diff --git a/caching.html b/caching.html new file mode 100644 index 0000000..ad6684c --- /dev/null +++ b/caching.html @@ -0,0 +1,326 @@ +Caching

Caching

+ + +

How to not shoot yourself in the foot

+

There are only two hard things in Computer Science: cache invalidation and naming things.

— Phil Karlton, Netscape
+

Was ist Caching?

  • Ich halte eine lokale Kopie von Daten für eine begrenzte Zeit

    → Ich tausche Speicher gegen $Vorteile

  • $Vorteile beinhalten:

    • Bessere Performance: Langsame Festplatten-, Netzwerk-, Datenbank-Zugriffe reduzieren; aufwendige (Neu-)Berechnungen gleicher Werte vermeiden

    • Lastvermeidung: Nicht/schlecht skalierbares (Legacy-)Backend schützen; Aufrufe kostenpflichtiger externer APIs minimieren

    • Fehlertoleranz: Weiterarbeiten können, obwohl ein externes System nicht erreichbar ist

+

Rahmenbedingungen

  • Möglichst hohe Cache Hit Rate

    → Anzahl der Anfragen, die aus dem Cache beantwortet werden können

  • Möglichst niedriger Speicherverbrauch

    → Begrenzt durch Kapazität und/oder Kosten

  • Möglichst keine Überalterung

    → Aktualisierungen vom Quellsystem mitbekommen

+

Cache Stampede

+

Cache Stampede

A cache stampede is a type of cascading failure that can occur when massively parallel computing systems with caching mechanisms come under very high load. This behaviour is sometimes also called dog-piling.

— Wikipedia
+

Eine typische Implementierung

public Value fetch(Key key) {
+    Value cachedValue = cache.getValue(key);
+    if (cachedValue == null) {
+        cachedValue = recompute(key);
+        cache.setValue(key, cachedValue);
+    }
+    return cachedValue;
+}
+
  • Einträge werden aus dem Cache geladen

  • Falls Eintrag nicht vorhanden ist (z.B. wegen Überalterung), wird er neu berechnet und im Cache abgelegt

  • Ideale Welt: Auf Einträge im Cache wird gleichverteilt zugegriffen

  • Cache Hit Rate von 80%, 100 Requests pro Sekunde

    → 80 aus dem Cache bedient, 20 neu berechnet

+

Es war einmal…​

  • Situation: Cache mit einem einzigen Eintrag

  • …​der von einem externen System kommt

  • …​für jeden Request gebraucht wird

  • …​und eine TTL von 4 Stunden hat

  • Cache Hit Rate von 100%, 20 Requests pro Sekunde

    → 20 aus dem Cache bedient, 0 an das externe System

+

😎

+

…​ein böses Erwachen

requests white 3
+

😢

+

TTL + 1 Sekunde

  • 20 Requests pro Sekunde

  • …​stellen fest, dass der Eintrag veraltet ist

  • …​laden den Eintrag neu vom externen System

    → 20 Requests pro Sekunde an das externe System

  • Ein Request dauert 6 Sekunden

  • 20 Requests pro Sekunde stellen 6 Sekunden lang fest, dass der Eintrag veraltet ist

    → 120 Requests an das externe System

  • Heißt auch: Unter Umständen 120 blockierte Ressourcen (Verbindungen, Threads, …​) und ein überlastetes externes System, längere Antwortzeiten, …​

+

Congestion Collapse

+

Was kann man tun?

  • Locking

  • Externe Aktualisierung

  • Probabilistic Early Expiration

+

Locking

  • Der erste Zugriff sperrt den Eintrag und berechnet ihn neu

  • Alle anderen warten auf die Aktualisierung

  • Nur ein Zugriff an das externe System

Implementierung

private Map<Key, CompletableFuture<Value>> pendingMap = new ConcurrentHashMap<>();
+
+public Value fetch(Key key) throws Exception {
+    Value cachedValue = cache.getValue(key);
+    if (cachedValue != null) {
+        return cachedValue;
+    }
+    CompletableFuture<Value> deferred = pendingMap.computeIfAbsent(key,
+        k -> CompletableFuture.supplyAsync(() -> {
+            Value value = recompute(k);
+            cache.setValue(k, value);
+            pendingMap.remove(k);
+            return value;
+        }));
+    return deferred.get();
+}
+

Einschränkungen

  • Synchronisierung ist komplex

    → Deadlocks, Starvation, …​

  • Zusätzliche Schreib- und Lesezugriffe für den Lock

  • Lock selbst braucht "passende" TTL

    → Weder zu lang noch zu kurz

  • "Alle anderen warten auf die Aktualisierung"

  • Plus: Locking im verteilten System?

    → Netzwerk, Latenz, …​

    +

    → Was, wenn genau der Knoten wegbricht, der gerade den Lock hat?

+

Externe Aktualisierung

  • Separater Prozess, der Einträge neu berechnet

    → Daemon Thread, Cronjob, manueller Trigger, …​

  • Einzelne Requests laden nicht mehr nach

  • Nur ein Zugriff an das externe System

  • Ermöglicht zeitgesteuerte Aktualisierung unabhängig von Requests (stündliche Reports, …​)

Implementierung

public Value fetch(Key key) {
+    return cache.getValue(key);
+}

Einschränkungen

  • Eine Komponente mehr, die betrieben werden will

    → Fallback, wenn der separate Prozess nicht funktioniert

  • Funktioniert nicht "on the fly"

    → Einträge basierend auf beliebigen Nutzereingaben?

  • Typischerweise deutlich höherer Speicherbedarf und unnötige Neuberechnungen

    → Nach welchen Kriterien aktualisieren?

    +

    → 1 Million Artikel, von denen 80% (fast) nie verkauft werden?

+

Probabilistic Early Expiration

  • Einträge aktualisieren, solange sie noch gültig sind

  • Der alte Eintrag bleibt im Cache und kann weiter verwendet werden

  • Prinzip: "Verhalte dich so als wäre es Jetzt + X"

    → X wird durch Wahrscheinlichkeitsfunktion zufällig bestimmt

  • Jeder Request hat die Chance, den Eintrag neu zu berechnen; die Wahrscheinlichkeit dafür steigt in Richtung TTL

  • Dank Wahrscheinlichkeitsfunktion auch verteilt ohne Synchronisation und Locking nutzbar

  • Verschiedene Wahrscheinlichkeitsfunktionen möglich

Paper

  • "Optimal Probabilistic Cache Stampede Prevention"

    Andrea Vattani, Flavio Chierichetti, Keegan Lowenstein

    +
  • Hier: Wahrscheinlichkeit steigt exponentiell in der Nähe der TTL, TTL wird möglichst gut eingehalten

  • Behauptung: Optimal für alle Anwendungsfälle

paper1
+
paper2

Die Wahrscheinlichkeitsfunktion

delta * beta * ln(random())

+
  • random: Zufallszahl zwischen 0 und 1

  • ln: natürlicher Logarithmus

  • delta: Zeitbedarf für Neuberechnung

  • beta: "Einstellknopf" - empfohlener Standard 1.0

    • > 1.0 bewirkt eher frühere Neuberechnung

    • < 1.0 bewirkt eher spätere (also näher an der tatsächlichen TTL)

  • Unabhängig von konkreter TTL

b1d10
+
b4d10
+
b1d40
+
b025d10

Implementierung

private double beta;
+
+public Value fetch(Key key) {
+    Item cachedItem = cache.getItem(key);
+    Instant now = Instant.now();
+    if (cachedItem == null
+            || now.plusSeconds(fetchEarly(beta, cachedItem.lastFetchDuration))
+                  .isAfter(cachedItem.expiresAt)) {
+        Value value = recompute(key);
+        Duration fetchDuration = Duration.between(Instant.now(), now);
+        Instant expiresAt = now.plusSeconds(ttlSeconds);
+        cachedItem = new Item(value, expiresAt, fetchDuration);
+        cache.setItem(key, cachedItem);
+    }
+    return cachedItem.value;
+}
+
+public long fetchEarly(double beta, Duration delta) {
+    return (long) (delta.toSeconds() * beta * -Math.log(Math.random()));
+}

Implementierungsdetail

  • Math.random() liefert [0, 1)

  • ln(0) ist mathematisch nicht definiert, geht gegen -Unendlich

  • Java kann das ab:

    jshell> (long)java.lang.Math.log(0)
    +$1 ==> -9223372036854775808
+
ln

Einschränkungen

  • Mehr Speicherverbrauch

  • Wahrscheinlichkeitsfunktion bietet keine Garantien

    • Trotzdem noch mehr als 1 Request gleichzeitig möglich (aber Größe der Stampede deutlich geringer)

    • Theoretisch auch direkt erneute Neuberechnung möglich (aber sehr unwahrscheinlich)

  • Hilft nicht bei leerem Cache

\ No newline at end of file diff --git a/going.mouseless.html b/going.mouseless.html new file mode 100644 index 0000000..181595d --- /dev/null +++ b/going.mouseless.html @@ -0,0 +1,322 @@ +Going (almost) mouseless

Going (almost) mouseless

+ + +

Some tips and tricks for more productivity

+

Why do you want to ditch your mouse?

  • "Every second counts"

  • Stay in the "flow"

  • More comfortable

+

The points of interest

Browser

+

Terminal

+

Intellij

+

Browser

  • Ctrl+T Open new tab

  • Ctrl+W Close current tab

  • Ctrl+Shift+T Reopen last closed tab

  • Ctrl+N Open new browser window

  • Ctrl+Tab Switch to next tab

  • Ctrl+Shift+Tab Switch to previous tab

  • Alt+Left Arrow Back

  • Alt+Right Arrow Forward

  • Space Scroll down a frame

  • Shift+Space Scroll up a frame

+

Browser

  • What if I want to click on a link?

  • What if I want to search for a specific tab?

  • Solution: vimium (github.com/philc/vimium)

+

Browser

Vimium
+

Browser

Vimium
+

Browser

Vimium
+

Terminal

Fix mistakes in prompt with vi-mode

+
set -o vi # in bashrc
+
+bindkey -v # in zshrc
+
+fish_vi_key_bindings # in .config/fish/config.fish
+

Terminal

Fix command with fc

+
fc # to fix the last executed command
+
+fc -l # to list previous commands
+
+fc -l 600 # to fix specific command
+

Terminal

Vimium
+

Terminal

+
tmux new -s session-name # start tmux session with a name
+
+Ctrl+b c # create new window
+
+Ctrl+b % # split window horizontally
+
+Ctrl+b " # split window vertically
+
+Ctrl+d # close pane or window
+
+Ctrl+b w # choose a window to open
+
+Ctrl+b d # detach from session
+
+tmux ls # list session
+
+tmux attach -t session-name # attach to session
+

Intellij

Ctrl+Shift+A: find action

+

Ctrl+E: recent file, window

+

Alt+1-9: open window

+

Ctrl+Shift+F12: hide all window

+

Ctrl+N: search class

+

Ctrl+Shift+N: search file

+

Ctrl+Shift+Alt+N: search symbols

+

2xShift: search everywhere

+

Intellij

Ctrl+Shift+T: open corresponding test class

+

Ctrl+Alt+Left/Right: go back/forward

+

Ctrl+Shift+E: recent location

+

Alt+Insert: context menu

+

Ctrl+Alt+V: extract

+

Ctrl+Shift+Enter: complete statement

+

Alt+/: hippie completion

+

Ctrl+Shift+Space: smart completion

+

Intellij

Ctrl+F12: navigate in file

+

Ctrl+Y: delete a line

+

Ctrl+D: duplicate a line

+

Ctrl+W: select code

+

Ctrl+Shift+Up/Down: move code

+

Shift+Alt+Up/Down: move line of code

+

Ctrl+Shift+V: choose content to paste

+

Ctrl+Tab: cycle through editor

+

Intellij

Shift+F6: rename for anything, that needs to be renamed

+

Ctrl+P: show parameters of a function

+

Ctrl+Shift+F: search in project

+

Ctrl+Shift+I: open quick definition look up

\ No newline at end of file diff --git a/index.html b/index.html new file mode 100644 index 0000000..5a42533 --- /dev/null +++ b/index.html @@ -0,0 +1,75 @@ + + + + + + + JUG-IN Talks + + +

Talks of the Java User Group Ingolstadt e.V.

+
+
+
+
Caching
+ View +
+
+
+
Going (almost) mouseless
+ View +
+
+
+
java.time
+ View +
+
+
+
JCP - The Java Community Process
+ View +
+
+
+
JDK 12
+ View +
+
+
+
JDK 15
+ View +
+
+
+
JDK 16
+ View +
+
+
+
JMH
+ View +
+
+
+
JUG Ingolstadt e.V.
+ View +
+
+
+
Software-Esoterik-1
+ View +
+
+
+
Software-Esoterik-2
+ View +
+
+
+
How to quit vim?
+ View +
+
+
+ + diff --git a/java.time.html b/java.time.html new file mode 100644 index 0000000..9f98f61 --- /dev/null +++ b/java.time.html @@ -0,0 +1,409 @@ +java.time

java.time

+ + +

Wer die Zeitzone nicht kennt hat schnell Weihnachten verpennt

+

Es war einmal…​

vor einigen Java Releases…​

in einer längst vergangenen Zeit…​

oder etwa doch nicht?

java.util.Date

Zeitpunkt in Millisekunden seit 1.1.1970

+
var date = new Date(System.currentTimeMillis());
+date.toString(); // Tue Dec 03 22:08:57 CET 2019
+// uses -Duser.timezone
+date.setTime(1231211251L); // Mutable!
+// + round about 350 @Deprecated Methods
+

🤮

java.util.Calendar

Ortsgebundene Zeit, über java.util.Date gestülpt

+
var cal = Calendar.getInstance(TimeZone.getDefault());
+/* Interface that uses many -Duser.* properties for
+ * selecting an implementation out of e.g.:
+ * GregorianCalendar,
+ * BuddhistCalendar or
+ * JapaneseImperialCalendar */
+cal.toString();
+// java.util.GregorianCalendar[time=1575409375587,areFieldsSet=true,areAllFieldsSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id="Europe/Berlin",offset=3600000,dstSavings=3600000,useDaylight=true,transitions=143,lastRule=java.util.SimpleTimeZone[id=Europe/Berlin,offset=3600000,dstSavings=3600000,useDaylight=true,startYear=0,startMode=2,startMonth=2,startDay=-1,startDayOfWeek=1,startTime=3600000,startTimeMode=2,endMode=2,endMonth=9,endDay=-1,endDayOfWeek=1,endTime=3600000,endTimeMode=2]],firstDayOfWeek=2,minimalDaysInFirstWeek=4,ERA=1,YEAR=2019,MONTH=11,WEEK_OF_YEAR=49,WEEK_OF_MONTH=1,DAY_OF_MONTH=3,DAY_OF_YEAR=337,DAY_OF_WEEK=3,DAY_OF_WEEK_IN_MONTH=1,AM_PM=1,HOUR=10,HOUR_OF_DAY=22,MINUTE=42,SECOND=55,MILLISECOND=587,ZONE_OFFSET=3600000,DST_OFFSET=0]
+cal.set(2019, 10, 12, 18, 30, 0); // Yeah!
+cal.setTimeInMillis(1231211251L); // What?
+

🤮🤮

java.text.SimpleDateFormat

Formatieren und parsen von java.util Zeiten

+
var sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSXXX");
+sdf.setTimeZone(TimeZone.getTimeZone("CET"));
+Date toFormat = Calendar.getInstance().getTime();
+String text = sdf.format(toFormat);
+// 2019-12-03T22:50:42.562+01:00
+
+Date parsed = sdf.parse(text);
+var cal = Calendar.getInstance();
+cal.setTime(parsed);
+

🤮🤮🤮

Arbeiten mit Calendar

Ohne (viele) Worte…​

+
var today = new Date();
+var tomorrow = new Date(today.getTime() + 1000 * 60 * 60 * 24);
+
+var now = Calendar.getInstance();
+now.add(Calendar.DAY_OF_WEEK_IN_MONTH, 1); // What?
+now.add(Calendar.HOUR, -2); // All right
+now.add(Calendar.HOUR_OF_DAY, 3); // ehhh?
+// BUT: now isn't now anymore!
+var sometime = (Calendar) now.clone();
+// ...
+

🤮🤮🤮🤮🤮🤮🤮🤮🤮🤮🤮🤮

+

Zeitzonen

Gibt’s zum Download im Internet: +https://www.iana.org/time-zones

IANA TZ Database

# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
+Rule	Germany	1947	only	-	Apr	 6	3:00s	1:00	S
+Rule	Germany	1947	only	-	May	11	2:00s	2:00	M
+Rule	Germany	1947	only	-	Jun	29	3:00	1:00	S
+Rule	Germany	1948	only	-	Apr	18	2:00s	1:00	S
+Rule	Germany	1949	only	-	Apr	10	2:00s	1:00	S
+
+Rule SovietZone	1945	only	-	May	24	2:00	2:00	M # Midsummer
+Rule SovietZone	1945	only	-	Sep	24	3:00	1:00	S
+Rule SovietZone	1945	only	-	Nov	18	2:00s	0	-
+
+# Zone	NAME		STDOFF	RULES	FORMAT	[UNTIL]
+Zone	Europe/Berlin	0:53:28 -	LMT	1893 Apr
+			1:00	C-Eur	CE%sT	1945 May 24  2:00
+			1:00 SovietZone	CE%sT	1946
+			1:00	Germany	CE%sT	1980
+			1:00	EU	CE%sT

Zeitzonen in Deutschland

# Büsingen <http://www.buesingen.de>, surrounded by the Swiss canton
+# Schaffhausen, did not start observing DST in 1980 as the rest of DE
+# (West Germany at that time) and DD (East Germany at that time) did.
+# DD merged into DE, the area is currently covered by code DE in ISO 3166-1,
+# which in turn is covered by the zone Europe/Berlin.
+#
+# Source for the time in Büsingen 1980:
+# http://www.srf.ch/player/video?id=c012c029-03b7-4c2b-9164-aa5902cd58d3
+
+Link	Europe/Zurich	Europe/Busingen

Java Zeitzonen

In der JRE enthalten:

+
$JAVA_HOME/lib/tzdb.dat
+$JAVA_HOME/lib/tzmappings

Java Laufzeit Umgebung

System Umgebung (System.getProperties())

+
user.variant:
+user.timezone:
+user.country: DE
+user.language: de
+

Benutzer Eigenschaften (System.getenv())

+
TZ: Europe/Berlin
+LANG: de_DE.UTF-8
+

Java 8: JSR 310

aber Rettung naht…​

java.time.LocalDate

var localDate = LocalDate.now();
+localDate.toString(); // 2019-12-04
+

Ein Tag. Irgendwo. Irgendwann.

java.time.LocalTime

var localTime = LocalTime.now();
+localTime.toString(); // 20:47:16.232363100
+

Ortszeit. Zeitanzeige der Uhr.

java.time.LocalDateTime

var localDateTime = LocalDateTime.now();
+localDateTime.toString();
+// 2019-12-04T20:47:16.231363900
+

Datum und Zeit zusammen.

java.time.OffsetTime

var offsetTime = OffsetTime.now();
+offsetTime.toString();
+// 20:47:16.234362400+01:00
+

Ortszeit inklusive Stundenversatz von Greenwich.

java.time.OffsetDateTime

var offsetDateTime = OffsetDateTime.now();
+offsetDateTime.toString();
+// 2019-12-04T20:47:16.233362900+01:00
+

VersatzDatumZeit.

java.time.ZonedDateTime

var zonedDateTime = ZonedDateTime.now();
+zonedDateTime.toString();
+// 2019-12-04T20:47:16.236364500+01:00[Europe/Berlin]
+

Volles Programm, Datum und Zeit, Offset und Zeitzone.

java.time.Instant

var instant = Instant.now();
+instant.toString();
+// 2019-12-04T19:47:16.090017700Z
+

Internetzeit. UTC. GMT.

+

Rausgeben und Einlesen

Standards

TemporalAccessor ta = Instant.now();
+var text = DateTimeFormatter.ISO_INSTANT.format(ta);
+// 2019-12-05T20:28:37.257047300Z
+ta = DateTimeFormatter.ISO_INSTANT.parse(text);
+
+// DateTimeFormatter.BASIC_ISO_DATE
+// DateTimeFormatter.ISO_WEEK_DATE
+// DateTimeFormatter.RFC_1123_DATE_TIME

Benutzerdefiniert

// import static java.time.temporal.ChronoField.*;
+var dtf = new DateTimeFormatterBuilder()
+        .parseCaseInsensitive()
+        .appendValue(HOUR_OF_DAY, 2).appendLiteral(":")
+        .appendValue(MINUTE_OF_HOUR, 2)
+        .appendLiteral(" Uhr am ")
+        .appendValue(DAY_OF_MONTH, 2).appendLiteral('.')
+        .appendValue(MONTH_OF_YEAR, 2).appendLiteral('.')
+        .appendValue(YEAR, 4).toFormatter();
+dtf.format(LocalDateTime.now());
+// 22:05 Uhr am 05.12.2019
+
+dtf.parse("18:30 uhr am 10.12.2019");

JSON Mapping

Jackson

+
new ObjectMapper()
+    .registerModule(new JavaTimeModule());
+

Gson

+
new GsonBuilder()
+    .registerTypeAdapterFactory(
+		new GsonJava8TypeAdapterFactory()
+	).create()
+

Zeitreisen / -rechnen

Grundrechenarten

var now = LocalDateTime.now();
+var nextWeek = now.plusDays(7); // Immutable
+var yesterday = now.minusHours(24);

Dauer und Perioden

var duration = Duration.ofDays(5).plus(Duration.ofHours(2));
+var sometimes = Instant.now().plus(duration);
+sometimes.isAfter(Instant.now());
+Duration.between(Instant.now(), sometimes);
+// PT121H59M59.9990012S
+
+Period.between(LocalDate.now(), LocalDate.of(2019, 12, 24));
+// P19D
+

Zeitzonentreue

var sixMonth = Period.ofMonths(6);
+
+var odtNow = OffsetDateTime.now();
+// 2019-12-06T20:39:54.717348800+01:00
+
+odtNow.plus(sixMonth).toString();
+// 2020-06-06T20:39:54.717348800+01:00

💩

und jetzt richtig

var sixMonth = Period.ofMonths(6);
+
+var zdt = ZonedDateTime.now();
+zdt.toOffsetDateTime().toString();
+// 2019-12-06T20:50:36.461772200+01:00
+
+zdt.plus(sixMonth).toOffsetDateTime();
+// 2020-06-06T20:50:36.461772200+02:00
+

📅

Konvertieren

var instant = Instant.now();
+ZonedDateTime zdt = instant.atZone(ZoneId.of("Europe/Berlin"));
+LocalDateTime ldt = zdt.toLocalDateTime();
+OffsetDateTime odt = ldt.atOffset(ZoneOffset.ofHours(4));
+zdt = odt.atZoneSameInstant(ZoneId.systemDefault());
+zdt = odt.atZoneSimilarLocal(ZoneId.systemDefault());
+zdt.toInstant();
+

🧮

+

Resümee

  • Konstanter Ort: Local[Date]Time

  • Ortsübergreifende Zeitpunktbetrachtung (API):

    • Instant

    • Offset[Date]Time

    • ZonedDateTime

  • Speichern / Rechnen:

    • Instant

    • ZonedDateTime

\ No newline at end of file diff --git a/jcp.html b/jcp.html new file mode 100644 index 0000000..9d28626 --- /dev/null +++ b/jcp.html @@ -0,0 +1,265 @@ +JCP - The Java Community Process

JCP - The Java Community Process

+ +
+

Celebrating 25 Years JCP

Cake
+
+

Purpose

There to continually evolve the Java platform with the help of the international Java developer community

— JCP Program

Goals

  • Enable the broader Java Community to participate in the proposal, selection, and development of Java APIs

  • Enable members of the Java Community to propose and carry-out new API development

  • Ensure that the process is faithfully followed by all participants

  • Ensure that each specification is backed by both a reference implementation and TCK

  • Help foster a good liaison between the Java Community and other bodies such as consortia, standards bodies, academic research groups, and non-profit organizations.

+

History

time1

History

time2

History

time3

History

time4

+

JCP Procedures

JSR Life Cycle Dec2018

Initiation

Specifications (JSRs) are

+
  • initiated by community members

  • approved for development by the Executive Committee

Draft Releases

Approved JSRs are

+
  • drafted by (on demand formed) expert groups

  • reviewed by the public

+

Experts are

+
  • nominated by JSPA members

  • lead the JSR through the process

+

JCP executive committee decides on public review ballot

Final Release

  • Expert Group revise into a Proposed Final Draft

  • Reference implementation and TCK get completed

  • Final approval by the Executive Committee

  • Spec, ref. Impl. and TCK get published

Maintenance

  • Clarification

  • Interpretation

  • Enhancements

  • Revisions

+

via issue tracker

+

Executive Committee decides on changes to a Spec, or pushes back to Expert Group

\ No newline at end of file diff --git a/jdk12.html b/jdk12.html new file mode 100644 index 0000000..b52e5c4 --- /dev/null +++ b/jdk12.html @@ -0,0 +1,320 @@ +JDK 12

JDK 12

+ + +

released 2019-03-19

+

189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)

Add a new garbage collection (GC) algorithm named Shenandoah which reduces GC pause times by doing evacuation work concurrently with the running Java threads. Pause times with Shenandoah are independent of heap size, meaning you will have the same consistent pause times whether your heap is 200 MB or 200 GB.

Notes

  • Created by Red Hat

  • Minimizes 'Stop-The-World' pauses

  • Handle terabytes of heap

  • Nearly full concurrent execution

  • Not contained in Oracle builds (but in others like AdaptOpenJDK)

Functioning

  • Concurrent Marking

  • Concurrent Cleanup

  • Concurrent Evacuation

  • Concurrent Update References

Concurrent Marking

  • Init Mark: Stop the World to identify the Root-Set

  • Traverse Root set, perform Tri-Color-Algorithm:

    • 'Black': Alive, references scanned

    • 'Grey': Alive, references not scanned yet

    • 'White': Unreachable or not alive ⇒ Garbage

  • Intercept Reference creation/deletion

    • Mark as 'Grey'

Tri-Color-Algorithm

strauch shenandoah 2

Concurrent Evacuation

  • Clear garbage only regions

  • Evacuate Regions with few living objects

  • Forward/Brooks pointer

Brooks Barrier

strauch shenandoah 11
+
strauch shenandoah 12

Configuration

    -XX:+UnlockExperimentalVMOptions
+    -XX:+UseShenandoahGC
+

Livecycle

shenandoah gc cycle

Conclusion

  • ParallelGC:

    • Handle STW pauses

  • Shenandoah:

    • Scale Hardware

+

230: Microbenchmark Suite

Add a basic suite of microbenchmarks to the JDK source code, and make it easy for developers to run existing microbenchmarks and create new ones.

+

325: Switch Expressions (Preview)

Extend the switch statement so that it can be used as either a statement or an expression, and that both forms can use either a "traditional" or "simplified" scoping and control flow behavior. These changes will simplify everyday coding, and also prepare the way for the use of pattern matching (JEP 305) in switch. This will be a preview language feature.

Syntax (Inline)

Switch expressions are able to return values

+
    var result = switch(value) {
+        case VALID -> "It's ok dude";
+        case INVALID, UNKOWN -> "Better think about it";
+    };

Syntax (Blocks)

var result = switch(integer) {
+    case 0,1 -> integer + " is a bit to low.";
+    case 2,3,5,7,11,13,17,19 -> integer + " is really prime!";
+    case 4,6,8,9,10,12,14,15,16,20 -> integer + " isn't prime!";
+    default -> {
+        if (IntStream.range(21, integer).anyMatch(nut -> integer % nut == 0)) {
+            break integer + " isn't that nice, pardon.";
+        } else {
+            break integer + " is a really high prime";
+        }
+    }
+};

Type inference

Number result = switch(integer) {
+    case 2,3 -> integer *2;
+    case 4,5 -> BigDecimal.valueOf(integer);
+    case 6,7 -> integer / 2d;
+    default -> (long) integer;
+};
+
Serializable result = switch(integer) {
+    case 0,1 -> "A bit";
+    case 2,3 -> integer *2;
+    case 4,5 -> BigDecimal.valueOf(integer);
+    default -> (long) integer;
+};
+
ConstantDesc result = switch(integer) {
+    case 0,1 -> "A bit";
+    case 2,3 -> integer *2;
+    default -> (long) integer;
+};
+

334: JVM Constants API

Introduce an API to model nominal descriptions of key class-file and run-time artifacts, in particular constants that are loadable from the constant pool.

java.lang.constant

java.lang.constant.Constable

Represents a type which is constable. A constable type is one whose values are constants that can be represented in the constant pool of a Java classfile as described in JVMS 4.4, and whose instances can describe themselves nominally as a ConstantDesc.

+

public interface Constable

+

Some constable types have a native representation in the constant pool:

+

String, Integer, Long, Double

java.lang.constant.ConstantDesc

Represents a type which is constable. A constable type is one whose values are constants that can be represented in the constant pool of a Java classfile as described in JVMS 4.4, and whose instances can describe themselves nominally as a ConstantDesc.

+

public interface Constable

+

340: One AArch64 Port, Not Two

Remove all of the sources related to the arm64 port while retaining the 32-bit ARM port and the 64-bit aarch64 port.

+

341: Default CDS Archives

Enhance the JDK build process to generate a class data-sharing (CDS) archive, using the default class list, on 64-bit platforms.

+

344: Abortable Mixed Collections for G1

Make G1 mixed collections abortable if they might exceed the pause target.

+

346: Promptly Return Unused Committed Memory from G1

Enhance the G1 garbage collector to automatically return Java heap memory to the operating system when idle.

+

Standard Library API Changes (excerpt)

ChangedAddedRemovedTotal

Types

343

21

0

4152

Members

486

286

9

49882

java.lang.Character

Constant for the "Chess Symbols" Unicode character block.

+
public static final Character.UnicodeBlock CHESS_SYMBOLS

java.lang.Class

Returns a Class for an array type whose component type is described by this Class.

+
public Class<?> arrayType()
+

Returns a nominal descriptor for this instance, if one can be constructed, or an empty Optional if one cannot be.

+
public Optional<ClassDesc> describeConstable()

java.lang.String

Adjusts the indentation of each line of this string based on the value of n, and normalizes line termination characters.

+
public String indent​(int n)
+

This method allows the application of a function to this string. The function should expect a single String argument and produce an R result.

+
public <R> R transform​(Function<? super String,? extends R> f)

java.nio.file.Files

Finds and returns the position of the first mismatched byte in the content of two files, or -1L if there is no mismatch. The position will be in the inclusive range of 0L up to the size (in bytes) of the smaller file.

+
public static long mismatch​(Path path, Path path2)

java.text.CompactNumberFormat

A concrete subclass of NumberFormat that formats a decimal number in its compact form. The compact number formatting is designed for the environment where the space is limited, and the formatted string can be displayed in that limited space.

+
public final class CompactNumberFormat extends NumberFormat

java.util.concurrent.CompletableFuture

Returns a new [CompletableFuture|CompletionStage] that, when this stage completes exceptionally, is executed with this stage’s exception as the argument to the supplied function

+
default CompletionStage<T> exceptionallyAsync​(
+    Function<Throwable,? extends T> fn)

java.util.concurrent.CompletionStage

Returns a new [CompletableFuture|CompletionStage] that, when this stage completes exceptionally, is composed using the results of the supplied function applied to this stage’s exception.

+
default CompletionStage<T> exceptionallyComposeAsync​(
+    Function<Throwable,? extends CompletionStage<T>> fn)

java.util.stream.Collectors

Returns a Collector that is a composite of two downstream collectors. Every element passed to the resulting collector is processed by both downstream collectors, then their results are merged using the specified merge function into the final result.

+
public static <T,R1,R2,R> Collector<T,?,R> teeing​(
+    Collector<? super T,?,R1> downstream1,
+    Collector<? super T,?,R2> downstream2,
+    BiFunction<? super R1,? super R2,R> merger)

java.net.ssl.HttpsURLConnection

Returns an Optional containing the SSLSession in use on this connection. Returns an empty Optional if the underlying implementation does not support this method.

+
public Optional<SSLSession> getSSLSession()
+

JDK 13

2019-06-13

Rampdown Phase One (fork)

2019-07-18

Rampdown Phase Two

2019-08-08

Initial Release Candidate

2019-08-22

Final Release Candidate

2019-09-17

General Availability

Resources

\ No newline at end of file diff --git a/jdk15.html b/jdk15.html new file mode 100644 index 0000000..0e3964c --- /dev/null +++ b/jdk15.html @@ -0,0 +1,308 @@ +JDK 15

JDK 15

+ + +

released 2020-11-10

+

Jochen Bürkle

+

Java Releases Roadmap

java releases
+

ORACLE Definitionen zum JDK

Preview

"A preview feature is a new feature whose design, specification, and implementation are complete, but which is not permanent, which means that the feature may exist in a different form or not at all in future JDK releases."

Preview Features müssen per Compiler- bzw. JVM-Runtime Parameter explizit freigeschaltet werden

ORACLE Definitionen zum JDK

Incubator

+

"Incubator modules are a means of putting non-final APIs and non-final tools in the hands of developers, while the APIs/tools progress towards either finalization or removal in a future release."

+
+

Java 15

+

JEP 381: Entfernung der Solaris and SPARC Ports

  • Aller Solaris/x64 spezifischer Source Code wurde entfernt

  • Aller Solaris/SPARC Architektur spezifischer Code wurde entfernt

  • Dokumentation und Quellcode wurde für zukünftige Releases angepasst

+

JEP 372: Entfernung der Nashorn JavaScript Engine

  • Bei Release war Nashorn eine vollständige Implementierung des ECMAScript-262 5.1 Standards

  • Die Wartung der sich schnell weiter entwickelnden Sprache war eine sehr große Herausforderung

+

Folgende zwei JVM-Module werden entfernt:

+
  • jdk.scripting.nashorn

    • Enthält die jdk.nashorn.api.scripting und jdk.nashorn.api.tree Packages

  • jdk.scripting.nashorn.shell

    • Enthält das jjs tool

+

JEP 383: Foreign-Memory Access API (Second Incubator)

"Einführung einer API mit der auf außerhalb des Java Heaps liegenden Speicher sicher und effizient zugegriffen werden kann"

  • Ziel: Einfache API um auf externen Speicher (native memory, persistent memory, managed heap memory) zugreifen zu können

  • Es wurde ein neues Modul jdk.incubator.foreign mit gleichnamigen Package eingeführt

Foreign-Memory Access API - Abstraktionen

Es wurden hauptsächlich 3 neue Abstraktionen eingeführt:

+
  • MemorySegment - modelliert einen zusammenhängenden Speicherbereich

  • MemoryAddress - modelliert eine Speicheradresse

    • checked: Offset in einem bestehenden Memory Segment

    • unchecked: Adresse deren räumliche und zeitliche Begrenzungen unbekannt sind (bspw. Speicheradresse nativer Speicher)

  • MemoryLayout - Programmatische Beschreibung des Inhalts eines Memory Segments

+

JEP 339: Edwards-Curve Digital Signature Algorithmus (EdDSA)

  • Zusätzlicher Signaturalgorithmus mittels elliptischer Kurven mit Vorteilen über bereits bestehende Algorithmen

  • Ersetzt nicht ECDSA

  • 126 Bits EdDSA ~= 128 Bits ECDSA

  • Plattformunabhängige Implementierung

  • (Nur) In SunEC-Provider verfügbar (Nicht zwangsweise in Anderen)

+

JEP 373: Überarbeitung der Legacy DatagramSocket API

  • java.net.DatagramSocket und java.net.MulticastSocket sind bereits seit Version 1.0 Teil von Java

  • Die bisherige Implementierung war eine Mischung aus veraltetem Java- und C-Code

  • Schwierig zu maintainen und zu debuggen

  • MulticastSocket im Besonderen war älter als die IPv6 Implementierungen

  • Die alte Implementierung war nicht NIO basiert

Neue Implementierung

ueberarbeitung ds
+

Quelle: ORACLE

+

JEP 374: Dekativierung und Deprecation von Biased Locking

  • Vor Java 15 war Biased Locking immer eingeschaltet und verfügbar

  • Biased Locking brachte vor allem vor Java 1.2 Performance-Vorteile (Hashtable, Vector)

  • Heute werden hauptsächlich nicht-synchronisierte Datenstrukturen verwendet

  • Biased Locking ist aufwändig zu maintainen, bei immer geringer werdendem Nutzen

+

Ab Java 15 ist Biased Locking per Standard deaktiviert

+

Wieder-einschalten mittels VM-Parameter -XX:+UseBiasedLocking

+

JEP 377: Zero GC und JEP 379: Shenandoah GC jetzt produktive Features

Die bereits in Java 12 eingeführten alternativen Garbage Collectors:

+
  • Zero GC

  • Shenandoah GC

+

sind nicht mehr experimentell und können ohne Freischaltung experimenteller Features genutzt werden.

+

JEP 358: Helpful NullPointerException *

Gibt zur Laufzeit detailliertere Informationen beim Auftreten einer NullPointerException

+
Exception in thread "main" java.lang.NullPointerException: Cannot invoke "String.compareTo(String)" because "a" is null
+	at b.j.j15.HelpfulNPE.f(HelpfulNPE.java:9)
+	at b.j.j15.HelpfulNPE.main(HelpfulNPE.java:5)
+
  • War bereits in Java 14 enthalten, dort aber standardmäßig deaktiviert

  • Ab Java 15 standardmäßig aktiviert

  • Kann via VM-Parameter -XX:-ShowCodeDetailsInExceptionMessages deaktiviert werden

+

Methoden-lokale Interfaces, Enums und Records *

    public static void main(String[] args) {
+        interface A { }
+        enum Languages { LATIN, FRENCH, GERMAN }
+        record C(A a, Languages l) { }
+        class B implements A { }
+    }
+

JEP 375: Pattern Matching für instanceof (Second Preview) *

aka Smart Cast light

+
    Object o = "Hallo JUG Ingolstadt";
+    if(o instanceof String s && s.length() > 3) {
+        s.indent(3);
+    }
+

JEP 378: Text Blocks *

Erlaubt es im Quelltext Multiline-String-Literale zu definieren

    public static void main(String[] args) {
+        String s = """
+           Franz jagt
+           im komplett verwahrlosten Taxi
+           quer durch Bayern
+           """;
+    }
  • Es handelt sich um ein einziges String-Literal

  • Compiler fügt bei jedem Zeilenumbruch plattformunabhängig ein \n ein

  • Die Einrückung orientiert sich am sich am weitesten nach links eingerückten Zeile

Text Blocks: weitere Eigenschaften

  • Soll der letzte Zeilenumbruch vermieden werden, muss der letzte """ hinter den Text

  • Programmatische Einrückung über neue String-Methode indent(int n)

  • Innerhalb des Textblocks dürfen einzelne " vorkommen

  • Kein Support für String-Templates

+

JEP 384: Records (Second Preview) *

Records sind immutable, Struct-artige Datenklassen

public record Car(String brand, String model, int horsepower) { }
  • Werden durch record Schlüsselwort eingeleitet

  • Erzeugung durch Aufruf des kanonischen Konstruktors

  • Immutable properties werden in einen kanonischen Konstruktor-Parameter übergeben

  • Deren Namen sind zugleich die Namen der Accessor-Methoden (Nicht Beans-konform)

  • equals() und hashCode() werden auf Basis der Properties-Werte generiert

Records: Weitere Eigenschaften

  • Weitere Konstruktoren können erstellt werden, diese müssen aber an den kanonischen delegieren

  • Die Immutability ist "flach"

    • Inhalte von Collections können verändert werden

    • Es wird nicht in immutable Collections umkopiert

  • Records können nicht von anderen Klassen erben

  • Andere Klassen können nicht von Records erben

  • Reflection-Unterstützung von Records

    • Class#isRecord()

    • Class#getRecordComponents()

+

JEP 360: Sealed Types *

Für sealed Typen (Interfaces, Klassen) können die Untertypen eingeschränkt werden.

Hierfür wurden folgende neue (Soft)-Schlüsselwörter eingeführt:

  • sealed

  • permits

  • non-sealed

Die Subtypen des sealed Typen müssen sich im gleichen Package (oder ggf. Modul) befinden

Der sealed Obertyp

public sealed class Vehicle permits Car, Truck, MoonRanger {
+}
+
  • sealed markiert Klasse als geschlossene Klasse

  • permits leitet die Liste der erlaubten Subtypen ein

Die Untertypen des sealed Typs

Ein Untertyp eines sealed Typs muss einer der folgenden Eigenschaften besitzen:

+
  • selbst wieder eine sealed Typ sein

  • ein final er Typ sein (Keine weiterverbung möglich)

  • ein non-sealed Typ sein

+
public final class Car extends Vehicle { }
+public sealed class Truck extends Vehicle permits MonsterTruck { }
+public non-sealed class MoonRanger extends Vehicle{ }
+

Befinden sich alle Klassen in einer Datei, kann permits am sealed Typen weggelassen werden

Reflection-Unterstützung für sealed Typen

  • boolean : Class # isSealed()

  • ClassDesc[] : Class # permittedSubclasses()

+

JEP 371: Hidden Classes

  • Erlaubt es, Klassen zu erzeugen, die nicht direkt durch den Bytecode andere Klassen verwendet werden kann

  • Diese Klassen sollen nur von den Frameworks verwendet werden, die sie erzeugt haben - indirekt via Reflection

  • Erlaubt die Deprecation von sun.misc.Unsafe::defineAnonymousClass

\ No newline at end of file diff --git a/jdk16.html b/jdk16.html new file mode 100644 index 0000000..a61737a --- /dev/null +++ b/jdk16.html @@ -0,0 +1,360 @@ +JDK 16

JDK 16

+ + +

released 2021-03-16

+

JEP 396: Strongly Encapsulate JDK Internals by Default

Zugriff auf JDK interne Klassen, Methoden oder Felder wird - bis auf ein paar kritische Ausnahmen wie z.B. sun.misc.Unsafe - bei Strafe untersagt.

+
  • < JDK16: --illegal-access=permit

  • >= JDK16: --illegal-access=deny (Deprecated)

+

Feingranular: --add-opens java.base/java.util=ALL-UNNAMED

+

JEP 390: Warnings for Value-based Classes

Annotation @jdk.internal.ValueBased für "value-based" Klassen wie z.B. Integer.

+
  • Synchronisierung darauf führt zur Compiler Warnung.

  • Value Semantik soll etabliert werden.

  • Flag -XX:DiagnoseSyncOnValueBasedClasses führt zu entsprechenden Laufzeitwarnungen.

  • Konstruktoren dieser Klassen wie Integer(int) und Integer(String) wurden "Deprecated for removal".

+

JEP 389: Foreign Linker API (Incubator)

  • Statisch typisierter Zugriff auf nativen Code.

  • Vereinfachung des fehlerbehafteten Zugriff auf native Bibliotheken.

  • Ersatz für JNI.

+
MethodHandle strlen = CLinker.getInstance().downcallHandle(
+        LibraryLookup.ofDefault().lookup("strlen"),
+        MethodType.methodType(long.class, MemoryAddress.class),
+        FunctionDescriptor.of(C_LONG, C_POINTER)
+    );
+
+try (MemorySegment str = CLinker.toCString("Hello")) {
+   long len = strlen.invokeExact(str.address()); // 5
+}
+

JEP 393: Foreign-Memory Access API (Third Incubator)

  • API für sicheren und effizienten Zugriff auf fremden Memory außerhalb des Java Heap.

  • Ersatz für sun.misc.Unsafe.

+
VarHandle intHandle = MemoryHandles.varHandle(int.class,
+        ByteOrder.nativeOrder());
+
+try (MemorySegment segment = MemorySegment.allocateNative(100)) {
+    for (int i = 0; i < 25; i++) {
+        intHandle.set(segment, i * 4, i);
+    }
+}
+

Add InvocationHandler::invokeDefault Method for Proxy’s Default Method Support

  • Neue Methode invokeDefault wurde dem java.lang.reflect.InvocationHandler Interface hinzufügt.

  • Ermöglicht den Aufruf von default Methoden in Proxy Interfaces.

+

JEP 380: Unix domain sockets

Unterstützung für Unix domain sockets (AF_UNIX) wurde den java.nio.channels Klassen hinzugefügt.

+

Day Period Support Added to java.time Formats

Neues Formatter Pattern B in +java.time.format.DateTimeFormatter +und DateTimeFormatterBuilder +nach Unicode Technical Standard #35 Part 4 Section 2.3.

Locale and time dependent

int hour;
+DateTimeFormatter.ofPattern("B").format(LocalTime.now().withHour(hour));
+
+/* default Locale = GERMAN */
+// hour 0-4: "nachts"
+// hour 5-9: "morgens"
+// hour 10-11: "vormittags"
+// hour 12: "mittags"
+// hour 13-17: "nachmittags"
+// hour 18-23: "abends"
+
+/* default Locale = ENGLISH */
+// hour 0-5: "at night"
+// hour 6-11: "in the morning"
+// hour 12-17: "in the afternoon"
+// hour 18-20: "in the evening"
+// hour 21-23: "at night"
+

Add Stream.toList() Method

List<String> list = Stream.of("This", "is", "useful").toList();
+

JEP 338: Vector API (Incubator)

jdk.incubator.vector Klassen, z.B. IntVector, FloatVector.

+
  • Unmittelbare Unterstützung sogenannter "Single Instruction Multiple Data (SIMD)" CPU Befehlssätze.

  • Architektur agnositisch, Software Fallback.

+
FloatVector va = FloatVector.fromArray(a, 0), vb = FloatVector.fromArray(b, 0);
+FloatVector vc = va.mul(va).add(vb.mul(vb)).neg();
+}
+
+// similar to
+for (int i = 0; i < a.length; i++) {
+        c[i] = (a[i] * a[i] + b[i] * b[i]) * -1.0f;
+}
+

Improved CompileCommand Flag

CompilerCommand war bisher Fehleranfällig aufgrund dynamischer Parameterlisten:

+

-XX:CompileCommand=option,<method pattern>,<option name>,<value type>,<value>

+

Dies ist nun für jede Option separat zu verwenden, es erfolgt eine Validierung und hilfreiche Fehlermeldungen:

+

-XX:CompileCommand=<option name>,<method pattern>,<value>

+

Concurrently Uncommit Memory in G1

G1 Garbage Collector verlagert die aufwändigen Prozesse aus der GC Pause in einen nebenläufigen Thread.

+

JEP 376: ZGC Concurrent Stack Processing

Z Garbage Collector verarbeitet Thread Stacks nun nebenläufig, damit wird die GC Pause des ZGC konstant im Bereich von ein paar Hundert Mikrosekunden.

+

New jdk.ObjectAllocationSample Event Enabled by Default

Neues Java-Flight-Recorder Ereignis jdk.ObjectAllocationSample eingeführt, das ein ständiges Allocation Profiling mit geringen Overhead ermöglicht.

+

JEP 387: Elastic Metaspace

  • VM-interne Metaspace und Class-Space implementierungen überarbeitet mit dem Ergebnis des geringeren Speicherverbrauchs.

  • Neuer Schalter: XX:MetaspaceReclaimPolicy=(balanced|aggressive|none)

  • Schalter InitialBootClassLoaderMetaspaceSize und UseLargePagesInMetaspace deprecated.

+ +

SUN, SunRsaSign, and SunEC Providers Supports SHA-3 Based Signature Algorithms

SHA-3 Unterstützung zu den genannten Providern hinzugefügt.

+

Signed JAR Support for RSASSA-PSS and EdDSA

  • Die genannten Alorithmen werden vom JarSigner unterstützt.

  • Erzeugen von RFC 5652 und RFC 6211 Signaturen.

+

Added -trustcacerts and -keystore Options to keytool -printcert and -printcrl Commands

Die keytool Optionen -printcert und -printcrl haben die Optionen -trustcacerts und -keystore erhalten.

+ +

Improve Certificate Chain Handling

Neue System Properties: +* jdk.tls.maxHandshakeMessageSize +* jdk.tls.maxCertificateChainLength

+

Improve Encoding of TLS Application-Layer Protocol Negotiation (ALPN) Values

Verbesserungen im SunJSSE Provider für TLS Protokoll Verhandlungen.

+

TLS Support for the EdDSA Signature Algorithm

EdDSA Signatur Unterstützung für den SunJSSE Provider.

+

JEP 395: Records

Neue Klassenart als vollwertiges Sprachelement für unveränderliche Daten.

+
record JavaTreff(LocalDate day, String... topics) {}
+
+var jt = new JavaTreff(LocalDate.now(), "Java 16");
+LocalDate when = jt.day();
+String[] what = jt.topics();
+jt.hashCode(); jt.toString(); jt.equals(other);
+

JEP 394: Pattern Matching for instanceof

Das instanceof Pattern Matching (seit JDK 14) ist nun vollwertiges Sprachfeature:

+
Number n = getNumber();
+if (n instanceof Integer i) { }
+if (n instanceof Float f) { }
+

JEP 397: Sealed Classes (Second Preview)

Sealed Classes bleiben ein Preview Feature, Records werden unterstützt:

+
public sealed interface Expr
+permits ConstantExpr, PlusExpr, TimesExpr, NegExpr { ... }
+
+public record ConstantExpr(int i)       implements Expr { ... }
+public record PlusExpr(Expr a, Expr b)  implements Expr { ... }
+public record TimesExpr(Expr a, Expr b) implements Expr { ... }
+public record NegExpr(Expr e)           implements Expr { ... }
+

JEP 392: Packaging Tool

Das Tool jpackage (seit JDK 14) verlässt den Incubator Status und gilt nun als produktionsreif.

+

Entfernte Features und Optionen

  • Removal of java.awt.PeerFixer

  • Removal of Experimental Features AOT and Graal JIT

  • Deprecated Tracing Flags Are Obsolete and Must Be Replaced With Unified Logging Equivalents

  • Removed Root Certificates with 1024-bit Keys

  • Removal of Legacy Elliptic Curves

+

Deprecated Features und Optionen

  • Terminally Deprecated ThreadGroup stop, destroy, isDestroyed, setDaemon and isDaemon

  • Parts of the Signal-Chaining API Are Deprecated

  • Deprecated the java.security.cert APIs That Represent DNs as Principal or String Objects

+

Bekannte Probleme

  • Incomplete Support for Unix Domain Sockets in Windows 2019 Server

  • TreeMap.computeIfAbsent Mishandles Existing Entries Whose Values Are null

+

Sonstige Änderungen und Fehlerbehebungen 1

  • Line Terminator Definition Changed in java.io.LineNumberReader

  • Enhanced Support of Proxy Class

  • Support Supplementary Characters in String Case Insensitive Operations

  • Module::getPackages Returns the Set of Package Names in This Module

+

Sonstige Änderungen und Fehlerbehebungen 2

  • Proxy Classes Are Not Open for Reflective Access

  • HttpClient.newHttpClient and HttpClient.Builder.build Might Throw UncheckedIOException

  • The Default HttpClient Implementation Returns Cancelable Futures

  • HttpPrincipal::getName Returned Incorrect Name

+

Sonstige Änderungen und Fehlerbehebungen 3

  • (fs) NullPointerException Not Thrown When First Argument to Path.of or Paths.get Is null

  • US/Pacific-New Zone Name Removed as Part of tzdata2020b

  • Argument Index of Zero or Unrepresentable by int Throws IllegalFormatException

  • GZIPOutputStream Sets the GZIP OS Header Field to the Correct Default Value

+

Sonstige Änderungen und Fehlerbehebungen 4

  • Refine ZipOutputStream.putNextEntry() to Recalculate ZipEntry’s Compressed Size

  • java.util.logging.LogRecord Updated to Support Long Thread IDs

  • Support for CLDR Version 38

  • Added Property to Control LDAP Authentication Mechanisms Allowed to Authenticate Over Clear Connections

+

Sonstige Änderungen und Fehlerbehebungen 5

  • LDAP Channel Binding Support for Java GSS/Kerberos

  • Make JVMTI Table Concurrent

  • Object Monitors No Longer Keep Strong References to Their Associated Object

  • IncompatibleClassChangeError Exceptions Are Thrown For Failing 'final' Checks When Defining a Class

+

Sonstige Änderungen und Fehlerbehebungen 6

  • Upgraded the Default PKCS12 Encryption and MAC Algorithms

  • Added Entrust Root Certification Authority - G4 certificate

  • Added 3 SSL Corporation Root CA Certificates

  • Disable TLS 1.0 and 1.1

+

Sonstige Änderungen und Fehlerbehebungen 7

  • Annotation Interfaces May Not Be Declared As Local Interfaces

  • C-Style Array Declarations Are Not Allowed in Record Components

  • DocLint Support Moved to jdk.javadoc Module

  • Eliminating Duplication in Simple Documentation Comments

+

Sonstige Änderungen und Fehlerbehebungen 8

  • Viewing API Documentation on Small Devices

  • API Documentation Links to Platform Documentation

  • Improvements for JavaDoc Search

\ No newline at end of file diff --git a/jmh.html b/jmh.html new file mode 100644 index 0000000..b13436b --- /dev/null +++ b/jmh.html @@ -0,0 +1,449 @@ +JMH

JMH

+ + +

Java Microbenchmark Harness

+

Java Benchmarking

  • JIT Optimization

  • Reproduction

  • Concurrency

+

Configuration

at the example of maven (what else)

Dependencies

<dependencies>
+    <dependency>
+        <groupId>org.openjdk.jmh</groupId>
+        <artifactId>jmh-core</artifactId>
+        <version>1.21</version>
+    </dependency>
+    <dependency>
+        <groupId>org.openjdk.jmh</groupId>
+        <artifactId>jmh-generator-annprocess</artifactId>
+        <version>1.21</version>
+    </dependency>
+</dependencies>

Build

<plugin>
+    <groupId>org.apache.maven.plugins</groupId>
+    <artifactId>maven-shade-plugin</artifactId>
+    <version>3.2.1</version>
+    <executions>
+        <execution>
+            <phase>package</phase>
+            <goals><goal>shade</goal></goals>
+            <configuration>
+                <finalName>benchmarks</finalName>
+                <transformers>
+                    <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
+                        <mainClass>org.openjdk.jmh.Main</mainClass>
+                    </transformer>
+                </transformers>
+                <filters><filter>
+                    <artifact>*:*</artifact>
+                    <excludes>
+                        <exclude>META-INF/*.SF</exclude>
+                        <exclude>META-INF/*.DSA</exclude>
+                        <exclude>META-INF/*.RSA</exclude>
+                    </excludes>
+                </filter></filters>
+            </configuration>
+        </execution>
+    </executions>
+</plugin>

Execution

java -jar target/benchmarks.jar

+

Creating Tests

Simplest case

import org.openjdk.jmh.annotations.Benchmark;
+
+public class SomethingPerformanceCritical {
+    @Benchmark
+    public void testMePlenty() {
+        // Doing heavy calculation stuff
+    }
+}

Configuration Overview

@Benchmark
+@BenchmarkMode({Mode.Throughput, Mode.SingleShotTime, Mode.SampleTime, Mode.AverageTime, Mode.All})
+@Fork(warmups=5, value = 5)
+@Measurement(iterations = 5, time = 5, timeUnit = TimeUnit.SECONDS)
+@OperationsPerInvocation(1)
+@OutputTimeUnit(TimeUnit.SECONDS)
+@Threads(5)
+@Timeout(time = 100, timeUnit = TimeUnit.MILLISECONDS)
+@Warmup(iterations = 5, time = 5, timeUnit = TimeUnit.SECONDS)
+public void configure() {}

Modes

@BenchmarkMode

+
  • Throughput → Ops per second

  • Average Time → Avg duration

  • Sample Time → Duration statistics (min, max…​)

  • Single Shot Time → Time for single, cold execution

  • All

State

@State (Thread, Group, Benchmark), +@Setup, @TearDown

+
@State(Scope.Thread)
+public static class MyState {
+    public int a = 1;
+    public int b = 2;
+    public int sum ;
+}
+
+@Benchmark @BenchmarkMode(Mode.Throughput) @OutputTimeUnit(TimeUnit.MINUTES)
+public void testMethod(MyState state) {
+    state.sum = state.a + state.b;
+}
+

Remarks

  • Loop Optimizations

  • Dead Code Elimination

+
@Benchmark
+public void testMethod(Blackhole blackhole) {
+    // (...)
+    blackhole.consume(computationResult);
+}
+

Output

Example

# JMH version: 1.21
+# VM version: JDK 12, OpenJDK 64-Bit Server VM, 12+33
+# VM invoker: C:\Java\jdk12\bin\java.exe
+# VM options: --enable-preview
+# Warmup: 1 iterations, 5 s each
+# Measurement: 2 iterations, 5 s each
+# Timeout: 10 min per iteration
+# Threads: 1 thread, will synchronize iterations
+# Benchmark mode: Average time, time/op
+# Benchmark: bayern.jugin.jmh.LoopingComparison.imperativeLoop
+
+# Run progress: 0,00% complete, ETA 00:02:15
+# Warmup Fork: 1 of 1
+# Warmup Iteration   1: 2,941 ms/op
+Iteration   1: 2,206 ms/op
+Iteration   2: 2,273 ms/op
+
+# Run progress: 11,11% complete, ETA 00:02:03
+# Fork: 1 of 2
+# Warmup Iteration   1: 3,094 ms/op
+Iteration   1: 2,279 ms/op
+Iteration   2: 2,388 ms/op
+
+# Run progress: 22,22% complete, ETA 00:01:48
+# Fork: 2 of 2
+# Warmup Iteration   1: 2,651 ms/op
+Iteration   1: 2,283 ms/op
+Iteration   2: 2,335 ms/op
+
+
+Result "bayern.jugin.jmh.LoopingComparison.imperativeLoop":
+  2,321 |(99.9%) 0,331 ms/op [Average]
+  (min, avg, max) = (2,279, 2,321, 2,388), stdev = 0,051
+  CI (99.9%): [1,990, 2,653] (assumes normal distribution)
+
+
+# JMH version: 1.21
+# VM version: JDK 12, OpenJDK 64-Bit Server VM, 12+33
+# VM invoker: C:\Java\jdk12\bin\java.exe
+# VM options: --enable-preview
+# Warmup: 1 iterations, 5 s each
+# Measurement: 2 iterations, 5 s each
+# Timeout: 10 min per iteration
+# Threads: 1 thread, will synchronize iterations
+# Benchmark mode: Average time, time/op
+# Benchmark: bayern.jugin.jmh.LoopingComparison.iteratorLoop
+
+# Run progress: 33,33% complete, ETA 00:01:32
+# Warmup Fork: 1 of 1
+# Warmup Iteration   1: 2,747 ms/op
+Iteration   1: 2,216 ms/op
+Iteration   2: 2,241 ms/op
+
+# Run progress: 44,44% complete, ETA 00:01:17
+# Fork: 1 of 2
+# Warmup Iteration   1: 2,903 ms/op
+Iteration   1: 2,238 ms/op
+Iteration   2: 2,292 ms/op
+
+# Run progress: 55,56% complete, ETA 00:01:01
+# Fork: 2 of 2
+# Warmup Iteration   1: 3,200 ms/op
+Iteration   1: 2,476 ms/op
+Iteration   2: 3,241 ms/op
+
+
+Result "bayern.jugin.jmh.LoopingComparison.iteratorLoop":
+  2,562 |(99.9%) 2,999 ms/op [Average]
+  (min, avg, max) = (2,238, 2,562, 3,241), stdev = 0,464
+  CI (99.9%): [? 0, 5,560] (assumes normal distribution)
+
+
+# JMH version: 1.21
+# VM version: JDK 12, OpenJDK 64-Bit Server VM, 12+33
+# VM invoker: C:\Java\jdk12\bin\java.exe
+# VM options: --enable-preview
+# Warmup: 1 iterations, 5 s each
+# Measurement: 2 iterations, 5 s each
+# Timeout: 10 min per iteration
+# Threads: 1 thread, will synchronize iterations
+# Benchmark mode: Average time, time/op
+# Benchmark: bayern.jugin.jmh.LoopingComparison.rangeLoop
+
+# Run progress: 66,67% complete, ETA 00:00:46
+# Warmup Fork: 1 of 1
+# Warmup Iteration   1: 4,193 ms/op
+Iteration   1: 2,997 ms/op
+Iteration   2: 2,359 ms/op
+
+# Run progress: 77,78% complete, ETA 00:00:30
+# Fork: 1 of 2
+# Warmup Iteration   1: 2,860 ms/op
+Iteration   1: 2,241 ms/op
+Iteration   2: 2,815 ms/op
+
+# Run progress: 88,89% complete, ETA 00:00:15
+# Fork: 2 of 2
+# Warmup Iteration   1: 3,072 ms/op
+Iteration   1: 2,355 ms/op
+Iteration   2: 2,269 ms/op
+
+
+Result "bayern.jugin.jmh.LoopingComparison.rangeLoop":
+  2,420 |(99.9%) 1,730 ms/op [Average]
+  (min, avg, max) = (2,241, 2,420, 2,815), stdev = 0,268
+  CI (99.9%): [0,690, 4,150] (assumes normal distribution)
+
+
+# Run complete. Total time: 00:02:19
+
+REMEMBER: The numbers below are just data. To gain reusable insights, you need to follow up on
+why the numbers are the way they are. Use profilers (see -prof, -lprof), design factorial
+experiments, perform baseline and negative tests that provide experimental control, make sure
+the benchmarking environment is safe on JVM/OS/HW level, ask for reviews from the domain experts.
+Do not assume the numbers tell you what you want them to tell.
+
+Benchmark                         Mode  Cnt  Score   Error  Units
+LoopingComparison.imperativeLoop  avgt    4  2,321 | 0,331  ms/op
+LoopingComparison.iteratorLoop    avgt    4  2,562 | 2,999  ms/op
+LoopingComparison.rangeLoop       avgt    4  2,420 | 1,730  ms/op
\ No newline at end of file diff --git a/node_modules/asciidoctor-plantuml/LICENSE b/node_modules/asciidoctor-plantuml/LICENSE new file mode 100644 index 0000000..cc39510 --- /dev/null +++ b/node_modules/asciidoctor-plantuml/LICENSE @@ -0,0 +1,7 @@ +ISC License (ISC) + +Copyright Evgeny Shepelyuk and contributors + +Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/asciidoctor-plantuml/README.adoc b/node_modules/asciidoctor-plantuml/README.adoc new file mode 100644 index 0000000..900769e --- /dev/null +++ b/node_modules/asciidoctor-plantuml/README.adoc @@ -0,0 +1,227 @@ += Asciidoctor PlantUML Extension +:plantuml-server-public: http://www.plantuml.com/plantuml +:antora-link: https://antora.org[Antora] +:toc: macro +:icons: font + +Extension for https://github.com/asciidoctor/asciidoctor.js[Asciidoctor.js] that provides integration with http://plantuml.com[PlantUML] +using https://github.com/plantuml/plantuml-server[PlantUML Server] + +ifdef::env-github[] + +image:https://img.shields.io/travis/eshepelyuk/asciidoctor-plantuml.js?style=for-the-badge&logo=travis[Travis (.org), link="https://travis-ci.org/eshepelyuk/asciidoctor-plantuml.js"] image:https://img.shields.io/npm/v/asciidoctor-plantuml?style=for-the-badge&logo=npm["npm version", link="https://www.npmjs.com/package/asciidoctor-plantuml"] image:https://img.shields.io/badge/code_style-standardjs-brightgreen?style=for-the-badge[StandardJS, link="https://standardjs.com"] + +endif::[] + +toc::[] + +== Overview + +This extension mimics the behavior of the PlantUML support in https://asciidoctor.org/docs/asciidoctor-diagram[Asciidoctor Diagram] as closely as possible. +Positional and named attributes as well as PNG and SVG formats are supported. + +.PlantUML example +---- +[plantuml#myId,mydiagram,svg,role=sequence] <1> <2> <3> +.... +alice -> bob +.... +---- +<1> block style modifiers are supported +<2> positional attributes are supported +<3> named attributes are supported + +Unlike _Asciidoctor Diagram_, this extension uses https://github.com/plantuml/plantuml-server[PlantUML server] for displaying images. +The default behavior is that generated `image` tags will have the `src` attribute contain a link to a PlantUML server. + +[NOTE] +==== +Since the _PlantUML server_ supports some other formats, it's possible to use the http://ditaa.sourceforge.net/[Ditaa] and http://www.graphviz.org/doc/info/lang.html[Graphiz (DOT)] syntax as well. +Check the http://plantuml.com/[PlantUML website] for the complete list of supported diagrams. +==== + +.Ditaa example +---- +[ditaa] +.... ++----------+ +-------------+ +|cAAA | | | +| +---+ Application | +| Database | | cRED{d}| +| {s}| +-------------+ ++----------+ +.... +---- + +NOTE: Only PNG generation is supported for Ditaa diagrams. + +.Graphviz (DOT) example +---- +[graphviz] +.... +digraph foo { + node [style=rounded] + node1 [shape=box] + node2 [fillcolor=yellow, style="rounded,filled", shape=diamond] + node3 [shape=record, label="{ a | b | c }"] + + node1 -> node2 -> node3 +} +.... +---- + +=== PlantUML server + +https://github.com/plantuml/plantuml-server[PlantUML server] is a standalone web application exposing an HTTP API that allows generating diagram images on the fly. + +It can be used in two modes: + +* Public instance, for example this one {plantuml-server-public}. +* For performance reason it's recommended to use private one. ++ +One could easily deploy it as Docker container as described in https://github.com/plantuml/plantuml-server#how-to-run-the-server-with-docker[README]. + + $ docker run -d -p 8080:8080 plantuml/plantuml-server:jetty + +=== Configuration + +Extension behaviour can be configured via http://asciidoctor.org/docs/user-manual/#attributes[Asciidoctor attributes]. + +.Supported global or page configuration attributes +[cols="3,9"] +|=== +|Attribute |Description + +|plantuml-server-url +| *mandatory* PlantUML Server instance URL. Will be used for generating diagram `src`. E.g. http://www.plantuml.com/plantuml + +|plantuml-fetch-diagram +|If set, images will be downloaded and saved to local folder. `img` tags will be pointing to local folder. +Otherwise, `img` tags will have `src` attribute pointing to `:plantuml-server-url:` + +|imagesoutdir +|Analogue of https://asciidoctor.org/docs/asciidoctor-diagram/#image-output-location[Asciidoctor Diagram] attribute. +E.g. `./assets/images` + +|plantuml-config-file +|Analogue of https://github.com/asciidoctor/asciidoctor-diagram#plantuml[PlantUML config] attribute. + +|plantuml-default-format +|Sets the default output format, which is normally `png`. This can be overriden in a specific diagram with the `format` attribute. + +|plantuml-default-options +|Sets the default for the `options` attribute. May be set to `inline` for inline svg, or `interactive` for interactive object. + +|=== + +== Antora integration + +Integration is just the matter of enabling the extension in https://docs.antora.org/antora/2.0/playbook/[site playbook] +and providing address of PlantUML server via extension's config. + +There's https://github.com/eshepelyuk/asciidoctor-plantuml-antora[sample repository] demonstrating usage of this extension in `Antora`. + +== Asciidoctor.js integration + +=== Using in Node.JS + +Install dependencies:: + + $ yarn add asciidoctor.js asciidoctor-plantuml + +Create file with following content and run it:: ++ +[source,javascript] +[subs="verbatim,attributes"] +.plantuml.js +.... +const asciidoctor = require('asciidoctor.js')(); +const plantuml = require('asciidoctor-plantuml'); + +const asciidocContent = ` +== PlantUML +:plantuml-server-url: {plantuml-server-public} <1> +[plantuml] +---- +alice -> bob +bob ..> alice +---- +`; + +plantuml.register(asciidoctor.Extensions); +console.log(asciidoctor.convert(asciidocContent)); <2> + +const registry = asciidoctor.Extensions.create(); +plantuml.register(registry); +console.log(asciidoctor.convert(asciidocContent, {'extension_registry': registry})); <3> + +.... +<1> it's possible to configure different URL for PlantUML server using Asciidoctor attribute +<2> usage with global extension registry +<3> usage with custom registry + +=== Using in browser + +Install dependencies:: + + $ yarn add asciidoctor.js asciidoctor-plantuml + +Create file with following content and open in in browsert:: ++ +[source,html] +[subs="verbatim,attributes"] +.plantuml.html +.... + + + + + + + + + + +.... +<1> it's possible to configure different URL for PlantUML server using Asciidoctor attribute +<2> usage with global extension registry +<3> usage with custom registry + +=== Output + +Regardless of global or custom registry usage, produced HTML output will look like + +[source,html] +[subs="verbatim,attributes"] +---- +
+

PlantUML

+
+
+
+diagram +
+
+
+
+---- diff --git a/node_modules/asciidoctor-plantuml/README.md b/node_modules/asciidoctor-plantuml/README.md new file mode 100644 index 0000000..d19554c --- /dev/null +++ b/node_modules/asciidoctor-plantuml/README.md @@ -0,0 +1,3 @@ +Please visit [project home page](https://github.com/eshepelyuk/asciidoctor-plantuml.js) for the complete README. + +And please vote for [Asciidoctor README support](https://github.com/npm/www/issues/42) in NPM diff --git a/node_modules/asciidoctor-plantuml/dist/node/asciidoctor-plantuml.js b/node_modules/asciidoctor-plantuml/dist/node/asciidoctor-plantuml.js new file mode 100644 index 0000000..ee0a986 --- /dev/null +++ b/node_modules/asciidoctor-plantuml/dist/node/asciidoctor-plantuml.js @@ -0,0 +1,196 @@ +const plantumlEncoder = require('plantuml-encoder') +const fs = require('fs') + +/** + * Convert an (Opal) Hash to JSON. + * @private + */ +const fromHash = function (hash) { + const object = {} + const data = hash.$$smap + for (let key in data) { + object[key] = data[key] + } + return object +} + +function UnsupportedFormat (message) { + this.name = 'UnsupportedFormat' + this.message = message + this.stack = (new Error()).stack +} +// eslint-disable-next-line new-parens +UnsupportedFormat.prototype = new Error + +function UndefinedPlantumlServer (message) { + this.name = 'UndefinedPlantumlServer' + this.message = message + this.stack = (new Error()).stack +} +// eslint-disable-next-line new-parens +UndefinedPlantumlServer.prototype = new Error + +function createImageSrc (doc, text, target, format, vfs) { + const serverUrl = doc.getAttribute('plantuml-server-url') + const shouldFetch = doc.isAttribute('plantuml-fetch-diagram') + let diagramUrl = `${serverUrl}/${format}/${plantumlEncoder.encode(text)}` + if (shouldFetch) { + diagramUrl = require('./fetch').save(diagramUrl, doc, target, format, vfs) + } + return diagramUrl +} + +function processPlantuml (processor, parent, attrs, diagramType, diagramText, context) { + const doc = parent.getDocument() + // If "subs" attribute is specified, substitute accordingly. + // Be careful not to specify "specialcharacters" or your diagram code won't be valid anymore! + const subs = attrs.subs + if (subs) { + diagramText = parent.$apply_subs(diagramText, parent.$resolve_subs(subs), true) + } + + const plantumlConfigFile = doc.getAttribute('plantuml-config-file') + if (plantumlConfigFile && fs.existsSync(plantumlConfigFile)) { + let plantumlConfig = fs.readFileSync(plantumlConfigFile) + if (plantumlConfig) { + diagramText = plantumlConfig + '\n' + diagramText + } + } + + if (!/^@start([a-z]+)\n[\s\S]*\n@end\1$/.test(diagramText)) { + if (diagramType === 'plantuml') { + diagramText = '@startuml\n' + diagramText + '\n@enduml' + } else if (diagramType === 'ditaa') { + diagramText = '@startditaa\n' + diagramText + '\n@endditaa' + } else if (diagramType === 'graphviz') { + diagramText = '@startdot\n' + diagramText + '\n@enddot' + } + } + const serverUrl = doc.getAttribute('plantuml-server-url') + const role = attrs.role + const blockId = attrs.id + const title = attrs.title + if (serverUrl) { + const target = attrs.target + const format = attrs.format || 'png' + if (format === 'png' || format === 'svg') { + const imageUrl = createImageSrc(doc, diagramText, target, format, context.vfs) + const blockAttrs = { + role: role ? `${role} plantuml` : 'plantuml', + target: imageUrl, + alt: target || 'diagram', + title + } + if (blockId) blockAttrs.id = blockId + return processor.createImageBlock(parent, blockAttrs) + } else { + throw new UnsupportedFormat(`Format '${format}' is unsupported. Only 'png' and 'svg' are supported by the PlantUML server`) + } + } else { + throw new UndefinedPlantumlServer('PlantUML server URL is undefined. Please use the :plantuml-server-url: attribute to configure it.') + } +} + +function plantumlBlock (context) { + return function () { + const self = this + self.onContext(['listing', 'literal']) + self.positionalAttributes(['target', 'format']) + + self.process((parent, reader, attrs) => { + if (typeof attrs === 'object' && '$$smap' in attrs) { + attrs = fromHash(attrs) + } + const diagramType = this.name.toString() + const role = attrs.role + let diagramText = reader.getString() + try { + return processPlantuml(this, parent, attrs, diagramType, diagramText, context) + } catch (e) { + if (e.name === 'UnsupportedFormat' || e.name === 'UndefinedPlantumlServer') { + console.warn(`Skipping ${diagramType} block. ${e.message}`) + attrs.role = role ? `${role} plantuml-error` : 'plantuml-error' + return this.createBlock(parent, attrs['cloaked-context'], diagramText, attrs) + } + throw e + } + }) + } +} + +function plantumlBlockMacro (name, context) { + return function () { + const self = this + self.named(name) + + self.process((parent, target, attrs) => { + if (typeof attrs === 'object' && '$$smap' in attrs) { + attrs = fromHash(attrs) + } + let vfs = context.vfs + if (typeof vfs === 'undefined' || typeof vfs.read !== 'function') { + vfs = require('./node-fs') + } + const role = attrs.role + const diagramType = name + target = parent.$apply_subs(target) + let diagramText = vfs.read(target) + try { + return processPlantuml(this, parent, attrs, diagramType, diagramText, context) + } catch (e) { + if (e.name === 'UnsupportedFormat' || e.name === 'UndefinedPlantumlServer') { + console.warn(`Skipping ${diagramType} block macro. ${e.message}`) + attrs.role = role ? `${role} plantuml-error` : 'plantuml-error' + return this.createBlock(parent, 'paragraph', `${e.message} - ${diagramType}::${target}[]`, attrs) + } + throw e + } + }) + } +} + +const antoraAdapter = (file, contentCatalog) => ({ + add: (image) => { + const { component, version, module } = file.src + if (!contentCatalog.getById({ component, version, module, family: 'image', relative: image.basename })) { + contentCatalog.addFile({ + contents: image.contents, + src: { + component, + version, + module, + family: 'image', + mediaType: image.mediaType, + basename: image.basename, + relative: image.basename + } + }) + } + } +}) + +module.exports.register = function register (registry, context = {}) { + // patch context in case of Antora + if (typeof context.contentCatalog !== 'undefined' && typeof context.contentCatalog.addFile !== 'undefined' && typeof context.contentCatalog.addFile === 'function' && typeof context.file !== 'undefined') { + context.vfs = antoraAdapter(context.file, context.contentCatalog) + } + + if (typeof registry.register === 'function') { + registry.register(function () { + this.block('plantuml', plantumlBlock(context)) + this.block('ditaa', plantumlBlock(context)) + this.block('graphviz', plantumlBlock(context)) + this.blockMacro(plantumlBlockMacro('plantuml', context)) + this.blockMacro(plantumlBlockMacro('ditaa', context)) + this.blockMacro(plantumlBlockMacro('graphviz', context)) + }) + } else if (typeof registry.block === 'function') { + registry.block('plantuml', plantumlBlock(context)) + registry.block('ditaa', plantumlBlock(context)) + registry.block('graphviz', plantumlBlock(context)) + registry.blockMacro(plantumlBlockMacro('plantuml', context)) + registry.blockMacro(plantumlBlockMacro('ditaa', context)) + registry.blockMacro(plantumlBlockMacro('graphviz', context)) + } + return registry +} diff --git a/node_modules/asciidoctor-plantuml/dist/node/fetch.js b/node_modules/asciidoctor-plantuml/dist/node/fetch.js new file mode 100644 index 0000000..25b8ff6 --- /dev/null +++ b/node_modules/asciidoctor-plantuml/dist/node/fetch.js @@ -0,0 +1,27 @@ +const rusha = require('rusha') +const path = require('path') + +module.exports.save = function (diagramUrl, doc, target, format, vfs) { + const dirPath = path.join(doc.getAttribute('imagesoutdir') || '', doc.getAttribute('imagesdir') || '') + const diagramName = `${target || rusha.createHash().update(diagramUrl).digest('hex')}.${format}` + let read + if (typeof vfs === 'undefined' || typeof vfs.read !== 'function') { + read = require('./node-fs').read + } else { + read = vfs.read + } + const contents = read(diagramUrl, 'binary') + let add + if (typeof vfs === 'undefined' || typeof vfs.add !== 'function') { + add = require('./node-fs').add + } else { + add = vfs.add + } + add({ + relative: dirPath, + basename: diagramName, + mediaType: format === 'svg' ? 'image/svg+xml' : 'image/png', + contents: Buffer.from(contents, 'binary') + }) + return diagramName +} diff --git a/node_modules/asciidoctor-plantuml/dist/node/node-fs.js b/node_modules/asciidoctor-plantuml/dist/node/node-fs.js new file mode 100644 index 0000000..7614f84 --- /dev/null +++ b/node_modules/asciidoctor-plantuml/dist/node/node-fs.js @@ -0,0 +1,22 @@ +const fs = require('fs') +const path = require('path') +const mkdirp = require('mkdirp') + +const http = require('./node-http') + +module.exports = { + add: (image) => { + mkdirp.sync(image.relative) + const filePath = path.format({dir: image.relative, base: image.basename}) + fs.writeFileSync(filePath, image.contents, 'binary') + }, + read: (path, encoding = 'utf8') => { + if (path.startsWith('http://') || path.startsWith('https://')) { + return http.get(path, encoding) + } + if (path.startsWith('file://')) { + return fs.readFileSync(path.substr('file://'.length), encoding) + } + return fs.readFileSync(path, encoding) + } +} diff --git a/node_modules/asciidoctor-plantuml/dist/node/node-http.js b/node_modules/asciidoctor-plantuml/dist/node/node-http.js new file mode 100644 index 0000000..81b57b5 --- /dev/null +++ b/node_modules/asciidoctor-plantuml/dist/node/node-http.js @@ -0,0 +1,38 @@ +const httpGet = (uri, encoding = 'utf8') => { + let data = '' + let status = -1 + try { + const XMLHttpRequest = require('unxhr').XMLHttpRequest + const xhr = new XMLHttpRequest() + xhr.open('GET', uri, false) + if (encoding === 'binary') { + xhr.responseType = 'arraybuffer' + } + xhr.addEventListener('load', function () { + status = this.status + if (status === 200) { + if (encoding === 'binary') { + const arrayBuffer = xhr.response + const byteArray = new Uint8Array(arrayBuffer) + for (let i = 0; i < byteArray.byteLength; i++) { + data += String.fromCharCode(byteArray[i]) + } + } else { + data = this.responseText + } + } + }) + xhr.send() + } catch (e) { + throw new Error(`Error reading file: ${uri}; reason: ${e.message}`) + } + // assume that no data means it doesn't exist + if (status === 404 || !data) { + throw new Error(`No such file: ${uri}`) + } + return data +} + +module.exports = { + get: httpGet +} diff --git a/node_modules/asciidoctor-plantuml/package.json b/node_modules/asciidoctor-plantuml/package.json new file mode 100644 index 0000000..ee21de2 --- /dev/null +++ b/node_modules/asciidoctor-plantuml/package.json @@ -0,0 +1,98 @@ +{ + "_args": [ + [ + "asciidoctor-plantuml@1.5.0", + "/home/runner/work/jug-in.talks/jug-in.talks" + ] + ], + "_from": "asciidoctor-plantuml@1.5.0", + "_id": "asciidoctor-plantuml@1.5.0", + "_inBundle": false, + "_integrity": "sha512-YsiDyrr0iBkFrDkqSXujbZNS1YkhiKl6sIo3OB6yydSozrahXYX2LdU7pmQPUwe8kYeCy3L2G39O4kQc68mCew==", + "_location": "/asciidoctor-plantuml", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "asciidoctor-plantuml@1.5.0", + "name": "asciidoctor-plantuml", + "escapedName": "asciidoctor-plantuml", + "rawSpec": "1.5.0", + "saveSpec": null, + "fetchSpec": "1.5.0" + }, + "_requiredBy": [ + "/" + ], + "_resolved": "https://registry.npmjs.org/asciidoctor-plantuml/-/asciidoctor-plantuml-1.5.0.tgz", + "_spec": "1.5.0", + "_where": "/home/runner/work/jug-in.talks/jug-in.talks", + "author": { + "name": "Evgeny Shepelyuk" + }, + "bugs": { + "url": "https://github.com/eshepelyuk/asciidoctor-plantuml.js/issues" + }, + "dependencies": { + "asciidoctor.js": "^1.5.9", + "mkdirp": "^0.5.1", + "plantuml-encoder": "^1.2.5", + "rusha": "^0.8.13", + "unxhr": "1.0.1" + }, + "description": "PlantUML support for Asciidoctor.JS.", + "devDependencies": { + "@antora/content-classifier": "2.1.2", + "cheerio": "1.0.0-rc.2", + "eslint": "^4.19.0", + "eslint-config-standard": "^11.0.0", + "eslint-config-standard-jsx": "^5.0.0", + "eslint-plugin-import": "^2.9.0", + "eslint-plugin-node": "^6.0.1", + "eslint-plugin-promise": "^3.7.0", + "eslint-plugin-standard": "^3.0.1", + "hasha": "3.0.0", + "jasmine": "3.1.0", + "jasmine-expect": "^3.8.3", + "jasmine-spec-reporter": "^4.2.1", + "karma": "2.0.0", + "karma-browserify": "5.2.0", + "karma-chrome-launcher": "2.2.0", + "karma-jasmine": "1.1.1", + "puppeteer": "^1.2.0", + "tmp": "0.0.33", + "webpack": "4.1.1", + "webpack-cli": "2.0.12" + }, + "files": [ + "dist" + ], + "homepage": "https://github.com/eshepelyuk/asciidoctor-plantuml.js#readme", + "keywords": [ + "asciidoctor", + "plantuml", + "antora", + "asciidoctorjs", + "diagram", + "ditaa" + ], + "license": "ISC", + "main": "dist/node/asciidoctor-plantuml.js", + "name": "asciidoctor-plantuml", + "private": false, + "repository": { + "type": "git", + "url": "git+https://github.com/eshepelyuk/asciidoctor-plantuml.js.git" + }, + "scripts": { + "build": "yarn build:browser && yarn build:node", + "build:browser": "webpack", + "build:node": "bash ./script/build_node.sh", + "clean": "rm -rf dist", + "lint": "eslint test src", + "test": "yarn test:node && yarn test:browser", + "test:browser": "karma start karma.conf.js", + "test:node": "jasmine --config=jasmine.json" + }, + "version": "1.5.0" +} diff --git a/node_modules/asciidoctor-reveal.js/CHANGELOG.adoc b/node_modules/asciidoctor-reveal.js/CHANGELOG.adoc new file mode 100644 index 0000000..b6e224b --- /dev/null +++ b/node_modules/asciidoctor-reveal.js/CHANGELOG.adoc @@ -0,0 +1,345 @@ += {project-name} Changelog +:project-name: asciidoctor-reveal.js +:uri-repo: https://github.com/asciidoctor/asciidoctor-reveal.js +:uri-issue: {uri-repo}/issues/ + +This document provides a high-level view of the changes introduced in {project-name} by release. +For a detailed view of what has changed, refer to the {uri-repo}/commits/master[commit history] on GitHub. + + +== 2.0.1 (2019-12-04) + +Important Bug Fix:: + * Fixed an issue that caused all `reveal.js` options in CamelCase to use the default value instead of one specified as an AsciiDoc attribute ({uri-issue}263[#263], {uri-issue}267[#267]) + +Compliance:: + * Dropped support for verse table cells ({uri-issue}246[#246]). + Asciidoctor 2.0 dropped it, we followed. + +Enhancements:: + * Documentation improvements ({uri-issue}264[#264], {uri-issue}278[#278], {uri-issue}280[#280]) + +Bug Fixes:: + * Yarn.lock updates for security ({uri-issue}283[#283]) + +=== Release meta + +* Released on: 2019-12-04 +* Released by: Olivier Bilodeau +* Release whisky: Lot No. 40 Single Copper Pot Still Rye Whisky + +{uri-repo}/releases/tag/v2.0.1[git tag] | +{uri-repo}/compare/v2.0.0...v2.0.1[full diff] + +=== Credits + +Thanks to the following people who contributed to this release: + +Benjamin Schmid, Guillaume Grossetie, Olivier Bilodeau + + +== 2.0.0 (2019-02-28) + +Upgrade considerations:: + * Node.js API change! + If you generate your reveal.js presentations using the node/javascript toolchain, you need to change how the {project-name} back-end is registered to Asciidoctor.js. + Instead of `require('asciidoctor-reveal.js')` you need to do: + + var asciidoctorRevealjs = require('asciidoctor-reveal.js'); + asciidoctorRevealjs.register() ++ +This change enables new use cases like embedding a presentation in a React web app. + + * Anchor links generated by {project-name} will change from now on when revealjs_history is set to true (default is false). + This is the consequence of upstream fixing a long standing issue (see https://github.com/hakimel/reveal.js/pull/1230[#1230] and https://github.com/hakimel/reveal.js/pull/2037[#2037]) and us removing a workaround (see {uri-issue}232[#232]). + Explicit anchors are not affected. + * Custom CSS might require adjustments. + Source and listing block are less deeply nested into `div` blocks now. + See {uri-issue}195[#195] and {uri-issue}223[#223]. + * The reveal.js `marked` and `markdown` plugins are disabled by default now. + It is unlikely that they could have been used anyway. + See {uri-issue}204[#204]. + * Dropped the ability to override the Reveal.JS theme and transitions dynamically with the URL query. + Was not compatible with Reveal.JS 3.x series released 4 years ago. + +Enhancements:: + * Easier speaker notes: a `.notes` role that apply to many AsciiDoc blocks (open, sidebar and admonition) ({uri-issue}202[#202]) + * Added a role `right` that would apply a `float: right` to any block where it would be assigned ({uri-issue}197[#197], {uri-issue}213[#213], {uri-issue}215[#215]) + * Allow the background color of slides to be set using CSS ({uri-issue}16[#16], {uri-issue}220[#220], {uri-issue}226[#226], {uri-issue}229[#229]) + * Reveal.js's fragmentInURL option now supported ({uri-issue}206[#206], {uri-issue}214[#214]) + * Documentation improvements ({uri-issue}141[#141], {uri-issue}182[#182], {uri-issue}190[#190], {uri-issue}203[#203], {uri-issue}215[#215], {uri-issue}216[#216], {uri-issue}222[#222]) + * Support for Asciidoctor.js 1.5.6 and build simplification ({uri-issue}189[#189], {uri-issue}217[#217]) + * Support to specify and use reveal.js plugins without modifying {project-name}'s source code ({uri-issue}196[#196], {uri-issue}118[#118], {uri-issue}201[#201], {uri-issue}204[#204]) + * Node / Javascript back-end is now loaded on-demand with the `register()` method. + This allows embedding {project-name} into React or any other modern Javascript environment. + ({uri-issue}205[#205], {uri-issue}218[#218], {uri-issue}219[#219]) + * `revealjsdir` attribute is set to a more sensible default when running under Node.js ({uri-issue}191[#191], {uri-issue}228[#228]) + * Node / Javascript back-end updated to use Asciidoctor.js 1.5.9. + This extension is built with Opal 0.11.99.dev (6703d8d) in order to be compatible. + ({uri-issue}227[#227], {uri-issue}240[#240]) + +Compliance:: + * AsciiDoc source callout icons now work ({uri-issue}54[#54], {uri-issue}168[#168], {uri-issue}224[#224]) + * New reveal.js 3.7.0 features supported: `controlsTutorial`, `controlsLayout`, `controlsBackArrows`, new `slideNumber` formats, `showSlideNumber`, `autoSlideMethod`, `parallaxBackgroundHorizontal`, `parallaxBackgroundVertical` and `display` configuration parameters are now supported ({uri-issue}212[#212], {uri-issue}239[#239], {uri-issue}208[#208], {uri-issue}242[#242]) + * Asciidoctor 2.0 ready ({uri-issue}245[#245]) + +Bug Fixes:: + * Reveal.js' `stretch` class now works with listing blocks ({uri-issue}195[#195], {uri-issue}223[#223]) + * Auto-generated slide IDs with unallowed characters (for revealjs history) now work properly. + Upstream reveal.js fixed a bug in 3.7.0 (https://github.com/hakimel/reveal.js/pull/2037[#2037]) and we removed our broken workaround. + ({uri-issue}192[#192], {uri-issue}232[#232]) + +Infrastructure:: + * Travis testing prepared for upcoming Asciidoctor 2.0 ({uri-issue}216[#216]) + * Travis testing for Ruby 2.6 ({uri-issue}243[#243]) + +=== Release meta + +* Released on: 2019-02-28 +* Released by: Olivier Bilodeau +* Release beer: President's Choice Blonde Brew De-alcoholized Beer (Sober February Successfully Completed!) + +{uri-repo}/releases/tag/v2.0.0[git tag] | +{uri-repo}/compare/v1.1.3...v2.0.0[full diff] | +{uri-repo}/milestone/6[milestone] + +=== Credits + +Thanks to the following people who contributed to this release: + +a4z, Dan Allen, Guillaume Grossetie, Harald, Jakub Jirutka, Olivier Bilodeau, stevewillson, Vivien Didelot + + +== 1.1.3 (2018-01-31) + +A repackage of 1.1.2 with a fix for Ruby 2.5 environments + +Bug fixes:: + * Worked around a problem in ruby-beautify with the compiled Slim template under Ruby 2.5 + +=== Release meta + +* Released on: 2018-01-31 +* Released by: Olivier Bilodeau +* Release coffee: Santropol Dark Espresso + +{uri-repo}/releases/tag/v1.1.3[git tag] | +{uri-repo}/compare/v1.1.2...v1.1.3[full diff] + +=== Credits + +Thanks to the following people who contributed to this release: + +Jakub Jirutka, Olivier Bilodeau + + +== 1.1.2 (2018-01-30) + +NOTE: No packaged version of this release were produced. + +A bugfix release due to a problem rendering tables using the Javascript / +Node.js toolchain. + +Enhancements:: + * Documentation improvements ({uri-issue}181[#181]) + +Bug fixes:: + * Fixed crash with presentations with a table used from Javascript/Node.js setup ({uri-issue}178[#178]) + +=== Release meta + +* Released on: 2018-01-30 +* Released by: Olivier Bilodeau +* Release beer: A sad Belgian Moon in a Smoke Meat joint + +{uri-repo}/releases/tag/v1.1.2[git tag] | +{uri-repo}/compare/v1.1.1...v1.1.2[full diff] + +=== Credits + +Thanks to the following people who contributed to this release: + +Guillaume Grossetie, Tobias Placht, Olivier Bilodeau + + +== 1.1.1 (2018-01-03) + +An emergency bugfix release due to a problem in the Ruby Gem package + +Enhancements:: + * Documentation improvements ({uri-issue}163[#163], {uri-issue}165[#165], {uri-issue}169[#169], {uri-issue}173[#173], {uri-issue}175[#175]) + +Compliance:: + * Code listing callouts now work properly ({uri-issue}22[#22], {uri-issue}166[#166], {uri-issue}167[#167]) + * More source code listing examples and tests ({uri-issue}163[#163], {uri-issue}170[#170]) + +Bug fixes:: + * The version 1.1.0 Ruby Gem was broken due to a packaging error ({uri-issue}172[#172]) + +=== Release meta + +* Released on: 2018-01-03 +* Released by: Olivier Bilodeau +* Release beer: Croque-Mort Double IPA, À la fût + +{uri-repo}/releases/tag/v1.1.1[git tag] | +{uri-repo}/compare/v1.1.0...v1.1.1[full diff] | +{uri-repo}/milestone/5[milestone] + +=== Credits + +Thanks to the following people who contributed to this release: + +Dietrich Schulten, Olivier Bilodeau + + +== 1.1.0 (2017-12-25) - @obilodeau + +Enhancements:: + * Support for Reveal.JS 3.5.0+ ({uri-issue}146[#146], {uri-issue}151[#151]) + * Support for Asciidoctor 1.5.6 ({uri-issue}132[#132], {uri-issue}136[#136], {uri-issue}142[#142]) + * Support for Asciidoctor.js 1.5.6-preview.4 ({uri-issue}130[#130], {uri-issue}143[#143], {uri-issue}156[#156]) + * Compiling slim templates to Ruby allows us to drop Jade templates for Asciidoctor.js users + ({uri-issue}63[#63], {uri-issue}131[#131]) + * Documentation polish ({uri-issue}153[#153], {uri-issue}158[#158] and more) + +Compliance:: + * Users of Asciidoctor (Ruby) and Asciidoctor.js (Javascript) now run the same set of templates meaning that we achieved feature parity between the two implementations + ({uri-issue}63[#63], {uri-issue}131[#131]) + +Bug fixes:: + * Reveal.js https://github.com/hakimel/reveal.js/#configuration[history feature] now works. + We are working around Reveal.js' section id character limits. + ({uri-issue}127[#127], {uri-issue}150[#150], https://github.com/hakimel/reveal.js/issues/1346[hakimel/reveal.js#1346]) + +Infrastructure:: + * https://github.com/asciidoctor/asciidoctor-doctest[Asciidoctor-doctest] integration. + This layer of automated testing should help prevent regressions and improve our development process. + ({uri-issue}92[#92], {uri-issue}116[#116]) + * Travis-CI integration to automatically run doctests and examples AsciiDoc conversions + * Travis-CI tests are triggered by changes done in Asciidoctor. + We will detect upstream changes affecting us sooner. + * Smoke tests for our Javascript / Node / Asciidoctor.js toolchain (integrated in Travis-CI also) + * `npm run examples` will convert all examples using the Javascript / Node / Asciidoctor.js toolchain ({uri-issue}149[#149]) + * `rake examples:serve` will run a Web server from `examples/` so you can preview rendered examples ({uri-issue}154[#154]) + +=== Release meta + +{uri-repo}/releases/tag/v1.1.0[git tag] | +{uri-repo}/compare/v1.0.4...v1.1.0[full diff] + +=== Credits + +Thanks to the following people who contributed to this release: + +@jirutka, Dan Allen, Guillaume Grossetie, Jacob Aae Mikkelsen, Olivier Bilodeau, Rahul Somasunderam + + +== 1.0.4 (2017-09-27) - @obilodeau + +Bug fixes:: + * Dependency problems leading to crashes when used from Asciidoctor.js ({uri-issue}145[#145]) + +=== Release meta + +{uri-repo}/releases/tag/v1.0.4[git tag] | +{uri-repo}/compare/v1.0.3...v1.0.4[full diff] + +=== Credits + +Thanks to the following people who contributed to this release: + +Olivier Bilodeau, Guillaume Grossetie + + +== 1.0.3 (2017-08-28) - @obilodeau + +Enhancements:: + * Documentation improvements + +Compliance:: + * Added `data-state: title` to the title slide ({uri-issue}123[#123]) + +Bug fixes:: + * Pinned Asciidoctor version requirement to 1.5.4 to avoid dealing with {uri-issue}132[#132] in the 1.0.x series + * Fixed consistency issues with boolean values handling in revealjs settings ({uri-issue}125[#125]) + +=== Release meta + +{uri-repo}/releases/tag/v1.0.3[git tag] | +{uri-repo}/compare/v1.0.2...v1.0.3[full diff] + +=== Credits + +Thanks to the following people who contributed to this release: + +Dan Allen, nipa, Olivier Bilodeau, Pi3r + + +== 1.0.2 (2016-12-22) - @obilodeau + +Enhancements:: + * Ruby back-end is now compiled in Javascript with Opal (#115) + * Documentation improvements + +=== Release meta + +{uri-repo}/issues?q=milestone%3A1.0.2[issues resolved] | +{uri-repo}/releases/tag/v1.0.2[git tag] | +{uri-repo}/compare/v1.0.1...v1.0.2[full diff] + +=== Credits + +Thanks to the following people who contributed to this release: + +Dan Allen, Guillaume Grossetie, Olivier Bilodeau + + +== 1.0.1 (2016-10-12) - @obilodeau + +Enhancements:: + * Documentation: aligned release process for both npm and ruby gems packages + * npm package in sync with ruby gem + +=== Release meta + +Released by @obilodeau + +{uri-repo}/issues?q=milestone%3A1.0.1[issues resolved] | +{uri-repo}/releases/tag/v1.0.1[git tag] | +{uri-repo}/compare/v1.0.0...v1.0.1[full diff] + +=== Credits + +Thanks to the following people who contributed to this release: + +Olivier Bilodeau + + +== 1.0.0 (2016-10-06) - @obilodeau + +Since this is the first ever "release" of asciidoctor-reveal.js (we used to do continuous improvements w/o releases in the past), this list focuses on the major enhancements introduced over the last few weeks. + +Enhancements:: + * Initial release + * Ruby package (#93) + * Node package (#95) + * `:customcss:` attribute for easy per-presentation CSS (#85) + * Video support improvements (#81) + * Reveal.js `data-state` support (#61) + * Subtitle partioning (#70) + * Background image rework (#52) + * `:imagesdir:` properly enforced (#17, #67) + +=== Release meta + +Released by @obilodeau + +{uri-repo}/issues?q=milestone%3A1.0.0[issues resolved] | +{uri-repo}/releases/tag/v1.0.0[git tag] + +=== Credits + +Thanks to the following people who contributed to this release: + +Alexander Heusingfeld, Andrea Bedini, Antoine Sabot-Durand, Brian Street, Charles Moulliard, Dan Allen, Danny Hyun, Emmanuel Bernard, gtoast, Guillaume Grossetie, Jacob Aae Mikkelsen, Jakub Jirutka, Jozef Skrabo, Julien Grenier, Julien Kirch, kubamarchwicki, lifei, Nico Rikken, nipa, Olivier Bilodeau, Patrick van Dissel, phrix32, Rahman Usta, Robert Panzer, Rob Winch, Thomas and Wendell Smith diff --git a/node_modules/asciidoctor-reveal.js/CHANGELOG.adoc.orig b/node_modules/asciidoctor-reveal.js/CHANGELOG.adoc.orig new file mode 100644 index 0000000..8ae629a --- /dev/null +++ b/node_modules/asciidoctor-reveal.js/CHANGELOG.adoc.orig @@ -0,0 +1,304 @@ += {project-name} Changelog +:project-name: asciidoctor-reveal.js +:uri-repo: https://github.com/asciidoctor/asciidoctor-reveal.js +:uri-issue: {uri-repo}/issues/ + +This document provides a high-level view of the changes introduced in {project-name} by release. +For a detailed view of what has changed, refer to the {uri-repo}/commits/master[commit history] on GitHub. + +== master (unreleased) + +Upgrade considerations:: + * Node.js API change! + If you generate your reveal.js presentations using the node/javascript toolchain, you need to change how the {project-name} back-end is registered to Asciidoctor.js. + Instead of `require('asciidoctor-reveal.js')` you need to do: + + var asciidoctorRevealjs = require('asciidoctor-reveal.js'); + asciidoctorRevealjs.register() ++ +This change enables new use cases like embedding a presentation in a React web app. + + * Anchor links generated by {project-name} will change from now on when revealjs_history is set to true (default is false). + This is the consequence of upstream fixing a long standing issue (see https://github.com/hakimel/reveal.js/pull/1230[#1230] and https://github.com/hakimel/reveal.js/pull/2037[#2037]) and us removing a workaround (see {uri-issue}232[#232]). + Explicit anchors are not affected. + * Custom CSS might require adjustments. + Source and listing block are less deeply nested into `div` blocks now. + See {uri-issue}195[#195] and {uri-issue}223[#223]. + * The reveal.js `marked` and `markdown` plugins are disabled by default now. + It is unlikely that they could have been used anyway. + See {uri-issue}204[#204]. + * Dropped the ability to override the Reveal.JS theme and transitions dynamically with the URL query. + Was not compatible with Reveal.JS 3.x series released 4 years ago. + +Enhancements:: + * Easier speaker notes: a `.notes` role that apply to many AsciiDoc blocks (open, sidebar and admonition) ({uri-issue}202[#202]) + * Added a role `right` that would apply a `float: right` to any block where it would be assigned ({uri-issue}197[#197], {uri-issue}213[#213], {uri-issue}215[#215]) + * Allow the background color of slides to be set using CSS ({uri-issue}16[#16], {uri-issue}220[#220], {uri-issue}226[#226], {uri-issue}229[#229]) + * Reveal.js's fragmentInURL option now supported ({uri-issue}206[#206], {uri-issue}214[#214]) + * Documentation improvements ({uri-issue}141[#141], {uri-issue}182[#182], {uri-issue}190[#190], {uri-issue}203[#203], {uri-issue}215[#215], {uri-issue}216[#216], {uri-issue}222[#222]) + * Support for Asciidoctor.js 1.5.6 and build simplification ({uri-issue}189[#189], {uri-issue}217[#217]) + * Support to specify and use reveal.js plugins without modifying {project-name}'s source code ({uri-issue}196[#196], {uri-issue}118[#118], {uri-issue}201[#201], {uri-issue}204[#204]) + * Node / Javascript back-end is now loaded on-demand with the `register()` method. + This allows embedding {project-name} into React or any other modern Javascript environment. + ({uri-issue}205[#205], {uri-issue}218[#218], {uri-issue}219[#219]) + * `revealjsdir` attribute is set to a more sensible default when running under Node.js ({uri-issue}191[#191], {uri-issue}228[#228]) + * Node / Javascript back-end updated to use Asciidoctor.js 1.5.9. + This extension is built with Opal 0.11.99.dev (6703d8d) in order to be compatible. + ({uri-issue}227[#227], {uri-issue}240[#240]) + +Compliance:: + * AsciiDoc source callout icons now work ({uri-issue}54[#54], {uri-issue}168[#168], {uri-issue}224[#224]) +<<<<<<< Updated upstream + * New reveal.js 3.7.0 features supported: the new `slideNumber` formats and `showSlideNumber` configuration parameter are now supported ({uri-issue}212[#212], {uri-issue}239[#239]) + * Asciidoctor 2.0 ready ({uri-issue}245[#245]) +======= + * New reveal.js 3.7.0 features supported: `controlsTutorial`, + `controlsLayout`, `controlsBackArrows`, new `slideNumber` formats, + `showSlideNumber`, `autoSlideMethod`, `parallaxBackgroundHorizontal`, + `parallaxBackgroundVertical` and `display` configuration parameters are + now supported ({uri-issue}212[#212], {uri-issue}239[#239], TODO) +>>>>>>> Stashed changes + +Bug Fixes:: + * Reveal.js' `stretch` class now works with listing blocks ({uri-issue}195[#195], {uri-issue}223[#223]) + * Auto-generated slide IDs with unallowed characters (for revealjs history) now work properly. + Upstream reveal.js fixed a bug in 3.7.0 (https://github.com/hakimel/reveal.js/pull/2037[#2037]) and we removed our broken workaround. + ({uri-issue}192[#192], {uri-issue}232[#232]) + +Infrastructure:: + * Travis testing prepared for upcoming Asciidoctor 2.0 ({uri-issue}216[#216]) + + +== 1.1.3 (2018-01-31) + +A repackage of 1.1.2 with a fix for Ruby 2.5 environments + +Bug fixes:: + * Worked around a problem in ruby-beautify with the compiled Slim template under Ruby 2.5 + +=== Release meta + +* Released on: 2018-01-31 +* Released by: Olivier Bilodeau +* Release coffee: Santropol Dark Espresso + +{uri-repo}/releases/tag/v1.1.3[git tag] | +{uri-repo}/compare/v1.1.2...v1.1.3[full diff] + +=== Credits + +Thanks to the following people who contributed to this release: + +Jakub Jirutka, Olivier Bilodeau + + +== 1.1.2 (2018-01-30) + +NOTE: No packaged version of this release were produced. + +A bugfix release due to a problem rendering tables using the Javascript / +Node.js toolchain. + +Enhancements:: + * Documentation improvements ({uri-issue}181[#181]) + +Bug fixes:: + * Fixed crash with presentations with a table used from Javascript/Node.js setup ({uri-issue}178[#178]) + +=== Release meta + +* Released on: 2018-01-30 +* Released by: Olivier Bilodeau +* Release beer: A sad Belgian Moon in a Smoke Meat joint + +{uri-repo}/releases/tag/v1.1.2[git tag] | +{uri-repo}/compare/v1.1.1...v1.1.2[full diff] + +=== Credits + +Thanks to the following people who contributed to this release: + +Guillaume Grossetie, Tobias Placht, Olivier Bilodeau + + +== 1.1.1 (2018-01-03) + +An emergency bugfix release due to a problem in the Ruby Gem package + +Enhancements:: + * Documentation improvements ({uri-issue}163[#163], {uri-issue}165[#165], {uri-issue}169[#169], {uri-issue}173[#173], {uri-issue}175[#175]) + +Compliance:: + * Code listing callouts now work properly ({uri-issue}22[#22], {uri-issue}166[#166], {uri-issue}167[#167]) + * More source code listing examples and tests ({uri-issue}163[#163], {uri-issue}170[#170]) + +Bug fixes:: + * The version 1.1.0 Ruby Gem was broken due to a packaging error ({uri-issue}172[#172]) + +=== Release meta + +* Released on: 2018-01-03 +* Released by: Olivier Bilodeau +* Release beer: Croque-Mort Double IPA, À la fût + +{uri-repo}/releases/tag/v1.1.1[git tag] | +{uri-repo}/compare/v1.1.0...v1.1.1[full diff] | +{uri-repo}/milestone/5[milestone] + +=== Credits + +Thanks to the following people who contributed to this release: + +Dietrich Schulten, Olivier Bilodeau + + +== 1.1.0 (2017-12-25) - @obilodeau + +Enhancements:: + * Support for Reveal.JS 3.5.0+ ({uri-issue}146[#146], {uri-issue}151[#151]) + * Support for Asciidoctor 1.5.6 ({uri-issue}132[#132], {uri-issue}136[#136], {uri-issue}142[#142]) + * Support for Asciidoctor.js 1.5.6-preview.4 ({uri-issue}130[#130], {uri-issue}143[#143], {uri-issue}156[#156]) + * Compiling slim templates to Ruby allows us to drop Jade templates for Asciidoctor.js users + ({uri-issue}63[#63], {uri-issue}131[#131]) + * Documentation polish ({uri-issue}153[#153], {uri-issue}158[#158] and more) + +Compliance:: + * Users of Asciidoctor (Ruby) and Asciidoctor.js (Javascript) now run the same set of templates meaning that we achieved feature parity between the two implementations + ({uri-issue}63[#63], {uri-issue}131[#131]) + +Bug fixes:: + * Reveal.js https://github.com/hakimel/reveal.js/#configuration[history feature] now works. + We are working around Reveal.js' section id character limits. + ({uri-issue}127[#127], {uri-issue}150[#150], https://github.com/hakimel/reveal.js/issues/1346[hakimel/reveal.js#1346]) + +Infrastructure:: + * https://github.com/asciidoctor/asciidoctor-doctest[Asciidoctor-doctest] integration. + This layer of automated testing should help prevent regressions and improve our development process. + ({uri-issue}92[#92], {uri-issue}116[#116]) + * Travis-CI integration to automatically run doctests and examples AsciiDoc conversions + * Travis-CI tests are triggered by changes done in Asciidoctor. + We will detect upstream changes affecting us sooner. + * Smoke tests for our Javascript / Node / Asciidoctor.js toolchain (integrated in Travis-CI also) + * `npm run examples` will convert all examples using the Javascript / Node / Asciidoctor.js toolchain ({uri-issue}149[#149]) + * `rake examples:serve` will run a Web server from `examples/` so you can preview rendered examples ({uri-issue}154[#154]) + +=== Release meta + +{uri-repo}/releases/tag/v1.1.0[git tag] | +{uri-repo}/compare/v1.0.4...v1.1.0[full diff] + +=== Credits + +Thanks to the following people who contributed to this release: + +@jirutka, Dan Allen, Guillaume Grossetie, Jacob Aae Mikkelsen, Olivier Bilodeau, Rahul Somasunderam + + +== 1.0.4 (2017-09-27) - @obilodeau + +Bug fixes:: + * Dependency problems leading to crashes when used from Asciidoctor.js ({uri-issue}145[#145]) + +=== Release meta + +{uri-repo}/releases/tag/v1.0.4[git tag] | +{uri-repo}/compare/v1.0.3...v1.0.4[full diff] + +=== Credits + +Thanks to the following people who contributed to this release: + +Olivier Bilodeau, Guillaume Grossetie + + +== 1.0.3 (2017-08-28) - @obilodeau + +Enhancements:: + * Documentation improvements + +Compliance:: + * Added `data-state: title` to the title slide ({uri-issue}123[#123]) + +Bug fixes:: + * Pinned Asciidoctor version requirement to 1.5.4 to avoid dealing with {uri-issue}132[#132] in the 1.0.x series + * Fixed consistency issues with boolean values handling in revealjs settings ({uri-issue}125[#125]) + +=== Release meta + +{uri-repo}/releases/tag/v1.0.3[git tag] | +{uri-repo}/compare/v1.0.2...v1.0.3[full diff] + +=== Credits + +Thanks to the following people who contributed to this release: + +Dan Allen, nipa, Olivier Bilodeau, Pi3r + + +== 1.0.2 (2016-12-22) - @obilodeau + +Enhancements:: + * Ruby back-end is now compiled in Javascript with Opal (#115) + * Documentation improvements + +=== Release meta + +{uri-repo}/issues?q=milestone%3A1.0.2[issues resolved] | +{uri-repo}/releases/tag/v1.0.2[git tag] | +{uri-repo}/compare/v1.0.1...v1.0.2[full diff] + +=== Credits + +Thanks to the following people who contributed to this release: + +Dan Allen, Guillaume Grossetie, Olivier Bilodeau + + +== 1.0.1 (2016-10-12) - @obilodeau + +Enhancements:: + * Documentation: aligned release process for both npm and ruby gems packages + * npm package in sync with ruby gem + +=== Release meta + +Released by @obilodeau + +{uri-repo}/issues?q=milestone%3A1.0.1[issues resolved] | +{uri-repo}/releases/tag/v1.0.1[git tag] | +{uri-repo}/compare/v1.0.0...v1.0.1[full diff] + +=== Credits + +Thanks to the following people who contributed to this release: + +Olivier Bilodeau + + +== 1.0.0 (2016-10-06) - @obilodeau + +Since this is the first ever "release" of asciidoctor-reveal.js (we used to do continuous improvements w/o releases in the past), this list focuses on the major enhancements introduced over the last few weeks. + +Enhancements:: + * Initial release + * Ruby package (#93) + * Node package (#95) + * `:customcss:` attribute for easy per-presentation CSS (#85) + * Video support improvements (#81) + * Reveal.js `data-state` support (#61) + * Subtitle partioning (#70) + * Background image rework (#52) + * `:imagesdir:` properly enforced (#17, #67) + +=== Release meta + +Released by @obilodeau + +{uri-repo}/issues?q=milestone%3A1.0.0[issues resolved] | +{uri-repo}/releases/tag/v1.0.0[git tag] + +=== Credits + +Thanks to the following people who contributed to this release: + +Alexander Heusingfeld, Andrea Bedini, Antoine Sabot-Durand, Brian Street, Charles Moulliard, Dan Allen, Danny Hyun, Emmanuel Bernard, gtoast, Guillaume Grossetie, Jacob Aae Mikkelsen, Jakub Jirutka, Jozef Skrabo, Julien Grenier, Julien Kirch, kubamarchwicki, lifei, Nico Rikken, nipa, Olivier Bilodeau, Patrick van Dissel, phrix32, Rahman Usta, Robert Panzer, Rob Winch, Thomas and Wendell Smith diff --git a/node_modules/asciidoctor-reveal.js/CHANGELOG.html b/node_modules/asciidoctor-reveal.js/CHANGELOG.html new file mode 100644 index 0000000..830b84e --- /dev/null +++ b/node_modules/asciidoctor-reveal.js/CHANGELOG.html @@ -0,0 +1,1051 @@ + + + + + + + +asciidoctor-reveal.js Changelog + + + + + +
+
+
+
+

This document provides a high-level view of the changes introduced in asciidoctor-reveal.js by release. +For a detailed view of what has changed, refer to the commit history on GitHub.

+
+
+
+
+

master (unreleased)

+
+
+
+
Upgrade considerations
+
+
+
    +
  • +

    Node.js API change! +If you generate your reveal.js presentations using the node/javascript toolchain, you need to change how the asciidoctor-reveal.js back-end is registered to Asciidoctor.js. +Instead of require('asciidoctor-reveal.js') you need to do:

    +
    +
    +
    var asciidoctorRevealjs = require('asciidoctor-reveal.js');
    +asciidoctorRevealjs.register()
    +
    +
    +
    +

    This change enables new use cases like embedding a presentation in a React web app.

    +
    +
  • +
  • +

    The reveal.js marked and markdown plugins are disabled by default now. +It is unlikely that they could have been used anyway. +See #204.

    +
  • +
+
+
+
Enhancements
+
+
+
    +
  • +

    Easier speaker notes: a .notes role that apply to many AsciiDoc blocks (open, sidebar and admonition) (#202)

    +
  • +
  • +

    Added a role right that would apply a float: right to any block where it would be assigned (#197, #213, #215)

    +
  • +
  • +

    Reveal.js’s fragmentInURL option now supported (#206, #214)

    +
  • +
  • +

    Documentation improvements (#141, #182, #190, #203, #215)

    +
  • +
  • +

    Support for Asciidoctor.js 1.5.6-rc.1 and build simplification (#189)

    +
  • +
  • +

    Support to specify and use reveal.js plugins without modifying asciidoctor-reveal.js’s source code (#196, #118, #201, #204)

    +
  • +
+
+
+
+
+
+
+
+

1.1.3 (2018-01-31)

+
+
+

A repackage of 1.1.2 with a fix for Ruby 2.5 environments

+
+
+
+
Bug fixes
+
+
+
    +
  • +

    Worked around a problem in ruby-beautify with the compiled Slim template under Ruby 2.5

    +
  • +
+
+
+
+
+
+

Release meta

+
+
    +
  • +

    Released on: 2018-01-31

    +
  • +
  • +

    Released by: Olivier Bilodeau

    +
  • +
  • +

    Release coffee: Santropol Dark Espresso

    +
  • +
+
+ +
+
+

Credits

+
+

Thanks to the following people who contributed to this release:

+
+
+

Jakub Jirutka, Olivier Bilodeau

+
+
+
+
+
+

1.1.2 (2018-01-30)

+
+
+ + + + + +
+
Note
+
+No packaged version of this release were produced. +
+
+
+

A bugfix release due to a problem rendering tables using the Javascript / +Node.js toolchain.

+
+
+
+
Enhancements
+
+
+
    +
  • +

    Documentation improvements (#181)

    +
  • +
+
+
+
Bug fixes
+
+
+
    +
  • +

    Fixed crash with presentations with a table used from Javascript/Node.js setup (#178)

    +
  • +
+
+
+
+
+
+

Release meta

+
+
    +
  • +

    Released on: 2018-01-30

    +
  • +
  • +

    Released by: Olivier Bilodeau

    +
  • +
  • +

    Release beer: A sad Belgian Moon in a Smoke Meat joint

    +
  • +
+
+ +
+
+

Credits

+
+

Thanks to the following people who contributed to this release:

+
+
+

Guillaume Grossetie, Tobias Placht, Olivier Bilodeau

+
+
+
+
+
+

1.1.1 (2018-01-03)

+
+
+

An emergency bugfix release due to a problem in the Ruby Gem package

+
+
+
+
Enhancements
+
+
+ +
+
+
Compliance
+
+
+
    +
  • +

    Code listing callouts now work properly (#22, #166, #167)

    +
  • +
  • +

    More source code listing examples and tests (#163, #170)

    +
  • +
+
+
+
Bug fixes
+
+
+
    +
  • +

    The version 1.1.0 Ruby Gem was broken due to a packaging error (#172)

    +
  • +
+
+
+
+
+
+

Release meta

+
+
    +
  • +

    Released on: 2018-01-03

    +
  • +
  • +

    Released by: Olivier Bilodeau

    +
  • +
  • +

    Release beer: Croque-Mort Double IPA, À la fût

    +
  • +
+
+ +
+
+

Credits

+
+

Thanks to the following people who contributed to this release:

+
+
+

Dietrich Schulten, Olivier Bilodeau

+
+
+
+
+
+

1.1.0 (2017-12-25) - @obilodeau

+
+
+
+
Enhancements
+
+
+
    +
  • +

    Support for Reveal.JS 3.5.0+ (#146, #151)

    +
  • +
  • +

    Support for Asciidoctor 1.5.6 (#132, #136, #142)

    +
  • +
  • +

    Support for Asciidoctor.js 1.5.6-preview.4 (#130, #143, #156)

    +
  • +
  • +

    Compiling slim templates to Ruby allows us to drop Jade templates for Asciidoctor.js users +(#63, #131)

    +
  • +
  • +

    Documentation polish (#153, #158 and more)

    +
  • +
+
+
+
Compliance
+
+
+
    +
  • +

    Users of Asciidoctor (Ruby) and Asciidoctor.js (Javascript) now run the same set of templates meaning that we achieved feature parity between the two implementations +(#63, #131)

    +
  • +
+
+
+
Bug fixes
+
+
+ +
+
+
Infrastructure
+
+
+
    +
  • +

    Asciidoctor-doctest integration. +This layer of automated testing should help prevent regressions and improve our development process. +(#92, #116)

    +
  • +
  • +

    Travis-CI integration to automatically run doctests and examples AsciiDoc conversions

    +
  • +
  • +

    Travis-CI tests are triggered by changes done in Asciidoctor. +We will detect upstream changes affecting us sooner.

    +
  • +
  • +

    Smoke tests for our Javascript / Node / Asciidoctor.js toolchain (integrated in Travis-CI also)

    +
  • +
  • +

    npm run examples will convert all examples using the Javascript / Node / Asciidoctor.js toolchain (#149)

    +
  • +
  • +

    rake examples:serve will run a Web server from examples/ so you can preview rendered examples (#154)

    +
  • +
+
+
+
+
+
+

Release meta

+ +
+
+

Credits

+
+

Thanks to the following people who contributed to this release:

+
+
+

@jirutka, Dan Allen, Guillaume Grossetie, Jacob Aae Mikkelsen, Olivier Bilodeau, Rahul Somasunderam

+
+
+
+
+
+

1.0.4 (2017-09-27) - @obilodeau

+
+
+
+
Bug fixes
+
+
+
    +
  • +

    Dependency problems leading to crashes when used from Asciidoctor.js (#145)

    +
  • +
+
+
+
+
+
+

Release meta

+ +
+
+

Credits

+
+

Thanks to the following people who contributed to this release:

+
+
+

Olivier Bilodeau, Guillaume Grossetie

+
+
+
+
+
+

1.0.3 (2017-08-28) - @obilodeau

+
+
+
+
Enhancements
+
+
+
    +
  • +

    Documentation improvements

    +
  • +
+
+
+
Compliance
+
+
+
    +
  • +

    Added data-state: title to the title slide (#123)

    +
  • +
+
+
+
Bug fixes
+
+
+
    +
  • +

    Pinned Asciidoctor version requirement to 1.5.4 to avoid dealing with #132 in the 1.0.x series

    +
  • +
  • +

    Fixed consistency issues with boolean values handling in revealjs settings (#125)

    +
  • +
+
+
+
+
+
+

Release meta

+ +
+
+

Credits

+
+

Thanks to the following people who contributed to this release:

+
+
+

Dan Allen, nipa, Olivier Bilodeau, Pi3r

+
+
+
+
+
+

1.0.2 (2016-12-22) - @obilodeau

+
+
+
+
Enhancements
+
+
+
    +
  • +

    Ruby back-end is now compiled in Javascript with Opal (#115)

    +
  • +
  • +

    Documentation improvements

    +
  • +
+
+
+
+
+
+

Release meta

+ +
+
+

Credits

+
+

Thanks to the following people who contributed to this release:

+
+
+

Dan Allen, Guillaume Grossetie, Olivier Bilodeau

+
+
+
+
+
+

1.0.1 (2016-10-12) - @obilodeau

+
+
+
+
Enhancements
+
+
+
    +
  • +

    Documentation: aligned release process for both npm and ruby gems packages

    +
  • +
  • +

    npm package in sync with ruby gem

    +
  • +
+
+
+
+
+
+

Release meta

+
+

Released by @obilodeau

+
+ +
+
+

Credits

+
+

Thanks to the following people who contributed to this release:

+
+
+

Olivier Bilodeau

+
+
+
+
+
+

1.0.0 (2016-10-06) - @obilodeau

+
+
+

Since this is the first ever "release" of asciidoctor-reveal.js (we used to do continuous improvements w/o releases in the past), this list focuses on the major enhancements introduced over the last few weeks.

+
+
+
+
Enhancements
+
+
+
    +
  • +

    Initial release

    +
  • +
  • +

    Ruby package (#93)

    +
  • +
  • +

    Node package (#95)

    +
  • +
  • +

    :customcss: attribute for easy per-presentation CSS (#85)

    +
  • +
  • +

    Video support improvements (#81)

    +
  • +
  • +

    Reveal.js data-state support (#61)

    +
  • +
  • +

    Subtitle partioning (#70)

    +
  • +
  • +

    Background image rework (#52)

    +
  • +
  • +

    :imagesdir: properly enforced (#17, #67)

    +
  • +
+
+
+
+
+
+

Release meta

+
+

Released by @obilodeau

+
+ +
+
+

Credits

+
+

Thanks to the following people who contributed to this release:

+
+
+

Alexander Heusingfeld, Andrea Bedini, Antoine Sabot-Durand, Brian Street, Charles Moulliard, Dan Allen, Danny Hyun, Emmanuel Bernard, gtoast, Guillaume Grossetie, Jacob Aae Mikkelsen, Jakub Jirutka, Jozef Skrabo, Julien Grenier, Julien Kirch, kubamarchwicki, lifei, Nico Rikken, nipa, Olivier Bilodeau, Patrick van Dissel, phrix32, Rahman Usta, Robert Panzer, Rob Winch, Thomas and Wendell Smith

+
+
+
+
+
+ + + \ No newline at end of file diff --git a/node_modules/asciidoctor-reveal.js/LICENSE.adoc b/node_modules/asciidoctor-reveal.js/LICENSE.adoc new file mode 100644 index 0000000..a703956 --- /dev/null +++ b/node_modules/asciidoctor-reveal.js/LICENSE.adoc @@ -0,0 +1,22 @@ +.The MIT License +.... +Copyright (C) 2012-2019 Olivier Bilodeau, Charles Moulliard, Dan Allen and the Asciidoctor Project + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +.... diff --git a/node_modules/asciidoctor-reveal.js/README.adoc b/node_modules/asciidoctor-reveal.js/README.adoc new file mode 100644 index 0000000..fdb8fa7 --- /dev/null +++ b/node_modules/asciidoctor-reveal.js/README.adoc @@ -0,0 +1,975 @@ += Reveal.js converter for Asciidoctor +Olivier Bilodeau ; Guillaume Grossetie ; Dan Allen ; Rahman Usta ; Charles Moulliard +ifdef::env-github,env-browser[] +:toc: preamble +:toclevels: 2 +endif::[] +ifdef::env-github[] +:branch: master +:status: +:outfilesuffix: .adoc +:!toc-title: +:caution-caption: :fire: +:important-caption: :exclamation: +:note-caption: :paperclip: +:tip-caption: :bulb: +:warning-caption: :warning: +endif::[] +:uri-project-repo: https://github.com/asciidoctor/asciidoctor-reveal.js +:uri-asciidoctor: https://github.com/asciidoctor/asciidoctor +:uri-asciidoctorjs: https://github.com/asciidoctor/asciidoctor.js +:uri-revealjs-home: http://lab.hakim.se/reveal-js/ +:uri-revealjs-gh: https://github.com/hakimel/reveal.js +:uri-nodejs-download: https://nodejs.org/en/download/ + +ifdef::env-github[] +image:https://travis-ci.org/asciidoctor/asciidoctor-reveal.js.svg?branch=master[Build Status,link=https://travis-ci.org/asciidoctor/asciidoctor-reveal.js] +image:http://img.shields.io/gem/v/asciidoctor-revealjs.svg[gem, link=https://rubygems.org/gems/asciidoctor-revealjs] +image:http://img.shields.io/npm/v/asciidoctor-reveal.js.svg[npm, link=https://www.npmjs.org/package/asciidoctor-reveal.js] +endif::[] + +// IMPORTANT: Changes made to this description should be sync'ed with the readme field in package.json. +{uri-project-repo}[Asciidoctor reveal.js] is a converter for {uri-asciidoctor}[Asciidoctor] and {uri-asciidoctorjs}[Asciidoctor.js] that transforms an AsciiDoc document into an HTML5 presentation designed to be executed by the {uri-revealjs-home}[reveal.js] presentation framework. + + +There are two main technology stacks that can transform AsciiDoc into HTML5 / reveal.js: + +* Asciidoctor / Ruby / Bundler (See <>) +* Asciidoctor.js / JavaScript (Node.js) / NPM (See <>) + +Right now the Asciidoctor / Ruby stack is the better tested one but with the changes in v1.1.0 they have feature parity. + +ifeval::['{branch}' == 'master'] +NOTE: You're viewing the documentation for an upcoming release. +If you're looking for the documentation for the current release or an older one, please click on the appropriate link below: + +{uri-project-repo}/tree/v2.0.0#readme[2.0.0] (latest release) +⁃ +{uri-project-repo}/tree/v1.1.3#readme[1.1.3] (latest from 1.1 series) +⁃ +{uri-project-repo}/tree/maint-1.0.x#readme[1.0.x] +⁃ +{uri-project-repo}/tree/reveal.js-2.x#readme[Unversioned pre-release] (compatible with RevealJS 2.x) +endif::[] + + +== Ruby Setup + +NOTE: asciidoctor-reveal.js is now a Ruby Gem. +To ensure repeatability, we recommend that you manage your presentation projects using bundler. + +For a quick start clone our https://github.com/obilodeau/presentation-revealjs-starter[starter repository] and follow instructions there. + +For more complete instructions, read on. + + +=== Prerequisites + +. Install http://bundler.io/[bundler] (if not already installed) using your system's package manager or with: + + $ gem install bundler + +. If you're using RVM, make sure you switch away from any gemset: + + $ rvm use default ++ +or ++ + $ rvm use system + + +=== Install + +NOTE: These instructions should be repeated for every presentation project. + +. Create project directory + + $ mkdir my-awesome-presentation + $ cd my-awesome-presentation + +. Create a file named `Gemfile` with the following content: ++ +[source,ruby] +---- +source 'https://rubygems.org' + +gem 'asciidoctor-revealjs' # latest released version +---- ++ +NOTE: For some reason, when you use the system Ruby on Fedora, you also have to add the json gem to the Gemfile. ++ +. Install the gems into the project + + $ bundle config --local github.https true + $ bundle --path=.bundle/gems --binstubs=.bundle/.bin + +. Optional: Copy or clone reveal.js presentation framework. + Allows you to modify themes or view slides offline. + + $ git clone -b 3.7.0 --depth 1 https://github.com/hakimel/reveal.js.git + + +=== Rendering the AsciiDoc into slides + +. Create content in a file (*.adoc, *.ad, etc.). + See examples in <> section to get started. + +. Generate HTML presentation from the AsciiDoc source + + $ bundle exec asciidoctor-revealjs \ + -a revealjsdir=https://cdnjs.cloudflare.com/ajax/libs/reveal.js/3.7.0 CONTENT_FILE.adoc + +. If you did the optional step of having a local reveal.js clone you can + convert AsciiDoc source with + + $ bundle exec asciidoctor-revealjs CONTENT_FILE.adoc + +TIP: If you are using https://pages.github.com/[GitHub Pages], plan ahead by keeping your source files on `master` branch and all output files on the `gh-pages` branch. + + +== Node / JavaScript Setup + +=== Prerequisites + +First you must install and configure {uri-nodejs-download}[Node.js] on your machine. + +=== Install + +Using npm: + +Create a directory to place slides. Initialize the directory to store npm packages within that directory. + + $ echo {} > package.json # eliminates warnings, use `npm init` if you prefer + $ npm i --save asciidoctor-reveal.js + +=== Rendering the AsciiDoc into slides + +Once the package is installed, you can convert AsciiDoc files using reveal.js converter. +Here we are converting a file named `presentation.adoc` into a reveal.js presentation using Node.js: + +.asciidoctor-revealjs.js +[source, javascript] +---- +// Load asciidoctor.js and asciidoctor-reveal.js +var asciidoctor = require('asciidoctor.js')(); +var asciidoctorRevealjs = require('asciidoctor-reveal.js'); +asciidoctorRevealjs.register() + +// Convert the document 'presentation.adoc' using the reveal.js converter +var options = {safe: 'safe', backend: 'revealjs'}; +asciidoctor.convertFile('presentation.adoc', options); // <1> +---- +<1> Creates a file named `presentation.html` (in the directory where command is run) + +.presentation.adoc +[source, asciidoc] +---- += Title Slide + +== Slide One + +* Foo +* Bar +* World + +---- + +To render the slides, run: + + node asciidoctor-revealjs.js + +You can open the `presentation.html` file in your browser and enjoy! + + +== Syntax Examples + +Let's see some examples of `revealjs` backend features. +Additional examples can be found in the AsciiDoc files (.adoc) in `examples/`. + +=== Basic presentation with speaker notes + +[source, asciidoc] +---- += Title Slide + +== Slide One + +* Foo +* Bar +* World + +== Slide Two + +A Great Story + +[.notes] +-- +* tell anecdote +* make a point +-- +---- + +In previous snippet we are creating a slide titled Slide One with bullets and another one titled Slide Two with centered text (reveal.js`' default behavior) with {uri-revealjs-gh}#speaker-notes[speaker notes]. +Other syntax exists to create speaker notes, see `examples/speaker-notes.adoc`. + +Starting with Reveal.js 3.5 speaker notes supports configurable layouts: +image:https://cloud.githubusercontent.com/assets/629429/21808439/b941eb52-d743-11e6-9936-44ef80c60580.gif[] + +Speaker notes are opened by pressing `s`. +With Reveal.js 3.5 they require a webserver to work. +This limitation is not present in 3.6. +You can get a Web server running quickly with: + + ruby -run -e httpd . -p 5000 -b 127.0.0.1 + +Then use your browser to navigate to the URL \http://localhost:5000. + +=== Slides without titles + +There are a few ways to have no titles on slides. + +* Setting your title to `!` +* Adding the `notitle` option to your slide +* Adding the `conceal` option to your slide + +ifeval::[{safe-mode-level} >= 20] +See <>. +endif::[] +ifeval::[{safe-mode-level} < 20] +Here is an example of the three techniques in action: + +.concealed-slide-titles.adoc +[source,asciidoc] +.... +include::examples/concealed-slide-titles.adoc[lines=5..-1] +.... +endif::[] + +NOTE: `conceal` and `notitle` have the advantage that the slide still has an id so it can be linked to. + +IMPORTANT: Like the first page of an AsciiDoc document, the first slide is handled differently. + To hide the whole slide use the `:notitle:` http://asciidoctor.org/docs/user-manual/#header-summary[document attribute]. + To achieve the effect of hiding only the first slide's title, combine the `:notitle:` attribute on the first slide and use `[%notitle]` on the second slide which will, in effect, be your first slide now. + + +=== Background Colors + +Background colors for slides can be specified by two means: a classic one and one using AsciiDoc roles. +See <> for more examples. + +==== Using AsciiDoc Roles + +Using roles respects the AsciiDoc philosophy of separation of content and presentation. +Colors are to be defined by CSS and the <> need to be used to specify the CSS file to load. +To avoid clashing with existing reveal.js themes or CSS, a specific CSS class called `background` is expected to be present. +Here is an example: + + +[source, asciidoc] +---- += Title +:customcss: my-css.css + +[.red.background] +== Slide One + +Is very red +---- + +.my-css.css +[source, css] +---- +section.red.background { + background-color: red; +} +---- + +NOTE: The `canvas` keyword can be used instead of `background` for the same effect. + +==== Classic + +[source, asciidoc] +---- +[background-color="yellow"] +== Slide Three + +Is very yellow +---- + +Slide Three applies the attribute {uri-revealjs-gh}#slide-backgrounds[data-background-color] to the `reveal.js`
tag. +Anything accepted by CSS color formats works. + + +=== Background images + +[source, asciidoc] +---- +[%notitle] +== Grand Announcement + +image::cover.jpg[background, size=cover] +---- + +This will put `cover.jpg` as the slide's background image. +It sets reveal.js`' `data-background-image` attribute. +The `size` attribute is also supported. +See the {uri-revealjs-gh}#image-backgrounds[relevant reveal.js documentation] for details. + +NOTE: Background images file names are now relative to the `:imagesdir:` attribute if set. + +NOTE: The `canvas` keyword can be used instead of `background` for the same effect. + +[source, asciidoc] +---- +[%notitle] +== The Great Goat + +image::https://upload.wikimedia.org/wikipedia/commons/b/b2/Hausziege_04.jpg[canvas,size=contain] +---- + +As you can see, you can use a URL to specify your image resource too. + + +[#background_videos] +=== Background videos + +A background video for a slide can be specified using the `background-video` element attribute. + +[source, asciidoc] +---- +[background-video="https://my.video/file.mp4",background-video-loop=true,background-video-muted=true] +== Nice background! +---- + +For convenience `background-video-loop` and `background-video-muted` attributes are mapped to `loop` and `muted` options which can be specified with `options="loop,muted"`. + +For example: + +[source, asciidoc] +---- +[background-video="https://my.video/file.mp4",options="loop,muted"] +== Nice background! +---- + +See {uri-revealjs-gh}#video-backgrounds[the relevant reveal.js documentation] for details. +Note that the `data-` prefix is not required in asciidoc files. + + +=== Background iframes + +The background can be replaced with anything a browser can render in an iframe using the `background-iframe` reveal.js feature. + +[source, asciidoc] +---- +[%notitle,background-iframe="https://www.youtube.com/embed/LaApqL4QjH8?rel=0&start=3&enablejsapi=1&autoplay=1&loop=1&controls=0&modestbranding=1"] +== a youtube video +---- + +See {uri-revealjs-gh}#iframe-backgrounds[the relevant reveal.js documentation] for details. + + +=== Slide Transitions + +[source, asciidoc] +---- +[transition=zoom, %notitle] +== Zoom zoom + +This slide will override the presentation transition and zoom! + +[transition-speed=fast, %notitle] +== Speed + +Choose from three transition speeds: default, fast or slow! +---- + +See {uri-revealjs-gh}#slide-transitions[the relevant reveal.js documentation] for details. + + +=== Fragments + +[source, asciidoc] +---- +== Slide Four + +[%step] +* this +* is +* revealed +* gradually +---- + +Slide Four has bullets that are revealed one after the other. +This is what `reveal.js` calls http://lab.hakim.se/reveal-js/#/fragments[fragments]. +Applying the step option or role on a list (`[%step]` or `[.step]`) will do the trick. +Here is {uri-revealjs-gh}#fragments[the relevant reveal.js +documentation] on the topic. +Note that only `fade-in` is supported for lists at the moment. + + +=== Stretch class attribute + +Reveal.js supports a special class that will give all available screen space to an HTML node. +This class element is named `stretch`. + +Sometimes it's desirable to have an element, like an image or video, stretch to consume as much space as possible within a given slide. + +To apply that class to block simply use asciidoctor's class assignment: + + [.stretch] + +See {uri-revealjs-gh}#stretching-elements[reveal.js documentation on stretching elements]. + + +=== Videos + +In addition to <>, videos can be inserted directly into slides. +The syntax is the standard http://asciidoctor.org/docs/user-manual/#video[asciidoc video block macro] syntax. + +[source, asciidoc] +---- +== Trains, we love trains! + +video::kZH9JtPBq7k[youtube, start=34, options=autoplay] +---- + +By default videos are given as much space as possible. +To override that behavior use the `width` and `height` named attributes. + + +=== Syntax highlighting + +Reveal.js is well integrated with https://highlightjs.org/[highlight.js] for syntax highlighting. +Asciidoctor-reveal.js supports that. +You can activate highlight.js syntax highlighting (disabled by default) by setting the `source-highlighter` document attribute as follows: + +[source, asciidoc] +---- += Presentation Title +// [...] other document attributes +:source-highlighter: highlightjs +---- + +Once enabled you can write code blocks as usual: + +[source, asciidoc] +.... +== Slide Five + +Uses highlighted code + +[source, python] +---- +print "Hello World" +---- +.... + +By default `[source]` blocks and blocks delimited by `----` will be highlighted. +An explicit `[listing]` block will not be highlighted. +`highlight.js` does language auto-detection but using the `language="..."` attribute will hint the highlighter. +For example this will highlight this source code as Perl: + +[source, asciidoc] +.... +== Slide Five + +[source,perl] +---- +print "$0: hello world\n" +---- +.... + +[NOTE] +Alternatively, you can use http://coderay.rubychan.de[Coderay] or http://pygments.org[Pygments] as syntax highlighters if you are using the Asciidoctor/Ruby/Bundler toolchain (not Asciidoctor.js/Javascript/NPM). +Check the `examples/` directory for examples and notes about what needs to be done for them to work. +They are considered unsupported by the asciidoctor-reveal.js project. + + +=== Vertical slides + +[source, asciidoc] +.... +== Slide Six + +Top slide + +=== Slide Six.One + +This is a vertical subslide +.... + +Slide Six uses the vertical slide feature of `reveal.js`. +Slide Six.One will be rendered vertically below Slide Six. +Here is {uri-revealjs-gh}#markup[the relevant reveal.js +documentation] on that topic. + + +=== Asciidoctor-reveal.js specific roles + +Roles are usually applied with the following syntax where the `important-text` CSS class would be applied to the slide title in the generated HTML: + +[source, asciidoc] +.... +[.important-text] +== Slide Title + +* Some +* Information +.... + +Or + +[source, asciidoc] +.... +[role="important-text"] +== Slide Title + +* Some +* Information +.... + +See https://asciidoctor.org/docs/user-manual/#role[Asciidoctor's documentation] for more details. + +.Image specific note +In addition to the https://asciidoctor.org/docs/user-manual/\#positioning-attributes[existing attributes] to position images, roles can be used as well. However, the shorthand syntax (.) doesn't work in the image macro arguments but must be used above with the angle bracket syntax. +See <> for examples. + +Here is a list of supported roles: + +right:: Will apply a `float: right` style to the affected block + + +=== Title slide customization + +The title slide is customized via Asciidoc attributes. +These are the global variable assigned at the top of a document under the lead +title that look like this: `:name: value`. + +This converter supports changing the color, image, video, iframe and +transitions of the title slide. + +Read {uri-revealjs-gh}#slide-backgrounds[the relevant reveal.js documentation] to understand what attributes need to be set. +Keep in mind that for title slides you must replace `data-` with `title-slide-`. + +ifeval::[{safe-mode-level} >= 20] +See <>. +endif::[] +ifeval::[{safe-mode-level} < 20] +Here is an example: + +.title-slide-image.adoc +[source,asciidoc] +.... +include::examples/title-slide-image.adoc[lines=5..-1] +.... +endif::[] + +The title slide is also added a `title` CSS class to help with template customization. + +=== Content meant for multiple converters + +Some content can be created with both slides and book in mind. + +To mark slides split points you can use preprocessor conditionals combined +with a backend declaration. +Breaking points are set using slides with no title `=== !` wrapped in a +conditional: `ifdef::backend-revealjs[=== !]`. +In the end, the whole document has to be compiled with the backend option: +`-b revealjs` + +For example: + +[source, asciidoc] +---- +== Main section + +=== Sub Section + +Small + +Multiline + +intro + +. very +. long +. list +. of +. items + +\ifdef::backend-revealjs[=== !] + +Some overview diagram + +\ifdef::backend-revealjs[=== !] + +Detailed view diagram +---- + + +[[customcss]] +=== CSS override + +If you use the `:customcss:` document attribute, a CSS file of the name given in the attribute is added to the list of CSS resources loaded by the rendered HTML. +Doing so, you can then easily override specific elements of your theme per presentation. + +For example, to do proper position-independent text placement of a title slide with a specific background you can use: + +[source, css] +---- +.reveal section.title h1 { + margin-top: 2.3em; +} + +.reveal section.title small { + margin-top: 15.3em; + font-weight: bold; + color: white; +} +---- + +If the `:customcss:` attribute value is empty then `asciidoctor-revealjs.css` is the CSS resource that the presentation is linked to. + + +=== Slide state + +Reveal.js supports a {uri-revealjs-gh}#slide-states[data-state] tag that can be added on slides which gets rendered into `
` tags. +In AsciiDoc the `data-state` can be applied to a slide by adding a state attribute to a section like this: + +[source, asciidoc] +---- +[state=topic] +== Epic Topic +---- + +That state can be queried from Javascript or used in CSS to apply further customization to your slide deck. +For example, by combining this feature with the <> one, you can alter fonts for specific pages with this CSS: + +[source, css] +---- +@import 'https://fonts.googleapis.com/css?family=Baloo+Bhai'; + +section[data-state="topic"] h2 { + font-family: 'Baloo Bhai', cursive; + font-size: 4em; +} +---- + +=== Admonitions + +Asciidoctor font-based http://asciidoctor.org/docs/user-manual/#admonition[admonitions] are supported. +Make sure to add the following attribute to your document: + +[source, asciidoc] +---- +:icons: font +---- + +Here is an example slide: + +[source, asciidoc] +---- +== But first + +WARNING: This presentation is dangerous! +---- + +Here are details about Asciidoctor's http://asciidoctor.org/docs/user-manual/#admonition-icons[Admonition icons] support. + + +== Reveal.js Options + +Some attributes can be set at the top of the document that are specific to the `reveal.js` converter. +They use the same name as in the `reveal.js` project except that they are prepended by `revealjs_` and case doesn't matter. +They are applied in the link:templates/document.html.slim[document template]. + +NOTE: Default settings are based on `reveal.js` default settings. + +[cols="1m,1,2"] +|=== +|Attribute |Value(s) |Description + +|:revealjs_theme: +|beige, *black*, league, night, serif, simple, sky, solarized, white +|Chooses one of reveal.js`' {uri-revealjs-gh}#theming[built-in themes]. + +|:revealjs_customtheme: +| +|Overrides CSS with given file or URL. +Default is disabled. + +|:highlightjs-theme: +| +|Overrides https://highlightjs.org[highlight.js] CSS style with given file or URL. +Default is built-in [path]_lib/css/zenburn.css_. + +|:revealjsdir: +| +|Overrides reveal.js directory. +Example: ../reveal.js or +https://cdnjs.com/libraries/reveal.js/3.7.0[https://cdnjs.cloudflare.com/ajax/libs/reveal.js/3.7.0]. +Default is `reveal.js/` unless in a Node.js environment where it is `node_modules/reveal.js/`. + +|:revealjs_controls: +|*true*, false +|Display presentation control arrows + +|:revealjs_controlsTutorial: +|*true*, false +|Help the user learn the controls by providing hints, for example by bouncing the down arrow when they first encounter a vertical slide + +|:revealjs_controlsLayout: +|edges, *bottom-right* +|Determines where controls appear, "edges" or "bottom-right" + +|:revealjs_controlsBackArrows: +|*faded*, hidden, visible +|Visibility rule for backwards navigation arrows; "faded", "hidden" or "visible" + +|:revealjs_progress: +|*true*, false +|Display a presentation progress bar. + +|:revealjs_slideNumber: +|true, *false*, h.v, h/v, c, c/t +a|Display the page number of the current slide. +*true* will display the slide number with default formatting. +Additional formatting is available: + +h.v:: horizontal . vertical slide number (default) +h/v:: horizontal / vertical slide number +c:: flattened slide number +c/t:: flattened slide number / total slides + +|:revealjs_showSlideNumber: +|*all*, speaker, print +a|Control which views the slide number displays on using the "showSlideNumber" value: + +all:: show on all views (default) +speaker:: only show slide numbers on speaker notes view +print:: only show slide numbers when printing to PDF + +|:revealjs_history: +|true, *false* +|Push each slide change to the browser history. + +|:revealjs_keyboard: +|*true*, false +|Enable keyboard shortcuts for navigation. + +|:revealjs_overview: +|*true*, false +|Enable the slide overview mode. + +|:revealjs_touch: +|*true*, false +|Enables touch navigation on devices with touch input. + +|:revealjs_center: +|*true*, false +|Vertical centering of slides. + +|:revealjs_loop: +|true, *false* +|Loop the presentation. + +|:revealjs_rtl: +|true, *false* +|Change the presentation direction to be RTL. + +|:revealjs_fragments: +|*true*, false +|Turns fragments on and off globally. + +|:revealjs_fragmentInURL: +|true, *false* +|Flags whether to include the current fragment in the URL, so that reloading brings you to the same fragment position + +|:revealjs_embedded: +|true, *false* +|Flags if the presentation is running in an embedded mode (i.e., contained within a limited portion of the screen). + +|:revealjs_help: +|*true*, false +|Flags if we should show a help overlay when the questionmark key is pressed + +|:revealjs_showNotes: +|*true*, false +|Flags if speaker notes should be visible to all viewers + +|:revealjs_autoPlayMedia: +|*null*, true, false +a|Global override for autolaying embedded media (video/audio/iframe) + +null:: Media will only autoplay if data-autoplay is present +true:: All media will autoplay, regardless of individual setting +false:: No media will autoplay, regardless of individual setting + +|:revealjs_autoSlide: +| +|Delay in milliseconds between automatically proceeding to the next slide. +Disabled when set to *0* (the default). +This value can be overwritten by using a `data-autoslide` attribute on your slides. + +|:revealjs_autoSlideStoppable: +|*true*, false +|Stop auto-sliding after user input. + +|:revealjs_autoSlideMethod: +|*Reveal.navigateNext* +|Use this method for navigation when auto-sliding + +|:revealjs_defaultTiming: +| +|Specify the average time in seconds that you think you will spend presenting each slide. +This is used to show a pacing timer in the speaker view. +Defaults to *120* + +|:revealjs_mouseWheel: +|true, *false* +|Enable slide navigation via mouse wheel. + +|:revealjs_hideAddressBar: +|*true*, false +|Hides the address bar on mobile devices. + +|:revealjs_previewLinks: +|true, *false* +|Opens links in an iframe preview overlay. +Add `data-preview-link` and `data-preview-link="false"` to customise each link individually + +|:revealjs_transition: +|none, fade, *slide*, convex, concave, zoom +|Transition style. + +|:revealjs_transitionSpeed: +|*default*, fast, slow +|Transition speed. + +|:revealjs_backgroundTransition: +|none, *fade*, slide, convex, concave, zoom +|Transition style for full page slide backgrounds. + +|:revealjs_viewDistance: +| +|Number of slides away from the current that are visible. Default: 3 + +|:revealjs_parallaxBackgroundImage: +| +|Parallax background image. +Defaults to none + +|:revealjs_parallaxBackgroundSize: +| +|Parallax background size (accepts any CSS syntax). +Defaults to none + +|:revealjs_parallaxBackgroundHorizontal: +| +a|Number of pixels to move the parallax background per slide + +- Calculated automatically unless specified +- Set to 0 to disable movement along an axis + +|:revealjs_parallaxBackgroundVertical: +| +a|Number of pixels to move the parallax background per slide + +- Calculated automatically unless specified +- Set to 0 to disable movement along an axis + +|:revealjs_display: +| +|The display mode that will be used to show slides. +Defaults to *block* + +|:revealjs_width: +| +| Independent from the values, the aspect ratio will be preserved + when scaled to fit different resolutions. Defaults to *960* + +|:revealjs_height: +| +| See `:revealjs_width:`. Defaults to *700* + +|:revealjs_margin: +| +| Factor of the display size that should remain empty around the content. Defaults to *0.1* + +|=== + +If you want to build a custom theme or customize an existing one you should +look at the +{uri-revealjs-gh}/blob/master/css/theme/README.md[reveal.js +theme documentation] and use the `revealjs_customtheme` AsciiDoc attribute to +activate it. + +=== Default plugins + +By default, generated presentations will have the following reveal.js plugins enabled: + +* plugin/zoom-js/zoom.js +* plugin/notes/notes.js + +All these plugins are part of the reveal.js distribution. + +To enable or disable a built-in plugin, it is possible to set the `revealjs_plugin_[plugin name]` attribute to `enable` or `disable`. + +For example, to disable all the default plugins set the following document attributes: + +---- +:revealjs_plugin_zoom: disabled +:revealjs_plugin_notes: disabled +---- + +reveal.js ships with a plugin that allows to create a PDF from a slide deck. +To enable this plugin, set the `revealjs_plugin_pdf` attribute. + +---- +:revealjs_plugin_pdf: enabled +---- + +When the plugin is enabled and you run your presentation in a browser with `?print-pdf` at the end of the URL, you can then use the default print function to print the slide deck into a PDF document. + +TIP: To work properly, this plugin requires a Chrome-based browser. + + +=== Additional plugins + +Additional reveal.js plugins can be installed and activated using AsciiDoc attributes and external javascript files. + +. Extract the plugin files in a directory +. Create a Javascript file that will contain the Javascript statements to load the plugin (only one required even if you are using several plugins) +. Add a `:revealjs_plugins:` attribute to point to that Javascript file +. (Optional) Add a `:revealjs_plugins_configuration:` attribute to point to a Javascript file that configures the plugins you use + +Looking at the example provided in the repository will provide guidance: link:examples/revealjs-plugins.adoc[AsciiDoc source], link:examples/revealjs-plugins.js[Plugin Loader], link:examples/revealjs-plugins-conf.js[Plugin Configuration]. + +Read {uri-revealjs-gh}#dependencies[the relevant reveal.js documentation] to understand more about reveal.js plugins. +A {uri-revealjs-gh}/wiki/Plugins,-Tools-and-Hardware[list of existing reveal.js plugins] is also maintained upstream. + + +== Minimum Requirements + +Our requirements are expressed in our packages and by our dependencies. +Basically, all you need is the package manager of the flavor of Asciidoctor-Reveal.js you are interested to run: + +* With Ruby / Bundler: A https://www.ruby-lang.org/en/downloads/[recent Ruby] and https://bundler.io/[Bundler] +* With Javascript (Node.js) / NPM: a https://nodejs.org/en/download/[recent Node.js] environment + +If you need more details about our dependencies check out Asciidoctor dependencies: + +* With Ruby / Bundler: https://asciidoctor.org/#requirements[Asciidoctor] 1.5.6 +* With Javascript (Node.js) / NPM: https://github.com/asciidoctor/asciidoctor.js/blob/v1.5.6/package.json[Asciidoctor.js] 1.5.6 + + +== Contributing + +Interested in contributing? +We are interested! +Developer-focused documentation is link:HACKING.adoc[over here]. + + +== Copyright and Licensing + +Copyright (C) 2012-2019 {authors} and the Asciidoctor Project. +Free use of this software is granted under the terms of the MIT License. + +ifdef::env-github,env-browser[See the <> file for details.] diff --git a/node_modules/asciidoctor-reveal.js/README.html b/node_modules/asciidoctor-reveal.js/README.html new file mode 100644 index 0000000..1cdf7e7 --- /dev/null +++ b/node_modules/asciidoctor-reveal.js/README.html @@ -0,0 +1,1499 @@ + + + + + + + + +Reveal.js converter for Asciidoctor + + + + + +
+
+
+
+

Asciidoctor reveal.js is a converter for Asciidoctor and Asciidoctor.js that transforms an AsciiDoc document into an HTML5 presentation designed to be executed by the reveal.js presentation framework.

+
+
+

There are two main technology stacks that can transform AsciiDoc into HTML5 / reveal.js:

+
+
+ +
+
+

Right now the Asciidoctor / Ruby stack is the better tested one but with the changes in v1.1.0 they have feature parity.

+
+
+
+
+

Ruby Setup

+
+
+ + + + + +
+
Note
+
+asciidoctor-reveal.js is now a Ruby Gem. +To ensure repeatability, we recommend that you manage your presentation projects using bundler. +
+
+
+

For a quick start clone our starter repository and follow instructions there.

+
+
+

For more complete instructions, read on.

+
+
+

Prerequisites

+
+
    +
  1. +

    Install bundler (if not already installed) using your system’s package manager or with:

    +
    +
    +
    $ gem install bundler
    +
    +
    +
  2. +
  3. +

    If you’re using RVM, make sure you switch away from any gemset:

    +
    +
    +
    $ rvm use default
    +
    +
    +
    +

    or

    +
    +
    +
    +
    $ rvm use system
    +
    +
    +
  4. +
+
+
+
+

Install

+
+ + + + + +
+
Note
+
+These instructions should be repeated for every presentation project. +
+
+
+
    +
  1. +

    Create project directory

    +
    +
    +
    $ mkdir my-awesome-presentation
    +$ cd my-awesome-presentation
    +
    +
    +
  2. +
  3. +

    Create a file named Gemfile with the following content:

    +
    +
    +
    source 'https://rubygems.org'
    +
    +gem 'asciidoctor-revealjs' # latest released version
    +
    +
    +
    + + + + + +
    +
    Note
    +
    +For some reason, when you use the system Ruby on Fedora, you also have to add the json gem to the Gemfile. +
    +
    +
  4. +
  5. +

    Install the gems into the project

    +
    +
    +
    $ bundle config --local github.https true
    +$ bundle --path=.bundle/gems --binstubs=.bundle/.bin
    +
    +
    +
  6. +
  7. +

    Optional: Copy or clone reveal.js presentation framework. +Allows you to modify themes or view slides offline.

    +
    +
    +
    $ git clone -b 3.6.0 --depth 1 https://github.com/hakimel/reveal.js.git
    +
    +
    +
  8. +
+
+
+
+

Rendering the AsciiDoc into slides

+
+
    +
  1. +

    Create content in a file (*.adoc, *.ad, etc.). +See examples in Syntax Examples section to get started.

    +
  2. +
  3. +

    Generate HTML presentation from the AsciiDoc source

    +
    +
    +
    $ bundle exec asciidoctor-revealjs \
    +  -a revealjsdir=https://cdnjs.cloudflare.com/ajax/libs/reveal.js/3.6.0 CONTENT_FILE.adoc
    +
    +
    +
  4. +
  5. +

    If you did the optional step of having a local reveal.js clone you can +convert AsciiDoc source with

    +
    +
    +
    $ bundle exec asciidoctor-revealjs CONTENT_FILE.adoc
    +
    +
    +
  6. +
+
+
+ + + + + +
+
Tip
+
+If you are using GitHub Pages, plan ahead by keeping your source files on master branch and all output files on the gh-pages branch. +
+
+
+
+
+
+

Node / JavaScript Setup

+
+
+

Prerequisites

+
+

First you must install and configure Node.js on your machine.

+
+
+
+

Install

+
+

Using npm:

+
+
+
+
$ npm i --save asciidoctor-reveal.js
+
+
+
+
+

Rendering the AsciiDoc into slides

+
+

Once the package is installed, you can convert AsciiDoc files using reveal.js converter. +Here we are converting a file named presentation.adoc into a reveal.js presentation using Node.js:

+
+
+
asciidoctor-revealjs.js
+
+
// Load asciidoctor.js and asciidoctor-reveal.js
+var asciidoctor = require('asciidoctor.js')();
+require('asciidoctor-reveal.js');
+
+// Convert the document 'presentation.adoc' using the reveal.js converter
+var attributes = {'revealjsdir': 'node_modules/reveal.js@'};
+var options = {safe: 'safe', backend: 'revealjs', attributes: attributes};
+asciidoctor.convertFile('presentation.adoc', options); (1)
+
+
+
+
    +
  1. +

    Creates a file named presentation.html (in the directory where command is run)

    +
  2. +
+
+
+
presentation.adoc
+
+
= Title Slide
+// depending on your npm version, you might need to override the default
+// 'revealjsdir' value by removing the comments from the line below:
+//:revealjsdir: node_modules/asciidoctor-reveal.js/node_modules/reveal.js
+
+== Slide One
+
+* Foo
+* Bar
+* World
+
+
+
+

To render the slides, run:

+
+
+
+
node asciidoctor-revealjs.js
+
+
+
+

You can open the presentation.html file in your browser and enjoy!

+
+
+
+
+
+

Syntax Examples

+
+
+

Let’s see some examples of revealjs backend features. +Additional examples can be found in the AsciiDoc files (.adoc) in examples/.

+
+
+

Basic presentation with speaker notes

+
+
+
= Title Slide
+
+== Slide One
+
+* Foo
+* Bar
+* World
+
+== Slide Two
+
+Hello World - Good Bye Cruel World
+
+[NOTE.speaker]
+--
+Actually things aren't that bad
+--
+
+
+
+

In previous snippet we are creating a slide titled Slide One with bullets and another one titled Slide Two with centered text (reveal.js’ default behavior) with speaker notes.

+
+
+

Starting with Reveal.js 3.5 speaker notes supports configurable layouts: +b941eb52 d743 11e6 9936 44ef80c60580

+
+
+

Speaker notes are opened by pressing s. +With Reveal.js 3.5 they require a webserver to work. +This limitation is not present in 3.6. +You can get a Web server running quickly with:

+
+
+
+
ruby -run -e httpd . -p 5000 -b 127.0.0.1
+
+
+
+

Then use your browser to navigate to the URL http://localhost:5000.

+
+
+
+

Slides without titles

+
+

There are a few ways to have no titles on slides.

+
+
+
    +
  • +

    Setting your title to !

    +
  • +
  • +

    Adding the notitle option to your slide

    +
  • +
  • +

    Adding the conceal option to your slide

    +
  • +
+
+
+

Here is an example of the three techniques in action:

+
+
+
concealed-slide-titles.adoc
+
+
= Concealed Slide Titles
+:backend: revealjs
+
+== !
+
+This
+
+[%notitle]
+== Presentation
+
+presentation's titles
+
+[%conceal]
+== Concealed
+
+should be concealed
+
+
+
+ + + + + +
+
Note
+
+conceal and notitle have the advantage that the slide still has an id so it can be linked to. +
+
+
+ + + + + +
+
Important
+
+Like the first page of an AsciiDoc document, the first slide is handled differently. + To hide the whole slide use the :notitle: document attribute. + To achieve the effect of hiding only the first slide’s title, combine the :notitle: attribute on the first slide and use [%notitle] on the second slide which will, in effect, be your first slide now. +
+
+
+
+

Background colors

+
+
+
[background-color="yellow"]
+== Slide Three
+
+Is very yellow
+
+
+
+

Slide Three applies the attribute data-background-color to the reveal.js <section> tag. +Anything accepted by CSS color formats works.

+
+
+
+

Background images

+
+
+
[%notitle]
+== Grand Announcement
+
+image::cover.jpg[background, size=cover]
+
+
+
+

This will put cover.jpg as the slide’s background image. +It sets reveal.js’ data-background-image attribute. +The size attribute is also supported. +See the relevant reveal.js documentation for details.

+
+
+ + + + + +
+
Note
+
+Background images file names are now relative to the :imagedir: attribute if set. +
+
+
+ + + + + +
+
Note
+
+The canvas keyword can be used instead of background for the same effect. +
+
+
+
+
[%notitle]
+== The Great Goat
+
+image::https://upload.wikimedia.org/wikipedia/commons/b/b2/Hausziege_04.jpg[canvas,size=contain]
+
+
+
+

As you can see, you can use a URL to specify your image resource too.

+
+
+
+

Background videos

+
+

A background video for a slide can be specified using the background-video element attribute.

+
+
+
+
[background-video="https://my.video/file.mp4",background-video-loop=true,background-video-muted=true]
+== Nice background!
+
+
+
+

For convenience background-video-loop and background-video-muted attributes are mapped to loop and muted options which can be specified with options="loop,muted".

+
+
+

For example:

+
+
+
+
[background-video="https://my.video/file.mp4",options="loop,muted"]
+== Nice background!
+
+
+
+

See the relevant reveal.js documentation for details. +Note that the data- prefix is not required in asciidoc files.

+
+
+
+

Background iframes

+
+

The background can be replaced with anything a browser can render in an iframe using the background-iframe reveal.js feature.

+
+
+
+
[%notitle,background-iframe="https://www.youtube.com/embed/LaApqL4QjH8?rel=0&start=3&enablejsapi=1&autoplay=1&loop=1&controls=0&modestbranding=1"]
+== a youtube video
+
+
+ +
+
+

Slide Transitions

+
+
+
[transition=zoom, %notitle]
+== Zoom zoom
+
+This slide will override the presentation transition and zoom!
+
+[transition-speed=fast, %notitle]
+== Speed
+
+Choose from three transition speeds: default, fast or slow!
+
+
+ +
+
+

Fragments

+
+
+
== Slide Four
+
+[%step]
+* this
+* is
+* revealed
+* gradually
+
+
+
+

Slide Four has bullets that are revealed one after the other. +This is what reveal.js calls fragments. +Applying the step option or role on a list ([%step] or [.step]) will do the trick. +Here is the relevant reveal.js +documentation on the topic. +Note that only fade-in is supported for lists at the moment.

+
+
+
+

Stretch class attribute

+
+

Reveal.js supports a special class that will give all available screen space to an HTML node. +This class element is named stretch.

+
+
+

Sometimes it’s desirable to have an element, like an image or video, stretch to consume as much space as possible within a given slide.

+
+
+

To apply that class to block simply use asciidoctor’s class assignment:

+
+
+
+
[.stretch]
+
+
+ +
+
+

Videos

+
+

In addition to background videos, videos can be inserted directly into slides. +The syntax is the standard asciidoc video block macro syntax.

+
+
+
+
== Trains, we love trains!
+
+video::kZH9JtPBq7k[youtube, start=34, options=autoplay]
+
+
+
+

By default videos are given as much space as possible. +To override that behavior use the width and height named attributes.

+
+
+
+

Syntax highlighting

+
+

Reveal.js is well integrated with highlight.js for syntax highlighting. +Asciidoctor-reveal.js supports that. +You can activate highlight.js syntax highlighting (disabled by default) by setting the source-highlighter document attribute as follows:

+
+
+
+
= Presentation Title
+// [...] other document attributes
+:source-highlighter: highlightjs
+
+
+
+

Once enabled you can write code blocks as usual:

+
+
+
+
== Slide Five
+
+Uses highlighted code
+
+[source, python]
+----
+print "Hello World"
+----
+
+
+
+

By default [source] blocks and blocks delimited by ---- will be highlighted. +An explicit [listing] block will not be highlighted. +highlight.js does language auto-detection but using the language="…​" attribute will hint the highlighter. +For example this will highlight this source code as Perl:

+
+
+
+
== Slide Five
+
+[source,perl]
+----
+print "$0: hello world\n"
+----
+
+
+
+ + + + + +
+
Note
+
+Alternatively, you can use Coderay or Pygments as syntax highlighters if you are using the Asciidoctor/Ruby/Bundler toolchain (not Asciidoctor.js/Javascript/NPM). +Check the examples/ directory for examples and notes about what needs to be done for them to work. +They are considered unsupported by the asciidoctor-reveal.js project. +
+
+
+
+

Vertical slides

+
+
+
== Slide Six
+
+Top slide
+
+=== Slide Six.One
+
+This is a vertical subslide
+
+
+
+

Slide Six uses the vertical slide feature of reveal.js. +Slide Six.One will be rendered vertically below Slide Six. +Here is the relevant reveal.js +documentation on that topic.

+
+
+
+

Title slide customization

+
+

The title slide is customized via Asciidoc attributes. +These are the global variable assigned at the top of a document under the lead +title that look like this: :name: value.

+
+
+

This converter supports changing the color, image, video, iframe and +transitions of the title slide.

+
+
+

Read the relevant reveal.js documentation to understand what attributes need to be set. +Keep in mind that for title slides you must replace data- with title-slide-.

+
+
+

Here is an example:

+
+
+
title-slide-image.adoc
+
+
= EPIC TITLE
+:imagesdir: images
+:title-slide-background-image: 70s.jpg
+:title-slide-transition: zoom
+:title-slide-transition-speed: fast
+
+== Next slide
+
+Content
+
+
+
+

The title slide is also added a title CSS class to help with template customization.

+
+
+
+

Content meant for multiple converters

+
+

Some content can be created with both slides and book in mind.

+
+
+

To mark slides split points you can use preprocessor conditionals combined +with a backend declaration. +Breaking points are set using slides with no title === ! wrapped in a +conditional: ifdef::backend-revealjs[=== !]. +In the end, the whole document has to be compiled with the backend option: +-b revealjs

+
+
+

For example:

+
+
+
+
== Main section
+
+=== Sub Section
+
+Small +
+Multiline +
+intro
+
+. very
+. long
+. list
+. of
+. items
+
+ifdef::backend-revealjs[=== !]
+
+Some overview diagram
+
+ifdef::backend-revealjs[=== !]
+
+Detailed view diagram
+
+
+
+
+

CSS override

+
+

If you use the :customcss: document attribute, a CSS file of the name given in the attribute is added to the list of CSS resources loaded by the rendered HTML. +Doing so, you can then easily override specific elements of your theme per presentation.

+
+
+

For example, to do proper position-independent text placement of a title slide with a specific background you can use:

+
+
+
+
.reveal section.title h1 {
+    margin-top: 2.3em;
+}
+
+.reveal section.title small {
+    margin-top: 15.3em;
+    font-weight: bold;
+    color: white;
+}
+
+
+
+

If the :customcss: attribute value is empty then asciidoctor-revealjs.css is the CSS resource that the presentation is linked to.

+
+
+
+

Slide state

+
+

Reveal.js supports a data-state tag that can be added on slides which gets rendered into <section> tags. +In AsciiDoc the data-state can be applied to a slide by adding a state attribute to a section like this:

+
+
+
+
[state=topic]
+== Epic Topic
+
+
+
+

That state can be queried from Javascript or used in CSS to apply further customization to your slide deck. +For example, by combining this feature with the CSS override one, you can alter fonts for specific pages with this CSS:

+
+
+
+
@import 'https://fonts.googleapis.com/css?family=Baloo+Bhai';
+
+section[data-state="topic"] h2 {
+    font-family: 'Baloo Bhai', cursive;
+    font-size: 4em;
+}
+
+
+
+
+

Admonitions

+
+

Asciidoctor font-based admonitions are supported. +Make sure to add the following attribute to your document:

+
+
+
+
:icons: font
+
+
+
+

Here is an example slide:

+
+
+
+
== But first
+
+WARNING: This presentation is dangerous!
+
+
+
+

Here are details about Asciidoctor’s Admonition icons support.

+
+
+
+
+
+

Reveal.js Options

+
+
+

There are some attributes that can be set at the top of the document which they are specific of revealjs converter.

+
+
+ + + + + +
+
Note
+
+Default settings are based on reveal.js default settings. +
+
+ +++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
AttributeValue(s)Description

:revealjs_theme:

beige, black, league, night, serif, simple, sky, solarized, white

Chooses one of reveal.js’ built-in themes.

:revealjs_customtheme:

<file|URL>

Overrides CSS with given file or URL. +Default is disabled.

:highlightjs-theme:

<file|URL>

Overrides highlight.js CSS style with given file or URL. +Default is built-in lib/css/zenburn.css.

:revealjsdir:

<file|URL>

Overrides reveal.js directory. +Example: ../reveal.js or +https://cdnjs.cloudflare.com/ajax/libs/reveal.js/3.6.0

:revealjs_controls:

true, false

Display controls in the bottom right corner.

:revealjs_progress:

true, false

Display a presentation progress bar.

:revealjs_slideNumber:

true, false

Display the page number of the current slide.

:revealjs_history:

true, false

Push each slide change to the browser history.

:revealjs_keyboard:

true, false

Enable keyboard shortcuts for navigation.

:revealjs_overview:

true, false

Enable the slide overview mode.

:revealjs_touch:

true, false

Enables touch navigation on devices with touch input.

:revealjs_center:

true, false

Vertical centering of slides.

:revealjs_loop:

true, false

Loop the presentation.

:revealjs_rtl:

true, false

Change the presentation direction to be RTL.

:revealjs_fragments:

true, false

Turns fragments on and off globally.

:revealjs_embedded:

true, false

Flags if the presentation is running in an embedded mode (i.e., contained within a limited portion of the screen).

:revealjs_autoSlide:

<integer>

Delay in milliseconds between automatically proceeding to the next slide. +Disabled when set to 0 (the default). +This value can be overwritten by using a data-autoslide attribute on your slides.

:revealjs_autoSlideStoppable:

true, false

Stop auto-sliding after user input.

:revealjs_mouseWheel:

true, false

Enable slide navigation via mouse wheel.

:revealjs_hideAddressBar:

true, false

Hides the address bar on mobile devices.

:revealjs_previewLinks:

true, false

Opens links in an iframe preview overlay.

:revealjs_transition:

none, fade, slide, convex, concave, zoom

Transition style.

:revealjs_transitionSpeed:

default, fast, slow

Transition speed.

:revealjs_backgroundTransition:

none, fade, slide, convex, concave, zoom

Transition style for full page slide backgrounds.

:revealjs_viewDistance:

<integer>

Number of slides away from the current that are visible. Default: 3

:revealjs_parallaxBackgroundImage:

<file|URL>

Parallax background image. +Defaults to none

:revealjs_parallaxBackgroundSize:

<CSS size syntax>

Parallax background size (accepts any CSS syntax). +Defaults to none

+
+

If you want to build a custom theme or customize an existing one you should +look at the +reveal.js +theme documentation and use the revealjs_customtheme AsciiDoc attribute to +activate it.

+
+
+

Additional plugins

+
+

Additional reveal.js plugins can be installed and activated using AsciiDoc attributes and external javascript files.

+
+
+
    +
  1. +

    Extract the plugin files in a directory

    +
  2. +
  3. +

    Create a Javascript file that will contain the Javascript statements to load the plugin (only one required even if you are using several plugins)

    +
  4. +
  5. +

    Add a :revealjs_plugins: attribute to point to that Javascript file

    +
  6. +
  7. +

    (Optional) Add a :revealjs_plugins_configuration: attribute to point to the a Javascript file that configures the plugins you use

    +
  8. +
+
+
+

Looking at the example provided in the repository will provide guidance: AsciiDoc source, Plugin Loader, Plugin Configuration.

+
+
+

Read the relevant reveal.js documentation to understand more about reveal.js plugins. +A list of reveal.js plugins is also maintained upstream.

+
+
+
+
+
+

Minimum Requirements

+
+
+
    +
  • +

    asciidoctor 1.5.6

    +
  • +
+
+
+
+
+ +
+
+

Copyright © 2012-2018 Olivier Bilodeau, Guillaume Grossetie, Dan Allen, Rahman Usta, Charles Moulliard and the Asciidoctor Project. +Free use of this software is granted under the terms of the MIT License.

+
+
+
+
+ + + \ No newline at end of file diff --git a/node_modules/asciidoctor-reveal.js/README.md b/node_modules/asciidoctor-reveal.js/README.md new file mode 100644 index 0000000..29cfff6 --- /dev/null +++ b/node_modules/asciidoctor-reveal.js/README.md @@ -0,0 +1,5 @@ +# reveal.js converter for Asciidoctor.js + +A reveal.js converter for [Asciidoctor.js](https://github.com/asciidoctor/asciidoctor.js) that transforms an AsciiDoc document into an HTML5 presentation designed to be executed by the [reveal.js](http://lab.hakim.se/reveal-js/) presentation framework. + +For setup instructions and the AsciiDoc syntax to use to write a presentation see the module's documentation at [https://github.com/asciidoctor/asciidoctor-reveal.js](https://github.com/asciidoctor/asciidoctor-reveal.js). diff --git a/node_modules/asciidoctor-reveal.js/dist/main.js b/node_modules/asciidoctor-reveal.js/dist/main.js new file mode 100644 index 0000000..d60115f --- /dev/null +++ b/node_modules/asciidoctor-reveal.js/dist/main.js @@ -0,0 +1,5356 @@ +(function (Opal) { + function initialize (Opal) { +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor-revealjs/converter"] = function(Opal) { + function $rb_plus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); + } + function $rb_le(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs <= rhs : lhs['$<='](rhs); + } + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + function $rb_ge(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs >= rhs : lhs['$>='](rhs); + } + function $rb_times(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs * rhs : lhs['$*'](rhs); + } + function $rb_lt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $truthy = Opal.truthy, $send = Opal.send, $hash2 = Opal.hash2; + + Opal.add_stubs(['$==', '$nil?', '$option?', '$include?', '$join', '$map', '$split', '$!=', '$to_s', '$inject', '$!', '$nil_or_empty?', '$is_a?', '$compact', '$<<', '$empty?', '$+', '$level', '$special', '$to_i', '$attr', '$document', '$numbered', '$caption', '$<=', '$sectnum', '$captioned_title', '$content', '$each', '$constants', '$const_set', '$const_get', '$register_for', '$respond_to?', '$basebackend', '$outfilesuffix', '$filetype', '$[]', '$create', '$backend_info', '$new', '$node_name', '$send', '$extend', '$instance_eval', '$set_local_variables', '$converter', '$binding', '$===', '$flatten', '$map!', '$to_proc', '$reject!', '$convert', '$doctype', '$puts', '$[]=', '$-', '$role', '$reject', '$title?', '$title', '$context', '$has_role?', '$resolve_content', '$attr?', '$items', '$text', '$text?', '$blocks?', '$chomp', '$last', '$attributes', '$roles', '$image_uri', '$zero?', '$select', '$style', '$html_tag', '$colspan', '$rowspan', '$doctitle', '$normalize_web_path', '$>=', '$coderay_stylesheet_data', '$instance', '$pygments_stylesheet_data', '$docinfo', '$notitle', '$has_header?', '$media_uri', '$subtitle?', '$slice_text', '$header', '$subtitle', '$find_by', '$length', '$pop', '$author', '$to_boolean', '$to_valid_slidenumber', '$read', '$icon_uri', '$*', '$id', '$footnotes?', '$footnotes', '$index', '$sections', '$section_level', '$first', '$section_title', '$<', '$size', '$each_with_index', '$blocks', '$to_sym', '$strip', '$sub_specialcharacters', '$start_with?', '$end_with?', '$list_marker_keyword', '$tr_s', '$fetch', '$references', '$role?', '$local_variable_set']); + + (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + (function($base, $parent_nesting) { + function $Revealjs() {}; + var self = $Revealjs = $module($base, 'Revealjs', $Revealjs); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + nil + })($nesting[0], $nesting) + })($nesting[0], $nesting); + return (function($base, $super, $parent_nesting) { + function $Converter(){}; + var self = $Converter = $klass($base, $super, 'Converter', $Converter); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Converter_10, TMP_Converter_initialize_11, TMP_Converter_convert_12, TMP_Converter_toc_13, TMP_Converter_page_break_15, TMP_Converter_open_17, TMP_Converter_paragraph_19, TMP_Converter_verse_21, TMP_Converter_dlist_23, TMP_Converter_inline_footnote_31, TMP_Converter_asciidoctor_revealjs_33, TMP_Converter_image_35, TMP_Converter_inline_break_37, TMP_Converter_preamble_39, TMP_Converter_thematic_break_41, TMP_Converter_quote_43, TMP_Converter_inline_indexterm_45, TMP_Converter_pass_47, TMP_Converter_table_49, TMP_Converter_document_60, TMP_Converter_inline_callout_63, TMP_Converter_notes_65, TMP_Converter_inline_image_67, TMP_Converter_video_69, TMP_Converter_literal_71, TMP_Converter_floating_title_73, TMP_Converter_embedded_75, TMP_Converter_sidebar_78, TMP_Converter_outline_80, TMP_Converter_listing_83, TMP_Converter_inline_kbd_85, TMP_Converter_section_88, TMP_Converter_example_95, TMP_Converter_inline_button_97, TMP_Converter_inline_menu_99, TMP_Converter_audio_102, TMP_Converter_stem_104, TMP_Converter_olist_106, TMP_Converter_inline_anchor_109, TMP_Converter_admonition_111, TMP_Converter_inline_quoted_113, TMP_Converter_ulist_115, TMP_Converter_ruler_118, TMP_Converter_colist_120, TMP_Converter_set_local_variables_124; + + def.delegate_converter = nil; + + if ($$($nesting, 'RUBY_ENGINE')['$==']("opal")) { + } else { + nil + }; + (function($base, $parent_nesting) { + function $Helpers() {}; + var self = $Helpers = $module($base, 'Helpers', $Helpers); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Helpers_slice_text_1, TMP_Helpers_to_boolean_3, TMP_Helpers_to_valid_slidenumber_4, TMP_Helpers_html_tag_5, TMP_Helpers_section_level_7, TMP_Helpers_section_title_8, TMP_Helpers_resolve_content_9; + + + Opal.const_set($nesting[0], 'EOL', "\n"); + Opal.const_set($nesting[0], 'SliceHintRx', / +/); + + Opal.def(self, '$slice_text', TMP_Helpers_slice_text_1 = function $$slice_text(str, active) { + var $a, $b, $c, TMP_2, self = this; + + + + if (active == null) { + active = nil; + }; + if ($truthy(($truthy($a = ($truthy($b = active) ? $b : ($truthy($c = active['$nil?']()) ? self['$option?']("slice") : $c))) ? str['$include?'](" ") : $a))) { + return $send(str.$split($$($nesting, 'SliceHintRx')), 'map', [], (TMP_2 = function(line){var self = TMP_2.$$s || this; + + + + if (line == null) { + line = nil; + }; + return "" + "" + (line) + "";}, TMP_2.$$s = self, TMP_2.$$arity = 1, TMP_2)).$join($$($nesting, 'EOL')) + } else { + return str + }; + }, TMP_Helpers_slice_text_1.$$arity = -2); + + Opal.def(self, '$to_boolean', TMP_Helpers_to_boolean_3 = function $$to_boolean(val) { + var $a, $b, $c, self = this; + + return ($truthy($a = ($truthy($b = ($truthy($c = val) ? val['$!=']("false") : $c)) ? val.$to_s()['$!=']("0") : $b)) ? $a : false) + }, TMP_Helpers_to_boolean_3.$$arity = 1); + + Opal.def(self, '$to_valid_slidenumber', TMP_Helpers_to_valid_slidenumber_4 = function $$to_valid_slidenumber(val) { + var self = this; + + + if (val['$==']("")) { + return true}; + if (val.$to_s()['$==']("false")) { + return false + } else { + return "" + "'" + (val) + "'" + }; + }, TMP_Helpers_to_valid_slidenumber_4.$$arity = 1); + Opal.const_set($nesting[0], 'DEFAULT_TOCLEVELS', 2); + Opal.const_set($nesting[0], 'DEFAULT_SECTNUMLEVELS', 3); + Opal.const_set($nesting[0], 'VOID_ELEMENTS', ["area", "base", "br", "col", "command", "embed", "hr", "img", "input", "keygen", "link", "meta", "param", "source", "track", "wbr"]); + + Opal.def(self, '$html_tag', TMP_Helpers_html_tag_5 = function $$html_tag(name, attributes, content) { + var TMP_6, $a, $iter = TMP_Helpers_html_tag_5.$$p, $yield = $iter || nil, self = this, attrs = nil, attrs_str = nil; + + if ($iter) TMP_Helpers_html_tag_5.$$p = null; + + + if (attributes == null) { + attributes = $hash2([], {}); + }; + + if (content == null) { + content = nil; + }; + attrs = $send(attributes, 'inject', [[]], (TMP_6 = function(attrs, $mlhs_tmp1){var self = TMP_6.$$s || this, $a, $b, k = nil, v = nil; + + + + if (attrs == null) { + attrs = nil; + }; + + if ($mlhs_tmp1 == null) { + $mlhs_tmp1 = nil; + }; + $b = $mlhs_tmp1, $a = Opal.to_ary($b), (k = ($a[0] == null ? nil : $a[0])), (v = ($a[1] == null ? nil : $a[1])), $b; + if ($truthy(($truthy($a = v['$!']()) ? $a : v['$nil_or_empty?']()))) { + return attrs;}; + if ($truthy(v['$is_a?']($$($nesting, 'Array')))) { + v = v.$compact().$join(" ")}; + return attrs['$<<']((function() {if (v['$=='](true)) { + return k + } else { + return "" + (k) + "=\"" + (v) + "\"" + }; return nil; })());}, TMP_6.$$s = self, TMP_6.$$arity = 2, TMP_6.$$has_top_level_mlhs_arg = true, TMP_6)); + attrs_str = (function() {if ($truthy(attrs['$empty?']())) { + return "" + } else { + return $rb_plus(" ", attrs.$join(" ")) + }; return nil; })(); + if ($truthy($$($nesting, 'VOID_ELEMENTS')['$include?'](name.$to_s()))) { + return "" + "<" + (name) + (attrs_str) + ">" + } else { + + if (($yield !== nil)) { + content = ($truthy($a = content) ? $a : Opal.yieldX($yield, []))}; + return "" + "<" + (name) + (attrs_str) + ">" + (content) + ""; + }; + }, TMP_Helpers_html_tag_5.$$arity = -2); + + Opal.def(self, '$section_level', TMP_Helpers_section_level_7 = function $$section_level(sec) { + var $a, $b, self = this; + if (self._section_level == null) self._section_level = nil; + + + + if (sec == null) { + sec = self; + }; + return (self._section_level = ($truthy($a = self._section_level) ? $a : (function() {if ($truthy((($b = sec.$level()['$=='](0)) ? sec.$special() : sec.$level()['$=='](0)))) { + return 1 + } else { + return sec.$level() + }; return nil; })())); + }, TMP_Helpers_section_level_7.$$arity = -1); + + Opal.def(self, '$section_title', TMP_Helpers_section_title_8 = function $$section_title(sec) { + var $a, $b, self = this, sectnumlevels = nil; + + + + if (sec == null) { + sec = self; + }; + sectnumlevels = self.$document().$attr("sectnumlevels", $$($nesting, 'DEFAULT_SECTNUMLEVELS')).$to_i(); + if ($truthy(($truthy($a = ($truthy($b = sec.$numbered()) ? sec.$caption()['$!']() : $b)) ? $rb_le(sec.$level(), sectnumlevels) : $a))) { + return [sec.$sectnum(), sec.$captioned_title()].$join(" ") + } else { + return sec.$captioned_title() + }; + }, TMP_Helpers_section_title_8.$$arity = -1); + + Opal.def(self, '$resolve_content', TMP_Helpers_resolve_content_9 = function $$resolve_content() { + var self = this; + if (self.content_model == null) self.content_model = nil; + + if (self.content_model['$==']("simple")) { + return "" + "

" + (self.$content()) + "

" + } else { + return self.$content() + } + }, TMP_Helpers_resolve_content_9.$$arity = 0); + })($nesting[0], $nesting); + $send($$($nesting, 'Helpers').$constants(), 'each', [], (TMP_Converter_10 = function(const$){var self = TMP_Converter_10.$$s || this; + + + + if (const$ == null) { + const$ = nil; + }; + return self.$const_set(const$, $$($nesting, 'Helpers').$const_get(const$));}, TMP_Converter_10.$$s = self, TMP_Converter_10.$$arity = 1, TMP_Converter_10)); + self.$register_for("revealjs"); + + Opal.def(self, '$initialize', TMP_Converter_initialize_11 = function $$initialize(backend, opts) { + var $a, $iter = TMP_Converter_initialize_11.$$p, $yield = $iter || nil, self = this, delegate_backend = nil, factory = nil, converter = nil, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_Converter_initialize_11.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + + + if (opts == null) { + opts = $hash2([], {}); + }; + $send(self, Opal.find_super_dispatcher(self, 'initialize', TMP_Converter_initialize_11, false), $zuper, $iter); + if ($truthy(self['$respond_to?']("basebackend"))) { + self.$basebackend("html")}; + if ($truthy(self['$respond_to?']("outfilesuffix"))) { + self.$outfilesuffix(".html")}; + if ($truthy(self['$respond_to?']("filetype"))) { + self.$filetype("html")}; + delegate_backend = ($truthy($a = opts['$[]']("delegate_backend")) ? $a : "html5").$to_s(); + factory = $$$($$$($$$('::', 'Asciidoctor'), 'Converter'), 'Factory'); + converter = factory.$create(delegate_backend, self.$backend_info()); + return (self.delegate_converter = (function() {if (converter['$=='](self)) { + return factory.$new().$create(delegate_backend, self.$backend_info()) + } else { + return converter + }; return nil; })()); + }, TMP_Converter_initialize_11.$$arity = -2); + + Opal.def(self, '$convert', TMP_Converter_convert_12 = function $$convert(node, transform, opts) { + var $a, self = this, converter = nil; + + + + if (transform == null) { + transform = nil; + }; + + if (opts == null) { + opts = $hash2([], {}); + }; + transform = ($truthy($a = transform) ? $a : node.$node_name()); + converter = (function() {if ($truthy(self['$respond_to?'](transform))) { + return self + } else { + return self.delegate_converter + }; return nil; })(); + if ($truthy(opts['$empty?']())) { + return converter.$send(transform, node) + } else { + return converter.$send(transform, node, opts) + }; + }, TMP_Converter_convert_12.$$arity = -2); + + Opal.def(self, '$toc', TMP_Converter_toc_13 = function $$toc(node, opts) { + var TMP_14, self = this; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + node.$extend($$($nesting, 'Helpers')); + return $send(node, 'instance_eval', [], (TMP_14 = function(){var self = TMP_14.$$s || this, _buf = nil, _temple_html_attributeremover1 = nil, _slim_codeattributes1 = nil; + + + if ($truthy(opts['$empty?']())) { + } else { + self.$converter().$set_local_variables(self.$binding(), opts) + }; + _buf = []; + _buf['$<<']("
"); + _buf['$<<'](self.$document().$attr("toc-title")); + _buf['$<<']("
"); + _buf['$<<'](self.$converter().$convert(self.$document(), "outline")); + _buf['$<<']("
"); + return (_buf = _buf.$join(""));}, TMP_14.$$s = self, TMP_14.$$arity = 0, TMP_14)); + }, TMP_Converter_toc_13.$$arity = -2); + + Opal.def(self, '$page_break', TMP_Converter_page_break_15 = function $$page_break(node, opts) { + var TMP_16, self = this; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + node.$extend($$($nesting, 'Helpers')); + return $send(node, 'instance_eval', [], (TMP_16 = function(){var self = TMP_16.$$s || this, _buf = nil; + + + if ($truthy(opts['$empty?']())) { + } else { + self.$converter().$set_local_variables(self.$binding(), opts) + }; + _buf = []; + _buf['$<<']("
"); + return (_buf = _buf.$join(""));}, TMP_16.$$s = self, TMP_16.$$arity = 0, TMP_16)); + }, TMP_Converter_page_break_15.$$arity = -2); + + Opal.def(self, '$open', TMP_Converter_open_17 = function $$open(node, opts) { + var TMP_18, self = this; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + node.$extend($$($nesting, 'Helpers')); + return $send(node, 'instance_eval', [], (TMP_18 = function(){var self = TMP_18.$$s || this, $a, $b, $c, _buf = nil, _temple_html_attributeremover1 = nil, _temple_html_attributemerger1 = nil, $writer = nil, _slim_codeattributes1 = nil, _slim_codeattributes2 = nil, _temple_html_attributeremover2 = nil, _temple_html_attributemerger2 = nil, _slim_codeattributes3 = nil, _slim_codeattributes4 = nil; + if (self.style == null) self.style = nil; + if (self.parent == null) self.parent = nil; + if (self.document == null) self.document = nil; + if (self.id == null) self.id = nil; + if (self.level == null) self.level = nil; + + + if ($truthy(opts['$empty?']())) { + } else { + self.$converter().$set_local_variables(self.$binding(), opts) + }; + _buf = []; + if (self.style['$==']("abstract")) { + if ($truthy((($a = self.parent['$=='](self.document)) ? self.document.$doctype()['$==']("book") : self.parent['$=='](self.document)))) { + self.$puts("asciidoctor: WARNING: abstract block cannot be used in a document without a title when doctype is book. Excluding block content.") + } else { + + _buf['$<<'](""); + if ($truthy(self['$title?']())) { + + _buf['$<<']("
"); + _buf['$<<'](self.$title()); + _buf['$<<']("
");}; + _buf['$<<']("
"); + _buf['$<<'](self.$content()); + _buf['$<<']("
"); + } + } else if ($truthy((($a = self.style['$==']("partintro")) ? ($truthy($b = ($truthy($c = self.level['$!='](0)) ? $c : self.parent.$context()['$!=']("section"))) ? $b : self.document.$doctype()['$!=']("book")) : self.style['$==']("partintro")))) { + self.$puts("asciidoctor: ERROR: partintro block can only be used when doctype is book and it's a child of a book part. Excluding block content.") + } else if ($truthy(($truthy($a = ($truthy($b = self['$has_role?']("aside")) ? $b : self['$has_role?']("speaker"))) ? $a : self['$has_role?']("notes")))) { + + _buf['$<<'](""); + } else { + + _buf['$<<'](""); + if ($truthy(self['$title?']())) { + + _buf['$<<']("
"); + _buf['$<<'](self.$title()); + _buf['$<<']("
");}; + _buf['$<<']("
"); + _buf['$<<'](self.$content()); + _buf['$<<']("
"); + }; + return (_buf = _buf.$join(""));}, TMP_18.$$s = self, TMP_18.$$arity = 0, TMP_18)); + }, TMP_Converter_open_17.$$arity = -2); + + Opal.def(self, '$paragraph', TMP_Converter_paragraph_19 = function $$paragraph(node, opts) { + var TMP_20, self = this; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + node.$extend($$($nesting, 'Helpers')); + return $send(node, 'instance_eval', [], (TMP_20 = function(){var self = TMP_20.$$s || this, _buf = nil, _temple_html_attributeremover1 = nil, _temple_html_attributemerger1 = nil, $writer = nil, _slim_codeattributes1 = nil, _slim_codeattributes2 = nil; + if (self.id == null) self.id = nil; + + + if ($truthy(opts['$empty?']())) { + } else { + self.$converter().$set_local_variables(self.$binding(), opts) + }; + _buf = []; + _buf['$<<'](""); + if ($truthy(self['$title?']())) { + + _buf['$<<']("
"); + _buf['$<<'](self.$title()); + _buf['$<<']("
");}; + if ($truthy(self['$has_role?']("small"))) { + + _buf['$<<'](""); + _buf['$<<'](self.$content()); + _buf['$<<'](""); + } else { + + _buf['$<<']("

"); + _buf['$<<'](self.$content()); + _buf['$<<']("

"); + }; + _buf['$<<'](""); + return (_buf = _buf.$join(""));}, TMP_20.$$s = self, TMP_20.$$arity = 0, TMP_20)); + }, TMP_Converter_paragraph_19.$$arity = -2); + + Opal.def(self, '$verse', TMP_Converter_verse_21 = function $$verse(node, opts) { + var TMP_22, self = this; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + node.$extend($$($nesting, 'Helpers')); + return $send(node, 'instance_eval', [], (TMP_22 = function(){var self = TMP_22.$$s || this, $a, _buf = nil, _temple_html_attributeremover1 = nil, _temple_html_attributemerger1 = nil, $writer = nil, _slim_codeattributes1 = nil, _slim_codeattributes2 = nil, attribution = nil, citetitle = nil; + if (self.id == null) self.id = nil; + + + if ($truthy(opts['$empty?']())) { + } else { + self.$converter().$set_local_variables(self.$binding(), opts) + }; + _buf = []; + _buf['$<<'](""); + if ($truthy(self['$title?']())) { + + _buf['$<<']("
"); + _buf['$<<'](self.$title()); + _buf['$<<']("
");}; + _buf['$<<']("
");
+        _buf['$<<'](self.$content());
+        _buf['$<<']("
"); + attribution = (function() {if ($truthy(self['$attr?']("attribution"))) { + + return self.$attr("attribution"); + } else { + return nil + }; return nil; })(); + citetitle = (function() {if ($truthy(self['$attr?']("citetitle"))) { + + return self.$attr("citetitle"); + } else { + return nil + }; return nil; })(); + if ($truthy(($truthy($a = attribution) ? $a : citetitle))) { + + _buf['$<<']("
"); + if ($truthy(citetitle)) { + + _buf['$<<'](""); + _buf['$<<'](citetitle); + _buf['$<<']("");}; + if ($truthy(attribution)) { + + if ($truthy(citetitle)) { + _buf['$<<']("
")}; + _buf['$<<']("— "); + _buf['$<<'](attribution);}; + _buf['$<<']("
");}; + _buf['$<<'](""); + return (_buf = _buf.$join(""));}, TMP_22.$$s = self, TMP_22.$$arity = 0, TMP_22)); + }, TMP_Converter_verse_21.$$arity = -2); + + Opal.def(self, '$dlist', TMP_Converter_dlist_23 = function $$dlist(node, opts) { + var TMP_24, self = this; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + node.$extend($$($nesting, 'Helpers')); + return $send(node, 'instance_eval', [], (TMP_24 = function(){var self = TMP_24.$$s || this, TMP_25, $a, TMP_27, TMP_29, _buf = nil, $case = nil, _temple_html_attributeremover1 = nil, _temple_html_attributemerger1 = nil, $writer = nil, _slim_codeattributes1 = nil, _slim_codeattributes2 = nil, _temple_html_attributeremover2 = nil, _temple_html_attributemerger2 = nil, _slim_codeattributes3 = nil, _slim_codeattributes4 = nil, _slim_codeattributes5 = nil, _slim_codeattributes6 = nil, _temple_html_attributeremover4 = nil, _temple_html_attributemerger3 = nil, _slim_codeattributes8 = nil, _slim_codeattributes9 = nil; + if (self.style == null) self.style = nil; + if (self.id == null) self.id = nil; + + + if ($truthy(opts['$empty?']())) { + } else { + self.$converter().$set_local_variables(self.$binding(), opts) + }; + _buf = []; + $case = self.style; + if ("qanda"['$===']($case)) { + _buf['$<<'](""); + if ($truthy(self['$title?']())) { + + _buf['$<<']("
"); + _buf['$<<'](self.$title()); + _buf['$<<']("
");}; + _buf['$<<']("
    "); + $send(self.$items(), 'each', [], (TMP_25 = function(questions, answer){var self = TMP_25.$$s || this, TMP_26; + + + + if (questions == null) { + questions = nil; + }; + + if (answer == null) { + answer = nil; + }; + _buf['$<<']("
  1. "); + $send([].concat(Opal.to_a(questions)), 'each', [], (TMP_26 = function(question){var self = TMP_26.$$s || this; + + + + if (question == null) { + question = nil; + }; + _buf['$<<']("

    "); + _buf['$<<'](question.$text()); + return _buf['$<<']("

    ");}, TMP_26.$$s = self, TMP_26.$$arity = 1, TMP_26)); + if ($truthy(answer['$nil?']())) { + } else { + + if ($truthy(answer['$text?']())) { + + _buf['$<<']("

    "); + _buf['$<<'](answer.$text()); + _buf['$<<']("

    ");}; + if ($truthy(answer['$blocks?']())) { + _buf['$<<'](answer.$content())}; + }; + return _buf['$<<']("
  2. ");}, TMP_25.$$s = self, TMP_25.$$arity = 2, TMP_25)); + _buf['$<<']("
");} + else if ("horizontal"['$===']($case)) { + _buf['$<<'](""); + if ($truthy(self['$title?']())) { + + _buf['$<<']("
"); + _buf['$<<'](self.$title()); + _buf['$<<']("
");}; + _buf['$<<'](""); + if ($truthy(($truthy($a = self['$attr?']("labelwidth")) ? $a : self['$attr?']("itemwidth")))) { + + _buf['$<<']("");}; + $send(self.$items(), 'each', [], (TMP_27 = function(terms, dd){var self = TMP_27.$$s || this, TMP_28, _temple_html_attributeremover3 = nil, _slim_codeattributes7 = nil, last_term = nil; + + + + if (terms == null) { + terms = nil; + }; + + if (dd == null) { + dd = nil; + }; + _buf['$<<'](""); + terms = [].concat(Opal.to_a(terms)); + last_term = terms.$last(); + $send(terms, 'each', [], (TMP_28 = function(dt){var self = TMP_28.$$s || this; + + + + if (dt == null) { + dt = nil; + }; + _buf['$<<'](dt.$text()); + if ($truthy(dt['$!='](last_term))) { + return _buf['$<<']("
") + } else { + return nil + };}, TMP_28.$$s = self, TMP_28.$$arity = 1, TMP_28)); + _buf['$<<']("
");}, TMP_27.$$s = self, TMP_27.$$arity = 2, TMP_27)); + _buf['$<<']("
"); + if ($truthy(dd['$nil?']())) { + } else { + + if ($truthy(dd['$text?']())) { + + _buf['$<<']("

"); + _buf['$<<'](dd.$text()); + _buf['$<<']("

");}; + if ($truthy(dd['$blocks?']())) { + _buf['$<<'](dd.$content())}; + }; + return _buf['$<<']("
");} + else { + _buf['$<<'](""); + if ($truthy(self['$title?']())) { + + _buf['$<<']("
"); + _buf['$<<'](self.$title()); + _buf['$<<']("
");}; + _buf['$<<']("
"); + $send(self.$items(), 'each', [], (TMP_29 = function(terms, dd){var self = TMP_29.$$s || this, TMP_30; + + + + if (terms == null) { + terms = nil; + }; + + if (dd == null) { + dd = nil; + }; + $send([].concat(Opal.to_a(terms)), 'each', [], (TMP_30 = function(dt){var self = TMP_30.$$s || this, _temple_html_attributeremover5 = nil, _slim_codeattributes10 = nil; + if (self.style == null) self.style = nil; + + + + if (dt == null) { + dt = nil; + }; + _buf['$<<'](""); + _buf['$<<'](dt.$text()); + return _buf['$<<']("");}, TMP_30.$$s = self, TMP_30.$$arity = 1, TMP_30)); + if ($truthy(dd['$nil?']())) { + return nil + } else { + + _buf['$<<']("
"); + if ($truthy(dd['$text?']())) { + + _buf['$<<']("

"); + _buf['$<<'](dd.$text()); + _buf['$<<']("

");}; + if ($truthy(dd['$blocks?']())) { + _buf['$<<'](dd.$content())}; + return _buf['$<<']("
"); + };}, TMP_29.$$s = self, TMP_29.$$arity = 2, TMP_29)); + _buf['$<<']("
");}; + return (_buf = _buf.$join(""));}, TMP_24.$$s = self, TMP_24.$$arity = 0, TMP_24)); + }, TMP_Converter_dlist_23.$$arity = -2); + + Opal.def(self, '$inline_footnote', TMP_Converter_inline_footnote_31 = function $$inline_footnote(node, opts) { + var TMP_32, self = this; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + node.$extend($$($nesting, 'Helpers')); + return $send(node, 'instance_eval', [], (TMP_32 = function(){var self = TMP_32.$$s || this, _buf = nil, _slim_codeattributes1 = nil; + if (self.type == null) self.type = nil; + if (self.id == null) self.id = nil; + + + if ($truthy(opts['$empty?']())) { + } else { + self.$converter().$set_local_variables(self.$binding(), opts) + }; + _buf = []; + if (self.type['$==']("xref")) { + + _buf['$<<']("["); + _buf['$<<'](self.$attr("index")); + _buf['$<<']("]"); + } else { + + _buf['$<<']("["); + _buf['$<<'](self.$attr("index")); + _buf['$<<']("]"); + }; + return (_buf = _buf.$join(""));}, TMP_32.$$s = self, TMP_32.$$arity = 0, TMP_32)); + }, TMP_Converter_inline_footnote_31.$$arity = -2); + + Opal.def(self, '$asciidoctor_revealjs', TMP_Converter_asciidoctor_revealjs_33 = function $$asciidoctor_revealjs(node, opts) { + var TMP_34, self = this; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + node.$extend($$($nesting, 'Helpers')); + return $send(node, 'instance_eval', [], (TMP_34 = function(){var self = TMP_34.$$s || this, _buf = nil; + + + if ($truthy(opts['$empty?']())) { + } else { + self.$converter().$set_local_variables(self.$binding(), opts) + }; + _buf = []; + _buf['$<<'](""); + return (_buf = _buf.$join(""));}, TMP_34.$$s = self, TMP_34.$$arity = 0, TMP_34)); + }, TMP_Converter_asciidoctor_revealjs_33.$$arity = -2); + + Opal.def(self, '$image', TMP_Converter_image_35 = function $$image(node, opts) { + var TMP_36, self = this; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + node.$extend($$($nesting, 'Helpers')); + return $send(node, 'instance_eval', [], (TMP_36 = function(){var self = TMP_36.$$s || this, $a, $b, _buf = nil, width = nil, height = nil, _temple_html_attributeremover1 = nil, _temple_html_attributemerger1 = nil, $writer = nil, _slim_codeattributes1 = nil, _slim_codeattributes2 = nil, _slim_codeattributes3 = nil, _slim_codeattributes4 = nil, _slim_codeattributes5 = nil, _slim_codeattributes6 = nil, _slim_codeattributes7 = nil, _slim_codeattributes8 = nil, _slim_codeattributes9 = nil, _slim_codeattributes10 = nil, _slim_codeattributes11 = nil, _slim_codeattributes12 = nil, _slim_codeattributes13 = nil, _slim_codeattributes14 = nil; + if (self.id == null) self.id = nil; + + + if ($truthy(opts['$empty?']())) { + } else { + self.$converter().$set_local_variables(self.$binding(), opts) + }; + _buf = []; + width = (function() {if ($truthy(self['$attr?']("width"))) { + + return self.$attr("width"); + } else { + return nil + }; return nil; })(); + height = (function() {if ($truthy(self['$attr?']("height"))) { + + return self.$attr("height"); + } else { + return nil + }; return nil; })(); + if ($truthy(($truthy($a = self['$has_role?']("stretch")) ? ($truthy($b = self['$attr?']("width")) ? $b : self['$attr?']("height"))['$!']() : $a))) { + height = "100%"}; + if ($truthy(($truthy($a = self.$attributes()['$[]'](1)['$==']("background")) ? $a : self.$attributes()['$[]'](1)['$==']("canvas")))) { + } else { + + _buf['$<<'](""); + if ($truthy(self['$attr?']("link"))) { + + _buf['$<<'](""); + } else { + + _buf['$<<'](""); + }; + _buf['$<<'](""); + if ($truthy(self['$title?']())) { + + _buf['$<<']("
"); + _buf['$<<'](self.$captioned_title()); + _buf['$<<']("
");}; + }; + return (_buf = _buf.$join(""));}, TMP_36.$$s = self, TMP_36.$$arity = 0, TMP_36)); + }, TMP_Converter_image_35.$$arity = -2); + + Opal.def(self, '$inline_break', TMP_Converter_inline_break_37 = function $$inline_break(node, opts) { + var TMP_38, self = this; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + node.$extend($$($nesting, 'Helpers')); + return $send(node, 'instance_eval', [], (TMP_38 = function(){var self = TMP_38.$$s || this, _buf = nil; + if (self.text == null) self.text = nil; + + + if ($truthy(opts['$empty?']())) { + } else { + self.$converter().$set_local_variables(self.$binding(), opts) + }; + _buf = []; + _buf['$<<'](self.text); + _buf['$<<']("
"); + return (_buf = _buf.$join(""));}, TMP_38.$$s = self, TMP_38.$$arity = 0, TMP_38)); + }, TMP_Converter_inline_break_37.$$arity = -2); + + Opal.def(self, '$preamble', TMP_Converter_preamble_39 = function $$preamble(node, opts) { + var TMP_40, self = this; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + node.$extend($$($nesting, 'Helpers')); + return $send(node, 'instance_eval', [], (TMP_40 = function(){var self = TMP_40.$$s || this, _buf = nil; + + + if ($truthy(opts['$empty?']())) { + } else { + self.$converter().$set_local_variables(self.$binding(), opts) + }; + _buf = []; + return (_buf = _buf.$join(""));}, TMP_40.$$s = self, TMP_40.$$arity = 0, TMP_40)); + }, TMP_Converter_preamble_39.$$arity = -2); + + Opal.def(self, '$thematic_break', TMP_Converter_thematic_break_41 = function $$thematic_break(node, opts) { + var TMP_42, self = this; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + node.$extend($$($nesting, 'Helpers')); + return $send(node, 'instance_eval', [], (TMP_42 = function(){var self = TMP_42.$$s || this, _buf = nil; + + + if ($truthy(opts['$empty?']())) { + } else { + self.$converter().$set_local_variables(self.$binding(), opts) + }; + _buf = []; + _buf['$<<']("
"); + return (_buf = _buf.$join(""));}, TMP_42.$$s = self, TMP_42.$$arity = 0, TMP_42)); + }, TMP_Converter_thematic_break_41.$$arity = -2); + + Opal.def(self, '$quote', TMP_Converter_quote_43 = function $$quote(node, opts) { + var TMP_44, self = this; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + node.$extend($$($nesting, 'Helpers')); + return $send(node, 'instance_eval', [], (TMP_44 = function(){var self = TMP_44.$$s || this, $a, _buf = nil, _temple_html_attributeremover1 = nil, _temple_html_attributemerger1 = nil, $writer = nil, _slim_codeattributes1 = nil, _slim_codeattributes2 = nil, attribution = nil, citetitle = nil; + if (self.id == null) self.id = nil; + + + if ($truthy(opts['$empty?']())) { + } else { + self.$converter().$set_local_variables(self.$binding(), opts) + }; + _buf = []; + _buf['$<<'](""); + if ($truthy(self['$title?']())) { + + _buf['$<<']("
"); + _buf['$<<'](self.$title()); + _buf['$<<']("
");}; + _buf['$<<']("
"); + _buf['$<<'](self.$content()); + _buf['$<<']("
"); + attribution = (function() {if ($truthy(self['$attr?']("attribution"))) { + + return self.$attr("attribution"); + } else { + return nil + }; return nil; })(); + citetitle = (function() {if ($truthy(self['$attr?']("citetitle"))) { + + return self.$attr("citetitle"); + } else { + return nil + }; return nil; })(); + if ($truthy(($truthy($a = attribution) ? $a : citetitle))) { + + _buf['$<<']("
"); + if ($truthy(citetitle)) { + + _buf['$<<'](""); + _buf['$<<'](citetitle); + _buf['$<<']("");}; + if ($truthy(attribution)) { + + if ($truthy(citetitle)) { + _buf['$<<']("
")}; + _buf['$<<']("— "); + _buf['$<<'](attribution);}; + _buf['$<<']("
");}; + _buf['$<<'](""); + return (_buf = _buf.$join(""));}, TMP_44.$$s = self, TMP_44.$$arity = 0, TMP_44)); + }, TMP_Converter_quote_43.$$arity = -2); + + Opal.def(self, '$inline_indexterm', TMP_Converter_inline_indexterm_45 = function $$inline_indexterm(node, opts) { + var TMP_46, self = this; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + node.$extend($$($nesting, 'Helpers')); + return $send(node, 'instance_eval', [], (TMP_46 = function(){var self = TMP_46.$$s || this, _buf = nil; + if (self.type == null) self.type = nil; + if (self.text == null) self.text = nil; + + + if ($truthy(opts['$empty?']())) { + } else { + self.$converter().$set_local_variables(self.$binding(), opts) + }; + _buf = []; + if (self.type['$==']("visible")) { + _buf['$<<'](self.text)}; + return (_buf = _buf.$join(""));}, TMP_46.$$s = self, TMP_46.$$arity = 0, TMP_46)); + }, TMP_Converter_inline_indexterm_45.$$arity = -2); + + Opal.def(self, '$pass', TMP_Converter_pass_47 = function $$pass(node, opts) { + var TMP_48, self = this; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + node.$extend($$($nesting, 'Helpers')); + return $send(node, 'instance_eval', [], (TMP_48 = function(){var self = TMP_48.$$s || this, _buf = nil; + + + if ($truthy(opts['$empty?']())) { + } else { + self.$converter().$set_local_variables(self.$binding(), opts) + }; + _buf = []; + _buf['$<<'](self.$content()); + return (_buf = _buf.$join(""));}, TMP_48.$$s = self, TMP_48.$$arity = 0, TMP_48)); + }, TMP_Converter_pass_47.$$arity = -2); + + Opal.def(self, '$table', TMP_Converter_table_49 = function $$table(node, opts) { + var TMP_50, self = this; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + node.$extend($$($nesting, 'Helpers')); + return $send(node, 'instance_eval', [], (TMP_50 = function(){var self = TMP_50.$$s || this, TMP_51, TMP_52, TMP_53, TMP_54, _buf = nil, _slim_codeattributes1 = nil, _temple_html_attributeremover1 = nil, _slim_codeattributes2 = nil, _slim_codeattributes3 = nil; + if (self.id == null) self.id = nil; + if (self.columns == null) self.columns = nil; + + + if ($truthy(opts['$empty?']())) { + } else { + self.$converter().$set_local_variables(self.$binding(), opts) + }; + _buf = []; + _buf['$<<'](""); + if ($truthy(self['$title?']())) { + + _buf['$<<'](""); + _buf['$<<'](self.$captioned_title()); + _buf['$<<']("");}; + if ($truthy(self.$attr("rowcount")['$zero?']())) { + } else { + + _buf['$<<'](""); + if ($truthy(self['$option?']("autowidth"))) { + $send(self.columns, 'each', [], (TMP_51 = function(){var self = TMP_51.$$s || this; + + return _buf['$<<']("")}, TMP_51.$$s = self, TMP_51.$$arity = 0, TMP_51)) + } else { + $send(self.columns, 'each', [], (TMP_52 = function(col){var self = TMP_52.$$s || this; + + + + if (col == null) { + col = nil; + }; + _buf['$<<']("");}, TMP_52.$$s = self, TMP_52.$$arity = 1, TMP_52)) + }; + _buf['$<<'](""); + $send($send(["head", "foot", "body"], 'select', [], (TMP_53 = function(tblsec){var self = TMP_53.$$s || this; + if (self.rows == null) self.rows = nil; + + + + if (tblsec == null) { + tblsec = nil; + }; + return self.rows['$[]'](tblsec)['$empty?']()['$!']();}, TMP_53.$$s = self, TMP_53.$$arity = 1, TMP_53)), 'each', [], (TMP_54 = function(tblsec){var self = TMP_54.$$s || this, TMP_55; + if (self.rows == null) self.rows = nil; + + + + if (tblsec == null) { + tblsec = nil; + }; + _buf['$<<'](""); + return $send(self.rows['$[]'](tblsec), 'each', [], (TMP_55 = function(row){var self = TMP_55.$$s || this, TMP_56; + + + + if (row == null) { + row = nil; + }; + _buf['$<<'](""); + $send(row, 'each', [], (TMP_56 = function(cell){var self = TMP_56.$$s || this, $a, TMP_57, cell_content = nil, $case = nil, _slim_controls1 = nil; + if (self.document == null) self.document = nil; + + + + if (cell == null) { + cell = nil; + }; + if (tblsec['$==']("head")) { + cell_content = cell.$text() + } else { + $case = cell.$style(); + if ("literal"['$===']($case)) {cell_content = cell.$text()} + else {cell_content = cell.$content()} + }; + _slim_controls1 = $send(self, 'html_tag', [(function() {if ($truthy(($truthy($a = tblsec['$==']("head")) ? $a : cell.$style()['$==']("header")))) { + return "th" + } else { + return "td" + }; return nil; })(), $hash2(["class", "colspan", "rowspan", "style"], {"class": ["tableblock", "" + "halign-" + (cell.$attr("halign")), "" + "valign-" + (cell.$attr("valign"))], "colspan": cell.$colspan(), "rowspan": cell.$rowspan(), "style": (function() {if ($truthy(self.document['$attr?']("cellbgcolor"))) { + return "" + "background-color:" + (self.document.$attr("cellbgcolor")) + ";" + } else { + return nil + }; return nil; })()})], (TMP_57 = function(){var self = TMP_57.$$s || this, TMP_58, TMP_59, _slim_controls2 = nil; + + + _slim_controls2 = []; + if (tblsec['$==']("head")) { + _slim_controls2['$<<'](cell_content) + } else { + $case = cell.$style(); + if ("asciidoc"['$===']($case)) { + _slim_controls2['$<<']("
"); + _slim_controls2['$<<'](cell_content); + _slim_controls2['$<<']("
");} + else if ("literal"['$===']($case)) { + _slim_controls2['$<<']("
");
+                    _slim_controls2['$<<'](cell_content);
+                    _slim_controls2['$<<']("
");} + else if ("header"['$===']($case)) {$send(cell_content, 'each', [], (TMP_58 = function(text){var self = TMP_58.$$s || this; + + + + if (text == null) { + text = nil; + }; + _slim_controls2['$<<']("

"); + _slim_controls2['$<<'](text); + return _slim_controls2['$<<']("

");}, TMP_58.$$s = self, TMP_58.$$arity = 1, TMP_58))} + else {$send(cell_content, 'each', [], (TMP_59 = function(text){var self = TMP_59.$$s || this; + + + + if (text == null) { + text = nil; + }; + _slim_controls2['$<<']("

"); + _slim_controls2['$<<'](text); + return _slim_controls2['$<<']("

");}, TMP_59.$$s = self, TMP_59.$$arity = 1, TMP_59))} + }; + return (_slim_controls2 = _slim_controls2.$join(""));}, TMP_57.$$s = self, TMP_57.$$arity = 0, TMP_57)); + return _buf['$<<'](_slim_controls1);}, TMP_56.$$s = self, TMP_56.$$arity = 1, TMP_56)); + return _buf['$<<']("");}, TMP_55.$$s = self, TMP_55.$$arity = 1, TMP_55));}, TMP_54.$$s = self, TMP_54.$$arity = 1, TMP_54)); + }; + _buf['$<<'](""); + return (_buf = _buf.$join(""));}, TMP_50.$$s = self, TMP_50.$$arity = 0, TMP_50)); + }, TMP_Converter_table_49.$$arity = -2); + + Opal.def(self, '$document', TMP_Converter_document_60 = function $$document(node, opts) { + var TMP_61, self = this; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + node.$extend($$($nesting, 'Helpers')); + return $send(node, 'instance_eval', [], (TMP_61 = function(){var self = TMP_61.$$s || this, $a, TMP_62, _buf = nil, _slim_codeattributes1 = nil, revealjsdir = nil, asset_uri_scheme = nil, cdn_base = nil, _slim_codeattributes4 = nil, _slim_codeattributes5 = nil, _slim_codeattributes6 = nil, eqnums_val = nil, eqnums_opt = nil, $case = nil, _slim_codeattributes7 = nil, _slim_codeattributes8 = nil, _slim_codeattributes9 = nil, docinfo_content = nil, _slim_codeattributes10 = nil, customcss = nil, bg_image = nil, bg_video = nil, _temple_html_attributeremover1 = nil, _temple_html_attributemerger1 = nil, $writer = nil, _slim_codeattributes11 = nil, _slim_codeattributes12 = nil, _slim_codeattributes13 = nil, _slim_codeattributes14 = nil, _slim_codeattributes15 = nil, _slim_codeattributes16 = nil, _slim_codeattributes17 = nil, _slim_codeattributes18 = nil, _slim_codeattributes19 = nil, _slim_codeattributes20 = nil, _slim_codeattributes21 = nil, _slim_codeattributes22 = nil, _slim_codeattributes23 = nil, _slim_codeattributes24 = nil, _title_obj = nil, _slice = nil, preamble = nil; + if (self.safe == null) self.safe = nil; + if (self.header == null) self.header = nil; + if (self.document == null) self.document = nil; + + + if ($truthy(opts['$empty?']())) { + } else { + self.$converter().$set_local_variables(self.$binding(), opts) + }; + _buf = []; + _buf['$<<'](""); + if ($truthy((($a = $$($nesting, 'RUBY_ENGINE')['$==']("opal")) ? $$($nesting, 'JAVASCRIPT_PLATFORM')['$==']("node") : $$($nesting, 'RUBY_ENGINE')['$==']("opal")))) { + revealjsdir = self.$attr("revealjsdir", "node_modules/reveal.js") + } else { + revealjsdir = self.$attr("revealjsdir", "reveal.js") + }; + if ($truthy((asset_uri_scheme = self.$attr("asset-uri-scheme", "https"))['$empty?']())) { + } else { + asset_uri_scheme = "" + (asset_uri_scheme) + ":" + }; + cdn_base = "" + (asset_uri_scheme) + "//cdnjs.cloudflare.com/ajax/libs"; + $send(["description", "keywords", "author", "copyright"], 'each', [], (TMP_62 = function(key){var self = TMP_62.$$s || this, _slim_codeattributes2 = nil, _slim_codeattributes3 = nil; + + + + if (key == null) { + key = nil; + }; + if ($truthy(self['$attr?'](key))) { + + _buf['$<<'](""); + } else { + return nil + };}, TMP_62.$$s = self, TMP_62.$$arity = 1, TMP_62)); + _buf['$<<'](""); + _buf['$<<'](self.$doctitle($hash2(["sanitize", "use_fallback"], {"sanitize": true, "use_fallback": true}))); + _buf['$<<'](""); + if ($truthy(self['$attr?']("revealjs_customtheme"))) { + + _buf['$<<'](""); + } else { + + _buf['$<<'](""); + }; + _buf['$<<'](""); + if ($truthy(self['$attr?']("icons", "font"))) { + if ($truthy(self['$attr?']("iconfont-remote"))) { + + _buf['$<<'](""); + } else { + + _buf['$<<'](""); + }}; + if ($truthy(self['$attr?']("stem"))) { + + eqnums_val = self.$attr("eqnums", "none"); + if (eqnums_val['$==']("")) { + eqnums_val = "AMS"}; + eqnums_opt = "" + " equationNumbers: { autoNumber: \"" + (eqnums_val) + "\" } "; + _buf['$<<']("");}; + $case = self.$document().$attr("source-highlighter"); + if ("coderay"['$===']($case)) {if (self.$attr("coderay-css", "class")['$==']("class")) { + if ($truthy(($truthy($a = $rb_ge(self.safe, $$$($$$($$($nesting, 'Asciidoctor'), 'SafeMode'), 'SECURE'))) ? $a : self['$attr?']("linkcss")))) { + + _buf['$<<'](""); + } else { + + _buf['$<<'](""); + }}} + else if ("pygments"['$===']($case)) {if (self.$attr("pygments-css", "class")['$==']("class")) { + if ($truthy(($truthy($a = $rb_ge(self.safe, $$$($$$($$($nesting, 'Asciidoctor'), 'SafeMode'), 'SECURE'))) ? $a : self['$attr?']("linkcss")))) { + + _buf['$<<'](""); + } else { + + _buf['$<<'](""); + }}}; + if ($truthy(self['$attr?']("highlightjs-theme"))) { + + _buf['$<<'](""); + } else { + + _buf['$<<'](""); + }; + _buf['$<<'](""); + if ($truthy((docinfo_content = self.$docinfo("header", ".html"))['$empty?']())) { + } else { + _buf['$<<'](docinfo_content) + }; + if ($truthy(self['$attr?']("customcss"))) { + + _buf['$<<']("");}; + _buf['$<<']("
"); + if ($truthy(($truthy($a = self.$notitle()) ? $a : self['$has_header?']()['$!']()))) { + } else { + + bg_image = (function() {if ($truthy(self['$attr?']("title-slide-background-image"))) { + + return self.$image_uri(self.$attr("title-slide-background-image")); + } else { + return nil + }; return nil; })(); + bg_video = (function() {if ($truthy(self['$attr?']("title-slide-background-video"))) { + + return self.$media_uri(self.$attr("title-slide-background-video")); + } else { + return nil + }; return nil; })(); + _buf['$<<'](""); + if ($truthy((_title_obj = self.$doctitle($hash2(["partition", "use_fallback"], {"partition": true, "use_fallback": true})))['$subtitle?']())) { + + _buf['$<<']("

"); + _buf['$<<'](self.$slice_text(_title_obj.$title(), (_slice = self.$header()['$option?']("slice")))); + _buf['$<<']("

"); + _buf['$<<'](self.$slice_text(_title_obj.$subtitle(), _slice)); + _buf['$<<']("

"); + } else { + + _buf['$<<']("

"); + _buf['$<<'](self.header.$title()); + _buf['$<<']("

"); + }; + preamble = self.document.$find_by($hash2(["context"], {"context": "preamble"})); + if ($truthy(($truthy($a = preamble['$nil?']()) ? $a : preamble.$length()['$=='](0)))) { + } else { + + _buf['$<<']("
"); + _buf['$<<'](preamble.$pop().$content()); + _buf['$<<']("
"); + }; + if ($truthy(self.$author()['$nil?']())) { + } else { + + _buf['$<<']("

"); + _buf['$<<'](self.$author()); + _buf['$<<']("

"); + }; + _buf['$<<']("
"); + }; + _buf['$<<'](self.$content()); + _buf['$<<'](""); + if ($truthy((docinfo_content = self.$docinfo("footer", ".html"))['$empty?']())) { + } else { + _buf['$<<'](docinfo_content) + }; + _buf['$<<'](""); + return (_buf = _buf.$join(""));}, TMP_61.$$s = self, TMP_61.$$arity = 0, TMP_61)); + }, TMP_Converter_document_60.$$arity = -2); + + Opal.def(self, '$inline_callout', TMP_Converter_inline_callout_63 = function $$inline_callout(node, opts) { + var TMP_64, self = this; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + node.$extend($$($nesting, 'Helpers')); + return $send(node, 'instance_eval', [], (TMP_64 = function(){var self = TMP_64.$$s || this, _buf = nil, _slim_codeattributes1 = nil, _slim_codeattributes2 = nil, _slim_codeattributes3 = nil; + if (self.document == null) self.document = nil; + if (self.text == null) self.text = nil; + + + if ($truthy(opts['$empty?']())) { + } else { + self.$converter().$set_local_variables(self.$binding(), opts) + }; + _buf = []; + if ($truthy(self.document['$attr?']("icons", "font"))) { + + _buf['$<<'](""); + _buf['$<<']("" + "(" + (self.text) + ")"); + _buf['$<<'](""); + } else if ($truthy(self.document['$attr?']("icons"))) { + + _buf['$<<'](""); + } else { + + _buf['$<<'](""); + _buf['$<<']("" + "(" + (self.text) + ")"); + _buf['$<<'](""); + }; + return (_buf = _buf.$join(""));}, TMP_64.$$s = self, TMP_64.$$arity = 0, TMP_64)); + }, TMP_Converter_inline_callout_63.$$arity = -2); + + Opal.def(self, '$notes', TMP_Converter_notes_65 = function $$notes(node, opts) { + var TMP_66, self = this; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + node.$extend($$($nesting, 'Helpers')); + return $send(node, 'instance_eval', [], (TMP_66 = function(){var self = TMP_66.$$s || this, _buf = nil; + + + if ($truthy(opts['$empty?']())) { + } else { + self.$converter().$set_local_variables(self.$binding(), opts) + }; + _buf = []; + _buf['$<<'](""); + return (_buf = _buf.$join(""));}, TMP_66.$$s = self, TMP_66.$$arity = 0, TMP_66)); + }, TMP_Converter_notes_65.$$arity = -2); + + Opal.def(self, '$inline_image', TMP_Converter_inline_image_67 = function $$inline_image(node, opts) { + var TMP_68, self = this; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + node.$extend($$($nesting, 'Helpers')); + return $send(node, 'instance_eval', [], (TMP_68 = function(){var self = TMP_68.$$s || this, $a, _buf = nil, _temple_html_attributeremover1 = nil, _slim_codeattributes1 = nil, _slim_codeattributes2 = nil, style_class = nil, _slim_codeattributes3 = nil, _slim_codeattributes4 = nil, _temple_html_attributeremover2 = nil, _slim_codeattributes5 = nil, _slim_codeattributes6 = nil, _temple_html_attributeremover3 = nil, _slim_codeattributes7 = nil, _slim_codeattributes8 = nil, _slim_codeattributes9 = nil, _slim_codeattributes10 = nil, src = nil, _slim_codeattributes11 = nil, _slim_codeattributes12 = nil, _slim_codeattributes13 = nil, _slim_codeattributes14 = nil, _slim_codeattributes15 = nil, _slim_codeattributes16 = nil, _slim_codeattributes17 = nil, _slim_codeattributes18 = nil, _slim_codeattributes19 = nil, _slim_codeattributes20 = nil, _slim_codeattributes21 = nil, _slim_codeattributes22 = nil; + if (self.type == null) self.type = nil; + if (self.document == null) self.document = nil; + if (self.target == null) self.target = nil; + + + if ($truthy(opts['$empty?']())) { + } else { + self.$converter().$set_local_variables(self.$binding(), opts) + }; + _buf = []; + _buf['$<<'](""); + if ($truthy((($a = self.type['$==']("icon")) ? self.document['$attr?']("icons", "font") : self.type['$==']("icon")))) { + + style_class = ["" + "fa fa-" + (self.target)]; + if ($truthy(self['$attr?']("size"))) { + style_class['$<<']("" + "fa-" + (self.$attr("size")))}; + if ($truthy(self['$attr?']("rotate"))) { + style_class['$<<']("" + "fa-rotate-" + (self.$attr("rotate")))}; + if ($truthy(self['$attr?']("flip"))) { + style_class['$<<']("" + "fa-flip-" + (self.$attr("flip")))}; + if ($truthy(self['$attr?']("link"))) { + + _buf['$<<'](""); + } else { + + _buf['$<<'](""); + }; + } else if ($truthy((($a = self.type['$==']("icon")) ? self.document['$attr?']("icons")['$!']() : self.type['$==']("icon")))) { + if ($truthy(self['$attr?']("link"))) { + + _buf['$<<']("["); + _buf['$<<'](self.$attr("alt")); + _buf['$<<']("]"); + } else { + + _buf['$<<']("["); + _buf['$<<'](self.$attr("alt")); + _buf['$<<']("]"); + } + } else { + + src = (function() {if (self.type['$==']("icon")) { + + return self.$icon_uri(self.target); + } else { + + return self.$image_uri(self.target); + }; return nil; })(); + if ($truthy(self['$attr?']("link"))) { + + _buf['$<<'](""); + } else { + + _buf['$<<'](""); + }; + }; + _buf['$<<'](""); + return (_buf = _buf.$join(""));}, TMP_68.$$s = self, TMP_68.$$arity = 0, TMP_68)); + }, TMP_Converter_inline_image_67.$$arity = -2); + + Opal.def(self, '$video', TMP_Converter_video_69 = function $$video(node, opts) { + var TMP_70, self = this; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + node.$extend($$($nesting, 'Helpers')); + return $send(node, 'instance_eval', [], (TMP_70 = function(){var self = TMP_70.$$s || this, $a, _buf = nil, no_stretch = nil, width = nil, height = nil, _temple_html_attributeremover1 = nil, _temple_html_attributemerger1 = nil, $writer = nil, _slim_codeattributes1 = nil, _slim_codeattributes2 = nil, $case = nil, asset_uri_scheme = nil, start_anchor = nil, delimiter = nil, loop_param = nil, src = nil, _slim_codeattributes3 = nil, _slim_codeattributes4 = nil, _slim_codeattributes5 = nil, _slim_codeattributes6 = nil, _slim_codeattributes7 = nil, params = nil, _slim_codeattributes8 = nil, _slim_codeattributes9 = nil, _slim_codeattributes10 = nil, _slim_codeattributes11 = nil, _slim_codeattributes12 = nil, _slim_codeattributes13 = nil, _slim_codeattributes14 = nil, _slim_codeattributes15 = nil, _slim_codeattributes16 = nil, _slim_codeattributes17 = nil, _slim_codeattributes18 = nil, _slim_codeattributes19 = nil, _slim_codeattributes20 = nil; + if (self.style == null) self.style = nil; + if (self.id == null) self.id = nil; + + + if ($truthy(opts['$empty?']())) { + } else { + self.$converter().$set_local_variables(self.$binding(), opts) + }; + _buf = []; + no_stretch = ($truthy($a = self['$attr?']("width")) ? $a : self['$attr?']("height")); + width = (function() {if ($truthy(self['$attr?']("width"))) { + + return self.$attr("width"); + } else { + return "100%" + }; return nil; })(); + height = (function() {if ($truthy(self['$attr?']("height"))) { + + return self.$attr("height"); + } else { + return "100%" + }; return nil; })(); + _buf['$<<'](""); + if ($truthy(self['$title?']())) { + + _buf['$<<']("
"); + _buf['$<<'](self.$captioned_title()); + _buf['$<<']("
");}; + $case = self.$attr("poster"); + if ("vimeo"['$===']($case)) { + if ($truthy((asset_uri_scheme = self.$attr("asset_uri_scheme", "https"))['$empty?']())) { + } else { + asset_uri_scheme = "" + (asset_uri_scheme) + ":" + }; + start_anchor = (function() {if ($truthy(self['$attr?']("start"))) { + return "" + "#at=" + (self.$attr("start")) + } else { + return nil + }; return nil; })(); + delimiter = "?"; + loop_param = (function() {if ($truthy(self['$option?']("loop"))) { + return "" + (delimiter) + "loop=1" + } else { + return nil + }; return nil; })(); + src = "" + (asset_uri_scheme) + "//player.vimeo.com/video/" + (self.$attr("target")) + (start_anchor) + (loop_param); + _buf['$<<']("");} + else if ("youtube"['$===']($case)) { + if ($truthy((asset_uri_scheme = self.$attr("asset_uri_scheme", "https"))['$empty?']())) { + } else { + asset_uri_scheme = "" + (asset_uri_scheme) + ":" + }; + params = ["rel=0"]; + if ($truthy(self['$attr?']("start"))) { + params['$<<']("" + "start=" + (self.$attr("start")))}; + if ($truthy(self['$attr?']("end"))) { + params['$<<']("" + "end=" + (self.$attr("end")))}; + if ($truthy(self['$option?']("loop"))) { + params['$<<']("loop=1")}; + if ($truthy(self['$option?']("nocontrols"))) { + params['$<<']("controls=0")}; + src = "" + (asset_uri_scheme) + "//www.youtube.com/embed/" + (self.$attr("target")) + "?" + ($rb_times(params, "&")); + _buf['$<<']("");} + else { + _buf['$<<']("Your browser does not support the video tag.");}; + _buf['$<<'](""); + return (_buf = _buf.$join(""));}, TMP_70.$$s = self, TMP_70.$$arity = 0, TMP_70)); + }, TMP_Converter_video_69.$$arity = -2); + + Opal.def(self, '$literal', TMP_Converter_literal_71 = function $$literal(node, opts) { + var TMP_72, self = this; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + node.$extend($$($nesting, 'Helpers')); + return $send(node, 'instance_eval', [], (TMP_72 = function(){var self = TMP_72.$$s || this, $a, _buf = nil, _temple_html_attributeremover1 = nil, _temple_html_attributemerger1 = nil, $writer = nil, _slim_codeattributes1 = nil, _slim_codeattributes2 = nil, _temple_html_attributeremover2 = nil, _slim_codeattributes3 = nil; + if (self.id == null) self.id = nil; + if (self.document == null) self.document = nil; + + + if ($truthy(opts['$empty?']())) { + } else { + self.$converter().$set_local_variables(self.$binding(), opts) + }; + _buf = []; + _buf['$<<'](""); + if ($truthy(self['$title?']())) { + + _buf['$<<']("
"); + _buf['$<<'](self.$title()); + _buf['$<<']("
");}; + _buf['$<<']("
"); + _buf['$<<'](self.$content()); + _buf['$<<']("
"); + return (_buf = _buf.$join(""));}, TMP_72.$$s = self, TMP_72.$$arity = 0, TMP_72)); + }, TMP_Converter_literal_71.$$arity = -2); + + Opal.def(self, '$floating_title', TMP_Converter_floating_title_73 = function $$floating_title(node, opts) { + var TMP_74, self = this; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + node.$extend($$($nesting, 'Helpers')); + return $send(node, 'instance_eval', [], (TMP_74 = function(){var self = TMP_74.$$s || this, _buf = nil, _slim_htag_filter1 = nil, _slim_codeattributes1 = nil, _temple_html_attributeremover1 = nil, _slim_codeattributes2 = nil; + + + if ($truthy(opts['$empty?']())) { + } else { + self.$converter().$set_local_variables(self.$binding(), opts) + }; + _buf = []; + _slim_htag_filter1 = $rb_plus(self.$level(), 1).$to_s(); + _buf['$<<'](""); + _buf['$<<'](self.$title()); + _buf['$<<'](""); + return (_buf = _buf.$join(""));}, TMP_74.$$s = self, TMP_74.$$arity = 0, TMP_74)); + }, TMP_Converter_floating_title_73.$$arity = -2); + + Opal.def(self, '$embedded', TMP_Converter_embedded_75 = function $$embedded(node, opts) { + var TMP_76, self = this; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + node.$extend($$($nesting, 'Helpers')); + return $send(node, 'instance_eval', [], (TMP_76 = function(){var self = TMP_76.$$s || this, $a, TMP_77, _buf = nil, _slim_codeattributes1 = nil; + if (self.id == null) self.id = nil; + if (self.header == null) self.header = nil; + + + if ($truthy(opts['$empty?']())) { + } else { + self.$converter().$set_local_variables(self.$binding(), opts) + }; + _buf = []; + if ($truthy(($truthy($a = self.$notitle()) ? $a : self['$has_header?']()['$!']()))) { + } else { + + _buf['$<<'](""); + _buf['$<<'](self.header.$title()); + _buf['$<<'](""); + }; + _buf['$<<'](self.$content()); + if ($truthy(($truthy($a = self['$footnotes?']()['$!']()) ? $a : self['$attr?']("nofootnotes")))) { + } else { + + _buf['$<<']("

"); + $send(self.$footnotes(), 'each', [], (TMP_77 = function(fn){var self = TMP_77.$$s || this; + + + + if (fn == null) { + fn = nil; + }; + _buf['$<<']("
"); + _buf['$<<'](fn.$index()); + _buf['$<<'](". "); + _buf['$<<'](fn.$text()); + return _buf['$<<']("
");}, TMP_77.$$s = self, TMP_77.$$arity = 1, TMP_77)); + _buf['$<<']("
"); + }; + return (_buf = _buf.$join(""));}, TMP_76.$$s = self, TMP_76.$$arity = 0, TMP_76)); + }, TMP_Converter_embedded_75.$$arity = -2); + + Opal.def(self, '$sidebar', TMP_Converter_sidebar_78 = function $$sidebar(node, opts) { + var TMP_79, self = this; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + node.$extend($$($nesting, 'Helpers')); + return $send(node, 'instance_eval', [], (TMP_79 = function(){var self = TMP_79.$$s || this, $a, $b, _buf = nil, _temple_html_attributeremover1 = nil, _temple_html_attributemerger1 = nil, $writer = nil, _slim_codeattributes1 = nil, _slim_codeattributes2 = nil; + if (self.id == null) self.id = nil; + + + if ($truthy(opts['$empty?']())) { + } else { + self.$converter().$set_local_variables(self.$binding(), opts) + }; + _buf = []; + if ($truthy(($truthy($a = ($truthy($b = self['$has_role?']("aside")) ? $b : self['$has_role?']("speaker"))) ? $a : self['$has_role?']("notes")))) { + + _buf['$<<'](""); + } else { + + _buf['$<<']("
"); + if ($truthy(self['$title?']())) { + + _buf['$<<']("
"); + _buf['$<<'](self.$title()); + _buf['$<<']("
");}; + _buf['$<<'](self.$content()); + _buf['$<<']("
"); + }; + return (_buf = _buf.$join(""));}, TMP_79.$$s = self, TMP_79.$$arity = 0, TMP_79)); + }, TMP_Converter_sidebar_78.$$arity = -2); + + Opal.def(self, '$outline', TMP_Converter_outline_80 = function $$outline(node, opts) { + var TMP_81, self = this; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + node.$extend($$($nesting, 'Helpers')); + return $send(node, 'instance_eval', [], (TMP_81 = function(){var self = TMP_81.$$s || this, $a, TMP_82, _buf = nil, toclevels = nil, slevel = nil; + + + if ($truthy(opts['$empty?']())) { + } else { + self.$converter().$set_local_variables(self.$binding(), opts) + }; + _buf = []; + if ($truthy(self.$sections()['$empty?']())) { + } else { + + toclevels = ($truthy($a = toclevels) ? $a : self.$document().$attr("toclevels", $$($nesting, 'DEFAULT_TOCLEVELS')).$to_i()); + slevel = self.$section_level(self.$sections().$first()); + _buf['$<<']("
    "); + $send(self.$sections(), 'each', [], (TMP_82 = function(sec){var self = TMP_82.$$s || this, $b, child_toc = nil; + + + + if (sec == null) { + sec = nil; + }; + _buf['$<<']("
  1. "); + _buf['$<<'](self.$section_title(sec)); + _buf['$<<'](""); + if ($truthy(($truthy($b = $rb_lt(sec.$level(), toclevels)) ? (child_toc = self.$converter().$convert(sec, "outline")) : $b))) { + _buf['$<<'](child_toc)}; + return _buf['$<<']("
  2. ");}, TMP_82.$$s = self, TMP_82.$$arity = 1, TMP_82)); + _buf['$<<']("
"); + }; + return (_buf = _buf.$join(""));}, TMP_81.$$s = self, TMP_81.$$arity = 0, TMP_81)); + }, TMP_Converter_outline_80.$$arity = -2); + + Opal.def(self, '$listing', TMP_Converter_listing_83 = function $$listing(node, opts) { + var TMP_84, self = this; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + node.$extend($$($nesting, 'Helpers')); + return $send(node, 'instance_eval', [], (TMP_84 = function(){var self = TMP_84.$$s || this, $a, $b, _buf = nil, nowrap = nil, language = nil, code_class = nil, pre_class = nil, pre_lang = nil, code_noescape = nil, $case = nil, _temple_html_attributeremover1 = nil, _slim_codeattributes1 = nil, _slim_codeattributes2 = nil, _slim_codeattributes3 = nil, _slim_codeattributes4 = nil, _temple_html_attributeremover2 = nil, _slim_codeattributes5 = nil, _temple_html_attributeremover3 = nil, _slim_codeattributes6 = nil; + if (self.document == null) self.document = nil; + if (self.style == null) self.style = nil; + if (self.id == null) self.id = nil; + + + if ($truthy(opts['$empty?']())) { + } else { + self.$converter().$set_local_variables(self.$binding(), opts) + }; + _buf = []; + if ($truthy(self['$title?']())) { + + _buf['$<<']("
"); + _buf['$<<'](self.$captioned_title()); + _buf['$<<']("
");}; + nowrap = ($truthy($a = self.document['$attr?']("prewrap")['$!']()) ? $a : self['$option?']("nowrap")); + if ($truthy(($truthy($a = self.style['$==']("source")) ? $a : (($b = self.style['$==']("listing")) ? self.$attributes()['$[]'](1)['$!=']("listing") : self.style['$==']("listing"))))) { + + language = self.$attr("language"); + code_class = (function() {if ($truthy(language)) { + return [language, "" + "language-" + (language)] + } else { + return nil + }; return nil; })(); + pre_class = ["highlight"]; + pre_lang = nil; + code_noescape = false; + $case = self.$document().$attr("source-highlighter"); + if ("coderay"['$===']($case)) {pre_class = ["CodeRay"]} + else if ("pygments"['$===']($case)) {pre_class = ["pygments", "highlight"]} + else if ("prettify"['$===']($case)) { + pre_class = ["prettyprint"]; + if ($truthy(self['$attr?']("linenums"))) { + pre_class['$<<']("linenums")}; + if ($truthy(language)) { + pre_class['$<<'](language)}; + if ($truthy(language)) { + pre_class['$<<']("" + "language-" + (language))}; + code_class = nil;} + else if ("html-pipeline"['$===']($case)) { + pre_lang = language; + pre_class = (code_class = nil); + nowrap = false;} + else if ("highlightjs"['$===']($case) || "highlight.js"['$===']($case)) {code_noescape = true}; + if ($truthy(nowrap)) { + pre_class['$<<']("nowrap")}; + pre_class['$<<']("listingblock"); + if ($truthy(self.$role())) { + pre_class['$<<'](self.$role())}; + _buf['$<<'](""); + _buf['$<<'](self.$content()); + _buf['$<<'](""); + } else { + + _buf['$<<'](""); + _buf['$<<'](self.$content()); + _buf['$<<'](""); + }; + return (_buf = _buf.$join(""));}, TMP_84.$$s = self, TMP_84.$$arity = 0, TMP_84)); + }, TMP_Converter_listing_83.$$arity = -2); + + Opal.def(self, '$inline_kbd', TMP_Converter_inline_kbd_85 = function $$inline_kbd(node, opts) { + var TMP_86, self = this; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + node.$extend($$($nesting, 'Helpers')); + return $send(node, 'instance_eval', [], (TMP_86 = function(){var self = TMP_86.$$s || this, TMP_87, _buf = nil, keys = nil; + + + if ($truthy(opts['$empty?']())) { + } else { + self.$converter().$set_local_variables(self.$binding(), opts) + }; + _buf = []; + if ((keys = self.$attr("keys")).$size()['$=='](1)) { + + _buf['$<<'](""); + _buf['$<<'](keys.$first()); + _buf['$<<'](""); + } else { + + _buf['$<<'](""); + $send(keys, 'each_with_index', [], (TMP_87 = function(key, idx){var self = TMP_87.$$s || this; + + + + if (key == null) { + key = nil; + }; + + if (idx == null) { + idx = nil; + }; + if ($truthy(idx['$zero?']())) { + } else { + _buf['$<<']("+") + }; + _buf['$<<'](""); + _buf['$<<'](key); + return _buf['$<<']("");}, TMP_87.$$s = self, TMP_87.$$arity = 2, TMP_87)); + _buf['$<<'](""); + }; + return (_buf = _buf.$join(""));}, TMP_86.$$s = self, TMP_86.$$arity = 0, TMP_86)); + }, TMP_Converter_inline_kbd_85.$$arity = -2); + + Opal.def(self, '$section', TMP_Converter_section_88 = function $$section(node, opts) { + var TMP_89, self = this; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + node.$extend($$($nesting, 'Helpers')); + return $send(node, 'instance_eval', [], (TMP_89 = function(){var self = TMP_89.$$s || this, $a, $b, TMP_90, TMP_91, TMP_93, TMP_94, _buf = nil, titleless = nil, title = nil, hide_title = nil, vertical_slides = nil, data_background_image = nil, data_background_size = nil, data_background_repeat = nil, data_background_transition = nil, section_images = nil, bg_image = nil, data_background_color = nil, _slim_codeattributes1 = nil, _temple_html_attributeremover1 = nil, _slim_codeattributes2 = nil, _slim_codeattributes3 = nil, _slim_codeattributes4 = nil, _slim_codeattributes5 = nil, _slim_codeattributes6 = nil, _slim_codeattributes7 = nil, _slim_codeattributes8 = nil, _slim_codeattributes9 = nil, _slim_codeattributes10 = nil, _slim_codeattributes11 = nil, _slim_codeattributes12 = nil, _slim_codeattributes13 = nil, _slim_codeattributes14 = nil, _slim_htag_filter1 = nil, _slim_codeattributes15 = nil, _temple_html_attributeremover2 = nil, _slim_codeattributes16 = nil, _slim_codeattributes17 = nil, _slim_codeattributes18 = nil, _slim_codeattributes19 = nil, _slim_codeattributes20 = nil, _slim_codeattributes21 = nil, _slim_codeattributes22 = nil, _slim_codeattributes23 = nil, _slim_codeattributes24 = nil, _slim_codeattributes25 = nil, _slim_codeattributes26 = nil, _slim_codeattributes27 = nil, _slim_codeattributes28 = nil; + if (self.level == null) self.level = nil; + + + if ($truthy(opts['$empty?']())) { + } else { + self.$converter().$set_local_variables(self.$binding(), opts) + }; + _buf = []; + titleless = (title = self.$title())['$==']("!"); + hide_title = ($truthy($a = ($truthy($b = titleless) ? $b : self['$option?']("notitle"))) ? $a : self['$option?']("conceal")); + vertical_slides = $send(self, 'find_by', [$hash2(["context"], {"context": "section"})], (TMP_90 = function(section){var self = TMP_90.$$s || this; + + + + if (section == null) { + section = nil; + }; + return section.$level()['$=='](2);}, TMP_90.$$s = self, TMP_90.$$arity = 1, TMP_90)); + $b = nil, $a = Opal.to_ary($b), (data_background_image = ($a[0] == null ? nil : $a[0])), (data_background_size = ($a[1] == null ? nil : $a[1])), (data_background_repeat = ($a[2] == null ? nil : $a[2])), (data_background_transition = ($a[3] == null ? nil : $a[3])), $b; + section_images = $send(self.$blocks(), 'map', [], (TMP_91 = function(block){var self = TMP_91.$$s || this, $c, TMP_92, ctx = nil; + + + + if (block == null) { + block = nil; + }; + if ((ctx = block.$context())['$==']("image")) { + if ($truthy(["background", "canvas"]['$include?'](block.$attributes()['$[]'](1)))) { + return block + } else { + return [] + } + } else if (ctx['$==']("section")) { + return [] + } else { + return ($truthy($c = $send(block, 'find_by', [$hash2(["context"], {"context": "image"})], (TMP_92 = function(image){var self = TMP_92.$$s || this; + + + + if (image == null) { + image = nil; + }; + return ["background", "canvas"]['$include?'](image.$attributes()['$[]'](1));}, TMP_92.$$s = self, TMP_92.$$arity = 1, TMP_92))) ? $c : []) + };}, TMP_91.$$s = self, TMP_91.$$arity = 1, TMP_91)); + if ($truthy((bg_image = section_images.$flatten().$first()))) { + + data_background_image = self.$image_uri(bg_image.$attr("target")); + data_background_size = bg_image.$attr("size"); + data_background_repeat = bg_image.$attr("repeat"); + data_background_transition = bg_image.$attr("transition");}; + if ($truthy(self['$attr?']("background-image"))) { + data_background_image = self.$image_uri(self.$attr("background-image"))}; + if ($truthy(self['$attr?']("background-color"))) { + data_background_color = self.$attr("background-color")}; + if ($truthy((($a = self.level['$=='](1)) ? vertical_slides['$empty?']()['$!']() : self.level['$=='](1)))) { + + _buf['$<<']("
"); + if ($truthy(hide_title)) { + } else { + + _buf['$<<']("

"); + _buf['$<<'](title); + _buf['$<<']("

"); + }; + $send($rb_minus(self.$blocks(), vertical_slides), 'each', [], (TMP_93 = function(block){var self = TMP_93.$$s || this; + + + + if (block == null) { + block = nil; + }; + return _buf['$<<'](block.$convert());}, TMP_93.$$s = self, TMP_93.$$arity = 1, TMP_93)); + _buf['$<<']("
"); + $send(vertical_slides, 'each', [], (TMP_94 = function(subsection){var self = TMP_94.$$s || this; + + + + if (subsection == null) { + subsection = nil; + }; + return _buf['$<<'](subsection.$convert());}, TMP_94.$$s = self, TMP_94.$$arity = 1, TMP_94)); + _buf['$<<']("
"); + } else if ($truthy($rb_ge(self.level, 3))) { + + _slim_htag_filter1 = self.level.$to_s(); + _buf['$<<'](""); + _buf['$<<'](title); + _buf['$<<'](""); + _buf['$<<'](self.$content().$chomp()); + } else { + + _buf['$<<'](""); + if ($truthy(hide_title)) { + } else { + + _buf['$<<']("

"); + _buf['$<<'](title); + _buf['$<<']("

"); + }; + _buf['$<<'](self.$content().$chomp()); + _buf['$<<'](""); + }; + return (_buf = _buf.$join(""));}, TMP_89.$$s = self, TMP_89.$$arity = 0, TMP_89)); + }, TMP_Converter_section_88.$$arity = -2); + + Opal.def(self, '$example', TMP_Converter_example_95 = function $$example(node, opts) { + var TMP_96, self = this; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + node.$extend($$($nesting, 'Helpers')); + return $send(node, 'instance_eval', [], (TMP_96 = function(){var self = TMP_96.$$s || this, _buf = nil, _temple_html_attributeremover1 = nil, _temple_html_attributemerger1 = nil, $writer = nil, _slim_codeattributes1 = nil, _slim_codeattributes2 = nil; + if (self.id == null) self.id = nil; + + + if ($truthy(opts['$empty?']())) { + } else { + self.$converter().$set_local_variables(self.$binding(), opts) + }; + _buf = []; + _buf['$<<'](""); + if ($truthy(self['$title?']())) { + + _buf['$<<']("
"); + _buf['$<<'](self.$captioned_title()); + _buf['$<<']("
");}; + _buf['$<<']("
"); + _buf['$<<'](self.$content()); + _buf['$<<']("
"); + return (_buf = _buf.$join(""));}, TMP_96.$$s = self, TMP_96.$$arity = 0, TMP_96)); + }, TMP_Converter_example_95.$$arity = -2); + + Opal.def(self, '$inline_button', TMP_Converter_inline_button_97 = function $$inline_button(node, opts) { + var TMP_98, self = this; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + node.$extend($$($nesting, 'Helpers')); + return $send(node, 'instance_eval', [], (TMP_98 = function(){var self = TMP_98.$$s || this, _buf = nil; + if (self.text == null) self.text = nil; + + + if ($truthy(opts['$empty?']())) { + } else { + self.$converter().$set_local_variables(self.$binding(), opts) + }; + _buf = []; + _buf['$<<'](""); + _buf['$<<'](self.text); + _buf['$<<'](""); + return (_buf = _buf.$join(""));}, TMP_98.$$s = self, TMP_98.$$arity = 0, TMP_98)); + }, TMP_Converter_inline_button_97.$$arity = -2); + + Opal.def(self, '$inline_menu', TMP_Converter_inline_menu_99 = function $$inline_menu(node, opts) { + var TMP_100, self = this; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + node.$extend($$($nesting, 'Helpers')); + return $send(node, 'instance_eval', [], (TMP_100 = function(){var self = TMP_100.$$s || this, TMP_101, _buf = nil, menu = nil, menuitem = nil, submenus = nil; + + + if ($truthy(opts['$empty?']())) { + } else { + self.$converter().$set_local_variables(self.$binding(), opts) + }; + _buf = []; + menu = self.$attr("menu"); + menuitem = self.$attr("menuitem"); + if ($truthy((submenus = self.$attr("submenus"))['$empty?']()['$!']())) { + + _buf['$<<'](""); + _buf['$<<'](menu); + _buf['$<<'](" ▸ "); + _buf['$<<']($send(submenus, 'map', [], (TMP_101 = function(submenu){var self = TMP_101.$$s || this; + + + + if (submenu == null) { + submenu = nil; + }; + return "" + "" + (submenu) + " ▸ ";}, TMP_101.$$s = self, TMP_101.$$arity = 1, TMP_101)).$join()); + _buf['$<<'](""); + _buf['$<<'](menuitem); + _buf['$<<'](""); + } else if ($truthy(menuitem['$nil?']()['$!']())) { + + _buf['$<<'](""); + _buf['$<<'](menu); + _buf['$<<'](" ▸ "); + _buf['$<<'](menuitem); + _buf['$<<'](""); + } else { + + _buf['$<<'](""); + _buf['$<<'](menu); + _buf['$<<'](""); + }; + return (_buf = _buf.$join(""));}, TMP_100.$$s = self, TMP_100.$$arity = 0, TMP_100)); + }, TMP_Converter_inline_menu_99.$$arity = -2); + + Opal.def(self, '$audio', TMP_Converter_audio_102 = function $$audio(node, opts) { + var TMP_103, self = this; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + node.$extend($$($nesting, 'Helpers')); + return $send(node, 'instance_eval', [], (TMP_103 = function(){var self = TMP_103.$$s || this, _buf = nil, _temple_html_attributeremover1 = nil, _temple_html_attributemerger1 = nil, $writer = nil, _slim_codeattributes1 = nil, _slim_codeattributes2 = nil, _slim_codeattributes3 = nil, _slim_codeattributes4 = nil, _slim_codeattributes5 = nil, _slim_codeattributes6 = nil; + if (self.style == null) self.style = nil; + if (self.id == null) self.id = nil; + + + if ($truthy(opts['$empty?']())) { + } else { + self.$converter().$set_local_variables(self.$binding(), opts) + }; + _buf = []; + _buf['$<<'](""); + if ($truthy(self['$title?']())) { + + _buf['$<<']("
"); + _buf['$<<'](self.$captioned_title()); + _buf['$<<']("
");}; + _buf['$<<']("
Your browser does not support the audio tag.
"); + return (_buf = _buf.$join(""));}, TMP_103.$$s = self, TMP_103.$$arity = 0, TMP_103)); + }, TMP_Converter_audio_102.$$arity = -2); + + Opal.def(self, '$stem', TMP_Converter_stem_104 = function $$stem(node, opts) { + var TMP_105, self = this; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + node.$extend($$($nesting, 'Helpers')); + return $send(node, 'instance_eval', [], (TMP_105 = function(){var self = TMP_105.$$s || this, $a, $b, _buf = nil, open = nil, close = nil, equation = nil, _temple_html_attributeremover1 = nil, _temple_html_attributemerger1 = nil, $writer = nil, _slim_codeattributes1 = nil, _slim_codeattributes2 = nil; + if (self.style == null) self.style = nil; + if (self.subs == null) self.subs = nil; + if (self.id == null) self.id = nil; + + + if ($truthy(opts['$empty?']())) { + } else { + self.$converter().$set_local_variables(self.$binding(), opts) + }; + _buf = []; + $b = $$$($$($nesting, 'Asciidoctor'), 'BLOCK_MATH_DELIMITERS')['$[]'](self.style.$to_sym()), $a = Opal.to_ary($b), (open = ($a[0] == null ? nil : $a[0])), (close = ($a[1] == null ? nil : $a[1])), $b; + equation = self.$content().$strip(); + if ($truthy(($truthy($a = ($truthy($b = self.subs['$nil?']()) ? $b : self.subs['$empty?']())) ? self['$attr?']("subs")['$!']() : $a))) { + equation = self.$sub_specialcharacters(equation)}; + if ($truthy(($truthy($a = equation['$start_with?'](open)) ? equation['$end_with?'](close) : $a))) { + } else { + equation = "" + (open) + (equation) + (close) + }; + _buf['$<<'](""); + if ($truthy(self['$title?']())) { + + _buf['$<<']("
"); + _buf['$<<'](self.$title()); + _buf['$<<']("
");}; + _buf['$<<']("
"); + _buf['$<<'](equation); + _buf['$<<']("
"); + return (_buf = _buf.$join(""));}, TMP_105.$$s = self, TMP_105.$$arity = 0, TMP_105)); + }, TMP_Converter_stem_104.$$arity = -2); + + Opal.def(self, '$olist', TMP_Converter_olist_106 = function $$olist(node, opts) { + var TMP_107, self = this; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + node.$extend($$($nesting, 'Helpers')); + return $send(node, 'instance_eval', [], (TMP_107 = function(){var self = TMP_107.$$s || this, TMP_108, _buf = nil, _temple_html_attributeremover1 = nil, _temple_html_attributemerger1 = nil, $writer = nil, _slim_codeattributes1 = nil, _slim_codeattributes2 = nil, _temple_html_attributeremover2 = nil, _slim_codeattributes3 = nil, _slim_codeattributes4 = nil, _slim_codeattributes5 = nil; + if (self.style == null) self.style = nil; + if (self.id == null) self.id = nil; + + + if ($truthy(opts['$empty?']())) { + } else { + self.$converter().$set_local_variables(self.$binding(), opts) + }; + _buf = []; + _buf['$<<'](""); + if ($truthy(self['$title?']())) { + + _buf['$<<']("
"); + _buf['$<<'](self.$title()); + _buf['$<<']("
");}; + _buf['$<<'](""); + $send(self.$items(), 'each', [], (TMP_108 = function(item){var self = TMP_108.$$s || this, $a, _temple_html_attributeremover3 = nil, _slim_codeattributes6 = nil; + + + + if (item == null) { + item = nil; + }; + _buf['$<<']("

"); + _buf['$<<'](item.$text()); + _buf['$<<']("

"); + if ($truthy(item['$blocks?']())) { + _buf['$<<'](item.$content())}; + return _buf['$<<']("");}, TMP_108.$$s = self, TMP_108.$$arity = 1, TMP_108)); + _buf['$<<'](""); + return (_buf = _buf.$join(""));}, TMP_107.$$s = self, TMP_107.$$arity = 0, TMP_107)); + }, TMP_Converter_olist_106.$$arity = -2); + + Opal.def(self, '$inline_anchor', TMP_Converter_inline_anchor_109 = function $$inline_anchor(node, opts) { + var TMP_110, self = this; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + node.$extend($$($nesting, 'Helpers')); + return $send(node, 'instance_eval', [], (TMP_110 = function(){var self = TMP_110.$$s || this, $a, _buf = nil, $case = nil, refid = nil, _slim_codeattributes1 = nil, _slim_codeattributes2 = nil, _slim_codeattributes3 = nil, _slim_codeattributes4 = nil, _temple_html_attributeremover1 = nil, _slim_codeattributes5 = nil, _slim_codeattributes6 = nil; + if (self.type == null) self.type = nil; + if (self.target == null) self.target = nil; + if (self.text == null) self.text = nil; + if (self.document == null) self.document = nil; + + + if ($truthy(opts['$empty?']())) { + } else { + self.$converter().$set_local_variables(self.$binding(), opts) + }; + _buf = []; + $case = self.type; + if ("xref"['$===']($case)) { + refid = ($truthy($a = self.$attr("refid")) ? $a : self.target); + _buf['$<<'](""); + _buf['$<<'](($truthy($a = self.text) ? $a : self.document.$references()['$[]']("ids").$fetch(refid, "" + "[" + (refid) + "]")).$tr_s("\n", " ")); + _buf['$<<']("");} + else if ("ref"['$===']($case)) { + _buf['$<<']("");} + else if ("bibref"['$===']($case)) { + _buf['$<<']("["); + _buf['$<<'](self.target); + _buf['$<<']("]");} + else { + _buf['$<<'](""); + _buf['$<<'](self.text); + _buf['$<<']("");}; + return (_buf = _buf.$join(""));}, TMP_110.$$s = self, TMP_110.$$arity = 0, TMP_110)); + }, TMP_Converter_inline_anchor_109.$$arity = -2); + + Opal.def(self, '$admonition', TMP_Converter_admonition_111 = function $$admonition(node, opts) { + var TMP_112, self = this; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + node.$extend($$($nesting, 'Helpers')); + return $send(node, 'instance_eval', [], (TMP_112 = function(){var self = TMP_112.$$s || this, $a, $b, _buf = nil, _temple_html_attributeremover1 = nil, _temple_html_attributemerger1 = nil, $writer = nil, _slim_codeattributes1 = nil, _slim_codeattributes2 = nil, icon_mapping = nil, _temple_html_attributeremover2 = nil, _slim_codeattributes3 = nil, _slim_codeattributes4 = nil, _slim_codeattributes5 = nil, _slim_codeattributes6 = nil; + if (self.id == null) self.id = nil; + if (self.document == null) self.document = nil; + if (self.caption == null) self.caption = nil; + + + if ($truthy(opts['$empty?']())) { + } else { + self.$converter().$set_local_variables(self.$binding(), opts) + }; + _buf = []; + if ($truthy(($truthy($a = ($truthy($b = self['$has_role?']("aside")) ? $b : self['$has_role?']("speaker"))) ? $a : self['$has_role?']("notes")))) { + + _buf['$<<'](""); + } else { + + _buf['$<<']("
"); + if ($truthy(self.document['$attr?']("icons", "font"))) { + + icon_mapping = $$($nesting, 'Hash')['$[]']("caution", "fire", "important", "exclamation-circle", "note", "info-circle", "tip", "lightbulb-o", "warning", "warning"); + _buf['$<<'](""); + } else if ($truthy(self.document['$attr?']("icons"))) { + + _buf['$<<'](""); + } else { + + _buf['$<<']("
"); + _buf['$<<'](($truthy($a = self.$attr("textlabel")) ? $a : self.caption)); + _buf['$<<']("
"); + }; + _buf['$<<']("
"); + if ($truthy(self['$title?']())) { + + _buf['$<<']("
"); + _buf['$<<'](self.$title()); + _buf['$<<']("
");}; + _buf['$<<'](self.$content()); + _buf['$<<']("
"); + }; + return (_buf = _buf.$join(""));}, TMP_112.$$s = self, TMP_112.$$arity = 0, TMP_112)); + }, TMP_Converter_admonition_111.$$arity = -2); + + Opal.def(self, '$inline_quoted', TMP_Converter_inline_quoted_113 = function $$inline_quoted(node, opts) { + var TMP_114, self = this; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + node.$extend($$($nesting, 'Helpers')); + return $send(node, 'instance_eval', [], (TMP_114 = function(){var self = TMP_114.$$s || this, $a, $b, _buf = nil, _slim_codeattributes1 = nil, $case = nil, _temple_html_attributeremover1 = nil, _slim_codeattributes2 = nil, _temple_html_attributeremover2 = nil, _slim_codeattributes3 = nil, _temple_html_attributeremover3 = nil, _slim_codeattributes4 = nil, _temple_html_attributeremover4 = nil, _slim_codeattributes5 = nil, _temple_html_attributeremover5 = nil, _slim_codeattributes6 = nil, open = nil, close = nil; + if (self.id == null) self.id = nil; + if (self.type == null) self.type = nil; + if (self.text == null) self.text = nil; + + + if ($truthy(opts['$empty?']())) { + } else { + self.$converter().$set_local_variables(self.$binding(), opts) + }; + _buf = []; + if ($truthy(self.id['$nil?']())) { + } else { + + _buf['$<<'](""); + }; + $case = self.type; + if ("emphasis"['$===']($case)) { + _buf['$<<'](""); + _buf['$<<'](self.text); + _buf['$<<']("");} + else if ("strong"['$===']($case)) { + _buf['$<<'](""); + _buf['$<<'](self.text); + _buf['$<<']("");} + else if ("monospaced"['$===']($case)) { + _buf['$<<'](""); + _buf['$<<'](self.text); + _buf['$<<']("");} + else if ("superscript"['$===']($case)) { + _buf['$<<'](""); + _buf['$<<'](self.text); + _buf['$<<']("");} + else if ("subscript"['$===']($case)) { + _buf['$<<'](""); + _buf['$<<'](self.text); + _buf['$<<']("");} + else if ("double"['$===']($case)) {_buf['$<<']((function() {if ($truthy(self['$role?']())) { + return "" + "“" + (self.text) + "”" + } else { + return "" + "“" + (self.text) + "”" + }; return nil; })())} + else if ("single"['$===']($case)) {_buf['$<<']((function() {if ($truthy(self['$role?']())) { + return "" + "‘" + (self.text) + "’" + } else { + return "" + "‘" + (self.text) + "’" + }; return nil; })())} + else if ("asciimath"['$===']($case) || "latexmath"['$===']($case)) { + $b = $$$($$($nesting, 'Asciidoctor'), 'INLINE_MATH_DELIMITERS')['$[]'](self.type), $a = Opal.to_ary($b), (open = ($a[0] == null ? nil : $a[0])), (close = ($a[1] == null ? nil : $a[1])), $b; + _buf['$<<'](open); + _buf['$<<'](self.text); + _buf['$<<'](close);} + else {_buf['$<<']((function() {if ($truthy(self['$role?']())) { + return "" + "" + (self.text) + "" + } else { + return self.text + }; return nil; })())}; + return (_buf = _buf.$join(""));}, TMP_114.$$s = self, TMP_114.$$arity = 0, TMP_114)); + }, TMP_Converter_inline_quoted_113.$$arity = -2); + + Opal.def(self, '$ulist', TMP_Converter_ulist_115 = function $$ulist(node, opts) { + var TMP_116, self = this; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + node.$extend($$($nesting, 'Helpers')); + return $send(node, 'instance_eval', [], (TMP_116 = function(){var self = TMP_116.$$s || this, $a, TMP_117, _buf = nil, checklist = nil, marker_checked = nil, marker_unchecked = nil, _temple_html_attributeremover1 = nil, _temple_html_attributemerger1 = nil, $writer = nil, _slim_codeattributes1 = nil, _slim_codeattributes2 = nil, _temple_html_attributeremover2 = nil, _slim_codeattributes3 = nil; + if (self.document == null) self.document = nil; + if (self.style == null) self.style = nil; + if (self.id == null) self.id = nil; + + + if ($truthy(opts['$empty?']())) { + } else { + self.$converter().$set_local_variables(self.$binding(), opts) + }; + _buf = []; + if ($truthy((checklist = (function() {if ($truthy(self['$option?']("checklist"))) { + return "checklist" + } else { + return nil + }; return nil; })()))) { + if ($truthy(self['$option?']("interactive"))) { + + marker_checked = ""; + marker_unchecked = ""; + } else if ($truthy(self.document['$attr?']("icons", "font"))) { + + marker_checked = ""; + marker_unchecked = ""; + } else { + + marker_checked = ""; + marker_unchecked = ""; + }}; + _buf['$<<'](""); + if ($truthy(self['$title?']())) { + + _buf['$<<']("
"); + _buf['$<<'](self.$title()); + _buf['$<<']("
");}; + _buf['$<<'](""); + $send(self.$items(), 'each', [], (TMP_117 = function(item){var self = TMP_117.$$s || this, $b, _temple_html_attributeremover3 = nil, _slim_codeattributes4 = nil; + + + + if (item == null) { + item = nil; + }; + _buf['$<<']("

"); + if ($truthy(($truthy($b = checklist) ? item['$attr?']("checkbox") : $b))) { + _buf['$<<']("" + ((function() {if ($truthy(item['$attr?']("checked"))) { + return marker_checked + } else { + return marker_unchecked + }; return nil; })()) + (item.$text())) + } else { + _buf['$<<'](item.$text()) + }; + _buf['$<<']("

"); + if ($truthy(item['$blocks?']())) { + _buf['$<<'](item.$content())}; + return _buf['$<<']("");}, TMP_117.$$s = self, TMP_117.$$arity = 1, TMP_117)); + _buf['$<<'](""); + return (_buf = _buf.$join(""));}, TMP_116.$$s = self, TMP_116.$$arity = 0, TMP_116)); + }, TMP_Converter_ulist_115.$$arity = -2); + + Opal.def(self, '$ruler', TMP_Converter_ruler_118 = function $$ruler(node, opts) { + var TMP_119, self = this; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + node.$extend($$($nesting, 'Helpers')); + return $send(node, 'instance_eval', [], (TMP_119 = function(){var self = TMP_119.$$s || this, _buf = nil; + + + if ($truthy(opts['$empty?']())) { + } else { + self.$converter().$set_local_variables(self.$binding(), opts) + }; + _buf = []; + _buf['$<<']("
"); + return (_buf = _buf.$join(""));}, TMP_119.$$s = self, TMP_119.$$arity = 0, TMP_119)); + }, TMP_Converter_ruler_118.$$arity = -2); + + Opal.def(self, '$colist', TMP_Converter_colist_120 = function $$colist(node, opts) { + var TMP_121, self = this; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + node.$extend($$($nesting, 'Helpers')); + return $send(node, 'instance_eval', [], (TMP_121 = function(){var self = TMP_121.$$s || this, TMP_122, TMP_123, _buf = nil, _temple_html_attributeremover1 = nil, _temple_html_attributemerger1 = nil, $writer = nil, _slim_codeattributes1 = nil, _slim_codeattributes2 = nil, font_icons = nil; + if (self.style == null) self.style = nil; + if (self.id == null) self.id = nil; + if (self.document == null) self.document = nil; + + + if ($truthy(opts['$empty?']())) { + } else { + self.$converter().$set_local_variables(self.$binding(), opts) + }; + _buf = []; + _buf['$<<'](""); + if ($truthy(self['$title?']())) { + + _buf['$<<']("
"); + _buf['$<<'](self.$title()); + _buf['$<<']("
");}; + if ($truthy(self.document['$attr?']("icons"))) { + + font_icons = self.document['$attr?']("icons", "font"); + _buf['$<<'](""); + $send(self.$items(), 'each_with_index', [], (TMP_122 = function(item, i){var self = TMP_122.$$s || this, num = nil, _slim_codeattributes3 = nil, _slim_codeattributes4 = nil, _slim_codeattributes5 = nil; + + + + if (item == null) { + item = nil; + }; + + if (i == null) { + i = nil; + }; + num = $rb_plus(i, 1); + _buf['$<<']("");}, TMP_122.$$s = self, TMP_122.$$arity = 2, TMP_122)); + _buf['$<<']("
"); + if ($truthy(font_icons)) { + + _buf['$<<'](""); + _buf['$<<'](num); + _buf['$<<'](""); + } else { + + _buf['$<<'](""); + }; + _buf['$<<'](""); + _buf['$<<'](item.$text()); + return _buf['$<<']("
"); + } else { + + _buf['$<<']("
    "); + $send(self.$items(), 'each', [], (TMP_123 = function(item){var self = TMP_123.$$s || this; + + + + if (item == null) { + item = nil; + }; + _buf['$<<']("
  1. "); + _buf['$<<'](item.$text()); + return _buf['$<<']("

  2. ");}, TMP_123.$$s = self, TMP_123.$$arity = 1, TMP_123)); + _buf['$<<']("
"); + }; + _buf['$<<'](""); + return (_buf = _buf.$join(""));}, TMP_121.$$s = self, TMP_121.$$arity = 0, TMP_121)); + }, TMP_Converter_colist_120.$$arity = -2); + return (Opal.def(self, '$set_local_variables', TMP_Converter_set_local_variables_124 = function $$set_local_variables(binding, vars) { + var TMP_125, self = this; + + return $send(vars, 'each', [], (TMP_125 = function(key, val){var self = TMP_125.$$s || this; + + + + if (key == null) { + key = nil; + }; + + if (val == null) { + val = nil; + }; + return binding.$local_variable_set(key.$to_sym(), val);}, TMP_125.$$s = self, TMP_125.$$arity = 2, TMP_125)) + }, TMP_Converter_set_local_variables_124.$$arity = 2), nil) && 'set_local_variables'; + })($$$($$($nesting, 'Asciidoctor'), 'Revealjs'), $$$($$$($$$('::', 'Asciidoctor'), 'Converter'), 'Base'), $nesting); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor-revealjs/version"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module; + + return (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + (function($base, $parent_nesting) { + function $Revealjs() {}; + var self = $Revealjs = $module($base, 'Revealjs', $Revealjs); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + Opal.const_set($nesting[0], 'VERSION', "2.0.1") + })($nesting[0], $nesting) + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +(function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice; + + Opal.add_stubs(['$==', '$require']); + if ($$($nesting, 'RUBY_ENGINE')['$==']("opal")) { + + self.$require("asciidoctor-revealjs/converter"); + return self.$require("asciidoctor-revealjs/version"); + } else { + return nil + } +})(Opal); + + } + + var mainModule + + function resolveModule () { + if (!mainModule) { + checkAsciidoctor() + initialize(Opal) + mainModule = Opal.const_get_qualified(Opal.Asciidoctor, 'Revealjs') + } + return mainModule + } + + function checkAsciidoctor () { + if (typeof Opal.Asciidoctor === 'undefined') { + throw new TypeError('Asciidoctor.js is not loaded') + } + } + + /** + * @return {string} Version of this extension. + */ + function getVersion () { + return resolveModule().$$const.VERSION.toString() + } + + /** + * Registers the reveal.js converter. + */ + function register () { + return resolveModule() + } + + var facade = { + getVersion: getVersion, + register: register, + } + + if (typeof module !== 'undefined' && module.exports) { + module.exports = facade + } + return facade +})(Opal); diff --git a/node_modules/asciidoctor-reveal.js/package.json b/node_modules/asciidoctor-reveal.js/package.json new file mode 100644 index 0000000..aef1d6f --- /dev/null +++ b/node_modules/asciidoctor-reveal.js/package.json @@ -0,0 +1,79 @@ +{ + "_args": [ + [ + "asciidoctor-reveal.js@2.0.1", + "/home/runner/work/jug-in.talks/jug-in.talks" + ] + ], + "_from": "asciidoctor-reveal.js@2.0.1", + "_id": "asciidoctor-reveal.js@2.0.1", + "_inBundle": false, + "_integrity": "sha512-4OXSp1toljq3lYldD0NLeOWbeMwX05R0haQDhJ63wYk6dbfqUPhxy0fDq7P9E4ANR7qxKDe2ruQA0lvU1YPgyA==", + "_location": "/asciidoctor-reveal.js", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "asciidoctor-reveal.js@2.0.1", + "name": "asciidoctor-reveal.js", + "escapedName": "asciidoctor-reveal.js", + "rawSpec": "2.0.1", + "saveSpec": null, + "fetchSpec": "2.0.1" + }, + "_requiredBy": [ + "/" + ], + "_resolved": "https://registry.npmjs.org/asciidoctor-reveal.js/-/asciidoctor-reveal.js-2.0.1.tgz", + "_spec": "2.0.1", + "_where": "/home/runner/work/jug-in.talks/jug-in.talks", + "authors": [ + "Guillaume Grossetie (https://github.com/mogztter)" + ], + "bugs": { + "url": "https://github.com/asciidoctor/asciidoctor-reveal.js/issues" + }, + "dependencies": { + "asciidoctor.js": "1.5.9", + "reveal.js": "3.7.0" + }, + "description": "A reveal.js converter for Asciidoctor.js. Write your slides in AsciiDoc!", + "devDependencies": { + "bestikk-log": "0.1.0", + "expect.js": "0.3.1" + }, + "engines": { + "node": ">=4", + "npm": ">=3.0.0" + }, + "files": [ + "dist", + "LICENSE.adoc", + "README.adoc" + ], + "homepage": "https://github.com/asciidoctor/asciidoctor-reveal.js", + "keywords": [ + "asciidoc", + "asciidoctor", + "opal", + "javascript", + "library", + "backend", + "template", + "reveal.js", + "jade" + ], + "license": "MIT", + "main": "dist/main.js", + "name": "asciidoctor-reveal.js", + "repository": { + "type": "git", + "url": "git+https://github.com/asciidoctor/asciidoctor-reveal.js.git" + }, + "scripts": { + "build": "node npm/build.js", + "examples": "node npm/examples.js", + "test": "node test/smoke.js" + }, + "version": "2.0.1" +} diff --git a/node_modules/asciidoctor.js/LICENSE b/node_modules/asciidoctor.js/LICENSE new file mode 100644 index 0000000..bee010f --- /dev/null +++ b/node_modules/asciidoctor.js/LICENSE @@ -0,0 +1,21 @@ +The MIT License + +Copyright (C) 2014-2018 Dan Allen, Guillaume Grossetie, Anthonny Quérouil and the Asciidoctor Project + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/node_modules/asciidoctor.js/README.md b/node_modules/asciidoctor.js/README.md new file mode 100644 index 0000000..0d917fa --- /dev/null +++ b/node_modules/asciidoctor.js/README.md @@ -0,0 +1,104 @@ +# Asciidoctor.js: AsciiDoc in JavaScript powered by Asciidoctor + +![Travis build status](https://img.shields.io/travis/asciidoctor/asciidoctor.js/master.svg) +![Appveyor build status](https://ci.appveyor.com/api/projects/status/i69sqvvyr95sf6i7/branch/master?svg=true) +![npm version](https://img.shields.io/npm/v/asciidoctor.js.svg) +![jsDelivr stats](https://data.jsdelivr.com/v1/package/npm/asciidoctor.js/badge?style=rounded) +![cdnjs](https://img.shields.io/cdnjs/v/asciidoctor.js.svg) +![JSDoc](https://img.shields.io/badge/jsdoc-master-blue.svg) +![InchCI](https://inch-ci.org/github/asciidoctor/asciidoctor.js.svg?branch=master) + +Asciidoctor.js brings AsciiDoc to the JavaScript world! + +This project uses [Opal](https://opalrb.com) to transpile [Asciidoctor](http://asciidoctor.org), a modern implementation of AsciiDoc, from Ruby to JavaScript to produce _asciidoctor.js_. +The _asciidoctor.js_ script can be run on any JavaScript platform, including Node.js, Nashorn and, of course, a web browser. + +**IMPORTANT:** Asciidoctor.js does _not_ use Semantic Versioning as the release versions are aligned on _Asciidoctor (Ruby)_. It's *highly recommended* to define the exact version in your `package.json` file (ie. without `^`). Please read the release notes when upgrading to the latest version as breaking changes can be introduced in non major release. + +## Introduction + +You can use Asciidoctor.js either for back-end development using [Node.js](https://nodejs.org) or front-end development using a browser. + +## Front-end development + +**Installing Asciidoctor.js with npm** + + $ npm install asciidoctor.js --save + +Once the package installed, you can add the following `script` tag to your HTML page: + +```html + +``` + +Here is a simple example that converts AsciiDoc to HTML5: + +**sample.js** + +```javascript +var asciidoctor = Asciidoctor(); // <1> +var content = "http://asciidoctor.org[*Asciidoctor*] " + + "running on https://opalrb.com[_Opal_] " + + "brings AsciiDoc to the browser!"; +var html = asciidoctor.convert(content); // <2> +console.log(html); // <3> +``` + +<1> Instantiate the Asciidoctor.js library +<2> Convert AsciiDoc content to HTML5 using Asciidoctor.js +<3> Print the HTML5 output to the console + +## Back-end development + +**Installing Asciidoctor.js with npm** + + $ npm install asciidoctor.js --save + +Once the package is installed, the first thing to do is to load the `asciidoctor.js` module using `require`, then you're ready to start using the API: + +**sample.js** + +```javascript +var asciidoctor = require('asciidoctor.js')(); // <1> +var content = "http://asciidoctor.org[*Asciidoctor*] " + + "running on https://opalrb.com[_Opal_] " + + "brings AsciiDoc to Node.js!"; +var html = asciidoctor.convert(content); // <2> +console.log(html); // <3> +``` + +<1> Instantiate the Asciidoctor.js library +<2> Convert AsciiDoc content to HTML5 using Asciidoctor.js +<3> Print the HTML5 output to the console + +Save the file as `sample.js` and run it using the `node` command: + + $ node sample.js + +You should see the following output in your terminal: + + +
+

Asciidoctor running on Opal brings AsciiDoc to Node.js!

+
+ +## Advanced topics + +If you want to know more about _Asciidoctor.js_, please read the [User Manual](https://asciidoctor-docs.netlify.com/asciidoctor.js/). + +## Contributing + +In the spirit of [free software](https://www.gnu.org/philosophy/free-sw.html), _everyone_ is encouraged to help improve this project. +If you discover errors or omissions in the source code, documentation, or website content, please don't hesitate to submit an issue or open a pull request with a fix. +New contributors are always welcome! + +The [Contributing](https://github.com/asciidoctor/asciidoctor.js/blob/master/CONTRIBUTING.adoc) guide provides information on how to contribute. + +If you want to write code, the [Contributing Code](https://github.com/asciidoctor/asciidoctor.js/blob/master/CONTRIBUTING-CODE.adoc) guide will help you to get started quickly. + +## Copyright + +Copyright (C) 2018 Dan Allen, Guillaume Grossetie, Anthonny Quérouil and the Asciidoctor Project. +Free use of this software is granted under the terms of the MIT License. + +See the [LICENSE](https://github.com/asciidoctor/asciidoctor.js/blob/master/LICENSE) file for details. diff --git a/node_modules/asciidoctor.js/dist/asciidoctor.js b/node_modules/asciidoctor.js/dist/asciidoctor.js new file mode 100644 index 0000000..c00e45f --- /dev/null +++ b/node_modules/asciidoctor.js/dist/asciidoctor.js @@ -0,0 +1,46290 @@ +/* eslint-disable indent */ +if (typeof Opal === 'undefined' && typeof module === 'object' && module.exports) { + Opal = require('opal-runtime').Opal; +} + +if (typeof Opal === 'undefined') { + // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects#Fundamental_objects + var fundamentalObjects = [ + Function, + Boolean, + Error, + Number, + Date, + String, + RegExp, + Array + ]; + var backup = {}; + for (var index in fundamentalObjects) { + var fundamentalObject = fundamentalObjects[index]; + backup[fundamentalObject.name] = { + call: fundamentalObject.call, + apply: fundamentalObject.apply, + bind: fundamentalObject.bind + }; + } + +(function(undefined) { + // @note + // A few conventions for the documentation of this file: + // 1. Always use "//" (in contrast with "/**/") + // 2. The syntax used is Yardoc (yardoc.org), which is intended for Ruby (se below) + // 3. `@param` and `@return` types should be preceded by `JS.` when referring to + // JavaScript constructors (e.g. `JS.Function`) otherwise Ruby is assumed. + // 4. `nil` and `null` being unambiguous refer to the respective + // objects/values in Ruby and JavaScript + // 5. This is still WIP :) so please give feedback and suggestions on how + // to improve or for alternative solutions + // + // The way the code is digested before going through Yardoc is a secret kept + // in the docs repo (https://github.com/opal/docs/tree/master). + + var global_object = this, console; + + // Detect the global object + if (typeof(global) !== 'undefined') { global_object = global; } + if (typeof(window) !== 'undefined') { global_object = window; } + + // Setup a dummy console object if missing + if (typeof(global_object.console) === 'object') { + console = global_object.console; + } else if (global_object.console == null) { + console = global_object.console = {}; + } else { + console = {}; + } + + if (!('log' in console)) { console.log = function () {}; } + if (!('warn' in console)) { console.warn = console.log; } + + if (typeof(this.Opal) !== 'undefined') { + console.warn('Opal already loaded. Loading twice can cause troubles, please fix your setup.'); + return this.Opal; + } + + var nil; + + // The actual class for BasicObject + var BasicObject; + + // The actual Object class. + // The leading underscore is to avoid confusion with window.Object() + var _Object; + + // The actual Module class + var Module; + + // The actual Class class + var Class; + + // The Opal object that is exposed globally + var Opal = this.Opal = {}; + + // This is a useful reference to global object inside ruby files + Opal.global = global_object; + global_object.Opal = Opal; + + // Configure runtime behavior with regards to require and unsupported fearures + Opal.config = { + missing_require_severity: 'error', // error, warning, ignore + unsupported_features_severity: 'warning', // error, warning, ignore + enable_stack_trace: true // true, false + } + + // Minify common function calls + var $hasOwn = Object.hasOwnProperty; + var $bind = Function.prototype.bind; + var $setPrototype = Object.setPrototypeOf; + var $slice = Array.prototype.slice; + + // Nil object id is always 4 + var nil_id = 4; + + // Generates even sequential numbers greater than 4 + // (nil_id) to serve as unique ids for ruby objects + var unique_id = nil_id; + + // Return next unique id + Opal.uid = function() { + unique_id += 2; + return unique_id; + }; + + // Retrieve or assign the id of an object + Opal.id = function(obj) { + if (obj.$$is_number) return (obj * 2)+1; + if (obj.$$id != null) { + return obj.$$id; + }; + $defineProperty(obj, '$$id', Opal.uid()); + return obj.$$id; + }; + + // Globals table + Opal.gvars = {}; + + // Exit function, this should be replaced by platform specific implementation + // (See nodejs and chrome for examples) + Opal.exit = function(status) { if (Opal.gvars.DEBUG) console.log('Exited with status '+status); }; + + // keeps track of exceptions for $! + Opal.exceptions = []; + + // @private + // Pops an exception from the stack and updates `$!`. + Opal.pop_exception = function() { + Opal.gvars["!"] = Opal.exceptions.pop() || nil; + } + + // Inspect any kind of object, including non Ruby ones + Opal.inspect = function(obj) { + if (obj === undefined) { + return "undefined"; + } + else if (obj === null) { + return "null"; + } + else if (!obj.$$class) { + return obj.toString(); + } + else { + return obj.$inspect(); + } + } + + function $defineProperty(object, name, initialValue) { + if (typeof(object) === "string") { + // Special case for: + // s = "string" + // def s.m; end + // String class is the only class that: + // + compiles to JS primitive + // + allows method definition directly on instances + // numbers, true, false and nil do not support it. + object[name] = initialValue; + } else { + Object.defineProperty(object, name, { + value: initialValue, + enumerable: false, + configurable: true, + writable: true + }); + } + } + + Opal.defineProperty = $defineProperty; + + Opal.slice = $slice; + + + // Truth + // ----- + + Opal.truthy = function(val) { + return (val !== nil && val != null && (!val.$$is_boolean || val == true)); + }; + + Opal.falsy = function(val) { + return (val === nil || val == null || (val.$$is_boolean && val == false)) + }; + + + // Constants + // --------- + // + // For future reference: + // - The Rails autoloading guide (http://guides.rubyonrails.org/v5.0/autoloading_and_reloading_constants.html) + // - @ConradIrwin's 2012 post on “Everything you ever wanted to know about constant lookup in Ruby” (http://cirw.in/blog/constant-lookup.html) + // + // Legend of MRI concepts/names: + // - constant reference (cref): the module/class that acts as a namespace + // - nesting: the namespaces wrapping the current scope, e.g. nesting inside + // `module A; module B::C; end; end` is `[B::C, A]` + + // Get the constant in the scope of the current cref + function const_get_name(cref, name) { + if (cref) return cref.$$const[name]; + } + + // Walk up the nesting array looking for the constant + function const_lookup_nesting(nesting, name) { + var i, ii, result, constant; + + if (nesting.length === 0) return; + + // If the nesting is not empty the constant is looked up in its elements + // and in order. The ancestors of those elements are ignored. + for (i = 0, ii = nesting.length; i < ii; i++) { + constant = nesting[i].$$const[name]; + if (constant != null) return constant; + } + } + + // Walk up the ancestors chain looking for the constant + function const_lookup_ancestors(cref, name) { + var i, ii, result, ancestors; + + if (cref == null) return; + + ancestors = Opal.ancestors(cref); + + for (i = 0, ii = ancestors.length; i < ii; i++) { + if (ancestors[i].$$const && $hasOwn.call(ancestors[i].$$const, name)) { + return ancestors[i].$$const[name]; + } + } + } + + // Walk up Object's ancestors chain looking for the constant, + // but only if cref is missing or a module. + function const_lookup_Object(cref, name) { + if (cref == null || cref.$$is_module) { + return const_lookup_ancestors(_Object, name); + } + } + + // Call const_missing if nothing else worked + function const_missing(cref, name, skip_missing) { + if (!skip_missing) { + return (cref || _Object).$const_missing(name); + } + } + + // Look for the constant just in the current cref or call `#const_missing` + Opal.const_get_local = function(cref, name, skip_missing) { + var result; + + if (cref == null) return; + + if (cref === '::') cref = _Object; + + if (!cref.$$is_module && !cref.$$is_class) { + throw new Opal.TypeError(cref.toString() + " is not a class/module"); + } + + result = const_get_name(cref, name); if (result != null) return result; + result = const_missing(cref, name, skip_missing); if (result != null) return result; + } + + // Look for the constant relative to a cref or call `#const_missing` (when the + // constant is prefixed by `::`). + Opal.const_get_qualified = function(cref, name, skip_missing) { + var result, cache, cached, current_version = Opal.const_cache_version; + + if (cref == null) return; + + if (cref === '::') cref = _Object; + + if (!cref.$$is_module && !cref.$$is_class) { + throw new Opal.TypeError(cref.toString() + " is not a class/module"); + } + + if ((cache = cref.$$const_cache) == null) { + $defineProperty(cref, '$$const_cache', Object.create(null)); + cache = cref.$$const_cache; + } + cached = cache[name]; + + if (cached == null || cached[0] !== current_version) { + ((result = const_get_name(cref, name)) != null) || + ((result = const_lookup_ancestors(cref, name)) != null); + cache[name] = [current_version, result]; + } else { + result = cached[1]; + } + + return result != null ? result : const_missing(cref, name, skip_missing); + }; + + // Initialize the top level constant cache generation counter + Opal.const_cache_version = 1; + + // Look for the constant in the open using the current nesting and the nearest + // cref ancestors or call `#const_missing` (when the constant has no :: prefix). + Opal.const_get_relative = function(nesting, name, skip_missing) { + var cref = nesting[0], result, current_version = Opal.const_cache_version, cache, cached; + + if ((cache = nesting.$$const_cache) == null) { + $defineProperty(nesting, '$$const_cache', Object.create(null)); + cache = nesting.$$const_cache; + } + cached = cache[name]; + + if (cached == null || cached[0] !== current_version) { + ((result = const_get_name(cref, name)) != null) || + ((result = const_lookup_nesting(nesting, name)) != null) || + ((result = const_lookup_ancestors(cref, name)) != null) || + ((result = const_lookup_Object(cref, name)) != null); + + cache[name] = [current_version, result]; + } else { + result = cached[1]; + } + + return result != null ? result : const_missing(cref, name, skip_missing); + }; + + // Register the constant on a cref and opportunistically set the name of + // unnamed classes/modules. + Opal.const_set = function(cref, name, value) { + if (cref == null || cref === '::') cref = _Object; + + if (value.$$is_a_module) { + if (value.$$name == null || value.$$name === nil) value.$$name = name; + if (value.$$base_module == null) value.$$base_module = cref; + } + + cref.$$const = (cref.$$const || Object.create(null)); + cref.$$const[name] = value; + + // Add a short helper to navigate constants manually. + // @example + // Opal.$$.Regexp.$$.IGNORECASE + cref.$$ = cref.$$const; + + Opal.const_cache_version++; + + // Expose top level constants onto the Opal object + if (cref === _Object) Opal[name] = value; + + // Name new class directly onto current scope (Opal.Foo.Baz = klass) + $defineProperty(cref, name, value); + + return value; + }; + + // Get all the constants reachable from a given cref, by default will include + // inherited constants. + Opal.constants = function(cref, inherit) { + if (inherit == null) inherit = true; + + var module, modules = [cref], module_constants, i, ii, constants = {}, constant; + + if (inherit) modules = modules.concat(Opal.ancestors(cref)); + if (inherit && cref.$$is_module) modules = modules.concat([Opal.Object]).concat(Opal.ancestors(Opal.Object)); + + for (i = 0, ii = modules.length; i < ii; i++) { + module = modules[i]; + + // Don not show Objects constants unless we're querying Object itself + if (cref !== _Object && module == _Object) break; + + for (constant in module.$$const) { + constants[constant] = true; + } + } + + return Object.keys(constants); + }; + + // Remove a constant from a cref. + Opal.const_remove = function(cref, name) { + Opal.const_cache_version++; + + if (cref.$$const[name] != null) { + var old = cref.$$const[name]; + delete cref.$$const[name]; + return old; + } + + if (cref.$$autoload != null && cref.$$autoload[name] != null) { + delete cref.$$autoload[name]; + return nil; + } + + throw Opal.NameError.$new("constant "+cref+"::"+cref.$name()+" not defined"); + }; + + + // Modules & Classes + // ----------------- + + // A `class Foo; end` expression in ruby is compiled to call this runtime + // method which either returns an existing class of the given name, or creates + // a new class in the given `base` scope. + // + // If a constant with the given name exists, then we check to make sure that + // it is a class and also that the superclasses match. If either of these + // fail, then we raise a `TypeError`. Note, `superclass` may be null if one + // was not specified in the ruby code. + // + // We pass a constructor to this method of the form `function ClassName() {}` + // simply so that classes show up with nicely formatted names inside debuggers + // in the web browser (or node/sprockets). + // + // The `scope` is the current `self` value where the class is being created + // from. We use this to get the scope for where the class should be created. + // If `scope` is an object (not a class/module), we simple get its class and + // use that as the scope instead. + // + // @param scope [Object] where the class is being created + // @param superclass [Class,null] superclass of the new class (may be null) + // @param id [String] the name of the class to be created + // @param constructor [JS.Function] function to use as constructor + // + // @return new [Class] or existing ruby class + // + Opal.allocate_class = function(name, superclass, constructor) { + var klass = constructor; + + if (superclass != null && superclass.$$bridge) { + // Inheritance from bridged classes requires + // calling original JS constructors + klass = function SubclassOfNativeClass() { + var args = $slice.call(arguments), + self = new ($bind.apply(superclass, [null].concat(args)))(); + + // and replacing a __proto__ manually + $setPrototype(self, klass.prototype); + return self; + } + } + + $defineProperty(klass, '$$name', name); + $defineProperty(klass, '$$const', {}); + $defineProperty(klass, '$$is_class', true); + $defineProperty(klass, '$$is_a_module', true); + $defineProperty(klass, '$$super', superclass); + $defineProperty(klass, '$$cvars', {}); + $defineProperty(klass, '$$own_included_modules', []); + $defineProperty(klass, '$$own_prepended_modules', []); + $defineProperty(klass, '$$ancestors', []); + $defineProperty(klass, '$$ancestors_cache_version', null); + + $defineProperty(klass.prototype, '$$class', klass); + + // By default if there are no singleton class methods + // __proto__ is Class.prototype + // Later singleton methods generate a singleton_class + // and inject it into ancestors chain + if (Opal.Class) { + $setPrototype(klass, Opal.Class.prototype); + } + + if (superclass != null) { + $setPrototype(klass.prototype, superclass.prototype); + + if (superclass !== Opal.Module && superclass.$$meta) { + // If superclass has metaclass then we have explicitely inherit it. + Opal.build_class_singleton_class(klass); + } + }; + + return klass; + } + + + function find_existing_class(scope, name) { + // Try to find the class in the current scope + var klass = const_get_name(scope, name); + + // If the class exists in the scope, then we must use that + if (klass) { + // Make sure the existing constant is a class, or raise error + if (!klass.$$is_class) { + throw Opal.TypeError.$new(name + " is not a class"); + } + + return klass; + } + } + + function ensureSuperclassMatch(klass, superclass) { + if (klass.$$super !== superclass) { + throw Opal.TypeError.$new("superclass mismatch for class " + klass.$$name); + } + } + + Opal.klass = function(scope, superclass, name, constructor) { + var bridged; + + if (scope == null) { + // Global scope + scope = _Object; + } else if (!scope.$$is_class && !scope.$$is_module) { + // Scope is an object, use its class + scope = scope.$$class; + } + + // If the superclass is not an Opal-generated class then we're bridging a native JS class + if (superclass != null && !superclass.hasOwnProperty('$$is_class')) { + bridged = superclass; + superclass = _Object; + } + + var klass = find_existing_class(scope, name); + + if (klass) { + if (superclass) { + // Make sure existing class has same superclass + ensureSuperclassMatch(klass, superclass); + } + return klass; + } + + // Class doesnt exist, create a new one with given superclass... + + // Not specifying a superclass means we can assume it to be Object + if (superclass == null) { + superclass = _Object; + } + + if (bridged) { + Opal.bridge(bridged); + klass = bridged; + Opal.const_set(scope, name, klass); + } else { + // Create the class object (instance of Class) + klass = Opal.allocate_class(name, superclass, constructor); + Opal.const_set(scope, name, klass); + // Call .inherited() hook with new class on the superclass + if (superclass.$inherited) { + superclass.$inherited(klass); + } + } + + return klass; + + } + + // Define new module (or return existing module). The given `scope` is basically + // the current `self` value the `module` statement was defined in. If this is + // a ruby module or class, then it is used, otherwise if the scope is a ruby + // object then that objects real ruby class is used (e.g. if the scope is the + // main object, then the top level `Object` class is used as the scope). + // + // If a module of the given name is already defined in the scope, then that + // instance is just returned. + // + // If there is a class of the given name in the scope, then an error is + // generated instead (cannot have a class and module of same name in same scope). + // + // Otherwise, a new module is created in the scope with the given name, and that + // new instance is returned back (to be referenced at runtime). + // + // @param scope [Module, Class] class or module this definition is inside + // @param id [String] the name of the new (or existing) module + // + // @return [Module] + Opal.allocate_module = function(name, constructor) { + var module = constructor; + + $defineProperty(module, '$$name', name); + $defineProperty(module, '$$const', {}); + $defineProperty(module, '$$is_module', true); + $defineProperty(module, '$$is_a_module', true); + $defineProperty(module, '$$cvars', {}); + $defineProperty(module, '$$iclasses', []); + $defineProperty(module, '$$own_included_modules', []); + $defineProperty(module, '$$own_prepended_modules', []); + $defineProperty(module, '$$ancestors', [module]); + $defineProperty(module, '$$ancestors_cache_version', null); + + $setPrototype(module, Opal.Module.prototype); + + return module; + } + + function find_existing_module(scope, name) { + var module = const_get_name(scope, name); + if (module == null && scope === _Object) module = const_lookup_ancestors(_Object, name); + + if (module) { + if (!module.$$is_module && module !== _Object) { + throw Opal.TypeError.$new(name + " is not a module"); + } + } + + return module; + } + + Opal.module = function(scope, name, constructor) { + var module; + + if (scope == null) { + // Global scope + scope = _Object; + } else if (!scope.$$is_class && !scope.$$is_module) { + // Scope is an object, use its class + scope = scope.$$class; + } + + module = find_existing_module(scope, name); + + if (module) { + return module; + } + + // Module doesnt exist, create a new one... + module = Opal.allocate_module(name, constructor); + Opal.const_set(scope, name, module); + + return module; + } + + // Return the singleton class for the passed object. + // + // If the given object alredy has a singleton class, then it will be stored on + // the object as the `$$meta` property. If this exists, then it is simply + // returned back. + // + // Otherwise, a new singleton object for the class or object is created, set on + // the object at `$$meta` for future use, and then returned. + // + // @param object [Object] the ruby object + // @return [Class] the singleton class for object + Opal.get_singleton_class = function(object) { + if (object.$$meta) { + return object.$$meta; + } + + if (object.hasOwnProperty('$$is_class')) { + return Opal.build_class_singleton_class(object); + } else if (object.hasOwnProperty('$$is_module')) { + return Opal.build_module_singletin_class(object); + } else { + return Opal.build_object_singleton_class(object); + } + }; + + // Build the singleton class for an existing class. Class object are built + // with their singleton class already in the prototype chain and inheriting + // from their superclass object (up to `Class` itself). + // + // NOTE: Actually in MRI a class' singleton class inherits from its + // superclass' singleton class which in turn inherits from Class. + // + // @param klass [Class] + // @return [Class] + Opal.build_class_singleton_class = function(klass) { + var superclass, meta; + + if (klass.$$meta) { + return klass.$$meta; + } + + // The singleton_class superclass is the singleton_class of its superclass; + // but BasicObject has no superclass (its `$$super` is null), thus we + // fallback on `Class`. + superclass = klass === BasicObject ? Class : Opal.get_singleton_class(klass.$$super); + + meta = Opal.allocate_class(null, superclass, function(){}); + + $defineProperty(meta, '$$is_singleton', true); + $defineProperty(meta, '$$singleton_of', klass); + $defineProperty(klass, '$$meta', meta); + $setPrototype(klass, meta.prototype); + // Restoring ClassName.class + $defineProperty(klass, '$$class', Opal.Class); + + return meta; + }; + + Opal.build_module_singletin_class = function(mod) { + if (mod.$$meta) { + return mod.$$meta; + } + + var meta = Opal.allocate_class(null, Opal.Module, function(){}); + + $defineProperty(meta, '$$is_singleton', true); + $defineProperty(meta, '$$singleton_of', mod); + $defineProperty(mod, '$$meta', meta); + $setPrototype(mod, meta.prototype); + // Restoring ModuleName.class + $defineProperty(mod, '$$class', Opal.Module); + + return meta; + } + + // Build the singleton class for a Ruby (non class) Object. + // + // @param object [Object] + // @return [Class] + Opal.build_object_singleton_class = function(object) { + var superclass = object.$$class, + klass = Opal.allocate_class(nil, superclass, function(){}); + + $defineProperty(klass, '$$is_singleton', true); + $defineProperty(klass, '$$singleton_of', object); + + delete klass.prototype.$$class; + + $defineProperty(object, '$$meta', klass); + + $setPrototype(object, object.$$meta.prototype); + + return klass; + }; + + Opal.is_method = function(prop) { + return (prop[0] === '$' && prop[1] !== '$'); + } + + Opal.instance_methods = function(mod) { + var exclude = [], results = [], ancestors = Opal.ancestors(mod); + + for (var i = 0, l = ancestors.length; i < l; i++) { + var ancestor = ancestors[i], + proto = ancestor.prototype; + + if (proto.hasOwnProperty('$$dummy')) { + proto = proto.$$define_methods_on; + } + + var props = Object.getOwnPropertyNames(proto); + + for (var j = 0, ll = props.length; j < ll; j++) { + var prop = props[j]; + + if (Opal.is_method(prop)) { + var method_name = prop.slice(1), + method = proto[prop]; + + if (method.$$stub && exclude.indexOf(method_name) === -1) { + exclude.push(method_name); + } + + if (!method.$$stub && results.indexOf(method_name) === -1 && exclude.indexOf(method_name) === -1) { + results.push(method_name); + } + } + } + } + + return results; + } + + Opal.own_instance_methods = function(mod) { + var results = [], + proto = mod.prototype; + + if (proto.hasOwnProperty('$$dummy')) { + proto = proto.$$define_methods_on; + } + + var props = Object.getOwnPropertyNames(proto); + + for (var i = 0, length = props.length; i < length; i++) { + var prop = props[i]; + + if (Opal.is_method(prop)) { + var method = proto[prop]; + + if (!method.$$stub) { + var method_name = prop.slice(1); + results.push(method_name); + } + } + } + + return results; + } + + Opal.methods = function(obj) { + return Opal.instance_methods(Opal.get_singleton_class(obj)); + } + + Opal.own_methods = function(obj) { + return Opal.own_instance_methods(Opal.get_singleton_class(obj)); + } + + Opal.receiver_methods = function(obj) { + var mod = Opal.get_singleton_class(obj); + var singleton_methods = Opal.own_instance_methods(mod); + var instance_methods = Opal.own_instance_methods(mod.$$super); + return singleton_methods.concat(instance_methods); + } + + // Returns an object containing all pairs of names/values + // for all class variables defined in provided +module+ + // and its ancestors. + // + // @param module [Module] + // @return [Object] + Opal.class_variables = function(module) { + var ancestors = Opal.ancestors(module), + i, length = ancestors.length, + result = {}; + + for (i = length - 1; i >= 0; i--) { + var ancestor = ancestors[i]; + + for (var cvar in ancestor.$$cvars) { + result[cvar] = ancestor.$$cvars[cvar]; + } + } + + return result; + } + + // Sets class variable with specified +name+ to +value+ + // in provided +module+ + // + // @param module [Module] + // @param name [String] + // @param value [Object] + Opal.class_variable_set = function(module, name, value) { + var ancestors = Opal.ancestors(module), + i, length = ancestors.length; + + for (i = length - 2; i >= 0; i--) { + var ancestor = ancestors[i]; + + if ($hasOwn.call(ancestor.$$cvars, name)) { + ancestor.$$cvars[name] = value; + return value; + } + } + + module.$$cvars[name] = value; + + return value; + } + + function isRoot(proto) { + return proto.hasOwnProperty('$$iclass') && proto.hasOwnProperty('$$root'); + } + + function own_included_modules(module) { + var result = [], mod, proto = Object.getPrototypeOf(module.prototype); + + while (proto) { + if (proto.hasOwnProperty('$$class')) { + // superclass + break; + } + mod = protoToModule(proto); + if (mod) { + result.push(mod); + } + proto = Object.getPrototypeOf(proto); + } + + return result; + } + + function own_prepended_modules(module) { + var result = [], mod, proto = Object.getPrototypeOf(module.prototype); + + if (module.prototype.hasOwnProperty('$$dummy')) { + while (proto) { + if (proto === module.prototype.$$define_methods_on) { + break; + } + + mod = protoToModule(proto); + if (mod) { + result.push(mod); + } + + proto = Object.getPrototypeOf(proto); + } + } + + return result; + } + + + // The actual inclusion of a module into a class. + // + // ## Class `$$parent` and `iclass` + // + // To handle `super` calls, every class has a `$$parent`. This parent is + // used to resolve the next class for a super call. A normal class would + // have this point to its superclass. However, if a class includes a module + // then this would need to take into account the module. The module would + // also have to then point its `$$parent` to the actual superclass. We + // cannot modify modules like this, because it might be included in more + // then one class. To fix this, we actually insert an `iclass` as the class' + // `$$parent` which can then point to the superclass. The `iclass` acts as + // a proxy to the actual module, so the `super` chain can then search it for + // the required method. + // + // @param module [Module] the module to include + // @param includer [Module] the target class to include module into + // @return [null] + Opal.append_features = function(module, includer) { + var module_ancestors = Opal.ancestors(module); + var iclasses = []; + + if (module_ancestors.indexOf(includer) !== -1) { + throw Opal.ArgumentError.$new('cyclic include detected'); + } + + for (var i = 0, length = module_ancestors.length; i < length; i++) { + var ancestor = module_ancestors[i], iclass = create_iclass(ancestor); + $defineProperty(iclass, '$$included', true); + iclasses.push(iclass); + } + var includer_ancestors = Opal.ancestors(includer), + chain = chain_iclasses(iclasses), + start_chain_after, + end_chain_on; + + if (includer_ancestors.indexOf(module) === -1) { + // first time include + + // includer -> chain.first -> ...chain... -> chain.last -> includer.parent + start_chain_after = includer.prototype; + end_chain_on = Object.getPrototypeOf(includer.prototype); + } else { + // The module has been already included, + // we don't need to put it into the ancestors chain again, + // but this module may have new included modules. + // If it's true we need to copy them. + // + // The simplest way is to replace ancestors chain from + // parent + // | + // `module` iclass (has a $$root flag) + // | + // ...previos chain of module.included_modules ... + // | + // "next ancestor" (has a $$root flag or is a real class) + // + // to + // parent + // | + // `module` iclass (has a $$root flag) + // | + // ...regenerated chain of module.included_modules + // | + // "next ancestor" (has a $$root flag or is a real class) + // + // because there are no intermediate classes between `parent` and `next ancestor`. + // It doesn't break any prototypes of other objects as we don't change class references. + + var proto = includer.prototype, parent = proto, module_iclass = Object.getPrototypeOf(parent); + + while (module_iclass != null) { + if (isRoot(module_iclass) && module_iclass.$$module === module) { + break; + } + + parent = module_iclass; + module_iclass = Object.getPrototypeOf(module_iclass); + } + + var next_ancestor = Object.getPrototypeOf(module_iclass); + + // skip non-root iclasses (that were recursively included) + while (next_ancestor.hasOwnProperty('$$iclass') && !isRoot(next_ancestor)) { + next_ancestor = Object.getPrototypeOf(next_ancestor); + } + + start_chain_after = parent; + end_chain_on = next_ancestor; + } + + $setPrototype(start_chain_after, chain.first); + $setPrototype(chain.last, end_chain_on); + + // recalculate own_included_modules cache + includer.$$own_included_modules = own_included_modules(includer); + + Opal.const_cache_version++; + } + + Opal.prepend_features = function(module, prepender) { + // Here we change the ancestors chain from + // + // prepender + // | + // parent + // + // to: + // + // dummy(prepender) + // | + // iclass(module) + // | + // iclass(prepender) + // | + // parent + var module_ancestors = Opal.ancestors(module); + var iclasses = []; + + if (module_ancestors.indexOf(prepender) !== -1) { + throw Opal.ArgumentError.$new('cyclic prepend detected'); + } + + for (var i = 0, length = module_ancestors.length; i < length; i++) { + var ancestor = module_ancestors[i], iclass = create_iclass(ancestor); + $defineProperty(iclass, '$$prepended', true); + iclasses.push(iclass); + } + + var chain = chain_iclasses(iclasses), + dummy_prepender = prepender.prototype, + previous_parent = Object.getPrototypeOf(dummy_prepender), + prepender_iclass, + start_chain_after, + end_chain_on; + + if (dummy_prepender.hasOwnProperty('$$dummy')) { + // The module already has some prepended modules + // which means that we don't need to make it "dummy" + prepender_iclass = dummy_prepender.$$define_methods_on; + } else { + // Making the module "dummy" + prepender_iclass = create_dummy_iclass(prepender); + flush_methods_in(prepender); + $defineProperty(dummy_prepender, '$$dummy', true); + $defineProperty(dummy_prepender, '$$define_methods_on', prepender_iclass); + + // Converting + // dummy(prepender) -> previous_parent + // to + // dummy(prepender) -> iclass(prepender) -> previous_parent + $setPrototype(dummy_prepender, prepender_iclass); + $setPrototype(prepender_iclass, previous_parent); + } + + var prepender_ancestors = Opal.ancestors(prepender); + + if (prepender_ancestors.indexOf(module) === -1) { + // first time prepend + + start_chain_after = dummy_prepender; + + // next $$root or prepender_iclass or non-$$iclass + end_chain_on = Object.getPrototypeOf(dummy_prepender); + while (end_chain_on != null) { + if ( + end_chain_on.hasOwnProperty('$$root') || + end_chain_on === prepender_iclass || + !end_chain_on.hasOwnProperty('$$iclass') + ) { + break; + } + + end_chain_on = Object.getPrototypeOf(end_chain_on); + } + } else { + throw Opal.RuntimeError.$new("Prepending a module multiple times is not supported"); + } + + $setPrototype(start_chain_after, chain.first); + $setPrototype(chain.last, end_chain_on); + + // recalculate own_prepended_modules cache + prepender.$$own_prepended_modules = own_prepended_modules(prepender); + + Opal.const_cache_version++; + } + + function flush_methods_in(module) { + var proto = module.prototype, + props = Object.getOwnPropertyNames(proto); + + for (var i = 0; i < props.length; i++) { + var prop = props[i]; + if (Opal.is_method(prop)) { + delete proto[prop]; + } + } + } + + function create_iclass(module) { + var iclass = create_dummy_iclass(module); + + if (module.$$is_module) { + module.$$iclasses.push(iclass); + } + + return iclass; + } + + // Dummy iclass doesn't receive updates when the module gets a new method. + function create_dummy_iclass(module) { + var iclass = {}, + proto = module.prototype; + + if (proto.hasOwnProperty('$$dummy')) { + proto = proto.$$define_methods_on; + } + + var props = Object.getOwnPropertyNames(proto), + length = props.length, i; + + for (i = 0; i < length; i++) { + var prop = props[i]; + $defineProperty(iclass, prop, proto[prop]); + } + + $defineProperty(iclass, '$$iclass', true); + $defineProperty(iclass, '$$module', module); + + return iclass; + } + + function chain_iclasses(iclasses) { + var length = iclasses.length, first = iclasses[0]; + + $defineProperty(first, '$$root', true); + + if (length === 1) { + return { first: first, last: first }; + } + + var previous = first; + + for (var i = 1; i < length; i++) { + var current = iclasses[i]; + $setPrototype(previous, current); + previous = current; + } + + + return { first: iclasses[0], last: iclasses[length - 1] }; + } + + // For performance, some core Ruby classes are toll-free bridged to their + // native JavaScript counterparts (e.g. a Ruby Array is a JavaScript Array). + // + // This method is used to setup a native constructor (e.g. Array), to have + // its prototype act like a normal Ruby class. Firstly, a new Ruby class is + // created using the native constructor so that its prototype is set as the + // target for th new class. Note: all bridged classes are set to inherit + // from Object. + // + // Example: + // + // Opal.bridge(self, Function); + // + // @param klass [Class] the Ruby class to bridge + // @param constructor [JS.Function] native JavaScript constructor to use + // @return [Class] returns the passed Ruby class + // + Opal.bridge = function(constructor, klass) { + if (constructor.hasOwnProperty('$$bridge')) { + throw Opal.ArgumentError.$new("already bridged"); + } + + var klass_to_inject, klass_reference; + + if (klass == null) { + klass_to_inject = Opal.Object; + klass_reference = constructor; + } else { + klass_to_inject = klass; + klass_reference = klass; + } + + // constructor is a JS function with a prototype chain like: + // - constructor + // - super + // + // What we need to do is to inject our class (with its prototype chain) + // between constructor and super. For example, after injecting Ruby Object into JS Error we get: + // - constructor + // - Opal.Object + // - Opal.Kernel + // - Opal.BasicObject + // - super + // + + $setPrototype(constructor.prototype, klass_to_inject.prototype); + $defineProperty(constructor.prototype, '$$class', klass_reference); + $defineProperty(constructor, '$$bridge', true); + $defineProperty(constructor, '$$is_class', true); + $defineProperty(constructor, '$$is_a_module', true); + $defineProperty(constructor, '$$super', klass_to_inject); + $defineProperty(constructor, '$$const', {}); + $defineProperty(constructor, '$$own_included_modules', []); + $defineProperty(constructor, '$$own_prepended_modules', []); + $defineProperty(constructor, '$$ancestors', []); + $defineProperty(constructor, '$$ancestors_cache_version', null); + $setPrototype(constructor, Opal.Class.prototype); + }; + + function protoToModule(proto) { + if (proto.hasOwnProperty('$$dummy')) { + return; + } else if (proto.hasOwnProperty('$$iclass')) { + return proto.$$module; + } else if (proto.hasOwnProperty('$$class')) { + return proto.$$class; + } + } + + function own_ancestors(module) { + return module.$$own_prepended_modules.concat([module]).concat(module.$$own_included_modules); + } + + // The Array of ancestors for a given module/class + Opal.ancestors = function(module) { + if (!module) { return []; } + + if (module.$$ancestors_cache_version === Opal.const_cache_version) { + return module.$$ancestors; + } + + var result = [], i, mods, length; + + for (i = 0, mods = own_ancestors(module), length = mods.length; i < length; i++) { + result.push(mods[i]); + } + + if (module.$$super) { + for (i = 0, mods = Opal.ancestors(module.$$super), length = mods.length; i < length; i++) { + result.push(mods[i]); + } + } + + module.$$ancestors_cache_version = Opal.const_cache_version; + module.$$ancestors = result; + + return result; + } + + Opal.included_modules = function(module) { + var result = [], mod = null, proto = Object.getPrototypeOf(module.prototype); + + for (; proto && Object.getPrototypeOf(proto); proto = Object.getPrototypeOf(proto)) { + mod = protoToModule(proto); + if (mod && mod.$$is_module && proto.$$iclass && proto.$$included) { + result.push(mod); + } + } + + return result; + } + + + // Method Missing + // -------------- + + // Methods stubs are used to facilitate method_missing in opal. A stub is a + // placeholder function which just calls `method_missing` on the receiver. + // If no method with the given name is actually defined on an object, then it + // is obvious to say that the stub will be called instead, and then in turn + // method_missing will be called. + // + // When a file in ruby gets compiled to javascript, it includes a call to + // this function which adds stubs for every method name in the compiled file. + // It should then be safe to assume that method_missing will work for any + // method call detected. + // + // Method stubs are added to the BasicObject prototype, which every other + // ruby object inherits, so all objects should handle method missing. A stub + // is only added if the given property name (method name) is not already + // defined. + // + // Note: all ruby methods have a `$` prefix in javascript, so all stubs will + // have this prefix as well (to make this method more performant). + // + // Opal.add_stubs(["$foo", "$bar", "$baz="]); + // + // All stub functions will have a private `$$stub` property set to true so + // that other internal methods can detect if a method is just a stub or not. + // `Kernel#respond_to?` uses this property to detect a methods presence. + // + // @param stubs [Array] an array of method stubs to add + // @return [undefined] + Opal.add_stubs = function(stubs) { + var proto = Opal.BasicObject.prototype; + + for (var i = 0, length = stubs.length; i < length; i++) { + var stub = stubs[i], existing_method = proto[stub]; + + if (existing_method == null || existing_method.$$stub) { + Opal.add_stub_for(proto, stub); + } + } + }; + + // Add a method_missing stub function to the given prototype for the + // given name. + // + // @param prototype [Prototype] the target prototype + // @param stub [String] stub name to add (e.g. "$foo") + // @return [undefined] + Opal.add_stub_for = function(prototype, stub) { + var method_missing_stub = Opal.stub_for(stub); + $defineProperty(prototype, stub, method_missing_stub); + }; + + // Generate the method_missing stub for a given method name. + // + // @param method_name [String] The js-name of the method to stub (e.g. "$foo") + // @return [undefined] + Opal.stub_for = function(method_name) { + function method_missing_stub() { + // Copy any given block onto the method_missing dispatcher + this.$method_missing.$$p = method_missing_stub.$$p; + + // Set block property to null ready for the next call (stop false-positives) + method_missing_stub.$$p = null; + + // call method missing with correct args (remove '$' prefix on method name) + var args_ary = new Array(arguments.length); + for(var i = 0, l = args_ary.length; i < l; i++) { args_ary[i] = arguments[i]; } + + return this.$method_missing.apply(this, [method_name.slice(1)].concat(args_ary)); + } + + method_missing_stub.$$stub = true; + + return method_missing_stub; + }; + + + // Methods + // ------- + + // Arity count error dispatcher for methods + // + // @param actual [Fixnum] number of arguments given to method + // @param expected [Fixnum] expected number of arguments + // @param object [Object] owner of the method +meth+ + // @param meth [String] method name that got wrong number of arguments + // @raise [ArgumentError] + Opal.ac = function(actual, expected, object, meth) { + var inspect = ''; + if (object.$$is_a_module) { + inspect += object.$$name + '.'; + } + else { + inspect += object.$$class.$$name + '#'; + } + inspect += meth; + + throw Opal.ArgumentError.$new('[' + inspect + '] wrong number of arguments(' + actual + ' for ' + expected + ')'); + }; + + // Arity count error dispatcher for blocks + // + // @param actual [Fixnum] number of arguments given to block + // @param expected [Fixnum] expected number of arguments + // @param context [Object] context of the block definition + // @raise [ArgumentError] + Opal.block_ac = function(actual, expected, context) { + var inspect = "`block in " + context + "'"; + + throw Opal.ArgumentError.$new(inspect + ': wrong number of arguments (' + actual + ' for ' + expected + ')'); + }; + + // Super dispatcher + Opal.find_super_dispatcher = function(obj, mid, current_func, defcheck, defs) { + var jsid = '$' + mid, ancestors, super_method; + + if (obj.hasOwnProperty('$$meta')) { + ancestors = Opal.ancestors(obj.$$meta); + } else { + ancestors = Opal.ancestors(obj.$$class); + } + + var current_index = ancestors.indexOf(current_func.$$owner); + + for (var i = current_index + 1; i < ancestors.length; i++) { + var ancestor = ancestors[i], + proto = ancestor.prototype; + + if (proto.hasOwnProperty('$$dummy')) { + proto = proto.$$define_methods_on; + } + + if (proto.hasOwnProperty(jsid)) { + var method = proto[jsid]; + + if (!method.$$stub) { + super_method = method; + } + break; + } + } + + if (!defcheck && super_method == null && Opal.Kernel.$method_missing === obj.$method_missing) { + // method_missing hasn't been explicitly defined + throw Opal.NoMethodError.$new('super: no superclass method `'+mid+"' for "+obj, mid); + } + + return super_method; + }; + + // Iter dispatcher for super in a block + Opal.find_iter_super_dispatcher = function(obj, jsid, current_func, defcheck, implicit) { + var call_jsid = jsid; + + if (!current_func) { + throw Opal.RuntimeError.$new("super called outside of method"); + } + + if (implicit && current_func.$$define_meth) { + throw Opal.RuntimeError.$new("implicit argument passing of super from method defined by define_method() is not supported. Specify all arguments explicitly"); + } + + if (current_func.$$def) { + call_jsid = current_func.$$jsid; + } + + return Opal.find_super_dispatcher(obj, call_jsid, current_func, defcheck); + }; + + // Used to return as an expression. Sometimes, we can't simply return from + // a javascript function as if we were a method, as the return is used as + // an expression, or even inside a block which must "return" to the outer + // method. This helper simply throws an error which is then caught by the + // method. This approach is expensive, so it is only used when absolutely + // needed. + // + Opal.ret = function(val) { + Opal.returner.$v = val; + throw Opal.returner; + }; + + // Used to break out of a block. + Opal.brk = function(val, breaker) { + breaker.$v = val; + throw breaker; + }; + + // Builds a new unique breaker, this is to avoid multiple nested breaks to get + // in the way of each other. + Opal.new_brk = function() { + return new Error('unexpected break'); + }; + + // handles yield calls for 1 yielded arg + Opal.yield1 = function(block, arg) { + if (typeof(block) !== "function") { + throw Opal.LocalJumpError.$new("no block given"); + } + + var has_mlhs = block.$$has_top_level_mlhs_arg, + has_trailing_comma = block.$$has_trailing_comma_in_args; + + if (block.length > 1 || ((has_mlhs || has_trailing_comma) && block.length === 1)) { + arg = Opal.to_ary(arg); + } + + if ((block.length > 1 || (has_trailing_comma && block.length === 1)) && arg.$$is_array) { + return block.apply(null, arg); + } + else { + return block(arg); + } + }; + + // handles yield for > 1 yielded arg + Opal.yieldX = function(block, args) { + if (typeof(block) !== "function") { + throw Opal.LocalJumpError.$new("no block given"); + } + + if (block.length > 1 && args.length === 1) { + if (args[0].$$is_array) { + return block.apply(null, args[0]); + } + } + + if (!args.$$is_array) { + var args_ary = new Array(args.length); + for(var i = 0, l = args_ary.length; i < l; i++) { args_ary[i] = args[i]; } + + return block.apply(null, args_ary); + } + + return block.apply(null, args); + }; + + // Finds the corresponding exception match in candidates. Each candidate can + // be a value, or an array of values. Returns null if not found. + Opal.rescue = function(exception, candidates) { + for (var i = 0; i < candidates.length; i++) { + var candidate = candidates[i]; + + if (candidate.$$is_array) { + var result = Opal.rescue(exception, candidate); + + if (result) { + return result; + } + } + else if (candidate === Opal.JS.Error) { + return candidate; + } + else if (candidate['$==='](exception)) { + return candidate; + } + } + + return null; + }; + + Opal.is_a = function(object, klass) { + if (klass != null && object.$$meta === klass || object.$$class === klass) { + return true; + } + + if (object.$$is_number && klass.$$is_number_class) { + return true; + } + + var i, length, ancestors = Opal.ancestors(object.$$is_class ? Opal.get_singleton_class(object) : (object.$$meta || object.$$class)); + + for (i = 0, length = ancestors.length; i < length; i++) { + if (ancestors[i] === klass) { + return true; + } + } + + return false; + }; + + // Helpers for extracting kwsplats + // Used for: { **h } + Opal.to_hash = function(value) { + if (value.$$is_hash) { + return value; + } + else if (value['$respond_to?']('to_hash', true)) { + var hash = value.$to_hash(); + if (hash.$$is_hash) { + return hash; + } + else { + throw Opal.TypeError.$new("Can't convert " + value.$$class + + " to Hash (" + value.$$class + "#to_hash gives " + hash.$$class + ")"); + } + } + else { + throw Opal.TypeError.$new("no implicit conversion of " + value.$$class + " into Hash"); + } + }; + + // Helpers for implementing multiple assignment + // Our code for extracting the values and assigning them only works if the + // return value is a JS array. + // So if we get an Array subclass, extract the wrapped JS array from it + + // Used for: a, b = something (no splat) + Opal.to_ary = function(value) { + if (value.$$is_array) { + return value; + } + else if (value['$respond_to?']('to_ary', true)) { + var ary = value.$to_ary(); + if (ary === nil) { + return [value]; + } + else if (ary.$$is_array) { + return ary; + } + else { + throw Opal.TypeError.$new("Can't convert " + value.$$class + + " to Array (" + value.$$class + "#to_ary gives " + ary.$$class + ")"); + } + } + else { + return [value]; + } + }; + + // Used for: a, b = *something (with splat) + Opal.to_a = function(value) { + if (value.$$is_array) { + // A splatted array must be copied + return value.slice(); + } + else if (value['$respond_to?']('to_a', true)) { + var ary = value.$to_a(); + if (ary === nil) { + return [value]; + } + else if (ary.$$is_array) { + return ary; + } + else { + throw Opal.TypeError.$new("Can't convert " + value.$$class + + " to Array (" + value.$$class + "#to_a gives " + ary.$$class + ")"); + } + } + else { + return [value]; + } + }; + + // Used for extracting keyword arguments from arguments passed to + // JS function. If provided +arguments+ list doesn't have a Hash + // as a last item, returns a blank Hash. + // + // @param parameters [Array] + // @return [Hash] + // + Opal.extract_kwargs = function(parameters) { + var kwargs = parameters[parameters.length - 1]; + if (kwargs != null && kwargs['$respond_to?']('to_hash', true)) { + Array.prototype.splice.call(parameters, parameters.length - 1, 1); + return kwargs.$to_hash(); + } + else { + return Opal.hash2([], {}); + } + } + + // Used to get a list of rest keyword arguments. Method takes the given + // keyword args, i.e. the hash literal passed to the method containing all + // keyword arguemnts passed to method, as well as the used args which are + // the names of required and optional arguments defined. This method then + // just returns all key/value pairs which have not been used, in a new + // hash literal. + // + // @param given_args [Hash] all kwargs given to method + // @param used_args [Object] all keys used as named kwargs + // @return [Hash] + // + Opal.kwrestargs = function(given_args, used_args) { + var keys = [], + map = {}, + key = null, + given_map = given_args.$$smap; + + for (key in given_map) { + if (!used_args[key]) { + keys.push(key); + map[key] = given_map[key]; + } + } + + return Opal.hash2(keys, map); + }; + + // Calls passed method on a ruby object with arguments and block: + // + // Can take a method or a method name. + // + // 1. When method name gets passed it invokes it by its name + // and calls 'method_missing' when object doesn't have this method. + // Used internally by Opal to invoke method that takes a block or a splat. + // 2. When method (i.e. method body) gets passed, it doesn't trigger 'method_missing' + // because it doesn't know the name of the actual method. + // Used internally by Opal to invoke 'super'. + // + // @example + // var my_array = [1, 2, 3, 4] + // Opal.send(my_array, 'length') # => 4 + // Opal.send(my_array, my_array.$length) # => 4 + // + // Opal.send(my_array, 'reverse!') # => [4, 3, 2, 1] + // Opal.send(my_array, my_array['$reverse!']') # => [4, 3, 2, 1] + // + // @param recv [Object] ruby object + // @param method [Function, String] method body or name of the method + // @param args [Array] arguments that will be passed to the method call + // @param block [Function] ruby block + // @return [Object] returning value of the method call + Opal.send = function(recv, method, args, block) { + var body = (typeof(method) === 'string') ? recv['$'+method] : method; + + if (body != null) { + if (typeof block === 'function') { + body.$$p = block; + } + return body.apply(recv, args); + } + + return recv.$method_missing.apply(recv, [method].concat(args)); + } + + Opal.lambda = function(block) { + block.$$is_lambda = true; + return block; + } + + // Used to define methods on an object. This is a helper method, used by the + // compiled source to define methods on special case objects when the compiler + // can not determine the destination object, or the object is a Module + // instance. This can get called by `Module#define_method` as well. + // + // ## Modules + // + // Any method defined on a module will come through this runtime helper. + // The method is added to the module body, and the owner of the method is + // set to be the module itself. This is used later when choosing which + // method should show on a class if more than 1 included modules define + // the same method. Finally, if the module is in `module_function` mode, + // then the method is also defined onto the module itself. + // + // ## Classes + // + // This helper will only be called for classes when a method is being + // defined indirectly; either through `Module#define_method`, or by a + // literal `def` method inside an `instance_eval` or `class_eval` body. In + // either case, the method is simply added to the class' prototype. A special + // exception exists for `BasicObject` and `Object`. These two classes are + // special because they are used in toll-free bridged classes. In each of + // these two cases, extra work is required to define the methods on toll-free + // bridged class' prototypes as well. + // + // ## Objects + // + // If a simple ruby object is the object, then the method is simply just + // defined on the object as a singleton method. This would be the case when + // a method is defined inside an `instance_eval` block. + // + // @param obj [Object, Class] the actual obj to define method for + // @param jsid [String] the JavaScript friendly method name (e.g. '$foo') + // @param body [JS.Function] the literal JavaScript function used as method + // @return [null] + // + Opal.def = function(obj, jsid, body) { + // Special case for a method definition in the + // top-level namespace + if (obj === Opal.top) { + Opal.defn(Opal.Object, jsid, body) + } + // if instance_eval is invoked on a module/class, it sets inst_eval_mod + else if (!obj.$$eval && obj.$$is_a_module) { + Opal.defn(obj, jsid, body); + } + else { + Opal.defs(obj, jsid, body); + } + }; + + // Define method on a module or class (see Opal.def). + Opal.defn = function(module, jsid, body) { + body.$$owner = module; + + var proto = module.prototype; + if (proto.hasOwnProperty('$$dummy')) { + proto = proto.$$define_methods_on; + } + $defineProperty(proto, jsid, body); + + if (module.$$is_module) { + if (module.$$module_function) { + Opal.defs(module, jsid, body) + } + + for (var i = 0, iclasses = module.$$iclasses, length = iclasses.length; i < length; i++) { + var iclass = iclasses[i]; + $defineProperty(iclass, jsid, body); + } + } + + var singleton_of = module.$$singleton_of; + if (module.$method_added && !module.$method_added.$$stub && !singleton_of) { + module.$method_added(jsid.substr(1)); + } + else if (singleton_of && singleton_of.$singleton_method_added && !singleton_of.$singleton_method_added.$$stub) { + singleton_of.$singleton_method_added(jsid.substr(1)); + } + } + + // Define a singleton method on the given object (see Opal.def). + Opal.defs = function(obj, jsid, body) { + if (obj.$$is_string || obj.$$is_number) { + // That's simply impossible + return; + } + Opal.defn(Opal.get_singleton_class(obj), jsid, body) + }; + + // Called from #remove_method. + Opal.rdef = function(obj, jsid) { + if (!$hasOwn.call(obj.prototype, jsid)) { + throw Opal.NameError.$new("method '" + jsid.substr(1) + "' not defined in " + obj.$name()); + } + + delete obj.prototype[jsid]; + + if (obj.$$is_singleton) { + if (obj.prototype.$singleton_method_removed && !obj.prototype.$singleton_method_removed.$$stub) { + obj.prototype.$singleton_method_removed(jsid.substr(1)); + } + } + else { + if (obj.$method_removed && !obj.$method_removed.$$stub) { + obj.$method_removed(jsid.substr(1)); + } + } + }; + + // Called from #undef_method. + Opal.udef = function(obj, jsid) { + if (!obj.prototype[jsid] || obj.prototype[jsid].$$stub) { + throw Opal.NameError.$new("method '" + jsid.substr(1) + "' not defined in " + obj.$name()); + } + + Opal.add_stub_for(obj.prototype, jsid); + + if (obj.$$is_singleton) { + if (obj.prototype.$singleton_method_undefined && !obj.prototype.$singleton_method_undefined.$$stub) { + obj.prototype.$singleton_method_undefined(jsid.substr(1)); + } + } + else { + if (obj.$method_undefined && !obj.$method_undefined.$$stub) { + obj.$method_undefined(jsid.substr(1)); + } + } + }; + + function is_method_body(body) { + return (typeof(body) === "function" && !body.$$stub); + } + + Opal.alias = function(obj, name, old) { + var id = '$' + name, + old_id = '$' + old, + body = obj.prototype['$' + old], + alias; + + // When running inside #instance_eval the alias refers to class methods. + if (obj.$$eval) { + return Opal.alias(Opal.get_singleton_class(obj), name, old); + } + + if (!is_method_body(body)) { + var ancestor = obj.$$super; + + while (typeof(body) !== "function" && ancestor) { + body = ancestor[old_id]; + ancestor = ancestor.$$super; + } + + if (!is_method_body(body) && obj.$$is_module) { + // try to look into Object + body = Opal.Object.prototype[old_id] + } + + if (!is_method_body(body)) { + throw Opal.NameError.$new("undefined method `" + old + "' for class `" + obj.$name() + "'") + } + } + + // If the body is itself an alias use the original body + // to keep the max depth at 1. + if (body.$$alias_of) body = body.$$alias_of; + + // We need a wrapper because otherwise properties + // would be ovrewritten on the original body. + alias = function() { + var block = alias.$$p, args, i, ii; + + args = new Array(arguments.length); + for(i = 0, ii = arguments.length; i < ii; i++) { + args[i] = arguments[i]; + } + + if (block != null) { alias.$$p = null } + + return Opal.send(this, body, args, block); + }; + + // Try to make the browser pick the right name + alias.displayName = name; + alias.length = body.length; + alias.$$arity = body.$$arity; + alias.$$parameters = body.$$parameters; + alias.$$source_location = body.$$source_location; + alias.$$alias_of = body; + alias.$$alias_name = name; + + Opal.defn(obj, id, alias); + + return obj; + }; + + Opal.alias_native = function(obj, name, native_name) { + var id = '$' + name, + body = obj.prototype[native_name]; + + if (typeof(body) !== "function" || body.$$stub) { + throw Opal.NameError.$new("undefined native method `" + native_name + "' for class `" + obj.$name() + "'") + } + + Opal.defn(obj, id, body); + + return obj; + }; + + + // Hashes + // ------ + + Opal.hash_init = function(hash) { + hash.$$smap = Object.create(null); + hash.$$map = Object.create(null); + hash.$$keys = []; + }; + + Opal.hash_clone = function(from_hash, to_hash) { + to_hash.$$none = from_hash.$$none; + to_hash.$$proc = from_hash.$$proc; + + for (var i = 0, keys = from_hash.$$keys, smap = from_hash.$$smap, len = keys.length, key, value; i < len; i++) { + key = keys[i]; + + if (key.$$is_string) { + value = smap[key]; + } else { + value = key.value; + key = key.key; + } + + Opal.hash_put(to_hash, key, value); + } + }; + + Opal.hash_put = function(hash, key, value) { + if (key.$$is_string) { + if (!$hasOwn.call(hash.$$smap, key)) { + hash.$$keys.push(key); + } + hash.$$smap[key] = value; + return; + } + + var key_hash, bucket, last_bucket; + key_hash = hash.$$by_identity ? Opal.id(key) : key.$hash(); + + if (!$hasOwn.call(hash.$$map, key_hash)) { + bucket = {key: key, key_hash: key_hash, value: value}; + hash.$$keys.push(bucket); + hash.$$map[key_hash] = bucket; + return; + } + + bucket = hash.$$map[key_hash]; + + while (bucket) { + if (key === bucket.key || key['$eql?'](bucket.key)) { + last_bucket = undefined; + bucket.value = value; + break; + } + last_bucket = bucket; + bucket = bucket.next; + } + + if (last_bucket) { + bucket = {key: key, key_hash: key_hash, value: value}; + hash.$$keys.push(bucket); + last_bucket.next = bucket; + } + }; + + Opal.hash_get = function(hash, key) { + if (key.$$is_string) { + if ($hasOwn.call(hash.$$smap, key)) { + return hash.$$smap[key]; + } + return; + } + + var key_hash, bucket; + key_hash = hash.$$by_identity ? Opal.id(key) : key.$hash(); + + if ($hasOwn.call(hash.$$map, key_hash)) { + bucket = hash.$$map[key_hash]; + + while (bucket) { + if (key === bucket.key || key['$eql?'](bucket.key)) { + return bucket.value; + } + bucket = bucket.next; + } + } + }; + + Opal.hash_delete = function(hash, key) { + var i, keys = hash.$$keys, length = keys.length, value; + + if (key.$$is_string) { + if (!$hasOwn.call(hash.$$smap, key)) { + return; + } + + for (i = 0; i < length; i++) { + if (keys[i] === key) { + keys.splice(i, 1); + break; + } + } + + value = hash.$$smap[key]; + delete hash.$$smap[key]; + return value; + } + + var key_hash = key.$hash(); + + if (!$hasOwn.call(hash.$$map, key_hash)) { + return; + } + + var bucket = hash.$$map[key_hash], last_bucket; + + while (bucket) { + if (key === bucket.key || key['$eql?'](bucket.key)) { + value = bucket.value; + + for (i = 0; i < length; i++) { + if (keys[i] === bucket) { + keys.splice(i, 1); + break; + } + } + + if (last_bucket && bucket.next) { + last_bucket.next = bucket.next; + } + else if (last_bucket) { + delete last_bucket.next; + } + else if (bucket.next) { + hash.$$map[key_hash] = bucket.next; + } + else { + delete hash.$$map[key_hash]; + } + + return value; + } + last_bucket = bucket; + bucket = bucket.next; + } + }; + + Opal.hash_rehash = function(hash) { + for (var i = 0, length = hash.$$keys.length, key_hash, bucket, last_bucket; i < length; i++) { + + if (hash.$$keys[i].$$is_string) { + continue; + } + + key_hash = hash.$$keys[i].key.$hash(); + + if (key_hash === hash.$$keys[i].key_hash) { + continue; + } + + bucket = hash.$$map[hash.$$keys[i].key_hash]; + last_bucket = undefined; + + while (bucket) { + if (bucket === hash.$$keys[i]) { + if (last_bucket && bucket.next) { + last_bucket.next = bucket.next; + } + else if (last_bucket) { + delete last_bucket.next; + } + else if (bucket.next) { + hash.$$map[hash.$$keys[i].key_hash] = bucket.next; + } + else { + delete hash.$$map[hash.$$keys[i].key_hash]; + } + break; + } + last_bucket = bucket; + bucket = bucket.next; + } + + hash.$$keys[i].key_hash = key_hash; + + if (!$hasOwn.call(hash.$$map, key_hash)) { + hash.$$map[key_hash] = hash.$$keys[i]; + continue; + } + + bucket = hash.$$map[key_hash]; + last_bucket = undefined; + + while (bucket) { + if (bucket === hash.$$keys[i]) { + last_bucket = undefined; + break; + } + last_bucket = bucket; + bucket = bucket.next; + } + + if (last_bucket) { + last_bucket.next = hash.$$keys[i]; + } + } + }; + + Opal.hash = function() { + var arguments_length = arguments.length, args, hash, i, length, key, value; + + if (arguments_length === 1 && arguments[0].$$is_hash) { + return arguments[0]; + } + + hash = new Opal.Hash(); + Opal.hash_init(hash); + + if (arguments_length === 1 && arguments[0].$$is_array) { + args = arguments[0]; + length = args.length; + + for (i = 0; i < length; i++) { + if (args[i].length !== 2) { + throw Opal.ArgumentError.$new("value not of length 2: " + args[i].$inspect()); + } + + key = args[i][0]; + value = args[i][1]; + + Opal.hash_put(hash, key, value); + } + + return hash; + } + + if (arguments_length === 1) { + args = arguments[0]; + for (key in args) { + if ($hasOwn.call(args, key)) { + value = args[key]; + + Opal.hash_put(hash, key, value); + } + } + + return hash; + } + + if (arguments_length % 2 !== 0) { + throw Opal.ArgumentError.$new("odd number of arguments for Hash"); + } + + for (i = 0; i < arguments_length; i += 2) { + key = arguments[i]; + value = arguments[i + 1]; + + Opal.hash_put(hash, key, value); + } + + return hash; + }; + + // A faster Hash creator for hashes that just use symbols and + // strings as keys. The map and keys array can be constructed at + // compile time, so they are just added here by the constructor + // function. + // + Opal.hash2 = function(keys, smap) { + var hash = new Opal.Hash(); + + hash.$$smap = smap; + hash.$$map = Object.create(null); + hash.$$keys = keys; + + return hash; + }; + + // Create a new range instance with first and last values, and whether the + // range excludes the last value. + // + Opal.range = function(first, last, exc) { + var range = new Opal.Range(); + range.begin = first; + range.end = last; + range.excl = exc; + + return range; + }; + + // Get the ivar name for a given name. + // Mostly adds a trailing $ to reserved names. + // + Opal.ivar = function(name) { + if ( + // properties + name === "constructor" || + name === "displayName" || + name === "__count__" || + name === "__noSuchMethod__" || + name === "__parent__" || + name === "__proto__" || + + // methods + name === "hasOwnProperty" || + name === "valueOf" + ) + { + return name + "$"; + } + + return name; + }; + + + // Regexps + // ------- + + // Escape Regexp special chars letting the resulting string be used to build + // a new Regexp. + // + Opal.escape_regexp = function(str) { + return str.replace(/([-[\]\/{}()*+?.^$\\| ])/g, '\\$1') + .replace(/[\n]/g, '\\n') + .replace(/[\r]/g, '\\r') + .replace(/[\f]/g, '\\f') + .replace(/[\t]/g, '\\t'); + }; + + // Create a global Regexp from a RegExp object and cache the result + // on the object itself ($$g attribute). + // + Opal.global_regexp = function(pattern) { + if (pattern.global) { + return pattern; // RegExp already has the global flag + } + if (pattern.$$g == null) { + pattern.$$g = new RegExp(pattern.source, (pattern.multiline ? 'gm' : 'g') + (pattern.ignoreCase ? 'i' : '')); + } else { + pattern.$$g.lastIndex = null; // reset lastIndex property + } + return pattern.$$g; + }; + + // Create a global multiline Regexp from a RegExp object and cache the result + // on the object itself ($$gm or $$g attribute). + // + Opal.global_multiline_regexp = function(pattern) { + var result; + if (pattern.multiline) { + if (pattern.global) { + return pattern; // RegExp already has the global and multiline flag + } + // we are using the $$g attribute because the Regexp is already multiline + if (pattern.$$g != null) { + result = pattern.$$g; + } else { + result = pattern.$$g = new RegExp(pattern.source, 'gm' + (pattern.ignoreCase ? 'i' : '')); + } + } else if (pattern.$$gm != null) { + result = pattern.$$gm; + } else { + result = pattern.$$gm = new RegExp(pattern.source, 'gm' + (pattern.ignoreCase ? 'i' : '')); + } + result.lastIndex = null; // reset lastIndex property + return result; + }; + + // Require system + // -------------- + + Opal.modules = {}; + Opal.loaded_features = ['corelib/runtime']; + Opal.current_dir = '.'; + Opal.require_table = {'corelib/runtime': true}; + + Opal.normalize = function(path) { + var parts, part, new_parts = [], SEPARATOR = '/'; + + if (Opal.current_dir !== '.') { + path = Opal.current_dir.replace(/\/*$/, '/') + path; + } + + path = path.replace(/^\.\//, ''); + path = path.replace(/\.(rb|opal|js)$/, ''); + parts = path.split(SEPARATOR); + + for (var i = 0, ii = parts.length; i < ii; i++) { + part = parts[i]; + if (part === '') continue; + (part === '..') ? new_parts.pop() : new_parts.push(part) + } + + return new_parts.join(SEPARATOR); + }; + + Opal.loaded = function(paths) { + var i, l, path; + + for (i = 0, l = paths.length; i < l; i++) { + path = Opal.normalize(paths[i]); + + if (Opal.require_table[path]) { + continue; + } + + Opal.loaded_features.push(path); + Opal.require_table[path] = true; + } + }; + + Opal.load = function(path) { + path = Opal.normalize(path); + + Opal.loaded([path]); + + var module = Opal.modules[path]; + + if (module) { + module(Opal); + } + else { + var severity = Opal.config.missing_require_severity; + var message = 'cannot load such file -- ' + path; + + if (severity === "error") { + if (Opal.LoadError) { + throw Opal.LoadError.$new(message) + } else { + throw message + } + } + else if (severity === "warning") { + console.warn('WARNING: LoadError: ' + message); + } + } + + return true; + }; + + Opal.require = function(path) { + path = Opal.normalize(path); + + if (Opal.require_table[path]) { + return false; + } + + return Opal.load(path); + }; + + + // Initialization + // -------------- + function $BasicObject() {}; + function $Object() {}; + function $Module() {}; + function $Class() {}; + + Opal.BasicObject = BasicObject = Opal.allocate_class('BasicObject', null, $BasicObject); + Opal.Object = _Object = Opal.allocate_class('Object', Opal.BasicObject, $Object); + Opal.Module = Module = Opal.allocate_class('Module', Opal.Object, $Module); + Opal.Class = Class = Opal.allocate_class('Class', Opal.Module, $Class); + + $setPrototype(Opal.BasicObject, Opal.Class.prototype); + $setPrototype(Opal.Object, Opal.Class.prototype); + $setPrototype(Opal.Module, Opal.Class.prototype); + $setPrototype(Opal.Class, Opal.Class.prototype); + + // BasicObject can reach itself, avoid const_set to skip the $$base_module logic + BasicObject.$$const["BasicObject"] = BasicObject; + + // Assign basic constants + Opal.const_set(_Object, "BasicObject", BasicObject); + Opal.const_set(_Object, "Object", _Object); + Opal.const_set(_Object, "Module", Module); + Opal.const_set(_Object, "Class", Class); + + // Fix booted classes to have correct .class value + BasicObject.$$class = Class; + _Object.$$class = Class; + Module.$$class = Class; + Class.$$class = Class; + + // Forward .toString() to #to_s + $defineProperty(_Object.prototype, 'toString', function() { + var to_s = this.$to_s(); + if (to_s.$$is_string && typeof(to_s) === 'object') { + // a string created using new String('string') + return to_s.valueOf(); + } else { + return to_s; + } + }); + + // Make Kernel#require immediately available as it's needed to require all the + // other corelib files. + $defineProperty(_Object.prototype, '$require', Opal.require); + + // Add a short helper to navigate constants manually. + // @example + // Opal.$$.Regexp.$$.IGNORECASE + Opal.$$ = _Object.$$; + + // Instantiate the main object + Opal.top = new _Object(); + Opal.top.$to_s = Opal.top.$inspect = function() { return 'main' }; + + + // Nil + function $NilClass() {}; + Opal.NilClass = Opal.allocate_class('NilClass', Opal.Object, $NilClass); + Opal.const_set(_Object, 'NilClass', Opal.NilClass); + nil = Opal.nil = new Opal.NilClass(); + nil.$$id = nil_id; + nil.call = nil.apply = function() { throw Opal.LocalJumpError.$new('no block given'); }; + + // Errors + Opal.breaker = new Error('unexpected break (old)'); + Opal.returner = new Error('unexpected return'); + TypeError.$$super = Error; +}).call(this); +Opal.loaded(["corelib/runtime.js"]); +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/helpers"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $truthy = Opal.truthy; + + Opal.add_stubs(['$new', '$class', '$===', '$respond_to?', '$raise', '$type_error', '$__send__', '$coerce_to', '$nil?', '$<=>', '$coerce_to!', '$!=', '$[]', '$upcase']); + return (function($base, $parent_nesting) { + function $Opal() {}; + var self = $Opal = $module($base, 'Opal', $Opal); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Opal_bridge_1, TMP_Opal_type_error_2, TMP_Opal_coerce_to_3, TMP_Opal_coerce_to$B_4, TMP_Opal_coerce_to$q_5, TMP_Opal_try_convert_6, TMP_Opal_compare_7, TMP_Opal_destructure_8, TMP_Opal_respond_to$q_9, TMP_Opal_inspect_obj_10, TMP_Opal_instance_variable_name$B_11, TMP_Opal_class_variable_name$B_12, TMP_Opal_const_name$B_13, TMP_Opal_pristine_14; + + + Opal.defs(self, '$bridge', TMP_Opal_bridge_1 = function $$bridge(constructor, klass) { + var self = this; + + return Opal.bridge(constructor, klass); + }, TMP_Opal_bridge_1.$$arity = 2); + Opal.defs(self, '$type_error', TMP_Opal_type_error_2 = function $$type_error(object, type, method, coerced) { + var $a, self = this; + + + + if (method == null) { + method = nil; + }; + + if (coerced == null) { + coerced = nil; + }; + if ($truthy(($truthy($a = method) ? coerced : $a))) { + return $$($nesting, 'TypeError').$new("" + "can't convert " + (object.$class()) + " into " + (type) + " (" + (object.$class()) + "#" + (method) + " gives " + (coerced.$class()) + ")") + } else { + return $$($nesting, 'TypeError').$new("" + "no implicit conversion of " + (object.$class()) + " into " + (type)) + }; + }, TMP_Opal_type_error_2.$$arity = -3); + Opal.defs(self, '$coerce_to', TMP_Opal_coerce_to_3 = function $$coerce_to(object, type, method) { + var self = this; + + + if ($truthy(type['$==='](object))) { + return object}; + if ($truthy(object['$respond_to?'](method))) { + } else { + self.$raise(self.$type_error(object, type)) + }; + return object.$__send__(method); + }, TMP_Opal_coerce_to_3.$$arity = 3); + Opal.defs(self, '$coerce_to!', TMP_Opal_coerce_to$B_4 = function(object, type, method) { + var self = this, coerced = nil; + + + coerced = self.$coerce_to(object, type, method); + if ($truthy(type['$==='](coerced))) { + } else { + self.$raise(self.$type_error(object, type, method, coerced)) + }; + return coerced; + }, TMP_Opal_coerce_to$B_4.$$arity = 3); + Opal.defs(self, '$coerce_to?', TMP_Opal_coerce_to$q_5 = function(object, type, method) { + var self = this, coerced = nil; + + + if ($truthy(object['$respond_to?'](method))) { + } else { + return nil + }; + coerced = self.$coerce_to(object, type, method); + if ($truthy(coerced['$nil?']())) { + return nil}; + if ($truthy(type['$==='](coerced))) { + } else { + self.$raise(self.$type_error(object, type, method, coerced)) + }; + return coerced; + }, TMP_Opal_coerce_to$q_5.$$arity = 3); + Opal.defs(self, '$try_convert', TMP_Opal_try_convert_6 = function $$try_convert(object, type, method) { + var self = this; + + + if ($truthy(type['$==='](object))) { + return object}; + if ($truthy(object['$respond_to?'](method))) { + return object.$__send__(method) + } else { + return nil + }; + }, TMP_Opal_try_convert_6.$$arity = 3); + Opal.defs(self, '$compare', TMP_Opal_compare_7 = function $$compare(a, b) { + var self = this, compare = nil; + + + compare = a['$<=>'](b); + if ($truthy(compare === nil)) { + self.$raise($$($nesting, 'ArgumentError'), "" + "comparison of " + (a.$class()) + " with " + (b.$class()) + " failed")}; + return compare; + }, TMP_Opal_compare_7.$$arity = 2); + Opal.defs(self, '$destructure', TMP_Opal_destructure_8 = function $$destructure(args) { + var self = this; + + + if (args.length == 1) { + return args[0]; + } + else if (args.$$is_array) { + return args; + } + else { + var args_ary = new Array(args.length); + for(var i = 0, l = args_ary.length; i < l; i++) { args_ary[i] = args[i]; } + + return args_ary; + } + + }, TMP_Opal_destructure_8.$$arity = 1); + Opal.defs(self, '$respond_to?', TMP_Opal_respond_to$q_9 = function(obj, method, include_all) { + var self = this; + + + + if (include_all == null) { + include_all = false; + }; + + if (obj == null || !obj.$$class) { + return false; + } + ; + return obj['$respond_to?'](method, include_all); + }, TMP_Opal_respond_to$q_9.$$arity = -3); + Opal.defs(self, '$inspect_obj', TMP_Opal_inspect_obj_10 = function $$inspect_obj(obj) { + var self = this; + + return Opal.inspect(obj); + }, TMP_Opal_inspect_obj_10.$$arity = 1); + Opal.defs(self, '$instance_variable_name!', TMP_Opal_instance_variable_name$B_11 = function(name) { + var self = this; + + + name = $$($nesting, 'Opal')['$coerce_to!'](name, $$($nesting, 'String'), "to_str"); + if ($truthy(/^@[a-zA-Z_][a-zA-Z0-9_]*?$/.test(name))) { + } else { + self.$raise($$($nesting, 'NameError').$new("" + "'" + (name) + "' is not allowed as an instance variable name", name)) + }; + return name; + }, TMP_Opal_instance_variable_name$B_11.$$arity = 1); + Opal.defs(self, '$class_variable_name!', TMP_Opal_class_variable_name$B_12 = function(name) { + var self = this; + + + name = $$($nesting, 'Opal')['$coerce_to!'](name, $$($nesting, 'String'), "to_str"); + if ($truthy(name.length < 3 || name.slice(0,2) !== '@@')) { + self.$raise($$($nesting, 'NameError').$new("" + "`" + (name) + "' is not allowed as a class variable name", name))}; + return name; + }, TMP_Opal_class_variable_name$B_12.$$arity = 1); + Opal.defs(self, '$const_name!', TMP_Opal_const_name$B_13 = function(const_name) { + var self = this; + + + const_name = $$($nesting, 'Opal')['$coerce_to!'](const_name, $$($nesting, 'String'), "to_str"); + if ($truthy(const_name['$[]'](0)['$!='](const_name['$[]'](0).$upcase()))) { + self.$raise($$($nesting, 'NameError'), "" + "wrong constant name " + (const_name))}; + return const_name; + }, TMP_Opal_const_name$B_13.$$arity = 1); + Opal.defs(self, '$pristine', TMP_Opal_pristine_14 = function $$pristine(owner_class, $a) { + var $post_args, method_names, self = this; + + + + $post_args = Opal.slice.call(arguments, 1, arguments.length); + + method_names = $post_args;; + + var method_name, method; + for (var i = method_names.length - 1; i >= 0; i--) { + method_name = method_names[i]; + method = owner_class.prototype['$'+method_name]; + + if (method && !method.$$stub) { + method.$$pristine = true; + } + } + ; + return nil; + }, TMP_Opal_pristine_14.$$arity = -2); + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/module"] = function(Opal) { + function $rb_lt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); + } + function $rb_gt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $send = Opal.send, $truthy = Opal.truthy, $lambda = Opal.lambda, $range = Opal.range, $hash2 = Opal.hash2; + + Opal.add_stubs(['$module_eval', '$to_proc', '$===', '$raise', '$equal?', '$<', '$>', '$nil?', '$attr_reader', '$attr_writer', '$class_variable_name!', '$new', '$const_name!', '$=~', '$inject', '$split', '$const_get', '$==', '$!~', '$start_with?', '$bind', '$call', '$class', '$append_features', '$included', '$name', '$cover?', '$size', '$merge', '$compile', '$proc', '$any?', '$prepend_features', '$prepended', '$to_s', '$__id__', '$constants', '$include?', '$copy_class_variables', '$copy_constants']); + return (function($base, $super, $parent_nesting) { + function $Module(){}; + var self = $Module = $klass($base, $super, 'Module', $Module); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Module_allocate_1, TMP_Module_inherited_2, TMP_Module_initialize_3, TMP_Module_$eq$eq$eq_4, TMP_Module_$lt_5, TMP_Module_$lt$eq_6, TMP_Module_$gt_7, TMP_Module_$gt$eq_8, TMP_Module_$lt$eq$gt_9, TMP_Module_alias_method_10, TMP_Module_alias_native_11, TMP_Module_ancestors_12, TMP_Module_append_features_13, TMP_Module_attr_accessor_14, TMP_Module_attr_reader_15, TMP_Module_attr_writer_16, TMP_Module_autoload_17, TMP_Module_class_variables_18, TMP_Module_class_variable_get_19, TMP_Module_class_variable_set_20, TMP_Module_class_variable_defined$q_21, TMP_Module_remove_class_variable_22, TMP_Module_constants_23, TMP_Module_constants_24, TMP_Module_nesting_25, TMP_Module_const_defined$q_26, TMP_Module_const_get_27, TMP_Module_const_missing_29, TMP_Module_const_set_30, TMP_Module_public_constant_31, TMP_Module_define_method_32, TMP_Module_remove_method_34, TMP_Module_singleton_class$q_35, TMP_Module_include_36, TMP_Module_included_modules_37, TMP_Module_include$q_38, TMP_Module_instance_method_39, TMP_Module_instance_methods_40, TMP_Module_included_41, TMP_Module_extended_42, TMP_Module_extend_object_43, TMP_Module_method_added_44, TMP_Module_method_removed_45, TMP_Module_method_undefined_46, TMP_Module_module_eval_47, TMP_Module_module_exec_49, TMP_Module_method_defined$q_50, TMP_Module_module_function_51, TMP_Module_name_52, TMP_Module_prepend_53, TMP_Module_prepend_features_54, TMP_Module_prepended_55, TMP_Module_remove_const_56, TMP_Module_to_s_57, TMP_Module_undef_method_58, TMP_Module_instance_variables_59, TMP_Module_dup_60, TMP_Module_copy_class_variables_61, TMP_Module_copy_constants_62; + + + Opal.defs(self, '$allocate', TMP_Module_allocate_1 = function $$allocate() { + var self = this; + + + var module = Opal.allocate_module(nil, function(){}); + return module; + + }, TMP_Module_allocate_1.$$arity = 0); + Opal.defs(self, '$inherited', TMP_Module_inherited_2 = function $$inherited(klass) { + var self = this; + + + klass.$allocate = function() { + var module = Opal.allocate_module(nil, function(){}); + Object.setPrototypeOf(module, klass.prototype); + return module; + } + + }, TMP_Module_inherited_2.$$arity = 1); + + Opal.def(self, '$initialize', TMP_Module_initialize_3 = function $$initialize() { + var $iter = TMP_Module_initialize_3.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Module_initialize_3.$$p = null; + + + if ($iter) TMP_Module_initialize_3.$$p = null;; + if ((block !== nil)) { + return $send(self, 'module_eval', [], block.$to_proc()) + } else { + return nil + }; + }, TMP_Module_initialize_3.$$arity = 0); + + Opal.def(self, '$===', TMP_Module_$eq$eq$eq_4 = function(object) { + var self = this; + + + if ($truthy(object == null)) { + return false}; + return Opal.is_a(object, self);; + }, TMP_Module_$eq$eq$eq_4.$$arity = 1); + + Opal.def(self, '$<', TMP_Module_$lt_5 = function(other) { + var self = this; + + + if ($truthy($$($nesting, 'Module')['$==='](other))) { + } else { + self.$raise($$($nesting, 'TypeError'), "compared with non class/module") + }; + + var working = self, + ancestors, + i, length; + + if (working === other) { + return false; + } + + for (i = 0, ancestors = Opal.ancestors(self), length = ancestors.length; i < length; i++) { + if (ancestors[i] === other) { + return true; + } + } + + for (i = 0, ancestors = Opal.ancestors(other), length = ancestors.length; i < length; i++) { + if (ancestors[i] === self) { + return false; + } + } + + return nil; + ; + }, TMP_Module_$lt_5.$$arity = 1); + + Opal.def(self, '$<=', TMP_Module_$lt$eq_6 = function(other) { + var $a, self = this; + + return ($truthy($a = self['$equal?'](other)) ? $a : $rb_lt(self, other)) + }, TMP_Module_$lt$eq_6.$$arity = 1); + + Opal.def(self, '$>', TMP_Module_$gt_7 = function(other) { + var self = this; + + + if ($truthy($$($nesting, 'Module')['$==='](other))) { + } else { + self.$raise($$($nesting, 'TypeError'), "compared with non class/module") + }; + return $rb_lt(other, self); + }, TMP_Module_$gt_7.$$arity = 1); + + Opal.def(self, '$>=', TMP_Module_$gt$eq_8 = function(other) { + var $a, self = this; + + return ($truthy($a = self['$equal?'](other)) ? $a : $rb_gt(self, other)) + }, TMP_Module_$gt$eq_8.$$arity = 1); + + Opal.def(self, '$<=>', TMP_Module_$lt$eq$gt_9 = function(other) { + var self = this, lt = nil; + + + + if (self === other) { + return 0; + } + ; + if ($truthy($$($nesting, 'Module')['$==='](other))) { + } else { + return nil + }; + lt = $rb_lt(self, other); + if ($truthy(lt['$nil?']())) { + return nil}; + if ($truthy(lt)) { + return -1 + } else { + return 1 + }; + }, TMP_Module_$lt$eq$gt_9.$$arity = 1); + + Opal.def(self, '$alias_method', TMP_Module_alias_method_10 = function $$alias_method(newname, oldname) { + var self = this; + + + Opal.alias(self, newname, oldname); + return self; + }, TMP_Module_alias_method_10.$$arity = 2); + + Opal.def(self, '$alias_native', TMP_Module_alias_native_11 = function $$alias_native(mid, jsid) { + var self = this; + + + + if (jsid == null) { + jsid = mid; + }; + Opal.alias_native(self, mid, jsid); + return self; + }, TMP_Module_alias_native_11.$$arity = -2); + + Opal.def(self, '$ancestors', TMP_Module_ancestors_12 = function $$ancestors() { + var self = this; + + return Opal.ancestors(self); + }, TMP_Module_ancestors_12.$$arity = 0); + + Opal.def(self, '$append_features', TMP_Module_append_features_13 = function $$append_features(includer) { + var self = this; + + + Opal.append_features(self, includer); + return self; + }, TMP_Module_append_features_13.$$arity = 1); + + Opal.def(self, '$attr_accessor', TMP_Module_attr_accessor_14 = function $$attr_accessor($a) { + var $post_args, names, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + names = $post_args;; + $send(self, 'attr_reader', Opal.to_a(names)); + return $send(self, 'attr_writer', Opal.to_a(names)); + }, TMP_Module_attr_accessor_14.$$arity = -1); + Opal.alias(self, "attr", "attr_accessor"); + + Opal.def(self, '$attr_reader', TMP_Module_attr_reader_15 = function $$attr_reader($a) { + var $post_args, names, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + names = $post_args;; + + var proto = self.prototype; + + for (var i = names.length - 1; i >= 0; i--) { + var name = names[i], + id = '$' + name, + ivar = Opal.ivar(name); + + // the closure here is needed because name will change at the next + // cycle, I wish we could use let. + var body = (function(ivar) { + return function() { + if (this[ivar] == null) { + return nil; + } + else { + return this[ivar]; + } + }; + })(ivar); + + // initialize the instance variable as nil + Opal.defineProperty(proto, ivar, nil); + + body.$$parameters = []; + body.$$arity = 0; + + Opal.defn(self, id, body); + } + ; + return nil; + }, TMP_Module_attr_reader_15.$$arity = -1); + + Opal.def(self, '$attr_writer', TMP_Module_attr_writer_16 = function $$attr_writer($a) { + var $post_args, names, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + names = $post_args;; + + var proto = self.prototype; + + for (var i = names.length - 1; i >= 0; i--) { + var name = names[i], + id = '$' + name + '=', + ivar = Opal.ivar(name); + + // the closure here is needed because name will change at the next + // cycle, I wish we could use let. + var body = (function(ivar){ + return function(value) { + return this[ivar] = value; + } + })(ivar); + + body.$$parameters = [['req']]; + body.$$arity = 1; + + // initialize the instance variable as nil + Opal.defineProperty(proto, ivar, nil); + + Opal.defn(self, id, body); + } + ; + return nil; + }, TMP_Module_attr_writer_16.$$arity = -1); + + Opal.def(self, '$autoload', TMP_Module_autoload_17 = function $$autoload(const$, path) { + var self = this; + + + if (self.$$autoload == null) self.$$autoload = {}; + Opal.const_cache_version++; + self.$$autoload[const$] = path; + return nil; + + }, TMP_Module_autoload_17.$$arity = 2); + + Opal.def(self, '$class_variables', TMP_Module_class_variables_18 = function $$class_variables() { + var self = this; + + return Object.keys(Opal.class_variables(self)); + }, TMP_Module_class_variables_18.$$arity = 0); + + Opal.def(self, '$class_variable_get', TMP_Module_class_variable_get_19 = function $$class_variable_get(name) { + var self = this; + + + name = $$($nesting, 'Opal')['$class_variable_name!'](name); + + var value = Opal.class_variables(self)[name]; + if (value == null) { + self.$raise($$($nesting, 'NameError').$new("" + "uninitialized class variable " + (name) + " in " + (self), name)) + } + return value; + ; + }, TMP_Module_class_variable_get_19.$$arity = 1); + + Opal.def(self, '$class_variable_set', TMP_Module_class_variable_set_20 = function $$class_variable_set(name, value) { + var self = this; + + + name = $$($nesting, 'Opal')['$class_variable_name!'](name); + return Opal.class_variable_set(self, name, value);; + }, TMP_Module_class_variable_set_20.$$arity = 2); + + Opal.def(self, '$class_variable_defined?', TMP_Module_class_variable_defined$q_21 = function(name) { + var self = this; + + + name = $$($nesting, 'Opal')['$class_variable_name!'](name); + return Opal.class_variables(self).hasOwnProperty(name);; + }, TMP_Module_class_variable_defined$q_21.$$arity = 1); + + Opal.def(self, '$remove_class_variable', TMP_Module_remove_class_variable_22 = function $$remove_class_variable(name) { + var self = this; + + + name = $$($nesting, 'Opal')['$class_variable_name!'](name); + + if (Opal.hasOwnProperty.call(self.$$cvars, name)) { + var value = self.$$cvars[name]; + delete self.$$cvars[name]; + return value; + } else { + self.$raise($$($nesting, 'NameError'), "" + "cannot remove " + (name) + " for " + (self)) + } + ; + }, TMP_Module_remove_class_variable_22.$$arity = 1); + + Opal.def(self, '$constants', TMP_Module_constants_23 = function $$constants(inherit) { + var self = this; + + + + if (inherit == null) { + inherit = true; + }; + return Opal.constants(self, inherit);; + }, TMP_Module_constants_23.$$arity = -1); + Opal.defs(self, '$constants', TMP_Module_constants_24 = function $$constants(inherit) { + var self = this; + + + ; + + if (inherit == null) { + var nesting = (self.$$nesting || []).concat(Opal.Object), + constant, constants = {}, + i, ii; + + for(i = 0, ii = nesting.length; i < ii; i++) { + for (constant in nesting[i].$$const) { + constants[constant] = true; + } + } + return Object.keys(constants); + } else { + return Opal.constants(self, inherit) + } + ; + }, TMP_Module_constants_24.$$arity = -1); + Opal.defs(self, '$nesting', TMP_Module_nesting_25 = function $$nesting() { + var self = this; + + return self.$$nesting || []; + }, TMP_Module_nesting_25.$$arity = 0); + + Opal.def(self, '$const_defined?', TMP_Module_const_defined$q_26 = function(name, inherit) { + var self = this; + + + + if (inherit == null) { + inherit = true; + }; + name = $$($nesting, 'Opal')['$const_name!'](name); + if ($truthy(name['$=~']($$$($$($nesting, 'Opal'), 'CONST_NAME_REGEXP')))) { + } else { + self.$raise($$($nesting, 'NameError').$new("" + "wrong constant name " + (name), name)) + }; + + var module, modules = [self], module_constants, i, ii; + + // Add up ancestors if inherit is true + if (inherit) { + modules = modules.concat(Opal.ancestors(self)); + + // Add Object's ancestors if it's a module – modules have no ancestors otherwise + if (self.$$is_module) { + modules = modules.concat([Opal.Object]).concat(Opal.ancestors(Opal.Object)); + } + } + + for (i = 0, ii = modules.length; i < ii; i++) { + module = modules[i]; + if (module.$$const[name] != null) { + return true; + } + } + + return false; + ; + }, TMP_Module_const_defined$q_26.$$arity = -2); + + Opal.def(self, '$const_get', TMP_Module_const_get_27 = function $$const_get(name, inherit) { + var TMP_28, self = this; + + + + if (inherit == null) { + inherit = true; + }; + name = $$($nesting, 'Opal')['$const_name!'](name); + + if (name.indexOf('::') === 0 && name !== '::'){ + name = name.slice(2); + } + ; + if ($truthy(name.indexOf('::') != -1 && name != '::')) { + return $send(name.$split("::"), 'inject', [self], (TMP_28 = function(o, c){var self = TMP_28.$$s || this; + + + + if (o == null) { + o = nil; + }; + + if (c == null) { + c = nil; + }; + return o.$const_get(c);}, TMP_28.$$s = self, TMP_28.$$arity = 2, TMP_28))}; + if ($truthy(name['$=~']($$$($$($nesting, 'Opal'), 'CONST_NAME_REGEXP')))) { + } else { + self.$raise($$($nesting, 'NameError').$new("" + "wrong constant name " + (name), name)) + }; + + if (inherit) { + return $$([self], name); + } else { + return Opal.const_get_local(self, name); + } + ; + }, TMP_Module_const_get_27.$$arity = -2); + + Opal.def(self, '$const_missing', TMP_Module_const_missing_29 = function $$const_missing(name) { + var self = this, full_const_name = nil; + + + + if (self.$$autoload) { + var file = self.$$autoload[name]; + + if (file) { + self.$require(file); + + return self.$const_get(name); + } + } + ; + full_const_name = (function() {if (self['$==']($$($nesting, 'Object'))) { + return name + } else { + return "" + (self) + "::" + (name) + }; return nil; })(); + return self.$raise($$($nesting, 'NameError').$new("" + "uninitialized constant " + (full_const_name), name)); + }, TMP_Module_const_missing_29.$$arity = 1); + + Opal.def(self, '$const_set', TMP_Module_const_set_30 = function $$const_set(name, value) { + var $a, self = this; + + + name = $$($nesting, 'Opal')['$const_name!'](name); + if ($truthy(($truthy($a = name['$!~']($$$($$($nesting, 'Opal'), 'CONST_NAME_REGEXP'))) ? $a : name['$start_with?']("::")))) { + self.$raise($$($nesting, 'NameError').$new("" + "wrong constant name " + (name), name))}; + Opal.const_set(self, name, value); + return value; + }, TMP_Module_const_set_30.$$arity = 2); + + Opal.def(self, '$public_constant', TMP_Module_public_constant_31 = function $$public_constant(const_name) { + var self = this; + + return nil + }, TMP_Module_public_constant_31.$$arity = 1); + + Opal.def(self, '$define_method', TMP_Module_define_method_32 = function $$define_method(name, method) { + var $iter = TMP_Module_define_method_32.$$p, block = $iter || nil, $a, TMP_33, self = this, $case = nil; + + if ($iter) TMP_Module_define_method_32.$$p = null; + + + if ($iter) TMP_Module_define_method_32.$$p = null;; + ; + if ($truthy(method === undefined && block === nil)) { + self.$raise($$($nesting, 'ArgumentError'), "tried to create a Proc object without a block")}; + block = ($truthy($a = block) ? $a : (function() {$case = method; + if ($$($nesting, 'Proc')['$===']($case)) {return method} + else if ($$($nesting, 'Method')['$===']($case)) {return method.$to_proc().$$unbound} + else if ($$($nesting, 'UnboundMethod')['$===']($case)) {return $lambda((TMP_33 = function($b){var self = TMP_33.$$s || this, $post_args, args, bound = nil; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + bound = method.$bind(self); + return $send(bound, 'call', Opal.to_a(args));}, TMP_33.$$s = self, TMP_33.$$arity = -1, TMP_33))} + else {return self.$raise($$($nesting, 'TypeError'), "" + "wrong argument type " + (block.$class()) + " (expected Proc/Method)")}})()); + + var id = '$' + name; + + block.$$jsid = name; + block.$$s = null; + block.$$def = block; + block.$$define_meth = true; + + Opal.defn(self, id, block); + + return name; + ; + }, TMP_Module_define_method_32.$$arity = -2); + + Opal.def(self, '$remove_method', TMP_Module_remove_method_34 = function $$remove_method($a) { + var $post_args, names, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + names = $post_args;; + + for (var i = 0, length = names.length; i < length; i++) { + Opal.rdef(self, "$" + names[i]); + } + ; + return self; + }, TMP_Module_remove_method_34.$$arity = -1); + + Opal.def(self, '$singleton_class?', TMP_Module_singleton_class$q_35 = function() { + var self = this; + + return !!self.$$is_singleton; + }, TMP_Module_singleton_class$q_35.$$arity = 0); + + Opal.def(self, '$include', TMP_Module_include_36 = function $$include($a) { + var $post_args, mods, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + mods = $post_args;; + + for (var i = mods.length - 1; i >= 0; i--) { + var mod = mods[i]; + + if (!mod.$$is_module) { + self.$raise($$($nesting, 'TypeError'), "" + "wrong argument type " + ((mod).$class()) + " (expected Module)"); + } + + (mod).$append_features(self); + (mod).$included(self); + } + ; + return self; + }, TMP_Module_include_36.$$arity = -1); + + Opal.def(self, '$included_modules', TMP_Module_included_modules_37 = function $$included_modules() { + var self = this; + + return Opal.included_modules(self); + }, TMP_Module_included_modules_37.$$arity = 0); + + Opal.def(self, '$include?', TMP_Module_include$q_38 = function(mod) { + var self = this; + + + if (!mod.$$is_module) { + self.$raise($$($nesting, 'TypeError'), "" + "wrong argument type " + ((mod).$class()) + " (expected Module)"); + } + + var i, ii, mod2, ancestors = Opal.ancestors(self); + + for (i = 0, ii = ancestors.length; i < ii; i++) { + mod2 = ancestors[i]; + if (mod2 === mod && mod2 !== self) { + return true; + } + } + + return false; + + }, TMP_Module_include$q_38.$$arity = 1); + + Opal.def(self, '$instance_method', TMP_Module_instance_method_39 = function $$instance_method(name) { + var self = this; + + + var meth = self.prototype['$' + name]; + + if (!meth || meth.$$stub) { + self.$raise($$($nesting, 'NameError').$new("" + "undefined method `" + (name) + "' for class `" + (self.$name()) + "'", name)); + } + + return $$($nesting, 'UnboundMethod').$new(self, meth.$$owner || self, meth, name); + + }, TMP_Module_instance_method_39.$$arity = 1); + + Opal.def(self, '$instance_methods', TMP_Module_instance_methods_40 = function $$instance_methods(include_super) { + var self = this; + + + + if (include_super == null) { + include_super = true; + }; + + if ($truthy(include_super)) { + return Opal.instance_methods(self); + } else { + return Opal.own_instance_methods(self); + } + ; + }, TMP_Module_instance_methods_40.$$arity = -1); + + Opal.def(self, '$included', TMP_Module_included_41 = function $$included(mod) { + var self = this; + + return nil + }, TMP_Module_included_41.$$arity = 1); + + Opal.def(self, '$extended', TMP_Module_extended_42 = function $$extended(mod) { + var self = this; + + return nil + }, TMP_Module_extended_42.$$arity = 1); + + Opal.def(self, '$extend_object', TMP_Module_extend_object_43 = function $$extend_object(object) { + var self = this; + + return nil + }, TMP_Module_extend_object_43.$$arity = 1); + + Opal.def(self, '$method_added', TMP_Module_method_added_44 = function $$method_added($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return nil; + }, TMP_Module_method_added_44.$$arity = -1); + + Opal.def(self, '$method_removed', TMP_Module_method_removed_45 = function $$method_removed($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return nil; + }, TMP_Module_method_removed_45.$$arity = -1); + + Opal.def(self, '$method_undefined', TMP_Module_method_undefined_46 = function $$method_undefined($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return nil; + }, TMP_Module_method_undefined_46.$$arity = -1); + + Opal.def(self, '$module_eval', TMP_Module_module_eval_47 = function $$module_eval($a) { + var $iter = TMP_Module_module_eval_47.$$p, block = $iter || nil, $post_args, args, $b, TMP_48, self = this, string = nil, file = nil, _lineno = nil, default_eval_options = nil, compiling_options = nil, compiled = nil; + + if ($iter) TMP_Module_module_eval_47.$$p = null; + + + if ($iter) TMP_Module_module_eval_47.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + if ($truthy(($truthy($b = block['$nil?']()) ? !!Opal.compile : $b))) { + + if ($truthy($range(1, 3, false)['$cover?'](args.$size()))) { + } else { + $$($nesting, 'Kernel').$raise($$($nesting, 'ArgumentError'), "wrong number of arguments (0 for 1..3)") + }; + $b = [].concat(Opal.to_a(args)), (string = ($b[0] == null ? nil : $b[0])), (file = ($b[1] == null ? nil : $b[1])), (_lineno = ($b[2] == null ? nil : $b[2])), $b; + default_eval_options = $hash2(["file", "eval"], {"file": ($truthy($b = file) ? $b : "(eval)"), "eval": true}); + compiling_options = Opal.hash({ arity_check: false }).$merge(default_eval_options); + compiled = $$($nesting, 'Opal').$compile(string, compiling_options); + block = $send($$($nesting, 'Kernel'), 'proc', [], (TMP_48 = function(){var self = TMP_48.$$s || this; + + + return (function(self) { + return eval(compiled); + })(self) + }, TMP_48.$$s = self, TMP_48.$$arity = 0, TMP_48)); + } else if ($truthy(args['$any?']())) { + $$($nesting, 'Kernel').$raise($$($nesting, 'ArgumentError'), "" + ("" + "wrong number of arguments (" + (args.$size()) + " for 0)") + "\n\n NOTE:If you want to enable passing a String argument please add \"require 'opal-parser'\" to your script\n")}; + + var old = block.$$s, + result; + + block.$$s = null; + result = block.apply(self, [self]); + block.$$s = old; + + return result; + ; + }, TMP_Module_module_eval_47.$$arity = -1); + Opal.alias(self, "class_eval", "module_eval"); + + Opal.def(self, '$module_exec', TMP_Module_module_exec_49 = function $$module_exec($a) { + var $iter = TMP_Module_module_exec_49.$$p, block = $iter || nil, $post_args, args, self = this; + + if ($iter) TMP_Module_module_exec_49.$$p = null; + + + if ($iter) TMP_Module_module_exec_49.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + + if (block === nil) { + self.$raise($$($nesting, 'LocalJumpError'), "no block given") + } + + var block_self = block.$$s, result; + + block.$$s = null; + result = block.apply(self, args); + block.$$s = block_self; + + return result; + ; + }, TMP_Module_module_exec_49.$$arity = -1); + Opal.alias(self, "class_exec", "module_exec"); + + Opal.def(self, '$method_defined?', TMP_Module_method_defined$q_50 = function(method) { + var self = this; + + + var body = self.prototype['$' + method]; + return (!!body) && !body.$$stub; + + }, TMP_Module_method_defined$q_50.$$arity = 1); + + Opal.def(self, '$module_function', TMP_Module_module_function_51 = function $$module_function($a) { + var $post_args, methods, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + methods = $post_args;; + + if (methods.length === 0) { + self.$$module_function = true; + } + else { + for (var i = 0, length = methods.length; i < length; i++) { + var meth = methods[i], + id = '$' + meth, + func = self.prototype[id]; + + Opal.defs(self, id, func); + } + } + + return self; + ; + }, TMP_Module_module_function_51.$$arity = -1); + + Opal.def(self, '$name', TMP_Module_name_52 = function $$name() { + var self = this; + + + if (self.$$full_name) { + return self.$$full_name; + } + + var result = [], base = self; + + while (base) { + // Give up if any of the ancestors is unnamed + if (base.$$name === nil || base.$$name == null) return nil; + + result.unshift(base.$$name); + + base = base.$$base_module; + + if (base === Opal.Object) { + break; + } + } + + if (result.length === 0) { + return nil; + } + + return self.$$full_name = result.join('::'); + + }, TMP_Module_name_52.$$arity = 0); + + Opal.def(self, '$prepend', TMP_Module_prepend_53 = function $$prepend($a) { + var $post_args, mods, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + mods = $post_args;; + + if (mods.length === 0) { + self.$raise($$($nesting, 'ArgumentError'), "wrong number of arguments (given 0, expected 1+)") + } + + for (var i = mods.length - 1; i >= 0; i--) { + var mod = mods[i]; + + if (!mod.$$is_module) { + self.$raise($$($nesting, 'TypeError'), "" + "wrong argument type " + ((mod).$class()) + " (expected Module)"); + } + + (mod).$prepend_features(self); + (mod).$prepended(self); + } + ; + return self; + }, TMP_Module_prepend_53.$$arity = -1); + + Opal.def(self, '$prepend_features', TMP_Module_prepend_features_54 = function $$prepend_features(prepender) { + var self = this; + + + + if (!self.$$is_module) { + self.$raise($$($nesting, 'TypeError'), "" + "wrong argument type " + (self.$class()) + " (expected Module)"); + } + + Opal.prepend_features(self, prepender) + ; + return self; + }, TMP_Module_prepend_features_54.$$arity = 1); + + Opal.def(self, '$prepended', TMP_Module_prepended_55 = function $$prepended(mod) { + var self = this; + + return nil + }, TMP_Module_prepended_55.$$arity = 1); + + Opal.def(self, '$remove_const', TMP_Module_remove_const_56 = function $$remove_const(name) { + var self = this; + + return Opal.const_remove(self, name); + }, TMP_Module_remove_const_56.$$arity = 1); + + Opal.def(self, '$to_s', TMP_Module_to_s_57 = function $$to_s() { + var $a, self = this; + + return ($truthy($a = Opal.Module.$name.call(self)) ? $a : "" + "#<" + (self.$$is_module ? 'Module' : 'Class') + ":0x" + (self.$__id__().$to_s(16)) + ">") + }, TMP_Module_to_s_57.$$arity = 0); + + Opal.def(self, '$undef_method', TMP_Module_undef_method_58 = function $$undef_method($a) { + var $post_args, names, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + names = $post_args;; + + for (var i = 0, length = names.length; i < length; i++) { + Opal.udef(self, "$" + names[i]); + } + ; + return self; + }, TMP_Module_undef_method_58.$$arity = -1); + + Opal.def(self, '$instance_variables', TMP_Module_instance_variables_59 = function $$instance_variables() { + var self = this, consts = nil; + + + consts = (Opal.Module.$$nesting = $nesting, self.$constants()); + + var result = []; + + for (var name in self) { + if (self.hasOwnProperty(name) && name.charAt(0) !== '$' && name !== 'constructor' && !consts['$include?'](name)) { + result.push('@' + name); + } + } + + return result; + ; + }, TMP_Module_instance_variables_59.$$arity = 0); + + Opal.def(self, '$dup', TMP_Module_dup_60 = function $$dup() { + var $iter = TMP_Module_dup_60.$$p, $yield = $iter || nil, self = this, copy = nil, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_Module_dup_60.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + + copy = $send(self, Opal.find_super_dispatcher(self, 'dup', TMP_Module_dup_60, false), $zuper, $iter); + copy.$copy_class_variables(self); + copy.$copy_constants(self); + return copy; + }, TMP_Module_dup_60.$$arity = 0); + + Opal.def(self, '$copy_class_variables', TMP_Module_copy_class_variables_61 = function $$copy_class_variables(other) { + var self = this; + + + for (var name in other.$$cvars) { + self.$$cvars[name] = other.$$cvars[name]; + } + + }, TMP_Module_copy_class_variables_61.$$arity = 1); + return (Opal.def(self, '$copy_constants', TMP_Module_copy_constants_62 = function $$copy_constants(other) { + var self = this; + + + var name, other_constants = other.$$const; + + for (name in other_constants) { + Opal.const_set(self, name, other_constants[name]); + } + + }, TMP_Module_copy_constants_62.$$arity = 1), nil) && 'copy_constants'; + })($nesting[0], null, $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/class"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $send = Opal.send; + + Opal.add_stubs(['$require', '$class_eval', '$to_proc', '$initialize_copy', '$allocate', '$name', '$to_s']); + + self.$require("corelib/module"); + return (function($base, $super, $parent_nesting) { + function $Class(){}; + var self = $Class = $klass($base, $super, 'Class', $Class); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Class_new_1, TMP_Class_allocate_2, TMP_Class_inherited_3, TMP_Class_initialize_dup_4, TMP_Class_new_5, TMP_Class_superclass_6, TMP_Class_to_s_7; + + + Opal.defs(self, '$new', TMP_Class_new_1 = function(superclass) { + var $iter = TMP_Class_new_1.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Class_new_1.$$p = null; + + + if ($iter) TMP_Class_new_1.$$p = null;; + + if (superclass == null) { + superclass = $$($nesting, 'Object'); + }; + + if (!superclass.$$is_class) { + throw Opal.TypeError.$new("superclass must be a Class"); + } + + var klass = Opal.allocate_class(nil, superclass, function(){}); + superclass.$inherited(klass); + (function() {if ((block !== nil)) { + return $send((klass), 'class_eval', [], block.$to_proc()) + } else { + return nil + }; return nil; })() + return klass; + ; + }, TMP_Class_new_1.$$arity = -1); + + Opal.def(self, '$allocate', TMP_Class_allocate_2 = function $$allocate() { + var self = this; + + + var obj = new self(); + obj.$$id = Opal.uid(); + return obj; + + }, TMP_Class_allocate_2.$$arity = 0); + + Opal.def(self, '$inherited', TMP_Class_inherited_3 = function $$inherited(cls) { + var self = this; + + return nil + }, TMP_Class_inherited_3.$$arity = 1); + + Opal.def(self, '$initialize_dup', TMP_Class_initialize_dup_4 = function $$initialize_dup(original) { + var self = this; + + + self.$initialize_copy(original); + + self.$$name = null; + self.$$full_name = null; + ; + }, TMP_Class_initialize_dup_4.$$arity = 1); + + Opal.def(self, '$new', TMP_Class_new_5 = function($a) { + var $iter = TMP_Class_new_5.$$p, block = $iter || nil, $post_args, args, self = this; + + if ($iter) TMP_Class_new_5.$$p = null; + + + if ($iter) TMP_Class_new_5.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + + var object = self.$allocate(); + Opal.send(object, object.$initialize, args, block); + return object; + ; + }, TMP_Class_new_5.$$arity = -1); + + Opal.def(self, '$superclass', TMP_Class_superclass_6 = function $$superclass() { + var self = this; + + return self.$$super || nil; + }, TMP_Class_superclass_6.$$arity = 0); + return (Opal.def(self, '$to_s', TMP_Class_to_s_7 = function $$to_s() { + var $iter = TMP_Class_to_s_7.$$p, $yield = $iter || nil, self = this; + + if ($iter) TMP_Class_to_s_7.$$p = null; + + var singleton_of = self.$$singleton_of; + + if (singleton_of && (singleton_of.$$is_a_module)) { + return "" + "#"; + } + else if (singleton_of) { + // a singleton class created from an object + return "" + "#>"; + } + return $send(self, Opal.find_super_dispatcher(self, 'to_s', TMP_Class_to_s_7, false), [], null); + + }, TMP_Class_to_s_7.$$arity = 0), nil) && 'to_s'; + })($nesting[0], null, $nesting); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/basic_object"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $truthy = Opal.truthy, $range = Opal.range, $hash2 = Opal.hash2, $send = Opal.send; + + Opal.add_stubs(['$==', '$!', '$nil?', '$cover?', '$size', '$raise', '$merge', '$compile', '$proc', '$any?', '$inspect', '$new']); + return (function($base, $super, $parent_nesting) { + function $BasicObject(){}; + var self = $BasicObject = $klass($base, $super, 'BasicObject', $BasicObject); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_BasicObject_initialize_1, TMP_BasicObject_$eq$eq_2, TMP_BasicObject_eql$q_3, TMP_BasicObject___id___4, TMP_BasicObject___send___5, TMP_BasicObject_$B_6, TMP_BasicObject_$B$eq_7, TMP_BasicObject_instance_eval_8, TMP_BasicObject_instance_exec_10, TMP_BasicObject_singleton_method_added_11, TMP_BasicObject_singleton_method_removed_12, TMP_BasicObject_singleton_method_undefined_13, TMP_BasicObject_class_14, TMP_BasicObject_method_missing_15; + + + + Opal.def(self, '$initialize', TMP_BasicObject_initialize_1 = function $$initialize($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return nil; + }, TMP_BasicObject_initialize_1.$$arity = -1); + + Opal.def(self, '$==', TMP_BasicObject_$eq$eq_2 = function(other) { + var self = this; + + return self === other; + }, TMP_BasicObject_$eq$eq_2.$$arity = 1); + + Opal.def(self, '$eql?', TMP_BasicObject_eql$q_3 = function(other) { + var self = this; + + return self['$=='](other) + }, TMP_BasicObject_eql$q_3.$$arity = 1); + Opal.alias(self, "equal?", "=="); + + Opal.def(self, '$__id__', TMP_BasicObject___id___4 = function $$__id__() { + var self = this; + + + if (self.$$id != null) { + return self.$$id; + } + Opal.defineProperty(self, '$$id', Opal.uid()); + return self.$$id; + + }, TMP_BasicObject___id___4.$$arity = 0); + + Opal.def(self, '$__send__', TMP_BasicObject___send___5 = function $$__send__(symbol, $a) { + var $iter = TMP_BasicObject___send___5.$$p, block = $iter || nil, $post_args, args, self = this; + + if ($iter) TMP_BasicObject___send___5.$$p = null; + + + if ($iter) TMP_BasicObject___send___5.$$p = null;; + + $post_args = Opal.slice.call(arguments, 1, arguments.length); + + args = $post_args;; + + var func = self['$' + symbol] + + if (func) { + if (block !== nil) { + func.$$p = block; + } + + return func.apply(self, args); + } + + if (block !== nil) { + self.$method_missing.$$p = block; + } + + return self.$method_missing.apply(self, [symbol].concat(args)); + ; + }, TMP_BasicObject___send___5.$$arity = -2); + + Opal.def(self, '$!', TMP_BasicObject_$B_6 = function() { + var self = this; + + return false + }, TMP_BasicObject_$B_6.$$arity = 0); + + Opal.def(self, '$!=', TMP_BasicObject_$B$eq_7 = function(other) { + var self = this; + + return self['$=='](other)['$!']() + }, TMP_BasicObject_$B$eq_7.$$arity = 1); + + Opal.def(self, '$instance_eval', TMP_BasicObject_instance_eval_8 = function $$instance_eval($a) { + var $iter = TMP_BasicObject_instance_eval_8.$$p, block = $iter || nil, $post_args, args, $b, TMP_9, self = this, string = nil, file = nil, _lineno = nil, default_eval_options = nil, compiling_options = nil, compiled = nil; + + if ($iter) TMP_BasicObject_instance_eval_8.$$p = null; + + + if ($iter) TMP_BasicObject_instance_eval_8.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + if ($truthy(($truthy($b = block['$nil?']()) ? !!Opal.compile : $b))) { + + if ($truthy($range(1, 3, false)['$cover?'](args.$size()))) { + } else { + $$$('::', 'Kernel').$raise($$$('::', 'ArgumentError'), "wrong number of arguments (0 for 1..3)") + }; + $b = [].concat(Opal.to_a(args)), (string = ($b[0] == null ? nil : $b[0])), (file = ($b[1] == null ? nil : $b[1])), (_lineno = ($b[2] == null ? nil : $b[2])), $b; + default_eval_options = $hash2(["file", "eval"], {"file": ($truthy($b = file) ? $b : "(eval)"), "eval": true}); + compiling_options = Opal.hash({ arity_check: false }).$merge(default_eval_options); + compiled = $$$('::', 'Opal').$compile(string, compiling_options); + block = $send($$$('::', 'Kernel'), 'proc', [], (TMP_9 = function(){var self = TMP_9.$$s || this; + + + return (function(self) { + return eval(compiled); + })(self) + }, TMP_9.$$s = self, TMP_9.$$arity = 0, TMP_9)); + } else if ($truthy(args['$any?']())) { + $$$('::', 'Kernel').$raise($$$('::', 'ArgumentError'), "" + "wrong number of arguments (" + (args.$size()) + " for 0)")}; + + var old = block.$$s, + result; + + block.$$s = null; + + // Need to pass $$eval so that method definitions know if this is + // being done on a class/module. Cannot be compiler driven since + // send(:instance_eval) needs to work. + if (self.$$is_a_module) { + self.$$eval = true; + try { + result = block.call(self, self); + } + finally { + self.$$eval = false; + } + } + else { + result = block.call(self, self); + } + + block.$$s = old; + + return result; + ; + }, TMP_BasicObject_instance_eval_8.$$arity = -1); + + Opal.def(self, '$instance_exec', TMP_BasicObject_instance_exec_10 = function $$instance_exec($a) { + var $iter = TMP_BasicObject_instance_exec_10.$$p, block = $iter || nil, $post_args, args, self = this; + + if ($iter) TMP_BasicObject_instance_exec_10.$$p = null; + + + if ($iter) TMP_BasicObject_instance_exec_10.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + if ($truthy(block)) { + } else { + $$$('::', 'Kernel').$raise($$$('::', 'ArgumentError'), "no block given") + }; + + var block_self = block.$$s, + result; + + block.$$s = null; + + if (self.$$is_a_module) { + self.$$eval = true; + try { + result = block.apply(self, args); + } + finally { + self.$$eval = false; + } + } + else { + result = block.apply(self, args); + } + + block.$$s = block_self; + + return result; + ; + }, TMP_BasicObject_instance_exec_10.$$arity = -1); + + Opal.def(self, '$singleton_method_added', TMP_BasicObject_singleton_method_added_11 = function $$singleton_method_added($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return nil; + }, TMP_BasicObject_singleton_method_added_11.$$arity = -1); + + Opal.def(self, '$singleton_method_removed', TMP_BasicObject_singleton_method_removed_12 = function $$singleton_method_removed($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return nil; + }, TMP_BasicObject_singleton_method_removed_12.$$arity = -1); + + Opal.def(self, '$singleton_method_undefined', TMP_BasicObject_singleton_method_undefined_13 = function $$singleton_method_undefined($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return nil; + }, TMP_BasicObject_singleton_method_undefined_13.$$arity = -1); + + Opal.def(self, '$class', TMP_BasicObject_class_14 = function() { + var self = this; + + return self.$$class; + }, TMP_BasicObject_class_14.$$arity = 0); + return (Opal.def(self, '$method_missing', TMP_BasicObject_method_missing_15 = function $$method_missing(symbol, $a) { + var $iter = TMP_BasicObject_method_missing_15.$$p, block = $iter || nil, $post_args, args, self = this, message = nil; + + if ($iter) TMP_BasicObject_method_missing_15.$$p = null; + + + if ($iter) TMP_BasicObject_method_missing_15.$$p = null;; + + $post_args = Opal.slice.call(arguments, 1, arguments.length); + + args = $post_args;; + message = (function() {if ($truthy(self.$inspect && !self.$inspect.$$stub)) { + return "" + "undefined method `" + (symbol) + "' for " + (self.$inspect()) + ":" + (self.$$class) + } else { + return "" + "undefined method `" + (symbol) + "' for " + (self.$$class) + }; return nil; })(); + return $$$('::', 'Kernel').$raise($$$('::', 'NoMethodError').$new(message, symbol)); + }, TMP_BasicObject_method_missing_15.$$arity = -2), nil) && 'method_missing'; + })($nesting[0], null, $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/kernel"] = function(Opal) { + function $rb_le(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs <= rhs : lhs['$<='](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $truthy = Opal.truthy, $gvars = Opal.gvars, $hash2 = Opal.hash2, $send = Opal.send, $klass = Opal.klass; + + Opal.add_stubs(['$raise', '$new', '$inspect', '$!', '$=~', '$==', '$object_id', '$class', '$coerce_to?', '$<<', '$allocate', '$copy_instance_variables', '$copy_singleton_methods', '$initialize_clone', '$initialize_copy', '$define_method', '$singleton_class', '$to_proc', '$initialize_dup', '$for', '$empty?', '$pop', '$call', '$coerce_to', '$append_features', '$extend_object', '$extended', '$length', '$respond_to?', '$[]', '$nil?', '$to_a', '$to_int', '$fetch', '$Integer', '$Float', '$to_ary', '$to_str', '$to_s', '$__id__', '$instance_variable_name!', '$coerce_to!', '$===', '$enum_for', '$result', '$any?', '$print', '$format', '$puts', '$each', '$<=', '$exception', '$is_a?', '$rand', '$respond_to_missing?', '$try_convert!', '$expand_path', '$join', '$start_with?', '$new_seed', '$srand', '$sym', '$arg', '$open', '$include']); + + (function($base, $parent_nesting) { + function $Kernel() {}; + var self = $Kernel = $module($base, 'Kernel', $Kernel); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Kernel_method_missing_1, TMP_Kernel_$eq$_2, TMP_Kernel_$B$_3, TMP_Kernel_$eq$eq$eq_4, TMP_Kernel_$lt$eq$gt_5, TMP_Kernel_method_6, TMP_Kernel_methods_7, TMP_Kernel_public_methods_8, TMP_Kernel_Array_9, TMP_Kernel_at_exit_10, TMP_Kernel_caller_11, TMP_Kernel_class_12, TMP_Kernel_copy_instance_variables_13, TMP_Kernel_copy_singleton_methods_14, TMP_Kernel_clone_15, TMP_Kernel_initialize_clone_16, TMP_Kernel_define_singleton_method_17, TMP_Kernel_dup_18, TMP_Kernel_initialize_dup_19, TMP_Kernel_enum_for_20, TMP_Kernel_equal$q_21, TMP_Kernel_exit_22, TMP_Kernel_extend_23, TMP_Kernel_format_24, TMP_Kernel_hash_25, TMP_Kernel_initialize_copy_26, TMP_Kernel_inspect_27, TMP_Kernel_instance_of$q_28, TMP_Kernel_instance_variable_defined$q_29, TMP_Kernel_instance_variable_get_30, TMP_Kernel_instance_variable_set_31, TMP_Kernel_remove_instance_variable_32, TMP_Kernel_instance_variables_33, TMP_Kernel_Integer_34, TMP_Kernel_Float_35, TMP_Kernel_Hash_36, TMP_Kernel_is_a$q_37, TMP_Kernel_itself_38, TMP_Kernel_lambda_39, TMP_Kernel_load_40, TMP_Kernel_loop_41, TMP_Kernel_nil$q_43, TMP_Kernel_printf_44, TMP_Kernel_proc_45, TMP_Kernel_puts_46, TMP_Kernel_p_47, TMP_Kernel_print_49, TMP_Kernel_warn_50, TMP_Kernel_raise_51, TMP_Kernel_rand_52, TMP_Kernel_respond_to$q_53, TMP_Kernel_respond_to_missing$q_54, TMP_Kernel_require_55, TMP_Kernel_require_relative_56, TMP_Kernel_require_tree_57, TMP_Kernel_singleton_class_58, TMP_Kernel_sleep_59, TMP_Kernel_srand_60, TMP_Kernel_String_61, TMP_Kernel_tap_62, TMP_Kernel_to_proc_63, TMP_Kernel_to_s_64, TMP_Kernel_catch_65, TMP_Kernel_throw_66, TMP_Kernel_open_67, TMP_Kernel_yield_self_68; + + + + Opal.def(self, '$method_missing', TMP_Kernel_method_missing_1 = function $$method_missing(symbol, $a) { + var $iter = TMP_Kernel_method_missing_1.$$p, block = $iter || nil, $post_args, args, self = this; + + if ($iter) TMP_Kernel_method_missing_1.$$p = null; + + + if ($iter) TMP_Kernel_method_missing_1.$$p = null;; + + $post_args = Opal.slice.call(arguments, 1, arguments.length); + + args = $post_args;; + return self.$raise($$($nesting, 'NoMethodError').$new("" + "undefined method `" + (symbol) + "' for " + (self.$inspect()), symbol, args)); + }, TMP_Kernel_method_missing_1.$$arity = -2); + + Opal.def(self, '$=~', TMP_Kernel_$eq$_2 = function(obj) { + var self = this; + + return false + }, TMP_Kernel_$eq$_2.$$arity = 1); + + Opal.def(self, '$!~', TMP_Kernel_$B$_3 = function(obj) { + var self = this; + + return self['$=~'](obj)['$!']() + }, TMP_Kernel_$B$_3.$$arity = 1); + + Opal.def(self, '$===', TMP_Kernel_$eq$eq$eq_4 = function(other) { + var $a, self = this; + + return ($truthy($a = self.$object_id()['$=='](other.$object_id())) ? $a : self['$=='](other)) + }, TMP_Kernel_$eq$eq$eq_4.$$arity = 1); + + Opal.def(self, '$<=>', TMP_Kernel_$lt$eq$gt_5 = function(other) { + var self = this; + + + // set guard for infinite recursion + self.$$comparable = true; + + var x = self['$=='](other); + + if (x && x !== nil) { + return 0; + } + + return nil; + + }, TMP_Kernel_$lt$eq$gt_5.$$arity = 1); + + Opal.def(self, '$method', TMP_Kernel_method_6 = function $$method(name) { + var self = this; + + + var meth = self['$' + name]; + + if (!meth || meth.$$stub) { + self.$raise($$($nesting, 'NameError').$new("" + "undefined method `" + (name) + "' for class `" + (self.$class()) + "'", name)); + } + + return $$($nesting, 'Method').$new(self, meth.$$owner || self.$class(), meth, name); + + }, TMP_Kernel_method_6.$$arity = 1); + + Opal.def(self, '$methods', TMP_Kernel_methods_7 = function $$methods(all) { + var self = this; + + + + if (all == null) { + all = true; + }; + + if ($truthy(all)) { + return Opal.methods(self); + } else { + return Opal.own_methods(self); + } + ; + }, TMP_Kernel_methods_7.$$arity = -1); + + Opal.def(self, '$public_methods', TMP_Kernel_public_methods_8 = function $$public_methods(all) { + var self = this; + + + + if (all == null) { + all = true; + }; + + if ($truthy(all)) { + return Opal.methods(self); + } else { + return Opal.receiver_methods(self); + } + ; + }, TMP_Kernel_public_methods_8.$$arity = -1); + + Opal.def(self, '$Array', TMP_Kernel_Array_9 = function $$Array(object) { + var self = this; + + + var coerced; + + if (object === nil) { + return []; + } + + if (object.$$is_array) { + return object; + } + + coerced = $$($nesting, 'Opal')['$coerce_to?'](object, $$($nesting, 'Array'), "to_ary"); + if (coerced !== nil) { return coerced; } + + coerced = $$($nesting, 'Opal')['$coerce_to?'](object, $$($nesting, 'Array'), "to_a"); + if (coerced !== nil) { return coerced; } + + return [object]; + + }, TMP_Kernel_Array_9.$$arity = 1); + + Opal.def(self, '$at_exit', TMP_Kernel_at_exit_10 = function $$at_exit() { + var $iter = TMP_Kernel_at_exit_10.$$p, block = $iter || nil, $a, self = this; + if ($gvars.__at_exit__ == null) $gvars.__at_exit__ = nil; + + if ($iter) TMP_Kernel_at_exit_10.$$p = null; + + + if ($iter) TMP_Kernel_at_exit_10.$$p = null;; + $gvars.__at_exit__ = ($truthy($a = $gvars.__at_exit__) ? $a : []); + return $gvars.__at_exit__['$<<'](block); + }, TMP_Kernel_at_exit_10.$$arity = 0); + + Opal.def(self, '$caller', TMP_Kernel_caller_11 = function $$caller($a) { + var $post_args, args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + return []; + }, TMP_Kernel_caller_11.$$arity = -1); + + Opal.def(self, '$class', TMP_Kernel_class_12 = function() { + var self = this; + + return self.$$class; + }, TMP_Kernel_class_12.$$arity = 0); + + Opal.def(self, '$copy_instance_variables', TMP_Kernel_copy_instance_variables_13 = function $$copy_instance_variables(other) { + var self = this; + + + var keys = Object.keys(other), i, ii, name; + for (i = 0, ii = keys.length; i < ii; i++) { + name = keys[i]; + if (name.charAt(0) !== '$' && other.hasOwnProperty(name)) { + self[name] = other[name]; + } + } + + }, TMP_Kernel_copy_instance_variables_13.$$arity = 1); + + Opal.def(self, '$copy_singleton_methods', TMP_Kernel_copy_singleton_methods_14 = function $$copy_singleton_methods(other) { + var self = this; + + + var i, name, names, length; + + if (other.hasOwnProperty('$$meta')) { + var other_singleton_class = Opal.get_singleton_class(other); + var self_singleton_class = Opal.get_singleton_class(self); + names = Object.getOwnPropertyNames(other_singleton_class.prototype); + + for (i = 0, length = names.length; i < length; i++) { + name = names[i]; + if (Opal.is_method(name)) { + self_singleton_class.prototype[name] = other_singleton_class.prototype[name]; + } + } + + self_singleton_class.$$const = Object.assign({}, other_singleton_class.$$const); + Object.setPrototypeOf( + self_singleton_class.prototype, + Object.getPrototypeOf(other_singleton_class.prototype) + ); + } + + for (i = 0, names = Object.getOwnPropertyNames(other), length = names.length; i < length; i++) { + name = names[i]; + if (name.charAt(0) === '$' && name.charAt(1) !== '$' && other.hasOwnProperty(name)) { + self[name] = other[name]; + } + } + + }, TMP_Kernel_copy_singleton_methods_14.$$arity = 1); + + Opal.def(self, '$clone', TMP_Kernel_clone_15 = function $$clone($kwargs) { + var freeze, self = this, copy = nil; + + + + if ($kwargs == null) { + $kwargs = $hash2([], {}); + } else if (!$kwargs.$$is_hash) { + throw Opal.ArgumentError.$new('expected kwargs'); + }; + + freeze = $kwargs.$$smap["freeze"]; + if (freeze == null) { + freeze = true + }; + copy = self.$class().$allocate(); + copy.$copy_instance_variables(self); + copy.$copy_singleton_methods(self); + copy.$initialize_clone(self); + return copy; + }, TMP_Kernel_clone_15.$$arity = -1); + + Opal.def(self, '$initialize_clone', TMP_Kernel_initialize_clone_16 = function $$initialize_clone(other) { + var self = this; + + return self.$initialize_copy(other) + }, TMP_Kernel_initialize_clone_16.$$arity = 1); + + Opal.def(self, '$define_singleton_method', TMP_Kernel_define_singleton_method_17 = function $$define_singleton_method(name, method) { + var $iter = TMP_Kernel_define_singleton_method_17.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Kernel_define_singleton_method_17.$$p = null; + + + if ($iter) TMP_Kernel_define_singleton_method_17.$$p = null;; + ; + return $send(self.$singleton_class(), 'define_method', [name, method], block.$to_proc()); + }, TMP_Kernel_define_singleton_method_17.$$arity = -2); + + Opal.def(self, '$dup', TMP_Kernel_dup_18 = function $$dup() { + var self = this, copy = nil; + + + copy = self.$class().$allocate(); + copy.$copy_instance_variables(self); + copy.$initialize_dup(self); + return copy; + }, TMP_Kernel_dup_18.$$arity = 0); + + Opal.def(self, '$initialize_dup', TMP_Kernel_initialize_dup_19 = function $$initialize_dup(other) { + var self = this; + + return self.$initialize_copy(other) + }, TMP_Kernel_initialize_dup_19.$$arity = 1); + + Opal.def(self, '$enum_for', TMP_Kernel_enum_for_20 = function $$enum_for($a, $b) { + var $iter = TMP_Kernel_enum_for_20.$$p, block = $iter || nil, $post_args, method, args, self = this; + + if ($iter) TMP_Kernel_enum_for_20.$$p = null; + + + if ($iter) TMP_Kernel_enum_for_20.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + if ($post_args.length > 0) { + method = $post_args[0]; + $post_args.splice(0, 1); + } + if (method == null) { + method = "each"; + }; + + args = $post_args;; + return $send($$($nesting, 'Enumerator'), 'for', [self, method].concat(Opal.to_a(args)), block.$to_proc()); + }, TMP_Kernel_enum_for_20.$$arity = -1); + Opal.alias(self, "to_enum", "enum_for"); + + Opal.def(self, '$equal?', TMP_Kernel_equal$q_21 = function(other) { + var self = this; + + return self === other; + }, TMP_Kernel_equal$q_21.$$arity = 1); + + Opal.def(self, '$exit', TMP_Kernel_exit_22 = function $$exit(status) { + var $a, self = this, block = nil; + if ($gvars.__at_exit__ == null) $gvars.__at_exit__ = nil; + + + + if (status == null) { + status = true; + }; + $gvars.__at_exit__ = ($truthy($a = $gvars.__at_exit__) ? $a : []); + while (!($truthy($gvars.__at_exit__['$empty?']()))) { + + block = $gvars.__at_exit__.$pop(); + block.$call(); + }; + + if (status.$$is_boolean) { + status = status ? 0 : 1; + } else { + status = $$($nesting, 'Opal').$coerce_to(status, $$($nesting, 'Integer'), "to_int") + } + + Opal.exit(status); + ; + return nil; + }, TMP_Kernel_exit_22.$$arity = -1); + + Opal.def(self, '$extend', TMP_Kernel_extend_23 = function $$extend($a) { + var $post_args, mods, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + mods = $post_args;; + + var singleton = self.$singleton_class(); + + for (var i = mods.length - 1; i >= 0; i--) { + var mod = mods[i]; + + if (!mod.$$is_module) { + self.$raise($$($nesting, 'TypeError'), "" + "wrong argument type " + ((mod).$class()) + " (expected Module)"); + } + + (mod).$append_features(singleton); + (mod).$extend_object(self); + (mod).$extended(self); + } + ; + return self; + }, TMP_Kernel_extend_23.$$arity = -1); + + Opal.def(self, '$format', TMP_Kernel_format_24 = function $$format(format_string, $a) { + var $post_args, args, $b, self = this, ary = nil; + if ($gvars.DEBUG == null) $gvars.DEBUG = nil; + + + + $post_args = Opal.slice.call(arguments, 1, arguments.length); + + args = $post_args;; + if ($truthy((($b = args.$length()['$=='](1)) ? args['$[]'](0)['$respond_to?']("to_ary") : args.$length()['$=='](1)))) { + + ary = $$($nesting, 'Opal')['$coerce_to?'](args['$[]'](0), $$($nesting, 'Array'), "to_ary"); + if ($truthy(ary['$nil?']())) { + } else { + args = ary.$to_a() + };}; + + var result = '', + //used for slicing: + begin_slice = 0, + end_slice, + //used for iterating over the format string: + i, + len = format_string.length, + //used for processing field values: + arg, + str, + //used for processing %g and %G fields: + exponent, + //used for keeping track of width and precision: + width, + precision, + //used for holding temporary values: + tmp_num, + //used for processing %{} and %<> fileds: + hash_parameter_key, + closing_brace_char, + //used for processing %b, %B, %o, %x, and %X fields: + base_number, + base_prefix, + base_neg_zero_regex, + base_neg_zero_digit, + //used for processing arguments: + next_arg, + seq_arg_num = 1, + pos_arg_num = 0, + //used for keeping track of flags: + flags, + FNONE = 0, + FSHARP = 1, + FMINUS = 2, + FPLUS = 4, + FZERO = 8, + FSPACE = 16, + FWIDTH = 32, + FPREC = 64, + FPREC0 = 128; + + function CHECK_FOR_FLAGS() { + if (flags&FWIDTH) { self.$raise($$($nesting, 'ArgumentError'), "flag after width") } + if (flags&FPREC0) { self.$raise($$($nesting, 'ArgumentError'), "flag after precision") } + } + + function CHECK_FOR_WIDTH() { + if (flags&FWIDTH) { self.$raise($$($nesting, 'ArgumentError'), "width given twice") } + if (flags&FPREC0) { self.$raise($$($nesting, 'ArgumentError'), "width after precision") } + } + + function GET_NTH_ARG(num) { + if (num >= args.length) { self.$raise($$($nesting, 'ArgumentError'), "too few arguments") } + return args[num]; + } + + function GET_NEXT_ARG() { + switch (pos_arg_num) { + case -1: self.$raise($$($nesting, 'ArgumentError'), "" + "unnumbered(" + (seq_arg_num) + ") mixed with numbered") + case -2: self.$raise($$($nesting, 'ArgumentError'), "" + "unnumbered(" + (seq_arg_num) + ") mixed with named") + } + pos_arg_num = seq_arg_num++; + return GET_NTH_ARG(pos_arg_num - 1); + } + + function GET_POS_ARG(num) { + if (pos_arg_num > 0) { + self.$raise($$($nesting, 'ArgumentError'), "" + "numbered(" + (num) + ") after unnumbered(" + (pos_arg_num) + ")") + } + if (pos_arg_num === -2) { + self.$raise($$($nesting, 'ArgumentError'), "" + "numbered(" + (num) + ") after named") + } + if (num < 1) { + self.$raise($$($nesting, 'ArgumentError'), "" + "invalid index - " + (num) + "$") + } + pos_arg_num = -1; + return GET_NTH_ARG(num - 1); + } + + function GET_ARG() { + return (next_arg === undefined ? GET_NEXT_ARG() : next_arg); + } + + function READ_NUM(label) { + var num, str = ''; + for (;; i++) { + if (i === len) { + self.$raise($$($nesting, 'ArgumentError'), "malformed format string - %*[0-9]") + } + if (format_string.charCodeAt(i) < 48 || format_string.charCodeAt(i) > 57) { + i--; + num = parseInt(str, 10) || 0; + if (num > 2147483647) { + self.$raise($$($nesting, 'ArgumentError'), "" + (label) + " too big") + } + return num; + } + str += format_string.charAt(i); + } + } + + function READ_NUM_AFTER_ASTER(label) { + var arg, num = READ_NUM(label); + if (format_string.charAt(i + 1) === '$') { + i++; + arg = GET_POS_ARG(num); + } else { + arg = GET_NEXT_ARG(); + } + return (arg).$to_int(); + } + + for (i = format_string.indexOf('%'); i !== -1; i = format_string.indexOf('%', i)) { + str = undefined; + + flags = FNONE; + width = -1; + precision = -1; + next_arg = undefined; + + end_slice = i; + + i++; + + switch (format_string.charAt(i)) { + case '%': + begin_slice = i; + case '': + case '\n': + case '\0': + i++; + continue; + } + + format_sequence: for (; i < len; i++) { + switch (format_string.charAt(i)) { + + case ' ': + CHECK_FOR_FLAGS(); + flags |= FSPACE; + continue format_sequence; + + case '#': + CHECK_FOR_FLAGS(); + flags |= FSHARP; + continue format_sequence; + + case '+': + CHECK_FOR_FLAGS(); + flags |= FPLUS; + continue format_sequence; + + case '-': + CHECK_FOR_FLAGS(); + flags |= FMINUS; + continue format_sequence; + + case '0': + CHECK_FOR_FLAGS(); + flags |= FZERO; + continue format_sequence; + + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + tmp_num = READ_NUM('width'); + if (format_string.charAt(i + 1) === '$') { + if (i + 2 === len) { + str = '%'; + i++; + break format_sequence; + } + if (next_arg !== undefined) { + self.$raise($$($nesting, 'ArgumentError'), "" + "value given twice - %" + (tmp_num) + "$") + } + next_arg = GET_POS_ARG(tmp_num); + i++; + } else { + CHECK_FOR_WIDTH(); + flags |= FWIDTH; + width = tmp_num; + } + continue format_sequence; + + case '<': + case '\{': + closing_brace_char = (format_string.charAt(i) === '<' ? '>' : '\}'); + hash_parameter_key = ''; + + i++; + + for (;; i++) { + if (i === len) { + self.$raise($$($nesting, 'ArgumentError'), "malformed name - unmatched parenthesis") + } + if (format_string.charAt(i) === closing_brace_char) { + + if (pos_arg_num > 0) { + self.$raise($$($nesting, 'ArgumentError'), "" + "named " + (hash_parameter_key) + " after unnumbered(" + (pos_arg_num) + ")") + } + if (pos_arg_num === -1) { + self.$raise($$($nesting, 'ArgumentError'), "" + "named " + (hash_parameter_key) + " after numbered") + } + pos_arg_num = -2; + + if (args[0] === undefined || !args[0].$$is_hash) { + self.$raise($$($nesting, 'ArgumentError'), "one hash required") + } + + next_arg = (args[0]).$fetch(hash_parameter_key); + + if (closing_brace_char === '>') { + continue format_sequence; + } else { + str = next_arg.toString(); + if (precision !== -1) { str = str.slice(0, precision); } + if (flags&FMINUS) { + while (str.length < width) { str = str + ' '; } + } else { + while (str.length < width) { str = ' ' + str; } + } + break format_sequence; + } + } + hash_parameter_key += format_string.charAt(i); + } + + case '*': + i++; + CHECK_FOR_WIDTH(); + flags |= FWIDTH; + width = READ_NUM_AFTER_ASTER('width'); + if (width < 0) { + flags |= FMINUS; + width = -width; + } + continue format_sequence; + + case '.': + if (flags&FPREC0) { + self.$raise($$($nesting, 'ArgumentError'), "precision given twice") + } + flags |= FPREC|FPREC0; + precision = 0; + i++; + if (format_string.charAt(i) === '*') { + i++; + precision = READ_NUM_AFTER_ASTER('precision'); + if (precision < 0) { + flags &= ~FPREC; + } + continue format_sequence; + } + precision = READ_NUM('precision'); + continue format_sequence; + + case 'd': + case 'i': + case 'u': + arg = self.$Integer(GET_ARG()); + if (arg >= 0) { + str = arg.toString(); + while (str.length < precision) { str = '0' + str; } + if (flags&FMINUS) { + if (flags&FPLUS || flags&FSPACE) { str = (flags&FPLUS ? '+' : ' ') + str; } + while (str.length < width) { str = str + ' '; } + } else { + if (flags&FZERO && precision === -1) { + while (str.length < width - ((flags&FPLUS || flags&FSPACE) ? 1 : 0)) { str = '0' + str; } + if (flags&FPLUS || flags&FSPACE) { str = (flags&FPLUS ? '+' : ' ') + str; } + } else { + if (flags&FPLUS || flags&FSPACE) { str = (flags&FPLUS ? '+' : ' ') + str; } + while (str.length < width) { str = ' ' + str; } + } + } + } else { + str = (-arg).toString(); + while (str.length < precision) { str = '0' + str; } + if (flags&FMINUS) { + str = '-' + str; + while (str.length < width) { str = str + ' '; } + } else { + if (flags&FZERO && precision === -1) { + while (str.length < width - 1) { str = '0' + str; } + str = '-' + str; + } else { + str = '-' + str; + while (str.length < width) { str = ' ' + str; } + } + } + } + break format_sequence; + + case 'b': + case 'B': + case 'o': + case 'x': + case 'X': + switch (format_string.charAt(i)) { + case 'b': + case 'B': + base_number = 2; + base_prefix = '0b'; + base_neg_zero_regex = /^1+/; + base_neg_zero_digit = '1'; + break; + case 'o': + base_number = 8; + base_prefix = '0'; + base_neg_zero_regex = /^3?7+/; + base_neg_zero_digit = '7'; + break; + case 'x': + case 'X': + base_number = 16; + base_prefix = '0x'; + base_neg_zero_regex = /^f+/; + base_neg_zero_digit = 'f'; + break; + } + arg = self.$Integer(GET_ARG()); + if (arg >= 0) { + str = arg.toString(base_number); + while (str.length < precision) { str = '0' + str; } + if (flags&FMINUS) { + if (flags&FPLUS || flags&FSPACE) { str = (flags&FPLUS ? '+' : ' ') + str; } + if (flags&FSHARP && arg !== 0) { str = base_prefix + str; } + while (str.length < width) { str = str + ' '; } + } else { + if (flags&FZERO && precision === -1) { + while (str.length < width - ((flags&FPLUS || flags&FSPACE) ? 1 : 0) - ((flags&FSHARP && arg !== 0) ? base_prefix.length : 0)) { str = '0' + str; } + if (flags&FSHARP && arg !== 0) { str = base_prefix + str; } + if (flags&FPLUS || flags&FSPACE) { str = (flags&FPLUS ? '+' : ' ') + str; } + } else { + if (flags&FSHARP && arg !== 0) { str = base_prefix + str; } + if (flags&FPLUS || flags&FSPACE) { str = (flags&FPLUS ? '+' : ' ') + str; } + while (str.length < width) { str = ' ' + str; } + } + } + } else { + if (flags&FPLUS || flags&FSPACE) { + str = (-arg).toString(base_number); + while (str.length < precision) { str = '0' + str; } + if (flags&FMINUS) { + if (flags&FSHARP) { str = base_prefix + str; } + str = '-' + str; + while (str.length < width) { str = str + ' '; } + } else { + if (flags&FZERO && precision === -1) { + while (str.length < width - 1 - (flags&FSHARP ? 2 : 0)) { str = '0' + str; } + if (flags&FSHARP) { str = base_prefix + str; } + str = '-' + str; + } else { + if (flags&FSHARP) { str = base_prefix + str; } + str = '-' + str; + while (str.length < width) { str = ' ' + str; } + } + } + } else { + str = (arg >>> 0).toString(base_number).replace(base_neg_zero_regex, base_neg_zero_digit); + while (str.length < precision - 2) { str = base_neg_zero_digit + str; } + if (flags&FMINUS) { + str = '..' + str; + if (flags&FSHARP) { str = base_prefix + str; } + while (str.length < width) { str = str + ' '; } + } else { + if (flags&FZERO && precision === -1) { + while (str.length < width - 2 - (flags&FSHARP ? base_prefix.length : 0)) { str = base_neg_zero_digit + str; } + str = '..' + str; + if (flags&FSHARP) { str = base_prefix + str; } + } else { + str = '..' + str; + if (flags&FSHARP) { str = base_prefix + str; } + while (str.length < width) { str = ' ' + str; } + } + } + } + } + if (format_string.charAt(i) === format_string.charAt(i).toUpperCase()) { + str = str.toUpperCase(); + } + break format_sequence; + + case 'f': + case 'e': + case 'E': + case 'g': + case 'G': + arg = self.$Float(GET_ARG()); + if (arg >= 0 || isNaN(arg)) { + if (arg === Infinity) { + str = 'Inf'; + } else { + switch (format_string.charAt(i)) { + case 'f': + str = arg.toFixed(precision === -1 ? 6 : precision); + break; + case 'e': + case 'E': + str = arg.toExponential(precision === -1 ? 6 : precision); + break; + case 'g': + case 'G': + str = arg.toExponential(); + exponent = parseInt(str.split('e')[1], 10); + if (!(exponent < -4 || exponent >= (precision === -1 ? 6 : precision))) { + str = arg.toPrecision(precision === -1 ? (flags&FSHARP ? 6 : undefined) : precision); + } + break; + } + } + if (flags&FMINUS) { + if (flags&FPLUS || flags&FSPACE) { str = (flags&FPLUS ? '+' : ' ') + str; } + while (str.length < width) { str = str + ' '; } + } else { + if (flags&FZERO && arg !== Infinity && !isNaN(arg)) { + while (str.length < width - ((flags&FPLUS || flags&FSPACE) ? 1 : 0)) { str = '0' + str; } + if (flags&FPLUS || flags&FSPACE) { str = (flags&FPLUS ? '+' : ' ') + str; } + } else { + if (flags&FPLUS || flags&FSPACE) { str = (flags&FPLUS ? '+' : ' ') + str; } + while (str.length < width) { str = ' ' + str; } + } + } + } else { + if (arg === -Infinity) { + str = 'Inf'; + } else { + switch (format_string.charAt(i)) { + case 'f': + str = (-arg).toFixed(precision === -1 ? 6 : precision); + break; + case 'e': + case 'E': + str = (-arg).toExponential(precision === -1 ? 6 : precision); + break; + case 'g': + case 'G': + str = (-arg).toExponential(); + exponent = parseInt(str.split('e')[1], 10); + if (!(exponent < -4 || exponent >= (precision === -1 ? 6 : precision))) { + str = (-arg).toPrecision(precision === -1 ? (flags&FSHARP ? 6 : undefined) : precision); + } + break; + } + } + if (flags&FMINUS) { + str = '-' + str; + while (str.length < width) { str = str + ' '; } + } else { + if (flags&FZERO && arg !== -Infinity) { + while (str.length < width - 1) { str = '0' + str; } + str = '-' + str; + } else { + str = '-' + str; + while (str.length < width) { str = ' ' + str; } + } + } + } + if (format_string.charAt(i) === format_string.charAt(i).toUpperCase() && arg !== Infinity && arg !== -Infinity && !isNaN(arg)) { + str = str.toUpperCase(); + } + str = str.replace(/([eE][-+]?)([0-9])$/, '$10$2'); + break format_sequence; + + case 'a': + case 'A': + // Not implemented because there are no specs for this field type. + self.$raise($$($nesting, 'NotImplementedError'), "`A` and `a` format field types are not implemented in Opal yet") + + case 'c': + arg = GET_ARG(); + if ((arg)['$respond_to?']("to_ary")) { arg = (arg).$to_ary()[0]; } + if ((arg)['$respond_to?']("to_str")) { + str = (arg).$to_str(); + } else { + str = String.fromCharCode($$($nesting, 'Opal').$coerce_to(arg, $$($nesting, 'Integer'), "to_int")); + } + if (str.length !== 1) { + self.$raise($$($nesting, 'ArgumentError'), "%c requires a character") + } + if (flags&FMINUS) { + while (str.length < width) { str = str + ' '; } + } else { + while (str.length < width) { str = ' ' + str; } + } + break format_sequence; + + case 'p': + str = (GET_ARG()).$inspect(); + if (precision !== -1) { str = str.slice(0, precision); } + if (flags&FMINUS) { + while (str.length < width) { str = str + ' '; } + } else { + while (str.length < width) { str = ' ' + str; } + } + break format_sequence; + + case 's': + str = (GET_ARG()).$to_s(); + if (precision !== -1) { str = str.slice(0, precision); } + if (flags&FMINUS) { + while (str.length < width) { str = str + ' '; } + } else { + while (str.length < width) { str = ' ' + str; } + } + break format_sequence; + + default: + self.$raise($$($nesting, 'ArgumentError'), "" + "malformed format string - %" + (format_string.charAt(i))) + } + } + + if (str === undefined) { + self.$raise($$($nesting, 'ArgumentError'), "malformed format string - %") + } + + result += format_string.slice(begin_slice, end_slice) + str; + begin_slice = i + 1; + } + + if ($gvars.DEBUG && pos_arg_num >= 0 && seq_arg_num < args.length) { + self.$raise($$($nesting, 'ArgumentError'), "too many arguments for format string") + } + + return result + format_string.slice(begin_slice); + ; + }, TMP_Kernel_format_24.$$arity = -2); + + Opal.def(self, '$hash', TMP_Kernel_hash_25 = function $$hash() { + var self = this; + + return self.$__id__() + }, TMP_Kernel_hash_25.$$arity = 0); + + Opal.def(self, '$initialize_copy', TMP_Kernel_initialize_copy_26 = function $$initialize_copy(other) { + var self = this; + + return nil + }, TMP_Kernel_initialize_copy_26.$$arity = 1); + + Opal.def(self, '$inspect', TMP_Kernel_inspect_27 = function $$inspect() { + var self = this; + + return self.$to_s() + }, TMP_Kernel_inspect_27.$$arity = 0); + + Opal.def(self, '$instance_of?', TMP_Kernel_instance_of$q_28 = function(klass) { + var self = this; + + + if (!klass.$$is_class && !klass.$$is_module) { + self.$raise($$($nesting, 'TypeError'), "class or module required"); + } + + return self.$$class === klass; + + }, TMP_Kernel_instance_of$q_28.$$arity = 1); + + Opal.def(self, '$instance_variable_defined?', TMP_Kernel_instance_variable_defined$q_29 = function(name) { + var self = this; + + + name = $$($nesting, 'Opal')['$instance_variable_name!'](name); + return Opal.hasOwnProperty.call(self, name.substr(1));; + }, TMP_Kernel_instance_variable_defined$q_29.$$arity = 1); + + Opal.def(self, '$instance_variable_get', TMP_Kernel_instance_variable_get_30 = function $$instance_variable_get(name) { + var self = this; + + + name = $$($nesting, 'Opal')['$instance_variable_name!'](name); + + var ivar = self[Opal.ivar(name.substr(1))]; + + return ivar == null ? nil : ivar; + ; + }, TMP_Kernel_instance_variable_get_30.$$arity = 1); + + Opal.def(self, '$instance_variable_set', TMP_Kernel_instance_variable_set_31 = function $$instance_variable_set(name, value) { + var self = this; + + + name = $$($nesting, 'Opal')['$instance_variable_name!'](name); + return self[Opal.ivar(name.substr(1))] = value;; + }, TMP_Kernel_instance_variable_set_31.$$arity = 2); + + Opal.def(self, '$remove_instance_variable', TMP_Kernel_remove_instance_variable_32 = function $$remove_instance_variable(name) { + var self = this; + + + name = $$($nesting, 'Opal')['$instance_variable_name!'](name); + + var key = Opal.ivar(name.substr(1)), + val; + if (self.hasOwnProperty(key)) { + val = self[key]; + delete self[key]; + return val; + } + ; + return self.$raise($$($nesting, 'NameError'), "" + "instance variable " + (name) + " not defined"); + }, TMP_Kernel_remove_instance_variable_32.$$arity = 1); + + Opal.def(self, '$instance_variables', TMP_Kernel_instance_variables_33 = function $$instance_variables() { + var self = this; + + + var result = [], ivar; + + for (var name in self) { + if (self.hasOwnProperty(name) && name.charAt(0) !== '$') { + if (name.substr(-1) === '$') { + ivar = name.slice(0, name.length - 1); + } else { + ivar = name; + } + result.push('@' + ivar); + } + } + + return result; + + }, TMP_Kernel_instance_variables_33.$$arity = 0); + + Opal.def(self, '$Integer', TMP_Kernel_Integer_34 = function $$Integer(value, base) { + var self = this; + + + ; + + var i, str, base_digits; + + if (!value.$$is_string) { + if (base !== undefined) { + self.$raise($$($nesting, 'ArgumentError'), "base specified for non string value") + } + if (value === nil) { + self.$raise($$($nesting, 'TypeError'), "can't convert nil into Integer") + } + if (value.$$is_number) { + if (value === Infinity || value === -Infinity || isNaN(value)) { + self.$raise($$($nesting, 'FloatDomainError'), value) + } + return Math.floor(value); + } + if (value['$respond_to?']("to_int")) { + i = value.$to_int(); + if (i !== nil) { + return i; + } + } + return $$($nesting, 'Opal')['$coerce_to!'](value, $$($nesting, 'Integer'), "to_i"); + } + + if (value === "0") { + return 0; + } + + if (base === undefined) { + base = 0; + } else { + base = $$($nesting, 'Opal').$coerce_to(base, $$($nesting, 'Integer'), "to_int"); + if (base === 1 || base < 0 || base > 36) { + self.$raise($$($nesting, 'ArgumentError'), "" + "invalid radix " + (base)) + } + } + + str = value.toLowerCase(); + + str = str.replace(/(\d)_(?=\d)/g, '$1'); + + str = str.replace(/^(\s*[+-]?)(0[bodx]?)/, function (_, head, flag) { + switch (flag) { + case '0b': + if (base === 0 || base === 2) { + base = 2; + return head; + } + case '0': + case '0o': + if (base === 0 || base === 8) { + base = 8; + return head; + } + case '0d': + if (base === 0 || base === 10) { + base = 10; + return head; + } + case '0x': + if (base === 0 || base === 16) { + base = 16; + return head; + } + } + self.$raise($$($nesting, 'ArgumentError'), "" + "invalid value for Integer(): \"" + (value) + "\"") + }); + + base = (base === 0 ? 10 : base); + + base_digits = '0-' + (base <= 10 ? base - 1 : '9a-' + String.fromCharCode(97 + (base - 11))); + + if (!(new RegExp('^\\s*[+-]?[' + base_digits + ']+\\s*$')).test(str)) { + self.$raise($$($nesting, 'ArgumentError'), "" + "invalid value for Integer(): \"" + (value) + "\"") + } + + i = parseInt(str, base); + + if (isNaN(i)) { + self.$raise($$($nesting, 'ArgumentError'), "" + "invalid value for Integer(): \"" + (value) + "\"") + } + + return i; + ; + }, TMP_Kernel_Integer_34.$$arity = -2); + + Opal.def(self, '$Float', TMP_Kernel_Float_35 = function $$Float(value) { + var self = this; + + + var str; + + if (value === nil) { + self.$raise($$($nesting, 'TypeError'), "can't convert nil into Float") + } + + if (value.$$is_string) { + str = value.toString(); + + str = str.replace(/(\d)_(?=\d)/g, '$1'); + + //Special case for hex strings only: + if (/^\s*[-+]?0[xX][0-9a-fA-F]+\s*$/.test(str)) { + return self.$Integer(str); + } + + if (!/^\s*[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?\s*$/.test(str)) { + self.$raise($$($nesting, 'ArgumentError'), "" + "invalid value for Float(): \"" + (value) + "\"") + } + + return parseFloat(str); + } + + return $$($nesting, 'Opal')['$coerce_to!'](value, $$($nesting, 'Float'), "to_f"); + + }, TMP_Kernel_Float_35.$$arity = 1); + + Opal.def(self, '$Hash', TMP_Kernel_Hash_36 = function $$Hash(arg) { + var $a, self = this; + + + if ($truthy(($truthy($a = arg['$nil?']()) ? $a : arg['$==']([])))) { + return $hash2([], {})}; + if ($truthy($$($nesting, 'Hash')['$==='](arg))) { + return arg}; + return $$($nesting, 'Opal')['$coerce_to!'](arg, $$($nesting, 'Hash'), "to_hash"); + }, TMP_Kernel_Hash_36.$$arity = 1); + + Opal.def(self, '$is_a?', TMP_Kernel_is_a$q_37 = function(klass) { + var self = this; + + + if (!klass.$$is_class && !klass.$$is_module) { + self.$raise($$($nesting, 'TypeError'), "class or module required"); + } + + return Opal.is_a(self, klass); + + }, TMP_Kernel_is_a$q_37.$$arity = 1); + + Opal.def(self, '$itself', TMP_Kernel_itself_38 = function $$itself() { + var self = this; + + return self + }, TMP_Kernel_itself_38.$$arity = 0); + Opal.alias(self, "kind_of?", "is_a?"); + + Opal.def(self, '$lambda', TMP_Kernel_lambda_39 = function $$lambda() { + var $iter = TMP_Kernel_lambda_39.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Kernel_lambda_39.$$p = null; + + + if ($iter) TMP_Kernel_lambda_39.$$p = null;; + return Opal.lambda(block);; + }, TMP_Kernel_lambda_39.$$arity = 0); + + Opal.def(self, '$load', TMP_Kernel_load_40 = function $$load(file) { + var self = this; + + + file = $$($nesting, 'Opal')['$coerce_to!'](file, $$($nesting, 'String'), "to_str"); + return Opal.load(file); + }, TMP_Kernel_load_40.$$arity = 1); + + Opal.def(self, '$loop', TMP_Kernel_loop_41 = function $$loop() { + var TMP_42, $a, $iter = TMP_Kernel_loop_41.$$p, $yield = $iter || nil, self = this, e = nil; + + if ($iter) TMP_Kernel_loop_41.$$p = null; + + if (($yield !== nil)) { + } else { + return $send(self, 'enum_for', ["loop"], (TMP_42 = function(){var self = TMP_42.$$s || this; + + return $$$($$($nesting, 'Float'), 'INFINITY')}, TMP_42.$$s = self, TMP_42.$$arity = 0, TMP_42)) + }; + while ($truthy(true)) { + + try { + Opal.yieldX($yield, []) + } catch ($err) { + if (Opal.rescue($err, [$$($nesting, 'StopIteration')])) {e = $err; + try { + return e.$result() + } finally { Opal.pop_exception() } + } else { throw $err; } + }; + }; + return self; + }, TMP_Kernel_loop_41.$$arity = 0); + + Opal.def(self, '$nil?', TMP_Kernel_nil$q_43 = function() { + var self = this; + + return false + }, TMP_Kernel_nil$q_43.$$arity = 0); + Opal.alias(self, "object_id", "__id__"); + + Opal.def(self, '$printf', TMP_Kernel_printf_44 = function $$printf($a) { + var $post_args, args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + if ($truthy(args['$any?']())) { + self.$print($send(self, 'format', Opal.to_a(args)))}; + return nil; + }, TMP_Kernel_printf_44.$$arity = -1); + + Opal.def(self, '$proc', TMP_Kernel_proc_45 = function $$proc() { + var $iter = TMP_Kernel_proc_45.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Kernel_proc_45.$$p = null; + + + if ($iter) TMP_Kernel_proc_45.$$p = null;; + if ($truthy(block)) { + } else { + self.$raise($$($nesting, 'ArgumentError'), "tried to create Proc object without a block") + }; + block.$$is_lambda = false; + return block; + }, TMP_Kernel_proc_45.$$arity = 0); + + Opal.def(self, '$puts', TMP_Kernel_puts_46 = function $$puts($a) { + var $post_args, strs, self = this; + if ($gvars.stdout == null) $gvars.stdout = nil; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + strs = $post_args;; + return $send($gvars.stdout, 'puts', Opal.to_a(strs)); + }, TMP_Kernel_puts_46.$$arity = -1); + + Opal.def(self, '$p', TMP_Kernel_p_47 = function $$p($a) { + var $post_args, args, TMP_48, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + $send(args, 'each', [], (TMP_48 = function(obj){var self = TMP_48.$$s || this; + if ($gvars.stdout == null) $gvars.stdout = nil; + + + + if (obj == null) { + obj = nil; + }; + return $gvars.stdout.$puts(obj.$inspect());}, TMP_48.$$s = self, TMP_48.$$arity = 1, TMP_48)); + if ($truthy($rb_le(args.$length(), 1))) { + return args['$[]'](0) + } else { + return args + }; + }, TMP_Kernel_p_47.$$arity = -1); + + Opal.def(self, '$print', TMP_Kernel_print_49 = function $$print($a) { + var $post_args, strs, self = this; + if ($gvars.stdout == null) $gvars.stdout = nil; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + strs = $post_args;; + return $send($gvars.stdout, 'print', Opal.to_a(strs)); + }, TMP_Kernel_print_49.$$arity = -1); + + Opal.def(self, '$warn', TMP_Kernel_warn_50 = function $$warn($a) { + var $post_args, strs, $b, self = this; + if ($gvars.VERBOSE == null) $gvars.VERBOSE = nil; + if ($gvars.stderr == null) $gvars.stderr = nil; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + strs = $post_args;; + if ($truthy(($truthy($b = $gvars.VERBOSE['$nil?']()) ? $b : strs['$empty?']()))) { + return nil + } else { + return $send($gvars.stderr, 'puts', Opal.to_a(strs)) + }; + }, TMP_Kernel_warn_50.$$arity = -1); + + Opal.def(self, '$raise', TMP_Kernel_raise_51 = function $$raise(exception, string, _backtrace) { + var self = this; + if ($gvars["!"] == null) $gvars["!"] = nil; + + + ; + + if (string == null) { + string = nil; + }; + + if (_backtrace == null) { + _backtrace = nil; + }; + + if (exception == null && $gvars["!"] !== nil) { + throw $gvars["!"]; + } + if (exception == null) { + exception = $$($nesting, 'RuntimeError').$new(); + } + else if (exception.$$is_string) { + exception = $$($nesting, 'RuntimeError').$new(exception); + } + // using respond_to? and not an undefined check to avoid method_missing matching as true + else if (exception.$$is_class && exception['$respond_to?']("exception")) { + exception = exception.$exception(string); + } + else if (exception['$is_a?']($$($nesting, 'Exception'))) { + // exception is fine + } + else { + exception = $$($nesting, 'TypeError').$new("exception class/object expected"); + } + + if ($gvars["!"] !== nil) { + Opal.exceptions.push($gvars["!"]); + } + + $gvars["!"] = exception; + + throw exception; + ; + }, TMP_Kernel_raise_51.$$arity = -1); + Opal.alias(self, "fail", "raise"); + + Opal.def(self, '$rand', TMP_Kernel_rand_52 = function $$rand(max) { + var self = this; + + + ; + + if (max === undefined) { + return $$$($$($nesting, 'Random'), 'DEFAULT').$rand(); + } + + if (max.$$is_number) { + if (max < 0) { + max = Math.abs(max); + } + + if (max % 1 !== 0) { + max = max.$to_i(); + } + + if (max === 0) { + max = undefined; + } + } + ; + return $$$($$($nesting, 'Random'), 'DEFAULT').$rand(max); + }, TMP_Kernel_rand_52.$$arity = -1); + + Opal.def(self, '$respond_to?', TMP_Kernel_respond_to$q_53 = function(name, include_all) { + var self = this; + + + + if (include_all == null) { + include_all = false; + }; + if ($truthy(self['$respond_to_missing?'](name, include_all))) { + return true}; + + var body = self['$' + name]; + + if (typeof(body) === "function" && !body.$$stub) { + return true; + } + ; + return false; + }, TMP_Kernel_respond_to$q_53.$$arity = -2); + + Opal.def(self, '$respond_to_missing?', TMP_Kernel_respond_to_missing$q_54 = function(method_name, include_all) { + var self = this; + + + + if (include_all == null) { + include_all = false; + }; + return false; + }, TMP_Kernel_respond_to_missing$q_54.$$arity = -2); + + Opal.def(self, '$require', TMP_Kernel_require_55 = function $$require(file) { + var self = this; + + + file = $$($nesting, 'Opal')['$coerce_to!'](file, $$($nesting, 'String'), "to_str"); + return Opal.require(file); + }, TMP_Kernel_require_55.$$arity = 1); + + Opal.def(self, '$require_relative', TMP_Kernel_require_relative_56 = function $$require_relative(file) { + var self = this; + + + $$($nesting, 'Opal')['$try_convert!'](file, $$($nesting, 'String'), "to_str"); + file = $$($nesting, 'File').$expand_path($$($nesting, 'File').$join(Opal.current_file, "..", file)); + return Opal.require(file); + }, TMP_Kernel_require_relative_56.$$arity = 1); + + Opal.def(self, '$require_tree', TMP_Kernel_require_tree_57 = function $$require_tree(path) { + var self = this; + + + var result = []; + + path = $$($nesting, 'File').$expand_path(path) + path = Opal.normalize(path); + if (path === '.') path = ''; + for (var name in Opal.modules) { + if ((name)['$start_with?'](path)) { + result.push([name, Opal.require(name)]); + } + } + + return result; + + }, TMP_Kernel_require_tree_57.$$arity = 1); + Opal.alias(self, "send", "__send__"); + Opal.alias(self, "public_send", "__send__"); + + Opal.def(self, '$singleton_class', TMP_Kernel_singleton_class_58 = function $$singleton_class() { + var self = this; + + return Opal.get_singleton_class(self); + }, TMP_Kernel_singleton_class_58.$$arity = 0); + + Opal.def(self, '$sleep', TMP_Kernel_sleep_59 = function $$sleep(seconds) { + var self = this; + + + + if (seconds == null) { + seconds = nil; + }; + + if (seconds === nil) { + self.$raise($$($nesting, 'TypeError'), "can't convert NilClass into time interval") + } + if (!seconds.$$is_number) { + self.$raise($$($nesting, 'TypeError'), "" + "can't convert " + (seconds.$class()) + " into time interval") + } + if (seconds < 0) { + self.$raise($$($nesting, 'ArgumentError'), "time interval must be positive") + } + var get_time = Opal.global.performance ? + function() {return performance.now()} : + function() {return new Date()} + + var t = get_time(); + while (get_time() - t <= seconds * 1000); + return seconds; + ; + }, TMP_Kernel_sleep_59.$$arity = -1); + Opal.alias(self, "sprintf", "format"); + + Opal.def(self, '$srand', TMP_Kernel_srand_60 = function $$srand(seed) { + var self = this; + + + + if (seed == null) { + seed = $$($nesting, 'Random').$new_seed(); + }; + return $$($nesting, 'Random').$srand(seed); + }, TMP_Kernel_srand_60.$$arity = -1); + + Opal.def(self, '$String', TMP_Kernel_String_61 = function $$String(str) { + var $a, self = this; + + return ($truthy($a = $$($nesting, 'Opal')['$coerce_to?'](str, $$($nesting, 'String'), "to_str")) ? $a : $$($nesting, 'Opal')['$coerce_to!'](str, $$($nesting, 'String'), "to_s")) + }, TMP_Kernel_String_61.$$arity = 1); + + Opal.def(self, '$tap', TMP_Kernel_tap_62 = function $$tap() { + var $iter = TMP_Kernel_tap_62.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Kernel_tap_62.$$p = null; + + + if ($iter) TMP_Kernel_tap_62.$$p = null;; + Opal.yield1(block, self); + return self; + }, TMP_Kernel_tap_62.$$arity = 0); + + Opal.def(self, '$to_proc', TMP_Kernel_to_proc_63 = function $$to_proc() { + var self = this; + + return self + }, TMP_Kernel_to_proc_63.$$arity = 0); + + Opal.def(self, '$to_s', TMP_Kernel_to_s_64 = function $$to_s() { + var self = this; + + return "" + "#<" + (self.$class()) + ":0x" + (self.$__id__().$to_s(16)) + ">" + }, TMP_Kernel_to_s_64.$$arity = 0); + + Opal.def(self, '$catch', TMP_Kernel_catch_65 = function(sym) { + var $iter = TMP_Kernel_catch_65.$$p, $yield = $iter || nil, self = this, e = nil; + + if ($iter) TMP_Kernel_catch_65.$$p = null; + try { + return Opal.yieldX($yield, []); + } catch ($err) { + if (Opal.rescue($err, [$$($nesting, 'UncaughtThrowError')])) {e = $err; + try { + + if (e.$sym()['$=='](sym)) { + return e.$arg()}; + return self.$raise(); + } finally { Opal.pop_exception() } + } else { throw $err; } + } + }, TMP_Kernel_catch_65.$$arity = 1); + + Opal.def(self, '$throw', TMP_Kernel_throw_66 = function($a) { + var $post_args, args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + return self.$raise($$($nesting, 'UncaughtThrowError'), args); + }, TMP_Kernel_throw_66.$$arity = -1); + + Opal.def(self, '$open', TMP_Kernel_open_67 = function $$open($a) { + var $iter = TMP_Kernel_open_67.$$p, block = $iter || nil, $post_args, args, self = this; + + if ($iter) TMP_Kernel_open_67.$$p = null; + + + if ($iter) TMP_Kernel_open_67.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + return $send($$($nesting, 'File'), 'open', Opal.to_a(args), block.$to_proc()); + }, TMP_Kernel_open_67.$$arity = -1); + + Opal.def(self, '$yield_self', TMP_Kernel_yield_self_68 = function $$yield_self() { + var TMP_69, $iter = TMP_Kernel_yield_self_68.$$p, $yield = $iter || nil, self = this; + + if ($iter) TMP_Kernel_yield_self_68.$$p = null; + + if (($yield !== nil)) { + } else { + return $send(self, 'enum_for', ["yield_self"], (TMP_69 = function(){var self = TMP_69.$$s || this; + + return 1}, TMP_69.$$s = self, TMP_69.$$arity = 0, TMP_69)) + }; + return Opal.yield1($yield, self);; + }, TMP_Kernel_yield_self_68.$$arity = 0); + })($nesting[0], $nesting); + return (function($base, $super, $parent_nesting) { + function $Object(){}; + var self = $Object = $klass($base, $super, 'Object', $Object); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return self.$include($$($nesting, 'Kernel')) + })($nesting[0], null, $nesting); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/error"] = function(Opal) { + function $rb_plus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); + } + function $rb_gt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $send = Opal.send, $truthy = Opal.truthy, $module = Opal.module, $hash2 = Opal.hash2; + + Opal.add_stubs(['$new', '$clone', '$to_s', '$empty?', '$class', '$raise', '$+', '$attr_reader', '$[]', '$>', '$length', '$inspect']); + + (function($base, $super, $parent_nesting) { + function $Exception(){}; + var self = $Exception = $klass($base, $super, 'Exception', $Exception); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Exception_new_1, TMP_Exception_exception_2, TMP_Exception_initialize_3, TMP_Exception_backtrace_4, TMP_Exception_exception_5, TMP_Exception_message_6, TMP_Exception_inspect_7, TMP_Exception_set_backtrace_8, TMP_Exception_to_s_9; + + def.message = nil; + + var stack_trace_limit; + Opal.defs(self, '$new', TMP_Exception_new_1 = function($a) { + var $post_args, args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + + var message = (args.length > 0) ? args[0] : nil; + var error = new self(message); + error.name = self.$$name; + error.message = message; + Opal.send(error, error.$initialize, args); + + // Error.captureStackTrace() will use .name and .toString to build the + // first line of the stack trace so it must be called after the error + // has been initialized. + // https://nodejs.org/dist/latest-v6.x/docs/api/errors.html + if (Opal.config.enable_stack_trace && Error.captureStackTrace) { + // Passing Kernel.raise will cut the stack trace from that point above + Error.captureStackTrace(error, stack_trace_limit); + } + + return error; + ; + }, TMP_Exception_new_1.$$arity = -1); + stack_trace_limit = self.$new; + Opal.defs(self, '$exception', TMP_Exception_exception_2 = function $$exception($a) { + var $post_args, args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + return $send(self, 'new', Opal.to_a(args)); + }, TMP_Exception_exception_2.$$arity = -1); + + Opal.def(self, '$initialize', TMP_Exception_initialize_3 = function $$initialize($a) { + var $post_args, args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + return self.message = (args.length > 0) ? args[0] : nil;; + }, TMP_Exception_initialize_3.$$arity = -1); + + Opal.def(self, '$backtrace', TMP_Exception_backtrace_4 = function $$backtrace() { + var self = this; + + + if (self.backtrace) { + // nil is a valid backtrace + return self.backtrace; + } + + var backtrace = self.stack; + + if (typeof(backtrace) === 'string') { + return backtrace.split("\n").slice(0, 15); + } + else if (backtrace) { + return backtrace.slice(0, 15); + } + + return []; + + }, TMP_Exception_backtrace_4.$$arity = 0); + + Opal.def(self, '$exception', TMP_Exception_exception_5 = function $$exception(str) { + var self = this; + + + + if (str == null) { + str = nil; + }; + + if (str === nil || self === str) { + return self; + } + + var cloned = self.$clone(); + cloned.message = str; + return cloned; + ; + }, TMP_Exception_exception_5.$$arity = -1); + + Opal.def(self, '$message', TMP_Exception_message_6 = function $$message() { + var self = this; + + return self.$to_s() + }, TMP_Exception_message_6.$$arity = 0); + + Opal.def(self, '$inspect', TMP_Exception_inspect_7 = function $$inspect() { + var self = this, as_str = nil; + + + as_str = self.$to_s(); + if ($truthy(as_str['$empty?']())) { + return self.$class().$to_s() + } else { + return "" + "#<" + (self.$class().$to_s()) + ": " + (self.$to_s()) + ">" + }; + }, TMP_Exception_inspect_7.$$arity = 0); + + Opal.def(self, '$set_backtrace', TMP_Exception_set_backtrace_8 = function $$set_backtrace(backtrace) { + var self = this; + + + var valid = true, i, ii; + + if (backtrace === nil) { + self.backtrace = nil; + } else if (backtrace.$$is_string) { + self.backtrace = [backtrace]; + } else { + if (backtrace.$$is_array) { + for (i = 0, ii = backtrace.length; i < ii; i++) { + if (!backtrace[i].$$is_string) { + valid = false; + break; + } + } + } else { + valid = false; + } + + if (valid === false) { + self.$raise($$($nesting, 'TypeError'), "backtrace must be Array of String") + } + + self.backtrace = backtrace; + } + + return backtrace; + + }, TMP_Exception_set_backtrace_8.$$arity = 1); + return (Opal.def(self, '$to_s', TMP_Exception_to_s_9 = function $$to_s() { + var $a, $b, self = this; + + return ($truthy($a = ($truthy($b = self.message) ? self.message.$to_s() : $b)) ? $a : self.$class().$to_s()) + }, TMP_Exception_to_s_9.$$arity = 0), nil) && 'to_s'; + })($nesting[0], Error, $nesting); + (function($base, $super, $parent_nesting) { + function $ScriptError(){}; + var self = $ScriptError = $klass($base, $super, 'ScriptError', $ScriptError); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return nil + })($nesting[0], $$($nesting, 'Exception'), $nesting); + (function($base, $super, $parent_nesting) { + function $SyntaxError(){}; + var self = $SyntaxError = $klass($base, $super, 'SyntaxError', $SyntaxError); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return nil + })($nesting[0], $$($nesting, 'ScriptError'), $nesting); + (function($base, $super, $parent_nesting) { + function $LoadError(){}; + var self = $LoadError = $klass($base, $super, 'LoadError', $LoadError); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return nil + })($nesting[0], $$($nesting, 'ScriptError'), $nesting); + (function($base, $super, $parent_nesting) { + function $NotImplementedError(){}; + var self = $NotImplementedError = $klass($base, $super, 'NotImplementedError', $NotImplementedError); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return nil + })($nesting[0], $$($nesting, 'ScriptError'), $nesting); + (function($base, $super, $parent_nesting) { + function $SystemExit(){}; + var self = $SystemExit = $klass($base, $super, 'SystemExit', $SystemExit); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return nil + })($nesting[0], $$($nesting, 'Exception'), $nesting); + (function($base, $super, $parent_nesting) { + function $NoMemoryError(){}; + var self = $NoMemoryError = $klass($base, $super, 'NoMemoryError', $NoMemoryError); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return nil + })($nesting[0], $$($nesting, 'Exception'), $nesting); + (function($base, $super, $parent_nesting) { + function $SignalException(){}; + var self = $SignalException = $klass($base, $super, 'SignalException', $SignalException); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return nil + })($nesting[0], $$($nesting, 'Exception'), $nesting); + (function($base, $super, $parent_nesting) { + function $Interrupt(){}; + var self = $Interrupt = $klass($base, $super, 'Interrupt', $Interrupt); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return nil + })($nesting[0], $$($nesting, 'Exception'), $nesting); + (function($base, $super, $parent_nesting) { + function $SecurityError(){}; + var self = $SecurityError = $klass($base, $super, 'SecurityError', $SecurityError); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return nil + })($nesting[0], $$($nesting, 'Exception'), $nesting); + (function($base, $super, $parent_nesting) { + function $StandardError(){}; + var self = $StandardError = $klass($base, $super, 'StandardError', $StandardError); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return nil + })($nesting[0], $$($nesting, 'Exception'), $nesting); + (function($base, $super, $parent_nesting) { + function $EncodingError(){}; + var self = $EncodingError = $klass($base, $super, 'EncodingError', $EncodingError); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return nil + })($nesting[0], $$($nesting, 'StandardError'), $nesting); + (function($base, $super, $parent_nesting) { + function $ZeroDivisionError(){}; + var self = $ZeroDivisionError = $klass($base, $super, 'ZeroDivisionError', $ZeroDivisionError); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return nil + })($nesting[0], $$($nesting, 'StandardError'), $nesting); + (function($base, $super, $parent_nesting) { + function $NameError(){}; + var self = $NameError = $klass($base, $super, 'NameError', $NameError); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return nil + })($nesting[0], $$($nesting, 'StandardError'), $nesting); + (function($base, $super, $parent_nesting) { + function $NoMethodError(){}; + var self = $NoMethodError = $klass($base, $super, 'NoMethodError', $NoMethodError); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return nil + })($nesting[0], $$($nesting, 'NameError'), $nesting); + (function($base, $super, $parent_nesting) { + function $RuntimeError(){}; + var self = $RuntimeError = $klass($base, $super, 'RuntimeError', $RuntimeError); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return nil + })($nesting[0], $$($nesting, 'StandardError'), $nesting); + (function($base, $super, $parent_nesting) { + function $FrozenError(){}; + var self = $FrozenError = $klass($base, $super, 'FrozenError', $FrozenError); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return nil + })($nesting[0], $$($nesting, 'RuntimeError'), $nesting); + (function($base, $super, $parent_nesting) { + function $LocalJumpError(){}; + var self = $LocalJumpError = $klass($base, $super, 'LocalJumpError', $LocalJumpError); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return nil + })($nesting[0], $$($nesting, 'StandardError'), $nesting); + (function($base, $super, $parent_nesting) { + function $TypeError(){}; + var self = $TypeError = $klass($base, $super, 'TypeError', $TypeError); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return nil + })($nesting[0], $$($nesting, 'StandardError'), $nesting); + (function($base, $super, $parent_nesting) { + function $ArgumentError(){}; + var self = $ArgumentError = $klass($base, $super, 'ArgumentError', $ArgumentError); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return nil + })($nesting[0], $$($nesting, 'StandardError'), $nesting); + (function($base, $super, $parent_nesting) { + function $IndexError(){}; + var self = $IndexError = $klass($base, $super, 'IndexError', $IndexError); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return nil + })($nesting[0], $$($nesting, 'StandardError'), $nesting); + (function($base, $super, $parent_nesting) { + function $StopIteration(){}; + var self = $StopIteration = $klass($base, $super, 'StopIteration', $StopIteration); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return nil + })($nesting[0], $$($nesting, 'IndexError'), $nesting); + (function($base, $super, $parent_nesting) { + function $KeyError(){}; + var self = $KeyError = $klass($base, $super, 'KeyError', $KeyError); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return nil + })($nesting[0], $$($nesting, 'IndexError'), $nesting); + (function($base, $super, $parent_nesting) { + function $RangeError(){}; + var self = $RangeError = $klass($base, $super, 'RangeError', $RangeError); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return nil + })($nesting[0], $$($nesting, 'StandardError'), $nesting); + (function($base, $super, $parent_nesting) { + function $FloatDomainError(){}; + var self = $FloatDomainError = $klass($base, $super, 'FloatDomainError', $FloatDomainError); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return nil + })($nesting[0], $$($nesting, 'RangeError'), $nesting); + (function($base, $super, $parent_nesting) { + function $IOError(){}; + var self = $IOError = $klass($base, $super, 'IOError', $IOError); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return nil + })($nesting[0], $$($nesting, 'StandardError'), $nesting); + (function($base, $super, $parent_nesting) { + function $SystemCallError(){}; + var self = $SystemCallError = $klass($base, $super, 'SystemCallError', $SystemCallError); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return nil + })($nesting[0], $$($nesting, 'StandardError'), $nesting); + (function($base, $parent_nesting) { + function $Errno() {}; + var self = $Errno = $module($base, 'Errno', $Errno); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + (function($base, $super, $parent_nesting) { + function $EINVAL(){}; + var self = $EINVAL = $klass($base, $super, 'EINVAL', $EINVAL); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_EINVAL_new_10; + + return (Opal.defs(self, '$new', TMP_EINVAL_new_10 = function(name) { + var $iter = TMP_EINVAL_new_10.$$p, $yield = $iter || nil, self = this, message = nil; + + if ($iter) TMP_EINVAL_new_10.$$p = null; + + + if (name == null) { + name = nil; + }; + message = "Invalid argument"; + if ($truthy(name)) { + message = $rb_plus(message, "" + " - " + (name))}; + return $send(self, Opal.find_super_dispatcher(self, 'new', TMP_EINVAL_new_10, false, $EINVAL), [message], null); + }, TMP_EINVAL_new_10.$$arity = -1), nil) && 'new' + })($nesting[0], $$($nesting, 'SystemCallError'), $nesting) + })($nesting[0], $nesting); + (function($base, $super, $parent_nesting) { + function $UncaughtThrowError(){}; + var self = $UncaughtThrowError = $klass($base, $super, 'UncaughtThrowError', $UncaughtThrowError); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_UncaughtThrowError_initialize_11; + + def.sym = nil; + + self.$attr_reader("sym", "arg"); + return (Opal.def(self, '$initialize', TMP_UncaughtThrowError_initialize_11 = function $$initialize(args) { + var $iter = TMP_UncaughtThrowError_initialize_11.$$p, $yield = $iter || nil, self = this; + + if ($iter) TMP_UncaughtThrowError_initialize_11.$$p = null; + + self.sym = args['$[]'](0); + if ($truthy($rb_gt(args.$length(), 1))) { + self.arg = args['$[]'](1)}; + return $send(self, Opal.find_super_dispatcher(self, 'initialize', TMP_UncaughtThrowError_initialize_11, false), ["" + "uncaught throw " + (self.sym.$inspect())], null); + }, TMP_UncaughtThrowError_initialize_11.$$arity = 1), nil) && 'initialize'; + })($nesting[0], $$($nesting, 'ArgumentError'), $nesting); + (function($base, $super, $parent_nesting) { + function $NameError(){}; + var self = $NameError = $klass($base, $super, 'NameError', $NameError); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_NameError_initialize_12; + + + self.$attr_reader("name"); + return (Opal.def(self, '$initialize', TMP_NameError_initialize_12 = function $$initialize(message, name) { + var $iter = TMP_NameError_initialize_12.$$p, $yield = $iter || nil, self = this; + + if ($iter) TMP_NameError_initialize_12.$$p = null; + + + if (name == null) { + name = nil; + }; + $send(self, Opal.find_super_dispatcher(self, 'initialize', TMP_NameError_initialize_12, false), [message], null); + return (self.name = name); + }, TMP_NameError_initialize_12.$$arity = -2), nil) && 'initialize'; + })($nesting[0], null, $nesting); + (function($base, $super, $parent_nesting) { + function $NoMethodError(){}; + var self = $NoMethodError = $klass($base, $super, 'NoMethodError', $NoMethodError); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_NoMethodError_initialize_13; + + + self.$attr_reader("args"); + return (Opal.def(self, '$initialize', TMP_NoMethodError_initialize_13 = function $$initialize(message, name, args) { + var $iter = TMP_NoMethodError_initialize_13.$$p, $yield = $iter || nil, self = this; + + if ($iter) TMP_NoMethodError_initialize_13.$$p = null; + + + if (name == null) { + name = nil; + }; + + if (args == null) { + args = []; + }; + $send(self, Opal.find_super_dispatcher(self, 'initialize', TMP_NoMethodError_initialize_13, false), [message, name], null); + return (self.args = args); + }, TMP_NoMethodError_initialize_13.$$arity = -2), nil) && 'initialize'; + })($nesting[0], null, $nesting); + (function($base, $super, $parent_nesting) { + function $StopIteration(){}; + var self = $StopIteration = $klass($base, $super, 'StopIteration', $StopIteration); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return self.$attr_reader("result") + })($nesting[0], null, $nesting); + (function($base, $super, $parent_nesting) { + function $KeyError(){}; + var self = $KeyError = $klass($base, $super, 'KeyError', $KeyError); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_KeyError_initialize_14, TMP_KeyError_receiver_15, TMP_KeyError_key_16; + + def.receiver = def.key = nil; + + + Opal.def(self, '$initialize', TMP_KeyError_initialize_14 = function $$initialize(message, $kwargs) { + var receiver, key, $iter = TMP_KeyError_initialize_14.$$p, $yield = $iter || nil, self = this; + + if ($iter) TMP_KeyError_initialize_14.$$p = null; + + + if ($kwargs == null) { + $kwargs = $hash2([], {}); + } else if (!$kwargs.$$is_hash) { + throw Opal.ArgumentError.$new('expected kwargs'); + }; + + receiver = $kwargs.$$smap["receiver"]; + if (receiver == null) { + receiver = nil + }; + + key = $kwargs.$$smap["key"]; + if (key == null) { + key = nil + }; + $send(self, Opal.find_super_dispatcher(self, 'initialize', TMP_KeyError_initialize_14, false), [message], null); + self.receiver = receiver; + return (self.key = key); + }, TMP_KeyError_initialize_14.$$arity = -2); + + Opal.def(self, '$receiver', TMP_KeyError_receiver_15 = function $$receiver() { + var $a, self = this; + + return ($truthy($a = self.receiver) ? $a : self.$raise($$($nesting, 'ArgumentError'), "no receiver is available")) + }, TMP_KeyError_receiver_15.$$arity = 0); + return (Opal.def(self, '$key', TMP_KeyError_key_16 = function $$key() { + var $a, self = this; + + return ($truthy($a = self.key) ? $a : self.$raise($$($nesting, 'ArgumentError'), "no key is available")) + }, TMP_KeyError_key_16.$$arity = 0), nil) && 'key'; + })($nesting[0], null, $nesting); + return (function($base, $parent_nesting) { + function $JS() {}; + var self = $JS = $module($base, 'JS', $JS); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + (function($base, $super, $parent_nesting) { + function $Error(){}; + var self = $Error = $klass($base, $super, 'Error', $Error); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return nil + })($nesting[0], null, $nesting) + })($nesting[0], $nesting); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/constants"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice; + + + Opal.const_set($nesting[0], 'RUBY_PLATFORM', "opal"); + Opal.const_set($nesting[0], 'RUBY_ENGINE', "opal"); + Opal.const_set($nesting[0], 'RUBY_VERSION', "2.5.1"); + Opal.const_set($nesting[0], 'RUBY_ENGINE_VERSION', "0.11.99.dev"); + Opal.const_set($nesting[0], 'RUBY_RELEASE_DATE', "2018-12-25"); + Opal.const_set($nesting[0], 'RUBY_PATCHLEVEL', 0); + Opal.const_set($nesting[0], 'RUBY_REVISION', 0); + Opal.const_set($nesting[0], 'RUBY_COPYRIGHT', "opal - Copyright (C) 2013-2018 Adam Beynon and the Opal contributors"); + return Opal.const_set($nesting[0], 'RUBY_DESCRIPTION', "" + "opal " + ($$($nesting, 'RUBY_ENGINE_VERSION')) + " (" + ($$($nesting, 'RUBY_RELEASE_DATE')) + " revision " + ($$($nesting, 'RUBY_REVISION')) + ")"); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["opal/base"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice; + + Opal.add_stubs(['$require']); + + self.$require("corelib/runtime"); + self.$require("corelib/helpers"); + self.$require("corelib/module"); + self.$require("corelib/class"); + self.$require("corelib/basic_object"); + self.$require("corelib/kernel"); + self.$require("corelib/error"); + return self.$require("corelib/constants"); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/nil"] = function(Opal) { + function $rb_gt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $hash2 = Opal.hash2, $truthy = Opal.truthy; + + Opal.add_stubs(['$raise', '$name', '$new', '$>', '$length', '$Rational']); + + (function($base, $super, $parent_nesting) { + function $NilClass(){}; + var self = $NilClass = $klass($base, $super, 'NilClass', $NilClass); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_NilClass_$B_2, TMP_NilClass_$_3, TMP_NilClass_$_4, TMP_NilClass_$_5, TMP_NilClass_$eq$eq_6, TMP_NilClass_dup_7, TMP_NilClass_clone_8, TMP_NilClass_inspect_9, TMP_NilClass_nil$q_10, TMP_NilClass_singleton_class_11, TMP_NilClass_to_a_12, TMP_NilClass_to_h_13, TMP_NilClass_to_i_14, TMP_NilClass_to_s_15, TMP_NilClass_to_c_16, TMP_NilClass_rationalize_17, TMP_NilClass_to_r_18, TMP_NilClass_instance_variables_19; + + + def.$$meta = self; + (function(self, $parent_nesting) { + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_allocate_1; + + + + Opal.def(self, '$allocate', TMP_allocate_1 = function $$allocate() { + var self = this; + + return self.$raise($$($nesting, 'TypeError'), "" + "allocator undefined for " + (self.$name())) + }, TMP_allocate_1.$$arity = 0); + + + Opal.udef(self, '$' + "new");; + return nil;; + })(Opal.get_singleton_class(self), $nesting); + + Opal.def(self, '$!', TMP_NilClass_$B_2 = function() { + var self = this; + + return true + }, TMP_NilClass_$B_2.$$arity = 0); + + Opal.def(self, '$&', TMP_NilClass_$_3 = function(other) { + var self = this; + + return false + }, TMP_NilClass_$_3.$$arity = 1); + + Opal.def(self, '$|', TMP_NilClass_$_4 = function(other) { + var self = this; + + return other !== false && other !== nil; + }, TMP_NilClass_$_4.$$arity = 1); + + Opal.def(self, '$^', TMP_NilClass_$_5 = function(other) { + var self = this; + + return other !== false && other !== nil; + }, TMP_NilClass_$_5.$$arity = 1); + + Opal.def(self, '$==', TMP_NilClass_$eq$eq_6 = function(other) { + var self = this; + + return other === nil; + }, TMP_NilClass_$eq$eq_6.$$arity = 1); + + Opal.def(self, '$dup', TMP_NilClass_dup_7 = function $$dup() { + var self = this; + + return nil + }, TMP_NilClass_dup_7.$$arity = 0); + + Opal.def(self, '$clone', TMP_NilClass_clone_8 = function $$clone($kwargs) { + var freeze, self = this; + + + + if ($kwargs == null) { + $kwargs = $hash2([], {}); + } else if (!$kwargs.$$is_hash) { + throw Opal.ArgumentError.$new('expected kwargs'); + }; + + freeze = $kwargs.$$smap["freeze"]; + if (freeze == null) { + freeze = true + }; + return nil; + }, TMP_NilClass_clone_8.$$arity = -1); + + Opal.def(self, '$inspect', TMP_NilClass_inspect_9 = function $$inspect() { + var self = this; + + return "nil" + }, TMP_NilClass_inspect_9.$$arity = 0); + + Opal.def(self, '$nil?', TMP_NilClass_nil$q_10 = function() { + var self = this; + + return true + }, TMP_NilClass_nil$q_10.$$arity = 0); + + Opal.def(self, '$singleton_class', TMP_NilClass_singleton_class_11 = function $$singleton_class() { + var self = this; + + return $$($nesting, 'NilClass') + }, TMP_NilClass_singleton_class_11.$$arity = 0); + + Opal.def(self, '$to_a', TMP_NilClass_to_a_12 = function $$to_a() { + var self = this; + + return [] + }, TMP_NilClass_to_a_12.$$arity = 0); + + Opal.def(self, '$to_h', TMP_NilClass_to_h_13 = function $$to_h() { + var self = this; + + return Opal.hash(); + }, TMP_NilClass_to_h_13.$$arity = 0); + + Opal.def(self, '$to_i', TMP_NilClass_to_i_14 = function $$to_i() { + var self = this; + + return 0 + }, TMP_NilClass_to_i_14.$$arity = 0); + Opal.alias(self, "to_f", "to_i"); + + Opal.def(self, '$to_s', TMP_NilClass_to_s_15 = function $$to_s() { + var self = this; + + return "" + }, TMP_NilClass_to_s_15.$$arity = 0); + + Opal.def(self, '$to_c', TMP_NilClass_to_c_16 = function $$to_c() { + var self = this; + + return $$($nesting, 'Complex').$new(0, 0) + }, TMP_NilClass_to_c_16.$$arity = 0); + + Opal.def(self, '$rationalize', TMP_NilClass_rationalize_17 = function $$rationalize($a) { + var $post_args, args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + if ($truthy($rb_gt(args.$length(), 1))) { + self.$raise($$($nesting, 'ArgumentError'))}; + return self.$Rational(0, 1); + }, TMP_NilClass_rationalize_17.$$arity = -1); + + Opal.def(self, '$to_r', TMP_NilClass_to_r_18 = function $$to_r() { + var self = this; + + return self.$Rational(0, 1) + }, TMP_NilClass_to_r_18.$$arity = 0); + return (Opal.def(self, '$instance_variables', TMP_NilClass_instance_variables_19 = function $$instance_variables() { + var self = this; + + return [] + }, TMP_NilClass_instance_variables_19.$$arity = 0), nil) && 'instance_variables'; + })($nesting[0], null, $nesting); + return Opal.const_set($nesting[0], 'NIL', nil); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/boolean"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $hash2 = Opal.hash2; + + Opal.add_stubs(['$raise', '$name']); + + (function($base, $super, $parent_nesting) { + function $Boolean(){}; + var self = $Boolean = $klass($base, $super, 'Boolean', $Boolean); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Boolean___id___2, TMP_Boolean_$B_3, TMP_Boolean_$_4, TMP_Boolean_$_5, TMP_Boolean_$_6, TMP_Boolean_$eq$eq_7, TMP_Boolean_singleton_class_8, TMP_Boolean_to_s_9, TMP_Boolean_dup_10, TMP_Boolean_clone_11; + + + Opal.defineProperty(Boolean.prototype, '$$is_boolean', true); + Opal.defineProperty(Boolean.prototype, '$$meta', self); + (function(self, $parent_nesting) { + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_allocate_1; + + + + Opal.def(self, '$allocate', TMP_allocate_1 = function $$allocate() { + var self = this; + + return self.$raise($$($nesting, 'TypeError'), "" + "allocator undefined for " + (self.$name())) + }, TMP_allocate_1.$$arity = 0); + + + Opal.udef(self, '$' + "new");; + return nil;; + })(Opal.get_singleton_class(self), $nesting); + + Opal.def(self, '$__id__', TMP_Boolean___id___2 = function $$__id__() { + var self = this; + + return self.valueOf() ? 2 : 0; + }, TMP_Boolean___id___2.$$arity = 0); + Opal.alias(self, "object_id", "__id__"); + + Opal.def(self, '$!', TMP_Boolean_$B_3 = function() { + var self = this; + + return self != true; + }, TMP_Boolean_$B_3.$$arity = 0); + + Opal.def(self, '$&', TMP_Boolean_$_4 = function(other) { + var self = this; + + return (self == true) ? (other !== false && other !== nil) : false; + }, TMP_Boolean_$_4.$$arity = 1); + + Opal.def(self, '$|', TMP_Boolean_$_5 = function(other) { + var self = this; + + return (self == true) ? true : (other !== false && other !== nil); + }, TMP_Boolean_$_5.$$arity = 1); + + Opal.def(self, '$^', TMP_Boolean_$_6 = function(other) { + var self = this; + + return (self == true) ? (other === false || other === nil) : (other !== false && other !== nil); + }, TMP_Boolean_$_6.$$arity = 1); + + Opal.def(self, '$==', TMP_Boolean_$eq$eq_7 = function(other) { + var self = this; + + return (self == true) === other.valueOf(); + }, TMP_Boolean_$eq$eq_7.$$arity = 1); + Opal.alias(self, "equal?", "=="); + Opal.alias(self, "eql?", "=="); + + Opal.def(self, '$singleton_class', TMP_Boolean_singleton_class_8 = function $$singleton_class() { + var self = this; + + return $$($nesting, 'Boolean') + }, TMP_Boolean_singleton_class_8.$$arity = 0); + + Opal.def(self, '$to_s', TMP_Boolean_to_s_9 = function $$to_s() { + var self = this; + + return (self == true) ? 'true' : 'false'; + }, TMP_Boolean_to_s_9.$$arity = 0); + + Opal.def(self, '$dup', TMP_Boolean_dup_10 = function $$dup() { + var self = this; + + return self + }, TMP_Boolean_dup_10.$$arity = 0); + return (Opal.def(self, '$clone', TMP_Boolean_clone_11 = function $$clone($kwargs) { + var freeze, self = this; + + + + if ($kwargs == null) { + $kwargs = $hash2([], {}); + } else if (!$kwargs.$$is_hash) { + throw Opal.ArgumentError.$new('expected kwargs'); + }; + + freeze = $kwargs.$$smap["freeze"]; + if (freeze == null) { + freeze = true + }; + return self; + }, TMP_Boolean_clone_11.$$arity = -1), nil) && 'clone'; + })($nesting[0], Boolean, $nesting); + Opal.const_set($nesting[0], 'TrueClass', $$($nesting, 'Boolean')); + Opal.const_set($nesting[0], 'FalseClass', $$($nesting, 'Boolean')); + Opal.const_set($nesting[0], 'TRUE', true); + return Opal.const_set($nesting[0], 'FALSE', false); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/comparable"] = function(Opal) { + function $rb_gt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); + } + function $rb_lt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $truthy = Opal.truthy; + + Opal.add_stubs(['$===', '$>', '$<', '$equal?', '$<=>', '$normalize', '$raise', '$class']); + return (function($base, $parent_nesting) { + function $Comparable() {}; + var self = $Comparable = $module($base, 'Comparable', $Comparable); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Comparable_normalize_1, TMP_Comparable_$eq$eq_2, TMP_Comparable_$gt_3, TMP_Comparable_$gt$eq_4, TMP_Comparable_$lt_5, TMP_Comparable_$lt$eq_6, TMP_Comparable_between$q_7, TMP_Comparable_clamp_8; + + + Opal.defs(self, '$normalize', TMP_Comparable_normalize_1 = function $$normalize(what) { + var self = this; + + + if ($truthy($$($nesting, 'Integer')['$==='](what))) { + return what}; + if ($truthy($rb_gt(what, 0))) { + return 1}; + if ($truthy($rb_lt(what, 0))) { + return -1}; + return 0; + }, TMP_Comparable_normalize_1.$$arity = 1); + + Opal.def(self, '$==', TMP_Comparable_$eq$eq_2 = function(other) { + var self = this, cmp = nil; + + try { + + if ($truthy(self['$equal?'](other))) { + return true}; + + if (self["$<=>"] == Opal.Kernel["$<=>"]) { + return false; + } + + // check for infinite recursion + if (self.$$comparable) { + delete self.$$comparable; + return false; + } + ; + if ($truthy((cmp = self['$<=>'](other)))) { + } else { + return false + }; + return $$($nesting, 'Comparable').$normalize(cmp) == 0; + } catch ($err) { + if (Opal.rescue($err, [$$($nesting, 'StandardError')])) { + try { + return false + } finally { Opal.pop_exception() } + } else { throw $err; } + } + }, TMP_Comparable_$eq$eq_2.$$arity = 1); + + Opal.def(self, '$>', TMP_Comparable_$gt_3 = function(other) { + var self = this, cmp = nil; + + + if ($truthy((cmp = self['$<=>'](other)))) { + } else { + self.$raise($$($nesting, 'ArgumentError'), "" + "comparison of " + (self.$class()) + " with " + (other.$class()) + " failed") + }; + return $$($nesting, 'Comparable').$normalize(cmp) > 0; + }, TMP_Comparable_$gt_3.$$arity = 1); + + Opal.def(self, '$>=', TMP_Comparable_$gt$eq_4 = function(other) { + var self = this, cmp = nil; + + + if ($truthy((cmp = self['$<=>'](other)))) { + } else { + self.$raise($$($nesting, 'ArgumentError'), "" + "comparison of " + (self.$class()) + " with " + (other.$class()) + " failed") + }; + return $$($nesting, 'Comparable').$normalize(cmp) >= 0; + }, TMP_Comparable_$gt$eq_4.$$arity = 1); + + Opal.def(self, '$<', TMP_Comparable_$lt_5 = function(other) { + var self = this, cmp = nil; + + + if ($truthy((cmp = self['$<=>'](other)))) { + } else { + self.$raise($$($nesting, 'ArgumentError'), "" + "comparison of " + (self.$class()) + " with " + (other.$class()) + " failed") + }; + return $$($nesting, 'Comparable').$normalize(cmp) < 0; + }, TMP_Comparable_$lt_5.$$arity = 1); + + Opal.def(self, '$<=', TMP_Comparable_$lt$eq_6 = function(other) { + var self = this, cmp = nil; + + + if ($truthy((cmp = self['$<=>'](other)))) { + } else { + self.$raise($$($nesting, 'ArgumentError'), "" + "comparison of " + (self.$class()) + " with " + (other.$class()) + " failed") + }; + return $$($nesting, 'Comparable').$normalize(cmp) <= 0; + }, TMP_Comparable_$lt$eq_6.$$arity = 1); + + Opal.def(self, '$between?', TMP_Comparable_between$q_7 = function(min, max) { + var self = this; + + + if ($rb_lt(self, min)) { + return false}; + if ($rb_gt(self, max)) { + return false}; + return true; + }, TMP_Comparable_between$q_7.$$arity = 2); + + Opal.def(self, '$clamp', TMP_Comparable_clamp_8 = function $$clamp(min, max) { + var self = this, cmp = nil; + + + cmp = min['$<=>'](max); + if ($truthy(cmp)) { + } else { + self.$raise($$($nesting, 'ArgumentError'), "" + "comparison of " + (min.$class()) + " with " + (max.$class()) + " failed") + }; + if ($truthy($rb_gt($$($nesting, 'Comparable').$normalize(cmp), 0))) { + self.$raise($$($nesting, 'ArgumentError'), "min argument must be smaller than max argument")}; + if ($truthy($rb_lt($$($nesting, 'Comparable').$normalize(self['$<=>'](min)), 0))) { + return min}; + if ($truthy($rb_gt($$($nesting, 'Comparable').$normalize(self['$<=>'](max)), 0))) { + return max}; + return self; + }, TMP_Comparable_clamp_8.$$arity = 2); + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/regexp"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $send = Opal.send, $truthy = Opal.truthy, $gvars = Opal.gvars; + + Opal.add_stubs(['$nil?', '$[]', '$raise', '$escape', '$options', '$to_str', '$new', '$join', '$coerce_to!', '$!', '$match', '$coerce_to?', '$begin', '$coerce_to', '$=~', '$attr_reader', '$===', '$inspect', '$to_a']); + + (function($base, $super, $parent_nesting) { + function $RegexpError(){}; + var self = $RegexpError = $klass($base, $super, 'RegexpError', $RegexpError); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return nil + })($nesting[0], $$($nesting, 'StandardError'), $nesting); + (function($base, $super, $parent_nesting) { + function $Regexp(){}; + var self = $Regexp = $klass($base, $super, 'Regexp', $Regexp); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Regexp_$eq$eq_6, TMP_Regexp_$eq$eq$eq_7, TMP_Regexp_$eq$_8, TMP_Regexp_inspect_9, TMP_Regexp_match_10, TMP_Regexp_match$q_11, TMP_Regexp_$_12, TMP_Regexp_source_13, TMP_Regexp_options_14, TMP_Regexp_casefold$q_15; + + + Opal.const_set($nesting[0], 'IGNORECASE', 1); + Opal.const_set($nesting[0], 'EXTENDED', 2); + Opal.const_set($nesting[0], 'MULTILINE', 4); + Opal.defineProperty(RegExp.prototype, '$$is_regexp', true); + (function(self, $parent_nesting) { + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_allocate_1, TMP_escape_2, TMP_last_match_3, TMP_union_4, TMP_new_5; + + + + Opal.def(self, '$allocate', TMP_allocate_1 = function $$allocate() { + var $iter = TMP_allocate_1.$$p, $yield = $iter || nil, self = this, allocated = nil, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_allocate_1.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + + allocated = $send(self, Opal.find_super_dispatcher(self, 'allocate', TMP_allocate_1, false), $zuper, $iter); + allocated.uninitialized = true; + return allocated; + }, TMP_allocate_1.$$arity = 0); + + Opal.def(self, '$escape', TMP_escape_2 = function $$escape(string) { + var self = this; + + return Opal.escape_regexp(string); + }, TMP_escape_2.$$arity = 1); + + Opal.def(self, '$last_match', TMP_last_match_3 = function $$last_match(n) { + var self = this; + if ($gvars["~"] == null) $gvars["~"] = nil; + + + + if (n == null) { + n = nil; + }; + if ($truthy(n['$nil?']())) { + return $gvars["~"] + } else { + return $gvars["~"]['$[]'](n) + }; + }, TMP_last_match_3.$$arity = -1); + Opal.alias(self, "quote", "escape"); + + Opal.def(self, '$union', TMP_union_4 = function $$union($a) { + var $post_args, parts, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + parts = $post_args;; + + var is_first_part_array, quoted_validated, part, options, each_part_options; + if (parts.length == 0) { + return /(?!)/; + } + // return fast if there's only one element + if (parts.length == 1 && parts[0].$$is_regexp) { + return parts[0]; + } + // cover the 2 arrays passed as arguments case + is_first_part_array = parts[0].$$is_array; + if (parts.length > 1 && is_first_part_array) { + self.$raise($$($nesting, 'TypeError'), "no implicit conversion of Array into String") + } + // deal with splat issues (related to https://github.com/opal/opal/issues/858) + if (is_first_part_array) { + parts = parts[0]; + } + options = undefined; + quoted_validated = []; + for (var i=0; i < parts.length; i++) { + part = parts[i]; + if (part.$$is_string) { + quoted_validated.push(self.$escape(part)); + } + else if (part.$$is_regexp) { + each_part_options = (part).$options(); + if (options != undefined && options != each_part_options) { + self.$raise($$($nesting, 'TypeError'), "All expressions must use the same options") + } + options = each_part_options; + quoted_validated.push('('+part.source+')'); + } + else { + quoted_validated.push(self.$escape((part).$to_str())); + } + } + ; + return self.$new((quoted_validated).$join("|"), options); + }, TMP_union_4.$$arity = -1); + return (Opal.def(self, '$new', TMP_new_5 = function(regexp, options) { + var self = this; + + + ; + + if (regexp.$$is_regexp) { + return new RegExp(regexp); + } + + regexp = $$($nesting, 'Opal')['$coerce_to!'](regexp, $$($nesting, 'String'), "to_str"); + + if (regexp.charAt(regexp.length - 1) === '\\' && regexp.charAt(regexp.length - 2) !== '\\') { + self.$raise($$($nesting, 'RegexpError'), "" + "too short escape sequence: /" + (regexp) + "/") + } + + if (options === undefined || options['$!']()) { + return new RegExp(regexp); + } + + if (options.$$is_number) { + var temp = ''; + if ($$($nesting, 'IGNORECASE') & options) { temp += 'i'; } + if ($$($nesting, 'MULTILINE') & options) { temp += 'm'; } + options = temp; + } + else { + options = 'i'; + } + + return new RegExp(regexp, options); + ; + }, TMP_new_5.$$arity = -2), nil) && 'new'; + })(Opal.get_singleton_class(self), $nesting); + + Opal.def(self, '$==', TMP_Regexp_$eq$eq_6 = function(other) { + var self = this; + + return other instanceof RegExp && self.toString() === other.toString(); + }, TMP_Regexp_$eq$eq_6.$$arity = 1); + + Opal.def(self, '$===', TMP_Regexp_$eq$eq$eq_7 = function(string) { + var self = this; + + return self.$match($$($nesting, 'Opal')['$coerce_to?'](string, $$($nesting, 'String'), "to_str")) !== nil + }, TMP_Regexp_$eq$eq$eq_7.$$arity = 1); + + Opal.def(self, '$=~', TMP_Regexp_$eq$_8 = function(string) { + var $a, self = this; + if ($gvars["~"] == null) $gvars["~"] = nil; + + return ($truthy($a = self.$match(string)) ? $gvars["~"].$begin(0) : $a) + }, TMP_Regexp_$eq$_8.$$arity = 1); + Opal.alias(self, "eql?", "=="); + + Opal.def(self, '$inspect', TMP_Regexp_inspect_9 = function $$inspect() { + var self = this; + + + var regexp_format = /^\/(.*)\/([^\/]*)$/; + var value = self.toString(); + var matches = regexp_format.exec(value); + if (matches) { + var regexp_pattern = matches[1]; + var regexp_flags = matches[2]; + var chars = regexp_pattern.split(''); + var chars_length = chars.length; + var char_escaped = false; + var regexp_pattern_escaped = ''; + for (var i = 0; i < chars_length; i++) { + var current_char = chars[i]; + if (!char_escaped && current_char == '/') { + regexp_pattern_escaped = regexp_pattern_escaped.concat('\\'); + } + regexp_pattern_escaped = regexp_pattern_escaped.concat(current_char); + if (current_char == '\\') { + if (char_escaped) { + // does not over escape + char_escaped = false; + } else { + char_escaped = true; + } + } else { + char_escaped = false; + } + } + return '/' + regexp_pattern_escaped + '/' + regexp_flags; + } else { + return value; + } + + }, TMP_Regexp_inspect_9.$$arity = 0); + + Opal.def(self, '$match', TMP_Regexp_match_10 = function $$match(string, pos) { + var $iter = TMP_Regexp_match_10.$$p, block = $iter || nil, self = this; + if ($gvars["~"] == null) $gvars["~"] = nil; + + if ($iter) TMP_Regexp_match_10.$$p = null; + + + if ($iter) TMP_Regexp_match_10.$$p = null;; + ; + + if (self.uninitialized) { + self.$raise($$($nesting, 'TypeError'), "uninitialized Regexp") + } + + if (pos === undefined) { + if (string === nil) return ($gvars["~"] = nil); + var m = self.exec($$($nesting, 'Opal').$coerce_to(string, $$($nesting, 'String'), "to_str")); + if (m) { + ($gvars["~"] = $$($nesting, 'MatchData').$new(self, m)); + return block === nil ? $gvars["~"] : Opal.yield1(block, $gvars["~"]); + } else { + return ($gvars["~"] = nil); + } + } + + pos = $$($nesting, 'Opal').$coerce_to(pos, $$($nesting, 'Integer'), "to_int"); + + if (string === nil) { + return ($gvars["~"] = nil); + } + + string = $$($nesting, 'Opal').$coerce_to(string, $$($nesting, 'String'), "to_str"); + + if (pos < 0) { + pos += string.length; + if (pos < 0) { + return ($gvars["~"] = nil); + } + } + + // global RegExp maintains state, so not using self/this + var md, re = Opal.global_regexp(self); + + while (true) { + md = re.exec(string); + if (md === null) { + return ($gvars["~"] = nil); + } + if (md.index >= pos) { + ($gvars["~"] = $$($nesting, 'MatchData').$new(re, md)); + return block === nil ? $gvars["~"] : Opal.yield1(block, $gvars["~"]); + } + re.lastIndex = md.index + 1; + } + ; + }, TMP_Regexp_match_10.$$arity = -2); + + Opal.def(self, '$match?', TMP_Regexp_match$q_11 = function(string, pos) { + var self = this; + + + ; + + if (self.uninitialized) { + self.$raise($$($nesting, 'TypeError'), "uninitialized Regexp") + } + + if (pos === undefined) { + return string === nil ? false : self.test($$($nesting, 'Opal').$coerce_to(string, $$($nesting, 'String'), "to_str")); + } + + pos = $$($nesting, 'Opal').$coerce_to(pos, $$($nesting, 'Integer'), "to_int"); + + if (string === nil) { + return false; + } + + string = $$($nesting, 'Opal').$coerce_to(string, $$($nesting, 'String'), "to_str"); + + if (pos < 0) { + pos += string.length; + if (pos < 0) { + return false; + } + } + + // global RegExp maintains state, so not using self/this + var md, re = Opal.global_regexp(self); + + md = re.exec(string); + if (md === null || md.index < pos) { + return false; + } else { + return true; + } + ; + }, TMP_Regexp_match$q_11.$$arity = -2); + + Opal.def(self, '$~', TMP_Regexp_$_12 = function() { + var self = this; + if ($gvars._ == null) $gvars._ = nil; + + return self['$=~']($gvars._) + }, TMP_Regexp_$_12.$$arity = 0); + + Opal.def(self, '$source', TMP_Regexp_source_13 = function $$source() { + var self = this; + + return self.source; + }, TMP_Regexp_source_13.$$arity = 0); + + Opal.def(self, '$options', TMP_Regexp_options_14 = function $$options() { + var self = this; + + + if (self.uninitialized) { + self.$raise($$($nesting, 'TypeError'), "uninitialized Regexp") + } + var result = 0; + // should be supported in IE6 according to https://msdn.microsoft.com/en-us/library/7f5z26w4(v=vs.94).aspx + if (self.multiline) { + result |= $$($nesting, 'MULTILINE'); + } + if (self.ignoreCase) { + result |= $$($nesting, 'IGNORECASE'); + } + return result; + + }, TMP_Regexp_options_14.$$arity = 0); + + Opal.def(self, '$casefold?', TMP_Regexp_casefold$q_15 = function() { + var self = this; + + return self.ignoreCase; + }, TMP_Regexp_casefold$q_15.$$arity = 0); + return Opal.alias(self, "to_s", "source"); + })($nesting[0], RegExp, $nesting); + return (function($base, $super, $parent_nesting) { + function $MatchData(){}; + var self = $MatchData = $klass($base, $super, 'MatchData', $MatchData); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_MatchData_initialize_16, TMP_MatchData_$$_17, TMP_MatchData_offset_18, TMP_MatchData_$eq$eq_19, TMP_MatchData_begin_20, TMP_MatchData_end_21, TMP_MatchData_captures_22, TMP_MatchData_inspect_23, TMP_MatchData_length_24, TMP_MatchData_to_a_25, TMP_MatchData_to_s_26, TMP_MatchData_values_at_27; + + def.matches = nil; + + self.$attr_reader("post_match", "pre_match", "regexp", "string"); + + Opal.def(self, '$initialize', TMP_MatchData_initialize_16 = function $$initialize(regexp, match_groups) { + var self = this; + + + $gvars["~"] = self; + self.regexp = regexp; + self.begin = match_groups.index; + self.string = match_groups.input; + self.pre_match = match_groups.input.slice(0, match_groups.index); + self.post_match = match_groups.input.slice(match_groups.index + match_groups[0].length); + self.matches = []; + + for (var i = 0, length = match_groups.length; i < length; i++) { + var group = match_groups[i]; + + if (group == null) { + self.matches.push(nil); + } + else { + self.matches.push(group); + } + } + ; + }, TMP_MatchData_initialize_16.$$arity = 2); + + Opal.def(self, '$[]', TMP_MatchData_$$_17 = function($a) { + var $post_args, args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + return $send(self.matches, '[]', Opal.to_a(args)); + }, TMP_MatchData_$$_17.$$arity = -1); + + Opal.def(self, '$offset', TMP_MatchData_offset_18 = function $$offset(n) { + var self = this; + + + if (n !== 0) { + self.$raise($$($nesting, 'ArgumentError'), "MatchData#offset only supports 0th element") + } + return [self.begin, self.begin + self.matches[n].length]; + + }, TMP_MatchData_offset_18.$$arity = 1); + + Opal.def(self, '$==', TMP_MatchData_$eq$eq_19 = function(other) { + var $a, $b, $c, $d, self = this; + + + if ($truthy($$($nesting, 'MatchData')['$==='](other))) { + } else { + return false + }; + return ($truthy($a = ($truthy($b = ($truthy($c = ($truthy($d = self.string == other.string) ? self.regexp.toString() == other.regexp.toString() : $d)) ? self.pre_match == other.pre_match : $c)) ? self.post_match == other.post_match : $b)) ? self.begin == other.begin : $a); + }, TMP_MatchData_$eq$eq_19.$$arity = 1); + Opal.alias(self, "eql?", "=="); + + Opal.def(self, '$begin', TMP_MatchData_begin_20 = function $$begin(n) { + var self = this; + + + if (n !== 0) { + self.$raise($$($nesting, 'ArgumentError'), "MatchData#begin only supports 0th element") + } + return self.begin; + + }, TMP_MatchData_begin_20.$$arity = 1); + + Opal.def(self, '$end', TMP_MatchData_end_21 = function $$end(n) { + var self = this; + + + if (n !== 0) { + self.$raise($$($nesting, 'ArgumentError'), "MatchData#end only supports 0th element") + } + return self.begin + self.matches[n].length; + + }, TMP_MatchData_end_21.$$arity = 1); + + Opal.def(self, '$captures', TMP_MatchData_captures_22 = function $$captures() { + var self = this; + + return self.matches.slice(1) + }, TMP_MatchData_captures_22.$$arity = 0); + + Opal.def(self, '$inspect', TMP_MatchData_inspect_23 = function $$inspect() { + var self = this; + + + var str = "#"; + + }, TMP_MatchData_inspect_23.$$arity = 0); + + Opal.def(self, '$length', TMP_MatchData_length_24 = function $$length() { + var self = this; + + return self.matches.length + }, TMP_MatchData_length_24.$$arity = 0); + Opal.alias(self, "size", "length"); + + Opal.def(self, '$to_a', TMP_MatchData_to_a_25 = function $$to_a() { + var self = this; + + return self.matches + }, TMP_MatchData_to_a_25.$$arity = 0); + + Opal.def(self, '$to_s', TMP_MatchData_to_s_26 = function $$to_s() { + var self = this; + + return self.matches[0] + }, TMP_MatchData_to_s_26.$$arity = 0); + return (Opal.def(self, '$values_at', TMP_MatchData_values_at_27 = function $$values_at($a) { + var $post_args, args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + + var i, a, index, values = []; + + for (i = 0; i < args.length; i++) { + + if (args[i].$$is_range) { + a = (args[i]).$to_a(); + a.unshift(i, 1); + Array.prototype.splice.apply(args, a); + } + + index = $$($nesting, 'Opal')['$coerce_to!'](args[i], $$($nesting, 'Integer'), "to_int"); + + if (index < 0) { + index += self.matches.length; + if (index < 0) { + values.push(nil); + continue; + } + } + + values.push(self.matches[index]); + } + + return values; + ; + }, TMP_MatchData_values_at_27.$$arity = -1), nil) && 'values_at'; + })($nesting[0], null, $nesting); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/string"] = function(Opal) { + function $rb_divide(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs / rhs : lhs['$/'](rhs); + } + function $rb_plus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $truthy = Opal.truthy, $send = Opal.send, $gvars = Opal.gvars; + + Opal.add_stubs(['$require', '$include', '$coerce_to?', '$coerce_to', '$raise', '$===', '$format', '$to_s', '$respond_to?', '$to_str', '$<=>', '$==', '$=~', '$new', '$force_encoding', '$casecmp', '$empty?', '$ljust', '$ceil', '$/', '$+', '$rjust', '$floor', '$to_a', '$each_char', '$to_proc', '$coerce_to!', '$copy_singleton_methods', '$initialize_clone', '$initialize_dup', '$enum_for', '$size', '$chomp', '$[]', '$to_i', '$each_line', '$class', '$match', '$match?', '$captures', '$proc', '$succ', '$escape']); + + self.$require("corelib/comparable"); + self.$require("corelib/regexp"); + (function($base, $super, $parent_nesting) { + function $String(){}; + var self = $String = $klass($base, $super, 'String', $String); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_String___id___1, TMP_String_try_convert_2, TMP_String_new_3, TMP_String_initialize_4, TMP_String_$_5, TMP_String_$_6, TMP_String_$_7, TMP_String_$lt$eq$gt_8, TMP_String_$eq$eq_9, TMP_String_$eq$_10, TMP_String_$$_11, TMP_String_b_12, TMP_String_capitalize_13, TMP_String_casecmp_14, TMP_String_casecmp$q_15, TMP_String_center_16, TMP_String_chars_17, TMP_String_chomp_18, TMP_String_chop_19, TMP_String_chr_20, TMP_String_clone_21, TMP_String_dup_22, TMP_String_count_23, TMP_String_delete_24, TMP_String_delete_prefix_25, TMP_String_delete_suffix_26, TMP_String_downcase_27, TMP_String_each_char_28, TMP_String_each_line_30, TMP_String_empty$q_31, TMP_String_end_with$q_32, TMP_String_gsub_33, TMP_String_hash_34, TMP_String_hex_35, TMP_String_include$q_36, TMP_String_index_37, TMP_String_inspect_38, TMP_String_intern_39, TMP_String_lines_40, TMP_String_length_41, TMP_String_ljust_42, TMP_String_lstrip_43, TMP_String_ascii_only$q_44, TMP_String_match_45, TMP_String_match$q_46, TMP_String_next_47, TMP_String_oct_48, TMP_String_ord_49, TMP_String_partition_50, TMP_String_reverse_51, TMP_String_rindex_52, TMP_String_rjust_53, TMP_String_rpartition_54, TMP_String_rstrip_55, TMP_String_scan_56, TMP_String_split_57, TMP_String_squeeze_58, TMP_String_start_with$q_59, TMP_String_strip_60, TMP_String_sub_61, TMP_String_sum_62, TMP_String_swapcase_63, TMP_String_to_f_64, TMP_String_to_i_65, TMP_String_to_proc_66, TMP_String_to_s_68, TMP_String_tr_69, TMP_String_tr_s_70, TMP_String_upcase_71, TMP_String_upto_72, TMP_String_instance_variables_73, TMP_String__load_74, TMP_String_unicode_normalize_75, TMP_String_unicode_normalized$q_76, TMP_String_unpack_77, TMP_String_unpack1_78; + + + self.$include($$($nesting, 'Comparable')); + + Opal.defineProperty(String.prototype, '$$is_string', true); + + Opal.defineProperty(String.prototype, '$$cast', function(string) { + var klass = this.$$class; + if (klass === String) { + return string; + } else { + return new klass(string); + } + }); + ; + + Opal.def(self, '$__id__', TMP_String___id___1 = function $$__id__() { + var self = this; + + return self.toString(); + }, TMP_String___id___1.$$arity = 0); + Opal.alias(self, "object_id", "__id__"); + Opal.defs(self, '$try_convert', TMP_String_try_convert_2 = function $$try_convert(what) { + var self = this; + + return $$($nesting, 'Opal')['$coerce_to?'](what, $$($nesting, 'String'), "to_str") + }, TMP_String_try_convert_2.$$arity = 1); + Opal.defs(self, '$new', TMP_String_new_3 = function(str) { + var self = this; + + + + if (str == null) { + str = ""; + }; + str = $$($nesting, 'Opal').$coerce_to(str, $$($nesting, 'String'), "to_str"); + return new self(str);; + }, TMP_String_new_3.$$arity = -1); + + Opal.def(self, '$initialize', TMP_String_initialize_4 = function $$initialize(str) { + var self = this; + + + ; + + if (str === undefined) { + return self; + } + ; + return self.$raise($$($nesting, 'NotImplementedError'), "Mutable strings are not supported in Opal."); + }, TMP_String_initialize_4.$$arity = -1); + + Opal.def(self, '$%', TMP_String_$_5 = function(data) { + var self = this; + + if ($truthy($$($nesting, 'Array')['$==='](data))) { + return $send(self, 'format', [self].concat(Opal.to_a(data))) + } else { + return self.$format(self, data) + } + }, TMP_String_$_5.$$arity = 1); + + Opal.def(self, '$*', TMP_String_$_6 = function(count) { + var self = this; + + + count = $$($nesting, 'Opal').$coerce_to(count, $$($nesting, 'Integer'), "to_int"); + + if (count < 0) { + self.$raise($$($nesting, 'ArgumentError'), "negative argument") + } + + if (count === 0) { + return self.$$cast(''); + } + + var result = '', + string = self.toString(); + + // All credit for the bit-twiddling magic code below goes to Mozilla + // polyfill implementation of String.prototype.repeat() posted here: + // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/repeat + + if (string.length * count >= 1 << 28) { + self.$raise($$($nesting, 'RangeError'), "multiply count must not overflow maximum string size") + } + + for (;;) { + if ((count & 1) === 1) { + result += string; + } + count >>>= 1; + if (count === 0) { + break; + } + string += string; + } + + return self.$$cast(result); + + }, TMP_String_$_6.$$arity = 1); + + Opal.def(self, '$+', TMP_String_$_7 = function(other) { + var self = this; + + + other = $$($nesting, 'Opal').$coerce_to(other, $$($nesting, 'String'), "to_str"); + return self + other.$to_s(); + }, TMP_String_$_7.$$arity = 1); + + Opal.def(self, '$<=>', TMP_String_$lt$eq$gt_8 = function(other) { + var self = this; + + if ($truthy(other['$respond_to?']("to_str"))) { + + other = other.$to_str().$to_s(); + return self > other ? 1 : (self < other ? -1 : 0);; + } else { + + var cmp = other['$<=>'](self); + + if (cmp === nil) { + return nil; + } + else { + return cmp > 0 ? -1 : (cmp < 0 ? 1 : 0); + } + + } + }, TMP_String_$lt$eq$gt_8.$$arity = 1); + + Opal.def(self, '$==', TMP_String_$eq$eq_9 = function(other) { + var self = this; + + + if (other.$$is_string) { + return self.toString() === other.toString(); + } + if ($$($nesting, 'Opal')['$respond_to?'](other, "to_str")) { + return other['$=='](self); + } + return false; + + }, TMP_String_$eq$eq_9.$$arity = 1); + Opal.alias(self, "eql?", "=="); + Opal.alias(self, "===", "=="); + + Opal.def(self, '$=~', TMP_String_$eq$_10 = function(other) { + var self = this; + + + if (other.$$is_string) { + self.$raise($$($nesting, 'TypeError'), "type mismatch: String given"); + } + + return other['$=~'](self); + + }, TMP_String_$eq$_10.$$arity = 1); + + Opal.def(self, '$[]', TMP_String_$$_11 = function(index, length) { + var self = this; + + + ; + + var size = self.length, exclude; + + if (index.$$is_range) { + exclude = index.excl; + length = $$($nesting, 'Opal').$coerce_to(index.end, $$($nesting, 'Integer'), "to_int"); + index = $$($nesting, 'Opal').$coerce_to(index.begin, $$($nesting, 'Integer'), "to_int"); + + if (Math.abs(index) > size) { + return nil; + } + + if (index < 0) { + index += size; + } + + if (length < 0) { + length += size; + } + + if (!exclude) { + length += 1; + } + + length = length - index; + + if (length < 0) { + length = 0; + } + + return self.$$cast(self.substr(index, length)); + } + + + if (index.$$is_string) { + if (length != null) { + self.$raise($$($nesting, 'TypeError')) + } + return self.indexOf(index) !== -1 ? self.$$cast(index) : nil; + } + + + if (index.$$is_regexp) { + var match = self.match(index); + + if (match === null) { + ($gvars["~"] = nil) + return nil; + } + + ($gvars["~"] = $$($nesting, 'MatchData').$new(index, match)) + + if (length == null) { + return self.$$cast(match[0]); + } + + length = $$($nesting, 'Opal').$coerce_to(length, $$($nesting, 'Integer'), "to_int"); + + if (length < 0 && -length < match.length) { + return self.$$cast(match[length += match.length]); + } + + if (length >= 0 && length < match.length) { + return self.$$cast(match[length]); + } + + return nil; + } + + + index = $$($nesting, 'Opal').$coerce_to(index, $$($nesting, 'Integer'), "to_int"); + + if (index < 0) { + index += size; + } + + if (length == null) { + if (index >= size || index < 0) { + return nil; + } + return self.$$cast(self.substr(index, 1)); + } + + length = $$($nesting, 'Opal').$coerce_to(length, $$($nesting, 'Integer'), "to_int"); + + if (length < 0) { + return nil; + } + + if (index > size || index < 0) { + return nil; + } + + return self.$$cast(self.substr(index, length)); + ; + }, TMP_String_$$_11.$$arity = -2); + Opal.alias(self, "byteslice", "[]"); + + Opal.def(self, '$b', TMP_String_b_12 = function $$b() { + var self = this; + + return self.$force_encoding("binary") + }, TMP_String_b_12.$$arity = 0); + + Opal.def(self, '$capitalize', TMP_String_capitalize_13 = function $$capitalize() { + var self = this; + + return self.$$cast(self.charAt(0).toUpperCase() + self.substr(1).toLowerCase()); + }, TMP_String_capitalize_13.$$arity = 0); + + Opal.def(self, '$casecmp', TMP_String_casecmp_14 = function $$casecmp(other) { + var self = this; + + + if ($truthy(other['$respond_to?']("to_str"))) { + } else { + return nil + }; + other = $$($nesting, 'Opal').$coerce_to(other, $$($nesting, 'String'), "to_str").$to_s(); + + var ascii_only = /^[\x00-\x7F]*$/; + if (ascii_only.test(self) && ascii_only.test(other)) { + self = self.toLowerCase(); + other = other.toLowerCase(); + } + ; + return self['$<=>'](other); + }, TMP_String_casecmp_14.$$arity = 1); + + Opal.def(self, '$casecmp?', TMP_String_casecmp$q_15 = function(other) { + var self = this; + + + var cmp = self.$casecmp(other); + if (cmp === nil) { + return nil; + } else { + return cmp === 0; + } + + }, TMP_String_casecmp$q_15.$$arity = 1); + + Opal.def(self, '$center', TMP_String_center_16 = function $$center(width, padstr) { + var self = this; + + + + if (padstr == null) { + padstr = " "; + }; + width = $$($nesting, 'Opal').$coerce_to(width, $$($nesting, 'Integer'), "to_int"); + padstr = $$($nesting, 'Opal').$coerce_to(padstr, $$($nesting, 'String'), "to_str").$to_s(); + if ($truthy(padstr['$empty?']())) { + self.$raise($$($nesting, 'ArgumentError'), "zero width padding")}; + if ($truthy(width <= self.length)) { + return self}; + + var ljustified = self.$ljust($rb_divide($rb_plus(width, self.length), 2).$ceil(), padstr), + rjustified = self.$rjust($rb_divide($rb_plus(width, self.length), 2).$floor(), padstr); + + return self.$$cast(rjustified + ljustified.slice(self.length)); + ; + }, TMP_String_center_16.$$arity = -2); + + Opal.def(self, '$chars', TMP_String_chars_17 = function $$chars() { + var $iter = TMP_String_chars_17.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_String_chars_17.$$p = null; + + + if ($iter) TMP_String_chars_17.$$p = null;; + if ($truthy(block)) { + } else { + return self.$each_char().$to_a() + }; + return $send(self, 'each_char', [], block.$to_proc()); + }, TMP_String_chars_17.$$arity = 0); + + Opal.def(self, '$chomp', TMP_String_chomp_18 = function $$chomp(separator) { + var self = this; + if ($gvars["/"] == null) $gvars["/"] = nil; + + + + if (separator == null) { + separator = $gvars["/"]; + }; + if ($truthy(separator === nil || self.length === 0)) { + return self}; + separator = $$($nesting, 'Opal')['$coerce_to!'](separator, $$($nesting, 'String'), "to_str").$to_s(); + + var result; + + if (separator === "\n") { + result = self.replace(/\r?\n?$/, ''); + } + else if (separator === "") { + result = self.replace(/(\r?\n)+$/, ''); + } + else if (self.length > separator.length) { + var tail = self.substr(self.length - separator.length, separator.length); + + if (tail === separator) { + result = self.substr(0, self.length - separator.length); + } + } + + if (result != null) { + return self.$$cast(result); + } + ; + return self; + }, TMP_String_chomp_18.$$arity = -1); + + Opal.def(self, '$chop', TMP_String_chop_19 = function $$chop() { + var self = this; + + + var length = self.length, result; + + if (length <= 1) { + result = ""; + } else if (self.charAt(length - 1) === "\n" && self.charAt(length - 2) === "\r") { + result = self.substr(0, length - 2); + } else { + result = self.substr(0, length - 1); + } + + return self.$$cast(result); + + }, TMP_String_chop_19.$$arity = 0); + + Opal.def(self, '$chr', TMP_String_chr_20 = function $$chr() { + var self = this; + + return self.charAt(0); + }, TMP_String_chr_20.$$arity = 0); + + Opal.def(self, '$clone', TMP_String_clone_21 = function $$clone() { + var self = this, copy = nil; + + + copy = self.slice(); + copy.$copy_singleton_methods(self); + copy.$initialize_clone(self); + return copy; + }, TMP_String_clone_21.$$arity = 0); + + Opal.def(self, '$dup', TMP_String_dup_22 = function $$dup() { + var self = this, copy = nil; + + + copy = self.slice(); + copy.$initialize_dup(self); + return copy; + }, TMP_String_dup_22.$$arity = 0); + + Opal.def(self, '$count', TMP_String_count_23 = function $$count($a) { + var $post_args, sets, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + sets = $post_args;; + + if (sets.length === 0) { + self.$raise($$($nesting, 'ArgumentError'), "ArgumentError: wrong number of arguments (0 for 1+)") + } + var char_class = char_class_from_char_sets(sets); + if (char_class === null) { + return 0; + } + return self.length - self.replace(new RegExp(char_class, 'g'), '').length; + ; + }, TMP_String_count_23.$$arity = -1); + + Opal.def(self, '$delete', TMP_String_delete_24 = function($a) { + var $post_args, sets, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + sets = $post_args;; + + if (sets.length === 0) { + self.$raise($$($nesting, 'ArgumentError'), "ArgumentError: wrong number of arguments (0 for 1+)") + } + var char_class = char_class_from_char_sets(sets); + if (char_class === null) { + return self; + } + return self.$$cast(self.replace(new RegExp(char_class, 'g'), '')); + ; + }, TMP_String_delete_24.$$arity = -1); + + Opal.def(self, '$delete_prefix', TMP_String_delete_prefix_25 = function $$delete_prefix(prefix) { + var self = this; + + + if (!prefix.$$is_string) { + (prefix = $$($nesting, 'Opal').$coerce_to(prefix, $$($nesting, 'String'), "to_str")) + } + + if (self.slice(0, prefix.length) === prefix) { + return self.$$cast(self.slice(prefix.length)); + } else { + return self; + } + + }, TMP_String_delete_prefix_25.$$arity = 1); + + Opal.def(self, '$delete_suffix', TMP_String_delete_suffix_26 = function $$delete_suffix(suffix) { + var self = this; + + + if (!suffix.$$is_string) { + (suffix = $$($nesting, 'Opal').$coerce_to(suffix, $$($nesting, 'String'), "to_str")) + } + + if (self.slice(self.length - suffix.length) === suffix) { + return self.$$cast(self.slice(0, self.length - suffix.length)); + } else { + return self; + } + + }, TMP_String_delete_suffix_26.$$arity = 1); + + Opal.def(self, '$downcase', TMP_String_downcase_27 = function $$downcase() { + var self = this; + + return self.$$cast(self.toLowerCase()); + }, TMP_String_downcase_27.$$arity = 0); + + Opal.def(self, '$each_char', TMP_String_each_char_28 = function $$each_char() { + var $iter = TMP_String_each_char_28.$$p, block = $iter || nil, TMP_29, self = this; + + if ($iter) TMP_String_each_char_28.$$p = null; + + + if ($iter) TMP_String_each_char_28.$$p = null;; + if ((block !== nil)) { + } else { + return $send(self, 'enum_for', ["each_char"], (TMP_29 = function(){var self = TMP_29.$$s || this; + + return self.$size()}, TMP_29.$$s = self, TMP_29.$$arity = 0, TMP_29)) + }; + + for (var i = 0, length = self.length; i < length; i++) { + Opal.yield1(block, self.charAt(i)); + } + ; + return self; + }, TMP_String_each_char_28.$$arity = 0); + + Opal.def(self, '$each_line', TMP_String_each_line_30 = function $$each_line(separator) { + var $iter = TMP_String_each_line_30.$$p, block = $iter || nil, self = this; + if ($gvars["/"] == null) $gvars["/"] = nil; + + if ($iter) TMP_String_each_line_30.$$p = null; + + + if ($iter) TMP_String_each_line_30.$$p = null;; + + if (separator == null) { + separator = $gvars["/"]; + }; + if ((block !== nil)) { + } else { + return self.$enum_for("each_line", separator) + }; + + if (separator === nil) { + Opal.yield1(block, self); + + return self; + } + + separator = $$($nesting, 'Opal').$coerce_to(separator, $$($nesting, 'String'), "to_str") + + var a, i, n, length, chomped, trailing, splitted; + + if (separator.length === 0) { + for (a = self.split(/(\n{2,})/), i = 0, n = a.length; i < n; i += 2) { + if (a[i] || a[i + 1]) { + var value = (a[i] || "") + (a[i + 1] || ""); + Opal.yield1(block, self.$$cast(value)); + } + } + + return self; + } + + chomped = self.$chomp(separator); + trailing = self.length != chomped.length; + splitted = chomped.split(separator); + + for (i = 0, length = splitted.length; i < length; i++) { + if (i < length - 1 || trailing) { + Opal.yield1(block, self.$$cast(splitted[i] + separator)); + } + else { + Opal.yield1(block, self.$$cast(splitted[i])); + } + } + ; + return self; + }, TMP_String_each_line_30.$$arity = -1); + + Opal.def(self, '$empty?', TMP_String_empty$q_31 = function() { + var self = this; + + return self.length === 0; + }, TMP_String_empty$q_31.$$arity = 0); + + Opal.def(self, '$end_with?', TMP_String_end_with$q_32 = function($a) { + var $post_args, suffixes, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + suffixes = $post_args;; + + for (var i = 0, length = suffixes.length; i < length; i++) { + var suffix = $$($nesting, 'Opal').$coerce_to(suffixes[i], $$($nesting, 'String'), "to_str").$to_s(); + + if (self.length >= suffix.length && + self.substr(self.length - suffix.length, suffix.length) == suffix) { + return true; + } + } + ; + return false; + }, TMP_String_end_with$q_32.$$arity = -1); + Opal.alias(self, "equal?", "==="); + + Opal.def(self, '$gsub', TMP_String_gsub_33 = function $$gsub(pattern, replacement) { + var $iter = TMP_String_gsub_33.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_String_gsub_33.$$p = null; + + + if ($iter) TMP_String_gsub_33.$$p = null;; + ; + + if (replacement === undefined && block === nil) { + return self.$enum_for("gsub", pattern); + } + + var result = '', match_data = nil, index = 0, match, _replacement; + + if (pattern.$$is_regexp) { + pattern = Opal.global_multiline_regexp(pattern); + } else { + pattern = $$($nesting, 'Opal').$coerce_to(pattern, $$($nesting, 'String'), "to_str"); + pattern = new RegExp(pattern.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'), 'gm'); + } + + var lastIndex; + while (true) { + match = pattern.exec(self); + + if (match === null) { + ($gvars["~"] = nil) + result += self.slice(index); + break; + } + + match_data = $$($nesting, 'MatchData').$new(pattern, match); + + if (replacement === undefined) { + lastIndex = pattern.lastIndex; + _replacement = block(match[0]); + pattern.lastIndex = lastIndex; // save and restore lastIndex + } + else if (replacement.$$is_hash) { + _replacement = (replacement)['$[]'](match[0]).$to_s(); + } + else { + if (!replacement.$$is_string) { + replacement = $$($nesting, 'Opal').$coerce_to(replacement, $$($nesting, 'String'), "to_str"); + } + _replacement = replacement.replace(/([\\]+)([0-9+&`'])/g, function (original, slashes, command) { + if (slashes.length % 2 === 0) { + return original; + } + switch (command) { + case "+": + for (var i = match.length - 1; i > 0; i--) { + if (match[i] !== undefined) { + return slashes.slice(1) + match[i]; + } + } + return ''; + case "&": return slashes.slice(1) + match[0]; + case "`": return slashes.slice(1) + self.slice(0, match.index); + case "'": return slashes.slice(1) + self.slice(match.index + match[0].length); + default: return slashes.slice(1) + (match[command] || ''); + } + }).replace(/\\\\/g, '\\'); + } + + if (pattern.lastIndex === match.index) { + result += (_replacement + self.slice(index, match.index + 1)) + pattern.lastIndex += 1; + } + else { + result += (self.slice(index, match.index) + _replacement) + } + index = pattern.lastIndex; + } + + ($gvars["~"] = match_data) + return self.$$cast(result); + ; + }, TMP_String_gsub_33.$$arity = -2); + + Opal.def(self, '$hash', TMP_String_hash_34 = function $$hash() { + var self = this; + + return self.toString(); + }, TMP_String_hash_34.$$arity = 0); + + Opal.def(self, '$hex', TMP_String_hex_35 = function $$hex() { + var self = this; + + return self.$to_i(16) + }, TMP_String_hex_35.$$arity = 0); + + Opal.def(self, '$include?', TMP_String_include$q_36 = function(other) { + var self = this; + + + if (!other.$$is_string) { + (other = $$($nesting, 'Opal').$coerce_to(other, $$($nesting, 'String'), "to_str")) + } + return self.indexOf(other) !== -1; + + }, TMP_String_include$q_36.$$arity = 1); + + Opal.def(self, '$index', TMP_String_index_37 = function $$index(search, offset) { + var self = this; + + + ; + + var index, + match, + regex; + + if (offset === undefined) { + offset = 0; + } else { + offset = $$($nesting, 'Opal').$coerce_to(offset, $$($nesting, 'Integer'), "to_int"); + if (offset < 0) { + offset += self.length; + if (offset < 0) { + return nil; + } + } + } + + if (search.$$is_regexp) { + regex = Opal.global_multiline_regexp(search); + while (true) { + match = regex.exec(self); + if (match === null) { + ($gvars["~"] = nil); + index = -1; + break; + } + if (match.index >= offset) { + ($gvars["~"] = $$($nesting, 'MatchData').$new(regex, match)) + index = match.index; + break; + } + regex.lastIndex = match.index + 1; + } + } else { + search = $$($nesting, 'Opal').$coerce_to(search, $$($nesting, 'String'), "to_str"); + if (search.length === 0 && offset > self.length) { + index = -1; + } else { + index = self.indexOf(search, offset); + } + } + + return index === -1 ? nil : index; + ; + }, TMP_String_index_37.$$arity = -2); + + Opal.def(self, '$inspect', TMP_String_inspect_38 = function $$inspect() { + var self = this; + + + var escapable = /[\\\"\x00-\x1f\u007F-\u009F\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, + meta = { + '\u0007': '\\a', + '\u001b': '\\e', + '\b': '\\b', + '\t': '\\t', + '\n': '\\n', + '\f': '\\f', + '\r': '\\r', + '\v': '\\v', + '"' : '\\"', + '\\': '\\\\' + }, + escaped = self.replace(escapable, function (chr) { + return meta[chr] || '\\u' + ('0000' + chr.charCodeAt(0).toString(16).toUpperCase()).slice(-4); + }); + return '"' + escaped.replace(/\#[\$\@\{]/g, '\\$&') + '"'; + + }, TMP_String_inspect_38.$$arity = 0); + + Opal.def(self, '$intern', TMP_String_intern_39 = function $$intern() { + var self = this; + + return self.toString(); + }, TMP_String_intern_39.$$arity = 0); + + Opal.def(self, '$lines', TMP_String_lines_40 = function $$lines(separator) { + var $iter = TMP_String_lines_40.$$p, block = $iter || nil, self = this, e = nil; + if ($gvars["/"] == null) $gvars["/"] = nil; + + if ($iter) TMP_String_lines_40.$$p = null; + + + if ($iter) TMP_String_lines_40.$$p = null;; + + if (separator == null) { + separator = $gvars["/"]; + }; + e = $send(self, 'each_line', [separator], block.$to_proc()); + if ($truthy(block)) { + return self + } else { + return e.$to_a() + }; + }, TMP_String_lines_40.$$arity = -1); + + Opal.def(self, '$length', TMP_String_length_41 = function $$length() { + var self = this; + + return self.length; + }, TMP_String_length_41.$$arity = 0); + + Opal.def(self, '$ljust', TMP_String_ljust_42 = function $$ljust(width, padstr) { + var self = this; + + + + if (padstr == null) { + padstr = " "; + }; + width = $$($nesting, 'Opal').$coerce_to(width, $$($nesting, 'Integer'), "to_int"); + padstr = $$($nesting, 'Opal').$coerce_to(padstr, $$($nesting, 'String'), "to_str").$to_s(); + if ($truthy(padstr['$empty?']())) { + self.$raise($$($nesting, 'ArgumentError'), "zero width padding")}; + if ($truthy(width <= self.length)) { + return self}; + + var index = -1, + result = ""; + + width -= self.length; + + while (++index < width) { + result += padstr; + } + + return self.$$cast(self + result.slice(0, width)); + ; + }, TMP_String_ljust_42.$$arity = -2); + + Opal.def(self, '$lstrip', TMP_String_lstrip_43 = function $$lstrip() { + var self = this; + + return self.replace(/^\s*/, ''); + }, TMP_String_lstrip_43.$$arity = 0); + + Opal.def(self, '$ascii_only?', TMP_String_ascii_only$q_44 = function() { + var self = this; + + return self.match(/[ -~\n]*/)[0] === self; + }, TMP_String_ascii_only$q_44.$$arity = 0); + + Opal.def(self, '$match', TMP_String_match_45 = function $$match(pattern, pos) { + var $iter = TMP_String_match_45.$$p, block = $iter || nil, $a, self = this; + + if ($iter) TMP_String_match_45.$$p = null; + + + if ($iter) TMP_String_match_45.$$p = null;; + ; + if ($truthy(($truthy($a = $$($nesting, 'String')['$==='](pattern)) ? $a : pattern['$respond_to?']("to_str")))) { + pattern = $$($nesting, 'Regexp').$new(pattern.$to_str())}; + if ($truthy($$($nesting, 'Regexp')['$==='](pattern))) { + } else { + self.$raise($$($nesting, 'TypeError'), "" + "wrong argument type " + (pattern.$class()) + " (expected Regexp)") + }; + return $send(pattern, 'match', [self, pos], block.$to_proc()); + }, TMP_String_match_45.$$arity = -2); + + Opal.def(self, '$match?', TMP_String_match$q_46 = function(pattern, pos) { + var $a, self = this; + + + ; + if ($truthy(($truthy($a = $$($nesting, 'String')['$==='](pattern)) ? $a : pattern['$respond_to?']("to_str")))) { + pattern = $$($nesting, 'Regexp').$new(pattern.$to_str())}; + if ($truthy($$($nesting, 'Regexp')['$==='](pattern))) { + } else { + self.$raise($$($nesting, 'TypeError'), "" + "wrong argument type " + (pattern.$class()) + " (expected Regexp)") + }; + return pattern['$match?'](self, pos); + }, TMP_String_match$q_46.$$arity = -2); + + Opal.def(self, '$next', TMP_String_next_47 = function $$next() { + var self = this; + + + var i = self.length; + if (i === 0) { + return self.$$cast(''); + } + var result = self; + var first_alphanum_char_index = self.search(/[a-zA-Z0-9]/); + var carry = false; + var code; + while (i--) { + code = self.charCodeAt(i); + if ((code >= 48 && code <= 57) || + (code >= 65 && code <= 90) || + (code >= 97 && code <= 122)) { + switch (code) { + case 57: + carry = true; + code = 48; + break; + case 90: + carry = true; + code = 65; + break; + case 122: + carry = true; + code = 97; + break; + default: + carry = false; + code += 1; + } + } else { + if (first_alphanum_char_index === -1) { + if (code === 255) { + carry = true; + code = 0; + } else { + carry = false; + code += 1; + } + } else { + carry = true; + } + } + result = result.slice(0, i) + String.fromCharCode(code) + result.slice(i + 1); + if (carry && (i === 0 || i === first_alphanum_char_index)) { + switch (code) { + case 65: + break; + case 97: + break; + default: + code += 1; + } + if (i === 0) { + result = String.fromCharCode(code) + result; + } else { + result = result.slice(0, i) + String.fromCharCode(code) + result.slice(i); + } + carry = false; + } + if (!carry) { + break; + } + } + return self.$$cast(result); + + }, TMP_String_next_47.$$arity = 0); + + Opal.def(self, '$oct', TMP_String_oct_48 = function $$oct() { + var self = this; + + + var result, + string = self, + radix = 8; + + if (/^\s*_/.test(string)) { + return 0; + } + + string = string.replace(/^(\s*[+-]?)(0[bodx]?)(.+)$/i, function (original, head, flag, tail) { + switch (tail.charAt(0)) { + case '+': + case '-': + return original; + case '0': + if (tail.charAt(1) === 'x' && flag === '0x') { + return original; + } + } + switch (flag) { + case '0b': + radix = 2; + break; + case '0': + case '0o': + radix = 8; + break; + case '0d': + radix = 10; + break; + case '0x': + radix = 16; + break; + } + return head + tail; + }); + + result = parseInt(string.replace(/_(?!_)/g, ''), radix); + return isNaN(result) ? 0 : result; + + }, TMP_String_oct_48.$$arity = 0); + + Opal.def(self, '$ord', TMP_String_ord_49 = function $$ord() { + var self = this; + + return self.charCodeAt(0); + }, TMP_String_ord_49.$$arity = 0); + + Opal.def(self, '$partition', TMP_String_partition_50 = function $$partition(sep) { + var self = this; + + + var i, m; + + if (sep.$$is_regexp) { + m = sep.exec(self); + if (m === null) { + i = -1; + } else { + $$($nesting, 'MatchData').$new(sep, m); + sep = m[0]; + i = m.index; + } + } else { + sep = $$($nesting, 'Opal').$coerce_to(sep, $$($nesting, 'String'), "to_str"); + i = self.indexOf(sep); + } + + if (i === -1) { + return [self, '', '']; + } + + return [ + self.slice(0, i), + self.slice(i, i + sep.length), + self.slice(i + sep.length) + ]; + + }, TMP_String_partition_50.$$arity = 1); + + Opal.def(self, '$reverse', TMP_String_reverse_51 = function $$reverse() { + var self = this; + + return self.split('').reverse().join(''); + }, TMP_String_reverse_51.$$arity = 0); + + Opal.def(self, '$rindex', TMP_String_rindex_52 = function $$rindex(search, offset) { + var self = this; + + + ; + + var i, m, r, _m; + + if (offset === undefined) { + offset = self.length; + } else { + offset = $$($nesting, 'Opal').$coerce_to(offset, $$($nesting, 'Integer'), "to_int"); + if (offset < 0) { + offset += self.length; + if (offset < 0) { + return nil; + } + } + } + + if (search.$$is_regexp) { + m = null; + r = Opal.global_multiline_regexp(search); + while (true) { + _m = r.exec(self); + if (_m === null || _m.index > offset) { + break; + } + m = _m; + r.lastIndex = m.index + 1; + } + if (m === null) { + ($gvars["~"] = nil) + i = -1; + } else { + $$($nesting, 'MatchData').$new(r, m); + i = m.index; + } + } else { + search = $$($nesting, 'Opal').$coerce_to(search, $$($nesting, 'String'), "to_str"); + i = self.lastIndexOf(search, offset); + } + + return i === -1 ? nil : i; + ; + }, TMP_String_rindex_52.$$arity = -2); + + Opal.def(self, '$rjust', TMP_String_rjust_53 = function $$rjust(width, padstr) { + var self = this; + + + + if (padstr == null) { + padstr = " "; + }; + width = $$($nesting, 'Opal').$coerce_to(width, $$($nesting, 'Integer'), "to_int"); + padstr = $$($nesting, 'Opal').$coerce_to(padstr, $$($nesting, 'String'), "to_str").$to_s(); + if ($truthy(padstr['$empty?']())) { + self.$raise($$($nesting, 'ArgumentError'), "zero width padding")}; + if ($truthy(width <= self.length)) { + return self}; + + var chars = Math.floor(width - self.length), + patterns = Math.floor(chars / padstr.length), + result = Array(patterns + 1).join(padstr), + remaining = chars - result.length; + + return self.$$cast(result + padstr.slice(0, remaining) + self); + ; + }, TMP_String_rjust_53.$$arity = -2); + + Opal.def(self, '$rpartition', TMP_String_rpartition_54 = function $$rpartition(sep) { + var self = this; + + + var i, m, r, _m; + + if (sep.$$is_regexp) { + m = null; + r = Opal.global_multiline_regexp(sep); + + while (true) { + _m = r.exec(self); + if (_m === null) { + break; + } + m = _m; + r.lastIndex = m.index + 1; + } + + if (m === null) { + i = -1; + } else { + $$($nesting, 'MatchData').$new(r, m); + sep = m[0]; + i = m.index; + } + + } else { + sep = $$($nesting, 'Opal').$coerce_to(sep, $$($nesting, 'String'), "to_str"); + i = self.lastIndexOf(sep); + } + + if (i === -1) { + return ['', '', self]; + } + + return [ + self.slice(0, i), + self.slice(i, i + sep.length), + self.slice(i + sep.length) + ]; + + }, TMP_String_rpartition_54.$$arity = 1); + + Opal.def(self, '$rstrip', TMP_String_rstrip_55 = function $$rstrip() { + var self = this; + + return self.replace(/[\s\u0000]*$/, ''); + }, TMP_String_rstrip_55.$$arity = 0); + + Opal.def(self, '$scan', TMP_String_scan_56 = function $$scan(pattern) { + var $iter = TMP_String_scan_56.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_String_scan_56.$$p = null; + + + if ($iter) TMP_String_scan_56.$$p = null;; + + var result = [], + match_data = nil, + match; + + if (pattern.$$is_regexp) { + pattern = Opal.global_multiline_regexp(pattern); + } else { + pattern = $$($nesting, 'Opal').$coerce_to(pattern, $$($nesting, 'String'), "to_str"); + pattern = new RegExp(pattern.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'), 'gm'); + } + + while ((match = pattern.exec(self)) != null) { + match_data = $$($nesting, 'MatchData').$new(pattern, match); + if (block === nil) { + match.length == 1 ? result.push(match[0]) : result.push((match_data).$captures()); + } else { + match.length == 1 ? block(match[0]) : block.call(self, (match_data).$captures()); + } + if (pattern.lastIndex === match.index) { + pattern.lastIndex += 1; + } + } + + ($gvars["~"] = match_data) + + return (block !== nil ? self : result); + ; + }, TMP_String_scan_56.$$arity = 1); + Opal.alias(self, "size", "length"); + Opal.alias(self, "slice", "[]"); + + Opal.def(self, '$split', TMP_String_split_57 = function $$split(pattern, limit) { + var $a, self = this; + if ($gvars[";"] == null) $gvars[";"] = nil; + + + ; + ; + + if (self.length === 0) { + return []; + } + + if (limit === undefined) { + limit = 0; + } else { + limit = $$($nesting, 'Opal')['$coerce_to!'](limit, $$($nesting, 'Integer'), "to_int"); + if (limit === 1) { + return [self]; + } + } + + if (pattern === undefined || pattern === nil) { + pattern = ($truthy($a = $gvars[";"]) ? $a : " "); + } + + var result = [], + string = self.toString(), + index = 0, + match, + i, ii; + + if (pattern.$$is_regexp) { + pattern = Opal.global_multiline_regexp(pattern); + } else { + pattern = $$($nesting, 'Opal').$coerce_to(pattern, $$($nesting, 'String'), "to_str").$to_s(); + if (pattern === ' ') { + pattern = /\s+/gm; + string = string.replace(/^\s+/, ''); + } else { + pattern = new RegExp(pattern.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'), 'gm'); + } + } + + result = string.split(pattern); + + if (result.length === 1 && result[0] === string) { + return [self.$$cast(result[0])]; + } + + while ((i = result.indexOf(undefined)) !== -1) { + result.splice(i, 1); + } + + function castResult() { + for (i = 0; i < result.length; i++) { + result[i] = self.$$cast(result[i]); + } + } + + if (limit === 0) { + while (result[result.length - 1] === '') { + result.length -= 1; + } + castResult(); + return result; + } + + match = pattern.exec(string); + + if (limit < 0) { + if (match !== null && match[0] === '' && pattern.source.indexOf('(?=') === -1) { + for (i = 0, ii = match.length; i < ii; i++) { + result.push(''); + } + } + castResult(); + return result; + } + + if (match !== null && match[0] === '') { + result.splice(limit - 1, result.length - 1, result.slice(limit - 1).join('')); + castResult(); + return result; + } + + if (limit >= result.length) { + castResult(); + return result; + } + + i = 0; + while (match !== null) { + i++; + index = pattern.lastIndex; + if (i + 1 === limit) { + break; + } + match = pattern.exec(string); + } + result.splice(limit - 1, result.length - 1, string.slice(index)); + castResult(); + return result; + ; + }, TMP_String_split_57.$$arity = -1); + + Opal.def(self, '$squeeze', TMP_String_squeeze_58 = function $$squeeze($a) { + var $post_args, sets, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + sets = $post_args;; + + if (sets.length === 0) { + return self.$$cast(self.replace(/(.)\1+/g, '$1')); + } + var char_class = char_class_from_char_sets(sets); + if (char_class === null) { + return self; + } + return self.$$cast(self.replace(new RegExp('(' + char_class + ')\\1+', 'g'), '$1')); + ; + }, TMP_String_squeeze_58.$$arity = -1); + + Opal.def(self, '$start_with?', TMP_String_start_with$q_59 = function($a) { + var $post_args, prefixes, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + prefixes = $post_args;; + + for (var i = 0, length = prefixes.length; i < length; i++) { + var prefix = $$($nesting, 'Opal').$coerce_to(prefixes[i], $$($nesting, 'String'), "to_str").$to_s(); + + if (self.indexOf(prefix) === 0) { + return true; + } + } + + return false; + ; + }, TMP_String_start_with$q_59.$$arity = -1); + + Opal.def(self, '$strip', TMP_String_strip_60 = function $$strip() { + var self = this; + + return self.replace(/^\s*/, '').replace(/[\s\u0000]*$/, ''); + }, TMP_String_strip_60.$$arity = 0); + + Opal.def(self, '$sub', TMP_String_sub_61 = function $$sub(pattern, replacement) { + var $iter = TMP_String_sub_61.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_String_sub_61.$$p = null; + + + if ($iter) TMP_String_sub_61.$$p = null;; + ; + + if (!pattern.$$is_regexp) { + pattern = $$($nesting, 'Opal').$coerce_to(pattern, $$($nesting, 'String'), "to_str"); + pattern = new RegExp(pattern.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')); + } + + var result, match = pattern.exec(self); + + if (match === null) { + ($gvars["~"] = nil) + result = self.toString(); + } else { + $$($nesting, 'MatchData').$new(pattern, match) + + if (replacement === undefined) { + + if (block === nil) { + self.$raise($$($nesting, 'ArgumentError'), "wrong number of arguments (1 for 2)") + } + result = self.slice(0, match.index) + block(match[0]) + self.slice(match.index + match[0].length); + + } else if (replacement.$$is_hash) { + + result = self.slice(0, match.index) + (replacement)['$[]'](match[0]).$to_s() + self.slice(match.index + match[0].length); + + } else { + + replacement = $$($nesting, 'Opal').$coerce_to(replacement, $$($nesting, 'String'), "to_str"); + + replacement = replacement.replace(/([\\]+)([0-9+&`'])/g, function (original, slashes, command) { + if (slashes.length % 2 === 0) { + return original; + } + switch (command) { + case "+": + for (var i = match.length - 1; i > 0; i--) { + if (match[i] !== undefined) { + return slashes.slice(1) + match[i]; + } + } + return ''; + case "&": return slashes.slice(1) + match[0]; + case "`": return slashes.slice(1) + self.slice(0, match.index); + case "'": return slashes.slice(1) + self.slice(match.index + match[0].length); + default: return slashes.slice(1) + (match[command] || ''); + } + }).replace(/\\\\/g, '\\'); + + result = self.slice(0, match.index) + replacement + self.slice(match.index + match[0].length); + } + } + + return self.$$cast(result); + ; + }, TMP_String_sub_61.$$arity = -2); + Opal.alias(self, "succ", "next"); + + Opal.def(self, '$sum', TMP_String_sum_62 = function $$sum(n) { + var self = this; + + + + if (n == null) { + n = 16; + }; + + n = $$($nesting, 'Opal').$coerce_to(n, $$($nesting, 'Integer'), "to_int"); + + var result = 0, + length = self.length, + i = 0; + + for (; i < length; i++) { + result += self.charCodeAt(i); + } + + if (n <= 0) { + return result; + } + + return result & (Math.pow(2, n) - 1); + ; + }, TMP_String_sum_62.$$arity = -1); + + Opal.def(self, '$swapcase', TMP_String_swapcase_63 = function $$swapcase() { + var self = this; + + + var str = self.replace(/([a-z]+)|([A-Z]+)/g, function($0,$1,$2) { + return $1 ? $0.toUpperCase() : $0.toLowerCase(); + }); + + if (self.constructor === String) { + return str; + } + + return self.$class().$new(str); + + }, TMP_String_swapcase_63.$$arity = 0); + + Opal.def(self, '$to_f', TMP_String_to_f_64 = function $$to_f() { + var self = this; + + + if (self.charAt(0) === '_') { + return 0; + } + + var result = parseFloat(self.replace(/_/g, '')); + + if (isNaN(result) || result == Infinity || result == -Infinity) { + return 0; + } + else { + return result; + } + + }, TMP_String_to_f_64.$$arity = 0); + + Opal.def(self, '$to_i', TMP_String_to_i_65 = function $$to_i(base) { + var self = this; + + + + if (base == null) { + base = 10; + }; + + var result, + string = self.toLowerCase(), + radix = $$($nesting, 'Opal').$coerce_to(base, $$($nesting, 'Integer'), "to_int"); + + if (radix === 1 || radix < 0 || radix > 36) { + self.$raise($$($nesting, 'ArgumentError'), "" + "invalid radix " + (radix)) + } + + if (/^\s*_/.test(string)) { + return 0; + } + + string = string.replace(/^(\s*[+-]?)(0[bodx]?)(.+)$/, function (original, head, flag, tail) { + switch (tail.charAt(0)) { + case '+': + case '-': + return original; + case '0': + if (tail.charAt(1) === 'x' && flag === '0x' && (radix === 0 || radix === 16)) { + return original; + } + } + switch (flag) { + case '0b': + if (radix === 0 || radix === 2) { + radix = 2; + return head + tail; + } + break; + case '0': + case '0o': + if (radix === 0 || radix === 8) { + radix = 8; + return head + tail; + } + break; + case '0d': + if (radix === 0 || radix === 10) { + radix = 10; + return head + tail; + } + break; + case '0x': + if (radix === 0 || radix === 16) { + radix = 16; + return head + tail; + } + break; + } + return original + }); + + result = parseInt(string.replace(/_(?!_)/g, ''), radix); + return isNaN(result) ? 0 : result; + ; + }, TMP_String_to_i_65.$$arity = -1); + + Opal.def(self, '$to_proc', TMP_String_to_proc_66 = function $$to_proc() { + var TMP_67, $iter = TMP_String_to_proc_66.$$p, $yield = $iter || nil, self = this, method_name = nil; + + if ($iter) TMP_String_to_proc_66.$$p = null; + + method_name = $rb_plus("$", self.valueOf()); + return $send(self, 'proc', [], (TMP_67 = function($a){var self = TMP_67.$$s || this, $iter = TMP_67.$$p, block = $iter || nil, $post_args, args; + + + + if ($iter) TMP_67.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + + if (args.length === 0) { + self.$raise($$($nesting, 'ArgumentError'), "no receiver given") + } + + var recv = args[0]; + + if (recv == null) recv = nil; + + var body = recv[method_name]; + + if (!body) { + return recv.$method_missing.apply(recv, args); + } + + if (typeof block === 'function') { + body.$$p = block; + } + + if (args.length === 1) { + return body.call(recv); + } else { + return body.apply(recv, args.slice(1)); + } + ;}, TMP_67.$$s = self, TMP_67.$$arity = -1, TMP_67)); + }, TMP_String_to_proc_66.$$arity = 0); + + Opal.def(self, '$to_s', TMP_String_to_s_68 = function $$to_s() { + var self = this; + + return self.toString(); + }, TMP_String_to_s_68.$$arity = 0); + Opal.alias(self, "to_str", "to_s"); + Opal.alias(self, "to_sym", "intern"); + + Opal.def(self, '$tr', TMP_String_tr_69 = function $$tr(from, to) { + var self = this; + + + from = $$($nesting, 'Opal').$coerce_to(from, $$($nesting, 'String'), "to_str").$to_s(); + to = $$($nesting, 'Opal').$coerce_to(to, $$($nesting, 'String'), "to_str").$to_s(); + + if (from.length == 0 || from === to) { + return self; + } + + var i, in_range, c, ch, start, end, length; + var subs = {}; + var from_chars = from.split(''); + var from_length = from_chars.length; + var to_chars = to.split(''); + var to_length = to_chars.length; + + var inverse = false; + var global_sub = null; + if (from_chars[0] === '^' && from_chars.length > 1) { + inverse = true; + from_chars.shift(); + global_sub = to_chars[to_length - 1] + from_length -= 1; + } + + var from_chars_expanded = []; + var last_from = null; + in_range = false; + for (i = 0; i < from_length; i++) { + ch = from_chars[i]; + if (last_from == null) { + last_from = ch; + from_chars_expanded.push(ch); + } + else if (ch === '-') { + if (last_from === '-') { + from_chars_expanded.push('-'); + from_chars_expanded.push('-'); + } + else if (i == from_length - 1) { + from_chars_expanded.push('-'); + } + else { + in_range = true; + } + } + else if (in_range) { + start = last_from.charCodeAt(0); + end = ch.charCodeAt(0); + if (start > end) { + self.$raise($$($nesting, 'ArgumentError'), "" + "invalid range \"" + (String.fromCharCode(start)) + "-" + (String.fromCharCode(end)) + "\" in string transliteration") + } + for (c = start + 1; c < end; c++) { + from_chars_expanded.push(String.fromCharCode(c)); + } + from_chars_expanded.push(ch); + in_range = null; + last_from = null; + } + else { + from_chars_expanded.push(ch); + } + } + + from_chars = from_chars_expanded; + from_length = from_chars.length; + + if (inverse) { + for (i = 0; i < from_length; i++) { + subs[from_chars[i]] = true; + } + } + else { + if (to_length > 0) { + var to_chars_expanded = []; + var last_to = null; + in_range = false; + for (i = 0; i < to_length; i++) { + ch = to_chars[i]; + if (last_to == null) { + last_to = ch; + to_chars_expanded.push(ch); + } + else if (ch === '-') { + if (last_to === '-') { + to_chars_expanded.push('-'); + to_chars_expanded.push('-'); + } + else if (i == to_length - 1) { + to_chars_expanded.push('-'); + } + else { + in_range = true; + } + } + else if (in_range) { + start = last_to.charCodeAt(0); + end = ch.charCodeAt(0); + if (start > end) { + self.$raise($$($nesting, 'ArgumentError'), "" + "invalid range \"" + (String.fromCharCode(start)) + "-" + (String.fromCharCode(end)) + "\" in string transliteration") + } + for (c = start + 1; c < end; c++) { + to_chars_expanded.push(String.fromCharCode(c)); + } + to_chars_expanded.push(ch); + in_range = null; + last_to = null; + } + else { + to_chars_expanded.push(ch); + } + } + + to_chars = to_chars_expanded; + to_length = to_chars.length; + } + + var length_diff = from_length - to_length; + if (length_diff > 0) { + var pad_char = (to_length > 0 ? to_chars[to_length - 1] : ''); + for (i = 0; i < length_diff; i++) { + to_chars.push(pad_char); + } + } + + for (i = 0; i < from_length; i++) { + subs[from_chars[i]] = to_chars[i]; + } + } + + var new_str = '' + for (i = 0, length = self.length; i < length; i++) { + ch = self.charAt(i); + var sub = subs[ch]; + if (inverse) { + new_str += (sub == null ? global_sub : ch); + } + else { + new_str += (sub != null ? sub : ch); + } + } + return self.$$cast(new_str); + ; + }, TMP_String_tr_69.$$arity = 2); + + Opal.def(self, '$tr_s', TMP_String_tr_s_70 = function $$tr_s(from, to) { + var self = this; + + + from = $$($nesting, 'Opal').$coerce_to(from, $$($nesting, 'String'), "to_str").$to_s(); + to = $$($nesting, 'Opal').$coerce_to(to, $$($nesting, 'String'), "to_str").$to_s(); + + if (from.length == 0) { + return self; + } + + var i, in_range, c, ch, start, end, length; + var subs = {}; + var from_chars = from.split(''); + var from_length = from_chars.length; + var to_chars = to.split(''); + var to_length = to_chars.length; + + var inverse = false; + var global_sub = null; + if (from_chars[0] === '^' && from_chars.length > 1) { + inverse = true; + from_chars.shift(); + global_sub = to_chars[to_length - 1] + from_length -= 1; + } + + var from_chars_expanded = []; + var last_from = null; + in_range = false; + for (i = 0; i < from_length; i++) { + ch = from_chars[i]; + if (last_from == null) { + last_from = ch; + from_chars_expanded.push(ch); + } + else if (ch === '-') { + if (last_from === '-') { + from_chars_expanded.push('-'); + from_chars_expanded.push('-'); + } + else if (i == from_length - 1) { + from_chars_expanded.push('-'); + } + else { + in_range = true; + } + } + else if (in_range) { + start = last_from.charCodeAt(0); + end = ch.charCodeAt(0); + if (start > end) { + self.$raise($$($nesting, 'ArgumentError'), "" + "invalid range \"" + (String.fromCharCode(start)) + "-" + (String.fromCharCode(end)) + "\" in string transliteration") + } + for (c = start + 1; c < end; c++) { + from_chars_expanded.push(String.fromCharCode(c)); + } + from_chars_expanded.push(ch); + in_range = null; + last_from = null; + } + else { + from_chars_expanded.push(ch); + } + } + + from_chars = from_chars_expanded; + from_length = from_chars.length; + + if (inverse) { + for (i = 0; i < from_length; i++) { + subs[from_chars[i]] = true; + } + } + else { + if (to_length > 0) { + var to_chars_expanded = []; + var last_to = null; + in_range = false; + for (i = 0; i < to_length; i++) { + ch = to_chars[i]; + if (last_from == null) { + last_from = ch; + to_chars_expanded.push(ch); + } + else if (ch === '-') { + if (last_to === '-') { + to_chars_expanded.push('-'); + to_chars_expanded.push('-'); + } + else if (i == to_length - 1) { + to_chars_expanded.push('-'); + } + else { + in_range = true; + } + } + else if (in_range) { + start = last_from.charCodeAt(0); + end = ch.charCodeAt(0); + if (start > end) { + self.$raise($$($nesting, 'ArgumentError'), "" + "invalid range \"" + (String.fromCharCode(start)) + "-" + (String.fromCharCode(end)) + "\" in string transliteration") + } + for (c = start + 1; c < end; c++) { + to_chars_expanded.push(String.fromCharCode(c)); + } + to_chars_expanded.push(ch); + in_range = null; + last_from = null; + } + else { + to_chars_expanded.push(ch); + } + } + + to_chars = to_chars_expanded; + to_length = to_chars.length; + } + + var length_diff = from_length - to_length; + if (length_diff > 0) { + var pad_char = (to_length > 0 ? to_chars[to_length - 1] : ''); + for (i = 0; i < length_diff; i++) { + to_chars.push(pad_char); + } + } + + for (i = 0; i < from_length; i++) { + subs[from_chars[i]] = to_chars[i]; + } + } + var new_str = '' + var last_substitute = null + for (i = 0, length = self.length; i < length; i++) { + ch = self.charAt(i); + var sub = subs[ch] + if (inverse) { + if (sub == null) { + if (last_substitute == null) { + new_str += global_sub; + last_substitute = true; + } + } + else { + new_str += ch; + last_substitute = null; + } + } + else { + if (sub != null) { + if (last_substitute == null || last_substitute !== sub) { + new_str += sub; + last_substitute = sub; + } + } + else { + new_str += ch; + last_substitute = null; + } + } + } + return self.$$cast(new_str); + ; + }, TMP_String_tr_s_70.$$arity = 2); + + Opal.def(self, '$upcase', TMP_String_upcase_71 = function $$upcase() { + var self = this; + + return self.$$cast(self.toUpperCase()); + }, TMP_String_upcase_71.$$arity = 0); + + Opal.def(self, '$upto', TMP_String_upto_72 = function $$upto(stop, excl) { + var $iter = TMP_String_upto_72.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_String_upto_72.$$p = null; + + + if ($iter) TMP_String_upto_72.$$p = null;; + + if (excl == null) { + excl = false; + }; + if ((block !== nil)) { + } else { + return self.$enum_for("upto", stop, excl) + }; + stop = $$($nesting, 'Opal').$coerce_to(stop, $$($nesting, 'String'), "to_str"); + + var a, b, s = self.toString(); + + if (s.length === 1 && stop.length === 1) { + + a = s.charCodeAt(0); + b = stop.charCodeAt(0); + + while (a <= b) { + if (excl && a === b) { + break; + } + + block(String.fromCharCode(a)); + + a += 1; + } + + } else if (parseInt(s, 10).toString() === s && parseInt(stop, 10).toString() === stop) { + + a = parseInt(s, 10); + b = parseInt(stop, 10); + + while (a <= b) { + if (excl && a === b) { + break; + } + + block(a.toString()); + + a += 1; + } + + } else { + + while (s.length <= stop.length && s <= stop) { + if (excl && s === stop) { + break; + } + + block(s); + + s = (s).$succ(); + } + + } + return self; + ; + }, TMP_String_upto_72.$$arity = -2); + + function char_class_from_char_sets(sets) { + function explode_sequences_in_character_set(set) { + var result = '', + i, len = set.length, + curr_char, + skip_next_dash, + char_code_from, + char_code_upto, + char_code; + for (i = 0; i < len; i++) { + curr_char = set.charAt(i); + if (curr_char === '-' && i > 0 && i < (len - 1) && !skip_next_dash) { + char_code_from = set.charCodeAt(i - 1); + char_code_upto = set.charCodeAt(i + 1); + if (char_code_from > char_code_upto) { + self.$raise($$($nesting, 'ArgumentError'), "" + "invalid range \"" + (char_code_from) + "-" + (char_code_upto) + "\" in string transliteration") + } + for (char_code = char_code_from + 1; char_code < char_code_upto + 1; char_code++) { + result += String.fromCharCode(char_code); + } + skip_next_dash = true; + i++; + } else { + skip_next_dash = (curr_char === '\\'); + result += curr_char; + } + } + return result; + } + + function intersection(setA, setB) { + if (setA.length === 0) { + return setB; + } + var result = '', + i, len = setA.length, + chr; + for (i = 0; i < len; i++) { + chr = setA.charAt(i); + if (setB.indexOf(chr) !== -1) { + result += chr; + } + } + return result; + } + + var i, len, set, neg, chr, tmp, + pos_intersection = '', + neg_intersection = ''; + + for (i = 0, len = sets.length; i < len; i++) { + set = $$($nesting, 'Opal').$coerce_to(sets[i], $$($nesting, 'String'), "to_str"); + neg = (set.charAt(0) === '^' && set.length > 1); + set = explode_sequences_in_character_set(neg ? set.slice(1) : set); + if (neg) { + neg_intersection = intersection(neg_intersection, set); + } else { + pos_intersection = intersection(pos_intersection, set); + } + } + + if (pos_intersection.length > 0 && neg_intersection.length > 0) { + tmp = ''; + for (i = 0, len = pos_intersection.length; i < len; i++) { + chr = pos_intersection.charAt(i); + if (neg_intersection.indexOf(chr) === -1) { + tmp += chr; + } + } + pos_intersection = tmp; + neg_intersection = ''; + } + + if (pos_intersection.length > 0) { + return '[' + $$($nesting, 'Regexp').$escape(pos_intersection) + ']'; + } + + if (neg_intersection.length > 0) { + return '[^' + $$($nesting, 'Regexp').$escape(neg_intersection) + ']'; + } + + return null; + } + ; + + Opal.def(self, '$instance_variables', TMP_String_instance_variables_73 = function $$instance_variables() { + var self = this; + + return [] + }, TMP_String_instance_variables_73.$$arity = 0); + Opal.defs(self, '$_load', TMP_String__load_74 = function $$_load($a) { + var $post_args, args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + return $send(self, 'new', Opal.to_a(args)); + }, TMP_String__load_74.$$arity = -1); + + Opal.def(self, '$unicode_normalize', TMP_String_unicode_normalize_75 = function $$unicode_normalize(form) { + var self = this; + + + ; + return self.toString();; + }, TMP_String_unicode_normalize_75.$$arity = -1); + + Opal.def(self, '$unicode_normalized?', TMP_String_unicode_normalized$q_76 = function(form) { + var self = this; + + + ; + return true; + }, TMP_String_unicode_normalized$q_76.$$arity = -1); + + Opal.def(self, '$unpack', TMP_String_unpack_77 = function $$unpack(format) { + var self = this; + + return self.$raise("To use String#unpack, you must first require 'corelib/string/unpack'.") + }, TMP_String_unpack_77.$$arity = 1); + return (Opal.def(self, '$unpack1', TMP_String_unpack1_78 = function $$unpack1(format) { + var self = this; + + return self.$raise("To use String#unpack1, you must first require 'corelib/string/unpack'.") + }, TMP_String_unpack1_78.$$arity = 1), nil) && 'unpack1'; + })($nesting[0], String, $nesting); + return Opal.const_set($nesting[0], 'Symbol', $$($nesting, 'String')); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/enumerable"] = function(Opal) { + function $rb_gt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); + } + function $rb_times(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs * rhs : lhs['$*'](rhs); + } + function $rb_lt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); + } + function $rb_plus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); + } + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + function $rb_divide(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs / rhs : lhs['$/'](rhs); + } + function $rb_le(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs <= rhs : lhs['$<='](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $truthy = Opal.truthy, $send = Opal.send, $falsy = Opal.falsy, $hash2 = Opal.hash2, $lambda = Opal.lambda; + + Opal.add_stubs(['$each', '$public_send', '$destructure', '$to_enum', '$enumerator_size', '$new', '$yield', '$raise', '$slice_when', '$!', '$enum_for', '$flatten', '$map', '$warn', '$proc', '$==', '$nil?', '$respond_to?', '$coerce_to!', '$>', '$*', '$coerce_to', '$try_convert', '$<', '$+', '$-', '$ceil', '$/', '$size', '$__send__', '$length', '$<=', '$[]', '$push', '$<<', '$[]=', '$===', '$inspect', '$<=>', '$first', '$reverse', '$sort', '$to_proc', '$compare', '$call', '$dup', '$to_a', '$sort!', '$map!', '$key?', '$values', '$zip']); + return (function($base, $parent_nesting) { + function $Enumerable() {}; + var self = $Enumerable = $module($base, 'Enumerable', $Enumerable); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Enumerable_all$q_1, TMP_Enumerable_any$q_5, TMP_Enumerable_chunk_9, TMP_Enumerable_chunk_while_12, TMP_Enumerable_collect_14, TMP_Enumerable_collect_concat_16, TMP_Enumerable_count_19, TMP_Enumerable_cycle_23, TMP_Enumerable_detect_25, TMP_Enumerable_drop_27, TMP_Enumerable_drop_while_28, TMP_Enumerable_each_cons_29, TMP_Enumerable_each_entry_31, TMP_Enumerable_each_slice_33, TMP_Enumerable_each_with_index_35, TMP_Enumerable_each_with_object_37, TMP_Enumerable_entries_39, TMP_Enumerable_find_all_40, TMP_Enumerable_find_index_42, TMP_Enumerable_first_45, TMP_Enumerable_grep_48, TMP_Enumerable_grep_v_50, TMP_Enumerable_group_by_52, TMP_Enumerable_include$q_54, TMP_Enumerable_inject_56, TMP_Enumerable_lazy_57, TMP_Enumerable_enumerator_size_59, TMP_Enumerable_max_60, TMP_Enumerable_max_by_61, TMP_Enumerable_min_63, TMP_Enumerable_min_by_64, TMP_Enumerable_minmax_66, TMP_Enumerable_minmax_by_68, TMP_Enumerable_none$q_69, TMP_Enumerable_one$q_73, TMP_Enumerable_partition_77, TMP_Enumerable_reject_79, TMP_Enumerable_reverse_each_81, TMP_Enumerable_slice_before_83, TMP_Enumerable_slice_after_85, TMP_Enumerable_slice_when_88, TMP_Enumerable_sort_90, TMP_Enumerable_sort_by_92, TMP_Enumerable_sum_97, TMP_Enumerable_take_99, TMP_Enumerable_take_while_100, TMP_Enumerable_uniq_102, TMP_Enumerable_zip_104; + + + + function comparableForPattern(value) { + if (value.length === 0) { + value = [nil]; + } + + if (value.length > 1) { + value = [value]; + } + + return value; + } + ; + + Opal.def(self, '$all?', TMP_Enumerable_all$q_1 = function(pattern) {try { + + var $iter = TMP_Enumerable_all$q_1.$$p, block = $iter || nil, TMP_2, TMP_3, TMP_4, self = this; + + if ($iter) TMP_Enumerable_all$q_1.$$p = null; + + + if ($iter) TMP_Enumerable_all$q_1.$$p = null;; + ; + if ($truthy(pattern !== undefined)) { + $send(self, 'each', [], (TMP_2 = function($a){var self = TMP_2.$$s || this, $post_args, value, comparable = nil; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + value = $post_args;; + comparable = comparableForPattern(value); + if ($truthy($send(pattern, 'public_send', ["==="].concat(Opal.to_a(comparable))))) { + return nil + } else { + Opal.ret(false) + };}, TMP_2.$$s = self, TMP_2.$$arity = -1, TMP_2)) + } else if ((block !== nil)) { + $send(self, 'each', [], (TMP_3 = function($a){var self = TMP_3.$$s || this, $post_args, value; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + value = $post_args;; + if ($truthy(Opal.yieldX(block, Opal.to_a(value)))) { + return nil + } else { + Opal.ret(false) + };}, TMP_3.$$s = self, TMP_3.$$arity = -1, TMP_3)) + } else { + $send(self, 'each', [], (TMP_4 = function($a){var self = TMP_4.$$s || this, $post_args, value; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + value = $post_args;; + if ($truthy($$($nesting, 'Opal').$destructure(value))) { + return nil + } else { + Opal.ret(false) + };}, TMP_4.$$s = self, TMP_4.$$arity = -1, TMP_4)) + }; + return true; + } catch ($returner) { if ($returner === Opal.returner) { return $returner.$v } throw $returner; } + }, TMP_Enumerable_all$q_1.$$arity = -1); + + Opal.def(self, '$any?', TMP_Enumerable_any$q_5 = function(pattern) {try { + + var $iter = TMP_Enumerable_any$q_5.$$p, block = $iter || nil, TMP_6, TMP_7, TMP_8, self = this; + + if ($iter) TMP_Enumerable_any$q_5.$$p = null; + + + if ($iter) TMP_Enumerable_any$q_5.$$p = null;; + ; + if ($truthy(pattern !== undefined)) { + $send(self, 'each', [], (TMP_6 = function($a){var self = TMP_6.$$s || this, $post_args, value, comparable = nil; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + value = $post_args;; + comparable = comparableForPattern(value); + if ($truthy($send(pattern, 'public_send', ["==="].concat(Opal.to_a(comparable))))) { + Opal.ret(true) + } else { + return nil + };}, TMP_6.$$s = self, TMP_6.$$arity = -1, TMP_6)) + } else if ((block !== nil)) { + $send(self, 'each', [], (TMP_7 = function($a){var self = TMP_7.$$s || this, $post_args, value; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + value = $post_args;; + if ($truthy(Opal.yieldX(block, Opal.to_a(value)))) { + Opal.ret(true) + } else { + return nil + };}, TMP_7.$$s = self, TMP_7.$$arity = -1, TMP_7)) + } else { + $send(self, 'each', [], (TMP_8 = function($a){var self = TMP_8.$$s || this, $post_args, value; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + value = $post_args;; + if ($truthy($$($nesting, 'Opal').$destructure(value))) { + Opal.ret(true) + } else { + return nil + };}, TMP_8.$$s = self, TMP_8.$$arity = -1, TMP_8)) + }; + return false; + } catch ($returner) { if ($returner === Opal.returner) { return $returner.$v } throw $returner; } + }, TMP_Enumerable_any$q_5.$$arity = -1); + + Opal.def(self, '$chunk', TMP_Enumerable_chunk_9 = function $$chunk() { + var $iter = TMP_Enumerable_chunk_9.$$p, block = $iter || nil, TMP_10, TMP_11, self = this; + + if ($iter) TMP_Enumerable_chunk_9.$$p = null; + + + if ($iter) TMP_Enumerable_chunk_9.$$p = null;; + if ((block !== nil)) { + } else { + return $send(self, 'to_enum', ["chunk"], (TMP_10 = function(){var self = TMP_10.$$s || this; + + return self.$enumerator_size()}, TMP_10.$$s = self, TMP_10.$$arity = 0, TMP_10)) + }; + return $send($$$('::', 'Enumerator'), 'new', [], (TMP_11 = function(yielder){var self = TMP_11.$$s || this; + + + + if (yielder == null) { + yielder = nil; + }; + + var previous = nil, accumulate = []; + + function releaseAccumulate() { + if (accumulate.length > 0) { + yielder.$yield(previous, accumulate) + } + } + + self.$each.$$p = function(value) { + var key = Opal.yield1(block, value); + + if (key === nil) { + releaseAccumulate(); + accumulate = []; + previous = nil; + } else { + if (previous === nil || previous === key) { + accumulate.push(value); + } else { + releaseAccumulate(); + accumulate = [value]; + } + + previous = key; + } + } + + self.$each(); + + releaseAccumulate(); + ;}, TMP_11.$$s = self, TMP_11.$$arity = 1, TMP_11)); + }, TMP_Enumerable_chunk_9.$$arity = 0); + + Opal.def(self, '$chunk_while', TMP_Enumerable_chunk_while_12 = function $$chunk_while() { + var $iter = TMP_Enumerable_chunk_while_12.$$p, block = $iter || nil, TMP_13, self = this; + + if ($iter) TMP_Enumerable_chunk_while_12.$$p = null; + + + if ($iter) TMP_Enumerable_chunk_while_12.$$p = null;; + if ((block !== nil)) { + } else { + self.$raise($$($nesting, 'ArgumentError'), "no block given") + }; + return $send(self, 'slice_when', [], (TMP_13 = function(before, after){var self = TMP_13.$$s || this; + + + + if (before == null) { + before = nil; + }; + + if (after == null) { + after = nil; + }; + return Opal.yieldX(block, [before, after])['$!']();}, TMP_13.$$s = self, TMP_13.$$arity = 2, TMP_13)); + }, TMP_Enumerable_chunk_while_12.$$arity = 0); + + Opal.def(self, '$collect', TMP_Enumerable_collect_14 = function $$collect() { + var $iter = TMP_Enumerable_collect_14.$$p, block = $iter || nil, TMP_15, self = this; + + if ($iter) TMP_Enumerable_collect_14.$$p = null; + + + if ($iter) TMP_Enumerable_collect_14.$$p = null;; + if ((block !== nil)) { + } else { + return $send(self, 'enum_for', ["collect"], (TMP_15 = function(){var self = TMP_15.$$s || this; + + return self.$enumerator_size()}, TMP_15.$$s = self, TMP_15.$$arity = 0, TMP_15)) + }; + + var result = []; + + self.$each.$$p = function() { + var value = Opal.yieldX(block, arguments); + + result.push(value); + }; + + self.$each(); + + return result; + ; + }, TMP_Enumerable_collect_14.$$arity = 0); + + Opal.def(self, '$collect_concat', TMP_Enumerable_collect_concat_16 = function $$collect_concat() { + var $iter = TMP_Enumerable_collect_concat_16.$$p, block = $iter || nil, TMP_17, TMP_18, self = this; + + if ($iter) TMP_Enumerable_collect_concat_16.$$p = null; + + + if ($iter) TMP_Enumerable_collect_concat_16.$$p = null;; + if ((block !== nil)) { + } else { + return $send(self, 'enum_for', ["collect_concat"], (TMP_17 = function(){var self = TMP_17.$$s || this; + + return self.$enumerator_size()}, TMP_17.$$s = self, TMP_17.$$arity = 0, TMP_17)) + }; + return $send(self, 'map', [], (TMP_18 = function(item){var self = TMP_18.$$s || this; + + + + if (item == null) { + item = nil; + }; + return Opal.yield1(block, item);;}, TMP_18.$$s = self, TMP_18.$$arity = 1, TMP_18)).$flatten(1); + }, TMP_Enumerable_collect_concat_16.$$arity = 0); + + Opal.def(self, '$count', TMP_Enumerable_count_19 = function $$count(object) { + var $iter = TMP_Enumerable_count_19.$$p, block = $iter || nil, TMP_20, TMP_21, TMP_22, self = this, result = nil; + + if ($iter) TMP_Enumerable_count_19.$$p = null; + + + if ($iter) TMP_Enumerable_count_19.$$p = null;; + ; + result = 0; + + if (object != null && block !== nil) { + self.$warn("warning: given block not used") + } + ; + if ($truthy(object != null)) { + block = $send(self, 'proc', [], (TMP_20 = function($a){var self = TMP_20.$$s || this, $post_args, args; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + return $$($nesting, 'Opal').$destructure(args)['$=='](object);}, TMP_20.$$s = self, TMP_20.$$arity = -1, TMP_20)) + } else if ($truthy(block['$nil?']())) { + block = $send(self, 'proc', [], (TMP_21 = function(){var self = TMP_21.$$s || this; + + return true}, TMP_21.$$s = self, TMP_21.$$arity = 0, TMP_21))}; + $send(self, 'each', [], (TMP_22 = function($a){var self = TMP_22.$$s || this, $post_args, args; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + if ($truthy(Opal.yieldX(block, args))) { + return result++; + } else { + return nil + };}, TMP_22.$$s = self, TMP_22.$$arity = -1, TMP_22)); + return result; + }, TMP_Enumerable_count_19.$$arity = -1); + + Opal.def(self, '$cycle', TMP_Enumerable_cycle_23 = function $$cycle(n) { + var $iter = TMP_Enumerable_cycle_23.$$p, block = $iter || nil, TMP_24, self = this; + + if ($iter) TMP_Enumerable_cycle_23.$$p = null; + + + if ($iter) TMP_Enumerable_cycle_23.$$p = null;; + + if (n == null) { + n = nil; + }; + if ((block !== nil)) { + } else { + return $send(self, 'enum_for', ["cycle", n], (TMP_24 = function(){var self = TMP_24.$$s || this; + + if ($truthy(n['$nil?']())) { + if ($truthy(self['$respond_to?']("size"))) { + return $$$($$($nesting, 'Float'), 'INFINITY') + } else { + return nil + } + } else { + + n = $$($nesting, 'Opal')['$coerce_to!'](n, $$($nesting, 'Integer'), "to_int"); + if ($truthy($rb_gt(n, 0))) { + return $rb_times(self.$enumerator_size(), n) + } else { + return 0 + }; + }}, TMP_24.$$s = self, TMP_24.$$arity = 0, TMP_24)) + }; + if ($truthy(n['$nil?']())) { + } else { + + n = $$($nesting, 'Opal')['$coerce_to!'](n, $$($nesting, 'Integer'), "to_int"); + if ($truthy(n <= 0)) { + return nil}; + }; + + var result, + all = [], i, length, value; + + self.$each.$$p = function() { + var param = $$($nesting, 'Opal').$destructure(arguments), + value = Opal.yield1(block, param); + + all.push(param); + } + + self.$each(); + + if (result !== undefined) { + return result; + } + + if (all.length === 0) { + return nil; + } + + if (n === nil) { + while (true) { + for (i = 0, length = all.length; i < length; i++) { + value = Opal.yield1(block, all[i]); + } + } + } + else { + while (n > 1) { + for (i = 0, length = all.length; i < length; i++) { + value = Opal.yield1(block, all[i]); + } + + n--; + } + } + ; + }, TMP_Enumerable_cycle_23.$$arity = -1); + + Opal.def(self, '$detect', TMP_Enumerable_detect_25 = function $$detect(ifnone) {try { + + var $iter = TMP_Enumerable_detect_25.$$p, block = $iter || nil, TMP_26, self = this; + + if ($iter) TMP_Enumerable_detect_25.$$p = null; + + + if ($iter) TMP_Enumerable_detect_25.$$p = null;; + ; + if ((block !== nil)) { + } else { + return self.$enum_for("detect", ifnone) + }; + $send(self, 'each', [], (TMP_26 = function($a){var self = TMP_26.$$s || this, $post_args, args, value = nil; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + value = $$($nesting, 'Opal').$destructure(args); + if ($truthy(Opal.yield1(block, value))) { + Opal.ret(value) + } else { + return nil + };}, TMP_26.$$s = self, TMP_26.$$arity = -1, TMP_26)); + + if (ifnone !== undefined) { + if (typeof(ifnone) === 'function') { + return ifnone(); + } else { + return ifnone; + } + } + ; + return nil; + } catch ($returner) { if ($returner === Opal.returner) { return $returner.$v } throw $returner; } + }, TMP_Enumerable_detect_25.$$arity = -1); + + Opal.def(self, '$drop', TMP_Enumerable_drop_27 = function $$drop(number) { + var self = this; + + + number = $$($nesting, 'Opal').$coerce_to(number, $$($nesting, 'Integer'), "to_int"); + if ($truthy(number < 0)) { + self.$raise($$($nesting, 'ArgumentError'), "attempt to drop negative size")}; + + var result = [], + current = 0; + + self.$each.$$p = function() { + if (number <= current) { + result.push($$($nesting, 'Opal').$destructure(arguments)); + } + + current++; + }; + + self.$each() + + return result; + ; + }, TMP_Enumerable_drop_27.$$arity = 1); + + Opal.def(self, '$drop_while', TMP_Enumerable_drop_while_28 = function $$drop_while() { + var $iter = TMP_Enumerable_drop_while_28.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Enumerable_drop_while_28.$$p = null; + + + if ($iter) TMP_Enumerable_drop_while_28.$$p = null;; + if ((block !== nil)) { + } else { + return self.$enum_for("drop_while") + }; + + var result = [], + dropping = true; + + self.$each.$$p = function() { + var param = $$($nesting, 'Opal').$destructure(arguments); + + if (dropping) { + var value = Opal.yield1(block, param); + + if ($falsy(value)) { + dropping = false; + result.push(param); + } + } + else { + result.push(param); + } + }; + + self.$each(); + + return result; + ; + }, TMP_Enumerable_drop_while_28.$$arity = 0); + + Opal.def(self, '$each_cons', TMP_Enumerable_each_cons_29 = function $$each_cons(n) { + var $iter = TMP_Enumerable_each_cons_29.$$p, block = $iter || nil, TMP_30, self = this; + + if ($iter) TMP_Enumerable_each_cons_29.$$p = null; + + + if ($iter) TMP_Enumerable_each_cons_29.$$p = null;; + if ($truthy(arguments.length != 1)) { + self.$raise($$($nesting, 'ArgumentError'), "" + "wrong number of arguments (" + (arguments.length) + " for 1)")}; + n = $$($nesting, 'Opal').$try_convert(n, $$($nesting, 'Integer'), "to_int"); + if ($truthy(n <= 0)) { + self.$raise($$($nesting, 'ArgumentError'), "invalid size")}; + if ((block !== nil)) { + } else { + return $send(self, 'enum_for', ["each_cons", n], (TMP_30 = function(){var self = TMP_30.$$s || this, $a, enum_size = nil; + + + enum_size = self.$enumerator_size(); + if ($truthy(enum_size['$nil?']())) { + return nil + } else if ($truthy(($truthy($a = enum_size['$=='](0)) ? $a : $rb_lt(enum_size, n)))) { + return 0 + } else { + return $rb_plus($rb_minus(enum_size, n), 1) + };}, TMP_30.$$s = self, TMP_30.$$arity = 0, TMP_30)) + }; + + var buffer = [], result = nil; + + self.$each.$$p = function() { + var element = $$($nesting, 'Opal').$destructure(arguments); + buffer.push(element); + if (buffer.length > n) { + buffer.shift(); + } + if (buffer.length == n) { + Opal.yield1(block, buffer.slice(0, n)); + } + } + + self.$each(); + + return result; + ; + }, TMP_Enumerable_each_cons_29.$$arity = 1); + + Opal.def(self, '$each_entry', TMP_Enumerable_each_entry_31 = function $$each_entry($a) { + var $iter = TMP_Enumerable_each_entry_31.$$p, block = $iter || nil, $post_args, data, TMP_32, self = this; + + if ($iter) TMP_Enumerable_each_entry_31.$$p = null; + + + if ($iter) TMP_Enumerable_each_entry_31.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + data = $post_args;; + if ((block !== nil)) { + } else { + return $send(self, 'to_enum', ["each_entry"].concat(Opal.to_a(data)), (TMP_32 = function(){var self = TMP_32.$$s || this; + + return self.$enumerator_size()}, TMP_32.$$s = self, TMP_32.$$arity = 0, TMP_32)) + }; + + self.$each.$$p = function() { + var item = $$($nesting, 'Opal').$destructure(arguments); + + Opal.yield1(block, item); + } + + self.$each.apply(self, data); + + return self; + ; + }, TMP_Enumerable_each_entry_31.$$arity = -1); + + Opal.def(self, '$each_slice', TMP_Enumerable_each_slice_33 = function $$each_slice(n) { + var $iter = TMP_Enumerable_each_slice_33.$$p, block = $iter || nil, TMP_34, self = this; + + if ($iter) TMP_Enumerable_each_slice_33.$$p = null; + + + if ($iter) TMP_Enumerable_each_slice_33.$$p = null;; + n = $$($nesting, 'Opal').$coerce_to(n, $$($nesting, 'Integer'), "to_int"); + if ($truthy(n <= 0)) { + self.$raise($$($nesting, 'ArgumentError'), "invalid slice size")}; + if ((block !== nil)) { + } else { + return $send(self, 'enum_for', ["each_slice", n], (TMP_34 = function(){var self = TMP_34.$$s || this; + + if ($truthy(self['$respond_to?']("size"))) { + return $rb_divide(self.$size(), n).$ceil() + } else { + return nil + }}, TMP_34.$$s = self, TMP_34.$$arity = 0, TMP_34)) + }; + + var result, + slice = [] + + self.$each.$$p = function() { + var param = $$($nesting, 'Opal').$destructure(arguments); + + slice.push(param); + + if (slice.length === n) { + Opal.yield1(block, slice); + slice = []; + } + }; + + self.$each(); + + if (result !== undefined) { + return result; + } + + // our "last" group, if smaller than n then won't have been yielded + if (slice.length > 0) { + Opal.yield1(block, slice); + } + ; + return nil; + }, TMP_Enumerable_each_slice_33.$$arity = 1); + + Opal.def(self, '$each_with_index', TMP_Enumerable_each_with_index_35 = function $$each_with_index($a) { + var $iter = TMP_Enumerable_each_with_index_35.$$p, block = $iter || nil, $post_args, args, TMP_36, self = this; + + if ($iter) TMP_Enumerable_each_with_index_35.$$p = null; + + + if ($iter) TMP_Enumerable_each_with_index_35.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + if ((block !== nil)) { + } else { + return $send(self, 'enum_for', ["each_with_index"].concat(Opal.to_a(args)), (TMP_36 = function(){var self = TMP_36.$$s || this; + + return self.$enumerator_size()}, TMP_36.$$s = self, TMP_36.$$arity = 0, TMP_36)) + }; + + var result, + index = 0; + + self.$each.$$p = function() { + var param = $$($nesting, 'Opal').$destructure(arguments); + + block(param, index); + + index++; + }; + + self.$each.apply(self, args); + + if (result !== undefined) { + return result; + } + ; + return self; + }, TMP_Enumerable_each_with_index_35.$$arity = -1); + + Opal.def(self, '$each_with_object', TMP_Enumerable_each_with_object_37 = function $$each_with_object(object) { + var $iter = TMP_Enumerable_each_with_object_37.$$p, block = $iter || nil, TMP_38, self = this; + + if ($iter) TMP_Enumerable_each_with_object_37.$$p = null; + + + if ($iter) TMP_Enumerable_each_with_object_37.$$p = null;; + if ((block !== nil)) { + } else { + return $send(self, 'enum_for', ["each_with_object", object], (TMP_38 = function(){var self = TMP_38.$$s || this; + + return self.$enumerator_size()}, TMP_38.$$s = self, TMP_38.$$arity = 0, TMP_38)) + }; + + var result; + + self.$each.$$p = function() { + var param = $$($nesting, 'Opal').$destructure(arguments); + + block(param, object); + }; + + self.$each(); + + if (result !== undefined) { + return result; + } + ; + return object; + }, TMP_Enumerable_each_with_object_37.$$arity = 1); + + Opal.def(self, '$entries', TMP_Enumerable_entries_39 = function $$entries($a) { + var $post_args, args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + + var result = []; + + self.$each.$$p = function() { + result.push($$($nesting, 'Opal').$destructure(arguments)); + }; + + self.$each.apply(self, args); + + return result; + ; + }, TMP_Enumerable_entries_39.$$arity = -1); + Opal.alias(self, "find", "detect"); + + Opal.def(self, '$find_all', TMP_Enumerable_find_all_40 = function $$find_all() { + var $iter = TMP_Enumerable_find_all_40.$$p, block = $iter || nil, TMP_41, self = this; + + if ($iter) TMP_Enumerable_find_all_40.$$p = null; + + + if ($iter) TMP_Enumerable_find_all_40.$$p = null;; + if ((block !== nil)) { + } else { + return $send(self, 'enum_for', ["find_all"], (TMP_41 = function(){var self = TMP_41.$$s || this; + + return self.$enumerator_size()}, TMP_41.$$s = self, TMP_41.$$arity = 0, TMP_41)) + }; + + var result = []; + + self.$each.$$p = function() { + var param = $$($nesting, 'Opal').$destructure(arguments), + value = Opal.yield1(block, param); + + if ($truthy(value)) { + result.push(param); + } + }; + + self.$each(); + + return result; + ; + }, TMP_Enumerable_find_all_40.$$arity = 0); + + Opal.def(self, '$find_index', TMP_Enumerable_find_index_42 = function $$find_index(object) {try { + + var $iter = TMP_Enumerable_find_index_42.$$p, block = $iter || nil, TMP_43, TMP_44, self = this, index = nil; + + if ($iter) TMP_Enumerable_find_index_42.$$p = null; + + + if ($iter) TMP_Enumerable_find_index_42.$$p = null;; + ; + if ($truthy(object === undefined && block === nil)) { + return self.$enum_for("find_index")}; + + if (object != null && block !== nil) { + self.$warn("warning: given block not used") + } + ; + index = 0; + if ($truthy(object != null)) { + $send(self, 'each', [], (TMP_43 = function($a){var self = TMP_43.$$s || this, $post_args, value; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + value = $post_args;; + if ($$($nesting, 'Opal').$destructure(value)['$=='](object)) { + Opal.ret(index)}; + return index += 1;;}, TMP_43.$$s = self, TMP_43.$$arity = -1, TMP_43)) + } else { + $send(self, 'each', [], (TMP_44 = function($a){var self = TMP_44.$$s || this, $post_args, value; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + value = $post_args;; + if ($truthy(Opal.yieldX(block, Opal.to_a(value)))) { + Opal.ret(index)}; + return index += 1;;}, TMP_44.$$s = self, TMP_44.$$arity = -1, TMP_44)) + }; + return nil; + } catch ($returner) { if ($returner === Opal.returner) { return $returner.$v } throw $returner; } + }, TMP_Enumerable_find_index_42.$$arity = -1); + + Opal.def(self, '$first', TMP_Enumerable_first_45 = function $$first(number) {try { + + var TMP_46, TMP_47, self = this, result = nil, current = nil; + + + ; + if ($truthy(number === undefined)) { + return $send(self, 'each', [], (TMP_46 = function(value){var self = TMP_46.$$s || this; + + + + if (value == null) { + value = nil; + }; + Opal.ret(value);}, TMP_46.$$s = self, TMP_46.$$arity = 1, TMP_46)) + } else { + + result = []; + number = $$($nesting, 'Opal').$coerce_to(number, $$($nesting, 'Integer'), "to_int"); + if ($truthy(number < 0)) { + self.$raise($$($nesting, 'ArgumentError'), "attempt to take negative size")}; + if ($truthy(number == 0)) { + return []}; + current = 0; + $send(self, 'each', [], (TMP_47 = function($a){var self = TMP_47.$$s || this, $post_args, args; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + result.push($$($nesting, 'Opal').$destructure(args)); + if ($truthy(number <= ++current)) { + Opal.ret(result) + } else { + return nil + };}, TMP_47.$$s = self, TMP_47.$$arity = -1, TMP_47)); + return result; + }; + } catch ($returner) { if ($returner === Opal.returner) { return $returner.$v } throw $returner; } + }, TMP_Enumerable_first_45.$$arity = -1); + Opal.alias(self, "flat_map", "collect_concat"); + + Opal.def(self, '$grep', TMP_Enumerable_grep_48 = function $$grep(pattern) { + var $iter = TMP_Enumerable_grep_48.$$p, block = $iter || nil, TMP_49, self = this, result = nil; + + if ($iter) TMP_Enumerable_grep_48.$$p = null; + + + if ($iter) TMP_Enumerable_grep_48.$$p = null;; + result = []; + $send(self, 'each', [], (TMP_49 = function($a){var self = TMP_49.$$s || this, $post_args, value, cmp = nil; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + value = $post_args;; + cmp = comparableForPattern(value); + if ($truthy($send(pattern, '__send__', ["==="].concat(Opal.to_a(cmp))))) { + } else { + return nil; + }; + if ((block !== nil)) { + + if ($truthy($rb_gt(value.$length(), 1))) { + value = [value]}; + value = Opal.yieldX(block, Opal.to_a(value)); + } else if ($truthy($rb_le(value.$length(), 1))) { + value = value['$[]'](0)}; + return result.$push(value);}, TMP_49.$$s = self, TMP_49.$$arity = -1, TMP_49)); + return result; + }, TMP_Enumerable_grep_48.$$arity = 1); + + Opal.def(self, '$grep_v', TMP_Enumerable_grep_v_50 = function $$grep_v(pattern) { + var $iter = TMP_Enumerable_grep_v_50.$$p, block = $iter || nil, TMP_51, self = this, result = nil; + + if ($iter) TMP_Enumerable_grep_v_50.$$p = null; + + + if ($iter) TMP_Enumerable_grep_v_50.$$p = null;; + result = []; + $send(self, 'each', [], (TMP_51 = function($a){var self = TMP_51.$$s || this, $post_args, value, cmp = nil; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + value = $post_args;; + cmp = comparableForPattern(value); + if ($truthy($send(pattern, '__send__', ["==="].concat(Opal.to_a(cmp))))) { + return nil;}; + if ((block !== nil)) { + + if ($truthy($rb_gt(value.$length(), 1))) { + value = [value]}; + value = Opal.yieldX(block, Opal.to_a(value)); + } else if ($truthy($rb_le(value.$length(), 1))) { + value = value['$[]'](0)}; + return result.$push(value);}, TMP_51.$$s = self, TMP_51.$$arity = -1, TMP_51)); + return result; + }, TMP_Enumerable_grep_v_50.$$arity = 1); + + Opal.def(self, '$group_by', TMP_Enumerable_group_by_52 = function $$group_by() { + var $iter = TMP_Enumerable_group_by_52.$$p, block = $iter || nil, TMP_53, $a, self = this, hash = nil, $writer = nil; + + if ($iter) TMP_Enumerable_group_by_52.$$p = null; + + + if ($iter) TMP_Enumerable_group_by_52.$$p = null;; + if ((block !== nil)) { + } else { + return $send(self, 'enum_for', ["group_by"], (TMP_53 = function(){var self = TMP_53.$$s || this; + + return self.$enumerator_size()}, TMP_53.$$s = self, TMP_53.$$arity = 0, TMP_53)) + }; + hash = $hash2([], {}); + + var result; + + self.$each.$$p = function() { + var param = $$($nesting, 'Opal').$destructure(arguments), + value = Opal.yield1(block, param); + + ($truthy($a = hash['$[]'](value)) ? $a : (($writer = [value, []]), $send(hash, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]))['$<<'](param); + } + + self.$each(); + + if (result !== undefined) { + return result; + } + ; + return hash; + }, TMP_Enumerable_group_by_52.$$arity = 0); + + Opal.def(self, '$include?', TMP_Enumerable_include$q_54 = function(obj) {try { + + var TMP_55, self = this; + + + $send(self, 'each', [], (TMP_55 = function($a){var self = TMP_55.$$s || this, $post_args, args; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + if ($$($nesting, 'Opal').$destructure(args)['$=='](obj)) { + Opal.ret(true) + } else { + return nil + };}, TMP_55.$$s = self, TMP_55.$$arity = -1, TMP_55)); + return false; + } catch ($returner) { if ($returner === Opal.returner) { return $returner.$v } throw $returner; } + }, TMP_Enumerable_include$q_54.$$arity = 1); + + Opal.def(self, '$inject', TMP_Enumerable_inject_56 = function $$inject(object, sym) { + var $iter = TMP_Enumerable_inject_56.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Enumerable_inject_56.$$p = null; + + + if ($iter) TMP_Enumerable_inject_56.$$p = null;; + ; + ; + + var result = object; + + if (block !== nil && sym === undefined) { + self.$each.$$p = function() { + var value = $$($nesting, 'Opal').$destructure(arguments); + + if (result === undefined) { + result = value; + return; + } + + value = Opal.yieldX(block, [result, value]); + + result = value; + }; + } + else { + if (sym === undefined) { + if (!$$($nesting, 'Symbol')['$==='](object)) { + self.$raise($$($nesting, 'TypeError'), "" + (object.$inspect()) + " is not a Symbol"); + } + + sym = object; + result = undefined; + } + + self.$each.$$p = function() { + var value = $$($nesting, 'Opal').$destructure(arguments); + + if (result === undefined) { + result = value; + return; + } + + result = (result).$__send__(sym, value); + }; + } + + self.$each(); + + return result == undefined ? nil : result; + ; + }, TMP_Enumerable_inject_56.$$arity = -1); + + Opal.def(self, '$lazy', TMP_Enumerable_lazy_57 = function $$lazy() { + var TMP_58, self = this; + + return $send($$$($$($nesting, 'Enumerator'), 'Lazy'), 'new', [self, self.$enumerator_size()], (TMP_58 = function(enum$, $a){var self = TMP_58.$$s || this, $post_args, args; + + + + if (enum$ == null) { + enum$ = nil; + }; + + $post_args = Opal.slice.call(arguments, 1, arguments.length); + + args = $post_args;; + return $send(enum$, 'yield', Opal.to_a(args));}, TMP_58.$$s = self, TMP_58.$$arity = -2, TMP_58)) + }, TMP_Enumerable_lazy_57.$$arity = 0); + + Opal.def(self, '$enumerator_size', TMP_Enumerable_enumerator_size_59 = function $$enumerator_size() { + var self = this; + + if ($truthy(self['$respond_to?']("size"))) { + return self.$size() + } else { + return nil + } + }, TMP_Enumerable_enumerator_size_59.$$arity = 0); + Opal.alias(self, "map", "collect"); + + Opal.def(self, '$max', TMP_Enumerable_max_60 = function $$max(n) { + var $iter = TMP_Enumerable_max_60.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Enumerable_max_60.$$p = null; + + + if ($iter) TMP_Enumerable_max_60.$$p = null;; + ; + + if (n === undefined || n === nil) { + var result, value; + + self.$each.$$p = function() { + var item = $$($nesting, 'Opal').$destructure(arguments); + + if (result === undefined) { + result = item; + return; + } + + if (block !== nil) { + value = Opal.yieldX(block, [item, result]); + } else { + value = (item)['$<=>'](result); + } + + if (value === nil) { + self.$raise($$($nesting, 'ArgumentError'), "comparison failed"); + } + + if (value > 0) { + result = item; + } + } + + self.$each(); + + if (result === undefined) { + return nil; + } else { + return result; + } + } + ; + n = $$($nesting, 'Opal').$coerce_to(n, $$($nesting, 'Integer'), "to_int"); + return $send(self, 'sort', [], block.$to_proc()).$reverse().$first(n); + }, TMP_Enumerable_max_60.$$arity = -1); + + Opal.def(self, '$max_by', TMP_Enumerable_max_by_61 = function $$max_by() { + var $iter = TMP_Enumerable_max_by_61.$$p, block = $iter || nil, TMP_62, self = this; + + if ($iter) TMP_Enumerable_max_by_61.$$p = null; + + + if ($iter) TMP_Enumerable_max_by_61.$$p = null;; + if ($truthy(block)) { + } else { + return $send(self, 'enum_for', ["max_by"], (TMP_62 = function(){var self = TMP_62.$$s || this; + + return self.$enumerator_size()}, TMP_62.$$s = self, TMP_62.$$arity = 0, TMP_62)) + }; + + var result, + by; + + self.$each.$$p = function() { + var param = $$($nesting, 'Opal').$destructure(arguments), + value = Opal.yield1(block, param); + + if (result === undefined) { + result = param; + by = value; + return; + } + + if ((value)['$<=>'](by) > 0) { + result = param + by = value; + } + }; + + self.$each(); + + return result === undefined ? nil : result; + ; + }, TMP_Enumerable_max_by_61.$$arity = 0); + Opal.alias(self, "member?", "include?"); + + Opal.def(self, '$min', TMP_Enumerable_min_63 = function $$min() { + var $iter = TMP_Enumerable_min_63.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Enumerable_min_63.$$p = null; + + + if ($iter) TMP_Enumerable_min_63.$$p = null;; + + var result; + + if (block !== nil) { + self.$each.$$p = function() { + var param = $$($nesting, 'Opal').$destructure(arguments); + + if (result === undefined) { + result = param; + return; + } + + var value = block(param, result); + + if (value === nil) { + self.$raise($$($nesting, 'ArgumentError'), "comparison failed"); + } + + if (value < 0) { + result = param; + } + }; + } + else { + self.$each.$$p = function() { + var param = $$($nesting, 'Opal').$destructure(arguments); + + if (result === undefined) { + result = param; + return; + } + + if ($$($nesting, 'Opal').$compare(param, result) < 0) { + result = param; + } + }; + } + + self.$each(); + + return result === undefined ? nil : result; + ; + }, TMP_Enumerable_min_63.$$arity = 0); + + Opal.def(self, '$min_by', TMP_Enumerable_min_by_64 = function $$min_by() { + var $iter = TMP_Enumerable_min_by_64.$$p, block = $iter || nil, TMP_65, self = this; + + if ($iter) TMP_Enumerable_min_by_64.$$p = null; + + + if ($iter) TMP_Enumerable_min_by_64.$$p = null;; + if ($truthy(block)) { + } else { + return $send(self, 'enum_for', ["min_by"], (TMP_65 = function(){var self = TMP_65.$$s || this; + + return self.$enumerator_size()}, TMP_65.$$s = self, TMP_65.$$arity = 0, TMP_65)) + }; + + var result, + by; + + self.$each.$$p = function() { + var param = $$($nesting, 'Opal').$destructure(arguments), + value = Opal.yield1(block, param); + + if (result === undefined) { + result = param; + by = value; + return; + } + + if ((value)['$<=>'](by) < 0) { + result = param + by = value; + } + }; + + self.$each(); + + return result === undefined ? nil : result; + ; + }, TMP_Enumerable_min_by_64.$$arity = 0); + + Opal.def(self, '$minmax', TMP_Enumerable_minmax_66 = function $$minmax() { + var $iter = TMP_Enumerable_minmax_66.$$p, block = $iter || nil, $a, TMP_67, self = this; + + if ($iter) TMP_Enumerable_minmax_66.$$p = null; + + + if ($iter) TMP_Enumerable_minmax_66.$$p = null;; + block = ($truthy($a = block) ? $a : $send(self, 'proc', [], (TMP_67 = function(a, b){var self = TMP_67.$$s || this; + + + + if (a == null) { + a = nil; + }; + + if (b == null) { + b = nil; + }; + return a['$<=>'](b);}, TMP_67.$$s = self, TMP_67.$$arity = 2, TMP_67))); + + var min = nil, max = nil, first_time = true; + + self.$each.$$p = function() { + var element = $$($nesting, 'Opal').$destructure(arguments); + if (first_time) { + min = max = element; + first_time = false; + } else { + var min_cmp = block.$call(min, element); + + if (min_cmp === nil) { + self.$raise($$($nesting, 'ArgumentError'), "comparison failed") + } else if (min_cmp > 0) { + min = element; + } + + var max_cmp = block.$call(max, element); + + if (max_cmp === nil) { + self.$raise($$($nesting, 'ArgumentError'), "comparison failed") + } else if (max_cmp < 0) { + max = element; + } + } + } + + self.$each(); + + return [min, max]; + ; + }, TMP_Enumerable_minmax_66.$$arity = 0); + + Opal.def(self, '$minmax_by', TMP_Enumerable_minmax_by_68 = function $$minmax_by() { + var $iter = TMP_Enumerable_minmax_by_68.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Enumerable_minmax_by_68.$$p = null; + + + if ($iter) TMP_Enumerable_minmax_by_68.$$p = null;; + return self.$raise($$($nesting, 'NotImplementedError')); + }, TMP_Enumerable_minmax_by_68.$$arity = 0); + + Opal.def(self, '$none?', TMP_Enumerable_none$q_69 = function(pattern) {try { + + var $iter = TMP_Enumerable_none$q_69.$$p, block = $iter || nil, TMP_70, TMP_71, TMP_72, self = this; + + if ($iter) TMP_Enumerable_none$q_69.$$p = null; + + + if ($iter) TMP_Enumerable_none$q_69.$$p = null;; + ; + if ($truthy(pattern !== undefined)) { + $send(self, 'each', [], (TMP_70 = function($a){var self = TMP_70.$$s || this, $post_args, value, comparable = nil; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + value = $post_args;; + comparable = comparableForPattern(value); + if ($truthy($send(pattern, 'public_send', ["==="].concat(Opal.to_a(comparable))))) { + Opal.ret(false) + } else { + return nil + };}, TMP_70.$$s = self, TMP_70.$$arity = -1, TMP_70)) + } else if ((block !== nil)) { + $send(self, 'each', [], (TMP_71 = function($a){var self = TMP_71.$$s || this, $post_args, value; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + value = $post_args;; + if ($truthy(Opal.yieldX(block, Opal.to_a(value)))) { + Opal.ret(false) + } else { + return nil + };}, TMP_71.$$s = self, TMP_71.$$arity = -1, TMP_71)) + } else { + $send(self, 'each', [], (TMP_72 = function($a){var self = TMP_72.$$s || this, $post_args, value, item = nil; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + value = $post_args;; + item = $$($nesting, 'Opal').$destructure(value); + if ($truthy(item)) { + Opal.ret(false) + } else { + return nil + };}, TMP_72.$$s = self, TMP_72.$$arity = -1, TMP_72)) + }; + return true; + } catch ($returner) { if ($returner === Opal.returner) { return $returner.$v } throw $returner; } + }, TMP_Enumerable_none$q_69.$$arity = -1); + + Opal.def(self, '$one?', TMP_Enumerable_one$q_73 = function(pattern) {try { + + var $iter = TMP_Enumerable_one$q_73.$$p, block = $iter || nil, TMP_74, TMP_75, TMP_76, self = this, count = nil; + + if ($iter) TMP_Enumerable_one$q_73.$$p = null; + + + if ($iter) TMP_Enumerable_one$q_73.$$p = null;; + ; + count = 0; + if ($truthy(pattern !== undefined)) { + $send(self, 'each', [], (TMP_74 = function($a){var self = TMP_74.$$s || this, $post_args, value, comparable = nil; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + value = $post_args;; + comparable = comparableForPattern(value); + if ($truthy($send(pattern, 'public_send', ["==="].concat(Opal.to_a(comparable))))) { + + count = $rb_plus(count, 1); + if ($truthy($rb_gt(count, 1))) { + Opal.ret(false) + } else { + return nil + }; + } else { + return nil + };}, TMP_74.$$s = self, TMP_74.$$arity = -1, TMP_74)) + } else if ((block !== nil)) { + $send(self, 'each', [], (TMP_75 = function($a){var self = TMP_75.$$s || this, $post_args, value; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + value = $post_args;; + if ($truthy(Opal.yieldX(block, Opal.to_a(value)))) { + } else { + return nil; + }; + count = $rb_plus(count, 1); + if ($truthy($rb_gt(count, 1))) { + Opal.ret(false) + } else { + return nil + };}, TMP_75.$$s = self, TMP_75.$$arity = -1, TMP_75)) + } else { + $send(self, 'each', [], (TMP_76 = function($a){var self = TMP_76.$$s || this, $post_args, value; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + value = $post_args;; + if ($truthy($$($nesting, 'Opal').$destructure(value))) { + } else { + return nil; + }; + count = $rb_plus(count, 1); + if ($truthy($rb_gt(count, 1))) { + Opal.ret(false) + } else { + return nil + };}, TMP_76.$$s = self, TMP_76.$$arity = -1, TMP_76)) + }; + return count['$=='](1); + } catch ($returner) { if ($returner === Opal.returner) { return $returner.$v } throw $returner; } + }, TMP_Enumerable_one$q_73.$$arity = -1); + + Opal.def(self, '$partition', TMP_Enumerable_partition_77 = function $$partition() { + var $iter = TMP_Enumerable_partition_77.$$p, block = $iter || nil, TMP_78, self = this; + + if ($iter) TMP_Enumerable_partition_77.$$p = null; + + + if ($iter) TMP_Enumerable_partition_77.$$p = null;; + if ((block !== nil)) { + } else { + return $send(self, 'enum_for', ["partition"], (TMP_78 = function(){var self = TMP_78.$$s || this; + + return self.$enumerator_size()}, TMP_78.$$s = self, TMP_78.$$arity = 0, TMP_78)) + }; + + var truthy = [], falsy = [], result; + + self.$each.$$p = function() { + var param = $$($nesting, 'Opal').$destructure(arguments), + value = Opal.yield1(block, param); + + if ($truthy(value)) { + truthy.push(param); + } + else { + falsy.push(param); + } + }; + + self.$each(); + + return [truthy, falsy]; + ; + }, TMP_Enumerable_partition_77.$$arity = 0); + Opal.alias(self, "reduce", "inject"); + + Opal.def(self, '$reject', TMP_Enumerable_reject_79 = function $$reject() { + var $iter = TMP_Enumerable_reject_79.$$p, block = $iter || nil, TMP_80, self = this; + + if ($iter) TMP_Enumerable_reject_79.$$p = null; + + + if ($iter) TMP_Enumerable_reject_79.$$p = null;; + if ((block !== nil)) { + } else { + return $send(self, 'enum_for', ["reject"], (TMP_80 = function(){var self = TMP_80.$$s || this; + + return self.$enumerator_size()}, TMP_80.$$s = self, TMP_80.$$arity = 0, TMP_80)) + }; + + var result = []; + + self.$each.$$p = function() { + var param = $$($nesting, 'Opal').$destructure(arguments), + value = Opal.yield1(block, param); + + if ($falsy(value)) { + result.push(param); + } + }; + + self.$each(); + + return result; + ; + }, TMP_Enumerable_reject_79.$$arity = 0); + + Opal.def(self, '$reverse_each', TMP_Enumerable_reverse_each_81 = function $$reverse_each() { + var $iter = TMP_Enumerable_reverse_each_81.$$p, block = $iter || nil, TMP_82, self = this; + + if ($iter) TMP_Enumerable_reverse_each_81.$$p = null; + + + if ($iter) TMP_Enumerable_reverse_each_81.$$p = null;; + if ((block !== nil)) { + } else { + return $send(self, 'enum_for', ["reverse_each"], (TMP_82 = function(){var self = TMP_82.$$s || this; + + return self.$enumerator_size()}, TMP_82.$$s = self, TMP_82.$$arity = 0, TMP_82)) + }; + + var result = []; + + self.$each.$$p = function() { + result.push(arguments); + }; + + self.$each(); + + for (var i = result.length - 1; i >= 0; i--) { + Opal.yieldX(block, result[i]); + } + + return result; + ; + }, TMP_Enumerable_reverse_each_81.$$arity = 0); + Opal.alias(self, "select", "find_all"); + + Opal.def(self, '$slice_before', TMP_Enumerable_slice_before_83 = function $$slice_before(pattern) { + var $iter = TMP_Enumerable_slice_before_83.$$p, block = $iter || nil, TMP_84, self = this; + + if ($iter) TMP_Enumerable_slice_before_83.$$p = null; + + + if ($iter) TMP_Enumerable_slice_before_83.$$p = null;; + ; + if ($truthy(pattern === undefined && block === nil)) { + self.$raise($$($nesting, 'ArgumentError'), "both pattern and block are given")}; + if ($truthy(pattern !== undefined && block !== nil || arguments.length > 1)) { + self.$raise($$($nesting, 'ArgumentError'), "" + "wrong number of arguments (" + (arguments.length) + " expected 1)")}; + return $send($$($nesting, 'Enumerator'), 'new', [], (TMP_84 = function(e){var self = TMP_84.$$s || this; + + + + if (e == null) { + e = nil; + }; + + var slice = []; + + if (block !== nil) { + if (pattern === undefined) { + self.$each.$$p = function() { + var param = $$($nesting, 'Opal').$destructure(arguments), + value = Opal.yield1(block, param); + + if ($truthy(value) && slice.length > 0) { + e['$<<'](slice); + slice = []; + } + + slice.push(param); + }; + } + else { + self.$each.$$p = function() { + var param = $$($nesting, 'Opal').$destructure(arguments), + value = block(param, pattern.$dup()); + + if ($truthy(value) && slice.length > 0) { + e['$<<'](slice); + slice = []; + } + + slice.push(param); + }; + } + } + else { + self.$each.$$p = function() { + var param = $$($nesting, 'Opal').$destructure(arguments), + value = pattern['$==='](param); + + if ($truthy(value) && slice.length > 0) { + e['$<<'](slice); + slice = []; + } + + slice.push(param); + }; + } + + self.$each(); + + if (slice.length > 0) { + e['$<<'](slice); + } + ;}, TMP_84.$$s = self, TMP_84.$$arity = 1, TMP_84)); + }, TMP_Enumerable_slice_before_83.$$arity = -1); + + Opal.def(self, '$slice_after', TMP_Enumerable_slice_after_85 = function $$slice_after(pattern) { + var $iter = TMP_Enumerable_slice_after_85.$$p, block = $iter || nil, TMP_86, TMP_87, self = this; + + if ($iter) TMP_Enumerable_slice_after_85.$$p = null; + + + if ($iter) TMP_Enumerable_slice_after_85.$$p = null;; + ; + if ($truthy(pattern === undefined && block === nil)) { + self.$raise($$($nesting, 'ArgumentError'), "both pattern and block are given")}; + if ($truthy(pattern !== undefined && block !== nil || arguments.length > 1)) { + self.$raise($$($nesting, 'ArgumentError'), "" + "wrong number of arguments (" + (arguments.length) + " expected 1)")}; + if ($truthy(pattern !== undefined)) { + block = $send(self, 'proc', [], (TMP_86 = function(e){var self = TMP_86.$$s || this; + + + + if (e == null) { + e = nil; + }; + return pattern['$==='](e);}, TMP_86.$$s = self, TMP_86.$$arity = 1, TMP_86))}; + return $send($$($nesting, 'Enumerator'), 'new', [], (TMP_87 = function(yielder){var self = TMP_87.$$s || this; + + + + if (yielder == null) { + yielder = nil; + }; + + var accumulate; + + self.$each.$$p = function() { + var element = $$($nesting, 'Opal').$destructure(arguments), + end_chunk = Opal.yield1(block, element); + + if (accumulate == null) { + accumulate = []; + } + + if ($truthy(end_chunk)) { + accumulate.push(element); + yielder.$yield(accumulate); + accumulate = null; + } else { + accumulate.push(element) + } + } + + self.$each(); + + if (accumulate != null) { + yielder.$yield(accumulate); + } + ;}, TMP_87.$$s = self, TMP_87.$$arity = 1, TMP_87)); + }, TMP_Enumerable_slice_after_85.$$arity = -1); + + Opal.def(self, '$slice_when', TMP_Enumerable_slice_when_88 = function $$slice_when() { + var $iter = TMP_Enumerable_slice_when_88.$$p, block = $iter || nil, TMP_89, self = this; + + if ($iter) TMP_Enumerable_slice_when_88.$$p = null; + + + if ($iter) TMP_Enumerable_slice_when_88.$$p = null;; + if ((block !== nil)) { + } else { + self.$raise($$($nesting, 'ArgumentError'), "wrong number of arguments (0 for 1)") + }; + return $send($$($nesting, 'Enumerator'), 'new', [], (TMP_89 = function(yielder){var self = TMP_89.$$s || this; + + + + if (yielder == null) { + yielder = nil; + }; + + var slice = nil, last_after = nil; + + self.$each_cons.$$p = function() { + var params = $$($nesting, 'Opal').$destructure(arguments), + before = params[0], + after = params[1], + match = Opal.yieldX(block, [before, after]); + + last_after = after; + + if (slice === nil) { + slice = []; + } + + if ($truthy(match)) { + slice.push(before); + yielder.$yield(slice); + slice = []; + } else { + slice.push(before); + } + } + + self.$each_cons(2); + + if (slice !== nil) { + slice.push(last_after); + yielder.$yield(slice); + } + ;}, TMP_89.$$s = self, TMP_89.$$arity = 1, TMP_89)); + }, TMP_Enumerable_slice_when_88.$$arity = 0); + + Opal.def(self, '$sort', TMP_Enumerable_sort_90 = function $$sort() { + var $iter = TMP_Enumerable_sort_90.$$p, block = $iter || nil, TMP_91, self = this, ary = nil; + + if ($iter) TMP_Enumerable_sort_90.$$p = null; + + + if ($iter) TMP_Enumerable_sort_90.$$p = null;; + ary = self.$to_a(); + if ((block !== nil)) { + } else { + block = $lambda((TMP_91 = function(a, b){var self = TMP_91.$$s || this; + + + + if (a == null) { + a = nil; + }; + + if (b == null) { + b = nil; + }; + return a['$<=>'](b);}, TMP_91.$$s = self, TMP_91.$$arity = 2, TMP_91)) + }; + return $send(ary, 'sort', [], block.$to_proc()); + }, TMP_Enumerable_sort_90.$$arity = 0); + + Opal.def(self, '$sort_by', TMP_Enumerable_sort_by_92 = function $$sort_by() { + var $iter = TMP_Enumerable_sort_by_92.$$p, block = $iter || nil, TMP_93, TMP_94, TMP_95, TMP_96, self = this, dup = nil; + + if ($iter) TMP_Enumerable_sort_by_92.$$p = null; + + + if ($iter) TMP_Enumerable_sort_by_92.$$p = null;; + if ((block !== nil)) { + } else { + return $send(self, 'enum_for', ["sort_by"], (TMP_93 = function(){var self = TMP_93.$$s || this; + + return self.$enumerator_size()}, TMP_93.$$s = self, TMP_93.$$arity = 0, TMP_93)) + }; + dup = $send(self, 'map', [], (TMP_94 = function(){var self = TMP_94.$$s || this, arg = nil; + + + arg = $$($nesting, 'Opal').$destructure(arguments); + return [Opal.yield1(block, arg), arg];}, TMP_94.$$s = self, TMP_94.$$arity = 0, TMP_94)); + $send(dup, 'sort!', [], (TMP_95 = function(a, b){var self = TMP_95.$$s || this; + + + + if (a == null) { + a = nil; + }; + + if (b == null) { + b = nil; + }; + return (a[0])['$<=>'](b[0]);}, TMP_95.$$s = self, TMP_95.$$arity = 2, TMP_95)); + return $send(dup, 'map!', [], (TMP_96 = function(i){var self = TMP_96.$$s || this; + + + + if (i == null) { + i = nil; + }; + return i[1];;}, TMP_96.$$s = self, TMP_96.$$arity = 1, TMP_96)); + }, TMP_Enumerable_sort_by_92.$$arity = 0); + + Opal.def(self, '$sum', TMP_Enumerable_sum_97 = function $$sum(initial) { + var TMP_98, $iter = TMP_Enumerable_sum_97.$$p, $yield = $iter || nil, self = this, result = nil; + + if ($iter) TMP_Enumerable_sum_97.$$p = null; + + + if (initial == null) { + initial = 0; + }; + result = initial; + $send(self, 'each', [], (TMP_98 = function($a){var self = TMP_98.$$s || this, $post_args, args, item = nil; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + item = (function() {if (($yield !== nil)) { + return Opal.yieldX($yield, Opal.to_a(args)); + } else { + return $$($nesting, 'Opal').$destructure(args) + }; return nil; })(); + return (result = $rb_plus(result, item));}, TMP_98.$$s = self, TMP_98.$$arity = -1, TMP_98)); + return result; + }, TMP_Enumerable_sum_97.$$arity = -1); + + Opal.def(self, '$take', TMP_Enumerable_take_99 = function $$take(num) { + var self = this; + + return self.$first(num) + }, TMP_Enumerable_take_99.$$arity = 1); + + Opal.def(self, '$take_while', TMP_Enumerable_take_while_100 = function $$take_while() {try { + + var $iter = TMP_Enumerable_take_while_100.$$p, block = $iter || nil, TMP_101, self = this, result = nil; + + if ($iter) TMP_Enumerable_take_while_100.$$p = null; + + + if ($iter) TMP_Enumerable_take_while_100.$$p = null;; + if ($truthy(block)) { + } else { + return self.$enum_for("take_while") + }; + result = []; + return $send(self, 'each', [], (TMP_101 = function($a){var self = TMP_101.$$s || this, $post_args, args, value = nil; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + value = $$($nesting, 'Opal').$destructure(args); + if ($truthy(Opal.yield1(block, value))) { + } else { + Opal.ret(result) + }; + return result.push(value);;}, TMP_101.$$s = self, TMP_101.$$arity = -1, TMP_101)); + } catch ($returner) { if ($returner === Opal.returner) { return $returner.$v } throw $returner; } + }, TMP_Enumerable_take_while_100.$$arity = 0); + + Opal.def(self, '$uniq', TMP_Enumerable_uniq_102 = function $$uniq() { + var $iter = TMP_Enumerable_uniq_102.$$p, block = $iter || nil, TMP_103, self = this, hash = nil; + + if ($iter) TMP_Enumerable_uniq_102.$$p = null; + + + if ($iter) TMP_Enumerable_uniq_102.$$p = null;; + hash = $hash2([], {}); + $send(self, 'each', [], (TMP_103 = function($a){var self = TMP_103.$$s || this, $post_args, args, value = nil, produced = nil, $writer = nil; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + value = $$($nesting, 'Opal').$destructure(args); + produced = (function() {if ((block !== nil)) { + return Opal.yield1(block, value); + } else { + return value + }; return nil; })(); + if ($truthy(hash['$key?'](produced))) { + return nil + } else { + + $writer = [produced, value]; + $send(hash, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + };}, TMP_103.$$s = self, TMP_103.$$arity = -1, TMP_103)); + return hash.$values(); + }, TMP_Enumerable_uniq_102.$$arity = 0); + Opal.alias(self, "to_a", "entries"); + + Opal.def(self, '$zip', TMP_Enumerable_zip_104 = function $$zip($a) { + var $iter = TMP_Enumerable_zip_104.$$p, block = $iter || nil, $post_args, others, self = this; + + if ($iter) TMP_Enumerable_zip_104.$$p = null; + + + if ($iter) TMP_Enumerable_zip_104.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + others = $post_args;; + return $send(self.$to_a(), 'zip', Opal.to_a(others)); + }, TMP_Enumerable_zip_104.$$arity = -1); + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/enumerator"] = function(Opal) { + function $rb_plus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); + } + function $rb_lt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $truthy = Opal.truthy, $send = Opal.send, $falsy = Opal.falsy; + + Opal.add_stubs(['$require', '$include', '$allocate', '$new', '$to_proc', '$coerce_to', '$nil?', '$empty?', '$+', '$class', '$__send__', '$===', '$call', '$enum_for', '$size', '$destructure', '$inspect', '$any?', '$[]', '$raise', '$yield', '$each', '$enumerator_size', '$respond_to?', '$try_convert', '$<', '$for']); + + self.$require("corelib/enumerable"); + return (function($base, $super, $parent_nesting) { + function $Enumerator(){}; + var self = $Enumerator = $klass($base, $super, 'Enumerator', $Enumerator); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Enumerator_for_1, TMP_Enumerator_initialize_2, TMP_Enumerator_each_3, TMP_Enumerator_size_4, TMP_Enumerator_with_index_5, TMP_Enumerator_inspect_7; + + def.size = def.args = def.object = def.method = nil; + + self.$include($$($nesting, 'Enumerable')); + def.$$is_enumerator = true; + Opal.defs(self, '$for', TMP_Enumerator_for_1 = function(object, $a, $b) { + var $iter = TMP_Enumerator_for_1.$$p, block = $iter || nil, $post_args, method, args, self = this; + + if ($iter) TMP_Enumerator_for_1.$$p = null; + + + if ($iter) TMP_Enumerator_for_1.$$p = null;; + + $post_args = Opal.slice.call(arguments, 1, arguments.length); + + if ($post_args.length > 0) { + method = $post_args[0]; + $post_args.splice(0, 1); + } + if (method == null) { + method = "each"; + }; + + args = $post_args;; + + var obj = self.$allocate(); + + obj.object = object; + obj.size = block; + obj.method = method; + obj.args = args; + + return obj; + ; + }, TMP_Enumerator_for_1.$$arity = -2); + + Opal.def(self, '$initialize', TMP_Enumerator_initialize_2 = function $$initialize($a) { + var $iter = TMP_Enumerator_initialize_2.$$p, block = $iter || nil, $post_args, self = this; + + if ($iter) TMP_Enumerator_initialize_2.$$p = null; + + + if ($iter) TMP_Enumerator_initialize_2.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + if ($truthy(block)) { + + self.object = $send($$($nesting, 'Generator'), 'new', [], block.$to_proc()); + self.method = "each"; + self.args = []; + self.size = arguments[0] || nil; + if ($truthy(self.size)) { + return (self.size = $$($nesting, 'Opal').$coerce_to(self.size, $$($nesting, 'Integer'), "to_int")) + } else { + return nil + }; + } else { + + self.object = arguments[0]; + self.method = arguments[1] || "each"; + self.args = $slice.call(arguments, 2); + return (self.size = nil); + }; + }, TMP_Enumerator_initialize_2.$$arity = -1); + + Opal.def(self, '$each', TMP_Enumerator_each_3 = function $$each($a) { + var $iter = TMP_Enumerator_each_3.$$p, block = $iter || nil, $post_args, args, $b, self = this; + + if ($iter) TMP_Enumerator_each_3.$$p = null; + + + if ($iter) TMP_Enumerator_each_3.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + if ($truthy(($truthy($b = block['$nil?']()) ? args['$empty?']() : $b))) { + return self}; + args = $rb_plus(self.args, args); + if ($truthy(block['$nil?']())) { + return $send(self.$class(), 'new', [self.object, self.method].concat(Opal.to_a(args)))}; + return $send(self.object, '__send__', [self.method].concat(Opal.to_a(args)), block.$to_proc()); + }, TMP_Enumerator_each_3.$$arity = -1); + + Opal.def(self, '$size', TMP_Enumerator_size_4 = function $$size() { + var self = this; + + if ($truthy($$($nesting, 'Proc')['$==='](self.size))) { + return $send(self.size, 'call', Opal.to_a(self.args)) + } else { + return self.size + } + }, TMP_Enumerator_size_4.$$arity = 0); + + Opal.def(self, '$with_index', TMP_Enumerator_with_index_5 = function $$with_index(offset) { + var $iter = TMP_Enumerator_with_index_5.$$p, block = $iter || nil, TMP_6, self = this; + + if ($iter) TMP_Enumerator_with_index_5.$$p = null; + + + if ($iter) TMP_Enumerator_with_index_5.$$p = null;; + + if (offset == null) { + offset = 0; + }; + offset = (function() {if ($truthy(offset)) { + return $$($nesting, 'Opal').$coerce_to(offset, $$($nesting, 'Integer'), "to_int") + } else { + return 0 + }; return nil; })(); + if ($truthy(block)) { + } else { + return $send(self, 'enum_for', ["with_index", offset], (TMP_6 = function(){var self = TMP_6.$$s || this; + + return self.$size()}, TMP_6.$$s = self, TMP_6.$$arity = 0, TMP_6)) + }; + + var result, index = offset; + + self.$each.$$p = function() { + var param = $$($nesting, 'Opal').$destructure(arguments), + value = block(param, index); + + index++; + + return value; + } + + return self.$each(); + ; + }, TMP_Enumerator_with_index_5.$$arity = -1); + Opal.alias(self, "with_object", "each_with_object"); + + Opal.def(self, '$inspect', TMP_Enumerator_inspect_7 = function $$inspect() { + var self = this, result = nil; + + + result = "" + "#<" + (self.$class()) + ": " + (self.object.$inspect()) + ":" + (self.method); + if ($truthy(self.args['$any?']())) { + result = $rb_plus(result, "" + "(" + (self.args.$inspect()['$[]']($$($nesting, 'Range').$new(1, -2))) + ")")}; + return $rb_plus(result, ">"); + }, TMP_Enumerator_inspect_7.$$arity = 0); + (function($base, $super, $parent_nesting) { + function $Generator(){}; + var self = $Generator = $klass($base, $super, 'Generator', $Generator); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Generator_initialize_8, TMP_Generator_each_9; + + def.block = nil; + + self.$include($$($nesting, 'Enumerable')); + + Opal.def(self, '$initialize', TMP_Generator_initialize_8 = function $$initialize() { + var $iter = TMP_Generator_initialize_8.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Generator_initialize_8.$$p = null; + + + if ($iter) TMP_Generator_initialize_8.$$p = null;; + if ($truthy(block)) { + } else { + self.$raise($$($nesting, 'LocalJumpError'), "no block given") + }; + return (self.block = block); + }, TMP_Generator_initialize_8.$$arity = 0); + return (Opal.def(self, '$each', TMP_Generator_each_9 = function $$each($a) { + var $iter = TMP_Generator_each_9.$$p, block = $iter || nil, $post_args, args, self = this, yielder = nil; + + if ($iter) TMP_Generator_each_9.$$p = null; + + + if ($iter) TMP_Generator_each_9.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + yielder = $send($$($nesting, 'Yielder'), 'new', [], block.$to_proc()); + + try { + args.unshift(yielder); + + Opal.yieldX(self.block, args); + } + catch (e) { + if (e === $breaker) { + return $breaker.$v; + } + else { + throw e; + } + } + ; + return self; + }, TMP_Generator_each_9.$$arity = -1), nil) && 'each'; + })($nesting[0], null, $nesting); + (function($base, $super, $parent_nesting) { + function $Yielder(){}; + var self = $Yielder = $klass($base, $super, 'Yielder', $Yielder); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Yielder_initialize_10, TMP_Yielder_yield_11, TMP_Yielder_$lt$lt_12; + + def.block = nil; + + + Opal.def(self, '$initialize', TMP_Yielder_initialize_10 = function $$initialize() { + var $iter = TMP_Yielder_initialize_10.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Yielder_initialize_10.$$p = null; + + + if ($iter) TMP_Yielder_initialize_10.$$p = null;; + return (self.block = block); + }, TMP_Yielder_initialize_10.$$arity = 0); + + Opal.def(self, '$yield', TMP_Yielder_yield_11 = function($a) { + var $post_args, values, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + values = $post_args;; + + var value = Opal.yieldX(self.block, values); + + if (value === $breaker) { + throw $breaker; + } + + return value; + ; + }, TMP_Yielder_yield_11.$$arity = -1); + return (Opal.def(self, '$<<', TMP_Yielder_$lt$lt_12 = function($a) { + var $post_args, values, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + values = $post_args;; + $send(self, 'yield', Opal.to_a(values)); + return self; + }, TMP_Yielder_$lt$lt_12.$$arity = -1), nil) && '<<'; + })($nesting[0], null, $nesting); + return (function($base, $super, $parent_nesting) { + function $Lazy(){}; + var self = $Lazy = $klass($base, $super, 'Lazy', $Lazy); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Lazy_initialize_13, TMP_Lazy_lazy_16, TMP_Lazy_collect_17, TMP_Lazy_collect_concat_19, TMP_Lazy_drop_23, TMP_Lazy_drop_while_25, TMP_Lazy_enum_for_27, TMP_Lazy_find_all_28, TMP_Lazy_grep_30, TMP_Lazy_reject_33, TMP_Lazy_take_35, TMP_Lazy_take_while_37, TMP_Lazy_inspect_39; + + def.enumerator = nil; + + (function($base, $super, $parent_nesting) { + function $StopLazyError(){}; + var self = $StopLazyError = $klass($base, $super, 'StopLazyError', $StopLazyError); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return nil + })($nesting[0], $$($nesting, 'Exception'), $nesting); + + Opal.def(self, '$initialize', TMP_Lazy_initialize_13 = function $$initialize(object, size) { + var $iter = TMP_Lazy_initialize_13.$$p, block = $iter || nil, TMP_14, self = this; + + if ($iter) TMP_Lazy_initialize_13.$$p = null; + + + if ($iter) TMP_Lazy_initialize_13.$$p = null;; + + if (size == null) { + size = nil; + }; + if ((block !== nil)) { + } else { + self.$raise($$($nesting, 'ArgumentError'), "tried to call lazy new without a block") + }; + self.enumerator = object; + return $send(self, Opal.find_super_dispatcher(self, 'initialize', TMP_Lazy_initialize_13, false), [size], (TMP_14 = function(yielder, $a){var self = TMP_14.$$s || this, $post_args, each_args, TMP_15; + + + + if (yielder == null) { + yielder = nil; + }; + + $post_args = Opal.slice.call(arguments, 1, arguments.length); + + each_args = $post_args;; + try { + return $send(object, 'each', Opal.to_a(each_args), (TMP_15 = function($b){var self = TMP_15.$$s || this, $post_args, args; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + + args.unshift(yielder); + + Opal.yieldX(block, args); + ;}, TMP_15.$$s = self, TMP_15.$$arity = -1, TMP_15)) + } catch ($err) { + if (Opal.rescue($err, [$$($nesting, 'Exception')])) { + try { + return nil + } finally { Opal.pop_exception() } + } else { throw $err; } + };}, TMP_14.$$s = self, TMP_14.$$arity = -2, TMP_14)); + }, TMP_Lazy_initialize_13.$$arity = -2); + Opal.alias(self, "force", "to_a"); + + Opal.def(self, '$lazy', TMP_Lazy_lazy_16 = function $$lazy() { + var self = this; + + return self + }, TMP_Lazy_lazy_16.$$arity = 0); + + Opal.def(self, '$collect', TMP_Lazy_collect_17 = function $$collect() { + var $iter = TMP_Lazy_collect_17.$$p, block = $iter || nil, TMP_18, self = this; + + if ($iter) TMP_Lazy_collect_17.$$p = null; + + + if ($iter) TMP_Lazy_collect_17.$$p = null;; + if ($truthy(block)) { + } else { + self.$raise($$($nesting, 'ArgumentError'), "tried to call lazy map without a block") + }; + return $send($$($nesting, 'Lazy'), 'new', [self, self.$enumerator_size()], (TMP_18 = function(enum$, $a){var self = TMP_18.$$s || this, $post_args, args; + + + + if (enum$ == null) { + enum$ = nil; + }; + + $post_args = Opal.slice.call(arguments, 1, arguments.length); + + args = $post_args;; + + var value = Opal.yieldX(block, args); + + enum$.$yield(value); + ;}, TMP_18.$$s = self, TMP_18.$$arity = -2, TMP_18)); + }, TMP_Lazy_collect_17.$$arity = 0); + + Opal.def(self, '$collect_concat', TMP_Lazy_collect_concat_19 = function $$collect_concat() { + var $iter = TMP_Lazy_collect_concat_19.$$p, block = $iter || nil, TMP_20, self = this; + + if ($iter) TMP_Lazy_collect_concat_19.$$p = null; + + + if ($iter) TMP_Lazy_collect_concat_19.$$p = null;; + if ($truthy(block)) { + } else { + self.$raise($$($nesting, 'ArgumentError'), "tried to call lazy map without a block") + }; + return $send($$($nesting, 'Lazy'), 'new', [self, nil], (TMP_20 = function(enum$, $a){var self = TMP_20.$$s || this, $post_args, args, TMP_21, TMP_22; + + + + if (enum$ == null) { + enum$ = nil; + }; + + $post_args = Opal.slice.call(arguments, 1, arguments.length); + + args = $post_args;; + + var value = Opal.yieldX(block, args); + + if ((value)['$respond_to?']("force") && (value)['$respond_to?']("each")) { + $send((value), 'each', [], (TMP_21 = function(v){var self = TMP_21.$$s || this; + + + + if (v == null) { + v = nil; + }; + return enum$.$yield(v);}, TMP_21.$$s = self, TMP_21.$$arity = 1, TMP_21)) + } + else { + var array = $$($nesting, 'Opal').$try_convert(value, $$($nesting, 'Array'), "to_ary"); + + if (array === nil) { + enum$.$yield(value); + } + else { + $send((value), 'each', [], (TMP_22 = function(v){var self = TMP_22.$$s || this; + + + + if (v == null) { + v = nil; + }; + return enum$.$yield(v);}, TMP_22.$$s = self, TMP_22.$$arity = 1, TMP_22)); + } + } + ;}, TMP_20.$$s = self, TMP_20.$$arity = -2, TMP_20)); + }, TMP_Lazy_collect_concat_19.$$arity = 0); + + Opal.def(self, '$drop', TMP_Lazy_drop_23 = function $$drop(n) { + var TMP_24, self = this, current_size = nil, set_size = nil, dropped = nil; + + + n = $$($nesting, 'Opal').$coerce_to(n, $$($nesting, 'Integer'), "to_int"); + if ($truthy($rb_lt(n, 0))) { + self.$raise($$($nesting, 'ArgumentError'), "attempt to drop negative size")}; + current_size = self.$enumerator_size(); + set_size = (function() {if ($truthy($$($nesting, 'Integer')['$==='](current_size))) { + if ($truthy($rb_lt(n, current_size))) { + return n + } else { + return current_size + } + } else { + return current_size + }; return nil; })(); + dropped = 0; + return $send($$($nesting, 'Lazy'), 'new', [self, set_size], (TMP_24 = function(enum$, $a){var self = TMP_24.$$s || this, $post_args, args; + + + + if (enum$ == null) { + enum$ = nil; + }; + + $post_args = Opal.slice.call(arguments, 1, arguments.length); + + args = $post_args;; + if ($truthy($rb_lt(dropped, n))) { + return (dropped = $rb_plus(dropped, 1)) + } else { + return $send(enum$, 'yield', Opal.to_a(args)) + };}, TMP_24.$$s = self, TMP_24.$$arity = -2, TMP_24)); + }, TMP_Lazy_drop_23.$$arity = 1); + + Opal.def(self, '$drop_while', TMP_Lazy_drop_while_25 = function $$drop_while() { + var $iter = TMP_Lazy_drop_while_25.$$p, block = $iter || nil, TMP_26, self = this, succeeding = nil; + + if ($iter) TMP_Lazy_drop_while_25.$$p = null; + + + if ($iter) TMP_Lazy_drop_while_25.$$p = null;; + if ($truthy(block)) { + } else { + self.$raise($$($nesting, 'ArgumentError'), "tried to call lazy drop_while without a block") + }; + succeeding = true; + return $send($$($nesting, 'Lazy'), 'new', [self, nil], (TMP_26 = function(enum$, $a){var self = TMP_26.$$s || this, $post_args, args; + + + + if (enum$ == null) { + enum$ = nil; + }; + + $post_args = Opal.slice.call(arguments, 1, arguments.length); + + args = $post_args;; + if ($truthy(succeeding)) { + + var value = Opal.yieldX(block, args); + + if ($falsy(value)) { + succeeding = false; + + $send(enum$, 'yield', Opal.to_a(args)); + } + + } else { + return $send(enum$, 'yield', Opal.to_a(args)) + };}, TMP_26.$$s = self, TMP_26.$$arity = -2, TMP_26)); + }, TMP_Lazy_drop_while_25.$$arity = 0); + + Opal.def(self, '$enum_for', TMP_Lazy_enum_for_27 = function $$enum_for($a, $b) { + var $iter = TMP_Lazy_enum_for_27.$$p, block = $iter || nil, $post_args, method, args, self = this; + + if ($iter) TMP_Lazy_enum_for_27.$$p = null; + + + if ($iter) TMP_Lazy_enum_for_27.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + if ($post_args.length > 0) { + method = $post_args[0]; + $post_args.splice(0, 1); + } + if (method == null) { + method = "each"; + }; + + args = $post_args;; + return $send(self.$class(), 'for', [self, method].concat(Opal.to_a(args)), block.$to_proc()); + }, TMP_Lazy_enum_for_27.$$arity = -1); + + Opal.def(self, '$find_all', TMP_Lazy_find_all_28 = function $$find_all() { + var $iter = TMP_Lazy_find_all_28.$$p, block = $iter || nil, TMP_29, self = this; + + if ($iter) TMP_Lazy_find_all_28.$$p = null; + + + if ($iter) TMP_Lazy_find_all_28.$$p = null;; + if ($truthy(block)) { + } else { + self.$raise($$($nesting, 'ArgumentError'), "tried to call lazy select without a block") + }; + return $send($$($nesting, 'Lazy'), 'new', [self, nil], (TMP_29 = function(enum$, $a){var self = TMP_29.$$s || this, $post_args, args; + + + + if (enum$ == null) { + enum$ = nil; + }; + + $post_args = Opal.slice.call(arguments, 1, arguments.length); + + args = $post_args;; + + var value = Opal.yieldX(block, args); + + if ($truthy(value)) { + $send(enum$, 'yield', Opal.to_a(args)); + } + ;}, TMP_29.$$s = self, TMP_29.$$arity = -2, TMP_29)); + }, TMP_Lazy_find_all_28.$$arity = 0); + Opal.alias(self, "flat_map", "collect_concat"); + + Opal.def(self, '$grep', TMP_Lazy_grep_30 = function $$grep(pattern) { + var $iter = TMP_Lazy_grep_30.$$p, block = $iter || nil, TMP_31, TMP_32, self = this; + + if ($iter) TMP_Lazy_grep_30.$$p = null; + + + if ($iter) TMP_Lazy_grep_30.$$p = null;; + if ($truthy(block)) { + return $send($$($nesting, 'Lazy'), 'new', [self, nil], (TMP_31 = function(enum$, $a){var self = TMP_31.$$s || this, $post_args, args; + + + + if (enum$ == null) { + enum$ = nil; + }; + + $post_args = Opal.slice.call(arguments, 1, arguments.length); + + args = $post_args;; + + var param = $$($nesting, 'Opal').$destructure(args), + value = pattern['$==='](param); + + if ($truthy(value)) { + value = Opal.yield1(block, param); + + enum$.$yield(Opal.yield1(block, param)); + } + ;}, TMP_31.$$s = self, TMP_31.$$arity = -2, TMP_31)) + } else { + return $send($$($nesting, 'Lazy'), 'new', [self, nil], (TMP_32 = function(enum$, $a){var self = TMP_32.$$s || this, $post_args, args; + + + + if (enum$ == null) { + enum$ = nil; + }; + + $post_args = Opal.slice.call(arguments, 1, arguments.length); + + args = $post_args;; + + var param = $$($nesting, 'Opal').$destructure(args), + value = pattern['$==='](param); + + if ($truthy(value)) { + enum$.$yield(param); + } + ;}, TMP_32.$$s = self, TMP_32.$$arity = -2, TMP_32)) + }; + }, TMP_Lazy_grep_30.$$arity = 1); + Opal.alias(self, "map", "collect"); + Opal.alias(self, "select", "find_all"); + + Opal.def(self, '$reject', TMP_Lazy_reject_33 = function $$reject() { + var $iter = TMP_Lazy_reject_33.$$p, block = $iter || nil, TMP_34, self = this; + + if ($iter) TMP_Lazy_reject_33.$$p = null; + + + if ($iter) TMP_Lazy_reject_33.$$p = null;; + if ($truthy(block)) { + } else { + self.$raise($$($nesting, 'ArgumentError'), "tried to call lazy reject without a block") + }; + return $send($$($nesting, 'Lazy'), 'new', [self, nil], (TMP_34 = function(enum$, $a){var self = TMP_34.$$s || this, $post_args, args; + + + + if (enum$ == null) { + enum$ = nil; + }; + + $post_args = Opal.slice.call(arguments, 1, arguments.length); + + args = $post_args;; + + var value = Opal.yieldX(block, args); + + if ($falsy(value)) { + $send(enum$, 'yield', Opal.to_a(args)); + } + ;}, TMP_34.$$s = self, TMP_34.$$arity = -2, TMP_34)); + }, TMP_Lazy_reject_33.$$arity = 0); + + Opal.def(self, '$take', TMP_Lazy_take_35 = function $$take(n) { + var TMP_36, self = this, current_size = nil, set_size = nil, taken = nil; + + + n = $$($nesting, 'Opal').$coerce_to(n, $$($nesting, 'Integer'), "to_int"); + if ($truthy($rb_lt(n, 0))) { + self.$raise($$($nesting, 'ArgumentError'), "attempt to take negative size")}; + current_size = self.$enumerator_size(); + set_size = (function() {if ($truthy($$($nesting, 'Integer')['$==='](current_size))) { + if ($truthy($rb_lt(n, current_size))) { + return n + } else { + return current_size + } + } else { + return current_size + }; return nil; })(); + taken = 0; + return $send($$($nesting, 'Lazy'), 'new', [self, set_size], (TMP_36 = function(enum$, $a){var self = TMP_36.$$s || this, $post_args, args; + + + + if (enum$ == null) { + enum$ = nil; + }; + + $post_args = Opal.slice.call(arguments, 1, arguments.length); + + args = $post_args;; + if ($truthy($rb_lt(taken, n))) { + + $send(enum$, 'yield', Opal.to_a(args)); + return (taken = $rb_plus(taken, 1)); + } else { + return self.$raise($$($nesting, 'StopLazyError')) + };}, TMP_36.$$s = self, TMP_36.$$arity = -2, TMP_36)); + }, TMP_Lazy_take_35.$$arity = 1); + + Opal.def(self, '$take_while', TMP_Lazy_take_while_37 = function $$take_while() { + var $iter = TMP_Lazy_take_while_37.$$p, block = $iter || nil, TMP_38, self = this; + + if ($iter) TMP_Lazy_take_while_37.$$p = null; + + + if ($iter) TMP_Lazy_take_while_37.$$p = null;; + if ($truthy(block)) { + } else { + self.$raise($$($nesting, 'ArgumentError'), "tried to call lazy take_while without a block") + }; + return $send($$($nesting, 'Lazy'), 'new', [self, nil], (TMP_38 = function(enum$, $a){var self = TMP_38.$$s || this, $post_args, args; + + + + if (enum$ == null) { + enum$ = nil; + }; + + $post_args = Opal.slice.call(arguments, 1, arguments.length); + + args = $post_args;; + + var value = Opal.yieldX(block, args); + + if ($truthy(value)) { + $send(enum$, 'yield', Opal.to_a(args)); + } + else { + self.$raise($$($nesting, 'StopLazyError')); + } + ;}, TMP_38.$$s = self, TMP_38.$$arity = -2, TMP_38)); + }, TMP_Lazy_take_while_37.$$arity = 0); + Opal.alias(self, "to_enum", "enum_for"); + return (Opal.def(self, '$inspect', TMP_Lazy_inspect_39 = function $$inspect() { + var self = this; + + return "" + "#<" + (self.$class()) + ": " + (self.enumerator.$inspect()) + ">" + }, TMP_Lazy_inspect_39.$$arity = 0), nil) && 'inspect'; + })($nesting[0], self, $nesting); + })($nesting[0], null, $nesting); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/numeric"] = function(Opal) { + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + function $rb_times(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs * rhs : lhs['$*'](rhs); + } + function $rb_lt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); + } + function $rb_divide(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs / rhs : lhs['$/'](rhs); + } + function $rb_gt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $truthy = Opal.truthy, $hash2 = Opal.hash2; + + Opal.add_stubs(['$require', '$include', '$instance_of?', '$class', '$Float', '$respond_to?', '$coerce', '$__send__', '$===', '$raise', '$equal?', '$-', '$*', '$div', '$<', '$-@', '$ceil', '$to_f', '$denominator', '$to_r', '$==', '$floor', '$/', '$%', '$Complex', '$zero?', '$numerator', '$abs', '$arg', '$coerce_to!', '$round', '$to_i', '$truncate', '$>']); + + self.$require("corelib/comparable"); + return (function($base, $super, $parent_nesting) { + function $Numeric(){}; + var self = $Numeric = $klass($base, $super, 'Numeric', $Numeric); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Numeric_coerce_1, TMP_Numeric___coerced___2, TMP_Numeric_$lt$eq$gt_3, TMP_Numeric_$$_4, TMP_Numeric_$$_5, TMP_Numeric_$_6, TMP_Numeric_abs_7, TMP_Numeric_abs2_8, TMP_Numeric_angle_9, TMP_Numeric_ceil_10, TMP_Numeric_conj_11, TMP_Numeric_denominator_12, TMP_Numeric_div_13, TMP_Numeric_divmod_14, TMP_Numeric_fdiv_15, TMP_Numeric_floor_16, TMP_Numeric_i_17, TMP_Numeric_imag_18, TMP_Numeric_integer$q_19, TMP_Numeric_nonzero$q_20, TMP_Numeric_numerator_21, TMP_Numeric_polar_22, TMP_Numeric_quo_23, TMP_Numeric_real_24, TMP_Numeric_real$q_25, TMP_Numeric_rect_26, TMP_Numeric_round_27, TMP_Numeric_to_c_28, TMP_Numeric_to_int_29, TMP_Numeric_truncate_30, TMP_Numeric_zero$q_31, TMP_Numeric_positive$q_32, TMP_Numeric_negative$q_33, TMP_Numeric_dup_34, TMP_Numeric_clone_35, TMP_Numeric_finite$q_36, TMP_Numeric_infinite$q_37; + + + self.$include($$($nesting, 'Comparable')); + + Opal.def(self, '$coerce', TMP_Numeric_coerce_1 = function $$coerce(other) { + var self = this; + + + if ($truthy(other['$instance_of?'](self.$class()))) { + return [other, self]}; + return [self.$Float(other), self.$Float(self)]; + }, TMP_Numeric_coerce_1.$$arity = 1); + + Opal.def(self, '$__coerced__', TMP_Numeric___coerced___2 = function $$__coerced__(method, other) { + var $a, $b, self = this, a = nil, b = nil, $case = nil; + + if ($truthy(other['$respond_to?']("coerce"))) { + + $b = other.$coerce(self), $a = Opal.to_ary($b), (a = ($a[0] == null ? nil : $a[0])), (b = ($a[1] == null ? nil : $a[1])), $b; + return a.$__send__(method, b); + } else { + return (function() {$case = method; + if ("+"['$===']($case) || "-"['$===']($case) || "*"['$===']($case) || "/"['$===']($case) || "%"['$===']($case) || "&"['$===']($case) || "|"['$===']($case) || "^"['$===']($case) || "**"['$===']($case)) {return self.$raise($$($nesting, 'TypeError'), "" + (other.$class()) + " can't be coerced into Numeric")} + else if (">"['$===']($case) || ">="['$===']($case) || "<"['$===']($case) || "<="['$===']($case) || "<=>"['$===']($case)) {return self.$raise($$($nesting, 'ArgumentError'), "" + "comparison of " + (self.$class()) + " with " + (other.$class()) + " failed")} + else { return nil }})() + } + }, TMP_Numeric___coerced___2.$$arity = 2); + + Opal.def(self, '$<=>', TMP_Numeric_$lt$eq$gt_3 = function(other) { + var self = this; + + + if ($truthy(self['$equal?'](other))) { + return 0}; + return nil; + }, TMP_Numeric_$lt$eq$gt_3.$$arity = 1); + + Opal.def(self, '$+@', TMP_Numeric_$$_4 = function() { + var self = this; + + return self + }, TMP_Numeric_$$_4.$$arity = 0); + + Opal.def(self, '$-@', TMP_Numeric_$$_5 = function() { + var self = this; + + return $rb_minus(0, self) + }, TMP_Numeric_$$_5.$$arity = 0); + + Opal.def(self, '$%', TMP_Numeric_$_6 = function(other) { + var self = this; + + return $rb_minus(self, $rb_times(other, self.$div(other))) + }, TMP_Numeric_$_6.$$arity = 1); + + Opal.def(self, '$abs', TMP_Numeric_abs_7 = function $$abs() { + var self = this; + + if ($rb_lt(self, 0)) { + return self['$-@']() + } else { + return self + } + }, TMP_Numeric_abs_7.$$arity = 0); + + Opal.def(self, '$abs2', TMP_Numeric_abs2_8 = function $$abs2() { + var self = this; + + return $rb_times(self, self) + }, TMP_Numeric_abs2_8.$$arity = 0); + + Opal.def(self, '$angle', TMP_Numeric_angle_9 = function $$angle() { + var self = this; + + if ($rb_lt(self, 0)) { + return $$$($$($nesting, 'Math'), 'PI') + } else { + return 0 + } + }, TMP_Numeric_angle_9.$$arity = 0); + Opal.alias(self, "arg", "angle"); + + Opal.def(self, '$ceil', TMP_Numeric_ceil_10 = function $$ceil(ndigits) { + var self = this; + + + + if (ndigits == null) { + ndigits = 0; + }; + return self.$to_f().$ceil(ndigits); + }, TMP_Numeric_ceil_10.$$arity = -1); + + Opal.def(self, '$conj', TMP_Numeric_conj_11 = function $$conj() { + var self = this; + + return self + }, TMP_Numeric_conj_11.$$arity = 0); + Opal.alias(self, "conjugate", "conj"); + + Opal.def(self, '$denominator', TMP_Numeric_denominator_12 = function $$denominator() { + var self = this; + + return self.$to_r().$denominator() + }, TMP_Numeric_denominator_12.$$arity = 0); + + Opal.def(self, '$div', TMP_Numeric_div_13 = function $$div(other) { + var self = this; + + + if (other['$=='](0)) { + self.$raise($$($nesting, 'ZeroDivisionError'), "divided by o")}; + return $rb_divide(self, other).$floor(); + }, TMP_Numeric_div_13.$$arity = 1); + + Opal.def(self, '$divmod', TMP_Numeric_divmod_14 = function $$divmod(other) { + var self = this; + + return [self.$div(other), self['$%'](other)] + }, TMP_Numeric_divmod_14.$$arity = 1); + + Opal.def(self, '$fdiv', TMP_Numeric_fdiv_15 = function $$fdiv(other) { + var self = this; + + return $rb_divide(self.$to_f(), other) + }, TMP_Numeric_fdiv_15.$$arity = 1); + + Opal.def(self, '$floor', TMP_Numeric_floor_16 = function $$floor(ndigits) { + var self = this; + + + + if (ndigits == null) { + ndigits = 0; + }; + return self.$to_f().$floor(ndigits); + }, TMP_Numeric_floor_16.$$arity = -1); + + Opal.def(self, '$i', TMP_Numeric_i_17 = function $$i() { + var self = this; + + return self.$Complex(0, self) + }, TMP_Numeric_i_17.$$arity = 0); + + Opal.def(self, '$imag', TMP_Numeric_imag_18 = function $$imag() { + var self = this; + + return 0 + }, TMP_Numeric_imag_18.$$arity = 0); + Opal.alias(self, "imaginary", "imag"); + + Opal.def(self, '$integer?', TMP_Numeric_integer$q_19 = function() { + var self = this; + + return false + }, TMP_Numeric_integer$q_19.$$arity = 0); + Opal.alias(self, "magnitude", "abs"); + Opal.alias(self, "modulo", "%"); + + Opal.def(self, '$nonzero?', TMP_Numeric_nonzero$q_20 = function() { + var self = this; + + if ($truthy(self['$zero?']())) { + return nil + } else { + return self + } + }, TMP_Numeric_nonzero$q_20.$$arity = 0); + + Opal.def(self, '$numerator', TMP_Numeric_numerator_21 = function $$numerator() { + var self = this; + + return self.$to_r().$numerator() + }, TMP_Numeric_numerator_21.$$arity = 0); + Opal.alias(self, "phase", "arg"); + + Opal.def(self, '$polar', TMP_Numeric_polar_22 = function $$polar() { + var self = this; + + return [self.$abs(), self.$arg()] + }, TMP_Numeric_polar_22.$$arity = 0); + + Opal.def(self, '$quo', TMP_Numeric_quo_23 = function $$quo(other) { + var self = this; + + return $rb_divide($$($nesting, 'Opal')['$coerce_to!'](self, $$($nesting, 'Rational'), "to_r"), other) + }, TMP_Numeric_quo_23.$$arity = 1); + + Opal.def(self, '$real', TMP_Numeric_real_24 = function $$real() { + var self = this; + + return self + }, TMP_Numeric_real_24.$$arity = 0); + + Opal.def(self, '$real?', TMP_Numeric_real$q_25 = function() { + var self = this; + + return true + }, TMP_Numeric_real$q_25.$$arity = 0); + + Opal.def(self, '$rect', TMP_Numeric_rect_26 = function $$rect() { + var self = this; + + return [self, 0] + }, TMP_Numeric_rect_26.$$arity = 0); + Opal.alias(self, "rectangular", "rect"); + + Opal.def(self, '$round', TMP_Numeric_round_27 = function $$round(digits) { + var self = this; + + + ; + return self.$to_f().$round(digits); + }, TMP_Numeric_round_27.$$arity = -1); + + Opal.def(self, '$to_c', TMP_Numeric_to_c_28 = function $$to_c() { + var self = this; + + return self.$Complex(self, 0) + }, TMP_Numeric_to_c_28.$$arity = 0); + + Opal.def(self, '$to_int', TMP_Numeric_to_int_29 = function $$to_int() { + var self = this; + + return self.$to_i() + }, TMP_Numeric_to_int_29.$$arity = 0); + + Opal.def(self, '$truncate', TMP_Numeric_truncate_30 = function $$truncate(ndigits) { + var self = this; + + + + if (ndigits == null) { + ndigits = 0; + }; + return self.$to_f().$truncate(ndigits); + }, TMP_Numeric_truncate_30.$$arity = -1); + + Opal.def(self, '$zero?', TMP_Numeric_zero$q_31 = function() { + var self = this; + + return self['$=='](0) + }, TMP_Numeric_zero$q_31.$$arity = 0); + + Opal.def(self, '$positive?', TMP_Numeric_positive$q_32 = function() { + var self = this; + + return $rb_gt(self, 0) + }, TMP_Numeric_positive$q_32.$$arity = 0); + + Opal.def(self, '$negative?', TMP_Numeric_negative$q_33 = function() { + var self = this; + + return $rb_lt(self, 0) + }, TMP_Numeric_negative$q_33.$$arity = 0); + + Opal.def(self, '$dup', TMP_Numeric_dup_34 = function $$dup() { + var self = this; + + return self + }, TMP_Numeric_dup_34.$$arity = 0); + + Opal.def(self, '$clone', TMP_Numeric_clone_35 = function $$clone($kwargs) { + var freeze, self = this; + + + + if ($kwargs == null) { + $kwargs = $hash2([], {}); + } else if (!$kwargs.$$is_hash) { + throw Opal.ArgumentError.$new('expected kwargs'); + }; + + freeze = $kwargs.$$smap["freeze"]; + if (freeze == null) { + freeze = true + }; + return self; + }, TMP_Numeric_clone_35.$$arity = -1); + + Opal.def(self, '$finite?', TMP_Numeric_finite$q_36 = function() { + var self = this; + + return true + }, TMP_Numeric_finite$q_36.$$arity = 0); + return (Opal.def(self, '$infinite?', TMP_Numeric_infinite$q_37 = function() { + var self = this; + + return nil + }, TMP_Numeric_infinite$q_37.$$arity = 0), nil) && 'infinite?'; + })($nesting[0], null, $nesting); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/array"] = function(Opal) { + function $rb_gt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); + } + function $rb_times(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs * rhs : lhs['$*'](rhs); + } + function $rb_ge(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs >= rhs : lhs['$>='](rhs); + } + function $rb_lt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); + } + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $truthy = Opal.truthy, $hash2 = Opal.hash2, $send = Opal.send, $gvars = Opal.gvars; + + Opal.add_stubs(['$require', '$include', '$to_a', '$warn', '$raise', '$replace', '$respond_to?', '$to_ary', '$coerce_to', '$coerce_to?', '$===', '$join', '$to_str', '$class', '$hash', '$<=>', '$==', '$object_id', '$inspect', '$enum_for', '$bsearch_index', '$to_proc', '$nil?', '$coerce_to!', '$>', '$*', '$enumerator_size', '$empty?', '$size', '$map', '$equal?', '$dup', '$each', '$[]', '$dig', '$eql?', '$length', '$begin', '$end', '$exclude_end?', '$flatten', '$__id__', '$to_s', '$new', '$max', '$min', '$!', '$>=', '$**', '$delete_if', '$reverse', '$rotate', '$rand', '$at', '$keep_if', '$shuffle!', '$<', '$sort', '$sort_by', '$!=', '$times', '$[]=', '$-', '$<<', '$values', '$is_a?', '$last', '$first', '$upto', '$reject', '$pristine', '$singleton_class']); + + self.$require("corelib/enumerable"); + self.$require("corelib/numeric"); + return (function($base, $super, $parent_nesting) { + function $Array(){}; + var self = $Array = $klass($base, $super, 'Array', $Array); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Array_$$_1, TMP_Array_initialize_2, TMP_Array_try_convert_3, TMP_Array_$_4, TMP_Array_$_5, TMP_Array_$_6, TMP_Array_$_7, TMP_Array_$_8, TMP_Array_$lt$lt_9, TMP_Array_$lt$eq$gt_10, TMP_Array_$eq$eq_11, TMP_Array_$$_12, TMP_Array_$$$eq_13, TMP_Array_any$q_14, TMP_Array_assoc_15, TMP_Array_at_16, TMP_Array_bsearch_index_17, TMP_Array_bsearch_18, TMP_Array_cycle_19, TMP_Array_clear_21, TMP_Array_count_22, TMP_Array_initialize_copy_23, TMP_Array_collect_24, TMP_Array_collect$B_26, TMP_Array_combination_28, TMP_Array_repeated_combination_30, TMP_Array_compact_32, TMP_Array_compact$B_33, TMP_Array_concat_34, TMP_Array_delete_37, TMP_Array_delete_at_38, TMP_Array_delete_if_39, TMP_Array_dig_41, TMP_Array_drop_42, TMP_Array_dup_43, TMP_Array_each_44, TMP_Array_each_index_46, TMP_Array_empty$q_48, TMP_Array_eql$q_49, TMP_Array_fetch_50, TMP_Array_fill_51, TMP_Array_first_52, TMP_Array_flatten_53, TMP_Array_flatten$B_54, TMP_Array_hash_55, TMP_Array_include$q_56, TMP_Array_index_57, TMP_Array_insert_58, TMP_Array_inspect_59, TMP_Array_join_60, TMP_Array_keep_if_61, TMP_Array_last_63, TMP_Array_length_64, TMP_Array_max_65, TMP_Array_min_66, TMP_Array_permutation_67, TMP_Array_repeated_permutation_69, TMP_Array_pop_71, TMP_Array_product_72, TMP_Array_push_73, TMP_Array_rassoc_74, TMP_Array_reject_75, TMP_Array_reject$B_77, TMP_Array_replace_79, TMP_Array_reverse_80, TMP_Array_reverse$B_81, TMP_Array_reverse_each_82, TMP_Array_rindex_84, TMP_Array_rotate_85, TMP_Array_rotate$B_86, TMP_Array_sample_89, TMP_Array_select_90, TMP_Array_select$B_92, TMP_Array_shift_94, TMP_Array_shuffle_95, TMP_Array_shuffle$B_96, TMP_Array_slice$B_97, TMP_Array_sort_98, TMP_Array_sort$B_99, TMP_Array_sort_by$B_100, TMP_Array_take_102, TMP_Array_take_while_103, TMP_Array_to_a_104, TMP_Array_to_h_105, TMP_Array_transpose_106, TMP_Array_uniq_109, TMP_Array_uniq$B_110, TMP_Array_unshift_111, TMP_Array_values_at_112, TMP_Array_zip_115, TMP_Array_inherited_116, TMP_Array_instance_variables_117, TMP_Array_pack_119; + + + self.$include($$($nesting, 'Enumerable')); + Opal.defineProperty(Array.prototype, '$$is_array', true); + + function toArraySubclass(obj, klass) { + if (klass.$$name === Opal.Array) { + return obj; + } else { + return klass.$allocate().$replace((obj).$to_a()); + } + } + ; + Opal.defs(self, '$[]', TMP_Array_$$_1 = function($a) { + var $post_args, objects, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + objects = $post_args;; + return toArraySubclass(objects, self);; + }, TMP_Array_$$_1.$$arity = -1); + + Opal.def(self, '$initialize', TMP_Array_initialize_2 = function $$initialize(size, obj) { + var $iter = TMP_Array_initialize_2.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Array_initialize_2.$$p = null; + + + if ($iter) TMP_Array_initialize_2.$$p = null;; + + if (size == null) { + size = nil; + }; + + if (obj == null) { + obj = nil; + }; + + if (obj !== nil && block !== nil) { + self.$warn("warning: block supersedes default value argument") + } + + if (size > $$$($$($nesting, 'Integer'), 'MAX')) { + self.$raise($$($nesting, 'ArgumentError'), "array size too big") + } + + if (arguments.length > 2) { + self.$raise($$($nesting, 'ArgumentError'), "" + "wrong number of arguments (" + (arguments.length) + " for 0..2)") + } + + if (arguments.length === 0) { + self.splice(0, self.length); + return self; + } + + if (arguments.length === 1) { + if (size.$$is_array) { + self.$replace(size.$to_a()) + return self; + } else if (size['$respond_to?']("to_ary")) { + self.$replace(size.$to_ary()) + return self; + } + } + + size = $$($nesting, 'Opal').$coerce_to(size, $$($nesting, 'Integer'), "to_int") + + if (size < 0) { + self.$raise($$($nesting, 'ArgumentError'), "negative array size") + } + + self.splice(0, self.length); + var i, value; + + if (block === nil) { + for (i = 0; i < size; i++) { + self.push(obj); + } + } + else { + for (i = 0, value; i < size; i++) { + value = block(i); + self[i] = value; + } + } + + return self; + ; + }, TMP_Array_initialize_2.$$arity = -1); + Opal.defs(self, '$try_convert', TMP_Array_try_convert_3 = function $$try_convert(obj) { + var self = this; + + return $$($nesting, 'Opal')['$coerce_to?'](obj, $$($nesting, 'Array'), "to_ary") + }, TMP_Array_try_convert_3.$$arity = 1); + + Opal.def(self, '$&', TMP_Array_$_4 = function(other) { + var self = this; + + + other = (function() {if ($truthy($$($nesting, 'Array')['$==='](other))) { + return other.$to_a() + } else { + return $$($nesting, 'Opal').$coerce_to(other, $$($nesting, 'Array'), "to_ary").$to_a() + }; return nil; })(); + + var result = [], hash = $hash2([], {}), i, length, item; + + for (i = 0, length = other.length; i < length; i++) { + Opal.hash_put(hash, other[i], true); + } + + for (i = 0, length = self.length; i < length; i++) { + item = self[i]; + if (Opal.hash_delete(hash, item) !== undefined) { + result.push(item); + } + } + + return result; + ; + }, TMP_Array_$_4.$$arity = 1); + + Opal.def(self, '$|', TMP_Array_$_5 = function(other) { + var self = this; + + + other = (function() {if ($truthy($$($nesting, 'Array')['$==='](other))) { + return other.$to_a() + } else { + return $$($nesting, 'Opal').$coerce_to(other, $$($nesting, 'Array'), "to_ary").$to_a() + }; return nil; })(); + + var hash = $hash2([], {}), i, length, item; + + for (i = 0, length = self.length; i < length; i++) { + Opal.hash_put(hash, self[i], true); + } + + for (i = 0, length = other.length; i < length; i++) { + Opal.hash_put(hash, other[i], true); + } + + return hash.$keys(); + ; + }, TMP_Array_$_5.$$arity = 1); + + Opal.def(self, '$*', TMP_Array_$_6 = function(other) { + var self = this; + + + if ($truthy(other['$respond_to?']("to_str"))) { + return self.$join(other.$to_str())}; + other = $$($nesting, 'Opal').$coerce_to(other, $$($nesting, 'Integer'), "to_int"); + if ($truthy(other < 0)) { + self.$raise($$($nesting, 'ArgumentError'), "negative argument")}; + + var result = [], + converted = self.$to_a(); + + for (var i = 0; i < other; i++) { + result = result.concat(converted); + } + + return toArraySubclass(result, self.$class()); + ; + }, TMP_Array_$_6.$$arity = 1); + + Opal.def(self, '$+', TMP_Array_$_7 = function(other) { + var self = this; + + + other = (function() {if ($truthy($$($nesting, 'Array')['$==='](other))) { + return other.$to_a() + } else { + return $$($nesting, 'Opal').$coerce_to(other, $$($nesting, 'Array'), "to_ary").$to_a() + }; return nil; })(); + return self.concat(other);; + }, TMP_Array_$_7.$$arity = 1); + + Opal.def(self, '$-', TMP_Array_$_8 = function(other) { + var self = this; + + + other = (function() {if ($truthy($$($nesting, 'Array')['$==='](other))) { + return other.$to_a() + } else { + return $$($nesting, 'Opal').$coerce_to(other, $$($nesting, 'Array'), "to_ary").$to_a() + }; return nil; })(); + if ($truthy(self.length === 0)) { + return []}; + if ($truthy(other.length === 0)) { + return self.slice()}; + + var result = [], hash = $hash2([], {}), i, length, item; + + for (i = 0, length = other.length; i < length; i++) { + Opal.hash_put(hash, other[i], true); + } + + for (i = 0, length = self.length; i < length; i++) { + item = self[i]; + if (Opal.hash_get(hash, item) === undefined) { + result.push(item); + } + } + + return result; + ; + }, TMP_Array_$_8.$$arity = 1); + + Opal.def(self, '$<<', TMP_Array_$lt$lt_9 = function(object) { + var self = this; + + + self.push(object); + return self; + }, TMP_Array_$lt$lt_9.$$arity = 1); + + Opal.def(self, '$<=>', TMP_Array_$lt$eq$gt_10 = function(other) { + var self = this; + + + if ($truthy($$($nesting, 'Array')['$==='](other))) { + other = other.$to_a() + } else if ($truthy(other['$respond_to?']("to_ary"))) { + other = other.$to_ary().$to_a() + } else { + return nil + }; + + if (self.$hash() === other.$hash()) { + return 0; + } + + var count = Math.min(self.length, other.length); + + for (var i = 0; i < count; i++) { + var tmp = (self[i])['$<=>'](other[i]); + + if (tmp !== 0) { + return tmp; + } + } + + return (self.length)['$<=>'](other.length); + ; + }, TMP_Array_$lt$eq$gt_10.$$arity = 1); + + Opal.def(self, '$==', TMP_Array_$eq$eq_11 = function(other) { + var self = this; + + + var recursed = {}; + + function _eqeq(array, other) { + var i, length, a, b; + + if (array === other) + return true; + + if (!other.$$is_array) { + if ($$($nesting, 'Opal')['$respond_to?'](other, "to_ary")) { + return (other)['$=='](array); + } else { + return false; + } + } + + if (array.constructor !== Array) + array = (array).$to_a(); + if (other.constructor !== Array) + other = (other).$to_a(); + + if (array.length !== other.length) { + return false; + } + + recursed[(array).$object_id()] = true; + + for (i = 0, length = array.length; i < length; i++) { + a = array[i]; + b = other[i]; + if (a.$$is_array) { + if (b.$$is_array && b.length !== a.length) { + return false; + } + if (!recursed.hasOwnProperty((a).$object_id())) { + if (!_eqeq(a, b)) { + return false; + } + } + } else { + if (!(a)['$=='](b)) { + return false; + } + } + } + + return true; + } + + return _eqeq(self, other); + + }, TMP_Array_$eq$eq_11.$$arity = 1); + + function $array_slice_range(self, index) { + var size = self.length, + exclude, from, to, result; + + exclude = index.excl; + from = Opal.Opal.$coerce_to(index.begin, Opal.Integer, 'to_int'); + to = Opal.Opal.$coerce_to(index.end, Opal.Integer, 'to_int'); + + if (from < 0) { + from += size; + + if (from < 0) { + return nil; + } + } + + if (from > size) { + return nil; + } + + if (to < 0) { + to += size; + + if (to < 0) { + return []; + } + } + + if (!exclude) { + to += 1; + } + + result = self.slice(from, to); + return toArraySubclass(result, self.$class()); + } + + function $array_slice_index_length(self, index, length) { + var size = self.length, + exclude, from, to, result; + + index = Opal.Opal.$coerce_to(index, Opal.Integer, 'to_int'); + + if (index < 0) { + index += size; + + if (index < 0) { + return nil; + } + } + + if (length === undefined) { + if (index >= size || index < 0) { + return nil; + } + + return self[index]; + } + else { + length = Opal.Opal.$coerce_to(length, Opal.Integer, 'to_int'); + + if (length < 0 || index > size || index < 0) { + return nil; + } + + result = self.slice(index, index + length); + } + return toArraySubclass(result, self.$class()); + } + ; + + Opal.def(self, '$[]', TMP_Array_$$_12 = function(index, length) { + var self = this; + + + ; + + if (index.$$is_range) { + return $array_slice_range(self, index); + } + else { + return $array_slice_index_length(self, index, length); + } + ; + }, TMP_Array_$$_12.$$arity = -2); + + Opal.def(self, '$[]=', TMP_Array_$$$eq_13 = function(index, value, extra) { + var self = this, data = nil, length = nil; + + + ; + var i, size = self.length;; + if ($truthy($$($nesting, 'Range')['$==='](index))) { + + data = (function() {if ($truthy($$($nesting, 'Array')['$==='](value))) { + return value.$to_a() + } else if ($truthy(value['$respond_to?']("to_ary"))) { + return value.$to_ary().$to_a() + } else { + return [value] + }; return nil; })(); + + var exclude = index.excl, + from = $$($nesting, 'Opal').$coerce_to(index.begin, $$($nesting, 'Integer'), "to_int"), + to = $$($nesting, 'Opal').$coerce_to(index.end, $$($nesting, 'Integer'), "to_int"); + + if (from < 0) { + from += size; + + if (from < 0) { + self.$raise($$($nesting, 'RangeError'), "" + (index.$inspect()) + " out of range"); + } + } + + if (to < 0) { + to += size; + } + + if (!exclude) { + to += 1; + } + + if (from > size) { + for (i = size; i < from; i++) { + self[i] = nil; + } + } + + if (to < 0) { + self.splice.apply(self, [from, 0].concat(data)); + } + else { + self.splice.apply(self, [from, to - from].concat(data)); + } + + return value; + ; + } else { + + if ($truthy(extra === undefined)) { + length = 1 + } else { + + length = value; + value = extra; + data = (function() {if ($truthy($$($nesting, 'Array')['$==='](value))) { + return value.$to_a() + } else if ($truthy(value['$respond_to?']("to_ary"))) { + return value.$to_ary().$to_a() + } else { + return [value] + }; return nil; })(); + }; + + var old; + + index = $$($nesting, 'Opal').$coerce_to(index, $$($nesting, 'Integer'), "to_int"); + length = $$($nesting, 'Opal').$coerce_to(length, $$($nesting, 'Integer'), "to_int"); + + if (index < 0) { + old = index; + index += size; + + if (index < 0) { + self.$raise($$($nesting, 'IndexError'), "" + "index " + (old) + " too small for array; minimum " + (-self.length)); + } + } + + if (length < 0) { + self.$raise($$($nesting, 'IndexError'), "" + "negative length (" + (length) + ")") + } + + if (index > size) { + for (i = size; i < index; i++) { + self[i] = nil; + } + } + + if (extra === undefined) { + self[index] = value; + } + else { + self.splice.apply(self, [index, length].concat(data)); + } + + return value; + ; + }; + }, TMP_Array_$$$eq_13.$$arity = -3); + + Opal.def(self, '$any?', TMP_Array_any$q_14 = function(pattern) { + var $iter = TMP_Array_any$q_14.$$p, block = $iter || nil, self = this, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_Array_any$q_14.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + + + if ($iter) TMP_Array_any$q_14.$$p = null;; + ; + if (self.length === 0) return false; + return $send(self, Opal.find_super_dispatcher(self, 'any?', TMP_Array_any$q_14, false), $zuper, $iter); + }, TMP_Array_any$q_14.$$arity = -1); + + Opal.def(self, '$assoc', TMP_Array_assoc_15 = function $$assoc(object) { + var self = this; + + + for (var i = 0, length = self.length, item; i < length; i++) { + if (item = self[i], item.length && (item[0])['$=='](object)) { + return item; + } + } + + return nil; + + }, TMP_Array_assoc_15.$$arity = 1); + + Opal.def(self, '$at', TMP_Array_at_16 = function $$at(index) { + var self = this; + + + index = $$($nesting, 'Opal').$coerce_to(index, $$($nesting, 'Integer'), "to_int"); + + if (index < 0) { + index += self.length; + } + + if (index < 0 || index >= self.length) { + return nil; + } + + return self[index]; + ; + }, TMP_Array_at_16.$$arity = 1); + + Opal.def(self, '$bsearch_index', TMP_Array_bsearch_index_17 = function $$bsearch_index() { + var $iter = TMP_Array_bsearch_index_17.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Array_bsearch_index_17.$$p = null; + + + if ($iter) TMP_Array_bsearch_index_17.$$p = null;; + if ((block !== nil)) { + } else { + return self.$enum_for("bsearch_index") + }; + + var min = 0, + max = self.length, + mid, + val, + ret, + smaller = false, + satisfied = nil; + + while (min < max) { + mid = min + Math.floor((max - min) / 2); + val = self[mid]; + ret = Opal.yield1(block, val); + + if (ret === true) { + satisfied = mid; + smaller = true; + } + else if (ret === false || ret === nil) { + smaller = false; + } + else if (ret.$$is_number) { + if (ret === 0) { return mid; } + smaller = (ret < 0); + } + else { + self.$raise($$($nesting, 'TypeError'), "" + "wrong argument type " + ((ret).$class()) + " (must be numeric, true, false or nil)") + } + + if (smaller) { max = mid; } else { min = mid + 1; } + } + + return satisfied; + ; + }, TMP_Array_bsearch_index_17.$$arity = 0); + + Opal.def(self, '$bsearch', TMP_Array_bsearch_18 = function $$bsearch() { + var $iter = TMP_Array_bsearch_18.$$p, block = $iter || nil, self = this, index = nil; + + if ($iter) TMP_Array_bsearch_18.$$p = null; + + + if ($iter) TMP_Array_bsearch_18.$$p = null;; + if ((block !== nil)) { + } else { + return self.$enum_for("bsearch") + }; + index = $send(self, 'bsearch_index', [], block.$to_proc()); + + if (index != null && index.$$is_number) { + return self[index]; + } else { + return index; + } + ; + }, TMP_Array_bsearch_18.$$arity = 0); + + Opal.def(self, '$cycle', TMP_Array_cycle_19 = function $$cycle(n) { + var $iter = TMP_Array_cycle_19.$$p, block = $iter || nil, TMP_20, $a, self = this; + + if ($iter) TMP_Array_cycle_19.$$p = null; + + + if ($iter) TMP_Array_cycle_19.$$p = null;; + + if (n == null) { + n = nil; + }; + if ((block !== nil)) { + } else { + return $send(self, 'enum_for', ["cycle", n], (TMP_20 = function(){var self = TMP_20.$$s || this; + + if ($truthy(n['$nil?']())) { + return $$$($$($nesting, 'Float'), 'INFINITY') + } else { + + n = $$($nesting, 'Opal')['$coerce_to!'](n, $$($nesting, 'Integer'), "to_int"); + if ($truthy($rb_gt(n, 0))) { + return $rb_times(self.$enumerator_size(), n) + } else { + return 0 + }; + }}, TMP_20.$$s = self, TMP_20.$$arity = 0, TMP_20)) + }; + if ($truthy(($truthy($a = self['$empty?']()) ? $a : n['$=='](0)))) { + return nil}; + + var i, length, value; + + if (n === nil) { + while (true) { + for (i = 0, length = self.length; i < length; i++) { + value = Opal.yield1(block, self[i]); + } + } + } + else { + n = $$($nesting, 'Opal')['$coerce_to!'](n, $$($nesting, 'Integer'), "to_int"); + if (n <= 0) { + return self; + } + + while (n > 0) { + for (i = 0, length = self.length; i < length; i++) { + value = Opal.yield1(block, self[i]); + } + + n--; + } + } + ; + return self; + }, TMP_Array_cycle_19.$$arity = -1); + + Opal.def(self, '$clear', TMP_Array_clear_21 = function $$clear() { + var self = this; + + + self.splice(0, self.length); + return self; + }, TMP_Array_clear_21.$$arity = 0); + + Opal.def(self, '$count', TMP_Array_count_22 = function $$count(object) { + var $iter = TMP_Array_count_22.$$p, block = $iter || nil, $a, self = this, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_Array_count_22.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + + + if ($iter) TMP_Array_count_22.$$p = null;; + + if (object == null) { + object = nil; + }; + if ($truthy(($truthy($a = object) ? $a : block))) { + return $send(self, Opal.find_super_dispatcher(self, 'count', TMP_Array_count_22, false), $zuper, $iter) + } else { + return self.$size() + }; + }, TMP_Array_count_22.$$arity = -1); + + Opal.def(self, '$initialize_copy', TMP_Array_initialize_copy_23 = function $$initialize_copy(other) { + var self = this; + + return self.$replace(other) + }, TMP_Array_initialize_copy_23.$$arity = 1); + + Opal.def(self, '$collect', TMP_Array_collect_24 = function $$collect() { + var $iter = TMP_Array_collect_24.$$p, block = $iter || nil, TMP_25, self = this; + + if ($iter) TMP_Array_collect_24.$$p = null; + + + if ($iter) TMP_Array_collect_24.$$p = null;; + if ((block !== nil)) { + } else { + return $send(self, 'enum_for', ["collect"], (TMP_25 = function(){var self = TMP_25.$$s || this; + + return self.$size()}, TMP_25.$$s = self, TMP_25.$$arity = 0, TMP_25)) + }; + + var result = []; + + for (var i = 0, length = self.length; i < length; i++) { + var value = Opal.yield1(block, self[i]); + result.push(value); + } + + return result; + ; + }, TMP_Array_collect_24.$$arity = 0); + + Opal.def(self, '$collect!', TMP_Array_collect$B_26 = function() { + var $iter = TMP_Array_collect$B_26.$$p, block = $iter || nil, TMP_27, self = this; + + if ($iter) TMP_Array_collect$B_26.$$p = null; + + + if ($iter) TMP_Array_collect$B_26.$$p = null;; + if ((block !== nil)) { + } else { + return $send(self, 'enum_for', ["collect!"], (TMP_27 = function(){var self = TMP_27.$$s || this; + + return self.$size()}, TMP_27.$$s = self, TMP_27.$$arity = 0, TMP_27)) + }; + + for (var i = 0, length = self.length; i < length; i++) { + var value = Opal.yield1(block, self[i]); + self[i] = value; + } + ; + return self; + }, TMP_Array_collect$B_26.$$arity = 0); + + function binomial_coefficient(n, k) { + if (n === k || k === 0) { + return 1; + } + + if (k > 0 && n > k) { + return binomial_coefficient(n - 1, k - 1) + binomial_coefficient(n - 1, k); + } + + return 0; + } + ; + + Opal.def(self, '$combination', TMP_Array_combination_28 = function $$combination(n) { + var TMP_29, $iter = TMP_Array_combination_28.$$p, $yield = $iter || nil, self = this, num = nil; + + if ($iter) TMP_Array_combination_28.$$p = null; + + num = $$($nesting, 'Opal')['$coerce_to!'](n, $$($nesting, 'Integer'), "to_int"); + if (($yield !== nil)) { + } else { + return $send(self, 'enum_for', ["combination", num], (TMP_29 = function(){var self = TMP_29.$$s || this; + + return binomial_coefficient(self.length, num)}, TMP_29.$$s = self, TMP_29.$$arity = 0, TMP_29)) + }; + + var i, length, stack, chosen, lev, done, next; + + if (num === 0) { + Opal.yield1($yield, []) + } else if (num === 1) { + for (i = 0, length = self.length; i < length; i++) { + Opal.yield1($yield, [self[i]]) + } + } + else if (num === self.length) { + Opal.yield1($yield, self.slice()) + } + else if (num >= 0 && num < self.length) { + stack = []; + for (i = 0; i <= num + 1; i++) { + stack.push(0); + } + + chosen = []; + lev = 0; + done = false; + stack[0] = -1; + + while (!done) { + chosen[lev] = self[stack[lev+1]]; + while (lev < num - 1) { + lev++; + next = stack[lev+1] = stack[lev] + 1; + chosen[lev] = self[next]; + } + Opal.yield1($yield, chosen.slice()) + lev++; + do { + done = (lev === 0); + stack[lev]++; + lev--; + } while ( stack[lev+1] + num === self.length + lev + 1 ); + } + } + ; + return self; + }, TMP_Array_combination_28.$$arity = 1); + + Opal.def(self, '$repeated_combination', TMP_Array_repeated_combination_30 = function $$repeated_combination(n) { + var TMP_31, $iter = TMP_Array_repeated_combination_30.$$p, $yield = $iter || nil, self = this, num = nil; + + if ($iter) TMP_Array_repeated_combination_30.$$p = null; + + num = $$($nesting, 'Opal')['$coerce_to!'](n, $$($nesting, 'Integer'), "to_int"); + if (($yield !== nil)) { + } else { + return $send(self, 'enum_for', ["repeated_combination", num], (TMP_31 = function(){var self = TMP_31.$$s || this; + + return binomial_coefficient(self.length + num - 1, num);}, TMP_31.$$s = self, TMP_31.$$arity = 0, TMP_31)) + }; + + function iterate(max, from, buffer, self) { + if (buffer.length == max) { + var copy = buffer.slice(); + Opal.yield1($yield, copy) + return; + } + for (var i = from; i < self.length; i++) { + buffer.push(self[i]); + iterate(max, i, buffer, self); + buffer.pop(); + } + } + + if (num >= 0) { + iterate(num, 0, [], self); + } + ; + return self; + }, TMP_Array_repeated_combination_30.$$arity = 1); + + Opal.def(self, '$compact', TMP_Array_compact_32 = function $$compact() { + var self = this; + + + var result = []; + + for (var i = 0, length = self.length, item; i < length; i++) { + if ((item = self[i]) !== nil) { + result.push(item); + } + } + + return result; + + }, TMP_Array_compact_32.$$arity = 0); + + Opal.def(self, '$compact!', TMP_Array_compact$B_33 = function() { + var self = this; + + + var original = self.length; + + for (var i = 0, length = self.length; i < length; i++) { + if (self[i] === nil) { + self.splice(i, 1); + + length--; + i--; + } + } + + return self.length === original ? nil : self; + + }, TMP_Array_compact$B_33.$$arity = 0); + + Opal.def(self, '$concat', TMP_Array_concat_34 = function $$concat($a) { + var $post_args, others, TMP_35, TMP_36, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + others = $post_args;; + others = $send(others, 'map', [], (TMP_35 = function(other){var self = TMP_35.$$s || this; + + + + if (other == null) { + other = nil; + }; + other = (function() {if ($truthy($$($nesting, 'Array')['$==='](other))) { + return other.$to_a() + } else { + return $$($nesting, 'Opal').$coerce_to(other, $$($nesting, 'Array'), "to_ary").$to_a() + }; return nil; })(); + if ($truthy(other['$equal?'](self))) { + other = other.$dup()}; + return other;}, TMP_35.$$s = self, TMP_35.$$arity = 1, TMP_35)); + $send(others, 'each', [], (TMP_36 = function(other){var self = TMP_36.$$s || this; + + + + if (other == null) { + other = nil; + }; + + for (var i = 0, length = other.length; i < length; i++) { + self.push(other[i]); + } + ;}, TMP_36.$$s = self, TMP_36.$$arity = 1, TMP_36)); + return self; + }, TMP_Array_concat_34.$$arity = -1); + + Opal.def(self, '$delete', TMP_Array_delete_37 = function(object) { + var $iter = TMP_Array_delete_37.$$p, $yield = $iter || nil, self = this; + + if ($iter) TMP_Array_delete_37.$$p = null; + + var original = self.length; + + for (var i = 0, length = original; i < length; i++) { + if ((self[i])['$=='](object)) { + self.splice(i, 1); + + length--; + i--; + } + } + + if (self.length === original) { + if (($yield !== nil)) { + return Opal.yieldX($yield, []); + } + return nil; + } + return object; + + }, TMP_Array_delete_37.$$arity = 1); + + Opal.def(self, '$delete_at', TMP_Array_delete_at_38 = function $$delete_at(index) { + var self = this; + + + index = $$($nesting, 'Opal').$coerce_to(index, $$($nesting, 'Integer'), "to_int"); + + if (index < 0) { + index += self.length; + } + + if (index < 0 || index >= self.length) { + return nil; + } + + var result = self[index]; + + self.splice(index, 1); + + return result; + + }, TMP_Array_delete_at_38.$$arity = 1); + + Opal.def(self, '$delete_if', TMP_Array_delete_if_39 = function $$delete_if() { + var $iter = TMP_Array_delete_if_39.$$p, block = $iter || nil, TMP_40, self = this; + + if ($iter) TMP_Array_delete_if_39.$$p = null; + + + if ($iter) TMP_Array_delete_if_39.$$p = null;; + if ((block !== nil)) { + } else { + return $send(self, 'enum_for', ["delete_if"], (TMP_40 = function(){var self = TMP_40.$$s || this; + + return self.$size()}, TMP_40.$$s = self, TMP_40.$$arity = 0, TMP_40)) + }; + + for (var i = 0, length = self.length, value; i < length; i++) { + value = block(self[i]); + + if (value !== false && value !== nil) { + self.splice(i, 1); + + length--; + i--; + } + } + ; + return self; + }, TMP_Array_delete_if_39.$$arity = 0); + + Opal.def(self, '$dig', TMP_Array_dig_41 = function $$dig(idx, $a) { + var $post_args, idxs, self = this, item = nil; + + + + $post_args = Opal.slice.call(arguments, 1, arguments.length); + + idxs = $post_args;; + item = self['$[]'](idx); + + if (item === nil || idxs.length === 0) { + return item; + } + ; + if ($truthy(item['$respond_to?']("dig"))) { + } else { + self.$raise($$($nesting, 'TypeError'), "" + (item.$class()) + " does not have #dig method") + }; + return $send(item, 'dig', Opal.to_a(idxs)); + }, TMP_Array_dig_41.$$arity = -2); + + Opal.def(self, '$drop', TMP_Array_drop_42 = function $$drop(number) { + var self = this; + + + if (number < 0) { + self.$raise($$($nesting, 'ArgumentError')) + } + + return self.slice(number); + + }, TMP_Array_drop_42.$$arity = 1); + + Opal.def(self, '$dup', TMP_Array_dup_43 = function $$dup() { + var $iter = TMP_Array_dup_43.$$p, $yield = $iter || nil, self = this, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_Array_dup_43.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + + + if (self.$$class === Opal.Array && + self.$$class.$allocate.$$pristine && + self.$copy_instance_variables.$$pristine && + self.$initialize_dup.$$pristine) { + return self.slice(0); + } + ; + return $send(self, Opal.find_super_dispatcher(self, 'dup', TMP_Array_dup_43, false), $zuper, $iter); + }, TMP_Array_dup_43.$$arity = 0); + + Opal.def(self, '$each', TMP_Array_each_44 = function $$each() { + var $iter = TMP_Array_each_44.$$p, block = $iter || nil, TMP_45, self = this; + + if ($iter) TMP_Array_each_44.$$p = null; + + + if ($iter) TMP_Array_each_44.$$p = null;; + if ((block !== nil)) { + } else { + return $send(self, 'enum_for', ["each"], (TMP_45 = function(){var self = TMP_45.$$s || this; + + return self.$size()}, TMP_45.$$s = self, TMP_45.$$arity = 0, TMP_45)) + }; + + for (var i = 0, length = self.length; i < length; i++) { + var value = Opal.yield1(block, self[i]); + } + ; + return self; + }, TMP_Array_each_44.$$arity = 0); + + Opal.def(self, '$each_index', TMP_Array_each_index_46 = function $$each_index() { + var $iter = TMP_Array_each_index_46.$$p, block = $iter || nil, TMP_47, self = this; + + if ($iter) TMP_Array_each_index_46.$$p = null; + + + if ($iter) TMP_Array_each_index_46.$$p = null;; + if ((block !== nil)) { + } else { + return $send(self, 'enum_for', ["each_index"], (TMP_47 = function(){var self = TMP_47.$$s || this; + + return self.$size()}, TMP_47.$$s = self, TMP_47.$$arity = 0, TMP_47)) + }; + + for (var i = 0, length = self.length; i < length; i++) { + var value = Opal.yield1(block, i); + } + ; + return self; + }, TMP_Array_each_index_46.$$arity = 0); + + Opal.def(self, '$empty?', TMP_Array_empty$q_48 = function() { + var self = this; + + return self.length === 0; + }, TMP_Array_empty$q_48.$$arity = 0); + + Opal.def(self, '$eql?', TMP_Array_eql$q_49 = function(other) { + var self = this; + + + var recursed = {}; + + function _eql(array, other) { + var i, length, a, b; + + if (!other.$$is_array) { + return false; + } + + other = other.$to_a(); + + if (array.length !== other.length) { + return false; + } + + recursed[(array).$object_id()] = true; + + for (i = 0, length = array.length; i < length; i++) { + a = array[i]; + b = other[i]; + if (a.$$is_array) { + if (b.$$is_array && b.length !== a.length) { + return false; + } + if (!recursed.hasOwnProperty((a).$object_id())) { + if (!_eql(a, b)) { + return false; + } + } + } else { + if (!(a)['$eql?'](b)) { + return false; + } + } + } + + return true; + } + + return _eql(self, other); + + }, TMP_Array_eql$q_49.$$arity = 1); + + Opal.def(self, '$fetch', TMP_Array_fetch_50 = function $$fetch(index, defaults) { + var $iter = TMP_Array_fetch_50.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Array_fetch_50.$$p = null; + + + if ($iter) TMP_Array_fetch_50.$$p = null;; + ; + + var original = index; + + index = $$($nesting, 'Opal').$coerce_to(index, $$($nesting, 'Integer'), "to_int"); + + if (index < 0) { + index += self.length; + } + + if (index >= 0 && index < self.length) { + return self[index]; + } + + if (block !== nil && defaults != null) { + self.$warn("warning: block supersedes default value argument") + } + + if (block !== nil) { + return block(original); + } + + if (defaults != null) { + return defaults; + } + + if (self.length === 0) { + self.$raise($$($nesting, 'IndexError'), "" + "index " + (original) + " outside of array bounds: 0...0") + } + else { + self.$raise($$($nesting, 'IndexError'), "" + "index " + (original) + " outside of array bounds: -" + (self.length) + "..." + (self.length)); + } + ; + }, TMP_Array_fetch_50.$$arity = -2); + + Opal.def(self, '$fill', TMP_Array_fill_51 = function $$fill($a) { + var $iter = TMP_Array_fill_51.$$p, block = $iter || nil, $post_args, args, $b, $c, self = this, one = nil, two = nil, obj = nil, left = nil, right = nil; + + if ($iter) TMP_Array_fill_51.$$p = null; + + + if ($iter) TMP_Array_fill_51.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + var i, length, value;; + if ($truthy(block)) { + + if ($truthy(args.length > 2)) { + self.$raise($$($nesting, 'ArgumentError'), "" + "wrong number of arguments (" + (args.$length()) + " for 0..2)")}; + $c = args, $b = Opal.to_ary($c), (one = ($b[0] == null ? nil : $b[0])), (two = ($b[1] == null ? nil : $b[1])), $c; + } else { + + if ($truthy(args.length == 0)) { + self.$raise($$($nesting, 'ArgumentError'), "wrong number of arguments (0 for 1..3)") + } else if ($truthy(args.length > 3)) { + self.$raise($$($nesting, 'ArgumentError'), "" + "wrong number of arguments (" + (args.$length()) + " for 1..3)")}; + $c = args, $b = Opal.to_ary($c), (obj = ($b[0] == null ? nil : $b[0])), (one = ($b[1] == null ? nil : $b[1])), (two = ($b[2] == null ? nil : $b[2])), $c; + }; + if ($truthy($$($nesting, 'Range')['$==='](one))) { + + if ($truthy(two)) { + self.$raise($$($nesting, 'TypeError'), "length invalid with range")}; + left = $$($nesting, 'Opal').$coerce_to(one.$begin(), $$($nesting, 'Integer'), "to_int"); + if ($truthy(left < 0)) { + left += this.length}; + if ($truthy(left < 0)) { + self.$raise($$($nesting, 'RangeError'), "" + (one.$inspect()) + " out of range")}; + right = $$($nesting, 'Opal').$coerce_to(one.$end(), $$($nesting, 'Integer'), "to_int"); + if ($truthy(right < 0)) { + right += this.length}; + if ($truthy(one['$exclude_end?']())) { + } else { + right += 1 + }; + if ($truthy(right <= left)) { + return self}; + } else if ($truthy(one)) { + + left = $$($nesting, 'Opal').$coerce_to(one, $$($nesting, 'Integer'), "to_int"); + if ($truthy(left < 0)) { + left += this.length}; + if ($truthy(left < 0)) { + left = 0}; + if ($truthy(two)) { + + right = $$($nesting, 'Opal').$coerce_to(two, $$($nesting, 'Integer'), "to_int"); + if ($truthy(right == 0)) { + return self}; + right += left; + } else { + right = this.length + }; + } else { + + left = 0; + right = this.length; + }; + if ($truthy(left > this.length)) { + + for (i = this.length; i < right; i++) { + self[i] = nil; + } + }; + if ($truthy(right > this.length)) { + this.length = right}; + if ($truthy(block)) { + + for (length = this.length; left < right; left++) { + value = block(left); + self[left] = value; + } + + } else { + + for (length = this.length; left < right; left++) { + self[left] = obj; + } + + }; + return self; + }, TMP_Array_fill_51.$$arity = -1); + + Opal.def(self, '$first', TMP_Array_first_52 = function $$first(count) { + var self = this; + + + ; + + if (count == null) { + return self.length === 0 ? nil : self[0]; + } + + count = $$($nesting, 'Opal').$coerce_to(count, $$($nesting, 'Integer'), "to_int"); + + if (count < 0) { + self.$raise($$($nesting, 'ArgumentError'), "negative array size"); + } + + return self.slice(0, count); + ; + }, TMP_Array_first_52.$$arity = -1); + + Opal.def(self, '$flatten', TMP_Array_flatten_53 = function $$flatten(level) { + var self = this; + + + ; + + function _flatten(array, level) { + var result = [], + i, length, + item, ary; + + array = (array).$to_a(); + + for (i = 0, length = array.length; i < length; i++) { + item = array[i]; + + if (!$$($nesting, 'Opal')['$respond_to?'](item, "to_ary", true)) { + result.push(item); + continue; + } + + ary = (item).$to_ary(); + + if (ary === nil) { + result.push(item); + continue; + } + + if (!ary.$$is_array) { + self.$raise($$($nesting, 'TypeError')); + } + + if (ary === self) { + self.$raise($$($nesting, 'ArgumentError')); + } + + switch (level) { + case undefined: + result = result.concat(_flatten(ary)); + break; + case 0: + result.push(ary); + break; + default: + result.push.apply(result, _flatten(ary, level - 1)); + } + } + return result; + } + + if (level !== undefined) { + level = $$($nesting, 'Opal').$coerce_to(level, $$($nesting, 'Integer'), "to_int"); + } + + return toArraySubclass(_flatten(self, level), self.$class()); + ; + }, TMP_Array_flatten_53.$$arity = -1); + + Opal.def(self, '$flatten!', TMP_Array_flatten$B_54 = function(level) { + var self = this; + + + ; + + var flattened = self.$flatten(level); + + if (self.length == flattened.length) { + for (var i = 0, length = self.length; i < length; i++) { + if (self[i] !== flattened[i]) { + break; + } + } + + if (i == length) { + return nil; + } + } + + self.$replace(flattened); + ; + return self; + }, TMP_Array_flatten$B_54.$$arity = -1); + + Opal.def(self, '$hash', TMP_Array_hash_55 = function $$hash() { + var self = this; + + + var top = (Opal.hash_ids === undefined), + result = ['A'], + hash_id = self.$object_id(), + item, i, key; + + try { + if (top) { + Opal.hash_ids = Object.create(null); + } + + // return early for recursive structures + if (Opal.hash_ids[hash_id]) { + return 'self'; + } + + for (key in Opal.hash_ids) { + item = Opal.hash_ids[key]; + if (self['$eql?'](item)) { + return 'self'; + } + } + + Opal.hash_ids[hash_id] = self; + + for (i = 0; i < self.length; i++) { + item = self[i]; + result.push(item.$hash()); + } + + return result.join(','); + } finally { + if (top) { + Opal.hash_ids = undefined; + } + } + + }, TMP_Array_hash_55.$$arity = 0); + + Opal.def(self, '$include?', TMP_Array_include$q_56 = function(member) { + var self = this; + + + for (var i = 0, length = self.length; i < length; i++) { + if ((self[i])['$=='](member)) { + return true; + } + } + + return false; + + }, TMP_Array_include$q_56.$$arity = 1); + + Opal.def(self, '$index', TMP_Array_index_57 = function $$index(object) { + var $iter = TMP_Array_index_57.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Array_index_57.$$p = null; + + + if ($iter) TMP_Array_index_57.$$p = null;; + ; + + var i, length, value; + + if (object != null && block !== nil) { + self.$warn("warning: given block not used") + } + + if (object != null) { + for (i = 0, length = self.length; i < length; i++) { + if ((self[i])['$=='](object)) { + return i; + } + } + } + else if (block !== nil) { + for (i = 0, length = self.length; i < length; i++) { + value = block(self[i]); + + if (value !== false && value !== nil) { + return i; + } + } + } + else { + return self.$enum_for("index"); + } + + return nil; + ; + }, TMP_Array_index_57.$$arity = -1); + + Opal.def(self, '$insert', TMP_Array_insert_58 = function $$insert(index, $a) { + var $post_args, objects, self = this; + + + + $post_args = Opal.slice.call(arguments, 1, arguments.length); + + objects = $post_args;; + + index = $$($nesting, 'Opal').$coerce_to(index, $$($nesting, 'Integer'), "to_int"); + + if (objects.length > 0) { + if (index < 0) { + index += self.length + 1; + + if (index < 0) { + self.$raise($$($nesting, 'IndexError'), "" + (index) + " is out of bounds"); + } + } + if (index > self.length) { + for (var i = self.length; i < index; i++) { + self.push(nil); + } + } + + self.splice.apply(self, [index, 0].concat(objects)); + } + ; + return self; + }, TMP_Array_insert_58.$$arity = -2); + + Opal.def(self, '$inspect', TMP_Array_inspect_59 = function $$inspect() { + var self = this; + + + var result = [], + id = self.$__id__(); + + for (var i = 0, length = self.length; i < length; i++) { + var item = self['$[]'](i); + + if ((item).$__id__() === id) { + result.push('[...]'); + } + else { + result.push((item).$inspect()); + } + } + + return '[' + result.join(', ') + ']'; + + }, TMP_Array_inspect_59.$$arity = 0); + + Opal.def(self, '$join', TMP_Array_join_60 = function $$join(sep) { + var self = this; + if ($gvars[","] == null) $gvars[","] = nil; + + + + if (sep == null) { + sep = nil; + }; + if ($truthy(self.length === 0)) { + return ""}; + if ($truthy(sep === nil)) { + sep = $gvars[","]}; + + var result = []; + var i, length, item, tmp; + + for (i = 0, length = self.length; i < length; i++) { + item = self[i]; + + if ($$($nesting, 'Opal')['$respond_to?'](item, "to_str")) { + tmp = (item).$to_str(); + + if (tmp !== nil) { + result.push((tmp).$to_s()); + + continue; + } + } + + if ($$($nesting, 'Opal')['$respond_to?'](item, "to_ary")) { + tmp = (item).$to_ary(); + + if (tmp === self) { + self.$raise($$($nesting, 'ArgumentError')); + } + + if (tmp !== nil) { + result.push((tmp).$join(sep)); + + continue; + } + } + + if ($$($nesting, 'Opal')['$respond_to?'](item, "to_s")) { + tmp = (item).$to_s(); + + if (tmp !== nil) { + result.push(tmp); + + continue; + } + } + + self.$raise($$($nesting, 'NoMethodError').$new("" + (Opal.inspect(item)) + " doesn't respond to #to_str, #to_ary or #to_s", "to_str")); + } + + if (sep === nil) { + return result.join(''); + } + else { + return result.join($$($nesting, 'Opal')['$coerce_to!'](sep, $$($nesting, 'String'), "to_str").$to_s()); + } + ; + }, TMP_Array_join_60.$$arity = -1); + + Opal.def(self, '$keep_if', TMP_Array_keep_if_61 = function $$keep_if() { + var $iter = TMP_Array_keep_if_61.$$p, block = $iter || nil, TMP_62, self = this; + + if ($iter) TMP_Array_keep_if_61.$$p = null; + + + if ($iter) TMP_Array_keep_if_61.$$p = null;; + if ((block !== nil)) { + } else { + return $send(self, 'enum_for', ["keep_if"], (TMP_62 = function(){var self = TMP_62.$$s || this; + + return self.$size()}, TMP_62.$$s = self, TMP_62.$$arity = 0, TMP_62)) + }; + + for (var i = 0, length = self.length, value; i < length; i++) { + value = block(self[i]); + + if (value === false || value === nil) { + self.splice(i, 1); + + length--; + i--; + } + } + ; + return self; + }, TMP_Array_keep_if_61.$$arity = 0); + + Opal.def(self, '$last', TMP_Array_last_63 = function $$last(count) { + var self = this; + + + ; + + if (count == null) { + return self.length === 0 ? nil : self[self.length - 1]; + } + + count = $$($nesting, 'Opal').$coerce_to(count, $$($nesting, 'Integer'), "to_int"); + + if (count < 0) { + self.$raise($$($nesting, 'ArgumentError'), "negative array size"); + } + + if (count > self.length) { + count = self.length; + } + + return self.slice(self.length - count, self.length); + ; + }, TMP_Array_last_63.$$arity = -1); + + Opal.def(self, '$length', TMP_Array_length_64 = function $$length() { + var self = this; + + return self.length; + }, TMP_Array_length_64.$$arity = 0); + Opal.alias(self, "map", "collect"); + Opal.alias(self, "map!", "collect!"); + + Opal.def(self, '$max', TMP_Array_max_65 = function $$max(n) { + var $iter = TMP_Array_max_65.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Array_max_65.$$p = null; + + + if ($iter) TMP_Array_max_65.$$p = null;; + ; + return $send(self.$each(), 'max', [n], block.$to_proc()); + }, TMP_Array_max_65.$$arity = -1); + + Opal.def(self, '$min', TMP_Array_min_66 = function $$min() { + var $iter = TMP_Array_min_66.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Array_min_66.$$p = null; + + + if ($iter) TMP_Array_min_66.$$p = null;; + return $send(self.$each(), 'min', [], block.$to_proc()); + }, TMP_Array_min_66.$$arity = 0); + + // Returns the product of from, from-1, ..., from - how_many + 1. + function descending_factorial(from, how_many) { + var count = how_many >= 0 ? 1 : 0; + while (how_many) { + count *= from; + from--; + how_many--; + } + return count; + } + ; + + Opal.def(self, '$permutation', TMP_Array_permutation_67 = function $$permutation(num) { + var $iter = TMP_Array_permutation_67.$$p, block = $iter || nil, TMP_68, self = this, perm = nil, used = nil; + + if ($iter) TMP_Array_permutation_67.$$p = null; + + + if ($iter) TMP_Array_permutation_67.$$p = null;; + ; + if ((block !== nil)) { + } else { + return $send(self, 'enum_for', ["permutation", num], (TMP_68 = function(){var self = TMP_68.$$s || this; + + return descending_factorial(self.length, num === undefined ? self.length : num);}, TMP_68.$$s = self, TMP_68.$$arity = 0, TMP_68)) + }; + + var permute, offensive, output; + + if (num === undefined) { + num = self.length; + } + else { + num = $$($nesting, 'Opal').$coerce_to(num, $$($nesting, 'Integer'), "to_int") + } + + if (num < 0 || self.length < num) { + // no permutations, yield nothing + } + else if (num === 0) { + // exactly one permutation: the zero-length array + Opal.yield1(block, []) + } + else if (num === 1) { + // this is a special, easy case + for (var i = 0; i < self.length; i++) { + Opal.yield1(block, [self[i]]) + } + } + else { + // this is the general case + (perm = $$($nesting, 'Array').$new(num)); + (used = $$($nesting, 'Array').$new(self.length, false)); + + permute = function(num, perm, index, used, blk) { + self = this; + for(var i = 0; i < self.length; i++){ + if(used['$[]'](i)['$!']()) { + perm[index] = i; + if(index < num - 1) { + used[i] = true; + permute.call(self, num, perm, index + 1, used, blk); + used[i] = false; + } + else { + output = []; + for (var j = 0; j < perm.length; j++) { + output.push(self[perm[j]]); + } + Opal.yield1(blk, output); + } + } + } + } + + if ((block !== nil)) { + // offensive (both definitions) copy. + offensive = self.slice(); + permute.call(offensive, num, perm, 0, used, block); + } + else { + permute.call(self, num, perm, 0, used, block); + } + } + ; + return self; + }, TMP_Array_permutation_67.$$arity = -1); + + Opal.def(self, '$repeated_permutation', TMP_Array_repeated_permutation_69 = function $$repeated_permutation(n) { + var TMP_70, $iter = TMP_Array_repeated_permutation_69.$$p, $yield = $iter || nil, self = this, num = nil; + + if ($iter) TMP_Array_repeated_permutation_69.$$p = null; + + num = $$($nesting, 'Opal')['$coerce_to!'](n, $$($nesting, 'Integer'), "to_int"); + if (($yield !== nil)) { + } else { + return $send(self, 'enum_for', ["repeated_permutation", num], (TMP_70 = function(){var self = TMP_70.$$s || this; + + if ($truthy($rb_ge(num, 0))) { + return self.$size()['$**'](num) + } else { + return 0 + }}, TMP_70.$$s = self, TMP_70.$$arity = 0, TMP_70)) + }; + + function iterate(max, buffer, self) { + if (buffer.length == max) { + var copy = buffer.slice(); + Opal.yield1($yield, copy) + return; + } + for (var i = 0; i < self.length; i++) { + buffer.push(self[i]); + iterate(max, buffer, self); + buffer.pop(); + } + } + + iterate(num, [], self.slice()); + ; + return self; + }, TMP_Array_repeated_permutation_69.$$arity = 1); + + Opal.def(self, '$pop', TMP_Array_pop_71 = function $$pop(count) { + var self = this; + + + ; + if ($truthy(count === undefined)) { + + if ($truthy(self.length === 0)) { + return nil}; + return self.pop();}; + count = $$($nesting, 'Opal').$coerce_to(count, $$($nesting, 'Integer'), "to_int"); + if ($truthy(count < 0)) { + self.$raise($$($nesting, 'ArgumentError'), "negative array size")}; + if ($truthy(self.length === 0)) { + return []}; + if ($truthy(count > self.length)) { + return self.splice(0, self.length); + } else { + return self.splice(self.length - count, self.length); + }; + }, TMP_Array_pop_71.$$arity = -1); + + Opal.def(self, '$product', TMP_Array_product_72 = function $$product($a) { + var $iter = TMP_Array_product_72.$$p, block = $iter || nil, $post_args, args, self = this; + + if ($iter) TMP_Array_product_72.$$p = null; + + + if ($iter) TMP_Array_product_72.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + + var result = (block !== nil) ? null : [], + n = args.length + 1, + counters = new Array(n), + lengths = new Array(n), + arrays = new Array(n), + i, m, subarray, len, resultlen = 1; + + arrays[0] = self; + for (i = 1; i < n; i++) { + arrays[i] = $$($nesting, 'Opal').$coerce_to(args[i - 1], $$($nesting, 'Array'), "to_ary"); + } + + for (i = 0; i < n; i++) { + len = arrays[i].length; + if (len === 0) { + return result || self; + } + resultlen *= len; + if (resultlen > 2147483647) { + self.$raise($$($nesting, 'RangeError'), "too big to product") + } + lengths[i] = len; + counters[i] = 0; + } + + outer_loop: for (;;) { + subarray = []; + for (i = 0; i < n; i++) { + subarray.push(arrays[i][counters[i]]); + } + if (result) { + result.push(subarray); + } else { + Opal.yield1(block, subarray) + } + m = n - 1; + counters[m]++; + while (counters[m] === lengths[m]) { + counters[m] = 0; + if (--m < 0) break outer_loop; + counters[m]++; + } + } + + return result || self; + ; + }, TMP_Array_product_72.$$arity = -1); + + Opal.def(self, '$push', TMP_Array_push_73 = function $$push($a) { + var $post_args, objects, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + objects = $post_args;; + + for (var i = 0, length = objects.length; i < length; i++) { + self.push(objects[i]); + } + ; + return self; + }, TMP_Array_push_73.$$arity = -1); + Opal.alias(self, "append", "push"); + + Opal.def(self, '$rassoc', TMP_Array_rassoc_74 = function $$rassoc(object) { + var self = this; + + + for (var i = 0, length = self.length, item; i < length; i++) { + item = self[i]; + + if (item.length && item[1] !== undefined) { + if ((item[1])['$=='](object)) { + return item; + } + } + } + + return nil; + + }, TMP_Array_rassoc_74.$$arity = 1); + + Opal.def(self, '$reject', TMP_Array_reject_75 = function $$reject() { + var $iter = TMP_Array_reject_75.$$p, block = $iter || nil, TMP_76, self = this; + + if ($iter) TMP_Array_reject_75.$$p = null; + + + if ($iter) TMP_Array_reject_75.$$p = null;; + if ((block !== nil)) { + } else { + return $send(self, 'enum_for', ["reject"], (TMP_76 = function(){var self = TMP_76.$$s || this; + + return self.$size()}, TMP_76.$$s = self, TMP_76.$$arity = 0, TMP_76)) + }; + + var result = []; + + for (var i = 0, length = self.length, value; i < length; i++) { + value = block(self[i]); + + if (value === false || value === nil) { + result.push(self[i]); + } + } + return result; + ; + }, TMP_Array_reject_75.$$arity = 0); + + Opal.def(self, '$reject!', TMP_Array_reject$B_77 = function() { + var $iter = TMP_Array_reject$B_77.$$p, block = $iter || nil, TMP_78, self = this, original = nil; + + if ($iter) TMP_Array_reject$B_77.$$p = null; + + + if ($iter) TMP_Array_reject$B_77.$$p = null;; + if ((block !== nil)) { + } else { + return $send(self, 'enum_for', ["reject!"], (TMP_78 = function(){var self = TMP_78.$$s || this; + + return self.$size()}, TMP_78.$$s = self, TMP_78.$$arity = 0, TMP_78)) + }; + original = self.$length(); + $send(self, 'delete_if', [], block.$to_proc()); + if (self.$length()['$=='](original)) { + return nil + } else { + return self + }; + }, TMP_Array_reject$B_77.$$arity = 0); + + Opal.def(self, '$replace', TMP_Array_replace_79 = function $$replace(other) { + var self = this; + + + other = (function() {if ($truthy($$($nesting, 'Array')['$==='](other))) { + return other.$to_a() + } else { + return $$($nesting, 'Opal').$coerce_to(other, $$($nesting, 'Array'), "to_ary").$to_a() + }; return nil; })(); + + self.splice(0, self.length); + self.push.apply(self, other); + ; + return self; + }, TMP_Array_replace_79.$$arity = 1); + + Opal.def(self, '$reverse', TMP_Array_reverse_80 = function $$reverse() { + var self = this; + + return self.slice(0).reverse(); + }, TMP_Array_reverse_80.$$arity = 0); + + Opal.def(self, '$reverse!', TMP_Array_reverse$B_81 = function() { + var self = this; + + return self.reverse(); + }, TMP_Array_reverse$B_81.$$arity = 0); + + Opal.def(self, '$reverse_each', TMP_Array_reverse_each_82 = function $$reverse_each() { + var $iter = TMP_Array_reverse_each_82.$$p, block = $iter || nil, TMP_83, self = this; + + if ($iter) TMP_Array_reverse_each_82.$$p = null; + + + if ($iter) TMP_Array_reverse_each_82.$$p = null;; + if ((block !== nil)) { + } else { + return $send(self, 'enum_for', ["reverse_each"], (TMP_83 = function(){var self = TMP_83.$$s || this; + + return self.$size()}, TMP_83.$$s = self, TMP_83.$$arity = 0, TMP_83)) + }; + $send(self.$reverse(), 'each', [], block.$to_proc()); + return self; + }, TMP_Array_reverse_each_82.$$arity = 0); + + Opal.def(self, '$rindex', TMP_Array_rindex_84 = function $$rindex(object) { + var $iter = TMP_Array_rindex_84.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Array_rindex_84.$$p = null; + + + if ($iter) TMP_Array_rindex_84.$$p = null;; + ; + + var i, value; + + if (object != null && block !== nil) { + self.$warn("warning: given block not used") + } + + if (object != null) { + for (i = self.length - 1; i >= 0; i--) { + if (i >= self.length) { + break; + } + if ((self[i])['$=='](object)) { + return i; + } + } + } + else if (block !== nil) { + for (i = self.length - 1; i >= 0; i--) { + if (i >= self.length) { + break; + } + + value = block(self[i]); + + if (value !== false && value !== nil) { + return i; + } + } + } + else if (object == null) { + return self.$enum_for("rindex"); + } + + return nil; + ; + }, TMP_Array_rindex_84.$$arity = -1); + + Opal.def(self, '$rotate', TMP_Array_rotate_85 = function $$rotate(n) { + var self = this; + + + + if (n == null) { + n = 1; + }; + n = $$($nesting, 'Opal').$coerce_to(n, $$($nesting, 'Integer'), "to_int"); + + var ary, idx, firstPart, lastPart; + + if (self.length === 1) { + return self.slice(); + } + if (self.length === 0) { + return []; + } + + ary = self.slice(); + idx = n % ary.length; + + firstPart = ary.slice(idx); + lastPart = ary.slice(0, idx); + return firstPart.concat(lastPart); + ; + }, TMP_Array_rotate_85.$$arity = -1); + + Opal.def(self, '$rotate!', TMP_Array_rotate$B_86 = function(cnt) { + var self = this, ary = nil; + + + + if (cnt == null) { + cnt = 1; + }; + + if (self.length === 0 || self.length === 1) { + return self; + } + ; + cnt = $$($nesting, 'Opal').$coerce_to(cnt, $$($nesting, 'Integer'), "to_int"); + ary = self.$rotate(cnt); + return self.$replace(ary); + }, TMP_Array_rotate$B_86.$$arity = -1); + (function($base, $super, $parent_nesting) { + function $SampleRandom(){}; + var self = $SampleRandom = $klass($base, $super, 'SampleRandom', $SampleRandom); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_SampleRandom_initialize_87, TMP_SampleRandom_rand_88; + + def.rng = nil; + + + Opal.def(self, '$initialize', TMP_SampleRandom_initialize_87 = function $$initialize(rng) { + var self = this; + + return (self.rng = rng) + }, TMP_SampleRandom_initialize_87.$$arity = 1); + return (Opal.def(self, '$rand', TMP_SampleRandom_rand_88 = function $$rand(size) { + var self = this, random = nil; + + + random = $$($nesting, 'Opal').$coerce_to(self.rng.$rand(size), $$($nesting, 'Integer'), "to_int"); + if ($truthy(random < 0)) { + self.$raise($$($nesting, 'RangeError'), "random value must be >= 0")}; + if ($truthy(random < size)) { + } else { + self.$raise($$($nesting, 'RangeError'), "random value must be less than Array size") + }; + return random; + }, TMP_SampleRandom_rand_88.$$arity = 1), nil) && 'rand'; + })($nesting[0], null, $nesting); + + Opal.def(self, '$sample', TMP_Array_sample_89 = function $$sample(count, options) { + var $a, self = this, o = nil, rng = nil; + + + ; + ; + if ($truthy(count === undefined)) { + return self.$at($$($nesting, 'Kernel').$rand(self.length))}; + if ($truthy(options === undefined)) { + if ($truthy((o = $$($nesting, 'Opal')['$coerce_to?'](count, $$($nesting, 'Hash'), "to_hash")))) { + + options = o; + count = nil; + } else { + + options = nil; + count = $$($nesting, 'Opal').$coerce_to(count, $$($nesting, 'Integer'), "to_int"); + } + } else { + + count = $$($nesting, 'Opal').$coerce_to(count, $$($nesting, 'Integer'), "to_int"); + options = $$($nesting, 'Opal').$coerce_to(options, $$($nesting, 'Hash'), "to_hash"); + }; + if ($truthy(($truthy($a = count) ? count < 0 : $a))) { + self.$raise($$($nesting, 'ArgumentError'), "count must be greater than 0")}; + if ($truthy(options)) { + rng = options['$[]']("random")}; + rng = (function() {if ($truthy(($truthy($a = rng) ? rng['$respond_to?']("rand") : $a))) { + return $$($nesting, 'SampleRandom').$new(rng) + } else { + return $$($nesting, 'Kernel') + }; return nil; })(); + if ($truthy(count)) { + } else { + return self[rng.$rand(self.length)] + }; + + + var abandon, spin, result, i, j, k, targetIndex, oldValue; + + if (count > self.length) { + count = self.length; + } + + switch (count) { + case 0: + return []; + break; + case 1: + return [self[rng.$rand(self.length)]]; + break; + case 2: + i = rng.$rand(self.length); + j = rng.$rand(self.length); + if (i === j) { + j = i === 0 ? i + 1 : i - 1; + } + return [self[i], self[j]]; + break; + default: + if (self.length / count > 3) { + abandon = false; + spin = 0; + + result = $$($nesting, 'Array').$new(count); + i = 1; + + result[0] = rng.$rand(self.length); + while (i < count) { + k = rng.$rand(self.length); + j = 0; + + while (j < i) { + while (k === result[j]) { + spin++; + if (spin > 100) { + abandon = true; + break; + } + k = rng.$rand(self.length); + } + if (abandon) { break; } + + j++; + } + + if (abandon) { break; } + + result[i] = k; + + i++; + } + + if (!abandon) { + i = 0; + while (i < count) { + result[i] = self[result[i]]; + i++; + } + + return result; + } + } + + result = self.slice(); + + for (var c = 0; c < count; c++) { + targetIndex = rng.$rand(self.length); + oldValue = result[c]; + result[c] = result[targetIndex]; + result[targetIndex] = oldValue; + } + + return count === self.length ? result : (result)['$[]'](0, count); + } + ; + }, TMP_Array_sample_89.$$arity = -1); + + Opal.def(self, '$select', TMP_Array_select_90 = function $$select() { + var $iter = TMP_Array_select_90.$$p, block = $iter || nil, TMP_91, self = this; + + if ($iter) TMP_Array_select_90.$$p = null; + + + if ($iter) TMP_Array_select_90.$$p = null;; + if ((block !== nil)) { + } else { + return $send(self, 'enum_for', ["select"], (TMP_91 = function(){var self = TMP_91.$$s || this; + + return self.$size()}, TMP_91.$$s = self, TMP_91.$$arity = 0, TMP_91)) + }; + + var result = []; + + for (var i = 0, length = self.length, item, value; i < length; i++) { + item = self[i]; + + value = Opal.yield1(block, item); + + if (Opal.truthy(value)) { + result.push(item); + } + } + + return result; + ; + }, TMP_Array_select_90.$$arity = 0); + + Opal.def(self, '$select!', TMP_Array_select$B_92 = function() { + var $iter = TMP_Array_select$B_92.$$p, block = $iter || nil, TMP_93, self = this; + + if ($iter) TMP_Array_select$B_92.$$p = null; + + + if ($iter) TMP_Array_select$B_92.$$p = null;; + if ((block !== nil)) { + } else { + return $send(self, 'enum_for', ["select!"], (TMP_93 = function(){var self = TMP_93.$$s || this; + + return self.$size()}, TMP_93.$$s = self, TMP_93.$$arity = 0, TMP_93)) + }; + + var original = self.length; + $send(self, 'keep_if', [], block.$to_proc()); + return self.length === original ? nil : self; + ; + }, TMP_Array_select$B_92.$$arity = 0); + + Opal.def(self, '$shift', TMP_Array_shift_94 = function $$shift(count) { + var self = this; + + + ; + if ($truthy(count === undefined)) { + + if ($truthy(self.length === 0)) { + return nil}; + return self.shift();}; + count = $$($nesting, 'Opal').$coerce_to(count, $$($nesting, 'Integer'), "to_int"); + if ($truthy(count < 0)) { + self.$raise($$($nesting, 'ArgumentError'), "negative array size")}; + if ($truthy(self.length === 0)) { + return []}; + return self.splice(0, count);; + }, TMP_Array_shift_94.$$arity = -1); + Opal.alias(self, "size", "length"); + + Opal.def(self, '$shuffle', TMP_Array_shuffle_95 = function $$shuffle(rng) { + var self = this; + + + ; + return self.$dup().$to_a()['$shuffle!'](rng); + }, TMP_Array_shuffle_95.$$arity = -1); + + Opal.def(self, '$shuffle!', TMP_Array_shuffle$B_96 = function(rng) { + var self = this; + + + ; + + var randgen, i = self.length, j, tmp; + + if (rng !== undefined) { + rng = $$($nesting, 'Opal')['$coerce_to?'](rng, $$($nesting, 'Hash'), "to_hash"); + + if (rng !== nil) { + rng = rng['$[]']("random"); + + if (rng !== nil && rng['$respond_to?']("rand")) { + randgen = rng; + } + } + } + + while (i) { + if (randgen) { + j = randgen.$rand(i).$to_int(); + + if (j < 0) { + self.$raise($$($nesting, 'RangeError'), "" + "random number too small " + (j)) + } + + if (j >= i) { + self.$raise($$($nesting, 'RangeError'), "" + "random number too big " + (j)) + } + } + else { + j = self.$rand(i); + } + + tmp = self[--i]; + self[i] = self[j]; + self[j] = tmp; + } + + return self; + ; + }, TMP_Array_shuffle$B_96.$$arity = -1); + Opal.alias(self, "slice", "[]"); + + Opal.def(self, '$slice!', TMP_Array_slice$B_97 = function(index, length) { + var self = this, result = nil, range = nil, range_start = nil, range_end = nil, start = nil; + + + ; + result = nil; + if ($truthy(length === undefined)) { + if ($truthy($$($nesting, 'Range')['$==='](index))) { + + range = index; + result = self['$[]'](range); + range_start = $$($nesting, 'Opal').$coerce_to(range.$begin(), $$($nesting, 'Integer'), "to_int"); + range_end = $$($nesting, 'Opal').$coerce_to(range.$end(), $$($nesting, 'Integer'), "to_int"); + + if (range_start < 0) { + range_start += self.length; + } + + if (range_end < 0) { + range_end += self.length; + } else if (range_end >= self.length) { + range_end = self.length - 1; + if (range.excl) { + range_end += 1; + } + } + + var range_length = range_end - range_start; + if (range.excl) { + range_end -= 1; + } else { + range_length += 1; + } + + if (range_start < self.length && range_start >= 0 && range_end < self.length && range_end >= 0 && range_length > 0) { + self.splice(range_start, range_length); + } + ; + } else { + + start = $$($nesting, 'Opal').$coerce_to(index, $$($nesting, 'Integer'), "to_int"); + + if (start < 0) { + start += self.length; + } + + if (start < 0 || start >= self.length) { + return nil; + } + + result = self[start]; + + if (start === 0) { + self.shift(); + } else { + self.splice(start, 1); + } + ; + } + } else { + + start = $$($nesting, 'Opal').$coerce_to(index, $$($nesting, 'Integer'), "to_int"); + length = $$($nesting, 'Opal').$coerce_to(length, $$($nesting, 'Integer'), "to_int"); + + if (length < 0) { + return nil; + } + + var end = start + length; + + result = self['$[]'](start, length); + + if (start < 0) { + start += self.length; + } + + if (start + length > self.length) { + length = self.length - start; + } + + if (start < self.length && start >= 0) { + self.splice(start, length); + } + ; + }; + return result; + }, TMP_Array_slice$B_97.$$arity = -2); + + Opal.def(self, '$sort', TMP_Array_sort_98 = function $$sort() { + var $iter = TMP_Array_sort_98.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Array_sort_98.$$p = null; + + + if ($iter) TMP_Array_sort_98.$$p = null;; + if ($truthy(self.length > 1)) { + } else { + return self + }; + + if (block === nil) { + block = function(a, b) { + return (a)['$<=>'](b); + }; + } + + return self.slice().sort(function(x, y) { + var ret = block(x, y); + + if (ret === nil) { + self.$raise($$($nesting, 'ArgumentError'), "" + "comparison of " + ((x).$inspect()) + " with " + ((y).$inspect()) + " failed"); + } + + return $rb_gt(ret, 0) ? 1 : ($rb_lt(ret, 0) ? -1 : 0); + }); + ; + }, TMP_Array_sort_98.$$arity = 0); + + Opal.def(self, '$sort!', TMP_Array_sort$B_99 = function() { + var $iter = TMP_Array_sort$B_99.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Array_sort$B_99.$$p = null; + + + if ($iter) TMP_Array_sort$B_99.$$p = null;; + + var result; + + if ((block !== nil)) { + result = $send((self.slice()), 'sort', [], block.$to_proc()); + } + else { + result = (self.slice()).$sort(); + } + + self.length = 0; + for(var i = 0, length = result.length; i < length; i++) { + self.push(result[i]); + } + + return self; + ; + }, TMP_Array_sort$B_99.$$arity = 0); + + Opal.def(self, '$sort_by!', TMP_Array_sort_by$B_100 = function() { + var $iter = TMP_Array_sort_by$B_100.$$p, block = $iter || nil, TMP_101, self = this; + + if ($iter) TMP_Array_sort_by$B_100.$$p = null; + + + if ($iter) TMP_Array_sort_by$B_100.$$p = null;; + if ((block !== nil)) { + } else { + return $send(self, 'enum_for', ["sort_by!"], (TMP_101 = function(){var self = TMP_101.$$s || this; + + return self.$size()}, TMP_101.$$s = self, TMP_101.$$arity = 0, TMP_101)) + }; + return self.$replace($send(self, 'sort_by', [], block.$to_proc())); + }, TMP_Array_sort_by$B_100.$$arity = 0); + + Opal.def(self, '$take', TMP_Array_take_102 = function $$take(count) { + var self = this; + + + if (count < 0) { + self.$raise($$($nesting, 'ArgumentError')); + } + + return self.slice(0, count); + + }, TMP_Array_take_102.$$arity = 1); + + Opal.def(self, '$take_while', TMP_Array_take_while_103 = function $$take_while() { + var $iter = TMP_Array_take_while_103.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Array_take_while_103.$$p = null; + + + if ($iter) TMP_Array_take_while_103.$$p = null;; + + var result = []; + + for (var i = 0, length = self.length, item, value; i < length; i++) { + item = self[i]; + + value = block(item); + + if (value === false || value === nil) { + return result; + } + + result.push(item); + } + + return result; + ; + }, TMP_Array_take_while_103.$$arity = 0); + + Opal.def(self, '$to_a', TMP_Array_to_a_104 = function $$to_a() { + var self = this; + + return self + }, TMP_Array_to_a_104.$$arity = 0); + Opal.alias(self, "to_ary", "to_a"); + + Opal.def(self, '$to_h', TMP_Array_to_h_105 = function $$to_h() { + var self = this; + + + var i, len = self.length, ary, key, val, hash = $hash2([], {}); + + for (i = 0; i < len; i++) { + ary = $$($nesting, 'Opal')['$coerce_to?'](self[i], $$($nesting, 'Array'), "to_ary"); + if (!ary.$$is_array) { + self.$raise($$($nesting, 'TypeError'), "" + "wrong element type " + ((ary).$class()) + " at " + (i) + " (expected array)") + } + if (ary.length !== 2) { + self.$raise($$($nesting, 'ArgumentError'), "" + "wrong array length at " + (i) + " (expected 2, was " + ((ary).$length()) + ")") + } + key = ary[0]; + val = ary[1]; + Opal.hash_put(hash, key, val); + } + + return hash; + + }, TMP_Array_to_h_105.$$arity = 0); + Opal.alias(self, "to_s", "inspect"); + + Opal.def(self, '$transpose', TMP_Array_transpose_106 = function $$transpose() { + var TMP_107, self = this, result = nil, max = nil; + + + if ($truthy(self['$empty?']())) { + return []}; + result = []; + max = nil; + $send(self, 'each', [], (TMP_107 = function(row){var self = TMP_107.$$s || this, $a, TMP_108; + + + + if (row == null) { + row = nil; + }; + row = (function() {if ($truthy($$($nesting, 'Array')['$==='](row))) { + return row.$to_a() + } else { + return $$($nesting, 'Opal').$coerce_to(row, $$($nesting, 'Array'), "to_ary").$to_a() + }; return nil; })(); + max = ($truthy($a = max) ? $a : row.length); + if ($truthy((row.length)['$!='](max))) { + self.$raise($$($nesting, 'IndexError'), "" + "element size differs (" + (row.length) + " should be " + (max) + ")")}; + return $send((row.length), 'times', [], (TMP_108 = function(i){var self = TMP_108.$$s || this, $b, entry = nil, $writer = nil; + + + + if (i == null) { + i = nil; + }; + entry = ($truthy($b = result['$[]'](i)) ? $b : (($writer = [i, []]), $send(result, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + return entry['$<<'](row.$at(i));}, TMP_108.$$s = self, TMP_108.$$arity = 1, TMP_108));}, TMP_107.$$s = self, TMP_107.$$arity = 1, TMP_107)); + return result; + }, TMP_Array_transpose_106.$$arity = 0); + + Opal.def(self, '$uniq', TMP_Array_uniq_109 = function $$uniq() { + var $iter = TMP_Array_uniq_109.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Array_uniq_109.$$p = null; + + + if ($iter) TMP_Array_uniq_109.$$p = null;; + + var hash = $hash2([], {}), i, length, item, key; + + if (block === nil) { + for (i = 0, length = self.length; i < length; i++) { + item = self[i]; + if (Opal.hash_get(hash, item) === undefined) { + Opal.hash_put(hash, item, item); + } + } + } + else { + for (i = 0, length = self.length; i < length; i++) { + item = self[i]; + key = Opal.yield1(block, item); + if (Opal.hash_get(hash, key) === undefined) { + Opal.hash_put(hash, key, item); + } + } + } + + return toArraySubclass((hash).$values(), self.$class()); + ; + }, TMP_Array_uniq_109.$$arity = 0); + + Opal.def(self, '$uniq!', TMP_Array_uniq$B_110 = function() { + var $iter = TMP_Array_uniq$B_110.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Array_uniq$B_110.$$p = null; + + + if ($iter) TMP_Array_uniq$B_110.$$p = null;; + + var original_length = self.length, hash = $hash2([], {}), i, length, item, key; + + for (i = 0, length = original_length; i < length; i++) { + item = self[i]; + key = (block === nil ? item : Opal.yield1(block, item)); + + if (Opal.hash_get(hash, key) === undefined) { + Opal.hash_put(hash, key, item); + continue; + } + + self.splice(i, 1); + length--; + i--; + } + + return self.length === original_length ? nil : self; + ; + }, TMP_Array_uniq$B_110.$$arity = 0); + + Opal.def(self, '$unshift', TMP_Array_unshift_111 = function $$unshift($a) { + var $post_args, objects, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + objects = $post_args;; + + for (var i = objects.length - 1; i >= 0; i--) { + self.unshift(objects[i]); + } + ; + return self; + }, TMP_Array_unshift_111.$$arity = -1); + Opal.alias(self, "prepend", "unshift"); + + Opal.def(self, '$values_at', TMP_Array_values_at_112 = function $$values_at($a) { + var $post_args, args, TMP_113, self = this, out = nil; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + out = []; + $send(args, 'each', [], (TMP_113 = function(elem){var self = TMP_113.$$s || this, TMP_114, finish = nil, start = nil, i = nil; + + + + if (elem == null) { + elem = nil; + }; + if ($truthy(elem['$is_a?']($$($nesting, 'Range')))) { + + finish = $$($nesting, 'Opal').$coerce_to(elem.$last(), $$($nesting, 'Integer'), "to_int"); + start = $$($nesting, 'Opal').$coerce_to(elem.$first(), $$($nesting, 'Integer'), "to_int"); + + if (start < 0) { + start = start + self.length; + return nil;; + } + ; + + if (finish < 0) { + finish = finish + self.length; + } + if (elem['$exclude_end?']()) { + finish--; + } + if (finish < start) { + return nil;; + } + ; + return $send(start, 'upto', [finish], (TMP_114 = function(i){var self = TMP_114.$$s || this; + + + + if (i == null) { + i = nil; + }; + return out['$<<'](self.$at(i));}, TMP_114.$$s = self, TMP_114.$$arity = 1, TMP_114)); + } else { + + i = $$($nesting, 'Opal').$coerce_to(elem, $$($nesting, 'Integer'), "to_int"); + return out['$<<'](self.$at(i)); + };}, TMP_113.$$s = self, TMP_113.$$arity = 1, TMP_113)); + return out; + }, TMP_Array_values_at_112.$$arity = -1); + + Opal.def(self, '$zip', TMP_Array_zip_115 = function $$zip($a) { + var $iter = TMP_Array_zip_115.$$p, block = $iter || nil, $post_args, others, $b, self = this; + + if ($iter) TMP_Array_zip_115.$$p = null; + + + if ($iter) TMP_Array_zip_115.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + others = $post_args;; + + var result = [], size = self.length, part, o, i, j, jj; + + for (j = 0, jj = others.length; j < jj; j++) { + o = others[j]; + if (o.$$is_array) { + continue; + } + if (o.$$is_enumerator) { + if (o.$size() === Infinity) { + others[j] = o.$take(size); + } else { + others[j] = o.$to_a(); + } + continue; + } + others[j] = ($truthy($b = $$($nesting, 'Opal')['$coerce_to?'](o, $$($nesting, 'Array'), "to_ary")) ? $b : $$($nesting, 'Opal')['$coerce_to!'](o, $$($nesting, 'Enumerator'), "each")).$to_a(); + } + + for (i = 0; i < size; i++) { + part = [self[i]]; + + for (j = 0, jj = others.length; j < jj; j++) { + o = others[j][i]; + + if (o == null) { + o = nil; + } + + part[j + 1] = o; + } + + result[i] = part; + } + + if (block !== nil) { + for (i = 0; i < size; i++) { + block(result[i]); + } + + return nil; + } + + return result; + ; + }, TMP_Array_zip_115.$$arity = -1); + Opal.defs(self, '$inherited', TMP_Array_inherited_116 = function $$inherited(klass) { + var self = this; + + + klass.prototype.$to_a = function() { + return this.slice(0, this.length); + } + + }, TMP_Array_inherited_116.$$arity = 1); + + Opal.def(self, '$instance_variables', TMP_Array_instance_variables_117 = function $$instance_variables() { + var TMP_118, $iter = TMP_Array_instance_variables_117.$$p, $yield = $iter || nil, self = this, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_Array_instance_variables_117.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + return $send($send(self, Opal.find_super_dispatcher(self, 'instance_variables', TMP_Array_instance_variables_117, false), $zuper, $iter), 'reject', [], (TMP_118 = function(ivar){var self = TMP_118.$$s || this, $a; + + + + if (ivar == null) { + ivar = nil; + }; + return ($truthy($a = /^@\d+$/.test(ivar)) ? $a : ivar['$==']("@length"));}, TMP_118.$$s = self, TMP_118.$$arity = 1, TMP_118)) + }, TMP_Array_instance_variables_117.$$arity = 0); + $$($nesting, 'Opal').$pristine(self.$singleton_class(), "allocate"); + $$($nesting, 'Opal').$pristine(self, "copy_instance_variables", "initialize_dup"); + return (Opal.def(self, '$pack', TMP_Array_pack_119 = function $$pack($a) { + var $post_args, args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + return self.$raise("To use Array#pack, you must first require 'corelib/array/pack'."); + }, TMP_Array_pack_119.$$arity = -1), nil) && 'pack'; + })($nesting[0], Array, $nesting); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/hash"] = function(Opal) { + function $rb_ge(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs >= rhs : lhs['$>='](rhs); + } + function $rb_gt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); + } + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $send = Opal.send, $hash2 = Opal.hash2, $truthy = Opal.truthy; + + Opal.add_stubs(['$require', '$include', '$coerce_to?', '$[]', '$merge!', '$allocate', '$raise', '$coerce_to!', '$each', '$fetch', '$>=', '$>', '$==', '$compare_by_identity', '$lambda?', '$abs', '$arity', '$enum_for', '$size', '$respond_to?', '$class', '$dig', '$new', '$inspect', '$map', '$to_proc', '$flatten', '$eql?', '$default', '$dup', '$default_proc', '$default_proc=', '$-', '$default=', '$proc']); + + self.$require("corelib/enumerable"); + return (function($base, $super, $parent_nesting) { + function $Hash(){}; + var self = $Hash = $klass($base, $super, 'Hash', $Hash); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Hash_$$_1, TMP_Hash_allocate_2, TMP_Hash_try_convert_3, TMP_Hash_initialize_4, TMP_Hash_$eq$eq_5, TMP_Hash_$gt$eq_6, TMP_Hash_$gt_8, TMP_Hash_$lt_9, TMP_Hash_$lt$eq_10, TMP_Hash_$$_11, TMP_Hash_$$$eq_12, TMP_Hash_assoc_13, TMP_Hash_clear_14, TMP_Hash_clone_15, TMP_Hash_compact_16, TMP_Hash_compact$B_17, TMP_Hash_compare_by_identity_18, TMP_Hash_compare_by_identity$q_19, TMP_Hash_default_20, TMP_Hash_default$eq_21, TMP_Hash_default_proc_22, TMP_Hash_default_proc$eq_23, TMP_Hash_delete_24, TMP_Hash_delete_if_25, TMP_Hash_dig_27, TMP_Hash_each_28, TMP_Hash_each_key_30, TMP_Hash_each_value_32, TMP_Hash_empty$q_34, TMP_Hash_fetch_35, TMP_Hash_fetch_values_36, TMP_Hash_flatten_38, TMP_Hash_has_key$q_39, TMP_Hash_has_value$q_40, TMP_Hash_hash_41, TMP_Hash_index_42, TMP_Hash_indexes_43, TMP_Hash_inspect_44, TMP_Hash_invert_45, TMP_Hash_keep_if_46, TMP_Hash_keys_48, TMP_Hash_length_49, TMP_Hash_merge_50, TMP_Hash_merge$B_51, TMP_Hash_rassoc_52, TMP_Hash_rehash_53, TMP_Hash_reject_54, TMP_Hash_reject$B_56, TMP_Hash_replace_58, TMP_Hash_select_59, TMP_Hash_select$B_61, TMP_Hash_shift_63, TMP_Hash_slice_64, TMP_Hash_to_a_65, TMP_Hash_to_h_66, TMP_Hash_to_hash_67, TMP_Hash_to_proc_68, TMP_Hash_transform_keys_70, TMP_Hash_transform_keys$B_72, TMP_Hash_transform_values_74, TMP_Hash_transform_values$B_76, TMP_Hash_values_78; + + + self.$include($$($nesting, 'Enumerable')); + def.$$is_hash = true; + Opal.defs(self, '$[]', TMP_Hash_$$_1 = function($a) { + var $post_args, argv, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + argv = $post_args;; + + var hash, argc = argv.length, i; + + if (argc === 1) { + hash = $$($nesting, 'Opal')['$coerce_to?'](argv['$[]'](0), $$($nesting, 'Hash'), "to_hash"); + if (hash !== nil) { + return self.$allocate()['$merge!'](hash); + } + + argv = $$($nesting, 'Opal')['$coerce_to?'](argv['$[]'](0), $$($nesting, 'Array'), "to_ary"); + if (argv === nil) { + self.$raise($$($nesting, 'ArgumentError'), "odd number of arguments for Hash") + } + + argc = argv.length; + hash = self.$allocate(); + + for (i = 0; i < argc; i++) { + if (!argv[i].$$is_array) continue; + switch(argv[i].length) { + case 1: + hash.$store(argv[i][0], nil); + break; + case 2: + hash.$store(argv[i][0], argv[i][1]); + break; + default: + self.$raise($$($nesting, 'ArgumentError'), "" + "invalid number of elements (" + (argv[i].length) + " for 1..2)") + } + } + + return hash; + } + + if (argc % 2 !== 0) { + self.$raise($$($nesting, 'ArgumentError'), "odd number of arguments for Hash") + } + + hash = self.$allocate(); + + for (i = 0; i < argc; i += 2) { + hash.$store(argv[i], argv[i + 1]); + } + + return hash; + ; + }, TMP_Hash_$$_1.$$arity = -1); + Opal.defs(self, '$allocate', TMP_Hash_allocate_2 = function $$allocate() { + var self = this; + + + var hash = new self(); + + Opal.hash_init(hash); + + hash.$$none = nil; + hash.$$proc = nil; + + return hash; + + }, TMP_Hash_allocate_2.$$arity = 0); + Opal.defs(self, '$try_convert', TMP_Hash_try_convert_3 = function $$try_convert(obj) { + var self = this; + + return $$($nesting, 'Opal')['$coerce_to?'](obj, $$($nesting, 'Hash'), "to_hash") + }, TMP_Hash_try_convert_3.$$arity = 1); + + Opal.def(self, '$initialize', TMP_Hash_initialize_4 = function $$initialize(defaults) { + var $iter = TMP_Hash_initialize_4.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Hash_initialize_4.$$p = null; + + + if ($iter) TMP_Hash_initialize_4.$$p = null;; + ; + + if (defaults !== undefined && block !== nil) { + self.$raise($$($nesting, 'ArgumentError'), "wrong number of arguments (1 for 0)") + } + self.$$none = (defaults === undefined ? nil : defaults); + self.$$proc = block; + + return self; + ; + }, TMP_Hash_initialize_4.$$arity = -1); + + Opal.def(self, '$==', TMP_Hash_$eq$eq_5 = function(other) { + var self = this; + + + if (self === other) { + return true; + } + + if (!other.$$is_hash) { + return false; + } + + if (self.$$keys.length !== other.$$keys.length) { + return false; + } + + for (var i = 0, keys = self.$$keys, length = keys.length, key, value, other_value; i < length; i++) { + key = keys[i]; + + if (key.$$is_string) { + value = self.$$smap[key]; + other_value = other.$$smap[key]; + } else { + value = key.value; + other_value = Opal.hash_get(other, key.key); + } + + if (other_value === undefined || !value['$eql?'](other_value)) { + return false; + } + } + + return true; + + }, TMP_Hash_$eq$eq_5.$$arity = 1); + + Opal.def(self, '$>=', TMP_Hash_$gt$eq_6 = function(other) { + var TMP_7, self = this, result = nil; + + + other = $$($nesting, 'Opal')['$coerce_to!'](other, $$($nesting, 'Hash'), "to_hash"); + + if (self.$$keys.length < other.$$keys.length) { + return false + } + ; + result = true; + $send(other, 'each', [], (TMP_7 = function(other_key, other_val){var self = TMP_7.$$s || this, val = nil; + + + + if (other_key == null) { + other_key = nil; + }; + + if (other_val == null) { + other_val = nil; + }; + val = self.$fetch(other_key, null); + + if (val == null || val !== other_val) { + result = false; + return; + } + ;}, TMP_7.$$s = self, TMP_7.$$arity = 2, TMP_7)); + return result; + }, TMP_Hash_$gt$eq_6.$$arity = 1); + + Opal.def(self, '$>', TMP_Hash_$gt_8 = function(other) { + var self = this; + + + other = $$($nesting, 'Opal')['$coerce_to!'](other, $$($nesting, 'Hash'), "to_hash"); + + if (self.$$keys.length <= other.$$keys.length) { + return false + } + ; + return $rb_ge(self, other); + }, TMP_Hash_$gt_8.$$arity = 1); + + Opal.def(self, '$<', TMP_Hash_$lt_9 = function(other) { + var self = this; + + + other = $$($nesting, 'Opal')['$coerce_to!'](other, $$($nesting, 'Hash'), "to_hash"); + return $rb_gt(other, self); + }, TMP_Hash_$lt_9.$$arity = 1); + + Opal.def(self, '$<=', TMP_Hash_$lt$eq_10 = function(other) { + var self = this; + + + other = $$($nesting, 'Opal')['$coerce_to!'](other, $$($nesting, 'Hash'), "to_hash"); + return $rb_ge(other, self); + }, TMP_Hash_$lt$eq_10.$$arity = 1); + + Opal.def(self, '$[]', TMP_Hash_$$_11 = function(key) { + var self = this; + + + var value = Opal.hash_get(self, key); + + if (value !== undefined) { + return value; + } + + return self.$default(key); + + }, TMP_Hash_$$_11.$$arity = 1); + + Opal.def(self, '$[]=', TMP_Hash_$$$eq_12 = function(key, value) { + var self = this; + + + Opal.hash_put(self, key, value); + return value; + + }, TMP_Hash_$$$eq_12.$$arity = 2); + + Opal.def(self, '$assoc', TMP_Hash_assoc_13 = function $$assoc(object) { + var self = this; + + + for (var i = 0, keys = self.$$keys, length = keys.length, key; i < length; i++) { + key = keys[i]; + + if (key.$$is_string) { + if ((key)['$=='](object)) { + return [key, self.$$smap[key]]; + } + } else { + if ((key.key)['$=='](object)) { + return [key.key, key.value]; + } + } + } + + return nil; + + }, TMP_Hash_assoc_13.$$arity = 1); + + Opal.def(self, '$clear', TMP_Hash_clear_14 = function $$clear() { + var self = this; + + + Opal.hash_init(self); + return self; + + }, TMP_Hash_clear_14.$$arity = 0); + + Opal.def(self, '$clone', TMP_Hash_clone_15 = function $$clone() { + var self = this; + + + var hash = new self.$$class(); + + Opal.hash_init(hash); + Opal.hash_clone(self, hash); + + return hash; + + }, TMP_Hash_clone_15.$$arity = 0); + + Opal.def(self, '$compact', TMP_Hash_compact_16 = function $$compact() { + var self = this; + + + var hash = Opal.hash(); + + for (var i = 0, keys = self.$$keys, length = keys.length, key, value, obj; i < length; i++) { + key = keys[i]; + + if (key.$$is_string) { + value = self.$$smap[key]; + } else { + value = key.value; + key = key.key; + } + + if (value !== nil) { + Opal.hash_put(hash, key, value); + } + } + + return hash; + + }, TMP_Hash_compact_16.$$arity = 0); + + Opal.def(self, '$compact!', TMP_Hash_compact$B_17 = function() { + var self = this; + + + var changes_were_made = false; + + for (var i = 0, keys = self.$$keys, length = keys.length, key, value, obj; i < length; i++) { + key = keys[i]; + + if (key.$$is_string) { + value = self.$$smap[key]; + } else { + value = key.value; + key = key.key; + } + + if (value === nil) { + if (Opal.hash_delete(self, key) !== undefined) { + changes_were_made = true; + length--; + i--; + } + } + } + + return changes_were_made ? self : nil; + + }, TMP_Hash_compact$B_17.$$arity = 0); + + Opal.def(self, '$compare_by_identity', TMP_Hash_compare_by_identity_18 = function $$compare_by_identity() { + var self = this; + + + var i, ii, key, keys = self.$$keys, identity_hash; + + if (self.$$by_identity) return self; + if (self.$$keys.length === 0) { + self.$$by_identity = true + return self; + } + + identity_hash = $hash2([], {}).$compare_by_identity(); + for(i = 0, ii = keys.length; i < ii; i++) { + key = keys[i]; + if (!key.$$is_string) key = key.key; + Opal.hash_put(identity_hash, key, Opal.hash_get(self, key)); + } + + self.$$by_identity = true; + self.$$map = identity_hash.$$map; + self.$$smap = identity_hash.$$smap; + return self; + + }, TMP_Hash_compare_by_identity_18.$$arity = 0); + + Opal.def(self, '$compare_by_identity?', TMP_Hash_compare_by_identity$q_19 = function() { + var self = this; + + return self.$$by_identity === true; + }, TMP_Hash_compare_by_identity$q_19.$$arity = 0); + + Opal.def(self, '$default', TMP_Hash_default_20 = function(key) { + var self = this; + + + ; + + if (key !== undefined && self.$$proc !== nil && self.$$proc !== undefined) { + return self.$$proc.$call(self, key); + } + if (self.$$none === undefined) { + return nil; + } + return self.$$none; + ; + }, TMP_Hash_default_20.$$arity = -1); + + Opal.def(self, '$default=', TMP_Hash_default$eq_21 = function(object) { + var self = this; + + + self.$$proc = nil; + self.$$none = object; + + return object; + + }, TMP_Hash_default$eq_21.$$arity = 1); + + Opal.def(self, '$default_proc', TMP_Hash_default_proc_22 = function $$default_proc() { + var self = this; + + + if (self.$$proc !== undefined) { + return self.$$proc; + } + return nil; + + }, TMP_Hash_default_proc_22.$$arity = 0); + + Opal.def(self, '$default_proc=', TMP_Hash_default_proc$eq_23 = function(default_proc) { + var self = this; + + + var proc = default_proc; + + if (proc !== nil) { + proc = $$($nesting, 'Opal')['$coerce_to!'](proc, $$($nesting, 'Proc'), "to_proc"); + + if ((proc)['$lambda?']() && (proc).$arity().$abs() !== 2) { + self.$raise($$($nesting, 'TypeError'), "default_proc takes two arguments"); + } + } + + self.$$none = nil; + self.$$proc = proc; + + return default_proc; + + }, TMP_Hash_default_proc$eq_23.$$arity = 1); + + Opal.def(self, '$delete', TMP_Hash_delete_24 = function(key) { + var $iter = TMP_Hash_delete_24.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Hash_delete_24.$$p = null; + + + if ($iter) TMP_Hash_delete_24.$$p = null;; + + var value = Opal.hash_delete(self, key); + + if (value !== undefined) { + return value; + } + + if (block !== nil) { + return Opal.yield1(block, key); + } + + return nil; + ; + }, TMP_Hash_delete_24.$$arity = 1); + + Opal.def(self, '$delete_if', TMP_Hash_delete_if_25 = function $$delete_if() { + var $iter = TMP_Hash_delete_if_25.$$p, block = $iter || nil, TMP_26, self = this; + + if ($iter) TMP_Hash_delete_if_25.$$p = null; + + + if ($iter) TMP_Hash_delete_if_25.$$p = null;; + if ($truthy(block)) { + } else { + return $send(self, 'enum_for', ["delete_if"], (TMP_26 = function(){var self = TMP_26.$$s || this; + + return self.$size()}, TMP_26.$$s = self, TMP_26.$$arity = 0, TMP_26)) + }; + + for (var i = 0, keys = self.$$keys, length = keys.length, key, value, obj; i < length; i++) { + key = keys[i]; + + if (key.$$is_string) { + value = self.$$smap[key]; + } else { + value = key.value; + key = key.key; + } + + obj = block(key, value); + + if (obj !== false && obj !== nil) { + if (Opal.hash_delete(self, key) !== undefined) { + length--; + i--; + } + } + } + + return self; + ; + }, TMP_Hash_delete_if_25.$$arity = 0); + Opal.alias(self, "dup", "clone"); + + Opal.def(self, '$dig', TMP_Hash_dig_27 = function $$dig(key, $a) { + var $post_args, keys, self = this, item = nil; + + + + $post_args = Opal.slice.call(arguments, 1, arguments.length); + + keys = $post_args;; + item = self['$[]'](key); + + if (item === nil || keys.length === 0) { + return item; + } + ; + if ($truthy(item['$respond_to?']("dig"))) { + } else { + self.$raise($$($nesting, 'TypeError'), "" + (item.$class()) + " does not have #dig method") + }; + return $send(item, 'dig', Opal.to_a(keys)); + }, TMP_Hash_dig_27.$$arity = -2); + + Opal.def(self, '$each', TMP_Hash_each_28 = function $$each() { + var $iter = TMP_Hash_each_28.$$p, block = $iter || nil, TMP_29, self = this; + + if ($iter) TMP_Hash_each_28.$$p = null; + + + if ($iter) TMP_Hash_each_28.$$p = null;; + if ($truthy(block)) { + } else { + return $send(self, 'enum_for', ["each"], (TMP_29 = function(){var self = TMP_29.$$s || this; + + return self.$size()}, TMP_29.$$s = self, TMP_29.$$arity = 0, TMP_29)) + }; + + for (var i = 0, keys = self.$$keys, length = keys.length, key, value; i < length; i++) { + key = keys[i]; + + if (key.$$is_string) { + value = self.$$smap[key]; + } else { + value = key.value; + key = key.key; + } + + Opal.yield1(block, [key, value]); + } + + return self; + ; + }, TMP_Hash_each_28.$$arity = 0); + + Opal.def(self, '$each_key', TMP_Hash_each_key_30 = function $$each_key() { + var $iter = TMP_Hash_each_key_30.$$p, block = $iter || nil, TMP_31, self = this; + + if ($iter) TMP_Hash_each_key_30.$$p = null; + + + if ($iter) TMP_Hash_each_key_30.$$p = null;; + if ($truthy(block)) { + } else { + return $send(self, 'enum_for', ["each_key"], (TMP_31 = function(){var self = TMP_31.$$s || this; + + return self.$size()}, TMP_31.$$s = self, TMP_31.$$arity = 0, TMP_31)) + }; + + for (var i = 0, keys = self.$$keys, length = keys.length, key; i < length; i++) { + key = keys[i]; + + block(key.$$is_string ? key : key.key); + } + + return self; + ; + }, TMP_Hash_each_key_30.$$arity = 0); + Opal.alias(self, "each_pair", "each"); + + Opal.def(self, '$each_value', TMP_Hash_each_value_32 = function $$each_value() { + var $iter = TMP_Hash_each_value_32.$$p, block = $iter || nil, TMP_33, self = this; + + if ($iter) TMP_Hash_each_value_32.$$p = null; + + + if ($iter) TMP_Hash_each_value_32.$$p = null;; + if ($truthy(block)) { + } else { + return $send(self, 'enum_for', ["each_value"], (TMP_33 = function(){var self = TMP_33.$$s || this; + + return self.$size()}, TMP_33.$$s = self, TMP_33.$$arity = 0, TMP_33)) + }; + + for (var i = 0, keys = self.$$keys, length = keys.length, key; i < length; i++) { + key = keys[i]; + + block(key.$$is_string ? self.$$smap[key] : key.value); + } + + return self; + ; + }, TMP_Hash_each_value_32.$$arity = 0); + + Opal.def(self, '$empty?', TMP_Hash_empty$q_34 = function() { + var self = this; + + return self.$$keys.length === 0; + }, TMP_Hash_empty$q_34.$$arity = 0); + Opal.alias(self, "eql?", "=="); + + Opal.def(self, '$fetch', TMP_Hash_fetch_35 = function $$fetch(key, defaults) { + var $iter = TMP_Hash_fetch_35.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Hash_fetch_35.$$p = null; + + + if ($iter) TMP_Hash_fetch_35.$$p = null;; + ; + + var value = Opal.hash_get(self, key); + + if (value !== undefined) { + return value; + } + + if (block !== nil) { + return block(key); + } + + if (defaults !== undefined) { + return defaults; + } + ; + return self.$raise($$($nesting, 'KeyError').$new("" + "key not found: " + (key.$inspect()), $hash2(["key", "receiver"], {"key": key, "receiver": self}))); + }, TMP_Hash_fetch_35.$$arity = -2); + + Opal.def(self, '$fetch_values', TMP_Hash_fetch_values_36 = function $$fetch_values($a) { + var $iter = TMP_Hash_fetch_values_36.$$p, block = $iter || nil, $post_args, keys, TMP_37, self = this; + + if ($iter) TMP_Hash_fetch_values_36.$$p = null; + + + if ($iter) TMP_Hash_fetch_values_36.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + keys = $post_args;; + return $send(keys, 'map', [], (TMP_37 = function(key){var self = TMP_37.$$s || this; + + + + if (key == null) { + key = nil; + }; + return $send(self, 'fetch', [key], block.$to_proc());}, TMP_37.$$s = self, TMP_37.$$arity = 1, TMP_37)); + }, TMP_Hash_fetch_values_36.$$arity = -1); + + Opal.def(self, '$flatten', TMP_Hash_flatten_38 = function $$flatten(level) { + var self = this; + + + + if (level == null) { + level = 1; + }; + level = $$($nesting, 'Opal')['$coerce_to!'](level, $$($nesting, 'Integer'), "to_int"); + + var result = []; + + for (var i = 0, keys = self.$$keys, length = keys.length, key, value; i < length; i++) { + key = keys[i]; + + if (key.$$is_string) { + value = self.$$smap[key]; + } else { + value = key.value; + key = key.key; + } + + result.push(key); + + if (value.$$is_array) { + if (level === 1) { + result.push(value); + continue; + } + + result = result.concat((value).$flatten(level - 2)); + continue; + } + + result.push(value); + } + + return result; + ; + }, TMP_Hash_flatten_38.$$arity = -1); + + Opal.def(self, '$has_key?', TMP_Hash_has_key$q_39 = function(key) { + var self = this; + + return Opal.hash_get(self, key) !== undefined; + }, TMP_Hash_has_key$q_39.$$arity = 1); + + Opal.def(self, '$has_value?', TMP_Hash_has_value$q_40 = function(value) { + var self = this; + + + for (var i = 0, keys = self.$$keys, length = keys.length, key; i < length; i++) { + key = keys[i]; + + if (((key.$$is_string ? self.$$smap[key] : key.value))['$=='](value)) { + return true; + } + } + + return false; + + }, TMP_Hash_has_value$q_40.$$arity = 1); + + Opal.def(self, '$hash', TMP_Hash_hash_41 = function $$hash() { + var self = this; + + + var top = (Opal.hash_ids === undefined), + hash_id = self.$object_id(), + result = ['Hash'], + key, item; + + try { + if (top) { + Opal.hash_ids = Object.create(null); + } + + if (Opal[hash_id]) { + return 'self'; + } + + for (key in Opal.hash_ids) { + item = Opal.hash_ids[key]; + if (self['$eql?'](item)) { + return 'self'; + } + } + + Opal.hash_ids[hash_id] = self; + + for (var i = 0, keys = self.$$keys, length = keys.length; i < length; i++) { + key = keys[i]; + + if (key.$$is_string) { + result.push([key, self.$$smap[key].$hash()]); + } else { + result.push([key.key_hash, key.value.$hash()]); + } + } + + return result.sort().join(); + + } finally { + if (top) { + Opal.hash_ids = undefined; + } + } + + }, TMP_Hash_hash_41.$$arity = 0); + Opal.alias(self, "include?", "has_key?"); + + Opal.def(self, '$index', TMP_Hash_index_42 = function $$index(object) { + var self = this; + + + for (var i = 0, keys = self.$$keys, length = keys.length, key, value; i < length; i++) { + key = keys[i]; + + if (key.$$is_string) { + value = self.$$smap[key]; + } else { + value = key.value; + key = key.key; + } + + if ((value)['$=='](object)) { + return key; + } + } + + return nil; + + }, TMP_Hash_index_42.$$arity = 1); + + Opal.def(self, '$indexes', TMP_Hash_indexes_43 = function $$indexes($a) { + var $post_args, args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + + var result = []; + + for (var i = 0, length = args.length, key, value; i < length; i++) { + key = args[i]; + value = Opal.hash_get(self, key); + + if (value === undefined) { + result.push(self.$default()); + continue; + } + + result.push(value); + } + + return result; + ; + }, TMP_Hash_indexes_43.$$arity = -1); + Opal.alias(self, "indices", "indexes"); + var inspect_ids; + + Opal.def(self, '$inspect', TMP_Hash_inspect_44 = function $$inspect() { + var self = this; + + + var top = (inspect_ids === undefined), + hash_id = self.$object_id(), + result = []; + + try { + if (top) { + inspect_ids = {}; + } + + if (inspect_ids.hasOwnProperty(hash_id)) { + return '{...}'; + } + + inspect_ids[hash_id] = true; + + for (var i = 0, keys = self.$$keys, length = keys.length, key, value; i < length; i++) { + key = keys[i]; + + if (key.$$is_string) { + value = self.$$smap[key]; + } else { + value = key.value; + key = key.key; + } + + result.push(key.$inspect() + '=>' + value.$inspect()); + } + + return '{' + result.join(', ') + '}'; + + } finally { + if (top) { + inspect_ids = undefined; + } + } + + }, TMP_Hash_inspect_44.$$arity = 0); + + Opal.def(self, '$invert', TMP_Hash_invert_45 = function $$invert() { + var self = this; + + + var hash = Opal.hash(); + + for (var i = 0, keys = self.$$keys, length = keys.length, key, value; i < length; i++) { + key = keys[i]; + + if (key.$$is_string) { + value = self.$$smap[key]; + } else { + value = key.value; + key = key.key; + } + + Opal.hash_put(hash, value, key); + } + + return hash; + + }, TMP_Hash_invert_45.$$arity = 0); + + Opal.def(self, '$keep_if', TMP_Hash_keep_if_46 = function $$keep_if() { + var $iter = TMP_Hash_keep_if_46.$$p, block = $iter || nil, TMP_47, self = this; + + if ($iter) TMP_Hash_keep_if_46.$$p = null; + + + if ($iter) TMP_Hash_keep_if_46.$$p = null;; + if ($truthy(block)) { + } else { + return $send(self, 'enum_for', ["keep_if"], (TMP_47 = function(){var self = TMP_47.$$s || this; + + return self.$size()}, TMP_47.$$s = self, TMP_47.$$arity = 0, TMP_47)) + }; + + for (var i = 0, keys = self.$$keys, length = keys.length, key, value, obj; i < length; i++) { + key = keys[i]; + + if (key.$$is_string) { + value = self.$$smap[key]; + } else { + value = key.value; + key = key.key; + } + + obj = block(key, value); + + if (obj === false || obj === nil) { + if (Opal.hash_delete(self, key) !== undefined) { + length--; + i--; + } + } + } + + return self; + ; + }, TMP_Hash_keep_if_46.$$arity = 0); + Opal.alias(self, "key", "index"); + Opal.alias(self, "key?", "has_key?"); + + Opal.def(self, '$keys', TMP_Hash_keys_48 = function $$keys() { + var self = this; + + + var result = []; + + for (var i = 0, keys = self.$$keys, length = keys.length, key; i < length; i++) { + key = keys[i]; + + if (key.$$is_string) { + result.push(key); + } else { + result.push(key.key); + } + } + + return result; + + }, TMP_Hash_keys_48.$$arity = 0); + + Opal.def(self, '$length', TMP_Hash_length_49 = function $$length() { + var self = this; + + return self.$$keys.length; + }, TMP_Hash_length_49.$$arity = 0); + Opal.alias(self, "member?", "has_key?"); + + Opal.def(self, '$merge', TMP_Hash_merge_50 = function $$merge(other) { + var $iter = TMP_Hash_merge_50.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Hash_merge_50.$$p = null; + + + if ($iter) TMP_Hash_merge_50.$$p = null;; + return $send(self.$dup(), 'merge!', [other], block.$to_proc()); + }, TMP_Hash_merge_50.$$arity = 1); + + Opal.def(self, '$merge!', TMP_Hash_merge$B_51 = function(other) { + var $iter = TMP_Hash_merge$B_51.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Hash_merge$B_51.$$p = null; + + + if ($iter) TMP_Hash_merge$B_51.$$p = null;; + + if (!other.$$is_hash) { + other = $$($nesting, 'Opal')['$coerce_to!'](other, $$($nesting, 'Hash'), "to_hash"); + } + + var i, other_keys = other.$$keys, length = other_keys.length, key, value, other_value; + + if (block === nil) { + for (i = 0; i < length; i++) { + key = other_keys[i]; + + if (key.$$is_string) { + other_value = other.$$smap[key]; + } else { + other_value = key.value; + key = key.key; + } + + Opal.hash_put(self, key, other_value); + } + + return self; + } + + for (i = 0; i < length; i++) { + key = other_keys[i]; + + if (key.$$is_string) { + other_value = other.$$smap[key]; + } else { + other_value = key.value; + key = key.key; + } + + value = Opal.hash_get(self, key); + + if (value === undefined) { + Opal.hash_put(self, key, other_value); + continue; + } + + Opal.hash_put(self, key, block(key, value, other_value)); + } + + return self; + ; + }, TMP_Hash_merge$B_51.$$arity = 1); + + Opal.def(self, '$rassoc', TMP_Hash_rassoc_52 = function $$rassoc(object) { + var self = this; + + + for (var i = 0, keys = self.$$keys, length = keys.length, key, value; i < length; i++) { + key = keys[i]; + + if (key.$$is_string) { + value = self.$$smap[key]; + } else { + value = key.value; + key = key.key; + } + + if ((value)['$=='](object)) { + return [key, value]; + } + } + + return nil; + + }, TMP_Hash_rassoc_52.$$arity = 1); + + Opal.def(self, '$rehash', TMP_Hash_rehash_53 = function $$rehash() { + var self = this; + + + Opal.hash_rehash(self); + return self; + + }, TMP_Hash_rehash_53.$$arity = 0); + + Opal.def(self, '$reject', TMP_Hash_reject_54 = function $$reject() { + var $iter = TMP_Hash_reject_54.$$p, block = $iter || nil, TMP_55, self = this; + + if ($iter) TMP_Hash_reject_54.$$p = null; + + + if ($iter) TMP_Hash_reject_54.$$p = null;; + if ($truthy(block)) { + } else { + return $send(self, 'enum_for', ["reject"], (TMP_55 = function(){var self = TMP_55.$$s || this; + + return self.$size()}, TMP_55.$$s = self, TMP_55.$$arity = 0, TMP_55)) + }; + + var hash = Opal.hash(); + + for (var i = 0, keys = self.$$keys, length = keys.length, key, value, obj; i < length; i++) { + key = keys[i]; + + if (key.$$is_string) { + value = self.$$smap[key]; + } else { + value = key.value; + key = key.key; + } + + obj = block(key, value); + + if (obj === false || obj === nil) { + Opal.hash_put(hash, key, value); + } + } + + return hash; + ; + }, TMP_Hash_reject_54.$$arity = 0); + + Opal.def(self, '$reject!', TMP_Hash_reject$B_56 = function() { + var $iter = TMP_Hash_reject$B_56.$$p, block = $iter || nil, TMP_57, self = this; + + if ($iter) TMP_Hash_reject$B_56.$$p = null; + + + if ($iter) TMP_Hash_reject$B_56.$$p = null;; + if ($truthy(block)) { + } else { + return $send(self, 'enum_for', ["reject!"], (TMP_57 = function(){var self = TMP_57.$$s || this; + + return self.$size()}, TMP_57.$$s = self, TMP_57.$$arity = 0, TMP_57)) + }; + + var changes_were_made = false; + + for (var i = 0, keys = self.$$keys, length = keys.length, key, value, obj; i < length; i++) { + key = keys[i]; + + if (key.$$is_string) { + value = self.$$smap[key]; + } else { + value = key.value; + key = key.key; + } + + obj = block(key, value); + + if (obj !== false && obj !== nil) { + if (Opal.hash_delete(self, key) !== undefined) { + changes_were_made = true; + length--; + i--; + } + } + } + + return changes_were_made ? self : nil; + ; + }, TMP_Hash_reject$B_56.$$arity = 0); + + Opal.def(self, '$replace', TMP_Hash_replace_58 = function $$replace(other) { + var self = this, $writer = nil; + + + other = $$($nesting, 'Opal')['$coerce_to!'](other, $$($nesting, 'Hash'), "to_hash"); + + Opal.hash_init(self); + + for (var i = 0, other_keys = other.$$keys, length = other_keys.length, key, value, other_value; i < length; i++) { + key = other_keys[i]; + + if (key.$$is_string) { + other_value = other.$$smap[key]; + } else { + other_value = key.value; + key = key.key; + } + + Opal.hash_put(self, key, other_value); + } + ; + if ($truthy(other.$default_proc())) { + + $writer = [other.$default_proc()]; + $send(self, 'default_proc=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + } else { + + $writer = [other.$default()]; + $send(self, 'default=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + return self; + }, TMP_Hash_replace_58.$$arity = 1); + + Opal.def(self, '$select', TMP_Hash_select_59 = function $$select() { + var $iter = TMP_Hash_select_59.$$p, block = $iter || nil, TMP_60, self = this; + + if ($iter) TMP_Hash_select_59.$$p = null; + + + if ($iter) TMP_Hash_select_59.$$p = null;; + if ($truthy(block)) { + } else { + return $send(self, 'enum_for', ["select"], (TMP_60 = function(){var self = TMP_60.$$s || this; + + return self.$size()}, TMP_60.$$s = self, TMP_60.$$arity = 0, TMP_60)) + }; + + var hash = Opal.hash(); + + for (var i = 0, keys = self.$$keys, length = keys.length, key, value, obj; i < length; i++) { + key = keys[i]; + + if (key.$$is_string) { + value = self.$$smap[key]; + } else { + value = key.value; + key = key.key; + } + + obj = block(key, value); + + if (obj !== false && obj !== nil) { + Opal.hash_put(hash, key, value); + } + } + + return hash; + ; + }, TMP_Hash_select_59.$$arity = 0); + + Opal.def(self, '$select!', TMP_Hash_select$B_61 = function() { + var $iter = TMP_Hash_select$B_61.$$p, block = $iter || nil, TMP_62, self = this; + + if ($iter) TMP_Hash_select$B_61.$$p = null; + + + if ($iter) TMP_Hash_select$B_61.$$p = null;; + if ($truthy(block)) { + } else { + return $send(self, 'enum_for', ["select!"], (TMP_62 = function(){var self = TMP_62.$$s || this; + + return self.$size()}, TMP_62.$$s = self, TMP_62.$$arity = 0, TMP_62)) + }; + + var result = nil; + + for (var i = 0, keys = self.$$keys, length = keys.length, key, value, obj; i < length; i++) { + key = keys[i]; + + if (key.$$is_string) { + value = self.$$smap[key]; + } else { + value = key.value; + key = key.key; + } + + obj = block(key, value); + + if (obj === false || obj === nil) { + if (Opal.hash_delete(self, key) !== undefined) { + length--; + i--; + } + result = self; + } + } + + return result; + ; + }, TMP_Hash_select$B_61.$$arity = 0); + + Opal.def(self, '$shift', TMP_Hash_shift_63 = function $$shift() { + var self = this; + + + var keys = self.$$keys, + key; + + if (keys.length > 0) { + key = keys[0]; + + key = key.$$is_string ? key : key.key; + + return [key, Opal.hash_delete(self, key)]; + } + + return self.$default(nil); + + }, TMP_Hash_shift_63.$$arity = 0); + Opal.alias(self, "size", "length"); + + Opal.def(self, '$slice', TMP_Hash_slice_64 = function $$slice($a) { + var $post_args, keys, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + keys = $post_args;; + + var result = Opal.hash(); + + for (var i = 0, length = keys.length; i < length; i++) { + var key = keys[i], value = Opal.hash_get(self, key); + + if (value !== undefined) { + Opal.hash_put(result, key, value); + } + } + + return result; + ; + }, TMP_Hash_slice_64.$$arity = -1); + Opal.alias(self, "store", "[]="); + + Opal.def(self, '$to_a', TMP_Hash_to_a_65 = function $$to_a() { + var self = this; + + + var result = []; + + for (var i = 0, keys = self.$$keys, length = keys.length, key, value; i < length; i++) { + key = keys[i]; + + if (key.$$is_string) { + value = self.$$smap[key]; + } else { + value = key.value; + key = key.key; + } + + result.push([key, value]); + } + + return result; + + }, TMP_Hash_to_a_65.$$arity = 0); + + Opal.def(self, '$to_h', TMP_Hash_to_h_66 = function $$to_h() { + var self = this; + + + if (self.$$class === Opal.Hash) { + return self; + } + + var hash = new Opal.Hash(); + + Opal.hash_init(hash); + Opal.hash_clone(self, hash); + + return hash; + + }, TMP_Hash_to_h_66.$$arity = 0); + + Opal.def(self, '$to_hash', TMP_Hash_to_hash_67 = function $$to_hash() { + var self = this; + + return self + }, TMP_Hash_to_hash_67.$$arity = 0); + + Opal.def(self, '$to_proc', TMP_Hash_to_proc_68 = function $$to_proc() { + var TMP_69, self = this; + + return $send(self, 'proc', [], (TMP_69 = function(key){var self = TMP_69.$$s || this; + + + ; + + if (key == null) { + self.$raise($$($nesting, 'ArgumentError'), "no key given") + } + ; + return self['$[]'](key);}, TMP_69.$$s = self, TMP_69.$$arity = -1, TMP_69)) + }, TMP_Hash_to_proc_68.$$arity = 0); + Opal.alias(self, "to_s", "inspect"); + + Opal.def(self, '$transform_keys', TMP_Hash_transform_keys_70 = function $$transform_keys() { + var $iter = TMP_Hash_transform_keys_70.$$p, block = $iter || nil, TMP_71, self = this; + + if ($iter) TMP_Hash_transform_keys_70.$$p = null; + + + if ($iter) TMP_Hash_transform_keys_70.$$p = null;; + if ($truthy(block)) { + } else { + return $send(self, 'enum_for', ["transform_keys"], (TMP_71 = function(){var self = TMP_71.$$s || this; + + return self.$size()}, TMP_71.$$s = self, TMP_71.$$arity = 0, TMP_71)) + }; + + var result = Opal.hash(); + + for (var i = 0, keys = self.$$keys, length = keys.length, key, value; i < length; i++) { + key = keys[i]; + + if (key.$$is_string) { + value = self.$$smap[key]; + } else { + value = key.value; + key = key.key; + } + + key = Opal.yield1(block, key); + + Opal.hash_put(result, key, value); + } + + return result; + ; + }, TMP_Hash_transform_keys_70.$$arity = 0); + + Opal.def(self, '$transform_keys!', TMP_Hash_transform_keys$B_72 = function() { + var $iter = TMP_Hash_transform_keys$B_72.$$p, block = $iter || nil, TMP_73, self = this; + + if ($iter) TMP_Hash_transform_keys$B_72.$$p = null; + + + if ($iter) TMP_Hash_transform_keys$B_72.$$p = null;; + if ($truthy(block)) { + } else { + return $send(self, 'enum_for', ["transform_keys!"], (TMP_73 = function(){var self = TMP_73.$$s || this; + + return self.$size()}, TMP_73.$$s = self, TMP_73.$$arity = 0, TMP_73)) + }; + + var keys = Opal.slice.call(self.$$keys), + i, length = keys.length, key, value, new_key; + + for (i = 0; i < length; i++) { + key = keys[i]; + + if (key.$$is_string) { + value = self.$$smap[key]; + } else { + value = key.value; + key = key.key; + } + + new_key = Opal.yield1(block, key); + + Opal.hash_delete(self, key); + Opal.hash_put(self, new_key, value); + } + + return self; + ; + }, TMP_Hash_transform_keys$B_72.$$arity = 0); + + Opal.def(self, '$transform_values', TMP_Hash_transform_values_74 = function $$transform_values() { + var $iter = TMP_Hash_transform_values_74.$$p, block = $iter || nil, TMP_75, self = this; + + if ($iter) TMP_Hash_transform_values_74.$$p = null; + + + if ($iter) TMP_Hash_transform_values_74.$$p = null;; + if ($truthy(block)) { + } else { + return $send(self, 'enum_for', ["transform_values"], (TMP_75 = function(){var self = TMP_75.$$s || this; + + return self.$size()}, TMP_75.$$s = self, TMP_75.$$arity = 0, TMP_75)) + }; + + var result = Opal.hash(); + + for (var i = 0, keys = self.$$keys, length = keys.length, key, value; i < length; i++) { + key = keys[i]; + + if (key.$$is_string) { + value = self.$$smap[key]; + } else { + value = key.value; + key = key.key; + } + + value = Opal.yield1(block, value); + + Opal.hash_put(result, key, value); + } + + return result; + ; + }, TMP_Hash_transform_values_74.$$arity = 0); + + Opal.def(self, '$transform_values!', TMP_Hash_transform_values$B_76 = function() { + var $iter = TMP_Hash_transform_values$B_76.$$p, block = $iter || nil, TMP_77, self = this; + + if ($iter) TMP_Hash_transform_values$B_76.$$p = null; + + + if ($iter) TMP_Hash_transform_values$B_76.$$p = null;; + if ($truthy(block)) { + } else { + return $send(self, 'enum_for', ["transform_values!"], (TMP_77 = function(){var self = TMP_77.$$s || this; + + return self.$size()}, TMP_77.$$s = self, TMP_77.$$arity = 0, TMP_77)) + }; + + for (var i = 0, keys = self.$$keys, length = keys.length, key, value; i < length; i++) { + key = keys[i]; + + if (key.$$is_string) { + value = self.$$smap[key]; + } else { + value = key.value; + key = key.key; + } + + value = Opal.yield1(block, value); + + Opal.hash_put(self, key, value); + } + + return self; + ; + }, TMP_Hash_transform_values$B_76.$$arity = 0); + Opal.alias(self, "update", "merge!"); + Opal.alias(self, "value?", "has_value?"); + Opal.alias(self, "values_at", "indexes"); + return (Opal.def(self, '$values', TMP_Hash_values_78 = function $$values() { + var self = this; + + + var result = []; + + for (var i = 0, keys = self.$$keys, length = keys.length, key; i < length; i++) { + key = keys[i]; + + if (key.$$is_string) { + result.push(self.$$smap[key]); + } else { + result.push(key.value); + } + } + + return result; + + }, TMP_Hash_values_78.$$arity = 0), nil) && 'values'; + })($nesting[0], null, $nesting); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/number"] = function(Opal) { + function $rb_gt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); + } + function $rb_lt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); + } + function $rb_plus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); + } + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + function $rb_divide(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs / rhs : lhs['$/'](rhs); + } + function $rb_times(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs * rhs : lhs['$*'](rhs); + } + function $rb_le(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs <= rhs : lhs['$<='](rhs); + } + function $rb_ge(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs >= rhs : lhs['$>='](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $truthy = Opal.truthy, $send = Opal.send, $hash2 = Opal.hash2; + + Opal.add_stubs(['$require', '$bridge', '$raise', '$name', '$class', '$Float', '$respond_to?', '$coerce_to!', '$__coerced__', '$===', '$!', '$>', '$**', '$new', '$<', '$to_f', '$==', '$nan?', '$infinite?', '$enum_for', '$+', '$-', '$gcd', '$lcm', '$%', '$/', '$frexp', '$to_i', '$ldexp', '$rationalize', '$*', '$<<', '$to_r', '$truncate', '$-@', '$size', '$<=', '$>=', '$<=>', '$compare', '$any?']); + + self.$require("corelib/numeric"); + (function($base, $super, $parent_nesting) { + function $Number(){}; + var self = $Number = $klass($base, $super, 'Number', $Number); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Number_coerce_2, TMP_Number___id___3, TMP_Number_$_4, TMP_Number_$_5, TMP_Number_$_6, TMP_Number_$_7, TMP_Number_$_8, TMP_Number_$_9, TMP_Number_$_10, TMP_Number_$_11, TMP_Number_$lt_12, TMP_Number_$lt$eq_13, TMP_Number_$gt_14, TMP_Number_$gt$eq_15, TMP_Number_$lt$eq$gt_16, TMP_Number_$lt$lt_17, TMP_Number_$gt$gt_18, TMP_Number_$$_19, TMP_Number_$$_20, TMP_Number_$$_21, TMP_Number_$_22, TMP_Number_$$_23, TMP_Number_$eq$eq$eq_24, TMP_Number_$eq$eq_25, TMP_Number_abs_26, TMP_Number_abs2_27, TMP_Number_allbits$q_28, TMP_Number_anybits$q_29, TMP_Number_angle_30, TMP_Number_bit_length_31, TMP_Number_ceil_32, TMP_Number_chr_33, TMP_Number_denominator_34, TMP_Number_downto_35, TMP_Number_equal$q_37, TMP_Number_even$q_38, TMP_Number_floor_39, TMP_Number_gcd_40, TMP_Number_gcdlcm_41, TMP_Number_integer$q_42, TMP_Number_is_a$q_43, TMP_Number_instance_of$q_44, TMP_Number_lcm_45, TMP_Number_next_46, TMP_Number_nobits$q_47, TMP_Number_nonzero$q_48, TMP_Number_numerator_49, TMP_Number_odd$q_50, TMP_Number_ord_51, TMP_Number_pow_52, TMP_Number_pred_53, TMP_Number_quo_54, TMP_Number_rationalize_55, TMP_Number_remainder_56, TMP_Number_round_57, TMP_Number_step_58, TMP_Number_times_60, TMP_Number_to_f_62, TMP_Number_to_i_63, TMP_Number_to_r_64, TMP_Number_to_s_65, TMP_Number_truncate_66, TMP_Number_digits_67, TMP_Number_divmod_68, TMP_Number_upto_69, TMP_Number_zero$q_71, TMP_Number_size_72, TMP_Number_nan$q_73, TMP_Number_finite$q_74, TMP_Number_infinite$q_75, TMP_Number_positive$q_76, TMP_Number_negative$q_77; + + + $$($nesting, 'Opal').$bridge(Number, self); + Opal.defineProperty(Number.prototype, '$$is_number', true); + self.$$is_number_class = true; + (function(self, $parent_nesting) { + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_allocate_1; + + + + Opal.def(self, '$allocate', TMP_allocate_1 = function $$allocate() { + var self = this; + + return self.$raise($$($nesting, 'TypeError'), "" + "allocator undefined for " + (self.$name())) + }, TMP_allocate_1.$$arity = 0); + + + Opal.udef(self, '$' + "new");; + return nil;; + })(Opal.get_singleton_class(self), $nesting); + + Opal.def(self, '$coerce', TMP_Number_coerce_2 = function $$coerce(other) { + var self = this; + + + if (other === nil) { + self.$raise($$($nesting, 'TypeError'), "" + "can't convert " + (other.$class()) + " into Float"); + } + else if (other.$$is_string) { + return [self.$Float(other), self]; + } + else if (other['$respond_to?']("to_f")) { + return [$$($nesting, 'Opal')['$coerce_to!'](other, $$($nesting, 'Float'), "to_f"), self]; + } + else if (other.$$is_number) { + return [other, self]; + } + else { + self.$raise($$($nesting, 'TypeError'), "" + "can't convert " + (other.$class()) + " into Float"); + } + + }, TMP_Number_coerce_2.$$arity = 1); + + Opal.def(self, '$__id__', TMP_Number___id___3 = function $$__id__() { + var self = this; + + return (self * 2) + 1; + }, TMP_Number___id___3.$$arity = 0); + Opal.alias(self, "object_id", "__id__"); + + Opal.def(self, '$+', TMP_Number_$_4 = function(other) { + var self = this; + + + if (other.$$is_number) { + return self + other; + } + else { + return self.$__coerced__("+", other); + } + + }, TMP_Number_$_4.$$arity = 1); + + Opal.def(self, '$-', TMP_Number_$_5 = function(other) { + var self = this; + + + if (other.$$is_number) { + return self - other; + } + else { + return self.$__coerced__("-", other); + } + + }, TMP_Number_$_5.$$arity = 1); + + Opal.def(self, '$*', TMP_Number_$_6 = function(other) { + var self = this; + + + if (other.$$is_number) { + return self * other; + } + else { + return self.$__coerced__("*", other); + } + + }, TMP_Number_$_6.$$arity = 1); + + Opal.def(self, '$/', TMP_Number_$_7 = function(other) { + var self = this; + + + if (other.$$is_number) { + return self / other; + } + else { + return self.$__coerced__("/", other); + } + + }, TMP_Number_$_7.$$arity = 1); + Opal.alias(self, "fdiv", "/"); + + Opal.def(self, '$%', TMP_Number_$_8 = function(other) { + var self = this; + + + if (other.$$is_number) { + if (other == -Infinity) { + return other; + } + else if (other == 0) { + self.$raise($$($nesting, 'ZeroDivisionError'), "divided by 0"); + } + else if (other < 0 || self < 0) { + return (self % other + other) % other; + } + else { + return self % other; + } + } + else { + return self.$__coerced__("%", other); + } + + }, TMP_Number_$_8.$$arity = 1); + + Opal.def(self, '$&', TMP_Number_$_9 = function(other) { + var self = this; + + + if (other.$$is_number) { + return self & other; + } + else { + return self.$__coerced__("&", other); + } + + }, TMP_Number_$_9.$$arity = 1); + + Opal.def(self, '$|', TMP_Number_$_10 = function(other) { + var self = this; + + + if (other.$$is_number) { + return self | other; + } + else { + return self.$__coerced__("|", other); + } + + }, TMP_Number_$_10.$$arity = 1); + + Opal.def(self, '$^', TMP_Number_$_11 = function(other) { + var self = this; + + + if (other.$$is_number) { + return self ^ other; + } + else { + return self.$__coerced__("^", other); + } + + }, TMP_Number_$_11.$$arity = 1); + + Opal.def(self, '$<', TMP_Number_$lt_12 = function(other) { + var self = this; + + + if (other.$$is_number) { + return self < other; + } + else { + return self.$__coerced__("<", other); + } + + }, TMP_Number_$lt_12.$$arity = 1); + + Opal.def(self, '$<=', TMP_Number_$lt$eq_13 = function(other) { + var self = this; + + + if (other.$$is_number) { + return self <= other; + } + else { + return self.$__coerced__("<=", other); + } + + }, TMP_Number_$lt$eq_13.$$arity = 1); + + Opal.def(self, '$>', TMP_Number_$gt_14 = function(other) { + var self = this; + + + if (other.$$is_number) { + return self > other; + } + else { + return self.$__coerced__(">", other); + } + + }, TMP_Number_$gt_14.$$arity = 1); + + Opal.def(self, '$>=', TMP_Number_$gt$eq_15 = function(other) { + var self = this; + + + if (other.$$is_number) { + return self >= other; + } + else { + return self.$__coerced__(">=", other); + } + + }, TMP_Number_$gt$eq_15.$$arity = 1); + + var spaceship_operator = function(self, other) { + if (other.$$is_number) { + if (isNaN(self) || isNaN(other)) { + return nil; + } + + if (self > other) { + return 1; + } else if (self < other) { + return -1; + } else { + return 0; + } + } + else { + return self.$__coerced__("<=>", other); + } + } + ; + + Opal.def(self, '$<=>', TMP_Number_$lt$eq$gt_16 = function(other) { + var self = this; + + try { + return spaceship_operator(self, other); + } catch ($err) { + if (Opal.rescue($err, [$$($nesting, 'ArgumentError')])) { + try { + return nil + } finally { Opal.pop_exception() } + } else { throw $err; } + } + }, TMP_Number_$lt$eq$gt_16.$$arity = 1); + + Opal.def(self, '$<<', TMP_Number_$lt$lt_17 = function(count) { + var self = this; + + + count = $$($nesting, 'Opal')['$coerce_to!'](count, $$($nesting, 'Integer'), "to_int"); + return count > 0 ? self << count : self >> -count; + }, TMP_Number_$lt$lt_17.$$arity = 1); + + Opal.def(self, '$>>', TMP_Number_$gt$gt_18 = function(count) { + var self = this; + + + count = $$($nesting, 'Opal')['$coerce_to!'](count, $$($nesting, 'Integer'), "to_int"); + return count > 0 ? self >> count : self << -count; + }, TMP_Number_$gt$gt_18.$$arity = 1); + + Opal.def(self, '$[]', TMP_Number_$$_19 = function(bit) { + var self = this; + + + bit = $$($nesting, 'Opal')['$coerce_to!'](bit, $$($nesting, 'Integer'), "to_int"); + + if (bit < 0) { + return 0; + } + if (bit >= 32) { + return self < 0 ? 1 : 0; + } + return (self >> bit) & 1; + ; + }, TMP_Number_$$_19.$$arity = 1); + + Opal.def(self, '$+@', TMP_Number_$$_20 = function() { + var self = this; + + return +self; + }, TMP_Number_$$_20.$$arity = 0); + + Opal.def(self, '$-@', TMP_Number_$$_21 = function() { + var self = this; + + return -self; + }, TMP_Number_$$_21.$$arity = 0); + + Opal.def(self, '$~', TMP_Number_$_22 = function() { + var self = this; + + return ~self; + }, TMP_Number_$_22.$$arity = 0); + + Opal.def(self, '$**', TMP_Number_$$_23 = function(other) { + var $a, $b, self = this; + + if ($truthy($$($nesting, 'Integer')['$==='](other))) { + if ($truthy(($truthy($a = $$($nesting, 'Integer')['$==='](self)['$!']()) ? $a : $rb_gt(other, 0)))) { + return Math.pow(self, other); + } else { + return $$($nesting, 'Rational').$new(self, 1)['$**'](other) + } + } else if ($truthy((($a = $rb_lt(self, 0)) ? ($truthy($b = $$($nesting, 'Float')['$==='](other)) ? $b : $$($nesting, 'Rational')['$==='](other)) : $rb_lt(self, 0)))) { + return $$($nesting, 'Complex').$new(self, 0)['$**'](other.$to_f()) + } else if ($truthy(other.$$is_number != null)) { + return Math.pow(self, other); + } else { + return self.$__coerced__("**", other) + } + }, TMP_Number_$$_23.$$arity = 1); + + Opal.def(self, '$===', TMP_Number_$eq$eq$eq_24 = function(other) { + var self = this; + + + if (other.$$is_number) { + return self.valueOf() === other.valueOf(); + } + else if (other['$respond_to?']("==")) { + return other['$=='](self); + } + else { + return false; + } + + }, TMP_Number_$eq$eq$eq_24.$$arity = 1); + + Opal.def(self, '$==', TMP_Number_$eq$eq_25 = function(other) { + var self = this; + + + if (other.$$is_number) { + return self.valueOf() === other.valueOf(); + } + else if (other['$respond_to?']("==")) { + return other['$=='](self); + } + else { + return false; + } + + }, TMP_Number_$eq$eq_25.$$arity = 1); + + Opal.def(self, '$abs', TMP_Number_abs_26 = function $$abs() { + var self = this; + + return Math.abs(self); + }, TMP_Number_abs_26.$$arity = 0); + + Opal.def(self, '$abs2', TMP_Number_abs2_27 = function $$abs2() { + var self = this; + + return Math.abs(self * self); + }, TMP_Number_abs2_27.$$arity = 0); + + Opal.def(self, '$allbits?', TMP_Number_allbits$q_28 = function(mask) { + var self = this; + + + mask = $$($nesting, 'Opal')['$coerce_to!'](mask, $$($nesting, 'Integer'), "to_int"); + return (self & mask) == mask;; + }, TMP_Number_allbits$q_28.$$arity = 1); + + Opal.def(self, '$anybits?', TMP_Number_anybits$q_29 = function(mask) { + var self = this; + + + mask = $$($nesting, 'Opal')['$coerce_to!'](mask, $$($nesting, 'Integer'), "to_int"); + return (self & mask) !== 0;; + }, TMP_Number_anybits$q_29.$$arity = 1); + + Opal.def(self, '$angle', TMP_Number_angle_30 = function $$angle() { + var self = this; + + + if ($truthy(self['$nan?']())) { + return self}; + + if (self == 0) { + if (1 / self > 0) { + return 0; + } + else { + return Math.PI; + } + } + else if (self < 0) { + return Math.PI; + } + else { + return 0; + } + ; + }, TMP_Number_angle_30.$$arity = 0); + Opal.alias(self, "arg", "angle"); + Opal.alias(self, "phase", "angle"); + + Opal.def(self, '$bit_length', TMP_Number_bit_length_31 = function $$bit_length() { + var self = this; + + + if ($truthy($$($nesting, 'Integer')['$==='](self))) { + } else { + self.$raise($$($nesting, 'NoMethodError').$new("" + "undefined method `bit_length` for " + (self) + ":Float", "bit_length")) + }; + + if (self === 0 || self === -1) { + return 0; + } + + var result = 0, + value = self < 0 ? ~self : self; + + while (value != 0) { + result += 1; + value >>>= 1; + } + + return result; + ; + }, TMP_Number_bit_length_31.$$arity = 0); + + Opal.def(self, '$ceil', TMP_Number_ceil_32 = function $$ceil(ndigits) { + var self = this; + + + + if (ndigits == null) { + ndigits = 0; + }; + + var f = self.$to_f(); + + if (f % 1 === 0 && ndigits >= 0) { + return f; + } + + var factor = Math.pow(10, ndigits), + result = Math.ceil(f * factor) / factor; + + if (f % 1 === 0) { + result = Math.round(result); + } + + return result; + ; + }, TMP_Number_ceil_32.$$arity = -1); + + Opal.def(self, '$chr', TMP_Number_chr_33 = function $$chr(encoding) { + var self = this; + + + ; + return String.fromCharCode(self);; + }, TMP_Number_chr_33.$$arity = -1); + + Opal.def(self, '$denominator', TMP_Number_denominator_34 = function $$denominator() { + var $a, $iter = TMP_Number_denominator_34.$$p, $yield = $iter || nil, self = this, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_Number_denominator_34.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + if ($truthy(($truthy($a = self['$nan?']()) ? $a : self['$infinite?']()))) { + return 1 + } else { + return $send(self, Opal.find_super_dispatcher(self, 'denominator', TMP_Number_denominator_34, false), $zuper, $iter) + } + }, TMP_Number_denominator_34.$$arity = 0); + + Opal.def(self, '$downto', TMP_Number_downto_35 = function $$downto(stop) { + var $iter = TMP_Number_downto_35.$$p, block = $iter || nil, TMP_36, self = this; + + if ($iter) TMP_Number_downto_35.$$p = null; + + + if ($iter) TMP_Number_downto_35.$$p = null;; + if ((block !== nil)) { + } else { + return $send(self, 'enum_for', ["downto", stop], (TMP_36 = function(){var self = TMP_36.$$s || this; + + + if ($truthy($$($nesting, 'Numeric')['$==='](stop))) { + } else { + self.$raise($$($nesting, 'ArgumentError'), "" + "comparison of " + (self.$class()) + " with " + (stop.$class()) + " failed") + }; + if ($truthy($rb_gt(stop, self))) { + return 0 + } else { + return $rb_plus($rb_minus(self, stop), 1) + };}, TMP_36.$$s = self, TMP_36.$$arity = 0, TMP_36)) + }; + + if (!stop.$$is_number) { + self.$raise($$($nesting, 'ArgumentError'), "" + "comparison of " + (self.$class()) + " with " + (stop.$class()) + " failed") + } + for (var i = self; i >= stop; i--) { + block(i); + } + ; + return self; + }, TMP_Number_downto_35.$$arity = 1); + Opal.alias(self, "eql?", "=="); + + Opal.def(self, '$equal?', TMP_Number_equal$q_37 = function(other) { + var $a, self = this; + + return ($truthy($a = self['$=='](other)) ? $a : isNaN(self) && isNaN(other)) + }, TMP_Number_equal$q_37.$$arity = 1); + + Opal.def(self, '$even?', TMP_Number_even$q_38 = function() { + var self = this; + + return self % 2 === 0; + }, TMP_Number_even$q_38.$$arity = 0); + + Opal.def(self, '$floor', TMP_Number_floor_39 = function $$floor(ndigits) { + var self = this; + + + + if (ndigits == null) { + ndigits = 0; + }; + + var f = self.$to_f(); + + if (f % 1 === 0 && ndigits >= 0) { + return f; + } + + var factor = Math.pow(10, ndigits), + result = Math.floor(f * factor) / factor; + + if (f % 1 === 0) { + result = Math.round(result); + } + + return result; + ; + }, TMP_Number_floor_39.$$arity = -1); + + Opal.def(self, '$gcd', TMP_Number_gcd_40 = function $$gcd(other) { + var self = this; + + + if ($truthy($$($nesting, 'Integer')['$==='](other))) { + } else { + self.$raise($$($nesting, 'TypeError'), "not an integer") + }; + + var min = Math.abs(self), + max = Math.abs(other); + + while (min > 0) { + var tmp = min; + + min = max % min; + max = tmp; + } + + return max; + ; + }, TMP_Number_gcd_40.$$arity = 1); + + Opal.def(self, '$gcdlcm', TMP_Number_gcdlcm_41 = function $$gcdlcm(other) { + var self = this; + + return [self.$gcd(), self.$lcm()] + }, TMP_Number_gcdlcm_41.$$arity = 1); + + Opal.def(self, '$integer?', TMP_Number_integer$q_42 = function() { + var self = this; + + return self % 1 === 0; + }, TMP_Number_integer$q_42.$$arity = 0); + + Opal.def(self, '$is_a?', TMP_Number_is_a$q_43 = function(klass) { + var $a, $iter = TMP_Number_is_a$q_43.$$p, $yield = $iter || nil, self = this, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_Number_is_a$q_43.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + + if ($truthy((($a = klass['$==']($$($nesting, 'Integer'))) ? $$($nesting, 'Integer')['$==='](self) : klass['$==']($$($nesting, 'Integer'))))) { + return true}; + if ($truthy((($a = klass['$==']($$($nesting, 'Integer'))) ? $$($nesting, 'Integer')['$==='](self) : klass['$==']($$($nesting, 'Integer'))))) { + return true}; + if ($truthy((($a = klass['$==']($$($nesting, 'Float'))) ? $$($nesting, 'Float')['$==='](self) : klass['$==']($$($nesting, 'Float'))))) { + return true}; + return $send(self, Opal.find_super_dispatcher(self, 'is_a?', TMP_Number_is_a$q_43, false), $zuper, $iter); + }, TMP_Number_is_a$q_43.$$arity = 1); + Opal.alias(self, "kind_of?", "is_a?"); + + Opal.def(self, '$instance_of?', TMP_Number_instance_of$q_44 = function(klass) { + var $a, $iter = TMP_Number_instance_of$q_44.$$p, $yield = $iter || nil, self = this, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_Number_instance_of$q_44.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + + if ($truthy((($a = klass['$==']($$($nesting, 'Integer'))) ? $$($nesting, 'Integer')['$==='](self) : klass['$==']($$($nesting, 'Integer'))))) { + return true}; + if ($truthy((($a = klass['$==']($$($nesting, 'Integer'))) ? $$($nesting, 'Integer')['$==='](self) : klass['$==']($$($nesting, 'Integer'))))) { + return true}; + if ($truthy((($a = klass['$==']($$($nesting, 'Float'))) ? $$($nesting, 'Float')['$==='](self) : klass['$==']($$($nesting, 'Float'))))) { + return true}; + return $send(self, Opal.find_super_dispatcher(self, 'instance_of?', TMP_Number_instance_of$q_44, false), $zuper, $iter); + }, TMP_Number_instance_of$q_44.$$arity = 1); + + Opal.def(self, '$lcm', TMP_Number_lcm_45 = function $$lcm(other) { + var self = this; + + + if ($truthy($$($nesting, 'Integer')['$==='](other))) { + } else { + self.$raise($$($nesting, 'TypeError'), "not an integer") + }; + + if (self == 0 || other == 0) { + return 0; + } + else { + return Math.abs(self * other / self.$gcd(other)); + } + ; + }, TMP_Number_lcm_45.$$arity = 1); + Opal.alias(self, "magnitude", "abs"); + Opal.alias(self, "modulo", "%"); + + Opal.def(self, '$next', TMP_Number_next_46 = function $$next() { + var self = this; + + return self + 1; + }, TMP_Number_next_46.$$arity = 0); + + Opal.def(self, '$nobits?', TMP_Number_nobits$q_47 = function(mask) { + var self = this; + + + mask = $$($nesting, 'Opal')['$coerce_to!'](mask, $$($nesting, 'Integer'), "to_int"); + return (self & mask) == 0;; + }, TMP_Number_nobits$q_47.$$arity = 1); + + Opal.def(self, '$nonzero?', TMP_Number_nonzero$q_48 = function() { + var self = this; + + return self == 0 ? nil : self; + }, TMP_Number_nonzero$q_48.$$arity = 0); + + Opal.def(self, '$numerator', TMP_Number_numerator_49 = function $$numerator() { + var $a, $iter = TMP_Number_numerator_49.$$p, $yield = $iter || nil, self = this, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_Number_numerator_49.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + if ($truthy(($truthy($a = self['$nan?']()) ? $a : self['$infinite?']()))) { + return self + } else { + return $send(self, Opal.find_super_dispatcher(self, 'numerator', TMP_Number_numerator_49, false), $zuper, $iter) + } + }, TMP_Number_numerator_49.$$arity = 0); + + Opal.def(self, '$odd?', TMP_Number_odd$q_50 = function() { + var self = this; + + return self % 2 !== 0; + }, TMP_Number_odd$q_50.$$arity = 0); + + Opal.def(self, '$ord', TMP_Number_ord_51 = function $$ord() { + var self = this; + + return self + }, TMP_Number_ord_51.$$arity = 0); + + Opal.def(self, '$pow', TMP_Number_pow_52 = function $$pow(b, m) { + var self = this; + + + ; + + if (self == 0) { + self.$raise($$($nesting, 'ZeroDivisionError'), "divided by 0") + } + + if (m === undefined) { + return self['$**'](b); + } else { + if (!($$($nesting, 'Integer')['$==='](b))) { + self.$raise($$($nesting, 'TypeError'), "Integer#pow() 2nd argument not allowed unless a 1st argument is integer") + } + + if (b < 0) { + self.$raise($$($nesting, 'TypeError'), "Integer#pow() 1st argument cannot be negative when 2nd argument specified") + } + + if (!($$($nesting, 'Integer')['$==='](m))) { + self.$raise($$($nesting, 'TypeError'), "Integer#pow() 2nd argument not allowed unless all arguments are integers") + } + + if (m === 0) { + self.$raise($$($nesting, 'ZeroDivisionError'), "divided by 0") + } + + return self['$**'](b)['$%'](m) + } + ; + }, TMP_Number_pow_52.$$arity = -2); + + Opal.def(self, '$pred', TMP_Number_pred_53 = function $$pred() { + var self = this; + + return self - 1; + }, TMP_Number_pred_53.$$arity = 0); + + Opal.def(self, '$quo', TMP_Number_quo_54 = function $$quo(other) { + var $iter = TMP_Number_quo_54.$$p, $yield = $iter || nil, self = this, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_Number_quo_54.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + if ($truthy($$($nesting, 'Integer')['$==='](self))) { + return $send(self, Opal.find_super_dispatcher(self, 'quo', TMP_Number_quo_54, false), $zuper, $iter) + } else { + return $rb_divide(self, other) + } + }, TMP_Number_quo_54.$$arity = 1); + + Opal.def(self, '$rationalize', TMP_Number_rationalize_55 = function $$rationalize(eps) { + var $a, $b, self = this, f = nil, n = nil; + + + ; + + if (arguments.length > 1) { + self.$raise($$($nesting, 'ArgumentError'), "" + "wrong number of arguments (" + (arguments.length) + " for 0..1)"); + } + ; + if ($truthy($$($nesting, 'Integer')['$==='](self))) { + return $$($nesting, 'Rational').$new(self, 1) + } else if ($truthy(self['$infinite?']())) { + return self.$raise($$($nesting, 'FloatDomainError'), "Infinity") + } else if ($truthy(self['$nan?']())) { + return self.$raise($$($nesting, 'FloatDomainError'), "NaN") + } else if ($truthy(eps == null)) { + + $b = $$($nesting, 'Math').$frexp(self), $a = Opal.to_ary($b), (f = ($a[0] == null ? nil : $a[0])), (n = ($a[1] == null ? nil : $a[1])), $b; + f = $$($nesting, 'Math').$ldexp(f, $$$($$($nesting, 'Float'), 'MANT_DIG')).$to_i(); + n = $rb_minus(n, $$$($$($nesting, 'Float'), 'MANT_DIG')); + return $$($nesting, 'Rational').$new($rb_times(2, f), (1)['$<<']($rb_minus(1, n))).$rationalize($$($nesting, 'Rational').$new(1, (1)['$<<']($rb_minus(1, n)))); + } else { + return self.$to_r().$rationalize(eps) + }; + }, TMP_Number_rationalize_55.$$arity = -1); + + Opal.def(self, '$remainder', TMP_Number_remainder_56 = function $$remainder(y) { + var self = this; + + return $rb_minus(self, $rb_times(y, $rb_divide(self, y).$truncate())) + }, TMP_Number_remainder_56.$$arity = 1); + + Opal.def(self, '$round', TMP_Number_round_57 = function $$round(ndigits) { + var $a, $b, self = this, _ = nil, exp = nil; + + + ; + if ($truthy($$($nesting, 'Integer')['$==='](self))) { + + if ($truthy(ndigits == null)) { + return self}; + if ($truthy(($truthy($a = $$($nesting, 'Float')['$==='](ndigits)) ? ndigits['$infinite?']() : $a))) { + self.$raise($$($nesting, 'RangeError'), "Infinity")}; + ndigits = $$($nesting, 'Opal')['$coerce_to!'](ndigits, $$($nesting, 'Integer'), "to_int"); + if ($truthy($rb_lt(ndigits, $$$($$($nesting, 'Integer'), 'MIN')))) { + self.$raise($$($nesting, 'RangeError'), "out of bounds")}; + if ($truthy(ndigits >= 0)) { + return self}; + ndigits = ndigits['$-@'](); + + if (0.415241 * ndigits - 0.125 > self.$size()) { + return 0; + } + + var f = Math.pow(10, ndigits), + x = Math.floor((Math.abs(x) + f / 2) / f) * f; + + return self < 0 ? -x : x; + ; + } else { + + if ($truthy(($truthy($a = self['$nan?']()) ? ndigits == null : $a))) { + self.$raise($$($nesting, 'FloatDomainError'), "NaN")}; + ndigits = $$($nesting, 'Opal')['$coerce_to!'](ndigits || 0, $$($nesting, 'Integer'), "to_int"); + if ($truthy($rb_le(ndigits, 0))) { + if ($truthy(self['$nan?']())) { + self.$raise($$($nesting, 'RangeError'), "NaN") + } else if ($truthy(self['$infinite?']())) { + self.$raise($$($nesting, 'FloatDomainError'), "Infinity")} + } else if (ndigits['$=='](0)) { + return Math.round(self) + } else if ($truthy(($truthy($a = self['$nan?']()) ? $a : self['$infinite?']()))) { + return self}; + $b = $$($nesting, 'Math').$frexp(self), $a = Opal.to_ary($b), (_ = ($a[0] == null ? nil : $a[0])), (exp = ($a[1] == null ? nil : $a[1])), $b; + if ($truthy($rb_ge(ndigits, $rb_minus($rb_plus($$$($$($nesting, 'Float'), 'DIG'), 2), (function() {if ($truthy($rb_gt(exp, 0))) { + return $rb_divide(exp, 4) + } else { + return $rb_minus($rb_divide(exp, 3), 1) + }; return nil; })())))) { + return self}; + if ($truthy($rb_lt(ndigits, (function() {if ($truthy($rb_gt(exp, 0))) { + return $rb_plus($rb_divide(exp, 3), 1) + } else { + return $rb_divide(exp, 4) + }; return nil; })()['$-@']()))) { + return 0}; + return Math.round(self * Math.pow(10, ndigits)) / Math.pow(10, ndigits);; + }; + }, TMP_Number_round_57.$$arity = -1); + + Opal.def(self, '$step', TMP_Number_step_58 = function $$step($a, $b, $c) { + var $iter = TMP_Number_step_58.$$p, block = $iter || nil, $post_args, $kwargs, limit, step, to, by, TMP_59, self = this, positional_args = nil, keyword_args = nil; + + if ($iter) TMP_Number_step_58.$$p = null; + + + if ($iter) TMP_Number_step_58.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + $kwargs = Opal.extract_kwargs($post_args); + + if ($kwargs == null) { + $kwargs = $hash2([], {}); + } else if (!$kwargs.$$is_hash) { + throw Opal.ArgumentError.$new('expected kwargs'); + }; + + if ($post_args.length > 0) { + limit = $post_args[0]; + $post_args.splice(0, 1); + }; + + if ($post_args.length > 0) { + step = $post_args[0]; + $post_args.splice(0, 1); + }; + + to = $kwargs.$$smap["to"];; + + by = $kwargs.$$smap["by"];; + + if (limit !== undefined && to !== undefined) { + self.$raise($$($nesting, 'ArgumentError'), "to is given twice") + } + + if (step !== undefined && by !== undefined) { + self.$raise($$($nesting, 'ArgumentError'), "step is given twice") + } + + function validateParameters() { + if (to !== undefined) { + limit = to; + } + + if (limit === undefined) { + limit = nil; + } + + if (step === nil) { + self.$raise($$($nesting, 'TypeError'), "step must be numeric") + } + + if (step === 0) { + self.$raise($$($nesting, 'ArgumentError'), "step can't be 0") + } + + if (by !== undefined) { + step = by; + } + + if (step === nil || step == null) { + step = 1; + } + + var sign = step['$<=>'](0); + + if (sign === nil) { + self.$raise($$($nesting, 'ArgumentError'), "" + "0 can't be coerced into " + (step.$class())) + } + + if (limit === nil || limit == null) { + limit = sign > 0 ? $$$($$($nesting, 'Float'), 'INFINITY') : $$$($$($nesting, 'Float'), 'INFINITY')['$-@'](); + } + + $$($nesting, 'Opal').$compare(self, limit) + } + + function stepFloatSize() { + if ((step > 0 && self > limit) || (step < 0 && self < limit)) { + return 0; + } else if (step === Infinity || step === -Infinity) { + return 1; + } else { + var abs = Math.abs, floor = Math.floor, + err = (abs(self) + abs(limit) + abs(limit - self)) / abs(step) * $$$($$($nesting, 'Float'), 'EPSILON'); + + if (err === Infinity || err === -Infinity) { + return 0; + } else { + if (err > 0.5) { + err = 0.5; + } + + return floor((limit - self) / step + err) + 1 + } + } + } + + function stepSize() { + validateParameters(); + + if (step === 0) { + return Infinity; + } + + if (step % 1 !== 0) { + return stepFloatSize(); + } else if ((step > 0 && self > limit) || (step < 0 && self < limit)) { + return 0; + } else { + var ceil = Math.ceil, abs = Math.abs, + lhs = abs(self - limit) + 1, + rhs = abs(step); + + return ceil(lhs / rhs); + } + } + ; + if ((block !== nil)) { + } else { + + positional_args = []; + keyword_args = $hash2([], {}); + + if (limit !== undefined) { + positional_args.push(limit); + } + + if (step !== undefined) { + positional_args.push(step); + } + + if (to !== undefined) { + Opal.hash_put(keyword_args, "to", to); + } + + if (by !== undefined) { + Opal.hash_put(keyword_args, "by", by); + } + + if (keyword_args['$any?']()) { + positional_args.push(keyword_args); + } + ; + return $send(self, 'enum_for', ["step"].concat(Opal.to_a(positional_args)), (TMP_59 = function(){var self = TMP_59.$$s || this; + + return stepSize();}, TMP_59.$$s = self, TMP_59.$$arity = 0, TMP_59)); + }; + + validateParameters(); + + if (step === 0) { + while (true) { + block(self); + } + } + + if (self % 1 !== 0 || limit % 1 !== 0 || step % 1 !== 0) { + var n = stepFloatSize(); + + if (n > 0) { + if (step === Infinity || step === -Infinity) { + block(self); + } else { + var i = 0, d; + + if (step > 0) { + while (i < n) { + d = i * step + self; + if (limit < d) { + d = limit; + } + block(d); + i += 1; + } + } else { + while (i < n) { + d = i * step + self; + if (limit > d) { + d = limit; + } + block(d); + i += 1 + } + } + } + } + } else { + var value = self; + + if (step > 0) { + while (value <= limit) { + block(value); + value += step; + } + } else { + while (value >= limit) { + block(value); + value += step + } + } + } + + return self; + ; + }, TMP_Number_step_58.$$arity = -1); + Opal.alias(self, "succ", "next"); + + Opal.def(self, '$times', TMP_Number_times_60 = function $$times() { + var $iter = TMP_Number_times_60.$$p, block = $iter || nil, TMP_61, self = this; + + if ($iter) TMP_Number_times_60.$$p = null; + + + if ($iter) TMP_Number_times_60.$$p = null;; + if ($truthy(block)) { + } else { + return $send(self, 'enum_for', ["times"], (TMP_61 = function(){var self = TMP_61.$$s || this; + + return self}, TMP_61.$$s = self, TMP_61.$$arity = 0, TMP_61)) + }; + + for (var i = 0; i < self; i++) { + block(i); + } + ; + return self; + }, TMP_Number_times_60.$$arity = 0); + + Opal.def(self, '$to_f', TMP_Number_to_f_62 = function $$to_f() { + var self = this; + + return self + }, TMP_Number_to_f_62.$$arity = 0); + + Opal.def(self, '$to_i', TMP_Number_to_i_63 = function $$to_i() { + var self = this; + + return parseInt(self, 10); + }, TMP_Number_to_i_63.$$arity = 0); + Opal.alias(self, "to_int", "to_i"); + + Opal.def(self, '$to_r', TMP_Number_to_r_64 = function $$to_r() { + var $a, $b, self = this, f = nil, e = nil; + + if ($truthy($$($nesting, 'Integer')['$==='](self))) { + return $$($nesting, 'Rational').$new(self, 1) + } else { + + $b = $$($nesting, 'Math').$frexp(self), $a = Opal.to_ary($b), (f = ($a[0] == null ? nil : $a[0])), (e = ($a[1] == null ? nil : $a[1])), $b; + f = $$($nesting, 'Math').$ldexp(f, $$$($$($nesting, 'Float'), 'MANT_DIG')).$to_i(); + e = $rb_minus(e, $$$($$($nesting, 'Float'), 'MANT_DIG')); + return $rb_times(f, $$$($$($nesting, 'Float'), 'RADIX')['$**'](e)).$to_r(); + } + }, TMP_Number_to_r_64.$$arity = 0); + + Opal.def(self, '$to_s', TMP_Number_to_s_65 = function $$to_s(base) { + var $a, self = this; + + + + if (base == null) { + base = 10; + }; + base = $$($nesting, 'Opal')['$coerce_to!'](base, $$($nesting, 'Integer'), "to_int"); + if ($truthy(($truthy($a = $rb_lt(base, 2)) ? $a : $rb_gt(base, 36)))) { + self.$raise($$($nesting, 'ArgumentError'), "" + "invalid radix " + (base))}; + return self.toString(base);; + }, TMP_Number_to_s_65.$$arity = -1); + + Opal.def(self, '$truncate', TMP_Number_truncate_66 = function $$truncate(ndigits) { + var self = this; + + + + if (ndigits == null) { + ndigits = 0; + }; + + var f = self.$to_f(); + + if (f % 1 === 0 && ndigits >= 0) { + return f; + } + + var factor = Math.pow(10, ndigits), + result = parseInt(f * factor, 10) / factor; + + if (f % 1 === 0) { + result = Math.round(result); + } + + return result; + ; + }, TMP_Number_truncate_66.$$arity = -1); + Opal.alias(self, "inspect", "to_s"); + + Opal.def(self, '$digits', TMP_Number_digits_67 = function $$digits(base) { + var self = this; + + + + if (base == null) { + base = 10; + }; + if ($rb_lt(self, 0)) { + self.$raise($$$($$($nesting, 'Math'), 'DomainError'), "out of domain")}; + base = $$($nesting, 'Opal')['$coerce_to!'](base, $$($nesting, 'Integer'), "to_int"); + if ($truthy($rb_lt(base, 2))) { + self.$raise($$($nesting, 'ArgumentError'), "" + "invalid radix " + (base))}; + + var value = self, result = []; + + while (value !== 0) { + result.push(value % base); + value = parseInt(value / base, 10); + } + + return result; + ; + }, TMP_Number_digits_67.$$arity = -1); + + Opal.def(self, '$divmod', TMP_Number_divmod_68 = function $$divmod(other) { + var $a, $iter = TMP_Number_divmod_68.$$p, $yield = $iter || nil, self = this, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_Number_divmod_68.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + if ($truthy(($truthy($a = self['$nan?']()) ? $a : other['$nan?']()))) { + return self.$raise($$($nesting, 'FloatDomainError'), "NaN") + } else if ($truthy(self['$infinite?']())) { + return self.$raise($$($nesting, 'FloatDomainError'), "Infinity") + } else { + return $send(self, Opal.find_super_dispatcher(self, 'divmod', TMP_Number_divmod_68, false), $zuper, $iter) + } + }, TMP_Number_divmod_68.$$arity = 1); + + Opal.def(self, '$upto', TMP_Number_upto_69 = function $$upto(stop) { + var $iter = TMP_Number_upto_69.$$p, block = $iter || nil, TMP_70, self = this; + + if ($iter) TMP_Number_upto_69.$$p = null; + + + if ($iter) TMP_Number_upto_69.$$p = null;; + if ((block !== nil)) { + } else { + return $send(self, 'enum_for', ["upto", stop], (TMP_70 = function(){var self = TMP_70.$$s || this; + + + if ($truthy($$($nesting, 'Numeric')['$==='](stop))) { + } else { + self.$raise($$($nesting, 'ArgumentError'), "" + "comparison of " + (self.$class()) + " with " + (stop.$class()) + " failed") + }; + if ($truthy($rb_lt(stop, self))) { + return 0 + } else { + return $rb_plus($rb_minus(stop, self), 1) + };}, TMP_70.$$s = self, TMP_70.$$arity = 0, TMP_70)) + }; + + if (!stop.$$is_number) { + self.$raise($$($nesting, 'ArgumentError'), "" + "comparison of " + (self.$class()) + " with " + (stop.$class()) + " failed") + } + for (var i = self; i <= stop; i++) { + block(i); + } + ; + return self; + }, TMP_Number_upto_69.$$arity = 1); + + Opal.def(self, '$zero?', TMP_Number_zero$q_71 = function() { + var self = this; + + return self == 0; + }, TMP_Number_zero$q_71.$$arity = 0); + + Opal.def(self, '$size', TMP_Number_size_72 = function $$size() { + var self = this; + + return 4 + }, TMP_Number_size_72.$$arity = 0); + + Opal.def(self, '$nan?', TMP_Number_nan$q_73 = function() { + var self = this; + + return isNaN(self); + }, TMP_Number_nan$q_73.$$arity = 0); + + Opal.def(self, '$finite?', TMP_Number_finite$q_74 = function() { + var self = this; + + return self != Infinity && self != -Infinity && !isNaN(self); + }, TMP_Number_finite$q_74.$$arity = 0); + + Opal.def(self, '$infinite?', TMP_Number_infinite$q_75 = function() { + var self = this; + + + if (self == Infinity) { + return +1; + } + else if (self == -Infinity) { + return -1; + } + else { + return nil; + } + + }, TMP_Number_infinite$q_75.$$arity = 0); + + Opal.def(self, '$positive?', TMP_Number_positive$q_76 = function() { + var self = this; + + return self != 0 && (self == Infinity || 1 / self > 0); + }, TMP_Number_positive$q_76.$$arity = 0); + return (Opal.def(self, '$negative?', TMP_Number_negative$q_77 = function() { + var self = this; + + return self == -Infinity || 1 / self < 0; + }, TMP_Number_negative$q_77.$$arity = 0), nil) && 'negative?'; + })($nesting[0], $$($nesting, 'Numeric'), $nesting); + Opal.const_set($nesting[0], 'Fixnum', $$($nesting, 'Number')); + (function($base, $super, $parent_nesting) { + function $Integer(){}; + var self = $Integer = $klass($base, $super, 'Integer', $Integer); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + + self.$$is_number_class = true; + (function(self, $parent_nesting) { + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_allocate_78, TMP_$eq$eq$eq_79, TMP_sqrt_80; + + + + Opal.def(self, '$allocate', TMP_allocate_78 = function $$allocate() { + var self = this; + + return self.$raise($$($nesting, 'TypeError'), "" + "allocator undefined for " + (self.$name())) + }, TMP_allocate_78.$$arity = 0); + + Opal.udef(self, '$' + "new");; + + Opal.def(self, '$===', TMP_$eq$eq$eq_79 = function(other) { + var self = this; + + + if (!other.$$is_number) { + return false; + } + + return (other % 1) === 0; + + }, TMP_$eq$eq$eq_79.$$arity = 1); + return (Opal.def(self, '$sqrt', TMP_sqrt_80 = function $$sqrt(n) { + var self = this; + + + n = $$($nesting, 'Opal')['$coerce_to!'](n, $$($nesting, 'Integer'), "to_int"); + + if (n < 0) { + self.$raise($$$($$($nesting, 'Math'), 'DomainError'), "Numerical argument is out of domain - \"isqrt\"") + } + + return parseInt(Math.sqrt(n), 10); + ; + }, TMP_sqrt_80.$$arity = 1), nil) && 'sqrt'; + })(Opal.get_singleton_class(self), $nesting); + Opal.const_set($nesting[0], 'MAX', Math.pow(2, 30) - 1); + return Opal.const_set($nesting[0], 'MIN', -Math.pow(2, 30)); + })($nesting[0], $$($nesting, 'Numeric'), $nesting); + return (function($base, $super, $parent_nesting) { + function $Float(){}; + var self = $Float = $klass($base, $super, 'Float', $Float); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + + self.$$is_number_class = true; + (function(self, $parent_nesting) { + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_allocate_81, TMP_$eq$eq$eq_82; + + + + Opal.def(self, '$allocate', TMP_allocate_81 = function $$allocate() { + var self = this; + + return self.$raise($$($nesting, 'TypeError'), "" + "allocator undefined for " + (self.$name())) + }, TMP_allocate_81.$$arity = 0); + + Opal.udef(self, '$' + "new");; + return (Opal.def(self, '$===', TMP_$eq$eq$eq_82 = function(other) { + var self = this; + + return !!other.$$is_number; + }, TMP_$eq$eq$eq_82.$$arity = 1), nil) && '==='; + })(Opal.get_singleton_class(self), $nesting); + Opal.const_set($nesting[0], 'INFINITY', Infinity); + Opal.const_set($nesting[0], 'MAX', Number.MAX_VALUE); + Opal.const_set($nesting[0], 'MIN', Number.MIN_VALUE); + Opal.const_set($nesting[0], 'NAN', NaN); + Opal.const_set($nesting[0], 'DIG', 15); + Opal.const_set($nesting[0], 'MANT_DIG', 53); + Opal.const_set($nesting[0], 'RADIX', 2); + return Opal.const_set($nesting[0], 'EPSILON', Number.EPSILON || 2.2204460492503130808472633361816E-16); + })($nesting[0], $$($nesting, 'Numeric'), $nesting); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/range"] = function(Opal) { + function $rb_le(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs <= rhs : lhs['$<='](rhs); + } + function $rb_lt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); + } + function $rb_gt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); + } + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + function $rb_divide(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs / rhs : lhs['$/'](rhs); + } + function $rb_plus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); + } + function $rb_times(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs * rhs : lhs['$*'](rhs); + } + function $rb_ge(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs >= rhs : lhs['$>='](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $truthy = Opal.truthy, $send = Opal.send; + + Opal.add_stubs(['$require', '$include', '$attr_reader', '$raise', '$<=>', '$include?', '$<=', '$<', '$enum_for', '$upto', '$to_proc', '$respond_to?', '$class', '$succ', '$!', '$==', '$===', '$exclude_end?', '$eql?', '$begin', '$end', '$last', '$to_a', '$>', '$-', '$abs', '$to_i', '$coerce_to!', '$ceil', '$/', '$size', '$loop', '$+', '$*', '$>=', '$each_with_index', '$%', '$bsearch', '$inspect', '$[]', '$hash']); + + self.$require("corelib/enumerable"); + return (function($base, $super, $parent_nesting) { + function $Range(){}; + var self = $Range = $klass($base, $super, 'Range', $Range); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Range_initialize_1, TMP_Range_$eq$eq_2, TMP_Range_$eq$eq$eq_3, TMP_Range_cover$q_4, TMP_Range_each_5, TMP_Range_eql$q_6, TMP_Range_exclude_end$q_7, TMP_Range_first_8, TMP_Range_last_9, TMP_Range_max_10, TMP_Range_min_11, TMP_Range_size_12, TMP_Range_step_13, TMP_Range_bsearch_17, TMP_Range_to_s_18, TMP_Range_inspect_19, TMP_Range_marshal_load_20, TMP_Range_hash_21; + + def.begin = def.end = def.excl = nil; + + self.$include($$($nesting, 'Enumerable')); + def.$$is_range = true; + self.$attr_reader("begin", "end"); + + Opal.def(self, '$initialize', TMP_Range_initialize_1 = function $$initialize(first, last, exclude) { + var self = this; + + + + if (exclude == null) { + exclude = false; + }; + if ($truthy(self.begin)) { + self.$raise($$($nesting, 'NameError'), "'initialize' called twice")}; + if ($truthy(first['$<=>'](last))) { + } else { + self.$raise($$($nesting, 'ArgumentError'), "bad value for range") + }; + self.begin = first; + self.end = last; + return (self.excl = exclude); + }, TMP_Range_initialize_1.$$arity = -3); + + Opal.def(self, '$==', TMP_Range_$eq$eq_2 = function(other) { + var self = this; + + + if (!other.$$is_range) { + return false; + } + + return self.excl === other.excl && + self.begin == other.begin && + self.end == other.end; + + }, TMP_Range_$eq$eq_2.$$arity = 1); + + Opal.def(self, '$===', TMP_Range_$eq$eq$eq_3 = function(value) { + var self = this; + + return self['$include?'](value) + }, TMP_Range_$eq$eq$eq_3.$$arity = 1); + + Opal.def(self, '$cover?', TMP_Range_cover$q_4 = function(value) { + var $a, self = this, beg_cmp = nil, end_cmp = nil; + + + beg_cmp = self.begin['$<=>'](value); + if ($truthy(($truthy($a = beg_cmp) ? $rb_le(beg_cmp, 0) : $a))) { + } else { + return false + }; + end_cmp = value['$<=>'](self.end); + if ($truthy(self.excl)) { + return ($truthy($a = end_cmp) ? $rb_lt(end_cmp, 0) : $a) + } else { + return ($truthy($a = end_cmp) ? $rb_le(end_cmp, 0) : $a) + }; + }, TMP_Range_cover$q_4.$$arity = 1); + + Opal.def(self, '$each', TMP_Range_each_5 = function $$each() { + var $iter = TMP_Range_each_5.$$p, block = $iter || nil, $a, self = this, current = nil, last = nil; + + if ($iter) TMP_Range_each_5.$$p = null; + + + if ($iter) TMP_Range_each_5.$$p = null;; + if ((block !== nil)) { + } else { + return self.$enum_for("each") + }; + + var i, limit; + + if (self.begin.$$is_number && self.end.$$is_number) { + if (self.begin % 1 !== 0 || self.end % 1 !== 0) { + self.$raise($$($nesting, 'TypeError'), "can't iterate from Float") + } + + for (i = self.begin, limit = self.end + (function() {if ($truthy(self.excl)) { + return 0 + } else { + return 1 + }; return nil; })(); i < limit; i++) { + block(i); + } + + return self; + } + + if (self.begin.$$is_string && self.end.$$is_string) { + $send(self.begin, 'upto', [self.end, self.excl], block.$to_proc()) + return self; + } + ; + current = self.begin; + last = self.end; + if ($truthy(current['$respond_to?']("succ"))) { + } else { + self.$raise($$($nesting, 'TypeError'), "" + "can't iterate from " + (current.$class())) + }; + while ($truthy($rb_lt(current['$<=>'](last), 0))) { + + Opal.yield1(block, current); + current = current.$succ(); + }; + if ($truthy(($truthy($a = self.excl['$!']()) ? current['$=='](last) : $a))) { + Opal.yield1(block, current)}; + return self; + }, TMP_Range_each_5.$$arity = 0); + + Opal.def(self, '$eql?', TMP_Range_eql$q_6 = function(other) { + var $a, $b, self = this; + + + if ($truthy($$($nesting, 'Range')['$==='](other))) { + } else { + return false + }; + return ($truthy($a = ($truthy($b = self.excl['$==='](other['$exclude_end?']())) ? self.begin['$eql?'](other.$begin()) : $b)) ? self.end['$eql?'](other.$end()) : $a); + }, TMP_Range_eql$q_6.$$arity = 1); + + Opal.def(self, '$exclude_end?', TMP_Range_exclude_end$q_7 = function() { + var self = this; + + return self.excl + }, TMP_Range_exclude_end$q_7.$$arity = 0); + + Opal.def(self, '$first', TMP_Range_first_8 = function $$first(n) { + var $iter = TMP_Range_first_8.$$p, $yield = $iter || nil, self = this, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_Range_first_8.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + + ; + if ($truthy(n == null)) { + return self.begin}; + return $send(self, Opal.find_super_dispatcher(self, 'first', TMP_Range_first_8, false), $zuper, $iter); + }, TMP_Range_first_8.$$arity = -1); + Opal.alias(self, "include?", "cover?"); + + Opal.def(self, '$last', TMP_Range_last_9 = function $$last(n) { + var self = this; + + + ; + if ($truthy(n == null)) { + return self.end}; + return self.$to_a().$last(n); + }, TMP_Range_last_9.$$arity = -1); + + Opal.def(self, '$max', TMP_Range_max_10 = function $$max() { + var $a, $iter = TMP_Range_max_10.$$p, $yield = $iter || nil, self = this, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_Range_max_10.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + if (($yield !== nil)) { + return $send(self, Opal.find_super_dispatcher(self, 'max', TMP_Range_max_10, false), $zuper, $iter) + } else if ($truthy($rb_gt(self.begin, self.end))) { + return nil + } else if ($truthy(($truthy($a = self.excl) ? self.begin['$=='](self.end) : $a))) { + return nil + } else { + return self.excl ? self.end - 1 : self.end + } + }, TMP_Range_max_10.$$arity = 0); + Opal.alias(self, "member?", "cover?"); + + Opal.def(self, '$min', TMP_Range_min_11 = function $$min() { + var $a, $iter = TMP_Range_min_11.$$p, $yield = $iter || nil, self = this, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_Range_min_11.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + if (($yield !== nil)) { + return $send(self, Opal.find_super_dispatcher(self, 'min', TMP_Range_min_11, false), $zuper, $iter) + } else if ($truthy($rb_gt(self.begin, self.end))) { + return nil + } else if ($truthy(($truthy($a = self.excl) ? self.begin['$=='](self.end) : $a))) { + return nil + } else { + return self.begin + } + }, TMP_Range_min_11.$$arity = 0); + + Opal.def(self, '$size', TMP_Range_size_12 = function $$size() { + var $a, self = this, range_begin = nil, range_end = nil, infinity = nil; + + + range_begin = self.begin; + range_end = self.end; + if ($truthy(self.excl)) { + range_end = $rb_minus(range_end, 1)}; + if ($truthy(($truthy($a = $$($nesting, 'Numeric')['$==='](range_begin)) ? $$($nesting, 'Numeric')['$==='](range_end) : $a))) { + } else { + return nil + }; + if ($truthy($rb_lt(range_end, range_begin))) { + return 0}; + infinity = $$$($$($nesting, 'Float'), 'INFINITY'); + if ($truthy([range_begin.$abs(), range_end.$abs()]['$include?'](infinity))) { + return infinity}; + return (Math.abs(range_end - range_begin) + 1).$to_i(); + }, TMP_Range_size_12.$$arity = 0); + + Opal.def(self, '$step', TMP_Range_step_13 = function $$step(n) { + var TMP_14, TMP_15, TMP_16, $iter = TMP_Range_step_13.$$p, $yield = $iter || nil, self = this, i = nil; + + if ($iter) TMP_Range_step_13.$$p = null; + + + if (n == null) { + n = 1; + }; + + function coerceStepSize() { + if (!n.$$is_number) { + n = $$($nesting, 'Opal')['$coerce_to!'](n, $$($nesting, 'Integer'), "to_int") + } + + if (n < 0) { + self.$raise($$($nesting, 'ArgumentError'), "step can't be negative") + } else if (n === 0) { + self.$raise($$($nesting, 'ArgumentError'), "step can't be 0") + } + } + + function enumeratorSize() { + if (!self.begin['$respond_to?']("succ")) { + return nil; + } + + if (self.begin.$$is_string && self.end.$$is_string) { + return nil; + } + + if (n % 1 === 0) { + return $rb_divide(self.$size(), n).$ceil(); + } else { + // n is a float + var begin = self.begin, end = self.end, + abs = Math.abs, floor = Math.floor, + err = (abs(begin) + abs(end) + abs(end - begin)) / abs(n) * $$$($$($nesting, 'Float'), 'EPSILON'), + size; + + if (err > 0.5) { + err = 0.5; + } + + if (self.excl) { + size = floor((end - begin) / n - err); + if (size * n + begin < end) { + size++; + } + } else { + size = floor((end - begin) / n + err) + 1 + } + + return size; + } + } + ; + if (($yield !== nil)) { + } else { + return $send(self, 'enum_for', ["step", n], (TMP_14 = function(){var self = TMP_14.$$s || this; + + + coerceStepSize(); + return enumeratorSize(); + }, TMP_14.$$s = self, TMP_14.$$arity = 0, TMP_14)) + }; + coerceStepSize(); + if ($truthy(self.begin.$$is_number && self.end.$$is_number)) { + + i = 0; + (function(){var $brk = Opal.new_brk(); try {return $send(self, 'loop', [], (TMP_15 = function(){var self = TMP_15.$$s || this, current = nil; + if (self.begin == null) self.begin = nil; + if (self.excl == null) self.excl = nil; + if (self.end == null) self.end = nil; + + + current = $rb_plus(self.begin, $rb_times(i, n)); + if ($truthy(self.excl)) { + if ($truthy($rb_ge(current, self.end))) { + + Opal.brk(nil, $brk)} + } else if ($truthy($rb_gt(current, self.end))) { + + Opal.brk(nil, $brk)}; + Opal.yield1($yield, current); + return (i = $rb_plus(i, 1));}, TMP_15.$$s = self, TMP_15.$$brk = $brk, TMP_15.$$arity = 0, TMP_15)) + } catch (err) { if (err === $brk) { return err.$v } else { throw err } }})(); + } else { + + + if (self.begin.$$is_string && self.end.$$is_string && n % 1 !== 0) { + self.$raise($$($nesting, 'TypeError'), "no implicit conversion to float from string") + } + ; + $send(self, 'each_with_index', [], (TMP_16 = function(value, idx){var self = TMP_16.$$s || this; + + + + if (value == null) { + value = nil; + }; + + if (idx == null) { + idx = nil; + }; + if (idx['$%'](n)['$=='](0)) { + return Opal.yield1($yield, value); + } else { + return nil + };}, TMP_16.$$s = self, TMP_16.$$arity = 2, TMP_16)); + }; + return self; + }, TMP_Range_step_13.$$arity = -1); + + Opal.def(self, '$bsearch', TMP_Range_bsearch_17 = function $$bsearch() { + var $iter = TMP_Range_bsearch_17.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Range_bsearch_17.$$p = null; + + + if ($iter) TMP_Range_bsearch_17.$$p = null;; + if ((block !== nil)) { + } else { + return self.$enum_for("bsearch") + }; + if ($truthy(self.begin.$$is_number && self.end.$$is_number)) { + } else { + self.$raise($$($nesting, 'TypeError'), "" + "can't do binary search for " + (self.begin.$class())) + }; + return $send(self.$to_a(), 'bsearch', [], block.$to_proc()); + }, TMP_Range_bsearch_17.$$arity = 0); + + Opal.def(self, '$to_s', TMP_Range_to_s_18 = function $$to_s() { + var self = this; + + return "" + (self.begin) + ((function() {if ($truthy(self.excl)) { + return "..." + } else { + return ".." + }; return nil; })()) + (self.end) + }, TMP_Range_to_s_18.$$arity = 0); + + Opal.def(self, '$inspect', TMP_Range_inspect_19 = function $$inspect() { + var self = this; + + return "" + (self.begin.$inspect()) + ((function() {if ($truthy(self.excl)) { + return "..." + } else { + return ".." + }; return nil; })()) + (self.end.$inspect()) + }, TMP_Range_inspect_19.$$arity = 0); + + Opal.def(self, '$marshal_load', TMP_Range_marshal_load_20 = function $$marshal_load(args) { + var self = this; + + + self.begin = args['$[]']("begin"); + self.end = args['$[]']("end"); + return (self.excl = args['$[]']("excl")); + }, TMP_Range_marshal_load_20.$$arity = 1); + return (Opal.def(self, '$hash', TMP_Range_hash_21 = function $$hash() { + var self = this; + + return [self.begin, self.end, self.excl].$hash() + }, TMP_Range_hash_21.$$arity = 0), nil) && 'hash'; + })($nesting[0], null, $nesting); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/proc"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $truthy = Opal.truthy; + + Opal.add_stubs(['$raise', '$coerce_to!']); + return (function($base, $super, $parent_nesting) { + function $Proc(){}; + var self = $Proc = $klass($base, $super, 'Proc', $Proc); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Proc_new_1, TMP_Proc_call_2, TMP_Proc_to_proc_3, TMP_Proc_lambda$q_4, TMP_Proc_arity_5, TMP_Proc_source_location_6, TMP_Proc_binding_7, TMP_Proc_parameters_8, TMP_Proc_curry_9, TMP_Proc_dup_10; + + + Opal.defineProperty(Function.prototype, '$$is_proc', true); + Opal.defineProperty(Function.prototype, '$$is_lambda', false); + Opal.defs(self, '$new', TMP_Proc_new_1 = function() { + var $iter = TMP_Proc_new_1.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Proc_new_1.$$p = null; + + + if ($iter) TMP_Proc_new_1.$$p = null;; + if ($truthy(block)) { + } else { + self.$raise($$($nesting, 'ArgumentError'), "tried to create a Proc object without a block") + }; + return block; + }, TMP_Proc_new_1.$$arity = 0); + + Opal.def(self, '$call', TMP_Proc_call_2 = function $$call($a) { + var $iter = TMP_Proc_call_2.$$p, block = $iter || nil, $post_args, args, self = this; + + if ($iter) TMP_Proc_call_2.$$p = null; + + + if ($iter) TMP_Proc_call_2.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + + if (block !== nil) { + self.$$p = block; + } + + var result, $brk = self.$$brk; + + if ($brk) { + try { + if (self.$$is_lambda) { + result = self.apply(null, args); + } + else { + result = Opal.yieldX(self, args); + } + } catch (err) { + if (err === $brk) { + return $brk.$v + } + else { + throw err + } + } + } + else { + if (self.$$is_lambda) { + result = self.apply(null, args); + } + else { + result = Opal.yieldX(self, args); + } + } + + return result; + ; + }, TMP_Proc_call_2.$$arity = -1); + Opal.alias(self, "[]", "call"); + Opal.alias(self, "===", "call"); + Opal.alias(self, "yield", "call"); + + Opal.def(self, '$to_proc', TMP_Proc_to_proc_3 = function $$to_proc() { + var self = this; + + return self + }, TMP_Proc_to_proc_3.$$arity = 0); + + Opal.def(self, '$lambda?', TMP_Proc_lambda$q_4 = function() { + var self = this; + + return !!self.$$is_lambda; + }, TMP_Proc_lambda$q_4.$$arity = 0); + + Opal.def(self, '$arity', TMP_Proc_arity_5 = function $$arity() { + var self = this; + + + if (self.$$is_curried) { + return -1; + } else { + return self.$$arity; + } + + }, TMP_Proc_arity_5.$$arity = 0); + + Opal.def(self, '$source_location', TMP_Proc_source_location_6 = function $$source_location() { + var self = this; + + + if (self.$$is_curried) { return nil; }; + return nil; + }, TMP_Proc_source_location_6.$$arity = 0); + + Opal.def(self, '$binding', TMP_Proc_binding_7 = function $$binding() { + var self = this; + + + if (self.$$is_curried) { self.$raise($$($nesting, 'ArgumentError'), "Can't create Binding") }; + return nil; + }, TMP_Proc_binding_7.$$arity = 0); + + Opal.def(self, '$parameters', TMP_Proc_parameters_8 = function $$parameters() { + var self = this; + + + if (self.$$is_curried) { + return [["rest"]]; + } else if (self.$$parameters) { + if (self.$$is_lambda) { + return self.$$parameters; + } else { + var result = [], i, length; + + for (i = 0, length = self.$$parameters.length; i < length; i++) { + var parameter = self.$$parameters[i]; + + if (parameter[0] === 'req') { + // required arguments always have name + parameter = ['opt', parameter[1]]; + } + + result.push(parameter); + } + + return result; + } + } else { + return []; + } + + }, TMP_Proc_parameters_8.$$arity = 0); + + Opal.def(self, '$curry', TMP_Proc_curry_9 = function $$curry(arity) { + var self = this; + + + ; + + if (arity === undefined) { + arity = self.length; + } + else { + arity = $$($nesting, 'Opal')['$coerce_to!'](arity, $$($nesting, 'Integer'), "to_int"); + if (self.$$is_lambda && arity !== self.length) { + self.$raise($$($nesting, 'ArgumentError'), "" + "wrong number of arguments (" + (arity) + " for " + (self.length) + ")") + } + } + + function curried () { + var args = $slice.call(arguments), + length = args.length, + result; + + if (length > arity && self.$$is_lambda && !self.$$is_curried) { + self.$raise($$($nesting, 'ArgumentError'), "" + "wrong number of arguments (" + (length) + " for " + (arity) + ")") + } + + if (length >= arity) { + return self.$call.apply(self, args); + } + + result = function () { + return curried.apply(null, + args.concat($slice.call(arguments))); + } + result.$$is_lambda = self.$$is_lambda; + result.$$is_curried = true; + + return result; + }; + + curried.$$is_lambda = self.$$is_lambda; + curried.$$is_curried = true; + return curried; + ; + }, TMP_Proc_curry_9.$$arity = -1); + + Opal.def(self, '$dup', TMP_Proc_dup_10 = function $$dup() { + var self = this; + + + var original_proc = self.$$original_proc || self, + proc = function () { + return original_proc.apply(this, arguments); + }; + + for (var prop in self) { + if (self.hasOwnProperty(prop)) { + proc[prop] = self[prop]; + } + } + + return proc; + + }, TMP_Proc_dup_10.$$arity = 0); + return Opal.alias(self, "clone", "dup"); + })($nesting[0], Function, $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/method"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $truthy = Opal.truthy; + + Opal.add_stubs(['$attr_reader', '$arity', '$new', '$class', '$join', '$source_location', '$raise']); + + (function($base, $super, $parent_nesting) { + function $Method(){}; + var self = $Method = $klass($base, $super, 'Method', $Method); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Method_initialize_1, TMP_Method_arity_2, TMP_Method_parameters_3, TMP_Method_source_location_4, TMP_Method_comments_5, TMP_Method_call_6, TMP_Method_unbind_7, TMP_Method_to_proc_8, TMP_Method_inspect_9; + + def.method = def.receiver = def.owner = def.name = nil; + + self.$attr_reader("owner", "receiver", "name"); + + Opal.def(self, '$initialize', TMP_Method_initialize_1 = function $$initialize(receiver, owner, method, name) { + var self = this; + + + self.receiver = receiver; + self.owner = owner; + self.name = name; + return (self.method = method); + }, TMP_Method_initialize_1.$$arity = 4); + + Opal.def(self, '$arity', TMP_Method_arity_2 = function $$arity() { + var self = this; + + return self.method.$arity() + }, TMP_Method_arity_2.$$arity = 0); + + Opal.def(self, '$parameters', TMP_Method_parameters_3 = function $$parameters() { + var self = this; + + return self.method.$$parameters + }, TMP_Method_parameters_3.$$arity = 0); + + Opal.def(self, '$source_location', TMP_Method_source_location_4 = function $$source_location() { + var $a, self = this; + + return ($truthy($a = self.method.$$source_location) ? $a : ["(eval)", 0]) + }, TMP_Method_source_location_4.$$arity = 0); + + Opal.def(self, '$comments', TMP_Method_comments_5 = function $$comments() { + var $a, self = this; + + return ($truthy($a = self.method.$$comments) ? $a : []) + }, TMP_Method_comments_5.$$arity = 0); + + Opal.def(self, '$call', TMP_Method_call_6 = function $$call($a) { + var $iter = TMP_Method_call_6.$$p, block = $iter || nil, $post_args, args, self = this; + + if ($iter) TMP_Method_call_6.$$p = null; + + + if ($iter) TMP_Method_call_6.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + + self.method.$$p = block; + + return self.method.apply(self.receiver, args); + ; + }, TMP_Method_call_6.$$arity = -1); + Opal.alias(self, "[]", "call"); + + Opal.def(self, '$unbind', TMP_Method_unbind_7 = function $$unbind() { + var self = this; + + return $$($nesting, 'UnboundMethod').$new(self.receiver.$class(), self.owner, self.method, self.name) + }, TMP_Method_unbind_7.$$arity = 0); + + Opal.def(self, '$to_proc', TMP_Method_to_proc_8 = function $$to_proc() { + var self = this; + + + var proc = self.$call.bind(self); + proc.$$unbound = self.method; + proc.$$is_lambda = true; + return proc; + + }, TMP_Method_to_proc_8.$$arity = 0); + return (Opal.def(self, '$inspect', TMP_Method_inspect_9 = function $$inspect() { + var self = this; + + return "" + "#<" + (self.$class()) + ": " + (self.receiver.$class()) + "#" + (self.name) + " (defined in " + (self.owner) + " in " + (self.$source_location().$join(":")) + ")>" + }, TMP_Method_inspect_9.$$arity = 0), nil) && 'inspect'; + })($nesting[0], null, $nesting); + return (function($base, $super, $parent_nesting) { + function $UnboundMethod(){}; + var self = $UnboundMethod = $klass($base, $super, 'UnboundMethod', $UnboundMethod); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_UnboundMethod_initialize_10, TMP_UnboundMethod_arity_11, TMP_UnboundMethod_parameters_12, TMP_UnboundMethod_source_location_13, TMP_UnboundMethod_comments_14, TMP_UnboundMethod_bind_15, TMP_UnboundMethod_inspect_16; + + def.method = def.owner = def.name = def.source = nil; + + self.$attr_reader("source", "owner", "name"); + + Opal.def(self, '$initialize', TMP_UnboundMethod_initialize_10 = function $$initialize(source, owner, method, name) { + var self = this; + + + self.source = source; + self.owner = owner; + self.method = method; + return (self.name = name); + }, TMP_UnboundMethod_initialize_10.$$arity = 4); + + Opal.def(self, '$arity', TMP_UnboundMethod_arity_11 = function $$arity() { + var self = this; + + return self.method.$arity() + }, TMP_UnboundMethod_arity_11.$$arity = 0); + + Opal.def(self, '$parameters', TMP_UnboundMethod_parameters_12 = function $$parameters() { + var self = this; + + return self.method.$$parameters + }, TMP_UnboundMethod_parameters_12.$$arity = 0); + + Opal.def(self, '$source_location', TMP_UnboundMethod_source_location_13 = function $$source_location() { + var $a, self = this; + + return ($truthy($a = self.method.$$source_location) ? $a : ["(eval)", 0]) + }, TMP_UnboundMethod_source_location_13.$$arity = 0); + + Opal.def(self, '$comments', TMP_UnboundMethod_comments_14 = function $$comments() { + var $a, self = this; + + return ($truthy($a = self.method.$$comments) ? $a : []) + }, TMP_UnboundMethod_comments_14.$$arity = 0); + + Opal.def(self, '$bind', TMP_UnboundMethod_bind_15 = function $$bind(object) { + var self = this; + + + if (self.owner.$$is_module || Opal.is_a(object, self.owner)) { + return $$($nesting, 'Method').$new(object, self.owner, self.method, self.name); + } + else { + self.$raise($$($nesting, 'TypeError'), "" + "can't bind singleton method to a different class (expected " + (object) + ".kind_of?(" + (self.owner) + " to be true)"); + } + + }, TMP_UnboundMethod_bind_15.$$arity = 1); + return (Opal.def(self, '$inspect', TMP_UnboundMethod_inspect_16 = function $$inspect() { + var self = this; + + return "" + "#<" + (self.$class()) + ": " + (self.source) + "#" + (self.name) + " (defined in " + (self.owner) + " in " + (self.$source_location().$join(":")) + ")>" + }, TMP_UnboundMethod_inspect_16.$$arity = 0), nil) && 'inspect'; + })($nesting[0], null, $nesting); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/variables"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $gvars = Opal.gvars, $hash2 = Opal.hash2; + + Opal.add_stubs(['$new']); + + $gvars['&'] = $gvars['~'] = $gvars['`'] = $gvars["'"] = nil; + $gvars.LOADED_FEATURES = ($gvars["\""] = Opal.loaded_features); + $gvars.LOAD_PATH = ($gvars[":"] = []); + $gvars["/"] = "\n"; + $gvars[","] = nil; + Opal.const_set($nesting[0], 'ARGV', []); + Opal.const_set($nesting[0], 'ARGF', $$($nesting, 'Object').$new()); + Opal.const_set($nesting[0], 'ENV', $hash2([], {})); + $gvars.VERBOSE = false; + $gvars.DEBUG = false; + return ($gvars.SAFE = 0); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["opal/regexp_anchors"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module; + + Opal.add_stubs(['$==', '$new']); + return (function($base, $parent_nesting) { + function $Opal() {}; + var self = $Opal = $module($base, 'Opal', $Opal); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + + Opal.const_set($nesting[0], 'REGEXP_START', (function() {if ($$($nesting, 'RUBY_ENGINE')['$==']("opal")) { + return "^" + } else { + return nil + }; return nil; })()); + Opal.const_set($nesting[0], 'REGEXP_END', (function() {if ($$($nesting, 'RUBY_ENGINE')['$==']("opal")) { + return "$" + } else { + return nil + }; return nil; })()); + Opal.const_set($nesting[0], 'FORBIDDEN_STARTING_IDENTIFIER_CHARS', "\\u0001-\\u002F\\u003A-\\u0040\\u005B-\\u005E\\u0060\\u007B-\\u007F"); + Opal.const_set($nesting[0], 'FORBIDDEN_ENDING_IDENTIFIER_CHARS', "\\u0001-\\u0020\\u0022-\\u002F\\u003A-\\u003E\\u0040\\u005B-\\u005E\\u0060\\u007B-\\u007F"); + Opal.const_set($nesting[0], 'INLINE_IDENTIFIER_REGEXP', $$($nesting, 'Regexp').$new("" + "[^" + ($$($nesting, 'FORBIDDEN_STARTING_IDENTIFIER_CHARS')) + "]*[^" + ($$($nesting, 'FORBIDDEN_ENDING_IDENTIFIER_CHARS')) + "]")); + Opal.const_set($nesting[0], 'FORBIDDEN_CONST_NAME_CHARS', "\\u0001-\\u0020\\u0021-\\u002F\\u003B-\\u003F\\u0040\\u005B-\\u005E\\u0060\\u007B-\\u007F"); + Opal.const_set($nesting[0], 'CONST_NAME_REGEXP', $$($nesting, 'Regexp').$new("" + ($$($nesting, 'REGEXP_START')) + "(::)?[A-Z][^" + ($$($nesting, 'FORBIDDEN_CONST_NAME_CHARS')) + "]*" + ($$($nesting, 'REGEXP_END')))); + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["opal/mini"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice; + + Opal.add_stubs(['$require']); + + self.$require("opal/base"); + self.$require("corelib/nil"); + self.$require("corelib/boolean"); + self.$require("corelib/string"); + self.$require("corelib/comparable"); + self.$require("corelib/enumerable"); + self.$require("corelib/enumerator"); + self.$require("corelib/array"); + self.$require("corelib/hash"); + self.$require("corelib/number"); + self.$require("corelib/range"); + self.$require("corelib/proc"); + self.$require("corelib/method"); + self.$require("corelib/regexp"); + self.$require("corelib/variables"); + return self.$require("opal/regexp_anchors"); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/string/encoding"] = function(Opal) { + function $rb_plus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); + } + var TMP_12, TMP_15, TMP_18, TMP_21, TMP_24, self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $hash2 = Opal.hash2, $truthy = Opal.truthy, $send = Opal.send; + + Opal.add_stubs(['$require', '$+', '$[]', '$new', '$to_proc', '$each', '$const_set', '$sub', '$==', '$default_external', '$upcase', '$raise', '$attr_accessor', '$attr_reader', '$register', '$length', '$bytes', '$to_a', '$each_byte', '$bytesize', '$enum_for', '$force_encoding', '$dup', '$coerce_to!', '$find', '$getbyte']); + + self.$require("corelib/string"); + (function($base, $super, $parent_nesting) { + function $Encoding(){}; + var self = $Encoding = $klass($base, $super, 'Encoding', $Encoding); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Encoding_register_1, TMP_Encoding_find_3, TMP_Encoding_initialize_4, TMP_Encoding_ascii_compatible$q_5, TMP_Encoding_dummy$q_6, TMP_Encoding_to_s_7, TMP_Encoding_inspect_8, TMP_Encoding_each_byte_9, TMP_Encoding_getbyte_10, TMP_Encoding_bytesize_11; + + def.ascii = def.dummy = def.name = nil; + + Opal.defineProperty(self, '$$register', {}); + Opal.defs(self, '$register', TMP_Encoding_register_1 = function $$register(name, options) { + var $iter = TMP_Encoding_register_1.$$p, block = $iter || nil, $a, TMP_2, self = this, names = nil, encoding = nil, register = nil; + + if ($iter) TMP_Encoding_register_1.$$p = null; + + + if ($iter) TMP_Encoding_register_1.$$p = null;; + + if (options == null) { + options = $hash2([], {}); + }; + names = $rb_plus([name], ($truthy($a = options['$[]']("aliases")) ? $a : [])); + encoding = $send($$($nesting, 'Class'), 'new', [self], block.$to_proc()).$new(name, names, ($truthy($a = options['$[]']("ascii")) ? $a : false), ($truthy($a = options['$[]']("dummy")) ? $a : false)); + register = self["$$register"]; + return $send(names, 'each', [], (TMP_2 = function(encoding_name){var self = TMP_2.$$s || this; + + + + if (encoding_name == null) { + encoding_name = nil; + }; + self.$const_set(encoding_name.$sub("-", "_"), encoding); + return register["" + "$$" + (encoding_name)] = encoding;}, TMP_2.$$s = self, TMP_2.$$arity = 1, TMP_2)); + }, TMP_Encoding_register_1.$$arity = -2); + Opal.defs(self, '$find', TMP_Encoding_find_3 = function $$find(name) { + var $a, self = this, register = nil, encoding = nil; + + + if (name['$==']("default_external")) { + return self.$default_external()}; + register = self["$$register"]; + encoding = ($truthy($a = register["" + "$$" + (name)]) ? $a : register["" + "$$" + (name.$upcase())]); + if ($truthy(encoding)) { + } else { + self.$raise($$($nesting, 'ArgumentError'), "" + "unknown encoding name - " + (name)) + }; + return encoding; + }, TMP_Encoding_find_3.$$arity = 1); + (function(self, $parent_nesting) { + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return self.$attr_accessor("default_external") + })(Opal.get_singleton_class(self), $nesting); + self.$attr_reader("name", "names"); + + Opal.def(self, '$initialize', TMP_Encoding_initialize_4 = function $$initialize(name, names, ascii, dummy) { + var self = this; + + + self.name = name; + self.names = names; + self.ascii = ascii; + return (self.dummy = dummy); + }, TMP_Encoding_initialize_4.$$arity = 4); + + Opal.def(self, '$ascii_compatible?', TMP_Encoding_ascii_compatible$q_5 = function() { + var self = this; + + return self.ascii + }, TMP_Encoding_ascii_compatible$q_5.$$arity = 0); + + Opal.def(self, '$dummy?', TMP_Encoding_dummy$q_6 = function() { + var self = this; + + return self.dummy + }, TMP_Encoding_dummy$q_6.$$arity = 0); + + Opal.def(self, '$to_s', TMP_Encoding_to_s_7 = function $$to_s() { + var self = this; + + return self.name + }, TMP_Encoding_to_s_7.$$arity = 0); + + Opal.def(self, '$inspect', TMP_Encoding_inspect_8 = function $$inspect() { + var self = this; + + return "" + "#" + }, TMP_Encoding_inspect_8.$$arity = 0); + + Opal.def(self, '$each_byte', TMP_Encoding_each_byte_9 = function $$each_byte($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return self.$raise($$($nesting, 'NotImplementedError')); + }, TMP_Encoding_each_byte_9.$$arity = -1); + + Opal.def(self, '$getbyte', TMP_Encoding_getbyte_10 = function $$getbyte($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return self.$raise($$($nesting, 'NotImplementedError')); + }, TMP_Encoding_getbyte_10.$$arity = -1); + + Opal.def(self, '$bytesize', TMP_Encoding_bytesize_11 = function $$bytesize($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return self.$raise($$($nesting, 'NotImplementedError')); + }, TMP_Encoding_bytesize_11.$$arity = -1); + (function($base, $super, $parent_nesting) { + function $EncodingError(){}; + var self = $EncodingError = $klass($base, $super, 'EncodingError', $EncodingError); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return nil + })($nesting[0], $$($nesting, 'StandardError'), $nesting); + return (function($base, $super, $parent_nesting) { + function $CompatibilityError(){}; + var self = $CompatibilityError = $klass($base, $super, 'CompatibilityError', $CompatibilityError); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return nil + })($nesting[0], $$($nesting, 'EncodingError'), $nesting); + })($nesting[0], null, $nesting); + $send($$($nesting, 'Encoding'), 'register', ["UTF-8", $hash2(["aliases", "ascii"], {"aliases": ["CP65001"], "ascii": true})], (TMP_12 = function(){var self = TMP_12.$$s || this, TMP_each_byte_13, TMP_bytesize_14; + + + + Opal.def(self, '$each_byte', TMP_each_byte_13 = function $$each_byte(string) { + var $iter = TMP_each_byte_13.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_each_byte_13.$$p = null; + + + if ($iter) TMP_each_byte_13.$$p = null;; + + for (var i = 0, length = string.length; i < length; i++) { + var code = string.charCodeAt(i); + + if (code <= 0x7f) { + Opal.yield1(block, code); + } + else { + var encoded = encodeURIComponent(string.charAt(i)).substr(1).split('%'); + + for (var j = 0, encoded_length = encoded.length; j < encoded_length; j++) { + Opal.yield1(block, parseInt(encoded[j], 16)); + } + } + } + ; + }, TMP_each_byte_13.$$arity = 1); + return (Opal.def(self, '$bytesize', TMP_bytesize_14 = function $$bytesize(string) { + var self = this; + + return string.$bytes().$length() + }, TMP_bytesize_14.$$arity = 1), nil) && 'bytesize';}, TMP_12.$$s = self, TMP_12.$$arity = 0, TMP_12)); + $send($$($nesting, 'Encoding'), 'register', ["UTF-16LE"], (TMP_15 = function(){var self = TMP_15.$$s || this, TMP_each_byte_16, TMP_bytesize_17; + + + + Opal.def(self, '$each_byte', TMP_each_byte_16 = function $$each_byte(string) { + var $iter = TMP_each_byte_16.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_each_byte_16.$$p = null; + + + if ($iter) TMP_each_byte_16.$$p = null;; + + for (var i = 0, length = string.length; i < length; i++) { + var code = string.charCodeAt(i); + + Opal.yield1(block, code & 0xff); + Opal.yield1(block, code >> 8); + } + ; + }, TMP_each_byte_16.$$arity = 1); + return (Opal.def(self, '$bytesize', TMP_bytesize_17 = function $$bytesize(string) { + var self = this; + + return string.$bytes().$length() + }, TMP_bytesize_17.$$arity = 1), nil) && 'bytesize';}, TMP_15.$$s = self, TMP_15.$$arity = 0, TMP_15)); + $send($$($nesting, 'Encoding'), 'register', ["UTF-16BE"], (TMP_18 = function(){var self = TMP_18.$$s || this, TMP_each_byte_19, TMP_bytesize_20; + + + + Opal.def(self, '$each_byte', TMP_each_byte_19 = function $$each_byte(string) { + var $iter = TMP_each_byte_19.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_each_byte_19.$$p = null; + + + if ($iter) TMP_each_byte_19.$$p = null;; + + for (var i = 0, length = string.length; i < length; i++) { + var code = string.charCodeAt(i); + + Opal.yield1(block, code >> 8); + Opal.yield1(block, code & 0xff); + } + ; + }, TMP_each_byte_19.$$arity = 1); + return (Opal.def(self, '$bytesize', TMP_bytesize_20 = function $$bytesize(string) { + var self = this; + + return string.$bytes().$length() + }, TMP_bytesize_20.$$arity = 1), nil) && 'bytesize';}, TMP_18.$$s = self, TMP_18.$$arity = 0, TMP_18)); + $send($$($nesting, 'Encoding'), 'register', ["UTF-32LE"], (TMP_21 = function(){var self = TMP_21.$$s || this, TMP_each_byte_22, TMP_bytesize_23; + + + + Opal.def(self, '$each_byte', TMP_each_byte_22 = function $$each_byte(string) { + var $iter = TMP_each_byte_22.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_each_byte_22.$$p = null; + + + if ($iter) TMP_each_byte_22.$$p = null;; + + for (var i = 0, length = string.length; i < length; i++) { + var code = string.charCodeAt(i); + + Opal.yield1(block, code & 0xff); + Opal.yield1(block, code >> 8); + } + ; + }, TMP_each_byte_22.$$arity = 1); + return (Opal.def(self, '$bytesize', TMP_bytesize_23 = function $$bytesize(string) { + var self = this; + + return string.$bytes().$length() + }, TMP_bytesize_23.$$arity = 1), nil) && 'bytesize';}, TMP_21.$$s = self, TMP_21.$$arity = 0, TMP_21)); + $send($$($nesting, 'Encoding'), 'register', ["ASCII-8BIT", $hash2(["aliases", "ascii", "dummy"], {"aliases": ["BINARY", "US-ASCII", "ASCII"], "ascii": true, "dummy": true})], (TMP_24 = function(){var self = TMP_24.$$s || this, TMP_each_byte_25, TMP_bytesize_26; + + + + Opal.def(self, '$each_byte', TMP_each_byte_25 = function $$each_byte(string) { + var $iter = TMP_each_byte_25.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_each_byte_25.$$p = null; + + + if ($iter) TMP_each_byte_25.$$p = null;; + + for (var i = 0, length = string.length; i < length; i++) { + var code = string.charCodeAt(i); + Opal.yield1(block, code & 0xff); + Opal.yield1(block, code >> 8); + } + ; + }, TMP_each_byte_25.$$arity = 1); + return (Opal.def(self, '$bytesize', TMP_bytesize_26 = function $$bytesize(string) { + var self = this; + + return string.$bytes().$length() + }, TMP_bytesize_26.$$arity = 1), nil) && 'bytesize';}, TMP_24.$$s = self, TMP_24.$$arity = 0, TMP_24)); + return (function($base, $super, $parent_nesting) { + function $String(){}; + var self = $String = $klass($base, $super, 'String', $String); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_String_bytes_27, TMP_String_bytesize_28, TMP_String_each_byte_29, TMP_String_encode_30, TMP_String_force_encoding_31, TMP_String_getbyte_32, TMP_String_valid_encoding$q_33; + + def.encoding = nil; + + self.$attr_reader("encoding"); + Opal.defineProperty(String.prototype, 'encoding', $$$($$($nesting, 'Encoding'), 'UTF_16LE')); + + Opal.def(self, '$bytes', TMP_String_bytes_27 = function $$bytes() { + var self = this; + + return self.$each_byte().$to_a() + }, TMP_String_bytes_27.$$arity = 0); + + Opal.def(self, '$bytesize', TMP_String_bytesize_28 = function $$bytesize() { + var self = this; + + return self.encoding.$bytesize(self) + }, TMP_String_bytesize_28.$$arity = 0); + + Opal.def(self, '$each_byte', TMP_String_each_byte_29 = function $$each_byte() { + var $iter = TMP_String_each_byte_29.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_String_each_byte_29.$$p = null; + + + if ($iter) TMP_String_each_byte_29.$$p = null;; + if ((block !== nil)) { + } else { + return self.$enum_for("each_byte") + }; + $send(self.encoding, 'each_byte', [self], block.$to_proc()); + return self; + }, TMP_String_each_byte_29.$$arity = 0); + + Opal.def(self, '$encode', TMP_String_encode_30 = function $$encode(encoding) { + var self = this; + + return self.$dup().$force_encoding(encoding) + }, TMP_String_encode_30.$$arity = 1); + + Opal.def(self, '$force_encoding', TMP_String_force_encoding_31 = function $$force_encoding(encoding) { + var self = this; + + + if (encoding === self.encoding) { return self; } + + encoding = $$($nesting, 'Opal')['$coerce_to!'](encoding, $$($nesting, 'String'), "to_s"); + encoding = $$($nesting, 'Encoding').$find(encoding); + + if (encoding === self.encoding) { return self; } + + self.encoding = encoding; + return self; + + }, TMP_String_force_encoding_31.$$arity = 1); + + Opal.def(self, '$getbyte', TMP_String_getbyte_32 = function $$getbyte(idx) { + var self = this; + + return self.encoding.$getbyte(self, idx) + }, TMP_String_getbyte_32.$$arity = 1); + return (Opal.def(self, '$valid_encoding?', TMP_String_valid_encoding$q_33 = function() { + var self = this; + + return true + }, TMP_String_valid_encoding$q_33.$$arity = 0), nil) && 'valid_encoding?'; + })($nesting[0], null, $nesting); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/math"] = function(Opal) { + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + function $rb_divide(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs / rhs : lhs['$/'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $truthy = Opal.truthy; + + Opal.add_stubs(['$new', '$raise', '$Float', '$type_error', '$Integer', '$module_function', '$checked', '$float!', '$===', '$gamma', '$-', '$integer!', '$/', '$infinite?']); + return (function($base, $parent_nesting) { + function $Math() {}; + var self = $Math = $module($base, 'Math', $Math); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Math_checked_1, TMP_Math_float$B_2, TMP_Math_integer$B_3, TMP_Math_acos_4, TMP_Math_acosh_5, TMP_Math_asin_6, TMP_Math_asinh_7, TMP_Math_atan_8, TMP_Math_atan2_9, TMP_Math_atanh_10, TMP_Math_cbrt_11, TMP_Math_cos_12, TMP_Math_cosh_13, TMP_Math_erf_14, TMP_Math_erfc_15, TMP_Math_exp_16, TMP_Math_frexp_17, TMP_Math_gamma_18, TMP_Math_hypot_19, TMP_Math_ldexp_20, TMP_Math_lgamma_21, TMP_Math_log_22, TMP_Math_log10_23, TMP_Math_log2_24, TMP_Math_sin_25, TMP_Math_sinh_26, TMP_Math_sqrt_27, TMP_Math_tan_28, TMP_Math_tanh_29; + + + Opal.const_set($nesting[0], 'E', Math.E); + Opal.const_set($nesting[0], 'PI', Math.PI); + Opal.const_set($nesting[0], 'DomainError', $$($nesting, 'Class').$new($$($nesting, 'StandardError'))); + Opal.defs(self, '$checked', TMP_Math_checked_1 = function $$checked(method, $a) { + var $post_args, args, self = this; + + + + $post_args = Opal.slice.call(arguments, 1, arguments.length); + + args = $post_args;; + + if (isNaN(args[0]) || (args.length == 2 && isNaN(args[1]))) { + return NaN; + } + + var result = Math[method].apply(null, args); + + if (isNaN(result)) { + self.$raise($$($nesting, 'DomainError'), "" + "Numerical argument is out of domain - \"" + (method) + "\""); + } + + return result; + ; + }, TMP_Math_checked_1.$$arity = -2); + Opal.defs(self, '$float!', TMP_Math_float$B_2 = function(value) { + var self = this; + + try { + return self.$Float(value) + } catch ($err) { + if (Opal.rescue($err, [$$($nesting, 'ArgumentError')])) { + try { + return self.$raise($$($nesting, 'Opal').$type_error(value, $$($nesting, 'Float'))) + } finally { Opal.pop_exception() } + } else { throw $err; } + } + }, TMP_Math_float$B_2.$$arity = 1); + Opal.defs(self, '$integer!', TMP_Math_integer$B_3 = function(value) { + var self = this; + + try { + return self.$Integer(value) + } catch ($err) { + if (Opal.rescue($err, [$$($nesting, 'ArgumentError')])) { + try { + return self.$raise($$($nesting, 'Opal').$type_error(value, $$($nesting, 'Integer'))) + } finally { Opal.pop_exception() } + } else { throw $err; } + } + }, TMP_Math_integer$B_3.$$arity = 1); + self.$module_function(); + + Opal.def(self, '$acos', TMP_Math_acos_4 = function $$acos(x) { + var self = this; + + return $$($nesting, 'Math').$checked("acos", $$($nesting, 'Math')['$float!'](x)) + }, TMP_Math_acos_4.$$arity = 1); + if ($truthy((typeof(Math.acosh) !== "undefined"))) { + } else { + + Math.acosh = function(x) { + return Math.log(x + Math.sqrt(x * x - 1)); + } + + }; + + Opal.def(self, '$acosh', TMP_Math_acosh_5 = function $$acosh(x) { + var self = this; + + return $$($nesting, 'Math').$checked("acosh", $$($nesting, 'Math')['$float!'](x)) + }, TMP_Math_acosh_5.$$arity = 1); + + Opal.def(self, '$asin', TMP_Math_asin_6 = function $$asin(x) { + var self = this; + + return $$($nesting, 'Math').$checked("asin", $$($nesting, 'Math')['$float!'](x)) + }, TMP_Math_asin_6.$$arity = 1); + if ($truthy((typeof(Math.asinh) !== "undefined"))) { + } else { + + Math.asinh = function(x) { + return Math.log(x + Math.sqrt(x * x + 1)) + } + + }; + + Opal.def(self, '$asinh', TMP_Math_asinh_7 = function $$asinh(x) { + var self = this; + + return $$($nesting, 'Math').$checked("asinh", $$($nesting, 'Math')['$float!'](x)) + }, TMP_Math_asinh_7.$$arity = 1); + + Opal.def(self, '$atan', TMP_Math_atan_8 = function $$atan(x) { + var self = this; + + return $$($nesting, 'Math').$checked("atan", $$($nesting, 'Math')['$float!'](x)) + }, TMP_Math_atan_8.$$arity = 1); + + Opal.def(self, '$atan2', TMP_Math_atan2_9 = function $$atan2(y, x) { + var self = this; + + return $$($nesting, 'Math').$checked("atan2", $$($nesting, 'Math')['$float!'](y), $$($nesting, 'Math')['$float!'](x)) + }, TMP_Math_atan2_9.$$arity = 2); + if ($truthy((typeof(Math.atanh) !== "undefined"))) { + } else { + + Math.atanh = function(x) { + return 0.5 * Math.log((1 + x) / (1 - x)); + } + + }; + + Opal.def(self, '$atanh', TMP_Math_atanh_10 = function $$atanh(x) { + var self = this; + + return $$($nesting, 'Math').$checked("atanh", $$($nesting, 'Math')['$float!'](x)) + }, TMP_Math_atanh_10.$$arity = 1); + if ($truthy((typeof(Math.cbrt) !== "undefined"))) { + } else { + + Math.cbrt = function(x) { + if (x == 0) { + return 0; + } + + if (x < 0) { + return -Math.cbrt(-x); + } + + var r = x, + ex = 0; + + while (r < 0.125) { + r *= 8; + ex--; + } + + while (r > 1.0) { + r *= 0.125; + ex++; + } + + r = (-0.46946116 * r + 1.072302) * r + 0.3812513; + + while (ex < 0) { + r *= 0.5; + ex++; + } + + while (ex > 0) { + r *= 2; + ex--; + } + + r = (2.0 / 3.0) * r + (1.0 / 3.0) * x / (r * r); + r = (2.0 / 3.0) * r + (1.0 / 3.0) * x / (r * r); + r = (2.0 / 3.0) * r + (1.0 / 3.0) * x / (r * r); + r = (2.0 / 3.0) * r + (1.0 / 3.0) * x / (r * r); + + return r; + } + + }; + + Opal.def(self, '$cbrt', TMP_Math_cbrt_11 = function $$cbrt(x) { + var self = this; + + return $$($nesting, 'Math').$checked("cbrt", $$($nesting, 'Math')['$float!'](x)) + }, TMP_Math_cbrt_11.$$arity = 1); + + Opal.def(self, '$cos', TMP_Math_cos_12 = function $$cos(x) { + var self = this; + + return $$($nesting, 'Math').$checked("cos", $$($nesting, 'Math')['$float!'](x)) + }, TMP_Math_cos_12.$$arity = 1); + if ($truthy((typeof(Math.cosh) !== "undefined"))) { + } else { + + Math.cosh = function(x) { + return (Math.exp(x) + Math.exp(-x)) / 2; + } + + }; + + Opal.def(self, '$cosh', TMP_Math_cosh_13 = function $$cosh(x) { + var self = this; + + return $$($nesting, 'Math').$checked("cosh", $$($nesting, 'Math')['$float!'](x)) + }, TMP_Math_cosh_13.$$arity = 1); + if ($truthy((typeof(Math.erf) !== "undefined"))) { + } else { + + Opal.defineProperty(Math, 'erf', function(x) { + var A1 = 0.254829592, + A2 = -0.284496736, + A3 = 1.421413741, + A4 = -1.453152027, + A5 = 1.061405429, + P = 0.3275911; + + var sign = 1; + + if (x < 0) { + sign = -1; + } + + x = Math.abs(x); + + var t = 1.0 / (1.0 + P * x); + var y = 1.0 - (((((A5 * t + A4) * t) + A3) * t + A2) * t + A1) * t * Math.exp(-x * x); + + return sign * y; + }); + + }; + + Opal.def(self, '$erf', TMP_Math_erf_14 = function $$erf(x) { + var self = this; + + return $$($nesting, 'Math').$checked("erf", $$($nesting, 'Math')['$float!'](x)) + }, TMP_Math_erf_14.$$arity = 1); + if ($truthy((typeof(Math.erfc) !== "undefined"))) { + } else { + + Opal.defineProperty(Math, 'erfc', function(x) { + var z = Math.abs(x), + t = 1.0 / (0.5 * z + 1.0); + + var A1 = t * 0.17087277 + -0.82215223, + A2 = t * A1 + 1.48851587, + A3 = t * A2 + -1.13520398, + A4 = t * A3 + 0.27886807, + A5 = t * A4 + -0.18628806, + A6 = t * A5 + 0.09678418, + A7 = t * A6 + 0.37409196, + A8 = t * A7 + 1.00002368, + A9 = t * A8, + A10 = -z * z - 1.26551223 + A9; + + var a = t * Math.exp(A10); + + if (x < 0.0) { + return 2.0 - a; + } + else { + return a; + } + }); + + }; + + Opal.def(self, '$erfc', TMP_Math_erfc_15 = function $$erfc(x) { + var self = this; + + return $$($nesting, 'Math').$checked("erfc", $$($nesting, 'Math')['$float!'](x)) + }, TMP_Math_erfc_15.$$arity = 1); + + Opal.def(self, '$exp', TMP_Math_exp_16 = function $$exp(x) { + var self = this; + + return $$($nesting, 'Math').$checked("exp", $$($nesting, 'Math')['$float!'](x)) + }, TMP_Math_exp_16.$$arity = 1); + + Opal.def(self, '$frexp', TMP_Math_frexp_17 = function $$frexp(x) { + var self = this; + + + x = $$($nesting, 'Math')['$float!'](x); + + if (isNaN(x)) { + return [NaN, 0]; + } + + var ex = Math.floor(Math.log(Math.abs(x)) / Math.log(2)) + 1, + frac = x / Math.pow(2, ex); + + return [frac, ex]; + ; + }, TMP_Math_frexp_17.$$arity = 1); + + Opal.def(self, '$gamma', TMP_Math_gamma_18 = function $$gamma(n) { + var self = this; + + + n = $$($nesting, 'Math')['$float!'](n); + + var i, t, x, value, result, twoN, threeN, fourN, fiveN; + + var G = 4.7421875; + + var P = [ + 0.99999999999999709182, + 57.156235665862923517, + -59.597960355475491248, + 14.136097974741747174, + -0.49191381609762019978, + 0.33994649984811888699e-4, + 0.46523628927048575665e-4, + -0.98374475304879564677e-4, + 0.15808870322491248884e-3, + -0.21026444172410488319e-3, + 0.21743961811521264320e-3, + -0.16431810653676389022e-3, + 0.84418223983852743293e-4, + -0.26190838401581408670e-4, + 0.36899182659531622704e-5 + ]; + + + if (isNaN(n)) { + return NaN; + } + + if (n === 0 && 1 / n < 0) { + return -Infinity; + } + + if (n === -1 || n === -Infinity) { + self.$raise($$($nesting, 'DomainError'), "Numerical argument is out of domain - \"gamma\""); + } + + if ($$($nesting, 'Integer')['$==='](n)) { + if (n <= 0) { + return isFinite(n) ? Infinity : NaN; + } + + if (n > 171) { + return Infinity; + } + + value = n - 2; + result = n - 1; + + while (value > 1) { + result *= value; + value--; + } + + if (result == 0) { + result = 1; + } + + return result; + } + + if (n < 0.5) { + return Math.PI / (Math.sin(Math.PI * n) * $$($nesting, 'Math').$gamma($rb_minus(1, n))); + } + + if (n >= 171.35) { + return Infinity; + } + + if (n > 85.0) { + twoN = n * n; + threeN = twoN * n; + fourN = threeN * n; + fiveN = fourN * n; + + return Math.sqrt(2 * Math.PI / n) * Math.pow((n / Math.E), n) * + (1 + 1 / (12 * n) + 1 / (288 * twoN) - 139 / (51840 * threeN) - + 571 / (2488320 * fourN) + 163879 / (209018880 * fiveN) + + 5246819 / (75246796800 * fiveN * n)); + } + + n -= 1; + x = P[0]; + + for (i = 1; i < P.length; ++i) { + x += P[i] / (n + i); + } + + t = n + G + 0.5; + + return Math.sqrt(2 * Math.PI) * Math.pow(t, n + 0.5) * Math.exp(-t) * x; + ; + }, TMP_Math_gamma_18.$$arity = 1); + if ($truthy((typeof(Math.hypot) !== "undefined"))) { + } else { + + Math.hypot = function(x, y) { + return Math.sqrt(x * x + y * y) + } + + }; + + Opal.def(self, '$hypot', TMP_Math_hypot_19 = function $$hypot(x, y) { + var self = this; + + return $$($nesting, 'Math').$checked("hypot", $$($nesting, 'Math')['$float!'](x), $$($nesting, 'Math')['$float!'](y)) + }, TMP_Math_hypot_19.$$arity = 2); + + Opal.def(self, '$ldexp', TMP_Math_ldexp_20 = function $$ldexp(mantissa, exponent) { + var self = this; + + + mantissa = $$($nesting, 'Math')['$float!'](mantissa); + exponent = $$($nesting, 'Math')['$integer!'](exponent); + + if (isNaN(exponent)) { + self.$raise($$($nesting, 'RangeError'), "float NaN out of range of integer"); + } + + return mantissa * Math.pow(2, exponent); + ; + }, TMP_Math_ldexp_20.$$arity = 2); + + Opal.def(self, '$lgamma', TMP_Math_lgamma_21 = function $$lgamma(n) { + var self = this; + + + if (n == -1) { + return [Infinity, 1]; + } + else { + return [Math.log(Math.abs($$($nesting, 'Math').$gamma(n))), $$($nesting, 'Math').$gamma(n) < 0 ? -1 : 1]; + } + + }, TMP_Math_lgamma_21.$$arity = 1); + + Opal.def(self, '$log', TMP_Math_log_22 = function $$log(x, base) { + var self = this; + + + ; + if ($truthy($$($nesting, 'String')['$==='](x))) { + self.$raise($$($nesting, 'Opal').$type_error(x, $$($nesting, 'Float')))}; + if ($truthy(base == null)) { + return $$($nesting, 'Math').$checked("log", $$($nesting, 'Math')['$float!'](x)) + } else { + + if ($truthy($$($nesting, 'String')['$==='](base))) { + self.$raise($$($nesting, 'Opal').$type_error(base, $$($nesting, 'Float')))}; + return $rb_divide($$($nesting, 'Math').$checked("log", $$($nesting, 'Math')['$float!'](x)), $$($nesting, 'Math').$checked("log", $$($nesting, 'Math')['$float!'](base))); + }; + }, TMP_Math_log_22.$$arity = -2); + if ($truthy((typeof(Math.log10) !== "undefined"))) { + } else { + + Math.log10 = function(x) { + return Math.log(x) / Math.LN10; + } + + }; + + Opal.def(self, '$log10', TMP_Math_log10_23 = function $$log10(x) { + var self = this; + + + if ($truthy($$($nesting, 'String')['$==='](x))) { + self.$raise($$($nesting, 'Opal').$type_error(x, $$($nesting, 'Float')))}; + return $$($nesting, 'Math').$checked("log10", $$($nesting, 'Math')['$float!'](x)); + }, TMP_Math_log10_23.$$arity = 1); + if ($truthy((typeof(Math.log2) !== "undefined"))) { + } else { + + Math.log2 = function(x) { + return Math.log(x) / Math.LN2; + } + + }; + + Opal.def(self, '$log2', TMP_Math_log2_24 = function $$log2(x) { + var self = this; + + + if ($truthy($$($nesting, 'String')['$==='](x))) { + self.$raise($$($nesting, 'Opal').$type_error(x, $$($nesting, 'Float')))}; + return $$($nesting, 'Math').$checked("log2", $$($nesting, 'Math')['$float!'](x)); + }, TMP_Math_log2_24.$$arity = 1); + + Opal.def(self, '$sin', TMP_Math_sin_25 = function $$sin(x) { + var self = this; + + return $$($nesting, 'Math').$checked("sin", $$($nesting, 'Math')['$float!'](x)) + }, TMP_Math_sin_25.$$arity = 1); + if ($truthy((typeof(Math.sinh) !== "undefined"))) { + } else { + + Math.sinh = function(x) { + return (Math.exp(x) - Math.exp(-x)) / 2; + } + + }; + + Opal.def(self, '$sinh', TMP_Math_sinh_26 = function $$sinh(x) { + var self = this; + + return $$($nesting, 'Math').$checked("sinh", $$($nesting, 'Math')['$float!'](x)) + }, TMP_Math_sinh_26.$$arity = 1); + + Opal.def(self, '$sqrt', TMP_Math_sqrt_27 = function $$sqrt(x) { + var self = this; + + return $$($nesting, 'Math').$checked("sqrt", $$($nesting, 'Math')['$float!'](x)) + }, TMP_Math_sqrt_27.$$arity = 1); + + Opal.def(self, '$tan', TMP_Math_tan_28 = function $$tan(x) { + var self = this; + + + x = $$($nesting, 'Math')['$float!'](x); + if ($truthy(x['$infinite?']())) { + return $$$($$($nesting, 'Float'), 'NAN')}; + return $$($nesting, 'Math').$checked("tan", $$($nesting, 'Math')['$float!'](x)); + }, TMP_Math_tan_28.$$arity = 1); + if ($truthy((typeof(Math.tanh) !== "undefined"))) { + } else { + + Math.tanh = function(x) { + if (x == Infinity) { + return 1; + } + else if (x == -Infinity) { + return -1; + } + else { + return (Math.exp(x) - Math.exp(-x)) / (Math.exp(x) + Math.exp(-x)); + } + } + + }; + + Opal.def(self, '$tanh', TMP_Math_tanh_29 = function $$tanh(x) { + var self = this; + + return $$($nesting, 'Math').$checked("tanh", $$($nesting, 'Math')['$float!'](x)) + }, TMP_Math_tanh_29.$$arity = 1); + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/complex"] = function(Opal) { + function $rb_times(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs * rhs : lhs['$*'](rhs); + } + function $rb_plus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); + } + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + function $rb_divide(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs / rhs : lhs['$/'](rhs); + } + function $rb_gt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $truthy = Opal.truthy, $module = Opal.module; + + Opal.add_stubs(['$require', '$===', '$real?', '$raise', '$new', '$*', '$cos', '$sin', '$attr_reader', '$class', '$==', '$real', '$imag', '$Complex', '$-@', '$+', '$__coerced__', '$-', '$nan?', '$/', '$conj', '$abs2', '$quo', '$polar', '$exp', '$log', '$>', '$!=', '$divmod', '$**', '$hypot', '$atan2', '$lcm', '$denominator', '$finite?', '$infinite?', '$numerator', '$abs', '$arg', '$rationalize', '$to_f', '$to_i', '$to_r', '$inspect', '$positive?', '$zero?', '$Rational']); + + self.$require("corelib/numeric"); + (function($base, $super, $parent_nesting) { + function $Complex(){}; + var self = $Complex = $klass($base, $super, 'Complex', $Complex); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Complex_rect_1, TMP_Complex_polar_2, TMP_Complex_initialize_3, TMP_Complex_coerce_4, TMP_Complex_$eq$eq_5, TMP_Complex_$$_6, TMP_Complex_$_7, TMP_Complex_$_8, TMP_Complex_$_9, TMP_Complex_$_10, TMP_Complex_$$_11, TMP_Complex_abs_12, TMP_Complex_abs2_13, TMP_Complex_angle_14, TMP_Complex_conj_15, TMP_Complex_denominator_16, TMP_Complex_eql$q_17, TMP_Complex_fdiv_18, TMP_Complex_finite$q_19, TMP_Complex_hash_20, TMP_Complex_infinite$q_21, TMP_Complex_inspect_22, TMP_Complex_numerator_23, TMP_Complex_polar_24, TMP_Complex_rationalize_25, TMP_Complex_real$q_26, TMP_Complex_rect_27, TMP_Complex_to_f_28, TMP_Complex_to_i_29, TMP_Complex_to_r_30, TMP_Complex_to_s_31; + + def.real = def.imag = nil; + + Opal.defs(self, '$rect', TMP_Complex_rect_1 = function $$rect(real, imag) { + var $a, $b, $c, self = this; + + + + if (imag == null) { + imag = 0; + }; + if ($truthy(($truthy($a = ($truthy($b = ($truthy($c = $$($nesting, 'Numeric')['$==='](real)) ? real['$real?']() : $c)) ? $$($nesting, 'Numeric')['$==='](imag) : $b)) ? imag['$real?']() : $a))) { + } else { + self.$raise($$($nesting, 'TypeError'), "not a real") + }; + return self.$new(real, imag); + }, TMP_Complex_rect_1.$$arity = -2); + (function(self, $parent_nesting) { + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return Opal.alias(self, "rectangular", "rect") + })(Opal.get_singleton_class(self), $nesting); + Opal.defs(self, '$polar', TMP_Complex_polar_2 = function $$polar(r, theta) { + var $a, $b, $c, self = this; + + + + if (theta == null) { + theta = 0; + }; + if ($truthy(($truthy($a = ($truthy($b = ($truthy($c = $$($nesting, 'Numeric')['$==='](r)) ? r['$real?']() : $c)) ? $$($nesting, 'Numeric')['$==='](theta) : $b)) ? theta['$real?']() : $a))) { + } else { + self.$raise($$($nesting, 'TypeError'), "not a real") + }; + return self.$new($rb_times(r, $$($nesting, 'Math').$cos(theta)), $rb_times(r, $$($nesting, 'Math').$sin(theta))); + }, TMP_Complex_polar_2.$$arity = -2); + self.$attr_reader("real", "imag"); + + Opal.def(self, '$initialize', TMP_Complex_initialize_3 = function $$initialize(real, imag) { + var self = this; + + + + if (imag == null) { + imag = 0; + }; + self.real = real; + return (self.imag = imag); + }, TMP_Complex_initialize_3.$$arity = -2); + + Opal.def(self, '$coerce', TMP_Complex_coerce_4 = function $$coerce(other) { + var $a, self = this; + + if ($truthy($$($nesting, 'Complex')['$==='](other))) { + return [other, self] + } else if ($truthy(($truthy($a = $$($nesting, 'Numeric')['$==='](other)) ? other['$real?']() : $a))) { + return [$$($nesting, 'Complex').$new(other, 0), self] + } else { + return self.$raise($$($nesting, 'TypeError'), "" + (other.$class()) + " can't be coerced into Complex") + } + }, TMP_Complex_coerce_4.$$arity = 1); + + Opal.def(self, '$==', TMP_Complex_$eq$eq_5 = function(other) { + var $a, self = this; + + if ($truthy($$($nesting, 'Complex')['$==='](other))) { + return (($a = self.real['$=='](other.$real())) ? self.imag['$=='](other.$imag()) : self.real['$=='](other.$real())) + } else if ($truthy(($truthy($a = $$($nesting, 'Numeric')['$==='](other)) ? other['$real?']() : $a))) { + return (($a = self.real['$=='](other)) ? self.imag['$=='](0) : self.real['$=='](other)) + } else { + return other['$=='](self) + } + }, TMP_Complex_$eq$eq_5.$$arity = 1); + + Opal.def(self, '$-@', TMP_Complex_$$_6 = function() { + var self = this; + + return self.$Complex(self.real['$-@'](), self.imag['$-@']()) + }, TMP_Complex_$$_6.$$arity = 0); + + Opal.def(self, '$+', TMP_Complex_$_7 = function(other) { + var $a, self = this; + + if ($truthy($$($nesting, 'Complex')['$==='](other))) { + return self.$Complex($rb_plus(self.real, other.$real()), $rb_plus(self.imag, other.$imag())) + } else if ($truthy(($truthy($a = $$($nesting, 'Numeric')['$==='](other)) ? other['$real?']() : $a))) { + return self.$Complex($rb_plus(self.real, other), self.imag) + } else { + return self.$__coerced__("+", other) + } + }, TMP_Complex_$_7.$$arity = 1); + + Opal.def(self, '$-', TMP_Complex_$_8 = function(other) { + var $a, self = this; + + if ($truthy($$($nesting, 'Complex')['$==='](other))) { + return self.$Complex($rb_minus(self.real, other.$real()), $rb_minus(self.imag, other.$imag())) + } else if ($truthy(($truthy($a = $$($nesting, 'Numeric')['$==='](other)) ? other['$real?']() : $a))) { + return self.$Complex($rb_minus(self.real, other), self.imag) + } else { + return self.$__coerced__("-", other) + } + }, TMP_Complex_$_8.$$arity = 1); + + Opal.def(self, '$*', TMP_Complex_$_9 = function(other) { + var $a, self = this; + + if ($truthy($$($nesting, 'Complex')['$==='](other))) { + return self.$Complex($rb_minus($rb_times(self.real, other.$real()), $rb_times(self.imag, other.$imag())), $rb_plus($rb_times(self.real, other.$imag()), $rb_times(self.imag, other.$real()))) + } else if ($truthy(($truthy($a = $$($nesting, 'Numeric')['$==='](other)) ? other['$real?']() : $a))) { + return self.$Complex($rb_times(self.real, other), $rb_times(self.imag, other)) + } else { + return self.$__coerced__("*", other) + } + }, TMP_Complex_$_9.$$arity = 1); + + Opal.def(self, '$/', TMP_Complex_$_10 = function(other) { + var $a, $b, $c, $d, self = this; + + if ($truthy($$($nesting, 'Complex')['$==='](other))) { + if ($truthy(($truthy($a = ($truthy($b = ($truthy($c = ($truthy($d = $$($nesting, 'Number')['$==='](self.real)) ? self.real['$nan?']() : $d)) ? $c : ($truthy($d = $$($nesting, 'Number')['$==='](self.imag)) ? self.imag['$nan?']() : $d))) ? $b : ($truthy($c = $$($nesting, 'Number')['$==='](other.$real())) ? other.$real()['$nan?']() : $c))) ? $a : ($truthy($b = $$($nesting, 'Number')['$==='](other.$imag())) ? other.$imag()['$nan?']() : $b)))) { + return $$($nesting, 'Complex').$new($$$($$($nesting, 'Float'), 'NAN'), $$$($$($nesting, 'Float'), 'NAN')) + } else { + return $rb_divide($rb_times(self, other.$conj()), other.$abs2()) + } + } else if ($truthy(($truthy($a = $$($nesting, 'Numeric')['$==='](other)) ? other['$real?']() : $a))) { + return self.$Complex(self.real.$quo(other), self.imag.$quo(other)) + } else { + return self.$__coerced__("/", other) + } + }, TMP_Complex_$_10.$$arity = 1); + + Opal.def(self, '$**', TMP_Complex_$$_11 = function(other) { + var $a, $b, $c, $d, self = this, r = nil, theta = nil, ore = nil, oim = nil, nr = nil, ntheta = nil, x = nil, z = nil, n = nil, div = nil, mod = nil; + + + if (other['$=='](0)) { + return $$($nesting, 'Complex').$new(1, 0)}; + if ($truthy($$($nesting, 'Complex')['$==='](other))) { + + $b = self.$polar(), $a = Opal.to_ary($b), (r = ($a[0] == null ? nil : $a[0])), (theta = ($a[1] == null ? nil : $a[1])), $b; + ore = other.$real(); + oim = other.$imag(); + nr = $$($nesting, 'Math').$exp($rb_minus($rb_times(ore, $$($nesting, 'Math').$log(r)), $rb_times(oim, theta))); + ntheta = $rb_plus($rb_times(theta, ore), $rb_times(oim, $$($nesting, 'Math').$log(r))); + return $$($nesting, 'Complex').$polar(nr, ntheta); + } else if ($truthy($$($nesting, 'Integer')['$==='](other))) { + if ($truthy($rb_gt(other, 0))) { + + x = self; + z = x; + n = $rb_minus(other, 1); + while ($truthy(n['$!='](0))) { + + $c = n.$divmod(2), $b = Opal.to_ary($c), (div = ($b[0] == null ? nil : $b[0])), (mod = ($b[1] == null ? nil : $b[1])), $c; + while (mod['$=='](0)) { + + x = self.$Complex($rb_minus($rb_times(x.$real(), x.$real()), $rb_times(x.$imag(), x.$imag())), $rb_times($rb_times(2, x.$real()), x.$imag())); + n = div; + $d = n.$divmod(2), $c = Opal.to_ary($d), (div = ($c[0] == null ? nil : $c[0])), (mod = ($c[1] == null ? nil : $c[1])), $d; + }; + z = $rb_times(z, x); + n = $rb_minus(n, 1); + }; + return z; + } else { + return $rb_divide($$($nesting, 'Rational').$new(1, 1), self)['$**'](other['$-@']()) + } + } else if ($truthy(($truthy($a = $$($nesting, 'Float')['$==='](other)) ? $a : $$($nesting, 'Rational')['$==='](other)))) { + + $b = self.$polar(), $a = Opal.to_ary($b), (r = ($a[0] == null ? nil : $a[0])), (theta = ($a[1] == null ? nil : $a[1])), $b; + return $$($nesting, 'Complex').$polar(r['$**'](other), $rb_times(theta, other)); + } else { + return self.$__coerced__("**", other) + }; + }, TMP_Complex_$$_11.$$arity = 1); + + Opal.def(self, '$abs', TMP_Complex_abs_12 = function $$abs() { + var self = this; + + return $$($nesting, 'Math').$hypot(self.real, self.imag) + }, TMP_Complex_abs_12.$$arity = 0); + + Opal.def(self, '$abs2', TMP_Complex_abs2_13 = function $$abs2() { + var self = this; + + return $rb_plus($rb_times(self.real, self.real), $rb_times(self.imag, self.imag)) + }, TMP_Complex_abs2_13.$$arity = 0); + + Opal.def(self, '$angle', TMP_Complex_angle_14 = function $$angle() { + var self = this; + + return $$($nesting, 'Math').$atan2(self.imag, self.real) + }, TMP_Complex_angle_14.$$arity = 0); + Opal.alias(self, "arg", "angle"); + + Opal.def(self, '$conj', TMP_Complex_conj_15 = function $$conj() { + var self = this; + + return self.$Complex(self.real, self.imag['$-@']()) + }, TMP_Complex_conj_15.$$arity = 0); + Opal.alias(self, "conjugate", "conj"); + + Opal.def(self, '$denominator', TMP_Complex_denominator_16 = function $$denominator() { + var self = this; + + return self.real.$denominator().$lcm(self.imag.$denominator()) + }, TMP_Complex_denominator_16.$$arity = 0); + Opal.alias(self, "divide", "/"); + + Opal.def(self, '$eql?', TMP_Complex_eql$q_17 = function(other) { + var $a, $b, self = this; + + return ($truthy($a = ($truthy($b = $$($nesting, 'Complex')['$==='](other)) ? self.real.$class()['$=='](self.imag.$class()) : $b)) ? self['$=='](other) : $a) + }, TMP_Complex_eql$q_17.$$arity = 1); + + Opal.def(self, '$fdiv', TMP_Complex_fdiv_18 = function $$fdiv(other) { + var self = this; + + + if ($truthy($$($nesting, 'Numeric')['$==='](other))) { + } else { + self.$raise($$($nesting, 'TypeError'), "" + (other.$class()) + " can't be coerced into Complex") + }; + return $rb_divide(self, other); + }, TMP_Complex_fdiv_18.$$arity = 1); + + Opal.def(self, '$finite?', TMP_Complex_finite$q_19 = function() { + var $a, self = this; + + return ($truthy($a = self.real['$finite?']()) ? self.imag['$finite?']() : $a) + }, TMP_Complex_finite$q_19.$$arity = 0); + + Opal.def(self, '$hash', TMP_Complex_hash_20 = function $$hash() { + var self = this; + + return "" + "Complex:" + (self.real) + ":" + (self.imag) + }, TMP_Complex_hash_20.$$arity = 0); + Opal.alias(self, "imaginary", "imag"); + + Opal.def(self, '$infinite?', TMP_Complex_infinite$q_21 = function() { + var $a, self = this; + + return ($truthy($a = self.real['$infinite?']()) ? $a : self.imag['$infinite?']()) + }, TMP_Complex_infinite$q_21.$$arity = 0); + + Opal.def(self, '$inspect', TMP_Complex_inspect_22 = function $$inspect() { + var self = this; + + return "" + "(" + (self) + ")" + }, TMP_Complex_inspect_22.$$arity = 0); + Opal.alias(self, "magnitude", "abs"); + + Opal.udef(self, '$' + "negative?");; + + Opal.def(self, '$numerator', TMP_Complex_numerator_23 = function $$numerator() { + var self = this, d = nil; + + + d = self.$denominator(); + return self.$Complex($rb_times(self.real.$numerator(), $rb_divide(d, self.real.$denominator())), $rb_times(self.imag.$numerator(), $rb_divide(d, self.imag.$denominator()))); + }, TMP_Complex_numerator_23.$$arity = 0); + Opal.alias(self, "phase", "arg"); + + Opal.def(self, '$polar', TMP_Complex_polar_24 = function $$polar() { + var self = this; + + return [self.$abs(), self.$arg()] + }, TMP_Complex_polar_24.$$arity = 0); + + Opal.udef(self, '$' + "positive?");; + Opal.alias(self, "quo", "/"); + + Opal.def(self, '$rationalize', TMP_Complex_rationalize_25 = function $$rationalize(eps) { + var self = this; + + + ; + + if (arguments.length > 1) { + self.$raise($$($nesting, 'ArgumentError'), "" + "wrong number of arguments (" + (arguments.length) + " for 0..1)"); + } + ; + if ($truthy(self.imag['$!='](0))) { + self.$raise($$($nesting, 'RangeError'), "" + "can't' convert " + (self) + " into Rational")}; + return self.$real().$rationalize(eps); + }, TMP_Complex_rationalize_25.$$arity = -1); + + Opal.def(self, '$real?', TMP_Complex_real$q_26 = function() { + var self = this; + + return false + }, TMP_Complex_real$q_26.$$arity = 0); + + Opal.def(self, '$rect', TMP_Complex_rect_27 = function $$rect() { + var self = this; + + return [self.real, self.imag] + }, TMP_Complex_rect_27.$$arity = 0); + Opal.alias(self, "rectangular", "rect"); + + Opal.def(self, '$to_f', TMP_Complex_to_f_28 = function $$to_f() { + var self = this; + + + if (self.imag['$=='](0)) { + } else { + self.$raise($$($nesting, 'RangeError'), "" + "can't convert " + (self) + " into Float") + }; + return self.real.$to_f(); + }, TMP_Complex_to_f_28.$$arity = 0); + + Opal.def(self, '$to_i', TMP_Complex_to_i_29 = function $$to_i() { + var self = this; + + + if (self.imag['$=='](0)) { + } else { + self.$raise($$($nesting, 'RangeError'), "" + "can't convert " + (self) + " into Integer") + }; + return self.real.$to_i(); + }, TMP_Complex_to_i_29.$$arity = 0); + + Opal.def(self, '$to_r', TMP_Complex_to_r_30 = function $$to_r() { + var self = this; + + + if (self.imag['$=='](0)) { + } else { + self.$raise($$($nesting, 'RangeError'), "" + "can't convert " + (self) + " into Rational") + }; + return self.real.$to_r(); + }, TMP_Complex_to_r_30.$$arity = 0); + + Opal.def(self, '$to_s', TMP_Complex_to_s_31 = function $$to_s() { + var $a, $b, $c, self = this, result = nil; + + + result = self.real.$inspect(); + result = $rb_plus(result, (function() {if ($truthy(($truthy($a = ($truthy($b = ($truthy($c = $$($nesting, 'Number')['$==='](self.imag)) ? self.imag['$nan?']() : $c)) ? $b : self.imag['$positive?']())) ? $a : self.imag['$zero?']()))) { + return "+" + } else { + return "-" + }; return nil; })()); + result = $rb_plus(result, self.imag.$abs().$inspect()); + if ($truthy(($truthy($a = $$($nesting, 'Number')['$==='](self.imag)) ? ($truthy($b = self.imag['$nan?']()) ? $b : self.imag['$infinite?']()) : $a))) { + result = $rb_plus(result, "*")}; + return $rb_plus(result, "i"); + }, TMP_Complex_to_s_31.$$arity = 0); + return Opal.const_set($nesting[0], 'I', self.$new(0, 1)); + })($nesting[0], $$($nesting, 'Numeric'), $nesting); + (function($base, $parent_nesting) { + function $Kernel() {}; + var self = $Kernel = $module($base, 'Kernel', $Kernel); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Kernel_Complex_32; + + + Opal.def(self, '$Complex', TMP_Kernel_Complex_32 = function $$Complex(real, imag) { + var self = this; + + + + if (imag == null) { + imag = nil; + }; + if ($truthy(imag)) { + return $$($nesting, 'Complex').$new(real, imag) + } else { + return $$($nesting, 'Complex').$new(real, 0) + }; + }, TMP_Kernel_Complex_32.$$arity = -2) + })($nesting[0], $nesting); + return (function($base, $super, $parent_nesting) { + function $String(){}; + var self = $String = $klass($base, $super, 'String', $String); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_String_to_c_33; + + return (Opal.def(self, '$to_c', TMP_String_to_c_33 = function $$to_c() { + var self = this; + + + var str = self, + re = /[+-]?[\d_]+(\.[\d_]+)?(e\d+)?/, + match = str.match(re), + real, imag, denominator; + + function isFloat() { + return re.test(str); + } + + function cutFloat() { + var match = str.match(re); + var number = match[0]; + str = str.slice(number.length); + return number.replace(/_/g, ''); + } + + // handles both floats and rationals + function cutNumber() { + if (isFloat()) { + var numerator = parseFloat(cutFloat()); + + if (str[0] === '/') { + // rational real part + str = str.slice(1); + + if (isFloat()) { + var denominator = parseFloat(cutFloat()); + return self.$Rational(numerator, denominator); + } else { + // reverting '/' + str = '/' + str; + return numerator; + } + } else { + // float real part, no denominator + return numerator; + } + } else { + return null; + } + } + + real = cutNumber(); + + if (!real) { + if (str[0] === 'i') { + // i => Complex(0, 1) + return self.$Complex(0, 1); + } + if (str[0] === '-' && str[1] === 'i') { + // -i => Complex(0, -1) + return self.$Complex(0, -1); + } + if (str[0] === '+' && str[1] === 'i') { + // +i => Complex(0, 1) + return self.$Complex(0, 1); + } + // anything => Complex(0, 0) + return self.$Complex(0, 0); + } + + imag = cutNumber(); + if (!imag) { + if (str[0] === 'i') { + // 3i => Complex(0, 3) + return self.$Complex(0, real); + } else { + // 3 => Complex(3, 0) + return self.$Complex(real, 0); + } + } else { + // 3+2i => Complex(3, 2) + return self.$Complex(real, imag); + } + + }, TMP_String_to_c_33.$$arity = 0), nil) && 'to_c' + })($nesting[0], null, $nesting); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/rational"] = function(Opal) { + function $rb_lt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); + } + function $rb_divide(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs / rhs : lhs['$/'](rhs); + } + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + function $rb_times(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs * rhs : lhs['$*'](rhs); + } + function $rb_plus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); + } + function $rb_gt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); + } + function $rb_le(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs <= rhs : lhs['$<='](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $truthy = Opal.truthy, $module = Opal.module; + + Opal.add_stubs(['$require', '$to_i', '$==', '$raise', '$<', '$-@', '$new', '$gcd', '$/', '$nil?', '$===', '$reduce', '$to_r', '$equal?', '$!', '$coerce_to!', '$to_f', '$numerator', '$denominator', '$<=>', '$-', '$*', '$__coerced__', '$+', '$Rational', '$>', '$**', '$abs', '$ceil', '$with_precision', '$floor', '$<=', '$truncate', '$send', '$convert']); + + self.$require("corelib/numeric"); + (function($base, $super, $parent_nesting) { + function $Rational(){}; + var self = $Rational = $klass($base, $super, 'Rational', $Rational); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Rational_reduce_1, TMP_Rational_convert_2, TMP_Rational_initialize_3, TMP_Rational_numerator_4, TMP_Rational_denominator_5, TMP_Rational_coerce_6, TMP_Rational_$eq$eq_7, TMP_Rational_$lt$eq$gt_8, TMP_Rational_$_9, TMP_Rational_$_10, TMP_Rational_$_11, TMP_Rational_$_12, TMP_Rational_$$_13, TMP_Rational_abs_14, TMP_Rational_ceil_15, TMP_Rational_floor_16, TMP_Rational_hash_17, TMP_Rational_inspect_18, TMP_Rational_rationalize_19, TMP_Rational_round_20, TMP_Rational_to_f_21, TMP_Rational_to_i_22, TMP_Rational_to_r_23, TMP_Rational_to_s_24, TMP_Rational_truncate_25, TMP_Rational_with_precision_26; + + def.num = def.den = nil; + + Opal.defs(self, '$reduce', TMP_Rational_reduce_1 = function $$reduce(num, den) { + var self = this, gcd = nil; + + + num = num.$to_i(); + den = den.$to_i(); + if (den['$=='](0)) { + self.$raise($$($nesting, 'ZeroDivisionError'), "divided by 0") + } else if ($truthy($rb_lt(den, 0))) { + + num = num['$-@'](); + den = den['$-@'](); + } else if (den['$=='](1)) { + return self.$new(num, den)}; + gcd = num.$gcd(den); + return self.$new($rb_divide(num, gcd), $rb_divide(den, gcd)); + }, TMP_Rational_reduce_1.$$arity = 2); + Opal.defs(self, '$convert', TMP_Rational_convert_2 = function $$convert(num, den) { + var $a, $b, self = this; + + + if ($truthy(($truthy($a = num['$nil?']()) ? $a : den['$nil?']()))) { + self.$raise($$($nesting, 'TypeError'), "cannot convert nil into Rational")}; + if ($truthy(($truthy($a = $$($nesting, 'Integer')['$==='](num)) ? $$($nesting, 'Integer')['$==='](den) : $a))) { + return self.$reduce(num, den)}; + if ($truthy(($truthy($a = ($truthy($b = $$($nesting, 'Float')['$==='](num)) ? $b : $$($nesting, 'String')['$==='](num))) ? $a : $$($nesting, 'Complex')['$==='](num)))) { + num = num.$to_r()}; + if ($truthy(($truthy($a = ($truthy($b = $$($nesting, 'Float')['$==='](den)) ? $b : $$($nesting, 'String')['$==='](den))) ? $a : $$($nesting, 'Complex')['$==='](den)))) { + den = den.$to_r()}; + if ($truthy(($truthy($a = den['$equal?'](1)) ? $$($nesting, 'Integer')['$==='](num)['$!']() : $a))) { + return $$($nesting, 'Opal')['$coerce_to!'](num, $$($nesting, 'Rational'), "to_r") + } else if ($truthy(($truthy($a = $$($nesting, 'Numeric')['$==='](num)) ? $$($nesting, 'Numeric')['$==='](den) : $a))) { + return $rb_divide(num, den) + } else { + return self.$reduce(num, den) + }; + }, TMP_Rational_convert_2.$$arity = 2); + + Opal.def(self, '$initialize', TMP_Rational_initialize_3 = function $$initialize(num, den) { + var self = this; + + + self.num = num; + return (self.den = den); + }, TMP_Rational_initialize_3.$$arity = 2); + + Opal.def(self, '$numerator', TMP_Rational_numerator_4 = function $$numerator() { + var self = this; + + return self.num + }, TMP_Rational_numerator_4.$$arity = 0); + + Opal.def(self, '$denominator', TMP_Rational_denominator_5 = function $$denominator() { + var self = this; + + return self.den + }, TMP_Rational_denominator_5.$$arity = 0); + + Opal.def(self, '$coerce', TMP_Rational_coerce_6 = function $$coerce(other) { + var self = this, $case = nil; + + return (function() {$case = other; + if ($$($nesting, 'Rational')['$===']($case)) {return [other, self]} + else if ($$($nesting, 'Integer')['$===']($case)) {return [other.$to_r(), self]} + else if ($$($nesting, 'Float')['$===']($case)) {return [other, self.$to_f()]} + else { return nil }})() + }, TMP_Rational_coerce_6.$$arity = 1); + + Opal.def(self, '$==', TMP_Rational_$eq$eq_7 = function(other) { + var $a, self = this, $case = nil; + + return (function() {$case = other; + if ($$($nesting, 'Rational')['$===']($case)) {return (($a = self.num['$=='](other.$numerator())) ? self.den['$=='](other.$denominator()) : self.num['$=='](other.$numerator()))} + else if ($$($nesting, 'Integer')['$===']($case)) {return (($a = self.num['$=='](other)) ? self.den['$=='](1) : self.num['$=='](other))} + else if ($$($nesting, 'Float')['$===']($case)) {return self.$to_f()['$=='](other)} + else {return other['$=='](self)}})() + }, TMP_Rational_$eq$eq_7.$$arity = 1); + + Opal.def(self, '$<=>', TMP_Rational_$lt$eq$gt_8 = function(other) { + var self = this, $case = nil; + + return (function() {$case = other; + if ($$($nesting, 'Rational')['$===']($case)) {return $rb_minus($rb_times(self.num, other.$denominator()), $rb_times(self.den, other.$numerator()))['$<=>'](0)} + else if ($$($nesting, 'Integer')['$===']($case)) {return $rb_minus(self.num, $rb_times(self.den, other))['$<=>'](0)} + else if ($$($nesting, 'Float')['$===']($case)) {return self.$to_f()['$<=>'](other)} + else {return self.$__coerced__("<=>", other)}})() + }, TMP_Rational_$lt$eq$gt_8.$$arity = 1); + + Opal.def(self, '$+', TMP_Rational_$_9 = function(other) { + var self = this, $case = nil, num = nil, den = nil; + + return (function() {$case = other; + if ($$($nesting, 'Rational')['$===']($case)) { + num = $rb_plus($rb_times(self.num, other.$denominator()), $rb_times(self.den, other.$numerator())); + den = $rb_times(self.den, other.$denominator()); + return self.$Rational(num, den);} + else if ($$($nesting, 'Integer')['$===']($case)) {return self.$Rational($rb_plus(self.num, $rb_times(other, self.den)), self.den)} + else if ($$($nesting, 'Float')['$===']($case)) {return $rb_plus(self.$to_f(), other)} + else {return self.$__coerced__("+", other)}})() + }, TMP_Rational_$_9.$$arity = 1); + + Opal.def(self, '$-', TMP_Rational_$_10 = function(other) { + var self = this, $case = nil, num = nil, den = nil; + + return (function() {$case = other; + if ($$($nesting, 'Rational')['$===']($case)) { + num = $rb_minus($rb_times(self.num, other.$denominator()), $rb_times(self.den, other.$numerator())); + den = $rb_times(self.den, other.$denominator()); + return self.$Rational(num, den);} + else if ($$($nesting, 'Integer')['$===']($case)) {return self.$Rational($rb_minus(self.num, $rb_times(other, self.den)), self.den)} + else if ($$($nesting, 'Float')['$===']($case)) {return $rb_minus(self.$to_f(), other)} + else {return self.$__coerced__("-", other)}})() + }, TMP_Rational_$_10.$$arity = 1); + + Opal.def(self, '$*', TMP_Rational_$_11 = function(other) { + var self = this, $case = nil, num = nil, den = nil; + + return (function() {$case = other; + if ($$($nesting, 'Rational')['$===']($case)) { + num = $rb_times(self.num, other.$numerator()); + den = $rb_times(self.den, other.$denominator()); + return self.$Rational(num, den);} + else if ($$($nesting, 'Integer')['$===']($case)) {return self.$Rational($rb_times(self.num, other), self.den)} + else if ($$($nesting, 'Float')['$===']($case)) {return $rb_times(self.$to_f(), other)} + else {return self.$__coerced__("*", other)}})() + }, TMP_Rational_$_11.$$arity = 1); + + Opal.def(self, '$/', TMP_Rational_$_12 = function(other) { + var self = this, $case = nil, num = nil, den = nil; + + return (function() {$case = other; + if ($$($nesting, 'Rational')['$===']($case)) { + num = $rb_times(self.num, other.$denominator()); + den = $rb_times(self.den, other.$numerator()); + return self.$Rational(num, den);} + else if ($$($nesting, 'Integer')['$===']($case)) {if (other['$=='](0)) { + return $rb_divide(self.$to_f(), 0.0) + } else { + return self.$Rational(self.num, $rb_times(self.den, other)) + }} + else if ($$($nesting, 'Float')['$===']($case)) {return $rb_divide(self.$to_f(), other)} + else {return self.$__coerced__("/", other)}})() + }, TMP_Rational_$_12.$$arity = 1); + + Opal.def(self, '$**', TMP_Rational_$$_13 = function(other) { + var $a, self = this, $case = nil; + + return (function() {$case = other; + if ($$($nesting, 'Integer')['$===']($case)) {if ($truthy((($a = self['$=='](0)) ? $rb_lt(other, 0) : self['$=='](0)))) { + return $$$($$($nesting, 'Float'), 'INFINITY') + } else if ($truthy($rb_gt(other, 0))) { + return self.$Rational(self.num['$**'](other), self.den['$**'](other)) + } else if ($truthy($rb_lt(other, 0))) { + return self.$Rational(self.den['$**'](other['$-@']()), self.num['$**'](other['$-@']())) + } else { + return self.$Rational(1, 1) + }} + else if ($$($nesting, 'Float')['$===']($case)) {return self.$to_f()['$**'](other)} + else if ($$($nesting, 'Rational')['$===']($case)) {if (other['$=='](0)) { + return self.$Rational(1, 1) + } else if (other.$denominator()['$=='](1)) { + if ($truthy($rb_lt(other, 0))) { + return self.$Rational(self.den['$**'](other.$numerator().$abs()), self.num['$**'](other.$numerator().$abs())) + } else { + return self.$Rational(self.num['$**'](other.$numerator()), self.den['$**'](other.$numerator())) + } + } else if ($truthy((($a = self['$=='](0)) ? $rb_lt(other, 0) : self['$=='](0)))) { + return self.$raise($$($nesting, 'ZeroDivisionError'), "divided by 0") + } else { + return self.$to_f()['$**'](other) + }} + else {return self.$__coerced__("**", other)}})() + }, TMP_Rational_$$_13.$$arity = 1); + + Opal.def(self, '$abs', TMP_Rational_abs_14 = function $$abs() { + var self = this; + + return self.$Rational(self.num.$abs(), self.den.$abs()) + }, TMP_Rational_abs_14.$$arity = 0); + + Opal.def(self, '$ceil', TMP_Rational_ceil_15 = function $$ceil(precision) { + var self = this; + + + + if (precision == null) { + precision = 0; + }; + if (precision['$=='](0)) { + return $rb_divide(self.num['$-@'](), self.den)['$-@']().$ceil() + } else { + return self.$with_precision("ceil", precision) + }; + }, TMP_Rational_ceil_15.$$arity = -1); + Opal.alias(self, "divide", "/"); + + Opal.def(self, '$floor', TMP_Rational_floor_16 = function $$floor(precision) { + var self = this; + + + + if (precision == null) { + precision = 0; + }; + if (precision['$=='](0)) { + return $rb_divide(self.num['$-@'](), self.den)['$-@']().$floor() + } else { + return self.$with_precision("floor", precision) + }; + }, TMP_Rational_floor_16.$$arity = -1); + + Opal.def(self, '$hash', TMP_Rational_hash_17 = function $$hash() { + var self = this; + + return "" + "Rational:" + (self.num) + ":" + (self.den) + }, TMP_Rational_hash_17.$$arity = 0); + + Opal.def(self, '$inspect', TMP_Rational_inspect_18 = function $$inspect() { + var self = this; + + return "" + "(" + (self) + ")" + }, TMP_Rational_inspect_18.$$arity = 0); + Opal.alias(self, "quo", "/"); + + Opal.def(self, '$rationalize', TMP_Rational_rationalize_19 = function $$rationalize(eps) { + var self = this; + + + ; + + if (arguments.length > 1) { + self.$raise($$($nesting, 'ArgumentError'), "" + "wrong number of arguments (" + (arguments.length) + " for 0..1)"); + } + + if (eps == null) { + return self; + } + + var e = eps.$abs(), + a = $rb_minus(self, e), + b = $rb_plus(self, e); + + var p0 = 0, + p1 = 1, + q0 = 1, + q1 = 0, + p2, q2; + + var c, k, t; + + while (true) { + c = (a).$ceil(); + + if ($rb_le(c, b)) { + break; + } + + k = c - 1; + p2 = k * p1 + p0; + q2 = k * q1 + q0; + t = $rb_divide(1, $rb_minus(b, k)); + b = $rb_divide(1, $rb_minus(a, k)); + a = t; + + p0 = p1; + q0 = q1; + p1 = p2; + q1 = q2; + } + + return self.$Rational(c * p1 + p0, c * q1 + q0); + ; + }, TMP_Rational_rationalize_19.$$arity = -1); + + Opal.def(self, '$round', TMP_Rational_round_20 = function $$round(precision) { + var self = this, num = nil, den = nil, approx = nil; + + + + if (precision == null) { + precision = 0; + }; + if (precision['$=='](0)) { + } else { + return self.$with_precision("round", precision) + }; + if (self.num['$=='](0)) { + return 0}; + if (self.den['$=='](1)) { + return self.num}; + num = $rb_plus($rb_times(self.num.$abs(), 2), self.den); + den = $rb_times(self.den, 2); + approx = $rb_divide(num, den).$truncate(); + if ($truthy($rb_lt(self.num, 0))) { + return approx['$-@']() + } else { + return approx + }; + }, TMP_Rational_round_20.$$arity = -1); + + Opal.def(self, '$to_f', TMP_Rational_to_f_21 = function $$to_f() { + var self = this; + + return $rb_divide(self.num, self.den) + }, TMP_Rational_to_f_21.$$arity = 0); + + Opal.def(self, '$to_i', TMP_Rational_to_i_22 = function $$to_i() { + var self = this; + + return self.$truncate() + }, TMP_Rational_to_i_22.$$arity = 0); + + Opal.def(self, '$to_r', TMP_Rational_to_r_23 = function $$to_r() { + var self = this; + + return self + }, TMP_Rational_to_r_23.$$arity = 0); + + Opal.def(self, '$to_s', TMP_Rational_to_s_24 = function $$to_s() { + var self = this; + + return "" + (self.num) + "/" + (self.den) + }, TMP_Rational_to_s_24.$$arity = 0); + + Opal.def(self, '$truncate', TMP_Rational_truncate_25 = function $$truncate(precision) { + var self = this; + + + + if (precision == null) { + precision = 0; + }; + if (precision['$=='](0)) { + if ($truthy($rb_lt(self.num, 0))) { + return self.$ceil() + } else { + return self.$floor() + } + } else { + return self.$with_precision("truncate", precision) + }; + }, TMP_Rational_truncate_25.$$arity = -1); + return (Opal.def(self, '$with_precision', TMP_Rational_with_precision_26 = function $$with_precision(method, precision) { + var self = this, p = nil, s = nil; + + + if ($truthy($$($nesting, 'Integer')['$==='](precision))) { + } else { + self.$raise($$($nesting, 'TypeError'), "not an Integer") + }; + p = (10)['$**'](precision); + s = $rb_times(self, p); + if ($truthy($rb_lt(precision, 1))) { + return $rb_divide(s.$send(method), p).$to_i() + } else { + return self.$Rational(s.$send(method), p) + }; + }, TMP_Rational_with_precision_26.$$arity = 2), nil) && 'with_precision'; + })($nesting[0], $$($nesting, 'Numeric'), $nesting); + (function($base, $parent_nesting) { + function $Kernel() {}; + var self = $Kernel = $module($base, 'Kernel', $Kernel); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Kernel_Rational_27; + + + Opal.def(self, '$Rational', TMP_Kernel_Rational_27 = function $$Rational(numerator, denominator) { + var self = this; + + + + if (denominator == null) { + denominator = 1; + }; + return $$($nesting, 'Rational').$convert(numerator, denominator); + }, TMP_Kernel_Rational_27.$$arity = -2) + })($nesting[0], $nesting); + return (function($base, $super, $parent_nesting) { + function $String(){}; + var self = $String = $klass($base, $super, 'String', $String); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_String_to_r_28; + + return (Opal.def(self, '$to_r', TMP_String_to_r_28 = function $$to_r() { + var self = this; + + + var str = self.trimLeft(), + re = /^[+-]?[\d_]+(\.[\d_]+)?/, + match = str.match(re), + numerator, denominator; + + function isFloat() { + return re.test(str); + } + + function cutFloat() { + var match = str.match(re); + var number = match[0]; + str = str.slice(number.length); + return number.replace(/_/g, ''); + } + + if (isFloat()) { + numerator = parseFloat(cutFloat()); + + if (str[0] === '/') { + // rational real part + str = str.slice(1); + + if (isFloat()) { + denominator = parseFloat(cutFloat()); + return self.$Rational(numerator, denominator); + } else { + return self.$Rational(numerator, 1); + } + } else { + return self.$Rational(numerator, 1); + } + } else { + return self.$Rational(0, 1); + } + + }, TMP_String_to_r_28.$$arity = 0), nil) && 'to_r' + })($nesting[0], null, $nesting); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/time"] = function(Opal) { + function $rb_gt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); + } + function $rb_lt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); + } + function $rb_plus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); + } + function $rb_divide(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs / rhs : lhs['$/'](rhs); + } + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + function $rb_le(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs <= rhs : lhs['$<='](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $truthy = Opal.truthy, $range = Opal.range; + + Opal.add_stubs(['$require', '$include', '$===', '$raise', '$coerce_to!', '$respond_to?', '$to_str', '$to_i', '$new', '$<=>', '$to_f', '$nil?', '$>', '$<', '$strftime', '$year', '$month', '$day', '$+', '$round', '$/', '$-', '$copy_instance_variables', '$initialize_dup', '$is_a?', '$zero?', '$wday', '$utc?', '$mon', '$yday', '$hour', '$min', '$sec', '$rjust', '$ljust', '$zone', '$to_s', '$[]', '$cweek_cyear', '$isdst', '$<=', '$!=', '$==', '$ceil']); + + self.$require("corelib/comparable"); + return (function($base, $super, $parent_nesting) { + function $Time(){}; + var self = $Time = $klass($base, $super, 'Time', $Time); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Time_at_1, TMP_Time_new_2, TMP_Time_local_3, TMP_Time_gm_4, TMP_Time_now_5, TMP_Time_$_6, TMP_Time_$_7, TMP_Time_$lt$eq$gt_8, TMP_Time_$eq$eq_9, TMP_Time_asctime_10, TMP_Time_day_11, TMP_Time_yday_12, TMP_Time_isdst_13, TMP_Time_dup_14, TMP_Time_eql$q_15, TMP_Time_friday$q_16, TMP_Time_hash_17, TMP_Time_hour_18, TMP_Time_inspect_19, TMP_Time_min_20, TMP_Time_mon_21, TMP_Time_monday$q_22, TMP_Time_saturday$q_23, TMP_Time_sec_24, TMP_Time_succ_25, TMP_Time_usec_26, TMP_Time_zone_27, TMP_Time_getgm_28, TMP_Time_gmtime_29, TMP_Time_gmt$q_30, TMP_Time_gmt_offset_31, TMP_Time_strftime_32, TMP_Time_sunday$q_33, TMP_Time_thursday$q_34, TMP_Time_to_a_35, TMP_Time_to_f_36, TMP_Time_to_i_37, TMP_Time_tuesday$q_38, TMP_Time_wday_39, TMP_Time_wednesday$q_40, TMP_Time_year_41, TMP_Time_cweek_cyear_42; + + + self.$include($$($nesting, 'Comparable')); + + var days_of_week = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"], + short_days = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], + short_months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], + long_months = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]; + ; + Opal.defs(self, '$at', TMP_Time_at_1 = function $$at(seconds, frac) { + var self = this; + + + ; + + var result; + + if ($$($nesting, 'Time')['$==='](seconds)) { + if (frac !== undefined) { + self.$raise($$($nesting, 'TypeError'), "can't convert Time into an exact number") + } + result = new Date(seconds.getTime()); + result.is_utc = seconds.is_utc; + return result; + } + + if (!seconds.$$is_number) { + seconds = $$($nesting, 'Opal')['$coerce_to!'](seconds, $$($nesting, 'Integer'), "to_int"); + } + + if (frac === undefined) { + return new Date(seconds * 1000); + } + + if (!frac.$$is_number) { + frac = $$($nesting, 'Opal')['$coerce_to!'](frac, $$($nesting, 'Integer'), "to_int"); + } + + return new Date(seconds * 1000 + (frac / 1000)); + ; + }, TMP_Time_at_1.$$arity = -2); + + function time_params(year, month, day, hour, min, sec) { + if (year.$$is_string) { + year = parseInt(year, 10); + } else { + year = $$($nesting, 'Opal')['$coerce_to!'](year, $$($nesting, 'Integer'), "to_int"); + } + + if (month === nil) { + month = 1; + } else if (!month.$$is_number) { + if ((month)['$respond_to?']("to_str")) { + month = (month).$to_str(); + switch (month.toLowerCase()) { + case 'jan': month = 1; break; + case 'feb': month = 2; break; + case 'mar': month = 3; break; + case 'apr': month = 4; break; + case 'may': month = 5; break; + case 'jun': month = 6; break; + case 'jul': month = 7; break; + case 'aug': month = 8; break; + case 'sep': month = 9; break; + case 'oct': month = 10; break; + case 'nov': month = 11; break; + case 'dec': month = 12; break; + default: month = (month).$to_i(); + } + } else { + month = $$($nesting, 'Opal')['$coerce_to!'](month, $$($nesting, 'Integer'), "to_int"); + } + } + + if (month < 1 || month > 12) { + self.$raise($$($nesting, 'ArgumentError'), "" + "month out of range: " + (month)) + } + month = month - 1; + + if (day === nil) { + day = 1; + } else if (day.$$is_string) { + day = parseInt(day, 10); + } else { + day = $$($nesting, 'Opal')['$coerce_to!'](day, $$($nesting, 'Integer'), "to_int"); + } + + if (day < 1 || day > 31) { + self.$raise($$($nesting, 'ArgumentError'), "" + "day out of range: " + (day)) + } + + if (hour === nil) { + hour = 0; + } else if (hour.$$is_string) { + hour = parseInt(hour, 10); + } else { + hour = $$($nesting, 'Opal')['$coerce_to!'](hour, $$($nesting, 'Integer'), "to_int"); + } + + if (hour < 0 || hour > 24) { + self.$raise($$($nesting, 'ArgumentError'), "" + "hour out of range: " + (hour)) + } + + if (min === nil) { + min = 0; + } else if (min.$$is_string) { + min = parseInt(min, 10); + } else { + min = $$($nesting, 'Opal')['$coerce_to!'](min, $$($nesting, 'Integer'), "to_int"); + } + + if (min < 0 || min > 59) { + self.$raise($$($nesting, 'ArgumentError'), "" + "min out of range: " + (min)) + } + + if (sec === nil) { + sec = 0; + } else if (!sec.$$is_number) { + if (sec.$$is_string) { + sec = parseInt(sec, 10); + } else { + sec = $$($nesting, 'Opal')['$coerce_to!'](sec, $$($nesting, 'Integer'), "to_int"); + } + } + + if (sec < 0 || sec > 60) { + self.$raise($$($nesting, 'ArgumentError'), "" + "sec out of range: " + (sec)) + } + + return [year, month, day, hour, min, sec]; + } + ; + Opal.defs(self, '$new', TMP_Time_new_2 = function(year, month, day, hour, min, sec, utc_offset) { + var self = this; + + + ; + + if (month == null) { + month = nil; + }; + + if (day == null) { + day = nil; + }; + + if (hour == null) { + hour = nil; + }; + + if (min == null) { + min = nil; + }; + + if (sec == null) { + sec = nil; + }; + + if (utc_offset == null) { + utc_offset = nil; + }; + + var args, result; + + if (year === undefined) { + return new Date(); + } + + if (utc_offset !== nil) { + self.$raise($$($nesting, 'ArgumentError'), "Opal does not support explicitly specifying UTC offset for Time") + } + + args = time_params(year, month, day, hour, min, sec); + year = args[0]; + month = args[1]; + day = args[2]; + hour = args[3]; + min = args[4]; + sec = args[5]; + + result = new Date(year, month, day, hour, min, 0, sec * 1000); + if (year < 100) { + result.setFullYear(year); + } + return result; + ; + }, TMP_Time_new_2.$$arity = -1); + Opal.defs(self, '$local', TMP_Time_local_3 = function $$local(year, month, day, hour, min, sec, millisecond, _dummy1, _dummy2, _dummy3) { + var self = this; + + + + if (month == null) { + month = nil; + }; + + if (day == null) { + day = nil; + }; + + if (hour == null) { + hour = nil; + }; + + if (min == null) { + min = nil; + }; + + if (sec == null) { + sec = nil; + }; + + if (millisecond == null) { + millisecond = nil; + }; + + if (_dummy1 == null) { + _dummy1 = nil; + }; + + if (_dummy2 == null) { + _dummy2 = nil; + }; + + if (_dummy3 == null) { + _dummy3 = nil; + }; + + var args, result; + + if (arguments.length === 10) { + args = $slice.call(arguments); + year = args[5]; + month = args[4]; + day = args[3]; + hour = args[2]; + min = args[1]; + sec = args[0]; + } + + args = time_params(year, month, day, hour, min, sec); + year = args[0]; + month = args[1]; + day = args[2]; + hour = args[3]; + min = args[4]; + sec = args[5]; + + result = new Date(year, month, day, hour, min, 0, sec * 1000); + if (year < 100) { + result.setFullYear(year); + } + return result; + ; + }, TMP_Time_local_3.$$arity = -2); + Opal.defs(self, '$gm', TMP_Time_gm_4 = function $$gm(year, month, day, hour, min, sec, millisecond, _dummy1, _dummy2, _dummy3) { + var self = this; + + + + if (month == null) { + month = nil; + }; + + if (day == null) { + day = nil; + }; + + if (hour == null) { + hour = nil; + }; + + if (min == null) { + min = nil; + }; + + if (sec == null) { + sec = nil; + }; + + if (millisecond == null) { + millisecond = nil; + }; + + if (_dummy1 == null) { + _dummy1 = nil; + }; + + if (_dummy2 == null) { + _dummy2 = nil; + }; + + if (_dummy3 == null) { + _dummy3 = nil; + }; + + var args, result; + + if (arguments.length === 10) { + args = $slice.call(arguments); + year = args[5]; + month = args[4]; + day = args[3]; + hour = args[2]; + min = args[1]; + sec = args[0]; + } + + args = time_params(year, month, day, hour, min, sec); + year = args[0]; + month = args[1]; + day = args[2]; + hour = args[3]; + min = args[4]; + sec = args[5]; + + result = new Date(Date.UTC(year, month, day, hour, min, 0, sec * 1000)); + if (year < 100) { + result.setUTCFullYear(year); + } + result.is_utc = true; + return result; + ; + }, TMP_Time_gm_4.$$arity = -2); + (function(self, $parent_nesting) { + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + + Opal.alias(self, "mktime", "local"); + return Opal.alias(self, "utc", "gm"); + })(Opal.get_singleton_class(self), $nesting); + Opal.defs(self, '$now', TMP_Time_now_5 = function $$now() { + var self = this; + + return self.$new() + }, TMP_Time_now_5.$$arity = 0); + + Opal.def(self, '$+', TMP_Time_$_6 = function(other) { + var self = this; + + + if ($truthy($$($nesting, 'Time')['$==='](other))) { + self.$raise($$($nesting, 'TypeError'), "time + time?")}; + + if (!other.$$is_number) { + other = $$($nesting, 'Opal')['$coerce_to!'](other, $$($nesting, 'Integer'), "to_int"); + } + var result = new Date(self.getTime() + (other * 1000)); + result.is_utc = self.is_utc; + return result; + ; + }, TMP_Time_$_6.$$arity = 1); + + Opal.def(self, '$-', TMP_Time_$_7 = function(other) { + var self = this; + + + if ($truthy($$($nesting, 'Time')['$==='](other))) { + return (self.getTime() - other.getTime()) / 1000}; + + if (!other.$$is_number) { + other = $$($nesting, 'Opal')['$coerce_to!'](other, $$($nesting, 'Integer'), "to_int"); + } + var result = new Date(self.getTime() - (other * 1000)); + result.is_utc = self.is_utc; + return result; + ; + }, TMP_Time_$_7.$$arity = 1); + + Opal.def(self, '$<=>', TMP_Time_$lt$eq$gt_8 = function(other) { + var self = this, r = nil; + + if ($truthy($$($nesting, 'Time')['$==='](other))) { + return self.$to_f()['$<=>'](other.$to_f()) + } else { + + r = other['$<=>'](self); + if ($truthy(r['$nil?']())) { + return nil + } else if ($truthy($rb_gt(r, 0))) { + return -1 + } else if ($truthy($rb_lt(r, 0))) { + return 1 + } else { + return 0 + }; + } + }, TMP_Time_$lt$eq$gt_8.$$arity = 1); + + Opal.def(self, '$==', TMP_Time_$eq$eq_9 = function(other) { + var $a, self = this; + + return ($truthy($a = $$($nesting, 'Time')['$==='](other)) ? self.$to_f() === other.$to_f() : $a) + }, TMP_Time_$eq$eq_9.$$arity = 1); + + Opal.def(self, '$asctime', TMP_Time_asctime_10 = function $$asctime() { + var self = this; + + return self.$strftime("%a %b %e %H:%M:%S %Y") + }, TMP_Time_asctime_10.$$arity = 0); + Opal.alias(self, "ctime", "asctime"); + + Opal.def(self, '$day', TMP_Time_day_11 = function $$day() { + var self = this; + + return self.is_utc ? self.getUTCDate() : self.getDate(); + }, TMP_Time_day_11.$$arity = 0); + + Opal.def(self, '$yday', TMP_Time_yday_12 = function $$yday() { + var self = this, start_of_year = nil, start_of_day = nil, one_day = nil; + + + start_of_year = $$($nesting, 'Time').$new(self.$year()).$to_i(); + start_of_day = $$($nesting, 'Time').$new(self.$year(), self.$month(), self.$day()).$to_i(); + one_day = 86400; + return $rb_plus($rb_divide($rb_minus(start_of_day, start_of_year), one_day).$round(), 1); + }, TMP_Time_yday_12.$$arity = 0); + + Opal.def(self, '$isdst', TMP_Time_isdst_13 = function $$isdst() { + var self = this; + + + var jan = new Date(self.getFullYear(), 0, 1), + jul = new Date(self.getFullYear(), 6, 1); + return self.getTimezoneOffset() < Math.max(jan.getTimezoneOffset(), jul.getTimezoneOffset()); + + }, TMP_Time_isdst_13.$$arity = 0); + Opal.alias(self, "dst?", "isdst"); + + Opal.def(self, '$dup', TMP_Time_dup_14 = function $$dup() { + var self = this, copy = nil; + + + copy = new Date(self.getTime()); + copy.$copy_instance_variables(self); + copy.$initialize_dup(self); + return copy; + }, TMP_Time_dup_14.$$arity = 0); + + Opal.def(self, '$eql?', TMP_Time_eql$q_15 = function(other) { + var $a, self = this; + + return ($truthy($a = other['$is_a?']($$($nesting, 'Time'))) ? self['$<=>'](other)['$zero?']() : $a) + }, TMP_Time_eql$q_15.$$arity = 1); + + Opal.def(self, '$friday?', TMP_Time_friday$q_16 = function() { + var self = this; + + return self.$wday() == 5 + }, TMP_Time_friday$q_16.$$arity = 0); + + Opal.def(self, '$hash', TMP_Time_hash_17 = function $$hash() { + var self = this; + + return 'Time:' + self.getTime(); + }, TMP_Time_hash_17.$$arity = 0); + + Opal.def(self, '$hour', TMP_Time_hour_18 = function $$hour() { + var self = this; + + return self.is_utc ? self.getUTCHours() : self.getHours(); + }, TMP_Time_hour_18.$$arity = 0); + + Opal.def(self, '$inspect', TMP_Time_inspect_19 = function $$inspect() { + var self = this; + + if ($truthy(self['$utc?']())) { + return self.$strftime("%Y-%m-%d %H:%M:%S UTC") + } else { + return self.$strftime("%Y-%m-%d %H:%M:%S %z") + } + }, TMP_Time_inspect_19.$$arity = 0); + Opal.alias(self, "mday", "day"); + + Opal.def(self, '$min', TMP_Time_min_20 = function $$min() { + var self = this; + + return self.is_utc ? self.getUTCMinutes() : self.getMinutes(); + }, TMP_Time_min_20.$$arity = 0); + + Opal.def(self, '$mon', TMP_Time_mon_21 = function $$mon() { + var self = this; + + return (self.is_utc ? self.getUTCMonth() : self.getMonth()) + 1; + }, TMP_Time_mon_21.$$arity = 0); + + Opal.def(self, '$monday?', TMP_Time_monday$q_22 = function() { + var self = this; + + return self.$wday() == 1 + }, TMP_Time_monday$q_22.$$arity = 0); + Opal.alias(self, "month", "mon"); + + Opal.def(self, '$saturday?', TMP_Time_saturday$q_23 = function() { + var self = this; + + return self.$wday() == 6 + }, TMP_Time_saturday$q_23.$$arity = 0); + + Opal.def(self, '$sec', TMP_Time_sec_24 = function $$sec() { + var self = this; + + return self.is_utc ? self.getUTCSeconds() : self.getSeconds(); + }, TMP_Time_sec_24.$$arity = 0); + + Opal.def(self, '$succ', TMP_Time_succ_25 = function $$succ() { + var self = this; + + + var result = new Date(self.getTime() + 1000); + result.is_utc = self.is_utc; + return result; + + }, TMP_Time_succ_25.$$arity = 0); + + Opal.def(self, '$usec', TMP_Time_usec_26 = function $$usec() { + var self = this; + + return self.getMilliseconds() * 1000; + }, TMP_Time_usec_26.$$arity = 0); + + Opal.def(self, '$zone', TMP_Time_zone_27 = function $$zone() { + var self = this; + + + var string = self.toString(), + result; + + if (string.indexOf('(') == -1) { + result = string.match(/[A-Z]{3,4}/)[0]; + } + else { + result = string.match(/\((.+)\)(?:\s|$)/)[1] + } + + if (result == "GMT" && /(GMT\W*\d{4})/.test(string)) { + return RegExp.$1; + } + else { + return result; + } + + }, TMP_Time_zone_27.$$arity = 0); + + Opal.def(self, '$getgm', TMP_Time_getgm_28 = function $$getgm() { + var self = this; + + + var result = new Date(self.getTime()); + result.is_utc = true; + return result; + + }, TMP_Time_getgm_28.$$arity = 0); + Opal.alias(self, "getutc", "getgm"); + + Opal.def(self, '$gmtime', TMP_Time_gmtime_29 = function $$gmtime() { + var self = this; + + + self.is_utc = true; + return self; + + }, TMP_Time_gmtime_29.$$arity = 0); + Opal.alias(self, "utc", "gmtime"); + + Opal.def(self, '$gmt?', TMP_Time_gmt$q_30 = function() { + var self = this; + + return self.is_utc === true; + }, TMP_Time_gmt$q_30.$$arity = 0); + + Opal.def(self, '$gmt_offset', TMP_Time_gmt_offset_31 = function $$gmt_offset() { + var self = this; + + return -self.getTimezoneOffset() * 60; + }, TMP_Time_gmt_offset_31.$$arity = 0); + + Opal.def(self, '$strftime', TMP_Time_strftime_32 = function $$strftime(format) { + var self = this; + + + return format.replace(/%([\-_#^0]*:{0,2})(\d+)?([EO]*)(.)/g, function(full, flags, width, _, conv) { + var result = "", + zero = flags.indexOf('0') !== -1, + pad = flags.indexOf('-') === -1, + blank = flags.indexOf('_') !== -1, + upcase = flags.indexOf('^') !== -1, + invert = flags.indexOf('#') !== -1, + colons = (flags.match(':') || []).length; + + width = parseInt(width, 10); + + if (zero && blank) { + if (flags.indexOf('0') < flags.indexOf('_')) { + zero = false; + } + else { + blank = false; + } + } + + switch (conv) { + case 'Y': + result += self.$year(); + break; + + case 'C': + zero = !blank; + result += Math.round(self.$year() / 100); + break; + + case 'y': + zero = !blank; + result += (self.$year() % 100); + break; + + case 'm': + zero = !blank; + result += self.$mon(); + break; + + case 'B': + result += long_months[self.$mon() - 1]; + break; + + case 'b': + case 'h': + blank = !zero; + result += short_months[self.$mon() - 1]; + break; + + case 'd': + zero = !blank + result += self.$day(); + break; + + case 'e': + blank = !zero + result += self.$day(); + break; + + case 'j': + result += self.$yday(); + break; + + case 'H': + zero = !blank; + result += self.$hour(); + break; + + case 'k': + blank = !zero; + result += self.$hour(); + break; + + case 'I': + zero = !blank; + result += (self.$hour() % 12 || 12); + break; + + case 'l': + blank = !zero; + result += (self.$hour() % 12 || 12); + break; + + case 'P': + result += (self.$hour() >= 12 ? "pm" : "am"); + break; + + case 'p': + result += (self.$hour() >= 12 ? "PM" : "AM"); + break; + + case 'M': + zero = !blank; + result += self.$min(); + break; + + case 'S': + zero = !blank; + result += self.$sec() + break; + + case 'L': + zero = !blank; + width = isNaN(width) ? 3 : width; + result += self.getMilliseconds(); + break; + + case 'N': + width = isNaN(width) ? 9 : width; + result += (self.getMilliseconds().toString()).$rjust(3, "0"); + result = (result).$ljust(width, "0"); + break; + + case 'z': + var offset = self.getTimezoneOffset(), + hours = Math.floor(Math.abs(offset) / 60), + minutes = Math.abs(offset) % 60; + + result += offset < 0 ? "+" : "-"; + result += hours < 10 ? "0" : ""; + result += hours; + + if (colons > 0) { + result += ":"; + } + + result += minutes < 10 ? "0" : ""; + result += minutes; + + if (colons > 1) { + result += ":00"; + } + + break; + + case 'Z': + result += self.$zone(); + break; + + case 'A': + result += days_of_week[self.$wday()]; + break; + + case 'a': + result += short_days[self.$wday()]; + break; + + case 'u': + result += (self.$wday() + 1); + break; + + case 'w': + result += self.$wday(); + break; + + case 'V': + result += self.$cweek_cyear()['$[]'](0).$to_s().$rjust(2, "0"); + break; + + case 'G': + result += self.$cweek_cyear()['$[]'](1); + break; + + case 'g': + result += self.$cweek_cyear()['$[]'](1)['$[]']($range(-2, -1, false)); + break; + + case 's': + result += self.$to_i(); + break; + + case 'n': + result += "\n"; + break; + + case 't': + result += "\t"; + break; + + case '%': + result += "%"; + break; + + case 'c': + result += self.$strftime("%a %b %e %T %Y"); + break; + + case 'D': + case 'x': + result += self.$strftime("%m/%d/%y"); + break; + + case 'F': + result += self.$strftime("%Y-%m-%d"); + break; + + case 'v': + result += self.$strftime("%e-%^b-%4Y"); + break; + + case 'r': + result += self.$strftime("%I:%M:%S %p"); + break; + + case 'R': + result += self.$strftime("%H:%M"); + break; + + case 'T': + case 'X': + result += self.$strftime("%H:%M:%S"); + break; + + default: + return full; + } + + if (upcase) { + result = result.toUpperCase(); + } + + if (invert) { + result = result.replace(/[A-Z]/, function(c) { c.toLowerCase() }). + replace(/[a-z]/, function(c) { c.toUpperCase() }); + } + + if (pad && (zero || blank)) { + result = (result).$rjust(isNaN(width) ? 2 : width, blank ? " " : "0"); + } + + return result; + }); + + }, TMP_Time_strftime_32.$$arity = 1); + + Opal.def(self, '$sunday?', TMP_Time_sunday$q_33 = function() { + var self = this; + + return self.$wday() == 0 + }, TMP_Time_sunday$q_33.$$arity = 0); + + Opal.def(self, '$thursday?', TMP_Time_thursday$q_34 = function() { + var self = this; + + return self.$wday() == 4 + }, TMP_Time_thursday$q_34.$$arity = 0); + + Opal.def(self, '$to_a', TMP_Time_to_a_35 = function $$to_a() { + var self = this; + + return [self.$sec(), self.$min(), self.$hour(), self.$day(), self.$month(), self.$year(), self.$wday(), self.$yday(), self.$isdst(), self.$zone()] + }, TMP_Time_to_a_35.$$arity = 0); + + Opal.def(self, '$to_f', TMP_Time_to_f_36 = function $$to_f() { + var self = this; + + return self.getTime() / 1000; + }, TMP_Time_to_f_36.$$arity = 0); + + Opal.def(self, '$to_i', TMP_Time_to_i_37 = function $$to_i() { + var self = this; + + return parseInt(self.getTime() / 1000, 10); + }, TMP_Time_to_i_37.$$arity = 0); + Opal.alias(self, "to_s", "inspect"); + + Opal.def(self, '$tuesday?', TMP_Time_tuesday$q_38 = function() { + var self = this; + + return self.$wday() == 2 + }, TMP_Time_tuesday$q_38.$$arity = 0); + Opal.alias(self, "tv_sec", "to_i"); + Opal.alias(self, "tv_usec", "usec"); + Opal.alias(self, "utc?", "gmt?"); + Opal.alias(self, "gmtoff", "gmt_offset"); + Opal.alias(self, "utc_offset", "gmt_offset"); + + Opal.def(self, '$wday', TMP_Time_wday_39 = function $$wday() { + var self = this; + + return self.is_utc ? self.getUTCDay() : self.getDay(); + }, TMP_Time_wday_39.$$arity = 0); + + Opal.def(self, '$wednesday?', TMP_Time_wednesday$q_40 = function() { + var self = this; + + return self.$wday() == 3 + }, TMP_Time_wednesday$q_40.$$arity = 0); + + Opal.def(self, '$year', TMP_Time_year_41 = function $$year() { + var self = this; + + return self.is_utc ? self.getUTCFullYear() : self.getFullYear(); + }, TMP_Time_year_41.$$arity = 0); + return (Opal.def(self, '$cweek_cyear', TMP_Time_cweek_cyear_42 = function $$cweek_cyear() { + var $a, self = this, jan01 = nil, jan01_wday = nil, first_monday = nil, year = nil, offset = nil, week = nil, dec31 = nil, dec31_wday = nil; + + + jan01 = $$($nesting, 'Time').$new(self.$year(), 1, 1); + jan01_wday = jan01.$wday(); + first_monday = 0; + year = self.$year(); + if ($truthy(($truthy($a = $rb_le(jan01_wday, 4)) ? jan01_wday['$!='](0) : $a))) { + offset = $rb_minus(jan01_wday, 1) + } else { + + offset = $rb_minus($rb_minus(jan01_wday, 7), 1); + if (offset['$=='](-8)) { + offset = -1}; + }; + week = $rb_divide($rb_plus(self.$yday(), offset), 7.0).$ceil(); + if ($truthy($rb_le(week, 0))) { + return $$($nesting, 'Time').$new($rb_minus(self.$year(), 1), 12, 31).$cweek_cyear() + } else if (week['$=='](53)) { + + dec31 = $$($nesting, 'Time').$new(self.$year(), 12, 31); + dec31_wday = dec31.$wday(); + if ($truthy(($truthy($a = $rb_le(dec31_wday, 3)) ? dec31_wday['$!='](0) : $a))) { + + week = 1; + year = $rb_plus(year, 1);};}; + return [week, year]; + }, TMP_Time_cweek_cyear_42.$$arity = 0), nil) && 'cweek_cyear'; + })($nesting[0], Date, $nesting); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/struct"] = function(Opal) { + function $rb_gt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); + } + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + function $rb_lt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); + } + function $rb_ge(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs >= rhs : lhs['$>='](rhs); + } + function $rb_plus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $hash2 = Opal.hash2, $truthy = Opal.truthy, $send = Opal.send; + + Opal.add_stubs(['$require', '$include', '$const_name!', '$unshift', '$map', '$coerce_to!', '$new', '$each', '$define_struct_attribute', '$allocate', '$initialize', '$alias_method', '$module_eval', '$to_proc', '$const_set', '$==', '$raise', '$<<', '$members', '$define_method', '$instance_eval', '$class', '$last', '$>', '$length', '$-', '$keys', '$any?', '$join', '$[]', '$[]=', '$each_with_index', '$hash', '$===', '$<', '$-@', '$size', '$>=', '$include?', '$to_sym', '$instance_of?', '$__id__', '$eql?', '$enum_for', '$name', '$+', '$each_pair', '$inspect', '$each_with_object', '$flatten', '$to_a', '$respond_to?', '$dig']); + + self.$require("corelib/enumerable"); + return (function($base, $super, $parent_nesting) { + function $Struct(){}; + var self = $Struct = $klass($base, $super, 'Struct', $Struct); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Struct_new_1, TMP_Struct_define_struct_attribute_6, TMP_Struct_members_9, TMP_Struct_inherited_10, TMP_Struct_initialize_12, TMP_Struct_members_15, TMP_Struct_hash_16, TMP_Struct_$$_17, TMP_Struct_$$$eq_18, TMP_Struct_$eq$eq_19, TMP_Struct_eql$q_20, TMP_Struct_each_21, TMP_Struct_each_pair_24, TMP_Struct_length_27, TMP_Struct_to_a_28, TMP_Struct_inspect_30, TMP_Struct_to_h_32, TMP_Struct_values_at_34, TMP_Struct_dig_36; + + + self.$include($$($nesting, 'Enumerable')); + Opal.defs(self, '$new', TMP_Struct_new_1 = function(const_name, $a, $b) { + var $iter = TMP_Struct_new_1.$$p, block = $iter || nil, $post_args, $kwargs, args, keyword_init, TMP_2, TMP_3, self = this, klass = nil; + + if ($iter) TMP_Struct_new_1.$$p = null; + + + if ($iter) TMP_Struct_new_1.$$p = null;; + + $post_args = Opal.slice.call(arguments, 1, arguments.length); + + $kwargs = Opal.extract_kwargs($post_args); + + if ($kwargs == null) { + $kwargs = $hash2([], {}); + } else if (!$kwargs.$$is_hash) { + throw Opal.ArgumentError.$new('expected kwargs'); + }; + + args = $post_args;; + + keyword_init = $kwargs.$$smap["keyword_init"]; + if (keyword_init == null) { + keyword_init = false + }; + if ($truthy(const_name)) { + + try { + const_name = $$($nesting, 'Opal')['$const_name!'](const_name) + } catch ($err) { + if (Opal.rescue($err, [$$($nesting, 'TypeError'), $$($nesting, 'NameError')])) { + try { + + args.$unshift(const_name); + const_name = nil; + } finally { Opal.pop_exception() } + } else { throw $err; } + };}; + $send(args, 'map', [], (TMP_2 = function(arg){var self = TMP_2.$$s || this; + + + + if (arg == null) { + arg = nil; + }; + return $$($nesting, 'Opal')['$coerce_to!'](arg, $$($nesting, 'String'), "to_str");}, TMP_2.$$s = self, TMP_2.$$arity = 1, TMP_2)); + klass = $send($$($nesting, 'Class'), 'new', [self], (TMP_3 = function(){var self = TMP_3.$$s || this, TMP_4; + + + $send(args, 'each', [], (TMP_4 = function(arg){var self = TMP_4.$$s || this; + + + + if (arg == null) { + arg = nil; + }; + return self.$define_struct_attribute(arg);}, TMP_4.$$s = self, TMP_4.$$arity = 1, TMP_4)); + return (function(self, $parent_nesting) { + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_new_5; + + + + Opal.def(self, '$new', TMP_new_5 = function($a) { + var $post_args, args, self = this, instance = nil; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + instance = self.$allocate(); + instance.$$data = {}; + $send(instance, 'initialize', Opal.to_a(args)); + return instance; + }, TMP_new_5.$$arity = -1); + return self.$alias_method("[]", "new"); + })(Opal.get_singleton_class(self), $nesting);}, TMP_3.$$s = self, TMP_3.$$arity = 0, TMP_3)); + if ($truthy(block)) { + $send(klass, 'module_eval', [], block.$to_proc())}; + klass.$$keyword_init = keyword_init; + if ($truthy(const_name)) { + $$($nesting, 'Struct').$const_set(const_name, klass)}; + return klass; + }, TMP_Struct_new_1.$$arity = -2); + Opal.defs(self, '$define_struct_attribute', TMP_Struct_define_struct_attribute_6 = function $$define_struct_attribute(name) { + var TMP_7, TMP_8, self = this; + + + if (self['$==']($$($nesting, 'Struct'))) { + self.$raise($$($nesting, 'ArgumentError'), "you cannot define attributes to the Struct class")}; + self.$members()['$<<'](name); + $send(self, 'define_method', [name], (TMP_7 = function(){var self = TMP_7.$$s || this; + + return self.$$data[name];}, TMP_7.$$s = self, TMP_7.$$arity = 0, TMP_7)); + return $send(self, 'define_method', ["" + (name) + "="], (TMP_8 = function(value){var self = TMP_8.$$s || this; + + + + if (value == null) { + value = nil; + }; + return self.$$data[name] = value;;}, TMP_8.$$s = self, TMP_8.$$arity = 1, TMP_8)); + }, TMP_Struct_define_struct_attribute_6.$$arity = 1); + Opal.defs(self, '$members', TMP_Struct_members_9 = function $$members() { + var $a, self = this; + if (self.members == null) self.members = nil; + + + if (self['$==']($$($nesting, 'Struct'))) { + self.$raise($$($nesting, 'ArgumentError'), "the Struct class has no members")}; + return (self.members = ($truthy($a = self.members) ? $a : [])); + }, TMP_Struct_members_9.$$arity = 0); + Opal.defs(self, '$inherited', TMP_Struct_inherited_10 = function $$inherited(klass) { + var TMP_11, self = this, members = nil; + if (self.members == null) self.members = nil; + + + members = self.members; + return $send(klass, 'instance_eval', [], (TMP_11 = function(){var self = TMP_11.$$s || this; + + return (self.members = members)}, TMP_11.$$s = self, TMP_11.$$arity = 0, TMP_11)); + }, TMP_Struct_inherited_10.$$arity = 1); + + Opal.def(self, '$initialize', TMP_Struct_initialize_12 = function $$initialize($a) { + var $post_args, args, $b, TMP_13, TMP_14, self = this, kwargs = nil, extra = nil; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + if ($truthy(self.$class().$$keyword_init)) { + + kwargs = ($truthy($b = args.$last()) ? $b : $hash2([], {})); + if ($truthy(($truthy($b = $rb_gt(args.$length(), 1)) ? $b : (args.length === 1 && !kwargs.$$is_hash)))) { + self.$raise($$($nesting, 'ArgumentError'), "" + "wrong number of arguments (given " + (args.$length()) + ", expected 0)")}; + extra = $rb_minus(kwargs.$keys(), self.$class().$members()); + if ($truthy(extra['$any?']())) { + self.$raise($$($nesting, 'ArgumentError'), "" + "unknown keywords: " + (extra.$join(", ")))}; + return $send(self.$class().$members(), 'each', [], (TMP_13 = function(name){var self = TMP_13.$$s || this, $writer = nil; + + + + if (name == null) { + name = nil; + }; + $writer = [name, kwargs['$[]'](name)]; + $send(self, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];}, TMP_13.$$s = self, TMP_13.$$arity = 1, TMP_13)); + } else { + + if ($truthy($rb_gt(args.$length(), self.$class().$members().$length()))) { + self.$raise($$($nesting, 'ArgumentError'), "struct size differs")}; + return $send(self.$class().$members(), 'each_with_index', [], (TMP_14 = function(name, index){var self = TMP_14.$$s || this, $writer = nil; + + + + if (name == null) { + name = nil; + }; + + if (index == null) { + index = nil; + }; + $writer = [name, args['$[]'](index)]; + $send(self, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];}, TMP_14.$$s = self, TMP_14.$$arity = 2, TMP_14)); + }; + }, TMP_Struct_initialize_12.$$arity = -1); + + Opal.def(self, '$members', TMP_Struct_members_15 = function $$members() { + var self = this; + + return self.$class().$members() + }, TMP_Struct_members_15.$$arity = 0); + + Opal.def(self, '$hash', TMP_Struct_hash_16 = function $$hash() { + var self = this; + + return $$($nesting, 'Hash').$new(self.$$data).$hash() + }, TMP_Struct_hash_16.$$arity = 0); + + Opal.def(self, '$[]', TMP_Struct_$$_17 = function(name) { + var self = this; + + + if ($truthy($$($nesting, 'Integer')['$==='](name))) { + + if ($truthy($rb_lt(name, self.$class().$members().$size()['$-@']()))) { + self.$raise($$($nesting, 'IndexError'), "" + "offset " + (name) + " too small for struct(size:" + (self.$class().$members().$size()) + ")")}; + if ($truthy($rb_ge(name, self.$class().$members().$size()))) { + self.$raise($$($nesting, 'IndexError'), "" + "offset " + (name) + " too large for struct(size:" + (self.$class().$members().$size()) + ")")}; + name = self.$class().$members()['$[]'](name); + } else if ($truthy($$($nesting, 'String')['$==='](name))) { + + if(!self.$$data.hasOwnProperty(name)) { + self.$raise($$($nesting, 'NameError').$new("" + "no member '" + (name) + "' in struct", name)) + } + + } else { + self.$raise($$($nesting, 'TypeError'), "" + "no implicit conversion of " + (name.$class()) + " into Integer") + }; + name = $$($nesting, 'Opal')['$coerce_to!'](name, $$($nesting, 'String'), "to_str"); + return self.$$data[name];; + }, TMP_Struct_$$_17.$$arity = 1); + + Opal.def(self, '$[]=', TMP_Struct_$$$eq_18 = function(name, value) { + var self = this; + + + if ($truthy($$($nesting, 'Integer')['$==='](name))) { + + if ($truthy($rb_lt(name, self.$class().$members().$size()['$-@']()))) { + self.$raise($$($nesting, 'IndexError'), "" + "offset " + (name) + " too small for struct(size:" + (self.$class().$members().$size()) + ")")}; + if ($truthy($rb_ge(name, self.$class().$members().$size()))) { + self.$raise($$($nesting, 'IndexError'), "" + "offset " + (name) + " too large for struct(size:" + (self.$class().$members().$size()) + ")")}; + name = self.$class().$members()['$[]'](name); + } else if ($truthy($$($nesting, 'String')['$==='](name))) { + if ($truthy(self.$class().$members()['$include?'](name.$to_sym()))) { + } else { + self.$raise($$($nesting, 'NameError').$new("" + "no member '" + (name) + "' in struct", name)) + } + } else { + self.$raise($$($nesting, 'TypeError'), "" + "no implicit conversion of " + (name.$class()) + " into Integer") + }; + name = $$($nesting, 'Opal')['$coerce_to!'](name, $$($nesting, 'String'), "to_str"); + return self.$$data[name] = value;; + }, TMP_Struct_$$$eq_18.$$arity = 2); + + Opal.def(self, '$==', TMP_Struct_$eq$eq_19 = function(other) { + var self = this; + + + if ($truthy(other['$instance_of?'](self.$class()))) { + } else { + return false + }; + + var recursed1 = {}, recursed2 = {}; + + function _eqeq(struct, other) { + var key, a, b; + + recursed1[(struct).$__id__()] = true; + recursed2[(other).$__id__()] = true; + + for (key in struct.$$data) { + a = struct.$$data[key]; + b = other.$$data[key]; + + if ($$($nesting, 'Struct')['$==='](a)) { + if (!recursed1.hasOwnProperty((a).$__id__()) || !recursed2.hasOwnProperty((b).$__id__())) { + if (!_eqeq(a, b)) { + return false; + } + } + } else { + if (!(a)['$=='](b)) { + return false; + } + } + } + + return true; + } + + return _eqeq(self, other); + ; + }, TMP_Struct_$eq$eq_19.$$arity = 1); + + Opal.def(self, '$eql?', TMP_Struct_eql$q_20 = function(other) { + var self = this; + + + if ($truthy(other['$instance_of?'](self.$class()))) { + } else { + return false + }; + + var recursed1 = {}, recursed2 = {}; + + function _eqeq(struct, other) { + var key, a, b; + + recursed1[(struct).$__id__()] = true; + recursed2[(other).$__id__()] = true; + + for (key in struct.$$data) { + a = struct.$$data[key]; + b = other.$$data[key]; + + if ($$($nesting, 'Struct')['$==='](a)) { + if (!recursed1.hasOwnProperty((a).$__id__()) || !recursed2.hasOwnProperty((b).$__id__())) { + if (!_eqeq(a, b)) { + return false; + } + } + } else { + if (!(a)['$eql?'](b)) { + return false; + } + } + } + + return true; + } + + return _eqeq(self, other); + ; + }, TMP_Struct_eql$q_20.$$arity = 1); + + Opal.def(self, '$each', TMP_Struct_each_21 = function $$each() { + var TMP_22, TMP_23, $iter = TMP_Struct_each_21.$$p, $yield = $iter || nil, self = this; + + if ($iter) TMP_Struct_each_21.$$p = null; + + if (($yield !== nil)) { + } else { + return $send(self, 'enum_for', ["each"], (TMP_22 = function(){var self = TMP_22.$$s || this; + + return self.$size()}, TMP_22.$$s = self, TMP_22.$$arity = 0, TMP_22)) + }; + $send(self.$class().$members(), 'each', [], (TMP_23 = function(name){var self = TMP_23.$$s || this; + + + + if (name == null) { + name = nil; + }; + return Opal.yield1($yield, self['$[]'](name));;}, TMP_23.$$s = self, TMP_23.$$arity = 1, TMP_23)); + return self; + }, TMP_Struct_each_21.$$arity = 0); + + Opal.def(self, '$each_pair', TMP_Struct_each_pair_24 = function $$each_pair() { + var TMP_25, TMP_26, $iter = TMP_Struct_each_pair_24.$$p, $yield = $iter || nil, self = this; + + if ($iter) TMP_Struct_each_pair_24.$$p = null; + + if (($yield !== nil)) { + } else { + return $send(self, 'enum_for', ["each_pair"], (TMP_25 = function(){var self = TMP_25.$$s || this; + + return self.$size()}, TMP_25.$$s = self, TMP_25.$$arity = 0, TMP_25)) + }; + $send(self.$class().$members(), 'each', [], (TMP_26 = function(name){var self = TMP_26.$$s || this; + + + + if (name == null) { + name = nil; + }; + return Opal.yield1($yield, [name, self['$[]'](name)]);;}, TMP_26.$$s = self, TMP_26.$$arity = 1, TMP_26)); + return self; + }, TMP_Struct_each_pair_24.$$arity = 0); + + Opal.def(self, '$length', TMP_Struct_length_27 = function $$length() { + var self = this; + + return self.$class().$members().$length() + }, TMP_Struct_length_27.$$arity = 0); + Opal.alias(self, "size", "length"); + + Opal.def(self, '$to_a', TMP_Struct_to_a_28 = function $$to_a() { + var TMP_29, self = this; + + return $send(self.$class().$members(), 'map', [], (TMP_29 = function(name){var self = TMP_29.$$s || this; + + + + if (name == null) { + name = nil; + }; + return self['$[]'](name);}, TMP_29.$$s = self, TMP_29.$$arity = 1, TMP_29)) + }, TMP_Struct_to_a_28.$$arity = 0); + Opal.alias(self, "values", "to_a"); + + Opal.def(self, '$inspect', TMP_Struct_inspect_30 = function $$inspect() { + var $a, TMP_31, self = this, result = nil; + + + result = "#"); + return result; + }, TMP_Struct_inspect_30.$$arity = 0); + Opal.alias(self, "to_s", "inspect"); + + Opal.def(self, '$to_h', TMP_Struct_to_h_32 = function $$to_h() { + var TMP_33, self = this; + + return $send(self.$class().$members(), 'each_with_object', [$hash2([], {})], (TMP_33 = function(name, h){var self = TMP_33.$$s || this, $writer = nil; + + + + if (name == null) { + name = nil; + }; + + if (h == null) { + h = nil; + }; + $writer = [name, self['$[]'](name)]; + $send(h, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];}, TMP_33.$$s = self, TMP_33.$$arity = 2, TMP_33)) + }, TMP_Struct_to_h_32.$$arity = 0); + + Opal.def(self, '$values_at', TMP_Struct_values_at_34 = function $$values_at($a) { + var $post_args, args, TMP_35, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + args = $send(args, 'map', [], (TMP_35 = function(arg){var self = TMP_35.$$s || this; + + + + if (arg == null) { + arg = nil; + }; + return arg.$$is_range ? arg.$to_a() : arg;}, TMP_35.$$s = self, TMP_35.$$arity = 1, TMP_35)).$flatten(); + + var result = []; + for (var i = 0, len = args.length; i < len; i++) { + if (!args[i].$$is_number) { + self.$raise($$($nesting, 'TypeError'), "" + "no implicit conversion of " + ((args[i]).$class()) + " into Integer") + } + result.push(self['$[]'](args[i])); + } + return result; + ; + }, TMP_Struct_values_at_34.$$arity = -1); + return (Opal.def(self, '$dig', TMP_Struct_dig_36 = function $$dig(key, $a) { + var $post_args, keys, self = this, item = nil; + + + + $post_args = Opal.slice.call(arguments, 1, arguments.length); + + keys = $post_args;; + item = (function() {if ($truthy(key.$$is_string && self.$$data.hasOwnProperty(key))) { + return self.$$data[key] || nil; + } else { + return nil + }; return nil; })(); + + if (item === nil || keys.length === 0) { + return item; + } + ; + if ($truthy(item['$respond_to?']("dig"))) { + } else { + self.$raise($$($nesting, 'TypeError'), "" + (item.$class()) + " does not have #dig method") + }; + return $send(item, 'dig', Opal.to_a(keys)); + }, TMP_Struct_dig_36.$$arity = -2), nil) && 'dig'; + })($nesting[0], null, $nesting); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/io"] = function(Opal) { + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $module = Opal.module, $send = Opal.send, $gvars = Opal.gvars, $truthy = Opal.truthy, $writer = nil; + + Opal.add_stubs(['$attr_accessor', '$size', '$write', '$join', '$map', '$String', '$empty?', '$concat', '$chomp', '$getbyte', '$getc', '$raise', '$new', '$write_proc=', '$-', '$extend']); + + (function($base, $super, $parent_nesting) { + function $IO(){}; + var self = $IO = $klass($base, $super, 'IO', $IO); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_IO_tty$q_1, TMP_IO_closed$q_2, TMP_IO_write_3, TMP_IO_flush_4; + + def.tty = def.closed = nil; + + Opal.const_set($nesting[0], 'SEEK_SET', 0); + Opal.const_set($nesting[0], 'SEEK_CUR', 1); + Opal.const_set($nesting[0], 'SEEK_END', 2); + + Opal.def(self, '$tty?', TMP_IO_tty$q_1 = function() { + var self = this; + + return self.tty + }, TMP_IO_tty$q_1.$$arity = 0); + + Opal.def(self, '$closed?', TMP_IO_closed$q_2 = function() { + var self = this; + + return self.closed + }, TMP_IO_closed$q_2.$$arity = 0); + self.$attr_accessor("write_proc"); + + Opal.def(self, '$write', TMP_IO_write_3 = function $$write(string) { + var self = this; + + + self.write_proc(string); + return string.$size(); + }, TMP_IO_write_3.$$arity = 1); + self.$attr_accessor("sync", "tty"); + + Opal.def(self, '$flush', TMP_IO_flush_4 = function $$flush() { + var self = this; + + return nil + }, TMP_IO_flush_4.$$arity = 0); + (function($base, $parent_nesting) { + function $Writable() {}; + var self = $Writable = $module($base, 'Writable', $Writable); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Writable_$lt$lt_5, TMP_Writable_print_6, TMP_Writable_puts_8; + + + + Opal.def(self, '$<<', TMP_Writable_$lt$lt_5 = function(string) { + var self = this; + + + self.$write(string); + return self; + }, TMP_Writable_$lt$lt_5.$$arity = 1); + + Opal.def(self, '$print', TMP_Writable_print_6 = function $$print($a) { + var $post_args, args, TMP_7, self = this; + if ($gvars[","] == null) $gvars[","] = nil; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + self.$write($send(args, 'map', [], (TMP_7 = function(arg){var self = TMP_7.$$s || this; + + + + if (arg == null) { + arg = nil; + }; + return self.$String(arg);}, TMP_7.$$s = self, TMP_7.$$arity = 1, TMP_7)).$join($gvars[","])); + return nil; + }, TMP_Writable_print_6.$$arity = -1); + + Opal.def(self, '$puts', TMP_Writable_puts_8 = function $$puts($a) { + var $post_args, args, TMP_9, self = this, newline = nil; + if ($gvars["/"] == null) $gvars["/"] = nil; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + newline = $gvars["/"]; + if ($truthy(args['$empty?']())) { + self.$write($gvars["/"]) + } else { + self.$write($send(args, 'map', [], (TMP_9 = function(arg){var self = TMP_9.$$s || this; + + + + if (arg == null) { + arg = nil; + }; + return self.$String(arg).$chomp();}, TMP_9.$$s = self, TMP_9.$$arity = 1, TMP_9)).$concat([nil]).$join(newline)) + }; + return nil; + }, TMP_Writable_puts_8.$$arity = -1); + })($nesting[0], $nesting); + return (function($base, $parent_nesting) { + function $Readable() {}; + var self = $Readable = $module($base, 'Readable', $Readable); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Readable_readbyte_10, TMP_Readable_readchar_11, TMP_Readable_readline_12, TMP_Readable_readpartial_13; + + + + Opal.def(self, '$readbyte', TMP_Readable_readbyte_10 = function $$readbyte() { + var self = this; + + return self.$getbyte() + }, TMP_Readable_readbyte_10.$$arity = 0); + + Opal.def(self, '$readchar', TMP_Readable_readchar_11 = function $$readchar() { + var self = this; + + return self.$getc() + }, TMP_Readable_readchar_11.$$arity = 0); + + Opal.def(self, '$readline', TMP_Readable_readline_12 = function $$readline(sep) { + var self = this; + if ($gvars["/"] == null) $gvars["/"] = nil; + + + + if (sep == null) { + sep = $gvars["/"]; + }; + return self.$raise($$($nesting, 'NotImplementedError')); + }, TMP_Readable_readline_12.$$arity = -1); + + Opal.def(self, '$readpartial', TMP_Readable_readpartial_13 = function $$readpartial(integer, outbuf) { + var self = this; + + + + if (outbuf == null) { + outbuf = nil; + }; + return self.$raise($$($nesting, 'NotImplementedError')); + }, TMP_Readable_readpartial_13.$$arity = -2); + })($nesting[0], $nesting); + })($nesting[0], null, $nesting); + Opal.const_set($nesting[0], 'STDERR', ($gvars.stderr = $$($nesting, 'IO').$new())); + Opal.const_set($nesting[0], 'STDIN', ($gvars.stdin = $$($nesting, 'IO').$new())); + Opal.const_set($nesting[0], 'STDOUT', ($gvars.stdout = $$($nesting, 'IO').$new())); + var console = Opal.global.console; + + $writer = [typeof(process) === 'object' && typeof(process.stdout) === 'object' ? function(s){process.stdout.write(s)} : function(s){console.log(s)}]; + $send($$($nesting, 'STDOUT'), 'write_proc=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = [typeof(process) === 'object' && typeof(process.stderr) === 'object' ? function(s){process.stderr.write(s)} : function(s){console.warn(s)}]; + $send($$($nesting, 'STDERR'), 'write_proc=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + $$($nesting, 'STDOUT').$extend($$$($$($nesting, 'IO'), 'Writable')); + return $$($nesting, 'STDERR').$extend($$$($$($nesting, 'IO'), 'Writable')); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/main"] = function(Opal) { + var TMP_to_s_1, TMP_include_2, self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice; + + Opal.add_stubs(['$include']); + + Opal.defs(self, '$to_s', TMP_to_s_1 = function $$to_s() { + var self = this; + + return "main" + }, TMP_to_s_1.$$arity = 0); + return (Opal.defs(self, '$include', TMP_include_2 = function $$include(mod) { + var self = this; + + return $$($nesting, 'Object').$include(mod) + }, TMP_include_2.$$arity = 1), nil) && 'include'; +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/dir"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $truthy = Opal.truthy; + + Opal.add_stubs(['$[]']); + return (function($base, $super, $parent_nesting) { + function $Dir(){}; + var self = $Dir = $klass($base, $super, 'Dir', $Dir); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return (function(self, $parent_nesting) { + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_chdir_1, TMP_pwd_2, TMP_home_3; + + + + Opal.def(self, '$chdir', TMP_chdir_1 = function $$chdir(dir) { + var $iter = TMP_chdir_1.$$p, $yield = $iter || nil, self = this, prev_cwd = nil; + + if ($iter) TMP_chdir_1.$$p = null; + return (function() { try { + + prev_cwd = Opal.current_dir; + Opal.current_dir = dir; + return Opal.yieldX($yield, []);; + } finally { + Opal.current_dir = prev_cwd + }; })() + }, TMP_chdir_1.$$arity = 1); + + Opal.def(self, '$pwd', TMP_pwd_2 = function $$pwd() { + var self = this; + + return Opal.current_dir || '.'; + }, TMP_pwd_2.$$arity = 0); + Opal.alias(self, "getwd", "pwd"); + return (Opal.def(self, '$home', TMP_home_3 = function $$home() { + var $a, self = this; + + return ($truthy($a = $$($nesting, 'ENV')['$[]']("HOME")) ? $a : ".") + }, TMP_home_3.$$arity = 0), nil) && 'home'; + })(Opal.get_singleton_class(self), $nesting) + })($nesting[0], null, $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/file"] = function(Opal) { + function $rb_plus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); + } + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $truthy = Opal.truthy, $range = Opal.range, $send = Opal.send; + + Opal.add_stubs(['$home', '$raise', '$start_with?', '$+', '$sub', '$pwd', '$split', '$unshift', '$join', '$respond_to?', '$coerce_to!', '$basename', '$empty?', '$rindex', '$[]', '$nil?', '$==', '$-', '$length', '$gsub', '$find', '$=~', '$map', '$each_with_index', '$flatten', '$reject', '$to_proc', '$end_with?']); + return (function($base, $super, $parent_nesting) { + function $File(){}; + var self = $File = $klass($base, $super, 'File', $File); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), windows_root_rx = nil; + + + Opal.const_set($nesting[0], 'Separator', Opal.const_set($nesting[0], 'SEPARATOR', "/")); + Opal.const_set($nesting[0], 'ALT_SEPARATOR', nil); + Opal.const_set($nesting[0], 'PATH_SEPARATOR', ":"); + Opal.const_set($nesting[0], 'FNM_SYSCASE', 0); + windows_root_rx = /^[a-zA-Z]:(?:\\|\/)/; + return (function(self, $parent_nesting) { + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_expand_path_1, TMP_dirname_2, TMP_basename_3, TMP_extname_4, TMP_exist$q_5, TMP_directory$q_6, TMP_join_8, TMP_split_11; + + + + Opal.def(self, '$expand_path', TMP_expand_path_1 = function $$expand_path(path, basedir) { + var $a, self = this, sep = nil, sep_chars = nil, new_parts = nil, home = nil, home_path_regexp = nil, path_abs = nil, basedir_abs = nil, parts = nil, leading_sep = nil, abs = nil, new_path = nil; + + + + if (basedir == null) { + basedir = nil; + }; + sep = $$($nesting, 'SEPARATOR'); + sep_chars = $sep_chars(); + new_parts = []; + if ($truthy(path[0] === '~' || (basedir && basedir[0] === '~'))) { + + home = $$($nesting, 'Dir').$home(); + if ($truthy(home)) { + } else { + self.$raise($$($nesting, 'ArgumentError'), "couldn't find HOME environment -- expanding `~'") + }; + if ($truthy(home['$start_with?'](sep))) { + } else { + self.$raise($$($nesting, 'ArgumentError'), "non-absolute home") + }; + home = $rb_plus(home, sep); + home_path_regexp = new RegExp("" + "^\\~(?:" + (sep) + "|$)"); + path = path.$sub(home_path_regexp, home); + if ($truthy(basedir)) { + basedir = basedir.$sub(home_path_regexp, home)};}; + basedir = ($truthy($a = basedir) ? $a : $$($nesting, 'Dir').$pwd()); + path_abs = path.substr(0, sep.length) === sep || windows_root_rx.test(path); + basedir_abs = basedir.substr(0, sep.length) === sep || windows_root_rx.test(basedir); + if ($truthy(path_abs)) { + + parts = path.$split(new RegExp("" + "[" + (sep_chars) + "]")); + leading_sep = windows_root_rx.test(path) ? '' : path.$sub(new RegExp("" + "^([" + (sep_chars) + "]+).*$"), "\\1"); + abs = true; + } else { + + parts = $rb_plus(basedir.$split(new RegExp("" + "[" + (sep_chars) + "]")), path.$split(new RegExp("" + "[" + (sep_chars) + "]"))); + leading_sep = windows_root_rx.test(basedir) ? '' : basedir.$sub(new RegExp("" + "^([" + (sep_chars) + "]+).*$"), "\\1"); + abs = basedir_abs; + }; + + var part; + for (var i = 0, ii = parts.length; i < ii; i++) { + part = parts[i]; + + if ( + (part === nil) || + (part === '' && ((new_parts.length === 0) || abs)) || + (part === '.' && ((new_parts.length === 0) || abs)) + ) { + continue; + } + if (part === '..') { + new_parts.pop(); + } else { + new_parts.push(part); + } + } + + if (!abs && parts[0] !== '.') { + new_parts.$unshift(".") + } + ; + new_path = new_parts.$join(sep); + if ($truthy(abs)) { + new_path = $rb_plus(leading_sep, new_path)}; + return new_path; + }, TMP_expand_path_1.$$arity = -2); + Opal.alias(self, "realpath", "expand_path"); + + // Coerce a given path to a path string using #to_path and #to_str + function $coerce_to_path(path) { + if ($truthy((path)['$respond_to?']("to_path"))) { + path = path.$to_path(); + } + + path = $$($nesting, 'Opal')['$coerce_to!'](path, $$($nesting, 'String'), "to_str"); + + return path; + } + + // Return a RegExp compatible char class + function $sep_chars() { + if ($$($nesting, 'ALT_SEPARATOR') === nil) { + return Opal.escape_regexp($$($nesting, 'SEPARATOR')); + } else { + return Opal.escape_regexp($rb_plus($$($nesting, 'SEPARATOR'), $$($nesting, 'ALT_SEPARATOR'))); + } + } + ; + + Opal.def(self, '$dirname', TMP_dirname_2 = function $$dirname(path) { + var self = this, sep_chars = nil; + + + sep_chars = $sep_chars(); + path = $coerce_to_path(path); + + var absolute = path.match(new RegExp("" + "^[" + (sep_chars) + "]")); + + path = path.replace(new RegExp("" + "[" + (sep_chars) + "]+$"), ''); // remove trailing separators + path = path.replace(new RegExp("" + "[^" + (sep_chars) + "]+$"), ''); // remove trailing basename + path = path.replace(new RegExp("" + "[" + (sep_chars) + "]+$"), ''); // remove final trailing separators + + if (path === '') { + return absolute ? '/' : '.'; + } + + return path; + ; + }, TMP_dirname_2.$$arity = 1); + + Opal.def(self, '$basename', TMP_basename_3 = function $$basename(name, suffix) { + var self = this, sep_chars = nil; + + + + if (suffix == null) { + suffix = nil; + }; + sep_chars = $sep_chars(); + name = $coerce_to_path(name); + + if (name.length == 0) { + return name; + } + + if (suffix !== nil) { + suffix = $$($nesting, 'Opal')['$coerce_to!'](suffix, $$($nesting, 'String'), "to_str") + } else { + suffix = null; + } + + name = name.replace(new RegExp("" + "(.)[" + (sep_chars) + "]*$"), '$1'); + name = name.replace(new RegExp("" + "^(?:.*[" + (sep_chars) + "])?([^" + (sep_chars) + "]+)$"), '$1'); + + if (suffix === ".*") { + name = name.replace(/\.[^\.]+$/, ''); + } else if(suffix !== null) { + suffix = Opal.escape_regexp(suffix); + name = name.replace(new RegExp("" + (suffix) + "$"), ''); + } + + return name; + ; + }, TMP_basename_3.$$arity = -2); + + Opal.def(self, '$extname', TMP_extname_4 = function $$extname(path) { + var $a, self = this, filename = nil, last_dot_idx = nil; + + + path = $coerce_to_path(path); + filename = self.$basename(path); + if ($truthy(filename['$empty?']())) { + return ""}; + last_dot_idx = filename['$[]']($range(1, -1, false)).$rindex("."); + if ($truthy(($truthy($a = last_dot_idx['$nil?']()) ? $a : $rb_plus(last_dot_idx, 1)['$==']($rb_minus(filename.$length(), 1))))) { + return "" + } else { + return filename['$[]'](Opal.Range.$new($rb_plus(last_dot_idx, 1), -1, false)) + }; + }, TMP_extname_4.$$arity = 1); + + Opal.def(self, '$exist?', TMP_exist$q_5 = function(path) { + var self = this; + + return Opal.modules[path] != null + }, TMP_exist$q_5.$$arity = 1); + Opal.alias(self, "exists?", "exist?"); + + Opal.def(self, '$directory?', TMP_directory$q_6 = function(path) { + var TMP_7, self = this, files = nil, file = nil; + + + files = []; + + for (var key in Opal.modules) { + files.push(key) + } + ; + path = path.$gsub(new RegExp("" + "(^." + ($$($nesting, 'SEPARATOR')) + "+|" + ($$($nesting, 'SEPARATOR')) + "+$)")); + file = $send(files, 'find', [], (TMP_7 = function(f){var self = TMP_7.$$s || this; + + + + if (f == null) { + f = nil; + }; + return f['$=~'](new RegExp("" + "^" + (path)));}, TMP_7.$$s = self, TMP_7.$$arity = 1, TMP_7)); + return file; + }, TMP_directory$q_6.$$arity = 1); + + Opal.def(self, '$join', TMP_join_8 = function $$join($a) { + var $post_args, paths, TMP_9, TMP_10, self = this, result = nil; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + paths = $post_args;; + if ($truthy(paths['$empty?']())) { + return ""}; + result = ""; + paths = $send(paths.$flatten().$each_with_index(), 'map', [], (TMP_9 = function(item, index){var self = TMP_9.$$s || this, $b; + + + + if (item == null) { + item = nil; + }; + + if (index == null) { + index = nil; + }; + if ($truthy((($b = index['$=='](0)) ? item['$empty?']() : index['$=='](0)))) { + return $$($nesting, 'SEPARATOR') + } else if ($truthy((($b = paths.$length()['$==']($rb_plus(index, 1))) ? item['$empty?']() : paths.$length()['$==']($rb_plus(index, 1))))) { + return $$($nesting, 'SEPARATOR') + } else { + return item + };}, TMP_9.$$s = self, TMP_9.$$arity = 2, TMP_9)); + paths = $send(paths, 'reject', [], "empty?".$to_proc()); + $send(paths, 'each_with_index', [], (TMP_10 = function(item, index){var self = TMP_10.$$s || this, $b, next_item = nil; + + + + if (item == null) { + item = nil; + }; + + if (index == null) { + index = nil; + }; + next_item = paths['$[]']($rb_plus(index, 1)); + if ($truthy(next_item['$nil?']())) { + return (result = "" + (result) + (item)) + } else { + + if ($truthy(($truthy($b = item['$end_with?']($$($nesting, 'SEPARATOR'))) ? next_item['$start_with?']($$($nesting, 'SEPARATOR')) : $b))) { + item = item.$sub(new RegExp("" + ($$($nesting, 'SEPARATOR')) + "+$"), "")}; + return (result = (function() {if ($truthy(($truthy($b = item['$end_with?']($$($nesting, 'SEPARATOR'))) ? $b : next_item['$start_with?']($$($nesting, 'SEPARATOR'))))) { + return "" + (result) + (item) + } else { + return "" + (result) + (item) + ($$($nesting, 'SEPARATOR')) + }; return nil; })()); + };}, TMP_10.$$s = self, TMP_10.$$arity = 2, TMP_10)); + return result; + }, TMP_join_8.$$arity = -1); + return (Opal.def(self, '$split', TMP_split_11 = function $$split(path) { + var self = this; + + return path.$split($$($nesting, 'SEPARATOR')) + }, TMP_split_11.$$arity = 1), nil) && 'split'; + })(Opal.get_singleton_class(self), $nesting); + })($nesting[0], $$($nesting, 'IO'), $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/process"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $truthy = Opal.truthy; + + Opal.add_stubs(['$const_set', '$size', '$<<', '$__register_clock__', '$to_f', '$now', '$new', '$[]', '$raise']); + + (function($base, $super, $parent_nesting) { + function $Process(){}; + var self = $Process = $klass($base, $super, 'Process', $Process); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Process___register_clock___1, TMP_Process_pid_2, TMP_Process_times_3, TMP_Process_clock_gettime_4, monotonic = nil; + + + self.__clocks__ = []; + Opal.defs(self, '$__register_clock__', TMP_Process___register_clock___1 = function $$__register_clock__(name, func) { + var self = this; + if (self.__clocks__ == null) self.__clocks__ = nil; + + + self.$const_set(name, self.__clocks__.$size()); + return self.__clocks__['$<<'](func); + }, TMP_Process___register_clock___1.$$arity = 2); + self.$__register_clock__("CLOCK_REALTIME", function() { return Date.now() }); + monotonic = false; + + if (Opal.global.performance) { + monotonic = function() { + return performance.now() + }; + } + else if (Opal.global.process && process.hrtime) { + // let now be the base to get smaller numbers + var hrtime_base = process.hrtime(); + + monotonic = function() { + var hrtime = process.hrtime(hrtime_base); + var us = (hrtime[1] / 1000) | 0; // cut below microsecs; + return ((hrtime[0] * 1000) + (us / 1000)); + }; + } + ; + if ($truthy(monotonic)) { + self.$__register_clock__("CLOCK_MONOTONIC", monotonic)}; + Opal.defs(self, '$pid', TMP_Process_pid_2 = function $$pid() { + var self = this; + + return 0 + }, TMP_Process_pid_2.$$arity = 0); + Opal.defs(self, '$times', TMP_Process_times_3 = function $$times() { + var self = this, t = nil; + + + t = $$($nesting, 'Time').$now().$to_f(); + return $$$($$($nesting, 'Benchmark'), 'Tms').$new(t, t, t, t, t); + }, TMP_Process_times_3.$$arity = 0); + return (Opal.defs(self, '$clock_gettime', TMP_Process_clock_gettime_4 = function $$clock_gettime(clock_id, unit) { + var $a, self = this, clock = nil; + if (self.__clocks__ == null) self.__clocks__ = nil; + + + + if (unit == null) { + unit = "float_second"; + }; + ($truthy($a = (clock = self.__clocks__['$[]'](clock_id))) ? $a : self.$raise($$$($$($nesting, 'Errno'), 'EINVAL'), "" + "clock_gettime(" + (clock_id) + ") " + (self.__clocks__['$[]'](clock_id)))); + + var ms = clock(); + switch (unit) { + case 'float_second': return (ms / 1000); // number of seconds as a float (default) + case 'float_millisecond': return (ms / 1); // number of milliseconds as a float + case 'float_microsecond': return (ms * 1000); // number of microseconds as a float + case 'second': return ((ms / 1000) | 0); // number of seconds as an integer + case 'millisecond': return ((ms / 1) | 0); // number of milliseconds as an integer + case 'microsecond': return ((ms * 1000) | 0); // number of microseconds as an integer + case 'nanosecond': return ((ms * 1000000) | 0); // number of nanoseconds as an integer + default: self.$raise($$($nesting, 'ArgumentError'), "" + "unexpected unit: " + (unit)) + } + ; + }, TMP_Process_clock_gettime_4.$$arity = -2), nil) && 'clock_gettime'; + })($nesting[0], null, $nesting); + (function($base, $super, $parent_nesting) { + function $Signal(){}; + var self = $Signal = $klass($base, $super, 'Signal', $Signal); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Signal_trap_5; + + return (Opal.defs(self, '$trap', TMP_Signal_trap_5 = function $$trap($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return nil; + }, TMP_Signal_trap_5.$$arity = -1), nil) && 'trap' + })($nesting[0], null, $nesting); + return (function($base, $super, $parent_nesting) { + function $GC(){}; + var self = $GC = $klass($base, $super, 'GC', $GC); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_GC_start_6; + + return (Opal.defs(self, '$start', TMP_GC_start_6 = function $$start() { + var self = this; + + return nil + }, TMP_GC_start_6.$$arity = 0), nil) && 'start' + })($nesting[0], null, $nesting); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/random"] = function(Opal) { + function $rb_lt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $truthy = Opal.truthy, $send = Opal.send; + + Opal.add_stubs(['$attr_reader', '$new_seed', '$coerce_to!', '$reseed', '$rand', '$seed', '$<', '$raise', '$encode', '$join', '$new', '$chr', '$===', '$==', '$state', '$const_defined?', '$const_set']); + return (function($base, $super, $parent_nesting) { + function $Random(){}; + var self = $Random = $klass($base, $super, 'Random', $Random); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Random_initialize_1, TMP_Random_reseed_2, TMP_Random_new_seed_3, TMP_Random_rand_4, TMP_Random_srand_5, TMP_Random_urandom_6, TMP_Random_$eq$eq_8, TMP_Random_bytes_9, TMP_Random_rand_11, TMP_Random_generator$eq_12; + + + self.$attr_reader("seed", "state"); + + Opal.def(self, '$initialize', TMP_Random_initialize_1 = function $$initialize(seed) { + var self = this; + + + + if (seed == null) { + seed = $$($nesting, 'Random').$new_seed(); + }; + seed = $$($nesting, 'Opal')['$coerce_to!'](seed, $$($nesting, 'Integer'), "to_int"); + self.state = seed; + return self.$reseed(seed); + }, TMP_Random_initialize_1.$$arity = -1); + + Opal.def(self, '$reseed', TMP_Random_reseed_2 = function $$reseed(seed) { + var self = this; + + + self.seed = seed; + return self.$rng = Opal.$$rand.reseed(seed);; + }, TMP_Random_reseed_2.$$arity = 1); + Opal.defs(self, '$new_seed', TMP_Random_new_seed_3 = function $$new_seed() { + var self = this; + + return Opal.$$rand.new_seed(); + }, TMP_Random_new_seed_3.$$arity = 0); + Opal.defs(self, '$rand', TMP_Random_rand_4 = function $$rand(limit) { + var self = this; + + + ; + return $$($nesting, 'DEFAULT').$rand(limit); + }, TMP_Random_rand_4.$$arity = -1); + Opal.defs(self, '$srand', TMP_Random_srand_5 = function $$srand(n) { + var self = this, previous_seed = nil; + + + + if (n == null) { + n = $$($nesting, 'Random').$new_seed(); + }; + n = $$($nesting, 'Opal')['$coerce_to!'](n, $$($nesting, 'Integer'), "to_int"); + previous_seed = $$($nesting, 'DEFAULT').$seed(); + $$($nesting, 'DEFAULT').$reseed(n); + return previous_seed; + }, TMP_Random_srand_5.$$arity = -1); + Opal.defs(self, '$urandom', TMP_Random_urandom_6 = function $$urandom(size) { + var TMP_7, self = this; + + + size = $$($nesting, 'Opal')['$coerce_to!'](size, $$($nesting, 'Integer'), "to_int"); + if ($truthy($rb_lt(size, 0))) { + self.$raise($$($nesting, 'ArgumentError'), "negative string size (or size too big)")}; + return $send($$($nesting, 'Array'), 'new', [size], (TMP_7 = function(){var self = TMP_7.$$s || this; + + return self.$rand(255).$chr()}, TMP_7.$$s = self, TMP_7.$$arity = 0, TMP_7)).$join().$encode("ASCII-8BIT"); + }, TMP_Random_urandom_6.$$arity = 1); + + Opal.def(self, '$==', TMP_Random_$eq$eq_8 = function(other) { + var $a, self = this; + + + if ($truthy($$($nesting, 'Random')['$==='](other))) { + } else { + return false + }; + return (($a = self.$seed()['$=='](other.$seed())) ? self.$state()['$=='](other.$state()) : self.$seed()['$=='](other.$seed())); + }, TMP_Random_$eq$eq_8.$$arity = 1); + + Opal.def(self, '$bytes', TMP_Random_bytes_9 = function $$bytes(length) { + var TMP_10, self = this; + + + length = $$($nesting, 'Opal')['$coerce_to!'](length, $$($nesting, 'Integer'), "to_int"); + return $send($$($nesting, 'Array'), 'new', [length], (TMP_10 = function(){var self = TMP_10.$$s || this; + + return self.$rand(255).$chr()}, TMP_10.$$s = self, TMP_10.$$arity = 0, TMP_10)).$join().$encode("ASCII-8BIT"); + }, TMP_Random_bytes_9.$$arity = 1); + + Opal.def(self, '$rand', TMP_Random_rand_11 = function $$rand(limit) { + var self = this; + + + ; + + function randomFloat() { + self.state++; + return Opal.$$rand.rand(self.$rng); + } + + function randomInt() { + return Math.floor(randomFloat() * limit); + } + + function randomRange() { + var min = limit.begin, + max = limit.end; + + if (min === nil || max === nil) { + return nil; + } + + var length = max - min; + + if (length < 0) { + return nil; + } + + if (length === 0) { + return min; + } + + if (max % 1 === 0 && min % 1 === 0 && !limit.excl) { + length++; + } + + return self.$rand(length) + min; + } + + if (limit == null) { + return randomFloat(); + } else if (limit.$$is_range) { + return randomRange(); + } else if (limit.$$is_number) { + if (limit <= 0) { + self.$raise($$($nesting, 'ArgumentError'), "" + "invalid argument - " + (limit)) + } + + if (limit % 1 === 0) { + // integer + return randomInt(); + } else { + return randomFloat() * limit; + } + } else { + limit = $$($nesting, 'Opal')['$coerce_to!'](limit, $$($nesting, 'Integer'), "to_int"); + + if (limit <= 0) { + self.$raise($$($nesting, 'ArgumentError'), "" + "invalid argument - " + (limit)) + } + + return randomInt(); + } + ; + }, TMP_Random_rand_11.$$arity = -1); + return (Opal.defs(self, '$generator=', TMP_Random_generator$eq_12 = function(generator) { + var self = this; + + + Opal.$$rand = generator; + if ($truthy(self['$const_defined?']("DEFAULT"))) { + return $$($nesting, 'DEFAULT').$reseed() + } else { + return self.$const_set("DEFAULT", self.$new(self.$new_seed())) + }; + }, TMP_Random_generator$eq_12.$$arity = 1), nil) && 'generator='; + })($nesting[0], null, $nesting) +}; + +/* +This is based on an adaptation of Makoto Matsumoto and Takuji Nishimura's code +done by Sean McCullough and Dave Heitzman +, subsequently readapted from an updated version of +ruby's random.c (rev c38a183032a7826df1adabd8aa0725c713d53e1c). + +The original copyright notice from random.c follows. + + This is based on trimmed version of MT19937. To get the original version, + contact . + + The original copyright notice follows. + + A C-program for MT19937, with initialization improved 2002/2/10. + Coded by Takuji Nishimura and Makoto Matsumoto. + This is a faster version by taking Shawn Cokus's optimization, + Matthe Bellew's simplification, Isaku Wada's real version. + + Before using, initialize the state by using init_genrand(mt, seed) + or init_by_array(mt, init_key, key_length). + + Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura, + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + 3. The names of its contributors may not be used to endorse or promote + products derived from this software without specific prior written + permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + + Any feedback is very welcome. + http://www.math.keio.ac.jp/matumoto/emt.html + email: matumoto@math.keio.ac.jp +*/ +var MersenneTwister = (function() { + /* Period parameters */ + var N = 624; + var M = 397; + var MATRIX_A = 0x9908b0df; /* constant vector a */ + var UMASK = 0x80000000; /* most significant w-r bits */ + var LMASK = 0x7fffffff; /* least significant r bits */ + var MIXBITS = function(u,v) { return ( ((u) & UMASK) | ((v) & LMASK) ); }; + var TWIST = function(u,v) { return (MIXBITS((u),(v)) >>> 1) ^ ((v & 0x1) ? MATRIX_A : 0x0); }; + + function init(s) { + var mt = {left: 0, next: N, state: new Array(N)}; + init_genrand(mt, s); + return mt; + } + + /* initializes mt[N] with a seed */ + function init_genrand(mt, s) { + var j, i; + mt.state[0] = s >>> 0; + for (j=1; j> 30) >>> 0)) + j); + /* See Knuth TAOCP Vol2. 3rd Ed. P.106 for multiplier. */ + /* In the previous versions, MSBs of the seed affect */ + /* only MSBs of the array state[]. */ + /* 2002/01/09 modified by Makoto Matsumoto */ + mt.state[j] &= 0xffffffff; /* for >32 bit machines */ + } + mt.left = 1; + mt.next = N; + } + + /* generate N words at one time */ + function next_state(mt) { + var p = 0, _p = mt.state; + var j; + + mt.left = N; + mt.next = 0; + + for (j=N-M+1; --j; p++) + _p[p] = _p[p+(M)] ^ TWIST(_p[p+(0)], _p[p+(1)]); + + for (j=M; --j; p++) + _p[p] = _p[p+(M-N)] ^ TWIST(_p[p+(0)], _p[p+(1)]); + + _p[p] = _p[p+(M-N)] ^ TWIST(_p[p+(0)], _p[0]); + } + + /* generates a random number on [0,0xffffffff]-interval */ + function genrand_int32(mt) { + /* mt must be initialized */ + var y; + + if (--mt.left <= 0) next_state(mt); + y = mt.state[mt.next++]; + + /* Tempering */ + y ^= (y >>> 11); + y ^= (y << 7) & 0x9d2c5680; + y ^= (y << 15) & 0xefc60000; + y ^= (y >>> 18); + + return y >>> 0; + } + + function int_pair_to_real_exclusive(a, b) { + a >>>= 5; + b >>>= 6; + return(a*67108864.0+b)*(1.0/9007199254740992.0); + } + + // generates a random number on [0,1) with 53-bit resolution + function genrand_real(mt) { + /* mt must be initialized */ + var a = genrand_int32(mt), b = genrand_int32(mt); + return int_pair_to_real_exclusive(a, b); + } + + return { genrand_real: genrand_real, init: init }; +})(); +Opal.loaded(["corelib/random/MersenneTwister.js"]); +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/random/mersenne_twister"] = function(Opal) { + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $send = Opal.send; + + Opal.add_stubs(['$require', '$generator=', '$-']); + + self.$require("corelib/random/MersenneTwister"); + return (function($base, $super, $parent_nesting) { + function $Random(){}; + var self = $Random = $klass($base, $super, 'Random', $Random); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), $writer = nil; + + + var MAX_INT = Number.MAX_SAFE_INTEGER || Math.pow(2, 53) - 1; + Opal.const_set($nesting[0], 'MERSENNE_TWISTER_GENERATOR', { + new_seed: function() { return Math.round(Math.random() * MAX_INT); }, + reseed: function(seed) { return MersenneTwister.init(seed); }, + rand: function(mt) { return MersenneTwister.genrand_real(mt); } + }); + + $writer = [$$($nesting, 'MERSENNE_TWISTER_GENERATOR')]; + $send(self, 'generator=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];; + })($nesting[0], null, $nesting); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/unsupported"] = function(Opal) { + var TMP_public_35, TMP_private_36, self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $module = Opal.module; + + Opal.add_stubs(['$raise', '$warn', '$%']); + + + var warnings = {}; + + function handle_unsupported_feature(message) { + switch (Opal.config.unsupported_features_severity) { + case 'error': + $$($nesting, 'Kernel').$raise($$($nesting, 'NotImplementedError'), message) + break; + case 'warning': + warn(message) + break; + default: // ignore + // noop + } + } + + function warn(string) { + if (warnings[string]) { + return; + } + + warnings[string] = true; + self.$warn(string); + } +; + (function($base, $super, $parent_nesting) { + function $String(){}; + var self = $String = $klass($base, $super, 'String', $String); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_String_$lt$lt_1, TMP_String_capitalize$B_2, TMP_String_chomp$B_3, TMP_String_chop$B_4, TMP_String_downcase$B_5, TMP_String_gsub$B_6, TMP_String_lstrip$B_7, TMP_String_next$B_8, TMP_String_reverse$B_9, TMP_String_slice$B_10, TMP_String_squeeze$B_11, TMP_String_strip$B_12, TMP_String_sub$B_13, TMP_String_succ$B_14, TMP_String_swapcase$B_15, TMP_String_tr$B_16, TMP_String_tr_s$B_17, TMP_String_upcase$B_18, TMP_String_prepend_19, TMP_String_$$$eq_20, TMP_String_clear_21, TMP_String_encode$B_22, TMP_String_unicode_normalize$B_23; + + + var ERROR = "String#%s not supported. Mutable String methods are not supported in Opal."; + + Opal.def(self, '$<<', TMP_String_$lt$lt_1 = function($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return self.$raise($$($nesting, 'NotImplementedError'), (ERROR)['$%']("<<")); + }, TMP_String_$lt$lt_1.$$arity = -1); + + Opal.def(self, '$capitalize!', TMP_String_capitalize$B_2 = function($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return self.$raise($$($nesting, 'NotImplementedError'), (ERROR)['$%']("capitalize!")); + }, TMP_String_capitalize$B_2.$$arity = -1); + + Opal.def(self, '$chomp!', TMP_String_chomp$B_3 = function($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return self.$raise($$($nesting, 'NotImplementedError'), (ERROR)['$%']("chomp!")); + }, TMP_String_chomp$B_3.$$arity = -1); + + Opal.def(self, '$chop!', TMP_String_chop$B_4 = function($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return self.$raise($$($nesting, 'NotImplementedError'), (ERROR)['$%']("chop!")); + }, TMP_String_chop$B_4.$$arity = -1); + + Opal.def(self, '$downcase!', TMP_String_downcase$B_5 = function($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return self.$raise($$($nesting, 'NotImplementedError'), (ERROR)['$%']("downcase!")); + }, TMP_String_downcase$B_5.$$arity = -1); + + Opal.def(self, '$gsub!', TMP_String_gsub$B_6 = function($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return self.$raise($$($nesting, 'NotImplementedError'), (ERROR)['$%']("gsub!")); + }, TMP_String_gsub$B_6.$$arity = -1); + + Opal.def(self, '$lstrip!', TMP_String_lstrip$B_7 = function($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return self.$raise($$($nesting, 'NotImplementedError'), (ERROR)['$%']("lstrip!")); + }, TMP_String_lstrip$B_7.$$arity = -1); + + Opal.def(self, '$next!', TMP_String_next$B_8 = function($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return self.$raise($$($nesting, 'NotImplementedError'), (ERROR)['$%']("next!")); + }, TMP_String_next$B_8.$$arity = -1); + + Opal.def(self, '$reverse!', TMP_String_reverse$B_9 = function($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return self.$raise($$($nesting, 'NotImplementedError'), (ERROR)['$%']("reverse!")); + }, TMP_String_reverse$B_9.$$arity = -1); + + Opal.def(self, '$slice!', TMP_String_slice$B_10 = function($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return self.$raise($$($nesting, 'NotImplementedError'), (ERROR)['$%']("slice!")); + }, TMP_String_slice$B_10.$$arity = -1); + + Opal.def(self, '$squeeze!', TMP_String_squeeze$B_11 = function($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return self.$raise($$($nesting, 'NotImplementedError'), (ERROR)['$%']("squeeze!")); + }, TMP_String_squeeze$B_11.$$arity = -1); + + Opal.def(self, '$strip!', TMP_String_strip$B_12 = function($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return self.$raise($$($nesting, 'NotImplementedError'), (ERROR)['$%']("strip!")); + }, TMP_String_strip$B_12.$$arity = -1); + + Opal.def(self, '$sub!', TMP_String_sub$B_13 = function($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return self.$raise($$($nesting, 'NotImplementedError'), (ERROR)['$%']("sub!")); + }, TMP_String_sub$B_13.$$arity = -1); + + Opal.def(self, '$succ!', TMP_String_succ$B_14 = function($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return self.$raise($$($nesting, 'NotImplementedError'), (ERROR)['$%']("succ!")); + }, TMP_String_succ$B_14.$$arity = -1); + + Opal.def(self, '$swapcase!', TMP_String_swapcase$B_15 = function($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return self.$raise($$($nesting, 'NotImplementedError'), (ERROR)['$%']("swapcase!")); + }, TMP_String_swapcase$B_15.$$arity = -1); + + Opal.def(self, '$tr!', TMP_String_tr$B_16 = function($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return self.$raise($$($nesting, 'NotImplementedError'), (ERROR)['$%']("tr!")); + }, TMP_String_tr$B_16.$$arity = -1); + + Opal.def(self, '$tr_s!', TMP_String_tr_s$B_17 = function($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return self.$raise($$($nesting, 'NotImplementedError'), (ERROR)['$%']("tr_s!")); + }, TMP_String_tr_s$B_17.$$arity = -1); + + Opal.def(self, '$upcase!', TMP_String_upcase$B_18 = function($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return self.$raise($$($nesting, 'NotImplementedError'), (ERROR)['$%']("upcase!")); + }, TMP_String_upcase$B_18.$$arity = -1); + + Opal.def(self, '$prepend', TMP_String_prepend_19 = function $$prepend($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return self.$raise($$($nesting, 'NotImplementedError'), (ERROR)['$%']("prepend")); + }, TMP_String_prepend_19.$$arity = -1); + + Opal.def(self, '$[]=', TMP_String_$$$eq_20 = function($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return self.$raise($$($nesting, 'NotImplementedError'), (ERROR)['$%']("[]=")); + }, TMP_String_$$$eq_20.$$arity = -1); + + Opal.def(self, '$clear', TMP_String_clear_21 = function $$clear($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return self.$raise($$($nesting, 'NotImplementedError'), (ERROR)['$%']("clear")); + }, TMP_String_clear_21.$$arity = -1); + + Opal.def(self, '$encode!', TMP_String_encode$B_22 = function($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return self.$raise($$($nesting, 'NotImplementedError'), (ERROR)['$%']("encode!")); + }, TMP_String_encode$B_22.$$arity = -1); + return (Opal.def(self, '$unicode_normalize!', TMP_String_unicode_normalize$B_23 = function($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return self.$raise($$($nesting, 'NotImplementedError'), (ERROR)['$%']("unicode_normalize!")); + }, TMP_String_unicode_normalize$B_23.$$arity = -1), nil) && 'unicode_normalize!'; + })($nesting[0], null, $nesting); + (function($base, $parent_nesting) { + function $Kernel() {}; + var self = $Kernel = $module($base, 'Kernel', $Kernel); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Kernel_freeze_24, TMP_Kernel_frozen$q_25; + + + var ERROR = "Object freezing is not supported by Opal"; + + Opal.def(self, '$freeze', TMP_Kernel_freeze_24 = function $$freeze() { + var self = this; + + + handle_unsupported_feature(ERROR); + return self; + }, TMP_Kernel_freeze_24.$$arity = 0); + + Opal.def(self, '$frozen?', TMP_Kernel_frozen$q_25 = function() { + var self = this; + + + handle_unsupported_feature(ERROR); + return false; + }, TMP_Kernel_frozen$q_25.$$arity = 0); + })($nesting[0], $nesting); + (function($base, $parent_nesting) { + function $Kernel() {}; + var self = $Kernel = $module($base, 'Kernel', $Kernel); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Kernel_taint_26, TMP_Kernel_untaint_27, TMP_Kernel_tainted$q_28; + + + var ERROR = "Object tainting is not supported by Opal"; + + Opal.def(self, '$taint', TMP_Kernel_taint_26 = function $$taint() { + var self = this; + + + handle_unsupported_feature(ERROR); + return self; + }, TMP_Kernel_taint_26.$$arity = 0); + + Opal.def(self, '$untaint', TMP_Kernel_untaint_27 = function $$untaint() { + var self = this; + + + handle_unsupported_feature(ERROR); + return self; + }, TMP_Kernel_untaint_27.$$arity = 0); + + Opal.def(self, '$tainted?', TMP_Kernel_tainted$q_28 = function() { + var self = this; + + + handle_unsupported_feature(ERROR); + return false; + }, TMP_Kernel_tainted$q_28.$$arity = 0); + })($nesting[0], $nesting); + (function($base, $super, $parent_nesting) { + function $Module(){}; + var self = $Module = $klass($base, $super, 'Module', $Module); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Module_public_29, TMP_Module_private_class_method_30, TMP_Module_private_method_defined$q_31, TMP_Module_private_constant_32; + + + + Opal.def(self, '$public', TMP_Module_public_29 = function($a) { + var $post_args, methods, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + methods = $post_args;; + + if (methods.length === 0) { + self.$$module_function = false; + } + + return nil; + ; + }, TMP_Module_public_29.$$arity = -1); + Opal.alias(self, "private", "public"); + Opal.alias(self, "protected", "public"); + Opal.alias(self, "nesting", "public"); + + Opal.def(self, '$private_class_method', TMP_Module_private_class_method_30 = function $$private_class_method($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return self; + }, TMP_Module_private_class_method_30.$$arity = -1); + Opal.alias(self, "public_class_method", "private_class_method"); + + Opal.def(self, '$private_method_defined?', TMP_Module_private_method_defined$q_31 = function(obj) { + var self = this; + + return false + }, TMP_Module_private_method_defined$q_31.$$arity = 1); + + Opal.def(self, '$private_constant', TMP_Module_private_constant_32 = function $$private_constant($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return nil; + }, TMP_Module_private_constant_32.$$arity = -1); + Opal.alias(self, "protected_method_defined?", "private_method_defined?"); + Opal.alias(self, "public_instance_methods", "instance_methods"); + Opal.alias(self, "public_instance_method", "instance_method"); + return Opal.alias(self, "public_method_defined?", "method_defined?"); + })($nesting[0], null, $nesting); + (function($base, $parent_nesting) { + function $Kernel() {}; + var self = $Kernel = $module($base, 'Kernel', $Kernel); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Kernel_private_methods_33; + + + + Opal.def(self, '$private_methods', TMP_Kernel_private_methods_33 = function $$private_methods($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return []; + }, TMP_Kernel_private_methods_33.$$arity = -1); + Opal.alias(self, "private_instance_methods", "private_methods"); + })($nesting[0], $nesting); + (function($base, $parent_nesting) { + function $Kernel() {}; + var self = $Kernel = $module($base, 'Kernel', $Kernel); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Kernel_eval_34; + + + Opal.def(self, '$eval', TMP_Kernel_eval_34 = function($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return self.$raise($$($nesting, 'NotImplementedError'), "" + "To use Kernel#eval, you must first require 'opal-parser'. " + ("" + "See https://github.com/opal/opal/blob/" + ($$($nesting, 'RUBY_ENGINE_VERSION')) + "/docs/opal_parser.md for details.")); + }, TMP_Kernel_eval_34.$$arity = -1) + })($nesting[0], $nesting); + Opal.defs(self, '$public', TMP_public_35 = function($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return nil; + }, TMP_public_35.$$arity = -1); + return (Opal.defs(self, '$private', TMP_private_36 = function($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return nil; + }, TMP_private_36.$$arity = -1), nil) && 'private'; +}; + +/* Generated by Opal 0.11.99.dev */ +(function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice; + + Opal.add_stubs(['$require']); + + self.$require("opal/base"); + self.$require("opal/mini"); + self.$require("corelib/string/encoding"); + self.$require("corelib/math"); + self.$require("corelib/complex"); + self.$require("corelib/rational"); + self.$require("corelib/time"); + self.$require("corelib/struct"); + self.$require("corelib/io"); + self.$require("corelib/main"); + self.$require("corelib/dir"); + self.$require("corelib/file"); + self.$require("corelib/process"); + self.$require("corelib/random"); + self.$require("corelib/random/mersenne_twister.js"); + return self.$require("corelib/unsupported"); +})(Opal); + + + // restore Function methods (see https://github.com/opal/opal/issues/1846) + for (var index in fundamentalObjects) { + var fundamentalObject = fundamentalObjects[index]; + var name = fundamentalObject.name; + if (typeof fundamentalObject.call !== 'function') { + fundamentalObject.call = backup[name].call; + } + if (typeof fundamentalObject.apply !== 'function') { + fundamentalObject.apply = backup[name].apply; + } + if (typeof fundamentalObject.bind !== 'function') { + fundamentalObject.bind = backup[name].bind; + } + } +} + +// UMD Module +(function (root, factory) { + if (typeof module === 'object' && module.exports) { + // Node. Does not work with strict CommonJS, but + // only CommonJS-like environments that support module.exports, + // like Node. + module.exports = factory; + } else if (typeof define === 'function' && define.amd) { + // AMD. Register a named module. + define('asciidoctor', ['module'], function (module) { + return factory(module.config()); + }); + } else { + // Browser globals (root is window) + root.Asciidoctor = factory; + } +// eslint-disable-next-line no-unused-vars +}(this, function (moduleConfig) { +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/js/opal_ext/nashorn/dir"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass; + + return (function($base, $super, $parent_nesting) { + function $Dir(){}; + var self = $Dir = $klass($base, $super, 'Dir', $Dir); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return (function(self, $parent_nesting) { + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_pwd_1; + + + + Opal.def(self, '$pwd', TMP_pwd_1 = function $$pwd() { + var self = this; + + return Java.type("java.nio.file.Paths").get("").toAbsolutePath().toString(); + }, TMP_pwd_1.$$arity = 0); + return Opal.alias(self, "getwd", "pwd"); + })(Opal.get_singleton_class(self), $nesting) + })($nesting[0], null, $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/js/opal_ext/nashorn/file"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass; + + return (function($base, $super, $parent_nesting) { + function $File(){}; + var self = $File = $klass($base, $super, 'File', $File); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_File_read_1; + + return (Opal.defs(self, '$read', TMP_File_read_1 = function $$read(path) { + var self = this; + + + var Paths = Java.type('java.nio.file.Paths'); + var Files = Java.type('java.nio.file.Files'); + var lines = Files.readAllLines(Paths.get(path), Java.type('java.nio.charset.StandardCharsets').UTF_8); + var data = []; + lines.forEach(function(line) { data.push(line); }); + return data.join("\n"); + + }, TMP_File_read_1.$$arity = 1), nil) && 'read' + })($nesting[0], null, $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/js/opal_ext/nashorn/io"] = function(Opal) { + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $send = Opal.send, $gvars = Opal.gvars, $writer = nil; + if ($gvars.stdout == null) $gvars.stdout = nil; + if ($gvars.stderr == null) $gvars.stderr = nil; + + Opal.add_stubs(['$write_proc=', '$-']); + + + $writer = [function(s){print(s)}]; + $send($gvars.stdout, 'write_proc=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = [function(s){print(s)}]; + $send($gvars.stderr, 'write_proc=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];; +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/js/opal_ext/electron/io"] = function(Opal) { + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $send = Opal.send, $gvars = Opal.gvars, $writer = nil; + if ($gvars.stdout == null) $gvars.stdout = nil; + if ($gvars.stderr == null) $gvars.stderr = nil; + + Opal.add_stubs(['$write_proc=', '$-']); + + + $writer = [function(s){console.log(s)}]; + $send($gvars.stdout, 'write_proc=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = [function(s){console.error(s)}]; + $send($gvars.stderr, 'write_proc=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];; +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/js/opal_ext/phantomjs/file"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass; + + return (function($base, $super, $parent_nesting) { + function $File(){}; + var self = $File = $klass($base, $super, 'File', $File); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_File_read_1; + + return (Opal.defs(self, '$read', TMP_File_read_1 = function $$read(path) { + var self = this; + + return require('fs').read(path); + }, TMP_File_read_1.$$arity = 1), nil) && 'read' + })($nesting[0], null, $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/js/opal_ext/spidermonkey/file"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass; + + return (function($base, $super, $parent_nesting) { + function $File(){}; + var self = $File = $klass($base, $super, 'File', $File); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_File_read_1; + + return (Opal.defs(self, '$read', TMP_File_read_1 = function $$read(path) { + var self = this; + + return read(path); + }, TMP_File_read_1.$$arity = 1), nil) && 'read' + })($nesting[0], null, $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/js/opal_ext/browser/file"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass; + + Opal.add_stubs(['$new']); + return (function($base, $super, $parent_nesting) { + function $File(){}; + var self = $File = $klass($base, $super, 'File', $File); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_File_read_1; + + return (Opal.defs(self, '$read', TMP_File_read_1 = function $$read(path) { + var self = this; + + + var data = ''; + var status = -1; + try { + var xhr = new XMLHttpRequest(); + xhr.open('GET', path, false); + xhr.addEventListener('load', function() { + status = this.status; + // status is 0 for local file mode (i.e., file://) + if (status === 0 || status === 200) { + data = this.responseText; + } + }); + xhr.overrideMimeType('text/plain'); + xhr.send(); + } + catch (e) { + throw $$($nesting, 'IOError').$new('Error reading file or directory: ' + path + '; reason: ' + e.message); + } + // assume that no data in local file mode means it doesn't exist + if (status === 404 || (status === 0 && !data)) { + throw $$($nesting, 'IOError').$new('No such file or directory: ' + path); + } + return data; + + }, TMP_File_read_1.$$arity = 1), nil) && 'read' + })($nesting[0], null, $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/js/opal_ext/umd"] = function(Opal) { + var $a, self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $truthy = Opal.truthy; + + Opal.add_stubs(['$==', '$require']); + + + var isNode = typeof process === 'object' && typeof process.versions === 'object' && process.browser != true, + isElectron = typeof navigator === 'object' && typeof navigator.userAgent === 'string' && typeof navigator.userAgent.indexOf('Electron') !== -1, + isBrowser = typeof window === 'object', + isNashorn = typeof Java === 'object' && Java.type, + isRhino = typeof java === 'object', + isPhantomJS = typeof window === 'object' && typeof window.phantom === 'object', + isWebWorker = typeof importScripts === 'function', + isSpiderMonkey = typeof JSRuntime === 'object', + platform, + engine, + framework, + ioModule; + + if (typeof moduleConfig === 'object' && typeof moduleConfig.runtime === 'object') { + var runtime = moduleConfig.runtime; + platform = runtime.platform; + engine = runtime.engine; + framework = runtime.framework; + ioModule = runtime.ioModule; + } + + if (typeof platform === 'undefined') { + // Try to automatically detect the JavaScript platform, engine and framework + if (isNode) { + platform = platform || 'node'; + engine = engine || 'v8'; + if (isElectron) { + framework = framework || 'electron'; + } + } + else if (isNashorn) { + platform = platform || 'java'; + engine = engine || 'nashorn'; + } + else if (isRhino) { + platform = platform || 'java'; + engine = engine || 'rhino'; + } + else if (isSpiderMonkey) { + platform = platform || 'standalone'; + framework = framework || 'spidermonkey'; + } + else if (isBrowser) { + platform = platform || 'browser'; + if (isPhantomJS) { + framework = framework || 'phantomjs'; + } + } + // NOTE: WebWorker are not limited to browser + if (isWebWorker) { + framework = framework || 'webworker'; + } + } + + if (typeof platform === 'undefined') { + throw new Error('Unable to automatically detect the JavaScript platform, please configure Asciidoctor.js: `Asciidoctor({runtime: {platform: \'node\'}})`'); + } + + // Optional information + if (typeof framework === 'undefined') { + framework = ''; + } + if (typeof engine === 'undefined') { + engine = ''; + } + + // IO Module + if (typeof ioModule !== 'undefined') { + if (ioModule !== 'spidermonkey' + && ioModule !== 'phantomjs' + && ioModule !== 'node' + && ioModule !== 'java_nio' + && ioModule !== 'xmlhttprequest') { + throw new Error('Invalid IO module, `config.ioModule` must be one of: spidermonkey, phantomjs, node, java_nio or xmlhttprequest'); + } + } else { + if (framework === 'spidermonkey') { + ioModule = 'spidermonkey'; + } else if (framework === 'phantomjs') { + ioModule = 'phantomjs'; + } else if (platform === 'node') { + ioModule = 'node'; + } else if (engine === 'nashorn') { + ioModule = 'java_nio' + } else if (platform === 'browser' || typeof XmlHTTPRequest !== 'undefined') { + ioModule = 'xmlhttprequest' + } else { + throw new Error('Unable to automatically detect the IO module, please configure Asciidoctor.js: `Asciidoctor({runtime: {ioModule: \'node\'}})`'); + } + } +; + Opal.const_set($nesting[0], 'JAVASCRIPT_IO_MODULE', ioModule); + Opal.const_set($nesting[0], 'JAVASCRIPT_PLATFORM', platform); + Opal.const_set($nesting[0], 'JAVASCRIPT_ENGINE', engine); + Opal.const_set($nesting[0], 'JAVASCRIPT_FRAMEWORK', framework); + if ($truthy(($truthy($a = $$($nesting, 'JAVASCRIPT_ENGINE')['$==']("nashorn")) ? $a : $$($nesting, 'JAVASCRIPT_IO_MODULE')['$==']("java_nio")))) { + + self.$require("asciidoctor/js/opal_ext/nashorn/dir"); + self.$require("asciidoctor/js/opal_ext/nashorn/file"); + self.$require("asciidoctor/js/opal_ext/nashorn/io");}; + if ($$($nesting, 'JAVASCRIPT_FRAMEWORK')['$==']("electron")) { + self.$require("asciidoctor/js/opal_ext/electron/io")}; + if ($$($nesting, 'JAVASCRIPT_PLATFORM')['$==']("node")) { + Opal.load("nodejs")}; + if ($$($nesting, 'JAVASCRIPT_IO_MODULE')['$==']("phantomjs")) { + self.$require("asciidoctor/js/opal_ext/phantomjs/file")}; + if ($$($nesting, 'JAVASCRIPT_IO_MODULE')['$==']("spidermonkey")) { + self.$require("asciidoctor/js/opal_ext/spidermonkey/file")}; + if ($$($nesting, 'JAVASCRIPT_IO_MODULE')['$==']("xmlhttprequest")) { + return self.$require("asciidoctor/js/opal_ext/browser/file") + } else { + return nil + }; +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["set"] = function(Opal) { + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + function $rb_lt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); + } + function $rb_le(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs <= rhs : lhs['$<='](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $hash2 = Opal.hash2, $truthy = Opal.truthy, $send = Opal.send, $module = Opal.module; + + Opal.add_stubs(['$include', '$new', '$nil?', '$===', '$raise', '$each', '$add', '$merge', '$class', '$respond_to?', '$subtract', '$dup', '$join', '$to_a', '$equal?', '$instance_of?', '$==', '$instance_variable_get', '$is_a?', '$size', '$all?', '$include?', '$[]=', '$-', '$enum_for', '$[]', '$<<', '$replace', '$delete', '$select', '$each_key', '$to_proc', '$empty?', '$eql?', '$instance_eval', '$clear', '$<', '$<=', '$keys']); + + (function($base, $super, $parent_nesting) { + function $Set(){}; + var self = $Set = $klass($base, $super, 'Set', $Set); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Set_$$_1, TMP_Set_initialize_2, TMP_Set_dup_4, TMP_Set_$_5, TMP_Set_inspect_6, TMP_Set_$eq$eq_7, TMP_Set_add_9, TMP_Set_classify_10, TMP_Set_collect$B_13, TMP_Set_delete_15, TMP_Set_delete$q_16, TMP_Set_delete_if_17, TMP_Set_add$q_20, TMP_Set_each_21, TMP_Set_empty$q_22, TMP_Set_eql$q_23, TMP_Set_clear_25, TMP_Set_include$q_26, TMP_Set_merge_27, TMP_Set_replace_29, TMP_Set_size_30, TMP_Set_subtract_31, TMP_Set_$_33, TMP_Set_superset$q_34, TMP_Set_proper_superset$q_36, TMP_Set_subset$q_38, TMP_Set_proper_subset$q_40, TMP_Set_to_a_42; + + def.hash = nil; + + self.$include($$($nesting, 'Enumerable')); + Opal.defs(self, '$[]', TMP_Set_$$_1 = function($a) { + var $post_args, ary, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + ary = $post_args;; + return self.$new(ary); + }, TMP_Set_$$_1.$$arity = -1); + + Opal.def(self, '$initialize', TMP_Set_initialize_2 = function $$initialize(enum$) { + var $iter = TMP_Set_initialize_2.$$p, block = $iter || nil, TMP_3, self = this; + + if ($iter) TMP_Set_initialize_2.$$p = null; + + + if ($iter) TMP_Set_initialize_2.$$p = null;; + + if (enum$ == null) { + enum$ = nil; + }; + self.hash = $hash2([], {}); + if ($truthy(enum$['$nil?']())) { + return nil}; + if ($truthy($$($nesting, 'Enumerable')['$==='](enum$))) { + } else { + self.$raise($$($nesting, 'ArgumentError'), "value must be enumerable") + }; + if ($truthy(block)) { + return $send(enum$, 'each', [], (TMP_3 = function(item){var self = TMP_3.$$s || this; + + + + if (item == null) { + item = nil; + }; + return self.$add(Opal.yield1(block, item));}, TMP_3.$$s = self, TMP_3.$$arity = 1, TMP_3)) + } else { + return self.$merge(enum$) + }; + }, TMP_Set_initialize_2.$$arity = -1); + + Opal.def(self, '$dup', TMP_Set_dup_4 = function $$dup() { + var self = this, result = nil; + + + result = self.$class().$new(); + return result.$merge(self); + }, TMP_Set_dup_4.$$arity = 0); + + Opal.def(self, '$-', TMP_Set_$_5 = function(enum$) { + var self = this; + + + if ($truthy(enum$['$respond_to?']("each"))) { + } else { + self.$raise($$($nesting, 'ArgumentError'), "value must be enumerable") + }; + return self.$dup().$subtract(enum$); + }, TMP_Set_$_5.$$arity = 1); + Opal.alias(self, "difference", "-"); + + Opal.def(self, '$inspect', TMP_Set_inspect_6 = function $$inspect() { + var self = this; + + return "" + "#" + }, TMP_Set_inspect_6.$$arity = 0); + + Opal.def(self, '$==', TMP_Set_$eq$eq_7 = function(other) { + var $a, TMP_8, self = this; + + if ($truthy(self['$equal?'](other))) { + return true + } else if ($truthy(other['$instance_of?'](self.$class()))) { + return self.hash['$=='](other.$instance_variable_get("@hash")) + } else if ($truthy(($truthy($a = other['$is_a?']($$($nesting, 'Set'))) ? self.$size()['$=='](other.$size()) : $a))) { + return $send(other, 'all?', [], (TMP_8 = function(o){var self = TMP_8.$$s || this; + if (self.hash == null) self.hash = nil; + + + + if (o == null) { + o = nil; + }; + return self.hash['$include?'](o);}, TMP_8.$$s = self, TMP_8.$$arity = 1, TMP_8)) + } else { + return false + } + }, TMP_Set_$eq$eq_7.$$arity = 1); + + Opal.def(self, '$add', TMP_Set_add_9 = function $$add(o) { + var self = this, $writer = nil; + + + + $writer = [o, true]; + $send(self.hash, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + return self; + }, TMP_Set_add_9.$$arity = 1); + Opal.alias(self, "<<", "add"); + + Opal.def(self, '$classify', TMP_Set_classify_10 = function $$classify() { + var $iter = TMP_Set_classify_10.$$p, block = $iter || nil, TMP_11, TMP_12, self = this, result = nil; + + if ($iter) TMP_Set_classify_10.$$p = null; + + + if ($iter) TMP_Set_classify_10.$$p = null;; + if ((block !== nil)) { + } else { + return self.$enum_for("classify") + }; + result = $send($$($nesting, 'Hash'), 'new', [], (TMP_11 = function(h, k){var self = TMP_11.$$s || this, $writer = nil; + + + + if (h == null) { + h = nil; + }; + + if (k == null) { + k = nil; + }; + $writer = [k, self.$class().$new()]; + $send(h, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];}, TMP_11.$$s = self, TMP_11.$$arity = 2, TMP_11)); + $send(self, 'each', [], (TMP_12 = function(item){var self = TMP_12.$$s || this; + + + + if (item == null) { + item = nil; + }; + return result['$[]'](Opal.yield1(block, item)).$add(item);}, TMP_12.$$s = self, TMP_12.$$arity = 1, TMP_12)); + return result; + }, TMP_Set_classify_10.$$arity = 0); + + Opal.def(self, '$collect!', TMP_Set_collect$B_13 = function() { + var $iter = TMP_Set_collect$B_13.$$p, block = $iter || nil, TMP_14, self = this, result = nil; + + if ($iter) TMP_Set_collect$B_13.$$p = null; + + + if ($iter) TMP_Set_collect$B_13.$$p = null;; + if ((block !== nil)) { + } else { + return self.$enum_for("collect!") + }; + result = self.$class().$new(); + $send(self, 'each', [], (TMP_14 = function(item){var self = TMP_14.$$s || this; + + + + if (item == null) { + item = nil; + }; + return result['$<<'](Opal.yield1(block, item));}, TMP_14.$$s = self, TMP_14.$$arity = 1, TMP_14)); + return self.$replace(result); + }, TMP_Set_collect$B_13.$$arity = 0); + Opal.alias(self, "map!", "collect!"); + + Opal.def(self, '$delete', TMP_Set_delete_15 = function(o) { + var self = this; + + + self.hash.$delete(o); + return self; + }, TMP_Set_delete_15.$$arity = 1); + + Opal.def(self, '$delete?', TMP_Set_delete$q_16 = function(o) { + var self = this; + + if ($truthy(self['$include?'](o))) { + + self.$delete(o); + return self; + } else { + return nil + } + }, TMP_Set_delete$q_16.$$arity = 1); + + Opal.def(self, '$delete_if', TMP_Set_delete_if_17 = function $$delete_if() { + var TMP_18, TMP_19, $iter = TMP_Set_delete_if_17.$$p, $yield = $iter || nil, self = this; + + if ($iter) TMP_Set_delete_if_17.$$p = null; + + if (($yield !== nil)) { + } else { + return self.$enum_for("delete_if") + }; + $send($send(self, 'select', [], (TMP_18 = function(o){var self = TMP_18.$$s || this; + + + + if (o == null) { + o = nil; + }; + return Opal.yield1($yield, o);;}, TMP_18.$$s = self, TMP_18.$$arity = 1, TMP_18)), 'each', [], (TMP_19 = function(o){var self = TMP_19.$$s || this; + if (self.hash == null) self.hash = nil; + + + + if (o == null) { + o = nil; + }; + return self.hash.$delete(o);}, TMP_19.$$s = self, TMP_19.$$arity = 1, TMP_19)); + return self; + }, TMP_Set_delete_if_17.$$arity = 0); + + Opal.def(self, '$add?', TMP_Set_add$q_20 = function(o) { + var self = this; + + if ($truthy(self['$include?'](o))) { + return nil + } else { + return self.$add(o) + } + }, TMP_Set_add$q_20.$$arity = 1); + + Opal.def(self, '$each', TMP_Set_each_21 = function $$each() { + var $iter = TMP_Set_each_21.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Set_each_21.$$p = null; + + + if ($iter) TMP_Set_each_21.$$p = null;; + if ((block !== nil)) { + } else { + return self.$enum_for("each") + }; + $send(self.hash, 'each_key', [], block.$to_proc()); + return self; + }, TMP_Set_each_21.$$arity = 0); + + Opal.def(self, '$empty?', TMP_Set_empty$q_22 = function() { + var self = this; + + return self.hash['$empty?']() + }, TMP_Set_empty$q_22.$$arity = 0); + + Opal.def(self, '$eql?', TMP_Set_eql$q_23 = function(other) { + var TMP_24, self = this; + + return self.hash['$eql?']($send(other, 'instance_eval', [], (TMP_24 = function(){var self = TMP_24.$$s || this; + if (self.hash == null) self.hash = nil; + + return self.hash}, TMP_24.$$s = self, TMP_24.$$arity = 0, TMP_24))) + }, TMP_Set_eql$q_23.$$arity = 1); + + Opal.def(self, '$clear', TMP_Set_clear_25 = function $$clear() { + var self = this; + + + self.hash.$clear(); + return self; + }, TMP_Set_clear_25.$$arity = 0); + + Opal.def(self, '$include?', TMP_Set_include$q_26 = function(o) { + var self = this; + + return self.hash['$include?'](o) + }, TMP_Set_include$q_26.$$arity = 1); + Opal.alias(self, "member?", "include?"); + + Opal.def(self, '$merge', TMP_Set_merge_27 = function $$merge(enum$) { + var TMP_28, self = this; + + + $send(enum$, 'each', [], (TMP_28 = function(item){var self = TMP_28.$$s || this; + + + + if (item == null) { + item = nil; + }; + return self.$add(item);}, TMP_28.$$s = self, TMP_28.$$arity = 1, TMP_28)); + return self; + }, TMP_Set_merge_27.$$arity = 1); + + Opal.def(self, '$replace', TMP_Set_replace_29 = function $$replace(enum$) { + var self = this; + + + self.$clear(); + self.$merge(enum$); + return self; + }, TMP_Set_replace_29.$$arity = 1); + + Opal.def(self, '$size', TMP_Set_size_30 = function $$size() { + var self = this; + + return self.hash.$size() + }, TMP_Set_size_30.$$arity = 0); + Opal.alias(self, "length", "size"); + + Opal.def(self, '$subtract', TMP_Set_subtract_31 = function $$subtract(enum$) { + var TMP_32, self = this; + + + $send(enum$, 'each', [], (TMP_32 = function(item){var self = TMP_32.$$s || this; + + + + if (item == null) { + item = nil; + }; + return self.$delete(item);}, TMP_32.$$s = self, TMP_32.$$arity = 1, TMP_32)); + return self; + }, TMP_Set_subtract_31.$$arity = 1); + + Opal.def(self, '$|', TMP_Set_$_33 = function(enum$) { + var self = this; + + + if ($truthy(enum$['$respond_to?']("each"))) { + } else { + self.$raise($$($nesting, 'ArgumentError'), "value must be enumerable") + }; + return self.$dup().$merge(enum$); + }, TMP_Set_$_33.$$arity = 1); + + Opal.def(self, '$superset?', TMP_Set_superset$q_34 = function(set) { + var $a, TMP_35, self = this; + + + ($truthy($a = set['$is_a?']($$($nesting, 'Set'))) ? $a : self.$raise($$($nesting, 'ArgumentError'), "value must be a set")); + if ($truthy($rb_lt(self.$size(), set.$size()))) { + return false}; + return $send(set, 'all?', [], (TMP_35 = function(o){var self = TMP_35.$$s || this; + + + + if (o == null) { + o = nil; + }; + return self['$include?'](o);}, TMP_35.$$s = self, TMP_35.$$arity = 1, TMP_35)); + }, TMP_Set_superset$q_34.$$arity = 1); + Opal.alias(self, ">=", "superset?"); + + Opal.def(self, '$proper_superset?', TMP_Set_proper_superset$q_36 = function(set) { + var $a, TMP_37, self = this; + + + ($truthy($a = set['$is_a?']($$($nesting, 'Set'))) ? $a : self.$raise($$($nesting, 'ArgumentError'), "value must be a set")); + if ($truthy($rb_le(self.$size(), set.$size()))) { + return false}; + return $send(set, 'all?', [], (TMP_37 = function(o){var self = TMP_37.$$s || this; + + + + if (o == null) { + o = nil; + }; + return self['$include?'](o);}, TMP_37.$$s = self, TMP_37.$$arity = 1, TMP_37)); + }, TMP_Set_proper_superset$q_36.$$arity = 1); + Opal.alias(self, ">", "proper_superset?"); + + Opal.def(self, '$subset?', TMP_Set_subset$q_38 = function(set) { + var $a, TMP_39, self = this; + + + ($truthy($a = set['$is_a?']($$($nesting, 'Set'))) ? $a : self.$raise($$($nesting, 'ArgumentError'), "value must be a set")); + if ($truthy($rb_lt(set.$size(), self.$size()))) { + return false}; + return $send(self, 'all?', [], (TMP_39 = function(o){var self = TMP_39.$$s || this; + + + + if (o == null) { + o = nil; + }; + return set['$include?'](o);}, TMP_39.$$s = self, TMP_39.$$arity = 1, TMP_39)); + }, TMP_Set_subset$q_38.$$arity = 1); + Opal.alias(self, "<=", "subset?"); + + Opal.def(self, '$proper_subset?', TMP_Set_proper_subset$q_40 = function(set) { + var $a, TMP_41, self = this; + + + ($truthy($a = set['$is_a?']($$($nesting, 'Set'))) ? $a : self.$raise($$($nesting, 'ArgumentError'), "value must be a set")); + if ($truthy($rb_le(set.$size(), self.$size()))) { + return false}; + return $send(self, 'all?', [], (TMP_41 = function(o){var self = TMP_41.$$s || this; + + + + if (o == null) { + o = nil; + }; + return set['$include?'](o);}, TMP_41.$$s = self, TMP_41.$$arity = 1, TMP_41)); + }, TMP_Set_proper_subset$q_40.$$arity = 1); + Opal.alias(self, "<", "proper_subset?"); + Opal.alias(self, "+", "|"); + Opal.alias(self, "union", "|"); + return (Opal.def(self, '$to_a', TMP_Set_to_a_42 = function $$to_a() { + var self = this; + + return self.hash.$keys() + }, TMP_Set_to_a_42.$$arity = 0), nil) && 'to_a'; + })($nesting[0], null, $nesting); + return (function($base, $parent_nesting) { + function $Enumerable() {}; + var self = $Enumerable = $module($base, 'Enumerable', $Enumerable); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Enumerable_to_set_43; + + + Opal.def(self, '$to_set', TMP_Enumerable_to_set_43 = function $$to_set($a, $b) { + var $iter = TMP_Enumerable_to_set_43.$$p, block = $iter || nil, $post_args, klass, args, self = this; + + if ($iter) TMP_Enumerable_to_set_43.$$p = null; + + + if ($iter) TMP_Enumerable_to_set_43.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + if ($post_args.length > 0) { + klass = $post_args[0]; + $post_args.splice(0, 1); + } + if (klass == null) { + klass = $$($nesting, 'Set'); + }; + + args = $post_args;; + return $send(klass, 'new', [self].concat(Opal.to_a(args)), block.$to_proc()); + }, TMP_Enumerable_to_set_43.$$arity = -1) + })($nesting[0], $nesting); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/js/opal_ext/file"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $send = Opal.send, $klass = Opal.klass, $truthy = Opal.truthy, $gvars = Opal.gvars; + + Opal.add_stubs(['$new', '$attr_reader', '$delete', '$gsub', '$read', '$size', '$to_enum', '$chomp', '$each_line', '$readlines', '$split']); + + (function($base, $parent_nesting) { + function $Kernel() {}; + var self = $Kernel = $module($base, 'Kernel', $Kernel); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Kernel_open_1; + + + Opal.def(self, '$open', TMP_Kernel_open_1 = function $$open(path, $a) { + var $post_args, rest, $iter = TMP_Kernel_open_1.$$p, $yield = $iter || nil, self = this, file = nil; + + if ($iter) TMP_Kernel_open_1.$$p = null; + + + $post_args = Opal.slice.call(arguments, 1, arguments.length); + + rest = $post_args;; + file = $send($$($nesting, 'File'), 'new', [path].concat(Opal.to_a(rest))); + if (($yield !== nil)) { + return Opal.yield1($yield, file); + } else { + return file + }; + }, TMP_Kernel_open_1.$$arity = -2) + })($nesting[0], $nesting); + (function($base, $super, $parent_nesting) { + function $File(){}; + var self = $File = $klass($base, $super, 'File', $File); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_File_initialize_2, TMP_File_read_3, TMP_File_each_line_4, TMP_File_readlines_5; + + def.eof = def.path = nil; + + self.$attr_reader("eof"); + self.$attr_reader("lineno"); + self.$attr_reader("path"); + + Opal.def(self, '$initialize', TMP_File_initialize_2 = function $$initialize(path, flags) { + var self = this, encoding_flag_regexp = nil; + + + + if (flags == null) { + flags = "r"; + }; + self.path = path; + self.contents = nil; + self.eof = false; + self.lineno = 0; + flags = flags.$delete("b"); + encoding_flag_regexp = /:(.*)/; + flags = flags.$gsub(encoding_flag_regexp, ""); + return (self.flags = flags); + }, TMP_File_initialize_2.$$arity = -2); + + Opal.def(self, '$read', TMP_File_read_3 = function $$read() { + var self = this, res = nil; + + if ($truthy(self.eof)) { + return "" + } else { + + res = $$($nesting, 'File').$read(self.path); + self.eof = true; + self.lineno = res.$size(); + return res; + } + }, TMP_File_read_3.$$arity = 0); + + Opal.def(self, '$each_line', TMP_File_each_line_4 = function $$each_line(separator) { + var $iter = TMP_File_each_line_4.$$p, block = $iter || nil, self = this, lines = nil; + if ($gvars["/"] == null) $gvars["/"] = nil; + + if ($iter) TMP_File_each_line_4.$$p = null; + + + if ($iter) TMP_File_each_line_4.$$p = null;; + + if (separator == null) { + separator = $gvars["/"]; + }; + if ($truthy(self.eof)) { + return (function() {if ((block !== nil)) { + return self + } else { + return [].$to_enum() + }; return nil; })()}; + if ((block !== nil)) { + + lines = $$($nesting, 'File').$read(self.path); + + self.eof = false; + self.lineno = 0; + var chomped = lines.$chomp(), + trailing = lines.length != chomped.length, + splitted = chomped.split(separator); + for (var i = 0, length = splitted.length; i < length; i++) { + self.lineno += 1; + if (i < length - 1 || trailing) { + Opal.yield1(block, splitted[i] + separator); + } + else { + Opal.yield1(block, splitted[i]); + } + } + self.eof = true; + ; + return self; + } else { + return self.$read().$each_line() + }; + }, TMP_File_each_line_4.$$arity = -1); + + Opal.def(self, '$readlines', TMP_File_readlines_5 = function $$readlines() { + var self = this; + + return $$($nesting, 'File').$readlines(self.path) + }, TMP_File_readlines_5.$$arity = 0); + return (function(self, $parent_nesting) { + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_readlines_6, TMP_file$q_7, TMP_readable$q_8, TMP_read_9; + + + + Opal.def(self, '$readlines', TMP_readlines_6 = function $$readlines(path, separator) { + var self = this, content = nil; + if ($gvars["/"] == null) $gvars["/"] = nil; + + + + if (separator == null) { + separator = $gvars["/"]; + }; + content = $$($nesting, 'File').$read(path); + return content.$split(separator); + }, TMP_readlines_6.$$arity = -2); + + Opal.def(self, '$file?', TMP_file$q_7 = function(path) { + var self = this; + + return true + }, TMP_file$q_7.$$arity = 1); + + Opal.def(self, '$readable?', TMP_readable$q_8 = function(path) { + var self = this; + + return true + }, TMP_readable$q_8.$$arity = 1); + return (Opal.def(self, '$read', TMP_read_9 = function $$read(path) { + var self = this; + + return "" + }, TMP_read_9.$$arity = 1), nil) && 'read'; + })(Opal.get_singleton_class(self), $nesting); + })($nesting[0], null, $nesting); + return (function($base, $super, $parent_nesting) { + function $IO(){}; + var self = $IO = $klass($base, $super, 'IO', $IO); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_IO_read_10; + + return (Opal.defs(self, '$read', TMP_IO_read_10 = function $$read(path) { + var self = this; + + return $$($nesting, 'File').$read(path) + }, TMP_IO_read_10.$$arity = 1), nil) && 'read' + })($nesting[0], null, $nesting); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/js/opal_ext/match_data"] = function(Opal) { + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $send = Opal.send; + + Opal.add_stubs(['$[]=', '$-']); + return (function($base, $super, $parent_nesting) { + function $MatchData(){}; + var self = $MatchData = $klass($base, $super, 'MatchData', $MatchData); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_MatchData_$$$eq_1; + + def.matches = nil; + return (Opal.def(self, '$[]=', TMP_MatchData_$$$eq_1 = function(idx, val) { + var self = this, $writer = nil; + + + $writer = [idx, val]; + $send(self.matches, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + }, TMP_MatchData_$$$eq_1.$$arity = 2), nil) && '[]=' + })($nesting[0], null, $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/js/opal_ext/kernel"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module; + + return (function($base, $parent_nesting) { + function $Kernel() {}; + var self = $Kernel = $module($base, 'Kernel', $Kernel); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Kernel_freeze_1; + + + Opal.def(self, '$freeze', TMP_Kernel_freeze_1 = function $$freeze() { + var self = this; + + return self + }, TMP_Kernel_freeze_1.$$arity = 0) + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/js/opal_ext/thread_safe"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass; + + return (function($base, $parent_nesting) { + function $ThreadSafe() {}; + var self = $ThreadSafe = $module($base, 'ThreadSafe', $ThreadSafe); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + (function($base, $super, $parent_nesting) { + function $Cache(){}; + var self = $Cache = $klass($base, $super, 'Cache', $Cache); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return nil + })($nesting[0], $$$('::', 'Hash'), $nesting) + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/js/opal_ext/string"] = function(Opal) { + function $rb_lt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $truthy = Opal.truthy, $send = Opal.send; + + Opal.add_stubs(['$method_defined?', '$<', '$length', '$bytes', '$to_s', '$byteslice', '$==', '$with_index', '$select', '$[]', '$even?', '$_original_unpack']); + return (function($base, $super, $parent_nesting) { + function $String(){}; + var self = $String = $klass($base, $super, 'String', $String); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_String_limit_bytesize_1, TMP_String_unpack_2; + + + if ($truthy(self['$method_defined?']("limit_bytesize"))) { + } else { + + Opal.def(self, '$limit_bytesize', TMP_String_limit_bytesize_1 = function $$limit_bytesize(size) { + var self = this, result = nil; + + + if ($truthy($rb_lt(size, self.$bytes().$length()))) { + } else { + return self.$to_s() + }; + result = self.$byteslice(0, size); + return result.$to_s(); + }, TMP_String_limit_bytesize_1.$$arity = 1) + }; + if ($truthy(self['$method_defined?']("limit"))) { + } else { + Opal.alias(self, "limit", "limit_bytesize") + }; + Opal.alias(self, "_original_unpack", "unpack"); + return (Opal.def(self, '$unpack', TMP_String_unpack_2 = function $$unpack(format) { + var TMP_3, self = this; + + if (format['$==']("C3")) { + return $send(self['$[]'](0, 3).$bytes().$select(), 'with_index', [], (TMP_3 = function(_, i){var self = TMP_3.$$s || this; + + + + if (_ == null) { + _ = nil; + }; + + if (i == null) { + i = nil; + }; + return i['$even?']();}, TMP_3.$$s = self, TMP_3.$$arity = 2, TMP_3)) + } else { + return self.$_original_unpack(format) + } + }, TMP_String_unpack_2.$$arity = 1), nil) && 'unpack'; + })($nesting[0], null, $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/js/opal_ext/uri"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module; + + Opal.add_stubs(['$extend']); + return (function($base, $parent_nesting) { + function $URI() {}; + var self = $URI = $module($base, 'URI', $URI); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_URI_parse_1, TMP_URI_path_2; + + + Opal.defs(self, '$parse', TMP_URI_parse_1 = function $$parse(str) { + var self = this; + + return str.$extend($$($nesting, 'URI')) + }, TMP_URI_parse_1.$$arity = 1); + + Opal.def(self, '$path', TMP_URI_path_2 = function $$path() { + var self = this; + + return self + }, TMP_URI_path_2.$$arity = 0); + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/js/opal_ext"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice; + + Opal.add_stubs(['$require']); + + self.$require("asciidoctor/js/opal_ext/file"); + self.$require("asciidoctor/js/opal_ext/match_data"); + self.$require("asciidoctor/js/opal_ext/kernel"); + self.$require("asciidoctor/js/opal_ext/thread_safe"); + self.$require("asciidoctor/js/opal_ext/string"); + self.$require("asciidoctor/js/opal_ext/uri"); + +// Load specific implementation +self.$require("asciidoctor/js/opal_ext/umd"); +; +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/js/rx"] = function(Opal) { + function $rb_plus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $send = Opal.send, $gvars = Opal.gvars, $truthy = Opal.truthy; + + Opal.add_stubs(['$gsub', '$+', '$unpack_hex_range']); + return (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Asciidoctor_unpack_hex_range_1; + + + Opal.const_set($nesting[0], 'HEX_RANGE_RX', /([A-F0-9]{4})(?:-([A-F0-9]{4}))?/); + Opal.defs(self, '$unpack_hex_range', TMP_Asciidoctor_unpack_hex_range_1 = function $$unpack_hex_range(str) { + var TMP_2, self = this; + + return $send(str, 'gsub', [$$($nesting, 'HEX_RANGE_RX')], (TMP_2 = function(){var self = TMP_2.$$s || this, $a, $b; + + return "" + "\\u" + ((($a = $gvars['~']) === nil ? nil : $a['$[]'](1))) + (($truthy($a = (($b = $gvars['~']) === nil ? nil : $b['$[]'](2))) ? "" + "-\\u" + ((($b = $gvars['~']) === nil ? nil : $b['$[]'](2))) : $a))}, TMP_2.$$s = self, TMP_2.$$arity = 0, TMP_2)) + }, TMP_Asciidoctor_unpack_hex_range_1.$$arity = 1); + Opal.const_set($nesting[0], 'P_L', $rb_plus("A-Za-z", self.$unpack_hex_range("00AA00B500BA00C0-00D600D8-00F600F8-02C102C6-02D102E0-02E402EC02EE0370-037403760377037A-037D037F03860388-038A038C038E-03A103A3-03F503F7-0481048A-052F0531-055605590561-058705D0-05EA05F0-05F20620-064A066E066F0671-06D306D506E506E606EE06EF06FA-06FC06FF07100712-072F074D-07A507B107CA-07EA07F407F507FA0800-0815081A082408280840-085808A0-08B20904-0939093D09500958-09610971-09800985-098C098F09900993-09A809AA-09B009B209B6-09B909BD09CE09DC09DD09DF-09E109F009F10A05-0A0A0A0F0A100A13-0A280A2A-0A300A320A330A350A360A380A390A59-0A5C0A5E0A72-0A740A85-0A8D0A8F-0A910A93-0AA80AAA-0AB00AB20AB30AB5-0AB90ABD0AD00AE00AE10B05-0B0C0B0F0B100B13-0B280B2A-0B300B320B330B35-0B390B3D0B5C0B5D0B5F-0B610B710B830B85-0B8A0B8E-0B900B92-0B950B990B9A0B9C0B9E0B9F0BA30BA40BA8-0BAA0BAE-0BB90BD00C05-0C0C0C0E-0C100C12-0C280C2A-0C390C3D0C580C590C600C610C85-0C8C0C8E-0C900C92-0CA80CAA-0CB30CB5-0CB90CBD0CDE0CE00CE10CF10CF20D05-0D0C0D0E-0D100D12-0D3A0D3D0D4E0D600D610D7A-0D7F0D85-0D960D9A-0DB10DB3-0DBB0DBD0DC0-0DC60E01-0E300E320E330E40-0E460E810E820E840E870E880E8A0E8D0E94-0E970E99-0E9F0EA1-0EA30EA50EA70EAA0EAB0EAD-0EB00EB20EB30EBD0EC0-0EC40EC60EDC-0EDF0F000F40-0F470F49-0F6C0F88-0F8C1000-102A103F1050-1055105A-105D106110651066106E-10701075-1081108E10A0-10C510C710CD10D0-10FA10FC-1248124A-124D1250-12561258125A-125D1260-1288128A-128D1290-12B012B2-12B512B8-12BE12C012C2-12C512C8-12D612D8-13101312-13151318-135A1380-138F13A0-13F41401-166C166F-167F1681-169A16A0-16EA16F1-16F81700-170C170E-17111720-17311740-17511760-176C176E-17701780-17B317D717DC1820-18771880-18A818AA18B0-18F51900-191E1950-196D1970-19741980-19AB19C1-19C71A00-1A161A20-1A541AA71B05-1B331B45-1B4B1B83-1BA01BAE1BAF1BBA-1BE51C00-1C231C4D-1C4F1C5A-1C7D1CE9-1CEC1CEE-1CF11CF51CF61D00-1DBF1E00-1F151F18-1F1D1F20-1F451F48-1F4D1F50-1F571F591F5B1F5D1F5F-1F7D1F80-1FB41FB6-1FBC1FBE1FC2-1FC41FC6-1FCC1FD0-1FD31FD6-1FDB1FE0-1FEC1FF2-1FF41FF6-1FFC2071207F2090-209C21022107210A-211321152119-211D212421262128212A-212D212F-2139213C-213F2145-2149214E218321842C00-2C2E2C30-2C5E2C60-2CE42CEB-2CEE2CF22CF32D00-2D252D272D2D2D30-2D672D6F2D80-2D962DA0-2DA62DA8-2DAE2DB0-2DB62DB8-2DBE2DC0-2DC62DC8-2DCE2DD0-2DD62DD8-2DDE2E2F300530063031-3035303B303C3041-3096309D-309F30A1-30FA30FC-30FF3105-312D3131-318E31A0-31BA31F0-31FF3400-4DB54E00-9FCCA000-A48CA4D0-A4FDA500-A60CA610-A61FA62AA62BA640-A66EA67F-A69DA6A0-A6E5A717-A71FA722-A788A78B-A78EA790-A7ADA7B0A7B1A7F7-A801A803-A805A807-A80AA80C-A822A840-A873A882-A8B3A8F2-A8F7A8FBA90A-A925A930-A946A960-A97CA984-A9B2A9CFA9E0-A9E4A9E6-A9EFA9FA-A9FEAA00-AA28AA40-AA42AA44-AA4BAA60-AA76AA7AAA7E-AAAFAAB1AAB5AAB6AAB9-AABDAAC0AAC2AADB-AADDAAE0-AAEAAAF2-AAF4AB01-AB06AB09-AB0EAB11-AB16AB20-AB26AB28-AB2EAB30-AB5AAB5C-AB5FAB64AB65ABC0-ABE2AC00-D7A3D7B0-D7C6D7CB-D7FBF900-FA6DFA70-FAD9FB00-FB06FB13-FB17FB1DFB1F-FB28FB2A-FB36FB38-FB3CFB3EFB40FB41FB43FB44FB46-FBB1FBD3-FD3DFD50-FD8FFD92-FDC7FDF0-FDFBFE70-FE74FE76-FEFCFF21-FF3AFF41-FF5AFF66-FFBEFFC2-FFC7FFCA-FFCFFFD2-FFD7FFDA-FFDC"))); + Opal.const_set($nesting[0], 'P_Nl', self.$unpack_hex_range("16EE-16F02160-21822185-218830073021-30293038-303AA6E6-A6EF")); + Opal.const_set($nesting[0], 'P_Nd', $rb_plus("0-9", self.$unpack_hex_range("0660-066906F0-06F907C0-07C90966-096F09E6-09EF0A66-0A6F0AE6-0AEF0B66-0B6F0BE6-0BEF0C66-0C6F0CE6-0CEF0D66-0D6F0DE6-0DEF0E50-0E590ED0-0ED90F20-0F291040-10491090-109917E0-17E91810-18191946-194F19D0-19D91A80-1A891A90-1A991B50-1B591BB0-1BB91C40-1C491C50-1C59A620-A629A8D0-A8D9A900-A909A9D0-A9D9A9F0-A9F9AA50-AA59ABF0-ABF9FF10-FF19"))); + Opal.const_set($nesting[0], 'P_Pc', self.$unpack_hex_range("005F203F20402054FE33FE34FE4D-FE4FFF3F")); + Opal.const_set($nesting[0], 'CC_ALPHA', "" + ($$($nesting, 'P_L')) + ($$($nesting, 'P_Nl'))); + Opal.const_set($nesting[0], 'CG_ALPHA', "" + "[" + ($$($nesting, 'CC_ALPHA')) + "]"); + Opal.const_set($nesting[0], 'CC_ALNUM', "" + ($$($nesting, 'CC_ALPHA')) + ($$($nesting, 'P_Nd'))); + Opal.const_set($nesting[0], 'CG_ALNUM', "" + "[" + ($$($nesting, 'CC_ALNUM')) + "]"); + Opal.const_set($nesting[0], 'CC_WORD', "" + ($$($nesting, 'CC_ALNUM')) + ($$($nesting, 'P_Pc'))); + Opal.const_set($nesting[0], 'CG_WORD', "" + "[" + ($$($nesting, 'CC_WORD')) + "]"); + Opal.const_set($nesting[0], 'CG_BLANK', "[ \\t]"); + Opal.const_set($nesting[0], 'CC_EOL', "(?=\\n|$)"); + Opal.const_set($nesting[0], 'CG_GRAPH', "[^\\s\\x00-\\x1F\\x7F]"); + Opal.const_set($nesting[0], 'CC_ALL', "[\\s\\S]"); + Opal.const_set($nesting[0], 'CC_ANY', "[^\\n]"); + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["strscan"] = function(Opal) { + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $send = Opal.send; + + Opal.add_stubs(['$attr_reader', '$anchor', '$scan_until', '$length', '$size', '$rest', '$pos=', '$-', '$private']); + return (function($base, $super, $parent_nesting) { + function $StringScanner(){}; + var self = $StringScanner = $klass($base, $super, 'StringScanner', $StringScanner); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_StringScanner_initialize_1, TMP_StringScanner_beginning_of_line$q_2, TMP_StringScanner_scan_3, TMP_StringScanner_scan_until_4, TMP_StringScanner_$$_5, TMP_StringScanner_check_6, TMP_StringScanner_check_until_7, TMP_StringScanner_peek_8, TMP_StringScanner_eos$q_9, TMP_StringScanner_exist$q_10, TMP_StringScanner_skip_11, TMP_StringScanner_skip_until_12, TMP_StringScanner_get_byte_13, TMP_StringScanner_match$q_14, TMP_StringScanner_pos$eq_15, TMP_StringScanner_matched_size_16, TMP_StringScanner_post_match_17, TMP_StringScanner_pre_match_18, TMP_StringScanner_reset_19, TMP_StringScanner_rest_20, TMP_StringScanner_rest$q_21, TMP_StringScanner_rest_size_22, TMP_StringScanner_terminate_23, TMP_StringScanner_unscan_24, TMP_StringScanner_anchor_25; + + def.pos = def.string = def.working = def.matched = def.prev_pos = def.match = nil; + + self.$attr_reader("pos"); + self.$attr_reader("matched"); + + Opal.def(self, '$initialize', TMP_StringScanner_initialize_1 = function $$initialize(string) { + var self = this; + + + self.string = string; + self.pos = 0; + self.matched = nil; + self.working = string; + return (self.match = []); + }, TMP_StringScanner_initialize_1.$$arity = 1); + self.$attr_reader("string"); + + Opal.def(self, '$beginning_of_line?', TMP_StringScanner_beginning_of_line$q_2 = function() { + var self = this; + + return self.pos === 0 || self.string.charAt(self.pos - 1) === "\n" + }, TMP_StringScanner_beginning_of_line$q_2.$$arity = 0); + Opal.alias(self, "bol?", "beginning_of_line?"); + + Opal.def(self, '$scan', TMP_StringScanner_scan_3 = function $$scan(pattern) { + var self = this; + + + pattern = self.$anchor(pattern); + + var result = pattern.exec(self.working); + + if (result == null) { + return self.matched = nil; + } + else if (typeof(result) === 'object') { + self.prev_pos = self.pos; + self.pos += result[0].length; + self.working = self.working.substring(result[0].length); + self.matched = result[0]; + self.match = result; + + return result[0]; + } + else if (typeof(result) === 'string') { + self.pos += result.length; + self.working = self.working.substring(result.length); + + return result; + } + else { + return nil; + } + ; + }, TMP_StringScanner_scan_3.$$arity = 1); + + Opal.def(self, '$scan_until', TMP_StringScanner_scan_until_4 = function $$scan_until(pattern) { + var self = this; + + + pattern = self.$anchor(pattern); + + var pos = self.pos, + working = self.working, + result; + + while (true) { + result = pattern.exec(working); + pos += 1; + working = working.substr(1); + + if (result == null) { + if (working.length === 0) { + return self.matched = nil; + } + + continue; + } + + self.matched = self.string.substr(self.pos, pos - self.pos - 1 + result[0].length); + self.prev_pos = pos - 1; + self.pos = pos; + self.working = working.substr(result[0].length); + + return self.matched; + } + ; + }, TMP_StringScanner_scan_until_4.$$arity = 1); + + Opal.def(self, '$[]', TMP_StringScanner_$$_5 = function(idx) { + var self = this; + + + var match = self.match; + + if (idx < 0) { + idx += match.length; + } + + if (idx < 0 || idx >= match.length) { + return nil; + } + + if (match[idx] == null) { + return nil; + } + + return match[idx]; + + }, TMP_StringScanner_$$_5.$$arity = 1); + + Opal.def(self, '$check', TMP_StringScanner_check_6 = function $$check(pattern) { + var self = this; + + + pattern = self.$anchor(pattern); + + var result = pattern.exec(self.working); + + if (result == null) { + return self.matched = nil; + } + + return self.matched = result[0]; + ; + }, TMP_StringScanner_check_6.$$arity = 1); + + Opal.def(self, '$check_until', TMP_StringScanner_check_until_7 = function $$check_until(pattern) { + var self = this; + + + var prev_pos = self.prev_pos, + pos = self.pos; + + var result = self.$scan_until(pattern); + + if (result !== nil) { + self.matched = result.substr(-1); + self.working = self.string.substr(pos); + } + + self.prev_pos = prev_pos; + self.pos = pos; + + return result; + + }, TMP_StringScanner_check_until_7.$$arity = 1); + + Opal.def(self, '$peek', TMP_StringScanner_peek_8 = function $$peek(length) { + var self = this; + + return self.working.substring(0, length) + }, TMP_StringScanner_peek_8.$$arity = 1); + + Opal.def(self, '$eos?', TMP_StringScanner_eos$q_9 = function() { + var self = this; + + return self.working.length === 0 + }, TMP_StringScanner_eos$q_9.$$arity = 0); + + Opal.def(self, '$exist?', TMP_StringScanner_exist$q_10 = function(pattern) { + var self = this; + + + var result = pattern.exec(self.working); + + if (result == null) { + return nil; + } + else if (result.index == 0) { + return 0; + } + else { + return result.index + 1; + } + + }, TMP_StringScanner_exist$q_10.$$arity = 1); + + Opal.def(self, '$skip', TMP_StringScanner_skip_11 = function $$skip(pattern) { + var self = this; + + + pattern = self.$anchor(pattern); + + var result = pattern.exec(self.working); + + if (result == null) { + return self.matched = nil; + } + else { + var match_str = result[0]; + var match_len = match_str.length; + + self.matched = match_str; + self.prev_pos = self.pos; + self.pos += match_len; + self.working = self.working.substring(match_len); + + return match_len; + } + ; + }, TMP_StringScanner_skip_11.$$arity = 1); + + Opal.def(self, '$skip_until', TMP_StringScanner_skip_until_12 = function $$skip_until(pattern) { + var self = this; + + + var result = self.$scan_until(pattern); + + if (result === nil) { + return nil; + } + else { + self.matched = result.substr(-1); + + return result.length; + } + + }, TMP_StringScanner_skip_until_12.$$arity = 1); + + Opal.def(self, '$get_byte', TMP_StringScanner_get_byte_13 = function $$get_byte() { + var self = this; + + + var result = nil; + + if (self.pos < self.string.length) { + self.prev_pos = self.pos; + self.pos += 1; + result = self.matched = self.working.substring(0, 1); + self.working = self.working.substring(1); + } + else { + self.matched = nil; + } + + return result; + + }, TMP_StringScanner_get_byte_13.$$arity = 0); + Opal.alias(self, "getch", "get_byte"); + + Opal.def(self, '$match?', TMP_StringScanner_match$q_14 = function(pattern) { + var self = this; + + + pattern = self.$anchor(pattern); + + var result = pattern.exec(self.working); + + if (result == null) { + return nil; + } + else { + self.prev_pos = self.pos; + + return result[0].length; + } + ; + }, TMP_StringScanner_match$q_14.$$arity = 1); + + Opal.def(self, '$pos=', TMP_StringScanner_pos$eq_15 = function(pos) { + var self = this; + + + + if (pos < 0) { + pos += self.string.$length(); + } + ; + self.pos = pos; + return (self.working = self.string.slice(pos)); + }, TMP_StringScanner_pos$eq_15.$$arity = 1); + + Opal.def(self, '$matched_size', TMP_StringScanner_matched_size_16 = function $$matched_size() { + var self = this; + + + if (self.matched === nil) { + return nil; + } + + return self.matched.length + + }, TMP_StringScanner_matched_size_16.$$arity = 0); + + Opal.def(self, '$post_match', TMP_StringScanner_post_match_17 = function $$post_match() { + var self = this; + + + if (self.matched === nil) { + return nil; + } + + return self.string.substr(self.pos); + + }, TMP_StringScanner_post_match_17.$$arity = 0); + + Opal.def(self, '$pre_match', TMP_StringScanner_pre_match_18 = function $$pre_match() { + var self = this; + + + if (self.matched === nil) { + return nil; + } + + return self.string.substr(0, self.prev_pos); + + }, TMP_StringScanner_pre_match_18.$$arity = 0); + + Opal.def(self, '$reset', TMP_StringScanner_reset_19 = function $$reset() { + var self = this; + + + self.working = self.string; + self.matched = nil; + return (self.pos = 0); + }, TMP_StringScanner_reset_19.$$arity = 0); + + Opal.def(self, '$rest', TMP_StringScanner_rest_20 = function $$rest() { + var self = this; + + return self.working + }, TMP_StringScanner_rest_20.$$arity = 0); + + Opal.def(self, '$rest?', TMP_StringScanner_rest$q_21 = function() { + var self = this; + + return self.working.length !== 0 + }, TMP_StringScanner_rest$q_21.$$arity = 0); + + Opal.def(self, '$rest_size', TMP_StringScanner_rest_size_22 = function $$rest_size() { + var self = this; + + return self.$rest().$size() + }, TMP_StringScanner_rest_size_22.$$arity = 0); + + Opal.def(self, '$terminate', TMP_StringScanner_terminate_23 = function $$terminate() { + var self = this, $writer = nil; + + + self.match = nil; + + $writer = [self.string.$length()]; + $send(self, 'pos=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];; + }, TMP_StringScanner_terminate_23.$$arity = 0); + + Opal.def(self, '$unscan', TMP_StringScanner_unscan_24 = function $$unscan() { + var self = this; + + + self.pos = self.prev_pos; + self.prev_pos = nil; + self.match = nil; + return self; + }, TMP_StringScanner_unscan_24.$$arity = 0); + self.$private(); + return (Opal.def(self, '$anchor', TMP_StringScanner_anchor_25 = function $$anchor(pattern) { + var self = this; + + + var flags = pattern.toString().match(/\/([^\/]+)$/); + flags = flags ? flags[1] : undefined; + return new RegExp('^(?:' + pattern.source + ')', flags); + + }, TMP_StringScanner_anchor_25.$$arity = 1), nil) && 'anchor'; + })($nesting[0], null, $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/js"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice; + + Opal.add_stubs(['$require']); + + self.$require("asciidoctor/js/opal_ext"); + self.$require("asciidoctor/js/rx"); + return self.$require("strscan"); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["logger"] = function(Opal) { + function $rb_plus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); + } + function $rb_le(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs <= rhs : lhs['$<='](rhs); + } + function $rb_lt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $module = Opal.module, $send = Opal.send, $truthy = Opal.truthy; + + Opal.add_stubs(['$include', '$to_h', '$map', '$constants', '$const_get', '$to_s', '$format', '$chr', '$strftime', '$message_as_string', '$===', '$+', '$message', '$class', '$join', '$backtrace', '$inspect', '$attr_reader', '$attr_accessor', '$new', '$key', '$upcase', '$raise', '$add', '$to_proc', '$<=', '$<', '$write', '$call', '$[]', '$now']); + return (function($base, $super, $parent_nesting) { + function $Logger(){}; + var self = $Logger = $klass($base, $super, 'Logger', $Logger); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Logger_1, TMP_Logger_initialize_4, TMP_Logger_level$eq_5, TMP_Logger_info_6, TMP_Logger_debug_7, TMP_Logger_warn_8, TMP_Logger_error_9, TMP_Logger_fatal_10, TMP_Logger_unknown_11, TMP_Logger_info$q_12, TMP_Logger_debug$q_13, TMP_Logger_warn$q_14, TMP_Logger_error$q_15, TMP_Logger_fatal$q_16, TMP_Logger_add_17; + + def.level = def.progname = def.pipe = def.formatter = nil; + + (function($base, $parent_nesting) { + function $Severity() {}; + var self = $Severity = $module($base, 'Severity', $Severity); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + + Opal.const_set($nesting[0], 'DEBUG', 0); + Opal.const_set($nesting[0], 'INFO', 1); + Opal.const_set($nesting[0], 'WARN', 2); + Opal.const_set($nesting[0], 'ERROR', 3); + Opal.const_set($nesting[0], 'FATAL', 4); + Opal.const_set($nesting[0], 'UNKNOWN', 5); + })($nesting[0], $nesting); + self.$include($$($nesting, 'Severity')); + Opal.const_set($nesting[0], 'SEVERITY_LABELS', $send($$($nesting, 'Severity').$constants(), 'map', [], (TMP_Logger_1 = function(s){var self = TMP_Logger_1.$$s || this; + + + + if (s == null) { + s = nil; + }; + return [$$($nesting, 'Severity').$const_get(s), s.$to_s()];}, TMP_Logger_1.$$s = self, TMP_Logger_1.$$arity = 1, TMP_Logger_1)).$to_h()); + (function($base, $super, $parent_nesting) { + function $Formatter(){}; + var self = $Formatter = $klass($base, $super, 'Formatter', $Formatter); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Formatter_call_2, TMP_Formatter_message_as_string_3; + + + Opal.const_set($nesting[0], 'MESSAGE_FORMAT', "%s, [%s] %5s -- %s: %s\n"); + Opal.const_set($nesting[0], 'DATE_TIME_FORMAT', "%Y-%m-%dT%H:%M:%S.%6N"); + + Opal.def(self, '$call', TMP_Formatter_call_2 = function $$call(severity, time, progname, msg) { + var self = this; + + return self.$format($$($nesting, 'MESSAGE_FORMAT'), severity.$chr(), time.$strftime($$($nesting, 'DATE_TIME_FORMAT')), severity, progname, self.$message_as_string(msg)) + }, TMP_Formatter_call_2.$$arity = 4); + return (Opal.def(self, '$message_as_string', TMP_Formatter_message_as_string_3 = function $$message_as_string(msg) { + var $a, self = this, $case = nil; + + return (function() {$case = msg; + if ($$$('::', 'String')['$===']($case)) {return msg} + else if ($$$('::', 'Exception')['$===']($case)) {return $rb_plus("" + (msg.$message()) + " (" + (msg.$class()) + ")\n", ($truthy($a = msg.$backtrace()) ? $a : []).$join("\n"))} + else {return msg.$inspect()}})() + }, TMP_Formatter_message_as_string_3.$$arity = 1), nil) && 'message_as_string'; + })($nesting[0], null, $nesting); + self.$attr_reader("level"); + self.$attr_accessor("progname"); + self.$attr_accessor("formatter"); + + Opal.def(self, '$initialize', TMP_Logger_initialize_4 = function $$initialize(pipe) { + var self = this; + + + self.pipe = pipe; + self.level = $$($nesting, 'DEBUG'); + return (self.formatter = $$($nesting, 'Formatter').$new()); + }, TMP_Logger_initialize_4.$$arity = 1); + + Opal.def(self, '$level=', TMP_Logger_level$eq_5 = function(severity) { + var self = this, level = nil; + + if ($truthy($$$('::', 'Integer')['$==='](severity))) { + return (self.level = severity) + } else if ($truthy((level = $$($nesting, 'SEVERITY_LABELS').$key(severity.$to_s().$upcase())))) { + return (self.level = level) + } else { + return self.$raise($$($nesting, 'ArgumentError'), "" + "invalid log level: " + (severity)) + } + }, TMP_Logger_level$eq_5.$$arity = 1); + + Opal.def(self, '$info', TMP_Logger_info_6 = function $$info(progname) { + var $iter = TMP_Logger_info_6.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Logger_info_6.$$p = null; + + + if ($iter) TMP_Logger_info_6.$$p = null;; + + if (progname == null) { + progname = nil; + }; + return $send(self, 'add', [$$($nesting, 'INFO'), nil, progname], block.$to_proc()); + }, TMP_Logger_info_6.$$arity = -1); + + Opal.def(self, '$debug', TMP_Logger_debug_7 = function $$debug(progname) { + var $iter = TMP_Logger_debug_7.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Logger_debug_7.$$p = null; + + + if ($iter) TMP_Logger_debug_7.$$p = null;; + + if (progname == null) { + progname = nil; + }; + return $send(self, 'add', [$$($nesting, 'DEBUG'), nil, progname], block.$to_proc()); + }, TMP_Logger_debug_7.$$arity = -1); + + Opal.def(self, '$warn', TMP_Logger_warn_8 = function $$warn(progname) { + var $iter = TMP_Logger_warn_8.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Logger_warn_8.$$p = null; + + + if ($iter) TMP_Logger_warn_8.$$p = null;; + + if (progname == null) { + progname = nil; + }; + return $send(self, 'add', [$$($nesting, 'WARN'), nil, progname], block.$to_proc()); + }, TMP_Logger_warn_8.$$arity = -1); + + Opal.def(self, '$error', TMP_Logger_error_9 = function $$error(progname) { + var $iter = TMP_Logger_error_9.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Logger_error_9.$$p = null; + + + if ($iter) TMP_Logger_error_9.$$p = null;; + + if (progname == null) { + progname = nil; + }; + return $send(self, 'add', [$$($nesting, 'ERROR'), nil, progname], block.$to_proc()); + }, TMP_Logger_error_9.$$arity = -1); + + Opal.def(self, '$fatal', TMP_Logger_fatal_10 = function $$fatal(progname) { + var $iter = TMP_Logger_fatal_10.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Logger_fatal_10.$$p = null; + + + if ($iter) TMP_Logger_fatal_10.$$p = null;; + + if (progname == null) { + progname = nil; + }; + return $send(self, 'add', [$$($nesting, 'FATAL'), nil, progname], block.$to_proc()); + }, TMP_Logger_fatal_10.$$arity = -1); + + Opal.def(self, '$unknown', TMP_Logger_unknown_11 = function $$unknown(progname) { + var $iter = TMP_Logger_unknown_11.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Logger_unknown_11.$$p = null; + + + if ($iter) TMP_Logger_unknown_11.$$p = null;; + + if (progname == null) { + progname = nil; + }; + return $send(self, 'add', [$$($nesting, 'UNKNOWN'), nil, progname], block.$to_proc()); + }, TMP_Logger_unknown_11.$$arity = -1); + + Opal.def(self, '$info?', TMP_Logger_info$q_12 = function() { + var self = this; + + return $rb_le(self.level, $$($nesting, 'INFO')) + }, TMP_Logger_info$q_12.$$arity = 0); + + Opal.def(self, '$debug?', TMP_Logger_debug$q_13 = function() { + var self = this; + + return $rb_le(self.level, $$($nesting, 'DEBUG')) + }, TMP_Logger_debug$q_13.$$arity = 0); + + Opal.def(self, '$warn?', TMP_Logger_warn$q_14 = function() { + var self = this; + + return $rb_le(self.level, $$($nesting, 'WARN')) + }, TMP_Logger_warn$q_14.$$arity = 0); + + Opal.def(self, '$error?', TMP_Logger_error$q_15 = function() { + var self = this; + + return $rb_le(self.level, $$($nesting, 'ERROR')) + }, TMP_Logger_error$q_15.$$arity = 0); + + Opal.def(self, '$fatal?', TMP_Logger_fatal$q_16 = function() { + var self = this; + + return $rb_le(self.level, $$($nesting, 'FATAL')) + }, TMP_Logger_fatal$q_16.$$arity = 0); + return (Opal.def(self, '$add', TMP_Logger_add_17 = function $$add(severity, message, progname) { + var $iter = TMP_Logger_add_17.$$p, block = $iter || nil, $a, self = this; + + if ($iter) TMP_Logger_add_17.$$p = null; + + + if ($iter) TMP_Logger_add_17.$$p = null;; + + if (message == null) { + message = nil; + }; + + if (progname == null) { + progname = nil; + }; + if ($truthy($rb_lt((severity = ($truthy($a = severity) ? $a : $$($nesting, 'UNKNOWN'))), self.level))) { + return true}; + progname = ($truthy($a = progname) ? $a : self.progname); + if ($truthy(message)) { + } else if ((block !== nil)) { + message = Opal.yieldX(block, []) + } else { + + message = progname; + progname = self.progname; + }; + self.pipe.$write(self.formatter.$call(($truthy($a = $$($nesting, 'SEVERITY_LABELS')['$[]'](severity)) ? $a : "ANY"), $$$('::', 'Time').$now(), progname, message)); + return true; + }, TMP_Logger_add_17.$$arity = -2), nil) && 'add'; + })($nesting[0], null, $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/logging"] = function(Opal) { + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + function $rb_gt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $send = Opal.send, $truthy = Opal.truthy, $hash2 = Opal.hash2, $gvars = Opal.gvars; + + Opal.add_stubs(['$require', '$attr_reader', '$progname=', '$-', '$new', '$formatter=', '$level=', '$>', '$[]', '$===', '$inspect', '$map', '$constants', '$const_get', '$to_sym', '$<<', '$clear', '$empty?', '$max', '$attr_accessor', '$memoize_logger', '$private', '$alias_method', '$==', '$define_method', '$extend', '$logger', '$merge']); + + self.$require("logger"); + return (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + + (function($base, $super, $parent_nesting) { + function $Logger(){}; + var self = $Logger = $klass($base, $super, 'Logger', $Logger); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Logger_initialize_1, TMP_Logger_add_2; + + def.max_severity = nil; + + self.$attr_reader("max_severity"); + + Opal.def(self, '$initialize', TMP_Logger_initialize_1 = function $$initialize($a) { + var $post_args, args, $iter = TMP_Logger_initialize_1.$$p, $yield = $iter || nil, self = this, $writer = nil, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_Logger_initialize_1.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + $send(self, Opal.find_super_dispatcher(self, 'initialize', TMP_Logger_initialize_1, false), $zuper, $iter); + + $writer = ["asciidoctor"]; + $send(self, 'progname=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = [$$($nesting, 'BasicFormatter').$new()]; + $send(self, 'formatter=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = [$$($nesting, 'WARN')]; + $send(self, 'level=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];; + }, TMP_Logger_initialize_1.$$arity = -1); + + Opal.def(self, '$add', TMP_Logger_add_2 = function $$add(severity, message, progname) { + var $a, $iter = TMP_Logger_add_2.$$p, $yield = $iter || nil, self = this, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_Logger_add_2.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + + + if (message == null) { + message = nil; + }; + + if (progname == null) { + progname = nil; + }; + if ($truthy($rb_gt((severity = ($truthy($a = severity) ? $a : $$($nesting, 'UNKNOWN'))), (self.max_severity = ($truthy($a = self.max_severity) ? $a : severity))))) { + self.max_severity = severity}; + return $send(self, Opal.find_super_dispatcher(self, 'add', TMP_Logger_add_2, false), $zuper, $iter); + }, TMP_Logger_add_2.$$arity = -2); + (function($base, $super, $parent_nesting) { + function $BasicFormatter(){}; + var self = $BasicFormatter = $klass($base, $super, 'BasicFormatter', $BasicFormatter); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_BasicFormatter_call_3; + + + Opal.const_set($nesting[0], 'SEVERITY_LABELS', $hash2(["WARN", "FATAL"], {"WARN": "WARNING", "FATAL": "FAILED"})); + return (Opal.def(self, '$call', TMP_BasicFormatter_call_3 = function $$call(severity, _, progname, msg) { + var $a, self = this; + + return "" + (progname) + ": " + (($truthy($a = $$($nesting, 'SEVERITY_LABELS')['$[]'](severity)) ? $a : severity)) + ": " + ((function() {if ($truthy($$$('::', 'String')['$==='](msg))) { + return msg + } else { + return msg.$inspect() + }; return nil; })()) + "\n" + }, TMP_BasicFormatter_call_3.$$arity = 4), nil) && 'call'; + })($nesting[0], $$($nesting, 'Formatter'), $nesting); + return (function($base, $parent_nesting) { + function $AutoFormattingMessage() {}; + var self = $AutoFormattingMessage = $module($base, 'AutoFormattingMessage', $AutoFormattingMessage); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_AutoFormattingMessage_inspect_4; + + + Opal.def(self, '$inspect', TMP_AutoFormattingMessage_inspect_4 = function $$inspect() { + var self = this, sloc = nil; + + if ($truthy((sloc = self['$[]']("source_location")))) { + return "" + (sloc) + ": " + (self['$[]']("text")) + } else { + return self['$[]']("text") + } + }, TMP_AutoFormattingMessage_inspect_4.$$arity = 0) + })($nesting[0], $nesting); + })($nesting[0], $$$('::', 'Logger'), $nesting); + (function($base, $super, $parent_nesting) { + function $MemoryLogger(){}; + var self = $MemoryLogger = $klass($base, $super, 'MemoryLogger', $MemoryLogger); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_MemoryLogger_5, TMP_MemoryLogger_initialize_6, TMP_MemoryLogger_add_7, TMP_MemoryLogger_clear_8, TMP_MemoryLogger_empty$q_9, TMP_MemoryLogger_max_severity_10; + + def.messages = nil; + + Opal.const_set($nesting[0], 'SEVERITY_LABELS', $$$('::', 'Hash')['$[]']($send($$($nesting, 'Severity').$constants(), 'map', [], (TMP_MemoryLogger_5 = function(c){var self = TMP_MemoryLogger_5.$$s || this; + + + + if (c == null) { + c = nil; + }; + return [$$($nesting, 'Severity').$const_get(c), c.$to_sym()];}, TMP_MemoryLogger_5.$$s = self, TMP_MemoryLogger_5.$$arity = 1, TMP_MemoryLogger_5)))); + self.$attr_reader("messages"); + + Opal.def(self, '$initialize', TMP_MemoryLogger_initialize_6 = function $$initialize() { + var self = this, $writer = nil; + + + + $writer = [$$($nesting, 'WARN')]; + $send(self, 'level=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + return (self.messages = []); + }, TMP_MemoryLogger_initialize_6.$$arity = 0); + + Opal.def(self, '$add', TMP_MemoryLogger_add_7 = function $$add(severity, message, progname) { + var $a, $iter = TMP_MemoryLogger_add_7.$$p, $yield = $iter || nil, self = this; + + if ($iter) TMP_MemoryLogger_add_7.$$p = null; + + + if (message == null) { + message = nil; + }; + + if (progname == null) { + progname = nil; + }; + if ($truthy(message)) { + } else { + message = (function() {if (($yield !== nil)) { + return Opal.yieldX($yield, []); + } else { + return progname + }; return nil; })() + }; + self.messages['$<<']($hash2(["severity", "message"], {"severity": $$($nesting, 'SEVERITY_LABELS')['$[]'](($truthy($a = severity) ? $a : $$($nesting, 'UNKNOWN'))), "message": message})); + return true; + }, TMP_MemoryLogger_add_7.$$arity = -2); + + Opal.def(self, '$clear', TMP_MemoryLogger_clear_8 = function $$clear() { + var self = this; + + return self.messages.$clear() + }, TMP_MemoryLogger_clear_8.$$arity = 0); + + Opal.def(self, '$empty?', TMP_MemoryLogger_empty$q_9 = function() { + var self = this; + + return self.messages['$empty?']() + }, TMP_MemoryLogger_empty$q_9.$$arity = 0); + return (Opal.def(self, '$max_severity', TMP_MemoryLogger_max_severity_10 = function $$max_severity() { + var TMP_11, self = this; + + if ($truthy(self['$empty?']())) { + return nil + } else { + return $send(self.messages, 'map', [], (TMP_11 = function(m){var self = TMP_11.$$s || this; + + + + if (m == null) { + m = nil; + }; + return $$($nesting, 'Severity').$const_get(m['$[]']("severity"));}, TMP_11.$$s = self, TMP_11.$$arity = 1, TMP_11)).$max() + } + }, TMP_MemoryLogger_max_severity_10.$$arity = 0), nil) && 'max_severity'; + })($nesting[0], $$$('::', 'Logger'), $nesting); + (function($base, $super, $parent_nesting) { + function $NullLogger(){}; + var self = $NullLogger = $klass($base, $super, 'NullLogger', $NullLogger); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_NullLogger_initialize_12, TMP_NullLogger_add_13; + + def.max_severity = nil; + + self.$attr_reader("max_severity"); + + Opal.def(self, '$initialize', TMP_NullLogger_initialize_12 = function $$initialize() { + var self = this; + + return nil + }, TMP_NullLogger_initialize_12.$$arity = 0); + return (Opal.def(self, '$add', TMP_NullLogger_add_13 = function $$add(severity, message, progname) { + var $a, self = this; + + + + if (message == null) { + message = nil; + }; + + if (progname == null) { + progname = nil; + }; + if ($truthy($rb_gt((severity = ($truthy($a = severity) ? $a : $$($nesting, 'UNKNOWN'))), (self.max_severity = ($truthy($a = self.max_severity) ? $a : severity))))) { + self.max_severity = severity}; + return true; + }, TMP_NullLogger_add_13.$$arity = -2), nil) && 'add'; + })($nesting[0], $$$('::', 'Logger'), $nesting); + (function($base, $parent_nesting) { + function $LoggerManager() {}; + var self = $LoggerManager = $module($base, 'LoggerManager', $LoggerManager); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + + self.logger_class = $$($nesting, 'Logger'); + (function(self, $parent_nesting) { + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_logger_14, TMP_logger$eq_15, TMP_memoize_logger_16; + + + self.$attr_accessor("logger_class"); + + Opal.def(self, '$logger', TMP_logger_14 = function $$logger(pipe) { + var $a, self = this; + if (self.logger == null) self.logger = nil; + if (self.logger_class == null) self.logger_class = nil; + if ($gvars.stderr == null) $gvars.stderr = nil; + + + + if (pipe == null) { + pipe = $gvars.stderr; + }; + self.$memoize_logger(); + return (self.logger = ($truthy($a = self.logger) ? $a : self.logger_class.$new(pipe))); + }, TMP_logger_14.$$arity = -1); + + Opal.def(self, '$logger=', TMP_logger$eq_15 = function(logger) { + var $a, self = this; + if (self.logger_class == null) self.logger_class = nil; + if ($gvars.stderr == null) $gvars.stderr = nil; + + return (self.logger = ($truthy($a = logger) ? $a : self.logger_class.$new($gvars.stderr))) + }, TMP_logger$eq_15.$$arity = 1); + self.$private(); + return (Opal.def(self, '$memoize_logger', TMP_memoize_logger_16 = function $$memoize_logger() { + var self = this; + + return (function(self, $parent_nesting) { + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_17; + + + self.$alias_method("logger", "logger"); + if ($$($nesting, 'RUBY_ENGINE')['$==']("opal")) { + return $send(self, 'define_method', ["logger"], (TMP_17 = function(){var self = TMP_17.$$s || this; + if (self.logger == null) self.logger = nil; + + return self.logger}, TMP_17.$$s = self, TMP_17.$$arity = 0, TMP_17)) + } else { + return nil + }; + })(Opal.get_singleton_class(self), $nesting) + }, TMP_memoize_logger_16.$$arity = 0), nil) && 'memoize_logger'; + })(Opal.get_singleton_class(self), $nesting); + })($nesting[0], $nesting); + (function($base, $parent_nesting) { + function $Logging() {}; + var self = $Logging = $module($base, 'Logging', $Logging); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Logging_included_18, TMP_Logging_logger_19, TMP_Logging_message_with_context_20; + + + Opal.defs(self, '$included', TMP_Logging_included_18 = function $$included(into) { + var self = this; + + return into.$extend($$($nesting, 'Logging')) + }, TMP_Logging_included_18.$$arity = 1); + self.$private(); + + Opal.def(self, '$logger', TMP_Logging_logger_19 = function $$logger() { + var self = this; + + return $$($nesting, 'LoggerManager').$logger() + }, TMP_Logging_logger_19.$$arity = 0); + + Opal.def(self, '$message_with_context', TMP_Logging_message_with_context_20 = function $$message_with_context(text, context) { + var self = this; + + + + if (context == null) { + context = $hash2([], {}); + }; + return $hash2(["text"], {"text": text}).$merge(context).$extend($$$($$($nesting, 'Logger'), 'AutoFormattingMessage')); + }, TMP_Logging_message_with_context_20.$$arity = -2); + })($nesting[0], $nesting); + })($nesting[0], $nesting); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/timings"] = function(Opal) { + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + function $rb_plus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); + } + function $rb_gt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $hash2 = Opal.hash2, $send = Opal.send, $truthy = Opal.truthy, $gvars = Opal.gvars; + + Opal.add_stubs(['$now', '$[]=', '$-', '$delete', '$reduce', '$+', '$[]', '$>', '$time', '$puts', '$%', '$to_f', '$read_parse', '$convert', '$read_parse_convert', '$const_defined?', '$respond_to?', '$clock_gettime']); + return (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + (function($base, $super, $parent_nesting) { + function $Timings(){}; + var self = $Timings = $klass($base, $super, 'Timings', $Timings); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Timings_initialize_1, TMP_Timings_start_2, TMP_Timings_record_3, TMP_Timings_time_4, TMP_Timings_read_6, TMP_Timings_parse_7, TMP_Timings_read_parse_8, TMP_Timings_convert_9, TMP_Timings_read_parse_convert_10, TMP_Timings_write_11, TMP_Timings_total_12, TMP_Timings_print_report_13, $a, TMP_Timings_now_14, TMP_Timings_now_15; + + def.timers = def.log = nil; + + + Opal.def(self, '$initialize', TMP_Timings_initialize_1 = function $$initialize() { + var self = this; + + + self.log = $hash2([], {}); + return (self.timers = $hash2([], {})); + }, TMP_Timings_initialize_1.$$arity = 0); + + Opal.def(self, '$start', TMP_Timings_start_2 = function $$start(key) { + var self = this, $writer = nil; + + + $writer = [key, self.$now()]; + $send(self.timers, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + }, TMP_Timings_start_2.$$arity = 1); + + Opal.def(self, '$record', TMP_Timings_record_3 = function $$record(key) { + var self = this, $writer = nil; + + + $writer = [key, $rb_minus(self.$now(), self.timers.$delete(key))]; + $send(self.log, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + }, TMP_Timings_record_3.$$arity = 1); + + Opal.def(self, '$time', TMP_Timings_time_4 = function $$time($a) { + var $post_args, keys, TMP_5, self = this, time = nil; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + keys = $post_args;; + time = $send(keys, 'reduce', [0], (TMP_5 = function(sum, key){var self = TMP_5.$$s || this, $b; + if (self.log == null) self.log = nil; + + + + if (sum == null) { + sum = nil; + }; + + if (key == null) { + key = nil; + }; + return $rb_plus(sum, ($truthy($b = self.log['$[]'](key)) ? $b : 0));}, TMP_5.$$s = self, TMP_5.$$arity = 2, TMP_5)); + if ($truthy($rb_gt(time, 0))) { + return time + } else { + return nil + }; + }, TMP_Timings_time_4.$$arity = -1); + + Opal.def(self, '$read', TMP_Timings_read_6 = function $$read() { + var self = this; + + return self.$time("read") + }, TMP_Timings_read_6.$$arity = 0); + + Opal.def(self, '$parse', TMP_Timings_parse_7 = function $$parse() { + var self = this; + + return self.$time("parse") + }, TMP_Timings_parse_7.$$arity = 0); + + Opal.def(self, '$read_parse', TMP_Timings_read_parse_8 = function $$read_parse() { + var self = this; + + return self.$time("read", "parse") + }, TMP_Timings_read_parse_8.$$arity = 0); + + Opal.def(self, '$convert', TMP_Timings_convert_9 = function $$convert() { + var self = this; + + return self.$time("convert") + }, TMP_Timings_convert_9.$$arity = 0); + + Opal.def(self, '$read_parse_convert', TMP_Timings_read_parse_convert_10 = function $$read_parse_convert() { + var self = this; + + return self.$time("read", "parse", "convert") + }, TMP_Timings_read_parse_convert_10.$$arity = 0); + + Opal.def(self, '$write', TMP_Timings_write_11 = function $$write() { + var self = this; + + return self.$time("write") + }, TMP_Timings_write_11.$$arity = 0); + + Opal.def(self, '$total', TMP_Timings_total_12 = function $$total() { + var self = this; + + return self.$time("read", "parse", "convert", "write") + }, TMP_Timings_total_12.$$arity = 0); + + Opal.def(self, '$print_report', TMP_Timings_print_report_13 = function $$print_report(to, subject) { + var self = this; + if ($gvars.stdout == null) $gvars.stdout = nil; + + + + if (to == null) { + to = $gvars.stdout; + }; + + if (subject == null) { + subject = nil; + }; + if ($truthy(subject)) { + to.$puts("" + "Input file: " + (subject))}; + to.$puts("" + " Time to read and parse source: " + ("%05.5f"['$%'](self.$read_parse().$to_f()))); + to.$puts("" + " Time to convert document: " + ("%05.5f"['$%'](self.$convert().$to_f()))); + return to.$puts("" + " Total time (read, parse and convert): " + ("%05.5f"['$%'](self.$read_parse_convert().$to_f()))); + }, TMP_Timings_print_report_13.$$arity = -1); + if ($truthy(($truthy($a = $$$('::', 'Process')['$const_defined?']("CLOCK_MONOTONIC")) ? $$$('::', 'Process')['$respond_to?']("clock_gettime") : $a))) { + + Opal.const_set($nesting[0], 'CLOCK_ID', $$$($$$('::', 'Process'), 'CLOCK_MONOTONIC')); + return (Opal.def(self, '$now', TMP_Timings_now_14 = function $$now() { + var self = this; + + return $$$('::', 'Process').$clock_gettime($$($nesting, 'CLOCK_ID')) + }, TMP_Timings_now_14.$$arity = 0), nil) && 'now'; + } else { + return (Opal.def(self, '$now', TMP_Timings_now_15 = function $$now() { + var self = this; + + return $$$('::', 'Time').$now() + }, TMP_Timings_now_15.$$arity = 0), nil) && 'now' + }; + })($nesting[0], null, $nesting) + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/version"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module; + + return (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + Opal.const_set($nesting[0], 'VERSION', "1.5.8") + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/core_ext/nil_or_empty"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $truthy = Opal.truthy; + + Opal.add_stubs(['$method_defined?']); + + (function($base, $super, $parent_nesting) { + function $NilClass(){}; + var self = $NilClass = $klass($base, $super, 'NilClass', $NilClass); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + if ($truthy(self['$method_defined?']("nil_or_empty?"))) { + return nil + } else { + return Opal.alias(self, "nil_or_empty?", "nil?") + } + })($nesting[0], null, $nesting); + (function($base, $super, $parent_nesting) { + function $String(){}; + var self = $String = $klass($base, $super, 'String', $String); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + if ($truthy(self['$method_defined?']("nil_or_empty?"))) { + return nil + } else { + return Opal.alias(self, "nil_or_empty?", "empty?") + } + })($nesting[0], null, $nesting); + (function($base, $super, $parent_nesting) { + function $Array(){}; + var self = $Array = $klass($base, $super, 'Array', $Array); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + if ($truthy(self['$method_defined?']("nil_or_empty?"))) { + return nil + } else { + return Opal.alias(self, "nil_or_empty?", "empty?") + } + })($nesting[0], null, $nesting); + (function($base, $super, $parent_nesting) { + function $Hash(){}; + var self = $Hash = $klass($base, $super, 'Hash', $Hash); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + if ($truthy(self['$method_defined?']("nil_or_empty?"))) { + return nil + } else { + return Opal.alias(self, "nil_or_empty?", "empty?") + } + })($nesting[0], null, $nesting); + return (function($base, $super, $parent_nesting) { + function $Numeric(){}; + var self = $Numeric = $klass($base, $super, 'Numeric', $Numeric); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + if ($truthy(self['$method_defined?']("nil_or_empty?"))) { + return nil + } else { + return Opal.alias(self, "nil_or_empty?", "nil?") + } + })($nesting[0], null, $nesting); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/core_ext/regexp/is_match"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $truthy = Opal.truthy; + + Opal.add_stubs(['$method_defined?']); + return (function($base, $super, $parent_nesting) { + function $Regexp(){}; + var self = $Regexp = $klass($base, $super, 'Regexp', $Regexp); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + if ($truthy(self['$method_defined?']("match?"))) { + return nil + } else { + return Opal.alias(self, "match?", "===") + } + })($nesting[0], null, $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/core_ext/string/limit_bytesize"] = function(Opal) { + function $rb_lt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); + } + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $truthy = Opal.truthy; + + Opal.add_stubs(['$method_defined?', '$<', '$bytesize', '$valid_encoding?', '$force_encoding', '$byteslice', '$-']); + return (function($base, $super, $parent_nesting) { + function $String(){}; + var self = $String = $klass($base, $super, 'String', $String); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_String_limit_bytesize_1; + + if ($truthy(self['$method_defined?']("limit_bytesize"))) { + return nil + } else { + return (Opal.def(self, '$limit_bytesize', TMP_String_limit_bytesize_1 = function $$limit_bytesize(size) { + var $a, self = this, result = nil; + + + if ($truthy($rb_lt(size, self.$bytesize()))) { + } else { + return self + }; + while (!($truthy((result = self.$byteslice(0, size)).$force_encoding($$$($$$('::', 'Encoding'), 'UTF_8'))['$valid_encoding?']()))) { + size = $rb_minus(size, 1) + }; + return result; + }, TMP_String_limit_bytesize_1.$$arity = 1), nil) && 'limit_bytesize' + } + })($nesting[0], null, $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/core_ext/1.8.7/io/binread"] = function(Opal) { + var TMP_binread_1, self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $truthy = Opal.truthy, $send = Opal.send; + + Opal.add_stubs(['$respond_to?', '$open', '$==', '$seek', '$read']); + if ($truthy($$($nesting, 'IO')['$respond_to?']("binread"))) { + return nil + } else { + return (Opal.defs($$($nesting, 'IO'), '$binread', TMP_binread_1 = function $$binread(name, length, offset) { + var TMP_2, self = this; + + + + if (length == null) { + length = nil; + }; + + if (offset == null) { + offset = 0; + }; + return $send($$($nesting, 'File'), 'open', [name, "rb"], (TMP_2 = function(f){var self = TMP_2.$$s || this; + + + + if (f == null) { + f = nil; + }; + if (offset['$=='](0)) { + } else { + f.$seek(offset) + }; + if ($truthy(length)) { + + return f.$read(length); + } else { + return f.$read() + };}, TMP_2.$$s = self, TMP_2.$$arity = 1, TMP_2)); + }, TMP_binread_1.$$arity = -2), nil) && 'binread' + } +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/core_ext/1.8.7/io/write"] = function(Opal) { + var TMP_write_1, self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $truthy = Opal.truthy, $send = Opal.send; + + Opal.add_stubs(['$respond_to?', '$open', '$write']); + if ($truthy($$($nesting, 'IO')['$respond_to?']("write"))) { + return nil + } else { + return (Opal.defs($$($nesting, 'IO'), '$write', TMP_write_1 = function $$write(name, string, offset, opts) { + var TMP_2, self = this; + + + + if (offset == null) { + offset = 0; + }; + + if (opts == null) { + opts = nil; + }; + return $send($$($nesting, 'File'), 'open', [name, "w"], (TMP_2 = function(f){var self = TMP_2.$$s || this; + + + + if (f == null) { + f = nil; + }; + return f.$write(string);}, TMP_2.$$s = self, TMP_2.$$arity = 1, TMP_2)); + }, TMP_write_1.$$arity = -3), nil) && 'write' + } +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/core_ext"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $truthy = Opal.truthy; + + Opal.add_stubs(['$require', '$==', '$!=']); + + self.$require("asciidoctor/core_ext/nil_or_empty"); + self.$require("asciidoctor/core_ext/regexp/is_match"); + if ($truthy($$($nesting, 'RUBY_MIN_VERSION_1_9'))) { + + self.$require("asciidoctor/core_ext/string/limit_bytesize"); + if ($$($nesting, 'RUBY_ENGINE')['$==']("opal")) { + + self.$require("asciidoctor/core_ext/1.8.7/io/binread"); + return self.$require("asciidoctor/core_ext/1.8.7/io/write"); + } else { + return nil + }; + } else if ($truthy($$($nesting, 'RUBY_ENGINE')['$!=']("opal"))) { + return nil + } else { + return nil + }; +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/helpers"] = function(Opal) { + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + function $rb_times(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs * rhs : lhs['$*'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $truthy = Opal.truthy, $send = Opal.send, $gvars = Opal.gvars, $hash2 = Opal.hash2; + + Opal.add_stubs(['$require', '$include?', '$include', '$==', '$===', '$raise', '$warn', '$logger', '$chomp', '$message', '$normalize_lines_from_string', '$normalize_lines_array', '$empty?', '$unpack', '$[]', '$slice', '$join', '$map', '$each_line', '$encode', '$force_encoding', '$length', '$rstrip', '$[]=', '$-', '$encoding', '$nil_or_empty?', '$match?', '$=~', '$gsub', '$each_byte', '$sprintf', '$rindex', '$basename', '$extname', '$directory?', '$dirname', '$mkdir_p', '$mkdir', '$divmod', '$*']); + return (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + (function($base, $parent_nesting) { + function $Helpers() {}; + var self = $Helpers = $module($base, 'Helpers', $Helpers); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Helpers_require_library_1, TMP_Helpers_normalize_lines_2, TMP_Helpers_normalize_lines_array_3, TMP_Helpers_normalize_lines_from_string_8, TMP_Helpers_uriish$q_10, TMP_Helpers_uri_prefix_11, TMP_Helpers_uri_encode_12, TMP_Helpers_rootname_15, TMP_Helpers_basename_16, TMP_Helpers_mkdir_p_17, TMP_Helpers_int_to_roman_18; + + + Opal.defs(self, '$require_library', TMP_Helpers_require_library_1 = function $$require_library(name, gem_name, on_failure) { + var self = this, e = nil, $case = nil; + + + + if (gem_name == null) { + gem_name = true; + }; + + if (on_failure == null) { + on_failure = "abort"; + }; + try { + return self.$require(name) + } catch ($err) { + if (Opal.rescue($err, [$$$('::', 'LoadError')])) {e = $err; + try { + + if ($truthy(self['$include?']($$($nesting, 'Logging')))) { + } else { + self.$include($$($nesting, 'Logging')) + }; + if ($truthy(gem_name)) { + + if (gem_name['$=='](true)) { + gem_name = name}; + $case = on_failure; + if ("abort"['$===']($case)) {self.$raise($$$('::', 'LoadError'), "" + "asciidoctor: FAILED: required gem '" + (gem_name) + "' is not installed. Processing aborted.")} + else if ("warn"['$===']($case)) {self.$logger().$warn("" + "optional gem '" + (gem_name) + "' is not installed. Functionality disabled.")}; + } else { + $case = on_failure; + if ("abort"['$===']($case)) {self.$raise($$$('::', 'LoadError'), "" + "asciidoctor: FAILED: " + (e.$message().$chomp(".")) + ". Processing aborted.")} + else if ("warn"['$===']($case)) {self.$logger().$warn("" + (e.$message().$chomp(".")) + ". Functionality disabled.")} + }; + return nil; + } finally { Opal.pop_exception() } + } else { throw $err; } + }; + }, TMP_Helpers_require_library_1.$$arity = -2); + Opal.defs(self, '$normalize_lines', TMP_Helpers_normalize_lines_2 = function $$normalize_lines(data) { + var self = this; + + if ($truthy($$$('::', 'String')['$==='](data))) { + + return self.$normalize_lines_from_string(data); + } else { + + return self.$normalize_lines_array(data); + } + }, TMP_Helpers_normalize_lines_2.$$arity = 1); + Opal.defs(self, '$normalize_lines_array', TMP_Helpers_normalize_lines_array_3 = function $$normalize_lines_array(data) { + var TMP_4, TMP_5, TMP_6, TMP_7, self = this, leading_bytes = nil, first_line = nil, utf8 = nil, leading_2_bytes = nil, $writer = nil; + + + if ($truthy(data['$empty?']())) { + return data}; + leading_bytes = (first_line = data['$[]'](0)).$unpack("C3"); + if ($truthy($$($nesting, 'COERCE_ENCODING'))) { + + utf8 = $$$($$$('::', 'Encoding'), 'UTF_8'); + if ((leading_2_bytes = leading_bytes.$slice(0, 2))['$==']($$($nesting, 'BOM_BYTES_UTF_16LE'))) { + + data = data.$join(); + return $send(data.$force_encoding($$$($$$('::', 'Encoding'), 'UTF_16LE')).$slice(1, data.$length()).$encode(utf8).$each_line(), 'map', [], (TMP_4 = function(line){var self = TMP_4.$$s || this; + + + + if (line == null) { + line = nil; + }; + return line.$rstrip();}, TMP_4.$$s = self, TMP_4.$$arity = 1, TMP_4)); + } else if (leading_2_bytes['$==']($$($nesting, 'BOM_BYTES_UTF_16BE'))) { + + + $writer = [0, first_line.$force_encoding($$$($$$('::', 'Encoding'), 'UTF_16BE')).$slice(1, first_line.$length())]; + $send(data, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + return $send(data, 'map', [], (TMP_5 = function(line){var self = TMP_5.$$s || this; + + + + if (line == null) { + line = nil; + }; + return line.$force_encoding($$$($$$('::', 'Encoding'), 'UTF_16BE')).$encode(utf8).$rstrip();}, TMP_5.$$s = self, TMP_5.$$arity = 1, TMP_5)); + } else if (leading_bytes['$==']($$($nesting, 'BOM_BYTES_UTF_8'))) { + + $writer = [0, first_line.$force_encoding(utf8).$slice(1, first_line.$length())]; + $send(data, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + return $send(data, 'map', [], (TMP_6 = function(line){var self = TMP_6.$$s || this; + + + + if (line == null) { + line = nil; + }; + if (line.$encoding()['$=='](utf8)) { + return line.$rstrip() + } else { + return line.$force_encoding(utf8).$rstrip() + };}, TMP_6.$$s = self, TMP_6.$$arity = 1, TMP_6)); + } else { + + if (leading_bytes['$==']($$($nesting, 'BOM_BYTES_UTF_8'))) { + + $writer = [0, first_line.$slice(3, first_line.$length())]; + $send(data, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + return $send(data, 'map', [], (TMP_7 = function(line){var self = TMP_7.$$s || this; + + + + if (line == null) { + line = nil; + }; + return line.$rstrip();}, TMP_7.$$s = self, TMP_7.$$arity = 1, TMP_7)); + }; + }, TMP_Helpers_normalize_lines_array_3.$$arity = 1); + Opal.defs(self, '$normalize_lines_from_string', TMP_Helpers_normalize_lines_from_string_8 = function $$normalize_lines_from_string(data) { + var TMP_9, self = this, leading_bytes = nil, utf8 = nil, leading_2_bytes = nil; + + + if ($truthy(data['$nil_or_empty?']())) { + return []}; + leading_bytes = data.$unpack("C3"); + if ($truthy($$($nesting, 'COERCE_ENCODING'))) { + + utf8 = $$$($$$('::', 'Encoding'), 'UTF_8'); + if ((leading_2_bytes = leading_bytes.$slice(0, 2))['$==']($$($nesting, 'BOM_BYTES_UTF_16LE'))) { + data = data.$force_encoding($$$($$$('::', 'Encoding'), 'UTF_16LE')).$slice(1, data.$length()).$encode(utf8) + } else if (leading_2_bytes['$==']($$($nesting, 'BOM_BYTES_UTF_16BE'))) { + data = data.$force_encoding($$$($$$('::', 'Encoding'), 'UTF_16BE')).$slice(1, data.$length()).$encode(utf8) + } else if (leading_bytes['$==']($$($nesting, 'BOM_BYTES_UTF_8'))) { + data = (function() {if (data.$encoding()['$=='](utf8)) { + + return data.$slice(1, data.$length()); + } else { + + return data.$force_encoding(utf8).$slice(1, data.$length()); + }; return nil; })() + } else if (data.$encoding()['$=='](utf8)) { + } else { + data = data.$force_encoding(utf8) + }; + } else if (leading_bytes['$==']($$($nesting, 'BOM_BYTES_UTF_8'))) { + data = data.$slice(3, data.$length())}; + return $send(data.$each_line(), 'map', [], (TMP_9 = function(line){var self = TMP_9.$$s || this; + + + + if (line == null) { + line = nil; + }; + return line.$rstrip();}, TMP_9.$$s = self, TMP_9.$$arity = 1, TMP_9)); + }, TMP_Helpers_normalize_lines_from_string_8.$$arity = 1); + Opal.defs(self, '$uriish?', TMP_Helpers_uriish$q_10 = function(str) { + var $a, self = this; + + return ($truthy($a = str['$include?'](":")) ? $$($nesting, 'UriSniffRx')['$match?'](str) : $a) + }, TMP_Helpers_uriish$q_10.$$arity = 1); + Opal.defs(self, '$uri_prefix', TMP_Helpers_uri_prefix_11 = function $$uri_prefix(str) { + var $a, self = this; + + if ($truthy(($truthy($a = str['$include?'](":")) ? $$($nesting, 'UriSniffRx')['$=~'](str) : $a))) { + return (($a = $gvars['~']) === nil ? nil : $a['$[]'](0)) + } else { + return nil + } + }, TMP_Helpers_uri_prefix_11.$$arity = 1); + Opal.const_set($nesting[0], 'REGEXP_ENCODE_URI_CHARS', /[^\w\-.!~*';:@=+$,()\[\]]/); + Opal.defs(self, '$uri_encode', TMP_Helpers_uri_encode_12 = function $$uri_encode(str) { + var TMP_13, self = this; + + return $send(str, 'gsub', [$$($nesting, 'REGEXP_ENCODE_URI_CHARS')], (TMP_13 = function(){var self = TMP_13.$$s || this, $a, TMP_14; + + return $send((($a = $gvars['~']) === nil ? nil : $a['$[]'](0)).$each_byte(), 'map', [], (TMP_14 = function(c){var self = TMP_14.$$s || this; + + + + if (c == null) { + c = nil; + }; + return self.$sprintf("%%%02X", c);}, TMP_14.$$s = self, TMP_14.$$arity = 1, TMP_14)).$join()}, TMP_13.$$s = self, TMP_13.$$arity = 0, TMP_13)) + }, TMP_Helpers_uri_encode_12.$$arity = 1); + Opal.defs(self, '$rootname', TMP_Helpers_rootname_15 = function $$rootname(filename) { + var $a, self = this; + + return filename.$slice(0, ($truthy($a = filename.$rindex(".")) ? $a : filename.$length())) + }, TMP_Helpers_rootname_15.$$arity = 1); + Opal.defs(self, '$basename', TMP_Helpers_basename_16 = function $$basename(filename, drop_ext) { + var self = this; + + + + if (drop_ext == null) { + drop_ext = nil; + }; + if ($truthy(drop_ext)) { + return $$$('::', 'File').$basename(filename, (function() {if (drop_ext['$=='](true)) { + + return $$$('::', 'File').$extname(filename); + } else { + return drop_ext + }; return nil; })()) + } else { + return $$$('::', 'File').$basename(filename) + }; + }, TMP_Helpers_basename_16.$$arity = -2); + Opal.defs(self, '$mkdir_p', TMP_Helpers_mkdir_p_17 = function $$mkdir_p(dir) { + var self = this, parent_dir = nil; + + if ($truthy($$$('::', 'File')['$directory?'](dir))) { + return nil + } else { + + if ((parent_dir = $$$('::', 'File').$dirname(dir))['$=='](".")) { + } else { + self.$mkdir_p(parent_dir) + }; + + try { + return $$$('::', 'Dir').$mkdir(dir) + } catch ($err) { + if (Opal.rescue($err, [$$$('::', 'SystemCallError')])) { + try { + if ($truthy($$$('::', 'File')['$directory?'](dir))) { + return nil + } else { + return self.$raise() + } + } finally { Opal.pop_exception() } + } else { throw $err; } + };; + } + }, TMP_Helpers_mkdir_p_17.$$arity = 1); + Opal.const_set($nesting[0], 'ROMAN_NUMERALS', $hash2(["M", "CM", "D", "CD", "C", "XC", "L", "XL", "X", "IX", "V", "IV", "I"], {"M": 1000, "CM": 900, "D": 500, "CD": 400, "C": 100, "XC": 90, "L": 50, "XL": 40, "X": 10, "IX": 9, "V": 5, "IV": 4, "I": 1})); + Opal.defs(self, '$int_to_roman', TMP_Helpers_int_to_roman_18 = function $$int_to_roman(val) { + var TMP_19, self = this; + + return $send($$($nesting, 'ROMAN_NUMERALS'), 'map', [], (TMP_19 = function(l, i){var self = TMP_19.$$s || this, $a, $b, repeat = nil; + + + + if (l == null) { + l = nil; + }; + + if (i == null) { + i = nil; + }; + $b = val.$divmod(i), $a = Opal.to_ary($b), (repeat = ($a[0] == null ? nil : $a[0])), (val = ($a[1] == null ? nil : $a[1])), $b; + return $rb_times(l, repeat);}, TMP_19.$$s = self, TMP_19.$$arity = 2, TMP_19)).$join() + }, TMP_Helpers_int_to_roman_18.$$arity = 1); + })($nesting[0], $nesting) + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/substitutors"] = function(Opal) { + function $rb_plus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); + } + function $rb_gt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); + } + function $rb_times(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs * rhs : lhs['$*'](rhs); + } + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + function $rb_lt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $hash2 = Opal.hash2, $hash = Opal.hash, $truthy = Opal.truthy, $send = Opal.send, $gvars = Opal.gvars; + + Opal.add_stubs(['$freeze', '$+', '$keys', '$chr', '$attr_reader', '$empty?', '$!', '$===', '$[]', '$join', '$include?', '$extract_passthroughs', '$each', '$sub_specialchars', '$sub_quotes', '$sub_attributes', '$sub_replacements', '$sub_macros', '$highlight_source', '$sub_callouts', '$sub_post_replacements', '$warn', '$logger', '$restore_passthroughs', '$split', '$apply_subs', '$compat_mode', '$gsub', '$==', '$length', '$>', '$*', '$-', '$end_with?', '$slice', '$parse_quoted_text_attributes', '$size', '$[]=', '$unescape_brackets', '$resolve_pass_subs', '$start_with?', '$extract_inner_passthrough', '$to_sym', '$attributes', '$basebackend?', '$=~', '$to_i', '$convert', '$new', '$clear', '$match?', '$convert_quoted_text', '$do_replacement', '$sub', '$shift', '$store_attribute', '$!=', '$attribute_undefined', '$counter', '$key?', '$downcase', '$attribute_missing', '$tr_s', '$delete', '$reject', '$strip', '$index', '$min', '$compact', '$map', '$chop', '$unescape_bracketed_text', '$pop', '$rstrip', '$extensions', '$inline_macros?', '$inline_macros', '$regexp', '$instance', '$names', '$config', '$dup', '$nil_or_empty?', '$parse_attributes', '$process_method', '$register', '$tr', '$basename', '$split_simple_csv', '$normalize_string', '$!~', '$parse', '$uri_encode', '$sub_inline_xrefs', '$sub_inline_anchors', '$find', '$footnotes', '$id', '$text', '$style', '$lstrip', '$parse_into', '$extname', '$catalog', '$fetch', '$outfilesuffix', '$natural_xrefs', '$key', '$attr?', '$attr', '$to_s', '$read_next_id', '$callouts', '$<', '$<<', '$shorthand_property_syntax', '$concat', '$each_char', '$drop', '$&', '$resolve_subs', '$nil?', '$require_library', '$sub_source', '$resolve_lines_to_highlight', '$highlight', '$find_by_alias', '$find_by_mimetype', '$name', '$option?', '$count', '$to_a', '$uniq', '$sort', '$resolve_block_subs']); + return (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + (function($base, $parent_nesting) { + function $Substitutors() {}; + var self = $Substitutors = $module($base, 'Substitutors', $Substitutors); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Substitutors_apply_subs_1, TMP_Substitutors_apply_normal_subs_3, TMP_Substitutors_apply_title_subs_4, TMP_Substitutors_apply_reftext_subs_5, TMP_Substitutors_apply_header_subs_6, TMP_Substitutors_extract_passthroughs_7, TMP_Substitutors_extract_inner_passthrough_11, TMP_Substitutors_restore_passthroughs_12, TMP_Substitutors_sub_quotes_14, TMP_Substitutors_sub_replacements_17, TMP_Substitutors_sub_specialchars_20, TMP_Substitutors_sub_specialchars_21, TMP_Substitutors_do_replacement_23, TMP_Substitutors_sub_attributes_24, TMP_Substitutors_sub_macros_29, TMP_Substitutors_sub_inline_anchors_46, TMP_Substitutors_sub_inline_xrefs_49, TMP_Substitutors_sub_callouts_51, TMP_Substitutors_sub_post_replacements_53, TMP_Substitutors_convert_quoted_text_56, TMP_Substitutors_parse_quoted_text_attributes_57, TMP_Substitutors_parse_attributes_58, TMP_Substitutors_expand_subs_59, TMP_Substitutors_unescape_bracketed_text_61, TMP_Substitutors_normalize_string_62, TMP_Substitutors_unescape_brackets_63, TMP_Substitutors_split_simple_csv_64, TMP_Substitutors_resolve_subs_67, TMP_Substitutors_resolve_block_subs_69, TMP_Substitutors_resolve_pass_subs_70, TMP_Substitutors_highlight_source_71, TMP_Substitutors_resolve_lines_to_highlight_76, TMP_Substitutors_sub_source_78, TMP_Substitutors_lock_in_subs_79; + + + Opal.const_set($nesting[0], 'SpecialCharsRx', /[<&>]/); + Opal.const_set($nesting[0], 'SpecialCharsTr', $hash2([">", "<", "&"], {">": ">", "<": "<", "&": "&"})); + Opal.const_set($nesting[0], 'QuotedTextSniffRx', $hash(false, /[*_`#^~]/, true, /[*'_+#^~]/)); + Opal.const_set($nesting[0], 'BASIC_SUBS', ["specialcharacters"]).$freeze(); + Opal.const_set($nesting[0], 'HEADER_SUBS', ["specialcharacters", "attributes"]).$freeze(); + Opal.const_set($nesting[0], 'NORMAL_SUBS', ["specialcharacters", "quotes", "attributes", "replacements", "macros", "post_replacements"]).$freeze(); + Opal.const_set($nesting[0], 'NONE_SUBS', []).$freeze(); + Opal.const_set($nesting[0], 'TITLE_SUBS', ["specialcharacters", "quotes", "replacements", "macros", "attributes", "post_replacements"]).$freeze(); + Opal.const_set($nesting[0], 'REFTEXT_SUBS', ["specialcharacters", "quotes", "replacements"]).$freeze(); + Opal.const_set($nesting[0], 'VERBATIM_SUBS', ["specialcharacters", "callouts"]).$freeze(); + Opal.const_set($nesting[0], 'SUB_GROUPS', $hash2(["none", "normal", "verbatim", "specialchars"], {"none": $$($nesting, 'NONE_SUBS'), "normal": $$($nesting, 'NORMAL_SUBS'), "verbatim": $$($nesting, 'VERBATIM_SUBS'), "specialchars": $$($nesting, 'BASIC_SUBS')})); + Opal.const_set($nesting[0], 'SUB_HINTS', $hash2(["a", "m", "n", "p", "q", "r", "c", "v"], {"a": "attributes", "m": "macros", "n": "normal", "p": "post_replacements", "q": "quotes", "r": "replacements", "c": "specialcharacters", "v": "verbatim"})); + Opal.const_set($nesting[0], 'SUB_OPTIONS', $hash2(["block", "inline"], {"block": $rb_plus($rb_plus($$($nesting, 'SUB_GROUPS').$keys(), $$($nesting, 'NORMAL_SUBS')), ["callouts"]), "inline": $rb_plus($$($nesting, 'SUB_GROUPS').$keys(), $$($nesting, 'NORMAL_SUBS'))})); + Opal.const_set($nesting[0], 'SUB_HIGHLIGHT', ["coderay", "pygments"]); + if ($truthy($$$('::', 'RUBY_MIN_VERSION_1_9'))) { + + Opal.const_set($nesting[0], 'CAN', "\u0018"); + Opal.const_set($nesting[0], 'DEL', "\u007F"); + Opal.const_set($nesting[0], 'PASS_START', "\u0096"); + Opal.const_set($nesting[0], 'PASS_END', "\u0097"); + } else { + + Opal.const_set($nesting[0], 'CAN', (24).$chr()); + Opal.const_set($nesting[0], 'DEL', (127).$chr()); + Opal.const_set($nesting[0], 'PASS_START', (150).$chr()); + Opal.const_set($nesting[0], 'PASS_END', (151).$chr()); + }; + Opal.const_set($nesting[0], 'PassSlotRx', new RegExp("" + ($$($nesting, 'PASS_START')) + "(\\d+)" + ($$($nesting, 'PASS_END')))); + Opal.const_set($nesting[0], 'HighlightedPassSlotRx', new RegExp("" + "]*>" + ($$($nesting, 'PASS_START')) + "[^\\d]*(\\d+)[^\\d]*]*>" + ($$($nesting, 'PASS_END')) + "")); + Opal.const_set($nesting[0], 'RS', "\\"); + Opal.const_set($nesting[0], 'R_SB', "]"); + Opal.const_set($nesting[0], 'ESC_R_SB', "\\]"); + Opal.const_set($nesting[0], 'PLUS', "+"); + Opal.const_set($nesting[0], 'PygmentsWrapperDivRx', /
(.*)<\/div>/m); + Opal.const_set($nesting[0], 'PygmentsWrapperPreRx', /]*?>(.*?)<\/pre>\s*/m); + self.$attr_reader("passthroughs"); + + Opal.def(self, '$apply_subs', TMP_Substitutors_apply_subs_1 = function $$apply_subs(text, subs) { + var $a, TMP_2, self = this, multiline = nil, has_passthroughs = nil; + if (self.passthroughs == null) self.passthroughs = nil; + + + + if (subs == null) { + subs = $$($nesting, 'NORMAL_SUBS'); + }; + if ($truthy(($truthy($a = text['$empty?']()) ? $a : subs['$!']()))) { + return text}; + if ($truthy((multiline = $$$('::', 'Array')['$==='](text)))) { + text = (function() {if ($truthy(text['$[]'](1))) { + + return text.$join($$($nesting, 'LF')); + } else { + return text['$[]'](0) + }; return nil; })()}; + if ($truthy((has_passthroughs = subs['$include?']("macros")))) { + + text = self.$extract_passthroughs(text); + if ($truthy(self.passthroughs['$empty?']())) { + has_passthroughs = false};}; + $send(subs, 'each', [], (TMP_2 = function(type){var self = TMP_2.$$s || this, $case = nil; + + + + if (type == null) { + type = nil; + }; + return (function() {$case = type; + if ("specialcharacters"['$===']($case)) {return (text = self.$sub_specialchars(text))} + else if ("quotes"['$===']($case)) {return (text = self.$sub_quotes(text))} + else if ("attributes"['$===']($case)) {if ($truthy(text['$include?']($$($nesting, 'ATTR_REF_HEAD')))) { + return (text = self.$sub_attributes(text)) + } else { + return nil + }} + else if ("replacements"['$===']($case)) {return (text = self.$sub_replacements(text))} + else if ("macros"['$===']($case)) {return (text = self.$sub_macros(text))} + else if ("highlight"['$===']($case)) {return (text = self.$highlight_source(text, subs['$include?']("callouts")))} + else if ("callouts"['$===']($case)) {if ($truthy(subs['$include?']("highlight"))) { + return nil + } else { + return (text = self.$sub_callouts(text)) + }} + else if ("post_replacements"['$===']($case)) {return (text = self.$sub_post_replacements(text))} + else {return self.$logger().$warn("" + "unknown substitution type " + (type))}})();}, TMP_2.$$s = self, TMP_2.$$arity = 1, TMP_2)); + if ($truthy(has_passthroughs)) { + text = self.$restore_passthroughs(text)}; + if ($truthy(multiline)) { + + return text.$split($$($nesting, 'LF'), -1); + } else { + return text + }; + }, TMP_Substitutors_apply_subs_1.$$arity = -2); + + Opal.def(self, '$apply_normal_subs', TMP_Substitutors_apply_normal_subs_3 = function $$apply_normal_subs(text) { + var self = this; + + return self.$apply_subs(text) + }, TMP_Substitutors_apply_normal_subs_3.$$arity = 1); + + Opal.def(self, '$apply_title_subs', TMP_Substitutors_apply_title_subs_4 = function $$apply_title_subs(title) { + var self = this; + + return self.$apply_subs(title, $$($nesting, 'TITLE_SUBS')) + }, TMP_Substitutors_apply_title_subs_4.$$arity = 1); + + Opal.def(self, '$apply_reftext_subs', TMP_Substitutors_apply_reftext_subs_5 = function $$apply_reftext_subs(text) { + var self = this; + + return self.$apply_subs(text, $$($nesting, 'REFTEXT_SUBS')) + }, TMP_Substitutors_apply_reftext_subs_5.$$arity = 1); + + Opal.def(self, '$apply_header_subs', TMP_Substitutors_apply_header_subs_6 = function $$apply_header_subs(text) { + var self = this; + + return self.$apply_subs(text, $$($nesting, 'HEADER_SUBS')) + }, TMP_Substitutors_apply_header_subs_6.$$arity = 1); + + Opal.def(self, '$extract_passthroughs', TMP_Substitutors_extract_passthroughs_7 = function $$extract_passthroughs(text) { + var $a, $b, TMP_8, TMP_9, TMP_10, self = this, compat_mode = nil, passes = nil, pass_inline_char1 = nil, pass_inline_char2 = nil, pass_inline_rx = nil; + if (self.document == null) self.document = nil; + if (self.passthroughs == null) self.passthroughs = nil; + + + compat_mode = self.document.$compat_mode(); + passes = self.passthroughs; + if ($truthy(($truthy($a = ($truthy($b = text['$include?']("++")) ? $b : text['$include?']("$$"))) ? $a : text['$include?']("ss:")))) { + text = $send(text, 'gsub', [$$($nesting, 'InlinePassMacroRx')], (TMP_8 = function(){var self = TMP_8.$$s || this, $c, m = nil, preceding = nil, boundary = nil, attributes = nil, escape_count = nil, content = nil, old_behavior = nil, subs = nil, pass_key = nil, $writer = nil; + if ($gvars["~"] == null) $gvars["~"] = nil; + + + m = $gvars["~"]; + preceding = nil; + if ($truthy((boundary = m['$[]'](4)))) { + + if ($truthy(($truthy($c = compat_mode) ? boundary['$==']("++") : $c))) { + return (function() {if ($truthy(m['$[]'](2))) { + return "" + (m['$[]'](1)) + "[" + (m['$[]'](2)) + "]" + (m['$[]'](3)) + "++" + (self.$extract_passthroughs(m['$[]'](5))) + "++" + } else { + return "" + (m['$[]'](1)) + (m['$[]'](3)) + "++" + (self.$extract_passthroughs(m['$[]'](5))) + "++" + }; return nil; })();}; + attributes = m['$[]'](2); + escape_count = m['$[]'](3).$length(); + content = m['$[]'](5); + old_behavior = false; + if ($truthy(attributes)) { + if ($truthy($rb_gt(escape_count, 0))) { + return "" + (m['$[]'](1)) + "[" + (attributes) + "]" + ($rb_times($$($nesting, 'RS'), $rb_minus(escape_count, 1))) + (boundary) + (m['$[]'](5)) + (boundary); + } else if (m['$[]'](1)['$==']($$($nesting, 'RS'))) { + + preceding = "" + "[" + (attributes) + "]"; + attributes = nil; + } else { + + if ($truthy((($c = boundary['$==']("++")) ? attributes['$end_with?']("x-") : boundary['$==']("++")))) { + + old_behavior = true; + attributes = attributes.$slice(0, $rb_minus(attributes.$length(), 2));}; + attributes = self.$parse_quoted_text_attributes(attributes); + } + } else if ($truthy($rb_gt(escape_count, 0))) { + return "" + ($rb_times($$($nesting, 'RS'), $rb_minus(escape_count, 1))) + (boundary) + (m['$[]'](5)) + (boundary);}; + subs = (function() {if (boundary['$==']("+++")) { + return [] + } else { + return $$($nesting, 'BASIC_SUBS') + }; return nil; })(); + pass_key = passes.$size(); + if ($truthy(attributes)) { + if ($truthy(old_behavior)) { + + $writer = [pass_key, $hash2(["text", "subs", "type", "attributes"], {"text": content, "subs": $$($nesting, 'NORMAL_SUBS'), "type": "monospaced", "attributes": attributes})]; + $send(passes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + } else { + + $writer = [pass_key, $hash2(["text", "subs", "type", "attributes"], {"text": content, "subs": subs, "type": "unquoted", "attributes": attributes})]; + $send(passes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + } + } else { + + $writer = [pass_key, $hash2(["text", "subs"], {"text": content, "subs": subs})]; + $send(passes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + } else { + + if (m['$[]'](6)['$==']($$($nesting, 'RS'))) { + return m['$[]'](0).$slice(1, m['$[]'](0).$length());}; + + $writer = [(pass_key = passes.$size()), $hash2(["text", "subs"], {"text": self.$unescape_brackets(m['$[]'](8)), "subs": (function() {if ($truthy(m['$[]'](7))) { + + return self.$resolve_pass_subs(m['$[]'](7)); + } else { + return nil + }; return nil; })()})]; + $send(passes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + }; + return "" + (preceding) + ($$($nesting, 'PASS_START')) + (pass_key) + ($$($nesting, 'PASS_END'));}, TMP_8.$$s = self, TMP_8.$$arity = 0, TMP_8))}; + $b = $$($nesting, 'InlinePassRx')['$[]'](compat_mode), $a = Opal.to_ary($b), (pass_inline_char1 = ($a[0] == null ? nil : $a[0])), (pass_inline_char2 = ($a[1] == null ? nil : $a[1])), (pass_inline_rx = ($a[2] == null ? nil : $a[2])), $b; + if ($truthy(($truthy($a = text['$include?'](pass_inline_char1)) ? $a : ($truthy($b = pass_inline_char2) ? text['$include?'](pass_inline_char2) : $b)))) { + text = $send(text, 'gsub', [pass_inline_rx], (TMP_9 = function(){var self = TMP_9.$$s || this, $c, m = nil, preceding = nil, attributes = nil, quoted_text = nil, escape_mark = nil, format_mark = nil, content = nil, old_behavior = nil, pass_key = nil, $writer = nil, subs = nil; + if ($gvars["~"] == null) $gvars["~"] = nil; + + + m = $gvars["~"]; + preceding = m['$[]'](1); + attributes = m['$[]'](2); + if ($truthy((quoted_text = m['$[]'](3))['$start_with?']($$($nesting, 'RS')))) { + escape_mark = $$($nesting, 'RS')}; + format_mark = m['$[]'](4); + content = m['$[]'](5); + if ($truthy(compat_mode)) { + old_behavior = true + } else if ($truthy((old_behavior = ($truthy($c = attributes) ? attributes['$end_with?']("x-") : $c)))) { + attributes = attributes.$slice(0, $rb_minus(attributes.$length(), 2))}; + if ($truthy(attributes)) { + + if ($truthy((($c = format_mark['$==']("`")) ? old_behavior['$!']() : format_mark['$==']("`")))) { + return self.$extract_inner_passthrough(content, "" + (preceding) + "[" + (attributes) + "]" + (escape_mark), attributes);}; + if ($truthy(escape_mark)) { + return "" + (preceding) + "[" + (attributes) + "]" + (quoted_text.$slice(1, quoted_text.$length())); + } else if (preceding['$==']($$($nesting, 'RS'))) { + + preceding = "" + "[" + (attributes) + "]"; + attributes = nil; + } else { + attributes = self.$parse_quoted_text_attributes(attributes) + }; + } else if ($truthy((($c = format_mark['$==']("`")) ? old_behavior['$!']() : format_mark['$==']("`")))) { + return self.$extract_inner_passthrough(content, "" + (preceding) + (escape_mark)); + } else if ($truthy(escape_mark)) { + return "" + (preceding) + (quoted_text.$slice(1, quoted_text.$length()));}; + pass_key = passes.$size(); + if ($truthy(compat_mode)) { + + $writer = [pass_key, $hash2(["text", "subs", "attributes", "type"], {"text": content, "subs": $$($nesting, 'BASIC_SUBS'), "attributes": attributes, "type": "monospaced"})]; + $send(passes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + } else if ($truthy(attributes)) { + if ($truthy(old_behavior)) { + + subs = (function() {if (format_mark['$==']("`")) { + return $$($nesting, 'BASIC_SUBS') + } else { + return $$($nesting, 'NORMAL_SUBS') + }; return nil; })(); + + $writer = [pass_key, $hash2(["text", "subs", "attributes", "type"], {"text": content, "subs": subs, "attributes": attributes, "type": "monospaced"})]; + $send(passes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + } else { + + $writer = [pass_key, $hash2(["text", "subs", "attributes", "type"], {"text": content, "subs": $$($nesting, 'BASIC_SUBS'), "attributes": attributes, "type": "unquoted"})]; + $send(passes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + } + } else { + + $writer = [pass_key, $hash2(["text", "subs"], {"text": content, "subs": $$($nesting, 'BASIC_SUBS')})]; + $send(passes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + return "" + (preceding) + ($$($nesting, 'PASS_START')) + (pass_key) + ($$($nesting, 'PASS_END'));}, TMP_9.$$s = self, TMP_9.$$arity = 0, TMP_9))}; + if ($truthy(($truthy($a = text['$include?'](":")) ? ($truthy($b = text['$include?']("stem:")) ? $b : text['$include?']("math:")) : $a))) { + text = $send(text, 'gsub', [$$($nesting, 'InlineStemMacroRx')], (TMP_10 = function(){var self = TMP_10.$$s || this, $c, m = nil, type = nil, content = nil, subs = nil, $writer = nil, pass_key = nil; + if (self.document == null) self.document = nil; + if ($gvars["~"] == null) $gvars["~"] = nil; + + + m = $gvars["~"]; + if ($truthy((($c = $gvars['~']) === nil ? nil : $c['$[]'](0))['$start_with?']($$($nesting, 'RS')))) { + return m['$[]'](0).$slice(1, m['$[]'](0).$length());}; + if ((type = m['$[]'](1).$to_sym())['$==']("stem")) { + type = $$($nesting, 'STEM_TYPE_ALIASES')['$[]'](self.document.$attributes()['$[]']("stem")).$to_sym()}; + content = self.$unescape_brackets(m['$[]'](3)); + subs = (function() {if ($truthy(m['$[]'](2))) { + + return self.$resolve_pass_subs(m['$[]'](2)); + } else { + + if ($truthy(self.document['$basebackend?']("html"))) { + return $$($nesting, 'BASIC_SUBS') + } else { + return nil + }; + }; return nil; })(); + + $writer = [(pass_key = passes.$size()), $hash2(["text", "subs", "type"], {"text": content, "subs": subs, "type": type})]; + $send(passes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + return "" + ($$($nesting, 'PASS_START')) + (pass_key) + ($$($nesting, 'PASS_END'));}, TMP_10.$$s = self, TMP_10.$$arity = 0, TMP_10))}; + return text; + }, TMP_Substitutors_extract_passthroughs_7.$$arity = 1); + + Opal.def(self, '$extract_inner_passthrough', TMP_Substitutors_extract_inner_passthrough_11 = function $$extract_inner_passthrough(text, pre, attributes) { + var $a, $b, self = this, $writer = nil, pass_key = nil; + if (self.passthroughs == null) self.passthroughs = nil; + + + + if (attributes == null) { + attributes = nil; + }; + if ($truthy(($truthy($a = ($truthy($b = text['$end_with?']("+")) ? text['$start_with?']("+", "\\+") : $b)) ? $$($nesting, 'SinglePlusInlinePassRx')['$=~'](text) : $a))) { + if ($truthy((($a = $gvars['~']) === nil ? nil : $a['$[]'](1)))) { + return "" + (pre) + "`+" + ((($a = $gvars['~']) === nil ? nil : $a['$[]'](2))) + "+`" + } else { + + + $writer = [(pass_key = self.passthroughs.$size()), (function() {if ($truthy(attributes)) { + return $hash2(["text", "subs", "attributes", "type"], {"text": (($a = $gvars['~']) === nil ? nil : $a['$[]'](2)), "subs": $$($nesting, 'BASIC_SUBS'), "attributes": attributes, "type": "unquoted"}) + } else { + return $hash2(["text", "subs"], {"text": (($a = $gvars['~']) === nil ? nil : $a['$[]'](2)), "subs": $$($nesting, 'BASIC_SUBS')}) + }; return nil; })()]; + $send(self.passthroughs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + return "" + (pre) + "`" + ($$($nesting, 'PASS_START')) + (pass_key) + ($$($nesting, 'PASS_END')) + "`"; + } + } else { + return "" + (pre) + "`" + (text) + "`" + }; + }, TMP_Substitutors_extract_inner_passthrough_11.$$arity = -3); + + Opal.def(self, '$restore_passthroughs', TMP_Substitutors_restore_passthroughs_12 = function $$restore_passthroughs(text, outer) { + var TMP_13, self = this, passes = nil; + if (self.passthroughs == null) self.passthroughs = nil; + + + + if (outer == null) { + outer = true; + }; + return (function() { try { + + passes = self.passthroughs; + return $send(text, 'gsub', [$$($nesting, 'PassSlotRx')], (TMP_13 = function(){var self = TMP_13.$$s || this, $a, pass = nil, subbed_text = nil, type = nil; + + + pass = passes['$[]']((($a = $gvars['~']) === nil ? nil : $a['$[]'](1)).$to_i()); + subbed_text = self.$apply_subs(pass['$[]']("text"), pass['$[]']("subs")); + if ($truthy((type = pass['$[]']("type")))) { + subbed_text = $$($nesting, 'Inline').$new(self, "quoted", subbed_text, $hash2(["type", "attributes"], {"type": type, "attributes": pass['$[]']("attributes")})).$convert()}; + if ($truthy(subbed_text['$include?']($$($nesting, 'PASS_START')))) { + return self.$restore_passthroughs(subbed_text, false) + } else { + return subbed_text + };}, TMP_13.$$s = self, TMP_13.$$arity = 0, TMP_13)); + } finally { + (function() {if ($truthy(outer)) { + return passes.$clear() + } else { + return nil + }; return nil; })() + }; })(); + }, TMP_Substitutors_restore_passthroughs_12.$$arity = -2); + if ($$($nesting, 'RUBY_ENGINE')['$==']("opal")) { + + + Opal.def(self, '$sub_quotes', TMP_Substitutors_sub_quotes_14 = function $$sub_quotes(text) { + var TMP_15, self = this, compat = nil; + if (self.document == null) self.document = nil; + + + if ($truthy($$($nesting, 'QuotedTextSniffRx')['$[]']((compat = self.document.$compat_mode()))['$match?'](text))) { + $send($$($nesting, 'QUOTE_SUBS')['$[]'](compat), 'each', [], (TMP_15 = function(type, scope, pattern){var self = TMP_15.$$s || this, TMP_16; + + + + if (type == null) { + type = nil; + }; + + if (scope == null) { + scope = nil; + }; + + if (pattern == null) { + pattern = nil; + }; + return (text = $send(text, 'gsub', [pattern], (TMP_16 = function(){var self = TMP_16.$$s || this; + if ($gvars["~"] == null) $gvars["~"] = nil; + + return self.$convert_quoted_text($gvars["~"], type, scope)}, TMP_16.$$s = self, TMP_16.$$arity = 0, TMP_16)));}, TMP_15.$$s = self, TMP_15.$$arity = 3, TMP_15))}; + return text; + }, TMP_Substitutors_sub_quotes_14.$$arity = 1); + + Opal.def(self, '$sub_replacements', TMP_Substitutors_sub_replacements_17 = function $$sub_replacements(text) { + var TMP_18, self = this; + + + if ($truthy($$($nesting, 'ReplaceableTextRx')['$match?'](text))) { + $send($$($nesting, 'REPLACEMENTS'), 'each', [], (TMP_18 = function(pattern, replacement, restore){var self = TMP_18.$$s || this, TMP_19; + + + + if (pattern == null) { + pattern = nil; + }; + + if (replacement == null) { + replacement = nil; + }; + + if (restore == null) { + restore = nil; + }; + return (text = $send(text, 'gsub', [pattern], (TMP_19 = function(){var self = TMP_19.$$s || this; + if ($gvars["~"] == null) $gvars["~"] = nil; + + return self.$do_replacement($gvars["~"], replacement, restore)}, TMP_19.$$s = self, TMP_19.$$arity = 0, TMP_19)));}, TMP_18.$$s = self, TMP_18.$$arity = 3, TMP_18))}; + return text; + }, TMP_Substitutors_sub_replacements_17.$$arity = 1); + } else { + nil + }; + if ($truthy($$$('::', 'RUBY_MIN_VERSION_1_9'))) { + + Opal.def(self, '$sub_specialchars', TMP_Substitutors_sub_specialchars_20 = function $$sub_specialchars(text) { + var $a, $b, self = this; + + if ($truthy(($truthy($a = ($truthy($b = text['$include?']("<")) ? $b : text['$include?']("&"))) ? $a : text['$include?'](">")))) { + + return text.$gsub($$($nesting, 'SpecialCharsRx'), $$($nesting, 'SpecialCharsTr')); + } else { + return text + } + }, TMP_Substitutors_sub_specialchars_20.$$arity = 1) + } else { + + Opal.def(self, '$sub_specialchars', TMP_Substitutors_sub_specialchars_21 = function $$sub_specialchars(text) { + var $a, $b, TMP_22, self = this; + + if ($truthy(($truthy($a = ($truthy($b = text['$include?']("<")) ? $b : text['$include?']("&"))) ? $a : text['$include?'](">")))) { + + return $send(text, 'gsub', [$$($nesting, 'SpecialCharsRx')], (TMP_22 = function(){var self = TMP_22.$$s || this, $c; + + return $$($nesting, 'SpecialCharsTr')['$[]']((($c = $gvars['~']) === nil ? nil : $c['$[]'](0)))}, TMP_22.$$s = self, TMP_22.$$arity = 0, TMP_22)); + } else { + return text + } + }, TMP_Substitutors_sub_specialchars_21.$$arity = 1) + }; + Opal.alias(self, "sub_specialcharacters", "sub_specialchars"); + + Opal.def(self, '$do_replacement', TMP_Substitutors_do_replacement_23 = function $$do_replacement(m, replacement, restore) { + var self = this, captured = nil, $case = nil; + + if ($truthy((captured = m['$[]'](0))['$include?']($$($nesting, 'RS')))) { + return captured.$sub($$($nesting, 'RS'), "") + } else { + return (function() {$case = restore; + if ("none"['$===']($case)) {return replacement} + else if ("bounding"['$===']($case)) {return "" + (m['$[]'](1)) + (replacement) + (m['$[]'](2))} + else {return "" + (m['$[]'](1)) + (replacement)}})() + } + }, TMP_Substitutors_do_replacement_23.$$arity = 3); + + Opal.def(self, '$sub_attributes', TMP_Substitutors_sub_attributes_24 = function $$sub_attributes(text, opts) { + var TMP_25, TMP_26, TMP_27, TMP_28, self = this, doc_attrs = nil, drop = nil, drop_line = nil, drop_empty_line = nil, attribute_undefined = nil, attribute_missing = nil, lines = nil; + if (self.document == null) self.document = nil; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + doc_attrs = self.document.$attributes(); + drop = (drop_line = (drop_empty_line = (attribute_undefined = (attribute_missing = nil)))); + text = $send(text, 'gsub', [$$($nesting, 'AttributeReferenceRx')], (TMP_25 = function(){var self = TMP_25.$$s || this, $a, $b, $c, $case = nil, args = nil, _ = nil, value = nil, key = nil; + if (self.document == null) self.document = nil; + + if ($truthy(($truthy($a = (($b = $gvars['~']) === nil ? nil : $b['$[]'](1))['$==']($$($nesting, 'RS'))) ? $a : (($b = $gvars['~']) === nil ? nil : $b['$[]'](4))['$==']($$($nesting, 'RS'))))) { + return "" + "{" + ((($a = $gvars['~']) === nil ? nil : $a['$[]'](2))) + "}" + } else if ($truthy((($a = $gvars['~']) === nil ? nil : $a['$[]'](3)))) { + return (function() {$case = (args = (($a = $gvars['~']) === nil ? nil : $a['$[]'](2)).$split(":", 3)).$shift(); + if ("set"['$===']($case)) { + $b = $$($nesting, 'Parser').$store_attribute(args['$[]'](0), ($truthy($c = args['$[]'](1)) ? $c : ""), self.document), $a = Opal.to_ary($b), (_ = ($a[0] == null ? nil : $a[0])), (value = ($a[1] == null ? nil : $a[1])), $b; + if ($truthy(($truthy($a = value) ? $a : (attribute_undefined = ($truthy($b = attribute_undefined) ? $b : ($truthy($c = doc_attrs['$[]']("attribute-undefined")) ? $c : $$($nesting, 'Compliance').$attribute_undefined())))['$!=']("drop-line")))) { + return (drop = (drop_empty_line = $$($nesting, 'DEL'))) + } else { + return (drop = (drop_line = $$($nesting, 'CAN'))) + };} + else if ("counter2"['$===']($case)) { + $send(self.document, 'counter', Opal.to_a(args)); + return (drop = (drop_empty_line = $$($nesting, 'DEL')));} + else {return $send(self.document, 'counter', Opal.to_a(args))}})() + } else if ($truthy(doc_attrs['$key?']((key = (($a = $gvars['~']) === nil ? nil : $a['$[]'](2)).$downcase())))) { + return doc_attrs['$[]'](key) + } else if ($truthy((value = $$($nesting, 'INTRINSIC_ATTRIBUTES')['$[]'](key)))) { + return value + } else { + return (function() {$case = (attribute_missing = ($truthy($a = attribute_missing) ? $a : ($truthy($b = ($truthy($c = opts['$[]']("attribute_missing")) ? $c : doc_attrs['$[]']("attribute-missing"))) ? $b : $$($nesting, 'Compliance').$attribute_missing()))); + if ("drop"['$===']($case)) {return (drop = (drop_empty_line = $$($nesting, 'DEL')))} + else if ("drop-line"['$===']($case)) { + self.$logger().$warn("" + "dropping line containing reference to missing attribute: " + (key)); + return (drop = (drop_line = $$($nesting, 'CAN')));} + else if ("warn"['$===']($case)) { + self.$logger().$warn("" + "skipping reference to missing attribute: " + (key)); + return (($a = $gvars['~']) === nil ? nil : $a['$[]'](0));} + else {return (($a = $gvars['~']) === nil ? nil : $a['$[]'](0))}})() + }}, TMP_25.$$s = self, TMP_25.$$arity = 0, TMP_25)); + if ($truthy(drop)) { + if ($truthy(drop_empty_line)) { + + lines = text.$tr_s($$($nesting, 'DEL'), $$($nesting, 'DEL')).$split($$($nesting, 'LF'), -1); + if ($truthy(drop_line)) { + return $send(lines, 'reject', [], (TMP_26 = function(line){var self = TMP_26.$$s || this, $a, $b, $c; + + + + if (line == null) { + line = nil; + }; + return ($truthy($a = ($truthy($b = ($truthy($c = line['$==']($$($nesting, 'DEL'))) ? $c : line['$==']($$($nesting, 'CAN')))) ? $b : line['$start_with?']($$($nesting, 'CAN')))) ? $a : line['$include?']($$($nesting, 'CAN')));}, TMP_26.$$s = self, TMP_26.$$arity = 1, TMP_26)).$join($$($nesting, 'LF')).$delete($$($nesting, 'DEL')) + } else { + return $send(lines, 'reject', [], (TMP_27 = function(line){var self = TMP_27.$$s || this; + + + + if (line == null) { + line = nil; + }; + return line['$==']($$($nesting, 'DEL'));}, TMP_27.$$s = self, TMP_27.$$arity = 1, TMP_27)).$join($$($nesting, 'LF')).$delete($$($nesting, 'DEL')) + }; + } else if ($truthy(text['$include?']($$($nesting, 'LF')))) { + return $send(text.$split($$($nesting, 'LF'), -1), 'reject', [], (TMP_28 = function(line){var self = TMP_28.$$s || this, $a, $b; + + + + if (line == null) { + line = nil; + }; + return ($truthy($a = ($truthy($b = line['$==']($$($nesting, 'CAN'))) ? $b : line['$start_with?']($$($nesting, 'CAN')))) ? $a : line['$include?']($$($nesting, 'CAN')));}, TMP_28.$$s = self, TMP_28.$$arity = 1, TMP_28)).$join($$($nesting, 'LF')) + } else { + return "" + } + } else { + return text + }; + }, TMP_Substitutors_sub_attributes_24.$$arity = -2); + + Opal.def(self, '$sub_macros', TMP_Substitutors_sub_macros_29 = function $$sub_macros(text) {try { + + var $a, $b, TMP_30, TMP_33, TMP_35, TMP_37, TMP_39, TMP_40, TMP_41, TMP_42, TMP_43, TMP_44, self = this, found = nil, found_square_bracket = nil, $writer = nil, found_colon = nil, found_macroish = nil, found_macroish_short = nil, doc_attrs = nil, doc = nil, extensions = nil; + if (self.document == null) self.document = nil; + + + found = $hash2([], {}); + found_square_bracket = (($writer = ["square_bracket", text['$include?']("[")]), $send(found, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]); + found_colon = text['$include?'](":"); + found_macroish = (($writer = ["macroish", ($truthy($a = found_square_bracket) ? found_colon : $a)]), $send(found, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]); + found_macroish_short = ($truthy($a = found_macroish) ? text['$include?'](":[") : $a); + doc_attrs = (doc = self.document).$attributes(); + if ($truthy(doc_attrs['$key?']("experimental"))) { + + if ($truthy(($truthy($a = found_macroish_short) ? ($truthy($b = text['$include?']("kbd:")) ? $b : text['$include?']("btn:")) : $a))) { + text = $send(text, 'gsub', [$$($nesting, 'InlineKbdBtnMacroRx')], (TMP_30 = function(){var self = TMP_30.$$s || this, $c, TMP_31, TMP_32, keys = nil, delim_idx = nil, delim = nil; + + if ($truthy((($c = $gvars['~']) === nil ? nil : $c['$[]'](1)))) { + return (($c = $gvars['~']) === nil ? nil : $c['$[]'](0)).$slice(1, (($c = $gvars['~']) === nil ? nil : $c['$[]'](0)).$length()) + } else if ((($c = $gvars['~']) === nil ? nil : $c['$[]'](2))['$==']("kbd")) { + + if ($truthy((keys = (($c = $gvars['~']) === nil ? nil : $c['$[]'](3)).$strip())['$include?']($$($nesting, 'R_SB')))) { + keys = keys.$gsub($$($nesting, 'ESC_R_SB'), $$($nesting, 'R_SB'))}; + if ($truthy(($truthy($c = $rb_gt(keys.$length(), 1)) ? (delim_idx = (function() {if ($truthy((delim_idx = keys.$index(",", 1)))) { + return [delim_idx, keys.$index("+", 1)].$compact().$min() + } else { + + return keys.$index("+", 1); + }; return nil; })()) : $c))) { + + delim = keys.$slice(delim_idx, 1); + if ($truthy(keys['$end_with?'](delim))) { + + keys = $send(keys.$chop().$split(delim, -1), 'map', [], (TMP_31 = function(key){var self = TMP_31.$$s || this; + + + + if (key == null) { + key = nil; + }; + return key.$strip();}, TMP_31.$$s = self, TMP_31.$$arity = 1, TMP_31)); + + $writer = [-1, "" + (keys['$[]'](-1)) + (delim)]; + $send(keys, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + } else { + keys = $send(keys.$split(delim), 'map', [], (TMP_32 = function(key){var self = TMP_32.$$s || this; + + + + if (key == null) { + key = nil; + }; + return key.$strip();}, TMP_32.$$s = self, TMP_32.$$arity = 1, TMP_32)) + }; + } else { + keys = [keys] + }; + return $$($nesting, 'Inline').$new(self, "kbd", nil, $hash2(["attributes"], {"attributes": $hash2(["keys"], {"keys": keys})})).$convert(); + } else { + return $$($nesting, 'Inline').$new(self, "button", self.$unescape_bracketed_text((($c = $gvars['~']) === nil ? nil : $c['$[]'](3)))).$convert() + }}, TMP_30.$$s = self, TMP_30.$$arity = 0, TMP_30))}; + if ($truthy(($truthy($a = found_macroish) ? text['$include?']("menu:") : $a))) { + text = $send(text, 'gsub', [$$($nesting, 'InlineMenuMacroRx')], (TMP_33 = function(){var self = TMP_33.$$s || this, $c, TMP_34, m = nil, menu = nil, items = nil, delim = nil, submenus = nil, menuitem = nil; + if ($gvars["~"] == null) $gvars["~"] = nil; + + + m = $gvars["~"]; + if ($truthy((($c = $gvars['~']) === nil ? nil : $c['$[]'](0))['$start_with?']($$($nesting, 'RS')))) { + return m['$[]'](0).$slice(1, m['$[]'](0).$length());}; + $c = [m['$[]'](1), m['$[]'](2)], (menu = $c[0]), (items = $c[1]), $c; + if ($truthy(items)) { + + if ($truthy(items['$include?']($$($nesting, 'R_SB')))) { + items = items.$gsub($$($nesting, 'ESC_R_SB'), $$($nesting, 'R_SB'))}; + if ($truthy((delim = (function() {if ($truthy(items['$include?'](">"))) { + return ">" + } else { + + if ($truthy(items['$include?'](","))) { + return "," + } else { + return nil + }; + }; return nil; })()))) { + + submenus = $send(items.$split(delim), 'map', [], (TMP_34 = function(it){var self = TMP_34.$$s || this; + + + + if (it == null) { + it = nil; + }; + return it.$strip();}, TMP_34.$$s = self, TMP_34.$$arity = 1, TMP_34)); + menuitem = submenus.$pop(); + } else { + $c = [[], items.$rstrip()], (submenus = $c[0]), (menuitem = $c[1]), $c + }; + } else { + $c = [[], nil], (submenus = $c[0]), (menuitem = $c[1]), $c + }; + return $$($nesting, 'Inline').$new(self, "menu", nil, $hash2(["attributes"], {"attributes": $hash2(["menu", "submenus", "menuitem"], {"menu": menu, "submenus": submenus, "menuitem": menuitem})})).$convert();}, TMP_33.$$s = self, TMP_33.$$arity = 0, TMP_33))}; + if ($truthy(($truthy($a = text['$include?']("\"")) ? text['$include?'](">") : $a))) { + text = $send(text, 'gsub', [$$($nesting, 'InlineMenuRx')], (TMP_35 = function(){var self = TMP_35.$$s || this, $c, $d, TMP_36, m = nil, input = nil, menu = nil, submenus = nil, menuitem = nil; + if ($gvars["~"] == null) $gvars["~"] = nil; + + + m = $gvars["~"]; + if ($truthy((($c = $gvars['~']) === nil ? nil : $c['$[]'](0))['$start_with?']($$($nesting, 'RS')))) { + return m['$[]'](0).$slice(1, m['$[]'](0).$length());}; + input = m['$[]'](1); + $d = $send(input.$split(">"), 'map', [], (TMP_36 = function(it){var self = TMP_36.$$s || this; + + + + if (it == null) { + it = nil; + }; + return it.$strip();}, TMP_36.$$s = self, TMP_36.$$arity = 1, TMP_36)), $c = Opal.to_ary($d), (menu = ($c[0] == null ? nil : $c[0])), (submenus = $slice.call($c, 1)), $d; + menuitem = submenus.$pop(); + return $$($nesting, 'Inline').$new(self, "menu", nil, $hash2(["attributes"], {"attributes": $hash2(["menu", "submenus", "menuitem"], {"menu": menu, "submenus": submenus, "menuitem": menuitem})})).$convert();}, TMP_35.$$s = self, TMP_35.$$arity = 0, TMP_35))};}; + if ($truthy(($truthy($a = (extensions = doc.$extensions())) ? extensions['$inline_macros?']() : $a))) { + $send(extensions.$inline_macros(), 'each', [], (TMP_37 = function(extension){var self = TMP_37.$$s || this, TMP_38; + + + + if (extension == null) { + extension = nil; + }; + return (text = $send(text, 'gsub', [extension.$instance().$regexp()], (TMP_38 = function(){var self = TMP_38.$$s || this, $c, m = nil, target = nil, content = nil, extconf = nil, attributes = nil, replacement = nil; + if ($gvars["~"] == null) $gvars["~"] = nil; + + + m = $gvars["~"]; + if ($truthy((($c = $gvars['~']) === nil ? nil : $c['$[]'](0))['$start_with?']($$($nesting, 'RS')))) { + return m['$[]'](0).$slice(1, m['$[]'](0).$length());}; + if ($truthy((function() { try { + return m.$names() + } catch ($err) { + if (Opal.rescue($err, [$$($nesting, 'StandardError')])) { + try { + return [] + } finally { Opal.pop_exception() } + } else { throw $err; } + }})()['$empty?']())) { + $c = [m['$[]'](1), m['$[]'](2), extension.$config()], (target = $c[0]), (content = $c[1]), (extconf = $c[2]), $c + } else { + $c = [(function() { try { + return m['$[]']("target") + } catch ($err) { + if (Opal.rescue($err, [$$($nesting, 'StandardError')])) { + try { + return nil + } finally { Opal.pop_exception() } + } else { throw $err; } + }})(), (function() { try { + return m['$[]']("content") + } catch ($err) { + if (Opal.rescue($err, [$$($nesting, 'StandardError')])) { + try { + return nil + } finally { Opal.pop_exception() } + } else { throw $err; } + }})(), extension.$config()], (target = $c[0]), (content = $c[1]), (extconf = $c[2]), $c + }; + attributes = (function() {if ($truthy((attributes = extconf['$[]']("default_attrs")))) { + return attributes.$dup() + } else { + return $hash2([], {}) + }; return nil; })(); + if ($truthy(content['$nil_or_empty?']())) { + if ($truthy(($truthy($c = content) ? extconf['$[]']("content_model")['$!=']("attributes") : $c))) { + + $writer = ["text", content]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];} + } else { + + content = self.$unescape_bracketed_text(content); + if (extconf['$[]']("content_model")['$==']("attributes")) { + self.$parse_attributes(content, ($truthy($c = extconf['$[]']("pos_attrs")) ? $c : []), $hash2(["into"], {"into": attributes})) + } else { + + $writer = ["text", content]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + }; + replacement = extension.$process_method()['$[]'](self, ($truthy($c = target) ? $c : content), attributes); + if ($truthy($$($nesting, 'Inline')['$==='](replacement))) { + return replacement.$convert() + } else { + return replacement + };}, TMP_38.$$s = self, TMP_38.$$arity = 0, TMP_38)));}, TMP_37.$$s = self, TMP_37.$$arity = 1, TMP_37))}; + if ($truthy(($truthy($a = found_macroish) ? ($truthy($b = text['$include?']("image:")) ? $b : text['$include?']("icon:")) : $a))) { + text = $send(text, 'gsub', [$$($nesting, 'InlineImageMacroRx')], (TMP_39 = function(){var self = TMP_39.$$s || this, $c, m = nil, captured = nil, type = nil, posattrs = nil, target = nil, attrs = nil; + if ($gvars["~"] == null) $gvars["~"] = nil; + + + m = $gvars["~"]; + if ($truthy((captured = (($c = $gvars['~']) === nil ? nil : $c['$[]'](0)))['$start_with?']($$($nesting, 'RS')))) { + return captured.$slice(1, captured.$length()); + } else if ($truthy(captured['$start_with?']("icon:"))) { + $c = ["icon", ["size"]], (type = $c[0]), (posattrs = $c[1]), $c + } else { + $c = ["image", ["alt", "width", "height"]], (type = $c[0]), (posattrs = $c[1]), $c + }; + if ($truthy((target = m['$[]'](1))['$include?']($$($nesting, 'ATTR_REF_HEAD')))) { + target = self.$sub_attributes(target)}; + attrs = self.$parse_attributes(m['$[]'](2), posattrs, $hash2(["unescape_input"], {"unescape_input": true})); + if (type['$==']("icon")) { + } else { + doc.$register("images", [target, (($writer = ["imagesdir", doc_attrs['$[]']("imagesdir")]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])]) + }; + ($truthy($c = attrs['$[]']("alt")) ? $c : (($writer = ["alt", (($writer = ["default-alt", $$($nesting, 'Helpers').$basename(target, true).$tr("_-", " ")]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + return $$($nesting, 'Inline').$new(self, "image", nil, $hash2(["type", "target", "attributes"], {"type": type, "target": target, "attributes": attrs})).$convert();}, TMP_39.$$s = self, TMP_39.$$arity = 0, TMP_39))}; + if ($truthy(($truthy($a = ($truthy($b = text['$include?']("((")) ? text['$include?']("))") : $b)) ? $a : ($truthy($b = found_macroish_short) ? text['$include?']("dexterm") : $b)))) { + text = $send(text, 'gsub', [$$($nesting, 'InlineIndextermMacroRx')], (TMP_40 = function(){var self = TMP_40.$$s || this, $c, captured = nil, $case = nil, terms = nil, term = nil, visible = nil, before = nil, after = nil, subbed_term = nil; + + + captured = (($c = $gvars['~']) === nil ? nil : $c['$[]'](0)); + return (function() {$case = (($c = $gvars['~']) === nil ? nil : $c['$[]'](1)); + if ("indexterm"['$===']($case)) { + text = (($c = $gvars['~']) === nil ? nil : $c['$[]'](2)); + if ($truthy(captured['$start_with?']($$($nesting, 'RS')))) { + return captured.$slice(1, captured.$length());}; + terms = self.$split_simple_csv(self.$normalize_string(text, true)); + doc.$register("indexterms", terms); + return $$($nesting, 'Inline').$new(self, "indexterm", nil, $hash2(["attributes"], {"attributes": $hash2(["terms"], {"terms": terms})})).$convert();} + else if ("indexterm2"['$===']($case)) { + text = (($c = $gvars['~']) === nil ? nil : $c['$[]'](2)); + if ($truthy(captured['$start_with?']($$($nesting, 'RS')))) { + return captured.$slice(1, captured.$length());}; + term = self.$normalize_string(text, true); + doc.$register("indexterms", [term]); + return $$($nesting, 'Inline').$new(self, "indexterm", term, $hash2(["type"], {"type": "visible"})).$convert();} + else { + text = (($c = $gvars['~']) === nil ? nil : $c['$[]'](3)); + if ($truthy(captured['$start_with?']($$($nesting, 'RS')))) { + if ($truthy(($truthy($c = text['$start_with?']("(")) ? text['$end_with?'](")") : $c))) { + + text = text.$slice(1, $rb_minus(text.$length(), 2)); + $c = [true, "(", ")"], (visible = $c[0]), (before = $c[1]), (after = $c[2]), $c; + } else { + return captured.$slice(1, captured.$length()); + } + } else { + + visible = true; + if ($truthy(text['$start_with?']("("))) { + if ($truthy(text['$end_with?'](")"))) { + $c = [text.$slice(1, $rb_minus(text.$length(), 2)), false], (text = $c[0]), (visible = $c[1]), $c + } else { + $c = [text.$slice(1, text.$length()), "(", ""], (text = $c[0]), (before = $c[1]), (after = $c[2]), $c + } + } else if ($truthy(text['$end_with?'](")"))) { + $c = [text.$slice(0, $rb_minus(text.$length(), 1)), "", ")"], (text = $c[0]), (before = $c[1]), (after = $c[2]), $c}; + }; + if ($truthy(visible)) { + + term = self.$normalize_string(text); + doc.$register("indexterms", [term]); + subbed_term = $$($nesting, 'Inline').$new(self, "indexterm", term, $hash2(["type"], {"type": "visible"})).$convert(); + } else { + + terms = self.$split_simple_csv(self.$normalize_string(text)); + doc.$register("indexterms", terms); + subbed_term = $$($nesting, 'Inline').$new(self, "indexterm", nil, $hash2(["attributes"], {"attributes": $hash2(["terms"], {"terms": terms})})).$convert(); + }; + if ($truthy(before)) { + return "" + (before) + (subbed_term) + (after) + } else { + return subbed_term + };}})();}, TMP_40.$$s = self, TMP_40.$$arity = 0, TMP_40))}; + if ($truthy(($truthy($a = found_colon) ? text['$include?']("://") : $a))) { + text = $send(text, 'gsub', [$$($nesting, 'InlineLinkRx')], (TMP_41 = function(){var self = TMP_41.$$s || this, $c, $d, m = nil, target = nil, macro = nil, prefix = nil, suffix = nil, $case = nil, attrs = nil, link_opts = nil; + if ($gvars["~"] == null) $gvars["~"] = nil; + + + m = $gvars["~"]; + if ($truthy((target = (($c = $gvars['~']) === nil ? nil : $c['$[]'](2)))['$start_with?']($$($nesting, 'RS')))) { + return "" + (m['$[]'](1)) + (target.$slice(1, target.$length())) + (m['$[]'](3));}; + $c = [m['$[]'](1), ($truthy($d = (macro = m['$[]'](3))) ? $d : ""), ""], (prefix = $c[0]), (text = $c[1]), (suffix = $c[2]), $c; + if (prefix['$==']("link:")) { + if ($truthy(macro)) { + prefix = "" + } else { + return m['$[]'](0); + }}; + if ($truthy(($truthy($c = macro) ? $c : $$($nesting, 'UriTerminatorRx')['$!~'](target)))) { + } else { + + $case = (($c = $gvars['~']) === nil ? nil : $c['$[]'](0)); + if (")"['$===']($case)) { + target = target.$chop(); + suffix = ")";} + else if (";"['$===']($case)) {if ($truthy(($truthy($c = prefix['$start_with?']("<")) ? target['$end_with?'](">") : $c))) { + + prefix = prefix.$slice(4, prefix.$length()); + target = target.$slice(0, $rb_minus(target.$length(), 4)); + } else if ($truthy((target = target.$chop())['$end_with?'](")"))) { + + target = target.$chop(); + suffix = ");"; + } else { + suffix = ";" + }} + else if (":"['$===']($case)) {if ($truthy((target = target.$chop())['$end_with?'](")"))) { + + target = target.$chop(); + suffix = "):"; + } else { + suffix = ":" + }}; + if ($truthy(target['$end_with?']("://"))) { + Opal.ret(m['$[]'](0))}; + }; + $c = [nil, $hash2(["type"], {"type": "link"})], (attrs = $c[0]), (link_opts = $c[1]), $c; + if ($truthy(text['$empty?']())) { + } else { + + if ($truthy(text['$include?']($$($nesting, 'R_SB')))) { + text = text.$gsub($$($nesting, 'ESC_R_SB'), $$($nesting, 'R_SB'))}; + if ($truthy(($truthy($c = doc.$compat_mode()['$!']()) ? text['$include?']("=") : $c))) { + + text = ($truthy($c = (attrs = $$($nesting, 'AttributeList').$new(text, self).$parse())['$[]'](1)) ? $c : ""); + if ($truthy(attrs['$key?']("id"))) { + + $writer = ["id", attrs.$delete("id")]; + $send(link_opts, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];};}; + if ($truthy(text['$end_with?']("^"))) { + + text = text.$chop(); + if ($truthy(attrs)) { + ($truthy($c = attrs['$[]']("window")) ? $c : (($writer = ["window", "_blank"]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])) + } else { + attrs = $hash2(["window"], {"window": "_blank"}) + };}; + }; + if ($truthy(text['$empty?']())) { + + text = (function() {if ($truthy(doc_attrs['$key?']("hide-uri-scheme"))) { + + return target.$sub($$($nesting, 'UriSniffRx'), ""); + } else { + return target + }; return nil; })(); + if ($truthy(attrs)) { + + $writer = ["role", (function() {if ($truthy(attrs['$key?']("role"))) { + return "" + "bare " + (attrs['$[]']("role")) + } else { + return "bare" + }; return nil; })()]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + } else { + attrs = $hash2(["role"], {"role": "bare"}) + };}; + doc.$register("links", (($writer = ["target", target]), $send(link_opts, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + if ($truthy(attrs)) { + + $writer = ["attributes", attrs]; + $send(link_opts, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + return "" + (prefix) + ($$($nesting, 'Inline').$new(self, "anchor", text, link_opts).$convert()) + (suffix);}, TMP_41.$$s = self, TMP_41.$$arity = 0, TMP_41))}; + if ($truthy(($truthy($a = found_macroish) ? ($truthy($b = text['$include?']("link:")) ? $b : text['$include?']("mailto:")) : $a))) { + text = $send(text, 'gsub', [$$($nesting, 'InlineLinkMacroRx')], (TMP_42 = function(){var self = TMP_42.$$s || this, $c, m = nil, target = nil, mailto = nil, attrs = nil, link_opts = nil; + if ($gvars["~"] == null) $gvars["~"] = nil; + + + m = $gvars["~"]; + if ($truthy((($c = $gvars['~']) === nil ? nil : $c['$[]'](0))['$start_with?']($$($nesting, 'RS')))) { + return m['$[]'](0).$slice(1, m['$[]'](0).$length());}; + target = (function() {if ($truthy((mailto = m['$[]'](1)))) { + return "" + "mailto:" + (m['$[]'](2)) + } else { + return m['$[]'](2) + }; return nil; })(); + $c = [nil, $hash2(["type"], {"type": "link"})], (attrs = $c[0]), (link_opts = $c[1]), $c; + if ($truthy((text = m['$[]'](3))['$empty?']())) { + } else { + + if ($truthy(text['$include?']($$($nesting, 'R_SB')))) { + text = text.$gsub($$($nesting, 'ESC_R_SB'), $$($nesting, 'R_SB'))}; + if ($truthy(mailto)) { + if ($truthy(($truthy($c = doc.$compat_mode()['$!']()) ? text['$include?'](",") : $c))) { + + text = ($truthy($c = (attrs = $$($nesting, 'AttributeList').$new(text, self).$parse())['$[]'](1)) ? $c : ""); + if ($truthy(attrs['$key?']("id"))) { + + $writer = ["id", attrs.$delete("id")]; + $send(link_opts, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if ($truthy(attrs['$key?'](2))) { + if ($truthy(attrs['$key?'](3))) { + target = "" + (target) + "?subject=" + ($$($nesting, 'Helpers').$uri_encode(attrs['$[]'](2))) + "&body=" + ($$($nesting, 'Helpers').$uri_encode(attrs['$[]'](3))) + } else { + target = "" + (target) + "?subject=" + ($$($nesting, 'Helpers').$uri_encode(attrs['$[]'](2))) + }};} + } else if ($truthy(($truthy($c = doc.$compat_mode()['$!']()) ? text['$include?']("=") : $c))) { + + text = ($truthy($c = (attrs = $$($nesting, 'AttributeList').$new(text, self).$parse())['$[]'](1)) ? $c : ""); + if ($truthy(attrs['$key?']("id"))) { + + $writer = ["id", attrs.$delete("id")]; + $send(link_opts, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];};}; + if ($truthy(text['$end_with?']("^"))) { + + text = text.$chop(); + if ($truthy(attrs)) { + ($truthy($c = attrs['$[]']("window")) ? $c : (($writer = ["window", "_blank"]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])) + } else { + attrs = $hash2(["window"], {"window": "_blank"}) + };}; + }; + if ($truthy(text['$empty?']())) { + if ($truthy(mailto)) { + text = m['$[]'](2) + } else { + + if ($truthy(doc_attrs['$key?']("hide-uri-scheme"))) { + if ($truthy((text = target.$sub($$($nesting, 'UriSniffRx'), ""))['$empty?']())) { + text = target} + } else { + text = target + }; + if ($truthy(attrs)) { + + $writer = ["role", (function() {if ($truthy(attrs['$key?']("role"))) { + return "" + "bare " + (attrs['$[]']("role")) + } else { + return "bare" + }; return nil; })()]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + } else { + attrs = $hash2(["role"], {"role": "bare"}) + }; + }}; + doc.$register("links", (($writer = ["target", target]), $send(link_opts, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + if ($truthy(attrs)) { + + $writer = ["attributes", attrs]; + $send(link_opts, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + return $$($nesting, 'Inline').$new(self, "anchor", text, link_opts).$convert();}, TMP_42.$$s = self, TMP_42.$$arity = 0, TMP_42))}; + if ($truthy(text['$include?']("@"))) { + text = $send(text, 'gsub', [$$($nesting, 'InlineEmailRx')], (TMP_43 = function(){var self = TMP_43.$$s || this, $c, $d, address = nil, tip = nil, target = nil; + + + $c = [(($d = $gvars['~']) === nil ? nil : $d['$[]'](0)), (($d = $gvars['~']) === nil ? nil : $d['$[]'](1))], (address = $c[0]), (tip = $c[1]), $c; + if ($truthy(tip)) { + return (function() {if (tip['$==']($$($nesting, 'RS'))) { + + return address.$slice(1, address.$length()); + } else { + return address + }; return nil; })();}; + target = "" + "mailto:" + (address); + doc.$register("links", target); + return $$($nesting, 'Inline').$new(self, "anchor", address, $hash2(["type", "target"], {"type": "link", "target": target})).$convert();}, TMP_43.$$s = self, TMP_43.$$arity = 0, TMP_43))}; + if ($truthy(($truthy($a = found_macroish) ? text['$include?']("tnote") : $a))) { + text = $send(text, 'gsub', [$$($nesting, 'InlineFootnoteMacroRx')], (TMP_44 = function(){var self = TMP_44.$$s || this, $c, $d, $e, TMP_45, m = nil, id = nil, index = nil, type = nil, target = nil, footnote = nil; + if ($gvars["~"] == null) $gvars["~"] = nil; + + + m = $gvars["~"]; + if ($truthy((($c = $gvars['~']) === nil ? nil : $c['$[]'](0))['$start_with?']($$($nesting, 'RS')))) { + return m['$[]'](0).$slice(1, m['$[]'](0).$length());}; + if ($truthy(m['$[]'](1))) { + $d = ($truthy($e = m['$[]'](3)) ? $e : "").$split(",", 2), $c = Opal.to_ary($d), (id = ($c[0] == null ? nil : $c[0])), (text = ($c[1] == null ? nil : $c[1])), $d + } else { + $c = [m['$[]'](2), m['$[]'](3)], (id = $c[0]), (text = $c[1]), $c + }; + if ($truthy(id)) { + if ($truthy(text)) { + + text = self.$restore_passthroughs(self.$sub_inline_xrefs(self.$sub_inline_anchors(self.$normalize_string(text, true))), false); + index = doc.$counter("footnote-number"); + doc.$register("footnotes", $$$($$($nesting, 'Document'), 'Footnote').$new(index, id, text)); + $c = ["ref", nil], (type = $c[0]), (target = $c[1]), $c; + } else { + + if ($truthy((footnote = $send(doc.$footnotes(), 'find', [], (TMP_45 = function(candidate){var self = TMP_45.$$s || this; + + + + if (candidate == null) { + candidate = nil; + }; + return candidate.$id()['$=='](id);}, TMP_45.$$s = self, TMP_45.$$arity = 1, TMP_45))))) { + $c = [footnote.$index(), footnote.$text()], (index = $c[0]), (text = $c[1]), $c + } else { + + self.$logger().$warn("" + "invalid footnote reference: " + (id)); + $c = [nil, id], (index = $c[0]), (text = $c[1]), $c; + }; + $c = ["xref", id, nil], (type = $c[0]), (target = $c[1]), (id = $c[2]), $c; + } + } else if ($truthy(text)) { + + text = self.$restore_passthroughs(self.$sub_inline_xrefs(self.$sub_inline_anchors(self.$normalize_string(text, true))), false); + index = doc.$counter("footnote-number"); + doc.$register("footnotes", $$$($$($nesting, 'Document'), 'Footnote').$new(index, id, text)); + type = (target = nil); + } else { + return m['$[]'](0); + }; + return $$($nesting, 'Inline').$new(self, "footnote", text, $hash2(["attributes", "id", "target", "type"], {"attributes": $hash2(["index"], {"index": index}), "id": id, "target": target, "type": type})).$convert();}, TMP_44.$$s = self, TMP_44.$$arity = 0, TMP_44))}; + return self.$sub_inline_xrefs(self.$sub_inline_anchors(text, found), found); + } catch ($returner) { if ($returner === Opal.returner) { return $returner.$v } throw $returner; } + }, TMP_Substitutors_sub_macros_29.$$arity = 1); + + Opal.def(self, '$sub_inline_anchors', TMP_Substitutors_sub_inline_anchors_46 = function $$sub_inline_anchors(text, found) { + var $a, TMP_47, $b, $c, TMP_48, self = this; + if (self.context == null) self.context = nil; + if (self.parent == null) self.parent = nil; + + + + if (found == null) { + found = nil; + }; + if ($truthy((($a = self.context['$==']("list_item")) ? self.parent.$style()['$==']("bibliography") : self.context['$==']("list_item")))) { + text = $send(text, 'sub', [$$($nesting, 'InlineBiblioAnchorRx')], (TMP_47 = function(){var self = TMP_47.$$s || this, $b, $c; + + return $$($nesting, 'Inline').$new(self, "anchor", "" + "[" + (($truthy($b = (($c = $gvars['~']) === nil ? nil : $c['$[]'](2))) ? $b : (($c = $gvars['~']) === nil ? nil : $c['$[]'](1)))) + "]", $hash2(["type", "id", "target"], {"type": "bibref", "id": (($b = $gvars['~']) === nil ? nil : $b['$[]'](1)), "target": (($b = $gvars['~']) === nil ? nil : $b['$[]'](1))})).$convert()}, TMP_47.$$s = self, TMP_47.$$arity = 0, TMP_47))}; + if ($truthy(($truthy($a = ($truthy($b = ($truthy($c = found['$!']()) ? $c : found['$[]']("square_bracket"))) ? text['$include?']("[[") : $b)) ? $a : ($truthy($b = ($truthy($c = found['$!']()) ? $c : found['$[]']("macroish"))) ? text['$include?']("or:") : $b)))) { + text = $send(text, 'gsub', [$$($nesting, 'InlineAnchorRx')], (TMP_48 = function(){var self = TMP_48.$$s || this, $d, $e, id = nil, reftext = nil; + + + if ($truthy((($d = $gvars['~']) === nil ? nil : $d['$[]'](1)))) { + return (($d = $gvars['~']) === nil ? nil : $d['$[]'](0)).$slice(1, (($d = $gvars['~']) === nil ? nil : $d['$[]'](0)).$length());}; + if ($truthy((id = (($d = $gvars['~']) === nil ? nil : $d['$[]'](2))))) { + reftext = (($d = $gvars['~']) === nil ? nil : $d['$[]'](3)) + } else { + + id = (($d = $gvars['~']) === nil ? nil : $d['$[]'](4)); + if ($truthy(($truthy($d = (reftext = (($e = $gvars['~']) === nil ? nil : $e['$[]'](5)))) ? reftext['$include?']($$($nesting, 'R_SB')) : $d))) { + reftext = reftext.$gsub($$($nesting, 'ESC_R_SB'), $$($nesting, 'R_SB'))}; + }; + return $$($nesting, 'Inline').$new(self, "anchor", reftext, $hash2(["type", "id", "target"], {"type": "ref", "id": id, "target": id})).$convert();}, TMP_48.$$s = self, TMP_48.$$arity = 0, TMP_48))}; + return text; + }, TMP_Substitutors_sub_inline_anchors_46.$$arity = -2); + + Opal.def(self, '$sub_inline_xrefs', TMP_Substitutors_sub_inline_xrefs_49 = function $$sub_inline_xrefs(content, found) { + var $a, $b, TMP_50, self = this; + + + + if (found == null) { + found = nil; + }; + if ($truthy(($truthy($a = ($truthy($b = (function() {if ($truthy(found)) { + return found['$[]']("macroish") + } else { + + return content['$include?']("["); + }; return nil; })()) ? content['$include?']("xref:") : $b)) ? $a : ($truthy($b = content['$include?']("&")) ? content['$include?']("lt;&") : $b)))) { + content = $send(content, 'gsub', [$$($nesting, 'InlineXrefMacroRx')], (TMP_50 = function(){var self = TMP_50.$$s || this, $c, $d, m = nil, attrs = nil, doc = nil, refid = nil, text = nil, macro = nil, fragment = nil, hash_idx = nil, fragment_len = nil, path = nil, ext = nil, src2src = nil, target = nil; + if (self.document == null) self.document = nil; + if ($gvars["~"] == null) $gvars["~"] = nil; + if ($gvars.VERBOSE == null) $gvars.VERBOSE = nil; + + + m = $gvars["~"]; + if ($truthy((($c = $gvars['~']) === nil ? nil : $c['$[]'](0))['$start_with?']($$($nesting, 'RS')))) { + return m['$[]'](0).$slice(1, m['$[]'](0).$length());}; + $c = [$hash2([], {}), self.document], (attrs = $c[0]), (doc = $c[1]), $c; + if ($truthy((refid = m['$[]'](1)))) { + + $d = refid.$split(",", 2), $c = Opal.to_ary($d), (refid = ($c[0] == null ? nil : $c[0])), (text = ($c[1] == null ? nil : $c[1])), $d; + if ($truthy(text)) { + text = text.$lstrip()}; + } else { + + macro = true; + refid = m['$[]'](2); + if ($truthy((text = m['$[]'](3)))) { + + if ($truthy(text['$include?']($$($nesting, 'R_SB')))) { + text = text.$gsub($$($nesting, 'ESC_R_SB'), $$($nesting, 'R_SB'))}; + if ($truthy(($truthy($c = doc.$compat_mode()['$!']()) ? text['$include?']("=") : $c))) { + text = $$($nesting, 'AttributeList').$new(text, self).$parse_into(attrs)['$[]'](1)};}; + }; + if ($truthy(doc.$compat_mode())) { + fragment = refid + } else if ($truthy((hash_idx = refid.$index("#")))) { + if ($truthy($rb_gt(hash_idx, 0))) { + + if ($truthy($rb_gt((fragment_len = $rb_minus($rb_minus(refid.$length(), hash_idx), 1)), 0))) { + $c = [refid.$slice(0, hash_idx), refid.$slice($rb_plus(hash_idx, 1), fragment_len)], (path = $c[0]), (fragment = $c[1]), $c + } else { + path = refid.$slice(0, hash_idx) + }; + if ($truthy((ext = $$$('::', 'File').$extname(path))['$empty?']())) { + src2src = path + } else if ($truthy($$($nesting, 'ASCIIDOC_EXTENSIONS')['$[]'](ext))) { + src2src = (path = path.$slice(0, $rb_minus(path.$length(), ext.$length())))}; + } else { + $c = [refid, refid.$slice(1, refid.$length())], (target = $c[0]), (fragment = $c[1]), $c + } + } else if ($truthy(($truthy($c = macro) ? refid['$end_with?'](".adoc") : $c))) { + src2src = (path = refid.$slice(0, $rb_minus(refid.$length(), 5))) + } else { + fragment = refid + }; + if ($truthy(target)) { + + refid = fragment; + if ($truthy(($truthy($c = $gvars.VERBOSE) ? doc.$catalog()['$[]']("ids")['$key?'](refid)['$!']() : $c))) { + self.$logger().$warn("" + "invalid reference: " + (refid))}; + } else if ($truthy(path)) { + if ($truthy(($truthy($c = src2src) ? ($truthy($d = doc.$attributes()['$[]']("docname")['$=='](path)) ? $d : doc.$catalog()['$[]']("includes")['$[]'](path)) : $c))) { + if ($truthy(fragment)) { + + $c = [fragment, nil, "" + "#" + (fragment)], (refid = $c[0]), (path = $c[1]), (target = $c[2]), $c; + if ($truthy(($truthy($c = $gvars.VERBOSE) ? doc.$catalog()['$[]']("ids")['$key?'](refid)['$!']() : $c))) { + self.$logger().$warn("" + "invalid reference: " + (refid))}; + } else { + $c = [nil, nil, "#"], (refid = $c[0]), (path = $c[1]), (target = $c[2]), $c + } + } else { + + $c = [path, "" + (doc.$attributes()['$[]']("relfileprefix")) + (path) + ((function() {if ($truthy(src2src)) { + + return doc.$attributes().$fetch("relfilesuffix", doc.$outfilesuffix()); + } else { + return "" + }; return nil; })())], (refid = $c[0]), (path = $c[1]), $c; + if ($truthy(fragment)) { + $c = ["" + (refid) + "#" + (fragment), "" + (path) + "#" + (fragment)], (refid = $c[0]), (target = $c[1]), $c + } else { + target = path + }; + } + } else if ($truthy(($truthy($c = doc.$compat_mode()) ? $c : $$($nesting, 'Compliance').$natural_xrefs()['$!']()))) { + + $c = [fragment, "" + "#" + (fragment)], (refid = $c[0]), (target = $c[1]), $c; + if ($truthy(($truthy($c = $gvars.VERBOSE) ? doc.$catalog()['$[]']("ids")['$key?'](refid)['$!']() : $c))) { + self.$logger().$warn("" + "invalid reference: " + (refid))}; + } else if ($truthy(doc.$catalog()['$[]']("ids")['$key?'](fragment))) { + $c = [fragment, "" + "#" + (fragment)], (refid = $c[0]), (target = $c[1]), $c + } else if ($truthy(($truthy($c = (refid = doc.$catalog()['$[]']("ids").$key(fragment))) ? ($truthy($d = fragment['$include?'](" ")) ? $d : fragment.$downcase()['$!='](fragment)) : $c))) { + $c = [refid, "" + "#" + (refid)], (fragment = $c[0]), (target = $c[1]), $c + } else { + + $c = [fragment, "" + "#" + (fragment)], (refid = $c[0]), (target = $c[1]), $c; + if ($truthy($gvars.VERBOSE)) { + self.$logger().$warn("" + "invalid reference: " + (refid))}; + }; + $c = [path, fragment, refid], attrs['$[]=']("path", $c[0]), attrs['$[]=']("fragment", $c[1]), attrs['$[]=']("refid", $c[2]), $c; + return $$($nesting, 'Inline').$new(self, "anchor", text, $hash2(["type", "target", "attributes"], {"type": "xref", "target": target, "attributes": attrs})).$convert();}, TMP_50.$$s = self, TMP_50.$$arity = 0, TMP_50))}; + return content; + }, TMP_Substitutors_sub_inline_xrefs_49.$$arity = -2); + + Opal.def(self, '$sub_callouts', TMP_Substitutors_sub_callouts_51 = function $$sub_callouts(text) { + var TMP_52, self = this, callout_rx = nil, autonum = nil; + + + callout_rx = (function() {if ($truthy(self['$attr?']("line-comment"))) { + return $$($nesting, 'CalloutSourceRxMap')['$[]'](self.$attr("line-comment")) + } else { + return $$($nesting, 'CalloutSourceRx') + }; return nil; })(); + autonum = 0; + return $send(text, 'gsub', [callout_rx], (TMP_52 = function(){var self = TMP_52.$$s || this, $a; + if (self.document == null) self.document = nil; + + if ($truthy((($a = $gvars['~']) === nil ? nil : $a['$[]'](2)))) { + return (($a = $gvars['~']) === nil ? nil : $a['$[]'](0)).$sub($$($nesting, 'RS'), "") + } else { + return $$($nesting, 'Inline').$new(self, "callout", (function() {if ((($a = $gvars['~']) === nil ? nil : $a['$[]'](4))['$=='](".")) { + return (autonum = $rb_plus(autonum, 1)).$to_s() + } else { + return (($a = $gvars['~']) === nil ? nil : $a['$[]'](4)) + }; return nil; })(), $hash2(["id", "attributes"], {"id": self.document.$callouts().$read_next_id(), "attributes": $hash2(["guard"], {"guard": (($a = $gvars['~']) === nil ? nil : $a['$[]'](1))})})).$convert() + }}, TMP_52.$$s = self, TMP_52.$$arity = 0, TMP_52)); + }, TMP_Substitutors_sub_callouts_51.$$arity = 1); + + Opal.def(self, '$sub_post_replacements', TMP_Substitutors_sub_post_replacements_53 = function $$sub_post_replacements(text) { + var $a, TMP_54, TMP_55, self = this, lines = nil, last = nil; + if (self.document == null) self.document = nil; + if (self.attributes == null) self.attributes = nil; + + if ($truthy(($truthy($a = self.document.$attributes()['$key?']("hardbreaks")) ? $a : self.attributes['$key?']("hardbreaks-option")))) { + + lines = text.$split($$($nesting, 'LF'), -1); + if ($truthy($rb_lt(lines.$size(), 2))) { + return text}; + last = lines.$pop(); + return $send(lines, 'map', [], (TMP_54 = function(line){var self = TMP_54.$$s || this; + + + + if (line == null) { + line = nil; + }; + return $$($nesting, 'Inline').$new(self, "break", (function() {if ($truthy(line['$end_with?']($$($nesting, 'HARD_LINE_BREAK')))) { + + return line.$slice(0, $rb_minus(line.$length(), 2)); + } else { + return line + }; return nil; })(), $hash2(["type"], {"type": "line"})).$convert();}, TMP_54.$$s = self, TMP_54.$$arity = 1, TMP_54))['$<<'](last).$join($$($nesting, 'LF')); + } else if ($truthy(($truthy($a = text['$include?']($$($nesting, 'PLUS'))) ? text['$include?']($$($nesting, 'HARD_LINE_BREAK')) : $a))) { + return $send(text, 'gsub', [$$($nesting, 'HardLineBreakRx')], (TMP_55 = function(){var self = TMP_55.$$s || this, $b; + + return $$($nesting, 'Inline').$new(self, "break", (($b = $gvars['~']) === nil ? nil : $b['$[]'](1)), $hash2(["type"], {"type": "line"})).$convert()}, TMP_55.$$s = self, TMP_55.$$arity = 0, TMP_55)) + } else { + return text + } + }, TMP_Substitutors_sub_post_replacements_53.$$arity = 1); + + Opal.def(self, '$convert_quoted_text', TMP_Substitutors_convert_quoted_text_56 = function $$convert_quoted_text(match, type, scope) { + var $a, self = this, attrs = nil, unescaped_attrs = nil, attrlist = nil, id = nil, attributes = nil; + + + if ($truthy(match['$[]'](0)['$start_with?']($$($nesting, 'RS')))) { + if ($truthy((($a = scope['$==']("constrained")) ? (attrs = match['$[]'](2)) : scope['$==']("constrained")))) { + unescaped_attrs = "" + "[" + (attrs) + "]" + } else { + return match['$[]'](0).$slice(1, match['$[]'](0).$length()) + }}; + if (scope['$==']("constrained")) { + if ($truthy(unescaped_attrs)) { + return "" + (unescaped_attrs) + ($$($nesting, 'Inline').$new(self, "quoted", match['$[]'](3), $hash2(["type"], {"type": type})).$convert()) + } else { + + if ($truthy((attrlist = match['$[]'](2)))) { + + id = (attributes = self.$parse_quoted_text_attributes(attrlist)).$delete("id"); + if (type['$==']("mark")) { + type = "unquoted"};}; + return "" + (match['$[]'](1)) + ($$($nesting, 'Inline').$new(self, "quoted", match['$[]'](3), $hash2(["type", "id", "attributes"], {"type": type, "id": id, "attributes": attributes})).$convert()); + } + } else { + + if ($truthy((attrlist = match['$[]'](1)))) { + + id = (attributes = self.$parse_quoted_text_attributes(attrlist)).$delete("id"); + if (type['$==']("mark")) { + type = "unquoted"};}; + return $$($nesting, 'Inline').$new(self, "quoted", match['$[]'](2), $hash2(["type", "id", "attributes"], {"type": type, "id": id, "attributes": attributes})).$convert(); + }; + }, TMP_Substitutors_convert_quoted_text_56.$$arity = 3); + + Opal.def(self, '$parse_quoted_text_attributes', TMP_Substitutors_parse_quoted_text_attributes_57 = function $$parse_quoted_text_attributes(str) { + var $a, $b, self = this, segments = nil, id = nil, more_roles = nil, roles = nil, attrs = nil, $writer = nil; + + + if ($truthy(str['$include?']($$($nesting, 'ATTR_REF_HEAD')))) { + str = self.$sub_attributes(str)}; + if ($truthy(str['$include?'](","))) { + str = str.$slice(0, str.$index(","))}; + if ($truthy((str = str.$strip())['$empty?']())) { + return $hash2([], {}) + } else if ($truthy(($truthy($a = str['$start_with?'](".", "#")) ? $$($nesting, 'Compliance').$shorthand_property_syntax() : $a))) { + + segments = str.$split("#", 2); + if ($truthy($rb_gt(segments.$size(), 1))) { + $b = segments['$[]'](1).$split("."), $a = Opal.to_ary($b), (id = ($a[0] == null ? nil : $a[0])), (more_roles = $slice.call($a, 1)), $b + } else { + + id = nil; + more_roles = []; + }; + roles = (function() {if ($truthy(segments['$[]'](0)['$empty?']())) { + return [] + } else { + return segments['$[]'](0).$split(".") + }; return nil; })(); + if ($truthy($rb_gt(roles.$size(), 1))) { + roles.$shift()}; + if ($truthy($rb_gt(more_roles.$size(), 0))) { + roles.$concat(more_roles)}; + attrs = $hash2([], {}); + if ($truthy(id)) { + + $writer = ["id", id]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if ($truthy(roles['$empty?']())) { + } else { + + $writer = ["role", roles.$join(" ")]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + return attrs; + } else { + return $hash2(["role"], {"role": str}) + }; + }, TMP_Substitutors_parse_quoted_text_attributes_57.$$arity = 1); + + Opal.def(self, '$parse_attributes', TMP_Substitutors_parse_attributes_58 = function $$parse_attributes(attrlist, posattrs, opts) { + var $a, self = this, block = nil, into = nil; + if (self.document == null) self.document = nil; + + + + if (posattrs == null) { + posattrs = []; + }; + + if (opts == null) { + opts = $hash2([], {}); + }; + if ($truthy(($truthy($a = attrlist) ? attrlist['$empty?']()['$!']() : $a))) { + } else { + return $hash2([], {}) + }; + if ($truthy(($truthy($a = opts['$[]']("sub_input")) ? attrlist['$include?']($$($nesting, 'ATTR_REF_HEAD')) : $a))) { + attrlist = self.document.$sub_attributes(attrlist)}; + if ($truthy(opts['$[]']("unescape_input"))) { + attrlist = self.$unescape_bracketed_text(attrlist)}; + if ($truthy(opts['$[]']("sub_result"))) { + block = self}; + if ($truthy((into = opts['$[]']("into")))) { + return $$($nesting, 'AttributeList').$new(attrlist, block).$parse_into(into, posattrs) + } else { + return $$($nesting, 'AttributeList').$new(attrlist, block).$parse(posattrs) + }; + }, TMP_Substitutors_parse_attributes_58.$$arity = -2); + + Opal.def(self, '$expand_subs', TMP_Substitutors_expand_subs_59 = function $$expand_subs(subs) { + var $a, TMP_60, self = this, expanded_subs = nil; + + if ($truthy($$$('::', 'Symbol')['$==='](subs))) { + if (subs['$==']("none")) { + return nil + } else { + return ($truthy($a = $$($nesting, 'SUB_GROUPS')['$[]'](subs)) ? $a : [subs]) + } + } else { + + expanded_subs = []; + $send(subs, 'each', [], (TMP_60 = function(key){var self = TMP_60.$$s || this, sub_group = nil; + + + + if (key == null) { + key = nil; + }; + if (key['$==']("none")) { + return nil + } else if ($truthy((sub_group = $$($nesting, 'SUB_GROUPS')['$[]'](key)))) { + return (expanded_subs = $rb_plus(expanded_subs, sub_group)) + } else { + return expanded_subs['$<<'](key) + };}, TMP_60.$$s = self, TMP_60.$$arity = 1, TMP_60)); + if ($truthy(expanded_subs['$empty?']())) { + return nil + } else { + return expanded_subs + }; + } + }, TMP_Substitutors_expand_subs_59.$$arity = 1); + + Opal.def(self, '$unescape_bracketed_text', TMP_Substitutors_unescape_bracketed_text_61 = function $$unescape_bracketed_text(text) { + var self = this; + + + if ($truthy(text['$empty?']())) { + } else if ($truthy((text = text.$strip().$tr($$($nesting, 'LF'), " "))['$include?']($$($nesting, 'R_SB')))) { + text = text.$gsub($$($nesting, 'ESC_R_SB'), $$($nesting, 'R_SB'))}; + return text; + }, TMP_Substitutors_unescape_bracketed_text_61.$$arity = 1); + + Opal.def(self, '$normalize_string', TMP_Substitutors_normalize_string_62 = function $$normalize_string(str, unescape_brackets) { + var $a, self = this; + + + + if (unescape_brackets == null) { + unescape_brackets = false; + }; + if ($truthy(str['$empty?']())) { + } else { + + str = str.$strip().$tr($$($nesting, 'LF'), " "); + if ($truthy(($truthy($a = unescape_brackets) ? str['$include?']($$($nesting, 'R_SB')) : $a))) { + str = str.$gsub($$($nesting, 'ESC_R_SB'), $$($nesting, 'R_SB'))}; + }; + return str; + }, TMP_Substitutors_normalize_string_62.$$arity = -2); + + Opal.def(self, '$unescape_brackets', TMP_Substitutors_unescape_brackets_63 = function $$unescape_brackets(str) { + var self = this; + + + if ($truthy(str['$empty?']())) { + } else if ($truthy(str['$include?']($$($nesting, 'RS')))) { + str = str.$gsub($$($nesting, 'ESC_R_SB'), $$($nesting, 'R_SB'))}; + return str; + }, TMP_Substitutors_unescape_brackets_63.$$arity = 1); + + Opal.def(self, '$split_simple_csv', TMP_Substitutors_split_simple_csv_64 = function $$split_simple_csv(str) { + var TMP_65, TMP_66, self = this, values = nil, current = nil, quote_open = nil; + + + if ($truthy(str['$empty?']())) { + values = [] + } else if ($truthy(str['$include?']("\""))) { + + values = []; + current = []; + quote_open = false; + $send(str, 'each_char', [], (TMP_65 = function(c){var self = TMP_65.$$s || this, $case = nil; + + + + if (c == null) { + c = nil; + }; + return (function() {$case = c; + if (","['$===']($case)) {if ($truthy(quote_open)) { + return current['$<<'](c) + } else { + + values['$<<'](current.$join().$strip()); + return (current = []); + }} + else if ("\""['$===']($case)) {return (quote_open = quote_open['$!']())} + else {return current['$<<'](c)}})();}, TMP_65.$$s = self, TMP_65.$$arity = 1, TMP_65)); + values['$<<'](current.$join().$strip()); + } else { + values = $send(str.$split(","), 'map', [], (TMP_66 = function(it){var self = TMP_66.$$s || this; + + + + if (it == null) { + it = nil; + }; + return it.$strip();}, TMP_66.$$s = self, TMP_66.$$arity = 1, TMP_66)) + }; + return values; + }, TMP_Substitutors_split_simple_csv_64.$$arity = 1); + + Opal.def(self, '$resolve_subs', TMP_Substitutors_resolve_subs_67 = function $$resolve_subs(subs, type, defaults, subject) { + var TMP_68, self = this, candidates = nil, modifiers_present = nil, resolved = nil, invalid = nil; + + + + if (type == null) { + type = "block"; + }; + + if (defaults == null) { + defaults = nil; + }; + + if (subject == null) { + subject = nil; + }; + if ($truthy(subs['$nil_or_empty?']())) { + return nil}; + candidates = nil; + if ($truthy(subs['$include?'](" "))) { + subs = subs.$delete(" ")}; + modifiers_present = $$($nesting, 'SubModifierSniffRx')['$match?'](subs); + $send(subs.$split(","), 'each', [], (TMP_68 = function(key){var self = TMP_68.$$s || this, $a, $b, modifier_operation = nil, first = nil, resolved_keys = nil, resolved_key = nil, candidate = nil, $case = nil; + + + + if (key == null) { + key = nil; + }; + modifier_operation = nil; + if ($truthy(modifiers_present)) { + if ((first = key.$chr())['$==']("+")) { + + modifier_operation = "append"; + key = key.$slice(1, key.$length()); + } else if (first['$==']("-")) { + + modifier_operation = "remove"; + key = key.$slice(1, key.$length()); + } else if ($truthy(key['$end_with?']("+"))) { + + modifier_operation = "prepend"; + key = key.$chop();}}; + key = key.$to_sym(); + if ($truthy((($a = type['$==']("inline")) ? ($truthy($b = key['$==']("verbatim")) ? $b : key['$==']("v")) : type['$==']("inline")))) { + resolved_keys = $$($nesting, 'BASIC_SUBS') + } else if ($truthy($$($nesting, 'SUB_GROUPS')['$key?'](key))) { + resolved_keys = $$($nesting, 'SUB_GROUPS')['$[]'](key) + } else if ($truthy(($truthy($a = (($b = type['$==']("inline")) ? key.$length()['$=='](1) : type['$==']("inline"))) ? $$($nesting, 'SUB_HINTS')['$key?'](key) : $a))) { + + resolved_key = $$($nesting, 'SUB_HINTS')['$[]'](key); + if ($truthy((candidate = $$($nesting, 'SUB_GROUPS')['$[]'](resolved_key)))) { + resolved_keys = candidate + } else { + resolved_keys = [resolved_key] + }; + } else { + resolved_keys = [key] + }; + if ($truthy(modifier_operation)) { + + candidates = ($truthy($a = candidates) ? $a : (function() {if ($truthy(defaults)) { + + return defaults.$drop(0); + } else { + return [] + }; return nil; })()); + return (function() {$case = modifier_operation; + if ("append"['$===']($case)) {return (candidates = $rb_plus(candidates, resolved_keys))} + else if ("prepend"['$===']($case)) {return (candidates = $rb_plus(resolved_keys, candidates))} + else if ("remove"['$===']($case)) {return (candidates = $rb_minus(candidates, resolved_keys))} + else { return nil }})(); + } else { + + candidates = ($truthy($a = candidates) ? $a : []); + return (candidates = $rb_plus(candidates, resolved_keys)); + };}, TMP_68.$$s = self, TMP_68.$$arity = 1, TMP_68)); + if ($truthy(candidates)) { + } else { + return nil + }; + resolved = candidates['$&']($$($nesting, 'SUB_OPTIONS')['$[]'](type)); + if ($truthy($rb_minus(candidates, resolved)['$empty?']())) { + } else { + + invalid = $rb_minus(candidates, resolved); + self.$logger().$warn("" + "invalid substitution type" + ((function() {if ($truthy($rb_gt(invalid.$size(), 1))) { + return "s" + } else { + return "" + }; return nil; })()) + ((function() {if ($truthy(subject)) { + return " for " + } else { + return "" + }; return nil; })()) + (subject) + ": " + (invalid.$join(", "))); + }; + return resolved; + }, TMP_Substitutors_resolve_subs_67.$$arity = -2); + + Opal.def(self, '$resolve_block_subs', TMP_Substitutors_resolve_block_subs_69 = function $$resolve_block_subs(subs, defaults, subject) { + var self = this; + + return self.$resolve_subs(subs, "block", defaults, subject) + }, TMP_Substitutors_resolve_block_subs_69.$$arity = 3); + + Opal.def(self, '$resolve_pass_subs', TMP_Substitutors_resolve_pass_subs_70 = function $$resolve_pass_subs(subs) { + var self = this; + + return self.$resolve_subs(subs, "inline", nil, "passthrough macro") + }, TMP_Substitutors_resolve_pass_subs_70.$$arity = 1); + + Opal.def(self, '$highlight_source', TMP_Substitutors_highlight_source_71 = function $$highlight_source(source, process_callouts, highlighter) { + var $a, $b, $c, $d, $e, $f, TMP_72, TMP_74, self = this, $case = nil, highlighter_loaded = nil, lineno = nil, callout_on_last = nil, callout_marks = nil, last = nil, callout_rx = nil, linenums_mode = nil, highlight_lines = nil, start = nil, result = nil, lexer = nil, opts = nil, $writer = nil, autonum = nil, reached_code = nil; + if (self.document == null) self.document = nil; + if (self.passthroughs == null) self.passthroughs = nil; + + + + if (highlighter == null) { + highlighter = nil; + }; + $case = (highlighter = ($truthy($a = highlighter) ? $a : self.document.$attributes()['$[]']("source-highlighter"))); + if ("coderay"['$===']($case)) {if ($truthy(($truthy($a = ($truthy($b = (highlighter_loaded = (($c = $$$('::', 'CodeRay', 'skip_raise')) ? 'constant' : nil))) ? $b : (($d = $Substitutors.$$cvars['@@coderay_unavailable'], $d != null) ? 'class variable' : nil))) ? $a : self.document.$attributes()['$[]']("coderay-unavailable")))) { + } else if ($truthy($$($nesting, 'Helpers').$require_library("coderay", true, "warn")['$nil?']())) { + (Opal.class_variable_set($Substitutors, '@@coderay_unavailable', true)) + } else { + highlighter_loaded = true + }} + else if ("pygments"['$===']($case)) {if ($truthy(($truthy($a = ($truthy($b = (highlighter_loaded = (($e = $$$('::', 'Pygments', 'skip_raise')) ? 'constant' : nil))) ? $b : (($f = $Substitutors.$$cvars['@@pygments_unavailable'], $f != null) ? 'class variable' : nil))) ? $a : self.document.$attributes()['$[]']("pygments-unavailable")))) { + } else if ($truthy($$($nesting, 'Helpers').$require_library("pygments", "pygments.rb", "warn")['$nil?']())) { + (Opal.class_variable_set($Substitutors, '@@pygments_unavailable', true)) + } else { + highlighter_loaded = true + }} + else {highlighter_loaded = false}; + if ($truthy(highlighter_loaded)) { + } else { + return self.$sub_source(source, process_callouts) + }; + lineno = 0; + callout_on_last = false; + if ($truthy(process_callouts)) { + + callout_marks = $hash2([], {}); + last = -1; + callout_rx = (function() {if ($truthy(self['$attr?']("line-comment"))) { + return $$($nesting, 'CalloutExtractRxMap')['$[]'](self.$attr("line-comment")) + } else { + return $$($nesting, 'CalloutExtractRx') + }; return nil; })(); + source = $send(source.$split($$($nesting, 'LF'), -1), 'map', [], (TMP_72 = function(line){var self = TMP_72.$$s || this, TMP_73; + + + + if (line == null) { + line = nil; + }; + lineno = $rb_plus(lineno, 1); + return $send(line, 'gsub', [callout_rx], (TMP_73 = function(){var self = TMP_73.$$s || this, $g, $writer = nil; + + if ($truthy((($g = $gvars['~']) === nil ? nil : $g['$[]'](2)))) { + return (($g = $gvars['~']) === nil ? nil : $g['$[]'](0)).$sub($$($nesting, 'RS'), "") + } else { + + ($truthy($g = callout_marks['$[]'](lineno)) ? $g : (($writer = [lineno, []]), $send(callout_marks, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]))['$<<']([(($g = $gvars['~']) === nil ? nil : $g['$[]'](1)), (($g = $gvars['~']) === nil ? nil : $g['$[]'](4))]); + last = lineno; + return nil; + }}, TMP_73.$$s = self, TMP_73.$$arity = 0, TMP_73));}, TMP_72.$$s = self, TMP_72.$$arity = 1, TMP_72)).$join($$($nesting, 'LF')); + callout_on_last = last['$=='](lineno); + if ($truthy(callout_marks['$empty?']())) { + callout_marks = nil}; + } else { + callout_marks = nil + }; + linenums_mode = nil; + highlight_lines = nil; + $case = highlighter; + if ("coderay"['$===']($case)) { + if ($truthy((linenums_mode = (function() {if ($truthy(self['$attr?']("linenums", nil, false))) { + return ($truthy($a = self.document.$attributes()['$[]']("coderay-linenums-mode")) ? $a : "table").$to_sym() + } else { + return nil + }; return nil; })()))) { + + if ($truthy($rb_lt((start = self.$attr("start", nil, 1).$to_i()), 1))) { + start = 1}; + if ($truthy(self['$attr?']("highlight", nil, false))) { + highlight_lines = self.$resolve_lines_to_highlight(source, self.$attr("highlight", nil, false))};}; + result = $$$($$$('::', 'CodeRay'), 'Duo')['$[]'](self.$attr("language", "text", false).$to_sym(), "html", $hash2(["css", "line_numbers", "line_number_start", "line_number_anchors", "highlight_lines", "bold_every"], {"css": ($truthy($a = self.document.$attributes()['$[]']("coderay-css")) ? $a : "class").$to_sym(), "line_numbers": linenums_mode, "line_number_start": start, "line_number_anchors": false, "highlight_lines": highlight_lines, "bold_every": false})).$highlight(source);} + else if ("pygments"['$===']($case)) { + lexer = ($truthy($a = $$$($$$('::', 'Pygments'), 'Lexer').$find_by_alias(self.$attr("language", "text", false))) ? $a : $$$($$$('::', 'Pygments'), 'Lexer').$find_by_mimetype("text/plain")); + opts = $hash2(["cssclass", "classprefix", "nobackground", "stripnl"], {"cssclass": "pyhl", "classprefix": "tok-", "nobackground": true, "stripnl": false}); + if (lexer.$name()['$==']("PHP")) { + + $writer = ["startinline", self['$option?']("mixed")['$!']()]; + $send(opts, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if (($truthy($a = self.document.$attributes()['$[]']("pygments-css")) ? $a : "class")['$==']("class")) { + } else { + + + $writer = ["noclasses", true]; + $send(opts, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["style", ($truthy($a = self.document.$attributes()['$[]']("pygments-style")) ? $a : $$$($$($nesting, 'Stylesheets'), 'DEFAULT_PYGMENTS_STYLE'))]; + $send(opts, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + }; + if ($truthy(self['$attr?']("highlight", nil, false))) { + if ($truthy((highlight_lines = self.$resolve_lines_to_highlight(source, self.$attr("highlight", nil, false)))['$empty?']())) { + } else { + + $writer = ["hl_lines", highlight_lines.$join(" ")]; + $send(opts, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }}; + if ($truthy(($truthy($a = ($truthy($b = self['$attr?']("linenums", nil, false)) ? (($writer = ["linenostart", (function() {if ($truthy($rb_lt((start = self.$attr("start", 1, false)).$to_i(), 1))) { + return 1 + } else { + return start + }; return nil; })()]), $send(opts, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]) : $b)) ? (($writer = ["linenos", ($truthy($b = self.document.$attributes()['$[]']("pygments-linenums-mode")) ? $b : "table")]), $send(opts, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])['$==']("table") : $a))) { + + linenums_mode = "table"; + if ($truthy((result = lexer.$highlight(source, $hash2(["options"], {"options": opts}))))) { + result = result.$sub($$($nesting, 'PygmentsWrapperDivRx'), "\\1").$gsub($$($nesting, 'PygmentsWrapperPreRx'), "\\1") + } else { + result = self.$sub_specialchars(source) + }; + } else if ($truthy((result = lexer.$highlight(source, $hash2(["options"], {"options": opts}))))) { + if ($truthy($$($nesting, 'PygmentsWrapperPreRx')['$=~'](result))) { + result = (($a = $gvars['~']) === nil ? nil : $a['$[]'](1))} + } else { + result = self.$sub_specialchars(source) + };}; + if ($truthy(self.passthroughs['$empty?']())) { + } else { + result = result.$gsub($$($nesting, 'HighlightedPassSlotRx'), "" + ($$($nesting, 'PASS_START')) + "\\1" + ($$($nesting, 'PASS_END'))) + }; + if ($truthy(($truthy($a = process_callouts) ? callout_marks : $a))) { + + lineno = 0; + autonum = 0; + reached_code = linenums_mode['$!=']("table"); + return $send(result.$split($$($nesting, 'LF'), -1), 'map', [], (TMP_74 = function(line){var self = TMP_74.$$s || this, $g, $h, TMP_75, conums = nil, tail = nil, pos = nil, guard = nil, conum = nil, conums_markup = nil; + if (self.document == null) self.document = nil; + + + + if (line == null) { + line = nil; + }; + if ($truthy(reached_code)) { + } else { + + if ($truthy(line['$include?'](""))) { + } else { + return line; + }; + reached_code = true; + }; + lineno = $rb_plus(lineno, 1); + if ($truthy((conums = callout_marks.$delete(lineno)))) { + + tail = nil; + if ($truthy(($truthy($g = ($truthy($h = callout_on_last) ? callout_marks['$empty?']() : $h)) ? linenums_mode['$==']("table") : $g))) { + if ($truthy((($g = highlighter['$==']("coderay")) ? (pos = line.$index("")) : highlighter['$==']("coderay")))) { + $g = [line.$slice(0, pos), line.$slice(pos, line.$length())], (line = $g[0]), (tail = $g[1]), $g + } else if ($truthy((($g = highlighter['$==']("pygments")) ? (pos = line['$start_with?']("")) : highlighter['$==']("pygments")))) { + $g = ["", line], (line = $g[0]), (tail = $g[1]), $g}}; + if (conums.$size()['$=='](1)) { + + $h = conums['$[]'](0), $g = Opal.to_ary($h), (guard = ($g[0] == null ? nil : $g[0])), (conum = ($g[1] == null ? nil : $g[1])), $h; + return "" + (line) + ($$($nesting, 'Inline').$new(self, "callout", (function() {if (conum['$=='](".")) { + return (autonum = $rb_plus(autonum, 1)).$to_s() + } else { + return conum + }; return nil; })(), $hash2(["id", "attributes"], {"id": self.document.$callouts().$read_next_id(), "attributes": $hash2(["guard"], {"guard": guard})})).$convert()) + (tail); + } else { + + conums_markup = $send(conums, 'map', [], (TMP_75 = function(guard_it, conum_it){var self = TMP_75.$$s || this; + if (self.document == null) self.document = nil; + + + + if (guard_it == null) { + guard_it = nil; + }; + + if (conum_it == null) { + conum_it = nil; + }; + return $$($nesting, 'Inline').$new(self, "callout", (function() {if (conum_it['$=='](".")) { + return (autonum = $rb_plus(autonum, 1)).$to_s() + } else { + return conum_it + }; return nil; })(), $hash2(["id", "attributes"], {"id": self.document.$callouts().$read_next_id(), "attributes": $hash2(["guard"], {"guard": guard_it})})).$convert();}, TMP_75.$$s = self, TMP_75.$$arity = 2, TMP_75)).$join(" "); + return "" + (line) + (conums_markup) + (tail); + }; + } else { + return line + };}, TMP_74.$$s = self, TMP_74.$$arity = 1, TMP_74)).$join($$($nesting, 'LF')); + } else { + return result + }; + }, TMP_Substitutors_highlight_source_71.$$arity = -3); + + Opal.def(self, '$resolve_lines_to_highlight', TMP_Substitutors_resolve_lines_to_highlight_76 = function $$resolve_lines_to_highlight(source, spec) { + var TMP_77, self = this, lines = nil; + + + lines = []; + if ($truthy(spec['$include?'](" "))) { + spec = spec.$delete(" ")}; + $send((function() {if ($truthy(spec['$include?'](","))) { + + return spec.$split(","); + } else { + + return spec.$split(";"); + }; return nil; })(), 'map', [], (TMP_77 = function(entry){var self = TMP_77.$$s || this, $a, $b, negate = nil, delim = nil, from = nil, to = nil, line_nums = nil; + + + + if (entry == null) { + entry = nil; + }; + negate = false; + if ($truthy(entry['$start_with?']("!"))) { + + entry = entry.$slice(1, entry.$length()); + negate = true;}; + if ($truthy((delim = (function() {if ($truthy(entry['$include?'](".."))) { + return ".." + } else { + + if ($truthy(entry['$include?']("-"))) { + return "-" + } else { + return nil + }; + }; return nil; })()))) { + + $b = entry.$split(delim, 2), $a = Opal.to_ary($b), (from = ($a[0] == null ? nil : $a[0])), (to = ($a[1] == null ? nil : $a[1])), $b; + if ($truthy(($truthy($a = to['$empty?']()) ? $a : $rb_lt((to = to.$to_i()), 0)))) { + to = $rb_plus(source.$count($$($nesting, 'LF')), 1)}; + line_nums = $$$('::', 'Range').$new(from.$to_i(), to).$to_a(); + if ($truthy(negate)) { + return (lines = $rb_minus(lines, line_nums)) + } else { + return lines.$concat(line_nums) + }; + } else if ($truthy(negate)) { + return lines.$delete(entry.$to_i()) + } else { + return lines['$<<'](entry.$to_i()) + };}, TMP_77.$$s = self, TMP_77.$$arity = 1, TMP_77)); + return lines.$sort().$uniq(); + }, TMP_Substitutors_resolve_lines_to_highlight_76.$$arity = 2); + + Opal.def(self, '$sub_source', TMP_Substitutors_sub_source_78 = function $$sub_source(source, process_callouts) { + var self = this; + + if ($truthy(process_callouts)) { + return self.$sub_callouts(self.$sub_specialchars(source)) + } else { + + return self.$sub_specialchars(source); + } + }, TMP_Substitutors_sub_source_78.$$arity = 2); + + Opal.def(self, '$lock_in_subs', TMP_Substitutors_lock_in_subs_79 = function $$lock_in_subs() { + var $a, $b, $c, $d, $e, self = this, default_subs = nil, $case = nil, custom_subs = nil, idx = nil, $writer = nil; + if (self.default_subs == null) self.default_subs = nil; + if (self.content_model == null) self.content_model = nil; + if (self.context == null) self.context = nil; + if (self.subs == null) self.subs = nil; + if (self.attributes == null) self.attributes = nil; + if (self.style == null) self.style = nil; + if (self.document == null) self.document = nil; + + + if ($truthy((default_subs = self.default_subs))) { + } else { + $case = self.content_model; + if ("simple"['$===']($case)) {default_subs = $$($nesting, 'NORMAL_SUBS')} + else if ("verbatim"['$===']($case)) {if ($truthy(($truthy($a = self.context['$==']("listing")) ? $a : (($b = self.context['$==']("literal")) ? self['$option?']("listparagraph")['$!']() : self.context['$==']("literal"))))) { + default_subs = $$($nesting, 'VERBATIM_SUBS') + } else if (self.context['$==']("verse")) { + default_subs = $$($nesting, 'NORMAL_SUBS') + } else { + default_subs = $$($nesting, 'BASIC_SUBS') + }} + else if ("raw"['$===']($case)) {default_subs = (function() {if (self.context['$==']("stem")) { + return $$($nesting, 'BASIC_SUBS') + } else { + return $$($nesting, 'NONE_SUBS') + }; return nil; })()} + else {return self.subs} + }; + if ($truthy((custom_subs = self.attributes['$[]']("subs")))) { + self.subs = ($truthy($a = self.$resolve_block_subs(custom_subs, default_subs, self.context)) ? $a : []) + } else { + self.subs = default_subs.$drop(0) + }; + if ($truthy(($truthy($a = ($truthy($b = ($truthy($c = ($truthy($d = (($e = self.context['$==']("listing")) ? self.style['$==']("source") : self.context['$==']("listing"))) ? self.attributes['$key?']("language") : $d)) ? self.document['$basebackend?']("html") : $c)) ? $$($nesting, 'SUB_HIGHLIGHT')['$include?'](self.document.$attributes()['$[]']("source-highlighter")) : $b)) ? (idx = self.subs.$index("specialcharacters")) : $a))) { + + $writer = [idx, "highlight"]; + $send(self.subs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + return self.subs; + }, TMP_Substitutors_lock_in_subs_79.$$arity = 0); + })($nesting[0], $nesting) + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/abstract_node"] = function(Opal) { + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + function $rb_plus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); + } + function $rb_lt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $hash2 = Opal.hash2, $truthy = Opal.truthy, $send = Opal.send; + + Opal.add_stubs(['$include', '$attr_reader', '$attr_accessor', '$==', '$document', '$to_s', '$key?', '$dup', '$[]', '$raise', '$converter', '$attributes', '$nil?', '$[]=', '$-', '$delete', '$+', '$update', '$nil_or_empty?', '$split', '$include?', '$empty?', '$join', '$apply_reftext_subs', '$attr?', '$extname', '$attr', '$image_uri', '$<', '$safe', '$uriish?', '$uri_encode_spaces', '$normalize_web_path', '$generate_data_uri_from_uri', '$generate_data_uri', '$slice', '$length', '$normalize_system_path', '$readable?', '$strict_encode64', '$binread', '$warn', '$logger', '$require_library', '$!', '$open', '$content_type', '$read', '$base_dir', '$root?', '$path_resolver', '$system_path', '$web_path', '$===', '$!=', '$normalize_lines_array', '$to_a', '$each_line', '$open_uri', '$fetch', '$read_asset', '$gsub']); + return (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + (function($base, $super, $parent_nesting) { + function $AbstractNode(){}; + var self = $AbstractNode = $klass($base, $super, 'AbstractNode', $AbstractNode); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_AbstractNode_initialize_1, TMP_AbstractNode_block$q_2, TMP_AbstractNode_inline$q_3, TMP_AbstractNode_converter_4, TMP_AbstractNode_parent$eq_5, TMP_AbstractNode_attr_6, TMP_AbstractNode_attr$q_7, TMP_AbstractNode_set_attr_8, TMP_AbstractNode_remove_attr_9, TMP_AbstractNode_option$q_10, TMP_AbstractNode_set_option_11, TMP_AbstractNode_update_attributes_12, TMP_AbstractNode_role_13, TMP_AbstractNode_roles_14, TMP_AbstractNode_role$q_15, TMP_AbstractNode_has_role$q_16, TMP_AbstractNode_add_role_17, TMP_AbstractNode_remove_role_18, TMP_AbstractNode_reftext_19, TMP_AbstractNode_reftext$q_20, TMP_AbstractNode_icon_uri_21, TMP_AbstractNode_image_uri_22, TMP_AbstractNode_media_uri_23, TMP_AbstractNode_generate_data_uri_24, TMP_AbstractNode_generate_data_uri_from_uri_25, TMP_AbstractNode_normalize_asset_path_27, TMP_AbstractNode_normalize_system_path_28, TMP_AbstractNode_normalize_web_path_29, TMP_AbstractNode_read_asset_30, TMP_AbstractNode_read_contents_32, TMP_AbstractNode_uri_encode_spaces_35, TMP_AbstractNode_is_uri$q_36; + + def.document = def.attributes = def.parent = nil; + + self.$include($$($nesting, 'Logging')); + self.$include($$($nesting, 'Substitutors')); + self.$attr_reader("attributes"); + self.$attr_reader("context"); + self.$attr_reader("document"); + self.$attr_accessor("id"); + self.$attr_reader("node_name"); + self.$attr_reader("parent"); + + Opal.def(self, '$initialize', TMP_AbstractNode_initialize_1 = function $$initialize(parent, context, opts) { + var $a, self = this; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + if (context['$==']("document")) { + $a = [self, nil], (self.document = $a[0]), (self.parent = $a[1]), $a + } else if ($truthy(parent)) { + $a = [parent.$document(), parent], (self.document = $a[0]), (self.parent = $a[1]), $a + } else { + self.document = (self.parent = nil) + }; + self.node_name = (self.context = context).$to_s(); + self.attributes = (function() {if ($truthy(opts['$key?']("attributes"))) { + return opts['$[]']("attributes").$dup() + } else { + return $hash2([], {}) + }; return nil; })(); + return (self.passthroughs = $hash2([], {})); + }, TMP_AbstractNode_initialize_1.$$arity = -3); + + Opal.def(self, '$block?', TMP_AbstractNode_block$q_2 = function() { + var self = this; + + return self.$raise($$$('::', 'NotImplementedError')) + }, TMP_AbstractNode_block$q_2.$$arity = 0); + + Opal.def(self, '$inline?', TMP_AbstractNode_inline$q_3 = function() { + var self = this; + + return self.$raise($$$('::', 'NotImplementedError')) + }, TMP_AbstractNode_inline$q_3.$$arity = 0); + + Opal.def(self, '$converter', TMP_AbstractNode_converter_4 = function $$converter() { + var self = this; + + return self.document.$converter() + }, TMP_AbstractNode_converter_4.$$arity = 0); + + Opal.def(self, '$parent=', TMP_AbstractNode_parent$eq_5 = function(parent) { + var $a, self = this; + + return $a = [parent, parent.$document()], (self.parent = $a[0]), (self.document = $a[1]), $a + }, TMP_AbstractNode_parent$eq_5.$$arity = 1); + + Opal.def(self, '$attr', TMP_AbstractNode_attr_6 = function $$attr(name, default_val, inherit) { + var $a, $b, self = this; + + + + if (default_val == null) { + default_val = nil; + }; + + if (inherit == null) { + inherit = true; + }; + name = name.$to_s(); + return ($truthy($a = self.attributes['$[]'](name)) ? $a : (function() {if ($truthy(($truthy($b = inherit) ? self.parent : $b))) { + return ($truthy($b = self.document.$attributes()['$[]'](name)) ? $b : default_val) + } else { + return default_val + }; return nil; })()); + }, TMP_AbstractNode_attr_6.$$arity = -2); + + Opal.def(self, '$attr?', TMP_AbstractNode_attr$q_7 = function(name, expect_val, inherit) { + var $a, $b, $c, self = this; + + + + if (expect_val == null) { + expect_val = nil; + }; + + if (inherit == null) { + inherit = true; + }; + name = name.$to_s(); + if ($truthy(expect_val['$nil?']())) { + return ($truthy($a = self.attributes['$key?'](name)) ? $a : ($truthy($b = ($truthy($c = inherit) ? self.parent : $c)) ? self.document.$attributes()['$key?'](name) : $b)) + } else { + return expect_val['$=='](($truthy($a = self.attributes['$[]'](name)) ? $a : (function() {if ($truthy(($truthy($b = inherit) ? self.parent : $b))) { + return self.document.$attributes()['$[]'](name) + } else { + return nil + }; return nil; })())) + }; + }, TMP_AbstractNode_attr$q_7.$$arity = -2); + + Opal.def(self, '$set_attr', TMP_AbstractNode_set_attr_8 = function $$set_attr(name, value, overwrite) { + var $a, self = this, $writer = nil; + + + + if (value == null) { + value = ""; + }; + + if (overwrite == null) { + overwrite = true; + }; + if ($truthy((($a = overwrite['$=='](false)) ? self.attributes['$key?'](name) : overwrite['$=='](false)))) { + return false + } else { + + + $writer = [name, value]; + $send(self.attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + return true; + }; + }, TMP_AbstractNode_set_attr_8.$$arity = -2); + + Opal.def(self, '$remove_attr', TMP_AbstractNode_remove_attr_9 = function $$remove_attr(name) { + var self = this; + + return self.attributes.$delete(name) + }, TMP_AbstractNode_remove_attr_9.$$arity = 1); + + Opal.def(self, '$option?', TMP_AbstractNode_option$q_10 = function(name) { + var self = this; + + return self.attributes['$key?']("" + (name) + "-option") + }, TMP_AbstractNode_option$q_10.$$arity = 1); + + Opal.def(self, '$set_option', TMP_AbstractNode_set_option_11 = function $$set_option(name) { + var self = this, attrs = nil, key = nil, $writer = nil; + + if ($truthy((attrs = self.attributes)['$[]']("options"))) { + if ($truthy(attrs['$[]']((key = "" + (name) + "-option")))) { + return nil + } else { + + + $writer = ["options", $rb_plus(attrs['$[]']("options"), "" + "," + (name))]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = [key, ""]; + $send(attrs, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];; + } + } else { + + + $writer = ["options", name]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["" + (name) + "-option", ""]; + $send(attrs, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];; + } + }, TMP_AbstractNode_set_option_11.$$arity = 1); + + Opal.def(self, '$update_attributes', TMP_AbstractNode_update_attributes_12 = function $$update_attributes(attributes) { + var self = this; + + + self.attributes.$update(attributes); + return nil; + }, TMP_AbstractNode_update_attributes_12.$$arity = 1); + + Opal.def(self, '$role', TMP_AbstractNode_role_13 = function $$role() { + var $a, self = this; + + return ($truthy($a = self.attributes['$[]']("role")) ? $a : self.document.$attributes()['$[]']("role")) + }, TMP_AbstractNode_role_13.$$arity = 0); + + Opal.def(self, '$roles', TMP_AbstractNode_roles_14 = function $$roles() { + var $a, self = this, val = nil; + + if ($truthy((val = ($truthy($a = self.attributes['$[]']("role")) ? $a : self.document.$attributes()['$[]']("role")))['$nil_or_empty?']())) { + return [] + } else { + return val.$split() + } + }, TMP_AbstractNode_roles_14.$$arity = 0); + + Opal.def(self, '$role?', TMP_AbstractNode_role$q_15 = function(expect_val) { + var $a, self = this; + + + + if (expect_val == null) { + expect_val = nil; + }; + if ($truthy(expect_val)) { + return expect_val['$=='](($truthy($a = self.attributes['$[]']("role")) ? $a : self.document.$attributes()['$[]']("role"))) + } else { + return ($truthy($a = self.attributes['$key?']("role")) ? $a : self.document.$attributes()['$key?']("role")) + }; + }, TMP_AbstractNode_role$q_15.$$arity = -1); + + Opal.def(self, '$has_role?', TMP_AbstractNode_has_role$q_16 = function(name) { + var $a, self = this, val = nil; + + if ($truthy((val = ($truthy($a = self.attributes['$[]']("role")) ? $a : self.document.$attributes()['$[]']("role"))))) { + return ((("" + " ") + (val)) + " ")['$include?']("" + " " + (name) + " ") + } else { + return false + } + }, TMP_AbstractNode_has_role$q_16.$$arity = 1); + + Opal.def(self, '$add_role', TMP_AbstractNode_add_role_17 = function $$add_role(name) { + var self = this, val = nil, $writer = nil; + + if ($truthy((val = self.attributes['$[]']("role"))['$nil_or_empty?']())) { + + + $writer = ["role", name]; + $send(self.attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + return true; + } else if ($truthy(((("" + " ") + (val)) + " ")['$include?']("" + " " + (name) + " "))) { + return false + } else { + + + $writer = ["role", "" + (val) + " " + (name)]; + $send(self.attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + return true; + } + }, TMP_AbstractNode_add_role_17.$$arity = 1); + + Opal.def(self, '$remove_role', TMP_AbstractNode_remove_role_18 = function $$remove_role(name) { + var self = this, val = nil, $writer = nil; + + if ($truthy((val = self.attributes['$[]']("role"))['$nil_or_empty?']())) { + return false + } else if ($truthy((val = val.$split()).$delete(name))) { + + if ($truthy(val['$empty?']())) { + self.attributes.$delete("role") + } else { + + $writer = ["role", val.$join(" ")]; + $send(self.attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + return true; + } else { + return false + } + }, TMP_AbstractNode_remove_role_18.$$arity = 1); + + Opal.def(self, '$reftext', TMP_AbstractNode_reftext_19 = function $$reftext() { + var self = this, val = nil; + + if ($truthy((val = self.attributes['$[]']("reftext")))) { + + return self.$apply_reftext_subs(val); + } else { + return nil + } + }, TMP_AbstractNode_reftext_19.$$arity = 0); + + Opal.def(self, '$reftext?', TMP_AbstractNode_reftext$q_20 = function() { + var self = this; + + return self.attributes['$key?']("reftext") + }, TMP_AbstractNode_reftext$q_20.$$arity = 0); + + Opal.def(self, '$icon_uri', TMP_AbstractNode_icon_uri_21 = function $$icon_uri(name) { + var self = this, icon = nil; + + + if ($truthy(self['$attr?']("icon"))) { + if ($truthy($$$('::', 'File').$extname((icon = self.$attr("icon")))['$empty?']())) { + icon = "" + (icon) + "." + (self.document.$attr("icontype", "png"))} + } else { + icon = "" + (name) + "." + (self.document.$attr("icontype", "png")) + }; + return self.$image_uri(icon, "iconsdir"); + }, TMP_AbstractNode_icon_uri_21.$$arity = 1); + + Opal.def(self, '$image_uri', TMP_AbstractNode_image_uri_22 = function $$image_uri(target_image, asset_dir_key) { + var $a, $b, $c, $d, self = this, doc = nil, images_base = nil; + + + + if (asset_dir_key == null) { + asset_dir_key = "imagesdir"; + }; + if ($truthy(($truthy($a = $rb_lt((doc = self.document).$safe(), $$$($$($nesting, 'SafeMode'), 'SECURE'))) ? doc['$attr?']("data-uri") : $a))) { + if ($truthy(($truthy($a = ($truthy($b = $$($nesting, 'Helpers')['$uriish?'](target_image)) ? (target_image = self.$uri_encode_spaces(target_image)) : $b)) ? $a : ($truthy($b = ($truthy($c = ($truthy($d = asset_dir_key) ? (images_base = doc.$attr(asset_dir_key)) : $d)) ? $$($nesting, 'Helpers')['$uriish?'](images_base) : $c)) ? (target_image = self.$normalize_web_path(target_image, images_base, false)) : $b)))) { + if ($truthy(doc['$attr?']("allow-uri-read"))) { + return self.$generate_data_uri_from_uri(target_image, doc['$attr?']("cache-uri")) + } else { + return target_image + } + } else { + return self.$generate_data_uri(target_image, asset_dir_key) + } + } else { + return self.$normalize_web_path(target_image, (function() {if ($truthy(asset_dir_key)) { + + return doc.$attr(asset_dir_key); + } else { + return nil + }; return nil; })()) + }; + }, TMP_AbstractNode_image_uri_22.$$arity = -2); + + Opal.def(self, '$media_uri', TMP_AbstractNode_media_uri_23 = function $$media_uri(target, asset_dir_key) { + var self = this; + + + + if (asset_dir_key == null) { + asset_dir_key = "imagesdir"; + }; + return self.$normalize_web_path(target, (function() {if ($truthy(asset_dir_key)) { + return self.document.$attr(asset_dir_key) + } else { + return nil + }; return nil; })()); + }, TMP_AbstractNode_media_uri_23.$$arity = -2); + + Opal.def(self, '$generate_data_uri', TMP_AbstractNode_generate_data_uri_24 = function $$generate_data_uri(target_image, asset_dir_key) { + var self = this, ext = nil, mimetype = nil, image_path = nil; + + + + if (asset_dir_key == null) { + asset_dir_key = nil; + }; + ext = $$$('::', 'File').$extname(target_image); + mimetype = (function() {if (ext['$=='](".svg")) { + return "image/svg+xml" + } else { + return "" + "image/" + (ext.$slice(1, ext.$length())) + }; return nil; })(); + if ($truthy(asset_dir_key)) { + image_path = self.$normalize_system_path(target_image, self.document.$attr(asset_dir_key), nil, $hash2(["target_name"], {"target_name": "image"})) + } else { + image_path = self.$normalize_system_path(target_image) + }; + if ($truthy($$$('::', 'File')['$readable?'](image_path))) { + return "" + "data:" + (mimetype) + ";base64," + ($$$('::', 'Base64').$strict_encode64($$$('::', 'IO').$binread(image_path))) + } else { + + self.$logger().$warn("" + "image to embed not found or not readable: " + (image_path)); + return "" + "data:" + (mimetype) + ";base64,"; + }; + }, TMP_AbstractNode_generate_data_uri_24.$$arity = -2); + + Opal.def(self, '$generate_data_uri_from_uri', TMP_AbstractNode_generate_data_uri_from_uri_25 = function $$generate_data_uri_from_uri(image_uri, cache_uri) { + var TMP_26, self = this, mimetype = nil, bindata = nil; + + + + if (cache_uri == null) { + cache_uri = false; + }; + if ($truthy(cache_uri)) { + $$($nesting, 'Helpers').$require_library("open-uri/cached", "open-uri-cached") + } else if ($truthy($$$('::', 'RUBY_ENGINE_OPAL')['$!']())) { + $$$('::', 'OpenURI')}; + + try { + + mimetype = nil; + bindata = $send(self, 'open', [image_uri, "rb"], (TMP_26 = function(f){var self = TMP_26.$$s || this; + + + + if (f == null) { + f = nil; + }; + mimetype = f.$content_type(); + return f.$read();}, TMP_26.$$s = self, TMP_26.$$arity = 1, TMP_26)); + return "" + "data:" + (mimetype) + ";base64," + ($$$('::', 'Base64').$strict_encode64(bindata)); + } catch ($err) { + if (Opal.rescue($err, [$$($nesting, 'StandardError')])) { + try { + + self.$logger().$warn("" + "could not retrieve image data from URI: " + (image_uri)); + return image_uri; + } finally { Opal.pop_exception() } + } else { throw $err; } + };; + }, TMP_AbstractNode_generate_data_uri_from_uri_25.$$arity = -2); + + Opal.def(self, '$normalize_asset_path', TMP_AbstractNode_normalize_asset_path_27 = function $$normalize_asset_path(asset_ref, asset_name, autocorrect) { + var self = this; + + + + if (asset_name == null) { + asset_name = "path"; + }; + + if (autocorrect == null) { + autocorrect = true; + }; + return self.$normalize_system_path(asset_ref, self.document.$base_dir(), nil, $hash2(["target_name", "recover"], {"target_name": asset_name, "recover": autocorrect})); + }, TMP_AbstractNode_normalize_asset_path_27.$$arity = -2); + + Opal.def(self, '$normalize_system_path', TMP_AbstractNode_normalize_system_path_28 = function $$normalize_system_path(target, start, jail, opts) { + var self = this, doc = nil; + + + + if (start == null) { + start = nil; + }; + + if (jail == null) { + jail = nil; + }; + + if (opts == null) { + opts = $hash2([], {}); + }; + if ($truthy($rb_lt((doc = self.document).$safe(), $$$($$($nesting, 'SafeMode'), 'SAFE')))) { + if ($truthy(start)) { + if ($truthy(doc.$path_resolver()['$root?'](start))) { + } else { + start = $$$('::', 'File').$join(doc.$base_dir(), start) + } + } else { + start = doc.$base_dir() + } + } else { + + if ($truthy(start)) { + } else { + start = doc.$base_dir() + }; + if ($truthy(jail)) { + } else { + jail = doc.$base_dir() + }; + }; + return doc.$path_resolver().$system_path(target, start, jail, opts); + }, TMP_AbstractNode_normalize_system_path_28.$$arity = -2); + + Opal.def(self, '$normalize_web_path', TMP_AbstractNode_normalize_web_path_29 = function $$normalize_web_path(target, start, preserve_uri_target) { + var $a, self = this; + + + + if (start == null) { + start = nil; + }; + + if (preserve_uri_target == null) { + preserve_uri_target = true; + }; + if ($truthy(($truthy($a = preserve_uri_target) ? $$($nesting, 'Helpers')['$uriish?'](target) : $a))) { + return self.$uri_encode_spaces(target) + } else { + return self.document.$path_resolver().$web_path(target, start) + }; + }, TMP_AbstractNode_normalize_web_path_29.$$arity = -2); + + Opal.def(self, '$read_asset', TMP_AbstractNode_read_asset_30 = function $$read_asset(path, opts) { + var TMP_31, $a, self = this; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + if ($truthy($$$('::', 'Hash')['$==='](opts))) { + } else { + opts = $hash2(["warn_on_failure"], {"warn_on_failure": opts['$!='](false)}) + }; + if ($truthy($$$('::', 'File')['$readable?'](path))) { + if ($truthy(opts['$[]']("normalize"))) { + return $$($nesting, 'Helpers').$normalize_lines_array($send($$$('::', 'File'), 'open', [path, "rb"], (TMP_31 = function(f){var self = TMP_31.$$s || this; + + + + if (f == null) { + f = nil; + }; + return f.$each_line().$to_a();}, TMP_31.$$s = self, TMP_31.$$arity = 1, TMP_31))).$join($$($nesting, 'LF')) + } else { + return $$$('::', 'IO').$read(path) + } + } else if ($truthy(opts['$[]']("warn_on_failure"))) { + + self.$logger().$warn("" + (($truthy($a = self.$attr("docfile")) ? $a : "")) + ": " + (($truthy($a = opts['$[]']("label")) ? $a : "file")) + " does not exist or cannot be read: " + (path)); + return nil; + } else { + return nil + }; + }, TMP_AbstractNode_read_asset_30.$$arity = -2); + + Opal.def(self, '$read_contents', TMP_AbstractNode_read_contents_32 = function $$read_contents(target, opts) { + var $a, $b, $c, TMP_33, TMP_34, self = this, doc = nil, start = nil; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + doc = self.document; + if ($truthy(($truthy($a = $$($nesting, 'Helpers')['$uriish?'](target)) ? $a : ($truthy($b = ($truthy($c = (start = opts['$[]']("start"))) ? $$($nesting, 'Helpers')['$uriish?'](start) : $c)) ? (target = doc.$path_resolver().$web_path(target, start)) : $b)))) { + if ($truthy(doc['$attr?']("allow-uri-read"))) { + + if ($truthy(doc['$attr?']("cache-uri"))) { + $$($nesting, 'Helpers').$require_library("open-uri/cached", "open-uri-cached")}; + + try { + if ($truthy(opts['$[]']("normalize"))) { + return $$($nesting, 'Helpers').$normalize_lines_array($send($$$('::', 'OpenURI'), 'open_uri', [target], (TMP_33 = function(f){var self = TMP_33.$$s || this; + + + + if (f == null) { + f = nil; + }; + return f.$each_line().$to_a();}, TMP_33.$$s = self, TMP_33.$$arity = 1, TMP_33))).$join($$($nesting, 'LF')) + } else { + return $send($$$('::', 'OpenURI'), 'open_uri', [target], (TMP_34 = function(f){var self = TMP_34.$$s || this; + + + + if (f == null) { + f = nil; + }; + return f.$read();}, TMP_34.$$s = self, TMP_34.$$arity = 1, TMP_34)) + } + } catch ($err) { + if (Opal.rescue($err, [$$($nesting, 'StandardError')])) { + try { + + if ($truthy(opts.$fetch("warn_on_failure", true))) { + self.$logger().$warn("" + "could not retrieve contents of " + (($truthy($a = opts['$[]']("label")) ? $a : "asset")) + " at URI: " + (target))}; + return nil; + } finally { Opal.pop_exception() } + } else { throw $err; } + };; + } else { + + if ($truthy(opts.$fetch("warn_on_failure", true))) { + self.$logger().$warn("" + "cannot retrieve contents of " + (($truthy($a = opts['$[]']("label")) ? $a : "asset")) + " at URI: " + (target) + " (allow-uri-read attribute not enabled)")}; + return nil; + } + } else { + + target = self.$normalize_system_path(target, opts['$[]']("start"), nil, $hash2(["target_name"], {"target_name": ($truthy($a = opts['$[]']("label")) ? $a : "asset")})); + return self.$read_asset(target, $hash2(["normalize", "warn_on_failure", "label"], {"normalize": opts['$[]']("normalize"), "warn_on_failure": opts.$fetch("warn_on_failure", true), "label": opts['$[]']("label")})); + }; + }, TMP_AbstractNode_read_contents_32.$$arity = -2); + + Opal.def(self, '$uri_encode_spaces', TMP_AbstractNode_uri_encode_spaces_35 = function $$uri_encode_spaces(str) { + var self = this; + + if ($truthy(str['$include?'](" "))) { + + return str.$gsub(" ", "%20"); + } else { + return str + } + }, TMP_AbstractNode_uri_encode_spaces_35.$$arity = 1); + return (Opal.def(self, '$is_uri?', TMP_AbstractNode_is_uri$q_36 = function(str) { + var self = this; + + return $$($nesting, 'Helpers')['$uriish?'](str) + }, TMP_AbstractNode_is_uri$q_36.$$arity = 1), nil) && 'is_uri?'; + })($nesting[0], null, $nesting) + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/abstract_block"] = function(Opal) { + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + function $rb_gt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); + } + function $rb_plus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $hash2 = Opal.hash2, $send = Opal.send, $truthy = Opal.truthy; + + Opal.add_stubs(['$attr_reader', '$attr_writer', '$attr_accessor', '$==', '$!=', '$level', '$file', '$lineno', '$playback_attributes', '$convert', '$converter', '$join', '$map', '$to_s', '$parent', '$parent=', '$-', '$<<', '$!', '$empty?', '$>', '$find_by_internal', '$to_proc', '$[]', '$has_role?', '$replace', '$raise', '$===', '$header?', '$each', '$flatten', '$context', '$blocks', '$+', '$find_index', '$next_adjacent_block', '$select', '$sub_specialchars', '$match?', '$sub_replacements', '$title', '$apply_title_subs', '$include?', '$delete', '$reftext', '$sprintf', '$sub_quotes', '$compat_mode', '$attributes', '$chomp', '$increment_and_store_counter', '$index=', '$numbered', '$sectname', '$counter', '$numeral=', '$numeral', '$caption=', '$assign_numeral', '$reindex_sections']); + return (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + (function($base, $super, $parent_nesting) { + function $AbstractBlock(){}; + var self = $AbstractBlock = $klass($base, $super, 'AbstractBlock', $AbstractBlock); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_AbstractBlock_initialize_1, TMP_AbstractBlock_block$q_2, TMP_AbstractBlock_inline$q_3, TMP_AbstractBlock_file_4, TMP_AbstractBlock_lineno_5, TMP_AbstractBlock_convert_6, TMP_AbstractBlock_content_7, TMP_AbstractBlock_context$eq_9, TMP_AbstractBlock_$lt$lt_10, TMP_AbstractBlock_blocks$q_11, TMP_AbstractBlock_sections$q_12, TMP_AbstractBlock_find_by_13, TMP_AbstractBlock_find_by_internal_14, TMP_AbstractBlock_next_adjacent_block_17, TMP_AbstractBlock_sections_18, TMP_AbstractBlock_alt_20, TMP_AbstractBlock_caption_21, TMP_AbstractBlock_captioned_title_22, TMP_AbstractBlock_list_marker_keyword_23, TMP_AbstractBlock_title_24, TMP_AbstractBlock_title$q_25, TMP_AbstractBlock_title$eq_26, TMP_AbstractBlock_sub$q_27, TMP_AbstractBlock_remove_sub_28, TMP_AbstractBlock_xreftext_29, TMP_AbstractBlock_assign_caption_30, TMP_AbstractBlock_assign_numeral_31, TMP_AbstractBlock_reindex_sections_32; + + def.source_location = def.document = def.attributes = def.blocks = def.next_section_index = def.context = def.style = def.id = def.header = def.caption = def.title_converted = def.converted_title = def.title = def.subs = def.numeral = def.next_section_ordinal = nil; + + self.$attr_reader("blocks"); + self.$attr_writer("caption"); + self.$attr_accessor("content_model"); + self.$attr_accessor("level"); + self.$attr_accessor("numeral"); + Opal.alias(self, "number", "numeral"); + Opal.alias(self, "number=", "numeral="); + self.$attr_accessor("source_location"); + self.$attr_accessor("style"); + self.$attr_reader("subs"); + + Opal.def(self, '$initialize', TMP_AbstractBlock_initialize_1 = function $$initialize(parent, context, opts) { + var $a, $iter = TMP_AbstractBlock_initialize_1.$$p, $yield = $iter || nil, self = this, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_AbstractBlock_initialize_1.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + + + if (opts == null) { + opts = $hash2([], {}); + }; + $send(self, Opal.find_super_dispatcher(self, 'initialize', TMP_AbstractBlock_initialize_1, false), $zuper, $iter); + self.content_model = "compound"; + self.blocks = []; + self.subs = []; + self.id = (self.title = (self.title_converted = (self.caption = (self.numeral = (self.style = (self.default_subs = (self.source_location = nil))))))); + if (context['$==']("document")) { + self.level = 0 + } else if ($truthy(($truthy($a = parent) ? context['$!=']("section") : $a))) { + self.level = parent.$level() + } else { + self.level = nil + }; + self.next_section_index = 0; + return (self.next_section_ordinal = 1); + }, TMP_AbstractBlock_initialize_1.$$arity = -3); + + Opal.def(self, '$block?', TMP_AbstractBlock_block$q_2 = function() { + var self = this; + + return true + }, TMP_AbstractBlock_block$q_2.$$arity = 0); + + Opal.def(self, '$inline?', TMP_AbstractBlock_inline$q_3 = function() { + var self = this; + + return false + }, TMP_AbstractBlock_inline$q_3.$$arity = 0); + + Opal.def(self, '$file', TMP_AbstractBlock_file_4 = function $$file() { + var $a, self = this; + + return ($truthy($a = self.source_location) ? self.source_location.$file() : $a) + }, TMP_AbstractBlock_file_4.$$arity = 0); + + Opal.def(self, '$lineno', TMP_AbstractBlock_lineno_5 = function $$lineno() { + var $a, self = this; + + return ($truthy($a = self.source_location) ? self.source_location.$lineno() : $a) + }, TMP_AbstractBlock_lineno_5.$$arity = 0); + + Opal.def(self, '$convert', TMP_AbstractBlock_convert_6 = function $$convert() { + var self = this; + + + self.document.$playback_attributes(self.attributes); + return self.$converter().$convert(self); + }, TMP_AbstractBlock_convert_6.$$arity = 0); + Opal.alias(self, "render", "convert"); + + Opal.def(self, '$content', TMP_AbstractBlock_content_7 = function $$content() { + var TMP_8, self = this; + + return $send(self.blocks, 'map', [], (TMP_8 = function(b){var self = TMP_8.$$s || this; + + + + if (b == null) { + b = nil; + }; + return b.$convert();}, TMP_8.$$s = self, TMP_8.$$arity = 1, TMP_8)).$join($$($nesting, 'LF')) + }, TMP_AbstractBlock_content_7.$$arity = 0); + + Opal.def(self, '$context=', TMP_AbstractBlock_context$eq_9 = function(context) { + var self = this; + + return (self.node_name = (self.context = context).$to_s()) + }, TMP_AbstractBlock_context$eq_9.$$arity = 1); + + Opal.def(self, '$<<', TMP_AbstractBlock_$lt$lt_10 = function(block) { + var self = this, $writer = nil; + + + if (block.$parent()['$=='](self)) { + } else { + + $writer = [self]; + $send(block, 'parent=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + self.blocks['$<<'](block); + return self; + }, TMP_AbstractBlock_$lt$lt_10.$$arity = 1); + Opal.alias(self, "append", "<<"); + + Opal.def(self, '$blocks?', TMP_AbstractBlock_blocks$q_11 = function() { + var self = this; + + return self.blocks['$empty?']()['$!']() + }, TMP_AbstractBlock_blocks$q_11.$$arity = 0); + + Opal.def(self, '$sections?', TMP_AbstractBlock_sections$q_12 = function() { + var self = this; + + return $rb_gt(self.next_section_index, 0) + }, TMP_AbstractBlock_sections$q_12.$$arity = 0); + + Opal.def(self, '$find_by', TMP_AbstractBlock_find_by_13 = function $$find_by(selector) { + var $iter = TMP_AbstractBlock_find_by_13.$$p, block = $iter || nil, self = this, result = nil; + + if ($iter) TMP_AbstractBlock_find_by_13.$$p = null; + + + if ($iter) TMP_AbstractBlock_find_by_13.$$p = null;; + + if (selector == null) { + selector = $hash2([], {}); + }; + try { + return $send(self, 'find_by_internal', [selector, (result = [])], block.$to_proc()) + } catch ($err) { + if (Opal.rescue($err, [$$$('::', 'StopIteration')])) { + try { + return result + } finally { Opal.pop_exception() } + } else { throw $err; } + }; + }, TMP_AbstractBlock_find_by_13.$$arity = -1); + Opal.alias(self, "query", "find_by"); + + Opal.def(self, '$find_by_internal', TMP_AbstractBlock_find_by_internal_14 = function $$find_by_internal(selector, result) { + var $iter = TMP_AbstractBlock_find_by_internal_14.$$p, block = $iter || nil, $a, $b, $c, $d, TMP_15, TMP_16, self = this, any_context = nil, context_selector = nil, style_selector = nil, role_selector = nil, id_selector = nil, verdict = nil, $case = nil; + + if ($iter) TMP_AbstractBlock_find_by_internal_14.$$p = null; + + + if ($iter) TMP_AbstractBlock_find_by_internal_14.$$p = null;; + + if (selector == null) { + selector = $hash2([], {}); + }; + + if (result == null) { + result = []; + }; + if ($truthy(($truthy($a = ($truthy($b = ($truthy($c = ($truthy($d = (any_context = (context_selector = selector['$[]']("context"))['$!']())) ? $d : context_selector['$=='](self.context))) ? ($truthy($d = (style_selector = selector['$[]']("style"))['$!']()) ? $d : style_selector['$=='](self.style)) : $c)) ? ($truthy($c = (role_selector = selector['$[]']("role"))['$!']()) ? $c : self['$has_role?'](role_selector)) : $b)) ? ($truthy($b = (id_selector = selector['$[]']("id"))['$!']()) ? $b : id_selector['$=='](self.id)) : $a))) { + if ($truthy(id_selector)) { + + result.$replace((function() {if ((block !== nil)) { + + if ($truthy(Opal.yield1(block, self))) { + return [self] + } else { + return [] + }; + } else { + return [self] + }; return nil; })()); + self.$raise($$$('::', 'StopIteration')); + } else if ((block !== nil)) { + if ($truthy((verdict = Opal.yield1(block, self)))) { + $case = verdict; + if ("skip_children"['$===']($case)) { + result['$<<'](self); + return result;} + else if ("skip"['$===']($case)) {return result} + else {result['$<<'](self)}} + } else { + result['$<<'](self) + }}; + if ($truthy(($truthy($a = (($b = self.context['$==']("document")) ? ($truthy($c = any_context) ? $c : context_selector['$==']("section")) : self.context['$==']("document"))) ? self['$header?']() : $a))) { + $send(self.header, 'find_by_internal', [selector, result], block.$to_proc())}; + if (context_selector['$==']("document")) { + } else if (self.context['$==']("dlist")) { + if ($truthy(($truthy($a = any_context) ? $a : context_selector['$!=']("section")))) { + $send(self.blocks.$flatten(), 'each', [], (TMP_15 = function(li){var self = TMP_15.$$s || this; + + + + if (li == null) { + li = nil; + }; + if ($truthy(li)) { + return $send(li, 'find_by_internal', [selector, result], block.$to_proc()) + } else { + return nil + };}, TMP_15.$$s = self, TMP_15.$$arity = 1, TMP_15))} + } else if ($truthy($send(self.blocks, 'each', [], (TMP_16 = function(b){var self = TMP_16.$$s || this, $e; + + + + if (b == null) { + b = nil; + }; + if ($truthy((($e = context_selector['$==']("section")) ? b.$context()['$!=']("section") : context_selector['$==']("section")))) { + return nil;}; + return $send(b, 'find_by_internal', [selector, result], block.$to_proc());}, TMP_16.$$s = self, TMP_16.$$arity = 1, TMP_16)))) {}; + return result; + }, TMP_AbstractBlock_find_by_internal_14.$$arity = -1); + + Opal.def(self, '$next_adjacent_block', TMP_AbstractBlock_next_adjacent_block_17 = function $$next_adjacent_block() { + var self = this, sib = nil, p = nil; + + if (self.context['$==']("document")) { + return nil + } else if ($truthy((sib = (p = self.$parent()).$blocks()['$[]']($rb_plus(p.$blocks().$find_index(self), 1))))) { + return sib + } else { + return p.$next_adjacent_block() + } + }, TMP_AbstractBlock_next_adjacent_block_17.$$arity = 0); + + Opal.def(self, '$sections', TMP_AbstractBlock_sections_18 = function $$sections() { + var TMP_19, self = this; + + return $send(self.blocks, 'select', [], (TMP_19 = function(block){var self = TMP_19.$$s || this; + + + + if (block == null) { + block = nil; + }; + return block.$context()['$==']("section");}, TMP_19.$$s = self, TMP_19.$$arity = 1, TMP_19)) + }, TMP_AbstractBlock_sections_18.$$arity = 0); + + Opal.def(self, '$alt', TMP_AbstractBlock_alt_20 = function $$alt() { + var self = this, text = nil; + + if ($truthy((text = self.attributes['$[]']("alt")))) { + if (text['$=='](self.attributes['$[]']("default-alt"))) { + return self.$sub_specialchars(text) + } else { + + text = self.$sub_specialchars(text); + if ($truthy($$($nesting, 'ReplaceableTextRx')['$match?'](text))) { + + return self.$sub_replacements(text); + } else { + return text + }; + } + } else { + return nil + } + }, TMP_AbstractBlock_alt_20.$$arity = 0); + + Opal.def(self, '$caption', TMP_AbstractBlock_caption_21 = function $$caption() { + var self = this; + + if (self.context['$==']("admonition")) { + return self.attributes['$[]']("textlabel") + } else { + return self.caption + } + }, TMP_AbstractBlock_caption_21.$$arity = 0); + + Opal.def(self, '$captioned_title', TMP_AbstractBlock_captioned_title_22 = function $$captioned_title() { + var self = this; + + return "" + (self.caption) + (self.$title()) + }, TMP_AbstractBlock_captioned_title_22.$$arity = 0); + + Opal.def(self, '$list_marker_keyword', TMP_AbstractBlock_list_marker_keyword_23 = function $$list_marker_keyword(list_type) { + var $a, self = this; + + + + if (list_type == null) { + list_type = nil; + }; + return $$($nesting, 'ORDERED_LIST_KEYWORDS')['$[]'](($truthy($a = list_type) ? $a : self.style)); + }, TMP_AbstractBlock_list_marker_keyword_23.$$arity = -1); + + Opal.def(self, '$title', TMP_AbstractBlock_title_24 = function $$title() { + var $a, $b, self = this; + + if ($truthy(self.title_converted)) { + return self.converted_title + } else { + + return (self.converted_title = ($truthy($a = ($truthy($b = (self.title_converted = true)) ? self.title : $b)) ? self.$apply_title_subs(self.title) : $a)); + } + }, TMP_AbstractBlock_title_24.$$arity = 0); + + Opal.def(self, '$title?', TMP_AbstractBlock_title$q_25 = function() { + var self = this; + + if ($truthy(self.title)) { + return true + } else { + return false + } + }, TMP_AbstractBlock_title$q_25.$$arity = 0); + + Opal.def(self, '$title=', TMP_AbstractBlock_title$eq_26 = function(val) { + var $a, self = this; + + return $a = [val, nil], (self.title = $a[0]), (self.title_converted = $a[1]), $a + }, TMP_AbstractBlock_title$eq_26.$$arity = 1); + + Opal.def(self, '$sub?', TMP_AbstractBlock_sub$q_27 = function(name) { + var self = this; + + return self.subs['$include?'](name) + }, TMP_AbstractBlock_sub$q_27.$$arity = 1); + + Opal.def(self, '$remove_sub', TMP_AbstractBlock_remove_sub_28 = function $$remove_sub(sub) { + var self = this; + + + self.subs.$delete(sub); + return nil; + }, TMP_AbstractBlock_remove_sub_28.$$arity = 1); + + Opal.def(self, '$xreftext', TMP_AbstractBlock_xreftext_29 = function $$xreftext(xrefstyle) { + var $a, $b, self = this, val = nil, $case = nil, quoted_title = nil, prefix = nil; + + + + if (xrefstyle == null) { + xrefstyle = nil; + }; + if ($truthy(($truthy($a = (val = self.$reftext())) ? val['$empty?']()['$!']() : $a))) { + return val + } else if ($truthy(($truthy($a = ($truthy($b = xrefstyle) ? self.title : $b)) ? self.caption : $a))) { + return (function() {$case = xrefstyle; + if ("full"['$===']($case)) { + quoted_title = self.$sprintf(self.$sub_quotes((function() {if ($truthy(self.document.$compat_mode())) { + return "``%s''" + } else { + return "\"`%s`\"" + }; return nil; })()), self.$title()); + if ($truthy(($truthy($a = self.numeral) ? (prefix = self.document.$attributes()['$[]']((function() {if (self.context['$==']("image")) { + return "figure-caption" + } else { + return "" + (self.context) + "-caption" + }; return nil; })())) : $a))) { + return "" + (prefix) + " " + (self.numeral) + ", " + (quoted_title) + } else { + return "" + (self.caption.$chomp(". ")) + ", " + (quoted_title) + };} + else if ("short"['$===']($case)) {if ($truthy(($truthy($a = self.numeral) ? (prefix = self.document.$attributes()['$[]']((function() {if (self.context['$==']("image")) { + return "figure-caption" + } else { + return "" + (self.context) + "-caption" + }; return nil; })())) : $a))) { + return "" + (prefix) + " " + (self.numeral) + } else { + return self.caption.$chomp(". ") + }} + else {return self.$title()}})() + } else { + return self.$title() + }; + }, TMP_AbstractBlock_xreftext_29.$$arity = -1); + + Opal.def(self, '$assign_caption', TMP_AbstractBlock_assign_caption_30 = function $$assign_caption(value, key) { + var $a, $b, self = this, prefix = nil; + + + + if (value == null) { + value = nil; + }; + + if (key == null) { + key = nil; + }; + if ($truthy(($truthy($a = ($truthy($b = self.caption) ? $b : self.title['$!']())) ? $a : (self.caption = ($truthy($b = value) ? $b : self.document.$attributes()['$[]']("caption")))))) { + return nil + } else if ($truthy((prefix = self.document.$attributes()['$[]']("" + ((key = ($truthy($a = key) ? $a : self.context))) + "-caption")))) { + + self.caption = "" + (prefix) + " " + ((self.numeral = self.document.$increment_and_store_counter("" + (key) + "-number", self))) + ". "; + return nil; + } else { + return nil + }; + }, TMP_AbstractBlock_assign_caption_30.$$arity = -1); + + Opal.def(self, '$assign_numeral', TMP_AbstractBlock_assign_numeral_31 = function $$assign_numeral(section) { + var $a, self = this, $writer = nil, like = nil, sectname = nil, caption = nil; + + + self.next_section_index = $rb_plus((($writer = [self.next_section_index]), $send(section, 'index=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]), 1); + if ($truthy((like = section.$numbered()))) { + if ((sectname = section.$sectname())['$==']("appendix")) { + + + $writer = [self.document.$counter("appendix-number", "A")]; + $send(section, 'numeral=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + if ($truthy((caption = self.document.$attributes()['$[]']("appendix-caption")))) { + + $writer = ["" + (caption) + " " + (section.$numeral()) + ": "]; + $send(section, 'caption=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + } else { + + $writer = ["" + (section.$numeral()) + ". "]; + $send(section, 'caption=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + } else if ($truthy(($truthy($a = sectname['$==']("chapter")) ? $a : like['$==']("chapter")))) { + + $writer = [self.document.$counter("chapter-number", 1)]; + $send(section, 'numeral=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + } else { + + + $writer = [self.next_section_ordinal]; + $send(section, 'numeral=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + self.next_section_ordinal = $rb_plus(self.next_section_ordinal, 1); + }}; + return nil; + }, TMP_AbstractBlock_assign_numeral_31.$$arity = 1); + return (Opal.def(self, '$reindex_sections', TMP_AbstractBlock_reindex_sections_32 = function $$reindex_sections() { + var TMP_33, self = this; + + + self.next_section_index = 0; + self.next_section_ordinal = 1; + return $send(self.blocks, 'each', [], (TMP_33 = function(block){var self = TMP_33.$$s || this; + + + + if (block == null) { + block = nil; + }; + if (block.$context()['$==']("section")) { + + self.$assign_numeral(block); + return block.$reindex_sections(); + } else { + return nil + };}, TMP_33.$$s = self, TMP_33.$$arity = 1, TMP_33)); + }, TMP_AbstractBlock_reindex_sections_32.$$arity = 0), nil) && 'reindex_sections'; + })($nesting[0], $$($nesting, 'AbstractNode'), $nesting) + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/attribute_list"] = function(Opal) { + function $rb_plus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); + } + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + function $rb_times(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs * rhs : lhs['$*'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $hash = Opal.hash, $hash2 = Opal.hash2, $truthy = Opal.truthy, $send = Opal.send; + + Opal.add_stubs(['$new', '$[]', '$update', '$parse', '$parse_attribute', '$eos?', '$skip_delimiter', '$+', '$rekey', '$each_with_index', '$[]=', '$-', '$skip_blank', '$==', '$peek', '$parse_attribute_value', '$get_byte', '$start_with?', '$scan_name', '$!', '$!=', '$*', '$scan_to_delimiter', '$===', '$include?', '$delete', '$each', '$split', '$empty?', '$strip', '$apply_subs', '$scan_to_quote', '$gsub', '$skip', '$scan']); + return (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + (function($base, $super, $parent_nesting) { + function $AttributeList(){}; + var self = $AttributeList = $klass($base, $super, 'AttributeList', $AttributeList); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_AttributeList_initialize_1, TMP_AttributeList_parse_into_2, TMP_AttributeList_parse_3, TMP_AttributeList_rekey_4, TMP_AttributeList_rekey_5, TMP_AttributeList_parse_attribute_7, TMP_AttributeList_parse_attribute_value_9, TMP_AttributeList_skip_blank_10, TMP_AttributeList_skip_delimiter_11, TMP_AttributeList_scan_name_12, TMP_AttributeList_scan_to_delimiter_13, TMP_AttributeList_scan_to_quote_14; + + def.attributes = def.scanner = def.delimiter = def.block = def.delimiter_skip_pattern = def.delimiter_boundary_pattern = nil; + + Opal.const_set($nesting[0], 'BACKSLASH', "\\"); + Opal.const_set($nesting[0], 'APOS', "'"); + Opal.const_set($nesting[0], 'BoundaryRxs', $hash("\"", /.*?[^\\](?=")/, $$($nesting, 'APOS'), /.*?[^\\](?=')/, ",", /.*?(?=[ \t]*(,|$))/)); + Opal.const_set($nesting[0], 'EscapedQuotes', $hash("\"", "\\\"", $$($nesting, 'APOS'), "\\'")); + Opal.const_set($nesting[0], 'NameRx', new RegExp("" + ($$($nesting, 'CG_WORD')) + "[" + ($$($nesting, 'CC_WORD')) + "\\-.]*")); + Opal.const_set($nesting[0], 'BlankRx', /[ \t]+/); + Opal.const_set($nesting[0], 'SkipRxs', $hash2(["blank", ","], {"blank": $$($nesting, 'BlankRx'), ",": /[ \t]*(,|$)/})); + + Opal.def(self, '$initialize', TMP_AttributeList_initialize_1 = function $$initialize(source, block, delimiter) { + var self = this; + + + + if (block == null) { + block = nil; + }; + + if (delimiter == null) { + delimiter = ","; + }; + self.scanner = $$$('::', 'StringScanner').$new(source); + self.block = block; + self.delimiter = delimiter; + self.delimiter_skip_pattern = $$($nesting, 'SkipRxs')['$[]'](delimiter); + self.delimiter_boundary_pattern = $$($nesting, 'BoundaryRxs')['$[]'](delimiter); + return (self.attributes = nil); + }, TMP_AttributeList_initialize_1.$$arity = -2); + + Opal.def(self, '$parse_into', TMP_AttributeList_parse_into_2 = function $$parse_into(attributes, posattrs) { + var self = this; + + + + if (posattrs == null) { + posattrs = []; + }; + return attributes.$update(self.$parse(posattrs)); + }, TMP_AttributeList_parse_into_2.$$arity = -2); + + Opal.def(self, '$parse', TMP_AttributeList_parse_3 = function $$parse(posattrs) { + var $a, self = this, index = nil; + + + + if (posattrs == null) { + posattrs = []; + }; + if ($truthy(self.attributes)) { + return self.attributes}; + self.attributes = $hash2([], {}); + index = 0; + while ($truthy(self.$parse_attribute(index, posattrs))) { + + if ($truthy(self.scanner['$eos?']())) { + break;}; + self.$skip_delimiter(); + index = $rb_plus(index, 1); + }; + return self.attributes; + }, TMP_AttributeList_parse_3.$$arity = -1); + + Opal.def(self, '$rekey', TMP_AttributeList_rekey_4 = function $$rekey(posattrs) { + var self = this; + + return $$($nesting, 'AttributeList').$rekey(self.attributes, posattrs) + }, TMP_AttributeList_rekey_4.$$arity = 1); + Opal.defs(self, '$rekey', TMP_AttributeList_rekey_5 = function $$rekey(attributes, pos_attrs) { + var TMP_6, self = this; + + + $send(pos_attrs, 'each_with_index', [], (TMP_6 = function(key, index){var self = TMP_6.$$s || this, pos = nil, val = nil, $writer = nil; + + + + if (key == null) { + key = nil; + }; + + if (index == null) { + index = nil; + }; + if ($truthy(key)) { + } else { + return nil; + }; + pos = $rb_plus(index, 1); + if ($truthy((val = attributes['$[]'](pos)))) { + + $writer = [key, val]; + $send(attributes, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + } else { + return nil + };}, TMP_6.$$s = self, TMP_6.$$arity = 2, TMP_6)); + return attributes; + }, TMP_AttributeList_rekey_5.$$arity = 2); + + Opal.def(self, '$parse_attribute', TMP_AttributeList_parse_attribute_7 = function $$parse_attribute(index, pos_attrs) { + var $a, TMP_8, self = this, single_quoted_value = nil, first = nil, name = nil, value = nil, skipped = nil, c = nil, $case = nil, $writer = nil, resolved_name = nil, pos_name = nil; + + + + if (index == null) { + index = 0; + }; + + if (pos_attrs == null) { + pos_attrs = []; + }; + single_quoted_value = false; + self.$skip_blank(); + if ((first = self.scanner.$peek(1))['$==']("\"")) { + + name = self.$parse_attribute_value(self.scanner.$get_byte()); + value = nil; + } else if (first['$==']($$($nesting, 'APOS'))) { + + name = self.$parse_attribute_value(self.scanner.$get_byte()); + value = nil; + if ($truthy(name['$start_with?']($$($nesting, 'APOS')))) { + } else { + single_quoted_value = true + }; + } else { + + name = self.$scan_name(); + skipped = 0; + c = nil; + if ($truthy(self.scanner['$eos?']())) { + if ($truthy(name)) { + } else { + return false + } + } else { + + skipped = ($truthy($a = self.$skip_blank()) ? $a : 0); + c = self.scanner.$get_byte(); + }; + if ($truthy(($truthy($a = c['$!']()) ? $a : c['$=='](self.delimiter)))) { + value = nil + } else if ($truthy(($truthy($a = c['$!=']("=")) ? $a : name['$!']()))) { + + name = "" + (name) + ($rb_times(" ", skipped)) + (c) + (self.$scan_to_delimiter()); + value = nil; + } else { + + self.$skip_blank(); + if ($truthy(self.scanner.$peek(1))) { + if ((c = self.scanner.$get_byte())['$==']("\"")) { + value = self.$parse_attribute_value(c) + } else if (c['$==']($$($nesting, 'APOS'))) { + + value = self.$parse_attribute_value(c); + if ($truthy(value['$start_with?']($$($nesting, 'APOS')))) { + } else { + single_quoted_value = true + }; + } else if (c['$=='](self.delimiter)) { + value = "" + } else { + + value = "" + (c) + (self.$scan_to_delimiter()); + if (value['$==']("None")) { + return true}; + }}; + }; + }; + if ($truthy(value)) { + $case = name; + if ("options"['$===']($case) || "opts"['$===']($case)) { + if ($truthy(value['$include?'](","))) { + + if ($truthy(value['$include?'](" "))) { + value = value.$delete(" ")}; + $send(value.$split(","), 'each', [], (TMP_8 = function(opt){var self = TMP_8.$$s || this, $writer = nil; + if (self.attributes == null) self.attributes = nil; + + + + if (opt == null) { + opt = nil; + }; + if ($truthy(opt['$empty?']())) { + return nil + } else { + + $writer = ["" + (opt) + "-option", ""]; + $send(self.attributes, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + };}, TMP_8.$$s = self, TMP_8.$$arity = 1, TMP_8)); + } else { + + $writer = ["" + ((value = value.$strip())) + "-option", ""]; + $send(self.attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + + $writer = ["options", value]; + $send(self.attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];;} + else {if ($truthy(($truthy($a = single_quoted_value) ? self.block : $a))) { + $case = name; + if ("title"['$===']($case) || "reftext"['$===']($case)) { + $writer = [name, value]; + $send(self.attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];} + else { + $writer = [name, self.block.$apply_subs(value)]; + $send(self.attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];} + } else { + + $writer = [name, value]; + $send(self.attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }} + } else { + + resolved_name = (function() {if ($truthy(($truthy($a = single_quoted_value) ? self.block : $a))) { + + return self.block.$apply_subs(name); + } else { + return name + }; return nil; })(); + if ($truthy((pos_name = pos_attrs['$[]'](index)))) { + + $writer = [pos_name, resolved_name]; + $send(self.attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + + $writer = [$rb_plus(index, 1), resolved_name]; + $send(self.attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + }; + return true; + }, TMP_AttributeList_parse_attribute_7.$$arity = -1); + + Opal.def(self, '$parse_attribute_value', TMP_AttributeList_parse_attribute_value_9 = function $$parse_attribute_value(quote) { + var self = this, value = nil; + + + if (self.scanner.$peek(1)['$=='](quote)) { + + self.scanner.$get_byte(); + return "";}; + if ($truthy((value = self.$scan_to_quote(quote)))) { + + self.scanner.$get_byte(); + if ($truthy(value['$include?']($$($nesting, 'BACKSLASH')))) { + return value.$gsub($$($nesting, 'EscapedQuotes')['$[]'](quote), quote) + } else { + return value + }; + } else { + return "" + (quote) + (self.$scan_to_delimiter()) + }; + }, TMP_AttributeList_parse_attribute_value_9.$$arity = 1); + + Opal.def(self, '$skip_blank', TMP_AttributeList_skip_blank_10 = function $$skip_blank() { + var self = this; + + return self.scanner.$skip($$($nesting, 'BlankRx')) + }, TMP_AttributeList_skip_blank_10.$$arity = 0); + + Opal.def(self, '$skip_delimiter', TMP_AttributeList_skip_delimiter_11 = function $$skip_delimiter() { + var self = this; + + return self.scanner.$skip(self.delimiter_skip_pattern) + }, TMP_AttributeList_skip_delimiter_11.$$arity = 0); + + Opal.def(self, '$scan_name', TMP_AttributeList_scan_name_12 = function $$scan_name() { + var self = this; + + return self.scanner.$scan($$($nesting, 'NameRx')) + }, TMP_AttributeList_scan_name_12.$$arity = 0); + + Opal.def(self, '$scan_to_delimiter', TMP_AttributeList_scan_to_delimiter_13 = function $$scan_to_delimiter() { + var self = this; + + return self.scanner.$scan(self.delimiter_boundary_pattern) + }, TMP_AttributeList_scan_to_delimiter_13.$$arity = 0); + return (Opal.def(self, '$scan_to_quote', TMP_AttributeList_scan_to_quote_14 = function $$scan_to_quote(quote) { + var self = this; + + return self.scanner.$scan($$($nesting, 'BoundaryRxs')['$[]'](quote)) + }, TMP_AttributeList_scan_to_quote_14.$$arity = 1), nil) && 'scan_to_quote'; + })($nesting[0], null, $nesting) + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/block"] = function(Opal) { + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + function $rb_lt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $send = Opal.send, $hash2 = Opal.hash2, $truthy = Opal.truthy; + + Opal.add_stubs(['$default=', '$-', '$attr_accessor', '$[]', '$key?', '$==', '$===', '$drop', '$delete', '$[]=', '$lock_in_subs', '$nil_or_empty?', '$normalize_lines_from_string', '$apply_subs', '$join', '$<', '$size', '$empty?', '$rstrip', '$shift', '$pop', '$warn', '$logger', '$to_s', '$class', '$object_id', '$inspect']); + return (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + (function($base, $super, $parent_nesting) { + function $Block(){}; + var self = $Block = $klass($base, $super, 'Block', $Block); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Block_initialize_1, TMP_Block_content_2, TMP_Block_source_3, TMP_Block_to_s_4, $writer = nil; + + def.attributes = def.content_model = def.lines = def.subs = def.blocks = def.context = def.style = nil; + + + $writer = ["simple"]; + $send(Opal.const_set($nesting[0], 'DEFAULT_CONTENT_MODEL', $hash2(["audio", "image", "listing", "literal", "stem", "open", "page_break", "pass", "thematic_break", "video"], {"audio": "empty", "image": "empty", "listing": "verbatim", "literal": "verbatim", "stem": "raw", "open": "compound", "page_break": "empty", "pass": "raw", "thematic_break": "empty", "video": "empty"})), 'default=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + Opal.alias(self, "blockname", "context"); + self.$attr_accessor("lines"); + + Opal.def(self, '$initialize', TMP_Block_initialize_1 = function $$initialize(parent, context, opts) { + var $a, $iter = TMP_Block_initialize_1.$$p, $yield = $iter || nil, self = this, subs = nil, $writer = nil, raw_source = nil, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_Block_initialize_1.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + + + if (opts == null) { + opts = $hash2([], {}); + }; + $send(self, Opal.find_super_dispatcher(self, 'initialize', TMP_Block_initialize_1, false), $zuper, $iter); + self.content_model = ($truthy($a = opts['$[]']("content_model")) ? $a : $$($nesting, 'DEFAULT_CONTENT_MODEL')['$[]'](context)); + if ($truthy(opts['$key?']("subs"))) { + if ($truthy((subs = opts['$[]']("subs")))) { + + if (subs['$==']("default")) { + self.default_subs = opts['$[]']("default_subs") + } else if ($truthy($$$('::', 'Array')['$==='](subs))) { + + self.default_subs = subs.$drop(0); + self.attributes.$delete("subs"); + } else { + + self.default_subs = nil; + + $writer = ["subs", "" + (subs)]; + $send(self.attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + }; + self.$lock_in_subs(); + } else { + + self.default_subs = []; + self.attributes.$delete("subs"); + } + } else { + self.default_subs = nil + }; + if ($truthy((raw_source = opts['$[]']("source"))['$nil_or_empty?']())) { + return (self.lines = []) + } else if ($truthy($$$('::', 'String')['$==='](raw_source))) { + return (self.lines = $$($nesting, 'Helpers').$normalize_lines_from_string(raw_source)) + } else { + return (self.lines = raw_source.$drop(0)) + }; + }, TMP_Block_initialize_1.$$arity = -3); + + Opal.def(self, '$content', TMP_Block_content_2 = function $$content() { + var $a, $b, $iter = TMP_Block_content_2.$$p, $yield = $iter || nil, self = this, $case = nil, result = nil, first = nil, last = nil, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_Block_content_2.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + return (function() {$case = self.content_model; + if ("compound"['$===']($case)) {return $send(self, Opal.find_super_dispatcher(self, 'content', TMP_Block_content_2, false), $zuper, $iter)} + else if ("simple"['$===']($case)) {return self.$apply_subs(self.lines.$join($$($nesting, 'LF')), self.subs)} + else if ("verbatim"['$===']($case) || "raw"['$===']($case)) { + result = self.$apply_subs(self.lines, self.subs); + if ($truthy($rb_lt(result.$size(), 2))) { + return result['$[]'](0) + } else { + + while ($truthy(($truthy($b = (first = result['$[]'](0))) ? first.$rstrip()['$empty?']() : $b))) { + result.$shift() + }; + while ($truthy(($truthy($b = (last = result['$[]'](-1))) ? last.$rstrip()['$empty?']() : $b))) { + result.$pop() + }; + return result.$join($$($nesting, 'LF')); + };} + else { + if (self.content_model['$==']("empty")) { + } else { + self.$logger().$warn("" + "Unknown content model '" + (self.content_model) + "' for block: " + (self.$to_s())) + }; + return nil;}})() + }, TMP_Block_content_2.$$arity = 0); + + Opal.def(self, '$source', TMP_Block_source_3 = function $$source() { + var self = this; + + return self.lines.$join($$($nesting, 'LF')) + }, TMP_Block_source_3.$$arity = 0); + return (Opal.def(self, '$to_s', TMP_Block_to_s_4 = function $$to_s() { + var self = this, content_summary = nil; + + + content_summary = (function() {if (self.content_model['$==']("compound")) { + return "" + "blocks: " + (self.blocks.$size()) + } else { + return "" + "lines: " + (self.lines.$size()) + }; return nil; })(); + return "" + "#<" + (self.$class()) + "@" + (self.$object_id()) + " {context: " + (self.context.$inspect()) + ", content_model: " + (self.content_model.$inspect()) + ", style: " + (self.style.$inspect()) + ", " + (content_summary) + "}>"; + }, TMP_Block_to_s_4.$$arity = 0), nil) && 'to_s'; + })($nesting[0], $$($nesting, 'AbstractBlock'), $nesting) + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/callouts"] = function(Opal) { + function $rb_plus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); + } + function $rb_le(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs <= rhs : lhs['$<='](rhs); + } + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + function $rb_lt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $hash2 = Opal.hash2, $truthy = Opal.truthy, $send = Opal.send; + + Opal.add_stubs(['$next_list', '$<<', '$current_list', '$to_i', '$generate_next_callout_id', '$+', '$<=', '$size', '$[]', '$-', '$chop', '$join', '$map', '$==', '$<', '$generate_callout_id']); + return (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + (function($base, $super, $parent_nesting) { + function $Callouts(){}; + var self = $Callouts = $klass($base, $super, 'Callouts', $Callouts); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Callouts_initialize_1, TMP_Callouts_register_2, TMP_Callouts_read_next_id_3, TMP_Callouts_callout_ids_4, TMP_Callouts_current_list_6, TMP_Callouts_next_list_7, TMP_Callouts_rewind_8, TMP_Callouts_generate_next_callout_id_9, TMP_Callouts_generate_callout_id_10; + + def.co_index = def.lists = def.list_index = nil; + + + Opal.def(self, '$initialize', TMP_Callouts_initialize_1 = function $$initialize() { + var self = this; + + + self.lists = []; + self.list_index = 0; + return self.$next_list(); + }, TMP_Callouts_initialize_1.$$arity = 0); + + Opal.def(self, '$register', TMP_Callouts_register_2 = function $$register(li_ordinal) { + var self = this, id = nil; + + + self.$current_list()['$<<']($hash2(["ordinal", "id"], {"ordinal": li_ordinal.$to_i(), "id": (id = self.$generate_next_callout_id())})); + self.co_index = $rb_plus(self.co_index, 1); + return id; + }, TMP_Callouts_register_2.$$arity = 1); + + Opal.def(self, '$read_next_id', TMP_Callouts_read_next_id_3 = function $$read_next_id() { + var self = this, id = nil, list = nil; + + + id = nil; + list = self.$current_list(); + if ($truthy($rb_le(self.co_index, list.$size()))) { + id = list['$[]']($rb_minus(self.co_index, 1))['$[]']("id")}; + self.co_index = $rb_plus(self.co_index, 1); + return id; + }, TMP_Callouts_read_next_id_3.$$arity = 0); + + Opal.def(self, '$callout_ids', TMP_Callouts_callout_ids_4 = function $$callout_ids(li_ordinal) { + var TMP_5, self = this; + + return $send(self.$current_list(), 'map', [], (TMP_5 = function(it){var self = TMP_5.$$s || this; + + + + if (it == null) { + it = nil; + }; + if (it['$[]']("ordinal")['$=='](li_ordinal)) { + return "" + (it['$[]']("id")) + " " + } else { + return "" + };}, TMP_5.$$s = self, TMP_5.$$arity = 1, TMP_5)).$join().$chop() + }, TMP_Callouts_callout_ids_4.$$arity = 1); + + Opal.def(self, '$current_list', TMP_Callouts_current_list_6 = function $$current_list() { + var self = this; + + return self.lists['$[]']($rb_minus(self.list_index, 1)) + }, TMP_Callouts_current_list_6.$$arity = 0); + + Opal.def(self, '$next_list', TMP_Callouts_next_list_7 = function $$next_list() { + var self = this; + + + self.list_index = $rb_plus(self.list_index, 1); + if ($truthy($rb_lt(self.lists.$size(), self.list_index))) { + self.lists['$<<']([])}; + self.co_index = 1; + return nil; + }, TMP_Callouts_next_list_7.$$arity = 0); + + Opal.def(self, '$rewind', TMP_Callouts_rewind_8 = function $$rewind() { + var self = this; + + + self.list_index = 1; + self.co_index = 1; + return nil; + }, TMP_Callouts_rewind_8.$$arity = 0); + + Opal.def(self, '$generate_next_callout_id', TMP_Callouts_generate_next_callout_id_9 = function $$generate_next_callout_id() { + var self = this; + + return self.$generate_callout_id(self.list_index, self.co_index) + }, TMP_Callouts_generate_next_callout_id_9.$$arity = 0); + return (Opal.def(self, '$generate_callout_id', TMP_Callouts_generate_callout_id_10 = function $$generate_callout_id(list_index, co_index) { + var self = this; + + return "" + "CO" + (list_index) + "-" + (co_index) + }, TMP_Callouts_generate_callout_id_10.$$arity = 2), nil) && 'generate_callout_id'; + })($nesting[0], null, $nesting) + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/converter/base"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $hash2 = Opal.hash2, $truthy = Opal.truthy; + + Opal.add_stubs(['$include', '$node_name', '$empty?', '$send', '$content']); + return (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + + (function($base, $parent_nesting) { + function $Converter() {}; + var self = $Converter = $module($base, 'Converter', $Converter); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + nil + })($nesting[0], $nesting); + (function($base, $super, $parent_nesting) { + function $Base(){}; + var self = $Base = $klass($base, $super, 'Base', $Base); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + + self.$include($$($nesting, 'Logging')); + return self.$include($$($nesting, 'Converter')); + })($$($nesting, 'Converter'), null, $nesting); + (function($base, $super, $parent_nesting) { + function $BuiltIn(){}; + var self = $BuiltIn = $klass($base, $super, 'BuiltIn', $BuiltIn); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_BuiltIn_initialize_1, TMP_BuiltIn_convert_2, TMP_BuiltIn_content_3, TMP_BuiltIn_skip_4; + + + self.$include($$($nesting, 'Logging')); + + Opal.def(self, '$initialize', TMP_BuiltIn_initialize_1 = function $$initialize(backend, opts) { + var self = this; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + return nil; + }, TMP_BuiltIn_initialize_1.$$arity = -2); + + Opal.def(self, '$convert', TMP_BuiltIn_convert_2 = function $$convert(node, transform, opts) { + var $a, self = this; + + + + if (transform == null) { + transform = nil; + }; + + if (opts == null) { + opts = $hash2([], {}); + }; + transform = ($truthy($a = transform) ? $a : node.$node_name()); + if ($truthy(opts['$empty?']())) { + + return self.$send(transform, node); + } else { + + return self.$send(transform, node, opts); + }; + }, TMP_BuiltIn_convert_2.$$arity = -2); + Opal.alias(self, "handles?", "respond_to?"); + + Opal.def(self, '$content', TMP_BuiltIn_content_3 = function $$content(node) { + var self = this; + + return node.$content() + }, TMP_BuiltIn_content_3.$$arity = 1); + Opal.alias(self, "pass", "content"); + return (Opal.def(self, '$skip', TMP_BuiltIn_skip_4 = function $$skip(node) { + var self = this; + + return nil + }, TMP_BuiltIn_skip_4.$$arity = 1), nil) && 'skip'; + })($$($nesting, 'Converter'), null, $nesting); + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/converter/factory"] = function(Opal) { + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $truthy = Opal.truthy, $hash2 = Opal.hash2, $send = Opal.send; + + Opal.add_stubs(['$new', '$require', '$include?', '$include', '$warn', '$logger', '$register', '$default', '$resolve', '$create', '$converters', '$unregister_all', '$attr_reader', '$each', '$[]=', '$-', '$==', '$[]', '$clear', '$===', '$supports_templates?', '$to_s', '$key?']); + return (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + (function($base, $parent_nesting) { + function $Converter() {}; + var self = $Converter = $module($base, 'Converter', $Converter); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + (function($base, $super, $parent_nesting) { + function $Factory(){}; + var self = $Factory = $klass($base, $super, 'Factory', $Factory); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Factory_initialize_7, TMP_Factory_register_8, TMP_Factory_resolve_10, TMP_Factory_unregister_all_11, TMP_Factory_create_12; + + def.converters = def.star_converter = nil; + + self.__default__ = nil; + (function(self, $parent_nesting) { + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_default_1, TMP_register_2, TMP_resolve_3, TMP_create_4, TMP_converters_5, TMP_unregister_all_6; + + + + Opal.def(self, '$default', TMP_default_1 = function(initialize_singleton) { + var $a, $b, $c, self = this; + if (self.__default__ == null) self.__default__ = nil; + + + + if (initialize_singleton == null) { + initialize_singleton = true; + }; + if ($truthy(initialize_singleton)) { + } else { + return ($truthy($a = self.__default__) ? $a : self.$new()) + }; + return (self.__default__ = ($truthy($a = self.__default__) ? $a : (function() { try { + + if ($truthy((($c = $$$('::', 'Concurrent', 'skip_raise')) && ($b = $$$($c, 'Hash', 'skip_raise')) ? 'constant' : nil))) { + } else { + self.$require((function() {if ($truthy($$$('::', 'RUBY_MIN_VERSION_1_9'))) { + return "concurrent/hash" + } else { + return "asciidoctor/core_ext/1.8.7/concurrent/hash" + }; return nil; })()) + }; + return self.$new($$$($$$('::', 'Concurrent'), 'Hash').$new()); + } catch ($err) { + if (Opal.rescue($err, [$$$('::', 'LoadError')])) { + try { + + if ($truthy(self['$include?']($$($nesting, 'Logging')))) { + } else { + self.$include($$($nesting, 'Logging')) + }; + self.$logger().$warn("gem 'concurrent-ruby' is not installed. This gem is recommended when registering custom converters."); + return self.$new(); + } finally { Opal.pop_exception() } + } else { throw $err; } + }})())); + }, TMP_default_1.$$arity = -1); + + Opal.def(self, '$register', TMP_register_2 = function $$register(converter, backends) { + var self = this; + + + + if (backends == null) { + backends = ["*"]; + }; + return self.$default().$register(converter, backends); + }, TMP_register_2.$$arity = -2); + + Opal.def(self, '$resolve', TMP_resolve_3 = function $$resolve(backend) { + var self = this; + + return self.$default().$resolve(backend) + }, TMP_resolve_3.$$arity = 1); + + Opal.def(self, '$create', TMP_create_4 = function $$create(backend, opts) { + var self = this; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + return self.$default().$create(backend, opts); + }, TMP_create_4.$$arity = -2); + + Opal.def(self, '$converters', TMP_converters_5 = function $$converters() { + var self = this; + + return self.$default().$converters() + }, TMP_converters_5.$$arity = 0); + return (Opal.def(self, '$unregister_all', TMP_unregister_all_6 = function $$unregister_all() { + var self = this; + + return self.$default().$unregister_all() + }, TMP_unregister_all_6.$$arity = 0), nil) && 'unregister_all'; + })(Opal.get_singleton_class(self), $nesting); + self.$attr_reader("converters"); + + Opal.def(self, '$initialize', TMP_Factory_initialize_7 = function $$initialize(converters) { + var $a, self = this; + + + + if (converters == null) { + converters = nil; + }; + self.converters = ($truthy($a = converters) ? $a : $hash2([], {})); + return (self.star_converter = nil); + }, TMP_Factory_initialize_7.$$arity = -1); + + Opal.def(self, '$register', TMP_Factory_register_8 = function $$register(converter, backends) { + var TMP_9, self = this; + + + + if (backends == null) { + backends = ["*"]; + }; + $send(backends, 'each', [], (TMP_9 = function(backend){var self = TMP_9.$$s || this, $writer = nil; + if (self.converters == null) self.converters = nil; + + + + if (backend == null) { + backend = nil; + }; + + $writer = [backend, converter]; + $send(self.converters, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + if (backend['$==']("*")) { + return (self.star_converter = converter) + } else { + return nil + };}, TMP_9.$$s = self, TMP_9.$$arity = 1, TMP_9)); + return nil; + }, TMP_Factory_register_8.$$arity = -2); + + Opal.def(self, '$resolve', TMP_Factory_resolve_10 = function $$resolve(backend) { + var $a, $b, self = this; + + return ($truthy($a = self.converters) ? ($truthy($b = self.converters['$[]'](backend)) ? $b : self.star_converter) : $a) + }, TMP_Factory_resolve_10.$$arity = 1); + + Opal.def(self, '$unregister_all', TMP_Factory_unregister_all_11 = function $$unregister_all() { + var self = this; + + + self.converters.$clear(); + return (self.star_converter = nil); + }, TMP_Factory_unregister_all_11.$$arity = 0); + return (Opal.def(self, '$create', TMP_Factory_create_12 = function $$create(backend, opts) { + var $a, $b, $c, $d, $e, $f, $g, $h, $i, $j, $k, $l, $m, $n, $o, $p, $q, $r, self = this, converter = nil, base_converter = nil, $case = nil, template_converter = nil; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + if ($truthy((converter = self.$resolve(backend)))) { + + base_converter = (function() {if ($truthy($$$('::', 'Class')['$==='](converter))) { + + return converter.$new(backend, opts); + } else { + return converter + }; return nil; })(); + if ($truthy(($truthy($a = $$$($$($nesting, 'Converter'), 'BackendInfo')['$==='](base_converter)) ? base_converter['$supports_templates?']() : $a))) { + } else { + return base_converter + }; + } else { + $case = backend; + if ("html5"['$===']($case)) { + if ($truthy((($c = $$$('::', 'Asciidoctor', 'skip_raise')) && ($b = $$$($c, 'Converter', 'skip_raise')) && ($a = $$$($b, 'Html5Converter', 'skip_raise')) ? 'constant' : nil))) { + } else { + self.$require("asciidoctor/converter/html5".$to_s()) + }; + base_converter = $$($nesting, 'Html5Converter').$new(backend, opts);} + else if ("docbook5"['$===']($case)) { + if ($truthy((($f = $$$('::', 'Asciidoctor', 'skip_raise')) && ($e = $$$($f, 'Converter', 'skip_raise')) && ($d = $$$($e, 'DocBook5Converter', 'skip_raise')) ? 'constant' : nil))) { + } else { + self.$require("asciidoctor/converter/docbook5".$to_s()) + }; + base_converter = $$($nesting, 'DocBook5Converter').$new(backend, opts);} + else if ("docbook45"['$===']($case)) { + if ($truthy((($i = $$$('::', 'Asciidoctor', 'skip_raise')) && ($h = $$$($i, 'Converter', 'skip_raise')) && ($g = $$$($h, 'DocBook45Converter', 'skip_raise')) ? 'constant' : nil))) { + } else { + self.$require("asciidoctor/converter/docbook45".$to_s()) + }; + base_converter = $$($nesting, 'DocBook45Converter').$new(backend, opts);} + else if ("manpage"['$===']($case)) { + if ($truthy((($l = $$$('::', 'Asciidoctor', 'skip_raise')) && ($k = $$$($l, 'Converter', 'skip_raise')) && ($j = $$$($k, 'ManPageConverter', 'skip_raise')) ? 'constant' : nil))) { + } else { + self.$require("asciidoctor/converter/manpage".$to_s()) + }; + base_converter = $$($nesting, 'ManPageConverter').$new(backend, opts);} + }; + if ($truthy(opts['$key?']("template_dirs"))) { + } else { + return base_converter + }; + if ($truthy((($o = $$$('::', 'Asciidoctor', 'skip_raise')) && ($n = $$$($o, 'Converter', 'skip_raise')) && ($m = $$$($n, 'TemplateConverter', 'skip_raise')) ? 'constant' : nil))) { + } else { + self.$require("asciidoctor/converter/template".$to_s()) + }; + template_converter = $$($nesting, 'TemplateConverter').$new(backend, opts['$[]']("template_dirs"), opts); + if ($truthy((($r = $$$('::', 'Asciidoctor', 'skip_raise')) && ($q = $$$($r, 'Converter', 'skip_raise')) && ($p = $$$($q, 'CompositeConverter', 'skip_raise')) ? 'constant' : nil))) { + } else { + self.$require("asciidoctor/converter/composite".$to_s()) + }; + return $$($nesting, 'CompositeConverter').$new(backend, template_converter, base_converter); + }, TMP_Factory_create_12.$$arity = -2), nil) && 'create'; + })($nesting[0], null, $nesting) + })($nesting[0], $nesting) + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/converter"] = function(Opal) { + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $send = Opal.send, $truthy = Opal.truthy, $hash2 = Opal.hash2; + + Opal.add_stubs(['$register', '$==', '$send', '$include?', '$setup_backend_info', '$raise', '$class', '$sub', '$[]', '$slice', '$length', '$[]=', '$backend_info', '$-', '$extend', '$include', '$respond_to?', '$write', '$chomp', '$require']); + + (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + + (function($base, $parent_nesting) { + function $Converter() {}; + var self = $Converter = $module($base, 'Converter', $Converter); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Converter_initialize_13, TMP_Converter_convert_14; + + + (function($base, $parent_nesting) { + function $Config() {}; + var self = $Config = $module($base, 'Config', $Config); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Config_register_for_1; + + + Opal.def(self, '$register_for', TMP_Config_register_for_1 = function $$register_for($a) { + var $post_args, backends, TMP_2, TMP_3, self = this, metaclass = nil; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + backends = $post_args;; + $$($nesting, 'Factory').$register(self, backends); + metaclass = (function(self, $parent_nesting) { + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return self + })(Opal.get_singleton_class(self), $nesting); + if (backends['$=='](["*"])) { + $send(metaclass, 'send', ["define_method", "converts?"], (TMP_2 = function(name){var self = TMP_2.$$s || this; + + + + if (name == null) { + name = nil; + }; + return true;}, TMP_2.$$s = self, TMP_2.$$arity = 1, TMP_2)) + } else { + $send(metaclass, 'send', ["define_method", "converts?"], (TMP_3 = function(name){var self = TMP_3.$$s || this; + + + + if (name == null) { + name = nil; + }; + return backends['$include?'](name);}, TMP_3.$$s = self, TMP_3.$$arity = 1, TMP_3)) + }; + return nil; + }, TMP_Config_register_for_1.$$arity = -1) + })($nesting[0], $nesting); + (function($base, $parent_nesting) { + function $BackendInfo() {}; + var self = $BackendInfo = $module($base, 'BackendInfo', $BackendInfo); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_BackendInfo_backend_info_4, TMP_BackendInfo_setup_backend_info_5, TMP_BackendInfo_filetype_6, TMP_BackendInfo_basebackend_7, TMP_BackendInfo_outfilesuffix_8, TMP_BackendInfo_htmlsyntax_9, TMP_BackendInfo_supports_templates_10, TMP_BackendInfo_supports_templates$q_11; + + + + Opal.def(self, '$backend_info', TMP_BackendInfo_backend_info_4 = function $$backend_info() { + var $a, self = this; + if (self.backend_info == null) self.backend_info = nil; + + return (self.backend_info = ($truthy($a = self.backend_info) ? $a : self.$setup_backend_info())) + }, TMP_BackendInfo_backend_info_4.$$arity = 0); + + Opal.def(self, '$setup_backend_info', TMP_BackendInfo_setup_backend_info_5 = function $$setup_backend_info() { + var self = this, base = nil, ext = nil, type = nil, syntax = nil; + if (self.backend == null) self.backend = nil; + + + if ($truthy(self.backend)) { + } else { + self.$raise($$$('::', 'ArgumentError'), "" + "Cannot determine backend for converter: " + (self.$class())) + }; + base = self.backend.$sub($$($nesting, 'TrailingDigitsRx'), ""); + if ($truthy((ext = $$($nesting, 'DEFAULT_EXTENSIONS')['$[]'](base)))) { + type = ext.$slice(1, ext.$length()) + } else { + + base = "html"; + ext = ".html"; + type = "html"; + syntax = "html"; + }; + return $hash2(["basebackend", "outfilesuffix", "filetype", "htmlsyntax"], {"basebackend": base, "outfilesuffix": ext, "filetype": type, "htmlsyntax": syntax}); + }, TMP_BackendInfo_setup_backend_info_5.$$arity = 0); + + Opal.def(self, '$filetype', TMP_BackendInfo_filetype_6 = function $$filetype(value) { + var self = this, $writer = nil; + + + + if (value == null) { + value = nil; + }; + if ($truthy(value)) { + + $writer = ["filetype", value]; + $send(self.$backend_info(), '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + } else { + return self.$backend_info()['$[]']("filetype") + }; + }, TMP_BackendInfo_filetype_6.$$arity = -1); + + Opal.def(self, '$basebackend', TMP_BackendInfo_basebackend_7 = function $$basebackend(value) { + var self = this, $writer = nil; + + + + if (value == null) { + value = nil; + }; + if ($truthy(value)) { + + $writer = ["basebackend", value]; + $send(self.$backend_info(), '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + } else { + return self.$backend_info()['$[]']("basebackend") + }; + }, TMP_BackendInfo_basebackend_7.$$arity = -1); + + Opal.def(self, '$outfilesuffix', TMP_BackendInfo_outfilesuffix_8 = function $$outfilesuffix(value) { + var self = this, $writer = nil; + + + + if (value == null) { + value = nil; + }; + if ($truthy(value)) { + + $writer = ["outfilesuffix", value]; + $send(self.$backend_info(), '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + } else { + return self.$backend_info()['$[]']("outfilesuffix") + }; + }, TMP_BackendInfo_outfilesuffix_8.$$arity = -1); + + Opal.def(self, '$htmlsyntax', TMP_BackendInfo_htmlsyntax_9 = function $$htmlsyntax(value) { + var self = this, $writer = nil; + + + + if (value == null) { + value = nil; + }; + if ($truthy(value)) { + + $writer = ["htmlsyntax", value]; + $send(self.$backend_info(), '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + } else { + return self.$backend_info()['$[]']("htmlsyntax") + }; + }, TMP_BackendInfo_htmlsyntax_9.$$arity = -1); + + Opal.def(self, '$supports_templates', TMP_BackendInfo_supports_templates_10 = function $$supports_templates() { + var self = this, $writer = nil; + + + $writer = ["supports_templates", true]; + $send(self.$backend_info(), '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + }, TMP_BackendInfo_supports_templates_10.$$arity = 0); + + Opal.def(self, '$supports_templates?', TMP_BackendInfo_supports_templates$q_11 = function() { + var self = this; + + return self.$backend_info()['$[]']("supports_templates") + }, TMP_BackendInfo_supports_templates$q_11.$$arity = 0); + })($nesting[0], $nesting); + (function(self, $parent_nesting) { + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_included_12; + + return (Opal.def(self, '$included', TMP_included_12 = function $$included(converter) { + var self = this; + + return converter.$extend($$($nesting, 'Config')) + }, TMP_included_12.$$arity = 1), nil) && 'included' + })(Opal.get_singleton_class(self), $nesting); + self.$include($$($nesting, 'Config')); + self.$include($$($nesting, 'BackendInfo')); + + Opal.def(self, '$initialize', TMP_Converter_initialize_13 = function $$initialize(backend, opts) { + var self = this; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + self.backend = backend; + return self.$setup_backend_info(); + }, TMP_Converter_initialize_13.$$arity = -2); + + Opal.def(self, '$convert', TMP_Converter_convert_14 = function $$convert(node, transform, opts) { + var self = this; + + + + if (transform == null) { + transform = nil; + }; + + if (opts == null) { + opts = $hash2([], {}); + }; + return self.$raise($$$('::', 'NotImplementedError')); + }, TMP_Converter_convert_14.$$arity = -2); + Opal.alias(self, "handles?", "respond_to?"); + Opal.alias(self, "convert_with_options", "convert"); + })($nesting[0], $nesting); + (function($base, $parent_nesting) { + function $Writer() {}; + var self = $Writer = $module($base, 'Writer', $Writer); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Writer_write_15; + + + Opal.def(self, '$write', TMP_Writer_write_15 = function $$write(output, target) { + var self = this; + + + if ($truthy(target['$respond_to?']("write"))) { + + target.$write(output.$chomp()); + target.$write($$($nesting, 'LF')); + } else { + $$$('::', 'IO').$write(target, output) + }; + return nil; + }, TMP_Writer_write_15.$$arity = 2) + })($nesting[0], $nesting); + (function($base, $parent_nesting) { + function $VoidWriter() {}; + var self = $VoidWriter = $module($base, 'VoidWriter', $VoidWriter); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_VoidWriter_write_16; + + + self.$include($$($nesting, 'Writer')); + + Opal.def(self, '$write', TMP_VoidWriter_write_16 = function $$write(output, target) { + var self = this; + + return nil + }, TMP_VoidWriter_write_16.$$arity = 2); + })($nesting[0], $nesting); + })($nesting[0], $nesting); + self.$require("asciidoctor/converter/base"); + return self.$require("asciidoctor/converter/factory"); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/document"] = function(Opal) { + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + function $rb_ge(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs >= rhs : lhs['$>='](rhs); + } + function $rb_plus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); + } + function $rb_gt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); + } + function $rb_lt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $send = Opal.send, $truthy = Opal.truthy, $hash2 = Opal.hash2, $gvars = Opal.gvars; + + Opal.add_stubs(['$new', '$attr_reader', '$nil?', '$<<', '$[]', '$[]=', '$-', '$include?', '$strip', '$squeeze', '$gsub', '$empty?', '$!', '$rpartition', '$attr_accessor', '$delete', '$base_dir', '$options', '$inject', '$catalog', '$==', '$dup', '$attributes', '$safe', '$compat_mode', '$sourcemap', '$path_resolver', '$converter', '$extensions', '$each', '$end_with?', '$start_with?', '$slice', '$length', '$chop', '$downcase', '$extname', '$===', '$value_for_name', '$to_s', '$key?', '$freeze', '$attribute_undefined', '$attribute_missing', '$name_for_value', '$expand_path', '$pwd', '$>=', '$+', '$abs', '$to_i', '$delete_if', '$update_doctype_attributes', '$cursor', '$parse', '$restore_attributes', '$update_backend_attributes', '$utc', '$at', '$Integer', '$now', '$index', '$strftime', '$year', '$utc_offset', '$fetch', '$activate', '$create', '$to_proc', '$groups', '$preprocessors?', '$preprocessors', '$process_method', '$tree_processors?', '$tree_processors', '$!=', '$counter', '$nil_or_empty?', '$nextval', '$value', '$save_to', '$chr', '$ord', '$source', '$source_lines', '$doctitle', '$sectname=', '$title=', '$first_section', '$title', '$merge', '$>', '$<', '$find', '$context', '$assign_numeral', '$clear_playback_attributes', '$save_attributes', '$attribute_locked?', '$rewind', '$replace', '$name', '$negate', '$limit_bytesize', '$apply_attribute_value_subs', '$delete?', '$=~', '$apply_subs', '$resolve_pass_subs', '$apply_header_subs', '$create_converter', '$basebackend', '$outfilesuffix', '$filetype', '$sub', '$raise', '$Array', '$backend', '$default', '$start', '$doctype', '$content_model', '$warn', '$logger', '$content', '$convert', '$postprocessors?', '$postprocessors', '$record', '$write', '$respond_to?', '$chomp', '$write_alternate_pages', '$map', '$split', '$resolve_docinfo_subs', '$&', '$normalize_system_path', '$read_asset', '$docinfo_processors?', '$compact', '$join', '$resolve_subs', '$docinfo_processors', '$class', '$object_id', '$inspect', '$size']); + return (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + (function($base, $super, $parent_nesting) { + function $Document(){}; + var self = $Document = $klass($base, $super, 'Document', $Document); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Document_1, TMP_Document_initialize_8, TMP_Document_parse_12, TMP_Document_counter_15, TMP_Document_increment_and_store_counter_16, TMP_Document_nextval_17, TMP_Document_register_18, TMP_Document_footnotes$q_19, TMP_Document_footnotes_20, TMP_Document_callouts_21, TMP_Document_nested$q_22, TMP_Document_embedded$q_23, TMP_Document_extensions$q_24, TMP_Document_source_25, TMP_Document_source_lines_26, TMP_Document_basebackend$q_27, TMP_Document_title_28, TMP_Document_title$eq_29, TMP_Document_doctitle_30, TMP_Document_author_31, TMP_Document_authors_32, TMP_Document_revdate_33, TMP_Document_notitle_34, TMP_Document_noheader_35, TMP_Document_nofooter_36, TMP_Document_first_section_37, TMP_Document_has_header$q_39, TMP_Document_$lt$lt_40, TMP_Document_finalize_header_41, TMP_Document_save_attributes_42, TMP_Document_restore_attributes_44, TMP_Document_clear_playback_attributes_45, TMP_Document_playback_attributes_46, TMP_Document_set_attribute_48, TMP_Document_delete_attribute_49, TMP_Document_attribute_locked$q_50, TMP_Document_set_header_attribute_51, TMP_Document_apply_attribute_value_subs_52, TMP_Document_update_backend_attributes_53, TMP_Document_update_doctype_attributes_54, TMP_Document_create_converter_55, TMP_Document_convert_56, TMP_Document_write_58, TMP_Document_content_59, TMP_Document_docinfo_60, TMP_Document_resolve_docinfo_subs_63, TMP_Document_docinfo_processors$q_64, TMP_Document_to_s_65; + + def.attributes = def.safe = def.sourcemap = def.reader = def.base_dir = def.parsed = def.parent_document = def.extensions = def.options = def.counters = def.catalog = def.header = def.blocks = def.attributes_modified = def.id = def.header_attributes = def.max_attribute_value_size = def.attribute_overrides = def.backend = def.doctype = def.converter = def.timings = def.outfilesuffix = def.docinfo_processor_extensions = def.document = nil; + + Opal.const_set($nesting[0], 'ImageReference', $send($$$('::', 'Struct'), 'new', ["target", "imagesdir"], (TMP_Document_1 = function(){var self = TMP_Document_1.$$s || this; + + return Opal.alias(self, "to_s", "target")}, TMP_Document_1.$$s = self, TMP_Document_1.$$arity = 0, TMP_Document_1))); + Opal.const_set($nesting[0], 'Footnote', $$$('::', 'Struct').$new("index", "id", "text")); + (function($base, $super, $parent_nesting) { + function $AttributeEntry(){}; + var self = $AttributeEntry = $klass($base, $super, 'AttributeEntry', $AttributeEntry); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_AttributeEntry_initialize_2, TMP_AttributeEntry_save_to_3; + + + self.$attr_reader("name", "value", "negate"); + + Opal.def(self, '$initialize', TMP_AttributeEntry_initialize_2 = function $$initialize(name, value, negate) { + var self = this; + + + + if (negate == null) { + negate = nil; + }; + self.name = name; + self.value = value; + return (self.negate = (function() {if ($truthy(negate['$nil?']())) { + return value['$nil?']() + } else { + return negate + }; return nil; })()); + }, TMP_AttributeEntry_initialize_2.$$arity = -3); + return (Opal.def(self, '$save_to', TMP_AttributeEntry_save_to_3 = function $$save_to(block_attributes) { + var $a, self = this, $writer = nil; + + + ($truthy($a = block_attributes['$[]']("attribute_entries")) ? $a : (($writer = ["attribute_entries", []]), $send(block_attributes, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]))['$<<'](self); + return self; + }, TMP_AttributeEntry_save_to_3.$$arity = 1), nil) && 'save_to'; + })($nesting[0], null, $nesting); + (function($base, $super, $parent_nesting) { + function $Title(){}; + var self = $Title = $klass($base, $super, 'Title', $Title); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Title_initialize_4, TMP_Title_sanitized$q_5, TMP_Title_subtitle$q_6, TMP_Title_to_s_7; + + def.sanitized = def.subtitle = def.combined = nil; + + self.$attr_reader("main"); + Opal.alias(self, "title", "main"); + self.$attr_reader("subtitle"); + self.$attr_reader("combined"); + + Opal.def(self, '$initialize', TMP_Title_initialize_4 = function $$initialize(val, opts) { + var $a, $b, self = this, sep = nil, _ = nil; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + if ($truthy(($truthy($a = (self.sanitized = opts['$[]']("sanitize"))) ? val['$include?']("<") : $a))) { + val = val.$gsub($$($nesting, 'XmlSanitizeRx'), "").$squeeze(" ").$strip()}; + if ($truthy(($truthy($a = (sep = ($truthy($b = opts['$[]']("separator")) ? $b : ":"))['$empty?']()) ? $a : val['$include?']((sep = "" + (sep) + " "))['$!']()))) { + + self.main = val; + self.subtitle = nil; + } else { + $b = val.$rpartition(sep), $a = Opal.to_ary($b), (self.main = ($a[0] == null ? nil : $a[0])), (_ = ($a[1] == null ? nil : $a[1])), (self.subtitle = ($a[2] == null ? nil : $a[2])), $b + }; + return (self.combined = val); + }, TMP_Title_initialize_4.$$arity = -2); + + Opal.def(self, '$sanitized?', TMP_Title_sanitized$q_5 = function() { + var self = this; + + return self.sanitized + }, TMP_Title_sanitized$q_5.$$arity = 0); + + Opal.def(self, '$subtitle?', TMP_Title_subtitle$q_6 = function() { + var self = this; + + if ($truthy(self.subtitle)) { + return true + } else { + return false + } + }, TMP_Title_subtitle$q_6.$$arity = 0); + return (Opal.def(self, '$to_s', TMP_Title_to_s_7 = function $$to_s() { + var self = this; + + return self.combined + }, TMP_Title_to_s_7.$$arity = 0), nil) && 'to_s'; + })($nesting[0], null, $nesting); + Opal.const_set($nesting[0], 'Author', $$$('::', 'Struct').$new("name", "firstname", "middlename", "lastname", "initials", "email")); + self.$attr_reader("safe"); + self.$attr_reader("compat_mode"); + self.$attr_reader("backend"); + self.$attr_reader("doctype"); + self.$attr_accessor("sourcemap"); + self.$attr_reader("catalog"); + Opal.alias(self, "references", "catalog"); + self.$attr_reader("counters"); + self.$attr_reader("header"); + self.$attr_reader("base_dir"); + self.$attr_reader("options"); + self.$attr_reader("outfilesuffix"); + self.$attr_reader("parent_document"); + self.$attr_reader("reader"); + self.$attr_reader("path_resolver"); + self.$attr_reader("converter"); + self.$attr_reader("extensions"); + + Opal.def(self, '$initialize', TMP_Document_initialize_8 = function $$initialize(data, options) { + var $a, TMP_9, TMP_10, $b, $c, TMP_11, $d, $iter = TMP_Document_initialize_8.$$p, $yield = $iter || nil, self = this, parent_doc = nil, $writer = nil, attr_overrides = nil, parent_doctype = nil, initialize_extensions = nil, to_file = nil, safe_mode = nil, header_footer = nil, attrs = nil, safe_mode_name = nil, base_dir_val = nil, backend_val = nil, doctype_val = nil, size = nil, now = nil, localdate = nil, localyear = nil, localtime = nil, ext_registry = nil, ext_block = nil; + + if ($iter) TMP_Document_initialize_8.$$p = null; + + + if (data == null) { + data = nil; + }; + + if (options == null) { + options = $hash2([], {}); + }; + $send(self, Opal.find_super_dispatcher(self, 'initialize', TMP_Document_initialize_8, false), [self, "document"], null); + if ($truthy((parent_doc = options.$delete("parent")))) { + + self.parent_document = parent_doc; + ($truthy($a = options['$[]']("base_dir")) ? $a : (($writer = ["base_dir", parent_doc.$base_dir()]), $send(options, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + if ($truthy(parent_doc.$options()['$[]']("catalog_assets"))) { + + $writer = ["catalog_assets", true]; + $send(options, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + self.catalog = $send(parent_doc.$catalog(), 'inject', [$hash2([], {})], (TMP_9 = function(accum, $mlhs_tmp1){var self = TMP_9.$$s || this, $b, $c, key = nil, table = nil; + + + + if (accum == null) { + accum = nil; + }; + + if ($mlhs_tmp1 == null) { + $mlhs_tmp1 = nil; + }; + $c = $mlhs_tmp1, $b = Opal.to_ary($c), (key = ($b[0] == null ? nil : $b[0])), (table = ($b[1] == null ? nil : $b[1])), $c; + + $writer = [key, (function() {if (key['$==']("footnotes")) { + return [] + } else { + return table + }; return nil; })()]; + $send(accum, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + return accum;}, TMP_9.$$s = self, TMP_9.$$arity = 2, TMP_9.$$has_top_level_mlhs_arg = true, TMP_9)); + self.attribute_overrides = (attr_overrides = parent_doc.$attributes().$dup()); + parent_doctype = attr_overrides.$delete("doctype"); + attr_overrides.$delete("compat-mode"); + attr_overrides.$delete("toc"); + attr_overrides.$delete("toc-placement"); + attr_overrides.$delete("toc-position"); + self.safe = parent_doc.$safe(); + if ($truthy((self.compat_mode = parent_doc.$compat_mode()))) { + + $writer = ["compat-mode", ""]; + $send(self.attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + self.sourcemap = parent_doc.$sourcemap(); + self.timings = nil; + self.path_resolver = parent_doc.$path_resolver(); + self.converter = parent_doc.$converter(); + initialize_extensions = false; + self.extensions = parent_doc.$extensions(); + } else { + + self.parent_document = nil; + self.catalog = $hash2(["ids", "refs", "footnotes", "links", "images", "indexterms", "callouts", "includes"], {"ids": $hash2([], {}), "refs": $hash2([], {}), "footnotes": [], "links": [], "images": [], "indexterms": [], "callouts": $$($nesting, 'Callouts').$new(), "includes": $hash2([], {})}); + self.attribute_overrides = (attr_overrides = $hash2([], {})); + $send(($truthy($a = options['$[]']("attributes")) ? $a : $hash2([], {})), 'each', [], (TMP_10 = function(key, val){var self = TMP_10.$$s || this, $b; + + + + if (key == null) { + key = nil; + }; + + if (val == null) { + val = nil; + }; + if ($truthy(key['$end_with?']("@"))) { + if ($truthy(key['$start_with?']("!"))) { + $b = [key.$slice(1, $rb_minus(key.$length(), 2)), false], (key = $b[0]), (val = $b[1]), $b + } else if ($truthy(key['$end_with?']("!@"))) { + $b = [key.$slice(0, $rb_minus(key.$length(), 2)), false], (key = $b[0]), (val = $b[1]), $b + } else { + $b = [key.$chop(), "" + (val) + "@"], (key = $b[0]), (val = $b[1]), $b + } + } else if ($truthy(key['$start_with?']("!"))) { + $b = [key.$slice(1, key.$length()), (function() {if (val['$==']("@")) { + return false + } else { + return nil + }; return nil; })()], (key = $b[0]), (val = $b[1]), $b + } else if ($truthy(key['$end_with?']("!"))) { + $b = [key.$chop(), (function() {if (val['$==']("@")) { + return false + } else { + return nil + }; return nil; })()], (key = $b[0]), (val = $b[1]), $b}; + + $writer = [key.$downcase(), val]; + $send(attr_overrides, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];;}, TMP_10.$$s = self, TMP_10.$$arity = 2, TMP_10)); + if ($truthy((to_file = options['$[]']("to_file")))) { + + $writer = ["outfilesuffix", $$$('::', 'File').$extname(to_file)]; + $send(attr_overrides, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if ($truthy((safe_mode = options['$[]']("safe"))['$!']())) { + self.safe = $$$($$($nesting, 'SafeMode'), 'SECURE') + } else if ($truthy($$$('::', 'Integer')['$==='](safe_mode))) { + self.safe = safe_mode + } else { + + try { + self.safe = $$($nesting, 'SafeMode').$value_for_name(safe_mode.$to_s()) + } catch ($err) { + if (Opal.rescue($err, [$$($nesting, 'StandardError')])) { + try { + self.safe = $$$($$($nesting, 'SafeMode'), 'SECURE') + } finally { Opal.pop_exception() } + } else { throw $err; } + }; + }; + self.compat_mode = attr_overrides['$key?']("compat-mode"); + self.sourcemap = options['$[]']("sourcemap"); + self.timings = options.$delete("timings"); + self.path_resolver = $$($nesting, 'PathResolver').$new(); + self.converter = nil; + initialize_extensions = (($b = $$$('::', 'Asciidoctor', 'skip_raise')) && ($a = $$$($b, 'Extensions', 'skip_raise')) ? 'constant' : nil); + self.extensions = nil; + }; + self.parsed = false; + self.header = (self.header_attributes = nil); + self.counters = $hash2([], {}); + self.attributes_modified = $$$('::', 'Set').$new(); + self.docinfo_processor_extensions = $hash2([], {}); + header_footer = ($truthy($c = options['$[]']("header_footer")) ? $c : (($writer = ["header_footer", false]), $send(options, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + (self.options = options).$freeze(); + attrs = self.attributes; + + $writer = ["sectids", ""]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["toc-placement", "auto"]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + if ($truthy(header_footer)) { + + + $writer = ["copycss", ""]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["embedded", nil]; + $send(attr_overrides, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + } else { + + + $writer = ["notitle", ""]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["embedded", ""]; + $send(attr_overrides, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + }; + + $writer = ["stylesheet", ""]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["webfonts", ""]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["prewrap", ""]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["attribute-undefined", $$($nesting, 'Compliance').$attribute_undefined()]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["attribute-missing", $$($nesting, 'Compliance').$attribute_missing()]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["iconfont-remote", ""]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["caution-caption", "Caution"]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["important-caption", "Important"]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["note-caption", "Note"]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["tip-caption", "Tip"]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["warning-caption", "Warning"]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["example-caption", "Example"]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["figure-caption", "Figure"]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["table-caption", "Table"]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["toc-title", "Table of Contents"]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["section-refsig", "Section"]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["part-refsig", "Part"]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["chapter-refsig", "Chapter"]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["appendix-caption", (($writer = ["appendix-refsig", "Appendix"]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["untitled-label", "Untitled"]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["version-label", "Version"]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["last-update-label", "Last updated"]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["asciidoctor", ""]; + $send(attr_overrides, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["asciidoctor-version", $$($nesting, 'VERSION')]; + $send(attr_overrides, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["safe-mode-name", (safe_mode_name = $$($nesting, 'SafeMode').$name_for_value(self.safe))]; + $send(attr_overrides, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["" + "safe-mode-" + (safe_mode_name), ""]; + $send(attr_overrides, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["safe-mode-level", self.safe]; + $send(attr_overrides, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + ($truthy($c = attr_overrides['$[]']("max-include-depth")) ? $c : (($writer = ["max-include-depth", 64]), $send(attr_overrides, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + ($truthy($c = attr_overrides['$[]']("allow-uri-read")) ? $c : (($writer = ["allow-uri-read", nil]), $send(attr_overrides, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + + $writer = ["user-home", $$($nesting, 'USER_HOME')]; + $send(attr_overrides, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + if ($truthy(attr_overrides['$key?']("numbered"))) { + + $writer = ["sectnums", attr_overrides.$delete("numbered")]; + $send(attr_overrides, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if ($truthy((base_dir_val = options['$[]']("base_dir")))) { + self.base_dir = (($writer = ["docdir", $$$('::', 'File').$expand_path(base_dir_val)]), $send(attr_overrides, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]) + } else if ($truthy(attr_overrides['$[]']("docdir"))) { + self.base_dir = attr_overrides['$[]']("docdir") + } else { + self.base_dir = (($writer = ["docdir", $$$('::', 'Dir').$pwd()]), $send(attr_overrides, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]) + }; + if ($truthy((backend_val = options['$[]']("backend")))) { + + $writer = ["backend", "" + (backend_val)]; + $send(attr_overrides, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if ($truthy((doctype_val = options['$[]']("doctype")))) { + + $writer = ["doctype", "" + (doctype_val)]; + $send(attr_overrides, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if ($truthy($rb_ge(self.safe, $$$($$($nesting, 'SafeMode'), 'SERVER')))) { + + ($truthy($c = attr_overrides['$[]']("copycss")) ? $c : (($writer = ["copycss", nil]), $send(attr_overrides, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + ($truthy($c = attr_overrides['$[]']("source-highlighter")) ? $c : (($writer = ["source-highlighter", nil]), $send(attr_overrides, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + ($truthy($c = attr_overrides['$[]']("backend")) ? $c : (($writer = ["backend", $$($nesting, 'DEFAULT_BACKEND')]), $send(attr_overrides, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + if ($truthy(($truthy($c = parent_doc['$!']()) ? attr_overrides['$key?']("docfile") : $c))) { + + $writer = ["docfile", attr_overrides['$[]']("docfile")['$[]'](Opal.Range.$new($rb_plus(attr_overrides['$[]']("docdir").$length(), 1), -1, false))]; + $send(attr_overrides, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + + $writer = ["docdir", ""]; + $send(attr_overrides, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["user-home", "."]; + $send(attr_overrides, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + if ($truthy($rb_ge(self.safe, $$$($$($nesting, 'SafeMode'), 'SECURE')))) { + + if ($truthy(attr_overrides['$key?']("max-attribute-value-size"))) { + } else { + + $writer = ["max-attribute-value-size", 4096]; + $send(attr_overrides, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + if ($truthy(attr_overrides['$key?']("linkcss"))) { + } else { + + $writer = ["linkcss", ""]; + $send(attr_overrides, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + ($truthy($c = attr_overrides['$[]']("icons")) ? $c : (($writer = ["icons", nil]), $send(attr_overrides, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]));};}; + self.max_attribute_value_size = (function() {if ($truthy((size = ($truthy($c = attr_overrides['$[]']("max-attribute-value-size")) ? $c : (($writer = ["max-attribute-value-size", nil]), $send(attr_overrides, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]))))) { + return size.$to_i().$abs() + } else { + return nil + }; return nil; })(); + $send(attr_overrides, 'delete_if', [], (TMP_11 = function(key, val){var self = TMP_11.$$s || this, $d, verdict = nil; + + + + if (key == null) { + key = nil; + }; + + if (val == null) { + val = nil; + }; + if ($truthy(val)) { + + if ($truthy(($truthy($d = $$$('::', 'String')['$==='](val)) ? val['$end_with?']("@") : $d))) { + $d = [val.$chop(), true], (val = $d[0]), (verdict = $d[1]), $d}; + + $writer = [key, val]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + } else { + + attrs.$delete(key); + verdict = val['$=='](false); + }; + return verdict;}, TMP_11.$$s = self, TMP_11.$$arity = 2, TMP_11)); + if ($truthy(parent_doc)) { + + self.backend = attrs['$[]']("backend"); + if ((self.doctype = (($writer = ["doctype", parent_doctype]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]))['$==']($$($nesting, 'DEFAULT_DOCTYPE'))) { + } else { + self.$update_doctype_attributes($$($nesting, 'DEFAULT_DOCTYPE')) + }; + self.reader = $$($nesting, 'Reader').$new(data, options['$[]']("cursor")); + if ($truthy(self.sourcemap)) { + self.source_location = self.reader.$cursor()}; + $$($nesting, 'Parser').$parse(self.reader, self); + self.$restore_attributes(); + return (self.parsed = true); + } else { + + self.backend = nil; + if (($truthy($c = attrs['$[]']("backend")) ? $c : (($writer = ["backend", $$($nesting, 'DEFAULT_BACKEND')]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]))['$==']("manpage")) { + self.doctype = (($writer = ["doctype", (($writer = ["doctype", "manpage"]), $send(attr_overrides, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]) + } else { + self.doctype = ($truthy($c = attrs['$[]']("doctype")) ? $c : (($writer = ["doctype", $$($nesting, 'DEFAULT_DOCTYPE')]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])) + }; + self.$update_backend_attributes(attrs['$[]']("backend"), true); + now = (function() {if ($truthy($$$('::', 'ENV')['$[]']("SOURCE_DATE_EPOCH"))) { + return $$$('::', 'Time').$at(self.$Integer($$$('::', 'ENV')['$[]']("SOURCE_DATE_EPOCH"))).$utc() + } else { + return $$$('::', 'Time').$now() + }; return nil; })(); + if ($truthy((localdate = attrs['$[]']("localdate")))) { + localyear = ($truthy($c = attrs['$[]']("localyear")) ? $c : (($writer = ["localyear", (function() {if (localdate.$index("-")['$=='](4)) { + + return localdate.$slice(0, 4); + } else { + return nil + }; return nil; })()]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])) + } else { + + localdate = (($writer = ["localdate", now.$strftime("%F")]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]); + localyear = ($truthy($c = attrs['$[]']("localyear")) ? $c : (($writer = ["localyear", now.$year().$to_s()]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + }; + localtime = ($truthy($c = attrs['$[]']("localtime")) ? $c : (($writer = ["localtime", now.$strftime("" + "%T " + ((function() {if (now.$utc_offset()['$=='](0)) { + return "UTC" + } else { + return "%z" + }; return nil; })()))]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + ($truthy($c = attrs['$[]']("localdatetime")) ? $c : (($writer = ["localdatetime", "" + (localdate) + " " + (localtime)]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + ($truthy($c = attrs['$[]']("docdate")) ? $c : (($writer = ["docdate", localdate]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + ($truthy($c = attrs['$[]']("docyear")) ? $c : (($writer = ["docyear", localyear]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + ($truthy($c = attrs['$[]']("doctime")) ? $c : (($writer = ["doctime", localtime]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + ($truthy($c = attrs['$[]']("docdatetime")) ? $c : (($writer = ["docdatetime", "" + (localdate) + " " + (localtime)]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + ($truthy($c = attrs['$[]']("stylesdir")) ? $c : (($writer = ["stylesdir", "."]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + ($truthy($c = attrs['$[]']("iconsdir")) ? $c : (($writer = ["iconsdir", "" + (attrs.$fetch("imagesdir", "./images")) + "/icons"]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + if ($truthy(initialize_extensions)) { + if ($truthy((ext_registry = options['$[]']("extension_registry")))) { + if ($truthy(($truthy($c = $$$($$($nesting, 'Extensions'), 'Registry')['$==='](ext_registry)) ? $c : ($truthy($d = $$$('::', 'RUBY_ENGINE_JRUBY')) ? $$$($$$($$$('::', 'AsciidoctorJ'), 'Extensions'), 'ExtensionRegistry')['$==='](ext_registry) : $d)))) { + self.extensions = ext_registry.$activate(self)} + } else if ($truthy($$$('::', 'Proc')['$===']((ext_block = options['$[]']("extensions"))))) { + self.extensions = $send($$($nesting, 'Extensions'), 'create', [], ext_block.$to_proc()).$activate(self) + } else if ($truthy($$($nesting, 'Extensions').$groups()['$empty?']()['$!']())) { + self.extensions = $$$($$($nesting, 'Extensions'), 'Registry').$new().$activate(self)}}; + self.reader = $$($nesting, 'PreprocessorReader').$new(self, data, $$$($$($nesting, 'Reader'), 'Cursor').$new(attrs['$[]']("docfile"), self.base_dir), $hash2(["normalize"], {"normalize": true})); + if ($truthy(self.sourcemap)) { + return (self.source_location = self.reader.$cursor()) + } else { + return nil + }; + }; + }, TMP_Document_initialize_8.$$arity = -1); + + Opal.def(self, '$parse', TMP_Document_parse_12 = function $$parse(data) { + var $a, TMP_13, TMP_14, self = this, doc = nil, exts = nil; + + + + if (data == null) { + data = nil; + }; + if ($truthy(self.parsed)) { + return self + } else { + + doc = self; + if ($truthy(data)) { + + self.reader = $$($nesting, 'PreprocessorReader').$new(doc, data, $$$($$($nesting, 'Reader'), 'Cursor').$new(self.attributes['$[]']("docfile"), self.base_dir), $hash2(["normalize"], {"normalize": true})); + if ($truthy(self.sourcemap)) { + self.source_location = self.reader.$cursor()};}; + if ($truthy(($truthy($a = (exts = (function() {if ($truthy(self.parent_document)) { + return nil + } else { + return self.extensions + }; return nil; })())) ? exts['$preprocessors?']() : $a))) { + $send(exts.$preprocessors(), 'each', [], (TMP_13 = function(ext){var self = TMP_13.$$s || this, $b; + if (self.reader == null) self.reader = nil; + + + + if (ext == null) { + ext = nil; + }; + return (self.reader = ($truthy($b = ext.$process_method()['$[]'](doc, self.reader)) ? $b : self.reader));}, TMP_13.$$s = self, TMP_13.$$arity = 1, TMP_13))}; + $$($nesting, 'Parser').$parse(self.reader, doc, $hash2(["header_only"], {"header_only": self.options['$[]']("parse_header_only")})); + self.$restore_attributes(); + if ($truthy(($truthy($a = exts) ? exts['$tree_processors?']() : $a))) { + $send(exts.$tree_processors(), 'each', [], (TMP_14 = function(ext){var self = TMP_14.$$s || this, $b, $c, result = nil; + + + + if (ext == null) { + ext = nil; + }; + if ($truthy(($truthy($b = ($truthy($c = (result = ext.$process_method()['$[]'](doc))) ? $$($nesting, 'Document')['$==='](result) : $c)) ? result['$!='](doc) : $b))) { + return (doc = result) + } else { + return nil + };}, TMP_14.$$s = self, TMP_14.$$arity = 1, TMP_14))}; + self.parsed = true; + return doc; + }; + }, TMP_Document_parse_12.$$arity = -1); + + Opal.def(self, '$counter', TMP_Document_counter_15 = function $$counter(name, seed) { + var $a, self = this, attr_seed = nil, attr_val = nil, $writer = nil; + + + + if (seed == null) { + seed = nil; + }; + if ($truthy(self.parent_document)) { + return self.parent_document.$counter(name, seed)}; + if ($truthy(($truthy($a = (attr_seed = (attr_val = self.attributes['$[]'](name))['$nil_or_empty?']()['$!']())) ? self.counters['$key?'](name) : $a))) { + + $writer = [name, (($writer = [name, self.$nextval(attr_val)]), $send(self.counters, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])]; + $send(self.attributes, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + } else if ($truthy(seed)) { + + $writer = [name, (($writer = [name, (function() {if (seed['$=='](seed.$to_i().$to_s())) { + return seed.$to_i() + } else { + return seed + }; return nil; })()]), $send(self.counters, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])]; + $send(self.attributes, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + } else { + + $writer = [name, (($writer = [name, self.$nextval((function() {if ($truthy(attr_seed)) { + return attr_val + } else { + return 0 + }; return nil; })())]), $send(self.counters, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])]; + $send(self.attributes, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + }; + }, TMP_Document_counter_15.$$arity = -2); + + Opal.def(self, '$increment_and_store_counter', TMP_Document_increment_and_store_counter_16 = function $$increment_and_store_counter(counter_name, block) { + var self = this; + + return $$($nesting, 'AttributeEntry').$new(counter_name, self.$counter(counter_name)).$save_to(block.$attributes()).$value() + }, TMP_Document_increment_and_store_counter_16.$$arity = 2); + Opal.alias(self, "counter_increment", "increment_and_store_counter"); + + Opal.def(self, '$nextval', TMP_Document_nextval_17 = function $$nextval(current) { + var self = this, intval = nil; + + if ($truthy($$$('::', 'Integer')['$==='](current))) { + return $rb_plus(current, 1) + } else { + + intval = current.$to_i(); + if ($truthy(intval.$to_s()['$!='](current.$to_s()))) { + return $rb_plus(current['$[]'](0).$ord(), 1).$chr() + } else { + return $rb_plus(intval, 1) + }; + } + }, TMP_Document_nextval_17.$$arity = 1); + + Opal.def(self, '$register', TMP_Document_register_18 = function $$register(type, value) { + var $a, $b, self = this, $case = nil, id = nil, reftext = nil, $logical_op_recvr_tmp_1 = nil, $writer = nil, ref = nil, refs = nil; + + return (function() {$case = type; + if ("ids"['$===']($case)) { + $b = value, $a = Opal.to_ary($b), (id = ($a[0] == null ? nil : $a[0])), (reftext = ($a[1] == null ? nil : $a[1])), $b; + + $logical_op_recvr_tmp_1 = self.catalog['$[]']("ids"); + return ($truthy($a = $logical_op_recvr_tmp_1['$[]'](id)) ? $a : (($writer = [id, ($truthy($b = reftext) ? $b : $rb_plus($rb_plus("[", id), "]"))]), $send($logical_op_recvr_tmp_1, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]));;} + else if ("refs"['$===']($case)) { + $b = value, $a = Opal.to_ary($b), (id = ($a[0] == null ? nil : $a[0])), (ref = ($a[1] == null ? nil : $a[1])), (reftext = ($a[2] == null ? nil : $a[2])), $b; + if ($truthy((refs = self.catalog['$[]']("refs"))['$key?'](id))) { + return nil + } else { + + + $writer = [id, ($truthy($a = reftext) ? $a : $rb_plus($rb_plus("[", id), "]"))]; + $send(self.catalog['$[]']("ids"), '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = [id, ref]; + $send(refs, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];; + };} + else if ("footnotes"['$===']($case) || "indexterms"['$===']($case)) {return self.catalog['$[]'](type)['$<<'](value)} + else {if ($truthy(self.options['$[]']("catalog_assets"))) { + return self.catalog['$[]'](type)['$<<']((function() {if (type['$==']("images")) { + + return $$($nesting, 'ImageReference').$new(value['$[]'](0), value['$[]'](1)); + } else { + return value + }; return nil; })()) + } else { + return nil + }}})() + }, TMP_Document_register_18.$$arity = 2); + + Opal.def(self, '$footnotes?', TMP_Document_footnotes$q_19 = function() { + var self = this; + + if ($truthy(self.catalog['$[]']("footnotes")['$empty?']())) { + return false + } else { + return true + } + }, TMP_Document_footnotes$q_19.$$arity = 0); + + Opal.def(self, '$footnotes', TMP_Document_footnotes_20 = function $$footnotes() { + var self = this; + + return self.catalog['$[]']("footnotes") + }, TMP_Document_footnotes_20.$$arity = 0); + + Opal.def(self, '$callouts', TMP_Document_callouts_21 = function $$callouts() { + var self = this; + + return self.catalog['$[]']("callouts") + }, TMP_Document_callouts_21.$$arity = 0); + + Opal.def(self, '$nested?', TMP_Document_nested$q_22 = function() { + var self = this; + + if ($truthy(self.parent_document)) { + return true + } else { + return false + } + }, TMP_Document_nested$q_22.$$arity = 0); + + Opal.def(self, '$embedded?', TMP_Document_embedded$q_23 = function() { + var self = this; + + return self.attributes['$key?']("embedded") + }, TMP_Document_embedded$q_23.$$arity = 0); + + Opal.def(self, '$extensions?', TMP_Document_extensions$q_24 = function() { + var self = this; + + if ($truthy(self.extensions)) { + return true + } else { + return false + } + }, TMP_Document_extensions$q_24.$$arity = 0); + + Opal.def(self, '$source', TMP_Document_source_25 = function $$source() { + var self = this; + + if ($truthy(self.reader)) { + return self.reader.$source() + } else { + return nil + } + }, TMP_Document_source_25.$$arity = 0); + + Opal.def(self, '$source_lines', TMP_Document_source_lines_26 = function $$source_lines() { + var self = this; + + if ($truthy(self.reader)) { + return self.reader.$source_lines() + } else { + return nil + } + }, TMP_Document_source_lines_26.$$arity = 0); + + Opal.def(self, '$basebackend?', TMP_Document_basebackend$q_27 = function(base) { + var self = this; + + return self.attributes['$[]']("basebackend")['$=='](base) + }, TMP_Document_basebackend$q_27.$$arity = 1); + + Opal.def(self, '$title', TMP_Document_title_28 = function $$title() { + var self = this; + + return self.$doctitle() + }, TMP_Document_title_28.$$arity = 0); + + Opal.def(self, '$title=', TMP_Document_title$eq_29 = function(title) { + var self = this, sect = nil, $writer = nil; + + + if ($truthy((sect = self.header))) { + } else { + + $writer = ["header"]; + $send((sect = (self.header = $$($nesting, 'Section').$new(self, 0))), 'sectname=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + + $writer = [title]; + $send(sect, 'title=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];; + }, TMP_Document_title$eq_29.$$arity = 1); + + Opal.def(self, '$doctitle', TMP_Document_doctitle_30 = function $$doctitle(opts) { + var $a, self = this, val = nil, sect = nil, separator = nil; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + if ($truthy((val = self.attributes['$[]']("title")))) { + } else if ($truthy((sect = self.$first_section()))) { + val = sect.$title() + } else if ($truthy(($truthy($a = opts['$[]']("use_fallback")) ? (val = self.attributes['$[]']("untitled-label")) : $a)['$!']())) { + return nil}; + if ($truthy((separator = opts['$[]']("partition")))) { + return $$($nesting, 'Title').$new(val, opts.$merge($hash2(["separator"], {"separator": (function() {if (separator['$=='](true)) { + return self.attributes['$[]']("title-separator") + } else { + return separator + }; return nil; })()}))) + } else if ($truthy(($truthy($a = opts['$[]']("sanitize")) ? val['$include?']("<") : $a))) { + return val.$gsub($$($nesting, 'XmlSanitizeRx'), "").$squeeze(" ").$strip() + } else { + return val + }; + }, TMP_Document_doctitle_30.$$arity = -1); + Opal.alias(self, "name", "doctitle"); + + Opal.def(self, '$author', TMP_Document_author_31 = function $$author() { + var self = this; + + return self.attributes['$[]']("author") + }, TMP_Document_author_31.$$arity = 0); + + Opal.def(self, '$authors', TMP_Document_authors_32 = function $$authors() { + var $a, self = this, attrs = nil, authors = nil, num_authors = nil, idx = nil; + + if ($truthy((attrs = self.attributes)['$key?']("author"))) { + + authors = [$$($nesting, 'Author').$new(attrs['$[]']("author"), attrs['$[]']("firstname"), attrs['$[]']("middlename"), attrs['$[]']("lastname"), attrs['$[]']("authorinitials"), attrs['$[]']("email"))]; + if ($truthy($rb_gt((num_authors = ($truthy($a = attrs['$[]']("authorcount")) ? $a : 0)), 1))) { + + idx = 1; + while ($truthy($rb_lt(idx, num_authors))) { + + idx = $rb_plus(idx, 1); + authors['$<<']($$($nesting, 'Author').$new(attrs['$[]']("" + "author_" + (idx)), attrs['$[]']("" + "firstname_" + (idx)), attrs['$[]']("" + "middlename_" + (idx)), attrs['$[]']("" + "lastname_" + (idx)), attrs['$[]']("" + "authorinitials_" + (idx)), attrs['$[]']("" + "email_" + (idx)))); + };}; + return authors; + } else { + return [] + } + }, TMP_Document_authors_32.$$arity = 0); + + Opal.def(self, '$revdate', TMP_Document_revdate_33 = function $$revdate() { + var self = this; + + return self.attributes['$[]']("revdate") + }, TMP_Document_revdate_33.$$arity = 0); + + Opal.def(self, '$notitle', TMP_Document_notitle_34 = function $$notitle() { + var $a, self = this; + + return ($truthy($a = self.attributes['$key?']("showtitle")['$!']()) ? self.attributes['$key?']("notitle") : $a) + }, TMP_Document_notitle_34.$$arity = 0); + + Opal.def(self, '$noheader', TMP_Document_noheader_35 = function $$noheader() { + var self = this; + + return self.attributes['$key?']("noheader") + }, TMP_Document_noheader_35.$$arity = 0); + + Opal.def(self, '$nofooter', TMP_Document_nofooter_36 = function $$nofooter() { + var self = this; + + return self.attributes['$key?']("nofooter") + }, TMP_Document_nofooter_36.$$arity = 0); + + Opal.def(self, '$first_section', TMP_Document_first_section_37 = function $$first_section() { + var $a, TMP_38, self = this; + + return ($truthy($a = self.header) ? $a : $send(self.blocks, 'find', [], (TMP_38 = function(e){var self = TMP_38.$$s || this; + + + + if (e == null) { + e = nil; + }; + return e.$context()['$==']("section");}, TMP_38.$$s = self, TMP_38.$$arity = 1, TMP_38))) + }, TMP_Document_first_section_37.$$arity = 0); + + Opal.def(self, '$has_header?', TMP_Document_has_header$q_39 = function() { + var self = this; + + if ($truthy(self.header)) { + return true + } else { + return false + } + }, TMP_Document_has_header$q_39.$$arity = 0); + Opal.alias(self, "header?", "has_header?"); + + Opal.def(self, '$<<', TMP_Document_$lt$lt_40 = function(block) { + var $iter = TMP_Document_$lt$lt_40.$$p, $yield = $iter || nil, self = this, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_Document_$lt$lt_40.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + + if (block.$context()['$==']("section")) { + self.$assign_numeral(block)}; + return $send(self, Opal.find_super_dispatcher(self, '<<', TMP_Document_$lt$lt_40, false), $zuper, $iter); + }, TMP_Document_$lt$lt_40.$$arity = 1); + + Opal.def(self, '$finalize_header', TMP_Document_finalize_header_41 = function $$finalize_header(unrooted_attributes, header_valid) { + var self = this, $writer = nil; + + + + if (header_valid == null) { + header_valid = true; + }; + self.$clear_playback_attributes(unrooted_attributes); + self.$save_attributes(); + if ($truthy(header_valid)) { + } else { + + $writer = ["invalid-header", true]; + $send(unrooted_attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + return unrooted_attributes; + }, TMP_Document_finalize_header_41.$$arity = -2); + + Opal.def(self, '$save_attributes', TMP_Document_save_attributes_42 = function $$save_attributes() { + var $a, $b, TMP_43, self = this, attrs = nil, $writer = nil, val = nil, toc_position_val = nil, toc_val = nil, toc_placement = nil, default_toc_position = nil, default_toc_class = nil, position = nil, $case = nil; + + + if ((attrs = self.attributes)['$[]']("basebackend")['$==']("docbook")) { + + if ($truthy(($truthy($a = self['$attribute_locked?']("toc")) ? $a : self.attributes_modified['$include?']("toc")))) { + } else { + + $writer = ["toc", ""]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + if ($truthy(($truthy($a = self['$attribute_locked?']("sectnums")) ? $a : self.attributes_modified['$include?']("sectnums")))) { + } else { + + $writer = ["sectnums", ""]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + };}; + if ($truthy(($truthy($a = attrs['$key?']("doctitle")) ? $a : (val = self.$doctitle())['$!']()))) { + } else { + + $writer = ["doctitle", val]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + if ($truthy(self.id)) { + } else { + self.id = attrs['$[]']("css-signature") + }; + toc_position_val = (function() {if ($truthy((toc_val = (function() {if ($truthy(attrs.$delete("toc2"))) { + return "left" + } else { + return attrs['$[]']("toc") + }; return nil; })()))) { + if ($truthy(($truthy($a = (toc_placement = attrs.$fetch("toc-placement", "macro"))) ? toc_placement['$!=']("auto") : $a))) { + return toc_placement + } else { + return attrs['$[]']("toc-position") + } + } else { + return nil + }; return nil; })(); + if ($truthy(($truthy($a = toc_val) ? ($truthy($b = toc_val['$empty?']()['$!']()) ? $b : toc_position_val['$nil_or_empty?']()['$!']()) : $a))) { + + default_toc_position = "left"; + default_toc_class = "toc2"; + if ($truthy(toc_position_val['$nil_or_empty?']()['$!']())) { + position = toc_position_val + } else if ($truthy(toc_val['$empty?']()['$!']())) { + position = toc_val + } else { + position = default_toc_position + }; + + $writer = ["toc", ""]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["toc-placement", "auto"]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + $case = position; + if ("left"['$===']($case) || "<"['$===']($case) || "<"['$===']($case)) { + $writer = ["toc-position", "left"]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];} + else if ("right"['$===']($case) || ">"['$===']($case) || ">"['$===']($case)) { + $writer = ["toc-position", "right"]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];} + else if ("top"['$===']($case) || "^"['$===']($case)) { + $writer = ["toc-position", "top"]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];} + else if ("bottom"['$===']($case) || "v"['$===']($case)) { + $writer = ["toc-position", "bottom"]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];} + else if ("preamble"['$===']($case) || "macro"['$===']($case)) { + + $writer = ["toc-position", "content"]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["toc-placement", position]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + default_toc_class = nil;} + else { + attrs.$delete("toc-position"); + default_toc_class = nil;}; + if ($truthy(default_toc_class)) { + ($truthy($a = attrs['$[]']("toc-class")) ? $a : (($writer = ["toc-class", default_toc_class]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]))};}; + if ($truthy((self.compat_mode = attrs['$key?']("compat-mode")))) { + if ($truthy(attrs['$key?']("language"))) { + + $writer = ["source-language", attrs['$[]']("language")]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}}; + self.outfilesuffix = attrs['$[]']("outfilesuffix"); + self.header_attributes = attrs.$dup(); + if ($truthy(self.parent_document)) { + return nil + } else { + return $send($$($nesting, 'FLEXIBLE_ATTRIBUTES'), 'each', [], (TMP_43 = function(name){var self = TMP_43.$$s || this, $c; + if (self.attribute_overrides == null) self.attribute_overrides = nil; + + + + if (name == null) { + name = nil; + }; + if ($truthy(($truthy($c = self.attribute_overrides['$key?'](name)) ? self.attribute_overrides['$[]'](name) : $c))) { + return self.attribute_overrides.$delete(name) + } else { + return nil + };}, TMP_43.$$s = self, TMP_43.$$arity = 1, TMP_43)) + }; + }, TMP_Document_save_attributes_42.$$arity = 0); + + Opal.def(self, '$restore_attributes', TMP_Document_restore_attributes_44 = function $$restore_attributes() { + var self = this; + + + if ($truthy(self.parent_document)) { + } else { + self.catalog['$[]']("callouts").$rewind() + }; + return self.attributes.$replace(self.header_attributes); + }, TMP_Document_restore_attributes_44.$$arity = 0); + + Opal.def(self, '$clear_playback_attributes', TMP_Document_clear_playback_attributes_45 = function $$clear_playback_attributes(attributes) { + var self = this; + + return attributes.$delete("attribute_entries") + }, TMP_Document_clear_playback_attributes_45.$$arity = 1); + + Opal.def(self, '$playback_attributes', TMP_Document_playback_attributes_46 = function $$playback_attributes(block_attributes) { + var TMP_47, self = this; + + if ($truthy(block_attributes['$key?']("attribute_entries"))) { + return $send(block_attributes['$[]']("attribute_entries"), 'each', [], (TMP_47 = function(entry){var self = TMP_47.$$s || this, name = nil, $writer = nil; + if (self.attributes == null) self.attributes = nil; + + + + if (entry == null) { + entry = nil; + }; + name = entry.$name(); + if ($truthy(entry.$negate())) { + + self.attributes.$delete(name); + if (name['$==']("compat-mode")) { + return (self.compat_mode = false) + } else { + return nil + }; + } else { + + + $writer = [name, entry.$value()]; + $send(self.attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + if (name['$==']("compat-mode")) { + return (self.compat_mode = true) + } else { + return nil + }; + };}, TMP_47.$$s = self, TMP_47.$$arity = 1, TMP_47)) + } else { + return nil + } + }, TMP_Document_playback_attributes_46.$$arity = 1); + + Opal.def(self, '$set_attribute', TMP_Document_set_attribute_48 = function $$set_attribute(name, value) { + var self = this, resolved_value = nil, $case = nil, $writer = nil; + + + + if (value == null) { + value = ""; + }; + if ($truthy(self['$attribute_locked?'](name))) { + return false + } else { + + if ($truthy(self.max_attribute_value_size)) { + resolved_value = self.$apply_attribute_value_subs(value).$limit_bytesize(self.max_attribute_value_size) + } else { + resolved_value = self.$apply_attribute_value_subs(value) + }; + $case = name; + if ("backend"['$===']($case)) {self.$update_backend_attributes(resolved_value, self.attributes_modified['$delete?']("htmlsyntax"))} + else if ("doctype"['$===']($case)) {self.$update_doctype_attributes(resolved_value)} + else { + $writer = [name, resolved_value]; + $send(self.attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + self.attributes_modified['$<<'](name); + return resolved_value; + }; + }, TMP_Document_set_attribute_48.$$arity = -2); + + Opal.def(self, '$delete_attribute', TMP_Document_delete_attribute_49 = function $$delete_attribute(name) { + var self = this; + + if ($truthy(self['$attribute_locked?'](name))) { + return false + } else { + + self.attributes.$delete(name); + self.attributes_modified['$<<'](name); + return true; + } + }, TMP_Document_delete_attribute_49.$$arity = 1); + + Opal.def(self, '$attribute_locked?', TMP_Document_attribute_locked$q_50 = function(name) { + var self = this; + + return self.attribute_overrides['$key?'](name) + }, TMP_Document_attribute_locked$q_50.$$arity = 1); + + Opal.def(self, '$set_header_attribute', TMP_Document_set_header_attribute_51 = function $$set_header_attribute(name, value, overwrite) { + var $a, self = this, attrs = nil, $writer = nil; + + + + if (value == null) { + value = ""; + }; + + if (overwrite == null) { + overwrite = true; + }; + attrs = ($truthy($a = self.header_attributes) ? $a : self.attributes); + if ($truthy((($a = overwrite['$=='](false)) ? attrs['$key?'](name) : overwrite['$=='](false)))) { + return false + } else { + + + $writer = [name, value]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + return true; + }; + }, TMP_Document_set_header_attribute_51.$$arity = -2); + + Opal.def(self, '$apply_attribute_value_subs', TMP_Document_apply_attribute_value_subs_52 = function $$apply_attribute_value_subs(value) { + var $a, self = this; + + if ($truthy($$($nesting, 'AttributeEntryPassMacroRx')['$=~'](value))) { + if ($truthy((($a = $gvars['~']) === nil ? nil : $a['$[]'](1)))) { + + return self.$apply_subs((($a = $gvars['~']) === nil ? nil : $a['$[]'](2)), self.$resolve_pass_subs((($a = $gvars['~']) === nil ? nil : $a['$[]'](1)))); + } else { + return (($a = $gvars['~']) === nil ? nil : $a['$[]'](2)) + } + } else { + return self.$apply_header_subs(value) + } + }, TMP_Document_apply_attribute_value_subs_52.$$arity = 1); + + Opal.def(self, '$update_backend_attributes', TMP_Document_update_backend_attributes_53 = function $$update_backend_attributes(new_backend, force) { + var $a, $b, self = this, attrs = nil, current_backend = nil, current_basebackend = nil, current_doctype = nil, $writer = nil, resolved_backend = nil, new_basebackend = nil, new_filetype = nil, new_outfilesuffix = nil, current_filetype = nil, page_width = nil; + + + + if (force == null) { + force = nil; + }; + if ($truthy(($truthy($a = force) ? $a : ($truthy($b = new_backend) ? new_backend['$!='](self.backend) : $b)))) { + + $a = [self.backend, (attrs = self.attributes)['$[]']("basebackend"), self.doctype], (current_backend = $a[0]), (current_basebackend = $a[1]), (current_doctype = $a[2]), $a; + if ($truthy(new_backend['$start_with?']("xhtml"))) { + + + $writer = ["htmlsyntax", "xml"]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + new_backend = new_backend.$slice(1, new_backend.$length()); + } else if ($truthy(new_backend['$start_with?']("html"))) { + if (attrs['$[]']("htmlsyntax")['$==']("xml")) { + } else { + + $writer = ["htmlsyntax", "html"]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }}; + if ($truthy((resolved_backend = $$($nesting, 'BACKEND_ALIASES')['$[]'](new_backend)))) { + new_backend = resolved_backend}; + if ($truthy(current_doctype)) { + + if ($truthy(current_backend)) { + + attrs.$delete("" + "backend-" + (current_backend)); + attrs.$delete("" + "backend-" + (current_backend) + "-doctype-" + (current_doctype));}; + + $writer = ["" + "backend-" + (new_backend) + "-doctype-" + (current_doctype), ""]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["" + "doctype-" + (current_doctype), ""]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + } else if ($truthy(current_backend)) { + attrs.$delete("" + "backend-" + (current_backend))}; + + $writer = ["" + "backend-" + (new_backend), ""]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + self.backend = (($writer = ["backend", new_backend]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]); + if ($truthy($$$($$($nesting, 'Converter'), 'BackendInfo')['$===']((self.converter = self.$create_converter())))) { + + new_basebackend = self.converter.$basebackend(); + if ($truthy(self['$attribute_locked?']("outfilesuffix"))) { + } else { + + $writer = ["outfilesuffix", self.converter.$outfilesuffix()]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + new_filetype = self.converter.$filetype(); + } else if ($truthy(self.converter)) { + + new_basebackend = new_backend.$sub($$($nesting, 'TrailingDigitsRx'), ""); + if ($truthy((new_outfilesuffix = $$($nesting, 'DEFAULT_EXTENSIONS')['$[]'](new_basebackend)))) { + new_filetype = new_outfilesuffix.$slice(1, new_outfilesuffix.$length()) + } else { + $a = [".html", "html", "html"], (new_outfilesuffix = $a[0]), (new_basebackend = $a[1]), (new_filetype = $a[2]), $a + }; + if ($truthy(self['$attribute_locked?']("outfilesuffix"))) { + } else { + + $writer = ["outfilesuffix", new_outfilesuffix]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + } else { + self.$raise($$$('::', 'NotImplementedError'), "" + "asciidoctor: FAILED: missing converter for backend '" + (new_backend) + "'. Processing aborted.") + }; + if ($truthy((current_filetype = attrs['$[]']("filetype")))) { + attrs.$delete("" + "filetype-" + (current_filetype))}; + + $writer = ["filetype", new_filetype]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["" + "filetype-" + (new_filetype), ""]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + if ($truthy((page_width = $$($nesting, 'DEFAULT_PAGE_WIDTHS')['$[]'](new_basebackend)))) { + + $writer = ["pagewidth", page_width]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + } else { + attrs.$delete("pagewidth") + }; + if ($truthy(new_basebackend['$!='](current_basebackend))) { + + if ($truthy(current_doctype)) { + + if ($truthy(current_basebackend)) { + + attrs.$delete("" + "basebackend-" + (current_basebackend)); + attrs.$delete("" + "basebackend-" + (current_basebackend) + "-doctype-" + (current_doctype));}; + + $writer = ["" + "basebackend-" + (new_basebackend) + "-doctype-" + (current_doctype), ""]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + } else if ($truthy(current_basebackend)) { + attrs.$delete("" + "basebackend-" + (current_basebackend))}; + + $writer = ["" + "basebackend-" + (new_basebackend), ""]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["basebackend", new_basebackend]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];;}; + return new_backend; + } else { + return nil + }; + }, TMP_Document_update_backend_attributes_53.$$arity = -2); + + Opal.def(self, '$update_doctype_attributes', TMP_Document_update_doctype_attributes_54 = function $$update_doctype_attributes(new_doctype) { + var $a, self = this, attrs = nil, current_backend = nil, current_basebackend = nil, current_doctype = nil, $writer = nil; + + if ($truthy(($truthy($a = new_doctype) ? new_doctype['$!='](self.doctype) : $a))) { + + $a = [self.backend, (attrs = self.attributes)['$[]']("basebackend"), self.doctype], (current_backend = $a[0]), (current_basebackend = $a[1]), (current_doctype = $a[2]), $a; + if ($truthy(current_doctype)) { + + attrs.$delete("" + "doctype-" + (current_doctype)); + if ($truthy(current_backend)) { + + attrs.$delete("" + "backend-" + (current_backend) + "-doctype-" + (current_doctype)); + + $writer = ["" + "backend-" + (current_backend) + "-doctype-" + (new_doctype), ""]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];;}; + if ($truthy(current_basebackend)) { + + attrs.$delete("" + "basebackend-" + (current_basebackend) + "-doctype-" + (current_doctype)); + + $writer = ["" + "basebackend-" + (current_basebackend) + "-doctype-" + (new_doctype), ""]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];;}; + } else { + + if ($truthy(current_backend)) { + + $writer = ["" + "backend-" + (current_backend) + "-doctype-" + (new_doctype), ""]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if ($truthy(current_basebackend)) { + + $writer = ["" + "basebackend-" + (current_basebackend) + "-doctype-" + (new_doctype), ""]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + }; + + $writer = ["" + "doctype-" + (new_doctype), ""]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + return (self.doctype = (($writer = ["doctype", new_doctype]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + } else { + return nil + } + }, TMP_Document_update_doctype_attributes_54.$$arity = 1); + + Opal.def(self, '$create_converter', TMP_Document_create_converter_55 = function $$create_converter() { + var self = this, converter_opts = nil, $writer = nil, template_dir = nil, template_dirs = nil, converter = nil, converter_factory = nil; + + + converter_opts = $hash2([], {}); + + $writer = ["htmlsyntax", self.attributes['$[]']("htmlsyntax")]; + $send(converter_opts, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + if ($truthy((template_dir = self.options['$[]']("template_dir")))) { + template_dirs = [template_dir] + } else if ($truthy((template_dirs = self.options['$[]']("template_dirs")))) { + template_dirs = self.$Array(template_dirs)}; + if ($truthy(template_dirs)) { + + + $writer = ["template_dirs", template_dirs]; + $send(converter_opts, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["template_cache", self.options.$fetch("template_cache", true)]; + $send(converter_opts, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["template_engine", self.options['$[]']("template_engine")]; + $send(converter_opts, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["template_engine_options", self.options['$[]']("template_engine_options")]; + $send(converter_opts, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["eruby", self.options['$[]']("eruby")]; + $send(converter_opts, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["safe", self.safe]; + $send(converter_opts, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];;}; + if ($truthy((converter = self.options['$[]']("converter")))) { + converter_factory = $$$($$($nesting, 'Converter'), 'Factory').$new($$$('::', 'Hash')['$[]'](self.$backend(), converter)) + } else { + converter_factory = $$$($$($nesting, 'Converter'), 'Factory').$default(false) + }; + return converter_factory.$create(self.$backend(), converter_opts); + }, TMP_Document_create_converter_55.$$arity = 0); + + Opal.def(self, '$convert', TMP_Document_convert_56 = function $$convert(opts) { + var $a, TMP_57, self = this, $writer = nil, block = nil, output = nil, transform = nil, exts = nil; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + if ($truthy(self.timings)) { + self.timings.$start("convert")}; + if ($truthy(self.parsed)) { + } else { + self.$parse() + }; + if ($truthy(($truthy($a = $rb_ge(self.safe, $$$($$($nesting, 'SafeMode'), 'SERVER'))) ? $a : opts['$empty?']()))) { + } else { + + if ($truthy((($writer = ["outfile", opts['$[]']("outfile")]), $send(self.attributes, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]))) { + } else { + self.attributes.$delete("outfile") + }; + if ($truthy((($writer = ["outdir", opts['$[]']("outdir")]), $send(self.attributes, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]))) { + } else { + self.attributes.$delete("outdir") + }; + }; + if (self.$doctype()['$==']("inline")) { + if ($truthy((block = ($truthy($a = self.blocks['$[]'](0)) ? $a : self.header)))) { + if ($truthy(($truthy($a = block.$content_model()['$==']("compound")) ? $a : block.$content_model()['$==']("empty")))) { + self.$logger().$warn("no inline candidate; use the inline doctype to convert a single paragragh, verbatim, or raw block") + } else { + output = block.$content() + }} + } else { + + transform = (function() {if ($truthy((function() {if ($truthy(opts['$key?']("header_footer"))) { + return opts['$[]']("header_footer") + } else { + return self.options['$[]']("header_footer") + }; return nil; })())) { + return "document" + } else { + return "embedded" + }; return nil; })(); + output = self.converter.$convert(self, transform); + }; + if ($truthy(self.parent_document)) { + } else if ($truthy(($truthy($a = (exts = self.extensions)) ? exts['$postprocessors?']() : $a))) { + $send(exts.$postprocessors(), 'each', [], (TMP_57 = function(ext){var self = TMP_57.$$s || this; + + + + if (ext == null) { + ext = nil; + }; + return (output = ext.$process_method()['$[]'](self, output));}, TMP_57.$$s = self, TMP_57.$$arity = 1, TMP_57))}; + if ($truthy(self.timings)) { + self.timings.$record("convert")}; + return output; + }, TMP_Document_convert_56.$$arity = -1); + Opal.alias(self, "render", "convert"); + + Opal.def(self, '$write', TMP_Document_write_58 = function $$write(output, target) { + var $a, $b, self = this; + + + if ($truthy(self.timings)) { + self.timings.$start("write")}; + if ($truthy($$($nesting, 'Writer')['$==='](self.converter))) { + self.converter.$write(output, target) + } else { + + if ($truthy(target['$respond_to?']("write"))) { + if ($truthy(output['$nil_or_empty?']())) { + } else { + + target.$write(output.$chomp()); + target.$write($$($nesting, 'LF')); + } + } else if ($truthy($$($nesting, 'COERCE_ENCODING'))) { + $$$('::', 'IO').$write(target, output, $hash2(["encoding"], {"encoding": $$$($$$('::', 'Encoding'), 'UTF_8')})) + } else { + $$$('::', 'IO').$write(target, output) + }; + if ($truthy(($truthy($a = (($b = self.backend['$==']("manpage")) ? $$$('::', 'String')['$==='](target) : self.backend['$==']("manpage"))) ? self.converter['$respond_to?']("write_alternate_pages") : $a))) { + self.converter.$write_alternate_pages(self.attributes['$[]']("mannames"), self.attributes['$[]']("manvolnum"), target)}; + }; + if ($truthy(self.timings)) { + self.timings.$record("write")}; + return nil; + }, TMP_Document_write_58.$$arity = 2); + + Opal.def(self, '$content', TMP_Document_content_59 = function $$content() { + var $iter = TMP_Document_content_59.$$p, $yield = $iter || nil, self = this, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_Document_content_59.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + + self.attributes.$delete("title"); + return $send(self, Opal.find_super_dispatcher(self, 'content', TMP_Document_content_59, false), $zuper, $iter); + }, TMP_Document_content_59.$$arity = 0); + + Opal.def(self, '$docinfo', TMP_Document_docinfo_60 = function $$docinfo(location, suffix) { + var TMP_61, $a, TMP_62, self = this, content = nil, qualifier = nil, docinfo = nil, docinfo_file = nil, docinfo_dir = nil, docinfo_subs = nil, docinfo_path = nil, shd_content = nil, pvt_content = nil; + + + + if (location == null) { + location = "head"; + }; + + if (suffix == null) { + suffix = nil; + }; + if ($truthy($rb_ge(self.$safe(), $$$($$($nesting, 'SafeMode'), 'SECURE')))) { + return "" + } else { + + content = []; + if (location['$==']("head")) { + } else { + qualifier = "" + "-" + (location) + }; + if ($truthy(suffix)) { + } else { + suffix = self.outfilesuffix + }; + if ($truthy((docinfo = self.attributes['$[]']("docinfo"))['$nil_or_empty?']())) { + if ($truthy(self.attributes['$key?']("docinfo2"))) { + docinfo = ["private", "shared"] + } else if ($truthy(self.attributes['$key?']("docinfo1"))) { + docinfo = ["shared"] + } else { + docinfo = (function() {if ($truthy(docinfo)) { + return ["private"] + } else { + return nil + }; return nil; })() + } + } else { + docinfo = $send(docinfo.$split(","), 'map', [], (TMP_61 = function(it){var self = TMP_61.$$s || this; + + + + if (it == null) { + it = nil; + }; + return it.$strip();}, TMP_61.$$s = self, TMP_61.$$arity = 1, TMP_61)) + }; + if ($truthy(docinfo)) { + + $a = ["" + "docinfo" + (qualifier) + (suffix), self.attributes['$[]']("docinfodir"), self.$resolve_docinfo_subs()], (docinfo_file = $a[0]), (docinfo_dir = $a[1]), (docinfo_subs = $a[2]), $a; + if ($truthy(docinfo['$&'](["shared", "" + "shared-" + (location)])['$empty?']())) { + } else { + + docinfo_path = self.$normalize_system_path(docinfo_file, docinfo_dir); + if ($truthy((shd_content = self.$read_asset(docinfo_path, $hash2(["normalize"], {"normalize": true}))))) { + content['$<<'](self.$apply_subs(shd_content, docinfo_subs))}; + }; + if ($truthy(($truthy($a = self.attributes['$[]']("docname")['$nil_or_empty?']()) ? $a : docinfo['$&'](["private", "" + "private-" + (location)])['$empty?']()))) { + } else { + + docinfo_path = self.$normalize_system_path("" + (self.attributes['$[]']("docname")) + "-" + (docinfo_file), docinfo_dir); + if ($truthy((pvt_content = self.$read_asset(docinfo_path, $hash2(["normalize"], {"normalize": true}))))) { + content['$<<'](self.$apply_subs(pvt_content, docinfo_subs))}; + };}; + if ($truthy(($truthy($a = self.extensions) ? self['$docinfo_processors?'](location) : $a))) { + content = $rb_plus(content, $send(self.docinfo_processor_extensions['$[]'](location), 'map', [], (TMP_62 = function(ext){var self = TMP_62.$$s || this; + + + + if (ext == null) { + ext = nil; + }; + return ext.$process_method()['$[]'](self);}, TMP_62.$$s = self, TMP_62.$$arity = 1, TMP_62)).$compact())}; + return content.$join($$($nesting, 'LF')); + }; + }, TMP_Document_docinfo_60.$$arity = -1); + + Opal.def(self, '$resolve_docinfo_subs', TMP_Document_resolve_docinfo_subs_63 = function $$resolve_docinfo_subs() { + var self = this; + + if ($truthy(self.attributes['$key?']("docinfosubs"))) { + + return self.$resolve_subs(self.attributes['$[]']("docinfosubs"), "block", nil, "docinfo"); + } else { + return ["attributes"] + } + }, TMP_Document_resolve_docinfo_subs_63.$$arity = 0); + + Opal.def(self, '$docinfo_processors?', TMP_Document_docinfo_processors$q_64 = function(location) { + var $a, self = this, $writer = nil; + + + + if (location == null) { + location = "head"; + }; + if ($truthy(self.docinfo_processor_extensions['$key?'](location))) { + return self.docinfo_processor_extensions['$[]'](location)['$!='](false) + } else if ($truthy(($truthy($a = self.extensions) ? self.document.$extensions()['$docinfo_processors?'](location) : $a))) { + return (($writer = [location, self.document.$extensions().$docinfo_processors(location)]), $send(self.docinfo_processor_extensions, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])['$!']()['$!']() + } else { + + $writer = [location, false]; + $send(self.docinfo_processor_extensions, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + }; + }, TMP_Document_docinfo_processors$q_64.$$arity = -1); + return (Opal.def(self, '$to_s', TMP_Document_to_s_65 = function $$to_s() { + var self = this; + + return "" + "#<" + (self.$class()) + "@" + (self.$object_id()) + " {doctype: " + (self.$doctype().$inspect()) + ", doctitle: " + ((function() {if ($truthy(self.header['$!='](nil))) { + return self.header.$title() + } else { + return nil + }; return nil; })().$inspect()) + ", blocks: " + (self.blocks.$size()) + "}>" + }, TMP_Document_to_s_65.$$arity = 0), nil) && 'to_s'; + })($nesting[0], $$($nesting, 'AbstractBlock'), $nesting) + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/inline"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $hash2 = Opal.hash2, $send = Opal.send, $truthy = Opal.truthy; + + Opal.add_stubs(['$attr_reader', '$attr_accessor', '$[]', '$dup', '$convert', '$converter', '$attr', '$==', '$apply_reftext_subs', '$reftext']); + return (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + (function($base, $super, $parent_nesting) { + function $Inline(){}; + var self = $Inline = $klass($base, $super, 'Inline', $Inline); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Inline_initialize_1, TMP_Inline_block$q_2, TMP_Inline_inline$q_3, TMP_Inline_convert_4, TMP_Inline_alt_5, TMP_Inline_reftext$q_6, TMP_Inline_reftext_7, TMP_Inline_xreftext_8; + + def.text = def.type = nil; + + self.$attr_reader("text"); + self.$attr_reader("type"); + self.$attr_accessor("target"); + + Opal.def(self, '$initialize', TMP_Inline_initialize_1 = function $$initialize(parent, context, text, opts) { + var $iter = TMP_Inline_initialize_1.$$p, $yield = $iter || nil, self = this, attrs = nil; + + if ($iter) TMP_Inline_initialize_1.$$p = null; + + + if (text == null) { + text = nil; + }; + + if (opts == null) { + opts = $hash2([], {}); + }; + $send(self, Opal.find_super_dispatcher(self, 'initialize', TMP_Inline_initialize_1, false), [parent, context], null); + self.node_name = "" + "inline_" + (context); + self.text = text; + self.id = opts['$[]']("id"); + self.type = opts['$[]']("type"); + self.target = opts['$[]']("target"); + if ($truthy((attrs = opts['$[]']("attributes")))) { + return (self.attributes = attrs.$dup()) + } else { + return nil + }; + }, TMP_Inline_initialize_1.$$arity = -3); + + Opal.def(self, '$block?', TMP_Inline_block$q_2 = function() { + var self = this; + + return false + }, TMP_Inline_block$q_2.$$arity = 0); + + Opal.def(self, '$inline?', TMP_Inline_inline$q_3 = function() { + var self = this; + + return true + }, TMP_Inline_inline$q_3.$$arity = 0); + + Opal.def(self, '$convert', TMP_Inline_convert_4 = function $$convert() { + var self = this; + + return self.$converter().$convert(self) + }, TMP_Inline_convert_4.$$arity = 0); + Opal.alias(self, "render", "convert"); + + Opal.def(self, '$alt', TMP_Inline_alt_5 = function $$alt() { + var self = this; + + return self.$attr("alt") + }, TMP_Inline_alt_5.$$arity = 0); + + Opal.def(self, '$reftext?', TMP_Inline_reftext$q_6 = function() { + var $a, $b, self = this; + + return ($truthy($a = self.text) ? ($truthy($b = self.type['$==']("ref")) ? $b : self.type['$==']("bibref")) : $a) + }, TMP_Inline_reftext$q_6.$$arity = 0); + + Opal.def(self, '$reftext', TMP_Inline_reftext_7 = function $$reftext() { + var self = this, val = nil; + + if ($truthy((val = self.text))) { + + return self.$apply_reftext_subs(val); + } else { + return nil + } + }, TMP_Inline_reftext_7.$$arity = 0); + return (Opal.def(self, '$xreftext', TMP_Inline_xreftext_8 = function $$xreftext(xrefstyle) { + var self = this; + + + + if (xrefstyle == null) { + xrefstyle = nil; + }; + return self.$reftext(); + }, TMP_Inline_xreftext_8.$$arity = -1), nil) && 'xreftext'; + })($nesting[0], $$($nesting, 'AbstractNode'), $nesting) + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/list"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $hash2 = Opal.hash2, $send = Opal.send, $truthy = Opal.truthy; + + Opal.add_stubs(['$==', '$next_list', '$callouts', '$class', '$object_id', '$inspect', '$size', '$items', '$attr_accessor', '$level', '$drop', '$!', '$nil_or_empty?', '$apply_subs', '$empty?', '$===', '$[]', '$outline?', '$simple?', '$context', '$option?', '$shift', '$blocks', '$unshift', '$lines', '$source', '$parent']); + return (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + + (function($base, $super, $parent_nesting) { + function $List(){}; + var self = $List = $klass($base, $super, 'List', $List); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_List_initialize_1, TMP_List_outline$q_2, TMP_List_convert_3, TMP_List_to_s_4; + + def.context = def.document = def.style = nil; + + Opal.alias(self, "items", "blocks"); + Opal.alias(self, "content", "blocks"); + Opal.alias(self, "items?", "blocks?"); + + Opal.def(self, '$initialize', TMP_List_initialize_1 = function $$initialize(parent, context, opts) { + var $iter = TMP_List_initialize_1.$$p, $yield = $iter || nil, self = this, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_List_initialize_1.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + + + if (opts == null) { + opts = $hash2([], {}); + }; + return $send(self, Opal.find_super_dispatcher(self, 'initialize', TMP_List_initialize_1, false), $zuper, $iter); + }, TMP_List_initialize_1.$$arity = -3); + + Opal.def(self, '$outline?', TMP_List_outline$q_2 = function() { + var $a, self = this; + + return ($truthy($a = self.context['$==']("ulist")) ? $a : self.context['$==']("olist")) + }, TMP_List_outline$q_2.$$arity = 0); + + Opal.def(self, '$convert', TMP_List_convert_3 = function $$convert() { + var $iter = TMP_List_convert_3.$$p, $yield = $iter || nil, self = this, result = nil, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_List_convert_3.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + if (self.context['$==']("colist")) { + + result = $send(self, Opal.find_super_dispatcher(self, 'convert', TMP_List_convert_3, false), $zuper, $iter); + self.document.$callouts().$next_list(); + return result; + } else { + return $send(self, Opal.find_super_dispatcher(self, 'convert', TMP_List_convert_3, false), $zuper, $iter) + } + }, TMP_List_convert_3.$$arity = 0); + Opal.alias(self, "render", "convert"); + return (Opal.def(self, '$to_s', TMP_List_to_s_4 = function $$to_s() { + var self = this; + + return "" + "#<" + (self.$class()) + "@" + (self.$object_id()) + " {context: " + (self.context.$inspect()) + ", style: " + (self.style.$inspect()) + ", items: " + (self.$items().$size()) + "}>" + }, TMP_List_to_s_4.$$arity = 0), nil) && 'to_s'; + })($nesting[0], $$($nesting, 'AbstractBlock'), $nesting); + (function($base, $super, $parent_nesting) { + function $ListItem(){}; + var self = $ListItem = $klass($base, $super, 'ListItem', $ListItem); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_ListItem_initialize_5, TMP_ListItem_text$q_6, TMP_ListItem_text_7, TMP_ListItem_text$eq_8, TMP_ListItem_simple$q_9, TMP_ListItem_compound$q_10, TMP_ListItem_fold_first_11, TMP_ListItem_to_s_12; + + def.text = def.subs = def.blocks = nil; + + Opal.alias(self, "list", "parent"); + self.$attr_accessor("marker"); + + Opal.def(self, '$initialize', TMP_ListItem_initialize_5 = function $$initialize(parent, text) { + var $iter = TMP_ListItem_initialize_5.$$p, $yield = $iter || nil, self = this; + + if ($iter) TMP_ListItem_initialize_5.$$p = null; + + + if (text == null) { + text = nil; + }; + $send(self, Opal.find_super_dispatcher(self, 'initialize', TMP_ListItem_initialize_5, false), [parent, "list_item"], null); + self.text = text; + self.level = parent.$level(); + return (self.subs = $$($nesting, 'NORMAL_SUBS').$drop(0)); + }, TMP_ListItem_initialize_5.$$arity = -2); + + Opal.def(self, '$text?', TMP_ListItem_text$q_6 = function() { + var self = this; + + return self.text['$nil_or_empty?']()['$!']() + }, TMP_ListItem_text$q_6.$$arity = 0); + + Opal.def(self, '$text', TMP_ListItem_text_7 = function $$text() { + var $a, self = this; + + return ($truthy($a = self.text) ? self.$apply_subs(self.text, self.subs) : $a) + }, TMP_ListItem_text_7.$$arity = 0); + + Opal.def(self, '$text=', TMP_ListItem_text$eq_8 = function(val) { + var self = this; + + return (self.text = val) + }, TMP_ListItem_text$eq_8.$$arity = 1); + + Opal.def(self, '$simple?', TMP_ListItem_simple$q_9 = function() { + var $a, $b, $c, self = this, blk = nil; + + return ($truthy($a = self.blocks['$empty?']()) ? $a : ($truthy($b = (($c = self.blocks.$size()['$=='](1)) ? $$($nesting, 'List')['$===']((blk = self.blocks['$[]'](0))) : self.blocks.$size()['$=='](1))) ? blk['$outline?']() : $b)) + }, TMP_ListItem_simple$q_9.$$arity = 0); + + Opal.def(self, '$compound?', TMP_ListItem_compound$q_10 = function() { + var self = this; + + return self['$simple?']()['$!']() + }, TMP_ListItem_compound$q_10.$$arity = 0); + + Opal.def(self, '$fold_first', TMP_ListItem_fold_first_11 = function $$fold_first(continuation_connects_first_block, content_adjacent) { + var $a, $b, $c, $d, $e, self = this, first_block = nil, block = nil; + + + + if (continuation_connects_first_block == null) { + continuation_connects_first_block = false; + }; + + if (content_adjacent == null) { + content_adjacent = false; + }; + if ($truthy(($truthy($a = ($truthy($b = (first_block = self.blocks['$[]'](0))) ? $$($nesting, 'Block')['$==='](first_block) : $b)) ? ($truthy($b = (($c = first_block.$context()['$==']("paragraph")) ? continuation_connects_first_block['$!']() : first_block.$context()['$==']("paragraph"))) ? $b : ($truthy($c = ($truthy($d = ($truthy($e = content_adjacent) ? $e : continuation_connects_first_block['$!']())) ? first_block.$context()['$==']("literal") : $d)) ? first_block['$option?']("listparagraph") : $c)) : $a))) { + + block = self.$blocks().$shift(); + if ($truthy(self.text['$nil_or_empty?']())) { + } else { + block.$lines().$unshift(self.text) + }; + self.text = block.$source();}; + return nil; + }, TMP_ListItem_fold_first_11.$$arity = -1); + return (Opal.def(self, '$to_s', TMP_ListItem_to_s_12 = function $$to_s() { + var $a, self = this; + + return "" + "#<" + (self.$class()) + "@" + (self.$object_id()) + " {list_context: " + (self.$parent().$context().$inspect()) + ", text: " + (self.text.$inspect()) + ", blocks: " + (($truthy($a = self.blocks) ? $a : []).$size()) + "}>" + }, TMP_ListItem_to_s_12.$$arity = 0), nil) && 'to_s'; + })($nesting[0], $$($nesting, 'AbstractBlock'), $nesting); + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/parser"] = function(Opal) { + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + function $rb_plus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); + } + function $rb_gt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); + } + function $rb_lt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); + } + function $rb_times(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs * rhs : lhs['$*'](rhs); + } + function $rb_le(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs <= rhs : lhs['$<='](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $send = Opal.send, $truthy = Opal.truthy, $hash2 = Opal.hash2, $gvars = Opal.gvars; + + Opal.add_stubs(['$include', '$new', '$lambda', '$start_with?', '$match?', '$is_delimited_block?', '$raise', '$parse_document_header', '$[]', '$has_more_lines?', '$next_section', '$assign_numeral', '$<<', '$blocks', '$parse_block_metadata_lines', '$attributes', '$is_next_line_doctitle?', '$finalize_header', '$nil_or_empty?', '$title=', '$-', '$sourcemap', '$cursor', '$parse_section_title', '$id=', '$source_location=', '$header', '$attribute_locked?', '$[]=', '$id', '$parse_header_metadata', '$register', '$==', '$doctype', '$parse_manpage_header', '$=~', '$downcase', '$include?', '$sub_attributes', '$error', '$logger', '$message_with_context', '$cursor_at_line', '$backend', '$skip_blank_lines', '$save', '$update', '$is_next_line_section?', '$initialize_section', '$join', '$map', '$read_lines_until', '$to_proc', '$title', '$split', '$lstrip', '$restore_save', '$discard_save', '$context', '$empty?', '$has_header?', '$delete', '$!', '$!=', '$attr?', '$attr', '$key?', '$document', '$+', '$level', '$special', '$sectname', '$to_i', '$>', '$<', '$warn', '$next_block', '$blocks?', '$style', '$context=', '$style=', '$parent=', '$size', '$content_model', '$shift', '$unwrap_standalone_preamble', '$dup', '$fetch', '$parse_block_metadata_line', '$extensions', '$block_macros?', '$mark', '$read_line', '$terminator', '$to_s', '$masq', '$to_sym', '$registered_for_block?', '$cursor_at_mark', '$strict_verbatim_paragraphs', '$unshift_line', '$markdown_syntax', '$keys', '$chr', '$*', '$length', '$end_with?', '$===', '$parse_attributes', '$attribute_missing', '$clear', '$tr', '$basename', '$assign_caption', '$registered_for_block_macro?', '$config', '$process_method', '$replace', '$parse_callout_list', '$callouts', '$parse_list', '$match', '$parse_description_list', '$underline_style_section_titles', '$is_section_title?', '$peek_line', '$atx_section_title?', '$generate_id', '$level=', '$read_paragraph_lines', '$adjust_indentation!', '$set_option', '$map!', '$slice', '$pop', '$build_block', '$apply_subs', '$chop', '$catalog_inline_anchors', '$rekey', '$index', '$strip', '$parse_table', '$concat', '$each', '$title?', '$lock_in_subs', '$sub?', '$catalog_callouts', '$source', '$remove_sub', '$block_terminates_paragraph', '$<=', '$nil?', '$lines', '$parse_blocks', '$parse_list_item', '$items', '$scan', '$gsub', '$count', '$pre_match', '$advance', '$callout_ids', '$next_list', '$catalog_inline_anchor', '$source_location', '$marker=', '$catalog_inline_biblio_anchor', '$text=', '$resolve_ordered_list_marker', '$read_lines_for_list_item', '$skip_line_comments', '$unshift_lines', '$fold_first', '$text?', '$is_sibling_list_item?', '$find', '$delete_at', '$casecmp', '$sectname=', '$special=', '$numbered=', '$numbered', '$lineno', '$update_attributes', '$peek_lines', '$setext_section_title?', '$abs', '$line_length', '$cursor_at_prev_line', '$process_attribute_entries', '$next_line_empty?', '$process_authors', '$apply_header_subs', '$rstrip', '$each_with_index', '$compact', '$Array', '$squeeze', '$to_a', '$parse_style_attribute', '$process_attribute_entry', '$skip_comment_lines', '$store_attribute', '$sanitize_attribute_name', '$set_attribute', '$save_to', '$delete_attribute', '$ord', '$int_to_roman', '$resolve_list_marker', '$parse_colspecs', '$create_columns', '$format', '$starts_with_delimiter?', '$close_open_cell', '$parse_cellspec', '$delimiter', '$match_delimiter', '$post_match', '$buffer_has_unclosed_quotes?', '$skip_past_delimiter', '$buffer', '$buffer=', '$skip_past_escaped_delimiter', '$keep_cell_open', '$push_cellspec', '$close_cell', '$cell_open?', '$columns', '$assign_column_widths', '$has_header_option=', '$partition_header_footer', '$upto', '$shorthand_property_syntax', '$each_char', '$call', '$sub!', '$gsub!', '$%', '$begin']); + return (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + (function($base, $super, $parent_nesting) { + function $Parser(){}; + var self = $Parser = $klass($base, $super, 'Parser', $Parser); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Parser_1, TMP_Parser_2, TMP_Parser_3, TMP_Parser_initialize_4, TMP_Parser_parse_5, TMP_Parser_parse_document_header_6, TMP_Parser_parse_manpage_header_7, TMP_Parser_next_section_9, TMP_Parser_next_block_10, TMP_Parser_read_paragraph_lines_14, TMP_Parser_is_delimited_block$q_15, TMP_Parser_build_block_16, TMP_Parser_parse_blocks_17, TMP_Parser_parse_list_18, TMP_Parser_catalog_callouts_19, TMP_Parser_catalog_inline_anchor_21, TMP_Parser_catalog_inline_anchors_22, TMP_Parser_catalog_inline_biblio_anchor_24, TMP_Parser_parse_description_list_25, TMP_Parser_parse_callout_list_26, TMP_Parser_parse_list_item_27, TMP_Parser_read_lines_for_list_item_28, TMP_Parser_initialize_section_34, TMP_Parser_is_next_line_section$q_35, TMP_Parser_is_next_line_doctitle$q_36, TMP_Parser_is_section_title$q_37, TMP_Parser_atx_section_title$q_38, TMP_Parser_setext_section_title$q_39, TMP_Parser_parse_section_title_40, TMP_Parser_line_length_41, TMP_Parser_line_length_42, TMP_Parser_parse_header_metadata_43, TMP_Parser_process_authors_48, TMP_Parser_parse_block_metadata_lines_54, TMP_Parser_parse_block_metadata_line_55, TMP_Parser_process_attribute_entries_56, TMP_Parser_process_attribute_entry_57, TMP_Parser_store_attribute_58, TMP_Parser_resolve_list_marker_59, TMP_Parser_resolve_ordered_list_marker_60, TMP_Parser_is_sibling_list_item$q_62, TMP_Parser_parse_table_63, TMP_Parser_parse_colspecs_64, TMP_Parser_parse_cellspec_68, TMP_Parser_parse_style_attribute_69, TMP_Parser_adjust_indentation$B_73, TMP_Parser_sanitize_attribute_name_81; + + + self.$include($$($nesting, 'Logging')); + Opal.const_set($nesting[0], 'BlockMatchData', $$($nesting, 'Struct').$new("context", "masq", "tip", "terminator")); + Opal.const_set($nesting[0], 'TabRx', /\t/); + Opal.const_set($nesting[0], 'TabIndentRx', /^\t+/); + Opal.const_set($nesting[0], 'StartOfBlockProc', $send(self, 'lambda', [], (TMP_Parser_1 = function(l){var self = TMP_Parser_1.$$s || this, $a, $b; + + + + if (l == null) { + l = nil; + }; + return ($truthy($a = ($truthy($b = l['$start_with?']("[")) ? $$($nesting, 'BlockAttributeLineRx')['$match?'](l) : $b)) ? $a : self['$is_delimited_block?'](l));}, TMP_Parser_1.$$s = self, TMP_Parser_1.$$arity = 1, TMP_Parser_1))); + Opal.const_set($nesting[0], 'StartOfListProc', $send(self, 'lambda', [], (TMP_Parser_2 = function(l){var self = TMP_Parser_2.$$s || this; + + + + if (l == null) { + l = nil; + }; + return $$($nesting, 'AnyListRx')['$match?'](l);}, TMP_Parser_2.$$s = self, TMP_Parser_2.$$arity = 1, TMP_Parser_2))); + Opal.const_set($nesting[0], 'StartOfBlockOrListProc', $send(self, 'lambda', [], (TMP_Parser_3 = function(l){var self = TMP_Parser_3.$$s || this, $a, $b, $c; + + + + if (l == null) { + l = nil; + }; + return ($truthy($a = ($truthy($b = self['$is_delimited_block?'](l)) ? $b : ($truthy($c = l['$start_with?']("[")) ? $$($nesting, 'BlockAttributeLineRx')['$match?'](l) : $c))) ? $a : $$($nesting, 'AnyListRx')['$match?'](l));}, TMP_Parser_3.$$s = self, TMP_Parser_3.$$arity = 1, TMP_Parser_3))); + Opal.const_set($nesting[0], 'NoOp', nil); + Opal.const_set($nesting[0], 'TableCellHorzAlignments', $hash2(["<", ">", "^"], {"<": "left", ">": "right", "^": "center"})); + Opal.const_set($nesting[0], 'TableCellVertAlignments', $hash2(["<", ">", "^"], {"<": "top", ">": "bottom", "^": "middle"})); + Opal.const_set($nesting[0], 'TableCellStyles', $hash2(["d", "s", "e", "m", "h", "l", "v", "a"], {"d": "none", "s": "strong", "e": "emphasis", "m": "monospaced", "h": "header", "l": "literal", "v": "verse", "a": "asciidoc"})); + + Opal.def(self, '$initialize', TMP_Parser_initialize_4 = function $$initialize() { + var self = this; + + return self.$raise("Au contraire, mon frere. No parser instances will be running around.") + }, TMP_Parser_initialize_4.$$arity = 0); + Opal.defs(self, '$parse', TMP_Parser_parse_5 = function $$parse(reader, document, options) { + var $a, $b, $c, self = this, block_attributes = nil, new_section = nil; + + + + if (options == null) { + options = $hash2([], {}); + }; + block_attributes = self.$parse_document_header(reader, document); + if ($truthy(options['$[]']("header_only"))) { + } else { + while ($truthy(reader['$has_more_lines?']())) { + + $c = self.$next_section(reader, document, block_attributes), $b = Opal.to_ary($c), (new_section = ($b[0] == null ? nil : $b[0])), (block_attributes = ($b[1] == null ? nil : $b[1])), $c; + if ($truthy(new_section)) { + + document.$assign_numeral(new_section); + document.$blocks()['$<<'](new_section);}; + } + }; + return document; + }, TMP_Parser_parse_5.$$arity = -3); + Opal.defs(self, '$parse_document_header', TMP_Parser_parse_document_header_6 = function $$parse_document_header(reader, document) { + var $a, $b, self = this, block_attrs = nil, doc_attrs = nil, implicit_doctitle = nil, assigned_doctitle = nil, val = nil, $writer = nil, source_location = nil, _ = nil, doctitle = nil, atx = nil, separator = nil, section_title = nil, doc_id = nil, doc_role = nil, doc_reftext = nil; + + + block_attrs = self.$parse_block_metadata_lines(reader, document); + doc_attrs = document.$attributes(); + if ($truthy(($truthy($a = (implicit_doctitle = self['$is_next_line_doctitle?'](reader, block_attrs, doc_attrs['$[]']("leveloffset")))) ? block_attrs['$[]']("title") : $a))) { + return document.$finalize_header(block_attrs, false)}; + assigned_doctitle = nil; + if ($truthy((val = doc_attrs['$[]']("doctitle"))['$nil_or_empty?']())) { + } else { + + $writer = [(assigned_doctitle = val)]; + $send(document, 'title=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + if ($truthy(implicit_doctitle)) { + + if ($truthy(document.$sourcemap())) { + source_location = reader.$cursor()}; + $b = self.$parse_section_title(reader, document), $a = Opal.to_ary($b), document['$id='](($a[0] == null ? nil : $a[0])), (_ = ($a[1] == null ? nil : $a[1])), (doctitle = ($a[2] == null ? nil : $a[2])), (_ = ($a[3] == null ? nil : $a[3])), (atx = ($a[4] == null ? nil : $a[4])), $b; + if ($truthy(assigned_doctitle)) { + } else { + + $writer = [(assigned_doctitle = doctitle)]; + $send(document, 'title=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + if ($truthy(source_location)) { + + $writer = [source_location]; + $send(document.$header(), 'source_location=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if ($truthy(($truthy($a = atx) ? $a : document['$attribute_locked?']("compat-mode")))) { + } else { + + $writer = ["compat-mode", ""]; + $send(doc_attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + if ($truthy((separator = block_attrs['$[]']("separator")))) { + if ($truthy(document['$attribute_locked?']("title-separator"))) { + } else { + + $writer = ["title-separator", separator]; + $send(doc_attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }}; + + $writer = ["doctitle", (section_title = doctitle)]; + $send(doc_attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + if ($truthy((doc_id = block_attrs['$[]']("id")))) { + + $writer = [doc_id]; + $send(document, 'id=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + } else { + doc_id = document.$id() + }; + if ($truthy((doc_role = block_attrs['$[]']("role")))) { + + $writer = ["docrole", doc_role]; + $send(doc_attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if ($truthy((doc_reftext = block_attrs['$[]']("reftext")))) { + + $writer = ["reftext", doc_reftext]; + $send(doc_attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + block_attrs = $hash2([], {}); + self.$parse_header_metadata(reader, document); + if ($truthy(doc_id)) { + document.$register("refs", [doc_id, document])};}; + if ($truthy(($truthy($a = (val = doc_attrs['$[]']("doctitle"))['$nil_or_empty?']()) ? $a : val['$=='](section_title)))) { + } else { + + $writer = [(assigned_doctitle = val)]; + $send(document, 'title=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + if ($truthy(assigned_doctitle)) { + + $writer = ["doctitle", assigned_doctitle]; + $send(doc_attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if (document.$doctype()['$==']("manpage")) { + self.$parse_manpage_header(reader, document, block_attrs)}; + return document.$finalize_header(block_attrs); + }, TMP_Parser_parse_document_header_6.$$arity = 2); + Opal.defs(self, '$parse_manpage_header', TMP_Parser_parse_manpage_header_7 = function $$parse_manpage_header(reader, document, block_attributes) { + var $a, $b, TMP_8, self = this, doc_attrs = nil, $writer = nil, manvolnum = nil, mantitle = nil, manname = nil, name_section_level = nil, name_section = nil, name_section_buffer = nil, mannames = nil, error_msg = nil; + + + if ($truthy($$($nesting, 'ManpageTitleVolnumRx')['$=~']((doc_attrs = document.$attributes())['$[]']("doctitle")))) { + + + $writer = ["manvolnum", (manvolnum = (($a = $gvars['~']) === nil ? nil : $a['$[]'](2)))]; + $send(doc_attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["mantitle", (function() {if ($truthy((mantitle = (($a = $gvars['~']) === nil ? nil : $a['$[]'](1)))['$include?']($$($nesting, 'ATTR_REF_HEAD')))) { + + return document.$sub_attributes(mantitle); + } else { + return mantitle + }; return nil; })().$downcase()]; + $send(doc_attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + } else { + + self.$logger().$error(self.$message_with_context("non-conforming manpage title", $hash2(["source_location"], {"source_location": reader.$cursor_at_line(1)}))); + + $writer = ["mantitle", ($truthy($a = ($truthy($b = doc_attrs['$[]']("doctitle")) ? $b : doc_attrs['$[]']("docname"))) ? $a : "command")]; + $send(doc_attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["manvolnum", (manvolnum = "1")]; + $send(doc_attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + }; + if ($truthy(($truthy($a = (manname = doc_attrs['$[]']("manname"))) ? doc_attrs['$[]']("manpurpose") : $a))) { + + ($truthy($a = doc_attrs['$[]']("manname-title")) ? $a : (($writer = ["manname-title", "Name"]), $send(doc_attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + + $writer = ["mannames", [manname]]; + $send(doc_attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + if (document.$backend()['$==']("manpage")) { + + + $writer = ["docname", manname]; + $send(doc_attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["outfilesuffix", "" + "." + (manvolnum)]; + $send(doc_attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];;}; + } else { + + reader.$skip_blank_lines(); + reader.$save(); + block_attributes.$update(self.$parse_block_metadata_lines(reader, document)); + if ($truthy((name_section_level = self['$is_next_line_section?'](reader, $hash2([], {}))))) { + if (name_section_level['$=='](1)) { + + name_section = self.$initialize_section(reader, document, $hash2([], {})); + name_section_buffer = $send(reader.$read_lines_until($hash2(["break_on_blank_lines", "skip_line_comments"], {"break_on_blank_lines": true, "skip_line_comments": true})), 'map', [], "lstrip".$to_proc()).$join(" "); + if ($truthy($$($nesting, 'ManpageNamePurposeRx')['$=~'](name_section_buffer))) { + + ($truthy($a = doc_attrs['$[]']("manname-title")) ? $a : (($writer = ["manname-title", name_section.$title()]), $send(doc_attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + if ($truthy(name_section.$id())) { + + $writer = ["manname-id", name_section.$id()]; + $send(doc_attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + + $writer = ["manpurpose", (($a = $gvars['~']) === nil ? nil : $a['$[]'](2))]; + $send(doc_attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + if ($truthy((manname = (($a = $gvars['~']) === nil ? nil : $a['$[]'](1)))['$include?']($$($nesting, 'ATTR_REF_HEAD')))) { + manname = document.$sub_attributes(manname)}; + if ($truthy(manname['$include?'](","))) { + manname = (mannames = $send(manname.$split(","), 'map', [], (TMP_8 = function(n){var self = TMP_8.$$s || this; + + + + if (n == null) { + n = nil; + }; + return n.$lstrip();}, TMP_8.$$s = self, TMP_8.$$arity = 1, TMP_8)))['$[]'](0) + } else { + mannames = [manname] + }; + + $writer = ["manname", manname]; + $send(doc_attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["mannames", mannames]; + $send(doc_attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + if (document.$backend()['$==']("manpage")) { + + + $writer = ["docname", manname]; + $send(doc_attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["outfilesuffix", "" + "." + (manvolnum)]; + $send(doc_attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];;}; + } else { + error_msg = "non-conforming name section body" + }; + } else { + error_msg = "name section must be at level 1" + } + } else { + error_msg = "name section expected" + }; + if ($truthy(error_msg)) { + + reader.$restore_save(); + self.$logger().$error(self.$message_with_context(error_msg, $hash2(["source_location"], {"source_location": reader.$cursor()}))); + + $writer = ["manname", (manname = ($truthy($a = doc_attrs['$[]']("docname")) ? $a : "command"))]; + $send(doc_attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["mannames", [manname]]; + $send(doc_attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + if (document.$backend()['$==']("manpage")) { + + + $writer = ["docname", manname]; + $send(doc_attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["outfilesuffix", "" + "." + (manvolnum)]; + $send(doc_attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];;}; + } else { + reader.$discard_save() + }; + }; + return nil; + }, TMP_Parser_parse_manpage_header_7.$$arity = 3); + Opal.defs(self, '$next_section', TMP_Parser_next_section_9 = function $$next_section(reader, parent, attributes) { + var $a, $b, $c, $d, self = this, preamble = nil, intro = nil, part = nil, has_header = nil, book = nil, document = nil, $writer = nil, section = nil, current_level = nil, expected_next_level = nil, expected_next_level_alt = nil, title = nil, sectname = nil, next_level = nil, expected_condition = nil, new_section = nil, block_cursor = nil, new_block = nil, first_block = nil, child_block = nil; + + + + if (attributes == null) { + attributes = $hash2([], {}); + }; + preamble = (intro = (part = false)); + if ($truthy(($truthy($a = (($b = parent.$context()['$==']("document")) ? parent.$blocks()['$empty?']() : parent.$context()['$==']("document"))) ? ($truthy($b = ($truthy($c = (has_header = parent['$has_header?']())) ? $c : attributes.$delete("invalid-header"))) ? $b : self['$is_next_line_section?'](reader, attributes)['$!']()) : $a))) { + + book = (document = parent).$doctype()['$==']("book"); + if ($truthy(($truthy($a = has_header) ? $a : ($truthy($b = book) ? attributes['$[]'](1)['$!=']("abstract") : $b)))) { + + preamble = (intro = $$($nesting, 'Block').$new(parent, "preamble", $hash2(["content_model"], {"content_model": "compound"}))); + if ($truthy(($truthy($a = book) ? parent['$attr?']("preface-title") : $a))) { + + $writer = [parent.$attr("preface-title")]; + $send(preamble, 'title=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + parent.$blocks()['$<<'](preamble);}; + section = parent; + current_level = 0; + if ($truthy(parent.$attributes()['$key?']("fragment"))) { + expected_next_level = -1 + } else if ($truthy(book)) { + $a = [1, 0], (expected_next_level = $a[0]), (expected_next_level_alt = $a[1]), $a + } else { + expected_next_level = 1 + }; + } else { + + book = (document = parent.$document()).$doctype()['$==']("book"); + section = self.$initialize_section(reader, parent, attributes); + attributes = (function() {if ($truthy((title = attributes['$[]']("title")))) { + return $hash2(["title"], {"title": title}) + } else { + return $hash2([], {}) + }; return nil; })(); + expected_next_level = $rb_plus((current_level = section.$level()), 1); + if (current_level['$=='](0)) { + part = book + } else if ($truthy((($a = current_level['$=='](1)) ? section.$special() : current_level['$=='](1)))) { + if ($truthy(($truthy($a = ($truthy($b = (sectname = section.$sectname())['$==']("appendix")) ? $b : sectname['$==']("preface"))) ? $a : sectname['$==']("abstract")))) { + } else { + expected_next_level = nil + }}; + }; + reader.$skip_blank_lines(); + while ($truthy(reader['$has_more_lines?']())) { + + self.$parse_block_metadata_lines(reader, document, attributes); + if ($truthy((next_level = self['$is_next_line_section?'](reader, attributes)))) { + + if ($truthy(document['$attr?']("leveloffset"))) { + next_level = $rb_plus(next_level, document.$attr("leveloffset").$to_i())}; + if ($truthy($rb_gt(next_level, current_level))) { + + if ($truthy(expected_next_level)) { + if ($truthy(($truthy($b = ($truthy($c = next_level['$=='](expected_next_level)) ? $c : ($truthy($d = expected_next_level_alt) ? next_level['$=='](expected_next_level_alt) : $d))) ? $b : $rb_lt(expected_next_level, 0)))) { + } else { + + expected_condition = (function() {if ($truthy(expected_next_level_alt)) { + return "" + "expected levels " + (expected_next_level_alt) + " or " + (expected_next_level) + } else { + return "" + "expected level " + (expected_next_level) + }; return nil; })(); + self.$logger().$warn(self.$message_with_context("" + "section title out of sequence: " + (expected_condition) + ", got level " + (next_level), $hash2(["source_location"], {"source_location": reader.$cursor()}))); + } + } else { + self.$logger().$error(self.$message_with_context("" + (sectname) + " sections do not support nested sections", $hash2(["source_location"], {"source_location": reader.$cursor()}))) + }; + $c = self.$next_section(reader, section, attributes), $b = Opal.to_ary($c), (new_section = ($b[0] == null ? nil : $b[0])), (attributes = ($b[1] == null ? nil : $b[1])), $c; + section.$assign_numeral(new_section); + section.$blocks()['$<<'](new_section); + } else if ($truthy((($b = next_level['$=='](0)) ? section['$=='](document) : next_level['$=='](0)))) { + + if ($truthy(book)) { + } else { + self.$logger().$error(self.$message_with_context("level 0 sections can only be used when doctype is book", $hash2(["source_location"], {"source_location": reader.$cursor()}))) + }; + $c = self.$next_section(reader, section, attributes), $b = Opal.to_ary($c), (new_section = ($b[0] == null ? nil : $b[0])), (attributes = ($b[1] == null ? nil : $b[1])), $c; + section.$assign_numeral(new_section); + section.$blocks()['$<<'](new_section); + } else { + break; + }; + } else { + + block_cursor = reader.$cursor(); + if ($truthy((new_block = self.$next_block(reader, ($truthy($b = intro) ? $b : section), attributes, $hash2(["parse_metadata"], {"parse_metadata": false}))))) { + + if ($truthy(part)) { + if ($truthy(section['$blocks?']()['$!']())) { + if ($truthy(new_block.$style()['$!=']("partintro"))) { + if (new_block.$context()['$==']("paragraph")) { + + + $writer = ["open"]; + $send(new_block, 'context=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["partintro"]; + $send(new_block, 'style=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + } else { + + + $writer = [(intro = $$($nesting, 'Block').$new(section, "open", $hash2(["content_model"], {"content_model": "compound"})))]; + $send(new_block, 'parent=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["partintro"]; + $send(intro, 'style=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + section.$blocks()['$<<'](intro); + }} + } else if (section.$blocks().$size()['$=='](1)) { + + first_block = section.$blocks()['$[]'](0); + if ($truthy(($truthy($b = intro['$!']()) ? first_block.$content_model()['$==']("compound") : $b))) { + self.$logger().$error(self.$message_with_context("illegal block content outside of partintro block", $hash2(["source_location"], {"source_location": block_cursor}))) + } else if ($truthy(first_block.$content_model()['$!=']("compound"))) { + + + $writer = [(intro = $$($nesting, 'Block').$new(section, "open", $hash2(["content_model"], {"content_model": "compound"})))]; + $send(new_block, 'parent=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["partintro"]; + $send(intro, 'style=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + section.$blocks().$shift(); + if (first_block.$style()['$==']("partintro")) { + + + $writer = ["paragraph"]; + $send(first_block, 'context=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = [nil]; + $send(first_block, 'style=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];;}; + intro['$<<'](first_block); + section.$blocks()['$<<'](intro);};}}; + ($truthy($b = intro) ? $b : section).$blocks()['$<<'](new_block); + attributes = $hash2([], {});}; + }; + if ($truthy($b = reader.$skip_blank_lines())) { + $b + } else { + break; + }; + }; + if ($truthy(part)) { + if ($truthy(($truthy($a = section['$blocks?']()) ? section.$blocks()['$[]'](-1).$context()['$==']("section") : $a))) { + } else { + self.$logger().$error(self.$message_with_context("invalid part, must have at least one section (e.g., chapter, appendix, etc.)", $hash2(["source_location"], {"source_location": reader.$cursor()}))) + } + } else if ($truthy(preamble)) { + if ($truthy(preamble['$blocks?']())) { + if ($truthy(($truthy($a = ($truthy($b = book) ? $b : document.$blocks()['$[]'](1))) ? $a : $$($nesting, 'Compliance').$unwrap_standalone_preamble()['$!']()))) { + } else { + + document.$blocks().$shift(); + while ($truthy((child_block = preamble.$blocks().$shift()))) { + document['$<<'](child_block) + }; + } + } else { + document.$blocks().$shift() + }}; + return [(function() {if ($truthy(section['$!='](parent))) { + return section + } else { + return nil + }; return nil; })(), attributes.$dup()]; + }, TMP_Parser_next_section_9.$$arity = -3); + Opal.defs(self, '$next_block', TMP_Parser_next_block_10 = function $$next_block(reader, parent, attributes, options) {try { + + var $a, $b, $c, TMP_11, $d, TMP_12, TMP_13, self = this, skipped = nil, text_only = nil, document = nil, extensions = nil, block_extensions = nil, block_macro_extensions = nil, this_line = nil, doc_attrs = nil, style = nil, block = nil, block_context = nil, cloaked_context = nil, terminator = nil, delimited_block = nil, $writer = nil, indented = nil, md_syntax = nil, ch0 = nil, layout_break_chars = nil, ll = nil, blk_ctx = nil, target = nil, blk_attrs = nil, $case = nil, posattrs = nil, scaledwidth = nil, extension = nil, content = nil, default_attrs = nil, match = nil, float_id = nil, float_reftext = nil, float_title = nil, float_level = nil, lines = nil, in_list = nil, admonition_name = nil, credit_line = nil, attribution = nil, citetitle = nil, language = nil, comma_idx = nil, block_cursor = nil, block_reader = nil, content_model = nil, pos_attrs = nil, block_id = nil; + if ($gvars["~"] == null) $gvars["~"] = nil; + + + + if (attributes == null) { + attributes = $hash2([], {}); + }; + + if (options == null) { + options = $hash2([], {}); + }; + if ($truthy((skipped = reader.$skip_blank_lines()))) { + } else { + return nil + }; + if ($truthy(($truthy($a = (text_only = options['$[]']("text"))) ? $rb_gt(skipped, 0) : $a))) { + + options.$delete("text"); + text_only = false;}; + document = parent.$document(); + if ($truthy(options.$fetch("parse_metadata", true))) { + while ($truthy(self.$parse_block_metadata_line(reader, document, attributes, options))) { + + reader.$shift(); + ($truthy($b = reader.$skip_blank_lines()) ? $b : Opal.ret(nil)); + }}; + if ($truthy((extensions = document.$extensions()))) { + $a = [extensions['$blocks?'](), extensions['$block_macros?']()], (block_extensions = $a[0]), (block_macro_extensions = $a[1]), $a}; + reader.$mark(); + $a = [reader.$read_line(), document.$attributes(), attributes['$[]'](1)], (this_line = $a[0]), (doc_attrs = $a[1]), (style = $a[2]), $a; + block = (block_context = (cloaked_context = (terminator = nil))); + if ($truthy((delimited_block = self['$is_delimited_block?'](this_line, true)))) { + + block_context = (cloaked_context = delimited_block.$context()); + terminator = delimited_block.$terminator(); + if ($truthy(style['$!']())) { + style = (($writer = ["style", block_context.$to_s()]), $send(attributes, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]) + } else if ($truthy(style['$!='](block_context.$to_s()))) { + if ($truthy(delimited_block.$masq()['$include?'](style))) { + block_context = style.$to_sym() + } else if ($truthy(($truthy($a = delimited_block.$masq()['$include?']("admonition")) ? $$($nesting, 'ADMONITION_STYLES')['$include?'](style) : $a))) { + block_context = "admonition" + } else if ($truthy(($truthy($a = block_extensions) ? extensions['$registered_for_block?'](style, block_context) : $a))) { + block_context = style.$to_sym() + } else { + + self.$logger().$warn(self.$message_with_context("" + "invalid style for " + (block_context) + " block: " + (style), $hash2(["source_location"], {"source_location": reader.$cursor_at_mark()}))); + style = block_context.$to_s(); + }};}; + if ($truthy(delimited_block)) { + } else { + while ($truthy(true)) { + + if ($truthy(($truthy($b = ($truthy($c = style) ? $$($nesting, 'Compliance').$strict_verbatim_paragraphs() : $c)) ? $$($nesting, 'VERBATIM_STYLES')['$include?'](style) : $b))) { + + block_context = style.$to_sym(); + reader.$unshift_line(this_line); + break;;}; + if ($truthy(text_only)) { + indented = this_line['$start_with?'](" ", $$($nesting, 'TAB')) + } else { + + md_syntax = $$($nesting, 'Compliance').$markdown_syntax(); + if ($truthy(this_line['$start_with?'](" "))) { + + $b = [true, " "], (indented = $b[0]), (ch0 = $b[1]), $b; + if ($truthy(($truthy($b = ($truthy($c = md_syntax) ? $send(this_line.$lstrip(), 'start_with?', Opal.to_a($$($nesting, 'MARKDOWN_THEMATIC_BREAK_CHARS').$keys())) : $c)) ? $$($nesting, 'MarkdownThematicBreakRx')['$match?'](this_line) : $b))) { + + block = $$($nesting, 'Block').$new(parent, "thematic_break", $hash2(["content_model"], {"content_model": "empty"})); + break;;}; + } else if ($truthy(this_line['$start_with?']($$($nesting, 'TAB')))) { + $b = [true, $$($nesting, 'TAB')], (indented = $b[0]), (ch0 = $b[1]), $b + } else { + + $b = [false, this_line.$chr()], (indented = $b[0]), (ch0 = $b[1]), $b; + layout_break_chars = (function() {if ($truthy(md_syntax)) { + return $$($nesting, 'HYBRID_LAYOUT_BREAK_CHARS') + } else { + return $$($nesting, 'LAYOUT_BREAK_CHARS') + }; return nil; })(); + if ($truthy(($truthy($b = layout_break_chars['$key?'](ch0)) ? (function() {if ($truthy(md_syntax)) { + + return $$($nesting, 'ExtLayoutBreakRx')['$match?'](this_line); + } else { + + return (($c = this_line['$==']($rb_times(ch0, (ll = this_line.$length())))) ? $rb_gt(ll, 2) : this_line['$==']($rb_times(ch0, (ll = this_line.$length())))); + }; return nil; })() : $b))) { + + block = $$($nesting, 'Block').$new(parent, layout_break_chars['$[]'](ch0), $hash2(["content_model"], {"content_model": "empty"})); + break;; + } else if ($truthy(($truthy($b = this_line['$end_with?']("]")) ? this_line['$include?']("::") : $b))) { + if ($truthy(($truthy($b = ($truthy($c = ch0['$==']("i")) ? $c : this_line['$start_with?']("video:", "audio:"))) ? $$($nesting, 'BlockMediaMacroRx')['$=~'](this_line) : $b))) { + + $b = [(($c = $gvars['~']) === nil ? nil : $c['$[]'](1)).$to_sym(), (($c = $gvars['~']) === nil ? nil : $c['$[]'](2)), (($c = $gvars['~']) === nil ? nil : $c['$[]'](3))], (blk_ctx = $b[0]), (target = $b[1]), (blk_attrs = $b[2]), $b; + block = $$($nesting, 'Block').$new(parent, blk_ctx, $hash2(["content_model"], {"content_model": "empty"})); + if ($truthy(blk_attrs)) { + + $case = blk_ctx; + if ("video"['$===']($case)) {posattrs = ["poster", "width", "height"]} + else if ("audio"['$===']($case)) {posattrs = []} + else {posattrs = ["alt", "width", "height"]}; + block.$parse_attributes(blk_attrs, posattrs, $hash2(["sub_input", "into"], {"sub_input": true, "into": attributes}));}; + if ($truthy(attributes['$key?']("style"))) { + attributes.$delete("style")}; + if ($truthy(($truthy($b = target['$include?']($$($nesting, 'ATTR_REF_HEAD'))) ? (target = block.$sub_attributes(target, $hash2(["attribute_missing"], {"attribute_missing": "drop-line"})))['$empty?']() : $b))) { + if (($truthy($b = doc_attrs['$[]']("attribute-missing")) ? $b : $$($nesting, 'Compliance').$attribute_missing())['$==']("skip")) { + return $$($nesting, 'Block').$new(parent, "paragraph", $hash2(["content_model", "source"], {"content_model": "simple", "source": [this_line]})) + } else { + + attributes.$clear(); + return nil; + }}; + if (blk_ctx['$==']("image")) { + + document.$register("images", [target, (($writer = ["imagesdir", doc_attrs['$[]']("imagesdir")]), $send(attributes, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])]); + ($truthy($b = attributes['$[]']("alt")) ? $b : (($writer = ["alt", ($truthy($c = style) ? $c : (($writer = ["default-alt", $$($nesting, 'Helpers').$basename(target, true).$tr("_-", " ")]), $send(attributes, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]))]), $send(attributes, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + if ($truthy((scaledwidth = attributes.$delete("scaledwidth"))['$nil_or_empty?']())) { + } else { + + $writer = ["scaledwidth", (function() {if ($truthy($$($nesting, 'TrailingDigitsRx')['$match?'](scaledwidth))) { + return "" + (scaledwidth) + "%" + } else { + return scaledwidth + }; return nil; })()]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + if ($truthy(attributes['$key?']("title"))) { + + + $writer = [attributes.$delete("title")]; + $send(block, 'title=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + block.$assign_caption(attributes.$delete("caption"), "figure");};}; + + $writer = ["target", target]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + break;; + } else if ($truthy(($truthy($b = (($c = ch0['$==']("t")) ? this_line['$start_with?']("toc:") : ch0['$==']("t"))) ? $$($nesting, 'BlockTocMacroRx')['$=~'](this_line) : $b))) { + + block = $$($nesting, 'Block').$new(parent, "toc", $hash2(["content_model"], {"content_model": "empty"})); + if ($truthy((($b = $gvars['~']) === nil ? nil : $b['$[]'](1)))) { + block.$parse_attributes((($b = $gvars['~']) === nil ? nil : $b['$[]'](1)), [], $hash2(["into"], {"into": attributes}))}; + break;; + } else if ($truthy(($truthy($b = ($truthy($c = block_macro_extensions) ? $$($nesting, 'CustomBlockMacroRx')['$=~'](this_line) : $c)) ? (extension = extensions['$registered_for_block_macro?']((($c = $gvars['~']) === nil ? nil : $c['$[]'](1)))) : $b))) { + + $b = [(($c = $gvars['~']) === nil ? nil : $c['$[]'](2)), (($c = $gvars['~']) === nil ? nil : $c['$[]'](3))], (target = $b[0]), (content = $b[1]), $b; + if ($truthy(($truthy($b = ($truthy($c = target['$include?']($$($nesting, 'ATTR_REF_HEAD'))) ? (target = parent.$sub_attributes(target))['$empty?']() : $c)) ? ($truthy($c = doc_attrs['$[]']("attribute-missing")) ? $c : $$($nesting, 'Compliance').$attribute_missing())['$==']("drop-line") : $b))) { + + attributes.$clear(); + return nil;}; + if (extension.$config()['$[]']("content_model")['$==']("attributes")) { + if ($truthy(content)) { + document.$parse_attributes(content, ($truthy($b = extension.$config()['$[]']("pos_attrs")) ? $b : []), $hash2(["sub_input", "into"], {"sub_input": true, "into": attributes}))} + } else { + + $writer = ["text", ($truthy($b = content) ? $b : "")]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + if ($truthy((default_attrs = extension.$config()['$[]']("default_attrs")))) { + $send(attributes, 'update', [default_attrs], (TMP_11 = function(_, old_v){var self = TMP_11.$$s || this; + + + + if (_ == null) { + _ = nil; + }; + + if (old_v == null) { + old_v = nil; + }; + return old_v;}, TMP_11.$$s = self, TMP_11.$$arity = 2, TMP_11))}; + if ($truthy((block = extension.$process_method()['$[]'](parent, target, attributes)))) { + + attributes.$replace(block.$attributes()); + break;; + } else { + + attributes.$clear(); + return nil; + };}}; + }; + }; + if ($truthy(($truthy($b = ($truthy($c = indented['$!']()) ? (ch0 = ($truthy($d = ch0) ? $d : this_line.$chr()))['$==']("<") : $c)) ? $$($nesting, 'CalloutListRx')['$=~'](this_line) : $b))) { + + reader.$unshift_line(this_line); + block = self.$parse_callout_list(reader, $gvars["~"], parent, document.$callouts()); + + $writer = ["style", "arabic"]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + break;; + } else if ($truthy($$($nesting, 'UnorderedListRx')['$match?'](this_line))) { + + reader.$unshift_line(this_line); + if ($truthy(($truthy($b = ($truthy($c = style['$!']()) ? $$($nesting, 'Section')['$==='](parent) : $c)) ? parent.$sectname()['$==']("bibliography") : $b))) { + + $writer = ["style", (style = "bibliography")]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + block = self.$parse_list(reader, "ulist", parent, style); + break;; + } else if ($truthy((match = $$($nesting, 'OrderedListRx').$match(this_line)))) { + + reader.$unshift_line(this_line); + block = self.$parse_list(reader, "olist", parent, style); + if ($truthy(block.$style())) { + + $writer = ["style", block.$style()]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + break;; + } else if ($truthy((match = $$($nesting, 'DescriptionListRx').$match(this_line)))) { + + reader.$unshift_line(this_line); + block = self.$parse_description_list(reader, match, parent); + break;; + } else if ($truthy(($truthy($b = ($truthy($c = style['$==']("float")) ? $c : style['$==']("discrete"))) ? (function() {if ($truthy($$($nesting, 'Compliance').$underline_style_section_titles())) { + + return self['$is_section_title?'](this_line, reader.$peek_line()); + } else { + return ($truthy($c = indented['$!']()) ? self['$atx_section_title?'](this_line) : $c) + }; return nil; })() : $b))) { + + reader.$unshift_line(this_line); + $c = self.$parse_section_title(reader, document, attributes['$[]']("id")), $b = Opal.to_ary($c), (float_id = ($b[0] == null ? nil : $b[0])), (float_reftext = ($b[1] == null ? nil : $b[1])), (float_title = ($b[2] == null ? nil : $b[2])), (float_level = ($b[3] == null ? nil : $b[3])), $c; + if ($truthy(float_reftext)) { + + $writer = ["reftext", float_reftext]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + block = $$($nesting, 'Block').$new(parent, "floating_title", $hash2(["content_model"], {"content_model": "empty"})); + + $writer = [float_title]; + $send(block, 'title=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + attributes.$delete("title"); + + $writer = [($truthy($b = float_id) ? $b : (function() {if ($truthy(doc_attrs['$key?']("sectids"))) { + + return $$($nesting, 'Section').$generate_id(block.$title(), document); + } else { + return nil + }; return nil; })())]; + $send(block, 'id=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = [float_level]; + $send(block, 'level=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + break;; + } else if ($truthy(($truthy($b = style) ? style['$!=']("normal") : $b))) { + if ($truthy($$($nesting, 'PARAGRAPH_STYLES')['$include?'](style))) { + + block_context = style.$to_sym(); + cloaked_context = "paragraph"; + reader.$unshift_line(this_line); + break;; + } else if ($truthy($$($nesting, 'ADMONITION_STYLES')['$include?'](style))) { + + block_context = "admonition"; + cloaked_context = "paragraph"; + reader.$unshift_line(this_line); + break;; + } else if ($truthy(($truthy($b = block_extensions) ? extensions['$registered_for_block?'](style, "paragraph") : $b))) { + + block_context = style.$to_sym(); + cloaked_context = "paragraph"; + reader.$unshift_line(this_line); + break;; + } else { + + self.$logger().$warn(self.$message_with_context("" + "invalid style for paragraph: " + (style), $hash2(["source_location"], {"source_location": reader.$cursor_at_mark()}))); + style = nil; + }}; + reader.$unshift_line(this_line); + if ($truthy(($truthy($b = indented) ? style['$!']() : $b))) { + + lines = self.$read_paragraph_lines(reader, ($truthy($b = (in_list = $$($nesting, 'ListItem')['$==='](parent))) ? skipped['$=='](0) : $b), $hash2(["skip_line_comments"], {"skip_line_comments": text_only})); + self['$adjust_indentation!'](lines); + block = $$($nesting, 'Block').$new(parent, "literal", $hash2(["content_model", "source", "attributes"], {"content_model": "verbatim", "source": lines, "attributes": attributes})); + if ($truthy(in_list)) { + block.$set_option("listparagraph")}; + } else { + + lines = self.$read_paragraph_lines(reader, (($b = skipped['$=='](0)) ? $$($nesting, 'ListItem')['$==='](parent) : skipped['$=='](0)), $hash2(["skip_line_comments"], {"skip_line_comments": true})); + if ($truthy(text_only)) { + + if ($truthy(($truthy($b = indented) ? style['$==']("normal") : $b))) { + self['$adjust_indentation!'](lines)}; + block = $$($nesting, 'Block').$new(parent, "paragraph", $hash2(["content_model", "source", "attributes"], {"content_model": "simple", "source": lines, "attributes": attributes})); + } else if ($truthy(($truthy($b = ($truthy($c = $$($nesting, 'ADMONITION_STYLE_HEADS')['$include?'](ch0)) ? this_line['$include?'](":") : $c)) ? $$($nesting, 'AdmonitionParagraphRx')['$=~'](this_line) : $b))) { + + + $writer = [0, (($b = $gvars['~']) === nil ? nil : $b.$post_match())]; + $send(lines, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["name", (admonition_name = (($writer = ["style", (($b = $gvars['~']) === nil ? nil : $b['$[]'](1))]), $send(attributes, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]).$downcase())]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["textlabel", ($truthy($b = attributes.$delete("caption")) ? $b : doc_attrs['$[]']("" + (admonition_name) + "-caption"))]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + block = $$($nesting, 'Block').$new(parent, "admonition", $hash2(["content_model", "source", "attributes"], {"content_model": "simple", "source": lines, "attributes": attributes})); + } else if ($truthy(($truthy($b = ($truthy($c = md_syntax) ? ch0['$=='](">") : $c)) ? this_line['$start_with?']("> ") : $b))) { + + $send(lines, 'map!', [], (TMP_12 = function(line){var self = TMP_12.$$s || this; + + + + if (line == null) { + line = nil; + }; + if (line['$=='](">")) { + + return line.$slice(1, line.$length()); + } else { + + if ($truthy(line['$start_with?']("> "))) { + + return line.$slice(2, line.$length()); + } else { + return line + }; + };}, TMP_12.$$s = self, TMP_12.$$arity = 1, TMP_12)); + if ($truthy(lines['$[]'](-1)['$start_with?']("-- "))) { + + credit_line = (credit_line = lines.$pop()).$slice(3, credit_line.$length()); + while ($truthy(lines['$[]'](-1)['$empty?']())) { + lines.$pop() + };}; + + $writer = ["style", "quote"]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + block = self.$build_block("quote", "compound", false, parent, $$($nesting, 'Reader').$new(lines), attributes); + if ($truthy(credit_line)) { + + $c = block.$apply_subs(credit_line).$split(", ", 2), $b = Opal.to_ary($c), (attribution = ($b[0] == null ? nil : $b[0])), (citetitle = ($b[1] == null ? nil : $b[1])), $c; + if ($truthy(attribution)) { + + $writer = ["attribution", attribution]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if ($truthy(citetitle)) { + + $writer = ["citetitle", citetitle]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];};}; + } else if ($truthy(($truthy($b = ($truthy($c = (($d = ch0['$==']("\"")) ? $rb_gt(lines.$size(), 1) : ch0['$==']("\""))) ? lines['$[]'](-1)['$start_with?']("-- ") : $c)) ? lines['$[]'](-2)['$end_with?']("\"") : $b))) { + + + $writer = [0, this_line.$slice(1, this_line.$length())]; + $send(lines, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + credit_line = (credit_line = lines.$pop()).$slice(3, credit_line.$length()); + while ($truthy(lines['$[]'](-1)['$empty?']())) { + lines.$pop() + }; + lines['$<<'](lines.$pop().$chop()); + + $writer = ["style", "quote"]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + block = $$($nesting, 'Block').$new(parent, "quote", $hash2(["content_model", "source", "attributes"], {"content_model": "simple", "source": lines, "attributes": attributes})); + $c = block.$apply_subs(credit_line).$split(", ", 2), $b = Opal.to_ary($c), (attribution = ($b[0] == null ? nil : $b[0])), (citetitle = ($b[1] == null ? nil : $b[1])), $c; + if ($truthy(attribution)) { + + $writer = ["attribution", attribution]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if ($truthy(citetitle)) { + + $writer = ["citetitle", citetitle]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + } else { + + if ($truthy(($truthy($b = indented) ? style['$==']("normal") : $b))) { + self['$adjust_indentation!'](lines)}; + block = $$($nesting, 'Block').$new(parent, "paragraph", $hash2(["content_model", "source", "attributes"], {"content_model": "simple", "source": lines, "attributes": attributes})); + }; + self.$catalog_inline_anchors(lines.$join($$($nesting, 'LF')), block, document, reader); + }; + break;; + } + }; + if ($truthy(block)) { + } else { + + if ($truthy(($truthy($a = block_context['$==']("abstract")) ? $a : block_context['$==']("partintro")))) { + block_context = "open"}; + $case = block_context; + if ("admonition"['$===']($case)) { + + $writer = ["name", (admonition_name = style.$downcase())]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["textlabel", ($truthy($a = attributes.$delete("caption")) ? $a : doc_attrs['$[]']("" + (admonition_name) + "-caption"))]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + block = self.$build_block(block_context, "compound", terminator, parent, reader, attributes);} + else if ("comment"['$===']($case)) { + self.$build_block(block_context, "skip", terminator, parent, reader, attributes); + attributes.$clear(); + return nil;} + else if ("example"['$===']($case)) {block = self.$build_block(block_context, "compound", terminator, parent, reader, attributes)} + else if ("listing"['$===']($case) || "literal"['$===']($case)) {block = self.$build_block(block_context, "verbatim", terminator, parent, reader, attributes)} + else if ("source"['$===']($case)) { + $$($nesting, 'AttributeList').$rekey(attributes, [nil, "language", "linenums"]); + if ($truthy(attributes['$key?']("language"))) { + } else if ($truthy(doc_attrs['$key?']("source-language"))) { + + $writer = ["language", ($truthy($a = doc_attrs['$[]']("source-language")) ? $a : "text")]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if ($truthy(attributes['$key?']("linenums"))) { + } else if ($truthy(($truthy($a = attributes['$key?']("linenums-option")) ? $a : doc_attrs['$key?']("source-linenums-option")))) { + + $writer = ["linenums", ""]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if ($truthy(attributes['$key?']("indent"))) { + } else if ($truthy(doc_attrs['$key?']("source-indent"))) { + + $writer = ["indent", doc_attrs['$[]']("source-indent")]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + block = self.$build_block("listing", "verbatim", terminator, parent, reader, attributes);} + else if ("fenced_code"['$===']($case)) { + + $writer = ["style", "source"]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + if ((ll = this_line.$length())['$=='](3)) { + language = nil + } else if ($truthy((comma_idx = (language = this_line.$slice(3, ll)).$index(",")))) { + if ($truthy($rb_gt(comma_idx, 0))) { + + language = language.$slice(0, comma_idx).$strip(); + if ($truthy($rb_lt(comma_idx, $rb_minus(ll, 4)))) { + + $writer = ["linenums", ""]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + } else { + + language = nil; + if ($truthy($rb_gt(ll, 4))) { + + $writer = ["linenums", ""]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + } + } else { + language = language.$lstrip() + }; + if ($truthy(language['$nil_or_empty?']())) { + if ($truthy(doc_attrs['$key?']("source-language"))) { + + $writer = ["language", ($truthy($a = doc_attrs['$[]']("source-language")) ? $a : "text")]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];} + } else { + + $writer = ["language", language]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + if ($truthy(attributes['$key?']("linenums"))) { + } else if ($truthy(($truthy($a = attributes['$key?']("linenums-option")) ? $a : doc_attrs['$key?']("source-linenums-option")))) { + + $writer = ["linenums", ""]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if ($truthy(attributes['$key?']("indent"))) { + } else if ($truthy(doc_attrs['$key?']("source-indent"))) { + + $writer = ["indent", doc_attrs['$[]']("source-indent")]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + terminator = terminator.$slice(0, 3); + block = self.$build_block("listing", "verbatim", terminator, parent, reader, attributes);} + else if ("pass"['$===']($case)) {block = self.$build_block(block_context, "raw", terminator, parent, reader, attributes)} + else if ("stem"['$===']($case) || "latexmath"['$===']($case) || "asciimath"['$===']($case)) { + if (block_context['$==']("stem")) { + + $writer = ["style", $$($nesting, 'STEM_TYPE_ALIASES')['$[]'](($truthy($a = attributes['$[]'](2)) ? $a : doc_attrs['$[]']("stem")))]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + block = self.$build_block("stem", "raw", terminator, parent, reader, attributes);} + else if ("open"['$===']($case) || "sidebar"['$===']($case)) {block = self.$build_block(block_context, "compound", terminator, parent, reader, attributes)} + else if ("table"['$===']($case)) { + block_cursor = reader.$cursor(); + block_reader = $$($nesting, 'Reader').$new(reader.$read_lines_until($hash2(["terminator", "skip_line_comments", "context", "cursor"], {"terminator": terminator, "skip_line_comments": true, "context": "table", "cursor": "at_mark"})), block_cursor); + if ($truthy(terminator['$start_with?']("|", "!"))) { + } else { + ($truthy($a = attributes['$[]']("format")) ? $a : (($writer = ["format", (function() {if ($truthy(terminator['$start_with?'](","))) { + return "csv" + } else { + return "dsv" + }; return nil; })()]), $send(attributes, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])) + }; + block = self.$parse_table(block_reader, parent, attributes);} + else if ("quote"['$===']($case) || "verse"['$===']($case)) { + $$($nesting, 'AttributeList').$rekey(attributes, [nil, "attribution", "citetitle"]); + block = self.$build_block(block_context, (function() {if (block_context['$==']("verse")) { + return "verbatim" + } else { + return "compound" + }; return nil; })(), terminator, parent, reader, attributes);} + else {if ($truthy(($truthy($a = block_extensions) ? (extension = extensions['$registered_for_block?'](block_context, cloaked_context)) : $a))) { + + if ($truthy((content_model = extension.$config()['$[]']("content_model"))['$!=']("skip"))) { + + if ($truthy((pos_attrs = ($truthy($a = extension.$config()['$[]']("pos_attrs")) ? $a : []))['$empty?']()['$!']())) { + $$($nesting, 'AttributeList').$rekey(attributes, [nil].$concat(pos_attrs))}; + if ($truthy((default_attrs = extension.$config()['$[]']("default_attrs")))) { + $send(default_attrs, 'each', [], (TMP_13 = function(k, v){var self = TMP_13.$$s || this, $e; + + + + if (k == null) { + k = nil; + }; + + if (v == null) { + v = nil; + }; + return ($truthy($e = attributes['$[]'](k)) ? $e : (($writer = [k, v]), $send(attributes, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]));}, TMP_13.$$s = self, TMP_13.$$arity = 2, TMP_13))}; + + $writer = ["cloaked-context", cloaked_context]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];;}; + block = self.$build_block(block_context, content_model, terminator, parent, reader, attributes, $hash2(["extension"], {"extension": extension})); + if ($truthy(block)) { + } else { + + attributes.$clear(); + return nil; + }; + } else { + self.$raise("" + "Unsupported block type " + (block_context) + " at " + (reader.$cursor())) + }}; + }; + if ($truthy(document.$sourcemap())) { + + $writer = [reader.$cursor_at_mark()]; + $send(block, 'source_location=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if ($truthy(attributes['$key?']("title"))) { + + $writer = [attributes.$delete("title")]; + $send(block, 'title=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + + $writer = [attributes['$[]']("style")]; + $send(block, 'style=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + if ($truthy((block_id = ($truthy($a = block.$id()) ? $a : (($writer = [attributes['$[]']("id")]), $send(block, 'id=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]))))) { + if ($truthy(document.$register("refs", [block_id, block, ($truthy($a = attributes['$[]']("reftext")) ? $a : (function() {if ($truthy(block['$title?']())) { + return block.$title() + } else { + return nil + }; return nil; })())]))) { + } else { + self.$logger().$warn(self.$message_with_context("" + "id assigned to block already in use: " + (block_id), $hash2(["source_location"], {"source_location": reader.$cursor_at_mark()}))) + }}; + if ($truthy(attributes['$empty?']())) { + } else { + block.$attributes().$update(attributes) + }; + block.$lock_in_subs(); + if ($truthy(block['$sub?']("callouts"))) { + if ($truthy(self.$catalog_callouts(block.$source(), document))) { + } else { + block.$remove_sub("callouts") + }}; + return block; + } catch ($returner) { if ($returner === Opal.returner) { return $returner.$v } throw $returner; } + }, TMP_Parser_next_block_10.$$arity = -3); + Opal.defs(self, '$read_paragraph_lines', TMP_Parser_read_paragraph_lines_14 = function $$read_paragraph_lines(reader, break_at_list, opts) { + var self = this, $writer = nil, break_condition = nil; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + + $writer = ["break_on_blank_lines", true]; + $send(opts, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["break_on_list_continuation", true]; + $send(opts, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["preserve_last_line", true]; + $send(opts, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + break_condition = (function() {if ($truthy(break_at_list)) { + + if ($truthy($$($nesting, 'Compliance').$block_terminates_paragraph())) { + return $$($nesting, 'StartOfBlockOrListProc') + } else { + return $$($nesting, 'StartOfListProc') + }; + } else { + + if ($truthy($$($nesting, 'Compliance').$block_terminates_paragraph())) { + return $$($nesting, 'StartOfBlockProc') + } else { + return $$($nesting, 'NoOp') + }; + }; return nil; })(); + return $send(reader, 'read_lines_until', [opts], break_condition.$to_proc()); + }, TMP_Parser_read_paragraph_lines_14.$$arity = -3); + Opal.defs(self, '$is_delimited_block?', TMP_Parser_is_delimited_block$q_15 = function(line, return_match_data) { + var $a, $b, self = this, line_len = nil, tip = nil, tl = nil, fenced_code = nil, tip_3 = nil, context = nil, masq = nil; + + + + if (return_match_data == null) { + return_match_data = false; + }; + if ($truthy(($truthy($a = $rb_gt((line_len = line.$length()), 1)) ? $$($nesting, 'DELIMITED_BLOCK_HEADS')['$include?'](line.$slice(0, 2)) : $a))) { + } else { + return nil + }; + if (line_len['$=='](2)) { + + tip = line; + tl = 2; + } else { + + if ($truthy($rb_le(line_len, 4))) { + + tip = line; + tl = line_len; + } else { + + tip = line.$slice(0, 4); + tl = 4; + }; + fenced_code = false; + if ($truthy($$($nesting, 'Compliance').$markdown_syntax())) { + + tip_3 = (function() {if (tl['$=='](4)) { + return tip.$chop() + } else { + return tip + }; return nil; })(); + if (tip_3['$==']("```")) { + + if ($truthy((($a = tl['$=='](4)) ? tip['$end_with?']("`") : tl['$=='](4)))) { + return nil}; + tip = tip_3; + tl = 3; + fenced_code = true;};}; + if ($truthy((($a = tl['$=='](3)) ? fenced_code['$!']() : tl['$=='](3)))) { + return nil}; + }; + if ($truthy($$($nesting, 'DELIMITED_BLOCKS')['$key?'](tip))) { + if ($truthy(($truthy($a = $rb_lt(tl, 4)) ? $a : tl['$=='](line_len)))) { + if ($truthy(return_match_data)) { + + $b = $$($nesting, 'DELIMITED_BLOCKS')['$[]'](tip), $a = Opal.to_ary($b), (context = ($a[0] == null ? nil : $a[0])), (masq = ($a[1] == null ? nil : $a[1])), $b; + return $$($nesting, 'BlockMatchData').$new(context, masq, tip, tip); + } else { + return true + } + } else if ((("" + (tip)) + ($rb_times(tip.$slice(-1, 1), $rb_minus(line_len, tl))))['$=='](line)) { + if ($truthy(return_match_data)) { + + $b = $$($nesting, 'DELIMITED_BLOCKS')['$[]'](tip), $a = Opal.to_ary($b), (context = ($a[0] == null ? nil : $a[0])), (masq = ($a[1] == null ? nil : $a[1])), $b; + return $$($nesting, 'BlockMatchData').$new(context, masq, tip, line); + } else { + return true + } + } else { + return nil + } + } else { + return nil + }; + }, TMP_Parser_is_delimited_block$q_15.$$arity = -2); + Opal.defs(self, '$build_block', TMP_Parser_build_block_16 = function $$build_block(block_context, content_model, terminator, parent, reader, attributes, options) { + var $a, $b, self = this, skip_processing = nil, parse_as_content_model = nil, lines = nil, block_reader = nil, block_cursor = nil, indent = nil, tab_size = nil, extension = nil, block = nil, $writer = nil; + + + + if (options == null) { + options = $hash2([], {}); + }; + if (content_model['$==']("skip")) { + $a = [true, "simple"], (skip_processing = $a[0]), (parse_as_content_model = $a[1]), $a + } else if (content_model['$==']("raw")) { + $a = [false, "simple"], (skip_processing = $a[0]), (parse_as_content_model = $a[1]), $a + } else { + $a = [false, content_model], (skip_processing = $a[0]), (parse_as_content_model = $a[1]), $a + }; + if ($truthy(terminator['$nil?']())) { + + if (parse_as_content_model['$==']("verbatim")) { + lines = reader.$read_lines_until($hash2(["break_on_blank_lines", "break_on_list_continuation"], {"break_on_blank_lines": true, "break_on_list_continuation": true})) + } else { + + if (content_model['$==']("compound")) { + content_model = "simple"}; + lines = self.$read_paragraph_lines(reader, false, $hash2(["skip_line_comments", "skip_processing"], {"skip_line_comments": true, "skip_processing": skip_processing})); + }; + block_reader = nil; + } else if ($truthy(parse_as_content_model['$!=']("compound"))) { + + lines = reader.$read_lines_until($hash2(["terminator", "skip_processing", "context", "cursor"], {"terminator": terminator, "skip_processing": skip_processing, "context": block_context, "cursor": "at_mark"})); + block_reader = nil; + } else if (terminator['$=='](false)) { + + lines = nil; + block_reader = reader; + } else { + + lines = nil; + block_cursor = reader.$cursor(); + block_reader = $$($nesting, 'Reader').$new(reader.$read_lines_until($hash2(["terminator", "skip_processing", "context", "cursor"], {"terminator": terminator, "skip_processing": skip_processing, "context": block_context, "cursor": "at_mark"})), block_cursor); + }; + if (content_model['$==']("verbatim")) { + if ($truthy((indent = attributes['$[]']("indent")))) { + self['$adjust_indentation!'](lines, indent, ($truthy($a = attributes['$[]']("tabsize")) ? $a : parent.$document().$attributes()['$[]']("tabsize"))) + } else if ($truthy($rb_gt((tab_size = ($truthy($a = attributes['$[]']("tabsize")) ? $a : parent.$document().$attributes()['$[]']("tabsize")).$to_i()), 0))) { + self['$adjust_indentation!'](lines, nil, tab_size)} + } else if (content_model['$==']("skip")) { + return nil}; + if ($truthy((extension = options['$[]']("extension")))) { + + attributes.$delete("style"); + if ($truthy((block = extension.$process_method()['$[]'](parent, ($truthy($a = block_reader) ? $a : $$($nesting, 'Reader').$new(lines)), attributes.$dup())))) { + + attributes.$replace(block.$attributes()); + if ($truthy((($a = block.$content_model()['$==']("compound")) ? (lines = block.$lines())['$nil_or_empty?']()['$!']() : block.$content_model()['$==']("compound")))) { + + content_model = "compound"; + block_reader = $$($nesting, 'Reader').$new(lines);}; + } else { + return nil + }; + } else { + block = $$($nesting, 'Block').$new(parent, block_context, $hash2(["content_model", "source", "attributes"], {"content_model": content_model, "source": lines, "attributes": attributes})) + }; + if ($truthy(($truthy($a = ($truthy($b = attributes['$key?']("title")) ? block.$context()['$!=']("admonition") : $b)) ? parent.$document().$attributes()['$key?']("" + (block.$context()) + "-caption") : $a))) { + + + $writer = [attributes.$delete("title")]; + $send(block, 'title=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + block.$assign_caption(attributes.$delete("caption"));}; + if (content_model['$==']("compound")) { + self.$parse_blocks(block_reader, block)}; + return block; + }, TMP_Parser_build_block_16.$$arity = -7); + Opal.defs(self, '$parse_blocks', TMP_Parser_parse_blocks_17 = function $$parse_blocks(reader, parent) { + var $a, $b, $c, self = this, block = nil; + + while ($truthy(($truthy($b = ($truthy($c = (block = self.$next_block(reader, parent))) ? parent.$blocks()['$<<'](block) : $c)) ? $b : reader['$has_more_lines?']()))) { + + } + }, TMP_Parser_parse_blocks_17.$$arity = 2); + Opal.defs(self, '$parse_list', TMP_Parser_parse_list_18 = function $$parse_list(reader, list_type, parent, style) { + var $a, $b, $c, self = this, list_block = nil, list_rx = nil, list_item = nil; + if ($gvars["~"] == null) $gvars["~"] = nil; + + + list_block = $$($nesting, 'List').$new(parent, list_type); + while ($truthy(($truthy($b = reader['$has_more_lines?']()) ? (list_rx = ($truthy($c = list_rx) ? $c : $$($nesting, 'ListRxMap')['$[]'](list_type)))['$=~'](reader.$peek_line()) : $b))) { + + if ($truthy((list_item = self.$parse_list_item(reader, list_block, $gvars["~"], (($b = $gvars['~']) === nil ? nil : $b['$[]'](1)), style)))) { + list_block.$items()['$<<'](list_item)}; + if ($truthy($b = reader.$skip_blank_lines())) { + $b + } else { + break; + }; + }; + return list_block; + }, TMP_Parser_parse_list_18.$$arity = 4); + Opal.defs(self, '$catalog_callouts', TMP_Parser_catalog_callouts_19 = function $$catalog_callouts(text, document) { + var TMP_20, self = this, found = nil, autonum = nil; + + + found = false; + autonum = 0; + if ($truthy(text['$include?']("<"))) { + $send(text, 'scan', [$$($nesting, 'CalloutScanRx')], (TMP_20 = function(){var self = TMP_20.$$s || this, $a, $b, captured = nil, num = nil; + + + $a = [(($b = $gvars['~']) === nil ? nil : $b['$[]'](0)), (($b = $gvars['~']) === nil ? nil : $b['$[]'](2))], (captured = $a[0]), (num = $a[1]), $a; + if ($truthy(captured['$start_with?']("\\"))) { + } else { + document.$callouts().$register((function() {if (num['$=='](".")) { + return (autonum = $rb_plus(autonum, 1)).$to_s() + } else { + return num + }; return nil; })()) + }; + return (found = true);}, TMP_20.$$s = self, TMP_20.$$arity = 0, TMP_20))}; + return found; + }, TMP_Parser_catalog_callouts_19.$$arity = 2); + Opal.defs(self, '$catalog_inline_anchor', TMP_Parser_catalog_inline_anchor_21 = function $$catalog_inline_anchor(id, reftext, node, location, doc) { + var $a, self = this; + + + + if (doc == null) { + doc = nil; + }; + doc = ($truthy($a = doc) ? $a : node.$document()); + if ($truthy(($truthy($a = reftext) ? reftext['$include?']($$($nesting, 'ATTR_REF_HEAD')) : $a))) { + reftext = doc.$sub_attributes(reftext)}; + if ($truthy(doc.$register("refs", [id, $$($nesting, 'Inline').$new(node, "anchor", reftext, $hash2(["type", "id"], {"type": "ref", "id": id})), reftext]))) { + } else { + + if ($truthy($$($nesting, 'Reader')['$==='](location))) { + location = location.$cursor()}; + self.$logger().$warn(self.$message_with_context("" + "id assigned to anchor already in use: " + (id), $hash2(["source_location"], {"source_location": location}))); + }; + return nil; + }, TMP_Parser_catalog_inline_anchor_21.$$arity = -5); + Opal.defs(self, '$catalog_inline_anchors', TMP_Parser_catalog_inline_anchors_22 = function $$catalog_inline_anchors(text, block, document, reader) { + var $a, TMP_23, self = this; + + + if ($truthy(($truthy($a = text['$include?']("[[")) ? $a : text['$include?']("or:")))) { + $send(text, 'scan', [$$($nesting, 'InlineAnchorScanRx')], (TMP_23 = function(){var self = TMP_23.$$s || this, $b, m = nil, id = nil, reftext = nil, location = nil, offset = nil; + if ($gvars["~"] == null) $gvars["~"] = nil; + + + m = $gvars["~"]; + if ($truthy((id = (($b = $gvars['~']) === nil ? nil : $b['$[]'](1))))) { + if ($truthy((reftext = (($b = $gvars['~']) === nil ? nil : $b['$[]'](2))))) { + if ($truthy(($truthy($b = reftext['$include?']($$($nesting, 'ATTR_REF_HEAD'))) ? (reftext = document.$sub_attributes(reftext))['$empty?']() : $b))) { + return nil;}} + } else { + + id = (($b = $gvars['~']) === nil ? nil : $b['$[]'](3)); + if ($truthy((reftext = (($b = $gvars['~']) === nil ? nil : $b['$[]'](4))))) { + + if ($truthy(reftext['$include?']("]"))) { + reftext = reftext.$gsub("\\]", "]")}; + if ($truthy(($truthy($b = reftext['$include?']($$($nesting, 'ATTR_REF_HEAD'))) ? (reftext = document.$sub_attributes(reftext))['$empty?']() : $b))) { + return nil;};}; + }; + if ($truthy(document.$register("refs", [id, $$($nesting, 'Inline').$new(block, "anchor", reftext, $hash2(["type", "id"], {"type": "ref", "id": id})), reftext]))) { + return nil + } else { + + location = reader.$cursor_at_mark(); + if ($truthy($rb_gt((offset = $rb_plus(m.$pre_match().$count($$($nesting, 'LF')), (function() {if ($truthy(m['$[]'](0)['$start_with?']($$($nesting, 'LF')))) { + return 1 + } else { + return 0 + }; return nil; })())), 0))) { + (location = location.$dup()).$advance(offset)}; + return self.$logger().$warn(self.$message_with_context("" + "id assigned to anchor already in use: " + (id), $hash2(["source_location"], {"source_location": location}))); + };}, TMP_23.$$s = self, TMP_23.$$arity = 0, TMP_23))}; + return nil; + }, TMP_Parser_catalog_inline_anchors_22.$$arity = 4); + Opal.defs(self, '$catalog_inline_biblio_anchor', TMP_Parser_catalog_inline_biblio_anchor_24 = function $$catalog_inline_biblio_anchor(id, reftext, node, reader) { + var $a, self = this, styled_reftext = nil; + + + if ($truthy(node.$document().$register("refs", [id, $$($nesting, 'Inline').$new(node, "anchor", (styled_reftext = "" + "[" + (($truthy($a = reftext) ? $a : id)) + "]"), $hash2(["type", "id"], {"type": "bibref", "id": id})), styled_reftext]))) { + } else { + self.$logger().$warn(self.$message_with_context("" + "id assigned to bibliography anchor already in use: " + (id), $hash2(["source_location"], {"source_location": reader.$cursor()}))) + }; + return nil; + }, TMP_Parser_catalog_inline_biblio_anchor_24.$$arity = 4); + Opal.defs(self, '$parse_description_list', TMP_Parser_parse_description_list_25 = function $$parse_description_list(reader, match, parent) { + var $a, $b, $c, self = this, list_block = nil, previous_pair = nil, sibling_pattern = nil, term = nil, item = nil, $writer = nil; + + + list_block = $$($nesting, 'List').$new(parent, "dlist"); + previous_pair = nil; + sibling_pattern = $$($nesting, 'DescriptionListSiblingRx')['$[]'](match['$[]'](2)); + while ($truthy(($truthy($b = match) ? $b : ($truthy($c = reader['$has_more_lines?']()) ? (match = sibling_pattern.$match(reader.$peek_line())) : $c)))) { + + $c = self.$parse_list_item(reader, list_block, match, sibling_pattern), $b = Opal.to_ary($c), (term = ($b[0] == null ? nil : $b[0])), (item = ($b[1] == null ? nil : $b[1])), $c; + if ($truthy(($truthy($b = previous_pair) ? previous_pair['$[]'](1)['$!']() : $b))) { + + previous_pair['$[]'](0)['$<<'](term); + + $writer = [1, item]; + $send(previous_pair, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + } else { + list_block.$items()['$<<']((previous_pair = [[term], item])) + }; + match = nil; + }; + return list_block; + }, TMP_Parser_parse_description_list_25.$$arity = 3); + Opal.defs(self, '$parse_callout_list', TMP_Parser_parse_callout_list_26 = function $$parse_callout_list(reader, match, parent, callouts) { + var $a, $b, $c, self = this, list_block = nil, next_index = nil, autonum = nil, num = nil, list_item = nil, coids = nil, $writer = nil; + + + list_block = $$($nesting, 'List').$new(parent, "colist"); + next_index = 1; + autonum = 0; + while ($truthy(($truthy($b = match) ? $b : ($truthy($c = (match = $$($nesting, 'CalloutListRx').$match(reader.$peek_line()))) ? reader.$mark() : $c)))) { + + if ((num = match['$[]'](1))['$=='](".")) { + num = (autonum = $rb_plus(autonum, 1)).$to_s()}; + if (num['$=='](next_index.$to_s())) { + } else { + self.$logger().$warn(self.$message_with_context("" + "callout list item index: expected " + (next_index) + ", got " + (num), $hash2(["source_location"], {"source_location": reader.$cursor_at_mark()}))) + }; + if ($truthy((list_item = self.$parse_list_item(reader, list_block, match, "<1>")))) { + + list_block.$items()['$<<'](list_item); + if ($truthy((coids = callouts.$callout_ids(list_block.$items().$size()))['$empty?']())) { + self.$logger().$warn(self.$message_with_context("" + "no callout found for <" + (list_block.$items().$size()) + ">", $hash2(["source_location"], {"source_location": reader.$cursor_at_mark()}))) + } else { + + $writer = ["coids", coids]; + $send(list_item.$attributes(), '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + };}; + next_index = $rb_plus(next_index, 1); + match = nil; + }; + callouts.$next_list(); + return list_block; + }, TMP_Parser_parse_callout_list_26.$$arity = 4); + Opal.defs(self, '$parse_list_item', TMP_Parser_parse_list_item_27 = function $$parse_list_item(reader, list_block, match, sibling_trait, style) { + var $a, $b, self = this, list_type = nil, dlist = nil, list_term = nil, term_text = nil, item_text = nil, has_text = nil, list_item = nil, $writer = nil, sourcemap_assignment_deferred = nil, ordinal = nil, implicit_style = nil, block_cursor = nil, list_item_reader = nil, comment_lines = nil, subsequent_line = nil, continuation_connects_first_block = nil, content_adjacent = nil, block = nil; + + + + if (style == null) { + style = nil; + }; + if ((list_type = list_block.$context())['$==']("dlist")) { + + dlist = true; + list_term = $$($nesting, 'ListItem').$new(list_block, (term_text = match['$[]'](1))); + if ($truthy(($truthy($a = term_text['$start_with?']("[[")) ? $$($nesting, 'LeadingInlineAnchorRx')['$=~'](term_text) : $a))) { + self.$catalog_inline_anchor((($a = $gvars['~']) === nil ? nil : $a['$[]'](1)), ($truthy($a = (($b = $gvars['~']) === nil ? nil : $b['$[]'](2))) ? $a : (($b = $gvars['~']) === nil ? nil : $b.$post_match()).$lstrip()), list_term, reader)}; + if ($truthy((item_text = match['$[]'](3)))) { + has_text = true}; + list_item = $$($nesting, 'ListItem').$new(list_block, item_text); + if ($truthy(list_block.$document().$sourcemap())) { + + + $writer = [reader.$cursor()]; + $send(list_term, 'source_location=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + if ($truthy(has_text)) { + + $writer = [list_term.$source_location()]; + $send(list_item, 'source_location=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + } else { + sourcemap_assignment_deferred = true + };}; + } else { + + has_text = true; + list_item = $$($nesting, 'ListItem').$new(list_block, (item_text = match['$[]'](2))); + if ($truthy(list_block.$document().$sourcemap())) { + + $writer = [reader.$cursor()]; + $send(list_item, 'source_location=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if (list_type['$==']("ulist")) { + + + $writer = [sibling_trait]; + $send(list_item, 'marker=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + if ($truthy(item_text['$start_with?']("["))) { + if ($truthy(($truthy($a = style) ? style['$==']("bibliography") : $a))) { + if ($truthy($$($nesting, 'InlineBiblioAnchorRx')['$=~'](item_text))) { + self.$catalog_inline_biblio_anchor((($a = $gvars['~']) === nil ? nil : $a['$[]'](1)), (($a = $gvars['~']) === nil ? nil : $a['$[]'](2)), list_item, reader)} + } else if ($truthy(item_text['$start_with?']("[["))) { + if ($truthy($$($nesting, 'LeadingInlineAnchorRx')['$=~'](item_text))) { + self.$catalog_inline_anchor((($a = $gvars['~']) === nil ? nil : $a['$[]'](1)), (($a = $gvars['~']) === nil ? nil : $a['$[]'](2)), list_item, reader)} + } else if ($truthy(item_text['$start_with?']("[ ] ", "[x] ", "[*] "))) { + + + $writer = ["checklist-option", ""]; + $send(list_block.$attributes(), '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["checkbox", ""]; + $send(list_item.$attributes(), '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + if ($truthy(item_text['$start_with?']("[ "))) { + } else { + + $writer = ["checked", ""]; + $send(list_item.$attributes(), '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + + $writer = [item_text.$slice(4, item_text.$length())]; + $send(list_item, 'text=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];;}}; + } else if (list_type['$==']("olist")) { + + $b = self.$resolve_ordered_list_marker(sibling_trait, (ordinal = list_block.$items().$size()), true, reader), $a = Opal.to_ary($b), (sibling_trait = ($a[0] == null ? nil : $a[0])), (implicit_style = ($a[1] == null ? nil : $a[1])), $b; + + $writer = [sibling_trait]; + $send(list_item, 'marker=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + if ($truthy((($a = ordinal['$=='](0)) ? style['$!']() : ordinal['$=='](0)))) { + + $writer = [($truthy($a = implicit_style) ? $a : ($truthy($b = $$($nesting, 'ORDERED_LIST_STYLES')['$[]']($rb_minus(sibling_trait.$length(), 1))) ? $b : "arabic").$to_s())]; + $send(list_block, 'style=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if ($truthy(($truthy($a = item_text['$start_with?']("[[")) ? $$($nesting, 'LeadingInlineAnchorRx')['$=~'](item_text) : $a))) { + self.$catalog_inline_anchor((($a = $gvars['~']) === nil ? nil : $a['$[]'](1)), (($a = $gvars['~']) === nil ? nil : $a['$[]'](2)), list_item, reader)}; + } else { + + $writer = [sibling_trait]; + $send(list_item, 'marker=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + }; + reader.$shift(); + block_cursor = reader.$cursor(); + list_item_reader = $$($nesting, 'Reader').$new(self.$read_lines_for_list_item(reader, list_type, sibling_trait, has_text), block_cursor); + if ($truthy(list_item_reader['$has_more_lines?']())) { + + if ($truthy(sourcemap_assignment_deferred)) { + + $writer = [block_cursor]; + $send(list_item, 'source_location=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + comment_lines = list_item_reader.$skip_line_comments(); + if ($truthy((subsequent_line = list_item_reader.$peek_line()))) { + + if ($truthy(comment_lines['$empty?']())) { + } else { + list_item_reader.$unshift_lines(comment_lines) + }; + if ($truthy((continuation_connects_first_block = subsequent_line['$empty?']()))) { + content_adjacent = false + } else { + + content_adjacent = true; + if ($truthy(dlist)) { + } else { + has_text = nil + }; + }; + } else { + + continuation_connects_first_block = false; + content_adjacent = false; + }; + if ($truthy((block = self.$next_block(list_item_reader, list_item, $hash2([], {}), $hash2(["text"], {"text": has_text['$!']()}))))) { + list_item.$blocks()['$<<'](block)}; + while ($truthy(list_item_reader['$has_more_lines?']())) { + if ($truthy((block = self.$next_block(list_item_reader, list_item)))) { + list_item.$blocks()['$<<'](block)} + }; + list_item.$fold_first(continuation_connects_first_block, content_adjacent);}; + if ($truthy(dlist)) { + if ($truthy(($truthy($a = list_item['$text?']()) ? $a : list_item['$blocks?']()))) { + return [list_term, list_item] + } else { + return [list_term] + } + } else { + return list_item + }; + }, TMP_Parser_parse_list_item_27.$$arity = -5); + Opal.defs(self, '$read_lines_for_list_item', TMP_Parser_read_lines_for_list_item_28 = function $$read_lines_for_list_item(reader, list_type, sibling_trait, has_text) { + var $a, $b, $c, TMP_29, TMP_30, TMP_31, TMP_32, TMP_33, self = this, buffer = nil, continuation = nil, within_nested_list = nil, detached_continuation = nil, this_line = nil, prev_line = nil, $writer = nil, match = nil, nested_list_type = nil; + + + + if (sibling_trait == null) { + sibling_trait = nil; + }; + + if (has_text == null) { + has_text = true; + }; + buffer = []; + continuation = "inactive"; + within_nested_list = false; + detached_continuation = nil; + while ($truthy(reader['$has_more_lines?']())) { + + this_line = reader.$read_line(); + if ($truthy(self['$is_sibling_list_item?'](this_line, list_type, sibling_trait))) { + break;}; + prev_line = (function() {if ($truthy(buffer['$empty?']())) { + return nil + } else { + return buffer['$[]'](-1) + }; return nil; })(); + if (prev_line['$==']($$($nesting, 'LIST_CONTINUATION'))) { + + if (continuation['$==']("inactive")) { + + continuation = "active"; + has_text = true; + if ($truthy(within_nested_list)) { + } else { + + $writer = [-1, ""]; + $send(buffer, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + };}; + if (this_line['$==']($$($nesting, 'LIST_CONTINUATION'))) { + + if ($truthy(continuation['$!=']("frozen"))) { + + continuation = "frozen"; + buffer['$<<'](this_line);}; + this_line = nil; + continue;;};}; + if ($truthy((match = self['$is_delimited_block?'](this_line, true)))) { + if (continuation['$==']("active")) { + + buffer['$<<'](this_line); + buffer.$concat(reader.$read_lines_until($hash2(["terminator", "read_last_line", "context"], {"terminator": match.$terminator(), "read_last_line": true, "context": nil}))); + continuation = "inactive"; + } else { + break; + } + } else if ($truthy(($truthy($b = (($c = list_type['$==']("dlist")) ? continuation['$!=']("active") : list_type['$==']("dlist"))) ? $$($nesting, 'BlockAttributeLineRx')['$match?'](this_line) : $b))) { + break; + } else if ($truthy((($b = continuation['$==']("active")) ? this_line['$empty?']()['$!']() : continuation['$==']("active")))) { + if ($truthy($$($nesting, 'LiteralParagraphRx')['$match?'](this_line))) { + + reader.$unshift_line(this_line); + buffer.$concat($send(reader, 'read_lines_until', [$hash2(["preserve_last_line", "break_on_blank_lines", "break_on_list_continuation"], {"preserve_last_line": true, "break_on_blank_lines": true, "break_on_list_continuation": true})], (TMP_29 = function(line){var self = TMP_29.$$s || this, $d; + + + + if (line == null) { + line = nil; + }; + return (($d = list_type['$==']("dlist")) ? self['$is_sibling_list_item?'](line, list_type, sibling_trait) : list_type['$==']("dlist"));}, TMP_29.$$s = self, TMP_29.$$arity = 1, TMP_29))); + continuation = "inactive"; + } else if ($truthy(($truthy($b = ($truthy($c = $$($nesting, 'BlockTitleRx')['$match?'](this_line)) ? $c : $$($nesting, 'BlockAttributeLineRx')['$match?'](this_line))) ? $b : $$($nesting, 'AttributeEntryRx')['$match?'](this_line)))) { + buffer['$<<'](this_line) + } else { + + if ($truthy((nested_list_type = $send((function() {if ($truthy(within_nested_list)) { + return ["dlist"] + } else { + return $$($nesting, 'NESTABLE_LIST_CONTEXTS') + }; return nil; })(), 'find', [], (TMP_30 = function(ctx){var self = TMP_30.$$s || this; + + + + if (ctx == null) { + ctx = nil; + }; + return $$($nesting, 'ListRxMap')['$[]'](ctx)['$match?'](this_line);}, TMP_30.$$s = self, TMP_30.$$arity = 1, TMP_30))))) { + + within_nested_list = true; + if ($truthy((($b = nested_list_type['$==']("dlist")) ? (($c = $gvars['~']) === nil ? nil : $c['$[]'](3))['$nil_or_empty?']() : nested_list_type['$==']("dlist")))) { + has_text = false};}; + buffer['$<<'](this_line); + continuation = "inactive"; + } + } else if ($truthy(($truthy($b = prev_line) ? prev_line['$empty?']() : $b))) { + + if ($truthy(this_line['$empty?']())) { + + if ($truthy((this_line = ($truthy($b = reader.$skip_blank_lines()) ? reader.$read_line() : $b)))) { + } else { + break; + }; + if ($truthy(self['$is_sibling_list_item?'](this_line, list_type, sibling_trait))) { + break;};}; + if (this_line['$==']($$($nesting, 'LIST_CONTINUATION'))) { + + detached_continuation = buffer.$size(); + buffer['$<<'](this_line); + } else if ($truthy(has_text)) { + if ($truthy(self['$is_sibling_list_item?'](this_line, list_type, sibling_trait))) { + break; + } else if ($truthy((nested_list_type = $send($$($nesting, 'NESTABLE_LIST_CONTEXTS'), 'find', [], (TMP_31 = function(ctx){var self = TMP_31.$$s || this; + + + + if (ctx == null) { + ctx = nil; + }; + return $$($nesting, 'ListRxMap')['$[]'](ctx)['$=~'](this_line);}, TMP_31.$$s = self, TMP_31.$$arity = 1, TMP_31))))) { + + buffer['$<<'](this_line); + within_nested_list = true; + if ($truthy((($b = nested_list_type['$==']("dlist")) ? (($c = $gvars['~']) === nil ? nil : $c['$[]'](3))['$nil_or_empty?']() : nested_list_type['$==']("dlist")))) { + has_text = false}; + } else if ($truthy($$($nesting, 'LiteralParagraphRx')['$match?'](this_line))) { + + reader.$unshift_line(this_line); + buffer.$concat($send(reader, 'read_lines_until', [$hash2(["preserve_last_line", "break_on_blank_lines", "break_on_list_continuation"], {"preserve_last_line": true, "break_on_blank_lines": true, "break_on_list_continuation": true})], (TMP_32 = function(line){var self = TMP_32.$$s || this, $d; + + + + if (line == null) { + line = nil; + }; + return (($d = list_type['$==']("dlist")) ? self['$is_sibling_list_item?'](line, list_type, sibling_trait) : list_type['$==']("dlist"));}, TMP_32.$$s = self, TMP_32.$$arity = 1, TMP_32))); + } else { + break; + } + } else { + + if ($truthy(within_nested_list)) { + } else { + buffer.$pop() + }; + buffer['$<<'](this_line); + has_text = true; + }; + } else { + + if ($truthy(this_line['$empty?']()['$!']())) { + has_text = true}; + if ($truthy((nested_list_type = $send((function() {if ($truthy(within_nested_list)) { + return ["dlist"] + } else { + return $$($nesting, 'NESTABLE_LIST_CONTEXTS') + }; return nil; })(), 'find', [], (TMP_33 = function(ctx){var self = TMP_33.$$s || this; + + + + if (ctx == null) { + ctx = nil; + }; + return $$($nesting, 'ListRxMap')['$[]'](ctx)['$=~'](this_line);}, TMP_33.$$s = self, TMP_33.$$arity = 1, TMP_33))))) { + + within_nested_list = true; + if ($truthy((($b = nested_list_type['$==']("dlist")) ? (($c = $gvars['~']) === nil ? nil : $c['$[]'](3))['$nil_or_empty?']() : nested_list_type['$==']("dlist")))) { + has_text = false};}; + buffer['$<<'](this_line); + }; + this_line = nil; + }; + if ($truthy(this_line)) { + reader.$unshift_line(this_line)}; + if ($truthy(detached_continuation)) { + buffer.$delete_at(detached_continuation)}; + while ($truthy(($truthy($b = buffer['$empty?']()['$!']()) ? buffer['$[]'](-1)['$empty?']() : $b))) { + buffer.$pop() + }; + if ($truthy(($truthy($a = buffer['$empty?']()['$!']()) ? buffer['$[]'](-1)['$==']($$($nesting, 'LIST_CONTINUATION')) : $a))) { + buffer.$pop()}; + return buffer; + }, TMP_Parser_read_lines_for_list_item_28.$$arity = -3); + Opal.defs(self, '$initialize_section', TMP_Parser_initialize_section_34 = function $$initialize_section(reader, parent, attributes) { + var $a, $b, self = this, document = nil, book = nil, doctype = nil, source_location = nil, sect_style = nil, sect_id = nil, sect_reftext = nil, sect_title = nil, sect_level = nil, sect_atx = nil, $writer = nil, sect_name = nil, sect_special = nil, sect_numbered = nil, section = nil, id = nil; + + + + if (attributes == null) { + attributes = $hash2([], {}); + }; + document = parent.$document(); + book = (doctype = document.$doctype())['$==']("book"); + if ($truthy(document.$sourcemap())) { + source_location = reader.$cursor()}; + sect_style = attributes['$[]'](1); + $b = self.$parse_section_title(reader, document, attributes['$[]']("id")), $a = Opal.to_ary($b), (sect_id = ($a[0] == null ? nil : $a[0])), (sect_reftext = ($a[1] == null ? nil : $a[1])), (sect_title = ($a[2] == null ? nil : $a[2])), (sect_level = ($a[3] == null ? nil : $a[3])), (sect_atx = ($a[4] == null ? nil : $a[4])), $b; + if ($truthy(sect_reftext)) { + + $writer = ["reftext", sect_reftext]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + } else { + sect_reftext = attributes['$[]']("reftext") + }; + if ($truthy(sect_style)) { + if ($truthy(($truthy($a = book) ? sect_style['$==']("abstract") : $a))) { + $a = ["chapter", 1], (sect_name = $a[0]), (sect_level = $a[1]), $a + } else { + + $a = [sect_style, true], (sect_name = $a[0]), (sect_special = $a[1]), $a; + if (sect_level['$=='](0)) { + sect_level = 1}; + sect_numbered = sect_style['$==']("appendix"); + } + } else if ($truthy(book)) { + sect_name = (function() {if (sect_level['$=='](0)) { + return "part" + } else { + + if ($truthy($rb_gt(sect_level, 1))) { + return "section" + } else { + return "chapter" + }; + }; return nil; })() + } else if ($truthy((($a = doctype['$==']("manpage")) ? sect_title.$casecmp("synopsis")['$=='](0) : doctype['$==']("manpage")))) { + $a = ["synopsis", true], (sect_name = $a[0]), (sect_special = $a[1]), $a + } else { + sect_name = "section" + }; + section = $$($nesting, 'Section').$new(parent, sect_level); + $a = [sect_id, sect_title, sect_name, source_location], section['$id=']($a[0]), section['$title=']($a[1]), section['$sectname=']($a[2]), section['$source_location=']($a[3]), $a; + if ($truthy(sect_special)) { + + + $writer = [true]; + $send(section, 'special=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + if ($truthy(sect_numbered)) { + + $writer = [true]; + $send(section, 'numbered=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + } else if (document.$attributes()['$[]']("sectnums")['$==']("all")) { + + $writer = [(function() {if ($truthy(($truthy($a = book) ? sect_level['$=='](1) : $a))) { + return "chapter" + } else { + return true + }; return nil; })()]; + $send(section, 'numbered=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + } else if ($truthy(($truthy($a = document.$attributes()['$[]']("sectnums")) ? $rb_gt(sect_level, 0) : $a))) { + + $writer = [(function() {if ($truthy(section.$special())) { + return ($truthy($a = parent.$numbered()) ? true : $a) + } else { + return true + }; return nil; })()]; + $send(section, 'numbered=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + } else if ($truthy(($truthy($a = ($truthy($b = book) ? sect_level['$=='](0) : $b)) ? document.$attributes()['$[]']("partnums") : $a))) { + + $writer = [true]; + $send(section, 'numbered=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if ($truthy((id = ($truthy($a = section.$id()) ? $a : (($writer = [(function() {if ($truthy(document.$attributes()['$key?']("sectids"))) { + + return $$($nesting, 'Section').$generate_id(section.$title(), document); + } else { + return nil + }; return nil; })()]), $send(section, 'id=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]))))) { + if ($truthy(document.$register("refs", [id, section, ($truthy($a = sect_reftext) ? $a : section.$title())]))) { + } else { + self.$logger().$warn(self.$message_with_context("" + "id assigned to section already in use: " + (id), $hash2(["source_location"], {"source_location": reader.$cursor_at_line($rb_minus(reader.$lineno(), (function() {if ($truthy(sect_atx)) { + return 1 + } else { + return 2 + }; return nil; })()))}))) + }}; + section.$update_attributes(attributes); + reader.$skip_blank_lines(); + return section; + }, TMP_Parser_initialize_section_34.$$arity = -3); + Opal.defs(self, '$is_next_line_section?', TMP_Parser_is_next_line_section$q_35 = function(reader, attributes) { + var $a, $b, self = this, style = nil, next_lines = nil; + + if ($truthy(($truthy($a = (style = attributes['$[]'](1))) ? ($truthy($b = style['$==']("discrete")) ? $b : style['$==']("float")) : $a))) { + return nil + } else if ($truthy($$($nesting, 'Compliance').$underline_style_section_titles())) { + + next_lines = reader.$peek_lines(2, ($truthy($a = style) ? style['$==']("comment") : $a)); + return self['$is_section_title?'](($truthy($a = next_lines['$[]'](0)) ? $a : ""), next_lines['$[]'](1)); + } else { + return self['$atx_section_title?'](($truthy($a = reader.$peek_line()) ? $a : "")) + } + }, TMP_Parser_is_next_line_section$q_35.$$arity = 2); + Opal.defs(self, '$is_next_line_doctitle?', TMP_Parser_is_next_line_doctitle$q_36 = function(reader, attributes, leveloffset) { + var $a, self = this, sect_level = nil; + + if ($truthy(leveloffset)) { + return ($truthy($a = (sect_level = self['$is_next_line_section?'](reader, attributes))) ? $rb_plus(sect_level, leveloffset.$to_i())['$=='](0) : $a) + } else { + return self['$is_next_line_section?'](reader, attributes)['$=='](0) + } + }, TMP_Parser_is_next_line_doctitle$q_36.$$arity = 3); + Opal.defs(self, '$is_section_title?', TMP_Parser_is_section_title$q_37 = function(line1, line2) { + var $a, self = this; + + + + if (line2 == null) { + line2 = nil; + }; + return ($truthy($a = self['$atx_section_title?'](line1)) ? $a : (function() {if ($truthy(line2['$nil_or_empty?']())) { + return nil + } else { + return self['$setext_section_title?'](line1, line2) + }; return nil; })()); + }, TMP_Parser_is_section_title$q_37.$$arity = -2); + Opal.defs(self, '$atx_section_title?', TMP_Parser_atx_section_title$q_38 = function(line) { + var $a, self = this; + + if ($truthy((function() {if ($truthy($$($nesting, 'Compliance').$markdown_syntax())) { + + return ($truthy($a = line['$start_with?']("=", "#")) ? $$($nesting, 'ExtAtxSectionTitleRx')['$=~'](line) : $a); + } else { + + return ($truthy($a = line['$start_with?']("=")) ? $$($nesting, 'AtxSectionTitleRx')['$=~'](line) : $a); + }; return nil; })())) { + return $rb_minus((($a = $gvars['~']) === nil ? nil : $a['$[]'](1)).$length(), 1) + } else { + return nil + } + }, TMP_Parser_atx_section_title$q_38.$$arity = 1); + Opal.defs(self, '$setext_section_title?', TMP_Parser_setext_section_title$q_39 = function(line1, line2) { + var $a, $b, $c, self = this, level = nil, line2_ch1 = nil, line2_len = nil; + + if ($truthy(($truthy($a = ($truthy($b = ($truthy($c = (level = $$($nesting, 'SETEXT_SECTION_LEVELS')['$[]']((line2_ch1 = line2.$chr())))) ? $rb_times(line2_ch1, (line2_len = line2.$length()))['$=='](line2) : $c)) ? $$($nesting, 'SetextSectionTitleRx')['$match?'](line1) : $b)) ? $rb_lt($rb_minus(self.$line_length(line1), line2_len).$abs(), 2) : $a))) { + return level + } else { + return nil + } + }, TMP_Parser_setext_section_title$q_39.$$arity = 2); + Opal.defs(self, '$parse_section_title', TMP_Parser_parse_section_title_40 = function $$parse_section_title(reader, document, sect_id) { + var $a, $b, $c, $d, $e, self = this, sect_reftext = nil, line1 = nil, sect_level = nil, sect_title = nil, atx = nil, line2 = nil, line2_ch1 = nil, line2_len = nil; + + + + if (sect_id == null) { + sect_id = nil; + }; + sect_reftext = nil; + line1 = reader.$read_line(); + if ($truthy((function() {if ($truthy($$($nesting, 'Compliance').$markdown_syntax())) { + + return ($truthy($a = line1['$start_with?']("=", "#")) ? $$($nesting, 'ExtAtxSectionTitleRx')['$=~'](line1) : $a); + } else { + + return ($truthy($a = line1['$start_with?']("=")) ? $$($nesting, 'AtxSectionTitleRx')['$=~'](line1) : $a); + }; return nil; })())) { + + $a = [$rb_minus((($b = $gvars['~']) === nil ? nil : $b['$[]'](1)).$length(), 1), (($b = $gvars['~']) === nil ? nil : $b['$[]'](2)), true], (sect_level = $a[0]), (sect_title = $a[1]), (atx = $a[2]), $a; + if ($truthy(sect_id)) { + } else if ($truthy(($truthy($a = ($truthy($b = sect_title['$end_with?']("]]")) ? $$($nesting, 'InlineSectionAnchorRx')['$=~'](sect_title) : $b)) ? (($b = $gvars['~']) === nil ? nil : $b['$[]'](1))['$!']() : $a))) { + $a = [sect_title.$slice(0, $rb_minus(sect_title.$length(), (($b = $gvars['~']) === nil ? nil : $b['$[]'](0)).$length())), (($b = $gvars['~']) === nil ? nil : $b['$[]'](2)), (($b = $gvars['~']) === nil ? nil : $b['$[]'](3))], (sect_title = $a[0]), (sect_id = $a[1]), (sect_reftext = $a[2]), $a}; + } else if ($truthy(($truthy($a = ($truthy($b = ($truthy($c = ($truthy($d = ($truthy($e = $$($nesting, 'Compliance').$underline_style_section_titles()) ? (line2 = reader.$peek_line(true)) : $e)) ? (sect_level = $$($nesting, 'SETEXT_SECTION_LEVELS')['$[]']((line2_ch1 = line2.$chr()))) : $d)) ? $rb_times(line2_ch1, (line2_len = line2.$length()))['$=='](line2) : $c)) ? (sect_title = ($truthy($c = $$($nesting, 'SetextSectionTitleRx')['$=~'](line1)) ? (($d = $gvars['~']) === nil ? nil : $d['$[]'](1)) : $c)) : $b)) ? $rb_lt($rb_minus(self.$line_length(line1), line2_len).$abs(), 2) : $a))) { + + atx = false; + if ($truthy(sect_id)) { + } else if ($truthy(($truthy($a = ($truthy($b = sect_title['$end_with?']("]]")) ? $$($nesting, 'InlineSectionAnchorRx')['$=~'](sect_title) : $b)) ? (($b = $gvars['~']) === nil ? nil : $b['$[]'](1))['$!']() : $a))) { + $a = [sect_title.$slice(0, $rb_minus(sect_title.$length(), (($b = $gvars['~']) === nil ? nil : $b['$[]'](0)).$length())), (($b = $gvars['~']) === nil ? nil : $b['$[]'](2)), (($b = $gvars['~']) === nil ? nil : $b['$[]'](3))], (sect_title = $a[0]), (sect_id = $a[1]), (sect_reftext = $a[2]), $a}; + reader.$shift(); + } else { + self.$raise("" + "Unrecognized section at " + (reader.$cursor_at_prev_line())) + }; + if ($truthy(document['$attr?']("leveloffset"))) { + sect_level = $rb_plus(sect_level, document.$attr("leveloffset").$to_i())}; + return [sect_id, sect_reftext, sect_title, sect_level, atx]; + }, TMP_Parser_parse_section_title_40.$$arity = -3); + if ($truthy($$($nesting, 'FORCE_UNICODE_LINE_LENGTH'))) { + Opal.defs(self, '$line_length', TMP_Parser_line_length_41 = function $$line_length(line) { + var self = this; + + return line.$scan($$($nesting, 'UnicodeCharScanRx')).$size() + }, TMP_Parser_line_length_41.$$arity = 1) + } else { + Opal.defs(self, '$line_length', TMP_Parser_line_length_42 = function $$line_length(line) { + var self = this; + + return line.$length() + }, TMP_Parser_line_length_42.$$arity = 1) + }; + Opal.defs(self, '$parse_header_metadata', TMP_Parser_parse_header_metadata_43 = function $$parse_header_metadata(reader, document) { + var $a, TMP_44, TMP_45, TMP_46, self = this, doc_attrs = nil, implicit_authors = nil, metadata = nil, implicit_author = nil, implicit_authorinitials = nil, author_metadata = nil, rev_metadata = nil, rev_line = nil, match = nil, $writer = nil, component = nil, author_line = nil, authors = nil, author_idx = nil, author_key = nil, explicit = nil, sparse = nil, author_override = nil; + + + + if (document == null) { + document = nil; + }; + doc_attrs = ($truthy($a = document) ? document.$attributes() : $a); + self.$process_attribute_entries(reader, document); + $a = [(implicit_authors = $hash2([], {})), nil, nil], (metadata = $a[0]), (implicit_author = $a[1]), (implicit_authorinitials = $a[2]), $a; + if ($truthy(($truthy($a = reader['$has_more_lines?']()) ? reader['$next_line_empty?']()['$!']() : $a))) { + + if ($truthy((author_metadata = self.$process_authors(reader.$read_line()))['$empty?']())) { + } else { + + if ($truthy(document)) { + + $send(author_metadata, 'each', [], (TMP_44 = function(key, val){var self = TMP_44.$$s || this, $writer = nil; + + + + if (key == null) { + key = nil; + }; + + if (val == null) { + val = nil; + }; + if ($truthy(doc_attrs['$key?'](key))) { + return nil + } else { + + $writer = [key, (function() {if ($truthy($$$('::', 'String')['$==='](val))) { + + return document.$apply_header_subs(val); + } else { + return val + }; return nil; })()]; + $send(doc_attrs, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + };}, TMP_44.$$s = self, TMP_44.$$arity = 2, TMP_44)); + implicit_author = doc_attrs['$[]']("author"); + implicit_authorinitials = doc_attrs['$[]']("authorinitials"); + implicit_authors = doc_attrs['$[]']("authors");}; + metadata = author_metadata; + }; + self.$process_attribute_entries(reader, document); + rev_metadata = $hash2([], {}); + if ($truthy(($truthy($a = reader['$has_more_lines?']()) ? reader['$next_line_empty?']()['$!']() : $a))) { + + rev_line = reader.$read_line(); + if ($truthy((match = $$($nesting, 'RevisionInfoLineRx').$match(rev_line)))) { + + if ($truthy(match['$[]'](1))) { + + $writer = ["revnumber", match['$[]'](1).$rstrip()]; + $send(rev_metadata, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if ($truthy((component = match['$[]'](2).$strip())['$empty?']())) { + } else if ($truthy(($truthy($a = match['$[]'](1)['$!']()) ? component['$start_with?']("v") : $a))) { + + $writer = ["revnumber", component.$slice(1, component.$length())]; + $send(rev_metadata, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + } else { + + $writer = ["revdate", component]; + $send(rev_metadata, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + if ($truthy(match['$[]'](3))) { + + $writer = ["revremark", match['$[]'](3).$rstrip()]; + $send(rev_metadata, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + } else { + reader.$unshift_line(rev_line) + };}; + if ($truthy(rev_metadata['$empty?']())) { + } else { + + if ($truthy(document)) { + $send(rev_metadata, 'each', [], (TMP_45 = function(key, val){var self = TMP_45.$$s || this; + + + + if (key == null) { + key = nil; + }; + + if (val == null) { + val = nil; + }; + if ($truthy(doc_attrs['$key?'](key))) { + return nil + } else { + + $writer = [key, document.$apply_header_subs(val)]; + $send(doc_attrs, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + };}, TMP_45.$$s = self, TMP_45.$$arity = 2, TMP_45))}; + metadata.$update(rev_metadata); + }; + self.$process_attribute_entries(reader, document); + reader.$skip_blank_lines(); + } else { + author_metadata = $hash2([], {}) + }; + if ($truthy(document)) { + + if ($truthy(($truthy($a = doc_attrs['$key?']("author")) ? (author_line = doc_attrs['$[]']("author"))['$!='](implicit_author) : $a))) { + + author_metadata = self.$process_authors(author_line, true, false); + if ($truthy(doc_attrs['$[]']("authorinitials")['$!='](implicit_authorinitials))) { + author_metadata.$delete("authorinitials")}; + } else if ($truthy(($truthy($a = doc_attrs['$key?']("authors")) ? (author_line = doc_attrs['$[]']("authors"))['$!='](implicit_authors) : $a))) { + author_metadata = self.$process_authors(author_line, true) + } else { + + $a = [[], 1, "author_1", false, false], (authors = $a[0]), (author_idx = $a[1]), (author_key = $a[2]), (explicit = $a[3]), (sparse = $a[4]), $a; + while ($truthy(doc_attrs['$key?'](author_key))) { + + if ((author_override = doc_attrs['$[]'](author_key))['$=='](author_metadata['$[]'](author_key))) { + + authors['$<<'](nil); + sparse = true; + } else { + + authors['$<<'](author_override); + explicit = true; + }; + author_key = "" + "author_" + ((author_idx = $rb_plus(author_idx, 1))); + }; + if ($truthy(explicit)) { + + if ($truthy(sparse)) { + $send(authors, 'each_with_index', [], (TMP_46 = function(author, idx){var self = TMP_46.$$s || this, TMP_47, name_idx = nil; + + + + if (author == null) { + author = nil; + }; + + if (idx == null) { + idx = nil; + }; + if ($truthy(author)) { + return nil + } else { + + $writer = [idx, $send([author_metadata['$[]']("" + "firstname_" + ((name_idx = $rb_plus(idx, 1)))), author_metadata['$[]']("" + "middlename_" + (name_idx)), author_metadata['$[]']("" + "lastname_" + (name_idx))].$compact(), 'map', [], (TMP_47 = function(it){var self = TMP_47.$$s || this; + + + + if (it == null) { + it = nil; + }; + return it.$tr(" ", "_");}, TMP_47.$$s = self, TMP_47.$$arity = 1, TMP_47)).$join(" ")]; + $send(authors, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + };}, TMP_46.$$s = self, TMP_46.$$arity = 2, TMP_46))}; + author_metadata = self.$process_authors(authors, true, false); + } else { + author_metadata = $hash2([], {}) + }; + }; + if ($truthy(author_metadata['$empty?']())) { + ($truthy($a = metadata['$[]']("authorcount")) ? $a : (($writer = ["authorcount", (($writer = ["authorcount", 0]), $send(doc_attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])]), $send(metadata, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])) + } else { + + doc_attrs.$update(author_metadata); + if ($truthy(($truthy($a = doc_attrs['$key?']("email")['$!']()) ? doc_attrs['$key?']("email_1") : $a))) { + + $writer = ["email", doc_attrs['$[]']("email_1")]; + $send(doc_attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + };}; + return metadata; + }, TMP_Parser_parse_header_metadata_43.$$arity = -2); + Opal.defs(self, '$process_authors', TMP_Parser_process_authors_48 = function $$process_authors(author_line, names_only, multiple) { + var TMP_49, TMP_50, self = this, author_metadata = nil, author_idx = nil, keys = nil, author_entries = nil, $writer = nil; + + + + if (names_only == null) { + names_only = false; + }; + + if (multiple == null) { + multiple = true; + }; + author_metadata = $hash2([], {}); + author_idx = 0; + keys = ["author", "authorinitials", "firstname", "middlename", "lastname", "email"]; + author_entries = (function() {if ($truthy(multiple)) { + return $send(author_line.$split(";"), 'map', [], (TMP_49 = function(it){var self = TMP_49.$$s || this; + + + + if (it == null) { + it = nil; + }; + return it.$strip();}, TMP_49.$$s = self, TMP_49.$$arity = 1, TMP_49)) + } else { + return self.$Array(author_line) + }; return nil; })(); + $send(author_entries, 'each', [], (TMP_50 = function(author_entry){var self = TMP_50.$$s || this, TMP_51, TMP_52, $a, TMP_53, key_map = nil, $writer = nil, segments = nil, match = nil, author = nil, fname = nil, mname = nil, lname = nil; + + + + if (author_entry == null) { + author_entry = nil; + }; + if ($truthy(author_entry['$empty?']())) { + return nil;}; + author_idx = $rb_plus(author_idx, 1); + key_map = $hash2([], {}); + if (author_idx['$=='](1)) { + $send(keys, 'each', [], (TMP_51 = function(key){var self = TMP_51.$$s || this, $writer = nil; + + + + if (key == null) { + key = nil; + }; + $writer = [key.$to_sym(), key]; + $send(key_map, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];}, TMP_51.$$s = self, TMP_51.$$arity = 1, TMP_51)) + } else { + $send(keys, 'each', [], (TMP_52 = function(key){var self = TMP_52.$$s || this, $writer = nil; + + + + if (key == null) { + key = nil; + }; + $writer = [key.$to_sym(), "" + (key) + "_" + (author_idx)]; + $send(key_map, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];}, TMP_52.$$s = self, TMP_52.$$arity = 1, TMP_52)) + }; + if ($truthy(names_only)) { + + if ($truthy(author_entry['$include?']("<"))) { + + + $writer = [key_map['$[]']("author"), author_entry.$tr("_", " ")]; + $send(author_metadata, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + author_entry = author_entry.$gsub($$($nesting, 'XmlSanitizeRx'), "");}; + if ((segments = author_entry.$split(nil, 3)).$size()['$=='](3)) { + segments['$<<'](segments.$pop().$squeeze(" "))}; + } else if ($truthy((match = $$($nesting, 'AuthorInfoLineRx').$match(author_entry)))) { + (segments = match.$to_a()).$shift()}; + if ($truthy(segments)) { + + author = (($writer = [key_map['$[]']("firstname"), (fname = segments['$[]'](0).$tr("_", " "))]), $send(author_metadata, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]); + + $writer = [key_map['$[]']("authorinitials"), fname.$chr()]; + $send(author_metadata, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + if ($truthy(segments['$[]'](1))) { + if ($truthy(segments['$[]'](2))) { + + + $writer = [key_map['$[]']("middlename"), (mname = segments['$[]'](1).$tr("_", " "))]; + $send(author_metadata, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = [key_map['$[]']("lastname"), (lname = segments['$[]'](2).$tr("_", " "))]; + $send(author_metadata, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + author = $rb_plus($rb_plus($rb_plus($rb_plus(fname, " "), mname), " "), lname); + + $writer = [key_map['$[]']("authorinitials"), "" + (fname.$chr()) + (mname.$chr()) + (lname.$chr())]; + $send(author_metadata, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + } else { + + + $writer = [key_map['$[]']("lastname"), (lname = segments['$[]'](1).$tr("_", " "))]; + $send(author_metadata, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + author = $rb_plus($rb_plus(fname, " "), lname); + + $writer = [key_map['$[]']("authorinitials"), "" + (fname.$chr()) + (lname.$chr())]; + $send(author_metadata, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + }}; + ($truthy($a = author_metadata['$[]'](key_map['$[]']("author"))) ? $a : (($writer = [key_map['$[]']("author"), author]), $send(author_metadata, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + if ($truthy(($truthy($a = names_only) ? $a : segments['$[]'](3)['$!']()))) { + } else { + + $writer = [key_map['$[]']("email"), segments['$[]'](3)]; + $send(author_metadata, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + } else { + + + $writer = [key_map['$[]']("author"), (($writer = [key_map['$[]']("firstname"), (fname = author_entry.$squeeze(" ").$strip())]), $send(author_metadata, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])]; + $send(author_metadata, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = [key_map['$[]']("authorinitials"), fname.$chr()]; + $send(author_metadata, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + }; + if (author_idx['$=='](1)) { + + $writer = ["authors", author_metadata['$[]'](key_map['$[]']("author"))]; + $send(author_metadata, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + } else { + + if (author_idx['$=='](2)) { + $send(keys, 'each', [], (TMP_53 = function(key){var self = TMP_53.$$s || this; + + + + if (key == null) { + key = nil; + }; + if ($truthy(author_metadata['$key?'](key))) { + + $writer = ["" + (key) + "_1", author_metadata['$[]'](key)]; + $send(author_metadata, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + } else { + return nil + };}, TMP_53.$$s = self, TMP_53.$$arity = 1, TMP_53))}; + + $writer = ["authors", "" + (author_metadata['$[]']("authors")) + ", " + (author_metadata['$[]'](key_map['$[]']("author")))]; + $send(author_metadata, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];; + };}, TMP_50.$$s = self, TMP_50.$$arity = 1, TMP_50)); + + $writer = ["authorcount", author_idx]; + $send(author_metadata, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + return author_metadata; + }, TMP_Parser_process_authors_48.$$arity = -2); + Opal.defs(self, '$parse_block_metadata_lines', TMP_Parser_parse_block_metadata_lines_54 = function $$parse_block_metadata_lines(reader, document, attributes, options) { + var $a, $b, self = this; + + + + if (attributes == null) { + attributes = $hash2([], {}); + }; + + if (options == null) { + options = $hash2([], {}); + }; + while ($truthy(self.$parse_block_metadata_line(reader, document, attributes, options))) { + + reader.$shift(); + if ($truthy($b = reader.$skip_blank_lines())) { + $b + } else { + break; + }; + }; + return attributes; + }, TMP_Parser_parse_block_metadata_lines_54.$$arity = -3); + Opal.defs(self, '$parse_block_metadata_line', TMP_Parser_parse_block_metadata_line_55 = function $$parse_block_metadata_line(reader, document, attributes, options) { + var $a, $b, self = this, next_line = nil, normal = nil, $writer = nil, reftext = nil, current_style = nil, ll = nil; + if ($gvars["~"] == null) $gvars["~"] = nil; + + + + if (options == null) { + options = $hash2([], {}); + }; + if ($truthy(($truthy($a = (next_line = reader.$peek_line())) ? (function() {if ($truthy(options['$[]']("text"))) { + + return next_line['$start_with?']("[", "/"); + } else { + + return (normal = next_line['$start_with?']("[", ".", "/", ":")); + }; return nil; })() : $a))) { + if ($truthy(next_line['$start_with?']("["))) { + if ($truthy(next_line['$start_with?']("[["))) { + if ($truthy(($truthy($a = next_line['$end_with?']("]]")) ? $$($nesting, 'BlockAnchorRx')['$=~'](next_line) : $a))) { + + + $writer = ["id", (($a = $gvars['~']) === nil ? nil : $a['$[]'](1))]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + if ($truthy((reftext = (($a = $gvars['~']) === nil ? nil : $a['$[]'](2))))) { + + $writer = ["reftext", (function() {if ($truthy(reftext['$include?']($$($nesting, 'ATTR_REF_HEAD')))) { + + return document.$sub_attributes(reftext); + } else { + return reftext + }; return nil; })()]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + return true; + } else { + return nil + } + } else if ($truthy(($truthy($a = next_line['$end_with?']("]")) ? $$($nesting, 'BlockAttributeListRx')['$=~'](next_line) : $a))) { + + current_style = attributes['$[]'](1); + if ($truthy(document.$parse_attributes((($a = $gvars['~']) === nil ? nil : $a['$[]'](1)), [], $hash2(["sub_input", "sub_result", "into"], {"sub_input": true, "sub_result": true, "into": attributes}))['$[]'](1))) { + + $writer = [1, ($truthy($a = self.$parse_style_attribute(attributes, reader)) ? $a : current_style)]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + return true; + } else { + return nil + } + } else if ($truthy(($truthy($a = normal) ? next_line['$start_with?'](".") : $a))) { + if ($truthy($$($nesting, 'BlockTitleRx')['$=~'](next_line))) { + + + $writer = ["title", (($a = $gvars['~']) === nil ? nil : $a['$[]'](1))]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + return true; + } else { + return nil + } + } else if ($truthy(($truthy($a = normal['$!']()) ? $a : next_line['$start_with?']("/")))) { + if ($truthy(next_line['$start_with?']("//"))) { + if (next_line['$==']("//")) { + return true + } else if ($truthy(($truthy($a = normal) ? $rb_times("/", (ll = next_line.$length()))['$=='](next_line) : $a))) { + if (ll['$=='](3)) { + return nil + } else { + + reader.$read_lines_until($hash2(["terminator", "skip_first_line", "preserve_last_line", "skip_processing", "context"], {"terminator": next_line, "skip_first_line": true, "preserve_last_line": true, "skip_processing": true, "context": "comment"})); + return true; + } + } else if ($truthy(next_line['$start_with?']("///"))) { + return nil + } else { + return true + } + } else { + return nil + } + } else if ($truthy(($truthy($a = ($truthy($b = normal) ? next_line['$start_with?'](":") : $b)) ? $$($nesting, 'AttributeEntryRx')['$=~'](next_line) : $a))) { + + self.$process_attribute_entry(reader, document, attributes, $gvars["~"]); + return true; + } else { + return nil + } + } else { + return nil + }; + }, TMP_Parser_parse_block_metadata_line_55.$$arity = -4); + Opal.defs(self, '$process_attribute_entries', TMP_Parser_process_attribute_entries_56 = function $$process_attribute_entries(reader, document, attributes) { + var $a, self = this; + + + + if (attributes == null) { + attributes = nil; + }; + reader.$skip_comment_lines(); + while ($truthy(self.$process_attribute_entry(reader, document, attributes))) { + + reader.$shift(); + reader.$skip_comment_lines(); + }; + }, TMP_Parser_process_attribute_entries_56.$$arity = -3); + Opal.defs(self, '$process_attribute_entry', TMP_Parser_process_attribute_entry_57 = function $$process_attribute_entry(reader, document, attributes, match) { + var $a, $b, $c, self = this, value = nil, con = nil, next_line = nil, keep_open = nil; + + + + if (attributes == null) { + attributes = nil; + }; + + if (match == null) { + match = nil; + }; + if ($truthy((match = ($truthy($a = match) ? $a : (function() {if ($truthy(reader['$has_more_lines?']())) { + + return $$($nesting, 'AttributeEntryRx').$match(reader.$peek_line()); + } else { + return nil + }; return nil; })())))) { + + if ($truthy((value = match['$[]'](2))['$nil_or_empty?']())) { + value = "" + } else if ($truthy(value['$end_with?']($$($nesting, 'LINE_CONTINUATION'), $$($nesting, 'LINE_CONTINUATION_LEGACY')))) { + + $a = [value.$slice(-2, 2), value.$slice(0, $rb_minus(value.$length(), 2)).$rstrip()], (con = $a[0]), (value = $a[1]), $a; + while ($truthy(($truthy($b = reader.$advance()) ? (next_line = ($truthy($c = reader.$peek_line()) ? $c : ""))['$empty?']()['$!']() : $b))) { + + next_line = next_line.$lstrip(); + if ($truthy((keep_open = next_line['$end_with?'](con)))) { + next_line = next_line.$slice(0, $rb_minus(next_line.$length(), 2)).$rstrip()}; + value = "" + (value) + ((function() {if ($truthy(value['$end_with?']($$($nesting, 'HARD_LINE_BREAK')))) { + return $$($nesting, 'LF') + } else { + return " " + }; return nil; })()) + (next_line); + if ($truthy(keep_open)) { + } else { + break; + }; + };}; + self.$store_attribute(match['$[]'](1), value, document, attributes); + return true; + } else { + return nil + }; + }, TMP_Parser_process_attribute_entry_57.$$arity = -3); + Opal.defs(self, '$store_attribute', TMP_Parser_store_attribute_58 = function $$store_attribute(name, value, doc, attrs) { + var $a, self = this, resolved_value = nil; + + + + if (doc == null) { + doc = nil; + }; + + if (attrs == null) { + attrs = nil; + }; + if ($truthy(name['$end_with?']("!"))) { + $a = [name.$chop(), nil], (name = $a[0]), (value = $a[1]), $a + } else if ($truthy(name['$start_with?']("!"))) { + $a = [name.$slice(1, name.$length()), nil], (name = $a[0]), (value = $a[1]), $a}; + name = self.$sanitize_attribute_name(name); + if (name['$==']("numbered")) { + name = "sectnums"}; + if ($truthy(doc)) { + if ($truthy(value)) { + + if (name['$==']("leveloffset")) { + if ($truthy(value['$start_with?']("+"))) { + value = $rb_plus(doc.$attr("leveloffset", 0).$to_i(), value.$slice(1, value.$length()).$to_i()).$to_s() + } else if ($truthy(value['$start_with?']("-"))) { + value = $rb_minus(doc.$attr("leveloffset", 0).$to_i(), value.$slice(1, value.$length()).$to_i()).$to_s()}}; + if ($truthy((resolved_value = doc.$set_attribute(name, value)))) { + + value = resolved_value; + if ($truthy(attrs)) { + $$$($$($nesting, 'Document'), 'AttributeEntry').$new(name, value).$save_to(attrs)};}; + } else if ($truthy(($truthy($a = doc.$delete_attribute(name)) ? attrs : $a))) { + $$$($$($nesting, 'Document'), 'AttributeEntry').$new(name, value).$save_to(attrs)} + } else if ($truthy(attrs)) { + $$$($$($nesting, 'Document'), 'AttributeEntry').$new(name, value).$save_to(attrs)}; + return [name, value]; + }, TMP_Parser_store_attribute_58.$$arity = -3); + Opal.defs(self, '$resolve_list_marker', TMP_Parser_resolve_list_marker_59 = function $$resolve_list_marker(list_type, marker, ordinal, validate, reader) { + var self = this; + + + + if (ordinal == null) { + ordinal = 0; + }; + + if (validate == null) { + validate = false; + }; + + if (reader == null) { + reader = nil; + }; + if (list_type['$==']("ulist")) { + return marker + } else if (list_type['$==']("olist")) { + return self.$resolve_ordered_list_marker(marker, ordinal, validate, reader)['$[]'](0) + } else { + return "<1>" + }; + }, TMP_Parser_resolve_list_marker_59.$$arity = -3); + Opal.defs(self, '$resolve_ordered_list_marker', TMP_Parser_resolve_ordered_list_marker_60 = function $$resolve_ordered_list_marker(marker, ordinal, validate, reader) { + var TMP_61, $a, self = this, $case = nil, style = nil, expected = nil, actual = nil; + + + + if (ordinal == null) { + ordinal = 0; + }; + + if (validate == null) { + validate = false; + }; + + if (reader == null) { + reader = nil; + }; + if ($truthy(marker['$start_with?']("."))) { + return [marker]}; + $case = (style = $send($$($nesting, 'ORDERED_LIST_STYLES'), 'find', [], (TMP_61 = function(s){var self = TMP_61.$$s || this; + + + + if (s == null) { + s = nil; + }; + return $$($nesting, 'OrderedListMarkerRxMap')['$[]'](s)['$match?'](marker);}, TMP_61.$$s = self, TMP_61.$$arity = 1, TMP_61))); + if ("arabic"['$===']($case)) { + if ($truthy(validate)) { + + expected = $rb_plus(ordinal, 1); + actual = marker.$to_i();}; + marker = "1.";} + else if ("loweralpha"['$===']($case)) { + if ($truthy(validate)) { + + expected = $rb_plus("a"['$[]'](0).$ord(), ordinal).$chr(); + actual = marker.$chop();}; + marker = "a.";} + else if ("upperalpha"['$===']($case)) { + if ($truthy(validate)) { + + expected = $rb_plus("A"['$[]'](0).$ord(), ordinal).$chr(); + actual = marker.$chop();}; + marker = "A.";} + else if ("lowerroman"['$===']($case)) { + if ($truthy(validate)) { + + expected = $$($nesting, 'Helpers').$int_to_roman($rb_plus(ordinal, 1)).$downcase(); + actual = marker.$chop();}; + marker = "i)";} + else if ("upperroman"['$===']($case)) { + if ($truthy(validate)) { + + expected = $$($nesting, 'Helpers').$int_to_roman($rb_plus(ordinal, 1)); + actual = marker.$chop();}; + marker = "I)";}; + if ($truthy(($truthy($a = validate) ? expected['$!='](actual) : $a))) { + self.$logger().$warn(self.$message_with_context("" + "list item index: expected " + (expected) + ", got " + (actual), $hash2(["source_location"], {"source_location": reader.$cursor()})))}; + return [marker, style]; + }, TMP_Parser_resolve_ordered_list_marker_60.$$arity = -2); + Opal.defs(self, '$is_sibling_list_item?', TMP_Parser_is_sibling_list_item$q_62 = function(line, list_type, sibling_trait) { + var $a, self = this, matcher = nil, expected_marker = nil; + + + if ($truthy($$$('::', 'Regexp')['$==='](sibling_trait))) { + matcher = sibling_trait + } else { + + matcher = $$($nesting, 'ListRxMap')['$[]'](list_type); + expected_marker = sibling_trait; + }; + if ($truthy(matcher['$=~'](line))) { + if ($truthy(expected_marker)) { + return expected_marker['$=='](self.$resolve_list_marker(list_type, (($a = $gvars['~']) === nil ? nil : $a['$[]'](1)))) + } else { + return true + } + } else { + return false + }; + }, TMP_Parser_is_sibling_list_item$q_62.$$arity = 3); + Opal.defs(self, '$parse_table', TMP_Parser_parse_table_63 = function $$parse_table(table_reader, parent, attributes) { + var $a, $b, $c, $d, self = this, table = nil, $writer = nil, colspecs = nil, explicit_colspecs = nil, skipped = nil, parser_ctx = nil, format = nil, loop_idx = nil, implicit_header_boundary = nil, implicit_header = nil, line = nil, beyond_first = nil, next_cellspec = nil, m = nil, pre_match = nil, post_match = nil, $case = nil, cell_text = nil, $logical_op_recvr_tmp_2 = nil; + + + table = $$($nesting, 'Table').$new(parent, attributes); + if ($truthy(attributes['$key?']("title"))) { + + + $writer = [attributes.$delete("title")]; + $send(table, 'title=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + table.$assign_caption(attributes.$delete("caption"));}; + if ($truthy(($truthy($a = attributes['$key?']("cols")) ? (colspecs = self.$parse_colspecs(attributes['$[]']("cols")))['$empty?']()['$!']() : $a))) { + + table.$create_columns(colspecs); + explicit_colspecs = true;}; + skipped = ($truthy($a = table_reader.$skip_blank_lines()) ? $a : 0); + parser_ctx = $$$($$($nesting, 'Table'), 'ParserContext').$new(table_reader, table, attributes); + $a = [parser_ctx.$format(), -1, nil], (format = $a[0]), (loop_idx = $a[1]), (implicit_header_boundary = $a[2]), $a; + if ($truthy(($truthy($a = ($truthy($b = $rb_gt(skipped, 0)) ? $b : attributes['$key?']("header-option"))) ? $a : attributes['$key?']("noheader-option")))) { + } else { + implicit_header = true + }; + $a = false; while ($a || $truthy((line = table_reader.$read_line()))) {$a = false; + + if ($truthy(($truthy($b = (beyond_first = $rb_gt((loop_idx = $rb_plus(loop_idx, 1)), 0))) ? line['$empty?']() : $b))) { + + line = nil; + if ($truthy(implicit_header_boundary)) { + implicit_header_boundary = $rb_plus(implicit_header_boundary, 1)}; + } else if (format['$==']("psv")) { + if ($truthy(parser_ctx['$starts_with_delimiter?'](line))) { + + line = line.$slice(1, line.$length()); + parser_ctx.$close_open_cell(); + if ($truthy(implicit_header_boundary)) { + implicit_header_boundary = nil}; + } else { + + $c = self.$parse_cellspec(line, "start", parser_ctx.$delimiter()), $b = Opal.to_ary($c), (next_cellspec = ($b[0] == null ? nil : $b[0])), (line = ($b[1] == null ? nil : $b[1])), $c; + if ($truthy(next_cellspec)) { + + parser_ctx.$close_open_cell(next_cellspec); + if ($truthy(implicit_header_boundary)) { + implicit_header_boundary = nil}; + } else if ($truthy(($truthy($b = implicit_header_boundary) ? implicit_header_boundary['$=='](loop_idx) : $b))) { + $b = [false, nil], (implicit_header = $b[0]), (implicit_header_boundary = $b[1]), $b}; + }}; + if ($truthy(beyond_first)) { + } else { + + table_reader.$mark(); + if ($truthy(implicit_header)) { + if ($truthy(($truthy($b = table_reader['$has_more_lines?']()) ? table_reader.$peek_line()['$empty?']() : $b))) { + implicit_header_boundary = 1 + } else { + implicit_header = false + }}; + }; + $b = false; while ($b || $truthy(true)) {$b = false; + if ($truthy(($truthy($c = line) ? (m = parser_ctx.$match_delimiter(line)) : $c))) { + + $c = [m.$pre_match(), m.$post_match()], (pre_match = $c[0]), (post_match = $c[1]), $c; + $case = format; + if ("csv"['$===']($case)) { + if ($truthy(parser_ctx['$buffer_has_unclosed_quotes?'](pre_match))) { + + parser_ctx.$skip_past_delimiter(pre_match); + if ($truthy((line = post_match)['$empty?']())) { + break;}; + $b = true; continue;;}; + + $writer = ["" + (parser_ctx.$buffer()) + (pre_match)]; + $send(parser_ctx, 'buffer=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];;} + else if ("dsv"['$===']($case)) { + if ($truthy(pre_match['$end_with?']("\\"))) { + + parser_ctx.$skip_past_escaped_delimiter(pre_match); + if ($truthy((line = post_match)['$empty?']())) { + + + $writer = ["" + (parser_ctx.$buffer()) + ($$($nesting, 'LF'))]; + $send(parser_ctx, 'buffer=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + parser_ctx.$keep_cell_open(); + break;;}; + $b = true; continue;;}; + + $writer = ["" + (parser_ctx.$buffer()) + (pre_match)]; + $send(parser_ctx, 'buffer=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];;} + else { + if ($truthy(pre_match['$end_with?']("\\"))) { + + parser_ctx.$skip_past_escaped_delimiter(pre_match); + if ($truthy((line = post_match)['$empty?']())) { + + + $writer = ["" + (parser_ctx.$buffer()) + ($$($nesting, 'LF'))]; + $send(parser_ctx, 'buffer=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + parser_ctx.$keep_cell_open(); + break;;}; + $b = true; continue;;}; + $d = self.$parse_cellspec(pre_match), $c = Opal.to_ary($d), (next_cellspec = ($c[0] == null ? nil : $c[0])), (cell_text = ($c[1] == null ? nil : $c[1])), $d; + parser_ctx.$push_cellspec(next_cellspec); + + $writer = ["" + (parser_ctx.$buffer()) + (cell_text)]; + $send(parser_ctx, 'buffer=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];;}; + if ($truthy((line = post_match)['$empty?']())) { + line = nil}; + parser_ctx.$close_cell(); + } else { + + + $writer = ["" + (parser_ctx.$buffer()) + (line) + ($$($nesting, 'LF'))]; + $send(parser_ctx, 'buffer=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + $case = format; + if ("csv"['$===']($case)) {if ($truthy(parser_ctx['$buffer_has_unclosed_quotes?']())) { + + if ($truthy(($truthy($c = implicit_header_boundary) ? loop_idx['$=='](0) : $c))) { + $c = [false, nil], (implicit_header = $c[0]), (implicit_header_boundary = $c[1]), $c}; + parser_ctx.$keep_cell_open(); + } else { + parser_ctx.$close_cell(true) + }} + else if ("dsv"['$===']($case)) {parser_ctx.$close_cell(true)} + else {parser_ctx.$keep_cell_open()}; + break;; + } + }; + if ($truthy(parser_ctx['$cell_open?']())) { + if ($truthy(table_reader['$has_more_lines?']())) { + } else { + parser_ctx.$close_cell(true) + } + } else { + if ($truthy($b = table_reader.$skip_blank_lines())) { + $b + } else { + break; + } + }; + }; + if ($truthy(($truthy($a = (($logical_op_recvr_tmp_2 = table.$attributes()), ($truthy($b = $logical_op_recvr_tmp_2['$[]']("colcount")) ? $b : (($writer = ["colcount", table.$columns().$size()]), $send($logical_op_recvr_tmp_2, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])))['$=='](0)) ? $a : explicit_colspecs))) { + } else { + table.$assign_column_widths() + }; + if ($truthy(implicit_header)) { + + + $writer = [true]; + $send(table, 'has_header_option=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["header-option", ""]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["options", (function() {if ($truthy(attributes['$key?']("options"))) { + return "" + (attributes['$[]']("options")) + ",header" + } else { + return "header" + }; return nil; })()]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];;}; + table.$partition_header_footer(attributes); + return table; + }, TMP_Parser_parse_table_63.$$arity = 3); + Opal.defs(self, '$parse_colspecs', TMP_Parser_parse_colspecs_64 = function $$parse_colspecs(records) { + var TMP_65, TMP_66, self = this, specs = nil; + + + if ($truthy(records['$include?'](" "))) { + records = records.$delete(" ")}; + if (records['$=='](records.$to_i().$to_s())) { + return $send($$$('::', 'Array'), 'new', [records.$to_i()], (TMP_65 = function(){var self = TMP_65.$$s || this; + + return $hash2(["width"], {"width": 1})}, TMP_65.$$s = self, TMP_65.$$arity = 0, TMP_65))}; + specs = []; + $send((function() {if ($truthy(records['$include?'](","))) { + + return records.$split(",", -1); + } else { + + return records.$split(";", -1); + }; return nil; })(), 'each', [], (TMP_66 = function(record){var self = TMP_66.$$s || this, $a, $b, TMP_67, m = nil, spec = nil, colspec = nil, rowspec = nil, $writer = nil, width = nil; + + + + if (record == null) { + record = nil; + }; + if ($truthy(record['$empty?']())) { + return specs['$<<']($hash2(["width"], {"width": 1})) + } else if ($truthy((m = $$($nesting, 'ColumnSpecRx').$match(record)))) { + + spec = $hash2([], {}); + if ($truthy(m['$[]'](2))) { + + $b = m['$[]'](2).$split("."), $a = Opal.to_ary($b), (colspec = ($a[0] == null ? nil : $a[0])), (rowspec = ($a[1] == null ? nil : $a[1])), $b; + if ($truthy(($truthy($a = colspec['$nil_or_empty?']()['$!']()) ? $$($nesting, 'TableCellHorzAlignments')['$key?'](colspec) : $a))) { + + $writer = ["halign", $$($nesting, 'TableCellHorzAlignments')['$[]'](colspec)]; + $send(spec, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if ($truthy(($truthy($a = rowspec['$nil_or_empty?']()['$!']()) ? $$($nesting, 'TableCellVertAlignments')['$key?'](rowspec) : $a))) { + + $writer = ["valign", $$($nesting, 'TableCellVertAlignments')['$[]'](rowspec)]; + $send(spec, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];};}; + if ($truthy((width = m['$[]'](3)))) { + + $writer = ["width", (function() {if (width['$==']("~")) { + return -1 + } else { + return width.$to_i() + }; return nil; })()]; + $send(spec, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + } else { + + $writer = ["width", 1]; + $send(spec, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + if ($truthy(($truthy($a = m['$[]'](4)) ? $$($nesting, 'TableCellStyles')['$key?'](m['$[]'](4)) : $a))) { + + $writer = ["style", $$($nesting, 'TableCellStyles')['$[]'](m['$[]'](4))]; + $send(spec, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if ($truthy(m['$[]'](1))) { + return $send((1), 'upto', [m['$[]'](1).$to_i()], (TMP_67 = function(){var self = TMP_67.$$s || this; + + return specs['$<<'](spec.$dup())}, TMP_67.$$s = self, TMP_67.$$arity = 0, TMP_67)) + } else { + return specs['$<<'](spec) + }; + } else { + return nil + };}, TMP_66.$$s = self, TMP_66.$$arity = 1, TMP_66)); + return specs; + }, TMP_Parser_parse_colspecs_64.$$arity = 1); + Opal.defs(self, '$parse_cellspec', TMP_Parser_parse_cellspec_68 = function $$parse_cellspec(line, pos, delimiter) { + var $a, $b, self = this, m = nil, rest = nil, spec_part = nil, spec = nil, colspec = nil, rowspec = nil, $writer = nil; + + + + if (pos == null) { + pos = "end"; + }; + + if (delimiter == null) { + delimiter = nil; + }; + $a = [nil, ""], (m = $a[0]), (rest = $a[1]), $a; + if (pos['$==']("start")) { + if ($truthy(line['$include?'](delimiter))) { + + $b = line.$split(delimiter, 2), $a = Opal.to_ary($b), (spec_part = ($a[0] == null ? nil : $a[0])), (rest = ($a[1] == null ? nil : $a[1])), $b; + if ($truthy((m = $$($nesting, 'CellSpecStartRx').$match(spec_part)))) { + if ($truthy(m['$[]'](0)['$empty?']())) { + return [$hash2([], {}), rest]} + } else { + return [nil, line] + }; + } else { + return [nil, line] + } + } else if ($truthy((m = $$($nesting, 'CellSpecEndRx').$match(line)))) { + + if ($truthy(m['$[]'](0).$lstrip()['$empty?']())) { + return [$hash2([], {}), line.$rstrip()]}; + rest = m.$pre_match(); + } else { + return [$hash2([], {}), line] + }; + spec = $hash2([], {}); + if ($truthy(m['$[]'](1))) { + + $b = m['$[]'](1).$split("."), $a = Opal.to_ary($b), (colspec = ($a[0] == null ? nil : $a[0])), (rowspec = ($a[1] == null ? nil : $a[1])), $b; + colspec = (function() {if ($truthy(colspec['$nil_or_empty?']())) { + return 1 + } else { + return colspec.$to_i() + }; return nil; })(); + rowspec = (function() {if ($truthy(rowspec['$nil_or_empty?']())) { + return 1 + } else { + return rowspec.$to_i() + }; return nil; })(); + if (m['$[]'](2)['$==']("+")) { + + if (colspec['$=='](1)) { + } else { + + $writer = ["colspan", colspec]; + $send(spec, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + if (rowspec['$=='](1)) { + } else { + + $writer = ["rowspan", rowspec]; + $send(spec, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + } else if (m['$[]'](2)['$==']("*")) { + if (colspec['$=='](1)) { + } else { + + $writer = ["repeatcol", colspec]; + $send(spec, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }};}; + if ($truthy(m['$[]'](3))) { + + $b = m['$[]'](3).$split("."), $a = Opal.to_ary($b), (colspec = ($a[0] == null ? nil : $a[0])), (rowspec = ($a[1] == null ? nil : $a[1])), $b; + if ($truthy(($truthy($a = colspec['$nil_or_empty?']()['$!']()) ? $$($nesting, 'TableCellHorzAlignments')['$key?'](colspec) : $a))) { + + $writer = ["halign", $$($nesting, 'TableCellHorzAlignments')['$[]'](colspec)]; + $send(spec, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if ($truthy(($truthy($a = rowspec['$nil_or_empty?']()['$!']()) ? $$($nesting, 'TableCellVertAlignments')['$key?'](rowspec) : $a))) { + + $writer = ["valign", $$($nesting, 'TableCellVertAlignments')['$[]'](rowspec)]; + $send(spec, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];};}; + if ($truthy(($truthy($a = m['$[]'](4)) ? $$($nesting, 'TableCellStyles')['$key?'](m['$[]'](4)) : $a))) { + + $writer = ["style", $$($nesting, 'TableCellStyles')['$[]'](m['$[]'](4))]; + $send(spec, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + return [spec, rest]; + }, TMP_Parser_parse_cellspec_68.$$arity = -2); + Opal.defs(self, '$parse_style_attribute', TMP_Parser_parse_style_attribute_69 = function $$parse_style_attribute(attributes, reader) { + var $a, $b, TMP_70, TMP_71, TMP_72, self = this, raw_style = nil, type = nil, collector = nil, parsed = nil, save_current = nil, $writer = nil, parsed_style = nil, existing_role = nil, opts = nil, existing_opts = nil; + + + + if (reader == null) { + reader = nil; + }; + if ($truthy(($truthy($a = ($truthy($b = (raw_style = attributes['$[]'](1))) ? raw_style['$include?'](" ")['$!']() : $b)) ? $$($nesting, 'Compliance').$shorthand_property_syntax() : $a))) { + + $a = ["style", [], $hash2([], {})], (type = $a[0]), (collector = $a[1]), (parsed = $a[2]), $a; + save_current = $send(self, 'lambda', [], (TMP_70 = function(){var self = TMP_70.$$s || this, $c, $case = nil, $writer = nil; + + if ($truthy(collector['$empty?']())) { + if (type['$==']("style")) { + return nil + } else if ($truthy(reader)) { + return self.$logger().$warn(self.$message_with_context("" + "invalid empty " + (type) + " detected in style attribute", $hash2(["source_location"], {"source_location": reader.$cursor_at_prev_line()}))) + } else { + return self.$logger().$warn("" + "invalid empty " + (type) + " detected in style attribute") + } + } else { + + $case = type; + if ("role"['$===']($case) || "option"['$===']($case)) {($truthy($c = parsed['$[]'](type)) ? $c : (($writer = [type, []]), $send(parsed, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]))['$<<'](collector.$join())} + else if ("id"['$===']($case)) { + if ($truthy(parsed['$key?']("id"))) { + if ($truthy(reader)) { + self.$logger().$warn(self.$message_with_context("multiple ids detected in style attribute", $hash2(["source_location"], {"source_location": reader.$cursor_at_prev_line()}))) + } else { + self.$logger().$warn("multiple ids detected in style attribute") + }}; + + $writer = [type, collector.$join()]; + $send(parsed, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];;} + else { + $writer = [type, collector.$join()]; + $send(parsed, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + return (collector = []); + }}, TMP_70.$$s = self, TMP_70.$$arity = 0, TMP_70)); + $send(raw_style, 'each_char', [], (TMP_71 = function(c){var self = TMP_71.$$s || this, $c, $d, $case = nil; + + + + if (c == null) { + c = nil; + }; + if ($truthy(($truthy($c = ($truthy($d = c['$=='](".")) ? $d : c['$==']("#"))) ? $c : c['$==']("%")))) { + + save_current.$call(); + return (function() {$case = c; + if ("."['$===']($case)) {return (type = "role")} + else if ("#"['$===']($case)) {return (type = "id")} + else if ("%"['$===']($case)) {return (type = "option")} + else { return nil }})(); + } else { + return collector['$<<'](c) + };}, TMP_71.$$s = self, TMP_71.$$arity = 1, TMP_71)); + if (type['$==']("style")) { + + $writer = ["style", raw_style]; + $send(attributes, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + } else { + + save_current.$call(); + if ($truthy(parsed['$key?']("style"))) { + parsed_style = (($writer = ["style", parsed['$[]']("style")]), $send(attributes, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])}; + if ($truthy(parsed['$key?']("id"))) { + + $writer = ["id", parsed['$[]']("id")]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if ($truthy(parsed['$key?']("role"))) { + + $writer = ["role", (function() {if ($truthy((existing_role = attributes['$[]']("role"))['$nil_or_empty?']())) { + + return parsed['$[]']("role").$join(" "); + } else { + return "" + (existing_role) + " " + (parsed['$[]']("role").$join(" ")) + }; return nil; })()]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if ($truthy(parsed['$key?']("option"))) { + + $send((opts = parsed['$[]']("option")), 'each', [], (TMP_72 = function(opt){var self = TMP_72.$$s || this; + + + + if (opt == null) { + opt = nil; + }; + $writer = ["" + (opt) + "-option", ""]; + $send(attributes, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];}, TMP_72.$$s = self, TMP_72.$$arity = 1, TMP_72)); + + $writer = ["options", (function() {if ($truthy((existing_opts = attributes['$[]']("options"))['$nil_or_empty?']())) { + + return opts.$join(","); + } else { + return "" + (existing_opts) + "," + (opts.$join(",")) + }; return nil; })()]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];;}; + return parsed_style; + }; + } else { + + $writer = ["style", raw_style]; + $send(attributes, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + }; + }, TMP_Parser_parse_style_attribute_69.$$arity = -2); + Opal.defs(self, '$adjust_indentation!', TMP_Parser_adjust_indentation$B_73 = function(lines, indent, tab_size) { + var $a, TMP_74, TMP_77, TMP_78, TMP_79, TMP_80, self = this, full_tab_space = nil, gutter_width = nil, padding = nil; + + + + if (indent == null) { + indent = 0; + }; + + if (tab_size == null) { + tab_size = 0; + }; + if ($truthy(lines['$empty?']())) { + return nil}; + if ($truthy(($truthy($a = $rb_gt((tab_size = tab_size.$to_i()), 0)) ? lines.$join()['$include?']($$($nesting, 'TAB')) : $a))) { + + full_tab_space = $rb_times(" ", tab_size); + $send(lines, 'map!', [], (TMP_74 = function(line){var self = TMP_74.$$s || this, TMP_75, TMP_76, spaces_added = nil; + + + + if (line == null) { + line = nil; + }; + if ($truthy(line['$empty?']())) { + return line;}; + if ($truthy(line['$start_with?']($$($nesting, 'TAB')))) { + line = $send(line, 'sub', [$$($nesting, 'TabIndentRx')], (TMP_75 = function(){var self = TMP_75.$$s || this, $b; + + return $rb_times(full_tab_space, (($b = $gvars['~']) === nil ? nil : $b['$[]'](0)).$length())}, TMP_75.$$s = self, TMP_75.$$arity = 0, TMP_75))}; + if ($truthy(line['$include?']($$($nesting, 'TAB')))) { + + spaces_added = 0; + return line = $send(line, 'gsub', [$$($nesting, 'TabRx')], (TMP_76 = function(){var self = TMP_76.$$s || this, offset = nil, spaces = nil; + if ($gvars["~"] == null) $gvars["~"] = nil; + + if ((offset = $rb_plus($gvars["~"].$begin(0), spaces_added))['$%'](tab_size)['$=='](0)) { + + spaces_added = $rb_plus(spaces_added, $rb_minus(tab_size, 1)); + return full_tab_space; + } else { + + if ((spaces = $rb_minus(tab_size, offset['$%'](tab_size)))['$=='](1)) { + } else { + spaces_added = $rb_plus(spaces_added, $rb_minus(spaces, 1)) + }; + return $rb_times(" ", spaces); + }}, TMP_76.$$s = self, TMP_76.$$arity = 0, TMP_76)); + } else { + return line + };}, TMP_74.$$s = self, TMP_74.$$arity = 1, TMP_74));}; + if ($truthy(($truthy($a = indent) ? $rb_gt((indent = indent.$to_i()), -1) : $a))) { + } else { + return nil + }; + gutter_width = nil; + (function(){var $brk = Opal.new_brk(); try {return $send(lines, 'each', [], (TMP_77 = function(line){var self = TMP_77.$$s || this, $b, line_indent = nil; + + + + if (line == null) { + line = nil; + }; + if ($truthy(line['$empty?']())) { + return nil;}; + if ((line_indent = $rb_minus(line.$length(), line.$lstrip().$length()))['$=='](0)) { + + gutter_width = nil; + + Opal.brk(nil, $brk); + } else if ($truthy(($truthy($b = gutter_width) ? $rb_gt(line_indent, gutter_width) : $b))) { + return nil + } else { + return (gutter_width = line_indent) + };}, TMP_77.$$s = self, TMP_77.$$brk = $brk, TMP_77.$$arity = 1, TMP_77)) + } catch (err) { if (err === $brk) { return err.$v } else { throw err } }})(); + if (indent['$=='](0)) { + if ($truthy(gutter_width)) { + $send(lines, 'map!', [], (TMP_78 = function(line){var self = TMP_78.$$s || this; + + + + if (line == null) { + line = nil; + }; + if ($truthy(line['$empty?']())) { + return line + } else { + + return line.$slice(gutter_width, line.$length()); + };}, TMP_78.$$s = self, TMP_78.$$arity = 1, TMP_78))} + } else { + + padding = $rb_times(" ", indent); + if ($truthy(gutter_width)) { + $send(lines, 'map!', [], (TMP_79 = function(line){var self = TMP_79.$$s || this; + + + + if (line == null) { + line = nil; + }; + if ($truthy(line['$empty?']())) { + return line + } else { + return $rb_plus(padding, line.$slice(gutter_width, line.$length())) + };}, TMP_79.$$s = self, TMP_79.$$arity = 1, TMP_79)) + } else { + $send(lines, 'map!', [], (TMP_80 = function(line){var self = TMP_80.$$s || this; + + + + if (line == null) { + line = nil; + }; + if ($truthy(line['$empty?']())) { + return line + } else { + return $rb_plus(padding, line) + };}, TMP_80.$$s = self, TMP_80.$$arity = 1, TMP_80)) + }; + }; + return nil; + }, TMP_Parser_adjust_indentation$B_73.$$arity = -2); + return (Opal.defs(self, '$sanitize_attribute_name', TMP_Parser_sanitize_attribute_name_81 = function $$sanitize_attribute_name(name) { + var self = this; + + return name.$gsub($$($nesting, 'InvalidAttributeNameCharsRx'), "").$downcase() + }, TMP_Parser_sanitize_attribute_name_81.$$arity = 1), nil) && 'sanitize_attribute_name'; + })($nesting[0], null, $nesting) + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/path_resolver"] = function(Opal) { + function $rb_plus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); + } + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + function $rb_gt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $truthy = Opal.truthy, $hash2 = Opal.hash2, $send = Opal.send; + + Opal.add_stubs(['$include', '$attr_accessor', '$root?', '$posixify', '$expand_path', '$pwd', '$start_with?', '$==', '$match?', '$absolute_path?', '$+', '$length', '$descends_from?', '$slice', '$to_s', '$relative_path_from', '$new', '$include?', '$tr', '$partition_path', '$each', '$pop', '$<<', '$join_path', '$[]', '$web_root?', '$unc?', '$index', '$split', '$delete', '$[]=', '$-', '$join', '$raise', '$!', '$fetch', '$warn', '$logger', '$empty?', '$nil_or_empty?', '$chomp', '$!=', '$>', '$size', '$end_with?', '$uri_prefix', '$gsub']); + return (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + (function($base, $super, $parent_nesting) { + function $PathResolver(){}; + var self = $PathResolver = $klass($base, $super, 'PathResolver', $PathResolver); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_PathResolver_initialize_1, TMP_PathResolver_absolute_path$q_2, $a, TMP_PathResolver_root$q_3, TMP_PathResolver_unc$q_4, TMP_PathResolver_web_root$q_5, TMP_PathResolver_descends_from$q_6, TMP_PathResolver_relative_path_7, TMP_PathResolver_posixify_8, TMP_PathResolver_expand_path_9, TMP_PathResolver_partition_path_11, TMP_PathResolver_join_path_12, TMP_PathResolver_system_path_13, TMP_PathResolver_web_path_16; + + def.file_separator = def._partition_path_web = def._partition_path_sys = def.working_dir = nil; + + self.$include($$($nesting, 'Logging')); + Opal.const_set($nesting[0], 'DOT', "."); + Opal.const_set($nesting[0], 'DOT_DOT', ".."); + Opal.const_set($nesting[0], 'DOT_SLASH', "./"); + Opal.const_set($nesting[0], 'SLASH', "/"); + Opal.const_set($nesting[0], 'BACKSLASH', "\\"); + Opal.const_set($nesting[0], 'DOUBLE_SLASH', "//"); + Opal.const_set($nesting[0], 'WindowsRootRx', /^(?:[a-zA-Z]:)?[\\\/]/); + self.$attr_accessor("file_separator"); + self.$attr_accessor("working_dir"); + + Opal.def(self, '$initialize', TMP_PathResolver_initialize_1 = function $$initialize(file_separator, working_dir) { + var $a, $b, self = this; + + + + if (file_separator == null) { + file_separator = nil; + }; + + if (working_dir == null) { + working_dir = nil; + }; + self.file_separator = ($truthy($a = ($truthy($b = file_separator) ? $b : $$$($$$('::', 'File'), 'ALT_SEPARATOR'))) ? $a : $$$($$$('::', 'File'), 'SEPARATOR')); + self.working_dir = (function() {if ($truthy(working_dir)) { + + if ($truthy(self['$root?'](working_dir))) { + + return self.$posixify(working_dir); + } else { + + return $$$('::', 'File').$expand_path(working_dir); + }; + } else { + return $$$('::', 'Dir').$pwd() + }; return nil; })(); + self._partition_path_sys = $hash2([], {}); + return (self._partition_path_web = $hash2([], {})); + }, TMP_PathResolver_initialize_1.$$arity = -1); + + Opal.def(self, '$absolute_path?', TMP_PathResolver_absolute_path$q_2 = function(path) { + var $a, $b, self = this; + + return ($truthy($a = path['$start_with?']($$($nesting, 'SLASH'))) ? $a : (($b = self.file_separator['$==']($$($nesting, 'BACKSLASH'))) ? $$($nesting, 'WindowsRootRx')['$match?'](path) : self.file_separator['$==']($$($nesting, 'BACKSLASH')))) + }, TMP_PathResolver_absolute_path$q_2.$$arity = 1); + if ($truthy((($a = $$($nesting, 'RUBY_ENGINE')['$==']("opal")) ? $$$('::', 'JAVASCRIPT_IO_MODULE')['$==']("xmlhttprequest") : $$($nesting, 'RUBY_ENGINE')['$==']("opal")))) { + + Opal.def(self, '$root?', TMP_PathResolver_root$q_3 = function(path) { + var $a, self = this; + + return ($truthy($a = self['$absolute_path?'](path)) ? $a : path['$start_with?']("file://", "http://", "https://")) + }, TMP_PathResolver_root$q_3.$$arity = 1) + } else { + Opal.alias(self, "root?", "absolute_path?") + }; + + Opal.def(self, '$unc?', TMP_PathResolver_unc$q_4 = function(path) { + var self = this; + + return path['$start_with?']($$($nesting, 'DOUBLE_SLASH')) + }, TMP_PathResolver_unc$q_4.$$arity = 1); + + Opal.def(self, '$web_root?', TMP_PathResolver_web_root$q_5 = function(path) { + var self = this; + + return path['$start_with?']($$($nesting, 'SLASH')) + }, TMP_PathResolver_web_root$q_5.$$arity = 1); + + Opal.def(self, '$descends_from?', TMP_PathResolver_descends_from$q_6 = function(path, base) { + var $a, self = this; + + if (base['$=='](path)) { + return 0 + } else if (base['$==']($$($nesting, 'SLASH'))) { + return ($truthy($a = path['$start_with?']($$($nesting, 'SLASH'))) ? 1 : $a) + } else { + return ($truthy($a = path['$start_with?']($rb_plus(base, $$($nesting, 'SLASH')))) ? $rb_plus(base.$length(), 1) : $a) + } + }, TMP_PathResolver_descends_from$q_6.$$arity = 2); + + Opal.def(self, '$relative_path', TMP_PathResolver_relative_path_7 = function $$relative_path(path, base) { + var self = this, offset = nil; + + if ($truthy(self['$root?'](path))) { + if ($truthy((offset = self['$descends_from?'](path, base)))) { + return path.$slice(offset, path.$length()) + } else { + return $$($nesting, 'Pathname').$new(path).$relative_path_from($$($nesting, 'Pathname').$new(base)).$to_s() + } + } else { + return path + } + }, TMP_PathResolver_relative_path_7.$$arity = 2); + + Opal.def(self, '$posixify', TMP_PathResolver_posixify_8 = function $$posixify(path) { + var $a, self = this; + + if ($truthy(path)) { + if ($truthy((($a = self.file_separator['$==']($$($nesting, 'BACKSLASH'))) ? path['$include?']($$($nesting, 'BACKSLASH')) : self.file_separator['$==']($$($nesting, 'BACKSLASH'))))) { + + return path.$tr($$($nesting, 'BACKSLASH'), $$($nesting, 'SLASH')); + } else { + return path + } + } else { + return "" + } + }, TMP_PathResolver_posixify_8.$$arity = 1); + Opal.alias(self, "posixfy", "posixify"); + + Opal.def(self, '$expand_path', TMP_PathResolver_expand_path_9 = function $$expand_path(path) { + var $a, $b, TMP_10, self = this, path_segments = nil, path_root = nil, resolved_segments = nil; + + + $b = self.$partition_path(path), $a = Opal.to_ary($b), (path_segments = ($a[0] == null ? nil : $a[0])), (path_root = ($a[1] == null ? nil : $a[1])), $b; + if ($truthy(path['$include?']($$($nesting, 'DOT_DOT')))) { + + resolved_segments = []; + $send(path_segments, 'each', [], (TMP_10 = function(segment){var self = TMP_10.$$s || this; + + + + if (segment == null) { + segment = nil; + }; + if (segment['$==']($$($nesting, 'DOT_DOT'))) { + return resolved_segments.$pop() + } else { + return resolved_segments['$<<'](segment) + };}, TMP_10.$$s = self, TMP_10.$$arity = 1, TMP_10)); + return self.$join_path(resolved_segments, path_root); + } else { + return self.$join_path(path_segments, path_root) + }; + }, TMP_PathResolver_expand_path_9.$$arity = 1); + + Opal.def(self, '$partition_path', TMP_PathResolver_partition_path_11 = function $$partition_path(path, web) { + var self = this, result = nil, cache = nil, posix_path = nil, root = nil, path_segments = nil, $writer = nil; + + + + if (web == null) { + web = nil; + }; + if ($truthy((result = (cache = (function() {if ($truthy(web)) { + return self._partition_path_web + } else { + return self._partition_path_sys + }; return nil; })())['$[]'](path)))) { + return result}; + posix_path = self.$posixify(path); + if ($truthy(web)) { + if ($truthy(self['$web_root?'](posix_path))) { + root = $$($nesting, 'SLASH') + } else if ($truthy(posix_path['$start_with?']($$($nesting, 'DOT_SLASH')))) { + root = $$($nesting, 'DOT_SLASH')} + } else if ($truthy(self['$root?'](posix_path))) { + if ($truthy(self['$unc?'](posix_path))) { + root = $$($nesting, 'DOUBLE_SLASH') + } else if ($truthy(posix_path['$start_with?']($$($nesting, 'SLASH')))) { + root = $$($nesting, 'SLASH') + } else { + root = posix_path.$slice(0, $rb_plus(posix_path.$index($$($nesting, 'SLASH')), 1)) + } + } else if ($truthy(posix_path['$start_with?']($$($nesting, 'DOT_SLASH')))) { + root = $$($nesting, 'DOT_SLASH')}; + path_segments = (function() {if ($truthy(root)) { + + return posix_path.$slice(root.$length(), posix_path.$length()); + } else { + return posix_path + }; return nil; })().$split($$($nesting, 'SLASH')); + path_segments.$delete($$($nesting, 'DOT')); + + $writer = [path, [path_segments, root]]; + $send(cache, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];; + }, TMP_PathResolver_partition_path_11.$$arity = -2); + + Opal.def(self, '$join_path', TMP_PathResolver_join_path_12 = function $$join_path(segments, root) { + var self = this; + + + + if (root == null) { + root = nil; + }; + if ($truthy(root)) { + return "" + (root) + (segments.$join($$($nesting, 'SLASH'))) + } else { + + return segments.$join($$($nesting, 'SLASH')); + }; + }, TMP_PathResolver_join_path_12.$$arity = -2); + + Opal.def(self, '$system_path', TMP_PathResolver_system_path_13 = function $$system_path(target, start, jail, opts) { + var $a, $b, TMP_14, TMP_15, self = this, target_path = nil, target_segments = nil, _ = nil, jail_segments = nil, jail_root = nil, recheck = nil, start_segments = nil, start_root = nil, resolved_segments = nil, unresolved_segments = nil, warned = nil; + + + + if (start == null) { + start = nil; + }; + + if (jail == null) { + jail = nil; + }; + + if (opts == null) { + opts = $hash2([], {}); + }; + if ($truthy(jail)) { + + if ($truthy(self['$root?'](jail))) { + } else { + self.$raise($$$('::', 'SecurityError'), "" + "Jail is not an absolute path: " + (jail)) + }; + jail = self.$posixify(jail);}; + if ($truthy(target)) { + if ($truthy(self['$root?'](target))) { + + target_path = self.$expand_path(target); + if ($truthy(($truthy($a = jail) ? self['$descends_from?'](target_path, jail)['$!']() : $a))) { + if ($truthy(opts.$fetch("recover", true))) { + + self.$logger().$warn("" + (($truthy($a = opts['$[]']("target_name")) ? $a : "path")) + " is outside of jail; recovering automatically"); + $b = self.$partition_path(target_path), $a = Opal.to_ary($b), (target_segments = ($a[0] == null ? nil : $a[0])), (_ = ($a[1] == null ? nil : $a[1])), $b; + $b = self.$partition_path(jail), $a = Opal.to_ary($b), (jail_segments = ($a[0] == null ? nil : $a[0])), (jail_root = ($a[1] == null ? nil : $a[1])), $b; + return self.$join_path($rb_plus(jail_segments, target_segments), jail_root); + } else { + self.$raise($$$('::', 'SecurityError'), "" + (($truthy($a = opts['$[]']("target_name")) ? $a : "path")) + " " + (target) + " is outside of jail: " + (jail) + " (disallowed in safe mode)") + }}; + return target_path; + } else { + $b = self.$partition_path(target), $a = Opal.to_ary($b), (target_segments = ($a[0] == null ? nil : $a[0])), (_ = ($a[1] == null ? nil : $a[1])), $b + } + } else { + target_segments = [] + }; + if ($truthy(target_segments['$empty?']())) { + if ($truthy(start['$nil_or_empty?']())) { + return ($truthy($a = jail) ? $a : self.working_dir) + } else if ($truthy(self['$root?'](start))) { + if ($truthy(jail)) { + start = self.$posixify(start) + } else { + return self.$expand_path(start) + } + } else { + + $b = self.$partition_path(start), $a = Opal.to_ary($b), (target_segments = ($a[0] == null ? nil : $a[0])), (_ = ($a[1] == null ? nil : $a[1])), $b; + start = ($truthy($a = jail) ? $a : self.working_dir); + } + } else if ($truthy(start['$nil_or_empty?']())) { + start = ($truthy($a = jail) ? $a : self.working_dir) + } else if ($truthy(self['$root?'](start))) { + if ($truthy(jail)) { + start = self.$posixify(start)} + } else { + start = "" + (($truthy($a = jail) ? $a : self.working_dir).$chomp("/")) + "/" + (start) + }; + if ($truthy(($truthy($a = ($truthy($b = jail) ? (recheck = self['$descends_from?'](start, jail)['$!']()) : $b)) ? self.file_separator['$==']($$($nesting, 'BACKSLASH')) : $a))) { + + $b = self.$partition_path(start), $a = Opal.to_ary($b), (start_segments = ($a[0] == null ? nil : $a[0])), (start_root = ($a[1] == null ? nil : $a[1])), $b; + $b = self.$partition_path(jail), $a = Opal.to_ary($b), (jail_segments = ($a[0] == null ? nil : $a[0])), (jail_root = ($a[1] == null ? nil : $a[1])), $b; + if ($truthy(start_root['$!='](jail_root))) { + if ($truthy(opts.$fetch("recover", true))) { + + self.$logger().$warn("" + "start path for " + (($truthy($a = opts['$[]']("target_name")) ? $a : "path")) + " is outside of jail root; recovering automatically"); + start_segments = jail_segments; + recheck = false; + } else { + self.$raise($$$('::', 'SecurityError'), "" + "start path for " + (($truthy($a = opts['$[]']("target_name")) ? $a : "path")) + " " + (start) + " refers to location outside jail root: " + (jail) + " (disallowed in safe mode)") + }}; + } else { + $b = self.$partition_path(start), $a = Opal.to_ary($b), (start_segments = ($a[0] == null ? nil : $a[0])), (jail_root = ($a[1] == null ? nil : $a[1])), $b + }; + if ($truthy((resolved_segments = $rb_plus(start_segments, target_segments))['$include?']($$($nesting, 'DOT_DOT')))) { + + $a = [resolved_segments, []], (unresolved_segments = $a[0]), (resolved_segments = $a[1]), $a; + if ($truthy(jail)) { + + if ($truthy(jail_segments)) { + } else { + $b = self.$partition_path(jail), $a = Opal.to_ary($b), (jail_segments = ($a[0] == null ? nil : $a[0])), (_ = ($a[1] == null ? nil : $a[1])), $b + }; + warned = false; + $send(unresolved_segments, 'each', [], (TMP_14 = function(segment){var self = TMP_14.$$s || this, $c; + + + + if (segment == null) { + segment = nil; + }; + if (segment['$==']($$($nesting, 'DOT_DOT'))) { + if ($truthy($rb_gt(resolved_segments.$size(), jail_segments.$size()))) { + return resolved_segments.$pop() + } else if ($truthy(opts.$fetch("recover", true))) { + if ($truthy(warned)) { + return nil + } else { + + self.$logger().$warn("" + (($truthy($c = opts['$[]']("target_name")) ? $c : "path")) + " has illegal reference to ancestor of jail; recovering automatically"); + return (warned = true); + } + } else { + return self.$raise($$$('::', 'SecurityError'), "" + (($truthy($c = opts['$[]']("target_name")) ? $c : "path")) + " " + (target) + " refers to location outside jail: " + (jail) + " (disallowed in safe mode)") + } + } else { + return resolved_segments['$<<'](segment) + };}, TMP_14.$$s = self, TMP_14.$$arity = 1, TMP_14)); + } else { + $send(unresolved_segments, 'each', [], (TMP_15 = function(segment){var self = TMP_15.$$s || this; + + + + if (segment == null) { + segment = nil; + }; + if (segment['$==']($$($nesting, 'DOT_DOT'))) { + return resolved_segments.$pop() + } else { + return resolved_segments['$<<'](segment) + };}, TMP_15.$$s = self, TMP_15.$$arity = 1, TMP_15)) + };}; + if ($truthy(recheck)) { + + target_path = self.$join_path(resolved_segments, jail_root); + if ($truthy(self['$descends_from?'](target_path, jail))) { + return target_path + } else if ($truthy(opts.$fetch("recover", true))) { + + self.$logger().$warn("" + (($truthy($a = opts['$[]']("target_name")) ? $a : "path")) + " is outside of jail; recovering automatically"); + if ($truthy(jail_segments)) { + } else { + $b = self.$partition_path(jail), $a = Opal.to_ary($b), (jail_segments = ($a[0] == null ? nil : $a[0])), (_ = ($a[1] == null ? nil : $a[1])), $b + }; + return self.$join_path($rb_plus(jail_segments, target_segments), jail_root); + } else { + return self.$raise($$$('::', 'SecurityError'), "" + (($truthy($a = opts['$[]']("target_name")) ? $a : "path")) + " " + (target) + " is outside of jail: " + (jail) + " (disallowed in safe mode)") + }; + } else { + return self.$join_path(resolved_segments, jail_root) + }; + }, TMP_PathResolver_system_path_13.$$arity = -2); + return (Opal.def(self, '$web_path', TMP_PathResolver_web_path_16 = function $$web_path(target, start) { + var $a, $b, TMP_17, self = this, uri_prefix = nil, target_segments = nil, target_root = nil, resolved_segments = nil, resolved_path = nil; + + + + if (start == null) { + start = nil; + }; + target = self.$posixify(target); + start = self.$posixify(start); + uri_prefix = nil; + if ($truthy(($truthy($a = start['$nil_or_empty?']()) ? $a : self['$web_root?'](target)))) { + } else { + + target = (function() {if ($truthy(start['$end_with?']($$($nesting, 'SLASH')))) { + return "" + (start) + (target) + } else { + return "" + (start) + ($$($nesting, 'SLASH')) + (target) + }; return nil; })(); + if ($truthy((uri_prefix = $$($nesting, 'Helpers').$uri_prefix(target)))) { + target = target['$[]'](Opal.Range.$new(uri_prefix.$length(), -1, false))}; + }; + $b = self.$partition_path(target, true), $a = Opal.to_ary($b), (target_segments = ($a[0] == null ? nil : $a[0])), (target_root = ($a[1] == null ? nil : $a[1])), $b; + resolved_segments = []; + $send(target_segments, 'each', [], (TMP_17 = function(segment){var self = TMP_17.$$s || this, $c; + + + + if (segment == null) { + segment = nil; + }; + if (segment['$==']($$($nesting, 'DOT_DOT'))) { + if ($truthy(resolved_segments['$empty?']())) { + if ($truthy(($truthy($c = target_root) ? target_root['$!=']($$($nesting, 'DOT_SLASH')) : $c))) { + return nil + } else { + return resolved_segments['$<<'](segment) + } + } else if (resolved_segments['$[]'](-1)['$==']($$($nesting, 'DOT_DOT'))) { + return resolved_segments['$<<'](segment) + } else { + return resolved_segments.$pop() + } + } else { + return resolved_segments['$<<'](segment) + };}, TMP_17.$$s = self, TMP_17.$$arity = 1, TMP_17)); + if ($truthy((resolved_path = self.$join_path(resolved_segments, target_root))['$include?'](" "))) { + resolved_path = resolved_path.$gsub(" ", "%20")}; + if ($truthy(uri_prefix)) { + return "" + (uri_prefix) + (resolved_path) + } else { + return resolved_path + }; + }, TMP_PathResolver_web_path_16.$$arity = -2), nil) && 'web_path'; + })($nesting[0], null, $nesting) + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/reader"] = function(Opal) { + function $rb_plus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); + } + function $rb_gt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); + } + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + function $rb_times(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs * rhs : lhs['$*'](rhs); + } + function $rb_lt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); + } + function $rb_ge(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs >= rhs : lhs['$>='](rhs); + } + function $rb_divide(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs / rhs : lhs['$/'](rhs); + } + function $rb_le(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs <= rhs : lhs['$<='](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $hash2 = Opal.hash2, $truthy = Opal.truthy, $send = Opal.send, $gvars = Opal.gvars, $hash = Opal.hash; + + Opal.add_stubs(['$include', '$attr_reader', '$+', '$attr_accessor', '$!', '$===', '$split', '$file', '$dir', '$dirname', '$path', '$basename', '$lineno', '$prepare_lines', '$drop', '$[]', '$normalize_lines_from_string', '$normalize_lines_array', '$empty?', '$nil_or_empty?', '$peek_line', '$>', '$slice', '$length', '$process_line', '$times', '$shift', '$read_line', '$<<', '$-', '$unshift_all', '$has_more_lines?', '$join', '$read_lines', '$unshift', '$start_with?', '$==', '$*', '$read_lines_until', '$size', '$clear', '$cursor', '$[]=', '$!=', '$fetch', '$cursor_at_mark', '$warn', '$logger', '$message_with_context', '$new', '$each', '$instance_variables', '$instance_variable_get', '$dup', '$instance_variable_set', '$to_i', '$attributes', '$<', '$catalog', '$skip_front_matter!', '$pop', '$adjust_indentation!', '$attr', '$end_with?', '$include?', '$=~', '$preprocess_conditional_directive', '$preprocess_include_directive', '$pop_include', '$downcase', '$error', '$none?', '$key?', '$any?', '$all?', '$strip', '$resolve_expr_val', '$send', '$to_sym', '$replace_next_line', '$rstrip', '$sub_attributes', '$attribute_missing', '$include_processors?', '$find', '$handles?', '$instance', '$process_method', '$parse_attributes', '$>=', '$safe', '$resolve_include_path', '$split_delimited_value', '$/', '$to_a', '$uniq', '$sort', '$open', '$each_line', '$infinite?', '$push_include', '$delete', '$value?', '$force_encoding', '$create_include_cursor', '$rindex', '$delete_at', '$nil?', '$keys', '$read', '$uriish?', '$attr?', '$require_library', '$parse', '$normalize_system_path', '$file?', '$relative_path', '$path_resolver', '$base_dir', '$to_s', '$path=', '$extname', '$rootname', '$<=', '$to_f', '$extensions?', '$extensions', '$include_processors', '$class', '$object_id', '$inspect', '$map']); + return (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + + (function($base, $super, $parent_nesting) { + function $Reader(){}; + var self = $Reader = $klass($base, $super, 'Reader', $Reader); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Reader_initialize_4, TMP_Reader_prepare_lines_5, TMP_Reader_process_line_6, TMP_Reader_has_more_lines$q_7, TMP_Reader_empty$q_8, TMP_Reader_next_line_empty$q_9, TMP_Reader_peek_line_10, TMP_Reader_peek_lines_11, TMP_Reader_read_line_13, TMP_Reader_read_lines_14, TMP_Reader_read_15, TMP_Reader_advance_16, TMP_Reader_unshift_line_17, TMP_Reader_unshift_lines_18, TMP_Reader_replace_next_line_19, TMP_Reader_skip_blank_lines_20, TMP_Reader_skip_comment_lines_21, TMP_Reader_skip_line_comments_22, TMP_Reader_terminate_23, TMP_Reader_read_lines_until_24, TMP_Reader_shift_25, TMP_Reader_unshift_26, TMP_Reader_unshift_all_27, TMP_Reader_cursor_28, TMP_Reader_cursor_at_line_29, TMP_Reader_cursor_at_mark_30, TMP_Reader_cursor_before_mark_31, TMP_Reader_cursor_at_prev_line_32, TMP_Reader_mark_33, TMP_Reader_line_info_34, TMP_Reader_lines_35, TMP_Reader_string_36, TMP_Reader_source_37, TMP_Reader_save_38, TMP_Reader_restore_save_40, TMP_Reader_discard_save_42; + + def.file = def.lines = def.process_lines = def.look_ahead = def.unescape_next_line = def.lineno = def.dir = def.path = def.mark = def.source_lines = def.saved = nil; + + self.$include($$($nesting, 'Logging')); + (function($base, $super, $parent_nesting) { + function $Cursor(){}; + var self = $Cursor = $klass($base, $super, 'Cursor', $Cursor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Cursor_initialize_1, TMP_Cursor_advance_2, TMP_Cursor_line_info_3; + + def.lineno = def.path = nil; + + self.$attr_reader("file", "dir", "path", "lineno"); + + Opal.def(self, '$initialize', TMP_Cursor_initialize_1 = function $$initialize(file, dir, path, lineno) { + var $a, self = this; + + + + if (dir == null) { + dir = nil; + }; + + if (path == null) { + path = nil; + }; + + if (lineno == null) { + lineno = 1; + }; + return $a = [file, dir, path, lineno], (self.file = $a[0]), (self.dir = $a[1]), (self.path = $a[2]), (self.lineno = $a[3]), $a; + }, TMP_Cursor_initialize_1.$$arity = -2); + + Opal.def(self, '$advance', TMP_Cursor_advance_2 = function $$advance(num) { + var self = this; + + return (self.lineno = $rb_plus(self.lineno, num)) + }, TMP_Cursor_advance_2.$$arity = 1); + + Opal.def(self, '$line_info', TMP_Cursor_line_info_3 = function $$line_info() { + var self = this; + + return "" + (self.path) + ": line " + (self.lineno) + }, TMP_Cursor_line_info_3.$$arity = 0); + return Opal.alias(self, "to_s", "line_info"); + })($nesting[0], null, $nesting); + self.$attr_reader("file"); + self.$attr_reader("dir"); + self.$attr_reader("path"); + self.$attr_reader("lineno"); + self.$attr_reader("source_lines"); + self.$attr_accessor("process_lines"); + self.$attr_accessor("unterminated"); + + Opal.def(self, '$initialize', TMP_Reader_initialize_4 = function $$initialize(data, cursor, opts) { + var $a, $b, self = this; + + + + if (data == null) { + data = nil; + }; + + if (cursor == null) { + cursor = nil; + }; + + if (opts == null) { + opts = $hash2([], {}); + }; + if ($truthy(cursor['$!']())) { + + self.file = nil; + self.dir = "."; + self.path = ""; + self.lineno = 1; + } else if ($truthy($$$('::', 'String')['$==='](cursor))) { + + self.file = cursor; + $b = $$$('::', 'File').$split(self.file), $a = Opal.to_ary($b), (self.dir = ($a[0] == null ? nil : $a[0])), (self.path = ($a[1] == null ? nil : $a[1])), $b; + self.lineno = 1; + } else { + + if ($truthy((self.file = cursor.$file()))) { + + self.dir = ($truthy($a = cursor.$dir()) ? $a : $$$('::', 'File').$dirname(self.file)); + self.path = ($truthy($a = cursor.$path()) ? $a : $$$('::', 'File').$basename(self.file)); + } else { + + self.dir = ($truthy($a = cursor.$dir()) ? $a : "."); + self.path = ($truthy($a = cursor.$path()) ? $a : ""); + }; + self.lineno = ($truthy($a = cursor.$lineno()) ? $a : 1); + }; + self.lines = (function() {if ($truthy(data)) { + + return self.$prepare_lines(data, opts); + } else { + return [] + }; return nil; })(); + self.source_lines = self.lines.$drop(0); + self.mark = nil; + self.look_ahead = 0; + self.process_lines = true; + self.unescape_next_line = false; + self.unterminated = nil; + return (self.saved = nil); + }, TMP_Reader_initialize_4.$$arity = -1); + + Opal.def(self, '$prepare_lines', TMP_Reader_prepare_lines_5 = function $$prepare_lines(data, opts) { + var self = this; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + if ($truthy($$$('::', 'String')['$==='](data))) { + if ($truthy(opts['$[]']("normalize"))) { + return $$($nesting, 'Helpers').$normalize_lines_from_string(data) + } else { + return data.$split($$($nesting, 'LF'), -1) + } + } else if ($truthy(opts['$[]']("normalize"))) { + return $$($nesting, 'Helpers').$normalize_lines_array(data) + } else { + return data.$drop(0) + }; + }, TMP_Reader_prepare_lines_5.$$arity = -2); + + Opal.def(self, '$process_line', TMP_Reader_process_line_6 = function $$process_line(line) { + var self = this; + + + if ($truthy(self.process_lines)) { + self.look_ahead = $rb_plus(self.look_ahead, 1)}; + return line; + }, TMP_Reader_process_line_6.$$arity = 1); + + Opal.def(self, '$has_more_lines?', TMP_Reader_has_more_lines$q_7 = function() { + var self = this; + + if ($truthy(self.lines['$empty?']())) { + + self.look_ahead = 0; + return false; + } else { + return true + } + }, TMP_Reader_has_more_lines$q_7.$$arity = 0); + + Opal.def(self, '$empty?', TMP_Reader_empty$q_8 = function() { + var self = this; + + if ($truthy(self.lines['$empty?']())) { + + self.look_ahead = 0; + return true; + } else { + return false + } + }, TMP_Reader_empty$q_8.$$arity = 0); + Opal.alias(self, "eof?", "empty?"); + + Opal.def(self, '$next_line_empty?', TMP_Reader_next_line_empty$q_9 = function() { + var self = this; + + return self.$peek_line()['$nil_or_empty?']() + }, TMP_Reader_next_line_empty$q_9.$$arity = 0); + + Opal.def(self, '$peek_line', TMP_Reader_peek_line_10 = function $$peek_line(direct) { + var $a, self = this, line = nil; + + + + if (direct == null) { + direct = false; + }; + if ($truthy(($truthy($a = direct) ? $a : $rb_gt(self.look_ahead, 0)))) { + if ($truthy(self.unescape_next_line)) { + + return (line = self.lines['$[]'](0)).$slice(1, line.$length()); + } else { + return self.lines['$[]'](0) + } + } else if ($truthy(self.lines['$empty?']())) { + + self.look_ahead = 0; + return nil; + } else if ($truthy((line = self.$process_line(self.lines['$[]'](0))))) { + return line + } else { + return self.$peek_line() + }; + }, TMP_Reader_peek_line_10.$$arity = -1); + + Opal.def(self, '$peek_lines', TMP_Reader_peek_lines_11 = function $$peek_lines(num, direct) { + var $a, TMP_12, self = this, old_look_ahead = nil, result = nil; + + + + if (num == null) { + num = nil; + }; + + if (direct == null) { + direct = false; + }; + old_look_ahead = self.look_ahead; + result = []; + (function(){var $brk = Opal.new_brk(); try {return $send(($truthy($a = num) ? $a : $$($nesting, 'MAX_INT')), 'times', [], (TMP_12 = function(){var self = TMP_12.$$s || this, line = nil; + if (self.lineno == null) self.lineno = nil; + + if ($truthy((line = (function() {if ($truthy(direct)) { + return self.$shift() + } else { + return self.$read_line() + }; return nil; })()))) { + return result['$<<'](line) + } else { + + if ($truthy(direct)) { + self.lineno = $rb_minus(self.lineno, 1)}; + + Opal.brk(nil, $brk); + }}, TMP_12.$$s = self, TMP_12.$$brk = $brk, TMP_12.$$arity = 0, TMP_12)) + } catch (err) { if (err === $brk) { return err.$v } else { throw err } }})(); + if ($truthy(result['$empty?']())) { + } else { + + self.$unshift_all(result); + if ($truthy(direct)) { + self.look_ahead = old_look_ahead}; + }; + return result; + }, TMP_Reader_peek_lines_11.$$arity = -1); + + Opal.def(self, '$read_line', TMP_Reader_read_line_13 = function $$read_line() { + var $a, self = this; + + if ($truthy(($truthy($a = $rb_gt(self.look_ahead, 0)) ? $a : self['$has_more_lines?']()))) { + return self.$shift() + } else { + return nil + } + }, TMP_Reader_read_line_13.$$arity = 0); + + Opal.def(self, '$read_lines', TMP_Reader_read_lines_14 = function $$read_lines() { + var $a, self = this, lines = nil; + + + lines = []; + while ($truthy(self['$has_more_lines?']())) { + lines['$<<'](self.$shift()) + }; + return lines; + }, TMP_Reader_read_lines_14.$$arity = 0); + Opal.alias(self, "readlines", "read_lines"); + + Opal.def(self, '$read', TMP_Reader_read_15 = function $$read() { + var self = this; + + return self.$read_lines().$join($$($nesting, 'LF')) + }, TMP_Reader_read_15.$$arity = 0); + + Opal.def(self, '$advance', TMP_Reader_advance_16 = function $$advance() { + var self = this; + + if ($truthy(self.$shift())) { + return true + } else { + return false + } + }, TMP_Reader_advance_16.$$arity = 0); + + Opal.def(self, '$unshift_line', TMP_Reader_unshift_line_17 = function $$unshift_line(line_to_restore) { + var self = this; + + + self.$unshift(line_to_restore); + return nil; + }, TMP_Reader_unshift_line_17.$$arity = 1); + Opal.alias(self, "restore_line", "unshift_line"); + + Opal.def(self, '$unshift_lines', TMP_Reader_unshift_lines_18 = function $$unshift_lines(lines_to_restore) { + var self = this; + + + self.$unshift_all(lines_to_restore); + return nil; + }, TMP_Reader_unshift_lines_18.$$arity = 1); + Opal.alias(self, "restore_lines", "unshift_lines"); + + Opal.def(self, '$replace_next_line', TMP_Reader_replace_next_line_19 = function $$replace_next_line(replacement) { + var self = this; + + + self.$shift(); + self.$unshift(replacement); + return true; + }, TMP_Reader_replace_next_line_19.$$arity = 1); + Opal.alias(self, "replace_line", "replace_next_line"); + + Opal.def(self, '$skip_blank_lines', TMP_Reader_skip_blank_lines_20 = function $$skip_blank_lines() { + var $a, self = this, num_skipped = nil, next_line = nil; + + + if ($truthy(self['$empty?']())) { + return nil}; + num_skipped = 0; + while ($truthy((next_line = self.$peek_line()))) { + if ($truthy(next_line['$empty?']())) { + + self.$shift(); + num_skipped = $rb_plus(num_skipped, 1); + } else { + return num_skipped + } + }; + }, TMP_Reader_skip_blank_lines_20.$$arity = 0); + + Opal.def(self, '$skip_comment_lines', TMP_Reader_skip_comment_lines_21 = function $$skip_comment_lines() { + var $a, $b, self = this, next_line = nil, ll = nil; + + + if ($truthy(self['$empty?']())) { + return nil}; + while ($truthy(($truthy($b = (next_line = self.$peek_line())) ? next_line['$empty?']()['$!']() : $b))) { + if ($truthy(next_line['$start_with?']("//"))) { + if ($truthy(next_line['$start_with?']("///"))) { + if ($truthy(($truthy($b = $rb_gt((ll = next_line.$length()), 3)) ? next_line['$==']($rb_times("/", ll)) : $b))) { + self.$read_lines_until($hash2(["terminator", "skip_first_line", "read_last_line", "skip_processing", "context"], {"terminator": next_line, "skip_first_line": true, "read_last_line": true, "skip_processing": true, "context": "comment"})) + } else { + break; + } + } else { + self.$shift() + } + } else { + break; + } + }; + return nil; + }, TMP_Reader_skip_comment_lines_21.$$arity = 0); + + Opal.def(self, '$skip_line_comments', TMP_Reader_skip_line_comments_22 = function $$skip_line_comments() { + var $a, $b, self = this, comment_lines = nil, next_line = nil; + + + if ($truthy(self['$empty?']())) { + return []}; + comment_lines = []; + while ($truthy(($truthy($b = (next_line = self.$peek_line())) ? next_line['$empty?']()['$!']() : $b))) { + if ($truthy(next_line['$start_with?']("//"))) { + comment_lines['$<<'](self.$shift()) + } else { + break; + } + }; + return comment_lines; + }, TMP_Reader_skip_line_comments_22.$$arity = 0); + + Opal.def(self, '$terminate', TMP_Reader_terminate_23 = function $$terminate() { + var self = this; + + + self.lineno = $rb_plus(self.lineno, self.lines.$size()); + self.lines.$clear(); + self.look_ahead = 0; + return nil; + }, TMP_Reader_terminate_23.$$arity = 0); + + Opal.def(self, '$read_lines_until', TMP_Reader_read_lines_until_24 = function $$read_lines_until(options) { + var $a, $b, $c, $d, $iter = TMP_Reader_read_lines_until_24.$$p, $yield = $iter || nil, self = this, result = nil, restore_process_lines = nil, terminator = nil, start_cursor = nil, break_on_blank_lines = nil, break_on_list_continuation = nil, skip_comments = nil, complete = nil, line_read = nil, line_restored = nil, line = nil, $writer = nil, context = nil; + + if ($iter) TMP_Reader_read_lines_until_24.$$p = null; + + + if (options == null) { + options = $hash2([], {}); + }; + result = []; + if ($truthy(($truthy($a = self.process_lines) ? options['$[]']("skip_processing") : $a))) { + + self.process_lines = false; + restore_process_lines = true;}; + if ($truthy((terminator = options['$[]']("terminator")))) { + + start_cursor = ($truthy($a = options['$[]']("cursor")) ? $a : self.$cursor()); + break_on_blank_lines = false; + break_on_list_continuation = false; + } else { + + break_on_blank_lines = options['$[]']("break_on_blank_lines"); + break_on_list_continuation = options['$[]']("break_on_list_continuation"); + }; + skip_comments = options['$[]']("skip_line_comments"); + complete = (line_read = (line_restored = nil)); + if ($truthy(options['$[]']("skip_first_line"))) { + self.$shift()}; + while ($truthy(($truthy($b = complete['$!']()) ? (line = self.$read_line()) : $b))) { + + complete = (function() {while ($truthy(true)) { + + if ($truthy(($truthy($c = terminator) ? line['$=='](terminator) : $c))) { + return true}; + if ($truthy(($truthy($c = break_on_blank_lines) ? line['$empty?']() : $c))) { + return true}; + if ($truthy(($truthy($c = ($truthy($d = break_on_list_continuation) ? line_read : $d)) ? line['$==']($$($nesting, 'LIST_CONTINUATION')) : $c))) { + + + $writer = ["preserve_last_line", true]; + $send(options, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + return true;}; + if ($truthy((($c = ($yield !== nil)) ? Opal.yield1($yield, line) : ($yield !== nil)))) { + return true}; + return false; + }; return nil; })(); + if ($truthy(complete)) { + + if ($truthy(options['$[]']("read_last_line"))) { + + result['$<<'](line); + line_read = true;}; + if ($truthy(options['$[]']("preserve_last_line"))) { + + self.$unshift(line); + line_restored = true;}; + } else if ($truthy(($truthy($b = ($truthy($c = skip_comments) ? line['$start_with?']("//") : $c)) ? line['$start_with?']("///")['$!']() : $b))) { + } else { + + result['$<<'](line); + line_read = true; + }; + }; + if ($truthy(restore_process_lines)) { + + self.process_lines = true; + if ($truthy(($truthy($a = line_restored) ? terminator['$!']() : $a))) { + self.look_ahead = $rb_minus(self.look_ahead, 1)};}; + if ($truthy(($truthy($a = ($truthy($b = terminator) ? terminator['$!='](line) : $b)) ? (context = options.$fetch("context", terminator)) : $a))) { + + if (start_cursor['$==']("at_mark")) { + start_cursor = self.$cursor_at_mark()}; + self.$logger().$warn(self.$message_with_context("" + "unterminated " + (context) + " block", $hash2(["source_location"], {"source_location": start_cursor}))); + self.unterminated = true;}; + return result; + }, TMP_Reader_read_lines_until_24.$$arity = -1); + + Opal.def(self, '$shift', TMP_Reader_shift_25 = function $$shift() { + var self = this; + + + self.lineno = $rb_plus(self.lineno, 1); + if (self.look_ahead['$=='](0)) { + } else { + self.look_ahead = $rb_minus(self.look_ahead, 1) + }; + return self.lines.$shift(); + }, TMP_Reader_shift_25.$$arity = 0); + + Opal.def(self, '$unshift', TMP_Reader_unshift_26 = function $$unshift(line) { + var self = this; + + + self.lineno = $rb_minus(self.lineno, 1); + self.look_ahead = $rb_plus(self.look_ahead, 1); + return self.lines.$unshift(line); + }, TMP_Reader_unshift_26.$$arity = 1); + + Opal.def(self, '$unshift_all', TMP_Reader_unshift_all_27 = function $$unshift_all(lines) { + var self = this; + + + self.lineno = $rb_minus(self.lineno, lines.$size()); + self.look_ahead = $rb_plus(self.look_ahead, lines.$size()); + return $send(self.lines, 'unshift', Opal.to_a(lines)); + }, TMP_Reader_unshift_all_27.$$arity = 1); + + Opal.def(self, '$cursor', TMP_Reader_cursor_28 = function $$cursor() { + var self = this; + + return $$($nesting, 'Cursor').$new(self.file, self.dir, self.path, self.lineno) + }, TMP_Reader_cursor_28.$$arity = 0); + + Opal.def(self, '$cursor_at_line', TMP_Reader_cursor_at_line_29 = function $$cursor_at_line(lineno) { + var self = this; + + return $$($nesting, 'Cursor').$new(self.file, self.dir, self.path, lineno) + }, TMP_Reader_cursor_at_line_29.$$arity = 1); + + Opal.def(self, '$cursor_at_mark', TMP_Reader_cursor_at_mark_30 = function $$cursor_at_mark() { + var self = this; + + if ($truthy(self.mark)) { + return $send($$($nesting, 'Cursor'), 'new', Opal.to_a(self.mark)) + } else { + return self.$cursor() + } + }, TMP_Reader_cursor_at_mark_30.$$arity = 0); + + Opal.def(self, '$cursor_before_mark', TMP_Reader_cursor_before_mark_31 = function $$cursor_before_mark() { + var $a, $b, self = this, m_file = nil, m_dir = nil, m_path = nil, m_lineno = nil; + + if ($truthy(self.mark)) { + + $b = self.mark, $a = Opal.to_ary($b), (m_file = ($a[0] == null ? nil : $a[0])), (m_dir = ($a[1] == null ? nil : $a[1])), (m_path = ($a[2] == null ? nil : $a[2])), (m_lineno = ($a[3] == null ? nil : $a[3])), $b; + return $$($nesting, 'Cursor').$new(m_file, m_dir, m_path, $rb_minus(m_lineno, 1)); + } else { + return $$($nesting, 'Cursor').$new(self.file, self.dir, self.path, $rb_minus(self.lineno, 1)) + } + }, TMP_Reader_cursor_before_mark_31.$$arity = 0); + + Opal.def(self, '$cursor_at_prev_line', TMP_Reader_cursor_at_prev_line_32 = function $$cursor_at_prev_line() { + var self = this; + + return $$($nesting, 'Cursor').$new(self.file, self.dir, self.path, $rb_minus(self.lineno, 1)) + }, TMP_Reader_cursor_at_prev_line_32.$$arity = 0); + + Opal.def(self, '$mark', TMP_Reader_mark_33 = function $$mark() { + var self = this; + + return (self.mark = [self.file, self.dir, self.path, self.lineno]) + }, TMP_Reader_mark_33.$$arity = 0); + + Opal.def(self, '$line_info', TMP_Reader_line_info_34 = function $$line_info() { + var self = this; + + return "" + (self.path) + ": line " + (self.lineno) + }, TMP_Reader_line_info_34.$$arity = 0); + + Opal.def(self, '$lines', TMP_Reader_lines_35 = function $$lines() { + var self = this; + + return self.lines.$drop(0) + }, TMP_Reader_lines_35.$$arity = 0); + + Opal.def(self, '$string', TMP_Reader_string_36 = function $$string() { + var self = this; + + return self.lines.$join($$($nesting, 'LF')) + }, TMP_Reader_string_36.$$arity = 0); + + Opal.def(self, '$source', TMP_Reader_source_37 = function $$source() { + var self = this; + + return self.source_lines.$join($$($nesting, 'LF')) + }, TMP_Reader_source_37.$$arity = 0); + + Opal.def(self, '$save', TMP_Reader_save_38 = function $$save() { + var TMP_39, self = this, accum = nil; + + + accum = $hash2([], {}); + $send(self.$instance_variables(), 'each', [], (TMP_39 = function(name){var self = TMP_39.$$s || this, $a, $writer = nil, val = nil; + + + + if (name == null) { + name = nil; + }; + if ($truthy(($truthy($a = name['$==']("@saved")) ? $a : name['$==']("@source_lines")))) { + return nil + } else { + + $writer = [name, (function() {if ($truthy($$$('::', 'Array')['$===']((val = self.$instance_variable_get(name))))) { + return val.$dup() + } else { + return val + }; return nil; })()]; + $send(accum, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + };}, TMP_39.$$s = self, TMP_39.$$arity = 1, TMP_39)); + self.saved = accum; + return nil; + }, TMP_Reader_save_38.$$arity = 0); + + Opal.def(self, '$restore_save', TMP_Reader_restore_save_40 = function $$restore_save() { + var TMP_41, self = this; + + if ($truthy(self.saved)) { + + $send(self.saved, 'each', [], (TMP_41 = function(name, val){var self = TMP_41.$$s || this; + + + + if (name == null) { + name = nil; + }; + + if (val == null) { + val = nil; + }; + return self.$instance_variable_set(name, val);}, TMP_41.$$s = self, TMP_41.$$arity = 2, TMP_41)); + return (self.saved = nil); + } else { + return nil + } + }, TMP_Reader_restore_save_40.$$arity = 0); + + Opal.def(self, '$discard_save', TMP_Reader_discard_save_42 = function $$discard_save() { + var self = this; + + return (self.saved = nil) + }, TMP_Reader_discard_save_42.$$arity = 0); + return Opal.alias(self, "to_s", "line_info"); + })($nesting[0], null, $nesting); + (function($base, $super, $parent_nesting) { + function $PreprocessorReader(){}; + var self = $PreprocessorReader = $klass($base, $super, 'PreprocessorReader', $PreprocessorReader); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_PreprocessorReader_initialize_43, TMP_PreprocessorReader_prepare_lines_44, TMP_PreprocessorReader_process_line_45, TMP_PreprocessorReader_has_more_lines$q_46, TMP_PreprocessorReader_empty$q_47, TMP_PreprocessorReader_peek_line_48, TMP_PreprocessorReader_preprocess_conditional_directive_49, TMP_PreprocessorReader_preprocess_include_directive_54, TMP_PreprocessorReader_resolve_include_path_66, TMP_PreprocessorReader_push_include_67, TMP_PreprocessorReader_create_include_cursor_68, TMP_PreprocessorReader_pop_include_69, TMP_PreprocessorReader_include_depth_70, TMP_PreprocessorReader_exceeded_max_depth$q_71, TMP_PreprocessorReader_shift_72, TMP_PreprocessorReader_split_delimited_value_73, TMP_PreprocessorReader_skip_front_matter$B_74, TMP_PreprocessorReader_resolve_expr_val_75, TMP_PreprocessorReader_include_processors$q_76, TMP_PreprocessorReader_to_s_77; + + def.document = def.lineno = def.process_lines = def.look_ahead = def.skipping = def.include_stack = def.conditional_stack = def.path = def.include_processor_extensions = def.maxdepth = def.dir = def.lines = def.file = def.includes = def.unescape_next_line = nil; + + self.$attr_reader("include_stack"); + + Opal.def(self, '$initialize', TMP_PreprocessorReader_initialize_43 = function $$initialize(document, data, cursor, opts) { + var $iter = TMP_PreprocessorReader_initialize_43.$$p, $yield = $iter || nil, self = this, include_depth_default = nil; + + if ($iter) TMP_PreprocessorReader_initialize_43.$$p = null; + + + if (data == null) { + data = nil; + }; + + if (cursor == null) { + cursor = nil; + }; + + if (opts == null) { + opts = $hash2([], {}); + }; + self.document = document; + $send(self, Opal.find_super_dispatcher(self, 'initialize', TMP_PreprocessorReader_initialize_43, false), [data, cursor, opts], null); + include_depth_default = document.$attributes().$fetch("max-include-depth", 64).$to_i(); + if ($truthy($rb_lt(include_depth_default, 0))) { + include_depth_default = 0}; + self.maxdepth = $hash2(["abs", "rel"], {"abs": include_depth_default, "rel": include_depth_default}); + self.include_stack = []; + self.includes = document.$catalog()['$[]']("includes"); + self.skipping = false; + self.conditional_stack = []; + return (self.include_processor_extensions = nil); + }, TMP_PreprocessorReader_initialize_43.$$arity = -2); + + Opal.def(self, '$prepare_lines', TMP_PreprocessorReader_prepare_lines_44 = function $$prepare_lines(data, opts) { + var $a, $b, $iter = TMP_PreprocessorReader_prepare_lines_44.$$p, $yield = $iter || nil, self = this, result = nil, front_matter = nil, $writer = nil, first = nil, last = nil, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_PreprocessorReader_prepare_lines_44.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + + + if (opts == null) { + opts = $hash2([], {}); + }; + result = $send(self, Opal.find_super_dispatcher(self, 'prepare_lines', TMP_PreprocessorReader_prepare_lines_44, false), $zuper, $iter); + if ($truthy(($truthy($a = self.document) ? self.document.$attributes()['$[]']("skip-front-matter") : $a))) { + if ($truthy((front_matter = self['$skip_front_matter!'](result)))) { + + $writer = ["front-matter", front_matter.$join($$($nesting, 'LF'))]; + $send(self.document.$attributes(), '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}}; + if ($truthy(opts.$fetch("condense", true))) { + + while ($truthy(($truthy($b = (first = result['$[]'](0))) ? first['$empty?']() : $b))) { + ($truthy($b = result.$shift()) ? (self.lineno = $rb_plus(self.lineno, 1)) : $b) + }; + while ($truthy(($truthy($b = (last = result['$[]'](-1))) ? last['$empty?']() : $b))) { + result.$pop() + };}; + if ($truthy(opts['$[]']("indent"))) { + $$($nesting, 'Parser')['$adjust_indentation!'](result, opts['$[]']("indent"), self.document.$attr("tabsize"))}; + return result; + }, TMP_PreprocessorReader_prepare_lines_44.$$arity = -2); + + Opal.def(self, '$process_line', TMP_PreprocessorReader_process_line_45 = function $$process_line(line) { + var $a, $b, self = this; + + + if ($truthy(self.process_lines)) { + } else { + return line + }; + if ($truthy(line['$empty?']())) { + + self.look_ahead = $rb_plus(self.look_ahead, 1); + return line;}; + if ($truthy(($truthy($a = ($truthy($b = line['$end_with?']("]")) ? line['$start_with?']("[")['$!']() : $b)) ? line['$include?']("::") : $a))) { + if ($truthy(($truthy($a = line['$include?']("if")) ? $$($nesting, 'ConditionalDirectiveRx')['$=~'](line) : $a))) { + if ((($a = $gvars['~']) === nil ? nil : $a['$[]'](1))['$==']("\\")) { + + self.unescape_next_line = true; + self.look_ahead = $rb_plus(self.look_ahead, 1); + return line.$slice(1, line.$length()); + } else if ($truthy(self.$preprocess_conditional_directive((($a = $gvars['~']) === nil ? nil : $a['$[]'](2)), (($a = $gvars['~']) === nil ? nil : $a['$[]'](3)), (($a = $gvars['~']) === nil ? nil : $a['$[]'](4)), (($a = $gvars['~']) === nil ? nil : $a['$[]'](5))))) { + + self.$shift(); + return nil; + } else { + + self.look_ahead = $rb_plus(self.look_ahead, 1); + return line; + } + } else if ($truthy(self.skipping)) { + + self.$shift(); + return nil; + } else if ($truthy(($truthy($a = line['$start_with?']("inc", "\\inc")) ? $$($nesting, 'IncludeDirectiveRx')['$=~'](line) : $a))) { + if ((($a = $gvars['~']) === nil ? nil : $a['$[]'](1))['$==']("\\")) { + + self.unescape_next_line = true; + self.look_ahead = $rb_plus(self.look_ahead, 1); + return line.$slice(1, line.$length()); + } else if ($truthy(self.$preprocess_include_directive((($a = $gvars['~']) === nil ? nil : $a['$[]'](2)), (($a = $gvars['~']) === nil ? nil : $a['$[]'](3))))) { + return nil + } else { + + self.look_ahead = $rb_plus(self.look_ahead, 1); + return line; + } + } else { + + self.look_ahead = $rb_plus(self.look_ahead, 1); + return line; + } + } else if ($truthy(self.skipping)) { + + self.$shift(); + return nil; + } else { + + self.look_ahead = $rb_plus(self.look_ahead, 1); + return line; + }; + }, TMP_PreprocessorReader_process_line_45.$$arity = 1); + + Opal.def(self, '$has_more_lines?', TMP_PreprocessorReader_has_more_lines$q_46 = function() { + var self = this; + + if ($truthy(self.$peek_line())) { + return true + } else { + return false + } + }, TMP_PreprocessorReader_has_more_lines$q_46.$$arity = 0); + + Opal.def(self, '$empty?', TMP_PreprocessorReader_empty$q_47 = function() { + var self = this; + + if ($truthy(self.$peek_line())) { + return false + } else { + return true + } + }, TMP_PreprocessorReader_empty$q_47.$$arity = 0); + Opal.alias(self, "eof?", "empty?"); + + Opal.def(self, '$peek_line', TMP_PreprocessorReader_peek_line_48 = function $$peek_line(direct) { + var $iter = TMP_PreprocessorReader_peek_line_48.$$p, $yield = $iter || nil, self = this, line = nil, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_PreprocessorReader_peek_line_48.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + + + if (direct == null) { + direct = false; + }; + if ($truthy((line = $send(self, Opal.find_super_dispatcher(self, 'peek_line', TMP_PreprocessorReader_peek_line_48, false), $zuper, $iter)))) { + return line + } else if ($truthy(self.include_stack['$empty?']())) { + return nil + } else { + + self.$pop_include(); + return self.$peek_line(direct); + }; + }, TMP_PreprocessorReader_peek_line_48.$$arity = -1); + + Opal.def(self, '$preprocess_conditional_directive', TMP_PreprocessorReader_preprocess_conditional_directive_49 = function $$preprocess_conditional_directive(keyword, target, delimiter, text) { + var $a, $b, $c, TMP_50, TMP_51, TMP_52, TMP_53, self = this, no_target = nil, pair = nil, skip = nil, $case = nil, lhs = nil, op = nil, rhs = nil; + + + if ($truthy((no_target = target['$empty?']()))) { + } else { + target = target.$downcase() + }; + if ($truthy(($truthy($a = ($truthy($b = no_target) ? ($truthy($c = keyword['$==']("ifdef")) ? $c : keyword['$==']("ifndef")) : $b)) ? $a : ($truthy($b = text) ? keyword['$==']("endif") : $b)))) { + return false}; + if (keyword['$==']("endif")) { + + if ($truthy(self.conditional_stack['$empty?']())) { + self.$logger().$error(self.$message_with_context("" + "unmatched macro: endif::" + (target) + "[]", $hash2(["source_location"], {"source_location": self.$cursor()}))) + } else if ($truthy(($truthy($a = no_target) ? $a : target['$==']((pair = self.conditional_stack['$[]'](-1))['$[]']("target"))))) { + + self.conditional_stack.$pop(); + self.skipping = (function() {if ($truthy(self.conditional_stack['$empty?']())) { + return false + } else { + return self.conditional_stack['$[]'](-1)['$[]']("skipping") + }; return nil; })(); + } else { + self.$logger().$error(self.$message_with_context("" + "mismatched macro: endif::" + (target) + "[], expected endif::" + (pair['$[]']("target")) + "[]", $hash2(["source_location"], {"source_location": self.$cursor()}))) + }; + return true;}; + if ($truthy(self.skipping)) { + skip = false + } else { + $case = keyword; + if ("ifdef"['$===']($case)) {$case = delimiter; + if (","['$===']($case)) {skip = $send(target.$split(",", -1), 'none?', [], (TMP_50 = function(name){var self = TMP_50.$$s || this; + if (self.document == null) self.document = nil; + + + + if (name == null) { + name = nil; + }; + return self.document.$attributes()['$key?'](name);}, TMP_50.$$s = self, TMP_50.$$arity = 1, TMP_50))} + else if ("+"['$===']($case)) {skip = $send(target.$split("+", -1), 'any?', [], (TMP_51 = function(name){var self = TMP_51.$$s || this; + if (self.document == null) self.document = nil; + + + + if (name == null) { + name = nil; + }; + return self.document.$attributes()['$key?'](name)['$!']();}, TMP_51.$$s = self, TMP_51.$$arity = 1, TMP_51))} + else {skip = self.document.$attributes()['$key?'](target)['$!']()}} + else if ("ifndef"['$===']($case)) {$case = delimiter; + if (","['$===']($case)) {skip = $send(target.$split(",", -1), 'any?', [], (TMP_52 = function(name){var self = TMP_52.$$s || this; + if (self.document == null) self.document = nil; + + + + if (name == null) { + name = nil; + }; + return self.document.$attributes()['$key?'](name);}, TMP_52.$$s = self, TMP_52.$$arity = 1, TMP_52))} + else if ("+"['$===']($case)) {skip = $send(target.$split("+", -1), 'all?', [], (TMP_53 = function(name){var self = TMP_53.$$s || this; + if (self.document == null) self.document = nil; + + + + if (name == null) { + name = nil; + }; + return self.document.$attributes()['$key?'](name);}, TMP_53.$$s = self, TMP_53.$$arity = 1, TMP_53))} + else {skip = self.document.$attributes()['$key?'](target)}} + else if ("ifeval"['$===']($case)) { + if ($truthy(($truthy($a = no_target) ? $$($nesting, 'EvalExpressionRx')['$=~'](text.$strip()) : $a))) { + } else { + return false + }; + $a = [(($b = $gvars['~']) === nil ? nil : $b['$[]'](1)), (($b = $gvars['~']) === nil ? nil : $b['$[]'](2)), (($b = $gvars['~']) === nil ? nil : $b['$[]'](3))], (lhs = $a[0]), (op = $a[1]), (rhs = $a[2]), $a; + lhs = self.$resolve_expr_val(lhs); + rhs = self.$resolve_expr_val(rhs); + if (op['$==']("!=")) { + skip = lhs.$send("==", rhs) + } else { + skip = lhs.$send(op.$to_sym(), rhs)['$!']() + };} + }; + if ($truthy(($truthy($a = keyword['$==']("ifeval")) ? $a : text['$!']()))) { + + if ($truthy(skip)) { + self.skipping = true}; + self.conditional_stack['$<<']($hash2(["target", "skip", "skipping"], {"target": target, "skip": skip, "skipping": self.skipping})); + } else if ($truthy(($truthy($a = self.skipping) ? $a : skip))) { + } else { + + self.$replace_next_line(text.$rstrip()); + self.$unshift(""); + if ($truthy(text['$start_with?']("include::"))) { + self.look_ahead = $rb_minus(self.look_ahead, 1)}; + }; + return true; + }, TMP_PreprocessorReader_preprocess_conditional_directive_49.$$arity = 4); + + Opal.def(self, '$preprocess_include_directive', TMP_PreprocessorReader_preprocess_include_directive_54 = function $$preprocess_include_directive(target, attrlist) { + var $a, TMP_55, $b, TMP_56, TMP_57, TMP_58, TMP_60, TMP_63, TMP_64, TMP_65, self = this, doc = nil, expanded_target = nil, ext = nil, abs_maxdepth = nil, parsed_attrs = nil, inc_path = nil, target_type = nil, relpath = nil, inc_linenos = nil, inc_tags = nil, tag = nil, inc_lines = nil, inc_offset = nil, inc_lineno = nil, $writer = nil, tag_stack = nil, tags_used = nil, active_tag = nil, select = nil, base_select = nil, wildcard = nil, missing_tags = nil, inc_content = nil; + + + doc = self.document; + if ($truthy(($truthy($a = (expanded_target = target)['$include?']($$($nesting, 'ATTR_REF_HEAD'))) ? (expanded_target = doc.$sub_attributes(target, $hash2(["attribute_missing"], {"attribute_missing": "drop-line"})))['$empty?']() : $a))) { + + self.$shift(); + if (($truthy($a = doc.$attributes()['$[]']("attribute-missing")) ? $a : $$($nesting, 'Compliance').$attribute_missing())['$==']("skip")) { + self.$unshift("" + "Unresolved directive in " + (self.path) + " - include::" + (target) + "[" + (attrlist) + "]")}; + return true; + } else if ($truthy(($truthy($a = self['$include_processors?']()) ? (ext = $send(self.include_processor_extensions, 'find', [], (TMP_55 = function(candidate){var self = TMP_55.$$s || this; + + + + if (candidate == null) { + candidate = nil; + }; + return candidate.$instance()['$handles?'](expanded_target);}, TMP_55.$$s = self, TMP_55.$$arity = 1, TMP_55))) : $a))) { + + self.$shift(); + ext.$process_method()['$[]'](doc, self, expanded_target, doc.$parse_attributes(attrlist, [], $hash2(["sub_input"], {"sub_input": true}))); + return true; + } else if ($truthy($rb_ge(doc.$safe(), $$$($$($nesting, 'SafeMode'), 'SECURE')))) { + return self.$replace_next_line("" + "link:" + (expanded_target) + "[]") + } else if ($truthy($rb_gt((abs_maxdepth = self.maxdepth['$[]']("abs")), 0))) { + + if ($truthy($rb_ge(self.include_stack.$size(), abs_maxdepth))) { + + self.$logger().$error(self.$message_with_context("" + "maximum include depth of " + (self.maxdepth['$[]']("rel")) + " exceeded", $hash2(["source_location"], {"source_location": self.$cursor()}))); + return nil;}; + parsed_attrs = doc.$parse_attributes(attrlist, [], $hash2(["sub_input"], {"sub_input": true})); + $b = self.$resolve_include_path(expanded_target, attrlist, parsed_attrs), $a = Opal.to_ary($b), (inc_path = ($a[0] == null ? nil : $a[0])), (target_type = ($a[1] == null ? nil : $a[1])), (relpath = ($a[2] == null ? nil : $a[2])), $b; + if ($truthy(target_type)) { + } else { + return inc_path + }; + inc_linenos = (inc_tags = nil); + if ($truthy(attrlist)) { + if ($truthy(parsed_attrs['$key?']("lines"))) { + + inc_linenos = []; + $send(self.$split_delimited_value(parsed_attrs['$[]']("lines")), 'each', [], (TMP_56 = function(linedef){var self = TMP_56.$$s || this, $c, $d, from = nil, to = nil; + + + + if (linedef == null) { + linedef = nil; + }; + if ($truthy(linedef['$include?'](".."))) { + + $d = linedef.$split("..", 2), $c = Opal.to_ary($d), (from = ($c[0] == null ? nil : $c[0])), (to = ($c[1] == null ? nil : $c[1])), $d; + return (inc_linenos = $rb_plus(inc_linenos, (function() {if ($truthy(($truthy($c = to['$empty?']()) ? $c : $rb_lt((to = to.$to_i()), 0)))) { + return [from.$to_i(), $rb_divide(1, 0)] + } else { + return $$$('::', 'Range').$new(from.$to_i(), to).$to_a() + }; return nil; })())); + } else { + return inc_linenos['$<<'](linedef.$to_i()) + };}, TMP_56.$$s = self, TMP_56.$$arity = 1, TMP_56)); + inc_linenos = (function() {if ($truthy(inc_linenos['$empty?']())) { + return nil + } else { + return inc_linenos.$sort().$uniq() + }; return nil; })(); + } else if ($truthy(parsed_attrs['$key?']("tag"))) { + if ($truthy(($truthy($a = (tag = parsed_attrs['$[]']("tag"))['$empty?']()) ? $a : tag['$==']("!")))) { + } else { + inc_tags = (function() {if ($truthy(tag['$start_with?']("!"))) { + return $hash(tag.$slice(1, tag.$length()), false) + } else { + return $hash(tag, true) + }; return nil; })() + } + } else if ($truthy(parsed_attrs['$key?']("tags"))) { + + inc_tags = $hash2([], {}); + $send(self.$split_delimited_value(parsed_attrs['$[]']("tags")), 'each', [], (TMP_57 = function(tagdef){var self = TMP_57.$$s || this, $c, $writer = nil; + + + + if (tagdef == null) { + tagdef = nil; + }; + if ($truthy(($truthy($c = tagdef['$empty?']()) ? $c : tagdef['$==']("!")))) { + return nil + } else if ($truthy(tagdef['$start_with?']("!"))) { + + $writer = [tagdef.$slice(1, tagdef.$length()), false]; + $send(inc_tags, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + } else { + + $writer = [tagdef, true]; + $send(inc_tags, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + };}, TMP_57.$$s = self, TMP_57.$$arity = 1, TMP_57)); + if ($truthy(inc_tags['$empty?']())) { + inc_tags = nil};}}; + if ($truthy(inc_linenos)) { + + $a = [[], nil, 0], (inc_lines = $a[0]), (inc_offset = $a[1]), (inc_lineno = $a[2]), $a; + + try { + (function(){var $brk = Opal.new_brk(); try {return $send(self, 'open', [inc_path, "rb"], (TMP_58 = function(f){var self = TMP_58.$$s || this, TMP_59, select_remaining = nil; + + + + if (f == null) { + f = nil; + }; + select_remaining = nil; + return (function(){var $brk = Opal.new_brk(); try {return $send(f, 'each_line', [], (TMP_59 = function(l){var self = TMP_59.$$s || this, $c, $d, select = nil; + + + + if (l == null) { + l = nil; + }; + inc_lineno = $rb_plus(inc_lineno, 1); + if ($truthy(($truthy($c = select_remaining) ? $c : ($truthy($d = $$$('::', 'Float')['$===']((select = inc_linenos['$[]'](0)))) ? (select_remaining = select['$infinite?']()) : $d)))) { + + inc_offset = ($truthy($c = inc_offset) ? $c : inc_lineno); + return inc_lines['$<<'](l); + } else { + + if (select['$=='](inc_lineno)) { + + inc_offset = ($truthy($c = inc_offset) ? $c : inc_lineno); + inc_lines['$<<'](l); + inc_linenos.$shift();}; + if ($truthy(inc_linenos['$empty?']())) { + + Opal.brk(nil, $brk) + } else { + return nil + }; + };}, TMP_59.$$s = self, TMP_59.$$brk = $brk, TMP_59.$$arity = 1, TMP_59)) + } catch (err) { if (err === $brk) { return err.$v } else { throw err } }})();}, TMP_58.$$s = self, TMP_58.$$brk = $brk, TMP_58.$$arity = 1, TMP_58)) + } catch (err) { if (err === $brk) { return err.$v } else { throw err } }})() + } catch ($err) { + if (Opal.rescue($err, [$$($nesting, 'StandardError')])) { + try { + + self.$logger().$error(self.$message_with_context("" + "include " + (target_type) + " not readable: " + (inc_path), $hash2(["source_location"], {"source_location": self.$cursor()}))); + return self.$replace_next_line("" + "Unresolved directive in " + (self.path) + " - include::" + (expanded_target) + "[" + (attrlist) + "]"); + } finally { Opal.pop_exception() } + } else { throw $err; } + };; + self.$shift(); + if ($truthy(inc_offset)) { + + + $writer = ["partial-option", true]; + $send(parsed_attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + self.$push_include(inc_lines, inc_path, relpath, inc_offset, parsed_attrs);}; + } else if ($truthy(inc_tags)) { + + $a = [[], nil, 0, [], $$$('::', 'Set').$new(), nil], (inc_lines = $a[0]), (inc_offset = $a[1]), (inc_lineno = $a[2]), (tag_stack = $a[3]), (tags_used = $a[4]), (active_tag = $a[5]), $a; + if ($truthy(inc_tags['$key?']("**"))) { + if ($truthy(inc_tags['$key?']("*"))) { + + select = (base_select = inc_tags.$delete("**")); + wildcard = inc_tags.$delete("*"); + } else { + select = (base_select = (wildcard = inc_tags.$delete("**"))) + } + } else { + + select = (base_select = inc_tags['$value?'](true)['$!']()); + wildcard = inc_tags.$delete("*"); + }; + + try { + $send(self, 'open', [inc_path, "rb"], (TMP_60 = function(f){var self = TMP_60.$$s || this, $c, TMP_61, dbl_co = nil, dbl_sb = nil, encoding = nil; + + + + if (f == null) { + f = nil; + }; + $c = ["::", "[]"], (dbl_co = $c[0]), (dbl_sb = $c[1]), $c; + if ($truthy($$($nesting, 'COERCE_ENCODING'))) { + encoding = $$$($$$('::', 'Encoding'), 'UTF_8')}; + return $send(f, 'each_line', [], (TMP_61 = function(l){var self = TMP_61.$$s || this, $d, $e, TMP_62, this_tag = nil, include_cursor = nil, idx = nil; + + + + if (l == null) { + l = nil; + }; + inc_lineno = $rb_plus(inc_lineno, 1); + if ($truthy(encoding)) { + l.$force_encoding(encoding)}; + if ($truthy(($truthy($d = ($truthy($e = l['$include?'](dbl_co)) ? l['$include?'](dbl_sb) : $e)) ? $$($nesting, 'TagDirectiveRx')['$=~'](l) : $d))) { + if ($truthy((($d = $gvars['~']) === nil ? nil : $d['$[]'](1)))) { + if ((this_tag = (($d = $gvars['~']) === nil ? nil : $d['$[]'](2)))['$=='](active_tag)) { + + tag_stack.$pop(); + return $e = (function() {if ($truthy(tag_stack['$empty?']())) { + return [nil, base_select] + } else { + return tag_stack['$[]'](-1) + }; return nil; })(), $d = Opal.to_ary($e), (active_tag = ($d[0] == null ? nil : $d[0])), (select = ($d[1] == null ? nil : $d[1])), $e; + } else if ($truthy(inc_tags['$key?'](this_tag))) { + + include_cursor = self.$create_include_cursor(inc_path, expanded_target, inc_lineno); + if ($truthy((idx = $send(tag_stack, 'rindex', [], (TMP_62 = function(key, _){var self = TMP_62.$$s || this; + + + + if (key == null) { + key = nil; + }; + + if (_ == null) { + _ = nil; + }; + return key['$=='](this_tag);}, TMP_62.$$s = self, TMP_62.$$arity = 2, TMP_62))))) { + + if (idx['$=='](0)) { + tag_stack.$shift() + } else { + + tag_stack.$delete_at(idx); + }; + return self.$logger().$warn(self.$message_with_context("" + "mismatched end tag (expected '" + (active_tag) + "' but found '" + (this_tag) + "') at line " + (inc_lineno) + " of include " + (target_type) + ": " + (inc_path), $hash2(["source_location", "include_location"], {"source_location": self.$cursor(), "include_location": include_cursor}))); + } else { + return self.$logger().$warn(self.$message_with_context("" + "unexpected end tag '" + (this_tag) + "' at line " + (inc_lineno) + " of include " + (target_type) + ": " + (inc_path), $hash2(["source_location", "include_location"], {"source_location": self.$cursor(), "include_location": include_cursor}))) + }; + } else { + return nil + } + } else if ($truthy(inc_tags['$key?']((this_tag = (($d = $gvars['~']) === nil ? nil : $d['$[]'](2)))))) { + + tags_used['$<<'](this_tag); + return tag_stack['$<<']([(active_tag = this_tag), (select = inc_tags['$[]'](this_tag)), inc_lineno]); + } else if ($truthy(wildcard['$nil?']()['$!']())) { + + select = (function() {if ($truthy(($truthy($d = active_tag) ? select['$!']() : $d))) { + return false + } else { + return wildcard + }; return nil; })(); + return tag_stack['$<<']([(active_tag = this_tag), select, inc_lineno]); + } else { + return nil + } + } else if ($truthy(select)) { + + inc_offset = ($truthy($d = inc_offset) ? $d : inc_lineno); + return inc_lines['$<<'](l); + } else { + return nil + };}, TMP_61.$$s = self, TMP_61.$$arity = 1, TMP_61));}, TMP_60.$$s = self, TMP_60.$$arity = 1, TMP_60)) + } catch ($err) { + if (Opal.rescue($err, [$$($nesting, 'StandardError')])) { + try { + + self.$logger().$error(self.$message_with_context("" + "include " + (target_type) + " not readable: " + (inc_path), $hash2(["source_location"], {"source_location": self.$cursor()}))); + return self.$replace_next_line("" + "Unresolved directive in " + (self.path) + " - include::" + (expanded_target) + "[" + (attrlist) + "]"); + } finally { Opal.pop_exception() } + } else { throw $err; } + };; + if ($truthy(tag_stack['$empty?']())) { + } else { + $send(tag_stack, 'each', [], (TMP_63 = function(tag_name, _, tag_lineno){var self = TMP_63.$$s || this; + + + + if (tag_name == null) { + tag_name = nil; + }; + + if (_ == null) { + _ = nil; + }; + + if (tag_lineno == null) { + tag_lineno = nil; + }; + return self.$logger().$warn(self.$message_with_context("" + "detected unclosed tag '" + (tag_name) + "' starting at line " + (tag_lineno) + " of include " + (target_type) + ": " + (inc_path), $hash2(["source_location", "include_location"], {"source_location": self.$cursor(), "include_location": self.$create_include_cursor(inc_path, expanded_target, tag_lineno)})));}, TMP_63.$$s = self, TMP_63.$$arity = 3, TMP_63)) + }; + if ($truthy((missing_tags = $rb_minus(inc_tags.$keys().$to_a(), tags_used.$to_a()))['$empty?']())) { + } else { + self.$logger().$warn(self.$message_with_context("" + "tag" + ((function() {if ($truthy($rb_gt(missing_tags.$size(), 1))) { + return "s" + } else { + return "" + }; return nil; })()) + " '" + (missing_tags.$join(", ")) + "' not found in include " + (target_type) + ": " + (inc_path), $hash2(["source_location"], {"source_location": self.$cursor()}))) + }; + self.$shift(); + if ($truthy(inc_offset)) { + + if ($truthy(($truthy($a = ($truthy($b = base_select) ? wildcard : $b)) ? inc_tags['$empty?']() : $a))) { + } else { + + $writer = ["partial-option", true]; + $send(parsed_attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + self.$push_include(inc_lines, inc_path, relpath, inc_offset, parsed_attrs);}; + } else { + + try { + + inc_content = (function() {if (false) { + return $send($$$('::', 'File'), 'open', [inc_path, "rb"], (TMP_64 = function(f){var self = TMP_64.$$s || this; + + + + if (f == null) { + f = nil; + }; + return f.$read();}, TMP_64.$$s = self, TMP_64.$$arity = 1, TMP_64)) + } else { + return $send(self, 'open', [inc_path, "rb"], (TMP_65 = function(f){var self = TMP_65.$$s || this; + + + + if (f == null) { + f = nil; + }; + return f.$read();}, TMP_65.$$s = self, TMP_65.$$arity = 1, TMP_65)) + }; return nil; })(); + self.$shift(); + self.$push_include(inc_content, inc_path, relpath, 1, parsed_attrs); + } catch ($err) { + if (Opal.rescue($err, [$$($nesting, 'StandardError')])) { + try { + + self.$logger().$error(self.$message_with_context("" + "include " + (target_type) + " not readable: " + (inc_path), $hash2(["source_location"], {"source_location": self.$cursor()}))); + return self.$replace_next_line("" + "Unresolved directive in " + (self.path) + " - include::" + (expanded_target) + "[" + (attrlist) + "]"); + } finally { Opal.pop_exception() } + } else { throw $err; } + }; + }; + return true; + } else { + return nil + }; + }, TMP_PreprocessorReader_preprocess_include_directive_54.$$arity = 2); + + Opal.def(self, '$resolve_include_path', TMP_PreprocessorReader_resolve_include_path_66 = function $$resolve_include_path(target, attrlist, attributes) { + var $a, $b, self = this, doc = nil, inc_path = nil, relpath = nil; + + + doc = self.document; + if ($truthy(($truthy($a = $$($nesting, 'Helpers')['$uriish?'](target)) ? $a : (function() {if ($truthy($$$('::', 'String')['$==='](self.dir))) { + return nil + } else { + + return (target = "" + (self.dir) + "/" + (target)); + }; return nil; })()))) { + + if ($truthy(doc['$attr?']("allow-uri-read"))) { + } else { + return self.$replace_next_line("" + "link:" + (target) + "[" + (attrlist) + "]") + }; + if ($truthy(doc['$attr?']("cache-uri"))) { + if ($truthy((($b = $$$('::', 'OpenURI', 'skip_raise')) && ($a = $$$($b, 'Cache', 'skip_raise')) ? 'constant' : nil))) { + } else { + $$($nesting, 'Helpers').$require_library("open-uri/cached", "open-uri-cached") + } + } else if ($truthy($$$('::', 'RUBY_ENGINE_OPAL')['$!']())) { + $$$('::', 'OpenURI')}; + return [$$$('::', 'URI').$parse(target), "uri", target]; + } else { + + inc_path = doc.$normalize_system_path(target, self.dir, nil, $hash2(["target_name"], {"target_name": "include file"})); + if ($truthy($$$('::', 'File')['$file?'](inc_path))) { + } else if ($truthy(attributes['$key?']("optional-option"))) { + + self.$shift(); + return true; + } else { + + self.$logger().$error(self.$message_with_context("" + "include file not found: " + (inc_path), $hash2(["source_location"], {"source_location": self.$cursor()}))); + return self.$replace_next_line("" + "Unresolved directive in " + (self.path) + " - include::" + (target) + "[" + (attrlist) + "]"); + }; + relpath = doc.$path_resolver().$relative_path(inc_path, doc.$base_dir()); + return [inc_path, "file", relpath]; + }; + }, TMP_PreprocessorReader_resolve_include_path_66.$$arity = 3); + + Opal.def(self, '$push_include', TMP_PreprocessorReader_push_include_67 = function $$push_include(data, file, path, lineno, attributes) { + var $a, self = this, $writer = nil, dir = nil, depth = nil, old_leveloffset = nil; + + + + if (file == null) { + file = nil; + }; + + if (path == null) { + path = nil; + }; + + if (lineno == null) { + lineno = 1; + }; + + if (attributes == null) { + attributes = $hash2([], {}); + }; + self.include_stack['$<<']([self.lines, self.file, self.dir, self.path, self.lineno, self.maxdepth, self.process_lines]); + if ($truthy((self.file = file))) { + + if ($truthy($$$('::', 'String')['$==='](file))) { + self.dir = $$$('::', 'File').$dirname(file) + } else if ($truthy($$$('::', 'RUBY_ENGINE_OPAL'))) { + self.dir = $$$('::', 'URI').$parse($$$('::', 'File').$dirname((file = file.$to_s()))) + } else { + + + $writer = [(function() {if ((dir = $$$('::', 'File').$dirname(file.$path()))['$==']("/")) { + return "" + } else { + return dir + }; return nil; })()]; + $send((self.dir = file.$dup()), 'path=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + file = file.$to_s(); + }; + path = ($truthy($a = path) ? $a : $$$('::', 'File').$basename(file)); + self.process_lines = $$($nesting, 'ASCIIDOC_EXTENSIONS')['$[]']($$$('::', 'File').$extname(file)); + } else { + + self.dir = "."; + self.process_lines = true; + }; + if ($truthy(path)) { + + self.path = path; + if ($truthy(self.process_lines)) { + + $writer = [$$($nesting, 'Helpers').$rootname(path), (function() {if ($truthy(attributes['$[]']("partial-option"))) { + return nil + } else { + return true + }; return nil; })()]; + $send(self.includes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + } else { + self.path = "" + }; + self.lineno = lineno; + if ($truthy(attributes['$key?']("depth"))) { + + depth = attributes['$[]']("depth").$to_i(); + if ($truthy($rb_le(depth, 0))) { + depth = 1}; + self.maxdepth = $hash2(["abs", "rel"], {"abs": $rb_plus($rb_minus(self.include_stack.$size(), 1), depth), "rel": depth});}; + if ($truthy((self.lines = self.$prepare_lines(data, $hash2(["normalize", "condense", "indent"], {"normalize": true, "condense": false, "indent": attributes['$[]']("indent")})))['$empty?']())) { + self.$pop_include() + } else { + + if ($truthy(attributes['$key?']("leveloffset"))) { + + self.lines.$unshift(""); + self.lines.$unshift("" + ":leveloffset: " + (attributes['$[]']("leveloffset"))); + self.lines['$<<'](""); + if ($truthy((old_leveloffset = self.document.$attr("leveloffset")))) { + self.lines['$<<']("" + ":leveloffset: " + (old_leveloffset)) + } else { + self.lines['$<<'](":leveloffset!:") + }; + self.lineno = $rb_minus(self.lineno, 2);}; + self.look_ahead = 0; + }; + return self; + }, TMP_PreprocessorReader_push_include_67.$$arity = -2); + + Opal.def(self, '$create_include_cursor', TMP_PreprocessorReader_create_include_cursor_68 = function $$create_include_cursor(file, path, lineno) { + var self = this, dir = nil; + + + if ($truthy($$$('::', 'String')['$==='](file))) { + dir = $$$('::', 'File').$dirname(file) + } else if ($truthy($$$('::', 'RUBY_ENGINE_OPAL'))) { + dir = $$$('::', 'File').$dirname((file = file.$to_s())) + } else { + + dir = (function() {if ((dir = $$$('::', 'File').$dirname(file.$path()))['$==']("")) { + return "/" + } else { + return dir + }; return nil; })(); + file = file.$to_s(); + }; + return $$($nesting, 'Cursor').$new(file, dir, path, lineno); + }, TMP_PreprocessorReader_create_include_cursor_68.$$arity = 3); + + Opal.def(self, '$pop_include', TMP_PreprocessorReader_pop_include_69 = function $$pop_include() { + var $a, $b, self = this; + + if ($truthy($rb_gt(self.include_stack.$size(), 0))) { + + $b = self.include_stack.$pop(), $a = Opal.to_ary($b), (self.lines = ($a[0] == null ? nil : $a[0])), (self.file = ($a[1] == null ? nil : $a[1])), (self.dir = ($a[2] == null ? nil : $a[2])), (self.path = ($a[3] == null ? nil : $a[3])), (self.lineno = ($a[4] == null ? nil : $a[4])), (self.maxdepth = ($a[5] == null ? nil : $a[5])), (self.process_lines = ($a[6] == null ? nil : $a[6])), $b; + self.look_ahead = 0; + return nil; + } else { + return nil + } + }, TMP_PreprocessorReader_pop_include_69.$$arity = 0); + + Opal.def(self, '$include_depth', TMP_PreprocessorReader_include_depth_70 = function $$include_depth() { + var self = this; + + return self.include_stack.$size() + }, TMP_PreprocessorReader_include_depth_70.$$arity = 0); + + Opal.def(self, '$exceeded_max_depth?', TMP_PreprocessorReader_exceeded_max_depth$q_71 = function() { + var $a, self = this, abs_maxdepth = nil; + + if ($truthy(($truthy($a = $rb_gt((abs_maxdepth = self.maxdepth['$[]']("abs")), 0)) ? $rb_ge(self.include_stack.$size(), abs_maxdepth) : $a))) { + return self.maxdepth['$[]']("rel") + } else { + return false + } + }, TMP_PreprocessorReader_exceeded_max_depth$q_71.$$arity = 0); + + Opal.def(self, '$shift', TMP_PreprocessorReader_shift_72 = function $$shift() { + var $iter = TMP_PreprocessorReader_shift_72.$$p, $yield = $iter || nil, self = this, line = nil, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_PreprocessorReader_shift_72.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + if ($truthy(self.unescape_next_line)) { + + self.unescape_next_line = false; + return (line = $send(self, Opal.find_super_dispatcher(self, 'shift', TMP_PreprocessorReader_shift_72, false), $zuper, $iter)).$slice(1, line.$length()); + } else { + return $send(self, Opal.find_super_dispatcher(self, 'shift', TMP_PreprocessorReader_shift_72, false), $zuper, $iter) + } + }, TMP_PreprocessorReader_shift_72.$$arity = 0); + + Opal.def(self, '$split_delimited_value', TMP_PreprocessorReader_split_delimited_value_73 = function $$split_delimited_value(val) { + var self = this; + + if ($truthy(val['$include?'](","))) { + + return val.$split(","); + } else { + + return val.$split(";"); + } + }, TMP_PreprocessorReader_split_delimited_value_73.$$arity = 1); + + Opal.def(self, '$skip_front_matter!', TMP_PreprocessorReader_skip_front_matter$B_74 = function(data, increment_linenos) { + var $a, $b, self = this, front_matter = nil, original_data = nil; + + + + if (increment_linenos == null) { + increment_linenos = true; + }; + front_matter = nil; + if (data['$[]'](0)['$==']("---")) { + + original_data = data.$drop(0); + data.$shift(); + front_matter = []; + if ($truthy(increment_linenos)) { + self.lineno = $rb_plus(self.lineno, 1)}; + while ($truthy(($truthy($b = data['$empty?']()['$!']()) ? data['$[]'](0)['$!=']("---") : $b))) { + + front_matter['$<<'](data.$shift()); + if ($truthy(increment_linenos)) { + self.lineno = $rb_plus(self.lineno, 1)}; + }; + if ($truthy(data['$empty?']())) { + + $send(data, 'unshift', Opal.to_a(original_data)); + if ($truthy(increment_linenos)) { + self.lineno = 0}; + front_matter = nil; + } else { + + data.$shift(); + if ($truthy(increment_linenos)) { + self.lineno = $rb_plus(self.lineno, 1)}; + };}; + return front_matter; + }, TMP_PreprocessorReader_skip_front_matter$B_74.$$arity = -2); + + Opal.def(self, '$resolve_expr_val', TMP_PreprocessorReader_resolve_expr_val_75 = function $$resolve_expr_val(val) { + var $a, $b, self = this, quoted = nil; + + + if ($truthy(($truthy($a = ($truthy($b = val['$start_with?']("\"")) ? val['$end_with?']("\"") : $b)) ? $a : ($truthy($b = val['$start_with?']("'")) ? val['$end_with?']("'") : $b)))) { + + quoted = true; + val = val.$slice(1, $rb_minus(val.$length(), 1)); + } else { + quoted = false + }; + if ($truthy(val['$include?']($$($nesting, 'ATTR_REF_HEAD')))) { + val = self.document.$sub_attributes(val, $hash2(["attribute_missing"], {"attribute_missing": "drop"}))}; + if ($truthy(quoted)) { + return val + } else if ($truthy(val['$empty?']())) { + return nil + } else if (val['$==']("true")) { + return true + } else if (val['$==']("false")) { + return false + } else if ($truthy(val.$rstrip()['$empty?']())) { + return " " + } else if ($truthy(val['$include?']("."))) { + return val.$to_f() + } else { + return val.$to_i() + }; + }, TMP_PreprocessorReader_resolve_expr_val_75.$$arity = 1); + + Opal.def(self, '$include_processors?', TMP_PreprocessorReader_include_processors$q_76 = function() { + var $a, self = this; + + if ($truthy(self.include_processor_extensions['$nil?']())) { + if ($truthy(($truthy($a = self.document['$extensions?']()) ? self.document.$extensions()['$include_processors?']() : $a))) { + return (self.include_processor_extensions = self.document.$extensions().$include_processors())['$!']()['$!']() + } else { + return (self.include_processor_extensions = false) + } + } else { + return self.include_processor_extensions['$!='](false) + } + }, TMP_PreprocessorReader_include_processors$q_76.$$arity = 0); + return (Opal.def(self, '$to_s', TMP_PreprocessorReader_to_s_77 = function $$to_s() { + var TMP_78, self = this; + + return "" + "#<" + (self.$class()) + "@" + (self.$object_id()) + " {path: " + (self.path.$inspect()) + ", line #: " + (self.lineno) + ", include depth: " + (self.include_stack.$size()) + ", include stack: [" + ($send(self.include_stack, 'map', [], (TMP_78 = function(inc){var self = TMP_78.$$s || this; + + + + if (inc == null) { + inc = nil; + }; + return inc.$to_s();}, TMP_78.$$s = self, TMP_78.$$arity = 1, TMP_78)).$join(", ")) + "]}>" + }, TMP_PreprocessorReader_to_s_77.$$arity = 0), nil) && 'to_s'; + })($nesting[0], $$($nesting, 'Reader'), $nesting); + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/section"] = function(Opal) { + function $rb_plus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); + } + function $rb_gt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); + } + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $hash2 = Opal.hash2, $send = Opal.send, $truthy = Opal.truthy; + + Opal.add_stubs(['$attr_accessor', '$attr_reader', '$===', '$+', '$level', '$special', '$generate_id', '$title', '$==', '$>', '$sectnum', '$int_to_roman', '$to_i', '$reftext', '$!', '$empty?', '$sprintf', '$sub_quotes', '$compat_mode', '$[]', '$attributes', '$context', '$assign_numeral', '$class', '$object_id', '$inspect', '$size', '$length', '$chr', '$[]=', '$-', '$gsub', '$downcase', '$delete', '$tr_s', '$end_with?', '$chop', '$start_with?', '$slice', '$key?', '$catalog', '$unique_id_start_index']); + return (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + (function($base, $super, $parent_nesting) { + function $Section(){}; + var self = $Section = $klass($base, $super, 'Section', $Section); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Section_initialize_1, TMP_Section_generate_id_2, TMP_Section_sectnum_3, TMP_Section_xreftext_4, TMP_Section_$lt$lt_5, TMP_Section_to_s_6, TMP_Section_generate_id_7; + + def.document = def.level = def.numeral = def.parent = def.numbered = def.sectname = def.title = def.blocks = nil; + + self.$attr_accessor("index"); + self.$attr_accessor("sectname"); + self.$attr_accessor("special"); + self.$attr_accessor("numbered"); + self.$attr_reader("caption"); + + Opal.def(self, '$initialize', TMP_Section_initialize_1 = function $$initialize(parent, level, numbered, opts) { + var $a, $b, $iter = TMP_Section_initialize_1.$$p, $yield = $iter || nil, self = this; + + if ($iter) TMP_Section_initialize_1.$$p = null; + + + if (parent == null) { + parent = nil; + }; + + if (level == null) { + level = nil; + }; + + if (numbered == null) { + numbered = false; + }; + + if (opts == null) { + opts = $hash2([], {}); + }; + $send(self, Opal.find_super_dispatcher(self, 'initialize', TMP_Section_initialize_1, false), [parent, "section", opts], null); + if ($truthy($$($nesting, 'Section')['$==='](parent))) { + $a = [($truthy($b = level) ? $b : $rb_plus(parent.$level(), 1)), parent.$special()], (self.level = $a[0]), (self.special = $a[1]), $a + } else { + $a = [($truthy($b = level) ? $b : 1), false], (self.level = $a[0]), (self.special = $a[1]), $a + }; + self.numbered = numbered; + return (self.index = 0); + }, TMP_Section_initialize_1.$$arity = -1); + Opal.alias(self, "name", "title"); + + Opal.def(self, '$generate_id', TMP_Section_generate_id_2 = function $$generate_id() { + var self = this; + + return $$($nesting, 'Section').$generate_id(self.$title(), self.document) + }, TMP_Section_generate_id_2.$$arity = 0); + + Opal.def(self, '$sectnum', TMP_Section_sectnum_3 = function $$sectnum(delimiter, append) { + var $a, self = this; + + + + if (delimiter == null) { + delimiter = "."; + }; + + if (append == null) { + append = nil; + }; + append = ($truthy($a = append) ? $a : (function() {if (append['$=='](false)) { + return "" + } else { + return delimiter + }; return nil; })()); + if (self.level['$=='](1)) { + return "" + (self.numeral) + (append) + } else if ($truthy($rb_gt(self.level, 1))) { + if ($truthy($$($nesting, 'Section')['$==='](self.parent))) { + return "" + (self.parent.$sectnum(delimiter, delimiter)) + (self.numeral) + (append) + } else { + return "" + (self.numeral) + (append) + } + } else { + return "" + ($$($nesting, 'Helpers').$int_to_roman(self.numeral.$to_i())) + (append) + }; + }, TMP_Section_sectnum_3.$$arity = -1); + + Opal.def(self, '$xreftext', TMP_Section_xreftext_4 = function $$xreftext(xrefstyle) { + var $a, self = this, val = nil, $case = nil, type = nil, quoted_title = nil, signifier = nil; + + + + if (xrefstyle == null) { + xrefstyle = nil; + }; + if ($truthy(($truthy($a = (val = self.$reftext())) ? val['$empty?']()['$!']() : $a))) { + return val + } else if ($truthy(xrefstyle)) { + if ($truthy(self.numbered)) { + return (function() {$case = xrefstyle; + if ("full"['$===']($case)) { + if ($truthy(($truthy($a = (type = self.sectname)['$==']("chapter")) ? $a : type['$==']("appendix")))) { + quoted_title = self.$sprintf(self.$sub_quotes("_%s_"), self.$title()) + } else { + quoted_title = self.$sprintf(self.$sub_quotes((function() {if ($truthy(self.document.$compat_mode())) { + return "``%s''" + } else { + return "\"`%s`\"" + }; return nil; })()), self.$title()) + }; + if ($truthy((signifier = self.document.$attributes()['$[]']("" + (type) + "-refsig")))) { + return "" + (signifier) + " " + (self.$sectnum(".", ",")) + " " + (quoted_title) + } else { + return "" + (self.$sectnum(".", ",")) + " " + (quoted_title) + };} + else if ("short"['$===']($case)) {if ($truthy((signifier = self.document.$attributes()['$[]']("" + (self.sectname) + "-refsig")))) { + return "" + (signifier) + " " + (self.$sectnum(".", "")) + } else { + return self.$sectnum(".", "") + }} + else {if ($truthy(($truthy($a = (type = self.sectname)['$==']("chapter")) ? $a : type['$==']("appendix")))) { + + return self.$sprintf(self.$sub_quotes("_%s_"), self.$title()); + } else { + return self.$title() + }}})() + } else if ($truthy(($truthy($a = (type = self.sectname)['$==']("chapter")) ? $a : type['$==']("appendix")))) { + + return self.$sprintf(self.$sub_quotes("_%s_"), self.$title()); + } else { + return self.$title() + } + } else { + return self.$title() + }; + }, TMP_Section_xreftext_4.$$arity = -1); + + Opal.def(self, '$<<', TMP_Section_$lt$lt_5 = function(block) { + var $iter = TMP_Section_$lt$lt_5.$$p, $yield = $iter || nil, self = this, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_Section_$lt$lt_5.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + + if (block.$context()['$==']("section")) { + self.$assign_numeral(block)}; + return $send(self, Opal.find_super_dispatcher(self, '<<', TMP_Section_$lt$lt_5, false), $zuper, $iter); + }, TMP_Section_$lt$lt_5.$$arity = 1); + + Opal.def(self, '$to_s', TMP_Section_to_s_6 = function $$to_s() { + var $iter = TMP_Section_to_s_6.$$p, $yield = $iter || nil, self = this, formal_title = nil, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_Section_to_s_6.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + if ($truthy(self.title)) { + + formal_title = (function() {if ($truthy(self.numbered)) { + return "" + (self.$sectnum()) + " " + (self.title) + } else { + return self.title + }; return nil; })(); + return "" + "#<" + (self.$class()) + "@" + (self.$object_id()) + " {level: " + (self.level) + ", title: " + (formal_title.$inspect()) + ", blocks: " + (self.blocks.$size()) + "}>"; + } else { + return $send(self, Opal.find_super_dispatcher(self, 'to_s', TMP_Section_to_s_6, false), $zuper, $iter) + } + }, TMP_Section_to_s_6.$$arity = 0); + return (Opal.defs(self, '$generate_id', TMP_Section_generate_id_7 = function $$generate_id(title, document) { + var $a, $b, self = this, attrs = nil, pre = nil, sep = nil, no_sep = nil, $writer = nil, sep_sub = nil, gen_id = nil, ids = nil, cnt = nil, candidate_id = nil; + + + attrs = document.$attributes(); + pre = ($truthy($a = attrs['$[]']("idprefix")) ? $a : "_"); + if ($truthy((sep = attrs['$[]']("idseparator")))) { + if ($truthy(($truthy($a = sep.$length()['$=='](1)) ? $a : ($truthy($b = (no_sep = sep['$empty?']())['$!']()) ? (sep = (($writer = ["idseparator", sep.$chr()]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])) : $b)))) { + sep_sub = (function() {if ($truthy(($truthy($a = sep['$==']("-")) ? $a : sep['$=='](".")))) { + return " .-" + } else { + return "" + " " + (sep) + ".-" + }; return nil; })()} + } else { + $a = ["_", " _.-"], (sep = $a[0]), (sep_sub = $a[1]), $a + }; + gen_id = "" + (pre) + (title.$downcase().$gsub($$($nesting, 'InvalidSectionIdCharsRx'), "")); + if ($truthy(no_sep)) { + gen_id = gen_id.$delete(" ") + } else { + + gen_id = gen_id.$tr_s(sep_sub, sep); + if ($truthy(gen_id['$end_with?'](sep))) { + gen_id = gen_id.$chop()}; + if ($truthy(($truthy($a = pre['$empty?']()) ? gen_id['$start_with?'](sep) : $a))) { + gen_id = gen_id.$slice(1, gen_id.$length())}; + }; + if ($truthy(document.$catalog()['$[]']("ids")['$key?'](gen_id))) { + + $a = [document.$catalog()['$[]']("ids"), $$($nesting, 'Compliance').$unique_id_start_index()], (ids = $a[0]), (cnt = $a[1]), $a; + while ($truthy(ids['$key?']((candidate_id = "" + (gen_id) + (sep) + (cnt))))) { + cnt = $rb_plus(cnt, 1) + }; + return candidate_id; + } else { + return gen_id + }; + }, TMP_Section_generate_id_7.$$arity = 2), nil) && 'generate_id'; + })($nesting[0], $$($nesting, 'AbstractBlock'), $nesting) + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/stylesheets"] = function(Opal) { + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $truthy = Opal.truthy, $hash2 = Opal.hash2, $gvars = Opal.gvars, $send = Opal.send; + + Opal.add_stubs(['$join', '$new', '$rstrip', '$read', '$primary_stylesheet_data', '$write', '$primary_stylesheet_name', '$coderay_stylesheet_data', '$coderay_stylesheet_name', '$load_pygments', '$=~', '$css', '$[]', '$sub', '$[]=', '$-', '$pygments_stylesheet_data', '$pygments_stylesheet_name', '$!', '$nil?', '$require_library']); + return (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + (function($base, $super, $parent_nesting) { + function $Stylesheets(){}; + var self = $Stylesheets = $klass($base, $super, 'Stylesheets', $Stylesheets); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Stylesheets_instance_1, TMP_Stylesheets_primary_stylesheet_name_2, TMP_Stylesheets_primary_stylesheet_data_3, TMP_Stylesheets_embed_primary_stylesheet_4, TMP_Stylesheets_write_primary_stylesheet_5, TMP_Stylesheets_coderay_stylesheet_name_6, TMP_Stylesheets_coderay_stylesheet_data_7, TMP_Stylesheets_embed_coderay_stylesheet_8, TMP_Stylesheets_write_coderay_stylesheet_9, TMP_Stylesheets_pygments_stylesheet_name_10, TMP_Stylesheets_pygments_background_11, TMP_Stylesheets_pygments_stylesheet_data_12, TMP_Stylesheets_embed_pygments_stylesheet_13, TMP_Stylesheets_write_pygments_stylesheet_14, TMP_Stylesheets_load_pygments_15; + + def.primary_stylesheet_data = def.coderay_stylesheet_data = def.pygments_stylesheet_data = nil; + + Opal.const_set($nesting[0], 'DEFAULT_STYLESHEET_NAME', "asciidoctor.css"); + Opal.const_set($nesting[0], 'DEFAULT_PYGMENTS_STYLE', "default"); + Opal.const_set($nesting[0], 'STYLESHEETS_DATA_PATH', $$$('::', 'File').$join($$($nesting, 'DATA_PATH'), "stylesheets")); + Opal.const_set($nesting[0], 'PygmentsBgColorRx', /^\.pygments +\{ *background: *([^;]+);/); + self.__instance__ = self.$new(); + Opal.defs(self, '$instance', TMP_Stylesheets_instance_1 = function $$instance() { + var self = this; + if (self.__instance__ == null) self.__instance__ = nil; + + return self.__instance__ + }, TMP_Stylesheets_instance_1.$$arity = 0); + + Opal.def(self, '$primary_stylesheet_name', TMP_Stylesheets_primary_stylesheet_name_2 = function $$primary_stylesheet_name() { + var self = this; + + return $$($nesting, 'DEFAULT_STYLESHEET_NAME') + }, TMP_Stylesheets_primary_stylesheet_name_2.$$arity = 0); + + Opal.def(self, '$primary_stylesheet_data', TMP_Stylesheets_primary_stylesheet_data_3 = function $$primary_stylesheet_data() { + +var File = Opal.const_get_relative([], "File"); +var stylesheetsPath; +if (Opal.const_get_relative([], "JAVASCRIPT_PLATFORM")["$=="]("node")) { + if (File.$basename(__dirname) === "node" && File.$basename(File.$dirname(__dirname)) === "dist") { + stylesheetsPath = File.$join(File.$dirname(__dirname), "css"); + } else { + stylesheetsPath = File.$join(__dirname, "css"); + } +} else if (Opal.const_get_relative([], "JAVASCRIPT_ENGINE")["$=="]("nashorn")) { + if (File.$basename(__DIR__) === "nashorn" && File.$basename(File.$dirname(__DIR__)) === "dist") { + stylesheetsPath = File.$join(File.$dirname(__DIR__), "css"); + } else { + stylesheetsPath = File.$join(__DIR__, "css"); + } +} else { + stylesheetsPath = "css"; +} +return ((($a = self.primary_stylesheet_data) !== false && $a !== nil && $a != null) ? $a : self.primary_stylesheet_data = Opal.const_get_relative([], "IO").$read(File.$join(stylesheetsPath, "asciidoctor.css")).$chomp()); + + }, TMP_Stylesheets_primary_stylesheet_data_3.$$arity = 0); + + Opal.def(self, '$embed_primary_stylesheet', TMP_Stylesheets_embed_primary_stylesheet_4 = function $$embed_primary_stylesheet() { + var self = this; + + return "" + "" + }, TMP_Stylesheets_embed_primary_stylesheet_4.$$arity = 0); + + Opal.def(self, '$write_primary_stylesheet', TMP_Stylesheets_write_primary_stylesheet_5 = function $$write_primary_stylesheet(target_dir) { + var self = this; + + + + if (target_dir == null) { + target_dir = "."; + }; + return $$$('::', 'IO').$write($$$('::', 'File').$join(target_dir, self.$primary_stylesheet_name()), self.$primary_stylesheet_data()); + }, TMP_Stylesheets_write_primary_stylesheet_5.$$arity = -1); + + Opal.def(self, '$coderay_stylesheet_name', TMP_Stylesheets_coderay_stylesheet_name_6 = function $$coderay_stylesheet_name() { + var self = this; + + return "coderay-asciidoctor.css" + }, TMP_Stylesheets_coderay_stylesheet_name_6.$$arity = 0); + + Opal.def(self, '$coderay_stylesheet_data', TMP_Stylesheets_coderay_stylesheet_data_7 = function $$coderay_stylesheet_data() { + var $a, self = this; + + return (self.coderay_stylesheet_data = ($truthy($a = self.coderay_stylesheet_data) ? $a : $$$('::', 'IO').$read($$$('::', 'File').$join($$($nesting, 'STYLESHEETS_DATA_PATH'), "coderay-asciidoctor.css")).$rstrip())) + }, TMP_Stylesheets_coderay_stylesheet_data_7.$$arity = 0); + + Opal.def(self, '$embed_coderay_stylesheet', TMP_Stylesheets_embed_coderay_stylesheet_8 = function $$embed_coderay_stylesheet() { + var self = this; + + return "" + "" + }, TMP_Stylesheets_embed_coderay_stylesheet_8.$$arity = 0); + + Opal.def(self, '$write_coderay_stylesheet', TMP_Stylesheets_write_coderay_stylesheet_9 = function $$write_coderay_stylesheet(target_dir) { + var self = this; + + + + if (target_dir == null) { + target_dir = "."; + }; + return $$$('::', 'IO').$write($$$('::', 'File').$join(target_dir, self.$coderay_stylesheet_name()), self.$coderay_stylesheet_data()); + }, TMP_Stylesheets_write_coderay_stylesheet_9.$$arity = -1); + + Opal.def(self, '$pygments_stylesheet_name', TMP_Stylesheets_pygments_stylesheet_name_10 = function $$pygments_stylesheet_name(style) { + var $a, self = this; + + + + if (style == null) { + style = nil; + }; + return "" + "pygments-" + (($truthy($a = style) ? $a : $$($nesting, 'DEFAULT_PYGMENTS_STYLE'))) + ".css"; + }, TMP_Stylesheets_pygments_stylesheet_name_10.$$arity = -1); + + Opal.def(self, '$pygments_background', TMP_Stylesheets_pygments_background_11 = function $$pygments_background(style) { + var $a, $b, self = this; + + + + if (style == null) { + style = nil; + }; + if ($truthy(($truthy($a = self.$load_pygments()) ? $$($nesting, 'PygmentsBgColorRx')['$=~']($$$('::', 'Pygments').$css(".pygments", $hash2(["style"], {"style": ($truthy($b = style) ? $b : $$($nesting, 'DEFAULT_PYGMENTS_STYLE'))}))) : $a))) { + return (($a = $gvars['~']) === nil ? nil : $a['$[]'](1)) + } else { + return nil + }; + }, TMP_Stylesheets_pygments_background_11.$$arity = -1); + + Opal.def(self, '$pygments_stylesheet_data', TMP_Stylesheets_pygments_stylesheet_data_12 = function $$pygments_stylesheet_data(style) { + var $a, $b, self = this, $writer = nil; + + + + if (style == null) { + style = nil; + }; + if ($truthy(self.$load_pygments())) { + + style = ($truthy($a = style) ? $a : $$($nesting, 'DEFAULT_PYGMENTS_STYLE')); + return ($truthy($a = (self.pygments_stylesheet_data = ($truthy($b = self.pygments_stylesheet_data) ? $b : $hash2([], {})))['$[]'](style)) ? $a : (($writer = [style, ($truthy($b = $$$('::', 'Pygments').$css(".listingblock .pygments", $hash2(["classprefix", "style"], {"classprefix": "tok-", "style": style}))) ? $b : "/* Failed to load Pygments CSS. */").$sub(".listingblock .pygments {", ".listingblock .pygments, .listingblock .pygments code {")]), $send((self.pygments_stylesheet_data = ($truthy($b = self.pygments_stylesheet_data) ? $b : $hash2([], {}))), '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + } else { + return "/* Pygments CSS disabled. Pygments is not available. */" + }; + }, TMP_Stylesheets_pygments_stylesheet_data_12.$$arity = -1); + + Opal.def(self, '$embed_pygments_stylesheet', TMP_Stylesheets_embed_pygments_stylesheet_13 = function $$embed_pygments_stylesheet(style) { + var self = this; + + + + if (style == null) { + style = nil; + }; + return "" + ""; + }, TMP_Stylesheets_embed_pygments_stylesheet_13.$$arity = -1); + + Opal.def(self, '$write_pygments_stylesheet', TMP_Stylesheets_write_pygments_stylesheet_14 = function $$write_pygments_stylesheet(target_dir, style) { + var self = this; + + + + if (target_dir == null) { + target_dir = "."; + }; + + if (style == null) { + style = nil; + }; + return $$$('::', 'IO').$write($$$('::', 'File').$join(target_dir, self.$pygments_stylesheet_name(style)), self.$pygments_stylesheet_data(style)); + }, TMP_Stylesheets_write_pygments_stylesheet_14.$$arity = -1); + return (Opal.def(self, '$load_pygments', TMP_Stylesheets_load_pygments_15 = function $$load_pygments() { + var $a, self = this; + + if ($truthy((($a = $$$('::', 'Pygments', 'skip_raise')) ? 'constant' : nil))) { + return true + } else { + return $$($nesting, 'Helpers').$require_library("pygments", "pygments.rb", "ignore")['$nil?']()['$!']() + } + }, TMP_Stylesheets_load_pygments_15.$$arity = 0), nil) && 'load_pygments'; + })($nesting[0], null, $nesting) + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/table"] = function(Opal) { + function $rb_gt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); + } + function $rb_lt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); + } + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + function $rb_times(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs * rhs : lhs['$*'](rhs); + } + function $rb_divide(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs / rhs : lhs['$/'](rhs); + } + function $rb_plus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $send = Opal.send, $truthy = Opal.truthy, $hash2 = Opal.hash2, $gvars = Opal.gvars; + + Opal.add_stubs(['$attr_accessor', '$attr_reader', '$new', '$key?', '$[]', '$>', '$to_i', '$<', '$==', '$[]=', '$-', '$attributes', '$round', '$*', '$/', '$to_f', '$empty?', '$body', '$each', '$<<', '$size', '$+', '$assign_column_widths', '$warn', '$logger', '$update_attributes', '$assign_width', '$shift', '$style=', '$head=', '$pop', '$foot=', '$parent', '$sourcemap', '$dup', '$header_row?', '$table', '$delete', '$start_with?', '$rstrip', '$slice', '$length', '$advance', '$lstrip', '$strip', '$split', '$include?', '$readlines', '$unshift', '$nil?', '$=~', '$catalog_inline_anchor', '$apply_subs', '$convert', '$map', '$text', '$!', '$file', '$lineno', '$to_s', '$include', '$to_set', '$mark', '$nested?', '$document', '$error', '$message_with_context', '$cursor_at_prev_line', '$nil_or_empty?', '$escape', '$columns', '$match', '$chop', '$end_with?', '$gsub', '$push_cellspec', '$cell_open?', '$close_cell', '$take_cellspec', '$squeeze', '$upto', '$times', '$cursor_before_mark', '$rowspan', '$activate_rowspan', '$colspan', '$end_of_row?', '$!=', '$close_row', '$rows', '$effective_column_visits']); + return (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + + (function($base, $super, $parent_nesting) { + function $Table(){}; + var self = $Table = $klass($base, $super, 'Table', $Table); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Table_initialize_3, TMP_Table_header_row$q_4, TMP_Table_create_columns_5, TMP_Table_assign_column_widths_7, TMP_Table_partition_header_footer_11; + + def.attributes = def.document = def.has_header_option = def.rows = def.columns = nil; + + Opal.const_set($nesting[0], 'DEFAULT_PRECISION_FACTOR', 10000); + (function($base, $super, $parent_nesting) { + function $Rows(){}; + var self = $Rows = $klass($base, $super, 'Rows', $Rows); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Rows_initialize_1, TMP_Rows_by_section_2; + + def.head = def.body = def.foot = nil; + + self.$attr_accessor("head", "foot", "body"); + + Opal.def(self, '$initialize', TMP_Rows_initialize_1 = function $$initialize(head, foot, body) { + var self = this; + + + + if (head == null) { + head = []; + }; + + if (foot == null) { + foot = []; + }; + + if (body == null) { + body = []; + }; + self.head = head; + self.foot = foot; + return (self.body = body); + }, TMP_Rows_initialize_1.$$arity = -1); + Opal.alias(self, "[]", "send"); + return (Opal.def(self, '$by_section', TMP_Rows_by_section_2 = function $$by_section() { + var self = this; + + return [["head", self.head], ["body", self.body], ["foot", self.foot]] + }, TMP_Rows_by_section_2.$$arity = 0), nil) && 'by_section'; + })($nesting[0], null, $nesting); + self.$attr_accessor("columns"); + self.$attr_accessor("rows"); + self.$attr_accessor("has_header_option"); + self.$attr_reader("caption"); + + Opal.def(self, '$initialize', TMP_Table_initialize_3 = function $$initialize(parent, attributes) { + var $a, $b, $iter = TMP_Table_initialize_3.$$p, $yield = $iter || nil, self = this, pcwidth = nil, pcwidth_intval = nil, $writer = nil; + + if ($iter) TMP_Table_initialize_3.$$p = null; + + $send(self, Opal.find_super_dispatcher(self, 'initialize', TMP_Table_initialize_3, false), [parent, "table"], null); + self.rows = $$($nesting, 'Rows').$new(); + self.columns = []; + self.has_header_option = attributes['$key?']("header-option"); + if ($truthy((pcwidth = attributes['$[]']("width")))) { + if ($truthy(($truthy($a = $rb_gt((pcwidth_intval = pcwidth.$to_i()), 100)) ? $a : $rb_lt(pcwidth_intval, 1)))) { + if ($truthy((($a = pcwidth_intval['$=='](0)) ? ($truthy($b = pcwidth['$==']("0")) ? $b : pcwidth['$==']("0%")) : pcwidth_intval['$=='](0)))) { + } else { + pcwidth_intval = 100 + }} + } else { + pcwidth_intval = 100 + }; + + $writer = ["tablepcwidth", pcwidth_intval]; + $send(self.attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + if ($truthy(self.document.$attributes()['$key?']("pagewidth"))) { + ($truthy($a = self.attributes['$[]']("tableabswidth")) ? $a : (($writer = ["tableabswidth", $rb_times($rb_divide(self.attributes['$[]']("tablepcwidth").$to_f(), 100), self.document.$attributes()['$[]']("pagewidth")).$round()]), $send(self.attributes, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]))}; + if ($truthy(attributes['$key?']("rotate-option"))) { + + $writer = ["orientation", "landscape"]; + $send(attributes, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + } else { + return nil + }; + }, TMP_Table_initialize_3.$$arity = 2); + + Opal.def(self, '$header_row?', TMP_Table_header_row$q_4 = function() { + var $a, self = this; + + return ($truthy($a = self.has_header_option) ? self.rows.$body()['$empty?']() : $a) + }, TMP_Table_header_row$q_4.$$arity = 0); + + Opal.def(self, '$create_columns', TMP_Table_create_columns_5 = function $$create_columns(colspecs) { + var TMP_6, $a, self = this, cols = nil, autowidth_cols = nil, width_base = nil, num_cols = nil, $writer = nil; + + + cols = []; + autowidth_cols = nil; + width_base = 0; + $send(colspecs, 'each', [], (TMP_6 = function(colspec){var self = TMP_6.$$s || this, $a, colwidth = nil; + + + + if (colspec == null) { + colspec = nil; + }; + colwidth = colspec['$[]']("width"); + cols['$<<']($$($nesting, 'Column').$new(self, cols.$size(), colspec)); + if ($truthy($rb_lt(colwidth, 0))) { + return (autowidth_cols = ($truthy($a = autowidth_cols) ? $a : []))['$<<'](cols['$[]'](-1)) + } else { + return (width_base = $rb_plus(width_base, colwidth)) + };}, TMP_6.$$s = self, TMP_6.$$arity = 1, TMP_6)); + if ($truthy($rb_gt((num_cols = (self.columns = cols).$size()), 0))) { + + + $writer = ["colcount", num_cols]; + $send(self.attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + if ($truthy(($truthy($a = $rb_gt(width_base, 0)) ? $a : autowidth_cols))) { + } else { + width_base = nil + }; + self.$assign_column_widths(width_base, autowidth_cols);}; + return nil; + }, TMP_Table_create_columns_5.$$arity = 1); + + Opal.def(self, '$assign_column_widths', TMP_Table_assign_column_widths_7 = function $$assign_column_widths(width_base, autowidth_cols) { + var TMP_8, TMP_9, TMP_10, self = this, pf = nil, total_width = nil, col_pcwidth = nil, autowidth = nil, autowidth_attrs = nil; + + + + if (width_base == null) { + width_base = nil; + }; + + if (autowidth_cols == null) { + autowidth_cols = nil; + }; + pf = $$($nesting, 'DEFAULT_PRECISION_FACTOR'); + total_width = (col_pcwidth = 0); + if ($truthy(width_base)) { + + if ($truthy(autowidth_cols)) { + + if ($truthy($rb_gt(width_base, 100))) { + + autowidth = 0; + self.$logger().$warn("" + "total column width must not exceed 100% when using autowidth columns; got " + (width_base) + "%"); + } else { + + autowidth = $rb_divide($rb_times($rb_divide($rb_minus(100, width_base), autowidth_cols.$size()), pf).$to_i(), pf); + if (autowidth.$to_i()['$=='](autowidth)) { + autowidth = autowidth.$to_i()}; + width_base = 100; + }; + autowidth_attrs = $hash2(["width", "autowidth-option"], {"width": autowidth, "autowidth-option": ""}); + $send(autowidth_cols, 'each', [], (TMP_8 = function(col){var self = TMP_8.$$s || this; + + + + if (col == null) { + col = nil; + }; + return col.$update_attributes(autowidth_attrs);}, TMP_8.$$s = self, TMP_8.$$arity = 1, TMP_8));}; + $send(self.columns, 'each', [], (TMP_9 = function(col){var self = TMP_9.$$s || this; + + + + if (col == null) { + col = nil; + }; + return (total_width = $rb_plus(total_width, (col_pcwidth = col.$assign_width(nil, width_base, pf))));}, TMP_9.$$s = self, TMP_9.$$arity = 1, TMP_9)); + } else { + + col_pcwidth = $rb_divide($rb_divide($rb_times(100, pf), self.columns.$size()).$to_i(), pf); + if (col_pcwidth.$to_i()['$=='](col_pcwidth)) { + col_pcwidth = col_pcwidth.$to_i()}; + $send(self.columns, 'each', [], (TMP_10 = function(col){var self = TMP_10.$$s || this; + + + + if (col == null) { + col = nil; + }; + return (total_width = $rb_plus(total_width, col.$assign_width(col_pcwidth)));}, TMP_10.$$s = self, TMP_10.$$arity = 1, TMP_10)); + }; + if (total_width['$=='](100)) { + } else { + self.columns['$[]'](-1).$assign_width($rb_divide($rb_times($rb_plus($rb_minus(100, total_width), col_pcwidth), pf).$round(), pf)) + }; + return nil; + }, TMP_Table_assign_column_widths_7.$$arity = -1); + return (Opal.def(self, '$partition_header_footer', TMP_Table_partition_header_footer_11 = function $$partition_header_footer(attrs) { + var $a, TMP_12, self = this, $writer = nil, num_body_rows = nil, head = nil; + + + + $writer = ["rowcount", self.rows.$body().$size()]; + $send(self.attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + num_body_rows = self.rows.$body().$size(); + if ($truthy(($truthy($a = $rb_gt(num_body_rows, 0)) ? self.has_header_option : $a))) { + + head = self.rows.$body().$shift(); + num_body_rows = $rb_minus(num_body_rows, 1); + $send(head, 'each', [], (TMP_12 = function(c){var self = TMP_12.$$s || this; + + + + if (c == null) { + c = nil; + }; + $writer = [nil]; + $send(c, 'style=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];}, TMP_12.$$s = self, TMP_12.$$arity = 1, TMP_12)); + + $writer = [[head]]; + $send(self.rows, 'head=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];;}; + if ($truthy(($truthy($a = $rb_gt(num_body_rows, 0)) ? attrs['$key?']("footer-option") : $a))) { + + $writer = [[self.rows.$body().$pop()]]; + $send(self.rows, 'foot=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + return nil; + }, TMP_Table_partition_header_footer_11.$$arity = 1), nil) && 'partition_header_footer'; + })($nesting[0], $$($nesting, 'AbstractBlock'), $nesting); + (function($base, $super, $parent_nesting) { + function $Column(){}; + var self = $Column = $klass($base, $super, 'Column', $Column); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Column_initialize_13, TMP_Column_assign_width_14; + + def.attributes = nil; + + self.$attr_accessor("style"); + + Opal.def(self, '$initialize', TMP_Column_initialize_13 = function $$initialize(table, index, attributes) { + var $a, $iter = TMP_Column_initialize_13.$$p, $yield = $iter || nil, self = this, $writer = nil; + + if ($iter) TMP_Column_initialize_13.$$p = null; + + + if (attributes == null) { + attributes = $hash2([], {}); + }; + $send(self, Opal.find_super_dispatcher(self, 'initialize', TMP_Column_initialize_13, false), [table, "column"], null); + self.style = attributes['$[]']("style"); + + $writer = ["colnumber", $rb_plus(index, 1)]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + ($truthy($a = attributes['$[]']("width")) ? $a : (($writer = ["width", 1]), $send(attributes, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + ($truthy($a = attributes['$[]']("halign")) ? $a : (($writer = ["halign", "left"]), $send(attributes, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + ($truthy($a = attributes['$[]']("valign")) ? $a : (($writer = ["valign", "top"]), $send(attributes, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + return self.$update_attributes(attributes); + }, TMP_Column_initialize_13.$$arity = -3); + Opal.alias(self, "table", "parent"); + return (Opal.def(self, '$assign_width', TMP_Column_assign_width_14 = function $$assign_width(col_pcwidth, width_base, pf) { + var self = this, $writer = nil; + + + + if (width_base == null) { + width_base = nil; + }; + + if (pf == null) { + pf = 10000; + }; + if ($truthy(width_base)) { + + col_pcwidth = $rb_divide($rb_times($rb_times($rb_divide(self.attributes['$[]']("width").$to_f(), width_base), 100), pf).$to_i(), pf); + if (col_pcwidth.$to_i()['$=='](col_pcwidth)) { + col_pcwidth = col_pcwidth.$to_i()};}; + + $writer = ["colpcwidth", col_pcwidth]; + $send(self.attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + if ($truthy(self.$parent().$attributes()['$key?']("tableabswidth"))) { + + $writer = ["colabswidth", $rb_times($rb_divide(col_pcwidth, 100), self.$parent().$attributes()['$[]']("tableabswidth")).$round()]; + $send(self.attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + return col_pcwidth; + }, TMP_Column_assign_width_14.$$arity = -2), nil) && 'assign_width'; + })($$($nesting, 'Table'), $$($nesting, 'AbstractNode'), $nesting); + (function($base, $super, $parent_nesting) { + function $Cell(){}; + var self = $Cell = $klass($base, $super, 'Cell', $Cell); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Cell_initialize_15, TMP_Cell_text_16, TMP_Cell_text$eq_17, TMP_Cell_content_18, TMP_Cell_file_20, TMP_Cell_lineno_21, TMP_Cell_to_s_22; + + def.document = def.text = def.subs = def.style = def.inner_document = def.source_location = def.colspan = def.rowspan = def.attributes = nil; + + self.$attr_reader("source_location"); + self.$attr_accessor("style"); + self.$attr_accessor("subs"); + self.$attr_accessor("colspan"); + self.$attr_accessor("rowspan"); + Opal.alias(self, "column", "parent"); + self.$attr_reader("inner_document"); + + Opal.def(self, '$initialize', TMP_Cell_initialize_15 = function $$initialize(column, cell_text, attributes, opts) { + var $a, $b, $iter = TMP_Cell_initialize_15.$$p, $yield = $iter || nil, self = this, in_header_row = nil, cell_style = nil, asciidoc = nil, inner_document_cursor = nil, lines_advanced = nil, literal = nil, normal_psv = nil, parent_doctitle = nil, inner_document_lines = nil, unprocessed_line1 = nil, preprocessed_lines = nil, $writer = nil; + + if ($iter) TMP_Cell_initialize_15.$$p = null; + + + if (attributes == null) { + attributes = $hash2([], {}); + }; + + if (opts == null) { + opts = $hash2([], {}); + }; + $send(self, Opal.find_super_dispatcher(self, 'initialize', TMP_Cell_initialize_15, false), [column, "cell"], null); + if ($truthy(self.document.$sourcemap())) { + self.source_location = opts['$[]']("cursor").$dup()}; + if ($truthy(column)) { + + if ($truthy((in_header_row = column.$table()['$header_row?']()))) { + } else { + cell_style = column.$attributes()['$[]']("style") + }; + self.$update_attributes(column.$attributes());}; + if ($truthy(attributes)) { + + if ($truthy(attributes['$empty?']())) { + self.colspan = (self.rowspan = nil) + } else { + + $a = [attributes.$delete("colspan"), attributes.$delete("rowspan")], (self.colspan = $a[0]), (self.rowspan = $a[1]), $a; + if ($truthy(in_header_row)) { + } else { + cell_style = ($truthy($a = attributes['$[]']("style")) ? $a : cell_style) + }; + self.$update_attributes(attributes); + }; + if (cell_style['$==']("asciidoc")) { + + asciidoc = true; + inner_document_cursor = opts['$[]']("cursor"); + if ($truthy((cell_text = cell_text.$rstrip())['$start_with?']($$($nesting, 'LF')))) { + + lines_advanced = 1; + while ($truthy((cell_text = cell_text.$slice(1, cell_text.$length()))['$start_with?']($$($nesting, 'LF')))) { + lines_advanced = $rb_plus(lines_advanced, 1) + }; + inner_document_cursor.$advance(lines_advanced); + } else { + cell_text = cell_text.$lstrip() + }; + } else if ($truthy(($truthy($a = (literal = cell_style['$==']("literal"))) ? $a : cell_style['$==']("verse")))) { + + cell_text = cell_text.$rstrip(); + while ($truthy(cell_text['$start_with?']($$($nesting, 'LF')))) { + cell_text = cell_text.$slice(1, cell_text.$length()) + }; + } else { + + normal_psv = true; + cell_text = (function() {if ($truthy(cell_text)) { + return cell_text.$strip() + } else { + return "" + }; return nil; })(); + }; + } else { + + self.colspan = (self.rowspan = nil); + if (cell_style['$==']("asciidoc")) { + + asciidoc = true; + inner_document_cursor = opts['$[]']("cursor");}; + }; + if ($truthy(asciidoc)) { + + parent_doctitle = self.document.$attributes().$delete("doctitle"); + inner_document_lines = cell_text.$split($$($nesting, 'LF'), -1); + if ($truthy(inner_document_lines['$empty?']())) { + } else if ($truthy((unprocessed_line1 = inner_document_lines['$[]'](0))['$include?']("::"))) { + + preprocessed_lines = $$($nesting, 'PreprocessorReader').$new(self.document, [unprocessed_line1]).$readlines(); + if ($truthy((($a = unprocessed_line1['$=='](preprocessed_lines['$[]'](0))) ? $rb_lt(preprocessed_lines.$size(), 2) : unprocessed_line1['$=='](preprocessed_lines['$[]'](0))))) { + } else { + + inner_document_lines.$shift(); + if ($truthy(preprocessed_lines['$empty?']())) { + } else { + $send(inner_document_lines, 'unshift', Opal.to_a(preprocessed_lines)) + }; + };}; + self.inner_document = $$($nesting, 'Document').$new(inner_document_lines, $hash2(["header_footer", "parent", "cursor"], {"header_footer": false, "parent": self.document, "cursor": inner_document_cursor})); + if ($truthy(parent_doctitle['$nil?']())) { + } else { + + $writer = ["doctitle", parent_doctitle]; + $send(self.document.$attributes(), '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + self.subs = nil; + } else if ($truthy(literal)) { + self.subs = $$($nesting, 'BASIC_SUBS') + } else { + + if ($truthy(($truthy($a = ($truthy($b = normal_psv) ? cell_text['$start_with?']("[[") : $b)) ? $$($nesting, 'LeadingInlineAnchorRx')['$=~'](cell_text) : $a))) { + $$($nesting, 'Parser').$catalog_inline_anchor((($a = $gvars['~']) === nil ? nil : $a['$[]'](1)), (($a = $gvars['~']) === nil ? nil : $a['$[]'](2)), self, opts['$[]']("cursor"), self.document)}; + self.subs = $$($nesting, 'NORMAL_SUBS'); + }; + self.text = cell_text; + return (self.style = cell_style); + }, TMP_Cell_initialize_15.$$arity = -3); + + Opal.def(self, '$text', TMP_Cell_text_16 = function $$text() { + var self = this; + + return self.$apply_subs(self.text, self.subs) + }, TMP_Cell_text_16.$$arity = 0); + + Opal.def(self, '$text=', TMP_Cell_text$eq_17 = function(val) { + var self = this; + + return (self.text = val) + }, TMP_Cell_text$eq_17.$$arity = 1); + + Opal.def(self, '$content', TMP_Cell_content_18 = function $$content() { + var TMP_19, self = this; + + if (self.style['$==']("asciidoc")) { + return self.inner_document.$convert() + } else { + return $send(self.$text().$split($$($nesting, 'BlankLineRx')), 'map', [], (TMP_19 = function(p){var self = TMP_19.$$s || this, $a; + if (self.style == null) self.style = nil; + + + + if (p == null) { + p = nil; + }; + if ($truthy(($truthy($a = self.style['$!']()) ? $a : self.style['$==']("header")))) { + return p + } else { + return $$($nesting, 'Inline').$new(self.$parent(), "quoted", p, $hash2(["type"], {"type": self.style})).$convert() + };}, TMP_19.$$s = self, TMP_19.$$arity = 1, TMP_19)) + } + }, TMP_Cell_content_18.$$arity = 0); + + Opal.def(self, '$file', TMP_Cell_file_20 = function $$file() { + var $a, self = this; + + return ($truthy($a = self.source_location) ? self.source_location.$file() : $a) + }, TMP_Cell_file_20.$$arity = 0); + + Opal.def(self, '$lineno', TMP_Cell_lineno_21 = function $$lineno() { + var $a, self = this; + + return ($truthy($a = self.source_location) ? self.source_location.$lineno() : $a) + }, TMP_Cell_lineno_21.$$arity = 0); + return (Opal.def(self, '$to_s', TMP_Cell_to_s_22 = function $$to_s() { + var $a, $iter = TMP_Cell_to_s_22.$$p, $yield = $iter || nil, self = this, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_Cell_to_s_22.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + return "" + ($send(self, Opal.find_super_dispatcher(self, 'to_s', TMP_Cell_to_s_22, false), $zuper, $iter).$to_s()) + " - [text: " + (self.text) + ", colspan: " + (($truthy($a = self.colspan) ? $a : 1)) + ", rowspan: " + (($truthy($a = self.rowspan) ? $a : 1)) + ", attributes: " + (self.attributes) + "]" + }, TMP_Cell_to_s_22.$$arity = 0), nil) && 'to_s'; + })($$($nesting, 'Table'), $$($nesting, 'AbstractNode'), $nesting); + (function($base, $super, $parent_nesting) { + function $ParserContext(){}; + var self = $ParserContext = $klass($base, $super, 'ParserContext', $ParserContext); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_ParserContext_initialize_23, TMP_ParserContext_starts_with_delimiter$q_24, TMP_ParserContext_match_delimiter_25, TMP_ParserContext_skip_past_delimiter_26, TMP_ParserContext_skip_past_escaped_delimiter_27, TMP_ParserContext_buffer_has_unclosed_quotes$q_28, TMP_ParserContext_take_cellspec_29, TMP_ParserContext_push_cellspec_30, TMP_ParserContext_keep_cell_open_31, TMP_ParserContext_mark_cell_closed_32, TMP_ParserContext_cell_open$q_33, TMP_ParserContext_cell_closed$q_34, TMP_ParserContext_close_open_cell_35, TMP_ParserContext_close_cell_36, TMP_ParserContext_close_row_39, TMP_ParserContext_activate_rowspan_40, TMP_ParserContext_end_of_row$q_42, TMP_ParserContext_effective_column_visits_43, TMP_ParserContext_advance_44; + + def.delimiter = def.delimiter_re = def.buffer = def.cellspecs = def.cell_open = def.format = def.start_cursor_data = def.reader = def.table = def.current_row = def.colcount = def.column_visits = def.active_rowspans = def.linenum = nil; + + self.$include($$($nesting, 'Logging')); + Opal.const_set($nesting[0], 'FORMATS', ["psv", "csv", "dsv", "tsv"].$to_set()); + Opal.const_set($nesting[0], 'DELIMITERS', $hash2(["psv", "csv", "dsv", "tsv", "!sv"], {"psv": ["|", /\|/], "csv": [",", /,/], "dsv": [":", /:/], "tsv": ["\t", /\t/], "!sv": ["!", /!/]})); + self.$attr_accessor("table"); + self.$attr_accessor("format"); + self.$attr_reader("colcount"); + self.$attr_accessor("buffer"); + self.$attr_reader("delimiter"); + self.$attr_reader("delimiter_re"); + + Opal.def(self, '$initialize', TMP_ParserContext_initialize_23 = function $$initialize(reader, table, attributes) { + var $a, $b, self = this, xsv = nil, sep = nil; + + + + if (attributes == null) { + attributes = $hash2([], {}); + }; + self.start_cursor_data = (self.reader = reader).$mark(); + self.table = table; + if ($truthy(attributes['$key?']("format"))) { + if ($truthy($$($nesting, 'FORMATS')['$include?']((xsv = attributes['$[]']("format"))))) { + if (xsv['$==']("tsv")) { + self.format = "csv" + } else if ($truthy((($a = (self.format = xsv)['$==']("psv")) ? table.$document()['$nested?']() : (self.format = xsv)['$==']("psv")))) { + xsv = "!sv"} + } else { + + self.$logger().$error(self.$message_with_context("" + "illegal table format: " + (xsv), $hash2(["source_location"], {"source_location": reader.$cursor_at_prev_line()}))); + $a = ["psv", (function() {if ($truthy(table.$document()['$nested?']())) { + return "!sv" + } else { + return "psv" + }; return nil; })()], (self.format = $a[0]), (xsv = $a[1]), $a; + } + } else { + $a = ["psv", (function() {if ($truthy(table.$document()['$nested?']())) { + return "!sv" + } else { + return "psv" + }; return nil; })()], (self.format = $a[0]), (xsv = $a[1]), $a + }; + if ($truthy(attributes['$key?']("separator"))) { + if ($truthy((sep = attributes['$[]']("separator"))['$nil_or_empty?']())) { + $b = $$($nesting, 'DELIMITERS')['$[]'](xsv), $a = Opal.to_ary($b), (self.delimiter = ($a[0] == null ? nil : $a[0])), (self.delimiter_re = ($a[1] == null ? nil : $a[1])), $b + } else if (sep['$==']("\\t")) { + $b = $$($nesting, 'DELIMITERS')['$[]']("tsv"), $a = Opal.to_ary($b), (self.delimiter = ($a[0] == null ? nil : $a[0])), (self.delimiter_re = ($a[1] == null ? nil : $a[1])), $b + } else { + $a = [sep, new RegExp($$$('::', 'Regexp').$escape(sep))], (self.delimiter = $a[0]), (self.delimiter_re = $a[1]), $a + } + } else { + $b = $$($nesting, 'DELIMITERS')['$[]'](xsv), $a = Opal.to_ary($b), (self.delimiter = ($a[0] == null ? nil : $a[0])), (self.delimiter_re = ($a[1] == null ? nil : $a[1])), $b + }; + self.colcount = (function() {if ($truthy(table.$columns()['$empty?']())) { + return -1 + } else { + return table.$columns().$size() + }; return nil; })(); + self.buffer = ""; + self.cellspecs = []; + self.cell_open = false; + self.active_rowspans = [0]; + self.column_visits = 0; + self.current_row = []; + return (self.linenum = -1); + }, TMP_ParserContext_initialize_23.$$arity = -3); + + Opal.def(self, '$starts_with_delimiter?', TMP_ParserContext_starts_with_delimiter$q_24 = function(line) { + var self = this; + + return line['$start_with?'](self.delimiter) + }, TMP_ParserContext_starts_with_delimiter$q_24.$$arity = 1); + + Opal.def(self, '$match_delimiter', TMP_ParserContext_match_delimiter_25 = function $$match_delimiter(line) { + var self = this; + + return self.delimiter_re.$match(line) + }, TMP_ParserContext_match_delimiter_25.$$arity = 1); + + Opal.def(self, '$skip_past_delimiter', TMP_ParserContext_skip_past_delimiter_26 = function $$skip_past_delimiter(pre) { + var self = this; + + + self.buffer = "" + (self.buffer) + (pre) + (self.delimiter); + return nil; + }, TMP_ParserContext_skip_past_delimiter_26.$$arity = 1); + + Opal.def(self, '$skip_past_escaped_delimiter', TMP_ParserContext_skip_past_escaped_delimiter_27 = function $$skip_past_escaped_delimiter(pre) { + var self = this; + + + self.buffer = "" + (self.buffer) + (pre.$chop()) + (self.delimiter); + return nil; + }, TMP_ParserContext_skip_past_escaped_delimiter_27.$$arity = 1); + + Opal.def(self, '$buffer_has_unclosed_quotes?', TMP_ParserContext_buffer_has_unclosed_quotes$q_28 = function(append) { + var $a, $b, self = this, record = nil, trailing_quote = nil; + + + + if (append == null) { + append = nil; + }; + if ((record = (function() {if ($truthy(append)) { + return $rb_plus(self.buffer, append).$strip() + } else { + return self.buffer.$strip() + }; return nil; })())['$==']("\"")) { + return true + } else if ($truthy(record['$start_with?']("\""))) { + if ($truthy(($truthy($a = ($truthy($b = (trailing_quote = record['$end_with?']("\""))) ? record['$end_with?']("\"\"") : $b)) ? $a : record['$start_with?']("\"\"")))) { + return ($truthy($a = (record = record.$gsub("\"\"", ""))['$start_with?']("\"")) ? record['$end_with?']("\"")['$!']() : $a) + } else { + return trailing_quote['$!']() + } + } else { + return false + }; + }, TMP_ParserContext_buffer_has_unclosed_quotes$q_28.$$arity = -1); + + Opal.def(self, '$take_cellspec', TMP_ParserContext_take_cellspec_29 = function $$take_cellspec() { + var self = this; + + return self.cellspecs.$shift() + }, TMP_ParserContext_take_cellspec_29.$$arity = 0); + + Opal.def(self, '$push_cellspec', TMP_ParserContext_push_cellspec_30 = function $$push_cellspec(cellspec) { + var $a, self = this; + + + + if (cellspec == null) { + cellspec = $hash2([], {}); + }; + self.cellspecs['$<<'](($truthy($a = cellspec) ? $a : $hash2([], {}))); + return nil; + }, TMP_ParserContext_push_cellspec_30.$$arity = -1); + + Opal.def(self, '$keep_cell_open', TMP_ParserContext_keep_cell_open_31 = function $$keep_cell_open() { + var self = this; + + + self.cell_open = true; + return nil; + }, TMP_ParserContext_keep_cell_open_31.$$arity = 0); + + Opal.def(self, '$mark_cell_closed', TMP_ParserContext_mark_cell_closed_32 = function $$mark_cell_closed() { + var self = this; + + + self.cell_open = false; + return nil; + }, TMP_ParserContext_mark_cell_closed_32.$$arity = 0); + + Opal.def(self, '$cell_open?', TMP_ParserContext_cell_open$q_33 = function() { + var self = this; + + return self.cell_open + }, TMP_ParserContext_cell_open$q_33.$$arity = 0); + + Opal.def(self, '$cell_closed?', TMP_ParserContext_cell_closed$q_34 = function() { + var self = this; + + return self.cell_open['$!']() + }, TMP_ParserContext_cell_closed$q_34.$$arity = 0); + + Opal.def(self, '$close_open_cell', TMP_ParserContext_close_open_cell_35 = function $$close_open_cell(next_cellspec) { + var self = this; + + + + if (next_cellspec == null) { + next_cellspec = $hash2([], {}); + }; + self.$push_cellspec(next_cellspec); + if ($truthy(self['$cell_open?']())) { + self.$close_cell(true)}; + self.$advance(); + return nil; + }, TMP_ParserContext_close_open_cell_35.$$arity = -1); + + Opal.def(self, '$close_cell', TMP_ParserContext_close_cell_36 = function $$close_cell(eol) {try { + + var $a, $b, TMP_37, self = this, cell_text = nil, cellspec = nil, repeat = nil; + + + + if (eol == null) { + eol = false; + }; + if (self.format['$==']("psv")) { + + cell_text = self.buffer; + self.buffer = ""; + if ($truthy((cellspec = self.$take_cellspec()))) { + repeat = ($truthy($a = cellspec.$delete("repeatcol")) ? $a : 1) + } else { + + self.$logger().$error(self.$message_with_context("table missing leading separator; recovering automatically", $hash2(["source_location"], {"source_location": $send($$$($$($nesting, 'Reader'), 'Cursor'), 'new', Opal.to_a(self.start_cursor_data))}))); + cellspec = $hash2([], {}); + repeat = 1; + }; + } else { + + cell_text = self.buffer.$strip(); + self.buffer = ""; + cellspec = nil; + repeat = 1; + if ($truthy(($truthy($a = (($b = self.format['$==']("csv")) ? cell_text['$empty?']()['$!']() : self.format['$==']("csv"))) ? cell_text['$include?']("\"") : $a))) { + if ($truthy(($truthy($a = cell_text['$start_with?']("\"")) ? cell_text['$end_with?']("\"") : $a))) { + if ($truthy((cell_text = cell_text.$slice(1, $rb_minus(cell_text.$length(), 2))))) { + cell_text = cell_text.$strip().$squeeze("\"") + } else { + + self.$logger().$error(self.$message_with_context("unclosed quote in CSV data; setting cell to empty", $hash2(["source_location"], {"source_location": self.reader.$cursor_at_prev_line()}))); + cell_text = ""; + } + } else { + cell_text = cell_text.$squeeze("\"") + }}; + }; + $send((1), 'upto', [repeat], (TMP_37 = function(i){var self = TMP_37.$$s || this, $c, $d, TMP_38, $e, column = nil, extra_cols = nil, offset = nil, cell = nil; + if (self.colcount == null) self.colcount = nil; + if (self.table == null) self.table = nil; + if (self.current_row == null) self.current_row = nil; + if (self.reader == null) self.reader = nil; + if (self.column_visits == null) self.column_visits = nil; + if (self.linenum == null) self.linenum = nil; + + + + if (i == null) { + i = nil; + }; + if (self.colcount['$=='](-1)) { + + self.table.$columns()['$<<']((column = $$$($$($nesting, 'Table'), 'Column').$new(self.table, $rb_minus($rb_plus(self.table.$columns().$size(), i), 1)))); + if ($truthy(($truthy($c = ($truthy($d = cellspec) ? cellspec['$key?']("colspan") : $d)) ? $rb_gt((extra_cols = $rb_minus(cellspec['$[]']("colspan").$to_i(), 1)), 0) : $c))) { + + offset = self.table.$columns().$size(); + $send(extra_cols, 'times', [], (TMP_38 = function(j){var self = TMP_38.$$s || this; + if (self.table == null) self.table = nil; + + + + if (j == null) { + j = nil; + }; + return self.table.$columns()['$<<']($$$($$($nesting, 'Table'), 'Column').$new(self.table, $rb_plus(offset, j)));}, TMP_38.$$s = self, TMP_38.$$arity = 1, TMP_38));}; + } else if ($truthy((column = self.table.$columns()['$[]'](self.current_row.$size())))) { + } else { + + self.$logger().$error(self.$message_with_context("dropping cell because it exceeds specified number of columns", $hash2(["source_location"], {"source_location": self.reader.$cursor_before_mark()}))); + Opal.ret(nil); + }; + cell = $$$($$($nesting, 'Table'), 'Cell').$new(column, cell_text, cellspec, $hash2(["cursor"], {"cursor": self.reader.$cursor_before_mark()})); + self.reader.$mark(); + if ($truthy(($truthy($c = cell.$rowspan()['$!']()) ? $c : cell.$rowspan()['$=='](1)))) { + } else { + self.$activate_rowspan(cell.$rowspan(), ($truthy($c = cell.$colspan()) ? $c : 1)) + }; + self.column_visits = $rb_plus(self.column_visits, ($truthy($c = cell.$colspan()) ? $c : 1)); + self.current_row['$<<'](cell); + if ($truthy(($truthy($c = self['$end_of_row?']()) ? ($truthy($d = ($truthy($e = self.colcount['$!='](-1)) ? $e : $rb_gt(self.linenum, 0))) ? $d : ($truthy($e = eol) ? i['$=='](repeat) : $e)) : $c))) { + return self.$close_row() + } else { + return nil + };}, TMP_37.$$s = self, TMP_37.$$arity = 1, TMP_37)); + self.cell_open = false; + return nil; + } catch ($returner) { if ($returner === Opal.returner) { return $returner.$v } throw $returner; } + }, TMP_ParserContext_close_cell_36.$$arity = -1); + + Opal.def(self, '$close_row', TMP_ParserContext_close_row_39 = function $$close_row() { + var $a, self = this, $writer = nil; + + + self.table.$rows().$body()['$<<'](self.current_row); + if (self.colcount['$=='](-1)) { + self.colcount = self.column_visits}; + self.column_visits = 0; + self.current_row = []; + self.active_rowspans.$shift(); + ($truthy($a = self.active_rowspans['$[]'](0)) ? $a : (($writer = [0, 0]), $send(self.active_rowspans, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + return nil; + }, TMP_ParserContext_close_row_39.$$arity = 0); + + Opal.def(self, '$activate_rowspan', TMP_ParserContext_activate_rowspan_40 = function $$activate_rowspan(rowspan, colspan) { + var TMP_41, self = this; + + + $send((1).$upto($rb_minus(rowspan, 1)), 'each', [], (TMP_41 = function(i){var self = TMP_41.$$s || this, $a, $writer = nil; + if (self.active_rowspans == null) self.active_rowspans = nil; + + + + if (i == null) { + i = nil; + }; + $writer = [i, $rb_plus(($truthy($a = self.active_rowspans['$[]'](i)) ? $a : 0), colspan)]; + $send(self.active_rowspans, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];}, TMP_41.$$s = self, TMP_41.$$arity = 1, TMP_41)); + return nil; + }, TMP_ParserContext_activate_rowspan_40.$$arity = 2); + + Opal.def(self, '$end_of_row?', TMP_ParserContext_end_of_row$q_42 = function() { + var $a, self = this; + + return ($truthy($a = self.colcount['$=='](-1)) ? $a : self.$effective_column_visits()['$=='](self.colcount)) + }, TMP_ParserContext_end_of_row$q_42.$$arity = 0); + + Opal.def(self, '$effective_column_visits', TMP_ParserContext_effective_column_visits_43 = function $$effective_column_visits() { + var self = this; + + return $rb_plus(self.column_visits, self.active_rowspans['$[]'](0)) + }, TMP_ParserContext_effective_column_visits_43.$$arity = 0); + return (Opal.def(self, '$advance', TMP_ParserContext_advance_44 = function $$advance() { + var self = this; + + return (self.linenum = $rb_plus(self.linenum, 1)) + }, TMP_ParserContext_advance_44.$$arity = 0), nil) && 'advance'; + })($$($nesting, 'Table'), null, $nesting); + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/converter/composite"] = function(Opal) { + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $send = Opal.send, $truthy = Opal.truthy, $hash2 = Opal.hash2; + + Opal.add_stubs(['$attr_reader', '$each', '$compact', '$flatten', '$respond_to?', '$composed', '$node_name', '$convert', '$converter_for', '$[]', '$find_converter', '$[]=', '$-', '$handles?', '$raise']); + return (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + (function($base, $super, $parent_nesting) { + function $CompositeConverter(){}; + var self = $CompositeConverter = $klass($base, $super, 'CompositeConverter', $CompositeConverter); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_CompositeConverter_initialize_1, TMP_CompositeConverter_convert_3, TMP_CompositeConverter_converter_for_4, TMP_CompositeConverter_find_converter_5; + + def.converter_map = def.converters = nil; + + self.$attr_reader("converters"); + + Opal.def(self, '$initialize', TMP_CompositeConverter_initialize_1 = function $$initialize(backend, $a) { + var $post_args, converters, TMP_2, self = this; + + + + $post_args = Opal.slice.call(arguments, 1, arguments.length); + + converters = $post_args;; + self.backend = backend; + $send((self.converters = converters.$flatten().$compact()), 'each', [], (TMP_2 = function(converter){var self = TMP_2.$$s || this; + + + + if (converter == null) { + converter = nil; + }; + if ($truthy(converter['$respond_to?']("composed"))) { + return converter.$composed(self) + } else { + return nil + };}, TMP_2.$$s = self, TMP_2.$$arity = 1, TMP_2)); + return (self.converter_map = $hash2([], {})); + }, TMP_CompositeConverter_initialize_1.$$arity = -2); + + Opal.def(self, '$convert', TMP_CompositeConverter_convert_3 = function $$convert(node, transform, opts) { + var $a, self = this; + + + + if (transform == null) { + transform = nil; + }; + + if (opts == null) { + opts = $hash2([], {}); + }; + transform = ($truthy($a = transform) ? $a : node.$node_name()); + return self.$converter_for(transform).$convert(node, transform, opts); + }, TMP_CompositeConverter_convert_3.$$arity = -2); + Opal.alias(self, "convert_with_options", "convert"); + + Opal.def(self, '$converter_for', TMP_CompositeConverter_converter_for_4 = function $$converter_for(transform) { + var $a, self = this, $writer = nil; + + return ($truthy($a = self.converter_map['$[]'](transform)) ? $a : (($writer = [transform, self.$find_converter(transform)]), $send(self.converter_map, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])) + }, TMP_CompositeConverter_converter_for_4.$$arity = 1); + return (Opal.def(self, '$find_converter', TMP_CompositeConverter_find_converter_5 = function $$find_converter(transform) {try { + + var TMP_6, self = this; + + + $send(self.converters, 'each', [], (TMP_6 = function(candidate){var self = TMP_6.$$s || this; + + + + if (candidate == null) { + candidate = nil; + }; + if ($truthy(candidate['$handles?'](transform))) { + Opal.ret(candidate) + } else { + return nil + };}, TMP_6.$$s = self, TMP_6.$$arity = 1, TMP_6)); + return self.$raise("" + "Could not find a converter to handle transform: " + (transform)); + } catch ($returner) { if ($returner === Opal.returner) { return $returner.$v } throw $returner; } + }, TMP_CompositeConverter_find_converter_5.$$arity = 1), nil) && 'find_converter'; + })($$($nesting, 'Converter'), $$$($$($nesting, 'Converter'), 'Base'), $nesting) + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/converter/html5"] = function(Opal) { + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + function $rb_gt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); + } + function $rb_plus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); + } + function $rb_le(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs <= rhs : lhs['$<='](rhs); + } + function $rb_lt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); + } + function $rb_times(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs * rhs : lhs['$*'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $send = Opal.send, $hash2 = Opal.hash2, $truthy = Opal.truthy, $gvars = Opal.gvars; + + Opal.add_stubs(['$default=', '$-', '$==', '$[]', '$instance', '$empty?', '$attr', '$attr?', '$<<', '$include?', '$gsub', '$extname', '$slice', '$length', '$doctitle', '$normalize_web_path', '$embed_primary_stylesheet', '$read_asset', '$normalize_system_path', '$===', '$coderay_stylesheet_name', '$embed_coderay_stylesheet', '$pygments_stylesheet_name', '$embed_pygments_stylesheet', '$docinfo', '$id', '$sections?', '$doctype', '$join', '$noheader', '$outline', '$generate_manname_section', '$has_header?', '$notitle', '$title', '$header', '$each', '$authors', '$>', '$name', '$email', '$sub_macros', '$+', '$downcase', '$concat', '$content', '$footnotes?', '$!', '$footnotes', '$index', '$text', '$nofooter', '$inspect', '$!=', '$to_i', '$attributes', '$document', '$sections', '$level', '$caption', '$captioned_title', '$numbered', '$<=', '$<', '$sectname', '$sectnum', '$role', '$title?', '$icon_uri', '$compact', '$media_uri', '$option?', '$append_boolean_attribute', '$style', '$items', '$blocks?', '$text?', '$chomp', '$safe', '$read_svg_contents', '$alt', '$image_uri', '$encode_quotes', '$append_link_constraint_attrs', '$pygments_background', '$to_sym', '$*', '$count', '$start_with?', '$end_with?', '$list_marker_keyword', '$parent', '$warn', '$logger', '$context', '$error', '$new', '$size', '$columns', '$by_section', '$rows', '$colspan', '$rowspan', '$role?', '$unshift', '$shift', '$split', '$nil_or_empty?', '$type', '$catalog', '$xreftext', '$target', '$map', '$chop', '$upcase', '$read_contents', '$sub', '$match']); + return (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + (function($base, $super, $parent_nesting) { + function $Html5Converter(){}; + var self = $Html5Converter = $klass($base, $super, 'Html5Converter', $Html5Converter); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Html5Converter_initialize_1, TMP_Html5Converter_document_2, TMP_Html5Converter_embedded_5, TMP_Html5Converter_outline_7, TMP_Html5Converter_section_9, TMP_Html5Converter_admonition_10, TMP_Html5Converter_audio_11, TMP_Html5Converter_colist_12, TMP_Html5Converter_dlist_15, TMP_Html5Converter_example_22, TMP_Html5Converter_floating_title_23, TMP_Html5Converter_image_24, TMP_Html5Converter_listing_25, TMP_Html5Converter_literal_26, TMP_Html5Converter_stem_27, TMP_Html5Converter_olist_29, TMP_Html5Converter_open_31, TMP_Html5Converter_page_break_32, TMP_Html5Converter_paragraph_33, TMP_Html5Converter_preamble_34, TMP_Html5Converter_quote_35, TMP_Html5Converter_thematic_break_36, TMP_Html5Converter_sidebar_37, TMP_Html5Converter_table_38, TMP_Html5Converter_toc_43, TMP_Html5Converter_ulist_44, TMP_Html5Converter_verse_46, TMP_Html5Converter_video_47, TMP_Html5Converter_inline_anchor_48, TMP_Html5Converter_inline_break_49, TMP_Html5Converter_inline_button_50, TMP_Html5Converter_inline_callout_51, TMP_Html5Converter_inline_footnote_52, TMP_Html5Converter_inline_image_53, TMP_Html5Converter_inline_indexterm_56, TMP_Html5Converter_inline_kbd_57, TMP_Html5Converter_inline_menu_58, TMP_Html5Converter_inline_quoted_59, TMP_Html5Converter_append_boolean_attribute_60, TMP_Html5Converter_encode_quotes_61, TMP_Html5Converter_generate_manname_section_62, TMP_Html5Converter_append_link_constraint_attrs_63, TMP_Html5Converter_read_svg_contents_64, $writer = nil; + + def.xml_mode = def.void_element_slash = def.stylesheets = def.pygments_bg = def.refs = nil; + + + $writer = [["", "", false]]; + $send(Opal.const_set($nesting[0], 'QUOTE_TAGS', $hash2(["monospaced", "emphasis", "strong", "double", "single", "mark", "superscript", "subscript", "asciimath", "latexmath"], {"monospaced": ["", "", true], "emphasis": ["", "", true], "strong": ["", "", true], "double": ["“", "”", false], "single": ["‘", "’", false], "mark": ["", "", true], "superscript": ["", "", true], "subscript": ["", "", true], "asciimath": ["\\$", "\\$", false], "latexmath": ["\\(", "\\)", false]})), 'default=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + Opal.const_set($nesting[0], 'DropAnchorRx', /<(?:a[^>+]+|\/a)>/); + Opal.const_set($nesting[0], 'StemBreakRx', / *\\\n(?:\\?\n)*|\n\n+/); + Opal.const_set($nesting[0], 'SvgPreambleRx', /^.*?(?=]*>/); + Opal.const_set($nesting[0], 'DimensionAttributeRx', /\s(?:width|height|style)=(["']).*?\1/); + + Opal.def(self, '$initialize', TMP_Html5Converter_initialize_1 = function $$initialize(backend, opts) { + var self = this; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + self.xml_mode = opts['$[]']("htmlsyntax")['$==']("xml"); + self.void_element_slash = (function() {if ($truthy(self.xml_mode)) { + return "/" + } else { + return nil + }; return nil; })(); + return (self.stylesheets = $$($nesting, 'Stylesheets').$instance()); + }, TMP_Html5Converter_initialize_1.$$arity = -2); + + Opal.def(self, '$document', TMP_Html5Converter_document_2 = function $$document(node) { + var $a, $b, $c, TMP_3, TMP_4, self = this, slash = nil, br = nil, asset_uri_scheme = nil, cdn_base = nil, linkcss = nil, result = nil, lang_attribute = nil, authors = nil, icon_href = nil, icon_type = nil, icon_ext = nil, webfonts = nil, iconfont_stylesheet = nil, $case = nil, highlighter = nil, pygments_style = nil, docinfo_content = nil, body_attrs = nil, sectioned = nil, classes = nil, details = nil, idx = nil, highlightjs_path = nil, prettify_path = nil, eqnums_val = nil, eqnums_opt = nil; + + + slash = self.void_element_slash; + br = "" + ""; + if ($truthy((asset_uri_scheme = node.$attr("asset-uri-scheme", "https"))['$empty?']())) { + } else { + asset_uri_scheme = "" + (asset_uri_scheme) + ":" + }; + cdn_base = "" + (asset_uri_scheme) + "//cdnjs.cloudflare.com/ajax/libs"; + linkcss = node['$attr?']("linkcss"); + result = [""]; + lang_attribute = (function() {if ($truthy(node['$attr?']("nolang"))) { + return "" + } else { + return "" + " lang=\"" + (node.$attr("lang", "en")) + "\"" + }; return nil; })(); + result['$<<']("" + ""); + result['$<<']("" + "\n" + "\n" + "\n" + "\n" + ""); + if ($truthy(node['$attr?']("app-name"))) { + result['$<<']("" + "")}; + if ($truthy(node['$attr?']("description"))) { + result['$<<']("" + "")}; + if ($truthy(node['$attr?']("keywords"))) { + result['$<<']("" + "")}; + if ($truthy(node['$attr?']("authors"))) { + result['$<<']("" + "")}; + if ($truthy(node['$attr?']("copyright"))) { + result['$<<']("" + "")}; + if ($truthy(node['$attr?']("favicon"))) { + + if ($truthy((icon_href = node.$attr("favicon"))['$empty?']())) { + $a = ["favicon.ico", "image/x-icon"], (icon_href = $a[0]), (icon_type = $a[1]), $a + } else { + icon_type = (function() {if ((icon_ext = $$$('::', 'File').$extname(icon_href))['$=='](".ico")) { + return "image/x-icon" + } else { + return "" + "image/" + (icon_ext.$slice(1, icon_ext.$length())) + }; return nil; })() + }; + result['$<<']("" + "");}; + result['$<<']("" + "" + (node.$doctitle($hash2(["sanitize", "use_fallback"], {"sanitize": true, "use_fallback": true}))) + ""); + if ($truthy($$($nesting, 'DEFAULT_STYLESHEET_KEYS')['$include?'](node.$attr("stylesheet")))) { + + if ($truthy((webfonts = node.$attr("webfonts")))) { + result['$<<']("" + "")}; + if ($truthy(linkcss)) { + result['$<<']("" + "") + } else { + result['$<<'](self.stylesheets.$embed_primary_stylesheet()) + }; + } else if ($truthy(node['$attr?']("stylesheet"))) { + if ($truthy(linkcss)) { + result['$<<']("" + "") + } else { + result['$<<']("" + "") + }}; + if ($truthy(node['$attr?']("icons", "font"))) { + if ($truthy(node['$attr?']("iconfont-remote"))) { + result['$<<']("" + "") + } else { + + iconfont_stylesheet = "" + (node.$attr("iconfont-name", "font-awesome")) + ".css"; + result['$<<']("" + ""); + }}; + $case = (highlighter = node.$attr("source-highlighter")); + if ("coderay"['$===']($case)) {if (node.$attr("coderay-css", "class")['$==']("class")) { + if ($truthy(linkcss)) { + result['$<<']("" + "") + } else { + result['$<<'](self.stylesheets.$embed_coderay_stylesheet()) + }}} + else if ("pygments"['$===']($case)) {if (node.$attr("pygments-css", "class")['$==']("class")) { + + pygments_style = node.$attr("pygments-style"); + if ($truthy(linkcss)) { + result['$<<']("" + "") + } else { + result['$<<'](self.stylesheets.$embed_pygments_stylesheet(pygments_style)) + };}}; + if ($truthy((docinfo_content = node.$docinfo())['$empty?']())) { + } else { + result['$<<'](docinfo_content) + }; + result['$<<'](""); + body_attrs = (function() {if ($truthy(node.$id())) { + return ["" + "id=\"" + (node.$id()) + "\""] + } else { + return [] + }; return nil; })(); + if ($truthy(($truthy($a = ($truthy($b = ($truthy($c = (sectioned = node['$sections?']())) ? node['$attr?']("toc-class") : $c)) ? node['$attr?']("toc") : $b)) ? node['$attr?']("toc-placement", "auto") : $a))) { + classes = [node.$doctype(), node.$attr("toc-class"), "" + "toc-" + (node.$attr("toc-position", "header"))] + } else { + classes = [node.$doctype()] + }; + if ($truthy(node['$attr?']("docrole"))) { + classes['$<<'](node.$attr("docrole"))}; + body_attrs['$<<']("" + "class=\"" + (classes.$join(" ")) + "\""); + if ($truthy(node['$attr?']("max-width"))) { + body_attrs['$<<']("" + "style=\"max-width: " + (node.$attr("max-width")) + ";\"")}; + result['$<<']("" + ""); + if ($truthy(node.$noheader())) { + } else { + + result['$<<']("
"); + if (node.$doctype()['$==']("manpage")) { + + result['$<<']("" + "

" + (node.$doctitle()) + " Manual Page

"); + if ($truthy(($truthy($a = ($truthy($b = sectioned) ? node['$attr?']("toc") : $b)) ? node['$attr?']("toc-placement", "auto") : $a))) { + result['$<<']("" + "
\n" + "
" + (node.$attr("toc-title")) + "
\n" + (self.$outline(node)) + "\n" + "
")}; + if ($truthy(node['$attr?']("manpurpose"))) { + result['$<<'](self.$generate_manname_section(node))}; + } else { + + if ($truthy(node['$has_header?']())) { + + if ($truthy(node.$notitle())) { + } else { + result['$<<']("" + "

" + (node.$header().$title()) + "

") + }; + details = []; + idx = 1; + $send(node.$authors(), 'each', [], (TMP_3 = function(author){var self = TMP_3.$$s || this; + + + + if (author == null) { + author = nil; + }; + details['$<<']("" + "" + (author.$name()) + "" + (br)); + if ($truthy(author.$email())) { + details['$<<']("" + "" + (node.$sub_macros(author.$email())) + "" + (br))}; + return (idx = $rb_plus(idx, 1));}, TMP_3.$$s = self, TMP_3.$$arity = 1, TMP_3)); + if ($truthy(node['$attr?']("revnumber"))) { + details['$<<']("" + "" + (($truthy($a = node.$attr("version-label")) ? $a : "").$downcase()) + " " + (node.$attr("revnumber")) + ((function() {if ($truthy(node['$attr?']("revdate"))) { + return "," + } else { + return "" + }; return nil; })()) + "")}; + if ($truthy(node['$attr?']("revdate"))) { + details['$<<']("" + "" + (node.$attr("revdate")) + "")}; + if ($truthy(node['$attr?']("revremark"))) { + details['$<<']("" + (br) + "" + (node.$attr("revremark")) + "")}; + if ($truthy(details['$empty?']())) { + } else { + + result['$<<']("
"); + result.$concat(details); + result['$<<']("
"); + };}; + if ($truthy(($truthy($a = ($truthy($b = sectioned) ? node['$attr?']("toc") : $b)) ? node['$attr?']("toc-placement", "auto") : $a))) { + result['$<<']("" + "
\n" + "
" + (node.$attr("toc-title")) + "
\n" + (self.$outline(node)) + "\n" + "
")}; + }; + result['$<<']("
"); + }; + result['$<<']("" + "
\n" + (node.$content()) + "\n" + "
"); + if ($truthy(($truthy($a = node['$footnotes?']()) ? node['$attr?']("nofootnotes")['$!']() : $a))) { + + result['$<<']("" + "
\n" + ""); + $send(node.$footnotes(), 'each', [], (TMP_4 = function(footnote){var self = TMP_4.$$s || this; + + + + if (footnote == null) { + footnote = nil; + }; + return result['$<<']("" + "
\n" + "" + (footnote.$index()) + ". " + (footnote.$text()) + "\n" + "
");}, TMP_4.$$s = self, TMP_4.$$arity = 1, TMP_4)); + result['$<<']("
");}; + if ($truthy(node.$nofooter())) { + } else { + + result['$<<']("
"); + result['$<<']("
"); + if ($truthy(node['$attr?']("revnumber"))) { + result['$<<']("" + (node.$attr("version-label")) + " " + (node.$attr("revnumber")) + (br))}; + if ($truthy(($truthy($a = node['$attr?']("last-update-label")) ? node['$attr?']("reproducible")['$!']() : $a))) { + result['$<<']("" + (node.$attr("last-update-label")) + " " + (node.$attr("docdatetime")))}; + result['$<<']("
"); + result['$<<']("
"); + }; + if ($truthy((docinfo_content = node.$docinfo("footer"))['$empty?']())) { + } else { + result['$<<'](docinfo_content) + }; + $case = highlighter; + if ("highlightjs"['$===']($case) || "highlight.js"['$===']($case)) { + highlightjs_path = node.$attr("highlightjsdir", "" + (cdn_base) + "/highlight.js/9.13.1"); + result['$<<']("" + ""); + result['$<<']("" + "\n" + "");} + else if ("prettify"['$===']($case)) { + prettify_path = node.$attr("prettifydir", "" + (cdn_base) + "/prettify/r298"); + result['$<<']("" + ""); + result['$<<']("" + "\n" + "");}; + if ($truthy(node['$attr?']("stem"))) { + + eqnums_val = node.$attr("eqnums", "none"); + if ($truthy(eqnums_val['$empty?']())) { + eqnums_val = "AMS"}; + eqnums_opt = "" + " equationNumbers: { autoNumber: \"" + (eqnums_val) + "\" } "; + result['$<<']("" + "\n" + "");}; + result['$<<'](""); + result['$<<'](""); + return result.$join($$($nesting, 'LF')); + }, TMP_Html5Converter_document_2.$$arity = 1); + + Opal.def(self, '$embedded', TMP_Html5Converter_embedded_5 = function $$embedded(node) { + var $a, $b, $c, TMP_6, self = this, result = nil, id_attr = nil, toc_p = nil; + + + result = []; + if (node.$doctype()['$==']("manpage")) { + + if ($truthy(node.$notitle())) { + } else { + + id_attr = (function() {if ($truthy(node.$id())) { + return "" + " id=\"" + (node.$id()) + "\"" + } else { + return "" + }; return nil; })(); + result['$<<']("" + "" + (node.$doctitle()) + " Manual Page"); + }; + if ($truthy(node['$attr?']("manpurpose"))) { + result['$<<'](self.$generate_manname_section(node))}; + } else if ($truthy(($truthy($a = node['$has_header?']()) ? node.$notitle()['$!']() : $a))) { + + id_attr = (function() {if ($truthy(node.$id())) { + return "" + " id=\"" + (node.$id()) + "\"" + } else { + return "" + }; return nil; })(); + result['$<<']("" + "" + (node.$header().$title()) + "");}; + if ($truthy(($truthy($a = ($truthy($b = ($truthy($c = node['$sections?']()) ? node['$attr?']("toc") : $c)) ? (toc_p = node.$attr("toc-placement"))['$!=']("macro") : $b)) ? toc_p['$!=']("preamble") : $a))) { + result['$<<']("" + "
\n" + "
" + (node.$attr("toc-title")) + "
\n" + (self.$outline(node)) + "\n" + "
")}; + result['$<<'](node.$content()); + if ($truthy(($truthy($a = node['$footnotes?']()) ? node['$attr?']("nofootnotes")['$!']() : $a))) { + + result['$<<']("" + "
\n" + ""); + $send(node.$footnotes(), 'each', [], (TMP_6 = function(footnote){var self = TMP_6.$$s || this; + + + + if (footnote == null) { + footnote = nil; + }; + return result['$<<']("" + "
\n" + "" + (footnote.$index()) + ". " + (footnote.$text()) + "\n" + "
");}, TMP_6.$$s = self, TMP_6.$$arity = 1, TMP_6)); + result['$<<']("
");}; + return result.$join($$($nesting, 'LF')); + }, TMP_Html5Converter_embedded_5.$$arity = 1); + + Opal.def(self, '$outline', TMP_Html5Converter_outline_7 = function $$outline(node, opts) { + var $a, $b, TMP_8, self = this, sectnumlevels = nil, toclevels = nil, sections = nil, result = nil; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + if ($truthy(node['$sections?']())) { + } else { + return nil + }; + sectnumlevels = ($truthy($a = opts['$[]']("sectnumlevels")) ? $a : ($truthy($b = node.$document().$attributes()['$[]']("sectnumlevels")) ? $b : 3).$to_i()); + toclevels = ($truthy($a = opts['$[]']("toclevels")) ? $a : ($truthy($b = node.$document().$attributes()['$[]']("toclevels")) ? $b : 2).$to_i()); + sections = node.$sections(); + result = ["" + "
    "]; + $send(sections, 'each', [], (TMP_8 = function(section){var self = TMP_8.$$s || this, $c, slevel = nil, stitle = nil, signifier = nil, child_toc_level = nil; + + + + if (section == null) { + section = nil; + }; + slevel = section.$level(); + if ($truthy(section.$caption())) { + stitle = section.$captioned_title() + } else if ($truthy(($truthy($c = section.$numbered()) ? $rb_le(slevel, sectnumlevels) : $c))) { + if ($truthy(($truthy($c = $rb_lt(slevel, 2)) ? node.$document().$doctype()['$==']("book") : $c))) { + if (section.$sectname()['$==']("chapter")) { + stitle = "" + ((function() {if ($truthy((signifier = node.$document().$attributes()['$[]']("chapter-signifier")))) { + return "" + (signifier) + " " + } else { + return "" + }; return nil; })()) + (section.$sectnum()) + " " + (section.$title()) + } else if (section.$sectname()['$==']("part")) { + stitle = "" + ((function() {if ($truthy((signifier = node.$document().$attributes()['$[]']("part-signifier")))) { + return "" + (signifier) + " " + } else { + return "" + }; return nil; })()) + (section.$sectnum(nil, ":")) + " " + (section.$title()) + } else { + stitle = "" + (section.$sectnum()) + " " + (section.$title()) + } + } else { + stitle = "" + (section.$sectnum()) + " " + (section.$title()) + } + } else { + stitle = section.$title() + }; + if ($truthy(stitle['$include?']("" + (stitle) + ""); + result['$<<'](child_toc_level); + return result['$<<'](""); + } else { + return result['$<<']("" + "
  • " + (stitle) + "
  • ") + };}, TMP_8.$$s = self, TMP_8.$$arity = 1, TMP_8)); + result['$<<']("
"); + return result.$join($$($nesting, 'LF')); + }, TMP_Html5Converter_outline_7.$$arity = -2); + + Opal.def(self, '$section', TMP_Html5Converter_section_9 = function $$section(node) { + var $a, $b, self = this, doc_attrs = nil, level = nil, title = nil, signifier = nil, id_attr = nil, id = nil, role = nil; + + + doc_attrs = node.$document().$attributes(); + level = node.$level(); + if ($truthy(node.$caption())) { + title = node.$captioned_title() + } else if ($truthy(($truthy($a = node.$numbered()) ? $rb_le(level, ($truthy($b = doc_attrs['$[]']("sectnumlevels")) ? $b : 3).$to_i()) : $a))) { + if ($truthy(($truthy($a = $rb_lt(level, 2)) ? node.$document().$doctype()['$==']("book") : $a))) { + if (node.$sectname()['$==']("chapter")) { + title = "" + ((function() {if ($truthy((signifier = doc_attrs['$[]']("chapter-signifier")))) { + return "" + (signifier) + " " + } else { + return "" + }; return nil; })()) + (node.$sectnum()) + " " + (node.$title()) + } else if (node.$sectname()['$==']("part")) { + title = "" + ((function() {if ($truthy((signifier = doc_attrs['$[]']("part-signifier")))) { + return "" + (signifier) + " " + } else { + return "" + }; return nil; })()) + (node.$sectnum(nil, ":")) + " " + (node.$title()) + } else { + title = "" + (node.$sectnum()) + " " + (node.$title()) + } + } else { + title = "" + (node.$sectnum()) + " " + (node.$title()) + } + } else { + title = node.$title() + }; + if ($truthy(node.$id())) { + + id_attr = "" + " id=\"" + ((id = node.$id())) + "\""; + if ($truthy(doc_attrs['$[]']("sectlinks"))) { + title = "" + "" + (title) + ""}; + if ($truthy(doc_attrs['$[]']("sectanchors"))) { + if (doc_attrs['$[]']("sectanchors")['$==']("after")) { + title = "" + (title) + "" + } else { + title = "" + "" + (title) + }}; + } else { + id_attr = "" + }; + if (level['$=='](0)) { + return "" + "" + (title) + "\n" + (node.$content()) + } else { + return "" + "
\n" + "" + (title) + "\n" + ((function() {if (level['$=='](1)) { + return "" + "
\n" + (node.$content()) + "\n" + "
" + } else { + return node.$content() + }; return nil; })()) + "\n" + "
" + }; + }, TMP_Html5Converter_section_9.$$arity = 1); + + Opal.def(self, '$admonition', TMP_Html5Converter_admonition_10 = function $$admonition(node) { + var $a, self = this, id_attr = nil, name = nil, title_element = nil, label = nil, role = nil; + + + id_attr = (function() {if ($truthy(node.$id())) { + return "" + " id=\"" + (node.$id()) + "\"" + } else { + return "" + }; return nil; })(); + name = node.$attr("name"); + title_element = (function() {if ($truthy(node['$title?']())) { + return "" + "
" + (node.$title()) + "
\n" + } else { + return "" + }; return nil; })(); + if ($truthy(node.$document()['$attr?']("icons"))) { + if ($truthy(($truthy($a = node.$document()['$attr?']("icons", "font")) ? node['$attr?']("icon")['$!']() : $a))) { + label = "" + "" + } else { + label = "" + "\""" + } + } else { + label = "" + "
" + (node.$attr("textlabel")) + "
" + }; + return "" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "
\n" + (label) + "\n" + "\n" + (title_element) + (node.$content()) + "\n" + "
\n" + "
"; + }, TMP_Html5Converter_admonition_10.$$arity = 1); + + Opal.def(self, '$audio', TMP_Html5Converter_audio_11 = function $$audio(node) { + var $a, self = this, xml = nil, id_attribute = nil, classes = nil, class_attribute = nil, title_element = nil, start_t = nil, end_t = nil, time_anchor = nil; + + + xml = self.xml_mode; + id_attribute = (function() {if ($truthy(node.$id())) { + return "" + " id=\"" + (node.$id()) + "\"" + } else { + return "" + }; return nil; })(); + classes = ["audioblock", node.$role()].$compact(); + class_attribute = "" + " class=\"" + (classes.$join(" ")) + "\""; + title_element = (function() {if ($truthy(node['$title?']())) { + return "" + "
" + (node.$title()) + "
\n" + } else { + return "" + }; return nil; })(); + start_t = node.$attr("start", nil, false); + end_t = node.$attr("end", nil, false); + time_anchor = (function() {if ($truthy(($truthy($a = start_t) ? $a : end_t))) { + return "" + "#t=" + (($truthy($a = start_t) ? $a : "")) + ((function() {if ($truthy(end_t)) { + return "" + "," + (end_t) + } else { + return "" + }; return nil; })()) + } else { + return "" + }; return nil; })(); + return "" + "\n" + (title_element) + "
\n" + "\n" + "
\n" + ""; + }, TMP_Html5Converter_audio_11.$$arity = 1); + + Opal.def(self, '$colist', TMP_Html5Converter_colist_12 = function $$colist(node) { + var $a, TMP_13, TMP_14, self = this, result = nil, id_attribute = nil, classes = nil, class_attribute = nil, font_icons = nil, num = nil; + + + result = []; + id_attribute = (function() {if ($truthy(node.$id())) { + return "" + " id=\"" + (node.$id()) + "\"" + } else { + return "" + }; return nil; })(); + classes = ["colist", node.$style(), node.$role()].$compact(); + class_attribute = "" + " class=\"" + (classes.$join(" ")) + "\""; + result['$<<']("" + ""); + if ($truthy(node['$title?']())) { + result['$<<']("" + "
" + (node.$title()) + "
")}; + if ($truthy(node.$document()['$attr?']("icons"))) { + + result['$<<'](""); + $a = [node.$document()['$attr?']("icons", "font"), 0], (font_icons = $a[0]), (num = $a[1]), $a; + $send(node.$items(), 'each', [], (TMP_13 = function(item){var self = TMP_13.$$s || this, num_label = nil; + if (self.void_element_slash == null) self.void_element_slash = nil; + + + + if (item == null) { + item = nil; + }; + num = $rb_plus(num, 1); + if ($truthy(font_icons)) { + num_label = "" + "" + (num) + "" + } else { + num_label = "" + "\""" + }; + return result['$<<']("" + "\n" + "\n" + "\n" + "");}, TMP_13.$$s = self, TMP_13.$$arity = 1, TMP_13)); + result['$<<']("
" + (num_label) + "" + (item.$text()) + ((function() {if ($truthy(item['$blocks?']())) { + return $rb_plus($$($nesting, 'LF'), item.$content()) + } else { + return "" + }; return nil; })()) + "
"); + } else { + + result['$<<']("
    "); + $send(node.$items(), 'each', [], (TMP_14 = function(item){var self = TMP_14.$$s || this; + + + + if (item == null) { + item = nil; + }; + return result['$<<']("" + "
  1. \n" + "

    " + (item.$text()) + "

    " + ((function() {if ($truthy(item['$blocks?']())) { + return $rb_plus($$($nesting, 'LF'), item.$content()) + } else { + return "" + }; return nil; })()) + "\n" + "
  2. ");}, TMP_14.$$s = self, TMP_14.$$arity = 1, TMP_14)); + result['$<<']("
"); + }; + result['$<<'](""); + return result.$join($$($nesting, 'LF')); + }, TMP_Html5Converter_colist_12.$$arity = 1); + + Opal.def(self, '$dlist', TMP_Html5Converter_dlist_15 = function $$dlist(node) { + var TMP_16, $a, TMP_18, TMP_20, self = this, result = nil, id_attribute = nil, classes = nil, $case = nil, class_attribute = nil, slash = nil, col_style_attribute = nil, dt_style_attribute = nil; + + + result = []; + id_attribute = (function() {if ($truthy(node.$id())) { + return "" + " id=\"" + (node.$id()) + "\"" + } else { + return "" + }; return nil; })(); + classes = (function() {$case = node.$style(); + if ("qanda"['$===']($case)) {return ["qlist", "qanda", node.$role()]} + else if ("horizontal"['$===']($case)) {return ["hdlist", node.$role()]} + else {return ["dlist", node.$style(), node.$role()]}})().$compact(); + class_attribute = "" + " class=\"" + (classes.$join(" ")) + "\""; + result['$<<']("" + ""); + if ($truthy(node['$title?']())) { + result['$<<']("" + "
" + (node.$title()) + "
")}; + $case = node.$style(); + if ("qanda"['$===']($case)) { + result['$<<']("
    "); + $send(node.$items(), 'each', [], (TMP_16 = function(terms, dd){var self = TMP_16.$$s || this, TMP_17; + + + + if (terms == null) { + terms = nil; + }; + + if (dd == null) { + dd = nil; + }; + result['$<<']("
  1. "); + $send([].concat(Opal.to_a(terms)), 'each', [], (TMP_17 = function(dt){var self = TMP_17.$$s || this; + + + + if (dt == null) { + dt = nil; + }; + return result['$<<']("" + "

    " + (dt.$text()) + "

    ");}, TMP_17.$$s = self, TMP_17.$$arity = 1, TMP_17)); + if ($truthy(dd)) { + + if ($truthy(dd['$text?']())) { + result['$<<']("" + "

    " + (dd.$text()) + "

    ")}; + if ($truthy(dd['$blocks?']())) { + result['$<<'](dd.$content())};}; + return result['$<<']("
  2. ");}, TMP_16.$$s = self, TMP_16.$$arity = 2, TMP_16)); + result['$<<']("
");} + else if ("horizontal"['$===']($case)) { + slash = self.void_element_slash; + result['$<<'](""); + if ($truthy(($truthy($a = node['$attr?']("labelwidth")) ? $a : node['$attr?']("itemwidth")))) { + + result['$<<'](""); + col_style_attribute = (function() {if ($truthy(node['$attr?']("labelwidth"))) { + return "" + " style=\"width: " + (node.$attr("labelwidth").$chomp("%")) + "%;\"" + } else { + return "" + }; return nil; })(); + result['$<<']("" + ""); + col_style_attribute = (function() {if ($truthy(node['$attr?']("itemwidth"))) { + return "" + " style=\"width: " + (node.$attr("itemwidth").$chomp("%")) + "%;\"" + } else { + return "" + }; return nil; })(); + result['$<<']("" + ""); + result['$<<']("");}; + $send(node.$items(), 'each', [], (TMP_18 = function(terms, dd){var self = TMP_18.$$s || this, TMP_19, terms_array = nil, last_term = nil; + + + + if (terms == null) { + terms = nil; + }; + + if (dd == null) { + dd = nil; + }; + result['$<<'](""); + result['$<<']("" + ""); + result['$<<'](""); + return result['$<<']("");}, TMP_18.$$s = self, TMP_18.$$arity = 2, TMP_18)); + result['$<<']("
"); + terms_array = [].concat(Opal.to_a(terms)); + last_term = terms_array['$[]'](-1); + $send(terms_array, 'each', [], (TMP_19 = function(dt){var self = TMP_19.$$s || this; + + + + if (dt == null) { + dt = nil; + }; + result['$<<'](dt.$text()); + if ($truthy(dt['$!='](last_term))) { + return result['$<<']("" + "") + } else { + return nil + };}, TMP_19.$$s = self, TMP_19.$$arity = 1, TMP_19)); + result['$<<'](""); + if ($truthy(dd)) { + + if ($truthy(dd['$text?']())) { + result['$<<']("" + "

" + (dd.$text()) + "

")}; + if ($truthy(dd['$blocks?']())) { + result['$<<'](dd.$content())};}; + result['$<<']("
");} + else { + result['$<<']("
"); + dt_style_attribute = (function() {if ($truthy(node.$style())) { + return "" + } else { + return " class=\"hdlist1\"" + }; return nil; })(); + $send(node.$items(), 'each', [], (TMP_20 = function(terms, dd){var self = TMP_20.$$s || this, TMP_21; + + + + if (terms == null) { + terms = nil; + }; + + if (dd == null) { + dd = nil; + }; + $send([].concat(Opal.to_a(terms)), 'each', [], (TMP_21 = function(dt){var self = TMP_21.$$s || this; + + + + if (dt == null) { + dt = nil; + }; + return result['$<<']("" + "" + (dt.$text()) + "");}, TMP_21.$$s = self, TMP_21.$$arity = 1, TMP_21)); + if ($truthy(dd)) { + + result['$<<']("
"); + if ($truthy(dd['$text?']())) { + result['$<<']("" + "

" + (dd.$text()) + "

")}; + if ($truthy(dd['$blocks?']())) { + result['$<<'](dd.$content())}; + return result['$<<']("
"); + } else { + return nil + };}, TMP_20.$$s = self, TMP_20.$$arity = 2, TMP_20)); + result['$<<']("
");}; + result['$<<'](""); + return result.$join($$($nesting, 'LF')); + }, TMP_Html5Converter_dlist_15.$$arity = 1); + + Opal.def(self, '$example', TMP_Html5Converter_example_22 = function $$example(node) { + var self = this, id_attribute = nil, title_element = nil, role = nil; + + + id_attribute = (function() {if ($truthy(node.$id())) { + return "" + " id=\"" + (node.$id()) + "\"" + } else { + return "" + }; return nil; })(); + title_element = (function() {if ($truthy(node['$title?']())) { + return "" + "
" + (node.$captioned_title()) + "
\n" + } else { + return "" + }; return nil; })(); + return "" + "\n" + (title_element) + "
\n" + (node.$content()) + "\n" + "
\n" + ""; + }, TMP_Html5Converter_example_22.$$arity = 1); + + Opal.def(self, '$floating_title', TMP_Html5Converter_floating_title_23 = function $$floating_title(node) { + var self = this, tag_name = nil, id_attribute = nil, classes = nil; + + + tag_name = "" + "h" + ($rb_plus(node.$level(), 1)); + id_attribute = (function() {if ($truthy(node.$id())) { + return "" + " id=\"" + (node.$id()) + "\"" + } else { + return "" + }; return nil; })(); + classes = [node.$style(), node.$role()].$compact(); + return "" + "<" + (tag_name) + (id_attribute) + " class=\"" + (classes.$join(" ")) + "\">" + (node.$title()) + ""; + }, TMP_Html5Converter_floating_title_23.$$arity = 1); + + Opal.def(self, '$image', TMP_Html5Converter_image_24 = function $$image(node) { + var $a, $b, $c, self = this, target = nil, width_attr = nil, height_attr = nil, svg = nil, obj = nil, img = nil, fallback = nil, id_attr = nil, classes = nil, class_attr = nil, title_el = nil; + + + target = node.$attr("target"); + width_attr = (function() {if ($truthy(node['$attr?']("width"))) { + return "" + " width=\"" + (node.$attr("width")) + "\"" + } else { + return "" + }; return nil; })(); + height_attr = (function() {if ($truthy(node['$attr?']("height"))) { + return "" + " height=\"" + (node.$attr("height")) + "\"" + } else { + return "" + }; return nil; })(); + if ($truthy(($truthy($a = ($truthy($b = ($truthy($c = node['$attr?']("format", "svg", false)) ? $c : target['$include?'](".svg"))) ? $rb_lt(node.$document().$safe(), $$$($$($nesting, 'SafeMode'), 'SECURE')) : $b)) ? ($truthy($b = (svg = node['$option?']("inline"))) ? $b : (obj = node['$option?']("interactive"))) : $a))) { + if ($truthy(svg)) { + img = ($truthy($a = self.$read_svg_contents(node, target)) ? $a : "" + "" + (node.$alt()) + "") + } else if ($truthy(obj)) { + + fallback = (function() {if ($truthy(node['$attr?']("fallback"))) { + return "" + "\""" + } else { + return "" + "" + (node.$alt()) + "" + }; return nil; })(); + img = "" + "" + (fallback) + "";}}; + img = ($truthy($a = img) ? $a : "" + "\"""); + if ($truthy(node['$attr?']("link", nil, false))) { + img = "" + "" + (img) + ""}; + id_attr = (function() {if ($truthy(node.$id())) { + return "" + " id=\"" + (node.$id()) + "\"" + } else { + return "" + }; return nil; })(); + classes = ["imageblock"]; + if ($truthy(node['$attr?']("float"))) { + classes['$<<'](node.$attr("float"))}; + if ($truthy(node['$attr?']("align"))) { + classes['$<<']("" + "text-" + (node.$attr("align")))}; + if ($truthy(node.$role())) { + classes['$<<'](node.$role())}; + class_attr = "" + " class=\"" + (classes.$join(" ")) + "\""; + title_el = (function() {if ($truthy(node['$title?']())) { + return "" + "\n
" + (node.$captioned_title()) + "
" + } else { + return "" + }; return nil; })(); + return "" + "\n" + "
\n" + (img) + "\n" + "
" + (title_el) + "\n" + ""; + }, TMP_Html5Converter_image_24.$$arity = 1); + + Opal.def(self, '$listing', TMP_Html5Converter_listing_25 = function $$listing(node) { + var $a, self = this, nowrap = nil, language = nil, code_attrs = nil, $case = nil, pre_class = nil, pre_start = nil, pre_end = nil, id_attribute = nil, title_element = nil, role = nil; + + + nowrap = ($truthy($a = node.$document()['$attr?']("prewrap")['$!']()) ? $a : node['$option?']("nowrap")); + if (node.$style()['$==']("source")) { + + if ($truthy((language = node.$attr("language", nil, false)))) { + code_attrs = "" + " data-lang=\"" + (language) + "\"" + } else { + code_attrs = "" + }; + $case = node.$document().$attr("source-highlighter"); + if ("coderay"['$===']($case)) {pre_class = "" + " class=\"CodeRay highlight" + ((function() {if ($truthy(nowrap)) { + return " nowrap" + } else { + return "" + }; return nil; })()) + "\""} + else if ("pygments"['$===']($case)) {if ($truthy(node.$document()['$attr?']("pygments-css", "inline"))) { + + if ($truthy((($a = self['pygments_bg'], $a != null && $a !== nil) ? 'instance-variable' : nil))) { + } else { + self.pygments_bg = self.stylesheets.$pygments_background(node.$document().$attr("pygments-style")) + }; + pre_class = "" + " class=\"pygments highlight" + ((function() {if ($truthy(nowrap)) { + return " nowrap" + } else { + return "" + }; return nil; })()) + "\" style=\"background: " + (self.pygments_bg) + "\""; + } else { + pre_class = "" + " class=\"pygments highlight" + ((function() {if ($truthy(nowrap)) { + return " nowrap" + } else { + return "" + }; return nil; })()) + "\"" + }} + else if ("highlightjs"['$===']($case) || "highlight.js"['$===']($case)) { + pre_class = "" + " class=\"highlightjs highlight" + ((function() {if ($truthy(nowrap)) { + return " nowrap" + } else { + return "" + }; return nil; })()) + "\""; + if ($truthy(language)) { + code_attrs = "" + " class=\"language-" + (language) + " hljs\"" + (code_attrs)};} + else if ("prettify"['$===']($case)) { + pre_class = "" + " class=\"prettyprint highlight" + ((function() {if ($truthy(nowrap)) { + return " nowrap" + } else { + return "" + }; return nil; })()) + ((function() {if ($truthy(node['$attr?']("linenums", nil, false))) { + return " linenums" + } else { + return "" + }; return nil; })()) + "\""; + if ($truthy(language)) { + code_attrs = "" + " class=\"language-" + (language) + "\"" + (code_attrs)};} + else if ("html-pipeline"['$===']($case)) { + pre_class = (function() {if ($truthy(language)) { + return "" + " lang=\"" + (language) + "\"" + } else { + return "" + }; return nil; })(); + code_attrs = "";} + else { + pre_class = "" + " class=\"highlight" + ((function() {if ($truthy(nowrap)) { + return " nowrap" + } else { + return "" + }; return nil; })()) + "\""; + if ($truthy(language)) { + code_attrs = "" + " class=\"language-" + (language) + "\"" + (code_attrs)};}; + pre_start = "" + ""; + pre_end = ""; + } else { + + pre_start = "" + ""; + pre_end = ""; + }; + id_attribute = (function() {if ($truthy(node.$id())) { + return "" + " id=\"" + (node.$id()) + "\"" + } else { + return "" + }; return nil; })(); + title_element = (function() {if ($truthy(node['$title?']())) { + return "" + "
" + (node.$captioned_title()) + "
\n" + } else { + return "" + }; return nil; })(); + return "" + "\n" + (title_element) + "
\n" + (pre_start) + (node.$content()) + (pre_end) + "\n" + "
\n" + ""; + }, TMP_Html5Converter_listing_25.$$arity = 1); + + Opal.def(self, '$literal', TMP_Html5Converter_literal_26 = function $$literal(node) { + var $a, self = this, id_attribute = nil, title_element = nil, nowrap = nil, role = nil; + + + id_attribute = (function() {if ($truthy(node.$id())) { + return "" + " id=\"" + (node.$id()) + "\"" + } else { + return "" + }; return nil; })(); + title_element = (function() {if ($truthy(node['$title?']())) { + return "" + "
" + (node.$title()) + "
\n" + } else { + return "" + }; return nil; })(); + nowrap = ($truthy($a = node.$document()['$attr?']("prewrap")['$!']()) ? $a : node['$option?']("nowrap")); + return "" + "\n" + (title_element) + "
\n" + "" + (node.$content()) + "\n" + "
\n" + ""; + }, TMP_Html5Converter_literal_26.$$arity = 1); + + Opal.def(self, '$stem', TMP_Html5Converter_stem_27 = function $$stem(node) { + var $a, $b, TMP_28, self = this, id_attribute = nil, title_element = nil, style = nil, open = nil, close = nil, equation = nil, br = nil, role = nil; + + + id_attribute = (function() {if ($truthy(node.$id())) { + return "" + " id=\"" + (node.$id()) + "\"" + } else { + return "" + }; return nil; })(); + title_element = (function() {if ($truthy(node['$title?']())) { + return "" + "
" + (node.$title()) + "
\n" + } else { + return "" + }; return nil; })(); + $b = $$($nesting, 'BLOCK_MATH_DELIMITERS')['$[]']((style = node.$style().$to_sym())), $a = Opal.to_ary($b), (open = ($a[0] == null ? nil : $a[0])), (close = ($a[1] == null ? nil : $a[1])), $b; + equation = node.$content(); + if ($truthy((($a = style['$==']("asciimath")) ? equation['$include?']($$($nesting, 'LF')) : style['$==']("asciimath")))) { + + br = "" + "" + ($$($nesting, 'LF')); + equation = $send(equation, 'gsub', [$$($nesting, 'StemBreakRx')], (TMP_28 = function(){var self = TMP_28.$$s || this, $c; + + return "" + (close) + ($rb_times(br, (($c = $gvars['~']) === nil ? nil : $c['$[]'](0)).$count($$($nesting, 'LF')))) + (open)}, TMP_28.$$s = self, TMP_28.$$arity = 0, TMP_28));}; + if ($truthy(($truthy($a = equation['$start_with?'](open)) ? equation['$end_with?'](close) : $a))) { + } else { + equation = "" + (open) + (equation) + (close) + }; + return "" + "\n" + (title_element) + "
\n" + (equation) + "\n" + "
\n" + ""; + }, TMP_Html5Converter_stem_27.$$arity = 1); + + Opal.def(self, '$olist', TMP_Html5Converter_olist_29 = function $$olist(node) { + var TMP_30, self = this, result = nil, id_attribute = nil, classes = nil, class_attribute = nil, type_attribute = nil, keyword = nil, start_attribute = nil, reversed_attribute = nil; + + + result = []; + id_attribute = (function() {if ($truthy(node.$id())) { + return "" + " id=\"" + (node.$id()) + "\"" + } else { + return "" + }; return nil; })(); + classes = ["olist", node.$style(), node.$role()].$compact(); + class_attribute = "" + " class=\"" + (classes.$join(" ")) + "\""; + result['$<<']("" + ""); + if ($truthy(node['$title?']())) { + result['$<<']("" + "
" + (node.$title()) + "
")}; + type_attribute = (function() {if ($truthy((keyword = node.$list_marker_keyword()))) { + return "" + " type=\"" + (keyword) + "\"" + } else { + return "" + }; return nil; })(); + start_attribute = (function() {if ($truthy(node['$attr?']("start"))) { + return "" + " start=\"" + (node.$attr("start")) + "\"" + } else { + return "" + }; return nil; })(); + reversed_attribute = (function() {if ($truthy(node['$option?']("reversed"))) { + + return self.$append_boolean_attribute("reversed", self.xml_mode); + } else { + return "" + }; return nil; })(); + result['$<<']("" + "
    "); + $send(node.$items(), 'each', [], (TMP_30 = function(item){var self = TMP_30.$$s || this; + + + + if (item == null) { + item = nil; + }; + result['$<<']("
  1. "); + result['$<<']("" + "

    " + (item.$text()) + "

    "); + if ($truthy(item['$blocks?']())) { + result['$<<'](item.$content())}; + return result['$<<']("
  2. ");}, TMP_30.$$s = self, TMP_30.$$arity = 1, TMP_30)); + result['$<<']("
"); + result['$<<'](""); + return result.$join($$($nesting, 'LF')); + }, TMP_Html5Converter_olist_29.$$arity = 1); + + Opal.def(self, '$open', TMP_Html5Converter_open_31 = function $$open(node) { + var $a, $b, $c, self = this, style = nil, id_attr = nil, title_el = nil, role = nil; + + if ((style = node.$style())['$==']("abstract")) { + if ($truthy((($a = node.$parent()['$=='](node.$document())) ? node.$document().$doctype()['$==']("book") : node.$parent()['$=='](node.$document())))) { + + self.$logger().$warn("abstract block cannot be used in a document without a title when doctype is book. Excluding block content."); + return ""; + } else { + + id_attr = (function() {if ($truthy(node.$id())) { + return "" + " id=\"" + (node.$id()) + "\"" + } else { + return "" + }; return nil; })(); + title_el = (function() {if ($truthy(node['$title?']())) { + return "" + "
" + (node.$title()) + "
\n" + } else { + return "" + }; return nil; })(); + return "" + "\n" + (title_el) + "
\n" + (node.$content()) + "\n" + "
\n" + ""; + } + } else if ($truthy((($a = style['$==']("partintro")) ? ($truthy($b = ($truthy($c = $rb_gt(node.$level(), 0)) ? $c : node.$parent().$context()['$!=']("section"))) ? $b : node.$document().$doctype()['$!=']("book")) : style['$==']("partintro")))) { + + self.$logger().$error("partintro block can only be used when doctype is book and must be a child of a book part. Excluding block content."); + return ""; + } else { + + id_attr = (function() {if ($truthy(node.$id())) { + return "" + " id=\"" + (node.$id()) + "\"" + } else { + return "" + }; return nil; })(); + title_el = (function() {if ($truthy(node['$title?']())) { + return "" + "
" + (node.$title()) + "
\n" + } else { + return "" + }; return nil; })(); + return "" + "" + }, TMP_Html5Converter_page_break_32.$$arity = 1); + + Opal.def(self, '$paragraph', TMP_Html5Converter_paragraph_33 = function $$paragraph(node) { + var self = this, class_attribute = nil, attributes = nil; + + + class_attribute = (function() {if ($truthy(node.$role())) { + return "" + "class=\"paragraph " + (node.$role()) + "\"" + } else { + return "class=\"paragraph\"" + }; return nil; })(); + attributes = (function() {if ($truthy(node.$id())) { + return "" + "id=\"" + (node.$id()) + "\" " + (class_attribute) + } else { + return class_attribute + }; return nil; })(); + if ($truthy(node['$title?']())) { + return "" + "
\n" + "
" + (node.$title()) + "
\n" + "

" + (node.$content()) + "

\n" + "
" + } else { + return "" + "
\n" + "

" + (node.$content()) + "

\n" + "
" + }; + }, TMP_Html5Converter_paragraph_33.$$arity = 1); + + Opal.def(self, '$preamble', TMP_Html5Converter_preamble_34 = function $$preamble(node) { + var $a, $b, self = this, doc = nil, toc = nil; + + + if ($truthy(($truthy($a = ($truthy($b = (doc = node.$document())['$attr?']("toc-placement", "preamble")) ? doc['$sections?']() : $b)) ? doc['$attr?']("toc") : $a))) { + toc = "" + "\n" + "
\n" + "
" + (doc.$attr("toc-title")) + "
\n" + (self.$outline(doc)) + "\n" + "
" + } else { + toc = "" + }; + return "" + "
\n" + "
\n" + (node.$content()) + "\n" + "
" + (toc) + "\n" + "
"; + }, TMP_Html5Converter_preamble_34.$$arity = 1); + + Opal.def(self, '$quote', TMP_Html5Converter_quote_35 = function $$quote(node) { + var $a, self = this, id_attribute = nil, classes = nil, class_attribute = nil, title_element = nil, attribution = nil, citetitle = nil, cite_element = nil, attribution_text = nil, attribution_element = nil; + + + id_attribute = (function() {if ($truthy(node.$id())) { + return "" + " id=\"" + (node.$id()) + "\"" + } else { + return "" + }; return nil; })(); + classes = ["quoteblock", node.$role()].$compact(); + class_attribute = "" + " class=\"" + (classes.$join(" ")) + "\""; + title_element = (function() {if ($truthy(node['$title?']())) { + return "" + "\n
" + (node.$title()) + "
" + } else { + return "" + }; return nil; })(); + attribution = (function() {if ($truthy(node['$attr?']("attribution"))) { + + return node.$attr("attribution"); + } else { + return nil + }; return nil; })(); + citetitle = (function() {if ($truthy(node['$attr?']("citetitle"))) { + + return node.$attr("citetitle"); + } else { + return nil + }; return nil; })(); + if ($truthy(($truthy($a = attribution) ? $a : citetitle))) { + + cite_element = (function() {if ($truthy(citetitle)) { + return "" + "" + (citetitle) + "" + } else { + return "" + }; return nil; })(); + attribution_text = (function() {if ($truthy(attribution)) { + return "" + "— " + (attribution) + ((function() {if ($truthy(citetitle)) { + return "" + "\n" + } else { + return "" + }; return nil; })()) + } else { + return "" + }; return nil; })(); + attribution_element = "" + "\n
\n" + (attribution_text) + (cite_element) + "\n
"; + } else { + attribution_element = "" + }; + return "" + "" + (title_element) + "\n" + "
\n" + (node.$content()) + "\n" + "
" + (attribution_element) + "\n" + ""; + }, TMP_Html5Converter_quote_35.$$arity = 1); + + Opal.def(self, '$thematic_break', TMP_Html5Converter_thematic_break_36 = function $$thematic_break(node) { + var self = this; + + return "" + "" + }, TMP_Html5Converter_thematic_break_36.$$arity = 1); + + Opal.def(self, '$sidebar', TMP_Html5Converter_sidebar_37 = function $$sidebar(node) { + var self = this, id_attribute = nil, title_element = nil, role = nil; + + + id_attribute = (function() {if ($truthy(node.$id())) { + return "" + " id=\"" + (node.$id()) + "\"" + } else { + return "" + }; return nil; })(); + title_element = (function() {if ($truthy(node['$title?']())) { + return "" + "
" + (node.$title()) + "
\n" + } else { + return "" + }; return nil; })(); + return "" + "\n" + "
\n" + (title_element) + (node.$content()) + "\n" + "
\n" + ""; + }, TMP_Html5Converter_sidebar_37.$$arity = 1); + + Opal.def(self, '$table', TMP_Html5Converter_table_38 = function $$table(node) { + var $a, TMP_39, TMP_40, self = this, result = nil, id_attribute = nil, classes = nil, stripes = nil, styles = nil, autowidth = nil, tablewidth = nil, role = nil, class_attribute = nil, style_attribute = nil, slash = nil; + + + result = []; + id_attribute = (function() {if ($truthy(node.$id())) { + return "" + " id=\"" + (node.$id()) + "\"" + } else { + return "" + }; return nil; })(); + classes = ["tableblock", "" + "frame-" + (node.$attr("frame", "all")), "" + "grid-" + (node.$attr("grid", "all"))]; + if ($truthy((stripes = node.$attr("stripes")))) { + classes['$<<']("" + "stripes-" + (stripes))}; + styles = []; + if ($truthy(($truthy($a = (autowidth = node.$attributes()['$[]']("autowidth-option"))) ? node['$attr?']("width", nil, false)['$!']() : $a))) { + classes['$<<']("fit-content") + } else if ((tablewidth = node.$attr("tablepcwidth"))['$=='](100)) { + classes['$<<']("stretch") + } else { + styles['$<<']("" + "width: " + (tablewidth) + "%;") + }; + if ($truthy(node['$attr?']("float"))) { + classes['$<<'](node.$attr("float"))}; + if ($truthy((role = node.$role()))) { + classes['$<<'](role)}; + class_attribute = "" + " class=\"" + (classes.$join(" ")) + "\""; + style_attribute = (function() {if ($truthy(styles['$empty?']())) { + return "" + } else { + return "" + " style=\"" + (styles.$join(" ")) + "\"" + }; return nil; })(); + result['$<<']("" + ""); + if ($truthy(node['$title?']())) { + result['$<<']("" + "" + (node.$captioned_title()) + "")}; + if ($truthy($rb_gt(node.$attr("rowcount"), 0))) { + + slash = self.void_element_slash; + result['$<<'](""); + if ($truthy(autowidth)) { + result = $rb_plus(result, $$($nesting, 'Array').$new(node.$columns().$size(), "" + "")) + } else { + $send(node.$columns(), 'each', [], (TMP_39 = function(col){var self = TMP_39.$$s || this; + + + + if (col == null) { + col = nil; + }; + return result['$<<']((function() {if ($truthy(col.$attributes()['$[]']("autowidth-option"))) { + return "" + "" + } else { + return "" + "" + }; return nil; })());}, TMP_39.$$s = self, TMP_39.$$arity = 1, TMP_39)) + }; + result['$<<'](""); + $send(node.$rows().$by_section(), 'each', [], (TMP_40 = function(tsec, rows){var self = TMP_40.$$s || this, TMP_41; + + + + if (tsec == null) { + tsec = nil; + }; + + if (rows == null) { + rows = nil; + }; + if ($truthy(rows['$empty?']())) { + return nil;}; + result['$<<']("" + ""); + $send(rows, 'each', [], (TMP_41 = function(row){var self = TMP_41.$$s || this, TMP_42; + + + + if (row == null) { + row = nil; + }; + result['$<<'](""); + $send(row, 'each', [], (TMP_42 = function(cell){var self = TMP_42.$$s || this, $b, cell_content = nil, $case = nil, cell_tag_name = nil, cell_class_attribute = nil, cell_colspan_attribute = nil, cell_rowspan_attribute = nil, cell_style_attribute = nil; + + + + if (cell == null) { + cell = nil; + }; + if (tsec['$==']("head")) { + cell_content = cell.$text() + } else { + $case = cell.$style(); + if ("asciidoc"['$===']($case)) {cell_content = "" + "
" + (cell.$content()) + "
"} + else if ("verse"['$===']($case)) {cell_content = "" + "
" + (cell.$text()) + "
"} + else if ("literal"['$===']($case)) {cell_content = "" + "
" + (cell.$text()) + "
"} + else {cell_content = (function() {if ($truthy((cell_content = cell.$content())['$empty?']())) { + return "" + } else { + return "" + "

" + (cell_content.$join("" + "

\n" + "

")) + "

" + }; return nil; })()} + }; + cell_tag_name = (function() {if ($truthy(($truthy($b = tsec['$==']("head")) ? $b : cell.$style()['$==']("header")))) { + return "th" + } else { + return "td" + }; return nil; })(); + cell_class_attribute = "" + " class=\"tableblock halign-" + (cell.$attr("halign")) + " valign-" + (cell.$attr("valign")) + "\""; + cell_colspan_attribute = (function() {if ($truthy(cell.$colspan())) { + return "" + " colspan=\"" + (cell.$colspan()) + "\"" + } else { + return "" + }; return nil; })(); + cell_rowspan_attribute = (function() {if ($truthy(cell.$rowspan())) { + return "" + " rowspan=\"" + (cell.$rowspan()) + "\"" + } else { + return "" + }; return nil; })(); + cell_style_attribute = (function() {if ($truthy(node.$document()['$attr?']("cellbgcolor"))) { + return "" + " style=\"background-color: " + (node.$document().$attr("cellbgcolor")) + ";\"" + } else { + return "" + }; return nil; })(); + return result['$<<']("" + "<" + (cell_tag_name) + (cell_class_attribute) + (cell_colspan_attribute) + (cell_rowspan_attribute) + (cell_style_attribute) + ">" + (cell_content) + "");}, TMP_42.$$s = self, TMP_42.$$arity = 1, TMP_42)); + return result['$<<']("");}, TMP_41.$$s = self, TMP_41.$$arity = 1, TMP_41)); + return result['$<<']("" + "
");}, TMP_40.$$s = self, TMP_40.$$arity = 2, TMP_40));}; + result['$<<'](""); + return result.$join($$($nesting, 'LF')); + }, TMP_Html5Converter_table_38.$$arity = 1); + + Opal.def(self, '$toc', TMP_Html5Converter_toc_43 = function $$toc(node) { + var $a, $b, self = this, doc = nil, id_attr = nil, title_id_attr = nil, title = nil, levels = nil, role = nil; + + + if ($truthy(($truthy($a = ($truthy($b = (doc = node.$document())['$attr?']("toc-placement", "macro")) ? doc['$sections?']() : $b)) ? doc['$attr?']("toc") : $a))) { + } else { + return "" + }; + if ($truthy(node.$id())) { + + id_attr = "" + " id=\"" + (node.$id()) + "\""; + title_id_attr = "" + " id=\"" + (node.$id()) + "title\""; + } else { + + id_attr = " id=\"toc\""; + title_id_attr = " id=\"toctitle\""; + }; + title = (function() {if ($truthy(node['$title?']())) { + return node.$title() + } else { + + return doc.$attr("toc-title"); + }; return nil; })(); + levels = (function() {if ($truthy(node['$attr?']("levels"))) { + return node.$attr("levels").$to_i() + } else { + return nil + }; return nil; })(); + role = (function() {if ($truthy(node['$role?']())) { + return node.$role() + } else { + + return doc.$attr("toc-class", "toc"); + }; return nil; })(); + return "" + "\n" + "" + (title) + "\n" + (self.$outline(doc, $hash2(["toclevels"], {"toclevels": levels}))) + "\n" + ""; + }, TMP_Html5Converter_toc_43.$$arity = 1); + + Opal.def(self, '$ulist', TMP_Html5Converter_ulist_44 = function $$ulist(node) { + var TMP_45, self = this, result = nil, id_attribute = nil, div_classes = nil, marker_checked = nil, marker_unchecked = nil, checklist = nil, ul_class_attribute = nil; + + + result = []; + id_attribute = (function() {if ($truthy(node.$id())) { + return "" + " id=\"" + (node.$id()) + "\"" + } else { + return "" + }; return nil; })(); + div_classes = ["ulist", node.$style(), node.$role()].$compact(); + marker_checked = (marker_unchecked = ""); + if ($truthy((checklist = node['$option?']("checklist")))) { + + div_classes.$unshift(div_classes.$shift(), "checklist"); + ul_class_attribute = " class=\"checklist\""; + if ($truthy(node['$option?']("interactive"))) { + if ($truthy(self.xml_mode)) { + + marker_checked = " "; + marker_unchecked = " "; + } else { + + marker_checked = " "; + marker_unchecked = " "; + } + } else if ($truthy(node.$document()['$attr?']("icons", "font"))) { + + marker_checked = " "; + marker_unchecked = " "; + } else { + + marker_checked = "✓ "; + marker_unchecked = "❏ "; + }; + } else { + ul_class_attribute = (function() {if ($truthy(node.$style())) { + return "" + " class=\"" + (node.$style()) + "\"" + } else { + return "" + }; return nil; })() + }; + result['$<<']("" + ""); + if ($truthy(node['$title?']())) { + result['$<<']("" + "
" + (node.$title()) + "
")}; + result['$<<']("" + ""); + $send(node.$items(), 'each', [], (TMP_45 = function(item){var self = TMP_45.$$s || this, $a; + + + + if (item == null) { + item = nil; + }; + result['$<<']("
  • "); + if ($truthy(($truthy($a = checklist) ? item['$attr?']("checkbox") : $a))) { + result['$<<']("" + "

    " + ((function() {if ($truthy(item['$attr?']("checked"))) { + return marker_checked + } else { + return marker_unchecked + }; return nil; })()) + (item.$text()) + "

    ") + } else { + result['$<<']("" + "

    " + (item.$text()) + "

    ") + }; + if ($truthy(item['$blocks?']())) { + result['$<<'](item.$content())}; + return result['$<<']("
  • ");}, TMP_45.$$s = self, TMP_45.$$arity = 1, TMP_45)); + result['$<<'](""); + result['$<<'](""); + return result.$join($$($nesting, 'LF')); + }, TMP_Html5Converter_ulist_44.$$arity = 1); + + Opal.def(self, '$verse', TMP_Html5Converter_verse_46 = function $$verse(node) { + var $a, self = this, id_attribute = nil, classes = nil, class_attribute = nil, title_element = nil, attribution = nil, citetitle = nil, cite_element = nil, attribution_text = nil, attribution_element = nil; + + + id_attribute = (function() {if ($truthy(node.$id())) { + return "" + " id=\"" + (node.$id()) + "\"" + } else { + return "" + }; return nil; })(); + classes = ["verseblock", node.$role()].$compact(); + class_attribute = "" + " class=\"" + (classes.$join(" ")) + "\""; + title_element = (function() {if ($truthy(node['$title?']())) { + return "" + "\n
    " + (node.$title()) + "
    " + } else { + return "" + }; return nil; })(); + attribution = (function() {if ($truthy(node['$attr?']("attribution"))) { + + return node.$attr("attribution"); + } else { + return nil + }; return nil; })(); + citetitle = (function() {if ($truthy(node['$attr?']("citetitle"))) { + + return node.$attr("citetitle"); + } else { + return nil + }; return nil; })(); + if ($truthy(($truthy($a = attribution) ? $a : citetitle))) { + + cite_element = (function() {if ($truthy(citetitle)) { + return "" + "" + (citetitle) + "" + } else { + return "" + }; return nil; })(); + attribution_text = (function() {if ($truthy(attribution)) { + return "" + "— " + (attribution) + ((function() {if ($truthy(citetitle)) { + return "" + "\n" + } else { + return "" + }; return nil; })()) + } else { + return "" + }; return nil; })(); + attribution_element = "" + "\n
    \n" + (attribution_text) + (cite_element) + "\n
    "; + } else { + attribution_element = "" + }; + return "" + "" + (title_element) + "\n" + "
    " + (node.$content()) + "
    " + (attribution_element) + "\n" + ""; + }, TMP_Html5Converter_verse_46.$$arity = 1); + + Opal.def(self, '$video', TMP_Html5Converter_video_47 = function $$video(node) { + var $a, $b, self = this, xml = nil, id_attribute = nil, classes = nil, class_attribute = nil, title_element = nil, width_attribute = nil, height_attribute = nil, $case = nil, asset_uri_scheme = nil, start_anchor = nil, delimiter = nil, autoplay_param = nil, loop_param = nil, rel_param_val = nil, start_param = nil, end_param = nil, has_loop_param = nil, controls_param = nil, fs_param = nil, fs_attribute = nil, modest_param = nil, theme_param = nil, hl_param = nil, target = nil, list = nil, list_param = nil, playlist = nil, poster_attribute = nil, val = nil, preload_attribute = nil, start_t = nil, end_t = nil, time_anchor = nil; + + + xml = self.xml_mode; + id_attribute = (function() {if ($truthy(node.$id())) { + return "" + " id=\"" + (node.$id()) + "\"" + } else { + return "" + }; return nil; })(); + classes = ["videoblock"]; + if ($truthy(node['$attr?']("float"))) { + classes['$<<'](node.$attr("float"))}; + if ($truthy(node['$attr?']("align"))) { + classes['$<<']("" + "text-" + (node.$attr("align")))}; + if ($truthy(node.$role())) { + classes['$<<'](node.$role())}; + class_attribute = "" + " class=\"" + (classes.$join(" ")) + "\""; + title_element = (function() {if ($truthy(node['$title?']())) { + return "" + "\n
    " + (node.$title()) + "
    " + } else { + return "" + }; return nil; })(); + width_attribute = (function() {if ($truthy(node['$attr?']("width"))) { + return "" + " width=\"" + (node.$attr("width")) + "\"" + } else { + return "" + }; return nil; })(); + height_attribute = (function() {if ($truthy(node['$attr?']("height"))) { + return "" + " height=\"" + (node.$attr("height")) + "\"" + } else { + return "" + }; return nil; })(); + return (function() {$case = node.$attr("poster"); + if ("vimeo"['$===']($case)) { + if ($truthy((asset_uri_scheme = node.$document().$attr("asset-uri-scheme", "https"))['$empty?']())) { + } else { + asset_uri_scheme = "" + (asset_uri_scheme) + ":" + }; + start_anchor = (function() {if ($truthy(node['$attr?']("start", nil, false))) { + return "" + "#at=" + (node.$attr("start")) + } else { + return "" + }; return nil; })(); + delimiter = "?"; + if ($truthy(node['$option?']("autoplay"))) { + + autoplay_param = "" + (delimiter) + "autoplay=1"; + delimiter = "&"; + } else { + autoplay_param = "" + }; + loop_param = (function() {if ($truthy(node['$option?']("loop"))) { + return "" + (delimiter) + "loop=1" + } else { + return "" + }; return nil; })(); + return "" + "" + (title_element) + "\n" + "
    \n" + "\n" + "
    \n" + "";} + else if ("youtube"['$===']($case)) { + if ($truthy((asset_uri_scheme = node.$document().$attr("asset-uri-scheme", "https"))['$empty?']())) { + } else { + asset_uri_scheme = "" + (asset_uri_scheme) + ":" + }; + rel_param_val = (function() {if ($truthy(node['$option?']("related"))) { + return 1 + } else { + return 0 + }; return nil; })(); + start_param = (function() {if ($truthy(node['$attr?']("start", nil, false))) { + return "" + "&start=" + (node.$attr("start")) + } else { + return "" + }; return nil; })(); + end_param = (function() {if ($truthy(node['$attr?']("end", nil, false))) { + return "" + "&end=" + (node.$attr("end")) + } else { + return "" + }; return nil; })(); + autoplay_param = (function() {if ($truthy(node['$option?']("autoplay"))) { + return "&autoplay=1" + } else { + return "" + }; return nil; })(); + loop_param = (function() {if ($truthy((has_loop_param = node['$option?']("loop")))) { + return "&loop=1" + } else { + return "" + }; return nil; })(); + controls_param = (function() {if ($truthy(node['$option?']("nocontrols"))) { + return "&controls=0" + } else { + return "" + }; return nil; })(); + if ($truthy(node['$option?']("nofullscreen"))) { + + fs_param = "&fs=0"; + fs_attribute = ""; + } else { + + fs_param = ""; + fs_attribute = self.$append_boolean_attribute("allowfullscreen", xml); + }; + modest_param = (function() {if ($truthy(node['$option?']("modest"))) { + return "&modestbranding=1" + } else { + return "" + }; return nil; })(); + theme_param = (function() {if ($truthy(node['$attr?']("theme", nil, false))) { + return "" + "&theme=" + (node.$attr("theme")) + } else { + return "" + }; return nil; })(); + hl_param = (function() {if ($truthy(node['$attr?']("lang"))) { + return "" + "&hl=" + (node.$attr("lang")) + } else { + return "" + }; return nil; })(); + $b = node.$attr("target").$split("/", 2), $a = Opal.to_ary($b), (target = ($a[0] == null ? nil : $a[0])), (list = ($a[1] == null ? nil : $a[1])), $b; + if ($truthy((list = ($truthy($a = list) ? $a : node.$attr("list", nil, false))))) { + list_param = "" + "&list=" + (list) + } else { + + $b = target.$split(",", 2), $a = Opal.to_ary($b), (target = ($a[0] == null ? nil : $a[0])), (playlist = ($a[1] == null ? nil : $a[1])), $b; + if ($truthy((playlist = ($truthy($a = playlist) ? $a : node.$attr("playlist", nil, false))))) { + list_param = "" + "&playlist=" + (playlist) + } else { + list_param = (function() {if ($truthy(has_loop_param)) { + return "" + "&playlist=" + (target) + } else { + return "" + }; return nil; })() + }; + }; + return "" + "" + (title_element) + "\n" + "
    \n" + "\n" + "
    \n" + "";} + else { + poster_attribute = (function() {if ($truthy((val = node.$attr("poster", nil, false))['$nil_or_empty?']())) { + return "" + } else { + return "" + " poster=\"" + (node.$media_uri(val)) + "\"" + }; return nil; })(); + preload_attribute = (function() {if ($truthy((val = node.$attr("preload", nil, false))['$nil_or_empty?']())) { + return "" + } else { + return "" + " preload=\"" + (val) + "\"" + }; return nil; })(); + start_t = node.$attr("start", nil, false); + end_t = node.$attr("end", nil, false); + time_anchor = (function() {if ($truthy(($truthy($a = start_t) ? $a : end_t))) { + return "" + "#t=" + (($truthy($a = start_t) ? $a : "")) + ((function() {if ($truthy(end_t)) { + return "" + "," + (end_t) + } else { + return "" + }; return nil; })()) + } else { + return "" + }; return nil; })(); + return "" + "" + (title_element) + "\n" + "
    \n" + "\n" + "
    \n" + "";}})(); + }, TMP_Html5Converter_video_47.$$arity = 1); + + Opal.def(self, '$inline_anchor', TMP_Html5Converter_inline_anchor_48 = function $$inline_anchor(node) { + var $a, self = this, $case = nil, path = nil, attrs = nil, text = nil, refid = nil, ref = nil; + + return (function() {$case = node.$type(); + if ("xref"['$===']($case)) { + if ($truthy((path = node.$attributes()['$[]']("path")))) { + + attrs = self.$append_link_constraint_attrs(node, (function() {if ($truthy(node.$role())) { + return ["" + " class=\"" + (node.$role()) + "\""] + } else { + return [] + }; return nil; })()).$join(); + text = ($truthy($a = node.$text()) ? $a : path); + } else { + + attrs = (function() {if ($truthy(node.$role())) { + return "" + " class=\"" + (node.$role()) + "\"" + } else { + return "" + }; return nil; })(); + if ($truthy((text = node.$text()))) { + } else { + + refid = node.$attributes()['$[]']("refid"); + if ($truthy($$($nesting, 'AbstractNode')['$===']((ref = (self.refs = ($truthy($a = self.refs) ? $a : node.$document().$catalog()['$[]']("refs")))['$[]'](refid))))) { + text = ($truthy($a = ref.$xreftext(node.$attr("xrefstyle"))) ? $a : "" + "[" + (refid) + "]") + } else { + text = "" + "[" + (refid) + "]" + }; + }; + }; + return "" + "" + (text) + "";} + else if ("ref"['$===']($case)) {return "" + ""} + else if ("link"['$===']($case)) { + attrs = (function() {if ($truthy(node.$id())) { + return ["" + " id=\"" + (node.$id()) + "\""] + } else { + return [] + }; return nil; })(); + if ($truthy(node.$role())) { + attrs['$<<']("" + " class=\"" + (node.$role()) + "\"")}; + if ($truthy(node['$attr?']("title", nil, false))) { + attrs['$<<']("" + " title=\"" + (node.$attr("title")) + "\"")}; + return "" + "" + (node.$text()) + "";} + else if ("bibref"['$===']($case)) {return "" + "" + (node.$text())} + else { + self.$logger().$warn("" + "unknown anchor type: " + (node.$type().$inspect())); + return nil;}})() + }, TMP_Html5Converter_inline_anchor_48.$$arity = 1); + + Opal.def(self, '$inline_break', TMP_Html5Converter_inline_break_49 = function $$inline_break(node) { + var self = this; + + return "" + (node.$text()) + "" + }, TMP_Html5Converter_inline_break_49.$$arity = 1); + + Opal.def(self, '$inline_button', TMP_Html5Converter_inline_button_50 = function $$inline_button(node) { + var self = this; + + return "" + "" + (node.$text()) + "" + }, TMP_Html5Converter_inline_button_50.$$arity = 1); + + Opal.def(self, '$inline_callout', TMP_Html5Converter_inline_callout_51 = function $$inline_callout(node) { + var self = this, src = nil; + + if ($truthy(node.$document()['$attr?']("icons", "font"))) { + return "" + "(" + (node.$text()) + ")" + } else if ($truthy(node.$document()['$attr?']("icons"))) { + + src = node.$icon_uri("" + "callouts/" + (node.$text())); + return "" + "\"""; + } else { + return "" + (node.$attributes()['$[]']("guard")) + "(" + (node.$text()) + ")" + } + }, TMP_Html5Converter_inline_callout_51.$$arity = 1); + + Opal.def(self, '$inline_footnote', TMP_Html5Converter_inline_footnote_52 = function $$inline_footnote(node) { + var self = this, index = nil, id_attr = nil; + + if ($truthy((index = node.$attr("index", nil, false)))) { + if (node.$type()['$==']("xref")) { + return "" + "[" + (index) + "]" + } else { + + id_attr = (function() {if ($truthy(node.$id())) { + return "" + " id=\"_footnote_" + (node.$id()) + "\"" + } else { + return "" + }; return nil; })(); + return "" + "[" + (index) + "]"; + } + } else if (node.$type()['$==']("xref")) { + return "" + "[" + (node.$text()) + "]" + } else { + return nil + } + }, TMP_Html5Converter_inline_footnote_52.$$arity = 1); + + Opal.def(self, '$inline_image', TMP_Html5Converter_inline_image_53 = function $$inline_image(node) { + var $a, TMP_54, TMP_55, $b, $c, $d, self = this, type = nil, class_attr_val = nil, title_attr = nil, img = nil, target = nil, attrs = nil, svg = nil, obj = nil, fallback = nil, role = nil; + + + if ($truthy((($a = (type = node.$type())['$==']("icon")) ? node.$document()['$attr?']("icons", "font") : (type = node.$type())['$==']("icon")))) { + + class_attr_val = "" + "fa fa-" + (node.$target()); + $send($hash2(["size", "rotate", "flip"], {"size": "fa-", "rotate": "fa-rotate-", "flip": "fa-flip-"}), 'each', [], (TMP_54 = function(key, prefix){var self = TMP_54.$$s || this; + + + + if (key == null) { + key = nil; + }; + + if (prefix == null) { + prefix = nil; + }; + if ($truthy(node['$attr?'](key))) { + return (class_attr_val = "" + (class_attr_val) + " " + (prefix) + (node.$attr(key))) + } else { + return nil + };}, TMP_54.$$s = self, TMP_54.$$arity = 2, TMP_54)); + title_attr = (function() {if ($truthy(node['$attr?']("title"))) { + return "" + " title=\"" + (node.$attr("title")) + "\"" + } else { + return "" + }; return nil; })(); + img = "" + ""; + } else if ($truthy((($a = type['$==']("icon")) ? node.$document()['$attr?']("icons")['$!']() : type['$==']("icon")))) { + img = "" + "[" + (node.$alt()) + "]" + } else { + + target = node.$target(); + attrs = $send(["width", "height", "title"], 'map', [], (TMP_55 = function(name){var self = TMP_55.$$s || this; + + + + if (name == null) { + name = nil; + }; + if ($truthy(node['$attr?'](name))) { + return "" + " " + (name) + "=\"" + (node.$attr(name)) + "\"" + } else { + return "" + };}, TMP_55.$$s = self, TMP_55.$$arity = 1, TMP_55)).$join(); + if ($truthy(($truthy($a = ($truthy($b = ($truthy($c = type['$!=']("icon")) ? ($truthy($d = node['$attr?']("format", "svg", false)) ? $d : target['$include?'](".svg")) : $c)) ? $rb_lt(node.$document().$safe(), $$$($$($nesting, 'SafeMode'), 'SECURE')) : $b)) ? ($truthy($b = (svg = node['$option?']("inline"))) ? $b : (obj = node['$option?']("interactive"))) : $a))) { + if ($truthy(svg)) { + img = ($truthy($a = self.$read_svg_contents(node, target)) ? $a : "" + "" + (node.$alt()) + "") + } else if ($truthy(obj)) { + + fallback = (function() {if ($truthy(node['$attr?']("fallback"))) { + return "" + "\""" + } else { + return "" + "" + (node.$alt()) + "" + }; return nil; })(); + img = "" + "" + (fallback) + "";}}; + img = ($truthy($a = img) ? $a : "" + "\"""); + }; + if ($truthy(node['$attr?']("link", nil, false))) { + img = "" + "" + (img) + ""}; + if ($truthy((role = node.$role()))) { + if ($truthy(node['$attr?']("float"))) { + class_attr_val = "" + (type) + " " + (node.$attr("float")) + " " + (role) + } else { + class_attr_val = "" + (type) + " " + (role) + } + } else if ($truthy(node['$attr?']("float"))) { + class_attr_val = "" + (type) + " " + (node.$attr("float")) + } else { + class_attr_val = type + }; + return "" + "" + (img) + ""; + }, TMP_Html5Converter_inline_image_53.$$arity = 1); + + Opal.def(self, '$inline_indexterm', TMP_Html5Converter_inline_indexterm_56 = function $$inline_indexterm(node) { + var self = this; + + if (node.$type()['$==']("visible")) { + return node.$text() + } else { + return "" + } + }, TMP_Html5Converter_inline_indexterm_56.$$arity = 1); + + Opal.def(self, '$inline_kbd', TMP_Html5Converter_inline_kbd_57 = function $$inline_kbd(node) { + var self = this, keys = nil; + + if ((keys = node.$attr("keys")).$size()['$=='](1)) { + return "" + "" + (keys['$[]'](0)) + "" + } else { + return "" + "" + (keys.$join("+")) + "" + } + }, TMP_Html5Converter_inline_kbd_57.$$arity = 1); + + Opal.def(self, '$inline_menu', TMP_Html5Converter_inline_menu_58 = function $$inline_menu(node) { + var self = this, caret = nil, submenu_joiner = nil, menu = nil, submenus = nil, menuitem = nil; + + + caret = (function() {if ($truthy(node.$document()['$attr?']("icons", "font"))) { + return "  " + } else { + return "  " + }; return nil; })(); + submenu_joiner = "" + "" + (caret) + ""; + menu = node.$attr("menu"); + if ($truthy((submenus = node.$attr("submenus"))['$empty?']())) { + if ($truthy((menuitem = node.$attr("menuitem", nil, false)))) { + return "" + "" + (menu) + "" + (caret) + "" + (menuitem) + "" + } else { + return "" + "" + (menu) + "" + } + } else { + return "" + "" + (menu) + "" + (caret) + "" + (submenus.$join(submenu_joiner)) + "" + (caret) + "" + (node.$attr("menuitem")) + "" + }; + }, TMP_Html5Converter_inline_menu_58.$$arity = 1); + + Opal.def(self, '$inline_quoted', TMP_Html5Converter_inline_quoted_59 = function $$inline_quoted(node) { + var $a, $b, self = this, open = nil, close = nil, is_tag = nil, class_attr = nil, id_attr = nil; + + + $b = $$($nesting, 'QUOTE_TAGS')['$[]'](node.$type()), $a = Opal.to_ary($b), (open = ($a[0] == null ? nil : $a[0])), (close = ($a[1] == null ? nil : $a[1])), (is_tag = ($a[2] == null ? nil : $a[2])), $b; + if ($truthy(node.$role())) { + class_attr = "" + " class=\"" + (node.$role()) + "\""}; + if ($truthy(node.$id())) { + id_attr = "" + " id=\"" + (node.$id()) + "\""}; + if ($truthy(($truthy($a = class_attr) ? $a : id_attr))) { + if ($truthy(is_tag)) { + return "" + (open.$chop()) + (($truthy($a = id_attr) ? $a : "")) + (($truthy($a = class_attr) ? $a : "")) + ">" + (node.$text()) + (close) + } else { + return "" + "" + (open) + (node.$text()) + (close) + "" + } + } else { + return "" + (open) + (node.$text()) + (close) + }; + }, TMP_Html5Converter_inline_quoted_59.$$arity = 1); + + Opal.def(self, '$append_boolean_attribute', TMP_Html5Converter_append_boolean_attribute_60 = function $$append_boolean_attribute(name, xml) { + var self = this; + + if ($truthy(xml)) { + return "" + " " + (name) + "=\"" + (name) + "\"" + } else { + return "" + " " + (name) + } + }, TMP_Html5Converter_append_boolean_attribute_60.$$arity = 2); + + Opal.def(self, '$encode_quotes', TMP_Html5Converter_encode_quotes_61 = function $$encode_quotes(val) { + var self = this; + + if ($truthy(val['$include?']("\""))) { + + return val.$gsub("\"", """); + } else { + return val + } + }, TMP_Html5Converter_encode_quotes_61.$$arity = 1); + + Opal.def(self, '$generate_manname_section', TMP_Html5Converter_generate_manname_section_62 = function $$generate_manname_section(node) { + var $a, self = this, manname_title = nil, next_section = nil, next_section_title = nil, manname_id_attr = nil, manname_id = nil; + + + manname_title = node.$attr("manname-title", "Name"); + if ($truthy(($truthy($a = (next_section = node.$sections()['$[]'](0))) ? (next_section_title = next_section.$title())['$=='](next_section_title.$upcase()) : $a))) { + manname_title = manname_title.$upcase()}; + manname_id_attr = (function() {if ($truthy((manname_id = node.$attr("manname-id")))) { + return "" + " id=\"" + (manname_id) + "\"" + } else { + return "" + }; return nil; })(); + return "" + "" + (manname_title) + "\n" + "
    \n" + "

    " + (node.$attr("manname")) + " - " + (node.$attr("manpurpose")) + "

    \n" + "
    "; + }, TMP_Html5Converter_generate_manname_section_62.$$arity = 1); + + Opal.def(self, '$append_link_constraint_attrs', TMP_Html5Converter_append_link_constraint_attrs_63 = function $$append_link_constraint_attrs(node, attrs) { + var $a, self = this, rel = nil, window = nil; + + + + if (attrs == null) { + attrs = []; + }; + if ($truthy(node['$option?']("nofollow"))) { + rel = "nofollow"}; + if ($truthy((window = node.$attributes()['$[]']("window")))) { + + attrs['$<<']("" + " target=\"" + (window) + "\""); + if ($truthy(($truthy($a = window['$==']("_blank")) ? $a : node['$option?']("noopener")))) { + attrs['$<<']((function() {if ($truthy(rel)) { + return "" + " rel=\"" + (rel) + " noopener\"" + } else { + return " rel=\"noopener\"" + }; return nil; })())}; + } else if ($truthy(rel)) { + attrs['$<<']("" + " rel=\"" + (rel) + "\"")}; + return attrs; + }, TMP_Html5Converter_append_link_constraint_attrs_63.$$arity = -2); + return (Opal.def(self, '$read_svg_contents', TMP_Html5Converter_read_svg_contents_64 = function $$read_svg_contents(node, target) { + var TMP_65, self = this, svg = nil, old_start_tag = nil, new_start_tag = nil; + + + if ($truthy((svg = node.$read_contents(target, $hash2(["start", "normalize", "label"], {"start": node.$document().$attr("imagesdir"), "normalize": true, "label": "SVG"}))))) { + + if ($truthy(svg['$start_with?'](""); + } else { + return nil + };}, TMP_65.$$s = self, TMP_65.$$arity = 1, TMP_65)); + if ($truthy(new_start_tag)) { + svg = "" + (new_start_tag) + (svg['$[]'](Opal.Range.$new(old_start_tag.$length(), -1, false)))};}; + return svg; + }, TMP_Html5Converter_read_svg_contents_64.$$arity = 2), nil) && 'read_svg_contents'; + })($$($nesting, 'Converter'), $$$($$($nesting, 'Converter'), 'BuiltIn'), $nesting) + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/extensions"] = function(Opal) { + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + function $rb_plus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); + } + function $rb_gt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); + } + function $rb_lt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); + } + var $a, self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $truthy = Opal.truthy, $module = Opal.module, $klass = Opal.klass, $hash2 = Opal.hash2, $send = Opal.send, $hash = Opal.hash; + + Opal.add_stubs(['$require', '$to_s', '$[]=', '$config', '$-', '$nil_or_empty?', '$name', '$grep', '$constants', '$include', '$const_get', '$extend', '$attr_reader', '$merge', '$class', '$update', '$raise', '$document', '$==', '$doctype', '$[]', '$+', '$level', '$delete', '$>', '$casecmp', '$new', '$title=', '$sectname=', '$special=', '$fetch', '$numbered=', '$!', '$key?', '$attr?', '$special', '$numbered', '$generate_id', '$title', '$id=', '$update_attributes', '$tr', '$basename', '$create_block', '$assign_caption', '$===', '$next_block', '$dup', '$<<', '$has_more_lines?', '$each', '$define_method', '$unshift', '$shift', '$send', '$empty?', '$size', '$call', '$option', '$flatten', '$respond_to?', '$include?', '$split', '$to_i', '$compact', '$inspect', '$attr_accessor', '$to_set', '$match?', '$resolve_regexp', '$method', '$register', '$values', '$groups', '$arity', '$instance_exec', '$to_proc', '$activate', '$add_document_processor', '$any?', '$select', '$add_syntax_processor', '$to_sym', '$instance_variable_get', '$kind', '$private', '$join', '$map', '$capitalize', '$instance_variable_set', '$resolve_args', '$freeze', '$process_block_given?', '$source_location', '$resolve_class', '$<', '$update_config', '$push', '$as_symbol', '$name=', '$pop', '$-@', '$next_auto_id', '$generate_name', '$class_for_name', '$reduce', '$const_defined?']); + + if ($truthy((($a = $$($nesting, 'Asciidoctor', 'skip_raise')) ? 'constant' : nil))) { + } else { + self.$require("asciidoctor".$to_s()) + }; + return (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + (function($base, $parent_nesting) { + function $Extensions() {}; + var self = $Extensions = $module($base, 'Extensions', $Extensions); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + + (function($base, $super, $parent_nesting) { + function $Processor(){}; + var self = $Processor = $klass($base, $super, 'Processor', $Processor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Processor_initialize_4, TMP_Processor_update_config_5, TMP_Processor_process_6, TMP_Processor_create_section_7, TMP_Processor_create_block_8, TMP_Processor_create_list_9, TMP_Processor_create_list_item_10, TMP_Processor_create_image_block_11, TMP_Processor_create_inline_12, TMP_Processor_parse_content_13, TMP_Processor_14; + + def.config = nil; + + (function(self, $parent_nesting) { + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_config_1, TMP_option_2, TMP_use_dsl_3; + + + + Opal.def(self, '$config', TMP_config_1 = function $$config() { + var $a, self = this; + if (self.config == null) self.config = nil; + + return (self.config = ($truthy($a = self.config) ? $a : $hash2([], {}))) + }, TMP_config_1.$$arity = 0); + + Opal.def(self, '$option', TMP_option_2 = function $$option(key, default_value) { + var self = this, $writer = nil; + + + $writer = [key, default_value]; + $send(self.$config(), '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + }, TMP_option_2.$$arity = 2); + + Opal.def(self, '$use_dsl', TMP_use_dsl_3 = function $$use_dsl() { + var self = this; + + if ($truthy(self.$name()['$nil_or_empty?']())) { + if ($truthy((Opal.Module.$$nesting = $nesting, self.$constants()).$grep("DSL"))) { + return self.$include(self.$const_get("DSL")) + } else { + return nil + } + } else if ($truthy((Opal.Module.$$nesting = $nesting, self.$constants()).$grep("DSL"))) { + return self.$extend(self.$const_get("DSL")) + } else { + return nil + } + }, TMP_use_dsl_3.$$arity = 0); + Opal.alias(self, "extend_dsl", "use_dsl"); + return Opal.alias(self, "include_dsl", "use_dsl"); + })(Opal.get_singleton_class(self), $nesting); + self.$attr_reader("config"); + + Opal.def(self, '$initialize', TMP_Processor_initialize_4 = function $$initialize(config) { + var self = this; + + + + if (config == null) { + config = $hash2([], {}); + }; + return (self.config = self.$class().$config().$merge(config)); + }, TMP_Processor_initialize_4.$$arity = -1); + + Opal.def(self, '$update_config', TMP_Processor_update_config_5 = function $$update_config(config) { + var self = this; + + return self.config.$update(config) + }, TMP_Processor_update_config_5.$$arity = 1); + + Opal.def(self, '$process', TMP_Processor_process_6 = function $$process($a) { + var $post_args, args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + return self.$raise($$$('::', 'NotImplementedError'), "" + "Asciidoctor::Extensions::Processor subclass must implement #" + ("process") + " method"); + }, TMP_Processor_process_6.$$arity = -1); + + Opal.def(self, '$create_section', TMP_Processor_create_section_7 = function $$create_section(parent, title, attrs, opts) { + var $a, self = this, doc = nil, book = nil, doctype = nil, level = nil, style = nil, sectname = nil, special = nil, sect = nil, $writer = nil, id = nil; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + doc = parent.$document(); + book = (doctype = doc.$doctype())['$==']("book"); + level = ($truthy($a = opts['$[]']("level")) ? $a : $rb_plus(parent.$level(), 1)); + if ($truthy((style = attrs.$delete("style")))) { + if ($truthy(($truthy($a = book) ? style['$==']("abstract") : $a))) { + $a = ["chapter", 1], (sectname = $a[0]), (level = $a[1]), $a + } else { + + $a = [style, true], (sectname = $a[0]), (special = $a[1]), $a; + if (level['$=='](0)) { + level = 1}; + } + } else if ($truthy(book)) { + sectname = (function() {if (level['$=='](0)) { + return "part" + } else { + + if ($truthy($rb_gt(level, 1))) { + return "section" + } else { + return "chapter" + }; + }; return nil; })() + } else if ($truthy((($a = doctype['$==']("manpage")) ? title.$casecmp("synopsis")['$=='](0) : doctype['$==']("manpage")))) { + $a = ["synopsis", true], (sectname = $a[0]), (special = $a[1]), $a + } else { + sectname = "section" + }; + sect = $$($nesting, 'Section').$new(parent, level); + $a = [title, sectname], sect['$title=']($a[0]), sect['$sectname=']($a[1]), $a; + if ($truthy(special)) { + + + $writer = [true]; + $send(sect, 'special=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + if ($truthy(opts.$fetch("numbered", style['$==']("appendix")))) { + + $writer = [true]; + $send(sect, 'numbered=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + } else if ($truthy(($truthy($a = opts['$key?']("numbered")['$!']()) ? doc['$attr?']("sectnums", "all") : $a))) { + + $writer = [(function() {if ($truthy(($truthy($a = book) ? level['$=='](1) : $a))) { + return "chapter" + } else { + return true + }; return nil; })()]; + $send(sect, 'numbered=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + } else if ($truthy($rb_gt(level, 0))) { + if ($truthy(opts.$fetch("numbered", doc['$attr?']("sectnums")))) { + + $writer = [(function() {if ($truthy(sect.$special())) { + return ($truthy($a = parent.$numbered()) ? true : $a) + } else { + return true + }; return nil; })()]; + $send(sect, 'numbered=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];} + } else if ($truthy(opts.$fetch("numbered", ($truthy($a = book) ? doc['$attr?']("partnums") : $a)))) { + + $writer = [true]; + $send(sect, 'numbered=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if ((id = attrs.$delete("id"))['$=='](false)) { + } else { + + $writer = [(($writer = ["id", ($truthy($a = id) ? $a : (function() {if ($truthy(doc['$attr?']("sectids"))) { + + return $$($nesting, 'Section').$generate_id(sect.$title(), doc); + } else { + return nil + }; return nil; })())]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])]; + $send(sect, 'id=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + sect.$update_attributes(attrs); + return sect; + }, TMP_Processor_create_section_7.$$arity = -4); + + Opal.def(self, '$create_block', TMP_Processor_create_block_8 = function $$create_block(parent, context, source, attrs, opts) { + var self = this; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + return $$($nesting, 'Block').$new(parent, context, $hash2(["source", "attributes"], {"source": source, "attributes": attrs}).$merge(opts)); + }, TMP_Processor_create_block_8.$$arity = -5); + + Opal.def(self, '$create_list', TMP_Processor_create_list_9 = function $$create_list(parent, context, attrs) { + var self = this, list = nil; + + + + if (attrs == null) { + attrs = nil; + }; + list = $$($nesting, 'List').$new(parent, context); + if ($truthy(attrs)) { + list.$update_attributes(attrs)}; + return list; + }, TMP_Processor_create_list_9.$$arity = -3); + + Opal.def(self, '$create_list_item', TMP_Processor_create_list_item_10 = function $$create_list_item(parent, text) { + var self = this; + + + + if (text == null) { + text = nil; + }; + return $$($nesting, 'ListItem').$new(parent, text); + }, TMP_Processor_create_list_item_10.$$arity = -2); + + Opal.def(self, '$create_image_block', TMP_Processor_create_image_block_11 = function $$create_image_block(parent, attrs, opts) { + var $a, self = this, target = nil, $writer = nil, title = nil, block = nil; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + if ($truthy((target = attrs['$[]']("target")))) { + } else { + self.$raise($$$('::', 'ArgumentError'), "Unable to create an image block, target attribute is required") + }; + ($truthy($a = attrs['$[]']("alt")) ? $a : (($writer = ["alt", (($writer = ["default-alt", $$($nesting, 'Helpers').$basename(target, true).$tr("_-", " ")]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + title = (function() {if ($truthy(attrs['$key?']("title"))) { + + return attrs.$delete("title"); + } else { + return nil + }; return nil; })(); + block = self.$create_block(parent, "image", nil, attrs, opts); + if ($truthy(title)) { + + + $writer = [title]; + $send(block, 'title=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + block.$assign_caption(attrs.$delete("caption"), ($truthy($a = opts['$[]']("caption_context")) ? $a : "figure"));}; + return block; + }, TMP_Processor_create_image_block_11.$$arity = -3); + + Opal.def(self, '$create_inline', TMP_Processor_create_inline_12 = function $$create_inline(parent, context, text, opts) { + var self = this; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + return $$($nesting, 'Inline').$new(parent, context, text, opts); + }, TMP_Processor_create_inline_12.$$arity = -4); + + Opal.def(self, '$parse_content', TMP_Processor_parse_content_13 = function $$parse_content(parent, content, attributes) { + var $a, $b, $c, self = this, reader = nil, block = nil; + + + + if (attributes == null) { + attributes = nil; + }; + reader = (function() {if ($truthy($$($nesting, 'Reader')['$==='](content))) { + return content + } else { + + return $$($nesting, 'Reader').$new(content); + }; return nil; })(); + while ($truthy(($truthy($b = ($truthy($c = (block = $$($nesting, 'Parser').$next_block(reader, parent, (function() {if ($truthy(attributes)) { + return attributes.$dup() + } else { + return $hash2([], {}) + }; return nil; })()))) ? parent['$<<'](block) : $c)) ? $b : reader['$has_more_lines?']()))) { + + }; + return parent; + }, TMP_Processor_parse_content_13.$$arity = -3); + return $send([["create_paragraph", "create_block", "paragraph"], ["create_open_block", "create_block", "open"], ["create_example_block", "create_block", "example"], ["create_pass_block", "create_block", "pass"], ["create_listing_block", "create_block", "listing"], ["create_literal_block", "create_block", "literal"], ["create_anchor", "create_inline", "anchor"]], 'each', [], (TMP_Processor_14 = function(method_name, delegate_method_name, context){var self = TMP_Processor_14.$$s || this, TMP_15; + + + + if (method_name == null) { + method_name = nil; + }; + + if (delegate_method_name == null) { + delegate_method_name = nil; + }; + + if (context == null) { + context = nil; + }; + return $send(self, 'define_method', [method_name], (TMP_15 = function($a){var self = TMP_15.$$s || this, $post_args, args; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + args.$unshift(args.$shift(), context); + return $send(self, 'send', [delegate_method_name].concat(Opal.to_a(args)));}, TMP_15.$$s = self, TMP_15.$$arity = -1, TMP_15));}, TMP_Processor_14.$$s = self, TMP_Processor_14.$$arity = 3, TMP_Processor_14)); + })($nesting[0], null, $nesting); + (function($base, $parent_nesting) { + function $ProcessorDsl() {}; + var self = $ProcessorDsl = $module($base, 'ProcessorDsl', $ProcessorDsl); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_ProcessorDsl_option_16, TMP_ProcessorDsl_process_17, TMP_ProcessorDsl_process_block_given$q_18; + + + + Opal.def(self, '$option', TMP_ProcessorDsl_option_16 = function $$option(key, value) { + var self = this, $writer = nil; + + + $writer = [key, value]; + $send(self.$config(), '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + }, TMP_ProcessorDsl_option_16.$$arity = 2); + + Opal.def(self, '$process', TMP_ProcessorDsl_process_17 = function $$process($a) { + var $iter = TMP_ProcessorDsl_process_17.$$p, block = $iter || nil, $post_args, args, $b, self = this; + if (self.process_block == null) self.process_block = nil; + + if ($iter) TMP_ProcessorDsl_process_17.$$p = null; + + + if ($iter) TMP_ProcessorDsl_process_17.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + if ((block !== nil)) { + + if ($truthy(args['$empty?']())) { + } else { + self.$raise($$$('::', 'ArgumentError'), "" + "wrong number of arguments (given " + (args.$size()) + ", expected 0)") + }; + return (self.process_block = block); + } else if ($truthy((($b = self['process_block'], $b != null && $b !== nil) ? 'instance-variable' : nil))) { + return $send(self.process_block, 'call', Opal.to_a(args)) + } else { + return self.$raise($$$('::', 'NotImplementedError')) + }; + }, TMP_ProcessorDsl_process_17.$$arity = -1); + + Opal.def(self, '$process_block_given?', TMP_ProcessorDsl_process_block_given$q_18 = function() { + var $a, self = this; + + return (($a = self['process_block'], $a != null && $a !== nil) ? 'instance-variable' : nil) + }, TMP_ProcessorDsl_process_block_given$q_18.$$arity = 0); + })($nesting[0], $nesting); + (function($base, $parent_nesting) { + function $DocumentProcessorDsl() {}; + var self = $DocumentProcessorDsl = $module($base, 'DocumentProcessorDsl', $DocumentProcessorDsl); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_DocumentProcessorDsl_prefer_19; + + + self.$include($$($nesting, 'ProcessorDsl')); + + Opal.def(self, '$prefer', TMP_DocumentProcessorDsl_prefer_19 = function $$prefer() { + var self = this; + + return self.$option("position", ">>") + }, TMP_DocumentProcessorDsl_prefer_19.$$arity = 0); + })($nesting[0], $nesting); + (function($base, $parent_nesting) { + function $SyntaxProcessorDsl() {}; + var self = $SyntaxProcessorDsl = $module($base, 'SyntaxProcessorDsl', $SyntaxProcessorDsl); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_SyntaxProcessorDsl_named_20, TMP_SyntaxProcessorDsl_content_model_21, TMP_SyntaxProcessorDsl_positional_attrs_22, TMP_SyntaxProcessorDsl_default_attrs_23, TMP_SyntaxProcessorDsl_resolves_attributes_24; + + + self.$include($$($nesting, 'ProcessorDsl')); + + Opal.def(self, '$named', TMP_SyntaxProcessorDsl_named_20 = function $$named(value) { + var self = this; + + if ($truthy($$($nesting, 'Processor')['$==='](self))) { + return (self.name = value) + } else { + return self.$option("name", value) + } + }, TMP_SyntaxProcessorDsl_named_20.$$arity = 1); + Opal.alias(self, "match_name", "named"); + + Opal.def(self, '$content_model', TMP_SyntaxProcessorDsl_content_model_21 = function $$content_model(value) { + var self = this; + + return self.$option("content_model", value) + }, TMP_SyntaxProcessorDsl_content_model_21.$$arity = 1); + Opal.alias(self, "parse_content_as", "content_model"); + Opal.alias(self, "parses_content_as", "content_model"); + + Opal.def(self, '$positional_attrs', TMP_SyntaxProcessorDsl_positional_attrs_22 = function $$positional_attrs($a) { + var $post_args, value, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + value = $post_args;; + return self.$option("pos_attrs", value.$flatten()); + }, TMP_SyntaxProcessorDsl_positional_attrs_22.$$arity = -1); + Opal.alias(self, "name_attributes", "positional_attrs"); + Opal.alias(self, "name_positional_attributes", "positional_attrs"); + + Opal.def(self, '$default_attrs', TMP_SyntaxProcessorDsl_default_attrs_23 = function $$default_attrs(value) { + var self = this; + + return self.$option("default_attrs", value) + }, TMP_SyntaxProcessorDsl_default_attrs_23.$$arity = 1); + + Opal.def(self, '$resolves_attributes', TMP_SyntaxProcessorDsl_resolves_attributes_24 = function $$resolves_attributes($a) { + var $post_args, args, $b, TMP_25, TMP_26, self = this, $case = nil, names = nil, defaults = nil; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + if ($truthy($rb_gt(args.$size(), 1))) { + } else if ($truthy((args = args.$fetch(0, true))['$respond_to?']("to_sym"))) { + args = [args]}; + return (function() {$case = args; + if (true['$===']($case)) { + self.$option("pos_attrs", []); + return self.$option("default_attrs", $hash2([], {}));} + else if ($$$('::', 'Array')['$===']($case)) { + $b = [[], $hash2([], {})], (names = $b[0]), (defaults = $b[1]), $b; + $send(args, 'each', [], (TMP_25 = function(arg){var self = TMP_25.$$s || this, $c, $d, name = nil, value = nil, idx = nil, $writer = nil; + + + + if (arg == null) { + arg = nil; + }; + if ($truthy((arg = arg.$to_s())['$include?']("="))) { + + $d = arg.$split("=", 2), $c = Opal.to_ary($d), (name = ($c[0] == null ? nil : $c[0])), (value = ($c[1] == null ? nil : $c[1])), $d; + if ($truthy(name['$include?'](":"))) { + + $d = name.$split(":", 2), $c = Opal.to_ary($d), (idx = ($c[0] == null ? nil : $c[0])), (name = ($c[1] == null ? nil : $c[1])), $d; + idx = (function() {if (idx['$==']("@")) { + return names.$size() + } else { + return idx.$to_i() + }; return nil; })(); + + $writer = [idx, name]; + $send(names, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];;}; + + $writer = [name, value]; + $send(defaults, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];; + } else if ($truthy(arg['$include?'](":"))) { + + $d = arg.$split(":", 2), $c = Opal.to_ary($d), (idx = ($c[0] == null ? nil : $c[0])), (name = ($c[1] == null ? nil : $c[1])), $d; + idx = (function() {if (idx['$==']("@")) { + return names.$size() + } else { + return idx.$to_i() + }; return nil; })(); + + $writer = [idx, name]; + $send(names, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];; + } else { + return names['$<<'](arg) + };}, TMP_25.$$s = self, TMP_25.$$arity = 1, TMP_25)); + self.$option("pos_attrs", names.$compact()); + return self.$option("default_attrs", defaults);} + else if ($$$('::', 'Hash')['$===']($case)) { + $b = [[], $hash2([], {})], (names = $b[0]), (defaults = $b[1]), $b; + $send(args, 'each', [], (TMP_26 = function(key, val){var self = TMP_26.$$s || this, $c, $d, name = nil, idx = nil, $writer = nil; + + + + if (key == null) { + key = nil; + }; + + if (val == null) { + val = nil; + }; + if ($truthy((name = key.$to_s())['$include?'](":"))) { + + $d = name.$split(":", 2), $c = Opal.to_ary($d), (idx = ($c[0] == null ? nil : $c[0])), (name = ($c[1] == null ? nil : $c[1])), $d; + idx = (function() {if (idx['$==']("@")) { + return names.$size() + } else { + return idx.$to_i() + }; return nil; })(); + + $writer = [idx, name]; + $send(names, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];;}; + if ($truthy(val)) { + + $writer = [name, val]; + $send(defaults, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + } else { + return nil + };}, TMP_26.$$s = self, TMP_26.$$arity = 2, TMP_26)); + self.$option("pos_attrs", names.$compact()); + return self.$option("default_attrs", defaults);} + else {return self.$raise($$$('::', 'ArgumentError'), "" + "unsupported attributes specification for macro: " + (args.$inspect()))}})(); + }, TMP_SyntaxProcessorDsl_resolves_attributes_24.$$arity = -1); + Opal.alias(self, "resolve_attributes", "resolves_attributes"); + })($nesting[0], $nesting); + (function($base, $super, $parent_nesting) { + function $Preprocessor(){}; + var self = $Preprocessor = $klass($base, $super, 'Preprocessor', $Preprocessor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Preprocessor_process_27; + + return (Opal.def(self, '$process', TMP_Preprocessor_process_27 = function $$process(document, reader) { + var self = this; + + return self.$raise($$$('::', 'NotImplementedError'), "" + "Asciidoctor::Extensions::Preprocessor subclass must implement #" + ("process") + " method") + }, TMP_Preprocessor_process_27.$$arity = 2), nil) && 'process' + })($nesting[0], $$($nesting, 'Processor'), $nesting); + Opal.const_set($$($nesting, 'Preprocessor'), 'DSL', $$($nesting, 'DocumentProcessorDsl')); + (function($base, $super, $parent_nesting) { + function $TreeProcessor(){}; + var self = $TreeProcessor = $klass($base, $super, 'TreeProcessor', $TreeProcessor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_TreeProcessor_process_28; + + return (Opal.def(self, '$process', TMP_TreeProcessor_process_28 = function $$process(document) { + var self = this; + + return self.$raise($$$('::', 'NotImplementedError'), "" + "Asciidoctor::Extensions::TreeProcessor subclass must implement #" + ("process") + " method") + }, TMP_TreeProcessor_process_28.$$arity = 1), nil) && 'process' + })($nesting[0], $$($nesting, 'Processor'), $nesting); + Opal.const_set($$($nesting, 'TreeProcessor'), 'DSL', $$($nesting, 'DocumentProcessorDsl')); + Opal.const_set($nesting[0], 'Treeprocessor', $$($nesting, 'TreeProcessor')); + (function($base, $super, $parent_nesting) { + function $Postprocessor(){}; + var self = $Postprocessor = $klass($base, $super, 'Postprocessor', $Postprocessor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Postprocessor_process_29; + + return (Opal.def(self, '$process', TMP_Postprocessor_process_29 = function $$process(document, output) { + var self = this; + + return self.$raise($$$('::', 'NotImplementedError'), "" + "Asciidoctor::Extensions::Postprocessor subclass must implement #" + ("process") + " method") + }, TMP_Postprocessor_process_29.$$arity = 2), nil) && 'process' + })($nesting[0], $$($nesting, 'Processor'), $nesting); + Opal.const_set($$($nesting, 'Postprocessor'), 'DSL', $$($nesting, 'DocumentProcessorDsl')); + (function($base, $super, $parent_nesting) { + function $IncludeProcessor(){}; + var self = $IncludeProcessor = $klass($base, $super, 'IncludeProcessor', $IncludeProcessor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_IncludeProcessor_process_30, TMP_IncludeProcessor_handles$q_31; + + + + Opal.def(self, '$process', TMP_IncludeProcessor_process_30 = function $$process(document, reader, target, attributes) { + var self = this; + + return self.$raise($$$('::', 'NotImplementedError'), "" + "Asciidoctor::Extensions::IncludeProcessor subclass must implement #" + ("process") + " method") + }, TMP_IncludeProcessor_process_30.$$arity = 4); + return (Opal.def(self, '$handles?', TMP_IncludeProcessor_handles$q_31 = function(target) { + var self = this; + + return true + }, TMP_IncludeProcessor_handles$q_31.$$arity = 1), nil) && 'handles?'; + })($nesting[0], $$($nesting, 'Processor'), $nesting); + (function($base, $parent_nesting) { + function $IncludeProcessorDsl() {}; + var self = $IncludeProcessorDsl = $module($base, 'IncludeProcessorDsl', $IncludeProcessorDsl); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_IncludeProcessorDsl_handles$q_32; + + + self.$include($$($nesting, 'DocumentProcessorDsl')); + + Opal.def(self, '$handles?', TMP_IncludeProcessorDsl_handles$q_32 = function($a) { + var $iter = TMP_IncludeProcessorDsl_handles$q_32.$$p, block = $iter || nil, $post_args, args, $b, self = this; + if (self.handles_block == null) self.handles_block = nil; + + if ($iter) TMP_IncludeProcessorDsl_handles$q_32.$$p = null; + + + if ($iter) TMP_IncludeProcessorDsl_handles$q_32.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + if ((block !== nil)) { + + if ($truthy(args['$empty?']())) { + } else { + self.$raise($$$('::', 'ArgumentError'), "" + "wrong number of arguments (given " + (args.$size()) + ", expected 0)") + }; + return (self.handles_block = block); + } else if ($truthy((($b = self['handles_block'], $b != null && $b !== nil) ? 'instance-variable' : nil))) { + return self.handles_block.$call(args['$[]'](0)) + } else { + return true + }; + }, TMP_IncludeProcessorDsl_handles$q_32.$$arity = -1); + })($nesting[0], $nesting); + Opal.const_set($$($nesting, 'IncludeProcessor'), 'DSL', $$($nesting, 'IncludeProcessorDsl')); + (function($base, $super, $parent_nesting) { + function $DocinfoProcessor(){}; + var self = $DocinfoProcessor = $klass($base, $super, 'DocinfoProcessor', $DocinfoProcessor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_DocinfoProcessor_initialize_33, TMP_DocinfoProcessor_process_34; + + def.config = nil; + + self.$attr_accessor("location"); + + Opal.def(self, '$initialize', TMP_DocinfoProcessor_initialize_33 = function $$initialize(config) { + var $a, $iter = TMP_DocinfoProcessor_initialize_33.$$p, $yield = $iter || nil, self = this, $writer = nil; + + if ($iter) TMP_DocinfoProcessor_initialize_33.$$p = null; + + + if (config == null) { + config = $hash2([], {}); + }; + $send(self, Opal.find_super_dispatcher(self, 'initialize', TMP_DocinfoProcessor_initialize_33, false), [config], null); + return ($truthy($a = self.config['$[]']("location")) ? $a : (($writer = ["location", "head"]), $send(self.config, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + }, TMP_DocinfoProcessor_initialize_33.$$arity = -1); + return (Opal.def(self, '$process', TMP_DocinfoProcessor_process_34 = function $$process(document) { + var self = this; + + return self.$raise($$$('::', 'NotImplementedError'), "" + "Asciidoctor::Extensions::DocinfoProcessor subclass must implement #" + ("process") + " method") + }, TMP_DocinfoProcessor_process_34.$$arity = 1), nil) && 'process'; + })($nesting[0], $$($nesting, 'Processor'), $nesting); + (function($base, $parent_nesting) { + function $DocinfoProcessorDsl() {}; + var self = $DocinfoProcessorDsl = $module($base, 'DocinfoProcessorDsl', $DocinfoProcessorDsl); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_DocinfoProcessorDsl_at_location_35; + + + self.$include($$($nesting, 'DocumentProcessorDsl')); + + Opal.def(self, '$at_location', TMP_DocinfoProcessorDsl_at_location_35 = function $$at_location(value) { + var self = this; + + return self.$option("location", value) + }, TMP_DocinfoProcessorDsl_at_location_35.$$arity = 1); + })($nesting[0], $nesting); + Opal.const_set($$($nesting, 'DocinfoProcessor'), 'DSL', $$($nesting, 'DocinfoProcessorDsl')); + (function($base, $super, $parent_nesting) { + function $BlockProcessor(){}; + var self = $BlockProcessor = $klass($base, $super, 'BlockProcessor', $BlockProcessor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_BlockProcessor_initialize_36, TMP_BlockProcessor_process_37; + + def.config = nil; + + self.$attr_accessor("name"); + + Opal.def(self, '$initialize', TMP_BlockProcessor_initialize_36 = function $$initialize(name, config) { + var $a, $iter = TMP_BlockProcessor_initialize_36.$$p, $yield = $iter || nil, self = this, $case = nil, $writer = nil; + + if ($iter) TMP_BlockProcessor_initialize_36.$$p = null; + + + if (name == null) { + name = nil; + }; + + if (config == null) { + config = $hash2([], {}); + }; + $send(self, Opal.find_super_dispatcher(self, 'initialize', TMP_BlockProcessor_initialize_36, false), [config], null); + self.name = ($truthy($a = name) ? $a : self.config['$[]']("name")); + $case = self.config['$[]']("contexts"); + if ($$$('::', 'NilClass')['$===']($case)) {($truthy($a = self.config['$[]']("contexts")) ? $a : (($writer = ["contexts", ["open", "paragraph"].$to_set()]), $send(self.config, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]))} + else if ($$$('::', 'Symbol')['$===']($case)) { + $writer = ["contexts", [self.config['$[]']("contexts")].$to_set()]; + $send(self.config, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];} + else { + $writer = ["contexts", self.config['$[]']("contexts").$to_set()]; + $send(self.config, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + return ($truthy($a = self.config['$[]']("content_model")) ? $a : (($writer = ["content_model", "compound"]), $send(self.config, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + }, TMP_BlockProcessor_initialize_36.$$arity = -1); + return (Opal.def(self, '$process', TMP_BlockProcessor_process_37 = function $$process(parent, reader, attributes) { + var self = this; + + return self.$raise($$$('::', 'NotImplementedError'), "" + "Asciidoctor::Extensions::BlockProcessor subclass must implement #" + ("process") + " method") + }, TMP_BlockProcessor_process_37.$$arity = 3), nil) && 'process'; + })($nesting[0], $$($nesting, 'Processor'), $nesting); + (function($base, $parent_nesting) { + function $BlockProcessorDsl() {}; + var self = $BlockProcessorDsl = $module($base, 'BlockProcessorDsl', $BlockProcessorDsl); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_BlockProcessorDsl_contexts_38; + + + self.$include($$($nesting, 'SyntaxProcessorDsl')); + + Opal.def(self, '$contexts', TMP_BlockProcessorDsl_contexts_38 = function $$contexts($a) { + var $post_args, value, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + value = $post_args;; + return self.$option("contexts", value.$flatten().$to_set()); + }, TMP_BlockProcessorDsl_contexts_38.$$arity = -1); + Opal.alias(self, "on_contexts", "contexts"); + Opal.alias(self, "on_context", "contexts"); + Opal.alias(self, "bound_to", "contexts"); + })($nesting[0], $nesting); + Opal.const_set($$($nesting, 'BlockProcessor'), 'DSL', $$($nesting, 'BlockProcessorDsl')); + (function($base, $super, $parent_nesting) { + function $MacroProcessor(){}; + var self = $MacroProcessor = $klass($base, $super, 'MacroProcessor', $MacroProcessor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_MacroProcessor_initialize_39, TMP_MacroProcessor_process_40; + + def.config = nil; + + self.$attr_accessor("name"); + + Opal.def(self, '$initialize', TMP_MacroProcessor_initialize_39 = function $$initialize(name, config) { + var $a, $iter = TMP_MacroProcessor_initialize_39.$$p, $yield = $iter || nil, self = this, $writer = nil; + + if ($iter) TMP_MacroProcessor_initialize_39.$$p = null; + + + if (name == null) { + name = nil; + }; + + if (config == null) { + config = $hash2([], {}); + }; + $send(self, Opal.find_super_dispatcher(self, 'initialize', TMP_MacroProcessor_initialize_39, false), [config], null); + self.name = ($truthy($a = name) ? $a : self.config['$[]']("name")); + return ($truthy($a = self.config['$[]']("content_model")) ? $a : (($writer = ["content_model", "attributes"]), $send(self.config, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + }, TMP_MacroProcessor_initialize_39.$$arity = -1); + return (Opal.def(self, '$process', TMP_MacroProcessor_process_40 = function $$process(parent, target, attributes) { + var self = this; + + return self.$raise($$$('::', 'NotImplementedError'), "" + "Asciidoctor::Extensions::MacroProcessor subclass must implement #" + ("process") + " method") + }, TMP_MacroProcessor_process_40.$$arity = 3), nil) && 'process'; + })($nesting[0], $$($nesting, 'Processor'), $nesting); + (function($base, $parent_nesting) { + function $MacroProcessorDsl() {}; + var self = $MacroProcessorDsl = $module($base, 'MacroProcessorDsl', $MacroProcessorDsl); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_MacroProcessorDsl_resolves_attributes_41; + + + self.$include($$($nesting, 'SyntaxProcessorDsl')); + + Opal.def(self, '$resolves_attributes', TMP_MacroProcessorDsl_resolves_attributes_41 = function $$resolves_attributes($a) { + var $post_args, args, $b, $iter = TMP_MacroProcessorDsl_resolves_attributes_41.$$p, $yield = $iter || nil, self = this, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_MacroProcessorDsl_resolves_attributes_41.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + if ($truthy((($b = args.$size()['$=='](1)) ? args['$[]'](0)['$!']() : args.$size()['$=='](1)))) { + + self.$option("content_model", "text"); + return nil;}; + $send(self, Opal.find_super_dispatcher(self, 'resolves_attributes', TMP_MacroProcessorDsl_resolves_attributes_41, false), $zuper, $iter); + return self.$option("content_model", "attributes"); + }, TMP_MacroProcessorDsl_resolves_attributes_41.$$arity = -1); + Opal.alias(self, "resolve_attributes", "resolves_attributes"); + })($nesting[0], $nesting); + (function($base, $super, $parent_nesting) { + function $BlockMacroProcessor(){}; + var self = $BlockMacroProcessor = $klass($base, $super, 'BlockMacroProcessor', $BlockMacroProcessor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_BlockMacroProcessor_name_42; + + def.name = nil; + return (Opal.def(self, '$name', TMP_BlockMacroProcessor_name_42 = function $$name() { + var self = this; + + + if ($truthy($$($nesting, 'MacroNameRx')['$match?'](self.name.$to_s()))) { + } else { + self.$raise($$$('::', 'ArgumentError'), "" + "invalid name for block macro: " + (self.name)) + }; + return self.name; + }, TMP_BlockMacroProcessor_name_42.$$arity = 0), nil) && 'name' + })($nesting[0], $$($nesting, 'MacroProcessor'), $nesting); + Opal.const_set($$($nesting, 'BlockMacroProcessor'), 'DSL', $$($nesting, 'MacroProcessorDsl')); + (function($base, $super, $parent_nesting) { + function $InlineMacroProcessor(){}; + var self = $InlineMacroProcessor = $klass($base, $super, 'InlineMacroProcessor', $InlineMacroProcessor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_InlineMacroProcessor_regexp_43, TMP_InlineMacroProcessor_resolve_regexp_44; + + def.config = def.name = nil; + + (Opal.class_variable_set($InlineMacroProcessor, '@@rx_cache', $hash2([], {}))); + + Opal.def(self, '$regexp', TMP_InlineMacroProcessor_regexp_43 = function $$regexp() { + var $a, self = this, $writer = nil; + + return ($truthy($a = self.config['$[]']("regexp")) ? $a : (($writer = ["regexp", self.$resolve_regexp(self.name.$to_s(), self.config['$[]']("format"))]), $send(self.config, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])) + }, TMP_InlineMacroProcessor_regexp_43.$$arity = 0); + return (Opal.def(self, '$resolve_regexp', TMP_InlineMacroProcessor_resolve_regexp_44 = function $$resolve_regexp(name, format) { + var $a, $b, self = this, $writer = nil; + + + if ($truthy($$($nesting, 'MacroNameRx')['$match?'](name))) { + } else { + self.$raise($$$('::', 'ArgumentError'), "" + "invalid name for inline macro: " + (name)) + }; + return ($truthy($a = (($b = $InlineMacroProcessor.$$cvars['@@rx_cache']) == null ? nil : $b)['$[]']([name, format])) ? $a : (($writer = [[name, format], new RegExp("" + "\\\\?" + (name) + ":" + ((function() {if (format['$==']("short")) { + return "(){0}" + } else { + return "(\\S+?)" + }; return nil; })()) + "\\[(|.*?[^\\\\])\\]")]), $send((($b = $InlineMacroProcessor.$$cvars['@@rx_cache']) == null ? nil : $b), '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + }, TMP_InlineMacroProcessor_resolve_regexp_44.$$arity = 2), nil) && 'resolve_regexp'; + })($nesting[0], $$($nesting, 'MacroProcessor'), $nesting); + (function($base, $parent_nesting) { + function $InlineMacroProcessorDsl() {}; + var self = $InlineMacroProcessorDsl = $module($base, 'InlineMacroProcessorDsl', $InlineMacroProcessorDsl); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_InlineMacroProcessorDsl_with_format_45, TMP_InlineMacroProcessorDsl_matches_46; + + + self.$include($$($nesting, 'MacroProcessorDsl')); + + Opal.def(self, '$with_format', TMP_InlineMacroProcessorDsl_with_format_45 = function $$with_format(value) { + var self = this; + + return self.$option("format", value) + }, TMP_InlineMacroProcessorDsl_with_format_45.$$arity = 1); + Opal.alias(self, "using_format", "with_format"); + + Opal.def(self, '$matches', TMP_InlineMacroProcessorDsl_matches_46 = function $$matches(value) { + var self = this; + + return self.$option("regexp", value) + }, TMP_InlineMacroProcessorDsl_matches_46.$$arity = 1); + Opal.alias(self, "match", "matches"); + Opal.alias(self, "matching", "matches"); + })($nesting[0], $nesting); + Opal.const_set($$($nesting, 'InlineMacroProcessor'), 'DSL', $$($nesting, 'InlineMacroProcessorDsl')); + (function($base, $super, $parent_nesting) { + function $Extension(){}; + var self = $Extension = $klass($base, $super, 'Extension', $Extension); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Extension_initialize_47; + + + self.$attr_reader("kind"); + self.$attr_reader("config"); + self.$attr_reader("instance"); + return (Opal.def(self, '$initialize', TMP_Extension_initialize_47 = function $$initialize(kind, instance, config) { + var self = this; + + + self.kind = kind; + self.instance = instance; + return (self.config = config); + }, TMP_Extension_initialize_47.$$arity = 3), nil) && 'initialize'; + })($nesting[0], null, $nesting); + (function($base, $super, $parent_nesting) { + function $ProcessorExtension(){}; + var self = $ProcessorExtension = $klass($base, $super, 'ProcessorExtension', $ProcessorExtension); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_ProcessorExtension_initialize_48; + + + self.$attr_reader("process_method"); + return (Opal.def(self, '$initialize', TMP_ProcessorExtension_initialize_48 = function $$initialize(kind, instance, process_method) { + var $a, $iter = TMP_ProcessorExtension_initialize_48.$$p, $yield = $iter || nil, self = this; + + if ($iter) TMP_ProcessorExtension_initialize_48.$$p = null; + + + if (process_method == null) { + process_method = nil; + }; + $send(self, Opal.find_super_dispatcher(self, 'initialize', TMP_ProcessorExtension_initialize_48, false), [kind, instance, instance.$config()], null); + return (self.process_method = ($truthy($a = process_method) ? $a : instance.$method("process"))); + }, TMP_ProcessorExtension_initialize_48.$$arity = -3), nil) && 'initialize'; + })($nesting[0], $$($nesting, 'Extension'), $nesting); + (function($base, $super, $parent_nesting) { + function $Group(){}; + var self = $Group = $klass($base, $super, 'Group', $Group); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Group_activate_50; + + + (function(self, $parent_nesting) { + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_register_49; + + return (Opal.def(self, '$register', TMP_register_49 = function $$register(name) { + var self = this; + + + + if (name == null) { + name = nil; + }; + return $$($nesting, 'Extensions').$register(name, self); + }, TMP_register_49.$$arity = -1), nil) && 'register' + })(Opal.get_singleton_class(self), $nesting); + return (Opal.def(self, '$activate', TMP_Group_activate_50 = function $$activate(registry) { + var self = this; + + return self.$raise($$$('::', 'NotImplementedError')) + }, TMP_Group_activate_50.$$arity = 1), nil) && 'activate'; + })($nesting[0], null, $nesting); + (function($base, $super, $parent_nesting) { + function $Registry(){}; + var self = $Registry = $klass($base, $super, 'Registry', $Registry); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Registry_initialize_51, TMP_Registry_activate_52, TMP_Registry_preprocessor_54, TMP_Registry_preprocessors$q_55, TMP_Registry_preprocessors_56, TMP_Registry_tree_processor_57, TMP_Registry_tree_processors$q_58, TMP_Registry_tree_processors_59, TMP_Registry_postprocessor_60, TMP_Registry_postprocessors$q_61, TMP_Registry_postprocessors_62, TMP_Registry_include_processor_63, TMP_Registry_include_processors$q_64, TMP_Registry_include_processors_65, TMP_Registry_docinfo_processor_66, TMP_Registry_docinfo_processors$q_67, TMP_Registry_docinfo_processors_69, TMP_Registry_block_71, TMP_Registry_blocks$q_72, TMP_Registry_registered_for_block$q_73, TMP_Registry_find_block_extension_74, TMP_Registry_block_macro_75, TMP_Registry_block_macros$q_76, TMP_Registry_registered_for_block_macro$q_77, TMP_Registry_find_block_macro_extension_78, TMP_Registry_inline_macro_79, TMP_Registry_inline_macros$q_80, TMP_Registry_registered_for_inline_macro$q_81, TMP_Registry_find_inline_macro_extension_82, TMP_Registry_inline_macros_83, TMP_Registry_prefer_84, TMP_Registry_add_document_processor_85, TMP_Registry_add_syntax_processor_87, TMP_Registry_resolve_args_89, TMP_Registry_as_symbol_90; + + def.groups = def.preprocessor_extensions = def.tree_processor_extensions = def.postprocessor_extensions = def.include_processor_extensions = def.docinfo_processor_extensions = def.block_extensions = def.block_macro_extensions = def.inline_macro_extensions = nil; + + self.$attr_reader("document"); + self.$attr_reader("groups"); + + Opal.def(self, '$initialize', TMP_Registry_initialize_51 = function $$initialize(groups) { + var self = this; + + + + if (groups == null) { + groups = $hash2([], {}); + }; + self.groups = groups; + self.preprocessor_extensions = (self.tree_processor_extensions = (self.postprocessor_extensions = (self.include_processor_extensions = (self.docinfo_processor_extensions = (self.block_extensions = (self.block_macro_extensions = (self.inline_macro_extensions = nil))))))); + return (self.document = nil); + }, TMP_Registry_initialize_51.$$arity = -1); + + Opal.def(self, '$activate', TMP_Registry_activate_52 = function $$activate(document) { + var TMP_53, self = this, ext_groups = nil; + + + self.document = document; + if ($truthy((ext_groups = $rb_plus($$($nesting, 'Extensions').$groups().$values(), self.groups.$values()))['$empty?']())) { + } else { + $send(ext_groups, 'each', [], (TMP_53 = function(group){var self = TMP_53.$$s || this, $case = nil; + + + + if (group == null) { + group = nil; + }; + return (function() {$case = group; + if ($$$('::', 'Proc')['$===']($case)) {return (function() {$case = group.$arity(); + if ((0)['$===']($case) || (-1)['$===']($case)) {return $send(self, 'instance_exec', [], group.$to_proc())} + else if ((1)['$===']($case)) {return group.$call(self)} + else { return nil }})()} + else if ($$$('::', 'Class')['$===']($case)) {return group.$new().$activate(self)} + else {return group.$activate(self)}})();}, TMP_53.$$s = self, TMP_53.$$arity = 1, TMP_53)) + }; + return self; + }, TMP_Registry_activate_52.$$arity = 1); + + Opal.def(self, '$preprocessor', TMP_Registry_preprocessor_54 = function $$preprocessor($a) { + var $iter = TMP_Registry_preprocessor_54.$$p, block = $iter || nil, $post_args, args, self = this; + + if ($iter) TMP_Registry_preprocessor_54.$$p = null; + + + if ($iter) TMP_Registry_preprocessor_54.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + return $send(self, 'add_document_processor', ["preprocessor", args], block.$to_proc()); + }, TMP_Registry_preprocessor_54.$$arity = -1); + + Opal.def(self, '$preprocessors?', TMP_Registry_preprocessors$q_55 = function() { + var self = this; + + return self.preprocessor_extensions['$!']()['$!']() + }, TMP_Registry_preprocessors$q_55.$$arity = 0); + + Opal.def(self, '$preprocessors', TMP_Registry_preprocessors_56 = function $$preprocessors() { + var self = this; + + return self.preprocessor_extensions + }, TMP_Registry_preprocessors_56.$$arity = 0); + + Opal.def(self, '$tree_processor', TMP_Registry_tree_processor_57 = function $$tree_processor($a) { + var $iter = TMP_Registry_tree_processor_57.$$p, block = $iter || nil, $post_args, args, self = this; + + if ($iter) TMP_Registry_tree_processor_57.$$p = null; + + + if ($iter) TMP_Registry_tree_processor_57.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + return $send(self, 'add_document_processor', ["tree_processor", args], block.$to_proc()); + }, TMP_Registry_tree_processor_57.$$arity = -1); + + Opal.def(self, '$tree_processors?', TMP_Registry_tree_processors$q_58 = function() { + var self = this; + + return self.tree_processor_extensions['$!']()['$!']() + }, TMP_Registry_tree_processors$q_58.$$arity = 0); + + Opal.def(self, '$tree_processors', TMP_Registry_tree_processors_59 = function $$tree_processors() { + var self = this; + + return self.tree_processor_extensions + }, TMP_Registry_tree_processors_59.$$arity = 0); + Opal.alias(self, "treeprocessor", "tree_processor"); + Opal.alias(self, "treeprocessors?", "tree_processors?"); + Opal.alias(self, "treeprocessors", "tree_processors"); + + Opal.def(self, '$postprocessor', TMP_Registry_postprocessor_60 = function $$postprocessor($a) { + var $iter = TMP_Registry_postprocessor_60.$$p, block = $iter || nil, $post_args, args, self = this; + + if ($iter) TMP_Registry_postprocessor_60.$$p = null; + + + if ($iter) TMP_Registry_postprocessor_60.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + return $send(self, 'add_document_processor', ["postprocessor", args], block.$to_proc()); + }, TMP_Registry_postprocessor_60.$$arity = -1); + + Opal.def(self, '$postprocessors?', TMP_Registry_postprocessors$q_61 = function() { + var self = this; + + return self.postprocessor_extensions['$!']()['$!']() + }, TMP_Registry_postprocessors$q_61.$$arity = 0); + + Opal.def(self, '$postprocessors', TMP_Registry_postprocessors_62 = function $$postprocessors() { + var self = this; + + return self.postprocessor_extensions + }, TMP_Registry_postprocessors_62.$$arity = 0); + + Opal.def(self, '$include_processor', TMP_Registry_include_processor_63 = function $$include_processor($a) { + var $iter = TMP_Registry_include_processor_63.$$p, block = $iter || nil, $post_args, args, self = this; + + if ($iter) TMP_Registry_include_processor_63.$$p = null; + + + if ($iter) TMP_Registry_include_processor_63.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + return $send(self, 'add_document_processor', ["include_processor", args], block.$to_proc()); + }, TMP_Registry_include_processor_63.$$arity = -1); + + Opal.def(self, '$include_processors?', TMP_Registry_include_processors$q_64 = function() { + var self = this; + + return self.include_processor_extensions['$!']()['$!']() + }, TMP_Registry_include_processors$q_64.$$arity = 0); + + Opal.def(self, '$include_processors', TMP_Registry_include_processors_65 = function $$include_processors() { + var self = this; + + return self.include_processor_extensions + }, TMP_Registry_include_processors_65.$$arity = 0); + + Opal.def(self, '$docinfo_processor', TMP_Registry_docinfo_processor_66 = function $$docinfo_processor($a) { + var $iter = TMP_Registry_docinfo_processor_66.$$p, block = $iter || nil, $post_args, args, self = this; + + if ($iter) TMP_Registry_docinfo_processor_66.$$p = null; + + + if ($iter) TMP_Registry_docinfo_processor_66.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + return $send(self, 'add_document_processor', ["docinfo_processor", args], block.$to_proc()); + }, TMP_Registry_docinfo_processor_66.$$arity = -1); + + Opal.def(self, '$docinfo_processors?', TMP_Registry_docinfo_processors$q_67 = function(location) { + var TMP_68, self = this; + + + + if (location == null) { + location = nil; + }; + if ($truthy(self.docinfo_processor_extensions)) { + if ($truthy(location)) { + return $send(self.docinfo_processor_extensions, 'any?', [], (TMP_68 = function(ext){var self = TMP_68.$$s || this; + + + + if (ext == null) { + ext = nil; + }; + return ext.$config()['$[]']("location")['$=='](location);}, TMP_68.$$s = self, TMP_68.$$arity = 1, TMP_68)) + } else { + return true + } + } else { + return false + }; + }, TMP_Registry_docinfo_processors$q_67.$$arity = -1); + + Opal.def(self, '$docinfo_processors', TMP_Registry_docinfo_processors_69 = function $$docinfo_processors(location) { + var TMP_70, self = this; + + + + if (location == null) { + location = nil; + }; + if ($truthy(self.docinfo_processor_extensions)) { + if ($truthy(location)) { + return $send(self.docinfo_processor_extensions, 'select', [], (TMP_70 = function(ext){var self = TMP_70.$$s || this; + + + + if (ext == null) { + ext = nil; + }; + return ext.$config()['$[]']("location")['$=='](location);}, TMP_70.$$s = self, TMP_70.$$arity = 1, TMP_70)) + } else { + return self.docinfo_processor_extensions + } + } else { + return nil + }; + }, TMP_Registry_docinfo_processors_69.$$arity = -1); + + Opal.def(self, '$block', TMP_Registry_block_71 = function $$block($a) { + var $iter = TMP_Registry_block_71.$$p, block = $iter || nil, $post_args, args, self = this; + + if ($iter) TMP_Registry_block_71.$$p = null; + + + if ($iter) TMP_Registry_block_71.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + return $send(self, 'add_syntax_processor', ["block", args], block.$to_proc()); + }, TMP_Registry_block_71.$$arity = -1); + + Opal.def(self, '$blocks?', TMP_Registry_blocks$q_72 = function() { + var self = this; + + return self.block_extensions['$!']()['$!']() + }, TMP_Registry_blocks$q_72.$$arity = 0); + + Opal.def(self, '$registered_for_block?', TMP_Registry_registered_for_block$q_73 = function(name, context) { + var self = this, ext = nil; + + if ($truthy((ext = self.block_extensions['$[]'](name.$to_sym())))) { + if ($truthy(ext.$config()['$[]']("contexts")['$include?'](context))) { + return ext + } else { + return false + } + } else { + return false + } + }, TMP_Registry_registered_for_block$q_73.$$arity = 2); + + Opal.def(self, '$find_block_extension', TMP_Registry_find_block_extension_74 = function $$find_block_extension(name) { + var self = this; + + return self.block_extensions['$[]'](name.$to_sym()) + }, TMP_Registry_find_block_extension_74.$$arity = 1); + + Opal.def(self, '$block_macro', TMP_Registry_block_macro_75 = function $$block_macro($a) { + var $iter = TMP_Registry_block_macro_75.$$p, block = $iter || nil, $post_args, args, self = this; + + if ($iter) TMP_Registry_block_macro_75.$$p = null; + + + if ($iter) TMP_Registry_block_macro_75.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + return $send(self, 'add_syntax_processor', ["block_macro", args], block.$to_proc()); + }, TMP_Registry_block_macro_75.$$arity = -1); + + Opal.def(self, '$block_macros?', TMP_Registry_block_macros$q_76 = function() { + var self = this; + + return self.block_macro_extensions['$!']()['$!']() + }, TMP_Registry_block_macros$q_76.$$arity = 0); + + Opal.def(self, '$registered_for_block_macro?', TMP_Registry_registered_for_block_macro$q_77 = function(name) { + var self = this, ext = nil; + + if ($truthy((ext = self.block_macro_extensions['$[]'](name.$to_sym())))) { + return ext + } else { + return false + } + }, TMP_Registry_registered_for_block_macro$q_77.$$arity = 1); + + Opal.def(self, '$find_block_macro_extension', TMP_Registry_find_block_macro_extension_78 = function $$find_block_macro_extension(name) { + var self = this; + + return self.block_macro_extensions['$[]'](name.$to_sym()) + }, TMP_Registry_find_block_macro_extension_78.$$arity = 1); + + Opal.def(self, '$inline_macro', TMP_Registry_inline_macro_79 = function $$inline_macro($a) { + var $iter = TMP_Registry_inline_macro_79.$$p, block = $iter || nil, $post_args, args, self = this; + + if ($iter) TMP_Registry_inline_macro_79.$$p = null; + + + if ($iter) TMP_Registry_inline_macro_79.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + return $send(self, 'add_syntax_processor', ["inline_macro", args], block.$to_proc()); + }, TMP_Registry_inline_macro_79.$$arity = -1); + + Opal.def(self, '$inline_macros?', TMP_Registry_inline_macros$q_80 = function() { + var self = this; + + return self.inline_macro_extensions['$!']()['$!']() + }, TMP_Registry_inline_macros$q_80.$$arity = 0); + + Opal.def(self, '$registered_for_inline_macro?', TMP_Registry_registered_for_inline_macro$q_81 = function(name) { + var self = this, ext = nil; + + if ($truthy((ext = self.inline_macro_extensions['$[]'](name.$to_sym())))) { + return ext + } else { + return false + } + }, TMP_Registry_registered_for_inline_macro$q_81.$$arity = 1); + + Opal.def(self, '$find_inline_macro_extension', TMP_Registry_find_inline_macro_extension_82 = function $$find_inline_macro_extension(name) { + var self = this; + + return self.inline_macro_extensions['$[]'](name.$to_sym()) + }, TMP_Registry_find_inline_macro_extension_82.$$arity = 1); + + Opal.def(self, '$inline_macros', TMP_Registry_inline_macros_83 = function $$inline_macros() { + var self = this; + + return self.inline_macro_extensions.$values() + }, TMP_Registry_inline_macros_83.$$arity = 0); + + Opal.def(self, '$prefer', TMP_Registry_prefer_84 = function $$prefer($a) { + var $iter = TMP_Registry_prefer_84.$$p, block = $iter || nil, $post_args, args, self = this, extension = nil, arg0 = nil, extensions_store = nil; + + if ($iter) TMP_Registry_prefer_84.$$p = null; + + + if ($iter) TMP_Registry_prefer_84.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + extension = (function() {if ($truthy($$($nesting, 'ProcessorExtension')['$===']((arg0 = args.$shift())))) { + return arg0 + } else { + + return $send(self, 'send', [arg0].concat(Opal.to_a(args)), block.$to_proc()); + }; return nil; })(); + extensions_store = self.$instance_variable_get(((("" + "@") + (extension.$kind())) + "_extensions").$to_sym()); + extensions_store.$unshift(extensions_store.$delete(extension)); + return extension; + }, TMP_Registry_prefer_84.$$arity = -1); + self.$private(); + + Opal.def(self, '$add_document_processor', TMP_Registry_add_document_processor_85 = function $$add_document_processor(kind, args) { + var $iter = TMP_Registry_add_document_processor_85.$$p, block = $iter || nil, TMP_86, $a, $b, $c, self = this, kind_name = nil, kind_class_symbol = nil, kind_class = nil, kind_java_class = nil, kind_store = nil, extension = nil, config = nil, processor = nil, processor_class = nil, processor_instance = nil; + + if ($iter) TMP_Registry_add_document_processor_85.$$p = null; + + + if ($iter) TMP_Registry_add_document_processor_85.$$p = null;; + kind_name = kind.$to_s().$tr("_", " "); + kind_class_symbol = $send(kind_name.$split(), 'map', [], (TMP_86 = function(it){var self = TMP_86.$$s || this; + + + + if (it == null) { + it = nil; + }; + return it.$capitalize();}, TMP_86.$$s = self, TMP_86.$$arity = 1, TMP_86)).$join().$to_sym(); + kind_class = $$($nesting, 'Extensions').$const_get(kind_class_symbol); + kind_java_class = (function() {if ($truthy((($a = $$$('::', 'AsciidoctorJ', 'skip_raise')) ? 'constant' : nil))) { + + return $$$($$$('::', 'AsciidoctorJ'), 'Extensions').$const_get(kind_class_symbol); + } else { + return nil + }; return nil; })(); + kind_store = ($truthy($b = self.$instance_variable_get(((("" + "@") + (kind)) + "_extensions").$to_sym())) ? $b : self.$instance_variable_set(((("" + "@") + (kind)) + "_extensions").$to_sym(), [])); + extension = (function() {if ((block !== nil)) { + + config = self.$resolve_args(args, 1); + processor = kind_class.$new(config); + if ($truthy(kind_class.$constants().$grep("DSL"))) { + processor.$extend(kind_class.$const_get("DSL"))}; + $send(processor, 'instance_exec', [], block.$to_proc()); + processor.$freeze(); + if ($truthy(processor['$process_block_given?']())) { + } else { + self.$raise($$$('::', 'ArgumentError'), "" + "No block specified to process " + (kind_name) + " extension at " + (block.$source_location())) + }; + return $$($nesting, 'ProcessorExtension').$new(kind, processor); + } else { + + $c = self.$resolve_args(args, 2), $b = Opal.to_ary($c), (processor = ($b[0] == null ? nil : $b[0])), (config = ($b[1] == null ? nil : $b[1])), $c; + if ($truthy((processor_class = $$($nesting, 'Extensions').$resolve_class(processor)))) { + + if ($truthy(($truthy($b = $rb_lt(processor_class, kind_class)) ? $b : ($truthy($c = kind_java_class) ? $rb_lt(processor_class, kind_java_class) : $c)))) { + } else { + self.$raise($$$('::', 'ArgumentError'), "" + "Invalid type for " + (kind_name) + " extension: " + (processor)) + }; + processor_instance = processor_class.$new(config); + processor_instance.$freeze(); + return $$($nesting, 'ProcessorExtension').$new(kind, processor_instance); + } else if ($truthy(($truthy($b = kind_class['$==='](processor)) ? $b : ($truthy($c = kind_java_class) ? kind_java_class['$==='](processor) : $c)))) { + + processor.$update_config(config); + processor.$freeze(); + return $$($nesting, 'ProcessorExtension').$new(kind, processor); + } else { + return self.$raise($$$('::', 'ArgumentError'), "" + "Invalid arguments specified for registering " + (kind_name) + " extension: " + (args)) + }; + }; return nil; })(); + if (extension.$config()['$[]']("position")['$=='](">>")) { + + kind_store.$unshift(extension); + } else { + + kind_store['$<<'](extension); + }; + return extension; + }, TMP_Registry_add_document_processor_85.$$arity = 2); + + Opal.def(self, '$add_syntax_processor', TMP_Registry_add_syntax_processor_87 = function $$add_syntax_processor(kind, args) { + var $iter = TMP_Registry_add_syntax_processor_87.$$p, block = $iter || nil, TMP_88, $a, $b, $c, self = this, kind_name = nil, kind_class_symbol = nil, kind_class = nil, kind_java_class = nil, kind_store = nil, name = nil, config = nil, processor = nil, $writer = nil, processor_class = nil, processor_instance = nil; + + if ($iter) TMP_Registry_add_syntax_processor_87.$$p = null; + + + if ($iter) TMP_Registry_add_syntax_processor_87.$$p = null;; + kind_name = kind.$to_s().$tr("_", " "); + kind_class_symbol = $send(kind_name.$split(), 'map', [], (TMP_88 = function(it){var self = TMP_88.$$s || this; + + + + if (it == null) { + it = nil; + }; + return it.$capitalize();}, TMP_88.$$s = self, TMP_88.$$arity = 1, TMP_88)).$push("Processor").$join().$to_sym(); + kind_class = $$($nesting, 'Extensions').$const_get(kind_class_symbol); + kind_java_class = (function() {if ($truthy((($a = $$$('::', 'AsciidoctorJ', 'skip_raise')) ? 'constant' : nil))) { + + return $$$($$$('::', 'AsciidoctorJ'), 'Extensions').$const_get(kind_class_symbol); + } else { + return nil + }; return nil; })(); + kind_store = ($truthy($b = self.$instance_variable_get(((("" + "@") + (kind)) + "_extensions").$to_sym())) ? $b : self.$instance_variable_set(((("" + "@") + (kind)) + "_extensions").$to_sym(), $hash2([], {}))); + if ((block !== nil)) { + + $c = self.$resolve_args(args, 2), $b = Opal.to_ary($c), (name = ($b[0] == null ? nil : $b[0])), (config = ($b[1] == null ? nil : $b[1])), $c; + processor = kind_class.$new(self.$as_symbol(name), config); + if ($truthy(kind_class.$constants().$grep("DSL"))) { + processor.$extend(kind_class.$const_get("DSL"))}; + if (block.$arity()['$=='](1)) { + Opal.yield1(block, processor) + } else { + $send(processor, 'instance_exec', [], block.$to_proc()) + }; + if ($truthy((name = self.$as_symbol(processor.$name())))) { + } else { + self.$raise($$$('::', 'ArgumentError'), "" + "No name specified for " + (kind_name) + " extension at " + (block.$source_location())) + }; + if ($truthy(processor['$process_block_given?']())) { + } else { + self.$raise($$$('::', 'NoMethodError'), "" + "No block specified to process " + (kind_name) + " extension at " + (block.$source_location())) + }; + processor.$freeze(); + + $writer = [name, $$($nesting, 'ProcessorExtension').$new(kind, processor)]; + $send(kind_store, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];; + } else { + + $c = self.$resolve_args(args, 3), $b = Opal.to_ary($c), (processor = ($b[0] == null ? nil : $b[0])), (name = ($b[1] == null ? nil : $b[1])), (config = ($b[2] == null ? nil : $b[2])), $c; + if ($truthy((processor_class = $$($nesting, 'Extensions').$resolve_class(processor)))) { + + if ($truthy(($truthy($b = $rb_lt(processor_class, kind_class)) ? $b : ($truthy($c = kind_java_class) ? $rb_lt(processor_class, kind_java_class) : $c)))) { + } else { + self.$raise($$$('::', 'ArgumentError'), "" + "Class specified for " + (kind_name) + " extension does not inherit from " + (kind_class) + ": " + (processor)) + }; + processor_instance = processor_class.$new(self.$as_symbol(name), config); + if ($truthy((name = self.$as_symbol(processor_instance.$name())))) { + } else { + self.$raise($$$('::', 'ArgumentError'), "" + "No name specified for " + (kind_name) + " extension: " + (processor)) + }; + processor_instance.$freeze(); + + $writer = [name, $$($nesting, 'ProcessorExtension').$new(kind, processor_instance)]; + $send(kind_store, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];; + } else if ($truthy(($truthy($b = kind_class['$==='](processor)) ? $b : ($truthy($c = kind_java_class) ? kind_java_class['$==='](processor) : $c)))) { + + processor.$update_config(config); + if ($truthy((name = (function() {if ($truthy(name)) { + + + $writer = [self.$as_symbol(name)]; + $send(processor, 'name=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];; + } else { + + return self.$as_symbol(processor.$name()); + }; return nil; })()))) { + } else { + self.$raise($$$('::', 'ArgumentError'), "" + "No name specified for " + (kind_name) + " extension: " + (processor)) + }; + processor.$freeze(); + + $writer = [name, $$($nesting, 'ProcessorExtension').$new(kind, processor)]; + $send(kind_store, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];; + } else { + return self.$raise($$$('::', 'ArgumentError'), "" + "Invalid arguments specified for registering " + (kind_name) + " extension: " + (args)) + }; + }; + }, TMP_Registry_add_syntax_processor_87.$$arity = 2); + + Opal.def(self, '$resolve_args', TMP_Registry_resolve_args_89 = function $$resolve_args(args, expect) { + var self = this, opts = nil, missing = nil; + + + opts = (function() {if ($truthy($$$('::', 'Hash')['$==='](args['$[]'](-1)))) { + return args.$pop() + } else { + return $hash2([], {}) + }; return nil; })(); + if (expect['$=='](1)) { + return opts}; + if ($truthy($rb_gt((missing = $rb_minus($rb_minus(expect, 1), args.$size())), 0))) { + args = $rb_plus(args, $$$('::', 'Array').$new(missing)) + } else if ($truthy($rb_lt(missing, 0))) { + args.$pop(missing['$-@']())}; + args['$<<'](opts); + return args; + }, TMP_Registry_resolve_args_89.$$arity = 2); + return (Opal.def(self, '$as_symbol', TMP_Registry_as_symbol_90 = function $$as_symbol(name) { + var self = this; + + if ($truthy(name)) { + return name.$to_sym() + } else { + return nil + } + }, TMP_Registry_as_symbol_90.$$arity = 1), nil) && 'as_symbol'; + })($nesting[0], null, $nesting); + (function(self, $parent_nesting) { + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_generate_name_91, TMP_next_auto_id_92, TMP_groups_93, TMP_create_94, TMP_register_95, TMP_unregister_all_96, TMP_unregister_97, TMP_resolve_class_99, TMP_class_for_name_100, TMP_class_for_name_101, TMP_class_for_name_103; + + + + Opal.def(self, '$generate_name', TMP_generate_name_91 = function $$generate_name() { + var self = this; + + return "" + "extgrp" + (self.$next_auto_id()) + }, TMP_generate_name_91.$$arity = 0); + + Opal.def(self, '$next_auto_id', TMP_next_auto_id_92 = function $$next_auto_id() { + var $a, self = this; + if (self.auto_id == null) self.auto_id = nil; + + + self.auto_id = ($truthy($a = self.auto_id) ? $a : -1); + return (self.auto_id = $rb_plus(self.auto_id, 1)); + }, TMP_next_auto_id_92.$$arity = 0); + + Opal.def(self, '$groups', TMP_groups_93 = function $$groups() { + var $a, self = this; + if (self.groups == null) self.groups = nil; + + return (self.groups = ($truthy($a = self.groups) ? $a : $hash2([], {}))) + }, TMP_groups_93.$$arity = 0); + + Opal.def(self, '$create', TMP_create_94 = function $$create(name) { + var $iter = TMP_create_94.$$p, block = $iter || nil, $a, self = this; + + if ($iter) TMP_create_94.$$p = null; + + + if ($iter) TMP_create_94.$$p = null;; + + if (name == null) { + name = nil; + }; + if ((block !== nil)) { + return $$($nesting, 'Registry').$new($hash(($truthy($a = name) ? $a : self.$generate_name()), block)) + } else { + return $$($nesting, 'Registry').$new() + }; + }, TMP_create_94.$$arity = -1); + Opal.alias(self, "build_registry", "create"); + + Opal.def(self, '$register', TMP_register_95 = function $$register($a) { + var $iter = TMP_register_95.$$p, block = $iter || nil, $post_args, args, $b, self = this, argc = nil, resolved_group = nil, group = nil, name = nil, $writer = nil; + + if ($iter) TMP_register_95.$$p = null; + + + if ($iter) TMP_register_95.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + argc = args.$size(); + if ((block !== nil)) { + resolved_group = block + } else if ($truthy((group = args.$pop()))) { + resolved_group = ($truthy($b = self.$resolve_class(group)) ? $b : group) + } else { + self.$raise($$$('::', 'ArgumentError'), "Extension group to register not specified") + }; + name = ($truthy($b = args.$pop()) ? $b : self.$generate_name()); + if ($truthy(args['$empty?']())) { + } else { + self.$raise($$$('::', 'ArgumentError'), "" + "Wrong number of arguments (" + (argc) + " for 1..2)") + }; + + $writer = [name.$to_sym(), resolved_group]; + $send(self.$groups(), '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];; + }, TMP_register_95.$$arity = -1); + + Opal.def(self, '$unregister_all', TMP_unregister_all_96 = function $$unregister_all() { + var self = this; + + + self.groups = $hash2([], {}); + return nil; + }, TMP_unregister_all_96.$$arity = 0); + + Opal.def(self, '$unregister', TMP_unregister_97 = function $$unregister($a) { + var $post_args, names, TMP_98, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + names = $post_args;; + $send(names, 'each', [], (TMP_98 = function(group){var self = TMP_98.$$s || this; + if (self.groups == null) self.groups = nil; + + + + if (group == null) { + group = nil; + }; + return self.groups.$delete(group.$to_sym());}, TMP_98.$$s = self, TMP_98.$$arity = 1, TMP_98)); + return nil; + }, TMP_unregister_97.$$arity = -1); + + Opal.def(self, '$resolve_class', TMP_resolve_class_99 = function $$resolve_class(object) { + var self = this, $case = nil; + + return (function() {$case = object; + if ($$$('::', 'Class')['$===']($case)) {return object} + else if ($$$('::', 'String')['$===']($case)) {return self.$class_for_name(object)} + else { return nil }})() + }, TMP_resolve_class_99.$$arity = 1); + if ($truthy($$$('::', 'RUBY_MIN_VERSION_2'))) { + return (Opal.def(self, '$class_for_name', TMP_class_for_name_100 = function $$class_for_name(qualified_name) { + var self = this, resolved = nil; + + try { + + resolved = $$$('::', 'Object').$const_get(qualified_name, false); + if ($truthy($$$('::', 'Class')['$==='](resolved))) { + } else { + self.$raise() + }; + return resolved; + } catch ($err) { + if (Opal.rescue($err, [$$($nesting, 'StandardError')])) { + try { + return self.$raise($$$('::', 'NameError'), "" + "Could not resolve class for name: " + (qualified_name)) + } finally { Opal.pop_exception() } + } else { throw $err; } + } + }, TMP_class_for_name_100.$$arity = 1), nil) && 'class_for_name' + } else if ($truthy($$$('::', 'RUBY_MIN_VERSION_1_9'))) { + return (Opal.def(self, '$class_for_name', TMP_class_for_name_101 = function $$class_for_name(qualified_name) { + var TMP_102, self = this, resolved = nil; + + try { + + resolved = $send(qualified_name.$split("::"), 'reduce', [$$$('::', 'Object')], (TMP_102 = function(current, name){var self = TMP_102.$$s || this; + + + + if (current == null) { + current = nil; + }; + + if (name == null) { + name = nil; + }; + if ($truthy(name['$empty?']())) { + return current + } else { + + return current.$const_get(name, false); + };}, TMP_102.$$s = self, TMP_102.$$arity = 2, TMP_102)); + if ($truthy($$$('::', 'Class')['$==='](resolved))) { + } else { + self.$raise() + }; + return resolved; + } catch ($err) { + if (Opal.rescue($err, [$$($nesting, 'StandardError')])) { + try { + return self.$raise($$$('::', 'NameError'), "" + "Could not resolve class for name: " + (qualified_name)) + } finally { Opal.pop_exception() } + } else { throw $err; } + } + }, TMP_class_for_name_101.$$arity = 1), nil) && 'class_for_name' + } else { + return (Opal.def(self, '$class_for_name', TMP_class_for_name_103 = function $$class_for_name(qualified_name) { + var TMP_104, self = this, resolved = nil; + + try { + + resolved = $send(qualified_name.$split("::"), 'reduce', [$$$('::', 'Object')], (TMP_104 = function(current, name){var self = TMP_104.$$s || this; + + + + if (current == null) { + current = nil; + }; + + if (name == null) { + name = nil; + }; + if ($truthy(name['$empty?']())) { + return current + } else { + + if ($truthy(current['$const_defined?'](name))) { + + return current.$const_get(name); + } else { + return self.$raise() + }; + };}, TMP_104.$$s = self, TMP_104.$$arity = 2, TMP_104)); + if ($truthy($$$('::', 'Class')['$==='](resolved))) { + } else { + self.$raise() + }; + return resolved; + } catch ($err) { + if (Opal.rescue($err, [$$($nesting, 'StandardError')])) { + try { + return self.$raise($$$('::', 'NameError'), "" + "Could not resolve class for name: " + (qualified_name)) + } finally { Opal.pop_exception() } + } else { throw $err; } + } + }, TMP_class_for_name_103.$$arity = 1), nil) && 'class_for_name' + }; + })(Opal.get_singleton_class(self), $nesting); + })($nesting[0], $nesting) + })($nesting[0], $nesting); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/js/opal_ext/browser/reader"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $truthy = Opal.truthy; + + Opal.add_stubs(['$posixify', '$new', '$base_dir', '$start_with?', '$uriish?', '$descends_from?', '$key?', '$attributes', '$replace_next_line', '$absolute_path?', '$==', '$empty?', '$!', '$slice', '$length']); + return (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + (function($base, $super, $parent_nesting) { + function $PreprocessorReader(){}; + var self = $PreprocessorReader = $klass($base, $super, 'PreprocessorReader', $PreprocessorReader); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_PreprocessorReader_resolve_include_path_1; + + def.path_resolver = def.document = def.include_stack = def.dir = nil; + return (Opal.def(self, '$resolve_include_path', TMP_PreprocessorReader_resolve_include_path_1 = function $$resolve_include_path(target, attrlist, attributes) { + var $a, self = this, p_target = nil, target_type = nil, base_dir = nil, inc_path = nil, relpath = nil, ctx_dir = nil, top_level = nil, offset = nil; + + + p_target = (self.path_resolver = ($truthy($a = self.path_resolver) ? $a : $$($nesting, 'PathResolver').$new("\\"))).$posixify(target); + $a = ["file", self.document.$base_dir()], (target_type = $a[0]), (base_dir = $a[1]), $a; + if ($truthy(p_target['$start_with?']("file://"))) { + inc_path = (relpath = p_target) + } else if ($truthy($$($nesting, 'Helpers')['$uriish?'](p_target))) { + + if ($truthy(($truthy($a = self.path_resolver['$descends_from?'](p_target, base_dir)) ? $a : self.document.$attributes()['$key?']("allow-uri-read")))) { + } else { + return self.$replace_next_line("" + "link:" + (target) + "[" + (attrlist) + "]") + }; + inc_path = (relpath = p_target); + } else if ($truthy(self.path_resolver['$absolute_path?'](p_target))) { + inc_path = (relpath = "" + "file://" + ((function() {if ($truthy(p_target['$start_with?']("/"))) { + return "" + } else { + return "/" + }; return nil; })()) + (p_target)) + } else if ((ctx_dir = (function() {if ($truthy((top_level = self.include_stack['$empty?']()))) { + return base_dir + } else { + return self.dir + }; return nil; })())['$=='](".")) { + inc_path = (relpath = p_target) + } else if ($truthy(($truthy($a = ctx_dir['$start_with?']("file://")) ? $a : $$($nesting, 'Helpers')['$uriish?'](ctx_dir)['$!']()))) { + + inc_path = "" + (ctx_dir) + "/" + (p_target); + if ($truthy(top_level)) { + relpath = p_target + } else if ($truthy(($truthy($a = base_dir['$=='](".")) ? $a : (offset = self.path_resolver['$descends_from?'](inc_path, base_dir))['$!']()))) { + relpath = inc_path + } else { + relpath = inc_path.$slice(offset, inc_path.$length()) + }; + } else if ($truthy(top_level)) { + inc_path = "" + (ctx_dir) + "/" + ((relpath = p_target)) + } else if ($truthy(($truthy($a = (offset = self.path_resolver['$descends_from?'](ctx_dir, base_dir))) ? $a : self.document.$attributes()['$key?']("allow-uri-read")))) { + + inc_path = "" + (ctx_dir) + "/" + (p_target); + relpath = (function() {if ($truthy(offset)) { + + return inc_path.$slice(offset, inc_path.$length()); + } else { + return p_target + }; return nil; })(); + } else { + return self.$replace_next_line("" + "link:" + (target) + "[" + (attrlist) + "]") + }; + return [inc_path, "file", relpath]; + }, TMP_PreprocessorReader_resolve_include_path_1.$$arity = 3), nil) && 'resolve_include_path' + })($nesting[0], $$($nesting, 'Reader'), $nesting) + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/js/postscript"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice; + + Opal.add_stubs(['$require', '$==']); + + self.$require("asciidoctor/converter/composite"); + self.$require("asciidoctor/converter/html5"); + self.$require("asciidoctor/extensions"); + if ($$($nesting, 'JAVASCRIPT_IO_MODULE')['$==']("xmlhttprequest")) { + return self.$require("asciidoctor/js/opal_ext/browser/reader") + } else { + return nil + }; +}; + +/* Generated by Opal 0.11.99.dev */ +(function(Opal) { + function $rb_ge(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs >= rhs : lhs['$>='](rhs); + } + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + function $rb_lt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); + } + var $a, self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $truthy = Opal.truthy, $gvars = Opal.gvars, $module = Opal.module, $hash2 = Opal.hash2, $send = Opal.send, $hash = Opal.hash; + if ($gvars[":"] == null) $gvars[":"] = nil; + + Opal.add_stubs(['$==', '$>=', '$require', '$unshift', '$dirname', '$each', '$constants', '$const_get', '$downcase', '$to_s', '$[]=', '$-', '$upcase', '$[]', '$values', '$new', '$attr_reader', '$instance_variable_set', '$send', '$<<', '$define', '$expand_path', '$join', '$home', '$pwd', '$!', '$!=', '$default_external', '$to_set', '$map', '$keys', '$slice', '$merge', '$default=', '$to_a', '$escape', '$drop', '$insert', '$dup', '$start', '$logger', '$logger=', '$===', '$split', '$gsub', '$respond_to?', '$raise', '$ancestors', '$class', '$path', '$utc', '$at', '$Integer', '$mtime', '$readlines', '$basename', '$extname', '$index', '$strftime', '$year', '$utc_offset', '$rewind', '$lines', '$each_line', '$record', '$parse', '$exception', '$message', '$set_backtrace', '$backtrace', '$stack_trace', '$stack_trace=', '$open', '$load', '$delete', '$key?', '$attributes', '$outfilesuffix', '$safe', '$normalize_system_path', '$mkdir_p', '$directory?', '$convert', '$write', '$<', '$attr?', '$attr', '$uriish?', '$include?', '$write_primary_stylesheet', '$instance', '$empty?', '$read_asset', '$file?', '$write_coderay_stylesheet', '$write_pygments_stylesheet']); + + if ($truthy((($a = $$($nesting, 'RUBY_ENGINE', 'skip_raise')) ? 'constant' : nil))) { + } else { + Opal.const_set($nesting[0], 'RUBY_ENGINE', "unknown") + }; + Opal.const_set($nesting[0], 'RUBY_ENGINE_OPAL', $$($nesting, 'RUBY_ENGINE')['$==']("opal")); + Opal.const_set($nesting[0], 'RUBY_ENGINE_JRUBY', $$($nesting, 'RUBY_ENGINE')['$==']("jruby")); + Opal.const_set($nesting[0], 'RUBY_MIN_VERSION_1_9', $rb_ge($$($nesting, 'RUBY_VERSION'), "1.9")); + Opal.const_set($nesting[0], 'RUBY_MIN_VERSION_2', $rb_ge($$($nesting, 'RUBY_VERSION'), "2")); + self.$require("set"); + if ($$($nesting, 'RUBY_ENGINE')['$==']("opal")) { + self.$require("asciidoctor/js") + } else { + nil + }; + $gvars[":"].$unshift($$($nesting, 'File').$dirname("asciidoctor.rb")); + self.$require("asciidoctor/logging"); + (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), $a, TMP_Asciidoctor_6, TMP_Asciidoctor_7, TMP_Asciidoctor_8, $writer = nil, quote_subs = nil, compat_quote_subs = nil; + + + Opal.const_set($nesting[0], 'RUBY_ENGINE', $$$('::', 'RUBY_ENGINE')); + (function($base, $parent_nesting) { + function $SafeMode() {}; + var self = $SafeMode = $module($base, 'SafeMode', $SafeMode); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_SafeMode_1, TMP_SafeMode_value_for_name_2, TMP_SafeMode_name_for_value_3, TMP_SafeMode_names_4, rec = nil; + + + Opal.const_set($nesting[0], 'UNSAFE', 0); + Opal.const_set($nesting[0], 'SAFE', 1); + Opal.const_set($nesting[0], 'SERVER', 10); + Opal.const_set($nesting[0], 'SECURE', 20); + rec = $hash2([], {}); + $send((Opal.Module.$$nesting = $nesting, self.$constants()), 'each', [], (TMP_SafeMode_1 = function(sym){var self = TMP_SafeMode_1.$$s || this, $writer = nil; + + + + if (sym == null) { + sym = nil; + }; + $writer = [self.$const_get(sym), sym.$to_s().$downcase()]; + $send(rec, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];}, TMP_SafeMode_1.$$s = self, TMP_SafeMode_1.$$arity = 1, TMP_SafeMode_1)); + self.names_by_value = rec; + Opal.defs(self, '$value_for_name', TMP_SafeMode_value_for_name_2 = function $$value_for_name(name) { + var self = this; + + return self.$const_get(name.$upcase()) + }, TMP_SafeMode_value_for_name_2.$$arity = 1); + Opal.defs(self, '$name_for_value', TMP_SafeMode_name_for_value_3 = function $$name_for_value(value) { + var self = this; + if (self.names_by_value == null) self.names_by_value = nil; + + return self.names_by_value['$[]'](value) + }, TMP_SafeMode_name_for_value_3.$$arity = 1); + Opal.defs(self, '$names', TMP_SafeMode_names_4 = function $$names() { + var self = this; + if (self.names_by_value == null) self.names_by_value = nil; + + return self.names_by_value.$values() + }, TMP_SafeMode_names_4.$$arity = 0); + })($nesting[0], $nesting); + (function($base, $parent_nesting) { + function $Compliance() {}; + var self = $Compliance = $module($base, 'Compliance', $Compliance); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Compliance_define_5; + + + self.keys = $$$('::', 'Set').$new(); + (function(self, $parent_nesting) { + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return self.$attr_reader("keys") + })(Opal.get_singleton_class(self), $nesting); + Opal.defs(self, '$define', TMP_Compliance_define_5 = function $$define(key, value) { + var self = this; + if (self.keys == null) self.keys = nil; + + + self.$instance_variable_set("" + "@" + (key), value); + (function(self, $parent_nesting) { + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return self + })(Opal.get_singleton_class(self), $nesting).$send("attr_accessor", key); + self.keys['$<<'](key); + return nil; + }, TMP_Compliance_define_5.$$arity = 2); + self.$define("block_terminates_paragraph", true); + self.$define("strict_verbatim_paragraphs", true); + self.$define("underline_style_section_titles", true); + self.$define("unwrap_standalone_preamble", true); + self.$define("attribute_missing", "skip"); + self.$define("attribute_undefined", "drop-line"); + self.$define("shorthand_property_syntax", true); + self.$define("natural_xrefs", true); + self.$define("unique_id_start_index", 2); + self.$define("markdown_syntax", true); + })($nesting[0], $nesting); + Opal.const_set($nesting[0], 'ROOT_PATH', $$$('::', 'File').$dirname($$$('::', 'File').$dirname($$$('::', 'File').$expand_path("asciidoctor.rb")))); + Opal.const_set($nesting[0], 'DATA_PATH', $$$('::', 'File').$join($$($nesting, 'ROOT_PATH'), "data")); + + try { + Opal.const_set($nesting[0], 'USER_HOME', $$$('::', 'Dir').$home()) + } catch ($err) { + if (Opal.rescue($err, [$$($nesting, 'StandardError')])) { + try { + Opal.const_set($nesting[0], 'USER_HOME', ($truthy($a = $$$('::', 'ENV')['$[]']("HOME")) ? $a : $$$('::', 'Dir').$pwd())) + } finally { Opal.pop_exception() } + } else { throw $err; } + };; + Opal.const_set($nesting[0], 'COERCE_ENCODING', ($truthy($a = $$$('::', 'RUBY_ENGINE_OPAL')['$!']()) ? $$$('::', 'RUBY_MIN_VERSION_1_9') : $a)); + Opal.const_set($nesting[0], 'FORCE_ENCODING', ($truthy($a = $$($nesting, 'COERCE_ENCODING')) ? $$$('::', 'Encoding').$default_external()['$!=']($$$($$$('::', 'Encoding'), 'UTF_8')) : $a)); + Opal.const_set($nesting[0], 'BOM_BYTES_UTF_8', [239, 187, 191]); + Opal.const_set($nesting[0], 'BOM_BYTES_UTF_16LE', [255, 254]); + Opal.const_set($nesting[0], 'BOM_BYTES_UTF_16BE', [254, 255]); + Opal.const_set($nesting[0], 'FORCE_UNICODE_LINE_LENGTH', $$$('::', 'RUBY_MIN_VERSION_1_9')['$!']()); + Opal.const_set($nesting[0], 'LF', Opal.const_set($nesting[0], 'EOL', "\n")); + Opal.const_set($nesting[0], 'NULL', "\u0000"); + Opal.const_set($nesting[0], 'TAB', "\t"); + Opal.const_set($nesting[0], 'MAX_INT', 9007199254740991); + Opal.const_set($nesting[0], 'DEFAULT_DOCTYPE', "article"); + Opal.const_set($nesting[0], 'DEFAULT_BACKEND', "html5"); + Opal.const_set($nesting[0], 'DEFAULT_STYLESHEET_KEYS', ["", "DEFAULT"].$to_set()); + Opal.const_set($nesting[0], 'DEFAULT_STYLESHEET_NAME', "asciidoctor.css"); + Opal.const_set($nesting[0], 'BACKEND_ALIASES', $hash2(["html", "docbook"], {"html": "html5", "docbook": "docbook5"})); + Opal.const_set($nesting[0], 'DEFAULT_PAGE_WIDTHS', $hash2(["docbook"], {"docbook": 425})); + Opal.const_set($nesting[0], 'DEFAULT_EXTENSIONS', $hash2(["html", "docbook", "pdf", "epub", "manpage", "asciidoc"], {"html": ".html", "docbook": ".xml", "pdf": ".pdf", "epub": ".epub", "manpage": ".man", "asciidoc": ".adoc"})); + Opal.const_set($nesting[0], 'ASCIIDOC_EXTENSIONS', $hash2([".adoc", ".asciidoc", ".asc", ".ad", ".txt"], {".adoc": true, ".asciidoc": true, ".asc": true, ".ad": true, ".txt": true})); + Opal.const_set($nesting[0], 'SETEXT_SECTION_LEVELS', $hash2(["=", "-", "~", "^", "+"], {"=": 0, "-": 1, "~": 2, "^": 3, "+": 4})); + Opal.const_set($nesting[0], 'ADMONITION_STYLES', ["NOTE", "TIP", "IMPORTANT", "WARNING", "CAUTION"].$to_set()); + Opal.const_set($nesting[0], 'ADMONITION_STYLE_HEADS', ["N", "T", "I", "W", "C"].$to_set()); + Opal.const_set($nesting[0], 'PARAGRAPH_STYLES', ["comment", "example", "literal", "listing", "normal", "open", "pass", "quote", "sidebar", "source", "verse", "abstract", "partintro"].$to_set()); + Opal.const_set($nesting[0], 'VERBATIM_STYLES', ["literal", "listing", "source", "verse"].$to_set()); + Opal.const_set($nesting[0], 'DELIMITED_BLOCKS', $hash2(["--", "----", "....", "====", "****", "____", "\"\"", "++++", "|===", ",===", ":===", "!===", "////", "```"], {"--": ["open", ["comment", "example", "literal", "listing", "pass", "quote", "sidebar", "source", "verse", "admonition", "abstract", "partintro"].$to_set()], "----": ["listing", ["literal", "source"].$to_set()], "....": ["literal", ["listing", "source"].$to_set()], "====": ["example", ["admonition"].$to_set()], "****": ["sidebar", $$$('::', 'Set').$new()], "____": ["quote", ["verse"].$to_set()], "\"\"": ["quote", ["verse"].$to_set()], "++++": ["pass", ["stem", "latexmath", "asciimath"].$to_set()], "|===": ["table", $$$('::', 'Set').$new()], ",===": ["table", $$$('::', 'Set').$new()], ":===": ["table", $$$('::', 'Set').$new()], "!===": ["table", $$$('::', 'Set').$new()], "////": ["comment", $$$('::', 'Set').$new()], "```": ["fenced_code", $$$('::', 'Set').$new()]})); + Opal.const_set($nesting[0], 'DELIMITED_BLOCK_HEADS', $send($$($nesting, 'DELIMITED_BLOCKS').$keys(), 'map', [], (TMP_Asciidoctor_6 = function(key){var self = TMP_Asciidoctor_6.$$s || this; + + + + if (key == null) { + key = nil; + }; + return key.$slice(0, 2);}, TMP_Asciidoctor_6.$$s = self, TMP_Asciidoctor_6.$$arity = 1, TMP_Asciidoctor_6)).$to_set()); + Opal.const_set($nesting[0], 'LAYOUT_BREAK_CHARS', $hash2(["'", "<"], {"'": "thematic_break", "<": "page_break"})); + Opal.const_set($nesting[0], 'MARKDOWN_THEMATIC_BREAK_CHARS', $hash2(["-", "*", "_"], {"-": "thematic_break", "*": "thematic_break", "_": "thematic_break"})); + Opal.const_set($nesting[0], 'HYBRID_LAYOUT_BREAK_CHARS', $$($nesting, 'LAYOUT_BREAK_CHARS').$merge($$($nesting, 'MARKDOWN_THEMATIC_BREAK_CHARS'))); + Opal.const_set($nesting[0], 'NESTABLE_LIST_CONTEXTS', ["ulist", "olist", "dlist"]); + Opal.const_set($nesting[0], 'ORDERED_LIST_STYLES', ["arabic", "loweralpha", "lowerroman", "upperalpha", "upperroman"]); + Opal.const_set($nesting[0], 'ORDERED_LIST_KEYWORDS', $hash2(["loweralpha", "lowerroman", "upperalpha", "upperroman"], {"loweralpha": "a", "lowerroman": "i", "upperalpha": "A", "upperroman": "I"})); + Opal.const_set($nesting[0], 'ATTR_REF_HEAD', "{"); + Opal.const_set($nesting[0], 'LIST_CONTINUATION', "+"); + Opal.const_set($nesting[0], 'HARD_LINE_BREAK', " +"); + Opal.const_set($nesting[0], 'LINE_CONTINUATION', " \\"); + Opal.const_set($nesting[0], 'LINE_CONTINUATION_LEGACY', " +"); + Opal.const_set($nesting[0], 'MATHJAX_VERSION', "2.7.4"); + Opal.const_set($nesting[0], 'BLOCK_MATH_DELIMITERS', $hash2(["asciimath", "latexmath"], {"asciimath": ["\\$", "\\$"], "latexmath": ["\\[", "\\]"]})); + Opal.const_set($nesting[0], 'INLINE_MATH_DELIMITERS', $hash2(["asciimath", "latexmath"], {"asciimath": ["\\$", "\\$"], "latexmath": ["\\(", "\\)"]})); + + $writer = ["asciimath"]; + $send(Opal.const_set($nesting[0], 'STEM_TYPE_ALIASES', $hash2(["latexmath", "latex", "tex"], {"latexmath": "latexmath", "latex": "latexmath", "tex": "latexmath"})), 'default=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + Opal.const_set($nesting[0], 'FONT_AWESOME_VERSION', "4.7.0"); + Opal.const_set($nesting[0], 'FLEXIBLE_ATTRIBUTES', ["sectnums"]); + if ($$($nesting, 'RUBY_ENGINE')['$==']("opal")) { + if ($truthy((($a = $$($nesting, 'CC_ANY', 'skip_raise')) ? 'constant' : nil))) { + } else { + Opal.const_set($nesting[0], 'CC_ANY', "[^\\n]") + } + } else { + nil + }; + Opal.const_set($nesting[0], 'AuthorInfoLineRx', new RegExp("" + "^(" + ($$($nesting, 'CG_WORD')) + "[" + ($$($nesting, 'CC_WORD')) + "\\-'.]*)(?: +(" + ($$($nesting, 'CG_WORD')) + "[" + ($$($nesting, 'CC_WORD')) + "\\-'.]*))?(?: +(" + ($$($nesting, 'CG_WORD')) + "[" + ($$($nesting, 'CC_WORD')) + "\\-'.]*))?(?: +<([^>]+)>)?$")); + Opal.const_set($nesting[0], 'RevisionInfoLineRx', new RegExp("" + "^(?:[^\\d{]*(" + ($$($nesting, 'CC_ANY')) + "*?),)? *(?!:)(" + ($$($nesting, 'CC_ANY')) + "*?)(?: *(?!^),?: *(" + ($$($nesting, 'CC_ANY')) + "*))?$")); + Opal.const_set($nesting[0], 'ManpageTitleVolnumRx', new RegExp("" + "^(" + ($$($nesting, 'CC_ANY')) + "+?) *\\( *(" + ($$($nesting, 'CC_ANY')) + "+?) *\\)$")); + Opal.const_set($nesting[0], 'ManpageNamePurposeRx', new RegExp("" + "^(" + ($$($nesting, 'CC_ANY')) + "+?) +- +(" + ($$($nesting, 'CC_ANY')) + "+)$")); + Opal.const_set($nesting[0], 'ConditionalDirectiveRx', new RegExp("" + "^(\\\\)?(ifdef|ifndef|ifeval|endif)::(\\S*?(?:([,+])\\S*?)?)\\[(" + ($$($nesting, 'CC_ANY')) + "+)?\\]$")); + Opal.const_set($nesting[0], 'EvalExpressionRx', new RegExp("" + "^(" + ($$($nesting, 'CC_ANY')) + "+?) *([=!><]=|[><]) *(" + ($$($nesting, 'CC_ANY')) + "+)$")); + Opal.const_set($nesting[0], 'IncludeDirectiveRx', new RegExp("" + "^(\\\\)?include::([^\\[][^\\[]*)\\[(" + ($$($nesting, 'CC_ANY')) + "+)?\\]$")); + Opal.const_set($nesting[0], 'TagDirectiveRx', /\b(?:tag|(e)nd)::(\S+?)\[\](?=$|[ \r])/m); + Opal.const_set($nesting[0], 'AttributeEntryRx', new RegExp("" + "^:(!?" + ($$($nesting, 'CG_WORD')) + "[^:]*):(?:[ \\t]+(" + ($$($nesting, 'CC_ANY')) + "*))?$")); + Opal.const_set($nesting[0], 'InvalidAttributeNameCharsRx', new RegExp("" + "[^-" + ($$($nesting, 'CC_WORD')) + "]")); + if ($$($nesting, 'RUBY_ENGINE')['$==']("opal")) { + Opal.const_set($nesting[0], 'AttributeEntryPassMacroRx', /^pass:([a-z]+(?:,[a-z]+)*)?\[([\S\s]*)\]$/) + } else { + nil + }; + Opal.const_set($nesting[0], 'AttributeReferenceRx', new RegExp("" + "(\\\\)?\\{(" + ($$($nesting, 'CG_WORD')) + "[-" + ($$($nesting, 'CC_WORD')) + "]*|(set|counter2?):" + ($$($nesting, 'CC_ANY')) + "+?)(\\\\)?\\}")); + Opal.const_set($nesting[0], 'BlockAnchorRx', new RegExp("" + "^\\[\\[(?:|([" + ($$($nesting, 'CC_ALPHA')) + "_:][" + ($$($nesting, 'CC_WORD')) + ":.-]*)(?:, *(" + ($$($nesting, 'CC_ANY')) + "+))?)\\]\\]$")); + Opal.const_set($nesting[0], 'BlockAttributeListRx', new RegExp("" + "^\\[(|[" + ($$($nesting, 'CC_WORD')) + ".#%{,\"']" + ($$($nesting, 'CC_ANY')) + "*)\\]$")); + Opal.const_set($nesting[0], 'BlockAttributeLineRx', new RegExp("" + "^\\[(?:|[" + ($$($nesting, 'CC_WORD')) + ".#%{,\"']" + ($$($nesting, 'CC_ANY')) + "*|\\[(?:|[" + ($$($nesting, 'CC_ALPHA')) + "_:][" + ($$($nesting, 'CC_WORD')) + ":.-]*(?:, *" + ($$($nesting, 'CC_ANY')) + "+)?)\\])\\]$")); + Opal.const_set($nesting[0], 'BlockTitleRx', new RegExp("" + "^\\.(\\.?[^ \\t.]" + ($$($nesting, 'CC_ANY')) + "*)$")); + Opal.const_set($nesting[0], 'AdmonitionParagraphRx', new RegExp("" + "^(" + ($$($nesting, 'ADMONITION_STYLES').$to_a().$join("|")) + "):[ \\t]+")); + Opal.const_set($nesting[0], 'LiteralParagraphRx', new RegExp("" + "^([ \\t]+" + ($$($nesting, 'CC_ANY')) + "*)$")); + Opal.const_set($nesting[0], 'AtxSectionTitleRx', new RegExp("" + "^(=={0,5})[ \\t]+(" + ($$($nesting, 'CC_ANY')) + "+?)(?:[ \\t]+\\1)?$")); + Opal.const_set($nesting[0], 'ExtAtxSectionTitleRx', new RegExp("" + "^(=={0,5}|#\\\#{0,5})[ \\t]+(" + ($$($nesting, 'CC_ANY')) + "+?)(?:[ \\t]+\\1)?$")); + Opal.const_set($nesting[0], 'SetextSectionTitleRx', new RegExp("" + "^((?!\\.)" + ($$($nesting, 'CC_ANY')) + "*?" + ($$($nesting, 'CG_WORD')) + ($$($nesting, 'CC_ANY')) + "*)$")); + Opal.const_set($nesting[0], 'InlineSectionAnchorRx', new RegExp("" + " (\\\\)?\\[\\[([" + ($$($nesting, 'CC_ALPHA')) + "_:][" + ($$($nesting, 'CC_WORD')) + ":.-]*)(?:, *(" + ($$($nesting, 'CC_ANY')) + "+))?\\]\\]$")); + Opal.const_set($nesting[0], 'InvalidSectionIdCharsRx', new RegExp("" + "<[^>]+>|&(?:[a-z][a-z]+\\d{0,2}|#\\d\\d\\d{0,4}|#x[\\da-f][\\da-f][\\da-f]{0,3});|[^ " + ($$($nesting, 'CC_WORD')) + "\\-.]+?")); + Opal.const_set($nesting[0], 'AnyListRx', new RegExp("" + "^(?:[ \\t]*(?:-|\\*\\**|\\.\\.*|\\u2022|\\d+\\.|[a-zA-Z]\\.|[IVXivx]+\\))[ \\t]|(?!//[^/])" + ($$($nesting, 'CC_ANY')) + "*?(?::::{0,2}|;;)(?:$|[ \\t])|[ \\t])")); + Opal.const_set($nesting[0], 'UnorderedListRx', new RegExp("" + "^[ \\t]*(-|\\*\\**|\\u2022)[ \\t]+(" + ($$($nesting, 'CC_ANY')) + "*)$")); + Opal.const_set($nesting[0], 'OrderedListRx', new RegExp("" + "^[ \\t]*(\\.\\.*|\\d+\\.|[a-zA-Z]\\.|[IVXivx]+\\))[ \\t]+(" + ($$($nesting, 'CC_ANY')) + "*)$")); + Opal.const_set($nesting[0], 'OrderedListMarkerRxMap', $hash2(["arabic", "loweralpha", "lowerroman", "upperalpha", "upperroman"], {"arabic": /\d+\./, "loweralpha": /[a-z]\./, "lowerroman": /[ivx]+\)/, "upperalpha": /[A-Z]\./, "upperroman": /[IVX]+\)/})); + Opal.const_set($nesting[0], 'DescriptionListRx', new RegExp("" + "^(?!//[^/])[ \\t]*(" + ($$($nesting, 'CC_ANY')) + "*?)(:::{0,2}|;;)(?:$|[ \\t]+(" + ($$($nesting, 'CC_ANY')) + "*)$)")); + Opal.const_set($nesting[0], 'DescriptionListSiblingRx', $hash2(["::", ":::", "::::", ";;"], {"::": new RegExp("" + "^(?!//[^/])[ \\t]*(" + ($$($nesting, 'CC_ANY')) + "*[^:]|)(::)(?:$|[ \\t]+(" + ($$($nesting, 'CC_ANY')) + "*)$)"), ":::": new RegExp("" + "^(?!//[^/])[ \\t]*(" + ($$($nesting, 'CC_ANY')) + "*[^:]|)(:::)(?:$|[ \\t]+(" + ($$($nesting, 'CC_ANY')) + "*)$)"), "::::": new RegExp("" + "^(?!//[^/])[ \\t]*(" + ($$($nesting, 'CC_ANY')) + "*[^:]|)(::::)(?:$|[ \\t]+(" + ($$($nesting, 'CC_ANY')) + "*)$)"), ";;": new RegExp("" + "^(?!//[^/])[ \\t]*(" + ($$($nesting, 'CC_ANY')) + "*?)(;;)(?:$|[ \\t]+(" + ($$($nesting, 'CC_ANY')) + "*)$)")})); + Opal.const_set($nesting[0], 'CalloutListRx', new RegExp("" + "^<(\\d+|\\.)>[ \\t]+(" + ($$($nesting, 'CC_ANY')) + "*)$")); + Opal.const_set($nesting[0], 'CalloutExtractRx', /((?:\/\/|#|--|;;) ?)?(\\)?(?=(?: ?\\?)*$)/); + Opal.const_set($nesting[0], 'CalloutExtractRxt', "(\\\\)?<()(\\d+|\\.)>(?=(?: ?\\\\?<(?:\\d+|\\.)>)*$)"); + Opal.const_set($nesting[0], 'CalloutExtractRxMap', $send($$$('::', 'Hash'), 'new', [], (TMP_Asciidoctor_7 = function(h, k){var self = TMP_Asciidoctor_7.$$s || this; + + + + if (h == null) { + h = nil; + }; + + if (k == null) { + k = nil; + }; + $writer = [k, new RegExp("" + "(" + ($$$('::', 'Regexp').$escape(k)) + " ?)?" + ($$($nesting, 'CalloutExtractRxt')))]; + $send(h, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];}, TMP_Asciidoctor_7.$$s = self, TMP_Asciidoctor_7.$$arity = 2, TMP_Asciidoctor_7))); + Opal.const_set($nesting[0], 'CalloutScanRx', new RegExp("" + "\\\\?(?=(?: ?\\\\?)*" + ($$($nesting, 'CC_EOL')) + ")")); + Opal.const_set($nesting[0], 'CalloutSourceRx', new RegExp("" + "((?://|#|--|;;) ?)?(\\\\)?<!?(|--)(\\d+|\\.)\\3>(?=(?: ?\\\\?<!?\\3(?:\\d+|\\.)\\3>)*" + ($$($nesting, 'CC_EOL')) + ")")); + Opal.const_set($nesting[0], 'CalloutSourceRxt', "" + "(\\\\)?<()(\\d+|\\.)>(?=(?: ?\\\\?<(?:\\d+|\\.)>)*" + ($$($nesting, 'CC_EOL')) + ")"); + Opal.const_set($nesting[0], 'CalloutSourceRxMap', $send($$$('::', 'Hash'), 'new', [], (TMP_Asciidoctor_8 = function(h, k){var self = TMP_Asciidoctor_8.$$s || this; + + + + if (h == null) { + h = nil; + }; + + if (k == null) { + k = nil; + }; + $writer = [k, new RegExp("" + "(" + ($$$('::', 'Regexp').$escape(k)) + " ?)?" + ($$($nesting, 'CalloutSourceRxt')))]; + $send(h, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];}, TMP_Asciidoctor_8.$$s = self, TMP_Asciidoctor_8.$$arity = 2, TMP_Asciidoctor_8))); + Opal.const_set($nesting[0], 'ListRxMap', $hash2(["ulist", "olist", "dlist", "colist"], {"ulist": $$($nesting, 'UnorderedListRx'), "olist": $$($nesting, 'OrderedListRx'), "dlist": $$($nesting, 'DescriptionListRx'), "colist": $$($nesting, 'CalloutListRx')})); + Opal.const_set($nesting[0], 'ColumnSpecRx', /^(?:(\d+)\*)?([<^>](?:\.[<^>]?)?|(?:[<^>]?\.)?[<^>])?(\d+%?|~)?([a-z])?$/); + Opal.const_set($nesting[0], 'CellSpecStartRx', /^[ \t]*(?:(\d+(?:\.\d*)?|(?:\d*\.)?\d+)([*+]))?([<^>](?:\.[<^>]?)?|(?:[<^>]?\.)?[<^>])?([a-z])?$/); + Opal.const_set($nesting[0], 'CellSpecEndRx', /[ \t]+(?:(\d+(?:\.\d*)?|(?:\d*\.)?\d+)([*+]))?([<^>](?:\.[<^>]?)?|(?:[<^>]?\.)?[<^>])?([a-z])?$/); + Opal.const_set($nesting[0], 'CustomBlockMacroRx', new RegExp("" + "^(" + ($$($nesting, 'CG_WORD')) + "[-" + ($$($nesting, 'CC_WORD')) + "]*)::(|\\S|\\S" + ($$($nesting, 'CC_ANY')) + "*?\\S)\\[(" + ($$($nesting, 'CC_ANY')) + "+)?\\]$")); + Opal.const_set($nesting[0], 'BlockMediaMacroRx', new RegExp("" + "^(image|video|audio)::(\\S|\\S" + ($$($nesting, 'CC_ANY')) + "*?\\S)\\[(" + ($$($nesting, 'CC_ANY')) + "+)?\\]$")); + Opal.const_set($nesting[0], 'BlockTocMacroRx', new RegExp("" + "^toc::\\[(" + ($$($nesting, 'CC_ANY')) + "+)?\\]$")); + Opal.const_set($nesting[0], 'InlineAnchorRx', new RegExp("" + "(\\\\)?(?:\\[\\[([" + ($$($nesting, 'CC_ALPHA')) + "_:][" + ($$($nesting, 'CC_WORD')) + ":.-]*)(?:, *(" + ($$($nesting, 'CC_ANY')) + "+?))?\\]\\]|anchor:([" + ($$($nesting, 'CC_ALPHA')) + "_:][" + ($$($nesting, 'CC_WORD')) + ":.-]*)\\[(?:\\]|(" + ($$($nesting, 'CC_ANY')) + "*?[^\\\\])\\]))")); + Opal.const_set($nesting[0], 'InlineAnchorScanRx', new RegExp("" + "(?:^|[^\\\\\\[])\\[\\[([" + ($$($nesting, 'CC_ALPHA')) + "_:][" + ($$($nesting, 'CC_WORD')) + ":.-]*)(?:, *(" + ($$($nesting, 'CC_ANY')) + "+?))?\\]\\]|(?:^|[^\\\\])anchor:([" + ($$($nesting, 'CC_ALPHA')) + "_:][" + ($$($nesting, 'CC_WORD')) + ":.-]*)\\[(?:\\]|(" + ($$($nesting, 'CC_ANY')) + "*?[^\\\\])\\])")); + Opal.const_set($nesting[0], 'LeadingInlineAnchorRx', new RegExp("" + "^\\[\\[([" + ($$($nesting, 'CC_ALPHA')) + "_:][" + ($$($nesting, 'CC_WORD')) + ":.-]*)(?:, *(" + ($$($nesting, 'CC_ANY')) + "+?))?\\]\\]")); + Opal.const_set($nesting[0], 'InlineBiblioAnchorRx', new RegExp("" + "^\\[\\[\\[([" + ($$($nesting, 'CC_ALPHA')) + "_:][" + ($$($nesting, 'CC_WORD')) + ":.-]*)(?:, *(" + ($$($nesting, 'CC_ANY')) + "+?))?\\]\\]\\]")); + Opal.const_set($nesting[0], 'InlineEmailRx', new RegExp("" + "([\\\\>:/])?" + ($$($nesting, 'CG_WORD')) + "[" + ($$($nesting, 'CC_WORD')) + ".%+-]*@" + ($$($nesting, 'CG_ALNUM')) + "[" + ($$($nesting, 'CC_ALNUM')) + ".-]*\\." + ($$($nesting, 'CG_ALPHA')) + "{2,4}\\b")); + Opal.const_set($nesting[0], 'InlineFootnoteMacroRx', new RegExp("" + "\\\\?footnote(?:(ref):|:([\\w-]+)?)\\[(?:|(" + ($$($nesting, 'CC_ALL')) + "*?[^\\\\]))\\]", 'm')); + Opal.const_set($nesting[0], 'InlineImageMacroRx', new RegExp("" + "\\\\?i(?:mage|con):([^:\\s\\[](?:[^\\n\\[]*[^\\s\\[])?)\\[(|" + ($$($nesting, 'CC_ALL')) + "*?[^\\\\])\\]", 'm')); + Opal.const_set($nesting[0], 'InlineIndextermMacroRx', new RegExp("" + "\\\\?(?:(indexterm2?):\\[(" + ($$($nesting, 'CC_ALL')) + "*?[^\\\\])\\]|\\(\\((" + ($$($nesting, 'CC_ALL')) + "+?)\\)\\)(?!\\)))", 'm')); + Opal.const_set($nesting[0], 'InlineKbdBtnMacroRx', new RegExp("" + "(\\\\)?(kbd|btn):\\[(" + ($$($nesting, 'CC_ALL')) + "*?[^\\\\])\\]", 'm')); + Opal.const_set($nesting[0], 'InlineLinkRx', new RegExp("" + "(^|link:|" + ($$($nesting, 'CG_BLANK')) + "|<|[>\\(\\)\\[\\];])(\\\\?(?:https?|file|ftp|irc)://[^\\s\\[\\]<]*[^\\s.,\\[\\]<])(?:\\[(|" + ($$($nesting, 'CC_ALL')) + "*?[^\\\\])\\])?", 'm')); + Opal.const_set($nesting[0], 'InlineLinkMacroRx', new RegExp("" + "\\\\?(?:link|(mailto)):(|[^:\\s\\[][^\\s\\[]*)\\[(|" + ($$($nesting, 'CC_ALL')) + "*?[^\\\\])\\]", 'm')); + Opal.const_set($nesting[0], 'MacroNameRx', new RegExp("" + "^" + ($$($nesting, 'CG_WORD')) + "[-" + ($$($nesting, 'CC_WORD')) + "]*$")); + Opal.const_set($nesting[0], 'InlineStemMacroRx', new RegExp("" + "\\\\?(stem|(?:latex|ascii)math):([a-z]+(?:,[a-z]+)*)?\\[(" + ($$($nesting, 'CC_ALL')) + "*?[^\\\\])\\]", 'm')); + Opal.const_set($nesting[0], 'InlineMenuMacroRx', new RegExp("" + "\\\\?menu:(" + ($$($nesting, 'CG_WORD')) + "|[" + ($$($nesting, 'CC_WORD')) + "&][^\\n\\[]*[^\\s\\[])\\[ *(" + ($$($nesting, 'CC_ALL')) + "*?[^\\\\])?\\]", 'm')); + Opal.const_set($nesting[0], 'InlineMenuRx', new RegExp("" + "\\\\?\"([" + ($$($nesting, 'CC_WORD')) + "&][^\"]*?[ \\n]+>[ \\n]+[^\"]*)\"")); + Opal.const_set($nesting[0], 'InlinePassRx', $hash(false, ["+", "`", new RegExp("" + "(^|[^" + ($$($nesting, 'CC_WORD')) + ";:])(?:\\[([^\\]]+)\\])?(\\\\?(\\+|`)(\\S|\\S" + ($$($nesting, 'CC_ALL')) + "*?\\S)\\4)(?!" + ($$($nesting, 'CG_WORD')) + ")", 'm')], true, ["`", nil, new RegExp("" + "(^|[^`" + ($$($nesting, 'CC_WORD')) + "])(?:\\[([^\\]]+)\\])?(\\\\?(`)([^`\\s]|[^`\\s]" + ($$($nesting, 'CC_ALL')) + "*?\\S)\\4)(?![`" + ($$($nesting, 'CC_WORD')) + "])", 'm')])); + Opal.const_set($nesting[0], 'SinglePlusInlinePassRx', new RegExp("" + "^(\\\\)?\\+(\\S|\\S" + ($$($nesting, 'CC_ALL')) + "*?\\S)\\+$", 'm')); + Opal.const_set($nesting[0], 'InlinePassMacroRx', new RegExp("" + "(?:(?:(\\\\?)\\[([^\\]]+)\\])?(\\\\{0,2})(\\+\\+\\+?|\\$\\$)(" + ($$($nesting, 'CC_ALL')) + "*?)\\4|(\\\\?)pass:([a-z]+(?:,[a-z]+)*)?\\[(|" + ($$($nesting, 'CC_ALL')) + "*?[^\\\\])\\])", 'm')); + Opal.const_set($nesting[0], 'InlineXrefMacroRx', new RegExp("" + "\\\\?(?:<<([" + ($$($nesting, 'CC_WORD')) + "#/.:{]" + ($$($nesting, 'CC_ALL')) + "*?)>>|xref:([" + ($$($nesting, 'CC_WORD')) + "#/.:{]" + ($$($nesting, 'CC_ALL')) + "*?)\\[(?:\\]|(" + ($$($nesting, 'CC_ALL')) + "*?[^\\\\])\\]))", 'm')); + if ($$($nesting, 'RUBY_ENGINE')['$==']("opal")) { + Opal.const_set($nesting[0], 'HardLineBreakRx', new RegExp("" + "^(" + ($$($nesting, 'CC_ANY')) + "*) \\+$", 'm')) + } else { + nil + }; + Opal.const_set($nesting[0], 'MarkdownThematicBreakRx', /^ {0,3}([-*_])( *)\1\2\1$/); + Opal.const_set($nesting[0], 'ExtLayoutBreakRx', /^(?:'{3,}|<{3,}|([-*_])( *)\1\2\1)$/); + Opal.const_set($nesting[0], 'BlankLineRx', /\n{2,}/); + Opal.const_set($nesting[0], 'EscapedSpaceRx', /\\([ \t\n])/); + Opal.const_set($nesting[0], 'ReplaceableTextRx', /[&']|--|\.\.\.|\([CRT]M?\)/); + Opal.const_set($nesting[0], 'SpaceDelimiterRx', /([^\\])[ \t\n]+/); + Opal.const_set($nesting[0], 'SubModifierSniffRx', /[+-]/); + Opal.const_set($nesting[0], 'TrailingDigitsRx', /\d+$/); + if ($$($nesting, 'RUBY_ENGINE')['$==']("opal")) { + } else { + nil + }; + Opal.const_set($nesting[0], 'UriSniffRx', new RegExp("" + "^" + ($$($nesting, 'CG_ALPHA')) + "[" + ($$($nesting, 'CC_ALNUM')) + ".+-]+:/{0,2}")); + Opal.const_set($nesting[0], 'UriTerminatorRx', /[);:]$/); + Opal.const_set($nesting[0], 'XmlSanitizeRx', /<[^>]+>/); + Opal.const_set($nesting[0], 'INTRINSIC_ATTRIBUTES', $hash2(["startsb", "endsb", "vbar", "caret", "asterisk", "tilde", "plus", "backslash", "backtick", "blank", "empty", "sp", "two-colons", "two-semicolons", "nbsp", "deg", "zwsp", "quot", "apos", "lsquo", "rsquo", "ldquo", "rdquo", "wj", "brvbar", "pp", "cpp", "amp", "lt", "gt"], {"startsb": "[", "endsb": "]", "vbar": "|", "caret": "^", "asterisk": "*", "tilde": "~", "plus": "+", "backslash": "\\", "backtick": "`", "blank": "", "empty": "", "sp": " ", "two-colons": "::", "two-semicolons": ";;", "nbsp": " ", "deg": "°", "zwsp": "​", "quot": """, "apos": "'", "lsquo": "‘", "rsquo": "’", "ldquo": "“", "rdquo": "”", "wj": "⁠", "brvbar": "¦", "pp": "++", "cpp": "C++", "amp": "&", "lt": "<", "gt": ">"})); + quote_subs = [["strong", "unconstrained", new RegExp("" + "\\\\?(?:\\[([^\\]]+)\\])?\\*\\*(" + ($$($nesting, 'CC_ALL')) + "+?)\\*\\*", 'm')], ["strong", "constrained", new RegExp("" + "(^|[^" + ($$($nesting, 'CC_WORD')) + ";:}])(?:\\[([^\\]]+)\\])?\\*(\\S|\\S" + ($$($nesting, 'CC_ALL')) + "*?\\S)\\*(?!" + ($$($nesting, 'CG_WORD')) + ")", 'm')], ["double", "constrained", new RegExp("" + "(^|[^" + ($$($nesting, 'CC_WORD')) + ";:}])(?:\\[([^\\]]+)\\])?\"`(\\S|\\S" + ($$($nesting, 'CC_ALL')) + "*?\\S)`\"(?!" + ($$($nesting, 'CG_WORD')) + ")", 'm')], ["single", "constrained", new RegExp("" + "(^|[^" + ($$($nesting, 'CC_WORD')) + ";:`}])(?:\\[([^\\]]+)\\])?'`(\\S|\\S" + ($$($nesting, 'CC_ALL')) + "*?\\S)`'(?!" + ($$($nesting, 'CG_WORD')) + ")", 'm')], ["monospaced", "unconstrained", new RegExp("" + "\\\\?(?:\\[([^\\]]+)\\])?``(" + ($$($nesting, 'CC_ALL')) + "+?)``", 'm')], ["monospaced", "constrained", new RegExp("" + "(^|[^" + ($$($nesting, 'CC_WORD')) + ";:\"'`}])(?:\\[([^\\]]+)\\])?`(\\S|\\S" + ($$($nesting, 'CC_ALL')) + "*?\\S)`(?![" + ($$($nesting, 'CC_WORD')) + "\"'`])", 'm')], ["emphasis", "unconstrained", new RegExp("" + "\\\\?(?:\\[([^\\]]+)\\])?__(" + ($$($nesting, 'CC_ALL')) + "+?)__", 'm')], ["emphasis", "constrained", new RegExp("" + "(^|[^" + ($$($nesting, 'CC_WORD')) + ";:}])(?:\\[([^\\]]+)\\])?_(\\S|\\S" + ($$($nesting, 'CC_ALL')) + "*?\\S)_(?!" + ($$($nesting, 'CG_WORD')) + ")", 'm')], ["mark", "unconstrained", new RegExp("" + "\\\\?(?:\\[([^\\]]+)\\])?##(" + ($$($nesting, 'CC_ALL')) + "+?)##", 'm')], ["mark", "constrained", new RegExp("" + "(^|[^" + ($$($nesting, 'CC_WORD')) + "&;:}])(?:\\[([^\\]]+)\\])?#(\\S|\\S" + ($$($nesting, 'CC_ALL')) + "*?\\S)#(?!" + ($$($nesting, 'CG_WORD')) + ")", 'm')], ["superscript", "unconstrained", /\\?(?:\[([^\]]+)\])?\^(\S+?)\^/], ["subscript", "unconstrained", /\\?(?:\[([^\]]+)\])?~(\S+?)~/]]; + compat_quote_subs = quote_subs.$drop(0); + + $writer = [2, ["double", "constrained", new RegExp("" + "(^|[^" + ($$($nesting, 'CC_WORD')) + ";:}])(?:\\[([^\\]]+)\\])?``(\\S|\\S" + ($$($nesting, 'CC_ALL')) + "*?\\S)''(?!" + ($$($nesting, 'CG_WORD')) + ")", 'm')]]; + $send(compat_quote_subs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = [3, ["single", "constrained", new RegExp("" + "(^|[^" + ($$($nesting, 'CC_WORD')) + ";:}])(?:\\[([^\\]]+)\\])?`(\\S|\\S" + ($$($nesting, 'CC_ALL')) + "*?\\S)'(?!" + ($$($nesting, 'CG_WORD')) + ")", 'm')]]; + $send(compat_quote_subs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = [4, ["monospaced", "unconstrained", new RegExp("" + "\\\\?(?:\\[([^\\]]+)\\])?\\+\\+(" + ($$($nesting, 'CC_ALL')) + "+?)\\+\\+", 'm')]]; + $send(compat_quote_subs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = [5, ["monospaced", "constrained", new RegExp("" + "(^|[^" + ($$($nesting, 'CC_WORD')) + ";:}])(?:\\[([^\\]]+)\\])?\\+(\\S|\\S" + ($$($nesting, 'CC_ALL')) + "*?\\S)\\+(?!" + ($$($nesting, 'CG_WORD')) + ")", 'm')]]; + $send(compat_quote_subs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + compat_quote_subs.$insert(3, ["emphasis", "constrained", new RegExp("" + "(^|[^" + ($$($nesting, 'CC_WORD')) + ";:}])(?:\\[([^\\]]+)\\])?'(\\S|\\S" + ($$($nesting, 'CC_ALL')) + "*?\\S)'(?!" + ($$($nesting, 'CG_WORD')) + ")", 'm')]); + Opal.const_set($nesting[0], 'QUOTE_SUBS', $hash(false, quote_subs, true, compat_quote_subs)); + quote_subs = nil; + compat_quote_subs = nil; + Opal.const_set($nesting[0], 'REPLACEMENTS', [[/\\?\(C\)/, "©", "none"], [/\\?\(R\)/, "®", "none"], [/\\?\(TM\)/, "™", "none"], [/(^|\n| |\\)--( |\n|$)/, " — ", "none"], [new RegExp("" + "(" + ($$($nesting, 'CG_WORD')) + ")\\\\?--(?=" + ($$($nesting, 'CG_WORD')) + ")"), "—​", "leading"], [/\\?\.\.\./, "…​", "leading"], [/\\?`'/, "’", "none"], [new RegExp("" + "(" + ($$($nesting, 'CG_ALNUM')) + ")\\\\?'(?=" + ($$($nesting, 'CG_ALPHA')) + ")"), "’", "leading"], [/\\?->/, "→", "none"], [/\\?=>/, "⇒", "none"], [/\\?<-/, "←", "none"], [/\\?<=/, "⇐", "none"], [/\\?(&)amp;((?:[a-zA-Z][a-zA-Z]+\d{0,2}|#\d\d\d{0,4}|#x[\da-fA-F][\da-fA-F][\da-fA-F]{0,3});)/, "", "bounding"]]); + (function(self, $parent_nesting) { + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_load_9, TMP_load_file_13, TMP_convert_15, TMP_convert_file_16; + + + + Opal.def(self, '$load', TMP_load_9 = function $$load(input, options) { + var $a, $b, TMP_10, TMP_11, TMP_12, self = this, timings = nil, logger = nil, $writer = nil, attrs = nil, attrs_arr = nil, lines = nil, input_path = nil, input_mtime = nil, docdate = nil, doctime = nil, doc = nil, ex = nil, context = nil, wrapped_ex = nil; + + + + if (options == null) { + options = $hash2([], {}); + }; + try { + + options = options.$dup(); + if ($truthy((timings = options['$[]']("timings")))) { + timings.$start("read")}; + if ($truthy(($truthy($a = (logger = options['$[]']("logger"))) ? logger['$!=']($$($nesting, 'LoggerManager').$logger()) : $a))) { + + $writer = [logger]; + $send($$($nesting, 'LoggerManager'), 'logger=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if ($truthy((attrs = options['$[]']("attributes"))['$!']())) { + attrs = $hash2([], {}) + } else if ($truthy(($truthy($a = $$$('::', 'Hash')['$==='](attrs)) ? $a : ($truthy($b = $$$('::', 'RUBY_ENGINE_JRUBY')) ? $$$($$$($$$('::', 'Java'), 'JavaUtil'), 'Map')['$==='](attrs) : $b)))) { + attrs = attrs.$dup() + } else if ($truthy($$$('::', 'Array')['$==='](attrs))) { + + $a = [$hash2([], {}), attrs], (attrs = $a[0]), (attrs_arr = $a[1]), $a; + $send(attrs_arr, 'each', [], (TMP_10 = function(entry){var self = TMP_10.$$s || this, $c, $d, k = nil, v = nil; + + + + if (entry == null) { + entry = nil; + }; + $d = entry.$split("=", 2), $c = Opal.to_ary($d), (k = ($c[0] == null ? nil : $c[0])), (v = ($c[1] == null ? nil : $c[1])), $d; + + $writer = [k, ($truthy($c = v) ? $c : "")]; + $send(attrs, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];;}, TMP_10.$$s = self, TMP_10.$$arity = 1, TMP_10)); + } else if ($truthy($$$('::', 'String')['$==='](attrs))) { + + $a = [$hash2([], {}), attrs.$gsub($$($nesting, 'SpaceDelimiterRx'), "" + "\\1" + ($$($nesting, 'NULL'))).$gsub($$($nesting, 'EscapedSpaceRx'), "\\1").$split($$($nesting, 'NULL'))], (attrs = $a[0]), (attrs_arr = $a[1]), $a; + $send(attrs_arr, 'each', [], (TMP_11 = function(entry){var self = TMP_11.$$s || this, $c, $d, k = nil, v = nil; + + + + if (entry == null) { + entry = nil; + }; + $d = entry.$split("=", 2), $c = Opal.to_ary($d), (k = ($c[0] == null ? nil : $c[0])), (v = ($c[1] == null ? nil : $c[1])), $d; + + $writer = [k, ($truthy($c = v) ? $c : "")]; + $send(attrs, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];;}, TMP_11.$$s = self, TMP_11.$$arity = 1, TMP_11)); + } else if ($truthy(($truthy($a = attrs['$respond_to?']("keys")) ? attrs['$respond_to?']("[]") : $a))) { + attrs = $$$('::', 'Hash')['$[]']($send(attrs.$keys(), 'map', [], (TMP_12 = function(k){var self = TMP_12.$$s || this; + + + + if (k == null) { + k = nil; + }; + return [k, attrs['$[]'](k)];}, TMP_12.$$s = self, TMP_12.$$arity = 1, TMP_12))) + } else { + self.$raise($$$('::', 'ArgumentError'), "" + "illegal type for attributes option: " + (attrs.$class().$ancestors().$join(" < "))) + }; + lines = nil; + if ($truthy($$$('::', 'File')['$==='](input))) { + + input_path = $$$('::', 'File').$expand_path(input.$path()); + input_mtime = (function() {if ($truthy($$$('::', 'ENV')['$[]']("SOURCE_DATE_EPOCH"))) { + return $$$('::', 'Time').$at(self.$Integer($$$('::', 'ENV')['$[]']("SOURCE_DATE_EPOCH"))).$utc() + } else { + return input.$mtime() + }; return nil; })(); + lines = input.$readlines(); + + $writer = ["docfile", input_path]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["docdir", $$$('::', 'File').$dirname(input_path)]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["docname", $$($nesting, 'Helpers').$basename(input_path, (($writer = ["docfilesuffix", $$$('::', 'File').$extname(input_path)]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]))]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + if ($truthy((docdate = attrs['$[]']("docdate")))) { + ($truthy($a = attrs['$[]']("docyear")) ? $a : (($writer = ["docyear", (function() {if (docdate.$index("-")['$=='](4)) { + + return docdate.$slice(0, 4); + } else { + return nil + }; return nil; })()]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])) + } else { + + docdate = (($writer = ["docdate", input_mtime.$strftime("%F")]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]); + ($truthy($a = attrs['$[]']("docyear")) ? $a : (($writer = ["docyear", input_mtime.$year().$to_s()]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + }; + doctime = ($truthy($a = attrs['$[]']("doctime")) ? $a : (($writer = ["doctime", input_mtime.$strftime("" + "%T " + ((function() {if (input_mtime.$utc_offset()['$=='](0)) { + return "UTC" + } else { + return "%z" + }; return nil; })()))]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + + $writer = ["docdatetime", "" + (docdate) + " " + (doctime)]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + } else if ($truthy(input['$respond_to?']("readlines"))) { + + + try { + input.$rewind() + } catch ($err) { + if (Opal.rescue($err, [$$($nesting, 'StandardError')])) { + try { + nil + } finally { Opal.pop_exception() } + } else { throw $err; } + };; + lines = input.$readlines(); + } else if ($truthy($$$('::', 'String')['$==='](input))) { + lines = (function() {if ($truthy($$$('::', 'RUBY_MIN_VERSION_2'))) { + return input.$lines() + } else { + return input.$each_line().$to_a() + }; return nil; })() + } else if ($truthy($$$('::', 'Array')['$==='](input))) { + lines = input.$drop(0) + } else { + self.$raise($$$('::', 'ArgumentError'), "" + "unsupported input type: " + (input.$class())) + }; + if ($truthy(timings)) { + + timings.$record("read"); + timings.$start("parse");}; + + $writer = ["attributes", attrs]; + $send(options, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + doc = (function() {if (options['$[]']("parse")['$=='](false)) { + + return $$($nesting, 'Document').$new(lines, options); + } else { + return $$($nesting, 'Document').$new(lines, options).$parse() + }; return nil; })(); + if ($truthy(timings)) { + timings.$record("parse")}; + return doc; + } catch ($err) { + if (Opal.rescue($err, [$$($nesting, 'StandardError')])) {ex = $err; + try { + + + try { + + context = "" + "asciidoctor: FAILED: " + (($truthy($a = attrs['$[]']("docfile")) ? $a : "")) + ": Failed to load AsciiDoc document"; + if ($truthy(ex['$respond_to?']("exception"))) { + + wrapped_ex = ex.$exception("" + (context) + " - " + (ex.$message())); + wrapped_ex.$set_backtrace(ex.$backtrace()); + } else { + + wrapped_ex = ex.$class().$new(context, ex); + + $writer = [ex.$stack_trace()]; + $send(wrapped_ex, 'stack_trace=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + }; + } catch ($err) { + if (Opal.rescue($err, [$$($nesting, 'StandardError')])) { + try { + wrapped_ex = ex + } finally { Opal.pop_exception() } + } else { throw $err; } + };; + return self.$raise(wrapped_ex); + } finally { Opal.pop_exception() } + } else { throw $err; } + }; + }, TMP_load_9.$$arity = -2); + + Opal.def(self, '$load_file', TMP_load_file_13 = function $$load_file(filename, options) { + var TMP_14, self = this; + + + + if (options == null) { + options = $hash2([], {}); + }; + return $send($$$('::', 'File'), 'open', [filename, "rb"], (TMP_14 = function(file){var self = TMP_14.$$s || this; + + + + if (file == null) { + file = nil; + }; + return self.$load(file, options);}, TMP_14.$$s = self, TMP_14.$$arity = 1, TMP_14)); + }, TMP_load_file_13.$$arity = -2); + + Opal.def(self, '$convert', TMP_convert_15 = function $$convert(input, options) { + var $a, $b, $c, $d, $e, self = this, to_file = nil, to_dir = nil, mkdirs = nil, $case = nil, write_to_same_dir = nil, stream_output = nil, write_to_target = nil, $writer = nil, input_path = nil, outdir = nil, doc = nil, outfile = nil, working_dir = nil, jail = nil, opts = nil, output = nil, stylesdir = nil, copy_asciidoctor_stylesheet = nil, copy_user_stylesheet = nil, stylesheet = nil, copy_coderay_stylesheet = nil, copy_pygments_stylesheet = nil, stylesoutdir = nil, stylesheet_src = nil, stylesheet_dest = nil, stylesheet_data = nil; + + + + if (options == null) { + options = $hash2([], {}); + }; + options = options.$dup(); + options.$delete("parse"); + to_file = options.$delete("to_file"); + to_dir = options.$delete("to_dir"); + mkdirs = ($truthy($a = options.$delete("mkdirs")) ? $a : false); + $case = to_file; + if (true['$===']($case) || nil['$===']($case)) { + write_to_same_dir = ($truthy($a = to_dir['$!']()) ? $$$('::', 'File')['$==='](input) : $a); + stream_output = false; + write_to_target = to_dir; + to_file = nil;} + else if (false['$===']($case)) { + write_to_same_dir = false; + stream_output = false; + write_to_target = false; + to_file = nil;} + else if ("/dev/null"['$===']($case)) {return self.$load(input, options)} + else { + write_to_same_dir = false; + write_to_target = (function() {if ($truthy((stream_output = to_file['$respond_to?']("write")))) { + return false + } else { + + + $writer = ["to_file", to_file]; + $send(options, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];; + }; return nil; })();}; + if ($truthy(options['$key?']("header_footer"))) { + } else if ($truthy(($truthy($a = write_to_same_dir) ? $a : write_to_target))) { + + $writer = ["header_footer", true]; + $send(options, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if ($truthy(write_to_same_dir)) { + + input_path = $$$('::', 'File').$expand_path(input.$path()); + + $writer = ["to_dir", (outdir = $$$('::', 'File').$dirname(input_path))]; + $send(options, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + } else if ($truthy(write_to_target)) { + if ($truthy(to_dir)) { + if ($truthy(to_file)) { + + $writer = ["to_dir", $$$('::', 'File').$dirname($$$('::', 'File').$expand_path($$$('::', 'File').$join(to_dir, to_file)))]; + $send(options, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + } else { + + $writer = ["to_dir", $$$('::', 'File').$expand_path(to_dir)]; + $send(options, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + } + } else if ($truthy(to_file)) { + + $writer = ["to_dir", $$$('::', 'File').$dirname($$$('::', 'File').$expand_path(to_file))]; + $send(options, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}}; + doc = self.$load(input, options); + if ($truthy(write_to_same_dir)) { + + outfile = $$$('::', 'File').$join(outdir, "" + (doc.$attributes()['$[]']("docname")) + (doc.$outfilesuffix())); + if (outfile['$=='](input_path)) { + self.$raise($$$('::', 'IOError'), "" + "input file and output file cannot be the same: " + (outfile))}; + } else if ($truthy(write_to_target)) { + + working_dir = (function() {if ($truthy(options['$key?']("base_dir"))) { + + return $$$('::', 'File').$expand_path(options['$[]']("base_dir")); + } else { + return $$$('::', 'Dir').$pwd() + }; return nil; })(); + jail = (function() {if ($truthy($rb_ge(doc.$safe(), $$$($$($nesting, 'SafeMode'), 'SAFE')))) { + return working_dir + } else { + return nil + }; return nil; })(); + if ($truthy(to_dir)) { + + outdir = doc.$normalize_system_path(to_dir, working_dir, jail, $hash2(["target_name", "recover"], {"target_name": "to_dir", "recover": false})); + if ($truthy(to_file)) { + + outfile = doc.$normalize_system_path(to_file, outdir, nil, $hash2(["target_name", "recover"], {"target_name": "to_dir", "recover": false})); + outdir = $$$('::', 'File').$dirname(outfile); + } else { + outfile = $$$('::', 'File').$join(outdir, "" + (doc.$attributes()['$[]']("docname")) + (doc.$outfilesuffix())) + }; + } else if ($truthy(to_file)) { + + outfile = doc.$normalize_system_path(to_file, working_dir, jail, $hash2(["target_name", "recover"], {"target_name": "to_dir", "recover": false})); + outdir = $$$('::', 'File').$dirname(outfile);}; + if ($truthy(($truthy($a = $$$('::', 'File')['$==='](input)) ? outfile['$==']($$$('::', 'File').$expand_path(input.$path())) : $a))) { + self.$raise($$$('::', 'IOError'), "" + "input file and output file cannot be the same: " + (outfile))}; + if ($truthy(mkdirs)) { + $$($nesting, 'Helpers').$mkdir_p(outdir) + } else if ($truthy($$$('::', 'File')['$directory?'](outdir))) { + } else { + self.$raise($$$('::', 'IOError'), "" + "target directory does not exist: " + (to_dir) + " (hint: set mkdirs option)") + }; + } else { + + outfile = to_file; + outdir = nil; + }; + opts = (function() {if ($truthy(($truthy($a = outfile) ? stream_output['$!']() : $a))) { + return $hash2(["outfile", "outdir"], {"outfile": outfile, "outdir": outdir}) + } else { + return $hash2([], {}) + }; return nil; })(); + output = doc.$convert(opts); + if ($truthy(outfile)) { + + doc.$write(output, outfile); + if ($truthy(($truthy($a = ($truthy($b = ($truthy($c = ($truthy($d = ($truthy($e = stream_output['$!']()) ? $rb_lt(doc.$safe(), $$$($$($nesting, 'SafeMode'), 'SECURE')) : $e)) ? doc['$attr?']("linkcss") : $d)) ? doc['$attr?']("copycss") : $c)) ? doc['$attr?']("basebackend-html") : $b)) ? ($truthy($b = (stylesdir = doc.$attr("stylesdir"))) ? $$($nesting, 'Helpers')['$uriish?'](stylesdir) : $b)['$!']() : $a))) { + + copy_asciidoctor_stylesheet = false; + copy_user_stylesheet = false; + if ($truthy((stylesheet = doc.$attr("stylesheet")))) { + if ($truthy($$($nesting, 'DEFAULT_STYLESHEET_KEYS')['$include?'](stylesheet))) { + copy_asciidoctor_stylesheet = true + } else if ($truthy($$($nesting, 'Helpers')['$uriish?'](stylesheet)['$!']())) { + copy_user_stylesheet = true}}; + copy_coderay_stylesheet = ($truthy($a = doc['$attr?']("source-highlighter", "coderay")) ? doc.$attr("coderay-css", "class")['$==']("class") : $a); + copy_pygments_stylesheet = ($truthy($a = doc['$attr?']("source-highlighter", "pygments")) ? doc.$attr("pygments-css", "class")['$==']("class") : $a); + if ($truthy(($truthy($a = ($truthy($b = ($truthy($c = copy_asciidoctor_stylesheet) ? $c : copy_user_stylesheet)) ? $b : copy_coderay_stylesheet)) ? $a : copy_pygments_stylesheet))) { + + stylesoutdir = doc.$normalize_system_path(stylesdir, outdir, (function() {if ($truthy($rb_ge(doc.$safe(), $$$($$($nesting, 'SafeMode'), 'SAFE')))) { + return outdir + } else { + return nil + }; return nil; })()); + if ($truthy(mkdirs)) { + $$($nesting, 'Helpers').$mkdir_p(stylesoutdir) + } else if ($truthy($$$('::', 'File')['$directory?'](stylesoutdir))) { + } else { + self.$raise($$$('::', 'IOError'), "" + "target stylesheet directory does not exist: " + (stylesoutdir) + " (hint: set mkdirs option)") + }; + if ($truthy(copy_asciidoctor_stylesheet)) { + $$($nesting, 'Stylesheets').$instance().$write_primary_stylesheet(stylesoutdir) + } else if ($truthy(copy_user_stylesheet)) { + + if ($truthy((stylesheet_src = doc.$attr("copycss"))['$empty?']())) { + stylesheet_src = doc.$normalize_system_path(stylesheet) + } else { + stylesheet_src = doc.$normalize_system_path(stylesheet_src) + }; + stylesheet_dest = doc.$normalize_system_path(stylesheet, stylesoutdir, (function() {if ($truthy($rb_ge(doc.$safe(), $$$($$($nesting, 'SafeMode'), 'SAFE')))) { + return outdir + } else { + return nil + }; return nil; })()); + if ($truthy(($truthy($a = stylesheet_src['$!='](stylesheet_dest)) ? (stylesheet_data = doc.$read_asset(stylesheet_src, $hash2(["warn_on_failure", "label"], {"warn_on_failure": $$$('::', 'File')['$file?'](stylesheet_dest)['$!'](), "label": "stylesheet"}))) : $a))) { + $$$('::', 'IO').$write(stylesheet_dest, stylesheet_data)};}; + if ($truthy(copy_coderay_stylesheet)) { + $$($nesting, 'Stylesheets').$instance().$write_coderay_stylesheet(stylesoutdir) + } else if ($truthy(copy_pygments_stylesheet)) { + $$($nesting, 'Stylesheets').$instance().$write_pygments_stylesheet(stylesoutdir, doc.$attr("pygments-style"))};};}; + return doc; + } else { + return output + }; + }, TMP_convert_15.$$arity = -2); + Opal.alias(self, "render", "convert"); + + Opal.def(self, '$convert_file', TMP_convert_file_16 = function $$convert_file(filename, options) { + var TMP_17, self = this; + + + + if (options == null) { + options = $hash2([], {}); + }; + return $send($$$('::', 'File'), 'open', [filename, "rb"], (TMP_17 = function(file){var self = TMP_17.$$s || this; + + + + if (file == null) { + file = nil; + }; + return self.$convert(file, options);}, TMP_17.$$s = self, TMP_17.$$arity = 1, TMP_17)); + }, TMP_convert_file_16.$$arity = -2); + Opal.alias(self, "render_file", "convert_file"); + if ($$($nesting, 'RUBY_ENGINE')['$==']("opal")) { + return nil + } else { + return nil + }; + })(Opal.get_singleton_class(self), $nesting); + if ($$($nesting, 'RUBY_ENGINE')['$==']("opal")) { + + self.$require("asciidoctor/timings"); + self.$require("asciidoctor/version"); + } else { + nil + }; + })($nesting[0], $nesting); + self.$require("asciidoctor/core_ext"); + self.$require("asciidoctor/helpers"); + self.$require("asciidoctor/substitutors"); + self.$require("asciidoctor/abstract_node"); + self.$require("asciidoctor/abstract_block"); + self.$require("asciidoctor/attribute_list"); + self.$require("asciidoctor/block"); + self.$require("asciidoctor/callouts"); + self.$require("asciidoctor/converter"); + self.$require("asciidoctor/document"); + self.$require("asciidoctor/inline"); + self.$require("asciidoctor/list"); + self.$require("asciidoctor/parser"); + self.$require("asciidoctor/path_resolver"); + self.$require("asciidoctor/reader"); + self.$require("asciidoctor/section"); + self.$require("asciidoctor/stylesheets"); + self.$require("asciidoctor/table"); + if ($$($nesting, 'RUBY_ENGINE')['$==']("opal")) { + return self.$require("asciidoctor/js/postscript") + } else { + return nil + }; +})(Opal); + + +/** + * Convert a JSON to an (Opal) Hash. + * @private + */ +var toHash = function (object) { + return object && !('$$smap' in object) ? Opal.hash(object) : object; +}; + +/** + * Convert an (Opal) Hash to JSON. + * @private + */ +var fromHash = function (hash) { + var object = {}; + var data = hash.$$smap; + for (var key in data) { + object[key] = data[key]; + } + return object; +}; + +/** + * @private + */ +var prepareOptions = function (options) { + if (options = toHash(options)) { + var attrs = options['$[]']('attributes'); + if (attrs && typeof attrs === 'object' && attrs.constructor.name === 'Object') { + options = options.$dup(); + options['$[]=']('attributes', toHash(attrs)); + } + } + return options; +}; + +function initializeClass (superClass, className, functions, defaultFunctions, argProxyFunctions) { + var scope = Opal.klass(Opal.Object, superClass, className, function () {}); + var postConstructFunction; + var initializeFunction; + var defaultFunctionsOverridden = {}; + for (var functionName in functions) { + if (functions.hasOwnProperty(functionName)) { + (function (functionName) { + var userFunction = functions[functionName]; + if (functionName === 'postConstruct') { + postConstructFunction = userFunction; + } else if (functionName === 'initialize') { + initializeFunction = userFunction; + } else { + if (defaultFunctions && defaultFunctions.hasOwnProperty(functionName)) { + defaultFunctionsOverridden[functionName] = true; + } + Opal.def(scope, '$' + functionName, function () { + var args; + if (argProxyFunctions && argProxyFunctions.hasOwnProperty(functionName)) { + args = argProxyFunctions[functionName](arguments); + } else { + args = arguments; + } + return userFunction.apply(this, args); + }); + } + }(functionName)); + } + } + var initialize; + if (typeof initializeFunction === 'function') { + initialize = function () { + initializeFunction.apply(this, arguments); + if (typeof postConstructFunction === 'function') { + postConstructFunction.bind(this)(); + } + }; + } else { + initialize = function () { + Opal.send(this, Opal.find_super_dispatcher(this, 'initialize', initialize)); + if (typeof postConstructFunction === 'function') { + postConstructFunction.bind(this)(); + } + }; + } + Opal.def(scope, '$initialize', initialize); + Opal.def(scope, 'super', function (func) { + if (typeof func === 'function') { + Opal.send(this, Opal.find_super_dispatcher(this, func.name, func)); + } else { + // Bind the initialize function to super(); + var argumentsList = Array.from(arguments); + for (var i = 0; i < argumentsList.length; i++) { + // convert all (Opal) Hash arguments to JSON. + if (typeof argumentsList[i] === 'object') { + argumentsList[i] = toHash(argumentsList[i]); + } + } + Opal.send(this, Opal.find_super_dispatcher(this, 'initialize', initialize), argumentsList); + } + }); + if (defaultFunctions) { + for (var defaultFunctionName in defaultFunctions) { + if (defaultFunctions.hasOwnProperty(defaultFunctionName) && !defaultFunctionsOverridden.hasOwnProperty(defaultFunctionName)) { + (function (defaultFunctionName) { + var defaultFunction = defaultFunctions[defaultFunctionName]; + Opal.def(scope, '$' + defaultFunctionName, function () { + return defaultFunction.apply(this, arguments); + }); + }(defaultFunctionName)); + } + } + } + return scope; +} + +// Asciidoctor API + +/** + * @namespace + * @description + * Methods for parsing AsciiDoc input files and converting documents. + * + * AsciiDoc documents comprise a header followed by zero or more sections. + * Sections are composed of blocks of content. For example: + *
    + *   = Doc Title
    + *
    + *   == Section 1
    + *
    + *   This is a paragraph block in the first section.
    + *
    + *   == Section 2
    + *
    + *   This section has a paragraph block and an olist block.
    + *
    + *   . Item 1
    + *   . Item 2
    + * 
    + * + * @example + * asciidoctor.convertFile('sample.adoc'); + */ +var Asciidoctor = Opal.Asciidoctor['$$class']; + +/** + * Get Asciidoctor core version number. + * + * @memberof Asciidoctor + * @returns {string} - returns the version number of Asciidoctor core. + */ +Asciidoctor.prototype.getCoreVersion = function () { + return this.$$const.VERSION; +}; + +/** + * Get Asciidoctor.js runtime environment informations. + * + * @memberof Asciidoctor + * @returns {Object} - returns the runtime environement including the ioModule, the platform, the engine and the framework. + */ +Asciidoctor.prototype.getRuntime = function () { + return { + ioModule: Opal.const_get_qualified('::', 'JAVASCRIPT_IO_MODULE'), + platform: Opal.const_get_qualified('::', 'JAVASCRIPT_PLATFORM'), + engine: Opal.const_get_qualified('::', 'JAVASCRIPT_ENGINE'), + framework: Opal.const_get_qualified('::', 'JAVASCRIPT_FRAMEWORK') + }; +}; + +/** + * Parse the AsciiDoc source input into an {@link Document} and convert it to the specified backend format. + * + * Accepts input as a Buffer or String. + * + * @param {string|Buffer} input - AsciiDoc input as String or Buffer + * @param {Object} options - a JSON of options to control processing (default: {}) + * @returns {string|Document} - returns the {@link Document} object if the converted String is written to a file, + * otherwise the converted String + * @memberof Asciidoctor + * @example + * var input = '= Hello, AsciiDoc!\n' + + * 'Guillaume Grossetie \n\n' + + * 'An introduction to http://asciidoc.org[AsciiDoc].\n\n' + + * '== First Section\n\n' + + * '* item 1\n' + + * '* item 2\n'; + * + * var html = asciidoctor.convert(input); + */ +Asciidoctor.prototype.convert = function (input, options) { + if (typeof input === 'object' && input.constructor.name === 'Buffer') { + input = input.toString('utf8'); + } + var result = this.$convert(input, prepareOptions(options)); + return result === Opal.nil ? '' : result; +}; + +/** + * Parse the AsciiDoc source input into an {@link Document} and convert it to the specified backend format. + * + * @param {string} filename - source filename + * @param {Object} options - a JSON of options to control processing (default: {}) + * @returns {string|Document} - returns the {@link Document} object if the converted String is written to a file, + * otherwise the converted String + * @memberof Asciidoctor + * @example + * var html = asciidoctor.convertFile('./document.adoc'); + */ +Asciidoctor.prototype.convertFile = function (filename, options) { + return this.$convert_file(filename, prepareOptions(options)); +}; + +/** + * Parse the AsciiDoc source input into an {@link Document} + * + * Accepts input as a Buffer or String. + * + * @param {string|Buffer} input - AsciiDoc input as String or Buffer + * @param {Object} options - a JSON of options to control processing (default: {}) + * @returns {Document} - returns the {@link Document} object + * @memberof Asciidoctor + */ +Asciidoctor.prototype.load = function (input, options) { + if (typeof input === 'object' && input.constructor.name === 'Buffer') { + input = input.toString('utf8'); + } + return this.$load(input, prepareOptions(options)); +}; + +/** + * Parse the contents of the AsciiDoc source file into an {@link Document} + * + * @param {string} filename - source filename + * @param {Object} options - a JSON of options to control processing (default: {}) + * @returns {Document} - returns the {@link Document} object + * @memberof Asciidoctor + */ +Asciidoctor.prototype.loadFile = function (filename, options) { + return this.$load_file(filename, prepareOptions(options)); +}; + +// AbstractBlock API + +/** + * @namespace + * @extends AbstractNode + */ +var AbstractBlock = Opal.Asciidoctor.AbstractBlock; + +/** + * Append a block to this block's list of child blocks. + * + * @memberof AbstractBlock + * @returns {AbstractBlock} - the parent block to which this block was appended. + * + */ +AbstractBlock.prototype.append = function (block) { + this.$append(block); + return this; +}; + +/* + * Apply the named inline substitutions to the specified text. + * + * If no substitutions are specified, the following substitutions are + * applied: + * + * specialcharacters, quotes, attributes, replacements, macros, and post_replacements + * @param {string} text - The text to substitute. + * @param {Array} subs - A list named substitutions to apply to the text. + * @memberof AbstractBlock + * @returns {string} - returns the substituted text. + */ +AbstractBlock.prototype.applySubstitutions = function (text, subs) { + return this.$apply_subs(text, subs); +}; + +/** + * Get the String title of this Block with title substitions applied + * + * The following substitutions are applied to block and section titles: + * + * specialcharacters, quotes, replacements, macros, attributes and post_replacements + * + * @memberof AbstractBlock + * @returns {string} - returns the converted String title for this Block, or undefined if the title is not set. + * @example + * block.title // "Foo 3^ # {two-colons} Bar(1)" + * block.getTitle(); // "Foo 3^ # :: Bar(1)" + */ +AbstractBlock.prototype.getTitle = function () { + var title = this.$title(); + return title === Opal.nil ? undefined : title; +}; + +/** + * Convenience method that returns the interpreted title of the Block + * with the caption prepended. + * Concatenates the value of this Block's caption instance variable and the + * return value of this Block's title method. No space is added between the + * two values. If the Block does not have a caption, the interpreted title is + * returned. + * + * @memberof AbstractBlock + * @returns {string} - the converted String title prefixed with the caption, or just the + * converted String title if no caption is set + */ +AbstractBlock.prototype.getCaptionedTitle = function () { + return this.$captioned_title(); +}; + +/** + * Get the style (block type qualifier) for this block. + * @memberof AbstractBlock + * @returns {string} - returns the style for this block + */ +AbstractBlock.prototype.getStyle = function () { + return this.style; +}; + +/** + * Get the caption for this block. + * @memberof AbstractBlock + * @returns {string} - returns the caption for this block + */ +AbstractBlock.prototype.getCaption = function () { + return this.$caption(); +}; + +/** + * Set the caption for this block. + * @param {string} caption - Caption + * @memberof AbstractBlock + */ +AbstractBlock.prototype.setCaption = function (caption) { + this.caption = caption; +}; + +/** + * Get the level of this section or the section level in which this block resides. + * @memberof AbstractBlock + * @returns {number} - returns the level of this section + */ +AbstractBlock.prototype.getLevel = function () { + return this.level; +}; + +/** + * Get the substitution keywords to be applied to the contents of this block. + * + * @memberof AbstractBlock + * @returns {Array} - the list of {string} substitution keywords associated with this block. + */ +AbstractBlock.prototype.getSubstitutions = function () { + return this.subs; +}; + +/** + * Check whether a given substitution keyword is present in the substitutions for this block. + * + * @memberof AbstractBlock + * @returns {boolean} - whether the substitution is present on this block. + */ +AbstractBlock.prototype.hasSubstitution = function (substitution) { + return this['$sub?'](substitution); +}; + +/** + * Remove the specified substitution keyword from the list of substitutions for this block. + * + * @memberof AbstractBlock + * @returns undefined + */ +AbstractBlock.prototype.removeSubstitution = function (substitution) { + this.$remove_sub(substitution); +}; + +/** + * Checks if the {@link AbstractBlock} contains any child blocks. + * @memberof AbstractBlock + * @returns {boolean} - whether the {@link AbstractBlock} has child blocks. + */ +AbstractBlock.prototype.hasBlocks = function () { + return this.blocks.length > 0; +}; + +/** + * Get the list of {@link AbstractBlock} sub-blocks for this block. + * @memberof AbstractBlock + * @returns {Array} - returns a list of {@link AbstractBlock} sub-blocks + */ +AbstractBlock.prototype.getBlocks = function () { + return this.blocks; +}; + +/** + * Get the converted result of the child blocks by converting the children appropriate to content model that this block supports. + * @memberof AbstractBlock + * @returns {string} - returns the converted result of the child blocks + */ +AbstractBlock.prototype.getContent = function () { + return this.$content(); +}; + +/** + * Get the converted content for this block. + * If the block has child blocks, the content method should cause them to be converted + * and returned as content that can be included in the parent block's template. + * @memberof AbstractBlock + * @returns {string} - returns the converted String content for this block + */ +AbstractBlock.prototype.convert = function () { + return this.$convert(); +}; + +/** + * Query for all descendant block-level nodes in the document tree + * that match the specified selector (context, style, id, and/or role). + * If a function block is given, it's used as an additional filter. + * If no selector or function block is supplied, all block-level nodes in the tree are returned. + * @param {Object} [selector] + * @param {function} [block] + * @example + * doc.findBy({'context': 'section'}); + * // => { level: 0, title: "Hello, AsciiDoc!", blocks: 0 } + * // => { level: 1, title: "First Section", blocks: 1 } + * + * doc.findBy({'context': 'section'}, function (section) { return section.getLevel() === 1; }); + * // => { level: 1, title: "First Section", blocks: 1 } + * + * doc.findBy({'context': 'listing', 'style': 'source'}); + * // => { context: :listing, content_model: :verbatim, style: "source", lines: 1 } + * + * @memberof AbstractBlock + * @returns {Array} - returns a list of block-level nodes that match the filter or an empty list if no matches are found + */ +AbstractBlock.prototype.findBy = function (selector, block) { + if (typeof block === 'undefined' && typeof selector === 'function') { + return Opal.send(this, 'find_by', null, selector); + } + else if (typeof block === 'function') { + return Opal.send(this, 'find_by', [toHash(selector)], block); + } + else { + return this.$find_by(toHash(selector)); + } +}; + +/** + * Get the source line number where this block started. + * @memberof AbstractBlock + * @returns {number} - returns the source line number where this block started + */ +AbstractBlock.prototype.getLineNumber = function () { + var lineno = this.$lineno(); + return lineno === Opal.nil ? undefined : lineno; +}; + +/** + * Check whether this block has any child Section objects. + * Only applies to Document and Section instances. + * @memberof AbstractBlock + * @returns {boolean} - true if this block has child Section objects, otherwise false + */ +AbstractBlock.prototype.hasSections = function () { + return this['$sections?'](); +}; + +/** + * Get the Array of child Section objects. + * Only applies to Document and Section instances. + * @memberof AbstractBlock + * @returns {Array} - returns an {Array} of {@link Section} objects + */ +AbstractBlock.prototype.getSections = function () { + return this.$sections(); +}; + +/** + * Get the numeral of this block (if section, relative to parent, otherwise absolute). + * Only assigned to section if automatic section numbering is enabled. + * Only assigned to formal block (block with title) if corresponding caption attribute is present. + * If the section is an appendix, the numeral is a letter (starting with A). + * @memberof AbstractBlock + * @returns {string} - returns the numeral + */ +AbstractBlock.prototype.getNumeral = function () { + // number was renamed to numeral + // https://github.com/asciidoctor/asciidoctor/commit/33ac4821e0375bcd5aa189c394ad7630717bcd55 + return this.$number(); +}; + +/** + * Set the numeral of this block. + * @memberof AbstractBlock + */ +AbstractBlock.prototype.setNumeral = function (value) { + // number was renamed to numeral + // https://github.com/asciidoctor/asciidoctor/commit/33ac4821e0375bcd5aa189c394ad7630717bcd55 + return this['$number='](value); +}; + +/** + * A convenience method that checks whether the title of this block is defined. + * + * @returns a {boolean} indicating whether this block has a title. + * @memberof AbstractBlock + */ +AbstractBlock.prototype.hasTitle = function () { + return this['$title?'](); +}; + +// Section API + +/** + * @namespace + * @extends AbstractBlock + */ +var Section = Opal.Asciidoctor.Section; + +/** + * Get the 0-based index order of this section within the parent block. + * @memberof Section + * @returns {number} + */ +Section.prototype.getIndex = function () { + return this.index; +}; + +/** + * Set the 0-based index order of this section within the parent block. + * @memberof Section + */ +Section.prototype.setIndex = function (value) { + this.index = value; +}; + +/** + * Get the section name of this section. + * @memberof Section + * @returns {string} + */ +Section.prototype.getSectionName = function () { + return this.sectname; +}; + +/** + * Set the section name of this section. + * @memberof Section + */ +Section.prototype.setSectionName = function (value) { + this.sectname = value; +}; + +/** + * Get the flag to indicate whether this is a special section or a child of one. + * @memberof Section + * @returns {boolean} + */ +Section.prototype.isSpecial = function () { + return this.special; +}; + +/** + * Set the flag to indicate whether this is a special section or a child of one. + * @memberof Section + */ +Section.prototype.setSpecial = function (value) { + this.special = value; +}; + +/** + * Get the state of the numbered attribute at this section (need to preserve for creating TOC). + * @memberof Section + * @returns {boolean} + */ +Section.prototype.isNumbered = function () { + return this.numbered; +}; + +/** + * Get the caption for this section (only relevant for appendices). + * @memberof Section + * @returns {string} + */ +Section.prototype.getCaption = function () { + var value = this.caption; + return value === Opal.nil ? undefined : value; +}; + +/** + * Get the name of the Section (title) + * @memberof Section + * @returns {string} + * @see {@link AbstractBlock#getTitle} + */ +Section.prototype.getName = function () { + return this.getTitle(); +}; + +/** + * @namespace + */ +var Block = Opal.Asciidoctor.Block; + +/** + * Get the source of this block. + * @memberof Block + * @returns {string} - returns the String source of this block. + */ +Block.prototype.getSource = function () { + return this.$source(); +}; + +/** + * Get the source lines of this block. + * @memberof Block + * @returns {Array} - returns the String {Array} of source lines for this block. + */ +Block.prototype.getSourceLines = function () { + return this.lines; +}; + +// AbstractNode API + +/** + * @namespace + */ +var AbstractNode = Opal.Asciidoctor.AbstractNode; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.getNodeName = function () { + return this.node_name; +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.getAttributes = function () { + return fromHash(this.attributes); +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.getAttribute = function (name, defaultValue, inherit) { + var value = this.$attr(name, defaultValue, inherit); + return value === Opal.nil ? undefined : value; +}; + +/** + * Check whether the specified attribute is present on this node. + * + * @memberof AbstractNode + * @returns {boolean} - true if the attribute is present, otherwise false + */ +AbstractNode.prototype.hasAttribute = function (name) { + return name in this.attributes.$$smap; +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.isAttribute = function (name, expectedValue, inherit) { + var result = this['$attr?'](name, expectedValue, inherit); + return result === Opal.nil ? false : result; +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.setAttribute = function (name, value, overwrite) { + if (typeof overwrite === 'undefined') overwrite = true; + return this.$set_attr(name, value, overwrite); +}; + +/** + * Remove the attribute from the current node. + * @param {string} name - The String attribute name to remove + * @returns {string} - returns the previous {String} value, or undefined if the attribute was not present. + * @memberof AbstractNode + */ +AbstractNode.prototype.removeAttribute = function (name) { + var value = this.$remove_attr(name); + return value === Opal.nil ? undefined : value; +}; + +/** + * Get the {@link Document} to which this node belongs. + * + * @memberof AbstractNode + * @returns {Document} - returns the {@link Document} object to which this node belongs. + */ +AbstractNode.prototype.getDocument = function () { + return this.document; +}; + +/** + * Get the {@link AbstractNode} to which this node is attached. + * + * @memberof AbstractNode + * @returns {AbstractNode} - returns the {@link AbstractNode} object to which this node is attached, + * or undefined if this node has no parent. + */ +AbstractNode.prototype.getParent = function () { + var parent = this.parent; + return parent === Opal.nil ? undefined : parent; +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.isInline = function () { + return this['$inline?'](); +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.isBlock = function () { + return this['$block?'](); +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.isRole = function (expected) { + return this['$role?'](expected); +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.getRole = function () { + return this.$role(); +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.hasRole = function (name) { + return this['$has_role?'](name); +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.getRoles = function () { + return this.$roles(); +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.addRole = function (name) { + return this.$add_role(name); +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.removeRole = function (name) { + return this.$remove_role(name); +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.isReftext = function () { + return this['$reftext?'](); +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.getReftext = function () { + return this.$reftext(); +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.getContext = function () { + var context = this.context; + // Automatically convert Opal pseudo-symbol to String + return typeof context === 'string' ? context : context.toString(); +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.getId = function () { + var id = this.id; + return id === Opal.nil ? undefined : id; +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.isOption = function (name) { + return this['$option?'](name); +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.setOption = function (name) { + return this.$set_option(name); +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.getIconUri = function (name) { + return this.$icon_uri(name); +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.getMediaUri = function (target, assetDirKey) { + return this.$media_uri(target, assetDirKey); +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.getImageUri = function (targetImage, assetDirKey) { + return this.$image_uri(targetImage, assetDirKey); +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.getConverter = function () { + return this.$converter(); +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.readContents = function (target, options) { + return this.$read_contents(target, toHash(options)); +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.readAsset = function (path, options) { + return this.$read_asset(path, toHash(options)); +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.normalizeWebPath = function (target, start, preserveTargetUri) { + return this.$normalize_web_path(target, start, preserveTargetUri); +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.normalizeSystemPath = function (target, start, jail, options) { + return this.$normalize_system_path(target, start, jail, toHash(options)); +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.normalizeAssetPath = function (assetRef, assetName, autoCorrect) { + return this.$normalize_asset_path(assetRef, assetName, autoCorrect); +}; + +// Document API + +/** + * The {@link Document} class represents a parsed AsciiDoc document. + * + * Document is the root node of a parsed AsciiDoc document.
    + * It provides an abstract syntax tree (AST) that represents the structure of the AsciiDoc document + * from which the Document object was parsed. + * + * Although the constructor can be used to create an empty document object, + * more commonly, you'll load the document object from AsciiDoc source + * using the primary API methods on {@link Asciidoctor}. + * When using one of these APIs, you almost always want to set the safe mode to 'safe' (or 'unsafe') + * to enable all of Asciidoctor's features. + * + *
    + *   var doc = Asciidoctor.load('= Hello, AsciiDoc!', {'safe': 'safe'});
    + *   // => Asciidoctor::Document { doctype: "article", doctitle: "Hello, Asciidoc!", blocks: 0 }
    + * 
    + * + * Instances of this class can be used to extract information from the document or alter its structure. + * As such, the Document object is most often used in extensions and by integrations. + * + * The most basic usage of the Document object is to retrieve the document's title. + * + *
    + *  var source = '= Document Title';
    + *  var doc = asciidoctor.load(source, {'safe': 'safe'});
    + *  console.log(doc.getTitle()); // 'Document Title'
    + * 
    + * + * You can also use the Document object to access document attributes defined in the header, such as the author and doctype. + * @namespace + * @extends AbstractBlock + */ + +var Document = Opal.Asciidoctor.Document; + +/** + * Returns a JSON {Object} of ids captured by the processor. + * + * @returns {Object} - returns a JSON {Object} of ids in the document. + * @memberof Document + */ +Document.prototype.getIds = function () { + return fromHash(this.catalog.$$smap.ids); +}; + +/** + * Returns a JSON {Object} of references captured by the processor. + * + * @returns {Object} - returns a JSON {Object} of {AbstractNode} in the document. + * @memberof Document + */ +Document.prototype.getRefs = function () { + return fromHash(this.catalog.$$smap.refs); +}; + +/** + * Returns an {Array} of Document/ImageReference} captured by the processor. + * + * @returns {Array} - returns an {Array} of {Document/ImageReference} in the document. + * Will return an empty array if the option "catalog_assets: true" was not defined on the processor. + * @memberof Document + */ +Document.prototype.getImages = function () { + return this.catalog.$$smap.images; +}; + +/** + * Returns an {Array} of index terms captured by the processor. + * + * @returns {Array} - returns an {Array} of index terms in the document. + * Will return an empty array if the function was called before the document was converted. + * @memberof Document + */ +Document.prototype.getIndexTerms = function () { + return this.catalog.$$smap.indexterms; +}; + +/** + * Returns an {Array} of links captured by the processor. + * + * @returns {Array} - returns an {Array} of links in the document. + * Will return an empty array if: + * - the function was called before the document was converted + * - the option "catalog_assets: true" was not defined on the processor + * @memberof Document + */ +Document.prototype.getLinks = function () { + return this.catalog.$$smap.links; +}; + +/** + * @returns {boolean} - returns true if the document has footnotes otherwise false + * @memberof Document + */ +Document.prototype.hasFootnotes = function () { + return this['$footnotes?'](); +}; + +/** + * Returns an {Array} of {Document/Footnote} captured by the processor. + * + * @returns {Array} - returns an {Array} of {Document/Footnote} in the document. + * Will return an empty array if the function was called before the document was converted. + * @memberof Document + */ +Document.prototype.getFootnotes = function () { + return this.$footnotes(); +}; + +/** + * @returns {string} - returns the level-0 section + * @memberof Document + */ +Document.prototype.getHeader = function () { + return this.header; +}; + +/** + * @memberof Document + */ +Document.prototype.setAttribute = function (name, value) { + return this.$set_attribute(name, value); +}; + +/** + + * @memberof Document + */ +Document.prototype.removeAttribute = function (name) { + this.attributes.$delete(name); + this.attribute_overrides.$delete(name); +}; + +/** + * @memberof Document + */ +Document.prototype.convert = function (options) { + var result = this.$convert(toHash(options)); + return result === Opal.nil ? '' : result; +}; + +/** + * @memberof Document + */ +Document.prototype.write = function (output, target) { + return this.$write(output, target); +}; + +/** + * @returns {string} - returns the full name of the author as a String + * @memberof Document + */ +Document.prototype.getAuthor = function () { + return this.$author(); +}; + +/** + * @memberof Document + */ +Document.prototype.getSource = function () { + return this.$source(); +}; + +/** + * @memberof Document + */ +Document.prototype.getSourceLines = function () { + return this.$source_lines(); +}; + +/** + * @memberof Document + */ +Document.prototype.isNested = function () { + return this['$nested?'](); +}; + +/** + * @memberof Document + */ +Document.prototype.isEmbedded = function () { + return this['$embedded?'](); +}; + +/** + * @memberof Document + */ +Document.prototype.hasExtensions = function () { + return this['$extensions?'](); +}; + +/** + * @memberof Document + */ +Document.prototype.getDoctype = function () { + return this.doctype; +}; + +/** + * @memberof Document + */ +Document.prototype.getBackend = function () { + return this.backend; +}; + +/** + * @memberof Document + */ +Document.prototype.isBasebackend = function (base) { + return this['$basebackend?'](base); +}; + +/** + * Get the title explicitly defined in the document attributes. + * @returns {string} + * @see {@link AbstractNode#getAttributes} + * @memberof Document + */ +Document.prototype.getTitle = function () { + var title = this.$title(); + return title === Opal.nil ? undefined : title; +}; + +/** + * @memberof Document + */ +Document.prototype.setTitle = function (title) { + return this['$title='](title); +}; + +/** + * @memberof Document + * @returns {Document/Title} - returns a {@link Document/Title} + */ +Document.prototype.getDocumentTitle = function (options) { + var doctitle = this.$doctitle(toHash(options)); + return doctitle === Opal.nil ? undefined : doctitle; +}; + +/** + * @memberof Document + * @see {@link Document#getDocumentTitle} + */ +Document.prototype.getDoctitle = Document.prototype.getDocumentTitle; + +/** + * Get the document catalog Hash. + * @memberof Document + */ +Document.prototype.getCatalog = function () { + return fromHash(this.catalog); +}; + +/** + * @memberof Document + */ +Document.prototype.getReferences = Document.prototype.getCatalog; + +/** + * Get the document revision date from document header (document attribute revdate). + * @memberof Document + */ +Document.prototype.getRevisionDate = function () { + return this.getAttribute('revdate'); +}; + +/** + * @memberof Document + * @see Document#getRevisionDate + */ +Document.prototype.getRevdate = function () { + return this.getRevisionDate(); +}; + +/** + * Get the document revision number from document header (document attribute revnumber). + * @memberof Document + */ +Document.prototype.getRevisionNumber = function () { + return this.getAttribute('revnumber'); +}; + +/** + * Get the document revision remark from document header (document attribute revremark). + * @memberof Document + */ +Document.prototype.getRevisionRemark = function () { + return this.getAttribute('revremark'); +}; + + +/** + * Assign a value to the specified attribute in the document header. + * + * The assignment will be visible when the header attributes are restored, + * typically between processor phases (e.g., between parse and convert). + * + * @param {string} name - The {string} attribute name to assign + * @param {Object} value - The {Object} value to assign to the attribute (default: '') + * @param {boolean} overwrite - A {boolean} indicating whether to assign the attribute + * if already present in the attributes Hash (default: true) + * + * @memberof Document + * @returns {boolean} - returns true if the assignment was performed otherwise false + */ +Document.prototype.setHeaderAttribute = function (name, value, overwrite) { + if (typeof overwrite === 'undefined') overwrite = true; + if (typeof value === 'undefined') value = ''; + return this.$set_header_attribute(name, value, overwrite); +}; + +/** + * Convenience method to retrieve the authors of this document as an {Array} of {Document/Author} objects. + * + * This method is backed by the author-related attributes on the document. + * + * @memberof Document + * @returns {Array} - returns an {Array} of {Document/Author} objects. + */ +Document.prototype.getAuthors = function () { + return this.$authors(); +}; + +// Document.Footnote API + +/** + * @namespace + * @module Document/Footnote + */ +var Footnote = Document.Footnote; + +/** + * @memberof Document/Footnote + * @returns {number} - returns the footnote's index + */ +Footnote.prototype.getIndex = function () { + var index = this.$$data.index; + return index === Opal.nil ? undefined : index; +}; + +/** + * @memberof Document/Footnote + * @returns {string} - returns the footnote's id + */ +Footnote.prototype.getId = function () { + var id = this.$$data.id; + return id === Opal.nil ? undefined : id; +}; + +/** + * @memberof Document/Footnote + * @returns {string} - returns the footnote's text + */ +Footnote.prototype.getText = function () { + var text = this.$$data.text; + return text === Opal.nil ? undefined : text; +}; + +// Document.ImageReference API + +/** + * @namespace + * @module Document/ImageReference + */ +var ImageReference = Document.ImageReference; + +/** + * @memberof Document/ImageReference + * @returns {string} - returns the image's target + */ +ImageReference.prototype.getTarget = function () { + return this.$$data.target; +}; + +/** + * @memberof Document/ImageReference + * @returns {string} - returns the image's directory (imagesdir attribute) + */ +ImageReference.prototype.getImagesDirectory = function () { + var value = this.$$data.imagesdir; + return value === Opal.nil ? undefined : value; +}; + +// Document.Author API + +/** + * @namespace + * @module Document/Author + */ +var Author = Document.Author; + +/** + * @memberof Document/Author + * @returns {string} - returns the author's full name + */ +Author.prototype.getName = function () { + var name = this.$$data.name; + return name === Opal.nil ? undefined : name; +}; + +/** + * @memberof Document/Author + * @returns {string} - returns the author's first name + */ +Author.prototype.getFirstName = function () { + var firstName = this.$$data.firstname; + return firstName === Opal.nil ? undefined : firstName; +}; + +/** + * @memberof Document/Author + * @returns {string} - returns the author's middle name (or undefined if the author has no middle name) + */ +Author.prototype.getMiddleName = function () { + var middleName = this.$$data.middlename; + return middleName === Opal.nil ? undefined : middleName; +}; + +/** + * @memberof Document/Author + * @returns {string} - returns the author's last name + */ +Author.prototype.getLastName = function () { + var lastName = this.$$data.lastname; + return lastName === Opal.nil ? undefined : lastName; +}; + +/** + * @memberof Document/Author + * @returns {string} - returns the author's initials (by default based on the author's name) + */ +Author.prototype.getInitials = function () { + var initials = this.$$data.initials; + return initials === Opal.nil ? undefined : initials; +}; + +/** + * @memberof Document/Author + * @returns {string} - returns the author's email + */ +Author.prototype.getEmail = function () { + var email = this.$$data.email; + return email === Opal.nil ? undefined : email; +}; + +// private constructor +Document.RevisionInfo = function (date, number, remark) { + this.date = date; + this.number = number; + this.remark = remark; +}; + +/** + * @class + * @namespace + * @module Document/RevisionInfo + */ +var RevisionInfo = Document.RevisionInfo; + +/** + * Get the document revision date from document header (document attribute revdate). + * @memberof Document/RevisionInfo + */ +RevisionInfo.prototype.getDate = function () { + return this.date; +}; + +/** + * Get the document revision number from document header (document attribute revnumber). + * @memberof Document/RevisionInfo + */ +RevisionInfo.prototype.getNumber = function () { + return this.number; +}; + +/** + * Get the document revision remark from document header (document attribute revremark). + * A short summary of changes in this document revision. + * @memberof Document/RevisionInfo + */ +RevisionInfo.prototype.getRemark = function () { + return this.remark; +}; + +/** + * @memberof Document/RevisionInfo + * @returns {boolean} - returns true if the revision info is empty (ie. not defined), otherwise false + */ +RevisionInfo.prototype.isEmpty = function () { + return this.date === undefined && this.number === undefined && this.remark === undefined; +}; + +/** + * @memberof Document + * @returns {Document/RevisionInfo} - returns a {@link Document/RevisionInfo} + */ +Document.prototype.getRevisionInfo = function () { + return new Document.RevisionInfo(this.getRevisionDate(), this.getRevisionNumber(), this.getRevisionRemark()); +}; + +/** + * @memberof Document + * @returns {boolean} - returns true if the document contains revision info, otherwise false + */ +Document.prototype.hasRevisionInfo = function () { + var revisionInfo = this.getRevisionInfo(); + return !revisionInfo.isEmpty(); +}; + +/** + * @memberof Document + */ +Document.prototype.getNotitle = function () { + return this.$notitle(); +}; + +/** + * @memberof Document + */ +Document.prototype.getNoheader = function () { + return this.$noheader(); +}; + +/** + * @memberof Document + */ +Document.prototype.getNofooter = function () { + return this.$nofooter(); +}; + +/** + * @memberof Document + */ +Document.prototype.hasHeader = function () { + return this['$header?'](); +}; + +/** + * @memberof Document + */ +Document.prototype.deleteAttribute = function (name) { + return this.$delete_attribute(name); +}; + +/** + * @memberof Document + */ +Document.prototype.isAttributeLocked = function (name) { + return this['$attribute_locked?'](name); +}; + +/** + * @memberof Document + */ +Document.prototype.parse = function (data) { + return this.$parse(data); +}; + +/** + * @memberof Document + */ +Document.prototype.getDocinfo = function (docinfoLocation, suffix) { + return this.$docinfo(docinfoLocation, suffix); +}; + +/** + * @memberof Document + */ +Document.prototype.hasDocinfoProcessors = function (docinfoLocation) { + return this['$docinfo_processors?'](docinfoLocation); +}; + +/** + * @memberof Document + */ +Document.prototype.counterIncrement = function (counterName, block) { + return this.$counter_increment(counterName, block); +}; + +/** + * @memberof Document + */ +Document.prototype.counter = function (name, seed) { + return this.$counter(name, seed); +}; + +/** + * @memberof Document + */ +Document.prototype.getSafe = function () { + return this.safe; +}; + +/** + * @memberof Document + */ +Document.prototype.getCompatMode = function () { + return this.compat_mode; +}; + +/** + * @memberof Document + */ +Document.prototype.getSourcemap = function () { + return this.sourcemap; +}; + +/** + * @memberof Document + */ +Document.prototype.getCounters = function () { + return fromHash(this.counters); +}; + +/** + * @memberof Document + */ +Document.prototype.getCallouts = function () { + return this.$callouts(); +}; + +/** + * @memberof Document + */ +Document.prototype.getBaseDir = function () { + return this.base_dir; +}; + +/** + * @memberof Document + */ +Document.prototype.getOptions = function () { + return fromHash(this.options); +}; + +/** + * @memberof Document + */ +Document.prototype.getOutfilesuffix = function () { + return this.outfilesuffix; +}; + +/** + * @memberof Document + */ +Document.prototype.getParentDocument = function () { + return this.parent_document; +}; + +/** + * @memberof Document + */ +Document.prototype.getReader = function () { + return this.reader; +}; + +/** + * @memberof Document + */ +Document.prototype.getConverter = function () { + return this.converter; +}; + +/** + * @memberof Document + */ +Document.prototype.getExtensions = function () { + return this.extensions; +}; + +// Document.Title API + +/** + * @namespace + * @module Document/Title + */ +var Title = Document.Title; + +/** + * @memberof Document/Title + */ +Title.prototype.getMain = function () { + return this.main; +}; + +/** + * @memberof Document/Title + */ +Title.prototype.getCombined = function () { + return this.combined; +}; + +/** + * @memberof Document/Title + */ +Title.prototype.getSubtitle = function () { + var subtitle = this.subtitle; + return subtitle === Opal.nil ? undefined : subtitle; +}; + +/** + * @memberof Document/Title + */ +Title.prototype.isSanitized = function () { + var sanitized = this['$sanitized?'](); + return sanitized === Opal.nil ? false : sanitized; +}; + +/** + * @memberof Document/Title + */ +Title.prototype.hasSubtitle = function () { + return this['$subtitle?'](); +}; + +// Inline API + +/** + * @namespace + * @extends AbstractNode + */ +var Inline = Opal.Asciidoctor.Inline; + +/** + * Create a new Inline element. + * + * @memberof Inline + * @returns {Inline} - returns a new Inline element + */ +Opal.Asciidoctor.Inline['$$class'].prototype.create = function (parent, context, text, opts) { + return this.$new(parent, context, text, toHash(opts)); +}; + +/** + * Get the converted content for this inline node. + * + * @memberof Inline + * @returns {string} - returns the converted String content for this inline node + */ +Inline.prototype.convert = function () { + return this.$convert(); +}; + +/** + * Get the converted String text of this Inline node, if applicable. + * + * @memberof Inline + * @returns {string} - returns the converted String text for this Inline node, or undefined if not applicable for this node. + */ +Inline.prototype.getText = function () { + var text = this.$text(); + return text === Opal.nil ? undefined : text; +}; + +/** + * Get the String sub-type (aka qualifier) of this Inline node. + * + * This value is used to distinguish different variations of the same node + * category, such as different types of anchors. + * + * @memberof Inline + * @returns {string} - returns the string sub-type of this Inline node. + */ +Inline.prototype.getType = function () { + return this.$type(); +}; + +/** + * Get the primary String target of this Inline node. + * + * @memberof Inline + * @returns {string} - returns the string target of this Inline node. + */ +Inline.prototype.getTarget = function () { + var target = this.$target(); + return target === Opal.nil ? undefined : target; +}; + +// List API + +/** @namespace */ +var List = Opal.Asciidoctor.List; + +/** + * Get the Array of {@link ListItem} nodes for this {@link List}. + * + * @memberof List + * @returns {Array} - returns an Array of {@link ListItem} nodes. + */ +List.prototype.getItems = function () { + return this.blocks; +}; + +// ListItem API + +/** @namespace */ +var ListItem = Opal.Asciidoctor.ListItem; + +/** + * Get the converted String text of this ListItem node. + * + * @memberof ListItem + * @returns {string} - returns the converted String text for this ListItem node. + */ +ListItem.prototype.getText = function () { + return this.$text(); +}; + +/** + * Set the String source text of this ListItem node. + * + * @memberof ListItem + */ +ListItem.prototype.setText = function (text) { + return this.text = text; +}; + +// Reader API + +/** @namespace */ +var Reader = Opal.Asciidoctor.Reader; + +/** + * @memberof Reader + */ +Reader.prototype.pushInclude = function (data, file, path, lineno, attributes) { + return this.$push_include(data, file, path, lineno, toHash(attributes)); +}; + +/** + * Get the current location of the reader's cursor, which encapsulates the + * file, dir, path, and lineno of the file being read. + * + * @memberof Reader + */ +Reader.prototype.getCursor = function () { + return this.$cursor(); +}; + +/** + * Get a copy of the remaining {Array} of String lines managed by this Reader. + * + * @memberof Reader + * @returns {Array} - returns A copy of the String {Array} of lines remaining in this Reader. + */ +Reader.prototype.getLines = function () { + return this.$lines(); +}; + +/** + * Get the remaining lines managed by this Reader as a String. + * + * @memberof Reader + * @returns {string} - returns The remaining lines managed by this Reader as a String (joined by linefeed characters). + */ +Reader.prototype.getString = function () { + return this.$string(); +}; + +// Cursor API + +/** @namespace */ +var Cursor = Opal.Asciidoctor.Reader.Cursor; + +/** + * Get the file associated to the cursor. + * @memberof Cursor + */ +Cursor.prototype.getFile = function () { + var file = this.file; + return file === Opal.nil ? undefined : file; +}; + +/** + * Get the directory associated to the cursor. + * @memberof Cursor + * @returns {string} - returns the directory associated to the cursor + */ +Cursor.prototype.getDirectory = function () { + var dir = this.dir; + return dir === Opal.nil ? undefined : dir; +}; + +/** + * Get the path associated to the cursor. + * @memberof Cursor + * @returns {string} - returns the path associated to the cursor (or '') + */ +Cursor.prototype.getPath = function () { + var path = this.path; + return path === Opal.nil ? undefined : path; +}; + +/** + * Get the line number of the cursor. + * @memberof Cursor + * @returns {number} - returns the line number of the cursor + */ +Cursor.prototype.getLineNumber = function () { + return this.lineno; +}; + +// Logger API (available in Asciidoctor 1.5.7+) + +function initializeLoggerFormatterClass (className, functions) { + var superclass = Opal.const_get_qualified(Opal.Logger, 'Formatter'); + return initializeClass(superclass, className, functions, {}, { + 'call': function (args) { + for (var i = 0; i < args.length; i++) { + // convert all (Opal) Hash arguments to JSON. + if (typeof args[i] === 'object' && '$$smap' in args[i]) { + args[i] = fromHash(args[i]); + } + } + return args; + } + }); +} + +function initializeLoggerClass (className, functions) { + var superClass = Opal.const_get_qualified(Opal.Asciidoctor, 'Logger'); + return initializeClass(superClass, className, functions, {}, { + 'add': function (args) { + if (args.length >= 2 && typeof args[2] === 'object' && '$$smap' in args[2]) { + var message = args[2]; + var messageObject = fromHash(message); + messageObject.getText = function () { + return this['text']; + }; + messageObject.getSourceLocation = function () { + return this['source_location']; + }; + messageObject['$inspect'] = function () { + var sourceLocation = this.getSourceLocation(); + if (sourceLocation) { + return sourceLocation.getPath() + ': line ' + sourceLocation.getLineNumber() + ': ' + this.getText(); + } else { + return this.getText(); + } + }; + args[2] = messageObject; + } + return args; + } + }); +} + +/** + * @namespace + */ +var LoggerManager = Opal.const_get_qualified(Opal.Asciidoctor, 'LoggerManager', true); + +// Alias +Opal.Asciidoctor.LoggerManager = LoggerManager; + +if (LoggerManager) { + LoggerManager.getLogger = function () { + return this.$logger(); + }; + + LoggerManager.setLogger = function (logger) { + this.logger = logger; + }; + + LoggerManager.newLogger = function (name, functions) { + return initializeLoggerClass(name, functions).$new(); + }; + + LoggerManager.newFormatter = function (name, functions) { + return initializeLoggerFormatterClass(name, functions).$new(); + }; +} + +/** + * @namespace + */ +var LoggerSeverity = Opal.const_get_qualified(Opal.Logger, 'Severity', true); + +// Alias +Opal.Asciidoctor.LoggerSeverity = LoggerSeverity; + +if (LoggerSeverity) { + LoggerSeverity.get = function (severity) { + return LoggerSeverity.$constants()[severity]; + }; +} + +/** + * @namespace + */ +var LoggerFormatter = Opal.const_get_qualified(Opal.Logger, 'Formatter', true); + + +// Alias +Opal.Asciidoctor.LoggerFormatter = LoggerFormatter; + +if (LoggerFormatter) { + LoggerFormatter.prototype.call = function (severity, time, programName, message) { + return this.$call(LoggerSeverity.get(severity), time, programName, message); + }; +} + +/** + * @namespace + */ +var MemoryLogger = Opal.const_get_qualified(Opal.Asciidoctor, 'MemoryLogger', true); + +// Alias +Opal.Asciidoctor.MemoryLogger = MemoryLogger; + +if (MemoryLogger) { + MemoryLogger.prototype.getMessages = function () { + var messages = this.messages; + var result = []; + for (var i = 0; i < messages.length; i++) { + var message = messages[i]; + var messageObject = fromHash(message); + if (typeof messageObject.message === 'string') { + messageObject.getText = function () { + return this.message; + }; + } else { + // also convert the message attribute + messageObject.message = fromHash(messageObject.message); + messageObject.getText = function () { + return this.message['text']; + }; + } + messageObject.getSeverity = function () { + return this.severity.toString(); + }; + messageObject.getSourceLocation = function () { + return this.message['source_location']; + }; + result.push(messageObject); + } + return result; + }; +} + +/** + * @namespace + */ +var Logger = Opal.const_get_qualified(Opal.Asciidoctor, 'Logger', true); + +// Alias +Opal.Asciidoctor.Logger = Logger; + +if (Logger) { + Logger.prototype.getMaxSeverity = function () { + return this.max_severity; + }; + Logger.prototype.getFormatter = function () { + return this.formatter; + }; + Logger.prototype.setFormatter = function (formatter) { + return this.formatter = formatter; + }; + Logger.prototype.getLevel = function () { + return this.level; + }; + Logger.prototype.setLevel = function (level) { + return this.level = level; + }; + Logger.prototype.getProgramName = function () { + return this.progname; + }; + Logger.prototype.setProgramName = function (programName) { + return this.progname = programName; + }; +} + +/** + * @namespace + */ +var NullLogger = Opal.const_get_qualified(Opal.Asciidoctor, 'NullLogger', true); + +// Alias +Opal.Asciidoctor.NullLogger = NullLogger; + + +if (NullLogger) { + NullLogger.prototype.getMaxSeverity = function () { + return this.max_severity; + }; +} + + +// Alias +Opal.Asciidoctor.StopIteration = Opal.StopIteration; + +// Extensions API + +/** + * @private + */ +var toBlock = function (block) { + // arity is a mandatory field + block.$$arity = block.length; + return block; +}; + +var registerExtension = function (registry, type, processor, name) { + if (typeof processor === 'object' || processor.$$is_class) { + // processor is an instance or a class + return registry['$' + type](processor, name); + } else { + // processor is a function/lambda + return Opal.send(registry, type, name && [name], toBlock(processor)); + } +}; + +/** + * @namespace + * @description + * Extensions provide a way to participate in the parsing and converting + * phases of the AsciiDoc processor or extend the AsciiDoc syntax. + * + * The various extensions participate in AsciiDoc processing as follows: + * + * 1. After the source lines are normalized, {{@link Extensions/Preprocessor}}s modify or replace + * the source lines before parsing begins. {{@link Extensions/IncludeProcessor}}s are used to + * process include directives for targets which they claim to handle. + * 2. The Parser parses the block-level content into an abstract syntax tree. + * Custom blocks and block macros are processed by associated {{@link Extensions/BlockProcessor}}s + * and {{@link Extensions/BlockMacroProcessor}}s, respectively. + * 3. {{@link Extensions/TreeProcessor}}s are run on the abstract syntax tree. + * 4. Conversion of the document begins, at which point inline markup is processed + * and converted. Custom inline macros are processed by associated {InlineMacroProcessor}s. + * 5. {{@link Extensions/Postprocessor}}s modify or replace the converted document. + * 6. The output is written to the output stream. + * + * Extensions may be registered globally using the {Extensions.register} method + * or added to a custom {Registry} instance and passed as an option to a single + * Asciidoctor processor. + * + * @example + * Opal.Asciidoctor.Extensions.register(function () { + * this.block(function () { + * var self = this; + * self.named('shout'); + * self.onContext('paragraph'); + * self.process(function (parent, reader) { + * var lines = reader.getLines().map(function (l) { return l.toUpperCase(); }); + * return self.createBlock(parent, 'paragraph', lines); + * }); + * }); + * }); + */ +var Extensions = Opal.const_get_qualified(Opal.Asciidoctor, 'Extensions'); + +// Alias +Opal.Asciidoctor.Extensions = Extensions; + +/** + * Create a new {@link Extensions/Registry}. + * @param {string} name + * @param {function} block + * @memberof Extensions + * @returns {Extensions/Registry} - returns a {@link Extensions/Registry} + */ +Extensions.create = function (name, block) { + if (typeof name === 'function' && typeof block === 'undefined') { + return Opal.send(this, 'build_registry', null, toBlock(name)); + } else if (typeof block === 'function') { + return Opal.send(this, 'build_registry', [name], toBlock(block)); + } else { + return this.$build_registry(); + } +}; + +/** + * @memberof Extensions + */ +Extensions.register = function (name, block) { + if (typeof name === 'function' && typeof block === 'undefined') { + return Opal.send(this, 'register', null, toBlock(name)); + } else { + return Opal.send(this, 'register', [name], toBlock(block)); + } +}; + +/** + * Get statically-registerd extension groups. + * @memberof Extensions + */ +Extensions.getGroups = function () { + return fromHash(this.$groups()); +}; + +/** + * Unregister all statically-registered extension groups. + * @memberof Extensions + */ +Extensions.unregisterAll = function () { + this.$unregister_all(); +}; + +/** + * Unregister the specified statically-registered extension groups. + * + * NOTE Opal cannot delete an entry from a Hash that is indexed by symbol, so + * we have to resort to using low-level operations in this method. + * + * @memberof Extensions + */ +Extensions.unregister = function () { + var names = Array.prototype.concat.apply([], arguments); + var groups = this.$groups(); + var groupNameIdx = {}; + for (var i = 0, groupSymbolNames = groups.$$keys; i < groupSymbolNames.length; i++) { + var groupSymbolName = groupSymbolNames[i]; + groupNameIdx[groupSymbolName.toString()] = groupSymbolName; + } + for (var j = 0; j < names.length; j++) { + var groupStringName = names[j]; + if (groupStringName in groupNameIdx) Opal.hash_delete(groups, groupNameIdx[groupStringName]); + } +}; + +/** + * @namespace + * @module Extensions/Registry + */ +var Registry = Extensions.Registry; + +/** + * @memberof Extensions/Registry + */ +Registry.prototype.getGroups = Extensions.getGroups; + +/** + * @memberof Extensions/Registry + */ +Registry.prototype.unregisterAll = function () { + this.groups = Opal.hash(); +}; + +/** + * @memberof Extensions/Registry + */ +Registry.prototype.unregister = Extensions.unregister; + +/** + * @memberof Extensions/Registry + */ +Registry.prototype.prefer = function (name, processor) { + if (arguments.length === 1) { + processor = name; + name = null; + } + if (typeof processor === 'object' || processor.$$is_class) { + // processor is an instance or a class + return this['$prefer'](name, processor); + } else { + // processor is a function/lambda + return Opal.send(this, 'prefer', name && [name], toBlock(processor)); + } +}; + +/** + * @memberof Extensions/Registry + */ +Registry.prototype.block = function (name, processor) { + if (arguments.length === 1) { + processor = name; + name = null; + } + return registerExtension(this, 'block', processor, name); +}; + +/** + * @memberof Extensions/Registry + */ +Registry.prototype.inlineMacro = function (name, processor) { + if (arguments.length === 1) { + processor = name; + name = null; + } + return registerExtension(this, 'inline_macro', processor, name); +}; + +/** + * @memberof Extensions/Registry + */ +Registry.prototype.includeProcessor = function (name, processor) { + if (arguments.length === 1) { + processor = name; + name = null; + } + return registerExtension(this, 'include_processor', processor, name); +}; + +/** + * @memberof Extensions/Registry + */ +Registry.prototype.blockMacro = function (name, processor) { + if (arguments.length === 1) { + processor = name; + name = null; + } + return registerExtension(this, 'block_macro', processor, name); +}; + +/** + * @memberof Extensions/Registry + */ +Registry.prototype.treeProcessor = function (name, processor) { + if (arguments.length === 1) { + processor = name; + name = null; + } + return registerExtension(this, 'tree_processor', processor, name); +}; + +/** + * @memberof Extensions/Registry + */ +Registry.prototype.postprocessor = function (name, processor) { + if (arguments.length === 1) { + processor = name; + name = null; + } + return registerExtension(this, 'postprocessor', processor, name); +}; + +/** + * @memberof Extensions/Registry + */ +Registry.prototype.preprocessor = function (name, processor) { + if (arguments.length === 1) { + processor = name; + name = null; + } + return registerExtension(this, 'preprocessor', processor, name); +}; + +/** + * @memberof Extensions/Registry + */ + +Registry.prototype.docinfoProcessor = function (name, processor) { + if (arguments.length === 1) { + processor = name; + name = null; + } + return registerExtension(this, 'docinfo_processor', processor, name); +}; + +/** + * @namespace + * @module Extensions/Processor + */ +var Processor = Extensions.Processor; + +/** + * The extension will be added to the beginning of the list for that extension type. (default is append). + * @memberof Extensions/Processor + * @deprecated Please use the prefer function on the {@link Extensions/Registry}, + * the {@link Extensions/IncludeProcessor}, + * the {@link Extensions/TreeProcessor}, + * the {@link Extensions/Postprocessor}, + * the {@link Extensions/Preprocessor} + * or the {@link Extensions/DocinfoProcessor} + */ +Processor.prototype.prepend = function () { + this.$option('position', '>>'); +}; + +/** + * @memberof Extensions/Processor + */ +Processor.prototype.process = function (block) { + var handler = { + apply: function (target, thisArg, argumentsList) { + for (var i = 0; i < argumentsList.length; i++) { + // convert all (Opal) Hash arguments to JSON. + if (typeof argumentsList[i] === 'object' && '$$smap' in argumentsList[i]) { + argumentsList[i] = fromHash(argumentsList[i]); + } + } + return target.apply(thisArg, argumentsList); + } + }; + var blockProxy = new Proxy(block, handler); + return Opal.send(this, 'process', null, toBlock(blockProxy)); +}; + +/** + * @memberof Extensions/Processor + */ +Processor.prototype.named = function (name) { + return this.$named(name); +}; + +/** + * @memberof Extensions/Processor + */ +Processor.prototype.createBlock = function (parent, context, source, attrs, opts) { + return this.$create_block(parent, context, source, toHash(attrs), toHash(opts)); +}; + +/** + * Creates a list block node and links it to the specified parent. + * + * @param parent - The parent Block (Block, Section, or Document) of this new list block. + * @param {string} context - The list context (e.g., ulist, olist, colist, dlist) + * @param {Object} attrs - An object of attributes to set on this list block + * + * @memberof Extensions/Processor + */ +Processor.prototype.createList = function (parent, context, attrs) { + return this.$create_list(parent, context, toHash(attrs)); +}; + +/** + * Creates a list item node and links it to the specified parent. + * + * @param parent - The parent List of this new list item block. + * @param {string} text - The text of the list item. + * + * @memberof Extensions/Processor + */ +Processor.prototype.createListItem = function (parent, text) { + return this.$create_list_item(parent, text); +}; + +/** + * @memberof Extensions/Processor + */ +Processor.prototype.createImageBlock = function (parent, attrs, opts) { + return this.$create_image_block(parent, toHash(attrs), toHash(opts)); +}; + +/** + * @memberof Extensions/Processor + */ +Processor.prototype.createInline = function (parent, context, text, opts) { + if (opts && opts.attributes) { + opts.attributes = toHash(opts.attributes); + } + return this.$create_inline(parent, context, text, toHash(opts)); +}; + +/** + * @memberof Extensions/Processor + */ +Processor.prototype.parseContent = function (parent, content, attrs) { + return this.$parse_content(parent, content, attrs); +}; + +/** + * @memberof Extensions/Processor + */ +Processor.prototype.positionalAttributes = function (value) { + return this.$positional_attrs(value); +}; + +/** + * @memberof Extensions/Processor + */ +Processor.prototype.resolvesAttributes = function (args) { + return this.$resolves_attributes(args); +}; + +/** + * @namespace + * @module Extensions/BlockProcessor + */ +var BlockProcessor = Extensions.BlockProcessor; + +/** + * @memberof Extensions/BlockProcessor + */ +BlockProcessor.prototype.onContext = function (context) { + return this.$on_context(context); +}; + +/** + * @memberof Extensions/BlockProcessor + */ +BlockProcessor.prototype.onContexts = function () { + return this.$on_contexts(Array.prototype.slice.call(arguments)); +}; + +/** + * @memberof Extensions/BlockProcessor + */ +BlockProcessor.prototype.getName = function () { + var name = this.name; + return name === Opal.nil ? undefined : name; +}; + +/** + * @namespace + * @module Extensions/BlockMacroProcessor + */ +var BlockMacroProcessor = Extensions.BlockMacroProcessor; + +/** + * @memberof Extensions/BlockMacroProcessor + */ +BlockMacroProcessor.prototype.getName = function () { + var name = this.name; + return name === Opal.nil ? undefined : name; +}; + +/** + * @namespace + * @module Extensions/InlineMacroProcessor + */ +var InlineMacroProcessor = Extensions.InlineMacroProcessor; + +/** + * @memberof Extensions/InlineMacroProcessor + */ +InlineMacroProcessor.prototype.getName = function () { + var name = this.name; + return name === Opal.nil ? undefined : name; +}; + +/** + * @namespace + * @module Extensions/IncludeProcessor + */ +var IncludeProcessor = Extensions.IncludeProcessor; + +/** + * @memberof Extensions/IncludeProcessor + */ +IncludeProcessor.prototype.handles = function (block) { + return Opal.send(this, 'handles?', null, toBlock(block)); +}; + +/** + * @memberof Extensions/IncludeProcessor + */ +IncludeProcessor.prototype.prefer = function () { + this.$prefer(); +}; + +/** + * @namespace + * @module Extensions/TreeProcessor + */ +// eslint-disable-next-line no-unused-vars +var TreeProcessor = Extensions.TreeProcessor; + +/** + * @memberof Extensions/TreeProcessor + */ +TreeProcessor.prototype.prefer = function () { + this.$prefer(); +}; + +/** + * @namespace + * @module Extensions/Postprocessor + */ +// eslint-disable-next-line no-unused-vars +var Postprocessor = Extensions.Postprocessor; + +/** + * @memberof Extensions/Postprocessor + */ +Postprocessor.prototype.prefer = function () { + this.$prefer(); +}; + +/** + * @namespace + * @module Extensions/Preprocessor + */ +// eslint-disable-next-line no-unused-vars +var Preprocessor = Extensions.Preprocessor; + +/** + * @memberof Extensions/Preprocessor + */ +Preprocessor.prototype.prefer = function () { + this.$prefer(); +}; + +/** + * @namespace + * @module Extensions/DocinfoProcessor + */ +var DocinfoProcessor = Extensions.DocinfoProcessor; + +/** + * @memberof Extensions/DocinfoProcessor + */ +DocinfoProcessor.prototype.prefer = function () { + this.$prefer(); +}; + +/** + * @memberof Extensions/DocinfoProcessor + */ +DocinfoProcessor.prototype.atLocation = function (value) { + this.$at_location(value); +}; + +function initializeProcessorClass (superclassName, className, functions) { + var superClass = Opal.const_get_qualified(Extensions, superclassName); + return initializeClass(superClass, className, functions, { + 'handles?': function () { + return true; + } + }); +} + +// Postprocessor + +/** + * Create a postprocessor + * @description this API is experimental and subject to change + * @memberof Extensions + */ +Extensions.createPostprocessor = function (name, functions) { + if (arguments.length === 1) { + functions = name; + name = null; + } + return initializeProcessorClass('Postprocessor', name, functions); +}; + +/** + * Create and instantiate a postprocessor + * @description this API is experimental and subject to change + * @memberof Extensions + */ +Extensions.newPostprocessor = function (name, functions) { + if (arguments.length === 1) { + functions = name; + name = null; + } + return this.createPostprocessor(name, functions).$new(); +}; + +// Preprocessor + +/** + * Create a preprocessor + * @description this API is experimental and subject to change + * @memberof Extensions + */ +Extensions.createPreprocessor = function (name, functions) { + if (arguments.length === 1) { + functions = name; + name = null; + } + return initializeProcessorClass('Preprocessor', name, functions); +}; + +/** + * Create and instantiate a preprocessor + * @description this API is experimental and subject to change + * @memberof Extensions + */ +Extensions.newPreprocessor = function (name, functions) { + if (arguments.length === 1) { + functions = name; + name = null; + } + return this.createPreprocessor(name, functions).$new(); +}; + +// Tree Processor + +/** + * Create a tree processor + * @description this API is experimental and subject to change + * @memberof Extensions + */ +Extensions.createTreeProcessor = function (name, functions) { + if (arguments.length === 1) { + functions = name; + name = null; + } + return initializeProcessorClass('TreeProcessor', name, functions); +}; + +/** + * Create and instantiate a tree processor + * @description this API is experimental and subject to change + * @memberof Extensions + */ +Extensions.newTreeProcessor = function (name, functions) { + if (arguments.length === 1) { + functions = name; + name = null; + } + return this.createTreeProcessor(name, functions).$new(); +}; + +// Include Processor + +/** + * Create an include processor + * @description this API is experimental and subject to change + * @memberof Extensions + */ +Extensions.createIncludeProcessor = function (name, functions) { + if (arguments.length === 1) { + functions = name; + name = null; + } + return initializeProcessorClass('IncludeProcessor', name, functions); +}; + +/** + * Create and instantiate an include processor + * @description this API is experimental and subject to change + * @memberof Extensions + */ +Extensions.newIncludeProcessor = function (name, functions) { + if (arguments.length === 1) { + functions = name; + name = null; + } + return this.createIncludeProcessor(name, functions).$new(); +}; + +// Docinfo Processor + +/** + * Create a Docinfo processor + * @description this API is experimental and subject to change + * @memberof Extensions + */ +Extensions.createDocinfoProcessor = function (name, functions) { + if (arguments.length === 1) { + functions = name; + name = null; + } + return initializeProcessorClass('DocinfoProcessor', name, functions); +}; + +/** + * Create and instantiate a Docinfo processor + * @description this API is experimental and subject to change + * @memberof Extensions + */ +Extensions.newDocinfoProcessor = function (name, functions) { + if (arguments.length === 1) { + functions = name; + name = null; + } + return this.createDocinfoProcessor(name, functions).$new(); +}; + +// Block Processor + +/** + * Create a block processor + * @description this API is experimental and subject to change + * @memberof Extensions + */ +Extensions.createBlockProcessor = function (name, functions) { + if (arguments.length === 1) { + functions = name; + name = null; + } + return initializeProcessorClass('BlockProcessor', name, functions); +}; + +/** + * Create and instantiate a block processor + * @description this API is experimental and subject to change + * @memberof Extensions + */ +Extensions.newBlockProcessor = function (name, functions) { + if (arguments.length === 1) { + functions = name; + name = null; + } + return this.createBlockProcessor(name, functions).$new(); +}; + +// Inline Macro Processor + +/** + * Create an inline macro processor + * @description this API is experimental and subject to change + * @memberof Extensions + */ +Extensions.createInlineMacroProcessor = function (name, functions) { + if (arguments.length === 1) { + functions = name; + name = null; + } + return initializeProcessorClass('InlineMacroProcessor', name, functions); +}; + +/** + * Create and instantiate an inline macro processor + * @description this API is experimental and subject to change + * @memberof Extensions + */ +Extensions.newInlineMacroProcessor = function (name, functions) { + if (arguments.length === 1) { + functions = name; + name = null; + } + return this.createInlineMacroProcessor(name, functions).$new(); +}; + +// Block Macro Processor + +/** + * Create a block macro processor + * @description this API is experimental and subject to change + * @memberof Extensions + */ +Extensions.createBlockMacroProcessor = function (name, functions) { + if (arguments.length === 1) { + functions = name; + name = null; + } + return initializeProcessorClass('BlockMacroProcessor', name, functions); +}; + +/** + * Create and instantiate a block macro processor + * @description this API is experimental and subject to change + * @memberof Extensions + */ +Extensions.newBlockMacroProcessor = function (name, functions) { + if (arguments.length === 1) { + functions = name; + name = null; + } + return this.createBlockMacroProcessor(name, functions).$new(); +}; + +// Converter API + +/** + * @namespace + * @module Converter + */ +var Converter = Opal.const_get_qualified(Opal.Asciidoctor, 'Converter'); + +// Alias +Opal.Asciidoctor.Converter = Converter; + +/** + * Convert the specified node. + * + * @param {AbstractNode} node - the AbstractNode to convert + * @param {string} transform - an optional String transform that hints at + * which transformation should be applied to this node. + * @param {Object} opts - a JSON of options that provide additional hints about + * how to convert the node (default: {}) + * @returns the {Object} result of the conversion, typically a {string}. + * @memberof Converter + */ +Converter.prototype.convert = function (node, transform, opts) { + return this.$convert(node, transform, toHash(opts)); +}; + +// The built-in converter doesn't include Converter, so we have to force it +Converter.BuiltIn.prototype.convert = Converter.prototype.convert; + +// Converter Factory API + +/** + * @namespace + * @module Converter/Factory + */ +var ConverterFactory = Opal.Asciidoctor.Converter.Factory; + +// Alias +Opal.Asciidoctor.ConverterFactory = ConverterFactory; + +/** + * Register a custom converter in the global converter factory to handle conversion to the specified backends. + * If the backend value is an asterisk, the converter is used to handle any backend that does not have an explicit converter. + * + * @param converter - The Converter instance to register + * @param backends {Array} - A {string} {Array} of backend names that this converter should be registered to handle (optional, default: ['*']) + * @return {*} - Returns nothing + * @memberof Converter/Factory + */ +ConverterFactory.register = function (converter, backends) { + if (typeof converter === 'object' && typeof converter.$convert === 'undefined' && typeof converter.convert === 'function') { + Opal.def(converter, '$convert', converter.convert); + } + return this.$register(converter, backends); +}; + +/** + * Retrieves the singleton instance of the converter factory. + * + * @param {boolean} initialize - instantiate the singleton if it has not yet + * been instantiated. If this value is false and the singleton has not yet been + * instantiated, this method returns a fresh instance. + * @returns {Converter/Factory} an instance of the converter factory. + * @memberof Converter/Factory + */ +ConverterFactory.getDefault = function (initialize) { + return this.$default(initialize); +}; + +/** + * Create an instance of the converter bound to the specified backend. + * + * @param {string} backend - look for a converter bound to this keyword. + * @param {Object} opts - a JSON of options to pass to the converter (default: {}) + * @returns {Converter} - a converter instance for converting nodes in an Asciidoctor AST. + * @memberof Converter/Factory + */ +ConverterFactory.prototype.create = function (backend, opts) { + return this.$create(backend, toHash(opts)); +}; + +// Built-in converter + +/** + * @namespace + * @module Converter/Html5Converter + */ +var Html5Converter = Opal.Asciidoctor.Converter.Html5Converter; + +// Alias +Opal.Asciidoctor.Html5Converter = Html5Converter; + + +Html5Converter.prototype.convert = function (node, transform, opts) { + return this.$convert(node, transform, opts); +}; + + +var ASCIIDOCTOR_JS_VERSION = '1.5.9'; + + /** + * Get Asciidoctor.js version number. + * + * @memberof Asciidoctor + * @returns {string} - returns the version number of Asciidoctor.js. + */ + Asciidoctor.prototype.getVersion = function () { + return ASCIIDOCTOR_JS_VERSION; + }; + return Opal.Asciidoctor; +})); diff --git a/node_modules/asciidoctor.js/dist/asciidoctor.min.js b/node_modules/asciidoctor.js/dist/asciidoctor.min.js new file mode 100644 index 0000000..8216e67 --- /dev/null +++ b/node_modules/asciidoctor.js/dist/asciidoctor.min.js @@ -0,0 +1,1439 @@ +"undefined"===typeof Opal&&"object"===typeof module&&module.exports&&(Opal=require("opal-runtime").Opal); +if("undefined"===typeof Opal){var fundamentalObjects=[Function,Boolean,Error,Number,Date,String,RegExp,Array],backup={},index;for(index in fundamentalObjects){var fundamentalObject=fundamentalObjects[index];backup[fundamentalObject.name]={call:fundamentalObject.call,apply:fundamentalObject.apply,bind:fundamentalObject.bind}}(function(c){function u(a,b,c){"string"===typeof a?a[b]=c:Object.defineProperty(a,b,{value:c,enumerable:!1,configurable:!0,writable:!0})}function D(a,b){if(a)return a.$$const[b]} +function r(a,b){var c,e,g;if(null!=a)for(g=k.ancestors(a),c=0,e=g.length;c $coerce_to! $!= $[] $upcase".split(" "));return function(h,A){function x(){}var n=x=y(h,"Opal",x),m=[n].concat(A),w,H,M,u,a,e,k,q,v,g,B,b,F,p;c.defs(n,"$bridge",w=function(a,b){return c.bridge(a, +b)},w.$$arity=2);c.defs(n,"$type_error",H=function(a,b,c,e){var f;null==c&&(c=D);null==e&&(e=D);return l(l(f=c)?e:f)?r(m,"TypeError").$new("can't convert "+a.$class()+" into "+b+" ("+a.$class()+"#"+c+" gives "+e.$class()+")"):r(m,"TypeError").$new("no implicit conversion of "+a.$class()+" into "+b)},H.$$arity=-3);c.defs(n,"$coerce_to",M=function(a,b,c){if(l(b["$==="](a)))return a;l(a["$respond_to?"](c))||this.$raise(this.$type_error(a,b));return a.$__send__(c)},M.$$arity=3);c.defs(n,"$coerce_to!", +u=function(a,b,c){var e=D,e=this.$coerce_to(a,b,c);l(b["$==="](e))||this.$raise(this.$type_error(a,b,c,e));return e},u.$$arity=3);c.defs(n,"$coerce_to?",a=function(a,b,c){var e=D;if(!l(a["$respond_to?"](c)))return D;e=this.$coerce_to(a,b,c);if(l(e["$nil?"]()))return D;l(b["$==="](e))||this.$raise(this.$type_error(a,b,c,e));return e},a.$$arity=3);c.defs(n,"$try_convert",e=function(a,b,c){return l(b["$==="](a))?a:l(a["$respond_to?"](c))?a.$__send__(c):D},e.$$arity=3);c.defs(n,"$compare",k=function(a, +b){var c=D,c=a["$<=>"](b);l(c===D)&&this.$raise(r(m,"ArgumentError"),"comparison of "+a.$class()+" with "+b.$class()+" failed");return c},k.$$arity=2);c.defs(n,"$destructure",q=function(a){if(1==a.length)return a[0];if(a.$$is_array)return a;for(var b=Array(a.length),c=0,e=b.length;ca.length||"@@"!==a.slice(0,2))&&this.$raise(r(m,"NameError").$new("`"+a+"' is not allowed as a class variable name",a));return a}, +b.$$arity=1);c.defs(n,"$const_name!",F=function(a){a=r(m,"Opal")["$coerce_to!"](a,r(m,"String"),"to_str");l(a["$[]"](0)["$!="](a["$[]"](0).$upcase()))&&this.$raise(r(m,"NameError"),"wrong constant name "+a);return a},F.$$arity=1);c.defs(n,"$pristine",p=function(a,b){var e;e=c.slice.call(arguments,1,arguments.length);for(var d,f=e.length-1;0<=f;f--)d=e[f],(d=a.prototype["$"+d])&&!d.$$stub&&(d.$$pristine=!0);return D},p.$$arity=-2)}(u[0],u)};Opal.modules["corelib/module"]=function(c){function u(c,h){return"number"=== +typeof c&&"number"===typeof h?c $nil? $attr_reader $attr_writer $class_variable_name! $new $const_name! $=~ $inject $split $const_get $== $!~ $start_with? $bind $call $class $append_features $included $name $cover? $size $merge $compile $proc $any? $prepend_features $prepended $to_s $__id__ $constants $include? $copy_class_variables $copy_constants".split(" ")); +return function(H,$super,Q){function a(){}H=a=h(H,$super,"Module",a);var e=[H].concat(Q),k,q,v,g,B,b,F,p,N,P,z,d,f,ya,ja,Z,E,D,ha,ra,va,pa,L,t,za,ca,X,na,S,Y,U,fa,V,K,J,Ka,G,qa,la,Da,aa,ba,ma,sa,da,ea,R,Ea,Aa,Ba,wa,oa,Fa,Ua,Qa,xa,La,Ma,Ca;c.defs(H,"$allocate",k=function(){return c.allocate_module(r,function(){})},k.$$arity=0);c.defs(H,"$inherited",q=function(a){a.$allocate=function(){var b=c.allocate_module(r,function(){});Object.setPrototypeOf(b,a.prototype);return b}},q.$$arity=1);c.def(H,"$initialize", +v=function(){var a=v.$$p,b=a||r;a&&(v.$$p=null);a&&(v.$$p=null);return b!==r?A(this,"module_eval",[],b.$to_proc()):r},v.$$arity=0);c.def(H,"$===",g=function(a){return x(null==a)?!1:c.is_a(a,this)},g.$$arity=1);c.def(H,"$<",B=function(a){x(l(e,"Module")["$==="](a))||this.$raise(l(e,"TypeError"),"compared with non class/module");var b,d,f;if(this===a)return!1;d=0;b=c.ancestors(this);for(f=b.length;d",F=function(a){x(l(e,"Module")["$==="](a))||this.$raise(l(e,"TypeError"),"compared with non class/module");return u(a,this)},F.$$arity=1);c.def(H,"$>=",p=function(a){var b;return x(b=this["$equal?"](a))?b:"number"===typeof this&&"number"===typeof a?this>a:this["$>"](a)},p.$$arity=1);c.def(H,"$<=>",N=function(a){var b=r;if(this===a)return 0;if(!x(l(e,"Module")["$==="](a)))return r;b= +u(this,a);return x(b["$nil?"]())?r:x(b)?-1:1},N.$$arity=1);c.def(H,"$alias_method",P=function(a,b){c.alias(this,a,b);return this},P.$$arity=2);c.def(H,"$alias_native",z=function(a,b){null==b&&(b=a);c.alias_native(this,a,b);return this},z.$$arity=-2);c.def(H,"$ancestors",d=function(){return c.ancestors(this)},d.$$arity=0);c.def(H,"$append_features",f=function(a){c.append_features(this,a);return this},f.$$arity=1);c.def(H,"$attr_accessor",ya=function(a){var b;b=c.slice.call(arguments,0,arguments.length); +A(this,"attr_reader",c.to_a(b));return A(this,"attr_writer",c.to_a(b))},ya.$$arity=-1);c.alias(H,"attr","attr_accessor");c.def(H,"$attr_reader",ja=function(a){var b;b=c.slice.call(arguments,0,arguments.length);for(var e=this.prototype,d=b.length-1;0<=d;d--){var f=b[d],g="$"+f,f=c.ivar(f),k=function(a){return function(){return null==this[a]?r:this[a]}}(f);c.defineProperty(e,f,r);k.$$parameters=[];k.$$arity=0;c.defn(this,g,k)}return r},ja.$$arity=-1);c.def(H,"$attr_writer",Z=function(a){var b;b=c.slice.call(arguments, +0,arguments.length);for(var e=this.prototype,d=b.length-1;0<=d;d--){var f=b[d],g="$"+f+"=",f=c.ivar(f),k=function(a){return function(b){return this[a]=b}}(f);k.$$parameters=[["req"]];k.$$arity=1;c.defineProperty(e,f,r);c.defn(this,g,k)}return r},Z.$$arity=-1);c.def(H,"$autoload",E=function(a,b){null==this.$$autoload&&(this.$$autoload={});c.const_cache_version++;this.$$autoload[a]=b;return r},E.$$arity=2);c.def(H,"$class_variables",D=function(){return Object.keys(c.class_variables(this))},D.$$arity= +0);c.def(H,"$class_variable_get",ha=function(a){a=l(e,"Opal")["$class_variable_name!"](a);var b=c.class_variables(this)[a];null==b&&this.$raise(l(e,"NameError").$new("uninitialized class variable "+a+" in "+this,a));return b},ha.$$arity=1);c.def(H,"$class_variable_set",ra=function(a,b){a=l(e,"Opal")["$class_variable_name!"](a);return c.class_variable_set(this,a,b)},ra.$$arity=2);c.def(H,"$class_variable_defined?",va=function(a){a=l(e,"Opal")["$class_variable_name!"](a);return c.class_variables(this).hasOwnProperty(a)}, +va.$$arity=1);c.def(H,"$remove_class_variable",pa=function(a){a=l(e,"Opal")["$class_variable_name!"](a);if(c.hasOwnProperty.call(this.$$cvars,a)){var b=this.$$cvars[a];delete this.$$cvars[a];return b}this.$raise(l(e,"NameError"),"cannot remove "+a+" for "+this)},pa.$$arity=1);c.def(H,"$constants",L=function(a){null==a&&(a=!0);return c.constants(this,a)},L.$$arity=-1);c.defs(H,"$constants",t=function(a){if(null==a){a=(this.$$nesting||[]).concat(c.Object);var b,e={},d,f;d=0;for(f=a.length;d"},Ua.$$arity=0);c.def(H,"$undef_method",Qa=function(a){var b;b=c.slice.call(arguments,0,arguments.length);for(var e=0,d=b.length;e":a?"#>":h(this,c.find_super_dispatcher(this, +"to_s",q,!1),[],null)},q.$$arity=0),r)&&"to_s"}(D[0],null,D)};Opal.modules["corelib/basic_object"]=function(c){var u=[],D=c.nil,r=c.const_get_qualified,y=c.klass,l=c.truthy,h=c.range,A=c.hash2,x=c.send;c.add_stubs("$== $! $nil? $cover? $size $raise $merge $compile $proc $any? $inspect $new".split(" "));return function(n,$super,w){function H(){}n=H=y(n,$super,"BasicObject",H);[n].concat(w);var M,u,a,e,k,q,v,g,B,b,F,p,N,P;c.def(n,"$initialize",M=function(a){c.slice.call(arguments,0,arguments.length); +return D},M.$$arity=-1);c.def(n,"$==",u=function(a){return this===a},u.$$arity=1);c.def(n,"$eql?",a=function(a){return this["$=="](a)},a.$$arity=1);c.alias(n,"equal?","==");c.def(n,"$__id__",e=function(){if(null!=this.$$id)return this.$$id;c.defineProperty(this,"$$id",c.uid());return this.$$id},e.$$arity=0);c.def(n,"$__send__",k=function(a,b){var e=k.$$p,g=e||D;e&&(k.$$p=null);e&&(k.$$p=null);var e=c.slice.call(arguments,1,arguments.length),p=this["$"+a];if(p)return g!==D&&(p.$$p=g),p.apply(this, +e);g!==D&&(this.$method_missing.$$p=g);return this.$method_missing.apply(this,[a].concat(e))},k.$$arity=-2);c.def(n,"$!",q=function(){return!1},q.$$arity=0);c.def(n,"$!=",v=function(a){return this["$=="](a)["$!"]()},v.$$arity=1);c.def(n,"$instance_eval",g=function(a){var b=g.$$p,e=b||D,k,p,q=D,v=D,N=v=v=D;b&&(g.$$p=null);b&&(g.$$p=null);b=c.slice.call(arguments,0,arguments.length);l(l(k=e["$nil?"]())?!!c.compile:k)?(l(h(1,3,!1)["$cover?"](b.$size()))||r("::","Kernel").$raise(r("::","ArgumentError"), +"wrong number of arguments (0 for 1..3)"),k=[].concat(c.to_a(b)),q=null==k[0]?D:k[0],v=null==k[1]?D:k[1],k,v=A(["file","eval"],{file:l(k=v)?k:"(eval)",eval:!0}),v=c.hash({arity_check:!1}).$merge(v),N=r("::","Opal").$compile(q,v),e=x(r("::","Kernel"),"proc",[],(p=function(){return function(a){return eval(N)}(p.$$s||this)},p.$$s=this,p.$$arity=0,p))):l(b["$any?"]())&&r("::","Kernel").$raise(r("::","ArgumentError"),"wrong number of arguments ("+b.$size()+" for 0)");k=e.$$s;var F;e.$$s=null;if(this.$$is_a_module){this.$$eval= +!0;try{F=e.call(this,this)}finally{this.$$eval=!1}}else F=e.call(this,this);e.$$s=k;return F},g.$$arity=-1);c.def(n,"$instance_exec",B=function(a){var b=B.$$p,e=b||D;b&&(B.$$p=null);b&&(B.$$p=null);b=c.slice.call(arguments,0,arguments.length);l(e)||r("::","Kernel").$raise(r("::","ArgumentError"),"no block given");var g=e.$$s,k;e.$$s=null;if(this.$$is_a_module){this.$$eval=!0;try{k=e.apply(this,b)}finally{this.$$eval=!1}}else k=e.apply(this,b);e.$$s=g;return k},B.$$arity=-1);c.def(n,"$singleton_method_added", +b=function(a){c.slice.call(arguments,0,arguments.length);return D},b.$$arity=-1);c.def(n,"$singleton_method_removed",F=function(a){c.slice.call(arguments,0,arguments.length);return D},F.$$arity=-1);c.def(n,"$singleton_method_undefined",p=function(a){c.slice.call(arguments,0,arguments.length);return D},p.$$arity=-1);c.def(n,"$class",N=function(){return this.$$class},N.$$arity=0);return(c.def(n,"$method_missing",P=function(a,b){var e=P.$$p,g=D;e&&(P.$$p=null);e&&(P.$$p=null);c.slice.call(arguments, +1,arguments.length);g=l(this.$inspect&&!this.$inspect.$$stub)?"undefined method `"+a+"' for "+this.$inspect()+":"+this.$$class:"undefined method `"+a+"' for "+this.$$class;return r("::","Kernel").$raise(r("::","NoMethodError").$new(g,a))},P.$$arity=-2),D)&&"method_missing"}(u[0],null,u)};Opal.modules["corelib/kernel"]=function(c){function u(c,h){return"number"===typeof c&&"number"===typeof h?c<=h:c["$<="](h)}var D=[],r=c.nil,y=c.const_get_qualified,l=c.const_get_relative,h=c.module,A=c.truthy,x=c.gvars, +n=c.hash2,m=c.send,w=c.klass;c.add_stubs("$raise $new $inspect $! $=~ $== $object_id $class $coerce_to? $<< $allocate $copy_instance_variables $copy_singleton_methods $initialize_clone $initialize_copy $define_method $singleton_class $to_proc $initialize_dup $for $empty? $pop $call $coerce_to $append_features $extend_object $extended $length $respond_to? $[] $nil? $to_a $to_int $fetch $Integer $Float $to_ary $to_str $to_s $__id__ $instance_variable_name! $coerce_to! $=== $enum_for $result $any? $print $format $puts $each $<= $exception $is_a? $rand $respond_to_missing? $try_convert! $expand_path $join $start_with? $new_seed $srand $sym $arg $open $include".split(" ")); +(function(w,M){function Q(){}var a=Q=h(w,"Kernel",Q),e=[a].concat(M),k,q,v,g,B,b,F,p,N,P,z,d,f,ya,ja,Z,E,D,ha,ra,va,pa,L,t,za,ca,X,na,S,Y,U,fa,V,K,J,Ka,G,qa,la,Da,aa,ba,ma,sa,da,ea,R,Ea,Aa,Ba,wa,oa,Fa,Ua,Qa,xa,La,Ma,Ca,Ga,Ha,Ia,Pa,Ra,Na,Oa;c.def(a,"$method_missing",k=function(a,b){var d=k.$$p;d&&(k.$$p=null);d&&(k.$$p=null);d=c.slice.call(arguments,1,arguments.length);return this.$raise(l(e,"NoMethodError").$new("undefined method `"+a+"' for "+this.$inspect(),a,d))},k.$$arity=-2);c.def(a,"$=~",q= +function(a){return!1},q.$$arity=1);c.def(a,"$!~",v=function(a){return this["$=~"](a)["$!"]()},v.$$arity=1);c.def(a,"$===",g=function(a){var b;return A(b=this.$object_id()["$=="](a.$object_id()))?b:this["$=="](a)},g.$$arity=1);c.def(a,"$<=>",B=function(a){this.$$comparable=!0;return(a=this["$=="](a))&&a!==r?0:r},B.$$arity=1);c.def(a,"$method",b=function(a){var b=this["$"+a];b&&!b.$$stub||this.$raise(l(e,"NameError").$new("undefined method `"+a+"' for class `"+this.$class()+"'",a));return l(e,"Method").$new(this, +b.$$owner||this.$class(),b,a)},b.$$arity=1);c.def(a,"$methods",F=function(a){null==a&&(a=!0);return A(a)?c.methods(this):c.own_methods(this)},F.$$arity=-1);c.def(a,"$public_methods",p=function(a){null==a&&(a=!0);return A(a)?c.methods(this):c.receiver_methods(this)},p.$$arity=-1);c.def(a,"$Array",N=function(a){var b;if(a===r)return[];if(a.$$is_array)return a;b=l(e,"Opal")["$coerce_to?"](a,l(e,"Array"),"to_ary");if(b!==r)return b;b=l(e,"Opal")["$coerce_to?"](a,l(e,"Array"),"to_a");return b!==r?b:[a]}, +N.$$arity=1);c.def(a,"$at_exit",P=function(){var a=P.$$p,b=a||r,c;null==x.__at_exit__&&(x.__at_exit__=r);a&&(P.$$p=null);a&&(P.$$p=null);x.__at_exit__=A(c=x.__at_exit__)?c:[];return x.__at_exit__["$<<"](b)},P.$$arity=0);c.def(a,"$caller",z=function(a){c.slice.call(arguments,0,arguments.length);return[]},z.$$arity=-1);c.def(a,"$class",d=function(){return this.$$class},d.$$arity=0);c.def(a,"$copy_instance_variables",f=function(a){var b=Object.keys(a),c,e,d;c=0;for(e=b.length;c=T.length&&ka.$raise(l(e,"ArgumentError"),"too few arguments");return T[a]}function k(){switch(U){case -1:ka.$raise(l(e,"ArgumentError"),"unnumbered("+Fa+") mixed with numbered");case -2:ka.$raise(l(e,"ArgumentError"),"unnumbered("+Fa+") mixed with named")}U=Fa++;return g(U-1)}function t(a){0a&&ka.$raise(l(e,"ArgumentError"),"invalid index - "+a+"$");U=-1;return g(a-1)}function p(){return void 0===Ca?k():Ca}function q(b){var c;for(c="";;F++){F===E&&ka.$raise(l(e,"ArgumentError"),"malformed format string - %*[0-9]");if(48>a.charCodeAt(F)||57":"}",B="",F++;;F++){F===E&&ka.$raise(l(e,"ArgumentError"),"malformed name - unmatched parenthesis");if(a.charAt(F)===P)if(0"===P)continue a;else{h=Ca.toString();-1!==L&&(h=h.slice(0,L));if(J&2)for(;h.lengthK&&(J|=2,K=-K);continue a;case ".":J&128&&ka.$raise(l(e,"ArgumentError"),"precision given twice");J|=192;L=0;F++;if("*"===a.charAt(F)){F++;L=z("precision");0>L&&(J&=-65);continue a}L=q("precision");continue a;case "d":case "i":case "u":B=ka.$Integer(p());if(0<=B){for(h=B.toString();h.length>>0).toString(n).replace(w,m);h.lengthP||P>=(-1===L?6:L)||(h=B.toPrecision(-1===L?J&1?6:void 0:L))}if(J&2){if(J&4||J&16)h=(J&4?"+":" ")+h;for(;h.lengthP||P>=(-1===L?6:L)||(h=(-B).toPrecision(-1===L?J&1?6:void 0:L))}if(J&2)for(h="-"+h;h.lengthb||36=b?b-1:"9a-"+String.fromCharCode(97+(b-11)));(new RegExp("^\\s*[+-]?["+f+"]+\\s*$")).test(d)||c.$raise(l(e,"ArgumentError"),'invalid value for Integer(): "'+a+'"');d=parseInt(d,b);isNaN(d)&&c.$raise(l(e,"ArgumentError"),'invalid value for Integer(): "'+a+'"');return d},K.$$arity=-2);c.def(a,"$Float", +J=function(a){var b;a===r&&this.$raise(l(e,"TypeError"),"can't convert nil into Float");if(a.$$is_string){b=a.toString();b=b.replace(/(\d)_(?=\d)/g,"$1");if(/^\s*[-+]?0[xX][0-9a-fA-F]+\s*$/.test(b))return this.$Integer(b);/^\s*[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?\s*$/.test(b)||this.$raise(l(e,"ArgumentError"),'invalid value for Float(): "'+a+'"');return parseFloat(b)}return l(e,"Opal")["$coerce_to!"](a,l(e,"Float"),"to_f")},J.$$arity=1);c.def(a,"$Hash",Ka=function(a){var b;return A(A(b=a["$nil?"]())? +b:a["$=="]([]))?n([],{}):A(l(e,"Hash")["$==="](a))?a:l(e,"Opal")["$coerce_to!"](a,l(e,"Hash"),"to_hash")},Ka.$$arity=1);c.def(a,"$is_a?",G=function(a){a.$$is_class||a.$$is_module||this.$raise(l(e,"TypeError"),"class or module required");return c.is_a(this,a)},G.$$arity=1);c.def(a,"$itself",qa=function(){return this},qa.$$arity=0);c.alias(a,"kind_of?","is_a?");c.def(a,"$lambda",la=function(){var a=la.$$p,b=a||r;a&&(la.$$p=null);a&&(la.$$p=null);return c.lambda(b)},la.$$arity=0);c.def(a,"$load",Da= +function(a){a=l(e,"Opal")["$coerce_to!"](a,l(e,"String"),"to_str");return c.load(a)},Da.$$arity=1);c.def(a,"$loop",aa=function(){var a,b=aa.$$p,d=b||r,f=r;b&&(aa.$$p=null);if(d===r)return m(this,"enum_for",["loop"],(a=function(){return y(l(e,"Float"),"INFINITY")},a.$$s=this,a.$$arity=0,a));for(;A(!0);)try{c.yieldX(d,[])}catch(g){if(c.rescue(g,[l(e,"StopIteration")])){f=g;try{return f.$result()}finally{c.pop_exception()}}else throw g;}return this},aa.$$arity=0);c.def(a,"$nil?",ba=function(){return!1}, +ba.$$arity=0);c.alias(a,"object_id","__id__");c.def(a,"$printf",ma=function(a){var b;b=c.slice.call(arguments,0,arguments.length);A(b["$any?"]())&&this.$print(m(this,"format",c.to_a(b)));return r},ma.$$arity=-1);c.def(a,"$proc",sa=function(){var a=sa.$$p,b=a||r;a&&(sa.$$p=null);a&&(sa.$$p=null);A(b)||this.$raise(l(e,"ArgumentError"),"tried to create Proc object without a block");b.$$is_lambda=!1;return b},sa.$$arity=0);c.def(a,"$puts",da=function(a){var b;null==x.stdout&&(x.stdout=r);b=c.slice.call(arguments, +0,arguments.length);return m(x.stdout,"puts",c.to_a(b))},da.$$arity=-1);c.def(a,"$p",ea=function(a){var b,e;b=c.slice.call(arguments,0,arguments.length);m(b,"each",[],(e=function(a){null==x.stdout&&(x.stdout=r);null==a&&(a=r);return x.stdout.$puts(a.$inspect())},e.$$s=this,e.$$arity=1,e));return A(u(b.$length(),1))?b["$[]"](0):b},ea.$$arity=-1);c.def(a,"$print",R=function(a){var b;null==x.stdout&&(x.stdout=r);b=c.slice.call(arguments,0,arguments.length);return m(x.stdout,"print",c.to_a(b))},R.$$arity= +-1);c.def(a,"$warn",Ea=function(a){var b,e;null==x.VERBOSE&&(x.VERBOSE=r);null==x.stderr&&(x.stderr=r);b=c.slice.call(arguments,0,arguments.length);return A(A(e=x.VERBOSE["$nil?"]())?e:b["$empty?"]())?r:m(x.stderr,"puts",c.to_a(b))},Ea.$$arity=-1);c.def(a,"$raise",Aa=function(a,b,d){null==x["!"]&&(x["!"]=r);null==b&&(b=r);if(null==a&&x["!"]!==r)throw x["!"];null==a?a=l(e,"RuntimeError").$new():a.$$is_string?a=l(e,"RuntimeError").$new(a):a.$$is_class&&a["$respond_to?"]("exception")?a=a.$exception(b): +a["$is_a?"](l(e,"Exception"))||(a=l(e,"TypeError").$new("exception class/object expected"));x["!"]!==r&&c.exceptions.push(x["!"]);x["!"]=a;throw a;},Aa.$$arity=-1);c.alias(a,"fail","raise");c.def(a,"$rand",Ba=function(a){if(void 0===a)return y(l(e,"Random"),"DEFAULT").$rand();a.$$is_number&&(0>a&&(a=Math.abs(a)),0!==a%1&&(a=a.$to_i()),0===a&&(a=void 0));return y(l(e,"Random"),"DEFAULT").$rand(a)},Ba.$$arity=-1);c.def(a,"$respond_to?",wa=function(a,b){null==b&&(b=!1);if(A(this["$respond_to_missing?"](a, +b)))return!0;var c=this["$"+a];return"function"!==typeof c||c.$$stub?!1:!0},wa.$$arity=-2);c.def(a,"$respond_to_missing?",oa=function(a,b){return!1},oa.$$arity=-2);c.def(a,"$require",Fa=function(a){a=l(e,"Opal")["$coerce_to!"](a,l(e,"String"),"to_str");return c.require(a)},Fa.$$arity=1);c.def(a,"$require_relative",Ua=function(a){l(e,"Opal")["$try_convert!"](a,l(e,"String"),"to_str");a=l(e,"File").$expand_path(l(e,"File").$join(c.current_file,"..",a));return c.require(a)},Ua.$$arity=1);c.def(a,"$require_tree", +Qa=function(a){var b=[];a=l(e,"File").$expand_path(a);a=c.normalize(a);"."===a&&(a="");for(var d in c.modules)d["$start_with?"](a)&&b.push([d,c.require(d)]);return b},Qa.$$arity=1);c.alias(a,"send","__send__");c.alias(a,"public_send","__send__");c.def(a,"$singleton_class",xa=function(){return c.get_singleton_class(this)},xa.$$arity=0);c.def(a,"$sleep",La=function(a){null==a&&(a=r);a===r&&this.$raise(l(e,"TypeError"),"can't convert NilClass into time interval");a.$$is_number||this.$raise(l(e,"TypeError"), +"can't convert "+a.$class()+" into time interval");0>a&&this.$raise(l(e,"ArgumentError"),"time interval must be positive");for(var b=c.global.performance?function(){return performance.now()}:function(){return new Date},d=b();b()-d<=1E3*a;);return a},La.$$arity=-1);c.alias(a,"sprintf","format");c.def(a,"$srand",Ma=function(a){null==a&&(a=l(e,"Random").$new_seed());return l(e,"Random").$srand(a)},Ma.$$arity=-1);c.def(a,"$String",Ca=function(a){var b;return A(b=l(e,"Opal")["$coerce_to?"](a,l(e,"String"), +"to_str"))?b:l(e,"Opal")["$coerce_to!"](a,l(e,"String"),"to_s")},Ca.$$arity=1);c.def(a,"$tap",Ga=function(){var a=Ga.$$p,b=a||r;a&&(Ga.$$p=null);a&&(Ga.$$p=null);c.yield1(b,this);return this},Ga.$$arity=0);c.def(a,"$to_proc",Ha=function(){return this},Ha.$$arity=0);c.def(a,"$to_s",Ia=function(){return"#<"+this.$class()+":0x"+this.$__id__().$to_s(16)+">"},Ia.$$arity=0);c.def(a,"$catch",Pa=function(a){var b=Pa.$$p,d=b||r,f=r;b&&(Pa.$$p=null);try{return c.yieldX(d,[])}catch(g){if(c.rescue(g,[l(e,"UncaughtThrowError")])){f= +g;try{return f.$sym()["$=="](a)?f.$arg():this.$raise()}finally{c.pop_exception()}}else throw g;}},Pa.$$arity=1);c.def(a,"$throw",Ra=function(a){var b;b=c.slice.call(arguments,0,arguments.length);return this.$raise(l(e,"UncaughtThrowError"),b)},Ra.$$arity=-1);c.def(a,"$open",Na=function(a){var b=Na.$$p,d=b||r;b&&(Na.$$p=null);b&&(Na.$$p=null);b=c.slice.call(arguments,0,arguments.length);return m(l(e,"File"),"open",c.to_a(b),d.$to_proc())},Na.$$arity=-1);c.def(a,"$yield_self",Oa=function(){var a,b= +Oa.$$p,e=b||r;b&&(Oa.$$p=null);return e===r?m(this,"enum_for",["yield_self"],(a=function(){return 1},a.$$s=this,a.$$arity=0,a)):c.yield1(e,this)},Oa.$$arity=0)})(D[0],D);return function(c,$super,h){function a(){}c=a=w(c,$super,"Object",a);h=[c].concat(h);return c.$include(l(h,"Kernel"))}(D[0],null,D)};Opal.modules["corelib/error"]=function(c){var u=[],D=c.nil,r=c.const_get_relative,y=c.klass,l=c.send,h=c.truthy,A=c.module,x=c.hash2;c.add_stubs("$new $clone $to_s $empty? $class $raise $+ $attr_reader $[] $> $length $inspect".split(" ")); +(function(n,$super,w){function x(){}n=x=y(n,$super,"Exception",x);var M=n.prototype,u=[n].concat(w),a,e,k,q,v,g,B,b,F;M.message=D;var p;c.defs(n,"$new",a=function(a){var b;b=c.slice.call(arguments,0,arguments.length);var e=0"},B.$$arity=0);c.def(n,"$set_backtrace",b=function(a){var b=!0,c,e;if(a===D)this.backtrace=D;else if(a.$$is_string)this.backtrace=[a];else{if(a.$$is_array)for(c=0,e=a.length;c"](1);h(e)&&(this.arg=a["$[]"](1));return l(this, +c.find_super_dispatcher(this,"initialize",u,!1),["uncaught throw "+this.sym.$inspect()],null)},u.$$arity=1),D)&&"initialize"})(u[0],r(u,"ArgumentError"),u);(function(h,$super,w){function x(){}h=x=y(h,$super,"NameError",x);[h].concat(w);var r;h.$attr_reader("name");return(c.def(h,"$initialize",r=function(h,a){r.$$p&&(r.$$p=null);null==a&&(a=D);l(this,c.find_super_dispatcher(this,"initialize",r,!1),[h],null);return this.name=a},r.$$arity=-2),D)&&"initialize"})(u[0],null,u);(function(h,$super,w){function x(){} +h=x=y(h,$super,"NoMethodError",x);[h].concat(w);var r;h.$attr_reader("args");return(c.def(h,"$initialize",r=function(h,a,e){r.$$p&&(r.$$p=null);null==a&&(a=D);null==e&&(e=[]);l(this,c.find_super_dispatcher(this,"initialize",r,!1),[h,a],null);return this.args=e},r.$$arity=-2),D)&&"initialize"})(u[0],null,u);(function(c,$super,h){function l(){}c=l=y(c,$super,"StopIteration",l);[c].concat(h);return c.$attr_reader("result")})(u[0],null,u);(function(n,$super,w){function u(){}n=u=y(n,$super,"KeyError", +u);var M=n.prototype,A=[n].concat(w),a,e,k;M.receiver=M.key=D;c.def(n,"$initialize",a=function(e,k){var g,h;a.$$p&&(a.$$p=null);if(null==k)k=x([],{});else if(!k.$$is_hash)throw c.ArgumentError.$new("expected kwargs");g=k.$$smap.receiver;null==g&&(g=D);h=k.$$smap.key;null==h&&(h=D);l(this,c.find_super_dispatcher(this,"initialize",a,!1),[e],null);this.receiver=g;return this.key=h},a.$$arity=-2);c.def(n,"$receiver",e=function(){var a;return h(a=this.receiver)?a:this.$raise(r(A,"ArgumentError"),"no receiver is available")}, +e.$$arity=0);return(c.def(n,"$key",k=function(){var a;return h(a=this.key)?a:this.$raise(r(A,"ArgumentError"),"no key is available")},k.$$arity=0),D)&&"key"})(u[0],null,u);return function(c,h){function l(){}var x=[l=A(c,"JS",l)].concat(h);(function(c,$super,a){function e(){}[e=y(c,$super,"Error",e)].concat(a);return D})(x[0],null,x)}(u[0],u)};Opal.modules["corelib/constants"]=function(c){var u=[],D=c.const_get_relative;c.const_set(u[0],"RUBY_PLATFORM","opal");c.const_set(u[0],"RUBY_ENGINE","opal"); +c.const_set(u[0],"RUBY_VERSION","2.5.1");c.const_set(u[0],"RUBY_ENGINE_VERSION","0.11.99.dev");c.const_set(u[0],"RUBY_RELEASE_DATE","2018-12-25");c.const_set(u[0],"RUBY_PATCHLEVEL",0);c.const_set(u[0],"RUBY_REVISION",0);c.const_set(u[0],"RUBY_COPYRIGHT","opal - Copyright (C) 2013-2018 Adam Beynon and the Opal contributors");return c.const_set(u[0],"RUBY_DESCRIPTION","opal "+D(u,"RUBY_ENGINE_VERSION")+" ("+D(u,"RUBY_RELEASE_DATE")+" revision "+D(u,"RUBY_REVISION")+")")};Opal.modules["opal/base"]=function(c){var u= +c.top;c.add_stubs(["$require"]);u.$require("corelib/runtime");u.$require("corelib/helpers");u.$require("corelib/module");u.$require("corelib/class");u.$require("corelib/basic_object");u.$require("corelib/kernel");u.$require("corelib/error");return u.$require("corelib/constants")};Opal.modules["corelib/nil"]=function(c){var u=[],D=c.nil,r=c.const_get_relative,y=c.klass,l=c.hash2,h=c.truthy;c.add_stubs("$raise $name $new $> $length $Rational".split(" "));(function(u,$super,n){function m(){}u=m=y(u, +$super,"NilClass",m);var w=u.prototype,H=[u].concat(n),M,Q,a,e,k,q,v,g,B,b,F,p,N,P,z,d,f,ya;w.$$meta=u;(function(a,b){var e=[a].concat(b),d;c.def(a,"$allocate",d=function(){return this.$raise(r(e,"TypeError"),"allocator undefined for "+this.$name())},d.$$arity=0);c.udef(a,"$new");return D})(c.get_singleton_class(u),H);c.def(u,"$!",M=function(){return!0},M.$$arity=0);c.def(u,"$&",Q=function(a){return!1},Q.$$arity=1);c.def(u,"$|",a=function(a){return!1!==a&&a!==D},a.$$arity=1);c.def(u,"$^",e=function(a){return!1!== +a&&a!==D},e.$$arity=1);c.def(u,"$==",k=function(a){return a===D},k.$$arity=1);c.def(u,"$dup",q=function(){return D},q.$$arity=0);c.def(u,"$clone",v=function(a){if(null==a)l([],{});else if(!a.$$is_hash)throw c.ArgumentError.$new("expected kwargs");return D},v.$$arity=-1);c.def(u,"$inspect",g=function(){return"nil"},g.$$arity=0);c.def(u,"$nil?",B=function(){return!0},B.$$arity=0);c.def(u,"$singleton_class",b=function(){return r(H,"NilClass")},b.$$arity=0);c.def(u,"$to_a",F=function(){return[]},F.$$arity= +0);c.def(u,"$to_h",p=function(){return c.hash()},p.$$arity=0);c.def(u,"$to_i",N=function(){return 0},N.$$arity=0);c.alias(u,"to_f","to_i");c.def(u,"$to_s",P=function(){return""},P.$$arity=0);c.def(u,"$to_c",z=function(){return r(H,"Complex").$new(0,0)},z.$$arity=0);c.def(u,"$rationalize",d=function(a){var b;b=c.slice.call(arguments,0,arguments.length).$length();b="number"===typeof b?1"](1);h(b)&&this.$raise(r(H,"ArgumentError"));return this.$Rational(0,1)},d.$$arity=-1);c.def(u,"$to_r",f= +function(){return this.$Rational(0,1)},f.$$arity=0);return(c.def(u,"$instance_variables",ya=function(){return[]},ya.$$arity=0),D)&&"instance_variables"})(u[0],null,u);return c.const_set(u[0],"NIL",D)};Opal.modules["corelib/boolean"]=function(c){var u=[],D=c.nil,r=c.const_get_relative,y=c.klass,l=c.hash2;c.add_stubs(["$raise","$name"]);(function(h,$super,x){function n(){}h=n=y(h,$super,"Boolean",n);var m=[h].concat(x),w,u,M,Q,a,e,k,q,v,g;c.defineProperty(Boolean.prototype,"$$is_boolean",!0);c.defineProperty(Boolean.prototype, +"$$meta",h);(function(a,b){var e=[a].concat(b),g;c.def(a,"$allocate",g=function(){return this.$raise(r(e,"TypeError"),"allocator undefined for "+this.$name())},g.$$arity=0);c.udef(a,"$new");return D})(c.get_singleton_class(h),m);c.def(h,"$__id__",w=function(){return this.valueOf()?2:0},w.$$arity=0);c.alias(h,"object_id","__id__");c.def(h,"$!",u=function(){return 1!=this},u.$$arity=0);c.def(h,"$&",M=function(a){return 1==this?!1!==a&&a!==D:!1},M.$$arity=1);c.def(h,"$|",Q=function(a){return 1==this? +!0:!1!==a&&a!==D},Q.$$arity=1);c.def(h,"$^",a=function(a){return 1==this?!1===a||a===D:!1!==a&&a!==D},a.$$arity=1);c.def(h,"$==",e=function(a){return 1==this===a.valueOf()},e.$$arity=1);c.alias(h,"equal?","==");c.alias(h,"eql?","==");c.def(h,"$singleton_class",k=function(){return r(m,"Boolean")},k.$$arity=0);c.def(h,"$to_s",q=function(){return 1==this?"true":"false"},q.$$arity=0);c.def(h,"$dup",v=function(){return this},v.$$arity=0);return(c.def(h,"$clone",g=function(a){if(null==a)l([],{});else if(!a.$$is_hash)throw c.ArgumentError.$new("expected kwargs"); +return this},g.$$arity=-1),D)&&"clone"})(u[0],Boolean,u);c.const_set(u[0],"TrueClass",r(u,"Boolean"));c.const_set(u[0],"FalseClass",r(u,"Boolean"));c.const_set(u[0],"TRUE",!0);return c.const_set(u[0],"FALSE",!1)};Opal.modules["corelib/comparable"]=function(c){function u(c,h){return"number"===typeof c&&"number"===typeof h?c>h:c["$>"](h)}function D(c,h){return"number"===typeof c&&"number"===typeof h?c $< $equal? $<=> $normalize $raise $class".split(" ")); +return function(x,n){function m(){}var w=m=h(x,"Comparable",m),r=[w].concat(n),M,Q,a,e,k,q,v,g;c.defs(w,"$normalize",M=function(a){return A(l(r,"Integer")["$==="](a))?a:A(u(a,0))?1:A(D(a,0))?-1:0},M.$$arity=1);c.def(w,"$==",Q=function(a){var b=y;try{return A(this["$equal?"](a))?!0:this["$<=>"]==c.Kernel["$<=>"]?!1:this.$$comparable?(delete this.$$comparable,!1):A(b=this["$<=>"](a))?0==l(r,"Comparable").$normalize(b):!1}catch(e){if(c.rescue(e,[l(r,"StandardError")]))try{return!1}finally{c.pop_exception()}else throw e; +}},Q.$$arity=1);c.def(w,"$>",a=function(a){var b=y;A(b=this["$<=>"](a))||this.$raise(l(r,"ArgumentError"),"comparison of "+this.$class()+" with "+a.$class()+" failed");return 0=",e=function(a){var b=y;A(b=this["$<=>"](a))||this.$raise(l(r,"ArgumentError"),"comparison of "+this.$class()+" with "+a.$class()+" failed");return 0<=l(r,"Comparable").$normalize(b)},e.$$arity=1);c.def(w,"$<",k=function(a){var b=y;A(b=this["$<=>"](a))||this.$raise(l(r, +"ArgumentError"),"comparison of "+this.$class()+" with "+a.$class()+" failed");return 0>l(r,"Comparable").$normalize(b)},k.$$arity=1);c.def(w,"$<=",q=function(a){var b=y;A(b=this["$<=>"](a))||this.$raise(l(r,"ArgumentError"),"comparison of "+this.$class()+" with "+a.$class()+" failed");return 0>=l(r,"Comparable").$normalize(b)},q.$$arity=1);c.def(w,"$between?",v=function(a,b){return D(this,a)||u(this,b)?!1:!0},v.$$arity=2);c.def(w,"$clamp",g=function(a,b){var c=y,c=a["$<=>"](b);A(c)||this.$raise(l(r, +"ArgumentError"),"comparison of "+a.$class()+" with "+b.$class()+" failed");A(u(l(r,"Comparable").$normalize(c),0))&&this.$raise(l(r,"ArgumentError"),"min argument must be smaller than max argument");return A(D(l(r,"Comparable").$normalize(this["$<=>"](a)),0))?a:A(u(l(r,"Comparable").$normalize(this["$<=>"](b)),0))?b:this},g.$$arity=2)}(r[0],r)};Opal.modules["corelib/regexp"]=function(c){var u=[],D=c.nil,r=c.const_get_relative,y=c.klass,l=c.send,h=c.truthy,A=c.gvars;c.add_stubs("$nil? $[] $raise $escape $options $to_str $new $join $coerce_to! $! $match $coerce_to? $begin $coerce_to $=~ $attr_reader $=== $inspect $to_a".split(" ")); +(function(c,$super,h){function l(){}[l=y(c,$super,"RegexpError",l)].concat(h);return D})(u[0],r(u,"StandardError"),u);(function(x,$super,m){function w(){}x=w=y(x,$super,"Regexp",w);var u=[x].concat(m),M,Q,a,e,k,q,v,g,B,b;c.const_set(u[0],"IGNORECASE",1);c.const_set(u[0],"EXTENDED",2);c.const_set(u[0],"MULTILINE",4);c.defineProperty(RegExp.prototype,"$$is_regexp",!0);(function(a,b){var e=[a].concat(b),g,k,d,f,q;c.def(a,"$allocate",g=function(){var a=g.$$p,b=D,e=b=D,d=D;a&&(g.$$p=null);e=0;d=arguments.length; +for(b=Array(d);eb&&(b+=a.length,0>b))return A["~"]=D;for(var h=c.global_regexp(this);;){e=h.exec(a);if(null===e)return A["~"]=D;if(e.index>=b)return A["~"]=r(u,"MatchData").$new(h,e),g===D?A["~"]:c.yield1(g,A["~"]);h.lastIndex=e.index+1}},k.$$arity=-2);c.def(x,"$match?",q=function(a,b){this.uninitialized&&this.$raise(r(u,"TypeError"),"uninitialized Regexp");if(void 0===b)return a===D?!1:this.test(r(u,"Opal").$coerce_to(a,r(u,"String"),"to_str"));b=r(u,"Opal").$coerce_to(b, +r(u,"Integer"),"to_int");if(a===D)return!1;a=r(u,"Opal").$coerce_to(a,r(u,"String"),"to_str");if(0>b&&(b+=a.length,0>b))return!1;var e;e=c.global_regexp(this).exec(a);return null===e||e.index"},B.$$arity=0);c.def(x,"$length",b=function(){return this.matches.length},b.$$arity=0);c.alias(x,"size","length");c.def(x,"$to_a",F=function(){return this.matches}, +F.$$arity=0);c.def(x,"$to_s",p=function(){return this.matches[0]},p.$$arity=0);return(c.def(x,"$values_at",N=function(a){var b;b=c.slice.call(arguments,0,arguments.length);var e,f,g=[];for(e=0;ef&&(f+=this.matches.length,0>f)){g.push(D);continue}g.push(this.matches[f])}return g},N.$$arity=-1),D)&&"values_at"}(u[0],null,u)};Opal.modules["corelib/string"]= +function(c){function u(c,h){return"number"===typeof c&&"number"===typeof h?c/h:c["$/"](h)}function D(c,h){return"number"===typeof c&&"number"===typeof h?c+h:c["$+"](h)}var r=c.top,y=[],l=c.nil,h=c.const_get_relative,A=c.klass,x=c.truthy,n=c.send,m=c.gvars;c.add_stubs("$require $include $coerce_to? $coerce_to $raise $=== $format $to_s $respond_to? $to_str $<=> $== $=~ $new $force_encoding $casecmp $empty? $ljust $ceil $/ $+ $rjust $floor $to_a $each_char $to_proc $coerce_to! $copy_singleton_methods $initialize_clone $initialize_dup $enum_for $size $chomp $[] $to_i $each_line $class $match $match? $captures $proc $succ $escape".split(" ")); +r.$require("corelib/comparable");r.$require("corelib/regexp");(function(w,$super,r){function y(){}function a(a){function b(a){var c="",d,f=a.length,g,ka;for(d=0;dg&&e.$raise(h(k,"ArgumentError"),'invalid range "'+ka+"-"+g+'" in string transliteration');for(ka+=1;kaa&&this.$raise(h(k,"ArgumentError"),"negative argument");if(0===a)return this.$$cast("");var b="",c=this.toString();for(268435456<=c.length*a&&this.$raise(h(k,"RangeError"),"multiply count must not overflow maximum string size");;){1===(a&1)&&(b+=c);a>>>=1;if(0===a)break;c+=c}return this.$$cast(b)},F.$$arity=1);c.def(e,"$+",p=function(a){a=h(k,"Opal").$coerce_to(a,h(k,"String"),"to_str");return this+a.$to_s()}, +p.$$arity=1);c.def(e,"$<=>",N=function(a){if(x(a["$respond_to?"]("to_str")))return a=a.$to_str().$to_s(),this>a?1:this"](this);return a===l?l:0a?1:0},N.$$arity=1);c.def(e,"$==",P=function(a){return a.$$is_string?this.toString()===a.toString():h(k,"Opal")["$respond_to?"](a,"to_str")?a["$=="](this):!1},P.$$arity=1);c.alias(e,"eql?","==");c.alias(e,"===","==");c.def(e,"$=~",z=function(a){a.$$is_string&&this.$raise(h(k,"TypeError"),"type mismatch: String given");return a["$=~"](this)}, +z.$$arity=1);c.def(e,"$[]",d=function(a,b){var c=this.length,e;if(a.$$is_range){e=a.excl;b=h(k,"Opal").$coerce_to(a.end,h(k,"Integer"),"to_int");a=h(k,"Opal").$coerce_to(a.begin,h(k,"Integer"),"to_int");if(Math.abs(a)>c)return l;0>a&&(a+=c);0>b&&(b+=c);e||(b+=1);b-=a;0>b&&(b=0);return this.$$cast(this.substr(a,b))}if(a.$$is_string)return null!=b&&this.$raise(h(k,"TypeError")),-1!==this.indexOf(a)?this.$$cast(a):l;if(a.$$is_regexp){c=this.match(a);if(null===c)return m["~"]=l;m["~"]=h(k,"MatchData").$new(a, +c);if(null==b)return this.$$cast(c[0]);b=h(k,"Opal").$coerce_to(b,h(k,"Integer"),"to_int");return 0>b&&-ba&&(a+=c);if(null==b)return a>=c||0>a?l:this.$$cast(this.substr(a,1));b=h(k,"Opal").$coerce_to(b,h(k,"Integer"),"to_int");return 0>b||a>c||0>a?l:this.$$cast(this.substr(a,b))},d.$$arity=-2);c.alias(e,"byteslice","[]");c.def(e,"$b",f=function(){return this.$force_encoding("binary")}, +f.$$arity=0);c.def(e,"$capitalize",ya=function(){return this.$$cast(this.charAt(0).toUpperCase()+this.substr(1).toLowerCase())},ya.$$arity=0);c.def(e,"$casecmp",ja=function(a){var b=this;if(!x(a["$respond_to?"]("to_str")))return l;a=h(k,"Opal").$coerce_to(a,h(k,"String"),"to_str").$to_s();var c=/^[\x00-\x7F]*$/;c.test(b)&&c.test(a)&&(b=b.toLowerCase(),a=a.toLowerCase());return b["$<=>"](a)},ja.$$arity=1);c.def(e,"$casecmp?",Z=function(a){a=this.$casecmp(a);return a===l?l:0===a},Z.$$arity=1);c.def(e, +"$center",E=function(a,b){null==b&&(b=" ");a=h(k,"Opal").$coerce_to(a,h(k,"Integer"),"to_int");b=h(k,"Opal").$coerce_to(b,h(k,"String"),"to_str").$to_s();x(b["$empty?"]())&&this.$raise(h(k,"ArgumentError"),"zero width padding");if(x(a<=this.length))return this;var c=this.$ljust(u(D(a,this.length),2).$ceil(),b),e=this.$rjust(u(D(a,this.length),2).$floor(),b);return this.$$cast(e+c.slice(this.length))},E.$$arity=-2);c.def(e,"$chars",ta=function(){var a=ta.$$p,b=a||l;a&&(ta.$$p=null);a&&(ta.$$p=null); +return x(b)?n(this,"each_char",[],b.$to_proc()):this.$each_char().$to_a()},ta.$$arity=0);c.def(e,"$chomp",ha=function(a){null==m["/"]&&(m["/"]=l);null==a&&(a=m["/"]);if(x(a===l||0===this.length))return this;a=h(k,"Opal")["$coerce_to!"](a,h(k,"String"),"to_str").$to_s();var b;"\n"===a?b=this.replace(/\r?\n?$/,""):""===a?b=this.replace(/(\r?\n)+$/,""):this.length>a.length&&this.substr(this.length-a.length,a.length)===a&&(b=this.substr(0,this.length-a.length));return null!=b?this.$$cast(b):this},ha.$$arity= +-1);c.def(e,"$chop",ra=function(){var a=this.length,a=1>=a?"":"\n"===this.charAt(a-1)&&"\r"===this.charAt(a-2)?this.substr(0,a-2):this.substr(0,a-1);return this.$$cast(a)},ra.$$arity=0);c.def(e,"$chr",va=function(){return this.charAt(0)},va.$$arity=0);c.def(e,"$clone",pa=function(){var a=l,a=this.slice();a.$copy_singleton_methods(this);a.$initialize_clone(this);return a},pa.$$arity=0);c.def(e,"$dup",L=function(){var a=l,a=this.slice();a.$initialize_dup(this);return a},L.$$arity=0);c.def(e,"$count", +t=function(b){var e;e=c.slice.call(arguments,0,arguments.length);0===e.length&&this.$raise(h(k,"ArgumentError"),"ArgumentError: wrong number of arguments (0 for 1+)");e=a(e);return null===e?0:this.length-this.replace(new RegExp(e,"g"),"").length},t.$$arity=-1);c.def(e,"$delete",za=function(b){var e;e=c.slice.call(arguments,0,arguments.length);0===e.length&&this.$raise(h(k,"ArgumentError"),"ArgumentError: wrong number of arguments (0 for 1+)");e=a(e);return null===e?this:this.$$cast(this.replace(new RegExp(e, +"g"),""))},za.$$arity=-1);c.def(e,"$delete_prefix",ca=function(a){a.$$is_string||(a=h(k,"Opal").$coerce_to(a,h(k,"String"),"to_str"));return this.slice(0,a.length)===a?this.$$cast(this.slice(a.length)):this},ca.$$arity=1);c.def(e,"$delete_suffix",X=function(a){a.$$is_string||(a=h(k,"Opal").$coerce_to(a,h(k,"String"),"to_str"));return this.slice(this.length-a.length)===a?this.$$cast(this.slice(0,this.length-a.length)):this},X.$$arity=1);c.def(e,"$downcase",na=function(){return this.$$cast(this.toLowerCase())}, +na.$$arity=0);c.def(e,"$each_char",S=function(){var a=S.$$p,b=a||l,e;a&&(S.$$p=null);a&&(S.$$p=null);if(b===l)return n(this,"enum_for",["each_char"],(e=function(){return(e.$$s||this).$size()},e.$$s=this,e.$$arity=0,e));for(var a=0,d=this.length;a=f.length&&this.substr(this.length-f.length,f.length)==f)return!0}return!1},fa.$$arity=-1);c.alias(e,"equal?","===");c.def(e,"$gsub",V=function(a,b){var e=V.$$p,d=e||l,f=this;e&&(V.$$p=null);e&&(V.$$p=null);if(void 0===b&&d===l)return f.$enum_for("gsub",a);var e="",g=l,t=0,p,T;a.$$is_regexp?a=c.global_multiline_regexp(a):(a=h(k,"Opal").$coerce_to(a, +h(k,"String"),"to_str"),a=new RegExp(a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"gm"));for(var C;;){p=a.exec(f);if(null===p){m["~"]=l;e+=f.slice(t);break}g=h(k,"MatchData").$new(a,p);void 0===b?(C=a.lastIndex,T=d(p[0]),a.lastIndex=C):b.$$is_hash?T=b["$[]"](p[0]).$to_s():(b.$$is_string||(b=h(k,"Opal").$coerce_to(b,h(k,"String"),"to_str")),T=b.replace(/([\\]+)([0-9+&`'])/g,function(a,b,c){if(0===b.length%2)return a;switch(c){case "+":for(a=p.length-1;0b&&(b+=this.length,0>b))return l;if(a.$$is_regexp)for(d=c.global_multiline_regexp(a);;){e=d.exec(this);if(null===e){m["~"]=l;e=-1;break}if(e.index>=b){m["~"]=h(k,"MatchData").$new(d,e);e=e.index;break}d.lastIndex=e.index+1}else a=h(k,"Opal").$coerce_to(a,h(k,"String"),"to_str"),e=0=== +a.length&&b>this.length?-1:this.indexOf(a,b);return-1===e?l:e},G.$$arity=-2);c.def(e,"$inspect",qa=function(){var a={"\u0007":"\\a","\u001b":"\\e","\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r","\x0B":"\\v",'"':'\\"',"\\":"\\\\"};return'"'+this.replace(/[\\\"\x00-\x1f\u007F-\u009F\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,function(b){return a[b]||"\\u"+("0000"+b.charCodeAt(0).toString(16).toUpperCase()).slice(-4)}).replace(/\#[\$\@\{]/g,"\\$&")+ +'"'},qa.$$arity=0);c.def(e,"$intern",la=function(){return this.toString()},la.$$arity=0);c.def(e,"$lines",Da=function(a){var b=Da.$$p,c=b||l,e=l;null==m["/"]&&(m["/"]=l);b&&(Da.$$p=null);b&&(Da.$$p=null);null==a&&(a=m["/"]);e=n(this,"each_line",[a],c.$to_proc());return x(c)?this:e.$to_a()},Da.$$arity=-1);c.def(e,"$length",aa=function(){return this.length},aa.$$arity=0);c.def(e,"$ljust",ba=function(a,b){null==b&&(b=" ");a=h(k,"Opal").$coerce_to(a,h(k,"Integer"),"to_int");b=h(k,"Opal").$coerce_to(b, +h(k,"String"),"to_str").$to_s();x(b["$empty?"]())&&this.$raise(h(k,"ArgumentError"),"zero width padding");if(x(a<=this.length))return this;var c=-1,e="";for(a-=this.length;++c=d||65<=d&&90>=d||97<=d&&122>=d)switch(d){case 57:e=!0;d=48;break;case 90:e=!0;d=65;break;case 122:e=!0;d=97;break;default:e=!1,d+=1}else-1===c?255===d?(e=!0,d=0):(e=!1,d+=1):e=!0;b=b.slice(0,a)+String.fromCharCode(d)+b.slice(a+1);if(e&&(0===a||a===c)){switch(d){case 65:break;case 97:break; +default:d+=1}b=0===a?String.fromCharCode(d)+b:b.slice(0,a)+String.fromCharCode(d)+b.slice(a);e=!1}if(!e)break}return this.$$cast(b)},R.$$arity=0);c.def(e,"$oct",Ea=function(){var a;a=this;var b=8;if(/^\s*_/.test(a))return 0;a=a.replace(/^(\s*[+-]?)(0[bodx]?)(.+)$/i,function(a,c,e,d){switch(d.charAt(0)){case "+":case "-":return a;case "0":if("x"===d.charAt(1)&&"0x"===e)return a}switch(e){case "0b":b=2;break;case "0":case "0o":b=8;break;case "0d":b=10;break;case "0x":b=16}return c+d});a=parseInt(a.replace(/_(?!_)/g, +""),b);return isNaN(a)?0:a},Ea.$$arity=0);c.def(e,"$ord",Aa=function(){return this.charCodeAt(0)},Aa.$$arity=0);c.def(e,"$partition",Ba=function(a){var b;a.$$is_regexp?(b=a.exec(this),null===b?b=-1:(h(k,"MatchData").$new(a,b),a=b[0],b=b.index)):(a=h(k,"Opal").$coerce_to(a,h(k,"String"),"to_str"),b=this.indexOf(a));return-1===b?[this,"",""]:[this.slice(0,b),this.slice(b,b+a.length),this.slice(b+a.length)]},Ba.$$arity=1);c.def(e,"$reverse",wa=function(){return this.split("").reverse().join("")},wa.$$arity= +0);c.def(e,"$rindex",oa=function(a,b){var e,d,f;if(void 0===b)b=this.length;else if(b=h(k,"Opal").$coerce_to(b,h(k,"Integer"),"to_int"),0>b&&(b+=this.length,0>b))return l;if(a.$$is_regexp){e=null;for(d=c.global_multiline_regexp(a);;){f=d.exec(this);if(null===f||f.index>b)break;e=f;d.lastIndex=e.index+1}null===e?(m["~"]=l,e=-1):(h(k,"MatchData").$new(d,e),e=e.index)}else a=h(k,"Opal").$coerce_to(a,h(k,"String"),"to_str"),e=this.lastIndexOf(a,b);return-1===e?l:e},oa.$$arity=-2);c.def(e,"$rjust",Fa= +function(a,b){null==b&&(b=" ");a=h(k,"Opal").$coerce_to(a,h(k,"Integer"),"to_int");b=h(k,"Opal").$coerce_to(b,h(k,"String"),"to_str").$to_s();x(b["$empty?"]())&&this.$raise(h(k,"ArgumentError"),"zero width padding");if(x(a<=this.length))return this;var c=Math.floor(a-this.length),e=Array(Math.floor(c/b.length)+1).join(b);return this.$$cast(e+b.slice(0,c-e.length)+this)},Fa.$$arity=-2);c.def(e,"$rpartition",Ua=function(a){var b,e,d;if(a.$$is_regexp){b=null;for(e=c.global_multiline_regexp(a);;){d=e.exec(this); +if(null===d)break;b=d;e.lastIndex=b.index+1}null===b?b=-1:(h(k,"MatchData").$new(e,b),a=b[0],b=b.index)}else a=h(k,"Opal").$coerce_to(a,h(k,"String"),"to_str"),b=this.lastIndexOf(a);return-1===b?["","",this]:[this.slice(0,b),this.slice(b,b+a.length),this.slice(b+a.length)]},Ua.$$arity=1);c.def(e,"$rstrip",Qa=function(){return this.replace(/[\s\u0000]*$/,"")},Qa.$$arity=0);c.def(e,"$scan",xa=function(a){var b=xa.$$p,e=b||l;b&&(xa.$$p=null);b&&(xa.$$p=null);var b=[],d=l,f;a.$$is_regexp?a=c.global_multiline_regexp(a): +(a=h(k,"Opal").$coerce_to(a,h(k,"String"),"to_str"),a=new RegExp(a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"gm"));for(;null!=(f=a.exec(this));)d=h(k,"MatchData").$new(a,f),e===l?1==f.length?b.push(f[0]):b.push(d.$captures()):1==f.length?e(f[0]):e.call(this,d.$captures()),a.lastIndex===f.index&&(a.lastIndex+=1);m["~"]=d;return e!==l?this:b},xa.$$arity=1);c.alias(e,"size","length");c.alias(e,"slice","[]");c.def(e,"$split",La=function(a,b){function e(){for(T=0;Tb){if(null!==p&&""===p[0]&&-1===a.source.indexOf("(?="))for(T=0,d=p.length;T=g.length)return e(),g;for(T=0;null!==p;){T++;t=a.lastIndex;if(T+1===b)break;p=a.exec(d)}g.splice(b-1,g.length-1,d.slice(t));e();return g},La.$$arity=-1);c.def(e,"$squeeze",Ma=function(b){var e; +e=c.slice.call(arguments,0,arguments.length);if(0===e.length)return this.$$cast(this.replace(/(.)\1+/g,"$1"));e=a(e);return null===e?this:this.$$cast(this.replace(new RegExp("("+e+")\\1+","g"),"$1"))},Ma.$$arity=-1);c.def(e,"$start_with?",Ca=function(a){var b;b=c.slice.call(arguments,0,arguments.length);for(var e=0,d=b.length;e=a?b:b&Math.pow(2,a)-1},Ia.$$arity=-1);c.def(e,"$swapcase",Pa=function(){var a=this.replace(/([a-z]+)|([A-Z]+)/g,function(a,b,c){return b?a.toUpperCase():a.toLowerCase()});return this.constructor===String?a:this.$class().$new(a)},Pa.$$arity= +0);c.def(e,"$to_f",Ra=function(){if("_"===this.charAt(0))return 0;var a=parseFloat(this.replace(/_/g,""));return isNaN(a)||Infinity==a||-Infinity==a?0:a},Ra.$$arity=0);c.def(e,"$to_i",Na=function(a){null==a&&(a=10);var b=this.toLowerCase(),c=h(k,"Opal").$coerce_to(a,h(k,"Integer"),"to_int");(1===c||0>c||36e&&this.$raise(h(k,"ArgumentError"),'invalid range "'+ +String.fromCharCode(d)+"-"+String.fromCharCode(e)+'" in string transliteration');for(d+=1;de&&this.$raise(h(k,"ArgumentError"),'invalid range "'+String.fromCharCode(d)+"-"+String.fromCharCode(e)+ +'" in string transliteration');for(d+=1;de&&this.$raise(h(k,"ArgumentError"),'invalid range "'+String.fromCharCode(d)+"-"+String.fromCharCode(e)+'" in string transliteration');for(d+=1;de&&this.$raise(h(k,"ArgumentError"),'invalid range "'+String.fromCharCode(d)+"-"+String.fromCharCode(e)+'" in string transliteration');for(d+=1;dc:a["$>"](c)}function D(a,c){return"number"===typeof a&&"number"===typeof c?a+c:a["$+"](c)}function r(a,c){return"number"===typeof a&&"number"===typeof c?a-c:a["$-"](c)}function y(a,c){return"number"===typeof a&&"number"===typeof c?a<=c:a["$<="](c)}var l=[],h=c.nil,A=c.const_get_qualified,x=c.const_get_relative, +n=c.module,m=c.truthy,w=c.send,H=c.falsy,M=c.hash2,Q=c.lambda;c.add_stubs("$each $public_send $destructure $to_enum $enumerator_size $new $yield $raise $slice_when $! $enum_for $flatten $map $warn $proc $== $nil? $respond_to? $coerce_to! $> $* $coerce_to $try_convert $< $+ $- $ceil $/ $size $__send__ $length $<= $[] $push $<< $[]= $=== $inspect $<=> $first $reverse $sort $to_proc $compare $call $dup $to_a $sort! $map! $key? $values $zip".split(" "));return function(a,e){function k(){}function q(a){0=== +a.length&&(a=[h]);1=a)))return h;var k=[],t;this.$each.$$p=function(){var a=x(g,"Opal").$destructure(arguments);c.yield1(e,a);k.push(a)};this.$each();if(0===k.length)return h;if(a===h)for(;;)for(b=0,t=k.length;ba)&&this.$raise(x(g,"ArgumentError"), +"attempt to drop negative size");var b=[],c=0;this.$each.$$p=function(){a<=c&&b.push(x(g,"Opal").$destructure(arguments));c++};this.$each();return b},l.$$arity=1);c.def(v,"$drop_while",ja=function(){var a=ja.$$p,b=a||h;a&&(ja.$$p=null);a&&(ja.$$p=null);if(b===h)return this.$enum_for("drop_while");var e=[],d=!0;this.$each.$$p=function(){var a=x(g,"Opal").$destructure(arguments);if(d){var f=c.yield1(b,a);H(f)&&(d=!1,e.push(a))}else e.push(a)};this.$each();return e},ja.$$arity=0);c.def(v,"$each_cons", +Z=function(a){var b=Z.$$p,e=b||h,d;b&&(Z.$$p=null);b&&(Z.$$p=null);m(1!=arguments.length)&&this.$raise(x(g,"ArgumentError"),"wrong number of arguments ("+arguments.length+" for 1)");a=x(g,"Opal").$try_convert(a,x(g,"Integer"),"to_int");m(0>=a)&&this.$raise(x(g,"ArgumentError"),"invalid size");if(e===h)return w(this,"enum_for",["each_cons",a],(d=function(){var b,c=h,c=(d.$$s||this).$enumerator_size();return m(c["$nil?"]())?h:m(m(b=c["$=="](0))?b:"number"===typeof c&&"number"===typeof a?ca&&f.shift();f.length==a&&c.yield1(e,f.slice(0,a))};this.$each();return h},Z.$$arity=1);c.def(v,"$each_entry",E=function(a){var b=E.$$p,e=b||h,d;b&&(E.$$p=null);b&&(E.$$p=null);b=c.slice.call(arguments,0,arguments.length);if(e===h)return w(this,"to_enum",["each_entry"].concat(c.to_a(b)),(d=function(){return(d.$$s||this).$enumerator_size()},d.$$s=this,d.$$arity= +0,d));this.$each.$$p=function(){var a=x(g,"Opal").$destructure(arguments);c.yield1(e,a)};this.$each.apply(this,b);return this},E.$$arity=-1);c.def(v,"$each_slice",ta=function(a){var b=ta.$$p,e=b||h,d;b&&(ta.$$p=null);b&&(ta.$$p=null);a=x(g,"Opal").$coerce_to(a,x(g,"Integer"),"to_int");m(0>=a)&&this.$raise(x(g,"ArgumentError"),"invalid slice size");if(e===h)return w(this,"enum_for",["each_slice",a],(d=function(){var b=d.$$s||this;return m(b["$respond_to?"]("size"))?(b=b.$size(),("number"===typeof b&& +"number"===typeof a?b/a:b["$/"](a)).$ceil()):h},d.$$s=this,d.$$arity=0,d));var f=[];this.$each.$$p=function(){var b=x(g,"Opal").$destructure(arguments);f.push(b);f.length===a&&(c.yield1(e,f),f=[])};this.$each();0 +a)&&this.$raise(x(g,"ArgumentError"),"attempt to take negative size");if(m(0==a))return[];f=0;w(this,"each",[],(e=function(b){var e;e=c.slice.call(arguments,0,arguments.length);d.push(x(g,"Opal").$destructure(e));if(m(a<=++f))c.ret(d);else return h},e.$$s=this,e.$$arity=-1,e));return d}catch(k){if(k===c.returner)return k.$v;throw k;}},t.$$arity=-1);c.alias(v,"flat_map","collect_concat");c.def(v,"$grep",za=function(a){var b=za.$$p,e=b||h,d,f=h;b&&(za.$$p=null);b&&(za.$$p=null);f=[];w(this,"each",[], +(d=function(b){var d,g=h;d=c.slice.call(arguments,0,arguments.length);g=q(d);if(!m(w(a,"__send__",["==="].concat(c.to_a(g)))))return h;e!==h?(m(u(d.$length(),1))&&(d=[d]),d=c.yieldX(e,c.to_a(d))):m(y(d.$length(),1))&&(d=d["$[]"](0));return f.$push(d)},d.$$s=this,d.$$arity=-1,d));return f},za.$$arity=1);c.def(v,"$grep_v",ca=function(a){var b=ca.$$p,e=b||h,d,f=h;b&&(ca.$$p=null);b&&(ca.$$p=null);f=[];w(this,"each",[],(d=function(b){var d,g=h;d=c.slice.call(arguments,0,arguments.length);g=q(d);if(m(w(a, +"__send__",["==="].concat(c.to_a(g)))))return h;e!==h?(m(u(d.$length(),1))&&(d=[d]),d=c.yieldX(e,c.to_a(d))):m(y(d.$length(),1))&&(d=d["$[]"](0));return f.$push(d)},d.$$s=this,d.$$arity=-1,d));return f},ca.$$arity=1);c.def(v,"$group_by",X=function(){var a=X.$$p,b=a||h,e,d,f=h,k=h;a&&(X.$$p=null);a&&(X.$$p=null);if(b===h)return w(this,"enum_for",["group_by"],(e=function(){return(e.$$s||this).$enumerator_size()},e.$$s=this,e.$$arity=0,e));f=M([],{});this.$each.$$p=function(){var a=x(g,"Opal").$destructure(arguments), +e=c.yield1(b,a);(m(d=f["$[]"](e))?d:(k=[e,[]],w(f,"[]=",c.to_a(k)),k[r(k.length,1)]))["$<<"](a)};this.$each();return f},X.$$arity=0);c.def(v,"$include?",na=function(a){try{var b;w(this,"each",[],(b=function(b){var e;e=c.slice.call(arguments,0,arguments.length);if(x(g,"Opal").$destructure(e)["$=="](a))c.ret(!0);else return h},b.$$s=this,b.$$arity=-1,b));return!1}catch(e){if(e===c.returner)return e.$v;throw e;}},na.$$arity=1);c.def(v,"$inject",S=function(a,b){var e=S.$$p,d=e||h;e&&(S.$$p=null);e&&(S.$$p= +null);var f=a;d!==h&&void 0===b?this.$each.$$p=function(){var a=x(g,"Opal").$destructure(arguments);void 0!==f&&(a=c.yieldX(d,[f,a]));f=a}:(void 0===b&&(x(g,"Symbol")["$==="](a)||this.$raise(x(g,"TypeError"),""+a.$inspect()+" is not a Symbol"),b=a,f=void 0),this.$each.$$p=function(){var a=x(g,"Opal").$destructure(arguments);f=void 0===f?a:f.$__send__(b,a)});this.$each();return void 0==f?h:f},S.$$arity=-1);c.def(v,"$lazy",Y=function(){var a;return w(A(x(g,"Enumerator"),"Lazy"),"new",[this,this.$enumerator_size()], +(a=function(a,b){var e;null==a&&(a=h);e=c.slice.call(arguments,1,arguments.length);return w(a,"yield",c.to_a(e))},a.$$s=this,a.$$arity=-2,a))},Y.$$arity=0);c.def(v,"$enumerator_size",U=function(){return m(this["$respond_to?"]("size"))?this.$size():h},U.$$arity=0);c.alias(v,"map","collect");c.def(v,"$max",fa=function(a){var b=fa.$$p,e=b||h,d=this;b&&(fa.$$p=null);b&&(fa.$$p=null);if(void 0===a||a===h){var f,k;d.$each.$$p=function(){var a=x(g,"Opal").$destructure(arguments);void 0===f?f=a:(k=e!==h? +c.yieldX(e,[a,f]):a["$<=>"](f),k===h&&d.$raise(x(g,"ArgumentError"),"comparison failed"),0"](f)&&(d=a,f=e)};this.$each();return void 0===d?h:d},V.$$arity=0);c.alias(v,"member?","include?");c.def(v,"$min",K=function(){var a=K.$$p,b=a||h,c=this;a&&(K.$$p=null);a&&(K.$$p=null);var e;c.$each.$$p=b!==h?function(){var a=x(g,"Opal").$destructure(arguments);if(void 0===e)e=a;else{var d=b(a,e);d===h&&c.$raise(x(g,"ArgumentError"),"comparison failed");0>d&&(e=a)}}:function(){var a=x(g,"Opal").$destructure(arguments); +void 0===e?e=a:0>x(g,"Opal").$compare(a,e)&&(e=a)};c.$each();return void 0===e?h:e},K.$$arity=0);c.def(v,"$min_by",J=function(){var a=J.$$p,b=a||h,e;a&&(J.$$p=null);a&&(J.$$p=null);if(!m(b))return w(this,"enum_for",["min_by"],(e=function(){return(e.$$s||this).$enumerator_size()},e.$$s=this,e.$$arity=0,e));var d,f;this.$each.$$p=function(){var a=x(g,"Opal").$destructure(arguments),e=c.yield1(b,a);void 0===d?(d=a,f=e):0>e["$<=>"](f)&&(d=a,f=e)};this.$each();return void 0===d?h:d},J.$$arity=0);c.def(v, +"$minmax",Ka=function(){var a=Ka.$$p,b=a||h,c,e,d=this;a&&(Ka.$$p=null);a&&(Ka.$$p=null);var b=m(c=b)?c:w(d,"proc",[],(e=function(a,b){null==a&&(a=h);null==b&&(b=h);return a["$<=>"](b)},e.$$s=d,e.$$arity=2,e)),f=h,k=h,t=!0;d.$each.$$p=function(){var a=x(g,"Opal").$destructure(arguments);if(t)f=k=a,t=!1;else{var c=b.$call(f,a);c===h?d.$raise(x(g,"ArgumentError"),"comparison failed"):0c&&(k=a)}};d.$each();return[f,k]}, +Ka.$$arity=0);c.def(v,"$minmax_by",G=function(){var a=G.$$p;a&&(G.$$p=null);a&&(G.$$p=null);return this.$raise(x(g,"NotImplementedError"))},G.$$arity=0);c.def(v,"$none?",qa=function(a){try{var b=qa.$$p,e=b||h,d,f,k;b&&(qa.$$p=null);b&&(qa.$$p=null);m(void 0!==a)?w(this,"each",[],(d=function(b){var e;e=h;e=c.slice.call(arguments,0,arguments.length);e=q(e);if(m(w(a,"public_send",["==="].concat(c.to_a(e)))))c.ret(!1);else return h},d.$$s=this,d.$$arity=-1,d)):e!==h?w(this,"each",[],(f=function(a){var b; +b=c.slice.call(arguments,0,arguments.length);if(m(c.yieldX(e,c.to_a(b))))c.ret(!1);else return h},f.$$s=this,f.$$arity=-1,f)):w(this,"each",[],(k=function(a){var b;b=h;b=c.slice.call(arguments,0,arguments.length);b=x(g,"Opal").$destructure(b);if(m(b))c.ret(!1);else return h},k.$$s=this,k.$$arity=-1,k));return!0}catch(t){if(t===c.returner)return t.$v;throw t;}},qa.$$arity=-1);c.def(v,"$one?",la=function(a){try{var b=la.$$p,e=b||h,d,f,k,t=h;b&&(la.$$p=null);b&&(la.$$p=null);t=0;m(void 0!==a)?w(this, +"each",[],(d=function(b){var e;e=h;e=c.slice.call(arguments,0,arguments.length);e=q(e);if(m(w(a,"public_send",["==="].concat(c.to_a(e)))))if(t=D(t,1),m(u(t,1)))c.ret(!1);else return h;else return h},d.$$s=this,d.$$arity=-1,d)):e!==h?w(this,"each",[],(f=function(a){var b;b=c.slice.call(arguments,0,arguments.length);if(!m(c.yieldX(e,c.to_a(b))))return h;t=D(t,1);if(m(u(t,1)))c.ret(!1);else return h},f.$$s=this,f.$$arity=-1,f)):w(this,"each",[],(k=function(a){var b;b=c.slice.call(arguments,0,arguments.length); +if(!m(x(g,"Opal").$destructure(b)))return h;t=D(t,1);if(m(u(t,1)))c.ret(!1);else return h},k.$$s=this,k.$$arity=-1,k));return t["$=="](1)}catch(p){if(p===c.returner)return p.$v;throw p;}},la.$$arity=-1);c.def(v,"$partition",Da=function(){var a=Da.$$p,b=a||h,e;a&&(Da.$$p=null);a&&(Da.$$p=null);if(b===h)return w(this,"enum_for",["partition"],(e=function(){return(e.$$s||this).$enumerator_size()},e.$$s=this,e.$$arity=0,e));var d=[],f=[];this.$each.$$p=function(){var a=x(g,"Opal").$destructure(arguments), +e=c.yield1(b,a);m(e)?d.push(a):f.push(a)};this.$each();return[d,f]},Da.$$arity=0);c.alias(v,"reduce","inject");c.def(v,"$reject",aa=function(){var a=aa.$$p,b=a||h,e;a&&(aa.$$p=null);a&&(aa.$$p=null);if(b===h)return w(this,"enum_for",["reject"],(e=function(){return(e.$$s||this).$enumerator_size()},e.$$s=this,e.$$arity=0,e));var d=[];this.$each.$$p=function(){var a=x(g,"Opal").$destructure(arguments),e=c.yield1(b,a);H(e)&&d.push(a)};this.$each();return d},aa.$$arity=0);c.def(v,"$reverse_each",ba=function(){var a= +ba.$$p,b=a||h,e;a&&(ba.$$p=null);a&&(ba.$$p=null);if(b===h)return w(this,"enum_for",["reverse_each"],(e=function(){return(e.$$s||this).$enumerator_size()},e.$$s=this,e.$$arity=0,e));var d=[];this.$each.$$p=function(){d.push(arguments)};this.$each();for(a=d.length-1;0<=a;a--)c.yieldX(b,d[a]);return d},ba.$$arity=0);c.alias(v,"select","find_all");c.def(v,"$slice_before",ma=function(a){var b=ma.$$p,e=b||h,d;b&&(ma.$$p=null);b&&(ma.$$p=null);m(void 0===a&&e===h)&&this.$raise(x(g,"ArgumentError"),"both pattern and block are given"); +m(void 0!==a&&e!==h||1"](b)},c.$$s=this,c.$$arity=2,c)));return w(e,"sort",[],b.$to_proc())},ea.$$arity=0);c.def(v,"$sort_by",R=function(){var a=R.$$p,b=a||h,e,d,f,k,t=h;a&&(R.$$p=null);a&&(R.$$p=null);if(b===h)return w(this,"enum_for",["sort_by"],(e=function(){return(e.$$s||this).$enumerator_size()},e.$$s=this,e.$$arity=0,e));t=w(this,"map",[],(d=function(){var a=h,a=x(g,"Opal").$destructure(arguments); +return[c.yield1(b,a),a]},d.$$s=this,d.$$arity=0,d));w(t,"sort!",[],(f=function(a,b){null==a&&(a=h);null==b&&(b=h);return a[0]["$<=>"](b[0])},f.$$s=this,f.$$arity=2,f));return w(t,"map!",[],(k=function(a){null==a&&(a=h);return a[1]},k.$$s=this,k.$$arity=1,k))},R.$$arity=0);c.def(v,"$sum",Ea=function(a){var b,e=Ea.$$p,d=e||h,f=h;e&&(Ea.$$p=null);null==a&&(a=0);f=a;w(this,"each",[],(b=function(a){var b;b=h;b=c.slice.call(arguments,0,arguments.length);b=d!==h?c.yieldX(d,c.to_a(b)):x(g,"Opal").$destructure(b); +return f=D(f,b)},b.$$s=this,b.$$arity=-1,b));return f},Ea.$$arity=-1);c.def(v,"$take",Aa=function(a){return this.$first(a)},Aa.$$arity=1);c.def(v,"$take_while",Ba=function(){try{var a=Ba.$$p,b=a||h,e,d=h;a&&(Ba.$$p=null);a&&(Ba.$$p=null);if(!m(b))return this.$enum_for("take_while");d=[];return w(this,"each",[],(e=function(a){var e;e=h;e=c.slice.call(arguments,0,arguments.length);e=x(g,"Opal").$destructure(e);m(c.yield1(b,e))||c.ret(d);return d.push(e)},e.$$s=this,e.$$arity=-1,e))}catch(f){if(f=== +c.returner)return f.$v;throw f;}},Ba.$$arity=0);c.def(v,"$uniq",wa=function(){var a=wa.$$p,b=a||h,e,d=h;a&&(wa.$$p=null);a&&(wa.$$p=null);d=M([],{});w(this,"each",[],(e=function(a){var e,f=e=h;e=h;e=c.slice.call(arguments,0,arguments.length);e=x(g,"Opal").$destructure(e);f=b!==h?c.yield1(b,e):e;if(m(d["$key?"](f)))return h;e=[f,e];w(d,"[]=",c.to_a(e));return e[r(e.length,1)]},e.$$s=this,e.$$arity=-1,e));return d.$values()},wa.$$arity=0);c.alias(v,"to_a","entries");c.def(v,"$zip",oa=function(a){var b= +oa.$$p;b&&(oa.$$p=null);b&&(oa.$$p=null);b=c.slice.call(arguments,0,arguments.length);return w(this.$to_a(),"zip",c.to_a(b))},oa.$$arity=-1)}(l[0],l)};Opal.modules["corelib/enumerator"]=function(c){function u(c,h){return"number"===typeof c&&"number"===typeof h?c+h:c["$+"](h)}function D(c,h){return"number"===typeof c&&"number"===typeof h?c")},p.$$arity=0);(function(a,$super,b){function e(){}a=e=n(a,$super,"Generator",e);var f=a.prototype,g=[a].concat(b),k,p;f.block=l;a.$include(h(g,"Enumerable"));c.def(a,"$initialize",k=function(){var a=k.$$p,b=a||l;a&&(k.$$p=null);a&&(k.$$p=null);m(b)||this.$raise(h(g,"LocalJumpError"),"no block given");return this.block=b},k.$$arity=0);return(c.def(a,"$each",p=function(a){var b= +p.$$p,e=b||l,d=l;b&&(p.$$p=null);b&&(p.$$p=null);b=c.slice.call(arguments,0,arguments.length);d=w(h(g,"Yielder"),"new",[],e.$to_proc());try{b.unshift(d),c.yieldX(this.block,b)}catch(f){if(f===A)return A.$v;throw f;}return this},p.$$arity=-1),l)&&"each"})(q[0],null,q);(function(a,$super,b){function e(){}a=e=n(a,$super,"Yielder",e);var f=a.prototype;[a].concat(b);var g,k,p;f.block=l;c.def(a,"$initialize",g=function(){var a=g.$$p,b=a||l;a&&(g.$$p=null);a&&(g.$$p=null);return this.block=b},g.$$arity= +0);c.def(a,"$yield",k=function(a){var b;b=c.slice.call(arguments,0,arguments.length);b=c.yieldX(this.block,b);if(b===A)throw A;return b},k.$$arity=-1);return(c.def(a,"$<<",p=function(a){var b;b=c.slice.call(arguments,0,arguments.length);w(this,"yield",c.to_a(b));return this},p.$$arity=-1),l)&&"<<"})(q[0],null,q);return function(a,$super,b){function e(){}a=e=n(a,$super,"Lazy",e);var f=a.prototype,g=[a].concat(b),k,p,q,v,F,B,r,x,L,t,y,ca,X;f.enumerator=l;(function(a,$super,b){function c(){}[c=n(a,$super, +"StopLazyError",c)].concat(b);return l})(g[0],h(g,"Exception"),g);c.def(a,"$initialize",k=function(a,b){var e=k.$$p,d=e||l,f;e&&(k.$$p=null);e&&(k.$$p=null);null==b&&(b=l);d===l&&this.$raise(h(g,"ArgumentError"),"tried to call lazy new without a block");this.enumerator=a;return w(this,c.find_super_dispatcher(this,"initialize",k,!1),[b],(f=function(b,e){var k=f.$$s||this,t,p;null==b&&(b=l);t=c.slice.call(arguments,1,arguments.length);try{return w(a,"each",c.to_a(t),(p=function(a){var e;e=c.slice.call(arguments, +0,arguments.length);e.unshift(b);c.yieldX(d,e)},p.$$s=k,p.$$arity=-1,p))}catch(q){if(c.rescue(q,[h(g,"Exception")]))try{return l}finally{c.pop_exception()}else throw q;}},f.$$s=this,f.$$arity=-2,f))},k.$$arity=-2);c.alias(a,"force","to_a");c.def(a,"$lazy",p=function(){return this},p.$$arity=0);c.def(a,"$collect",q=function(){var a=q.$$p,b=a||l,e;a&&(q.$$p=null);a&&(q.$$p=null);m(b)||this.$raise(h(g,"ArgumentError"),"tried to call lazy map without a block");return w(h(g,"Lazy"),"new",[this,this.$enumerator_size()], +(e=function(a,e){var d;null==a&&(a=l);d=c.slice.call(arguments,1,arguments.length);d=c.yieldX(b,d);a.$yield(d)},e.$$s=this,e.$$arity=-2,e))},q.$$arity=0);c.def(a,"$collect_concat",v=function(){var a=v.$$p,b=a||l,e;a&&(v.$$p=null);a&&(v.$$p=null);m(b)||this.$raise(h(g,"ArgumentError"),"tried to call lazy map without a block");return w(h(g,"Lazy"),"new",[this,l],(e=function(a,d){var f=e.$$s||this,k,t,p;null==a&&(a=l);k=c.slice.call(arguments,1,arguments.length);k=c.yieldX(b,k);k["$respond_to?"]("force")&& +k["$respond_to?"]("each")?w(k,"each",[],(t=function(b){null==b&&(b=l);return a.$yield(b)},t.$$s=f,t.$$arity=1,t)):h(g,"Opal").$try_convert(k,h(g,"Array"),"to_ary")===l?a.$yield(k):w(k,"each",[],(p=function(b){null==b&&(b=l);return a.$yield(b)},p.$$s=f,p.$$arity=1,p))},e.$$s=this,e.$$arity=-2,e))},v.$$arity=0);c.def(a,"$drop",F=function(a){var b,e=l,d=e=l;a=h(g,"Opal").$coerce_to(a,h(g,"Integer"),"to_int");m(D(a,0))&&this.$raise(h(g,"ArgumentError"),"attempt to drop negative size");e=this.$enumerator_size(); +e=m(h(g,"Integer")["$==="](e))?m(D(a,e))?a:e:e;d=0;return w(h(g,"Lazy"),"new",[this,e],(b=function(b,e){var f;null==b&&(b=l);f=c.slice.call(arguments,1,arguments.length);return m(D(d,a))?d=u(d,1):w(b,"yield",c.to_a(f))},b.$$s=this,b.$$arity=-2,b))},F.$$arity=1);c.def(a,"$drop_while",B=function(){var a=B.$$p,b=a||l,e,d=l;a&&(B.$$p=null);a&&(B.$$p=null);m(b)||this.$raise(h(g,"ArgumentError"),"tried to call lazy drop_while without a block");d=!0;return w(h(g,"Lazy"),"new",[this,l],(e=function(a,e){var f; +null==a&&(a=l);f=c.slice.call(arguments,1,arguments.length);if(m(d)){var g=c.yieldX(b,f);H(g)&&(d=!1,w(a,"yield",c.to_a(f)))}else return w(a,"yield",c.to_a(f))},e.$$s=this,e.$$arity=-2,e))},B.$$arity=0);c.def(a,"$enum_for",r=function(a,b){var e=r.$$p,d=e||l,f;e&&(r.$$p=null);e&&(r.$$p=null);e=c.slice.call(arguments,0,arguments.length);0"},X.$$arity=0),l)&&"inspect"}(q[0],r,q)}(y[0],null,y)};Opal.modules["corelib/numeric"]=function(c){function u(c,h){return"number"=== +typeof c&&"number"===typeof h?c-h:c["$-"](h)}function D(c,h){return"number"===typeof c&&"number"===typeof h?c*h:c["$*"](h)}function r(c,h){return"number"===typeof c&&"number"===typeof h?c".split(" ")); +l.$require("corelib/comparable");return function(h,$super,a){function e(){}h=e=m(h,$super,"Numeric",e);var k=[h].concat(a),q,v,g,B,b,F,p,N,P,z,d,f,l,ja,Z,E,ta,ha,ra,va,pa,L,t,za,ca,X,na,S,Y,U,fa,V,K,J,Ka,G,qa;h.$include(n(k,"Comparable"));c.def(h,"$coerce",q=function(a){return w(a["$instance_of?"](this.$class()))?[a,this]:[this.$Float(a),this.$Float(this)]},q.$$arity=1);c.def(h,"$__coerced__",v=function(a,b){var e,d,f=A;d=e=A;if(w(b["$respond_to?"]("coerce")))return d=b.$coerce(this),e=c.to_ary(d), +f=null==e[0]?A:e[0],e=null==e[1]?A:e[1],d,f.$__send__(a,e);d=a;return"+"["$==="](d)||"-"["$==="](d)||"*"["$==="](d)||"/"["$==="](d)||"%"["$==="](d)||"&"["$==="](d)||"|"["$==="](d)||"^"["$==="](d)||"**"["$==="](d)?this.$raise(n(k,"TypeError"),""+b.$class()+" can't be coerced into Numeric"):">"["$==="](d)||">="["$==="](d)||"<"["$==="](d)||"<="["$==="](d)||"<=>"["$==="](d)?this.$raise(n(k,"ArgumentError"),"comparison of "+this.$class()+" with "+b.$class()+" failed"):A},v.$$arity=2);c.def(h,"$<=>",g= +function(a){return w(this["$equal?"](a))?0:A},g.$$arity=1);c.def(h,"$+@",B=function(){return this},B.$$arity=0);c.def(h,"$-@",b=function(){return u(0,this)},b.$$arity=0);c.def(h,"$%",F=function(a){return u(this,D(a,this.$div(a)))},F.$$arity=1);c.def(h,"$abs",p=function(){return r(this,0)?this["$-@"]():this},p.$$arity=0);c.def(h,"$abs2",N=function(){return D(this,this)},N.$$arity=0);c.def(h,"$angle",P=function(){return r(this,0)?x(n(k,"Math"),"PI"):0},P.$$arity=0);c.alias(h,"arg","angle");c.def(h, +"$ceil",z=function(a){null==a&&(a=0);return this.$to_f().$ceil(a)},z.$$arity=-1);c.def(h,"$conj",d=function(){return this},d.$$arity=0);c.alias(h,"conjugate","conj");c.def(h,"$denominator",f=function(){return this.$to_r().$denominator()},f.$$arity=0);c.def(h,"$div",l=function(a){a["$=="](0)&&this.$raise(n(k,"ZeroDivisionError"),"divided by o");return y(this,a).$floor()},l.$$arity=1);c.def(h,"$divmod",ja=function(a){return[this.$div(a),this["$%"](a)]},ja.$$arity=1);c.def(h,"$fdiv",Z=function(a){return y(this.$to_f(), +a)},Z.$$arity=1);c.def(h,"$floor",E=function(a){null==a&&(a=0);return this.$to_f().$floor(a)},E.$$arity=-1);c.def(h,"$i",ta=function(){return this.$Complex(0,this)},ta.$$arity=0);c.def(h,"$imag",ha=function(){return 0},ha.$$arity=0);c.alias(h,"imaginary","imag");c.def(h,"$integer?",ra=function(){return!1},ra.$$arity=0);c.alias(h,"magnitude","abs");c.alias(h,"modulo","%");c.def(h,"$nonzero?",va=function(){return w(this["$zero?"]())?A:this},va.$$arity=0);c.def(h,"$numerator",pa=function(){return this.$to_r().$numerator()}, +pa.$$arity=0);c.alias(h,"phase","arg");c.def(h,"$polar",L=function(){return[this.$abs(),this.$arg()]},L.$$arity=0);c.def(h,"$quo",t=function(a){return y(n(k,"Opal")["$coerce_to!"](this,n(k,"Rational"),"to_r"),a)},t.$$arity=1);c.def(h,"$real",za=function(){return this},za.$$arity=0);c.def(h,"$real?",ca=function(){return!0},ca.$$arity=0);c.def(h,"$rect",X=function(){return[this,0]},X.$$arity=0);c.alias(h,"rectangular","rect");c.def(h,"$round",na=function(a){return this.$to_f().$round(a)},na.$$arity= +-1);c.def(h,"$to_c",S=function(){return this.$Complex(this,0)},S.$$arity=0);c.def(h,"$to_int",Y=function(){return this.$to_i()},Y.$$arity=0);c.def(h,"$truncate",U=function(a){null==a&&(a=0);return this.$to_f().$truncate(a)},U.$$arity=-1);c.def(h,"$zero?",fa=function(){return this["$=="](0)},fa.$$arity=0);c.def(h,"$positive?",V=function(){return"number"===typeof this?0"](0)},V.$$arity=0);c.def(h,"$negative?",K=function(){return r(this,0)},K.$$arity=0);c.def(h,"$dup",J=function(){return this}, +J.$$arity=0);c.def(h,"$clone",Ka=function(a){if(null==a)H([],{});else if(!a.$$is_hash)throw c.ArgumentError.$new("expected kwargs");return this},Ka.$$arity=-1);c.def(h,"$finite?",G=function(){return!0},G.$$arity=0);return(c.def(h,"$infinite?",qa=function(){return A},qa.$$arity=0),A)&&"infinite?"}(h[0],null,h)};Opal.modules["corelib/array"]=function(c){function u(c,h){return"number"===typeof c&&"number"===typeof h?c>h:c["$>"](h)}var D=c.top,r=[],y=c.nil,l=c.const_get_qualified,h=c.const_get_relative, +A=c.klass,x=c.truthy,n=c.hash2,m=c.send,w=c.gvars;c.add_stubs("$require $include $to_a $warn $raise $replace $respond_to? $to_ary $coerce_to $coerce_to? $=== $join $to_str $class $hash $<=> $== $object_id $inspect $enum_for $bsearch_index $to_proc $nil? $coerce_to! $> $* $enumerator_size $empty? $size $map $equal? $dup $each $[] $dig $eql? $length $begin $end $exclude_end? $flatten $__id__ $to_s $new $max $min $! $>= $** $delete_if $reverse $rotate $rand $at $keep_if $shuffle! $< $sort $sort_by $!= $times $[]= $- $<< $values $is_a? $last $first $upto $reject $pristine $singleton_class".split(" ")); +D.$require("corelib/enumerable");D.$require("corelib/numeric");return function(r,$super,D){function a(){}function e(a,b){return b.$$name===c.Array?a:b.$allocate().$replace(a.$to_a())}function k(a,b){var d=a.length,f,g,k;f=b.excl;g=c.Opal.$coerce_to(b.begin,c.Integer,"to_int");k=c.Opal.$coerce_to(b.end,c.Integer,"to_int");if(0>g&&(g+=d,0>g)||g>d)return y;if(0>k&&(k+=d,0>k))return[];f||(k+=1);d=a.slice(g,k);return e(d,a.$class())}function q(a,b,d){var f=a.length;b=c.Opal.$coerce_to(b,c.Integer,"to_int"); +if(0>b&&(b+=f,0>b))return y;if(void 0===d)return b>=f||0>b?y:a[b];d=c.Opal.$coerce_to(d,c.Integer,"to_int");if(0>d||b>f||0>b)return y;b=a.slice(b,b+d);return e(b,a.$class())}function v(a,b){return a===b||0===b?1:0b?v(a-1,b-1)+v(a-1,b):0}var g=a=A(r,$super,"Array",a),B=[g].concat(D),b,F,p,N,P,z,d,f,ya,ja,Z,E,ta,ha,ra,va,pa,L,t,za,ca,X,na,S,Y,U,fa,V,K,J,Ka,G,qa,la,Da,aa,ba,ma,sa,da,ea,R,Ea,Aa,Ba,wa,oa,Fa,Ua,Qa,xa,La,Ma,Ca,Ga,Ha,Ia,Pa,Ra,Na,Oa,Va,C,W,Ja,ua,ia,ga,O,Sa,Ta,T,ka,jb,kb,I,ib,Ya,Za,ab, +lb,bb,mb,nb,ob,cb,db,gb,fb,Xa,eb,Wa,hb;g.$include(h(B,"Enumerable"));c.defineProperty(Array.prototype,"$$is_array",!0);c.defs(g,"$[]",b=function(a){var b;b=c.slice.call(arguments,0,arguments.length);return e(b,this)},b.$$arity=-1);c.def(g,"$initialize",F=function(a,b){var c=F.$$p,e=c||y;c&&(F.$$p=null);c&&(F.$$p=null);null==a&&(a=y);null==b&&(b=y);b!==y&&e!==y&&this.$warn("warning: block supersedes default value argument");a>l(h(B,"Integer"),"MAX")&&this.$raise(h(B,"ArgumentError"),"array size too big"); +2a&&this.$raise(h(B,"ArgumentError"),"negative array size");this.splice(0,this.length);var d;if(e===y)for(c=0;ca)&&this.$raise(h(B,"ArgumentError"),"negative argument");for(var b=[],c=this.$to_a(),d=0;d",ja=function(a){if(x(h(B,"Array")["$==="](a)))a=a.$to_a();else if(x(a["$respond_to?"]("to_ary")))a=a.$to_ary().$to_a();else return y;if(this.$hash()===a.$hash())return 0;for(var b=Math.min(this.length,a.length),c=0;c"](a[c]);if(0!==e)return e}return this.length["$<=>"](a.length)},ja.$$arity=1);c.def(g,"$==",Z=function(a){function b(a, +e){var d,f,g,k;if(a===e)return!0;if(!e.$$is_array)return h(B,"Opal")["$respond_to?"](e,"to_ary")?e["$=="](a):!1;a.constructor!==Array&&(a=a.$to_a());e.constructor!==Array&&(e=e.$to_a());if(a.length!==e.length)return!1;c[a.$object_id()]=!0;d=0;for(f=a.length;dc&&(c+=f,0>c&&this.$raise(h(B,"RangeError"),""+a.$inspect()+" out of range"));0>d&&(d+=f);g||(d+=1);if(c>f)for(;fd?this.splice.apply(this, +[c,0].concat(e)):this.splice.apply(this,[c,d-c].concat(e))}else{x(void 0===c)?d=1:(d=b,b=c,e=x(h(B,"Array")["$==="](b))?b.$to_a():x(b["$respond_to?"]("to_ary"))?b.$to_ary().$to_a():[b]);a=h(B,"Opal").$coerce_to(a,h(B,"Integer"),"to_int");d=h(B,"Opal").$coerce_to(d,h(B,"Integer"),"to_int");0>a&&(g=a,a+=f,0>a&&this.$raise(h(B,"IndexError"),"index "+g+" too small for array; minimum "+-this.length));0>d&&this.$raise(h(B,"IndexError"),"negative length ("+d+")");if(a>f)for(;fa&&(a+=this.length);return 0>a||a>=this.length?y:this[a]},va.$$arity=1);c.def(g,"$bsearch_index",pa=function(){var a=pa.$$p,b=a||y;a&&(pa.$$p=null);a&&(pa.$$p=null);if(b===y)return this.$enum_for("bsearch_index");for(var a=0,e=this.length,d,f,g=!1,k=y;af}else this.$raise(h(B,"TypeError"),"wrong argument type "+f.$class()+" (must be numeric, true, false or nil)"); +g?e=d:a=d+1}return k},pa.$$arity=0);c.def(g,"$bsearch",L=function(){var a=L.$$p,b=a||y,c=y;a&&(L.$$p=null);a&&(L.$$p=null);if(b===y)return this.$enum_for("bsearch");c=m(this,"bsearch_index",[],b.$to_proc());return null!=c&&c.$$is_number?this[c]:c},L.$$arity=0);c.def(g,"$cycle",t=function(a){var b=t.$$p,e=b||y,d,f;b&&(t.$$p=null);b&&(t.$$p=null);null==a&&(a=y);if(e===y)return m(this,"enum_for",["cycle",a],(d=function(){var b=d.$$s||this;if(x(a["$nil?"]()))return l(h(B,"Float"),"INFINITY");a=h(B,"Opal")["$coerce_to!"](a, +h(B,"Integer"),"to_int");return x(u(a,0))?(b=b.$enumerator_size(),"number"===typeof b&&"number"===typeof a?b*a:b["$*"](a)):0},d.$$s=this,d.$$arity=0,d));if(x(x(f=this["$empty?"]())?f:a["$=="](0)))return y;if(a===y)for(;;)for(b=0,f=this.length;b=a)return this;for(;0a&&(a+=this.length);if(0>a||a>=this.length)return y;var b=this[a];this.splice(a,1);return b},Ka.$$arity=1);c.def(g,"$delete_if",G=function(){var a=G.$$p,b=a||y,c;a&&(G.$$p=null);a&&(G.$$p=null);if(b===y)return m(this,"enum_for",["delete_if"],(c=function(){return(c.$$s||this).$size()},c.$$s=this,c.$$arity=0,c));for(var a=0,e=this.length,d;aa&&this.$raise(h(B,"ArgumentError"));return this.slice(a)},la.$$arity=1);c.def(g,"$dup",Da=function(){var a= +Da.$$p,b=y,e=y,d=y;a&&(Da.$$p=null);e=0;d=arguments.length;for(b=Array(d);ea&&(a+=this.length); +if(0<=a&&ag)&&(g+=this.length),x(0>g)&&this.$raise(h(B,"RangeError"),""+d.$inspect()+" out of range"),f=h(B,"Opal").$coerce_to(d.$end(),h(B,"Integer"),"to_int"),x(0>f)&&(f+=this.length),x(d["$exclude_end?"]())||(f+=1),x(f<=g))return this}else if(x(d))if(g=h(B,"Opal").$coerce_to(d,h(B,"Integer"),"to_int"),x(0>g)&&(g+=this.length),x(0>g)&&(g=0),x(f)){f=h(B,"Opal").$coerce_to(f,h(B,"Integer"),"to_int");if(x(0== +f))return this;f+=g}else f=this.length;else g=0,f=this.length;if(x(g>this.length))for(d=this.length;dthis.length)&&(this.length=f);if(x(e))for(;ga&&this.$raise(h(B,"ArgumentError"),"negative array size");return this.slice(0,a)},R.$$arity=-1);c.def(g,"$flatten",Ea=function(a){function b(a, +e){var d=[],f,g,k,t;a=a.$to_a();f=0;for(g=a.length;fa&&(a+=this.length+1,0>a&&this.$raise(h(B,"IndexError"),""+a+" is out of bounds"));if(a>this.length)for(var d=this.length;da&&this.$raise(h(B,"ArgumentError"),"negative array size");a>this.length&&(a=this.length);return this.slice(this.length-a,this.length)},La.$$arity=-1);c.def(g,"$length",Ma=function(){return this.length},Ma.$$arity=0);c.alias(g,"map","collect");c.alias(g,"map!","collect!"); +c.def(g,"$max",Ca=function(a){var b=Ca.$$p,c=b||y;b&&(Ca.$$p=null);b&&(Ca.$$p=null);return m(this.$each(),"max",[a],c.$to_proc())},Ca.$$arity=-1);c.def(g,"$min",Ga=function(){var a=Ga.$$p,b=a||y;a&&(Ga.$$p=null);a&&(Ga.$$p=null);return m(this.$each(),"min",[],b.$to_proc())},Ga.$$arity=0);c.def(g,"$permutation",Ha=function(a){var b=Ha.$$p,e=b||y,d,f=this,g=y,k=y;b&&(Ha.$$p=null);b&&(Ha.$$p=null);if(e===y)return m(f,"enum_for",["permutation",a],(d=function(){for(var b=d.$$s||this,c=b.length,b=void 0=== +a?b.length:a,e=0<=b?1:0;b;)e*=c,c--,b--;return e},d.$$s=f,d.$$arity=0,d));var t,p;a=void 0===a?f.length:h(B,"Opal").$coerce_to(a,h(B,"Integer"),"to_int");if(!(0>a||f.length="](0))? +a.$size()["$**"](g):0},e.$$s=this,e.$$arity=0,e));b(g,[],this.slice());return this},Ia.$$arity=1);c.def(g,"$pop",Pa=function(a){if(x(void 0===a))return x(0===this.length)?y:this.pop();a=h(B,"Opal").$coerce_to(a,h(B,"Integer"),"to_int");x(0>a)&&this.$raise(h(B,"ArgumentError"),"negative array size");return x(0===this.length)?[]:x(a>this.length)?this.splice(0,this.length):this.splice(this.length-a,this.length)},Pa.$$arity=-1);c.def(g,"$product",Ra=function(a){var b=Ra.$$p,e=b||y,d;b&&(Ra.$$p=null); +b&&(Ra.$$p=null);d=c.slice.call(arguments,0,arguments.length);var b=e!==y?null:[],f=d.length+1,g=Array(f),k=Array(f),t=Array(f),p,T;T=1;t[0]=this;for(p=1;p--p)break a;g[p]++}}return b|| +this},Ra.$$arity=-1);c.def(g,"$push",Na=function(a){var b;b=c.slice.call(arguments,0,arguments.length);for(var e=0,d=b.length;e=this.length);b--){if(this[b]["$=="](a))return b}else if(c!==y)for(b=this.length-1;0<=b&&!(b>=this.length);b--){if(a=c(this[b]),!1!==a&&a!==y)return b}else if(null==a)return this.$enum_for("rindex");return y},ga.$$arity= +-1);c.def(g,"$rotate",O=function(a){null==a&&(a=1);a=h(B,"Opal").$coerce_to(a,h(B,"Integer"),"to_int");var b,c;if(1===this.length)return this.slice();if(0===this.length)return[];b=this.slice();c=a%b.length;a=b.slice(c);b=b.slice(0,c);return a.concat(b)},O.$$arity=-1);c.def(g,"$rotate!",Sa=function(a){var b=y;null==a&&(a=1);if(0===this.length||1===this.length)return this;a=h(B,"Opal").$coerce_to(a,h(B,"Integer"),"to_int");b=this.$rotate(a);return this.$replace(b)},Sa.$$arity=-1);(function(a,$super, +b){function e(){}a=e=A(a,$super,"SampleRandom",e);var d=a.prototype,f=[a].concat(b),g,k;d.rng=y;c.def(a,"$initialize",g=function(a){return this.rng=a},g.$$arity=1);return(c.def(a,"$rand",k=function(a){var b=y,b=h(f,"Opal").$coerce_to(this.rng.$rand(a),h(f,"Integer"),"to_int");x(0>b)&&this.$raise(h(f,"RangeError"),"random value must be >= 0");x(ba:c)&&this.$raise(h(B,"ArgumentError"),"count must be greater than 0");x(b)&&(d=b["$[]"]("random"));d=x(x(c=d)?d["$respond_to?"]("rand"):c)?h(B,"SampleRandom").$new(d): +h(B,"Kernel");if(!x(a))return this[d.$rand(this.length)];var f,g,k,t;a>this.length&&(a=this.length);switch(a){case 0:return[];case 1:return[this[d.$rand(this.length)]];case 2:return g=d.$rand(this.length),k=d.$rand(this.length),g===k&&(k=0===g?g+1:g-1),[this[g],this[k]];default:if(3a)&&this.$raise(h(B,"ArgumentError"),"negative array size"); +return x(0===this.length)?[]:this.splice(0,a)},jb.$$arity=-1);c.alias(g,"size","length");c.def(g,"$shuffle",kb=function(a){return this.$dup().$to_a()["$shuffle!"](a)},kb.$$arity=-1);c.def(g,"$shuffle!",I=function(a){var b,c=this.length,e;void 0!==a&&(a=h(B,"Opal")["$coerce_to?"](a,h(B,"Hash"),"to_hash"),a!==y&&(a=a["$[]"]("random"),a!==y&&a["$respond_to?"]("rand")&&(b=a)));for(;c;)b?(a=b.$rand(c).$to_int(),0>a&&this.$raise(h(B,"RangeError"),"random number too small "+a),a>=c&&this.$raise(h(B,"RangeError"), +"random number too big "+a)):a=this.$rand(c),e=this[--c],this[c]=this[a],this[a]=e;return this},I.$$arity=-1);c.alias(g,"slice","[]");c.def(g,"$slice!",ib=function(a,b){var c=y,e=y,d=y,f=y,e=y;if(x(void 0===b))if(x(h(B,"Range")["$==="](a))){e=a;c=this["$[]"](e);d=h(B,"Opal").$coerce_to(e.$begin(),h(B,"Integer"),"to_int");f=h(B,"Opal").$coerce_to(e.$end(),h(B,"Integer"),"to_int");0>d&&(d+=this.length);0>f?f+=this.length:f>=this.length&&(f=this.length-1,e.excl&&(f+=1));var g=f-d;e.excl?--f:g+=1;de&&(e+=this.length);if(0>e||e>=this.length)return y;c=this[e];0===e?this.shift():this.splice(e,1)}else{e=h(B,"Opal").$coerce_to(a,h(B,"Integer"),"to_int");b=h(B,"Opal").$coerce_to(b,h(B,"Integer"),"to_int");if(0>b)return y;c=this["$[]"](e,b);0>e&&(e+=this.length);e+b>this.length&&(b=this.length-e);e"](b)});return c.slice().sort(function(a,e){var d=b(a,e);d===y&&c.$raise(h(B,"ArgumentError"),"comparison of "+a.$inspect()+" with "+e.$inspect()+" failed");return u(d,0)?1:("number"===typeof d?0>d:d["$<"](0))?-1:0})},Ya.$$arity=0);c.def(g,"$sort!",Za=function(){var a=Za.$$p,b=a||y;a&&(Za.$$p=null);a&&(Za.$$p=null);for(var a=b!==y?m(this.slice(),"sort",[],b.$to_proc()):this.slice().$sort(), +b=this.length=0,c=a.length;ba&&this.$raise(h(B,"ArgumentError"));return this.slice(0,a)},lb.$$arity=1);c.def(g,"$take_while",bb=function(){var a=bb.$$p, +b=a||y;a&&(bb.$$p=null);a&&(bb.$$p=null);for(var a=[],c=0,e=this.length,d,f;cg)return g+=b.length,y;0>f&&(f+=b.length);a["$exclude_end?"]()&&f--;return f=h:c["$>="](h)}var D=c.top,r=[],y=c.nil,l=c.const_get_relative,h=c.klass,A=c.send,x=c.hash2,n=c.truthy;c.add_stubs("$require $include $coerce_to? $[] $merge! $allocate $raise $coerce_to! $each $fetch $>= $> $== $compare_by_identity $lambda? $abs $arity $enum_for $size $respond_to? $class $dig $new $inspect $map $to_proc $flatten $eql? $default $dup $default_proc $default_proc= $- $default= $proc".split(" ")); +D.$require("corelib/enumerable");return function(m,$super,r){function M(){}m=M=h(m,$super,"Hash",M);var D=m.prototype,a=[m].concat(r),e,k,q,v,g,B,b,F,p,N,P,z,d,f,ya,ja,Z,E,ta,ha,ra,va,pa,L,t,za,ca,X,na,S,Y,U,fa,V,K,J,Ka,G,qa,la,Da,aa,ba,ma,sa,da,ea,R,Ea,Aa,Ba,wa,oa,Fa,Ua,Qa,xa,La,Ma,Ca,Ga,Ha;m.$include(l(a,"Enumerable"));D.$$is_hash=!0;c.defs(m,"$[]",e=function(b){var e;e=c.slice.call(arguments,0,arguments.length);var d,f=e.length,g;if(1===f){d=l(a,"Opal")["$coerce_to?"](e["$[]"](0),l(a,"Hash"),"to_hash"); +if(d!==y)return this.$allocate()["$merge!"](d);e=l(a,"Opal")["$coerce_to?"](e["$[]"](0),l(a,"Array"),"to_ary");e===y&&this.$raise(l(a,"ArgumentError"),"odd number of arguments for Hash");f=e.length;d=this.$allocate();for(g=0;g=",B=function(b){var c,e=y;b=l(a,"Opal")["$coerce_to!"](b,l(a,"Hash"),"to_hash");if(this.$$keys.length",b=function(b){b=l(a,"Opal")["$coerce_to!"](b,l(a,"Hash"),"to_hash");return this.$$keys.length<=b.$$keys.length?!1:u(this,b)},b.$$arity=1);c.def(m,"$<",F=function(b){b=l(a,"Opal")["$coerce_to!"](b,l(a,"Hash"),"to_hash");return"number"===typeof b&&"number"===typeof this?b>this:b["$>"](this)},F.$$arity=1);c.def(m, +"$<=",p=function(b){b=l(a,"Opal")["$coerce_to!"](b,l(a,"Hash"),"to_hash");return u(b,this)},p.$$arity=1);c.def(m,"$[]",N=function(a){var b=c.hash_get(this,a);return void 0!==b?b:this.$default(a)},N.$$arity=1);c.def(m,"$[]=",P=function(a,b){c.hash_put(this,a,b);return b},P.$$arity=2);c.def(m,"$assoc",z=function(a){for(var b=0,c=this.$$keys,e=c.length,d;b"+g.$inspect());return"{"+c.join(", ")+"}"}finally{a&&(Ia=void 0)}}, +G.$$arity=0);c.def(m,"$invert",qa=function(){for(var a=c.hash(),b=0,e=this.$$keys,d=e.length,f,g;bc:a["$>"](c)}function D(a,c){return"number"===typeof a&&"number"===typeof c?a $** $new $< $to_f $== $nan? $infinite? $enum_for $+ $- $gcd $lcm $% $/ $frexp $to_i $ldexp $rationalize $* $<< $to_r $truncate $-@ $size $<= $>= $<=> $compare $any?".split(" ")); +A.$require("corelib/numeric");(function(e,$super,q){function v(){}e=v=H(e,$super,"Number",v);var g=[e].concat(q),B,b,F,p,N,P,z,d,f,x,ja,Z,E,A,ha,ra,va,pa,L,t,za,ca,X,na,S,Y,U,fa,V,K,J,Ka,G,qa,la,Da,aa,ba,ma,sa,da,ea,R,Ea,Aa,Ba,wa,oa,Fa,Ua,Qa,xa,La,Ma,Ca,Ga,Ha,Ia,Pa,Ra,Na,Oa,Va,C,W,Ja,ua,ia,ga,O,Sa,Ta;w(g,"Opal").$bridge(Number,e);c.defineProperty(Number.prototype,"$$is_number",!0);e.$$is_number_class=!0;(function(a,b){var e=[a].concat(b),d;c.def(a,"$allocate",d=function(){return this.$raise(w(e,"TypeError"), +"allocator undefined for "+this.$name())},d.$$arity=0);c.udef(a,"$new");return n})(c.get_singleton_class(e),g);c.def(e,"$coerce",B=function(a){if(a!==n){if(a.$$is_string)return[this.$Float(a),this];if(a["$respond_to?"]("to_f"))return[w(g,"Opal")["$coerce_to!"](a,w(g,"Float"),"to_f"),this];if(a.$$is_number)return[a,this]}this.$raise(w(g,"TypeError"),"can't convert "+a.$class()+" into Float")},B.$$arity=1);c.def(e,"$__id__",b=function(){return 2*this+1},b.$$arity=0);c.alias(e,"object_id","__id__"); +c.def(e,"$+",F=function(a){return a.$$is_number?this+a:this.$__coerced__("+",a)},F.$$arity=1);c.def(e,"$-",p=function(a){return a.$$is_number?this-a:this.$__coerced__("-",a)},p.$$arity=1);c.def(e,"$*",N=function(a){return a.$$is_number?this*a:this.$__coerced__("*",a)},N.$$arity=1);c.def(e,"$/",P=function(a){return a.$$is_number?this/a:this.$__coerced__("/",a)},P.$$arity=1);c.alias(e,"fdiv","/");c.def(e,"$%",z=function(a){if(a.$$is_number){if(-Infinity==a)return a;if(0==a)this.$raise(w(g,"ZeroDivisionError"), +"divided by 0");else return 0>a||0>this?(this%a+a)%a:this%a}else return this.$__coerced__("%",a)},z.$$arity=1);c.def(e,"$&",d=function(a){return a.$$is_number?this&a:this.$__coerced__("&",a)},d.$$arity=1);c.def(e,"$|",f=function(a){return a.$$is_number?this|a:this.$__coerced__("|",a)},f.$$arity=1);c.def(e,"$^",x=function(a){return a.$$is_number?this^a:this.$__coerced__("^",a)},x.$$arity=1);c.def(e,"$<",ja=function(a){return a.$$is_number?this",E=function(a){return a.$$is_number?this>a:this.$__coerced__(">",a)},E.$$arity=1);c.def(e,"$>=",A=function(a){return a.$$is_number?this>=a:this.$__coerced__(">=",a)},A.$$arity=1);c.def(e,"$<=>",ha=function(a){try{return a.$$is_number?isNaN(this)||isNaN(a)?n:this>a?1:this",a)}catch(b){if(c.rescue(b,[w(g,"ArgumentError")]))try{return n}finally{c.pop_exception()}else throw b;}}, +ha.$$arity=1);c.def(e,"$<<",ra=function(a){a=w(g,"Opal")["$coerce_to!"](a,w(g,"Integer"),"to_int");return 0>-a},ra.$$arity=1);c.def(e,"$>>",va=function(a){a=w(g,"Opal")["$coerce_to!"](a,w(g,"Integer"),"to_int");return 0>a:this<<-a},va.$$arity=1);c.def(e,"$[]",pa=function(a){a=w(g,"Opal")["$coerce_to!"](a,w(g,"Integer"),"to_int");return 0>a?0:32<=a?0>this?1:0:this>>a&1},pa.$$arity=1);c.def(e,"$+@",L=function(){return+this},L.$$arity=0);c.def(e,"$-@",t=function(){return-this}, +t.$$arity=0);c.def(e,"$~",za=function(){return~this},za.$$arity=0);c.def(e,"$**",ca=function(a){var b,c;return M(w(g,"Integer")["$==="](a))?M(M(b=w(g,"Integer")["$==="](this)["$!"]())?b:u(a,0))?Math.pow(this,a):w(g,"Rational").$new(this,1)["$**"](a):M(D(this,0)?M(c=w(g,"Float")["$==="](a))?c:w(g,"Rational")["$==="](a):D(this,0))?w(g,"Complex").$new(this,0)["$**"](a.$to_f()):M(null!=a.$$is_number)?Math.pow(this,a):this.$__coerced__("**",a)},ca.$$arity=1);c.def(e,"$===",X=function(a){return a.$$is_number? +this.valueOf()===a.valueOf():a["$respond_to?"]("==")?a["$=="](this):!1},X.$$arity=1);c.def(e,"$==",na=function(a){return a.$$is_number?this.valueOf()===a.valueOf():a["$respond_to?"]("==")?a["$=="](this):!1},na.$$arity=1);c.def(e,"$abs",S=function(){return Math.abs(this)},S.$$arity=0);c.def(e,"$abs2",Y=function(){return Math.abs(this*this)},Y.$$arity=0);c.def(e,"$allbits?",U=function(a){a=w(g,"Opal")["$coerce_to!"](a,w(g,"Integer"),"to_int");return(this&a)==a},U.$$arity=1);c.def(e,"$anybits?",fa=function(a){a= +w(g,"Opal")["$coerce_to!"](a,w(g,"Integer"),"to_int");return 0!==(this&a)},fa.$$arity=1);c.def(e,"$angle",V=function(){return M(this["$nan?"]())?this:0==this?0<1/this?0:Math.PI:0>this?Math.PI:0},V.$$arity=0);c.alias(e,"arg","angle");c.alias(e,"phase","angle");c.def(e,"$bit_length",K=function(){M(w(g,"Integer")["$==="](this))||this.$raise(w(g,"NoMethodError").$new("undefined method `bit_length` for "+this+":Float","bit_length"));if(0===this||-1===this)return 0;for(var a=0,b=0>this?~this:this;0!=b;)a+= +1,b>>>=1;return a},K.$$arity=0);c.def(e,"$ceil",J=function(a){null==a&&(a=0);var b=this.$to_f();if(0===b%1&&0<=a)return b;a=Math.pow(10,a);a=Math.ceil(b*a)/a;0===b%1&&(a=Math.round(a));return a},J.$$arity=-1);c.def(e,"$chr",Ka=function(a){return String.fromCharCode(this)},Ka.$$arity=-1);c.def(e,"$denominator",G=function(){var a,b=G.$$p,e=n,d=n,f=n;b&&(G.$$p=null);d=0;f=arguments.length;for(e=Array(f);d=a;b--)c(b);return this},qa.$$arity=1);c.alias(e,"eql?","==");c.def(e,"$equal?",la=function(a){var b;return M(b=this["$=="](a))?b:isNaN(this)&&isNaN(a)},la.$$arity=1);c.def(e,"$even?",Da=function(){return 0===this%2},Da.$$arity=0);c.def(e,"$floor",aa=function(a){null==a&&(a=0);var b=this.$to_f();if(0===b%1&&0<=a)return b;a=Math.pow(10,a);a=Math.floor(b*a)/a;0===b%1&&(a=Math.round(a));return a},aa.$$arity=-1);c.def(e,"$gcd",ba=function(a){M(w(g,"Integer")["$==="](a))||this.$raise(w(g,"TypeError"), +"not an integer");var b=Math.abs(this);for(a=Math.abs(a);0a&&this.$raise(w(g,"TypeError"),"Integer#pow() 1st argument cannot be negative when 2nd argument specified");w(g,"Integer")["$==="](b)||this.$raise(w(g,"TypeError"), +"Integer#pow() 2nd argument not allowed unless all arguments are integers");0===b&&this.$raise(w(g,"ZeroDivisionError"),"divided by 0");return this["$**"](a)["$%"](b)},Ua.$$arity=-2);c.def(e,"$pred",Qa=function(){return this-1},Qa.$$arity=0);c.def(e,"$quo",xa=function(a){var b=xa.$$p,e=n,d=n,f=n;b&&(xa.$$p=null);d=0;f=arguments.length;for(e=Array(f);dthis.$size())return 0;a=Math.pow(10,a);e=Math.floor((Math.abs(e)+a/2)/a)*a;return 0>this?-e:e}M(M(b=this["$nan?"]())?null==a:b)&&this.$raise(w(g,"FloatDomainError"),"NaN");a=w(g,"Opal")["$coerce_to!"](a||0,w(g,"Integer"),"to_int");if(M("number"===typeof a?0>=a:a["$<="](0)))M(this["$nan?"]())?this.$raise(w(g,"RangeError"),"NaN"):M(this["$infinite?"]())&& +this.$raise(w(g,"FloatDomainError"),"Infinity");else{if(a["$=="](0))return Math.round(this);if(M(M(b=this["$nan?"]())?b:this["$infinite?"]()))return this}e=w(g,"Math").$frexp(this);b=c.to_ary(e);d=null==b[1]?n:b[1];e;b=y(r(m(w(g,"Float"),"DIG"),2),M(u(d,0))?l(d,4):y(l(d,3),1));b="number"===typeof a&&"number"===typeof b?a>=b:a["$>="](b);return M(b)?this:M(D(a,(M(u(d,0))?r(l(d,3),1):l(d,4))["$-@"]()))?0:Math.round(this*Math.pow(10,a))/Math.pow(10,a)},Ca.$$arity=-1);c.def(e,"$step",Ga=function(b,e,d){function f(){void 0!== +ga&&(v=ga);void 0===v&&(v=n);z===n&&F.$raise(w(g,"TypeError"),"step must be numeric");0===z&&F.$raise(w(g,"ArgumentError"),"step can't be 0");void 0!==ia&&(z=ia);if(z===n||null==z)z=1;var a=z["$<=>"](0);a===n&&F.$raise(w(g,"ArgumentError"),"0 can't be coerced into "+z.$class());if(v===n||null==v)v=0v||0>z&&Fv||0>z&&FO&&(O=v),q(O),p+=1}else if(C=F,0=v;)q(C),C+=z;return F},Ga.$$arity=-1);c.alias(e,"succ","next");c.def(e,"$times",Ha=function(){var a=Ha.$$p,b=a||n,c;a&&(Ha.$$p=null);a&&(Ha.$$p=null);if(!M(b))return Q(this,"enum_for",["times"],(c=function(){return c.$$s||this},c.$$s= +this,c.$$arity=0,c));for(a=0;a1/this},Ta.$$arity=0),n)&&"negative?"})(x[0],w(x,"Numeric"),x);c.const_set(x[0],"Fixnum",w(x,"Number"));(function(a,$super,h){function v(){}a=v=H(a,$super,"Integer",v);h=[a].concat(h);a.$$is_number_class=!0;(function(a,e){var b=[a].concat(e),h,p,q;c.def(a,"$allocate",h=function(){return this.$raise(w(b, +"TypeError"),"allocator undefined for "+this.$name())},h.$$arity=0);c.udef(a,"$new");c.def(a,"$===",p=function(a){return a.$$is_number?0===a%1:!1},p.$$arity=1);return(c.def(a,"$sqrt",q=function(a){a=w(b,"Opal")["$coerce_to!"](a,w(b,"Integer"),"to_int");0>a&&this.$raise(m(w(b,"Math"),"DomainError"),'Numerical argument is out of domain - "isqrt"');return parseInt(Math.sqrt(a),10)},q.$$arity=1),n)&&"sqrt"})(c.get_singleton_class(a),h);c.const_set(h[0],"MAX",Math.pow(2,30)-1);return c.const_set(h[0], +"MIN",-Math.pow(2,30))})(x[0],w(x,"Numeric"),x);return function(a,$super,h){function v(){}a=v=H(a,$super,"Float",v);h=[a].concat(h);a.$$is_number_class=!0;(function(a,e){var b=[a].concat(e),h,p;c.def(a,"$allocate",h=function(){return this.$raise(w(b,"TypeError"),"allocator undefined for "+this.$name())},h.$$arity=0);c.udef(a,"$new");return(c.def(a,"$===",p=function(a){return!!a.$$is_number},p.$$arity=1),n)&&"==="})(c.get_singleton_class(a),h);c.const_set(h[0],"INFINITY",Infinity);c.const_set(h[0], +"MAX",Number.MAX_VALUE);c.const_set(h[0],"MIN",Number.MIN_VALUE);c.const_set(h[0],"NAN",NaN);c.const_set(h[0],"DIG",15);c.const_set(h[0],"MANT_DIG",53);c.const_set(h[0],"RADIX",2);return c.const_set(h[0],"EPSILON",Number.EPSILON||2.220446049250313E-16)}(x[0],w(x,"Numeric"),x)};Opal.modules["corelib/range"]=function(c){function u(c,h){return"number"===typeof c&&"number"===typeof h?c<=h:c["$<="](h)}function D(c,h){return"number"===typeof c&&"number"===typeof h?ch:c["$>"](h)}function y(c,h){return"number"===typeof c&&"number"===typeof h?c+h:c["$+"](h)}var l=c.top,h=[],A=c.nil,x=c.const_get_qualified,n=c.const_get_relative,m=c.klass,w=c.truthy,H=c.send;c.add_stubs("$require $include $attr_reader $raise $<=> $include? $<= $< $enum_for $upto $to_proc $respond_to? $class $succ $! $== $=== $exclude_end? $eql? $begin $end $last $to_a $> $- $abs $to_i $coerce_to! $ceil $/ $size $loop $+ $* $>= $each_with_index $% $bsearch $inspect $[] $hash".split(" ")); +l.$require("corelib/enumerable");return function(h,$super,a){function e(){}h=e=m(h,$super,"Range",e);var k=h.prototype,q=[h].concat(a),v,g,B,b,F,p,N,P,z,d,f,l,ja,Z,E,ta,ha,ra;k.begin=k.end=k.excl=A;h.$include(n(q,"Enumerable"));k.$$is_range=!0;h.$attr_reader("begin","end");c.def(h,"$initialize",v=function(a,b,c){null==c&&(c=!1);w(this.begin)&&this.$raise(n(q,"NameError"),"'initialize' called twice");w(a["$<=>"](b))||this.$raise(n(q,"ArgumentError"),"bad value for range");this.begin=a;this.end=b;return this.excl= +c},v.$$arity=-3);c.def(h,"$==",g=function(a){return a.$$is_range?this.excl===a.excl&&this.begin==a.begin&&this.end==a.end:!1},g.$$arity=1);c.def(h,"$===",B=function(a){return this["$include?"](a)},B.$$arity=1);c.def(h,"$cover?",b=function(a){var b,c=A,c=A,c=this.begin["$<=>"](a);if(!w(w(b=c)?u(c,0):b))return!1;c=a["$<=>"](this.end);return w(this.excl)?w(b=c)?D(c,0):b:w(b=c)?u(c,0):b},b.$$arity=1);c.def(h,"$each",F=function(){var a=F.$$p,b=a||A,e,d=A,f=A;a&&(F.$$p=null);a&&(F.$$p=null);if(b===A)return this.$enum_for("each"); +if(this.begin.$$is_number&&this.end.$$is_number){0===this.begin%1&&0===this.end%1||this.$raise(n(q,"TypeError"),"can't iterate from Float");a=this.begin;for(e=this.end+(w(this.excl)?0:1);a"](f),0));)c.yield1(b,d),d=d.$succ();w(w(e= +this.excl["$!"]())?d["$=="](f):e)&&c.yield1(b,d);return this},F.$$arity=0);c.def(h,"$eql?",p=function(a){var b,c;return w(n(q,"Range")["$==="](a))?w(b=w(c=this.excl["$==="](a["$exclude_end?"]()))?this.begin["$eql?"](a.$begin()):c)?this.end["$eql?"](a.$end()):b:!1},p.$$arity=1);c.def(h,"$exclude_end?",N=function(){return this.excl},N.$$arity=0);c.def(h,"$first",P=function(a){var b=P.$$p,e=A,d=A,f=A;b&&(P.$$p=null);d=0;f=arguments.length;for(e=Array(f);da?p.$raise(n(q,"ArgumentError"),"step can't be negative"):0===a&&p.$raise(n(q,"ArgumentError"),"step can't be 0")}function e(){if(!p.begin["$respond_to?"]("succ")||p.begin.$$is_string&& +p.end.$$is_string)return A;if(0===a%1){var b=p.$size();return("number"===typeof b&&"number"===typeof a?b/a:b["$/"](a)).$ceil()}var b=p.begin,c=p.end,d=Math.abs,f=Math.floor,d=(d(b)+d(c)+d(c-b))/d(a)*x(n(q,"Float"),"EPSILON");.5=e:d["$>="](e),w(e)&&c.brk(A,b)):w(r(d,e.end))&&c.brk(A,b);c.yield1(h,d);return v=y(v,1)},f.$$s=p,f.$$brk=b,f.$$arity=0,f))}catch(e){if(e===b)return e.$v;throw e;}}()):(p.begin.$$is_string&&p.end.$$is_string&& +0!==a%1&&p.$raise(n(q,"TypeError"),"no implicit conversion to float from string"),H(p,"each_with_index",[],(g=function(b,e){null==b&&(b=A);null==e&&(e=A);return e["$%"](a)["$=="](0)?c.yield1(h,b):A},g.$$s=p,g.$$arity=2,g)));return p},ja.$$arity=-1);c.def(h,"$bsearch",Z=function(){var a=Z.$$p,b=a||A;a&&(Z.$$p=null);a&&(Z.$$p=null);if(b===A)return this.$enum_for("bsearch");w(this.begin.$$is_number&&this.end.$$is_number)||this.$raise(n(q,"TypeError"),"can't do binary search for "+this.begin.$class()); +return H(this.$to_a(),"bsearch",[],b.$to_proc())},Z.$$arity=0);c.def(h,"$to_s",E=function(){return""+this.begin+(w(this.excl)?"...":"..")+this.end},E.$$arity=0);c.def(h,"$inspect",ta=function(){return""+this.begin.$inspect()+(w(this.excl)?"...":"..")+this.end.$inspect()},ta.$$arity=0);c.def(h,"$marshal_load",ha=function(a){this.begin=a["$[]"]("begin");this.end=a["$[]"]("end");return this.excl=a["$[]"]("excl")},ha.$$arity=1);return(c.def(h,"$hash",ra=function(){return[this.begin,this.end,this.excl].$hash()}, +ra.$$arity=0),A)&&"hash"}(h[0],null,h)};Opal.modules["corelib/proc"]=function(c){var u=[],D=c.nil,r=c.const_get_relative,y=c.slice,l=c.klass,h=c.truthy;c.add_stubs(["$raise","$coerce_to!"]);return function(u,$super,n){function m(){}u=m=l(u,$super,"Proc",m);var w=[u].concat(n),H,M,Q,a,e,k,q,v,g,B;c.defineProperty(Function.prototype,"$$is_proc",!0);c.defineProperty(Function.prototype,"$$is_lambda",!1);c.defs(u,"$new",H=function(){var a=H.$$p,c=a||D;a&&(H.$$p=null);a&&(H.$$p=null);h(c)||this.$raise(r(w, +"ArgumentError"),"tried to create a Proc object without a block");return c},H.$$arity=0);c.def(u,"$call",M=function(a){var e=M.$$p,g=e||D;e&&(M.$$p=null);e&&(M.$$p=null);e=c.slice.call(arguments,0,arguments.length);g!==D&&(this.$$p=g);var k;if(g=this.$$brk)try{k=this.$$is_lambda?this.apply(null,e):c.yieldX(this,e)}catch(h){if(h===g)return g.$v;throw h;}else k=this.$$is_lambda?this.apply(null,e):c.yieldX(this,e);return k},M.$$arity=-1);c.alias(u,"[]","call");c.alias(u,"===","call");c.alias(u,"yield", +"call");c.def(u,"$to_proc",Q=function(){return this},Q.$$arity=0);c.def(u,"$lambda?",a=function(){return!!this.$$is_lambda},a.$$arity=0);c.def(u,"$arity",e=function(){return this.$$is_curried?-1:this.$$arity},e.$$arity=0);c.def(u,"$source_location",k=function(){return D},k.$$arity=0);c.def(u,"$binding",q=function(){this.$$is_curried&&this.$raise(r(w,"ArgumentError"),"Can't create Binding");return D},q.$$arity=0);c.def(u,"$parameters",v=function(){if(this.$$is_curried)return[["rest"]];if(this.$$parameters){if(this.$$is_lambda)return this.$$parameters; +var a=[],c,e;c=0;for(e=this.$$parameters.length;ca&&e.$$is_lambda&&!e.$$is_curried&&e.$raise(r(w,"ArgumentError"),"wrong number of arguments ("+k+" for "+a+")");if(k>=a)return e.$call.apply(e,g);k=function(){return c.apply(null,g.concat(y.call(arguments)))};k.$$is_lambda=e.$$is_lambda;k.$$is_curried=!0;return k} +var e=this;void 0===a?a=e.length:(a=r(w,"Opal")["$coerce_to!"](a,r(w,"Integer"),"to_int"),e.$$is_lambda&&a!==e.length&&e.$raise(r(w,"ArgumentError"),"wrong number of arguments ("+a+" for "+e.length+")"));c.$$is_lambda=e.$$is_lambda;c.$$is_curried=!0;return c},g.$$arity=-1);c.def(u,"$dup",B=function(){var a=this.$$original_proc||this,c=function(){return a.apply(this,arguments)},e;for(e in this)this.hasOwnProperty(e)&&(c[e]=this[e]);return c},B.$$arity=0);return c.alias(u,"clone","dup")}(u[0],Function, +u)};Opal.modules["corelib/method"]=function(c){var u=[],D=c.nil,r=c.const_get_relative,y=c.klass,l=c.truthy;c.add_stubs("$attr_reader $arity $new $class $join $source_location $raise".split(" "));(function(h,$super,x){function n(){}h=n=y(h,$super,"Method",n);var m=h.prototype,w=[h].concat(x),u,M,Q,a,e,k,q,v,g;m.method=m.receiver=m.owner=m.name=D;h.$attr_reader("owner","receiver","name");c.def(h,"$initialize",u=function(a,b,c,e){this.receiver=a;this.owner=b;this.name=e;return this.method=c},u.$$arity= +4);c.def(h,"$arity",M=function(){return this.method.$arity()},M.$$arity=0);c.def(h,"$parameters",Q=function(){return this.method.$$parameters},Q.$$arity=0);c.def(h,"$source_location",a=function(){var a;return l(a=this.method.$$source_location)?a:["(eval)",0]},a.$$arity=0);c.def(h,"$comments",e=function(){var a;return l(a=this.method.$$comments)?a:[]},e.$$arity=0);c.def(h,"$call",k=function(a){var b=k.$$p,e=b||D;b&&(k.$$p=null);b&&(k.$$p=null);b=c.slice.call(arguments,0,arguments.length);this.method.$$p= +e;return this.method.apply(this.receiver,b)},k.$$arity=-1);c.alias(h,"[]","call");c.def(h,"$unbind",q=function(){return r(w,"UnboundMethod").$new(this.receiver.$class(),this.owner,this.method,this.name)},q.$$arity=0);c.def(h,"$to_proc",v=function(){var a=this.$call.bind(this);a.$$unbound=this.method;a.$$is_lambda=!0;return a},v.$$arity=0);return(c.def(h,"$inspect",g=function(){return"#<"+this.$class()+": "+this.receiver.$class()+"#"+this.name+" (defined in "+this.owner+" in "+this.$source_location().$join(":")+ +")>"},g.$$arity=0),D)&&"inspect"})(u[0],null,u);return function(h,$super,x){function n(){}h=n=y(h,$super,"UnboundMethod",n);var m=h.prototype,w=[h].concat(x),u,M,Q,a,e,k,q;m.method=m.owner=m.name=m.source=D;h.$attr_reader("source","owner","name");c.def(h,"$initialize",u=function(a,c,e,b){this.source=a;this.owner=c;this.method=e;return this.name=b},u.$$arity=4);c.def(h,"$arity",M=function(){return this.method.$arity()},M.$$arity=0);c.def(h,"$parameters",Q=function(){return this.method.$$parameters}, +Q.$$arity=0);c.def(h,"$source_location",a=function(){var a;return l(a=this.method.$$source_location)?a:["(eval)",0]},a.$$arity=0);c.def(h,"$comments",e=function(){var a;return l(a=this.method.$$comments)?a:[]},e.$$arity=0);c.def(h,"$bind",k=function(a){if(this.owner.$$is_module||c.is_a(a,this.owner))return r(w,"Method").$new(a,this.owner,this.method,this.name);this.$raise(r(w,"TypeError"),"can't bind singleton method to a different class (expected "+a+".kind_of?("+this.owner+" to be true)")},k.$$arity= +1);return(c.def(h,"$inspect",q=function(){return"#<"+this.$class()+": "+this.source+"#"+this.name+" (defined in "+this.owner+" in "+this.$source_location().$join(":")+")>"},q.$$arity=0),D)&&"inspect"}(u[0],null,u)};Opal.modules["corelib/variables"]=function(c){var u=[],D=c.nil,r=c.const_get_relative,y=c.gvars,l=c.hash2;c.add_stubs(["$new"]);y["&"]=y["~"]=y["`"]=y["'"]=D;y.LOADED_FEATURES=y['"']=c.loaded_features;y.LOAD_PATH=y[":"]=[];y["/"]="\n";y[","]=D;c.const_set(u[0],"ARGV",[]);c.const_set(u[0], +"ARGF",r(u,"Object").$new());c.const_set(u[0],"ENV",l([],{}));y.VERBOSE=!1;y.DEBUG=!1;return y.SAFE=0};Opal.modules["opal/regexp_anchors"]=function(c){var u=[],D=c.nil,r=c.const_get_relative,y=c.module;c.add_stubs(["$==","$new"]);return function(l,h){function u(){}var x=[u=y(l,"Opal",u)].concat(h);c.const_set(x[0],"REGEXP_START",r(x,"RUBY_ENGINE")["$=="]("opal")?"^":D);c.const_set(x[0],"REGEXP_END",r(x,"RUBY_ENGINE")["$=="]("opal")?"$":D);c.const_set(x[0],"FORBIDDEN_STARTING_IDENTIFIER_CHARS","\\u0001-\\u002F\\u003A-\\u0040\\u005B-\\u005E\\u0060\\u007B-\\u007F"); +c.const_set(x[0],"FORBIDDEN_ENDING_IDENTIFIER_CHARS","\\u0001-\\u0020\\u0022-\\u002F\\u003A-\\u003E\\u0040\\u005B-\\u005E\\u0060\\u007B-\\u007F");c.const_set(x[0],"INLINE_IDENTIFIER_REGEXP",r(x,"Regexp").$new("[^"+r(x,"FORBIDDEN_STARTING_IDENTIFIER_CHARS")+"]*[^"+r(x,"FORBIDDEN_ENDING_IDENTIFIER_CHARS")+"]"));c.const_set(x[0],"FORBIDDEN_CONST_NAME_CHARS","\\u0001-\\u0020\\u0021-\\u002F\\u003B-\\u003F\\u0040\\u005B-\\u005E\\u0060\\u007B-\\u007F");c.const_set(x[0],"CONST_NAME_REGEXP",r(x,"Regexp").$new(""+ +r(x,"REGEXP_START")+"(::)?[A-Z][^"+r(x,"FORBIDDEN_CONST_NAME_CHARS")+"]*"+r(x,"REGEXP_END")))}(u[0],u)};Opal.modules["opal/mini"]=function(c){var u=c.top;c.add_stubs(["$require"]);u.$require("opal/base");u.$require("corelib/nil");u.$require("corelib/boolean");u.$require("corelib/string");u.$require("corelib/comparable");u.$require("corelib/enumerable");u.$require("corelib/enumerator");u.$require("corelib/array");u.$require("corelib/hash");u.$require("corelib/number");u.$require("corelib/range");u.$require("corelib/proc"); +u.$require("corelib/method");u.$require("corelib/regexp");u.$require("corelib/variables");return u.$require("opal/regexp_anchors")};Opal.modules["corelib/string/encoding"]=function(c){function u(a,c){return"number"===typeof a&&"number"===typeof c?a+c:a["$+"](c)}var D,r,y,l,h,A=c.top,x=[],n=c.nil,m=c.const_get_qualified,w=c.const_get_relative,H=c.klass,M=c.hash2,Q=c.truthy,a=c.send;c.add_stubs("$require $+ $[] $new $to_proc $each $const_set $sub $== $default_external $upcase $raise $attr_accessor $attr_reader $register $length $bytes $to_a $each_byte $bytesize $enum_for $force_encoding $dup $coerce_to! $find $getbyte".split(" ")); +A.$require("corelib/string");(function(e,$super,h){function v(){}e=v=H(e,$super,"Encoding",v);var g=e.prototype,B=[e].concat(h),b,F,p,N,P,z,d,f,l,m;g.ascii=g.dummy=g.name=n;c.defineProperty(e,"$$register",{});c.defs(e,"$register",b=function(c,e){var d=b.$$p,f=d||n,g,h,p=n,v=n,t=n;d&&(b.$$p=null);d&&(b.$$p=null);null==e&&(e=M([],{}));p=u([c],Q(g=e["$[]"]("aliases"))?g:[]);v=a(w(B,"Class"),"new",[this],f.$to_proc()).$new(c,p,Q(g=e["$[]"]("ascii"))?g:!1,Q(g=e["$[]"]("dummy"))?g:!1);t=this.$$register; +return a(p,"each",[],(h=function(a){var b=h.$$s||this;null==a&&(a=n);b.$const_set(a.$sub("-","_"),v);return t["$$"+a]=v},h.$$s=this,h.$$arity=1,h))},b.$$arity=-2);c.defs(e,"$find",F=function(a){var b,c=n,c=n;if(a["$=="]("default_external"))return this.$default_external();c=this.$$register;c=Q(b=c["$$"+a])?b:c["$$"+a.$upcase()];Q(c)||this.$raise(w(B,"ArgumentError"),"unknown encoding name - "+a);return c},F.$$arity=1);(function(a,b){[a].concat(b);return a.$attr_accessor("default_external")})(c.get_singleton_class(e), +B);e.$attr_reader("name","names");c.def(e,"$initialize",p=function(a,b,c,e){this.name=a;this.names=b;this.ascii=c;return this.dummy=e},p.$$arity=4);c.def(e,"$ascii_compatible?",N=function(){return this.ascii},N.$$arity=0);c.def(e,"$dummy?",P=function(){return this.dummy},P.$$arity=0);c.def(e,"$to_s",z=function(){return this.name},z.$$arity=0);c.def(e,"$inspect",d=function(){return"#"},d.$$arity=0);c.def(e,"$each_byte",f=function(a){c.slice.call(arguments, +0,arguments.length);return this.$raise(w(B,"NotImplementedError"))},f.$$arity=-1);c.def(e,"$getbyte",l=function(a){c.slice.call(arguments,0,arguments.length);return this.$raise(w(B,"NotImplementedError"))},l.$$arity=-1);c.def(e,"$bytesize",m=function(a){c.slice.call(arguments,0,arguments.length);return this.$raise(w(B,"NotImplementedError"))},m.$$arity=-1);(function(a,$super,b){function c(){}[c=H(a,$super,"EncodingError",c)].concat(b);return n})(B[0],w(B,"StandardError"),B);return function(a,$super, +b){function c(){}[c=H(a,$super,"CompatibilityError",c)].concat(b);return n}(B[0],w(B,"EncodingError"),B)})(x[0],null,x);a(w(x,"Encoding"),"register",["UTF-8",M(["aliases","ascii"],{aliases:["CP65001"],ascii:!0})],(D=function(){var a=D.$$s||this,k,h;c.def(a,"$each_byte",k=function(a){var e=k.$$p,h=e||n;e&&(k.$$p=null);e&&(k.$$p=null);for(var e=0,b=a.length;e=q)c.yield1(h,q);else for(var q=encodeURIComponent(a.charAt(e)).substr(1).split("%"),p=0,N=q.length;p>8)}},k.$$arity=1);return(c.def(a,"$bytesize",h=function(a){return a.$bytes().$length()},h.$$arity= +1),n)&&"bytesize"},r.$$s=A,r.$$arity=0,r));a(w(x,"Encoding"),"register",["UTF-16BE"],(y=function(){var a=y.$$s||this,k,h;c.def(a,"$each_byte",k=function(a){var e=k.$$p,h=e||n;e&&(k.$$p=null);e&&(k.$$p=null);for(var e=0,b=a.length;e>8);c.yield1(h,q&255)}},k.$$arity=1);return(c.def(a,"$bytesize",h=function(a){return a.$bytes().$length()},h.$$arity=1),n)&&"bytesize"},y.$$s=A,y.$$arity=0,y));a(w(x,"Encoding"),"register",["UTF-32LE"],(l=function(){var a=l.$$s|| +this,k,h;c.def(a,"$each_byte",k=function(a){var e=k.$$p,h=e||n;e&&(k.$$p=null);e&&(k.$$p=null);for(var e=0,b=a.length;e>8)}},k.$$arity=1);return(c.def(a,"$bytesize",h=function(a){return a.$bytes().$length()},h.$$arity=1),n)&&"bytesize"},l.$$s=A,l.$$arity=0,l));a(w(x,"Encoding"),"register",["ASCII-8BIT",M(["aliases","ascii","dummy"],{aliases:["BINARY","US-ASCII","ASCII"],ascii:!0,dummy:!0})],(h=function(){var a=h.$$s||this,k,q;c.def(a,"$each_byte", +k=function(a){var e=k.$$p,h=e||n;e&&(k.$$p=null);e&&(k.$$p=null);for(var e=0,b=a.length;e>8)}},k.$$arity=1);return(c.def(a,"$bytesize",q=function(a){return a.$bytes().$length()},q.$$arity=1),n)&&"bytesize"},h.$$s=A,h.$$arity=0,h));return function(e,$super,h){function v(){}e=v=H(e,$super,"String",v);var g=e.prototype,B=[e].concat(h),b,F,p,N,P,z,d;g.encoding=n;e.$attr_reader("encoding");c.defineProperty(String.prototype,"encoding",m(w(B,"Encoding"), +"UTF_16LE"));c.def(e,"$bytes",b=function(){return this.$each_byte().$to_a()},b.$$arity=0);c.def(e,"$bytesize",F=function(){return this.encoding.$bytesize(this)},F.$$arity=0);c.def(e,"$each_byte",p=function(){var b=p.$$p,c=b||n;b&&(p.$$p=null);b&&(p.$$p=null);if(c===n)return this.$enum_for("each_byte");a(this.encoding,"each_byte",[this],c.$to_proc());return this},p.$$arity=0);c.def(e,"$encode",N=function(a){return this.$dup().$force_encoding(a)},N.$$arity=1);c.def(e,"$force_encoding",P=function(a){if(a=== +this.encoding)return this;a=w(B,"Opal")["$coerce_to!"](a,w(B,"String"),"to_s");a=w(B,"Encoding").$find(a);if(a===this.encoding)return this;this.encoding=a;return this},P.$$arity=1);c.def(e,"$getbyte",z=function(a){return this.encoding.$getbyte(this,a)},z.$$arity=1);return(c.def(e,"$valid_encoding?",d=function(){return!0},d.$$arity=0),n)&&"valid_encoding?"}(x[0],null,x)};Opal.modules["corelib/math"]=function(c){var u=[],D=c.const_get_qualified,r=c.const_get_relative,y=c.module,l=c.truthy;c.add_stubs("$new $raise $Float $type_error $Integer $module_function $checked $float! $=== $gamma $- $integer! $/ $infinite?".split(" ")); +return function(h,u){function x(){}var n=x=y(h,"Math",x),m=[n].concat(u),w,H,M,Q,a,e,k,q,v,g,B,b,F,p,N,P,z,d,f,ya,ja,Z,E,ta,ha,ra,va,pa,L;c.const_set(m[0],"E",Math.E);c.const_set(m[0],"PI",Math.PI);c.const_set(m[0],"DomainError",r(m,"Class").$new(r(m,"StandardError")));c.defs(n,"$checked",w=function(a,b){var e;e=c.slice.call(arguments,1,arguments.length);if(isNaN(e[0])||2==e.length&&isNaN(e[1]))return NaN;e=Math[a].apply(null,e);isNaN(e)&&this.$raise(r(m,"DomainError"),'Numerical argument is out of domain - "'+ +a+'"');return e},w.$$arity=-2);c.defs(n,"$float!",H=function(a){try{return this.$Float(a)}catch(b){if(c.rescue(b,[r(m,"ArgumentError")]))try{return this.$raise(r(m,"Opal").$type_error(a,r(m,"Float")))}finally{c.pop_exception()}else throw b;}},H.$$arity=1);c.defs(n,"$integer!",M=function(a){try{return this.$Integer(a)}catch(b){if(c.rescue(b,[r(m,"ArgumentError")]))try{return this.$raise(r(m,"Opal").$type_error(a,r(m,"Integer")))}finally{c.pop_exception()}else throw b;}},M.$$arity=1);n.$module_function(); +c.def(n,"$acos",Q=function(a){return r(m,"Math").$checked("acos",r(m,"Math")["$float!"](a))},Q.$$arity=1);l("undefined"!==typeof Math.acosh)||(Math.acosh=function(a){return Math.log(a+Math.sqrt(a*a-1))});c.def(n,"$acosh",a=function(a){return r(m,"Math").$checked("acosh",r(m,"Math")["$float!"](a))},a.$$arity=1);c.def(n,"$asin",e=function(a){return r(m,"Math").$checked("asin",r(m,"Math")["$float!"](a))},e.$$arity=1);l("undefined"!==typeof Math.asinh)||(Math.asinh=function(a){return Math.log(a+Math.sqrt(a* +a+1))});c.def(n,"$asinh",k=function(a){return r(m,"Math").$checked("asinh",r(m,"Math")["$float!"](a))},k.$$arity=1);c.def(n,"$atan",q=function(a){return r(m,"Math").$checked("atan",r(m,"Math")["$float!"](a))},q.$$arity=1);c.def(n,"$atan2",v=function(a,b){return r(m,"Math").$checked("atan2",r(m,"Math")["$float!"](a),r(m,"Math")["$float!"](b))},v.$$arity=2);l("undefined"!==typeof Math.atanh)||(Math.atanh=function(a){return.5*Math.log((1+a)/(1-a))});c.def(n,"$atanh",g=function(a){return r(m,"Math").$checked("atanh", +r(m,"Math")["$float!"](a))},g.$$arity=1);l("undefined"!==typeof Math.cbrt)||(Math.cbrt=function(a){if(0==a)return 0;if(0>a)return-Math.cbrt(-a);for(var b=a,c=0;.125>b;)b*=8,c--;for(;1c;)b*=.5,c++;for(;0a&&(b=-1);a=Math.abs(a);var c=1/(1+.3275911*a);return b*(1-((((1.061405429*c+-1.453152027)*c+1.421413741)*c+-.284496736)*c+.254829592)*c*Math.exp(-a*a))}); +c.def(n,"$erf",p=function(a){return r(m,"Math").$checked("erf",r(m,"Math")["$float!"](a))},p.$$arity=1);l("undefined"!==typeof Math.erfc)||c.defineProperty(Math,"erfc",function(a){var b=Math.abs(a),c=1/(.5*b+1),b=c*Math.exp(-b*b-1.26551223+c*(c*(c*(c*(c*(c*(c*(c*(.17087277*c+-.82215223)+1.48851587)+-1.13520398)+.27886807)+-.18628806)+.09678418)+.37409196)+1.00002368));return 0>a?2-b:b});c.def(n,"$erfc",N=function(a){return r(m,"Math").$checked("erfc",r(m,"Math")["$float!"](a))},N.$$arity=1);c.def(n, +"$exp",P=function(a){return r(m,"Math").$checked("exp",r(m,"Math")["$float!"](a))},P.$$arity=1);c.def(n,"$frexp",z=function(a){a=r(m,"Math")["$float!"](a);if(isNaN(a))return[NaN,0];var b=Math.floor(Math.log(Math.abs(a))/Math.log(2))+1;return[a/Math.pow(2,b),b]},z.$$arity=1);c.def(n,"$gamma",d=function(a){a=r(m,"Math")["$float!"](a);var b,c,e,d;e=[.9999999999999971,57.15623566586292,-59.59796035547549,14.136097974741746,-.4919138160976202,3.399464998481189E-5,4.652362892704858E-5,-9.837447530487956E-5, +1.580887032249125E-4,-2.1026444172410488E-4,2.1743961811521265E-4,-1.643181065367639E-4,8.441822398385275E-5,-2.6190838401581408E-5,3.6899182659531625E-6];if(isNaN(a))return NaN;if(0===a&&0>1/a)return-Infinity;-1!==a&&-Infinity!==a||this.$raise(r(m,"DomainError"),'Numerical argument is out of domain - "gamma"');if(r(m,"Integer")["$==="](a)){if(0>=a)return isFinite(a)?Infinity:NaN;if(171a)return Math.PI/(Math.sin(Math.PI*a)* +r(m,"Math").$gamma("number"===typeof a?1-a:1["$-"](a)));if(171.35<=a)return Infinity;if(85r(m,"Math").$gamma(a)?-1:1]},ja.$$arity=1);c.def(n,"$log",Z=function(a, +b){l(r(m,"String")["$==="](a))&&this.$raise(r(m,"Opal").$type_error(a,r(m,"Float")));if(l(null==b))return r(m,"Math").$checked("log",r(m,"Math")["$float!"](a));l(r(m,"String")["$==="](b))&&this.$raise(r(m,"Opal").$type_error(b,r(m,"Float")));var c=r(m,"Math").$checked("log",r(m,"Math")["$float!"](a)),e=r(m,"Math").$checked("log",r(m,"Math")["$float!"](b));return"number"===typeof c&&"number"===typeof e?c/e:c["$/"](e)},Z.$$arity=-2);l("undefined"!==typeof Math.log10)||(Math.log10=function(a){return Math.log(a)/ +Math.LN10});c.def(n,"$log10",E=function(a){l(r(m,"String")["$==="](a))&&this.$raise(r(m,"Opal").$type_error(a,r(m,"Float")));return r(m,"Math").$checked("log10",r(m,"Math")["$float!"](a))},E.$$arity=1);l("undefined"!==typeof Math.log2)||(Math.log2=function(a){return Math.log(a)/Math.LN2});c.def(n,"$log2",ta=function(a){l(r(m,"String")["$==="](a))&&this.$raise(r(m,"Opal").$type_error(a,r(m,"Float")));return r(m,"Math").$checked("log2",r(m,"Math")["$float!"](a))},ta.$$arity=1);c.def(n,"$sin",ha=function(a){return r(m, +"Math").$checked("sin",r(m,"Math")["$float!"](a))},ha.$$arity=1);l("undefined"!==typeof Math.sinh)||(Math.sinh=function(a){return(Math.exp(a)-Math.exp(-a))/2});c.def(n,"$sinh",ra=function(a){return r(m,"Math").$checked("sinh",r(m,"Math")["$float!"](a))},ra.$$arity=1);c.def(n,"$sqrt",va=function(a){return r(m,"Math").$checked("sqrt",r(m,"Math")["$float!"](a))},va.$$arity=1);c.def(n,"$tan",pa=function(a){a=r(m,"Math")["$float!"](a);return l(a["$infinite?"]())?D(r(m,"Float"),"NAN"):r(m,"Math").$checked("tan", +r(m,"Math")["$float!"](a))},pa.$$arity=1);l("undefined"!==typeof Math.tanh)||(Math.tanh=function(a){return Infinity==a?1:-Infinity==a?-1:(Math.exp(a)-Math.exp(-a))/(Math.exp(a)+Math.exp(-a))});c.def(n,"$tanh",L=function(a){return r(m,"Math").$checked("tanh",r(m,"Math")["$float!"](a))},L.$$arity=1)}(u[0],u)};Opal.modules["corelib/complex"]=function(c){function u(c,h){return"number"===typeof c&&"number"===typeof h?c*h:c["$*"](h)}function D(c,h){return"number"===typeof c&&"number"===typeof h?c+h:c["$+"](h)} +function r(c,h){return"number"===typeof c&&"number"===typeof h?c-h:c["$-"](h)}function y(c,h){return"number"===typeof c&&"number"===typeof h?c/h:c["$/"](h)}var l=c.top,h=[],A=c.nil,x=c.const_get_qualified,n=c.const_get_relative,m=c.klass,w=c.truthy,H=c.module;c.add_stubs("$require $=== $real? $raise $new $* $cos $sin $attr_reader $class $== $real $imag $Complex $-@ $+ $__coerced__ $- $nan? $/ $conj $abs2 $quo $polar $exp $log $> $!= $divmod $** $hypot $atan2 $lcm $denominator $finite? $infinite? $numerator $abs $arg $rationalize $to_f $to_i $to_r $inspect $positive? $zero? $Rational".split(" ")); +l.$require("corelib/numeric");(function(h,$super,a){function e(){}h=e=m(h,$super,"Complex",e);var k=h.prototype,q=[h].concat(a),v,g,B,b,F,p,N,P,z,d,f,l,ja,Z,E,ta,ha,ra,va,pa,L,t,za,ca,X,na,S,Y,U,fa,V;k.real=k.imag=A;c.defs(h,"$rect",v=function(a,b){var c,e,d;null==b&&(b=0);w(w(c=w(e=w(d=n(q,"Numeric")["$==="](a))?a["$real?"]():d)?n(q,"Numeric")["$==="](b):e)?b["$real?"]():c)||this.$raise(n(q,"TypeError"),"not a real");return this.$new(a,b)},v.$$arity=-2);(function(a,b){[a].concat(b);return c.alias(a, +"rectangular","rect")})(c.get_singleton_class(h),q);c.defs(h,"$polar",g=function(a,b){var c,e,d;null==b&&(b=0);w(w(c=w(e=w(d=n(q,"Numeric")["$==="](a))?a["$real?"]():d)?n(q,"Numeric")["$==="](b):e)?b["$real?"]():c)||this.$raise(n(q,"TypeError"),"not a real");return this.$new(u(a,n(q,"Math").$cos(b)),u(a,n(q,"Math").$sin(b)))},g.$$arity=-2);h.$attr_reader("real","imag");c.def(h,"$initialize",B=function(a,b){null==b&&(b=0);this.real=a;return this.imag=b},B.$$arity=-2);c.def(h,"$coerce",b=function(a){var b; +return w(n(q,"Complex")["$==="](a))?[a,this]:w(w(b=n(q,"Numeric")["$==="](a))?a["$real?"]():b)?[n(q,"Complex").$new(a,0),this]:this.$raise(n(q,"TypeError"),""+a.$class()+" can't be coerced into Complex")},b.$$arity=1);c.def(h,"$==",F=function(a){var b;return w(n(q,"Complex")["$==="](a))?this.real["$=="](a.$real())?this.imag["$=="](a.$imag()):this.real["$=="](a.$real()):w(w(b=n(q,"Numeric")["$==="](a))?a["$real?"]():b)?this.real["$=="](a)?this.imag["$=="](0):this.real["$=="](a):a["$=="](this)},F.$$arity= +1);c.def(h,"$-@",p=function(){return this.$Complex(this.real["$-@"](),this.imag["$-@"]())},p.$$arity=0);c.def(h,"$+",N=function(a){var b;return w(n(q,"Complex")["$==="](a))?this.$Complex(D(this.real,a.$real()),D(this.imag,a.$imag())):w(w(b=n(q,"Numeric")["$==="](a))?a["$real?"]():b)?this.$Complex(D(this.real,a),this.imag):this.$__coerced__("+",a)},N.$$arity=1);c.def(h,"$-",P=function(a){var b;return w(n(q,"Complex")["$==="](a))?this.$Complex(r(this.real,a.$real()),r(this.imag,a.$imag())):w(w(b=n(q, +"Numeric")["$==="](a))?a["$real?"]():b)?this.$Complex(r(this.real,a),this.imag):this.$__coerced__("-",a)},P.$$arity=1);c.def(h,"$*",z=function(a){var b;return w(n(q,"Complex")["$==="](a))?this.$Complex(r(u(this.real,a.$real()),u(this.imag,a.$imag())),D(u(this.real,a.$imag()),u(this.imag,a.$real()))):w(w(b=n(q,"Numeric")["$==="](a))?a["$real?"]():b)?this.$Complex(u(this.real,a),u(this.imag,a)):this.$__coerced__("*",a)},z.$$arity=1);c.def(h,"$/",d=function(a){var b,c,e,d;return w(n(q,"Complex")["$==="](a))? +w(w(b=w(c=w(e=w(d=n(q,"Number")["$==="](this.real))?this.real["$nan?"]():d)?e:w(d=n(q,"Number")["$==="](this.imag))?this.imag["$nan?"]():d)?c:w(e=n(q,"Number")["$==="](a.$real()))?a.$real()["$nan?"]():e)?b:w(c=n(q,"Number")["$==="](a.$imag()))?a.$imag()["$nan?"]():c)?n(q,"Complex").$new(x(n(q,"Float"),"NAN"),x(n(q,"Float"),"NAN")):y(u(this,a.$conj()),a.$abs2()):w(w(b=n(q,"Numeric")["$==="](a))?a["$real?"]():b)?this.$Complex(this.real.$quo(a),this.imag.$quo(a)):this.$__coerced__("/",a)},d.$$arity= +1);c.def(h,"$**",f=function(a){var b,e,d=A,f=A,g=A,k=A;e=k=g=f=d=d=e=A;if(a["$=="](0))return n(q,"Complex").$new(1,0);if(w(n(q,"Complex")["$==="](a)))return e=this.$polar(),b=c.to_ary(e),d=null==b[0]?A:b[0],f=null==b[1]?A:b[1],e,g=a.$real(),k=a.$imag(),e=n(q,"Math").$exp(r(u(g,n(q,"Math").$log(d)),u(k,f))),d=D(u(f,g),u(k,n(q,"Math").$log(d))),n(q,"Complex").$polar(e,d);if(w(n(q,"Integer")["$==="](a))){if(w("number"===typeof a?0"](0))){f=d=this;for(g=r(a,1);w(g["$!="](0));){a=g.$divmod(2); +e=c.to_ary(a);k=null==e[0]?A:e[0];e=null==e[1]?A:e[1];for(a;e["$=="](0);)d=this.$Complex(r(u(d.$real(),d.$real()),u(d.$imag(),d.$imag())),u(u(2,d.$real()),d.$imag())),g=k,b=g.$divmod(2),a=c.to_ary(b),k=null==a[0]?A:a[0],e=null==a[1]?A:a[1],b;f=u(f,d);g=r(g,1)}return f}return y(n(q,"Rational").$new(1,1),this)["$**"](a["$-@"]())}return w(w(b=n(q,"Float")["$==="](a))?b:n(q,"Rational")["$==="](a))?(e=this.$polar(),b=c.to_ary(e),d=null==b[0]?A:b[0],f=null==b[1]?A:b[1],e,n(q,"Complex").$polar(d["$**"](a), +u(f,a))):this.$__coerced__("**",a)},f.$$arity=1);c.def(h,"$abs",l=function(){return n(q,"Math").$hypot(this.real,this.imag)},l.$$arity=0);c.def(h,"$abs2",ja=function(){return D(u(this.real,this.real),u(this.imag,this.imag))},ja.$$arity=0);c.def(h,"$angle",Z=function(){return n(q,"Math").$atan2(this.imag,this.real)},Z.$$arity=0);c.alias(h,"arg","angle");c.def(h,"$conj",E=function(){return this.$Complex(this.real,this.imag["$-@"]())},E.$$arity=0);c.alias(h,"conjugate","conj");c.def(h,"$denominator", +ta=function(){return this.real.$denominator().$lcm(this.imag.$denominator())},ta.$$arity=0);c.alias(h,"divide","/");c.def(h,"$eql?",ha=function(a){var b,c;return w(b=w(c=n(q,"Complex")["$==="](a))?this.real.$class()["$=="](this.imag.$class()):c)?this["$=="](a):b},ha.$$arity=1);c.def(h,"$fdiv",ra=function(a){w(n(q,"Numeric")["$==="](a))||this.$raise(n(q,"TypeError"),""+a.$class()+" can't be coerced into Complex");return y(this,a)},ra.$$arity=1);c.def(h,"$finite?",va=function(){var a;return w(a=this.real["$finite?"]())? +this.imag["$finite?"]():a},va.$$arity=0);c.def(h,"$hash",pa=function(){return"Complex:"+this.real+":"+this.imag},pa.$$arity=0);c.alias(h,"imaginary","imag");c.def(h,"$infinite?",L=function(){var a;return w(a=this.real["$infinite?"]())?a:this.imag["$infinite?"]()},L.$$arity=0);c.def(h,"$inspect",t=function(){return"("+this+")"},t.$$arity=0);c.alias(h,"magnitude","abs");c.udef(h,"$negative?");c.def(h,"$numerator",za=function(){var a=A,a=this.$denominator();return this.$Complex(u(this.real.$numerator(), +y(a,this.real.$denominator())),u(this.imag.$numerator(),y(a,this.imag.$denominator())))},za.$$arity=0);c.alias(h,"phase","arg");c.def(h,"$polar",ca=function(){return[this.$abs(),this.$arg()]},ca.$$arity=0);c.udef(h,"$positive?");c.alias(h,"quo","/");c.def(h,"$rationalize",X=function(a){1 $- $* $__coerced__ $+ $Rational $> $** $abs $ceil $with_precision $floor $<= $truncate $send $convert".split(" ")); +h.$require("corelib/numeric");(function(h,$super,e){function k(){}h=k=w(h,$super,"Rational",k);var q=h.prototype,v=[h].concat(e),g,B,b,F,p,N,P,z,d,f,ya,ja,Z,E,A,ha,ra,va,pa,L,t,za,ca,X,na,S;q.num=q.den=x;c.defs(h,"$reduce",g=function(b,c){var e=x;b=b.$to_i();c=c.$to_i();if(c["$=="](0))this.$raise(m(v,"ZeroDivisionError"),"divided by 0");else if(H(u(c,0)))b=b["$-@"](),c=c["$-@"]();else if(c["$=="](1))return this.$new(b,c);e=b.$gcd(c);return this.$new(D(b,e),D(c,e))},g.$$arity=2);c.defs(h,"$convert", +B=function(b,c){var e,d;H(H(e=b["$nil?"]())?e:c["$nil?"]())&&this.$raise(m(v,"TypeError"),"cannot convert nil into Rational");if(H(H(e=m(v,"Integer")["$==="](b))?m(v,"Integer")["$==="](c):e))return this.$reduce(b,c);H(H(e=H(d=m(v,"Float")["$==="](b))?d:m(v,"String")["$==="](b))?e:m(v,"Complex")["$==="](b))&&(b=b.$to_r());H(H(e=H(d=m(v,"Float")["$==="](c))?d:m(v,"String")["$==="](c))?e:m(v,"Complex")["$==="](c))&&(c=c.$to_r());return H(H(e=c["$equal?"](1))?m(v,"Integer")["$==="](b)["$!"]():e)?m(v, +"Opal")["$coerce_to!"](b,m(v,"Rational"),"to_r"):H(H(e=m(v,"Numeric")["$==="](b))?m(v,"Numeric")["$==="](c):e)?D(b,c):this.$reduce(b,c)},B.$$arity=2);c.def(h,"$initialize",b=function(b,c){this.num=b;return this.den=c},b.$$arity=2);c.def(h,"$numerator",F=function(){return this.num},F.$$arity=0);c.def(h,"$denominator",p=function(){return this.den},p.$$arity=0);c.def(h,"$coerce",N=function(b){var c=x,c=b;return m(v,"Rational")["$==="](c)?[b,this]:m(v,"Integer")["$==="](c)?[b.$to_r(),this]:m(v,"Float")["$==="](c)? +[b,this.$to_f()]:x},N.$$arity=1);c.def(h,"$==",P=function(b){var c=x,c=b;return m(v,"Rational")["$==="](c)?this.num["$=="](b.$numerator())?this.den["$=="](b.$denominator()):this.num["$=="](b.$numerator()):m(v,"Integer")["$==="](c)?this.num["$=="](b)?this.den["$=="](1):this.num["$=="](b):m(v,"Float")["$==="](c)?this.$to_f()["$=="](b):b["$=="](this)},P.$$arity=1);c.def(h,"$<=>",z=function(b){var c=x,c=b;return m(v,"Rational")["$==="](c)?r(y(this.num,b.$denominator()),y(this.den,b.$numerator()))["$<=>"](0): +m(v,"Integer")["$==="](c)?r(this.num,y(this.den,b))["$<=>"](0):m(v,"Float")["$==="](c)?this.$to_f()["$<=>"](b):this.$__coerced__("<=>",b)},z.$$arity=1);c.def(h,"$+",d=function(b){var c=x,e=c=x;c=b;m(v,"Rational")["$==="](c)?(c=l(y(this.num,b.$denominator()),y(this.den,b.$numerator())),e=y(this.den,b.$denominator()),b=this.$Rational(c,e)):b=m(v,"Integer")["$==="](c)?this.$Rational(l(this.num,y(b,this.den)),this.den):m(v,"Float")["$==="](c)?l(this.$to_f(),b):this.$__coerced__("+",b);return b},d.$$arity= +1);c.def(h,"$-",f=function(b){var c=x,e=c=x;c=b;m(v,"Rational")["$==="](c)?(c=r(y(this.num,b.$denominator()),y(this.den,b.$numerator())),e=y(this.den,b.$denominator()),b=this.$Rational(c,e)):b=m(v,"Integer")["$==="](c)?this.$Rational(r(this.num,y(b,this.den)),this.den):m(v,"Float")["$==="](c)?r(this.$to_f(),b):this.$__coerced__("-",b);return b},f.$$arity=1);c.def(h,"$*",ya=function(b){var c=x,e=c=x;c=b;m(v,"Rational")["$==="](c)?(c=y(this.num,b.$numerator()),e=y(this.den,b.$denominator()),b=this.$Rational(c, +e)):b=m(v,"Integer")["$==="](c)?this.$Rational(y(this.num,b),this.den):m(v,"Float")["$==="](c)?y(this.$to_f(),b):this.$__coerced__("*",b);return b},ya.$$arity=1);c.def(h,"$/",ja=function(b){var c=x,e=c=x;c=b;m(v,"Rational")["$==="](c)?(c=y(this.num,b.$denominator()),e=y(this.den,b.$numerator()),b=this.$Rational(c,e)):b=m(v,"Integer")["$==="](c)?b["$=="](0)?D(this.$to_f(),0):this.$Rational(this.num,y(this.den,b)):m(v,"Float")["$==="](c)?D(this.$to_f(),b):this.$__coerced__("/",b);return b},ja.$$arity= +1);c.def(h,"$**",Z=function(b){var c=x,c=b;return m(v,"Integer")["$==="](c)?H(this["$=="](0)?u(b,0):this["$=="](0))?n(m(v,"Float"),"INFINITY"):H("number"===typeof b?0"](0))?this.$Rational(this.num["$**"](b),this.den["$**"](b)):H(u(b,0))?this.$Rational(this.den["$**"](b["$-@"]()),this.num["$**"](b["$-@"]())):this.$Rational(1,1):m(v,"Float")["$==="](c)?this.$to_f()["$**"](b):m(v,"Rational")["$==="](c)?b["$=="](0)?this.$Rational(1,1):b.$denominator()["$=="](1)?H(u(b,0))?this.$Rational(this.den["$**"](b.$numerator().$abs()), +this.num["$**"](b.$numerator().$abs())):this.$Rational(this.num["$**"](b.$numerator()),this.den["$**"](b.$numerator())):H(this["$=="](0)?u(b,0):this["$=="](0))?this.$raise(m(v,"ZeroDivisionError"),"divided by 0"):this.$to_f()["$**"](b):this.$__coerced__("**",b)},Z.$$arity=1);c.def(h,"$abs",E=function(){return this.$Rational(this.num.$abs(),this.den.$abs())},E.$$arity=0);c.def(h,"$ceil",A=function(b){null==b&&(b=0);return b["$=="](0)?D(this.num["$-@"](),this.den)["$-@"]().$ceil():this.$with_precision("ceil", +b)},A.$$arity=-1);c.alias(h,"divide","/");c.def(h,"$floor",ha=function(b){null==b&&(b=0);return b["$=="](0)?D(this.num["$-@"](),this.den)["$-@"]().$floor():this.$with_precision("floor",b)},ha.$$arity=-1);c.def(h,"$hash",ra=function(){return"Rational:"+this.num+":"+this.den},ra.$$arity=0);c.def(h,"$inspect",va=function(){return"("+this+")"},va.$$arity=0);c.alias(h,"quo","/");c.def(h,"$rationalize",pa=function(b){1 $to_f $nil? $> $< $strftime $year $month $day $+ $round $/ $- $copy_instance_variables $initialize_dup $is_a? $zero? $wday $utc? $mon $yday $hour $min $sec $rjust $ljust $zone $to_s $[] $cweek_cyear $isdst $<= $!= $== $ceil".split(" ")); +l.$require("corelib/comparable");return function(h,$super,a){function e(){}function k(a,b,c,e,d,f){a=a.$$is_string?parseInt(a,10):x(v,"Opal")["$coerce_to!"](a,x(v,"Integer"),"to_int");if(b===A)b=1;else if(!b.$$is_number)if(b["$respond_to?"]("to_str"))switch(b=b.$to_str(),b.toLowerCase()){case "jan":b=1;break;case "feb":b=2;break;case "mar":b=3;break;case "apr":b=4;break;case "may":b=5;break;case "jun":b=6;break;case "jul":b=7;break;case "aug":b=8;break;case "sep":b=9;break;case "oct":b=10;break;case "nov":b= +11;break;case "dec":b=12;break;default:b=b.$to_i()}else b=x(v,"Opal")["$coerce_to!"](b,x(v,"Integer"),"to_int");(1>b||12c||31e||24d||59f||60a&&b.setFullYear(a);return b},B.$$arity=-1);c.defs(q,"$local",b=function(a,b,c,e,d,f,g,h,p,t){null==b&&(b=A);null==c&&(c=A);null==e&&(e=A);null==d&&(d=A);null==f&&(f=A);null==g&&(g=A);null==h&&(h=A);null==p&&(p=A);null==t&&(t=A);var q;10===arguments.length&&(q=n.call(arguments),a=q[5],b=q[4],c=q[3],e=q[2],d=q[1],f=q[0]);q=k(a,b,c,e,d,f);a=q[0];b=q[1];c=q[2];e=q[3];d=q[4];f=q[5];q=new Date(a,b,c,e,d,0,1E3* +f);100>a&&q.setFullYear(a);return q},b.$$arity=-2);c.defs(q,"$gm",F=function(a,b,c,e,d,f,g,h,p,t){null==b&&(b=A);null==c&&(c=A);null==e&&(e=A);null==d&&(d=A);null==f&&(f=A);null==g&&(g=A);null==h&&(h=A);null==p&&(p=A);null==t&&(t=A);var q;10===arguments.length&&(q=n.call(arguments),a=q[5],b=q[4],c=q[3],e=q[2],d=q[1],f=q[0]);q=k(a,b,c,e,d,f);a=q[0];b=q[1];c=q[2];e=q[3];d=q[4];f=q[5];q=new Date(Date.UTC(a,b,c,e,d,0,1E3*f));100>a&&q.setUTCFullYear(a);q.is_utc=!0;return q},F.$$arity=-2);(function(a,b){[a].concat(b); +c.alias(a,"mktime","local");return c.alias(a,"utc","gm")})(c.get_singleton_class(q),v);c.defs(q,"$now",p=function(){return this.$new()},p.$$arity=0);c.def(q,"$+",N=function(a){w(x(v,"Time")["$==="](a))&&this.$raise(x(v,"TypeError"),"time + time?");a.$$is_number||(a=x(v,"Opal")["$coerce_to!"](a,x(v,"Integer"),"to_int"));a=new Date(this.getTime()+1E3*a);a.is_utc=this.is_utc;return a},N.$$arity=1);c.def(q,"$-",P=function(a){if(w(x(v,"Time")["$==="](a)))return(this.getTime()-a.getTime())/1E3;a.$$is_number|| +(a=x(v,"Opal")["$coerce_to!"](a,x(v,"Integer"),"to_int"));a=new Date(this.getTime()-1E3*a);a.is_utc=this.is_utc;return a},P.$$arity=1);c.def(q,"$<=>",z=function(a){var b=A;if(w(x(v,"Time")["$==="](a)))return this.$to_f()["$<=>"](a.$to_f());b=a["$<=>"](this);return w(b["$nil?"]())?A:w("number"===typeof b?0"](0))?-1:w("number"===typeof b?0>b:b["$<"](0))?1:0},z.$$arity=1);c.def(q,"$==",d=function(a){var b;return w(b=x(v,"Time")["$==="](a))?this.$to_f()===a.$to_f():b},d.$$arity=1);c.def(q,"$asctime", +f=function(){return this.$strftime("%a %b %e %H:%M:%S %Y")},f.$$arity=0);c.alias(q,"ctime","asctime");c.def(q,"$day",l=function(){return this.is_utc?this.getUTCDate():this.getDate()},l.$$arity=0);c.def(q,"$yday",ja=function(){var a=A,b=A,c=A,a=x(v,"Time").$new(this.$year()).$to_i(),b=x(v,"Time").$new(this.$year(),this.$month(),this.$day()).$to_i(),c=86400;return u(D(r(b,a),c).$round(),1)},ja.$$arity=0);c.def(q,"$isdst",Z=function(){var a=new Date(this.getFullYear(),0,1),b=new Date(this.getFullYear(), +6,1);return this.getTimezoneOffset()"](a)["$zero?"]():b},ta.$$arity=1);c.def(q,"$friday?",ha=function(){return 5==this.$wday()},ha.$$arity=0);c.def(q,"$hash",ra=function(){return"Time:"+ +this.getTime()},ra.$$arity=0);c.def(q,"$hour",va=function(){return this.is_utc?this.getUTCHours():this.getHours()},va.$$arity=0);c.def(q,"$inspect",pa=function(){return w(this["$utc?"]())?this.$strftime("%Y-%m-%d %H:%M:%S UTC"):this.$strftime("%Y-%m-%d %H:%M:%S %z")},pa.$$arity=0);c.alias(q,"mday","day");c.def(q,"$min",L=function(){return this.is_utc?this.getUTCMinutes():this.getMinutes()},L.$$arity=0);c.def(q,"$mon",t=function(){return(this.is_utc?this.getUTCMonth():this.getMonth())+1},t.$$arity= +0);c.def(q,"$monday?",za=function(){return 1==this.$wday()},za.$$arity=0);c.alias(q,"month","mon");c.def(q,"$saturday?",ca=function(){return 6==this.$wday()},ca.$$arity=0);c.def(q,"$sec",X=function(){return this.is_utc?this.getUTCSeconds():this.getSeconds()},X.$$arity=0);c.def(q,"$succ",na=function(){var a=new Date(this.getTime()+1E3);a.is_utc=this.is_utc;return a},na.$$arity=0);c.def(q,"$usec",S=function(){return 1E3*this.getMilliseconds()},S.$$arity=0);c.def(q,"$zone",Y=function(){var a=this.toString(), +b;b=-1==a.indexOf("(")?a.match(/[A-Z]{3,4}/)[0]:a.match(/\((.+)\)(?:\s|$)/)[1];return"GMT"==b&&/(GMT\W*\d{4})/.test(a)?RegExp.$1:b},Y.$$arity=0);c.def(q,"$getgm",U=function(){var a=new Date(this.getTime());a.is_utc=!0;return a},U.$$arity=0);c.alias(q,"getutc","getgm");c.def(q,"$gmtime",fa=function(){this.is_utc=!0;return this},fa.$$arity=0);c.alias(q,"utc","gmtime");c.def(q,"$gmt?",V=function(){return!0===this.is_utc},V.$$arity=0);c.def(q,"$gmt_offset",K=function(){return 60*-this.getTimezoneOffset()}, +K.$$arity=0);c.def(q,"$strftime",J=function(a){var b=this;return a.replace(/%([\-_#^0]*:{0,2})(\d+)?([EO]*)(.)/g,function(a,c,e,d,f){d="";var g=-1!==c.indexOf("0"),k=-1===c.indexOf("-"),h=-1!==c.indexOf("_"),p=-1!==c.indexOf("^"),t=-1!==c.indexOf("#"),q=(c.match(":")||[]).length;e=parseInt(e,10);g&&h&&(c.indexOf("0")a?"+":"-")+(10>c?"0":"");d+=c;0f?"0":"";d+=f;1a:c["$>"](a)}function D(c,a){return"number"===typeof c&&"number"===typeof a?c-a:c["$-"](a)}function r(c,a){return"number"===typeof c&&"number"===typeof a?c=a:c["$>="](a)}function l(c,a){return"number"===typeof c&&"number"===typeof a?c+a:c["$+"](a)}var h=c.top,A=[],x=c.nil,n=c.const_get_relative,m=c.klass,w=c.hash2,H=c.truthy,M=c.send;c.add_stubs("$require $include $const_name! $unshift $map $coerce_to! $new $each $define_struct_attribute $allocate $initialize $alias_method $module_eval $to_proc $const_set $== $raise $<< $members $define_method $instance_eval $class $last $> $length $- $keys $any? $join $[] $[]= $each_with_index $hash $=== $< $-@ $size $>= $include? $to_sym $instance_of? $__id__ $eql? $enum_for $name $+ $each_pair $inspect $each_with_object $flatten $to_a $respond_to? $dig".split(" ")); +h.$require("corelib/enumerable");return function(h,$super,e){function k(){}h=k=m(h,$super,"Struct",k);var q=[h].concat(e),v,g,B,b,F,p,N,P,z,d,f,ya,ja,A,E,ta,ha,ra,va;h.$include(n(q,"Enumerable"));c.defs(h,"$new",v=function(b,e,d){var f=v.$$p,g=f||x,k,h,p,z;k=x;f&&(v.$$p=null);f&&(v.$$p=null);k=c.slice.call(arguments,1,arguments.length);f=c.extract_kwargs(k);if(null==f)f=w([],{});else if(!f.$$is_hash)throw c.ArgumentError.$new("expected kwargs");h=k;f=f.$$smap.keyword_init;null==f&&(f=!1);if(H(b))try{b= +n(q,"Opal")["$const_name!"](b)}catch(F){if(c.rescue(F,[n(q,"TypeError"),n(q,"NameError")]))try{h.$unshift(b),b=x}finally{c.pop_exception()}else throw F;}M(h,"map",[],(p=function(b){null==b&&(b=x);return n(q,"Opal")["$coerce_to!"](b,n(q,"String"),"to_str")},p.$$s=this,p.$$arity=1,p));k=M(n(q,"Class"),"new",[this],(z=function(){var b=z.$$s||this,e;M(h,"each",[],(e=function(b){var c=e.$$s||this;null==b&&(b=x);return c.$define_struct_attribute(b)},e.$$s=b,e.$$arity=1,e));return function(b,e){[b].concat(e); +var d;c.def(b,"$new",d=function(b){var e,d=x;e=c.slice.call(arguments,0,arguments.length);d=this.$allocate();d.$$data={};M(d,"initialize",c.to_a(e));return d},d.$$arity=-1);return b.$alias_method("[]","new")}(c.get_singleton_class(b),q)},z.$$s=this,z.$$arity=0,z));H(g)&&M(k,"module_eval",[],g.$to_proc());k.$$keyword_init=f;H(b)&&n(q,"Struct").$const_set(b,k);return k},v.$$arity=-2);c.defs(h,"$define_struct_attribute",g=function(b){var c,e;this["$=="](n(q,"Struct"))&&this.$raise(n(q,"ArgumentError"), +"you cannot define attributes to the Struct class");this.$members()["$<<"](b);M(this,"define_method",[b],(c=function(){return(c.$$s||this).$$data[b]},c.$$s=this,c.$$arity=0,c));return M(this,"define_method",[""+b+"="],(e=function(c){var d=e.$$s||this;null==c&&(c=x);return d.$$data[b]=c},e.$$s=this,e.$$arity=1,e))},g.$$arity=1);c.defs(h,"$members",B=function(){var b;null==this.members&&(this.members=x);this["$=="](n(q,"Struct"))&&this.$raise(n(q,"ArgumentError"),"the Struct class has no members"); +return this.members=H(b=this.members)?b:[]},B.$$arity=0);c.defs(h,"$inherited",b=function(b){var c,e=x;null==this.members&&(this.members=x);e=this.members;return M(b,"instance_eval",[],(c=function(){return(c.$$s||this).members=e},c.$$s=this,c.$$arity=0,c))},b.$$arity=1);c.def(h,"$initialize",F=function(b){var e,d,f,g,k=x,h=x;e=c.slice.call(arguments,0,arguments.length);if(H(this.$class().$$keyword_init))return k=H(d=e.$last())?d:w([],{}),H(H(d=u(e.$length(),1))?d:1===e.length&&!k.$$is_hash)&&this.$raise(n(q, +"ArgumentError"),"wrong number of arguments (given "+e.$length()+", expected 0)"),h=D(k.$keys(),this.$class().$members()),H(h["$any?"]())&&this.$raise(n(q,"ArgumentError"),"unknown keywords: "+h.$join(", ")),M(this.$class().$members(),"each",[],(f=function(b){var e=f.$$s||this,d=x;null==b&&(b=x);d=[b,k["$[]"](b)];M(e,"[]=",c.to_a(d));return d[D(d.length,1)]},f.$$s=this,f.$$arity=1,f));H(u(e.$length(),this.$class().$members().$length()))&&this.$raise(n(q,"ArgumentError"),"struct size differs");return M(this.$class().$members(), +"each_with_index",[],(g=function(b,d){var f=g.$$s||this,k=x;null==b&&(b=x);null==d&&(d=x);k=[b,e["$[]"](d)];M(f,"[]=",c.to_a(k));return k[D(k.length,1)]},g.$$s=this,g.$$arity=2,g))},F.$$arity=-1);c.def(h,"$members",p=function(){return this.$class().$members()},p.$$arity=0);c.def(h,"$hash",N=function(){return n(q,"Hash").$new(this.$$data).$hash()},N.$$arity=0);c.def(h,"$[]",P=function(b){H(n(q,"Integer")["$==="](b))?(H(r(b,this.$class().$members().$size()["$-@"]()))&&this.$raise(n(q,"IndexError"), +"offset "+b+" too small for struct(size:"+this.$class().$members().$size()+")"),H(y(b,this.$class().$members().$size()))&&this.$raise(n(q,"IndexError"),"offset "+b+" too large for struct(size:"+this.$class().$members().$size()+")"),b=this.$class().$members()["$[]"](b)):H(n(q,"String")["$==="](b))?this.$$data.hasOwnProperty(b)||this.$raise(n(q,"NameError").$new("no member '"+b+"' in struct",b)):this.$raise(n(q,"TypeError"),"no implicit conversion of "+b.$class()+" into Integer");b=n(q,"Opal")["$coerce_to!"](b, +n(q,"String"),"to_str");return this.$$data[b]},P.$$arity=1);c.def(h,"$[]=",z=function(b,c){H(n(q,"Integer")["$==="](b))?(H(r(b,this.$class().$members().$size()["$-@"]()))&&this.$raise(n(q,"IndexError"),"offset "+b+" too small for struct(size:"+this.$class().$members().$size()+")"),H(y(b,this.$class().$members().$size()))&&this.$raise(n(q,"IndexError"),"offset "+b+" too large for struct(size:"+this.$class().$members().$size()+")"),b=this.$class().$members()["$[]"](b)):H(n(q,"String")["$==="](b))?H(this.$class().$members()["$include?"](b.$to_sym()))|| +this.$raise(n(q,"NameError").$new("no member '"+b+"' in struct",b)):this.$raise(n(q,"TypeError"),"no implicit conversion of "+b.$class()+" into Integer");b=n(q,"Opal")["$coerce_to!"](b,n(q,"String"),"to_str");return this.$$data[b]=c},z.$$arity=2);c.def(h,"$==",d=function(b){function c(b,f){var g,k,h;e[b.$__id__()]=!0;d[f.$__id__()]=!0;for(g in b.$$data)if(k=b.$$data[g],h=f.$$data[g],n(q,"Struct")["$==="](k)){if(!(e.hasOwnProperty(k.$__id__())&&d.hasOwnProperty(h.$__id__())||c(k,h)))return!1}else if(!k["$=="](h))return!1; +return!0}if(!H(b["$instance_of?"](this.$class())))return!1;var e={},d={};return c(this,b)},d.$$arity=1);c.def(h,"$eql?",f=function(b){function c(b,f){var g,k,h;e[b.$__id__()]=!0;d[f.$__id__()]=!0;for(g in b.$$data)if(k=b.$$data[g],h=f.$$data[g],n(q,"Struct")["$==="](k)){if(!(e.hasOwnProperty(k.$__id__())&&d.hasOwnProperty(h.$__id__())||c(k,h)))return!1}else if(!k["$eql?"](h))return!1;return!0}if(!H(b["$instance_of?"](this.$class())))return!1;var e={},d={};return c(this,b)},f.$$arity=1);c.def(h,"$each", +ya=function(){var b,e,d=ya.$$p,f=d||x;d&&(ya.$$p=null);if(f===x)return M(this,"enum_for",["each"],(b=function(){return(b.$$s||this).$size()},b.$$s=this,b.$$arity=0,b));M(this.$class().$members(),"each",[],(e=function(b){var d=e.$$s||this;null==b&&(b=x);return c.yield1(f,d["$[]"](b))},e.$$s=this,e.$$arity=1,e));return this},ya.$$arity=0);c.def(h,"$each_pair",ja=function(){var b,e,d=ja.$$p,f=d||x;d&&(ja.$$p=null);if(f===x)return M(this,"enum_for",["each_pair"],(b=function(){return(b.$$s||this).$size()}, +b.$$s=this,b.$$arity=0,b));M(this.$class().$members(),"each",[],(e=function(b){var d=e.$$s||this;null==b&&(b=x);return c.yield1(f,[b,d["$[]"](b)])},e.$$s=this,e.$$arity=1,e));return this},ja.$$arity=0);c.def(h,"$length",A=function(){return this.$class().$members().$length()},A.$$arity=0);c.alias(h,"size","length");c.def(h,"$to_a",E=function(){var b;return M(this.$class().$members(),"map",[],(b=function(c){var e=b.$$s||this;null==c&&(c=x);return e["$[]"](c)},b.$$s=this,b.$$arity=1,b))},E.$$arity=0); +c.alias(h,"values","to_a");c.def(h,"$inspect",ta=function(){var b,c,e=x,e="#")},ta.$$arity=0);c.alias(h,"to_s","inspect");c.def(h,"$to_h",ha=function(){var b;return M(this.$class().$members(),"each_with_object",[w([],{})],(b=function(e, +d){var f=b.$$s||this,g=x;null==e&&(e=x);null==d&&(d=x);g=[e,f["$[]"](e)];M(d,"[]=",c.to_a(g));return g[D(g.length,1)]},b.$$s=this,b.$$arity=2,b))},ha.$$arity=0);c.def(h,"$values_at",ra=function(b){var e,d;e=c.slice.call(arguments,0,arguments.length);e=M(e,"map",[],(d=function(b){null==b&&(b=x);return b.$$is_range?b.$to_a():b},d.$$s=this,d.$$arity=1,d)).$flatten();d=[];for(var f=0,g=e.length;fa:a["$<"](0))&&this.$raise(r(w,"ArgumentError"),"negative string size (or size too big)");return h(r(w,"Array"), +"new",[a],(c=function(){return(c.$$s||this).$rand(255).$chr()},c.$$s=this,c.$$arity=0,c)).$join().$encode("ASCII-8BIT")},k.$$arity=1);c.def(u,"$==",q=function(a){return l(r(w,"Random")["$==="](a))?this.$seed()["$=="](a.$seed())?this.$state()["$=="](a.$state()):this.$seed()["$=="](a.$seed()):!1},q.$$arity=1);c.def(u,"$bytes",v=function(a){var c;a=r(w,"Opal")["$coerce_to!"](a,r(w,"Integer"),"to_int");return h(r(w,"Array"),"new",[a],(c=function(){return(c.$$s||this).$rand(255).$chr()},c.$$s=this,c.$$arity= +0,c)).$join().$encode("ASCII-8BIT")},v.$$arity=1);c.def(u,"$rand",g=function(a){function e(){k.state++;return c.$$rand.rand(k.$rng)}function g(){var c=a.begin,e=a.end;if(c===D||e===D)return D;var d=e-c;if(0>d)return D;if(0===d)return c;0!==e%1||0!==c%1||a.excl||d++;return k.$rand(d)+c}var k=this;if(null==a)return e();if(a.$$is_range)return g();if(a.$$is_number)return 0>=a&&k.$raise(r(w,"ArgumentError"),"invalid argument - "+a),0===a%1?Math.floor(e()*a):e()*a;a=r(w,"Opal")["$coerce_to!"](a,r(w,"Integer"), +"to_int");0>=a&&k.$raise(r(w,"ArgumentError"),"invalid argument - "+a);return Math.floor(e()*a)},g.$$arity=-1);return(c.defs(u,"$generator=",B=function(a){c.$$rand=a;return l(this["$const_defined?"]("DEFAULT"))?r(w,"DEFAULT").$reseed():this.$const_set("DEFAULT",this.$new(this.$new_seed()))},B.$$arity=1),D)&&"generator="}(u[0],null,u)};var MersenneTwister=function(){function c(c){if(0>=--c.left){var r=0,y=c.state,l;c.left=624;c.next=0;for(l=228;--l;r++)y[r]=y[r+397]^u(y[r+0],y[r+1]);for(l=397;--l;r++)y[r]= +y[r+-227]^u(y[r+0],y[r+1]);y[r]=y[r+-227]^u(y[r+0],y[0])}c=c.state[c.next++];c^=c>>>11;c^=c<<7&2636928640;c^=c<<15&4022730752;return(c^c>>>18)>>>0}var u=function(c,u){return(c&2147483648|u&2147483647)>>>1^(u&1?2567483615:0)};return{genrand_real:function(u){var r=c(u);u=c(u);r>>>=5;u>>>=6;return 1.1102230246251565E-16*(67108864*r+u)},init:function(c){var u={left:0,next:624,state:Array(624)};u.state[0]=c>>>0;for(c=1;624>c;c++)u.state[c]=1812433253*(u.state[c-1]^u.state[c-1]>>30>>>0)+c,u.state[c]&=4294967295; +u.left=1;u.next=624;return u}}}();Opal.loaded(["corelib/random/MersenneTwister.js"]);Opal.modules["corelib/random/mersenne_twister"]=function(c){function u(c,h){return"number"===typeof c&&"number"===typeof h?c-h:c["$-"](h)}var D=c.top,r=[],y=c.nil,l=c.const_get_relative,h=c.klass,A=c.send;c.add_stubs(["$require","$generator=","$-"]);D.$require("corelib/random/MersenneTwister");return function(r,$super,m){function w(){}r=w=h(r,$super,"Random",w);m=[r].concat(m);var D=y,M=Number.MAX_SAFE_INTEGER||Math.pow(2, +53)-1;c.const_set(m[0],"MERSENNE_TWISTER_GENERATOR",{new_seed:function(){return Math.round(Math.random()*M)},reseed:function(c){return MersenneTwister.init(c)},rand:function(c){return MersenneTwister.genrand_real(c)}});D=[l(m,"MERSENNE_TWISTER_GENERATOR")];A(r,"generator=",c.to_a(D));return D[u(D.length,1)]}(r[0],null,r)};Opal.modules["corelib/unsupported"]=function(c){function u(h){switch(c.config.unsupported_features_severity){case "error":A(l,"Kernel").$raise(A(l,"NotImplementedError"),h);break; +case "warning":m[h]||(m[h]=!0,y.$warn(h))}}var D,r,y=c.top,l=[],h=c.nil,A=c.const_get_relative,x=c.klass,n=c.module;c.add_stubs(["$raise","$warn","$%"]);var m={};(function(l,$super,n){function m(){}l=m=x(l,$super,"String",m);var a=[l].concat(n),e,k,q,v,g,B,b,F,p,N,P,z,d,f,u,r,y,E,D,ha,ra,va,pa;c.def(l,"$<<",e=function(b){c.slice.call(arguments,0,arguments.length);return this.$raise(A(a,"NotImplementedError"),"String#%s not supported. Mutable String methods are not supported in Opal."["$%"]("<<"))}, +e.$$arity=-1);c.def(l,"$capitalize!",k=function(b){c.slice.call(arguments,0,arguments.length);return this.$raise(A(a,"NotImplementedError"),"String#%s not supported. Mutable String methods are not supported in Opal."["$%"]("capitalize!"))},k.$$arity=-1);c.def(l,"$chomp!",q=function(b){c.slice.call(arguments,0,arguments.length);return this.$raise(A(a,"NotImplementedError"),"String#%s not supported. Mutable String methods are not supported in Opal."["$%"]("chomp!"))},q.$$arity=-1);c.def(l,"$chop!", +v=function(b){c.slice.call(arguments,0,arguments.length);return this.$raise(A(a,"NotImplementedError"),"String#%s not supported. Mutable String methods are not supported in Opal."["$%"]("chop!"))},v.$$arity=-1);c.def(l,"$downcase!",g=function(b){c.slice.call(arguments,0,arguments.length);return this.$raise(A(a,"NotImplementedError"),"String#%s not supported. Mutable String methods are not supported in Opal."["$%"]("downcase!"))},g.$$arity=-1);c.def(l,"$gsub!",B=function(b){c.slice.call(arguments, +0,arguments.length);return this.$raise(A(a,"NotImplementedError"),"String#%s not supported. Mutable String methods are not supported in Opal."["$%"]("gsub!"))},B.$$arity=-1);c.def(l,"$lstrip!",b=function(b){c.slice.call(arguments,0,arguments.length);return this.$raise(A(a,"NotImplementedError"),"String#%s not supported. Mutable String methods are not supported in Opal."["$%"]("lstrip!"))},b.$$arity=-1);c.def(l,"$next!",F=function(b){c.slice.call(arguments,0,arguments.length);return this.$raise(A(a, +"NotImplementedError"),"String#%s not supported. Mutable String methods are not supported in Opal."["$%"]("next!"))},F.$$arity=-1);c.def(l,"$reverse!",p=function(b){c.slice.call(arguments,0,arguments.length);return this.$raise(A(a,"NotImplementedError"),"String#%s not supported. Mutable String methods are not supported in Opal."["$%"]("reverse!"))},p.$$arity=-1);c.def(l,"$slice!",N=function(b){c.slice.call(arguments,0,arguments.length);return this.$raise(A(a,"NotImplementedError"),"String#%s not supported. Mutable String methods are not supported in Opal."["$%"]("slice!"))}, +N.$$arity=-1);c.def(l,"$squeeze!",P=function(b){c.slice.call(arguments,0,arguments.length);return this.$raise(A(a,"NotImplementedError"),"String#%s not supported. Mutable String methods are not supported in Opal."["$%"]("squeeze!"))},P.$$arity=-1);c.def(l,"$strip!",z=function(b){c.slice.call(arguments,0,arguments.length);return this.$raise(A(a,"NotImplementedError"),"String#%s not supported. Mutable String methods are not supported in Opal."["$%"]("strip!"))},z.$$arity=-1);c.def(l,"$sub!",d=function(b){c.slice.call(arguments, +0,arguments.length);return this.$raise(A(a,"NotImplementedError"),"String#%s not supported. Mutable String methods are not supported in Opal."["$%"]("sub!"))},d.$$arity=-1);c.def(l,"$succ!",f=function(b){c.slice.call(arguments,0,arguments.length);return this.$raise(A(a,"NotImplementedError"),"String#%s not supported. Mutable String methods are not supported in Opal."["$%"]("succ!"))},f.$$arity=-1);c.def(l,"$swapcase!",u=function(b){c.slice.call(arguments,0,arguments.length);return this.$raise(A(a, +"NotImplementedError"),"String#%s not supported. Mutable String methods are not supported in Opal."["$%"]("swapcase!"))},u.$$arity=-1);c.def(l,"$tr!",r=function(b){c.slice.call(arguments,0,arguments.length);return this.$raise(A(a,"NotImplementedError"),"String#%s not supported. Mutable String methods are not supported in Opal."["$%"]("tr!"))},r.$$arity=-1);c.def(l,"$tr_s!",y=function(b){c.slice.call(arguments,0,arguments.length);return this.$raise(A(a,"NotImplementedError"),"String#%s not supported. Mutable String methods are not supported in Opal."["$%"]("tr_s!"))}, +y.$$arity=-1);c.def(l,"$upcase!",E=function(b){c.slice.call(arguments,0,arguments.length);return this.$raise(A(a,"NotImplementedError"),"String#%s not supported. Mutable String methods are not supported in Opal."["$%"]("upcase!"))},E.$$arity=-1);c.def(l,"$prepend",D=function(b){c.slice.call(arguments,0,arguments.length);return this.$raise(A(a,"NotImplementedError"),"String#%s not supported. Mutable String methods are not supported in Opal."["$%"]("prepend"))},D.$$arity=-1);c.def(l,"$[]=",ha=function(b){c.slice.call(arguments, +0,arguments.length);return this.$raise(A(a,"NotImplementedError"),"String#%s not supported. Mutable String methods are not supported in Opal."["$%"]("[]="))},ha.$$arity=-1);c.def(l,"$clear",ra=function(b){c.slice.call(arguments,0,arguments.length);return this.$raise(A(a,"NotImplementedError"),"String#%s not supported. Mutable String methods are not supported in Opal."["$%"]("clear"))},ra.$$arity=-1);c.def(l,"$encode!",va=function(b){c.slice.call(arguments,0,arguments.length);return this.$raise(A(a, +"NotImplementedError"),"String#%s not supported. Mutable String methods are not supported in Opal."["$%"]("encode!"))},va.$$arity=-1);return(c.def(l,"$unicode_normalize!",pa=function(b){c.slice.call(arguments,0,arguments.length);return this.$raise(A(a,"NotImplementedError"),"String#%s not supported. Mutable String methods are not supported in Opal."["$%"]("unicode_normalize!"))},pa.$$arity=-1),h)&&"unicode_normalize!"})(l[0],null,l);(function(h,l){function m(){}var r=m=n(h,"Kernel",m);[r].concat(l); +var a,e;c.def(r,"$freeze",a=function(){u("Object freezing is not supported by Opal");return this},a.$$arity=0);c.def(r,"$frozen?",e=function(){u("Object freezing is not supported by Opal");return!1},e.$$arity=0)})(l[0],l);(function(h,l){function m(){}var r=m=n(h,"Kernel",m);[r].concat(l);var a,e,k;c.def(r,"$taint",a=function(){u("Object tainting is not supported by Opal");return this},a.$$arity=0);c.def(r,"$untaint",e=function(){u("Object tainting is not supported by Opal");return this},e.$$arity= +0);c.def(r,"$tainted?",k=function(){u("Object tainting is not supported by Opal");return!1},k.$$arity=0)})(l[0],l);(function(l,$super,n){function m(){}l=m=x(l,$super,"Module",m);[l].concat(n);var a,e,k,q;c.def(l,"$public",a=function(a){0===c.slice.call(arguments,0,arguments.length).length&&(this.$$module_function=!1);return h},a.$$arity=-1);c.alias(l,"private","public");c.alias(l,"protected","public");c.alias(l,"nesting","public");c.def(l,"$private_class_method",e=function(a){c.slice.call(arguments, +0,arguments.length);return this},e.$$arity=-1);c.alias(l,"public_class_method","private_class_method");c.def(l,"$private_method_defined?",k=function(a){return!1},k.$$arity=1);c.def(l,"$private_constant",q=function(a){c.slice.call(arguments,0,arguments.length);return h},q.$$arity=-1);c.alias(l,"protected_method_defined?","private_method_defined?");c.alias(l,"public_instance_methods","instance_methods");c.alias(l,"public_instance_method","instance_method");return c.alias(l,"public_method_defined?", +"method_defined?")})(l[0],null,l);(function(h,l){function m(){}var u=m=n(h,"Kernel",m);[u].concat(l);var a;c.def(u,"$private_methods",a=function(a){c.slice.call(arguments,0,arguments.length);return[]},a.$$arity=-1);c.alias(u,"private_instance_methods","private_methods")})(l[0],l);(function(h,l){function m(){}var u=m=n(h,"Kernel",m),a=[u].concat(l),e;c.def(u,"$eval",e=function(e){c.slice.call(arguments,0,arguments.length);return this.$raise(A(a,"NotImplementedError"),"To use Kernel#eval, you must first require 'opal-parser'. "+ +("See https://github.com/opal/opal/blob/"+A(a,"RUBY_ENGINE_VERSION")+"/docs/opal_parser.md for details."))},e.$$arity=-1)})(l[0],l);c.defs(y,"$public",D=function(l){c.slice.call(arguments,0,arguments.length);return h},D.$$arity=-1);return(c.defs(y,"$private",r=function(l){c.slice.call(arguments,0,arguments.length);return h},r.$$arity=-1),h)&&"private"};(function(c){var u=c.top;c.add_stubs(["$require"]);u.$require("opal/base");u.$require("opal/mini");u.$require("corelib/string/encoding");u.$require("corelib/math"); +u.$require("corelib/complex");u.$require("corelib/rational");u.$require("corelib/time");u.$require("corelib/struct");u.$require("corelib/io");u.$require("corelib/main");u.$require("corelib/dir");u.$require("corelib/file");u.$require("corelib/process");u.$require("corelib/random");u.$require("corelib/random/mersenne_twister.js");return u.$require("corelib/unsupported")})(Opal);for(index in fundamentalObjects){var fundamentalObject=fundamentalObjects[index],name=fundamentalObject.name;"function"!== +typeof fundamentalObject.call&&(fundamentalObject.call=backup[name].call);"function"!==typeof fundamentalObject.apply&&(fundamentalObject.apply=backup[name].apply);"function"!==typeof fundamentalObject.bind&&(fundamentalObject.bind=backup[name].bind)}} +(function(c,u){"object"===typeof module&&module.exports?module.exports=u:"function"===typeof define&&define.amd?define("asciidoctor",["module"],function(c){return u(c.config())}):c.Asciidoctor=u})(this,function(c){function u(a,c,k,h,v){var g=Opal.klass(Opal.Object,a,c,function(){}),B,b,F={},p;for(p in k)k.hasOwnProperty(p)&&function(a){var c=k[a];"postConstruct"===a?B=c:"initialize"===a?b=c:(h&&h.hasOwnProperty(a)&&(F[a]=!0),Opal.def(g,"$"+a,function(){var b;b=v&&v.hasOwnProperty(a)?v[a](arguments): +arguments;return c.apply(this,b)}))}(p);var N;N="function"===typeof b?function(){b.apply(this,arguments);"function"===typeof B&&B.bind(this)()}:function(){Opal.send(this,Opal.find_super_dispatcher(this,"initialize",N));"function"===typeof B&&B.bind(this)()};Opal.def(g,"$initialize",N);Opal.def(g,"super",function(a){if("function"===typeof a)Opal.send(this,Opal.find_super_dispatcher(this,a.name,a));else{for(var b=Array.from(arguments),c=0;c"},x.$$arity=0);a.def(v,"$==",y=function(a){var b,c;return p(this["$equal?"](a))?!0:p(a["$instance_of?"](this.$class()))?this.hash["$=="](a.$instance_variable_get("@hash")):p(p(b=a["$is_a?"](l(P,"Set")))?this.$size()["$=="](a.$size()):b)?N(a,"all?",[],(c=function(a){var b=c.$$s||this;null==b.hash&&(b.hash=g);null==a&&(a=g);return b.hash["$include?"](a)},c.$$s=this,c.$$arity=1,c)):!1},y.$$arity=1);a.def(v,"$add",L=function(b){var f= +g,f=[b,!0];N(this.hash,"[]=",a.to_a(f));f[c(f.length,1)];return this},L.$$arity=1);a.alias(v,"<<","add");a.def(v,"$classify",t=function(){var b=t.$$p,f=b||g,k,h,p=g;b&&(t.$$p=null);b&&(t.$$p=null);if(f===g)return this.$enum_for("classify");p=N(l(P,"Hash"),"new",[],(k=function(b,f){var h=k.$$s||this,p=g;null==b&&(b=g);null==f&&(f=g);p=[f,h.$class().$new()];N(b,"[]=",a.to_a(p));return p[c(p.length,1)]},k.$$s=this,k.$$arity=2,k));N(this,"each",[],(h=function(b){null==b&&(b=g);return p["$[]"](a.yield1(f, +b)).$add(b)},h.$$s=this,h.$$arity=1,h));return p},t.$$arity=0);a.def(v,"$collect!",A=function(){var b=A.$$p,c=b||g,e,f=g;b&&(A.$$p=null);b&&(A.$$p=null);if(c===g)return this.$enum_for("collect!");f=this.$class().$new();N(this,"each",[],(e=function(b){null==b&&(b=g);return f["$<<"](a.yield1(c,b))},e.$$s=this,e.$$arity=1,e));return this.$replace(f)},A.$$arity=0);a.alias(v,"map!","collect!");a.def(v,"$delete",ca=function(a){this.hash.$delete(a);return this},ca.$$arity=1);a.def(v,"$delete?",X=function(a){return p(this["$include?"](a))? +(this.$delete(a),this):g},X.$$arity=1);a.def(v,"$delete_if",na=function(){var b,c,e=na.$$p,f=e||g;e&&(na.$$p=null);if(f===g)return this.$enum_for("delete_if");N(N(this,"select",[],(b=function(b){null==b&&(b=g);return a.yield1(f,b)},b.$$s=this,b.$$arity=1,b)),"each",[],(c=function(a){var b=c.$$s||this;null==b.hash&&(b.hash=g);null==a&&(a=g);return b.hash.$delete(a)},c.$$s=this,c.$$arity=1,c));return this},na.$$arity=0);a.def(v,"$add?",S=function(a){return p(this["$include?"](a))?g:this.$add(a)},S.$$arity= +1);a.def(v,"$each",Y=function(){var a=Y.$$p,b=a||g;a&&(Y.$$p=null);a&&(Y.$$p=null);if(b===g)return this.$enum_for("each");N(this.hash,"each_key",[],b.$to_proc());return this},Y.$$arity=0);a.def(v,"$empty?",U=function(){return this.hash["$empty?"]()},U.$$arity=0);a.def(v,"$eql?",fa=function(a){var b;return this.hash["$eql?"](N(a,"instance_eval",[],(b=function(){var a=b.$$s||this;null==a.hash&&(a.hash=g);return a.hash},b.$$s=this,b.$$arity=0,b)))},fa.$$arity=1);a.def(v,"$clear",V=function(){this.hash.$clear(); +return this},V.$$arity=0);a.def(v,"$include?",K=function(a){return this.hash["$include?"](a)},K.$$arity=1);a.alias(v,"member?","include?");a.def(v,"$merge",J=function(a){var b;N(a,"each",[],(b=function(a){var c=b.$$s||this;null==a&&(a=g);return c.$add(a)},b.$$s=this,b.$$arity=1,b));return this},J.$$arity=1);a.def(v,"$replace",D=function(a){this.$clear();this.$merge(a);return this},D.$$arity=1);a.def(v,"$size",G=function(){return this.hash.$size()},G.$$arity=0);a.alias(v,"length","size");a.def(v,"$subtract", +qa=function(a){var b;N(a,"each",[],(b=function(a){var c=b.$$s||this;null==a&&(a=g);return c.$delete(a)},b.$$s=this,b.$$arity=1,b));return this},qa.$$arity=1);a.def(v,"$|",la=function(a){p(a["$respond_to?"]("each"))||this.$raise(l(P,"ArgumentError"),"value must be enumerable");return this.$dup().$merge(a)},la.$$arity=1);a.def(v,"$superset?",H=function(a){var b,c;p(b=a["$is_a?"](l(P,"Set")))?b:this.$raise(l(P,"ArgumentError"),"value must be a set");return p(k(this.$size(),a.$size()))?!1:N(a,"all?", +[],(c=function(a){var b=c.$$s||this;null==a&&(a=g);return b["$include?"](a)},c.$$s=this,c.$$arity=1,c))},H.$$arity=1);a.alias(v,">=","superset?");a.def(v,"$proper_superset?",aa=function(a){var b,c;p(b=a["$is_a?"](l(P,"Set")))?b:this.$raise(l(P,"ArgumentError"),"value must be a set");return p(h(this.$size(),a.$size()))?!1:N(a,"all?",[],(c=function(a){var b=c.$$s||this;null==a&&(a=g);return b["$include?"](a)},c.$$s=this,c.$$arity=1,c))},aa.$$arity=1);a.alias(v,">","proper_superset?");a.def(v,"$subset?", +ba=function(a){var b,c;p(b=a["$is_a?"](l(P,"Set")))?b:this.$raise(l(P,"ArgumentError"),"value must be a set");return p(k(a.$size(),this.$size()))?!1:N(this,"all?",[],(c=function(b){null==b&&(b=g);return a["$include?"](b)},c.$$s=this,c.$$arity=1,c))},ba.$$arity=1);a.alias(v,"<=","subset?");a.def(v,"$proper_subset?",ma=function(a){var b,c;p(b=a["$is_a?"](l(P,"Set")))?b:this.$raise(l(P,"ArgumentError"),"value must be a set");return p(h(a.$size(),this.$size()))?!1:N(this,"all?",[],(c=function(b){null== +b&&(b=g);return a["$include?"](b)},c.$$s=this,c.$$arity=1,c))},ma.$$arity=1);a.alias(v,"<","proper_subset?");a.alias(v,"+","|");a.alias(v,"union","|");return(a.def(v,"$to_a",M=function(){return this.hash.$keys()},M.$$arity=0),g)&&"to_a"})(v[0],null,v);return function(b,c){function e(){}var k=e=n(b,"Enumerable",e),h=[k].concat(c),p;a.def(k,"$to_set",p=function(b,c){var e=p.$$p,d=e||g,f;e&&(p.$$p=null);e&&(p.$$p=null);e=a.slice.call(arguments,0,arguments.length);0a&&(a+=b.length);return 0>a||a>=b.length||null==b[a]?h:b[a]},f.$$arity=1);a.def(c,"$check",m=function(a){a=this.$anchor(a);a=a.exec(this.working);return null==a?this.matched=h:this.matched=a[0]},m.$$arity=1);a.def(c,"$check_until",u=function(a){var b=this.prev_pos,c=this.pos;a=this.$scan_until(a);a!==h&&(this.matched=a.substr(-1),this.working=this.string.substr(c));this.prev_pos=b;this.pos=c;return a},u.$$arity=1);a.def(c,"$peek",r=function(a){return this.working.substring(0, +a)},r.$$arity=1);a.def(c,"$eos?",E=function(){return 0===this.working.length},E.$$arity=0);a.def(c,"$exist?",w=function(a){a=a.exec(this.working);return null==a?h:0==a.index?0:a.index+1},w.$$arity=1);a.def(c,"$skip",x=function(a){a=this.$anchor(a);a=a.exec(this.working);if(null==a)return this.matched=h;a=a[0];var b=a.length;this.matched=a;this.prev_pos=this.pos;this.pos+=b;this.working=this.working.substring(b);return b},x.$$arity=1);a.def(c,"$skip_until",y=function(a){a=this.$scan_until(a);if(a=== +h)return h;this.matched=a.substr(-1);return a.length},y.$$arity=1);a.def(c,"$get_byte",A=function(){var a=h;this.pos +a&&(a+=this.string.$length());this.pos=a;return this.working=this.string.slice(a)},L.$$arity=1);a.def(c,"$matched_size",t=function(){return this.matched===h?h:this.matched.length},t.$$arity=0);a.def(c,"$post_match",za=function(){return this.matched===h?h:this.string.substr(this.pos)},za.$$arity=0);a.def(c,"$pre_match",ca=function(){return this.matched===h?h:this.string.substr(0,this.prev_pos)},ca.$$arity=0);a.def(c,"$reset",X=function(){this.working=this.string;this.matched=h;return this.pos=0},X.$$arity= +0);a.def(c,"$rest",na=function(){return this.working},na.$$arity=0);a.def(c,"$rest?",S=function(){return 0!==this.working.length},S.$$arity=0);a.def(c,"$rest_size",Y=function(){return this.$rest().$size()},Y.$$arity=0);a.def(c,"$terminate",U=function(){var b=h;this.match=h;b=[this.string.$length()];v(this,"pos=",a.to_a(b));var c=b,b=b.length,b="number"===typeof b?b-1:b["$-"](1);return c[b]},U.$$arity=0);a.def(c,"$unscan",fa=function(){this.pos=this.prev_pos;this.match=this.prev_pos=h;return this}, +fa.$$arity=0);c.$private();return(a.def(c,"$anchor",V=function(a){var b=a.toString().match(/\/([^\/]+)$/),b=b?b[1]:void 0;return new RegExp("^(?:"+a.source+")",b)},V.$$arity=1),h)&&"anchor"}(c[0],null,c)};Opal.modules["asciidoctor/js"]=function(a){var c=a.top;a.add_stubs(["$require"]);c.$require("asciidoctor/js/opal_ext");c.$require("asciidoctor/js/rx");return c.$require("strscan")};Opal.modules.logger=function(a){function c(a,b){return"number"===typeof a&&"number"===typeof b?a<=b:a["$<="](b)}var h= +[],q=a.nil,v=a.const_get_qualified,g=a.const_get_relative,l=a.klass,b=a.module,F=a.send,p=a.truthy;a.add_stubs("$include $to_h $map $constants $const_get $to_s $format $chr $strftime $message_as_string $=== $+ $message $class $join $backtrace $inspect $attr_reader $attr_accessor $new $key $upcase $raise $add $to_proc $<= $< $write $call $[] $now".split(" "));return function(h,$super,k){function d(){}h=d=l(h,$super,"Logger",d);var f=h.prototype,n=[h].concat(k),m,u,E,r,w,x,y,A,L,t,D,ca,X,na,S;f.level= +f.progname=f.pipe=f.formatter=q;(function(c,e){function d(){}var f=[d=b(c,"Severity",d)].concat(e);a.const_set(f[0],"DEBUG",0);a.const_set(f[0],"INFO",1);a.const_set(f[0],"WARN",2);a.const_set(f[0],"ERROR",3);a.const_set(f[0],"FATAL",4);a.const_set(f[0],"UNKNOWN",5)})(n[0],n);h.$include(g(n,"Severity"));a.const_set(n[0],"SEVERITY_LABELS",F(g(n,"Severity").$constants(),"map",[],(m=function(a){null==a&&(a=q);return[g(n,"Severity").$const_get(a),a.$to_s()]},m.$$s=h,m.$$arity=1,m)).$to_h());(function(b, +$super,c){function e(){}b=e=l(b,$super,"Formatter",e);var d=[b].concat(c),f,h;a.const_set(d[0],"MESSAGE_FORMAT","%s, [%s] %5s -- %s: %s\n");a.const_set(d[0],"DATE_TIME_FORMAT","%Y-%m-%dT%H:%M:%S.%6N");a.def(b,"$call",f=function(a,b,c,e){return this.$format(g(d,"MESSAGE_FORMAT"),a.$chr(),b.$strftime(g(d,"DATE_TIME_FORMAT")),a,c,this.$message_as_string(e))},f.$$arity=4);return(a.def(b,"$message_as_string",h=function(a){var b,c=q;return function(){c=a;if(v("::","String")["$==="](c))return a;if(v("::", +"Exception")["$==="](c)){var e=""+a.$message()+" ("+a.$class()+")\n",d=(p(b=a.$backtrace())?b:[]).$join("\n");return"number"===typeof e&&"number"===typeof d?e+d:e["$+"](d)}return a.$inspect()}()},h.$$arity=1),q)&&"message_as_string"})(n[0],null,n);h.$attr_reader("level");h.$attr_accessor("progname");h.$attr_accessor("formatter");a.def(h,"$initialize",u=function(a){this.pipe=a;this.level=g(n,"DEBUG");return this.formatter=g(n,"Formatter").$new()},u.$$arity=1);a.def(h,"$level=",E=function(a){var b= +q;return p(v("::","Integer")["$==="](a))?this.level=a:p(b=g(n,"SEVERITY_LABELS").$key(a.$to_s().$upcase()))?this.level=b:this.$raise(g(n,"ArgumentError"),"invalid log level: "+a)},E.$$arity=1);a.def(h,"$info",r=function(a){var b=r.$$p,c=b||q;b&&(r.$$p=null);b&&(r.$$p=null);null==a&&(a=q);return F(this,"add",[g(n,"INFO"),q,a],c.$to_proc())},r.$$arity=-1);a.def(h,"$debug",w=function(a){var b=w.$$p,c=b||q;b&&(w.$$p=null);b&&(w.$$p=null);null==a&&(a=q);return F(this,"add",[g(n,"DEBUG"),q,a],c.$to_proc())}, +w.$$arity=-1);a.def(h,"$warn",x=function(a){var b=x.$$p,c=b||q;b&&(x.$$p=null);b&&(x.$$p=null);null==a&&(a=q);return F(this,"add",[g(n,"WARN"),q,a],c.$to_proc())},x.$$arity=-1);a.def(h,"$error",y=function(a){var b=y.$$p,c=b||q;b&&(y.$$p=null);b&&(y.$$p=null);null==a&&(a=q);return F(this,"add",[g(n,"ERROR"),q,a],c.$to_proc())},y.$$arity=-1);a.def(h,"$fatal",A=function(a){var b=A.$$p,c=b||q;b&&(A.$$p=null);b&&(A.$$p=null);null==a&&(a=q);return F(this,"add",[g(n,"FATAL"),q,a],c.$to_proc())},A.$$arity= +-1);a.def(h,"$unknown",L=function(a){var b=L.$$p,c=b||q;b&&(L.$$p=null);b&&(L.$$p=null);null==a&&(a=q);return F(this,"add",[g(n,"UNKNOWN"),q,a],c.$to_proc())},L.$$arity=-1);a.def(h,"$info?",t=function(){return c(this.level,g(n,"INFO"))},t.$$arity=0);a.def(h,"$debug?",D=function(){return c(this.level,g(n,"DEBUG"))},D.$$arity=0);a.def(h,"$warn?",ca=function(){return c(this.level,g(n,"WARN"))},ca.$$arity=0);a.def(h,"$error?",X=function(){return c(this.level,g(n,"ERROR"))},X.$$arity=0);a.def(h,"$fatal?", +na=function(){return c(this.level,g(n,"FATAL"))},na.$$arity=0);return(a.def(h,"$add",S=function(b,c,e){var d=S.$$p,f=d||q,h;d&&(S.$$p=null);d&&(S.$$p=null);null==c&&(c=q);null==e&&(e=q);var d=b=p(h=b)?h:g(n,"UNKNOWN"),k=this.level,d="number"===typeof d&&"number"===typeof k?db:a["$>"](b)}var q=a.top,v=[],g=a.nil,l=a.const_get_qualified,b=a.const_get_relative,F=a.module,p=a.klass,n=a.send,m=a.truthy,z=a.hash2,d=a.gvars;a.add_stubs("$require $attr_reader $progname= $- $new $formatter= $level= $> $[] $=== $inspect $map $constants $const_get $to_sym $<< $clear $empty? $max $attr_accessor $memoize_logger $private $alias_method $== $define_method $extend $logger $merge".split(" ")); +q.$require("logger");return function(f,v){function q(){}var u=[q=F(f,"Asciidoctor",q)].concat(v);(function(d,$super,f){function v(){}d=v=p(d,$super,"Logger",v);var q=d.prototype,u=[d].concat(f),L,t;q.max_severity=g;d.$attr_reader("max_severity");a.def(d,"$initialize",L=function(d){var f=L.$$p,h=g,k=h=g,p=g;f&&(L.$$p=null);k=0;p=arguments.length;for(h=Array(p);k $time $puts $% $to_f $read_parse $convert $read_parse_convert $const_defined? $respond_to? $clock_gettime".split(" ")); +return function(h,d){function f(){}var k=[f=l(h,"Asciidoctor",f)].concat(d);(function(d,$super,f){function h(){}d=h=b(d,$super,"Timings",h);var k=d.prototype,z=[d].concat(f),l,u,B,t,r,w,x,y,A,Y,U,D,V,K,J;k.timers=k.log=q;a.def(d,"$initialize",l=function(){this.log=F([],{});return this.timers=F([],{})},l.$$arity=0);a.def(d,"$start",u=function(b){var d=q,d=[b,this.$now()];p(this.timers,"[]=",a.to_a(d));return d[c(d.length,1)]},u.$$arity=1);a.def(d,"$record",B=function(b){var d=q,d=[b,c(this.$now(), +this.timers.$delete(b))];p(this.log,"[]=",a.to_a(d));return d[c(d.length,1)]},B.$$arity=1);a.def(d,"$time",t=function(b){var c,e;c=q;c=a.slice.call(arguments,0,arguments.length);c=p(c,"reduce",[0],(e=function(a,b){var c=e.$$s||this,d;null==c.log&&(c.log=q);null==a&&(a=q);null==b&&(b=q);c=n(d=c.log["$[]"](b))?d:0;return"number"===typeof a&&"number"===typeof c?a+c:a["$+"](c)},e.$$s=this,e.$$arity=2,e));return n("number"===typeof c?0"](0))?c:q},t.$$arity=-1);a.def(d,"$read",r=function(){return this.$time("read")}, +r.$$arity=0);a.def(d,"$parse",w=function(){return this.$time("parse")},w.$$arity=0);a.def(d,"$read_parse",x=function(){return this.$time("read","parse")},x.$$arity=0);a.def(d,"$convert",y=function(){return this.$time("convert")},y.$$arity=0);a.def(d,"$read_parse_convert",A=function(){return this.$time("read","parse","convert")},A.$$arity=0);a.def(d,"$write",Y=function(){return this.$time("write")},Y.$$arity=0);a.def(d,"$total",U=function(){return this.$time("read","parse","convert","write")},U.$$arity= +0);a.def(d,"$print_report",D=function(a,b){null==m.stdout&&(m.stdout=q);null==a&&(a=m.stdout);null==b&&(b=q);n(b)&&a.$puts("Input file: "+b);a.$puts(" Time to read and parse source: "+"%05.5f"["$%"](this.$read_parse().$to_f()));a.$puts(" Time to convert document: "+"%05.5f"["$%"](this.$convert().$to_f()));return a.$puts(" Total time (read, parse and convert): "+"%05.5f"["$%"](this.$read_parse_convert().$to_f()))},D.$$arity=-1);return n(n(V=v("::","Process")["$const_defined?"]("CLOCK_MONOTONIC"))? +v("::","Process")["$respond_to?"]("clock_gettime"):V)?(a.const_set(z[0],"CLOCK_ID",v(v("::","Process"),"CLOCK_MONOTONIC")),(a.def(d,"$now",K=function(){return v("::","Process").$clock_gettime(g(z,"CLOCK_ID"))},K.$$arity=0),q)&&"now"):(a.def(d,"$now",J=function(){return v("::","Time").$now()},J.$$arity=0),q)&&"now"})(k[0],null,k)}(h[0],h)};Opal.modules["asciidoctor/version"]=function(a){var c=[],h=a.module;return function(c,e){function g(){}var l=[g=h(c,"Asciidoctor",g)].concat(e);a.const_set(l[0], +"VERSION","1.5.8")}(c[0],c)};Opal.modules["asciidoctor/core_ext/nil_or_empty"]=function(a){var c=[],h=a.nil,q=a.klass,v=a.truthy;a.add_stubs(["$method_defined?"]);(function(c,$super,b){function e(){}c=e=q(c,$super,"NilClass",e);[c].concat(b);return v(c["$method_defined?"]("nil_or_empty?"))?h:a.alias(c,"nil_or_empty?","nil?")})(c[0],null,c);(function(c,$super,b){function e(){}c=e=q(c,$super,"String",e);[c].concat(b);return v(c["$method_defined?"]("nil_or_empty?"))?h:a.alias(c,"nil_or_empty?","empty?")})(c[0], +null,c);(function(c,$super,b){function e(){}c=e=q(c,$super,"Array",e);[c].concat(b);return v(c["$method_defined?"]("nil_or_empty?"))?h:a.alias(c,"nil_or_empty?","empty?")})(c[0],null,c);(function(c,$super,b){function e(){}c=e=q(c,$super,"Hash",e);[c].concat(b);return v(c["$method_defined?"]("nil_or_empty?"))?h:a.alias(c,"nil_or_empty?","empty?")})(c[0],null,c);return function(c,$super,b){function e(){}c=e=q(c,$super,"Numeric",e);[c].concat(b);return v(c["$method_defined?"]("nil_or_empty?"))?h:a.alias(c, +"nil_or_empty?","nil?")}(c[0],null,c)};Opal.modules["asciidoctor/core_ext/regexp/is_match"]=function(a){var c=[],h=a.nil,q=a.klass,v=a.truthy;a.add_stubs(["$method_defined?"]);return function(c,$super,b){function e(){}c=e=q(c,$super,"Regexp",e);[c].concat(b);return v(c["$method_defined?"]("match?"))?h:a.alias(c,"match?","===")}(c[0],null,c)};Opal.modules["asciidoctor/core_ext/string/limit_bytesize"]=function(a){var c=[],h=a.nil,q=a.const_get_qualified,v=a.klass,g=a.truthy;a.add_stubs("$method_defined? $< $bytesize $valid_encoding? $force_encoding $byteslice $-".split(" ")); +return function(c,$super,e){function p(){}c=p=v(c,$super,"String",p);[c].concat(e);var l;return g(c["$method_defined?"]("limit_bytesize"))?h:(a.def(c,"$limit_bytesize",l=function(a){var c=h,c=this.$bytesize(),c="number"===typeof a&&"number"===typeof c?ab:a["$>"](b)}function q(a,b){return"number"===typeof a&&"number"===typeof b?a*b:a["$*"](b)}function v(a,b){return"number"===typeof a&&"number"===typeof b?a-b:a["$-"](b)}function g(a,b){return"number"===typeof a&&"number"===typeof b?a $* $- $end_with? $slice $parse_quoted_text_attributes $size $[]= $unescape_brackets $resolve_pass_subs $start_with? $extract_inner_passthrough $to_sym $attributes $basebackend? $=~ $to_i $convert $new $clear $match? $convert_quoted_text $do_replacement $sub $shift $store_attribute $!= $attribute_undefined $counter $key? $downcase $attribute_missing $tr_s $delete $reject $strip $index $min $compact $map $chop $unescape_bracketed_text $pop $rstrip $extensions $inline_macros? $inline_macros $regexp $instance $names $config $dup $nil_or_empty? $parse_attributes $process_method $register $tr $basename $split_simple_csv $normalize_string $!~ $parse $uri_encode $sub_inline_xrefs $sub_inline_anchors $find $footnotes $id $text $style $lstrip $parse_into $extname $catalog $fetch $outfilesuffix $natural_xrefs $key $attr? $attr $to_s $read_next_id $callouts $< $<< $shorthand_property_syntax $concat $each_char $drop $& $resolve_subs $nil? $require_library $sub_source $resolve_lines_to_highlight $highlight $find_by_alias $find_by_mimetype $name $option? $count $to_a $uniq $sort $resolve_block_subs".split(" ")); +return function(l,E){function B(){}var x=[B=u(l,"Asciidoctor",B)].concat(E);(function(l,E){function B(){}var L=B=u(l,"Substitutors",B),t=[L].concat(E),x,y,A,ha,S,D,U,fa,V,K,J,Z,G,qa,la,H,aa,ba,ma,M,da,ea,R,Ea,Aa,Ba,wa,oa,Fa,Ua,Qa,xa,ta,Q;a.const_set(t[0],"SpecialCharsRx",/[<&>]/);a.const_set(t[0],"SpecialCharsTr",z([">","<","&"],{">":">","<":"<","&":"&"}));a.const_set(t[0],"QuotedTextSniffRx",d(!1,/[*_`#^~]/,!0,/[*'_+#^~]/));a.const_set(t[0],"BASIC_SUBS",["specialcharacters"]).$freeze(); +a.const_set(t[0],"HEADER_SUBS",["specialcharacters","attributes"]).$freeze();a.const_set(t[0],"NORMAL_SUBS","specialcharacters quotes attributes replacements macros post_replacements".split(" ")).$freeze();a.const_set(t[0],"NONE_SUBS",[]).$freeze();a.const_set(t[0],"TITLE_SUBS","specialcharacters quotes replacements macros attributes post_replacements".split(" ")).$freeze();a.const_set(t[0],"REFTEXT_SUBS",["specialcharacters","quotes","replacements"]).$freeze();a.const_set(t[0],"VERBATIM_SUBS",["specialcharacters", +"callouts"]).$freeze();a.const_set(t[0],"SUB_GROUPS",z(["none","normal","verbatim","specialchars"],{none:p(t,"NONE_SUBS"),normal:p(t,"NORMAL_SUBS"),verbatim:p(t,"VERBATIM_SUBS"),specialchars:p(t,"BASIC_SUBS")}));a.const_set(t[0],"SUB_HINTS",z("amnpqrcv".split(""),{a:"attributes",m:"macros",n:"normal",p:"post_replacements",q:"quotes",r:"replacements",c:"specialcharacters",v:"verbatim"}));a.const_set(t[0],"SUB_OPTIONS",z(["block","inline"],{block:c(c(p(t,"SUB_GROUPS").$keys(),p(t,"NORMAL_SUBS")),["callouts"]), +inline:c(p(t,"SUB_GROUPS").$keys(),p(t,"NORMAL_SUBS"))}));a.const_set(t[0],"SUB_HIGHLIGHT",["coderay","pygments"]);f(n("::","RUBY_MIN_VERSION_1_9"))?(a.const_set(t[0],"CAN","\u0018"),a.const_set(t[0],"DEL","\u007f"),a.const_set(t[0],"PASS_START","\u0096"),a.const_set(t[0],"PASS_END","\u0097")):(a.const_set(t[0],"CAN",(24).$chr()),a.const_set(t[0],"DEL",(127).$chr()),a.const_set(t[0],"PASS_START",(150).$chr()),a.const_set(t[0],"PASS_END",(151).$chr()));a.const_set(t[0],"PassSlotRx",new RegExp(""+p(t, +"PASS_START")+"(\\d+)"+p(t,"PASS_END")));a.const_set(t[0],"HighlightedPassSlotRx",new RegExp("]*>"+p(t,"PASS_START")+"[^\\d]*(\\d+)[^\\d]*]*>"+p(t,"PASS_END")+""));a.const_set(t[0],"RS","\\");a.const_set(t[0],"R_SB","]");a.const_set(t[0],"ESC_R_SB","\\]");a.const_set(t[0],"PLUS","+");a.const_set(t[0],"PygmentsWrapperDivRx",/
    (.*)<\/div>/m);a.const_set(t[0],"PygmentsWrapperPreRx",/]*?>(.*?)<\/pre>\s*/m);L.$attr_reader("passthroughs");a.def(L, +"$apply_subs",x=function(a,c){var e,d,g=b,h=b;null==this.passthroughs&&(this.passthroughs=b);null==c&&(c=p(t,"NORMAL_SUBS"));if(f(f(e=a["$empty?"]())?e:c["$!"]()))return a;f(g=n("::","Array")["$==="](a))&&(a=f(a["$[]"](1))?a.$join(p(t,"LF")):a["$[]"](0));f(h=c["$include?"]("macros"))&&(a=this.$extract_passthroughs(a),f(this.passthroughs["$empty?"]())&&(h=!1));r(c,"each",[],(d=function(e){var g=d.$$s||this,h=b;null==e&&(e=b);h=e;return"specialcharacters"["$==="](h)?a=g.$sub_specialchars(a):"quotes"["$==="](h)? +a=g.$sub_quotes(a):"attributes"["$==="](h)?f(a["$include?"](p(t,"ATTR_REF_HEAD")))?a=g.$sub_attributes(a):b:"replacements"["$==="](h)?a=g.$sub_replacements(a):"macros"["$==="](h)?a=g.$sub_macros(a):"highlight"["$==="](h)?a=g.$highlight_source(a,c["$include?"]("callouts")):"callouts"["$==="](h)?f(c["$include?"]("highlight"))?b:a=g.$sub_callouts(a):"post_replacements"["$==="](h)?a=g.$sub_post_replacements(a):g.$logger().$warn("unknown substitution type "+e)},d.$$s=this,d.$$arity=1,d));f(h)&&(a=this.$restore_passthroughs(a)); +return f(g)?a.$split(p(t,"LF"),-1):a},x.$$arity=-2);a.def(L,"$apply_normal_subs",y=function(a){return this.$apply_subs(a)},y.$$arity=1);a.def(L,"$apply_title_subs",A=function(a){return this.$apply_subs(a,p(t,"TITLE_SUBS"))},A.$$arity=1);a.def(L,"$apply_reftext_subs",ha=function(a){return this.$apply_subs(a,p(t,"REFTEXT_SUBS"))},ha.$$arity=1);a.def(L,"$apply_header_subs",S=function(a){return this.$apply_subs(a,p(t,"HEADER_SUBS"))},S.$$arity=1);a.def(L,"$extract_passthroughs",D=function(c){var e,d, +g,l,n,F=b,m=b,E=b,C=b,u=b;null==this.document&&(this.document=b);null==this.passthroughs&&(this.passthroughs=b);F=this.document.$compat_mode();m=this.passthroughs;f(f(e=f(d=c["$include?"]("++"))?d:c["$include?"]("$$"))?e:c["$include?"]("ss:"))&&(c=r(c,"gsub",[p(t,"InlinePassMacroRx")],(g=function(){var c=g.$$s||this,e,d=b,ga=b,O=b,C=b,l=b,n=b,E=b,C=O=d=b;null==w["~"]&&(w["~"]=b);d=w["~"];ga=b;if(f(O=d["$[]"](4))){if(f(f(e=F)?O["$=="]("++"):e))return f(d["$[]"](2))?""+d["$[]"](1)+"["+d["$[]"](2)+"]"+ +d["$[]"](3)+"++"+c.$extract_passthroughs(d["$[]"](5))+"++":""+d["$[]"](1)+d["$[]"](3)+"++"+c.$extract_passthroughs(d["$[]"](5))+"++";C=d["$[]"](2);l=d["$[]"](3).$length();n=d["$[]"](5);E=!1;if(f(C)){if(f(h(l,0)))return""+d["$[]"](1)+"["+C+"]"+q(p(t,"RS"),v(l,1))+O+d["$[]"](5)+O;d["$[]"](1)["$=="](p(t,"RS"))?(ga="["+C+"]",C=b):(f(O["$=="]("++")?C["$end_with?"]("x-"):O["$=="]("++"))&&(E=!0,C=C.$slice(0,v(C.$length(),2))),C=c.$parse_quoted_text_attributes(C))}else if(f(h(l,0)))return""+q(p(t,"RS"),v(l, +1))+O+d["$[]"](5)+O;d=O["$=="]("+++")?[]:p(t,"BASIC_SUBS");O=m.$size();C=f(C)?f(E)?[O,z(["text","subs","type","attributes"],{text:n,subs:p(t,"NORMAL_SUBS"),type:"monospaced",attributes:C})]:[O,z(["text","subs","type","attributes"],{text:n,subs:d,type:"unquoted",attributes:C})]:[O,z(["text","subs"],{text:n,subs:d})]}else{if(d["$[]"](6)["$=="](p(t,"RS")))return d["$[]"](0).$slice(1,d["$[]"](0).$length());C=[O=m.$size(),z(["text","subs"],{text:c.$unescape_brackets(d["$[]"](8)),subs:f(d["$[]"](7))?c.$resolve_pass_subs(d["$[]"](7)): +b})]}r(m,"[]=",a.to_a(C));C[v(C.length,1)];return""+ga+p(t,"PASS_START")+O+p(t,"PASS_END")},g.$$s=this,g.$$arity=0,g)));d=p(t,"InlinePassRx")["$[]"](F);e=a.to_ary(d);E=null==e[0]?b:e[0];C=null==e[1]?b:e[1];u=null==e[2]?b:e[2];d;f(f(e=c["$include?"](E))?e:f(d=C)?c["$include?"](C):d)&&(c=r(c,"gsub",[u],(l=function(){var c=l.$$s||this,e,d=b,g=b,h=b,k=b,q=b,C=b,n=d=b,C=h=k=b;null==w["~"]&&(w["~"]=b);d=w["~"];g=d["$[]"](1);h=d["$[]"](2);f((k=d["$[]"](3))["$start_with?"](p(t,"RS")))&&(q=p(t,"RS"));C=d["$[]"](4); +d=d["$[]"](5);f(F)?n=!0:f(n=f(e=h)?h["$end_with?"]("x-"):e)&&(h=h.$slice(0,v(h.$length(),2)));if(f(h)){if(f(C["$=="]("`")?n["$!"]():C["$=="]("`")))return c.$extract_inner_passthrough(d,""+g+"["+h+"]"+q,h);if(f(q))return""+g+"["+h+"]"+k.$slice(1,k.$length());g["$=="](p(t,"RS"))?(g="["+h+"]",h=b):h=c.$parse_quoted_text_attributes(h)}else{if(f(C["$=="]("`")?n["$!"]():C["$=="]("`")))return c.$extract_inner_passthrough(d,""+g+q);if(f(q))return""+g+k.$slice(1,k.$length())}k=m.$size();f(F)?h=[k,z(["text", +"subs","attributes","type"],{text:d,subs:p(t,"BASIC_SUBS"),attributes:h,type:"monospaced"})]:f(h)?f(n)?(C=C["$=="]("`")?p(t,"BASIC_SUBS"):p(t,"NORMAL_SUBS"),h=[k,z(["text","subs","attributes","type"],{text:d,subs:C,attributes:h,type:"monospaced"})]):h=[k,z(["text","subs","attributes","type"],{text:d,subs:p(t,"BASIC_SUBS"),attributes:h,type:"unquoted"})]:h=[k,z(["text","subs"],{text:d,subs:p(t,"BASIC_SUBS")})];r(m,"[]=",a.to_a(h));h[v(h.length,1)];return""+g+p(t,"PASS_START")+k+p(t,"PASS_END")},l.$$s= +this,l.$$arity=0,l)));f(f(e=c["$include?"](":"))?f(d=c["$include?"]("stem:"))?d:c["$include?"]("math:"):e)&&(c=r(c,"gsub",[p(t,"InlineStemMacroRx")],(n=function(){var c=n.$$s||this,e,d=b,g=b,h=b,k=b,d=g=b;null==c.document&&(c.document=b);null==w["~"]&&(w["~"]=b);d=w["~"];if(f(((e=w["~"])===b?b:e["$[]"](0))["$start_with?"](p(t,"RS"))))return d["$[]"](0).$slice(1,d["$[]"](0).$length());(g=d["$[]"](1).$to_sym())["$=="]("stem")&&(g=p(t,"STEM_TYPE_ALIASES")["$[]"](c.document.$attributes()["$[]"]("stem")).$to_sym()); +h=c.$unescape_brackets(d["$[]"](3));k=f(d["$[]"](2))?c.$resolve_pass_subs(d["$[]"](2)):f(c.document["$basebackend?"]("html"))?p(t,"BASIC_SUBS"):b;g=[d=m.$size(),z(["text","subs","type"],{text:h,subs:k,type:g})];r(m,"[]=",a.to_a(g));g[v(g.length,1)];return""+p(t,"PASS_START")+d+p(t,"PASS_END")},n.$$s=this,n.$$arity=0,n)));return c},D.$$arity=1);a.def(L,"$extract_inner_passthrough",U=function(c,e,d){var g,h,k=b,q=b;null==this.passthroughs&&(this.passthroughs=b);null==d&&(d=b);if(f(f(g=f(h=c["$end_with?"]("+"))? +c["$start_with?"]("+","\\+"):h)?p(t,"SinglePlusInlinePassRx")["$=~"](c):g)){if(f((g=w["~"])===b?b:g["$[]"](1)))return""+e+"`+"+((g=w["~"])===b?b:g["$[]"](2))+"+`";k=[q=this.passthroughs.$size(),f(d)?z(["text","subs","attributes","type"],{text:(g=w["~"])===b?b:g["$[]"](2),subs:p(t,"BASIC_SUBS"),attributes:d,type:"unquoted"}):z(["text","subs"],{text:(g=w["~"])===b?b:g["$[]"](2),subs:p(t,"BASIC_SUBS")})];r(this.passthroughs,"[]=",a.to_a(k));k[v(k.length,1)];return""+e+"`"+p(t,"PASS_START")+q+p(t,"PASS_END")+ +"`"}return""+e+"`"+c+"`"},U.$$arity=-3);a.def(L,"$restore_passthroughs",fa=function(a,c){var e,d=this,g=b;null==d.passthroughs&&(d.passthroughs=b);null==c&&(c=!0);return function(){try{return g=d.passthroughs,r(a,"gsub",[p(t,"PassSlotRx")],(e=function(){var a=e.$$s||this,c,d=b,h=b,k=b,d=g["$[]"](((c=w["~"])===b?b:c["$[]"](1)).$to_i()),h=a.$apply_subs(d["$[]"]("text"),d["$[]"]("subs"));f(k=d["$[]"]("type"))&&(h=p(t,"Inline").$new(a,"quoted",h,z(["type","attributes"],{type:k,attributes:d["$[]"]("attributes")})).$convert()); +return f(h["$include?"](p(t,"PASS_START")))?a.$restore_passthroughs(h,!1):h},e.$$s=d,e.$$arity=0,e))}finally{f(c)&&g.$clear()}}()},fa.$$arity=-2);p(t,"RUBY_ENGINE")["$=="]("opal")?(a.def(L,"$sub_quotes",V=function(a){var c,e=b;null==this.document&&(this.document=b);f(p(t,"QuotedTextSniffRx")["$[]"](e=this.document.$compat_mode())["$match?"](a))&&r(p(t,"QUOTE_SUBS")["$[]"](e),"each",[],(c=function(e,d,f){var g=c.$$s||this,h;null==e&&(e=b);null==d&&(d=b);null==f&&(f=b);return a=r(a,"gsub",[f],(h=function(){var a= +h.$$s||this;null==w["~"]&&(w["~"]=b);return a.$convert_quoted_text(w["~"],e,d)},h.$$s=g,h.$$arity=0,h))},c.$$s=this,c.$$arity=3,c));return a},V.$$arity=1),a.def(L,"$sub_replacements",K=function(a){var c;f(p(t,"ReplaceableTextRx")["$match?"](a))&&r(p(t,"REPLACEMENTS"),"each",[],(c=function(e,d,f){var g=c.$$s||this,h;null==e&&(e=b);null==d&&(d=b);null==f&&(f=b);return a=r(a,"gsub",[e],(h=function(){var a=h.$$s||this;null==w["~"]&&(w["~"]=b);return a.$do_replacement(w["~"],d,f)},h.$$s=g,h.$$arity=0, +h))},c.$$s=this,c.$$arity=3,c));return a},K.$$arity=1)):b;f(n("::","RUBY_MIN_VERSION_1_9"))?a.def(L,"$sub_specialchars",J=function(a){var b,c;return f(f(b=f(c=a["$include?"]("<"))?c:a["$include?"]("&"))?b:a["$include?"](">"))?a.$gsub(p(t,"SpecialCharsRx"),p(t,"SpecialCharsTr")):a},J.$$arity=1):a.def(L,"$sub_specialchars",Z=function(a){var c,e,d;return f(f(c=f(e=a["$include?"]("<"))?e:a["$include?"]("&"))?c:a["$include?"](">"))?r(a,"gsub",[p(t,"SpecialCharsRx")],(d=function(){var a;return p(t,"SpecialCharsTr")["$[]"]((a= +w["~"])===b?b:a["$[]"](0))},d.$$s=this,d.$$arity=0,d)):a},Z.$$arity=1);a.alias(L,"sub_specialcharacters","sub_specialchars");a.def(L,"$do_replacement",G=function(a,c,e){var d=b,d=b;f((d=a["$[]"](0))["$include?"](p(t,"RS")))?a=d.$sub(p(t,"RS"),""):(d=e,a="none"["$==="](d)?c:"bounding"["$==="](d)?""+a["$[]"](1)+c+a["$[]"](2):""+a["$[]"](1)+c);return a},G.$$arity=3);a.def(L,"$sub_attributes",qa=function(c,e){var d,g,h,k,v=b,q=b,l=b,C=b,n=b,F=b,ua=b;null==this.document&&(this.document=b);null==e&&(e= +z([],{}));v=this.document.$attributes();q=l=C=n=F=b;c=r(c,"gsub",[p(t,"AttributeReferenceRx")],(d=function(){var c=d.$$s||this,g,h,k,z=b,ua=b,m=b,E=b;null==c.document&&(c.document=b);return f(f(g=((h=w["~"])===b?b:h["$[]"](1))["$=="](p(t,"RS")))?g:((h=w["~"])===b?b:h["$[]"](4))["$=="](p(t,"RS")))?"{"+((g=w["~"])===b?b:g["$[]"](2))+"}":f((g=w["~"])===b?b:g["$[]"](3))?function(){z=(ua=((g=w["~"])===b?b:g["$[]"](2)).$split(":",3)).$shift();return"set"["$==="](z)?(h=p(t,"Parser").$store_attribute(ua["$[]"](0), +f(k=ua["$[]"](1))?k:"",c.document),g=a.to_ary(h),m=null==g[1]?b:g[1],h,f(f(g=m)?g:(n=f(h=n)?h:f(k=v["$[]"]("attribute-undefined"))?k:p(t,"Compliance").$attribute_undefined())["$!="]("drop-line"))?q=C=p(t,"DEL"):q=l=p(t,"CAN")):"counter2"["$==="](z)?(r(c.document,"counter",a.to_a(ua)),q=C=p(t,"DEL")):r(c.document,"counter",a.to_a(ua))}():f(v["$key?"](E=((g=w["~"])===b?b:g["$[]"](2)).$downcase()))?v["$[]"](E):f(m=p(t,"INTRINSIC_ATTRIBUTES")["$[]"](E))?m:function(){z=F=f(g=F)?g:f(h=f(k=e["$[]"]("attribute_missing"))? +k:v["$[]"]("attribute-missing"))?h:p(t,"Compliance").$attribute_missing();if("drop"["$==="](z))return q=C=p(t,"DEL");if("drop-line"["$==="](z))return c.$logger().$warn("dropping line containing reference to missing attribute: "+E),q=l=p(t,"CAN");"warn"["$==="](z)&&c.$logger().$warn("skipping reference to missing attribute: "+E);return(g=w["~"])===b?b:g["$[]"](0)}()},d.$$s=this,d.$$arity=0,d));return f(q)?f(C)?(ua=c.$tr_s(p(t,"DEL"),p(t,"DEL")).$split(p(t,"LF"),-1),f(l)?r(ua,"reject",[],(g=function(a){var c, +e,d;null==a&&(a=b);return f(c=f(e=f(d=a["$=="](p(t,"DEL")))?d:a["$=="](p(t,"CAN")))?e:a["$start_with?"](p(t,"CAN")))?c:a["$include?"](p(t,"CAN"))},g.$$s=this,g.$$arity=1,g)).$join(p(t,"LF")).$delete(p(t,"DEL")):r(ua,"reject",[],(h=function(a){null==a&&(a=b);return a["$=="](p(t,"DEL"))},h.$$s=this,h.$$arity=1,h)).$join(p(t,"LF")).$delete(p(t,"DEL"))):f(c["$include?"](p(t,"LF")))?r(c.$split(p(t,"LF"),-1),"reject",[],(k=function(a){var c,e;null==a&&(a=b);return f(c=f(e=a["$=="](p(t,"CAN")))?e:a["$start_with?"](p(t, +"CAN")))?c:a["$include?"](p(t,"CAN"))},k.$$s=this,k.$$arity=1,k)).$join(p(t,"LF")):"":c},qa.$$arity=-2);a.def(L,"$sub_macros",la=function(c){try{var e,d,g,q,l,E,u,B,C,L,P,ua,ia=b,ga=b,O=b,Sa=b,Ta=b,T=b,ka=b,x=b,y=b;null==this.document&&(this.document=b);ia=z([],{});ga=(O=["square_bracket",c["$include?"]("[")],r(ia,"[]=",a.to_a(O)),O[v(O.length,1)]);Sa=c["$include?"](":");Ta=(O=["macroish",f(e=ga)?Sa:e],r(ia,"[]=",a.to_a(O)),O[v(O.length,1)]);T=f(e=Ta)?c["$include?"](":["):e;ka=(x=this.document).$attributes(); +f(ka["$key?"]("experimental"))&&(f(f(e=T)?f(d=c["$include?"]("kbd:"))?d:c["$include?"]("btn:"):e)&&(c=r(c,"gsub",[p(t,"InlineKbdBtnMacroRx")],(g=function(){var c=g.$$s||this,e,d,q,C=b,ga=b,l=b;return f((e=w["~"])===b?b:e["$[]"](1))?((e=w["~"])===b?b:e["$[]"](0)).$slice(1,((e=w["~"])===b?b:e["$[]"](0)).$length()):((e=w["~"])===b?b:e["$[]"](2))["$=="]("kbd")?(f((C=((e=w["~"])===b?b:e["$[]"](3)).$strip())["$include?"](p(t,"R_SB")))&&(C=C.$gsub(p(t,"ESC_R_SB"),p(t,"R_SB"))),f(f(e=h(C.$length(),1))?ga= +f(ga=C.$index(",",1))?[ga,C.$index("+",1)].$compact().$min():C.$index("+",1):e)?(l=C.$slice(ga,1),f(C["$end_with?"](l))?(C=r(C.$chop().$split(l,-1),"map",[],(d=function(a){null==a&&(a=b);return a.$strip()},d.$$s=c,d.$$arity=1,d)),O=[-1,""+C["$[]"](-1)+l],r(C,"[]=",a.to_a(O)),O[v(O.length,1)]):C=r(C.$split(l),"map",[],(q=function(a){null==a&&(a=b);return a.$strip()},q.$$s=c,q.$$arity=1,q))):C=[C],p(t,"Inline").$new(c,"kbd",b,z(["attributes"],{attributes:z(["keys"],{keys:C})})).$convert()):p(t,"Inline").$new(c, +"button",c.$unescape_bracketed_text((e=w["~"])===b?b:e["$[]"](3))).$convert()},g.$$s=this,g.$$arity=0,g))),f(f(e=Ta)?c["$include?"]("menu:"):e)&&(c=r(c,"gsub",[p(t,"InlineMenuMacroRx")],(q=function(){var a=q.$$s||this,c,e,d=b,g=d=b,h=b,h=g=b;null==w["~"]&&(w["~"]=b);d=w["~"];if(f(((c=w["~"])===b?b:c["$[]"](0))["$start_with?"](p(t,"RS"))))return d["$[]"](0).$slice(1,d["$[]"](0).$length());c=[d["$[]"](1),d["$[]"](2)];d=c[0];g=c[1];c;f(g)?(f(g["$include?"](p(t,"R_SB")))&&(g=g.$gsub(p(t,"ESC_R_SB"),p(t, +"R_SB"))),f(h=f(g["$include?"](">"))?">":f(g["$include?"](","))?",":b)?(g=r(g.$split(h),"map",[],(e=function(a){null==a&&(a=b);return a.$strip()},e.$$s=a,e.$$arity=1,e)),h=g.$pop()):(c=[[],g.$rstrip()],g=c[0],h=c[1],c)):(c=[[],b],g=c[0],h=c[1],c);return p(t,"Inline").$new(a,"menu",b,z(["attributes"],{attributes:z(["menu","submenus","menuitem"],{menu:d,submenus:g,menuitem:h})})).$convert()},q.$$s=this,q.$$arity=0,q))),f(f(e=c["$include?"]('"'))?c["$include?"](">"):e)&&(c=r(c,"gsub",[p(t,"InlineMenuRx")], +(l=function(){var c=l.$$s||this,e,d,g,h=b,k=h=h=b;d=b;null==w["~"]&&(w["~"]=b);h=w["~"];if(f(((e=w["~"])===b?b:e["$[]"](0))["$start_with?"](p(t,"RS"))))return h["$[]"](0).$slice(1,h["$[]"](0).$length());h=h["$[]"](1);d=r(h.$split(">"),"map",[],(g=function(a){null==a&&(a=b);return a.$strip()},g.$$s=c,g.$$arity=1,g));e=a.to_ary(d);h=null==e[0]?b:e[0];k=m.call(e,1);d;d=k.$pop();return p(t,"Inline").$new(c,"menu",b,z(["attributes"],{attributes:z(["menu","submenus","menuitem"],{menu:h,submenus:k,menuitem:d})})).$convert()}, +l.$$s=this,l.$$arity=0,l))));f(f(e=y=x.$extensions())?y["$inline_macros?"]():e)&&r(y.$inline_macros(),"each",[],(E=function(e){var d=E.$$s||this,g;null==e&&(e=b);return c=r(c,"gsub",[e.$instance().$regexp()],(g=function(){var c=g.$$s||this,d,h=b,k=h=b,q=b,C=b,h=b;null==w["~"]&&(w["~"]=b);h=w["~"];if(f(((d=w["~"])===b?b:d["$[]"](0))["$start_with?"](p(t,"RS"))))return h["$[]"](0).$slice(1,h["$[]"](0).$length());var ga;a:{try{ga=h.$names();break a}catch(l){if(a.rescue(l,[p(t,"StandardError")]))try{ga= +[];break a}finally{a.pop_exception()}else throw l;}ga=void 0}if(f(ga["$empty?"]()))d=[h["$[]"](1),h["$[]"](2),e.$config()];else{var ua;a:{try{ua=h["$[]"]("target");break a}catch(l){if(a.rescue(l,[p(t,"StandardError")]))try{ua=b;break a}finally{a.pop_exception()}else throw l;}ua=void 0}d=ua;var ia;a:{try{ia=h["$[]"]("content");break a}catch(l){if(a.rescue(l,[p(t,"StandardError")]))try{ia=b;break a}finally{a.pop_exception()}else throw l;}ia=void 0}d=[d,ia,e.$config()]}h=d[0];k=d[1];q=d[2];d;C=f(C=q["$[]"]("default_attrs"))? +C.$dup():z([],{});f(k["$nil_or_empty?"]())?f(f(d=k)?q["$[]"]("content_model")["$!="]("attributes"):d)&&(O=["text",k],r(C,"[]=",a.to_a(O)),O[v(O.length,1)]):(k=c.$unescape_bracketed_text(k),q["$[]"]("content_model")["$=="]("attributes")?c.$parse_attributes(k,f(d=q["$[]"]("pos_attrs"))?d:[],z(["into"],{into:C})):(O=["text",k],r(C,"[]=",a.to_a(O)),O[v(O.length,1)]));h=e.$process_method()["$[]"](c,f(d=h)?d:k,C);return f(p(t,"Inline")["$==="](h))?h.$convert():h},g.$$s=d,g.$$arity=0,g))},E.$$s=this,E.$$arity= +1,E));f(f(e=Ta)?f(d=c["$include?"]("image:"))?d:c["$include?"]("icon:"):e)&&(c=r(c,"gsub",[p(t,"InlineImageMacroRx")],(u=function(){var c=u.$$s||this,e,d=b,g=b,h=g=b,k=b,d=b;null==w["~"]&&(w["~"]=b);d=w["~"];if(f((g=(e=w["~"])===b?b:e["$[]"](0))["$start_with?"](p(t,"RS"))))return g.$slice(1,g.$length());e=f(g["$start_with?"]("icon:"))?["icon",["size"]]:["image",["alt","width","height"]];g=e[0];h=e[1];e;f((k=d["$[]"](1))["$include?"](p(t,"ATTR_REF_HEAD")))&&(k=c.$sub_attributes(k));d=c.$parse_attributes(d["$[]"](2), +h,z(["unescape_input"],{unescape_input:!0}));g["$=="]("icon")||x.$register("images",[k,(O=["imagesdir",ka["$[]"]("imagesdir")],r(d,"[]=",a.to_a(O)),O[v(O.length,1)])]);f(e=d["$[]"]("alt"))?e:(O=["alt",(O=["default-alt",p(t,"Helpers").$basename(k,!0).$tr("_-"," ")],r(d,"[]=",a.to_a(O)),O[v(O.length,1)])],r(d,"[]=",a.to_a(O)),O[v(O.length,1)]);return p(t,"Inline").$new(c,"image",b,z(["type","target","attributes"],{type:g,target:k,attributes:d})).$convert()},u.$$s=this,u.$$arity=0,u)));f(f(e=f(d=c["$include?"]("(("))? +c["$include?"]("))"):d)?e:f(d=T)?c["$include?"]("dexterm"):d)&&(c=r(c,"gsub",[p(t,"InlineIndextermMacroRx")],(B=function(){var a=B.$$s||this,e,d=b,g=b,h=b,k=b,q=b,O=b,C=b,ga=b,d=(e=w["~"])===b?b:e["$[]"](0);return function(){g=(e=w["~"])===b?b:e["$[]"](1);if("indexterm"["$==="](g)){c=(e=w["~"])===b?b:e["$[]"](2);if(f(d["$start_with?"](p(t,"RS"))))return d.$slice(1,d.$length());h=a.$split_simple_csv(a.$normalize_string(c,!0));x.$register("indexterms",h);return p(t,"Inline").$new(a,"indexterm",b,z(["attributes"], +{attributes:z(["terms"],{terms:h})})).$convert()}if("indexterm2"["$==="](g)){c=(e=w["~"])===b?b:e["$[]"](2);if(f(d["$start_with?"](p(t,"RS"))))return d.$slice(1,d.$length());k=a.$normalize_string(c,!0);x.$register("indexterms",[k]);return p(t,"Inline").$new(a,"indexterm",k,z(["type"],{type:"visible"})).$convert()}c=(e=w["~"])===b?b:e["$[]"](3);if(f(d["$start_with?"](p(t,"RS"))))if(f(f(e=c["$start_with?"]("("))?c["$end_with?"](")"):e))c=c.$slice(1,v(c.$length(),2)),e=[!0,"(",")"],q=e[0],O=e[1],C=e[2], +e;else return d.$slice(1,d.$length());else q=!0,f(c["$start_with?"]("("))?(f(c["$end_with?"](")"))?(e=[c.$slice(1,v(c.$length(),2)),!1],c=e[0],q=e[1]):(e=[c.$slice(1,c.$length()),"(",""],c=e[0],O=e[1],C=e[2]),e):f(c["$end_with?"](")"))&&(e=[c.$slice(0,v(c.$length(),1)),"",")"],c=e[0],O=e[1],C=e[2],e);f(q)?(k=a.$normalize_string(c),x.$register("indexterms",[k]),ga=p(t,"Inline").$new(a,"indexterm",k,z(["type"],{type:"visible"})).$convert()):(h=a.$split_simple_csv(a.$normalize_string(c)),x.$register("indexterms", +h),ga=p(t,"Inline").$new(a,"indexterm",b,z(["attributes"],{attributes:z(["terms"],{terms:h})})).$convert());return f(O)?""+O+ga+C:ga}()},B.$$s=this,B.$$arity=0,B)));f(f(e=Sa)?c["$include?"]("://"):e)&&(c=r(c,"gsub",[p(t,"InlineLinkRx")],(C=function(){var e=C.$$s||this,d,g,h=b,k=b,q=b,ga=b,l=b,q=h=q=b;null==w["~"]&&(w["~"]=b);h=w["~"];if(f((k=(d=w["~"])===b?b:d["$[]"](2))["$start_with?"](p(t,"RS"))))return""+h["$[]"](1)+k.$slice(1,k.$length())+h["$[]"](3);d=[h["$[]"](1),f(g=q=h["$[]"](3))?g:"",""]; +ga=d[0];c=d[1];l=d[2];d;if(ga["$=="]("link:"))if(f(q))ga="";else return h["$[]"](0);f(f(d=q)?d:p(t,"UriTerminatorRx")["$!~"](k))||(q=(d=w["~"])===b?b:d["$[]"](0),")"["$==="](q)?(k=k.$chop(),l=")"):";"["$==="](q)?f(f(d=ga["$start_with?"]("<"))?k["$end_with?"](">"):d)?(ga=ga.$slice(4,ga.$length()),k=k.$slice(0,v(k.$length(),4))):f((k=k.$chop())["$end_with?"](")"))?(k=k.$chop(),l=");"):l=";":":"["$==="](q)&&(f((k=k.$chop())["$end_with?"](")"))?(k=k.$chop(),l="):"):l=":"),f(k["$end_with?"]("://"))&& +a.ret(h["$[]"](0)));d=[b,z(["type"],{type:"link"})];h=d[0];q=d[1];d;f(c["$empty?"]())||(f(c["$include?"](p(t,"R_SB")))&&(c=c.$gsub(p(t,"ESC_R_SB"),p(t,"R_SB"))),f(f(d=x.$compat_mode()["$!"]())?c["$include?"]("="):d)&&(c=f(d=(h=p(t,"AttributeList").$new(c,e).$parse())["$[]"](1))?d:"",f(h["$key?"]("id"))&&(O=["id",h.$delete("id")],r(q,"[]=",a.to_a(O)),O[v(O.length,1)])),f(c["$end_with?"]("^"))&&(c=c.$chop(),f(h)?f(d=h["$[]"]("window"))?d:(O=["window","_blank"],r(h,"[]=",a.to_a(O)),O[v(O.length,1)]): +h=z(["window"],{window:"_blank"})));f(c["$empty?"]())&&(c=f(ka["$key?"]("hide-uri-scheme"))?k.$sub(p(t,"UriSniffRx"),""):k,f(h)?(O=["role",f(h["$key?"]("role"))?"bare "+h["$[]"]("role"):"bare"],r(h,"[]=",a.to_a(O)),O[v(O.length,1)]):h=z(["role"],{role:"bare"}));x.$register("links",(O=["target",k],r(q,"[]=",a.to_a(O)),O[v(O.length,1)]));f(h)&&(O=["attributes",h],r(q,"[]=",a.to_a(O)),O[v(O.length,1)]);return""+ga+p(t,"Inline").$new(e,"anchor",c,q).$convert()+l},C.$$s=this,C.$$arity=0,C)));f(f(e=Ta)? +f(d=c["$include?"]("link:"))?d:c["$include?"]("mailto:"):e)&&(c=r(c,"gsub",[p(t,"InlineLinkMacroRx")],(L=function(){var e=L.$$s||this,d,g=b,h=b,k=b,q=b,C=b;null==w["~"]&&(w["~"]=b);g=w["~"];if(f(((d=w["~"])===b?b:d["$[]"](0))["$start_with?"](p(t,"RS"))))return g["$[]"](0).$slice(1,g["$[]"](0).$length());h=f(k=g["$[]"](1))?"mailto:"+g["$[]"](2):g["$[]"](2);d=[b,z(["type"],{type:"link"})];q=d[0];C=d[1];d;f((c=g["$[]"](3))["$empty?"]())||(f(c["$include?"](p(t,"R_SB")))&&(c=c.$gsub(p(t,"ESC_R_SB"),p(t, +"R_SB"))),f(k)?f(f(d=x.$compat_mode()["$!"]())?c["$include?"](","):d)&&(c=f(d=(q=p(t,"AttributeList").$new(c,e).$parse())["$[]"](1))?d:"",f(q["$key?"]("id"))&&(O=["id",q.$delete("id")],r(C,"[]=",a.to_a(O)),O[v(O.length,1)]),f(q["$key?"](2))&&(h=f(q["$key?"](3))?""+h+"?subject="+p(t,"Helpers").$uri_encode(q["$[]"](2))+"&body="+p(t,"Helpers").$uri_encode(q["$[]"](3)):""+h+"?subject="+p(t,"Helpers").$uri_encode(q["$[]"](2)))):f(f(d=x.$compat_mode()["$!"]())?c["$include?"]("="):d)&&(c=f(d=(q=p(t, +"AttributeList").$new(c,e).$parse())["$[]"](1))?d:"",f(q["$key?"]("id"))&&(O=["id",q.$delete("id")],r(C,"[]=",a.to_a(O)),O[v(O.length,1)])),f(c["$end_with?"]("^"))&&(c=c.$chop(),f(q)?f(d=q["$[]"]("window"))?d:(O=["window","_blank"],r(q,"[]=",a.to_a(O)),O[v(O.length,1)]):q=z(["window"],{window:"_blank"})));f(c["$empty?"]())&&(f(k)?c=g["$[]"](2):(f(ka["$key?"]("hide-uri-scheme"))?f((c=h.$sub(p(t,"UriSniffRx"),""))["$empty?"]())&&(c=h):c=h,f(q)?(O=["role",f(q["$key?"]("role"))?"bare "+q["$[]"]("role"): +"bare"],r(q,"[]=",a.to_a(O)),O[v(O.length,1)]):q=z(["role"],{role:"bare"})));x.$register("links",(O=["target",h],r(C,"[]=",a.to_a(O)),O[v(O.length,1)]));f(q)&&(O=["attributes",q],r(C,"[]=",a.to_a(O)),O[v(O.length,1)]);return p(t,"Inline").$new(e,"anchor",c,C).$convert()},L.$$s=this,L.$$arity=0,L)));f(c["$include?"]("@"))&&(c=r(c,"gsub",[p(t,"InlineEmailRx")],(P=function(){var a=P.$$s||this,c,e,d=b,g=b;c=b;c=[(e=w["~"])===b?b:e["$[]"](0),(e=w["~"])===b?b:e["$[]"](1)];d=c[0];g=c[1];c;if(f(g))return g["$=="](p(t, +"RS"))?d.$slice(1,d.$length()):d;c="mailto:"+d;x.$register("links",c);return p(t,"Inline").$new(a,"anchor",d,z(["type","target"],{type:"link",target:c})).$convert()},P.$$s=this,P.$$arity=0,P)));f(f(e=Ta)?c["$include?"]("tnote"):e)&&(c=r(c,"gsub",[p(t,"InlineFootnoteMacroRx")],(ua=function(){var e=ua.$$s||this,d,g,h,k,q=b,v=b,C=q=g=b;g=b;null==w["~"]&&(w["~"]=b);q=w["~"];if(f(((d=w["~"])===b?b:d["$[]"](0))["$start_with?"](p(t,"RS"))))return q["$[]"](0).$slice(1,q["$[]"](0).$length());f(q["$[]"](1))? +(g=(f(h=q["$[]"](3))?h:"").$split(",",2),d=a.to_ary(g),v=null==d[0]?b:d[0],c=null==d[1]?b:d[1],g):(d=[q["$[]"](2),q["$[]"](3)],v=d[0],c=d[1],d);if(f(v))f(c)?(c=e.$restore_passthroughs(e.$sub_inline_xrefs(e.$sub_inline_anchors(e.$normalize_string(c,!0))),!1),g=x.$counter("footnote-number"),x.$register("footnotes",n(p(t,"Document"),"Footnote").$new(g,v,c)),d=["ref",b],q=d[0],C=d[1]):(f(g=r(x.$footnotes(),"find",[],(k=function(a){null==a&&(a=b);return a.$id()["$=="](v)},k.$$s=e,k.$$arity=1,k)))?d=[g.$index(), +g.$text()]:(e.$logger().$warn("invalid footnote reference: "+v),d=[b,v]),g=d[0],c=d[1],d,d=["xref",v,b],q=d[0],C=d[1],v=d[2]),d;else if(f(c))c=e.$restore_passthroughs(e.$sub_inline_xrefs(e.$sub_inline_anchors(e.$normalize_string(c,!0))),!1),g=x.$counter("footnote-number"),x.$register("footnotes",n(p(t,"Document"),"Footnote").$new(g,v,c)),q=C=b;else return q["$[]"](0);return p(t,"Inline").$new(e,"footnote",c,z(["attributes","id","target","type"],{attributes:z(["index"],{index:g}),id:v,target:C,type:q})).$convert()}, +ua.$$s=this,ua.$$arity=0,ua)));return this.$sub_inline_xrefs(this.$sub_inline_anchors(c,ia),ia)}catch(I){if(I===a.returner)return I.$v;throw I;}},la.$$arity=1);a.def(L,"$sub_inline_anchors",H=function(a,c){var e,d,g,h,k;null==this.context&&(this.context=b);null==this.parent&&(this.parent=b);null==c&&(c=b);f((e=this.context["$=="]("list_item"))?this.parent.$style()["$=="]("bibliography"):this.context["$=="]("list_item"))&&(a=r(a,"sub",[p(t,"InlineBiblioAnchorRx")],(d=function(){var a=d.$$s||this,c, +e;return p(t,"Inline").$new(a,"anchor","["+(f(c=(e=w["~"])===b?b:e["$[]"](2))?c:(e=w["~"])===b?b:e["$[]"](1))+"]",z(["type","id","target"],{type:"bibref",id:(c=w["~"])===b?b:c["$[]"](1),target:(c=w["~"])===b?b:c["$[]"](1)})).$convert()},d.$$s=this,d.$$arity=0,d)));f(f(e=f(g=f(h=c["$!"]())?h:c["$[]"]("square_bracket"))?a["$include?"]("[["):g)?e:f(g=f(h=c["$!"]())?h:c["$[]"]("macroish"))?a["$include?"]("or:"):g)&&(a=r(a,"gsub",[p(t,"InlineAnchorRx")],(k=function(){var a=k.$$s||this,c,e,d=b,g=b;if(f((c= +w["~"])===b?b:c["$[]"](1)))return((c=w["~"])===b?b:c["$[]"](0)).$slice(1,((c=w["~"])===b?b:c["$[]"](0)).$length());f(d=(c=w["~"])===b?b:c["$[]"](2))?g=(c=w["~"])===b?b:c["$[]"](3):(d=(c=w["~"])===b?b:c["$[]"](4),f(f(c=g=(e=w["~"])===b?b:e["$[]"](5))?g["$include?"](p(t,"R_SB")):c)&&(g=g.$gsub(p(t,"ESC_R_SB"),p(t,"R_SB"))));return p(t,"Inline").$new(a,"anchor",g,z(["type","id","target"],{type:"ref",id:d,target:d})).$convert()},k.$$s=this,k.$$arity=0,k)));return a},H.$$arity=-2);a.def(L,"$sub_inline_xrefs", +aa=function(d,g){var q,l,m;null==g&&(g=b);f(f(q=f(l=f(g)?g["$[]"]("macroish"):d["$include?"]("["))?d["$include?"]("xref:"):l)?q:f(l=d["$include?"]("&"))?d["$include?"]("lt;&"):l)&&(d=r(d,"gsub",[p(t,"InlineXrefMacroRx")],(m=function(){var d=m.$$s||this,g,q,l=b,C=b,r=b,E=b,ua=l=b,ia=b,ga=b,O=b,Sa=O=b,u=b,T=b;null==d.document&&(d.document=b);null==w["~"]&&(w["~"]=b);null==w.VERBOSE&&(w.VERBOSE=b);l=w["~"];if(f(((g=w["~"])===b?b:g["$[]"](0))["$start_with?"](p(t,"RS"))))return l["$[]"](0).$slice(1,l["$[]"](0).$length()); +g=[z([],{}),d.document];C=g[0];r=g[1];g;f(E=l["$[]"](1))?(q=E.$split(",",2),g=a.to_ary(q),E=null==g[0]?b:g[0],l=null==g[1]?b:g[1],q,f(l)&&(l=l.$lstrip())):(ua=!0,E=l["$[]"](2),f(l=l["$[]"](3))&&(f(l["$include?"](p(t,"R_SB")))&&(l=l.$gsub(p(t,"ESC_R_SB"),p(t,"R_SB"))),f(f(g=r.$compat_mode()["$!"]())?l["$include?"]("="):g)&&(l=p(t,"AttributeList").$new(l,d).$parse_into(C)["$[]"](1))));f(r.$compat_mode())?ia=E:f(ga=E.$index("#"))?f(h(ga,0))?(f(h(O=v(v(E.$length(),ga),1),0))?(g=[E.$slice(0,ga),E.$slice(c(ga, +1),O)],O=g[0],ia=g[1],g):O=E.$slice(0,ga),f((Sa=n("::","File").$extname(O))["$empty?"]())?u=O:f(p(t,"ASCIIDOC_EXTENSIONS")["$[]"](Sa))&&(u=O=O.$slice(0,v(O.$length(),Sa.$length())))):(g=[E,E.$slice(1,E.$length())],T=g[0],ia=g[1],g):f(f(g=ua)?E["$end_with?"](".adoc"):g)?u=O=E.$slice(0,v(E.$length(),5)):ia=E;f(T)?(E=ia,f(f(g=w.VERBOSE)?r.$catalog()["$[]"]("ids")["$key?"](E)["$!"]():g)&&d.$logger().$warn("invalid reference: "+E)):f(O)?f(f(g=u)?f(q=r.$attributes()["$[]"]("docname")["$=="](O))?q:r.$catalog()["$[]"]("includes")["$[]"](O): +g)?f(ia)?(g=[ia,b,"#"+ia],E=g[0],O=g[1],T=g[2],g,f(f(g=w.VERBOSE)?r.$catalog()["$[]"]("ids")["$key?"](E)["$!"]():g)&&d.$logger().$warn("invalid reference: "+E)):(g=[b,b,"#"],E=g[0],O=g[1],T=g[2],g):(g=[O,""+r.$attributes()["$[]"]("relfileprefix")+O+(f(u)?r.$attributes().$fetch("relfilesuffix",r.$outfilesuffix()):"")],E=g[0],O=g[1],g,f(ia)?(g=[""+E+"#"+ia,""+O+"#"+ia],E=g[0],T=g[1],g):T=O):f(f(g=r.$compat_mode())?g:p(t,"Compliance").$natural_xrefs()["$!"]())?(g=[ia,"#"+ia],E=g[0],T=g[1],g,f(f(g=w.VERBOSE)? +r.$catalog()["$[]"]("ids")["$key?"](E)["$!"]():g)&&d.$logger().$warn("invalid reference: "+E)):f(r.$catalog()["$[]"]("ids")["$key?"](ia))?(g=[ia,"#"+ia],E=g[0],T=g[1],g):f(f(g=E=r.$catalog()["$[]"]("ids").$key(ia))?f(q=ia["$include?"](" "))?q:ia.$downcase()["$!="](ia):g)?(g=[E,"#"+E],ia=g[0],T=g[1],g):(g=[ia,"#"+ia],E=g[0],T=g[1],g,f(w.VERBOSE)&&d.$logger().$warn("invalid reference: "+E));g=[O,ia,E];C["$[]="]("path",g[0]);C["$[]="]("fragment",g[1]);C["$[]="]("refid",g[2]);g;return p(t,"Inline").$new(d, +"anchor",l,z(["type","target","attributes"],{type:"xref",target:T,attributes:C})).$convert()},m.$$s=this,m.$$arity=0,m)));return d},aa.$$arity=-2);a.def(L,"$sub_callouts",ba=function(a){var d,g=b,h=b,g=f(this["$attr?"]("line-comment"))?p(t,"CalloutSourceRxMap")["$[]"](this.$attr("line-comment")):p(t,"CalloutSourceRx"),h=0;return r(a,"gsub",[g],(d=function(){var a=d.$$s||this,g;null==a.document&&(a.document=b);return f((g=w["~"])===b?b:g["$[]"](2))?((g=w["~"])===b?b:g["$[]"](0)).$sub(p(t,"RS"),""): +p(t,"Inline").$new(a,"callout",((g=w["~"])===b?b:g["$[]"](4))["$=="](".")?(h=c(h,1)).$to_s():(g=w["~"])===b?b:g["$[]"](4),z(["id","attributes"],{id:a.document.$callouts().$read_next_id(),attributes:z(["guard"],{guard:(g=w["~"])===b?b:g["$[]"](1)})})).$convert()},d.$$s=this,d.$$arity=0,d))},ba.$$arity=1);a.def(L,"$sub_post_replacements",ma=function(a){var c,e,d,h=b,k=b;null==this.document&&(this.document=b);null==this.attributes&&(this.attributes=b);if(f(f(c=this.document.$attributes()["$key?"]("hardbreaks"))? +c:this.attributes["$key?"]("hardbreaks-option"))){h=a.$split(p(t,"LF"),-1);if(f(g(h.$size(),2)))return a;k=h.$pop();return r(h,"map",[],(e=function(a){var c=e.$$s||this;null==a&&(a=b);return p(t,"Inline").$new(c,"break",f(a["$end_with?"](p(t,"HARD_LINE_BREAK")))?a.$slice(0,v(a.$length(),2)):a,z(["type"],{type:"line"})).$convert()},e.$$s=this,e.$$arity=1,e))["$<<"](k).$join(p(t,"LF"))}return f(f(c=a["$include?"](p(t,"PLUS")))?a["$include?"](p(t,"HARD_LINE_BREAK")):c)?r(a,"gsub",[p(t,"HardLineBreakRx")], +(d=function(){var a=d.$$s||this,c;return p(t,"Inline").$new(a,"break",(c=w["~"])===b?b:c["$[]"](1),z(["type"],{type:"line"})).$convert()},d.$$s=this,d.$$arity=0,d)):a},ma.$$arity=1);a.def(L,"$convert_quoted_text",M=function(a,c,e){var d=b,g=b,h=b,k=b,q=b;if(f(a["$[]"](0)["$start_with?"](p(t,"RS"))))if(f(e["$=="]("constrained")?d=a["$[]"](2):e["$=="]("constrained")))g="["+d+"]";else return a["$[]"](0).$slice(1,a["$[]"](0).$length());if(e["$=="]("constrained")){if(f(g))return""+g+p(t,"Inline").$new(this, +"quoted",a["$[]"](3),z(["type"],{type:c})).$convert();f(h=a["$[]"](2))&&(k=(q=this.$parse_quoted_text_attributes(h)).$delete("id"),c["$=="]("mark")&&(c="unquoted"));return""+a["$[]"](1)+p(t,"Inline").$new(this,"quoted",a["$[]"](3),z(["type","id","attributes"],{type:c,id:k,attributes:q})).$convert()}f(h=a["$[]"](1))&&(k=(q=this.$parse_quoted_text_attributes(h)).$delete("id"),c["$=="]("mark")&&(c="unquoted"));return p(t,"Inline").$new(this,"quoted",a["$[]"](2),z(["type","id","attributes"],{type:c,id:k, +attributes:q})).$convert()},M.$$arity=3);a.def(L,"$parse_quoted_text_attributes",da=function(c){var e,d=b,g=b,q=b,g=q=d=b;f(c["$include?"](p(t,"ATTR_REF_HEAD")))&&(c=this.$sub_attributes(c));f(c["$include?"](","))&&(c=c.$slice(0,c.$index(",")));return f((c=c.$strip())["$empty?"]())?z([],{}):f(f(e=c["$start_with?"](".","#"))?p(t,"Compliance").$shorthand_property_syntax():e)?(d=c.$split("#",2),f(h(d.$size(),1))?(c=d["$[]"](1).$split("."),e=a.to_ary(c),g=null==e[0]?b:e[0],q=m.call(e,1),c):(g=b,q=[]), +d=f(d["$[]"](0)["$empty?"]())?[]:d["$[]"](0).$split("."),f(h(d.$size(),1))&&d.$shift(),f(h(q.$size(),0))&&d.$concat(q),q=z([],{}),f(g)&&(g=["id",g],r(q,"[]=",a.to_a(g)),g[v(g.length,1)]),f(d["$empty?"]())||(g=["role",d.$join(" ")],r(q,"[]=",a.to_a(g)),g[v(g.length,1)]),q):z(["role"],{role:c})},da.$$arity=1);a.def(L,"$parse_attributes",ea=function(a,c,e){var d,g=b,h=b;null==this.document&&(this.document=b);null==c&&(c=[]);null==e&&(e=z([],{}));if(!f(f(d=a)?a["$empty?"]()["$!"]():d))return z([],{}); +f(f(d=e["$[]"]("sub_input"))?a["$include?"](p(t,"ATTR_REF_HEAD")):d)&&(a=this.document.$sub_attributes(a));f(e["$[]"]("unescape_input"))&&(a=this.$unescape_bracketed_text(a));f(e["$[]"]("sub_result"))&&(g=this);return f(h=e["$[]"]("into"))?p(t,"AttributeList").$new(a,g).$parse_into(h,c):p(t,"AttributeList").$new(a,g).$parse(c)},ea.$$arity=-2);a.def(L,"$expand_subs",R=function(a){var d,g,h=b;if(f(n("::","Symbol")["$==="](a)))return a["$=="]("none")?b:f(d=p(t,"SUB_GROUPS")["$[]"](a))?d:[a];h=[];r(a, +"each",[],(g=function(a){var d=b;null==a&&(a=b);return a["$=="]("none")?b:f(d=p(t,"SUB_GROUPS")["$[]"](a))?h=c(h,d):h["$<<"](a)},g.$$s=this,g.$$arity=1,g));return f(h["$empty?"]())?b:h},R.$$arity=1);a.def(L,"$unescape_bracketed_text",Ea=function(a){f(a["$empty?"]())||f((a=a.$strip().$tr(p(t,"LF")," "))["$include?"](p(t,"R_SB")))&&(a=a.$gsub(p(t,"ESC_R_SB"),p(t,"R_SB")));return a},Ea.$$arity=1);a.def(L,"$normalize_string",Aa=function(a,b){var c;null==b&&(b=!1);f(a["$empty?"]())||(a=a.$strip().$tr(p(t, +"LF")," "),f(f(c=b)?a["$include?"](p(t,"R_SB")):c)&&(a=a.$gsub(p(t,"ESC_R_SB"),p(t,"R_SB"))));return a},Aa.$$arity=-2);a.def(L,"$unescape_brackets",Ba=function(a){f(a["$empty?"]())||f(a["$include?"](p(t,"RS")))&&(a=a.$gsub(p(t,"ESC_R_SB"),p(t,"R_SB")));return a},Ba.$$arity=1);a.def(L,"$split_simple_csv",wa=function(a){var c,e,d=b,g=b,h=b;f(a["$empty?"]())?d=[]:f(a["$include?"]('"'))?(d=[],g=[],h=!1,r(a,"each_char",[],(c=function(a){var c=b;null==a&&(a=b);return function(){c=a;if(","["$==="](c)){if(f(h))return g["$<<"](a); +d["$<<"](g.$join().$strip());return g=[]}return'"'["$==="](c)?h=h["$!"]():g["$<<"](a)}()},c.$$s=this,c.$$arity=1,c)),d["$<<"](g.$join().$strip())):d=r(a.$split(","),"map",[],(e=function(a){null==a&&(a=b);return a.$strip()},e.$$s=this,e.$$arity=1,e));return d},wa.$$arity=1);a.def(L,"$resolve_subs",oa=function(a,d,g,q){var l,z=b,n=b,E=b,F=b;null==d&&(d="block");null==g&&(g=b);null==q&&(q=b);if(f(a["$nil_or_empty?"]()))return b;z=b;f(a["$include?"](" "))&&(a=a.$delete(" "));n=p(t,"SubModifierSniffRx")["$match?"](a); +r(a.$split(","),"each",[],(l=function(a){var h,k,q=b,l=h=b,ga=l=b,q=b;null==a&&(a=b);q=b;f(n)&&((h=a.$chr())["$=="]("+")?(q="append",a=a.$slice(1,a.$length())):h["$=="]("-")?(q="remove",a=a.$slice(1,a.$length())):f(a["$end_with?"]("+"))&&(q="prepend",a=a.$chop()));a=a.$to_sym();f((h=d["$=="]("inline"))?f(k=a["$=="]("verbatim"))?k:a["$=="]("v"):d["$=="]("inline"))?l=p(t,"BASIC_SUBS"):f(p(t,"SUB_GROUPS")["$key?"](a))?l=p(t,"SUB_GROUPS")["$[]"](a):f(f(h=d["$=="]("inline")?a.$length()["$=="](1):d["$=="]("inline"))? +p(t,"SUB_HINTS")["$key?"](a):h)?(l=p(t,"SUB_HINTS")["$[]"](a),l=f(ga=p(t,"SUB_GROUPS")["$[]"](l))?ga:[l]):l=[a];if(f(q))return z=f(h=z)?h:f(g)?g.$drop(0):[],"append"["$==="](q)?z=c(z,l):"prepend"["$==="](q)?z=c(l,z):"remove"["$==="](q)?z=v(z,l):b;z=f(h=z)?h:[];return z=c(z,l)},l.$$s=this,l.$$arity=1,l));if(!f(z))return b;E=z["$&"](p(t,"SUB_OPTIONS")["$[]"](d));f(v(z,E)["$empty?"]())||(F=v(z,E),this.$logger().$warn("invalid substitution type"+(f(h(F.$size(),1))?"s":"")+(f(q)?" for ":"")+q+": "+F.$join(", "))); +return E},oa.$$arity=-2);a.def(L,"$resolve_block_subs",Fa=function(a,b,c){return this.$resolve_subs(a,"block",b,c)},Fa.$$arity=3);a.def(L,"$resolve_pass_subs",Ua=function(a){return this.$resolve_subs(a,"inline",b,"passthrough macro")},Ua.$$arity=1);a.def(L,"$highlight_source",Qa=function(d,h,k){var q,l,E,m,u,L,C=b,N=b,x=b,ua=b,ia=b,ga=b,O=b,Sa=b,Ta=b,T=b,ka=b,P=C=b,y=b,I=b,J=b;null==this.document&&(this.document=b);null==this.passthroughs&&(this.passthroughs=b);null==k&&(k=b);C=k=f(q=k)?q:this.document.$attributes()["$[]"]("source-highlighter"); +"coderay"["$==="](C)?f(f(q=f(l=N=n("::","CodeRay","skip_raise")?"constant":b)?l:(E=B.$$cvars["@@coderay_unavailable"],null!=E)?"class variable":b)?q:this.document.$attributes()["$[]"]("coderay-unavailable"))||(f(p(t,"Helpers").$require_library("coderay",!0,"warn")["$nil?"]())?a.class_variable_set(B,"@@coderay_unavailable",!0):N=!0):"pygments"["$==="](C)?f(f(q=f(l=N=n("::","Pygments","skip_raise")?"constant":b)?l:(m=B.$$cvars["@@pygments_unavailable"],null!=m)?"class variable":b)?q:this.document.$attributes()["$[]"]("pygments-unavailable"))|| +(f(p(t,"Helpers").$require_library("pygments","pygments.rb","warn")["$nil?"]())?a.class_variable_set(B,"@@pygments_unavailable",!0):N=!0):N=!1;if(!f(N))return this.$sub_source(d,h);x=0;ua=!1;f(h)?(ia=z([],{}),ga=-1,O=f(this["$attr?"]("line-comment"))?p(t,"CalloutExtractRxMap")["$[]"](this.$attr("line-comment")):p(t,"CalloutExtractRx"),d=r(d.$split(p(t,"LF"),-1),"map",[],(u=function(d){var g=u.$$s||this,h;null==d&&(d=b);x=c(x,1);return r(d,"gsub",[O],(h=function(){var c,e=b;if(f((c=w["~"])===b?b:c["$[]"](2)))return((c= +w["~"])===b?b:c["$[]"](0)).$sub(p(t,"RS"),"");(f(c=ia["$[]"](x))?c:(e=[x,[]],r(ia,"[]=",a.to_a(e)),e[v(e.length,1)]))["$<<"]([(c=w["~"])===b?b:c["$[]"](1),(c=w["~"])===b?b:c["$[]"](4)]);ga=x;return b},h.$$s=g,h.$$arity=0,h))},u.$$s=this,u.$$arity=1,u)).$join(p(t,"LF")),ua=ga["$=="](x),f(ia["$empty?"]())&&(ia=b)):ia=b;Ta=Sa=b;C=k;"coderay"["$==="](C)?(f(Sa=f(this["$attr?"]("linenums",b,!1))?(f(q=this.document.$attributes()["$[]"]("coderay-linenums-mode"))?q:"table").$to_sym():b)&&(f(g(T=this.$attr("start", +b,1).$to_i(),1))&&(T=1),f(this["$attr?"]("highlight",b,!1))&&(Ta=this.$resolve_lines_to_highlight(d,this.$attr("highlight",b,!1)))),ka=n(n("::","CodeRay"),"Duo")["$[]"](this.$attr("language","text",!1).$to_sym(),"html",z("css line_numbers line_number_start line_number_anchors highlight_lines bold_every".split(" "),{css:(f(q=this.document.$attributes()["$[]"]("coderay-css"))?q:"class").$to_sym(),line_numbers:Sa,line_number_start:T,line_number_anchors:!1,highlight_lines:Ta,bold_every:!1})).$highlight(d)): +"pygments"["$==="](C)&&(C=f(q=n(n("::","Pygments"),"Lexer").$find_by_alias(this.$attr("language","text",!1)))?q:n(n("::","Pygments"),"Lexer").$find_by_mimetype("text/plain"),P=z(["cssclass","classprefix","nobackground","stripnl"],{cssclass:"pyhl",classprefix:"tok-",nobackground:!0,stripnl:!1}),C.$name()["$=="]("PHP")&&(y=["startinline",this["$option?"]("mixed")["$!"]()],r(P,"[]=",a.to_a(y)),y[v(y.length,1)]),(f(q=this.document.$attributes()["$[]"]("pygments-css"))?q:"class")["$=="]("class")||(y=["noclasses", +!0],r(P,"[]=",a.to_a(y)),y[v(y.length,1)],y=["style",f(q=this.document.$attributes()["$[]"]("pygments-style"))?q:n(p(t,"Stylesheets"),"DEFAULT_PYGMENTS_STYLE")],r(P,"[]=",a.to_a(y)),y[v(y.length,1)]),f(this["$attr?"]("highlight",b,!1))&&!f((Ta=this.$resolve_lines_to_highlight(d,this.$attr("highlight",b,!1)))["$empty?"]())&&(y=["hl_lines",Ta.$join(" ")],r(P,"[]=",a.to_a(y)),y[v(y.length,1)]),f(f(q=f(l=this["$attr?"]("linenums",b,!1))?(y=["linenostart",f(g((T=this.$attr("start",1,!1)).$to_i(),1))?1: +T],r(P,"[]=",a.to_a(y)),y[v(y.length,1)]):l)?(y=["linenos",f(l=this.document.$attributes()["$[]"]("pygments-linenums-mode"))?l:"table"],r(P,"[]=",a.to_a(y)),y[v(y.length,1)])["$=="]("table"):q)?(Sa="table",ka=f(ka=C.$highlight(d,z(["options"],{options:P})))?ka.$sub(p(t,"PygmentsWrapperDivRx"),"\\1").$gsub(p(t,"PygmentsWrapperPreRx"),"\\1"):this.$sub_specialchars(d)):f(ka=C.$highlight(d,z(["options"],{options:P})))?f(p(t,"PygmentsWrapperPreRx")["$=~"](ka))&&(ka=(q=w["~"])===b?b:q["$[]"](1)):ka=this.$sub_specialchars(d)); +f(this.passthroughs["$empty?"]())||(ka=ka.$gsub(p(t,"HighlightedPassSlotRx"),""+p(t,"PASS_START")+"\\1"+p(t,"PASS_END")));return f(f(q=h)?ia:q)?(I=x=0,J=Sa["$!="]("table"),r(ka.$split(p(t,"LF"),-1),"map",[],(L=function(d){var g=L.$$s||this,h,q,v,O=b,C=b,l=b,ga=O=b,O=b;null==g.document&&(g.document=b);null==d&&(d=b);if(!f(J)){if(!f(d["$include?"]('')))return d;J=!0}x=c(x,1);if(f(O=ia.$delete(x))){C=b;f(f(h=f(q=ua)?ia["$empty?"]():q)?Sa["$=="]("table"):h)&&(f((h=k["$=="]("coderay"))? +l=d.$index(""):k["$=="]("coderay"))?(h=[d.$slice(0,l),d.$slice(l,d.$length())],d=h[0],C=h[1],h):f((h=k["$=="]("pygments"))?l=d["$start_with?"](""):k["$=="]("pygments"))&&(h=["",d],d=h[0],C=h[1],h));if(O.$size()["$=="](1))return q=O["$[]"](0),h=a.to_ary(q),O=null==h[0]?b:h[0],ga=null==h[1]?b:h[1],q,""+d+p(t,"Inline").$new(g,"callout",ga["$=="](".")?(I=c(I,1)).$to_s():ga,z(["id","attributes"],{id:g.document.$callouts().$read_next_id(),attributes:z(["guard"],{guard:O})})).$convert()+C;O=r(O, +"map",[],(v=function(a,d){var f=v.$$s||this;null==f.document&&(f.document=b);null==a&&(a=b);null==d&&(d=b);return p(t,"Inline").$new(f,"callout",d["$=="](".")?(I=c(I,1)).$to_s():d,z(["id","attributes"],{id:f.document.$callouts().$read_next_id(),attributes:z(["guard"],{guard:a})})).$convert()},v.$$s=g,v.$$arity=2,v)).$join(" ");return""+d+O+C}return d},L.$$s=this,L.$$arity=1,L)).$join(p(t,"LF"))):ka},Qa.$$arity=-3);a.def(L,"$resolve_lines_to_highlight",xa=function(d,h){var k,q=b,q=[];f(h["$include?"](" "))&& +(h=h.$delete(" "));r(f(h["$include?"](","))?h.$split(","):h.$split(";"),"map",[],(k=function(h){var k,l=b,z=b,E=z=b,z=b;null==h&&(h=b);l=!1;f(h["$start_with?"]("!"))&&(h=h.$slice(1,h.$length()),l=!0);return f(z=f(h["$include?"](".."))?"..":f(h["$include?"]("-"))?"-":b)?(k=h.$split(z,2),h=a.to_ary(k),z=null==h[0]?b:h[0],E=null==h[1]?b:h[1],k,f(f(h=E["$empty?"]())?h:g(E=E.$to_i(),0))&&(E=c(d.$count(p(t,"LF")),1)),z=n("::","Range").$new(z.$to_i(),E).$to_a(),f(l)?q=v(q,z):q.$concat(z)):f(l)?q.$delete(h.$to_i()): +q["$<<"](h.$to_i())},k.$$s=this,k.$$arity=1,k));return q.$sort().$uniq()},xa.$$arity=2);a.def(L,"$sub_source",ta=function(a,b){return f(b)?this.$sub_callouts(this.$sub_specialchars(a)):this.$sub_specialchars(a)},ta.$$arity=2);a.def(L,"$lock_in_subs",Q=function(){var c,e,d,g,h=b,k=h=b,q=b,h=b;null==this.default_subs&&(this.default_subs=b);null==this.content_model&&(this.content_model=b);null==this.context&&(this.context=b);null==this.subs&&(this.subs=b);null==this.attributes&&(this.attributes=b);null== +this.style&&(this.style=b);null==this.document&&(this.document=b);if(!f(h=this.default_subs))if(h=this.content_model,"simple"["$==="](h))h=p(t,"NORMAL_SUBS");else if("verbatim"["$==="](h))h=f(f(c=this.context["$=="]("listing"))?c:(e=this.context["$=="]("literal"))?this["$option?"]("listparagraph")["$!"]():this.context["$=="]("literal"))?p(t,"VERBATIM_SUBS"):this.context["$=="]("verse")?p(t,"NORMAL_SUBS"):p(t,"BASIC_SUBS");else if("raw"["$==="](h))h=this.context["$=="]("stem")?p(t,"BASIC_SUBS"):p(t, +"NONE_SUBS");else return this.subs;f(k=this.attributes["$[]"]("subs"))?this.subs=f(c=this.$resolve_block_subs(k,h,this.context))?c:[]:this.subs=h.$drop(0);f(f(c=f(e=f(d=f(g=this.context["$=="]("listing")?this.style["$=="]("source"):this.context["$=="]("listing"))?this.attributes["$key?"]("language"):g)?this.document["$basebackend?"]("html"):d)?p(t,"SUB_HIGHLIGHT")["$include?"](this.document.$attributes()["$[]"]("source-highlighter")):e)?q=this.subs.$index("specialcharacters"):c)&&(h=[q,"highlight"], +r(this.subs,"[]=",a.to_a(h)),h[v(h.length,1)]);return this.subs},Q.$$arity=0)})(x[0],x)}(l[0],l)};Opal.modules["asciidoctor/abstract_node"]=function(a){function c(a,b){return"number"===typeof a&&"number"===typeof b?a-b:a["$-"](b)}function h(a,b){return"number"===typeof a&&"number"===typeof b?a")+": "+(m(e=b["$[]"]("label"))?e:"file")+" does not exist or cannot be read: "+a);return v},Aa.$$arity=-2);a.def(b,"$read_contents",Ba=function(b,c){var e,d,f,h,k,q=v,t=v;null==c&&(c=p([],{}));q=this.document;if(m(m(e=l(z,"Helpers")["$uriish?"](b))?e:m(d= +m(f=t=c["$[]"]("start"))?l(z,"Helpers")["$uriish?"](t):f)?b=q.$path_resolver().$web_path(b,t):d))if(m(q["$attr?"]("allow-uri-read"))){m(q["$attr?"]("cache-uri"))&&l(z,"Helpers").$require_library("open-uri/cached","open-uri-cached");try{return m(c["$[]"]("normalize"))?l(z,"Helpers").$normalize_lines_array(r(g("::","OpenURI"),"open_uri",[b],(h=function(a){null==a&&(a=v);return a.$each_line().$to_a()},h.$$s=this,h.$$arity=1,h))).$join(l(z,"LF")):r(g("::","OpenURI"),"open_uri",[b],(k=function(a){null== +a&&(a=v);return a.$read()},k.$$s=this,k.$$arity=1,k))}catch(n){if(a.rescue(n,[l(z,"StandardError")]))try{return m(c.$fetch("warn_on_failure",!0))&&this.$logger().$warn("could not retrieve contents of "+(m(e=c["$[]"]("label"))?e:"asset")+" at URI: "+b),v}finally{a.pop_exception()}else throw n;}}else return m(c.$fetch("warn_on_failure",!0))&&this.$logger().$warn("cannot retrieve contents of "+(m(e=c["$[]"]("label"))?e:"asset")+" at URI: "+b+" (allow-uri-read attribute not enabled)"),v;else return b= +this.$normalize_system_path(b,c["$[]"]("start"),v,p(["target_name"],{target_name:m(e=c["$[]"]("label"))?e:"asset"})),this.$read_asset(b,p(["normalize","warn_on_failure","label"],{normalize:c["$[]"]("normalize"),warn_on_failure:c.$fetch("warn_on_failure",!0),label:c["$[]"]("label")}))},Ba.$$arity=-2);a.def(b,"$uri_encode_spaces",wa=function(a){return m(a["$include?"](" "))?a.$gsub(" ","%20"):a},wa.$$arity=1);return(a.def(b,"$is_uri?",oa=function(a){return l(z,"Helpers")["$uriish?"](a)},oa.$$arity= +1),v)&&"is_uri?"})(u[0],null,u)}(q[0],q)};Opal.modules["asciidoctor/abstract_block"]=function(a){function c(a,b){return"number"===typeof a&&"number"===typeof b?a-b:a["$-"](b)}function h(a,b){return"number"===typeof a&&"number"===typeof b?a+b:a["$+"](b)}var q=[],v=a.nil,g=a.const_get_qualified,l=a.const_get_relative,b=a.module,m=a.klass,p=a.hash2,n=a.send,r=a.truthy;a.add_stubs("$attr_reader $attr_writer $attr_accessor $== $!= $level $file $lineno $playback_attributes $convert $converter $join $map $to_s $parent $parent= $- $<< $! $empty? $> $find_by_internal $to_proc $[] $has_role? $replace $raise $=== $header? $each $flatten $context $blocks $+ $find_index $next_adjacent_block $select $sub_specialchars $match? $sub_replacements $title $apply_title_subs $include? $delete $reftext $sprintf $sub_quotes $compat_mode $attributes $chomp $increment_and_store_counter $index= $numbered $sectname $counter $numeral= $numeral $caption= $assign_numeral $reindex_sections".split(" ")); +return function(q,d){function f(){}var u=[f=b(q,"Asciidoctor",f)].concat(d);(function(b,$super,d){function f(){}b=f=m(b,$super,"AbstractBlock",f);var q=b.prototype,z=[b].concat(d),u,w,L,t,x,y,A,D,S,Y,U,fa,V,K,J,ya,G,qa,la,H,aa,ba,ma,M,da,ea,R,Ea;q.source_location=q.document=q.attributes=q.blocks=q.next_section_index=q.context=q.style=q.id=q.header=q.caption=q.title_converted=q.converted_title=q.title=q.subs=q.numeral=q.next_section_ordinal=v;b.$attr_reader("blocks");b.$attr_writer("caption");b.$attr_accessor("content_model"); +b.$attr_accessor("level");b.$attr_accessor("numeral");a.alias(b,"number","numeral");a.alias(b,"number=","numeral=");b.$attr_accessor("source_location");b.$attr_accessor("style");b.$attr_reader("subs");a.def(b,"$initialize",u=function(b,c,e){var d=u.$$p,f=v,g=v,h=v;d&&(u.$$p=null);g=0;h=arguments.length;for(f=Array(h);g"](0)},U.$$arity=0);a.def(b,"$find_by",fa=function(b){var c=fa.$$p,e=c||v,d=v;c&&(fa.$$p= +null);c&&(fa.$$p=null);null==b&&(b=p([],{}));try{return n(this,"find_by_internal",[b,d=[]],e.$to_proc())}catch(f){if(a.rescue(f,[g("::","StopIteration")]))try{return d}finally{a.pop_exception()}else throw f;}},fa.$$arity=-1);a.alias(b,"query","find_by");a.def(b,"$find_by_internal",V=function(b,c){var e=V.$$p,d=e||v,f,h,k,q,t,l,z=v,m=v,E=v,F=v,u=v,w=v,w=v;e&&(V.$$p=null);e&&(V.$$p=null);null==b&&(b=p([],{}));null==c&&(c=[]);if(r(r(f=r(h=r(k=r(q=z=(m=b["$[]"]("context"))["$!"]())?q:m["$=="](this.context))? +r(q=(E=b["$[]"]("style"))["$!"]())?q:E["$=="](this.style):k)?r(k=(F=b["$[]"]("role"))["$!"]())?k:this["$has_role?"](F):h)?r(h=(u=b["$[]"]("id"))["$!"]())?h:u["$=="](this.id):f))if(r(u))c.$replace(d!==v?r(a.yield1(d,this))?[this]:[]:[this]),this.$raise(g("::","StopIteration"));else if(d!==v){if(r(w=a.yield1(d,this))){if("skip_children"["$==="](w))return c["$<<"](this),c;if("skip"["$==="](w))return c;c["$<<"](this)}}else c["$<<"](this);r(r(f=(h=this.context["$=="]("document"))?r(k=z)?k:m["$=="]("section"): +this.context["$=="]("document"))?this["$header?"]():f)&&n(this.header,"find_by_internal",[b,c],d.$to_proc());m["$=="]("document")||(this.context["$=="]("dlist")?r(r(f=z)?f:m["$!="]("section"))&&n(this.blocks.$flatten(),"each",[],(t=function(a){null==a&&(a=v);return r(a)?n(a,"find_by_internal",[b,c],d.$to_proc()):v},t.$$s=this,t.$$arity=1,t)):r(n(this.blocks,"each",[],(l=function(a){null==a&&(a=v);return r(m["$=="]("section")?a.$context()["$!="]("section"):m["$=="]("section"))?v:n(a,"find_by_internal", +[b,c],d.$to_proc())},l.$$s=this,l.$$arity=1,l))));return c},V.$$arity=-1);a.def(b,"$next_adjacent_block",K=function(){var a=v,b=v;return this.context["$=="]("document")?v:r(a=(b=this.$parent()).$blocks()["$[]"](h(b.$blocks().$find_index(this),1)))?a:b.$next_adjacent_block()},K.$$arity=0);a.def(b,"$sections",J=function(){var a;return n(this.blocks,"select",[],(a=function(a){null==a&&(a=v);return a.$context()["$=="]("section")},a.$$s=this,a.$$arity=1,a))},J.$$arity=0);a.def(b,"$alt",ya=function(){var a= +v;if(r(a=this.attributes["$[]"]("alt"))){if(a["$=="](this.attributes["$[]"]("default-alt")))return this.$sub_specialchars(a);a=this.$sub_specialchars(a);return r(l(z,"ReplaceableTextRx")["$match?"](a))?this.$sub_replacements(a):a}return v},ya.$$arity=0);a.def(b,"$caption",G=function(){return this.context["$=="]("admonition")?this.attributes["$[]"]("textlabel"):this.caption},G.$$arity=0);a.def(b,"$captioned_title",qa=function(){return""+this.caption+this.$title()},qa.$$arity=0);a.def(b,"$list_marker_keyword", +la=function(a){var b;null==a&&(a=v);return l(z,"ORDERED_LIST_KEYWORDS")["$[]"](r(b=a)?b:this.style)},la.$$arity=-1);a.def(b,"$title",H=function(){var a,b;return r(this.title_converted)?this.converted_title:this.converted_title=r(a=r(b=this.title_converted=!0)?this.title:b)?this.$apply_title_subs(this.title):a},H.$$arity=0);a.def(b,"$title?",aa=function(){return r(this.title)?!0:!1},aa.$$arity=0);a.def(b,"$title=",ba=function(a){var b;return b=[a,v],this.title=b[0],this.title_converted=b[1],b},ba.$$arity= +1);a.def(b,"$sub?",ma=function(a){return this.subs["$include?"](a)},ma.$$arity=1);a.def(b,"$remove_sub",M=function(a){this.subs.$delete(a);return v},M.$$arity=1);a.def(b,"$xreftext",da=function(a){var b,c,e=v,d=v,f=d=v;null==a&&(a=v);r(r(b=e=this.$reftext())?e["$empty?"]()["$!"]():b)?b=e:(r(r(b=r(c=a)?this.title:c)?this.caption:b)?(d=a,"full"["$==="](d)?(d=this.$sprintf(this.$sub_quotes(r(this.document.$compat_mode())?"``%s''":'"`%s`"'),this.$title()),a=r(r(b=this.numeral)?f=this.document.$attributes()["$[]"](this.context["$=="]("image")? +"figure-caption":""+this.context+"-caption"):b)?""+f+" "+this.numeral+", "+d:""+this.caption.$chomp(". ")+", "+d):a="short"["$==="](d)?r(r(b=this.numeral)?f=this.document.$attributes()["$[]"](this.context["$=="]("image")?"figure-caption":""+this.context+"-caption"):b)?""+f+" "+this.numeral:this.caption.$chomp(". "):this.$title()):a=this.$title(),b=a);return b},da.$$arity=-1);a.def(b,"$assign_caption",ea=function(a,b){var c,e,d=v;null==a&&(a=v);null==b&&(b=v);!r(r(c=r(e=this.caption)?e:this.title["$!"]())? +c:this.caption=r(e=a)?e:this.document.$attributes()["$[]"]("caption"))&&r(d=this.document.$attributes()["$[]"](""+(b=r(c=b)?c:this.context)+"-caption"))&&(this.caption=""+d+" "+(this.numeral=this.document.$increment_and_store_counter(""+b+"-number",this))+". ");return v},ea.$$arity=-1);a.def(b,"$assign_numeral",R=function(b){var d,f=v,g=v,p=v,q=v;this.next_section_index=h((f=[this.next_section_index],n(b,"index=",a.to_a(f)),f[c(f.length,1)]),1);r(g=b.$numbered())&&((p=b.$sectname())["$=="]("appendix")? +(f=[this.document.$counter("appendix-number","A")],n(b,"numeral=",a.to_a(f)),f[c(f.length,1)],f=r(q=this.document.$attributes()["$[]"]("appendix-caption"))?[""+q+" "+b.$numeral()+": "]:[""+b.$numeral()+". "],n(b,"caption=",a.to_a(f)),f[c(f.length,1)]):r(r(d=p["$=="]("chapter"))?d:g["$=="]("chapter"))?(f=[this.document.$counter("chapter-number",1)],n(b,"numeral=",a.to_a(f)),f[c(f.length,1)]):(f=[this.next_section_ordinal],n(b,"numeral=",a.to_a(f)),f[c(f.length,1)],this.next_section_ordinal=h(this.next_section_ordinal, +1)));return v},R.$$arity=1);return(a.def(b,"$reindex_sections",Ea=function(){var a;this.next_section_index=0;this.next_section_ordinal=1;return n(this.blocks,"each",[],(a=function(b){var c=a.$$s||this;null==b&&(b=v);return b.$context()["$=="]("section")?(c.$assign_numeral(b),b.$reindex_sections()):v},a.$$s=this,a.$$arity=1,a))},Ea.$$arity=0),v)&&"reindex_sections"})(u[0],l(u,"AbstractNode"),u)}(q[0],q)};Opal.modules["asciidoctor/attribute_list"]=function(a){function c(a,b){return"number"===typeof a&& +"number"===typeof b?a+b:a["$+"](b)}function h(a,b){return"number"===typeof a&&"number"===typeof b?a-b:a["$-"](b)}var q=[],v=a.nil,g=a.const_get_qualified,l=a.const_get_relative,b=a.module,m=a.klass,p=a.hash,n=a.hash2,r=a.truthy,z=a.send;a.add_stubs("$new $[] $update $parse $parse_attribute $eos? $skip_delimiter $+ $rekey $each_with_index $[]= $- $skip_blank $== $peek $parse_attribute_value $get_byte $start_with? $scan_name $! $!= $* $scan_to_delimiter $=== $include? $delete $each $split $empty? $strip $apply_subs $scan_to_quote $gsub $skip $scan".split(" ")); +return function(d,f){function q(){}var u=[q=b(d,"Asciidoctor",q)].concat(f);(function(b,$super,d){function f(){}b=f=m(b,$super,"AttributeList",f);var q=b.prototype,u=[b].concat(d),w,L,t,x,y,A,D,S,Y,U,fa,V;q.attributes=q.scanner=q.delimiter=q.block=q.delimiter_skip_pattern=q.delimiter_boundary_pattern=v;a.const_set(u[0],"BACKSLASH","\\");a.const_set(u[0],"APOS","'");a.const_set(u[0],"BoundaryRxs",p('"',/.*?[^\\](?=")/,l(u,"APOS"),/.*?[^\\](?=')/,",",/.*?(?=[ \t]*(,|$))/));a.const_set(u[0],"EscapedQuotes", +p('"','\\"',l(u,"APOS"),"\\'"));a.const_set(u[0],"NameRx",new RegExp(""+l(u,"CG_WORD")+"["+l(u,"CC_WORD")+"\\-.]*"));a.const_set(u[0],"BlankRx",/[ \t]+/);a.const_set(u[0],"SkipRxs",n(["blank",","],{blank:l(u,"BlankRx"),",":/[ \t]*(,|$)/}));a.def(b,"$initialize",w=function(a,b,c){null==b&&(b=v);null==c&&(c=",");this.scanner=g("::","StringScanner").$new(a);this.block=b;this.delimiter=c;this.delimiter_skip_pattern=l(u,"SkipRxs")["$[]"](c);this.delimiter_boundary_pattern=l(u,"BoundaryRxs")["$[]"](c); +return this.attributes=v},w.$$arity=-2);a.def(b,"$parse_into",L=function(a,b){null==b&&(b=[]);return a.$update(this.$parse(b))},L.$$arity=-2);a.def(b,"$parse",t=function(a){var b=v;null==a&&(a=[]);if(r(this.attributes))return this.attributes;this.attributes=n([],{});for(b=0;r(this.$parse_attribute(b,a))&&!r(this.scanner["$eos?"]());)this.$skip_delimiter(),b=c(b,1);return this.attributes},t.$$arity=-1);a.def(b,"$rekey",x=function(a){return l(u,"AttributeList").$rekey(this.attributes,a)},x.$$arity= +1);a.defs(b,"$rekey",y=function(b,d){var f;z(d,"each_with_index",[],(f=function(d,f){var g=v,g=g=v;null==d&&(d=v);null==f&&(f=v);if(!r(d))return v;g=c(f,1);return r(g=b["$[]"](g))?(g=[d,g],z(b,"[]=",a.to_a(g)),g[h(g.length,1)]):v},f.$$s=this,f.$$arity=2,f));return b},y.$$arity=2);a.def(b,"$parse_attribute",A=function(b,d){var f,g,p=v,q=v,t=q=v,n=v,m=v,q=p=q=n=v;null==b&&(b=0);null==d&&(d=[]);p=!1;this.$skip_blank();if((q=this.scanner.$peek(1))["$=="]('"'))q=this.$parse_attribute_value(this.scanner.$get_byte()), +t=v;else if(q["$=="](l(u,"APOS")))q=this.$parse_attribute_value(this.scanner.$get_byte()),t=v,r(q["$start_with?"](l(u,"APOS")))||(p=!0);else{q=this.$scan_name();n=0;m=v;if(r(this.scanner["$eos?"]())){if(!r(q))return!1}else n=r(f=this.$skip_blank())?f:0,m=this.scanner.$get_byte();if(r(r(f=m["$!"]())?f:m["$=="](this.delimiter)))t=v;else if(r(r(f=m["$!="]("="))?f:q["$!"]()))q=""+q+" "["$*"](n)+m+this.$scan_to_delimiter(),t=v;else if(this.$skip_blank(),r(this.scanner.$peek(1)))if((m=this.scanner.$get_byte())["$=="]('"'))t= +this.$parse_attribute_value(m);else if(m["$=="](l(u,"APOS")))t=this.$parse_attribute_value(m),r(t["$start_with?"](l(u,"APOS")))||(p=!0);else if(m["$=="](this.delimiter))t="";else if(t=""+m+this.$scan_to_delimiter(),t["$=="]("None"))return!0}r(t)?(n=q,"options"["$==="](n)||"opts"["$==="](n)?(r(t["$include?"](","))?(r(t["$include?"](" "))&&(t=t.$delete(" ")),z(t.$split(","),"each",[],(g=function(b){var c=g.$$s||this,e=v;null==c.attributes&&(c.attributes=v);null==b&&(b=v);if(r(b["$empty?"]()))return v; +e=[""+b+"-option",""];z(c.attributes,"[]=",a.to_a(e));return e[h(e.length,1)]},g.$$s=this,g.$$arity=1,g))):(q=[""+(t=t.$strip())+"-option",""],z(this.attributes,"[]=",a.to_a(q)),q[h(q.length,1)]),q=["options",t]):r(r(f=p)?this.block:f)?(n=q,q="title"["$==="](n)||"reftext"["$==="](n)?[q,t]:[q,this.block.$apply_subs(t)]):q=[q,t]):(p=r(r(f=p)?this.block:f)?this.block.$apply_subs(q):q,r(q=d["$[]"](b))&&(q=[q,p],z(this.attributes,"[]=",a.to_a(q)),q[h(q.length,1)]),q=[c(b,1),p]);z(this.attributes,"[]=", +a.to_a(q));q[h(q.length,1)];return!0},A.$$arity=-1);a.def(b,"$parse_attribute_value",D=function(a){var b=v;return this.scanner.$peek(1)["$=="](a)?(this.scanner.$get_byte(),""):r(b=this.$scan_to_quote(a))?(this.scanner.$get_byte(),r(b["$include?"](l(u,"BACKSLASH")))?b.$gsub(l(u,"EscapedQuotes")["$[]"](a),a):b):""+a+this.$scan_to_delimiter()},D.$$arity=1);a.def(b,"$skip_blank",S=function(){return this.scanner.$skip(l(u,"BlankRx"))},S.$$arity=0);a.def(b,"$skip_delimiter",Y=function(){return this.scanner.$skip(this.delimiter_skip_pattern)}, +Y.$$arity=0);a.def(b,"$scan_name",U=function(){return this.scanner.$scan(l(u,"NameRx"))},U.$$arity=0);a.def(b,"$scan_to_delimiter",fa=function(){return this.scanner.$scan(this.delimiter_boundary_pattern)},fa.$$arity=0);return(a.def(b,"$scan_to_quote",V=function(a){return this.scanner.$scan(l(u,"BoundaryRxs")["$[]"](a))},V.$$arity=1),v)&&"scan_to_quote"})(u[0],null,u)}(q[0],q)};Opal.modules["asciidoctor/block"]=function(a){function c(a,b){return"number"===typeof a&&"number"===typeof b?a-b:a["$-"](b)} +var h=[],q=a.nil,v=a.const_get_qualified,g=a.const_get_relative,l=a.module,b=a.klass,m=a.send,p=a.hash2,n=a.truthy;a.add_stubs("$default= $- $attr_accessor $[] $key? $== $=== $drop $delete $[]= $lock_in_subs $nil_or_empty? $normalize_lines_from_string $apply_subs $join $< $size $empty? $rstrip $shift $pop $warn $logger $to_s $class $object_id $inspect".split(" "));return function(h,k){function d(){}var f=[d=l(h,"Asciidoctor",d)].concat(k);(function(d,$super,f){function h(){}d=h=b(d,$super,"Block", +h);var k=d.prototype,l=[d].concat(f),z,r,u,w;f=q;k.attributes=k.content_model=k.lines=k.subs=k.blocks=k.context=k.style=q;f=["simple"];m(a.const_set(l[0],"DEFAULT_CONTENT_MODEL",p("audio image listing literal stem open page_break pass thematic_break video".split(" "),{audio:"empty",image:"empty",listing:"verbatim",literal:"verbatim",stem:"raw",open:"compound",page_break:"empty",pass:"raw",thematic_break:"empty",video:"empty"})),"default=",a.to_a(f));f[c(f.length,1)];a.alias(d,"blockname","context"); +d.$attr_accessor("lines");a.def(d,"$initialize",z=function(b,d,f){var h,k=z.$$p,r=q,u=r=q,E=r=q,w=q;k&&(z.$$p=null);E=0;w=arguments.length;for(r=Array(w);Ev:v["$<"](2);if(n(v))return f["$[]"](0);for(;n(n(b=h=f["$[]"](0))?h.$rstrip()["$empty?"]():b);)f.$shift(); +for(;n(n(b=k=f["$[]"](-1))?k.$rstrip()["$empty?"]():b);)f.$pop();return f.$join(g(l,"LF"))}e.content_model["$=="]("empty")||e.$logger().$warn("Unknown content model '"+e.content_model+"' for block: "+e.$to_s());return q}()},r.$$arity=0);a.def(d,"$source",u=function(){return this.lines.$join(g(l,"LF"))},u.$$arity=0);return(a.def(d,"$to_s",w=function(){var a=q,a=this.content_model["$=="]("compound")?"blocks: "+this.blocks.$size():"lines: "+this.lines.$size();return"#<"+this.$class()+"@"+this.$object_id()+ +" {context: "+this.context.$inspect()+", content_model: "+this.content_model.$inspect()+", style: "+this.style.$inspect()+", "+a+"}>"},w.$$arity=0),q)&&"to_s"})(f[0],g(f,"AbstractBlock"),f)}(h[0],h)};Opal.modules["asciidoctor/callouts"]=function(a){function c(a,b){return"number"===typeof a&&"number"===typeof b?a+b:a["$+"](b)}function h(a,b){return"number"===typeof a&&"number"===typeof b?a-b:a["$-"](b)}var q=[],v=a.nil,g=a.module,l=a.klass,b=a.hash2,r=a.truthy,p=a.send;a.add_stubs("$next_list $<< $current_list $to_i $generate_next_callout_id $+ $<= $size $[] $- $chop $join $map $== $< $generate_callout_id".split(" ")); +return function(q,n){function z(){}var d=[z=g(q,"Asciidoctor",z)].concat(n);(function(d,$super,g){function q(){}d=q=l(d,$super,"Callouts",q);var z=d.prototype;[d].concat(g);var n,m,u,w,x,L,t,y,N;z.co_index=z.lists=z.list_index=v;a.def(d,"$initialize",n=function(){this.lists=[];this.list_index=0;return this.$next_list()},n.$$arity=0);a.def(d,"$register",m=function(a){var d=v;this.$current_list()["$<<"](b(["ordinal","id"],{ordinal:a.$to_i(),id:d=this.$generate_next_callout_id()}));this.co_index=c(this.co_index, +1);return d},m.$$arity=1);a.def(d,"$read_next_id",u=function(){var a=v,b=v,a=v,b=this.$current_list(),d;d=this.co_index;var f=b.$size();d="number"===typeof d&&"number"===typeof f?d<=f:d["$<="](f);r(d)&&(a=b["$[]"](h(this.co_index,1))["$[]"]("id"));this.co_index=c(this.co_index,1);return a},u.$$arity=0);a.def(d,"$callout_ids",w=function(a){var b;return p(this.$current_list(),"map",[],(b=function(b){null==b&&(b=v);return b["$[]"]("ordinal")["$=="](a)?""+b["$[]"]("id")+" ":""},b.$$s=this,b.$$arity=1, +b)).$join().$chop()},w.$$arity=1);a.def(d,"$current_list",x=function(){return this.lists["$[]"](h(this.list_index,1))},x.$$arity=0);a.def(d,"$next_list",L=function(){this.list_index=c(this.list_index,1);var a;a=this.lists.$size();var b=this.list_index;a="number"===typeof a&&"number"===typeof b?a=b:a["$>="](b)}function q(a,b){return"number"===typeof a&&"number"===typeof b?a+b:a["$+"](b)}var v=[],g=a.nil,l=a.const_get_qualified,b=a.const_get_relative,r=a.module,p=a.klass,n=a.send,m=a.truthy,z=a.hash2,d=a.gvars;a.add_stubs("$new $attr_reader $nil? $<< $[] $[]= $- $include? $strip $squeeze $gsub $empty? $! $rpartition $attr_accessor $delete $base_dir $options $inject $catalog $== $dup $attributes $safe $compat_mode $sourcemap $path_resolver $converter $extensions $each $end_with? $start_with? $slice $length $chop $downcase $extname $=== $value_for_name $to_s $key? $freeze $attribute_undefined $attribute_missing $name_for_value $expand_path $pwd $>= $+ $abs $to_i $delete_if $update_doctype_attributes $cursor $parse $restore_attributes $update_backend_attributes $utc $at $Integer $now $index $strftime $year $utc_offset $fetch $activate $create $to_proc $groups $preprocessors? $preprocessors $process_method $tree_processors? $tree_processors $!= $counter $nil_or_empty? $nextval $value $save_to $chr $ord $source $source_lines $doctitle $sectname= $title= $first_section $title $merge $> $< $find $context $assign_numeral $clear_playback_attributes $save_attributes $attribute_locked? $rewind $replace $name $negate $limit_bytesize $apply_attribute_value_subs $delete? $=~ $apply_subs $resolve_pass_subs $apply_header_subs $create_converter $basebackend $outfilesuffix $filetype $sub $raise $Array $backend $default $start $doctype $content_model $warn $logger $content $convert $postprocessors? $postprocessors $record $write $respond_to? $chomp $write_alternate_pages $map $split $resolve_docinfo_subs $& $normalize_system_path $read_asset $docinfo_processors? $compact $join $resolve_subs $docinfo_processors $class $object_id $inspect $size".split(" ")); +return function(f,v){function u(){}var w=[u=r(f,"Asciidoctor",u)].concat(v);(function(f,$super,v){function r(){}f=r=p(f,$super,"Document",r);var u=f.prototype,w=[f].concat(v),F,t,x,y,A,D,S,Y,U,fa,V,K,J,H,G,qa,Z,ya,aa,ba,M,sa,da,ea,R,Ea,Aa,ja,wa,oa,Fa,Q,Qa,xa,La,Ma,Ca,Ga,Ha,Ia,Pa,Ra,Na,Oa,Va,C,W,Ja;u.attributes=u.safe=u.sourcemap=u.reader=u.base_dir=u.parsed=u.parent_document=u.extensions=u.options=u.counters=u.catalog=u.header=u.blocks=u.attributes_modified=u.id=u.header_attributes=u.max_attribute_value_size= +u.attribute_overrides=u.backend=u.doctype=u.converter=u.timings=u.outfilesuffix=u.docinfo_processor_extensions=u.document=g;a.const_set(w[0],"ImageReference",n(l("::","Struct"),"new",["target","imagesdir"],(F=function(){return a.alias(F.$$s||this,"to_s","target")},F.$$s=f,F.$$arity=0,F)));a.const_set(w[0],"Footnote",l("::","Struct").$new("index","id","text"));(function(b,$super,d){function f(){}b=f=p(b,$super,"AttributeEntry",f);[b].concat(d);var h,k;b.$attr_reader("name","value","negate");a.def(b, +"$initialize",h=function(a,b,c){null==c&&(c=g);this.name=a;this.value=b;return this.negate=m(c["$nil?"]())?b["$nil?"]():c},h.$$arity=-3);return(a.def(b,"$save_to",k=function(b){var d,f=g;(m(d=b["$[]"]("attribute_entries"))?d:(f=["attribute_entries",[]],n(b,"[]=",a.to_a(f)),f[c(f.length,1)]))["$<<"](this);return this},k.$$arity=1),g)&&"save_to"})(w[0],null,w);(function(c,$super,d){function e(){}c=e=p(c,$super,"Title",e);var f=c.prototype,h=[c].concat(d),k,q,l,v;f.sanitized=f.subtitle=f.combined=g; +c.$attr_reader("main");a.alias(c,"title","main");c.$attr_reader("subtitle");c.$attr_reader("combined");a.def(c,"$initialize",k=function(c,d){var e,f,k=g;null==d&&(d=z([],{}));m(m(e=this.sanitized=d["$[]"]("sanitize"))?c["$include?"]("<"):e)&&(c=c.$gsub(b(h,"XmlSanitizeRx"),"").$squeeze(" ").$strip());m(m(e=(k=m(f=d["$[]"]("separator"))?f:":")["$empty?"]())?e:c["$include?"](k=""+k+" ")["$!"]())?(this.main=c,this.subtitle=g):(f=c.$rpartition(k),e=a.to_ary(f),this.main=null==e[0]?g:e[0],this.subtitle= +null==e[2]?g:e[2],f);return this.combined=c},k.$$arity=-2);a.def(c,"$sanitized?",q=function(){return this.sanitized},q.$$arity=0);a.def(c,"$subtitle?",l=function(){return m(this.subtitle)?!0:!1},l.$$arity=0);return(a.def(c,"$to_s",v=function(){return this.combined},v.$$arity=0),g)&&"to_s"})(w[0],null,w);a.const_set(w[0],"Author",l("::","Struct").$new("name","firstname","middlename","lastname","initials","email"));f.$attr_reader("safe");f.$attr_reader("compat_mode");f.$attr_reader("backend");f.$attr_reader("doctype"); +f.$attr_accessor("sourcemap");f.$attr_reader("catalog");a.alias(f,"references","catalog");f.$attr_reader("counters");f.$attr_reader("header");f.$attr_reader("base_dir");f.$attr_reader("options");f.$attr_reader("outfilesuffix");f.$attr_reader("parent_document");f.$attr_reader("reader");f.$attr_reader("path_resolver");f.$attr_reader("converter");f.$attr_reader("extensions");a.def(f,"$initialize",t=function(d,f){var p,v,C,r,u,F,E,x=g,I=g,y=g,L=g,J=g,A=J=J=g,K=g,D=A=g,V=A=A=g,ea=g,J=J=ea=A=x=g;t.$$p&& +(t.$$p=null);null==d&&(d=g);null==f&&(f=z([],{}));n(this,a.find_super_dispatcher(this,"initialize",t,!1),[this,"document"],null);if(m(x=f.$delete("parent")))this.parent_document=x,m(p=f["$[]"]("base_dir"))?p:(I=["base_dir",x.$base_dir()],n(f,"[]=",a.to_a(I)),I[c(I.length,1)]),m(x.$options()["$[]"]("catalog_assets"))&&(I=["catalog_assets",!0],n(f,"[]=",a.to_a(I)),I[c(I.length,1)]),this.catalog=n(x.$catalog(),"inject",[z([],{})],(v=function(b,d){var f,h,k=g;f=g;null==b&&(b=g);null==d&&(d=g);h=d;f=a.to_ary(h); +k=null==f[0]?g:f[0];f=null==f[1]?g:f[1];h;I=[k,k["$=="]("footnotes")?[]:f];n(b,"[]=",a.to_a(I));I[c(I.length,1)];return b},v.$$s=this,v.$$arity=2,v.$$has_top_level_mlhs_arg=!0,v)),this.attribute_overrides=y=x.$attributes().$dup(),L=y.$delete("doctype"),y.$delete("compat-mode"),y.$delete("toc"),y.$delete("toc-placement"),y.$delete("toc-position"),this.safe=x.$safe(),m(this.compat_mode=x.$compat_mode())&&(I=["compat-mode",""],n(this.attributes,"[]=",a.to_a(I)),I[c(I.length,1)]),this.sourcemap=x.$sourcemap(), +this.timings=g,this.path_resolver=x.$path_resolver(),this.converter=x.$converter(),J=!1,this.extensions=x.$extensions();else{this.parent_document=g;this.catalog=z("ids refs footnotes links images indexterms callouts includes".split(" "),{ids:z([],{}),refs:z([],{}),footnotes:[],links:[],images:[],indexterms:[],callouts:b(w,"Callouts").$new(),includes:z([],{})});this.attribute_overrides=y=z([],{});n(m(p=f["$[]"]("attributes"))?p:z([],{}),"each",[],(C=function(b,d){var f;null==b&&(b=g);null==d&&(d=g); +m(b["$end_with?"]("@"))?(f=m(b["$start_with?"]("!"))?[b.$slice(1,c(b.$length(),2)),!1]:m(b["$end_with?"]("!@"))?[b.$slice(0,c(b.$length(),2)),!1]:[b.$chop(),""+d+"@"],b=f[0],d=f[1],f):m(b["$start_with?"]("!"))?(f=[b.$slice(1,b.$length()),d["$=="]("@")?!1:g],b=f[0],d=f[1],f):m(b["$end_with?"]("!"))&&(f=[b.$chop(),d["$=="]("@")?!1:g],b=f[0],d=f[1],f);I=[b.$downcase(),d];n(y,"[]=",a.to_a(I));return I[c(I.length,1)]},C.$$s=this,C.$$arity=2,C));m(J=f["$[]"]("to_file"))&&(I=["outfilesuffix",l("::","File").$extname(J)], +n(y,"[]=",a.to_a(I)),I[c(I.length,1)]);if(m((J=f["$[]"]("safe"))["$!"]()))this.safe=l(b(w,"SafeMode"),"SECURE");else if(m(l("::","Integer")["$==="](J)))this.safe=J;else try{this.safe=b(w,"SafeMode").$value_for_name(J.$to_s())}catch(X){if(a.rescue(X,[b(w,"StandardError")]))try{this.safe=l(b(w,"SafeMode"),"SECURE")}finally{a.pop_exception()}else throw X;}this.compat_mode=y["$key?"]("compat-mode");this.sourcemap=f["$[]"]("sourcemap");this.timings=f.$delete("timings");this.path_resolver=b(w,"PathResolver").$new(); +this.converter=g;J=(r=l("::","Asciidoctor","skip_raise"))&&(p=l(r,"Extensions","skip_raise"))?"constant":g;this.extensions=g}this.parsed=!1;this.header=this.header_attributes=g;this.counters=z([],{});this.attributes_modified=l("::","Set").$new();this.docinfo_processor_extensions=z([],{});A=m(u=f["$[]"]("header_footer"))?u:(I=["header_footer",!1],n(f,"[]=",a.to_a(I)),I[c(I.length,1)]);(this.options=f).$freeze();K=this.attributes;I=["sectids",""];n(K,"[]=",a.to_a(I));I[c(I.length,1)];I=["toc-placement", +"auto"];n(K,"[]=",a.to_a(I));I[c(I.length,1)];m(A)?(I=["copycss",""],n(K,"[]=",a.to_a(I)),I[c(I.length,1)],I=["embedded",g]):(I=["notitle",""],n(K,"[]=",a.to_a(I)),I[c(I.length,1)],I=["embedded",""]);n(y,"[]=",a.to_a(I));I[c(I.length,1)];I=["stylesheet",""];n(K,"[]=",a.to_a(I));I[c(I.length,1)];I=["webfonts",""];n(K,"[]=",a.to_a(I));I[c(I.length,1)];I=["prewrap",""];n(K,"[]=",a.to_a(I));I[c(I.length,1)];I=["attribute-undefined",b(w,"Compliance").$attribute_undefined()];n(K,"[]=",a.to_a(I));I[c(I.length, +1)];I=["attribute-missing",b(w,"Compliance").$attribute_missing()];n(K,"[]=",a.to_a(I));I[c(I.length,1)];I=["iconfont-remote",""];n(K,"[]=",a.to_a(I));I[c(I.length,1)];I=["caution-caption","Caution"];n(K,"[]=",a.to_a(I));I[c(I.length,1)];I=["important-caption","Important"];n(K,"[]=",a.to_a(I));I[c(I.length,1)];I=["note-caption","Note"];n(K,"[]=",a.to_a(I));I[c(I.length,1)];I=["tip-caption","Tip"];n(K,"[]=",a.to_a(I));I[c(I.length,1)];I=["warning-caption","Warning"];n(K,"[]=",a.to_a(I));I[c(I.length, +1)];I=["example-caption","Example"];n(K,"[]=",a.to_a(I));I[c(I.length,1)];I=["figure-caption","Figure"];n(K,"[]=",a.to_a(I));I[c(I.length,1)];I=["table-caption","Table"];n(K,"[]=",a.to_a(I));I[c(I.length,1)];I=["toc-title","Table of Contents"];n(K,"[]=",a.to_a(I));I[c(I.length,1)];I=["section-refsig","Section"];n(K,"[]=",a.to_a(I));I[c(I.length,1)];I=["part-refsig","Part"];n(K,"[]=",a.to_a(I));I[c(I.length,1)];I=["chapter-refsig","Chapter"];n(K,"[]=",a.to_a(I));I[c(I.length,1)];I=["appendix-caption", +(I=["appendix-refsig","Appendix"],n(K,"[]=",a.to_a(I)),I[c(I.length,1)])];n(K,"[]=",a.to_a(I));I[c(I.length,1)];I=["untitled-label","Untitled"];n(K,"[]=",a.to_a(I));I[c(I.length,1)];I=["version-label","Version"];n(K,"[]=",a.to_a(I));I[c(I.length,1)];I=["last-update-label","Last updated"];n(K,"[]=",a.to_a(I));I[c(I.length,1)];I=["asciidoctor",""];n(y,"[]=",a.to_a(I));I[c(I.length,1)];I=["asciidoctor-version",b(w,"VERSION")];n(y,"[]=",a.to_a(I));I[c(I.length,1)];I=["safe-mode-name",A=b(w,"SafeMode").$name_for_value(this.safe)]; +n(y,"[]=",a.to_a(I));I[c(I.length,1)];I=["safe-mode-"+A,""];n(y,"[]=",a.to_a(I));I[c(I.length,1)];I=["safe-mode-level",this.safe];n(y,"[]=",a.to_a(I));I[c(I.length,1)];m(u=y["$[]"]("max-include-depth"))?u:(I=["max-include-depth",64],n(y,"[]=",a.to_a(I)),I[c(I.length,1)]);m(u=y["$[]"]("allow-uri-read"))?u:(I=["allow-uri-read",g],n(y,"[]=",a.to_a(I)),I[c(I.length,1)]);I=["user-home",b(w,"USER_HOME")];n(y,"[]=",a.to_a(I));I[c(I.length,1)];m(y["$key?"]("numbered"))&&(I=["sectnums",y.$delete("numbered")], +n(y,"[]=",a.to_a(I)),I[c(I.length,1)]);m(D=f["$[]"]("base_dir"))?this.base_dir=(I=["docdir",l("::","File").$expand_path(D)],n(y,"[]=",a.to_a(I)),I[c(I.length,1)]):m(y["$[]"]("docdir"))?this.base_dir=y["$[]"]("docdir"):this.base_dir=(I=["docdir",l("::","Dir").$pwd()],n(y,"[]=",a.to_a(I)),I[c(I.length,1)]);m(A=f["$[]"]("backend"))&&(I=["backend",""+A],n(y,"[]=",a.to_a(I)),I[c(I.length,1)]);m(A=f["$[]"]("doctype"))&&(I=["doctype",""+A],n(y,"[]=",a.to_a(I)),I[c(I.length,1)]);m(h(this.safe,l(b(w,"SafeMode"), +"SERVER")))&&(m(u=y["$[]"]("copycss"))?u:(I=["copycss",g],n(y,"[]=",a.to_a(I)),I[c(I.length,1)]),m(u=y["$[]"]("source-highlighter"))?u:(I=["source-highlighter",g],n(y,"[]=",a.to_a(I)),I[c(I.length,1)]),m(u=y["$[]"]("backend"))?u:(I=["backend",b(w,"DEFAULT_BACKEND")],n(y,"[]=",a.to_a(I)),I[c(I.length,1)]),m(m(u=x["$!"]())?y["$key?"]("docfile"):u)&&(I=["docfile",y["$[]"]("docfile")["$[]"](a.Range.$new(q(y["$[]"]("docdir").$length(),1),-1,!1))],n(y,"[]=",a.to_a(I)),I[c(I.length,1)]),I=["docdir",""], +n(y,"[]=",a.to_a(I)),I[c(I.length,1)],I=["user-home","."],n(y,"[]=",a.to_a(I)),I[c(I.length,1)],m(h(this.safe,l(b(w,"SafeMode"),"SECURE")))&&(m(y["$key?"]("max-attribute-value-size"))||(I=["max-attribute-value-size",4096],n(y,"[]=",a.to_a(I)),I[c(I.length,1)]),m(y["$key?"]("linkcss"))||(I=["linkcss",""],n(y,"[]=",a.to_a(I)),I[c(I.length,1)]),m(u=y["$[]"]("icons"))?u:(I=["icons",g],n(y,"[]=",a.to_a(I)),I[c(I.length,1)])));this.max_attribute_value_size=m(V=m(u=y["$[]"]("max-attribute-value-size"))? +u:(I=["max-attribute-value-size",g],n(y,"[]=",a.to_a(I)),I[c(I.length,1)]))?V.$to_i().$abs():g;n(y,"delete_if",[],(F=function(b,d){var f,h=g;null==b&&(b=g);null==d&&(d=g);m(d)?(m(m(f=l("::","String")["$==="](d))?d["$end_with?"]("@"):f)&&(f=[d.$chop(),!0],d=f[0],h=f[1],f),I=[b,d],n(K,"[]=",a.to_a(I)),I[c(I.length,1)]):(K.$delete(b),h=d["$=="](!1));return h},F.$$s=this,F.$$arity=2,F));if(m(x))return this.backend=K["$[]"]("backend"),(this.doctype=(I=["doctype",L],n(K,"[]=",a.to_a(I)),I[c(I.length,1)]))["$=="](b(w, +"DEFAULT_DOCTYPE"))||this.$update_doctype_attributes(b(w,"DEFAULT_DOCTYPE")),this.reader=b(w,"Reader").$new(d,f["$[]"]("cursor")),m(this.sourcemap)&&(this.source_location=this.reader.$cursor()),b(w,"Parser").$parse(this.reader,this),this.$restore_attributes(),this.parsed=!0;this.backend=g;(m(u=K["$[]"]("backend"))?u:(I=["backend",b(w,"DEFAULT_BACKEND")],n(K,"[]=",a.to_a(I)),I[c(I.length,1)]))["$=="]("manpage")?this.doctype=(I=["doctype",(I=["doctype","manpage"],n(y,"[]=",a.to_a(I)),I[c(I.length,1)])], +n(K,"[]=",a.to_a(I)),I[c(I.length,1)]):this.doctype=m(u=K["$[]"]("doctype"))?u:(I=["doctype",b(w,"DEFAULT_DOCTYPE")],n(K,"[]=",a.to_a(I)),I[c(I.length,1)]);this.$update_backend_attributes(K["$[]"]("backend"),!0);ea=m(l("::","ENV")["$[]"]("SOURCE_DATE_EPOCH"))?l("::","Time").$at(this.$Integer(l("::","ENV")["$[]"]("SOURCE_DATE_EPOCH"))).$utc():l("::","Time").$now();m(x=K["$[]"]("localdate"))?A=m(u=K["$[]"]("localyear"))?u:(I=["localyear",x.$index("-")["$=="](4)?x.$slice(0,4):g],n(K,"[]=",a.to_a(I)), +I[c(I.length,1)]):(x=(I=["localdate",ea.$strftime("%F")],n(K,"[]=",a.to_a(I)),I[c(I.length,1)]),A=m(u=K["$[]"]("localyear"))?u:(I=["localyear",ea.$year().$to_s()],n(K,"[]=",a.to_a(I)),I[c(I.length,1)]));ea=m(u=K["$[]"]("localtime"))?u:(I=["localtime",ea.$strftime("%T "+(ea.$utc_offset()["$=="](0)?"UTC":"%z"))],n(K,"[]=",a.to_a(I)),I[c(I.length,1)]);m(u=K["$[]"]("localdatetime"))?u:(I=["localdatetime",""+x+" "+ea],n(K,"[]=",a.to_a(I)),I[c(I.length,1)]);m(u=K["$[]"]("docdate"))?u:(I=["docdate",x],n(K, +"[]=",a.to_a(I)),I[c(I.length,1)]);m(u=K["$[]"]("docyear"))?u:(I=["docyear",A],n(K,"[]=",a.to_a(I)),I[c(I.length,1)]);m(u=K["$[]"]("doctime"))?u:(I=["doctime",ea],n(K,"[]=",a.to_a(I)),I[c(I.length,1)]);m(u=K["$[]"]("docdatetime"))?u:(I=["docdatetime",""+x+" "+ea],n(K,"[]=",a.to_a(I)),I[c(I.length,1)]);m(u=K["$[]"]("stylesdir"))?u:(I=["stylesdir","."],n(K,"[]=",a.to_a(I)),I[c(I.length,1)]);m(u=K["$[]"]("iconsdir"))?u:(I=["iconsdir",""+K.$fetch("imagesdir","./images")+"/icons"],n(K,"[]=",a.to_a(I)), +I[c(I.length,1)]);m(J)&&(m(J=f["$[]"]("extension_registry"))?m(m(u=l(b(w,"Extensions"),"Registry")["$==="](J))?u:m(E=l("::","RUBY_ENGINE_JRUBY"))?l(l(l("::","AsciidoctorJ"),"Extensions"),"ExtensionRegistry")["$==="](J):E)&&(this.extensions=J.$activate(this)):m(l("::","Proc")["$==="](J=f["$[]"]("extensions")))?this.extensions=n(b(w,"Extensions"),"create",[],J.$to_proc()).$activate(this):m(b(w,"Extensions").$groups()["$empty?"]()["$!"]())&&(this.extensions=l(b(w,"Extensions"),"Registry").$new().$activate(this))); +this.reader=b(w,"PreprocessorReader").$new(this,d,l(b(w,"Reader"),"Cursor").$new(K["$[]"]("docfile"),this.base_dir),z(["normalize"],{normalize:!0}));return m(this.sourcemap)?this.source_location=this.reader.$cursor():g},t.$$arity=-1);a.def(f,"$parse",x=function(a){var c,d,e,f=g,h=g;null==a&&(a=g);if(m(this.parsed))return this;f=this;m(a)&&(this.reader=b(w,"PreprocessorReader").$new(f,a,l(b(w,"Reader"),"Cursor").$new(this.attributes["$[]"]("docfile"),this.base_dir),z(["normalize"],{normalize:!0})), +m(this.sourcemap)&&(this.source_location=this.reader.$cursor()));m(m(c=h=m(this.parent_document)?g:this.extensions)?h["$preprocessors?"]():c)&&n(h.$preprocessors(),"each",[],(d=function(a){var b=d.$$s||this,c;null==b.reader&&(b.reader=g);null==a&&(a=g);return b.reader=m(c=a.$process_method()["$[]"](f,b.reader))?c:b.reader},d.$$s=this,d.$$arity=1,d));b(w,"Parser").$parse(this.reader,f,z(["header_only"],{header_only:this.options["$[]"]("parse_header_only")}));this.$restore_attributes();m(m(c=h)?h["$tree_processors?"](): +c)&&n(h.$tree_processors(),"each",[],(e=function(a){var c,d,e=g;null==a&&(a=g);return m(m(c=m(d=e=a.$process_method()["$[]"](f))?b(w,"Document")["$==="](e):d)?e["$!="](f):c)?f=e:g},e.$$s=this,e.$$arity=1,e));this.parsed=!0;return f},x.$$arity=-1);a.def(f,"$counter",y=function(b,d){var f,h=g,k=g,q=g;null==d&&(d=g);if(m(this.parent_document))return this.parent_document.$counter(b,d);q=m(m(f=h=(k=this.attributes["$[]"](b))["$nil_or_empty?"]()["$!"]())?this.counters["$key?"](b):f)?[b,(q=[b,this.$nextval(k)], +n(this.counters,"[]=",a.to_a(q)),q[c(q.length,1)])]:m(d)?[b,(q=[b,d["$=="](d.$to_i().$to_s())?d.$to_i():d],n(this.counters,"[]=",a.to_a(q)),q[c(q.length,1)])]:[b,(q=[b,this.$nextval(m(h)?k:0)],n(this.counters,"[]=",a.to_a(q)),q[c(q.length,1)])];n(this.attributes,"[]=",a.to_a(q));return q[c(q.length,1)]},y.$$arity=-2);a.def(f,"$increment_and_store_counter",A=function(a,c){return b(w,"AttributeEntry").$new(a,this.$counter(a)).$save_to(c.$attributes()).$value()},A.$$arity=2);a.alias(f,"counter_increment", +"increment_and_store_counter");a.def(f,"$nextval",D=function(a){var b=g;if(m(l("::","Integer")["$==="](a)))return q(a,1);b=a.$to_i();return m(b.$to_s()["$!="](a.$to_s()))?q(a["$[]"](0).$ord(),1).$chr():q(b,1)},D.$$arity=1);a.def(f,"$register",S=function(d,f){var h,k,p=this,l=g,v=g,t=g,C=g,z=g,r=g,u=g;return function(){l=d;if("ids"["$==="](l))return k=f,h=a.to_ary(k),v=null==h[0]?g:h[0],t=null==h[1]?g:h[1],k,C=p.catalog["$[]"]("ids"),m(h=C["$[]"](v))?h:(z=[v,m(k=t)?k:q(q("[",v),"]")],n(C,"[]=",a.to_a(z)), +z[c(z.length,1)]);if("refs"["$==="](l)){k=f;h=a.to_ary(k);v=null==h[0]?g:h[0];r=null==h[1]?g:h[1];t=null==h[2]?g:h[2];k;if(m((u=p.catalog["$[]"]("refs"))["$key?"](v)))return g;z=[v,m(h=t)?h:q(q("[",v),"]")];n(p.catalog["$[]"]("ids"),"[]=",a.to_a(z));z[c(z.length,1)];z=[v,r];n(u,"[]=",a.to_a(z));return z[c(z.length,1)]}return"footnotes"["$==="](l)||"indexterms"["$==="](l)?p.catalog["$[]"](d)["$<<"](f):m(p.options["$[]"]("catalog_assets"))?p.catalog["$[]"](d)["$<<"](d["$=="]("images")?b(w,"ImageReference").$new(f["$[]"](0), +f["$[]"](1)):f):g}()},S.$$arity=2);a.def(f,"$footnotes?",Y=function(){return m(this.catalog["$[]"]("footnotes")["$empty?"]())?!1:!0},Y.$$arity=0);a.def(f,"$footnotes",U=function(){return this.catalog["$[]"]("footnotes")},U.$$arity=0);a.def(f,"$callouts",fa=function(){return this.catalog["$[]"]("callouts")},fa.$$arity=0);a.def(f,"$nested?",V=function(){return m(this.parent_document)?!0:!1},V.$$arity=0);a.def(f,"$embedded?",K=function(){return this.attributes["$key?"]("embedded")},K.$$arity=0);a.def(f, +"$extensions?",J=function(){return m(this.extensions)?!0:!1},J.$$arity=0);a.def(f,"$source",H=function(){return m(this.reader)?this.reader.$source():g},H.$$arity=0);a.def(f,"$source_lines",G=function(){return m(this.reader)?this.reader.$source_lines():g},G.$$arity=0);a.def(f,"$basebackend?",qa=function(a){return this.attributes["$[]"]("basebackend")["$=="](a)},qa.$$arity=1);a.def(f,"$title",Z=function(){return this.$doctitle()},Z.$$arity=0);a.def(f,"$title=",ya=function(d){var f=g,h=g;m(f=this.header)|| +(h=["header"],n(f=this.header=b(w,"Section").$new(this,0),"sectname=",a.to_a(h)),h[c(h.length,1)]);h=[d];n(f,"title=",a.to_a(h));return h[c(h.length,1)]},ya.$$arity=1);a.def(f,"$doctitle",aa=function(a){var c,d=g,e=g,f=g;null==a&&(a=z([],{}));if(!m(d=this.attributes["$[]"]("title")))if(m(e=this.$first_section()))d=e.$title();else if(m((m(c=a["$[]"]("use_fallback"))?d=this.attributes["$[]"]("untitled-label"):c)["$!"]()))return g;return m(f=a["$[]"]("partition"))?b(w,"Title").$new(d,a.$merge(z(["separator"], +{separator:f["$=="](!0)?this.attributes["$[]"]("title-separator"):f}))):m(m(c=a["$[]"]("sanitize"))?d["$include?"]("<"):c)?d.$gsub(b(w,"XmlSanitizeRx"),"").$squeeze(" ").$strip():d},aa.$$arity=-1);a.alias(f,"name","doctitle");a.def(f,"$author",ba=function(){return this.attributes["$[]"]("author")},ba.$$arity=0);a.def(f,"$authors",M=function(){var a,c=g,d=g,e=g,f=g;if(m((c=this.attributes)["$key?"]("author"))){d=[b(w,"Author").$new(c["$[]"]("author"),c["$[]"]("firstname"),c["$[]"]("middlename"),c["$[]"]("lastname"), +c["$[]"]("authorinitials"),c["$[]"]("email"))];f=e=m(a=c["$[]"]("authorcount"))?a:0;a="number"===typeof f?1"](1);if(m(a))for(f=1;m("number"===typeof f&&"number"===typeof e?f"["$==="](t)||">"["$==="](t)?(q=["toc-position","right"],n(k,"[]=",a.to_a(q)),q[c(q.length,1)]):"top"["$==="](t)||"^"["$==="](t)?(q=["toc-position","top"],n(k,"[]=",a.to_a(q)),q[c(q.length,1)]):"bottom"["$==="](t)||"v"["$==="](t)?(q= +["toc-position","bottom"],n(k,"[]=",a.to_a(q)),q[c(q.length,1)]):("preamble"["$==="](t)||"macro"["$==="](t)?(q=["toc-position","content"],n(k,"[]=",a.to_a(q)),q[c(q.length,1)],q=["toc-placement",l],n(k,"[]=",a.to_a(q)),q[c(q.length,1)]):k.$delete("toc-position"),C=g),m(C)&&(m(d=k["$[]"]("toc-class"))?d:(q=["toc-class",C],n(k,"[]=",a.to_a(q)),q[c(q.length,1)])));m(this.compat_mode=k["$key?"]("compat-mode"))&&m(k["$key?"]("language"))&&(q=["source-language",k["$[]"]("language")],n(k,"[]=",a.to_a(q)), +q[c(q.length,1)]);this.outfilesuffix=k["$[]"]("outfilesuffix");this.header_attributes=k.$dup();return m(this.parent_document)?g:n(b(w,"FLEXIBLE_ATTRIBUTES"),"each",[],(h=function(a){var b=h.$$s||this,c;null==b.attribute_overrides&&(b.attribute_overrides=g);null==a&&(a=g);return m(m(c=b.attribute_overrides["$key?"](a))?b.attribute_overrides["$[]"](a):c)?b.attribute_overrides.$delete(a):g},h.$$s=this,h.$$arity=1,h))},oa.$$arity=0);a.def(f,"$restore_attributes",Fa=function(){m(this.parent_document)|| +this.catalog["$[]"]("callouts").$rewind();return this.attributes.$replace(this.header_attributes)},Fa.$$arity=0);a.def(f,"$clear_playback_attributes",Q=function(a){return a.$delete("attribute_entries")},Q.$$arity=1);a.def(f,"$playback_attributes",Qa=function(b){var d;return m(b["$key?"]("attribute_entries"))?n(b["$[]"]("attribute_entries"),"each",[],(d=function(b){var f=d.$$s||this,h=g,k=g;null==f.attributes&&(f.attributes=g);null==b&&(b=g);h=b.$name();if(m(b.$negate()))return f.attributes.$delete(h), +h["$=="]("compat-mode")?f.compat_mode=!1:g;k=[h,b.$value()];n(f.attributes,"[]=",a.to_a(k));k[c(k.length,1)];return h["$=="]("compat-mode")?f.compat_mode=!0:g},d.$$s=this,d.$$arity=1,d)):g},Qa.$$arity=1);a.def(f,"$set_attribute",xa=function(b,d){var f=g,h=g,h=g;null==d&&(d="");if(m(this["$attribute_locked?"](b)))return!1;f=m(this.max_attribute_value_size)?this.$apply_attribute_value_subs(d).$limit_bytesize(this.max_attribute_value_size):this.$apply_attribute_value_subs(d);h=b;"backend"["$==="](h)? +this.$update_backend_attributes(f,this.attributes_modified["$delete?"]("htmlsyntax")):"doctype"["$==="](h)?this.$update_doctype_attributes(f):(h=[b,f],n(this.attributes,"[]=",a.to_a(h)),h[c(h.length,1)]);this.attributes_modified["$<<"](b);return f},xa.$$arity=-2);a.def(f,"$delete_attribute",La=function(a){if(m(this["$attribute_locked?"](a)))return!1;this.attributes.$delete(a);this.attributes_modified["$<<"](a);return!0},La.$$arity=1);a.def(f,"$attribute_locked?",Ma=function(a){return this.attribute_overrides["$key?"](a)}, +Ma.$$arity=1);a.def(f,"$set_header_attribute",Ca=function(b,d,f){var h,k=g,q=g;null==d&&(d="");null==f&&(f=!0);k=m(h=this.header_attributes)?h:this.attributes;if(m(f["$=="](!1)?k["$key?"](b):f["$=="](!1)))return!1;q=[b,d];n(k,"[]=",a.to_a(q));q[c(q.length,1)];return!0},Ca.$$arity=-2);a.def(f,"$apply_attribute_value_subs",Ga=function(a){var c;return m(b(w,"AttributeEntryPassMacroRx")["$=~"](a))?m((c=d["~"])===g?g:c["$[]"](1))?this.$apply_subs((c=d["~"])===g?g:c["$[]"](2),this.$resolve_pass_subs((c= +d["~"])===g?g:c["$[]"](1))):(c=d["~"])===g?g:c["$[]"](2):this.$apply_header_subs(a)},Ga.$$arity=1);a.def(f,"$update_backend_attributes",Ha=function(d,f){var h,k,q=g,p=g,v=g,t=g,C=g,z=g,r=g,u=g,F=p=g,p=g;null==f&&(f=g);return m(m(h=f)?h:m(k=d)?d["$!="](this.backend):k)?(h=[this.backend,(q=this.attributes)["$[]"]("basebackend"),this.doctype],p=h[0],v=h[1],t=h[2],h,m(d["$start_with?"]("xhtml"))?(C=["htmlsyntax","xml"],n(q,"[]=",a.to_a(C)),C[c(C.length,1)],d=d.$slice(1,d.$length())):m(d["$start_with?"]("html"))&& +!q["$[]"]("htmlsyntax")["$=="]("xml")&&(C=["htmlsyntax","html"],n(q,"[]=",a.to_a(C)),C[c(C.length,1)]),m(z=b(w,"BACKEND_ALIASES")["$[]"](d))&&(d=z),m(t)?(m(p)&&(q.$delete("backend-"+p),q.$delete("backend-"+p+"-doctype-"+t)),C=["backend-"+d+"-doctype-"+t,""],n(q,"[]=",a.to_a(C)),C[c(C.length,1)],C=["doctype-"+t,""],n(q,"[]=",a.to_a(C)),C[c(C.length,1)]):m(p)&&q.$delete("backend-"+p),C=["backend-"+d,""],n(q,"[]=",a.to_a(C)),C[c(C.length,1)],this.backend=(C=["backend",d],n(q,"[]=",a.to_a(C)),C[c(C.length, +1)]),m(l(b(w,"Converter"),"BackendInfo")["$==="](this.converter=this.$create_converter()))?(r=this.converter.$basebackend(),m(this["$attribute_locked?"]("outfilesuffix"))||(C=["outfilesuffix",this.converter.$outfilesuffix()],n(q,"[]=",a.to_a(C)),C[c(C.length,1)]),u=this.converter.$filetype()):m(this.converter)?(r=d.$sub(b(w,"TrailingDigitsRx"),""),m(p=b(w,"DEFAULT_EXTENSIONS")["$[]"](r))?u=p.$slice(1,p.$length()):(h=[".html","html","html"],p=h[0],r=h[1],u=h[2],h),m(this["$attribute_locked?"]("outfilesuffix"))|| +(C=["outfilesuffix",p],n(q,"[]=",a.to_a(C)),C[c(C.length,1)])):this.$raise(l("::","NotImplementedError"),"asciidoctor: FAILED: missing converter for backend '"+d+"'. Processing aborted."),m(F=q["$[]"]("filetype"))&&q.$delete("filetype-"+F),C=["filetype",u],n(q,"[]=",a.to_a(C)),C[c(C.length,1)],C=["filetype-"+u,""],n(q,"[]=",a.to_a(C)),C[c(C.length,1)],m(p=b(w,"DEFAULT_PAGE_WIDTHS")["$[]"](r))?(C=["pagewidth",p],n(q,"[]=",a.to_a(C)),C[c(C.length,1)]):q.$delete("pagewidth"),m(r["$!="](v))&&(m(t)?(m(v)&& +(q.$delete("basebackend-"+v),q.$delete("basebackend-"+v+"-doctype-"+t)),C=["basebackend-"+r+"-doctype-"+t,""],n(q,"[]=",a.to_a(C)),C[c(C.length,1)]):m(v)&&q.$delete("basebackend-"+v),C=["basebackend-"+r,""],n(q,"[]=",a.to_a(C)),C[c(C.length,1)],C=["basebackend",r],n(q,"[]=",a.to_a(C)),C[c(C.length,1)]),d):g},Ha.$$arity=-2);a.def(f,"$update_doctype_attributes",Ia=function(b){var d,f=g,h=g,k=g,q=g,h=g;return m(m(d=b)?b["$!="](this.doctype):d)?(d=[this.backend,(f=this.attributes)["$[]"]("basebackend"), +this.doctype],h=d[0],k=d[1],q=d[2],d,m(q)?(f.$delete("doctype-"+q),m(h)&&(f.$delete("backend-"+h+"-doctype-"+q),h=["backend-"+h+"-doctype-"+b,""],n(f,"[]=",a.to_a(h)),h[c(h.length,1)]),m(k)&&(f.$delete("basebackend-"+k+"-doctype-"+q),h=["basebackend-"+k+"-doctype-"+b,""],n(f,"[]=",a.to_a(h)),h[c(h.length,1)])):(m(h)&&(h=["backend-"+h+"-doctype-"+b,""],n(f,"[]=",a.to_a(h)),h[c(h.length,1)]),m(k)&&(h=["basebackend-"+k+"-doctype-"+b,""],n(f,"[]=",a.to_a(h)),h[c(h.length,1)])),h=["doctype-"+b,""],n(f, +"[]=",a.to_a(h)),h[c(h.length,1)],this.doctype=(h=["doctype",b],n(f,"[]=",a.to_a(h)),h[c(h.length,1)])):g},Ia.$$arity=1);a.def(f,"$create_converter",Pa=function(){var d=g,f=g,h=g,k=g,q=g,f=g,d=z([],{}),f=["htmlsyntax",this.attributes["$[]"]("htmlsyntax")];n(d,"[]=",a.to_a(f));f[c(f.length,1)];m(h=this.options["$[]"]("template_dir"))?k=[h]:m(k=this.options["$[]"]("template_dirs"))&&(k=this.$Array(k));m(k)&&(f=["template_dirs",k],n(d,"[]=",a.to_a(f)),f[c(f.length,1)],f=["template_cache",this.options.$fetch("template_cache", +!0)],n(d,"[]=",a.to_a(f)),f[c(f.length,1)],f=["template_engine",this.options["$[]"]("template_engine")],n(d,"[]=",a.to_a(f)),f[c(f.length,1)],f=["template_engine_options",this.options["$[]"]("template_engine_options")],n(d,"[]=",a.to_a(f)),f[c(f.length,1)],f=["eruby",this.options["$[]"]("eruby")],n(d,"[]=",a.to_a(f)),f[c(f.length,1)],f=["safe",this.safe],n(d,"[]=",a.to_a(f)),f[c(f.length,1)]);f=m(q=this.options["$[]"]("converter"))?l(b(w,"Converter"),"Factory").$new(l("::","Hash")["$[]"](this.$backend(), +q)):l(b(w,"Converter"),"Factory").$default(!1);return f.$create(this.$backend(),d)},Pa.$$arity=0);a.def(f,"$convert",Ra=function(d){var f,q,p=g,v=g,t=g,C=g,r=g;null==d&&(d=z([],{}));m(this.timings)&&this.timings.$start("convert");m(this.parsed)||this.$parse();m(m(f=h(this.safe,l(b(w,"SafeMode"),"SERVER")))?f:d["$empty?"]())||(m((p=["outfile",d["$[]"]("outfile")],n(this.attributes,"[]=",a.to_a(p)),p[c(p.length,1)]))||this.attributes.$delete("outfile"),m((p=["outdir",d["$[]"]("outdir")],n(this.attributes, +"[]=",a.to_a(p)),p[c(p.length,1)]))||this.attributes.$delete("outdir"));this.$doctype()["$=="]("inline")?m(v=m(f=this.blocks["$[]"](0))?f:this.header)&&(m(m(f=v.$content_model()["$=="]("compound"))?f:v.$content_model()["$=="]("empty"))?this.$logger().$warn("no inline candidate; use the inline doctype to convert a single paragragh, verbatim, or raw block"):t=v.$content()):(C=m(m(d["$key?"]("header_footer"))?d["$[]"]("header_footer"):this.options["$[]"]("header_footer"))?"document":"embedded",t=this.converter.$convert(this, +C));!m(this.parent_document)&&m(m(f=r=this.extensions)?r["$postprocessors?"]():f)&&n(r.$postprocessors(),"each",[],(q=function(a){var b=q.$$s||this;null==a&&(a=g);return t=a.$process_method()["$[]"](b,t)},q.$$s=this,q.$$arity=1,q));m(this.timings)&&this.timings.$record("convert");return t},Ra.$$arity=-1);a.alias(f,"render","convert");a.def(f,"$write",Na=function(a,c){var d;m(this.timings)&&this.timings.$start("write");m(b(w,"Writer")["$==="](this.converter))?this.converter.$write(a,c):(m(c["$respond_to?"]("write"))? +m(a["$nil_or_empty?"]())||(c.$write(a.$chomp()),c.$write(b(w,"LF"))):m(b(w,"COERCE_ENCODING"))?l("::","IO").$write(c,a,z(["encoding"],{encoding:l(l("::","Encoding"),"UTF_8")})):l("::","IO").$write(c,a),m(m(d=this.backend["$=="]("manpage")?l("::","String")["$==="](c):this.backend["$=="]("manpage"))?this.converter["$respond_to?"]("write_alternate_pages"):d)&&this.converter.$write_alternate_pages(this.attributes["$[]"]("mannames"),this.attributes["$[]"]("manvolnum"),c));m(this.timings)&&this.timings.$record("write"); +return g},Na.$$arity=2);a.def(f,"$content",Oa=function(){var b=Oa.$$p,c=g,d=g,e=g;b&&(Oa.$$p=null);d=0;e=arguments.length;for(c=Array(e);d"},Ja.$$arity=0),g)&&"to_s"})(w[0],b(w,"AbstractBlock"),w)}(v[0],v)};Opal.modules["asciidoctor/inline"]=function(a){var c=[],h=a.nil,q=a.const_get_relative,m=a.module,g=a.klass,l=a.hash2,b=a.send,n=a.truthy;a.add_stubs("$attr_reader $attr_accessor $[] $dup $convert $converter $attr $== $apply_reftext_subs $reftext".split(" "));return function(c,e){function r(){}var z=[r=m(c,"Asciidoctor",r)].concat(e);(function(c,$super,e){function q(){} +c=q=g(c,$super,"Inline",q);var p=c.prototype;[c].concat(e);var m,v,r,z,u,w,y,t;p.text=p.type=h;c.$attr_reader("text");c.$attr_reader("type");c.$attr_accessor("target");a.def(c,"$initialize",m=function(c,d,e,g){var q=h;m.$$p&&(m.$$p=null);null==e&&(e=h);null==g&&(g=l([],{}));b(this,a.find_super_dispatcher(this,"initialize",m,!1),[c,d],null);this.node_name="inline_"+d;this.text=e;this.id=g["$[]"]("id");this.type=g["$[]"]("type");this.target=g["$[]"]("target");return n(q=g["$[]"]("attributes"))?this.attributes= +q.$dup():h},m.$$arity=-3);a.def(c,"$block?",v=function(){return!1},v.$$arity=0);a.def(c,"$inline?",r=function(){return!0},r.$$arity=0);a.def(c,"$convert",z=function(){return this.$converter().$convert(this)},z.$$arity=0);a.alias(c,"render","convert");a.def(c,"$alt",u=function(){return this.$attr("alt")},u.$$arity=0);a.def(c,"$reftext?",w=function(){var a,b;return n(a=this.text)?n(b=this.type["$=="]("ref"))?b:this.type["$=="]("bibref"):a},w.$$arity=0);a.def(c,"$reftext",y=function(){var a=h;return n(a= +this.text)?this.$apply_reftext_subs(a):h},y.$$arity=0);return(a.def(c,"$xreftext",t=function(a){return this.$reftext()},t.$$arity=-1),h)&&"xreftext"})(z[0],q(z,"AbstractNode"),z)}(c[0],c)};Opal.modules["asciidoctor/list"]=function(a){var c=[],h=a.nil,q=a.const_get_relative,m=a.module,g=a.klass,l=a.hash2,b=a.send,n=a.truthy;a.add_stubs("$== $next_list $callouts $class $object_id $inspect $size $items $attr_accessor $level $drop $! $nil_or_empty? $apply_subs $empty? $=== $[] $outline? $simple? $context $option? $shift $blocks $unshift $lines $source $parent".split(" ")); +return function(c,e){function r(){}var z=[r=m(c,"Asciidoctor",r)].concat(e);(function(c,$super,e){function q(){}c=q=g(c,$super,"List",q);var p=c.prototype;[c].concat(e);var m,v,r,z;p.context=p.document=p.style=h;a.alias(c,"items","blocks");a.alias(c,"content","blocks");a.alias(c,"items?","blocks?");a.def(c,"$initialize",m=function(c,d,e){var g=m.$$p,q=h,p=h,v=h;g&&(m.$$p=null);p=0;v=arguments.length;for(q=Array(v);p"},z.$$arity=0),h)&&"to_s"})(z[0],q(z,"AbstractBlock"),z);(function(c,$super,e){function p(){}c=p=g(c,$super,"ListItem",p);var m=c.prototype,v=[c].concat(e),l,r,z,u,w,y,t,x;m.text=m.subs=m.blocks=h;a.alias(c,"list","parent");c.$attr_accessor("marker");a.def(c,"$initialize",l= +function(c,d){l.$$p&&(l.$$p=null);null==d&&(d=h);b(this,a.find_super_dispatcher(this,"initialize",l,!1),[c,"list_item"],null);this.text=d;this.level=c.$level();return this.subs=q(v,"NORMAL_SUBS").$drop(0)},l.$$arity=-2);a.def(c,"$text?",r=function(){return this.text["$nil_or_empty?"]()["$!"]()},r.$$arity=0);a.def(c,"$text",z=function(){var a;return n(a=this.text)?this.$apply_subs(this.text,this.subs):a},z.$$arity=0);a.def(c,"$text=",u=function(a){return this.text=a},u.$$arity=1);a.def(c,"$simple?", +w=function(){var a,b,c=h;return n(a=this.blocks["$empty?"]())?a:n(b=this.blocks.$size()["$=="](1)?q(v,"List")["$==="](c=this.blocks["$[]"](0)):this.blocks.$size()["$=="](1))?c["$outline?"]():b},w.$$arity=0);a.def(c,"$compound?",y=function(){return this["$simple?"]()["$!"]()},y.$$arity=0);a.def(c,"$fold_first",t=function(a,b){var c,d,e,g,p,m=h,l=h;null==a&&(a=!1);null==b&&(b=!1);n(n(c=n(d=m=this.blocks["$[]"](0))?q(v,"Block")["$==="](m):d)?n(d=m.$context()["$=="]("paragraph")?a["$!"]():m.$context()["$=="]("paragraph"))? +d:n(e=n(g=n(p=b)?p:a["$!"]())?m.$context()["$=="]("literal"):g)?m["$option?"]("listparagraph"):e:c)&&(l=this.$blocks().$shift(),n(this.text["$nil_or_empty?"]())||l.$lines().$unshift(this.text),this.text=l.$source());return h},t.$$arity=-1);return(a.def(c,"$to_s",x=function(){var a;return"#<"+this.$class()+"@"+this.$object_id()+" {list_context: "+this.$parent().$context().$inspect()+", text: "+this.text.$inspect()+", blocks: "+(n(a=this.blocks)?a:[]).$size()+"}>"},x.$$arity=0),h)&&"to_s"})(z[0],q(z, +"AbstractBlock"),z)}(c[0],c)};Opal.modules["asciidoctor/parser"]=function(a){function c(a,b){return"number"===typeof a&&"number"===typeof b?a-b:a["$-"](b)}function h(a,b){return"number"===typeof a&&"number"===typeof b?a+b:a["$+"](b)}function q(a,b){return"number"===typeof a&&"number"===typeof b?a>b:a["$>"](b)}function m(a,b){return"number"===typeof a&&"number"===typeof b?a $< $warn $next_block $blocks? $style $context= $style= $parent= $size $content_model $shift $unwrap_standalone_preamble $dup $fetch $parse_block_metadata_line $extensions $block_macros? $mark $read_line $terminator $to_s $masq $to_sym $registered_for_block? $cursor_at_mark $strict_verbatim_paragraphs $unshift_line $markdown_syntax $keys $chr $* $length $end_with? $=== $parse_attributes $attribute_missing $clear $tr $basename $assign_caption $registered_for_block_macro? $config $process_method $replace $parse_callout_list $callouts $parse_list $match $parse_description_list $underline_style_section_titles $is_section_title? $peek_line $atx_section_title? $generate_id $level= $read_paragraph_lines $adjust_indentation! $set_option $map! $slice $pop $build_block $apply_subs $chop $catalog_inline_anchors $rekey $index $strip $parse_table $concat $each $title? $lock_in_subs $sub? $catalog_callouts $source $remove_sub $block_terminates_paragraph $<= $nil? $lines $parse_blocks $parse_list_item $items $scan $gsub $count $pre_match $advance $callout_ids $next_list $catalog_inline_anchor $source_location $marker= $catalog_inline_biblio_anchor $text= $resolve_ordered_list_marker $read_lines_for_list_item $skip_line_comments $unshift_lines $fold_first $text? $is_sibling_list_item? $find $delete_at $casecmp $sectname= $special= $numbered= $numbered $lineno $update_attributes $peek_lines $setext_section_title? $abs $line_length $cursor_at_prev_line $process_attribute_entries $next_line_empty? $process_authors $apply_header_subs $rstrip $each_with_index $compact $Array $squeeze $to_a $parse_style_attribute $process_attribute_entry $skip_comment_lines $store_attribute $sanitize_attribute_name $set_attribute $save_to $delete_attribute $ord $int_to_roman $resolve_list_marker $parse_colspecs $create_columns $format $starts_with_delimiter? $close_open_cell $parse_cellspec $delimiter $match_delimiter $post_match $buffer_has_unclosed_quotes? $skip_past_delimiter $buffer $buffer= $skip_past_escaped_delimiter $keep_cell_open $push_cellspec $close_cell $cell_open? $columns $assign_column_widths $has_header_option= $partition_header_footer $upto $shorthand_property_syntax $each_char $call $sub! $gsub! $% $begin".split(" ")); +return function(l,y){function x(){}var B=[x=r(l,"Asciidoctor",x)].concat(y);(function(l,$super,r){function y(){}l=y=u(l,$super,"Parser",y);var x=[l].concat(r),t,E,B,A,D,N,Y,U,H,V,K,J,M,G,qa,la,Z,aa,ba,ma,sa,da,ea,R,Ea,Aa,Ba,wa,oa,Fa,Q,ja,xa,ta,Ma,Ca,Ga,Ha,Ia,Pa,Ra,Na,Oa,Va,C,W,Ja;l.$include(p(x,"Logging"));a.const_set(x[0],"BlockMatchData",p(x,"Struct").$new("context","masq","tip","terminator"));a.const_set(x[0],"TabRx",/\t/);a.const_set(x[0],"TabIndentRx",/^\t+/);a.const_set(x[0],"StartOfBlockProc", +z(l,"lambda",[],(t=function(a){var c=t.$$s||this,e,f;null==a&&(a=b);return d(e=d(f=a["$start_with?"]("["))?p(x,"BlockAttributeLineRx")["$match?"](a):f)?e:c["$is_delimited_block?"](a)},t.$$s=l,t.$$arity=1,t)));a.const_set(x[0],"StartOfListProc",z(l,"lambda",[],(E=function(a){null==a&&(a=b);return p(x,"AnyListRx")["$match?"](a)},E.$$s=l,E.$$arity=1,E)));a.const_set(x[0],"StartOfBlockOrListProc",z(l,"lambda",[],(B=function(a){var c=B.$$s||this,e,f,h;null==a&&(a=b);return d(e=d(f=c["$is_delimited_block?"](a))? +f:d(h=a["$start_with?"]("["))?p(x,"BlockAttributeLineRx")["$match?"](a):h)?e:p(x,"AnyListRx")["$match?"](a)},B.$$s=l,B.$$arity=1,B)));a.const_set(x[0],"NoOp",b);a.const_set(x[0],"TableCellHorzAlignments",f(["<",">","^"],{"<":"left",">":"right","^":"center"}));a.const_set(x[0],"TableCellVertAlignments",f(["<",">","^"],{"<":"top",">":"bottom","^":"middle"}));a.const_set(x[0],"TableCellStyles",f("dsemhlva".split(""),{d:"none",s:"strong",e:"emphasis",m:"monospaced",h:"header",l:"literal",v:"verse",a:"asciidoc"})); +a.def(l,"$initialize",A=function(){return this.$raise("Au contraire, mon frere. No parser instances will be running around.")},A.$$arity=0);a.defs(l,"$parse",D=function(c,e,h){var g,k=g=b;null==h&&(h=f([],{}));g=this.$parse_document_header(c,e);if(!d(h["$[]"]("header_only")))for(;d(c["$has_more_lines?"]());)h=this.$next_section(c,e,g),g=a.to_ary(h),k=null==g[0]?b:g[0],g=null==g[1]?b:g[1],h,d(k)&&(e.$assign_numeral(k),e.$blocks()["$<<"](k));return e},D.$$arity=-3);a.defs(l,"$parse_document_header", +N=function(h,g){var k,q,p=b,l=b,m=b,v=b,t=b,n=q=b,C=b,p=q=m=C=q=m=b,p=this.$parse_block_metadata_lines(h,g),l=g.$attributes();if(d(d(k=m=this["$is_next_line_doctitle?"](h,p,l["$[]"]("leveloffset")))?p["$[]"]("title"):k))return g.$finalize_header(p,!1);v=b;d((t=l["$[]"]("doctitle"))["$nil_or_empty?"]())||(q=[v=t],z(g,"title=",a.to_a(q)),q[c(q.length,1)]);d(m)&&(d(g.$sourcemap())&&(n=h.$cursor()),q=this.$parse_section_title(h,g),k=a.to_ary(q),g["$id="](null==k[0]?b:k[0]),C=null==k[2]?b:k[2],m=null== +k[4]?b:k[4],q,d(v)||(q=[v=C],z(g,"title=",a.to_a(q)),q[c(q.length,1)]),d(n)&&(q=[n],z(g.$header(),"source_location=",a.to_a(q)),q[c(q.length,1)]),d(d(k=m)?k:g["$attribute_locked?"]("compat-mode"))||(q=["compat-mode",""],z(l,"[]=",a.to_a(q)),q[c(q.length,1)]),d(q=p["$[]"]("separator"))&&!d(g["$attribute_locked?"]("title-separator"))&&(q=["title-separator",q],z(l,"[]=",a.to_a(q)),q[c(q.length,1)]),q=["doctitle",C],z(l,"[]=",a.to_a(q)),q[c(q.length,1)],d(m=p["$[]"]("id"))?(q=[m],z(g,"id=",a.to_a(q)), +q[c(q.length,1)]):m=g.$id(),d(q=p["$[]"]("role"))&&(q=["docrole",q],z(l,"[]=",a.to_a(q)),q[c(q.length,1)]),d(p=p["$[]"]("reftext"))&&(q=["reftext",p],z(l,"[]=",a.to_a(q)),q[c(q.length,1)]),p=f([],{}),this.$parse_header_metadata(h,g),d(m)&&g.$register("refs",[m,g]));d(d(k=(t=l["$[]"]("doctitle"))["$nil_or_empty?"]())?k:t["$=="](C))||(q=[v=t],z(g,"title=",a.to_a(q)),q[c(q.length,1)]);d(v)&&(q=["doctitle",v],z(l,"[]=",a.to_a(q)),q[c(q.length,1)]);g.$doctype()["$=="]("manpage")&&this.$parse_manpage_header(h, +g,p);return g.$finalize_header(p)},N.$$arity=2);a.defs(l,"$parse_manpage_header",Y=function(g,h,k){var q,l,m,v=b,t=b,n=b,C=b,r=b,u=b,F=u=b,y=b,E=b;d(p(x,"ManpageTitleVolnumRx")["$=~"]((v=h.$attributes())["$[]"]("doctitle")))?(t=["manvolnum",n=(q=w["~"])===b?b:q["$[]"](2)],z(v,"[]=",a.to_a(t)),t[c(t.length,1)],t=["mantitle",(d((C=(q=w["~"])===b?b:q["$[]"](1))["$include?"](p(x,"ATTR_REF_HEAD")))?h.$sub_attributes(C):C).$downcase()]):(this.$logger().$error(this.$message_with_context("non-conforming manpage title", +f(["source_location"],{source_location:g.$cursor_at_line(1)}))),t=["mantitle",d(q=d(l=v["$[]"]("doctitle"))?l:v["$[]"]("docname"))?q:"command"],z(v,"[]=",a.to_a(t)),t[c(t.length,1)],t=["manvolnum",n="1"]);z(v,"[]=",a.to_a(t));t[c(t.length,1)];d(d(q=r=v["$[]"]("manname"))?v["$[]"]("manpurpose"):q)?(d(q=v["$[]"]("manname-title"))?q:(t=["manname-title","Name"],z(v,"[]=",a.to_a(t)),t[c(t.length,1)]),t=["mannames",[r]],z(v,"[]=",a.to_a(t)),t[c(t.length,1)],h.$backend()["$=="]("manpage")&&(t=["docname", +r],z(v,"[]=",a.to_a(t)),t[c(t.length,1)],t=["outfilesuffix","."+n],z(v,"[]=",a.to_a(t)),t[c(t.length,1)])):(g.$skip_blank_lines(),g.$save(),k.$update(this.$parse_block_metadata_lines(g,h)),d(u=this["$is_next_line_section?"](g,f([],{})))?u["$=="](1)?(u=this.$initialize_section(g,h,f([],{})),F=z(g.$read_lines_until(f(["break_on_blank_lines","skip_line_comments"],{break_on_blank_lines:!0,skip_line_comments:!0})),"map",[],"lstrip".$to_proc()).$join(" "),d(p(x,"ManpageNamePurposeRx")["$=~"](F))?(d(q=v["$[]"]("manname-title"))? +q:(t=["manname-title",u.$title()],z(v,"[]=",a.to_a(t)),t[c(t.length,1)]),d(u.$id())&&(t=["manname-id",u.$id()],z(v,"[]=",a.to_a(t)),t[c(t.length,1)]),t=["manpurpose",(q=w["~"])===b?b:q["$[]"](2)],z(v,"[]=",a.to_a(t)),t[c(t.length,1)],d((r=(q=w["~"])===b?b:q["$[]"](1))["$include?"](p(x,"ATTR_REF_HEAD")))&&(r=h.$sub_attributes(r)),d(r["$include?"](","))?r=(y=z(r.$split(","),"map",[],(m=function(a){null==a&&(a=b);return a.$lstrip()},m.$$s=this,m.$$arity=1,m)))["$[]"](0):y=[r],t=["manname",r],z(v,"[]=", +a.to_a(t)),t[c(t.length,1)],t=["mannames",y],z(v,"[]=",a.to_a(t)),t[c(t.length,1)],h.$backend()["$=="]("manpage")&&(t=["docname",r],z(v,"[]=",a.to_a(t)),t[c(t.length,1)],t=["outfilesuffix","."+n],z(v,"[]=",a.to_a(t)),t[c(t.length,1)])):E="non-conforming name section body"):E="name section must be at level 1":E="name section expected",d(E)?(g.$restore_save(),this.$logger().$error(this.$message_with_context(E,f(["source_location"],{source_location:g.$cursor()}))),t=["manname",r=d(q=v["$[]"]("docname"))? +q:"command"],z(v,"[]=",a.to_a(t)),t[c(t.length,1)],t=["mannames",[r]],z(v,"[]=",a.to_a(t)),t[c(t.length,1)],h.$backend()["$=="]("manpage")&&(t=["docname",r],z(v,"[]=",a.to_a(t)),t[c(t.length,1)],t=["outfilesuffix","."+n],z(v,"[]=",a.to_a(t)),t[c(t.length,1)])):g.$discard_save());return b},Y.$$arity=3);a.defs(l,"$next_section",U=function(g,l,t){var n,C,r,u,w=b,F=b,y=b,E=b,B=b,J=b,K=b,A=b,D=b,ea=b,V=b,N=D=b,R=b,W=b,F=W=R=K=R=b;null==t&&(t=f([],{}));w=F=y=!1;d(d(n=(C=l.$context()["$=="]("document"))? +l.$blocks()["$empty?"]():l.$context()["$=="]("document"))?d(C=d(r=E=l["$has_header?"]())?r:t.$delete("invalid-header"))?C:this["$is_next_line_section?"](g,t)["$!"]():n)?(B=(J=l).$doctype()["$=="]("book"),d(d(n=E)?n:d(C=B)?t["$[]"](1)["$!="]("abstract"):C)&&(w=F=p(x,"Block").$new(l,"preamble",f(["content_model"],{content_model:"compound"})),d(d(n=B)?l["$attr?"]("preface-title"):n)&&(K=[l.$attr("preface-title")],z(w,"title=",a.to_a(K)),K[c(K.length,1)]),l.$blocks()["$<<"](w)),A=l,D=0,d(l.$attributes()["$key?"]("fragment"))? +ea=-1:d(B)?(n=[1,0],ea=n[0],V=n[1],n):ea=1):(B=(J=l.$document()).$doctype()["$=="]("book"),A=this.$initialize_section(g,l,t),t=d(D=t["$[]"]("title"))?f(["title"],{title:D}):f([],{}),ea=h(D=A.$level(),1),D["$=="](0)?y=B:d((n=D["$=="](1))?A.$special():D["$=="](1))&&!d(d(n=d(C=(N=A.$sectname())["$=="]("appendix"))?C:N["$=="]("preface"))?n:N["$=="]("abstract"))&&(ea=b));for(g.$skip_blank_lines();d(g["$has_more_lines?"]());){this.$parse_block_metadata_lines(g,J,t);if(d(R=this["$is_next_line_section?"](g, +t)))if(d(J["$attr?"]("leveloffset"))&&(R=h(R,J.$attr("leveloffset").$to_i())),d(q(R,D)))d(ea)?d(d(C=d(r=R["$=="](ea))?r:d(u=V)?R["$=="](V):u)?C:m(ea,0))||(W=d(V)?"expected levels "+V+" or "+ea:"expected level "+ea,this.$logger().$warn(this.$message_with_context("section title out of sequence: "+W+", got level "+R,f(["source_location"],{source_location:g.$cursor()})))):this.$logger().$error(this.$message_with_context(""+N+" sections do not support nested sections",f(["source_location"],{source_location:g.$cursor()}))), +r=this.$next_section(g,A,t),C=a.to_ary(r),R=null==C[0]?b:C[0],t=null==C[1]?b:C[1],r,A.$assign_numeral(R),A.$blocks()["$<<"](R);else if(d((C=R["$=="](0))?A["$=="](J):R["$=="](0)))d(B)||this.$logger().$error(this.$message_with_context("level 0 sections can only be used when doctype is book",f(["source_location"],{source_location:g.$cursor()}))),r=this.$next_section(g,A,t),C=a.to_ary(r),R=null==C[0]?b:C[0],t=null==C[1]?b:C[1],r,A.$assign_numeral(R),A.$blocks()["$<<"](R);else break;else K=g.$cursor(), +d(R=this.$next_block(g,d(C=F)?C:A,t,f(["parse_metadata"],{parse_metadata:!1})))&&(d(y)&&(d(A["$blocks?"]()["$!"]())?d(R.$style()["$!="]("partintro"))&&(R.$context()["$=="]("paragraph")?(K=["open"],z(R,"context=",a.to_a(K)),K[c(K.length,1)],K=["partintro"],z(R,"style=",a.to_a(K)),K[c(K.length,1)]):(K=[F=p(x,"Block").$new(A,"open",f(["content_model"],{content_model:"compound"}))],z(R,"parent=",a.to_a(K)),K[c(K.length,1)],K=["partintro"],z(F,"style=",a.to_a(K)),K[c(K.length,1)],A.$blocks()["$<<"](F))): +A.$blocks().$size()["$=="](1)&&(W=A.$blocks()["$[]"](0),d(d(C=F["$!"]())?W.$content_model()["$=="]("compound"):C)?this.$logger().$error(this.$message_with_context("illegal block content outside of partintro block",f(["source_location"],{source_location:K}))):d(W.$content_model()["$!="]("compound"))&&(K=[F=p(x,"Block").$new(A,"open",f(["content_model"],{content_model:"compound"}))],z(R,"parent=",a.to_a(K)),K[c(K.length,1)],K=["partintro"],z(F,"style=",a.to_a(K)),K[c(K.length,1)],A.$blocks().$shift(), +W.$style()["$=="]("partintro")&&(K=["paragraph"],z(W,"context=",a.to_a(K)),K[c(K.length,1)],K=[b],z(W,"style=",a.to_a(K)),K[c(K.length,1)]),F["$<<"](W),A.$blocks()["$<<"](F)))),(d(C=F)?C:A).$blocks()["$<<"](R),t=f([],{}));if(d(C=g.$skip_blank_lines()))C;else break}if(d(y))d(d(n=A["$blocks?"]())?A.$blocks()["$[]"](-1).$context()["$=="]("section"):n)||this.$logger().$error(this.$message_with_context("invalid part, must have at least one section (e.g., chapter, appendix, etc.)",f(["source_location"], +{source_location:g.$cursor()})));else if(d(w))if(d(w["$blocks?"]())){if(!d(d(n=d(C=B)?C:J.$blocks()["$[]"](1))?n:p(x,"Compliance").$unwrap_standalone_preamble()["$!"]()))for(J.$blocks().$shift();d(F=w.$blocks().$shift());)J["$<<"](F)}else J.$blocks().$shift();return[d(A["$!="](l))?A:b,t.$dup()]},U.$$arity=-3);a.defs(l,"$next_block",H=function(h,k,l,t){try{var n,C,r,u,F,y,E,B=b,K=b,J=b,A=b,D=b,ea=b,R=b,V=b,N=b,W=b,X=b,Ja=b,S=b,aa=b,G=b,da=b,U=b,ba=b,Y=b,H=b,na=b,fa=b,ha=b,ca=b,Ea=b,qa=b,P=b,M=b,za= +b,Ka=b,ma=b,la=b,Aa=b,Ia=b,Z=b,Oa=b,Fa=b,Da=b,sa=b,Na=b,oa=b,Ba=b,pa=b,wa=b,Pa=b,xa=b,Q=b;null==w["~"]&&(w["~"]=b);null==l&&(l=f([],{}));null==t&&(t=f([],{}));if(!d(B=h.$skip_blank_lines()))return b;d(d(n=K=t["$[]"]("text"))?q(B,0):n)&&(t.$delete("text"),K=!1);J=k.$document();if(d(t.$fetch("parse_metadata",!0)))for(;d(this.$parse_block_metadata_line(h,J,l,t));)h.$shift(),d(C=h.$skip_blank_lines())?C:a.ret(b);d(A=J.$extensions())&&(n=[A["$blocks?"](),A["$block_macros?"]()],D=n[0],ea=n[1],n);h.$mark(); +n=[h.$read_line(),J.$attributes(),l["$[]"](1)];R=n[0];V=n[1];N=n[2];n;W=X=Ja=S=b;d(aa=this["$is_delimited_block?"](R,!0))&&(X=Ja=aa.$context(),S=aa.$terminator(),d(N["$!"]())?N=(G=["style",X.$to_s()],z(l,"[]=",a.to_a(G)),G[c(G.length,1)]):d(N["$!="](X.$to_s()))&&(d(aa.$masq()["$include?"](N))?X=N.$to_sym():d(d(n=aa.$masq()["$include?"]("admonition"))?p(x,"ADMONITION_STYLES")["$include?"](N):n)?X="admonition":d(d(n=D)?A["$registered_for_block?"](N,X):n)?X=N.$to_sym():(this.$logger().$warn(this.$message_with_context("invalid style for "+ +X+" block: "+N,f(["source_location"],{source_location:h.$cursor_at_mark()}))),N=X.$to_s())));if(!d(aa))for(;d(!0);){if(d(d(C=d(r=N)?p(x,"Compliance").$strict_verbatim_paragraphs():r)?p(x,"VERBATIM_STYLES")["$include?"](N):C)){X=N.$to_sym();h.$unshift_line(R);break}if(d(K))da=R["$start_with?"](" ",p(x,"TAB"));else if(U=p(x,"Compliance").$markdown_syntax(),d(R["$start_with?"](" "))){if(C=[!0," "],da=C[0],ba=C[1],C,d(d(C=d(r=U)?z(R.$lstrip(),"start_with?",a.to_a(p(x,"MARKDOWN_THEMATIC_BREAK_CHARS").$keys())): +r)?p(x,"MarkdownThematicBreakRx")["$match?"](R):C)){W=p(x,"Block").$new(k,"thematic_break",f(["content_model"],{content_model:"empty"}));break}}else if(d(R["$start_with?"](p(x,"TAB"))))C=[!0,p(x,"TAB")],da=C[0],ba=C[1],C;else if(C=[!1,R.$chr()],da=C[0],ba=C[1],C,Y=d(U)?p(x,"HYBRID_LAYOUT_BREAK_CHARS"):p(x,"LAYOUT_BREAK_CHARS"),d(d(C=Y["$key?"](ba))?d(U)?p(x,"ExtLayoutBreakRx")["$match?"](R):(r=R["$=="](g(ba,H=R.$length())))?q(H,2):R["$=="](g(ba,H=R.$length())):C)){W=p(x,"Block").$new(k,Y["$[]"](ba), +f(["content_model"],{content_model:"empty"}));break}else if(d(d(C=R["$end_with?"]("]"))?R["$include?"]("::"):C))if(d(d(C=d(r=ba["$=="]("i"))?r:R["$start_with?"]("video:","audio:"))?p(x,"BlockMediaMacroRx")["$=~"](R):C)){C=[((r=w["~"])===b?b:r["$[]"](1)).$to_sym(),(r=w["~"])===b?b:r["$[]"](2),(r=w["~"])===b?b:r["$[]"](3)];na=C[0];fa=C[1];ha=C[2];C;W=p(x,"Block").$new(k,na,f(["content_model"],{content_model:"empty"}));d(ha)&&(ca=na,Ea="video"["$==="](ca)?["poster","width","height"]:"audio"["$==="](ca)? +[]:["alt","width","height"],W.$parse_attributes(ha,Ea,f(["sub_input","into"],{sub_input:!0,into:l})));d(l["$key?"]("style"))&&l.$delete("style");if(d(d(C=fa["$include?"](p(x,"ATTR_REF_HEAD")))?(fa=W.$sub_attributes(fa,f(["attribute_missing"],{attribute_missing:"drop-line"})))["$empty?"]():C)){if((d(C=V["$[]"]("attribute-missing"))?C:p(x,"Compliance").$attribute_missing())["$=="]("skip"))return p(x,"Block").$new(k,"paragraph",f(["content_model","source"],{content_model:"simple",source:[R]}));l.$clear(); +return b}na["$=="]("image")&&(J.$register("images",[fa,(G=["imagesdir",V["$[]"]("imagesdir")],z(l,"[]=",a.to_a(G)),G[c(G.length,1)])]),d(C=l["$[]"]("alt"))?C:(G=["alt",d(r=N)?r:(G=["default-alt",p(x,"Helpers").$basename(fa,!0).$tr("_-"," ")],z(l,"[]=",a.to_a(G)),G[c(G.length,1)])],z(l,"[]=",a.to_a(G)),G[c(G.length,1)]),d((qa=l.$delete("scaledwidth"))["$nil_or_empty?"]())||(G=["scaledwidth",d(p(x,"TrailingDigitsRx")["$match?"](qa))?""+qa+"%":qa],z(l,"[]=",a.to_a(G)),G[c(G.length,1)]),d(l["$key?"]("title"))&& +(G=[l.$delete("title")],z(W,"title=",a.to_a(G)),G[c(G.length,1)],W.$assign_caption(l.$delete("caption"),"figure")));G=["target",fa];z(l,"[]=",a.to_a(G));G[c(G.length,1)];break}else if(d(d(C=(r=ba["$=="]("t"))?R["$start_with?"]("toc:"):ba["$=="]("t"))?p(x,"BlockTocMacroRx")["$=~"](R):C)){W=p(x,"Block").$new(k,"toc",f(["content_model"],{content_model:"empty"}));d((C=w["~"])===b?b:C["$[]"](1))&&W.$parse_attributes((C=w["~"])===b?b:C["$[]"](1),[],f(["into"],{into:l}));break}else if(d(d(C=d(r=ea)?p(x, +"CustomBlockMacroRx")["$=~"](R):r)?P=A["$registered_for_block_macro?"]((r=w["~"])===b?b:r["$[]"](1)):C)){C=[(r=w["~"])===b?b:r["$[]"](2),(r=w["~"])===b?b:r["$[]"](3)];fa=C[0];M=C[1];C;if(d(d(C=d(r=fa["$include?"](p(x,"ATTR_REF_HEAD")))?(fa=k.$sub_attributes(fa))["$empty?"]():r)?(d(r=V["$[]"]("attribute-missing"))?r:p(x,"Compliance").$attribute_missing())["$=="]("drop-line"):C))return l.$clear(),b;P.$config()["$[]"]("content_model")["$=="]("attributes")?d(M)&&J.$parse_attributes(M,d(C=P.$config()["$[]"]("pos_attrs"))? +C:[],f(["sub_input","into"],{sub_input:!0,into:l})):(G=["text",d(C=M)?C:""],z(l,"[]=",a.to_a(G)),G[c(G.length,1)]);d(za=P.$config()["$[]"]("default_attrs"))&&z(l,"update",[za],(u=function(a,c){null==c&&(c=b);return c},u.$$s=this,u.$$arity=2,u));if(d(W=P.$process_method()["$[]"](k,fa,l))){l.$replace(W.$attributes());break}else return l.$clear(),b}if(d(d(C=d(r=da["$!"]())?(ba=d(F=ba)?F:R.$chr())["$=="]("<"):r)?p(x,"CalloutListRx")["$=~"](R):C)){h.$unshift_line(R);W=this.$parse_callout_list(h,w["~"], +k,J.$callouts());G=["style","arabic"];z(l,"[]=",a.to_a(G));G[c(G.length,1)];break}else if(d(p(x,"UnorderedListRx")["$match?"](R))){h.$unshift_line(R);d(d(C=d(r=N["$!"]())?p(x,"Section")["$==="](k):r)?k.$sectname()["$=="]("bibliography"):C)&&(G=["style",N="bibliography"],z(l,"[]=",a.to_a(G)),G[c(G.length,1)]);W=this.$parse_list(h,"ulist",k,N);break}else if(d(Ka=p(x,"OrderedListRx").$match(R))){h.$unshift_line(R);W=this.$parse_list(h,"olist",k,N);d(W.$style())&&(G=["style",W.$style()],z(l,"[]=",a.to_a(G)), +G[c(G.length,1)]);break}else if(d(Ka=p(x,"DescriptionListRx").$match(R))){h.$unshift_line(R);W=this.$parse_description_list(h,Ka,k);break}else if(d(d(C=d(r=N["$=="]("float"))?r:N["$=="]("discrete"))?d(p(x,"Compliance").$underline_style_section_titles())?this["$is_section_title?"](R,h.$peek_line()):d(r=da["$!"]())?this["$atx_section_title?"](R):r:C)){h.$unshift_line(R);r=this.$parse_section_title(h,J,l["$[]"]("id"));C=a.to_ary(r);ma=null==C[0]?b:C[0];la=null==C[1]?b:C[1];Aa=null==C[2]?b:C[2];Ia=null== +C[3]?b:C[3];r;d(la)&&(G=["reftext",la],z(l,"[]=",a.to_a(G)),G[c(G.length,1)]);W=p(x,"Block").$new(k,"floating_title",f(["content_model"],{content_model:"empty"}));G=[Aa];z(W,"title=",a.to_a(G));G[c(G.length,1)];l.$delete("title");G=[d(C=ma)?C:d(V["$key?"]("sectids"))?p(x,"Section").$generate_id(W.$title(),J):b];z(W,"id=",a.to_a(G));G[c(G.length,1)];G=[Ia];z(W,"level=",a.to_a(G));G[c(G.length,1)];break}else if(d(d(C=N)?N["$!="]("normal"):C))if(d(p(x,"PARAGRAPH_STYLES")["$include?"](N))){X=N.$to_sym(); +Ja="paragraph";h.$unshift_line(R);break}else if(d(p(x,"ADMONITION_STYLES")["$include?"](N))){X="admonition";Ja="paragraph";h.$unshift_line(R);break}else if(d(d(C=D)?A["$registered_for_block?"](N,"paragraph"):C)){X=N.$to_sym();Ja="paragraph";h.$unshift_line(R);break}else this.$logger().$warn(this.$message_with_context("invalid style for paragraph: "+N,f(["source_location"],{source_location:h.$cursor_at_mark()}))),N=b;h.$unshift_line(R);if(d(d(C=da)?N["$!"]():C))Z=this.$read_paragraph_lines(h,d(C=Oa= +p(x,"ListItem")["$==="](k))?B["$=="](0):C,f(["skip_line_comments"],{skip_line_comments:K})),this["$adjust_indentation!"](Z),W=p(x,"Block").$new(k,"literal",f(["content_model","source","attributes"],{content_model:"verbatim",source:Z,attributes:l})),d(Oa)&&W.$set_option("listparagraph");else{Z=this.$read_paragraph_lines(h,(C=B["$=="](0))?p(x,"ListItem")["$==="](k):B["$=="](0),f(["skip_line_comments"],{skip_line_comments:!0}));if(d(K)){if(d(d(C=da)?N["$=="]("normal"):C))this["$adjust_indentation!"](Z); +W=p(x,"Block").$new(k,"paragraph",f(["content_model","source","attributes"],{content_model:"simple",source:Z,attributes:l}))}else if(d(d(C=d(r=p(x,"ADMONITION_STYLE_HEADS")["$include?"](ba))?R["$include?"](":"):r)?p(x,"AdmonitionParagraphRx")["$=~"](R):C))G=[0,(C=w["~"])===b?b:C.$post_match()],z(Z,"[]=",a.to_a(G)),G[c(G.length,1)],G=["name",Fa=(G=["style",(C=w["~"])===b?b:C["$[]"](1)],z(l,"[]=",a.to_a(G)),G[c(G.length,1)]).$downcase()],z(l,"[]=",a.to_a(G)),G[c(G.length,1)],G=["textlabel",d(C=l.$delete("caption"))? +C:V["$[]"](""+Fa+"-caption")],z(l,"[]=",a.to_a(G)),G[c(G.length,1)],W=p(x,"Block").$new(k,"admonition",f(["content_model","source","attributes"],{content_model:"simple",source:Z,attributes:l}));else if(d(d(C=d(r=U)?ba["$=="](">"):r)?R["$start_with?"]("> "):C)){z(Z,"map!",[],(y=function(a){null==a&&(a=b);return a["$=="](">")?a.$slice(1,a.$length()):d(a["$start_with?"]("> "))?a.$slice(2,a.$length()):a},y.$$s=this,y.$$arity=1,y));if(d(Z["$[]"](-1)["$start_with?"]("-- ")))for(Da=(Da=Z.$pop()).$slice(3, +Da.$length());d(Z["$[]"](-1)["$empty?"]());)Z.$pop();G=["style","quote"];z(l,"[]=",a.to_a(G));G[c(G.length,1)];W=this.$build_block("quote","compound",!1,k,p(x,"Reader").$new(Z),l);d(Da)&&(r=W.$apply_subs(Da).$split(", ",2),C=a.to_ary(r),sa=null==C[0]?b:C[0],Na=null==C[1]?b:C[1],r,d(sa)&&(G=["attribution",sa],z(l,"[]=",a.to_a(G)),G[c(G.length,1)]),d(Na)&&(G=["citetitle",Na],z(l,"[]=",a.to_a(G)),G[c(G.length,1)]))}else if(d(d(C=d(r=(F=ba["$=="]('"'))?q(Z.$size(),1):ba["$=="]('"'))?Z["$[]"](-1)["$start_with?"]("-- "): +r)?Z["$[]"](-2)["$end_with?"]('"'):C)){G=[0,R.$slice(1,R.$length())];z(Z,"[]=",a.to_a(G));G[c(G.length,1)];for(Da=(Da=Z.$pop()).$slice(3,Da.$length());d(Z["$[]"](-1)["$empty?"]());)Z.$pop();Z["$<<"](Z.$pop().$chop());G=["style","quote"];z(l,"[]=",a.to_a(G));G[c(G.length,1)];W=p(x,"Block").$new(k,"quote",f(["content_model","source","attributes"],{content_model:"simple",source:Z,attributes:l}));r=W.$apply_subs(Da).$split(", ",2);C=a.to_ary(r);sa=null==C[0]?b:C[0];Na=null==C[1]?b:C[1];r;d(sa)&&(G=["attribution", +sa],z(l,"[]=",a.to_a(G)),G[c(G.length,1)]);d(Na)&&(G=["citetitle",Na],z(l,"[]=",a.to_a(G)),G[c(G.length,1)])}else{if(d(d(C=da)?N["$=="]("normal"):C))this["$adjust_indentation!"](Z);W=p(x,"Block").$new(k,"paragraph",f(["content_model","source","attributes"],{content_model:"simple",source:Z,attributes:l}))}this.$catalog_inline_anchors(Z.$join(p(x,"LF")),W,J,h)}break}if(!d(W))if(d(d(n=X["$=="]("abstract"))?n:X["$=="]("partintro"))&&(X="open"),ca=X,"admonition"["$==="](ca))G=["name",Fa=N.$downcase()], +z(l,"[]=",a.to_a(G)),G[c(G.length,1)],G=["textlabel",d(n=l.$delete("caption"))?n:V["$[]"](""+Fa+"-caption")],z(l,"[]=",a.to_a(G)),G[c(G.length,1)],W=this.$build_block(X,"compound",S,k,h,l);else{if("comment"["$==="](ca))return this.$build_block(X,"skip",S,k,h,l),l.$clear(),b;if("example"["$==="](ca))W=this.$build_block(X,"compound",S,k,h,l);else if("listing"["$==="](ca)||"literal"["$==="](ca))W=this.$build_block(X,"verbatim",S,k,h,l);else if("source"["$==="](ca))p(x,"AttributeList").$rekey(l,[b,"language", +"linenums"]),!d(l["$key?"]("language"))&&d(V["$key?"]("source-language"))&&(G=["language",d(n=V["$[]"]("source-language"))?n:"text"],z(l,"[]=",a.to_a(G)),G[c(G.length,1)]),!d(l["$key?"]("linenums"))&&d(d(n=l["$key?"]("linenums-option"))?n:V["$key?"]("source-linenums-option"))&&(G=["linenums",""],z(l,"[]=",a.to_a(G)),G[c(G.length,1)]),!d(l["$key?"]("indent"))&&d(V["$key?"]("source-indent"))&&(G=["indent",V["$[]"]("source-indent")],z(l,"[]=",a.to_a(G)),G[c(G.length,1)]),W=this.$build_block("listing", +"verbatim",S,k,h,l);else if("fenced_code"["$==="](ca))G=["style","source"],z(l,"[]=",a.to_a(G)),G[c(G.length,1)],(H=R.$length())["$=="](3)?oa=b:d(Ba=(oa=R.$slice(3,H)).$index(","))?d(q(Ba,0))?(oa=oa.$slice(0,Ba).$strip(),d(m(Ba,c(H,4)))&&(G=["linenums",""],z(l,"[]=",a.to_a(G)),G[c(G.length,1)])):(oa=b,d(q(H,4))&&(G=["linenums",""],z(l,"[]=",a.to_a(G)),G[c(G.length,1)])):oa=oa.$lstrip(),d(oa["$nil_or_empty?"]())?d(V["$key?"]("source-language"))&&(G=["language",d(n=V["$[]"]("source-language"))?n:"text"], +z(l,"[]=",a.to_a(G)),G[c(G.length,1)]):(G=["language",oa],z(l,"[]=",a.to_a(G)),G[c(G.length,1)]),!d(l["$key?"]("linenums"))&&d(d(n=l["$key?"]("linenums-option"))?n:V["$key?"]("source-linenums-option"))&&(G=["linenums",""],z(l,"[]=",a.to_a(G)),G[c(G.length,1)]),!d(l["$key?"]("indent"))&&d(V["$key?"]("source-indent"))&&(G=["indent",V["$[]"]("source-indent")],z(l,"[]=",a.to_a(G)),G[c(G.length,1)]),S=S.$slice(0,3),W=this.$build_block("listing","verbatim",S,k,h,l);else if("pass"["$==="](ca))W=this.$build_block(X, +"raw",S,k,h,l);else if("stem"["$==="](ca)||"latexmath"["$==="](ca)||"asciimath"["$==="](ca))X["$=="]("stem")&&(G=["style",p(x,"STEM_TYPE_ALIASES")["$[]"](d(n=l["$[]"](2))?n:V["$[]"]("stem"))],z(l,"[]=",a.to_a(G)),G[c(G.length,1)]),W=this.$build_block("stem","raw",S,k,h,l);else if("open"["$==="](ca)||"sidebar"["$==="](ca))W=this.$build_block(X,"compound",S,k,h,l);else if("table"["$==="](ca))pa=h.$cursor(),wa=p(x,"Reader").$new(h.$read_lines_until(f(["terminator","skip_line_comments","context","cursor"], +{terminator:S,skip_line_comments:!0,context:"table",cursor:"at_mark"})),pa),d(S["$start_with?"]("|","!"))||(d(n=l["$[]"]("format"))?n:(G=["format",d(S["$start_with?"](","))?"csv":"dsv"],z(l,"[]=",a.to_a(G)),G[c(G.length,1)])),W=this.$parse_table(wa,k,l);else if("quote"["$==="](ca)||"verse"["$==="](ca))p(x,"AttributeList").$rekey(l,[b,"attribution","citetitle"]),W=this.$build_block(X,X["$=="]("verse")?"verbatim":"compound",S,k,h,l);else if(d(d(n=D)?P=A["$registered_for_block?"](X,Ja):n)){if(d((Pa= +P.$config()["$[]"]("content_model"))["$!="]("skip"))&&(d((xa=d(n=P.$config()["$[]"]("pos_attrs"))?n:[])["$empty?"]()["$!"]())&&p(x,"AttributeList").$rekey(l,[b].$concat(xa)),d(za=P.$config()["$[]"]("default_attrs"))&&z(za,"each",[],(E=function(f,h){var g;null==f&&(f=b);null==h&&(h=b);return d(g=l["$[]"](f))?g:(G=[f,h],z(l,"[]=",a.to_a(G)),G[c(G.length,1)])},E.$$s=this,E.$$arity=2,E)),G=["cloaked-context",Ja],z(l,"[]=",a.to_a(G)),G[c(G.length,1)]),W=this.$build_block(X,Pa,S,k,h,l,f(["extension"],{extension:P})), +!d(W))return l.$clear(),b}else this.$raise("Unsupported block type "+X+" at "+h.$cursor())}d(J.$sourcemap())&&(G=[h.$cursor_at_mark()],z(W,"source_location=",a.to_a(G)),G[c(G.length,1)]);d(l["$key?"]("title"))&&(G=[l.$delete("title")],z(W,"title=",a.to_a(G)),G[c(G.length,1)]);G=[l["$[]"]("style")];z(W,"style=",a.to_a(G));G[c(G.length,1)];d(Q=d(n=W.$id())?n:(G=[l["$[]"]("id")],z(W,"id=",a.to_a(G)),G[c(G.length,1)]))&&!d(J.$register("refs",[Q,W,d(n=l["$[]"]("reftext"))?n:d(W["$title?"]())?W.$title(): +b]))&&this.$logger().$warn(this.$message_with_context("id assigned to block already in use: "+Q,f(["source_location"],{source_location:h.$cursor_at_mark()})));d(l["$empty?"]())||W.$attributes().$update(l);W.$lock_in_subs();d(W["$sub?"]("callouts"))&&!d(this.$catalog_callouts(W.$source(),J))&&W.$remove_sub("callouts");return W}catch(ja){if(ja===a.returner)return ja.$v;throw ja;}},H.$$arity=-3);a.defs(l,"$read_paragraph_lines",V=function(h,g,k){var q=b,q=b;null==k&&(k=f([],{}));q=["break_on_blank_lines", +!0];z(k,"[]=",a.to_a(q));q[c(q.length,1)];q=["break_on_list_continuation",!0];z(k,"[]=",a.to_a(q));q[c(q.length,1)];q=["preserve_last_line",!0];z(k,"[]=",a.to_a(q));q[c(q.length,1)];q=d(g)?d(p(x,"Compliance").$block_terminates_paragraph())?p(x,"StartOfBlockOrListProc"):p(x,"StartOfListProc"):d(p(x,"Compliance").$block_terminates_paragraph())?p(x,"StartOfBlockProc"):p(x,"NoOp");return z(h,"read_lines_until",[k],q.$to_proc())},V.$$arity=-3);a.defs(l,"$is_delimited_block?",K=function(f,h){var k,l,t= +l=b,C=b,n=b,r=b,n=C=b;null==h&&(h=!1);if(!d(d(k=q(l=f.$length(),1))?p(x,"DELIMITED_BLOCK_HEADS")["$include?"](f.$slice(0,2)):k))return b;if(l["$=="](2))t=f,C=2;else{d("number"===typeof l?4>=l:l["$<="](4))?(t=f,C=l):(t=f.$slice(0,4),C=4);n=!1;if(d(p(x,"Compliance").$markdown_syntax())&&(r=C["$=="](4)?t.$chop():t,r["$=="]("```"))){if(d(C["$=="](4)?t["$end_with?"]("`"):C["$=="](4)))return b;t=r;C=3;n=!0}if(d((k=C["$=="](3))?n["$!"]():C["$=="](3)))return b}if(d(p(x,"DELIMITED_BLOCKS")["$key?"](t))){if(d(d(k= +m(C,4))?k:C["$=="](l)))return d(h)?(l=p(x,"DELIMITED_BLOCKS")["$[]"](t),k=a.to_ary(l),C=null==k[0]?b:k[0],n=null==k[1]?b:k[1],l,p(x,"BlockMatchData").$new(C,n,t,t)):!0;if((""+t+g(t.$slice(-1,1),c(l,C)))["$=="](f))return d(h)?(l=p(x,"DELIMITED_BLOCKS")["$[]"](t),k=a.to_ary(l),C=null==k[0]?b:k[0],n=null==k[1]?b:k[1],l,p(x,"BlockMatchData").$new(C,n,t,f)):!0}return b},K.$$arity=-2);a.defs(l,"$build_block",J=function(h,g,k,l,t,C,m){var n,v,r=b,u=b,w=r=u=b;n=w=w=w=w=b;null==m&&(m=f([],{}));n=g["$=="]("skip")? +[!0,"simple"]:g["$=="]("raw")?[!1,"simple"]:[!1,g];r=n[0];u=n[1];n;d(k["$nil?"]())?(u["$=="]("verbatim")?u=t.$read_lines_until(f(["break_on_blank_lines","break_on_list_continuation"],{break_on_blank_lines:!0,break_on_list_continuation:!0})):(g["$=="]("compound")&&(g="simple"),u=this.$read_paragraph_lines(t,!1,f(["skip_line_comments","skip_processing"],{skip_line_comments:!0,skip_processing:r}))),r=b):d(u["$!="]("compound"))?(u=t.$read_lines_until(f(["terminator","skip_processing","context","cursor"], +{terminator:k,skip_processing:r,context:h,cursor:"at_mark"})),r=b):k["$=="](!1)?(u=b,r=t):(u=b,w=t.$cursor(),r=p(x,"Reader").$new(t.$read_lines_until(f(["terminator","skip_processing","context","cursor"],{terminator:k,skip_processing:r,context:h,cursor:"at_mark"})),w));if(g["$=="]("verbatim"))if(d(w=C["$[]"]("indent")))this["$adjust_indentation!"](u,w,d(n=C["$[]"]("tabsize"))?n:l.$document().$attributes()["$[]"]("tabsize"));else{if(d(q(w=(d(n=C["$[]"]("tabsize"))?n:l.$document().$attributes()["$[]"]("tabsize")).$to_i(), +0)))this["$adjust_indentation!"](u,b,w)}else if(g["$=="]("skip"))return b;if(d(w=m["$[]"]("extension")))if(C.$delete("style"),d(w=w.$process_method()["$[]"](l,d(n=r)?n:p(x,"Reader").$new(u),C.$dup())))C.$replace(w.$attributes()),d((n=w.$content_model()["$=="]("compound"))?(u=w.$lines())["$nil_or_empty?"]()["$!"]():w.$content_model()["$=="]("compound"))&&(g="compound",r=p(x,"Reader").$new(u));else return b;else w=p(x,"Block").$new(l,h,f(["content_model","source","attributes"],{content_model:g,source:u, +attributes:C}));d(d(n=d(v=C["$key?"]("title"))?w.$context()["$!="]("admonition"):v)?l.$document().$attributes()["$key?"](""+w.$context()+"-caption"):n)&&(n=[C.$delete("title")],z(w,"title=",a.to_a(n)),n[c(n.length,1)],w.$assign_caption(C.$delete("caption")));g["$=="]("compound")&&this.$parse_blocks(r,w);return w},J.$$arity=-7);a.defs(l,"$parse_blocks",M=function(a,c){for(var e,f,h=b;d(d(e=d(f=h=this.$next_block(a,c))?c.$blocks()["$<<"](h):f)?e:a["$has_more_lines?"]()););},M.$$arity=2);a.defs(l,"$parse_list", +G=function(a,c,e,f){var h,g,k=b,q=b,l=b;null==w["~"]&&(w["~"]=b);for(k=p(x,"List").$new(e,c);d(d(h=a["$has_more_lines?"]())?(q=d(g=q)?g:p(x,"ListRxMap")["$[]"](c))["$=~"](a.$peek_line()):h);){if(d(l=this.$parse_list_item(a,k,w["~"],(h=w["~"])===b?b:h["$[]"](1),f)))k.$items()["$<<"](l);if(d(h=a.$skip_blank_lines()))h;else break}return k},G.$$arity=4);a.defs(l,"$catalog_callouts",qa=function(a,c){var e,f=b,g=b,f=!1,g=0;d(a["$include?"]("<"))&&z(a,"scan",[p(x,"CalloutScanRx")],(e=function(){var a,e, +q=b,p=b;a=[(e=w["~"])===b?b:e["$[]"](0),(e=w["~"])===b?b:e["$[]"](2)];q=a[0];p=a[1];a;d(q["$start_with?"]("\\"))||c.$callouts().$register(p["$=="](".")?(g=h(g,1)).$to_s():p);return f=!0},e.$$s=this,e.$$arity=0,e));return f},qa.$$arity=2);a.defs(l,"$catalog_inline_anchor",la=function(a,c,e,h,g){var k;null==g&&(g=b);g=d(k=g)?k:e.$document();d(d(k=c)?c["$include?"](p(x,"ATTR_REF_HEAD")):k)&&(c=g.$sub_attributes(c));d(g.$register("refs",[a,p(x,"Inline").$new(e,"anchor",c,f(["type","id"],{type:"ref",id:a})), +c]))||(d(p(x,"Reader")["$==="](h))&&(h=h.$cursor()),this.$logger().$warn(this.$message_with_context("id assigned to anchor already in use: "+a,f(["source_location"],{source_location:h}))));return b},la.$$arity=-5);a.defs(l,"$catalog_inline_anchors",Z=function(a,c,e,g){var l,t;d(d(l=a["$include?"]("[["))?l:a["$include?"]("or:"))&&z(a,"scan",[p(x,"InlineAnchorScanRx")],(t=function(){var a=t.$$s||this,l,C=b,n=b,m=b,v=b,r=b;null==w["~"]&&(w["~"]=b);C=w["~"];if(d(n=(l=w["~"])===b?b:l["$[]"](1))){if(d(m= +(l=w["~"])===b?b:l["$[]"](2))&&d(d(l=m["$include?"](p(x,"ATTR_REF_HEAD")))?(m=e.$sub_attributes(m))["$empty?"]():l))return b}else if(n=(l=w["~"])===b?b:l["$[]"](3),d(m=(l=w["~"])===b?b:l["$[]"](4))&&(d(m["$include?"]("]"))&&(m=m.$gsub("\\]","]")),d(d(l=m["$include?"](p(x,"ATTR_REF_HEAD")))?(m=e.$sub_attributes(m))["$empty?"]():l)))return b;if(d(e.$register("refs",[n,p(x,"Inline").$new(c,"anchor",m,f(["type","id"],{type:"ref",id:n})),m])))return b;v=g.$cursor_at_mark();d(q(r=h(C.$pre_match().$count(p(x, +"LF")),d(C["$[]"](0)["$start_with?"](p(x,"LF")))?1:0),0))&&(v=v.$dup()).$advance(r);return a.$logger().$warn(a.$message_with_context("id assigned to anchor already in use: "+n,f(["source_location"],{source_location:v})))},t.$$s=this,t.$$arity=0,t));return b},Z.$$arity=4);a.defs(l,"$catalog_inline_biblio_anchor",aa=function(a,c,e,h){var g=b;d(e.$document().$register("refs",[a,p(x,"Inline").$new(e,"anchor",g="["+(d(c)?c:a)+"]",f(["type","id"],{type:"bibref",id:a})),g]))||this.$logger().$warn(this.$message_with_context("id assigned to bibliography anchor already in use: "+ +a,f(["source_location"],{source_location:h.$cursor()})));return b},aa.$$arity=4);a.defs(l,"$parse_description_list",ba=function(f,h,g){for(var k,q,l=b,t=b,C=b,m=b,n=b,m=b,l=p(x,"List").$new(g,"dlist"),t=b,C=p(x,"DescriptionListSiblingRx")["$[]"](h["$[]"](2));d(d(k=h)?k:d(q=f["$has_more_lines?"]())?h=C.$match(f.$peek_line()):q);){q=this.$parse_list_item(f,l,h,C);k=a.to_ary(q);m=null==k[0]?b:k[0];n=null==k[1]?b:k[1];q;if(d(d(k=t)?t["$[]"](1)["$!"]():k))t["$[]"](0)["$<<"](m),m=[1,n],z(t,"[]=",a.to_a(m)), +m[c(m.length,1)];else l.$items()["$<<"](t=[[m],n]);h=b}return l},ba.$$arity=3);a.defs(l,"$parse_callout_list",ma=function(g,q,l,t){for(var C,m,n=b,v=b,r=b,u=b,w=u=b,w=b,n=p(x,"List").$new(l,"colist"),v=1,r=0;d(d(C=q)?C:d(m=q=p(x,"CalloutListRx").$match(g.$peek_line()))?g.$mark():m);)(u=q["$[]"](1))["$=="](".")&&(u=(r=h(r,1)).$to_s()),u["$=="](v.$to_s())||this.$logger().$warn(this.$message_with_context("callout list item index: expected "+v+", got "+u,f(["source_location"],{source_location:g.$cursor_at_mark()}))), +d(u=this.$parse_list_item(g,n,q,"<1>"))&&(n.$items()["$<<"](u),d((w=t.$callout_ids(n.$items().$size()))["$empty?"]())?this.$logger().$warn(this.$message_with_context("no callout found for <"+n.$items().$size()+">",f(["source_location"],{source_location:g.$cursor_at_mark()}))):(w=["coids",w],z(u.$attributes(),"[]=",a.to_a(w)),w[c(w.length,1)])),v=h(v,1),q=b;t.$next_list();return n},ma.$$arity=4);a.defs(l,"$parse_list_item",sa=function(h,g,k,q,l){var t,C,m=b,n=b,v=b,r=b,u=b,F=b,y=r=b,E=b,B=b,J=b,B= +u=y=u=y=m=y=b;null==l&&(l=b);(m=g.$context())["$=="]("dlist")?(n=!0,v=p(x,"ListItem").$new(g,r=k["$[]"](1)),d(d(t=r["$start_with?"]("[["))?p(x,"LeadingInlineAnchorRx")["$=~"](r):t)&&this.$catalog_inline_anchor((t=w["~"])===b?b:t["$[]"](1),d(t=(C=w["~"])===b?b:C["$[]"](2))?t:((C=w["~"])===b?b:C.$post_match()).$lstrip(),v,h),d(u=k["$[]"](3))&&(F=!0),r=p(x,"ListItem").$new(g,u),d(g.$document().$sourcemap())&&(y=[h.$cursor()],z(v,"source_location=",a.to_a(y)),y[c(y.length,1)],d(F)?(y=[v.$source_location()], +z(r,"source_location=",a.to_a(y)),y[c(y.length,1)]):E=!0)):(F=!0,r=p(x,"ListItem").$new(g,u=k["$[]"](2)),d(g.$document().$sourcemap())&&(y=[h.$cursor()],z(r,"source_location=",a.to_a(y)),y[c(y.length,1)]),m["$=="]("ulist")?(y=[q],z(r,"marker=",a.to_a(y)),y[c(y.length,1)],d(u["$start_with?"]("["))&&(d(d(t=l)?l["$=="]("bibliography"):t)?d(p(x,"InlineBiblioAnchorRx")["$=~"](u))&&this.$catalog_inline_biblio_anchor((t=w["~"])===b?b:t["$[]"](1),(t=w["~"])===b?b:t["$[]"](2),r,h):d(u["$start_with?"]("[["))? +d(p(x,"LeadingInlineAnchorRx")["$=~"](u))&&this.$catalog_inline_anchor((t=w["~"])===b?b:t["$[]"](1),(t=w["~"])===b?b:t["$[]"](2),r,h):d(u["$start_with?"]("[ ] ","[x] ","[*] "))&&(y=["checklist-option",""],z(g.$attributes(),"[]=",a.to_a(y)),y[c(y.length,1)],y=["checkbox",""],z(r.$attributes(),"[]=",a.to_a(y)),y[c(y.length,1)],d(u["$start_with?"]("[ "))||(y=["checked",""],z(r.$attributes(),"[]=",a.to_a(y)),y[c(y.length,1)]),y=[u.$slice(4,u.$length())],z(r,"text=",a.to_a(y)),y[c(y.length,1)]))):m["$=="]("olist")? +(C=this.$resolve_ordered_list_marker(q,B=g.$items().$size(),!0,h),t=a.to_ary(C),q=null==t[0]?b:t[0],J=null==t[1]?b:t[1],C,y=[q],z(r,"marker=",a.to_a(y)),y[c(y.length,1)],d((t=B["$=="](0))?l["$!"]():B["$=="](0))&&(y=[d(t=J)?t:(d(C=p(x,"ORDERED_LIST_STYLES")["$[]"](c(q.$length(),1)))?C:"arabic").$to_s()],z(g,"style=",a.to_a(y)),y[c(y.length,1)]),d(d(t=u["$start_with?"]("[["))?p(x,"LeadingInlineAnchorRx")["$=~"](u):t)&&this.$catalog_inline_anchor((t=w["~"])===b?b:t["$[]"](1),(t=w["~"])===b?b:t["$[]"](2), +r,h)):(y=[q],z(r,"marker=",a.to_a(y)),y[c(y.length,1)]));h.$shift();y=h.$cursor();m=p(x,"Reader").$new(this.$read_lines_for_list_item(h,m,q,F),y);if(d(m["$has_more_lines?"]())){d(E)&&(y=[y],z(r,"source_location=",a.to_a(y)),y[c(y.length,1)]);y=m.$skip_line_comments();d(u=m.$peek_line())?(d(y["$empty?"]())||m.$unshift_lines(y),d(y=u["$empty?"]())?u=!1:(u=!0,d(n)||(F=b))):u=y=!1;if(d(B=this.$next_block(m,r,f([],{}),f(["text"],{text:F["$!"]()}))))r.$blocks()["$<<"](B);for(;d(m["$has_more_lines?"]());)if(d(B= +this.$next_block(m,r)))r.$blocks()["$<<"](B);r.$fold_first(y,u)}return d(n)?d(d(t=r["$text?"]())?t:r["$blocks?"]())?[v,r]:[v]:r},sa.$$arity=-5);a.defs(l,"$read_lines_for_list_item",da=function(h,g,k,q){var l,t,C,m,n,v,r,u,y=b,F=b,E=b,B=b,J=b,K=b,K=C=C=b;null==k&&(k=b);null==q&&(q=!0);y=[];F="inactive";E=!1;for(B=b;d(h["$has_more_lines?"]());){J=h.$read_line();if(d(this["$is_sibling_list_item?"](J,g,k)))break;K=d(y["$empty?"]())?b:y["$[]"](-1);if(K["$=="](p(x,"LIST_CONTINUATION"))&&(F["$=="]("inactive")&& +(F="active",q=!0,d(E)||(C=[-1,""],z(y,"[]=",a.to_a(C)),C[c(C.length,1)])),J["$=="](p(x,"LIST_CONTINUATION")))){d(F["$!="]("frozen"))&&(F="frozen",y["$<<"](J));J=b;continue}if(d(C=this["$is_delimited_block?"](J,!0)))if(F["$=="]("active"))y["$<<"](J),y.$concat(h.$read_lines_until(f(["terminator","read_last_line","context"],{terminator:C.$terminator(),read_last_line:!0,context:b}))),F="inactive";else break;else if(d(d(t=(C=g["$=="]("dlist"))?F["$!="]("active"):g["$=="]("dlist"))?p(x,"BlockAttributeLineRx")["$match?"](J): +t))break;else if(d((t=F["$=="]("active"))?J["$empty?"]()["$!"]():F["$=="]("active")))if(d(p(x,"LiteralParagraphRx")["$match?"](J)))h.$unshift_line(J),y.$concat(z(h,"read_lines_until",[f(["preserve_last_line","break_on_blank_lines","break_on_list_continuation"],{preserve_last_line:!0,break_on_blank_lines:!0,break_on_list_continuation:!0})],(m=function(a){var c=m.$$s||this;null==a&&(a=b);return g["$=="]("dlist")?c["$is_sibling_list_item?"](a,g,k):g["$=="]("dlist")},m.$$s=this,m.$$arity=1,m))),F="inactive"; +else if(d(d(t=d(C=p(x,"BlockTitleRx")["$match?"](J))?C:p(x,"BlockAttributeLineRx")["$match?"](J))?t:p(x,"AttributeEntryRx")["$match?"](J)))y["$<<"](J);else d(K=z(d(E)?["dlist"]:p(x,"NESTABLE_LIST_CONTEXTS"),"find",[],(n=function(a){null==a&&(a=b);return p(x,"ListRxMap")["$[]"](a)["$match?"](J)},n.$$s=this,n.$$arity=1,n)))&&(E=!0,d((t=K["$=="]("dlist"))?((C=w["~"])===b?b:C["$[]"](3))["$nil_or_empty?"]():K["$=="]("dlist"))&&(q=!1)),y["$<<"](J),F="inactive";else if(d(d(t=K)?K["$empty?"]():t)){if(d(J["$empty?"]())){if(!d(J= +d(t=h.$skip_blank_lines())?h.$read_line():t))break;if(d(this["$is_sibling_list_item?"](J,g,k)))break}if(J["$=="](p(x,"LIST_CONTINUATION")))B=y.$size(),y["$<<"](J);else if(d(q))if(d(this["$is_sibling_list_item?"](J,g,k)))break;else if(d(K=z(p(x,"NESTABLE_LIST_CONTEXTS"),"find",[],(v=function(a){null==a&&(a=b);return p(x,"ListRxMap")["$[]"](a)["$=~"](J)},v.$$s=this,v.$$arity=1,v))))y["$<<"](J),E=!0,d((t=K["$=="]("dlist"))?((C=w["~"])===b?b:C["$[]"](3))["$nil_or_empty?"]():K["$=="]("dlist"))&&(q=!1); +else if(d(p(x,"LiteralParagraphRx")["$match?"](J)))h.$unshift_line(J),y.$concat(z(h,"read_lines_until",[f(["preserve_last_line","break_on_blank_lines","break_on_list_continuation"],{preserve_last_line:!0,break_on_blank_lines:!0,break_on_list_continuation:!0})],(r=function(a){var c=r.$$s||this;null==a&&(a=b);return g["$=="]("dlist")?c["$is_sibling_list_item?"](a,g,k):g["$=="]("dlist")},r.$$s=this,r.$$arity=1,r)));else break;else d(E)||y.$pop(),y["$<<"](J),q=!0}else d(J["$empty?"]()["$!"]())&&(q=!0), +d(K=z(d(E)?["dlist"]:p(x,"NESTABLE_LIST_CONTEXTS"),"find",[],(u=function(a){null==a&&(a=b);return p(x,"ListRxMap")["$[]"](a)["$=~"](J)},u.$$s=this,u.$$arity=1,u)))&&(E=!0,d((t=K["$=="]("dlist"))?((C=w["~"])===b?b:C["$[]"](3))["$nil_or_empty?"]():K["$=="]("dlist"))&&(q=!1)),y["$<<"](J);J=b}d(J)&&h.$unshift_line(J);for(d(B)&&y.$delete_at(B);d(d(t=y["$empty?"]()["$!"]())?y["$[]"](-1)["$empty?"]():t);)y.$pop();d(d(l=y["$empty?"]()["$!"]())?y["$[]"](-1)["$=="](p(x,"LIST_CONTINUATION")):l)&&y.$pop();return y}, +da.$$arity=-3);a.defs(l,"$initialize_section",ea=function(h,g,k){var l,t,C=b,m=b,n=b,v=b,r=b,u=b,w=b,y=b,F=b,E=b,B=b,J=n=b,K=b,G=r=b;null==k&&(k=f([],{}));C=g.$document();m=(n=C.$doctype())["$=="]("book");d(C.$sourcemap())&&(v=h.$cursor());r=k["$[]"](1);t=this.$parse_section_title(h,C,k["$[]"]("id"));l=a.to_ary(t);u=null==l[0]?b:l[0];w=null==l[1]?b:l[1];y=null==l[2]?b:l[2];F=null==l[3]?b:l[3];E=null==l[4]?b:l[4];t;d(w)?(B=["reftext",w],z(k,"[]=",a.to_a(B)),B[c(B.length,1)]):w=k["$[]"]("reftext"); +d(r)?d(d(l=m)?r["$=="]("abstract"):l)?(l=["chapter",1],n=l[0],F=l[1],l):(l=[r,!0],n=l[0],J=l[1],l,F["$=="](0)&&(F=1),K=r["$=="]("appendix")):d(m)?n=F["$=="](0)?"part":d(q(F,1))?"section":"chapter":d(n["$=="]("manpage")?y.$casecmp("synopsis")["$=="](0):n["$=="]("manpage"))?(l=["synopsis",!0],n=l[0],J=l[1],l):n="section";r=p(x,"Section").$new(g,F);l=[u,y,n,v];r["$id="](l[0]);r["$title="](l[1]);r["$sectname="](l[2]);r["$source_location="](l[3]);l;d(J)?(B=[!0],z(r,"special=",a.to_a(B)),B[c(B.length,1)], +d(K)?(B=[!0],z(r,"numbered=",a.to_a(B)),B[c(B.length,1)]):C.$attributes()["$[]"]("sectnums")["$=="]("all")&&(B=[d(d(l=m)?F["$=="](1):l)?"chapter":!0],z(r,"numbered=",a.to_a(B)),B[c(B.length,1)])):d(d(l=C.$attributes()["$[]"]("sectnums"))?q(F,0):l)?(B=[d(r.$special())?d(l=g.$numbered())?!0:l:!0],z(r,"numbered=",a.to_a(B)),B[c(B.length,1)]):d(d(l=d(t=m)?F["$=="](0):t)?C.$attributes()["$[]"]("partnums"):l)&&(B=[!0],z(r,"numbered=",a.to_a(B)),B[c(B.length,1)]);d(G=d(l=r.$id())?l:(B=[d(C.$attributes()["$key?"]("sectids"))? +p(x,"Section").$generate_id(r.$title(),C):b],z(r,"id=",a.to_a(B)),B[c(B.length,1)]))&&!d(C.$register("refs",[G,r,d(l=w)?l:r.$title()]))&&this.$logger().$warn(this.$message_with_context("id assigned to section already in use: "+G,f(["source_location"],{source_location:h.$cursor_at_line(c(h.$lineno(),d(E)?1:2))})));r.$update_attributes(k);h.$skip_blank_lines();return r},ea.$$arity=-3);a.defs(l,"$is_next_line_section?",R=function(a,c){var e,f,h=b,g=b;return d(d(e=h=c["$[]"](1))?d(f=h["$=="]("discrete"))? +f:h["$=="]("float"):e)?b:d(p(x,"Compliance").$underline_style_section_titles())?(g=a.$peek_lines(2,d(e=h)?h["$=="]("comment"):e),this["$is_section_title?"](d(e=g["$[]"](0))?e:"",g["$[]"](1))):this["$atx_section_title?"](d(e=a.$peek_line())?e:"")},R.$$arity=2);a.defs(l,"$is_next_line_doctitle?",Ea=function(a,c,e){var f,g=b;return d(e)?d(f=g=this["$is_next_line_section?"](a,c))?h(g,e.$to_i())["$=="](0):f:this["$is_next_line_section?"](a,c)["$=="](0)},Ea.$$arity=3);a.defs(l,"$is_section_title?",Aa=function(a, +c){var e;null==c&&(c=b);return d(e=this["$atx_section_title?"](a))?e:d(c["$nil_or_empty?"]())?b:this["$setext_section_title?"](a,c)},Aa.$$arity=-2);a.defs(l,"$atx_section_title?",Ba=function(a){var f;return d(d(p(x,"Compliance").$markdown_syntax())?d(f=a["$start_with?"]("=","#"))?p(x,"ExtAtxSectionTitleRx")["$=~"](a):f:d(f=a["$start_with?"]("="))?p(x,"AtxSectionTitleRx")["$=~"](a):f)?c(((f=w["~"])===b?b:f["$[]"](1)).$length(),1):b},Ba.$$arity=1);a.defs(l,"$setext_section_title?",wa=function(a,f){var h, +k,q,l=b,t=b,C=b;return d(d(h=d(k=d(q=l=p(x,"SETEXT_SECTION_LEVELS")["$[]"](t=f.$chr()))?g(t,C=f.$length())["$=="](f):q)?p(x,"SetextSectionTitleRx")["$match?"](a):k)?m(c(this.$line_length(a),C).$abs(),2):h)?l:b},wa.$$arity=2);a.defs(l,"$parse_section_title",oa=function(a,f,q){var l,t,C,n,r,u=b,z=b,y=b,F=b,E=b,B=b,J=b,K=b;null==q&&(q=b);u=b;z=a.$read_line();d(d(p(x,"Compliance").$markdown_syntax())?d(l=z["$start_with?"]("=","#"))?p(x,"ExtAtxSectionTitleRx")["$=~"](z):l:d(l=z["$start_with?"]("="))?p(x, +"AtxSectionTitleRx")["$=~"](z):l)?(l=[c(((t=w["~"])===b?b:t["$[]"](1)).$length(),1),(t=w["~"])===b?b:t["$[]"](2),!0],y=l[0],F=l[1],E=l[2],l,!d(q)&&d(d(l=d(t=F["$end_with?"]("]]"))?p(x,"InlineSectionAnchorRx")["$=~"](F):t)?((t=w["~"])===b?b:t["$[]"](1))["$!"]():l)&&(l=[F.$slice(0,c(F.$length(),((t=w["~"])===b?b:t["$[]"](0)).$length())),(t=w["~"])===b?b:t["$[]"](2),(t=w["~"])===b?b:t["$[]"](3)],F=l[0],q=l[1],u=l[2],l)):d(d(l=d(t=d(C=d(n=d(r=p(x,"Compliance").$underline_style_section_titles())?B=a.$peek_line(!0): +r)?y=p(x,"SETEXT_SECTION_LEVELS")["$[]"](J=B.$chr()):n)?g(J,K=B.$length())["$=="](B):C)?F=d(C=p(x,"SetextSectionTitleRx")["$=~"](z))?(n=w["~"])===b?b:n["$[]"](1):C:t)?m(c(this.$line_length(z),K).$abs(),2):l)?(E=!1,!d(q)&&d(d(l=d(t=F["$end_with?"]("]]"))?p(x,"InlineSectionAnchorRx")["$=~"](F):t)?((t=w["~"])===b?b:t["$[]"](1))["$!"]():l)&&(l=[F.$slice(0,c(F.$length(),((t=w["~"])===b?b:t["$[]"](0)).$length())),(t=w["~"])===b?b:t["$[]"](2),(t=w["~"])===b?b:t["$[]"](3)],F=l[0],q=l[1],u=l[2],l),a.$shift()): +this.$raise("Unrecognized section at "+a.$cursor_at_prev_line());d(f["$attr?"]("leveloffset"))&&(y=h(y,f.$attr("leveloffset").$to_i()));return[q,u,F,y,E]},oa.$$arity=-3);d(p(x,"FORCE_UNICODE_LINE_LENGTH"))?a.defs(l,"$line_length",Fa=function(a){return a.$scan(p(x,"UnicodeCharScanRx")).$size()},Fa.$$arity=1):a.defs(l,"$line_length",Q=function(a){return a.$length()},Q.$$arity=1);a.defs(l,"$parse_header_metadata",ja=function(g,q){var l,t,C,m,v=b,r=b,u=b,w=b,y=b,E=b,B=b,J=b,K=b,G=b,A=J=b,D=b,K=B=y=w= +r=b;null==q&&(q=b);v=d(l=q)?q.$attributes():l;this.$process_attribute_entries(g,q);l=[r=f([],{}),b,b];u=l[0];w=l[1];y=l[2];l;d(d(l=g["$has_more_lines?"]())?g["$next_line_empty?"]()["$!"]():l)?(d((E=this.$process_authors(g.$read_line()))["$empty?"]())||(d(q)&&(z(E,"each",[],(t=function(f,h){var g=b;null==f&&(f=b);null==h&&(h=b);if(d(v["$key?"](f)))return b;g=[f,d(n("::","String")["$==="](h))?q.$apply_header_subs(h):h];z(v,"[]=",a.to_a(g));return g[c(g.length,1)]},t.$$s=this,t.$$arity=2,t)),w=v["$[]"]("author"), +y=v["$[]"]("authorinitials"),r=v["$[]"]("authors")),u=E),this.$process_attribute_entries(g,q),B=f([],{}),d(d(l=g["$has_more_lines?"]())?g["$next_line_empty?"]()["$!"]():l)&&(J=g.$read_line(),d(K=p(x,"RevisionInfoLineRx").$match(J))?(d(K["$[]"](1))&&(G=["revnumber",K["$[]"](1).$rstrip()],z(B,"[]=",a.to_a(G)),G[c(G.length,1)]),d((J=K["$[]"](2).$strip())["$empty?"]())||(G=d(d(l=K["$[]"](1)["$!"]())?J["$start_with?"]("v"):l)?["revnumber",J.$slice(1,J.$length())]:["revdate",J],z(B,"[]=",a.to_a(G)),G[c(G.length, +1)]),d(K["$[]"](3))&&(G=["revremark",K["$[]"](3).$rstrip()],z(B,"[]=",a.to_a(G)),G[c(G.length,1)])):g.$unshift_line(J)),d(B["$empty?"]())||(d(q)&&z(B,"each",[],(C=function(f,h){null==f&&(f=b);null==h&&(h=b);if(d(v["$key?"](f)))return b;G=[f,q.$apply_header_subs(h)];z(v,"[]=",a.to_a(G));return G[c(G.length,1)]},C.$$s=this,C.$$arity=2,C)),u.$update(B)),this.$process_attribute_entries(g,q),g.$skip_blank_lines()):E=f([],{});if(d(q)){if(d(d(l=v["$key?"]("author"))?(A=v["$[]"]("author"))["$!="](w):l))E= +this.$process_authors(A,!0,!1),d(v["$[]"]("authorinitials")["$!="](y))&&E.$delete("authorinitials");else if(d(d(l=v["$key?"]("authors"))?(A=v["$[]"]("authors"))["$!="](r):l))E=this.$process_authors(A,!0);else{l=[[],1,"author_1",!1,!1];D=l[0];r=l[1];w=l[2];y=l[3];B=l[4];for(l;d(v["$key?"](w));)(K=v["$[]"](w))["$=="](E["$[]"](w))?(D["$<<"](b),B=!0):(D["$<<"](K),y=!0),w="author_"+(r=h(r,1));d(y)?(d(B)&&z(D,"each_with_index",[],(m=function(f,g){var q=m.$$s||this,l,p=b;null==f&&(f=b);null==g&&(g=b);if(d(f))return b; +G=[g,z([E["$[]"]("firstname_"+(p=h(g,1))),E["$[]"]("middlename_"+p),E["$[]"]("lastname_"+p)].$compact(),"map",[],(l=function(a){null==a&&(a=b);return a.$tr(" ","_")},l.$$s=q,l.$$arity=1,l)).$join(" ")];z(D,"[]=",a.to_a(G));return G[c(G.length,1)]},m.$$s=this,m.$$arity=2,m)),E=this.$process_authors(D,!0,!1)):E=f([],{})}d(E["$empty?"]())?d(l=u["$[]"]("authorcount"))?l:(G=["authorcount",(G=["authorcount",0],z(v,"[]=",a.to_a(G)),G[c(G.length,1)])],z(u,"[]=",a.to_a(G)),G[c(G.length,1)]):(v.$update(E), +d(d(l=v["$key?"]("email")["$!"]())?v["$key?"]("email_1"):l)&&(G=["email",v["$[]"]("email_1")],z(v,"[]=",a.to_a(G)),G[c(G.length,1)]))}return u},ja.$$arity=-2);a.defs(l,"$process_authors",xa=function(g,q,l){var t,C,m=this,n=b,v=b,r=b,u=b,u=b;null==q&&(q=!1);null==l&&(l=!0);n=f([],{});v=0;r="author authorinitials firstname middlename lastname email".split(" ");u=function(){return d(l)?z(g.$split(";"),"map",[],(t=function(a){null==a&&(a=b);return a.$strip()},t.$$s=m,t.$$arity=1,t)):m.$Array(g)}();z(u, +"each",[],(C=function(g){var l=C.$$s||this,t,m,u,w,y=b,F=b,E=b,B=b,J=b,K=b,G=b,O=b;null==g&&(g=b);if(d(g["$empty?"]()))return b;v=h(v,1);y=f([],{});v["$=="](1)?z(r,"each",[],(t=function(d){var f=b;null==d&&(d=b);f=[d.$to_sym(),d];z(y,"[]=",a.to_a(f));return f[c(f.length,1)]},t.$$s=l,t.$$arity=1,t)):z(r,"each",[],(m=function(d){var f=b;null==d&&(d=b);f=[d.$to_sym(),""+d+"_"+v];z(y,"[]=",a.to_a(f));return f[c(f.length,1)]},m.$$s=l,m.$$arity=1,m));if(d(q)){if(d(g["$include?"]("<"))&&(F=[y["$[]"]("author"), +g.$tr("_"," ")],z(n,"[]=",a.to_a(F)),F[c(F.length,1)],g=g.$gsub(p(x,"XmlSanitizeRx"),"")),(E=g.$split(b,3)).$size()["$=="](3))E["$<<"](E.$pop().$squeeze(" "))}else d(B=p(x,"AuthorInfoLineRx").$match(g))&&(E=B.$to_a()).$shift();d(E)?(J=(F=[y["$[]"]("firstname"),K=E["$[]"](0).$tr("_"," ")],z(n,"[]=",a.to_a(F)),F[c(F.length,1)]),F=[y["$[]"]("authorinitials"),K.$chr()],z(n,"[]=",a.to_a(F)),F[c(F.length,1)],d(E["$[]"](1))&&(d(E["$[]"](2))?(F=[y["$[]"]("middlename"),G=E["$[]"](1).$tr("_"," ")],z(n,"[]=", +a.to_a(F)),F[c(F.length,1)],F=[y["$[]"]("lastname"),O=E["$[]"](2).$tr("_"," ")],z(n,"[]=",a.to_a(F)),F[c(F.length,1)],J=h(h(h(h(K," "),G)," "),O),F=[y["$[]"]("authorinitials"),""+K.$chr()+G.$chr()+O.$chr()]):(F=[y["$[]"]("lastname"),O=E["$[]"](1).$tr("_"," ")],z(n,"[]=",a.to_a(F)),F[c(F.length,1)],J=h(h(K," "),O),F=[y["$[]"]("authorinitials"),""+K.$chr()+O.$chr()]),z(n,"[]=",a.to_a(F)),F[c(F.length,1)]),d(u=n["$[]"](y["$[]"]("author")))?u:(F=[y["$[]"]("author"),J],z(n,"[]=",a.to_a(F)),F[c(F.length, +1)]),d(d(u=q)?u:E["$[]"](3)["$!"]())||(F=[y["$[]"]("email"),E["$[]"](3)],z(n,"[]=",a.to_a(F)),F[c(F.length,1)])):(F=[y["$[]"]("author"),(F=[y["$[]"]("firstname"),K=g.$squeeze(" ").$strip()],z(n,"[]=",a.to_a(F)),F[c(F.length,1)])],z(n,"[]=",a.to_a(F)),F[c(F.length,1)],F=[y["$[]"]("authorinitials"),K.$chr()],z(n,"[]=",a.to_a(F)),F[c(F.length,1)]);v["$=="](1)?F=["authors",n["$[]"](y["$[]"]("author"))]:(v["$=="](2)&&z(r,"each",[],(w=function(f){null==f&&(f=b);return d(n["$key?"](f))?(F=[""+f+"_1",n["$[]"](f)], +z(n,"[]=",a.to_a(F)),F[c(F.length,1)]):b},w.$$s=l,w.$$arity=1,w)),F=["authors",""+n["$[]"]("authors")+", "+n["$[]"](y["$[]"]("author"))]);z(n,"[]=",a.to_a(F));return F[c(F.length,1)]},C.$$s=m,C.$$arity=1,C));u=["authorcount",v];z(n,"[]=",a.to_a(u));u[c(u.length,1)];return n},xa.$$arity=-2);a.defs(l,"$parse_block_metadata_lines",ta=function(a,b,c,e){var g;null==c&&(c=f([],{}));for(null==e&&(e=f([],{}));d(this.$parse_block_metadata_line(a,b,c,e));)if(a.$shift(),d(g=a.$skip_blank_lines()))g;else break; +return c},ta.$$arity=-3);a.defs(l,"$parse_block_metadata_line",Ma=function(h,k,q,l){var t,C,n=b,m=b,v=b,v=v=v=b;null==w["~"]&&(w["~"]=b);null==l&&(l=f([],{}));if(d(d(t=n=h.$peek_line())?d(l["$[]"]("text"))?n["$start_with?"]("[","/"):m=n["$start_with?"]("[",".","/",":"):t))if(d(n["$start_with?"]("[")))if(d(n["$start_with?"]("[["))){if(d(d(t=n["$end_with?"]("]]"))?p(x,"BlockAnchorRx")["$=~"](n):t))return v=["id",(t=w["~"])===b?b:t["$[]"](1)],z(q,"[]=",a.to_a(v)),v[c(v.length,1)],d(v=(t=w["~"])===b? +b:t["$[]"](2))&&(v=["reftext",d(v["$include?"](p(x,"ATTR_REF_HEAD")))?k.$sub_attributes(v):v],z(q,"[]=",a.to_a(v)),v[c(v.length,1)]),!0}else{if(d(d(t=n["$end_with?"]("]"))?p(x,"BlockAttributeListRx")["$=~"](n):t))return v=q["$[]"](1),d(k.$parse_attributes((t=w["~"])===b?b:t["$[]"](1),[],f(["sub_input","sub_result","into"],{sub_input:!0,sub_result:!0,into:q}))["$[]"](1))&&(v=[1,d(t=this.$parse_style_attribute(q,h))?t:v],z(q,"[]=",a.to_a(v)),v[c(v.length,1)]),!0}else if(d(d(t=m)?n["$start_with?"]("."): +t)){if(d(p(x,"BlockTitleRx")["$=~"](n)))return v=["title",(t=w["~"])===b?b:t["$[]"](1)],z(q,"[]=",a.to_a(v)),v[c(v.length,1)],!0}else if(d(d(t=m["$!"]())?t:n["$start_with?"]("/"))){if(d(n["$start_with?"]("//"))){if(n["$=="]("//"))return!0;if(d(d(t=m)?g("/",v=n.$length())["$=="](n):t)){if(v["$=="](3))return b;h.$read_lines_until(f(["terminator","skip_first_line","preserve_last_line","skip_processing","context"],{terminator:n,skip_first_line:!0,preserve_last_line:!0,skip_processing:!0,context:"comment"})); +return!0}return d(n["$start_with?"]("///"))?b:!0}}else if(d(d(t=d(C=m)?n["$start_with?"](":"):C)?p(x,"AttributeEntryRx")["$=~"](n):t))return this.$process_attribute_entry(h,k,q,w["~"]),!0;return b},Ma.$$arity=-4);a.defs(l,"$process_attribute_entries",Ca=function(a,c,e){null==e&&(e=b);for(a.$skip_comment_lines();d(this.$process_attribute_entry(a,c,e));)a.$shift(),a.$skip_comment_lines()},Ca.$$arity=-3);a.defs(l,"$process_attribute_entry",Ga=function(a,f,g,h){var k,q,l,t=b,C=b,n=b,m=b;null==g&&(g=b); +null==h&&(h=b);if(d(h=d(k=h)?k:d(a["$has_more_lines?"]())?p(x,"AttributeEntryRx").$match(a.$peek_line()):b)){if(d((t=h["$[]"](2))["$nil_or_empty?"]()))t="";else if(d(t["$end_with?"](p(x,"LINE_CONTINUATION"),p(x,"LINE_CONTINUATION_LEGACY"))))for(k=[t.$slice(-2,2),t.$slice(0,c(t.$length(),2)).$rstrip()],C=k[0],t=k[1],k;d(d(q=a.$advance())?(n=d(l=a.$peek_line())?l:"")["$empty?"]()["$!"]():q)&&(n=n.$lstrip(),d(m=n["$end_with?"](C))&&(n=n.$slice(0,c(n.$length(),2)).$rstrip()),t=""+t+(d(t["$end_with?"](p(x, +"HARD_LINE_BREAK")))?p(x,"LF"):" ")+n,d(m)););this.$store_attribute(h["$[]"](1),t,f,g);return!0}return b},Ga.$$arity=-3);a.defs(l,"$store_attribute",Ha=function(a,f,g,q){var l,t=b;null==g&&(g=b);null==q&&(q=b);d(a["$end_with?"]("!"))?(l=[a.$chop(),b],a=l[0],f=l[1],l):d(a["$start_with?"]("!"))&&(l=[a.$slice(1,a.$length()),b],a=l[0],f=l[1],l);a=this.$sanitize_attribute_name(a);a["$=="]("numbered")&&(a="sectnums");d(g)?d(f)?(a["$=="]("leveloffset")&&(d(f["$start_with?"]("+"))?f=h(g.$attr("leveloffset", +0).$to_i(),f.$slice(1,f.$length()).$to_i()).$to_s():d(f["$start_with?"]("-"))&&(f=c(g.$attr("leveloffset",0).$to_i(),f.$slice(1,f.$length()).$to_i()).$to_s())),d(t=g.$set_attribute(a,f))&&(f=t,d(q)&&n(p(x,"Document"),"AttributeEntry").$new(a,f).$save_to(q))):d(d(l=g.$delete_attribute(a))?q:l)&&n(p(x,"Document"),"AttributeEntry").$new(a,f).$save_to(q):d(q)&&n(p(x,"Document"),"AttributeEntry").$new(a,f).$save_to(q);return[a,f]},Ha.$$arity=-3);a.defs(l,"$resolve_list_marker",Ia=function(a,c,d,e,f){null== +d&&(d=0);null==e&&(e=!1);null==f&&(f=b);return a["$=="]("ulist")?c:a["$=="]("olist")?this.$resolve_ordered_list_marker(c,d,e,f)["$[]"](0):"<1>"},Ia.$$arity=-3);a.defs(l,"$resolve_ordered_list_marker",Pa=function(a,c,e,g){var q,l,t=b,C=b,n=b,m=b;null==c&&(c=0);null==e&&(e=!1);null==g&&(g=b);if(d(a["$start_with?"](".")))return[a];t=C=z(p(x,"ORDERED_LIST_STYLES"),"find",[],(q=function(c){null==c&&(c=b);return p(x,"OrderedListMarkerRxMap")["$[]"](c)["$match?"](a)},q.$$s=this,q.$$arity=1,q));"arabic"["$==="](t)? +(d(e)&&(n=h(c,1),m=a.$to_i()),a="1."):"loweralpha"["$==="](t)?(d(e)&&(n=h("a"["$[]"](0).$ord(),c).$chr(),m=a.$chop()),a="a."):"upperalpha"["$==="](t)?(d(e)&&(n=h("A"["$[]"](0).$ord(),c).$chr(),m=a.$chop()),a="A."):"lowerroman"["$==="](t)?(d(e)&&(n=p(x,"Helpers").$int_to_roman(h(c,1)).$downcase(),m=a.$chop()),a="i)"):"upperroman"["$==="](t)&&(d(e)&&(n=p(x,"Helpers").$int_to_roman(h(c,1)),m=a.$chop()),a="I)");d(d(l=e)?n["$!="](m):l)&&this.$logger().$warn(this.$message_with_context("list item index: expected "+ +n+", got "+m,f(["source_location"],{source_location:g.$cursor()})));return[a,C]},Pa.$$arity=-2);a.defs(l,"$is_sibling_list_item?",Ra=function(a,c,e){var f,g=b,h=b;d(n("::","Regexp")["$==="](e))?g=e:(g=p(x,"ListRxMap")["$[]"](c),h=e);return d(g["$=~"](a))?d(h)?h["$=="](this.$resolve_list_marker(c,(f=w["~"])===b?b:f["$[]"](1))):!0:!1},Ra.$$arity=3);a.defs(l,"$parse_table",Na=function(f,g,l){var t,C,m,v=b,r=b,u=b,w=b,y=b,E=b,B=b,J=b,K=b,G=b,A=b,D=y=b,R=b,W=y=D=b,N=W=b,v=p(x,"Table").$new(g,l);d(l["$key?"]("title"))&& +(r=[l.$delete("title")],z(v,"title=",a.to_a(r)),r[c(r.length,1)],v.$assign_caption(l.$delete("caption")));d(d(t=l["$key?"]("cols"))?(u=this.$parse_colspecs(l["$[]"]("cols")))["$empty?"]()["$!"]():t)&&(v.$create_columns(u),w=!0);y=d(t=f.$skip_blank_lines())?t:0;E=n(p(x,"Table"),"ParserContext").$new(f,v,l);t=[E.$format(),-1,b];B=t[0];J=t[1];K=t[2];t;d(d(t=d(C=q(y,0))?C:l["$key?"]("header-option"))?t:l["$key?"]("noheader-option"))||(G=!0);for(t=!1;t||d(A=f.$read_line());){t=!1;d(d(C=y=q(J=h(J,1),0))? +A["$empty?"]():C)?(A=b,d(K)&&(K=h(K,1))):B["$=="]("psv")&&(d(E["$starts_with_delimiter?"](A))?(A=A.$slice(1,A.$length()),E.$close_open_cell(),d(K)&&(K=b)):(m=this.$parse_cellspec(A,"start",E.$delimiter()),C=a.to_ary(m),D=null==C[0]?b:C[0],A=null==C[1]?b:C[1],m,d(D)?(E.$close_open_cell(D),d(K)&&(K=b)):d(d(C=K)?K["$=="](J):C)&&(C=[!1,b],G=C[0],K=C[1],C)));d(y)||(f.$mark(),d(G)&&(d(d(C=f["$has_more_lines?"]())?f.$peek_line()["$empty?"]():C)?K=1:G=!1));for(C=!1;C||d(!0);)if(C=!1,d(d(m=A)?R=E.$match_delimiter(A): +m)){m=[R.$pre_match(),R.$post_match()];D=m[0];y=m[1];m;W=B;if("csv"["$==="](W)){if(d(E["$buffer_has_unclosed_quotes?"](D))){E.$skip_past_delimiter(D);if(d((A=y)["$empty?"]()))break;C=!0;continue}r=[""+E.$buffer()+D]}else if("dsv"["$==="](W)){if(d(D["$end_with?"]("\\"))){E.$skip_past_escaped_delimiter(D);if(d((A=y)["$empty?"]())){r=[""+E.$buffer()+p(x,"LF")];z(E,"buffer=",a.to_a(r));r[c(r.length,1)];E.$keep_cell_open();break}C=!0;continue}r=[""+E.$buffer()+D]}else{if(d(D["$end_with?"]("\\"))){E.$skip_past_escaped_delimiter(D); +if(d((A=y)["$empty?"]())){r=[""+E.$buffer()+p(x,"LF")];z(E,"buffer=",a.to_a(r));r[c(r.length,1)];E.$keep_cell_open();break}C=!0;continue}g=this.$parse_cellspec(D);m=a.to_ary(g);D=null==m[0]?b:m[0];W=null==m[1]?b:m[1];g;E.$push_cellspec(D);r=[""+E.$buffer()+W]}z(E,"buffer=",a.to_a(r));r[c(r.length,1)];d((A=y)["$empty?"]())&&(A=b);E.$close_cell()}else{r=[""+E.$buffer()+A+p(x,"LF")];z(E,"buffer=",a.to_a(r));r[c(r.length,1)];W=B;"csv"["$==="](W)?d(E["$buffer_has_unclosed_quotes?"]())?(d(d(m=K)?J["$=="](0): +m)&&(m=[!1,b],G=m[0],K=m[1],m),E.$keep_cell_open()):E.$close_cell(!0):"dsv"["$==="](W)?E.$close_cell(!0):E.$keep_cell_open();break}if(d(E["$cell_open?"]()))d(f["$has_more_lines?"]())||E.$close_cell(!0);else if(d(C=f.$skip_blank_lines()))C;else break}d(d(t=(N=v.$attributes(),d(C=N["$[]"]("colcount"))?C:(r=["colcount",v.$columns().$size()],z(N,"[]=",a.to_a(r)),r[c(r.length,1)]))["$=="](0))?t:w)||v.$assign_column_widths();d(G)&&(r=[!0],z(v,"has_header_option=",a.to_a(r)),r[c(r.length,1)],r=["header-option", +""],z(l,"[]=",a.to_a(r)),r[c(r.length,1)],r=["options",d(l["$key?"]("options"))?""+l["$[]"]("options")+",header":"header"],z(l,"[]=",a.to_a(r)),r[c(r.length,1)]);v.$partition_header_footer(l);return v},Na.$$arity=3);a.defs(l,"$parse_colspecs",Oa=function(g){var h,k,q=b;d(g["$include?"](" "))&&(g=g.$delete(" "));if(g["$=="](g.$to_i().$to_s()))return z(n("::","Array"),"new",[g.$to_i()],(h=function(){return f(["width"],{width:1})},h.$$s=this,h.$$arity=0,h));q=[];z(d(g["$include?"](","))?g.$split(",", +-1):g.$split(";",-1),"each",[],(k=function(g){var h=k.$$s||this,l,t,C=b,n=b,m=b,v=b,r=m=b;null==g&&(g=b);return d(g["$empty?"]())?q["$<<"](f(["width"],{width:1})):d(C=p(x,"ColumnSpecRx").$match(g))?(n=f([],{}),d(C["$[]"](2))&&(g=C["$[]"](2).$split("."),l=a.to_ary(g),m=null==l[0]?b:l[0],v=null==l[1]?b:l[1],g,d(d(l=m["$nil_or_empty?"]()["$!"]())?p(x,"TableCellHorzAlignments")["$key?"](m):l)&&(m=["halign",p(x,"TableCellHorzAlignments")["$[]"](m)],z(n,"[]=",a.to_a(m)),m[c(m.length,1)]),d(d(l=v["$nil_or_empty?"]()["$!"]())? +p(x,"TableCellVertAlignments")["$key?"](v):l)&&(m=["valign",p(x,"TableCellVertAlignments")["$[]"](v)],z(n,"[]=",a.to_a(m)),m[c(m.length,1)])),m=d(r=C["$[]"](3))?["width",r["$=="]("~")?-1:r.$to_i()]:["width",1],z(n,"[]=",a.to_a(m)),m[c(m.length,1)],d(d(l=C["$[]"](4))?p(x,"TableCellStyles")["$key?"](C["$[]"](4)):l)&&(m=["style",p(x,"TableCellStyles")["$[]"](C["$[]"](4))],z(n,"[]=",a.to_a(m)),m[c(m.length,1)]),d(C["$[]"](1))?z(1,"upto",[C["$[]"](1).$to_i()],(t=function(){return q["$<<"](n.$dup())},t.$$s= +h,t.$$arity=0,t)):q["$<<"](n)):b},k.$$s=this,k.$$arity=1,k));return q},Oa.$$arity=1);a.defs(l,"$parse_cellspec",Va=function(g,h,k){var q,l=b,t=b,C=l=b,m=b,n=b,m=b;null==h&&(h="end");null==k&&(k=b);q=[b,""];q;if(h["$=="]("start"))if(d(g["$include?"](k)))if(h=g.$split(k,2),q=a.to_ary(h),l=null==q[0]?b:q[0],t=null==q[1]?b:q[1],h,d(l=p(x,"CellSpecStartRx").$match(l))){if(d(l["$[]"](0)["$empty?"]()))return[f([],{}),t]}else return[b,g];else return[b,g];else if(d(l=p(x,"CellSpecEndRx").$match(g))){if(d(l["$[]"](0).$lstrip()["$empty?"]()))return[f([], +{}),g.$rstrip()];t=l.$pre_match()}else return[f([],{}),g];C=f([],{});d(l["$[]"](1))&&(h=l["$[]"](1).$split("."),q=a.to_ary(h),m=null==q[0]?b:q[0],n=null==q[1]?b:q[1],h,m=d(m["$nil_or_empty?"]())?1:m.$to_i(),n=d(n["$nil_or_empty?"]())?1:n.$to_i(),l["$[]"](2)["$=="]("+")?(m["$=="](1)||(m=["colspan",m],z(C,"[]=",a.to_a(m)),m[c(m.length,1)]),n["$=="](1)||(m=["rowspan",n],z(C,"[]=",a.to_a(m)),m[c(m.length,1)])):l["$[]"](2)["$=="]("*")&&!m["$=="](1)&&(m=["repeatcol",m],z(C,"[]=",a.to_a(m)),m[c(m.length, +1)]));d(l["$[]"](3))&&(h=l["$[]"](3).$split("."),q=a.to_ary(h),m=null==q[0]?b:q[0],n=null==q[1]?b:q[1],h,d(d(q=m["$nil_or_empty?"]()["$!"]())?p(x,"TableCellHorzAlignments")["$key?"](m):q)&&(m=["halign",p(x,"TableCellHorzAlignments")["$[]"](m)],z(C,"[]=",a.to_a(m)),m[c(m.length,1)]),d(d(q=n["$nil_or_empty?"]()["$!"]())?p(x,"TableCellVertAlignments")["$key?"](n):q)&&(m=["valign",p(x,"TableCellVertAlignments")["$[]"](n)],z(C,"[]=",a.to_a(m)),m[c(m.length,1)]));d(d(q=l["$[]"](4))?p(x,"TableCellStyles")["$key?"](l["$[]"](4)): +q)&&(m=["style",p(x,"TableCellStyles")["$[]"](l["$[]"](4))],z(C,"[]=",a.to_a(m)),m[c(m.length,1)]);return[C,t]},Va.$$arity=-2);a.defs(l,"$parse_style_attribute",C=function(g,h){var k,q,l,t,C,m=b,n=b,v=b,r=b,u=b,w=b,y=b,F=b,E=b,B=b;null==h&&(h=b);if(d(d(k=d(q=m=g["$[]"](1))?m["$include?"](" ")["$!"]():q)?p(x,"Compliance").$shorthand_property_syntax():k)){k=["style",[],f([],{})];n=k[0];v=k[1];r=k[2];k;u=z(this,"lambda",[],(l=function(){var g=l.$$s||this,k,q=b,t=b;if(d(v["$empty?"]()))return n["$=="]("style")? +b:d(h)?g.$logger().$warn(g.$message_with_context("invalid empty "+n+" detected in style attribute",f(["source_location"],{source_location:h.$cursor_at_prev_line()}))):g.$logger().$warn("invalid empty "+n+" detected in style attribute");q=n;if("role"["$==="](q)||"option"["$==="](q))(d(k=r["$[]"](n))?k:(t=[n,[]],z(r,"[]=",a.to_a(t)),t[c(t.length,1)]))["$<<"](v.$join());else"id"["$==="](q)&&d(r["$key?"]("id"))&&(d(h)?g.$logger().$warn(g.$message_with_context("multiple ids detected in style attribute", +f(["source_location"],{source_location:h.$cursor_at_prev_line()}))):g.$logger().$warn("multiple ids detected in style attribute")),t=[n,v.$join()],z(r,"[]=",a.to_a(t)),t[c(t.length,1)];return v=[]},l.$$s=this,l.$$arity=0,l));z(m,"each_char",[],(t=function(a){var c,e,f=b;null==a&&(a=b);return d(d(c=d(e=a["$=="]("."))?e:a["$=="]("#"))?c:a["$=="]("%"))?(u.$call(),f=a,"."["$==="](f)?n="role":"#"["$==="](f)?n="id":"%"["$==="](f)?n="option":b):v["$<<"](a)},t.$$s=this,t.$$arity=1,t));if(n["$=="]("style"))return w= +["style",m],z(g,"[]=",a.to_a(w)),w[c(w.length,1)];u.$call();d(r["$key?"]("style"))&&(y=(w=["style",r["$[]"]("style")],z(g,"[]=",a.to_a(w)),w[c(w.length,1)]));d(r["$key?"]("id"))&&(w=["id",r["$[]"]("id")],z(g,"[]=",a.to_a(w)),w[c(w.length,1)]);d(r["$key?"]("role"))&&(w=["role",d((F=g["$[]"]("role"))["$nil_or_empty?"]())?r["$[]"]("role").$join(" "):""+F+" "+r["$[]"]("role").$join(" ")],z(g,"[]=",a.to_a(w)),w[c(w.length,1)]);d(r["$key?"]("option"))&&(z(E=r["$[]"]("option"),"each",[],(C=function(d){null== +d&&(d=b);w=[""+d+"-option",""];z(g,"[]=",a.to_a(w));return w[c(w.length,1)]},C.$$s=this,C.$$arity=1,C)),w=["options",d((B=g["$[]"]("options"))["$nil_or_empty?"]())?E.$join(","):""+B+","+E.$join(",")],z(g,"[]=",a.to_a(w)),w[c(w.length,1)]);return y}w=["style",m];z(g,"[]=",a.to_a(w));return w[c(w.length,1)]},C.$$arity=-2);a.defs(l,"$adjust_indentation!",W=function(f,l,t){var C,m,n,v,r,u,y=this,F=b,E=b,B=b;null==l&&(l=0);null==t&&(t=0);if(d(f["$empty?"]()))return b;d(d(C=q(t=t.$to_i(),0))?f.$join()["$include?"](p(x, +"TAB")):C)&&(F=g(" ",t),z(f,"map!",[],(m=function(a){var f=m.$$s||this,q,l,C=b;null==a&&(a=b);if(d(a["$empty?"]()))return a;d(a["$start_with?"](p(x,"TAB")))&&(a=z(a,"sub",[p(x,"TabIndentRx")],(q=function(){var a;return g(F,((a=w["~"])===b?b:a["$[]"](0)).$length())},q.$$s=f,q.$$arity=0,q)));return d(a["$include?"](p(x,"TAB")))?(C=0,a=z(a,"gsub",[p(x,"TabRx")],(l=function(){var a=b,d=b;null==w["~"]&&(w["~"]=b);if((a=h(w["~"].$begin(0),C))["$%"](t)["$=="](0))return C=h(C,c(t,1)),F;(d=c(t,a["$%"](t)))["$=="](1)|| +(C=h(C,c(d,1)));return g(" ",d)},l.$$s=f,l.$$arity=0,l))):a},m.$$s=y,m.$$arity=1,m)));if(!d(d(C=l)?q(l=l.$to_i(),-1):C))return b;E=b;(function(){var g=a.new_brk();try{return z(f,"each",[],(n=function(f){var h,k=b;null==f&&(f=b);if(d(f["$empty?"]()))return b;if((k=c(f.$length(),f.$lstrip().$length()))["$=="](0))E=b,a.brk(b,g);else return d(d(h=E)?q(k,E):h)?b:E=k},n.$$s=y,n.$$brk=g,n.$$arity=1,n))}catch(h){if(h===g)return h.$v;throw h;}})();l["$=="](0)?d(E)&&z(f,"map!",[],(v=function(a){null==a&&(a= +b);return d(a["$empty?"]())?a:a.$slice(E,a.$length())},v.$$s=y,v.$$arity=1,v)):(B=g(" ",l),d(E)?z(f,"map!",[],(r=function(a){null==a&&(a=b);return d(a["$empty?"]())?a:h(B,a.$slice(E,a.$length()))},r.$$s=y,r.$$arity=1,r)):z(f,"map!",[],(u=function(a){null==a&&(a=b);return d(a["$empty?"]())?a:h(B,a)},u.$$s=y,u.$$arity=1,u)));return b},W.$$arity=-2);return(a.defs(l,"$sanitize_attribute_name",Ja=function(a){return a.$gsub(p(x,"InvalidAttributeNameCharsRx"),"").$downcase()},Ja.$$arity=1),b)&&"sanitize_attribute_name"})(B[0], +null,B)}(l[0],l)};Opal.modules["asciidoctor/path_resolver"]=function(a){function c(a,b){return"number"===typeof a&&"number"===typeof b?a+b:a["$+"](b)}var h=[],q=a.nil,l=a.const_get_qualified,g=a.const_get_relative,m=a.module,b=a.klass,n=a.truthy,p=a.hash2,r=a.send;a.add_stubs("$include $attr_accessor $root? $posixify $expand_path $pwd $start_with? $== $match? $absolute_path? $+ $length $descends_from? $slice $to_s $relative_path_from $new $include? $tr $partition_path $each $pop $<< $join_path $[] $web_root? $unc? $index $split $delete $[]= $- $join $raise $! $fetch $warn $logger $empty? $nil_or_empty? $chomp $!= $> $size $end_with? $uri_prefix $gsub".split(" ")); +return function(h,k){function d(){}var f=[d=m(h,"Asciidoctor",d)].concat(k);(function(d,$super,f){function h(){}d=h=b(d,$super,"PathResolver",h);var k=d.prototype,m=[d].concat(f),u,w,z,x,t,y,B,A,D,S,Y,U,H;k.file_separator=k._partition_path_web=k._partition_path_sys=k.working_dir=q;d.$include(g(m,"Logging"));a.const_set(m[0],"DOT",".");a.const_set(m[0],"DOT_DOT","..");a.const_set(m[0],"DOT_SLASH","./");a.const_set(m[0],"SLASH","/");a.const_set(m[0],"BACKSLASH","\\");a.const_set(m[0],"DOUBLE_SLASH", +"//");a.const_set(m[0],"WindowsRootRx",/^(?:[a-zA-Z]:)?[\\\/]/);d.$attr_accessor("file_separator");d.$attr_accessor("working_dir");a.def(d,"$initialize",u=function(a,b){var c,d;null==a&&(a=q);null==b&&(b=q);this.file_separator=n(c=n(d=a)?d:l(l("::","File"),"ALT_SEPARATOR"))?c:l(l("::","File"),"SEPARATOR");this.working_dir=n(b)?n(this["$root?"](b))?this.$posixify(b):l("::","File").$expand_path(b):l("::","Dir").$pwd();this._partition_path_sys=p([],{});return this._partition_path_web=p([],{})},u.$$arity= +-1);a.def(d,"$absolute_path?",w=function(a){var b;return n(b=a["$start_with?"](g(m,"SLASH")))?b:this.file_separator["$=="](g(m,"BACKSLASH"))?g(m,"WindowsRootRx")["$match?"](a):this.file_separator["$=="](g(m,"BACKSLASH"))},w.$$arity=1);n(g(m,"RUBY_ENGINE")["$=="]("opal")?l("::","JAVASCRIPT_IO_MODULE")["$=="]("xmlhttprequest"):g(m,"RUBY_ENGINE")["$=="]("opal"))?a.def(d,"$root?",z=function(a){var b;return n(b=this["$absolute_path?"](a))?b:a["$start_with?"]("file://","http://","https://")},z.$$arity= +1):a.alias(d,"root?","absolute_path?");a.def(d,"$unc?",x=function(a){return a["$start_with?"](g(m,"DOUBLE_SLASH"))},x.$$arity=1);a.def(d,"$web_root?",t=function(a){return a["$start_with?"](g(m,"SLASH"))},t.$$arity=1);a.def(d,"$descends_from?",y=function(a,b){var d;return b["$=="](a)?0:b["$=="](g(m,"SLASH"))?n(d=a["$start_with?"](g(m,"SLASH")))?1:d:n(d=a["$start_with?"](c(b,g(m,"SLASH"))))?c(b.$length(),1):d},y.$$arity=2);a.def(d,"$relative_path",B=function(a,b){var c=q;return n(this["$root?"](a))? +n(c=this["$descends_from?"](a,b))?a.$slice(c,a.$length()):g(m,"Pathname").$new(a).$relative_path_from(g(m,"Pathname").$new(b)).$to_s():a},B.$$arity=2);a.def(d,"$posixify",A=function(a){return n(a)?n(this.file_separator["$=="](g(m,"BACKSLASH"))?a["$include?"](g(m,"BACKSLASH")):this.file_separator["$=="](g(m,"BACKSLASH")))?a.$tr(g(m,"BACKSLASH"),g(m,"SLASH")):a:""},A.$$arity=1);a.alias(d,"posixfy","posixify");a.def(d,"$expand_path",D=function(b){var c,d,e,f=q,h=c=q;d=this.$partition_path(b);c=a.to_ary(d); +f=null==c[0]?q:c[0];c=null==c[1]?q:c[1];d;return n(b["$include?"](g(m,"DOT_DOT")))?(h=[],r(f,"each",[],(e=function(a){null==a&&(a=q);return a["$=="](g(m,"DOT_DOT"))?h.$pop():h["$<<"](a)},e.$$s=this,e.$$arity=1,e)),this.$join_path(h,c)):this.$join_path(f,c)},D.$$arity=1);a.def(d,"$partition_path",S=function(b,d){var f=q,h=q,k=f=q,f=f=q;null==d&&(d=q);if(n(f=(h=n(d)?this._partition_path_web:this._partition_path_sys)["$[]"](b)))return f;f=this.$posixify(b);n(d)?n(this["$web_root?"](f))?k=g(m,"SLASH"): +n(f["$start_with?"](g(m,"DOT_SLASH")))&&(k=g(m,"DOT_SLASH")):n(this["$root?"](f))?k=n(this["$unc?"](f))?g(m,"DOUBLE_SLASH"):n(f["$start_with?"](g(m,"SLASH")))?g(m,"SLASH"):f.$slice(0,c(f.$index(g(m,"SLASH")),1)):n(f["$start_with?"](g(m,"DOT_SLASH")))&&(k=g(m,"DOT_SLASH"));f=(n(k)?f.$slice(k.$length(),f.$length()):f).$split(g(m,"SLASH"));f.$delete(g(m,"DOT"));f=[b,[f,k]];r(h,"[]=",a.to_a(f));h=f;k=f.length;k="number"===typeof k?k-1:k["$-"](1);return h[k]},S.$$arity=-2);a.def(d,"$join_path",Y=function(a, +b){null==b&&(b=q);return n(b)?""+b+a.$join(g(m,"SLASH")):a.$join(g(m,"SLASH"))},Y.$$arity=-2);a.def(d,"$system_path",U=function(b,d,f,h){var k,t,u,w,z=q,x=q,y=q,E=q,B=z=q,A=q,D=q,L=B=q;null==d&&(d=q);null==f&&(f=q);null==h&&(h=p([],{}));n(f)&&(n(this["$root?"](f))||this.$raise(l("::","SecurityError"),"Jail is not an absolute path: "+f),f=this.$posixify(f));if(n(b)){if(n(this["$root?"](b))){z=this.$expand_path(b);if(n(n(k=f)?this["$descends_from?"](z,f)["$!"]():k)){if(n(h.$fetch("recover",!0)))return this.$logger().$warn(""+ +(n(k=h["$[]"]("target_name"))?k:"path")+" is outside of jail; recovering automatically"),t=this.$partition_path(z),k=a.to_ary(t),x=null==k[0]?q:k[0],t,t=this.$partition_path(f),k=a.to_ary(t),y=null==k[0]?q:k[0],E=null==k[1]?q:k[1],t,this.$join_path(c(y,x),E);this.$raise(l("::","SecurityError"),""+(n(k=h["$[]"]("target_name"))?k:"path")+" "+b+" is outside of jail: "+f+" (disallowed in safe mode)")}return z}t=this.$partition_path(b);k=a.to_ary(t);x=null==k[0]?q:k[0];t}else x=[];if(n(x["$empty?"]())){if(n(d["$nil_or_empty?"]()))return n(k= +f)?k:this.working_dir;if(n(this["$root?"](d)))if(n(f))d=this.$posixify(d);else return this.$expand_path(d);else t=this.$partition_path(d),k=a.to_ary(t),x=null==k[0]?q:k[0],t,d=n(k=f)?k:this.working_dir}else n(d["$nil_or_empty?"]())?d=n(k=f)?k:this.working_dir:n(this["$root?"](d))?n(f)&&(d=this.$posixify(d)):d=""+(n(k=f)?k:this.working_dir).$chomp("/")+"/"+d;n(n(k=n(t=f)?z=this["$descends_from?"](d,f)["$!"]():t)?this.file_separator["$=="](g(m,"BACKSLASH")):k)?(t=this.$partition_path(d),k=a.to_ary(t), +B=null==k[0]?q:k[0],A=null==k[1]?q:k[1],t,t=this.$partition_path(f),k=a.to_ary(t),y=null==k[0]?q:k[0],E=null==k[1]?q:k[1],t,n(A["$!="](E))&&(n(h.$fetch("recover",!0))?(this.$logger().$warn("start path for "+(n(k=h["$[]"]("target_name"))?k:"path")+" is outside of jail root; recovering automatically"),B=y,z=!1):this.$raise(l("::","SecurityError"),"start path for "+(n(k=h["$[]"]("target_name"))?k:"path")+" "+d+" refers to location outside jail root: "+f+" (disallowed in safe mode)"))):(t=this.$partition_path(d), +k=a.to_ary(t),B=null==k[0]?q:k[0],E=null==k[1]?q:k[1],t);n((D=c(B,x))["$include?"](g(m,"DOT_DOT")))&&(k=[D,[]],B=k[0],D=k[1],k,n(f)?(n(y)||(t=this.$partition_path(f),k=a.to_ary(t),y=null==k[0]?q:k[0],t),L=!1,r(B,"each",[],(u=function(a){var c=u.$$s||this,d;null==a&&(a=q);if(a["$=="](g(m,"DOT_DOT"))){a=D.$size();var e=y.$size();a="number"===typeof a&&"number"===typeof e?a>e:a["$>"](e);if(n(a))return D.$pop();if(n(h.$fetch("recover",!0))){if(n(L))return q;c.$logger().$warn(""+(n(d=h["$[]"]("target_name"))? +d:"path")+" has illegal reference to ancestor of jail; recovering automatically");return L=!0}return c.$raise(l("::","SecurityError"),""+(n(d=h["$[]"]("target_name"))?d:"path")+" "+b+" refers to location outside jail: "+f+" (disallowed in safe mode)")}return D["$<<"](a)},u.$$s=this,u.$$arity=1,u))):r(B,"each",[],(w=function(a){null==a&&(a=q);return a["$=="](g(m,"DOT_DOT"))?D.$pop():D["$<<"](a)},w.$$s=this,w.$$arity=1,w)));return n(z)?(z=this.$join_path(D,E),n(this["$descends_from?"](z,f))?z:n(h.$fetch("recover", +!0))?(this.$logger().$warn(""+(n(k=h["$[]"]("target_name"))?k:"path")+" is outside of jail; recovering automatically"),n(y)||(t=this.$partition_path(f),k=a.to_ary(t),y=null==k[0]?q:k[0],t),this.$join_path(c(y,x),E)):this.$raise(l("::","SecurityError"),""+(n(k=h["$[]"]("target_name"))?k:"path")+" "+b+" is outside of jail: "+f+" (disallowed in safe mode)")):this.$join_path(D,E)},U.$$arity=-2);return(a.def(d,"$web_path",H=function(b,c){var d,e,f,h=q,k=q,l=q,t=q,p=q;null==c&&(c=q);b=this.$posixify(b); +c=this.$posixify(c);h=q;n(n(d=c["$nil_or_empty?"]())?d:this["$web_root?"](b))||(b=n(c["$end_with?"](g(m,"SLASH")))?""+c+b:""+c+g(m,"SLASH")+b,n(h=g(m,"Helpers").$uri_prefix(b))&&(b=b["$[]"](a.Range.$new(h.$length(),-1,!1))));e=this.$partition_path(b,!0);d=a.to_ary(e);k=null==d[0]?q:d[0];l=null==d[1]?q:d[1];e;t=[];r(k,"each",[],(f=function(a){var b;null==a&&(a=q);return a["$=="](g(m,"DOT_DOT"))?n(t["$empty?"]())?n(n(b=l)?l["$!="](g(m,"DOT_SLASH")):b)?q:t["$<<"](a):t["$[]"](-1)["$=="](g(m,"DOT_DOT"))? +t["$<<"](a):t.$pop():t["$<<"](a)},f.$$s=this,f.$$arity=1,f));n((p=this.$join_path(t,l))["$include?"](" "))&&(p=p.$gsub(" ","%20"));return n(h)?""+h+p:p},H.$$arity=-2),q)&&"web_path"})(f[0],null,f)}(h[0],h)};Opal.modules["asciidoctor/reader"]=function(a){function c(a,b){return"number"===typeof a&&"number"===typeof b?a+b:a["$+"](b)}function h(a,b){return"number"===typeof a&&"number"===typeof b?a>b:a["$>"](b)}function q(a,b){return"number"===typeof a&&"number"===typeof b?a-b:a["$-"](b)}function l(a, +b){return"number"===typeof a&&"number"===typeof b?a=b:a["$>="](b)}var m=[],b=a.nil,n=a.const_get_qualified,p=a.const_get_relative,r=a.module,u=a.klass,w=a.hash2,d=a.truthy,f=a.send,x=a.gvars,y=a.hash;a.add_stubs("$include $attr_reader $+ $attr_accessor $! $=== $split $file $dir $dirname $path $basename $lineno $prepare_lines $drop $[] $normalize_lines_from_string $normalize_lines_array $empty? $nil_or_empty? $peek_line $> $slice $length $process_line $times $shift $read_line $<< $- $unshift_all $has_more_lines? $join $read_lines $unshift $start_with? $== $* $read_lines_until $size $clear $cursor $[]= $!= $fetch $cursor_at_mark $warn $logger $message_with_context $new $each $instance_variables $instance_variable_get $dup $instance_variable_set $to_i $attributes $< $catalog $skip_front_matter! $pop $adjust_indentation! $attr $end_with? $include? $=~ $preprocess_conditional_directive $preprocess_include_directive $pop_include $downcase $error $none? $key? $any? $all? $strip $resolve_expr_val $send $to_sym $replace_next_line $rstrip $sub_attributes $attribute_missing $include_processors? $find $handles? $instance $process_method $parse_attributes $>= $safe $resolve_include_path $split_delimited_value $/ $to_a $uniq $sort $open $each_line $infinite? $push_include $delete $value? $force_encoding $create_include_cursor $rindex $delete_at $nil? $keys $read $uriish? $attr? $require_library $parse $normalize_system_path $file? $relative_path $path_resolver $base_dir $to_s $path= $extname $rootname $<= $to_f $extensions? $extensions $include_processors $class $object_id $inspect $map".split(" ")); +return function(m,E){function B(){}var A=[B=r(m,"Asciidoctor",B)].concat(E);(function(g,$super,l){function m(){}g=m=u(g,$super,"Reader",m);var t=g.prototype,v=[g].concat(l),r,x,y,E,B,A,D,N,K,J,H,G,M,Z,ha,aa,ba,ma,sa,da,ea,R,Ea,Aa,Ba,wa,oa,Fa,Q,ja,xa,ta,ya,Ca,Ga,Ha;t.file=t.lines=t.process_lines=t.look_ahead=t.unescape_next_line=t.lineno=t.dir=t.path=t.mark=t.source_lines=t.saved=b;g.$include(p(v,"Logging"));(function(d,$super,f){function g(){}d=g=u(d,$super,"Cursor",g);var h=d.prototype;[d].concat(f); +var k,q,l;h.lineno=h.path=b;d.$attr_reader("file","dir","path","lineno");a.def(d,"$initialize",k=function(a,c,d,e){var f;null==c&&(c=b);null==d&&(d=b);null==e&&(e=1);return f=[a,c,d,e],this.file=f[0],this.dir=f[1],this.path=f[2],this.lineno=f[3],f},k.$$arity=-2);a.def(d,"$advance",q=function(a){return this.lineno=c(this.lineno,a)},q.$$arity=1);a.def(d,"$line_info",l=function(){return""+this.path+": line "+this.lineno},l.$$arity=0);return a.alias(d,"to_s","line_info")})(v[0],null,v);g.$attr_reader("file"); +g.$attr_reader("dir");g.$attr_reader("path");g.$attr_reader("lineno");g.$attr_reader("source_lines");g.$attr_accessor("process_lines");g.$attr_accessor("unterminated");a.def(g,"$initialize",r=function(c,e,f){var g;null==c&&(c=b);null==e&&(e=b);null==f&&(f=w([],{}));d(e["$!"]())?(this.file=b,this.dir=".",this.path="",this.lineno=1):d(n("::","String")["$==="](e))?(this.file=e,e=n("::","File").$split(this.file),g=a.to_ary(e),this.dir=null==g[0]?b:g[0],this.path=null==g[1]?b:g[1],e,this.lineno= +1):(d(this.file=e.$file())?(this.dir=d(g=e.$dir())?g:n("::","File").$dirname(this.file),this.path=d(g=e.$path())?g:n("::","File").$basename(this.file)):(this.dir=d(g=e.$dir())?g:".",this.path=d(g=e.$path())?g:""),this.lineno=d(g=e.$lineno())?g:1);this.lines=d(c)?this.$prepare_lines(c,f):[];this.source_lines=this.lines.$drop(0);this.mark=b;this.look_ahead=0;this.process_lines=!0;this.unescape_next_line=!1;return this.saved=this.unterminated=b},r.$$arity=-1);a.def(g,"$prepare_lines",x=function(a, +b){null==b&&(b=w([],{}));return d(n("::","String")["$==="](a))?d(b["$[]"]("normalize"))?p(v,"Helpers").$normalize_lines_from_string(a):a.$split(p(v,"LF"),-1):d(b["$[]"]("normalize"))?p(v,"Helpers").$normalize_lines_array(a):a.$drop(0)},x.$$arity=-2);a.def(g,"$process_line",y=function(a){d(this.process_lines)&&(this.look_ahead=c(this.look_ahead,1));return a},y.$$arity=1);a.def(g,"$has_more_lines?",E=function(){return d(this.lines["$empty?"]())?(this.look_ahead=0,!1):!0},E.$$arity=0);a.def(g,"$empty?", +B=function(){return d(this.lines["$empty?"]())?(this.look_ahead=0,!0):!1},B.$$arity=0);a.alias(g,"eof?","empty?");a.def(g,"$next_line_empty?",A=function(){return this.$peek_line()["$nil_or_empty?"]()},A.$$arity=0);a.def(g,"$peek_line",D=function(a){var c,e=b;null==a&&(a=!1);return d(d(c=a)?c:h(this.look_ahead,0))?d(this.unescape_next_line)?(e=this.lines["$[]"](0)).$slice(1,e.$length()):this.lines["$[]"](0):d(this.lines["$empty?"]())?(this.look_ahead=0,b):d(e=this.$process_line(this.lines["$[]"](0)))? +e:this.$peek_line()},D.$$arity=-1);a.def(g,"$peek_lines",N=function(c,e){var g,h,k=this,l=b,t=b;null==c&&(c=b);null==e&&(e=!1);l=k.look_ahead;t=[];(function(){var l=a.new_brk();try{return f(d(g=c)?g:p(v,"MAX_INT"),"times",[],(h=function(){var c=h.$$s||this,f=b;null==c.lineno&&(c.lineno=b);if(d(f=d(e)?c.$shift():c.$read_line()))return t["$<<"](f);d(e)&&(c.lineno=q(c.lineno,1));a.brk(b,l)},h.$$s=k,h.$$brk=l,h.$$arity=0,h))}catch(n){if(n===l)return n.$v;throw n;}})();d(t["$empty?"]())||(k.$unshift_all(t), +d(e)&&(k.look_ahead=l));return t},N.$$arity=-1);a.def(g,"$read_line",K=function(){var a;return d(d(a=h(this.look_ahead,0))?a:this["$has_more_lines?"]())?this.$shift():b},K.$$arity=0);a.def(g,"$read_lines",J=function(){for(var a=b,a=[];d(this["$has_more_lines?"]());)a["$<<"](this.$shift());return a},J.$$arity=0);a.alias(g,"readlines","read_lines");a.def(g,"$read",H=function(){return this.$read_lines().$join(p(v,"LF"))},H.$$arity=0);a.def(g,"$advance",G=function(){return d(this.$shift())?!0:!1},G.$$arity= +0);a.def(g,"$unshift_line",M=function(a){this.$unshift(a);return b},M.$$arity=1);a.alias(g,"restore_line","unshift_line");a.def(g,"$unshift_lines",Z=function(a){this.$unshift_all(a);return b},Z.$$arity=1);a.alias(g,"restore_lines","unshift_lines");a.def(g,"$replace_next_line",ha=function(a){this.$shift();this.$unshift(a);return!0},ha.$$arity=1);a.alias(g,"replace_line","replace_next_line");a.def(g,"$skip_blank_lines",aa=function(){var a=b,f=b;if(d(this["$empty?"]()))return b;for(a=0;d(f=this.$peek_line());)if(d(f["$empty?"]()))this.$shift(), +a=c(a,1);else return a},aa.$$arity=0);a.def(g,"$skip_comment_lines",ba=function(){var a,c=b,e=b;if(d(this["$empty?"]()))return b;for(;d(d(a=c=this.$peek_line())?c["$empty?"]()["$!"]():a);)if(d(c["$start_with?"]("//")))if(d(c["$start_with?"]("///")))if(d(d(a=h(e=c.$length(),3))?c["$=="]("/"["$*"](e)):a))this.$read_lines_until(w(["terminator","skip_first_line","read_last_line","skip_processing","context"],{terminator:c,skip_first_line:!0,read_last_line:!0,skip_processing:!0,context:"comment"}));else break; +else this.$shift();else break;return b},ba.$$arity=0);a.def(g,"$skip_line_comments",ma=function(){var a,c=b,e=b;if(d(this["$empty?"]()))return[];for(c=[];d(d(a=e=this.$peek_line())?e["$empty?"]()["$!"]():a);)if(d(e["$start_with?"]("//")))c["$<<"](this.$shift());else break;return c},ma.$$arity=0);a.def(g,"$terminate",sa=function(){this.lineno=c(this.lineno,this.lines.$size());this.lines.$clear();this.look_ahead=0;return b},sa.$$arity=0);a.def(g,"$read_lines_until",da=function(c){var e,g,h,k,l=da.$$p, +t=l||b,n=b,m=b,r=b,u=b,x=b,y=b,E=b,F=b,B=b,A=b,J=b,K=b,D=b;l&&(da.$$p=null);null==c&&(c=w([],{}));n=[];d(d(e=this.process_lines)?c["$[]"]("skip_processing"):e)&&(this.process_lines=!1,m=!0);d(r=c["$[]"]("terminator"))?(u=d(e=c["$[]"]("cursor"))?e:this.$cursor(),y=x=!1):(x=c["$[]"]("break_on_blank_lines"),y=c["$[]"]("break_on_list_continuation"));E=c["$[]"]("skip_line_comments");F=B=A=b;for(d(c["$[]"]("skip_first_line"))&&this.$shift();d(d(g=F["$!"]())?J=this.$read_line():g);)F=function(){for(;d(!0);)return d(d(h= +r)?J["$=="](r):h)||d(d(h=x)?J["$empty?"]():h)?!0:d(d(h=d(k=y)?B:k)?J["$=="](p(v,"LIST_CONTINUATION")):h)?(K=["preserve_last_line",!0],f(c,"[]=",a.to_a(K)),K[q(K.length,1)],!0):d((h=t!==b)?a.yield1(t,J):t!==b)?!0:!1;return b}(),d(F)?(d(c["$[]"]("read_last_line"))&&(n["$<<"](J),B=!0),d(c["$[]"]("preserve_last_line"))&&(this.$unshift(J),A=!0)):d(d(g=d(h=E)?J["$start_with?"]("//"):h)?J["$start_with?"]("///")["$!"]():g)||(n["$<<"](J),B=!0);d(m)&&(this.process_lines=!0,d(d(e=A)?r["$!"]():e)&&(this.look_ahead= +q(this.look_ahead,1)));d(d(e=d(g=r)?r["$!="](J):g)?D=c.$fetch("context",r):e)&&(u["$=="]("at_mark")&&(u=this.$cursor_at_mark()),this.$logger().$warn(this.$message_with_context("unterminated "+D+" block",w(["source_location"],{source_location:u}))),this.unterminated=!0);return n},da.$$arity=-1);a.def(g,"$shift",ea=function(){this.lineno=c(this.lineno,1);this.look_ahead["$=="](0)||(this.look_ahead=q(this.look_ahead,1));return this.lines.$shift()},ea.$$arity=0);a.def(g,"$unshift",R=function(a){this.lineno= +q(this.lineno,1);this.look_ahead=c(this.look_ahead,1);return this.lines.$unshift(a)},R.$$arity=1);a.def(g,"$unshift_all",Ea=function(b){this.lineno=q(this.lineno,b.$size());this.look_ahead=c(this.look_ahead,b.$size());return f(this.lines,"unshift",a.to_a(b))},Ea.$$arity=1);a.def(g,"$cursor",Aa=function(){return p(v,"Cursor").$new(this.file,this.dir,this.path,this.lineno)},Aa.$$arity=0);a.def(g,"$cursor_at_line",Ba=function(a){return p(v,"Cursor").$new(this.file,this.dir,this.path,a)},Ba.$$arity=1); +a.def(g,"$cursor_at_mark",wa=function(){return d(this.mark)?f(p(v,"Cursor"),"new",a.to_a(this.mark)):this.$cursor()},wa.$$arity=0);a.def(g,"$cursor_before_mark",oa=function(){var c,e,f=b,g=b,h=b;c=b;return d(this.mark)?(e=this.mark,c=a.to_ary(e),f=null==c[0]?b:c[0],g=null==c[1]?b:c[1],h=null==c[2]?b:c[2],c=null==c[3]?b:c[3],e,p(v,"Cursor").$new(f,g,h,q(c,1))):p(v,"Cursor").$new(this.file,this.dir,this.path,q(this.lineno,1))},oa.$$arity=0);a.def(g,"$cursor_at_prev_line",Fa=function(){return p(v,"Cursor").$new(this.file, +this.dir,this.path,q(this.lineno,1))},Fa.$$arity=0);a.def(g,"$mark",Q=function(){return this.mark=[this.file,this.dir,this.path,this.lineno]},Q.$$arity=0);a.def(g,"$line_info",ja=function(){return""+this.path+": line "+this.lineno},ja.$$arity=0);a.def(g,"$lines",xa=function(){return this.lines.$drop(0)},xa.$$arity=0);a.def(g,"$string",ta=function(){return this.lines.$join(p(v,"LF"))},ta.$$arity=0);a.def(g,"$source",ya=function(){return this.source_lines.$join(p(v,"LF"))},ya.$$arity=0);a.def(g,"$save", +Ca=function(){var c,e=b,e=w([],{});f(this.$instance_variables(),"each",[],(c=function(g){var h=c.$$s||this,k,l=b,t=b;null==g&&(g=b);if(d(d(k=g["$=="]("@saved"))?k:g["$=="]("@source_lines")))return b;l=[g,d(n("::","Array")["$==="](t=h.$instance_variable_get(g)))?t.$dup():t];f(e,"[]=",a.to_a(l));return l[q(l.length,1)]},c.$$s=this,c.$$arity=1,c));this.saved=e;return b},Ca.$$arity=0);a.def(g,"$restore_save",Ga=function(){var a;return d(this.saved)?(f(this.saved,"each",[],(a=function(c,d){var e=a.$$s|| +this;null==c&&(c=b);null==d&&(d=b);return e.$instance_variable_set(c,d)},a.$$s=this,a.$$arity=2,a)),this.saved=b):b},Ga.$$arity=0);a.def(g,"$discard_save",Ha=function(){return this.saved=b},Ha.$$arity=0);return a.alias(g,"to_s","line_info")})(A[0],null,A);(function(m,$super,r){function E(){}m=E=u(m,$super,"PreprocessorReader",E);var t=m.prototype,B=[m].concat(r),A,D,N,S,Y,U,H,V,K,J,M,G,Z,la,ha,aa,ba,ma,sa,da;t.document=t.lineno=t.process_lines=t.look_ahead=t.skipping=t.include_stack=t.conditional_stack= +t.path=t.include_processor_extensions=t.maxdepth=t.dir=t.lines=t.file=t.includes=t.unescape_next_line=b;m.$attr_reader("include_stack");a.def(m,"$initialize",A=function(c,e,g,h){var k=b;A.$$p&&(A.$$p=null);null==e&&(e=b);null==g&&(g=b);null==h&&(h=w([],{}));this.document=c;f(this,a.find_super_dispatcher(this,"initialize",A,!1),[e,g,h],null);k=c.$attributes().$fetch("max-include-depth",64).$to_i();d(l(k,0))&&(k=0);this.maxdepth=w(["abs","rel"],{abs:k,rel:k});this.include_stack=[];this.includes=c.$catalog()["$[]"]("includes"); +this.skipping=!1;this.conditional_stack=[];return this.include_processor_extensions=b},A.$$arity=-2);a.def(m,"$prepare_lines",D=function(g,h){var k,l,t=D.$$p,m=b,n=b,v=b,r=b,u=b,x=v=m=b;t&&(D.$$p=null);v=0;x=arguments.length;for(m=Array(x);v";this.lineno= +l;d(t["$key?"]("depth"))&&(v=t["$[]"]("depth").$to_i(),d("number"===typeof v?0>=v:v["$<="](0))&&(v=1),this.maxdepth=w(["abs","rel"],{abs:c(q(this.include_stack.$size(),1),v),rel:v}));if(d((this.lines=this.$prepare_lines(g,w(["normalize","condense","indent"],{normalize:!0,condense:!1,indent:t["$[]"]("indent")})))["$empty?"]()))this.$pop_include();else{if(d(t["$key?"]("leveloffset"))){this.lines.$unshift("");this.lines.$unshift(":leveloffset: "+t["$[]"]("leveloffset"));this.lines["$<<"]("");if(d(v= +this.document.$attr("leveloffset")))this.lines["$<<"](":leveloffset: "+v);else this.lines["$<<"](":leveloffset!:");this.lineno=q(this.lineno,2)}this.look_ahead=0}return this},J.$$arity=-2);a.def(m,"$create_include_cursor",M=function(a,c,e){var f=b;d(n("::","String")["$==="](a))?f=n("::","File").$dirname(a):d(n("::","RUBY_ENGINE_OPAL"))?f=n("::","File").$dirname(a=a.$to_s()):(f=(f=n("::","File").$dirname(a.$path()))["$=="]("")?"/":f,a=a.$to_s());return p(B,"Cursor").$new(a,f,c,e)},M.$$arity=3);a.def(m, +"$pop_include",G=function(){var c,e;d(h(this.include_stack.$size(),0))&&(e=this.include_stack.$pop(),c=a.to_ary(e),this.lines=null==c[0]?b:c[0],this.file=null==c[1]?b:c[1],this.dir=null==c[2]?b:c[2],this.path=null==c[3]?b:c[3],this.lineno=null==c[4]?b:c[4],this.maxdepth=null==c[5]?b:c[5],this.process_lines=null==c[6]?b:c[6],e,this.look_ahead=0);return b},G.$$arity=0);a.def(m,"$include_depth",Z=function(){return this.include_stack.$size()},Z.$$arity=0);a.def(m,"$exceeded_max_depth?",la=function(){var a, +c=b;return d(d(a=h(c=this.maxdepth["$[]"]("abs"),0))?g(this.include_stack.$size(),c):a)?this.maxdepth["$[]"]("rel"):!1},la.$$arity=0);a.def(m,"$shift",ha=function(){var c=ha.$$p,e=b,g=b,h=b,k=b;c&&(ha.$$p=null);h=0;k=arguments.length;for(g=Array(k);h"},da.$$arity=0),b)&&"to_s"})(A[0],p(A,"Reader"),A)}(m[0],m)};Opal.modules["asciidoctor/section"]=function(a){function c(a,b){return"number"===typeof a&&"number"===typeof b?a+b:a["$+"](b)}var h=[],q=a.nil,l=a.const_get_relative,g=a.module,m=a.klass,b=a.hash2, +n=a.send,p=a.truthy;a.add_stubs("$attr_accessor $attr_reader $=== $+ $level $special $generate_id $title $== $> $sectnum $int_to_roman $to_i $reftext $! $empty? $sprintf $sub_quotes $compat_mode $[] $attributes $context $assign_numeral $class $object_id $inspect $size $length $chr $[]= $- $gsub $downcase $delete $tr_s $end_with? $chop $start_with? $slice $key? $catalog $unique_id_start_index".split(" "));return function(h,k){function r(){}var d=[r=g(h,"Asciidoctor",r)].concat(k);(function(d,$super, +g){function h(){}d=h=m(d,$super,"Section",h);var k=d.prototype,r=[d].concat(g),u,w,x,z,y,t,A;k.document=k.level=k.numeral=k.parent=k.numbered=k.sectname=k.title=k.blocks=q;d.$attr_accessor("index");d.$attr_accessor("sectname");d.$attr_accessor("special");d.$attr_accessor("numbered");d.$attr_reader("caption");a.def(d,"$initialize",u=function(d,f,g,h){var k;u.$$p&&(u.$$p=null);null==d&&(d=q);null==f&&(f=q);null==g&&(g=!1);null==h&&(h=b([],{}));n(this,a.find_super_dispatcher(this,"initialize",u,!1), +[d,"section",h],null);d=p(l(r,"Section")["$==="](d))?[p(k=f)?k:c(d.$level(),1),d.$special()]:[p(k=f)?k:1,!1];this.level=d[0];this.special=d[1];d;this.numbered=g;return this.index=0},u.$$arity=-1);a.alias(d,"name","title");a.def(d,"$generate_id",w=function(){return l(r,"Section").$generate_id(this.$title(),this.document)},w.$$arity=0);a.def(d,"$sectnum",x=function(a,b){var c;null==a&&(a=".");null==b&&(b=q);b=p(c=b)?c:b["$=="](!1)?"":a;this.level["$=="](1)?c=""+this.numeral+b:(c=this.level,c="number"=== +typeof c?1"](1),c=p(c)?p(l(r,"Section")["$==="](this.parent))?""+this.parent.$sectnum(a,a)+this.numeral+b:""+this.numeral+b:""+l(r,"Helpers").$int_to_roman(this.numeral.$to_i())+b);return c},x.$$arity=-1);a.def(d,"$xreftext",z=function(a){var b,c=q,d=q,e=q,f=d=q;null==a&&(a=q);p(p(b=c=this.$reftext())?c["$empty?"]()["$!"]():b)?b=c:p(a)?(p(this.numbered)?(d=a,"full"["$==="](d)?(d=p(p(b=(e=this.sectname)["$=="]("chapter"))?b:e["$=="]("appendix"))?this.$sprintf(this.$sub_quotes("_%s_"),this.$title()): +this.$sprintf(this.$sub_quotes(p(this.document.$compat_mode())?"``%s''":'"`%s`"'),this.$title()),a=p(f=this.document.$attributes()["$[]"](""+e+"-refsig"))?""+f+" "+this.$sectnum(".",",")+" "+d:""+this.$sectnum(".",",")+" "+d):a="short"["$==="](d)?p(f=this.document.$attributes()["$[]"](""+this.sectname+"-refsig"))?""+f+" "+this.$sectnum(".",""):this.$sectnum(".",""):p(p(b=(e=this.sectname)["$=="]("chapter"))?b:e["$=="]("appendix"))?this.$sprintf(this.$sub_quotes("_%s_"),this.$title()):this.$title()): +a=p(p(b=(e=this.sectname)["$=="]("chapter"))?b:e["$=="]("appendix"))?this.$sprintf(this.$sub_quotes("_%s_"),this.$title()):this.$title(),b=a):b=this.$title();return b},z.$$arity=-1);a.def(d,"$<<",y=function(b){var c=y.$$p,d=q,e=q,f=q;c&&(y.$$p=null);e=0;f=arguments.length;for(d=Array(f);e"):n(this,a.find_super_dispatcher(this,"to_s",t,!1),c,b)},t.$$arity=0);return(a.defs(d,"$generate_id",A=function(b,d){var f,g,h=q,k=q,t=q,m=q,u=g=q,w=g=k=h=q,h=d.$attributes(),k=p(f=h["$[]"]("idprefix"))?f:"_";p(t= +h["$[]"]("idseparator"))?(p(f=t.$length()["$=="](1))?h=f:p(g=(m=t["$empty?"]())["$!"]())?(g=["idseparator",t.$chr()],n(h,"[]=",a.to_a(g)),t=g,h=g.length,h="number"===typeof h?h-1:h["$-"](1),h=t=t[h]):h=g,p(h)&&(u=p(p(f=t["$=="]("-"))?f:t["$=="]("."))?" .-":" "+t+".-")):(f=["_"," _.-"],t=f[0],u=f[1],f);h=""+k+b.$downcase().$gsub(l(r,"InvalidSectionIdCharsRx"),"");p(m)?h=h.$delete(" "):(h=h.$tr_s(u,t),p(h["$end_with?"](t))&&(h=h.$chop()),p(p(f=k["$empty?"]())?h["$start_with?"](t):f)&&(h=h.$slice(1, +h.$length())));if(p(d.$catalog()["$[]"]("ids")["$key?"](h))){f=[d.$catalog()["$[]"]("ids"),l(r,"Compliance").$unique_id_start_index()];k=f[0];g=f[1];for(f;p(k["$key?"](w=""+h+t+g));)g=c(g,1);return w}return h},A.$$arity=2),q)&&"generate_id"})(d[0],l(d,"AbstractBlock"),d)}(h[0],h)};Opal.modules["asciidoctor/stylesheets"]=function(a){var c=[],h=a.nil,q=a.const_get_qualified,l=a.const_get_relative,g=a.module,m=a.klass,b=a.truthy,n=a.hash2,p=a.gvars,r=a.send;a.add_stubs("$join $new $rstrip $read $primary_stylesheet_data $write $primary_stylesheet_name $coderay_stylesheet_data $coderay_stylesheet_name $load_pygments $=~ $css $[] $sub $[]= $- $pygments_stylesheet_data $pygments_stylesheet_name $! $nil? $require_library".split(" ")); +return function(c,e){function d(){}var f=[d=g(c,"Asciidoctor",d)].concat(e);(function(c,$super,d){function e(){}var f=e=m(c,$super,"Stylesheets",e);c=f.prototype;var g=[f].concat(d),u,w,x,y,t,z,A,D,H,S,M,U,fa,V,K;c.primary_stylesheet_data=c.coderay_stylesheet_data=c.pygments_stylesheet_data=h;a.const_set(g[0],"DEFAULT_STYLESHEET_NAME","asciidoctor.css");a.const_set(g[0],"DEFAULT_PYGMENTS_STYLE","default");a.const_set(g[0],"STYLESHEETS_DATA_PATH",q("::","File").$join(l(g,"DATA_PATH"),"stylesheets")); +a.const_set(g[0],"PygmentsBgColorRx",/^\.pygments +\{ *background: *([^;]+);/);f.__instance__=f.$new();a.defs(f,"$instance",u=function(){null==this.__instance__&&(this.__instance__=h);return this.__instance__},u.$$arity=0);a.def(f,"$primary_stylesheet_name",w=function(){return l(g,"DEFAULT_STYLESHEET_NAME")},w.$$arity=0);a.def(f,"$primary_stylesheet_data",x=function(){var b=a.const_get_relative([],"File"),c;c=a.const_get_relative([],"JAVASCRIPT_PLATFORM")["$=="]("node")?"node"===b.$basename(__dirname)&& +"dist"===b.$basename(b.$dirname(__dirname))?b.$join(b.$dirname(__dirname),"css"):b.$join(__dirname,"css"):a.const_get_relative([],"JAVASCRIPT_ENGINE")["$=="]("nashorn")?"nashorn"===b.$basename(__DIR__)&&"dist"===b.$basename(b.$dirname(__DIR__))?b.$join(b.$dirname(__DIR__),"css"):b.$join(__DIR__,"css"):"css";return!1!==($a=f.primary_stylesheet_data)&&$a!==h&&null!=$a?$a:f.primary_stylesheet_data=a.const_get_relative([],"IO").$read(b.$join(c,"asciidoctor.css")).$chomp()},x.$$arity=0);a.def(f,"$embed_primary_stylesheet", +y=function(){return""},y.$$arity=0);a.def(f,"$write_primary_stylesheet",t=function(a){null==a&&(a=".");return q("::","IO").$write(q("::","File").$join(a,this.$primary_stylesheet_name()),this.$primary_stylesheet_data())},t.$$arity=-1);a.def(f,"$coderay_stylesheet_name",z=function(){return"coderay-asciidoctor.css"},z.$$arity=0);a.def(f,"$coderay_stylesheet_data",A=function(){var a;return this.coderay_stylesheet_data=b(a=this.coderay_stylesheet_data)? +a:q("::","IO").$read(q("::","File").$join(l(g,"STYLESHEETS_DATA_PATH"),"coderay-asciidoctor.css")).$rstrip()},A.$$arity=0);a.def(f,"$embed_coderay_stylesheet",D=function(){return""},D.$$arity=0);a.def(f,"$write_coderay_stylesheet",H=function(a){null==a&&(a=".");return q("::","IO").$write(q("::","File").$join(a,this.$coderay_stylesheet_name()),this.$coderay_stylesheet_data())},H.$$arity=-1);a.def(f,"$pygments_stylesheet_name",S=function(a){var c; +null==a&&(a=h);return"pygments-"+(b(c=a)?c:l(g,"DEFAULT_PYGMENTS_STYLE"))+".css"},S.$$arity=-1);a.def(f,"$pygments_background",M=function(a){var c,d;null==a&&(a=h);return b(b(c=this.$load_pygments())?l(g,"PygmentsBgColorRx")["$=~"](q("::","Pygments").$css(".pygments",n(["style"],{style:b(d=a)?d:l(g,"DEFAULT_PYGMENTS_STYLE")}))):c)?(c=p["~"])===h?h:c["$[]"](1):h},M.$$arity=-1);a.def(f,"$pygments_stylesheet_data",U=function(c){var d,e,f=h;null==c&&(c=h);return b(this.$load_pygments())?(c=b(d=c)?d:l(g, +"DEFAULT_PYGMENTS_STYLE"),b(d=(this.pygments_stylesheet_data=b(e=this.pygments_stylesheet_data)?e:n([],{}))["$[]"](c))?f=d:(f=[c,(b(e=q("::","Pygments").$css(".listingblock .pygments",n(["classprefix","style"],{classprefix:"tok-",style:c})))?e:"/* Failed to load Pygments CSS. */").$sub(".listingblock .pygments {",".listingblock .pygments, .listingblock .pygments code {")],r(this.pygments_stylesheet_data=b(e=this.pygments_stylesheet_data)?e:n([],{}),"[]=",a.to_a(f)),c=f,f=f.length,f="number"===typeof f? +f-1:f["$-"](1),f=c[f]),f):"/* Pygments CSS disabled. Pygments is not available. */"},U.$$arity=-1);a.def(f,"$embed_pygments_stylesheet",fa=function(a){null==a&&(a=h);return""},fa.$$arity=-1);a.def(f,"$write_pygments_stylesheet",V=function(a,b){null==a&&(a=".");null==b&&(b=h);return q("::","IO").$write(q("::","File").$join(a,this.$pygments_stylesheet_name(b)),this.$pygments_stylesheet_data(b))},V.$$arity=-1);return(a.def(f,"$load_pygments",K= +function(){return b(q("::","Pygments","skip_raise")?"constant":h)?!0:l(g,"Helpers").$require_library("pygments","pygments.rb","ignore")["$nil?"]()["$!"]()},K.$$arity=0),h)&&"load_pygments"})(f[0],null,f)}(c[0],c)};Opal.modules["asciidoctor/table"]=function(a){function c(a,b){return"number"===typeof a&&"number"===typeof b?a>b:a["$>"](b)}function h(a,b){return"number"===typeof a&&"number"===typeof b?a $to_i $< $== $[]= $- $attributes $round $* $/ $to_f $empty? $body $each $<< $size $+ $assign_column_widths $warn $logger $update_attributes $assign_width $shift $style= $head= $pop $foot= $parent $sourcemap $dup $header_row? $table $delete $start_with? $rstrip $slice $length $advance $lstrip $strip $split $include? $readlines $unshift $nil? $=~ $catalog_inline_anchor $apply_subs $convert $map $text $! $file $lineno $to_s $include $to_set $mark $nested? $document $error $message_with_context $cursor_at_prev_line $nil_or_empty? $escape $columns $match $chop $end_with? $gsub $push_cellspec $cell_open? $close_cell $take_cellspec $squeeze $upto $times $cursor_before_mark $rowspan $activate_rowspan $colspan $end_of_row? $!= $close_row $rows $effective_column_visits".split(" ")); +return function(b,E){function A(){}var D=[A=u(b,"Asciidoctor",A)].concat(E);(function(b,$super,p){function u(){}b=u=w(b,$super,"Table",u);var t=b.prototype,y=[b].concat(p),E,A,D,H,M;t.attributes=t.document=t.has_header_option=t.rows=t.columns=n;a.const_set(y[0],"DEFAULT_PRECISION_FACTOR",1E4);(function(b,$super,c){function d(){}b=d=w(b,$super,"Rows",d);var e=b.prototype;[b].concat(c);var f,g;e.head=e.body=e.foot=n;b.$attr_accessor("head","foot","body");a.def(b,"$initialize",f=function(a,b,c){null== +a&&(a=[]);null==b&&(b=[]);null==c&&(c=[]);this.head=a;this.foot=b;return this.body=c},f.$$arity=-1);a.alias(b,"[]","send");return(a.def(b,"$by_section",g=function(){return[["head",this.head],["body",this.body],["foot",this.foot]]},g.$$arity=0),n)&&"by_section"})(y[0],null,y);b.$attr_accessor("columns");b.$attr_accessor("rows");b.$attr_accessor("has_header_option");b.$attr_reader("caption");a.def(b,"$initialize",E=function(b,t){var m,p,u=n,w=n,x=n;E.$$p&&(E.$$p=null);d(this,a.find_super_dispatcher(this, +"initialize",E,!1),[b,"table"],null);this.rows=r(y,"Rows").$new();this.columns=[];this.has_header_option=t["$key?"]("header-option");f(u=t["$[]"]("width"))?f(f(m=c(w=u.$to_i(),100))?m:h(w,1))&&!f((m=w["$=="](0))?f(p=u["$=="]("0"))?p:u["$=="]("0%"):w["$=="](0))&&(w=100):w=100;x=["tablepcwidth",w];d(this.attributes,"[]=",a.to_a(x));x[q(x.length,1)];f(this.document.$attributes()["$key?"]("pagewidth"))&&(f(m=this.attributes["$[]"]("tableabswidth"))?m:(x=["tableabswidth",l(g(this.attributes["$[]"]("tablepcwidth").$to_f(), +100),this.document.$attributes()["$[]"]("pagewidth")).$round()],d(this.attributes,"[]=",a.to_a(x)),x[q(x.length,1)]));return f(t["$key?"]("rotate-option"))?(x=["orientation","landscape"],d(t,"[]=",a.to_a(x)),x[q(x.length,1)]):n},E.$$arity=2);a.def(b,"$header_row?",A=function(){var a;return f(a=this.has_header_option)?this.rows.$body()["$empty?"]():a},A.$$arity=0);a.def(b,"$create_columns",D=function(b){var g,l,t=n,p=n,v=n,u=n,u=n,t=[],p=n,v=0;d(b,"each",[],(g=function(a){var b=g.$$s||this,c,d=n;null== +a&&(a=n);d=a["$[]"]("width");t["$<<"](r(y,"Column").$new(b,t.$size(),a));return f(h(d,0))?(p=f(c=p)?c:[])["$<<"](t["$[]"](-1)):v=m(v,d)},g.$$s=this,g.$$arity=1,g));f(c(u=(this.columns=t).$size(),0))&&(u=["colcount",u],d(this.attributes,"[]=",a.to_a(u)),u[q(u.length,1)],f(f(l=c(v,0))?l:p)||(v=n),this.$assign_column_widths(v,p));return n},D.$$arity=1);a.def(b,"$assign_column_widths",H=function(a,b){var h,k,t,p=n,u=n,w=n,z=n,E=n;null==a&&(a=n);null==b&&(b=n);p=r(y,"DEFAULT_PRECISION_FACTOR");u=w=0;f(a)? +(f(b)&&(f(c(a,100))?(z=0,this.$logger().$warn("total column width must not exceed 100% when using autowidth columns; got "+a+"%")):(z=g(l(g(q(100,a),b.$size()),p).$to_i(),p),z.$to_i()["$=="](z)&&(z=z.$to_i()),a=100),E=x(["width","autowidth-option"],{width:z,"autowidth-option":""}),d(b,"each",[],(h=function(a){null==a&&(a=n);return a.$update_attributes(E)},h.$$s=this,h.$$arity=1,h))),d(this.columns,"each",[],(k=function(b){null==b&&(b=n);return u=m(u,w=b.$assign_width(n,a,p))},k.$$s=this,k.$$arity= +1,k))):(w=g(g(l(100,p),this.columns.$size()).$to_i(),p),w.$to_i()["$=="](w)&&(w=w.$to_i()),d(this.columns,"each",[],(t=function(a){null==a&&(a=n);return u=m(u,a.$assign_width(w))},t.$$s=this,t.$$arity=1,t)));u["$=="](100)||this.columns["$[]"](-1).$assign_width(g(l(m(q(100,u),w),p).$round(),p));return n},H.$$arity=-1);return(a.def(b,"$partition_header_footer",M=function(b){var g,h,k=n,l=n,t=n,k=["rowcount",this.rows.$body().$size()];d(this.attributes,"[]=",a.to_a(k));k[q(k.length,1)];l=this.rows.$body().$size(); +f(f(g=c(l,0))?this.has_header_option:g)&&(t=this.rows.$body().$shift(),l=q(l,1),d(t,"each",[],(h=function(b){null==b&&(b=n);k=[n];d(b,"style=",a.to_a(k));return k[q(k.length,1)]},h.$$s=this,h.$$arity=1,h)),k=[[t]],d(this.rows,"head=",a.to_a(k)),k[q(k.length,1)]);f(f(g=c(l,0))?b["$key?"]("footer-option"):g)&&(k=[[this.rows.$body().$pop()]],d(this.rows,"foot=",a.to_a(k)),k[q(k.length,1)]);return n},M.$$arity=1),n)&&"partition_header_footer"})(D[0],r(D,"AbstractBlock"),D);(function(b,$super,c){function e(){} +b=e=w(b,$super,"Column",e);var h=b.prototype;[b].concat(c);var k,p;h.attributes=n;b.$attr_accessor("style");a.def(b,"$initialize",k=function(b,c,e){var g,h=n;k.$$p&&(k.$$p=null);null==e&&(e=x([],{}));d(this,a.find_super_dispatcher(this,"initialize",k,!1),[b,"column"],null);this.style=e["$[]"]("style");h=["colnumber",m(c,1)];d(e,"[]=",a.to_a(h));h[q(h.length,1)];f(g=e["$[]"]("width"))?g:(h=["width",1],d(e,"[]=",a.to_a(h)),h[q(h.length,1)]);f(g=e["$[]"]("halign"))?g:(h=["halign","left"],d(e,"[]=",a.to_a(h)), +h[q(h.length,1)]);f(g=e["$[]"]("valign"))?g:(h=["valign","top"],d(e,"[]=",a.to_a(h)),h[q(h.length,1)]);return this.$update_attributes(e)},k.$$arity=-3);a.alias(b,"table","parent");return(a.def(b,"$assign_width",p=function(b,c,e){var h=n;null==c&&(c=n);null==e&&(e=1E4);f(c)&&(b=g(l(l(g(this.attributes["$[]"]("width").$to_f(),c),100),e).$to_i(),e),b.$to_i()["$=="](b)&&(b=b.$to_i()));h=["colpcwidth",b];d(this.attributes,"[]=",a.to_a(h));h[q(h.length,1)];f(this.$parent().$attributes()["$key?"]("tableabswidth"))&& +(h=["colabswidth",l(g(b,100),this.$parent().$attributes()["$[]"]("tableabswidth")).$round()],d(this.attributes,"[]=",a.to_a(h)),h[q(h.length,1)]);return b},p.$$arity=-2),n)&&"assign_width"})(r(D,"Table"),r(D,"AbstractNode"),D);(function(b,$super,c){function e(){}b=e=w(b,$super,"Cell",e);var g=b.prototype,l=[b].concat(c),p,v,u,E,A,D,H;g.document=g.text=g.subs=g.style=g.inner_document=g.source_location=g.colspan=g.rowspan=g.attributes=n;b.$attr_reader("source_location");b.$attr_accessor("style");b.$attr_accessor("subs"); +b.$attr_accessor("colspan");b.$attr_accessor("rowspan");a.alias(b,"column","parent");b.$attr_reader("inner_document");a.def(b,"$initialize",p=function(b,c,e,g){var t,v,u=n,w=n,z=n,E=n,A=n,D=n,L=n,H=A=n,R=n,X=n,A=n;p.$$p&&(p.$$p=null);null==e&&(e=x([],{}));null==g&&(g=x([],{}));d(this,a.find_super_dispatcher(this,"initialize",p,!1),[b,"cell"],null);f(this.document.$sourcemap())&&(this.source_location=g["$[]"]("cursor").$dup());f(b)&&(f(u=b.$table()["$header_row?"]())||(w=b.$attributes()["$[]"]("style")), +this.$update_attributes(b.$attributes()));if(f(e))if(f(e["$empty?"]())?this.colspan=this.rowspan=n:(t=[e.$delete("colspan"),e.$delete("rowspan")],this.colspan=t[0],this.rowspan=t[1],t,f(u)||(w=f(t=e["$[]"]("style"))?t:w),this.$update_attributes(e)),w["$=="]("asciidoc"))if(z=!0,E=g["$[]"]("cursor"),f((c=c.$rstrip())["$start_with?"](r(l,"LF")))){for(A=1;f((c=c.$slice(1,c.$length()))["$start_with?"](r(l,"LF")));)A=m(A,1);E.$advance(A)}else c=c.$lstrip();else if(f(f(t=D=w["$=="]("literal"))?t:w["$=="]("verse")))for(c= +c.$rstrip();f(c["$start_with?"](r(l,"LF")));)c=c.$slice(1,c.$length());else L=!0,c=f(c)?c.$strip():"";else this.colspan=this.rowspan=n,w["$=="]("asciidoc")&&(z=!0,E=g["$[]"]("cursor"));f(z)?(A=this.document.$attributes().$delete("doctitle"),H=c.$split(r(l,"LF"),-1),!f(H["$empty?"]())&&f((R=H["$[]"](0))["$include?"]("::"))&&(X=r(l,"PreprocessorReader").$new(this.document,[R]).$readlines(),f(R["$=="](X["$[]"](0))?h(X.$size(),2):R["$=="](X["$[]"](0)))||(H.$shift(),f(X["$empty?"]())||d(H,"unshift",a.to_a(X)))), +this.inner_document=r(l,"Document").$new(H,x(["header_footer","parent","cursor"],{header_footer:!1,parent:this.document,cursor:E})),f(A["$nil?"]())||(A=["doctitle",A],d(this.document.$attributes(),"[]=",a.to_a(A)),A[q(A.length,1)]),this.subs=n):f(D)?this.subs=r(l,"BASIC_SUBS"):(f(f(t=f(v=L)?c["$start_with?"]("[["):v)?r(l,"LeadingInlineAnchorRx")["$=~"](c):t)&&r(l,"Parser").$catalog_inline_anchor((t=y["~"])===n?n:t["$[]"](1),(t=y["~"])===n?n:t["$[]"](2),this,g["$[]"]("cursor"),this.document),this.subs= +r(l,"NORMAL_SUBS"));this.text=c;return this.style=w},p.$$arity=-3);a.def(b,"$text",v=function(){return this.$apply_subs(this.text,this.subs)},v.$$arity=0);a.def(b,"$text=",u=function(a){return this.text=a},u.$$arity=1);a.def(b,"$content",E=function(){var a;return this.style["$=="]("asciidoc")?this.inner_document.$convert():d(this.$text().$split(r(l,"BlankLineRx")),"map",[],(a=function(b){var c=a.$$s||this,d;null==c.style&&(c.style=n);null==b&&(b=n);return f(f(d=c.style["$!"]())?d:c.style["$=="]("header"))? +b:r(l,"Inline").$new(c.$parent(),"quoted",b,x(["type"],{type:c.style})).$convert()},a.$$s=this,a.$$arity=1,a))},E.$$arity=0);a.def(b,"$file",A=function(){var a;return f(a=this.source_location)?this.source_location.$file():a},A.$$arity=0);a.def(b,"$lineno",D=function(){var a;return f(a=this.source_location)?this.source_location.$lineno():a},D.$$arity=0);return(a.def(b,"$to_s",H=function(){var b,c=H.$$p,e=n,g=n,h=n;c&&(H.$$p=null);g=0;h=arguments.length;for(e=Array(h);gb:a["$>"](b)}function l(a,b){return"number"===typeof a&&"number"===typeof b?a+b:a["$+"](b)}function n(a,b){return"number"===typeof a&&"number"===typeof b?a<=b:a["$<="](b)}function g(a,b){return"number"=== +typeof a&&"number"===typeof b?a $name $email $sub_macros $+ $downcase $concat $content $footnotes? $! $footnotes $index $text $nofooter $inspect $!= $to_i $attributes $document $sections $level $caption $captioned_title $numbered $<= $< $sectname $sectnum $role $title? $icon_uri $compact $media_uri $option? $append_boolean_attribute $style $items $blocks? $text? $chomp $safe $read_svg_contents $alt $image_uri $encode_quotes $append_link_constraint_attrs $pygments_background $to_sym $* $count $start_with? $end_with? $list_marker_keyword $parent $warn $logger $context $error $new $size $columns $by_section $rows $colspan $rowspan $role? $unshift $shift $split $nil_or_empty? $type $catalog $xreftext $target $map $chop $upcase $read_contents $sub $match".split(" ")); +return function(m,B){function E(){}var A=[E=u(m,"Asciidoctor",E)].concat(B);(function(m,$super,u){function E(){}m=E=w(m,$super,"Html5Converter",E);var B=m.prototype,t=[m].concat(u),A,D,N,H,S,M,U,fa,V,K,J,Q,G,Z,la,Da,aa,ba,ma,sa,da,ea,R,ja,Aa,Ba,wa,oa,Fa,ta,Qa,xa,La,Ma,Ca,Ga,Ha,Ia,Pa,Ra,Na,Oa,Va;u=b;B.xml_mode=B.void_element_slash=B.stylesheets=B.pygments_bg=B.refs=b;u=[["","",!1]];x(a.const_set(t[0],"QUOTE_TAGS",d("monospaced emphasis strong double single mark superscript subscript asciimath latexmath".split(" "), +{monospaced:["","",!0],emphasis:["","",!0],strong:["","",!0],"double":["“","”",!1],single:["‘","’",!1],mark:["","",!0],superscript:["","",!0],subscript:["","",!0],asciimath:["\\$","\\$",!1],latexmath:["\\(","\\)",!1]})),"default=",a.to_a(u));u[c(u.length,1)];a.const_set(t[0],"DropAnchorRx",/<(?:a[^>+]+|\/a)>/);a.const_set(t[0],"StemBreakRx",/ *\\\n(?:\\?\n)*|\n\n+/);a.const_set(t[0],"SvgPreambleRx",/^.*?(?=]*>/);a.const_set(t[0],"DimensionAttributeRx",/\s(?:width|height|style)=(["']).*?\1/);a.def(m,"$initialize",A=function(a,c){null==c&&(c=d([],{}));this.xml_mode=c["$[]"]("htmlsyntax")["$=="]("xml");this.void_element_slash=f(this.xml_mode)?"/":b;return this.stylesheets=p(t,"Stylesheets").$instance()},A.$$arity=-2);a.def(m,"$document",D=function(a){var c,e,g,n,m,v=b,u=b,w=b,y=b,E=b,B=b,A=b,D=b,K=A=b,J=b,L=K=E=E=K=A=K=A=A=b,G=b,N=b,v=v=E=E=b,v=this.void_element_slash, +u="";f((w=a.$attr("asset-uri-scheme","https"))["$empty?"]())||(w=""+w+":");y=""+w+"//cdnjs.cloudflare.com/ajax/libs";E=a["$attr?"]("linkcss");B=[""];A=f(a["$attr?"]("nolang"))?"":' lang="'+a.$attr("lang","en")+'"';B["$<<"]("");B["$<<"]('\n\n\x3c!--[if IE]>\n");if(f(a["$attr?"]("app-name")))B["$<<"]('");if(f(a["$attr?"]("description")))B["$<<"]('");if(f(a["$attr?"]("keywords")))B["$<<"]('");if(f(a["$attr?"]("authors")))B["$<<"]('");if(f(a["$attr?"]("copyright")))B["$<<"]('");f(a["$attr?"]("favicon"))&&(f((A=a.$attr("favicon"))["$empty?"]())?(c=["favicon.ico","image/x-icon"],A=c[0],K=c[1],c):K=(J=r("::","File").$extname(A))["$=="](".ico")?"image/x-icon":"image/"+J.$slice(1,J.$length()),B["$<<"]('"));B["$<<"](""+a.$doctitle(d(["sanitize","use_fallback"],{sanitize:!0, +use_fallback:!0}))+"");if(f(p(t,"DEFAULT_STYLESHEET_KEYS")["$include?"](a.$attr("stylesheet")))){if(f(A=a.$attr("webfonts")))B["$<<"]('");if(f(E))B["$<<"]('");else B["$<<"](this.stylesheets.$embed_primary_stylesheet())}else if(f(a["$attr?"]("stylesheet")))if(f(E))B["$<<"]('");else B["$<<"]("");if(f(a["$attr?"]("icons","font")))if(f(a["$attr?"]("iconfont-remote")))B["$<<"]('");else A=""+a.$attr("iconfont-name","font-awesome")+".css",B["$<<"]('");K=A=a.$attr("source-highlighter");if("coderay"["$==="](K)){if(a.$attr("coderay-css","class")["$=="]("class"))if(f(E))B["$<<"]('");else B["$<<"](this.stylesheets.$embed_coderay_stylesheet())}else if("pygments"["$==="](K)&&a.$attr("pygments-css","class")["$=="]("class"))if(K=a.$attr("pygments-style"),f(E))B["$<<"]('");else B["$<<"](this.stylesheets.$embed_pygments_stylesheet(K));if(!f((E=a.$docinfo())["$empty?"]()))B["$<<"](E);B["$<<"]("");E=f(a.$id())?['id="'+a.$id()+ +'"']:[];L=f(f(c=f(e=f(g=K=a["$sections?"]())?a["$attr?"]("toc-class"):g)?a["$attr?"]("toc"):e)?a["$attr?"]("toc-placement","auto"):c)?[a.$doctype(),a.$attr("toc-class"),"toc-"+a.$attr("toc-position","header")]:[a.$doctype()];if(f(a["$attr?"]("docrole")))L["$<<"](a.$attr("docrole"));E["$<<"]('class="'+L.$join(" ")+'"');if(f(a["$attr?"]("max-width")))E["$<<"]('style="max-width: '+a.$attr("max-width")+';"');B["$<<"]("");if(!f(a.$noheader())){B["$<<"]('")}B["$<<"]('
    \n'+a.$content()+"\n
    ");f(f(c=a["$footnotes?"]())?a["$attr?"]("nofootnotes")["$!"](): +c)&&(B["$<<"]('
    \n"),x(a.$footnotes(),"each",[],(m=function(a){null==a&&(a=b);return B["$<<"]('
    \n'+a.$index()+". "+a.$text()+"\n
    ")},m.$$s=this,m.$$arity=1,m)),B["$<<"]("
    "));if(!f(a.$nofooter())){B["$<<"]('")}if(!f((E=a.$docinfo("footer"))["$empty?"]()))B["$<<"](E);K=A;"highlightjs"["$==="](K)||"highlight.js"["$==="](K)?(E=a.$attr("highlightjsdir",""+y+"/highlight.js/9.13.1"),B["$<<"]('"),B["$<<"]('\n" + "");} + else if ("prettify"['$===']($case)) { + prettify_path = node.$attr("prettifydir", "" + (cdn_base) + "/prettify/r298"); + result['$<<']("" + ""); + result['$<<']("" + "\n" + "");}; + if ($truthy(node['$attr?']("stem"))) { + + eqnums_val = node.$attr("eqnums", "none"); + if ($truthy(eqnums_val['$empty?']())) { + eqnums_val = "AMS"}; + eqnums_opt = "" + " equationNumbers: { autoNumber: \"" + (eqnums_val) + "\" } "; + result['$<<']("" + "\n" + "");}; + result['$<<'](""); + result['$<<'](""); + return result.$join($$($nesting, 'LF')); + }, TMP_Html5Converter_document_2.$$arity = 1); + + Opal.def(self, '$embedded', TMP_Html5Converter_embedded_5 = function $$embedded(node) { + var $a, $b, $c, TMP_6, self = this, result = nil, id_attr = nil, toc_p = nil; + + + result = []; + if (node.$doctype()['$==']("manpage")) { + + if ($truthy(node.$notitle())) { + } else { + + id_attr = (function() {if ($truthy(node.$id())) { + return "" + " id=\"" + (node.$id()) + "\"" + } else { + return "" + }; return nil; })(); + result['$<<']("" + "" + (node.$doctitle()) + " Manual Page"); + }; + if ($truthy(node['$attr?']("manpurpose"))) { + result['$<<'](self.$generate_manname_section(node))}; + } else if ($truthy(($truthy($a = node['$has_header?']()) ? node.$notitle()['$!']() : $a))) { + + id_attr = (function() {if ($truthy(node.$id())) { + return "" + " id=\"" + (node.$id()) + "\"" + } else { + return "" + }; return nil; })(); + result['$<<']("" + "" + (node.$header().$title()) + "");}; + if ($truthy(($truthy($a = ($truthy($b = ($truthy($c = node['$sections?']()) ? node['$attr?']("toc") : $c)) ? (toc_p = node.$attr("toc-placement"))['$!=']("macro") : $b)) ? toc_p['$!=']("preamble") : $a))) { + result['$<<']("" + "
    \n" + "
    " + (node.$attr("toc-title")) + "
    \n" + (self.$outline(node)) + "\n" + "
    ")}; + result['$<<'](node.$content()); + if ($truthy(($truthy($a = node['$footnotes?']()) ? node['$attr?']("nofootnotes")['$!']() : $a))) { + + result['$<<']("" + "
    \n" + ""); + $send(node.$footnotes(), 'each', [], (TMP_6 = function(footnote){var self = TMP_6.$$s || this; + + + + if (footnote == null) { + footnote = nil; + }; + return result['$<<']("" + "
    \n" + "" + (footnote.$index()) + ". " + (footnote.$text()) + "\n" + "
    ");}, TMP_6.$$s = self, TMP_6.$$arity = 1, TMP_6)); + result['$<<']("
    ");}; + return result.$join($$($nesting, 'LF')); + }, TMP_Html5Converter_embedded_5.$$arity = 1); + + Opal.def(self, '$outline', TMP_Html5Converter_outline_7 = function $$outline(node, opts) { + var $a, $b, TMP_8, self = this, sectnumlevels = nil, toclevels = nil, sections = nil, result = nil; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + if ($truthy(node['$sections?']())) { + } else { + return nil + }; + sectnumlevels = ($truthy($a = opts['$[]']("sectnumlevels")) ? $a : ($truthy($b = node.$document().$attributes()['$[]']("sectnumlevels")) ? $b : 3).$to_i()); + toclevels = ($truthy($a = opts['$[]']("toclevels")) ? $a : ($truthy($b = node.$document().$attributes()['$[]']("toclevels")) ? $b : 2).$to_i()); + sections = node.$sections(); + result = ["" + "
      "]; + $send(sections, 'each', [], (TMP_8 = function(section){var self = TMP_8.$$s || this, $c, slevel = nil, stitle = nil, signifier = nil, child_toc_level = nil; + + + + if (section == null) { + section = nil; + }; + slevel = section.$level(); + if ($truthy(section.$caption())) { + stitle = section.$captioned_title() + } else if ($truthy(($truthy($c = section.$numbered()) ? $rb_le(slevel, sectnumlevels) : $c))) { + if ($truthy(($truthy($c = $rb_lt(slevel, 2)) ? node.$document().$doctype()['$==']("book") : $c))) { + if (section.$sectname()['$==']("chapter")) { + stitle = "" + ((function() {if ($truthy((signifier = node.$document().$attributes()['$[]']("chapter-signifier")))) { + return "" + (signifier) + " " + } else { + return "" + }; return nil; })()) + (section.$sectnum()) + " " + (section.$title()) + } else if (section.$sectname()['$==']("part")) { + stitle = "" + ((function() {if ($truthy((signifier = node.$document().$attributes()['$[]']("part-signifier")))) { + return "" + (signifier) + " " + } else { + return "" + }; return nil; })()) + (section.$sectnum(nil, ":")) + " " + (section.$title()) + } else { + stitle = "" + (section.$sectnum()) + " " + (section.$title()) + } + } else { + stitle = "" + (section.$sectnum()) + " " + (section.$title()) + } + } else { + stitle = section.$title() + }; + if ($truthy(stitle['$include?']("" + (stitle) + ""); + result['$<<'](child_toc_level); + return result['$<<'](""); + } else { + return result['$<<']("" + "
    • " + (stitle) + "
    • ") + };}, TMP_8.$$s = self, TMP_8.$$arity = 1, TMP_8)); + result['$<<']("
    "); + return result.$join($$($nesting, 'LF')); + }, TMP_Html5Converter_outline_7.$$arity = -2); + + Opal.def(self, '$section', TMP_Html5Converter_section_9 = function $$section(node) { + var $a, $b, self = this, doc_attrs = nil, level = nil, title = nil, signifier = nil, id_attr = nil, id = nil, role = nil; + + + doc_attrs = node.$document().$attributes(); + level = node.$level(); + if ($truthy(node.$caption())) { + title = node.$captioned_title() + } else if ($truthy(($truthy($a = node.$numbered()) ? $rb_le(level, ($truthy($b = doc_attrs['$[]']("sectnumlevels")) ? $b : 3).$to_i()) : $a))) { + if ($truthy(($truthy($a = $rb_lt(level, 2)) ? node.$document().$doctype()['$==']("book") : $a))) { + if (node.$sectname()['$==']("chapter")) { + title = "" + ((function() {if ($truthy((signifier = doc_attrs['$[]']("chapter-signifier")))) { + return "" + (signifier) + " " + } else { + return "" + }; return nil; })()) + (node.$sectnum()) + " " + (node.$title()) + } else if (node.$sectname()['$==']("part")) { + title = "" + ((function() {if ($truthy((signifier = doc_attrs['$[]']("part-signifier")))) { + return "" + (signifier) + " " + } else { + return "" + }; return nil; })()) + (node.$sectnum(nil, ":")) + " " + (node.$title()) + } else { + title = "" + (node.$sectnum()) + " " + (node.$title()) + } + } else { + title = "" + (node.$sectnum()) + " " + (node.$title()) + } + } else { + title = node.$title() + }; + if ($truthy(node.$id())) { + + id_attr = "" + " id=\"" + ((id = node.$id())) + "\""; + if ($truthy(doc_attrs['$[]']("sectlinks"))) { + title = "" + "" + (title) + ""}; + if ($truthy(doc_attrs['$[]']("sectanchors"))) { + if (doc_attrs['$[]']("sectanchors")['$==']("after")) { + title = "" + (title) + "" + } else { + title = "" + "" + (title) + }}; + } else { + id_attr = "" + }; + if (level['$=='](0)) { + return "" + "" + (title) + "\n" + (node.$content()) + } else { + return "" + "
    \n" + "" + (title) + "\n" + ((function() {if (level['$=='](1)) { + return "" + "
    \n" + (node.$content()) + "\n" + "
    " + } else { + return node.$content() + }; return nil; })()) + "\n" + "
    " + }; + }, TMP_Html5Converter_section_9.$$arity = 1); + + Opal.def(self, '$admonition', TMP_Html5Converter_admonition_10 = function $$admonition(node) { + var $a, self = this, id_attr = nil, name = nil, title_element = nil, label = nil, role = nil; + + + id_attr = (function() {if ($truthy(node.$id())) { + return "" + " id=\"" + (node.$id()) + "\"" + } else { + return "" + }; return nil; })(); + name = node.$attr("name"); + title_element = (function() {if ($truthy(node['$title?']())) { + return "" + "
    " + (node.$title()) + "
    \n" + } else { + return "" + }; return nil; })(); + if ($truthy(node.$document()['$attr?']("icons"))) { + if ($truthy(($truthy($a = node.$document()['$attr?']("icons", "font")) ? node['$attr?']("icon")['$!']() : $a))) { + label = "" + "" + } else { + label = "" + "\""" + } + } else { + label = "" + "
    " + (node.$attr("textlabel")) + "
    " + }; + return "" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "
    \n" + (label) + "\n" + "\n" + (title_element) + (node.$content()) + "\n" + "
    \n" + "
    "; + }, TMP_Html5Converter_admonition_10.$$arity = 1); + + Opal.def(self, '$audio', TMP_Html5Converter_audio_11 = function $$audio(node) { + var $a, self = this, xml = nil, id_attribute = nil, classes = nil, class_attribute = nil, title_element = nil, start_t = nil, end_t = nil, time_anchor = nil; + + + xml = self.xml_mode; + id_attribute = (function() {if ($truthy(node.$id())) { + return "" + " id=\"" + (node.$id()) + "\"" + } else { + return "" + }; return nil; })(); + classes = ["audioblock", node.$role()].$compact(); + class_attribute = "" + " class=\"" + (classes.$join(" ")) + "\""; + title_element = (function() {if ($truthy(node['$title?']())) { + return "" + "
    " + (node.$title()) + "
    \n" + } else { + return "" + }; return nil; })(); + start_t = node.$attr("start", nil, false); + end_t = node.$attr("end", nil, false); + time_anchor = (function() {if ($truthy(($truthy($a = start_t) ? $a : end_t))) { + return "" + "#t=" + (($truthy($a = start_t) ? $a : "")) + ((function() {if ($truthy(end_t)) { + return "" + "," + (end_t) + } else { + return "" + }; return nil; })()) + } else { + return "" + }; return nil; })(); + return "" + "\n" + (title_element) + "
    \n" + "\n" + "
    \n" + ""; + }, TMP_Html5Converter_audio_11.$$arity = 1); + + Opal.def(self, '$colist', TMP_Html5Converter_colist_12 = function $$colist(node) { + var $a, TMP_13, TMP_14, self = this, result = nil, id_attribute = nil, classes = nil, class_attribute = nil, font_icons = nil, num = nil; + + + result = []; + id_attribute = (function() {if ($truthy(node.$id())) { + return "" + " id=\"" + (node.$id()) + "\"" + } else { + return "" + }; return nil; })(); + classes = ["colist", node.$style(), node.$role()].$compact(); + class_attribute = "" + " class=\"" + (classes.$join(" ")) + "\""; + result['$<<']("" + ""); + if ($truthy(node['$title?']())) { + result['$<<']("" + "
    " + (node.$title()) + "
    ")}; + if ($truthy(node.$document()['$attr?']("icons"))) { + + result['$<<'](""); + $a = [node.$document()['$attr?']("icons", "font"), 0], (font_icons = $a[0]), (num = $a[1]), $a; + $send(node.$items(), 'each', [], (TMP_13 = function(item){var self = TMP_13.$$s || this, num_label = nil; + if (self.void_element_slash == null) self.void_element_slash = nil; + + + + if (item == null) { + item = nil; + }; + num = $rb_plus(num, 1); + if ($truthy(font_icons)) { + num_label = "" + "" + (num) + "" + } else { + num_label = "" + "\""" + }; + return result['$<<']("" + "\n" + "\n" + "\n" + "");}, TMP_13.$$s = self, TMP_13.$$arity = 1, TMP_13)); + result['$<<']("
    " + (num_label) + "" + (item.$text()) + ((function() {if ($truthy(item['$blocks?']())) { + return $rb_plus($$($nesting, 'LF'), item.$content()) + } else { + return "" + }; return nil; })()) + "
    "); + } else { + + result['$<<']("
      "); + $send(node.$items(), 'each', [], (TMP_14 = function(item){var self = TMP_14.$$s || this; + + + + if (item == null) { + item = nil; + }; + return result['$<<']("" + "
    1. \n" + "

      " + (item.$text()) + "

      " + ((function() {if ($truthy(item['$blocks?']())) { + return $rb_plus($$($nesting, 'LF'), item.$content()) + } else { + return "" + }; return nil; })()) + "\n" + "
    2. ");}, TMP_14.$$s = self, TMP_14.$$arity = 1, TMP_14)); + result['$<<']("
    "); + }; + result['$<<'](""); + return result.$join($$($nesting, 'LF')); + }, TMP_Html5Converter_colist_12.$$arity = 1); + + Opal.def(self, '$dlist', TMP_Html5Converter_dlist_15 = function $$dlist(node) { + var TMP_16, $a, TMP_18, TMP_20, self = this, result = nil, id_attribute = nil, classes = nil, $case = nil, class_attribute = nil, slash = nil, col_style_attribute = nil, dt_style_attribute = nil; + + + result = []; + id_attribute = (function() {if ($truthy(node.$id())) { + return "" + " id=\"" + (node.$id()) + "\"" + } else { + return "" + }; return nil; })(); + classes = (function() {$case = node.$style(); + if ("qanda"['$===']($case)) {return ["qlist", "qanda", node.$role()]} + else if ("horizontal"['$===']($case)) {return ["hdlist", node.$role()]} + else {return ["dlist", node.$style(), node.$role()]}})().$compact(); + class_attribute = "" + " class=\"" + (classes.$join(" ")) + "\""; + result['$<<']("" + ""); + if ($truthy(node['$title?']())) { + result['$<<']("" + "
    " + (node.$title()) + "
    ")}; + $case = node.$style(); + if ("qanda"['$===']($case)) { + result['$<<']("
      "); + $send(node.$items(), 'each', [], (TMP_16 = function(terms, dd){var self = TMP_16.$$s || this, TMP_17; + + + + if (terms == null) { + terms = nil; + }; + + if (dd == null) { + dd = nil; + }; + result['$<<']("
    1. "); + $send([].concat(Opal.to_a(terms)), 'each', [], (TMP_17 = function(dt){var self = TMP_17.$$s || this; + + + + if (dt == null) { + dt = nil; + }; + return result['$<<']("" + "

      " + (dt.$text()) + "

      ");}, TMP_17.$$s = self, TMP_17.$$arity = 1, TMP_17)); + if ($truthy(dd)) { + + if ($truthy(dd['$text?']())) { + result['$<<']("" + "

      " + (dd.$text()) + "

      ")}; + if ($truthy(dd['$blocks?']())) { + result['$<<'](dd.$content())};}; + return result['$<<']("
    2. ");}, TMP_16.$$s = self, TMP_16.$$arity = 2, TMP_16)); + result['$<<']("
    ");} + else if ("horizontal"['$===']($case)) { + slash = self.void_element_slash; + result['$<<'](""); + if ($truthy(($truthy($a = node['$attr?']("labelwidth")) ? $a : node['$attr?']("itemwidth")))) { + + result['$<<'](""); + col_style_attribute = (function() {if ($truthy(node['$attr?']("labelwidth"))) { + return "" + " style=\"width: " + (node.$attr("labelwidth").$chomp("%")) + "%;\"" + } else { + return "" + }; return nil; })(); + result['$<<']("" + ""); + col_style_attribute = (function() {if ($truthy(node['$attr?']("itemwidth"))) { + return "" + " style=\"width: " + (node.$attr("itemwidth").$chomp("%")) + "%;\"" + } else { + return "" + }; return nil; })(); + result['$<<']("" + ""); + result['$<<']("");}; + $send(node.$items(), 'each', [], (TMP_18 = function(terms, dd){var self = TMP_18.$$s || this, TMP_19, terms_array = nil, last_term = nil; + + + + if (terms == null) { + terms = nil; + }; + + if (dd == null) { + dd = nil; + }; + result['$<<'](""); + result['$<<']("" + ""); + result['$<<'](""); + return result['$<<']("");}, TMP_18.$$s = self, TMP_18.$$arity = 2, TMP_18)); + result['$<<']("
    "); + terms_array = [].concat(Opal.to_a(terms)); + last_term = terms_array['$[]'](-1); + $send(terms_array, 'each', [], (TMP_19 = function(dt){var self = TMP_19.$$s || this; + + + + if (dt == null) { + dt = nil; + }; + result['$<<'](dt.$text()); + if ($truthy(dt['$!='](last_term))) { + return result['$<<']("" + "") + } else { + return nil + };}, TMP_19.$$s = self, TMP_19.$$arity = 1, TMP_19)); + result['$<<'](""); + if ($truthy(dd)) { + + if ($truthy(dd['$text?']())) { + result['$<<']("" + "

    " + (dd.$text()) + "

    ")}; + if ($truthy(dd['$blocks?']())) { + result['$<<'](dd.$content())};}; + result['$<<']("
    ");} + else { + result['$<<']("
    "); + dt_style_attribute = (function() {if ($truthy(node.$style())) { + return "" + } else { + return " class=\"hdlist1\"" + }; return nil; })(); + $send(node.$items(), 'each', [], (TMP_20 = function(terms, dd){var self = TMP_20.$$s || this, TMP_21; + + + + if (terms == null) { + terms = nil; + }; + + if (dd == null) { + dd = nil; + }; + $send([].concat(Opal.to_a(terms)), 'each', [], (TMP_21 = function(dt){var self = TMP_21.$$s || this; + + + + if (dt == null) { + dt = nil; + }; + return result['$<<']("" + "" + (dt.$text()) + "");}, TMP_21.$$s = self, TMP_21.$$arity = 1, TMP_21)); + if ($truthy(dd)) { + + result['$<<']("
    "); + if ($truthy(dd['$text?']())) { + result['$<<']("" + "

    " + (dd.$text()) + "

    ")}; + if ($truthy(dd['$blocks?']())) { + result['$<<'](dd.$content())}; + return result['$<<']("
    "); + } else { + return nil + };}, TMP_20.$$s = self, TMP_20.$$arity = 2, TMP_20)); + result['$<<']("
    ");}; + result['$<<'](""); + return result.$join($$($nesting, 'LF')); + }, TMP_Html5Converter_dlist_15.$$arity = 1); + + Opal.def(self, '$example', TMP_Html5Converter_example_22 = function $$example(node) { + var self = this, id_attribute = nil, title_element = nil, role = nil; + + + id_attribute = (function() {if ($truthy(node.$id())) { + return "" + " id=\"" + (node.$id()) + "\"" + } else { + return "" + }; return nil; })(); + title_element = (function() {if ($truthy(node['$title?']())) { + return "" + "
    " + (node.$captioned_title()) + "
    \n" + } else { + return "" + }; return nil; })(); + return "" + "\n" + (title_element) + "
    \n" + (node.$content()) + "\n" + "
    \n" + ""; + }, TMP_Html5Converter_example_22.$$arity = 1); + + Opal.def(self, '$floating_title', TMP_Html5Converter_floating_title_23 = function $$floating_title(node) { + var self = this, tag_name = nil, id_attribute = nil, classes = nil; + + + tag_name = "" + "h" + ($rb_plus(node.$level(), 1)); + id_attribute = (function() {if ($truthy(node.$id())) { + return "" + " id=\"" + (node.$id()) + "\"" + } else { + return "" + }; return nil; })(); + classes = [node.$style(), node.$role()].$compact(); + return "" + "<" + (tag_name) + (id_attribute) + " class=\"" + (classes.$join(" ")) + "\">" + (node.$title()) + ""; + }, TMP_Html5Converter_floating_title_23.$$arity = 1); + + Opal.def(self, '$image', TMP_Html5Converter_image_24 = function $$image(node) { + var $a, $b, $c, self = this, target = nil, width_attr = nil, height_attr = nil, svg = nil, obj = nil, img = nil, fallback = nil, id_attr = nil, classes = nil, class_attr = nil, title_el = nil; + + + target = node.$attr("target"); + width_attr = (function() {if ($truthy(node['$attr?']("width"))) { + return "" + " width=\"" + (node.$attr("width")) + "\"" + } else { + return "" + }; return nil; })(); + height_attr = (function() {if ($truthy(node['$attr?']("height"))) { + return "" + " height=\"" + (node.$attr("height")) + "\"" + } else { + return "" + }; return nil; })(); + if ($truthy(($truthy($a = ($truthy($b = ($truthy($c = node['$attr?']("format", "svg", false)) ? $c : target['$include?'](".svg"))) ? $rb_lt(node.$document().$safe(), $$$($$($nesting, 'SafeMode'), 'SECURE')) : $b)) ? ($truthy($b = (svg = node['$option?']("inline"))) ? $b : (obj = node['$option?']("interactive"))) : $a))) { + if ($truthy(svg)) { + img = ($truthy($a = self.$read_svg_contents(node, target)) ? $a : "" + "" + (node.$alt()) + "") + } else if ($truthy(obj)) { + + fallback = (function() {if ($truthy(node['$attr?']("fallback"))) { + return "" + "\""" + } else { + return "" + "" + (node.$alt()) + "" + }; return nil; })(); + img = "" + "" + (fallback) + "";}}; + img = ($truthy($a = img) ? $a : "" + "\"""); + if ($truthy(node['$attr?']("link", nil, false))) { + img = "" + "" + (img) + ""}; + id_attr = (function() {if ($truthy(node.$id())) { + return "" + " id=\"" + (node.$id()) + "\"" + } else { + return "" + }; return nil; })(); + classes = ["imageblock"]; + if ($truthy(node['$attr?']("float"))) { + classes['$<<'](node.$attr("float"))}; + if ($truthy(node['$attr?']("align"))) { + classes['$<<']("" + "text-" + (node.$attr("align")))}; + if ($truthy(node.$role())) { + classes['$<<'](node.$role())}; + class_attr = "" + " class=\"" + (classes.$join(" ")) + "\""; + title_el = (function() {if ($truthy(node['$title?']())) { + return "" + "\n
    " + (node.$captioned_title()) + "
    " + } else { + return "" + }; return nil; })(); + return "" + "\n" + "
    \n" + (img) + "\n" + "
    " + (title_el) + "\n" + ""; + }, TMP_Html5Converter_image_24.$$arity = 1); + + Opal.def(self, '$listing', TMP_Html5Converter_listing_25 = function $$listing(node) { + var $a, self = this, nowrap = nil, language = nil, code_attrs = nil, $case = nil, pre_class = nil, pre_start = nil, pre_end = nil, id_attribute = nil, title_element = nil, role = nil; + + + nowrap = ($truthy($a = node.$document()['$attr?']("prewrap")['$!']()) ? $a : node['$option?']("nowrap")); + if (node.$style()['$==']("source")) { + + if ($truthy((language = node.$attr("language", nil, false)))) { + code_attrs = "" + " data-lang=\"" + (language) + "\"" + } else { + code_attrs = "" + }; + $case = node.$document().$attr("source-highlighter"); + if ("coderay"['$===']($case)) {pre_class = "" + " class=\"CodeRay highlight" + ((function() {if ($truthy(nowrap)) { + return " nowrap" + } else { + return "" + }; return nil; })()) + "\""} + else if ("pygments"['$===']($case)) {if ($truthy(node.$document()['$attr?']("pygments-css", "inline"))) { + + if ($truthy((($a = self['pygments_bg'], $a != null && $a !== nil) ? 'instance-variable' : nil))) { + } else { + self.pygments_bg = self.stylesheets.$pygments_background(node.$document().$attr("pygments-style")) + }; + pre_class = "" + " class=\"pygments highlight" + ((function() {if ($truthy(nowrap)) { + return " nowrap" + } else { + return "" + }; return nil; })()) + "\" style=\"background: " + (self.pygments_bg) + "\""; + } else { + pre_class = "" + " class=\"pygments highlight" + ((function() {if ($truthy(nowrap)) { + return " nowrap" + } else { + return "" + }; return nil; })()) + "\"" + }} + else if ("highlightjs"['$===']($case) || "highlight.js"['$===']($case)) { + pre_class = "" + " class=\"highlightjs highlight" + ((function() {if ($truthy(nowrap)) { + return " nowrap" + } else { + return "" + }; return nil; })()) + "\""; + if ($truthy(language)) { + code_attrs = "" + " class=\"language-" + (language) + " hljs\"" + (code_attrs)};} + else if ("prettify"['$===']($case)) { + pre_class = "" + " class=\"prettyprint highlight" + ((function() {if ($truthy(nowrap)) { + return " nowrap" + } else { + return "" + }; return nil; })()) + ((function() {if ($truthy(node['$attr?']("linenums", nil, false))) { + return " linenums" + } else { + return "" + }; return nil; })()) + "\""; + if ($truthy(language)) { + code_attrs = "" + " class=\"language-" + (language) + "\"" + (code_attrs)};} + else if ("html-pipeline"['$===']($case)) { + pre_class = (function() {if ($truthy(language)) { + return "" + " lang=\"" + (language) + "\"" + } else { + return "" + }; return nil; })(); + code_attrs = "";} + else { + pre_class = "" + " class=\"highlight" + ((function() {if ($truthy(nowrap)) { + return " nowrap" + } else { + return "" + }; return nil; })()) + "\""; + if ($truthy(language)) { + code_attrs = "" + " class=\"language-" + (language) + "\"" + (code_attrs)};}; + pre_start = "" + ""; + pre_end = "
    "; + } else { + + pre_start = "" + ""; + pre_end = ""; + }; + id_attribute = (function() {if ($truthy(node.$id())) { + return "" + " id=\"" + (node.$id()) + "\"" + } else { + return "" + }; return nil; })(); + title_element = (function() {if ($truthy(node['$title?']())) { + return "" + "
    " + (node.$captioned_title()) + "
    \n" + } else { + return "" + }; return nil; })(); + return "" + "\n" + (title_element) + "
    \n" + (pre_start) + (node.$content()) + (pre_end) + "\n" + "
    \n" + ""; + }, TMP_Html5Converter_listing_25.$$arity = 1); + + Opal.def(self, '$literal', TMP_Html5Converter_literal_26 = function $$literal(node) { + var $a, self = this, id_attribute = nil, title_element = nil, nowrap = nil, role = nil; + + + id_attribute = (function() {if ($truthy(node.$id())) { + return "" + " id=\"" + (node.$id()) + "\"" + } else { + return "" + }; return nil; })(); + title_element = (function() {if ($truthy(node['$title?']())) { + return "" + "
    " + (node.$title()) + "
    \n" + } else { + return "" + }; return nil; })(); + nowrap = ($truthy($a = node.$document()['$attr?']("prewrap")['$!']()) ? $a : node['$option?']("nowrap")); + return "" + "\n" + (title_element) + "
    \n" + "" + (node.$content()) + "\n" + "
    \n" + ""; + }, TMP_Html5Converter_literal_26.$$arity = 1); + + Opal.def(self, '$stem', TMP_Html5Converter_stem_27 = function $$stem(node) { + var $a, $b, TMP_28, self = this, id_attribute = nil, title_element = nil, style = nil, open = nil, close = nil, equation = nil, br = nil, role = nil; + + + id_attribute = (function() {if ($truthy(node.$id())) { + return "" + " id=\"" + (node.$id()) + "\"" + } else { + return "" + }; return nil; })(); + title_element = (function() {if ($truthy(node['$title?']())) { + return "" + "
    " + (node.$title()) + "
    \n" + } else { + return "" + }; return nil; })(); + $b = $$($nesting, 'BLOCK_MATH_DELIMITERS')['$[]']((style = node.$style().$to_sym())), $a = Opal.to_ary($b), (open = ($a[0] == null ? nil : $a[0])), (close = ($a[1] == null ? nil : $a[1])), $b; + equation = node.$content(); + if ($truthy((($a = style['$==']("asciimath")) ? equation['$include?']($$($nesting, 'LF')) : style['$==']("asciimath")))) { + + br = "" + "" + ($$($nesting, 'LF')); + equation = $send(equation, 'gsub', [$$($nesting, 'StemBreakRx')], (TMP_28 = function(){var self = TMP_28.$$s || this, $c; + + return "" + (close) + ($rb_times(br, (($c = $gvars['~']) === nil ? nil : $c['$[]'](0)).$count($$($nesting, 'LF')))) + (open)}, TMP_28.$$s = self, TMP_28.$$arity = 0, TMP_28));}; + if ($truthy(($truthy($a = equation['$start_with?'](open)) ? equation['$end_with?'](close) : $a))) { + } else { + equation = "" + (open) + (equation) + (close) + }; + return "" + "\n" + (title_element) + "
    \n" + (equation) + "\n" + "
    \n" + ""; + }, TMP_Html5Converter_stem_27.$$arity = 1); + + Opal.def(self, '$olist', TMP_Html5Converter_olist_29 = function $$olist(node) { + var TMP_30, self = this, result = nil, id_attribute = nil, classes = nil, class_attribute = nil, type_attribute = nil, keyword = nil, start_attribute = nil, reversed_attribute = nil; + + + result = []; + id_attribute = (function() {if ($truthy(node.$id())) { + return "" + " id=\"" + (node.$id()) + "\"" + } else { + return "" + }; return nil; })(); + classes = ["olist", node.$style(), node.$role()].$compact(); + class_attribute = "" + " class=\"" + (classes.$join(" ")) + "\""; + result['$<<']("" + ""); + if ($truthy(node['$title?']())) { + result['$<<']("" + "
    " + (node.$title()) + "
    ")}; + type_attribute = (function() {if ($truthy((keyword = node.$list_marker_keyword()))) { + return "" + " type=\"" + (keyword) + "\"" + } else { + return "" + }; return nil; })(); + start_attribute = (function() {if ($truthy(node['$attr?']("start"))) { + return "" + " start=\"" + (node.$attr("start")) + "\"" + } else { + return "" + }; return nil; })(); + reversed_attribute = (function() {if ($truthy(node['$option?']("reversed"))) { + + return self.$append_boolean_attribute("reversed", self.xml_mode); + } else { + return "" + }; return nil; })(); + result['$<<']("" + "
      "); + $send(node.$items(), 'each', [], (TMP_30 = function(item){var self = TMP_30.$$s || this; + + + + if (item == null) { + item = nil; + }; + result['$<<']("
    1. "); + result['$<<']("" + "

      " + (item.$text()) + "

      "); + if ($truthy(item['$blocks?']())) { + result['$<<'](item.$content())}; + return result['$<<']("
    2. ");}, TMP_30.$$s = self, TMP_30.$$arity = 1, TMP_30)); + result['$<<']("
    "); + result['$<<'](""); + return result.$join($$($nesting, 'LF')); + }, TMP_Html5Converter_olist_29.$$arity = 1); + + Opal.def(self, '$open', TMP_Html5Converter_open_31 = function $$open(node) { + var $a, $b, $c, self = this, style = nil, id_attr = nil, title_el = nil, role = nil; + + if ((style = node.$style())['$==']("abstract")) { + if ($truthy((($a = node.$parent()['$=='](node.$document())) ? node.$document().$doctype()['$==']("book") : node.$parent()['$=='](node.$document())))) { + + self.$logger().$warn("abstract block cannot be used in a document without a title when doctype is book. Excluding block content."); + return ""; + } else { + + id_attr = (function() {if ($truthy(node.$id())) { + return "" + " id=\"" + (node.$id()) + "\"" + } else { + return "" + }; return nil; })(); + title_el = (function() {if ($truthy(node['$title?']())) { + return "" + "
    " + (node.$title()) + "
    \n" + } else { + return "" + }; return nil; })(); + return "" + "\n" + (title_el) + "
    \n" + (node.$content()) + "\n" + "
    \n" + ""; + } + } else if ($truthy((($a = style['$==']("partintro")) ? ($truthy($b = ($truthy($c = $rb_gt(node.$level(), 0)) ? $c : node.$parent().$context()['$!=']("section"))) ? $b : node.$document().$doctype()['$!=']("book")) : style['$==']("partintro")))) { + + self.$logger().$error("partintro block can only be used when doctype is book and must be a child of a book part. Excluding block content."); + return ""; + } else { + + id_attr = (function() {if ($truthy(node.$id())) { + return "" + " id=\"" + (node.$id()) + "\"" + } else { + return "" + }; return nil; })(); + title_el = (function() {if ($truthy(node['$title?']())) { + return "" + "
    " + (node.$title()) + "
    \n" + } else { + return "" + }; return nil; })(); + return "" + "" + }, TMP_Html5Converter_page_break_32.$$arity = 1); + + Opal.def(self, '$paragraph', TMP_Html5Converter_paragraph_33 = function $$paragraph(node) { + var self = this, class_attribute = nil, attributes = nil; + + + class_attribute = (function() {if ($truthy(node.$role())) { + return "" + "class=\"paragraph " + (node.$role()) + "\"" + } else { + return "class=\"paragraph\"" + }; return nil; })(); + attributes = (function() {if ($truthy(node.$id())) { + return "" + "id=\"" + (node.$id()) + "\" " + (class_attribute) + } else { + return class_attribute + }; return nil; })(); + if ($truthy(node['$title?']())) { + return "" + "
    \n" + "
    " + (node.$title()) + "
    \n" + "

    " + (node.$content()) + "

    \n" + "
    " + } else { + return "" + "
    \n" + "

    " + (node.$content()) + "

    \n" + "
    " + }; + }, TMP_Html5Converter_paragraph_33.$$arity = 1); + + Opal.def(self, '$preamble', TMP_Html5Converter_preamble_34 = function $$preamble(node) { + var $a, $b, self = this, doc = nil, toc = nil; + + + if ($truthy(($truthy($a = ($truthy($b = (doc = node.$document())['$attr?']("toc-placement", "preamble")) ? doc['$sections?']() : $b)) ? doc['$attr?']("toc") : $a))) { + toc = "" + "\n" + "
    \n" + "
    " + (doc.$attr("toc-title")) + "
    \n" + (self.$outline(doc)) + "\n" + "
    " + } else { + toc = "" + }; + return "" + "
    \n" + "
    \n" + (node.$content()) + "\n" + "
    " + (toc) + "\n" + "
    "; + }, TMP_Html5Converter_preamble_34.$$arity = 1); + + Opal.def(self, '$quote', TMP_Html5Converter_quote_35 = function $$quote(node) { + var $a, self = this, id_attribute = nil, classes = nil, class_attribute = nil, title_element = nil, attribution = nil, citetitle = nil, cite_element = nil, attribution_text = nil, attribution_element = nil; + + + id_attribute = (function() {if ($truthy(node.$id())) { + return "" + " id=\"" + (node.$id()) + "\"" + } else { + return "" + }; return nil; })(); + classes = ["quoteblock", node.$role()].$compact(); + class_attribute = "" + " class=\"" + (classes.$join(" ")) + "\""; + title_element = (function() {if ($truthy(node['$title?']())) { + return "" + "\n
    " + (node.$title()) + "
    " + } else { + return "" + }; return nil; })(); + attribution = (function() {if ($truthy(node['$attr?']("attribution"))) { + + return node.$attr("attribution"); + } else { + return nil + }; return nil; })(); + citetitle = (function() {if ($truthy(node['$attr?']("citetitle"))) { + + return node.$attr("citetitle"); + } else { + return nil + }; return nil; })(); + if ($truthy(($truthy($a = attribution) ? $a : citetitle))) { + + cite_element = (function() {if ($truthy(citetitle)) { + return "" + "" + (citetitle) + "" + } else { + return "" + }; return nil; })(); + attribution_text = (function() {if ($truthy(attribution)) { + return "" + "— " + (attribution) + ((function() {if ($truthy(citetitle)) { + return "" + "\n" + } else { + return "" + }; return nil; })()) + } else { + return "" + }; return nil; })(); + attribution_element = "" + "\n
    \n" + (attribution_text) + (cite_element) + "\n
    "; + } else { + attribution_element = "" + }; + return "" + "" + (title_element) + "\n" + "
    \n" + (node.$content()) + "\n" + "
    " + (attribution_element) + "\n" + ""; + }, TMP_Html5Converter_quote_35.$$arity = 1); + + Opal.def(self, '$thematic_break', TMP_Html5Converter_thematic_break_36 = function $$thematic_break(node) { + var self = this; + + return "" + "" + }, TMP_Html5Converter_thematic_break_36.$$arity = 1); + + Opal.def(self, '$sidebar', TMP_Html5Converter_sidebar_37 = function $$sidebar(node) { + var self = this, id_attribute = nil, title_element = nil, role = nil; + + + id_attribute = (function() {if ($truthy(node.$id())) { + return "" + " id=\"" + (node.$id()) + "\"" + } else { + return "" + }; return nil; })(); + title_element = (function() {if ($truthy(node['$title?']())) { + return "" + "
    " + (node.$title()) + "
    \n" + } else { + return "" + }; return nil; })(); + return "" + "\n" + "
    \n" + (title_element) + (node.$content()) + "\n" + "
    \n" + ""; + }, TMP_Html5Converter_sidebar_37.$$arity = 1); + + Opal.def(self, '$table', TMP_Html5Converter_table_38 = function $$table(node) { + var $a, TMP_39, TMP_40, self = this, result = nil, id_attribute = nil, classes = nil, stripes = nil, styles = nil, autowidth = nil, tablewidth = nil, role = nil, class_attribute = nil, style_attribute = nil, slash = nil; + + + result = []; + id_attribute = (function() {if ($truthy(node.$id())) { + return "" + " id=\"" + (node.$id()) + "\"" + } else { + return "" + }; return nil; })(); + classes = ["tableblock", "" + "frame-" + (node.$attr("frame", "all")), "" + "grid-" + (node.$attr("grid", "all"))]; + if ($truthy((stripes = node.$attr("stripes")))) { + classes['$<<']("" + "stripes-" + (stripes))}; + styles = []; + if ($truthy(($truthy($a = (autowidth = node.$attributes()['$[]']("autowidth-option"))) ? node['$attr?']("width", nil, false)['$!']() : $a))) { + classes['$<<']("fit-content") + } else if ((tablewidth = node.$attr("tablepcwidth"))['$=='](100)) { + classes['$<<']("stretch") + } else { + styles['$<<']("" + "width: " + (tablewidth) + "%;") + }; + if ($truthy(node['$attr?']("float"))) { + classes['$<<'](node.$attr("float"))}; + if ($truthy((role = node.$role()))) { + classes['$<<'](role)}; + class_attribute = "" + " class=\"" + (classes.$join(" ")) + "\""; + style_attribute = (function() {if ($truthy(styles['$empty?']())) { + return "" + } else { + return "" + " style=\"" + (styles.$join(" ")) + "\"" + }; return nil; })(); + result['$<<']("" + ""); + if ($truthy(node['$title?']())) { + result['$<<']("" + "" + (node.$captioned_title()) + "")}; + if ($truthy($rb_gt(node.$attr("rowcount"), 0))) { + + slash = self.void_element_slash; + result['$<<'](""); + if ($truthy(autowidth)) { + result = $rb_plus(result, $$($nesting, 'Array').$new(node.$columns().$size(), "" + "")) + } else { + $send(node.$columns(), 'each', [], (TMP_39 = function(col){var self = TMP_39.$$s || this; + + + + if (col == null) { + col = nil; + }; + return result['$<<']((function() {if ($truthy(col.$attributes()['$[]']("autowidth-option"))) { + return "" + "" + } else { + return "" + "" + }; return nil; })());}, TMP_39.$$s = self, TMP_39.$$arity = 1, TMP_39)) + }; + result['$<<'](""); + $send(node.$rows().$by_section(), 'each', [], (TMP_40 = function(tsec, rows){var self = TMP_40.$$s || this, TMP_41; + + + + if (tsec == null) { + tsec = nil; + }; + + if (rows == null) { + rows = nil; + }; + if ($truthy(rows['$empty?']())) { + return nil;}; + result['$<<']("" + ""); + $send(rows, 'each', [], (TMP_41 = function(row){var self = TMP_41.$$s || this, TMP_42; + + + + if (row == null) { + row = nil; + }; + result['$<<'](""); + $send(row, 'each', [], (TMP_42 = function(cell){var self = TMP_42.$$s || this, $b, cell_content = nil, $case = nil, cell_tag_name = nil, cell_class_attribute = nil, cell_colspan_attribute = nil, cell_rowspan_attribute = nil, cell_style_attribute = nil; + + + + if (cell == null) { + cell = nil; + }; + if (tsec['$==']("head")) { + cell_content = cell.$text() + } else { + $case = cell.$style(); + if ("asciidoc"['$===']($case)) {cell_content = "" + "
    " + (cell.$content()) + "
    "} + else if ("verse"['$===']($case)) {cell_content = "" + "
    " + (cell.$text()) + "
    "} + else if ("literal"['$===']($case)) {cell_content = "" + "
    " + (cell.$text()) + "
    "} + else {cell_content = (function() {if ($truthy((cell_content = cell.$content())['$empty?']())) { + return "" + } else { + return "" + "

    " + (cell_content.$join("" + "

    \n" + "

    ")) + "

    " + }; return nil; })()} + }; + cell_tag_name = (function() {if ($truthy(($truthy($b = tsec['$==']("head")) ? $b : cell.$style()['$==']("header")))) { + return "th" + } else { + return "td" + }; return nil; })(); + cell_class_attribute = "" + " class=\"tableblock halign-" + (cell.$attr("halign")) + " valign-" + (cell.$attr("valign")) + "\""; + cell_colspan_attribute = (function() {if ($truthy(cell.$colspan())) { + return "" + " colspan=\"" + (cell.$colspan()) + "\"" + } else { + return "" + }; return nil; })(); + cell_rowspan_attribute = (function() {if ($truthy(cell.$rowspan())) { + return "" + " rowspan=\"" + (cell.$rowspan()) + "\"" + } else { + return "" + }; return nil; })(); + cell_style_attribute = (function() {if ($truthy(node.$document()['$attr?']("cellbgcolor"))) { + return "" + " style=\"background-color: " + (node.$document().$attr("cellbgcolor")) + ";\"" + } else { + return "" + }; return nil; })(); + return result['$<<']("" + "<" + (cell_tag_name) + (cell_class_attribute) + (cell_colspan_attribute) + (cell_rowspan_attribute) + (cell_style_attribute) + ">" + (cell_content) + "");}, TMP_42.$$s = self, TMP_42.$$arity = 1, TMP_42)); + return result['$<<']("");}, TMP_41.$$s = self, TMP_41.$$arity = 1, TMP_41)); + return result['$<<']("" + "
    ");}, TMP_40.$$s = self, TMP_40.$$arity = 2, TMP_40));}; + result['$<<'](""); + return result.$join($$($nesting, 'LF')); + }, TMP_Html5Converter_table_38.$$arity = 1); + + Opal.def(self, '$toc', TMP_Html5Converter_toc_43 = function $$toc(node) { + var $a, $b, self = this, doc = nil, id_attr = nil, title_id_attr = nil, title = nil, levels = nil, role = nil; + + + if ($truthy(($truthy($a = ($truthy($b = (doc = node.$document())['$attr?']("toc-placement", "macro")) ? doc['$sections?']() : $b)) ? doc['$attr?']("toc") : $a))) { + } else { + return "" + }; + if ($truthy(node.$id())) { + + id_attr = "" + " id=\"" + (node.$id()) + "\""; + title_id_attr = "" + " id=\"" + (node.$id()) + "title\""; + } else { + + id_attr = " id=\"toc\""; + title_id_attr = " id=\"toctitle\""; + }; + title = (function() {if ($truthy(node['$title?']())) { + return node.$title() + } else { + + return doc.$attr("toc-title"); + }; return nil; })(); + levels = (function() {if ($truthy(node['$attr?']("levels"))) { + return node.$attr("levels").$to_i() + } else { + return nil + }; return nil; })(); + role = (function() {if ($truthy(node['$role?']())) { + return node.$role() + } else { + + return doc.$attr("toc-class", "toc"); + }; return nil; })(); + return "" + "\n" + "" + (title) + "\n" + (self.$outline(doc, $hash2(["toclevels"], {"toclevels": levels}))) + "\n" + ""; + }, TMP_Html5Converter_toc_43.$$arity = 1); + + Opal.def(self, '$ulist', TMP_Html5Converter_ulist_44 = function $$ulist(node) { + var TMP_45, self = this, result = nil, id_attribute = nil, div_classes = nil, marker_checked = nil, marker_unchecked = nil, checklist = nil, ul_class_attribute = nil; + + + result = []; + id_attribute = (function() {if ($truthy(node.$id())) { + return "" + " id=\"" + (node.$id()) + "\"" + } else { + return "" + }; return nil; })(); + div_classes = ["ulist", node.$style(), node.$role()].$compact(); + marker_checked = (marker_unchecked = ""); + if ($truthy((checklist = node['$option?']("checklist")))) { + + div_classes.$unshift(div_classes.$shift(), "checklist"); + ul_class_attribute = " class=\"checklist\""; + if ($truthy(node['$option?']("interactive"))) { + if ($truthy(self.xml_mode)) { + + marker_checked = " "; + marker_unchecked = " "; + } else { + + marker_checked = " "; + marker_unchecked = " "; + } + } else if ($truthy(node.$document()['$attr?']("icons", "font"))) { + + marker_checked = " "; + marker_unchecked = " "; + } else { + + marker_checked = "✓ "; + marker_unchecked = "❏ "; + }; + } else { + ul_class_attribute = (function() {if ($truthy(node.$style())) { + return "" + " class=\"" + (node.$style()) + "\"" + } else { + return "" + }; return nil; })() + }; + result['$<<']("" + ""); + if ($truthy(node['$title?']())) { + result['$<<']("" + "
    " + (node.$title()) + "
    ")}; + result['$<<']("" + ""); + $send(node.$items(), 'each', [], (TMP_45 = function(item){var self = TMP_45.$$s || this, $a; + + + + if (item == null) { + item = nil; + }; + result['$<<']("
  • "); + if ($truthy(($truthy($a = checklist) ? item['$attr?']("checkbox") : $a))) { + result['$<<']("" + "

    " + ((function() {if ($truthy(item['$attr?']("checked"))) { + return marker_checked + } else { + return marker_unchecked + }; return nil; })()) + (item.$text()) + "

    ") + } else { + result['$<<']("" + "

    " + (item.$text()) + "

    ") + }; + if ($truthy(item['$blocks?']())) { + result['$<<'](item.$content())}; + return result['$<<']("
  • ");}, TMP_45.$$s = self, TMP_45.$$arity = 1, TMP_45)); + result['$<<'](""); + result['$<<'](""); + return result.$join($$($nesting, 'LF')); + }, TMP_Html5Converter_ulist_44.$$arity = 1); + + Opal.def(self, '$verse', TMP_Html5Converter_verse_46 = function $$verse(node) { + var $a, self = this, id_attribute = nil, classes = nil, class_attribute = nil, title_element = nil, attribution = nil, citetitle = nil, cite_element = nil, attribution_text = nil, attribution_element = nil; + + + id_attribute = (function() {if ($truthy(node.$id())) { + return "" + " id=\"" + (node.$id()) + "\"" + } else { + return "" + }; return nil; })(); + classes = ["verseblock", node.$role()].$compact(); + class_attribute = "" + " class=\"" + (classes.$join(" ")) + "\""; + title_element = (function() {if ($truthy(node['$title?']())) { + return "" + "\n
    " + (node.$title()) + "
    " + } else { + return "" + }; return nil; })(); + attribution = (function() {if ($truthy(node['$attr?']("attribution"))) { + + return node.$attr("attribution"); + } else { + return nil + }; return nil; })(); + citetitle = (function() {if ($truthy(node['$attr?']("citetitle"))) { + + return node.$attr("citetitle"); + } else { + return nil + }; return nil; })(); + if ($truthy(($truthy($a = attribution) ? $a : citetitle))) { + + cite_element = (function() {if ($truthy(citetitle)) { + return "" + "" + (citetitle) + "" + } else { + return "" + }; return nil; })(); + attribution_text = (function() {if ($truthy(attribution)) { + return "" + "— " + (attribution) + ((function() {if ($truthy(citetitle)) { + return "" + "\n" + } else { + return "" + }; return nil; })()) + } else { + return "" + }; return nil; })(); + attribution_element = "" + "\n
    \n" + (attribution_text) + (cite_element) + "\n
    "; + } else { + attribution_element = "" + }; + return "" + "" + (title_element) + "\n" + "
    " + (node.$content()) + "
    " + (attribution_element) + "\n" + ""; + }, TMP_Html5Converter_verse_46.$$arity = 1); + + Opal.def(self, '$video', TMP_Html5Converter_video_47 = function $$video(node) { + var $a, $b, self = this, xml = nil, id_attribute = nil, classes = nil, class_attribute = nil, title_element = nil, width_attribute = nil, height_attribute = nil, $case = nil, asset_uri_scheme = nil, start_anchor = nil, delimiter = nil, autoplay_param = nil, loop_param = nil, rel_param_val = nil, start_param = nil, end_param = nil, has_loop_param = nil, controls_param = nil, fs_param = nil, fs_attribute = nil, modest_param = nil, theme_param = nil, hl_param = nil, target = nil, list = nil, list_param = nil, playlist = nil, poster_attribute = nil, val = nil, preload_attribute = nil, start_t = nil, end_t = nil, time_anchor = nil; + + + xml = self.xml_mode; + id_attribute = (function() {if ($truthy(node.$id())) { + return "" + " id=\"" + (node.$id()) + "\"" + } else { + return "" + }; return nil; })(); + classes = ["videoblock"]; + if ($truthy(node['$attr?']("float"))) { + classes['$<<'](node.$attr("float"))}; + if ($truthy(node['$attr?']("align"))) { + classes['$<<']("" + "text-" + (node.$attr("align")))}; + if ($truthy(node.$role())) { + classes['$<<'](node.$role())}; + class_attribute = "" + " class=\"" + (classes.$join(" ")) + "\""; + title_element = (function() {if ($truthy(node['$title?']())) { + return "" + "\n
    " + (node.$title()) + "
    " + } else { + return "" + }; return nil; })(); + width_attribute = (function() {if ($truthy(node['$attr?']("width"))) { + return "" + " width=\"" + (node.$attr("width")) + "\"" + } else { + return "" + }; return nil; })(); + height_attribute = (function() {if ($truthy(node['$attr?']("height"))) { + return "" + " height=\"" + (node.$attr("height")) + "\"" + } else { + return "" + }; return nil; })(); + return (function() {$case = node.$attr("poster"); + if ("vimeo"['$===']($case)) { + if ($truthy((asset_uri_scheme = node.$document().$attr("asset-uri-scheme", "https"))['$empty?']())) { + } else { + asset_uri_scheme = "" + (asset_uri_scheme) + ":" + }; + start_anchor = (function() {if ($truthy(node['$attr?']("start", nil, false))) { + return "" + "#at=" + (node.$attr("start")) + } else { + return "" + }; return nil; })(); + delimiter = "?"; + if ($truthy(node['$option?']("autoplay"))) { + + autoplay_param = "" + (delimiter) + "autoplay=1"; + delimiter = "&"; + } else { + autoplay_param = "" + }; + loop_param = (function() {if ($truthy(node['$option?']("loop"))) { + return "" + (delimiter) + "loop=1" + } else { + return "" + }; return nil; })(); + return "" + "" + (title_element) + "\n" + "
    \n" + "\n" + "
    \n" + "";} + else if ("youtube"['$===']($case)) { + if ($truthy((asset_uri_scheme = node.$document().$attr("asset-uri-scheme", "https"))['$empty?']())) { + } else { + asset_uri_scheme = "" + (asset_uri_scheme) + ":" + }; + rel_param_val = (function() {if ($truthy(node['$option?']("related"))) { + return 1 + } else { + return 0 + }; return nil; })(); + start_param = (function() {if ($truthy(node['$attr?']("start", nil, false))) { + return "" + "&start=" + (node.$attr("start")) + } else { + return "" + }; return nil; })(); + end_param = (function() {if ($truthy(node['$attr?']("end", nil, false))) { + return "" + "&end=" + (node.$attr("end")) + } else { + return "" + }; return nil; })(); + autoplay_param = (function() {if ($truthy(node['$option?']("autoplay"))) { + return "&autoplay=1" + } else { + return "" + }; return nil; })(); + loop_param = (function() {if ($truthy((has_loop_param = node['$option?']("loop")))) { + return "&loop=1" + } else { + return "" + }; return nil; })(); + controls_param = (function() {if ($truthy(node['$option?']("nocontrols"))) { + return "&controls=0" + } else { + return "" + }; return nil; })(); + if ($truthy(node['$option?']("nofullscreen"))) { + + fs_param = "&fs=0"; + fs_attribute = ""; + } else { + + fs_param = ""; + fs_attribute = self.$append_boolean_attribute("allowfullscreen", xml); + }; + modest_param = (function() {if ($truthy(node['$option?']("modest"))) { + return "&modestbranding=1" + } else { + return "" + }; return nil; })(); + theme_param = (function() {if ($truthy(node['$attr?']("theme", nil, false))) { + return "" + "&theme=" + (node.$attr("theme")) + } else { + return "" + }; return nil; })(); + hl_param = (function() {if ($truthy(node['$attr?']("lang"))) { + return "" + "&hl=" + (node.$attr("lang")) + } else { + return "" + }; return nil; })(); + $b = node.$attr("target").$split("/", 2), $a = Opal.to_ary($b), (target = ($a[0] == null ? nil : $a[0])), (list = ($a[1] == null ? nil : $a[1])), $b; + if ($truthy((list = ($truthy($a = list) ? $a : node.$attr("list", nil, false))))) { + list_param = "" + "&list=" + (list) + } else { + + $b = target.$split(",", 2), $a = Opal.to_ary($b), (target = ($a[0] == null ? nil : $a[0])), (playlist = ($a[1] == null ? nil : $a[1])), $b; + if ($truthy((playlist = ($truthy($a = playlist) ? $a : node.$attr("playlist", nil, false))))) { + list_param = "" + "&playlist=" + (playlist) + } else { + list_param = (function() {if ($truthy(has_loop_param)) { + return "" + "&playlist=" + (target) + } else { + return "" + }; return nil; })() + }; + }; + return "" + "" + (title_element) + "\n" + "
    \n" + "\n" + "
    \n" + "";} + else { + poster_attribute = (function() {if ($truthy((val = node.$attr("poster", nil, false))['$nil_or_empty?']())) { + return "" + } else { + return "" + " poster=\"" + (node.$media_uri(val)) + "\"" + }; return nil; })(); + preload_attribute = (function() {if ($truthy((val = node.$attr("preload", nil, false))['$nil_or_empty?']())) { + return "" + } else { + return "" + " preload=\"" + (val) + "\"" + }; return nil; })(); + start_t = node.$attr("start", nil, false); + end_t = node.$attr("end", nil, false); + time_anchor = (function() {if ($truthy(($truthy($a = start_t) ? $a : end_t))) { + return "" + "#t=" + (($truthy($a = start_t) ? $a : "")) + ((function() {if ($truthy(end_t)) { + return "" + "," + (end_t) + } else { + return "" + }; return nil; })()) + } else { + return "" + }; return nil; })(); + return "" + "" + (title_element) + "\n" + "
    \n" + "\n" + "
    \n" + "";}})(); + }, TMP_Html5Converter_video_47.$$arity = 1); + + Opal.def(self, '$inline_anchor', TMP_Html5Converter_inline_anchor_48 = function $$inline_anchor(node) { + var $a, self = this, $case = nil, path = nil, attrs = nil, text = nil, refid = nil, ref = nil; + + return (function() {$case = node.$type(); + if ("xref"['$===']($case)) { + if ($truthy((path = node.$attributes()['$[]']("path")))) { + + attrs = self.$append_link_constraint_attrs(node, (function() {if ($truthy(node.$role())) { + return ["" + " class=\"" + (node.$role()) + "\""] + } else { + return [] + }; return nil; })()).$join(); + text = ($truthy($a = node.$text()) ? $a : path); + } else { + + attrs = (function() {if ($truthy(node.$role())) { + return "" + " class=\"" + (node.$role()) + "\"" + } else { + return "" + }; return nil; })(); + if ($truthy((text = node.$text()))) { + } else { + + refid = node.$attributes()['$[]']("refid"); + if ($truthy($$($nesting, 'AbstractNode')['$===']((ref = (self.refs = ($truthy($a = self.refs) ? $a : node.$document().$catalog()['$[]']("refs")))['$[]'](refid))))) { + text = ($truthy($a = ref.$xreftext(node.$attr("xrefstyle"))) ? $a : "" + "[" + (refid) + "]") + } else { + text = "" + "[" + (refid) + "]" + }; + }; + }; + return "" + "" + (text) + "";} + else if ("ref"['$===']($case)) {return "" + ""} + else if ("link"['$===']($case)) { + attrs = (function() {if ($truthy(node.$id())) { + return ["" + " id=\"" + (node.$id()) + "\""] + } else { + return [] + }; return nil; })(); + if ($truthy(node.$role())) { + attrs['$<<']("" + " class=\"" + (node.$role()) + "\"")}; + if ($truthy(node['$attr?']("title", nil, false))) { + attrs['$<<']("" + " title=\"" + (node.$attr("title")) + "\"")}; + return "" + "" + (node.$text()) + "";} + else if ("bibref"['$===']($case)) {return "" + "" + (node.$text())} + else { + self.$logger().$warn("" + "unknown anchor type: " + (node.$type().$inspect())); + return nil;}})() + }, TMP_Html5Converter_inline_anchor_48.$$arity = 1); + + Opal.def(self, '$inline_break', TMP_Html5Converter_inline_break_49 = function $$inline_break(node) { + var self = this; + + return "" + (node.$text()) + "" + }, TMP_Html5Converter_inline_break_49.$$arity = 1); + + Opal.def(self, '$inline_button', TMP_Html5Converter_inline_button_50 = function $$inline_button(node) { + var self = this; + + return "" + "" + (node.$text()) + "" + }, TMP_Html5Converter_inline_button_50.$$arity = 1); + + Opal.def(self, '$inline_callout', TMP_Html5Converter_inline_callout_51 = function $$inline_callout(node) { + var self = this, src = nil; + + if ($truthy(node.$document()['$attr?']("icons", "font"))) { + return "" + "(" + (node.$text()) + ")" + } else if ($truthy(node.$document()['$attr?']("icons"))) { + + src = node.$icon_uri("" + "callouts/" + (node.$text())); + return "" + "\"""; + } else { + return "" + (node.$attributes()['$[]']("guard")) + "(" + (node.$text()) + ")" + } + }, TMP_Html5Converter_inline_callout_51.$$arity = 1); + + Opal.def(self, '$inline_footnote', TMP_Html5Converter_inline_footnote_52 = function $$inline_footnote(node) { + var self = this, index = nil, id_attr = nil; + + if ($truthy((index = node.$attr("index", nil, false)))) { + if (node.$type()['$==']("xref")) { + return "" + "[" + (index) + "]" + } else { + + id_attr = (function() {if ($truthy(node.$id())) { + return "" + " id=\"_footnote_" + (node.$id()) + "\"" + } else { + return "" + }; return nil; })(); + return "" + "[" + (index) + "]"; + } + } else if (node.$type()['$==']("xref")) { + return "" + "[" + (node.$text()) + "]" + } else { + return nil + } + }, TMP_Html5Converter_inline_footnote_52.$$arity = 1); + + Opal.def(self, '$inline_image', TMP_Html5Converter_inline_image_53 = function $$inline_image(node) { + var $a, TMP_54, TMP_55, $b, $c, $d, self = this, type = nil, class_attr_val = nil, title_attr = nil, img = nil, target = nil, attrs = nil, svg = nil, obj = nil, fallback = nil, role = nil; + + + if ($truthy((($a = (type = node.$type())['$==']("icon")) ? node.$document()['$attr?']("icons", "font") : (type = node.$type())['$==']("icon")))) { + + class_attr_val = "" + "fa fa-" + (node.$target()); + $send($hash2(["size", "rotate", "flip"], {"size": "fa-", "rotate": "fa-rotate-", "flip": "fa-flip-"}), 'each', [], (TMP_54 = function(key, prefix){var self = TMP_54.$$s || this; + + + + if (key == null) { + key = nil; + }; + + if (prefix == null) { + prefix = nil; + }; + if ($truthy(node['$attr?'](key))) { + return (class_attr_val = "" + (class_attr_val) + " " + (prefix) + (node.$attr(key))) + } else { + return nil + };}, TMP_54.$$s = self, TMP_54.$$arity = 2, TMP_54)); + title_attr = (function() {if ($truthy(node['$attr?']("title"))) { + return "" + " title=\"" + (node.$attr("title")) + "\"" + } else { + return "" + }; return nil; })(); + img = "" + ""; + } else if ($truthy((($a = type['$==']("icon")) ? node.$document()['$attr?']("icons")['$!']() : type['$==']("icon")))) { + img = "" + "[" + (node.$alt()) + "]" + } else { + + target = node.$target(); + attrs = $send(["width", "height", "title"], 'map', [], (TMP_55 = function(name){var self = TMP_55.$$s || this; + + + + if (name == null) { + name = nil; + }; + if ($truthy(node['$attr?'](name))) { + return "" + " " + (name) + "=\"" + (node.$attr(name)) + "\"" + } else { + return "" + };}, TMP_55.$$s = self, TMP_55.$$arity = 1, TMP_55)).$join(); + if ($truthy(($truthy($a = ($truthy($b = ($truthy($c = type['$!=']("icon")) ? ($truthy($d = node['$attr?']("format", "svg", false)) ? $d : target['$include?'](".svg")) : $c)) ? $rb_lt(node.$document().$safe(), $$$($$($nesting, 'SafeMode'), 'SECURE')) : $b)) ? ($truthy($b = (svg = node['$option?']("inline"))) ? $b : (obj = node['$option?']("interactive"))) : $a))) { + if ($truthy(svg)) { + img = ($truthy($a = self.$read_svg_contents(node, target)) ? $a : "" + "" + (node.$alt()) + "") + } else if ($truthy(obj)) { + + fallback = (function() {if ($truthy(node['$attr?']("fallback"))) { + return "" + "\""" + } else { + return "" + "" + (node.$alt()) + "" + }; return nil; })(); + img = "" + "" + (fallback) + "";}}; + img = ($truthy($a = img) ? $a : "" + "\"""); + }; + if ($truthy(node['$attr?']("link", nil, false))) { + img = "" + "" + (img) + ""}; + if ($truthy((role = node.$role()))) { + if ($truthy(node['$attr?']("float"))) { + class_attr_val = "" + (type) + " " + (node.$attr("float")) + " " + (role) + } else { + class_attr_val = "" + (type) + " " + (role) + } + } else if ($truthy(node['$attr?']("float"))) { + class_attr_val = "" + (type) + " " + (node.$attr("float")) + } else { + class_attr_val = type + }; + return "" + "" + (img) + ""; + }, TMP_Html5Converter_inline_image_53.$$arity = 1); + + Opal.def(self, '$inline_indexterm', TMP_Html5Converter_inline_indexterm_56 = function $$inline_indexterm(node) { + var self = this; + + if (node.$type()['$==']("visible")) { + return node.$text() + } else { + return "" + } + }, TMP_Html5Converter_inline_indexterm_56.$$arity = 1); + + Opal.def(self, '$inline_kbd', TMP_Html5Converter_inline_kbd_57 = function $$inline_kbd(node) { + var self = this, keys = nil; + + if ((keys = node.$attr("keys")).$size()['$=='](1)) { + return "" + "" + (keys['$[]'](0)) + "" + } else { + return "" + "" + (keys.$join("+")) + "" + } + }, TMP_Html5Converter_inline_kbd_57.$$arity = 1); + + Opal.def(self, '$inline_menu', TMP_Html5Converter_inline_menu_58 = function $$inline_menu(node) { + var self = this, caret = nil, submenu_joiner = nil, menu = nil, submenus = nil, menuitem = nil; + + + caret = (function() {if ($truthy(node.$document()['$attr?']("icons", "font"))) { + return "  " + } else { + return "  " + }; return nil; })(); + submenu_joiner = "" + "
    " + (caret) + ""; + menu = node.$attr("menu"); + if ($truthy((submenus = node.$attr("submenus"))['$empty?']())) { + if ($truthy((menuitem = node.$attr("menuitem", nil, false)))) { + return "" + "" + (menu) + "" + (caret) + "" + (menuitem) + "" + } else { + return "" + "" + (menu) + "" + } + } else { + return "" + "" + (menu) + "" + (caret) + "" + (submenus.$join(submenu_joiner)) + "" + (caret) + "" + (node.$attr("menuitem")) + "" + }; + }, TMP_Html5Converter_inline_menu_58.$$arity = 1); + + Opal.def(self, '$inline_quoted', TMP_Html5Converter_inline_quoted_59 = function $$inline_quoted(node) { + var $a, $b, self = this, open = nil, close = nil, is_tag = nil, class_attr = nil, id_attr = nil; + + + $b = $$($nesting, 'QUOTE_TAGS')['$[]'](node.$type()), $a = Opal.to_ary($b), (open = ($a[0] == null ? nil : $a[0])), (close = ($a[1] == null ? nil : $a[1])), (is_tag = ($a[2] == null ? nil : $a[2])), $b; + if ($truthy(node.$role())) { + class_attr = "" + " class=\"" + (node.$role()) + "\""}; + if ($truthy(node.$id())) { + id_attr = "" + " id=\"" + (node.$id()) + "\""}; + if ($truthy(($truthy($a = class_attr) ? $a : id_attr))) { + if ($truthy(is_tag)) { + return "" + (open.$chop()) + (($truthy($a = id_attr) ? $a : "")) + (($truthy($a = class_attr) ? $a : "")) + ">" + (node.$text()) + (close) + } else { + return "" + "" + (open) + (node.$text()) + (close) + "" + } + } else { + return "" + (open) + (node.$text()) + (close) + }; + }, TMP_Html5Converter_inline_quoted_59.$$arity = 1); + + Opal.def(self, '$append_boolean_attribute', TMP_Html5Converter_append_boolean_attribute_60 = function $$append_boolean_attribute(name, xml) { + var self = this; + + if ($truthy(xml)) { + return "" + " " + (name) + "=\"" + (name) + "\"" + } else { + return "" + " " + (name) + } + }, TMP_Html5Converter_append_boolean_attribute_60.$$arity = 2); + + Opal.def(self, '$encode_quotes', TMP_Html5Converter_encode_quotes_61 = function $$encode_quotes(val) { + var self = this; + + if ($truthy(val['$include?']("\""))) { + + return val.$gsub("\"", """); + } else { + return val + } + }, TMP_Html5Converter_encode_quotes_61.$$arity = 1); + + Opal.def(self, '$generate_manname_section', TMP_Html5Converter_generate_manname_section_62 = function $$generate_manname_section(node) { + var $a, self = this, manname_title = nil, next_section = nil, next_section_title = nil, manname_id_attr = nil, manname_id = nil; + + + manname_title = node.$attr("manname-title", "Name"); + if ($truthy(($truthy($a = (next_section = node.$sections()['$[]'](0))) ? (next_section_title = next_section.$title())['$=='](next_section_title.$upcase()) : $a))) { + manname_title = manname_title.$upcase()}; + manname_id_attr = (function() {if ($truthy((manname_id = node.$attr("manname-id")))) { + return "" + " id=\"" + (manname_id) + "\"" + } else { + return "" + }; return nil; })(); + return "" + "" + (manname_title) + "\n" + "
    \n" + "

    " + (node.$attr("manname")) + " - " + (node.$attr("manpurpose")) + "

    \n" + "
    "; + }, TMP_Html5Converter_generate_manname_section_62.$$arity = 1); + + Opal.def(self, '$append_link_constraint_attrs', TMP_Html5Converter_append_link_constraint_attrs_63 = function $$append_link_constraint_attrs(node, attrs) { + var $a, self = this, rel = nil, window = nil; + + + + if (attrs == null) { + attrs = []; + }; + if ($truthy(node['$option?']("nofollow"))) { + rel = "nofollow"}; + if ($truthy((window = node.$attributes()['$[]']("window")))) { + + attrs['$<<']("" + " target=\"" + (window) + "\""); + if ($truthy(($truthy($a = window['$==']("_blank")) ? $a : node['$option?']("noopener")))) { + attrs['$<<']((function() {if ($truthy(rel)) { + return "" + " rel=\"" + (rel) + " noopener\"" + } else { + return " rel=\"noopener\"" + }; return nil; })())}; + } else if ($truthy(rel)) { + attrs['$<<']("" + " rel=\"" + (rel) + "\"")}; + return attrs; + }, TMP_Html5Converter_append_link_constraint_attrs_63.$$arity = -2); + return (Opal.def(self, '$read_svg_contents', TMP_Html5Converter_read_svg_contents_64 = function $$read_svg_contents(node, target) { + var TMP_65, self = this, svg = nil, old_start_tag = nil, new_start_tag = nil; + + + if ($truthy((svg = node.$read_contents(target, $hash2(["start", "normalize", "label"], {"start": node.$document().$attr("imagesdir"), "normalize": true, "label": "SVG"}))))) { + + if ($truthy(svg['$start_with?'](""); + } else { + return nil + };}, TMP_65.$$s = self, TMP_65.$$arity = 1, TMP_65)); + if ($truthy(new_start_tag)) { + svg = "" + (new_start_tag) + (svg['$[]'](Opal.Range.$new(old_start_tag.$length(), -1, false)))};}; + return svg; + }, TMP_Html5Converter_read_svg_contents_64.$$arity = 2), nil) && 'read_svg_contents'; + })($$($nesting, 'Converter'), $$$($$($nesting, 'Converter'), 'BuiltIn'), $nesting) + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/extensions"] = function(Opal) { + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + function $rb_plus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); + } + function $rb_gt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); + } + function $rb_lt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); + } + var $a, self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $truthy = Opal.truthy, $module = Opal.module, $klass = Opal.klass, $hash2 = Opal.hash2, $send = Opal.send, $hash = Opal.hash; + + Opal.add_stubs(['$require', '$to_s', '$[]=', '$config', '$-', '$nil_or_empty?', '$name', '$grep', '$constants', '$include', '$const_get', '$extend', '$attr_reader', '$merge', '$class', '$update', '$raise', '$document', '$==', '$doctype', '$[]', '$+', '$level', '$delete', '$>', '$casecmp', '$new', '$title=', '$sectname=', '$special=', '$fetch', '$numbered=', '$!', '$key?', '$attr?', '$special', '$numbered', '$generate_id', '$title', '$id=', '$update_attributes', '$tr', '$basename', '$create_block', '$assign_caption', '$===', '$next_block', '$dup', '$<<', '$has_more_lines?', '$each', '$define_method', '$unshift', '$shift', '$send', '$empty?', '$size', '$call', '$option', '$flatten', '$respond_to?', '$include?', '$split', '$to_i', '$compact', '$inspect', '$attr_accessor', '$to_set', '$match?', '$resolve_regexp', '$method', '$register', '$values', '$groups', '$arity', '$instance_exec', '$to_proc', '$activate', '$add_document_processor', '$any?', '$select', '$add_syntax_processor', '$to_sym', '$instance_variable_get', '$kind', '$private', '$join', '$map', '$capitalize', '$instance_variable_set', '$resolve_args', '$freeze', '$process_block_given?', '$source_location', '$resolve_class', '$<', '$update_config', '$push', '$as_symbol', '$name=', '$pop', '$-@', '$next_auto_id', '$generate_name', '$class_for_name', '$reduce', '$const_defined?']); + + if ($truthy((($a = $$($nesting, 'Asciidoctor', 'skip_raise')) ? 'constant' : nil))) { + } else { + self.$require("asciidoctor".$to_s()) + }; + return (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + (function($base, $parent_nesting) { + function $Extensions() {}; + var self = $Extensions = $module($base, 'Extensions', $Extensions); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + + (function($base, $super, $parent_nesting) { + function $Processor(){}; + var self = $Processor = $klass($base, $super, 'Processor', $Processor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Processor_initialize_4, TMP_Processor_update_config_5, TMP_Processor_process_6, TMP_Processor_create_section_7, TMP_Processor_create_block_8, TMP_Processor_create_list_9, TMP_Processor_create_list_item_10, TMP_Processor_create_image_block_11, TMP_Processor_create_inline_12, TMP_Processor_parse_content_13, TMP_Processor_14; + + def.config = nil; + + (function(self, $parent_nesting) { + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_config_1, TMP_option_2, TMP_use_dsl_3; + + + + Opal.def(self, '$config', TMP_config_1 = function $$config() { + var $a, self = this; + if (self.config == null) self.config = nil; + + return (self.config = ($truthy($a = self.config) ? $a : $hash2([], {}))) + }, TMP_config_1.$$arity = 0); + + Opal.def(self, '$option', TMP_option_2 = function $$option(key, default_value) { + var self = this, $writer = nil; + + + $writer = [key, default_value]; + $send(self.$config(), '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + }, TMP_option_2.$$arity = 2); + + Opal.def(self, '$use_dsl', TMP_use_dsl_3 = function $$use_dsl() { + var self = this; + + if ($truthy(self.$name()['$nil_or_empty?']())) { + if ($truthy((Opal.Module.$$nesting = $nesting, self.$constants()).$grep("DSL"))) { + return self.$include(self.$const_get("DSL")) + } else { + return nil + } + } else if ($truthy((Opal.Module.$$nesting = $nesting, self.$constants()).$grep("DSL"))) { + return self.$extend(self.$const_get("DSL")) + } else { + return nil + } + }, TMP_use_dsl_3.$$arity = 0); + Opal.alias(self, "extend_dsl", "use_dsl"); + return Opal.alias(self, "include_dsl", "use_dsl"); + })(Opal.get_singleton_class(self), $nesting); + self.$attr_reader("config"); + + Opal.def(self, '$initialize', TMP_Processor_initialize_4 = function $$initialize(config) { + var self = this; + + + + if (config == null) { + config = $hash2([], {}); + }; + return (self.config = self.$class().$config().$merge(config)); + }, TMP_Processor_initialize_4.$$arity = -1); + + Opal.def(self, '$update_config', TMP_Processor_update_config_5 = function $$update_config(config) { + var self = this; + + return self.config.$update(config) + }, TMP_Processor_update_config_5.$$arity = 1); + + Opal.def(self, '$process', TMP_Processor_process_6 = function $$process($a) { + var $post_args, args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + return self.$raise($$$('::', 'NotImplementedError'), "" + "Asciidoctor::Extensions::Processor subclass must implement #" + ("process") + " method"); + }, TMP_Processor_process_6.$$arity = -1); + + Opal.def(self, '$create_section', TMP_Processor_create_section_7 = function $$create_section(parent, title, attrs, opts) { + var $a, self = this, doc = nil, book = nil, doctype = nil, level = nil, style = nil, sectname = nil, special = nil, sect = nil, $writer = nil, id = nil; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + doc = parent.$document(); + book = (doctype = doc.$doctype())['$==']("book"); + level = ($truthy($a = opts['$[]']("level")) ? $a : $rb_plus(parent.$level(), 1)); + if ($truthy((style = attrs.$delete("style")))) { + if ($truthy(($truthy($a = book) ? style['$==']("abstract") : $a))) { + $a = ["chapter", 1], (sectname = $a[0]), (level = $a[1]), $a + } else { + + $a = [style, true], (sectname = $a[0]), (special = $a[1]), $a; + if (level['$=='](0)) { + level = 1}; + } + } else if ($truthy(book)) { + sectname = (function() {if (level['$=='](0)) { + return "part" + } else { + + if ($truthy($rb_gt(level, 1))) { + return "section" + } else { + return "chapter" + }; + }; return nil; })() + } else if ($truthy((($a = doctype['$==']("manpage")) ? title.$casecmp("synopsis")['$=='](0) : doctype['$==']("manpage")))) { + $a = ["synopsis", true], (sectname = $a[0]), (special = $a[1]), $a + } else { + sectname = "section" + }; + sect = $$($nesting, 'Section').$new(parent, level); + $a = [title, sectname], sect['$title=']($a[0]), sect['$sectname=']($a[1]), $a; + if ($truthy(special)) { + + + $writer = [true]; + $send(sect, 'special=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + if ($truthy(opts.$fetch("numbered", style['$==']("appendix")))) { + + $writer = [true]; + $send(sect, 'numbered=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + } else if ($truthy(($truthy($a = opts['$key?']("numbered")['$!']()) ? doc['$attr?']("sectnums", "all") : $a))) { + + $writer = [(function() {if ($truthy(($truthy($a = book) ? level['$=='](1) : $a))) { + return "chapter" + } else { + return true + }; return nil; })()]; + $send(sect, 'numbered=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + } else if ($truthy($rb_gt(level, 0))) { + if ($truthy(opts.$fetch("numbered", doc['$attr?']("sectnums")))) { + + $writer = [(function() {if ($truthy(sect.$special())) { + return ($truthy($a = parent.$numbered()) ? true : $a) + } else { + return true + }; return nil; })()]; + $send(sect, 'numbered=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];} + } else if ($truthy(opts.$fetch("numbered", ($truthy($a = book) ? doc['$attr?']("partnums") : $a)))) { + + $writer = [true]; + $send(sect, 'numbered=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if ((id = attrs.$delete("id"))['$=='](false)) { + } else { + + $writer = [(($writer = ["id", ($truthy($a = id) ? $a : (function() {if ($truthy(doc['$attr?']("sectids"))) { + + return $$($nesting, 'Section').$generate_id(sect.$title(), doc); + } else { + return nil + }; return nil; })())]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])]; + $send(sect, 'id=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + sect.$update_attributes(attrs); + return sect; + }, TMP_Processor_create_section_7.$$arity = -4); + + Opal.def(self, '$create_block', TMP_Processor_create_block_8 = function $$create_block(parent, context, source, attrs, opts) { + var self = this; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + return $$($nesting, 'Block').$new(parent, context, $hash2(["source", "attributes"], {"source": source, "attributes": attrs}).$merge(opts)); + }, TMP_Processor_create_block_8.$$arity = -5); + + Opal.def(self, '$create_list', TMP_Processor_create_list_9 = function $$create_list(parent, context, attrs) { + var self = this, list = nil; + + + + if (attrs == null) { + attrs = nil; + }; + list = $$($nesting, 'List').$new(parent, context); + if ($truthy(attrs)) { + list.$update_attributes(attrs)}; + return list; + }, TMP_Processor_create_list_9.$$arity = -3); + + Opal.def(self, '$create_list_item', TMP_Processor_create_list_item_10 = function $$create_list_item(parent, text) { + var self = this; + + + + if (text == null) { + text = nil; + }; + return $$($nesting, 'ListItem').$new(parent, text); + }, TMP_Processor_create_list_item_10.$$arity = -2); + + Opal.def(self, '$create_image_block', TMP_Processor_create_image_block_11 = function $$create_image_block(parent, attrs, opts) { + var $a, self = this, target = nil, $writer = nil, title = nil, block = nil; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + if ($truthy((target = attrs['$[]']("target")))) { + } else { + self.$raise($$$('::', 'ArgumentError'), "Unable to create an image block, target attribute is required") + }; + ($truthy($a = attrs['$[]']("alt")) ? $a : (($writer = ["alt", (($writer = ["default-alt", $$($nesting, 'Helpers').$basename(target, true).$tr("_-", " ")]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + title = (function() {if ($truthy(attrs['$key?']("title"))) { + + return attrs.$delete("title"); + } else { + return nil + }; return nil; })(); + block = self.$create_block(parent, "image", nil, attrs, opts); + if ($truthy(title)) { + + + $writer = [title]; + $send(block, 'title=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + block.$assign_caption(attrs.$delete("caption"), ($truthy($a = opts['$[]']("caption_context")) ? $a : "figure"));}; + return block; + }, TMP_Processor_create_image_block_11.$$arity = -3); + + Opal.def(self, '$create_inline', TMP_Processor_create_inline_12 = function $$create_inline(parent, context, text, opts) { + var self = this; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + return $$($nesting, 'Inline').$new(parent, context, text, opts); + }, TMP_Processor_create_inline_12.$$arity = -4); + + Opal.def(self, '$parse_content', TMP_Processor_parse_content_13 = function $$parse_content(parent, content, attributes) { + var $a, $b, $c, self = this, reader = nil, block = nil; + + + + if (attributes == null) { + attributes = nil; + }; + reader = (function() {if ($truthy($$($nesting, 'Reader')['$==='](content))) { + return content + } else { + + return $$($nesting, 'Reader').$new(content); + }; return nil; })(); + while ($truthy(($truthy($b = ($truthy($c = (block = $$($nesting, 'Parser').$next_block(reader, parent, (function() {if ($truthy(attributes)) { + return attributes.$dup() + } else { + return $hash2([], {}) + }; return nil; })()))) ? parent['$<<'](block) : $c)) ? $b : reader['$has_more_lines?']()))) { + + }; + return parent; + }, TMP_Processor_parse_content_13.$$arity = -3); + return $send([["create_paragraph", "create_block", "paragraph"], ["create_open_block", "create_block", "open"], ["create_example_block", "create_block", "example"], ["create_pass_block", "create_block", "pass"], ["create_listing_block", "create_block", "listing"], ["create_literal_block", "create_block", "literal"], ["create_anchor", "create_inline", "anchor"]], 'each', [], (TMP_Processor_14 = function(method_name, delegate_method_name, context){var self = TMP_Processor_14.$$s || this, TMP_15; + + + + if (method_name == null) { + method_name = nil; + }; + + if (delegate_method_name == null) { + delegate_method_name = nil; + }; + + if (context == null) { + context = nil; + }; + return $send(self, 'define_method', [method_name], (TMP_15 = function($a){var self = TMP_15.$$s || this, $post_args, args; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + args.$unshift(args.$shift(), context); + return $send(self, 'send', [delegate_method_name].concat(Opal.to_a(args)));}, TMP_15.$$s = self, TMP_15.$$arity = -1, TMP_15));}, TMP_Processor_14.$$s = self, TMP_Processor_14.$$arity = 3, TMP_Processor_14)); + })($nesting[0], null, $nesting); + (function($base, $parent_nesting) { + function $ProcessorDsl() {}; + var self = $ProcessorDsl = $module($base, 'ProcessorDsl', $ProcessorDsl); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_ProcessorDsl_option_16, TMP_ProcessorDsl_process_17, TMP_ProcessorDsl_process_block_given$q_18; + + + + Opal.def(self, '$option', TMP_ProcessorDsl_option_16 = function $$option(key, value) { + var self = this, $writer = nil; + + + $writer = [key, value]; + $send(self.$config(), '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + }, TMP_ProcessorDsl_option_16.$$arity = 2); + + Opal.def(self, '$process', TMP_ProcessorDsl_process_17 = function $$process($a) { + var $iter = TMP_ProcessorDsl_process_17.$$p, block = $iter || nil, $post_args, args, $b, self = this; + if (self.process_block == null) self.process_block = nil; + + if ($iter) TMP_ProcessorDsl_process_17.$$p = null; + + + if ($iter) TMP_ProcessorDsl_process_17.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + if ((block !== nil)) { + + if ($truthy(args['$empty?']())) { + } else { + self.$raise($$$('::', 'ArgumentError'), "" + "wrong number of arguments (given " + (args.$size()) + ", expected 0)") + }; + return (self.process_block = block); + } else if ($truthy((($b = self['process_block'], $b != null && $b !== nil) ? 'instance-variable' : nil))) { + return $send(self.process_block, 'call', Opal.to_a(args)) + } else { + return self.$raise($$$('::', 'NotImplementedError')) + }; + }, TMP_ProcessorDsl_process_17.$$arity = -1); + + Opal.def(self, '$process_block_given?', TMP_ProcessorDsl_process_block_given$q_18 = function() { + var $a, self = this; + + return (($a = self['process_block'], $a != null && $a !== nil) ? 'instance-variable' : nil) + }, TMP_ProcessorDsl_process_block_given$q_18.$$arity = 0); + })($nesting[0], $nesting); + (function($base, $parent_nesting) { + function $DocumentProcessorDsl() {}; + var self = $DocumentProcessorDsl = $module($base, 'DocumentProcessorDsl', $DocumentProcessorDsl); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_DocumentProcessorDsl_prefer_19; + + + self.$include($$($nesting, 'ProcessorDsl')); + + Opal.def(self, '$prefer', TMP_DocumentProcessorDsl_prefer_19 = function $$prefer() { + var self = this; + + return self.$option("position", ">>") + }, TMP_DocumentProcessorDsl_prefer_19.$$arity = 0); + })($nesting[0], $nesting); + (function($base, $parent_nesting) { + function $SyntaxProcessorDsl() {}; + var self = $SyntaxProcessorDsl = $module($base, 'SyntaxProcessorDsl', $SyntaxProcessorDsl); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_SyntaxProcessorDsl_named_20, TMP_SyntaxProcessorDsl_content_model_21, TMP_SyntaxProcessorDsl_positional_attrs_22, TMP_SyntaxProcessorDsl_default_attrs_23, TMP_SyntaxProcessorDsl_resolves_attributes_24; + + + self.$include($$($nesting, 'ProcessorDsl')); + + Opal.def(self, '$named', TMP_SyntaxProcessorDsl_named_20 = function $$named(value) { + var self = this; + + if ($truthy($$($nesting, 'Processor')['$==='](self))) { + return (self.name = value) + } else { + return self.$option("name", value) + } + }, TMP_SyntaxProcessorDsl_named_20.$$arity = 1); + Opal.alias(self, "match_name", "named"); + + Opal.def(self, '$content_model', TMP_SyntaxProcessorDsl_content_model_21 = function $$content_model(value) { + var self = this; + + return self.$option("content_model", value) + }, TMP_SyntaxProcessorDsl_content_model_21.$$arity = 1); + Opal.alias(self, "parse_content_as", "content_model"); + Opal.alias(self, "parses_content_as", "content_model"); + + Opal.def(self, '$positional_attrs', TMP_SyntaxProcessorDsl_positional_attrs_22 = function $$positional_attrs($a) { + var $post_args, value, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + value = $post_args;; + return self.$option("pos_attrs", value.$flatten()); + }, TMP_SyntaxProcessorDsl_positional_attrs_22.$$arity = -1); + Opal.alias(self, "name_attributes", "positional_attrs"); + Opal.alias(self, "name_positional_attributes", "positional_attrs"); + + Opal.def(self, '$default_attrs', TMP_SyntaxProcessorDsl_default_attrs_23 = function $$default_attrs(value) { + var self = this; + + return self.$option("default_attrs", value) + }, TMP_SyntaxProcessorDsl_default_attrs_23.$$arity = 1); + + Opal.def(self, '$resolves_attributes', TMP_SyntaxProcessorDsl_resolves_attributes_24 = function $$resolves_attributes($a) { + var $post_args, args, $b, TMP_25, TMP_26, self = this, $case = nil, names = nil, defaults = nil; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + if ($truthy($rb_gt(args.$size(), 1))) { + } else if ($truthy((args = args.$fetch(0, true))['$respond_to?']("to_sym"))) { + args = [args]}; + return (function() {$case = args; + if (true['$===']($case)) { + self.$option("pos_attrs", []); + return self.$option("default_attrs", $hash2([], {}));} + else if ($$$('::', 'Array')['$===']($case)) { + $b = [[], $hash2([], {})], (names = $b[0]), (defaults = $b[1]), $b; + $send(args, 'each', [], (TMP_25 = function(arg){var self = TMP_25.$$s || this, $c, $d, name = nil, value = nil, idx = nil, $writer = nil; + + + + if (arg == null) { + arg = nil; + }; + if ($truthy((arg = arg.$to_s())['$include?']("="))) { + + $d = arg.$split("=", 2), $c = Opal.to_ary($d), (name = ($c[0] == null ? nil : $c[0])), (value = ($c[1] == null ? nil : $c[1])), $d; + if ($truthy(name['$include?'](":"))) { + + $d = name.$split(":", 2), $c = Opal.to_ary($d), (idx = ($c[0] == null ? nil : $c[0])), (name = ($c[1] == null ? nil : $c[1])), $d; + idx = (function() {if (idx['$==']("@")) { + return names.$size() + } else { + return idx.$to_i() + }; return nil; })(); + + $writer = [idx, name]; + $send(names, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];;}; + + $writer = [name, value]; + $send(defaults, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];; + } else if ($truthy(arg['$include?'](":"))) { + + $d = arg.$split(":", 2), $c = Opal.to_ary($d), (idx = ($c[0] == null ? nil : $c[0])), (name = ($c[1] == null ? nil : $c[1])), $d; + idx = (function() {if (idx['$==']("@")) { + return names.$size() + } else { + return idx.$to_i() + }; return nil; })(); + + $writer = [idx, name]; + $send(names, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];; + } else { + return names['$<<'](arg) + };}, TMP_25.$$s = self, TMP_25.$$arity = 1, TMP_25)); + self.$option("pos_attrs", names.$compact()); + return self.$option("default_attrs", defaults);} + else if ($$$('::', 'Hash')['$===']($case)) { + $b = [[], $hash2([], {})], (names = $b[0]), (defaults = $b[1]), $b; + $send(args, 'each', [], (TMP_26 = function(key, val){var self = TMP_26.$$s || this, $c, $d, name = nil, idx = nil, $writer = nil; + + + + if (key == null) { + key = nil; + }; + + if (val == null) { + val = nil; + }; + if ($truthy((name = key.$to_s())['$include?'](":"))) { + + $d = name.$split(":", 2), $c = Opal.to_ary($d), (idx = ($c[0] == null ? nil : $c[0])), (name = ($c[1] == null ? nil : $c[1])), $d; + idx = (function() {if (idx['$==']("@")) { + return names.$size() + } else { + return idx.$to_i() + }; return nil; })(); + + $writer = [idx, name]; + $send(names, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];;}; + if ($truthy(val)) { + + $writer = [name, val]; + $send(defaults, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + } else { + return nil + };}, TMP_26.$$s = self, TMP_26.$$arity = 2, TMP_26)); + self.$option("pos_attrs", names.$compact()); + return self.$option("default_attrs", defaults);} + else {return self.$raise($$$('::', 'ArgumentError'), "" + "unsupported attributes specification for macro: " + (args.$inspect()))}})(); + }, TMP_SyntaxProcessorDsl_resolves_attributes_24.$$arity = -1); + Opal.alias(self, "resolve_attributes", "resolves_attributes"); + })($nesting[0], $nesting); + (function($base, $super, $parent_nesting) { + function $Preprocessor(){}; + var self = $Preprocessor = $klass($base, $super, 'Preprocessor', $Preprocessor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Preprocessor_process_27; + + return (Opal.def(self, '$process', TMP_Preprocessor_process_27 = function $$process(document, reader) { + var self = this; + + return self.$raise($$$('::', 'NotImplementedError'), "" + "Asciidoctor::Extensions::Preprocessor subclass must implement #" + ("process") + " method") + }, TMP_Preprocessor_process_27.$$arity = 2), nil) && 'process' + })($nesting[0], $$($nesting, 'Processor'), $nesting); + Opal.const_set($$($nesting, 'Preprocessor'), 'DSL', $$($nesting, 'DocumentProcessorDsl')); + (function($base, $super, $parent_nesting) { + function $TreeProcessor(){}; + var self = $TreeProcessor = $klass($base, $super, 'TreeProcessor', $TreeProcessor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_TreeProcessor_process_28; + + return (Opal.def(self, '$process', TMP_TreeProcessor_process_28 = function $$process(document) { + var self = this; + + return self.$raise($$$('::', 'NotImplementedError'), "" + "Asciidoctor::Extensions::TreeProcessor subclass must implement #" + ("process") + " method") + }, TMP_TreeProcessor_process_28.$$arity = 1), nil) && 'process' + })($nesting[0], $$($nesting, 'Processor'), $nesting); + Opal.const_set($$($nesting, 'TreeProcessor'), 'DSL', $$($nesting, 'DocumentProcessorDsl')); + Opal.const_set($nesting[0], 'Treeprocessor', $$($nesting, 'TreeProcessor')); + (function($base, $super, $parent_nesting) { + function $Postprocessor(){}; + var self = $Postprocessor = $klass($base, $super, 'Postprocessor', $Postprocessor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Postprocessor_process_29; + + return (Opal.def(self, '$process', TMP_Postprocessor_process_29 = function $$process(document, output) { + var self = this; + + return self.$raise($$$('::', 'NotImplementedError'), "" + "Asciidoctor::Extensions::Postprocessor subclass must implement #" + ("process") + " method") + }, TMP_Postprocessor_process_29.$$arity = 2), nil) && 'process' + })($nesting[0], $$($nesting, 'Processor'), $nesting); + Opal.const_set($$($nesting, 'Postprocessor'), 'DSL', $$($nesting, 'DocumentProcessorDsl')); + (function($base, $super, $parent_nesting) { + function $IncludeProcessor(){}; + var self = $IncludeProcessor = $klass($base, $super, 'IncludeProcessor', $IncludeProcessor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_IncludeProcessor_process_30, TMP_IncludeProcessor_handles$q_31; + + + + Opal.def(self, '$process', TMP_IncludeProcessor_process_30 = function $$process(document, reader, target, attributes) { + var self = this; + + return self.$raise($$$('::', 'NotImplementedError'), "" + "Asciidoctor::Extensions::IncludeProcessor subclass must implement #" + ("process") + " method") + }, TMP_IncludeProcessor_process_30.$$arity = 4); + return (Opal.def(self, '$handles?', TMP_IncludeProcessor_handles$q_31 = function(target) { + var self = this; + + return true + }, TMP_IncludeProcessor_handles$q_31.$$arity = 1), nil) && 'handles?'; + })($nesting[0], $$($nesting, 'Processor'), $nesting); + (function($base, $parent_nesting) { + function $IncludeProcessorDsl() {}; + var self = $IncludeProcessorDsl = $module($base, 'IncludeProcessorDsl', $IncludeProcessorDsl); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_IncludeProcessorDsl_handles$q_32; + + + self.$include($$($nesting, 'DocumentProcessorDsl')); + + Opal.def(self, '$handles?', TMP_IncludeProcessorDsl_handles$q_32 = function($a) { + var $iter = TMP_IncludeProcessorDsl_handles$q_32.$$p, block = $iter || nil, $post_args, args, $b, self = this; + if (self.handles_block == null) self.handles_block = nil; + + if ($iter) TMP_IncludeProcessorDsl_handles$q_32.$$p = null; + + + if ($iter) TMP_IncludeProcessorDsl_handles$q_32.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + if ((block !== nil)) { + + if ($truthy(args['$empty?']())) { + } else { + self.$raise($$$('::', 'ArgumentError'), "" + "wrong number of arguments (given " + (args.$size()) + ", expected 0)") + }; + return (self.handles_block = block); + } else if ($truthy((($b = self['handles_block'], $b != null && $b !== nil) ? 'instance-variable' : nil))) { + return self.handles_block.$call(args['$[]'](0)) + } else { + return true + }; + }, TMP_IncludeProcessorDsl_handles$q_32.$$arity = -1); + })($nesting[0], $nesting); + Opal.const_set($$($nesting, 'IncludeProcessor'), 'DSL', $$($nesting, 'IncludeProcessorDsl')); + (function($base, $super, $parent_nesting) { + function $DocinfoProcessor(){}; + var self = $DocinfoProcessor = $klass($base, $super, 'DocinfoProcessor', $DocinfoProcessor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_DocinfoProcessor_initialize_33, TMP_DocinfoProcessor_process_34; + + def.config = nil; + + self.$attr_accessor("location"); + + Opal.def(self, '$initialize', TMP_DocinfoProcessor_initialize_33 = function $$initialize(config) { + var $a, $iter = TMP_DocinfoProcessor_initialize_33.$$p, $yield = $iter || nil, self = this, $writer = nil; + + if ($iter) TMP_DocinfoProcessor_initialize_33.$$p = null; + + + if (config == null) { + config = $hash2([], {}); + }; + $send(self, Opal.find_super_dispatcher(self, 'initialize', TMP_DocinfoProcessor_initialize_33, false), [config], null); + return ($truthy($a = self.config['$[]']("location")) ? $a : (($writer = ["location", "head"]), $send(self.config, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + }, TMP_DocinfoProcessor_initialize_33.$$arity = -1); + return (Opal.def(self, '$process', TMP_DocinfoProcessor_process_34 = function $$process(document) { + var self = this; + + return self.$raise($$$('::', 'NotImplementedError'), "" + "Asciidoctor::Extensions::DocinfoProcessor subclass must implement #" + ("process") + " method") + }, TMP_DocinfoProcessor_process_34.$$arity = 1), nil) && 'process'; + })($nesting[0], $$($nesting, 'Processor'), $nesting); + (function($base, $parent_nesting) { + function $DocinfoProcessorDsl() {}; + var self = $DocinfoProcessorDsl = $module($base, 'DocinfoProcessorDsl', $DocinfoProcessorDsl); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_DocinfoProcessorDsl_at_location_35; + + + self.$include($$($nesting, 'DocumentProcessorDsl')); + + Opal.def(self, '$at_location', TMP_DocinfoProcessorDsl_at_location_35 = function $$at_location(value) { + var self = this; + + return self.$option("location", value) + }, TMP_DocinfoProcessorDsl_at_location_35.$$arity = 1); + })($nesting[0], $nesting); + Opal.const_set($$($nesting, 'DocinfoProcessor'), 'DSL', $$($nesting, 'DocinfoProcessorDsl')); + (function($base, $super, $parent_nesting) { + function $BlockProcessor(){}; + var self = $BlockProcessor = $klass($base, $super, 'BlockProcessor', $BlockProcessor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_BlockProcessor_initialize_36, TMP_BlockProcessor_process_37; + + def.config = nil; + + self.$attr_accessor("name"); + + Opal.def(self, '$initialize', TMP_BlockProcessor_initialize_36 = function $$initialize(name, config) { + var $a, $iter = TMP_BlockProcessor_initialize_36.$$p, $yield = $iter || nil, self = this, $case = nil, $writer = nil; + + if ($iter) TMP_BlockProcessor_initialize_36.$$p = null; + + + if (name == null) { + name = nil; + }; + + if (config == null) { + config = $hash2([], {}); + }; + $send(self, Opal.find_super_dispatcher(self, 'initialize', TMP_BlockProcessor_initialize_36, false), [config], null); + self.name = ($truthy($a = name) ? $a : self.config['$[]']("name")); + $case = self.config['$[]']("contexts"); + if ($$$('::', 'NilClass')['$===']($case)) {($truthy($a = self.config['$[]']("contexts")) ? $a : (($writer = ["contexts", ["open", "paragraph"].$to_set()]), $send(self.config, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]))} + else if ($$$('::', 'Symbol')['$===']($case)) { + $writer = ["contexts", [self.config['$[]']("contexts")].$to_set()]; + $send(self.config, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];} + else { + $writer = ["contexts", self.config['$[]']("contexts").$to_set()]; + $send(self.config, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + return ($truthy($a = self.config['$[]']("content_model")) ? $a : (($writer = ["content_model", "compound"]), $send(self.config, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + }, TMP_BlockProcessor_initialize_36.$$arity = -1); + return (Opal.def(self, '$process', TMP_BlockProcessor_process_37 = function $$process(parent, reader, attributes) { + var self = this; + + return self.$raise($$$('::', 'NotImplementedError'), "" + "Asciidoctor::Extensions::BlockProcessor subclass must implement #" + ("process") + " method") + }, TMP_BlockProcessor_process_37.$$arity = 3), nil) && 'process'; + })($nesting[0], $$($nesting, 'Processor'), $nesting); + (function($base, $parent_nesting) { + function $BlockProcessorDsl() {}; + var self = $BlockProcessorDsl = $module($base, 'BlockProcessorDsl', $BlockProcessorDsl); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_BlockProcessorDsl_contexts_38; + + + self.$include($$($nesting, 'SyntaxProcessorDsl')); + + Opal.def(self, '$contexts', TMP_BlockProcessorDsl_contexts_38 = function $$contexts($a) { + var $post_args, value, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + value = $post_args;; + return self.$option("contexts", value.$flatten().$to_set()); + }, TMP_BlockProcessorDsl_contexts_38.$$arity = -1); + Opal.alias(self, "on_contexts", "contexts"); + Opal.alias(self, "on_context", "contexts"); + Opal.alias(self, "bound_to", "contexts"); + })($nesting[0], $nesting); + Opal.const_set($$($nesting, 'BlockProcessor'), 'DSL', $$($nesting, 'BlockProcessorDsl')); + (function($base, $super, $parent_nesting) { + function $MacroProcessor(){}; + var self = $MacroProcessor = $klass($base, $super, 'MacroProcessor', $MacroProcessor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_MacroProcessor_initialize_39, TMP_MacroProcessor_process_40; + + def.config = nil; + + self.$attr_accessor("name"); + + Opal.def(self, '$initialize', TMP_MacroProcessor_initialize_39 = function $$initialize(name, config) { + var $a, $iter = TMP_MacroProcessor_initialize_39.$$p, $yield = $iter || nil, self = this, $writer = nil; + + if ($iter) TMP_MacroProcessor_initialize_39.$$p = null; + + + if (name == null) { + name = nil; + }; + + if (config == null) { + config = $hash2([], {}); + }; + $send(self, Opal.find_super_dispatcher(self, 'initialize', TMP_MacroProcessor_initialize_39, false), [config], null); + self.name = ($truthy($a = name) ? $a : self.config['$[]']("name")); + return ($truthy($a = self.config['$[]']("content_model")) ? $a : (($writer = ["content_model", "attributes"]), $send(self.config, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + }, TMP_MacroProcessor_initialize_39.$$arity = -1); + return (Opal.def(self, '$process', TMP_MacroProcessor_process_40 = function $$process(parent, target, attributes) { + var self = this; + + return self.$raise($$$('::', 'NotImplementedError'), "" + "Asciidoctor::Extensions::MacroProcessor subclass must implement #" + ("process") + " method") + }, TMP_MacroProcessor_process_40.$$arity = 3), nil) && 'process'; + })($nesting[0], $$($nesting, 'Processor'), $nesting); + (function($base, $parent_nesting) { + function $MacroProcessorDsl() {}; + var self = $MacroProcessorDsl = $module($base, 'MacroProcessorDsl', $MacroProcessorDsl); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_MacroProcessorDsl_resolves_attributes_41; + + + self.$include($$($nesting, 'SyntaxProcessorDsl')); + + Opal.def(self, '$resolves_attributes', TMP_MacroProcessorDsl_resolves_attributes_41 = function $$resolves_attributes($a) { + var $post_args, args, $b, $iter = TMP_MacroProcessorDsl_resolves_attributes_41.$$p, $yield = $iter || nil, self = this, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_MacroProcessorDsl_resolves_attributes_41.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + if ($truthy((($b = args.$size()['$=='](1)) ? args['$[]'](0)['$!']() : args.$size()['$=='](1)))) { + + self.$option("content_model", "text"); + return nil;}; + $send(self, Opal.find_super_dispatcher(self, 'resolves_attributes', TMP_MacroProcessorDsl_resolves_attributes_41, false), $zuper, $iter); + return self.$option("content_model", "attributes"); + }, TMP_MacroProcessorDsl_resolves_attributes_41.$$arity = -1); + Opal.alias(self, "resolve_attributes", "resolves_attributes"); + })($nesting[0], $nesting); + (function($base, $super, $parent_nesting) { + function $BlockMacroProcessor(){}; + var self = $BlockMacroProcessor = $klass($base, $super, 'BlockMacroProcessor', $BlockMacroProcessor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_BlockMacroProcessor_name_42; + + def.name = nil; + return (Opal.def(self, '$name', TMP_BlockMacroProcessor_name_42 = function $$name() { + var self = this; + + + if ($truthy($$($nesting, 'MacroNameRx')['$match?'](self.name.$to_s()))) { + } else { + self.$raise($$$('::', 'ArgumentError'), "" + "invalid name for block macro: " + (self.name)) + }; + return self.name; + }, TMP_BlockMacroProcessor_name_42.$$arity = 0), nil) && 'name' + })($nesting[0], $$($nesting, 'MacroProcessor'), $nesting); + Opal.const_set($$($nesting, 'BlockMacroProcessor'), 'DSL', $$($nesting, 'MacroProcessorDsl')); + (function($base, $super, $parent_nesting) { + function $InlineMacroProcessor(){}; + var self = $InlineMacroProcessor = $klass($base, $super, 'InlineMacroProcessor', $InlineMacroProcessor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_InlineMacroProcessor_regexp_43, TMP_InlineMacroProcessor_resolve_regexp_44; + + def.config = def.name = nil; + + (Opal.class_variable_set($InlineMacroProcessor, '@@rx_cache', $hash2([], {}))); + + Opal.def(self, '$regexp', TMP_InlineMacroProcessor_regexp_43 = function $$regexp() { + var $a, self = this, $writer = nil; + + return ($truthy($a = self.config['$[]']("regexp")) ? $a : (($writer = ["regexp", self.$resolve_regexp(self.name.$to_s(), self.config['$[]']("format"))]), $send(self.config, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])) + }, TMP_InlineMacroProcessor_regexp_43.$$arity = 0); + return (Opal.def(self, '$resolve_regexp', TMP_InlineMacroProcessor_resolve_regexp_44 = function $$resolve_regexp(name, format) { + var $a, $b, self = this, $writer = nil; + + + if ($truthy($$($nesting, 'MacroNameRx')['$match?'](name))) { + } else { + self.$raise($$$('::', 'ArgumentError'), "" + "invalid name for inline macro: " + (name)) + }; + return ($truthy($a = (($b = $InlineMacroProcessor.$$cvars['@@rx_cache']) == null ? nil : $b)['$[]']([name, format])) ? $a : (($writer = [[name, format], new RegExp("" + "\\\\?" + (name) + ":" + ((function() {if (format['$==']("short")) { + return "(){0}" + } else { + return "(\\S+?)" + }; return nil; })()) + "\\[(|.*?[^\\\\])\\]")]), $send((($b = $InlineMacroProcessor.$$cvars['@@rx_cache']) == null ? nil : $b), '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + }, TMP_InlineMacroProcessor_resolve_regexp_44.$$arity = 2), nil) && 'resolve_regexp'; + })($nesting[0], $$($nesting, 'MacroProcessor'), $nesting); + (function($base, $parent_nesting) { + function $InlineMacroProcessorDsl() {}; + var self = $InlineMacroProcessorDsl = $module($base, 'InlineMacroProcessorDsl', $InlineMacroProcessorDsl); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_InlineMacroProcessorDsl_with_format_45, TMP_InlineMacroProcessorDsl_matches_46; + + + self.$include($$($nesting, 'MacroProcessorDsl')); + + Opal.def(self, '$with_format', TMP_InlineMacroProcessorDsl_with_format_45 = function $$with_format(value) { + var self = this; + + return self.$option("format", value) + }, TMP_InlineMacroProcessorDsl_with_format_45.$$arity = 1); + Opal.alias(self, "using_format", "with_format"); + + Opal.def(self, '$matches', TMP_InlineMacroProcessorDsl_matches_46 = function $$matches(value) { + var self = this; + + return self.$option("regexp", value) + }, TMP_InlineMacroProcessorDsl_matches_46.$$arity = 1); + Opal.alias(self, "match", "matches"); + Opal.alias(self, "matching", "matches"); + })($nesting[0], $nesting); + Opal.const_set($$($nesting, 'InlineMacroProcessor'), 'DSL', $$($nesting, 'InlineMacroProcessorDsl')); + (function($base, $super, $parent_nesting) { + function $Extension(){}; + var self = $Extension = $klass($base, $super, 'Extension', $Extension); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Extension_initialize_47; + + + self.$attr_reader("kind"); + self.$attr_reader("config"); + self.$attr_reader("instance"); + return (Opal.def(self, '$initialize', TMP_Extension_initialize_47 = function $$initialize(kind, instance, config) { + var self = this; + + + self.kind = kind; + self.instance = instance; + return (self.config = config); + }, TMP_Extension_initialize_47.$$arity = 3), nil) && 'initialize'; + })($nesting[0], null, $nesting); + (function($base, $super, $parent_nesting) { + function $ProcessorExtension(){}; + var self = $ProcessorExtension = $klass($base, $super, 'ProcessorExtension', $ProcessorExtension); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_ProcessorExtension_initialize_48; + + + self.$attr_reader("process_method"); + return (Opal.def(self, '$initialize', TMP_ProcessorExtension_initialize_48 = function $$initialize(kind, instance, process_method) { + var $a, $iter = TMP_ProcessorExtension_initialize_48.$$p, $yield = $iter || nil, self = this; + + if ($iter) TMP_ProcessorExtension_initialize_48.$$p = null; + + + if (process_method == null) { + process_method = nil; + }; + $send(self, Opal.find_super_dispatcher(self, 'initialize', TMP_ProcessorExtension_initialize_48, false), [kind, instance, instance.$config()], null); + return (self.process_method = ($truthy($a = process_method) ? $a : instance.$method("process"))); + }, TMP_ProcessorExtension_initialize_48.$$arity = -3), nil) && 'initialize'; + })($nesting[0], $$($nesting, 'Extension'), $nesting); + (function($base, $super, $parent_nesting) { + function $Group(){}; + var self = $Group = $klass($base, $super, 'Group', $Group); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Group_activate_50; + + + (function(self, $parent_nesting) { + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_register_49; + + return (Opal.def(self, '$register', TMP_register_49 = function $$register(name) { + var self = this; + + + + if (name == null) { + name = nil; + }; + return $$($nesting, 'Extensions').$register(name, self); + }, TMP_register_49.$$arity = -1), nil) && 'register' + })(Opal.get_singleton_class(self), $nesting); + return (Opal.def(self, '$activate', TMP_Group_activate_50 = function $$activate(registry) { + var self = this; + + return self.$raise($$$('::', 'NotImplementedError')) + }, TMP_Group_activate_50.$$arity = 1), nil) && 'activate'; + })($nesting[0], null, $nesting); + (function($base, $super, $parent_nesting) { + function $Registry(){}; + var self = $Registry = $klass($base, $super, 'Registry', $Registry); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Registry_initialize_51, TMP_Registry_activate_52, TMP_Registry_preprocessor_54, TMP_Registry_preprocessors$q_55, TMP_Registry_preprocessors_56, TMP_Registry_tree_processor_57, TMP_Registry_tree_processors$q_58, TMP_Registry_tree_processors_59, TMP_Registry_postprocessor_60, TMP_Registry_postprocessors$q_61, TMP_Registry_postprocessors_62, TMP_Registry_include_processor_63, TMP_Registry_include_processors$q_64, TMP_Registry_include_processors_65, TMP_Registry_docinfo_processor_66, TMP_Registry_docinfo_processors$q_67, TMP_Registry_docinfo_processors_69, TMP_Registry_block_71, TMP_Registry_blocks$q_72, TMP_Registry_registered_for_block$q_73, TMP_Registry_find_block_extension_74, TMP_Registry_block_macro_75, TMP_Registry_block_macros$q_76, TMP_Registry_registered_for_block_macro$q_77, TMP_Registry_find_block_macro_extension_78, TMP_Registry_inline_macro_79, TMP_Registry_inline_macros$q_80, TMP_Registry_registered_for_inline_macro$q_81, TMP_Registry_find_inline_macro_extension_82, TMP_Registry_inline_macros_83, TMP_Registry_prefer_84, TMP_Registry_add_document_processor_85, TMP_Registry_add_syntax_processor_87, TMP_Registry_resolve_args_89, TMP_Registry_as_symbol_90; + + def.groups = def.preprocessor_extensions = def.tree_processor_extensions = def.postprocessor_extensions = def.include_processor_extensions = def.docinfo_processor_extensions = def.block_extensions = def.block_macro_extensions = def.inline_macro_extensions = nil; + + self.$attr_reader("document"); + self.$attr_reader("groups"); + + Opal.def(self, '$initialize', TMP_Registry_initialize_51 = function $$initialize(groups) { + var self = this; + + + + if (groups == null) { + groups = $hash2([], {}); + }; + self.groups = groups; + self.preprocessor_extensions = (self.tree_processor_extensions = (self.postprocessor_extensions = (self.include_processor_extensions = (self.docinfo_processor_extensions = (self.block_extensions = (self.block_macro_extensions = (self.inline_macro_extensions = nil))))))); + return (self.document = nil); + }, TMP_Registry_initialize_51.$$arity = -1); + + Opal.def(self, '$activate', TMP_Registry_activate_52 = function $$activate(document) { + var TMP_53, self = this, ext_groups = nil; + + + self.document = document; + if ($truthy((ext_groups = $rb_plus($$($nesting, 'Extensions').$groups().$values(), self.groups.$values()))['$empty?']())) { + } else { + $send(ext_groups, 'each', [], (TMP_53 = function(group){var self = TMP_53.$$s || this, $case = nil; + + + + if (group == null) { + group = nil; + }; + return (function() {$case = group; + if ($$$('::', 'Proc')['$===']($case)) {return (function() {$case = group.$arity(); + if ((0)['$===']($case) || (-1)['$===']($case)) {return $send(self, 'instance_exec', [], group.$to_proc())} + else if ((1)['$===']($case)) {return group.$call(self)} + else { return nil }})()} + else if ($$$('::', 'Class')['$===']($case)) {return group.$new().$activate(self)} + else {return group.$activate(self)}})();}, TMP_53.$$s = self, TMP_53.$$arity = 1, TMP_53)) + }; + return self; + }, TMP_Registry_activate_52.$$arity = 1); + + Opal.def(self, '$preprocessor', TMP_Registry_preprocessor_54 = function $$preprocessor($a) { + var $iter = TMP_Registry_preprocessor_54.$$p, block = $iter || nil, $post_args, args, self = this; + + if ($iter) TMP_Registry_preprocessor_54.$$p = null; + + + if ($iter) TMP_Registry_preprocessor_54.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + return $send(self, 'add_document_processor', ["preprocessor", args], block.$to_proc()); + }, TMP_Registry_preprocessor_54.$$arity = -1); + + Opal.def(self, '$preprocessors?', TMP_Registry_preprocessors$q_55 = function() { + var self = this; + + return self.preprocessor_extensions['$!']()['$!']() + }, TMP_Registry_preprocessors$q_55.$$arity = 0); + + Opal.def(self, '$preprocessors', TMP_Registry_preprocessors_56 = function $$preprocessors() { + var self = this; + + return self.preprocessor_extensions + }, TMP_Registry_preprocessors_56.$$arity = 0); + + Opal.def(self, '$tree_processor', TMP_Registry_tree_processor_57 = function $$tree_processor($a) { + var $iter = TMP_Registry_tree_processor_57.$$p, block = $iter || nil, $post_args, args, self = this; + + if ($iter) TMP_Registry_tree_processor_57.$$p = null; + + + if ($iter) TMP_Registry_tree_processor_57.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + return $send(self, 'add_document_processor', ["tree_processor", args], block.$to_proc()); + }, TMP_Registry_tree_processor_57.$$arity = -1); + + Opal.def(self, '$tree_processors?', TMP_Registry_tree_processors$q_58 = function() { + var self = this; + + return self.tree_processor_extensions['$!']()['$!']() + }, TMP_Registry_tree_processors$q_58.$$arity = 0); + + Opal.def(self, '$tree_processors', TMP_Registry_tree_processors_59 = function $$tree_processors() { + var self = this; + + return self.tree_processor_extensions + }, TMP_Registry_tree_processors_59.$$arity = 0); + Opal.alias(self, "treeprocessor", "tree_processor"); + Opal.alias(self, "treeprocessors?", "tree_processors?"); + Opal.alias(self, "treeprocessors", "tree_processors"); + + Opal.def(self, '$postprocessor', TMP_Registry_postprocessor_60 = function $$postprocessor($a) { + var $iter = TMP_Registry_postprocessor_60.$$p, block = $iter || nil, $post_args, args, self = this; + + if ($iter) TMP_Registry_postprocessor_60.$$p = null; + + + if ($iter) TMP_Registry_postprocessor_60.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + return $send(self, 'add_document_processor', ["postprocessor", args], block.$to_proc()); + }, TMP_Registry_postprocessor_60.$$arity = -1); + + Opal.def(self, '$postprocessors?', TMP_Registry_postprocessors$q_61 = function() { + var self = this; + + return self.postprocessor_extensions['$!']()['$!']() + }, TMP_Registry_postprocessors$q_61.$$arity = 0); + + Opal.def(self, '$postprocessors', TMP_Registry_postprocessors_62 = function $$postprocessors() { + var self = this; + + return self.postprocessor_extensions + }, TMP_Registry_postprocessors_62.$$arity = 0); + + Opal.def(self, '$include_processor', TMP_Registry_include_processor_63 = function $$include_processor($a) { + var $iter = TMP_Registry_include_processor_63.$$p, block = $iter || nil, $post_args, args, self = this; + + if ($iter) TMP_Registry_include_processor_63.$$p = null; + + + if ($iter) TMP_Registry_include_processor_63.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + return $send(self, 'add_document_processor', ["include_processor", args], block.$to_proc()); + }, TMP_Registry_include_processor_63.$$arity = -1); + + Opal.def(self, '$include_processors?', TMP_Registry_include_processors$q_64 = function() { + var self = this; + + return self.include_processor_extensions['$!']()['$!']() + }, TMP_Registry_include_processors$q_64.$$arity = 0); + + Opal.def(self, '$include_processors', TMP_Registry_include_processors_65 = function $$include_processors() { + var self = this; + + return self.include_processor_extensions + }, TMP_Registry_include_processors_65.$$arity = 0); + + Opal.def(self, '$docinfo_processor', TMP_Registry_docinfo_processor_66 = function $$docinfo_processor($a) { + var $iter = TMP_Registry_docinfo_processor_66.$$p, block = $iter || nil, $post_args, args, self = this; + + if ($iter) TMP_Registry_docinfo_processor_66.$$p = null; + + + if ($iter) TMP_Registry_docinfo_processor_66.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + return $send(self, 'add_document_processor', ["docinfo_processor", args], block.$to_proc()); + }, TMP_Registry_docinfo_processor_66.$$arity = -1); + + Opal.def(self, '$docinfo_processors?', TMP_Registry_docinfo_processors$q_67 = function(location) { + var TMP_68, self = this; + + + + if (location == null) { + location = nil; + }; + if ($truthy(self.docinfo_processor_extensions)) { + if ($truthy(location)) { + return $send(self.docinfo_processor_extensions, 'any?', [], (TMP_68 = function(ext){var self = TMP_68.$$s || this; + + + + if (ext == null) { + ext = nil; + }; + return ext.$config()['$[]']("location")['$=='](location);}, TMP_68.$$s = self, TMP_68.$$arity = 1, TMP_68)) + } else { + return true + } + } else { + return false + }; + }, TMP_Registry_docinfo_processors$q_67.$$arity = -1); + + Opal.def(self, '$docinfo_processors', TMP_Registry_docinfo_processors_69 = function $$docinfo_processors(location) { + var TMP_70, self = this; + + + + if (location == null) { + location = nil; + }; + if ($truthy(self.docinfo_processor_extensions)) { + if ($truthy(location)) { + return $send(self.docinfo_processor_extensions, 'select', [], (TMP_70 = function(ext){var self = TMP_70.$$s || this; + + + + if (ext == null) { + ext = nil; + }; + return ext.$config()['$[]']("location")['$=='](location);}, TMP_70.$$s = self, TMP_70.$$arity = 1, TMP_70)) + } else { + return self.docinfo_processor_extensions + } + } else { + return nil + }; + }, TMP_Registry_docinfo_processors_69.$$arity = -1); + + Opal.def(self, '$block', TMP_Registry_block_71 = function $$block($a) { + var $iter = TMP_Registry_block_71.$$p, block = $iter || nil, $post_args, args, self = this; + + if ($iter) TMP_Registry_block_71.$$p = null; + + + if ($iter) TMP_Registry_block_71.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + return $send(self, 'add_syntax_processor', ["block", args], block.$to_proc()); + }, TMP_Registry_block_71.$$arity = -1); + + Opal.def(self, '$blocks?', TMP_Registry_blocks$q_72 = function() { + var self = this; + + return self.block_extensions['$!']()['$!']() + }, TMP_Registry_blocks$q_72.$$arity = 0); + + Opal.def(self, '$registered_for_block?', TMP_Registry_registered_for_block$q_73 = function(name, context) { + var self = this, ext = nil; + + if ($truthy((ext = self.block_extensions['$[]'](name.$to_sym())))) { + if ($truthy(ext.$config()['$[]']("contexts")['$include?'](context))) { + return ext + } else { + return false + } + } else { + return false + } + }, TMP_Registry_registered_for_block$q_73.$$arity = 2); + + Opal.def(self, '$find_block_extension', TMP_Registry_find_block_extension_74 = function $$find_block_extension(name) { + var self = this; + + return self.block_extensions['$[]'](name.$to_sym()) + }, TMP_Registry_find_block_extension_74.$$arity = 1); + + Opal.def(self, '$block_macro', TMP_Registry_block_macro_75 = function $$block_macro($a) { + var $iter = TMP_Registry_block_macro_75.$$p, block = $iter || nil, $post_args, args, self = this; + + if ($iter) TMP_Registry_block_macro_75.$$p = null; + + + if ($iter) TMP_Registry_block_macro_75.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + return $send(self, 'add_syntax_processor', ["block_macro", args], block.$to_proc()); + }, TMP_Registry_block_macro_75.$$arity = -1); + + Opal.def(self, '$block_macros?', TMP_Registry_block_macros$q_76 = function() { + var self = this; + + return self.block_macro_extensions['$!']()['$!']() + }, TMP_Registry_block_macros$q_76.$$arity = 0); + + Opal.def(self, '$registered_for_block_macro?', TMP_Registry_registered_for_block_macro$q_77 = function(name) { + var self = this, ext = nil; + + if ($truthy((ext = self.block_macro_extensions['$[]'](name.$to_sym())))) { + return ext + } else { + return false + } + }, TMP_Registry_registered_for_block_macro$q_77.$$arity = 1); + + Opal.def(self, '$find_block_macro_extension', TMP_Registry_find_block_macro_extension_78 = function $$find_block_macro_extension(name) { + var self = this; + + return self.block_macro_extensions['$[]'](name.$to_sym()) + }, TMP_Registry_find_block_macro_extension_78.$$arity = 1); + + Opal.def(self, '$inline_macro', TMP_Registry_inline_macro_79 = function $$inline_macro($a) { + var $iter = TMP_Registry_inline_macro_79.$$p, block = $iter || nil, $post_args, args, self = this; + + if ($iter) TMP_Registry_inline_macro_79.$$p = null; + + + if ($iter) TMP_Registry_inline_macro_79.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + return $send(self, 'add_syntax_processor', ["inline_macro", args], block.$to_proc()); + }, TMP_Registry_inline_macro_79.$$arity = -1); + + Opal.def(self, '$inline_macros?', TMP_Registry_inline_macros$q_80 = function() { + var self = this; + + return self.inline_macro_extensions['$!']()['$!']() + }, TMP_Registry_inline_macros$q_80.$$arity = 0); + + Opal.def(self, '$registered_for_inline_macro?', TMP_Registry_registered_for_inline_macro$q_81 = function(name) { + var self = this, ext = nil; + + if ($truthy((ext = self.inline_macro_extensions['$[]'](name.$to_sym())))) { + return ext + } else { + return false + } + }, TMP_Registry_registered_for_inline_macro$q_81.$$arity = 1); + + Opal.def(self, '$find_inline_macro_extension', TMP_Registry_find_inline_macro_extension_82 = function $$find_inline_macro_extension(name) { + var self = this; + + return self.inline_macro_extensions['$[]'](name.$to_sym()) + }, TMP_Registry_find_inline_macro_extension_82.$$arity = 1); + + Opal.def(self, '$inline_macros', TMP_Registry_inline_macros_83 = function $$inline_macros() { + var self = this; + + return self.inline_macro_extensions.$values() + }, TMP_Registry_inline_macros_83.$$arity = 0); + + Opal.def(self, '$prefer', TMP_Registry_prefer_84 = function $$prefer($a) { + var $iter = TMP_Registry_prefer_84.$$p, block = $iter || nil, $post_args, args, self = this, extension = nil, arg0 = nil, extensions_store = nil; + + if ($iter) TMP_Registry_prefer_84.$$p = null; + + + if ($iter) TMP_Registry_prefer_84.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + extension = (function() {if ($truthy($$($nesting, 'ProcessorExtension')['$===']((arg0 = args.$shift())))) { + return arg0 + } else { + + return $send(self, 'send', [arg0].concat(Opal.to_a(args)), block.$to_proc()); + }; return nil; })(); + extensions_store = self.$instance_variable_get(((("" + "@") + (extension.$kind())) + "_extensions").$to_sym()); + extensions_store.$unshift(extensions_store.$delete(extension)); + return extension; + }, TMP_Registry_prefer_84.$$arity = -1); + self.$private(); + + Opal.def(self, '$add_document_processor', TMP_Registry_add_document_processor_85 = function $$add_document_processor(kind, args) { + var $iter = TMP_Registry_add_document_processor_85.$$p, block = $iter || nil, TMP_86, $a, $b, $c, self = this, kind_name = nil, kind_class_symbol = nil, kind_class = nil, kind_java_class = nil, kind_store = nil, extension = nil, config = nil, processor = nil, processor_class = nil, processor_instance = nil; + + if ($iter) TMP_Registry_add_document_processor_85.$$p = null; + + + if ($iter) TMP_Registry_add_document_processor_85.$$p = null;; + kind_name = kind.$to_s().$tr("_", " "); + kind_class_symbol = $send(kind_name.$split(), 'map', [], (TMP_86 = function(it){var self = TMP_86.$$s || this; + + + + if (it == null) { + it = nil; + }; + return it.$capitalize();}, TMP_86.$$s = self, TMP_86.$$arity = 1, TMP_86)).$join().$to_sym(); + kind_class = $$($nesting, 'Extensions').$const_get(kind_class_symbol); + kind_java_class = (function() {if ($truthy((($a = $$$('::', 'AsciidoctorJ', 'skip_raise')) ? 'constant' : nil))) { + + return $$$($$$('::', 'AsciidoctorJ'), 'Extensions').$const_get(kind_class_symbol); + } else { + return nil + }; return nil; })(); + kind_store = ($truthy($b = self.$instance_variable_get(((("" + "@") + (kind)) + "_extensions").$to_sym())) ? $b : self.$instance_variable_set(((("" + "@") + (kind)) + "_extensions").$to_sym(), [])); + extension = (function() {if ((block !== nil)) { + + config = self.$resolve_args(args, 1); + processor = kind_class.$new(config); + if ($truthy(kind_class.$constants().$grep("DSL"))) { + processor.$extend(kind_class.$const_get("DSL"))}; + $send(processor, 'instance_exec', [], block.$to_proc()); + processor.$freeze(); + if ($truthy(processor['$process_block_given?']())) { + } else { + self.$raise($$$('::', 'ArgumentError'), "" + "No block specified to process " + (kind_name) + " extension at " + (block.$source_location())) + }; + return $$($nesting, 'ProcessorExtension').$new(kind, processor); + } else { + + $c = self.$resolve_args(args, 2), $b = Opal.to_ary($c), (processor = ($b[0] == null ? nil : $b[0])), (config = ($b[1] == null ? nil : $b[1])), $c; + if ($truthy((processor_class = $$($nesting, 'Extensions').$resolve_class(processor)))) { + + if ($truthy(($truthy($b = $rb_lt(processor_class, kind_class)) ? $b : ($truthy($c = kind_java_class) ? $rb_lt(processor_class, kind_java_class) : $c)))) { + } else { + self.$raise($$$('::', 'ArgumentError'), "" + "Invalid type for " + (kind_name) + " extension: " + (processor)) + }; + processor_instance = processor_class.$new(config); + processor_instance.$freeze(); + return $$($nesting, 'ProcessorExtension').$new(kind, processor_instance); + } else if ($truthy(($truthy($b = kind_class['$==='](processor)) ? $b : ($truthy($c = kind_java_class) ? kind_java_class['$==='](processor) : $c)))) { + + processor.$update_config(config); + processor.$freeze(); + return $$($nesting, 'ProcessorExtension').$new(kind, processor); + } else { + return self.$raise($$$('::', 'ArgumentError'), "" + "Invalid arguments specified for registering " + (kind_name) + " extension: " + (args)) + }; + }; return nil; })(); + if (extension.$config()['$[]']("position")['$=='](">>")) { + + kind_store.$unshift(extension); + } else { + + kind_store['$<<'](extension); + }; + return extension; + }, TMP_Registry_add_document_processor_85.$$arity = 2); + + Opal.def(self, '$add_syntax_processor', TMP_Registry_add_syntax_processor_87 = function $$add_syntax_processor(kind, args) { + var $iter = TMP_Registry_add_syntax_processor_87.$$p, block = $iter || nil, TMP_88, $a, $b, $c, self = this, kind_name = nil, kind_class_symbol = nil, kind_class = nil, kind_java_class = nil, kind_store = nil, name = nil, config = nil, processor = nil, $writer = nil, processor_class = nil, processor_instance = nil; + + if ($iter) TMP_Registry_add_syntax_processor_87.$$p = null; + + + if ($iter) TMP_Registry_add_syntax_processor_87.$$p = null;; + kind_name = kind.$to_s().$tr("_", " "); + kind_class_symbol = $send(kind_name.$split(), 'map', [], (TMP_88 = function(it){var self = TMP_88.$$s || this; + + + + if (it == null) { + it = nil; + }; + return it.$capitalize();}, TMP_88.$$s = self, TMP_88.$$arity = 1, TMP_88)).$push("Processor").$join().$to_sym(); + kind_class = $$($nesting, 'Extensions').$const_get(kind_class_symbol); + kind_java_class = (function() {if ($truthy((($a = $$$('::', 'AsciidoctorJ', 'skip_raise')) ? 'constant' : nil))) { + + return $$$($$$('::', 'AsciidoctorJ'), 'Extensions').$const_get(kind_class_symbol); + } else { + return nil + }; return nil; })(); + kind_store = ($truthy($b = self.$instance_variable_get(((("" + "@") + (kind)) + "_extensions").$to_sym())) ? $b : self.$instance_variable_set(((("" + "@") + (kind)) + "_extensions").$to_sym(), $hash2([], {}))); + if ((block !== nil)) { + + $c = self.$resolve_args(args, 2), $b = Opal.to_ary($c), (name = ($b[0] == null ? nil : $b[0])), (config = ($b[1] == null ? nil : $b[1])), $c; + processor = kind_class.$new(self.$as_symbol(name), config); + if ($truthy(kind_class.$constants().$grep("DSL"))) { + processor.$extend(kind_class.$const_get("DSL"))}; + if (block.$arity()['$=='](1)) { + Opal.yield1(block, processor) + } else { + $send(processor, 'instance_exec', [], block.$to_proc()) + }; + if ($truthy((name = self.$as_symbol(processor.$name())))) { + } else { + self.$raise($$$('::', 'ArgumentError'), "" + "No name specified for " + (kind_name) + " extension at " + (block.$source_location())) + }; + if ($truthy(processor['$process_block_given?']())) { + } else { + self.$raise($$$('::', 'NoMethodError'), "" + "No block specified to process " + (kind_name) + " extension at " + (block.$source_location())) + }; + processor.$freeze(); + + $writer = [name, $$($nesting, 'ProcessorExtension').$new(kind, processor)]; + $send(kind_store, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];; + } else { + + $c = self.$resolve_args(args, 3), $b = Opal.to_ary($c), (processor = ($b[0] == null ? nil : $b[0])), (name = ($b[1] == null ? nil : $b[1])), (config = ($b[2] == null ? nil : $b[2])), $c; + if ($truthy((processor_class = $$($nesting, 'Extensions').$resolve_class(processor)))) { + + if ($truthy(($truthy($b = $rb_lt(processor_class, kind_class)) ? $b : ($truthy($c = kind_java_class) ? $rb_lt(processor_class, kind_java_class) : $c)))) { + } else { + self.$raise($$$('::', 'ArgumentError'), "" + "Class specified for " + (kind_name) + " extension does not inherit from " + (kind_class) + ": " + (processor)) + }; + processor_instance = processor_class.$new(self.$as_symbol(name), config); + if ($truthy((name = self.$as_symbol(processor_instance.$name())))) { + } else { + self.$raise($$$('::', 'ArgumentError'), "" + "No name specified for " + (kind_name) + " extension: " + (processor)) + }; + processor_instance.$freeze(); + + $writer = [name, $$($nesting, 'ProcessorExtension').$new(kind, processor_instance)]; + $send(kind_store, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];; + } else if ($truthy(($truthy($b = kind_class['$==='](processor)) ? $b : ($truthy($c = kind_java_class) ? kind_java_class['$==='](processor) : $c)))) { + + processor.$update_config(config); + if ($truthy((name = (function() {if ($truthy(name)) { + + + $writer = [self.$as_symbol(name)]; + $send(processor, 'name=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];; + } else { + + return self.$as_symbol(processor.$name()); + }; return nil; })()))) { + } else { + self.$raise($$$('::', 'ArgumentError'), "" + "No name specified for " + (kind_name) + " extension: " + (processor)) + }; + processor.$freeze(); + + $writer = [name, $$($nesting, 'ProcessorExtension').$new(kind, processor)]; + $send(kind_store, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];; + } else { + return self.$raise($$$('::', 'ArgumentError'), "" + "Invalid arguments specified for registering " + (kind_name) + " extension: " + (args)) + }; + }; + }, TMP_Registry_add_syntax_processor_87.$$arity = 2); + + Opal.def(self, '$resolve_args', TMP_Registry_resolve_args_89 = function $$resolve_args(args, expect) { + var self = this, opts = nil, missing = nil; + + + opts = (function() {if ($truthy($$$('::', 'Hash')['$==='](args['$[]'](-1)))) { + return args.$pop() + } else { + return $hash2([], {}) + }; return nil; })(); + if (expect['$=='](1)) { + return opts}; + if ($truthy($rb_gt((missing = $rb_minus($rb_minus(expect, 1), args.$size())), 0))) { + args = $rb_plus(args, $$$('::', 'Array').$new(missing)) + } else if ($truthy($rb_lt(missing, 0))) { + args.$pop(missing['$-@']())}; + args['$<<'](opts); + return args; + }, TMP_Registry_resolve_args_89.$$arity = 2); + return (Opal.def(self, '$as_symbol', TMP_Registry_as_symbol_90 = function $$as_symbol(name) { + var self = this; + + if ($truthy(name)) { + return name.$to_sym() + } else { + return nil + } + }, TMP_Registry_as_symbol_90.$$arity = 1), nil) && 'as_symbol'; + })($nesting[0], null, $nesting); + (function(self, $parent_nesting) { + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_generate_name_91, TMP_next_auto_id_92, TMP_groups_93, TMP_create_94, TMP_register_95, TMP_unregister_all_96, TMP_unregister_97, TMP_resolve_class_99, TMP_class_for_name_100, TMP_class_for_name_101, TMP_class_for_name_103; + + + + Opal.def(self, '$generate_name', TMP_generate_name_91 = function $$generate_name() { + var self = this; + + return "" + "extgrp" + (self.$next_auto_id()) + }, TMP_generate_name_91.$$arity = 0); + + Opal.def(self, '$next_auto_id', TMP_next_auto_id_92 = function $$next_auto_id() { + var $a, self = this; + if (self.auto_id == null) self.auto_id = nil; + + + self.auto_id = ($truthy($a = self.auto_id) ? $a : -1); + return (self.auto_id = $rb_plus(self.auto_id, 1)); + }, TMP_next_auto_id_92.$$arity = 0); + + Opal.def(self, '$groups', TMP_groups_93 = function $$groups() { + var $a, self = this; + if (self.groups == null) self.groups = nil; + + return (self.groups = ($truthy($a = self.groups) ? $a : $hash2([], {}))) + }, TMP_groups_93.$$arity = 0); + + Opal.def(self, '$create', TMP_create_94 = function $$create(name) { + var $iter = TMP_create_94.$$p, block = $iter || nil, $a, self = this; + + if ($iter) TMP_create_94.$$p = null; + + + if ($iter) TMP_create_94.$$p = null;; + + if (name == null) { + name = nil; + }; + if ((block !== nil)) { + return $$($nesting, 'Registry').$new($hash(($truthy($a = name) ? $a : self.$generate_name()), block)) + } else { + return $$($nesting, 'Registry').$new() + }; + }, TMP_create_94.$$arity = -1); + Opal.alias(self, "build_registry", "create"); + + Opal.def(self, '$register', TMP_register_95 = function $$register($a) { + var $iter = TMP_register_95.$$p, block = $iter || nil, $post_args, args, $b, self = this, argc = nil, resolved_group = nil, group = nil, name = nil, $writer = nil; + + if ($iter) TMP_register_95.$$p = null; + + + if ($iter) TMP_register_95.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + argc = args.$size(); + if ((block !== nil)) { + resolved_group = block + } else if ($truthy((group = args.$pop()))) { + resolved_group = ($truthy($b = self.$resolve_class(group)) ? $b : group) + } else { + self.$raise($$$('::', 'ArgumentError'), "Extension group to register not specified") + }; + name = ($truthy($b = args.$pop()) ? $b : self.$generate_name()); + if ($truthy(args['$empty?']())) { + } else { + self.$raise($$$('::', 'ArgumentError'), "" + "Wrong number of arguments (" + (argc) + " for 1..2)") + }; + + $writer = [name.$to_sym(), resolved_group]; + $send(self.$groups(), '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];; + }, TMP_register_95.$$arity = -1); + + Opal.def(self, '$unregister_all', TMP_unregister_all_96 = function $$unregister_all() { + var self = this; + + + self.groups = $hash2([], {}); + return nil; + }, TMP_unregister_all_96.$$arity = 0); + + Opal.def(self, '$unregister', TMP_unregister_97 = function $$unregister($a) { + var $post_args, names, TMP_98, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + names = $post_args;; + $send(names, 'each', [], (TMP_98 = function(group){var self = TMP_98.$$s || this; + if (self.groups == null) self.groups = nil; + + + + if (group == null) { + group = nil; + }; + return self.groups.$delete(group.$to_sym());}, TMP_98.$$s = self, TMP_98.$$arity = 1, TMP_98)); + return nil; + }, TMP_unregister_97.$$arity = -1); + + Opal.def(self, '$resolve_class', TMP_resolve_class_99 = function $$resolve_class(object) { + var self = this, $case = nil; + + return (function() {$case = object; + if ($$$('::', 'Class')['$===']($case)) {return object} + else if ($$$('::', 'String')['$===']($case)) {return self.$class_for_name(object)} + else { return nil }})() + }, TMP_resolve_class_99.$$arity = 1); + if ($truthy($$$('::', 'RUBY_MIN_VERSION_2'))) { + return (Opal.def(self, '$class_for_name', TMP_class_for_name_100 = function $$class_for_name(qualified_name) { + var self = this, resolved = nil; + + try { + + resolved = $$$('::', 'Object').$const_get(qualified_name, false); + if ($truthy($$$('::', 'Class')['$==='](resolved))) { + } else { + self.$raise() + }; + return resolved; + } catch ($err) { + if (Opal.rescue($err, [$$($nesting, 'StandardError')])) { + try { + return self.$raise($$$('::', 'NameError'), "" + "Could not resolve class for name: " + (qualified_name)) + } finally { Opal.pop_exception() } + } else { throw $err; } + } + }, TMP_class_for_name_100.$$arity = 1), nil) && 'class_for_name' + } else if ($truthy($$$('::', 'RUBY_MIN_VERSION_1_9'))) { + return (Opal.def(self, '$class_for_name', TMP_class_for_name_101 = function $$class_for_name(qualified_name) { + var TMP_102, self = this, resolved = nil; + + try { + + resolved = $send(qualified_name.$split("::"), 'reduce', [$$$('::', 'Object')], (TMP_102 = function(current, name){var self = TMP_102.$$s || this; + + + + if (current == null) { + current = nil; + }; + + if (name == null) { + name = nil; + }; + if ($truthy(name['$empty?']())) { + return current + } else { + + return current.$const_get(name, false); + };}, TMP_102.$$s = self, TMP_102.$$arity = 2, TMP_102)); + if ($truthy($$$('::', 'Class')['$==='](resolved))) { + } else { + self.$raise() + }; + return resolved; + } catch ($err) { + if (Opal.rescue($err, [$$($nesting, 'StandardError')])) { + try { + return self.$raise($$$('::', 'NameError'), "" + "Could not resolve class for name: " + (qualified_name)) + } finally { Opal.pop_exception() } + } else { throw $err; } + } + }, TMP_class_for_name_101.$$arity = 1), nil) && 'class_for_name' + } else { + return (Opal.def(self, '$class_for_name', TMP_class_for_name_103 = function $$class_for_name(qualified_name) { + var TMP_104, self = this, resolved = nil; + + try { + + resolved = $send(qualified_name.$split("::"), 'reduce', [$$$('::', 'Object')], (TMP_104 = function(current, name){var self = TMP_104.$$s || this; + + + + if (current == null) { + current = nil; + }; + + if (name == null) { + name = nil; + }; + if ($truthy(name['$empty?']())) { + return current + } else { + + if ($truthy(current['$const_defined?'](name))) { + + return current.$const_get(name); + } else { + return self.$raise() + }; + };}, TMP_104.$$s = self, TMP_104.$$arity = 2, TMP_104)); + if ($truthy($$$('::', 'Class')['$==='](resolved))) { + } else { + self.$raise() + }; + return resolved; + } catch ($err) { + if (Opal.rescue($err, [$$($nesting, 'StandardError')])) { + try { + return self.$raise($$$('::', 'NameError'), "" + "Could not resolve class for name: " + (qualified_name)) + } finally { Opal.pop_exception() } + } else { throw $err; } + } + }, TMP_class_for_name_103.$$arity = 1), nil) && 'class_for_name' + }; + })(Opal.get_singleton_class(self), $nesting); + })($nesting[0], $nesting) + })($nesting[0], $nesting); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/js/opal_ext/browser/reader"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $truthy = Opal.truthy; + + Opal.add_stubs(['$posixify', '$new', '$base_dir', '$start_with?', '$uriish?', '$descends_from?', '$key?', '$attributes', '$replace_next_line', '$absolute_path?', '$==', '$empty?', '$!', '$slice', '$length']); + return (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + (function($base, $super, $parent_nesting) { + function $PreprocessorReader(){}; + var self = $PreprocessorReader = $klass($base, $super, 'PreprocessorReader', $PreprocessorReader); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_PreprocessorReader_resolve_include_path_1; + + def.path_resolver = def.document = def.include_stack = def.dir = nil; + return (Opal.def(self, '$resolve_include_path', TMP_PreprocessorReader_resolve_include_path_1 = function $$resolve_include_path(target, attrlist, attributes) { + var $a, self = this, p_target = nil, target_type = nil, base_dir = nil, inc_path = nil, relpath = nil, ctx_dir = nil, top_level = nil, offset = nil; + + + p_target = (self.path_resolver = ($truthy($a = self.path_resolver) ? $a : $$($nesting, 'PathResolver').$new("\\"))).$posixify(target); + $a = ["file", self.document.$base_dir()], (target_type = $a[0]), (base_dir = $a[1]), $a; + if ($truthy(p_target['$start_with?']("file://"))) { + inc_path = (relpath = p_target) + } else if ($truthy($$($nesting, 'Helpers')['$uriish?'](p_target))) { + + if ($truthy(($truthy($a = self.path_resolver['$descends_from?'](p_target, base_dir)) ? $a : self.document.$attributes()['$key?']("allow-uri-read")))) { + } else { + return self.$replace_next_line("" + "link:" + (target) + "[" + (attrlist) + "]") + }; + inc_path = (relpath = p_target); + } else if ($truthy(self.path_resolver['$absolute_path?'](p_target))) { + inc_path = (relpath = "" + "file://" + ((function() {if ($truthy(p_target['$start_with?']("/"))) { + return "" + } else { + return "/" + }; return nil; })()) + (p_target)) + } else if ((ctx_dir = (function() {if ($truthy((top_level = self.include_stack['$empty?']()))) { + return base_dir + } else { + return self.dir + }; return nil; })())['$=='](".")) { + inc_path = (relpath = p_target) + } else if ($truthy(($truthy($a = ctx_dir['$start_with?']("file://")) ? $a : $$($nesting, 'Helpers')['$uriish?'](ctx_dir)['$!']()))) { + + inc_path = "" + (ctx_dir) + "/" + (p_target); + if ($truthy(top_level)) { + relpath = p_target + } else if ($truthy(($truthy($a = base_dir['$=='](".")) ? $a : (offset = self.path_resolver['$descends_from?'](inc_path, base_dir))['$!']()))) { + relpath = inc_path + } else { + relpath = inc_path.$slice(offset, inc_path.$length()) + }; + } else if ($truthy(top_level)) { + inc_path = "" + (ctx_dir) + "/" + ((relpath = p_target)) + } else if ($truthy(($truthy($a = (offset = self.path_resolver['$descends_from?'](ctx_dir, base_dir))) ? $a : self.document.$attributes()['$key?']("allow-uri-read")))) { + + inc_path = "" + (ctx_dir) + "/" + (p_target); + relpath = (function() {if ($truthy(offset)) { + + return inc_path.$slice(offset, inc_path.$length()); + } else { + return p_target + }; return nil; })(); + } else { + return self.$replace_next_line("" + "link:" + (target) + "[" + (attrlist) + "]") + }; + return [inc_path, "file", relpath]; + }, TMP_PreprocessorReader_resolve_include_path_1.$$arity = 3), nil) && 'resolve_include_path' + })($nesting[0], $$($nesting, 'Reader'), $nesting) + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/js/postscript"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice; + + Opal.add_stubs(['$require', '$==']); + + self.$require("asciidoctor/converter/composite"); + self.$require("asciidoctor/converter/html5"); + self.$require("asciidoctor/extensions"); + if ($$($nesting, 'JAVASCRIPT_IO_MODULE')['$==']("xmlhttprequest")) { + return self.$require("asciidoctor/js/opal_ext/browser/reader") + } else { + return nil + }; +}; + +/* Generated by Opal 0.11.99.dev */ +(function(Opal) { + function $rb_ge(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs >= rhs : lhs['$>='](rhs); + } + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + function $rb_lt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); + } + var $a, self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $truthy = Opal.truthy, $gvars = Opal.gvars, $module = Opal.module, $hash2 = Opal.hash2, $send = Opal.send, $hash = Opal.hash; + if ($gvars[":"] == null) $gvars[":"] = nil; + + Opal.add_stubs(['$==', '$>=', '$require', '$unshift', '$dirname', '$each', '$constants', '$const_get', '$downcase', '$to_s', '$[]=', '$-', '$upcase', '$[]', '$values', '$new', '$attr_reader', '$instance_variable_set', '$send', '$<<', '$define', '$expand_path', '$join', '$home', '$pwd', '$!', '$!=', '$default_external', '$to_set', '$map', '$keys', '$slice', '$merge', '$default=', '$to_a', '$escape', '$drop', '$insert', '$dup', '$start', '$logger', '$logger=', '$===', '$split', '$gsub', '$respond_to?', '$raise', '$ancestors', '$class', '$path', '$utc', '$at', '$Integer', '$mtime', '$readlines', '$basename', '$extname', '$index', '$strftime', '$year', '$utc_offset', '$rewind', '$lines', '$each_line', '$record', '$parse', '$exception', '$message', '$set_backtrace', '$backtrace', '$stack_trace', '$stack_trace=', '$open', '$load', '$delete', '$key?', '$attributes', '$outfilesuffix', '$safe', '$normalize_system_path', '$mkdir_p', '$directory?', '$convert', '$write', '$<', '$attr?', '$attr', '$uriish?', '$include?', '$write_primary_stylesheet', '$instance', '$empty?', '$read_asset', '$file?', '$write_coderay_stylesheet', '$write_pygments_stylesheet']); + + if ($truthy((($a = $$($nesting, 'RUBY_ENGINE', 'skip_raise')) ? 'constant' : nil))) { + } else { + Opal.const_set($nesting[0], 'RUBY_ENGINE', "unknown") + }; + Opal.const_set($nesting[0], 'RUBY_ENGINE_OPAL', $$($nesting, 'RUBY_ENGINE')['$==']("opal")); + Opal.const_set($nesting[0], 'RUBY_ENGINE_JRUBY', $$($nesting, 'RUBY_ENGINE')['$==']("jruby")); + Opal.const_set($nesting[0], 'RUBY_MIN_VERSION_1_9', $rb_ge($$($nesting, 'RUBY_VERSION'), "1.9")); + Opal.const_set($nesting[0], 'RUBY_MIN_VERSION_2', $rb_ge($$($nesting, 'RUBY_VERSION'), "2")); + self.$require("set"); + if ($$($nesting, 'RUBY_ENGINE')['$==']("opal")) { + self.$require("asciidoctor/js") + } else { + nil + }; + $gvars[":"].$unshift($$($nesting, 'File').$dirname("asciidoctor.rb")); + self.$require("asciidoctor/logging"); + (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), $a, TMP_Asciidoctor_6, TMP_Asciidoctor_7, TMP_Asciidoctor_8, $writer = nil, quote_subs = nil, compat_quote_subs = nil; + + + Opal.const_set($nesting[0], 'RUBY_ENGINE', $$$('::', 'RUBY_ENGINE')); + (function($base, $parent_nesting) { + function $SafeMode() {}; + var self = $SafeMode = $module($base, 'SafeMode', $SafeMode); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_SafeMode_1, TMP_SafeMode_value_for_name_2, TMP_SafeMode_name_for_value_3, TMP_SafeMode_names_4, rec = nil; + + + Opal.const_set($nesting[0], 'UNSAFE', 0); + Opal.const_set($nesting[0], 'SAFE', 1); + Opal.const_set($nesting[0], 'SERVER', 10); + Opal.const_set($nesting[0], 'SECURE', 20); + rec = $hash2([], {}); + $send((Opal.Module.$$nesting = $nesting, self.$constants()), 'each', [], (TMP_SafeMode_1 = function(sym){var self = TMP_SafeMode_1.$$s || this, $writer = nil; + + + + if (sym == null) { + sym = nil; + }; + $writer = [self.$const_get(sym), sym.$to_s().$downcase()]; + $send(rec, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];}, TMP_SafeMode_1.$$s = self, TMP_SafeMode_1.$$arity = 1, TMP_SafeMode_1)); + self.names_by_value = rec; + Opal.defs(self, '$value_for_name', TMP_SafeMode_value_for_name_2 = function $$value_for_name(name) { + var self = this; + + return self.$const_get(name.$upcase()) + }, TMP_SafeMode_value_for_name_2.$$arity = 1); + Opal.defs(self, '$name_for_value', TMP_SafeMode_name_for_value_3 = function $$name_for_value(value) { + var self = this; + if (self.names_by_value == null) self.names_by_value = nil; + + return self.names_by_value['$[]'](value) + }, TMP_SafeMode_name_for_value_3.$$arity = 1); + Opal.defs(self, '$names', TMP_SafeMode_names_4 = function $$names() { + var self = this; + if (self.names_by_value == null) self.names_by_value = nil; + + return self.names_by_value.$values() + }, TMP_SafeMode_names_4.$$arity = 0); + })($nesting[0], $nesting); + (function($base, $parent_nesting) { + function $Compliance() {}; + var self = $Compliance = $module($base, 'Compliance', $Compliance); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Compliance_define_5; + + + self.keys = $$$('::', 'Set').$new(); + (function(self, $parent_nesting) { + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return self.$attr_reader("keys") + })(Opal.get_singleton_class(self), $nesting); + Opal.defs(self, '$define', TMP_Compliance_define_5 = function $$define(key, value) { + var self = this; + if (self.keys == null) self.keys = nil; + + + self.$instance_variable_set("" + "@" + (key), value); + (function(self, $parent_nesting) { + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return self + })(Opal.get_singleton_class(self), $nesting).$send("attr_accessor", key); + self.keys['$<<'](key); + return nil; + }, TMP_Compliance_define_5.$$arity = 2); + self.$define("block_terminates_paragraph", true); + self.$define("strict_verbatim_paragraphs", true); + self.$define("underline_style_section_titles", true); + self.$define("unwrap_standalone_preamble", true); + self.$define("attribute_missing", "skip"); + self.$define("attribute_undefined", "drop-line"); + self.$define("shorthand_property_syntax", true); + self.$define("natural_xrefs", true); + self.$define("unique_id_start_index", 2); + self.$define("markdown_syntax", true); + })($nesting[0], $nesting); + Opal.const_set($nesting[0], 'ROOT_PATH', $$$('::', 'File').$dirname($$$('::', 'File').$dirname($$$('::', 'File').$expand_path("asciidoctor.rb")))); + Opal.const_set($nesting[0], 'DATA_PATH', $$$('::', 'File').$join($$($nesting, 'ROOT_PATH'), "data")); + + try { + Opal.const_set($nesting[0], 'USER_HOME', $$$('::', 'Dir').$home()) + } catch ($err) { + if (Opal.rescue($err, [$$($nesting, 'StandardError')])) { + try { + Opal.const_set($nesting[0], 'USER_HOME', ($truthy($a = $$$('::', 'ENV')['$[]']("HOME")) ? $a : $$$('::', 'Dir').$pwd())) + } finally { Opal.pop_exception() } + } else { throw $err; } + };; + Opal.const_set($nesting[0], 'COERCE_ENCODING', ($truthy($a = $$$('::', 'RUBY_ENGINE_OPAL')['$!']()) ? $$$('::', 'RUBY_MIN_VERSION_1_9') : $a)); + Opal.const_set($nesting[0], 'FORCE_ENCODING', ($truthy($a = $$($nesting, 'COERCE_ENCODING')) ? $$$('::', 'Encoding').$default_external()['$!=']($$$($$$('::', 'Encoding'), 'UTF_8')) : $a)); + Opal.const_set($nesting[0], 'BOM_BYTES_UTF_8', [239, 187, 191]); + Opal.const_set($nesting[0], 'BOM_BYTES_UTF_16LE', [255, 254]); + Opal.const_set($nesting[0], 'BOM_BYTES_UTF_16BE', [254, 255]); + Opal.const_set($nesting[0], 'FORCE_UNICODE_LINE_LENGTH', $$$('::', 'RUBY_MIN_VERSION_1_9')['$!']()); + Opal.const_set($nesting[0], 'LF', Opal.const_set($nesting[0], 'EOL', "\n")); + Opal.const_set($nesting[0], 'NULL', "\u0000"); + Opal.const_set($nesting[0], 'TAB', "\t"); + Opal.const_set($nesting[0], 'MAX_INT', 9007199254740991); + Opal.const_set($nesting[0], 'DEFAULT_DOCTYPE', "article"); + Opal.const_set($nesting[0], 'DEFAULT_BACKEND', "html5"); + Opal.const_set($nesting[0], 'DEFAULT_STYLESHEET_KEYS', ["", "DEFAULT"].$to_set()); + Opal.const_set($nesting[0], 'DEFAULT_STYLESHEET_NAME', "asciidoctor.css"); + Opal.const_set($nesting[0], 'BACKEND_ALIASES', $hash2(["html", "docbook"], {"html": "html5", "docbook": "docbook5"})); + Opal.const_set($nesting[0], 'DEFAULT_PAGE_WIDTHS', $hash2(["docbook"], {"docbook": 425})); + Opal.const_set($nesting[0], 'DEFAULT_EXTENSIONS', $hash2(["html", "docbook", "pdf", "epub", "manpage", "asciidoc"], {"html": ".html", "docbook": ".xml", "pdf": ".pdf", "epub": ".epub", "manpage": ".man", "asciidoc": ".adoc"})); + Opal.const_set($nesting[0], 'ASCIIDOC_EXTENSIONS', $hash2([".adoc", ".asciidoc", ".asc", ".ad", ".txt"], {".adoc": true, ".asciidoc": true, ".asc": true, ".ad": true, ".txt": true})); + Opal.const_set($nesting[0], 'SETEXT_SECTION_LEVELS', $hash2(["=", "-", "~", "^", "+"], {"=": 0, "-": 1, "~": 2, "^": 3, "+": 4})); + Opal.const_set($nesting[0], 'ADMONITION_STYLES', ["NOTE", "TIP", "IMPORTANT", "WARNING", "CAUTION"].$to_set()); + Opal.const_set($nesting[0], 'ADMONITION_STYLE_HEADS', ["N", "T", "I", "W", "C"].$to_set()); + Opal.const_set($nesting[0], 'PARAGRAPH_STYLES', ["comment", "example", "literal", "listing", "normal", "open", "pass", "quote", "sidebar", "source", "verse", "abstract", "partintro"].$to_set()); + Opal.const_set($nesting[0], 'VERBATIM_STYLES', ["literal", "listing", "source", "verse"].$to_set()); + Opal.const_set($nesting[0], 'DELIMITED_BLOCKS', $hash2(["--", "----", "....", "====", "****", "____", "\"\"", "++++", "|===", ",===", ":===", "!===", "////", "```"], {"--": ["open", ["comment", "example", "literal", "listing", "pass", "quote", "sidebar", "source", "verse", "admonition", "abstract", "partintro"].$to_set()], "----": ["listing", ["literal", "source"].$to_set()], "....": ["literal", ["listing", "source"].$to_set()], "====": ["example", ["admonition"].$to_set()], "****": ["sidebar", $$$('::', 'Set').$new()], "____": ["quote", ["verse"].$to_set()], "\"\"": ["quote", ["verse"].$to_set()], "++++": ["pass", ["stem", "latexmath", "asciimath"].$to_set()], "|===": ["table", $$$('::', 'Set').$new()], ",===": ["table", $$$('::', 'Set').$new()], ":===": ["table", $$$('::', 'Set').$new()], "!===": ["table", $$$('::', 'Set').$new()], "////": ["comment", $$$('::', 'Set').$new()], "```": ["fenced_code", $$$('::', 'Set').$new()]})); + Opal.const_set($nesting[0], 'DELIMITED_BLOCK_HEADS', $send($$($nesting, 'DELIMITED_BLOCKS').$keys(), 'map', [], (TMP_Asciidoctor_6 = function(key){var self = TMP_Asciidoctor_6.$$s || this; + + + + if (key == null) { + key = nil; + }; + return key.$slice(0, 2);}, TMP_Asciidoctor_6.$$s = self, TMP_Asciidoctor_6.$$arity = 1, TMP_Asciidoctor_6)).$to_set()); + Opal.const_set($nesting[0], 'LAYOUT_BREAK_CHARS', $hash2(["'", "<"], {"'": "thematic_break", "<": "page_break"})); + Opal.const_set($nesting[0], 'MARKDOWN_THEMATIC_BREAK_CHARS', $hash2(["-", "*", "_"], {"-": "thematic_break", "*": "thematic_break", "_": "thematic_break"})); + Opal.const_set($nesting[0], 'HYBRID_LAYOUT_BREAK_CHARS', $$($nesting, 'LAYOUT_BREAK_CHARS').$merge($$($nesting, 'MARKDOWN_THEMATIC_BREAK_CHARS'))); + Opal.const_set($nesting[0], 'NESTABLE_LIST_CONTEXTS', ["ulist", "olist", "dlist"]); + Opal.const_set($nesting[0], 'ORDERED_LIST_STYLES', ["arabic", "loweralpha", "lowerroman", "upperalpha", "upperroman"]); + Opal.const_set($nesting[0], 'ORDERED_LIST_KEYWORDS', $hash2(["loweralpha", "lowerroman", "upperalpha", "upperroman"], {"loweralpha": "a", "lowerroman": "i", "upperalpha": "A", "upperroman": "I"})); + Opal.const_set($nesting[0], 'ATTR_REF_HEAD', "{"); + Opal.const_set($nesting[0], 'LIST_CONTINUATION', "+"); + Opal.const_set($nesting[0], 'HARD_LINE_BREAK', " +"); + Opal.const_set($nesting[0], 'LINE_CONTINUATION', " \\"); + Opal.const_set($nesting[0], 'LINE_CONTINUATION_LEGACY', " +"); + Opal.const_set($nesting[0], 'MATHJAX_VERSION', "2.7.4"); + Opal.const_set($nesting[0], 'BLOCK_MATH_DELIMITERS', $hash2(["asciimath", "latexmath"], {"asciimath": ["\\$", "\\$"], "latexmath": ["\\[", "\\]"]})); + Opal.const_set($nesting[0], 'INLINE_MATH_DELIMITERS', $hash2(["asciimath", "latexmath"], {"asciimath": ["\\$", "\\$"], "latexmath": ["\\(", "\\)"]})); + + $writer = ["asciimath"]; + $send(Opal.const_set($nesting[0], 'STEM_TYPE_ALIASES', $hash2(["latexmath", "latex", "tex"], {"latexmath": "latexmath", "latex": "latexmath", "tex": "latexmath"})), 'default=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + Opal.const_set($nesting[0], 'FONT_AWESOME_VERSION', "4.7.0"); + Opal.const_set($nesting[0], 'FLEXIBLE_ATTRIBUTES', ["sectnums"]); + if ($$($nesting, 'RUBY_ENGINE')['$==']("opal")) { + if ($truthy((($a = $$($nesting, 'CC_ANY', 'skip_raise')) ? 'constant' : nil))) { + } else { + Opal.const_set($nesting[0], 'CC_ANY', "[^\\n]") + } + } else { + nil + }; + Opal.const_set($nesting[0], 'AuthorInfoLineRx', new RegExp("" + "^(" + ($$($nesting, 'CG_WORD')) + "[" + ($$($nesting, 'CC_WORD')) + "\\-'.]*)(?: +(" + ($$($nesting, 'CG_WORD')) + "[" + ($$($nesting, 'CC_WORD')) + "\\-'.]*))?(?: +(" + ($$($nesting, 'CG_WORD')) + "[" + ($$($nesting, 'CC_WORD')) + "\\-'.]*))?(?: +<([^>]+)>)?$")); + Opal.const_set($nesting[0], 'RevisionInfoLineRx', new RegExp("" + "^(?:[^\\d{]*(" + ($$($nesting, 'CC_ANY')) + "*?),)? *(?!:)(" + ($$($nesting, 'CC_ANY')) + "*?)(?: *(?!^),?: *(" + ($$($nesting, 'CC_ANY')) + "*))?$")); + Opal.const_set($nesting[0], 'ManpageTitleVolnumRx', new RegExp("" + "^(" + ($$($nesting, 'CC_ANY')) + "+?) *\\( *(" + ($$($nesting, 'CC_ANY')) + "+?) *\\)$")); + Opal.const_set($nesting[0], 'ManpageNamePurposeRx', new RegExp("" + "^(" + ($$($nesting, 'CC_ANY')) + "+?) +- +(" + ($$($nesting, 'CC_ANY')) + "+)$")); + Opal.const_set($nesting[0], 'ConditionalDirectiveRx', new RegExp("" + "^(\\\\)?(ifdef|ifndef|ifeval|endif)::(\\S*?(?:([,+])\\S*?)?)\\[(" + ($$($nesting, 'CC_ANY')) + "+)?\\]$")); + Opal.const_set($nesting[0], 'EvalExpressionRx', new RegExp("" + "^(" + ($$($nesting, 'CC_ANY')) + "+?) *([=!><]=|[><]) *(" + ($$($nesting, 'CC_ANY')) + "+)$")); + Opal.const_set($nesting[0], 'IncludeDirectiveRx', new RegExp("" + "^(\\\\)?include::([^\\[][^\\[]*)\\[(" + ($$($nesting, 'CC_ANY')) + "+)?\\]$")); + Opal.const_set($nesting[0], 'TagDirectiveRx', /\b(?:tag|(e)nd)::(\S+?)\[\](?=$|[ \r])/m); + Opal.const_set($nesting[0], 'AttributeEntryRx', new RegExp("" + "^:(!?" + ($$($nesting, 'CG_WORD')) + "[^:]*):(?:[ \\t]+(" + ($$($nesting, 'CC_ANY')) + "*))?$")); + Opal.const_set($nesting[0], 'InvalidAttributeNameCharsRx', new RegExp("" + "[^-" + ($$($nesting, 'CC_WORD')) + "]")); + if ($$($nesting, 'RUBY_ENGINE')['$==']("opal")) { + Opal.const_set($nesting[0], 'AttributeEntryPassMacroRx', /^pass:([a-z]+(?:,[a-z]+)*)?\[([\S\s]*)\]$/) + } else { + nil + }; + Opal.const_set($nesting[0], 'AttributeReferenceRx', new RegExp("" + "(\\\\)?\\{(" + ($$($nesting, 'CG_WORD')) + "[-" + ($$($nesting, 'CC_WORD')) + "]*|(set|counter2?):" + ($$($nesting, 'CC_ANY')) + "+?)(\\\\)?\\}")); + Opal.const_set($nesting[0], 'BlockAnchorRx', new RegExp("" + "^\\[\\[(?:|([" + ($$($nesting, 'CC_ALPHA')) + "_:][" + ($$($nesting, 'CC_WORD')) + ":.-]*)(?:, *(" + ($$($nesting, 'CC_ANY')) + "+))?)\\]\\]$")); + Opal.const_set($nesting[0], 'BlockAttributeListRx', new RegExp("" + "^\\[(|[" + ($$($nesting, 'CC_WORD')) + ".#%{,\"']" + ($$($nesting, 'CC_ANY')) + "*)\\]$")); + Opal.const_set($nesting[0], 'BlockAttributeLineRx', new RegExp("" + "^\\[(?:|[" + ($$($nesting, 'CC_WORD')) + ".#%{,\"']" + ($$($nesting, 'CC_ANY')) + "*|\\[(?:|[" + ($$($nesting, 'CC_ALPHA')) + "_:][" + ($$($nesting, 'CC_WORD')) + ":.-]*(?:, *" + ($$($nesting, 'CC_ANY')) + "+)?)\\])\\]$")); + Opal.const_set($nesting[0], 'BlockTitleRx', new RegExp("" + "^\\.(\\.?[^ \\t.]" + ($$($nesting, 'CC_ANY')) + "*)$")); + Opal.const_set($nesting[0], 'AdmonitionParagraphRx', new RegExp("" + "^(" + ($$($nesting, 'ADMONITION_STYLES').$to_a().$join("|")) + "):[ \\t]+")); + Opal.const_set($nesting[0], 'LiteralParagraphRx', new RegExp("" + "^([ \\t]+" + ($$($nesting, 'CC_ANY')) + "*)$")); + Opal.const_set($nesting[0], 'AtxSectionTitleRx', new RegExp("" + "^(=={0,5})[ \\t]+(" + ($$($nesting, 'CC_ANY')) + "+?)(?:[ \\t]+\\1)?$")); + Opal.const_set($nesting[0], 'ExtAtxSectionTitleRx', new RegExp("" + "^(=={0,5}|#\\\#{0,5})[ \\t]+(" + ($$($nesting, 'CC_ANY')) + "+?)(?:[ \\t]+\\1)?$")); + Opal.const_set($nesting[0], 'SetextSectionTitleRx', new RegExp("" + "^((?!\\.)" + ($$($nesting, 'CC_ANY')) + "*?" + ($$($nesting, 'CG_WORD')) + ($$($nesting, 'CC_ANY')) + "*)$")); + Opal.const_set($nesting[0], 'InlineSectionAnchorRx', new RegExp("" + " (\\\\)?\\[\\[([" + ($$($nesting, 'CC_ALPHA')) + "_:][" + ($$($nesting, 'CC_WORD')) + ":.-]*)(?:, *(" + ($$($nesting, 'CC_ANY')) + "+))?\\]\\]$")); + Opal.const_set($nesting[0], 'InvalidSectionIdCharsRx', new RegExp("" + "<[^>]+>|&(?:[a-z][a-z]+\\d{0,2}|#\\d\\d\\d{0,4}|#x[\\da-f][\\da-f][\\da-f]{0,3});|[^ " + ($$($nesting, 'CC_WORD')) + "\\-.]+?")); + Opal.const_set($nesting[0], 'AnyListRx', new RegExp("" + "^(?:[ \\t]*(?:-|\\*\\**|\\.\\.*|\\u2022|\\d+\\.|[a-zA-Z]\\.|[IVXivx]+\\))[ \\t]|(?!//[^/])" + ($$($nesting, 'CC_ANY')) + "*?(?::::{0,2}|;;)(?:$|[ \\t])|[ \\t])")); + Opal.const_set($nesting[0], 'UnorderedListRx', new RegExp("" + "^[ \\t]*(-|\\*\\**|\\u2022)[ \\t]+(" + ($$($nesting, 'CC_ANY')) + "*)$")); + Opal.const_set($nesting[0], 'OrderedListRx', new RegExp("" + "^[ \\t]*(\\.\\.*|\\d+\\.|[a-zA-Z]\\.|[IVXivx]+\\))[ \\t]+(" + ($$($nesting, 'CC_ANY')) + "*)$")); + Opal.const_set($nesting[0], 'OrderedListMarkerRxMap', $hash2(["arabic", "loweralpha", "lowerroman", "upperalpha", "upperroman"], {"arabic": /\d+\./, "loweralpha": /[a-z]\./, "lowerroman": /[ivx]+\)/, "upperalpha": /[A-Z]\./, "upperroman": /[IVX]+\)/})); + Opal.const_set($nesting[0], 'DescriptionListRx', new RegExp("" + "^(?!//[^/])[ \\t]*(" + ($$($nesting, 'CC_ANY')) + "*?)(:::{0,2}|;;)(?:$|[ \\t]+(" + ($$($nesting, 'CC_ANY')) + "*)$)")); + Opal.const_set($nesting[0], 'DescriptionListSiblingRx', $hash2(["::", ":::", "::::", ";;"], {"::": new RegExp("" + "^(?!//[^/])[ \\t]*(" + ($$($nesting, 'CC_ANY')) + "*[^:]|)(::)(?:$|[ \\t]+(" + ($$($nesting, 'CC_ANY')) + "*)$)"), ":::": new RegExp("" + "^(?!//[^/])[ \\t]*(" + ($$($nesting, 'CC_ANY')) + "*[^:]|)(:::)(?:$|[ \\t]+(" + ($$($nesting, 'CC_ANY')) + "*)$)"), "::::": new RegExp("" + "^(?!//[^/])[ \\t]*(" + ($$($nesting, 'CC_ANY')) + "*[^:]|)(::::)(?:$|[ \\t]+(" + ($$($nesting, 'CC_ANY')) + "*)$)"), ";;": new RegExp("" + "^(?!//[^/])[ \\t]*(" + ($$($nesting, 'CC_ANY')) + "*?)(;;)(?:$|[ \\t]+(" + ($$($nesting, 'CC_ANY')) + "*)$)")})); + Opal.const_set($nesting[0], 'CalloutListRx', new RegExp("" + "^<(\\d+|\\.)>[ \\t]+(" + ($$($nesting, 'CC_ANY')) + "*)$")); + Opal.const_set($nesting[0], 'CalloutExtractRx', /((?:\/\/|#|--|;;) ?)?(\\)?(?=(?: ?\\?)*$)/); + Opal.const_set($nesting[0], 'CalloutExtractRxt', "(\\\\)?<()(\\d+|\\.)>(?=(?: ?\\\\?<(?:\\d+|\\.)>)*$)"); + Opal.const_set($nesting[0], 'CalloutExtractRxMap', $send($$$('::', 'Hash'), 'new', [], (TMP_Asciidoctor_7 = function(h, k){var self = TMP_Asciidoctor_7.$$s || this; + + + + if (h == null) { + h = nil; + }; + + if (k == null) { + k = nil; + }; + $writer = [k, new RegExp("" + "(" + ($$$('::', 'Regexp').$escape(k)) + " ?)?" + ($$($nesting, 'CalloutExtractRxt')))]; + $send(h, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];}, TMP_Asciidoctor_7.$$s = self, TMP_Asciidoctor_7.$$arity = 2, TMP_Asciidoctor_7))); + Opal.const_set($nesting[0], 'CalloutScanRx', new RegExp("" + "\\\\?(?=(?: ?\\\\?)*" + ($$($nesting, 'CC_EOL')) + ")")); + Opal.const_set($nesting[0], 'CalloutSourceRx', new RegExp("" + "((?://|#|--|;;) ?)?(\\\\)?<!?(|--)(\\d+|\\.)\\3>(?=(?: ?\\\\?<!?\\3(?:\\d+|\\.)\\3>)*" + ($$($nesting, 'CC_EOL')) + ")")); + Opal.const_set($nesting[0], 'CalloutSourceRxt', "" + "(\\\\)?<()(\\d+|\\.)>(?=(?: ?\\\\?<(?:\\d+|\\.)>)*" + ($$($nesting, 'CC_EOL')) + ")"); + Opal.const_set($nesting[0], 'CalloutSourceRxMap', $send($$$('::', 'Hash'), 'new', [], (TMP_Asciidoctor_8 = function(h, k){var self = TMP_Asciidoctor_8.$$s || this; + + + + if (h == null) { + h = nil; + }; + + if (k == null) { + k = nil; + }; + $writer = [k, new RegExp("" + "(" + ($$$('::', 'Regexp').$escape(k)) + " ?)?" + ($$($nesting, 'CalloutSourceRxt')))]; + $send(h, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];}, TMP_Asciidoctor_8.$$s = self, TMP_Asciidoctor_8.$$arity = 2, TMP_Asciidoctor_8))); + Opal.const_set($nesting[0], 'ListRxMap', $hash2(["ulist", "olist", "dlist", "colist"], {"ulist": $$($nesting, 'UnorderedListRx'), "olist": $$($nesting, 'OrderedListRx'), "dlist": $$($nesting, 'DescriptionListRx'), "colist": $$($nesting, 'CalloutListRx')})); + Opal.const_set($nesting[0], 'ColumnSpecRx', /^(?:(\d+)\*)?([<^>](?:\.[<^>]?)?|(?:[<^>]?\.)?[<^>])?(\d+%?|~)?([a-z])?$/); + Opal.const_set($nesting[0], 'CellSpecStartRx', /^[ \t]*(?:(\d+(?:\.\d*)?|(?:\d*\.)?\d+)([*+]))?([<^>](?:\.[<^>]?)?|(?:[<^>]?\.)?[<^>])?([a-z])?$/); + Opal.const_set($nesting[0], 'CellSpecEndRx', /[ \t]+(?:(\d+(?:\.\d*)?|(?:\d*\.)?\d+)([*+]))?([<^>](?:\.[<^>]?)?|(?:[<^>]?\.)?[<^>])?([a-z])?$/); + Opal.const_set($nesting[0], 'CustomBlockMacroRx', new RegExp("" + "^(" + ($$($nesting, 'CG_WORD')) + "[-" + ($$($nesting, 'CC_WORD')) + "]*)::(|\\S|\\S" + ($$($nesting, 'CC_ANY')) + "*?\\S)\\[(" + ($$($nesting, 'CC_ANY')) + "+)?\\]$")); + Opal.const_set($nesting[0], 'BlockMediaMacroRx', new RegExp("" + "^(image|video|audio)::(\\S|\\S" + ($$($nesting, 'CC_ANY')) + "*?\\S)\\[(" + ($$($nesting, 'CC_ANY')) + "+)?\\]$")); + Opal.const_set($nesting[0], 'BlockTocMacroRx', new RegExp("" + "^toc::\\[(" + ($$($nesting, 'CC_ANY')) + "+)?\\]$")); + Opal.const_set($nesting[0], 'InlineAnchorRx', new RegExp("" + "(\\\\)?(?:\\[\\[([" + ($$($nesting, 'CC_ALPHA')) + "_:][" + ($$($nesting, 'CC_WORD')) + ":.-]*)(?:, *(" + ($$($nesting, 'CC_ANY')) + "+?))?\\]\\]|anchor:([" + ($$($nesting, 'CC_ALPHA')) + "_:][" + ($$($nesting, 'CC_WORD')) + ":.-]*)\\[(?:\\]|(" + ($$($nesting, 'CC_ANY')) + "*?[^\\\\])\\]))")); + Opal.const_set($nesting[0], 'InlineAnchorScanRx', new RegExp("" + "(?:^|[^\\\\\\[])\\[\\[([" + ($$($nesting, 'CC_ALPHA')) + "_:][" + ($$($nesting, 'CC_WORD')) + ":.-]*)(?:, *(" + ($$($nesting, 'CC_ANY')) + "+?))?\\]\\]|(?:^|[^\\\\])anchor:([" + ($$($nesting, 'CC_ALPHA')) + "_:][" + ($$($nesting, 'CC_WORD')) + ":.-]*)\\[(?:\\]|(" + ($$($nesting, 'CC_ANY')) + "*?[^\\\\])\\])")); + Opal.const_set($nesting[0], 'LeadingInlineAnchorRx', new RegExp("" + "^\\[\\[([" + ($$($nesting, 'CC_ALPHA')) + "_:][" + ($$($nesting, 'CC_WORD')) + ":.-]*)(?:, *(" + ($$($nesting, 'CC_ANY')) + "+?))?\\]\\]")); + Opal.const_set($nesting[0], 'InlineBiblioAnchorRx', new RegExp("" + "^\\[\\[\\[([" + ($$($nesting, 'CC_ALPHA')) + "_:][" + ($$($nesting, 'CC_WORD')) + ":.-]*)(?:, *(" + ($$($nesting, 'CC_ANY')) + "+?))?\\]\\]\\]")); + Opal.const_set($nesting[0], 'InlineEmailRx', new RegExp("" + "([\\\\>:/])?" + ($$($nesting, 'CG_WORD')) + "[" + ($$($nesting, 'CC_WORD')) + ".%+-]*@" + ($$($nesting, 'CG_ALNUM')) + "[" + ($$($nesting, 'CC_ALNUM')) + ".-]*\\." + ($$($nesting, 'CG_ALPHA')) + "{2,4}\\b")); + Opal.const_set($nesting[0], 'InlineFootnoteMacroRx', new RegExp("" + "\\\\?footnote(?:(ref):|:([\\w-]+)?)\\[(?:|(" + ($$($nesting, 'CC_ALL')) + "*?[^\\\\]))\\]", 'm')); + Opal.const_set($nesting[0], 'InlineImageMacroRx', new RegExp("" + "\\\\?i(?:mage|con):([^:\\s\\[](?:[^\\n\\[]*[^\\s\\[])?)\\[(|" + ($$($nesting, 'CC_ALL')) + "*?[^\\\\])\\]", 'm')); + Opal.const_set($nesting[0], 'InlineIndextermMacroRx', new RegExp("" + "\\\\?(?:(indexterm2?):\\[(" + ($$($nesting, 'CC_ALL')) + "*?[^\\\\])\\]|\\(\\((" + ($$($nesting, 'CC_ALL')) + "+?)\\)\\)(?!\\)))", 'm')); + Opal.const_set($nesting[0], 'InlineKbdBtnMacroRx', new RegExp("" + "(\\\\)?(kbd|btn):\\[(" + ($$($nesting, 'CC_ALL')) + "*?[^\\\\])\\]", 'm')); + Opal.const_set($nesting[0], 'InlineLinkRx', new RegExp("" + "(^|link:|" + ($$($nesting, 'CG_BLANK')) + "|<|[>\\(\\)\\[\\];])(\\\\?(?:https?|file|ftp|irc)://[^\\s\\[\\]<]*[^\\s.,\\[\\]<])(?:\\[(|" + ($$($nesting, 'CC_ALL')) + "*?[^\\\\])\\])?", 'm')); + Opal.const_set($nesting[0], 'InlineLinkMacroRx', new RegExp("" + "\\\\?(?:link|(mailto)):(|[^:\\s\\[][^\\s\\[]*)\\[(|" + ($$($nesting, 'CC_ALL')) + "*?[^\\\\])\\]", 'm')); + Opal.const_set($nesting[0], 'MacroNameRx', new RegExp("" + "^" + ($$($nesting, 'CG_WORD')) + "[-" + ($$($nesting, 'CC_WORD')) + "]*$")); + Opal.const_set($nesting[0], 'InlineStemMacroRx', new RegExp("" + "\\\\?(stem|(?:latex|ascii)math):([a-z]+(?:,[a-z]+)*)?\\[(" + ($$($nesting, 'CC_ALL')) + "*?[^\\\\])\\]", 'm')); + Opal.const_set($nesting[0], 'InlineMenuMacroRx', new RegExp("" + "\\\\?menu:(" + ($$($nesting, 'CG_WORD')) + "|[" + ($$($nesting, 'CC_WORD')) + "&][^\\n\\[]*[^\\s\\[])\\[ *(" + ($$($nesting, 'CC_ALL')) + "*?[^\\\\])?\\]", 'm')); + Opal.const_set($nesting[0], 'InlineMenuRx', new RegExp("" + "\\\\?\"([" + ($$($nesting, 'CC_WORD')) + "&][^\"]*?[ \\n]+>[ \\n]+[^\"]*)\"")); + Opal.const_set($nesting[0], 'InlinePassRx', $hash(false, ["+", "`", new RegExp("" + "(^|[^" + ($$($nesting, 'CC_WORD')) + ";:])(?:\\[([^\\]]+)\\])?(\\\\?(\\+|`)(\\S|\\S" + ($$($nesting, 'CC_ALL')) + "*?\\S)\\4)(?!" + ($$($nesting, 'CG_WORD')) + ")", 'm')], true, ["`", nil, new RegExp("" + "(^|[^`" + ($$($nesting, 'CC_WORD')) + "])(?:\\[([^\\]]+)\\])?(\\\\?(`)([^`\\s]|[^`\\s]" + ($$($nesting, 'CC_ALL')) + "*?\\S)\\4)(?![`" + ($$($nesting, 'CC_WORD')) + "])", 'm')])); + Opal.const_set($nesting[0], 'SinglePlusInlinePassRx', new RegExp("" + "^(\\\\)?\\+(\\S|\\S" + ($$($nesting, 'CC_ALL')) + "*?\\S)\\+$", 'm')); + Opal.const_set($nesting[0], 'InlinePassMacroRx', new RegExp("" + "(?:(?:(\\\\?)\\[([^\\]]+)\\])?(\\\\{0,2})(\\+\\+\\+?|\\$\\$)(" + ($$($nesting, 'CC_ALL')) + "*?)\\4|(\\\\?)pass:([a-z]+(?:,[a-z]+)*)?\\[(|" + ($$($nesting, 'CC_ALL')) + "*?[^\\\\])\\])", 'm')); + Opal.const_set($nesting[0], 'InlineXrefMacroRx', new RegExp("" + "\\\\?(?:<<([" + ($$($nesting, 'CC_WORD')) + "#/.:{]" + ($$($nesting, 'CC_ALL')) + "*?)>>|xref:([" + ($$($nesting, 'CC_WORD')) + "#/.:{]" + ($$($nesting, 'CC_ALL')) + "*?)\\[(?:\\]|(" + ($$($nesting, 'CC_ALL')) + "*?[^\\\\])\\]))", 'm')); + if ($$($nesting, 'RUBY_ENGINE')['$==']("opal")) { + Opal.const_set($nesting[0], 'HardLineBreakRx', new RegExp("" + "^(" + ($$($nesting, 'CC_ANY')) + "*) \\+$", 'm')) + } else { + nil + }; + Opal.const_set($nesting[0], 'MarkdownThematicBreakRx', /^ {0,3}([-*_])( *)\1\2\1$/); + Opal.const_set($nesting[0], 'ExtLayoutBreakRx', /^(?:'{3,}|<{3,}|([-*_])( *)\1\2\1)$/); + Opal.const_set($nesting[0], 'BlankLineRx', /\n{2,}/); + Opal.const_set($nesting[0], 'EscapedSpaceRx', /\\([ \t\n])/); + Opal.const_set($nesting[0], 'ReplaceableTextRx', /[&']|--|\.\.\.|\([CRT]M?\)/); + Opal.const_set($nesting[0], 'SpaceDelimiterRx', /([^\\])[ \t\n]+/); + Opal.const_set($nesting[0], 'SubModifierSniffRx', /[+-]/); + Opal.const_set($nesting[0], 'TrailingDigitsRx', /\d+$/); + if ($$($nesting, 'RUBY_ENGINE')['$==']("opal")) { + } else { + nil + }; + Opal.const_set($nesting[0], 'UriSniffRx', new RegExp("" + "^" + ($$($nesting, 'CG_ALPHA')) + "[" + ($$($nesting, 'CC_ALNUM')) + ".+-]+:/{0,2}")); + Opal.const_set($nesting[0], 'UriTerminatorRx', /[);:]$/); + Opal.const_set($nesting[0], 'XmlSanitizeRx', /<[^>]+>/); + Opal.const_set($nesting[0], 'INTRINSIC_ATTRIBUTES', $hash2(["startsb", "endsb", "vbar", "caret", "asterisk", "tilde", "plus", "backslash", "backtick", "blank", "empty", "sp", "two-colons", "two-semicolons", "nbsp", "deg", "zwsp", "quot", "apos", "lsquo", "rsquo", "ldquo", "rdquo", "wj", "brvbar", "pp", "cpp", "amp", "lt", "gt"], {"startsb": "[", "endsb": "]", "vbar": "|", "caret": "^", "asterisk": "*", "tilde": "~", "plus": "+", "backslash": "\\", "backtick": "`", "blank": "", "empty": "", "sp": " ", "two-colons": "::", "two-semicolons": ";;", "nbsp": " ", "deg": "°", "zwsp": "​", "quot": """, "apos": "'", "lsquo": "‘", "rsquo": "’", "ldquo": "“", "rdquo": "”", "wj": "⁠", "brvbar": "¦", "pp": "++", "cpp": "C++", "amp": "&", "lt": "<", "gt": ">"})); + quote_subs = [["strong", "unconstrained", new RegExp("" + "\\\\?(?:\\[([^\\]]+)\\])?\\*\\*(" + ($$($nesting, 'CC_ALL')) + "+?)\\*\\*", 'm')], ["strong", "constrained", new RegExp("" + "(^|[^" + ($$($nesting, 'CC_WORD')) + ";:}])(?:\\[([^\\]]+)\\])?\\*(\\S|\\S" + ($$($nesting, 'CC_ALL')) + "*?\\S)\\*(?!" + ($$($nesting, 'CG_WORD')) + ")", 'm')], ["double", "constrained", new RegExp("" + "(^|[^" + ($$($nesting, 'CC_WORD')) + ";:}])(?:\\[([^\\]]+)\\])?\"`(\\S|\\S" + ($$($nesting, 'CC_ALL')) + "*?\\S)`\"(?!" + ($$($nesting, 'CG_WORD')) + ")", 'm')], ["single", "constrained", new RegExp("" + "(^|[^" + ($$($nesting, 'CC_WORD')) + ";:`}])(?:\\[([^\\]]+)\\])?'`(\\S|\\S" + ($$($nesting, 'CC_ALL')) + "*?\\S)`'(?!" + ($$($nesting, 'CG_WORD')) + ")", 'm')], ["monospaced", "unconstrained", new RegExp("" + "\\\\?(?:\\[([^\\]]+)\\])?``(" + ($$($nesting, 'CC_ALL')) + "+?)``", 'm')], ["monospaced", "constrained", new RegExp("" + "(^|[^" + ($$($nesting, 'CC_WORD')) + ";:\"'`}])(?:\\[([^\\]]+)\\])?`(\\S|\\S" + ($$($nesting, 'CC_ALL')) + "*?\\S)`(?![" + ($$($nesting, 'CC_WORD')) + "\"'`])", 'm')], ["emphasis", "unconstrained", new RegExp("" + "\\\\?(?:\\[([^\\]]+)\\])?__(" + ($$($nesting, 'CC_ALL')) + "+?)__", 'm')], ["emphasis", "constrained", new RegExp("" + "(^|[^" + ($$($nesting, 'CC_WORD')) + ";:}])(?:\\[([^\\]]+)\\])?_(\\S|\\S" + ($$($nesting, 'CC_ALL')) + "*?\\S)_(?!" + ($$($nesting, 'CG_WORD')) + ")", 'm')], ["mark", "unconstrained", new RegExp("" + "\\\\?(?:\\[([^\\]]+)\\])?##(" + ($$($nesting, 'CC_ALL')) + "+?)##", 'm')], ["mark", "constrained", new RegExp("" + "(^|[^" + ($$($nesting, 'CC_WORD')) + "&;:}])(?:\\[([^\\]]+)\\])?#(\\S|\\S" + ($$($nesting, 'CC_ALL')) + "*?\\S)#(?!" + ($$($nesting, 'CG_WORD')) + ")", 'm')], ["superscript", "unconstrained", /\\?(?:\[([^\]]+)\])?\^(\S+?)\^/], ["subscript", "unconstrained", /\\?(?:\[([^\]]+)\])?~(\S+?)~/]]; + compat_quote_subs = quote_subs.$drop(0); + + $writer = [2, ["double", "constrained", new RegExp("" + "(^|[^" + ($$($nesting, 'CC_WORD')) + ";:}])(?:\\[([^\\]]+)\\])?``(\\S|\\S" + ($$($nesting, 'CC_ALL')) + "*?\\S)''(?!" + ($$($nesting, 'CG_WORD')) + ")", 'm')]]; + $send(compat_quote_subs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = [3, ["single", "constrained", new RegExp("" + "(^|[^" + ($$($nesting, 'CC_WORD')) + ";:}])(?:\\[([^\\]]+)\\])?`(\\S|\\S" + ($$($nesting, 'CC_ALL')) + "*?\\S)'(?!" + ($$($nesting, 'CG_WORD')) + ")", 'm')]]; + $send(compat_quote_subs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = [4, ["monospaced", "unconstrained", new RegExp("" + "\\\\?(?:\\[([^\\]]+)\\])?\\+\\+(" + ($$($nesting, 'CC_ALL')) + "+?)\\+\\+", 'm')]]; + $send(compat_quote_subs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = [5, ["monospaced", "constrained", new RegExp("" + "(^|[^" + ($$($nesting, 'CC_WORD')) + ";:}])(?:\\[([^\\]]+)\\])?\\+(\\S|\\S" + ($$($nesting, 'CC_ALL')) + "*?\\S)\\+(?!" + ($$($nesting, 'CG_WORD')) + ")", 'm')]]; + $send(compat_quote_subs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + compat_quote_subs.$insert(3, ["emphasis", "constrained", new RegExp("" + "(^|[^" + ($$($nesting, 'CC_WORD')) + ";:}])(?:\\[([^\\]]+)\\])?'(\\S|\\S" + ($$($nesting, 'CC_ALL')) + "*?\\S)'(?!" + ($$($nesting, 'CG_WORD')) + ")", 'm')]); + Opal.const_set($nesting[0], 'QUOTE_SUBS', $hash(false, quote_subs, true, compat_quote_subs)); + quote_subs = nil; + compat_quote_subs = nil; + Opal.const_set($nesting[0], 'REPLACEMENTS', [[/\\?\(C\)/, "©", "none"], [/\\?\(R\)/, "®", "none"], [/\\?\(TM\)/, "™", "none"], [/(^|\n| |\\)--( |\n|$)/, " — ", "none"], [new RegExp("" + "(" + ($$($nesting, 'CG_WORD')) + ")\\\\?--(?=" + ($$($nesting, 'CG_WORD')) + ")"), "—​", "leading"], [/\\?\.\.\./, "…​", "leading"], [/\\?`'/, "’", "none"], [new RegExp("" + "(" + ($$($nesting, 'CG_ALNUM')) + ")\\\\?'(?=" + ($$($nesting, 'CG_ALPHA')) + ")"), "’", "leading"], [/\\?->/, "→", "none"], [/\\?=>/, "⇒", "none"], [/\\?<-/, "←", "none"], [/\\?<=/, "⇐", "none"], [/\\?(&)amp;((?:[a-zA-Z][a-zA-Z]+\d{0,2}|#\d\d\d{0,4}|#x[\da-fA-F][\da-fA-F][\da-fA-F]{0,3});)/, "", "bounding"]]); + (function(self, $parent_nesting) { + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_load_9, TMP_load_file_13, TMP_convert_15, TMP_convert_file_16; + + + + Opal.def(self, '$load', TMP_load_9 = function $$load(input, options) { + var $a, $b, TMP_10, TMP_11, TMP_12, self = this, timings = nil, logger = nil, $writer = nil, attrs = nil, attrs_arr = nil, lines = nil, input_path = nil, input_mtime = nil, docdate = nil, doctime = nil, doc = nil, ex = nil, context = nil, wrapped_ex = nil; + + + + if (options == null) { + options = $hash2([], {}); + }; + try { + + options = options.$dup(); + if ($truthy((timings = options['$[]']("timings")))) { + timings.$start("read")}; + if ($truthy(($truthy($a = (logger = options['$[]']("logger"))) ? logger['$!=']($$($nesting, 'LoggerManager').$logger()) : $a))) { + + $writer = [logger]; + $send($$($nesting, 'LoggerManager'), 'logger=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if ($truthy((attrs = options['$[]']("attributes"))['$!']())) { + attrs = $hash2([], {}) + } else if ($truthy(($truthy($a = $$$('::', 'Hash')['$==='](attrs)) ? $a : ($truthy($b = $$$('::', 'RUBY_ENGINE_JRUBY')) ? $$$($$$($$$('::', 'Java'), 'JavaUtil'), 'Map')['$==='](attrs) : $b)))) { + attrs = attrs.$dup() + } else if ($truthy($$$('::', 'Array')['$==='](attrs))) { + + $a = [$hash2([], {}), attrs], (attrs = $a[0]), (attrs_arr = $a[1]), $a; + $send(attrs_arr, 'each', [], (TMP_10 = function(entry){var self = TMP_10.$$s || this, $c, $d, k = nil, v = nil; + + + + if (entry == null) { + entry = nil; + }; + $d = entry.$split("=", 2), $c = Opal.to_ary($d), (k = ($c[0] == null ? nil : $c[0])), (v = ($c[1] == null ? nil : $c[1])), $d; + + $writer = [k, ($truthy($c = v) ? $c : "")]; + $send(attrs, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];;}, TMP_10.$$s = self, TMP_10.$$arity = 1, TMP_10)); + } else if ($truthy($$$('::', 'String')['$==='](attrs))) { + + $a = [$hash2([], {}), attrs.$gsub($$($nesting, 'SpaceDelimiterRx'), "" + "\\1" + ($$($nesting, 'NULL'))).$gsub($$($nesting, 'EscapedSpaceRx'), "\\1").$split($$($nesting, 'NULL'))], (attrs = $a[0]), (attrs_arr = $a[1]), $a; + $send(attrs_arr, 'each', [], (TMP_11 = function(entry){var self = TMP_11.$$s || this, $c, $d, k = nil, v = nil; + + + + if (entry == null) { + entry = nil; + }; + $d = entry.$split("=", 2), $c = Opal.to_ary($d), (k = ($c[0] == null ? nil : $c[0])), (v = ($c[1] == null ? nil : $c[1])), $d; + + $writer = [k, ($truthy($c = v) ? $c : "")]; + $send(attrs, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];;}, TMP_11.$$s = self, TMP_11.$$arity = 1, TMP_11)); + } else if ($truthy(($truthy($a = attrs['$respond_to?']("keys")) ? attrs['$respond_to?']("[]") : $a))) { + attrs = $$$('::', 'Hash')['$[]']($send(attrs.$keys(), 'map', [], (TMP_12 = function(k){var self = TMP_12.$$s || this; + + + + if (k == null) { + k = nil; + }; + return [k, attrs['$[]'](k)];}, TMP_12.$$s = self, TMP_12.$$arity = 1, TMP_12))) + } else { + self.$raise($$$('::', 'ArgumentError'), "" + "illegal type for attributes option: " + (attrs.$class().$ancestors().$join(" < "))) + }; + lines = nil; + if ($truthy($$$('::', 'File')['$==='](input))) { + + input_path = $$$('::', 'File').$expand_path(input.$path()); + input_mtime = (function() {if ($truthy($$$('::', 'ENV')['$[]']("SOURCE_DATE_EPOCH"))) { + return $$$('::', 'Time').$at(self.$Integer($$$('::', 'ENV')['$[]']("SOURCE_DATE_EPOCH"))).$utc() + } else { + return input.$mtime() + }; return nil; })(); + lines = input.$readlines(); + + $writer = ["docfile", input_path]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["docdir", $$$('::', 'File').$dirname(input_path)]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["docname", $$($nesting, 'Helpers').$basename(input_path, (($writer = ["docfilesuffix", $$$('::', 'File').$extname(input_path)]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]))]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + if ($truthy((docdate = attrs['$[]']("docdate")))) { + ($truthy($a = attrs['$[]']("docyear")) ? $a : (($writer = ["docyear", (function() {if (docdate.$index("-")['$=='](4)) { + + return docdate.$slice(0, 4); + } else { + return nil + }; return nil; })()]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])) + } else { + + docdate = (($writer = ["docdate", input_mtime.$strftime("%F")]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]); + ($truthy($a = attrs['$[]']("docyear")) ? $a : (($writer = ["docyear", input_mtime.$year().$to_s()]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + }; + doctime = ($truthy($a = attrs['$[]']("doctime")) ? $a : (($writer = ["doctime", input_mtime.$strftime("" + "%T " + ((function() {if (input_mtime.$utc_offset()['$=='](0)) { + return "UTC" + } else { + return "%z" + }; return nil; })()))]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + + $writer = ["docdatetime", "" + (docdate) + " " + (doctime)]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + } else if ($truthy(input['$respond_to?']("readlines"))) { + + + try { + input.$rewind() + } catch ($err) { + if (Opal.rescue($err, [$$($nesting, 'StandardError')])) { + try { + nil + } finally { Opal.pop_exception() } + } else { throw $err; } + };; + lines = input.$readlines(); + } else if ($truthy($$$('::', 'String')['$==='](input))) { + lines = (function() {if ($truthy($$$('::', 'RUBY_MIN_VERSION_2'))) { + return input.$lines() + } else { + return input.$each_line().$to_a() + }; return nil; })() + } else if ($truthy($$$('::', 'Array')['$==='](input))) { + lines = input.$drop(0) + } else { + self.$raise($$$('::', 'ArgumentError'), "" + "unsupported input type: " + (input.$class())) + }; + if ($truthy(timings)) { + + timings.$record("read"); + timings.$start("parse");}; + + $writer = ["attributes", attrs]; + $send(options, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + doc = (function() {if (options['$[]']("parse")['$=='](false)) { + + return $$($nesting, 'Document').$new(lines, options); + } else { + return $$($nesting, 'Document').$new(lines, options).$parse() + }; return nil; })(); + if ($truthy(timings)) { + timings.$record("parse")}; + return doc; + } catch ($err) { + if (Opal.rescue($err, [$$($nesting, 'StandardError')])) {ex = $err; + try { + + + try { + + context = "" + "asciidoctor: FAILED: " + (($truthy($a = attrs['$[]']("docfile")) ? $a : "")) + ": Failed to load AsciiDoc document"; + if ($truthy(ex['$respond_to?']("exception"))) { + + wrapped_ex = ex.$exception("" + (context) + " - " + (ex.$message())); + wrapped_ex.$set_backtrace(ex.$backtrace()); + } else { + + wrapped_ex = ex.$class().$new(context, ex); + + $writer = [ex.$stack_trace()]; + $send(wrapped_ex, 'stack_trace=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + }; + } catch ($err) { + if (Opal.rescue($err, [$$($nesting, 'StandardError')])) { + try { + wrapped_ex = ex + } finally { Opal.pop_exception() } + } else { throw $err; } + };; + return self.$raise(wrapped_ex); + } finally { Opal.pop_exception() } + } else { throw $err; } + }; + }, TMP_load_9.$$arity = -2); + + Opal.def(self, '$load_file', TMP_load_file_13 = function $$load_file(filename, options) { + var TMP_14, self = this; + + + + if (options == null) { + options = $hash2([], {}); + }; + return $send($$$('::', 'File'), 'open', [filename, "rb"], (TMP_14 = function(file){var self = TMP_14.$$s || this; + + + + if (file == null) { + file = nil; + }; + return self.$load(file, options);}, TMP_14.$$s = self, TMP_14.$$arity = 1, TMP_14)); + }, TMP_load_file_13.$$arity = -2); + + Opal.def(self, '$convert', TMP_convert_15 = function $$convert(input, options) { + var $a, $b, $c, $d, $e, self = this, to_file = nil, to_dir = nil, mkdirs = nil, $case = nil, write_to_same_dir = nil, stream_output = nil, write_to_target = nil, $writer = nil, input_path = nil, outdir = nil, doc = nil, outfile = nil, working_dir = nil, jail = nil, opts = nil, output = nil, stylesdir = nil, copy_asciidoctor_stylesheet = nil, copy_user_stylesheet = nil, stylesheet = nil, copy_coderay_stylesheet = nil, copy_pygments_stylesheet = nil, stylesoutdir = nil, stylesheet_src = nil, stylesheet_dest = nil, stylesheet_data = nil; + + + + if (options == null) { + options = $hash2([], {}); + }; + options = options.$dup(); + options.$delete("parse"); + to_file = options.$delete("to_file"); + to_dir = options.$delete("to_dir"); + mkdirs = ($truthy($a = options.$delete("mkdirs")) ? $a : false); + $case = to_file; + if (true['$===']($case) || nil['$===']($case)) { + write_to_same_dir = ($truthy($a = to_dir['$!']()) ? $$$('::', 'File')['$==='](input) : $a); + stream_output = false; + write_to_target = to_dir; + to_file = nil;} + else if (false['$===']($case)) { + write_to_same_dir = false; + stream_output = false; + write_to_target = false; + to_file = nil;} + else if ("/dev/null"['$===']($case)) {return self.$load(input, options)} + else { + write_to_same_dir = false; + write_to_target = (function() {if ($truthy((stream_output = to_file['$respond_to?']("write")))) { + return false + } else { + + + $writer = ["to_file", to_file]; + $send(options, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];; + }; return nil; })();}; + if ($truthy(options['$key?']("header_footer"))) { + } else if ($truthy(($truthy($a = write_to_same_dir) ? $a : write_to_target))) { + + $writer = ["header_footer", true]; + $send(options, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if ($truthy(write_to_same_dir)) { + + input_path = $$$('::', 'File').$expand_path(input.$path()); + + $writer = ["to_dir", (outdir = $$$('::', 'File').$dirname(input_path))]; + $send(options, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + } else if ($truthy(write_to_target)) { + if ($truthy(to_dir)) { + if ($truthy(to_file)) { + + $writer = ["to_dir", $$$('::', 'File').$dirname($$$('::', 'File').$expand_path($$$('::', 'File').$join(to_dir, to_file)))]; + $send(options, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + } else { + + $writer = ["to_dir", $$$('::', 'File').$expand_path(to_dir)]; + $send(options, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + } + } else if ($truthy(to_file)) { + + $writer = ["to_dir", $$$('::', 'File').$dirname($$$('::', 'File').$expand_path(to_file))]; + $send(options, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}}; + doc = self.$load(input, options); + if ($truthy(write_to_same_dir)) { + + outfile = $$$('::', 'File').$join(outdir, "" + (doc.$attributes()['$[]']("docname")) + (doc.$outfilesuffix())); + if (outfile['$=='](input_path)) { + self.$raise($$$('::', 'IOError'), "" + "input file and output file cannot be the same: " + (outfile))}; + } else if ($truthy(write_to_target)) { + + working_dir = (function() {if ($truthy(options['$key?']("base_dir"))) { + + return $$$('::', 'File').$expand_path(options['$[]']("base_dir")); + } else { + return $$$('::', 'Dir').$pwd() + }; return nil; })(); + jail = (function() {if ($truthy($rb_ge(doc.$safe(), $$$($$($nesting, 'SafeMode'), 'SAFE')))) { + return working_dir + } else { + return nil + }; return nil; })(); + if ($truthy(to_dir)) { + + outdir = doc.$normalize_system_path(to_dir, working_dir, jail, $hash2(["target_name", "recover"], {"target_name": "to_dir", "recover": false})); + if ($truthy(to_file)) { + + outfile = doc.$normalize_system_path(to_file, outdir, nil, $hash2(["target_name", "recover"], {"target_name": "to_dir", "recover": false})); + outdir = $$$('::', 'File').$dirname(outfile); + } else { + outfile = $$$('::', 'File').$join(outdir, "" + (doc.$attributes()['$[]']("docname")) + (doc.$outfilesuffix())) + }; + } else if ($truthy(to_file)) { + + outfile = doc.$normalize_system_path(to_file, working_dir, jail, $hash2(["target_name", "recover"], {"target_name": "to_dir", "recover": false})); + outdir = $$$('::', 'File').$dirname(outfile);}; + if ($truthy(($truthy($a = $$$('::', 'File')['$==='](input)) ? outfile['$==']($$$('::', 'File').$expand_path(input.$path())) : $a))) { + self.$raise($$$('::', 'IOError'), "" + "input file and output file cannot be the same: " + (outfile))}; + if ($truthy(mkdirs)) { + $$($nesting, 'Helpers').$mkdir_p(outdir) + } else if ($truthy($$$('::', 'File')['$directory?'](outdir))) { + } else { + self.$raise($$$('::', 'IOError'), "" + "target directory does not exist: " + (to_dir) + " (hint: set mkdirs option)") + }; + } else { + + outfile = to_file; + outdir = nil; + }; + opts = (function() {if ($truthy(($truthy($a = outfile) ? stream_output['$!']() : $a))) { + return $hash2(["outfile", "outdir"], {"outfile": outfile, "outdir": outdir}) + } else { + return $hash2([], {}) + }; return nil; })(); + output = doc.$convert(opts); + if ($truthy(outfile)) { + + doc.$write(output, outfile); + if ($truthy(($truthy($a = ($truthy($b = ($truthy($c = ($truthy($d = ($truthy($e = stream_output['$!']()) ? $rb_lt(doc.$safe(), $$$($$($nesting, 'SafeMode'), 'SECURE')) : $e)) ? doc['$attr?']("linkcss") : $d)) ? doc['$attr?']("copycss") : $c)) ? doc['$attr?']("basebackend-html") : $b)) ? ($truthy($b = (stylesdir = doc.$attr("stylesdir"))) ? $$($nesting, 'Helpers')['$uriish?'](stylesdir) : $b)['$!']() : $a))) { + + copy_asciidoctor_stylesheet = false; + copy_user_stylesheet = false; + if ($truthy((stylesheet = doc.$attr("stylesheet")))) { + if ($truthy($$($nesting, 'DEFAULT_STYLESHEET_KEYS')['$include?'](stylesheet))) { + copy_asciidoctor_stylesheet = true + } else if ($truthy($$($nesting, 'Helpers')['$uriish?'](stylesheet)['$!']())) { + copy_user_stylesheet = true}}; + copy_coderay_stylesheet = ($truthy($a = doc['$attr?']("source-highlighter", "coderay")) ? doc.$attr("coderay-css", "class")['$==']("class") : $a); + copy_pygments_stylesheet = ($truthy($a = doc['$attr?']("source-highlighter", "pygments")) ? doc.$attr("pygments-css", "class")['$==']("class") : $a); + if ($truthy(($truthy($a = ($truthy($b = ($truthy($c = copy_asciidoctor_stylesheet) ? $c : copy_user_stylesheet)) ? $b : copy_coderay_stylesheet)) ? $a : copy_pygments_stylesheet))) { + + stylesoutdir = doc.$normalize_system_path(stylesdir, outdir, (function() {if ($truthy($rb_ge(doc.$safe(), $$$($$($nesting, 'SafeMode'), 'SAFE')))) { + return outdir + } else { + return nil + }; return nil; })()); + if ($truthy(mkdirs)) { + $$($nesting, 'Helpers').$mkdir_p(stylesoutdir) + } else if ($truthy($$$('::', 'File')['$directory?'](stylesoutdir))) { + } else { + self.$raise($$$('::', 'IOError'), "" + "target stylesheet directory does not exist: " + (stylesoutdir) + " (hint: set mkdirs option)") + }; + if ($truthy(copy_asciidoctor_stylesheet)) { + $$($nesting, 'Stylesheets').$instance().$write_primary_stylesheet(stylesoutdir) + } else if ($truthy(copy_user_stylesheet)) { + + if ($truthy((stylesheet_src = doc.$attr("copycss"))['$empty?']())) { + stylesheet_src = doc.$normalize_system_path(stylesheet) + } else { + stylesheet_src = doc.$normalize_system_path(stylesheet_src) + }; + stylesheet_dest = doc.$normalize_system_path(stylesheet, stylesoutdir, (function() {if ($truthy($rb_ge(doc.$safe(), $$$($$($nesting, 'SafeMode'), 'SAFE')))) { + return outdir + } else { + return nil + }; return nil; })()); + if ($truthy(($truthy($a = stylesheet_src['$!='](stylesheet_dest)) ? (stylesheet_data = doc.$read_asset(stylesheet_src, $hash2(["warn_on_failure", "label"], {"warn_on_failure": $$$('::', 'File')['$file?'](stylesheet_dest)['$!'](), "label": "stylesheet"}))) : $a))) { + $$$('::', 'IO').$write(stylesheet_dest, stylesheet_data)};}; + if ($truthy(copy_coderay_stylesheet)) { + $$($nesting, 'Stylesheets').$instance().$write_coderay_stylesheet(stylesoutdir) + } else if ($truthy(copy_pygments_stylesheet)) { + $$($nesting, 'Stylesheets').$instance().$write_pygments_stylesheet(stylesoutdir, doc.$attr("pygments-style"))};};}; + return doc; + } else { + return output + }; + }, TMP_convert_15.$$arity = -2); + Opal.alias(self, "render", "convert"); + + Opal.def(self, '$convert_file', TMP_convert_file_16 = function $$convert_file(filename, options) { + var TMP_17, self = this; + + + + if (options == null) { + options = $hash2([], {}); + }; + return $send($$$('::', 'File'), 'open', [filename, "rb"], (TMP_17 = function(file){var self = TMP_17.$$s || this; + + + + if (file == null) { + file = nil; + }; + return self.$convert(file, options);}, TMP_17.$$s = self, TMP_17.$$arity = 1, TMP_17)); + }, TMP_convert_file_16.$$arity = -2); + Opal.alias(self, "render_file", "convert_file"); + if ($$($nesting, 'RUBY_ENGINE')['$==']("opal")) { + return nil + } else { + return nil + }; + })(Opal.get_singleton_class(self), $nesting); + if ($$($nesting, 'RUBY_ENGINE')['$==']("opal")) { + + self.$require("asciidoctor/timings"); + self.$require("asciidoctor/version"); + } else { + nil + }; + })($nesting[0], $nesting); + self.$require("asciidoctor/core_ext"); + self.$require("asciidoctor/helpers"); + self.$require("asciidoctor/substitutors"); + self.$require("asciidoctor/abstract_node"); + self.$require("asciidoctor/abstract_block"); + self.$require("asciidoctor/attribute_list"); + self.$require("asciidoctor/block"); + self.$require("asciidoctor/callouts"); + self.$require("asciidoctor/converter"); + self.$require("asciidoctor/document"); + self.$require("asciidoctor/inline"); + self.$require("asciidoctor/list"); + self.$require("asciidoctor/parser"); + self.$require("asciidoctor/path_resolver"); + self.$require("asciidoctor/reader"); + self.$require("asciidoctor/section"); + self.$require("asciidoctor/stylesheets"); + self.$require("asciidoctor/table"); + if ($$($nesting, 'RUBY_ENGINE')['$==']("opal")) { + return self.$require("asciidoctor/js/postscript") + } else { + return nil + }; +})(Opal); + + +/** + * Convert a JSON to an (Opal) Hash. + * @private + */ +var toHash = function (object) { + return object && !('$$smap' in object) ? Opal.hash(object) : object; +}; + +/** + * Convert an (Opal) Hash to JSON. + * @private + */ +var fromHash = function (hash) { + var object = {}; + var data = hash.$$smap; + for (var key in data) { + object[key] = data[key]; + } + return object; +}; + +/** + * @private + */ +var prepareOptions = function (options) { + if (options = toHash(options)) { + var attrs = options['$[]']('attributes'); + if (attrs && typeof attrs === 'object' && attrs.constructor.name === 'Object') { + options = options.$dup(); + options['$[]=']('attributes', toHash(attrs)); + } + } + return options; +}; + +function initializeClass (superClass, className, functions, defaultFunctions, argProxyFunctions) { + var scope = Opal.klass(Opal.Object, superClass, className, function () {}); + var postConstructFunction; + var initializeFunction; + var defaultFunctionsOverridden = {}; + for (var functionName in functions) { + if (functions.hasOwnProperty(functionName)) { + (function (functionName) { + var userFunction = functions[functionName]; + if (functionName === 'postConstruct') { + postConstructFunction = userFunction; + } else if (functionName === 'initialize') { + initializeFunction = userFunction; + } else { + if (defaultFunctions && defaultFunctions.hasOwnProperty(functionName)) { + defaultFunctionsOverridden[functionName] = true; + } + Opal.def(scope, '$' + functionName, function () { + var args; + if (argProxyFunctions && argProxyFunctions.hasOwnProperty(functionName)) { + args = argProxyFunctions[functionName](arguments); + } else { + args = arguments; + } + return userFunction.apply(this, args); + }); + } + }(functionName)); + } + } + var initialize; + if (typeof initializeFunction === 'function') { + initialize = function () { + initializeFunction.apply(this, arguments); + if (typeof postConstructFunction === 'function') { + postConstructFunction.bind(this)(); + } + }; + } else { + initialize = function () { + Opal.send(this, Opal.find_super_dispatcher(this, 'initialize', initialize)); + if (typeof postConstructFunction === 'function') { + postConstructFunction.bind(this)(); + } + }; + } + Opal.def(scope, '$initialize', initialize); + Opal.def(scope, 'super', function (func) { + if (typeof func === 'function') { + Opal.send(this, Opal.find_super_dispatcher(this, func.name, func)); + } else { + // Bind the initialize function to super(); + var argumentsList = Array.from(arguments); + for (var i = 0; i < argumentsList.length; i++) { + // convert all (Opal) Hash arguments to JSON. + if (typeof argumentsList[i] === 'object') { + argumentsList[i] = toHash(argumentsList[i]); + } + } + Opal.send(this, Opal.find_super_dispatcher(this, 'initialize', initialize), argumentsList); + } + }); + if (defaultFunctions) { + for (var defaultFunctionName in defaultFunctions) { + if (defaultFunctions.hasOwnProperty(defaultFunctionName) && !defaultFunctionsOverridden.hasOwnProperty(defaultFunctionName)) { + (function (defaultFunctionName) { + var defaultFunction = defaultFunctions[defaultFunctionName]; + Opal.def(scope, '$' + defaultFunctionName, function () { + return defaultFunction.apply(this, arguments); + }); + }(defaultFunctionName)); + } + } + } + return scope; +} + +// Asciidoctor API + +/** + * @namespace + * @description + * Methods for parsing AsciiDoc input files and converting documents. + * + * AsciiDoc documents comprise a header followed by zero or more sections. + * Sections are composed of blocks of content. For example: + *
    + *   = Doc Title
    + *
    + *   == Section 1
    + *
    + *   This is a paragraph block in the first section.
    + *
    + *   == Section 2
    + *
    + *   This section has a paragraph block and an olist block.
    + *
    + *   . Item 1
    + *   . Item 2
    + * 
    + * + * @example + * asciidoctor.convertFile('sample.adoc'); + */ +var Asciidoctor = Opal.Asciidoctor['$$class']; + +/** + * Get Asciidoctor core version number. + * + * @memberof Asciidoctor + * @returns {string} - returns the version number of Asciidoctor core. + */ +Asciidoctor.prototype.getCoreVersion = function () { + return this.$$const.VERSION; +}; + +/** + * Get Asciidoctor.js runtime environment informations. + * + * @memberof Asciidoctor + * @returns {Object} - returns the runtime environement including the ioModule, the platform, the engine and the framework. + */ +Asciidoctor.prototype.getRuntime = function () { + return { + ioModule: Opal.const_get_qualified('::', 'JAVASCRIPT_IO_MODULE'), + platform: Opal.const_get_qualified('::', 'JAVASCRIPT_PLATFORM'), + engine: Opal.const_get_qualified('::', 'JAVASCRIPT_ENGINE'), + framework: Opal.const_get_qualified('::', 'JAVASCRIPT_FRAMEWORK') + }; +}; + +/** + * Parse the AsciiDoc source input into an {@link Document} and convert it to the specified backend format. + * + * Accepts input as a Buffer or String. + * + * @param {string|Buffer} input - AsciiDoc input as String or Buffer + * @param {Object} options - a JSON of options to control processing (default: {}) + * @returns {string|Document} - returns the {@link Document} object if the converted String is written to a file, + * otherwise the converted String + * @memberof Asciidoctor + * @example + * var input = '= Hello, AsciiDoc!\n' + + * 'Guillaume Grossetie \n\n' + + * 'An introduction to http://asciidoc.org[AsciiDoc].\n\n' + + * '== First Section\n\n' + + * '* item 1\n' + + * '* item 2\n'; + * + * var html = asciidoctor.convert(input); + */ +Asciidoctor.prototype.convert = function (input, options) { + if (typeof input === 'object' && input.constructor.name === 'Buffer') { + input = input.toString('utf8'); + } + var result = this.$convert(input, prepareOptions(options)); + return result === Opal.nil ? '' : result; +}; + +/** + * Parse the AsciiDoc source input into an {@link Document} and convert it to the specified backend format. + * + * @param {string} filename - source filename + * @param {Object} options - a JSON of options to control processing (default: {}) + * @returns {string|Document} - returns the {@link Document} object if the converted String is written to a file, + * otherwise the converted String + * @memberof Asciidoctor + * @example + * var html = asciidoctor.convertFile('./document.adoc'); + */ +Asciidoctor.prototype.convertFile = function (filename, options) { + return this.$convert_file(filename, prepareOptions(options)); +}; + +/** + * Parse the AsciiDoc source input into an {@link Document} + * + * Accepts input as a Buffer or String. + * + * @param {string|Buffer} input - AsciiDoc input as String or Buffer + * @param {Object} options - a JSON of options to control processing (default: {}) + * @returns {Document} - returns the {@link Document} object + * @memberof Asciidoctor + */ +Asciidoctor.prototype.load = function (input, options) { + if (typeof input === 'object' && input.constructor.name === 'Buffer') { + input = input.toString('utf8'); + } + return this.$load(input, prepareOptions(options)); +}; + +/** + * Parse the contents of the AsciiDoc source file into an {@link Document} + * + * @param {string} filename - source filename + * @param {Object} options - a JSON of options to control processing (default: {}) + * @returns {Document} - returns the {@link Document} object + * @memberof Asciidoctor + */ +Asciidoctor.prototype.loadFile = function (filename, options) { + return this.$load_file(filename, prepareOptions(options)); +}; + +// AbstractBlock API + +/** + * @namespace + * @extends AbstractNode + */ +var AbstractBlock = Opal.Asciidoctor.AbstractBlock; + +/** + * Append a block to this block's list of child blocks. + * + * @memberof AbstractBlock + * @returns {AbstractBlock} - the parent block to which this block was appended. + * + */ +AbstractBlock.prototype.append = function (block) { + this.$append(block); + return this; +}; + +/* + * Apply the named inline substitutions to the specified text. + * + * If no substitutions are specified, the following substitutions are + * applied: + * + * specialcharacters, quotes, attributes, replacements, macros, and post_replacements + * @param {string} text - The text to substitute. + * @param {Array} subs - A list named substitutions to apply to the text. + * @memberof AbstractBlock + * @returns {string} - returns the substituted text. + */ +AbstractBlock.prototype.applySubstitutions = function (text, subs) { + return this.$apply_subs(text, subs); +}; + +/** + * Get the String title of this Block with title substitions applied + * + * The following substitutions are applied to block and section titles: + * + * specialcharacters, quotes, replacements, macros, attributes and post_replacements + * + * @memberof AbstractBlock + * @returns {string} - returns the converted String title for this Block, or undefined if the title is not set. + * @example + * block.title // "Foo 3^ # {two-colons} Bar(1)" + * block.getTitle(); // "Foo 3^ # :: Bar(1)" + */ +AbstractBlock.prototype.getTitle = function () { + var title = this.$title(); + return title === Opal.nil ? undefined : title; +}; + +/** + * Convenience method that returns the interpreted title of the Block + * with the caption prepended. + * Concatenates the value of this Block's caption instance variable and the + * return value of this Block's title method. No space is added between the + * two values. If the Block does not have a caption, the interpreted title is + * returned. + * + * @memberof AbstractBlock + * @returns {string} - the converted String title prefixed with the caption, or just the + * converted String title if no caption is set + */ +AbstractBlock.prototype.getCaptionedTitle = function () { + return this.$captioned_title(); +}; + +/** + * Get the style (block type qualifier) for this block. + * @memberof AbstractBlock + * @returns {string} - returns the style for this block + */ +AbstractBlock.prototype.getStyle = function () { + return this.style; +}; + +/** + * Get the caption for this block. + * @memberof AbstractBlock + * @returns {string} - returns the caption for this block + */ +AbstractBlock.prototype.getCaption = function () { + return this.$caption(); +}; + +/** + * Set the caption for this block. + * @param {string} caption - Caption + * @memberof AbstractBlock + */ +AbstractBlock.prototype.setCaption = function (caption) { + this.caption = caption; +}; + +/** + * Get the level of this section or the section level in which this block resides. + * @memberof AbstractBlock + * @returns {number} - returns the level of this section + */ +AbstractBlock.prototype.getLevel = function () { + return this.level; +}; + +/** + * Get the substitution keywords to be applied to the contents of this block. + * + * @memberof AbstractBlock + * @returns {Array} - the list of {string} substitution keywords associated with this block. + */ +AbstractBlock.prototype.getSubstitutions = function () { + return this.subs; +}; + +/** + * Check whether a given substitution keyword is present in the substitutions for this block. + * + * @memberof AbstractBlock + * @returns {boolean} - whether the substitution is present on this block. + */ +AbstractBlock.prototype.hasSubstitution = function (substitution) { + return this['$sub?'](substitution); +}; + +/** + * Remove the specified substitution keyword from the list of substitutions for this block. + * + * @memberof AbstractBlock + * @returns undefined + */ +AbstractBlock.prototype.removeSubstitution = function (substitution) { + this.$remove_sub(substitution); +}; + +/** + * Checks if the {@link AbstractBlock} contains any child blocks. + * @memberof AbstractBlock + * @returns {boolean} - whether the {@link AbstractBlock} has child blocks. + */ +AbstractBlock.prototype.hasBlocks = function () { + return this.blocks.length > 0; +}; + +/** + * Get the list of {@link AbstractBlock} sub-blocks for this block. + * @memberof AbstractBlock + * @returns {Array} - returns a list of {@link AbstractBlock} sub-blocks + */ +AbstractBlock.prototype.getBlocks = function () { + return this.blocks; +}; + +/** + * Get the converted result of the child blocks by converting the children appropriate to content model that this block supports. + * @memberof AbstractBlock + * @returns {string} - returns the converted result of the child blocks + */ +AbstractBlock.prototype.getContent = function () { + return this.$content(); +}; + +/** + * Get the converted content for this block. + * If the block has child blocks, the content method should cause them to be converted + * and returned as content that can be included in the parent block's template. + * @memberof AbstractBlock + * @returns {string} - returns the converted String content for this block + */ +AbstractBlock.prototype.convert = function () { + return this.$convert(); +}; + +/** + * Query for all descendant block-level nodes in the document tree + * that match the specified selector (context, style, id, and/or role). + * If a function block is given, it's used as an additional filter. + * If no selector or function block is supplied, all block-level nodes in the tree are returned. + * @param {Object} [selector] + * @param {function} [block] + * @example + * doc.findBy({'context': 'section'}); + * // => { level: 0, title: "Hello, AsciiDoc!", blocks: 0 } + * // => { level: 1, title: "First Section", blocks: 1 } + * + * doc.findBy({'context': 'section'}, function (section) { return section.getLevel() === 1; }); + * // => { level: 1, title: "First Section", blocks: 1 } + * + * doc.findBy({'context': 'listing', 'style': 'source'}); + * // => { context: :listing, content_model: :verbatim, style: "source", lines: 1 } + * + * @memberof AbstractBlock + * @returns {Array} - returns a list of block-level nodes that match the filter or an empty list if no matches are found + */ +AbstractBlock.prototype.findBy = function (selector, block) { + if (typeof block === 'undefined' && typeof selector === 'function') { + return Opal.send(this, 'find_by', null, selector); + } + else if (typeof block === 'function') { + return Opal.send(this, 'find_by', [toHash(selector)], block); + } + else { + return this.$find_by(toHash(selector)); + } +}; + +/** + * Get the source line number where this block started. + * @memberof AbstractBlock + * @returns {number} - returns the source line number where this block started + */ +AbstractBlock.prototype.getLineNumber = function () { + var lineno = this.$lineno(); + return lineno === Opal.nil ? undefined : lineno; +}; + +/** + * Check whether this block has any child Section objects. + * Only applies to Document and Section instances. + * @memberof AbstractBlock + * @returns {boolean} - true if this block has child Section objects, otherwise false + */ +AbstractBlock.prototype.hasSections = function () { + return this['$sections?'](); +}; + +/** + * Get the Array of child Section objects. + * Only applies to Document and Section instances. + * @memberof AbstractBlock + * @returns {Array} - returns an {Array} of {@link Section} objects + */ +AbstractBlock.prototype.getSections = function () { + return this.$sections(); +}; + +/** + * Get the numeral of this block (if section, relative to parent, otherwise absolute). + * Only assigned to section if automatic section numbering is enabled. + * Only assigned to formal block (block with title) if corresponding caption attribute is present. + * If the section is an appendix, the numeral is a letter (starting with A). + * @memberof AbstractBlock + * @returns {string} - returns the numeral + */ +AbstractBlock.prototype.getNumeral = function () { + // number was renamed to numeral + // https://github.com/asciidoctor/asciidoctor/commit/33ac4821e0375bcd5aa189c394ad7630717bcd55 + return this.$number(); +}; + +/** + * Set the numeral of this block. + * @memberof AbstractBlock + */ +AbstractBlock.prototype.setNumeral = function (value) { + // number was renamed to numeral + // https://github.com/asciidoctor/asciidoctor/commit/33ac4821e0375bcd5aa189c394ad7630717bcd55 + return this['$number='](value); +}; + +/** + * A convenience method that checks whether the title of this block is defined. + * + * @returns a {boolean} indicating whether this block has a title. + * @memberof AbstractBlock + */ +AbstractBlock.prototype.hasTitle = function () { + return this['$title?'](); +}; + +// Section API + +/** + * @namespace + * @extends AbstractBlock + */ +var Section = Opal.Asciidoctor.Section; + +/** + * Get the 0-based index order of this section within the parent block. + * @memberof Section + * @returns {number} + */ +Section.prototype.getIndex = function () { + return this.index; +}; + +/** + * Set the 0-based index order of this section within the parent block. + * @memberof Section + */ +Section.prototype.setIndex = function (value) { + this.index = value; +}; + +/** + * Get the section name of this section. + * @memberof Section + * @returns {string} + */ +Section.prototype.getSectionName = function () { + return this.sectname; +}; + +/** + * Set the section name of this section. + * @memberof Section + */ +Section.prototype.setSectionName = function (value) { + this.sectname = value; +}; + +/** + * Get the flag to indicate whether this is a special section or a child of one. + * @memberof Section + * @returns {boolean} + */ +Section.prototype.isSpecial = function () { + return this.special; +}; + +/** + * Set the flag to indicate whether this is a special section or a child of one. + * @memberof Section + */ +Section.prototype.setSpecial = function (value) { + this.special = value; +}; + +/** + * Get the state of the numbered attribute at this section (need to preserve for creating TOC). + * @memberof Section + * @returns {boolean} + */ +Section.prototype.isNumbered = function () { + return this.numbered; +}; + +/** + * Get the caption for this section (only relevant for appendices). + * @memberof Section + * @returns {string} + */ +Section.prototype.getCaption = function () { + var value = this.caption; + return value === Opal.nil ? undefined : value; +}; + +/** + * Get the name of the Section (title) + * @memberof Section + * @returns {string} + * @see {@link AbstractBlock#getTitle} + */ +Section.prototype.getName = function () { + return this.getTitle(); +}; + +/** + * @namespace + */ +var Block = Opal.Asciidoctor.Block; + +/** + * Get the source of this block. + * @memberof Block + * @returns {string} - returns the String source of this block. + */ +Block.prototype.getSource = function () { + return this.$source(); +}; + +/** + * Get the source lines of this block. + * @memberof Block + * @returns {Array} - returns the String {Array} of source lines for this block. + */ +Block.prototype.getSourceLines = function () { + return this.lines; +}; + +// AbstractNode API + +/** + * @namespace + */ +var AbstractNode = Opal.Asciidoctor.AbstractNode; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.getNodeName = function () { + return this.node_name; +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.getAttributes = function () { + return fromHash(this.attributes); +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.getAttribute = function (name, defaultValue, inherit) { + var value = this.$attr(name, defaultValue, inherit); + return value === Opal.nil ? undefined : value; +}; + +/** + * Check whether the specified attribute is present on this node. + * + * @memberof AbstractNode + * @returns {boolean} - true if the attribute is present, otherwise false + */ +AbstractNode.prototype.hasAttribute = function (name) { + return name in this.attributes.$$smap; +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.isAttribute = function (name, expectedValue, inherit) { + var result = this['$attr?'](name, expectedValue, inherit); + return result === Opal.nil ? false : result; +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.setAttribute = function (name, value, overwrite) { + if (typeof overwrite === 'undefined') overwrite = true; + return this.$set_attr(name, value, overwrite); +}; + +/** + * Remove the attribute from the current node. + * @param {string} name - The String attribute name to remove + * @returns {string} - returns the previous {String} value, or undefined if the attribute was not present. + * @memberof AbstractNode + */ +AbstractNode.prototype.removeAttribute = function (name) { + var value = this.$remove_attr(name); + return value === Opal.nil ? undefined : value; +}; + +/** + * Get the {@link Document} to which this node belongs. + * + * @memberof AbstractNode + * @returns {Document} - returns the {@link Document} object to which this node belongs. + */ +AbstractNode.prototype.getDocument = function () { + return this.document; +}; + +/** + * Get the {@link AbstractNode} to which this node is attached. + * + * @memberof AbstractNode + * @returns {AbstractNode} - returns the {@link AbstractNode} object to which this node is attached, + * or undefined if this node has no parent. + */ +AbstractNode.prototype.getParent = function () { + var parent = this.parent; + return parent === Opal.nil ? undefined : parent; +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.isInline = function () { + return this['$inline?'](); +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.isBlock = function () { + return this['$block?'](); +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.isRole = function (expected) { + return this['$role?'](expected); +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.getRole = function () { + return this.$role(); +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.hasRole = function (name) { + return this['$has_role?'](name); +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.getRoles = function () { + return this.$roles(); +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.addRole = function (name) { + return this.$add_role(name); +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.removeRole = function (name) { + return this.$remove_role(name); +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.isReftext = function () { + return this['$reftext?'](); +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.getReftext = function () { + return this.$reftext(); +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.getContext = function () { + var context = this.context; + // Automatically convert Opal pseudo-symbol to String + return typeof context === 'string' ? context : context.toString(); +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.getId = function () { + var id = this.id; + return id === Opal.nil ? undefined : id; +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.isOption = function (name) { + return this['$option?'](name); +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.setOption = function (name) { + return this.$set_option(name); +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.getIconUri = function (name) { + return this.$icon_uri(name); +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.getMediaUri = function (target, assetDirKey) { + return this.$media_uri(target, assetDirKey); +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.getImageUri = function (targetImage, assetDirKey) { + return this.$image_uri(targetImage, assetDirKey); +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.getConverter = function () { + return this.$converter(); +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.readContents = function (target, options) { + return this.$read_contents(target, toHash(options)); +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.readAsset = function (path, options) { + return this.$read_asset(path, toHash(options)); +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.normalizeWebPath = function (target, start, preserveTargetUri) { + return this.$normalize_web_path(target, start, preserveTargetUri); +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.normalizeSystemPath = function (target, start, jail, options) { + return this.$normalize_system_path(target, start, jail, toHash(options)); +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.normalizeAssetPath = function (assetRef, assetName, autoCorrect) { + return this.$normalize_asset_path(assetRef, assetName, autoCorrect); +}; + +// Document API + +/** + * The {@link Document} class represents a parsed AsciiDoc document. + * + * Document is the root node of a parsed AsciiDoc document.
    + * It provides an abstract syntax tree (AST) that represents the structure of the AsciiDoc document + * from which the Document object was parsed. + * + * Although the constructor can be used to create an empty document object, + * more commonly, you'll load the document object from AsciiDoc source + * using the primary API methods on {@link Asciidoctor}. + * When using one of these APIs, you almost always want to set the safe mode to 'safe' (or 'unsafe') + * to enable all of Asciidoctor's features. + * + *
    + *   var doc = Asciidoctor.load('= Hello, AsciiDoc!', {'safe': 'safe'});
    + *   // => Asciidoctor::Document { doctype: "article", doctitle: "Hello, Asciidoc!", blocks: 0 }
    + * 
    + * + * Instances of this class can be used to extract information from the document or alter its structure. + * As such, the Document object is most often used in extensions and by integrations. + * + * The most basic usage of the Document object is to retrieve the document's title. + * + *
    + *  var source = '= Document Title';
    + *  var doc = asciidoctor.load(source, {'safe': 'safe'});
    + *  console.log(doc.getTitle()); // 'Document Title'
    + * 
    + * + * You can also use the Document object to access document attributes defined in the header, such as the author and doctype. + * @namespace + * @extends AbstractBlock + */ + +var Document = Opal.Asciidoctor.Document; + +/** + * Returns a JSON {Object} of ids captured by the processor. + * + * @returns {Object} - returns a JSON {Object} of ids in the document. + * @memberof Document + */ +Document.prototype.getIds = function () { + return fromHash(this.catalog.$$smap.ids); +}; + +/** + * Returns a JSON {Object} of references captured by the processor. + * + * @returns {Object} - returns a JSON {Object} of {AbstractNode} in the document. + * @memberof Document + */ +Document.prototype.getRefs = function () { + return fromHash(this.catalog.$$smap.refs); +}; + +/** + * Returns an {Array} of Document/ImageReference} captured by the processor. + * + * @returns {Array} - returns an {Array} of {Document/ImageReference} in the document. + * Will return an empty array if the option "catalog_assets: true" was not defined on the processor. + * @memberof Document + */ +Document.prototype.getImages = function () { + return this.catalog.$$smap.images; +}; + +/** + * Returns an {Array} of index terms captured by the processor. + * + * @returns {Array} - returns an {Array} of index terms in the document. + * Will return an empty array if the function was called before the document was converted. + * @memberof Document + */ +Document.prototype.getIndexTerms = function () { + return this.catalog.$$smap.indexterms; +}; + +/** + * Returns an {Array} of links captured by the processor. + * + * @returns {Array} - returns an {Array} of links in the document. + * Will return an empty array if: + * - the function was called before the document was converted + * - the option "catalog_assets: true" was not defined on the processor + * @memberof Document + */ +Document.prototype.getLinks = function () { + return this.catalog.$$smap.links; +}; + +/** + * @returns {boolean} - returns true if the document has footnotes otherwise false + * @memberof Document + */ +Document.prototype.hasFootnotes = function () { + return this['$footnotes?'](); +}; + +/** + * Returns an {Array} of {Document/Footnote} captured by the processor. + * + * @returns {Array} - returns an {Array} of {Document/Footnote} in the document. + * Will return an empty array if the function was called before the document was converted. + * @memberof Document + */ +Document.prototype.getFootnotes = function () { + return this.$footnotes(); +}; + +/** + * @returns {string} - returns the level-0 section + * @memberof Document + */ +Document.prototype.getHeader = function () { + return this.header; +}; + +/** + * @memberof Document + */ +Document.prototype.setAttribute = function (name, value) { + return this.$set_attribute(name, value); +}; + +/** + + * @memberof Document + */ +Document.prototype.removeAttribute = function (name) { + this.attributes.$delete(name); + this.attribute_overrides.$delete(name); +}; + +/** + * @memberof Document + */ +Document.prototype.convert = function (options) { + var result = this.$convert(toHash(options)); + return result === Opal.nil ? '' : result; +}; + +/** + * @memberof Document + */ +Document.prototype.write = function (output, target) { + return this.$write(output, target); +}; + +/** + * @returns {string} - returns the full name of the author as a String + * @memberof Document + */ +Document.prototype.getAuthor = function () { + return this.$author(); +}; + +/** + * @memberof Document + */ +Document.prototype.getSource = function () { + return this.$source(); +}; + +/** + * @memberof Document + */ +Document.prototype.getSourceLines = function () { + return this.$source_lines(); +}; + +/** + * @memberof Document + */ +Document.prototype.isNested = function () { + return this['$nested?'](); +}; + +/** + * @memberof Document + */ +Document.prototype.isEmbedded = function () { + return this['$embedded?'](); +}; + +/** + * @memberof Document + */ +Document.prototype.hasExtensions = function () { + return this['$extensions?'](); +}; + +/** + * @memberof Document + */ +Document.prototype.getDoctype = function () { + return this.doctype; +}; + +/** + * @memberof Document + */ +Document.prototype.getBackend = function () { + return this.backend; +}; + +/** + * @memberof Document + */ +Document.prototype.isBasebackend = function (base) { + return this['$basebackend?'](base); +}; + +/** + * Get the title explicitly defined in the document attributes. + * @returns {string} + * @see {@link AbstractNode#getAttributes} + * @memberof Document + */ +Document.prototype.getTitle = function () { + var title = this.$title(); + return title === Opal.nil ? undefined : title; +}; + +/** + * @memberof Document + */ +Document.prototype.setTitle = function (title) { + return this['$title='](title); +}; + +/** + * @memberof Document + * @returns {Document/Title} - returns a {@link Document/Title} + */ +Document.prototype.getDocumentTitle = function (options) { + var doctitle = this.$doctitle(toHash(options)); + return doctitle === Opal.nil ? undefined : doctitle; +}; + +/** + * @memberof Document + * @see {@link Document#getDocumentTitle} + */ +Document.prototype.getDoctitle = Document.prototype.getDocumentTitle; + +/** + * Get the document catalog Hash. + * @memberof Document + */ +Document.prototype.getCatalog = function () { + return fromHash(this.catalog); +}; + +/** + * @memberof Document + */ +Document.prototype.getReferences = Document.prototype.getCatalog; + +/** + * Get the document revision date from document header (document attribute revdate). + * @memberof Document + */ +Document.prototype.getRevisionDate = function () { + return this.getAttribute('revdate'); +}; + +/** + * @memberof Document + * @see Document#getRevisionDate + */ +Document.prototype.getRevdate = function () { + return this.getRevisionDate(); +}; + +/** + * Get the document revision number from document header (document attribute revnumber). + * @memberof Document + */ +Document.prototype.getRevisionNumber = function () { + return this.getAttribute('revnumber'); +}; + +/** + * Get the document revision remark from document header (document attribute revremark). + * @memberof Document + */ +Document.prototype.getRevisionRemark = function () { + return this.getAttribute('revremark'); +}; + + +/** + * Assign a value to the specified attribute in the document header. + * + * The assignment will be visible when the header attributes are restored, + * typically between processor phases (e.g., between parse and convert). + * + * @param {string} name - The {string} attribute name to assign + * @param {Object} value - The {Object} value to assign to the attribute (default: '') + * @param {boolean} overwrite - A {boolean} indicating whether to assign the attribute + * if already present in the attributes Hash (default: true) + * + * @memberof Document + * @returns {boolean} - returns true if the assignment was performed otherwise false + */ +Document.prototype.setHeaderAttribute = function (name, value, overwrite) { + if (typeof overwrite === 'undefined') overwrite = true; + if (typeof value === 'undefined') value = ''; + return this.$set_header_attribute(name, value, overwrite); +}; + +/** + * Convenience method to retrieve the authors of this document as an {Array} of {Document/Author} objects. + * + * This method is backed by the author-related attributes on the document. + * + * @memberof Document + * @returns {Array} - returns an {Array} of {Document/Author} objects. + */ +Document.prototype.getAuthors = function () { + return this.$authors(); +}; + +// Document.Footnote API + +/** + * @namespace + * @module Document/Footnote + */ +var Footnote = Document.Footnote; + +/** + * @memberof Document/Footnote + * @returns {number} - returns the footnote's index + */ +Footnote.prototype.getIndex = function () { + var index = this.$$data.index; + return index === Opal.nil ? undefined : index; +}; + +/** + * @memberof Document/Footnote + * @returns {string} - returns the footnote's id + */ +Footnote.prototype.getId = function () { + var id = this.$$data.id; + return id === Opal.nil ? undefined : id; +}; + +/** + * @memberof Document/Footnote + * @returns {string} - returns the footnote's text + */ +Footnote.prototype.getText = function () { + var text = this.$$data.text; + return text === Opal.nil ? undefined : text; +}; + +// Document.ImageReference API + +/** + * @namespace + * @module Document/ImageReference + */ +var ImageReference = Document.ImageReference; + +/** + * @memberof Document/ImageReference + * @returns {string} - returns the image's target + */ +ImageReference.prototype.getTarget = function () { + return this.$$data.target; +}; + +/** + * @memberof Document/ImageReference + * @returns {string} - returns the image's directory (imagesdir attribute) + */ +ImageReference.prototype.getImagesDirectory = function () { + var value = this.$$data.imagesdir; + return value === Opal.nil ? undefined : value; +}; + +// Document.Author API + +/** + * @namespace + * @module Document/Author + */ +var Author = Document.Author; + +/** + * @memberof Document/Author + * @returns {string} - returns the author's full name + */ +Author.prototype.getName = function () { + var name = this.$$data.name; + return name === Opal.nil ? undefined : name; +}; + +/** + * @memberof Document/Author + * @returns {string} - returns the author's first name + */ +Author.prototype.getFirstName = function () { + var firstName = this.$$data.firstname; + return firstName === Opal.nil ? undefined : firstName; +}; + +/** + * @memberof Document/Author + * @returns {string} - returns the author's middle name (or undefined if the author has no middle name) + */ +Author.prototype.getMiddleName = function () { + var middleName = this.$$data.middlename; + return middleName === Opal.nil ? undefined : middleName; +}; + +/** + * @memberof Document/Author + * @returns {string} - returns the author's last name + */ +Author.prototype.getLastName = function () { + var lastName = this.$$data.lastname; + return lastName === Opal.nil ? undefined : lastName; +}; + +/** + * @memberof Document/Author + * @returns {string} - returns the author's initials (by default based on the author's name) + */ +Author.prototype.getInitials = function () { + var initials = this.$$data.initials; + return initials === Opal.nil ? undefined : initials; +}; + +/** + * @memberof Document/Author + * @returns {string} - returns the author's email + */ +Author.prototype.getEmail = function () { + var email = this.$$data.email; + return email === Opal.nil ? undefined : email; +}; + +// private constructor +Document.RevisionInfo = function (date, number, remark) { + this.date = date; + this.number = number; + this.remark = remark; +}; + +/** + * @class + * @namespace + * @module Document/RevisionInfo + */ +var RevisionInfo = Document.RevisionInfo; + +/** + * Get the document revision date from document header (document attribute revdate). + * @memberof Document/RevisionInfo + */ +RevisionInfo.prototype.getDate = function () { + return this.date; +}; + +/** + * Get the document revision number from document header (document attribute revnumber). + * @memberof Document/RevisionInfo + */ +RevisionInfo.prototype.getNumber = function () { + return this.number; +}; + +/** + * Get the document revision remark from document header (document attribute revremark). + * A short summary of changes in this document revision. + * @memberof Document/RevisionInfo + */ +RevisionInfo.prototype.getRemark = function () { + return this.remark; +}; + +/** + * @memberof Document/RevisionInfo + * @returns {boolean} - returns true if the revision info is empty (ie. not defined), otherwise false + */ +RevisionInfo.prototype.isEmpty = function () { + return this.date === undefined && this.number === undefined && this.remark === undefined; +}; + +/** + * @memberof Document + * @returns {Document/RevisionInfo} - returns a {@link Document/RevisionInfo} + */ +Document.prototype.getRevisionInfo = function () { + return new Document.RevisionInfo(this.getRevisionDate(), this.getRevisionNumber(), this.getRevisionRemark()); +}; + +/** + * @memberof Document + * @returns {boolean} - returns true if the document contains revision info, otherwise false + */ +Document.prototype.hasRevisionInfo = function () { + var revisionInfo = this.getRevisionInfo(); + return !revisionInfo.isEmpty(); +}; + +/** + * @memberof Document + */ +Document.prototype.getNotitle = function () { + return this.$notitle(); +}; + +/** + * @memberof Document + */ +Document.prototype.getNoheader = function () { + return this.$noheader(); +}; + +/** + * @memberof Document + */ +Document.prototype.getNofooter = function () { + return this.$nofooter(); +}; + +/** + * @memberof Document + */ +Document.prototype.hasHeader = function () { + return this['$header?'](); +}; + +/** + * @memberof Document + */ +Document.prototype.deleteAttribute = function (name) { + return this.$delete_attribute(name); +}; + +/** + * @memberof Document + */ +Document.prototype.isAttributeLocked = function (name) { + return this['$attribute_locked?'](name); +}; + +/** + * @memberof Document + */ +Document.prototype.parse = function (data) { + return this.$parse(data); +}; + +/** + * @memberof Document + */ +Document.prototype.getDocinfo = function (docinfoLocation, suffix) { + return this.$docinfo(docinfoLocation, suffix); +}; + +/** + * @memberof Document + */ +Document.prototype.hasDocinfoProcessors = function (docinfoLocation) { + return this['$docinfo_processors?'](docinfoLocation); +}; + +/** + * @memberof Document + */ +Document.prototype.counterIncrement = function (counterName, block) { + return this.$counter_increment(counterName, block); +}; + +/** + * @memberof Document + */ +Document.prototype.counter = function (name, seed) { + return this.$counter(name, seed); +}; + +/** + * @memberof Document + */ +Document.prototype.getSafe = function () { + return this.safe; +}; + +/** + * @memberof Document + */ +Document.prototype.getCompatMode = function () { + return this.compat_mode; +}; + +/** + * @memberof Document + */ +Document.prototype.getSourcemap = function () { + return this.sourcemap; +}; + +/** + * @memberof Document + */ +Document.prototype.getCounters = function () { + return fromHash(this.counters); +}; + +/** + * @memberof Document + */ +Document.prototype.getCallouts = function () { + return this.$callouts(); +}; + +/** + * @memberof Document + */ +Document.prototype.getBaseDir = function () { + return this.base_dir; +}; + +/** + * @memberof Document + */ +Document.prototype.getOptions = function () { + return fromHash(this.options); +}; + +/** + * @memberof Document + */ +Document.prototype.getOutfilesuffix = function () { + return this.outfilesuffix; +}; + +/** + * @memberof Document + */ +Document.prototype.getParentDocument = function () { + return this.parent_document; +}; + +/** + * @memberof Document + */ +Document.prototype.getReader = function () { + return this.reader; +}; + +/** + * @memberof Document + */ +Document.prototype.getConverter = function () { + return this.converter; +}; + +/** + * @memberof Document + */ +Document.prototype.getExtensions = function () { + return this.extensions; +}; + +// Document.Title API + +/** + * @namespace + * @module Document/Title + */ +var Title = Document.Title; + +/** + * @memberof Document/Title + */ +Title.prototype.getMain = function () { + return this.main; +}; + +/** + * @memberof Document/Title + */ +Title.prototype.getCombined = function () { + return this.combined; +}; + +/** + * @memberof Document/Title + */ +Title.prototype.getSubtitle = function () { + var subtitle = this.subtitle; + return subtitle === Opal.nil ? undefined : subtitle; +}; + +/** + * @memberof Document/Title + */ +Title.prototype.isSanitized = function () { + var sanitized = this['$sanitized?'](); + return sanitized === Opal.nil ? false : sanitized; +}; + +/** + * @memberof Document/Title + */ +Title.prototype.hasSubtitle = function () { + return this['$subtitle?'](); +}; + +// Inline API + +/** + * @namespace + * @extends AbstractNode + */ +var Inline = Opal.Asciidoctor.Inline; + +/** + * Create a new Inline element. + * + * @memberof Inline + * @returns {Inline} - returns a new Inline element + */ +Opal.Asciidoctor.Inline['$$class'].prototype.create = function (parent, context, text, opts) { + return this.$new(parent, context, text, toHash(opts)); +}; + +/** + * Get the converted content for this inline node. + * + * @memberof Inline + * @returns {string} - returns the converted String content for this inline node + */ +Inline.prototype.convert = function () { + return this.$convert(); +}; + +/** + * Get the converted String text of this Inline node, if applicable. + * + * @memberof Inline + * @returns {string} - returns the converted String text for this Inline node, or undefined if not applicable for this node. + */ +Inline.prototype.getText = function () { + var text = this.$text(); + return text === Opal.nil ? undefined : text; +}; + +/** + * Get the String sub-type (aka qualifier) of this Inline node. + * + * This value is used to distinguish different variations of the same node + * category, such as different types of anchors. + * + * @memberof Inline + * @returns {string} - returns the string sub-type of this Inline node. + */ +Inline.prototype.getType = function () { + return this.$type(); +}; + +/** + * Get the primary String target of this Inline node. + * + * @memberof Inline + * @returns {string} - returns the string target of this Inline node. + */ +Inline.prototype.getTarget = function () { + var target = this.$target(); + return target === Opal.nil ? undefined : target; +}; + +// List API + +/** @namespace */ +var List = Opal.Asciidoctor.List; + +/** + * Get the Array of {@link ListItem} nodes for this {@link List}. + * + * @memberof List + * @returns {Array} - returns an Array of {@link ListItem} nodes. + */ +List.prototype.getItems = function () { + return this.blocks; +}; + +// ListItem API + +/** @namespace */ +var ListItem = Opal.Asciidoctor.ListItem; + +/** + * Get the converted String text of this ListItem node. + * + * @memberof ListItem + * @returns {string} - returns the converted String text for this ListItem node. + */ +ListItem.prototype.getText = function () { + return this.$text(); +}; + +/** + * Set the String source text of this ListItem node. + * + * @memberof ListItem + */ +ListItem.prototype.setText = function (text) { + return this.text = text; +}; + +// Reader API + +/** @namespace */ +var Reader = Opal.Asciidoctor.Reader; + +/** + * @memberof Reader + */ +Reader.prototype.pushInclude = function (data, file, path, lineno, attributes) { + return this.$push_include(data, file, path, lineno, toHash(attributes)); +}; + +/** + * Get the current location of the reader's cursor, which encapsulates the + * file, dir, path, and lineno of the file being read. + * + * @memberof Reader + */ +Reader.prototype.getCursor = function () { + return this.$cursor(); +}; + +/** + * Get a copy of the remaining {Array} of String lines managed by this Reader. + * + * @memberof Reader + * @returns {Array} - returns A copy of the String {Array} of lines remaining in this Reader. + */ +Reader.prototype.getLines = function () { + return this.$lines(); +}; + +/** + * Get the remaining lines managed by this Reader as a String. + * + * @memberof Reader + * @returns {string} - returns The remaining lines managed by this Reader as a String (joined by linefeed characters). + */ +Reader.prototype.getString = function () { + return this.$string(); +}; + +// Cursor API + +/** @namespace */ +var Cursor = Opal.Asciidoctor.Reader.Cursor; + +/** + * Get the file associated to the cursor. + * @memberof Cursor + */ +Cursor.prototype.getFile = function () { + var file = this.file; + return file === Opal.nil ? undefined : file; +}; + +/** + * Get the directory associated to the cursor. + * @memberof Cursor + * @returns {string} - returns the directory associated to the cursor + */ +Cursor.prototype.getDirectory = function () { + var dir = this.dir; + return dir === Opal.nil ? undefined : dir; +}; + +/** + * Get the path associated to the cursor. + * @memberof Cursor + * @returns {string} - returns the path associated to the cursor (or '') + */ +Cursor.prototype.getPath = function () { + var path = this.path; + return path === Opal.nil ? undefined : path; +}; + +/** + * Get the line number of the cursor. + * @memberof Cursor + * @returns {number} - returns the line number of the cursor + */ +Cursor.prototype.getLineNumber = function () { + return this.lineno; +}; + +// Logger API (available in Asciidoctor 1.5.7+) + +function initializeLoggerFormatterClass (className, functions) { + var superclass = Opal.const_get_qualified(Opal.Logger, 'Formatter'); + return initializeClass(superclass, className, functions, {}, { + 'call': function (args) { + for (var i = 0; i < args.length; i++) { + // convert all (Opal) Hash arguments to JSON. + if (typeof args[i] === 'object' && '$$smap' in args[i]) { + args[i] = fromHash(args[i]); + } + } + return args; + } + }); +} + +function initializeLoggerClass (className, functions) { + var superClass = Opal.const_get_qualified(Opal.Asciidoctor, 'Logger'); + return initializeClass(superClass, className, functions, {}, { + 'add': function (args) { + if (args.length >= 2 && typeof args[2] === 'object' && '$$smap' in args[2]) { + var message = args[2]; + var messageObject = fromHash(message); + messageObject.getText = function () { + return this['text']; + }; + messageObject.getSourceLocation = function () { + return this['source_location']; + }; + messageObject['$inspect'] = function () { + var sourceLocation = this.getSourceLocation(); + if (sourceLocation) { + return sourceLocation.getPath() + ': line ' + sourceLocation.getLineNumber() + ': ' + this.getText(); + } else { + return this.getText(); + } + }; + args[2] = messageObject; + } + return args; + } + }); +} + +/** + * @namespace + */ +var LoggerManager = Opal.const_get_qualified(Opal.Asciidoctor, 'LoggerManager', true); + +// Alias +Opal.Asciidoctor.LoggerManager = LoggerManager; + +if (LoggerManager) { + LoggerManager.getLogger = function () { + return this.$logger(); + }; + + LoggerManager.setLogger = function (logger) { + this.logger = logger; + }; + + LoggerManager.newLogger = function (name, functions) { + return initializeLoggerClass(name, functions).$new(); + }; + + LoggerManager.newFormatter = function (name, functions) { + return initializeLoggerFormatterClass(name, functions).$new(); + }; +} + +/** + * @namespace + */ +var LoggerSeverity = Opal.const_get_qualified(Opal.Logger, 'Severity', true); + +// Alias +Opal.Asciidoctor.LoggerSeverity = LoggerSeverity; + +if (LoggerSeverity) { + LoggerSeverity.get = function (severity) { + return LoggerSeverity.$constants()[severity]; + }; +} + +/** + * @namespace + */ +var LoggerFormatter = Opal.const_get_qualified(Opal.Logger, 'Formatter', true); + + +// Alias +Opal.Asciidoctor.LoggerFormatter = LoggerFormatter; + +if (LoggerFormatter) { + LoggerFormatter.prototype.call = function (severity, time, programName, message) { + return this.$call(LoggerSeverity.get(severity), time, programName, message); + }; +} + +/** + * @namespace + */ +var MemoryLogger = Opal.const_get_qualified(Opal.Asciidoctor, 'MemoryLogger', true); + +// Alias +Opal.Asciidoctor.MemoryLogger = MemoryLogger; + +if (MemoryLogger) { + MemoryLogger.prototype.getMessages = function () { + var messages = this.messages; + var result = []; + for (var i = 0; i < messages.length; i++) { + var message = messages[i]; + var messageObject = fromHash(message); + if (typeof messageObject.message === 'string') { + messageObject.getText = function () { + return this.message; + }; + } else { + // also convert the message attribute + messageObject.message = fromHash(messageObject.message); + messageObject.getText = function () { + return this.message['text']; + }; + } + messageObject.getSeverity = function () { + return this.severity.toString(); + }; + messageObject.getSourceLocation = function () { + return this.message['source_location']; + }; + result.push(messageObject); + } + return result; + }; +} + +/** + * @namespace + */ +var Logger = Opal.const_get_qualified(Opal.Asciidoctor, 'Logger', true); + +// Alias +Opal.Asciidoctor.Logger = Logger; + +if (Logger) { + Logger.prototype.getMaxSeverity = function () { + return this.max_severity; + }; + Logger.prototype.getFormatter = function () { + return this.formatter; + }; + Logger.prototype.setFormatter = function (formatter) { + return this.formatter = formatter; + }; + Logger.prototype.getLevel = function () { + return this.level; + }; + Logger.prototype.setLevel = function (level) { + return this.level = level; + }; + Logger.prototype.getProgramName = function () { + return this.progname; + }; + Logger.prototype.setProgramName = function (programName) { + return this.progname = programName; + }; +} + +/** + * @namespace + */ +var NullLogger = Opal.const_get_qualified(Opal.Asciidoctor, 'NullLogger', true); + +// Alias +Opal.Asciidoctor.NullLogger = NullLogger; + + +if (NullLogger) { + NullLogger.prototype.getMaxSeverity = function () { + return this.max_severity; + }; +} + + +// Alias +Opal.Asciidoctor.StopIteration = Opal.StopIteration; + +// Extensions API + +/** + * @private + */ +var toBlock = function (block) { + // arity is a mandatory field + block.$$arity = block.length; + return block; +}; + +var registerExtension = function (registry, type, processor, name) { + if (typeof processor === 'object' || processor.$$is_class) { + // processor is an instance or a class + return registry['$' + type](processor, name); + } else { + // processor is a function/lambda + return Opal.send(registry, type, name && [name], toBlock(processor)); + } +}; + +/** + * @namespace + * @description + * Extensions provide a way to participate in the parsing and converting + * phases of the AsciiDoc processor or extend the AsciiDoc syntax. + * + * The various extensions participate in AsciiDoc processing as follows: + * + * 1. After the source lines are normalized, {{@link Extensions/Preprocessor}}s modify or replace + * the source lines before parsing begins. {{@link Extensions/IncludeProcessor}}s are used to + * process include directives for targets which they claim to handle. + * 2. The Parser parses the block-level content into an abstract syntax tree. + * Custom blocks and block macros are processed by associated {{@link Extensions/BlockProcessor}}s + * and {{@link Extensions/BlockMacroProcessor}}s, respectively. + * 3. {{@link Extensions/TreeProcessor}}s are run on the abstract syntax tree. + * 4. Conversion of the document begins, at which point inline markup is processed + * and converted. Custom inline macros are processed by associated {InlineMacroProcessor}s. + * 5. {{@link Extensions/Postprocessor}}s modify or replace the converted document. + * 6. The output is written to the output stream. + * + * Extensions may be registered globally using the {Extensions.register} method + * or added to a custom {Registry} instance and passed as an option to a single + * Asciidoctor processor. + * + * @example + * Opal.Asciidoctor.Extensions.register(function () { + * this.block(function () { + * var self = this; + * self.named('shout'); + * self.onContext('paragraph'); + * self.process(function (parent, reader) { + * var lines = reader.getLines().map(function (l) { return l.toUpperCase(); }); + * return self.createBlock(parent, 'paragraph', lines); + * }); + * }); + * }); + */ +var Extensions = Opal.const_get_qualified(Opal.Asciidoctor, 'Extensions'); + +// Alias +Opal.Asciidoctor.Extensions = Extensions; + +/** + * Create a new {@link Extensions/Registry}. + * @param {string} name + * @param {function} block + * @memberof Extensions + * @returns {Extensions/Registry} - returns a {@link Extensions/Registry} + */ +Extensions.create = function (name, block) { + if (typeof name === 'function' && typeof block === 'undefined') { + return Opal.send(this, 'build_registry', null, toBlock(name)); + } else if (typeof block === 'function') { + return Opal.send(this, 'build_registry', [name], toBlock(block)); + } else { + return this.$build_registry(); + } +}; + +/** + * @memberof Extensions + */ +Extensions.register = function (name, block) { + if (typeof name === 'function' && typeof block === 'undefined') { + return Opal.send(this, 'register', null, toBlock(name)); + } else { + return Opal.send(this, 'register', [name], toBlock(block)); + } +}; + +/** + * Get statically-registerd extension groups. + * @memberof Extensions + */ +Extensions.getGroups = function () { + return fromHash(this.$groups()); +}; + +/** + * Unregister all statically-registered extension groups. + * @memberof Extensions + */ +Extensions.unregisterAll = function () { + this.$unregister_all(); +}; + +/** + * Unregister the specified statically-registered extension groups. + * + * NOTE Opal cannot delete an entry from a Hash that is indexed by symbol, so + * we have to resort to using low-level operations in this method. + * + * @memberof Extensions + */ +Extensions.unregister = function () { + var names = Array.prototype.concat.apply([], arguments); + var groups = this.$groups(); + var groupNameIdx = {}; + for (var i = 0, groupSymbolNames = groups.$$keys; i < groupSymbolNames.length; i++) { + var groupSymbolName = groupSymbolNames[i]; + groupNameIdx[groupSymbolName.toString()] = groupSymbolName; + } + for (var j = 0; j < names.length; j++) { + var groupStringName = names[j]; + if (groupStringName in groupNameIdx) Opal.hash_delete(groups, groupNameIdx[groupStringName]); + } +}; + +/** + * @namespace + * @module Extensions/Registry + */ +var Registry = Extensions.Registry; + +/** + * @memberof Extensions/Registry + */ +Registry.prototype.getGroups = Extensions.getGroups; + +/** + * @memberof Extensions/Registry + */ +Registry.prototype.unregisterAll = function () { + this.groups = Opal.hash(); +}; + +/** + * @memberof Extensions/Registry + */ +Registry.prototype.unregister = Extensions.unregister; + +/** + * @memberof Extensions/Registry + */ +Registry.prototype.prefer = function (name, processor) { + if (arguments.length === 1) { + processor = name; + name = null; + } + if (typeof processor === 'object' || processor.$$is_class) { + // processor is an instance or a class + return this['$prefer'](name, processor); + } else { + // processor is a function/lambda + return Opal.send(this, 'prefer', name && [name], toBlock(processor)); + } +}; + +/** + * @memberof Extensions/Registry + */ +Registry.prototype.block = function (name, processor) { + if (arguments.length === 1) { + processor = name; + name = null; + } + return registerExtension(this, 'block', processor, name); +}; + +/** + * @memberof Extensions/Registry + */ +Registry.prototype.inlineMacro = function (name, processor) { + if (arguments.length === 1) { + processor = name; + name = null; + } + return registerExtension(this, 'inline_macro', processor, name); +}; + +/** + * @memberof Extensions/Registry + */ +Registry.prototype.includeProcessor = function (name, processor) { + if (arguments.length === 1) { + processor = name; + name = null; + } + return registerExtension(this, 'include_processor', processor, name); +}; + +/** + * @memberof Extensions/Registry + */ +Registry.prototype.blockMacro = function (name, processor) { + if (arguments.length === 1) { + processor = name; + name = null; + } + return registerExtension(this, 'block_macro', processor, name); +}; + +/** + * @memberof Extensions/Registry + */ +Registry.prototype.treeProcessor = function (name, processor) { + if (arguments.length === 1) { + processor = name; + name = null; + } + return registerExtension(this, 'tree_processor', processor, name); +}; + +/** + * @memberof Extensions/Registry + */ +Registry.prototype.postprocessor = function (name, processor) { + if (arguments.length === 1) { + processor = name; + name = null; + } + return registerExtension(this, 'postprocessor', processor, name); +}; + +/** + * @memberof Extensions/Registry + */ +Registry.prototype.preprocessor = function (name, processor) { + if (arguments.length === 1) { + processor = name; + name = null; + } + return registerExtension(this, 'preprocessor', processor, name); +}; + +/** + * @memberof Extensions/Registry + */ + +Registry.prototype.docinfoProcessor = function (name, processor) { + if (arguments.length === 1) { + processor = name; + name = null; + } + return registerExtension(this, 'docinfo_processor', processor, name); +}; + +/** + * @namespace + * @module Extensions/Processor + */ +var Processor = Extensions.Processor; + +/** + * The extension will be added to the beginning of the list for that extension type. (default is append). + * @memberof Extensions/Processor + * @deprecated Please use the prefer function on the {@link Extensions/Registry}, + * the {@link Extensions/IncludeProcessor}, + * the {@link Extensions/TreeProcessor}, + * the {@link Extensions/Postprocessor}, + * the {@link Extensions/Preprocessor} + * or the {@link Extensions/DocinfoProcessor} + */ +Processor.prototype.prepend = function () { + this.$option('position', '>>'); +}; + +/** + * @memberof Extensions/Processor + */ +Processor.prototype.process = function (block) { + var handler = { + apply: function (target, thisArg, argumentsList) { + for (var i = 0; i < argumentsList.length; i++) { + // convert all (Opal) Hash arguments to JSON. + if (typeof argumentsList[i] === 'object' && '$$smap' in argumentsList[i]) { + argumentsList[i] = fromHash(argumentsList[i]); + } + } + return target.apply(thisArg, argumentsList); + } + }; + var blockProxy = new Proxy(block, handler); + return Opal.send(this, 'process', null, toBlock(blockProxy)); +}; + +/** + * @memberof Extensions/Processor + */ +Processor.prototype.named = function (name) { + return this.$named(name); +}; + +/** + * @memberof Extensions/Processor + */ +Processor.prototype.createBlock = function (parent, context, source, attrs, opts) { + return this.$create_block(parent, context, source, toHash(attrs), toHash(opts)); +}; + +/** + * Creates a list block node and links it to the specified parent. + * + * @param parent - The parent Block (Block, Section, or Document) of this new list block. + * @param {string} context - The list context (e.g., ulist, olist, colist, dlist) + * @param {Object} attrs - An object of attributes to set on this list block + * + * @memberof Extensions/Processor + */ +Processor.prototype.createList = function (parent, context, attrs) { + return this.$create_list(parent, context, toHash(attrs)); +}; + +/** + * Creates a list item node and links it to the specified parent. + * + * @param parent - The parent List of this new list item block. + * @param {string} text - The text of the list item. + * + * @memberof Extensions/Processor + */ +Processor.prototype.createListItem = function (parent, text) { + return this.$create_list_item(parent, text); +}; + +/** + * @memberof Extensions/Processor + */ +Processor.prototype.createImageBlock = function (parent, attrs, opts) { + return this.$create_image_block(parent, toHash(attrs), toHash(opts)); +}; + +/** + * @memberof Extensions/Processor + */ +Processor.prototype.createInline = function (parent, context, text, opts) { + if (opts && opts.attributes) { + opts.attributes = toHash(opts.attributes); + } + return this.$create_inline(parent, context, text, toHash(opts)); +}; + +/** + * @memberof Extensions/Processor + */ +Processor.prototype.parseContent = function (parent, content, attrs) { + return this.$parse_content(parent, content, attrs); +}; + +/** + * @memberof Extensions/Processor + */ +Processor.prototype.positionalAttributes = function (value) { + return this.$positional_attrs(value); +}; + +/** + * @memberof Extensions/Processor + */ +Processor.prototype.resolvesAttributes = function (args) { + return this.$resolves_attributes(args); +}; + +/** + * @namespace + * @module Extensions/BlockProcessor + */ +var BlockProcessor = Extensions.BlockProcessor; + +/** + * @memberof Extensions/BlockProcessor + */ +BlockProcessor.prototype.onContext = function (context) { + return this.$on_context(context); +}; + +/** + * @memberof Extensions/BlockProcessor + */ +BlockProcessor.prototype.onContexts = function () { + return this.$on_contexts(Array.prototype.slice.call(arguments)); +}; + +/** + * @memberof Extensions/BlockProcessor + */ +BlockProcessor.prototype.getName = function () { + var name = this.name; + return name === Opal.nil ? undefined : name; +}; + +/** + * @namespace + * @module Extensions/BlockMacroProcessor + */ +var BlockMacroProcessor = Extensions.BlockMacroProcessor; + +/** + * @memberof Extensions/BlockMacroProcessor + */ +BlockMacroProcessor.prototype.getName = function () { + var name = this.name; + return name === Opal.nil ? undefined : name; +}; + +/** + * @namespace + * @module Extensions/InlineMacroProcessor + */ +var InlineMacroProcessor = Extensions.InlineMacroProcessor; + +/** + * @memberof Extensions/InlineMacroProcessor + */ +InlineMacroProcessor.prototype.getName = function () { + var name = this.name; + return name === Opal.nil ? undefined : name; +}; + +/** + * @namespace + * @module Extensions/IncludeProcessor + */ +var IncludeProcessor = Extensions.IncludeProcessor; + +/** + * @memberof Extensions/IncludeProcessor + */ +IncludeProcessor.prototype.handles = function (block) { + return Opal.send(this, 'handles?', null, toBlock(block)); +}; + +/** + * @memberof Extensions/IncludeProcessor + */ +IncludeProcessor.prototype.prefer = function () { + this.$prefer(); +}; + +/** + * @namespace + * @module Extensions/TreeProcessor + */ +// eslint-disable-next-line no-unused-vars +var TreeProcessor = Extensions.TreeProcessor; + +/** + * @memberof Extensions/TreeProcessor + */ +TreeProcessor.prototype.prefer = function () { + this.$prefer(); +}; + +/** + * @namespace + * @module Extensions/Postprocessor + */ +// eslint-disable-next-line no-unused-vars +var Postprocessor = Extensions.Postprocessor; + +/** + * @memberof Extensions/Postprocessor + */ +Postprocessor.prototype.prefer = function () { + this.$prefer(); +}; + +/** + * @namespace + * @module Extensions/Preprocessor + */ +// eslint-disable-next-line no-unused-vars +var Preprocessor = Extensions.Preprocessor; + +/** + * @memberof Extensions/Preprocessor + */ +Preprocessor.prototype.prefer = function () { + this.$prefer(); +}; + +/** + * @namespace + * @module Extensions/DocinfoProcessor + */ +var DocinfoProcessor = Extensions.DocinfoProcessor; + +/** + * @memberof Extensions/DocinfoProcessor + */ +DocinfoProcessor.prototype.prefer = function () { + this.$prefer(); +}; + +/** + * @memberof Extensions/DocinfoProcessor + */ +DocinfoProcessor.prototype.atLocation = function (value) { + this.$at_location(value); +}; + +function initializeProcessorClass (superclassName, className, functions) { + var superClass = Opal.const_get_qualified(Extensions, superclassName); + return initializeClass(superClass, className, functions, { + 'handles?': function () { + return true; + } + }); +} + +// Postprocessor + +/** + * Create a postprocessor + * @description this API is experimental and subject to change + * @memberof Extensions + */ +Extensions.createPostprocessor = function (name, functions) { + if (arguments.length === 1) { + functions = name; + name = null; + } + return initializeProcessorClass('Postprocessor', name, functions); +}; + +/** + * Create and instantiate a postprocessor + * @description this API is experimental and subject to change + * @memberof Extensions + */ +Extensions.newPostprocessor = function (name, functions) { + if (arguments.length === 1) { + functions = name; + name = null; + } + return this.createPostprocessor(name, functions).$new(); +}; + +// Preprocessor + +/** + * Create a preprocessor + * @description this API is experimental and subject to change + * @memberof Extensions + */ +Extensions.createPreprocessor = function (name, functions) { + if (arguments.length === 1) { + functions = name; + name = null; + } + return initializeProcessorClass('Preprocessor', name, functions); +}; + +/** + * Create and instantiate a preprocessor + * @description this API is experimental and subject to change + * @memberof Extensions + */ +Extensions.newPreprocessor = function (name, functions) { + if (arguments.length === 1) { + functions = name; + name = null; + } + return this.createPreprocessor(name, functions).$new(); +}; + +// Tree Processor + +/** + * Create a tree processor + * @description this API is experimental and subject to change + * @memberof Extensions + */ +Extensions.createTreeProcessor = function (name, functions) { + if (arguments.length === 1) { + functions = name; + name = null; + } + return initializeProcessorClass('TreeProcessor', name, functions); +}; + +/** + * Create and instantiate a tree processor + * @description this API is experimental and subject to change + * @memberof Extensions + */ +Extensions.newTreeProcessor = function (name, functions) { + if (arguments.length === 1) { + functions = name; + name = null; + } + return this.createTreeProcessor(name, functions).$new(); +}; + +// Include Processor + +/** + * Create an include processor + * @description this API is experimental and subject to change + * @memberof Extensions + */ +Extensions.createIncludeProcessor = function (name, functions) { + if (arguments.length === 1) { + functions = name; + name = null; + } + return initializeProcessorClass('IncludeProcessor', name, functions); +}; + +/** + * Create and instantiate an include processor + * @description this API is experimental and subject to change + * @memberof Extensions + */ +Extensions.newIncludeProcessor = function (name, functions) { + if (arguments.length === 1) { + functions = name; + name = null; + } + return this.createIncludeProcessor(name, functions).$new(); +}; + +// Docinfo Processor + +/** + * Create a Docinfo processor + * @description this API is experimental and subject to change + * @memberof Extensions + */ +Extensions.createDocinfoProcessor = function (name, functions) { + if (arguments.length === 1) { + functions = name; + name = null; + } + return initializeProcessorClass('DocinfoProcessor', name, functions); +}; + +/** + * Create and instantiate a Docinfo processor + * @description this API is experimental and subject to change + * @memberof Extensions + */ +Extensions.newDocinfoProcessor = function (name, functions) { + if (arguments.length === 1) { + functions = name; + name = null; + } + return this.createDocinfoProcessor(name, functions).$new(); +}; + +// Block Processor + +/** + * Create a block processor + * @description this API is experimental and subject to change + * @memberof Extensions + */ +Extensions.createBlockProcessor = function (name, functions) { + if (arguments.length === 1) { + functions = name; + name = null; + } + return initializeProcessorClass('BlockProcessor', name, functions); +}; + +/** + * Create and instantiate a block processor + * @description this API is experimental and subject to change + * @memberof Extensions + */ +Extensions.newBlockProcessor = function (name, functions) { + if (arguments.length === 1) { + functions = name; + name = null; + } + return this.createBlockProcessor(name, functions).$new(); +}; + +// Inline Macro Processor + +/** + * Create an inline macro processor + * @description this API is experimental and subject to change + * @memberof Extensions + */ +Extensions.createInlineMacroProcessor = function (name, functions) { + if (arguments.length === 1) { + functions = name; + name = null; + } + return initializeProcessorClass('InlineMacroProcessor', name, functions); +}; + +/** + * Create and instantiate an inline macro processor + * @description this API is experimental and subject to change + * @memberof Extensions + */ +Extensions.newInlineMacroProcessor = function (name, functions) { + if (arguments.length === 1) { + functions = name; + name = null; + } + return this.createInlineMacroProcessor(name, functions).$new(); +}; + +// Block Macro Processor + +/** + * Create a block macro processor + * @description this API is experimental and subject to change + * @memberof Extensions + */ +Extensions.createBlockMacroProcessor = function (name, functions) { + if (arguments.length === 1) { + functions = name; + name = null; + } + return initializeProcessorClass('BlockMacroProcessor', name, functions); +}; + +/** + * Create and instantiate a block macro processor + * @description this API is experimental and subject to change + * @memberof Extensions + */ +Extensions.newBlockMacroProcessor = function (name, functions) { + if (arguments.length === 1) { + functions = name; + name = null; + } + return this.createBlockMacroProcessor(name, functions).$new(); +}; + +// Converter API + +/** + * @namespace + * @module Converter + */ +var Converter = Opal.const_get_qualified(Opal.Asciidoctor, 'Converter'); + +// Alias +Opal.Asciidoctor.Converter = Converter; + +/** + * Convert the specified node. + * + * @param {AbstractNode} node - the AbstractNode to convert + * @param {string} transform - an optional String transform that hints at + * which transformation should be applied to this node. + * @param {Object} opts - a JSON of options that provide additional hints about + * how to convert the node (default: {}) + * @returns the {Object} result of the conversion, typically a {string}. + * @memberof Converter + */ +Converter.prototype.convert = function (node, transform, opts) { + return this.$convert(node, transform, toHash(opts)); +}; + +// The built-in converter doesn't include Converter, so we have to force it +Converter.BuiltIn.prototype.convert = Converter.prototype.convert; + +// Converter Factory API + +/** + * @namespace + * @module Converter/Factory + */ +var ConverterFactory = Opal.Asciidoctor.Converter.Factory; + +// Alias +Opal.Asciidoctor.ConverterFactory = ConverterFactory; + +/** + * Register a custom converter in the global converter factory to handle conversion to the specified backends. + * If the backend value is an asterisk, the converter is used to handle any backend that does not have an explicit converter. + * + * @param converter - The Converter instance to register + * @param backends {Array} - A {string} {Array} of backend names that this converter should be registered to handle (optional, default: ['*']) + * @return {*} - Returns nothing + * @memberof Converter/Factory + */ +ConverterFactory.register = function (converter, backends) { + if (typeof converter === 'object' && typeof converter.$convert === 'undefined' && typeof converter.convert === 'function') { + Opal.def(converter, '$convert', converter.convert); + } + return this.$register(converter, backends); +}; + +/** + * Retrieves the singleton instance of the converter factory. + * + * @param {boolean} initialize - instantiate the singleton if it has not yet + * been instantiated. If this value is false and the singleton has not yet been + * instantiated, this method returns a fresh instance. + * @returns {Converter/Factory} an instance of the converter factory. + * @memberof Converter/Factory + */ +ConverterFactory.getDefault = function (initialize) { + return this.$default(initialize); +}; + +/** + * Create an instance of the converter bound to the specified backend. + * + * @param {string} backend - look for a converter bound to this keyword. + * @param {Object} opts - a JSON of options to pass to the converter (default: {}) + * @returns {Converter} - a converter instance for converting nodes in an Asciidoctor AST. + * @memberof Converter/Factory + */ +ConverterFactory.prototype.create = function (backend, opts) { + return this.$create(backend, toHash(opts)); +}; + +// Built-in converter + +/** + * @namespace + * @module Converter/Html5Converter + */ +var Html5Converter = Opal.Asciidoctor.Converter.Html5Converter; + +// Alias +Opal.Asciidoctor.Html5Converter = Html5Converter; + + +Html5Converter.prototype.convert = function (node, transform, opts) { + return this.$convert(node, transform, opts); +}; + + +var ASCIIDOCTOR_JS_VERSION = '1.5.9'; + + /** + * Get Asciidoctor.js version number. + * + * @memberof Asciidoctor + * @returns {string} - returns the version number of Asciidoctor.js. + */ + Asciidoctor.prototype.getVersion = function () { + return ASCIIDOCTOR_JS_VERSION; + }; + return Opal.Asciidoctor; +})); diff --git a/node_modules/asciidoctor.js/dist/css/asciidoctor.css b/node_modules/asciidoctor.js/dist/css/asciidoctor.css new file mode 100644 index 0000000..ed40aa4 --- /dev/null +++ b/node_modules/asciidoctor.js/dist/css/asciidoctor.css @@ -0,0 +1,420 @@ +/* Asciidoctor default stylesheet | MIT License | http://asciidoctor.org */ +/* Uncomment @import statement below to use as custom stylesheet */ +/*@import "https://fonts.googleapis.com/css?family=Open+Sans:300,300italic,400,400italic,600,600italic%7CNoto+Serif:400,400italic,700,700italic%7CDroid+Sans+Mono:400,700";*/ +article,aside,details,figcaption,figure,footer,header,hgroup,main,nav,section,summary{display:block} +audio,canvas,video{display:inline-block} +audio:not([controls]){display:none;height:0} +script{display:none!important} +html{font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%} +a{background:transparent} +a:focus{outline:thin dotted} +a:active,a:hover{outline:0} +h1{font-size:2em;margin:.67em 0} +abbr[title]{border-bottom:1px dotted} +b,strong{font-weight:bold} +dfn{font-style:italic} +hr{-moz-box-sizing:content-box;box-sizing:content-box;height:0} +mark{background:#ff0;color:#000} +code,kbd,pre,samp{font-family:monospace;font-size:1em} +pre{white-space:pre-wrap} +q{quotes:"\201C" "\201D" "\2018" "\2019"} +small{font-size:80%} +sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline} +sup{top:-.5em} +sub{bottom:-.25em} +img{border:0} +svg:not(:root){overflow:hidden} +figure{margin:0} +fieldset{border:1px solid silver;margin:0 2px;padding:.35em .625em .75em} +legend{border:0;padding:0} +button,input,select,textarea{font-family:inherit;font-size:100%;margin:0} +button,input{line-height:normal} +button,select{text-transform:none} +button,html input[type="button"],input[type="reset"],input[type="submit"]{-webkit-appearance:button;cursor:pointer} +button[disabled],html input[disabled]{cursor:default} +input[type="checkbox"],input[type="radio"]{box-sizing:border-box;padding:0} +button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0} +textarea{overflow:auto;vertical-align:top} +table{border-collapse:collapse;border-spacing:0} +*,*::before,*::after{-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box} +html,body{font-size:100%} +body{background:#fff;color:rgba(0,0,0,.8);padding:0;margin:0;font-family:"Noto Serif","DejaVu Serif",serif;font-weight:400;font-style:normal;line-height:1;position:relative;cursor:auto;tab-size:4;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased} +a:hover{cursor:pointer} +img,object,embed{max-width:100%;height:auto} +object,embed{height:100%} +img{-ms-interpolation-mode:bicubic} +.left{float:left!important} +.right{float:right!important} +.text-left{text-align:left!important} +.text-right{text-align:right!important} +.text-center{text-align:center!important} +.text-justify{text-align:justify!important} +.hide{display:none} +img,object,svg{display:inline-block;vertical-align:middle} +textarea{height:auto;min-height:50px} +select{width:100%} +.center{margin-left:auto;margin-right:auto} +.stretch{width:100%} +.subheader,.admonitionblock td.content>.title,.audioblock>.title,.exampleblock>.title,.imageblock>.title,.listingblock>.title,.literalblock>.title,.stemblock>.title,.openblock>.title,.paragraph>.title,.quoteblock>.title,table.tableblock>.title,.verseblock>.title,.videoblock>.title,.dlist>.title,.olist>.title,.ulist>.title,.qlist>.title,.hdlist>.title{line-height:1.45;color:#7a2518;font-weight:400;margin-top:0;margin-bottom:.25em} +div,dl,dt,dd,ul,ol,li,h1,h2,h3,#toctitle,.sidebarblock>.content>.title,h4,h5,h6,pre,form,p,blockquote,th,td{margin:0;padding:0;direction:ltr} +a{color:#2156a5;text-decoration:underline;line-height:inherit} +a:hover,a:focus{color:#1d4b8f} +a img{border:none} +p{font-family:inherit;font-weight:400;font-size:1em;line-height:1.6;margin-bottom:1.25em;text-rendering:optimizeLegibility} +p aside{font-size:.875em;line-height:1.35;font-style:italic} +h1,h2,h3,#toctitle,.sidebarblock>.content>.title,h4,h5,h6{font-family:"Open Sans","DejaVu Sans",sans-serif;font-weight:300;font-style:normal;color:#ba3925;text-rendering:optimizeLegibility;margin-top:1em;margin-bottom:.5em;line-height:1.0125em} +h1 small,h2 small,h3 small,#toctitle small,.sidebarblock>.content>.title small,h4 small,h5 small,h6 small{font-size:60%;color:#e99b8f;line-height:0} +h1{font-size:2.125em} +h2{font-size:1.6875em} +h3,#toctitle,.sidebarblock>.content>.title{font-size:1.375em} +h4,h5{font-size:1.125em} +h6{font-size:1em} +hr{border:solid #dddddf;border-width:1px 0 0;clear:both;margin:1.25em 0 1.1875em;height:0} +em,i{font-style:italic;line-height:inherit} +strong,b{font-weight:bold;line-height:inherit} +small{font-size:60%;line-height:inherit} +code{font-family:"Droid Sans Mono","DejaVu Sans Mono",monospace;font-weight:400;color:rgba(0,0,0,.9)} +ul,ol,dl{font-size:1em;line-height:1.6;margin-bottom:1.25em;list-style-position:outside;font-family:inherit} +ul,ol{margin-left:1.5em} +ul li ul,ul li ol{margin-left:1.25em;margin-bottom:0;font-size:1em} +ul.square li ul,ul.circle li ul,ul.disc li ul{list-style:inherit} +ul.square{list-style-type:square} +ul.circle{list-style-type:circle} +ul.disc{list-style-type:disc} +ol li ul,ol li ol{margin-left:1.25em;margin-bottom:0} +dl dt{margin-bottom:.3125em;font-weight:bold} +dl dd{margin-bottom:1.25em} +abbr,acronym{text-transform:uppercase;font-size:90%;color:rgba(0,0,0,.8);border-bottom:1px dotted #ddd;cursor:help} +abbr{text-transform:none} +blockquote{margin:0 0 1.25em;padding:.5625em 1.25em 0 1.1875em;border-left:1px solid #ddd} +blockquote cite{display:block;font-size:.9375em;color:rgba(0,0,0,.6)} +blockquote cite::before{content:"\2014 \0020"} +blockquote cite a,blockquote cite a:visited{color:rgba(0,0,0,.6)} +blockquote,blockquote p{line-height:1.6;color:rgba(0,0,0,.85)} +@media screen and (min-width:768px){h1,h2,h3,#toctitle,.sidebarblock>.content>.title,h4,h5,h6{line-height:1.2} +h1{font-size:2.75em} +h2{font-size:2.3125em} +h3,#toctitle,.sidebarblock>.content>.title{font-size:1.6875em} +h4{font-size:1.4375em}} +table{background:#fff;margin-bottom:1.25em;border:solid 1px #dedede} +table thead,table tfoot{background:#f7f8f7} +table thead tr th,table thead tr td,table tfoot tr th,table tfoot tr td{padding:.5em .625em .625em;font-size:inherit;color:rgba(0,0,0,.8);text-align:left} +table tr th,table tr td{padding:.5625em .625em;font-size:inherit;color:rgba(0,0,0,.8)} +table tr.even,table tr.alt,table tr:nth-of-type(even){background:#f8f8f7} +table thead tr th,table tfoot tr th,table tbody tr td,table tr td,table tfoot tr td{display:table-cell;line-height:1.6} +h1,h2,h3,#toctitle,.sidebarblock>.content>.title,h4,h5,h6{line-height:1.2;word-spacing:-.05em} +h1 strong,h2 strong,h3 strong,#toctitle strong,.sidebarblock>.content>.title strong,h4 strong,h5 strong,h6 strong{font-weight:400} +.clearfix::before,.clearfix::after,.float-group::before,.float-group::after{content:" ";display:table} +.clearfix::after,.float-group::after{clear:both} +*:not(pre)>code{font-size:.9375em;font-style:normal!important;letter-spacing:0;padding:.1em .5ex;word-spacing:-.15em;background-color:#f7f7f8;-webkit-border-radius:4px;border-radius:4px;line-height:1.45;text-rendering:optimizeSpeed;word-wrap:break-word} +*:not(pre)>code.nobreak{word-wrap:normal} +*:not(pre)>code.nowrap{white-space:nowrap} +pre,pre>code{line-height:1.45;color:rgba(0,0,0,.9);font-family:"Droid Sans Mono","DejaVu Sans Mono",monospace;font-weight:400;text-rendering:optimizeSpeed} +em em{font-style:normal} +strong strong{font-weight:400} +.keyseq{color:rgba(51,51,51,.8)} +kbd{font-family:"Droid Sans Mono","DejaVu Sans Mono",monospace;display:inline-block;color:rgba(0,0,0,.8);font-size:.65em;line-height:1.45;background-color:#f7f7f7;border:1px solid #ccc;-webkit-border-radius:3px;border-radius:3px;-webkit-box-shadow:0 1px 0 rgba(0,0,0,.2),0 0 0 .1em white inset;box-shadow:0 1px 0 rgba(0,0,0,.2),0 0 0 .1em #fff inset;margin:0 .15em;padding:.2em .5em;vertical-align:middle;position:relative;top:-.1em;white-space:nowrap} +.keyseq kbd:first-child{margin-left:0} +.keyseq kbd:last-child{margin-right:0} +.menuseq,.menuref{color:#000} +.menuseq b:not(.caret),.menuref{font-weight:inherit} +.menuseq{word-spacing:-.02em} +.menuseq b.caret{font-size:1.25em;line-height:.8} +.menuseq i.caret{font-weight:bold;text-align:center;width:.45em} +b.button::before,b.button::after{position:relative;top:-1px;font-weight:400} +b.button::before{content:"[";padding:0 3px 0 2px} +b.button::after{content:"]";padding:0 2px 0 3px} +p a>code:hover{color:rgba(0,0,0,.9)} +#header,#content,#footnotes,#footer{width:100%;margin-left:auto;margin-right:auto;margin-top:0;margin-bottom:0;max-width:62.5em;*zoom:1;position:relative;padding-left:.9375em;padding-right:.9375em} +#header::before,#header::after,#content::before,#content::after,#footnotes::before,#footnotes::after,#footer::before,#footer::after{content:" ";display:table} +#header::after,#content::after,#footnotes::after,#footer::after{clear:both} +#content{margin-top:1.25em} +#content::before{content:none} +#header>h1:first-child{color:rgba(0,0,0,.85);margin-top:2.25rem;margin-bottom:0} +#header>h1:first-child+#toc{margin-top:8px;border-top:1px solid #dddddf} +#header>h1:only-child,body.toc2 #header>h1:nth-last-child(2){border-bottom:1px solid #dddddf;padding-bottom:8px} +#header .details{border-bottom:1px solid #dddddf;line-height:1.45;padding-top:.25em;padding-bottom:.25em;padding-left:.25em;color:rgba(0,0,0,.6);display:-ms-flexbox;display:-webkit-flex;display:flex;-ms-flex-flow:row wrap;-webkit-flex-flow:row wrap;flex-flow:row wrap} +#header .details span:first-child{margin-left:-.125em} +#header .details span.email a{color:rgba(0,0,0,.85)} +#header .details br{display:none} +#header .details br+span::before{content:"\00a0\2013\00a0"} +#header .details br+span.author::before{content:"\00a0\22c5\00a0";color:rgba(0,0,0,.85)} +#header .details br+span#revremark::before{content:"\00a0|\00a0"} +#header #revnumber{text-transform:capitalize} +#header #revnumber::after{content:"\00a0"} +#content>h1:first-child:not([class]){color:rgba(0,0,0,.85);border-bottom:1px solid #dddddf;padding-bottom:8px;margin-top:0;padding-top:1rem;margin-bottom:1.25rem} +#toc{border-bottom:1px solid #e7e7e9;padding-bottom:.5em} +#toc>ul{margin-left:.125em} +#toc ul.sectlevel0>li>a{font-style:italic} +#toc ul.sectlevel0 ul.sectlevel1{margin:.5em 0} +#toc ul{font-family:"Open Sans","DejaVu Sans",sans-serif;list-style-type:none} +#toc li{line-height:1.3334;margin-top:.3334em} +#toc a{text-decoration:none} +#toc a:active{text-decoration:underline} +#toctitle{color:#7a2518;font-size:1.2em} +@media screen and (min-width:768px){#toctitle{font-size:1.375em} +body.toc2{padding-left:15em;padding-right:0} +#toc.toc2{margin-top:0!important;background-color:#f8f8f7;position:fixed;width:15em;left:0;top:0;border-right:1px solid #e7e7e9;border-top-width:0!important;border-bottom-width:0!important;z-index:1000;padding:1.25em 1em;height:100%;overflow:auto} +#toc.toc2 #toctitle{margin-top:0;margin-bottom:.8rem;font-size:1.2em} +#toc.toc2>ul{font-size:.9em;margin-bottom:0} +#toc.toc2 ul ul{margin-left:0;padding-left:1em} +#toc.toc2 ul.sectlevel0 ul.sectlevel1{padding-left:0;margin-top:.5em;margin-bottom:.5em} +body.toc2.toc-right{padding-left:0;padding-right:15em} +body.toc2.toc-right #toc.toc2{border-right-width:0;border-left:1px solid #e7e7e9;left:auto;right:0}} +@media screen and (min-width:1280px){body.toc2{padding-left:20em;padding-right:0} +#toc.toc2{width:20em} +#toc.toc2 #toctitle{font-size:1.375em} +#toc.toc2>ul{font-size:.95em} +#toc.toc2 ul ul{padding-left:1.25em} +body.toc2.toc-right{padding-left:0;padding-right:20em}} +#content #toc{border-style:solid;border-width:1px;border-color:#e0e0dc;margin-bottom:1.25em;padding:1.25em;background:#f8f8f7;-webkit-border-radius:4px;border-radius:4px} +#content #toc>:first-child{margin-top:0} +#content #toc>:last-child{margin-bottom:0} +#footer{max-width:100%;background-color:rgba(0,0,0,.8);padding:1.25em} +#footer-text{color:rgba(255,255,255,.8);line-height:1.44} +#content{margin-bottom:.625em} +.sect1{padding-bottom:.625em} +@media screen and (min-width:768px){#content{margin-bottom:1.25em} +.sect1{padding-bottom:1.25em}} +.sect1:last-child{padding-bottom:0} +.sect1+.sect1{border-top:1px solid #e7e7e9} +#content h1>a.anchor,h2>a.anchor,h3>a.anchor,#toctitle>a.anchor,.sidebarblock>.content>.title>a.anchor,h4>a.anchor,h5>a.anchor,h6>a.anchor{position:absolute;z-index:1001;width:1.5ex;margin-left:-1.5ex;display:block;text-decoration:none!important;visibility:hidden;text-align:center;font-weight:400} +#content h1>a.anchor::before,h2>a.anchor::before,h3>a.anchor::before,#toctitle>a.anchor::before,.sidebarblock>.content>.title>a.anchor::before,h4>a.anchor::before,h5>a.anchor::before,h6>a.anchor::before{content:"\00A7";font-size:.85em;display:block;padding-top:.1em} +#content h1:hover>a.anchor,#content h1>a.anchor:hover,h2:hover>a.anchor,h2>a.anchor:hover,h3:hover>a.anchor,#toctitle:hover>a.anchor,.sidebarblock>.content>.title:hover>a.anchor,h3>a.anchor:hover,#toctitle>a.anchor:hover,.sidebarblock>.content>.title>a.anchor:hover,h4:hover>a.anchor,h4>a.anchor:hover,h5:hover>a.anchor,h5>a.anchor:hover,h6:hover>a.anchor,h6>a.anchor:hover{visibility:visible} +#content h1>a.link,h2>a.link,h3>a.link,#toctitle>a.link,.sidebarblock>.content>.title>a.link,h4>a.link,h5>a.link,h6>a.link{color:#ba3925;text-decoration:none} +#content h1>a.link:hover,h2>a.link:hover,h3>a.link:hover,#toctitle>a.link:hover,.sidebarblock>.content>.title>a.link:hover,h4>a.link:hover,h5>a.link:hover,h6>a.link:hover{color:#a53221} +.audioblock,.imageblock,.literalblock,.listingblock,.stemblock,.videoblock{margin-bottom:1.25em} +.admonitionblock td.content>.title,.audioblock>.title,.exampleblock>.title,.imageblock>.title,.listingblock>.title,.literalblock>.title,.stemblock>.title,.openblock>.title,.paragraph>.title,.quoteblock>.title,table.tableblock>.title,.verseblock>.title,.videoblock>.title,.dlist>.title,.olist>.title,.ulist>.title,.qlist>.title,.hdlist>.title{text-rendering:optimizeLegibility;text-align:left;font-family:"Noto Serif","DejaVu Serif",serif;font-size:1rem;font-style:italic} +table.tableblock.fit-content>caption.title{white-space:nowrap;width:0} +.paragraph.lead>p,#preamble>.sectionbody>[class="paragraph"]:first-of-type p{font-size:1.21875em;line-height:1.6;color:rgba(0,0,0,.85)} +table.tableblock #preamble>.sectionbody>[class="paragraph"]:first-of-type p{font-size:inherit} +.admonitionblock>table{border-collapse:separate;border:0;background:none;width:100%} +.admonitionblock>table td.icon{text-align:center;width:80px} +.admonitionblock>table td.icon img{max-width:none} +.admonitionblock>table td.icon .title{font-weight:bold;font-family:"Open Sans","DejaVu Sans",sans-serif;text-transform:uppercase} +.admonitionblock>table td.content{padding-left:1.125em;padding-right:1.25em;border-left:1px solid #dddddf;color:rgba(0,0,0,.6)} +.admonitionblock>table td.content>:last-child>:last-child{margin-bottom:0} +.exampleblock>.content{border-style:solid;border-width:1px;border-color:#e6e6e6;margin-bottom:1.25em;padding:1.25em;background:#fff;-webkit-border-radius:4px;border-radius:4px} +.exampleblock>.content>:first-child{margin-top:0} +.exampleblock>.content>:last-child{margin-bottom:0} +.sidebarblock{border-style:solid;border-width:1px;border-color:#e0e0dc;margin-bottom:1.25em;padding:1.25em;background:#f8f8f7;-webkit-border-radius:4px;border-radius:4px} +.sidebarblock>:first-child{margin-top:0} +.sidebarblock>:last-child{margin-bottom:0} +.sidebarblock>.content>.title{color:#7a2518;margin-top:0;text-align:center} +.exampleblock>.content>:last-child>:last-child,.exampleblock>.content .olist>ol>li:last-child>:last-child,.exampleblock>.content .ulist>ul>li:last-child>:last-child,.exampleblock>.content .qlist>ol>li:last-child>:last-child,.sidebarblock>.content>:last-child>:last-child,.sidebarblock>.content .olist>ol>li:last-child>:last-child,.sidebarblock>.content .ulist>ul>li:last-child>:last-child,.sidebarblock>.content .qlist>ol>li:last-child>:last-child{margin-bottom:0} +.literalblock pre,.listingblock pre:not(.highlight),.listingblock pre[class="highlight"],.listingblock pre[class^="highlight "],.listingblock pre.CodeRay,.listingblock pre.prettyprint{background:#f7f7f8} +.sidebarblock .literalblock pre,.sidebarblock .listingblock pre:not(.highlight),.sidebarblock .listingblock pre[class="highlight"],.sidebarblock .listingblock pre[class^="highlight "],.sidebarblock .listingblock pre.CodeRay,.sidebarblock .listingblock pre.prettyprint{background:#f2f1f1} +.literalblock pre,.literalblock pre[class],.listingblock pre,.listingblock pre[class]{-webkit-border-radius:4px;border-radius:4px;word-wrap:break-word;overflow-x:auto;padding:1em;font-size:.8125em} +@media screen and (min-width:768px){.literalblock pre,.literalblock pre[class],.listingblock pre,.listingblock pre[class]{font-size:.90625em}} +@media screen and (min-width:1280px){.literalblock pre,.literalblock pre[class],.listingblock pre,.listingblock pre[class]{font-size:1em}} +.literalblock pre.nowrap,.literalblock pre.nowrap pre,.listingblock pre.nowrap,.listingblock pre.nowrap pre{white-space:pre;word-wrap:normal} +.literalblock.output pre{color:#f7f7f8;background-color:rgba(0,0,0,.9)} +.listingblock pre.highlightjs{padding:0} +.listingblock pre.highlightjs>code{padding:1em;-webkit-border-radius:4px;border-radius:4px} +.listingblock pre.prettyprint{border-width:0} +.listingblock>.content{position:relative} +.listingblock code[data-lang]::before{display:none;content:attr(data-lang);position:absolute;font-size:.75em;top:.425rem;right:.5rem;line-height:1;text-transform:uppercase;color:#999} +.listingblock:hover code[data-lang]::before{display:block} +.listingblock.terminal pre .command::before{content:attr(data-prompt);padding-right:.5em;color:#999} +.listingblock.terminal pre .command:not([data-prompt])::before{content:"$"} +table.pyhltable{border-collapse:separate;border:0;margin-bottom:0;background:none} +table.pyhltable td{vertical-align:top;padding-top:0;padding-bottom:0;line-height:1.45} +table.pyhltable td.code{padding-left:.75em;padding-right:0} +pre.pygments .lineno,table.pyhltable td:not(.code){color:#999;padding-left:0;padding-right:.5em;border-right:1px solid #dddddf} +pre.pygments .lineno{display:inline-block;margin-right:.25em} +table.pyhltable .linenodiv{background:none!important;padding-right:0!important} +.quoteblock{margin:0 1em 1.25em 1.5em;display:table} +.quoteblock>.title{margin-left:-1.5em;margin-bottom:.75em} +.quoteblock blockquote,.quoteblock p{color:rgba(0,0,0,.85);font-size:1.15rem;line-height:1.75;word-spacing:.1em;letter-spacing:0;font-style:italic;text-align:justify} +.quoteblock blockquote{margin:0;padding:0;border:0} +.quoteblock blockquote::before{content:"\201c";float:left;font-size:2.75em;font-weight:bold;line-height:.6em;margin-left:-.6em;color:#7a2518;text-shadow:0 1px 2px rgba(0,0,0,.1)} +.quoteblock blockquote>.paragraph:last-child p{margin-bottom:0} +.quoteblock .attribution{margin-top:.75em;margin-right:.5ex;text-align:right} +.verseblock{margin:0 1em 1.25em} +.verseblock pre{font-family:"Open Sans","DejaVu Sans",sans;font-size:1.15rem;color:rgba(0,0,0,.85);font-weight:300;text-rendering:optimizeLegibility} +.verseblock pre strong{font-weight:400} +.verseblock .attribution{margin-top:1.25rem;margin-left:.5ex} +.quoteblock .attribution,.verseblock .attribution{font-size:.9375em;line-height:1.45;font-style:italic} +.quoteblock .attribution br,.verseblock .attribution br{display:none} +.quoteblock .attribution cite,.verseblock .attribution cite{display:block;letter-spacing:-.025em;color:rgba(0,0,0,.6)} +.quoteblock.abstract blockquote::before,.quoteblock.excerpt blockquote::before,.quoteblock .quoteblock blockquote::before{display:none} +.quoteblock.abstract blockquote,.quoteblock.abstract p,.quoteblock.excerpt blockquote,.quoteblock.excerpt p,.quoteblock .quoteblock blockquote,.quoteblock .quoteblock p{line-height:1.6;word-spacing:0} +.quoteblock.abstract{margin:0 1em 1.25em;display:block} +.quoteblock.abstract>.title{margin:0 0 .375em;font-size:1.15em;text-align:center} +.quoteblock.excerpt,.quoteblock .quoteblock{margin:0 0 1.25em;padding:0 0 .25em 1em;border-left:.25em solid #dddddf} +.quoteblock.excerpt blockquote,.quoteblock.excerpt p,.quoteblock .quoteblock blockquote,.quoteblock .quoteblock p{color:inherit;font-size:1.0625rem} +.quoteblock.excerpt .attribution,.quoteblock .quoteblock .attribution{color:inherit;text-align:left;margin-right:0} +table.tableblock{max-width:100%;border-collapse:separate} +p.tableblock:last-child{margin-bottom:0} +td.tableblock>.content{margin-bottom:-1.25em} +table.tableblock,th.tableblock,td.tableblock{border:0 solid #dedede} +table.grid-all>thead>tr>.tableblock,table.grid-all>tbody>tr>.tableblock{border-width:0 1px 1px 0} +table.grid-all>tfoot>tr>.tableblock{border-width:1px 1px 0 0} +table.grid-cols>*>tr>.tableblock{border-width:0 1px 0 0} +table.grid-rows>thead>tr>.tableblock,table.grid-rows>tbody>tr>.tableblock{border-width:0 0 1px} +table.grid-rows>tfoot>tr>.tableblock{border-width:1px 0 0} +table.grid-all>*>tr>.tableblock:last-child,table.grid-cols>*>tr>.tableblock:last-child{border-right-width:0} +table.grid-all>tbody>tr:last-child>.tableblock,table.grid-all>thead:last-child>tr>.tableblock,table.grid-rows>tbody>tr:last-child>.tableblock,table.grid-rows>thead:last-child>tr>.tableblock{border-bottom-width:0} +table.frame-all{border-width:1px} +table.frame-sides{border-width:0 1px} +table.frame-topbot,table.frame-ends{border-width:1px 0} +table.stripes-all tr,table.stripes-odd tr:nth-of-type(odd){background:#f8f8f7} +table.stripes-none tr,table.stripes-odd tr:nth-of-type(even){background:none} +th.halign-left,td.halign-left{text-align:left} +th.halign-right,td.halign-right{text-align:right} +th.halign-center,td.halign-center{text-align:center} +th.valign-top,td.valign-top{vertical-align:top} +th.valign-bottom,td.valign-bottom{vertical-align:bottom} +th.valign-middle,td.valign-middle{vertical-align:middle} +table thead th,table tfoot th{font-weight:bold} +tbody tr th{display:table-cell;line-height:1.6;background:#f7f8f7} +tbody tr th,tbody tr th p,tfoot tr th,tfoot tr th p{color:rgba(0,0,0,.8);font-weight:bold} +p.tableblock>code:only-child{background:none;padding:0} +p.tableblock{font-size:1em} +td>div.verse{white-space:pre} +ol{margin-left:1.75em} +ul li ol{margin-left:1.5em} +dl dd{margin-left:1.125em} +dl dd:last-child,dl dd:last-child>:last-child{margin-bottom:0} +ol>li p,ul>li p,ul dd,ol dd,.olist .olist,.ulist .ulist,.ulist .olist,.olist .ulist{margin-bottom:.625em} +ul.checklist,ul.none,ol.none,ul.no-bullet,ol.no-bullet,ol.unnumbered,ul.unstyled,ol.unstyled{list-style-type:none} +ul.no-bullet,ol.no-bullet,ol.unnumbered{margin-left:.625em} +ul.unstyled,ol.unstyled{margin-left:0} +ul.checklist{margin-left:.625em} +ul.checklist li>p:first-child>.fa-square-o:first-child,ul.checklist li>p:first-child>.fa-check-square-o:first-child{width:1.25em;font-size:.8em;position:relative;bottom:.125em} +ul.checklist li>p:first-child>input[type="checkbox"]:first-child{margin-right:.25em} +ul.inline{display:-ms-flexbox;display:-webkit-box;display:flex;-ms-flex-flow:row wrap;-webkit-flex-flow:row wrap;flex-flow:row wrap;list-style:none;margin:0 0 .625em -1.25em} +ul.inline>li{margin-left:1.25em} +.unstyled dl dt{font-weight:400;font-style:normal} +ol.arabic{list-style-type:decimal} +ol.decimal{list-style-type:decimal-leading-zero} +ol.loweralpha{list-style-type:lower-alpha} +ol.upperalpha{list-style-type:upper-alpha} +ol.lowerroman{list-style-type:lower-roman} +ol.upperroman{list-style-type:upper-roman} +ol.lowergreek{list-style-type:lower-greek} +.hdlist>table,.colist>table{border:0;background:none} +.hdlist>table>tbody>tr,.colist>table>tbody>tr{background:none} +td.hdlist1,td.hdlist2{vertical-align:top;padding:0 .625em} +td.hdlist1{font-weight:bold;padding-bottom:1.25em} +.literalblock+.colist,.listingblock+.colist{margin-top:-.5em} +.colist td:not([class]):first-child{padding:.4em .75em 0;line-height:1;vertical-align:top} +.colist td:not([class]):first-child img{max-width:none} +.colist td:not([class]):last-child{padding:.25em 0} +.thumb,.th{line-height:0;display:inline-block;border:solid 4px #fff;-webkit-box-shadow:0 0 0 1px #ddd;box-shadow:0 0 0 1px #ddd} +.imageblock.left{margin:.25em .625em 1.25em 0} +.imageblock.right{margin:.25em 0 1.25em .625em} +.imageblock>.title{margin-bottom:0} +.imageblock.thumb,.imageblock.th{border-width:6px} +.imageblock.thumb>.title,.imageblock.th>.title{padding:0 .125em} +.image.left,.image.right{margin-top:.25em;margin-bottom:.25em;display:inline-block;line-height:0} +.image.left{margin-right:.625em} +.image.right{margin-left:.625em} +a.image{text-decoration:none;display:inline-block} +a.image object{pointer-events:none} +sup.footnote,sup.footnoteref{font-size:.875em;position:static;vertical-align:super} +sup.footnote a,sup.footnoteref a{text-decoration:none} +sup.footnote a:active,sup.footnoteref a:active{text-decoration:underline} +#footnotes{padding-top:.75em;padding-bottom:.75em;margin-bottom:.625em} +#footnotes hr{width:20%;min-width:6.25em;margin:-.25em 0 .75em;border-width:1px 0 0} +#footnotes .footnote{padding:0 .375em 0 .225em;line-height:1.3334;font-size:.875em;margin-left:1.2em;margin-bottom:.2em} +#footnotes .footnote a:first-of-type{font-weight:bold;text-decoration:none;margin-left:-1.05em} +#footnotes .footnote:last-of-type{margin-bottom:0} +#content #footnotes{margin-top:-.625em;margin-bottom:0;padding:.75em 0} +.gist .file-data>table{border:0;background:#fff;width:100%;margin-bottom:0} +.gist .file-data>table td.line-data{width:99%} +div.unbreakable{page-break-inside:avoid} +.big{font-size:larger} +.small{font-size:smaller} +.underline{text-decoration:underline} +.overline{text-decoration:overline} +.line-through{text-decoration:line-through} +.aqua{color:#00bfbf} +.aqua-background{background-color:#00fafa} +.black{color:#000} +.black-background{background-color:#000} +.blue{color:#0000bf} +.blue-background{background-color:#0000fa} +.fuchsia{color:#bf00bf} +.fuchsia-background{background-color:#fa00fa} +.gray{color:#606060} +.gray-background{background-color:#7d7d7d} +.green{color:#006000} +.green-background{background-color:#007d00} +.lime{color:#00bf00} +.lime-background{background-color:#00fa00} +.maroon{color:#600000} +.maroon-background{background-color:#7d0000} +.navy{color:#000060} +.navy-background{background-color:#00007d} +.olive{color:#606000} +.olive-background{background-color:#7d7d00} +.purple{color:#600060} +.purple-background{background-color:#7d007d} +.red{color:#bf0000} +.red-background{background-color:#fa0000} +.silver{color:#909090} +.silver-background{background-color:#bcbcbc} +.teal{color:#006060} +.teal-background{background-color:#007d7d} +.white{color:#bfbfbf} +.white-background{background-color:#fafafa} +.yellow{color:#bfbf00} +.yellow-background{background-color:#fafa00} +span.icon>.fa{cursor:default} +a span.icon>.fa{cursor:inherit} +.admonitionblock td.icon [class^="fa icon-"]{font-size:2.5em;text-shadow:1px 1px 2px rgba(0,0,0,.5);cursor:default} +.admonitionblock td.icon .icon-note::before{content:"\f05a";color:#19407c} +.admonitionblock td.icon .icon-tip::before{content:"\f0eb";text-shadow:1px 1px 2px rgba(155,155,0,.8);color:#111} +.admonitionblock td.icon .icon-warning::before{content:"\f071";color:#bf6900} +.admonitionblock td.icon .icon-caution::before{content:"\f06d";color:#bf3400} +.admonitionblock td.icon .icon-important::before{content:"\f06a";color:#bf0000} +.conum[data-value]{display:inline-block;color:#fff!important;background-color:rgba(0,0,0,.8);-webkit-border-radius:100px;border-radius:100px;text-align:center;font-size:.75em;width:1.67em;height:1.67em;line-height:1.67em;font-family:"Open Sans","DejaVu Sans",sans-serif;font-style:normal;font-weight:bold} +.conum[data-value] *{color:#fff!important} +.conum[data-value]+b{display:none} +.conum[data-value]::after{content:attr(data-value)} +pre .conum[data-value]{position:relative;top:-.125em} +b.conum *{color:inherit!important} +.conum:not([data-value]):empty{display:none} +dt,th.tableblock,td.content,div.footnote{text-rendering:optimizeLegibility} +h1,h2,p,td.content,span.alt{letter-spacing:-.01em} +p strong,td.content strong,div.footnote strong{letter-spacing:-.005em} +p,blockquote,dt,td.content,span.alt{font-size:1.0625rem} +p{margin-bottom:1.25rem} +.sidebarblock p,.sidebarblock dt,.sidebarblock td.content,p.tableblock{font-size:1em} +.exampleblock>.content{background-color:#fffef7;border-color:#e0e0dc;-webkit-box-shadow:0 1px 4px #e0e0dc;box-shadow:0 1px 4px #e0e0dc} +.print-only{display:none!important} +@page{margin:1.25cm .75cm} +@media print{*{-webkit-box-shadow:none!important;box-shadow:none!important;text-shadow:none!important} +html{font-size:80%} +a{color:inherit!important;text-decoration:underline!important} +a.bare,a[href^="#"],a[href^="mailto:"]{text-decoration:none!important} +a[href^="http:"]:not(.bare)::after,a[href^="https:"]:not(.bare)::after{content:"(" attr(href) ")";display:inline-block;font-size:.875em;padding-left:.25em} +abbr[title]::after{content:" (" attr(title) ")"} +pre,blockquote,tr,img,object,svg{page-break-inside:avoid} +thead{display:table-header-group} +svg{max-width:100%} +p,blockquote,dt,td.content{font-size:1em;orphans:3;widows:3} +h2,h3,#toctitle,.sidebarblock>.content>.title{page-break-after:avoid} +#toc,.sidebarblock,.exampleblock>.content{background:none!important} +#toc{border-bottom:1px solid #dddddf!important;padding-bottom:0!important} +body.book #header{text-align:center} +body.book #header>h1:first-child{border:0!important;margin:2.5em 0 1em} +body.book #header .details{border:0!important;display:block;padding:0!important} +body.book #header .details span:first-child{margin-left:0!important} +body.book #header .details br{display:block} +body.book #header .details br+span::before{content:none!important} +body.book #toc{border:0!important;text-align:left!important;padding:0!important;margin:0!important} +body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-break-before:always} +.listingblock code[data-lang]::before{display:block} +#footer{padding:0 .9375em} +.hide-on-print{display:none!important} +.print-only{display:block!important} +.hide-for-print{display:none!important} +.show-for-print{display:inherit!important}} +@media print,amzn-kf8{#header>h1:first-child{margin-top:1.25rem} +.sect1{padding:0!important} +.sect1+.sect1{border:0} +#footer{background:none} +#footer-text{color:rgba(0,0,0,.6);font-size:.9em}} +@media amzn-kf8{#header,#content,#footnotes,#footer{padding:0}} diff --git a/node_modules/asciidoctor.js/dist/graalvm/asciidoctor.js b/node_modules/asciidoctor.js/dist/graalvm/asciidoctor.js new file mode 100644 index 0000000..6f3ce1b --- /dev/null +++ b/node_modules/asciidoctor.js/dist/graalvm/asciidoctor.js @@ -0,0 +1,46069 @@ +/* eslint-disable indent */ +if (typeof Opal === 'undefined' && typeof module === 'object' && module.exports) { + Opal = require('opal-runtime').Opal; +} + +if (typeof Opal === 'undefined') { + // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects#Fundamental_objects + var fundamentalObjects = [ + Function, + Boolean, + Error, + Number, + Date, + String, + RegExp, + Array + ]; + var backup = {}; + for (var index in fundamentalObjects) { + var fundamentalObject = fundamentalObjects[index]; + backup[fundamentalObject.name] = { + call: fundamentalObject.call, + apply: fundamentalObject.apply, + bind: fundamentalObject.bind + }; + } + +(function(undefined) { + // @note + // A few conventions for the documentation of this file: + // 1. Always use "//" (in contrast with "/**/") + // 2. The syntax used is Yardoc (yardoc.org), which is intended for Ruby (se below) + // 3. `@param` and `@return` types should be preceded by `JS.` when referring to + // JavaScript constructors (e.g. `JS.Function`) otherwise Ruby is assumed. + // 4. `nil` and `null` being unambiguous refer to the respective + // objects/values in Ruby and JavaScript + // 5. This is still WIP :) so please give feedback and suggestions on how + // to improve or for alternative solutions + // + // The way the code is digested before going through Yardoc is a secret kept + // in the docs repo (https://github.com/opal/docs/tree/master). + + var global_object = this, console; + + // Detect the global object + if (typeof(global) !== 'undefined') { global_object = global; } + if (typeof(window) !== 'undefined') { global_object = window; } + + // Setup a dummy console object if missing + if (typeof(global_object.console) === 'object') { + console = global_object.console; + } else if (global_object.console == null) { + console = global_object.console = {}; + } else { + console = {}; + } + + if (!('log' in console)) { console.log = function () {}; } + if (!('warn' in console)) { console.warn = console.log; } + + if (typeof(this.Opal) !== 'undefined') { + console.warn('Opal already loaded. Loading twice can cause troubles, please fix your setup.'); + return this.Opal; + } + + var nil; + + // The actual class for BasicObject + var BasicObject; + + // The actual Object class. + // The leading underscore is to avoid confusion with window.Object() + var _Object; + + // The actual Module class + var Module; + + // The actual Class class + var Class; + + // The Opal object that is exposed globally + var Opal = this.Opal = {}; + + // This is a useful reference to global object inside ruby files + Opal.global = global_object; + global_object.Opal = Opal; + + // Configure runtime behavior with regards to require and unsupported fearures + Opal.config = { + missing_require_severity: 'error', // error, warning, ignore + unsupported_features_severity: 'warning', // error, warning, ignore + enable_stack_trace: true // true, false + } + + // Minify common function calls + var $hasOwn = Object.hasOwnProperty; + var $bind = Function.prototype.bind; + var $setPrototype = Object.setPrototypeOf; + var $slice = Array.prototype.slice; + + // Nil object id is always 4 + var nil_id = 4; + + // Generates even sequential numbers greater than 4 + // (nil_id) to serve as unique ids for ruby objects + var unique_id = nil_id; + + // Return next unique id + Opal.uid = function() { + unique_id += 2; + return unique_id; + }; + + // Retrieve or assign the id of an object + Opal.id = function(obj) { + if (obj.$$is_number) return (obj * 2)+1; + if (obj.$$id != null) { + return obj.$$id; + }; + $defineProperty(obj, '$$id', Opal.uid()); + return obj.$$id; + }; + + // Globals table + Opal.gvars = {}; + + // Exit function, this should be replaced by platform specific implementation + // (See nodejs and chrome for examples) + Opal.exit = function(status) { if (Opal.gvars.DEBUG) console.log('Exited with status '+status); }; + + // keeps track of exceptions for $! + Opal.exceptions = []; + + // @private + // Pops an exception from the stack and updates `$!`. + Opal.pop_exception = function() { + Opal.gvars["!"] = Opal.exceptions.pop() || nil; + } + + // Inspect any kind of object, including non Ruby ones + Opal.inspect = function(obj) { + if (obj === undefined) { + return "undefined"; + } + else if (obj === null) { + return "null"; + } + else if (!obj.$$class) { + return obj.toString(); + } + else { + return obj.$inspect(); + } + } + + function $defineProperty(object, name, initialValue) { + if (typeof(object) === "string") { + // Special case for: + // s = "string" + // def s.m; end + // String class is the only class that: + // + compiles to JS primitive + // + allows method definition directly on instances + // numbers, true, false and nil do not support it. + object[name] = initialValue; + } else { + Object.defineProperty(object, name, { + value: initialValue, + enumerable: false, + configurable: true, + writable: true + }); + } + } + + Opal.defineProperty = $defineProperty; + + Opal.slice = $slice; + + + // Truth + // ----- + + Opal.truthy = function(val) { + return (val !== nil && val != null && (!val.$$is_boolean || val == true)); + }; + + Opal.falsy = function(val) { + return (val === nil || val == null || (val.$$is_boolean && val == false)) + }; + + + // Constants + // --------- + // + // For future reference: + // - The Rails autoloading guide (http://guides.rubyonrails.org/v5.0/autoloading_and_reloading_constants.html) + // - @ConradIrwin's 2012 post on “Everything you ever wanted to know about constant lookup in Ruby” (http://cirw.in/blog/constant-lookup.html) + // + // Legend of MRI concepts/names: + // - constant reference (cref): the module/class that acts as a namespace + // - nesting: the namespaces wrapping the current scope, e.g. nesting inside + // `module A; module B::C; end; end` is `[B::C, A]` + + // Get the constant in the scope of the current cref + function const_get_name(cref, name) { + if (cref) return cref.$$const[name]; + } + + // Walk up the nesting array looking for the constant + function const_lookup_nesting(nesting, name) { + var i, ii, result, constant; + + if (nesting.length === 0) return; + + // If the nesting is not empty the constant is looked up in its elements + // and in order. The ancestors of those elements are ignored. + for (i = 0, ii = nesting.length; i < ii; i++) { + constant = nesting[i].$$const[name]; + if (constant != null) return constant; + } + } + + // Walk up the ancestors chain looking for the constant + function const_lookup_ancestors(cref, name) { + var i, ii, result, ancestors; + + if (cref == null) return; + + ancestors = Opal.ancestors(cref); + + for (i = 0, ii = ancestors.length; i < ii; i++) { + if (ancestors[i].$$const && $hasOwn.call(ancestors[i].$$const, name)) { + return ancestors[i].$$const[name]; + } + } + } + + // Walk up Object's ancestors chain looking for the constant, + // but only if cref is missing or a module. + function const_lookup_Object(cref, name) { + if (cref == null || cref.$$is_module) { + return const_lookup_ancestors(_Object, name); + } + } + + // Call const_missing if nothing else worked + function const_missing(cref, name, skip_missing) { + if (!skip_missing) { + return (cref || _Object).$const_missing(name); + } + } + + // Look for the constant just in the current cref or call `#const_missing` + Opal.const_get_local = function(cref, name, skip_missing) { + var result; + + if (cref == null) return; + + if (cref === '::') cref = _Object; + + if (!cref.$$is_module && !cref.$$is_class) { + throw new Opal.TypeError(cref.toString() + " is not a class/module"); + } + + result = const_get_name(cref, name); if (result != null) return result; + result = const_missing(cref, name, skip_missing); if (result != null) return result; + } + + // Look for the constant relative to a cref or call `#const_missing` (when the + // constant is prefixed by `::`). + Opal.const_get_qualified = function(cref, name, skip_missing) { + var result, cache, cached, current_version = Opal.const_cache_version; + + if (cref == null) return; + + if (cref === '::') cref = _Object; + + if (!cref.$$is_module && !cref.$$is_class) { + throw new Opal.TypeError(cref.toString() + " is not a class/module"); + } + + if ((cache = cref.$$const_cache) == null) { + $defineProperty(cref, '$$const_cache', Object.create(null)); + cache = cref.$$const_cache; + } + cached = cache[name]; + + if (cached == null || cached[0] !== current_version) { + ((result = const_get_name(cref, name)) != null) || + ((result = const_lookup_ancestors(cref, name)) != null); + cache[name] = [current_version, result]; + } else { + result = cached[1]; + } + + return result != null ? result : const_missing(cref, name, skip_missing); + }; + + // Initialize the top level constant cache generation counter + Opal.const_cache_version = 1; + + // Look for the constant in the open using the current nesting and the nearest + // cref ancestors or call `#const_missing` (when the constant has no :: prefix). + Opal.const_get_relative = function(nesting, name, skip_missing) { + var cref = nesting[0], result, current_version = Opal.const_cache_version, cache, cached; + + if ((cache = nesting.$$const_cache) == null) { + $defineProperty(nesting, '$$const_cache', Object.create(null)); + cache = nesting.$$const_cache; + } + cached = cache[name]; + + if (cached == null || cached[0] !== current_version) { + ((result = const_get_name(cref, name)) != null) || + ((result = const_lookup_nesting(nesting, name)) != null) || + ((result = const_lookup_ancestors(cref, name)) != null) || + ((result = const_lookup_Object(cref, name)) != null); + + cache[name] = [current_version, result]; + } else { + result = cached[1]; + } + + return result != null ? result : const_missing(cref, name, skip_missing); + }; + + // Register the constant on a cref and opportunistically set the name of + // unnamed classes/modules. + Opal.const_set = function(cref, name, value) { + if (cref == null || cref === '::') cref = _Object; + + if (value.$$is_a_module) { + if (value.$$name == null || value.$$name === nil) value.$$name = name; + if (value.$$base_module == null) value.$$base_module = cref; + } + + cref.$$const = (cref.$$const || Object.create(null)); + cref.$$const[name] = value; + + // Add a short helper to navigate constants manually. + // @example + // Opal.$$.Regexp.$$.IGNORECASE + cref.$$ = cref.$$const; + + Opal.const_cache_version++; + + // Expose top level constants onto the Opal object + if (cref === _Object) Opal[name] = value; + + // Name new class directly onto current scope (Opal.Foo.Baz = klass) + $defineProperty(cref, name, value); + + return value; + }; + + // Get all the constants reachable from a given cref, by default will include + // inherited constants. + Opal.constants = function(cref, inherit) { + if (inherit == null) inherit = true; + + var module, modules = [cref], module_constants, i, ii, constants = {}, constant; + + if (inherit) modules = modules.concat(Opal.ancestors(cref)); + if (inherit && cref.$$is_module) modules = modules.concat([Opal.Object]).concat(Opal.ancestors(Opal.Object)); + + for (i = 0, ii = modules.length; i < ii; i++) { + module = modules[i]; + + // Don not show Objects constants unless we're querying Object itself + if (cref !== _Object && module == _Object) break; + + for (constant in module.$$const) { + constants[constant] = true; + } + } + + return Object.keys(constants); + }; + + // Remove a constant from a cref. + Opal.const_remove = function(cref, name) { + Opal.const_cache_version++; + + if (cref.$$const[name] != null) { + var old = cref.$$const[name]; + delete cref.$$const[name]; + return old; + } + + if (cref.$$autoload != null && cref.$$autoload[name] != null) { + delete cref.$$autoload[name]; + return nil; + } + + throw Opal.NameError.$new("constant "+cref+"::"+cref.$name()+" not defined"); + }; + + + // Modules & Classes + // ----------------- + + // A `class Foo; end` expression in ruby is compiled to call this runtime + // method which either returns an existing class of the given name, or creates + // a new class in the given `base` scope. + // + // If a constant with the given name exists, then we check to make sure that + // it is a class and also that the superclasses match. If either of these + // fail, then we raise a `TypeError`. Note, `superclass` may be null if one + // was not specified in the ruby code. + // + // We pass a constructor to this method of the form `function ClassName() {}` + // simply so that classes show up with nicely formatted names inside debuggers + // in the web browser (or node/sprockets). + // + // The `scope` is the current `self` value where the class is being created + // from. We use this to get the scope for where the class should be created. + // If `scope` is an object (not a class/module), we simple get its class and + // use that as the scope instead. + // + // @param scope [Object] where the class is being created + // @param superclass [Class,null] superclass of the new class (may be null) + // @param id [String] the name of the class to be created + // @param constructor [JS.Function] function to use as constructor + // + // @return new [Class] or existing ruby class + // + Opal.allocate_class = function(name, superclass, constructor) { + var klass = constructor; + + if (superclass != null && superclass.$$bridge) { + // Inheritance from bridged classes requires + // calling original JS constructors + klass = function SubclassOfNativeClass() { + var args = $slice.call(arguments), + self = new ($bind.apply(superclass, [null].concat(args)))(); + + // and replacing a __proto__ manually + $setPrototype(self, klass.prototype); + return self; + } + } + + $defineProperty(klass, '$$name', name); + $defineProperty(klass, '$$const', {}); + $defineProperty(klass, '$$is_class', true); + $defineProperty(klass, '$$is_a_module', true); + $defineProperty(klass, '$$super', superclass); + $defineProperty(klass, '$$cvars', {}); + $defineProperty(klass, '$$own_included_modules', []); + $defineProperty(klass, '$$own_prepended_modules', []); + $defineProperty(klass, '$$ancestors', []); + $defineProperty(klass, '$$ancestors_cache_version', null); + + $defineProperty(klass.prototype, '$$class', klass); + + // By default if there are no singleton class methods + // __proto__ is Class.prototype + // Later singleton methods generate a singleton_class + // and inject it into ancestors chain + if (Opal.Class) { + $setPrototype(klass, Opal.Class.prototype); + } + + if (superclass != null) { + $setPrototype(klass.prototype, superclass.prototype); + + if (superclass !== Opal.Module && superclass.$$meta) { + // If superclass has metaclass then we have explicitely inherit it. + Opal.build_class_singleton_class(klass); + } + }; + + return klass; + } + + + function find_existing_class(scope, name) { + // Try to find the class in the current scope + var klass = const_get_name(scope, name); + + // If the class exists in the scope, then we must use that + if (klass) { + // Make sure the existing constant is a class, or raise error + if (!klass.$$is_class) { + throw Opal.TypeError.$new(name + " is not a class"); + } + + return klass; + } + } + + function ensureSuperclassMatch(klass, superclass) { + if (klass.$$super !== superclass) { + throw Opal.TypeError.$new("superclass mismatch for class " + klass.$$name); + } + } + + Opal.klass = function(scope, superclass, name, constructor) { + var bridged; + + if (scope == null) { + // Global scope + scope = _Object; + } else if (!scope.$$is_class && !scope.$$is_module) { + // Scope is an object, use its class + scope = scope.$$class; + } + + // If the superclass is not an Opal-generated class then we're bridging a native JS class + if (superclass != null && !superclass.hasOwnProperty('$$is_class')) { + bridged = superclass; + superclass = _Object; + } + + var klass = find_existing_class(scope, name); + + if (klass) { + if (superclass) { + // Make sure existing class has same superclass + ensureSuperclassMatch(klass, superclass); + } + return klass; + } + + // Class doesnt exist, create a new one with given superclass... + + // Not specifying a superclass means we can assume it to be Object + if (superclass == null) { + superclass = _Object; + } + + if (bridged) { + Opal.bridge(bridged); + klass = bridged; + Opal.const_set(scope, name, klass); + } else { + // Create the class object (instance of Class) + klass = Opal.allocate_class(name, superclass, constructor); + Opal.const_set(scope, name, klass); + // Call .inherited() hook with new class on the superclass + if (superclass.$inherited) { + superclass.$inherited(klass); + } + } + + return klass; + + } + + // Define new module (or return existing module). The given `scope` is basically + // the current `self` value the `module` statement was defined in. If this is + // a ruby module or class, then it is used, otherwise if the scope is a ruby + // object then that objects real ruby class is used (e.g. if the scope is the + // main object, then the top level `Object` class is used as the scope). + // + // If a module of the given name is already defined in the scope, then that + // instance is just returned. + // + // If there is a class of the given name in the scope, then an error is + // generated instead (cannot have a class and module of same name in same scope). + // + // Otherwise, a new module is created in the scope with the given name, and that + // new instance is returned back (to be referenced at runtime). + // + // @param scope [Module, Class] class or module this definition is inside + // @param id [String] the name of the new (or existing) module + // + // @return [Module] + Opal.allocate_module = function(name, constructor) { + var module = constructor; + + $defineProperty(module, '$$name', name); + $defineProperty(module, '$$const', {}); + $defineProperty(module, '$$is_module', true); + $defineProperty(module, '$$is_a_module', true); + $defineProperty(module, '$$cvars', {}); + $defineProperty(module, '$$iclasses', []); + $defineProperty(module, '$$own_included_modules', []); + $defineProperty(module, '$$own_prepended_modules', []); + $defineProperty(module, '$$ancestors', [module]); + $defineProperty(module, '$$ancestors_cache_version', null); + + $setPrototype(module, Opal.Module.prototype); + + return module; + } + + function find_existing_module(scope, name) { + var module = const_get_name(scope, name); + if (module == null && scope === _Object) module = const_lookup_ancestors(_Object, name); + + if (module) { + if (!module.$$is_module && module !== _Object) { + throw Opal.TypeError.$new(name + " is not a module"); + } + } + + return module; + } + + Opal.module = function(scope, name, constructor) { + var module; + + if (scope == null) { + // Global scope + scope = _Object; + } else if (!scope.$$is_class && !scope.$$is_module) { + // Scope is an object, use its class + scope = scope.$$class; + } + + module = find_existing_module(scope, name); + + if (module) { + return module; + } + + // Module doesnt exist, create a new one... + module = Opal.allocate_module(name, constructor); + Opal.const_set(scope, name, module); + + return module; + } + + // Return the singleton class for the passed object. + // + // If the given object alredy has a singleton class, then it will be stored on + // the object as the `$$meta` property. If this exists, then it is simply + // returned back. + // + // Otherwise, a new singleton object for the class or object is created, set on + // the object at `$$meta` for future use, and then returned. + // + // @param object [Object] the ruby object + // @return [Class] the singleton class for object + Opal.get_singleton_class = function(object) { + if (object.$$meta) { + return object.$$meta; + } + + if (object.hasOwnProperty('$$is_class')) { + return Opal.build_class_singleton_class(object); + } else if (object.hasOwnProperty('$$is_module')) { + return Opal.build_module_singletin_class(object); + } else { + return Opal.build_object_singleton_class(object); + } + }; + + // Build the singleton class for an existing class. Class object are built + // with their singleton class already in the prototype chain and inheriting + // from their superclass object (up to `Class` itself). + // + // NOTE: Actually in MRI a class' singleton class inherits from its + // superclass' singleton class which in turn inherits from Class. + // + // @param klass [Class] + // @return [Class] + Opal.build_class_singleton_class = function(klass) { + var superclass, meta; + + if (klass.$$meta) { + return klass.$$meta; + } + + // The singleton_class superclass is the singleton_class of its superclass; + // but BasicObject has no superclass (its `$$super` is null), thus we + // fallback on `Class`. + superclass = klass === BasicObject ? Class : Opal.get_singleton_class(klass.$$super); + + meta = Opal.allocate_class(null, superclass, function(){}); + + $defineProperty(meta, '$$is_singleton', true); + $defineProperty(meta, '$$singleton_of', klass); + $defineProperty(klass, '$$meta', meta); + $setPrototype(klass, meta.prototype); + // Restoring ClassName.class + $defineProperty(klass, '$$class', Opal.Class); + + return meta; + }; + + Opal.build_module_singletin_class = function(mod) { + if (mod.$$meta) { + return mod.$$meta; + } + + var meta = Opal.allocate_class(null, Opal.Module, function(){}); + + $defineProperty(meta, '$$is_singleton', true); + $defineProperty(meta, '$$singleton_of', mod); + $defineProperty(mod, '$$meta', meta); + $setPrototype(mod, meta.prototype); + // Restoring ModuleName.class + $defineProperty(mod, '$$class', Opal.Module); + + return meta; + } + + // Build the singleton class for a Ruby (non class) Object. + // + // @param object [Object] + // @return [Class] + Opal.build_object_singleton_class = function(object) { + var superclass = object.$$class, + klass = Opal.allocate_class(nil, superclass, function(){}); + + $defineProperty(klass, '$$is_singleton', true); + $defineProperty(klass, '$$singleton_of', object); + + delete klass.prototype.$$class; + + $defineProperty(object, '$$meta', klass); + + $setPrototype(object, object.$$meta.prototype); + + return klass; + }; + + Opal.is_method = function(prop) { + return (prop[0] === '$' && prop[1] !== '$'); + } + + Opal.instance_methods = function(mod) { + var exclude = [], results = [], ancestors = Opal.ancestors(mod); + + for (var i = 0, l = ancestors.length; i < l; i++) { + var ancestor = ancestors[i], + proto = ancestor.prototype; + + if (proto.hasOwnProperty('$$dummy')) { + proto = proto.$$define_methods_on; + } + + var props = Object.getOwnPropertyNames(proto); + + for (var j = 0, ll = props.length; j < ll; j++) { + var prop = props[j]; + + if (Opal.is_method(prop)) { + var method_name = prop.slice(1), + method = proto[prop]; + + if (method.$$stub && exclude.indexOf(method_name) === -1) { + exclude.push(method_name); + } + + if (!method.$$stub && results.indexOf(method_name) === -1 && exclude.indexOf(method_name) === -1) { + results.push(method_name); + } + } + } + } + + return results; + } + + Opal.own_instance_methods = function(mod) { + var results = [], + proto = mod.prototype; + + if (proto.hasOwnProperty('$$dummy')) { + proto = proto.$$define_methods_on; + } + + var props = Object.getOwnPropertyNames(proto); + + for (var i = 0, length = props.length; i < length; i++) { + var prop = props[i]; + + if (Opal.is_method(prop)) { + var method = proto[prop]; + + if (!method.$$stub) { + var method_name = prop.slice(1); + results.push(method_name); + } + } + } + + return results; + } + + Opal.methods = function(obj) { + return Opal.instance_methods(Opal.get_singleton_class(obj)); + } + + Opal.own_methods = function(obj) { + return Opal.own_instance_methods(Opal.get_singleton_class(obj)); + } + + Opal.receiver_methods = function(obj) { + var mod = Opal.get_singleton_class(obj); + var singleton_methods = Opal.own_instance_methods(mod); + var instance_methods = Opal.own_instance_methods(mod.$$super); + return singleton_methods.concat(instance_methods); + } + + // Returns an object containing all pairs of names/values + // for all class variables defined in provided +module+ + // and its ancestors. + // + // @param module [Module] + // @return [Object] + Opal.class_variables = function(module) { + var ancestors = Opal.ancestors(module), + i, length = ancestors.length, + result = {}; + + for (i = length - 1; i >= 0; i--) { + var ancestor = ancestors[i]; + + for (var cvar in ancestor.$$cvars) { + result[cvar] = ancestor.$$cvars[cvar]; + } + } + + return result; + } + + // Sets class variable with specified +name+ to +value+ + // in provided +module+ + // + // @param module [Module] + // @param name [String] + // @param value [Object] + Opal.class_variable_set = function(module, name, value) { + var ancestors = Opal.ancestors(module), + i, length = ancestors.length; + + for (i = length - 2; i >= 0; i--) { + var ancestor = ancestors[i]; + + if ($hasOwn.call(ancestor.$$cvars, name)) { + ancestor.$$cvars[name] = value; + return value; + } + } + + module.$$cvars[name] = value; + + return value; + } + + function isRoot(proto) { + return proto.hasOwnProperty('$$iclass') && proto.hasOwnProperty('$$root'); + } + + function own_included_modules(module) { + var result = [], mod, proto = Object.getPrototypeOf(module.prototype); + + while (proto) { + if (proto.hasOwnProperty('$$class')) { + // superclass + break; + } + mod = protoToModule(proto); + if (mod) { + result.push(mod); + } + proto = Object.getPrototypeOf(proto); + } + + return result; + } + + function own_prepended_modules(module) { + var result = [], mod, proto = Object.getPrototypeOf(module.prototype); + + if (module.prototype.hasOwnProperty('$$dummy')) { + while (proto) { + if (proto === module.prototype.$$define_methods_on) { + break; + } + + mod = protoToModule(proto); + if (mod) { + result.push(mod); + } + + proto = Object.getPrototypeOf(proto); + } + } + + return result; + } + + + // The actual inclusion of a module into a class. + // + // ## Class `$$parent` and `iclass` + // + // To handle `super` calls, every class has a `$$parent`. This parent is + // used to resolve the next class for a super call. A normal class would + // have this point to its superclass. However, if a class includes a module + // then this would need to take into account the module. The module would + // also have to then point its `$$parent` to the actual superclass. We + // cannot modify modules like this, because it might be included in more + // then one class. To fix this, we actually insert an `iclass` as the class' + // `$$parent` which can then point to the superclass. The `iclass` acts as + // a proxy to the actual module, so the `super` chain can then search it for + // the required method. + // + // @param module [Module] the module to include + // @param includer [Module] the target class to include module into + // @return [null] + Opal.append_features = function(module, includer) { + var module_ancestors = Opal.ancestors(module); + var iclasses = []; + + if (module_ancestors.indexOf(includer) !== -1) { + throw Opal.ArgumentError.$new('cyclic include detected'); + } + + for (var i = 0, length = module_ancestors.length; i < length; i++) { + var ancestor = module_ancestors[i], iclass = create_iclass(ancestor); + $defineProperty(iclass, '$$included', true); + iclasses.push(iclass); + } + var includer_ancestors = Opal.ancestors(includer), + chain = chain_iclasses(iclasses), + start_chain_after, + end_chain_on; + + if (includer_ancestors.indexOf(module) === -1) { + // first time include + + // includer -> chain.first -> ...chain... -> chain.last -> includer.parent + start_chain_after = includer.prototype; + end_chain_on = Object.getPrototypeOf(includer.prototype); + } else { + // The module has been already included, + // we don't need to put it into the ancestors chain again, + // but this module may have new included modules. + // If it's true we need to copy them. + // + // The simplest way is to replace ancestors chain from + // parent + // | + // `module` iclass (has a $$root flag) + // | + // ...previos chain of module.included_modules ... + // | + // "next ancestor" (has a $$root flag or is a real class) + // + // to + // parent + // | + // `module` iclass (has a $$root flag) + // | + // ...regenerated chain of module.included_modules + // | + // "next ancestor" (has a $$root flag or is a real class) + // + // because there are no intermediate classes between `parent` and `next ancestor`. + // It doesn't break any prototypes of other objects as we don't change class references. + + var proto = includer.prototype, parent = proto, module_iclass = Object.getPrototypeOf(parent); + + while (module_iclass != null) { + if (isRoot(module_iclass) && module_iclass.$$module === module) { + break; + } + + parent = module_iclass; + module_iclass = Object.getPrototypeOf(module_iclass); + } + + var next_ancestor = Object.getPrototypeOf(module_iclass); + + // skip non-root iclasses (that were recursively included) + while (next_ancestor.hasOwnProperty('$$iclass') && !isRoot(next_ancestor)) { + next_ancestor = Object.getPrototypeOf(next_ancestor); + } + + start_chain_after = parent; + end_chain_on = next_ancestor; + } + + $setPrototype(start_chain_after, chain.first); + $setPrototype(chain.last, end_chain_on); + + // recalculate own_included_modules cache + includer.$$own_included_modules = own_included_modules(includer); + + Opal.const_cache_version++; + } + + Opal.prepend_features = function(module, prepender) { + // Here we change the ancestors chain from + // + // prepender + // | + // parent + // + // to: + // + // dummy(prepender) + // | + // iclass(module) + // | + // iclass(prepender) + // | + // parent + var module_ancestors = Opal.ancestors(module); + var iclasses = []; + + if (module_ancestors.indexOf(prepender) !== -1) { + throw Opal.ArgumentError.$new('cyclic prepend detected'); + } + + for (var i = 0, length = module_ancestors.length; i < length; i++) { + var ancestor = module_ancestors[i], iclass = create_iclass(ancestor); + $defineProperty(iclass, '$$prepended', true); + iclasses.push(iclass); + } + + var chain = chain_iclasses(iclasses), + dummy_prepender = prepender.prototype, + previous_parent = Object.getPrototypeOf(dummy_prepender), + prepender_iclass, + start_chain_after, + end_chain_on; + + if (dummy_prepender.hasOwnProperty('$$dummy')) { + // The module already has some prepended modules + // which means that we don't need to make it "dummy" + prepender_iclass = dummy_prepender.$$define_methods_on; + } else { + // Making the module "dummy" + prepender_iclass = create_dummy_iclass(prepender); + flush_methods_in(prepender); + $defineProperty(dummy_prepender, '$$dummy', true); + $defineProperty(dummy_prepender, '$$define_methods_on', prepender_iclass); + + // Converting + // dummy(prepender) -> previous_parent + // to + // dummy(prepender) -> iclass(prepender) -> previous_parent + $setPrototype(dummy_prepender, prepender_iclass); + $setPrototype(prepender_iclass, previous_parent); + } + + var prepender_ancestors = Opal.ancestors(prepender); + + if (prepender_ancestors.indexOf(module) === -1) { + // first time prepend + + start_chain_after = dummy_prepender; + + // next $$root or prepender_iclass or non-$$iclass + end_chain_on = Object.getPrototypeOf(dummy_prepender); + while (end_chain_on != null) { + if ( + end_chain_on.hasOwnProperty('$$root') || + end_chain_on === prepender_iclass || + !end_chain_on.hasOwnProperty('$$iclass') + ) { + break; + } + + end_chain_on = Object.getPrototypeOf(end_chain_on); + } + } else { + throw Opal.RuntimeError.$new("Prepending a module multiple times is not supported"); + } + + $setPrototype(start_chain_after, chain.first); + $setPrototype(chain.last, end_chain_on); + + // recalculate own_prepended_modules cache + prepender.$$own_prepended_modules = own_prepended_modules(prepender); + + Opal.const_cache_version++; + } + + function flush_methods_in(module) { + var proto = module.prototype, + props = Object.getOwnPropertyNames(proto); + + for (var i = 0; i < props.length; i++) { + var prop = props[i]; + if (Opal.is_method(prop)) { + delete proto[prop]; + } + } + } + + function create_iclass(module) { + var iclass = create_dummy_iclass(module); + + if (module.$$is_module) { + module.$$iclasses.push(iclass); + } + + return iclass; + } + + // Dummy iclass doesn't receive updates when the module gets a new method. + function create_dummy_iclass(module) { + var iclass = {}, + proto = module.prototype; + + if (proto.hasOwnProperty('$$dummy')) { + proto = proto.$$define_methods_on; + } + + var props = Object.getOwnPropertyNames(proto), + length = props.length, i; + + for (i = 0; i < length; i++) { + var prop = props[i]; + $defineProperty(iclass, prop, proto[prop]); + } + + $defineProperty(iclass, '$$iclass', true); + $defineProperty(iclass, '$$module', module); + + return iclass; + } + + function chain_iclasses(iclasses) { + var length = iclasses.length, first = iclasses[0]; + + $defineProperty(first, '$$root', true); + + if (length === 1) { + return { first: first, last: first }; + } + + var previous = first; + + for (var i = 1; i < length; i++) { + var current = iclasses[i]; + $setPrototype(previous, current); + previous = current; + } + + + return { first: iclasses[0], last: iclasses[length - 1] }; + } + + // For performance, some core Ruby classes are toll-free bridged to their + // native JavaScript counterparts (e.g. a Ruby Array is a JavaScript Array). + // + // This method is used to setup a native constructor (e.g. Array), to have + // its prototype act like a normal Ruby class. Firstly, a new Ruby class is + // created using the native constructor so that its prototype is set as the + // target for th new class. Note: all bridged classes are set to inherit + // from Object. + // + // Example: + // + // Opal.bridge(self, Function); + // + // @param klass [Class] the Ruby class to bridge + // @param constructor [JS.Function] native JavaScript constructor to use + // @return [Class] returns the passed Ruby class + // + Opal.bridge = function(constructor, klass) { + if (constructor.hasOwnProperty('$$bridge')) { + throw Opal.ArgumentError.$new("already bridged"); + } + + var klass_to_inject, klass_reference; + + if (klass == null) { + klass_to_inject = Opal.Object; + klass_reference = constructor; + } else { + klass_to_inject = klass; + klass_reference = klass; + } + + // constructor is a JS function with a prototype chain like: + // - constructor + // - super + // + // What we need to do is to inject our class (with its prototype chain) + // between constructor and super. For example, after injecting Ruby Object into JS Error we get: + // - constructor + // - Opal.Object + // - Opal.Kernel + // - Opal.BasicObject + // - super + // + + $setPrototype(constructor.prototype, klass_to_inject.prototype); + $defineProperty(constructor.prototype, '$$class', klass_reference); + $defineProperty(constructor, '$$bridge', true); + $defineProperty(constructor, '$$is_class', true); + $defineProperty(constructor, '$$is_a_module', true); + $defineProperty(constructor, '$$super', klass_to_inject); + $defineProperty(constructor, '$$const', {}); + $defineProperty(constructor, '$$own_included_modules', []); + $defineProperty(constructor, '$$own_prepended_modules', []); + $defineProperty(constructor, '$$ancestors', []); + $defineProperty(constructor, '$$ancestors_cache_version', null); + $setPrototype(constructor, Opal.Class.prototype); + }; + + function protoToModule(proto) { + if (proto.hasOwnProperty('$$dummy')) { + return; + } else if (proto.hasOwnProperty('$$iclass')) { + return proto.$$module; + } else if (proto.hasOwnProperty('$$class')) { + return proto.$$class; + } + } + + function own_ancestors(module) { + return module.$$own_prepended_modules.concat([module]).concat(module.$$own_included_modules); + } + + // The Array of ancestors for a given module/class + Opal.ancestors = function(module) { + if (!module) { return []; } + + if (module.$$ancestors_cache_version === Opal.const_cache_version) { + return module.$$ancestors; + } + + var result = [], i, mods, length; + + for (i = 0, mods = own_ancestors(module), length = mods.length; i < length; i++) { + result.push(mods[i]); + } + + if (module.$$super) { + for (i = 0, mods = Opal.ancestors(module.$$super), length = mods.length; i < length; i++) { + result.push(mods[i]); + } + } + + module.$$ancestors_cache_version = Opal.const_cache_version; + module.$$ancestors = result; + + return result; + } + + Opal.included_modules = function(module) { + var result = [], mod = null, proto = Object.getPrototypeOf(module.prototype); + + for (; proto && Object.getPrototypeOf(proto); proto = Object.getPrototypeOf(proto)) { + mod = protoToModule(proto); + if (mod && mod.$$is_module && proto.$$iclass && proto.$$included) { + result.push(mod); + } + } + + return result; + } + + + // Method Missing + // -------------- + + // Methods stubs are used to facilitate method_missing in opal. A stub is a + // placeholder function which just calls `method_missing` on the receiver. + // If no method with the given name is actually defined on an object, then it + // is obvious to say that the stub will be called instead, and then in turn + // method_missing will be called. + // + // When a file in ruby gets compiled to javascript, it includes a call to + // this function which adds stubs for every method name in the compiled file. + // It should then be safe to assume that method_missing will work for any + // method call detected. + // + // Method stubs are added to the BasicObject prototype, which every other + // ruby object inherits, so all objects should handle method missing. A stub + // is only added if the given property name (method name) is not already + // defined. + // + // Note: all ruby methods have a `$` prefix in javascript, so all stubs will + // have this prefix as well (to make this method more performant). + // + // Opal.add_stubs(["$foo", "$bar", "$baz="]); + // + // All stub functions will have a private `$$stub` property set to true so + // that other internal methods can detect if a method is just a stub or not. + // `Kernel#respond_to?` uses this property to detect a methods presence. + // + // @param stubs [Array] an array of method stubs to add + // @return [undefined] + Opal.add_stubs = function(stubs) { + var proto = Opal.BasicObject.prototype; + + for (var i = 0, length = stubs.length; i < length; i++) { + var stub = stubs[i], existing_method = proto[stub]; + + if (existing_method == null || existing_method.$$stub) { + Opal.add_stub_for(proto, stub); + } + } + }; + + // Add a method_missing stub function to the given prototype for the + // given name. + // + // @param prototype [Prototype] the target prototype + // @param stub [String] stub name to add (e.g. "$foo") + // @return [undefined] + Opal.add_stub_for = function(prototype, stub) { + var method_missing_stub = Opal.stub_for(stub); + $defineProperty(prototype, stub, method_missing_stub); + }; + + // Generate the method_missing stub for a given method name. + // + // @param method_name [String] The js-name of the method to stub (e.g. "$foo") + // @return [undefined] + Opal.stub_for = function(method_name) { + function method_missing_stub() { + // Copy any given block onto the method_missing dispatcher + this.$method_missing.$$p = method_missing_stub.$$p; + + // Set block property to null ready for the next call (stop false-positives) + method_missing_stub.$$p = null; + + // call method missing with correct args (remove '$' prefix on method name) + var args_ary = new Array(arguments.length); + for(var i = 0, l = args_ary.length; i < l; i++) { args_ary[i] = arguments[i]; } + + return this.$method_missing.apply(this, [method_name.slice(1)].concat(args_ary)); + } + + method_missing_stub.$$stub = true; + + return method_missing_stub; + }; + + + // Methods + // ------- + + // Arity count error dispatcher for methods + // + // @param actual [Fixnum] number of arguments given to method + // @param expected [Fixnum] expected number of arguments + // @param object [Object] owner of the method +meth+ + // @param meth [String] method name that got wrong number of arguments + // @raise [ArgumentError] + Opal.ac = function(actual, expected, object, meth) { + var inspect = ''; + if (object.$$is_a_module) { + inspect += object.$$name + '.'; + } + else { + inspect += object.$$class.$$name + '#'; + } + inspect += meth; + + throw Opal.ArgumentError.$new('[' + inspect + '] wrong number of arguments(' + actual + ' for ' + expected + ')'); + }; + + // Arity count error dispatcher for blocks + // + // @param actual [Fixnum] number of arguments given to block + // @param expected [Fixnum] expected number of arguments + // @param context [Object] context of the block definition + // @raise [ArgumentError] + Opal.block_ac = function(actual, expected, context) { + var inspect = "`block in " + context + "'"; + + throw Opal.ArgumentError.$new(inspect + ': wrong number of arguments (' + actual + ' for ' + expected + ')'); + }; + + // Super dispatcher + Opal.find_super_dispatcher = function(obj, mid, current_func, defcheck, defs) { + var jsid = '$' + mid, ancestors, super_method; + + if (obj.hasOwnProperty('$$meta')) { + ancestors = Opal.ancestors(obj.$$meta); + } else { + ancestors = Opal.ancestors(obj.$$class); + } + + var current_index = ancestors.indexOf(current_func.$$owner); + + for (var i = current_index + 1; i < ancestors.length; i++) { + var ancestor = ancestors[i], + proto = ancestor.prototype; + + if (proto.hasOwnProperty('$$dummy')) { + proto = proto.$$define_methods_on; + } + + if (proto.hasOwnProperty(jsid)) { + var method = proto[jsid]; + + if (!method.$$stub) { + super_method = method; + } + break; + } + } + + if (!defcheck && super_method == null && Opal.Kernel.$method_missing === obj.$method_missing) { + // method_missing hasn't been explicitly defined + throw Opal.NoMethodError.$new('super: no superclass method `'+mid+"' for "+obj, mid); + } + + return super_method; + }; + + // Iter dispatcher for super in a block + Opal.find_iter_super_dispatcher = function(obj, jsid, current_func, defcheck, implicit) { + var call_jsid = jsid; + + if (!current_func) { + throw Opal.RuntimeError.$new("super called outside of method"); + } + + if (implicit && current_func.$$define_meth) { + throw Opal.RuntimeError.$new("implicit argument passing of super from method defined by define_method() is not supported. Specify all arguments explicitly"); + } + + if (current_func.$$def) { + call_jsid = current_func.$$jsid; + } + + return Opal.find_super_dispatcher(obj, call_jsid, current_func, defcheck); + }; + + // Used to return as an expression. Sometimes, we can't simply return from + // a javascript function as if we were a method, as the return is used as + // an expression, or even inside a block which must "return" to the outer + // method. This helper simply throws an error which is then caught by the + // method. This approach is expensive, so it is only used when absolutely + // needed. + // + Opal.ret = function(val) { + Opal.returner.$v = val; + throw Opal.returner; + }; + + // Used to break out of a block. + Opal.brk = function(val, breaker) { + breaker.$v = val; + throw breaker; + }; + + // Builds a new unique breaker, this is to avoid multiple nested breaks to get + // in the way of each other. + Opal.new_brk = function() { + return new Error('unexpected break'); + }; + + // handles yield calls for 1 yielded arg + Opal.yield1 = function(block, arg) { + if (typeof(block) !== "function") { + throw Opal.LocalJumpError.$new("no block given"); + } + + var has_mlhs = block.$$has_top_level_mlhs_arg, + has_trailing_comma = block.$$has_trailing_comma_in_args; + + if (block.length > 1 || ((has_mlhs || has_trailing_comma) && block.length === 1)) { + arg = Opal.to_ary(arg); + } + + if ((block.length > 1 || (has_trailing_comma && block.length === 1)) && arg.$$is_array) { + return block.apply(null, arg); + } + else { + return block(arg); + } + }; + + // handles yield for > 1 yielded arg + Opal.yieldX = function(block, args) { + if (typeof(block) !== "function") { + throw Opal.LocalJumpError.$new("no block given"); + } + + if (block.length > 1 && args.length === 1) { + if (args[0].$$is_array) { + return block.apply(null, args[0]); + } + } + + if (!args.$$is_array) { + var args_ary = new Array(args.length); + for(var i = 0, l = args_ary.length; i < l; i++) { args_ary[i] = args[i]; } + + return block.apply(null, args_ary); + } + + return block.apply(null, args); + }; + + // Finds the corresponding exception match in candidates. Each candidate can + // be a value, or an array of values. Returns null if not found. + Opal.rescue = function(exception, candidates) { + for (var i = 0; i < candidates.length; i++) { + var candidate = candidates[i]; + + if (candidate.$$is_array) { + var result = Opal.rescue(exception, candidate); + + if (result) { + return result; + } + } + else if (candidate === Opal.JS.Error) { + return candidate; + } + else if (candidate['$==='](exception)) { + return candidate; + } + } + + return null; + }; + + Opal.is_a = function(object, klass) { + if (klass != null && object.$$meta === klass || object.$$class === klass) { + return true; + } + + if (object.$$is_number && klass.$$is_number_class) { + return true; + } + + var i, length, ancestors = Opal.ancestors(object.$$is_class ? Opal.get_singleton_class(object) : (object.$$meta || object.$$class)); + + for (i = 0, length = ancestors.length; i < length; i++) { + if (ancestors[i] === klass) { + return true; + } + } + + return false; + }; + + // Helpers for extracting kwsplats + // Used for: { **h } + Opal.to_hash = function(value) { + if (value.$$is_hash) { + return value; + } + else if (value['$respond_to?']('to_hash', true)) { + var hash = value.$to_hash(); + if (hash.$$is_hash) { + return hash; + } + else { + throw Opal.TypeError.$new("Can't convert " + value.$$class + + " to Hash (" + value.$$class + "#to_hash gives " + hash.$$class + ")"); + } + } + else { + throw Opal.TypeError.$new("no implicit conversion of " + value.$$class + " into Hash"); + } + }; + + // Helpers for implementing multiple assignment + // Our code for extracting the values and assigning them only works if the + // return value is a JS array. + // So if we get an Array subclass, extract the wrapped JS array from it + + // Used for: a, b = something (no splat) + Opal.to_ary = function(value) { + if (value.$$is_array) { + return value; + } + else if (value['$respond_to?']('to_ary', true)) { + var ary = value.$to_ary(); + if (ary === nil) { + return [value]; + } + else if (ary.$$is_array) { + return ary; + } + else { + throw Opal.TypeError.$new("Can't convert " + value.$$class + + " to Array (" + value.$$class + "#to_ary gives " + ary.$$class + ")"); + } + } + else { + return [value]; + } + }; + + // Used for: a, b = *something (with splat) + Opal.to_a = function(value) { + if (value.$$is_array) { + // A splatted array must be copied + return value.slice(); + } + else if (value['$respond_to?']('to_a', true)) { + var ary = value.$to_a(); + if (ary === nil) { + return [value]; + } + else if (ary.$$is_array) { + return ary; + } + else { + throw Opal.TypeError.$new("Can't convert " + value.$$class + + " to Array (" + value.$$class + "#to_a gives " + ary.$$class + ")"); + } + } + else { + return [value]; + } + }; + + // Used for extracting keyword arguments from arguments passed to + // JS function. If provided +arguments+ list doesn't have a Hash + // as a last item, returns a blank Hash. + // + // @param parameters [Array] + // @return [Hash] + // + Opal.extract_kwargs = function(parameters) { + var kwargs = parameters[parameters.length - 1]; + if (kwargs != null && kwargs['$respond_to?']('to_hash', true)) { + Array.prototype.splice.call(parameters, parameters.length - 1, 1); + return kwargs.$to_hash(); + } + else { + return Opal.hash2([], {}); + } + } + + // Used to get a list of rest keyword arguments. Method takes the given + // keyword args, i.e. the hash literal passed to the method containing all + // keyword arguemnts passed to method, as well as the used args which are + // the names of required and optional arguments defined. This method then + // just returns all key/value pairs which have not been used, in a new + // hash literal. + // + // @param given_args [Hash] all kwargs given to method + // @param used_args [Object] all keys used as named kwargs + // @return [Hash] + // + Opal.kwrestargs = function(given_args, used_args) { + var keys = [], + map = {}, + key = null, + given_map = given_args.$$smap; + + for (key in given_map) { + if (!used_args[key]) { + keys.push(key); + map[key] = given_map[key]; + } + } + + return Opal.hash2(keys, map); + }; + + // Calls passed method on a ruby object with arguments and block: + // + // Can take a method or a method name. + // + // 1. When method name gets passed it invokes it by its name + // and calls 'method_missing' when object doesn't have this method. + // Used internally by Opal to invoke method that takes a block or a splat. + // 2. When method (i.e. method body) gets passed, it doesn't trigger 'method_missing' + // because it doesn't know the name of the actual method. + // Used internally by Opal to invoke 'super'. + // + // @example + // var my_array = [1, 2, 3, 4] + // Opal.send(my_array, 'length') # => 4 + // Opal.send(my_array, my_array.$length) # => 4 + // + // Opal.send(my_array, 'reverse!') # => [4, 3, 2, 1] + // Opal.send(my_array, my_array['$reverse!']') # => [4, 3, 2, 1] + // + // @param recv [Object] ruby object + // @param method [Function, String] method body or name of the method + // @param args [Array] arguments that will be passed to the method call + // @param block [Function] ruby block + // @return [Object] returning value of the method call + Opal.send = function(recv, method, args, block) { + var body = (typeof(method) === 'string') ? recv['$'+method] : method; + + if (body != null) { + if (typeof block === 'function') { + body.$$p = block; + } + return body.apply(recv, args); + } + + return recv.$method_missing.apply(recv, [method].concat(args)); + } + + Opal.lambda = function(block) { + block.$$is_lambda = true; + return block; + } + + // Used to define methods on an object. This is a helper method, used by the + // compiled source to define methods on special case objects when the compiler + // can not determine the destination object, or the object is a Module + // instance. This can get called by `Module#define_method` as well. + // + // ## Modules + // + // Any method defined on a module will come through this runtime helper. + // The method is added to the module body, and the owner of the method is + // set to be the module itself. This is used later when choosing which + // method should show on a class if more than 1 included modules define + // the same method. Finally, if the module is in `module_function` mode, + // then the method is also defined onto the module itself. + // + // ## Classes + // + // This helper will only be called for classes when a method is being + // defined indirectly; either through `Module#define_method`, or by a + // literal `def` method inside an `instance_eval` or `class_eval` body. In + // either case, the method is simply added to the class' prototype. A special + // exception exists for `BasicObject` and `Object`. These two classes are + // special because they are used in toll-free bridged classes. In each of + // these two cases, extra work is required to define the methods on toll-free + // bridged class' prototypes as well. + // + // ## Objects + // + // If a simple ruby object is the object, then the method is simply just + // defined on the object as a singleton method. This would be the case when + // a method is defined inside an `instance_eval` block. + // + // @param obj [Object, Class] the actual obj to define method for + // @param jsid [String] the JavaScript friendly method name (e.g. '$foo') + // @param body [JS.Function] the literal JavaScript function used as method + // @return [null] + // + Opal.def = function(obj, jsid, body) { + // Special case for a method definition in the + // top-level namespace + if (obj === Opal.top) { + Opal.defn(Opal.Object, jsid, body) + } + // if instance_eval is invoked on a module/class, it sets inst_eval_mod + else if (!obj.$$eval && obj.$$is_a_module) { + Opal.defn(obj, jsid, body); + } + else { + Opal.defs(obj, jsid, body); + } + }; + + // Define method on a module or class (see Opal.def). + Opal.defn = function(module, jsid, body) { + body.$$owner = module; + + var proto = module.prototype; + if (proto.hasOwnProperty('$$dummy')) { + proto = proto.$$define_methods_on; + } + $defineProperty(proto, jsid, body); + + if (module.$$is_module) { + if (module.$$module_function) { + Opal.defs(module, jsid, body) + } + + for (var i = 0, iclasses = module.$$iclasses, length = iclasses.length; i < length; i++) { + var iclass = iclasses[i]; + $defineProperty(iclass, jsid, body); + } + } + + var singleton_of = module.$$singleton_of; + if (module.$method_added && !module.$method_added.$$stub && !singleton_of) { + module.$method_added(jsid.substr(1)); + } + else if (singleton_of && singleton_of.$singleton_method_added && !singleton_of.$singleton_method_added.$$stub) { + singleton_of.$singleton_method_added(jsid.substr(1)); + } + } + + // Define a singleton method on the given object (see Opal.def). + Opal.defs = function(obj, jsid, body) { + if (obj.$$is_string || obj.$$is_number) { + // That's simply impossible + return; + } + Opal.defn(Opal.get_singleton_class(obj), jsid, body) + }; + + // Called from #remove_method. + Opal.rdef = function(obj, jsid) { + if (!$hasOwn.call(obj.prototype, jsid)) { + throw Opal.NameError.$new("method '" + jsid.substr(1) + "' not defined in " + obj.$name()); + } + + delete obj.prototype[jsid]; + + if (obj.$$is_singleton) { + if (obj.prototype.$singleton_method_removed && !obj.prototype.$singleton_method_removed.$$stub) { + obj.prototype.$singleton_method_removed(jsid.substr(1)); + } + } + else { + if (obj.$method_removed && !obj.$method_removed.$$stub) { + obj.$method_removed(jsid.substr(1)); + } + } + }; + + // Called from #undef_method. + Opal.udef = function(obj, jsid) { + if (!obj.prototype[jsid] || obj.prototype[jsid].$$stub) { + throw Opal.NameError.$new("method '" + jsid.substr(1) + "' not defined in " + obj.$name()); + } + + Opal.add_stub_for(obj.prototype, jsid); + + if (obj.$$is_singleton) { + if (obj.prototype.$singleton_method_undefined && !obj.prototype.$singleton_method_undefined.$$stub) { + obj.prototype.$singleton_method_undefined(jsid.substr(1)); + } + } + else { + if (obj.$method_undefined && !obj.$method_undefined.$$stub) { + obj.$method_undefined(jsid.substr(1)); + } + } + }; + + function is_method_body(body) { + return (typeof(body) === "function" && !body.$$stub); + } + + Opal.alias = function(obj, name, old) { + var id = '$' + name, + old_id = '$' + old, + body = obj.prototype['$' + old], + alias; + + // When running inside #instance_eval the alias refers to class methods. + if (obj.$$eval) { + return Opal.alias(Opal.get_singleton_class(obj), name, old); + } + + if (!is_method_body(body)) { + var ancestor = obj.$$super; + + while (typeof(body) !== "function" && ancestor) { + body = ancestor[old_id]; + ancestor = ancestor.$$super; + } + + if (!is_method_body(body) && obj.$$is_module) { + // try to look into Object + body = Opal.Object.prototype[old_id] + } + + if (!is_method_body(body)) { + throw Opal.NameError.$new("undefined method `" + old + "' for class `" + obj.$name() + "'") + } + } + + // If the body is itself an alias use the original body + // to keep the max depth at 1. + if (body.$$alias_of) body = body.$$alias_of; + + // We need a wrapper because otherwise properties + // would be ovrewritten on the original body. + alias = function() { + var block = alias.$$p, args, i, ii; + + args = new Array(arguments.length); + for(i = 0, ii = arguments.length; i < ii; i++) { + args[i] = arguments[i]; + } + + if (block != null) { alias.$$p = null } + + return Opal.send(this, body, args, block); + }; + + // Try to make the browser pick the right name + alias.displayName = name; + alias.length = body.length; + alias.$$arity = body.$$arity; + alias.$$parameters = body.$$parameters; + alias.$$source_location = body.$$source_location; + alias.$$alias_of = body; + alias.$$alias_name = name; + + Opal.defn(obj, id, alias); + + return obj; + }; + + Opal.alias_native = function(obj, name, native_name) { + var id = '$' + name, + body = obj.prototype[native_name]; + + if (typeof(body) !== "function" || body.$$stub) { + throw Opal.NameError.$new("undefined native method `" + native_name + "' for class `" + obj.$name() + "'") + } + + Opal.defn(obj, id, body); + + return obj; + }; + + + // Hashes + // ------ + + Opal.hash_init = function(hash) { + hash.$$smap = Object.create(null); + hash.$$map = Object.create(null); + hash.$$keys = []; + }; + + Opal.hash_clone = function(from_hash, to_hash) { + to_hash.$$none = from_hash.$$none; + to_hash.$$proc = from_hash.$$proc; + + for (var i = 0, keys = from_hash.$$keys, smap = from_hash.$$smap, len = keys.length, key, value; i < len; i++) { + key = keys[i]; + + if (key.$$is_string) { + value = smap[key]; + } else { + value = key.value; + key = key.key; + } + + Opal.hash_put(to_hash, key, value); + } + }; + + Opal.hash_put = function(hash, key, value) { + if (key.$$is_string) { + if (!$hasOwn.call(hash.$$smap, key)) { + hash.$$keys.push(key); + } + hash.$$smap[key] = value; + return; + } + + var key_hash, bucket, last_bucket; + key_hash = hash.$$by_identity ? Opal.id(key) : key.$hash(); + + if (!$hasOwn.call(hash.$$map, key_hash)) { + bucket = {key: key, key_hash: key_hash, value: value}; + hash.$$keys.push(bucket); + hash.$$map[key_hash] = bucket; + return; + } + + bucket = hash.$$map[key_hash]; + + while (bucket) { + if (key === bucket.key || key['$eql?'](bucket.key)) { + last_bucket = undefined; + bucket.value = value; + break; + } + last_bucket = bucket; + bucket = bucket.next; + } + + if (last_bucket) { + bucket = {key: key, key_hash: key_hash, value: value}; + hash.$$keys.push(bucket); + last_bucket.next = bucket; + } + }; + + Opal.hash_get = function(hash, key) { + if (key.$$is_string) { + if ($hasOwn.call(hash.$$smap, key)) { + return hash.$$smap[key]; + } + return; + } + + var key_hash, bucket; + key_hash = hash.$$by_identity ? Opal.id(key) : key.$hash(); + + if ($hasOwn.call(hash.$$map, key_hash)) { + bucket = hash.$$map[key_hash]; + + while (bucket) { + if (key === bucket.key || key['$eql?'](bucket.key)) { + return bucket.value; + } + bucket = bucket.next; + } + } + }; + + Opal.hash_delete = function(hash, key) { + var i, keys = hash.$$keys, length = keys.length, value; + + if (key.$$is_string) { + if (!$hasOwn.call(hash.$$smap, key)) { + return; + } + + for (i = 0; i < length; i++) { + if (keys[i] === key) { + keys.splice(i, 1); + break; + } + } + + value = hash.$$smap[key]; + delete hash.$$smap[key]; + return value; + } + + var key_hash = key.$hash(); + + if (!$hasOwn.call(hash.$$map, key_hash)) { + return; + } + + var bucket = hash.$$map[key_hash], last_bucket; + + while (bucket) { + if (key === bucket.key || key['$eql?'](bucket.key)) { + value = bucket.value; + + for (i = 0; i < length; i++) { + if (keys[i] === bucket) { + keys.splice(i, 1); + break; + } + } + + if (last_bucket && bucket.next) { + last_bucket.next = bucket.next; + } + else if (last_bucket) { + delete last_bucket.next; + } + else if (bucket.next) { + hash.$$map[key_hash] = bucket.next; + } + else { + delete hash.$$map[key_hash]; + } + + return value; + } + last_bucket = bucket; + bucket = bucket.next; + } + }; + + Opal.hash_rehash = function(hash) { + for (var i = 0, length = hash.$$keys.length, key_hash, bucket, last_bucket; i < length; i++) { + + if (hash.$$keys[i].$$is_string) { + continue; + } + + key_hash = hash.$$keys[i].key.$hash(); + + if (key_hash === hash.$$keys[i].key_hash) { + continue; + } + + bucket = hash.$$map[hash.$$keys[i].key_hash]; + last_bucket = undefined; + + while (bucket) { + if (bucket === hash.$$keys[i]) { + if (last_bucket && bucket.next) { + last_bucket.next = bucket.next; + } + else if (last_bucket) { + delete last_bucket.next; + } + else if (bucket.next) { + hash.$$map[hash.$$keys[i].key_hash] = bucket.next; + } + else { + delete hash.$$map[hash.$$keys[i].key_hash]; + } + break; + } + last_bucket = bucket; + bucket = bucket.next; + } + + hash.$$keys[i].key_hash = key_hash; + + if (!$hasOwn.call(hash.$$map, key_hash)) { + hash.$$map[key_hash] = hash.$$keys[i]; + continue; + } + + bucket = hash.$$map[key_hash]; + last_bucket = undefined; + + while (bucket) { + if (bucket === hash.$$keys[i]) { + last_bucket = undefined; + break; + } + last_bucket = bucket; + bucket = bucket.next; + } + + if (last_bucket) { + last_bucket.next = hash.$$keys[i]; + } + } + }; + + Opal.hash = function() { + var arguments_length = arguments.length, args, hash, i, length, key, value; + + if (arguments_length === 1 && arguments[0].$$is_hash) { + return arguments[0]; + } + + hash = new Opal.Hash(); + Opal.hash_init(hash); + + if (arguments_length === 1 && arguments[0].$$is_array) { + args = arguments[0]; + length = args.length; + + for (i = 0; i < length; i++) { + if (args[i].length !== 2) { + throw Opal.ArgumentError.$new("value not of length 2: " + args[i].$inspect()); + } + + key = args[i][0]; + value = args[i][1]; + + Opal.hash_put(hash, key, value); + } + + return hash; + } + + if (arguments_length === 1) { + args = arguments[0]; + for (key in args) { + if ($hasOwn.call(args, key)) { + value = args[key]; + + Opal.hash_put(hash, key, value); + } + } + + return hash; + } + + if (arguments_length % 2 !== 0) { + throw Opal.ArgumentError.$new("odd number of arguments for Hash"); + } + + for (i = 0; i < arguments_length; i += 2) { + key = arguments[i]; + value = arguments[i + 1]; + + Opal.hash_put(hash, key, value); + } + + return hash; + }; + + // A faster Hash creator for hashes that just use symbols and + // strings as keys. The map and keys array can be constructed at + // compile time, so they are just added here by the constructor + // function. + // + Opal.hash2 = function(keys, smap) { + var hash = new Opal.Hash(); + + hash.$$smap = smap; + hash.$$map = Object.create(null); + hash.$$keys = keys; + + return hash; + }; + + // Create a new range instance with first and last values, and whether the + // range excludes the last value. + // + Opal.range = function(first, last, exc) { + var range = new Opal.Range(); + range.begin = first; + range.end = last; + range.excl = exc; + + return range; + }; + + // Get the ivar name for a given name. + // Mostly adds a trailing $ to reserved names. + // + Opal.ivar = function(name) { + if ( + // properties + name === "constructor" || + name === "displayName" || + name === "__count__" || + name === "__noSuchMethod__" || + name === "__parent__" || + name === "__proto__" || + + // methods + name === "hasOwnProperty" || + name === "valueOf" + ) + { + return name + "$"; + } + + return name; + }; + + + // Regexps + // ------- + + // Escape Regexp special chars letting the resulting string be used to build + // a new Regexp. + // + Opal.escape_regexp = function(str) { + return str.replace(/([-[\]\/{}()*+?.^$\\| ])/g, '\\$1') + .replace(/[\n]/g, '\\n') + .replace(/[\r]/g, '\\r') + .replace(/[\f]/g, '\\f') + .replace(/[\t]/g, '\\t'); + }; + + // Create a global Regexp from a RegExp object and cache the result + // on the object itself ($$g attribute). + // + Opal.global_regexp = function(pattern) { + if (pattern.global) { + return pattern; // RegExp already has the global flag + } + if (pattern.$$g == null) { + pattern.$$g = new RegExp(pattern.source, (pattern.multiline ? 'gm' : 'g') + (pattern.ignoreCase ? 'i' : '')); + } else { + pattern.$$g.lastIndex = null; // reset lastIndex property + } + return pattern.$$g; + }; + + // Create a global multiline Regexp from a RegExp object and cache the result + // on the object itself ($$gm or $$g attribute). + // + Opal.global_multiline_regexp = function(pattern) { + var result; + if (pattern.multiline) { + if (pattern.global) { + return pattern; // RegExp already has the global and multiline flag + } + // we are using the $$g attribute because the Regexp is already multiline + if (pattern.$$g != null) { + result = pattern.$$g; + } else { + result = pattern.$$g = new RegExp(pattern.source, 'gm' + (pattern.ignoreCase ? 'i' : '')); + } + } else if (pattern.$$gm != null) { + result = pattern.$$gm; + } else { + result = pattern.$$gm = new RegExp(pattern.source, 'gm' + (pattern.ignoreCase ? 'i' : '')); + } + result.lastIndex = null; // reset lastIndex property + return result; + }; + + // Require system + // -------------- + + Opal.modules = {}; + Opal.loaded_features = ['corelib/runtime']; + Opal.current_dir = '.'; + Opal.require_table = {'corelib/runtime': true}; + + Opal.normalize = function(path) { + var parts, part, new_parts = [], SEPARATOR = '/'; + + if (Opal.current_dir !== '.') { + path = Opal.current_dir.replace(/\/*$/, '/') + path; + } + + path = path.replace(/^\.\//, ''); + path = path.replace(/\.(rb|opal|js)$/, ''); + parts = path.split(SEPARATOR); + + for (var i = 0, ii = parts.length; i < ii; i++) { + part = parts[i]; + if (part === '') continue; + (part === '..') ? new_parts.pop() : new_parts.push(part) + } + + return new_parts.join(SEPARATOR); + }; + + Opal.loaded = function(paths) { + var i, l, path; + + for (i = 0, l = paths.length; i < l; i++) { + path = Opal.normalize(paths[i]); + + if (Opal.require_table[path]) { + continue; + } + + Opal.loaded_features.push(path); + Opal.require_table[path] = true; + } + }; + + Opal.load = function(path) { + path = Opal.normalize(path); + + Opal.loaded([path]); + + var module = Opal.modules[path]; + + if (module) { + module(Opal); + } + else { + var severity = Opal.config.missing_require_severity; + var message = 'cannot load such file -- ' + path; + + if (severity === "error") { + if (Opal.LoadError) { + throw Opal.LoadError.$new(message) + } else { + throw message + } + } + else if (severity === "warning") { + console.warn('WARNING: LoadError: ' + message); + } + } + + return true; + }; + + Opal.require = function(path) { + path = Opal.normalize(path); + + if (Opal.require_table[path]) { + return false; + } + + return Opal.load(path); + }; + + + // Initialization + // -------------- + function $BasicObject() {}; + function $Object() {}; + function $Module() {}; + function $Class() {}; + + Opal.BasicObject = BasicObject = Opal.allocate_class('BasicObject', null, $BasicObject); + Opal.Object = _Object = Opal.allocate_class('Object', Opal.BasicObject, $Object); + Opal.Module = Module = Opal.allocate_class('Module', Opal.Object, $Module); + Opal.Class = Class = Opal.allocate_class('Class', Opal.Module, $Class); + + $setPrototype(Opal.BasicObject, Opal.Class.prototype); + $setPrototype(Opal.Object, Opal.Class.prototype); + $setPrototype(Opal.Module, Opal.Class.prototype); + $setPrototype(Opal.Class, Opal.Class.prototype); + + // BasicObject can reach itself, avoid const_set to skip the $$base_module logic + BasicObject.$$const["BasicObject"] = BasicObject; + + // Assign basic constants + Opal.const_set(_Object, "BasicObject", BasicObject); + Opal.const_set(_Object, "Object", _Object); + Opal.const_set(_Object, "Module", Module); + Opal.const_set(_Object, "Class", Class); + + // Fix booted classes to have correct .class value + BasicObject.$$class = Class; + _Object.$$class = Class; + Module.$$class = Class; + Class.$$class = Class; + + // Forward .toString() to #to_s + $defineProperty(_Object.prototype, 'toString', function() { + var to_s = this.$to_s(); + if (to_s.$$is_string && typeof(to_s) === 'object') { + // a string created using new String('string') + return to_s.valueOf(); + } else { + return to_s; + } + }); + + // Make Kernel#require immediately available as it's needed to require all the + // other corelib files. + $defineProperty(_Object.prototype, '$require', Opal.require); + + // Add a short helper to navigate constants manually. + // @example + // Opal.$$.Regexp.$$.IGNORECASE + Opal.$$ = _Object.$$; + + // Instantiate the main object + Opal.top = new _Object(); + Opal.top.$to_s = Opal.top.$inspect = function() { return 'main' }; + + + // Nil + function $NilClass() {}; + Opal.NilClass = Opal.allocate_class('NilClass', Opal.Object, $NilClass); + Opal.const_set(_Object, 'NilClass', Opal.NilClass); + nil = Opal.nil = new Opal.NilClass(); + nil.$$id = nil_id; + nil.call = nil.apply = function() { throw Opal.LocalJumpError.$new('no block given'); }; + + // Errors + Opal.breaker = new Error('unexpected break (old)'); + Opal.returner = new Error('unexpected return'); + TypeError.$$super = Error; +}).call(this); +Opal.loaded(["corelib/runtime.js"]); +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/helpers"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $truthy = Opal.truthy; + + Opal.add_stubs(['$new', '$class', '$===', '$respond_to?', '$raise', '$type_error', '$__send__', '$coerce_to', '$nil?', '$<=>', '$coerce_to!', '$!=', '$[]', '$upcase']); + return (function($base, $parent_nesting) { + function $Opal() {}; + var self = $Opal = $module($base, 'Opal', $Opal); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Opal_bridge_1, TMP_Opal_type_error_2, TMP_Opal_coerce_to_3, TMP_Opal_coerce_to$B_4, TMP_Opal_coerce_to$q_5, TMP_Opal_try_convert_6, TMP_Opal_compare_7, TMP_Opal_destructure_8, TMP_Opal_respond_to$q_9, TMP_Opal_inspect_obj_10, TMP_Opal_instance_variable_name$B_11, TMP_Opal_class_variable_name$B_12, TMP_Opal_const_name$B_13, TMP_Opal_pristine_14; + + + Opal.defs(self, '$bridge', TMP_Opal_bridge_1 = function $$bridge(constructor, klass) { + var self = this; + + return Opal.bridge(constructor, klass); + }, TMP_Opal_bridge_1.$$arity = 2); + Opal.defs(self, '$type_error', TMP_Opal_type_error_2 = function $$type_error(object, type, method, coerced) { + var $a, self = this; + + + + if (method == null) { + method = nil; + }; + + if (coerced == null) { + coerced = nil; + }; + if ($truthy(($truthy($a = method) ? coerced : $a))) { + return $$($nesting, 'TypeError').$new("" + "can't convert " + (object.$class()) + " into " + (type) + " (" + (object.$class()) + "#" + (method) + " gives " + (coerced.$class()) + ")") + } else { + return $$($nesting, 'TypeError').$new("" + "no implicit conversion of " + (object.$class()) + " into " + (type)) + }; + }, TMP_Opal_type_error_2.$$arity = -3); + Opal.defs(self, '$coerce_to', TMP_Opal_coerce_to_3 = function $$coerce_to(object, type, method) { + var self = this; + + + if ($truthy(type['$==='](object))) { + return object}; + if ($truthy(object['$respond_to?'](method))) { + } else { + self.$raise(self.$type_error(object, type)) + }; + return object.$__send__(method); + }, TMP_Opal_coerce_to_3.$$arity = 3); + Opal.defs(self, '$coerce_to!', TMP_Opal_coerce_to$B_4 = function(object, type, method) { + var self = this, coerced = nil; + + + coerced = self.$coerce_to(object, type, method); + if ($truthy(type['$==='](coerced))) { + } else { + self.$raise(self.$type_error(object, type, method, coerced)) + }; + return coerced; + }, TMP_Opal_coerce_to$B_4.$$arity = 3); + Opal.defs(self, '$coerce_to?', TMP_Opal_coerce_to$q_5 = function(object, type, method) { + var self = this, coerced = nil; + + + if ($truthy(object['$respond_to?'](method))) { + } else { + return nil + }; + coerced = self.$coerce_to(object, type, method); + if ($truthy(coerced['$nil?']())) { + return nil}; + if ($truthy(type['$==='](coerced))) { + } else { + self.$raise(self.$type_error(object, type, method, coerced)) + }; + return coerced; + }, TMP_Opal_coerce_to$q_5.$$arity = 3); + Opal.defs(self, '$try_convert', TMP_Opal_try_convert_6 = function $$try_convert(object, type, method) { + var self = this; + + + if ($truthy(type['$==='](object))) { + return object}; + if ($truthy(object['$respond_to?'](method))) { + return object.$__send__(method) + } else { + return nil + }; + }, TMP_Opal_try_convert_6.$$arity = 3); + Opal.defs(self, '$compare', TMP_Opal_compare_7 = function $$compare(a, b) { + var self = this, compare = nil; + + + compare = a['$<=>'](b); + if ($truthy(compare === nil)) { + self.$raise($$($nesting, 'ArgumentError'), "" + "comparison of " + (a.$class()) + " with " + (b.$class()) + " failed")}; + return compare; + }, TMP_Opal_compare_7.$$arity = 2); + Opal.defs(self, '$destructure', TMP_Opal_destructure_8 = function $$destructure(args) { + var self = this; + + + if (args.length == 1) { + return args[0]; + } + else if (args.$$is_array) { + return args; + } + else { + var args_ary = new Array(args.length); + for(var i = 0, l = args_ary.length; i < l; i++) { args_ary[i] = args[i]; } + + return args_ary; + } + + }, TMP_Opal_destructure_8.$$arity = 1); + Opal.defs(self, '$respond_to?', TMP_Opal_respond_to$q_9 = function(obj, method, include_all) { + var self = this; + + + + if (include_all == null) { + include_all = false; + }; + + if (obj == null || !obj.$$class) { + return false; + } + ; + return obj['$respond_to?'](method, include_all); + }, TMP_Opal_respond_to$q_9.$$arity = -3); + Opal.defs(self, '$inspect_obj', TMP_Opal_inspect_obj_10 = function $$inspect_obj(obj) { + var self = this; + + return Opal.inspect(obj); + }, TMP_Opal_inspect_obj_10.$$arity = 1); + Opal.defs(self, '$instance_variable_name!', TMP_Opal_instance_variable_name$B_11 = function(name) { + var self = this; + + + name = $$($nesting, 'Opal')['$coerce_to!'](name, $$($nesting, 'String'), "to_str"); + if ($truthy(/^@[a-zA-Z_][a-zA-Z0-9_]*?$/.test(name))) { + } else { + self.$raise($$($nesting, 'NameError').$new("" + "'" + (name) + "' is not allowed as an instance variable name", name)) + }; + return name; + }, TMP_Opal_instance_variable_name$B_11.$$arity = 1); + Opal.defs(self, '$class_variable_name!', TMP_Opal_class_variable_name$B_12 = function(name) { + var self = this; + + + name = $$($nesting, 'Opal')['$coerce_to!'](name, $$($nesting, 'String'), "to_str"); + if ($truthy(name.length < 3 || name.slice(0,2) !== '@@')) { + self.$raise($$($nesting, 'NameError').$new("" + "`" + (name) + "' is not allowed as a class variable name", name))}; + return name; + }, TMP_Opal_class_variable_name$B_12.$$arity = 1); + Opal.defs(self, '$const_name!', TMP_Opal_const_name$B_13 = function(const_name) { + var self = this; + + + const_name = $$($nesting, 'Opal')['$coerce_to!'](const_name, $$($nesting, 'String'), "to_str"); + if ($truthy(const_name['$[]'](0)['$!='](const_name['$[]'](0).$upcase()))) { + self.$raise($$($nesting, 'NameError'), "" + "wrong constant name " + (const_name))}; + return const_name; + }, TMP_Opal_const_name$B_13.$$arity = 1); + Opal.defs(self, '$pristine', TMP_Opal_pristine_14 = function $$pristine(owner_class, $a) { + var $post_args, method_names, self = this; + + + + $post_args = Opal.slice.call(arguments, 1, arguments.length); + + method_names = $post_args;; + + var method_name, method; + for (var i = method_names.length - 1; i >= 0; i--) { + method_name = method_names[i]; + method = owner_class.prototype['$'+method_name]; + + if (method && !method.$$stub) { + method.$$pristine = true; + } + } + ; + return nil; + }, TMP_Opal_pristine_14.$$arity = -2); + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/module"] = function(Opal) { + function $rb_lt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); + } + function $rb_gt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $send = Opal.send, $truthy = Opal.truthy, $lambda = Opal.lambda, $range = Opal.range, $hash2 = Opal.hash2; + + Opal.add_stubs(['$module_eval', '$to_proc', '$===', '$raise', '$equal?', '$<', '$>', '$nil?', '$attr_reader', '$attr_writer', '$class_variable_name!', '$new', '$const_name!', '$=~', '$inject', '$split', '$const_get', '$==', '$!~', '$start_with?', '$bind', '$call', '$class', '$append_features', '$included', '$name', '$cover?', '$size', '$merge', '$compile', '$proc', '$any?', '$prepend_features', '$prepended', '$to_s', '$__id__', '$constants', '$include?', '$copy_class_variables', '$copy_constants']); + return (function($base, $super, $parent_nesting) { + function $Module(){}; + var self = $Module = $klass($base, $super, 'Module', $Module); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Module_allocate_1, TMP_Module_inherited_2, TMP_Module_initialize_3, TMP_Module_$eq$eq$eq_4, TMP_Module_$lt_5, TMP_Module_$lt$eq_6, TMP_Module_$gt_7, TMP_Module_$gt$eq_8, TMP_Module_$lt$eq$gt_9, TMP_Module_alias_method_10, TMP_Module_alias_native_11, TMP_Module_ancestors_12, TMP_Module_append_features_13, TMP_Module_attr_accessor_14, TMP_Module_attr_reader_15, TMP_Module_attr_writer_16, TMP_Module_autoload_17, TMP_Module_class_variables_18, TMP_Module_class_variable_get_19, TMP_Module_class_variable_set_20, TMP_Module_class_variable_defined$q_21, TMP_Module_remove_class_variable_22, TMP_Module_constants_23, TMP_Module_constants_24, TMP_Module_nesting_25, TMP_Module_const_defined$q_26, TMP_Module_const_get_27, TMP_Module_const_missing_29, TMP_Module_const_set_30, TMP_Module_public_constant_31, TMP_Module_define_method_32, TMP_Module_remove_method_34, TMP_Module_singleton_class$q_35, TMP_Module_include_36, TMP_Module_included_modules_37, TMP_Module_include$q_38, TMP_Module_instance_method_39, TMP_Module_instance_methods_40, TMP_Module_included_41, TMP_Module_extended_42, TMP_Module_extend_object_43, TMP_Module_method_added_44, TMP_Module_method_removed_45, TMP_Module_method_undefined_46, TMP_Module_module_eval_47, TMP_Module_module_exec_49, TMP_Module_method_defined$q_50, TMP_Module_module_function_51, TMP_Module_name_52, TMP_Module_prepend_53, TMP_Module_prepend_features_54, TMP_Module_prepended_55, TMP_Module_remove_const_56, TMP_Module_to_s_57, TMP_Module_undef_method_58, TMP_Module_instance_variables_59, TMP_Module_dup_60, TMP_Module_copy_class_variables_61, TMP_Module_copy_constants_62; + + + Opal.defs(self, '$allocate', TMP_Module_allocate_1 = function $$allocate() { + var self = this; + + + var module = Opal.allocate_module(nil, function(){}); + return module; + + }, TMP_Module_allocate_1.$$arity = 0); + Opal.defs(self, '$inherited', TMP_Module_inherited_2 = function $$inherited(klass) { + var self = this; + + + klass.$allocate = function() { + var module = Opal.allocate_module(nil, function(){}); + Object.setPrototypeOf(module, klass.prototype); + return module; + } + + }, TMP_Module_inherited_2.$$arity = 1); + + Opal.def(self, '$initialize', TMP_Module_initialize_3 = function $$initialize() { + var $iter = TMP_Module_initialize_3.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Module_initialize_3.$$p = null; + + + if ($iter) TMP_Module_initialize_3.$$p = null;; + if ((block !== nil)) { + return $send(self, 'module_eval', [], block.$to_proc()) + } else { + return nil + }; + }, TMP_Module_initialize_3.$$arity = 0); + + Opal.def(self, '$===', TMP_Module_$eq$eq$eq_4 = function(object) { + var self = this; + + + if ($truthy(object == null)) { + return false}; + return Opal.is_a(object, self);; + }, TMP_Module_$eq$eq$eq_4.$$arity = 1); + + Opal.def(self, '$<', TMP_Module_$lt_5 = function(other) { + var self = this; + + + if ($truthy($$($nesting, 'Module')['$==='](other))) { + } else { + self.$raise($$($nesting, 'TypeError'), "compared with non class/module") + }; + + var working = self, + ancestors, + i, length; + + if (working === other) { + return false; + } + + for (i = 0, ancestors = Opal.ancestors(self), length = ancestors.length; i < length; i++) { + if (ancestors[i] === other) { + return true; + } + } + + for (i = 0, ancestors = Opal.ancestors(other), length = ancestors.length; i < length; i++) { + if (ancestors[i] === self) { + return false; + } + } + + return nil; + ; + }, TMP_Module_$lt_5.$$arity = 1); + + Opal.def(self, '$<=', TMP_Module_$lt$eq_6 = function(other) { + var $a, self = this; + + return ($truthy($a = self['$equal?'](other)) ? $a : $rb_lt(self, other)) + }, TMP_Module_$lt$eq_6.$$arity = 1); + + Opal.def(self, '$>', TMP_Module_$gt_7 = function(other) { + var self = this; + + + if ($truthy($$($nesting, 'Module')['$==='](other))) { + } else { + self.$raise($$($nesting, 'TypeError'), "compared with non class/module") + }; + return $rb_lt(other, self); + }, TMP_Module_$gt_7.$$arity = 1); + + Opal.def(self, '$>=', TMP_Module_$gt$eq_8 = function(other) { + var $a, self = this; + + return ($truthy($a = self['$equal?'](other)) ? $a : $rb_gt(self, other)) + }, TMP_Module_$gt$eq_8.$$arity = 1); + + Opal.def(self, '$<=>', TMP_Module_$lt$eq$gt_9 = function(other) { + var self = this, lt = nil; + + + + if (self === other) { + return 0; + } + ; + if ($truthy($$($nesting, 'Module')['$==='](other))) { + } else { + return nil + }; + lt = $rb_lt(self, other); + if ($truthy(lt['$nil?']())) { + return nil}; + if ($truthy(lt)) { + return -1 + } else { + return 1 + }; + }, TMP_Module_$lt$eq$gt_9.$$arity = 1); + + Opal.def(self, '$alias_method', TMP_Module_alias_method_10 = function $$alias_method(newname, oldname) { + var self = this; + + + Opal.alias(self, newname, oldname); + return self; + }, TMP_Module_alias_method_10.$$arity = 2); + + Opal.def(self, '$alias_native', TMP_Module_alias_native_11 = function $$alias_native(mid, jsid) { + var self = this; + + + + if (jsid == null) { + jsid = mid; + }; + Opal.alias_native(self, mid, jsid); + return self; + }, TMP_Module_alias_native_11.$$arity = -2); + + Opal.def(self, '$ancestors', TMP_Module_ancestors_12 = function $$ancestors() { + var self = this; + + return Opal.ancestors(self); + }, TMP_Module_ancestors_12.$$arity = 0); + + Opal.def(self, '$append_features', TMP_Module_append_features_13 = function $$append_features(includer) { + var self = this; + + + Opal.append_features(self, includer); + return self; + }, TMP_Module_append_features_13.$$arity = 1); + + Opal.def(self, '$attr_accessor', TMP_Module_attr_accessor_14 = function $$attr_accessor($a) { + var $post_args, names, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + names = $post_args;; + $send(self, 'attr_reader', Opal.to_a(names)); + return $send(self, 'attr_writer', Opal.to_a(names)); + }, TMP_Module_attr_accessor_14.$$arity = -1); + Opal.alias(self, "attr", "attr_accessor"); + + Opal.def(self, '$attr_reader', TMP_Module_attr_reader_15 = function $$attr_reader($a) { + var $post_args, names, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + names = $post_args;; + + var proto = self.prototype; + + for (var i = names.length - 1; i >= 0; i--) { + var name = names[i], + id = '$' + name, + ivar = Opal.ivar(name); + + // the closure here is needed because name will change at the next + // cycle, I wish we could use let. + var body = (function(ivar) { + return function() { + if (this[ivar] == null) { + return nil; + } + else { + return this[ivar]; + } + }; + })(ivar); + + // initialize the instance variable as nil + Opal.defineProperty(proto, ivar, nil); + + body.$$parameters = []; + body.$$arity = 0; + + Opal.defn(self, id, body); + } + ; + return nil; + }, TMP_Module_attr_reader_15.$$arity = -1); + + Opal.def(self, '$attr_writer', TMP_Module_attr_writer_16 = function $$attr_writer($a) { + var $post_args, names, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + names = $post_args;; + + var proto = self.prototype; + + for (var i = names.length - 1; i >= 0; i--) { + var name = names[i], + id = '$' + name + '=', + ivar = Opal.ivar(name); + + // the closure here is needed because name will change at the next + // cycle, I wish we could use let. + var body = (function(ivar){ + return function(value) { + return this[ivar] = value; + } + })(ivar); + + body.$$parameters = [['req']]; + body.$$arity = 1; + + // initialize the instance variable as nil + Opal.defineProperty(proto, ivar, nil); + + Opal.defn(self, id, body); + } + ; + return nil; + }, TMP_Module_attr_writer_16.$$arity = -1); + + Opal.def(self, '$autoload', TMP_Module_autoload_17 = function $$autoload(const$, path) { + var self = this; + + + if (self.$$autoload == null) self.$$autoload = {}; + Opal.const_cache_version++; + self.$$autoload[const$] = path; + return nil; + + }, TMP_Module_autoload_17.$$arity = 2); + + Opal.def(self, '$class_variables', TMP_Module_class_variables_18 = function $$class_variables() { + var self = this; + + return Object.keys(Opal.class_variables(self)); + }, TMP_Module_class_variables_18.$$arity = 0); + + Opal.def(self, '$class_variable_get', TMP_Module_class_variable_get_19 = function $$class_variable_get(name) { + var self = this; + + + name = $$($nesting, 'Opal')['$class_variable_name!'](name); + + var value = Opal.class_variables(self)[name]; + if (value == null) { + self.$raise($$($nesting, 'NameError').$new("" + "uninitialized class variable " + (name) + " in " + (self), name)) + } + return value; + ; + }, TMP_Module_class_variable_get_19.$$arity = 1); + + Opal.def(self, '$class_variable_set', TMP_Module_class_variable_set_20 = function $$class_variable_set(name, value) { + var self = this; + + + name = $$($nesting, 'Opal')['$class_variable_name!'](name); + return Opal.class_variable_set(self, name, value);; + }, TMP_Module_class_variable_set_20.$$arity = 2); + + Opal.def(self, '$class_variable_defined?', TMP_Module_class_variable_defined$q_21 = function(name) { + var self = this; + + + name = $$($nesting, 'Opal')['$class_variable_name!'](name); + return Opal.class_variables(self).hasOwnProperty(name);; + }, TMP_Module_class_variable_defined$q_21.$$arity = 1); + + Opal.def(self, '$remove_class_variable', TMP_Module_remove_class_variable_22 = function $$remove_class_variable(name) { + var self = this; + + + name = $$($nesting, 'Opal')['$class_variable_name!'](name); + + if (Opal.hasOwnProperty.call(self.$$cvars, name)) { + var value = self.$$cvars[name]; + delete self.$$cvars[name]; + return value; + } else { + self.$raise($$($nesting, 'NameError'), "" + "cannot remove " + (name) + " for " + (self)) + } + ; + }, TMP_Module_remove_class_variable_22.$$arity = 1); + + Opal.def(self, '$constants', TMP_Module_constants_23 = function $$constants(inherit) { + var self = this; + + + + if (inherit == null) { + inherit = true; + }; + return Opal.constants(self, inherit);; + }, TMP_Module_constants_23.$$arity = -1); + Opal.defs(self, '$constants', TMP_Module_constants_24 = function $$constants(inherit) { + var self = this; + + + ; + + if (inherit == null) { + var nesting = (self.$$nesting || []).concat(Opal.Object), + constant, constants = {}, + i, ii; + + for(i = 0, ii = nesting.length; i < ii; i++) { + for (constant in nesting[i].$$const) { + constants[constant] = true; + } + } + return Object.keys(constants); + } else { + return Opal.constants(self, inherit) + } + ; + }, TMP_Module_constants_24.$$arity = -1); + Opal.defs(self, '$nesting', TMP_Module_nesting_25 = function $$nesting() { + var self = this; + + return self.$$nesting || []; + }, TMP_Module_nesting_25.$$arity = 0); + + Opal.def(self, '$const_defined?', TMP_Module_const_defined$q_26 = function(name, inherit) { + var self = this; + + + + if (inherit == null) { + inherit = true; + }; + name = $$($nesting, 'Opal')['$const_name!'](name); + if ($truthy(name['$=~']($$$($$($nesting, 'Opal'), 'CONST_NAME_REGEXP')))) { + } else { + self.$raise($$($nesting, 'NameError').$new("" + "wrong constant name " + (name), name)) + }; + + var module, modules = [self], module_constants, i, ii; + + // Add up ancestors if inherit is true + if (inherit) { + modules = modules.concat(Opal.ancestors(self)); + + // Add Object's ancestors if it's a module – modules have no ancestors otherwise + if (self.$$is_module) { + modules = modules.concat([Opal.Object]).concat(Opal.ancestors(Opal.Object)); + } + } + + for (i = 0, ii = modules.length; i < ii; i++) { + module = modules[i]; + if (module.$$const[name] != null) { + return true; + } + } + + return false; + ; + }, TMP_Module_const_defined$q_26.$$arity = -2); + + Opal.def(self, '$const_get', TMP_Module_const_get_27 = function $$const_get(name, inherit) { + var TMP_28, self = this; + + + + if (inherit == null) { + inherit = true; + }; + name = $$($nesting, 'Opal')['$const_name!'](name); + + if (name.indexOf('::') === 0 && name !== '::'){ + name = name.slice(2); + } + ; + if ($truthy(name.indexOf('::') != -1 && name != '::')) { + return $send(name.$split("::"), 'inject', [self], (TMP_28 = function(o, c){var self = TMP_28.$$s || this; + + + + if (o == null) { + o = nil; + }; + + if (c == null) { + c = nil; + }; + return o.$const_get(c);}, TMP_28.$$s = self, TMP_28.$$arity = 2, TMP_28))}; + if ($truthy(name['$=~']($$$($$($nesting, 'Opal'), 'CONST_NAME_REGEXP')))) { + } else { + self.$raise($$($nesting, 'NameError').$new("" + "wrong constant name " + (name), name)) + }; + + if (inherit) { + return $$([self], name); + } else { + return Opal.const_get_local(self, name); + } + ; + }, TMP_Module_const_get_27.$$arity = -2); + + Opal.def(self, '$const_missing', TMP_Module_const_missing_29 = function $$const_missing(name) { + var self = this, full_const_name = nil; + + + + if (self.$$autoload) { + var file = self.$$autoload[name]; + + if (file) { + self.$require(file); + + return self.$const_get(name); + } + } + ; + full_const_name = (function() {if (self['$==']($$($nesting, 'Object'))) { + return name + } else { + return "" + (self) + "::" + (name) + }; return nil; })(); + return self.$raise($$($nesting, 'NameError').$new("" + "uninitialized constant " + (full_const_name), name)); + }, TMP_Module_const_missing_29.$$arity = 1); + + Opal.def(self, '$const_set', TMP_Module_const_set_30 = function $$const_set(name, value) { + var $a, self = this; + + + name = $$($nesting, 'Opal')['$const_name!'](name); + if ($truthy(($truthy($a = name['$!~']($$$($$($nesting, 'Opal'), 'CONST_NAME_REGEXP'))) ? $a : name['$start_with?']("::")))) { + self.$raise($$($nesting, 'NameError').$new("" + "wrong constant name " + (name), name))}; + Opal.const_set(self, name, value); + return value; + }, TMP_Module_const_set_30.$$arity = 2); + + Opal.def(self, '$public_constant', TMP_Module_public_constant_31 = function $$public_constant(const_name) { + var self = this; + + return nil + }, TMP_Module_public_constant_31.$$arity = 1); + + Opal.def(self, '$define_method', TMP_Module_define_method_32 = function $$define_method(name, method) { + var $iter = TMP_Module_define_method_32.$$p, block = $iter || nil, $a, TMP_33, self = this, $case = nil; + + if ($iter) TMP_Module_define_method_32.$$p = null; + + + if ($iter) TMP_Module_define_method_32.$$p = null;; + ; + if ($truthy(method === undefined && block === nil)) { + self.$raise($$($nesting, 'ArgumentError'), "tried to create a Proc object without a block")}; + block = ($truthy($a = block) ? $a : (function() {$case = method; + if ($$($nesting, 'Proc')['$===']($case)) {return method} + else if ($$($nesting, 'Method')['$===']($case)) {return method.$to_proc().$$unbound} + else if ($$($nesting, 'UnboundMethod')['$===']($case)) {return $lambda((TMP_33 = function($b){var self = TMP_33.$$s || this, $post_args, args, bound = nil; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + bound = method.$bind(self); + return $send(bound, 'call', Opal.to_a(args));}, TMP_33.$$s = self, TMP_33.$$arity = -1, TMP_33))} + else {return self.$raise($$($nesting, 'TypeError'), "" + "wrong argument type " + (block.$class()) + " (expected Proc/Method)")}})()); + + var id = '$' + name; + + block.$$jsid = name; + block.$$s = null; + block.$$def = block; + block.$$define_meth = true; + + Opal.defn(self, id, block); + + return name; + ; + }, TMP_Module_define_method_32.$$arity = -2); + + Opal.def(self, '$remove_method', TMP_Module_remove_method_34 = function $$remove_method($a) { + var $post_args, names, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + names = $post_args;; + + for (var i = 0, length = names.length; i < length; i++) { + Opal.rdef(self, "$" + names[i]); + } + ; + return self; + }, TMP_Module_remove_method_34.$$arity = -1); + + Opal.def(self, '$singleton_class?', TMP_Module_singleton_class$q_35 = function() { + var self = this; + + return !!self.$$is_singleton; + }, TMP_Module_singleton_class$q_35.$$arity = 0); + + Opal.def(self, '$include', TMP_Module_include_36 = function $$include($a) { + var $post_args, mods, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + mods = $post_args;; + + for (var i = mods.length - 1; i >= 0; i--) { + var mod = mods[i]; + + if (!mod.$$is_module) { + self.$raise($$($nesting, 'TypeError'), "" + "wrong argument type " + ((mod).$class()) + " (expected Module)"); + } + + (mod).$append_features(self); + (mod).$included(self); + } + ; + return self; + }, TMP_Module_include_36.$$arity = -1); + + Opal.def(self, '$included_modules', TMP_Module_included_modules_37 = function $$included_modules() { + var self = this; + + return Opal.included_modules(self); + }, TMP_Module_included_modules_37.$$arity = 0); + + Opal.def(self, '$include?', TMP_Module_include$q_38 = function(mod) { + var self = this; + + + if (!mod.$$is_module) { + self.$raise($$($nesting, 'TypeError'), "" + "wrong argument type " + ((mod).$class()) + " (expected Module)"); + } + + var i, ii, mod2, ancestors = Opal.ancestors(self); + + for (i = 0, ii = ancestors.length; i < ii; i++) { + mod2 = ancestors[i]; + if (mod2 === mod && mod2 !== self) { + return true; + } + } + + return false; + + }, TMP_Module_include$q_38.$$arity = 1); + + Opal.def(self, '$instance_method', TMP_Module_instance_method_39 = function $$instance_method(name) { + var self = this; + + + var meth = self.prototype['$' + name]; + + if (!meth || meth.$$stub) { + self.$raise($$($nesting, 'NameError').$new("" + "undefined method `" + (name) + "' for class `" + (self.$name()) + "'", name)); + } + + return $$($nesting, 'UnboundMethod').$new(self, meth.$$owner || self, meth, name); + + }, TMP_Module_instance_method_39.$$arity = 1); + + Opal.def(self, '$instance_methods', TMP_Module_instance_methods_40 = function $$instance_methods(include_super) { + var self = this; + + + + if (include_super == null) { + include_super = true; + }; + + if ($truthy(include_super)) { + return Opal.instance_methods(self); + } else { + return Opal.own_instance_methods(self); + } + ; + }, TMP_Module_instance_methods_40.$$arity = -1); + + Opal.def(self, '$included', TMP_Module_included_41 = function $$included(mod) { + var self = this; + + return nil + }, TMP_Module_included_41.$$arity = 1); + + Opal.def(self, '$extended', TMP_Module_extended_42 = function $$extended(mod) { + var self = this; + + return nil + }, TMP_Module_extended_42.$$arity = 1); + + Opal.def(self, '$extend_object', TMP_Module_extend_object_43 = function $$extend_object(object) { + var self = this; + + return nil + }, TMP_Module_extend_object_43.$$arity = 1); + + Opal.def(self, '$method_added', TMP_Module_method_added_44 = function $$method_added($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return nil; + }, TMP_Module_method_added_44.$$arity = -1); + + Opal.def(self, '$method_removed', TMP_Module_method_removed_45 = function $$method_removed($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return nil; + }, TMP_Module_method_removed_45.$$arity = -1); + + Opal.def(self, '$method_undefined', TMP_Module_method_undefined_46 = function $$method_undefined($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return nil; + }, TMP_Module_method_undefined_46.$$arity = -1); + + Opal.def(self, '$module_eval', TMP_Module_module_eval_47 = function $$module_eval($a) { + var $iter = TMP_Module_module_eval_47.$$p, block = $iter || nil, $post_args, args, $b, TMP_48, self = this, string = nil, file = nil, _lineno = nil, default_eval_options = nil, compiling_options = nil, compiled = nil; + + if ($iter) TMP_Module_module_eval_47.$$p = null; + + + if ($iter) TMP_Module_module_eval_47.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + if ($truthy(($truthy($b = block['$nil?']()) ? !!Opal.compile : $b))) { + + if ($truthy($range(1, 3, false)['$cover?'](args.$size()))) { + } else { + $$($nesting, 'Kernel').$raise($$($nesting, 'ArgumentError'), "wrong number of arguments (0 for 1..3)") + }; + $b = [].concat(Opal.to_a(args)), (string = ($b[0] == null ? nil : $b[0])), (file = ($b[1] == null ? nil : $b[1])), (_lineno = ($b[2] == null ? nil : $b[2])), $b; + default_eval_options = $hash2(["file", "eval"], {"file": ($truthy($b = file) ? $b : "(eval)"), "eval": true}); + compiling_options = Opal.hash({ arity_check: false }).$merge(default_eval_options); + compiled = $$($nesting, 'Opal').$compile(string, compiling_options); + block = $send($$($nesting, 'Kernel'), 'proc', [], (TMP_48 = function(){var self = TMP_48.$$s || this; + + + return (function(self) { + return eval(compiled); + })(self) + }, TMP_48.$$s = self, TMP_48.$$arity = 0, TMP_48)); + } else if ($truthy(args['$any?']())) { + $$($nesting, 'Kernel').$raise($$($nesting, 'ArgumentError'), "" + ("" + "wrong number of arguments (" + (args.$size()) + " for 0)") + "\n\n NOTE:If you want to enable passing a String argument please add \"require 'opal-parser'\" to your script\n")}; + + var old = block.$$s, + result; + + block.$$s = null; + result = block.apply(self, [self]); + block.$$s = old; + + return result; + ; + }, TMP_Module_module_eval_47.$$arity = -1); + Opal.alias(self, "class_eval", "module_eval"); + + Opal.def(self, '$module_exec', TMP_Module_module_exec_49 = function $$module_exec($a) { + var $iter = TMP_Module_module_exec_49.$$p, block = $iter || nil, $post_args, args, self = this; + + if ($iter) TMP_Module_module_exec_49.$$p = null; + + + if ($iter) TMP_Module_module_exec_49.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + + if (block === nil) { + self.$raise($$($nesting, 'LocalJumpError'), "no block given") + } + + var block_self = block.$$s, result; + + block.$$s = null; + result = block.apply(self, args); + block.$$s = block_self; + + return result; + ; + }, TMP_Module_module_exec_49.$$arity = -1); + Opal.alias(self, "class_exec", "module_exec"); + + Opal.def(self, '$method_defined?', TMP_Module_method_defined$q_50 = function(method) { + var self = this; + + + var body = self.prototype['$' + method]; + return (!!body) && !body.$$stub; + + }, TMP_Module_method_defined$q_50.$$arity = 1); + + Opal.def(self, '$module_function', TMP_Module_module_function_51 = function $$module_function($a) { + var $post_args, methods, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + methods = $post_args;; + + if (methods.length === 0) { + self.$$module_function = true; + } + else { + for (var i = 0, length = methods.length; i < length; i++) { + var meth = methods[i], + id = '$' + meth, + func = self.prototype[id]; + + Opal.defs(self, id, func); + } + } + + return self; + ; + }, TMP_Module_module_function_51.$$arity = -1); + + Opal.def(self, '$name', TMP_Module_name_52 = function $$name() { + var self = this; + + + if (self.$$full_name) { + return self.$$full_name; + } + + var result = [], base = self; + + while (base) { + // Give up if any of the ancestors is unnamed + if (base.$$name === nil || base.$$name == null) return nil; + + result.unshift(base.$$name); + + base = base.$$base_module; + + if (base === Opal.Object) { + break; + } + } + + if (result.length === 0) { + return nil; + } + + return self.$$full_name = result.join('::'); + + }, TMP_Module_name_52.$$arity = 0); + + Opal.def(self, '$prepend', TMP_Module_prepend_53 = function $$prepend($a) { + var $post_args, mods, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + mods = $post_args;; + + if (mods.length === 0) { + self.$raise($$($nesting, 'ArgumentError'), "wrong number of arguments (given 0, expected 1+)") + } + + for (var i = mods.length - 1; i >= 0; i--) { + var mod = mods[i]; + + if (!mod.$$is_module) { + self.$raise($$($nesting, 'TypeError'), "" + "wrong argument type " + ((mod).$class()) + " (expected Module)"); + } + + (mod).$prepend_features(self); + (mod).$prepended(self); + } + ; + return self; + }, TMP_Module_prepend_53.$$arity = -1); + + Opal.def(self, '$prepend_features', TMP_Module_prepend_features_54 = function $$prepend_features(prepender) { + var self = this; + + + + if (!self.$$is_module) { + self.$raise($$($nesting, 'TypeError'), "" + "wrong argument type " + (self.$class()) + " (expected Module)"); + } + + Opal.prepend_features(self, prepender) + ; + return self; + }, TMP_Module_prepend_features_54.$$arity = 1); + + Opal.def(self, '$prepended', TMP_Module_prepended_55 = function $$prepended(mod) { + var self = this; + + return nil + }, TMP_Module_prepended_55.$$arity = 1); + + Opal.def(self, '$remove_const', TMP_Module_remove_const_56 = function $$remove_const(name) { + var self = this; + + return Opal.const_remove(self, name); + }, TMP_Module_remove_const_56.$$arity = 1); + + Opal.def(self, '$to_s', TMP_Module_to_s_57 = function $$to_s() { + var $a, self = this; + + return ($truthy($a = Opal.Module.$name.call(self)) ? $a : "" + "#<" + (self.$$is_module ? 'Module' : 'Class') + ":0x" + (self.$__id__().$to_s(16)) + ">") + }, TMP_Module_to_s_57.$$arity = 0); + + Opal.def(self, '$undef_method', TMP_Module_undef_method_58 = function $$undef_method($a) { + var $post_args, names, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + names = $post_args;; + + for (var i = 0, length = names.length; i < length; i++) { + Opal.udef(self, "$" + names[i]); + } + ; + return self; + }, TMP_Module_undef_method_58.$$arity = -1); + + Opal.def(self, '$instance_variables', TMP_Module_instance_variables_59 = function $$instance_variables() { + var self = this, consts = nil; + + + consts = (Opal.Module.$$nesting = $nesting, self.$constants()); + + var result = []; + + for (var name in self) { + if (self.hasOwnProperty(name) && name.charAt(0) !== '$' && name !== 'constructor' && !consts['$include?'](name)) { + result.push('@' + name); + } + } + + return result; + ; + }, TMP_Module_instance_variables_59.$$arity = 0); + + Opal.def(self, '$dup', TMP_Module_dup_60 = function $$dup() { + var $iter = TMP_Module_dup_60.$$p, $yield = $iter || nil, self = this, copy = nil, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_Module_dup_60.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + + copy = $send(self, Opal.find_super_dispatcher(self, 'dup', TMP_Module_dup_60, false), $zuper, $iter); + copy.$copy_class_variables(self); + copy.$copy_constants(self); + return copy; + }, TMP_Module_dup_60.$$arity = 0); + + Opal.def(self, '$copy_class_variables', TMP_Module_copy_class_variables_61 = function $$copy_class_variables(other) { + var self = this; + + + for (var name in other.$$cvars) { + self.$$cvars[name] = other.$$cvars[name]; + } + + }, TMP_Module_copy_class_variables_61.$$arity = 1); + return (Opal.def(self, '$copy_constants', TMP_Module_copy_constants_62 = function $$copy_constants(other) { + var self = this; + + + var name, other_constants = other.$$const; + + for (name in other_constants) { + Opal.const_set(self, name, other_constants[name]); + } + + }, TMP_Module_copy_constants_62.$$arity = 1), nil) && 'copy_constants'; + })($nesting[0], null, $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/class"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $send = Opal.send; + + Opal.add_stubs(['$require', '$class_eval', '$to_proc', '$initialize_copy', '$allocate', '$name', '$to_s']); + + self.$require("corelib/module"); + return (function($base, $super, $parent_nesting) { + function $Class(){}; + var self = $Class = $klass($base, $super, 'Class', $Class); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Class_new_1, TMP_Class_allocate_2, TMP_Class_inherited_3, TMP_Class_initialize_dup_4, TMP_Class_new_5, TMP_Class_superclass_6, TMP_Class_to_s_7; + + + Opal.defs(self, '$new', TMP_Class_new_1 = function(superclass) { + var $iter = TMP_Class_new_1.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Class_new_1.$$p = null; + + + if ($iter) TMP_Class_new_1.$$p = null;; + + if (superclass == null) { + superclass = $$($nesting, 'Object'); + }; + + if (!superclass.$$is_class) { + throw Opal.TypeError.$new("superclass must be a Class"); + } + + var klass = Opal.allocate_class(nil, superclass, function(){}); + superclass.$inherited(klass); + (function() {if ((block !== nil)) { + return $send((klass), 'class_eval', [], block.$to_proc()) + } else { + return nil + }; return nil; })() + return klass; + ; + }, TMP_Class_new_1.$$arity = -1); + + Opal.def(self, '$allocate', TMP_Class_allocate_2 = function $$allocate() { + var self = this; + + + var obj = new self(); + obj.$$id = Opal.uid(); + return obj; + + }, TMP_Class_allocate_2.$$arity = 0); + + Opal.def(self, '$inherited', TMP_Class_inherited_3 = function $$inherited(cls) { + var self = this; + + return nil + }, TMP_Class_inherited_3.$$arity = 1); + + Opal.def(self, '$initialize_dup', TMP_Class_initialize_dup_4 = function $$initialize_dup(original) { + var self = this; + + + self.$initialize_copy(original); + + self.$$name = null; + self.$$full_name = null; + ; + }, TMP_Class_initialize_dup_4.$$arity = 1); + + Opal.def(self, '$new', TMP_Class_new_5 = function($a) { + var $iter = TMP_Class_new_5.$$p, block = $iter || nil, $post_args, args, self = this; + + if ($iter) TMP_Class_new_5.$$p = null; + + + if ($iter) TMP_Class_new_5.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + + var object = self.$allocate(); + Opal.send(object, object.$initialize, args, block); + return object; + ; + }, TMP_Class_new_5.$$arity = -1); + + Opal.def(self, '$superclass', TMP_Class_superclass_6 = function $$superclass() { + var self = this; + + return self.$$super || nil; + }, TMP_Class_superclass_6.$$arity = 0); + return (Opal.def(self, '$to_s', TMP_Class_to_s_7 = function $$to_s() { + var $iter = TMP_Class_to_s_7.$$p, $yield = $iter || nil, self = this; + + if ($iter) TMP_Class_to_s_7.$$p = null; + + var singleton_of = self.$$singleton_of; + + if (singleton_of && (singleton_of.$$is_a_module)) { + return "" + "#"; + } + else if (singleton_of) { + // a singleton class created from an object + return "" + "#>"; + } + return $send(self, Opal.find_super_dispatcher(self, 'to_s', TMP_Class_to_s_7, false), [], null); + + }, TMP_Class_to_s_7.$$arity = 0), nil) && 'to_s'; + })($nesting[0], null, $nesting); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/basic_object"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $truthy = Opal.truthy, $range = Opal.range, $hash2 = Opal.hash2, $send = Opal.send; + + Opal.add_stubs(['$==', '$!', '$nil?', '$cover?', '$size', '$raise', '$merge', '$compile', '$proc', '$any?', '$inspect', '$new']); + return (function($base, $super, $parent_nesting) { + function $BasicObject(){}; + var self = $BasicObject = $klass($base, $super, 'BasicObject', $BasicObject); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_BasicObject_initialize_1, TMP_BasicObject_$eq$eq_2, TMP_BasicObject_eql$q_3, TMP_BasicObject___id___4, TMP_BasicObject___send___5, TMP_BasicObject_$B_6, TMP_BasicObject_$B$eq_7, TMP_BasicObject_instance_eval_8, TMP_BasicObject_instance_exec_10, TMP_BasicObject_singleton_method_added_11, TMP_BasicObject_singleton_method_removed_12, TMP_BasicObject_singleton_method_undefined_13, TMP_BasicObject_class_14, TMP_BasicObject_method_missing_15; + + + + Opal.def(self, '$initialize', TMP_BasicObject_initialize_1 = function $$initialize($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return nil; + }, TMP_BasicObject_initialize_1.$$arity = -1); + + Opal.def(self, '$==', TMP_BasicObject_$eq$eq_2 = function(other) { + var self = this; + + return self === other; + }, TMP_BasicObject_$eq$eq_2.$$arity = 1); + + Opal.def(self, '$eql?', TMP_BasicObject_eql$q_3 = function(other) { + var self = this; + + return self['$=='](other) + }, TMP_BasicObject_eql$q_3.$$arity = 1); + Opal.alias(self, "equal?", "=="); + + Opal.def(self, '$__id__', TMP_BasicObject___id___4 = function $$__id__() { + var self = this; + + + if (self.$$id != null) { + return self.$$id; + } + Opal.defineProperty(self, '$$id', Opal.uid()); + return self.$$id; + + }, TMP_BasicObject___id___4.$$arity = 0); + + Opal.def(self, '$__send__', TMP_BasicObject___send___5 = function $$__send__(symbol, $a) { + var $iter = TMP_BasicObject___send___5.$$p, block = $iter || nil, $post_args, args, self = this; + + if ($iter) TMP_BasicObject___send___5.$$p = null; + + + if ($iter) TMP_BasicObject___send___5.$$p = null;; + + $post_args = Opal.slice.call(arguments, 1, arguments.length); + + args = $post_args;; + + var func = self['$' + symbol] + + if (func) { + if (block !== nil) { + func.$$p = block; + } + + return func.apply(self, args); + } + + if (block !== nil) { + self.$method_missing.$$p = block; + } + + return self.$method_missing.apply(self, [symbol].concat(args)); + ; + }, TMP_BasicObject___send___5.$$arity = -2); + + Opal.def(self, '$!', TMP_BasicObject_$B_6 = function() { + var self = this; + + return false + }, TMP_BasicObject_$B_6.$$arity = 0); + + Opal.def(self, '$!=', TMP_BasicObject_$B$eq_7 = function(other) { + var self = this; + + return self['$=='](other)['$!']() + }, TMP_BasicObject_$B$eq_7.$$arity = 1); + + Opal.def(self, '$instance_eval', TMP_BasicObject_instance_eval_8 = function $$instance_eval($a) { + var $iter = TMP_BasicObject_instance_eval_8.$$p, block = $iter || nil, $post_args, args, $b, TMP_9, self = this, string = nil, file = nil, _lineno = nil, default_eval_options = nil, compiling_options = nil, compiled = nil; + + if ($iter) TMP_BasicObject_instance_eval_8.$$p = null; + + + if ($iter) TMP_BasicObject_instance_eval_8.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + if ($truthy(($truthy($b = block['$nil?']()) ? !!Opal.compile : $b))) { + + if ($truthy($range(1, 3, false)['$cover?'](args.$size()))) { + } else { + $$$('::', 'Kernel').$raise($$$('::', 'ArgumentError'), "wrong number of arguments (0 for 1..3)") + }; + $b = [].concat(Opal.to_a(args)), (string = ($b[0] == null ? nil : $b[0])), (file = ($b[1] == null ? nil : $b[1])), (_lineno = ($b[2] == null ? nil : $b[2])), $b; + default_eval_options = $hash2(["file", "eval"], {"file": ($truthy($b = file) ? $b : "(eval)"), "eval": true}); + compiling_options = Opal.hash({ arity_check: false }).$merge(default_eval_options); + compiled = $$$('::', 'Opal').$compile(string, compiling_options); + block = $send($$$('::', 'Kernel'), 'proc', [], (TMP_9 = function(){var self = TMP_9.$$s || this; + + + return (function(self) { + return eval(compiled); + })(self) + }, TMP_9.$$s = self, TMP_9.$$arity = 0, TMP_9)); + } else if ($truthy(args['$any?']())) { + $$$('::', 'Kernel').$raise($$$('::', 'ArgumentError'), "" + "wrong number of arguments (" + (args.$size()) + " for 0)")}; + + var old = block.$$s, + result; + + block.$$s = null; + + // Need to pass $$eval so that method definitions know if this is + // being done on a class/module. Cannot be compiler driven since + // send(:instance_eval) needs to work. + if (self.$$is_a_module) { + self.$$eval = true; + try { + result = block.call(self, self); + } + finally { + self.$$eval = false; + } + } + else { + result = block.call(self, self); + } + + block.$$s = old; + + return result; + ; + }, TMP_BasicObject_instance_eval_8.$$arity = -1); + + Opal.def(self, '$instance_exec', TMP_BasicObject_instance_exec_10 = function $$instance_exec($a) { + var $iter = TMP_BasicObject_instance_exec_10.$$p, block = $iter || nil, $post_args, args, self = this; + + if ($iter) TMP_BasicObject_instance_exec_10.$$p = null; + + + if ($iter) TMP_BasicObject_instance_exec_10.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + if ($truthy(block)) { + } else { + $$$('::', 'Kernel').$raise($$$('::', 'ArgumentError'), "no block given") + }; + + var block_self = block.$$s, + result; + + block.$$s = null; + + if (self.$$is_a_module) { + self.$$eval = true; + try { + result = block.apply(self, args); + } + finally { + self.$$eval = false; + } + } + else { + result = block.apply(self, args); + } + + block.$$s = block_self; + + return result; + ; + }, TMP_BasicObject_instance_exec_10.$$arity = -1); + + Opal.def(self, '$singleton_method_added', TMP_BasicObject_singleton_method_added_11 = function $$singleton_method_added($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return nil; + }, TMP_BasicObject_singleton_method_added_11.$$arity = -1); + + Opal.def(self, '$singleton_method_removed', TMP_BasicObject_singleton_method_removed_12 = function $$singleton_method_removed($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return nil; + }, TMP_BasicObject_singleton_method_removed_12.$$arity = -1); + + Opal.def(self, '$singleton_method_undefined', TMP_BasicObject_singleton_method_undefined_13 = function $$singleton_method_undefined($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return nil; + }, TMP_BasicObject_singleton_method_undefined_13.$$arity = -1); + + Opal.def(self, '$class', TMP_BasicObject_class_14 = function() { + var self = this; + + return self.$$class; + }, TMP_BasicObject_class_14.$$arity = 0); + return (Opal.def(self, '$method_missing', TMP_BasicObject_method_missing_15 = function $$method_missing(symbol, $a) { + var $iter = TMP_BasicObject_method_missing_15.$$p, block = $iter || nil, $post_args, args, self = this, message = nil; + + if ($iter) TMP_BasicObject_method_missing_15.$$p = null; + + + if ($iter) TMP_BasicObject_method_missing_15.$$p = null;; + + $post_args = Opal.slice.call(arguments, 1, arguments.length); + + args = $post_args;; + message = (function() {if ($truthy(self.$inspect && !self.$inspect.$$stub)) { + return "" + "undefined method `" + (symbol) + "' for " + (self.$inspect()) + ":" + (self.$$class) + } else { + return "" + "undefined method `" + (symbol) + "' for " + (self.$$class) + }; return nil; })(); + return $$$('::', 'Kernel').$raise($$$('::', 'NoMethodError').$new(message, symbol)); + }, TMP_BasicObject_method_missing_15.$$arity = -2), nil) && 'method_missing'; + })($nesting[0], null, $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/kernel"] = function(Opal) { + function $rb_le(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs <= rhs : lhs['$<='](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $truthy = Opal.truthy, $gvars = Opal.gvars, $hash2 = Opal.hash2, $send = Opal.send, $klass = Opal.klass; + + Opal.add_stubs(['$raise', '$new', '$inspect', '$!', '$=~', '$==', '$object_id', '$class', '$coerce_to?', '$<<', '$allocate', '$copy_instance_variables', '$copy_singleton_methods', '$initialize_clone', '$initialize_copy', '$define_method', '$singleton_class', '$to_proc', '$initialize_dup', '$for', '$empty?', '$pop', '$call', '$coerce_to', '$append_features', '$extend_object', '$extended', '$length', '$respond_to?', '$[]', '$nil?', '$to_a', '$to_int', '$fetch', '$Integer', '$Float', '$to_ary', '$to_str', '$to_s', '$__id__', '$instance_variable_name!', '$coerce_to!', '$===', '$enum_for', '$result', '$any?', '$print', '$format', '$puts', '$each', '$<=', '$exception', '$is_a?', '$rand', '$respond_to_missing?', '$try_convert!', '$expand_path', '$join', '$start_with?', '$new_seed', '$srand', '$sym', '$arg', '$open', '$include']); + + (function($base, $parent_nesting) { + function $Kernel() {}; + var self = $Kernel = $module($base, 'Kernel', $Kernel); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Kernel_method_missing_1, TMP_Kernel_$eq$_2, TMP_Kernel_$B$_3, TMP_Kernel_$eq$eq$eq_4, TMP_Kernel_$lt$eq$gt_5, TMP_Kernel_method_6, TMP_Kernel_methods_7, TMP_Kernel_public_methods_8, TMP_Kernel_Array_9, TMP_Kernel_at_exit_10, TMP_Kernel_caller_11, TMP_Kernel_class_12, TMP_Kernel_copy_instance_variables_13, TMP_Kernel_copy_singleton_methods_14, TMP_Kernel_clone_15, TMP_Kernel_initialize_clone_16, TMP_Kernel_define_singleton_method_17, TMP_Kernel_dup_18, TMP_Kernel_initialize_dup_19, TMP_Kernel_enum_for_20, TMP_Kernel_equal$q_21, TMP_Kernel_exit_22, TMP_Kernel_extend_23, TMP_Kernel_format_24, TMP_Kernel_hash_25, TMP_Kernel_initialize_copy_26, TMP_Kernel_inspect_27, TMP_Kernel_instance_of$q_28, TMP_Kernel_instance_variable_defined$q_29, TMP_Kernel_instance_variable_get_30, TMP_Kernel_instance_variable_set_31, TMP_Kernel_remove_instance_variable_32, TMP_Kernel_instance_variables_33, TMP_Kernel_Integer_34, TMP_Kernel_Float_35, TMP_Kernel_Hash_36, TMP_Kernel_is_a$q_37, TMP_Kernel_itself_38, TMP_Kernel_lambda_39, TMP_Kernel_load_40, TMP_Kernel_loop_41, TMP_Kernel_nil$q_43, TMP_Kernel_printf_44, TMP_Kernel_proc_45, TMP_Kernel_puts_46, TMP_Kernel_p_47, TMP_Kernel_print_49, TMP_Kernel_warn_50, TMP_Kernel_raise_51, TMP_Kernel_rand_52, TMP_Kernel_respond_to$q_53, TMP_Kernel_respond_to_missing$q_54, TMP_Kernel_require_55, TMP_Kernel_require_relative_56, TMP_Kernel_require_tree_57, TMP_Kernel_singleton_class_58, TMP_Kernel_sleep_59, TMP_Kernel_srand_60, TMP_Kernel_String_61, TMP_Kernel_tap_62, TMP_Kernel_to_proc_63, TMP_Kernel_to_s_64, TMP_Kernel_catch_65, TMP_Kernel_throw_66, TMP_Kernel_open_67, TMP_Kernel_yield_self_68; + + + + Opal.def(self, '$method_missing', TMP_Kernel_method_missing_1 = function $$method_missing(symbol, $a) { + var $iter = TMP_Kernel_method_missing_1.$$p, block = $iter || nil, $post_args, args, self = this; + + if ($iter) TMP_Kernel_method_missing_1.$$p = null; + + + if ($iter) TMP_Kernel_method_missing_1.$$p = null;; + + $post_args = Opal.slice.call(arguments, 1, arguments.length); + + args = $post_args;; + return self.$raise($$($nesting, 'NoMethodError').$new("" + "undefined method `" + (symbol) + "' for " + (self.$inspect()), symbol, args)); + }, TMP_Kernel_method_missing_1.$$arity = -2); + + Opal.def(self, '$=~', TMP_Kernel_$eq$_2 = function(obj) { + var self = this; + + return false + }, TMP_Kernel_$eq$_2.$$arity = 1); + + Opal.def(self, '$!~', TMP_Kernel_$B$_3 = function(obj) { + var self = this; + + return self['$=~'](obj)['$!']() + }, TMP_Kernel_$B$_3.$$arity = 1); + + Opal.def(self, '$===', TMP_Kernel_$eq$eq$eq_4 = function(other) { + var $a, self = this; + + return ($truthy($a = self.$object_id()['$=='](other.$object_id())) ? $a : self['$=='](other)) + }, TMP_Kernel_$eq$eq$eq_4.$$arity = 1); + + Opal.def(self, '$<=>', TMP_Kernel_$lt$eq$gt_5 = function(other) { + var self = this; + + + // set guard for infinite recursion + self.$$comparable = true; + + var x = self['$=='](other); + + if (x && x !== nil) { + return 0; + } + + return nil; + + }, TMP_Kernel_$lt$eq$gt_5.$$arity = 1); + + Opal.def(self, '$method', TMP_Kernel_method_6 = function $$method(name) { + var self = this; + + + var meth = self['$' + name]; + + if (!meth || meth.$$stub) { + self.$raise($$($nesting, 'NameError').$new("" + "undefined method `" + (name) + "' for class `" + (self.$class()) + "'", name)); + } + + return $$($nesting, 'Method').$new(self, meth.$$owner || self.$class(), meth, name); + + }, TMP_Kernel_method_6.$$arity = 1); + + Opal.def(self, '$methods', TMP_Kernel_methods_7 = function $$methods(all) { + var self = this; + + + + if (all == null) { + all = true; + }; + + if ($truthy(all)) { + return Opal.methods(self); + } else { + return Opal.own_methods(self); + } + ; + }, TMP_Kernel_methods_7.$$arity = -1); + + Opal.def(self, '$public_methods', TMP_Kernel_public_methods_8 = function $$public_methods(all) { + var self = this; + + + + if (all == null) { + all = true; + }; + + if ($truthy(all)) { + return Opal.methods(self); + } else { + return Opal.receiver_methods(self); + } + ; + }, TMP_Kernel_public_methods_8.$$arity = -1); + + Opal.def(self, '$Array', TMP_Kernel_Array_9 = function $$Array(object) { + var self = this; + + + var coerced; + + if (object === nil) { + return []; + } + + if (object.$$is_array) { + return object; + } + + coerced = $$($nesting, 'Opal')['$coerce_to?'](object, $$($nesting, 'Array'), "to_ary"); + if (coerced !== nil) { return coerced; } + + coerced = $$($nesting, 'Opal')['$coerce_to?'](object, $$($nesting, 'Array'), "to_a"); + if (coerced !== nil) { return coerced; } + + return [object]; + + }, TMP_Kernel_Array_9.$$arity = 1); + + Opal.def(self, '$at_exit', TMP_Kernel_at_exit_10 = function $$at_exit() { + var $iter = TMP_Kernel_at_exit_10.$$p, block = $iter || nil, $a, self = this; + if ($gvars.__at_exit__ == null) $gvars.__at_exit__ = nil; + + if ($iter) TMP_Kernel_at_exit_10.$$p = null; + + + if ($iter) TMP_Kernel_at_exit_10.$$p = null;; + $gvars.__at_exit__ = ($truthy($a = $gvars.__at_exit__) ? $a : []); + return $gvars.__at_exit__['$<<'](block); + }, TMP_Kernel_at_exit_10.$$arity = 0); + + Opal.def(self, '$caller', TMP_Kernel_caller_11 = function $$caller($a) { + var $post_args, args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + return []; + }, TMP_Kernel_caller_11.$$arity = -1); + + Opal.def(self, '$class', TMP_Kernel_class_12 = function() { + var self = this; + + return self.$$class; + }, TMP_Kernel_class_12.$$arity = 0); + + Opal.def(self, '$copy_instance_variables', TMP_Kernel_copy_instance_variables_13 = function $$copy_instance_variables(other) { + var self = this; + + + var keys = Object.keys(other), i, ii, name; + for (i = 0, ii = keys.length; i < ii; i++) { + name = keys[i]; + if (name.charAt(0) !== '$' && other.hasOwnProperty(name)) { + self[name] = other[name]; + } + } + + }, TMP_Kernel_copy_instance_variables_13.$$arity = 1); + + Opal.def(self, '$copy_singleton_methods', TMP_Kernel_copy_singleton_methods_14 = function $$copy_singleton_methods(other) { + var self = this; + + + var i, name, names, length; + + if (other.hasOwnProperty('$$meta')) { + var other_singleton_class = Opal.get_singleton_class(other); + var self_singleton_class = Opal.get_singleton_class(self); + names = Object.getOwnPropertyNames(other_singleton_class.prototype); + + for (i = 0, length = names.length; i < length; i++) { + name = names[i]; + if (Opal.is_method(name)) { + self_singleton_class.prototype[name] = other_singleton_class.prototype[name]; + } + } + + self_singleton_class.$$const = Object.assign({}, other_singleton_class.$$const); + Object.setPrototypeOf( + self_singleton_class.prototype, + Object.getPrototypeOf(other_singleton_class.prototype) + ); + } + + for (i = 0, names = Object.getOwnPropertyNames(other), length = names.length; i < length; i++) { + name = names[i]; + if (name.charAt(0) === '$' && name.charAt(1) !== '$' && other.hasOwnProperty(name)) { + self[name] = other[name]; + } + } + + }, TMP_Kernel_copy_singleton_methods_14.$$arity = 1); + + Opal.def(self, '$clone', TMP_Kernel_clone_15 = function $$clone($kwargs) { + var freeze, self = this, copy = nil; + + + + if ($kwargs == null) { + $kwargs = $hash2([], {}); + } else if (!$kwargs.$$is_hash) { + throw Opal.ArgumentError.$new('expected kwargs'); + }; + + freeze = $kwargs.$$smap["freeze"]; + if (freeze == null) { + freeze = true + }; + copy = self.$class().$allocate(); + copy.$copy_instance_variables(self); + copy.$copy_singleton_methods(self); + copy.$initialize_clone(self); + return copy; + }, TMP_Kernel_clone_15.$$arity = -1); + + Opal.def(self, '$initialize_clone', TMP_Kernel_initialize_clone_16 = function $$initialize_clone(other) { + var self = this; + + return self.$initialize_copy(other) + }, TMP_Kernel_initialize_clone_16.$$arity = 1); + + Opal.def(self, '$define_singleton_method', TMP_Kernel_define_singleton_method_17 = function $$define_singleton_method(name, method) { + var $iter = TMP_Kernel_define_singleton_method_17.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Kernel_define_singleton_method_17.$$p = null; + + + if ($iter) TMP_Kernel_define_singleton_method_17.$$p = null;; + ; + return $send(self.$singleton_class(), 'define_method', [name, method], block.$to_proc()); + }, TMP_Kernel_define_singleton_method_17.$$arity = -2); + + Opal.def(self, '$dup', TMP_Kernel_dup_18 = function $$dup() { + var self = this, copy = nil; + + + copy = self.$class().$allocate(); + copy.$copy_instance_variables(self); + copy.$initialize_dup(self); + return copy; + }, TMP_Kernel_dup_18.$$arity = 0); + + Opal.def(self, '$initialize_dup', TMP_Kernel_initialize_dup_19 = function $$initialize_dup(other) { + var self = this; + + return self.$initialize_copy(other) + }, TMP_Kernel_initialize_dup_19.$$arity = 1); + + Opal.def(self, '$enum_for', TMP_Kernel_enum_for_20 = function $$enum_for($a, $b) { + var $iter = TMP_Kernel_enum_for_20.$$p, block = $iter || nil, $post_args, method, args, self = this; + + if ($iter) TMP_Kernel_enum_for_20.$$p = null; + + + if ($iter) TMP_Kernel_enum_for_20.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + if ($post_args.length > 0) { + method = $post_args[0]; + $post_args.splice(0, 1); + } + if (method == null) { + method = "each"; + }; + + args = $post_args;; + return $send($$($nesting, 'Enumerator'), 'for', [self, method].concat(Opal.to_a(args)), block.$to_proc()); + }, TMP_Kernel_enum_for_20.$$arity = -1); + Opal.alias(self, "to_enum", "enum_for"); + + Opal.def(self, '$equal?', TMP_Kernel_equal$q_21 = function(other) { + var self = this; + + return self === other; + }, TMP_Kernel_equal$q_21.$$arity = 1); + + Opal.def(self, '$exit', TMP_Kernel_exit_22 = function $$exit(status) { + var $a, self = this, block = nil; + if ($gvars.__at_exit__ == null) $gvars.__at_exit__ = nil; + + + + if (status == null) { + status = true; + }; + $gvars.__at_exit__ = ($truthy($a = $gvars.__at_exit__) ? $a : []); + while (!($truthy($gvars.__at_exit__['$empty?']()))) { + + block = $gvars.__at_exit__.$pop(); + block.$call(); + }; + + if (status.$$is_boolean) { + status = status ? 0 : 1; + } else { + status = $$($nesting, 'Opal').$coerce_to(status, $$($nesting, 'Integer'), "to_int") + } + + Opal.exit(status); + ; + return nil; + }, TMP_Kernel_exit_22.$$arity = -1); + + Opal.def(self, '$extend', TMP_Kernel_extend_23 = function $$extend($a) { + var $post_args, mods, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + mods = $post_args;; + + var singleton = self.$singleton_class(); + + for (var i = mods.length - 1; i >= 0; i--) { + var mod = mods[i]; + + if (!mod.$$is_module) { + self.$raise($$($nesting, 'TypeError'), "" + "wrong argument type " + ((mod).$class()) + " (expected Module)"); + } + + (mod).$append_features(singleton); + (mod).$extend_object(self); + (mod).$extended(self); + } + ; + return self; + }, TMP_Kernel_extend_23.$$arity = -1); + + Opal.def(self, '$format', TMP_Kernel_format_24 = function $$format(format_string, $a) { + var $post_args, args, $b, self = this, ary = nil; + if ($gvars.DEBUG == null) $gvars.DEBUG = nil; + + + + $post_args = Opal.slice.call(arguments, 1, arguments.length); + + args = $post_args;; + if ($truthy((($b = args.$length()['$=='](1)) ? args['$[]'](0)['$respond_to?']("to_ary") : args.$length()['$=='](1)))) { + + ary = $$($nesting, 'Opal')['$coerce_to?'](args['$[]'](0), $$($nesting, 'Array'), "to_ary"); + if ($truthy(ary['$nil?']())) { + } else { + args = ary.$to_a() + };}; + + var result = '', + //used for slicing: + begin_slice = 0, + end_slice, + //used for iterating over the format string: + i, + len = format_string.length, + //used for processing field values: + arg, + str, + //used for processing %g and %G fields: + exponent, + //used for keeping track of width and precision: + width, + precision, + //used for holding temporary values: + tmp_num, + //used for processing %{} and %<> fileds: + hash_parameter_key, + closing_brace_char, + //used for processing %b, %B, %o, %x, and %X fields: + base_number, + base_prefix, + base_neg_zero_regex, + base_neg_zero_digit, + //used for processing arguments: + next_arg, + seq_arg_num = 1, + pos_arg_num = 0, + //used for keeping track of flags: + flags, + FNONE = 0, + FSHARP = 1, + FMINUS = 2, + FPLUS = 4, + FZERO = 8, + FSPACE = 16, + FWIDTH = 32, + FPREC = 64, + FPREC0 = 128; + + function CHECK_FOR_FLAGS() { + if (flags&FWIDTH) { self.$raise($$($nesting, 'ArgumentError'), "flag after width") } + if (flags&FPREC0) { self.$raise($$($nesting, 'ArgumentError'), "flag after precision") } + } + + function CHECK_FOR_WIDTH() { + if (flags&FWIDTH) { self.$raise($$($nesting, 'ArgumentError'), "width given twice") } + if (flags&FPREC0) { self.$raise($$($nesting, 'ArgumentError'), "width after precision") } + } + + function GET_NTH_ARG(num) { + if (num >= args.length) { self.$raise($$($nesting, 'ArgumentError'), "too few arguments") } + return args[num]; + } + + function GET_NEXT_ARG() { + switch (pos_arg_num) { + case -1: self.$raise($$($nesting, 'ArgumentError'), "" + "unnumbered(" + (seq_arg_num) + ") mixed with numbered") + case -2: self.$raise($$($nesting, 'ArgumentError'), "" + "unnumbered(" + (seq_arg_num) + ") mixed with named") + } + pos_arg_num = seq_arg_num++; + return GET_NTH_ARG(pos_arg_num - 1); + } + + function GET_POS_ARG(num) { + if (pos_arg_num > 0) { + self.$raise($$($nesting, 'ArgumentError'), "" + "numbered(" + (num) + ") after unnumbered(" + (pos_arg_num) + ")") + } + if (pos_arg_num === -2) { + self.$raise($$($nesting, 'ArgumentError'), "" + "numbered(" + (num) + ") after named") + } + if (num < 1) { + self.$raise($$($nesting, 'ArgumentError'), "" + "invalid index - " + (num) + "$") + } + pos_arg_num = -1; + return GET_NTH_ARG(num - 1); + } + + function GET_ARG() { + return (next_arg === undefined ? GET_NEXT_ARG() : next_arg); + } + + function READ_NUM(label) { + var num, str = ''; + for (;; i++) { + if (i === len) { + self.$raise($$($nesting, 'ArgumentError'), "malformed format string - %*[0-9]") + } + if (format_string.charCodeAt(i) < 48 || format_string.charCodeAt(i) > 57) { + i--; + num = parseInt(str, 10) || 0; + if (num > 2147483647) { + self.$raise($$($nesting, 'ArgumentError'), "" + (label) + " too big") + } + return num; + } + str += format_string.charAt(i); + } + } + + function READ_NUM_AFTER_ASTER(label) { + var arg, num = READ_NUM(label); + if (format_string.charAt(i + 1) === '$') { + i++; + arg = GET_POS_ARG(num); + } else { + arg = GET_NEXT_ARG(); + } + return (arg).$to_int(); + } + + for (i = format_string.indexOf('%'); i !== -1; i = format_string.indexOf('%', i)) { + str = undefined; + + flags = FNONE; + width = -1; + precision = -1; + next_arg = undefined; + + end_slice = i; + + i++; + + switch (format_string.charAt(i)) { + case '%': + begin_slice = i; + case '': + case '\n': + case '\0': + i++; + continue; + } + + format_sequence: for (; i < len; i++) { + switch (format_string.charAt(i)) { + + case ' ': + CHECK_FOR_FLAGS(); + flags |= FSPACE; + continue format_sequence; + + case '#': + CHECK_FOR_FLAGS(); + flags |= FSHARP; + continue format_sequence; + + case '+': + CHECK_FOR_FLAGS(); + flags |= FPLUS; + continue format_sequence; + + case '-': + CHECK_FOR_FLAGS(); + flags |= FMINUS; + continue format_sequence; + + case '0': + CHECK_FOR_FLAGS(); + flags |= FZERO; + continue format_sequence; + + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + tmp_num = READ_NUM('width'); + if (format_string.charAt(i + 1) === '$') { + if (i + 2 === len) { + str = '%'; + i++; + break format_sequence; + } + if (next_arg !== undefined) { + self.$raise($$($nesting, 'ArgumentError'), "" + "value given twice - %" + (tmp_num) + "$") + } + next_arg = GET_POS_ARG(tmp_num); + i++; + } else { + CHECK_FOR_WIDTH(); + flags |= FWIDTH; + width = tmp_num; + } + continue format_sequence; + + case '<': + case '\{': + closing_brace_char = (format_string.charAt(i) === '<' ? '>' : '\}'); + hash_parameter_key = ''; + + i++; + + for (;; i++) { + if (i === len) { + self.$raise($$($nesting, 'ArgumentError'), "malformed name - unmatched parenthesis") + } + if (format_string.charAt(i) === closing_brace_char) { + + if (pos_arg_num > 0) { + self.$raise($$($nesting, 'ArgumentError'), "" + "named " + (hash_parameter_key) + " after unnumbered(" + (pos_arg_num) + ")") + } + if (pos_arg_num === -1) { + self.$raise($$($nesting, 'ArgumentError'), "" + "named " + (hash_parameter_key) + " after numbered") + } + pos_arg_num = -2; + + if (args[0] === undefined || !args[0].$$is_hash) { + self.$raise($$($nesting, 'ArgumentError'), "one hash required") + } + + next_arg = (args[0]).$fetch(hash_parameter_key); + + if (closing_brace_char === '>') { + continue format_sequence; + } else { + str = next_arg.toString(); + if (precision !== -1) { str = str.slice(0, precision); } + if (flags&FMINUS) { + while (str.length < width) { str = str + ' '; } + } else { + while (str.length < width) { str = ' ' + str; } + } + break format_sequence; + } + } + hash_parameter_key += format_string.charAt(i); + } + + case '*': + i++; + CHECK_FOR_WIDTH(); + flags |= FWIDTH; + width = READ_NUM_AFTER_ASTER('width'); + if (width < 0) { + flags |= FMINUS; + width = -width; + } + continue format_sequence; + + case '.': + if (flags&FPREC0) { + self.$raise($$($nesting, 'ArgumentError'), "precision given twice") + } + flags |= FPREC|FPREC0; + precision = 0; + i++; + if (format_string.charAt(i) === '*') { + i++; + precision = READ_NUM_AFTER_ASTER('precision'); + if (precision < 0) { + flags &= ~FPREC; + } + continue format_sequence; + } + precision = READ_NUM('precision'); + continue format_sequence; + + case 'd': + case 'i': + case 'u': + arg = self.$Integer(GET_ARG()); + if (arg >= 0) { + str = arg.toString(); + while (str.length < precision) { str = '0' + str; } + if (flags&FMINUS) { + if (flags&FPLUS || flags&FSPACE) { str = (flags&FPLUS ? '+' : ' ') + str; } + while (str.length < width) { str = str + ' '; } + } else { + if (flags&FZERO && precision === -1) { + while (str.length < width - ((flags&FPLUS || flags&FSPACE) ? 1 : 0)) { str = '0' + str; } + if (flags&FPLUS || flags&FSPACE) { str = (flags&FPLUS ? '+' : ' ') + str; } + } else { + if (flags&FPLUS || flags&FSPACE) { str = (flags&FPLUS ? '+' : ' ') + str; } + while (str.length < width) { str = ' ' + str; } + } + } + } else { + str = (-arg).toString(); + while (str.length < precision) { str = '0' + str; } + if (flags&FMINUS) { + str = '-' + str; + while (str.length < width) { str = str + ' '; } + } else { + if (flags&FZERO && precision === -1) { + while (str.length < width - 1) { str = '0' + str; } + str = '-' + str; + } else { + str = '-' + str; + while (str.length < width) { str = ' ' + str; } + } + } + } + break format_sequence; + + case 'b': + case 'B': + case 'o': + case 'x': + case 'X': + switch (format_string.charAt(i)) { + case 'b': + case 'B': + base_number = 2; + base_prefix = '0b'; + base_neg_zero_regex = /^1+/; + base_neg_zero_digit = '1'; + break; + case 'o': + base_number = 8; + base_prefix = '0'; + base_neg_zero_regex = /^3?7+/; + base_neg_zero_digit = '7'; + break; + case 'x': + case 'X': + base_number = 16; + base_prefix = '0x'; + base_neg_zero_regex = /^f+/; + base_neg_zero_digit = 'f'; + break; + } + arg = self.$Integer(GET_ARG()); + if (arg >= 0) { + str = arg.toString(base_number); + while (str.length < precision) { str = '0' + str; } + if (flags&FMINUS) { + if (flags&FPLUS || flags&FSPACE) { str = (flags&FPLUS ? '+' : ' ') + str; } + if (flags&FSHARP && arg !== 0) { str = base_prefix + str; } + while (str.length < width) { str = str + ' '; } + } else { + if (flags&FZERO && precision === -1) { + while (str.length < width - ((flags&FPLUS || flags&FSPACE) ? 1 : 0) - ((flags&FSHARP && arg !== 0) ? base_prefix.length : 0)) { str = '0' + str; } + if (flags&FSHARP && arg !== 0) { str = base_prefix + str; } + if (flags&FPLUS || flags&FSPACE) { str = (flags&FPLUS ? '+' : ' ') + str; } + } else { + if (flags&FSHARP && arg !== 0) { str = base_prefix + str; } + if (flags&FPLUS || flags&FSPACE) { str = (flags&FPLUS ? '+' : ' ') + str; } + while (str.length < width) { str = ' ' + str; } + } + } + } else { + if (flags&FPLUS || flags&FSPACE) { + str = (-arg).toString(base_number); + while (str.length < precision) { str = '0' + str; } + if (flags&FMINUS) { + if (flags&FSHARP) { str = base_prefix + str; } + str = '-' + str; + while (str.length < width) { str = str + ' '; } + } else { + if (flags&FZERO && precision === -1) { + while (str.length < width - 1 - (flags&FSHARP ? 2 : 0)) { str = '0' + str; } + if (flags&FSHARP) { str = base_prefix + str; } + str = '-' + str; + } else { + if (flags&FSHARP) { str = base_prefix + str; } + str = '-' + str; + while (str.length < width) { str = ' ' + str; } + } + } + } else { + str = (arg >>> 0).toString(base_number).replace(base_neg_zero_regex, base_neg_zero_digit); + while (str.length < precision - 2) { str = base_neg_zero_digit + str; } + if (flags&FMINUS) { + str = '..' + str; + if (flags&FSHARP) { str = base_prefix + str; } + while (str.length < width) { str = str + ' '; } + } else { + if (flags&FZERO && precision === -1) { + while (str.length < width - 2 - (flags&FSHARP ? base_prefix.length : 0)) { str = base_neg_zero_digit + str; } + str = '..' + str; + if (flags&FSHARP) { str = base_prefix + str; } + } else { + str = '..' + str; + if (flags&FSHARP) { str = base_prefix + str; } + while (str.length < width) { str = ' ' + str; } + } + } + } + } + if (format_string.charAt(i) === format_string.charAt(i).toUpperCase()) { + str = str.toUpperCase(); + } + break format_sequence; + + case 'f': + case 'e': + case 'E': + case 'g': + case 'G': + arg = self.$Float(GET_ARG()); + if (arg >= 0 || isNaN(arg)) { + if (arg === Infinity) { + str = 'Inf'; + } else { + switch (format_string.charAt(i)) { + case 'f': + str = arg.toFixed(precision === -1 ? 6 : precision); + break; + case 'e': + case 'E': + str = arg.toExponential(precision === -1 ? 6 : precision); + break; + case 'g': + case 'G': + str = arg.toExponential(); + exponent = parseInt(str.split('e')[1], 10); + if (!(exponent < -4 || exponent >= (precision === -1 ? 6 : precision))) { + str = arg.toPrecision(precision === -1 ? (flags&FSHARP ? 6 : undefined) : precision); + } + break; + } + } + if (flags&FMINUS) { + if (flags&FPLUS || flags&FSPACE) { str = (flags&FPLUS ? '+' : ' ') + str; } + while (str.length < width) { str = str + ' '; } + } else { + if (flags&FZERO && arg !== Infinity && !isNaN(arg)) { + while (str.length < width - ((flags&FPLUS || flags&FSPACE) ? 1 : 0)) { str = '0' + str; } + if (flags&FPLUS || flags&FSPACE) { str = (flags&FPLUS ? '+' : ' ') + str; } + } else { + if (flags&FPLUS || flags&FSPACE) { str = (flags&FPLUS ? '+' : ' ') + str; } + while (str.length < width) { str = ' ' + str; } + } + } + } else { + if (arg === -Infinity) { + str = 'Inf'; + } else { + switch (format_string.charAt(i)) { + case 'f': + str = (-arg).toFixed(precision === -1 ? 6 : precision); + break; + case 'e': + case 'E': + str = (-arg).toExponential(precision === -1 ? 6 : precision); + break; + case 'g': + case 'G': + str = (-arg).toExponential(); + exponent = parseInt(str.split('e')[1], 10); + if (!(exponent < -4 || exponent >= (precision === -1 ? 6 : precision))) { + str = (-arg).toPrecision(precision === -1 ? (flags&FSHARP ? 6 : undefined) : precision); + } + break; + } + } + if (flags&FMINUS) { + str = '-' + str; + while (str.length < width) { str = str + ' '; } + } else { + if (flags&FZERO && arg !== -Infinity) { + while (str.length < width - 1) { str = '0' + str; } + str = '-' + str; + } else { + str = '-' + str; + while (str.length < width) { str = ' ' + str; } + } + } + } + if (format_string.charAt(i) === format_string.charAt(i).toUpperCase() && arg !== Infinity && arg !== -Infinity && !isNaN(arg)) { + str = str.toUpperCase(); + } + str = str.replace(/([eE][-+]?)([0-9])$/, '$10$2'); + break format_sequence; + + case 'a': + case 'A': + // Not implemented because there are no specs for this field type. + self.$raise($$($nesting, 'NotImplementedError'), "`A` and `a` format field types are not implemented in Opal yet") + + case 'c': + arg = GET_ARG(); + if ((arg)['$respond_to?']("to_ary")) { arg = (arg).$to_ary()[0]; } + if ((arg)['$respond_to?']("to_str")) { + str = (arg).$to_str(); + } else { + str = String.fromCharCode($$($nesting, 'Opal').$coerce_to(arg, $$($nesting, 'Integer'), "to_int")); + } + if (str.length !== 1) { + self.$raise($$($nesting, 'ArgumentError'), "%c requires a character") + } + if (flags&FMINUS) { + while (str.length < width) { str = str + ' '; } + } else { + while (str.length < width) { str = ' ' + str; } + } + break format_sequence; + + case 'p': + str = (GET_ARG()).$inspect(); + if (precision !== -1) { str = str.slice(0, precision); } + if (flags&FMINUS) { + while (str.length < width) { str = str + ' '; } + } else { + while (str.length < width) { str = ' ' + str; } + } + break format_sequence; + + case 's': + str = (GET_ARG()).$to_s(); + if (precision !== -1) { str = str.slice(0, precision); } + if (flags&FMINUS) { + while (str.length < width) { str = str + ' '; } + } else { + while (str.length < width) { str = ' ' + str; } + } + break format_sequence; + + default: + self.$raise($$($nesting, 'ArgumentError'), "" + "malformed format string - %" + (format_string.charAt(i))) + } + } + + if (str === undefined) { + self.$raise($$($nesting, 'ArgumentError'), "malformed format string - %") + } + + result += format_string.slice(begin_slice, end_slice) + str; + begin_slice = i + 1; + } + + if ($gvars.DEBUG && pos_arg_num >= 0 && seq_arg_num < args.length) { + self.$raise($$($nesting, 'ArgumentError'), "too many arguments for format string") + } + + return result + format_string.slice(begin_slice); + ; + }, TMP_Kernel_format_24.$$arity = -2); + + Opal.def(self, '$hash', TMP_Kernel_hash_25 = function $$hash() { + var self = this; + + return self.$__id__() + }, TMP_Kernel_hash_25.$$arity = 0); + + Opal.def(self, '$initialize_copy', TMP_Kernel_initialize_copy_26 = function $$initialize_copy(other) { + var self = this; + + return nil + }, TMP_Kernel_initialize_copy_26.$$arity = 1); + + Opal.def(self, '$inspect', TMP_Kernel_inspect_27 = function $$inspect() { + var self = this; + + return self.$to_s() + }, TMP_Kernel_inspect_27.$$arity = 0); + + Opal.def(self, '$instance_of?', TMP_Kernel_instance_of$q_28 = function(klass) { + var self = this; + + + if (!klass.$$is_class && !klass.$$is_module) { + self.$raise($$($nesting, 'TypeError'), "class or module required"); + } + + return self.$$class === klass; + + }, TMP_Kernel_instance_of$q_28.$$arity = 1); + + Opal.def(self, '$instance_variable_defined?', TMP_Kernel_instance_variable_defined$q_29 = function(name) { + var self = this; + + + name = $$($nesting, 'Opal')['$instance_variable_name!'](name); + return Opal.hasOwnProperty.call(self, name.substr(1));; + }, TMP_Kernel_instance_variable_defined$q_29.$$arity = 1); + + Opal.def(self, '$instance_variable_get', TMP_Kernel_instance_variable_get_30 = function $$instance_variable_get(name) { + var self = this; + + + name = $$($nesting, 'Opal')['$instance_variable_name!'](name); + + var ivar = self[Opal.ivar(name.substr(1))]; + + return ivar == null ? nil : ivar; + ; + }, TMP_Kernel_instance_variable_get_30.$$arity = 1); + + Opal.def(self, '$instance_variable_set', TMP_Kernel_instance_variable_set_31 = function $$instance_variable_set(name, value) { + var self = this; + + + name = $$($nesting, 'Opal')['$instance_variable_name!'](name); + return self[Opal.ivar(name.substr(1))] = value;; + }, TMP_Kernel_instance_variable_set_31.$$arity = 2); + + Opal.def(self, '$remove_instance_variable', TMP_Kernel_remove_instance_variable_32 = function $$remove_instance_variable(name) { + var self = this; + + + name = $$($nesting, 'Opal')['$instance_variable_name!'](name); + + var key = Opal.ivar(name.substr(1)), + val; + if (self.hasOwnProperty(key)) { + val = self[key]; + delete self[key]; + return val; + } + ; + return self.$raise($$($nesting, 'NameError'), "" + "instance variable " + (name) + " not defined"); + }, TMP_Kernel_remove_instance_variable_32.$$arity = 1); + + Opal.def(self, '$instance_variables', TMP_Kernel_instance_variables_33 = function $$instance_variables() { + var self = this; + + + var result = [], ivar; + + for (var name in self) { + if (self.hasOwnProperty(name) && name.charAt(0) !== '$') { + if (name.substr(-1) === '$') { + ivar = name.slice(0, name.length - 1); + } else { + ivar = name; + } + result.push('@' + ivar); + } + } + + return result; + + }, TMP_Kernel_instance_variables_33.$$arity = 0); + + Opal.def(self, '$Integer', TMP_Kernel_Integer_34 = function $$Integer(value, base) { + var self = this; + + + ; + + var i, str, base_digits; + + if (!value.$$is_string) { + if (base !== undefined) { + self.$raise($$($nesting, 'ArgumentError'), "base specified for non string value") + } + if (value === nil) { + self.$raise($$($nesting, 'TypeError'), "can't convert nil into Integer") + } + if (value.$$is_number) { + if (value === Infinity || value === -Infinity || isNaN(value)) { + self.$raise($$($nesting, 'FloatDomainError'), value) + } + return Math.floor(value); + } + if (value['$respond_to?']("to_int")) { + i = value.$to_int(); + if (i !== nil) { + return i; + } + } + return $$($nesting, 'Opal')['$coerce_to!'](value, $$($nesting, 'Integer'), "to_i"); + } + + if (value === "0") { + return 0; + } + + if (base === undefined) { + base = 0; + } else { + base = $$($nesting, 'Opal').$coerce_to(base, $$($nesting, 'Integer'), "to_int"); + if (base === 1 || base < 0 || base > 36) { + self.$raise($$($nesting, 'ArgumentError'), "" + "invalid radix " + (base)) + } + } + + str = value.toLowerCase(); + + str = str.replace(/(\d)_(?=\d)/g, '$1'); + + str = str.replace(/^(\s*[+-]?)(0[bodx]?)/, function (_, head, flag) { + switch (flag) { + case '0b': + if (base === 0 || base === 2) { + base = 2; + return head; + } + case '0': + case '0o': + if (base === 0 || base === 8) { + base = 8; + return head; + } + case '0d': + if (base === 0 || base === 10) { + base = 10; + return head; + } + case '0x': + if (base === 0 || base === 16) { + base = 16; + return head; + } + } + self.$raise($$($nesting, 'ArgumentError'), "" + "invalid value for Integer(): \"" + (value) + "\"") + }); + + base = (base === 0 ? 10 : base); + + base_digits = '0-' + (base <= 10 ? base - 1 : '9a-' + String.fromCharCode(97 + (base - 11))); + + if (!(new RegExp('^\\s*[+-]?[' + base_digits + ']+\\s*$')).test(str)) { + self.$raise($$($nesting, 'ArgumentError'), "" + "invalid value for Integer(): \"" + (value) + "\"") + } + + i = parseInt(str, base); + + if (isNaN(i)) { + self.$raise($$($nesting, 'ArgumentError'), "" + "invalid value for Integer(): \"" + (value) + "\"") + } + + return i; + ; + }, TMP_Kernel_Integer_34.$$arity = -2); + + Opal.def(self, '$Float', TMP_Kernel_Float_35 = function $$Float(value) { + var self = this; + + + var str; + + if (value === nil) { + self.$raise($$($nesting, 'TypeError'), "can't convert nil into Float") + } + + if (value.$$is_string) { + str = value.toString(); + + str = str.replace(/(\d)_(?=\d)/g, '$1'); + + //Special case for hex strings only: + if (/^\s*[-+]?0[xX][0-9a-fA-F]+\s*$/.test(str)) { + return self.$Integer(str); + } + + if (!/^\s*[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?\s*$/.test(str)) { + self.$raise($$($nesting, 'ArgumentError'), "" + "invalid value for Float(): \"" + (value) + "\"") + } + + return parseFloat(str); + } + + return $$($nesting, 'Opal')['$coerce_to!'](value, $$($nesting, 'Float'), "to_f"); + + }, TMP_Kernel_Float_35.$$arity = 1); + + Opal.def(self, '$Hash', TMP_Kernel_Hash_36 = function $$Hash(arg) { + var $a, self = this; + + + if ($truthy(($truthy($a = arg['$nil?']()) ? $a : arg['$==']([])))) { + return $hash2([], {})}; + if ($truthy($$($nesting, 'Hash')['$==='](arg))) { + return arg}; + return $$($nesting, 'Opal')['$coerce_to!'](arg, $$($nesting, 'Hash'), "to_hash"); + }, TMP_Kernel_Hash_36.$$arity = 1); + + Opal.def(self, '$is_a?', TMP_Kernel_is_a$q_37 = function(klass) { + var self = this; + + + if (!klass.$$is_class && !klass.$$is_module) { + self.$raise($$($nesting, 'TypeError'), "class or module required"); + } + + return Opal.is_a(self, klass); + + }, TMP_Kernel_is_a$q_37.$$arity = 1); + + Opal.def(self, '$itself', TMP_Kernel_itself_38 = function $$itself() { + var self = this; + + return self + }, TMP_Kernel_itself_38.$$arity = 0); + Opal.alias(self, "kind_of?", "is_a?"); + + Opal.def(self, '$lambda', TMP_Kernel_lambda_39 = function $$lambda() { + var $iter = TMP_Kernel_lambda_39.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Kernel_lambda_39.$$p = null; + + + if ($iter) TMP_Kernel_lambda_39.$$p = null;; + return Opal.lambda(block);; + }, TMP_Kernel_lambda_39.$$arity = 0); + + Opal.def(self, '$load', TMP_Kernel_load_40 = function $$load(file) { + var self = this; + + + file = $$($nesting, 'Opal')['$coerce_to!'](file, $$($nesting, 'String'), "to_str"); + return Opal.load(file); + }, TMP_Kernel_load_40.$$arity = 1); + + Opal.def(self, '$loop', TMP_Kernel_loop_41 = function $$loop() { + var TMP_42, $a, $iter = TMP_Kernel_loop_41.$$p, $yield = $iter || nil, self = this, e = nil; + + if ($iter) TMP_Kernel_loop_41.$$p = null; + + if (($yield !== nil)) { + } else { + return $send(self, 'enum_for', ["loop"], (TMP_42 = function(){var self = TMP_42.$$s || this; + + return $$$($$($nesting, 'Float'), 'INFINITY')}, TMP_42.$$s = self, TMP_42.$$arity = 0, TMP_42)) + }; + while ($truthy(true)) { + + try { + Opal.yieldX($yield, []) + } catch ($err) { + if (Opal.rescue($err, [$$($nesting, 'StopIteration')])) {e = $err; + try { + return e.$result() + } finally { Opal.pop_exception() } + } else { throw $err; } + }; + }; + return self; + }, TMP_Kernel_loop_41.$$arity = 0); + + Opal.def(self, '$nil?', TMP_Kernel_nil$q_43 = function() { + var self = this; + + return false + }, TMP_Kernel_nil$q_43.$$arity = 0); + Opal.alias(self, "object_id", "__id__"); + + Opal.def(self, '$printf', TMP_Kernel_printf_44 = function $$printf($a) { + var $post_args, args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + if ($truthy(args['$any?']())) { + self.$print($send(self, 'format', Opal.to_a(args)))}; + return nil; + }, TMP_Kernel_printf_44.$$arity = -1); + + Opal.def(self, '$proc', TMP_Kernel_proc_45 = function $$proc() { + var $iter = TMP_Kernel_proc_45.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Kernel_proc_45.$$p = null; + + + if ($iter) TMP_Kernel_proc_45.$$p = null;; + if ($truthy(block)) { + } else { + self.$raise($$($nesting, 'ArgumentError'), "tried to create Proc object without a block") + }; + block.$$is_lambda = false; + return block; + }, TMP_Kernel_proc_45.$$arity = 0); + + Opal.def(self, '$puts', TMP_Kernel_puts_46 = function $$puts($a) { + var $post_args, strs, self = this; + if ($gvars.stdout == null) $gvars.stdout = nil; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + strs = $post_args;; + return $send($gvars.stdout, 'puts', Opal.to_a(strs)); + }, TMP_Kernel_puts_46.$$arity = -1); + + Opal.def(self, '$p', TMP_Kernel_p_47 = function $$p($a) { + var $post_args, args, TMP_48, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + $send(args, 'each', [], (TMP_48 = function(obj){var self = TMP_48.$$s || this; + if ($gvars.stdout == null) $gvars.stdout = nil; + + + + if (obj == null) { + obj = nil; + }; + return $gvars.stdout.$puts(obj.$inspect());}, TMP_48.$$s = self, TMP_48.$$arity = 1, TMP_48)); + if ($truthy($rb_le(args.$length(), 1))) { + return args['$[]'](0) + } else { + return args + }; + }, TMP_Kernel_p_47.$$arity = -1); + + Opal.def(self, '$print', TMP_Kernel_print_49 = function $$print($a) { + var $post_args, strs, self = this; + if ($gvars.stdout == null) $gvars.stdout = nil; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + strs = $post_args;; + return $send($gvars.stdout, 'print', Opal.to_a(strs)); + }, TMP_Kernel_print_49.$$arity = -1); + + Opal.def(self, '$warn', TMP_Kernel_warn_50 = function $$warn($a) { + var $post_args, strs, $b, self = this; + if ($gvars.VERBOSE == null) $gvars.VERBOSE = nil; + if ($gvars.stderr == null) $gvars.stderr = nil; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + strs = $post_args;; + if ($truthy(($truthy($b = $gvars.VERBOSE['$nil?']()) ? $b : strs['$empty?']()))) { + return nil + } else { + return $send($gvars.stderr, 'puts', Opal.to_a(strs)) + }; + }, TMP_Kernel_warn_50.$$arity = -1); + + Opal.def(self, '$raise', TMP_Kernel_raise_51 = function $$raise(exception, string, _backtrace) { + var self = this; + if ($gvars["!"] == null) $gvars["!"] = nil; + + + ; + + if (string == null) { + string = nil; + }; + + if (_backtrace == null) { + _backtrace = nil; + }; + + if (exception == null && $gvars["!"] !== nil) { + throw $gvars["!"]; + } + if (exception == null) { + exception = $$($nesting, 'RuntimeError').$new(); + } + else if (exception.$$is_string) { + exception = $$($nesting, 'RuntimeError').$new(exception); + } + // using respond_to? and not an undefined check to avoid method_missing matching as true + else if (exception.$$is_class && exception['$respond_to?']("exception")) { + exception = exception.$exception(string); + } + else if (exception['$is_a?']($$($nesting, 'Exception'))) { + // exception is fine + } + else { + exception = $$($nesting, 'TypeError').$new("exception class/object expected"); + } + + if ($gvars["!"] !== nil) { + Opal.exceptions.push($gvars["!"]); + } + + $gvars["!"] = exception; + + throw exception; + ; + }, TMP_Kernel_raise_51.$$arity = -1); + Opal.alias(self, "fail", "raise"); + + Opal.def(self, '$rand', TMP_Kernel_rand_52 = function $$rand(max) { + var self = this; + + + ; + + if (max === undefined) { + return $$$($$($nesting, 'Random'), 'DEFAULT').$rand(); + } + + if (max.$$is_number) { + if (max < 0) { + max = Math.abs(max); + } + + if (max % 1 !== 0) { + max = max.$to_i(); + } + + if (max === 0) { + max = undefined; + } + } + ; + return $$$($$($nesting, 'Random'), 'DEFAULT').$rand(max); + }, TMP_Kernel_rand_52.$$arity = -1); + + Opal.def(self, '$respond_to?', TMP_Kernel_respond_to$q_53 = function(name, include_all) { + var self = this; + + + + if (include_all == null) { + include_all = false; + }; + if ($truthy(self['$respond_to_missing?'](name, include_all))) { + return true}; + + var body = self['$' + name]; + + if (typeof(body) === "function" && !body.$$stub) { + return true; + } + ; + return false; + }, TMP_Kernel_respond_to$q_53.$$arity = -2); + + Opal.def(self, '$respond_to_missing?', TMP_Kernel_respond_to_missing$q_54 = function(method_name, include_all) { + var self = this; + + + + if (include_all == null) { + include_all = false; + }; + return false; + }, TMP_Kernel_respond_to_missing$q_54.$$arity = -2); + + Opal.def(self, '$require', TMP_Kernel_require_55 = function $$require(file) { + var self = this; + + + file = $$($nesting, 'Opal')['$coerce_to!'](file, $$($nesting, 'String'), "to_str"); + return Opal.require(file); + }, TMP_Kernel_require_55.$$arity = 1); + + Opal.def(self, '$require_relative', TMP_Kernel_require_relative_56 = function $$require_relative(file) { + var self = this; + + + $$($nesting, 'Opal')['$try_convert!'](file, $$($nesting, 'String'), "to_str"); + file = $$($nesting, 'File').$expand_path($$($nesting, 'File').$join(Opal.current_file, "..", file)); + return Opal.require(file); + }, TMP_Kernel_require_relative_56.$$arity = 1); + + Opal.def(self, '$require_tree', TMP_Kernel_require_tree_57 = function $$require_tree(path) { + var self = this; + + + var result = []; + + path = $$($nesting, 'File').$expand_path(path) + path = Opal.normalize(path); + if (path === '.') path = ''; + for (var name in Opal.modules) { + if ((name)['$start_with?'](path)) { + result.push([name, Opal.require(name)]); + } + } + + return result; + + }, TMP_Kernel_require_tree_57.$$arity = 1); + Opal.alias(self, "send", "__send__"); + Opal.alias(self, "public_send", "__send__"); + + Opal.def(self, '$singleton_class', TMP_Kernel_singleton_class_58 = function $$singleton_class() { + var self = this; + + return Opal.get_singleton_class(self); + }, TMP_Kernel_singleton_class_58.$$arity = 0); + + Opal.def(self, '$sleep', TMP_Kernel_sleep_59 = function $$sleep(seconds) { + var self = this; + + + + if (seconds == null) { + seconds = nil; + }; + + if (seconds === nil) { + self.$raise($$($nesting, 'TypeError'), "can't convert NilClass into time interval") + } + if (!seconds.$$is_number) { + self.$raise($$($nesting, 'TypeError'), "" + "can't convert " + (seconds.$class()) + " into time interval") + } + if (seconds < 0) { + self.$raise($$($nesting, 'ArgumentError'), "time interval must be positive") + } + var get_time = Opal.global.performance ? + function() {return performance.now()} : + function() {return new Date()} + + var t = get_time(); + while (get_time() - t <= seconds * 1000); + return seconds; + ; + }, TMP_Kernel_sleep_59.$$arity = -1); + Opal.alias(self, "sprintf", "format"); + + Opal.def(self, '$srand', TMP_Kernel_srand_60 = function $$srand(seed) { + var self = this; + + + + if (seed == null) { + seed = $$($nesting, 'Random').$new_seed(); + }; + return $$($nesting, 'Random').$srand(seed); + }, TMP_Kernel_srand_60.$$arity = -1); + + Opal.def(self, '$String', TMP_Kernel_String_61 = function $$String(str) { + var $a, self = this; + + return ($truthy($a = $$($nesting, 'Opal')['$coerce_to?'](str, $$($nesting, 'String'), "to_str")) ? $a : $$($nesting, 'Opal')['$coerce_to!'](str, $$($nesting, 'String'), "to_s")) + }, TMP_Kernel_String_61.$$arity = 1); + + Opal.def(self, '$tap', TMP_Kernel_tap_62 = function $$tap() { + var $iter = TMP_Kernel_tap_62.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Kernel_tap_62.$$p = null; + + + if ($iter) TMP_Kernel_tap_62.$$p = null;; + Opal.yield1(block, self); + return self; + }, TMP_Kernel_tap_62.$$arity = 0); + + Opal.def(self, '$to_proc', TMP_Kernel_to_proc_63 = function $$to_proc() { + var self = this; + + return self + }, TMP_Kernel_to_proc_63.$$arity = 0); + + Opal.def(self, '$to_s', TMP_Kernel_to_s_64 = function $$to_s() { + var self = this; + + return "" + "#<" + (self.$class()) + ":0x" + (self.$__id__().$to_s(16)) + ">" + }, TMP_Kernel_to_s_64.$$arity = 0); + + Opal.def(self, '$catch', TMP_Kernel_catch_65 = function(sym) { + var $iter = TMP_Kernel_catch_65.$$p, $yield = $iter || nil, self = this, e = nil; + + if ($iter) TMP_Kernel_catch_65.$$p = null; + try { + return Opal.yieldX($yield, []); + } catch ($err) { + if (Opal.rescue($err, [$$($nesting, 'UncaughtThrowError')])) {e = $err; + try { + + if (e.$sym()['$=='](sym)) { + return e.$arg()}; + return self.$raise(); + } finally { Opal.pop_exception() } + } else { throw $err; } + } + }, TMP_Kernel_catch_65.$$arity = 1); + + Opal.def(self, '$throw', TMP_Kernel_throw_66 = function($a) { + var $post_args, args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + return self.$raise($$($nesting, 'UncaughtThrowError'), args); + }, TMP_Kernel_throw_66.$$arity = -1); + + Opal.def(self, '$open', TMP_Kernel_open_67 = function $$open($a) { + var $iter = TMP_Kernel_open_67.$$p, block = $iter || nil, $post_args, args, self = this; + + if ($iter) TMP_Kernel_open_67.$$p = null; + + + if ($iter) TMP_Kernel_open_67.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + return $send($$($nesting, 'File'), 'open', Opal.to_a(args), block.$to_proc()); + }, TMP_Kernel_open_67.$$arity = -1); + + Opal.def(self, '$yield_self', TMP_Kernel_yield_self_68 = function $$yield_self() { + var TMP_69, $iter = TMP_Kernel_yield_self_68.$$p, $yield = $iter || nil, self = this; + + if ($iter) TMP_Kernel_yield_self_68.$$p = null; + + if (($yield !== nil)) { + } else { + return $send(self, 'enum_for', ["yield_self"], (TMP_69 = function(){var self = TMP_69.$$s || this; + + return 1}, TMP_69.$$s = self, TMP_69.$$arity = 0, TMP_69)) + }; + return Opal.yield1($yield, self);; + }, TMP_Kernel_yield_self_68.$$arity = 0); + })($nesting[0], $nesting); + return (function($base, $super, $parent_nesting) { + function $Object(){}; + var self = $Object = $klass($base, $super, 'Object', $Object); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return self.$include($$($nesting, 'Kernel')) + })($nesting[0], null, $nesting); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/error"] = function(Opal) { + function $rb_plus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); + } + function $rb_gt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $send = Opal.send, $truthy = Opal.truthy, $module = Opal.module, $hash2 = Opal.hash2; + + Opal.add_stubs(['$new', '$clone', '$to_s', '$empty?', '$class', '$raise', '$+', '$attr_reader', '$[]', '$>', '$length', '$inspect']); + + (function($base, $super, $parent_nesting) { + function $Exception(){}; + var self = $Exception = $klass($base, $super, 'Exception', $Exception); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Exception_new_1, TMP_Exception_exception_2, TMP_Exception_initialize_3, TMP_Exception_backtrace_4, TMP_Exception_exception_5, TMP_Exception_message_6, TMP_Exception_inspect_7, TMP_Exception_set_backtrace_8, TMP_Exception_to_s_9; + + def.message = nil; + + var stack_trace_limit; + Opal.defs(self, '$new', TMP_Exception_new_1 = function($a) { + var $post_args, args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + + var message = (args.length > 0) ? args[0] : nil; + var error = new self(message); + error.name = self.$$name; + error.message = message; + Opal.send(error, error.$initialize, args); + + // Error.captureStackTrace() will use .name and .toString to build the + // first line of the stack trace so it must be called after the error + // has been initialized. + // https://nodejs.org/dist/latest-v6.x/docs/api/errors.html + if (Opal.config.enable_stack_trace && Error.captureStackTrace) { + // Passing Kernel.raise will cut the stack trace from that point above + Error.captureStackTrace(error, stack_trace_limit); + } + + return error; + ; + }, TMP_Exception_new_1.$$arity = -1); + stack_trace_limit = self.$new; + Opal.defs(self, '$exception', TMP_Exception_exception_2 = function $$exception($a) { + var $post_args, args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + return $send(self, 'new', Opal.to_a(args)); + }, TMP_Exception_exception_2.$$arity = -1); + + Opal.def(self, '$initialize', TMP_Exception_initialize_3 = function $$initialize($a) { + var $post_args, args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + return self.message = (args.length > 0) ? args[0] : nil;; + }, TMP_Exception_initialize_3.$$arity = -1); + + Opal.def(self, '$backtrace', TMP_Exception_backtrace_4 = function $$backtrace() { + var self = this; + + + if (self.backtrace) { + // nil is a valid backtrace + return self.backtrace; + } + + var backtrace = self.stack; + + if (typeof(backtrace) === 'string') { + return backtrace.split("\n").slice(0, 15); + } + else if (backtrace) { + return backtrace.slice(0, 15); + } + + return []; + + }, TMP_Exception_backtrace_4.$$arity = 0); + + Opal.def(self, '$exception', TMP_Exception_exception_5 = function $$exception(str) { + var self = this; + + + + if (str == null) { + str = nil; + }; + + if (str === nil || self === str) { + return self; + } + + var cloned = self.$clone(); + cloned.message = str; + return cloned; + ; + }, TMP_Exception_exception_5.$$arity = -1); + + Opal.def(self, '$message', TMP_Exception_message_6 = function $$message() { + var self = this; + + return self.$to_s() + }, TMP_Exception_message_6.$$arity = 0); + + Opal.def(self, '$inspect', TMP_Exception_inspect_7 = function $$inspect() { + var self = this, as_str = nil; + + + as_str = self.$to_s(); + if ($truthy(as_str['$empty?']())) { + return self.$class().$to_s() + } else { + return "" + "#<" + (self.$class().$to_s()) + ": " + (self.$to_s()) + ">" + }; + }, TMP_Exception_inspect_7.$$arity = 0); + + Opal.def(self, '$set_backtrace', TMP_Exception_set_backtrace_8 = function $$set_backtrace(backtrace) { + var self = this; + + + var valid = true, i, ii; + + if (backtrace === nil) { + self.backtrace = nil; + } else if (backtrace.$$is_string) { + self.backtrace = [backtrace]; + } else { + if (backtrace.$$is_array) { + for (i = 0, ii = backtrace.length; i < ii; i++) { + if (!backtrace[i].$$is_string) { + valid = false; + break; + } + } + } else { + valid = false; + } + + if (valid === false) { + self.$raise($$($nesting, 'TypeError'), "backtrace must be Array of String") + } + + self.backtrace = backtrace; + } + + return backtrace; + + }, TMP_Exception_set_backtrace_8.$$arity = 1); + return (Opal.def(self, '$to_s', TMP_Exception_to_s_9 = function $$to_s() { + var $a, $b, self = this; + + return ($truthy($a = ($truthy($b = self.message) ? self.message.$to_s() : $b)) ? $a : self.$class().$to_s()) + }, TMP_Exception_to_s_9.$$arity = 0), nil) && 'to_s'; + })($nesting[0], Error, $nesting); + (function($base, $super, $parent_nesting) { + function $ScriptError(){}; + var self = $ScriptError = $klass($base, $super, 'ScriptError', $ScriptError); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return nil + })($nesting[0], $$($nesting, 'Exception'), $nesting); + (function($base, $super, $parent_nesting) { + function $SyntaxError(){}; + var self = $SyntaxError = $klass($base, $super, 'SyntaxError', $SyntaxError); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return nil + })($nesting[0], $$($nesting, 'ScriptError'), $nesting); + (function($base, $super, $parent_nesting) { + function $LoadError(){}; + var self = $LoadError = $klass($base, $super, 'LoadError', $LoadError); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return nil + })($nesting[0], $$($nesting, 'ScriptError'), $nesting); + (function($base, $super, $parent_nesting) { + function $NotImplementedError(){}; + var self = $NotImplementedError = $klass($base, $super, 'NotImplementedError', $NotImplementedError); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return nil + })($nesting[0], $$($nesting, 'ScriptError'), $nesting); + (function($base, $super, $parent_nesting) { + function $SystemExit(){}; + var self = $SystemExit = $klass($base, $super, 'SystemExit', $SystemExit); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return nil + })($nesting[0], $$($nesting, 'Exception'), $nesting); + (function($base, $super, $parent_nesting) { + function $NoMemoryError(){}; + var self = $NoMemoryError = $klass($base, $super, 'NoMemoryError', $NoMemoryError); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return nil + })($nesting[0], $$($nesting, 'Exception'), $nesting); + (function($base, $super, $parent_nesting) { + function $SignalException(){}; + var self = $SignalException = $klass($base, $super, 'SignalException', $SignalException); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return nil + })($nesting[0], $$($nesting, 'Exception'), $nesting); + (function($base, $super, $parent_nesting) { + function $Interrupt(){}; + var self = $Interrupt = $klass($base, $super, 'Interrupt', $Interrupt); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return nil + })($nesting[0], $$($nesting, 'Exception'), $nesting); + (function($base, $super, $parent_nesting) { + function $SecurityError(){}; + var self = $SecurityError = $klass($base, $super, 'SecurityError', $SecurityError); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return nil + })($nesting[0], $$($nesting, 'Exception'), $nesting); + (function($base, $super, $parent_nesting) { + function $StandardError(){}; + var self = $StandardError = $klass($base, $super, 'StandardError', $StandardError); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return nil + })($nesting[0], $$($nesting, 'Exception'), $nesting); + (function($base, $super, $parent_nesting) { + function $EncodingError(){}; + var self = $EncodingError = $klass($base, $super, 'EncodingError', $EncodingError); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return nil + })($nesting[0], $$($nesting, 'StandardError'), $nesting); + (function($base, $super, $parent_nesting) { + function $ZeroDivisionError(){}; + var self = $ZeroDivisionError = $klass($base, $super, 'ZeroDivisionError', $ZeroDivisionError); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return nil + })($nesting[0], $$($nesting, 'StandardError'), $nesting); + (function($base, $super, $parent_nesting) { + function $NameError(){}; + var self = $NameError = $klass($base, $super, 'NameError', $NameError); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return nil + })($nesting[0], $$($nesting, 'StandardError'), $nesting); + (function($base, $super, $parent_nesting) { + function $NoMethodError(){}; + var self = $NoMethodError = $klass($base, $super, 'NoMethodError', $NoMethodError); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return nil + })($nesting[0], $$($nesting, 'NameError'), $nesting); + (function($base, $super, $parent_nesting) { + function $RuntimeError(){}; + var self = $RuntimeError = $klass($base, $super, 'RuntimeError', $RuntimeError); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return nil + })($nesting[0], $$($nesting, 'StandardError'), $nesting); + (function($base, $super, $parent_nesting) { + function $FrozenError(){}; + var self = $FrozenError = $klass($base, $super, 'FrozenError', $FrozenError); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return nil + })($nesting[0], $$($nesting, 'RuntimeError'), $nesting); + (function($base, $super, $parent_nesting) { + function $LocalJumpError(){}; + var self = $LocalJumpError = $klass($base, $super, 'LocalJumpError', $LocalJumpError); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return nil + })($nesting[0], $$($nesting, 'StandardError'), $nesting); + (function($base, $super, $parent_nesting) { + function $TypeError(){}; + var self = $TypeError = $klass($base, $super, 'TypeError', $TypeError); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return nil + })($nesting[0], $$($nesting, 'StandardError'), $nesting); + (function($base, $super, $parent_nesting) { + function $ArgumentError(){}; + var self = $ArgumentError = $klass($base, $super, 'ArgumentError', $ArgumentError); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return nil + })($nesting[0], $$($nesting, 'StandardError'), $nesting); + (function($base, $super, $parent_nesting) { + function $IndexError(){}; + var self = $IndexError = $klass($base, $super, 'IndexError', $IndexError); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return nil + })($nesting[0], $$($nesting, 'StandardError'), $nesting); + (function($base, $super, $parent_nesting) { + function $StopIteration(){}; + var self = $StopIteration = $klass($base, $super, 'StopIteration', $StopIteration); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return nil + })($nesting[0], $$($nesting, 'IndexError'), $nesting); + (function($base, $super, $parent_nesting) { + function $KeyError(){}; + var self = $KeyError = $klass($base, $super, 'KeyError', $KeyError); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return nil + })($nesting[0], $$($nesting, 'IndexError'), $nesting); + (function($base, $super, $parent_nesting) { + function $RangeError(){}; + var self = $RangeError = $klass($base, $super, 'RangeError', $RangeError); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return nil + })($nesting[0], $$($nesting, 'StandardError'), $nesting); + (function($base, $super, $parent_nesting) { + function $FloatDomainError(){}; + var self = $FloatDomainError = $klass($base, $super, 'FloatDomainError', $FloatDomainError); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return nil + })($nesting[0], $$($nesting, 'RangeError'), $nesting); + (function($base, $super, $parent_nesting) { + function $IOError(){}; + var self = $IOError = $klass($base, $super, 'IOError', $IOError); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return nil + })($nesting[0], $$($nesting, 'StandardError'), $nesting); + (function($base, $super, $parent_nesting) { + function $SystemCallError(){}; + var self = $SystemCallError = $klass($base, $super, 'SystemCallError', $SystemCallError); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return nil + })($nesting[0], $$($nesting, 'StandardError'), $nesting); + (function($base, $parent_nesting) { + function $Errno() {}; + var self = $Errno = $module($base, 'Errno', $Errno); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + (function($base, $super, $parent_nesting) { + function $EINVAL(){}; + var self = $EINVAL = $klass($base, $super, 'EINVAL', $EINVAL); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_EINVAL_new_10; + + return (Opal.defs(self, '$new', TMP_EINVAL_new_10 = function(name) { + var $iter = TMP_EINVAL_new_10.$$p, $yield = $iter || nil, self = this, message = nil; + + if ($iter) TMP_EINVAL_new_10.$$p = null; + + + if (name == null) { + name = nil; + }; + message = "Invalid argument"; + if ($truthy(name)) { + message = $rb_plus(message, "" + " - " + (name))}; + return $send(self, Opal.find_super_dispatcher(self, 'new', TMP_EINVAL_new_10, false, $EINVAL), [message], null); + }, TMP_EINVAL_new_10.$$arity = -1), nil) && 'new' + })($nesting[0], $$($nesting, 'SystemCallError'), $nesting) + })($nesting[0], $nesting); + (function($base, $super, $parent_nesting) { + function $UncaughtThrowError(){}; + var self = $UncaughtThrowError = $klass($base, $super, 'UncaughtThrowError', $UncaughtThrowError); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_UncaughtThrowError_initialize_11; + + def.sym = nil; + + self.$attr_reader("sym", "arg"); + return (Opal.def(self, '$initialize', TMP_UncaughtThrowError_initialize_11 = function $$initialize(args) { + var $iter = TMP_UncaughtThrowError_initialize_11.$$p, $yield = $iter || nil, self = this; + + if ($iter) TMP_UncaughtThrowError_initialize_11.$$p = null; + + self.sym = args['$[]'](0); + if ($truthy($rb_gt(args.$length(), 1))) { + self.arg = args['$[]'](1)}; + return $send(self, Opal.find_super_dispatcher(self, 'initialize', TMP_UncaughtThrowError_initialize_11, false), ["" + "uncaught throw " + (self.sym.$inspect())], null); + }, TMP_UncaughtThrowError_initialize_11.$$arity = 1), nil) && 'initialize'; + })($nesting[0], $$($nesting, 'ArgumentError'), $nesting); + (function($base, $super, $parent_nesting) { + function $NameError(){}; + var self = $NameError = $klass($base, $super, 'NameError', $NameError); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_NameError_initialize_12; + + + self.$attr_reader("name"); + return (Opal.def(self, '$initialize', TMP_NameError_initialize_12 = function $$initialize(message, name) { + var $iter = TMP_NameError_initialize_12.$$p, $yield = $iter || nil, self = this; + + if ($iter) TMP_NameError_initialize_12.$$p = null; + + + if (name == null) { + name = nil; + }; + $send(self, Opal.find_super_dispatcher(self, 'initialize', TMP_NameError_initialize_12, false), [message], null); + return (self.name = name); + }, TMP_NameError_initialize_12.$$arity = -2), nil) && 'initialize'; + })($nesting[0], null, $nesting); + (function($base, $super, $parent_nesting) { + function $NoMethodError(){}; + var self = $NoMethodError = $klass($base, $super, 'NoMethodError', $NoMethodError); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_NoMethodError_initialize_13; + + + self.$attr_reader("args"); + return (Opal.def(self, '$initialize', TMP_NoMethodError_initialize_13 = function $$initialize(message, name, args) { + var $iter = TMP_NoMethodError_initialize_13.$$p, $yield = $iter || nil, self = this; + + if ($iter) TMP_NoMethodError_initialize_13.$$p = null; + + + if (name == null) { + name = nil; + }; + + if (args == null) { + args = []; + }; + $send(self, Opal.find_super_dispatcher(self, 'initialize', TMP_NoMethodError_initialize_13, false), [message, name], null); + return (self.args = args); + }, TMP_NoMethodError_initialize_13.$$arity = -2), nil) && 'initialize'; + })($nesting[0], null, $nesting); + (function($base, $super, $parent_nesting) { + function $StopIteration(){}; + var self = $StopIteration = $klass($base, $super, 'StopIteration', $StopIteration); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return self.$attr_reader("result") + })($nesting[0], null, $nesting); + (function($base, $super, $parent_nesting) { + function $KeyError(){}; + var self = $KeyError = $klass($base, $super, 'KeyError', $KeyError); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_KeyError_initialize_14, TMP_KeyError_receiver_15, TMP_KeyError_key_16; + + def.receiver = def.key = nil; + + + Opal.def(self, '$initialize', TMP_KeyError_initialize_14 = function $$initialize(message, $kwargs) { + var receiver, key, $iter = TMP_KeyError_initialize_14.$$p, $yield = $iter || nil, self = this; + + if ($iter) TMP_KeyError_initialize_14.$$p = null; + + + if ($kwargs == null) { + $kwargs = $hash2([], {}); + } else if (!$kwargs.$$is_hash) { + throw Opal.ArgumentError.$new('expected kwargs'); + }; + + receiver = $kwargs.$$smap["receiver"]; + if (receiver == null) { + receiver = nil + }; + + key = $kwargs.$$smap["key"]; + if (key == null) { + key = nil + }; + $send(self, Opal.find_super_dispatcher(self, 'initialize', TMP_KeyError_initialize_14, false), [message], null); + self.receiver = receiver; + return (self.key = key); + }, TMP_KeyError_initialize_14.$$arity = -2); + + Opal.def(self, '$receiver', TMP_KeyError_receiver_15 = function $$receiver() { + var $a, self = this; + + return ($truthy($a = self.receiver) ? $a : self.$raise($$($nesting, 'ArgumentError'), "no receiver is available")) + }, TMP_KeyError_receiver_15.$$arity = 0); + return (Opal.def(self, '$key', TMP_KeyError_key_16 = function $$key() { + var $a, self = this; + + return ($truthy($a = self.key) ? $a : self.$raise($$($nesting, 'ArgumentError'), "no key is available")) + }, TMP_KeyError_key_16.$$arity = 0), nil) && 'key'; + })($nesting[0], null, $nesting); + return (function($base, $parent_nesting) { + function $JS() {}; + var self = $JS = $module($base, 'JS', $JS); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + (function($base, $super, $parent_nesting) { + function $Error(){}; + var self = $Error = $klass($base, $super, 'Error', $Error); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return nil + })($nesting[0], null, $nesting) + })($nesting[0], $nesting); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/constants"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice; + + + Opal.const_set($nesting[0], 'RUBY_PLATFORM', "opal"); + Opal.const_set($nesting[0], 'RUBY_ENGINE', "opal"); + Opal.const_set($nesting[0], 'RUBY_VERSION', "2.5.1"); + Opal.const_set($nesting[0], 'RUBY_ENGINE_VERSION', "0.11.99.dev"); + Opal.const_set($nesting[0], 'RUBY_RELEASE_DATE', "2018-12-25"); + Opal.const_set($nesting[0], 'RUBY_PATCHLEVEL', 0); + Opal.const_set($nesting[0], 'RUBY_REVISION', 0); + Opal.const_set($nesting[0], 'RUBY_COPYRIGHT', "opal - Copyright (C) 2013-2018 Adam Beynon and the Opal contributors"); + return Opal.const_set($nesting[0], 'RUBY_DESCRIPTION', "" + "opal " + ($$($nesting, 'RUBY_ENGINE_VERSION')) + " (" + ($$($nesting, 'RUBY_RELEASE_DATE')) + " revision " + ($$($nesting, 'RUBY_REVISION')) + ")"); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["opal/base"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice; + + Opal.add_stubs(['$require']); + + self.$require("corelib/runtime"); + self.$require("corelib/helpers"); + self.$require("corelib/module"); + self.$require("corelib/class"); + self.$require("corelib/basic_object"); + self.$require("corelib/kernel"); + self.$require("corelib/error"); + return self.$require("corelib/constants"); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/nil"] = function(Opal) { + function $rb_gt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $hash2 = Opal.hash2, $truthy = Opal.truthy; + + Opal.add_stubs(['$raise', '$name', '$new', '$>', '$length', '$Rational']); + + (function($base, $super, $parent_nesting) { + function $NilClass(){}; + var self = $NilClass = $klass($base, $super, 'NilClass', $NilClass); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_NilClass_$B_2, TMP_NilClass_$_3, TMP_NilClass_$_4, TMP_NilClass_$_5, TMP_NilClass_$eq$eq_6, TMP_NilClass_dup_7, TMP_NilClass_clone_8, TMP_NilClass_inspect_9, TMP_NilClass_nil$q_10, TMP_NilClass_singleton_class_11, TMP_NilClass_to_a_12, TMP_NilClass_to_h_13, TMP_NilClass_to_i_14, TMP_NilClass_to_s_15, TMP_NilClass_to_c_16, TMP_NilClass_rationalize_17, TMP_NilClass_to_r_18, TMP_NilClass_instance_variables_19; + + + def.$$meta = self; + (function(self, $parent_nesting) { + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_allocate_1; + + + + Opal.def(self, '$allocate', TMP_allocate_1 = function $$allocate() { + var self = this; + + return self.$raise($$($nesting, 'TypeError'), "" + "allocator undefined for " + (self.$name())) + }, TMP_allocate_1.$$arity = 0); + + + Opal.udef(self, '$' + "new");; + return nil;; + })(Opal.get_singleton_class(self), $nesting); + + Opal.def(self, '$!', TMP_NilClass_$B_2 = function() { + var self = this; + + return true + }, TMP_NilClass_$B_2.$$arity = 0); + + Opal.def(self, '$&', TMP_NilClass_$_3 = function(other) { + var self = this; + + return false + }, TMP_NilClass_$_3.$$arity = 1); + + Opal.def(self, '$|', TMP_NilClass_$_4 = function(other) { + var self = this; + + return other !== false && other !== nil; + }, TMP_NilClass_$_4.$$arity = 1); + + Opal.def(self, '$^', TMP_NilClass_$_5 = function(other) { + var self = this; + + return other !== false && other !== nil; + }, TMP_NilClass_$_5.$$arity = 1); + + Opal.def(self, '$==', TMP_NilClass_$eq$eq_6 = function(other) { + var self = this; + + return other === nil; + }, TMP_NilClass_$eq$eq_6.$$arity = 1); + + Opal.def(self, '$dup', TMP_NilClass_dup_7 = function $$dup() { + var self = this; + + return nil + }, TMP_NilClass_dup_7.$$arity = 0); + + Opal.def(self, '$clone', TMP_NilClass_clone_8 = function $$clone($kwargs) { + var freeze, self = this; + + + + if ($kwargs == null) { + $kwargs = $hash2([], {}); + } else if (!$kwargs.$$is_hash) { + throw Opal.ArgumentError.$new('expected kwargs'); + }; + + freeze = $kwargs.$$smap["freeze"]; + if (freeze == null) { + freeze = true + }; + return nil; + }, TMP_NilClass_clone_8.$$arity = -1); + + Opal.def(self, '$inspect', TMP_NilClass_inspect_9 = function $$inspect() { + var self = this; + + return "nil" + }, TMP_NilClass_inspect_9.$$arity = 0); + + Opal.def(self, '$nil?', TMP_NilClass_nil$q_10 = function() { + var self = this; + + return true + }, TMP_NilClass_nil$q_10.$$arity = 0); + + Opal.def(self, '$singleton_class', TMP_NilClass_singleton_class_11 = function $$singleton_class() { + var self = this; + + return $$($nesting, 'NilClass') + }, TMP_NilClass_singleton_class_11.$$arity = 0); + + Opal.def(self, '$to_a', TMP_NilClass_to_a_12 = function $$to_a() { + var self = this; + + return [] + }, TMP_NilClass_to_a_12.$$arity = 0); + + Opal.def(self, '$to_h', TMP_NilClass_to_h_13 = function $$to_h() { + var self = this; + + return Opal.hash(); + }, TMP_NilClass_to_h_13.$$arity = 0); + + Opal.def(self, '$to_i', TMP_NilClass_to_i_14 = function $$to_i() { + var self = this; + + return 0 + }, TMP_NilClass_to_i_14.$$arity = 0); + Opal.alias(self, "to_f", "to_i"); + + Opal.def(self, '$to_s', TMP_NilClass_to_s_15 = function $$to_s() { + var self = this; + + return "" + }, TMP_NilClass_to_s_15.$$arity = 0); + + Opal.def(self, '$to_c', TMP_NilClass_to_c_16 = function $$to_c() { + var self = this; + + return $$($nesting, 'Complex').$new(0, 0) + }, TMP_NilClass_to_c_16.$$arity = 0); + + Opal.def(self, '$rationalize', TMP_NilClass_rationalize_17 = function $$rationalize($a) { + var $post_args, args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + if ($truthy($rb_gt(args.$length(), 1))) { + self.$raise($$($nesting, 'ArgumentError'))}; + return self.$Rational(0, 1); + }, TMP_NilClass_rationalize_17.$$arity = -1); + + Opal.def(self, '$to_r', TMP_NilClass_to_r_18 = function $$to_r() { + var self = this; + + return self.$Rational(0, 1) + }, TMP_NilClass_to_r_18.$$arity = 0); + return (Opal.def(self, '$instance_variables', TMP_NilClass_instance_variables_19 = function $$instance_variables() { + var self = this; + + return [] + }, TMP_NilClass_instance_variables_19.$$arity = 0), nil) && 'instance_variables'; + })($nesting[0], null, $nesting); + return Opal.const_set($nesting[0], 'NIL', nil); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/boolean"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $hash2 = Opal.hash2; + + Opal.add_stubs(['$raise', '$name']); + + (function($base, $super, $parent_nesting) { + function $Boolean(){}; + var self = $Boolean = $klass($base, $super, 'Boolean', $Boolean); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Boolean___id___2, TMP_Boolean_$B_3, TMP_Boolean_$_4, TMP_Boolean_$_5, TMP_Boolean_$_6, TMP_Boolean_$eq$eq_7, TMP_Boolean_singleton_class_8, TMP_Boolean_to_s_9, TMP_Boolean_dup_10, TMP_Boolean_clone_11; + + + Opal.defineProperty(Boolean.prototype, '$$is_boolean', true); + Opal.defineProperty(Boolean.prototype, '$$meta', self); + (function(self, $parent_nesting) { + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_allocate_1; + + + + Opal.def(self, '$allocate', TMP_allocate_1 = function $$allocate() { + var self = this; + + return self.$raise($$($nesting, 'TypeError'), "" + "allocator undefined for " + (self.$name())) + }, TMP_allocate_1.$$arity = 0); + + + Opal.udef(self, '$' + "new");; + return nil;; + })(Opal.get_singleton_class(self), $nesting); + + Opal.def(self, '$__id__', TMP_Boolean___id___2 = function $$__id__() { + var self = this; + + return self.valueOf() ? 2 : 0; + }, TMP_Boolean___id___2.$$arity = 0); + Opal.alias(self, "object_id", "__id__"); + + Opal.def(self, '$!', TMP_Boolean_$B_3 = function() { + var self = this; + + return self != true; + }, TMP_Boolean_$B_3.$$arity = 0); + + Opal.def(self, '$&', TMP_Boolean_$_4 = function(other) { + var self = this; + + return (self == true) ? (other !== false && other !== nil) : false; + }, TMP_Boolean_$_4.$$arity = 1); + + Opal.def(self, '$|', TMP_Boolean_$_5 = function(other) { + var self = this; + + return (self == true) ? true : (other !== false && other !== nil); + }, TMP_Boolean_$_5.$$arity = 1); + + Opal.def(self, '$^', TMP_Boolean_$_6 = function(other) { + var self = this; + + return (self == true) ? (other === false || other === nil) : (other !== false && other !== nil); + }, TMP_Boolean_$_6.$$arity = 1); + + Opal.def(self, '$==', TMP_Boolean_$eq$eq_7 = function(other) { + var self = this; + + return (self == true) === other.valueOf(); + }, TMP_Boolean_$eq$eq_7.$$arity = 1); + Opal.alias(self, "equal?", "=="); + Opal.alias(self, "eql?", "=="); + + Opal.def(self, '$singleton_class', TMP_Boolean_singleton_class_8 = function $$singleton_class() { + var self = this; + + return $$($nesting, 'Boolean') + }, TMP_Boolean_singleton_class_8.$$arity = 0); + + Opal.def(self, '$to_s', TMP_Boolean_to_s_9 = function $$to_s() { + var self = this; + + return (self == true) ? 'true' : 'false'; + }, TMP_Boolean_to_s_9.$$arity = 0); + + Opal.def(self, '$dup', TMP_Boolean_dup_10 = function $$dup() { + var self = this; + + return self + }, TMP_Boolean_dup_10.$$arity = 0); + return (Opal.def(self, '$clone', TMP_Boolean_clone_11 = function $$clone($kwargs) { + var freeze, self = this; + + + + if ($kwargs == null) { + $kwargs = $hash2([], {}); + } else if (!$kwargs.$$is_hash) { + throw Opal.ArgumentError.$new('expected kwargs'); + }; + + freeze = $kwargs.$$smap["freeze"]; + if (freeze == null) { + freeze = true + }; + return self; + }, TMP_Boolean_clone_11.$$arity = -1), nil) && 'clone'; + })($nesting[0], Boolean, $nesting); + Opal.const_set($nesting[0], 'TrueClass', $$($nesting, 'Boolean')); + Opal.const_set($nesting[0], 'FalseClass', $$($nesting, 'Boolean')); + Opal.const_set($nesting[0], 'TRUE', true); + return Opal.const_set($nesting[0], 'FALSE', false); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/comparable"] = function(Opal) { + function $rb_gt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); + } + function $rb_lt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $truthy = Opal.truthy; + + Opal.add_stubs(['$===', '$>', '$<', '$equal?', '$<=>', '$normalize', '$raise', '$class']); + return (function($base, $parent_nesting) { + function $Comparable() {}; + var self = $Comparable = $module($base, 'Comparable', $Comparable); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Comparable_normalize_1, TMP_Comparable_$eq$eq_2, TMP_Comparable_$gt_3, TMP_Comparable_$gt$eq_4, TMP_Comparable_$lt_5, TMP_Comparable_$lt$eq_6, TMP_Comparable_between$q_7, TMP_Comparable_clamp_8; + + + Opal.defs(self, '$normalize', TMP_Comparable_normalize_1 = function $$normalize(what) { + var self = this; + + + if ($truthy($$($nesting, 'Integer')['$==='](what))) { + return what}; + if ($truthy($rb_gt(what, 0))) { + return 1}; + if ($truthy($rb_lt(what, 0))) { + return -1}; + return 0; + }, TMP_Comparable_normalize_1.$$arity = 1); + + Opal.def(self, '$==', TMP_Comparable_$eq$eq_2 = function(other) { + var self = this, cmp = nil; + + try { + + if ($truthy(self['$equal?'](other))) { + return true}; + + if (self["$<=>"] == Opal.Kernel["$<=>"]) { + return false; + } + + // check for infinite recursion + if (self.$$comparable) { + delete self.$$comparable; + return false; + } + ; + if ($truthy((cmp = self['$<=>'](other)))) { + } else { + return false + }; + return $$($nesting, 'Comparable').$normalize(cmp) == 0; + } catch ($err) { + if (Opal.rescue($err, [$$($nesting, 'StandardError')])) { + try { + return false + } finally { Opal.pop_exception() } + } else { throw $err; } + } + }, TMP_Comparable_$eq$eq_2.$$arity = 1); + + Opal.def(self, '$>', TMP_Comparable_$gt_3 = function(other) { + var self = this, cmp = nil; + + + if ($truthy((cmp = self['$<=>'](other)))) { + } else { + self.$raise($$($nesting, 'ArgumentError'), "" + "comparison of " + (self.$class()) + " with " + (other.$class()) + " failed") + }; + return $$($nesting, 'Comparable').$normalize(cmp) > 0; + }, TMP_Comparable_$gt_3.$$arity = 1); + + Opal.def(self, '$>=', TMP_Comparable_$gt$eq_4 = function(other) { + var self = this, cmp = nil; + + + if ($truthy((cmp = self['$<=>'](other)))) { + } else { + self.$raise($$($nesting, 'ArgumentError'), "" + "comparison of " + (self.$class()) + " with " + (other.$class()) + " failed") + }; + return $$($nesting, 'Comparable').$normalize(cmp) >= 0; + }, TMP_Comparable_$gt$eq_4.$$arity = 1); + + Opal.def(self, '$<', TMP_Comparable_$lt_5 = function(other) { + var self = this, cmp = nil; + + + if ($truthy((cmp = self['$<=>'](other)))) { + } else { + self.$raise($$($nesting, 'ArgumentError'), "" + "comparison of " + (self.$class()) + " with " + (other.$class()) + " failed") + }; + return $$($nesting, 'Comparable').$normalize(cmp) < 0; + }, TMP_Comparable_$lt_5.$$arity = 1); + + Opal.def(self, '$<=', TMP_Comparable_$lt$eq_6 = function(other) { + var self = this, cmp = nil; + + + if ($truthy((cmp = self['$<=>'](other)))) { + } else { + self.$raise($$($nesting, 'ArgumentError'), "" + "comparison of " + (self.$class()) + " with " + (other.$class()) + " failed") + }; + return $$($nesting, 'Comparable').$normalize(cmp) <= 0; + }, TMP_Comparable_$lt$eq_6.$$arity = 1); + + Opal.def(self, '$between?', TMP_Comparable_between$q_7 = function(min, max) { + var self = this; + + + if ($rb_lt(self, min)) { + return false}; + if ($rb_gt(self, max)) { + return false}; + return true; + }, TMP_Comparable_between$q_7.$$arity = 2); + + Opal.def(self, '$clamp', TMP_Comparable_clamp_8 = function $$clamp(min, max) { + var self = this, cmp = nil; + + + cmp = min['$<=>'](max); + if ($truthy(cmp)) { + } else { + self.$raise($$($nesting, 'ArgumentError'), "" + "comparison of " + (min.$class()) + " with " + (max.$class()) + " failed") + }; + if ($truthy($rb_gt($$($nesting, 'Comparable').$normalize(cmp), 0))) { + self.$raise($$($nesting, 'ArgumentError'), "min argument must be smaller than max argument")}; + if ($truthy($rb_lt($$($nesting, 'Comparable').$normalize(self['$<=>'](min)), 0))) { + return min}; + if ($truthy($rb_gt($$($nesting, 'Comparable').$normalize(self['$<=>'](max)), 0))) { + return max}; + return self; + }, TMP_Comparable_clamp_8.$$arity = 2); + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/regexp"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $send = Opal.send, $truthy = Opal.truthy, $gvars = Opal.gvars; + + Opal.add_stubs(['$nil?', '$[]', '$raise', '$escape', '$options', '$to_str', '$new', '$join', '$coerce_to!', '$!', '$match', '$coerce_to?', '$begin', '$coerce_to', '$=~', '$attr_reader', '$===', '$inspect', '$to_a']); + + (function($base, $super, $parent_nesting) { + function $RegexpError(){}; + var self = $RegexpError = $klass($base, $super, 'RegexpError', $RegexpError); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return nil + })($nesting[0], $$($nesting, 'StandardError'), $nesting); + (function($base, $super, $parent_nesting) { + function $Regexp(){}; + var self = $Regexp = $klass($base, $super, 'Regexp', $Regexp); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Regexp_$eq$eq_6, TMP_Regexp_$eq$eq$eq_7, TMP_Regexp_$eq$_8, TMP_Regexp_inspect_9, TMP_Regexp_match_10, TMP_Regexp_match$q_11, TMP_Regexp_$_12, TMP_Regexp_source_13, TMP_Regexp_options_14, TMP_Regexp_casefold$q_15; + + + Opal.const_set($nesting[0], 'IGNORECASE', 1); + Opal.const_set($nesting[0], 'EXTENDED', 2); + Opal.const_set($nesting[0], 'MULTILINE', 4); + Opal.defineProperty(RegExp.prototype, '$$is_regexp', true); + (function(self, $parent_nesting) { + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_allocate_1, TMP_escape_2, TMP_last_match_3, TMP_union_4, TMP_new_5; + + + + Opal.def(self, '$allocate', TMP_allocate_1 = function $$allocate() { + var $iter = TMP_allocate_1.$$p, $yield = $iter || nil, self = this, allocated = nil, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_allocate_1.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + + allocated = $send(self, Opal.find_super_dispatcher(self, 'allocate', TMP_allocate_1, false), $zuper, $iter); + allocated.uninitialized = true; + return allocated; + }, TMP_allocate_1.$$arity = 0); + + Opal.def(self, '$escape', TMP_escape_2 = function $$escape(string) { + var self = this; + + return Opal.escape_regexp(string); + }, TMP_escape_2.$$arity = 1); + + Opal.def(self, '$last_match', TMP_last_match_3 = function $$last_match(n) { + var self = this; + if ($gvars["~"] == null) $gvars["~"] = nil; + + + + if (n == null) { + n = nil; + }; + if ($truthy(n['$nil?']())) { + return $gvars["~"] + } else { + return $gvars["~"]['$[]'](n) + }; + }, TMP_last_match_3.$$arity = -1); + Opal.alias(self, "quote", "escape"); + + Opal.def(self, '$union', TMP_union_4 = function $$union($a) { + var $post_args, parts, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + parts = $post_args;; + + var is_first_part_array, quoted_validated, part, options, each_part_options; + if (parts.length == 0) { + return /(?!)/; + } + // return fast if there's only one element + if (parts.length == 1 && parts[0].$$is_regexp) { + return parts[0]; + } + // cover the 2 arrays passed as arguments case + is_first_part_array = parts[0].$$is_array; + if (parts.length > 1 && is_first_part_array) { + self.$raise($$($nesting, 'TypeError'), "no implicit conversion of Array into String") + } + // deal with splat issues (related to https://github.com/opal/opal/issues/858) + if (is_first_part_array) { + parts = parts[0]; + } + options = undefined; + quoted_validated = []; + for (var i=0; i < parts.length; i++) { + part = parts[i]; + if (part.$$is_string) { + quoted_validated.push(self.$escape(part)); + } + else if (part.$$is_regexp) { + each_part_options = (part).$options(); + if (options != undefined && options != each_part_options) { + self.$raise($$($nesting, 'TypeError'), "All expressions must use the same options") + } + options = each_part_options; + quoted_validated.push('('+part.source+')'); + } + else { + quoted_validated.push(self.$escape((part).$to_str())); + } + } + ; + return self.$new((quoted_validated).$join("|"), options); + }, TMP_union_4.$$arity = -1); + return (Opal.def(self, '$new', TMP_new_5 = function(regexp, options) { + var self = this; + + + ; + + if (regexp.$$is_regexp) { + return new RegExp(regexp); + } + + regexp = $$($nesting, 'Opal')['$coerce_to!'](regexp, $$($nesting, 'String'), "to_str"); + + if (regexp.charAt(regexp.length - 1) === '\\' && regexp.charAt(regexp.length - 2) !== '\\') { + self.$raise($$($nesting, 'RegexpError'), "" + "too short escape sequence: /" + (regexp) + "/") + } + + if (options === undefined || options['$!']()) { + return new RegExp(regexp); + } + + if (options.$$is_number) { + var temp = ''; + if ($$($nesting, 'IGNORECASE') & options) { temp += 'i'; } + if ($$($nesting, 'MULTILINE') & options) { temp += 'm'; } + options = temp; + } + else { + options = 'i'; + } + + return new RegExp(regexp, options); + ; + }, TMP_new_5.$$arity = -2), nil) && 'new'; + })(Opal.get_singleton_class(self), $nesting); + + Opal.def(self, '$==', TMP_Regexp_$eq$eq_6 = function(other) { + var self = this; + + return other instanceof RegExp && self.toString() === other.toString(); + }, TMP_Regexp_$eq$eq_6.$$arity = 1); + + Opal.def(self, '$===', TMP_Regexp_$eq$eq$eq_7 = function(string) { + var self = this; + + return self.$match($$($nesting, 'Opal')['$coerce_to?'](string, $$($nesting, 'String'), "to_str")) !== nil + }, TMP_Regexp_$eq$eq$eq_7.$$arity = 1); + + Opal.def(self, '$=~', TMP_Regexp_$eq$_8 = function(string) { + var $a, self = this; + if ($gvars["~"] == null) $gvars["~"] = nil; + + return ($truthy($a = self.$match(string)) ? $gvars["~"].$begin(0) : $a) + }, TMP_Regexp_$eq$_8.$$arity = 1); + Opal.alias(self, "eql?", "=="); + + Opal.def(self, '$inspect', TMP_Regexp_inspect_9 = function $$inspect() { + var self = this; + + + var regexp_format = /^\/(.*)\/([^\/]*)$/; + var value = self.toString(); + var matches = regexp_format.exec(value); + if (matches) { + var regexp_pattern = matches[1]; + var regexp_flags = matches[2]; + var chars = regexp_pattern.split(''); + var chars_length = chars.length; + var char_escaped = false; + var regexp_pattern_escaped = ''; + for (var i = 0; i < chars_length; i++) { + var current_char = chars[i]; + if (!char_escaped && current_char == '/') { + regexp_pattern_escaped = regexp_pattern_escaped.concat('\\'); + } + regexp_pattern_escaped = regexp_pattern_escaped.concat(current_char); + if (current_char == '\\') { + if (char_escaped) { + // does not over escape + char_escaped = false; + } else { + char_escaped = true; + } + } else { + char_escaped = false; + } + } + return '/' + regexp_pattern_escaped + '/' + regexp_flags; + } else { + return value; + } + + }, TMP_Regexp_inspect_9.$$arity = 0); + + Opal.def(self, '$match', TMP_Regexp_match_10 = function $$match(string, pos) { + var $iter = TMP_Regexp_match_10.$$p, block = $iter || nil, self = this; + if ($gvars["~"] == null) $gvars["~"] = nil; + + if ($iter) TMP_Regexp_match_10.$$p = null; + + + if ($iter) TMP_Regexp_match_10.$$p = null;; + ; + + if (self.uninitialized) { + self.$raise($$($nesting, 'TypeError'), "uninitialized Regexp") + } + + if (pos === undefined) { + if (string === nil) return ($gvars["~"] = nil); + var m = self.exec($$($nesting, 'Opal').$coerce_to(string, $$($nesting, 'String'), "to_str")); + if (m) { + ($gvars["~"] = $$($nesting, 'MatchData').$new(self, m)); + return block === nil ? $gvars["~"] : Opal.yield1(block, $gvars["~"]); + } else { + return ($gvars["~"] = nil); + } + } + + pos = $$($nesting, 'Opal').$coerce_to(pos, $$($nesting, 'Integer'), "to_int"); + + if (string === nil) { + return ($gvars["~"] = nil); + } + + string = $$($nesting, 'Opal').$coerce_to(string, $$($nesting, 'String'), "to_str"); + + if (pos < 0) { + pos += string.length; + if (pos < 0) { + return ($gvars["~"] = nil); + } + } + + // global RegExp maintains state, so not using self/this + var md, re = Opal.global_regexp(self); + + while (true) { + md = re.exec(string); + if (md === null) { + return ($gvars["~"] = nil); + } + if (md.index >= pos) { + ($gvars["~"] = $$($nesting, 'MatchData').$new(re, md)); + return block === nil ? $gvars["~"] : Opal.yield1(block, $gvars["~"]); + } + re.lastIndex = md.index + 1; + } + ; + }, TMP_Regexp_match_10.$$arity = -2); + + Opal.def(self, '$match?', TMP_Regexp_match$q_11 = function(string, pos) { + var self = this; + + + ; + + if (self.uninitialized) { + self.$raise($$($nesting, 'TypeError'), "uninitialized Regexp") + } + + if (pos === undefined) { + return string === nil ? false : self.test($$($nesting, 'Opal').$coerce_to(string, $$($nesting, 'String'), "to_str")); + } + + pos = $$($nesting, 'Opal').$coerce_to(pos, $$($nesting, 'Integer'), "to_int"); + + if (string === nil) { + return false; + } + + string = $$($nesting, 'Opal').$coerce_to(string, $$($nesting, 'String'), "to_str"); + + if (pos < 0) { + pos += string.length; + if (pos < 0) { + return false; + } + } + + // global RegExp maintains state, so not using self/this + var md, re = Opal.global_regexp(self); + + md = re.exec(string); + if (md === null || md.index < pos) { + return false; + } else { + return true; + } + ; + }, TMP_Regexp_match$q_11.$$arity = -2); + + Opal.def(self, '$~', TMP_Regexp_$_12 = function() { + var self = this; + if ($gvars._ == null) $gvars._ = nil; + + return self['$=~']($gvars._) + }, TMP_Regexp_$_12.$$arity = 0); + + Opal.def(self, '$source', TMP_Regexp_source_13 = function $$source() { + var self = this; + + return self.source; + }, TMP_Regexp_source_13.$$arity = 0); + + Opal.def(self, '$options', TMP_Regexp_options_14 = function $$options() { + var self = this; + + + if (self.uninitialized) { + self.$raise($$($nesting, 'TypeError'), "uninitialized Regexp") + } + var result = 0; + // should be supported in IE6 according to https://msdn.microsoft.com/en-us/library/7f5z26w4(v=vs.94).aspx + if (self.multiline) { + result |= $$($nesting, 'MULTILINE'); + } + if (self.ignoreCase) { + result |= $$($nesting, 'IGNORECASE'); + } + return result; + + }, TMP_Regexp_options_14.$$arity = 0); + + Opal.def(self, '$casefold?', TMP_Regexp_casefold$q_15 = function() { + var self = this; + + return self.ignoreCase; + }, TMP_Regexp_casefold$q_15.$$arity = 0); + return Opal.alias(self, "to_s", "source"); + })($nesting[0], RegExp, $nesting); + return (function($base, $super, $parent_nesting) { + function $MatchData(){}; + var self = $MatchData = $klass($base, $super, 'MatchData', $MatchData); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_MatchData_initialize_16, TMP_MatchData_$$_17, TMP_MatchData_offset_18, TMP_MatchData_$eq$eq_19, TMP_MatchData_begin_20, TMP_MatchData_end_21, TMP_MatchData_captures_22, TMP_MatchData_inspect_23, TMP_MatchData_length_24, TMP_MatchData_to_a_25, TMP_MatchData_to_s_26, TMP_MatchData_values_at_27; + + def.matches = nil; + + self.$attr_reader("post_match", "pre_match", "regexp", "string"); + + Opal.def(self, '$initialize', TMP_MatchData_initialize_16 = function $$initialize(regexp, match_groups) { + var self = this; + + + $gvars["~"] = self; + self.regexp = regexp; + self.begin = match_groups.index; + self.string = match_groups.input; + self.pre_match = match_groups.input.slice(0, match_groups.index); + self.post_match = match_groups.input.slice(match_groups.index + match_groups[0].length); + self.matches = []; + + for (var i = 0, length = match_groups.length; i < length; i++) { + var group = match_groups[i]; + + if (group == null) { + self.matches.push(nil); + } + else { + self.matches.push(group); + } + } + ; + }, TMP_MatchData_initialize_16.$$arity = 2); + + Opal.def(self, '$[]', TMP_MatchData_$$_17 = function($a) { + var $post_args, args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + return $send(self.matches, '[]', Opal.to_a(args)); + }, TMP_MatchData_$$_17.$$arity = -1); + + Opal.def(self, '$offset', TMP_MatchData_offset_18 = function $$offset(n) { + var self = this; + + + if (n !== 0) { + self.$raise($$($nesting, 'ArgumentError'), "MatchData#offset only supports 0th element") + } + return [self.begin, self.begin + self.matches[n].length]; + + }, TMP_MatchData_offset_18.$$arity = 1); + + Opal.def(self, '$==', TMP_MatchData_$eq$eq_19 = function(other) { + var $a, $b, $c, $d, self = this; + + + if ($truthy($$($nesting, 'MatchData')['$==='](other))) { + } else { + return false + }; + return ($truthy($a = ($truthy($b = ($truthy($c = ($truthy($d = self.string == other.string) ? self.regexp.toString() == other.regexp.toString() : $d)) ? self.pre_match == other.pre_match : $c)) ? self.post_match == other.post_match : $b)) ? self.begin == other.begin : $a); + }, TMP_MatchData_$eq$eq_19.$$arity = 1); + Opal.alias(self, "eql?", "=="); + + Opal.def(self, '$begin', TMP_MatchData_begin_20 = function $$begin(n) { + var self = this; + + + if (n !== 0) { + self.$raise($$($nesting, 'ArgumentError'), "MatchData#begin only supports 0th element") + } + return self.begin; + + }, TMP_MatchData_begin_20.$$arity = 1); + + Opal.def(self, '$end', TMP_MatchData_end_21 = function $$end(n) { + var self = this; + + + if (n !== 0) { + self.$raise($$($nesting, 'ArgumentError'), "MatchData#end only supports 0th element") + } + return self.begin + self.matches[n].length; + + }, TMP_MatchData_end_21.$$arity = 1); + + Opal.def(self, '$captures', TMP_MatchData_captures_22 = function $$captures() { + var self = this; + + return self.matches.slice(1) + }, TMP_MatchData_captures_22.$$arity = 0); + + Opal.def(self, '$inspect', TMP_MatchData_inspect_23 = function $$inspect() { + var self = this; + + + var str = "#"; + + }, TMP_MatchData_inspect_23.$$arity = 0); + + Opal.def(self, '$length', TMP_MatchData_length_24 = function $$length() { + var self = this; + + return self.matches.length + }, TMP_MatchData_length_24.$$arity = 0); + Opal.alias(self, "size", "length"); + + Opal.def(self, '$to_a', TMP_MatchData_to_a_25 = function $$to_a() { + var self = this; + + return self.matches + }, TMP_MatchData_to_a_25.$$arity = 0); + + Opal.def(self, '$to_s', TMP_MatchData_to_s_26 = function $$to_s() { + var self = this; + + return self.matches[0] + }, TMP_MatchData_to_s_26.$$arity = 0); + return (Opal.def(self, '$values_at', TMP_MatchData_values_at_27 = function $$values_at($a) { + var $post_args, args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + + var i, a, index, values = []; + + for (i = 0; i < args.length; i++) { + + if (args[i].$$is_range) { + a = (args[i]).$to_a(); + a.unshift(i, 1); + Array.prototype.splice.apply(args, a); + } + + index = $$($nesting, 'Opal')['$coerce_to!'](args[i], $$($nesting, 'Integer'), "to_int"); + + if (index < 0) { + index += self.matches.length; + if (index < 0) { + values.push(nil); + continue; + } + } + + values.push(self.matches[index]); + } + + return values; + ; + }, TMP_MatchData_values_at_27.$$arity = -1), nil) && 'values_at'; + })($nesting[0], null, $nesting); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/string"] = function(Opal) { + function $rb_divide(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs / rhs : lhs['$/'](rhs); + } + function $rb_plus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $truthy = Opal.truthy, $send = Opal.send, $gvars = Opal.gvars; + + Opal.add_stubs(['$require', '$include', '$coerce_to?', '$coerce_to', '$raise', '$===', '$format', '$to_s', '$respond_to?', '$to_str', '$<=>', '$==', '$=~', '$new', '$force_encoding', '$casecmp', '$empty?', '$ljust', '$ceil', '$/', '$+', '$rjust', '$floor', '$to_a', '$each_char', '$to_proc', '$coerce_to!', '$copy_singleton_methods', '$initialize_clone', '$initialize_dup', '$enum_for', '$size', '$chomp', '$[]', '$to_i', '$each_line', '$class', '$match', '$match?', '$captures', '$proc', '$succ', '$escape']); + + self.$require("corelib/comparable"); + self.$require("corelib/regexp"); + (function($base, $super, $parent_nesting) { + function $String(){}; + var self = $String = $klass($base, $super, 'String', $String); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_String___id___1, TMP_String_try_convert_2, TMP_String_new_3, TMP_String_initialize_4, TMP_String_$_5, TMP_String_$_6, TMP_String_$_7, TMP_String_$lt$eq$gt_8, TMP_String_$eq$eq_9, TMP_String_$eq$_10, TMP_String_$$_11, TMP_String_b_12, TMP_String_capitalize_13, TMP_String_casecmp_14, TMP_String_casecmp$q_15, TMP_String_center_16, TMP_String_chars_17, TMP_String_chomp_18, TMP_String_chop_19, TMP_String_chr_20, TMP_String_clone_21, TMP_String_dup_22, TMP_String_count_23, TMP_String_delete_24, TMP_String_delete_prefix_25, TMP_String_delete_suffix_26, TMP_String_downcase_27, TMP_String_each_char_28, TMP_String_each_line_30, TMP_String_empty$q_31, TMP_String_end_with$q_32, TMP_String_gsub_33, TMP_String_hash_34, TMP_String_hex_35, TMP_String_include$q_36, TMP_String_index_37, TMP_String_inspect_38, TMP_String_intern_39, TMP_String_lines_40, TMP_String_length_41, TMP_String_ljust_42, TMP_String_lstrip_43, TMP_String_ascii_only$q_44, TMP_String_match_45, TMP_String_match$q_46, TMP_String_next_47, TMP_String_oct_48, TMP_String_ord_49, TMP_String_partition_50, TMP_String_reverse_51, TMP_String_rindex_52, TMP_String_rjust_53, TMP_String_rpartition_54, TMP_String_rstrip_55, TMP_String_scan_56, TMP_String_split_57, TMP_String_squeeze_58, TMP_String_start_with$q_59, TMP_String_strip_60, TMP_String_sub_61, TMP_String_sum_62, TMP_String_swapcase_63, TMP_String_to_f_64, TMP_String_to_i_65, TMP_String_to_proc_66, TMP_String_to_s_68, TMP_String_tr_69, TMP_String_tr_s_70, TMP_String_upcase_71, TMP_String_upto_72, TMP_String_instance_variables_73, TMP_String__load_74, TMP_String_unicode_normalize_75, TMP_String_unicode_normalized$q_76, TMP_String_unpack_77, TMP_String_unpack1_78; + + + self.$include($$($nesting, 'Comparable')); + + Opal.defineProperty(String.prototype, '$$is_string', true); + + Opal.defineProperty(String.prototype, '$$cast', function(string) { + var klass = this.$$class; + if (klass === String) { + return string; + } else { + return new klass(string); + } + }); + ; + + Opal.def(self, '$__id__', TMP_String___id___1 = function $$__id__() { + var self = this; + + return self.toString(); + }, TMP_String___id___1.$$arity = 0); + Opal.alias(self, "object_id", "__id__"); + Opal.defs(self, '$try_convert', TMP_String_try_convert_2 = function $$try_convert(what) { + var self = this; + + return $$($nesting, 'Opal')['$coerce_to?'](what, $$($nesting, 'String'), "to_str") + }, TMP_String_try_convert_2.$$arity = 1); + Opal.defs(self, '$new', TMP_String_new_3 = function(str) { + var self = this; + + + + if (str == null) { + str = ""; + }; + str = $$($nesting, 'Opal').$coerce_to(str, $$($nesting, 'String'), "to_str"); + return new self(str);; + }, TMP_String_new_3.$$arity = -1); + + Opal.def(self, '$initialize', TMP_String_initialize_4 = function $$initialize(str) { + var self = this; + + + ; + + if (str === undefined) { + return self; + } + ; + return self.$raise($$($nesting, 'NotImplementedError'), "Mutable strings are not supported in Opal."); + }, TMP_String_initialize_4.$$arity = -1); + + Opal.def(self, '$%', TMP_String_$_5 = function(data) { + var self = this; + + if ($truthy($$($nesting, 'Array')['$==='](data))) { + return $send(self, 'format', [self].concat(Opal.to_a(data))) + } else { + return self.$format(self, data) + } + }, TMP_String_$_5.$$arity = 1); + + Opal.def(self, '$*', TMP_String_$_6 = function(count) { + var self = this; + + + count = $$($nesting, 'Opal').$coerce_to(count, $$($nesting, 'Integer'), "to_int"); + + if (count < 0) { + self.$raise($$($nesting, 'ArgumentError'), "negative argument") + } + + if (count === 0) { + return self.$$cast(''); + } + + var result = '', + string = self.toString(); + + // All credit for the bit-twiddling magic code below goes to Mozilla + // polyfill implementation of String.prototype.repeat() posted here: + // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/repeat + + if (string.length * count >= 1 << 28) { + self.$raise($$($nesting, 'RangeError'), "multiply count must not overflow maximum string size") + } + + for (;;) { + if ((count & 1) === 1) { + result += string; + } + count >>>= 1; + if (count === 0) { + break; + } + string += string; + } + + return self.$$cast(result); + + }, TMP_String_$_6.$$arity = 1); + + Opal.def(self, '$+', TMP_String_$_7 = function(other) { + var self = this; + + + other = $$($nesting, 'Opal').$coerce_to(other, $$($nesting, 'String'), "to_str"); + return self + other.$to_s(); + }, TMP_String_$_7.$$arity = 1); + + Opal.def(self, '$<=>', TMP_String_$lt$eq$gt_8 = function(other) { + var self = this; + + if ($truthy(other['$respond_to?']("to_str"))) { + + other = other.$to_str().$to_s(); + return self > other ? 1 : (self < other ? -1 : 0);; + } else { + + var cmp = other['$<=>'](self); + + if (cmp === nil) { + return nil; + } + else { + return cmp > 0 ? -1 : (cmp < 0 ? 1 : 0); + } + + } + }, TMP_String_$lt$eq$gt_8.$$arity = 1); + + Opal.def(self, '$==', TMP_String_$eq$eq_9 = function(other) { + var self = this; + + + if (other.$$is_string) { + return self.toString() === other.toString(); + } + if ($$($nesting, 'Opal')['$respond_to?'](other, "to_str")) { + return other['$=='](self); + } + return false; + + }, TMP_String_$eq$eq_9.$$arity = 1); + Opal.alias(self, "eql?", "=="); + Opal.alias(self, "===", "=="); + + Opal.def(self, '$=~', TMP_String_$eq$_10 = function(other) { + var self = this; + + + if (other.$$is_string) { + self.$raise($$($nesting, 'TypeError'), "type mismatch: String given"); + } + + return other['$=~'](self); + + }, TMP_String_$eq$_10.$$arity = 1); + + Opal.def(self, '$[]', TMP_String_$$_11 = function(index, length) { + var self = this; + + + ; + + var size = self.length, exclude; + + if (index.$$is_range) { + exclude = index.excl; + length = $$($nesting, 'Opal').$coerce_to(index.end, $$($nesting, 'Integer'), "to_int"); + index = $$($nesting, 'Opal').$coerce_to(index.begin, $$($nesting, 'Integer'), "to_int"); + + if (Math.abs(index) > size) { + return nil; + } + + if (index < 0) { + index += size; + } + + if (length < 0) { + length += size; + } + + if (!exclude) { + length += 1; + } + + length = length - index; + + if (length < 0) { + length = 0; + } + + return self.$$cast(self.substr(index, length)); + } + + + if (index.$$is_string) { + if (length != null) { + self.$raise($$($nesting, 'TypeError')) + } + return self.indexOf(index) !== -1 ? self.$$cast(index) : nil; + } + + + if (index.$$is_regexp) { + var match = self.match(index); + + if (match === null) { + ($gvars["~"] = nil) + return nil; + } + + ($gvars["~"] = $$($nesting, 'MatchData').$new(index, match)) + + if (length == null) { + return self.$$cast(match[0]); + } + + length = $$($nesting, 'Opal').$coerce_to(length, $$($nesting, 'Integer'), "to_int"); + + if (length < 0 && -length < match.length) { + return self.$$cast(match[length += match.length]); + } + + if (length >= 0 && length < match.length) { + return self.$$cast(match[length]); + } + + return nil; + } + + + index = $$($nesting, 'Opal').$coerce_to(index, $$($nesting, 'Integer'), "to_int"); + + if (index < 0) { + index += size; + } + + if (length == null) { + if (index >= size || index < 0) { + return nil; + } + return self.$$cast(self.substr(index, 1)); + } + + length = $$($nesting, 'Opal').$coerce_to(length, $$($nesting, 'Integer'), "to_int"); + + if (length < 0) { + return nil; + } + + if (index > size || index < 0) { + return nil; + } + + return self.$$cast(self.substr(index, length)); + ; + }, TMP_String_$$_11.$$arity = -2); + Opal.alias(self, "byteslice", "[]"); + + Opal.def(self, '$b', TMP_String_b_12 = function $$b() { + var self = this; + + return self.$force_encoding("binary") + }, TMP_String_b_12.$$arity = 0); + + Opal.def(self, '$capitalize', TMP_String_capitalize_13 = function $$capitalize() { + var self = this; + + return self.$$cast(self.charAt(0).toUpperCase() + self.substr(1).toLowerCase()); + }, TMP_String_capitalize_13.$$arity = 0); + + Opal.def(self, '$casecmp', TMP_String_casecmp_14 = function $$casecmp(other) { + var self = this; + + + if ($truthy(other['$respond_to?']("to_str"))) { + } else { + return nil + }; + other = $$($nesting, 'Opal').$coerce_to(other, $$($nesting, 'String'), "to_str").$to_s(); + + var ascii_only = /^[\x00-\x7F]*$/; + if (ascii_only.test(self) && ascii_only.test(other)) { + self = self.toLowerCase(); + other = other.toLowerCase(); + } + ; + return self['$<=>'](other); + }, TMP_String_casecmp_14.$$arity = 1); + + Opal.def(self, '$casecmp?', TMP_String_casecmp$q_15 = function(other) { + var self = this; + + + var cmp = self.$casecmp(other); + if (cmp === nil) { + return nil; + } else { + return cmp === 0; + } + + }, TMP_String_casecmp$q_15.$$arity = 1); + + Opal.def(self, '$center', TMP_String_center_16 = function $$center(width, padstr) { + var self = this; + + + + if (padstr == null) { + padstr = " "; + }; + width = $$($nesting, 'Opal').$coerce_to(width, $$($nesting, 'Integer'), "to_int"); + padstr = $$($nesting, 'Opal').$coerce_to(padstr, $$($nesting, 'String'), "to_str").$to_s(); + if ($truthy(padstr['$empty?']())) { + self.$raise($$($nesting, 'ArgumentError'), "zero width padding")}; + if ($truthy(width <= self.length)) { + return self}; + + var ljustified = self.$ljust($rb_divide($rb_plus(width, self.length), 2).$ceil(), padstr), + rjustified = self.$rjust($rb_divide($rb_plus(width, self.length), 2).$floor(), padstr); + + return self.$$cast(rjustified + ljustified.slice(self.length)); + ; + }, TMP_String_center_16.$$arity = -2); + + Opal.def(self, '$chars', TMP_String_chars_17 = function $$chars() { + var $iter = TMP_String_chars_17.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_String_chars_17.$$p = null; + + + if ($iter) TMP_String_chars_17.$$p = null;; + if ($truthy(block)) { + } else { + return self.$each_char().$to_a() + }; + return $send(self, 'each_char', [], block.$to_proc()); + }, TMP_String_chars_17.$$arity = 0); + + Opal.def(self, '$chomp', TMP_String_chomp_18 = function $$chomp(separator) { + var self = this; + if ($gvars["/"] == null) $gvars["/"] = nil; + + + + if (separator == null) { + separator = $gvars["/"]; + }; + if ($truthy(separator === nil || self.length === 0)) { + return self}; + separator = $$($nesting, 'Opal')['$coerce_to!'](separator, $$($nesting, 'String'), "to_str").$to_s(); + + var result; + + if (separator === "\n") { + result = self.replace(/\r?\n?$/, ''); + } + else if (separator === "") { + result = self.replace(/(\r?\n)+$/, ''); + } + else if (self.length > separator.length) { + var tail = self.substr(self.length - separator.length, separator.length); + + if (tail === separator) { + result = self.substr(0, self.length - separator.length); + } + } + + if (result != null) { + return self.$$cast(result); + } + ; + return self; + }, TMP_String_chomp_18.$$arity = -1); + + Opal.def(self, '$chop', TMP_String_chop_19 = function $$chop() { + var self = this; + + + var length = self.length, result; + + if (length <= 1) { + result = ""; + } else if (self.charAt(length - 1) === "\n" && self.charAt(length - 2) === "\r") { + result = self.substr(0, length - 2); + } else { + result = self.substr(0, length - 1); + } + + return self.$$cast(result); + + }, TMP_String_chop_19.$$arity = 0); + + Opal.def(self, '$chr', TMP_String_chr_20 = function $$chr() { + var self = this; + + return self.charAt(0); + }, TMP_String_chr_20.$$arity = 0); + + Opal.def(self, '$clone', TMP_String_clone_21 = function $$clone() { + var self = this, copy = nil; + + + copy = self.slice(); + copy.$copy_singleton_methods(self); + copy.$initialize_clone(self); + return copy; + }, TMP_String_clone_21.$$arity = 0); + + Opal.def(self, '$dup', TMP_String_dup_22 = function $$dup() { + var self = this, copy = nil; + + + copy = self.slice(); + copy.$initialize_dup(self); + return copy; + }, TMP_String_dup_22.$$arity = 0); + + Opal.def(self, '$count', TMP_String_count_23 = function $$count($a) { + var $post_args, sets, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + sets = $post_args;; + + if (sets.length === 0) { + self.$raise($$($nesting, 'ArgumentError'), "ArgumentError: wrong number of arguments (0 for 1+)") + } + var char_class = char_class_from_char_sets(sets); + if (char_class === null) { + return 0; + } + return self.length - self.replace(new RegExp(char_class, 'g'), '').length; + ; + }, TMP_String_count_23.$$arity = -1); + + Opal.def(self, '$delete', TMP_String_delete_24 = function($a) { + var $post_args, sets, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + sets = $post_args;; + + if (sets.length === 0) { + self.$raise($$($nesting, 'ArgumentError'), "ArgumentError: wrong number of arguments (0 for 1+)") + } + var char_class = char_class_from_char_sets(sets); + if (char_class === null) { + return self; + } + return self.$$cast(self.replace(new RegExp(char_class, 'g'), '')); + ; + }, TMP_String_delete_24.$$arity = -1); + + Opal.def(self, '$delete_prefix', TMP_String_delete_prefix_25 = function $$delete_prefix(prefix) { + var self = this; + + + if (!prefix.$$is_string) { + (prefix = $$($nesting, 'Opal').$coerce_to(prefix, $$($nesting, 'String'), "to_str")) + } + + if (self.slice(0, prefix.length) === prefix) { + return self.$$cast(self.slice(prefix.length)); + } else { + return self; + } + + }, TMP_String_delete_prefix_25.$$arity = 1); + + Opal.def(self, '$delete_suffix', TMP_String_delete_suffix_26 = function $$delete_suffix(suffix) { + var self = this; + + + if (!suffix.$$is_string) { + (suffix = $$($nesting, 'Opal').$coerce_to(suffix, $$($nesting, 'String'), "to_str")) + } + + if (self.slice(self.length - suffix.length) === suffix) { + return self.$$cast(self.slice(0, self.length - suffix.length)); + } else { + return self; + } + + }, TMP_String_delete_suffix_26.$$arity = 1); + + Opal.def(self, '$downcase', TMP_String_downcase_27 = function $$downcase() { + var self = this; + + return self.$$cast(self.toLowerCase()); + }, TMP_String_downcase_27.$$arity = 0); + + Opal.def(self, '$each_char', TMP_String_each_char_28 = function $$each_char() { + var $iter = TMP_String_each_char_28.$$p, block = $iter || nil, TMP_29, self = this; + + if ($iter) TMP_String_each_char_28.$$p = null; + + + if ($iter) TMP_String_each_char_28.$$p = null;; + if ((block !== nil)) { + } else { + return $send(self, 'enum_for', ["each_char"], (TMP_29 = function(){var self = TMP_29.$$s || this; + + return self.$size()}, TMP_29.$$s = self, TMP_29.$$arity = 0, TMP_29)) + }; + + for (var i = 0, length = self.length; i < length; i++) { + Opal.yield1(block, self.charAt(i)); + } + ; + return self; + }, TMP_String_each_char_28.$$arity = 0); + + Opal.def(self, '$each_line', TMP_String_each_line_30 = function $$each_line(separator) { + var $iter = TMP_String_each_line_30.$$p, block = $iter || nil, self = this; + if ($gvars["/"] == null) $gvars["/"] = nil; + + if ($iter) TMP_String_each_line_30.$$p = null; + + + if ($iter) TMP_String_each_line_30.$$p = null;; + + if (separator == null) { + separator = $gvars["/"]; + }; + if ((block !== nil)) { + } else { + return self.$enum_for("each_line", separator) + }; + + if (separator === nil) { + Opal.yield1(block, self); + + return self; + } + + separator = $$($nesting, 'Opal').$coerce_to(separator, $$($nesting, 'String'), "to_str") + + var a, i, n, length, chomped, trailing, splitted; + + if (separator.length === 0) { + for (a = self.split(/(\n{2,})/), i = 0, n = a.length; i < n; i += 2) { + if (a[i] || a[i + 1]) { + var value = (a[i] || "") + (a[i + 1] || ""); + Opal.yield1(block, self.$$cast(value)); + } + } + + return self; + } + + chomped = self.$chomp(separator); + trailing = self.length != chomped.length; + splitted = chomped.split(separator); + + for (i = 0, length = splitted.length; i < length; i++) { + if (i < length - 1 || trailing) { + Opal.yield1(block, self.$$cast(splitted[i] + separator)); + } + else { + Opal.yield1(block, self.$$cast(splitted[i])); + } + } + ; + return self; + }, TMP_String_each_line_30.$$arity = -1); + + Opal.def(self, '$empty?', TMP_String_empty$q_31 = function() { + var self = this; + + return self.length === 0; + }, TMP_String_empty$q_31.$$arity = 0); + + Opal.def(self, '$end_with?', TMP_String_end_with$q_32 = function($a) { + var $post_args, suffixes, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + suffixes = $post_args;; + + for (var i = 0, length = suffixes.length; i < length; i++) { + var suffix = $$($nesting, 'Opal').$coerce_to(suffixes[i], $$($nesting, 'String'), "to_str").$to_s(); + + if (self.length >= suffix.length && + self.substr(self.length - suffix.length, suffix.length) == suffix) { + return true; + } + } + ; + return false; + }, TMP_String_end_with$q_32.$$arity = -1); + Opal.alias(self, "equal?", "==="); + + Opal.def(self, '$gsub', TMP_String_gsub_33 = function $$gsub(pattern, replacement) { + var $iter = TMP_String_gsub_33.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_String_gsub_33.$$p = null; + + + if ($iter) TMP_String_gsub_33.$$p = null;; + ; + + if (replacement === undefined && block === nil) { + return self.$enum_for("gsub", pattern); + } + + var result = '', match_data = nil, index = 0, match, _replacement; + + if (pattern.$$is_regexp) { + pattern = Opal.global_multiline_regexp(pattern); + } else { + pattern = $$($nesting, 'Opal').$coerce_to(pattern, $$($nesting, 'String'), "to_str"); + pattern = new RegExp(pattern.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'), 'gm'); + } + + var lastIndex; + while (true) { + match = pattern.exec(self); + + if (match === null) { + ($gvars["~"] = nil) + result += self.slice(index); + break; + } + + match_data = $$($nesting, 'MatchData').$new(pattern, match); + + if (replacement === undefined) { + lastIndex = pattern.lastIndex; + _replacement = block(match[0]); + pattern.lastIndex = lastIndex; // save and restore lastIndex + } + else if (replacement.$$is_hash) { + _replacement = (replacement)['$[]'](match[0]).$to_s(); + } + else { + if (!replacement.$$is_string) { + replacement = $$($nesting, 'Opal').$coerce_to(replacement, $$($nesting, 'String'), "to_str"); + } + _replacement = replacement.replace(/([\\]+)([0-9+&`'])/g, function (original, slashes, command) { + if (slashes.length % 2 === 0) { + return original; + } + switch (command) { + case "+": + for (var i = match.length - 1; i > 0; i--) { + if (match[i] !== undefined) { + return slashes.slice(1) + match[i]; + } + } + return ''; + case "&": return slashes.slice(1) + match[0]; + case "`": return slashes.slice(1) + self.slice(0, match.index); + case "'": return slashes.slice(1) + self.slice(match.index + match[0].length); + default: return slashes.slice(1) + (match[command] || ''); + } + }).replace(/\\\\/g, '\\'); + } + + if (pattern.lastIndex === match.index) { + result += (_replacement + self.slice(index, match.index + 1)) + pattern.lastIndex += 1; + } + else { + result += (self.slice(index, match.index) + _replacement) + } + index = pattern.lastIndex; + } + + ($gvars["~"] = match_data) + return self.$$cast(result); + ; + }, TMP_String_gsub_33.$$arity = -2); + + Opal.def(self, '$hash', TMP_String_hash_34 = function $$hash() { + var self = this; + + return self.toString(); + }, TMP_String_hash_34.$$arity = 0); + + Opal.def(self, '$hex', TMP_String_hex_35 = function $$hex() { + var self = this; + + return self.$to_i(16) + }, TMP_String_hex_35.$$arity = 0); + + Opal.def(self, '$include?', TMP_String_include$q_36 = function(other) { + var self = this; + + + if (!other.$$is_string) { + (other = $$($nesting, 'Opal').$coerce_to(other, $$($nesting, 'String'), "to_str")) + } + return self.indexOf(other) !== -1; + + }, TMP_String_include$q_36.$$arity = 1); + + Opal.def(self, '$index', TMP_String_index_37 = function $$index(search, offset) { + var self = this; + + + ; + + var index, + match, + regex; + + if (offset === undefined) { + offset = 0; + } else { + offset = $$($nesting, 'Opal').$coerce_to(offset, $$($nesting, 'Integer'), "to_int"); + if (offset < 0) { + offset += self.length; + if (offset < 0) { + return nil; + } + } + } + + if (search.$$is_regexp) { + regex = Opal.global_multiline_regexp(search); + while (true) { + match = regex.exec(self); + if (match === null) { + ($gvars["~"] = nil); + index = -1; + break; + } + if (match.index >= offset) { + ($gvars["~"] = $$($nesting, 'MatchData').$new(regex, match)) + index = match.index; + break; + } + regex.lastIndex = match.index + 1; + } + } else { + search = $$($nesting, 'Opal').$coerce_to(search, $$($nesting, 'String'), "to_str"); + if (search.length === 0 && offset > self.length) { + index = -1; + } else { + index = self.indexOf(search, offset); + } + } + + return index === -1 ? nil : index; + ; + }, TMP_String_index_37.$$arity = -2); + + Opal.def(self, '$inspect', TMP_String_inspect_38 = function $$inspect() { + var self = this; + + + var escapable = /[\\\"\x00-\x1f\u007F-\u009F\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, + meta = { + '\u0007': '\\a', + '\u001b': '\\e', + '\b': '\\b', + '\t': '\\t', + '\n': '\\n', + '\f': '\\f', + '\r': '\\r', + '\v': '\\v', + '"' : '\\"', + '\\': '\\\\' + }, + escaped = self.replace(escapable, function (chr) { + return meta[chr] || '\\u' + ('0000' + chr.charCodeAt(0).toString(16).toUpperCase()).slice(-4); + }); + return '"' + escaped.replace(/\#[\$\@\{]/g, '\\$&') + '"'; + + }, TMP_String_inspect_38.$$arity = 0); + + Opal.def(self, '$intern', TMP_String_intern_39 = function $$intern() { + var self = this; + + return self.toString(); + }, TMP_String_intern_39.$$arity = 0); + + Opal.def(self, '$lines', TMP_String_lines_40 = function $$lines(separator) { + var $iter = TMP_String_lines_40.$$p, block = $iter || nil, self = this, e = nil; + if ($gvars["/"] == null) $gvars["/"] = nil; + + if ($iter) TMP_String_lines_40.$$p = null; + + + if ($iter) TMP_String_lines_40.$$p = null;; + + if (separator == null) { + separator = $gvars["/"]; + }; + e = $send(self, 'each_line', [separator], block.$to_proc()); + if ($truthy(block)) { + return self + } else { + return e.$to_a() + }; + }, TMP_String_lines_40.$$arity = -1); + + Opal.def(self, '$length', TMP_String_length_41 = function $$length() { + var self = this; + + return self.length; + }, TMP_String_length_41.$$arity = 0); + + Opal.def(self, '$ljust', TMP_String_ljust_42 = function $$ljust(width, padstr) { + var self = this; + + + + if (padstr == null) { + padstr = " "; + }; + width = $$($nesting, 'Opal').$coerce_to(width, $$($nesting, 'Integer'), "to_int"); + padstr = $$($nesting, 'Opal').$coerce_to(padstr, $$($nesting, 'String'), "to_str").$to_s(); + if ($truthy(padstr['$empty?']())) { + self.$raise($$($nesting, 'ArgumentError'), "zero width padding")}; + if ($truthy(width <= self.length)) { + return self}; + + var index = -1, + result = ""; + + width -= self.length; + + while (++index < width) { + result += padstr; + } + + return self.$$cast(self + result.slice(0, width)); + ; + }, TMP_String_ljust_42.$$arity = -2); + + Opal.def(self, '$lstrip', TMP_String_lstrip_43 = function $$lstrip() { + var self = this; + + return self.replace(/^\s*/, ''); + }, TMP_String_lstrip_43.$$arity = 0); + + Opal.def(self, '$ascii_only?', TMP_String_ascii_only$q_44 = function() { + var self = this; + + return self.match(/[ -~\n]*/)[0] === self; + }, TMP_String_ascii_only$q_44.$$arity = 0); + + Opal.def(self, '$match', TMP_String_match_45 = function $$match(pattern, pos) { + var $iter = TMP_String_match_45.$$p, block = $iter || nil, $a, self = this; + + if ($iter) TMP_String_match_45.$$p = null; + + + if ($iter) TMP_String_match_45.$$p = null;; + ; + if ($truthy(($truthy($a = $$($nesting, 'String')['$==='](pattern)) ? $a : pattern['$respond_to?']("to_str")))) { + pattern = $$($nesting, 'Regexp').$new(pattern.$to_str())}; + if ($truthy($$($nesting, 'Regexp')['$==='](pattern))) { + } else { + self.$raise($$($nesting, 'TypeError'), "" + "wrong argument type " + (pattern.$class()) + " (expected Regexp)") + }; + return $send(pattern, 'match', [self, pos], block.$to_proc()); + }, TMP_String_match_45.$$arity = -2); + + Opal.def(self, '$match?', TMP_String_match$q_46 = function(pattern, pos) { + var $a, self = this; + + + ; + if ($truthy(($truthy($a = $$($nesting, 'String')['$==='](pattern)) ? $a : pattern['$respond_to?']("to_str")))) { + pattern = $$($nesting, 'Regexp').$new(pattern.$to_str())}; + if ($truthy($$($nesting, 'Regexp')['$==='](pattern))) { + } else { + self.$raise($$($nesting, 'TypeError'), "" + "wrong argument type " + (pattern.$class()) + " (expected Regexp)") + }; + return pattern['$match?'](self, pos); + }, TMP_String_match$q_46.$$arity = -2); + + Opal.def(self, '$next', TMP_String_next_47 = function $$next() { + var self = this; + + + var i = self.length; + if (i === 0) { + return self.$$cast(''); + } + var result = self; + var first_alphanum_char_index = self.search(/[a-zA-Z0-9]/); + var carry = false; + var code; + while (i--) { + code = self.charCodeAt(i); + if ((code >= 48 && code <= 57) || + (code >= 65 && code <= 90) || + (code >= 97 && code <= 122)) { + switch (code) { + case 57: + carry = true; + code = 48; + break; + case 90: + carry = true; + code = 65; + break; + case 122: + carry = true; + code = 97; + break; + default: + carry = false; + code += 1; + } + } else { + if (first_alphanum_char_index === -1) { + if (code === 255) { + carry = true; + code = 0; + } else { + carry = false; + code += 1; + } + } else { + carry = true; + } + } + result = result.slice(0, i) + String.fromCharCode(code) + result.slice(i + 1); + if (carry && (i === 0 || i === first_alphanum_char_index)) { + switch (code) { + case 65: + break; + case 97: + break; + default: + code += 1; + } + if (i === 0) { + result = String.fromCharCode(code) + result; + } else { + result = result.slice(0, i) + String.fromCharCode(code) + result.slice(i); + } + carry = false; + } + if (!carry) { + break; + } + } + return self.$$cast(result); + + }, TMP_String_next_47.$$arity = 0); + + Opal.def(self, '$oct', TMP_String_oct_48 = function $$oct() { + var self = this; + + + var result, + string = self, + radix = 8; + + if (/^\s*_/.test(string)) { + return 0; + } + + string = string.replace(/^(\s*[+-]?)(0[bodx]?)(.+)$/i, function (original, head, flag, tail) { + switch (tail.charAt(0)) { + case '+': + case '-': + return original; + case '0': + if (tail.charAt(1) === 'x' && flag === '0x') { + return original; + } + } + switch (flag) { + case '0b': + radix = 2; + break; + case '0': + case '0o': + radix = 8; + break; + case '0d': + radix = 10; + break; + case '0x': + radix = 16; + break; + } + return head + tail; + }); + + result = parseInt(string.replace(/_(?!_)/g, ''), radix); + return isNaN(result) ? 0 : result; + + }, TMP_String_oct_48.$$arity = 0); + + Opal.def(self, '$ord', TMP_String_ord_49 = function $$ord() { + var self = this; + + return self.charCodeAt(0); + }, TMP_String_ord_49.$$arity = 0); + + Opal.def(self, '$partition', TMP_String_partition_50 = function $$partition(sep) { + var self = this; + + + var i, m; + + if (sep.$$is_regexp) { + m = sep.exec(self); + if (m === null) { + i = -1; + } else { + $$($nesting, 'MatchData').$new(sep, m); + sep = m[0]; + i = m.index; + } + } else { + sep = $$($nesting, 'Opal').$coerce_to(sep, $$($nesting, 'String'), "to_str"); + i = self.indexOf(sep); + } + + if (i === -1) { + return [self, '', '']; + } + + return [ + self.slice(0, i), + self.slice(i, i + sep.length), + self.slice(i + sep.length) + ]; + + }, TMP_String_partition_50.$$arity = 1); + + Opal.def(self, '$reverse', TMP_String_reverse_51 = function $$reverse() { + var self = this; + + return self.split('').reverse().join(''); + }, TMP_String_reverse_51.$$arity = 0); + + Opal.def(self, '$rindex', TMP_String_rindex_52 = function $$rindex(search, offset) { + var self = this; + + + ; + + var i, m, r, _m; + + if (offset === undefined) { + offset = self.length; + } else { + offset = $$($nesting, 'Opal').$coerce_to(offset, $$($nesting, 'Integer'), "to_int"); + if (offset < 0) { + offset += self.length; + if (offset < 0) { + return nil; + } + } + } + + if (search.$$is_regexp) { + m = null; + r = Opal.global_multiline_regexp(search); + while (true) { + _m = r.exec(self); + if (_m === null || _m.index > offset) { + break; + } + m = _m; + r.lastIndex = m.index + 1; + } + if (m === null) { + ($gvars["~"] = nil) + i = -1; + } else { + $$($nesting, 'MatchData').$new(r, m); + i = m.index; + } + } else { + search = $$($nesting, 'Opal').$coerce_to(search, $$($nesting, 'String'), "to_str"); + i = self.lastIndexOf(search, offset); + } + + return i === -1 ? nil : i; + ; + }, TMP_String_rindex_52.$$arity = -2); + + Opal.def(self, '$rjust', TMP_String_rjust_53 = function $$rjust(width, padstr) { + var self = this; + + + + if (padstr == null) { + padstr = " "; + }; + width = $$($nesting, 'Opal').$coerce_to(width, $$($nesting, 'Integer'), "to_int"); + padstr = $$($nesting, 'Opal').$coerce_to(padstr, $$($nesting, 'String'), "to_str").$to_s(); + if ($truthy(padstr['$empty?']())) { + self.$raise($$($nesting, 'ArgumentError'), "zero width padding")}; + if ($truthy(width <= self.length)) { + return self}; + + var chars = Math.floor(width - self.length), + patterns = Math.floor(chars / padstr.length), + result = Array(patterns + 1).join(padstr), + remaining = chars - result.length; + + return self.$$cast(result + padstr.slice(0, remaining) + self); + ; + }, TMP_String_rjust_53.$$arity = -2); + + Opal.def(self, '$rpartition', TMP_String_rpartition_54 = function $$rpartition(sep) { + var self = this; + + + var i, m, r, _m; + + if (sep.$$is_regexp) { + m = null; + r = Opal.global_multiline_regexp(sep); + + while (true) { + _m = r.exec(self); + if (_m === null) { + break; + } + m = _m; + r.lastIndex = m.index + 1; + } + + if (m === null) { + i = -1; + } else { + $$($nesting, 'MatchData').$new(r, m); + sep = m[0]; + i = m.index; + } + + } else { + sep = $$($nesting, 'Opal').$coerce_to(sep, $$($nesting, 'String'), "to_str"); + i = self.lastIndexOf(sep); + } + + if (i === -1) { + return ['', '', self]; + } + + return [ + self.slice(0, i), + self.slice(i, i + sep.length), + self.slice(i + sep.length) + ]; + + }, TMP_String_rpartition_54.$$arity = 1); + + Opal.def(self, '$rstrip', TMP_String_rstrip_55 = function $$rstrip() { + var self = this; + + return self.replace(/[\s\u0000]*$/, ''); + }, TMP_String_rstrip_55.$$arity = 0); + + Opal.def(self, '$scan', TMP_String_scan_56 = function $$scan(pattern) { + var $iter = TMP_String_scan_56.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_String_scan_56.$$p = null; + + + if ($iter) TMP_String_scan_56.$$p = null;; + + var result = [], + match_data = nil, + match; + + if (pattern.$$is_regexp) { + pattern = Opal.global_multiline_regexp(pattern); + } else { + pattern = $$($nesting, 'Opal').$coerce_to(pattern, $$($nesting, 'String'), "to_str"); + pattern = new RegExp(pattern.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'), 'gm'); + } + + while ((match = pattern.exec(self)) != null) { + match_data = $$($nesting, 'MatchData').$new(pattern, match); + if (block === nil) { + match.length == 1 ? result.push(match[0]) : result.push((match_data).$captures()); + } else { + match.length == 1 ? block(match[0]) : block.call(self, (match_data).$captures()); + } + if (pattern.lastIndex === match.index) { + pattern.lastIndex += 1; + } + } + + ($gvars["~"] = match_data) + + return (block !== nil ? self : result); + ; + }, TMP_String_scan_56.$$arity = 1); + Opal.alias(self, "size", "length"); + Opal.alias(self, "slice", "[]"); + + Opal.def(self, '$split', TMP_String_split_57 = function $$split(pattern, limit) { + var $a, self = this; + if ($gvars[";"] == null) $gvars[";"] = nil; + + + ; + ; + + if (self.length === 0) { + return []; + } + + if (limit === undefined) { + limit = 0; + } else { + limit = $$($nesting, 'Opal')['$coerce_to!'](limit, $$($nesting, 'Integer'), "to_int"); + if (limit === 1) { + return [self]; + } + } + + if (pattern === undefined || pattern === nil) { + pattern = ($truthy($a = $gvars[";"]) ? $a : " "); + } + + var result = [], + string = self.toString(), + index = 0, + match, + i, ii; + + if (pattern.$$is_regexp) { + pattern = Opal.global_multiline_regexp(pattern); + } else { + pattern = $$($nesting, 'Opal').$coerce_to(pattern, $$($nesting, 'String'), "to_str").$to_s(); + if (pattern === ' ') { + pattern = /\s+/gm; + string = string.replace(/^\s+/, ''); + } else { + pattern = new RegExp(pattern.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'), 'gm'); + } + } + + result = string.split(pattern); + + if (result.length === 1 && result[0] === string) { + return [self.$$cast(result[0])]; + } + + while ((i = result.indexOf(undefined)) !== -1) { + result.splice(i, 1); + } + + function castResult() { + for (i = 0; i < result.length; i++) { + result[i] = self.$$cast(result[i]); + } + } + + if (limit === 0) { + while (result[result.length - 1] === '') { + result.length -= 1; + } + castResult(); + return result; + } + + match = pattern.exec(string); + + if (limit < 0) { + if (match !== null && match[0] === '' && pattern.source.indexOf('(?=') === -1) { + for (i = 0, ii = match.length; i < ii; i++) { + result.push(''); + } + } + castResult(); + return result; + } + + if (match !== null && match[0] === '') { + result.splice(limit - 1, result.length - 1, result.slice(limit - 1).join('')); + castResult(); + return result; + } + + if (limit >= result.length) { + castResult(); + return result; + } + + i = 0; + while (match !== null) { + i++; + index = pattern.lastIndex; + if (i + 1 === limit) { + break; + } + match = pattern.exec(string); + } + result.splice(limit - 1, result.length - 1, string.slice(index)); + castResult(); + return result; + ; + }, TMP_String_split_57.$$arity = -1); + + Opal.def(self, '$squeeze', TMP_String_squeeze_58 = function $$squeeze($a) { + var $post_args, sets, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + sets = $post_args;; + + if (sets.length === 0) { + return self.$$cast(self.replace(/(.)\1+/g, '$1')); + } + var char_class = char_class_from_char_sets(sets); + if (char_class === null) { + return self; + } + return self.$$cast(self.replace(new RegExp('(' + char_class + ')\\1+', 'g'), '$1')); + ; + }, TMP_String_squeeze_58.$$arity = -1); + + Opal.def(self, '$start_with?', TMP_String_start_with$q_59 = function($a) { + var $post_args, prefixes, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + prefixes = $post_args;; + + for (var i = 0, length = prefixes.length; i < length; i++) { + var prefix = $$($nesting, 'Opal').$coerce_to(prefixes[i], $$($nesting, 'String'), "to_str").$to_s(); + + if (self.indexOf(prefix) === 0) { + return true; + } + } + + return false; + ; + }, TMP_String_start_with$q_59.$$arity = -1); + + Opal.def(self, '$strip', TMP_String_strip_60 = function $$strip() { + var self = this; + + return self.replace(/^\s*/, '').replace(/[\s\u0000]*$/, ''); + }, TMP_String_strip_60.$$arity = 0); + + Opal.def(self, '$sub', TMP_String_sub_61 = function $$sub(pattern, replacement) { + var $iter = TMP_String_sub_61.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_String_sub_61.$$p = null; + + + if ($iter) TMP_String_sub_61.$$p = null;; + ; + + if (!pattern.$$is_regexp) { + pattern = $$($nesting, 'Opal').$coerce_to(pattern, $$($nesting, 'String'), "to_str"); + pattern = new RegExp(pattern.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')); + } + + var result, match = pattern.exec(self); + + if (match === null) { + ($gvars["~"] = nil) + result = self.toString(); + } else { + $$($nesting, 'MatchData').$new(pattern, match) + + if (replacement === undefined) { + + if (block === nil) { + self.$raise($$($nesting, 'ArgumentError'), "wrong number of arguments (1 for 2)") + } + result = self.slice(0, match.index) + block(match[0]) + self.slice(match.index + match[0].length); + + } else if (replacement.$$is_hash) { + + result = self.slice(0, match.index) + (replacement)['$[]'](match[0]).$to_s() + self.slice(match.index + match[0].length); + + } else { + + replacement = $$($nesting, 'Opal').$coerce_to(replacement, $$($nesting, 'String'), "to_str"); + + replacement = replacement.replace(/([\\]+)([0-9+&`'])/g, function (original, slashes, command) { + if (slashes.length % 2 === 0) { + return original; + } + switch (command) { + case "+": + for (var i = match.length - 1; i > 0; i--) { + if (match[i] !== undefined) { + return slashes.slice(1) + match[i]; + } + } + return ''; + case "&": return slashes.slice(1) + match[0]; + case "`": return slashes.slice(1) + self.slice(0, match.index); + case "'": return slashes.slice(1) + self.slice(match.index + match[0].length); + default: return slashes.slice(1) + (match[command] || ''); + } + }).replace(/\\\\/g, '\\'); + + result = self.slice(0, match.index) + replacement + self.slice(match.index + match[0].length); + } + } + + return self.$$cast(result); + ; + }, TMP_String_sub_61.$$arity = -2); + Opal.alias(self, "succ", "next"); + + Opal.def(self, '$sum', TMP_String_sum_62 = function $$sum(n) { + var self = this; + + + + if (n == null) { + n = 16; + }; + + n = $$($nesting, 'Opal').$coerce_to(n, $$($nesting, 'Integer'), "to_int"); + + var result = 0, + length = self.length, + i = 0; + + for (; i < length; i++) { + result += self.charCodeAt(i); + } + + if (n <= 0) { + return result; + } + + return result & (Math.pow(2, n) - 1); + ; + }, TMP_String_sum_62.$$arity = -1); + + Opal.def(self, '$swapcase', TMP_String_swapcase_63 = function $$swapcase() { + var self = this; + + + var str = self.replace(/([a-z]+)|([A-Z]+)/g, function($0,$1,$2) { + return $1 ? $0.toUpperCase() : $0.toLowerCase(); + }); + + if (self.constructor === String) { + return str; + } + + return self.$class().$new(str); + + }, TMP_String_swapcase_63.$$arity = 0); + + Opal.def(self, '$to_f', TMP_String_to_f_64 = function $$to_f() { + var self = this; + + + if (self.charAt(0) === '_') { + return 0; + } + + var result = parseFloat(self.replace(/_/g, '')); + + if (isNaN(result) || result == Infinity || result == -Infinity) { + return 0; + } + else { + return result; + } + + }, TMP_String_to_f_64.$$arity = 0); + + Opal.def(self, '$to_i', TMP_String_to_i_65 = function $$to_i(base) { + var self = this; + + + + if (base == null) { + base = 10; + }; + + var result, + string = self.toLowerCase(), + radix = $$($nesting, 'Opal').$coerce_to(base, $$($nesting, 'Integer'), "to_int"); + + if (radix === 1 || radix < 0 || radix > 36) { + self.$raise($$($nesting, 'ArgumentError'), "" + "invalid radix " + (radix)) + } + + if (/^\s*_/.test(string)) { + return 0; + } + + string = string.replace(/^(\s*[+-]?)(0[bodx]?)(.+)$/, function (original, head, flag, tail) { + switch (tail.charAt(0)) { + case '+': + case '-': + return original; + case '0': + if (tail.charAt(1) === 'x' && flag === '0x' && (radix === 0 || radix === 16)) { + return original; + } + } + switch (flag) { + case '0b': + if (radix === 0 || radix === 2) { + radix = 2; + return head + tail; + } + break; + case '0': + case '0o': + if (radix === 0 || radix === 8) { + radix = 8; + return head + tail; + } + break; + case '0d': + if (radix === 0 || radix === 10) { + radix = 10; + return head + tail; + } + break; + case '0x': + if (radix === 0 || radix === 16) { + radix = 16; + return head + tail; + } + break; + } + return original + }); + + result = parseInt(string.replace(/_(?!_)/g, ''), radix); + return isNaN(result) ? 0 : result; + ; + }, TMP_String_to_i_65.$$arity = -1); + + Opal.def(self, '$to_proc', TMP_String_to_proc_66 = function $$to_proc() { + var TMP_67, $iter = TMP_String_to_proc_66.$$p, $yield = $iter || nil, self = this, method_name = nil; + + if ($iter) TMP_String_to_proc_66.$$p = null; + + method_name = $rb_plus("$", self.valueOf()); + return $send(self, 'proc', [], (TMP_67 = function($a){var self = TMP_67.$$s || this, $iter = TMP_67.$$p, block = $iter || nil, $post_args, args; + + + + if ($iter) TMP_67.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + + if (args.length === 0) { + self.$raise($$($nesting, 'ArgumentError'), "no receiver given") + } + + var recv = args[0]; + + if (recv == null) recv = nil; + + var body = recv[method_name]; + + if (!body) { + return recv.$method_missing.apply(recv, args); + } + + if (typeof block === 'function') { + body.$$p = block; + } + + if (args.length === 1) { + return body.call(recv); + } else { + return body.apply(recv, args.slice(1)); + } + ;}, TMP_67.$$s = self, TMP_67.$$arity = -1, TMP_67)); + }, TMP_String_to_proc_66.$$arity = 0); + + Opal.def(self, '$to_s', TMP_String_to_s_68 = function $$to_s() { + var self = this; + + return self.toString(); + }, TMP_String_to_s_68.$$arity = 0); + Opal.alias(self, "to_str", "to_s"); + Opal.alias(self, "to_sym", "intern"); + + Opal.def(self, '$tr', TMP_String_tr_69 = function $$tr(from, to) { + var self = this; + + + from = $$($nesting, 'Opal').$coerce_to(from, $$($nesting, 'String'), "to_str").$to_s(); + to = $$($nesting, 'Opal').$coerce_to(to, $$($nesting, 'String'), "to_str").$to_s(); + + if (from.length == 0 || from === to) { + return self; + } + + var i, in_range, c, ch, start, end, length; + var subs = {}; + var from_chars = from.split(''); + var from_length = from_chars.length; + var to_chars = to.split(''); + var to_length = to_chars.length; + + var inverse = false; + var global_sub = null; + if (from_chars[0] === '^' && from_chars.length > 1) { + inverse = true; + from_chars.shift(); + global_sub = to_chars[to_length - 1] + from_length -= 1; + } + + var from_chars_expanded = []; + var last_from = null; + in_range = false; + for (i = 0; i < from_length; i++) { + ch = from_chars[i]; + if (last_from == null) { + last_from = ch; + from_chars_expanded.push(ch); + } + else if (ch === '-') { + if (last_from === '-') { + from_chars_expanded.push('-'); + from_chars_expanded.push('-'); + } + else if (i == from_length - 1) { + from_chars_expanded.push('-'); + } + else { + in_range = true; + } + } + else if (in_range) { + start = last_from.charCodeAt(0); + end = ch.charCodeAt(0); + if (start > end) { + self.$raise($$($nesting, 'ArgumentError'), "" + "invalid range \"" + (String.fromCharCode(start)) + "-" + (String.fromCharCode(end)) + "\" in string transliteration") + } + for (c = start + 1; c < end; c++) { + from_chars_expanded.push(String.fromCharCode(c)); + } + from_chars_expanded.push(ch); + in_range = null; + last_from = null; + } + else { + from_chars_expanded.push(ch); + } + } + + from_chars = from_chars_expanded; + from_length = from_chars.length; + + if (inverse) { + for (i = 0; i < from_length; i++) { + subs[from_chars[i]] = true; + } + } + else { + if (to_length > 0) { + var to_chars_expanded = []; + var last_to = null; + in_range = false; + for (i = 0; i < to_length; i++) { + ch = to_chars[i]; + if (last_to == null) { + last_to = ch; + to_chars_expanded.push(ch); + } + else if (ch === '-') { + if (last_to === '-') { + to_chars_expanded.push('-'); + to_chars_expanded.push('-'); + } + else if (i == to_length - 1) { + to_chars_expanded.push('-'); + } + else { + in_range = true; + } + } + else if (in_range) { + start = last_to.charCodeAt(0); + end = ch.charCodeAt(0); + if (start > end) { + self.$raise($$($nesting, 'ArgumentError'), "" + "invalid range \"" + (String.fromCharCode(start)) + "-" + (String.fromCharCode(end)) + "\" in string transliteration") + } + for (c = start + 1; c < end; c++) { + to_chars_expanded.push(String.fromCharCode(c)); + } + to_chars_expanded.push(ch); + in_range = null; + last_to = null; + } + else { + to_chars_expanded.push(ch); + } + } + + to_chars = to_chars_expanded; + to_length = to_chars.length; + } + + var length_diff = from_length - to_length; + if (length_diff > 0) { + var pad_char = (to_length > 0 ? to_chars[to_length - 1] : ''); + for (i = 0; i < length_diff; i++) { + to_chars.push(pad_char); + } + } + + for (i = 0; i < from_length; i++) { + subs[from_chars[i]] = to_chars[i]; + } + } + + var new_str = '' + for (i = 0, length = self.length; i < length; i++) { + ch = self.charAt(i); + var sub = subs[ch]; + if (inverse) { + new_str += (sub == null ? global_sub : ch); + } + else { + new_str += (sub != null ? sub : ch); + } + } + return self.$$cast(new_str); + ; + }, TMP_String_tr_69.$$arity = 2); + + Opal.def(self, '$tr_s', TMP_String_tr_s_70 = function $$tr_s(from, to) { + var self = this; + + + from = $$($nesting, 'Opal').$coerce_to(from, $$($nesting, 'String'), "to_str").$to_s(); + to = $$($nesting, 'Opal').$coerce_to(to, $$($nesting, 'String'), "to_str").$to_s(); + + if (from.length == 0) { + return self; + } + + var i, in_range, c, ch, start, end, length; + var subs = {}; + var from_chars = from.split(''); + var from_length = from_chars.length; + var to_chars = to.split(''); + var to_length = to_chars.length; + + var inverse = false; + var global_sub = null; + if (from_chars[0] === '^' && from_chars.length > 1) { + inverse = true; + from_chars.shift(); + global_sub = to_chars[to_length - 1] + from_length -= 1; + } + + var from_chars_expanded = []; + var last_from = null; + in_range = false; + for (i = 0; i < from_length; i++) { + ch = from_chars[i]; + if (last_from == null) { + last_from = ch; + from_chars_expanded.push(ch); + } + else if (ch === '-') { + if (last_from === '-') { + from_chars_expanded.push('-'); + from_chars_expanded.push('-'); + } + else if (i == from_length - 1) { + from_chars_expanded.push('-'); + } + else { + in_range = true; + } + } + else if (in_range) { + start = last_from.charCodeAt(0); + end = ch.charCodeAt(0); + if (start > end) { + self.$raise($$($nesting, 'ArgumentError'), "" + "invalid range \"" + (String.fromCharCode(start)) + "-" + (String.fromCharCode(end)) + "\" in string transliteration") + } + for (c = start + 1; c < end; c++) { + from_chars_expanded.push(String.fromCharCode(c)); + } + from_chars_expanded.push(ch); + in_range = null; + last_from = null; + } + else { + from_chars_expanded.push(ch); + } + } + + from_chars = from_chars_expanded; + from_length = from_chars.length; + + if (inverse) { + for (i = 0; i < from_length; i++) { + subs[from_chars[i]] = true; + } + } + else { + if (to_length > 0) { + var to_chars_expanded = []; + var last_to = null; + in_range = false; + for (i = 0; i < to_length; i++) { + ch = to_chars[i]; + if (last_from == null) { + last_from = ch; + to_chars_expanded.push(ch); + } + else if (ch === '-') { + if (last_to === '-') { + to_chars_expanded.push('-'); + to_chars_expanded.push('-'); + } + else if (i == to_length - 1) { + to_chars_expanded.push('-'); + } + else { + in_range = true; + } + } + else if (in_range) { + start = last_from.charCodeAt(0); + end = ch.charCodeAt(0); + if (start > end) { + self.$raise($$($nesting, 'ArgumentError'), "" + "invalid range \"" + (String.fromCharCode(start)) + "-" + (String.fromCharCode(end)) + "\" in string transliteration") + } + for (c = start + 1; c < end; c++) { + to_chars_expanded.push(String.fromCharCode(c)); + } + to_chars_expanded.push(ch); + in_range = null; + last_from = null; + } + else { + to_chars_expanded.push(ch); + } + } + + to_chars = to_chars_expanded; + to_length = to_chars.length; + } + + var length_diff = from_length - to_length; + if (length_diff > 0) { + var pad_char = (to_length > 0 ? to_chars[to_length - 1] : ''); + for (i = 0; i < length_diff; i++) { + to_chars.push(pad_char); + } + } + + for (i = 0; i < from_length; i++) { + subs[from_chars[i]] = to_chars[i]; + } + } + var new_str = '' + var last_substitute = null + for (i = 0, length = self.length; i < length; i++) { + ch = self.charAt(i); + var sub = subs[ch] + if (inverse) { + if (sub == null) { + if (last_substitute == null) { + new_str += global_sub; + last_substitute = true; + } + } + else { + new_str += ch; + last_substitute = null; + } + } + else { + if (sub != null) { + if (last_substitute == null || last_substitute !== sub) { + new_str += sub; + last_substitute = sub; + } + } + else { + new_str += ch; + last_substitute = null; + } + } + } + return self.$$cast(new_str); + ; + }, TMP_String_tr_s_70.$$arity = 2); + + Opal.def(self, '$upcase', TMP_String_upcase_71 = function $$upcase() { + var self = this; + + return self.$$cast(self.toUpperCase()); + }, TMP_String_upcase_71.$$arity = 0); + + Opal.def(self, '$upto', TMP_String_upto_72 = function $$upto(stop, excl) { + var $iter = TMP_String_upto_72.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_String_upto_72.$$p = null; + + + if ($iter) TMP_String_upto_72.$$p = null;; + + if (excl == null) { + excl = false; + }; + if ((block !== nil)) { + } else { + return self.$enum_for("upto", stop, excl) + }; + stop = $$($nesting, 'Opal').$coerce_to(stop, $$($nesting, 'String'), "to_str"); + + var a, b, s = self.toString(); + + if (s.length === 1 && stop.length === 1) { + + a = s.charCodeAt(0); + b = stop.charCodeAt(0); + + while (a <= b) { + if (excl && a === b) { + break; + } + + block(String.fromCharCode(a)); + + a += 1; + } + + } else if (parseInt(s, 10).toString() === s && parseInt(stop, 10).toString() === stop) { + + a = parseInt(s, 10); + b = parseInt(stop, 10); + + while (a <= b) { + if (excl && a === b) { + break; + } + + block(a.toString()); + + a += 1; + } + + } else { + + while (s.length <= stop.length && s <= stop) { + if (excl && s === stop) { + break; + } + + block(s); + + s = (s).$succ(); + } + + } + return self; + ; + }, TMP_String_upto_72.$$arity = -2); + + function char_class_from_char_sets(sets) { + function explode_sequences_in_character_set(set) { + var result = '', + i, len = set.length, + curr_char, + skip_next_dash, + char_code_from, + char_code_upto, + char_code; + for (i = 0; i < len; i++) { + curr_char = set.charAt(i); + if (curr_char === '-' && i > 0 && i < (len - 1) && !skip_next_dash) { + char_code_from = set.charCodeAt(i - 1); + char_code_upto = set.charCodeAt(i + 1); + if (char_code_from > char_code_upto) { + self.$raise($$($nesting, 'ArgumentError'), "" + "invalid range \"" + (char_code_from) + "-" + (char_code_upto) + "\" in string transliteration") + } + for (char_code = char_code_from + 1; char_code < char_code_upto + 1; char_code++) { + result += String.fromCharCode(char_code); + } + skip_next_dash = true; + i++; + } else { + skip_next_dash = (curr_char === '\\'); + result += curr_char; + } + } + return result; + } + + function intersection(setA, setB) { + if (setA.length === 0) { + return setB; + } + var result = '', + i, len = setA.length, + chr; + for (i = 0; i < len; i++) { + chr = setA.charAt(i); + if (setB.indexOf(chr) !== -1) { + result += chr; + } + } + return result; + } + + var i, len, set, neg, chr, tmp, + pos_intersection = '', + neg_intersection = ''; + + for (i = 0, len = sets.length; i < len; i++) { + set = $$($nesting, 'Opal').$coerce_to(sets[i], $$($nesting, 'String'), "to_str"); + neg = (set.charAt(0) === '^' && set.length > 1); + set = explode_sequences_in_character_set(neg ? set.slice(1) : set); + if (neg) { + neg_intersection = intersection(neg_intersection, set); + } else { + pos_intersection = intersection(pos_intersection, set); + } + } + + if (pos_intersection.length > 0 && neg_intersection.length > 0) { + tmp = ''; + for (i = 0, len = pos_intersection.length; i < len; i++) { + chr = pos_intersection.charAt(i); + if (neg_intersection.indexOf(chr) === -1) { + tmp += chr; + } + } + pos_intersection = tmp; + neg_intersection = ''; + } + + if (pos_intersection.length > 0) { + return '[' + $$($nesting, 'Regexp').$escape(pos_intersection) + ']'; + } + + if (neg_intersection.length > 0) { + return '[^' + $$($nesting, 'Regexp').$escape(neg_intersection) + ']'; + } + + return null; + } + ; + + Opal.def(self, '$instance_variables', TMP_String_instance_variables_73 = function $$instance_variables() { + var self = this; + + return [] + }, TMP_String_instance_variables_73.$$arity = 0); + Opal.defs(self, '$_load', TMP_String__load_74 = function $$_load($a) { + var $post_args, args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + return $send(self, 'new', Opal.to_a(args)); + }, TMP_String__load_74.$$arity = -1); + + Opal.def(self, '$unicode_normalize', TMP_String_unicode_normalize_75 = function $$unicode_normalize(form) { + var self = this; + + + ; + return self.toString();; + }, TMP_String_unicode_normalize_75.$$arity = -1); + + Opal.def(self, '$unicode_normalized?', TMP_String_unicode_normalized$q_76 = function(form) { + var self = this; + + + ; + return true; + }, TMP_String_unicode_normalized$q_76.$$arity = -1); + + Opal.def(self, '$unpack', TMP_String_unpack_77 = function $$unpack(format) { + var self = this; + + return self.$raise("To use String#unpack, you must first require 'corelib/string/unpack'.") + }, TMP_String_unpack_77.$$arity = 1); + return (Opal.def(self, '$unpack1', TMP_String_unpack1_78 = function $$unpack1(format) { + var self = this; + + return self.$raise("To use String#unpack1, you must first require 'corelib/string/unpack'.") + }, TMP_String_unpack1_78.$$arity = 1), nil) && 'unpack1'; + })($nesting[0], String, $nesting); + return Opal.const_set($nesting[0], 'Symbol', $$($nesting, 'String')); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/enumerable"] = function(Opal) { + function $rb_gt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); + } + function $rb_times(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs * rhs : lhs['$*'](rhs); + } + function $rb_lt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); + } + function $rb_plus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); + } + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + function $rb_divide(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs / rhs : lhs['$/'](rhs); + } + function $rb_le(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs <= rhs : lhs['$<='](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $truthy = Opal.truthy, $send = Opal.send, $falsy = Opal.falsy, $hash2 = Opal.hash2, $lambda = Opal.lambda; + + Opal.add_stubs(['$each', '$public_send', '$destructure', '$to_enum', '$enumerator_size', '$new', '$yield', '$raise', '$slice_when', '$!', '$enum_for', '$flatten', '$map', '$warn', '$proc', '$==', '$nil?', '$respond_to?', '$coerce_to!', '$>', '$*', '$coerce_to', '$try_convert', '$<', '$+', '$-', '$ceil', '$/', '$size', '$__send__', '$length', '$<=', '$[]', '$push', '$<<', '$[]=', '$===', '$inspect', '$<=>', '$first', '$reverse', '$sort', '$to_proc', '$compare', '$call', '$dup', '$to_a', '$sort!', '$map!', '$key?', '$values', '$zip']); + return (function($base, $parent_nesting) { + function $Enumerable() {}; + var self = $Enumerable = $module($base, 'Enumerable', $Enumerable); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Enumerable_all$q_1, TMP_Enumerable_any$q_5, TMP_Enumerable_chunk_9, TMP_Enumerable_chunk_while_12, TMP_Enumerable_collect_14, TMP_Enumerable_collect_concat_16, TMP_Enumerable_count_19, TMP_Enumerable_cycle_23, TMP_Enumerable_detect_25, TMP_Enumerable_drop_27, TMP_Enumerable_drop_while_28, TMP_Enumerable_each_cons_29, TMP_Enumerable_each_entry_31, TMP_Enumerable_each_slice_33, TMP_Enumerable_each_with_index_35, TMP_Enumerable_each_with_object_37, TMP_Enumerable_entries_39, TMP_Enumerable_find_all_40, TMP_Enumerable_find_index_42, TMP_Enumerable_first_45, TMP_Enumerable_grep_48, TMP_Enumerable_grep_v_50, TMP_Enumerable_group_by_52, TMP_Enumerable_include$q_54, TMP_Enumerable_inject_56, TMP_Enumerable_lazy_57, TMP_Enumerable_enumerator_size_59, TMP_Enumerable_max_60, TMP_Enumerable_max_by_61, TMP_Enumerable_min_63, TMP_Enumerable_min_by_64, TMP_Enumerable_minmax_66, TMP_Enumerable_minmax_by_68, TMP_Enumerable_none$q_69, TMP_Enumerable_one$q_73, TMP_Enumerable_partition_77, TMP_Enumerable_reject_79, TMP_Enumerable_reverse_each_81, TMP_Enumerable_slice_before_83, TMP_Enumerable_slice_after_85, TMP_Enumerable_slice_when_88, TMP_Enumerable_sort_90, TMP_Enumerable_sort_by_92, TMP_Enumerable_sum_97, TMP_Enumerable_take_99, TMP_Enumerable_take_while_100, TMP_Enumerable_uniq_102, TMP_Enumerable_zip_104; + + + + function comparableForPattern(value) { + if (value.length === 0) { + value = [nil]; + } + + if (value.length > 1) { + value = [value]; + } + + return value; + } + ; + + Opal.def(self, '$all?', TMP_Enumerable_all$q_1 = function(pattern) {try { + + var $iter = TMP_Enumerable_all$q_1.$$p, block = $iter || nil, TMP_2, TMP_3, TMP_4, self = this; + + if ($iter) TMP_Enumerable_all$q_1.$$p = null; + + + if ($iter) TMP_Enumerable_all$q_1.$$p = null;; + ; + if ($truthy(pattern !== undefined)) { + $send(self, 'each', [], (TMP_2 = function($a){var self = TMP_2.$$s || this, $post_args, value, comparable = nil; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + value = $post_args;; + comparable = comparableForPattern(value); + if ($truthy($send(pattern, 'public_send', ["==="].concat(Opal.to_a(comparable))))) { + return nil + } else { + Opal.ret(false) + };}, TMP_2.$$s = self, TMP_2.$$arity = -1, TMP_2)) + } else if ((block !== nil)) { + $send(self, 'each', [], (TMP_3 = function($a){var self = TMP_3.$$s || this, $post_args, value; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + value = $post_args;; + if ($truthy(Opal.yieldX(block, Opal.to_a(value)))) { + return nil + } else { + Opal.ret(false) + };}, TMP_3.$$s = self, TMP_3.$$arity = -1, TMP_3)) + } else { + $send(self, 'each', [], (TMP_4 = function($a){var self = TMP_4.$$s || this, $post_args, value; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + value = $post_args;; + if ($truthy($$($nesting, 'Opal').$destructure(value))) { + return nil + } else { + Opal.ret(false) + };}, TMP_4.$$s = self, TMP_4.$$arity = -1, TMP_4)) + }; + return true; + } catch ($returner) { if ($returner === Opal.returner) { return $returner.$v } throw $returner; } + }, TMP_Enumerable_all$q_1.$$arity = -1); + + Opal.def(self, '$any?', TMP_Enumerable_any$q_5 = function(pattern) {try { + + var $iter = TMP_Enumerable_any$q_5.$$p, block = $iter || nil, TMP_6, TMP_7, TMP_8, self = this; + + if ($iter) TMP_Enumerable_any$q_5.$$p = null; + + + if ($iter) TMP_Enumerable_any$q_5.$$p = null;; + ; + if ($truthy(pattern !== undefined)) { + $send(self, 'each', [], (TMP_6 = function($a){var self = TMP_6.$$s || this, $post_args, value, comparable = nil; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + value = $post_args;; + comparable = comparableForPattern(value); + if ($truthy($send(pattern, 'public_send', ["==="].concat(Opal.to_a(comparable))))) { + Opal.ret(true) + } else { + return nil + };}, TMP_6.$$s = self, TMP_6.$$arity = -1, TMP_6)) + } else if ((block !== nil)) { + $send(self, 'each', [], (TMP_7 = function($a){var self = TMP_7.$$s || this, $post_args, value; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + value = $post_args;; + if ($truthy(Opal.yieldX(block, Opal.to_a(value)))) { + Opal.ret(true) + } else { + return nil + };}, TMP_7.$$s = self, TMP_7.$$arity = -1, TMP_7)) + } else { + $send(self, 'each', [], (TMP_8 = function($a){var self = TMP_8.$$s || this, $post_args, value; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + value = $post_args;; + if ($truthy($$($nesting, 'Opal').$destructure(value))) { + Opal.ret(true) + } else { + return nil + };}, TMP_8.$$s = self, TMP_8.$$arity = -1, TMP_8)) + }; + return false; + } catch ($returner) { if ($returner === Opal.returner) { return $returner.$v } throw $returner; } + }, TMP_Enumerable_any$q_5.$$arity = -1); + + Opal.def(self, '$chunk', TMP_Enumerable_chunk_9 = function $$chunk() { + var $iter = TMP_Enumerable_chunk_9.$$p, block = $iter || nil, TMP_10, TMP_11, self = this; + + if ($iter) TMP_Enumerable_chunk_9.$$p = null; + + + if ($iter) TMP_Enumerable_chunk_9.$$p = null;; + if ((block !== nil)) { + } else { + return $send(self, 'to_enum', ["chunk"], (TMP_10 = function(){var self = TMP_10.$$s || this; + + return self.$enumerator_size()}, TMP_10.$$s = self, TMP_10.$$arity = 0, TMP_10)) + }; + return $send($$$('::', 'Enumerator'), 'new', [], (TMP_11 = function(yielder){var self = TMP_11.$$s || this; + + + + if (yielder == null) { + yielder = nil; + }; + + var previous = nil, accumulate = []; + + function releaseAccumulate() { + if (accumulate.length > 0) { + yielder.$yield(previous, accumulate) + } + } + + self.$each.$$p = function(value) { + var key = Opal.yield1(block, value); + + if (key === nil) { + releaseAccumulate(); + accumulate = []; + previous = nil; + } else { + if (previous === nil || previous === key) { + accumulate.push(value); + } else { + releaseAccumulate(); + accumulate = [value]; + } + + previous = key; + } + } + + self.$each(); + + releaseAccumulate(); + ;}, TMP_11.$$s = self, TMP_11.$$arity = 1, TMP_11)); + }, TMP_Enumerable_chunk_9.$$arity = 0); + + Opal.def(self, '$chunk_while', TMP_Enumerable_chunk_while_12 = function $$chunk_while() { + var $iter = TMP_Enumerable_chunk_while_12.$$p, block = $iter || nil, TMP_13, self = this; + + if ($iter) TMP_Enumerable_chunk_while_12.$$p = null; + + + if ($iter) TMP_Enumerable_chunk_while_12.$$p = null;; + if ((block !== nil)) { + } else { + self.$raise($$($nesting, 'ArgumentError'), "no block given") + }; + return $send(self, 'slice_when', [], (TMP_13 = function(before, after){var self = TMP_13.$$s || this; + + + + if (before == null) { + before = nil; + }; + + if (after == null) { + after = nil; + }; + return Opal.yieldX(block, [before, after])['$!']();}, TMP_13.$$s = self, TMP_13.$$arity = 2, TMP_13)); + }, TMP_Enumerable_chunk_while_12.$$arity = 0); + + Opal.def(self, '$collect', TMP_Enumerable_collect_14 = function $$collect() { + var $iter = TMP_Enumerable_collect_14.$$p, block = $iter || nil, TMP_15, self = this; + + if ($iter) TMP_Enumerable_collect_14.$$p = null; + + + if ($iter) TMP_Enumerable_collect_14.$$p = null;; + if ((block !== nil)) { + } else { + return $send(self, 'enum_for', ["collect"], (TMP_15 = function(){var self = TMP_15.$$s || this; + + return self.$enumerator_size()}, TMP_15.$$s = self, TMP_15.$$arity = 0, TMP_15)) + }; + + var result = []; + + self.$each.$$p = function() { + var value = Opal.yieldX(block, arguments); + + result.push(value); + }; + + self.$each(); + + return result; + ; + }, TMP_Enumerable_collect_14.$$arity = 0); + + Opal.def(self, '$collect_concat', TMP_Enumerable_collect_concat_16 = function $$collect_concat() { + var $iter = TMP_Enumerable_collect_concat_16.$$p, block = $iter || nil, TMP_17, TMP_18, self = this; + + if ($iter) TMP_Enumerable_collect_concat_16.$$p = null; + + + if ($iter) TMP_Enumerable_collect_concat_16.$$p = null;; + if ((block !== nil)) { + } else { + return $send(self, 'enum_for', ["collect_concat"], (TMP_17 = function(){var self = TMP_17.$$s || this; + + return self.$enumerator_size()}, TMP_17.$$s = self, TMP_17.$$arity = 0, TMP_17)) + }; + return $send(self, 'map', [], (TMP_18 = function(item){var self = TMP_18.$$s || this; + + + + if (item == null) { + item = nil; + }; + return Opal.yield1(block, item);;}, TMP_18.$$s = self, TMP_18.$$arity = 1, TMP_18)).$flatten(1); + }, TMP_Enumerable_collect_concat_16.$$arity = 0); + + Opal.def(self, '$count', TMP_Enumerable_count_19 = function $$count(object) { + var $iter = TMP_Enumerable_count_19.$$p, block = $iter || nil, TMP_20, TMP_21, TMP_22, self = this, result = nil; + + if ($iter) TMP_Enumerable_count_19.$$p = null; + + + if ($iter) TMP_Enumerable_count_19.$$p = null;; + ; + result = 0; + + if (object != null && block !== nil) { + self.$warn("warning: given block not used") + } + ; + if ($truthy(object != null)) { + block = $send(self, 'proc', [], (TMP_20 = function($a){var self = TMP_20.$$s || this, $post_args, args; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + return $$($nesting, 'Opal').$destructure(args)['$=='](object);}, TMP_20.$$s = self, TMP_20.$$arity = -1, TMP_20)) + } else if ($truthy(block['$nil?']())) { + block = $send(self, 'proc', [], (TMP_21 = function(){var self = TMP_21.$$s || this; + + return true}, TMP_21.$$s = self, TMP_21.$$arity = 0, TMP_21))}; + $send(self, 'each', [], (TMP_22 = function($a){var self = TMP_22.$$s || this, $post_args, args; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + if ($truthy(Opal.yieldX(block, args))) { + return result++; + } else { + return nil + };}, TMP_22.$$s = self, TMP_22.$$arity = -1, TMP_22)); + return result; + }, TMP_Enumerable_count_19.$$arity = -1); + + Opal.def(self, '$cycle', TMP_Enumerable_cycle_23 = function $$cycle(n) { + var $iter = TMP_Enumerable_cycle_23.$$p, block = $iter || nil, TMP_24, self = this; + + if ($iter) TMP_Enumerable_cycle_23.$$p = null; + + + if ($iter) TMP_Enumerable_cycle_23.$$p = null;; + + if (n == null) { + n = nil; + }; + if ((block !== nil)) { + } else { + return $send(self, 'enum_for', ["cycle", n], (TMP_24 = function(){var self = TMP_24.$$s || this; + + if ($truthy(n['$nil?']())) { + if ($truthy(self['$respond_to?']("size"))) { + return $$$($$($nesting, 'Float'), 'INFINITY') + } else { + return nil + } + } else { + + n = $$($nesting, 'Opal')['$coerce_to!'](n, $$($nesting, 'Integer'), "to_int"); + if ($truthy($rb_gt(n, 0))) { + return $rb_times(self.$enumerator_size(), n) + } else { + return 0 + }; + }}, TMP_24.$$s = self, TMP_24.$$arity = 0, TMP_24)) + }; + if ($truthy(n['$nil?']())) { + } else { + + n = $$($nesting, 'Opal')['$coerce_to!'](n, $$($nesting, 'Integer'), "to_int"); + if ($truthy(n <= 0)) { + return nil}; + }; + + var result, + all = [], i, length, value; + + self.$each.$$p = function() { + var param = $$($nesting, 'Opal').$destructure(arguments), + value = Opal.yield1(block, param); + + all.push(param); + } + + self.$each(); + + if (result !== undefined) { + return result; + } + + if (all.length === 0) { + return nil; + } + + if (n === nil) { + while (true) { + for (i = 0, length = all.length; i < length; i++) { + value = Opal.yield1(block, all[i]); + } + } + } + else { + while (n > 1) { + for (i = 0, length = all.length; i < length; i++) { + value = Opal.yield1(block, all[i]); + } + + n--; + } + } + ; + }, TMP_Enumerable_cycle_23.$$arity = -1); + + Opal.def(self, '$detect', TMP_Enumerable_detect_25 = function $$detect(ifnone) {try { + + var $iter = TMP_Enumerable_detect_25.$$p, block = $iter || nil, TMP_26, self = this; + + if ($iter) TMP_Enumerable_detect_25.$$p = null; + + + if ($iter) TMP_Enumerable_detect_25.$$p = null;; + ; + if ((block !== nil)) { + } else { + return self.$enum_for("detect", ifnone) + }; + $send(self, 'each', [], (TMP_26 = function($a){var self = TMP_26.$$s || this, $post_args, args, value = nil; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + value = $$($nesting, 'Opal').$destructure(args); + if ($truthy(Opal.yield1(block, value))) { + Opal.ret(value) + } else { + return nil + };}, TMP_26.$$s = self, TMP_26.$$arity = -1, TMP_26)); + + if (ifnone !== undefined) { + if (typeof(ifnone) === 'function') { + return ifnone(); + } else { + return ifnone; + } + } + ; + return nil; + } catch ($returner) { if ($returner === Opal.returner) { return $returner.$v } throw $returner; } + }, TMP_Enumerable_detect_25.$$arity = -1); + + Opal.def(self, '$drop', TMP_Enumerable_drop_27 = function $$drop(number) { + var self = this; + + + number = $$($nesting, 'Opal').$coerce_to(number, $$($nesting, 'Integer'), "to_int"); + if ($truthy(number < 0)) { + self.$raise($$($nesting, 'ArgumentError'), "attempt to drop negative size")}; + + var result = [], + current = 0; + + self.$each.$$p = function() { + if (number <= current) { + result.push($$($nesting, 'Opal').$destructure(arguments)); + } + + current++; + }; + + self.$each() + + return result; + ; + }, TMP_Enumerable_drop_27.$$arity = 1); + + Opal.def(self, '$drop_while', TMP_Enumerable_drop_while_28 = function $$drop_while() { + var $iter = TMP_Enumerable_drop_while_28.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Enumerable_drop_while_28.$$p = null; + + + if ($iter) TMP_Enumerable_drop_while_28.$$p = null;; + if ((block !== nil)) { + } else { + return self.$enum_for("drop_while") + }; + + var result = [], + dropping = true; + + self.$each.$$p = function() { + var param = $$($nesting, 'Opal').$destructure(arguments); + + if (dropping) { + var value = Opal.yield1(block, param); + + if ($falsy(value)) { + dropping = false; + result.push(param); + } + } + else { + result.push(param); + } + }; + + self.$each(); + + return result; + ; + }, TMP_Enumerable_drop_while_28.$$arity = 0); + + Opal.def(self, '$each_cons', TMP_Enumerable_each_cons_29 = function $$each_cons(n) { + var $iter = TMP_Enumerable_each_cons_29.$$p, block = $iter || nil, TMP_30, self = this; + + if ($iter) TMP_Enumerable_each_cons_29.$$p = null; + + + if ($iter) TMP_Enumerable_each_cons_29.$$p = null;; + if ($truthy(arguments.length != 1)) { + self.$raise($$($nesting, 'ArgumentError'), "" + "wrong number of arguments (" + (arguments.length) + " for 1)")}; + n = $$($nesting, 'Opal').$try_convert(n, $$($nesting, 'Integer'), "to_int"); + if ($truthy(n <= 0)) { + self.$raise($$($nesting, 'ArgumentError'), "invalid size")}; + if ((block !== nil)) { + } else { + return $send(self, 'enum_for', ["each_cons", n], (TMP_30 = function(){var self = TMP_30.$$s || this, $a, enum_size = nil; + + + enum_size = self.$enumerator_size(); + if ($truthy(enum_size['$nil?']())) { + return nil + } else if ($truthy(($truthy($a = enum_size['$=='](0)) ? $a : $rb_lt(enum_size, n)))) { + return 0 + } else { + return $rb_plus($rb_minus(enum_size, n), 1) + };}, TMP_30.$$s = self, TMP_30.$$arity = 0, TMP_30)) + }; + + var buffer = [], result = nil; + + self.$each.$$p = function() { + var element = $$($nesting, 'Opal').$destructure(arguments); + buffer.push(element); + if (buffer.length > n) { + buffer.shift(); + } + if (buffer.length == n) { + Opal.yield1(block, buffer.slice(0, n)); + } + } + + self.$each(); + + return result; + ; + }, TMP_Enumerable_each_cons_29.$$arity = 1); + + Opal.def(self, '$each_entry', TMP_Enumerable_each_entry_31 = function $$each_entry($a) { + var $iter = TMP_Enumerable_each_entry_31.$$p, block = $iter || nil, $post_args, data, TMP_32, self = this; + + if ($iter) TMP_Enumerable_each_entry_31.$$p = null; + + + if ($iter) TMP_Enumerable_each_entry_31.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + data = $post_args;; + if ((block !== nil)) { + } else { + return $send(self, 'to_enum', ["each_entry"].concat(Opal.to_a(data)), (TMP_32 = function(){var self = TMP_32.$$s || this; + + return self.$enumerator_size()}, TMP_32.$$s = self, TMP_32.$$arity = 0, TMP_32)) + }; + + self.$each.$$p = function() { + var item = $$($nesting, 'Opal').$destructure(arguments); + + Opal.yield1(block, item); + } + + self.$each.apply(self, data); + + return self; + ; + }, TMP_Enumerable_each_entry_31.$$arity = -1); + + Opal.def(self, '$each_slice', TMP_Enumerable_each_slice_33 = function $$each_slice(n) { + var $iter = TMP_Enumerable_each_slice_33.$$p, block = $iter || nil, TMP_34, self = this; + + if ($iter) TMP_Enumerable_each_slice_33.$$p = null; + + + if ($iter) TMP_Enumerable_each_slice_33.$$p = null;; + n = $$($nesting, 'Opal').$coerce_to(n, $$($nesting, 'Integer'), "to_int"); + if ($truthy(n <= 0)) { + self.$raise($$($nesting, 'ArgumentError'), "invalid slice size")}; + if ((block !== nil)) { + } else { + return $send(self, 'enum_for', ["each_slice", n], (TMP_34 = function(){var self = TMP_34.$$s || this; + + if ($truthy(self['$respond_to?']("size"))) { + return $rb_divide(self.$size(), n).$ceil() + } else { + return nil + }}, TMP_34.$$s = self, TMP_34.$$arity = 0, TMP_34)) + }; + + var result, + slice = [] + + self.$each.$$p = function() { + var param = $$($nesting, 'Opal').$destructure(arguments); + + slice.push(param); + + if (slice.length === n) { + Opal.yield1(block, slice); + slice = []; + } + }; + + self.$each(); + + if (result !== undefined) { + return result; + } + + // our "last" group, if smaller than n then won't have been yielded + if (slice.length > 0) { + Opal.yield1(block, slice); + } + ; + return nil; + }, TMP_Enumerable_each_slice_33.$$arity = 1); + + Opal.def(self, '$each_with_index', TMP_Enumerable_each_with_index_35 = function $$each_with_index($a) { + var $iter = TMP_Enumerable_each_with_index_35.$$p, block = $iter || nil, $post_args, args, TMP_36, self = this; + + if ($iter) TMP_Enumerable_each_with_index_35.$$p = null; + + + if ($iter) TMP_Enumerable_each_with_index_35.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + if ((block !== nil)) { + } else { + return $send(self, 'enum_for', ["each_with_index"].concat(Opal.to_a(args)), (TMP_36 = function(){var self = TMP_36.$$s || this; + + return self.$enumerator_size()}, TMP_36.$$s = self, TMP_36.$$arity = 0, TMP_36)) + }; + + var result, + index = 0; + + self.$each.$$p = function() { + var param = $$($nesting, 'Opal').$destructure(arguments); + + block(param, index); + + index++; + }; + + self.$each.apply(self, args); + + if (result !== undefined) { + return result; + } + ; + return self; + }, TMP_Enumerable_each_with_index_35.$$arity = -1); + + Opal.def(self, '$each_with_object', TMP_Enumerable_each_with_object_37 = function $$each_with_object(object) { + var $iter = TMP_Enumerable_each_with_object_37.$$p, block = $iter || nil, TMP_38, self = this; + + if ($iter) TMP_Enumerable_each_with_object_37.$$p = null; + + + if ($iter) TMP_Enumerable_each_with_object_37.$$p = null;; + if ((block !== nil)) { + } else { + return $send(self, 'enum_for', ["each_with_object", object], (TMP_38 = function(){var self = TMP_38.$$s || this; + + return self.$enumerator_size()}, TMP_38.$$s = self, TMP_38.$$arity = 0, TMP_38)) + }; + + var result; + + self.$each.$$p = function() { + var param = $$($nesting, 'Opal').$destructure(arguments); + + block(param, object); + }; + + self.$each(); + + if (result !== undefined) { + return result; + } + ; + return object; + }, TMP_Enumerable_each_with_object_37.$$arity = 1); + + Opal.def(self, '$entries', TMP_Enumerable_entries_39 = function $$entries($a) { + var $post_args, args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + + var result = []; + + self.$each.$$p = function() { + result.push($$($nesting, 'Opal').$destructure(arguments)); + }; + + self.$each.apply(self, args); + + return result; + ; + }, TMP_Enumerable_entries_39.$$arity = -1); + Opal.alias(self, "find", "detect"); + + Opal.def(self, '$find_all', TMP_Enumerable_find_all_40 = function $$find_all() { + var $iter = TMP_Enumerable_find_all_40.$$p, block = $iter || nil, TMP_41, self = this; + + if ($iter) TMP_Enumerable_find_all_40.$$p = null; + + + if ($iter) TMP_Enumerable_find_all_40.$$p = null;; + if ((block !== nil)) { + } else { + return $send(self, 'enum_for', ["find_all"], (TMP_41 = function(){var self = TMP_41.$$s || this; + + return self.$enumerator_size()}, TMP_41.$$s = self, TMP_41.$$arity = 0, TMP_41)) + }; + + var result = []; + + self.$each.$$p = function() { + var param = $$($nesting, 'Opal').$destructure(arguments), + value = Opal.yield1(block, param); + + if ($truthy(value)) { + result.push(param); + } + }; + + self.$each(); + + return result; + ; + }, TMP_Enumerable_find_all_40.$$arity = 0); + + Opal.def(self, '$find_index', TMP_Enumerable_find_index_42 = function $$find_index(object) {try { + + var $iter = TMP_Enumerable_find_index_42.$$p, block = $iter || nil, TMP_43, TMP_44, self = this, index = nil; + + if ($iter) TMP_Enumerable_find_index_42.$$p = null; + + + if ($iter) TMP_Enumerable_find_index_42.$$p = null;; + ; + if ($truthy(object === undefined && block === nil)) { + return self.$enum_for("find_index")}; + + if (object != null && block !== nil) { + self.$warn("warning: given block not used") + } + ; + index = 0; + if ($truthy(object != null)) { + $send(self, 'each', [], (TMP_43 = function($a){var self = TMP_43.$$s || this, $post_args, value; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + value = $post_args;; + if ($$($nesting, 'Opal').$destructure(value)['$=='](object)) { + Opal.ret(index)}; + return index += 1;;}, TMP_43.$$s = self, TMP_43.$$arity = -1, TMP_43)) + } else { + $send(self, 'each', [], (TMP_44 = function($a){var self = TMP_44.$$s || this, $post_args, value; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + value = $post_args;; + if ($truthy(Opal.yieldX(block, Opal.to_a(value)))) { + Opal.ret(index)}; + return index += 1;;}, TMP_44.$$s = self, TMP_44.$$arity = -1, TMP_44)) + }; + return nil; + } catch ($returner) { if ($returner === Opal.returner) { return $returner.$v } throw $returner; } + }, TMP_Enumerable_find_index_42.$$arity = -1); + + Opal.def(self, '$first', TMP_Enumerable_first_45 = function $$first(number) {try { + + var TMP_46, TMP_47, self = this, result = nil, current = nil; + + + ; + if ($truthy(number === undefined)) { + return $send(self, 'each', [], (TMP_46 = function(value){var self = TMP_46.$$s || this; + + + + if (value == null) { + value = nil; + }; + Opal.ret(value);}, TMP_46.$$s = self, TMP_46.$$arity = 1, TMP_46)) + } else { + + result = []; + number = $$($nesting, 'Opal').$coerce_to(number, $$($nesting, 'Integer'), "to_int"); + if ($truthy(number < 0)) { + self.$raise($$($nesting, 'ArgumentError'), "attempt to take negative size")}; + if ($truthy(number == 0)) { + return []}; + current = 0; + $send(self, 'each', [], (TMP_47 = function($a){var self = TMP_47.$$s || this, $post_args, args; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + result.push($$($nesting, 'Opal').$destructure(args)); + if ($truthy(number <= ++current)) { + Opal.ret(result) + } else { + return nil + };}, TMP_47.$$s = self, TMP_47.$$arity = -1, TMP_47)); + return result; + }; + } catch ($returner) { if ($returner === Opal.returner) { return $returner.$v } throw $returner; } + }, TMP_Enumerable_first_45.$$arity = -1); + Opal.alias(self, "flat_map", "collect_concat"); + + Opal.def(self, '$grep', TMP_Enumerable_grep_48 = function $$grep(pattern) { + var $iter = TMP_Enumerable_grep_48.$$p, block = $iter || nil, TMP_49, self = this, result = nil; + + if ($iter) TMP_Enumerable_grep_48.$$p = null; + + + if ($iter) TMP_Enumerable_grep_48.$$p = null;; + result = []; + $send(self, 'each', [], (TMP_49 = function($a){var self = TMP_49.$$s || this, $post_args, value, cmp = nil; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + value = $post_args;; + cmp = comparableForPattern(value); + if ($truthy($send(pattern, '__send__', ["==="].concat(Opal.to_a(cmp))))) { + } else { + return nil; + }; + if ((block !== nil)) { + + if ($truthy($rb_gt(value.$length(), 1))) { + value = [value]}; + value = Opal.yieldX(block, Opal.to_a(value)); + } else if ($truthy($rb_le(value.$length(), 1))) { + value = value['$[]'](0)}; + return result.$push(value);}, TMP_49.$$s = self, TMP_49.$$arity = -1, TMP_49)); + return result; + }, TMP_Enumerable_grep_48.$$arity = 1); + + Opal.def(self, '$grep_v', TMP_Enumerable_grep_v_50 = function $$grep_v(pattern) { + var $iter = TMP_Enumerable_grep_v_50.$$p, block = $iter || nil, TMP_51, self = this, result = nil; + + if ($iter) TMP_Enumerable_grep_v_50.$$p = null; + + + if ($iter) TMP_Enumerable_grep_v_50.$$p = null;; + result = []; + $send(self, 'each', [], (TMP_51 = function($a){var self = TMP_51.$$s || this, $post_args, value, cmp = nil; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + value = $post_args;; + cmp = comparableForPattern(value); + if ($truthy($send(pattern, '__send__', ["==="].concat(Opal.to_a(cmp))))) { + return nil;}; + if ((block !== nil)) { + + if ($truthy($rb_gt(value.$length(), 1))) { + value = [value]}; + value = Opal.yieldX(block, Opal.to_a(value)); + } else if ($truthy($rb_le(value.$length(), 1))) { + value = value['$[]'](0)}; + return result.$push(value);}, TMP_51.$$s = self, TMP_51.$$arity = -1, TMP_51)); + return result; + }, TMP_Enumerable_grep_v_50.$$arity = 1); + + Opal.def(self, '$group_by', TMP_Enumerable_group_by_52 = function $$group_by() { + var $iter = TMP_Enumerable_group_by_52.$$p, block = $iter || nil, TMP_53, $a, self = this, hash = nil, $writer = nil; + + if ($iter) TMP_Enumerable_group_by_52.$$p = null; + + + if ($iter) TMP_Enumerable_group_by_52.$$p = null;; + if ((block !== nil)) { + } else { + return $send(self, 'enum_for', ["group_by"], (TMP_53 = function(){var self = TMP_53.$$s || this; + + return self.$enumerator_size()}, TMP_53.$$s = self, TMP_53.$$arity = 0, TMP_53)) + }; + hash = $hash2([], {}); + + var result; + + self.$each.$$p = function() { + var param = $$($nesting, 'Opal').$destructure(arguments), + value = Opal.yield1(block, param); + + ($truthy($a = hash['$[]'](value)) ? $a : (($writer = [value, []]), $send(hash, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]))['$<<'](param); + } + + self.$each(); + + if (result !== undefined) { + return result; + } + ; + return hash; + }, TMP_Enumerable_group_by_52.$$arity = 0); + + Opal.def(self, '$include?', TMP_Enumerable_include$q_54 = function(obj) {try { + + var TMP_55, self = this; + + + $send(self, 'each', [], (TMP_55 = function($a){var self = TMP_55.$$s || this, $post_args, args; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + if ($$($nesting, 'Opal').$destructure(args)['$=='](obj)) { + Opal.ret(true) + } else { + return nil + };}, TMP_55.$$s = self, TMP_55.$$arity = -1, TMP_55)); + return false; + } catch ($returner) { if ($returner === Opal.returner) { return $returner.$v } throw $returner; } + }, TMP_Enumerable_include$q_54.$$arity = 1); + + Opal.def(self, '$inject', TMP_Enumerable_inject_56 = function $$inject(object, sym) { + var $iter = TMP_Enumerable_inject_56.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Enumerable_inject_56.$$p = null; + + + if ($iter) TMP_Enumerable_inject_56.$$p = null;; + ; + ; + + var result = object; + + if (block !== nil && sym === undefined) { + self.$each.$$p = function() { + var value = $$($nesting, 'Opal').$destructure(arguments); + + if (result === undefined) { + result = value; + return; + } + + value = Opal.yieldX(block, [result, value]); + + result = value; + }; + } + else { + if (sym === undefined) { + if (!$$($nesting, 'Symbol')['$==='](object)) { + self.$raise($$($nesting, 'TypeError'), "" + (object.$inspect()) + " is not a Symbol"); + } + + sym = object; + result = undefined; + } + + self.$each.$$p = function() { + var value = $$($nesting, 'Opal').$destructure(arguments); + + if (result === undefined) { + result = value; + return; + } + + result = (result).$__send__(sym, value); + }; + } + + self.$each(); + + return result == undefined ? nil : result; + ; + }, TMP_Enumerable_inject_56.$$arity = -1); + + Opal.def(self, '$lazy', TMP_Enumerable_lazy_57 = function $$lazy() { + var TMP_58, self = this; + + return $send($$$($$($nesting, 'Enumerator'), 'Lazy'), 'new', [self, self.$enumerator_size()], (TMP_58 = function(enum$, $a){var self = TMP_58.$$s || this, $post_args, args; + + + + if (enum$ == null) { + enum$ = nil; + }; + + $post_args = Opal.slice.call(arguments, 1, arguments.length); + + args = $post_args;; + return $send(enum$, 'yield', Opal.to_a(args));}, TMP_58.$$s = self, TMP_58.$$arity = -2, TMP_58)) + }, TMP_Enumerable_lazy_57.$$arity = 0); + + Opal.def(self, '$enumerator_size', TMP_Enumerable_enumerator_size_59 = function $$enumerator_size() { + var self = this; + + if ($truthy(self['$respond_to?']("size"))) { + return self.$size() + } else { + return nil + } + }, TMP_Enumerable_enumerator_size_59.$$arity = 0); + Opal.alias(self, "map", "collect"); + + Opal.def(self, '$max', TMP_Enumerable_max_60 = function $$max(n) { + var $iter = TMP_Enumerable_max_60.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Enumerable_max_60.$$p = null; + + + if ($iter) TMP_Enumerable_max_60.$$p = null;; + ; + + if (n === undefined || n === nil) { + var result, value; + + self.$each.$$p = function() { + var item = $$($nesting, 'Opal').$destructure(arguments); + + if (result === undefined) { + result = item; + return; + } + + if (block !== nil) { + value = Opal.yieldX(block, [item, result]); + } else { + value = (item)['$<=>'](result); + } + + if (value === nil) { + self.$raise($$($nesting, 'ArgumentError'), "comparison failed"); + } + + if (value > 0) { + result = item; + } + } + + self.$each(); + + if (result === undefined) { + return nil; + } else { + return result; + } + } + ; + n = $$($nesting, 'Opal').$coerce_to(n, $$($nesting, 'Integer'), "to_int"); + return $send(self, 'sort', [], block.$to_proc()).$reverse().$first(n); + }, TMP_Enumerable_max_60.$$arity = -1); + + Opal.def(self, '$max_by', TMP_Enumerable_max_by_61 = function $$max_by() { + var $iter = TMP_Enumerable_max_by_61.$$p, block = $iter || nil, TMP_62, self = this; + + if ($iter) TMP_Enumerable_max_by_61.$$p = null; + + + if ($iter) TMP_Enumerable_max_by_61.$$p = null;; + if ($truthy(block)) { + } else { + return $send(self, 'enum_for', ["max_by"], (TMP_62 = function(){var self = TMP_62.$$s || this; + + return self.$enumerator_size()}, TMP_62.$$s = self, TMP_62.$$arity = 0, TMP_62)) + }; + + var result, + by; + + self.$each.$$p = function() { + var param = $$($nesting, 'Opal').$destructure(arguments), + value = Opal.yield1(block, param); + + if (result === undefined) { + result = param; + by = value; + return; + } + + if ((value)['$<=>'](by) > 0) { + result = param + by = value; + } + }; + + self.$each(); + + return result === undefined ? nil : result; + ; + }, TMP_Enumerable_max_by_61.$$arity = 0); + Opal.alias(self, "member?", "include?"); + + Opal.def(self, '$min', TMP_Enumerable_min_63 = function $$min() { + var $iter = TMP_Enumerable_min_63.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Enumerable_min_63.$$p = null; + + + if ($iter) TMP_Enumerable_min_63.$$p = null;; + + var result; + + if (block !== nil) { + self.$each.$$p = function() { + var param = $$($nesting, 'Opal').$destructure(arguments); + + if (result === undefined) { + result = param; + return; + } + + var value = block(param, result); + + if (value === nil) { + self.$raise($$($nesting, 'ArgumentError'), "comparison failed"); + } + + if (value < 0) { + result = param; + } + }; + } + else { + self.$each.$$p = function() { + var param = $$($nesting, 'Opal').$destructure(arguments); + + if (result === undefined) { + result = param; + return; + } + + if ($$($nesting, 'Opal').$compare(param, result) < 0) { + result = param; + } + }; + } + + self.$each(); + + return result === undefined ? nil : result; + ; + }, TMP_Enumerable_min_63.$$arity = 0); + + Opal.def(self, '$min_by', TMP_Enumerable_min_by_64 = function $$min_by() { + var $iter = TMP_Enumerable_min_by_64.$$p, block = $iter || nil, TMP_65, self = this; + + if ($iter) TMP_Enumerable_min_by_64.$$p = null; + + + if ($iter) TMP_Enumerable_min_by_64.$$p = null;; + if ($truthy(block)) { + } else { + return $send(self, 'enum_for', ["min_by"], (TMP_65 = function(){var self = TMP_65.$$s || this; + + return self.$enumerator_size()}, TMP_65.$$s = self, TMP_65.$$arity = 0, TMP_65)) + }; + + var result, + by; + + self.$each.$$p = function() { + var param = $$($nesting, 'Opal').$destructure(arguments), + value = Opal.yield1(block, param); + + if (result === undefined) { + result = param; + by = value; + return; + } + + if ((value)['$<=>'](by) < 0) { + result = param + by = value; + } + }; + + self.$each(); + + return result === undefined ? nil : result; + ; + }, TMP_Enumerable_min_by_64.$$arity = 0); + + Opal.def(self, '$minmax', TMP_Enumerable_minmax_66 = function $$minmax() { + var $iter = TMP_Enumerable_minmax_66.$$p, block = $iter || nil, $a, TMP_67, self = this; + + if ($iter) TMP_Enumerable_minmax_66.$$p = null; + + + if ($iter) TMP_Enumerable_minmax_66.$$p = null;; + block = ($truthy($a = block) ? $a : $send(self, 'proc', [], (TMP_67 = function(a, b){var self = TMP_67.$$s || this; + + + + if (a == null) { + a = nil; + }; + + if (b == null) { + b = nil; + }; + return a['$<=>'](b);}, TMP_67.$$s = self, TMP_67.$$arity = 2, TMP_67))); + + var min = nil, max = nil, first_time = true; + + self.$each.$$p = function() { + var element = $$($nesting, 'Opal').$destructure(arguments); + if (first_time) { + min = max = element; + first_time = false; + } else { + var min_cmp = block.$call(min, element); + + if (min_cmp === nil) { + self.$raise($$($nesting, 'ArgumentError'), "comparison failed") + } else if (min_cmp > 0) { + min = element; + } + + var max_cmp = block.$call(max, element); + + if (max_cmp === nil) { + self.$raise($$($nesting, 'ArgumentError'), "comparison failed") + } else if (max_cmp < 0) { + max = element; + } + } + } + + self.$each(); + + return [min, max]; + ; + }, TMP_Enumerable_minmax_66.$$arity = 0); + + Opal.def(self, '$minmax_by', TMP_Enumerable_minmax_by_68 = function $$minmax_by() { + var $iter = TMP_Enumerable_minmax_by_68.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Enumerable_minmax_by_68.$$p = null; + + + if ($iter) TMP_Enumerable_minmax_by_68.$$p = null;; + return self.$raise($$($nesting, 'NotImplementedError')); + }, TMP_Enumerable_minmax_by_68.$$arity = 0); + + Opal.def(self, '$none?', TMP_Enumerable_none$q_69 = function(pattern) {try { + + var $iter = TMP_Enumerable_none$q_69.$$p, block = $iter || nil, TMP_70, TMP_71, TMP_72, self = this; + + if ($iter) TMP_Enumerable_none$q_69.$$p = null; + + + if ($iter) TMP_Enumerable_none$q_69.$$p = null;; + ; + if ($truthy(pattern !== undefined)) { + $send(self, 'each', [], (TMP_70 = function($a){var self = TMP_70.$$s || this, $post_args, value, comparable = nil; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + value = $post_args;; + comparable = comparableForPattern(value); + if ($truthy($send(pattern, 'public_send', ["==="].concat(Opal.to_a(comparable))))) { + Opal.ret(false) + } else { + return nil + };}, TMP_70.$$s = self, TMP_70.$$arity = -1, TMP_70)) + } else if ((block !== nil)) { + $send(self, 'each', [], (TMP_71 = function($a){var self = TMP_71.$$s || this, $post_args, value; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + value = $post_args;; + if ($truthy(Opal.yieldX(block, Opal.to_a(value)))) { + Opal.ret(false) + } else { + return nil + };}, TMP_71.$$s = self, TMP_71.$$arity = -1, TMP_71)) + } else { + $send(self, 'each', [], (TMP_72 = function($a){var self = TMP_72.$$s || this, $post_args, value, item = nil; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + value = $post_args;; + item = $$($nesting, 'Opal').$destructure(value); + if ($truthy(item)) { + Opal.ret(false) + } else { + return nil + };}, TMP_72.$$s = self, TMP_72.$$arity = -1, TMP_72)) + }; + return true; + } catch ($returner) { if ($returner === Opal.returner) { return $returner.$v } throw $returner; } + }, TMP_Enumerable_none$q_69.$$arity = -1); + + Opal.def(self, '$one?', TMP_Enumerable_one$q_73 = function(pattern) {try { + + var $iter = TMP_Enumerable_one$q_73.$$p, block = $iter || nil, TMP_74, TMP_75, TMP_76, self = this, count = nil; + + if ($iter) TMP_Enumerable_one$q_73.$$p = null; + + + if ($iter) TMP_Enumerable_one$q_73.$$p = null;; + ; + count = 0; + if ($truthy(pattern !== undefined)) { + $send(self, 'each', [], (TMP_74 = function($a){var self = TMP_74.$$s || this, $post_args, value, comparable = nil; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + value = $post_args;; + comparable = comparableForPattern(value); + if ($truthy($send(pattern, 'public_send', ["==="].concat(Opal.to_a(comparable))))) { + + count = $rb_plus(count, 1); + if ($truthy($rb_gt(count, 1))) { + Opal.ret(false) + } else { + return nil + }; + } else { + return nil + };}, TMP_74.$$s = self, TMP_74.$$arity = -1, TMP_74)) + } else if ((block !== nil)) { + $send(self, 'each', [], (TMP_75 = function($a){var self = TMP_75.$$s || this, $post_args, value; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + value = $post_args;; + if ($truthy(Opal.yieldX(block, Opal.to_a(value)))) { + } else { + return nil; + }; + count = $rb_plus(count, 1); + if ($truthy($rb_gt(count, 1))) { + Opal.ret(false) + } else { + return nil + };}, TMP_75.$$s = self, TMP_75.$$arity = -1, TMP_75)) + } else { + $send(self, 'each', [], (TMP_76 = function($a){var self = TMP_76.$$s || this, $post_args, value; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + value = $post_args;; + if ($truthy($$($nesting, 'Opal').$destructure(value))) { + } else { + return nil; + }; + count = $rb_plus(count, 1); + if ($truthy($rb_gt(count, 1))) { + Opal.ret(false) + } else { + return nil + };}, TMP_76.$$s = self, TMP_76.$$arity = -1, TMP_76)) + }; + return count['$=='](1); + } catch ($returner) { if ($returner === Opal.returner) { return $returner.$v } throw $returner; } + }, TMP_Enumerable_one$q_73.$$arity = -1); + + Opal.def(self, '$partition', TMP_Enumerable_partition_77 = function $$partition() { + var $iter = TMP_Enumerable_partition_77.$$p, block = $iter || nil, TMP_78, self = this; + + if ($iter) TMP_Enumerable_partition_77.$$p = null; + + + if ($iter) TMP_Enumerable_partition_77.$$p = null;; + if ((block !== nil)) { + } else { + return $send(self, 'enum_for', ["partition"], (TMP_78 = function(){var self = TMP_78.$$s || this; + + return self.$enumerator_size()}, TMP_78.$$s = self, TMP_78.$$arity = 0, TMP_78)) + }; + + var truthy = [], falsy = [], result; + + self.$each.$$p = function() { + var param = $$($nesting, 'Opal').$destructure(arguments), + value = Opal.yield1(block, param); + + if ($truthy(value)) { + truthy.push(param); + } + else { + falsy.push(param); + } + }; + + self.$each(); + + return [truthy, falsy]; + ; + }, TMP_Enumerable_partition_77.$$arity = 0); + Opal.alias(self, "reduce", "inject"); + + Opal.def(self, '$reject', TMP_Enumerable_reject_79 = function $$reject() { + var $iter = TMP_Enumerable_reject_79.$$p, block = $iter || nil, TMP_80, self = this; + + if ($iter) TMP_Enumerable_reject_79.$$p = null; + + + if ($iter) TMP_Enumerable_reject_79.$$p = null;; + if ((block !== nil)) { + } else { + return $send(self, 'enum_for', ["reject"], (TMP_80 = function(){var self = TMP_80.$$s || this; + + return self.$enumerator_size()}, TMP_80.$$s = self, TMP_80.$$arity = 0, TMP_80)) + }; + + var result = []; + + self.$each.$$p = function() { + var param = $$($nesting, 'Opal').$destructure(arguments), + value = Opal.yield1(block, param); + + if ($falsy(value)) { + result.push(param); + } + }; + + self.$each(); + + return result; + ; + }, TMP_Enumerable_reject_79.$$arity = 0); + + Opal.def(self, '$reverse_each', TMP_Enumerable_reverse_each_81 = function $$reverse_each() { + var $iter = TMP_Enumerable_reverse_each_81.$$p, block = $iter || nil, TMP_82, self = this; + + if ($iter) TMP_Enumerable_reverse_each_81.$$p = null; + + + if ($iter) TMP_Enumerable_reverse_each_81.$$p = null;; + if ((block !== nil)) { + } else { + return $send(self, 'enum_for', ["reverse_each"], (TMP_82 = function(){var self = TMP_82.$$s || this; + + return self.$enumerator_size()}, TMP_82.$$s = self, TMP_82.$$arity = 0, TMP_82)) + }; + + var result = []; + + self.$each.$$p = function() { + result.push(arguments); + }; + + self.$each(); + + for (var i = result.length - 1; i >= 0; i--) { + Opal.yieldX(block, result[i]); + } + + return result; + ; + }, TMP_Enumerable_reverse_each_81.$$arity = 0); + Opal.alias(self, "select", "find_all"); + + Opal.def(self, '$slice_before', TMP_Enumerable_slice_before_83 = function $$slice_before(pattern) { + var $iter = TMP_Enumerable_slice_before_83.$$p, block = $iter || nil, TMP_84, self = this; + + if ($iter) TMP_Enumerable_slice_before_83.$$p = null; + + + if ($iter) TMP_Enumerable_slice_before_83.$$p = null;; + ; + if ($truthy(pattern === undefined && block === nil)) { + self.$raise($$($nesting, 'ArgumentError'), "both pattern and block are given")}; + if ($truthy(pattern !== undefined && block !== nil || arguments.length > 1)) { + self.$raise($$($nesting, 'ArgumentError'), "" + "wrong number of arguments (" + (arguments.length) + " expected 1)")}; + return $send($$($nesting, 'Enumerator'), 'new', [], (TMP_84 = function(e){var self = TMP_84.$$s || this; + + + + if (e == null) { + e = nil; + }; + + var slice = []; + + if (block !== nil) { + if (pattern === undefined) { + self.$each.$$p = function() { + var param = $$($nesting, 'Opal').$destructure(arguments), + value = Opal.yield1(block, param); + + if ($truthy(value) && slice.length > 0) { + e['$<<'](slice); + slice = []; + } + + slice.push(param); + }; + } + else { + self.$each.$$p = function() { + var param = $$($nesting, 'Opal').$destructure(arguments), + value = block(param, pattern.$dup()); + + if ($truthy(value) && slice.length > 0) { + e['$<<'](slice); + slice = []; + } + + slice.push(param); + }; + } + } + else { + self.$each.$$p = function() { + var param = $$($nesting, 'Opal').$destructure(arguments), + value = pattern['$==='](param); + + if ($truthy(value) && slice.length > 0) { + e['$<<'](slice); + slice = []; + } + + slice.push(param); + }; + } + + self.$each(); + + if (slice.length > 0) { + e['$<<'](slice); + } + ;}, TMP_84.$$s = self, TMP_84.$$arity = 1, TMP_84)); + }, TMP_Enumerable_slice_before_83.$$arity = -1); + + Opal.def(self, '$slice_after', TMP_Enumerable_slice_after_85 = function $$slice_after(pattern) { + var $iter = TMP_Enumerable_slice_after_85.$$p, block = $iter || nil, TMP_86, TMP_87, self = this; + + if ($iter) TMP_Enumerable_slice_after_85.$$p = null; + + + if ($iter) TMP_Enumerable_slice_after_85.$$p = null;; + ; + if ($truthy(pattern === undefined && block === nil)) { + self.$raise($$($nesting, 'ArgumentError'), "both pattern and block are given")}; + if ($truthy(pattern !== undefined && block !== nil || arguments.length > 1)) { + self.$raise($$($nesting, 'ArgumentError'), "" + "wrong number of arguments (" + (arguments.length) + " expected 1)")}; + if ($truthy(pattern !== undefined)) { + block = $send(self, 'proc', [], (TMP_86 = function(e){var self = TMP_86.$$s || this; + + + + if (e == null) { + e = nil; + }; + return pattern['$==='](e);}, TMP_86.$$s = self, TMP_86.$$arity = 1, TMP_86))}; + return $send($$($nesting, 'Enumerator'), 'new', [], (TMP_87 = function(yielder){var self = TMP_87.$$s || this; + + + + if (yielder == null) { + yielder = nil; + }; + + var accumulate; + + self.$each.$$p = function() { + var element = $$($nesting, 'Opal').$destructure(arguments), + end_chunk = Opal.yield1(block, element); + + if (accumulate == null) { + accumulate = []; + } + + if ($truthy(end_chunk)) { + accumulate.push(element); + yielder.$yield(accumulate); + accumulate = null; + } else { + accumulate.push(element) + } + } + + self.$each(); + + if (accumulate != null) { + yielder.$yield(accumulate); + } + ;}, TMP_87.$$s = self, TMP_87.$$arity = 1, TMP_87)); + }, TMP_Enumerable_slice_after_85.$$arity = -1); + + Opal.def(self, '$slice_when', TMP_Enumerable_slice_when_88 = function $$slice_when() { + var $iter = TMP_Enumerable_slice_when_88.$$p, block = $iter || nil, TMP_89, self = this; + + if ($iter) TMP_Enumerable_slice_when_88.$$p = null; + + + if ($iter) TMP_Enumerable_slice_when_88.$$p = null;; + if ((block !== nil)) { + } else { + self.$raise($$($nesting, 'ArgumentError'), "wrong number of arguments (0 for 1)") + }; + return $send($$($nesting, 'Enumerator'), 'new', [], (TMP_89 = function(yielder){var self = TMP_89.$$s || this; + + + + if (yielder == null) { + yielder = nil; + }; + + var slice = nil, last_after = nil; + + self.$each_cons.$$p = function() { + var params = $$($nesting, 'Opal').$destructure(arguments), + before = params[0], + after = params[1], + match = Opal.yieldX(block, [before, after]); + + last_after = after; + + if (slice === nil) { + slice = []; + } + + if ($truthy(match)) { + slice.push(before); + yielder.$yield(slice); + slice = []; + } else { + slice.push(before); + } + } + + self.$each_cons(2); + + if (slice !== nil) { + slice.push(last_after); + yielder.$yield(slice); + } + ;}, TMP_89.$$s = self, TMP_89.$$arity = 1, TMP_89)); + }, TMP_Enumerable_slice_when_88.$$arity = 0); + + Opal.def(self, '$sort', TMP_Enumerable_sort_90 = function $$sort() { + var $iter = TMP_Enumerable_sort_90.$$p, block = $iter || nil, TMP_91, self = this, ary = nil; + + if ($iter) TMP_Enumerable_sort_90.$$p = null; + + + if ($iter) TMP_Enumerable_sort_90.$$p = null;; + ary = self.$to_a(); + if ((block !== nil)) { + } else { + block = $lambda((TMP_91 = function(a, b){var self = TMP_91.$$s || this; + + + + if (a == null) { + a = nil; + }; + + if (b == null) { + b = nil; + }; + return a['$<=>'](b);}, TMP_91.$$s = self, TMP_91.$$arity = 2, TMP_91)) + }; + return $send(ary, 'sort', [], block.$to_proc()); + }, TMP_Enumerable_sort_90.$$arity = 0); + + Opal.def(self, '$sort_by', TMP_Enumerable_sort_by_92 = function $$sort_by() { + var $iter = TMP_Enumerable_sort_by_92.$$p, block = $iter || nil, TMP_93, TMP_94, TMP_95, TMP_96, self = this, dup = nil; + + if ($iter) TMP_Enumerable_sort_by_92.$$p = null; + + + if ($iter) TMP_Enumerable_sort_by_92.$$p = null;; + if ((block !== nil)) { + } else { + return $send(self, 'enum_for', ["sort_by"], (TMP_93 = function(){var self = TMP_93.$$s || this; + + return self.$enumerator_size()}, TMP_93.$$s = self, TMP_93.$$arity = 0, TMP_93)) + }; + dup = $send(self, 'map', [], (TMP_94 = function(){var self = TMP_94.$$s || this, arg = nil; + + + arg = $$($nesting, 'Opal').$destructure(arguments); + return [Opal.yield1(block, arg), arg];}, TMP_94.$$s = self, TMP_94.$$arity = 0, TMP_94)); + $send(dup, 'sort!', [], (TMP_95 = function(a, b){var self = TMP_95.$$s || this; + + + + if (a == null) { + a = nil; + }; + + if (b == null) { + b = nil; + }; + return (a[0])['$<=>'](b[0]);}, TMP_95.$$s = self, TMP_95.$$arity = 2, TMP_95)); + return $send(dup, 'map!', [], (TMP_96 = function(i){var self = TMP_96.$$s || this; + + + + if (i == null) { + i = nil; + }; + return i[1];;}, TMP_96.$$s = self, TMP_96.$$arity = 1, TMP_96)); + }, TMP_Enumerable_sort_by_92.$$arity = 0); + + Opal.def(self, '$sum', TMP_Enumerable_sum_97 = function $$sum(initial) { + var TMP_98, $iter = TMP_Enumerable_sum_97.$$p, $yield = $iter || nil, self = this, result = nil; + + if ($iter) TMP_Enumerable_sum_97.$$p = null; + + + if (initial == null) { + initial = 0; + }; + result = initial; + $send(self, 'each', [], (TMP_98 = function($a){var self = TMP_98.$$s || this, $post_args, args, item = nil; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + item = (function() {if (($yield !== nil)) { + return Opal.yieldX($yield, Opal.to_a(args)); + } else { + return $$($nesting, 'Opal').$destructure(args) + }; return nil; })(); + return (result = $rb_plus(result, item));}, TMP_98.$$s = self, TMP_98.$$arity = -1, TMP_98)); + return result; + }, TMP_Enumerable_sum_97.$$arity = -1); + + Opal.def(self, '$take', TMP_Enumerable_take_99 = function $$take(num) { + var self = this; + + return self.$first(num) + }, TMP_Enumerable_take_99.$$arity = 1); + + Opal.def(self, '$take_while', TMP_Enumerable_take_while_100 = function $$take_while() {try { + + var $iter = TMP_Enumerable_take_while_100.$$p, block = $iter || nil, TMP_101, self = this, result = nil; + + if ($iter) TMP_Enumerable_take_while_100.$$p = null; + + + if ($iter) TMP_Enumerable_take_while_100.$$p = null;; + if ($truthy(block)) { + } else { + return self.$enum_for("take_while") + }; + result = []; + return $send(self, 'each', [], (TMP_101 = function($a){var self = TMP_101.$$s || this, $post_args, args, value = nil; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + value = $$($nesting, 'Opal').$destructure(args); + if ($truthy(Opal.yield1(block, value))) { + } else { + Opal.ret(result) + }; + return result.push(value);;}, TMP_101.$$s = self, TMP_101.$$arity = -1, TMP_101)); + } catch ($returner) { if ($returner === Opal.returner) { return $returner.$v } throw $returner; } + }, TMP_Enumerable_take_while_100.$$arity = 0); + + Opal.def(self, '$uniq', TMP_Enumerable_uniq_102 = function $$uniq() { + var $iter = TMP_Enumerable_uniq_102.$$p, block = $iter || nil, TMP_103, self = this, hash = nil; + + if ($iter) TMP_Enumerable_uniq_102.$$p = null; + + + if ($iter) TMP_Enumerable_uniq_102.$$p = null;; + hash = $hash2([], {}); + $send(self, 'each', [], (TMP_103 = function($a){var self = TMP_103.$$s || this, $post_args, args, value = nil, produced = nil, $writer = nil; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + value = $$($nesting, 'Opal').$destructure(args); + produced = (function() {if ((block !== nil)) { + return Opal.yield1(block, value); + } else { + return value + }; return nil; })(); + if ($truthy(hash['$key?'](produced))) { + return nil + } else { + + $writer = [produced, value]; + $send(hash, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + };}, TMP_103.$$s = self, TMP_103.$$arity = -1, TMP_103)); + return hash.$values(); + }, TMP_Enumerable_uniq_102.$$arity = 0); + Opal.alias(self, "to_a", "entries"); + + Opal.def(self, '$zip', TMP_Enumerable_zip_104 = function $$zip($a) { + var $iter = TMP_Enumerable_zip_104.$$p, block = $iter || nil, $post_args, others, self = this; + + if ($iter) TMP_Enumerable_zip_104.$$p = null; + + + if ($iter) TMP_Enumerable_zip_104.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + others = $post_args;; + return $send(self.$to_a(), 'zip', Opal.to_a(others)); + }, TMP_Enumerable_zip_104.$$arity = -1); + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/enumerator"] = function(Opal) { + function $rb_plus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); + } + function $rb_lt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $truthy = Opal.truthy, $send = Opal.send, $falsy = Opal.falsy; + + Opal.add_stubs(['$require', '$include', '$allocate', '$new', '$to_proc', '$coerce_to', '$nil?', '$empty?', '$+', '$class', '$__send__', '$===', '$call', '$enum_for', '$size', '$destructure', '$inspect', '$any?', '$[]', '$raise', '$yield', '$each', '$enumerator_size', '$respond_to?', '$try_convert', '$<', '$for']); + + self.$require("corelib/enumerable"); + return (function($base, $super, $parent_nesting) { + function $Enumerator(){}; + var self = $Enumerator = $klass($base, $super, 'Enumerator', $Enumerator); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Enumerator_for_1, TMP_Enumerator_initialize_2, TMP_Enumerator_each_3, TMP_Enumerator_size_4, TMP_Enumerator_with_index_5, TMP_Enumerator_inspect_7; + + def.size = def.args = def.object = def.method = nil; + + self.$include($$($nesting, 'Enumerable')); + def.$$is_enumerator = true; + Opal.defs(self, '$for', TMP_Enumerator_for_1 = function(object, $a, $b) { + var $iter = TMP_Enumerator_for_1.$$p, block = $iter || nil, $post_args, method, args, self = this; + + if ($iter) TMP_Enumerator_for_1.$$p = null; + + + if ($iter) TMP_Enumerator_for_1.$$p = null;; + + $post_args = Opal.slice.call(arguments, 1, arguments.length); + + if ($post_args.length > 0) { + method = $post_args[0]; + $post_args.splice(0, 1); + } + if (method == null) { + method = "each"; + }; + + args = $post_args;; + + var obj = self.$allocate(); + + obj.object = object; + obj.size = block; + obj.method = method; + obj.args = args; + + return obj; + ; + }, TMP_Enumerator_for_1.$$arity = -2); + + Opal.def(self, '$initialize', TMP_Enumerator_initialize_2 = function $$initialize($a) { + var $iter = TMP_Enumerator_initialize_2.$$p, block = $iter || nil, $post_args, self = this; + + if ($iter) TMP_Enumerator_initialize_2.$$p = null; + + + if ($iter) TMP_Enumerator_initialize_2.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + if ($truthy(block)) { + + self.object = $send($$($nesting, 'Generator'), 'new', [], block.$to_proc()); + self.method = "each"; + self.args = []; + self.size = arguments[0] || nil; + if ($truthy(self.size)) { + return (self.size = $$($nesting, 'Opal').$coerce_to(self.size, $$($nesting, 'Integer'), "to_int")) + } else { + return nil + }; + } else { + + self.object = arguments[0]; + self.method = arguments[1] || "each"; + self.args = $slice.call(arguments, 2); + return (self.size = nil); + }; + }, TMP_Enumerator_initialize_2.$$arity = -1); + + Opal.def(self, '$each', TMP_Enumerator_each_3 = function $$each($a) { + var $iter = TMP_Enumerator_each_3.$$p, block = $iter || nil, $post_args, args, $b, self = this; + + if ($iter) TMP_Enumerator_each_3.$$p = null; + + + if ($iter) TMP_Enumerator_each_3.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + if ($truthy(($truthy($b = block['$nil?']()) ? args['$empty?']() : $b))) { + return self}; + args = $rb_plus(self.args, args); + if ($truthy(block['$nil?']())) { + return $send(self.$class(), 'new', [self.object, self.method].concat(Opal.to_a(args)))}; + return $send(self.object, '__send__', [self.method].concat(Opal.to_a(args)), block.$to_proc()); + }, TMP_Enumerator_each_3.$$arity = -1); + + Opal.def(self, '$size', TMP_Enumerator_size_4 = function $$size() { + var self = this; + + if ($truthy($$($nesting, 'Proc')['$==='](self.size))) { + return $send(self.size, 'call', Opal.to_a(self.args)) + } else { + return self.size + } + }, TMP_Enumerator_size_4.$$arity = 0); + + Opal.def(self, '$with_index', TMP_Enumerator_with_index_5 = function $$with_index(offset) { + var $iter = TMP_Enumerator_with_index_5.$$p, block = $iter || nil, TMP_6, self = this; + + if ($iter) TMP_Enumerator_with_index_5.$$p = null; + + + if ($iter) TMP_Enumerator_with_index_5.$$p = null;; + + if (offset == null) { + offset = 0; + }; + offset = (function() {if ($truthy(offset)) { + return $$($nesting, 'Opal').$coerce_to(offset, $$($nesting, 'Integer'), "to_int") + } else { + return 0 + }; return nil; })(); + if ($truthy(block)) { + } else { + return $send(self, 'enum_for', ["with_index", offset], (TMP_6 = function(){var self = TMP_6.$$s || this; + + return self.$size()}, TMP_6.$$s = self, TMP_6.$$arity = 0, TMP_6)) + }; + + var result, index = offset; + + self.$each.$$p = function() { + var param = $$($nesting, 'Opal').$destructure(arguments), + value = block(param, index); + + index++; + + return value; + } + + return self.$each(); + ; + }, TMP_Enumerator_with_index_5.$$arity = -1); + Opal.alias(self, "with_object", "each_with_object"); + + Opal.def(self, '$inspect', TMP_Enumerator_inspect_7 = function $$inspect() { + var self = this, result = nil; + + + result = "" + "#<" + (self.$class()) + ": " + (self.object.$inspect()) + ":" + (self.method); + if ($truthy(self.args['$any?']())) { + result = $rb_plus(result, "" + "(" + (self.args.$inspect()['$[]']($$($nesting, 'Range').$new(1, -2))) + ")")}; + return $rb_plus(result, ">"); + }, TMP_Enumerator_inspect_7.$$arity = 0); + (function($base, $super, $parent_nesting) { + function $Generator(){}; + var self = $Generator = $klass($base, $super, 'Generator', $Generator); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Generator_initialize_8, TMP_Generator_each_9; + + def.block = nil; + + self.$include($$($nesting, 'Enumerable')); + + Opal.def(self, '$initialize', TMP_Generator_initialize_8 = function $$initialize() { + var $iter = TMP_Generator_initialize_8.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Generator_initialize_8.$$p = null; + + + if ($iter) TMP_Generator_initialize_8.$$p = null;; + if ($truthy(block)) { + } else { + self.$raise($$($nesting, 'LocalJumpError'), "no block given") + }; + return (self.block = block); + }, TMP_Generator_initialize_8.$$arity = 0); + return (Opal.def(self, '$each', TMP_Generator_each_9 = function $$each($a) { + var $iter = TMP_Generator_each_9.$$p, block = $iter || nil, $post_args, args, self = this, yielder = nil; + + if ($iter) TMP_Generator_each_9.$$p = null; + + + if ($iter) TMP_Generator_each_9.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + yielder = $send($$($nesting, 'Yielder'), 'new', [], block.$to_proc()); + + try { + args.unshift(yielder); + + Opal.yieldX(self.block, args); + } + catch (e) { + if (e === $breaker) { + return $breaker.$v; + } + else { + throw e; + } + } + ; + return self; + }, TMP_Generator_each_9.$$arity = -1), nil) && 'each'; + })($nesting[0], null, $nesting); + (function($base, $super, $parent_nesting) { + function $Yielder(){}; + var self = $Yielder = $klass($base, $super, 'Yielder', $Yielder); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Yielder_initialize_10, TMP_Yielder_yield_11, TMP_Yielder_$lt$lt_12; + + def.block = nil; + + + Opal.def(self, '$initialize', TMP_Yielder_initialize_10 = function $$initialize() { + var $iter = TMP_Yielder_initialize_10.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Yielder_initialize_10.$$p = null; + + + if ($iter) TMP_Yielder_initialize_10.$$p = null;; + return (self.block = block); + }, TMP_Yielder_initialize_10.$$arity = 0); + + Opal.def(self, '$yield', TMP_Yielder_yield_11 = function($a) { + var $post_args, values, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + values = $post_args;; + + var value = Opal.yieldX(self.block, values); + + if (value === $breaker) { + throw $breaker; + } + + return value; + ; + }, TMP_Yielder_yield_11.$$arity = -1); + return (Opal.def(self, '$<<', TMP_Yielder_$lt$lt_12 = function($a) { + var $post_args, values, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + values = $post_args;; + $send(self, 'yield', Opal.to_a(values)); + return self; + }, TMP_Yielder_$lt$lt_12.$$arity = -1), nil) && '<<'; + })($nesting[0], null, $nesting); + return (function($base, $super, $parent_nesting) { + function $Lazy(){}; + var self = $Lazy = $klass($base, $super, 'Lazy', $Lazy); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Lazy_initialize_13, TMP_Lazy_lazy_16, TMP_Lazy_collect_17, TMP_Lazy_collect_concat_19, TMP_Lazy_drop_23, TMP_Lazy_drop_while_25, TMP_Lazy_enum_for_27, TMP_Lazy_find_all_28, TMP_Lazy_grep_30, TMP_Lazy_reject_33, TMP_Lazy_take_35, TMP_Lazy_take_while_37, TMP_Lazy_inspect_39; + + def.enumerator = nil; + + (function($base, $super, $parent_nesting) { + function $StopLazyError(){}; + var self = $StopLazyError = $klass($base, $super, 'StopLazyError', $StopLazyError); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return nil + })($nesting[0], $$($nesting, 'Exception'), $nesting); + + Opal.def(self, '$initialize', TMP_Lazy_initialize_13 = function $$initialize(object, size) { + var $iter = TMP_Lazy_initialize_13.$$p, block = $iter || nil, TMP_14, self = this; + + if ($iter) TMP_Lazy_initialize_13.$$p = null; + + + if ($iter) TMP_Lazy_initialize_13.$$p = null;; + + if (size == null) { + size = nil; + }; + if ((block !== nil)) { + } else { + self.$raise($$($nesting, 'ArgumentError'), "tried to call lazy new without a block") + }; + self.enumerator = object; + return $send(self, Opal.find_super_dispatcher(self, 'initialize', TMP_Lazy_initialize_13, false), [size], (TMP_14 = function(yielder, $a){var self = TMP_14.$$s || this, $post_args, each_args, TMP_15; + + + + if (yielder == null) { + yielder = nil; + }; + + $post_args = Opal.slice.call(arguments, 1, arguments.length); + + each_args = $post_args;; + try { + return $send(object, 'each', Opal.to_a(each_args), (TMP_15 = function($b){var self = TMP_15.$$s || this, $post_args, args; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + + args.unshift(yielder); + + Opal.yieldX(block, args); + ;}, TMP_15.$$s = self, TMP_15.$$arity = -1, TMP_15)) + } catch ($err) { + if (Opal.rescue($err, [$$($nesting, 'Exception')])) { + try { + return nil + } finally { Opal.pop_exception() } + } else { throw $err; } + };}, TMP_14.$$s = self, TMP_14.$$arity = -2, TMP_14)); + }, TMP_Lazy_initialize_13.$$arity = -2); + Opal.alias(self, "force", "to_a"); + + Opal.def(self, '$lazy', TMP_Lazy_lazy_16 = function $$lazy() { + var self = this; + + return self + }, TMP_Lazy_lazy_16.$$arity = 0); + + Opal.def(self, '$collect', TMP_Lazy_collect_17 = function $$collect() { + var $iter = TMP_Lazy_collect_17.$$p, block = $iter || nil, TMP_18, self = this; + + if ($iter) TMP_Lazy_collect_17.$$p = null; + + + if ($iter) TMP_Lazy_collect_17.$$p = null;; + if ($truthy(block)) { + } else { + self.$raise($$($nesting, 'ArgumentError'), "tried to call lazy map without a block") + }; + return $send($$($nesting, 'Lazy'), 'new', [self, self.$enumerator_size()], (TMP_18 = function(enum$, $a){var self = TMP_18.$$s || this, $post_args, args; + + + + if (enum$ == null) { + enum$ = nil; + }; + + $post_args = Opal.slice.call(arguments, 1, arguments.length); + + args = $post_args;; + + var value = Opal.yieldX(block, args); + + enum$.$yield(value); + ;}, TMP_18.$$s = self, TMP_18.$$arity = -2, TMP_18)); + }, TMP_Lazy_collect_17.$$arity = 0); + + Opal.def(self, '$collect_concat', TMP_Lazy_collect_concat_19 = function $$collect_concat() { + var $iter = TMP_Lazy_collect_concat_19.$$p, block = $iter || nil, TMP_20, self = this; + + if ($iter) TMP_Lazy_collect_concat_19.$$p = null; + + + if ($iter) TMP_Lazy_collect_concat_19.$$p = null;; + if ($truthy(block)) { + } else { + self.$raise($$($nesting, 'ArgumentError'), "tried to call lazy map without a block") + }; + return $send($$($nesting, 'Lazy'), 'new', [self, nil], (TMP_20 = function(enum$, $a){var self = TMP_20.$$s || this, $post_args, args, TMP_21, TMP_22; + + + + if (enum$ == null) { + enum$ = nil; + }; + + $post_args = Opal.slice.call(arguments, 1, arguments.length); + + args = $post_args;; + + var value = Opal.yieldX(block, args); + + if ((value)['$respond_to?']("force") && (value)['$respond_to?']("each")) { + $send((value), 'each', [], (TMP_21 = function(v){var self = TMP_21.$$s || this; + + + + if (v == null) { + v = nil; + }; + return enum$.$yield(v);}, TMP_21.$$s = self, TMP_21.$$arity = 1, TMP_21)) + } + else { + var array = $$($nesting, 'Opal').$try_convert(value, $$($nesting, 'Array'), "to_ary"); + + if (array === nil) { + enum$.$yield(value); + } + else { + $send((value), 'each', [], (TMP_22 = function(v){var self = TMP_22.$$s || this; + + + + if (v == null) { + v = nil; + }; + return enum$.$yield(v);}, TMP_22.$$s = self, TMP_22.$$arity = 1, TMP_22)); + } + } + ;}, TMP_20.$$s = self, TMP_20.$$arity = -2, TMP_20)); + }, TMP_Lazy_collect_concat_19.$$arity = 0); + + Opal.def(self, '$drop', TMP_Lazy_drop_23 = function $$drop(n) { + var TMP_24, self = this, current_size = nil, set_size = nil, dropped = nil; + + + n = $$($nesting, 'Opal').$coerce_to(n, $$($nesting, 'Integer'), "to_int"); + if ($truthy($rb_lt(n, 0))) { + self.$raise($$($nesting, 'ArgumentError'), "attempt to drop negative size")}; + current_size = self.$enumerator_size(); + set_size = (function() {if ($truthy($$($nesting, 'Integer')['$==='](current_size))) { + if ($truthy($rb_lt(n, current_size))) { + return n + } else { + return current_size + } + } else { + return current_size + }; return nil; })(); + dropped = 0; + return $send($$($nesting, 'Lazy'), 'new', [self, set_size], (TMP_24 = function(enum$, $a){var self = TMP_24.$$s || this, $post_args, args; + + + + if (enum$ == null) { + enum$ = nil; + }; + + $post_args = Opal.slice.call(arguments, 1, arguments.length); + + args = $post_args;; + if ($truthy($rb_lt(dropped, n))) { + return (dropped = $rb_plus(dropped, 1)) + } else { + return $send(enum$, 'yield', Opal.to_a(args)) + };}, TMP_24.$$s = self, TMP_24.$$arity = -2, TMP_24)); + }, TMP_Lazy_drop_23.$$arity = 1); + + Opal.def(self, '$drop_while', TMP_Lazy_drop_while_25 = function $$drop_while() { + var $iter = TMP_Lazy_drop_while_25.$$p, block = $iter || nil, TMP_26, self = this, succeeding = nil; + + if ($iter) TMP_Lazy_drop_while_25.$$p = null; + + + if ($iter) TMP_Lazy_drop_while_25.$$p = null;; + if ($truthy(block)) { + } else { + self.$raise($$($nesting, 'ArgumentError'), "tried to call lazy drop_while without a block") + }; + succeeding = true; + return $send($$($nesting, 'Lazy'), 'new', [self, nil], (TMP_26 = function(enum$, $a){var self = TMP_26.$$s || this, $post_args, args; + + + + if (enum$ == null) { + enum$ = nil; + }; + + $post_args = Opal.slice.call(arguments, 1, arguments.length); + + args = $post_args;; + if ($truthy(succeeding)) { + + var value = Opal.yieldX(block, args); + + if ($falsy(value)) { + succeeding = false; + + $send(enum$, 'yield', Opal.to_a(args)); + } + + } else { + return $send(enum$, 'yield', Opal.to_a(args)) + };}, TMP_26.$$s = self, TMP_26.$$arity = -2, TMP_26)); + }, TMP_Lazy_drop_while_25.$$arity = 0); + + Opal.def(self, '$enum_for', TMP_Lazy_enum_for_27 = function $$enum_for($a, $b) { + var $iter = TMP_Lazy_enum_for_27.$$p, block = $iter || nil, $post_args, method, args, self = this; + + if ($iter) TMP_Lazy_enum_for_27.$$p = null; + + + if ($iter) TMP_Lazy_enum_for_27.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + if ($post_args.length > 0) { + method = $post_args[0]; + $post_args.splice(0, 1); + } + if (method == null) { + method = "each"; + }; + + args = $post_args;; + return $send(self.$class(), 'for', [self, method].concat(Opal.to_a(args)), block.$to_proc()); + }, TMP_Lazy_enum_for_27.$$arity = -1); + + Opal.def(self, '$find_all', TMP_Lazy_find_all_28 = function $$find_all() { + var $iter = TMP_Lazy_find_all_28.$$p, block = $iter || nil, TMP_29, self = this; + + if ($iter) TMP_Lazy_find_all_28.$$p = null; + + + if ($iter) TMP_Lazy_find_all_28.$$p = null;; + if ($truthy(block)) { + } else { + self.$raise($$($nesting, 'ArgumentError'), "tried to call lazy select without a block") + }; + return $send($$($nesting, 'Lazy'), 'new', [self, nil], (TMP_29 = function(enum$, $a){var self = TMP_29.$$s || this, $post_args, args; + + + + if (enum$ == null) { + enum$ = nil; + }; + + $post_args = Opal.slice.call(arguments, 1, arguments.length); + + args = $post_args;; + + var value = Opal.yieldX(block, args); + + if ($truthy(value)) { + $send(enum$, 'yield', Opal.to_a(args)); + } + ;}, TMP_29.$$s = self, TMP_29.$$arity = -2, TMP_29)); + }, TMP_Lazy_find_all_28.$$arity = 0); + Opal.alias(self, "flat_map", "collect_concat"); + + Opal.def(self, '$grep', TMP_Lazy_grep_30 = function $$grep(pattern) { + var $iter = TMP_Lazy_grep_30.$$p, block = $iter || nil, TMP_31, TMP_32, self = this; + + if ($iter) TMP_Lazy_grep_30.$$p = null; + + + if ($iter) TMP_Lazy_grep_30.$$p = null;; + if ($truthy(block)) { + return $send($$($nesting, 'Lazy'), 'new', [self, nil], (TMP_31 = function(enum$, $a){var self = TMP_31.$$s || this, $post_args, args; + + + + if (enum$ == null) { + enum$ = nil; + }; + + $post_args = Opal.slice.call(arguments, 1, arguments.length); + + args = $post_args;; + + var param = $$($nesting, 'Opal').$destructure(args), + value = pattern['$==='](param); + + if ($truthy(value)) { + value = Opal.yield1(block, param); + + enum$.$yield(Opal.yield1(block, param)); + } + ;}, TMP_31.$$s = self, TMP_31.$$arity = -2, TMP_31)) + } else { + return $send($$($nesting, 'Lazy'), 'new', [self, nil], (TMP_32 = function(enum$, $a){var self = TMP_32.$$s || this, $post_args, args; + + + + if (enum$ == null) { + enum$ = nil; + }; + + $post_args = Opal.slice.call(arguments, 1, arguments.length); + + args = $post_args;; + + var param = $$($nesting, 'Opal').$destructure(args), + value = pattern['$==='](param); + + if ($truthy(value)) { + enum$.$yield(param); + } + ;}, TMP_32.$$s = self, TMP_32.$$arity = -2, TMP_32)) + }; + }, TMP_Lazy_grep_30.$$arity = 1); + Opal.alias(self, "map", "collect"); + Opal.alias(self, "select", "find_all"); + + Opal.def(self, '$reject', TMP_Lazy_reject_33 = function $$reject() { + var $iter = TMP_Lazy_reject_33.$$p, block = $iter || nil, TMP_34, self = this; + + if ($iter) TMP_Lazy_reject_33.$$p = null; + + + if ($iter) TMP_Lazy_reject_33.$$p = null;; + if ($truthy(block)) { + } else { + self.$raise($$($nesting, 'ArgumentError'), "tried to call lazy reject without a block") + }; + return $send($$($nesting, 'Lazy'), 'new', [self, nil], (TMP_34 = function(enum$, $a){var self = TMP_34.$$s || this, $post_args, args; + + + + if (enum$ == null) { + enum$ = nil; + }; + + $post_args = Opal.slice.call(arguments, 1, arguments.length); + + args = $post_args;; + + var value = Opal.yieldX(block, args); + + if ($falsy(value)) { + $send(enum$, 'yield', Opal.to_a(args)); + } + ;}, TMP_34.$$s = self, TMP_34.$$arity = -2, TMP_34)); + }, TMP_Lazy_reject_33.$$arity = 0); + + Opal.def(self, '$take', TMP_Lazy_take_35 = function $$take(n) { + var TMP_36, self = this, current_size = nil, set_size = nil, taken = nil; + + + n = $$($nesting, 'Opal').$coerce_to(n, $$($nesting, 'Integer'), "to_int"); + if ($truthy($rb_lt(n, 0))) { + self.$raise($$($nesting, 'ArgumentError'), "attempt to take negative size")}; + current_size = self.$enumerator_size(); + set_size = (function() {if ($truthy($$($nesting, 'Integer')['$==='](current_size))) { + if ($truthy($rb_lt(n, current_size))) { + return n + } else { + return current_size + } + } else { + return current_size + }; return nil; })(); + taken = 0; + return $send($$($nesting, 'Lazy'), 'new', [self, set_size], (TMP_36 = function(enum$, $a){var self = TMP_36.$$s || this, $post_args, args; + + + + if (enum$ == null) { + enum$ = nil; + }; + + $post_args = Opal.slice.call(arguments, 1, arguments.length); + + args = $post_args;; + if ($truthy($rb_lt(taken, n))) { + + $send(enum$, 'yield', Opal.to_a(args)); + return (taken = $rb_plus(taken, 1)); + } else { + return self.$raise($$($nesting, 'StopLazyError')) + };}, TMP_36.$$s = self, TMP_36.$$arity = -2, TMP_36)); + }, TMP_Lazy_take_35.$$arity = 1); + + Opal.def(self, '$take_while', TMP_Lazy_take_while_37 = function $$take_while() { + var $iter = TMP_Lazy_take_while_37.$$p, block = $iter || nil, TMP_38, self = this; + + if ($iter) TMP_Lazy_take_while_37.$$p = null; + + + if ($iter) TMP_Lazy_take_while_37.$$p = null;; + if ($truthy(block)) { + } else { + self.$raise($$($nesting, 'ArgumentError'), "tried to call lazy take_while without a block") + }; + return $send($$($nesting, 'Lazy'), 'new', [self, nil], (TMP_38 = function(enum$, $a){var self = TMP_38.$$s || this, $post_args, args; + + + + if (enum$ == null) { + enum$ = nil; + }; + + $post_args = Opal.slice.call(arguments, 1, arguments.length); + + args = $post_args;; + + var value = Opal.yieldX(block, args); + + if ($truthy(value)) { + $send(enum$, 'yield', Opal.to_a(args)); + } + else { + self.$raise($$($nesting, 'StopLazyError')); + } + ;}, TMP_38.$$s = self, TMP_38.$$arity = -2, TMP_38)); + }, TMP_Lazy_take_while_37.$$arity = 0); + Opal.alias(self, "to_enum", "enum_for"); + return (Opal.def(self, '$inspect', TMP_Lazy_inspect_39 = function $$inspect() { + var self = this; + + return "" + "#<" + (self.$class()) + ": " + (self.enumerator.$inspect()) + ">" + }, TMP_Lazy_inspect_39.$$arity = 0), nil) && 'inspect'; + })($nesting[0], self, $nesting); + })($nesting[0], null, $nesting); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/numeric"] = function(Opal) { + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + function $rb_times(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs * rhs : lhs['$*'](rhs); + } + function $rb_lt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); + } + function $rb_divide(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs / rhs : lhs['$/'](rhs); + } + function $rb_gt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $truthy = Opal.truthy, $hash2 = Opal.hash2; + + Opal.add_stubs(['$require', '$include', '$instance_of?', '$class', '$Float', '$respond_to?', '$coerce', '$__send__', '$===', '$raise', '$equal?', '$-', '$*', '$div', '$<', '$-@', '$ceil', '$to_f', '$denominator', '$to_r', '$==', '$floor', '$/', '$%', '$Complex', '$zero?', '$numerator', '$abs', '$arg', '$coerce_to!', '$round', '$to_i', '$truncate', '$>']); + + self.$require("corelib/comparable"); + return (function($base, $super, $parent_nesting) { + function $Numeric(){}; + var self = $Numeric = $klass($base, $super, 'Numeric', $Numeric); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Numeric_coerce_1, TMP_Numeric___coerced___2, TMP_Numeric_$lt$eq$gt_3, TMP_Numeric_$$_4, TMP_Numeric_$$_5, TMP_Numeric_$_6, TMP_Numeric_abs_7, TMP_Numeric_abs2_8, TMP_Numeric_angle_9, TMP_Numeric_ceil_10, TMP_Numeric_conj_11, TMP_Numeric_denominator_12, TMP_Numeric_div_13, TMP_Numeric_divmod_14, TMP_Numeric_fdiv_15, TMP_Numeric_floor_16, TMP_Numeric_i_17, TMP_Numeric_imag_18, TMP_Numeric_integer$q_19, TMP_Numeric_nonzero$q_20, TMP_Numeric_numerator_21, TMP_Numeric_polar_22, TMP_Numeric_quo_23, TMP_Numeric_real_24, TMP_Numeric_real$q_25, TMP_Numeric_rect_26, TMP_Numeric_round_27, TMP_Numeric_to_c_28, TMP_Numeric_to_int_29, TMP_Numeric_truncate_30, TMP_Numeric_zero$q_31, TMP_Numeric_positive$q_32, TMP_Numeric_negative$q_33, TMP_Numeric_dup_34, TMP_Numeric_clone_35, TMP_Numeric_finite$q_36, TMP_Numeric_infinite$q_37; + + + self.$include($$($nesting, 'Comparable')); + + Opal.def(self, '$coerce', TMP_Numeric_coerce_1 = function $$coerce(other) { + var self = this; + + + if ($truthy(other['$instance_of?'](self.$class()))) { + return [other, self]}; + return [self.$Float(other), self.$Float(self)]; + }, TMP_Numeric_coerce_1.$$arity = 1); + + Opal.def(self, '$__coerced__', TMP_Numeric___coerced___2 = function $$__coerced__(method, other) { + var $a, $b, self = this, a = nil, b = nil, $case = nil; + + if ($truthy(other['$respond_to?']("coerce"))) { + + $b = other.$coerce(self), $a = Opal.to_ary($b), (a = ($a[0] == null ? nil : $a[0])), (b = ($a[1] == null ? nil : $a[1])), $b; + return a.$__send__(method, b); + } else { + return (function() {$case = method; + if ("+"['$===']($case) || "-"['$===']($case) || "*"['$===']($case) || "/"['$===']($case) || "%"['$===']($case) || "&"['$===']($case) || "|"['$===']($case) || "^"['$===']($case) || "**"['$===']($case)) {return self.$raise($$($nesting, 'TypeError'), "" + (other.$class()) + " can't be coerced into Numeric")} + else if (">"['$===']($case) || ">="['$===']($case) || "<"['$===']($case) || "<="['$===']($case) || "<=>"['$===']($case)) {return self.$raise($$($nesting, 'ArgumentError'), "" + "comparison of " + (self.$class()) + " with " + (other.$class()) + " failed")} + else { return nil }})() + } + }, TMP_Numeric___coerced___2.$$arity = 2); + + Opal.def(self, '$<=>', TMP_Numeric_$lt$eq$gt_3 = function(other) { + var self = this; + + + if ($truthy(self['$equal?'](other))) { + return 0}; + return nil; + }, TMP_Numeric_$lt$eq$gt_3.$$arity = 1); + + Opal.def(self, '$+@', TMP_Numeric_$$_4 = function() { + var self = this; + + return self + }, TMP_Numeric_$$_4.$$arity = 0); + + Opal.def(self, '$-@', TMP_Numeric_$$_5 = function() { + var self = this; + + return $rb_minus(0, self) + }, TMP_Numeric_$$_5.$$arity = 0); + + Opal.def(self, '$%', TMP_Numeric_$_6 = function(other) { + var self = this; + + return $rb_minus(self, $rb_times(other, self.$div(other))) + }, TMP_Numeric_$_6.$$arity = 1); + + Opal.def(self, '$abs', TMP_Numeric_abs_7 = function $$abs() { + var self = this; + + if ($rb_lt(self, 0)) { + return self['$-@']() + } else { + return self + } + }, TMP_Numeric_abs_7.$$arity = 0); + + Opal.def(self, '$abs2', TMP_Numeric_abs2_8 = function $$abs2() { + var self = this; + + return $rb_times(self, self) + }, TMP_Numeric_abs2_8.$$arity = 0); + + Opal.def(self, '$angle', TMP_Numeric_angle_9 = function $$angle() { + var self = this; + + if ($rb_lt(self, 0)) { + return $$$($$($nesting, 'Math'), 'PI') + } else { + return 0 + } + }, TMP_Numeric_angle_9.$$arity = 0); + Opal.alias(self, "arg", "angle"); + + Opal.def(self, '$ceil', TMP_Numeric_ceil_10 = function $$ceil(ndigits) { + var self = this; + + + + if (ndigits == null) { + ndigits = 0; + }; + return self.$to_f().$ceil(ndigits); + }, TMP_Numeric_ceil_10.$$arity = -1); + + Opal.def(self, '$conj', TMP_Numeric_conj_11 = function $$conj() { + var self = this; + + return self + }, TMP_Numeric_conj_11.$$arity = 0); + Opal.alias(self, "conjugate", "conj"); + + Opal.def(self, '$denominator', TMP_Numeric_denominator_12 = function $$denominator() { + var self = this; + + return self.$to_r().$denominator() + }, TMP_Numeric_denominator_12.$$arity = 0); + + Opal.def(self, '$div', TMP_Numeric_div_13 = function $$div(other) { + var self = this; + + + if (other['$=='](0)) { + self.$raise($$($nesting, 'ZeroDivisionError'), "divided by o")}; + return $rb_divide(self, other).$floor(); + }, TMP_Numeric_div_13.$$arity = 1); + + Opal.def(self, '$divmod', TMP_Numeric_divmod_14 = function $$divmod(other) { + var self = this; + + return [self.$div(other), self['$%'](other)] + }, TMP_Numeric_divmod_14.$$arity = 1); + + Opal.def(self, '$fdiv', TMP_Numeric_fdiv_15 = function $$fdiv(other) { + var self = this; + + return $rb_divide(self.$to_f(), other) + }, TMP_Numeric_fdiv_15.$$arity = 1); + + Opal.def(self, '$floor', TMP_Numeric_floor_16 = function $$floor(ndigits) { + var self = this; + + + + if (ndigits == null) { + ndigits = 0; + }; + return self.$to_f().$floor(ndigits); + }, TMP_Numeric_floor_16.$$arity = -1); + + Opal.def(self, '$i', TMP_Numeric_i_17 = function $$i() { + var self = this; + + return self.$Complex(0, self) + }, TMP_Numeric_i_17.$$arity = 0); + + Opal.def(self, '$imag', TMP_Numeric_imag_18 = function $$imag() { + var self = this; + + return 0 + }, TMP_Numeric_imag_18.$$arity = 0); + Opal.alias(self, "imaginary", "imag"); + + Opal.def(self, '$integer?', TMP_Numeric_integer$q_19 = function() { + var self = this; + + return false + }, TMP_Numeric_integer$q_19.$$arity = 0); + Opal.alias(self, "magnitude", "abs"); + Opal.alias(self, "modulo", "%"); + + Opal.def(self, '$nonzero?', TMP_Numeric_nonzero$q_20 = function() { + var self = this; + + if ($truthy(self['$zero?']())) { + return nil + } else { + return self + } + }, TMP_Numeric_nonzero$q_20.$$arity = 0); + + Opal.def(self, '$numerator', TMP_Numeric_numerator_21 = function $$numerator() { + var self = this; + + return self.$to_r().$numerator() + }, TMP_Numeric_numerator_21.$$arity = 0); + Opal.alias(self, "phase", "arg"); + + Opal.def(self, '$polar', TMP_Numeric_polar_22 = function $$polar() { + var self = this; + + return [self.$abs(), self.$arg()] + }, TMP_Numeric_polar_22.$$arity = 0); + + Opal.def(self, '$quo', TMP_Numeric_quo_23 = function $$quo(other) { + var self = this; + + return $rb_divide($$($nesting, 'Opal')['$coerce_to!'](self, $$($nesting, 'Rational'), "to_r"), other) + }, TMP_Numeric_quo_23.$$arity = 1); + + Opal.def(self, '$real', TMP_Numeric_real_24 = function $$real() { + var self = this; + + return self + }, TMP_Numeric_real_24.$$arity = 0); + + Opal.def(self, '$real?', TMP_Numeric_real$q_25 = function() { + var self = this; + + return true + }, TMP_Numeric_real$q_25.$$arity = 0); + + Opal.def(self, '$rect', TMP_Numeric_rect_26 = function $$rect() { + var self = this; + + return [self, 0] + }, TMP_Numeric_rect_26.$$arity = 0); + Opal.alias(self, "rectangular", "rect"); + + Opal.def(self, '$round', TMP_Numeric_round_27 = function $$round(digits) { + var self = this; + + + ; + return self.$to_f().$round(digits); + }, TMP_Numeric_round_27.$$arity = -1); + + Opal.def(self, '$to_c', TMP_Numeric_to_c_28 = function $$to_c() { + var self = this; + + return self.$Complex(self, 0) + }, TMP_Numeric_to_c_28.$$arity = 0); + + Opal.def(self, '$to_int', TMP_Numeric_to_int_29 = function $$to_int() { + var self = this; + + return self.$to_i() + }, TMP_Numeric_to_int_29.$$arity = 0); + + Opal.def(self, '$truncate', TMP_Numeric_truncate_30 = function $$truncate(ndigits) { + var self = this; + + + + if (ndigits == null) { + ndigits = 0; + }; + return self.$to_f().$truncate(ndigits); + }, TMP_Numeric_truncate_30.$$arity = -1); + + Opal.def(self, '$zero?', TMP_Numeric_zero$q_31 = function() { + var self = this; + + return self['$=='](0) + }, TMP_Numeric_zero$q_31.$$arity = 0); + + Opal.def(self, '$positive?', TMP_Numeric_positive$q_32 = function() { + var self = this; + + return $rb_gt(self, 0) + }, TMP_Numeric_positive$q_32.$$arity = 0); + + Opal.def(self, '$negative?', TMP_Numeric_negative$q_33 = function() { + var self = this; + + return $rb_lt(self, 0) + }, TMP_Numeric_negative$q_33.$$arity = 0); + + Opal.def(self, '$dup', TMP_Numeric_dup_34 = function $$dup() { + var self = this; + + return self + }, TMP_Numeric_dup_34.$$arity = 0); + + Opal.def(self, '$clone', TMP_Numeric_clone_35 = function $$clone($kwargs) { + var freeze, self = this; + + + + if ($kwargs == null) { + $kwargs = $hash2([], {}); + } else if (!$kwargs.$$is_hash) { + throw Opal.ArgumentError.$new('expected kwargs'); + }; + + freeze = $kwargs.$$smap["freeze"]; + if (freeze == null) { + freeze = true + }; + return self; + }, TMP_Numeric_clone_35.$$arity = -1); + + Opal.def(self, '$finite?', TMP_Numeric_finite$q_36 = function() { + var self = this; + + return true + }, TMP_Numeric_finite$q_36.$$arity = 0); + return (Opal.def(self, '$infinite?', TMP_Numeric_infinite$q_37 = function() { + var self = this; + + return nil + }, TMP_Numeric_infinite$q_37.$$arity = 0), nil) && 'infinite?'; + })($nesting[0], null, $nesting); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/array"] = function(Opal) { + function $rb_gt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); + } + function $rb_times(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs * rhs : lhs['$*'](rhs); + } + function $rb_ge(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs >= rhs : lhs['$>='](rhs); + } + function $rb_lt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); + } + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $truthy = Opal.truthy, $hash2 = Opal.hash2, $send = Opal.send, $gvars = Opal.gvars; + + Opal.add_stubs(['$require', '$include', '$to_a', '$warn', '$raise', '$replace', '$respond_to?', '$to_ary', '$coerce_to', '$coerce_to?', '$===', '$join', '$to_str', '$class', '$hash', '$<=>', '$==', '$object_id', '$inspect', '$enum_for', '$bsearch_index', '$to_proc', '$nil?', '$coerce_to!', '$>', '$*', '$enumerator_size', '$empty?', '$size', '$map', '$equal?', '$dup', '$each', '$[]', '$dig', '$eql?', '$length', '$begin', '$end', '$exclude_end?', '$flatten', '$__id__', '$to_s', '$new', '$max', '$min', '$!', '$>=', '$**', '$delete_if', '$reverse', '$rotate', '$rand', '$at', '$keep_if', '$shuffle!', '$<', '$sort', '$sort_by', '$!=', '$times', '$[]=', '$-', '$<<', '$values', '$is_a?', '$last', '$first', '$upto', '$reject', '$pristine', '$singleton_class']); + + self.$require("corelib/enumerable"); + self.$require("corelib/numeric"); + return (function($base, $super, $parent_nesting) { + function $Array(){}; + var self = $Array = $klass($base, $super, 'Array', $Array); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Array_$$_1, TMP_Array_initialize_2, TMP_Array_try_convert_3, TMP_Array_$_4, TMP_Array_$_5, TMP_Array_$_6, TMP_Array_$_7, TMP_Array_$_8, TMP_Array_$lt$lt_9, TMP_Array_$lt$eq$gt_10, TMP_Array_$eq$eq_11, TMP_Array_$$_12, TMP_Array_$$$eq_13, TMP_Array_any$q_14, TMP_Array_assoc_15, TMP_Array_at_16, TMP_Array_bsearch_index_17, TMP_Array_bsearch_18, TMP_Array_cycle_19, TMP_Array_clear_21, TMP_Array_count_22, TMP_Array_initialize_copy_23, TMP_Array_collect_24, TMP_Array_collect$B_26, TMP_Array_combination_28, TMP_Array_repeated_combination_30, TMP_Array_compact_32, TMP_Array_compact$B_33, TMP_Array_concat_34, TMP_Array_delete_37, TMP_Array_delete_at_38, TMP_Array_delete_if_39, TMP_Array_dig_41, TMP_Array_drop_42, TMP_Array_dup_43, TMP_Array_each_44, TMP_Array_each_index_46, TMP_Array_empty$q_48, TMP_Array_eql$q_49, TMP_Array_fetch_50, TMP_Array_fill_51, TMP_Array_first_52, TMP_Array_flatten_53, TMP_Array_flatten$B_54, TMP_Array_hash_55, TMP_Array_include$q_56, TMP_Array_index_57, TMP_Array_insert_58, TMP_Array_inspect_59, TMP_Array_join_60, TMP_Array_keep_if_61, TMP_Array_last_63, TMP_Array_length_64, TMP_Array_max_65, TMP_Array_min_66, TMP_Array_permutation_67, TMP_Array_repeated_permutation_69, TMP_Array_pop_71, TMP_Array_product_72, TMP_Array_push_73, TMP_Array_rassoc_74, TMP_Array_reject_75, TMP_Array_reject$B_77, TMP_Array_replace_79, TMP_Array_reverse_80, TMP_Array_reverse$B_81, TMP_Array_reverse_each_82, TMP_Array_rindex_84, TMP_Array_rotate_85, TMP_Array_rotate$B_86, TMP_Array_sample_89, TMP_Array_select_90, TMP_Array_select$B_92, TMP_Array_shift_94, TMP_Array_shuffle_95, TMP_Array_shuffle$B_96, TMP_Array_slice$B_97, TMP_Array_sort_98, TMP_Array_sort$B_99, TMP_Array_sort_by$B_100, TMP_Array_take_102, TMP_Array_take_while_103, TMP_Array_to_a_104, TMP_Array_to_h_105, TMP_Array_transpose_106, TMP_Array_uniq_109, TMP_Array_uniq$B_110, TMP_Array_unshift_111, TMP_Array_values_at_112, TMP_Array_zip_115, TMP_Array_inherited_116, TMP_Array_instance_variables_117, TMP_Array_pack_119; + + + self.$include($$($nesting, 'Enumerable')); + Opal.defineProperty(Array.prototype, '$$is_array', true); + + function toArraySubclass(obj, klass) { + if (klass.$$name === Opal.Array) { + return obj; + } else { + return klass.$allocate().$replace((obj).$to_a()); + } + } + ; + Opal.defs(self, '$[]', TMP_Array_$$_1 = function($a) { + var $post_args, objects, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + objects = $post_args;; + return toArraySubclass(objects, self);; + }, TMP_Array_$$_1.$$arity = -1); + + Opal.def(self, '$initialize', TMP_Array_initialize_2 = function $$initialize(size, obj) { + var $iter = TMP_Array_initialize_2.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Array_initialize_2.$$p = null; + + + if ($iter) TMP_Array_initialize_2.$$p = null;; + + if (size == null) { + size = nil; + }; + + if (obj == null) { + obj = nil; + }; + + if (obj !== nil && block !== nil) { + self.$warn("warning: block supersedes default value argument") + } + + if (size > $$$($$($nesting, 'Integer'), 'MAX')) { + self.$raise($$($nesting, 'ArgumentError'), "array size too big") + } + + if (arguments.length > 2) { + self.$raise($$($nesting, 'ArgumentError'), "" + "wrong number of arguments (" + (arguments.length) + " for 0..2)") + } + + if (arguments.length === 0) { + self.splice(0, self.length); + return self; + } + + if (arguments.length === 1) { + if (size.$$is_array) { + self.$replace(size.$to_a()) + return self; + } else if (size['$respond_to?']("to_ary")) { + self.$replace(size.$to_ary()) + return self; + } + } + + size = $$($nesting, 'Opal').$coerce_to(size, $$($nesting, 'Integer'), "to_int") + + if (size < 0) { + self.$raise($$($nesting, 'ArgumentError'), "negative array size") + } + + self.splice(0, self.length); + var i, value; + + if (block === nil) { + for (i = 0; i < size; i++) { + self.push(obj); + } + } + else { + for (i = 0, value; i < size; i++) { + value = block(i); + self[i] = value; + } + } + + return self; + ; + }, TMP_Array_initialize_2.$$arity = -1); + Opal.defs(self, '$try_convert', TMP_Array_try_convert_3 = function $$try_convert(obj) { + var self = this; + + return $$($nesting, 'Opal')['$coerce_to?'](obj, $$($nesting, 'Array'), "to_ary") + }, TMP_Array_try_convert_3.$$arity = 1); + + Opal.def(self, '$&', TMP_Array_$_4 = function(other) { + var self = this; + + + other = (function() {if ($truthy($$($nesting, 'Array')['$==='](other))) { + return other.$to_a() + } else { + return $$($nesting, 'Opal').$coerce_to(other, $$($nesting, 'Array'), "to_ary").$to_a() + }; return nil; })(); + + var result = [], hash = $hash2([], {}), i, length, item; + + for (i = 0, length = other.length; i < length; i++) { + Opal.hash_put(hash, other[i], true); + } + + for (i = 0, length = self.length; i < length; i++) { + item = self[i]; + if (Opal.hash_delete(hash, item) !== undefined) { + result.push(item); + } + } + + return result; + ; + }, TMP_Array_$_4.$$arity = 1); + + Opal.def(self, '$|', TMP_Array_$_5 = function(other) { + var self = this; + + + other = (function() {if ($truthy($$($nesting, 'Array')['$==='](other))) { + return other.$to_a() + } else { + return $$($nesting, 'Opal').$coerce_to(other, $$($nesting, 'Array'), "to_ary").$to_a() + }; return nil; })(); + + var hash = $hash2([], {}), i, length, item; + + for (i = 0, length = self.length; i < length; i++) { + Opal.hash_put(hash, self[i], true); + } + + for (i = 0, length = other.length; i < length; i++) { + Opal.hash_put(hash, other[i], true); + } + + return hash.$keys(); + ; + }, TMP_Array_$_5.$$arity = 1); + + Opal.def(self, '$*', TMP_Array_$_6 = function(other) { + var self = this; + + + if ($truthy(other['$respond_to?']("to_str"))) { + return self.$join(other.$to_str())}; + other = $$($nesting, 'Opal').$coerce_to(other, $$($nesting, 'Integer'), "to_int"); + if ($truthy(other < 0)) { + self.$raise($$($nesting, 'ArgumentError'), "negative argument")}; + + var result = [], + converted = self.$to_a(); + + for (var i = 0; i < other; i++) { + result = result.concat(converted); + } + + return toArraySubclass(result, self.$class()); + ; + }, TMP_Array_$_6.$$arity = 1); + + Opal.def(self, '$+', TMP_Array_$_7 = function(other) { + var self = this; + + + other = (function() {if ($truthy($$($nesting, 'Array')['$==='](other))) { + return other.$to_a() + } else { + return $$($nesting, 'Opal').$coerce_to(other, $$($nesting, 'Array'), "to_ary").$to_a() + }; return nil; })(); + return self.concat(other);; + }, TMP_Array_$_7.$$arity = 1); + + Opal.def(self, '$-', TMP_Array_$_8 = function(other) { + var self = this; + + + other = (function() {if ($truthy($$($nesting, 'Array')['$==='](other))) { + return other.$to_a() + } else { + return $$($nesting, 'Opal').$coerce_to(other, $$($nesting, 'Array'), "to_ary").$to_a() + }; return nil; })(); + if ($truthy(self.length === 0)) { + return []}; + if ($truthy(other.length === 0)) { + return self.slice()}; + + var result = [], hash = $hash2([], {}), i, length, item; + + for (i = 0, length = other.length; i < length; i++) { + Opal.hash_put(hash, other[i], true); + } + + for (i = 0, length = self.length; i < length; i++) { + item = self[i]; + if (Opal.hash_get(hash, item) === undefined) { + result.push(item); + } + } + + return result; + ; + }, TMP_Array_$_8.$$arity = 1); + + Opal.def(self, '$<<', TMP_Array_$lt$lt_9 = function(object) { + var self = this; + + + self.push(object); + return self; + }, TMP_Array_$lt$lt_9.$$arity = 1); + + Opal.def(self, '$<=>', TMP_Array_$lt$eq$gt_10 = function(other) { + var self = this; + + + if ($truthy($$($nesting, 'Array')['$==='](other))) { + other = other.$to_a() + } else if ($truthy(other['$respond_to?']("to_ary"))) { + other = other.$to_ary().$to_a() + } else { + return nil + }; + + if (self.$hash() === other.$hash()) { + return 0; + } + + var count = Math.min(self.length, other.length); + + for (var i = 0; i < count; i++) { + var tmp = (self[i])['$<=>'](other[i]); + + if (tmp !== 0) { + return tmp; + } + } + + return (self.length)['$<=>'](other.length); + ; + }, TMP_Array_$lt$eq$gt_10.$$arity = 1); + + Opal.def(self, '$==', TMP_Array_$eq$eq_11 = function(other) { + var self = this; + + + var recursed = {}; + + function _eqeq(array, other) { + var i, length, a, b; + + if (array === other) + return true; + + if (!other.$$is_array) { + if ($$($nesting, 'Opal')['$respond_to?'](other, "to_ary")) { + return (other)['$=='](array); + } else { + return false; + } + } + + if (array.constructor !== Array) + array = (array).$to_a(); + if (other.constructor !== Array) + other = (other).$to_a(); + + if (array.length !== other.length) { + return false; + } + + recursed[(array).$object_id()] = true; + + for (i = 0, length = array.length; i < length; i++) { + a = array[i]; + b = other[i]; + if (a.$$is_array) { + if (b.$$is_array && b.length !== a.length) { + return false; + } + if (!recursed.hasOwnProperty((a).$object_id())) { + if (!_eqeq(a, b)) { + return false; + } + } + } else { + if (!(a)['$=='](b)) { + return false; + } + } + } + + return true; + } + + return _eqeq(self, other); + + }, TMP_Array_$eq$eq_11.$$arity = 1); + + function $array_slice_range(self, index) { + var size = self.length, + exclude, from, to, result; + + exclude = index.excl; + from = Opal.Opal.$coerce_to(index.begin, Opal.Integer, 'to_int'); + to = Opal.Opal.$coerce_to(index.end, Opal.Integer, 'to_int'); + + if (from < 0) { + from += size; + + if (from < 0) { + return nil; + } + } + + if (from > size) { + return nil; + } + + if (to < 0) { + to += size; + + if (to < 0) { + return []; + } + } + + if (!exclude) { + to += 1; + } + + result = self.slice(from, to); + return toArraySubclass(result, self.$class()); + } + + function $array_slice_index_length(self, index, length) { + var size = self.length, + exclude, from, to, result; + + index = Opal.Opal.$coerce_to(index, Opal.Integer, 'to_int'); + + if (index < 0) { + index += size; + + if (index < 0) { + return nil; + } + } + + if (length === undefined) { + if (index >= size || index < 0) { + return nil; + } + + return self[index]; + } + else { + length = Opal.Opal.$coerce_to(length, Opal.Integer, 'to_int'); + + if (length < 0 || index > size || index < 0) { + return nil; + } + + result = self.slice(index, index + length); + } + return toArraySubclass(result, self.$class()); + } + ; + + Opal.def(self, '$[]', TMP_Array_$$_12 = function(index, length) { + var self = this; + + + ; + + if (index.$$is_range) { + return $array_slice_range(self, index); + } + else { + return $array_slice_index_length(self, index, length); + } + ; + }, TMP_Array_$$_12.$$arity = -2); + + Opal.def(self, '$[]=', TMP_Array_$$$eq_13 = function(index, value, extra) { + var self = this, data = nil, length = nil; + + + ; + var i, size = self.length;; + if ($truthy($$($nesting, 'Range')['$==='](index))) { + + data = (function() {if ($truthy($$($nesting, 'Array')['$==='](value))) { + return value.$to_a() + } else if ($truthy(value['$respond_to?']("to_ary"))) { + return value.$to_ary().$to_a() + } else { + return [value] + }; return nil; })(); + + var exclude = index.excl, + from = $$($nesting, 'Opal').$coerce_to(index.begin, $$($nesting, 'Integer'), "to_int"), + to = $$($nesting, 'Opal').$coerce_to(index.end, $$($nesting, 'Integer'), "to_int"); + + if (from < 0) { + from += size; + + if (from < 0) { + self.$raise($$($nesting, 'RangeError'), "" + (index.$inspect()) + " out of range"); + } + } + + if (to < 0) { + to += size; + } + + if (!exclude) { + to += 1; + } + + if (from > size) { + for (i = size; i < from; i++) { + self[i] = nil; + } + } + + if (to < 0) { + self.splice.apply(self, [from, 0].concat(data)); + } + else { + self.splice.apply(self, [from, to - from].concat(data)); + } + + return value; + ; + } else { + + if ($truthy(extra === undefined)) { + length = 1 + } else { + + length = value; + value = extra; + data = (function() {if ($truthy($$($nesting, 'Array')['$==='](value))) { + return value.$to_a() + } else if ($truthy(value['$respond_to?']("to_ary"))) { + return value.$to_ary().$to_a() + } else { + return [value] + }; return nil; })(); + }; + + var old; + + index = $$($nesting, 'Opal').$coerce_to(index, $$($nesting, 'Integer'), "to_int"); + length = $$($nesting, 'Opal').$coerce_to(length, $$($nesting, 'Integer'), "to_int"); + + if (index < 0) { + old = index; + index += size; + + if (index < 0) { + self.$raise($$($nesting, 'IndexError'), "" + "index " + (old) + " too small for array; minimum " + (-self.length)); + } + } + + if (length < 0) { + self.$raise($$($nesting, 'IndexError'), "" + "negative length (" + (length) + ")") + } + + if (index > size) { + for (i = size; i < index; i++) { + self[i] = nil; + } + } + + if (extra === undefined) { + self[index] = value; + } + else { + self.splice.apply(self, [index, length].concat(data)); + } + + return value; + ; + }; + }, TMP_Array_$$$eq_13.$$arity = -3); + + Opal.def(self, '$any?', TMP_Array_any$q_14 = function(pattern) { + var $iter = TMP_Array_any$q_14.$$p, block = $iter || nil, self = this, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_Array_any$q_14.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + + + if ($iter) TMP_Array_any$q_14.$$p = null;; + ; + if (self.length === 0) return false; + return $send(self, Opal.find_super_dispatcher(self, 'any?', TMP_Array_any$q_14, false), $zuper, $iter); + }, TMP_Array_any$q_14.$$arity = -1); + + Opal.def(self, '$assoc', TMP_Array_assoc_15 = function $$assoc(object) { + var self = this; + + + for (var i = 0, length = self.length, item; i < length; i++) { + if (item = self[i], item.length && (item[0])['$=='](object)) { + return item; + } + } + + return nil; + + }, TMP_Array_assoc_15.$$arity = 1); + + Opal.def(self, '$at', TMP_Array_at_16 = function $$at(index) { + var self = this; + + + index = $$($nesting, 'Opal').$coerce_to(index, $$($nesting, 'Integer'), "to_int"); + + if (index < 0) { + index += self.length; + } + + if (index < 0 || index >= self.length) { + return nil; + } + + return self[index]; + ; + }, TMP_Array_at_16.$$arity = 1); + + Opal.def(self, '$bsearch_index', TMP_Array_bsearch_index_17 = function $$bsearch_index() { + var $iter = TMP_Array_bsearch_index_17.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Array_bsearch_index_17.$$p = null; + + + if ($iter) TMP_Array_bsearch_index_17.$$p = null;; + if ((block !== nil)) { + } else { + return self.$enum_for("bsearch_index") + }; + + var min = 0, + max = self.length, + mid, + val, + ret, + smaller = false, + satisfied = nil; + + while (min < max) { + mid = min + Math.floor((max - min) / 2); + val = self[mid]; + ret = Opal.yield1(block, val); + + if (ret === true) { + satisfied = mid; + smaller = true; + } + else if (ret === false || ret === nil) { + smaller = false; + } + else if (ret.$$is_number) { + if (ret === 0) { return mid; } + smaller = (ret < 0); + } + else { + self.$raise($$($nesting, 'TypeError'), "" + "wrong argument type " + ((ret).$class()) + " (must be numeric, true, false or nil)") + } + + if (smaller) { max = mid; } else { min = mid + 1; } + } + + return satisfied; + ; + }, TMP_Array_bsearch_index_17.$$arity = 0); + + Opal.def(self, '$bsearch', TMP_Array_bsearch_18 = function $$bsearch() { + var $iter = TMP_Array_bsearch_18.$$p, block = $iter || nil, self = this, index = nil; + + if ($iter) TMP_Array_bsearch_18.$$p = null; + + + if ($iter) TMP_Array_bsearch_18.$$p = null;; + if ((block !== nil)) { + } else { + return self.$enum_for("bsearch") + }; + index = $send(self, 'bsearch_index', [], block.$to_proc()); + + if (index != null && index.$$is_number) { + return self[index]; + } else { + return index; + } + ; + }, TMP_Array_bsearch_18.$$arity = 0); + + Opal.def(self, '$cycle', TMP_Array_cycle_19 = function $$cycle(n) { + var $iter = TMP_Array_cycle_19.$$p, block = $iter || nil, TMP_20, $a, self = this; + + if ($iter) TMP_Array_cycle_19.$$p = null; + + + if ($iter) TMP_Array_cycle_19.$$p = null;; + + if (n == null) { + n = nil; + }; + if ((block !== nil)) { + } else { + return $send(self, 'enum_for', ["cycle", n], (TMP_20 = function(){var self = TMP_20.$$s || this; + + if ($truthy(n['$nil?']())) { + return $$$($$($nesting, 'Float'), 'INFINITY') + } else { + + n = $$($nesting, 'Opal')['$coerce_to!'](n, $$($nesting, 'Integer'), "to_int"); + if ($truthy($rb_gt(n, 0))) { + return $rb_times(self.$enumerator_size(), n) + } else { + return 0 + }; + }}, TMP_20.$$s = self, TMP_20.$$arity = 0, TMP_20)) + }; + if ($truthy(($truthy($a = self['$empty?']()) ? $a : n['$=='](0)))) { + return nil}; + + var i, length, value; + + if (n === nil) { + while (true) { + for (i = 0, length = self.length; i < length; i++) { + value = Opal.yield1(block, self[i]); + } + } + } + else { + n = $$($nesting, 'Opal')['$coerce_to!'](n, $$($nesting, 'Integer'), "to_int"); + if (n <= 0) { + return self; + } + + while (n > 0) { + for (i = 0, length = self.length; i < length; i++) { + value = Opal.yield1(block, self[i]); + } + + n--; + } + } + ; + return self; + }, TMP_Array_cycle_19.$$arity = -1); + + Opal.def(self, '$clear', TMP_Array_clear_21 = function $$clear() { + var self = this; + + + self.splice(0, self.length); + return self; + }, TMP_Array_clear_21.$$arity = 0); + + Opal.def(self, '$count', TMP_Array_count_22 = function $$count(object) { + var $iter = TMP_Array_count_22.$$p, block = $iter || nil, $a, self = this, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_Array_count_22.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + + + if ($iter) TMP_Array_count_22.$$p = null;; + + if (object == null) { + object = nil; + }; + if ($truthy(($truthy($a = object) ? $a : block))) { + return $send(self, Opal.find_super_dispatcher(self, 'count', TMP_Array_count_22, false), $zuper, $iter) + } else { + return self.$size() + }; + }, TMP_Array_count_22.$$arity = -1); + + Opal.def(self, '$initialize_copy', TMP_Array_initialize_copy_23 = function $$initialize_copy(other) { + var self = this; + + return self.$replace(other) + }, TMP_Array_initialize_copy_23.$$arity = 1); + + Opal.def(self, '$collect', TMP_Array_collect_24 = function $$collect() { + var $iter = TMP_Array_collect_24.$$p, block = $iter || nil, TMP_25, self = this; + + if ($iter) TMP_Array_collect_24.$$p = null; + + + if ($iter) TMP_Array_collect_24.$$p = null;; + if ((block !== nil)) { + } else { + return $send(self, 'enum_for', ["collect"], (TMP_25 = function(){var self = TMP_25.$$s || this; + + return self.$size()}, TMP_25.$$s = self, TMP_25.$$arity = 0, TMP_25)) + }; + + var result = []; + + for (var i = 0, length = self.length; i < length; i++) { + var value = Opal.yield1(block, self[i]); + result.push(value); + } + + return result; + ; + }, TMP_Array_collect_24.$$arity = 0); + + Opal.def(self, '$collect!', TMP_Array_collect$B_26 = function() { + var $iter = TMP_Array_collect$B_26.$$p, block = $iter || nil, TMP_27, self = this; + + if ($iter) TMP_Array_collect$B_26.$$p = null; + + + if ($iter) TMP_Array_collect$B_26.$$p = null;; + if ((block !== nil)) { + } else { + return $send(self, 'enum_for', ["collect!"], (TMP_27 = function(){var self = TMP_27.$$s || this; + + return self.$size()}, TMP_27.$$s = self, TMP_27.$$arity = 0, TMP_27)) + }; + + for (var i = 0, length = self.length; i < length; i++) { + var value = Opal.yield1(block, self[i]); + self[i] = value; + } + ; + return self; + }, TMP_Array_collect$B_26.$$arity = 0); + + function binomial_coefficient(n, k) { + if (n === k || k === 0) { + return 1; + } + + if (k > 0 && n > k) { + return binomial_coefficient(n - 1, k - 1) + binomial_coefficient(n - 1, k); + } + + return 0; + } + ; + + Opal.def(self, '$combination', TMP_Array_combination_28 = function $$combination(n) { + var TMP_29, $iter = TMP_Array_combination_28.$$p, $yield = $iter || nil, self = this, num = nil; + + if ($iter) TMP_Array_combination_28.$$p = null; + + num = $$($nesting, 'Opal')['$coerce_to!'](n, $$($nesting, 'Integer'), "to_int"); + if (($yield !== nil)) { + } else { + return $send(self, 'enum_for', ["combination", num], (TMP_29 = function(){var self = TMP_29.$$s || this; + + return binomial_coefficient(self.length, num)}, TMP_29.$$s = self, TMP_29.$$arity = 0, TMP_29)) + }; + + var i, length, stack, chosen, lev, done, next; + + if (num === 0) { + Opal.yield1($yield, []) + } else if (num === 1) { + for (i = 0, length = self.length; i < length; i++) { + Opal.yield1($yield, [self[i]]) + } + } + else if (num === self.length) { + Opal.yield1($yield, self.slice()) + } + else if (num >= 0 && num < self.length) { + stack = []; + for (i = 0; i <= num + 1; i++) { + stack.push(0); + } + + chosen = []; + lev = 0; + done = false; + stack[0] = -1; + + while (!done) { + chosen[lev] = self[stack[lev+1]]; + while (lev < num - 1) { + lev++; + next = stack[lev+1] = stack[lev] + 1; + chosen[lev] = self[next]; + } + Opal.yield1($yield, chosen.slice()) + lev++; + do { + done = (lev === 0); + stack[lev]++; + lev--; + } while ( stack[lev+1] + num === self.length + lev + 1 ); + } + } + ; + return self; + }, TMP_Array_combination_28.$$arity = 1); + + Opal.def(self, '$repeated_combination', TMP_Array_repeated_combination_30 = function $$repeated_combination(n) { + var TMP_31, $iter = TMP_Array_repeated_combination_30.$$p, $yield = $iter || nil, self = this, num = nil; + + if ($iter) TMP_Array_repeated_combination_30.$$p = null; + + num = $$($nesting, 'Opal')['$coerce_to!'](n, $$($nesting, 'Integer'), "to_int"); + if (($yield !== nil)) { + } else { + return $send(self, 'enum_for', ["repeated_combination", num], (TMP_31 = function(){var self = TMP_31.$$s || this; + + return binomial_coefficient(self.length + num - 1, num);}, TMP_31.$$s = self, TMP_31.$$arity = 0, TMP_31)) + }; + + function iterate(max, from, buffer, self) { + if (buffer.length == max) { + var copy = buffer.slice(); + Opal.yield1($yield, copy) + return; + } + for (var i = from; i < self.length; i++) { + buffer.push(self[i]); + iterate(max, i, buffer, self); + buffer.pop(); + } + } + + if (num >= 0) { + iterate(num, 0, [], self); + } + ; + return self; + }, TMP_Array_repeated_combination_30.$$arity = 1); + + Opal.def(self, '$compact', TMP_Array_compact_32 = function $$compact() { + var self = this; + + + var result = []; + + for (var i = 0, length = self.length, item; i < length; i++) { + if ((item = self[i]) !== nil) { + result.push(item); + } + } + + return result; + + }, TMP_Array_compact_32.$$arity = 0); + + Opal.def(self, '$compact!', TMP_Array_compact$B_33 = function() { + var self = this; + + + var original = self.length; + + for (var i = 0, length = self.length; i < length; i++) { + if (self[i] === nil) { + self.splice(i, 1); + + length--; + i--; + } + } + + return self.length === original ? nil : self; + + }, TMP_Array_compact$B_33.$$arity = 0); + + Opal.def(self, '$concat', TMP_Array_concat_34 = function $$concat($a) { + var $post_args, others, TMP_35, TMP_36, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + others = $post_args;; + others = $send(others, 'map', [], (TMP_35 = function(other){var self = TMP_35.$$s || this; + + + + if (other == null) { + other = nil; + }; + other = (function() {if ($truthy($$($nesting, 'Array')['$==='](other))) { + return other.$to_a() + } else { + return $$($nesting, 'Opal').$coerce_to(other, $$($nesting, 'Array'), "to_ary").$to_a() + }; return nil; })(); + if ($truthy(other['$equal?'](self))) { + other = other.$dup()}; + return other;}, TMP_35.$$s = self, TMP_35.$$arity = 1, TMP_35)); + $send(others, 'each', [], (TMP_36 = function(other){var self = TMP_36.$$s || this; + + + + if (other == null) { + other = nil; + }; + + for (var i = 0, length = other.length; i < length; i++) { + self.push(other[i]); + } + ;}, TMP_36.$$s = self, TMP_36.$$arity = 1, TMP_36)); + return self; + }, TMP_Array_concat_34.$$arity = -1); + + Opal.def(self, '$delete', TMP_Array_delete_37 = function(object) { + var $iter = TMP_Array_delete_37.$$p, $yield = $iter || nil, self = this; + + if ($iter) TMP_Array_delete_37.$$p = null; + + var original = self.length; + + for (var i = 0, length = original; i < length; i++) { + if ((self[i])['$=='](object)) { + self.splice(i, 1); + + length--; + i--; + } + } + + if (self.length === original) { + if (($yield !== nil)) { + return Opal.yieldX($yield, []); + } + return nil; + } + return object; + + }, TMP_Array_delete_37.$$arity = 1); + + Opal.def(self, '$delete_at', TMP_Array_delete_at_38 = function $$delete_at(index) { + var self = this; + + + index = $$($nesting, 'Opal').$coerce_to(index, $$($nesting, 'Integer'), "to_int"); + + if (index < 0) { + index += self.length; + } + + if (index < 0 || index >= self.length) { + return nil; + } + + var result = self[index]; + + self.splice(index, 1); + + return result; + + }, TMP_Array_delete_at_38.$$arity = 1); + + Opal.def(self, '$delete_if', TMP_Array_delete_if_39 = function $$delete_if() { + var $iter = TMP_Array_delete_if_39.$$p, block = $iter || nil, TMP_40, self = this; + + if ($iter) TMP_Array_delete_if_39.$$p = null; + + + if ($iter) TMP_Array_delete_if_39.$$p = null;; + if ((block !== nil)) { + } else { + return $send(self, 'enum_for', ["delete_if"], (TMP_40 = function(){var self = TMP_40.$$s || this; + + return self.$size()}, TMP_40.$$s = self, TMP_40.$$arity = 0, TMP_40)) + }; + + for (var i = 0, length = self.length, value; i < length; i++) { + value = block(self[i]); + + if (value !== false && value !== nil) { + self.splice(i, 1); + + length--; + i--; + } + } + ; + return self; + }, TMP_Array_delete_if_39.$$arity = 0); + + Opal.def(self, '$dig', TMP_Array_dig_41 = function $$dig(idx, $a) { + var $post_args, idxs, self = this, item = nil; + + + + $post_args = Opal.slice.call(arguments, 1, arguments.length); + + idxs = $post_args;; + item = self['$[]'](idx); + + if (item === nil || idxs.length === 0) { + return item; + } + ; + if ($truthy(item['$respond_to?']("dig"))) { + } else { + self.$raise($$($nesting, 'TypeError'), "" + (item.$class()) + " does not have #dig method") + }; + return $send(item, 'dig', Opal.to_a(idxs)); + }, TMP_Array_dig_41.$$arity = -2); + + Opal.def(self, '$drop', TMP_Array_drop_42 = function $$drop(number) { + var self = this; + + + if (number < 0) { + self.$raise($$($nesting, 'ArgumentError')) + } + + return self.slice(number); + + }, TMP_Array_drop_42.$$arity = 1); + + Opal.def(self, '$dup', TMP_Array_dup_43 = function $$dup() { + var $iter = TMP_Array_dup_43.$$p, $yield = $iter || nil, self = this, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_Array_dup_43.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + + + if (self.$$class === Opal.Array && + self.$$class.$allocate.$$pristine && + self.$copy_instance_variables.$$pristine && + self.$initialize_dup.$$pristine) { + return self.slice(0); + } + ; + return $send(self, Opal.find_super_dispatcher(self, 'dup', TMP_Array_dup_43, false), $zuper, $iter); + }, TMP_Array_dup_43.$$arity = 0); + + Opal.def(self, '$each', TMP_Array_each_44 = function $$each() { + var $iter = TMP_Array_each_44.$$p, block = $iter || nil, TMP_45, self = this; + + if ($iter) TMP_Array_each_44.$$p = null; + + + if ($iter) TMP_Array_each_44.$$p = null;; + if ((block !== nil)) { + } else { + return $send(self, 'enum_for', ["each"], (TMP_45 = function(){var self = TMP_45.$$s || this; + + return self.$size()}, TMP_45.$$s = self, TMP_45.$$arity = 0, TMP_45)) + }; + + for (var i = 0, length = self.length; i < length; i++) { + var value = Opal.yield1(block, self[i]); + } + ; + return self; + }, TMP_Array_each_44.$$arity = 0); + + Opal.def(self, '$each_index', TMP_Array_each_index_46 = function $$each_index() { + var $iter = TMP_Array_each_index_46.$$p, block = $iter || nil, TMP_47, self = this; + + if ($iter) TMP_Array_each_index_46.$$p = null; + + + if ($iter) TMP_Array_each_index_46.$$p = null;; + if ((block !== nil)) { + } else { + return $send(self, 'enum_for', ["each_index"], (TMP_47 = function(){var self = TMP_47.$$s || this; + + return self.$size()}, TMP_47.$$s = self, TMP_47.$$arity = 0, TMP_47)) + }; + + for (var i = 0, length = self.length; i < length; i++) { + var value = Opal.yield1(block, i); + } + ; + return self; + }, TMP_Array_each_index_46.$$arity = 0); + + Opal.def(self, '$empty?', TMP_Array_empty$q_48 = function() { + var self = this; + + return self.length === 0; + }, TMP_Array_empty$q_48.$$arity = 0); + + Opal.def(self, '$eql?', TMP_Array_eql$q_49 = function(other) { + var self = this; + + + var recursed = {}; + + function _eql(array, other) { + var i, length, a, b; + + if (!other.$$is_array) { + return false; + } + + other = other.$to_a(); + + if (array.length !== other.length) { + return false; + } + + recursed[(array).$object_id()] = true; + + for (i = 0, length = array.length; i < length; i++) { + a = array[i]; + b = other[i]; + if (a.$$is_array) { + if (b.$$is_array && b.length !== a.length) { + return false; + } + if (!recursed.hasOwnProperty((a).$object_id())) { + if (!_eql(a, b)) { + return false; + } + } + } else { + if (!(a)['$eql?'](b)) { + return false; + } + } + } + + return true; + } + + return _eql(self, other); + + }, TMP_Array_eql$q_49.$$arity = 1); + + Opal.def(self, '$fetch', TMP_Array_fetch_50 = function $$fetch(index, defaults) { + var $iter = TMP_Array_fetch_50.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Array_fetch_50.$$p = null; + + + if ($iter) TMP_Array_fetch_50.$$p = null;; + ; + + var original = index; + + index = $$($nesting, 'Opal').$coerce_to(index, $$($nesting, 'Integer'), "to_int"); + + if (index < 0) { + index += self.length; + } + + if (index >= 0 && index < self.length) { + return self[index]; + } + + if (block !== nil && defaults != null) { + self.$warn("warning: block supersedes default value argument") + } + + if (block !== nil) { + return block(original); + } + + if (defaults != null) { + return defaults; + } + + if (self.length === 0) { + self.$raise($$($nesting, 'IndexError'), "" + "index " + (original) + " outside of array bounds: 0...0") + } + else { + self.$raise($$($nesting, 'IndexError'), "" + "index " + (original) + " outside of array bounds: -" + (self.length) + "..." + (self.length)); + } + ; + }, TMP_Array_fetch_50.$$arity = -2); + + Opal.def(self, '$fill', TMP_Array_fill_51 = function $$fill($a) { + var $iter = TMP_Array_fill_51.$$p, block = $iter || nil, $post_args, args, $b, $c, self = this, one = nil, two = nil, obj = nil, left = nil, right = nil; + + if ($iter) TMP_Array_fill_51.$$p = null; + + + if ($iter) TMP_Array_fill_51.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + var i, length, value;; + if ($truthy(block)) { + + if ($truthy(args.length > 2)) { + self.$raise($$($nesting, 'ArgumentError'), "" + "wrong number of arguments (" + (args.$length()) + " for 0..2)")}; + $c = args, $b = Opal.to_ary($c), (one = ($b[0] == null ? nil : $b[0])), (two = ($b[1] == null ? nil : $b[1])), $c; + } else { + + if ($truthy(args.length == 0)) { + self.$raise($$($nesting, 'ArgumentError'), "wrong number of arguments (0 for 1..3)") + } else if ($truthy(args.length > 3)) { + self.$raise($$($nesting, 'ArgumentError'), "" + "wrong number of arguments (" + (args.$length()) + " for 1..3)")}; + $c = args, $b = Opal.to_ary($c), (obj = ($b[0] == null ? nil : $b[0])), (one = ($b[1] == null ? nil : $b[1])), (two = ($b[2] == null ? nil : $b[2])), $c; + }; + if ($truthy($$($nesting, 'Range')['$==='](one))) { + + if ($truthy(two)) { + self.$raise($$($nesting, 'TypeError'), "length invalid with range")}; + left = $$($nesting, 'Opal').$coerce_to(one.$begin(), $$($nesting, 'Integer'), "to_int"); + if ($truthy(left < 0)) { + left += this.length}; + if ($truthy(left < 0)) { + self.$raise($$($nesting, 'RangeError'), "" + (one.$inspect()) + " out of range")}; + right = $$($nesting, 'Opal').$coerce_to(one.$end(), $$($nesting, 'Integer'), "to_int"); + if ($truthy(right < 0)) { + right += this.length}; + if ($truthy(one['$exclude_end?']())) { + } else { + right += 1 + }; + if ($truthy(right <= left)) { + return self}; + } else if ($truthy(one)) { + + left = $$($nesting, 'Opal').$coerce_to(one, $$($nesting, 'Integer'), "to_int"); + if ($truthy(left < 0)) { + left += this.length}; + if ($truthy(left < 0)) { + left = 0}; + if ($truthy(two)) { + + right = $$($nesting, 'Opal').$coerce_to(two, $$($nesting, 'Integer'), "to_int"); + if ($truthy(right == 0)) { + return self}; + right += left; + } else { + right = this.length + }; + } else { + + left = 0; + right = this.length; + }; + if ($truthy(left > this.length)) { + + for (i = this.length; i < right; i++) { + self[i] = nil; + } + }; + if ($truthy(right > this.length)) { + this.length = right}; + if ($truthy(block)) { + + for (length = this.length; left < right; left++) { + value = block(left); + self[left] = value; + } + + } else { + + for (length = this.length; left < right; left++) { + self[left] = obj; + } + + }; + return self; + }, TMP_Array_fill_51.$$arity = -1); + + Opal.def(self, '$first', TMP_Array_first_52 = function $$first(count) { + var self = this; + + + ; + + if (count == null) { + return self.length === 0 ? nil : self[0]; + } + + count = $$($nesting, 'Opal').$coerce_to(count, $$($nesting, 'Integer'), "to_int"); + + if (count < 0) { + self.$raise($$($nesting, 'ArgumentError'), "negative array size"); + } + + return self.slice(0, count); + ; + }, TMP_Array_first_52.$$arity = -1); + + Opal.def(self, '$flatten', TMP_Array_flatten_53 = function $$flatten(level) { + var self = this; + + + ; + + function _flatten(array, level) { + var result = [], + i, length, + item, ary; + + array = (array).$to_a(); + + for (i = 0, length = array.length; i < length; i++) { + item = array[i]; + + if (!$$($nesting, 'Opal')['$respond_to?'](item, "to_ary", true)) { + result.push(item); + continue; + } + + ary = (item).$to_ary(); + + if (ary === nil) { + result.push(item); + continue; + } + + if (!ary.$$is_array) { + self.$raise($$($nesting, 'TypeError')); + } + + if (ary === self) { + self.$raise($$($nesting, 'ArgumentError')); + } + + switch (level) { + case undefined: + result = result.concat(_flatten(ary)); + break; + case 0: + result.push(ary); + break; + default: + result.push.apply(result, _flatten(ary, level - 1)); + } + } + return result; + } + + if (level !== undefined) { + level = $$($nesting, 'Opal').$coerce_to(level, $$($nesting, 'Integer'), "to_int"); + } + + return toArraySubclass(_flatten(self, level), self.$class()); + ; + }, TMP_Array_flatten_53.$$arity = -1); + + Opal.def(self, '$flatten!', TMP_Array_flatten$B_54 = function(level) { + var self = this; + + + ; + + var flattened = self.$flatten(level); + + if (self.length == flattened.length) { + for (var i = 0, length = self.length; i < length; i++) { + if (self[i] !== flattened[i]) { + break; + } + } + + if (i == length) { + return nil; + } + } + + self.$replace(flattened); + ; + return self; + }, TMP_Array_flatten$B_54.$$arity = -1); + + Opal.def(self, '$hash', TMP_Array_hash_55 = function $$hash() { + var self = this; + + + var top = (Opal.hash_ids === undefined), + result = ['A'], + hash_id = self.$object_id(), + item, i, key; + + try { + if (top) { + Opal.hash_ids = Object.create(null); + } + + // return early for recursive structures + if (Opal.hash_ids[hash_id]) { + return 'self'; + } + + for (key in Opal.hash_ids) { + item = Opal.hash_ids[key]; + if (self['$eql?'](item)) { + return 'self'; + } + } + + Opal.hash_ids[hash_id] = self; + + for (i = 0; i < self.length; i++) { + item = self[i]; + result.push(item.$hash()); + } + + return result.join(','); + } finally { + if (top) { + Opal.hash_ids = undefined; + } + } + + }, TMP_Array_hash_55.$$arity = 0); + + Opal.def(self, '$include?', TMP_Array_include$q_56 = function(member) { + var self = this; + + + for (var i = 0, length = self.length; i < length; i++) { + if ((self[i])['$=='](member)) { + return true; + } + } + + return false; + + }, TMP_Array_include$q_56.$$arity = 1); + + Opal.def(self, '$index', TMP_Array_index_57 = function $$index(object) { + var $iter = TMP_Array_index_57.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Array_index_57.$$p = null; + + + if ($iter) TMP_Array_index_57.$$p = null;; + ; + + var i, length, value; + + if (object != null && block !== nil) { + self.$warn("warning: given block not used") + } + + if (object != null) { + for (i = 0, length = self.length; i < length; i++) { + if ((self[i])['$=='](object)) { + return i; + } + } + } + else if (block !== nil) { + for (i = 0, length = self.length; i < length; i++) { + value = block(self[i]); + + if (value !== false && value !== nil) { + return i; + } + } + } + else { + return self.$enum_for("index"); + } + + return nil; + ; + }, TMP_Array_index_57.$$arity = -1); + + Opal.def(self, '$insert', TMP_Array_insert_58 = function $$insert(index, $a) { + var $post_args, objects, self = this; + + + + $post_args = Opal.slice.call(arguments, 1, arguments.length); + + objects = $post_args;; + + index = $$($nesting, 'Opal').$coerce_to(index, $$($nesting, 'Integer'), "to_int"); + + if (objects.length > 0) { + if (index < 0) { + index += self.length + 1; + + if (index < 0) { + self.$raise($$($nesting, 'IndexError'), "" + (index) + " is out of bounds"); + } + } + if (index > self.length) { + for (var i = self.length; i < index; i++) { + self.push(nil); + } + } + + self.splice.apply(self, [index, 0].concat(objects)); + } + ; + return self; + }, TMP_Array_insert_58.$$arity = -2); + + Opal.def(self, '$inspect', TMP_Array_inspect_59 = function $$inspect() { + var self = this; + + + var result = [], + id = self.$__id__(); + + for (var i = 0, length = self.length; i < length; i++) { + var item = self['$[]'](i); + + if ((item).$__id__() === id) { + result.push('[...]'); + } + else { + result.push((item).$inspect()); + } + } + + return '[' + result.join(', ') + ']'; + + }, TMP_Array_inspect_59.$$arity = 0); + + Opal.def(self, '$join', TMP_Array_join_60 = function $$join(sep) { + var self = this; + if ($gvars[","] == null) $gvars[","] = nil; + + + + if (sep == null) { + sep = nil; + }; + if ($truthy(self.length === 0)) { + return ""}; + if ($truthy(sep === nil)) { + sep = $gvars[","]}; + + var result = []; + var i, length, item, tmp; + + for (i = 0, length = self.length; i < length; i++) { + item = self[i]; + + if ($$($nesting, 'Opal')['$respond_to?'](item, "to_str")) { + tmp = (item).$to_str(); + + if (tmp !== nil) { + result.push((tmp).$to_s()); + + continue; + } + } + + if ($$($nesting, 'Opal')['$respond_to?'](item, "to_ary")) { + tmp = (item).$to_ary(); + + if (tmp === self) { + self.$raise($$($nesting, 'ArgumentError')); + } + + if (tmp !== nil) { + result.push((tmp).$join(sep)); + + continue; + } + } + + if ($$($nesting, 'Opal')['$respond_to?'](item, "to_s")) { + tmp = (item).$to_s(); + + if (tmp !== nil) { + result.push(tmp); + + continue; + } + } + + self.$raise($$($nesting, 'NoMethodError').$new("" + (Opal.inspect(item)) + " doesn't respond to #to_str, #to_ary or #to_s", "to_str")); + } + + if (sep === nil) { + return result.join(''); + } + else { + return result.join($$($nesting, 'Opal')['$coerce_to!'](sep, $$($nesting, 'String'), "to_str").$to_s()); + } + ; + }, TMP_Array_join_60.$$arity = -1); + + Opal.def(self, '$keep_if', TMP_Array_keep_if_61 = function $$keep_if() { + var $iter = TMP_Array_keep_if_61.$$p, block = $iter || nil, TMP_62, self = this; + + if ($iter) TMP_Array_keep_if_61.$$p = null; + + + if ($iter) TMP_Array_keep_if_61.$$p = null;; + if ((block !== nil)) { + } else { + return $send(self, 'enum_for', ["keep_if"], (TMP_62 = function(){var self = TMP_62.$$s || this; + + return self.$size()}, TMP_62.$$s = self, TMP_62.$$arity = 0, TMP_62)) + }; + + for (var i = 0, length = self.length, value; i < length; i++) { + value = block(self[i]); + + if (value === false || value === nil) { + self.splice(i, 1); + + length--; + i--; + } + } + ; + return self; + }, TMP_Array_keep_if_61.$$arity = 0); + + Opal.def(self, '$last', TMP_Array_last_63 = function $$last(count) { + var self = this; + + + ; + + if (count == null) { + return self.length === 0 ? nil : self[self.length - 1]; + } + + count = $$($nesting, 'Opal').$coerce_to(count, $$($nesting, 'Integer'), "to_int"); + + if (count < 0) { + self.$raise($$($nesting, 'ArgumentError'), "negative array size"); + } + + if (count > self.length) { + count = self.length; + } + + return self.slice(self.length - count, self.length); + ; + }, TMP_Array_last_63.$$arity = -1); + + Opal.def(self, '$length', TMP_Array_length_64 = function $$length() { + var self = this; + + return self.length; + }, TMP_Array_length_64.$$arity = 0); + Opal.alias(self, "map", "collect"); + Opal.alias(self, "map!", "collect!"); + + Opal.def(self, '$max', TMP_Array_max_65 = function $$max(n) { + var $iter = TMP_Array_max_65.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Array_max_65.$$p = null; + + + if ($iter) TMP_Array_max_65.$$p = null;; + ; + return $send(self.$each(), 'max', [n], block.$to_proc()); + }, TMP_Array_max_65.$$arity = -1); + + Opal.def(self, '$min', TMP_Array_min_66 = function $$min() { + var $iter = TMP_Array_min_66.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Array_min_66.$$p = null; + + + if ($iter) TMP_Array_min_66.$$p = null;; + return $send(self.$each(), 'min', [], block.$to_proc()); + }, TMP_Array_min_66.$$arity = 0); + + // Returns the product of from, from-1, ..., from - how_many + 1. + function descending_factorial(from, how_many) { + var count = how_many >= 0 ? 1 : 0; + while (how_many) { + count *= from; + from--; + how_many--; + } + return count; + } + ; + + Opal.def(self, '$permutation', TMP_Array_permutation_67 = function $$permutation(num) { + var $iter = TMP_Array_permutation_67.$$p, block = $iter || nil, TMP_68, self = this, perm = nil, used = nil; + + if ($iter) TMP_Array_permutation_67.$$p = null; + + + if ($iter) TMP_Array_permutation_67.$$p = null;; + ; + if ((block !== nil)) { + } else { + return $send(self, 'enum_for', ["permutation", num], (TMP_68 = function(){var self = TMP_68.$$s || this; + + return descending_factorial(self.length, num === undefined ? self.length : num);}, TMP_68.$$s = self, TMP_68.$$arity = 0, TMP_68)) + }; + + var permute, offensive, output; + + if (num === undefined) { + num = self.length; + } + else { + num = $$($nesting, 'Opal').$coerce_to(num, $$($nesting, 'Integer'), "to_int") + } + + if (num < 0 || self.length < num) { + // no permutations, yield nothing + } + else if (num === 0) { + // exactly one permutation: the zero-length array + Opal.yield1(block, []) + } + else if (num === 1) { + // this is a special, easy case + for (var i = 0; i < self.length; i++) { + Opal.yield1(block, [self[i]]) + } + } + else { + // this is the general case + (perm = $$($nesting, 'Array').$new(num)); + (used = $$($nesting, 'Array').$new(self.length, false)); + + permute = function(num, perm, index, used, blk) { + self = this; + for(var i = 0; i < self.length; i++){ + if(used['$[]'](i)['$!']()) { + perm[index] = i; + if(index < num - 1) { + used[i] = true; + permute.call(self, num, perm, index + 1, used, blk); + used[i] = false; + } + else { + output = []; + for (var j = 0; j < perm.length; j++) { + output.push(self[perm[j]]); + } + Opal.yield1(blk, output); + } + } + } + } + + if ((block !== nil)) { + // offensive (both definitions) copy. + offensive = self.slice(); + permute.call(offensive, num, perm, 0, used, block); + } + else { + permute.call(self, num, perm, 0, used, block); + } + } + ; + return self; + }, TMP_Array_permutation_67.$$arity = -1); + + Opal.def(self, '$repeated_permutation', TMP_Array_repeated_permutation_69 = function $$repeated_permutation(n) { + var TMP_70, $iter = TMP_Array_repeated_permutation_69.$$p, $yield = $iter || nil, self = this, num = nil; + + if ($iter) TMP_Array_repeated_permutation_69.$$p = null; + + num = $$($nesting, 'Opal')['$coerce_to!'](n, $$($nesting, 'Integer'), "to_int"); + if (($yield !== nil)) { + } else { + return $send(self, 'enum_for', ["repeated_permutation", num], (TMP_70 = function(){var self = TMP_70.$$s || this; + + if ($truthy($rb_ge(num, 0))) { + return self.$size()['$**'](num) + } else { + return 0 + }}, TMP_70.$$s = self, TMP_70.$$arity = 0, TMP_70)) + }; + + function iterate(max, buffer, self) { + if (buffer.length == max) { + var copy = buffer.slice(); + Opal.yield1($yield, copy) + return; + } + for (var i = 0; i < self.length; i++) { + buffer.push(self[i]); + iterate(max, buffer, self); + buffer.pop(); + } + } + + iterate(num, [], self.slice()); + ; + return self; + }, TMP_Array_repeated_permutation_69.$$arity = 1); + + Opal.def(self, '$pop', TMP_Array_pop_71 = function $$pop(count) { + var self = this; + + + ; + if ($truthy(count === undefined)) { + + if ($truthy(self.length === 0)) { + return nil}; + return self.pop();}; + count = $$($nesting, 'Opal').$coerce_to(count, $$($nesting, 'Integer'), "to_int"); + if ($truthy(count < 0)) { + self.$raise($$($nesting, 'ArgumentError'), "negative array size")}; + if ($truthy(self.length === 0)) { + return []}; + if ($truthy(count > self.length)) { + return self.splice(0, self.length); + } else { + return self.splice(self.length - count, self.length); + }; + }, TMP_Array_pop_71.$$arity = -1); + + Opal.def(self, '$product', TMP_Array_product_72 = function $$product($a) { + var $iter = TMP_Array_product_72.$$p, block = $iter || nil, $post_args, args, self = this; + + if ($iter) TMP_Array_product_72.$$p = null; + + + if ($iter) TMP_Array_product_72.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + + var result = (block !== nil) ? null : [], + n = args.length + 1, + counters = new Array(n), + lengths = new Array(n), + arrays = new Array(n), + i, m, subarray, len, resultlen = 1; + + arrays[0] = self; + for (i = 1; i < n; i++) { + arrays[i] = $$($nesting, 'Opal').$coerce_to(args[i - 1], $$($nesting, 'Array'), "to_ary"); + } + + for (i = 0; i < n; i++) { + len = arrays[i].length; + if (len === 0) { + return result || self; + } + resultlen *= len; + if (resultlen > 2147483647) { + self.$raise($$($nesting, 'RangeError'), "too big to product") + } + lengths[i] = len; + counters[i] = 0; + } + + outer_loop: for (;;) { + subarray = []; + for (i = 0; i < n; i++) { + subarray.push(arrays[i][counters[i]]); + } + if (result) { + result.push(subarray); + } else { + Opal.yield1(block, subarray) + } + m = n - 1; + counters[m]++; + while (counters[m] === lengths[m]) { + counters[m] = 0; + if (--m < 0) break outer_loop; + counters[m]++; + } + } + + return result || self; + ; + }, TMP_Array_product_72.$$arity = -1); + + Opal.def(self, '$push', TMP_Array_push_73 = function $$push($a) { + var $post_args, objects, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + objects = $post_args;; + + for (var i = 0, length = objects.length; i < length; i++) { + self.push(objects[i]); + } + ; + return self; + }, TMP_Array_push_73.$$arity = -1); + Opal.alias(self, "append", "push"); + + Opal.def(self, '$rassoc', TMP_Array_rassoc_74 = function $$rassoc(object) { + var self = this; + + + for (var i = 0, length = self.length, item; i < length; i++) { + item = self[i]; + + if (item.length && item[1] !== undefined) { + if ((item[1])['$=='](object)) { + return item; + } + } + } + + return nil; + + }, TMP_Array_rassoc_74.$$arity = 1); + + Opal.def(self, '$reject', TMP_Array_reject_75 = function $$reject() { + var $iter = TMP_Array_reject_75.$$p, block = $iter || nil, TMP_76, self = this; + + if ($iter) TMP_Array_reject_75.$$p = null; + + + if ($iter) TMP_Array_reject_75.$$p = null;; + if ((block !== nil)) { + } else { + return $send(self, 'enum_for', ["reject"], (TMP_76 = function(){var self = TMP_76.$$s || this; + + return self.$size()}, TMP_76.$$s = self, TMP_76.$$arity = 0, TMP_76)) + }; + + var result = []; + + for (var i = 0, length = self.length, value; i < length; i++) { + value = block(self[i]); + + if (value === false || value === nil) { + result.push(self[i]); + } + } + return result; + ; + }, TMP_Array_reject_75.$$arity = 0); + + Opal.def(self, '$reject!', TMP_Array_reject$B_77 = function() { + var $iter = TMP_Array_reject$B_77.$$p, block = $iter || nil, TMP_78, self = this, original = nil; + + if ($iter) TMP_Array_reject$B_77.$$p = null; + + + if ($iter) TMP_Array_reject$B_77.$$p = null;; + if ((block !== nil)) { + } else { + return $send(self, 'enum_for', ["reject!"], (TMP_78 = function(){var self = TMP_78.$$s || this; + + return self.$size()}, TMP_78.$$s = self, TMP_78.$$arity = 0, TMP_78)) + }; + original = self.$length(); + $send(self, 'delete_if', [], block.$to_proc()); + if (self.$length()['$=='](original)) { + return nil + } else { + return self + }; + }, TMP_Array_reject$B_77.$$arity = 0); + + Opal.def(self, '$replace', TMP_Array_replace_79 = function $$replace(other) { + var self = this; + + + other = (function() {if ($truthy($$($nesting, 'Array')['$==='](other))) { + return other.$to_a() + } else { + return $$($nesting, 'Opal').$coerce_to(other, $$($nesting, 'Array'), "to_ary").$to_a() + }; return nil; })(); + + self.splice(0, self.length); + self.push.apply(self, other); + ; + return self; + }, TMP_Array_replace_79.$$arity = 1); + + Opal.def(self, '$reverse', TMP_Array_reverse_80 = function $$reverse() { + var self = this; + + return self.slice(0).reverse(); + }, TMP_Array_reverse_80.$$arity = 0); + + Opal.def(self, '$reverse!', TMP_Array_reverse$B_81 = function() { + var self = this; + + return self.reverse(); + }, TMP_Array_reverse$B_81.$$arity = 0); + + Opal.def(self, '$reverse_each', TMP_Array_reverse_each_82 = function $$reverse_each() { + var $iter = TMP_Array_reverse_each_82.$$p, block = $iter || nil, TMP_83, self = this; + + if ($iter) TMP_Array_reverse_each_82.$$p = null; + + + if ($iter) TMP_Array_reverse_each_82.$$p = null;; + if ((block !== nil)) { + } else { + return $send(self, 'enum_for', ["reverse_each"], (TMP_83 = function(){var self = TMP_83.$$s || this; + + return self.$size()}, TMP_83.$$s = self, TMP_83.$$arity = 0, TMP_83)) + }; + $send(self.$reverse(), 'each', [], block.$to_proc()); + return self; + }, TMP_Array_reverse_each_82.$$arity = 0); + + Opal.def(self, '$rindex', TMP_Array_rindex_84 = function $$rindex(object) { + var $iter = TMP_Array_rindex_84.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Array_rindex_84.$$p = null; + + + if ($iter) TMP_Array_rindex_84.$$p = null;; + ; + + var i, value; + + if (object != null && block !== nil) { + self.$warn("warning: given block not used") + } + + if (object != null) { + for (i = self.length - 1; i >= 0; i--) { + if (i >= self.length) { + break; + } + if ((self[i])['$=='](object)) { + return i; + } + } + } + else if (block !== nil) { + for (i = self.length - 1; i >= 0; i--) { + if (i >= self.length) { + break; + } + + value = block(self[i]); + + if (value !== false && value !== nil) { + return i; + } + } + } + else if (object == null) { + return self.$enum_for("rindex"); + } + + return nil; + ; + }, TMP_Array_rindex_84.$$arity = -1); + + Opal.def(self, '$rotate', TMP_Array_rotate_85 = function $$rotate(n) { + var self = this; + + + + if (n == null) { + n = 1; + }; + n = $$($nesting, 'Opal').$coerce_to(n, $$($nesting, 'Integer'), "to_int"); + + var ary, idx, firstPart, lastPart; + + if (self.length === 1) { + return self.slice(); + } + if (self.length === 0) { + return []; + } + + ary = self.slice(); + idx = n % ary.length; + + firstPart = ary.slice(idx); + lastPart = ary.slice(0, idx); + return firstPart.concat(lastPart); + ; + }, TMP_Array_rotate_85.$$arity = -1); + + Opal.def(self, '$rotate!', TMP_Array_rotate$B_86 = function(cnt) { + var self = this, ary = nil; + + + + if (cnt == null) { + cnt = 1; + }; + + if (self.length === 0 || self.length === 1) { + return self; + } + ; + cnt = $$($nesting, 'Opal').$coerce_to(cnt, $$($nesting, 'Integer'), "to_int"); + ary = self.$rotate(cnt); + return self.$replace(ary); + }, TMP_Array_rotate$B_86.$$arity = -1); + (function($base, $super, $parent_nesting) { + function $SampleRandom(){}; + var self = $SampleRandom = $klass($base, $super, 'SampleRandom', $SampleRandom); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_SampleRandom_initialize_87, TMP_SampleRandom_rand_88; + + def.rng = nil; + + + Opal.def(self, '$initialize', TMP_SampleRandom_initialize_87 = function $$initialize(rng) { + var self = this; + + return (self.rng = rng) + }, TMP_SampleRandom_initialize_87.$$arity = 1); + return (Opal.def(self, '$rand', TMP_SampleRandom_rand_88 = function $$rand(size) { + var self = this, random = nil; + + + random = $$($nesting, 'Opal').$coerce_to(self.rng.$rand(size), $$($nesting, 'Integer'), "to_int"); + if ($truthy(random < 0)) { + self.$raise($$($nesting, 'RangeError'), "random value must be >= 0")}; + if ($truthy(random < size)) { + } else { + self.$raise($$($nesting, 'RangeError'), "random value must be less than Array size") + }; + return random; + }, TMP_SampleRandom_rand_88.$$arity = 1), nil) && 'rand'; + })($nesting[0], null, $nesting); + + Opal.def(self, '$sample', TMP_Array_sample_89 = function $$sample(count, options) { + var $a, self = this, o = nil, rng = nil; + + + ; + ; + if ($truthy(count === undefined)) { + return self.$at($$($nesting, 'Kernel').$rand(self.length))}; + if ($truthy(options === undefined)) { + if ($truthy((o = $$($nesting, 'Opal')['$coerce_to?'](count, $$($nesting, 'Hash'), "to_hash")))) { + + options = o; + count = nil; + } else { + + options = nil; + count = $$($nesting, 'Opal').$coerce_to(count, $$($nesting, 'Integer'), "to_int"); + } + } else { + + count = $$($nesting, 'Opal').$coerce_to(count, $$($nesting, 'Integer'), "to_int"); + options = $$($nesting, 'Opal').$coerce_to(options, $$($nesting, 'Hash'), "to_hash"); + }; + if ($truthy(($truthy($a = count) ? count < 0 : $a))) { + self.$raise($$($nesting, 'ArgumentError'), "count must be greater than 0")}; + if ($truthy(options)) { + rng = options['$[]']("random")}; + rng = (function() {if ($truthy(($truthy($a = rng) ? rng['$respond_to?']("rand") : $a))) { + return $$($nesting, 'SampleRandom').$new(rng) + } else { + return $$($nesting, 'Kernel') + }; return nil; })(); + if ($truthy(count)) { + } else { + return self[rng.$rand(self.length)] + }; + + + var abandon, spin, result, i, j, k, targetIndex, oldValue; + + if (count > self.length) { + count = self.length; + } + + switch (count) { + case 0: + return []; + break; + case 1: + return [self[rng.$rand(self.length)]]; + break; + case 2: + i = rng.$rand(self.length); + j = rng.$rand(self.length); + if (i === j) { + j = i === 0 ? i + 1 : i - 1; + } + return [self[i], self[j]]; + break; + default: + if (self.length / count > 3) { + abandon = false; + spin = 0; + + result = $$($nesting, 'Array').$new(count); + i = 1; + + result[0] = rng.$rand(self.length); + while (i < count) { + k = rng.$rand(self.length); + j = 0; + + while (j < i) { + while (k === result[j]) { + spin++; + if (spin > 100) { + abandon = true; + break; + } + k = rng.$rand(self.length); + } + if (abandon) { break; } + + j++; + } + + if (abandon) { break; } + + result[i] = k; + + i++; + } + + if (!abandon) { + i = 0; + while (i < count) { + result[i] = self[result[i]]; + i++; + } + + return result; + } + } + + result = self.slice(); + + for (var c = 0; c < count; c++) { + targetIndex = rng.$rand(self.length); + oldValue = result[c]; + result[c] = result[targetIndex]; + result[targetIndex] = oldValue; + } + + return count === self.length ? result : (result)['$[]'](0, count); + } + ; + }, TMP_Array_sample_89.$$arity = -1); + + Opal.def(self, '$select', TMP_Array_select_90 = function $$select() { + var $iter = TMP_Array_select_90.$$p, block = $iter || nil, TMP_91, self = this; + + if ($iter) TMP_Array_select_90.$$p = null; + + + if ($iter) TMP_Array_select_90.$$p = null;; + if ((block !== nil)) { + } else { + return $send(self, 'enum_for', ["select"], (TMP_91 = function(){var self = TMP_91.$$s || this; + + return self.$size()}, TMP_91.$$s = self, TMP_91.$$arity = 0, TMP_91)) + }; + + var result = []; + + for (var i = 0, length = self.length, item, value; i < length; i++) { + item = self[i]; + + value = Opal.yield1(block, item); + + if (Opal.truthy(value)) { + result.push(item); + } + } + + return result; + ; + }, TMP_Array_select_90.$$arity = 0); + + Opal.def(self, '$select!', TMP_Array_select$B_92 = function() { + var $iter = TMP_Array_select$B_92.$$p, block = $iter || nil, TMP_93, self = this; + + if ($iter) TMP_Array_select$B_92.$$p = null; + + + if ($iter) TMP_Array_select$B_92.$$p = null;; + if ((block !== nil)) { + } else { + return $send(self, 'enum_for', ["select!"], (TMP_93 = function(){var self = TMP_93.$$s || this; + + return self.$size()}, TMP_93.$$s = self, TMP_93.$$arity = 0, TMP_93)) + }; + + var original = self.length; + $send(self, 'keep_if', [], block.$to_proc()); + return self.length === original ? nil : self; + ; + }, TMP_Array_select$B_92.$$arity = 0); + + Opal.def(self, '$shift', TMP_Array_shift_94 = function $$shift(count) { + var self = this; + + + ; + if ($truthy(count === undefined)) { + + if ($truthy(self.length === 0)) { + return nil}; + return self.shift();}; + count = $$($nesting, 'Opal').$coerce_to(count, $$($nesting, 'Integer'), "to_int"); + if ($truthy(count < 0)) { + self.$raise($$($nesting, 'ArgumentError'), "negative array size")}; + if ($truthy(self.length === 0)) { + return []}; + return self.splice(0, count);; + }, TMP_Array_shift_94.$$arity = -1); + Opal.alias(self, "size", "length"); + + Opal.def(self, '$shuffle', TMP_Array_shuffle_95 = function $$shuffle(rng) { + var self = this; + + + ; + return self.$dup().$to_a()['$shuffle!'](rng); + }, TMP_Array_shuffle_95.$$arity = -1); + + Opal.def(self, '$shuffle!', TMP_Array_shuffle$B_96 = function(rng) { + var self = this; + + + ; + + var randgen, i = self.length, j, tmp; + + if (rng !== undefined) { + rng = $$($nesting, 'Opal')['$coerce_to?'](rng, $$($nesting, 'Hash'), "to_hash"); + + if (rng !== nil) { + rng = rng['$[]']("random"); + + if (rng !== nil && rng['$respond_to?']("rand")) { + randgen = rng; + } + } + } + + while (i) { + if (randgen) { + j = randgen.$rand(i).$to_int(); + + if (j < 0) { + self.$raise($$($nesting, 'RangeError'), "" + "random number too small " + (j)) + } + + if (j >= i) { + self.$raise($$($nesting, 'RangeError'), "" + "random number too big " + (j)) + } + } + else { + j = self.$rand(i); + } + + tmp = self[--i]; + self[i] = self[j]; + self[j] = tmp; + } + + return self; + ; + }, TMP_Array_shuffle$B_96.$$arity = -1); + Opal.alias(self, "slice", "[]"); + + Opal.def(self, '$slice!', TMP_Array_slice$B_97 = function(index, length) { + var self = this, result = nil, range = nil, range_start = nil, range_end = nil, start = nil; + + + ; + result = nil; + if ($truthy(length === undefined)) { + if ($truthy($$($nesting, 'Range')['$==='](index))) { + + range = index; + result = self['$[]'](range); + range_start = $$($nesting, 'Opal').$coerce_to(range.$begin(), $$($nesting, 'Integer'), "to_int"); + range_end = $$($nesting, 'Opal').$coerce_to(range.$end(), $$($nesting, 'Integer'), "to_int"); + + if (range_start < 0) { + range_start += self.length; + } + + if (range_end < 0) { + range_end += self.length; + } else if (range_end >= self.length) { + range_end = self.length - 1; + if (range.excl) { + range_end += 1; + } + } + + var range_length = range_end - range_start; + if (range.excl) { + range_end -= 1; + } else { + range_length += 1; + } + + if (range_start < self.length && range_start >= 0 && range_end < self.length && range_end >= 0 && range_length > 0) { + self.splice(range_start, range_length); + } + ; + } else { + + start = $$($nesting, 'Opal').$coerce_to(index, $$($nesting, 'Integer'), "to_int"); + + if (start < 0) { + start += self.length; + } + + if (start < 0 || start >= self.length) { + return nil; + } + + result = self[start]; + + if (start === 0) { + self.shift(); + } else { + self.splice(start, 1); + } + ; + } + } else { + + start = $$($nesting, 'Opal').$coerce_to(index, $$($nesting, 'Integer'), "to_int"); + length = $$($nesting, 'Opal').$coerce_to(length, $$($nesting, 'Integer'), "to_int"); + + if (length < 0) { + return nil; + } + + var end = start + length; + + result = self['$[]'](start, length); + + if (start < 0) { + start += self.length; + } + + if (start + length > self.length) { + length = self.length - start; + } + + if (start < self.length && start >= 0) { + self.splice(start, length); + } + ; + }; + return result; + }, TMP_Array_slice$B_97.$$arity = -2); + + Opal.def(self, '$sort', TMP_Array_sort_98 = function $$sort() { + var $iter = TMP_Array_sort_98.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Array_sort_98.$$p = null; + + + if ($iter) TMP_Array_sort_98.$$p = null;; + if ($truthy(self.length > 1)) { + } else { + return self + }; + + if (block === nil) { + block = function(a, b) { + return (a)['$<=>'](b); + }; + } + + return self.slice().sort(function(x, y) { + var ret = block(x, y); + + if (ret === nil) { + self.$raise($$($nesting, 'ArgumentError'), "" + "comparison of " + ((x).$inspect()) + " with " + ((y).$inspect()) + " failed"); + } + + return $rb_gt(ret, 0) ? 1 : ($rb_lt(ret, 0) ? -1 : 0); + }); + ; + }, TMP_Array_sort_98.$$arity = 0); + + Opal.def(self, '$sort!', TMP_Array_sort$B_99 = function() { + var $iter = TMP_Array_sort$B_99.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Array_sort$B_99.$$p = null; + + + if ($iter) TMP_Array_sort$B_99.$$p = null;; + + var result; + + if ((block !== nil)) { + result = $send((self.slice()), 'sort', [], block.$to_proc()); + } + else { + result = (self.slice()).$sort(); + } + + self.length = 0; + for(var i = 0, length = result.length; i < length; i++) { + self.push(result[i]); + } + + return self; + ; + }, TMP_Array_sort$B_99.$$arity = 0); + + Opal.def(self, '$sort_by!', TMP_Array_sort_by$B_100 = function() { + var $iter = TMP_Array_sort_by$B_100.$$p, block = $iter || nil, TMP_101, self = this; + + if ($iter) TMP_Array_sort_by$B_100.$$p = null; + + + if ($iter) TMP_Array_sort_by$B_100.$$p = null;; + if ((block !== nil)) { + } else { + return $send(self, 'enum_for', ["sort_by!"], (TMP_101 = function(){var self = TMP_101.$$s || this; + + return self.$size()}, TMP_101.$$s = self, TMP_101.$$arity = 0, TMP_101)) + }; + return self.$replace($send(self, 'sort_by', [], block.$to_proc())); + }, TMP_Array_sort_by$B_100.$$arity = 0); + + Opal.def(self, '$take', TMP_Array_take_102 = function $$take(count) { + var self = this; + + + if (count < 0) { + self.$raise($$($nesting, 'ArgumentError')); + } + + return self.slice(0, count); + + }, TMP_Array_take_102.$$arity = 1); + + Opal.def(self, '$take_while', TMP_Array_take_while_103 = function $$take_while() { + var $iter = TMP_Array_take_while_103.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Array_take_while_103.$$p = null; + + + if ($iter) TMP_Array_take_while_103.$$p = null;; + + var result = []; + + for (var i = 0, length = self.length, item, value; i < length; i++) { + item = self[i]; + + value = block(item); + + if (value === false || value === nil) { + return result; + } + + result.push(item); + } + + return result; + ; + }, TMP_Array_take_while_103.$$arity = 0); + + Opal.def(self, '$to_a', TMP_Array_to_a_104 = function $$to_a() { + var self = this; + + return self + }, TMP_Array_to_a_104.$$arity = 0); + Opal.alias(self, "to_ary", "to_a"); + + Opal.def(self, '$to_h', TMP_Array_to_h_105 = function $$to_h() { + var self = this; + + + var i, len = self.length, ary, key, val, hash = $hash2([], {}); + + for (i = 0; i < len; i++) { + ary = $$($nesting, 'Opal')['$coerce_to?'](self[i], $$($nesting, 'Array'), "to_ary"); + if (!ary.$$is_array) { + self.$raise($$($nesting, 'TypeError'), "" + "wrong element type " + ((ary).$class()) + " at " + (i) + " (expected array)") + } + if (ary.length !== 2) { + self.$raise($$($nesting, 'ArgumentError'), "" + "wrong array length at " + (i) + " (expected 2, was " + ((ary).$length()) + ")") + } + key = ary[0]; + val = ary[1]; + Opal.hash_put(hash, key, val); + } + + return hash; + + }, TMP_Array_to_h_105.$$arity = 0); + Opal.alias(self, "to_s", "inspect"); + + Opal.def(self, '$transpose', TMP_Array_transpose_106 = function $$transpose() { + var TMP_107, self = this, result = nil, max = nil; + + + if ($truthy(self['$empty?']())) { + return []}; + result = []; + max = nil; + $send(self, 'each', [], (TMP_107 = function(row){var self = TMP_107.$$s || this, $a, TMP_108; + + + + if (row == null) { + row = nil; + }; + row = (function() {if ($truthy($$($nesting, 'Array')['$==='](row))) { + return row.$to_a() + } else { + return $$($nesting, 'Opal').$coerce_to(row, $$($nesting, 'Array'), "to_ary").$to_a() + }; return nil; })(); + max = ($truthy($a = max) ? $a : row.length); + if ($truthy((row.length)['$!='](max))) { + self.$raise($$($nesting, 'IndexError'), "" + "element size differs (" + (row.length) + " should be " + (max) + ")")}; + return $send((row.length), 'times', [], (TMP_108 = function(i){var self = TMP_108.$$s || this, $b, entry = nil, $writer = nil; + + + + if (i == null) { + i = nil; + }; + entry = ($truthy($b = result['$[]'](i)) ? $b : (($writer = [i, []]), $send(result, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + return entry['$<<'](row.$at(i));}, TMP_108.$$s = self, TMP_108.$$arity = 1, TMP_108));}, TMP_107.$$s = self, TMP_107.$$arity = 1, TMP_107)); + return result; + }, TMP_Array_transpose_106.$$arity = 0); + + Opal.def(self, '$uniq', TMP_Array_uniq_109 = function $$uniq() { + var $iter = TMP_Array_uniq_109.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Array_uniq_109.$$p = null; + + + if ($iter) TMP_Array_uniq_109.$$p = null;; + + var hash = $hash2([], {}), i, length, item, key; + + if (block === nil) { + for (i = 0, length = self.length; i < length; i++) { + item = self[i]; + if (Opal.hash_get(hash, item) === undefined) { + Opal.hash_put(hash, item, item); + } + } + } + else { + for (i = 0, length = self.length; i < length; i++) { + item = self[i]; + key = Opal.yield1(block, item); + if (Opal.hash_get(hash, key) === undefined) { + Opal.hash_put(hash, key, item); + } + } + } + + return toArraySubclass((hash).$values(), self.$class()); + ; + }, TMP_Array_uniq_109.$$arity = 0); + + Opal.def(self, '$uniq!', TMP_Array_uniq$B_110 = function() { + var $iter = TMP_Array_uniq$B_110.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Array_uniq$B_110.$$p = null; + + + if ($iter) TMP_Array_uniq$B_110.$$p = null;; + + var original_length = self.length, hash = $hash2([], {}), i, length, item, key; + + for (i = 0, length = original_length; i < length; i++) { + item = self[i]; + key = (block === nil ? item : Opal.yield1(block, item)); + + if (Opal.hash_get(hash, key) === undefined) { + Opal.hash_put(hash, key, item); + continue; + } + + self.splice(i, 1); + length--; + i--; + } + + return self.length === original_length ? nil : self; + ; + }, TMP_Array_uniq$B_110.$$arity = 0); + + Opal.def(self, '$unshift', TMP_Array_unshift_111 = function $$unshift($a) { + var $post_args, objects, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + objects = $post_args;; + + for (var i = objects.length - 1; i >= 0; i--) { + self.unshift(objects[i]); + } + ; + return self; + }, TMP_Array_unshift_111.$$arity = -1); + Opal.alias(self, "prepend", "unshift"); + + Opal.def(self, '$values_at', TMP_Array_values_at_112 = function $$values_at($a) { + var $post_args, args, TMP_113, self = this, out = nil; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + out = []; + $send(args, 'each', [], (TMP_113 = function(elem){var self = TMP_113.$$s || this, TMP_114, finish = nil, start = nil, i = nil; + + + + if (elem == null) { + elem = nil; + }; + if ($truthy(elem['$is_a?']($$($nesting, 'Range')))) { + + finish = $$($nesting, 'Opal').$coerce_to(elem.$last(), $$($nesting, 'Integer'), "to_int"); + start = $$($nesting, 'Opal').$coerce_to(elem.$first(), $$($nesting, 'Integer'), "to_int"); + + if (start < 0) { + start = start + self.length; + return nil;; + } + ; + + if (finish < 0) { + finish = finish + self.length; + } + if (elem['$exclude_end?']()) { + finish--; + } + if (finish < start) { + return nil;; + } + ; + return $send(start, 'upto', [finish], (TMP_114 = function(i){var self = TMP_114.$$s || this; + + + + if (i == null) { + i = nil; + }; + return out['$<<'](self.$at(i));}, TMP_114.$$s = self, TMP_114.$$arity = 1, TMP_114)); + } else { + + i = $$($nesting, 'Opal').$coerce_to(elem, $$($nesting, 'Integer'), "to_int"); + return out['$<<'](self.$at(i)); + };}, TMP_113.$$s = self, TMP_113.$$arity = 1, TMP_113)); + return out; + }, TMP_Array_values_at_112.$$arity = -1); + + Opal.def(self, '$zip', TMP_Array_zip_115 = function $$zip($a) { + var $iter = TMP_Array_zip_115.$$p, block = $iter || nil, $post_args, others, $b, self = this; + + if ($iter) TMP_Array_zip_115.$$p = null; + + + if ($iter) TMP_Array_zip_115.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + others = $post_args;; + + var result = [], size = self.length, part, o, i, j, jj; + + for (j = 0, jj = others.length; j < jj; j++) { + o = others[j]; + if (o.$$is_array) { + continue; + } + if (o.$$is_enumerator) { + if (o.$size() === Infinity) { + others[j] = o.$take(size); + } else { + others[j] = o.$to_a(); + } + continue; + } + others[j] = ($truthy($b = $$($nesting, 'Opal')['$coerce_to?'](o, $$($nesting, 'Array'), "to_ary")) ? $b : $$($nesting, 'Opal')['$coerce_to!'](o, $$($nesting, 'Enumerator'), "each")).$to_a(); + } + + for (i = 0; i < size; i++) { + part = [self[i]]; + + for (j = 0, jj = others.length; j < jj; j++) { + o = others[j][i]; + + if (o == null) { + o = nil; + } + + part[j + 1] = o; + } + + result[i] = part; + } + + if (block !== nil) { + for (i = 0; i < size; i++) { + block(result[i]); + } + + return nil; + } + + return result; + ; + }, TMP_Array_zip_115.$$arity = -1); + Opal.defs(self, '$inherited', TMP_Array_inherited_116 = function $$inherited(klass) { + var self = this; + + + klass.prototype.$to_a = function() { + return this.slice(0, this.length); + } + + }, TMP_Array_inherited_116.$$arity = 1); + + Opal.def(self, '$instance_variables', TMP_Array_instance_variables_117 = function $$instance_variables() { + var TMP_118, $iter = TMP_Array_instance_variables_117.$$p, $yield = $iter || nil, self = this, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_Array_instance_variables_117.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + return $send($send(self, Opal.find_super_dispatcher(self, 'instance_variables', TMP_Array_instance_variables_117, false), $zuper, $iter), 'reject', [], (TMP_118 = function(ivar){var self = TMP_118.$$s || this, $a; + + + + if (ivar == null) { + ivar = nil; + }; + return ($truthy($a = /^@\d+$/.test(ivar)) ? $a : ivar['$==']("@length"));}, TMP_118.$$s = self, TMP_118.$$arity = 1, TMP_118)) + }, TMP_Array_instance_variables_117.$$arity = 0); + $$($nesting, 'Opal').$pristine(self.$singleton_class(), "allocate"); + $$($nesting, 'Opal').$pristine(self, "copy_instance_variables", "initialize_dup"); + return (Opal.def(self, '$pack', TMP_Array_pack_119 = function $$pack($a) { + var $post_args, args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + return self.$raise("To use Array#pack, you must first require 'corelib/array/pack'."); + }, TMP_Array_pack_119.$$arity = -1), nil) && 'pack'; + })($nesting[0], Array, $nesting); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/hash"] = function(Opal) { + function $rb_ge(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs >= rhs : lhs['$>='](rhs); + } + function $rb_gt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); + } + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $send = Opal.send, $hash2 = Opal.hash2, $truthy = Opal.truthy; + + Opal.add_stubs(['$require', '$include', '$coerce_to?', '$[]', '$merge!', '$allocate', '$raise', '$coerce_to!', '$each', '$fetch', '$>=', '$>', '$==', '$compare_by_identity', '$lambda?', '$abs', '$arity', '$enum_for', '$size', '$respond_to?', '$class', '$dig', '$new', '$inspect', '$map', '$to_proc', '$flatten', '$eql?', '$default', '$dup', '$default_proc', '$default_proc=', '$-', '$default=', '$proc']); + + self.$require("corelib/enumerable"); + return (function($base, $super, $parent_nesting) { + function $Hash(){}; + var self = $Hash = $klass($base, $super, 'Hash', $Hash); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Hash_$$_1, TMP_Hash_allocate_2, TMP_Hash_try_convert_3, TMP_Hash_initialize_4, TMP_Hash_$eq$eq_5, TMP_Hash_$gt$eq_6, TMP_Hash_$gt_8, TMP_Hash_$lt_9, TMP_Hash_$lt$eq_10, TMP_Hash_$$_11, TMP_Hash_$$$eq_12, TMP_Hash_assoc_13, TMP_Hash_clear_14, TMP_Hash_clone_15, TMP_Hash_compact_16, TMP_Hash_compact$B_17, TMP_Hash_compare_by_identity_18, TMP_Hash_compare_by_identity$q_19, TMP_Hash_default_20, TMP_Hash_default$eq_21, TMP_Hash_default_proc_22, TMP_Hash_default_proc$eq_23, TMP_Hash_delete_24, TMP_Hash_delete_if_25, TMP_Hash_dig_27, TMP_Hash_each_28, TMP_Hash_each_key_30, TMP_Hash_each_value_32, TMP_Hash_empty$q_34, TMP_Hash_fetch_35, TMP_Hash_fetch_values_36, TMP_Hash_flatten_38, TMP_Hash_has_key$q_39, TMP_Hash_has_value$q_40, TMP_Hash_hash_41, TMP_Hash_index_42, TMP_Hash_indexes_43, TMP_Hash_inspect_44, TMP_Hash_invert_45, TMP_Hash_keep_if_46, TMP_Hash_keys_48, TMP_Hash_length_49, TMP_Hash_merge_50, TMP_Hash_merge$B_51, TMP_Hash_rassoc_52, TMP_Hash_rehash_53, TMP_Hash_reject_54, TMP_Hash_reject$B_56, TMP_Hash_replace_58, TMP_Hash_select_59, TMP_Hash_select$B_61, TMP_Hash_shift_63, TMP_Hash_slice_64, TMP_Hash_to_a_65, TMP_Hash_to_h_66, TMP_Hash_to_hash_67, TMP_Hash_to_proc_68, TMP_Hash_transform_keys_70, TMP_Hash_transform_keys$B_72, TMP_Hash_transform_values_74, TMP_Hash_transform_values$B_76, TMP_Hash_values_78; + + + self.$include($$($nesting, 'Enumerable')); + def.$$is_hash = true; + Opal.defs(self, '$[]', TMP_Hash_$$_1 = function($a) { + var $post_args, argv, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + argv = $post_args;; + + var hash, argc = argv.length, i; + + if (argc === 1) { + hash = $$($nesting, 'Opal')['$coerce_to?'](argv['$[]'](0), $$($nesting, 'Hash'), "to_hash"); + if (hash !== nil) { + return self.$allocate()['$merge!'](hash); + } + + argv = $$($nesting, 'Opal')['$coerce_to?'](argv['$[]'](0), $$($nesting, 'Array'), "to_ary"); + if (argv === nil) { + self.$raise($$($nesting, 'ArgumentError'), "odd number of arguments for Hash") + } + + argc = argv.length; + hash = self.$allocate(); + + for (i = 0; i < argc; i++) { + if (!argv[i].$$is_array) continue; + switch(argv[i].length) { + case 1: + hash.$store(argv[i][0], nil); + break; + case 2: + hash.$store(argv[i][0], argv[i][1]); + break; + default: + self.$raise($$($nesting, 'ArgumentError'), "" + "invalid number of elements (" + (argv[i].length) + " for 1..2)") + } + } + + return hash; + } + + if (argc % 2 !== 0) { + self.$raise($$($nesting, 'ArgumentError'), "odd number of arguments for Hash") + } + + hash = self.$allocate(); + + for (i = 0; i < argc; i += 2) { + hash.$store(argv[i], argv[i + 1]); + } + + return hash; + ; + }, TMP_Hash_$$_1.$$arity = -1); + Opal.defs(self, '$allocate', TMP_Hash_allocate_2 = function $$allocate() { + var self = this; + + + var hash = new self(); + + Opal.hash_init(hash); + + hash.$$none = nil; + hash.$$proc = nil; + + return hash; + + }, TMP_Hash_allocate_2.$$arity = 0); + Opal.defs(self, '$try_convert', TMP_Hash_try_convert_3 = function $$try_convert(obj) { + var self = this; + + return $$($nesting, 'Opal')['$coerce_to?'](obj, $$($nesting, 'Hash'), "to_hash") + }, TMP_Hash_try_convert_3.$$arity = 1); + + Opal.def(self, '$initialize', TMP_Hash_initialize_4 = function $$initialize(defaults) { + var $iter = TMP_Hash_initialize_4.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Hash_initialize_4.$$p = null; + + + if ($iter) TMP_Hash_initialize_4.$$p = null;; + ; + + if (defaults !== undefined && block !== nil) { + self.$raise($$($nesting, 'ArgumentError'), "wrong number of arguments (1 for 0)") + } + self.$$none = (defaults === undefined ? nil : defaults); + self.$$proc = block; + + return self; + ; + }, TMP_Hash_initialize_4.$$arity = -1); + + Opal.def(self, '$==', TMP_Hash_$eq$eq_5 = function(other) { + var self = this; + + + if (self === other) { + return true; + } + + if (!other.$$is_hash) { + return false; + } + + if (self.$$keys.length !== other.$$keys.length) { + return false; + } + + for (var i = 0, keys = self.$$keys, length = keys.length, key, value, other_value; i < length; i++) { + key = keys[i]; + + if (key.$$is_string) { + value = self.$$smap[key]; + other_value = other.$$smap[key]; + } else { + value = key.value; + other_value = Opal.hash_get(other, key.key); + } + + if (other_value === undefined || !value['$eql?'](other_value)) { + return false; + } + } + + return true; + + }, TMP_Hash_$eq$eq_5.$$arity = 1); + + Opal.def(self, '$>=', TMP_Hash_$gt$eq_6 = function(other) { + var TMP_7, self = this, result = nil; + + + other = $$($nesting, 'Opal')['$coerce_to!'](other, $$($nesting, 'Hash'), "to_hash"); + + if (self.$$keys.length < other.$$keys.length) { + return false + } + ; + result = true; + $send(other, 'each', [], (TMP_7 = function(other_key, other_val){var self = TMP_7.$$s || this, val = nil; + + + + if (other_key == null) { + other_key = nil; + }; + + if (other_val == null) { + other_val = nil; + }; + val = self.$fetch(other_key, null); + + if (val == null || val !== other_val) { + result = false; + return; + } + ;}, TMP_7.$$s = self, TMP_7.$$arity = 2, TMP_7)); + return result; + }, TMP_Hash_$gt$eq_6.$$arity = 1); + + Opal.def(self, '$>', TMP_Hash_$gt_8 = function(other) { + var self = this; + + + other = $$($nesting, 'Opal')['$coerce_to!'](other, $$($nesting, 'Hash'), "to_hash"); + + if (self.$$keys.length <= other.$$keys.length) { + return false + } + ; + return $rb_ge(self, other); + }, TMP_Hash_$gt_8.$$arity = 1); + + Opal.def(self, '$<', TMP_Hash_$lt_9 = function(other) { + var self = this; + + + other = $$($nesting, 'Opal')['$coerce_to!'](other, $$($nesting, 'Hash'), "to_hash"); + return $rb_gt(other, self); + }, TMP_Hash_$lt_9.$$arity = 1); + + Opal.def(self, '$<=', TMP_Hash_$lt$eq_10 = function(other) { + var self = this; + + + other = $$($nesting, 'Opal')['$coerce_to!'](other, $$($nesting, 'Hash'), "to_hash"); + return $rb_ge(other, self); + }, TMP_Hash_$lt$eq_10.$$arity = 1); + + Opal.def(self, '$[]', TMP_Hash_$$_11 = function(key) { + var self = this; + + + var value = Opal.hash_get(self, key); + + if (value !== undefined) { + return value; + } + + return self.$default(key); + + }, TMP_Hash_$$_11.$$arity = 1); + + Opal.def(self, '$[]=', TMP_Hash_$$$eq_12 = function(key, value) { + var self = this; + + + Opal.hash_put(self, key, value); + return value; + + }, TMP_Hash_$$$eq_12.$$arity = 2); + + Opal.def(self, '$assoc', TMP_Hash_assoc_13 = function $$assoc(object) { + var self = this; + + + for (var i = 0, keys = self.$$keys, length = keys.length, key; i < length; i++) { + key = keys[i]; + + if (key.$$is_string) { + if ((key)['$=='](object)) { + return [key, self.$$smap[key]]; + } + } else { + if ((key.key)['$=='](object)) { + return [key.key, key.value]; + } + } + } + + return nil; + + }, TMP_Hash_assoc_13.$$arity = 1); + + Opal.def(self, '$clear', TMP_Hash_clear_14 = function $$clear() { + var self = this; + + + Opal.hash_init(self); + return self; + + }, TMP_Hash_clear_14.$$arity = 0); + + Opal.def(self, '$clone', TMP_Hash_clone_15 = function $$clone() { + var self = this; + + + var hash = new self.$$class(); + + Opal.hash_init(hash); + Opal.hash_clone(self, hash); + + return hash; + + }, TMP_Hash_clone_15.$$arity = 0); + + Opal.def(self, '$compact', TMP_Hash_compact_16 = function $$compact() { + var self = this; + + + var hash = Opal.hash(); + + for (var i = 0, keys = self.$$keys, length = keys.length, key, value, obj; i < length; i++) { + key = keys[i]; + + if (key.$$is_string) { + value = self.$$smap[key]; + } else { + value = key.value; + key = key.key; + } + + if (value !== nil) { + Opal.hash_put(hash, key, value); + } + } + + return hash; + + }, TMP_Hash_compact_16.$$arity = 0); + + Opal.def(self, '$compact!', TMP_Hash_compact$B_17 = function() { + var self = this; + + + var changes_were_made = false; + + for (var i = 0, keys = self.$$keys, length = keys.length, key, value, obj; i < length; i++) { + key = keys[i]; + + if (key.$$is_string) { + value = self.$$smap[key]; + } else { + value = key.value; + key = key.key; + } + + if (value === nil) { + if (Opal.hash_delete(self, key) !== undefined) { + changes_were_made = true; + length--; + i--; + } + } + } + + return changes_were_made ? self : nil; + + }, TMP_Hash_compact$B_17.$$arity = 0); + + Opal.def(self, '$compare_by_identity', TMP_Hash_compare_by_identity_18 = function $$compare_by_identity() { + var self = this; + + + var i, ii, key, keys = self.$$keys, identity_hash; + + if (self.$$by_identity) return self; + if (self.$$keys.length === 0) { + self.$$by_identity = true + return self; + } + + identity_hash = $hash2([], {}).$compare_by_identity(); + for(i = 0, ii = keys.length; i < ii; i++) { + key = keys[i]; + if (!key.$$is_string) key = key.key; + Opal.hash_put(identity_hash, key, Opal.hash_get(self, key)); + } + + self.$$by_identity = true; + self.$$map = identity_hash.$$map; + self.$$smap = identity_hash.$$smap; + return self; + + }, TMP_Hash_compare_by_identity_18.$$arity = 0); + + Opal.def(self, '$compare_by_identity?', TMP_Hash_compare_by_identity$q_19 = function() { + var self = this; + + return self.$$by_identity === true; + }, TMP_Hash_compare_by_identity$q_19.$$arity = 0); + + Opal.def(self, '$default', TMP_Hash_default_20 = function(key) { + var self = this; + + + ; + + if (key !== undefined && self.$$proc !== nil && self.$$proc !== undefined) { + return self.$$proc.$call(self, key); + } + if (self.$$none === undefined) { + return nil; + } + return self.$$none; + ; + }, TMP_Hash_default_20.$$arity = -1); + + Opal.def(self, '$default=', TMP_Hash_default$eq_21 = function(object) { + var self = this; + + + self.$$proc = nil; + self.$$none = object; + + return object; + + }, TMP_Hash_default$eq_21.$$arity = 1); + + Opal.def(self, '$default_proc', TMP_Hash_default_proc_22 = function $$default_proc() { + var self = this; + + + if (self.$$proc !== undefined) { + return self.$$proc; + } + return nil; + + }, TMP_Hash_default_proc_22.$$arity = 0); + + Opal.def(self, '$default_proc=', TMP_Hash_default_proc$eq_23 = function(default_proc) { + var self = this; + + + var proc = default_proc; + + if (proc !== nil) { + proc = $$($nesting, 'Opal')['$coerce_to!'](proc, $$($nesting, 'Proc'), "to_proc"); + + if ((proc)['$lambda?']() && (proc).$arity().$abs() !== 2) { + self.$raise($$($nesting, 'TypeError'), "default_proc takes two arguments"); + } + } + + self.$$none = nil; + self.$$proc = proc; + + return default_proc; + + }, TMP_Hash_default_proc$eq_23.$$arity = 1); + + Opal.def(self, '$delete', TMP_Hash_delete_24 = function(key) { + var $iter = TMP_Hash_delete_24.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Hash_delete_24.$$p = null; + + + if ($iter) TMP_Hash_delete_24.$$p = null;; + + var value = Opal.hash_delete(self, key); + + if (value !== undefined) { + return value; + } + + if (block !== nil) { + return Opal.yield1(block, key); + } + + return nil; + ; + }, TMP_Hash_delete_24.$$arity = 1); + + Opal.def(self, '$delete_if', TMP_Hash_delete_if_25 = function $$delete_if() { + var $iter = TMP_Hash_delete_if_25.$$p, block = $iter || nil, TMP_26, self = this; + + if ($iter) TMP_Hash_delete_if_25.$$p = null; + + + if ($iter) TMP_Hash_delete_if_25.$$p = null;; + if ($truthy(block)) { + } else { + return $send(self, 'enum_for', ["delete_if"], (TMP_26 = function(){var self = TMP_26.$$s || this; + + return self.$size()}, TMP_26.$$s = self, TMP_26.$$arity = 0, TMP_26)) + }; + + for (var i = 0, keys = self.$$keys, length = keys.length, key, value, obj; i < length; i++) { + key = keys[i]; + + if (key.$$is_string) { + value = self.$$smap[key]; + } else { + value = key.value; + key = key.key; + } + + obj = block(key, value); + + if (obj !== false && obj !== nil) { + if (Opal.hash_delete(self, key) !== undefined) { + length--; + i--; + } + } + } + + return self; + ; + }, TMP_Hash_delete_if_25.$$arity = 0); + Opal.alias(self, "dup", "clone"); + + Opal.def(self, '$dig', TMP_Hash_dig_27 = function $$dig(key, $a) { + var $post_args, keys, self = this, item = nil; + + + + $post_args = Opal.slice.call(arguments, 1, arguments.length); + + keys = $post_args;; + item = self['$[]'](key); + + if (item === nil || keys.length === 0) { + return item; + } + ; + if ($truthy(item['$respond_to?']("dig"))) { + } else { + self.$raise($$($nesting, 'TypeError'), "" + (item.$class()) + " does not have #dig method") + }; + return $send(item, 'dig', Opal.to_a(keys)); + }, TMP_Hash_dig_27.$$arity = -2); + + Opal.def(self, '$each', TMP_Hash_each_28 = function $$each() { + var $iter = TMP_Hash_each_28.$$p, block = $iter || nil, TMP_29, self = this; + + if ($iter) TMP_Hash_each_28.$$p = null; + + + if ($iter) TMP_Hash_each_28.$$p = null;; + if ($truthy(block)) { + } else { + return $send(self, 'enum_for', ["each"], (TMP_29 = function(){var self = TMP_29.$$s || this; + + return self.$size()}, TMP_29.$$s = self, TMP_29.$$arity = 0, TMP_29)) + }; + + for (var i = 0, keys = self.$$keys, length = keys.length, key, value; i < length; i++) { + key = keys[i]; + + if (key.$$is_string) { + value = self.$$smap[key]; + } else { + value = key.value; + key = key.key; + } + + Opal.yield1(block, [key, value]); + } + + return self; + ; + }, TMP_Hash_each_28.$$arity = 0); + + Opal.def(self, '$each_key', TMP_Hash_each_key_30 = function $$each_key() { + var $iter = TMP_Hash_each_key_30.$$p, block = $iter || nil, TMP_31, self = this; + + if ($iter) TMP_Hash_each_key_30.$$p = null; + + + if ($iter) TMP_Hash_each_key_30.$$p = null;; + if ($truthy(block)) { + } else { + return $send(self, 'enum_for', ["each_key"], (TMP_31 = function(){var self = TMP_31.$$s || this; + + return self.$size()}, TMP_31.$$s = self, TMP_31.$$arity = 0, TMP_31)) + }; + + for (var i = 0, keys = self.$$keys, length = keys.length, key; i < length; i++) { + key = keys[i]; + + block(key.$$is_string ? key : key.key); + } + + return self; + ; + }, TMP_Hash_each_key_30.$$arity = 0); + Opal.alias(self, "each_pair", "each"); + + Opal.def(self, '$each_value', TMP_Hash_each_value_32 = function $$each_value() { + var $iter = TMP_Hash_each_value_32.$$p, block = $iter || nil, TMP_33, self = this; + + if ($iter) TMP_Hash_each_value_32.$$p = null; + + + if ($iter) TMP_Hash_each_value_32.$$p = null;; + if ($truthy(block)) { + } else { + return $send(self, 'enum_for', ["each_value"], (TMP_33 = function(){var self = TMP_33.$$s || this; + + return self.$size()}, TMP_33.$$s = self, TMP_33.$$arity = 0, TMP_33)) + }; + + for (var i = 0, keys = self.$$keys, length = keys.length, key; i < length; i++) { + key = keys[i]; + + block(key.$$is_string ? self.$$smap[key] : key.value); + } + + return self; + ; + }, TMP_Hash_each_value_32.$$arity = 0); + + Opal.def(self, '$empty?', TMP_Hash_empty$q_34 = function() { + var self = this; + + return self.$$keys.length === 0; + }, TMP_Hash_empty$q_34.$$arity = 0); + Opal.alias(self, "eql?", "=="); + + Opal.def(self, '$fetch', TMP_Hash_fetch_35 = function $$fetch(key, defaults) { + var $iter = TMP_Hash_fetch_35.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Hash_fetch_35.$$p = null; + + + if ($iter) TMP_Hash_fetch_35.$$p = null;; + ; + + var value = Opal.hash_get(self, key); + + if (value !== undefined) { + return value; + } + + if (block !== nil) { + return block(key); + } + + if (defaults !== undefined) { + return defaults; + } + ; + return self.$raise($$($nesting, 'KeyError').$new("" + "key not found: " + (key.$inspect()), $hash2(["key", "receiver"], {"key": key, "receiver": self}))); + }, TMP_Hash_fetch_35.$$arity = -2); + + Opal.def(self, '$fetch_values', TMP_Hash_fetch_values_36 = function $$fetch_values($a) { + var $iter = TMP_Hash_fetch_values_36.$$p, block = $iter || nil, $post_args, keys, TMP_37, self = this; + + if ($iter) TMP_Hash_fetch_values_36.$$p = null; + + + if ($iter) TMP_Hash_fetch_values_36.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + keys = $post_args;; + return $send(keys, 'map', [], (TMP_37 = function(key){var self = TMP_37.$$s || this; + + + + if (key == null) { + key = nil; + }; + return $send(self, 'fetch', [key], block.$to_proc());}, TMP_37.$$s = self, TMP_37.$$arity = 1, TMP_37)); + }, TMP_Hash_fetch_values_36.$$arity = -1); + + Opal.def(self, '$flatten', TMP_Hash_flatten_38 = function $$flatten(level) { + var self = this; + + + + if (level == null) { + level = 1; + }; + level = $$($nesting, 'Opal')['$coerce_to!'](level, $$($nesting, 'Integer'), "to_int"); + + var result = []; + + for (var i = 0, keys = self.$$keys, length = keys.length, key, value; i < length; i++) { + key = keys[i]; + + if (key.$$is_string) { + value = self.$$smap[key]; + } else { + value = key.value; + key = key.key; + } + + result.push(key); + + if (value.$$is_array) { + if (level === 1) { + result.push(value); + continue; + } + + result = result.concat((value).$flatten(level - 2)); + continue; + } + + result.push(value); + } + + return result; + ; + }, TMP_Hash_flatten_38.$$arity = -1); + + Opal.def(self, '$has_key?', TMP_Hash_has_key$q_39 = function(key) { + var self = this; + + return Opal.hash_get(self, key) !== undefined; + }, TMP_Hash_has_key$q_39.$$arity = 1); + + Opal.def(self, '$has_value?', TMP_Hash_has_value$q_40 = function(value) { + var self = this; + + + for (var i = 0, keys = self.$$keys, length = keys.length, key; i < length; i++) { + key = keys[i]; + + if (((key.$$is_string ? self.$$smap[key] : key.value))['$=='](value)) { + return true; + } + } + + return false; + + }, TMP_Hash_has_value$q_40.$$arity = 1); + + Opal.def(self, '$hash', TMP_Hash_hash_41 = function $$hash() { + var self = this; + + + var top = (Opal.hash_ids === undefined), + hash_id = self.$object_id(), + result = ['Hash'], + key, item; + + try { + if (top) { + Opal.hash_ids = Object.create(null); + } + + if (Opal[hash_id]) { + return 'self'; + } + + for (key in Opal.hash_ids) { + item = Opal.hash_ids[key]; + if (self['$eql?'](item)) { + return 'self'; + } + } + + Opal.hash_ids[hash_id] = self; + + for (var i = 0, keys = self.$$keys, length = keys.length; i < length; i++) { + key = keys[i]; + + if (key.$$is_string) { + result.push([key, self.$$smap[key].$hash()]); + } else { + result.push([key.key_hash, key.value.$hash()]); + } + } + + return result.sort().join(); + + } finally { + if (top) { + Opal.hash_ids = undefined; + } + } + + }, TMP_Hash_hash_41.$$arity = 0); + Opal.alias(self, "include?", "has_key?"); + + Opal.def(self, '$index', TMP_Hash_index_42 = function $$index(object) { + var self = this; + + + for (var i = 0, keys = self.$$keys, length = keys.length, key, value; i < length; i++) { + key = keys[i]; + + if (key.$$is_string) { + value = self.$$smap[key]; + } else { + value = key.value; + key = key.key; + } + + if ((value)['$=='](object)) { + return key; + } + } + + return nil; + + }, TMP_Hash_index_42.$$arity = 1); + + Opal.def(self, '$indexes', TMP_Hash_indexes_43 = function $$indexes($a) { + var $post_args, args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + + var result = []; + + for (var i = 0, length = args.length, key, value; i < length; i++) { + key = args[i]; + value = Opal.hash_get(self, key); + + if (value === undefined) { + result.push(self.$default()); + continue; + } + + result.push(value); + } + + return result; + ; + }, TMP_Hash_indexes_43.$$arity = -1); + Opal.alias(self, "indices", "indexes"); + var inspect_ids; + + Opal.def(self, '$inspect', TMP_Hash_inspect_44 = function $$inspect() { + var self = this; + + + var top = (inspect_ids === undefined), + hash_id = self.$object_id(), + result = []; + + try { + if (top) { + inspect_ids = {}; + } + + if (inspect_ids.hasOwnProperty(hash_id)) { + return '{...}'; + } + + inspect_ids[hash_id] = true; + + for (var i = 0, keys = self.$$keys, length = keys.length, key, value; i < length; i++) { + key = keys[i]; + + if (key.$$is_string) { + value = self.$$smap[key]; + } else { + value = key.value; + key = key.key; + } + + result.push(key.$inspect() + '=>' + value.$inspect()); + } + + return '{' + result.join(', ') + '}'; + + } finally { + if (top) { + inspect_ids = undefined; + } + } + + }, TMP_Hash_inspect_44.$$arity = 0); + + Opal.def(self, '$invert', TMP_Hash_invert_45 = function $$invert() { + var self = this; + + + var hash = Opal.hash(); + + for (var i = 0, keys = self.$$keys, length = keys.length, key, value; i < length; i++) { + key = keys[i]; + + if (key.$$is_string) { + value = self.$$smap[key]; + } else { + value = key.value; + key = key.key; + } + + Opal.hash_put(hash, value, key); + } + + return hash; + + }, TMP_Hash_invert_45.$$arity = 0); + + Opal.def(self, '$keep_if', TMP_Hash_keep_if_46 = function $$keep_if() { + var $iter = TMP_Hash_keep_if_46.$$p, block = $iter || nil, TMP_47, self = this; + + if ($iter) TMP_Hash_keep_if_46.$$p = null; + + + if ($iter) TMP_Hash_keep_if_46.$$p = null;; + if ($truthy(block)) { + } else { + return $send(self, 'enum_for', ["keep_if"], (TMP_47 = function(){var self = TMP_47.$$s || this; + + return self.$size()}, TMP_47.$$s = self, TMP_47.$$arity = 0, TMP_47)) + }; + + for (var i = 0, keys = self.$$keys, length = keys.length, key, value, obj; i < length; i++) { + key = keys[i]; + + if (key.$$is_string) { + value = self.$$smap[key]; + } else { + value = key.value; + key = key.key; + } + + obj = block(key, value); + + if (obj === false || obj === nil) { + if (Opal.hash_delete(self, key) !== undefined) { + length--; + i--; + } + } + } + + return self; + ; + }, TMP_Hash_keep_if_46.$$arity = 0); + Opal.alias(self, "key", "index"); + Opal.alias(self, "key?", "has_key?"); + + Opal.def(self, '$keys', TMP_Hash_keys_48 = function $$keys() { + var self = this; + + + var result = []; + + for (var i = 0, keys = self.$$keys, length = keys.length, key; i < length; i++) { + key = keys[i]; + + if (key.$$is_string) { + result.push(key); + } else { + result.push(key.key); + } + } + + return result; + + }, TMP_Hash_keys_48.$$arity = 0); + + Opal.def(self, '$length', TMP_Hash_length_49 = function $$length() { + var self = this; + + return self.$$keys.length; + }, TMP_Hash_length_49.$$arity = 0); + Opal.alias(self, "member?", "has_key?"); + + Opal.def(self, '$merge', TMP_Hash_merge_50 = function $$merge(other) { + var $iter = TMP_Hash_merge_50.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Hash_merge_50.$$p = null; + + + if ($iter) TMP_Hash_merge_50.$$p = null;; + return $send(self.$dup(), 'merge!', [other], block.$to_proc()); + }, TMP_Hash_merge_50.$$arity = 1); + + Opal.def(self, '$merge!', TMP_Hash_merge$B_51 = function(other) { + var $iter = TMP_Hash_merge$B_51.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Hash_merge$B_51.$$p = null; + + + if ($iter) TMP_Hash_merge$B_51.$$p = null;; + + if (!other.$$is_hash) { + other = $$($nesting, 'Opal')['$coerce_to!'](other, $$($nesting, 'Hash'), "to_hash"); + } + + var i, other_keys = other.$$keys, length = other_keys.length, key, value, other_value; + + if (block === nil) { + for (i = 0; i < length; i++) { + key = other_keys[i]; + + if (key.$$is_string) { + other_value = other.$$smap[key]; + } else { + other_value = key.value; + key = key.key; + } + + Opal.hash_put(self, key, other_value); + } + + return self; + } + + for (i = 0; i < length; i++) { + key = other_keys[i]; + + if (key.$$is_string) { + other_value = other.$$smap[key]; + } else { + other_value = key.value; + key = key.key; + } + + value = Opal.hash_get(self, key); + + if (value === undefined) { + Opal.hash_put(self, key, other_value); + continue; + } + + Opal.hash_put(self, key, block(key, value, other_value)); + } + + return self; + ; + }, TMP_Hash_merge$B_51.$$arity = 1); + + Opal.def(self, '$rassoc', TMP_Hash_rassoc_52 = function $$rassoc(object) { + var self = this; + + + for (var i = 0, keys = self.$$keys, length = keys.length, key, value; i < length; i++) { + key = keys[i]; + + if (key.$$is_string) { + value = self.$$smap[key]; + } else { + value = key.value; + key = key.key; + } + + if ((value)['$=='](object)) { + return [key, value]; + } + } + + return nil; + + }, TMP_Hash_rassoc_52.$$arity = 1); + + Opal.def(self, '$rehash', TMP_Hash_rehash_53 = function $$rehash() { + var self = this; + + + Opal.hash_rehash(self); + return self; + + }, TMP_Hash_rehash_53.$$arity = 0); + + Opal.def(self, '$reject', TMP_Hash_reject_54 = function $$reject() { + var $iter = TMP_Hash_reject_54.$$p, block = $iter || nil, TMP_55, self = this; + + if ($iter) TMP_Hash_reject_54.$$p = null; + + + if ($iter) TMP_Hash_reject_54.$$p = null;; + if ($truthy(block)) { + } else { + return $send(self, 'enum_for', ["reject"], (TMP_55 = function(){var self = TMP_55.$$s || this; + + return self.$size()}, TMP_55.$$s = self, TMP_55.$$arity = 0, TMP_55)) + }; + + var hash = Opal.hash(); + + for (var i = 0, keys = self.$$keys, length = keys.length, key, value, obj; i < length; i++) { + key = keys[i]; + + if (key.$$is_string) { + value = self.$$smap[key]; + } else { + value = key.value; + key = key.key; + } + + obj = block(key, value); + + if (obj === false || obj === nil) { + Opal.hash_put(hash, key, value); + } + } + + return hash; + ; + }, TMP_Hash_reject_54.$$arity = 0); + + Opal.def(self, '$reject!', TMP_Hash_reject$B_56 = function() { + var $iter = TMP_Hash_reject$B_56.$$p, block = $iter || nil, TMP_57, self = this; + + if ($iter) TMP_Hash_reject$B_56.$$p = null; + + + if ($iter) TMP_Hash_reject$B_56.$$p = null;; + if ($truthy(block)) { + } else { + return $send(self, 'enum_for', ["reject!"], (TMP_57 = function(){var self = TMP_57.$$s || this; + + return self.$size()}, TMP_57.$$s = self, TMP_57.$$arity = 0, TMP_57)) + }; + + var changes_were_made = false; + + for (var i = 0, keys = self.$$keys, length = keys.length, key, value, obj; i < length; i++) { + key = keys[i]; + + if (key.$$is_string) { + value = self.$$smap[key]; + } else { + value = key.value; + key = key.key; + } + + obj = block(key, value); + + if (obj !== false && obj !== nil) { + if (Opal.hash_delete(self, key) !== undefined) { + changes_were_made = true; + length--; + i--; + } + } + } + + return changes_were_made ? self : nil; + ; + }, TMP_Hash_reject$B_56.$$arity = 0); + + Opal.def(self, '$replace', TMP_Hash_replace_58 = function $$replace(other) { + var self = this, $writer = nil; + + + other = $$($nesting, 'Opal')['$coerce_to!'](other, $$($nesting, 'Hash'), "to_hash"); + + Opal.hash_init(self); + + for (var i = 0, other_keys = other.$$keys, length = other_keys.length, key, value, other_value; i < length; i++) { + key = other_keys[i]; + + if (key.$$is_string) { + other_value = other.$$smap[key]; + } else { + other_value = key.value; + key = key.key; + } + + Opal.hash_put(self, key, other_value); + } + ; + if ($truthy(other.$default_proc())) { + + $writer = [other.$default_proc()]; + $send(self, 'default_proc=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + } else { + + $writer = [other.$default()]; + $send(self, 'default=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + return self; + }, TMP_Hash_replace_58.$$arity = 1); + + Opal.def(self, '$select', TMP_Hash_select_59 = function $$select() { + var $iter = TMP_Hash_select_59.$$p, block = $iter || nil, TMP_60, self = this; + + if ($iter) TMP_Hash_select_59.$$p = null; + + + if ($iter) TMP_Hash_select_59.$$p = null;; + if ($truthy(block)) { + } else { + return $send(self, 'enum_for', ["select"], (TMP_60 = function(){var self = TMP_60.$$s || this; + + return self.$size()}, TMP_60.$$s = self, TMP_60.$$arity = 0, TMP_60)) + }; + + var hash = Opal.hash(); + + for (var i = 0, keys = self.$$keys, length = keys.length, key, value, obj; i < length; i++) { + key = keys[i]; + + if (key.$$is_string) { + value = self.$$smap[key]; + } else { + value = key.value; + key = key.key; + } + + obj = block(key, value); + + if (obj !== false && obj !== nil) { + Opal.hash_put(hash, key, value); + } + } + + return hash; + ; + }, TMP_Hash_select_59.$$arity = 0); + + Opal.def(self, '$select!', TMP_Hash_select$B_61 = function() { + var $iter = TMP_Hash_select$B_61.$$p, block = $iter || nil, TMP_62, self = this; + + if ($iter) TMP_Hash_select$B_61.$$p = null; + + + if ($iter) TMP_Hash_select$B_61.$$p = null;; + if ($truthy(block)) { + } else { + return $send(self, 'enum_for', ["select!"], (TMP_62 = function(){var self = TMP_62.$$s || this; + + return self.$size()}, TMP_62.$$s = self, TMP_62.$$arity = 0, TMP_62)) + }; + + var result = nil; + + for (var i = 0, keys = self.$$keys, length = keys.length, key, value, obj; i < length; i++) { + key = keys[i]; + + if (key.$$is_string) { + value = self.$$smap[key]; + } else { + value = key.value; + key = key.key; + } + + obj = block(key, value); + + if (obj === false || obj === nil) { + if (Opal.hash_delete(self, key) !== undefined) { + length--; + i--; + } + result = self; + } + } + + return result; + ; + }, TMP_Hash_select$B_61.$$arity = 0); + + Opal.def(self, '$shift', TMP_Hash_shift_63 = function $$shift() { + var self = this; + + + var keys = self.$$keys, + key; + + if (keys.length > 0) { + key = keys[0]; + + key = key.$$is_string ? key : key.key; + + return [key, Opal.hash_delete(self, key)]; + } + + return self.$default(nil); + + }, TMP_Hash_shift_63.$$arity = 0); + Opal.alias(self, "size", "length"); + + Opal.def(self, '$slice', TMP_Hash_slice_64 = function $$slice($a) { + var $post_args, keys, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + keys = $post_args;; + + var result = Opal.hash(); + + for (var i = 0, length = keys.length; i < length; i++) { + var key = keys[i], value = Opal.hash_get(self, key); + + if (value !== undefined) { + Opal.hash_put(result, key, value); + } + } + + return result; + ; + }, TMP_Hash_slice_64.$$arity = -1); + Opal.alias(self, "store", "[]="); + + Opal.def(self, '$to_a', TMP_Hash_to_a_65 = function $$to_a() { + var self = this; + + + var result = []; + + for (var i = 0, keys = self.$$keys, length = keys.length, key, value; i < length; i++) { + key = keys[i]; + + if (key.$$is_string) { + value = self.$$smap[key]; + } else { + value = key.value; + key = key.key; + } + + result.push([key, value]); + } + + return result; + + }, TMP_Hash_to_a_65.$$arity = 0); + + Opal.def(self, '$to_h', TMP_Hash_to_h_66 = function $$to_h() { + var self = this; + + + if (self.$$class === Opal.Hash) { + return self; + } + + var hash = new Opal.Hash(); + + Opal.hash_init(hash); + Opal.hash_clone(self, hash); + + return hash; + + }, TMP_Hash_to_h_66.$$arity = 0); + + Opal.def(self, '$to_hash', TMP_Hash_to_hash_67 = function $$to_hash() { + var self = this; + + return self + }, TMP_Hash_to_hash_67.$$arity = 0); + + Opal.def(self, '$to_proc', TMP_Hash_to_proc_68 = function $$to_proc() { + var TMP_69, self = this; + + return $send(self, 'proc', [], (TMP_69 = function(key){var self = TMP_69.$$s || this; + + + ; + + if (key == null) { + self.$raise($$($nesting, 'ArgumentError'), "no key given") + } + ; + return self['$[]'](key);}, TMP_69.$$s = self, TMP_69.$$arity = -1, TMP_69)) + }, TMP_Hash_to_proc_68.$$arity = 0); + Opal.alias(self, "to_s", "inspect"); + + Opal.def(self, '$transform_keys', TMP_Hash_transform_keys_70 = function $$transform_keys() { + var $iter = TMP_Hash_transform_keys_70.$$p, block = $iter || nil, TMP_71, self = this; + + if ($iter) TMP_Hash_transform_keys_70.$$p = null; + + + if ($iter) TMP_Hash_transform_keys_70.$$p = null;; + if ($truthy(block)) { + } else { + return $send(self, 'enum_for', ["transform_keys"], (TMP_71 = function(){var self = TMP_71.$$s || this; + + return self.$size()}, TMP_71.$$s = self, TMP_71.$$arity = 0, TMP_71)) + }; + + var result = Opal.hash(); + + for (var i = 0, keys = self.$$keys, length = keys.length, key, value; i < length; i++) { + key = keys[i]; + + if (key.$$is_string) { + value = self.$$smap[key]; + } else { + value = key.value; + key = key.key; + } + + key = Opal.yield1(block, key); + + Opal.hash_put(result, key, value); + } + + return result; + ; + }, TMP_Hash_transform_keys_70.$$arity = 0); + + Opal.def(self, '$transform_keys!', TMP_Hash_transform_keys$B_72 = function() { + var $iter = TMP_Hash_transform_keys$B_72.$$p, block = $iter || nil, TMP_73, self = this; + + if ($iter) TMP_Hash_transform_keys$B_72.$$p = null; + + + if ($iter) TMP_Hash_transform_keys$B_72.$$p = null;; + if ($truthy(block)) { + } else { + return $send(self, 'enum_for', ["transform_keys!"], (TMP_73 = function(){var self = TMP_73.$$s || this; + + return self.$size()}, TMP_73.$$s = self, TMP_73.$$arity = 0, TMP_73)) + }; + + var keys = Opal.slice.call(self.$$keys), + i, length = keys.length, key, value, new_key; + + for (i = 0; i < length; i++) { + key = keys[i]; + + if (key.$$is_string) { + value = self.$$smap[key]; + } else { + value = key.value; + key = key.key; + } + + new_key = Opal.yield1(block, key); + + Opal.hash_delete(self, key); + Opal.hash_put(self, new_key, value); + } + + return self; + ; + }, TMP_Hash_transform_keys$B_72.$$arity = 0); + + Opal.def(self, '$transform_values', TMP_Hash_transform_values_74 = function $$transform_values() { + var $iter = TMP_Hash_transform_values_74.$$p, block = $iter || nil, TMP_75, self = this; + + if ($iter) TMP_Hash_transform_values_74.$$p = null; + + + if ($iter) TMP_Hash_transform_values_74.$$p = null;; + if ($truthy(block)) { + } else { + return $send(self, 'enum_for', ["transform_values"], (TMP_75 = function(){var self = TMP_75.$$s || this; + + return self.$size()}, TMP_75.$$s = self, TMP_75.$$arity = 0, TMP_75)) + }; + + var result = Opal.hash(); + + for (var i = 0, keys = self.$$keys, length = keys.length, key, value; i < length; i++) { + key = keys[i]; + + if (key.$$is_string) { + value = self.$$smap[key]; + } else { + value = key.value; + key = key.key; + } + + value = Opal.yield1(block, value); + + Opal.hash_put(result, key, value); + } + + return result; + ; + }, TMP_Hash_transform_values_74.$$arity = 0); + + Opal.def(self, '$transform_values!', TMP_Hash_transform_values$B_76 = function() { + var $iter = TMP_Hash_transform_values$B_76.$$p, block = $iter || nil, TMP_77, self = this; + + if ($iter) TMP_Hash_transform_values$B_76.$$p = null; + + + if ($iter) TMP_Hash_transform_values$B_76.$$p = null;; + if ($truthy(block)) { + } else { + return $send(self, 'enum_for', ["transform_values!"], (TMP_77 = function(){var self = TMP_77.$$s || this; + + return self.$size()}, TMP_77.$$s = self, TMP_77.$$arity = 0, TMP_77)) + }; + + for (var i = 0, keys = self.$$keys, length = keys.length, key, value; i < length; i++) { + key = keys[i]; + + if (key.$$is_string) { + value = self.$$smap[key]; + } else { + value = key.value; + key = key.key; + } + + value = Opal.yield1(block, value); + + Opal.hash_put(self, key, value); + } + + return self; + ; + }, TMP_Hash_transform_values$B_76.$$arity = 0); + Opal.alias(self, "update", "merge!"); + Opal.alias(self, "value?", "has_value?"); + Opal.alias(self, "values_at", "indexes"); + return (Opal.def(self, '$values', TMP_Hash_values_78 = function $$values() { + var self = this; + + + var result = []; + + for (var i = 0, keys = self.$$keys, length = keys.length, key; i < length; i++) { + key = keys[i]; + + if (key.$$is_string) { + result.push(self.$$smap[key]); + } else { + result.push(key.value); + } + } + + return result; + + }, TMP_Hash_values_78.$$arity = 0), nil) && 'values'; + })($nesting[0], null, $nesting); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/number"] = function(Opal) { + function $rb_gt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); + } + function $rb_lt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); + } + function $rb_plus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); + } + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + function $rb_divide(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs / rhs : lhs['$/'](rhs); + } + function $rb_times(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs * rhs : lhs['$*'](rhs); + } + function $rb_le(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs <= rhs : lhs['$<='](rhs); + } + function $rb_ge(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs >= rhs : lhs['$>='](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $truthy = Opal.truthy, $send = Opal.send, $hash2 = Opal.hash2; + + Opal.add_stubs(['$require', '$bridge', '$raise', '$name', '$class', '$Float', '$respond_to?', '$coerce_to!', '$__coerced__', '$===', '$!', '$>', '$**', '$new', '$<', '$to_f', '$==', '$nan?', '$infinite?', '$enum_for', '$+', '$-', '$gcd', '$lcm', '$%', '$/', '$frexp', '$to_i', '$ldexp', '$rationalize', '$*', '$<<', '$to_r', '$truncate', '$-@', '$size', '$<=', '$>=', '$<=>', '$compare', '$any?']); + + self.$require("corelib/numeric"); + (function($base, $super, $parent_nesting) { + function $Number(){}; + var self = $Number = $klass($base, $super, 'Number', $Number); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Number_coerce_2, TMP_Number___id___3, TMP_Number_$_4, TMP_Number_$_5, TMP_Number_$_6, TMP_Number_$_7, TMP_Number_$_8, TMP_Number_$_9, TMP_Number_$_10, TMP_Number_$_11, TMP_Number_$lt_12, TMP_Number_$lt$eq_13, TMP_Number_$gt_14, TMP_Number_$gt$eq_15, TMP_Number_$lt$eq$gt_16, TMP_Number_$lt$lt_17, TMP_Number_$gt$gt_18, TMP_Number_$$_19, TMP_Number_$$_20, TMP_Number_$$_21, TMP_Number_$_22, TMP_Number_$$_23, TMP_Number_$eq$eq$eq_24, TMP_Number_$eq$eq_25, TMP_Number_abs_26, TMP_Number_abs2_27, TMP_Number_allbits$q_28, TMP_Number_anybits$q_29, TMP_Number_angle_30, TMP_Number_bit_length_31, TMP_Number_ceil_32, TMP_Number_chr_33, TMP_Number_denominator_34, TMP_Number_downto_35, TMP_Number_equal$q_37, TMP_Number_even$q_38, TMP_Number_floor_39, TMP_Number_gcd_40, TMP_Number_gcdlcm_41, TMP_Number_integer$q_42, TMP_Number_is_a$q_43, TMP_Number_instance_of$q_44, TMP_Number_lcm_45, TMP_Number_next_46, TMP_Number_nobits$q_47, TMP_Number_nonzero$q_48, TMP_Number_numerator_49, TMP_Number_odd$q_50, TMP_Number_ord_51, TMP_Number_pow_52, TMP_Number_pred_53, TMP_Number_quo_54, TMP_Number_rationalize_55, TMP_Number_remainder_56, TMP_Number_round_57, TMP_Number_step_58, TMP_Number_times_60, TMP_Number_to_f_62, TMP_Number_to_i_63, TMP_Number_to_r_64, TMP_Number_to_s_65, TMP_Number_truncate_66, TMP_Number_digits_67, TMP_Number_divmod_68, TMP_Number_upto_69, TMP_Number_zero$q_71, TMP_Number_size_72, TMP_Number_nan$q_73, TMP_Number_finite$q_74, TMP_Number_infinite$q_75, TMP_Number_positive$q_76, TMP_Number_negative$q_77; + + + $$($nesting, 'Opal').$bridge(Number, self); + Opal.defineProperty(Number.prototype, '$$is_number', true); + self.$$is_number_class = true; + (function(self, $parent_nesting) { + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_allocate_1; + + + + Opal.def(self, '$allocate', TMP_allocate_1 = function $$allocate() { + var self = this; + + return self.$raise($$($nesting, 'TypeError'), "" + "allocator undefined for " + (self.$name())) + }, TMP_allocate_1.$$arity = 0); + + + Opal.udef(self, '$' + "new");; + return nil;; + })(Opal.get_singleton_class(self), $nesting); + + Opal.def(self, '$coerce', TMP_Number_coerce_2 = function $$coerce(other) { + var self = this; + + + if (other === nil) { + self.$raise($$($nesting, 'TypeError'), "" + "can't convert " + (other.$class()) + " into Float"); + } + else if (other.$$is_string) { + return [self.$Float(other), self]; + } + else if (other['$respond_to?']("to_f")) { + return [$$($nesting, 'Opal')['$coerce_to!'](other, $$($nesting, 'Float'), "to_f"), self]; + } + else if (other.$$is_number) { + return [other, self]; + } + else { + self.$raise($$($nesting, 'TypeError'), "" + "can't convert " + (other.$class()) + " into Float"); + } + + }, TMP_Number_coerce_2.$$arity = 1); + + Opal.def(self, '$__id__', TMP_Number___id___3 = function $$__id__() { + var self = this; + + return (self * 2) + 1; + }, TMP_Number___id___3.$$arity = 0); + Opal.alias(self, "object_id", "__id__"); + + Opal.def(self, '$+', TMP_Number_$_4 = function(other) { + var self = this; + + + if (other.$$is_number) { + return self + other; + } + else { + return self.$__coerced__("+", other); + } + + }, TMP_Number_$_4.$$arity = 1); + + Opal.def(self, '$-', TMP_Number_$_5 = function(other) { + var self = this; + + + if (other.$$is_number) { + return self - other; + } + else { + return self.$__coerced__("-", other); + } + + }, TMP_Number_$_5.$$arity = 1); + + Opal.def(self, '$*', TMP_Number_$_6 = function(other) { + var self = this; + + + if (other.$$is_number) { + return self * other; + } + else { + return self.$__coerced__("*", other); + } + + }, TMP_Number_$_6.$$arity = 1); + + Opal.def(self, '$/', TMP_Number_$_7 = function(other) { + var self = this; + + + if (other.$$is_number) { + return self / other; + } + else { + return self.$__coerced__("/", other); + } + + }, TMP_Number_$_7.$$arity = 1); + Opal.alias(self, "fdiv", "/"); + + Opal.def(self, '$%', TMP_Number_$_8 = function(other) { + var self = this; + + + if (other.$$is_number) { + if (other == -Infinity) { + return other; + } + else if (other == 0) { + self.$raise($$($nesting, 'ZeroDivisionError'), "divided by 0"); + } + else if (other < 0 || self < 0) { + return (self % other + other) % other; + } + else { + return self % other; + } + } + else { + return self.$__coerced__("%", other); + } + + }, TMP_Number_$_8.$$arity = 1); + + Opal.def(self, '$&', TMP_Number_$_9 = function(other) { + var self = this; + + + if (other.$$is_number) { + return self & other; + } + else { + return self.$__coerced__("&", other); + } + + }, TMP_Number_$_9.$$arity = 1); + + Opal.def(self, '$|', TMP_Number_$_10 = function(other) { + var self = this; + + + if (other.$$is_number) { + return self | other; + } + else { + return self.$__coerced__("|", other); + } + + }, TMP_Number_$_10.$$arity = 1); + + Opal.def(self, '$^', TMP_Number_$_11 = function(other) { + var self = this; + + + if (other.$$is_number) { + return self ^ other; + } + else { + return self.$__coerced__("^", other); + } + + }, TMP_Number_$_11.$$arity = 1); + + Opal.def(self, '$<', TMP_Number_$lt_12 = function(other) { + var self = this; + + + if (other.$$is_number) { + return self < other; + } + else { + return self.$__coerced__("<", other); + } + + }, TMP_Number_$lt_12.$$arity = 1); + + Opal.def(self, '$<=', TMP_Number_$lt$eq_13 = function(other) { + var self = this; + + + if (other.$$is_number) { + return self <= other; + } + else { + return self.$__coerced__("<=", other); + } + + }, TMP_Number_$lt$eq_13.$$arity = 1); + + Opal.def(self, '$>', TMP_Number_$gt_14 = function(other) { + var self = this; + + + if (other.$$is_number) { + return self > other; + } + else { + return self.$__coerced__(">", other); + } + + }, TMP_Number_$gt_14.$$arity = 1); + + Opal.def(self, '$>=', TMP_Number_$gt$eq_15 = function(other) { + var self = this; + + + if (other.$$is_number) { + return self >= other; + } + else { + return self.$__coerced__(">=", other); + } + + }, TMP_Number_$gt$eq_15.$$arity = 1); + + var spaceship_operator = function(self, other) { + if (other.$$is_number) { + if (isNaN(self) || isNaN(other)) { + return nil; + } + + if (self > other) { + return 1; + } else if (self < other) { + return -1; + } else { + return 0; + } + } + else { + return self.$__coerced__("<=>", other); + } + } + ; + + Opal.def(self, '$<=>', TMP_Number_$lt$eq$gt_16 = function(other) { + var self = this; + + try { + return spaceship_operator(self, other); + } catch ($err) { + if (Opal.rescue($err, [$$($nesting, 'ArgumentError')])) { + try { + return nil + } finally { Opal.pop_exception() } + } else { throw $err; } + } + }, TMP_Number_$lt$eq$gt_16.$$arity = 1); + + Opal.def(self, '$<<', TMP_Number_$lt$lt_17 = function(count) { + var self = this; + + + count = $$($nesting, 'Opal')['$coerce_to!'](count, $$($nesting, 'Integer'), "to_int"); + return count > 0 ? self << count : self >> -count; + }, TMP_Number_$lt$lt_17.$$arity = 1); + + Opal.def(self, '$>>', TMP_Number_$gt$gt_18 = function(count) { + var self = this; + + + count = $$($nesting, 'Opal')['$coerce_to!'](count, $$($nesting, 'Integer'), "to_int"); + return count > 0 ? self >> count : self << -count; + }, TMP_Number_$gt$gt_18.$$arity = 1); + + Opal.def(self, '$[]', TMP_Number_$$_19 = function(bit) { + var self = this; + + + bit = $$($nesting, 'Opal')['$coerce_to!'](bit, $$($nesting, 'Integer'), "to_int"); + + if (bit < 0) { + return 0; + } + if (bit >= 32) { + return self < 0 ? 1 : 0; + } + return (self >> bit) & 1; + ; + }, TMP_Number_$$_19.$$arity = 1); + + Opal.def(self, '$+@', TMP_Number_$$_20 = function() { + var self = this; + + return +self; + }, TMP_Number_$$_20.$$arity = 0); + + Opal.def(self, '$-@', TMP_Number_$$_21 = function() { + var self = this; + + return -self; + }, TMP_Number_$$_21.$$arity = 0); + + Opal.def(self, '$~', TMP_Number_$_22 = function() { + var self = this; + + return ~self; + }, TMP_Number_$_22.$$arity = 0); + + Opal.def(self, '$**', TMP_Number_$$_23 = function(other) { + var $a, $b, self = this; + + if ($truthy($$($nesting, 'Integer')['$==='](other))) { + if ($truthy(($truthy($a = $$($nesting, 'Integer')['$==='](self)['$!']()) ? $a : $rb_gt(other, 0)))) { + return Math.pow(self, other); + } else { + return $$($nesting, 'Rational').$new(self, 1)['$**'](other) + } + } else if ($truthy((($a = $rb_lt(self, 0)) ? ($truthy($b = $$($nesting, 'Float')['$==='](other)) ? $b : $$($nesting, 'Rational')['$==='](other)) : $rb_lt(self, 0)))) { + return $$($nesting, 'Complex').$new(self, 0)['$**'](other.$to_f()) + } else if ($truthy(other.$$is_number != null)) { + return Math.pow(self, other); + } else { + return self.$__coerced__("**", other) + } + }, TMP_Number_$$_23.$$arity = 1); + + Opal.def(self, '$===', TMP_Number_$eq$eq$eq_24 = function(other) { + var self = this; + + + if (other.$$is_number) { + return self.valueOf() === other.valueOf(); + } + else if (other['$respond_to?']("==")) { + return other['$=='](self); + } + else { + return false; + } + + }, TMP_Number_$eq$eq$eq_24.$$arity = 1); + + Opal.def(self, '$==', TMP_Number_$eq$eq_25 = function(other) { + var self = this; + + + if (other.$$is_number) { + return self.valueOf() === other.valueOf(); + } + else if (other['$respond_to?']("==")) { + return other['$=='](self); + } + else { + return false; + } + + }, TMP_Number_$eq$eq_25.$$arity = 1); + + Opal.def(self, '$abs', TMP_Number_abs_26 = function $$abs() { + var self = this; + + return Math.abs(self); + }, TMP_Number_abs_26.$$arity = 0); + + Opal.def(self, '$abs2', TMP_Number_abs2_27 = function $$abs2() { + var self = this; + + return Math.abs(self * self); + }, TMP_Number_abs2_27.$$arity = 0); + + Opal.def(self, '$allbits?', TMP_Number_allbits$q_28 = function(mask) { + var self = this; + + + mask = $$($nesting, 'Opal')['$coerce_to!'](mask, $$($nesting, 'Integer'), "to_int"); + return (self & mask) == mask;; + }, TMP_Number_allbits$q_28.$$arity = 1); + + Opal.def(self, '$anybits?', TMP_Number_anybits$q_29 = function(mask) { + var self = this; + + + mask = $$($nesting, 'Opal')['$coerce_to!'](mask, $$($nesting, 'Integer'), "to_int"); + return (self & mask) !== 0;; + }, TMP_Number_anybits$q_29.$$arity = 1); + + Opal.def(self, '$angle', TMP_Number_angle_30 = function $$angle() { + var self = this; + + + if ($truthy(self['$nan?']())) { + return self}; + + if (self == 0) { + if (1 / self > 0) { + return 0; + } + else { + return Math.PI; + } + } + else if (self < 0) { + return Math.PI; + } + else { + return 0; + } + ; + }, TMP_Number_angle_30.$$arity = 0); + Opal.alias(self, "arg", "angle"); + Opal.alias(self, "phase", "angle"); + + Opal.def(self, '$bit_length', TMP_Number_bit_length_31 = function $$bit_length() { + var self = this; + + + if ($truthy($$($nesting, 'Integer')['$==='](self))) { + } else { + self.$raise($$($nesting, 'NoMethodError').$new("" + "undefined method `bit_length` for " + (self) + ":Float", "bit_length")) + }; + + if (self === 0 || self === -1) { + return 0; + } + + var result = 0, + value = self < 0 ? ~self : self; + + while (value != 0) { + result += 1; + value >>>= 1; + } + + return result; + ; + }, TMP_Number_bit_length_31.$$arity = 0); + + Opal.def(self, '$ceil', TMP_Number_ceil_32 = function $$ceil(ndigits) { + var self = this; + + + + if (ndigits == null) { + ndigits = 0; + }; + + var f = self.$to_f(); + + if (f % 1 === 0 && ndigits >= 0) { + return f; + } + + var factor = Math.pow(10, ndigits), + result = Math.ceil(f * factor) / factor; + + if (f % 1 === 0) { + result = Math.round(result); + } + + return result; + ; + }, TMP_Number_ceil_32.$$arity = -1); + + Opal.def(self, '$chr', TMP_Number_chr_33 = function $$chr(encoding) { + var self = this; + + + ; + return String.fromCharCode(self);; + }, TMP_Number_chr_33.$$arity = -1); + + Opal.def(self, '$denominator', TMP_Number_denominator_34 = function $$denominator() { + var $a, $iter = TMP_Number_denominator_34.$$p, $yield = $iter || nil, self = this, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_Number_denominator_34.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + if ($truthy(($truthy($a = self['$nan?']()) ? $a : self['$infinite?']()))) { + return 1 + } else { + return $send(self, Opal.find_super_dispatcher(self, 'denominator', TMP_Number_denominator_34, false), $zuper, $iter) + } + }, TMP_Number_denominator_34.$$arity = 0); + + Opal.def(self, '$downto', TMP_Number_downto_35 = function $$downto(stop) { + var $iter = TMP_Number_downto_35.$$p, block = $iter || nil, TMP_36, self = this; + + if ($iter) TMP_Number_downto_35.$$p = null; + + + if ($iter) TMP_Number_downto_35.$$p = null;; + if ((block !== nil)) { + } else { + return $send(self, 'enum_for', ["downto", stop], (TMP_36 = function(){var self = TMP_36.$$s || this; + + + if ($truthy($$($nesting, 'Numeric')['$==='](stop))) { + } else { + self.$raise($$($nesting, 'ArgumentError'), "" + "comparison of " + (self.$class()) + " with " + (stop.$class()) + " failed") + }; + if ($truthy($rb_gt(stop, self))) { + return 0 + } else { + return $rb_plus($rb_minus(self, stop), 1) + };}, TMP_36.$$s = self, TMP_36.$$arity = 0, TMP_36)) + }; + + if (!stop.$$is_number) { + self.$raise($$($nesting, 'ArgumentError'), "" + "comparison of " + (self.$class()) + " with " + (stop.$class()) + " failed") + } + for (var i = self; i >= stop; i--) { + block(i); + } + ; + return self; + }, TMP_Number_downto_35.$$arity = 1); + Opal.alias(self, "eql?", "=="); + + Opal.def(self, '$equal?', TMP_Number_equal$q_37 = function(other) { + var $a, self = this; + + return ($truthy($a = self['$=='](other)) ? $a : isNaN(self) && isNaN(other)) + }, TMP_Number_equal$q_37.$$arity = 1); + + Opal.def(self, '$even?', TMP_Number_even$q_38 = function() { + var self = this; + + return self % 2 === 0; + }, TMP_Number_even$q_38.$$arity = 0); + + Opal.def(self, '$floor', TMP_Number_floor_39 = function $$floor(ndigits) { + var self = this; + + + + if (ndigits == null) { + ndigits = 0; + }; + + var f = self.$to_f(); + + if (f % 1 === 0 && ndigits >= 0) { + return f; + } + + var factor = Math.pow(10, ndigits), + result = Math.floor(f * factor) / factor; + + if (f % 1 === 0) { + result = Math.round(result); + } + + return result; + ; + }, TMP_Number_floor_39.$$arity = -1); + + Opal.def(self, '$gcd', TMP_Number_gcd_40 = function $$gcd(other) { + var self = this; + + + if ($truthy($$($nesting, 'Integer')['$==='](other))) { + } else { + self.$raise($$($nesting, 'TypeError'), "not an integer") + }; + + var min = Math.abs(self), + max = Math.abs(other); + + while (min > 0) { + var tmp = min; + + min = max % min; + max = tmp; + } + + return max; + ; + }, TMP_Number_gcd_40.$$arity = 1); + + Opal.def(self, '$gcdlcm', TMP_Number_gcdlcm_41 = function $$gcdlcm(other) { + var self = this; + + return [self.$gcd(), self.$lcm()] + }, TMP_Number_gcdlcm_41.$$arity = 1); + + Opal.def(self, '$integer?', TMP_Number_integer$q_42 = function() { + var self = this; + + return self % 1 === 0; + }, TMP_Number_integer$q_42.$$arity = 0); + + Opal.def(self, '$is_a?', TMP_Number_is_a$q_43 = function(klass) { + var $a, $iter = TMP_Number_is_a$q_43.$$p, $yield = $iter || nil, self = this, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_Number_is_a$q_43.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + + if ($truthy((($a = klass['$==']($$($nesting, 'Integer'))) ? $$($nesting, 'Integer')['$==='](self) : klass['$==']($$($nesting, 'Integer'))))) { + return true}; + if ($truthy((($a = klass['$==']($$($nesting, 'Integer'))) ? $$($nesting, 'Integer')['$==='](self) : klass['$==']($$($nesting, 'Integer'))))) { + return true}; + if ($truthy((($a = klass['$==']($$($nesting, 'Float'))) ? $$($nesting, 'Float')['$==='](self) : klass['$==']($$($nesting, 'Float'))))) { + return true}; + return $send(self, Opal.find_super_dispatcher(self, 'is_a?', TMP_Number_is_a$q_43, false), $zuper, $iter); + }, TMP_Number_is_a$q_43.$$arity = 1); + Opal.alias(self, "kind_of?", "is_a?"); + + Opal.def(self, '$instance_of?', TMP_Number_instance_of$q_44 = function(klass) { + var $a, $iter = TMP_Number_instance_of$q_44.$$p, $yield = $iter || nil, self = this, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_Number_instance_of$q_44.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + + if ($truthy((($a = klass['$==']($$($nesting, 'Integer'))) ? $$($nesting, 'Integer')['$==='](self) : klass['$==']($$($nesting, 'Integer'))))) { + return true}; + if ($truthy((($a = klass['$==']($$($nesting, 'Integer'))) ? $$($nesting, 'Integer')['$==='](self) : klass['$==']($$($nesting, 'Integer'))))) { + return true}; + if ($truthy((($a = klass['$==']($$($nesting, 'Float'))) ? $$($nesting, 'Float')['$==='](self) : klass['$==']($$($nesting, 'Float'))))) { + return true}; + return $send(self, Opal.find_super_dispatcher(self, 'instance_of?', TMP_Number_instance_of$q_44, false), $zuper, $iter); + }, TMP_Number_instance_of$q_44.$$arity = 1); + + Opal.def(self, '$lcm', TMP_Number_lcm_45 = function $$lcm(other) { + var self = this; + + + if ($truthy($$($nesting, 'Integer')['$==='](other))) { + } else { + self.$raise($$($nesting, 'TypeError'), "not an integer") + }; + + if (self == 0 || other == 0) { + return 0; + } + else { + return Math.abs(self * other / self.$gcd(other)); + } + ; + }, TMP_Number_lcm_45.$$arity = 1); + Opal.alias(self, "magnitude", "abs"); + Opal.alias(self, "modulo", "%"); + + Opal.def(self, '$next', TMP_Number_next_46 = function $$next() { + var self = this; + + return self + 1; + }, TMP_Number_next_46.$$arity = 0); + + Opal.def(self, '$nobits?', TMP_Number_nobits$q_47 = function(mask) { + var self = this; + + + mask = $$($nesting, 'Opal')['$coerce_to!'](mask, $$($nesting, 'Integer'), "to_int"); + return (self & mask) == 0;; + }, TMP_Number_nobits$q_47.$$arity = 1); + + Opal.def(self, '$nonzero?', TMP_Number_nonzero$q_48 = function() { + var self = this; + + return self == 0 ? nil : self; + }, TMP_Number_nonzero$q_48.$$arity = 0); + + Opal.def(self, '$numerator', TMP_Number_numerator_49 = function $$numerator() { + var $a, $iter = TMP_Number_numerator_49.$$p, $yield = $iter || nil, self = this, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_Number_numerator_49.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + if ($truthy(($truthy($a = self['$nan?']()) ? $a : self['$infinite?']()))) { + return self + } else { + return $send(self, Opal.find_super_dispatcher(self, 'numerator', TMP_Number_numerator_49, false), $zuper, $iter) + } + }, TMP_Number_numerator_49.$$arity = 0); + + Opal.def(self, '$odd?', TMP_Number_odd$q_50 = function() { + var self = this; + + return self % 2 !== 0; + }, TMP_Number_odd$q_50.$$arity = 0); + + Opal.def(self, '$ord', TMP_Number_ord_51 = function $$ord() { + var self = this; + + return self + }, TMP_Number_ord_51.$$arity = 0); + + Opal.def(self, '$pow', TMP_Number_pow_52 = function $$pow(b, m) { + var self = this; + + + ; + + if (self == 0) { + self.$raise($$($nesting, 'ZeroDivisionError'), "divided by 0") + } + + if (m === undefined) { + return self['$**'](b); + } else { + if (!($$($nesting, 'Integer')['$==='](b))) { + self.$raise($$($nesting, 'TypeError'), "Integer#pow() 2nd argument not allowed unless a 1st argument is integer") + } + + if (b < 0) { + self.$raise($$($nesting, 'TypeError'), "Integer#pow() 1st argument cannot be negative when 2nd argument specified") + } + + if (!($$($nesting, 'Integer')['$==='](m))) { + self.$raise($$($nesting, 'TypeError'), "Integer#pow() 2nd argument not allowed unless all arguments are integers") + } + + if (m === 0) { + self.$raise($$($nesting, 'ZeroDivisionError'), "divided by 0") + } + + return self['$**'](b)['$%'](m) + } + ; + }, TMP_Number_pow_52.$$arity = -2); + + Opal.def(self, '$pred', TMP_Number_pred_53 = function $$pred() { + var self = this; + + return self - 1; + }, TMP_Number_pred_53.$$arity = 0); + + Opal.def(self, '$quo', TMP_Number_quo_54 = function $$quo(other) { + var $iter = TMP_Number_quo_54.$$p, $yield = $iter || nil, self = this, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_Number_quo_54.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + if ($truthy($$($nesting, 'Integer')['$==='](self))) { + return $send(self, Opal.find_super_dispatcher(self, 'quo', TMP_Number_quo_54, false), $zuper, $iter) + } else { + return $rb_divide(self, other) + } + }, TMP_Number_quo_54.$$arity = 1); + + Opal.def(self, '$rationalize', TMP_Number_rationalize_55 = function $$rationalize(eps) { + var $a, $b, self = this, f = nil, n = nil; + + + ; + + if (arguments.length > 1) { + self.$raise($$($nesting, 'ArgumentError'), "" + "wrong number of arguments (" + (arguments.length) + " for 0..1)"); + } + ; + if ($truthy($$($nesting, 'Integer')['$==='](self))) { + return $$($nesting, 'Rational').$new(self, 1) + } else if ($truthy(self['$infinite?']())) { + return self.$raise($$($nesting, 'FloatDomainError'), "Infinity") + } else if ($truthy(self['$nan?']())) { + return self.$raise($$($nesting, 'FloatDomainError'), "NaN") + } else if ($truthy(eps == null)) { + + $b = $$($nesting, 'Math').$frexp(self), $a = Opal.to_ary($b), (f = ($a[0] == null ? nil : $a[0])), (n = ($a[1] == null ? nil : $a[1])), $b; + f = $$($nesting, 'Math').$ldexp(f, $$$($$($nesting, 'Float'), 'MANT_DIG')).$to_i(); + n = $rb_minus(n, $$$($$($nesting, 'Float'), 'MANT_DIG')); + return $$($nesting, 'Rational').$new($rb_times(2, f), (1)['$<<']($rb_minus(1, n))).$rationalize($$($nesting, 'Rational').$new(1, (1)['$<<']($rb_minus(1, n)))); + } else { + return self.$to_r().$rationalize(eps) + }; + }, TMP_Number_rationalize_55.$$arity = -1); + + Opal.def(self, '$remainder', TMP_Number_remainder_56 = function $$remainder(y) { + var self = this; + + return $rb_minus(self, $rb_times(y, $rb_divide(self, y).$truncate())) + }, TMP_Number_remainder_56.$$arity = 1); + + Opal.def(self, '$round', TMP_Number_round_57 = function $$round(ndigits) { + var $a, $b, self = this, _ = nil, exp = nil; + + + ; + if ($truthy($$($nesting, 'Integer')['$==='](self))) { + + if ($truthy(ndigits == null)) { + return self}; + if ($truthy(($truthy($a = $$($nesting, 'Float')['$==='](ndigits)) ? ndigits['$infinite?']() : $a))) { + self.$raise($$($nesting, 'RangeError'), "Infinity")}; + ndigits = $$($nesting, 'Opal')['$coerce_to!'](ndigits, $$($nesting, 'Integer'), "to_int"); + if ($truthy($rb_lt(ndigits, $$$($$($nesting, 'Integer'), 'MIN')))) { + self.$raise($$($nesting, 'RangeError'), "out of bounds")}; + if ($truthy(ndigits >= 0)) { + return self}; + ndigits = ndigits['$-@'](); + + if (0.415241 * ndigits - 0.125 > self.$size()) { + return 0; + } + + var f = Math.pow(10, ndigits), + x = Math.floor((Math.abs(x) + f / 2) / f) * f; + + return self < 0 ? -x : x; + ; + } else { + + if ($truthy(($truthy($a = self['$nan?']()) ? ndigits == null : $a))) { + self.$raise($$($nesting, 'FloatDomainError'), "NaN")}; + ndigits = $$($nesting, 'Opal')['$coerce_to!'](ndigits || 0, $$($nesting, 'Integer'), "to_int"); + if ($truthy($rb_le(ndigits, 0))) { + if ($truthy(self['$nan?']())) { + self.$raise($$($nesting, 'RangeError'), "NaN") + } else if ($truthy(self['$infinite?']())) { + self.$raise($$($nesting, 'FloatDomainError'), "Infinity")} + } else if (ndigits['$=='](0)) { + return Math.round(self) + } else if ($truthy(($truthy($a = self['$nan?']()) ? $a : self['$infinite?']()))) { + return self}; + $b = $$($nesting, 'Math').$frexp(self), $a = Opal.to_ary($b), (_ = ($a[0] == null ? nil : $a[0])), (exp = ($a[1] == null ? nil : $a[1])), $b; + if ($truthy($rb_ge(ndigits, $rb_minus($rb_plus($$$($$($nesting, 'Float'), 'DIG'), 2), (function() {if ($truthy($rb_gt(exp, 0))) { + return $rb_divide(exp, 4) + } else { + return $rb_minus($rb_divide(exp, 3), 1) + }; return nil; })())))) { + return self}; + if ($truthy($rb_lt(ndigits, (function() {if ($truthy($rb_gt(exp, 0))) { + return $rb_plus($rb_divide(exp, 3), 1) + } else { + return $rb_divide(exp, 4) + }; return nil; })()['$-@']()))) { + return 0}; + return Math.round(self * Math.pow(10, ndigits)) / Math.pow(10, ndigits);; + }; + }, TMP_Number_round_57.$$arity = -1); + + Opal.def(self, '$step', TMP_Number_step_58 = function $$step($a, $b, $c) { + var $iter = TMP_Number_step_58.$$p, block = $iter || nil, $post_args, $kwargs, limit, step, to, by, TMP_59, self = this, positional_args = nil, keyword_args = nil; + + if ($iter) TMP_Number_step_58.$$p = null; + + + if ($iter) TMP_Number_step_58.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + $kwargs = Opal.extract_kwargs($post_args); + + if ($kwargs == null) { + $kwargs = $hash2([], {}); + } else if (!$kwargs.$$is_hash) { + throw Opal.ArgumentError.$new('expected kwargs'); + }; + + if ($post_args.length > 0) { + limit = $post_args[0]; + $post_args.splice(0, 1); + }; + + if ($post_args.length > 0) { + step = $post_args[0]; + $post_args.splice(0, 1); + }; + + to = $kwargs.$$smap["to"];; + + by = $kwargs.$$smap["by"];; + + if (limit !== undefined && to !== undefined) { + self.$raise($$($nesting, 'ArgumentError'), "to is given twice") + } + + if (step !== undefined && by !== undefined) { + self.$raise($$($nesting, 'ArgumentError'), "step is given twice") + } + + function validateParameters() { + if (to !== undefined) { + limit = to; + } + + if (limit === undefined) { + limit = nil; + } + + if (step === nil) { + self.$raise($$($nesting, 'TypeError'), "step must be numeric") + } + + if (step === 0) { + self.$raise($$($nesting, 'ArgumentError'), "step can't be 0") + } + + if (by !== undefined) { + step = by; + } + + if (step === nil || step == null) { + step = 1; + } + + var sign = step['$<=>'](0); + + if (sign === nil) { + self.$raise($$($nesting, 'ArgumentError'), "" + "0 can't be coerced into " + (step.$class())) + } + + if (limit === nil || limit == null) { + limit = sign > 0 ? $$$($$($nesting, 'Float'), 'INFINITY') : $$$($$($nesting, 'Float'), 'INFINITY')['$-@'](); + } + + $$($nesting, 'Opal').$compare(self, limit) + } + + function stepFloatSize() { + if ((step > 0 && self > limit) || (step < 0 && self < limit)) { + return 0; + } else if (step === Infinity || step === -Infinity) { + return 1; + } else { + var abs = Math.abs, floor = Math.floor, + err = (abs(self) + abs(limit) + abs(limit - self)) / abs(step) * $$$($$($nesting, 'Float'), 'EPSILON'); + + if (err === Infinity || err === -Infinity) { + return 0; + } else { + if (err > 0.5) { + err = 0.5; + } + + return floor((limit - self) / step + err) + 1 + } + } + } + + function stepSize() { + validateParameters(); + + if (step === 0) { + return Infinity; + } + + if (step % 1 !== 0) { + return stepFloatSize(); + } else if ((step > 0 && self > limit) || (step < 0 && self < limit)) { + return 0; + } else { + var ceil = Math.ceil, abs = Math.abs, + lhs = abs(self - limit) + 1, + rhs = abs(step); + + return ceil(lhs / rhs); + } + } + ; + if ((block !== nil)) { + } else { + + positional_args = []; + keyword_args = $hash2([], {}); + + if (limit !== undefined) { + positional_args.push(limit); + } + + if (step !== undefined) { + positional_args.push(step); + } + + if (to !== undefined) { + Opal.hash_put(keyword_args, "to", to); + } + + if (by !== undefined) { + Opal.hash_put(keyword_args, "by", by); + } + + if (keyword_args['$any?']()) { + positional_args.push(keyword_args); + } + ; + return $send(self, 'enum_for', ["step"].concat(Opal.to_a(positional_args)), (TMP_59 = function(){var self = TMP_59.$$s || this; + + return stepSize();}, TMP_59.$$s = self, TMP_59.$$arity = 0, TMP_59)); + }; + + validateParameters(); + + if (step === 0) { + while (true) { + block(self); + } + } + + if (self % 1 !== 0 || limit % 1 !== 0 || step % 1 !== 0) { + var n = stepFloatSize(); + + if (n > 0) { + if (step === Infinity || step === -Infinity) { + block(self); + } else { + var i = 0, d; + + if (step > 0) { + while (i < n) { + d = i * step + self; + if (limit < d) { + d = limit; + } + block(d); + i += 1; + } + } else { + while (i < n) { + d = i * step + self; + if (limit > d) { + d = limit; + } + block(d); + i += 1 + } + } + } + } + } else { + var value = self; + + if (step > 0) { + while (value <= limit) { + block(value); + value += step; + } + } else { + while (value >= limit) { + block(value); + value += step + } + } + } + + return self; + ; + }, TMP_Number_step_58.$$arity = -1); + Opal.alias(self, "succ", "next"); + + Opal.def(self, '$times', TMP_Number_times_60 = function $$times() { + var $iter = TMP_Number_times_60.$$p, block = $iter || nil, TMP_61, self = this; + + if ($iter) TMP_Number_times_60.$$p = null; + + + if ($iter) TMP_Number_times_60.$$p = null;; + if ($truthy(block)) { + } else { + return $send(self, 'enum_for', ["times"], (TMP_61 = function(){var self = TMP_61.$$s || this; + + return self}, TMP_61.$$s = self, TMP_61.$$arity = 0, TMP_61)) + }; + + for (var i = 0; i < self; i++) { + block(i); + } + ; + return self; + }, TMP_Number_times_60.$$arity = 0); + + Opal.def(self, '$to_f', TMP_Number_to_f_62 = function $$to_f() { + var self = this; + + return self + }, TMP_Number_to_f_62.$$arity = 0); + + Opal.def(self, '$to_i', TMP_Number_to_i_63 = function $$to_i() { + var self = this; + + return parseInt(self, 10); + }, TMP_Number_to_i_63.$$arity = 0); + Opal.alias(self, "to_int", "to_i"); + + Opal.def(self, '$to_r', TMP_Number_to_r_64 = function $$to_r() { + var $a, $b, self = this, f = nil, e = nil; + + if ($truthy($$($nesting, 'Integer')['$==='](self))) { + return $$($nesting, 'Rational').$new(self, 1) + } else { + + $b = $$($nesting, 'Math').$frexp(self), $a = Opal.to_ary($b), (f = ($a[0] == null ? nil : $a[0])), (e = ($a[1] == null ? nil : $a[1])), $b; + f = $$($nesting, 'Math').$ldexp(f, $$$($$($nesting, 'Float'), 'MANT_DIG')).$to_i(); + e = $rb_minus(e, $$$($$($nesting, 'Float'), 'MANT_DIG')); + return $rb_times(f, $$$($$($nesting, 'Float'), 'RADIX')['$**'](e)).$to_r(); + } + }, TMP_Number_to_r_64.$$arity = 0); + + Opal.def(self, '$to_s', TMP_Number_to_s_65 = function $$to_s(base) { + var $a, self = this; + + + + if (base == null) { + base = 10; + }; + base = $$($nesting, 'Opal')['$coerce_to!'](base, $$($nesting, 'Integer'), "to_int"); + if ($truthy(($truthy($a = $rb_lt(base, 2)) ? $a : $rb_gt(base, 36)))) { + self.$raise($$($nesting, 'ArgumentError'), "" + "invalid radix " + (base))}; + return self.toString(base);; + }, TMP_Number_to_s_65.$$arity = -1); + + Opal.def(self, '$truncate', TMP_Number_truncate_66 = function $$truncate(ndigits) { + var self = this; + + + + if (ndigits == null) { + ndigits = 0; + }; + + var f = self.$to_f(); + + if (f % 1 === 0 && ndigits >= 0) { + return f; + } + + var factor = Math.pow(10, ndigits), + result = parseInt(f * factor, 10) / factor; + + if (f % 1 === 0) { + result = Math.round(result); + } + + return result; + ; + }, TMP_Number_truncate_66.$$arity = -1); + Opal.alias(self, "inspect", "to_s"); + + Opal.def(self, '$digits', TMP_Number_digits_67 = function $$digits(base) { + var self = this; + + + + if (base == null) { + base = 10; + }; + if ($rb_lt(self, 0)) { + self.$raise($$$($$($nesting, 'Math'), 'DomainError'), "out of domain")}; + base = $$($nesting, 'Opal')['$coerce_to!'](base, $$($nesting, 'Integer'), "to_int"); + if ($truthy($rb_lt(base, 2))) { + self.$raise($$($nesting, 'ArgumentError'), "" + "invalid radix " + (base))}; + + var value = self, result = []; + + while (value !== 0) { + result.push(value % base); + value = parseInt(value / base, 10); + } + + return result; + ; + }, TMP_Number_digits_67.$$arity = -1); + + Opal.def(self, '$divmod', TMP_Number_divmod_68 = function $$divmod(other) { + var $a, $iter = TMP_Number_divmod_68.$$p, $yield = $iter || nil, self = this, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_Number_divmod_68.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + if ($truthy(($truthy($a = self['$nan?']()) ? $a : other['$nan?']()))) { + return self.$raise($$($nesting, 'FloatDomainError'), "NaN") + } else if ($truthy(self['$infinite?']())) { + return self.$raise($$($nesting, 'FloatDomainError'), "Infinity") + } else { + return $send(self, Opal.find_super_dispatcher(self, 'divmod', TMP_Number_divmod_68, false), $zuper, $iter) + } + }, TMP_Number_divmod_68.$$arity = 1); + + Opal.def(self, '$upto', TMP_Number_upto_69 = function $$upto(stop) { + var $iter = TMP_Number_upto_69.$$p, block = $iter || nil, TMP_70, self = this; + + if ($iter) TMP_Number_upto_69.$$p = null; + + + if ($iter) TMP_Number_upto_69.$$p = null;; + if ((block !== nil)) { + } else { + return $send(self, 'enum_for', ["upto", stop], (TMP_70 = function(){var self = TMP_70.$$s || this; + + + if ($truthy($$($nesting, 'Numeric')['$==='](stop))) { + } else { + self.$raise($$($nesting, 'ArgumentError'), "" + "comparison of " + (self.$class()) + " with " + (stop.$class()) + " failed") + }; + if ($truthy($rb_lt(stop, self))) { + return 0 + } else { + return $rb_plus($rb_minus(stop, self), 1) + };}, TMP_70.$$s = self, TMP_70.$$arity = 0, TMP_70)) + }; + + if (!stop.$$is_number) { + self.$raise($$($nesting, 'ArgumentError'), "" + "comparison of " + (self.$class()) + " with " + (stop.$class()) + " failed") + } + for (var i = self; i <= stop; i++) { + block(i); + } + ; + return self; + }, TMP_Number_upto_69.$$arity = 1); + + Opal.def(self, '$zero?', TMP_Number_zero$q_71 = function() { + var self = this; + + return self == 0; + }, TMP_Number_zero$q_71.$$arity = 0); + + Opal.def(self, '$size', TMP_Number_size_72 = function $$size() { + var self = this; + + return 4 + }, TMP_Number_size_72.$$arity = 0); + + Opal.def(self, '$nan?', TMP_Number_nan$q_73 = function() { + var self = this; + + return isNaN(self); + }, TMP_Number_nan$q_73.$$arity = 0); + + Opal.def(self, '$finite?', TMP_Number_finite$q_74 = function() { + var self = this; + + return self != Infinity && self != -Infinity && !isNaN(self); + }, TMP_Number_finite$q_74.$$arity = 0); + + Opal.def(self, '$infinite?', TMP_Number_infinite$q_75 = function() { + var self = this; + + + if (self == Infinity) { + return +1; + } + else if (self == -Infinity) { + return -1; + } + else { + return nil; + } + + }, TMP_Number_infinite$q_75.$$arity = 0); + + Opal.def(self, '$positive?', TMP_Number_positive$q_76 = function() { + var self = this; + + return self != 0 && (self == Infinity || 1 / self > 0); + }, TMP_Number_positive$q_76.$$arity = 0); + return (Opal.def(self, '$negative?', TMP_Number_negative$q_77 = function() { + var self = this; + + return self == -Infinity || 1 / self < 0; + }, TMP_Number_negative$q_77.$$arity = 0), nil) && 'negative?'; + })($nesting[0], $$($nesting, 'Numeric'), $nesting); + Opal.const_set($nesting[0], 'Fixnum', $$($nesting, 'Number')); + (function($base, $super, $parent_nesting) { + function $Integer(){}; + var self = $Integer = $klass($base, $super, 'Integer', $Integer); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + + self.$$is_number_class = true; + (function(self, $parent_nesting) { + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_allocate_78, TMP_$eq$eq$eq_79, TMP_sqrt_80; + + + + Opal.def(self, '$allocate', TMP_allocate_78 = function $$allocate() { + var self = this; + + return self.$raise($$($nesting, 'TypeError'), "" + "allocator undefined for " + (self.$name())) + }, TMP_allocate_78.$$arity = 0); + + Opal.udef(self, '$' + "new");; + + Opal.def(self, '$===', TMP_$eq$eq$eq_79 = function(other) { + var self = this; + + + if (!other.$$is_number) { + return false; + } + + return (other % 1) === 0; + + }, TMP_$eq$eq$eq_79.$$arity = 1); + return (Opal.def(self, '$sqrt', TMP_sqrt_80 = function $$sqrt(n) { + var self = this; + + + n = $$($nesting, 'Opal')['$coerce_to!'](n, $$($nesting, 'Integer'), "to_int"); + + if (n < 0) { + self.$raise($$$($$($nesting, 'Math'), 'DomainError'), "Numerical argument is out of domain - \"isqrt\"") + } + + return parseInt(Math.sqrt(n), 10); + ; + }, TMP_sqrt_80.$$arity = 1), nil) && 'sqrt'; + })(Opal.get_singleton_class(self), $nesting); + Opal.const_set($nesting[0], 'MAX', Math.pow(2, 30) - 1); + return Opal.const_set($nesting[0], 'MIN', -Math.pow(2, 30)); + })($nesting[0], $$($nesting, 'Numeric'), $nesting); + return (function($base, $super, $parent_nesting) { + function $Float(){}; + var self = $Float = $klass($base, $super, 'Float', $Float); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + + self.$$is_number_class = true; + (function(self, $parent_nesting) { + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_allocate_81, TMP_$eq$eq$eq_82; + + + + Opal.def(self, '$allocate', TMP_allocate_81 = function $$allocate() { + var self = this; + + return self.$raise($$($nesting, 'TypeError'), "" + "allocator undefined for " + (self.$name())) + }, TMP_allocate_81.$$arity = 0); + + Opal.udef(self, '$' + "new");; + return (Opal.def(self, '$===', TMP_$eq$eq$eq_82 = function(other) { + var self = this; + + return !!other.$$is_number; + }, TMP_$eq$eq$eq_82.$$arity = 1), nil) && '==='; + })(Opal.get_singleton_class(self), $nesting); + Opal.const_set($nesting[0], 'INFINITY', Infinity); + Opal.const_set($nesting[0], 'MAX', Number.MAX_VALUE); + Opal.const_set($nesting[0], 'MIN', Number.MIN_VALUE); + Opal.const_set($nesting[0], 'NAN', NaN); + Opal.const_set($nesting[0], 'DIG', 15); + Opal.const_set($nesting[0], 'MANT_DIG', 53); + Opal.const_set($nesting[0], 'RADIX', 2); + return Opal.const_set($nesting[0], 'EPSILON', Number.EPSILON || 2.2204460492503130808472633361816E-16); + })($nesting[0], $$($nesting, 'Numeric'), $nesting); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/range"] = function(Opal) { + function $rb_le(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs <= rhs : lhs['$<='](rhs); + } + function $rb_lt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); + } + function $rb_gt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); + } + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + function $rb_divide(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs / rhs : lhs['$/'](rhs); + } + function $rb_plus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); + } + function $rb_times(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs * rhs : lhs['$*'](rhs); + } + function $rb_ge(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs >= rhs : lhs['$>='](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $truthy = Opal.truthy, $send = Opal.send; + + Opal.add_stubs(['$require', '$include', '$attr_reader', '$raise', '$<=>', '$include?', '$<=', '$<', '$enum_for', '$upto', '$to_proc', '$respond_to?', '$class', '$succ', '$!', '$==', '$===', '$exclude_end?', '$eql?', '$begin', '$end', '$last', '$to_a', '$>', '$-', '$abs', '$to_i', '$coerce_to!', '$ceil', '$/', '$size', '$loop', '$+', '$*', '$>=', '$each_with_index', '$%', '$bsearch', '$inspect', '$[]', '$hash']); + + self.$require("corelib/enumerable"); + return (function($base, $super, $parent_nesting) { + function $Range(){}; + var self = $Range = $klass($base, $super, 'Range', $Range); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Range_initialize_1, TMP_Range_$eq$eq_2, TMP_Range_$eq$eq$eq_3, TMP_Range_cover$q_4, TMP_Range_each_5, TMP_Range_eql$q_6, TMP_Range_exclude_end$q_7, TMP_Range_first_8, TMP_Range_last_9, TMP_Range_max_10, TMP_Range_min_11, TMP_Range_size_12, TMP_Range_step_13, TMP_Range_bsearch_17, TMP_Range_to_s_18, TMP_Range_inspect_19, TMP_Range_marshal_load_20, TMP_Range_hash_21; + + def.begin = def.end = def.excl = nil; + + self.$include($$($nesting, 'Enumerable')); + def.$$is_range = true; + self.$attr_reader("begin", "end"); + + Opal.def(self, '$initialize', TMP_Range_initialize_1 = function $$initialize(first, last, exclude) { + var self = this; + + + + if (exclude == null) { + exclude = false; + }; + if ($truthy(self.begin)) { + self.$raise($$($nesting, 'NameError'), "'initialize' called twice")}; + if ($truthy(first['$<=>'](last))) { + } else { + self.$raise($$($nesting, 'ArgumentError'), "bad value for range") + }; + self.begin = first; + self.end = last; + return (self.excl = exclude); + }, TMP_Range_initialize_1.$$arity = -3); + + Opal.def(self, '$==', TMP_Range_$eq$eq_2 = function(other) { + var self = this; + + + if (!other.$$is_range) { + return false; + } + + return self.excl === other.excl && + self.begin == other.begin && + self.end == other.end; + + }, TMP_Range_$eq$eq_2.$$arity = 1); + + Opal.def(self, '$===', TMP_Range_$eq$eq$eq_3 = function(value) { + var self = this; + + return self['$include?'](value) + }, TMP_Range_$eq$eq$eq_3.$$arity = 1); + + Opal.def(self, '$cover?', TMP_Range_cover$q_4 = function(value) { + var $a, self = this, beg_cmp = nil, end_cmp = nil; + + + beg_cmp = self.begin['$<=>'](value); + if ($truthy(($truthy($a = beg_cmp) ? $rb_le(beg_cmp, 0) : $a))) { + } else { + return false + }; + end_cmp = value['$<=>'](self.end); + if ($truthy(self.excl)) { + return ($truthy($a = end_cmp) ? $rb_lt(end_cmp, 0) : $a) + } else { + return ($truthy($a = end_cmp) ? $rb_le(end_cmp, 0) : $a) + }; + }, TMP_Range_cover$q_4.$$arity = 1); + + Opal.def(self, '$each', TMP_Range_each_5 = function $$each() { + var $iter = TMP_Range_each_5.$$p, block = $iter || nil, $a, self = this, current = nil, last = nil; + + if ($iter) TMP_Range_each_5.$$p = null; + + + if ($iter) TMP_Range_each_5.$$p = null;; + if ((block !== nil)) { + } else { + return self.$enum_for("each") + }; + + var i, limit; + + if (self.begin.$$is_number && self.end.$$is_number) { + if (self.begin % 1 !== 0 || self.end % 1 !== 0) { + self.$raise($$($nesting, 'TypeError'), "can't iterate from Float") + } + + for (i = self.begin, limit = self.end + (function() {if ($truthy(self.excl)) { + return 0 + } else { + return 1 + }; return nil; })(); i < limit; i++) { + block(i); + } + + return self; + } + + if (self.begin.$$is_string && self.end.$$is_string) { + $send(self.begin, 'upto', [self.end, self.excl], block.$to_proc()) + return self; + } + ; + current = self.begin; + last = self.end; + if ($truthy(current['$respond_to?']("succ"))) { + } else { + self.$raise($$($nesting, 'TypeError'), "" + "can't iterate from " + (current.$class())) + }; + while ($truthy($rb_lt(current['$<=>'](last), 0))) { + + Opal.yield1(block, current); + current = current.$succ(); + }; + if ($truthy(($truthy($a = self.excl['$!']()) ? current['$=='](last) : $a))) { + Opal.yield1(block, current)}; + return self; + }, TMP_Range_each_5.$$arity = 0); + + Opal.def(self, '$eql?', TMP_Range_eql$q_6 = function(other) { + var $a, $b, self = this; + + + if ($truthy($$($nesting, 'Range')['$==='](other))) { + } else { + return false + }; + return ($truthy($a = ($truthy($b = self.excl['$==='](other['$exclude_end?']())) ? self.begin['$eql?'](other.$begin()) : $b)) ? self.end['$eql?'](other.$end()) : $a); + }, TMP_Range_eql$q_6.$$arity = 1); + + Opal.def(self, '$exclude_end?', TMP_Range_exclude_end$q_7 = function() { + var self = this; + + return self.excl + }, TMP_Range_exclude_end$q_7.$$arity = 0); + + Opal.def(self, '$first', TMP_Range_first_8 = function $$first(n) { + var $iter = TMP_Range_first_8.$$p, $yield = $iter || nil, self = this, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_Range_first_8.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + + ; + if ($truthy(n == null)) { + return self.begin}; + return $send(self, Opal.find_super_dispatcher(self, 'first', TMP_Range_first_8, false), $zuper, $iter); + }, TMP_Range_first_8.$$arity = -1); + Opal.alias(self, "include?", "cover?"); + + Opal.def(self, '$last', TMP_Range_last_9 = function $$last(n) { + var self = this; + + + ; + if ($truthy(n == null)) { + return self.end}; + return self.$to_a().$last(n); + }, TMP_Range_last_9.$$arity = -1); + + Opal.def(self, '$max', TMP_Range_max_10 = function $$max() { + var $a, $iter = TMP_Range_max_10.$$p, $yield = $iter || nil, self = this, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_Range_max_10.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + if (($yield !== nil)) { + return $send(self, Opal.find_super_dispatcher(self, 'max', TMP_Range_max_10, false), $zuper, $iter) + } else if ($truthy($rb_gt(self.begin, self.end))) { + return nil + } else if ($truthy(($truthy($a = self.excl) ? self.begin['$=='](self.end) : $a))) { + return nil + } else { + return self.excl ? self.end - 1 : self.end + } + }, TMP_Range_max_10.$$arity = 0); + Opal.alias(self, "member?", "cover?"); + + Opal.def(self, '$min', TMP_Range_min_11 = function $$min() { + var $a, $iter = TMP_Range_min_11.$$p, $yield = $iter || nil, self = this, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_Range_min_11.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + if (($yield !== nil)) { + return $send(self, Opal.find_super_dispatcher(self, 'min', TMP_Range_min_11, false), $zuper, $iter) + } else if ($truthy($rb_gt(self.begin, self.end))) { + return nil + } else if ($truthy(($truthy($a = self.excl) ? self.begin['$=='](self.end) : $a))) { + return nil + } else { + return self.begin + } + }, TMP_Range_min_11.$$arity = 0); + + Opal.def(self, '$size', TMP_Range_size_12 = function $$size() { + var $a, self = this, range_begin = nil, range_end = nil, infinity = nil; + + + range_begin = self.begin; + range_end = self.end; + if ($truthy(self.excl)) { + range_end = $rb_minus(range_end, 1)}; + if ($truthy(($truthy($a = $$($nesting, 'Numeric')['$==='](range_begin)) ? $$($nesting, 'Numeric')['$==='](range_end) : $a))) { + } else { + return nil + }; + if ($truthy($rb_lt(range_end, range_begin))) { + return 0}; + infinity = $$$($$($nesting, 'Float'), 'INFINITY'); + if ($truthy([range_begin.$abs(), range_end.$abs()]['$include?'](infinity))) { + return infinity}; + return (Math.abs(range_end - range_begin) + 1).$to_i(); + }, TMP_Range_size_12.$$arity = 0); + + Opal.def(self, '$step', TMP_Range_step_13 = function $$step(n) { + var TMP_14, TMP_15, TMP_16, $iter = TMP_Range_step_13.$$p, $yield = $iter || nil, self = this, i = nil; + + if ($iter) TMP_Range_step_13.$$p = null; + + + if (n == null) { + n = 1; + }; + + function coerceStepSize() { + if (!n.$$is_number) { + n = $$($nesting, 'Opal')['$coerce_to!'](n, $$($nesting, 'Integer'), "to_int") + } + + if (n < 0) { + self.$raise($$($nesting, 'ArgumentError'), "step can't be negative") + } else if (n === 0) { + self.$raise($$($nesting, 'ArgumentError'), "step can't be 0") + } + } + + function enumeratorSize() { + if (!self.begin['$respond_to?']("succ")) { + return nil; + } + + if (self.begin.$$is_string && self.end.$$is_string) { + return nil; + } + + if (n % 1 === 0) { + return $rb_divide(self.$size(), n).$ceil(); + } else { + // n is a float + var begin = self.begin, end = self.end, + abs = Math.abs, floor = Math.floor, + err = (abs(begin) + abs(end) + abs(end - begin)) / abs(n) * $$$($$($nesting, 'Float'), 'EPSILON'), + size; + + if (err > 0.5) { + err = 0.5; + } + + if (self.excl) { + size = floor((end - begin) / n - err); + if (size * n + begin < end) { + size++; + } + } else { + size = floor((end - begin) / n + err) + 1 + } + + return size; + } + } + ; + if (($yield !== nil)) { + } else { + return $send(self, 'enum_for', ["step", n], (TMP_14 = function(){var self = TMP_14.$$s || this; + + + coerceStepSize(); + return enumeratorSize(); + }, TMP_14.$$s = self, TMP_14.$$arity = 0, TMP_14)) + }; + coerceStepSize(); + if ($truthy(self.begin.$$is_number && self.end.$$is_number)) { + + i = 0; + (function(){var $brk = Opal.new_brk(); try {return $send(self, 'loop', [], (TMP_15 = function(){var self = TMP_15.$$s || this, current = nil; + if (self.begin == null) self.begin = nil; + if (self.excl == null) self.excl = nil; + if (self.end == null) self.end = nil; + + + current = $rb_plus(self.begin, $rb_times(i, n)); + if ($truthy(self.excl)) { + if ($truthy($rb_ge(current, self.end))) { + + Opal.brk(nil, $brk)} + } else if ($truthy($rb_gt(current, self.end))) { + + Opal.brk(nil, $brk)}; + Opal.yield1($yield, current); + return (i = $rb_plus(i, 1));}, TMP_15.$$s = self, TMP_15.$$brk = $brk, TMP_15.$$arity = 0, TMP_15)) + } catch (err) { if (err === $brk) { return err.$v } else { throw err } }})(); + } else { + + + if (self.begin.$$is_string && self.end.$$is_string && n % 1 !== 0) { + self.$raise($$($nesting, 'TypeError'), "no implicit conversion to float from string") + } + ; + $send(self, 'each_with_index', [], (TMP_16 = function(value, idx){var self = TMP_16.$$s || this; + + + + if (value == null) { + value = nil; + }; + + if (idx == null) { + idx = nil; + }; + if (idx['$%'](n)['$=='](0)) { + return Opal.yield1($yield, value); + } else { + return nil + };}, TMP_16.$$s = self, TMP_16.$$arity = 2, TMP_16)); + }; + return self; + }, TMP_Range_step_13.$$arity = -1); + + Opal.def(self, '$bsearch', TMP_Range_bsearch_17 = function $$bsearch() { + var $iter = TMP_Range_bsearch_17.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Range_bsearch_17.$$p = null; + + + if ($iter) TMP_Range_bsearch_17.$$p = null;; + if ((block !== nil)) { + } else { + return self.$enum_for("bsearch") + }; + if ($truthy(self.begin.$$is_number && self.end.$$is_number)) { + } else { + self.$raise($$($nesting, 'TypeError'), "" + "can't do binary search for " + (self.begin.$class())) + }; + return $send(self.$to_a(), 'bsearch', [], block.$to_proc()); + }, TMP_Range_bsearch_17.$$arity = 0); + + Opal.def(self, '$to_s', TMP_Range_to_s_18 = function $$to_s() { + var self = this; + + return "" + (self.begin) + ((function() {if ($truthy(self.excl)) { + return "..." + } else { + return ".." + }; return nil; })()) + (self.end) + }, TMP_Range_to_s_18.$$arity = 0); + + Opal.def(self, '$inspect', TMP_Range_inspect_19 = function $$inspect() { + var self = this; + + return "" + (self.begin.$inspect()) + ((function() {if ($truthy(self.excl)) { + return "..." + } else { + return ".." + }; return nil; })()) + (self.end.$inspect()) + }, TMP_Range_inspect_19.$$arity = 0); + + Opal.def(self, '$marshal_load', TMP_Range_marshal_load_20 = function $$marshal_load(args) { + var self = this; + + + self.begin = args['$[]']("begin"); + self.end = args['$[]']("end"); + return (self.excl = args['$[]']("excl")); + }, TMP_Range_marshal_load_20.$$arity = 1); + return (Opal.def(self, '$hash', TMP_Range_hash_21 = function $$hash() { + var self = this; + + return [self.begin, self.end, self.excl].$hash() + }, TMP_Range_hash_21.$$arity = 0), nil) && 'hash'; + })($nesting[0], null, $nesting); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/proc"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $truthy = Opal.truthy; + + Opal.add_stubs(['$raise', '$coerce_to!']); + return (function($base, $super, $parent_nesting) { + function $Proc(){}; + var self = $Proc = $klass($base, $super, 'Proc', $Proc); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Proc_new_1, TMP_Proc_call_2, TMP_Proc_to_proc_3, TMP_Proc_lambda$q_4, TMP_Proc_arity_5, TMP_Proc_source_location_6, TMP_Proc_binding_7, TMP_Proc_parameters_8, TMP_Proc_curry_9, TMP_Proc_dup_10; + + + Opal.defineProperty(Function.prototype, '$$is_proc', true); + Opal.defineProperty(Function.prototype, '$$is_lambda', false); + Opal.defs(self, '$new', TMP_Proc_new_1 = function() { + var $iter = TMP_Proc_new_1.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Proc_new_1.$$p = null; + + + if ($iter) TMP_Proc_new_1.$$p = null;; + if ($truthy(block)) { + } else { + self.$raise($$($nesting, 'ArgumentError'), "tried to create a Proc object without a block") + }; + return block; + }, TMP_Proc_new_1.$$arity = 0); + + Opal.def(self, '$call', TMP_Proc_call_2 = function $$call($a) { + var $iter = TMP_Proc_call_2.$$p, block = $iter || nil, $post_args, args, self = this; + + if ($iter) TMP_Proc_call_2.$$p = null; + + + if ($iter) TMP_Proc_call_2.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + + if (block !== nil) { + self.$$p = block; + } + + var result, $brk = self.$$brk; + + if ($brk) { + try { + if (self.$$is_lambda) { + result = self.apply(null, args); + } + else { + result = Opal.yieldX(self, args); + } + } catch (err) { + if (err === $brk) { + return $brk.$v + } + else { + throw err + } + } + } + else { + if (self.$$is_lambda) { + result = self.apply(null, args); + } + else { + result = Opal.yieldX(self, args); + } + } + + return result; + ; + }, TMP_Proc_call_2.$$arity = -1); + Opal.alias(self, "[]", "call"); + Opal.alias(self, "===", "call"); + Opal.alias(self, "yield", "call"); + + Opal.def(self, '$to_proc', TMP_Proc_to_proc_3 = function $$to_proc() { + var self = this; + + return self + }, TMP_Proc_to_proc_3.$$arity = 0); + + Opal.def(self, '$lambda?', TMP_Proc_lambda$q_4 = function() { + var self = this; + + return !!self.$$is_lambda; + }, TMP_Proc_lambda$q_4.$$arity = 0); + + Opal.def(self, '$arity', TMP_Proc_arity_5 = function $$arity() { + var self = this; + + + if (self.$$is_curried) { + return -1; + } else { + return self.$$arity; + } + + }, TMP_Proc_arity_5.$$arity = 0); + + Opal.def(self, '$source_location', TMP_Proc_source_location_6 = function $$source_location() { + var self = this; + + + if (self.$$is_curried) { return nil; }; + return nil; + }, TMP_Proc_source_location_6.$$arity = 0); + + Opal.def(self, '$binding', TMP_Proc_binding_7 = function $$binding() { + var self = this; + + + if (self.$$is_curried) { self.$raise($$($nesting, 'ArgumentError'), "Can't create Binding") }; + return nil; + }, TMP_Proc_binding_7.$$arity = 0); + + Opal.def(self, '$parameters', TMP_Proc_parameters_8 = function $$parameters() { + var self = this; + + + if (self.$$is_curried) { + return [["rest"]]; + } else if (self.$$parameters) { + if (self.$$is_lambda) { + return self.$$parameters; + } else { + var result = [], i, length; + + for (i = 0, length = self.$$parameters.length; i < length; i++) { + var parameter = self.$$parameters[i]; + + if (parameter[0] === 'req') { + // required arguments always have name + parameter = ['opt', parameter[1]]; + } + + result.push(parameter); + } + + return result; + } + } else { + return []; + } + + }, TMP_Proc_parameters_8.$$arity = 0); + + Opal.def(self, '$curry', TMP_Proc_curry_9 = function $$curry(arity) { + var self = this; + + + ; + + if (arity === undefined) { + arity = self.length; + } + else { + arity = $$($nesting, 'Opal')['$coerce_to!'](arity, $$($nesting, 'Integer'), "to_int"); + if (self.$$is_lambda && arity !== self.length) { + self.$raise($$($nesting, 'ArgumentError'), "" + "wrong number of arguments (" + (arity) + " for " + (self.length) + ")") + } + } + + function curried () { + var args = $slice.call(arguments), + length = args.length, + result; + + if (length > arity && self.$$is_lambda && !self.$$is_curried) { + self.$raise($$($nesting, 'ArgumentError'), "" + "wrong number of arguments (" + (length) + " for " + (arity) + ")") + } + + if (length >= arity) { + return self.$call.apply(self, args); + } + + result = function () { + return curried.apply(null, + args.concat($slice.call(arguments))); + } + result.$$is_lambda = self.$$is_lambda; + result.$$is_curried = true; + + return result; + }; + + curried.$$is_lambda = self.$$is_lambda; + curried.$$is_curried = true; + return curried; + ; + }, TMP_Proc_curry_9.$$arity = -1); + + Opal.def(self, '$dup', TMP_Proc_dup_10 = function $$dup() { + var self = this; + + + var original_proc = self.$$original_proc || self, + proc = function () { + return original_proc.apply(this, arguments); + }; + + for (var prop in self) { + if (self.hasOwnProperty(prop)) { + proc[prop] = self[prop]; + } + } + + return proc; + + }, TMP_Proc_dup_10.$$arity = 0); + return Opal.alias(self, "clone", "dup"); + })($nesting[0], Function, $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/method"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $truthy = Opal.truthy; + + Opal.add_stubs(['$attr_reader', '$arity', '$new', '$class', '$join', '$source_location', '$raise']); + + (function($base, $super, $parent_nesting) { + function $Method(){}; + var self = $Method = $klass($base, $super, 'Method', $Method); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Method_initialize_1, TMP_Method_arity_2, TMP_Method_parameters_3, TMP_Method_source_location_4, TMP_Method_comments_5, TMP_Method_call_6, TMP_Method_unbind_7, TMP_Method_to_proc_8, TMP_Method_inspect_9; + + def.method = def.receiver = def.owner = def.name = nil; + + self.$attr_reader("owner", "receiver", "name"); + + Opal.def(self, '$initialize', TMP_Method_initialize_1 = function $$initialize(receiver, owner, method, name) { + var self = this; + + + self.receiver = receiver; + self.owner = owner; + self.name = name; + return (self.method = method); + }, TMP_Method_initialize_1.$$arity = 4); + + Opal.def(self, '$arity', TMP_Method_arity_2 = function $$arity() { + var self = this; + + return self.method.$arity() + }, TMP_Method_arity_2.$$arity = 0); + + Opal.def(self, '$parameters', TMP_Method_parameters_3 = function $$parameters() { + var self = this; + + return self.method.$$parameters + }, TMP_Method_parameters_3.$$arity = 0); + + Opal.def(self, '$source_location', TMP_Method_source_location_4 = function $$source_location() { + var $a, self = this; + + return ($truthy($a = self.method.$$source_location) ? $a : ["(eval)", 0]) + }, TMP_Method_source_location_4.$$arity = 0); + + Opal.def(self, '$comments', TMP_Method_comments_5 = function $$comments() { + var $a, self = this; + + return ($truthy($a = self.method.$$comments) ? $a : []) + }, TMP_Method_comments_5.$$arity = 0); + + Opal.def(self, '$call', TMP_Method_call_6 = function $$call($a) { + var $iter = TMP_Method_call_6.$$p, block = $iter || nil, $post_args, args, self = this; + + if ($iter) TMP_Method_call_6.$$p = null; + + + if ($iter) TMP_Method_call_6.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + + self.method.$$p = block; + + return self.method.apply(self.receiver, args); + ; + }, TMP_Method_call_6.$$arity = -1); + Opal.alias(self, "[]", "call"); + + Opal.def(self, '$unbind', TMP_Method_unbind_7 = function $$unbind() { + var self = this; + + return $$($nesting, 'UnboundMethod').$new(self.receiver.$class(), self.owner, self.method, self.name) + }, TMP_Method_unbind_7.$$arity = 0); + + Opal.def(self, '$to_proc', TMP_Method_to_proc_8 = function $$to_proc() { + var self = this; + + + var proc = self.$call.bind(self); + proc.$$unbound = self.method; + proc.$$is_lambda = true; + return proc; + + }, TMP_Method_to_proc_8.$$arity = 0); + return (Opal.def(self, '$inspect', TMP_Method_inspect_9 = function $$inspect() { + var self = this; + + return "" + "#<" + (self.$class()) + ": " + (self.receiver.$class()) + "#" + (self.name) + " (defined in " + (self.owner) + " in " + (self.$source_location().$join(":")) + ")>" + }, TMP_Method_inspect_9.$$arity = 0), nil) && 'inspect'; + })($nesting[0], null, $nesting); + return (function($base, $super, $parent_nesting) { + function $UnboundMethod(){}; + var self = $UnboundMethod = $klass($base, $super, 'UnboundMethod', $UnboundMethod); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_UnboundMethod_initialize_10, TMP_UnboundMethod_arity_11, TMP_UnboundMethod_parameters_12, TMP_UnboundMethod_source_location_13, TMP_UnboundMethod_comments_14, TMP_UnboundMethod_bind_15, TMP_UnboundMethod_inspect_16; + + def.method = def.owner = def.name = def.source = nil; + + self.$attr_reader("source", "owner", "name"); + + Opal.def(self, '$initialize', TMP_UnboundMethod_initialize_10 = function $$initialize(source, owner, method, name) { + var self = this; + + + self.source = source; + self.owner = owner; + self.method = method; + return (self.name = name); + }, TMP_UnboundMethod_initialize_10.$$arity = 4); + + Opal.def(self, '$arity', TMP_UnboundMethod_arity_11 = function $$arity() { + var self = this; + + return self.method.$arity() + }, TMP_UnboundMethod_arity_11.$$arity = 0); + + Opal.def(self, '$parameters', TMP_UnboundMethod_parameters_12 = function $$parameters() { + var self = this; + + return self.method.$$parameters + }, TMP_UnboundMethod_parameters_12.$$arity = 0); + + Opal.def(self, '$source_location', TMP_UnboundMethod_source_location_13 = function $$source_location() { + var $a, self = this; + + return ($truthy($a = self.method.$$source_location) ? $a : ["(eval)", 0]) + }, TMP_UnboundMethod_source_location_13.$$arity = 0); + + Opal.def(self, '$comments', TMP_UnboundMethod_comments_14 = function $$comments() { + var $a, self = this; + + return ($truthy($a = self.method.$$comments) ? $a : []) + }, TMP_UnboundMethod_comments_14.$$arity = 0); + + Opal.def(self, '$bind', TMP_UnboundMethod_bind_15 = function $$bind(object) { + var self = this; + + + if (self.owner.$$is_module || Opal.is_a(object, self.owner)) { + return $$($nesting, 'Method').$new(object, self.owner, self.method, self.name); + } + else { + self.$raise($$($nesting, 'TypeError'), "" + "can't bind singleton method to a different class (expected " + (object) + ".kind_of?(" + (self.owner) + " to be true)"); + } + + }, TMP_UnboundMethod_bind_15.$$arity = 1); + return (Opal.def(self, '$inspect', TMP_UnboundMethod_inspect_16 = function $$inspect() { + var self = this; + + return "" + "#<" + (self.$class()) + ": " + (self.source) + "#" + (self.name) + " (defined in " + (self.owner) + " in " + (self.$source_location().$join(":")) + ")>" + }, TMP_UnboundMethod_inspect_16.$$arity = 0), nil) && 'inspect'; + })($nesting[0], null, $nesting); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/variables"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $gvars = Opal.gvars, $hash2 = Opal.hash2; + + Opal.add_stubs(['$new']); + + $gvars['&'] = $gvars['~'] = $gvars['`'] = $gvars["'"] = nil; + $gvars.LOADED_FEATURES = ($gvars["\""] = Opal.loaded_features); + $gvars.LOAD_PATH = ($gvars[":"] = []); + $gvars["/"] = "\n"; + $gvars[","] = nil; + Opal.const_set($nesting[0], 'ARGV', []); + Opal.const_set($nesting[0], 'ARGF', $$($nesting, 'Object').$new()); + Opal.const_set($nesting[0], 'ENV', $hash2([], {})); + $gvars.VERBOSE = false; + $gvars.DEBUG = false; + return ($gvars.SAFE = 0); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["opal/regexp_anchors"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module; + + Opal.add_stubs(['$==', '$new']); + return (function($base, $parent_nesting) { + function $Opal() {}; + var self = $Opal = $module($base, 'Opal', $Opal); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + + Opal.const_set($nesting[0], 'REGEXP_START', (function() {if ($$($nesting, 'RUBY_ENGINE')['$==']("opal")) { + return "^" + } else { + return nil + }; return nil; })()); + Opal.const_set($nesting[0], 'REGEXP_END', (function() {if ($$($nesting, 'RUBY_ENGINE')['$==']("opal")) { + return "$" + } else { + return nil + }; return nil; })()); + Opal.const_set($nesting[0], 'FORBIDDEN_STARTING_IDENTIFIER_CHARS', "\\u0001-\\u002F\\u003A-\\u0040\\u005B-\\u005E\\u0060\\u007B-\\u007F"); + Opal.const_set($nesting[0], 'FORBIDDEN_ENDING_IDENTIFIER_CHARS', "\\u0001-\\u0020\\u0022-\\u002F\\u003A-\\u003E\\u0040\\u005B-\\u005E\\u0060\\u007B-\\u007F"); + Opal.const_set($nesting[0], 'INLINE_IDENTIFIER_REGEXP', $$($nesting, 'Regexp').$new("" + "[^" + ($$($nesting, 'FORBIDDEN_STARTING_IDENTIFIER_CHARS')) + "]*[^" + ($$($nesting, 'FORBIDDEN_ENDING_IDENTIFIER_CHARS')) + "]")); + Opal.const_set($nesting[0], 'FORBIDDEN_CONST_NAME_CHARS', "\\u0001-\\u0020\\u0021-\\u002F\\u003B-\\u003F\\u0040\\u005B-\\u005E\\u0060\\u007B-\\u007F"); + Opal.const_set($nesting[0], 'CONST_NAME_REGEXP', $$($nesting, 'Regexp').$new("" + ($$($nesting, 'REGEXP_START')) + "(::)?[A-Z][^" + ($$($nesting, 'FORBIDDEN_CONST_NAME_CHARS')) + "]*" + ($$($nesting, 'REGEXP_END')))); + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["opal/mini"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice; + + Opal.add_stubs(['$require']); + + self.$require("opal/base"); + self.$require("corelib/nil"); + self.$require("corelib/boolean"); + self.$require("corelib/string"); + self.$require("corelib/comparable"); + self.$require("corelib/enumerable"); + self.$require("corelib/enumerator"); + self.$require("corelib/array"); + self.$require("corelib/hash"); + self.$require("corelib/number"); + self.$require("corelib/range"); + self.$require("corelib/proc"); + self.$require("corelib/method"); + self.$require("corelib/regexp"); + self.$require("corelib/variables"); + return self.$require("opal/regexp_anchors"); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/string/encoding"] = function(Opal) { + function $rb_plus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); + } + var TMP_12, TMP_15, TMP_18, TMP_21, TMP_24, self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $hash2 = Opal.hash2, $truthy = Opal.truthy, $send = Opal.send; + + Opal.add_stubs(['$require', '$+', '$[]', '$new', '$to_proc', '$each', '$const_set', '$sub', '$==', '$default_external', '$upcase', '$raise', '$attr_accessor', '$attr_reader', '$register', '$length', '$bytes', '$to_a', '$each_byte', '$bytesize', '$enum_for', '$force_encoding', '$dup', '$coerce_to!', '$find', '$getbyte']); + + self.$require("corelib/string"); + (function($base, $super, $parent_nesting) { + function $Encoding(){}; + var self = $Encoding = $klass($base, $super, 'Encoding', $Encoding); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Encoding_register_1, TMP_Encoding_find_3, TMP_Encoding_initialize_4, TMP_Encoding_ascii_compatible$q_5, TMP_Encoding_dummy$q_6, TMP_Encoding_to_s_7, TMP_Encoding_inspect_8, TMP_Encoding_each_byte_9, TMP_Encoding_getbyte_10, TMP_Encoding_bytesize_11; + + def.ascii = def.dummy = def.name = nil; + + Opal.defineProperty(self, '$$register', {}); + Opal.defs(self, '$register', TMP_Encoding_register_1 = function $$register(name, options) { + var $iter = TMP_Encoding_register_1.$$p, block = $iter || nil, $a, TMP_2, self = this, names = nil, encoding = nil, register = nil; + + if ($iter) TMP_Encoding_register_1.$$p = null; + + + if ($iter) TMP_Encoding_register_1.$$p = null;; + + if (options == null) { + options = $hash2([], {}); + }; + names = $rb_plus([name], ($truthy($a = options['$[]']("aliases")) ? $a : [])); + encoding = $send($$($nesting, 'Class'), 'new', [self], block.$to_proc()).$new(name, names, ($truthy($a = options['$[]']("ascii")) ? $a : false), ($truthy($a = options['$[]']("dummy")) ? $a : false)); + register = self["$$register"]; + return $send(names, 'each', [], (TMP_2 = function(encoding_name){var self = TMP_2.$$s || this; + + + + if (encoding_name == null) { + encoding_name = nil; + }; + self.$const_set(encoding_name.$sub("-", "_"), encoding); + return register["" + "$$" + (encoding_name)] = encoding;}, TMP_2.$$s = self, TMP_2.$$arity = 1, TMP_2)); + }, TMP_Encoding_register_1.$$arity = -2); + Opal.defs(self, '$find', TMP_Encoding_find_3 = function $$find(name) { + var $a, self = this, register = nil, encoding = nil; + + + if (name['$==']("default_external")) { + return self.$default_external()}; + register = self["$$register"]; + encoding = ($truthy($a = register["" + "$$" + (name)]) ? $a : register["" + "$$" + (name.$upcase())]); + if ($truthy(encoding)) { + } else { + self.$raise($$($nesting, 'ArgumentError'), "" + "unknown encoding name - " + (name)) + }; + return encoding; + }, TMP_Encoding_find_3.$$arity = 1); + (function(self, $parent_nesting) { + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return self.$attr_accessor("default_external") + })(Opal.get_singleton_class(self), $nesting); + self.$attr_reader("name", "names"); + + Opal.def(self, '$initialize', TMP_Encoding_initialize_4 = function $$initialize(name, names, ascii, dummy) { + var self = this; + + + self.name = name; + self.names = names; + self.ascii = ascii; + return (self.dummy = dummy); + }, TMP_Encoding_initialize_4.$$arity = 4); + + Opal.def(self, '$ascii_compatible?', TMP_Encoding_ascii_compatible$q_5 = function() { + var self = this; + + return self.ascii + }, TMP_Encoding_ascii_compatible$q_5.$$arity = 0); + + Opal.def(self, '$dummy?', TMP_Encoding_dummy$q_6 = function() { + var self = this; + + return self.dummy + }, TMP_Encoding_dummy$q_6.$$arity = 0); + + Opal.def(self, '$to_s', TMP_Encoding_to_s_7 = function $$to_s() { + var self = this; + + return self.name + }, TMP_Encoding_to_s_7.$$arity = 0); + + Opal.def(self, '$inspect', TMP_Encoding_inspect_8 = function $$inspect() { + var self = this; + + return "" + "#" + }, TMP_Encoding_inspect_8.$$arity = 0); + + Opal.def(self, '$each_byte', TMP_Encoding_each_byte_9 = function $$each_byte($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return self.$raise($$($nesting, 'NotImplementedError')); + }, TMP_Encoding_each_byte_9.$$arity = -1); + + Opal.def(self, '$getbyte', TMP_Encoding_getbyte_10 = function $$getbyte($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return self.$raise($$($nesting, 'NotImplementedError')); + }, TMP_Encoding_getbyte_10.$$arity = -1); + + Opal.def(self, '$bytesize', TMP_Encoding_bytesize_11 = function $$bytesize($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return self.$raise($$($nesting, 'NotImplementedError')); + }, TMP_Encoding_bytesize_11.$$arity = -1); + (function($base, $super, $parent_nesting) { + function $EncodingError(){}; + var self = $EncodingError = $klass($base, $super, 'EncodingError', $EncodingError); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return nil + })($nesting[0], $$($nesting, 'StandardError'), $nesting); + return (function($base, $super, $parent_nesting) { + function $CompatibilityError(){}; + var self = $CompatibilityError = $klass($base, $super, 'CompatibilityError', $CompatibilityError); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return nil + })($nesting[0], $$($nesting, 'EncodingError'), $nesting); + })($nesting[0], null, $nesting); + $send($$($nesting, 'Encoding'), 'register', ["UTF-8", $hash2(["aliases", "ascii"], {"aliases": ["CP65001"], "ascii": true})], (TMP_12 = function(){var self = TMP_12.$$s || this, TMP_each_byte_13, TMP_bytesize_14; + + + + Opal.def(self, '$each_byte', TMP_each_byte_13 = function $$each_byte(string) { + var $iter = TMP_each_byte_13.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_each_byte_13.$$p = null; + + + if ($iter) TMP_each_byte_13.$$p = null;; + + for (var i = 0, length = string.length; i < length; i++) { + var code = string.charCodeAt(i); + + if (code <= 0x7f) { + Opal.yield1(block, code); + } + else { + var encoded = encodeURIComponent(string.charAt(i)).substr(1).split('%'); + + for (var j = 0, encoded_length = encoded.length; j < encoded_length; j++) { + Opal.yield1(block, parseInt(encoded[j], 16)); + } + } + } + ; + }, TMP_each_byte_13.$$arity = 1); + return (Opal.def(self, '$bytesize', TMP_bytesize_14 = function $$bytesize(string) { + var self = this; + + return string.$bytes().$length() + }, TMP_bytesize_14.$$arity = 1), nil) && 'bytesize';}, TMP_12.$$s = self, TMP_12.$$arity = 0, TMP_12)); + $send($$($nesting, 'Encoding'), 'register', ["UTF-16LE"], (TMP_15 = function(){var self = TMP_15.$$s || this, TMP_each_byte_16, TMP_bytesize_17; + + + + Opal.def(self, '$each_byte', TMP_each_byte_16 = function $$each_byte(string) { + var $iter = TMP_each_byte_16.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_each_byte_16.$$p = null; + + + if ($iter) TMP_each_byte_16.$$p = null;; + + for (var i = 0, length = string.length; i < length; i++) { + var code = string.charCodeAt(i); + + Opal.yield1(block, code & 0xff); + Opal.yield1(block, code >> 8); + } + ; + }, TMP_each_byte_16.$$arity = 1); + return (Opal.def(self, '$bytesize', TMP_bytesize_17 = function $$bytesize(string) { + var self = this; + + return string.$bytes().$length() + }, TMP_bytesize_17.$$arity = 1), nil) && 'bytesize';}, TMP_15.$$s = self, TMP_15.$$arity = 0, TMP_15)); + $send($$($nesting, 'Encoding'), 'register', ["UTF-16BE"], (TMP_18 = function(){var self = TMP_18.$$s || this, TMP_each_byte_19, TMP_bytesize_20; + + + + Opal.def(self, '$each_byte', TMP_each_byte_19 = function $$each_byte(string) { + var $iter = TMP_each_byte_19.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_each_byte_19.$$p = null; + + + if ($iter) TMP_each_byte_19.$$p = null;; + + for (var i = 0, length = string.length; i < length; i++) { + var code = string.charCodeAt(i); + + Opal.yield1(block, code >> 8); + Opal.yield1(block, code & 0xff); + } + ; + }, TMP_each_byte_19.$$arity = 1); + return (Opal.def(self, '$bytesize', TMP_bytesize_20 = function $$bytesize(string) { + var self = this; + + return string.$bytes().$length() + }, TMP_bytesize_20.$$arity = 1), nil) && 'bytesize';}, TMP_18.$$s = self, TMP_18.$$arity = 0, TMP_18)); + $send($$($nesting, 'Encoding'), 'register', ["UTF-32LE"], (TMP_21 = function(){var self = TMP_21.$$s || this, TMP_each_byte_22, TMP_bytesize_23; + + + + Opal.def(self, '$each_byte', TMP_each_byte_22 = function $$each_byte(string) { + var $iter = TMP_each_byte_22.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_each_byte_22.$$p = null; + + + if ($iter) TMP_each_byte_22.$$p = null;; + + for (var i = 0, length = string.length; i < length; i++) { + var code = string.charCodeAt(i); + + Opal.yield1(block, code & 0xff); + Opal.yield1(block, code >> 8); + } + ; + }, TMP_each_byte_22.$$arity = 1); + return (Opal.def(self, '$bytesize', TMP_bytesize_23 = function $$bytesize(string) { + var self = this; + + return string.$bytes().$length() + }, TMP_bytesize_23.$$arity = 1), nil) && 'bytesize';}, TMP_21.$$s = self, TMP_21.$$arity = 0, TMP_21)); + $send($$($nesting, 'Encoding'), 'register', ["ASCII-8BIT", $hash2(["aliases", "ascii", "dummy"], {"aliases": ["BINARY", "US-ASCII", "ASCII"], "ascii": true, "dummy": true})], (TMP_24 = function(){var self = TMP_24.$$s || this, TMP_each_byte_25, TMP_bytesize_26; + + + + Opal.def(self, '$each_byte', TMP_each_byte_25 = function $$each_byte(string) { + var $iter = TMP_each_byte_25.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_each_byte_25.$$p = null; + + + if ($iter) TMP_each_byte_25.$$p = null;; + + for (var i = 0, length = string.length; i < length; i++) { + var code = string.charCodeAt(i); + Opal.yield1(block, code & 0xff); + Opal.yield1(block, code >> 8); + } + ; + }, TMP_each_byte_25.$$arity = 1); + return (Opal.def(self, '$bytesize', TMP_bytesize_26 = function $$bytesize(string) { + var self = this; + + return string.$bytes().$length() + }, TMP_bytesize_26.$$arity = 1), nil) && 'bytesize';}, TMP_24.$$s = self, TMP_24.$$arity = 0, TMP_24)); + return (function($base, $super, $parent_nesting) { + function $String(){}; + var self = $String = $klass($base, $super, 'String', $String); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_String_bytes_27, TMP_String_bytesize_28, TMP_String_each_byte_29, TMP_String_encode_30, TMP_String_force_encoding_31, TMP_String_getbyte_32, TMP_String_valid_encoding$q_33; + + def.encoding = nil; + + self.$attr_reader("encoding"); + Opal.defineProperty(String.prototype, 'encoding', $$$($$($nesting, 'Encoding'), 'UTF_16LE')); + + Opal.def(self, '$bytes', TMP_String_bytes_27 = function $$bytes() { + var self = this; + + return self.$each_byte().$to_a() + }, TMP_String_bytes_27.$$arity = 0); + + Opal.def(self, '$bytesize', TMP_String_bytesize_28 = function $$bytesize() { + var self = this; + + return self.encoding.$bytesize(self) + }, TMP_String_bytesize_28.$$arity = 0); + + Opal.def(self, '$each_byte', TMP_String_each_byte_29 = function $$each_byte() { + var $iter = TMP_String_each_byte_29.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_String_each_byte_29.$$p = null; + + + if ($iter) TMP_String_each_byte_29.$$p = null;; + if ((block !== nil)) { + } else { + return self.$enum_for("each_byte") + }; + $send(self.encoding, 'each_byte', [self], block.$to_proc()); + return self; + }, TMP_String_each_byte_29.$$arity = 0); + + Opal.def(self, '$encode', TMP_String_encode_30 = function $$encode(encoding) { + var self = this; + + return self.$dup().$force_encoding(encoding) + }, TMP_String_encode_30.$$arity = 1); + + Opal.def(self, '$force_encoding', TMP_String_force_encoding_31 = function $$force_encoding(encoding) { + var self = this; + + + if (encoding === self.encoding) { return self; } + + encoding = $$($nesting, 'Opal')['$coerce_to!'](encoding, $$($nesting, 'String'), "to_s"); + encoding = $$($nesting, 'Encoding').$find(encoding); + + if (encoding === self.encoding) { return self; } + + self.encoding = encoding; + return self; + + }, TMP_String_force_encoding_31.$$arity = 1); + + Opal.def(self, '$getbyte', TMP_String_getbyte_32 = function $$getbyte(idx) { + var self = this; + + return self.encoding.$getbyte(self, idx) + }, TMP_String_getbyte_32.$$arity = 1); + return (Opal.def(self, '$valid_encoding?', TMP_String_valid_encoding$q_33 = function() { + var self = this; + + return true + }, TMP_String_valid_encoding$q_33.$$arity = 0), nil) && 'valid_encoding?'; + })($nesting[0], null, $nesting); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/math"] = function(Opal) { + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + function $rb_divide(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs / rhs : lhs['$/'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $truthy = Opal.truthy; + + Opal.add_stubs(['$new', '$raise', '$Float', '$type_error', '$Integer', '$module_function', '$checked', '$float!', '$===', '$gamma', '$-', '$integer!', '$/', '$infinite?']); + return (function($base, $parent_nesting) { + function $Math() {}; + var self = $Math = $module($base, 'Math', $Math); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Math_checked_1, TMP_Math_float$B_2, TMP_Math_integer$B_3, TMP_Math_acos_4, TMP_Math_acosh_5, TMP_Math_asin_6, TMP_Math_asinh_7, TMP_Math_atan_8, TMP_Math_atan2_9, TMP_Math_atanh_10, TMP_Math_cbrt_11, TMP_Math_cos_12, TMP_Math_cosh_13, TMP_Math_erf_14, TMP_Math_erfc_15, TMP_Math_exp_16, TMP_Math_frexp_17, TMP_Math_gamma_18, TMP_Math_hypot_19, TMP_Math_ldexp_20, TMP_Math_lgamma_21, TMP_Math_log_22, TMP_Math_log10_23, TMP_Math_log2_24, TMP_Math_sin_25, TMP_Math_sinh_26, TMP_Math_sqrt_27, TMP_Math_tan_28, TMP_Math_tanh_29; + + + Opal.const_set($nesting[0], 'E', Math.E); + Opal.const_set($nesting[0], 'PI', Math.PI); + Opal.const_set($nesting[0], 'DomainError', $$($nesting, 'Class').$new($$($nesting, 'StandardError'))); + Opal.defs(self, '$checked', TMP_Math_checked_1 = function $$checked(method, $a) { + var $post_args, args, self = this; + + + + $post_args = Opal.slice.call(arguments, 1, arguments.length); + + args = $post_args;; + + if (isNaN(args[0]) || (args.length == 2 && isNaN(args[1]))) { + return NaN; + } + + var result = Math[method].apply(null, args); + + if (isNaN(result)) { + self.$raise($$($nesting, 'DomainError'), "" + "Numerical argument is out of domain - \"" + (method) + "\""); + } + + return result; + ; + }, TMP_Math_checked_1.$$arity = -2); + Opal.defs(self, '$float!', TMP_Math_float$B_2 = function(value) { + var self = this; + + try { + return self.$Float(value) + } catch ($err) { + if (Opal.rescue($err, [$$($nesting, 'ArgumentError')])) { + try { + return self.$raise($$($nesting, 'Opal').$type_error(value, $$($nesting, 'Float'))) + } finally { Opal.pop_exception() } + } else { throw $err; } + } + }, TMP_Math_float$B_2.$$arity = 1); + Opal.defs(self, '$integer!', TMP_Math_integer$B_3 = function(value) { + var self = this; + + try { + return self.$Integer(value) + } catch ($err) { + if (Opal.rescue($err, [$$($nesting, 'ArgumentError')])) { + try { + return self.$raise($$($nesting, 'Opal').$type_error(value, $$($nesting, 'Integer'))) + } finally { Opal.pop_exception() } + } else { throw $err; } + } + }, TMP_Math_integer$B_3.$$arity = 1); + self.$module_function(); + + Opal.def(self, '$acos', TMP_Math_acos_4 = function $$acos(x) { + var self = this; + + return $$($nesting, 'Math').$checked("acos", $$($nesting, 'Math')['$float!'](x)) + }, TMP_Math_acos_4.$$arity = 1); + if ($truthy((typeof(Math.acosh) !== "undefined"))) { + } else { + + Math.acosh = function(x) { + return Math.log(x + Math.sqrt(x * x - 1)); + } + + }; + + Opal.def(self, '$acosh', TMP_Math_acosh_5 = function $$acosh(x) { + var self = this; + + return $$($nesting, 'Math').$checked("acosh", $$($nesting, 'Math')['$float!'](x)) + }, TMP_Math_acosh_5.$$arity = 1); + + Opal.def(self, '$asin', TMP_Math_asin_6 = function $$asin(x) { + var self = this; + + return $$($nesting, 'Math').$checked("asin", $$($nesting, 'Math')['$float!'](x)) + }, TMP_Math_asin_6.$$arity = 1); + if ($truthy((typeof(Math.asinh) !== "undefined"))) { + } else { + + Math.asinh = function(x) { + return Math.log(x + Math.sqrt(x * x + 1)) + } + + }; + + Opal.def(self, '$asinh', TMP_Math_asinh_7 = function $$asinh(x) { + var self = this; + + return $$($nesting, 'Math').$checked("asinh", $$($nesting, 'Math')['$float!'](x)) + }, TMP_Math_asinh_7.$$arity = 1); + + Opal.def(self, '$atan', TMP_Math_atan_8 = function $$atan(x) { + var self = this; + + return $$($nesting, 'Math').$checked("atan", $$($nesting, 'Math')['$float!'](x)) + }, TMP_Math_atan_8.$$arity = 1); + + Opal.def(self, '$atan2', TMP_Math_atan2_9 = function $$atan2(y, x) { + var self = this; + + return $$($nesting, 'Math').$checked("atan2", $$($nesting, 'Math')['$float!'](y), $$($nesting, 'Math')['$float!'](x)) + }, TMP_Math_atan2_9.$$arity = 2); + if ($truthy((typeof(Math.atanh) !== "undefined"))) { + } else { + + Math.atanh = function(x) { + return 0.5 * Math.log((1 + x) / (1 - x)); + } + + }; + + Opal.def(self, '$atanh', TMP_Math_atanh_10 = function $$atanh(x) { + var self = this; + + return $$($nesting, 'Math').$checked("atanh", $$($nesting, 'Math')['$float!'](x)) + }, TMP_Math_atanh_10.$$arity = 1); + if ($truthy((typeof(Math.cbrt) !== "undefined"))) { + } else { + + Math.cbrt = function(x) { + if (x == 0) { + return 0; + } + + if (x < 0) { + return -Math.cbrt(-x); + } + + var r = x, + ex = 0; + + while (r < 0.125) { + r *= 8; + ex--; + } + + while (r > 1.0) { + r *= 0.125; + ex++; + } + + r = (-0.46946116 * r + 1.072302) * r + 0.3812513; + + while (ex < 0) { + r *= 0.5; + ex++; + } + + while (ex > 0) { + r *= 2; + ex--; + } + + r = (2.0 / 3.0) * r + (1.0 / 3.0) * x / (r * r); + r = (2.0 / 3.0) * r + (1.0 / 3.0) * x / (r * r); + r = (2.0 / 3.0) * r + (1.0 / 3.0) * x / (r * r); + r = (2.0 / 3.0) * r + (1.0 / 3.0) * x / (r * r); + + return r; + } + + }; + + Opal.def(self, '$cbrt', TMP_Math_cbrt_11 = function $$cbrt(x) { + var self = this; + + return $$($nesting, 'Math').$checked("cbrt", $$($nesting, 'Math')['$float!'](x)) + }, TMP_Math_cbrt_11.$$arity = 1); + + Opal.def(self, '$cos', TMP_Math_cos_12 = function $$cos(x) { + var self = this; + + return $$($nesting, 'Math').$checked("cos", $$($nesting, 'Math')['$float!'](x)) + }, TMP_Math_cos_12.$$arity = 1); + if ($truthy((typeof(Math.cosh) !== "undefined"))) { + } else { + + Math.cosh = function(x) { + return (Math.exp(x) + Math.exp(-x)) / 2; + } + + }; + + Opal.def(self, '$cosh', TMP_Math_cosh_13 = function $$cosh(x) { + var self = this; + + return $$($nesting, 'Math').$checked("cosh", $$($nesting, 'Math')['$float!'](x)) + }, TMP_Math_cosh_13.$$arity = 1); + if ($truthy((typeof(Math.erf) !== "undefined"))) { + } else { + + Opal.defineProperty(Math, 'erf', function(x) { + var A1 = 0.254829592, + A2 = -0.284496736, + A3 = 1.421413741, + A4 = -1.453152027, + A5 = 1.061405429, + P = 0.3275911; + + var sign = 1; + + if (x < 0) { + sign = -1; + } + + x = Math.abs(x); + + var t = 1.0 / (1.0 + P * x); + var y = 1.0 - (((((A5 * t + A4) * t) + A3) * t + A2) * t + A1) * t * Math.exp(-x * x); + + return sign * y; + }); + + }; + + Opal.def(self, '$erf', TMP_Math_erf_14 = function $$erf(x) { + var self = this; + + return $$($nesting, 'Math').$checked("erf", $$($nesting, 'Math')['$float!'](x)) + }, TMP_Math_erf_14.$$arity = 1); + if ($truthy((typeof(Math.erfc) !== "undefined"))) { + } else { + + Opal.defineProperty(Math, 'erfc', function(x) { + var z = Math.abs(x), + t = 1.0 / (0.5 * z + 1.0); + + var A1 = t * 0.17087277 + -0.82215223, + A2 = t * A1 + 1.48851587, + A3 = t * A2 + -1.13520398, + A4 = t * A3 + 0.27886807, + A5 = t * A4 + -0.18628806, + A6 = t * A5 + 0.09678418, + A7 = t * A6 + 0.37409196, + A8 = t * A7 + 1.00002368, + A9 = t * A8, + A10 = -z * z - 1.26551223 + A9; + + var a = t * Math.exp(A10); + + if (x < 0.0) { + return 2.0 - a; + } + else { + return a; + } + }); + + }; + + Opal.def(self, '$erfc', TMP_Math_erfc_15 = function $$erfc(x) { + var self = this; + + return $$($nesting, 'Math').$checked("erfc", $$($nesting, 'Math')['$float!'](x)) + }, TMP_Math_erfc_15.$$arity = 1); + + Opal.def(self, '$exp', TMP_Math_exp_16 = function $$exp(x) { + var self = this; + + return $$($nesting, 'Math').$checked("exp", $$($nesting, 'Math')['$float!'](x)) + }, TMP_Math_exp_16.$$arity = 1); + + Opal.def(self, '$frexp', TMP_Math_frexp_17 = function $$frexp(x) { + var self = this; + + + x = $$($nesting, 'Math')['$float!'](x); + + if (isNaN(x)) { + return [NaN, 0]; + } + + var ex = Math.floor(Math.log(Math.abs(x)) / Math.log(2)) + 1, + frac = x / Math.pow(2, ex); + + return [frac, ex]; + ; + }, TMP_Math_frexp_17.$$arity = 1); + + Opal.def(self, '$gamma', TMP_Math_gamma_18 = function $$gamma(n) { + var self = this; + + + n = $$($nesting, 'Math')['$float!'](n); + + var i, t, x, value, result, twoN, threeN, fourN, fiveN; + + var G = 4.7421875; + + var P = [ + 0.99999999999999709182, + 57.156235665862923517, + -59.597960355475491248, + 14.136097974741747174, + -0.49191381609762019978, + 0.33994649984811888699e-4, + 0.46523628927048575665e-4, + -0.98374475304879564677e-4, + 0.15808870322491248884e-3, + -0.21026444172410488319e-3, + 0.21743961811521264320e-3, + -0.16431810653676389022e-3, + 0.84418223983852743293e-4, + -0.26190838401581408670e-4, + 0.36899182659531622704e-5 + ]; + + + if (isNaN(n)) { + return NaN; + } + + if (n === 0 && 1 / n < 0) { + return -Infinity; + } + + if (n === -1 || n === -Infinity) { + self.$raise($$($nesting, 'DomainError'), "Numerical argument is out of domain - \"gamma\""); + } + + if ($$($nesting, 'Integer')['$==='](n)) { + if (n <= 0) { + return isFinite(n) ? Infinity : NaN; + } + + if (n > 171) { + return Infinity; + } + + value = n - 2; + result = n - 1; + + while (value > 1) { + result *= value; + value--; + } + + if (result == 0) { + result = 1; + } + + return result; + } + + if (n < 0.5) { + return Math.PI / (Math.sin(Math.PI * n) * $$($nesting, 'Math').$gamma($rb_minus(1, n))); + } + + if (n >= 171.35) { + return Infinity; + } + + if (n > 85.0) { + twoN = n * n; + threeN = twoN * n; + fourN = threeN * n; + fiveN = fourN * n; + + return Math.sqrt(2 * Math.PI / n) * Math.pow((n / Math.E), n) * + (1 + 1 / (12 * n) + 1 / (288 * twoN) - 139 / (51840 * threeN) - + 571 / (2488320 * fourN) + 163879 / (209018880 * fiveN) + + 5246819 / (75246796800 * fiveN * n)); + } + + n -= 1; + x = P[0]; + + for (i = 1; i < P.length; ++i) { + x += P[i] / (n + i); + } + + t = n + G + 0.5; + + return Math.sqrt(2 * Math.PI) * Math.pow(t, n + 0.5) * Math.exp(-t) * x; + ; + }, TMP_Math_gamma_18.$$arity = 1); + if ($truthy((typeof(Math.hypot) !== "undefined"))) { + } else { + + Math.hypot = function(x, y) { + return Math.sqrt(x * x + y * y) + } + + }; + + Opal.def(self, '$hypot', TMP_Math_hypot_19 = function $$hypot(x, y) { + var self = this; + + return $$($nesting, 'Math').$checked("hypot", $$($nesting, 'Math')['$float!'](x), $$($nesting, 'Math')['$float!'](y)) + }, TMP_Math_hypot_19.$$arity = 2); + + Opal.def(self, '$ldexp', TMP_Math_ldexp_20 = function $$ldexp(mantissa, exponent) { + var self = this; + + + mantissa = $$($nesting, 'Math')['$float!'](mantissa); + exponent = $$($nesting, 'Math')['$integer!'](exponent); + + if (isNaN(exponent)) { + self.$raise($$($nesting, 'RangeError'), "float NaN out of range of integer"); + } + + return mantissa * Math.pow(2, exponent); + ; + }, TMP_Math_ldexp_20.$$arity = 2); + + Opal.def(self, '$lgamma', TMP_Math_lgamma_21 = function $$lgamma(n) { + var self = this; + + + if (n == -1) { + return [Infinity, 1]; + } + else { + return [Math.log(Math.abs($$($nesting, 'Math').$gamma(n))), $$($nesting, 'Math').$gamma(n) < 0 ? -1 : 1]; + } + + }, TMP_Math_lgamma_21.$$arity = 1); + + Opal.def(self, '$log', TMP_Math_log_22 = function $$log(x, base) { + var self = this; + + + ; + if ($truthy($$($nesting, 'String')['$==='](x))) { + self.$raise($$($nesting, 'Opal').$type_error(x, $$($nesting, 'Float')))}; + if ($truthy(base == null)) { + return $$($nesting, 'Math').$checked("log", $$($nesting, 'Math')['$float!'](x)) + } else { + + if ($truthy($$($nesting, 'String')['$==='](base))) { + self.$raise($$($nesting, 'Opal').$type_error(base, $$($nesting, 'Float')))}; + return $rb_divide($$($nesting, 'Math').$checked("log", $$($nesting, 'Math')['$float!'](x)), $$($nesting, 'Math').$checked("log", $$($nesting, 'Math')['$float!'](base))); + }; + }, TMP_Math_log_22.$$arity = -2); + if ($truthy((typeof(Math.log10) !== "undefined"))) { + } else { + + Math.log10 = function(x) { + return Math.log(x) / Math.LN10; + } + + }; + + Opal.def(self, '$log10', TMP_Math_log10_23 = function $$log10(x) { + var self = this; + + + if ($truthy($$($nesting, 'String')['$==='](x))) { + self.$raise($$($nesting, 'Opal').$type_error(x, $$($nesting, 'Float')))}; + return $$($nesting, 'Math').$checked("log10", $$($nesting, 'Math')['$float!'](x)); + }, TMP_Math_log10_23.$$arity = 1); + if ($truthy((typeof(Math.log2) !== "undefined"))) { + } else { + + Math.log2 = function(x) { + return Math.log(x) / Math.LN2; + } + + }; + + Opal.def(self, '$log2', TMP_Math_log2_24 = function $$log2(x) { + var self = this; + + + if ($truthy($$($nesting, 'String')['$==='](x))) { + self.$raise($$($nesting, 'Opal').$type_error(x, $$($nesting, 'Float')))}; + return $$($nesting, 'Math').$checked("log2", $$($nesting, 'Math')['$float!'](x)); + }, TMP_Math_log2_24.$$arity = 1); + + Opal.def(self, '$sin', TMP_Math_sin_25 = function $$sin(x) { + var self = this; + + return $$($nesting, 'Math').$checked("sin", $$($nesting, 'Math')['$float!'](x)) + }, TMP_Math_sin_25.$$arity = 1); + if ($truthy((typeof(Math.sinh) !== "undefined"))) { + } else { + + Math.sinh = function(x) { + return (Math.exp(x) - Math.exp(-x)) / 2; + } + + }; + + Opal.def(self, '$sinh', TMP_Math_sinh_26 = function $$sinh(x) { + var self = this; + + return $$($nesting, 'Math').$checked("sinh", $$($nesting, 'Math')['$float!'](x)) + }, TMP_Math_sinh_26.$$arity = 1); + + Opal.def(self, '$sqrt', TMP_Math_sqrt_27 = function $$sqrt(x) { + var self = this; + + return $$($nesting, 'Math').$checked("sqrt", $$($nesting, 'Math')['$float!'](x)) + }, TMP_Math_sqrt_27.$$arity = 1); + + Opal.def(self, '$tan', TMP_Math_tan_28 = function $$tan(x) { + var self = this; + + + x = $$($nesting, 'Math')['$float!'](x); + if ($truthy(x['$infinite?']())) { + return $$$($$($nesting, 'Float'), 'NAN')}; + return $$($nesting, 'Math').$checked("tan", $$($nesting, 'Math')['$float!'](x)); + }, TMP_Math_tan_28.$$arity = 1); + if ($truthy((typeof(Math.tanh) !== "undefined"))) { + } else { + + Math.tanh = function(x) { + if (x == Infinity) { + return 1; + } + else if (x == -Infinity) { + return -1; + } + else { + return (Math.exp(x) - Math.exp(-x)) / (Math.exp(x) + Math.exp(-x)); + } + } + + }; + + Opal.def(self, '$tanh', TMP_Math_tanh_29 = function $$tanh(x) { + var self = this; + + return $$($nesting, 'Math').$checked("tanh", $$($nesting, 'Math')['$float!'](x)) + }, TMP_Math_tanh_29.$$arity = 1); + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/complex"] = function(Opal) { + function $rb_times(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs * rhs : lhs['$*'](rhs); + } + function $rb_plus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); + } + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + function $rb_divide(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs / rhs : lhs['$/'](rhs); + } + function $rb_gt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $truthy = Opal.truthy, $module = Opal.module; + + Opal.add_stubs(['$require', '$===', '$real?', '$raise', '$new', '$*', '$cos', '$sin', '$attr_reader', '$class', '$==', '$real', '$imag', '$Complex', '$-@', '$+', '$__coerced__', '$-', '$nan?', '$/', '$conj', '$abs2', '$quo', '$polar', '$exp', '$log', '$>', '$!=', '$divmod', '$**', '$hypot', '$atan2', '$lcm', '$denominator', '$finite?', '$infinite?', '$numerator', '$abs', '$arg', '$rationalize', '$to_f', '$to_i', '$to_r', '$inspect', '$positive?', '$zero?', '$Rational']); + + self.$require("corelib/numeric"); + (function($base, $super, $parent_nesting) { + function $Complex(){}; + var self = $Complex = $klass($base, $super, 'Complex', $Complex); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Complex_rect_1, TMP_Complex_polar_2, TMP_Complex_initialize_3, TMP_Complex_coerce_4, TMP_Complex_$eq$eq_5, TMP_Complex_$$_6, TMP_Complex_$_7, TMP_Complex_$_8, TMP_Complex_$_9, TMP_Complex_$_10, TMP_Complex_$$_11, TMP_Complex_abs_12, TMP_Complex_abs2_13, TMP_Complex_angle_14, TMP_Complex_conj_15, TMP_Complex_denominator_16, TMP_Complex_eql$q_17, TMP_Complex_fdiv_18, TMP_Complex_finite$q_19, TMP_Complex_hash_20, TMP_Complex_infinite$q_21, TMP_Complex_inspect_22, TMP_Complex_numerator_23, TMP_Complex_polar_24, TMP_Complex_rationalize_25, TMP_Complex_real$q_26, TMP_Complex_rect_27, TMP_Complex_to_f_28, TMP_Complex_to_i_29, TMP_Complex_to_r_30, TMP_Complex_to_s_31; + + def.real = def.imag = nil; + + Opal.defs(self, '$rect', TMP_Complex_rect_1 = function $$rect(real, imag) { + var $a, $b, $c, self = this; + + + + if (imag == null) { + imag = 0; + }; + if ($truthy(($truthy($a = ($truthy($b = ($truthy($c = $$($nesting, 'Numeric')['$==='](real)) ? real['$real?']() : $c)) ? $$($nesting, 'Numeric')['$==='](imag) : $b)) ? imag['$real?']() : $a))) { + } else { + self.$raise($$($nesting, 'TypeError'), "not a real") + }; + return self.$new(real, imag); + }, TMP_Complex_rect_1.$$arity = -2); + (function(self, $parent_nesting) { + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return Opal.alias(self, "rectangular", "rect") + })(Opal.get_singleton_class(self), $nesting); + Opal.defs(self, '$polar', TMP_Complex_polar_2 = function $$polar(r, theta) { + var $a, $b, $c, self = this; + + + + if (theta == null) { + theta = 0; + }; + if ($truthy(($truthy($a = ($truthy($b = ($truthy($c = $$($nesting, 'Numeric')['$==='](r)) ? r['$real?']() : $c)) ? $$($nesting, 'Numeric')['$==='](theta) : $b)) ? theta['$real?']() : $a))) { + } else { + self.$raise($$($nesting, 'TypeError'), "not a real") + }; + return self.$new($rb_times(r, $$($nesting, 'Math').$cos(theta)), $rb_times(r, $$($nesting, 'Math').$sin(theta))); + }, TMP_Complex_polar_2.$$arity = -2); + self.$attr_reader("real", "imag"); + + Opal.def(self, '$initialize', TMP_Complex_initialize_3 = function $$initialize(real, imag) { + var self = this; + + + + if (imag == null) { + imag = 0; + }; + self.real = real; + return (self.imag = imag); + }, TMP_Complex_initialize_3.$$arity = -2); + + Opal.def(self, '$coerce', TMP_Complex_coerce_4 = function $$coerce(other) { + var $a, self = this; + + if ($truthy($$($nesting, 'Complex')['$==='](other))) { + return [other, self] + } else if ($truthy(($truthy($a = $$($nesting, 'Numeric')['$==='](other)) ? other['$real?']() : $a))) { + return [$$($nesting, 'Complex').$new(other, 0), self] + } else { + return self.$raise($$($nesting, 'TypeError'), "" + (other.$class()) + " can't be coerced into Complex") + } + }, TMP_Complex_coerce_4.$$arity = 1); + + Opal.def(self, '$==', TMP_Complex_$eq$eq_5 = function(other) { + var $a, self = this; + + if ($truthy($$($nesting, 'Complex')['$==='](other))) { + return (($a = self.real['$=='](other.$real())) ? self.imag['$=='](other.$imag()) : self.real['$=='](other.$real())) + } else if ($truthy(($truthy($a = $$($nesting, 'Numeric')['$==='](other)) ? other['$real?']() : $a))) { + return (($a = self.real['$=='](other)) ? self.imag['$=='](0) : self.real['$=='](other)) + } else { + return other['$=='](self) + } + }, TMP_Complex_$eq$eq_5.$$arity = 1); + + Opal.def(self, '$-@', TMP_Complex_$$_6 = function() { + var self = this; + + return self.$Complex(self.real['$-@'](), self.imag['$-@']()) + }, TMP_Complex_$$_6.$$arity = 0); + + Opal.def(self, '$+', TMP_Complex_$_7 = function(other) { + var $a, self = this; + + if ($truthy($$($nesting, 'Complex')['$==='](other))) { + return self.$Complex($rb_plus(self.real, other.$real()), $rb_plus(self.imag, other.$imag())) + } else if ($truthy(($truthy($a = $$($nesting, 'Numeric')['$==='](other)) ? other['$real?']() : $a))) { + return self.$Complex($rb_plus(self.real, other), self.imag) + } else { + return self.$__coerced__("+", other) + } + }, TMP_Complex_$_7.$$arity = 1); + + Opal.def(self, '$-', TMP_Complex_$_8 = function(other) { + var $a, self = this; + + if ($truthy($$($nesting, 'Complex')['$==='](other))) { + return self.$Complex($rb_minus(self.real, other.$real()), $rb_minus(self.imag, other.$imag())) + } else if ($truthy(($truthy($a = $$($nesting, 'Numeric')['$==='](other)) ? other['$real?']() : $a))) { + return self.$Complex($rb_minus(self.real, other), self.imag) + } else { + return self.$__coerced__("-", other) + } + }, TMP_Complex_$_8.$$arity = 1); + + Opal.def(self, '$*', TMP_Complex_$_9 = function(other) { + var $a, self = this; + + if ($truthy($$($nesting, 'Complex')['$==='](other))) { + return self.$Complex($rb_minus($rb_times(self.real, other.$real()), $rb_times(self.imag, other.$imag())), $rb_plus($rb_times(self.real, other.$imag()), $rb_times(self.imag, other.$real()))) + } else if ($truthy(($truthy($a = $$($nesting, 'Numeric')['$==='](other)) ? other['$real?']() : $a))) { + return self.$Complex($rb_times(self.real, other), $rb_times(self.imag, other)) + } else { + return self.$__coerced__("*", other) + } + }, TMP_Complex_$_9.$$arity = 1); + + Opal.def(self, '$/', TMP_Complex_$_10 = function(other) { + var $a, $b, $c, $d, self = this; + + if ($truthy($$($nesting, 'Complex')['$==='](other))) { + if ($truthy(($truthy($a = ($truthy($b = ($truthy($c = ($truthy($d = $$($nesting, 'Number')['$==='](self.real)) ? self.real['$nan?']() : $d)) ? $c : ($truthy($d = $$($nesting, 'Number')['$==='](self.imag)) ? self.imag['$nan?']() : $d))) ? $b : ($truthy($c = $$($nesting, 'Number')['$==='](other.$real())) ? other.$real()['$nan?']() : $c))) ? $a : ($truthy($b = $$($nesting, 'Number')['$==='](other.$imag())) ? other.$imag()['$nan?']() : $b)))) { + return $$($nesting, 'Complex').$new($$$($$($nesting, 'Float'), 'NAN'), $$$($$($nesting, 'Float'), 'NAN')) + } else { + return $rb_divide($rb_times(self, other.$conj()), other.$abs2()) + } + } else if ($truthy(($truthy($a = $$($nesting, 'Numeric')['$==='](other)) ? other['$real?']() : $a))) { + return self.$Complex(self.real.$quo(other), self.imag.$quo(other)) + } else { + return self.$__coerced__("/", other) + } + }, TMP_Complex_$_10.$$arity = 1); + + Opal.def(self, '$**', TMP_Complex_$$_11 = function(other) { + var $a, $b, $c, $d, self = this, r = nil, theta = nil, ore = nil, oim = nil, nr = nil, ntheta = nil, x = nil, z = nil, n = nil, div = nil, mod = nil; + + + if (other['$=='](0)) { + return $$($nesting, 'Complex').$new(1, 0)}; + if ($truthy($$($nesting, 'Complex')['$==='](other))) { + + $b = self.$polar(), $a = Opal.to_ary($b), (r = ($a[0] == null ? nil : $a[0])), (theta = ($a[1] == null ? nil : $a[1])), $b; + ore = other.$real(); + oim = other.$imag(); + nr = $$($nesting, 'Math').$exp($rb_minus($rb_times(ore, $$($nesting, 'Math').$log(r)), $rb_times(oim, theta))); + ntheta = $rb_plus($rb_times(theta, ore), $rb_times(oim, $$($nesting, 'Math').$log(r))); + return $$($nesting, 'Complex').$polar(nr, ntheta); + } else if ($truthy($$($nesting, 'Integer')['$==='](other))) { + if ($truthy($rb_gt(other, 0))) { + + x = self; + z = x; + n = $rb_minus(other, 1); + while ($truthy(n['$!='](0))) { + + $c = n.$divmod(2), $b = Opal.to_ary($c), (div = ($b[0] == null ? nil : $b[0])), (mod = ($b[1] == null ? nil : $b[1])), $c; + while (mod['$=='](0)) { + + x = self.$Complex($rb_minus($rb_times(x.$real(), x.$real()), $rb_times(x.$imag(), x.$imag())), $rb_times($rb_times(2, x.$real()), x.$imag())); + n = div; + $d = n.$divmod(2), $c = Opal.to_ary($d), (div = ($c[0] == null ? nil : $c[0])), (mod = ($c[1] == null ? nil : $c[1])), $d; + }; + z = $rb_times(z, x); + n = $rb_minus(n, 1); + }; + return z; + } else { + return $rb_divide($$($nesting, 'Rational').$new(1, 1), self)['$**'](other['$-@']()) + } + } else if ($truthy(($truthy($a = $$($nesting, 'Float')['$==='](other)) ? $a : $$($nesting, 'Rational')['$==='](other)))) { + + $b = self.$polar(), $a = Opal.to_ary($b), (r = ($a[0] == null ? nil : $a[0])), (theta = ($a[1] == null ? nil : $a[1])), $b; + return $$($nesting, 'Complex').$polar(r['$**'](other), $rb_times(theta, other)); + } else { + return self.$__coerced__("**", other) + }; + }, TMP_Complex_$$_11.$$arity = 1); + + Opal.def(self, '$abs', TMP_Complex_abs_12 = function $$abs() { + var self = this; + + return $$($nesting, 'Math').$hypot(self.real, self.imag) + }, TMP_Complex_abs_12.$$arity = 0); + + Opal.def(self, '$abs2', TMP_Complex_abs2_13 = function $$abs2() { + var self = this; + + return $rb_plus($rb_times(self.real, self.real), $rb_times(self.imag, self.imag)) + }, TMP_Complex_abs2_13.$$arity = 0); + + Opal.def(self, '$angle', TMP_Complex_angle_14 = function $$angle() { + var self = this; + + return $$($nesting, 'Math').$atan2(self.imag, self.real) + }, TMP_Complex_angle_14.$$arity = 0); + Opal.alias(self, "arg", "angle"); + + Opal.def(self, '$conj', TMP_Complex_conj_15 = function $$conj() { + var self = this; + + return self.$Complex(self.real, self.imag['$-@']()) + }, TMP_Complex_conj_15.$$arity = 0); + Opal.alias(self, "conjugate", "conj"); + + Opal.def(self, '$denominator', TMP_Complex_denominator_16 = function $$denominator() { + var self = this; + + return self.real.$denominator().$lcm(self.imag.$denominator()) + }, TMP_Complex_denominator_16.$$arity = 0); + Opal.alias(self, "divide", "/"); + + Opal.def(self, '$eql?', TMP_Complex_eql$q_17 = function(other) { + var $a, $b, self = this; + + return ($truthy($a = ($truthy($b = $$($nesting, 'Complex')['$==='](other)) ? self.real.$class()['$=='](self.imag.$class()) : $b)) ? self['$=='](other) : $a) + }, TMP_Complex_eql$q_17.$$arity = 1); + + Opal.def(self, '$fdiv', TMP_Complex_fdiv_18 = function $$fdiv(other) { + var self = this; + + + if ($truthy($$($nesting, 'Numeric')['$==='](other))) { + } else { + self.$raise($$($nesting, 'TypeError'), "" + (other.$class()) + " can't be coerced into Complex") + }; + return $rb_divide(self, other); + }, TMP_Complex_fdiv_18.$$arity = 1); + + Opal.def(self, '$finite?', TMP_Complex_finite$q_19 = function() { + var $a, self = this; + + return ($truthy($a = self.real['$finite?']()) ? self.imag['$finite?']() : $a) + }, TMP_Complex_finite$q_19.$$arity = 0); + + Opal.def(self, '$hash', TMP_Complex_hash_20 = function $$hash() { + var self = this; + + return "" + "Complex:" + (self.real) + ":" + (self.imag) + }, TMP_Complex_hash_20.$$arity = 0); + Opal.alias(self, "imaginary", "imag"); + + Opal.def(self, '$infinite?', TMP_Complex_infinite$q_21 = function() { + var $a, self = this; + + return ($truthy($a = self.real['$infinite?']()) ? $a : self.imag['$infinite?']()) + }, TMP_Complex_infinite$q_21.$$arity = 0); + + Opal.def(self, '$inspect', TMP_Complex_inspect_22 = function $$inspect() { + var self = this; + + return "" + "(" + (self) + ")" + }, TMP_Complex_inspect_22.$$arity = 0); + Opal.alias(self, "magnitude", "abs"); + + Opal.udef(self, '$' + "negative?");; + + Opal.def(self, '$numerator', TMP_Complex_numerator_23 = function $$numerator() { + var self = this, d = nil; + + + d = self.$denominator(); + return self.$Complex($rb_times(self.real.$numerator(), $rb_divide(d, self.real.$denominator())), $rb_times(self.imag.$numerator(), $rb_divide(d, self.imag.$denominator()))); + }, TMP_Complex_numerator_23.$$arity = 0); + Opal.alias(self, "phase", "arg"); + + Opal.def(self, '$polar', TMP_Complex_polar_24 = function $$polar() { + var self = this; + + return [self.$abs(), self.$arg()] + }, TMP_Complex_polar_24.$$arity = 0); + + Opal.udef(self, '$' + "positive?");; + Opal.alias(self, "quo", "/"); + + Opal.def(self, '$rationalize', TMP_Complex_rationalize_25 = function $$rationalize(eps) { + var self = this; + + + ; + + if (arguments.length > 1) { + self.$raise($$($nesting, 'ArgumentError'), "" + "wrong number of arguments (" + (arguments.length) + " for 0..1)"); + } + ; + if ($truthy(self.imag['$!='](0))) { + self.$raise($$($nesting, 'RangeError'), "" + "can't' convert " + (self) + " into Rational")}; + return self.$real().$rationalize(eps); + }, TMP_Complex_rationalize_25.$$arity = -1); + + Opal.def(self, '$real?', TMP_Complex_real$q_26 = function() { + var self = this; + + return false + }, TMP_Complex_real$q_26.$$arity = 0); + + Opal.def(self, '$rect', TMP_Complex_rect_27 = function $$rect() { + var self = this; + + return [self.real, self.imag] + }, TMP_Complex_rect_27.$$arity = 0); + Opal.alias(self, "rectangular", "rect"); + + Opal.def(self, '$to_f', TMP_Complex_to_f_28 = function $$to_f() { + var self = this; + + + if (self.imag['$=='](0)) { + } else { + self.$raise($$($nesting, 'RangeError'), "" + "can't convert " + (self) + " into Float") + }; + return self.real.$to_f(); + }, TMP_Complex_to_f_28.$$arity = 0); + + Opal.def(self, '$to_i', TMP_Complex_to_i_29 = function $$to_i() { + var self = this; + + + if (self.imag['$=='](0)) { + } else { + self.$raise($$($nesting, 'RangeError'), "" + "can't convert " + (self) + " into Integer") + }; + return self.real.$to_i(); + }, TMP_Complex_to_i_29.$$arity = 0); + + Opal.def(self, '$to_r', TMP_Complex_to_r_30 = function $$to_r() { + var self = this; + + + if (self.imag['$=='](0)) { + } else { + self.$raise($$($nesting, 'RangeError'), "" + "can't convert " + (self) + " into Rational") + }; + return self.real.$to_r(); + }, TMP_Complex_to_r_30.$$arity = 0); + + Opal.def(self, '$to_s', TMP_Complex_to_s_31 = function $$to_s() { + var $a, $b, $c, self = this, result = nil; + + + result = self.real.$inspect(); + result = $rb_plus(result, (function() {if ($truthy(($truthy($a = ($truthy($b = ($truthy($c = $$($nesting, 'Number')['$==='](self.imag)) ? self.imag['$nan?']() : $c)) ? $b : self.imag['$positive?']())) ? $a : self.imag['$zero?']()))) { + return "+" + } else { + return "-" + }; return nil; })()); + result = $rb_plus(result, self.imag.$abs().$inspect()); + if ($truthy(($truthy($a = $$($nesting, 'Number')['$==='](self.imag)) ? ($truthy($b = self.imag['$nan?']()) ? $b : self.imag['$infinite?']()) : $a))) { + result = $rb_plus(result, "*")}; + return $rb_plus(result, "i"); + }, TMP_Complex_to_s_31.$$arity = 0); + return Opal.const_set($nesting[0], 'I', self.$new(0, 1)); + })($nesting[0], $$($nesting, 'Numeric'), $nesting); + (function($base, $parent_nesting) { + function $Kernel() {}; + var self = $Kernel = $module($base, 'Kernel', $Kernel); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Kernel_Complex_32; + + + Opal.def(self, '$Complex', TMP_Kernel_Complex_32 = function $$Complex(real, imag) { + var self = this; + + + + if (imag == null) { + imag = nil; + }; + if ($truthy(imag)) { + return $$($nesting, 'Complex').$new(real, imag) + } else { + return $$($nesting, 'Complex').$new(real, 0) + }; + }, TMP_Kernel_Complex_32.$$arity = -2) + })($nesting[0], $nesting); + return (function($base, $super, $parent_nesting) { + function $String(){}; + var self = $String = $klass($base, $super, 'String', $String); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_String_to_c_33; + + return (Opal.def(self, '$to_c', TMP_String_to_c_33 = function $$to_c() { + var self = this; + + + var str = self, + re = /[+-]?[\d_]+(\.[\d_]+)?(e\d+)?/, + match = str.match(re), + real, imag, denominator; + + function isFloat() { + return re.test(str); + } + + function cutFloat() { + var match = str.match(re); + var number = match[0]; + str = str.slice(number.length); + return number.replace(/_/g, ''); + } + + // handles both floats and rationals + function cutNumber() { + if (isFloat()) { + var numerator = parseFloat(cutFloat()); + + if (str[0] === '/') { + // rational real part + str = str.slice(1); + + if (isFloat()) { + var denominator = parseFloat(cutFloat()); + return self.$Rational(numerator, denominator); + } else { + // reverting '/' + str = '/' + str; + return numerator; + } + } else { + // float real part, no denominator + return numerator; + } + } else { + return null; + } + } + + real = cutNumber(); + + if (!real) { + if (str[0] === 'i') { + // i => Complex(0, 1) + return self.$Complex(0, 1); + } + if (str[0] === '-' && str[1] === 'i') { + // -i => Complex(0, -1) + return self.$Complex(0, -1); + } + if (str[0] === '+' && str[1] === 'i') { + // +i => Complex(0, 1) + return self.$Complex(0, 1); + } + // anything => Complex(0, 0) + return self.$Complex(0, 0); + } + + imag = cutNumber(); + if (!imag) { + if (str[0] === 'i') { + // 3i => Complex(0, 3) + return self.$Complex(0, real); + } else { + // 3 => Complex(3, 0) + return self.$Complex(real, 0); + } + } else { + // 3+2i => Complex(3, 2) + return self.$Complex(real, imag); + } + + }, TMP_String_to_c_33.$$arity = 0), nil) && 'to_c' + })($nesting[0], null, $nesting); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/rational"] = function(Opal) { + function $rb_lt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); + } + function $rb_divide(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs / rhs : lhs['$/'](rhs); + } + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + function $rb_times(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs * rhs : lhs['$*'](rhs); + } + function $rb_plus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); + } + function $rb_gt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); + } + function $rb_le(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs <= rhs : lhs['$<='](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $truthy = Opal.truthy, $module = Opal.module; + + Opal.add_stubs(['$require', '$to_i', '$==', '$raise', '$<', '$-@', '$new', '$gcd', '$/', '$nil?', '$===', '$reduce', '$to_r', '$equal?', '$!', '$coerce_to!', '$to_f', '$numerator', '$denominator', '$<=>', '$-', '$*', '$__coerced__', '$+', '$Rational', '$>', '$**', '$abs', '$ceil', '$with_precision', '$floor', '$<=', '$truncate', '$send', '$convert']); + + self.$require("corelib/numeric"); + (function($base, $super, $parent_nesting) { + function $Rational(){}; + var self = $Rational = $klass($base, $super, 'Rational', $Rational); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Rational_reduce_1, TMP_Rational_convert_2, TMP_Rational_initialize_3, TMP_Rational_numerator_4, TMP_Rational_denominator_5, TMP_Rational_coerce_6, TMP_Rational_$eq$eq_7, TMP_Rational_$lt$eq$gt_8, TMP_Rational_$_9, TMP_Rational_$_10, TMP_Rational_$_11, TMP_Rational_$_12, TMP_Rational_$$_13, TMP_Rational_abs_14, TMP_Rational_ceil_15, TMP_Rational_floor_16, TMP_Rational_hash_17, TMP_Rational_inspect_18, TMP_Rational_rationalize_19, TMP_Rational_round_20, TMP_Rational_to_f_21, TMP_Rational_to_i_22, TMP_Rational_to_r_23, TMP_Rational_to_s_24, TMP_Rational_truncate_25, TMP_Rational_with_precision_26; + + def.num = def.den = nil; + + Opal.defs(self, '$reduce', TMP_Rational_reduce_1 = function $$reduce(num, den) { + var self = this, gcd = nil; + + + num = num.$to_i(); + den = den.$to_i(); + if (den['$=='](0)) { + self.$raise($$($nesting, 'ZeroDivisionError'), "divided by 0") + } else if ($truthy($rb_lt(den, 0))) { + + num = num['$-@'](); + den = den['$-@'](); + } else if (den['$=='](1)) { + return self.$new(num, den)}; + gcd = num.$gcd(den); + return self.$new($rb_divide(num, gcd), $rb_divide(den, gcd)); + }, TMP_Rational_reduce_1.$$arity = 2); + Opal.defs(self, '$convert', TMP_Rational_convert_2 = function $$convert(num, den) { + var $a, $b, self = this; + + + if ($truthy(($truthy($a = num['$nil?']()) ? $a : den['$nil?']()))) { + self.$raise($$($nesting, 'TypeError'), "cannot convert nil into Rational")}; + if ($truthy(($truthy($a = $$($nesting, 'Integer')['$==='](num)) ? $$($nesting, 'Integer')['$==='](den) : $a))) { + return self.$reduce(num, den)}; + if ($truthy(($truthy($a = ($truthy($b = $$($nesting, 'Float')['$==='](num)) ? $b : $$($nesting, 'String')['$==='](num))) ? $a : $$($nesting, 'Complex')['$==='](num)))) { + num = num.$to_r()}; + if ($truthy(($truthy($a = ($truthy($b = $$($nesting, 'Float')['$==='](den)) ? $b : $$($nesting, 'String')['$==='](den))) ? $a : $$($nesting, 'Complex')['$==='](den)))) { + den = den.$to_r()}; + if ($truthy(($truthy($a = den['$equal?'](1)) ? $$($nesting, 'Integer')['$==='](num)['$!']() : $a))) { + return $$($nesting, 'Opal')['$coerce_to!'](num, $$($nesting, 'Rational'), "to_r") + } else if ($truthy(($truthy($a = $$($nesting, 'Numeric')['$==='](num)) ? $$($nesting, 'Numeric')['$==='](den) : $a))) { + return $rb_divide(num, den) + } else { + return self.$reduce(num, den) + }; + }, TMP_Rational_convert_2.$$arity = 2); + + Opal.def(self, '$initialize', TMP_Rational_initialize_3 = function $$initialize(num, den) { + var self = this; + + + self.num = num; + return (self.den = den); + }, TMP_Rational_initialize_3.$$arity = 2); + + Opal.def(self, '$numerator', TMP_Rational_numerator_4 = function $$numerator() { + var self = this; + + return self.num + }, TMP_Rational_numerator_4.$$arity = 0); + + Opal.def(self, '$denominator', TMP_Rational_denominator_5 = function $$denominator() { + var self = this; + + return self.den + }, TMP_Rational_denominator_5.$$arity = 0); + + Opal.def(self, '$coerce', TMP_Rational_coerce_6 = function $$coerce(other) { + var self = this, $case = nil; + + return (function() {$case = other; + if ($$($nesting, 'Rational')['$===']($case)) {return [other, self]} + else if ($$($nesting, 'Integer')['$===']($case)) {return [other.$to_r(), self]} + else if ($$($nesting, 'Float')['$===']($case)) {return [other, self.$to_f()]} + else { return nil }})() + }, TMP_Rational_coerce_6.$$arity = 1); + + Opal.def(self, '$==', TMP_Rational_$eq$eq_7 = function(other) { + var $a, self = this, $case = nil; + + return (function() {$case = other; + if ($$($nesting, 'Rational')['$===']($case)) {return (($a = self.num['$=='](other.$numerator())) ? self.den['$=='](other.$denominator()) : self.num['$=='](other.$numerator()))} + else if ($$($nesting, 'Integer')['$===']($case)) {return (($a = self.num['$=='](other)) ? self.den['$=='](1) : self.num['$=='](other))} + else if ($$($nesting, 'Float')['$===']($case)) {return self.$to_f()['$=='](other)} + else {return other['$=='](self)}})() + }, TMP_Rational_$eq$eq_7.$$arity = 1); + + Opal.def(self, '$<=>', TMP_Rational_$lt$eq$gt_8 = function(other) { + var self = this, $case = nil; + + return (function() {$case = other; + if ($$($nesting, 'Rational')['$===']($case)) {return $rb_minus($rb_times(self.num, other.$denominator()), $rb_times(self.den, other.$numerator()))['$<=>'](0)} + else if ($$($nesting, 'Integer')['$===']($case)) {return $rb_minus(self.num, $rb_times(self.den, other))['$<=>'](0)} + else if ($$($nesting, 'Float')['$===']($case)) {return self.$to_f()['$<=>'](other)} + else {return self.$__coerced__("<=>", other)}})() + }, TMP_Rational_$lt$eq$gt_8.$$arity = 1); + + Opal.def(self, '$+', TMP_Rational_$_9 = function(other) { + var self = this, $case = nil, num = nil, den = nil; + + return (function() {$case = other; + if ($$($nesting, 'Rational')['$===']($case)) { + num = $rb_plus($rb_times(self.num, other.$denominator()), $rb_times(self.den, other.$numerator())); + den = $rb_times(self.den, other.$denominator()); + return self.$Rational(num, den);} + else if ($$($nesting, 'Integer')['$===']($case)) {return self.$Rational($rb_plus(self.num, $rb_times(other, self.den)), self.den)} + else if ($$($nesting, 'Float')['$===']($case)) {return $rb_plus(self.$to_f(), other)} + else {return self.$__coerced__("+", other)}})() + }, TMP_Rational_$_9.$$arity = 1); + + Opal.def(self, '$-', TMP_Rational_$_10 = function(other) { + var self = this, $case = nil, num = nil, den = nil; + + return (function() {$case = other; + if ($$($nesting, 'Rational')['$===']($case)) { + num = $rb_minus($rb_times(self.num, other.$denominator()), $rb_times(self.den, other.$numerator())); + den = $rb_times(self.den, other.$denominator()); + return self.$Rational(num, den);} + else if ($$($nesting, 'Integer')['$===']($case)) {return self.$Rational($rb_minus(self.num, $rb_times(other, self.den)), self.den)} + else if ($$($nesting, 'Float')['$===']($case)) {return $rb_minus(self.$to_f(), other)} + else {return self.$__coerced__("-", other)}})() + }, TMP_Rational_$_10.$$arity = 1); + + Opal.def(self, '$*', TMP_Rational_$_11 = function(other) { + var self = this, $case = nil, num = nil, den = nil; + + return (function() {$case = other; + if ($$($nesting, 'Rational')['$===']($case)) { + num = $rb_times(self.num, other.$numerator()); + den = $rb_times(self.den, other.$denominator()); + return self.$Rational(num, den);} + else if ($$($nesting, 'Integer')['$===']($case)) {return self.$Rational($rb_times(self.num, other), self.den)} + else if ($$($nesting, 'Float')['$===']($case)) {return $rb_times(self.$to_f(), other)} + else {return self.$__coerced__("*", other)}})() + }, TMP_Rational_$_11.$$arity = 1); + + Opal.def(self, '$/', TMP_Rational_$_12 = function(other) { + var self = this, $case = nil, num = nil, den = nil; + + return (function() {$case = other; + if ($$($nesting, 'Rational')['$===']($case)) { + num = $rb_times(self.num, other.$denominator()); + den = $rb_times(self.den, other.$numerator()); + return self.$Rational(num, den);} + else if ($$($nesting, 'Integer')['$===']($case)) {if (other['$=='](0)) { + return $rb_divide(self.$to_f(), 0.0) + } else { + return self.$Rational(self.num, $rb_times(self.den, other)) + }} + else if ($$($nesting, 'Float')['$===']($case)) {return $rb_divide(self.$to_f(), other)} + else {return self.$__coerced__("/", other)}})() + }, TMP_Rational_$_12.$$arity = 1); + + Opal.def(self, '$**', TMP_Rational_$$_13 = function(other) { + var $a, self = this, $case = nil; + + return (function() {$case = other; + if ($$($nesting, 'Integer')['$===']($case)) {if ($truthy((($a = self['$=='](0)) ? $rb_lt(other, 0) : self['$=='](0)))) { + return $$$($$($nesting, 'Float'), 'INFINITY') + } else if ($truthy($rb_gt(other, 0))) { + return self.$Rational(self.num['$**'](other), self.den['$**'](other)) + } else if ($truthy($rb_lt(other, 0))) { + return self.$Rational(self.den['$**'](other['$-@']()), self.num['$**'](other['$-@']())) + } else { + return self.$Rational(1, 1) + }} + else if ($$($nesting, 'Float')['$===']($case)) {return self.$to_f()['$**'](other)} + else if ($$($nesting, 'Rational')['$===']($case)) {if (other['$=='](0)) { + return self.$Rational(1, 1) + } else if (other.$denominator()['$=='](1)) { + if ($truthy($rb_lt(other, 0))) { + return self.$Rational(self.den['$**'](other.$numerator().$abs()), self.num['$**'](other.$numerator().$abs())) + } else { + return self.$Rational(self.num['$**'](other.$numerator()), self.den['$**'](other.$numerator())) + } + } else if ($truthy((($a = self['$=='](0)) ? $rb_lt(other, 0) : self['$=='](0)))) { + return self.$raise($$($nesting, 'ZeroDivisionError'), "divided by 0") + } else { + return self.$to_f()['$**'](other) + }} + else {return self.$__coerced__("**", other)}})() + }, TMP_Rational_$$_13.$$arity = 1); + + Opal.def(self, '$abs', TMP_Rational_abs_14 = function $$abs() { + var self = this; + + return self.$Rational(self.num.$abs(), self.den.$abs()) + }, TMP_Rational_abs_14.$$arity = 0); + + Opal.def(self, '$ceil', TMP_Rational_ceil_15 = function $$ceil(precision) { + var self = this; + + + + if (precision == null) { + precision = 0; + }; + if (precision['$=='](0)) { + return $rb_divide(self.num['$-@'](), self.den)['$-@']().$ceil() + } else { + return self.$with_precision("ceil", precision) + }; + }, TMP_Rational_ceil_15.$$arity = -1); + Opal.alias(self, "divide", "/"); + + Opal.def(self, '$floor', TMP_Rational_floor_16 = function $$floor(precision) { + var self = this; + + + + if (precision == null) { + precision = 0; + }; + if (precision['$=='](0)) { + return $rb_divide(self.num['$-@'](), self.den)['$-@']().$floor() + } else { + return self.$with_precision("floor", precision) + }; + }, TMP_Rational_floor_16.$$arity = -1); + + Opal.def(self, '$hash', TMP_Rational_hash_17 = function $$hash() { + var self = this; + + return "" + "Rational:" + (self.num) + ":" + (self.den) + }, TMP_Rational_hash_17.$$arity = 0); + + Opal.def(self, '$inspect', TMP_Rational_inspect_18 = function $$inspect() { + var self = this; + + return "" + "(" + (self) + ")" + }, TMP_Rational_inspect_18.$$arity = 0); + Opal.alias(self, "quo", "/"); + + Opal.def(self, '$rationalize', TMP_Rational_rationalize_19 = function $$rationalize(eps) { + var self = this; + + + ; + + if (arguments.length > 1) { + self.$raise($$($nesting, 'ArgumentError'), "" + "wrong number of arguments (" + (arguments.length) + " for 0..1)"); + } + + if (eps == null) { + return self; + } + + var e = eps.$abs(), + a = $rb_minus(self, e), + b = $rb_plus(self, e); + + var p0 = 0, + p1 = 1, + q0 = 1, + q1 = 0, + p2, q2; + + var c, k, t; + + while (true) { + c = (a).$ceil(); + + if ($rb_le(c, b)) { + break; + } + + k = c - 1; + p2 = k * p1 + p0; + q2 = k * q1 + q0; + t = $rb_divide(1, $rb_minus(b, k)); + b = $rb_divide(1, $rb_minus(a, k)); + a = t; + + p0 = p1; + q0 = q1; + p1 = p2; + q1 = q2; + } + + return self.$Rational(c * p1 + p0, c * q1 + q0); + ; + }, TMP_Rational_rationalize_19.$$arity = -1); + + Opal.def(self, '$round', TMP_Rational_round_20 = function $$round(precision) { + var self = this, num = nil, den = nil, approx = nil; + + + + if (precision == null) { + precision = 0; + }; + if (precision['$=='](0)) { + } else { + return self.$with_precision("round", precision) + }; + if (self.num['$=='](0)) { + return 0}; + if (self.den['$=='](1)) { + return self.num}; + num = $rb_plus($rb_times(self.num.$abs(), 2), self.den); + den = $rb_times(self.den, 2); + approx = $rb_divide(num, den).$truncate(); + if ($truthy($rb_lt(self.num, 0))) { + return approx['$-@']() + } else { + return approx + }; + }, TMP_Rational_round_20.$$arity = -1); + + Opal.def(self, '$to_f', TMP_Rational_to_f_21 = function $$to_f() { + var self = this; + + return $rb_divide(self.num, self.den) + }, TMP_Rational_to_f_21.$$arity = 0); + + Opal.def(self, '$to_i', TMP_Rational_to_i_22 = function $$to_i() { + var self = this; + + return self.$truncate() + }, TMP_Rational_to_i_22.$$arity = 0); + + Opal.def(self, '$to_r', TMP_Rational_to_r_23 = function $$to_r() { + var self = this; + + return self + }, TMP_Rational_to_r_23.$$arity = 0); + + Opal.def(self, '$to_s', TMP_Rational_to_s_24 = function $$to_s() { + var self = this; + + return "" + (self.num) + "/" + (self.den) + }, TMP_Rational_to_s_24.$$arity = 0); + + Opal.def(self, '$truncate', TMP_Rational_truncate_25 = function $$truncate(precision) { + var self = this; + + + + if (precision == null) { + precision = 0; + }; + if (precision['$=='](0)) { + if ($truthy($rb_lt(self.num, 0))) { + return self.$ceil() + } else { + return self.$floor() + } + } else { + return self.$with_precision("truncate", precision) + }; + }, TMP_Rational_truncate_25.$$arity = -1); + return (Opal.def(self, '$with_precision', TMP_Rational_with_precision_26 = function $$with_precision(method, precision) { + var self = this, p = nil, s = nil; + + + if ($truthy($$($nesting, 'Integer')['$==='](precision))) { + } else { + self.$raise($$($nesting, 'TypeError'), "not an Integer") + }; + p = (10)['$**'](precision); + s = $rb_times(self, p); + if ($truthy($rb_lt(precision, 1))) { + return $rb_divide(s.$send(method), p).$to_i() + } else { + return self.$Rational(s.$send(method), p) + }; + }, TMP_Rational_with_precision_26.$$arity = 2), nil) && 'with_precision'; + })($nesting[0], $$($nesting, 'Numeric'), $nesting); + (function($base, $parent_nesting) { + function $Kernel() {}; + var self = $Kernel = $module($base, 'Kernel', $Kernel); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Kernel_Rational_27; + + + Opal.def(self, '$Rational', TMP_Kernel_Rational_27 = function $$Rational(numerator, denominator) { + var self = this; + + + + if (denominator == null) { + denominator = 1; + }; + return $$($nesting, 'Rational').$convert(numerator, denominator); + }, TMP_Kernel_Rational_27.$$arity = -2) + })($nesting[0], $nesting); + return (function($base, $super, $parent_nesting) { + function $String(){}; + var self = $String = $klass($base, $super, 'String', $String); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_String_to_r_28; + + return (Opal.def(self, '$to_r', TMP_String_to_r_28 = function $$to_r() { + var self = this; + + + var str = self.trimLeft(), + re = /^[+-]?[\d_]+(\.[\d_]+)?/, + match = str.match(re), + numerator, denominator; + + function isFloat() { + return re.test(str); + } + + function cutFloat() { + var match = str.match(re); + var number = match[0]; + str = str.slice(number.length); + return number.replace(/_/g, ''); + } + + if (isFloat()) { + numerator = parseFloat(cutFloat()); + + if (str[0] === '/') { + // rational real part + str = str.slice(1); + + if (isFloat()) { + denominator = parseFloat(cutFloat()); + return self.$Rational(numerator, denominator); + } else { + return self.$Rational(numerator, 1); + } + } else { + return self.$Rational(numerator, 1); + } + } else { + return self.$Rational(0, 1); + } + + }, TMP_String_to_r_28.$$arity = 0), nil) && 'to_r' + })($nesting[0], null, $nesting); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/time"] = function(Opal) { + function $rb_gt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); + } + function $rb_lt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); + } + function $rb_plus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); + } + function $rb_divide(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs / rhs : lhs['$/'](rhs); + } + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + function $rb_le(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs <= rhs : lhs['$<='](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $truthy = Opal.truthy, $range = Opal.range; + + Opal.add_stubs(['$require', '$include', '$===', '$raise', '$coerce_to!', '$respond_to?', '$to_str', '$to_i', '$new', '$<=>', '$to_f', '$nil?', '$>', '$<', '$strftime', '$year', '$month', '$day', '$+', '$round', '$/', '$-', '$copy_instance_variables', '$initialize_dup', '$is_a?', '$zero?', '$wday', '$utc?', '$mon', '$yday', '$hour', '$min', '$sec', '$rjust', '$ljust', '$zone', '$to_s', '$[]', '$cweek_cyear', '$isdst', '$<=', '$!=', '$==', '$ceil']); + + self.$require("corelib/comparable"); + return (function($base, $super, $parent_nesting) { + function $Time(){}; + var self = $Time = $klass($base, $super, 'Time', $Time); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Time_at_1, TMP_Time_new_2, TMP_Time_local_3, TMP_Time_gm_4, TMP_Time_now_5, TMP_Time_$_6, TMP_Time_$_7, TMP_Time_$lt$eq$gt_8, TMP_Time_$eq$eq_9, TMP_Time_asctime_10, TMP_Time_day_11, TMP_Time_yday_12, TMP_Time_isdst_13, TMP_Time_dup_14, TMP_Time_eql$q_15, TMP_Time_friday$q_16, TMP_Time_hash_17, TMP_Time_hour_18, TMP_Time_inspect_19, TMP_Time_min_20, TMP_Time_mon_21, TMP_Time_monday$q_22, TMP_Time_saturday$q_23, TMP_Time_sec_24, TMP_Time_succ_25, TMP_Time_usec_26, TMP_Time_zone_27, TMP_Time_getgm_28, TMP_Time_gmtime_29, TMP_Time_gmt$q_30, TMP_Time_gmt_offset_31, TMP_Time_strftime_32, TMP_Time_sunday$q_33, TMP_Time_thursday$q_34, TMP_Time_to_a_35, TMP_Time_to_f_36, TMP_Time_to_i_37, TMP_Time_tuesday$q_38, TMP_Time_wday_39, TMP_Time_wednesday$q_40, TMP_Time_year_41, TMP_Time_cweek_cyear_42; + + + self.$include($$($nesting, 'Comparable')); + + var days_of_week = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"], + short_days = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], + short_months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], + long_months = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]; + ; + Opal.defs(self, '$at', TMP_Time_at_1 = function $$at(seconds, frac) { + var self = this; + + + ; + + var result; + + if ($$($nesting, 'Time')['$==='](seconds)) { + if (frac !== undefined) { + self.$raise($$($nesting, 'TypeError'), "can't convert Time into an exact number") + } + result = new Date(seconds.getTime()); + result.is_utc = seconds.is_utc; + return result; + } + + if (!seconds.$$is_number) { + seconds = $$($nesting, 'Opal')['$coerce_to!'](seconds, $$($nesting, 'Integer'), "to_int"); + } + + if (frac === undefined) { + return new Date(seconds * 1000); + } + + if (!frac.$$is_number) { + frac = $$($nesting, 'Opal')['$coerce_to!'](frac, $$($nesting, 'Integer'), "to_int"); + } + + return new Date(seconds * 1000 + (frac / 1000)); + ; + }, TMP_Time_at_1.$$arity = -2); + + function time_params(year, month, day, hour, min, sec) { + if (year.$$is_string) { + year = parseInt(year, 10); + } else { + year = $$($nesting, 'Opal')['$coerce_to!'](year, $$($nesting, 'Integer'), "to_int"); + } + + if (month === nil) { + month = 1; + } else if (!month.$$is_number) { + if ((month)['$respond_to?']("to_str")) { + month = (month).$to_str(); + switch (month.toLowerCase()) { + case 'jan': month = 1; break; + case 'feb': month = 2; break; + case 'mar': month = 3; break; + case 'apr': month = 4; break; + case 'may': month = 5; break; + case 'jun': month = 6; break; + case 'jul': month = 7; break; + case 'aug': month = 8; break; + case 'sep': month = 9; break; + case 'oct': month = 10; break; + case 'nov': month = 11; break; + case 'dec': month = 12; break; + default: month = (month).$to_i(); + } + } else { + month = $$($nesting, 'Opal')['$coerce_to!'](month, $$($nesting, 'Integer'), "to_int"); + } + } + + if (month < 1 || month > 12) { + self.$raise($$($nesting, 'ArgumentError'), "" + "month out of range: " + (month)) + } + month = month - 1; + + if (day === nil) { + day = 1; + } else if (day.$$is_string) { + day = parseInt(day, 10); + } else { + day = $$($nesting, 'Opal')['$coerce_to!'](day, $$($nesting, 'Integer'), "to_int"); + } + + if (day < 1 || day > 31) { + self.$raise($$($nesting, 'ArgumentError'), "" + "day out of range: " + (day)) + } + + if (hour === nil) { + hour = 0; + } else if (hour.$$is_string) { + hour = parseInt(hour, 10); + } else { + hour = $$($nesting, 'Opal')['$coerce_to!'](hour, $$($nesting, 'Integer'), "to_int"); + } + + if (hour < 0 || hour > 24) { + self.$raise($$($nesting, 'ArgumentError'), "" + "hour out of range: " + (hour)) + } + + if (min === nil) { + min = 0; + } else if (min.$$is_string) { + min = parseInt(min, 10); + } else { + min = $$($nesting, 'Opal')['$coerce_to!'](min, $$($nesting, 'Integer'), "to_int"); + } + + if (min < 0 || min > 59) { + self.$raise($$($nesting, 'ArgumentError'), "" + "min out of range: " + (min)) + } + + if (sec === nil) { + sec = 0; + } else if (!sec.$$is_number) { + if (sec.$$is_string) { + sec = parseInt(sec, 10); + } else { + sec = $$($nesting, 'Opal')['$coerce_to!'](sec, $$($nesting, 'Integer'), "to_int"); + } + } + + if (sec < 0 || sec > 60) { + self.$raise($$($nesting, 'ArgumentError'), "" + "sec out of range: " + (sec)) + } + + return [year, month, day, hour, min, sec]; + } + ; + Opal.defs(self, '$new', TMP_Time_new_2 = function(year, month, day, hour, min, sec, utc_offset) { + var self = this; + + + ; + + if (month == null) { + month = nil; + }; + + if (day == null) { + day = nil; + }; + + if (hour == null) { + hour = nil; + }; + + if (min == null) { + min = nil; + }; + + if (sec == null) { + sec = nil; + }; + + if (utc_offset == null) { + utc_offset = nil; + }; + + var args, result; + + if (year === undefined) { + return new Date(); + } + + if (utc_offset !== nil) { + self.$raise($$($nesting, 'ArgumentError'), "Opal does not support explicitly specifying UTC offset for Time") + } + + args = time_params(year, month, day, hour, min, sec); + year = args[0]; + month = args[1]; + day = args[2]; + hour = args[3]; + min = args[4]; + sec = args[5]; + + result = new Date(year, month, day, hour, min, 0, sec * 1000); + if (year < 100) { + result.setFullYear(year); + } + return result; + ; + }, TMP_Time_new_2.$$arity = -1); + Opal.defs(self, '$local', TMP_Time_local_3 = function $$local(year, month, day, hour, min, sec, millisecond, _dummy1, _dummy2, _dummy3) { + var self = this; + + + + if (month == null) { + month = nil; + }; + + if (day == null) { + day = nil; + }; + + if (hour == null) { + hour = nil; + }; + + if (min == null) { + min = nil; + }; + + if (sec == null) { + sec = nil; + }; + + if (millisecond == null) { + millisecond = nil; + }; + + if (_dummy1 == null) { + _dummy1 = nil; + }; + + if (_dummy2 == null) { + _dummy2 = nil; + }; + + if (_dummy3 == null) { + _dummy3 = nil; + }; + + var args, result; + + if (arguments.length === 10) { + args = $slice.call(arguments); + year = args[5]; + month = args[4]; + day = args[3]; + hour = args[2]; + min = args[1]; + sec = args[0]; + } + + args = time_params(year, month, day, hour, min, sec); + year = args[0]; + month = args[1]; + day = args[2]; + hour = args[3]; + min = args[4]; + sec = args[5]; + + result = new Date(year, month, day, hour, min, 0, sec * 1000); + if (year < 100) { + result.setFullYear(year); + } + return result; + ; + }, TMP_Time_local_3.$$arity = -2); + Opal.defs(self, '$gm', TMP_Time_gm_4 = function $$gm(year, month, day, hour, min, sec, millisecond, _dummy1, _dummy2, _dummy3) { + var self = this; + + + + if (month == null) { + month = nil; + }; + + if (day == null) { + day = nil; + }; + + if (hour == null) { + hour = nil; + }; + + if (min == null) { + min = nil; + }; + + if (sec == null) { + sec = nil; + }; + + if (millisecond == null) { + millisecond = nil; + }; + + if (_dummy1 == null) { + _dummy1 = nil; + }; + + if (_dummy2 == null) { + _dummy2 = nil; + }; + + if (_dummy3 == null) { + _dummy3 = nil; + }; + + var args, result; + + if (arguments.length === 10) { + args = $slice.call(arguments); + year = args[5]; + month = args[4]; + day = args[3]; + hour = args[2]; + min = args[1]; + sec = args[0]; + } + + args = time_params(year, month, day, hour, min, sec); + year = args[0]; + month = args[1]; + day = args[2]; + hour = args[3]; + min = args[4]; + sec = args[5]; + + result = new Date(Date.UTC(year, month, day, hour, min, 0, sec * 1000)); + if (year < 100) { + result.setUTCFullYear(year); + } + result.is_utc = true; + return result; + ; + }, TMP_Time_gm_4.$$arity = -2); + (function(self, $parent_nesting) { + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + + Opal.alias(self, "mktime", "local"); + return Opal.alias(self, "utc", "gm"); + })(Opal.get_singleton_class(self), $nesting); + Opal.defs(self, '$now', TMP_Time_now_5 = function $$now() { + var self = this; + + return self.$new() + }, TMP_Time_now_5.$$arity = 0); + + Opal.def(self, '$+', TMP_Time_$_6 = function(other) { + var self = this; + + + if ($truthy($$($nesting, 'Time')['$==='](other))) { + self.$raise($$($nesting, 'TypeError'), "time + time?")}; + + if (!other.$$is_number) { + other = $$($nesting, 'Opal')['$coerce_to!'](other, $$($nesting, 'Integer'), "to_int"); + } + var result = new Date(self.getTime() + (other * 1000)); + result.is_utc = self.is_utc; + return result; + ; + }, TMP_Time_$_6.$$arity = 1); + + Opal.def(self, '$-', TMP_Time_$_7 = function(other) { + var self = this; + + + if ($truthy($$($nesting, 'Time')['$==='](other))) { + return (self.getTime() - other.getTime()) / 1000}; + + if (!other.$$is_number) { + other = $$($nesting, 'Opal')['$coerce_to!'](other, $$($nesting, 'Integer'), "to_int"); + } + var result = new Date(self.getTime() - (other * 1000)); + result.is_utc = self.is_utc; + return result; + ; + }, TMP_Time_$_7.$$arity = 1); + + Opal.def(self, '$<=>', TMP_Time_$lt$eq$gt_8 = function(other) { + var self = this, r = nil; + + if ($truthy($$($nesting, 'Time')['$==='](other))) { + return self.$to_f()['$<=>'](other.$to_f()) + } else { + + r = other['$<=>'](self); + if ($truthy(r['$nil?']())) { + return nil + } else if ($truthy($rb_gt(r, 0))) { + return -1 + } else if ($truthy($rb_lt(r, 0))) { + return 1 + } else { + return 0 + }; + } + }, TMP_Time_$lt$eq$gt_8.$$arity = 1); + + Opal.def(self, '$==', TMP_Time_$eq$eq_9 = function(other) { + var $a, self = this; + + return ($truthy($a = $$($nesting, 'Time')['$==='](other)) ? self.$to_f() === other.$to_f() : $a) + }, TMP_Time_$eq$eq_9.$$arity = 1); + + Opal.def(self, '$asctime', TMP_Time_asctime_10 = function $$asctime() { + var self = this; + + return self.$strftime("%a %b %e %H:%M:%S %Y") + }, TMP_Time_asctime_10.$$arity = 0); + Opal.alias(self, "ctime", "asctime"); + + Opal.def(self, '$day', TMP_Time_day_11 = function $$day() { + var self = this; + + return self.is_utc ? self.getUTCDate() : self.getDate(); + }, TMP_Time_day_11.$$arity = 0); + + Opal.def(self, '$yday', TMP_Time_yday_12 = function $$yday() { + var self = this, start_of_year = nil, start_of_day = nil, one_day = nil; + + + start_of_year = $$($nesting, 'Time').$new(self.$year()).$to_i(); + start_of_day = $$($nesting, 'Time').$new(self.$year(), self.$month(), self.$day()).$to_i(); + one_day = 86400; + return $rb_plus($rb_divide($rb_minus(start_of_day, start_of_year), one_day).$round(), 1); + }, TMP_Time_yday_12.$$arity = 0); + + Opal.def(self, '$isdst', TMP_Time_isdst_13 = function $$isdst() { + var self = this; + + + var jan = new Date(self.getFullYear(), 0, 1), + jul = new Date(self.getFullYear(), 6, 1); + return self.getTimezoneOffset() < Math.max(jan.getTimezoneOffset(), jul.getTimezoneOffset()); + + }, TMP_Time_isdst_13.$$arity = 0); + Opal.alias(self, "dst?", "isdst"); + + Opal.def(self, '$dup', TMP_Time_dup_14 = function $$dup() { + var self = this, copy = nil; + + + copy = new Date(self.getTime()); + copy.$copy_instance_variables(self); + copy.$initialize_dup(self); + return copy; + }, TMP_Time_dup_14.$$arity = 0); + + Opal.def(self, '$eql?', TMP_Time_eql$q_15 = function(other) { + var $a, self = this; + + return ($truthy($a = other['$is_a?']($$($nesting, 'Time'))) ? self['$<=>'](other)['$zero?']() : $a) + }, TMP_Time_eql$q_15.$$arity = 1); + + Opal.def(self, '$friday?', TMP_Time_friday$q_16 = function() { + var self = this; + + return self.$wday() == 5 + }, TMP_Time_friday$q_16.$$arity = 0); + + Opal.def(self, '$hash', TMP_Time_hash_17 = function $$hash() { + var self = this; + + return 'Time:' + self.getTime(); + }, TMP_Time_hash_17.$$arity = 0); + + Opal.def(self, '$hour', TMP_Time_hour_18 = function $$hour() { + var self = this; + + return self.is_utc ? self.getUTCHours() : self.getHours(); + }, TMP_Time_hour_18.$$arity = 0); + + Opal.def(self, '$inspect', TMP_Time_inspect_19 = function $$inspect() { + var self = this; + + if ($truthy(self['$utc?']())) { + return self.$strftime("%Y-%m-%d %H:%M:%S UTC") + } else { + return self.$strftime("%Y-%m-%d %H:%M:%S %z") + } + }, TMP_Time_inspect_19.$$arity = 0); + Opal.alias(self, "mday", "day"); + + Opal.def(self, '$min', TMP_Time_min_20 = function $$min() { + var self = this; + + return self.is_utc ? self.getUTCMinutes() : self.getMinutes(); + }, TMP_Time_min_20.$$arity = 0); + + Opal.def(self, '$mon', TMP_Time_mon_21 = function $$mon() { + var self = this; + + return (self.is_utc ? self.getUTCMonth() : self.getMonth()) + 1; + }, TMP_Time_mon_21.$$arity = 0); + + Opal.def(self, '$monday?', TMP_Time_monday$q_22 = function() { + var self = this; + + return self.$wday() == 1 + }, TMP_Time_monday$q_22.$$arity = 0); + Opal.alias(self, "month", "mon"); + + Opal.def(self, '$saturday?', TMP_Time_saturday$q_23 = function() { + var self = this; + + return self.$wday() == 6 + }, TMP_Time_saturday$q_23.$$arity = 0); + + Opal.def(self, '$sec', TMP_Time_sec_24 = function $$sec() { + var self = this; + + return self.is_utc ? self.getUTCSeconds() : self.getSeconds(); + }, TMP_Time_sec_24.$$arity = 0); + + Opal.def(self, '$succ', TMP_Time_succ_25 = function $$succ() { + var self = this; + + + var result = new Date(self.getTime() + 1000); + result.is_utc = self.is_utc; + return result; + + }, TMP_Time_succ_25.$$arity = 0); + + Opal.def(self, '$usec', TMP_Time_usec_26 = function $$usec() { + var self = this; + + return self.getMilliseconds() * 1000; + }, TMP_Time_usec_26.$$arity = 0); + + Opal.def(self, '$zone', TMP_Time_zone_27 = function $$zone() { + var self = this; + + + var string = self.toString(), + result; + + if (string.indexOf('(') == -1) { + result = string.match(/[A-Z]{3,4}/)[0]; + } + else { + result = string.match(/\((.+)\)(?:\s|$)/)[1] + } + + if (result == "GMT" && /(GMT\W*\d{4})/.test(string)) { + return RegExp.$1; + } + else { + return result; + } + + }, TMP_Time_zone_27.$$arity = 0); + + Opal.def(self, '$getgm', TMP_Time_getgm_28 = function $$getgm() { + var self = this; + + + var result = new Date(self.getTime()); + result.is_utc = true; + return result; + + }, TMP_Time_getgm_28.$$arity = 0); + Opal.alias(self, "getutc", "getgm"); + + Opal.def(self, '$gmtime', TMP_Time_gmtime_29 = function $$gmtime() { + var self = this; + + + self.is_utc = true; + return self; + + }, TMP_Time_gmtime_29.$$arity = 0); + Opal.alias(self, "utc", "gmtime"); + + Opal.def(self, '$gmt?', TMP_Time_gmt$q_30 = function() { + var self = this; + + return self.is_utc === true; + }, TMP_Time_gmt$q_30.$$arity = 0); + + Opal.def(self, '$gmt_offset', TMP_Time_gmt_offset_31 = function $$gmt_offset() { + var self = this; + + return -self.getTimezoneOffset() * 60; + }, TMP_Time_gmt_offset_31.$$arity = 0); + + Opal.def(self, '$strftime', TMP_Time_strftime_32 = function $$strftime(format) { + var self = this; + + + return format.replace(/%([\-_#^0]*:{0,2})(\d+)?([EO]*)(.)/g, function(full, flags, width, _, conv) { + var result = "", + zero = flags.indexOf('0') !== -1, + pad = flags.indexOf('-') === -1, + blank = flags.indexOf('_') !== -1, + upcase = flags.indexOf('^') !== -1, + invert = flags.indexOf('#') !== -1, + colons = (flags.match(':') || []).length; + + width = parseInt(width, 10); + + if (zero && blank) { + if (flags.indexOf('0') < flags.indexOf('_')) { + zero = false; + } + else { + blank = false; + } + } + + switch (conv) { + case 'Y': + result += self.$year(); + break; + + case 'C': + zero = !blank; + result += Math.round(self.$year() / 100); + break; + + case 'y': + zero = !blank; + result += (self.$year() % 100); + break; + + case 'm': + zero = !blank; + result += self.$mon(); + break; + + case 'B': + result += long_months[self.$mon() - 1]; + break; + + case 'b': + case 'h': + blank = !zero; + result += short_months[self.$mon() - 1]; + break; + + case 'd': + zero = !blank + result += self.$day(); + break; + + case 'e': + blank = !zero + result += self.$day(); + break; + + case 'j': + result += self.$yday(); + break; + + case 'H': + zero = !blank; + result += self.$hour(); + break; + + case 'k': + blank = !zero; + result += self.$hour(); + break; + + case 'I': + zero = !blank; + result += (self.$hour() % 12 || 12); + break; + + case 'l': + blank = !zero; + result += (self.$hour() % 12 || 12); + break; + + case 'P': + result += (self.$hour() >= 12 ? "pm" : "am"); + break; + + case 'p': + result += (self.$hour() >= 12 ? "PM" : "AM"); + break; + + case 'M': + zero = !blank; + result += self.$min(); + break; + + case 'S': + zero = !blank; + result += self.$sec() + break; + + case 'L': + zero = !blank; + width = isNaN(width) ? 3 : width; + result += self.getMilliseconds(); + break; + + case 'N': + width = isNaN(width) ? 9 : width; + result += (self.getMilliseconds().toString()).$rjust(3, "0"); + result = (result).$ljust(width, "0"); + break; + + case 'z': + var offset = self.getTimezoneOffset(), + hours = Math.floor(Math.abs(offset) / 60), + minutes = Math.abs(offset) % 60; + + result += offset < 0 ? "+" : "-"; + result += hours < 10 ? "0" : ""; + result += hours; + + if (colons > 0) { + result += ":"; + } + + result += minutes < 10 ? "0" : ""; + result += minutes; + + if (colons > 1) { + result += ":00"; + } + + break; + + case 'Z': + result += self.$zone(); + break; + + case 'A': + result += days_of_week[self.$wday()]; + break; + + case 'a': + result += short_days[self.$wday()]; + break; + + case 'u': + result += (self.$wday() + 1); + break; + + case 'w': + result += self.$wday(); + break; + + case 'V': + result += self.$cweek_cyear()['$[]'](0).$to_s().$rjust(2, "0"); + break; + + case 'G': + result += self.$cweek_cyear()['$[]'](1); + break; + + case 'g': + result += self.$cweek_cyear()['$[]'](1)['$[]']($range(-2, -1, false)); + break; + + case 's': + result += self.$to_i(); + break; + + case 'n': + result += "\n"; + break; + + case 't': + result += "\t"; + break; + + case '%': + result += "%"; + break; + + case 'c': + result += self.$strftime("%a %b %e %T %Y"); + break; + + case 'D': + case 'x': + result += self.$strftime("%m/%d/%y"); + break; + + case 'F': + result += self.$strftime("%Y-%m-%d"); + break; + + case 'v': + result += self.$strftime("%e-%^b-%4Y"); + break; + + case 'r': + result += self.$strftime("%I:%M:%S %p"); + break; + + case 'R': + result += self.$strftime("%H:%M"); + break; + + case 'T': + case 'X': + result += self.$strftime("%H:%M:%S"); + break; + + default: + return full; + } + + if (upcase) { + result = result.toUpperCase(); + } + + if (invert) { + result = result.replace(/[A-Z]/, function(c) { c.toLowerCase() }). + replace(/[a-z]/, function(c) { c.toUpperCase() }); + } + + if (pad && (zero || blank)) { + result = (result).$rjust(isNaN(width) ? 2 : width, blank ? " " : "0"); + } + + return result; + }); + + }, TMP_Time_strftime_32.$$arity = 1); + + Opal.def(self, '$sunday?', TMP_Time_sunday$q_33 = function() { + var self = this; + + return self.$wday() == 0 + }, TMP_Time_sunday$q_33.$$arity = 0); + + Opal.def(self, '$thursday?', TMP_Time_thursday$q_34 = function() { + var self = this; + + return self.$wday() == 4 + }, TMP_Time_thursday$q_34.$$arity = 0); + + Opal.def(self, '$to_a', TMP_Time_to_a_35 = function $$to_a() { + var self = this; + + return [self.$sec(), self.$min(), self.$hour(), self.$day(), self.$month(), self.$year(), self.$wday(), self.$yday(), self.$isdst(), self.$zone()] + }, TMP_Time_to_a_35.$$arity = 0); + + Opal.def(self, '$to_f', TMP_Time_to_f_36 = function $$to_f() { + var self = this; + + return self.getTime() / 1000; + }, TMP_Time_to_f_36.$$arity = 0); + + Opal.def(self, '$to_i', TMP_Time_to_i_37 = function $$to_i() { + var self = this; + + return parseInt(self.getTime() / 1000, 10); + }, TMP_Time_to_i_37.$$arity = 0); + Opal.alias(self, "to_s", "inspect"); + + Opal.def(self, '$tuesday?', TMP_Time_tuesday$q_38 = function() { + var self = this; + + return self.$wday() == 2 + }, TMP_Time_tuesday$q_38.$$arity = 0); + Opal.alias(self, "tv_sec", "to_i"); + Opal.alias(self, "tv_usec", "usec"); + Opal.alias(self, "utc?", "gmt?"); + Opal.alias(self, "gmtoff", "gmt_offset"); + Opal.alias(self, "utc_offset", "gmt_offset"); + + Opal.def(self, '$wday', TMP_Time_wday_39 = function $$wday() { + var self = this; + + return self.is_utc ? self.getUTCDay() : self.getDay(); + }, TMP_Time_wday_39.$$arity = 0); + + Opal.def(self, '$wednesday?', TMP_Time_wednesday$q_40 = function() { + var self = this; + + return self.$wday() == 3 + }, TMP_Time_wednesday$q_40.$$arity = 0); + + Opal.def(self, '$year', TMP_Time_year_41 = function $$year() { + var self = this; + + return self.is_utc ? self.getUTCFullYear() : self.getFullYear(); + }, TMP_Time_year_41.$$arity = 0); + return (Opal.def(self, '$cweek_cyear', TMP_Time_cweek_cyear_42 = function $$cweek_cyear() { + var $a, self = this, jan01 = nil, jan01_wday = nil, first_monday = nil, year = nil, offset = nil, week = nil, dec31 = nil, dec31_wday = nil; + + + jan01 = $$($nesting, 'Time').$new(self.$year(), 1, 1); + jan01_wday = jan01.$wday(); + first_monday = 0; + year = self.$year(); + if ($truthy(($truthy($a = $rb_le(jan01_wday, 4)) ? jan01_wday['$!='](0) : $a))) { + offset = $rb_minus(jan01_wday, 1) + } else { + + offset = $rb_minus($rb_minus(jan01_wday, 7), 1); + if (offset['$=='](-8)) { + offset = -1}; + }; + week = $rb_divide($rb_plus(self.$yday(), offset), 7.0).$ceil(); + if ($truthy($rb_le(week, 0))) { + return $$($nesting, 'Time').$new($rb_minus(self.$year(), 1), 12, 31).$cweek_cyear() + } else if (week['$=='](53)) { + + dec31 = $$($nesting, 'Time').$new(self.$year(), 12, 31); + dec31_wday = dec31.$wday(); + if ($truthy(($truthy($a = $rb_le(dec31_wday, 3)) ? dec31_wday['$!='](0) : $a))) { + + week = 1; + year = $rb_plus(year, 1);};}; + return [week, year]; + }, TMP_Time_cweek_cyear_42.$$arity = 0), nil) && 'cweek_cyear'; + })($nesting[0], Date, $nesting); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/struct"] = function(Opal) { + function $rb_gt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); + } + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + function $rb_lt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); + } + function $rb_ge(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs >= rhs : lhs['$>='](rhs); + } + function $rb_plus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $hash2 = Opal.hash2, $truthy = Opal.truthy, $send = Opal.send; + + Opal.add_stubs(['$require', '$include', '$const_name!', '$unshift', '$map', '$coerce_to!', '$new', '$each', '$define_struct_attribute', '$allocate', '$initialize', '$alias_method', '$module_eval', '$to_proc', '$const_set', '$==', '$raise', '$<<', '$members', '$define_method', '$instance_eval', '$class', '$last', '$>', '$length', '$-', '$keys', '$any?', '$join', '$[]', '$[]=', '$each_with_index', '$hash', '$===', '$<', '$-@', '$size', '$>=', '$include?', '$to_sym', '$instance_of?', '$__id__', '$eql?', '$enum_for', '$name', '$+', '$each_pair', '$inspect', '$each_with_object', '$flatten', '$to_a', '$respond_to?', '$dig']); + + self.$require("corelib/enumerable"); + return (function($base, $super, $parent_nesting) { + function $Struct(){}; + var self = $Struct = $klass($base, $super, 'Struct', $Struct); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Struct_new_1, TMP_Struct_define_struct_attribute_6, TMP_Struct_members_9, TMP_Struct_inherited_10, TMP_Struct_initialize_12, TMP_Struct_members_15, TMP_Struct_hash_16, TMP_Struct_$$_17, TMP_Struct_$$$eq_18, TMP_Struct_$eq$eq_19, TMP_Struct_eql$q_20, TMP_Struct_each_21, TMP_Struct_each_pair_24, TMP_Struct_length_27, TMP_Struct_to_a_28, TMP_Struct_inspect_30, TMP_Struct_to_h_32, TMP_Struct_values_at_34, TMP_Struct_dig_36; + + + self.$include($$($nesting, 'Enumerable')); + Opal.defs(self, '$new', TMP_Struct_new_1 = function(const_name, $a, $b) { + var $iter = TMP_Struct_new_1.$$p, block = $iter || nil, $post_args, $kwargs, args, keyword_init, TMP_2, TMP_3, self = this, klass = nil; + + if ($iter) TMP_Struct_new_1.$$p = null; + + + if ($iter) TMP_Struct_new_1.$$p = null;; + + $post_args = Opal.slice.call(arguments, 1, arguments.length); + + $kwargs = Opal.extract_kwargs($post_args); + + if ($kwargs == null) { + $kwargs = $hash2([], {}); + } else if (!$kwargs.$$is_hash) { + throw Opal.ArgumentError.$new('expected kwargs'); + }; + + args = $post_args;; + + keyword_init = $kwargs.$$smap["keyword_init"]; + if (keyword_init == null) { + keyword_init = false + }; + if ($truthy(const_name)) { + + try { + const_name = $$($nesting, 'Opal')['$const_name!'](const_name) + } catch ($err) { + if (Opal.rescue($err, [$$($nesting, 'TypeError'), $$($nesting, 'NameError')])) { + try { + + args.$unshift(const_name); + const_name = nil; + } finally { Opal.pop_exception() } + } else { throw $err; } + };}; + $send(args, 'map', [], (TMP_2 = function(arg){var self = TMP_2.$$s || this; + + + + if (arg == null) { + arg = nil; + }; + return $$($nesting, 'Opal')['$coerce_to!'](arg, $$($nesting, 'String'), "to_str");}, TMP_2.$$s = self, TMP_2.$$arity = 1, TMP_2)); + klass = $send($$($nesting, 'Class'), 'new', [self], (TMP_3 = function(){var self = TMP_3.$$s || this, TMP_4; + + + $send(args, 'each', [], (TMP_4 = function(arg){var self = TMP_4.$$s || this; + + + + if (arg == null) { + arg = nil; + }; + return self.$define_struct_attribute(arg);}, TMP_4.$$s = self, TMP_4.$$arity = 1, TMP_4)); + return (function(self, $parent_nesting) { + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_new_5; + + + + Opal.def(self, '$new', TMP_new_5 = function($a) { + var $post_args, args, self = this, instance = nil; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + instance = self.$allocate(); + instance.$$data = {}; + $send(instance, 'initialize', Opal.to_a(args)); + return instance; + }, TMP_new_5.$$arity = -1); + return self.$alias_method("[]", "new"); + })(Opal.get_singleton_class(self), $nesting);}, TMP_3.$$s = self, TMP_3.$$arity = 0, TMP_3)); + if ($truthy(block)) { + $send(klass, 'module_eval', [], block.$to_proc())}; + klass.$$keyword_init = keyword_init; + if ($truthy(const_name)) { + $$($nesting, 'Struct').$const_set(const_name, klass)}; + return klass; + }, TMP_Struct_new_1.$$arity = -2); + Opal.defs(self, '$define_struct_attribute', TMP_Struct_define_struct_attribute_6 = function $$define_struct_attribute(name) { + var TMP_7, TMP_8, self = this; + + + if (self['$==']($$($nesting, 'Struct'))) { + self.$raise($$($nesting, 'ArgumentError'), "you cannot define attributes to the Struct class")}; + self.$members()['$<<'](name); + $send(self, 'define_method', [name], (TMP_7 = function(){var self = TMP_7.$$s || this; + + return self.$$data[name];}, TMP_7.$$s = self, TMP_7.$$arity = 0, TMP_7)); + return $send(self, 'define_method', ["" + (name) + "="], (TMP_8 = function(value){var self = TMP_8.$$s || this; + + + + if (value == null) { + value = nil; + }; + return self.$$data[name] = value;;}, TMP_8.$$s = self, TMP_8.$$arity = 1, TMP_8)); + }, TMP_Struct_define_struct_attribute_6.$$arity = 1); + Opal.defs(self, '$members', TMP_Struct_members_9 = function $$members() { + var $a, self = this; + if (self.members == null) self.members = nil; + + + if (self['$==']($$($nesting, 'Struct'))) { + self.$raise($$($nesting, 'ArgumentError'), "the Struct class has no members")}; + return (self.members = ($truthy($a = self.members) ? $a : [])); + }, TMP_Struct_members_9.$$arity = 0); + Opal.defs(self, '$inherited', TMP_Struct_inherited_10 = function $$inherited(klass) { + var TMP_11, self = this, members = nil; + if (self.members == null) self.members = nil; + + + members = self.members; + return $send(klass, 'instance_eval', [], (TMP_11 = function(){var self = TMP_11.$$s || this; + + return (self.members = members)}, TMP_11.$$s = self, TMP_11.$$arity = 0, TMP_11)); + }, TMP_Struct_inherited_10.$$arity = 1); + + Opal.def(self, '$initialize', TMP_Struct_initialize_12 = function $$initialize($a) { + var $post_args, args, $b, TMP_13, TMP_14, self = this, kwargs = nil, extra = nil; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + if ($truthy(self.$class().$$keyword_init)) { + + kwargs = ($truthy($b = args.$last()) ? $b : $hash2([], {})); + if ($truthy(($truthy($b = $rb_gt(args.$length(), 1)) ? $b : (args.length === 1 && !kwargs.$$is_hash)))) { + self.$raise($$($nesting, 'ArgumentError'), "" + "wrong number of arguments (given " + (args.$length()) + ", expected 0)")}; + extra = $rb_minus(kwargs.$keys(), self.$class().$members()); + if ($truthy(extra['$any?']())) { + self.$raise($$($nesting, 'ArgumentError'), "" + "unknown keywords: " + (extra.$join(", ")))}; + return $send(self.$class().$members(), 'each', [], (TMP_13 = function(name){var self = TMP_13.$$s || this, $writer = nil; + + + + if (name == null) { + name = nil; + }; + $writer = [name, kwargs['$[]'](name)]; + $send(self, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];}, TMP_13.$$s = self, TMP_13.$$arity = 1, TMP_13)); + } else { + + if ($truthy($rb_gt(args.$length(), self.$class().$members().$length()))) { + self.$raise($$($nesting, 'ArgumentError'), "struct size differs")}; + return $send(self.$class().$members(), 'each_with_index', [], (TMP_14 = function(name, index){var self = TMP_14.$$s || this, $writer = nil; + + + + if (name == null) { + name = nil; + }; + + if (index == null) { + index = nil; + }; + $writer = [name, args['$[]'](index)]; + $send(self, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];}, TMP_14.$$s = self, TMP_14.$$arity = 2, TMP_14)); + }; + }, TMP_Struct_initialize_12.$$arity = -1); + + Opal.def(self, '$members', TMP_Struct_members_15 = function $$members() { + var self = this; + + return self.$class().$members() + }, TMP_Struct_members_15.$$arity = 0); + + Opal.def(self, '$hash', TMP_Struct_hash_16 = function $$hash() { + var self = this; + + return $$($nesting, 'Hash').$new(self.$$data).$hash() + }, TMP_Struct_hash_16.$$arity = 0); + + Opal.def(self, '$[]', TMP_Struct_$$_17 = function(name) { + var self = this; + + + if ($truthy($$($nesting, 'Integer')['$==='](name))) { + + if ($truthy($rb_lt(name, self.$class().$members().$size()['$-@']()))) { + self.$raise($$($nesting, 'IndexError'), "" + "offset " + (name) + " too small for struct(size:" + (self.$class().$members().$size()) + ")")}; + if ($truthy($rb_ge(name, self.$class().$members().$size()))) { + self.$raise($$($nesting, 'IndexError'), "" + "offset " + (name) + " too large for struct(size:" + (self.$class().$members().$size()) + ")")}; + name = self.$class().$members()['$[]'](name); + } else if ($truthy($$($nesting, 'String')['$==='](name))) { + + if(!self.$$data.hasOwnProperty(name)) { + self.$raise($$($nesting, 'NameError').$new("" + "no member '" + (name) + "' in struct", name)) + } + + } else { + self.$raise($$($nesting, 'TypeError'), "" + "no implicit conversion of " + (name.$class()) + " into Integer") + }; + name = $$($nesting, 'Opal')['$coerce_to!'](name, $$($nesting, 'String'), "to_str"); + return self.$$data[name];; + }, TMP_Struct_$$_17.$$arity = 1); + + Opal.def(self, '$[]=', TMP_Struct_$$$eq_18 = function(name, value) { + var self = this; + + + if ($truthy($$($nesting, 'Integer')['$==='](name))) { + + if ($truthy($rb_lt(name, self.$class().$members().$size()['$-@']()))) { + self.$raise($$($nesting, 'IndexError'), "" + "offset " + (name) + " too small for struct(size:" + (self.$class().$members().$size()) + ")")}; + if ($truthy($rb_ge(name, self.$class().$members().$size()))) { + self.$raise($$($nesting, 'IndexError'), "" + "offset " + (name) + " too large for struct(size:" + (self.$class().$members().$size()) + ")")}; + name = self.$class().$members()['$[]'](name); + } else if ($truthy($$($nesting, 'String')['$==='](name))) { + if ($truthy(self.$class().$members()['$include?'](name.$to_sym()))) { + } else { + self.$raise($$($nesting, 'NameError').$new("" + "no member '" + (name) + "' in struct", name)) + } + } else { + self.$raise($$($nesting, 'TypeError'), "" + "no implicit conversion of " + (name.$class()) + " into Integer") + }; + name = $$($nesting, 'Opal')['$coerce_to!'](name, $$($nesting, 'String'), "to_str"); + return self.$$data[name] = value;; + }, TMP_Struct_$$$eq_18.$$arity = 2); + + Opal.def(self, '$==', TMP_Struct_$eq$eq_19 = function(other) { + var self = this; + + + if ($truthy(other['$instance_of?'](self.$class()))) { + } else { + return false + }; + + var recursed1 = {}, recursed2 = {}; + + function _eqeq(struct, other) { + var key, a, b; + + recursed1[(struct).$__id__()] = true; + recursed2[(other).$__id__()] = true; + + for (key in struct.$$data) { + a = struct.$$data[key]; + b = other.$$data[key]; + + if ($$($nesting, 'Struct')['$==='](a)) { + if (!recursed1.hasOwnProperty((a).$__id__()) || !recursed2.hasOwnProperty((b).$__id__())) { + if (!_eqeq(a, b)) { + return false; + } + } + } else { + if (!(a)['$=='](b)) { + return false; + } + } + } + + return true; + } + + return _eqeq(self, other); + ; + }, TMP_Struct_$eq$eq_19.$$arity = 1); + + Opal.def(self, '$eql?', TMP_Struct_eql$q_20 = function(other) { + var self = this; + + + if ($truthy(other['$instance_of?'](self.$class()))) { + } else { + return false + }; + + var recursed1 = {}, recursed2 = {}; + + function _eqeq(struct, other) { + var key, a, b; + + recursed1[(struct).$__id__()] = true; + recursed2[(other).$__id__()] = true; + + for (key in struct.$$data) { + a = struct.$$data[key]; + b = other.$$data[key]; + + if ($$($nesting, 'Struct')['$==='](a)) { + if (!recursed1.hasOwnProperty((a).$__id__()) || !recursed2.hasOwnProperty((b).$__id__())) { + if (!_eqeq(a, b)) { + return false; + } + } + } else { + if (!(a)['$eql?'](b)) { + return false; + } + } + } + + return true; + } + + return _eqeq(self, other); + ; + }, TMP_Struct_eql$q_20.$$arity = 1); + + Opal.def(self, '$each', TMP_Struct_each_21 = function $$each() { + var TMP_22, TMP_23, $iter = TMP_Struct_each_21.$$p, $yield = $iter || nil, self = this; + + if ($iter) TMP_Struct_each_21.$$p = null; + + if (($yield !== nil)) { + } else { + return $send(self, 'enum_for', ["each"], (TMP_22 = function(){var self = TMP_22.$$s || this; + + return self.$size()}, TMP_22.$$s = self, TMP_22.$$arity = 0, TMP_22)) + }; + $send(self.$class().$members(), 'each', [], (TMP_23 = function(name){var self = TMP_23.$$s || this; + + + + if (name == null) { + name = nil; + }; + return Opal.yield1($yield, self['$[]'](name));;}, TMP_23.$$s = self, TMP_23.$$arity = 1, TMP_23)); + return self; + }, TMP_Struct_each_21.$$arity = 0); + + Opal.def(self, '$each_pair', TMP_Struct_each_pair_24 = function $$each_pair() { + var TMP_25, TMP_26, $iter = TMP_Struct_each_pair_24.$$p, $yield = $iter || nil, self = this; + + if ($iter) TMP_Struct_each_pair_24.$$p = null; + + if (($yield !== nil)) { + } else { + return $send(self, 'enum_for', ["each_pair"], (TMP_25 = function(){var self = TMP_25.$$s || this; + + return self.$size()}, TMP_25.$$s = self, TMP_25.$$arity = 0, TMP_25)) + }; + $send(self.$class().$members(), 'each', [], (TMP_26 = function(name){var self = TMP_26.$$s || this; + + + + if (name == null) { + name = nil; + }; + return Opal.yield1($yield, [name, self['$[]'](name)]);;}, TMP_26.$$s = self, TMP_26.$$arity = 1, TMP_26)); + return self; + }, TMP_Struct_each_pair_24.$$arity = 0); + + Opal.def(self, '$length', TMP_Struct_length_27 = function $$length() { + var self = this; + + return self.$class().$members().$length() + }, TMP_Struct_length_27.$$arity = 0); + Opal.alias(self, "size", "length"); + + Opal.def(self, '$to_a', TMP_Struct_to_a_28 = function $$to_a() { + var TMP_29, self = this; + + return $send(self.$class().$members(), 'map', [], (TMP_29 = function(name){var self = TMP_29.$$s || this; + + + + if (name == null) { + name = nil; + }; + return self['$[]'](name);}, TMP_29.$$s = self, TMP_29.$$arity = 1, TMP_29)) + }, TMP_Struct_to_a_28.$$arity = 0); + Opal.alias(self, "values", "to_a"); + + Opal.def(self, '$inspect', TMP_Struct_inspect_30 = function $$inspect() { + var $a, TMP_31, self = this, result = nil; + + + result = "#"); + return result; + }, TMP_Struct_inspect_30.$$arity = 0); + Opal.alias(self, "to_s", "inspect"); + + Opal.def(self, '$to_h', TMP_Struct_to_h_32 = function $$to_h() { + var TMP_33, self = this; + + return $send(self.$class().$members(), 'each_with_object', [$hash2([], {})], (TMP_33 = function(name, h){var self = TMP_33.$$s || this, $writer = nil; + + + + if (name == null) { + name = nil; + }; + + if (h == null) { + h = nil; + }; + $writer = [name, self['$[]'](name)]; + $send(h, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];}, TMP_33.$$s = self, TMP_33.$$arity = 2, TMP_33)) + }, TMP_Struct_to_h_32.$$arity = 0); + + Opal.def(self, '$values_at', TMP_Struct_values_at_34 = function $$values_at($a) { + var $post_args, args, TMP_35, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + args = $send(args, 'map', [], (TMP_35 = function(arg){var self = TMP_35.$$s || this; + + + + if (arg == null) { + arg = nil; + }; + return arg.$$is_range ? arg.$to_a() : arg;}, TMP_35.$$s = self, TMP_35.$$arity = 1, TMP_35)).$flatten(); + + var result = []; + for (var i = 0, len = args.length; i < len; i++) { + if (!args[i].$$is_number) { + self.$raise($$($nesting, 'TypeError'), "" + "no implicit conversion of " + ((args[i]).$class()) + " into Integer") + } + result.push(self['$[]'](args[i])); + } + return result; + ; + }, TMP_Struct_values_at_34.$$arity = -1); + return (Opal.def(self, '$dig', TMP_Struct_dig_36 = function $$dig(key, $a) { + var $post_args, keys, self = this, item = nil; + + + + $post_args = Opal.slice.call(arguments, 1, arguments.length); + + keys = $post_args;; + item = (function() {if ($truthy(key.$$is_string && self.$$data.hasOwnProperty(key))) { + return self.$$data[key] || nil; + } else { + return nil + }; return nil; })(); + + if (item === nil || keys.length === 0) { + return item; + } + ; + if ($truthy(item['$respond_to?']("dig"))) { + } else { + self.$raise($$($nesting, 'TypeError'), "" + (item.$class()) + " does not have #dig method") + }; + return $send(item, 'dig', Opal.to_a(keys)); + }, TMP_Struct_dig_36.$$arity = -2), nil) && 'dig'; + })($nesting[0], null, $nesting); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/io"] = function(Opal) { + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $module = Opal.module, $send = Opal.send, $gvars = Opal.gvars, $truthy = Opal.truthy, $writer = nil; + + Opal.add_stubs(['$attr_accessor', '$size', '$write', '$join', '$map', '$String', '$empty?', '$concat', '$chomp', '$getbyte', '$getc', '$raise', '$new', '$write_proc=', '$-', '$extend']); + + (function($base, $super, $parent_nesting) { + function $IO(){}; + var self = $IO = $klass($base, $super, 'IO', $IO); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_IO_tty$q_1, TMP_IO_closed$q_2, TMP_IO_write_3, TMP_IO_flush_4; + + def.tty = def.closed = nil; + + Opal.const_set($nesting[0], 'SEEK_SET', 0); + Opal.const_set($nesting[0], 'SEEK_CUR', 1); + Opal.const_set($nesting[0], 'SEEK_END', 2); + + Opal.def(self, '$tty?', TMP_IO_tty$q_1 = function() { + var self = this; + + return self.tty + }, TMP_IO_tty$q_1.$$arity = 0); + + Opal.def(self, '$closed?', TMP_IO_closed$q_2 = function() { + var self = this; + + return self.closed + }, TMP_IO_closed$q_2.$$arity = 0); + self.$attr_accessor("write_proc"); + + Opal.def(self, '$write', TMP_IO_write_3 = function $$write(string) { + var self = this; + + + self.write_proc(string); + return string.$size(); + }, TMP_IO_write_3.$$arity = 1); + self.$attr_accessor("sync", "tty"); + + Opal.def(self, '$flush', TMP_IO_flush_4 = function $$flush() { + var self = this; + + return nil + }, TMP_IO_flush_4.$$arity = 0); + (function($base, $parent_nesting) { + function $Writable() {}; + var self = $Writable = $module($base, 'Writable', $Writable); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Writable_$lt$lt_5, TMP_Writable_print_6, TMP_Writable_puts_8; + + + + Opal.def(self, '$<<', TMP_Writable_$lt$lt_5 = function(string) { + var self = this; + + + self.$write(string); + return self; + }, TMP_Writable_$lt$lt_5.$$arity = 1); + + Opal.def(self, '$print', TMP_Writable_print_6 = function $$print($a) { + var $post_args, args, TMP_7, self = this; + if ($gvars[","] == null) $gvars[","] = nil; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + self.$write($send(args, 'map', [], (TMP_7 = function(arg){var self = TMP_7.$$s || this; + + + + if (arg == null) { + arg = nil; + }; + return self.$String(arg);}, TMP_7.$$s = self, TMP_7.$$arity = 1, TMP_7)).$join($gvars[","])); + return nil; + }, TMP_Writable_print_6.$$arity = -1); + + Opal.def(self, '$puts', TMP_Writable_puts_8 = function $$puts($a) { + var $post_args, args, TMP_9, self = this, newline = nil; + if ($gvars["/"] == null) $gvars["/"] = nil; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + newline = $gvars["/"]; + if ($truthy(args['$empty?']())) { + self.$write($gvars["/"]) + } else { + self.$write($send(args, 'map', [], (TMP_9 = function(arg){var self = TMP_9.$$s || this; + + + + if (arg == null) { + arg = nil; + }; + return self.$String(arg).$chomp();}, TMP_9.$$s = self, TMP_9.$$arity = 1, TMP_9)).$concat([nil]).$join(newline)) + }; + return nil; + }, TMP_Writable_puts_8.$$arity = -1); + })($nesting[0], $nesting); + return (function($base, $parent_nesting) { + function $Readable() {}; + var self = $Readable = $module($base, 'Readable', $Readable); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Readable_readbyte_10, TMP_Readable_readchar_11, TMP_Readable_readline_12, TMP_Readable_readpartial_13; + + + + Opal.def(self, '$readbyte', TMP_Readable_readbyte_10 = function $$readbyte() { + var self = this; + + return self.$getbyte() + }, TMP_Readable_readbyte_10.$$arity = 0); + + Opal.def(self, '$readchar', TMP_Readable_readchar_11 = function $$readchar() { + var self = this; + + return self.$getc() + }, TMP_Readable_readchar_11.$$arity = 0); + + Opal.def(self, '$readline', TMP_Readable_readline_12 = function $$readline(sep) { + var self = this; + if ($gvars["/"] == null) $gvars["/"] = nil; + + + + if (sep == null) { + sep = $gvars["/"]; + }; + return self.$raise($$($nesting, 'NotImplementedError')); + }, TMP_Readable_readline_12.$$arity = -1); + + Opal.def(self, '$readpartial', TMP_Readable_readpartial_13 = function $$readpartial(integer, outbuf) { + var self = this; + + + + if (outbuf == null) { + outbuf = nil; + }; + return self.$raise($$($nesting, 'NotImplementedError')); + }, TMP_Readable_readpartial_13.$$arity = -2); + })($nesting[0], $nesting); + })($nesting[0], null, $nesting); + Opal.const_set($nesting[0], 'STDERR', ($gvars.stderr = $$($nesting, 'IO').$new())); + Opal.const_set($nesting[0], 'STDIN', ($gvars.stdin = $$($nesting, 'IO').$new())); + Opal.const_set($nesting[0], 'STDOUT', ($gvars.stdout = $$($nesting, 'IO').$new())); + var console = Opal.global.console; + + $writer = [typeof(process) === 'object' && typeof(process.stdout) === 'object' ? function(s){process.stdout.write(s)} : function(s){console.log(s)}]; + $send($$($nesting, 'STDOUT'), 'write_proc=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = [typeof(process) === 'object' && typeof(process.stderr) === 'object' ? function(s){process.stderr.write(s)} : function(s){console.warn(s)}]; + $send($$($nesting, 'STDERR'), 'write_proc=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + $$($nesting, 'STDOUT').$extend($$$($$($nesting, 'IO'), 'Writable')); + return $$($nesting, 'STDERR').$extend($$$($$($nesting, 'IO'), 'Writable')); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/main"] = function(Opal) { + var TMP_to_s_1, TMP_include_2, self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice; + + Opal.add_stubs(['$include']); + + Opal.defs(self, '$to_s', TMP_to_s_1 = function $$to_s() { + var self = this; + + return "main" + }, TMP_to_s_1.$$arity = 0); + return (Opal.defs(self, '$include', TMP_include_2 = function $$include(mod) { + var self = this; + + return $$($nesting, 'Object').$include(mod) + }, TMP_include_2.$$arity = 1), nil) && 'include'; +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/dir"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $truthy = Opal.truthy; + + Opal.add_stubs(['$[]']); + return (function($base, $super, $parent_nesting) { + function $Dir(){}; + var self = $Dir = $klass($base, $super, 'Dir', $Dir); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return (function(self, $parent_nesting) { + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_chdir_1, TMP_pwd_2, TMP_home_3; + + + + Opal.def(self, '$chdir', TMP_chdir_1 = function $$chdir(dir) { + var $iter = TMP_chdir_1.$$p, $yield = $iter || nil, self = this, prev_cwd = nil; + + if ($iter) TMP_chdir_1.$$p = null; + return (function() { try { + + prev_cwd = Opal.current_dir; + Opal.current_dir = dir; + return Opal.yieldX($yield, []);; + } finally { + Opal.current_dir = prev_cwd + }; })() + }, TMP_chdir_1.$$arity = 1); + + Opal.def(self, '$pwd', TMP_pwd_2 = function $$pwd() { + var self = this; + + return Opal.current_dir || '.'; + }, TMP_pwd_2.$$arity = 0); + Opal.alias(self, "getwd", "pwd"); + return (Opal.def(self, '$home', TMP_home_3 = function $$home() { + var $a, self = this; + + return ($truthy($a = $$($nesting, 'ENV')['$[]']("HOME")) ? $a : ".") + }, TMP_home_3.$$arity = 0), nil) && 'home'; + })(Opal.get_singleton_class(self), $nesting) + })($nesting[0], null, $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/file"] = function(Opal) { + function $rb_plus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); + } + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $truthy = Opal.truthy, $range = Opal.range, $send = Opal.send; + + Opal.add_stubs(['$home', '$raise', '$start_with?', '$+', '$sub', '$pwd', '$split', '$unshift', '$join', '$respond_to?', '$coerce_to!', '$basename', '$empty?', '$rindex', '$[]', '$nil?', '$==', '$-', '$length', '$gsub', '$find', '$=~', '$map', '$each_with_index', '$flatten', '$reject', '$to_proc', '$end_with?']); + return (function($base, $super, $parent_nesting) { + function $File(){}; + var self = $File = $klass($base, $super, 'File', $File); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), windows_root_rx = nil; + + + Opal.const_set($nesting[0], 'Separator', Opal.const_set($nesting[0], 'SEPARATOR', "/")); + Opal.const_set($nesting[0], 'ALT_SEPARATOR', nil); + Opal.const_set($nesting[0], 'PATH_SEPARATOR', ":"); + Opal.const_set($nesting[0], 'FNM_SYSCASE', 0); + windows_root_rx = /^[a-zA-Z]:(?:\\|\/)/; + return (function(self, $parent_nesting) { + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_expand_path_1, TMP_dirname_2, TMP_basename_3, TMP_extname_4, TMP_exist$q_5, TMP_directory$q_6, TMP_join_8, TMP_split_11; + + + + Opal.def(self, '$expand_path', TMP_expand_path_1 = function $$expand_path(path, basedir) { + var $a, self = this, sep = nil, sep_chars = nil, new_parts = nil, home = nil, home_path_regexp = nil, path_abs = nil, basedir_abs = nil, parts = nil, leading_sep = nil, abs = nil, new_path = nil; + + + + if (basedir == null) { + basedir = nil; + }; + sep = $$($nesting, 'SEPARATOR'); + sep_chars = $sep_chars(); + new_parts = []; + if ($truthy(path[0] === '~' || (basedir && basedir[0] === '~'))) { + + home = $$($nesting, 'Dir').$home(); + if ($truthy(home)) { + } else { + self.$raise($$($nesting, 'ArgumentError'), "couldn't find HOME environment -- expanding `~'") + }; + if ($truthy(home['$start_with?'](sep))) { + } else { + self.$raise($$($nesting, 'ArgumentError'), "non-absolute home") + }; + home = $rb_plus(home, sep); + home_path_regexp = new RegExp("" + "^\\~(?:" + (sep) + "|$)"); + path = path.$sub(home_path_regexp, home); + if ($truthy(basedir)) { + basedir = basedir.$sub(home_path_regexp, home)};}; + basedir = ($truthy($a = basedir) ? $a : $$($nesting, 'Dir').$pwd()); + path_abs = path.substr(0, sep.length) === sep || windows_root_rx.test(path); + basedir_abs = basedir.substr(0, sep.length) === sep || windows_root_rx.test(basedir); + if ($truthy(path_abs)) { + + parts = path.$split(new RegExp("" + "[" + (sep_chars) + "]")); + leading_sep = windows_root_rx.test(path) ? '' : path.$sub(new RegExp("" + "^([" + (sep_chars) + "]+).*$"), "\\1"); + abs = true; + } else { + + parts = $rb_plus(basedir.$split(new RegExp("" + "[" + (sep_chars) + "]")), path.$split(new RegExp("" + "[" + (sep_chars) + "]"))); + leading_sep = windows_root_rx.test(basedir) ? '' : basedir.$sub(new RegExp("" + "^([" + (sep_chars) + "]+).*$"), "\\1"); + abs = basedir_abs; + }; + + var part; + for (var i = 0, ii = parts.length; i < ii; i++) { + part = parts[i]; + + if ( + (part === nil) || + (part === '' && ((new_parts.length === 0) || abs)) || + (part === '.' && ((new_parts.length === 0) || abs)) + ) { + continue; + } + if (part === '..') { + new_parts.pop(); + } else { + new_parts.push(part); + } + } + + if (!abs && parts[0] !== '.') { + new_parts.$unshift(".") + } + ; + new_path = new_parts.$join(sep); + if ($truthy(abs)) { + new_path = $rb_plus(leading_sep, new_path)}; + return new_path; + }, TMP_expand_path_1.$$arity = -2); + Opal.alias(self, "realpath", "expand_path"); + + // Coerce a given path to a path string using #to_path and #to_str + function $coerce_to_path(path) { + if ($truthy((path)['$respond_to?']("to_path"))) { + path = path.$to_path(); + } + + path = $$($nesting, 'Opal')['$coerce_to!'](path, $$($nesting, 'String'), "to_str"); + + return path; + } + + // Return a RegExp compatible char class + function $sep_chars() { + if ($$($nesting, 'ALT_SEPARATOR') === nil) { + return Opal.escape_regexp($$($nesting, 'SEPARATOR')); + } else { + return Opal.escape_regexp($rb_plus($$($nesting, 'SEPARATOR'), $$($nesting, 'ALT_SEPARATOR'))); + } + } + ; + + Opal.def(self, '$dirname', TMP_dirname_2 = function $$dirname(path) { + var self = this, sep_chars = nil; + + + sep_chars = $sep_chars(); + path = $coerce_to_path(path); + + var absolute = path.match(new RegExp("" + "^[" + (sep_chars) + "]")); + + path = path.replace(new RegExp("" + "[" + (sep_chars) + "]+$"), ''); // remove trailing separators + path = path.replace(new RegExp("" + "[^" + (sep_chars) + "]+$"), ''); // remove trailing basename + path = path.replace(new RegExp("" + "[" + (sep_chars) + "]+$"), ''); // remove final trailing separators + + if (path === '') { + return absolute ? '/' : '.'; + } + + return path; + ; + }, TMP_dirname_2.$$arity = 1); + + Opal.def(self, '$basename', TMP_basename_3 = function $$basename(name, suffix) { + var self = this, sep_chars = nil; + + + + if (suffix == null) { + suffix = nil; + }; + sep_chars = $sep_chars(); + name = $coerce_to_path(name); + + if (name.length == 0) { + return name; + } + + if (suffix !== nil) { + suffix = $$($nesting, 'Opal')['$coerce_to!'](suffix, $$($nesting, 'String'), "to_str") + } else { + suffix = null; + } + + name = name.replace(new RegExp("" + "(.)[" + (sep_chars) + "]*$"), '$1'); + name = name.replace(new RegExp("" + "^(?:.*[" + (sep_chars) + "])?([^" + (sep_chars) + "]+)$"), '$1'); + + if (suffix === ".*") { + name = name.replace(/\.[^\.]+$/, ''); + } else if(suffix !== null) { + suffix = Opal.escape_regexp(suffix); + name = name.replace(new RegExp("" + (suffix) + "$"), ''); + } + + return name; + ; + }, TMP_basename_3.$$arity = -2); + + Opal.def(self, '$extname', TMP_extname_4 = function $$extname(path) { + var $a, self = this, filename = nil, last_dot_idx = nil; + + + path = $coerce_to_path(path); + filename = self.$basename(path); + if ($truthy(filename['$empty?']())) { + return ""}; + last_dot_idx = filename['$[]']($range(1, -1, false)).$rindex("."); + if ($truthy(($truthy($a = last_dot_idx['$nil?']()) ? $a : $rb_plus(last_dot_idx, 1)['$==']($rb_minus(filename.$length(), 1))))) { + return "" + } else { + return filename['$[]'](Opal.Range.$new($rb_plus(last_dot_idx, 1), -1, false)) + }; + }, TMP_extname_4.$$arity = 1); + + Opal.def(self, '$exist?', TMP_exist$q_5 = function(path) { + var self = this; + + return Opal.modules[path] != null + }, TMP_exist$q_5.$$arity = 1); + Opal.alias(self, "exists?", "exist?"); + + Opal.def(self, '$directory?', TMP_directory$q_6 = function(path) { + var TMP_7, self = this, files = nil, file = nil; + + + files = []; + + for (var key in Opal.modules) { + files.push(key) + } + ; + path = path.$gsub(new RegExp("" + "(^." + ($$($nesting, 'SEPARATOR')) + "+|" + ($$($nesting, 'SEPARATOR')) + "+$)")); + file = $send(files, 'find', [], (TMP_7 = function(f){var self = TMP_7.$$s || this; + + + + if (f == null) { + f = nil; + }; + return f['$=~'](new RegExp("" + "^" + (path)));}, TMP_7.$$s = self, TMP_7.$$arity = 1, TMP_7)); + return file; + }, TMP_directory$q_6.$$arity = 1); + + Opal.def(self, '$join', TMP_join_8 = function $$join($a) { + var $post_args, paths, TMP_9, TMP_10, self = this, result = nil; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + paths = $post_args;; + if ($truthy(paths['$empty?']())) { + return ""}; + result = ""; + paths = $send(paths.$flatten().$each_with_index(), 'map', [], (TMP_9 = function(item, index){var self = TMP_9.$$s || this, $b; + + + + if (item == null) { + item = nil; + }; + + if (index == null) { + index = nil; + }; + if ($truthy((($b = index['$=='](0)) ? item['$empty?']() : index['$=='](0)))) { + return $$($nesting, 'SEPARATOR') + } else if ($truthy((($b = paths.$length()['$==']($rb_plus(index, 1))) ? item['$empty?']() : paths.$length()['$==']($rb_plus(index, 1))))) { + return $$($nesting, 'SEPARATOR') + } else { + return item + };}, TMP_9.$$s = self, TMP_9.$$arity = 2, TMP_9)); + paths = $send(paths, 'reject', [], "empty?".$to_proc()); + $send(paths, 'each_with_index', [], (TMP_10 = function(item, index){var self = TMP_10.$$s || this, $b, next_item = nil; + + + + if (item == null) { + item = nil; + }; + + if (index == null) { + index = nil; + }; + next_item = paths['$[]']($rb_plus(index, 1)); + if ($truthy(next_item['$nil?']())) { + return (result = "" + (result) + (item)) + } else { + + if ($truthy(($truthy($b = item['$end_with?']($$($nesting, 'SEPARATOR'))) ? next_item['$start_with?']($$($nesting, 'SEPARATOR')) : $b))) { + item = item.$sub(new RegExp("" + ($$($nesting, 'SEPARATOR')) + "+$"), "")}; + return (result = (function() {if ($truthy(($truthy($b = item['$end_with?']($$($nesting, 'SEPARATOR'))) ? $b : next_item['$start_with?']($$($nesting, 'SEPARATOR'))))) { + return "" + (result) + (item) + } else { + return "" + (result) + (item) + ($$($nesting, 'SEPARATOR')) + }; return nil; })()); + };}, TMP_10.$$s = self, TMP_10.$$arity = 2, TMP_10)); + return result; + }, TMP_join_8.$$arity = -1); + return (Opal.def(self, '$split', TMP_split_11 = function $$split(path) { + var self = this; + + return path.$split($$($nesting, 'SEPARATOR')) + }, TMP_split_11.$$arity = 1), nil) && 'split'; + })(Opal.get_singleton_class(self), $nesting); + })($nesting[0], $$($nesting, 'IO'), $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/process"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $truthy = Opal.truthy; + + Opal.add_stubs(['$const_set', '$size', '$<<', '$__register_clock__', '$to_f', '$now', '$new', '$[]', '$raise']); + + (function($base, $super, $parent_nesting) { + function $Process(){}; + var self = $Process = $klass($base, $super, 'Process', $Process); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Process___register_clock___1, TMP_Process_pid_2, TMP_Process_times_3, TMP_Process_clock_gettime_4, monotonic = nil; + + + self.__clocks__ = []; + Opal.defs(self, '$__register_clock__', TMP_Process___register_clock___1 = function $$__register_clock__(name, func) { + var self = this; + if (self.__clocks__ == null) self.__clocks__ = nil; + + + self.$const_set(name, self.__clocks__.$size()); + return self.__clocks__['$<<'](func); + }, TMP_Process___register_clock___1.$$arity = 2); + self.$__register_clock__("CLOCK_REALTIME", function() { return Date.now() }); + monotonic = false; + + if (Opal.global.performance) { + monotonic = function() { + return performance.now() + }; + } + else if (Opal.global.process && process.hrtime) { + // let now be the base to get smaller numbers + var hrtime_base = process.hrtime(); + + monotonic = function() { + var hrtime = process.hrtime(hrtime_base); + var us = (hrtime[1] / 1000) | 0; // cut below microsecs; + return ((hrtime[0] * 1000) + (us / 1000)); + }; + } + ; + if ($truthy(monotonic)) { + self.$__register_clock__("CLOCK_MONOTONIC", monotonic)}; + Opal.defs(self, '$pid', TMP_Process_pid_2 = function $$pid() { + var self = this; + + return 0 + }, TMP_Process_pid_2.$$arity = 0); + Opal.defs(self, '$times', TMP_Process_times_3 = function $$times() { + var self = this, t = nil; + + + t = $$($nesting, 'Time').$now().$to_f(); + return $$$($$($nesting, 'Benchmark'), 'Tms').$new(t, t, t, t, t); + }, TMP_Process_times_3.$$arity = 0); + return (Opal.defs(self, '$clock_gettime', TMP_Process_clock_gettime_4 = function $$clock_gettime(clock_id, unit) { + var $a, self = this, clock = nil; + if (self.__clocks__ == null) self.__clocks__ = nil; + + + + if (unit == null) { + unit = "float_second"; + }; + ($truthy($a = (clock = self.__clocks__['$[]'](clock_id))) ? $a : self.$raise($$$($$($nesting, 'Errno'), 'EINVAL'), "" + "clock_gettime(" + (clock_id) + ") " + (self.__clocks__['$[]'](clock_id)))); + + var ms = clock(); + switch (unit) { + case 'float_second': return (ms / 1000); // number of seconds as a float (default) + case 'float_millisecond': return (ms / 1); // number of milliseconds as a float + case 'float_microsecond': return (ms * 1000); // number of microseconds as a float + case 'second': return ((ms / 1000) | 0); // number of seconds as an integer + case 'millisecond': return ((ms / 1) | 0); // number of milliseconds as an integer + case 'microsecond': return ((ms * 1000) | 0); // number of microseconds as an integer + case 'nanosecond': return ((ms * 1000000) | 0); // number of nanoseconds as an integer + default: self.$raise($$($nesting, 'ArgumentError'), "" + "unexpected unit: " + (unit)) + } + ; + }, TMP_Process_clock_gettime_4.$$arity = -2), nil) && 'clock_gettime'; + })($nesting[0], null, $nesting); + (function($base, $super, $parent_nesting) { + function $Signal(){}; + var self = $Signal = $klass($base, $super, 'Signal', $Signal); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Signal_trap_5; + + return (Opal.defs(self, '$trap', TMP_Signal_trap_5 = function $$trap($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return nil; + }, TMP_Signal_trap_5.$$arity = -1), nil) && 'trap' + })($nesting[0], null, $nesting); + return (function($base, $super, $parent_nesting) { + function $GC(){}; + var self = $GC = $klass($base, $super, 'GC', $GC); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_GC_start_6; + + return (Opal.defs(self, '$start', TMP_GC_start_6 = function $$start() { + var self = this; + + return nil + }, TMP_GC_start_6.$$arity = 0), nil) && 'start' + })($nesting[0], null, $nesting); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/random"] = function(Opal) { + function $rb_lt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $truthy = Opal.truthy, $send = Opal.send; + + Opal.add_stubs(['$attr_reader', '$new_seed', '$coerce_to!', '$reseed', '$rand', '$seed', '$<', '$raise', '$encode', '$join', '$new', '$chr', '$===', '$==', '$state', '$const_defined?', '$const_set']); + return (function($base, $super, $parent_nesting) { + function $Random(){}; + var self = $Random = $klass($base, $super, 'Random', $Random); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Random_initialize_1, TMP_Random_reseed_2, TMP_Random_new_seed_3, TMP_Random_rand_4, TMP_Random_srand_5, TMP_Random_urandom_6, TMP_Random_$eq$eq_8, TMP_Random_bytes_9, TMP_Random_rand_11, TMP_Random_generator$eq_12; + + + self.$attr_reader("seed", "state"); + + Opal.def(self, '$initialize', TMP_Random_initialize_1 = function $$initialize(seed) { + var self = this; + + + + if (seed == null) { + seed = $$($nesting, 'Random').$new_seed(); + }; + seed = $$($nesting, 'Opal')['$coerce_to!'](seed, $$($nesting, 'Integer'), "to_int"); + self.state = seed; + return self.$reseed(seed); + }, TMP_Random_initialize_1.$$arity = -1); + + Opal.def(self, '$reseed', TMP_Random_reseed_2 = function $$reseed(seed) { + var self = this; + + + self.seed = seed; + return self.$rng = Opal.$$rand.reseed(seed);; + }, TMP_Random_reseed_2.$$arity = 1); + Opal.defs(self, '$new_seed', TMP_Random_new_seed_3 = function $$new_seed() { + var self = this; + + return Opal.$$rand.new_seed(); + }, TMP_Random_new_seed_3.$$arity = 0); + Opal.defs(self, '$rand', TMP_Random_rand_4 = function $$rand(limit) { + var self = this; + + + ; + return $$($nesting, 'DEFAULT').$rand(limit); + }, TMP_Random_rand_4.$$arity = -1); + Opal.defs(self, '$srand', TMP_Random_srand_5 = function $$srand(n) { + var self = this, previous_seed = nil; + + + + if (n == null) { + n = $$($nesting, 'Random').$new_seed(); + }; + n = $$($nesting, 'Opal')['$coerce_to!'](n, $$($nesting, 'Integer'), "to_int"); + previous_seed = $$($nesting, 'DEFAULT').$seed(); + $$($nesting, 'DEFAULT').$reseed(n); + return previous_seed; + }, TMP_Random_srand_5.$$arity = -1); + Opal.defs(self, '$urandom', TMP_Random_urandom_6 = function $$urandom(size) { + var TMP_7, self = this; + + + size = $$($nesting, 'Opal')['$coerce_to!'](size, $$($nesting, 'Integer'), "to_int"); + if ($truthy($rb_lt(size, 0))) { + self.$raise($$($nesting, 'ArgumentError'), "negative string size (or size too big)")}; + return $send($$($nesting, 'Array'), 'new', [size], (TMP_7 = function(){var self = TMP_7.$$s || this; + + return self.$rand(255).$chr()}, TMP_7.$$s = self, TMP_7.$$arity = 0, TMP_7)).$join().$encode("ASCII-8BIT"); + }, TMP_Random_urandom_6.$$arity = 1); + + Opal.def(self, '$==', TMP_Random_$eq$eq_8 = function(other) { + var $a, self = this; + + + if ($truthy($$($nesting, 'Random')['$==='](other))) { + } else { + return false + }; + return (($a = self.$seed()['$=='](other.$seed())) ? self.$state()['$=='](other.$state()) : self.$seed()['$=='](other.$seed())); + }, TMP_Random_$eq$eq_8.$$arity = 1); + + Opal.def(self, '$bytes', TMP_Random_bytes_9 = function $$bytes(length) { + var TMP_10, self = this; + + + length = $$($nesting, 'Opal')['$coerce_to!'](length, $$($nesting, 'Integer'), "to_int"); + return $send($$($nesting, 'Array'), 'new', [length], (TMP_10 = function(){var self = TMP_10.$$s || this; + + return self.$rand(255).$chr()}, TMP_10.$$s = self, TMP_10.$$arity = 0, TMP_10)).$join().$encode("ASCII-8BIT"); + }, TMP_Random_bytes_9.$$arity = 1); + + Opal.def(self, '$rand', TMP_Random_rand_11 = function $$rand(limit) { + var self = this; + + + ; + + function randomFloat() { + self.state++; + return Opal.$$rand.rand(self.$rng); + } + + function randomInt() { + return Math.floor(randomFloat() * limit); + } + + function randomRange() { + var min = limit.begin, + max = limit.end; + + if (min === nil || max === nil) { + return nil; + } + + var length = max - min; + + if (length < 0) { + return nil; + } + + if (length === 0) { + return min; + } + + if (max % 1 === 0 && min % 1 === 0 && !limit.excl) { + length++; + } + + return self.$rand(length) + min; + } + + if (limit == null) { + return randomFloat(); + } else if (limit.$$is_range) { + return randomRange(); + } else if (limit.$$is_number) { + if (limit <= 0) { + self.$raise($$($nesting, 'ArgumentError'), "" + "invalid argument - " + (limit)) + } + + if (limit % 1 === 0) { + // integer + return randomInt(); + } else { + return randomFloat() * limit; + } + } else { + limit = $$($nesting, 'Opal')['$coerce_to!'](limit, $$($nesting, 'Integer'), "to_int"); + + if (limit <= 0) { + self.$raise($$($nesting, 'ArgumentError'), "" + "invalid argument - " + (limit)) + } + + return randomInt(); + } + ; + }, TMP_Random_rand_11.$$arity = -1); + return (Opal.defs(self, '$generator=', TMP_Random_generator$eq_12 = function(generator) { + var self = this; + + + Opal.$$rand = generator; + if ($truthy(self['$const_defined?']("DEFAULT"))) { + return $$($nesting, 'DEFAULT').$reseed() + } else { + return self.$const_set("DEFAULT", self.$new(self.$new_seed())) + }; + }, TMP_Random_generator$eq_12.$$arity = 1), nil) && 'generator='; + })($nesting[0], null, $nesting) +}; + +/* +This is based on an adaptation of Makoto Matsumoto and Takuji Nishimura's code +done by Sean McCullough and Dave Heitzman +, subsequently readapted from an updated version of +ruby's random.c (rev c38a183032a7826df1adabd8aa0725c713d53e1c). + +The original copyright notice from random.c follows. + + This is based on trimmed version of MT19937. To get the original version, + contact . + + The original copyright notice follows. + + A C-program for MT19937, with initialization improved 2002/2/10. + Coded by Takuji Nishimura and Makoto Matsumoto. + This is a faster version by taking Shawn Cokus's optimization, + Matthe Bellew's simplification, Isaku Wada's real version. + + Before using, initialize the state by using init_genrand(mt, seed) + or init_by_array(mt, init_key, key_length). + + Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura, + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + 3. The names of its contributors may not be used to endorse or promote + products derived from this software without specific prior written + permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + + Any feedback is very welcome. + http://www.math.keio.ac.jp/matumoto/emt.html + email: matumoto@math.keio.ac.jp +*/ +var MersenneTwister = (function() { + /* Period parameters */ + var N = 624; + var M = 397; + var MATRIX_A = 0x9908b0df; /* constant vector a */ + var UMASK = 0x80000000; /* most significant w-r bits */ + var LMASK = 0x7fffffff; /* least significant r bits */ + var MIXBITS = function(u,v) { return ( ((u) & UMASK) | ((v) & LMASK) ); }; + var TWIST = function(u,v) { return (MIXBITS((u),(v)) >>> 1) ^ ((v & 0x1) ? MATRIX_A : 0x0); }; + + function init(s) { + var mt = {left: 0, next: N, state: new Array(N)}; + init_genrand(mt, s); + return mt; + } + + /* initializes mt[N] with a seed */ + function init_genrand(mt, s) { + var j, i; + mt.state[0] = s >>> 0; + for (j=1; j> 30) >>> 0)) + j); + /* See Knuth TAOCP Vol2. 3rd Ed. P.106 for multiplier. */ + /* In the previous versions, MSBs of the seed affect */ + /* only MSBs of the array state[]. */ + /* 2002/01/09 modified by Makoto Matsumoto */ + mt.state[j] &= 0xffffffff; /* for >32 bit machines */ + } + mt.left = 1; + mt.next = N; + } + + /* generate N words at one time */ + function next_state(mt) { + var p = 0, _p = mt.state; + var j; + + mt.left = N; + mt.next = 0; + + for (j=N-M+1; --j; p++) + _p[p] = _p[p+(M)] ^ TWIST(_p[p+(0)], _p[p+(1)]); + + for (j=M; --j; p++) + _p[p] = _p[p+(M-N)] ^ TWIST(_p[p+(0)], _p[p+(1)]); + + _p[p] = _p[p+(M-N)] ^ TWIST(_p[p+(0)], _p[0]); + } + + /* generates a random number on [0,0xffffffff]-interval */ + function genrand_int32(mt) { + /* mt must be initialized */ + var y; + + if (--mt.left <= 0) next_state(mt); + y = mt.state[mt.next++]; + + /* Tempering */ + y ^= (y >>> 11); + y ^= (y << 7) & 0x9d2c5680; + y ^= (y << 15) & 0xefc60000; + y ^= (y >>> 18); + + return y >>> 0; + } + + function int_pair_to_real_exclusive(a, b) { + a >>>= 5; + b >>>= 6; + return(a*67108864.0+b)*(1.0/9007199254740992.0); + } + + // generates a random number on [0,1) with 53-bit resolution + function genrand_real(mt) { + /* mt must be initialized */ + var a = genrand_int32(mt), b = genrand_int32(mt); + return int_pair_to_real_exclusive(a, b); + } + + return { genrand_real: genrand_real, init: init }; +})(); +Opal.loaded(["corelib/random/MersenneTwister.js"]); +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/random/mersenne_twister"] = function(Opal) { + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $send = Opal.send; + + Opal.add_stubs(['$require', '$generator=', '$-']); + + self.$require("corelib/random/MersenneTwister"); + return (function($base, $super, $parent_nesting) { + function $Random(){}; + var self = $Random = $klass($base, $super, 'Random', $Random); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), $writer = nil; + + + var MAX_INT = Number.MAX_SAFE_INTEGER || Math.pow(2, 53) - 1; + Opal.const_set($nesting[0], 'MERSENNE_TWISTER_GENERATOR', { + new_seed: function() { return Math.round(Math.random() * MAX_INT); }, + reseed: function(seed) { return MersenneTwister.init(seed); }, + rand: function(mt) { return MersenneTwister.genrand_real(mt); } + }); + + $writer = [$$($nesting, 'MERSENNE_TWISTER_GENERATOR')]; + $send(self, 'generator=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];; + })($nesting[0], null, $nesting); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/unsupported"] = function(Opal) { + var TMP_public_35, TMP_private_36, self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $module = Opal.module; + + Opal.add_stubs(['$raise', '$warn', '$%']); + + + var warnings = {}; + + function handle_unsupported_feature(message) { + switch (Opal.config.unsupported_features_severity) { + case 'error': + $$($nesting, 'Kernel').$raise($$($nesting, 'NotImplementedError'), message) + break; + case 'warning': + warn(message) + break; + default: // ignore + // noop + } + } + + function warn(string) { + if (warnings[string]) { + return; + } + + warnings[string] = true; + self.$warn(string); + } +; + (function($base, $super, $parent_nesting) { + function $String(){}; + var self = $String = $klass($base, $super, 'String', $String); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_String_$lt$lt_1, TMP_String_capitalize$B_2, TMP_String_chomp$B_3, TMP_String_chop$B_4, TMP_String_downcase$B_5, TMP_String_gsub$B_6, TMP_String_lstrip$B_7, TMP_String_next$B_8, TMP_String_reverse$B_9, TMP_String_slice$B_10, TMP_String_squeeze$B_11, TMP_String_strip$B_12, TMP_String_sub$B_13, TMP_String_succ$B_14, TMP_String_swapcase$B_15, TMP_String_tr$B_16, TMP_String_tr_s$B_17, TMP_String_upcase$B_18, TMP_String_prepend_19, TMP_String_$$$eq_20, TMP_String_clear_21, TMP_String_encode$B_22, TMP_String_unicode_normalize$B_23; + + + var ERROR = "String#%s not supported. Mutable String methods are not supported in Opal."; + + Opal.def(self, '$<<', TMP_String_$lt$lt_1 = function($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return self.$raise($$($nesting, 'NotImplementedError'), (ERROR)['$%']("<<")); + }, TMP_String_$lt$lt_1.$$arity = -1); + + Opal.def(self, '$capitalize!', TMP_String_capitalize$B_2 = function($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return self.$raise($$($nesting, 'NotImplementedError'), (ERROR)['$%']("capitalize!")); + }, TMP_String_capitalize$B_2.$$arity = -1); + + Opal.def(self, '$chomp!', TMP_String_chomp$B_3 = function($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return self.$raise($$($nesting, 'NotImplementedError'), (ERROR)['$%']("chomp!")); + }, TMP_String_chomp$B_3.$$arity = -1); + + Opal.def(self, '$chop!', TMP_String_chop$B_4 = function($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return self.$raise($$($nesting, 'NotImplementedError'), (ERROR)['$%']("chop!")); + }, TMP_String_chop$B_4.$$arity = -1); + + Opal.def(self, '$downcase!', TMP_String_downcase$B_5 = function($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return self.$raise($$($nesting, 'NotImplementedError'), (ERROR)['$%']("downcase!")); + }, TMP_String_downcase$B_5.$$arity = -1); + + Opal.def(self, '$gsub!', TMP_String_gsub$B_6 = function($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return self.$raise($$($nesting, 'NotImplementedError'), (ERROR)['$%']("gsub!")); + }, TMP_String_gsub$B_6.$$arity = -1); + + Opal.def(self, '$lstrip!', TMP_String_lstrip$B_7 = function($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return self.$raise($$($nesting, 'NotImplementedError'), (ERROR)['$%']("lstrip!")); + }, TMP_String_lstrip$B_7.$$arity = -1); + + Opal.def(self, '$next!', TMP_String_next$B_8 = function($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return self.$raise($$($nesting, 'NotImplementedError'), (ERROR)['$%']("next!")); + }, TMP_String_next$B_8.$$arity = -1); + + Opal.def(self, '$reverse!', TMP_String_reverse$B_9 = function($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return self.$raise($$($nesting, 'NotImplementedError'), (ERROR)['$%']("reverse!")); + }, TMP_String_reverse$B_9.$$arity = -1); + + Opal.def(self, '$slice!', TMP_String_slice$B_10 = function($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return self.$raise($$($nesting, 'NotImplementedError'), (ERROR)['$%']("slice!")); + }, TMP_String_slice$B_10.$$arity = -1); + + Opal.def(self, '$squeeze!', TMP_String_squeeze$B_11 = function($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return self.$raise($$($nesting, 'NotImplementedError'), (ERROR)['$%']("squeeze!")); + }, TMP_String_squeeze$B_11.$$arity = -1); + + Opal.def(self, '$strip!', TMP_String_strip$B_12 = function($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return self.$raise($$($nesting, 'NotImplementedError'), (ERROR)['$%']("strip!")); + }, TMP_String_strip$B_12.$$arity = -1); + + Opal.def(self, '$sub!', TMP_String_sub$B_13 = function($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return self.$raise($$($nesting, 'NotImplementedError'), (ERROR)['$%']("sub!")); + }, TMP_String_sub$B_13.$$arity = -1); + + Opal.def(self, '$succ!', TMP_String_succ$B_14 = function($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return self.$raise($$($nesting, 'NotImplementedError'), (ERROR)['$%']("succ!")); + }, TMP_String_succ$B_14.$$arity = -1); + + Opal.def(self, '$swapcase!', TMP_String_swapcase$B_15 = function($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return self.$raise($$($nesting, 'NotImplementedError'), (ERROR)['$%']("swapcase!")); + }, TMP_String_swapcase$B_15.$$arity = -1); + + Opal.def(self, '$tr!', TMP_String_tr$B_16 = function($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return self.$raise($$($nesting, 'NotImplementedError'), (ERROR)['$%']("tr!")); + }, TMP_String_tr$B_16.$$arity = -1); + + Opal.def(self, '$tr_s!', TMP_String_tr_s$B_17 = function($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return self.$raise($$($nesting, 'NotImplementedError'), (ERROR)['$%']("tr_s!")); + }, TMP_String_tr_s$B_17.$$arity = -1); + + Opal.def(self, '$upcase!', TMP_String_upcase$B_18 = function($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return self.$raise($$($nesting, 'NotImplementedError'), (ERROR)['$%']("upcase!")); + }, TMP_String_upcase$B_18.$$arity = -1); + + Opal.def(self, '$prepend', TMP_String_prepend_19 = function $$prepend($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return self.$raise($$($nesting, 'NotImplementedError'), (ERROR)['$%']("prepend")); + }, TMP_String_prepend_19.$$arity = -1); + + Opal.def(self, '$[]=', TMP_String_$$$eq_20 = function($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return self.$raise($$($nesting, 'NotImplementedError'), (ERROR)['$%']("[]=")); + }, TMP_String_$$$eq_20.$$arity = -1); + + Opal.def(self, '$clear', TMP_String_clear_21 = function $$clear($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return self.$raise($$($nesting, 'NotImplementedError'), (ERROR)['$%']("clear")); + }, TMP_String_clear_21.$$arity = -1); + + Opal.def(self, '$encode!', TMP_String_encode$B_22 = function($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return self.$raise($$($nesting, 'NotImplementedError'), (ERROR)['$%']("encode!")); + }, TMP_String_encode$B_22.$$arity = -1); + return (Opal.def(self, '$unicode_normalize!', TMP_String_unicode_normalize$B_23 = function($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return self.$raise($$($nesting, 'NotImplementedError'), (ERROR)['$%']("unicode_normalize!")); + }, TMP_String_unicode_normalize$B_23.$$arity = -1), nil) && 'unicode_normalize!'; + })($nesting[0], null, $nesting); + (function($base, $parent_nesting) { + function $Kernel() {}; + var self = $Kernel = $module($base, 'Kernel', $Kernel); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Kernel_freeze_24, TMP_Kernel_frozen$q_25; + + + var ERROR = "Object freezing is not supported by Opal"; + + Opal.def(self, '$freeze', TMP_Kernel_freeze_24 = function $$freeze() { + var self = this; + + + handle_unsupported_feature(ERROR); + return self; + }, TMP_Kernel_freeze_24.$$arity = 0); + + Opal.def(self, '$frozen?', TMP_Kernel_frozen$q_25 = function() { + var self = this; + + + handle_unsupported_feature(ERROR); + return false; + }, TMP_Kernel_frozen$q_25.$$arity = 0); + })($nesting[0], $nesting); + (function($base, $parent_nesting) { + function $Kernel() {}; + var self = $Kernel = $module($base, 'Kernel', $Kernel); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Kernel_taint_26, TMP_Kernel_untaint_27, TMP_Kernel_tainted$q_28; + + + var ERROR = "Object tainting is not supported by Opal"; + + Opal.def(self, '$taint', TMP_Kernel_taint_26 = function $$taint() { + var self = this; + + + handle_unsupported_feature(ERROR); + return self; + }, TMP_Kernel_taint_26.$$arity = 0); + + Opal.def(self, '$untaint', TMP_Kernel_untaint_27 = function $$untaint() { + var self = this; + + + handle_unsupported_feature(ERROR); + return self; + }, TMP_Kernel_untaint_27.$$arity = 0); + + Opal.def(self, '$tainted?', TMP_Kernel_tainted$q_28 = function() { + var self = this; + + + handle_unsupported_feature(ERROR); + return false; + }, TMP_Kernel_tainted$q_28.$$arity = 0); + })($nesting[0], $nesting); + (function($base, $super, $parent_nesting) { + function $Module(){}; + var self = $Module = $klass($base, $super, 'Module', $Module); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Module_public_29, TMP_Module_private_class_method_30, TMP_Module_private_method_defined$q_31, TMP_Module_private_constant_32; + + + + Opal.def(self, '$public', TMP_Module_public_29 = function($a) { + var $post_args, methods, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + methods = $post_args;; + + if (methods.length === 0) { + self.$$module_function = false; + } + + return nil; + ; + }, TMP_Module_public_29.$$arity = -1); + Opal.alias(self, "private", "public"); + Opal.alias(self, "protected", "public"); + Opal.alias(self, "nesting", "public"); + + Opal.def(self, '$private_class_method', TMP_Module_private_class_method_30 = function $$private_class_method($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return self; + }, TMP_Module_private_class_method_30.$$arity = -1); + Opal.alias(self, "public_class_method", "private_class_method"); + + Opal.def(self, '$private_method_defined?', TMP_Module_private_method_defined$q_31 = function(obj) { + var self = this; + + return false + }, TMP_Module_private_method_defined$q_31.$$arity = 1); + + Opal.def(self, '$private_constant', TMP_Module_private_constant_32 = function $$private_constant($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return nil; + }, TMP_Module_private_constant_32.$$arity = -1); + Opal.alias(self, "protected_method_defined?", "private_method_defined?"); + Opal.alias(self, "public_instance_methods", "instance_methods"); + Opal.alias(self, "public_instance_method", "instance_method"); + return Opal.alias(self, "public_method_defined?", "method_defined?"); + })($nesting[0], null, $nesting); + (function($base, $parent_nesting) { + function $Kernel() {}; + var self = $Kernel = $module($base, 'Kernel', $Kernel); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Kernel_private_methods_33; + + + + Opal.def(self, '$private_methods', TMP_Kernel_private_methods_33 = function $$private_methods($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return []; + }, TMP_Kernel_private_methods_33.$$arity = -1); + Opal.alias(self, "private_instance_methods", "private_methods"); + })($nesting[0], $nesting); + (function($base, $parent_nesting) { + function $Kernel() {}; + var self = $Kernel = $module($base, 'Kernel', $Kernel); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Kernel_eval_34; + + + Opal.def(self, '$eval', TMP_Kernel_eval_34 = function($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return self.$raise($$($nesting, 'NotImplementedError'), "" + "To use Kernel#eval, you must first require 'opal-parser'. " + ("" + "See https://github.com/opal/opal/blob/" + ($$($nesting, 'RUBY_ENGINE_VERSION')) + "/docs/opal_parser.md for details.")); + }, TMP_Kernel_eval_34.$$arity = -1) + })($nesting[0], $nesting); + Opal.defs(self, '$public', TMP_public_35 = function($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return nil; + }, TMP_public_35.$$arity = -1); + return (Opal.defs(self, '$private', TMP_private_36 = function($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return nil; + }, TMP_private_36.$$arity = -1), nil) && 'private'; +}; + +/* Generated by Opal 0.11.99.dev */ +(function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice; + + Opal.add_stubs(['$require']); + + self.$require("opal/base"); + self.$require("opal/mini"); + self.$require("corelib/string/encoding"); + self.$require("corelib/math"); + self.$require("corelib/complex"); + self.$require("corelib/rational"); + self.$require("corelib/time"); + self.$require("corelib/struct"); + self.$require("corelib/io"); + self.$require("corelib/main"); + self.$require("corelib/dir"); + self.$require("corelib/file"); + self.$require("corelib/process"); + self.$require("corelib/random"); + self.$require("corelib/random/mersenne_twister.js"); + return self.$require("corelib/unsupported"); +})(Opal); + + + // restore Function methods (see https://github.com/opal/opal/issues/1846) + for (var index in fundamentalObjects) { + var fundamentalObject = fundamentalObjects[index]; + var name = fundamentalObject.name; + if (typeof fundamentalObject.call !== 'function') { + fundamentalObject.call = backup[name].call; + } + if (typeof fundamentalObject.apply !== 'function') { + fundamentalObject.apply = backup[name].apply; + } + if (typeof fundamentalObject.bind !== 'function') { + fundamentalObject.bind = backup[name].bind; + } + } +} + +// UMD Module +(function (root, factory) { + if (typeof module === 'object' && module.exports) { + // Node. Does not work with strict CommonJS, but + // only CommonJS-like environments that support module.exports, + // like Node. + module.exports = factory; + } else if (typeof define === 'function' && define.amd) { + // AMD. Register a named module. + define('asciidoctor', ['module'], function (module) { + return factory(module.config()); + }); + } else { + // Browser globals (root is window) + root.Asciidoctor = factory; + } +// eslint-disable-next-line no-unused-vars +}(this, function (moduleConfig) { +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/js/opal_ext/graalvm/file"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass; + + return (function($base, $super, $parent_nesting) { + function $File(){}; + var self = $File = $klass($base, $super, 'File', $File); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_File_read_1; + + return (Opal.defs(self, '$read', TMP_File_read_1 = function $$read(path) { + var self = this; + + return IncludeResolver.read(path); + }, TMP_File_read_1.$$arity = 1), nil) && 'read' + })($nesting[0], null, $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/js/opal_ext/graalvm/dir"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass; + + return (function($base, $super, $parent_nesting) { + function $Dir(){}; + var self = $Dir = $klass($base, $super, 'Dir', $Dir); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return (function(self, $parent_nesting) { + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_pwd_1; + + + + Opal.def(self, '$pwd', TMP_pwd_1 = function $$pwd() { + var self = this; + + return IncludeResolver.pwd(); + }, TMP_pwd_1.$$arity = 0); + return Opal.alias(self, "getwd", "pwd"); + })(Opal.get_singleton_class(self), $nesting) + })($nesting[0], null, $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/js/opal_ext/graalvm"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice; + + Opal.add_stubs(['$require']); + + + var platform, engine, framework, ioModule; + + if (typeof moduleConfig === 'object' && typeof moduleConfig.runtime === 'object') { + var runtime = moduleConfig.runtime; + platform = runtime.platform; + engine = runtime.engine; + framework = runtime.framework; + ioModule = runtime.ioModule; + } + ioModule = ioModule || 'java_nio'; + platform = platform || 'java'; + engine = engine || 'graalvm'; + framework = framework || ''; +; + Opal.const_set($nesting[0], 'JAVASCRIPT_IO_MODULE', ioModule); + Opal.const_set($nesting[0], 'JAVASCRIPT_PLATFORM', platform); + Opal.const_set($nesting[0], 'JAVASCRIPT_ENGINE', engine); + Opal.const_set($nesting[0], 'JAVASCRIPT_FRAMEWORK', framework); + self.$require("asciidoctor/js/opal_ext/graalvm/file"); + return self.$require("asciidoctor/js/opal_ext/graalvm/dir"); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["set"] = function(Opal) { + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + function $rb_lt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); + } + function $rb_le(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs <= rhs : lhs['$<='](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $hash2 = Opal.hash2, $truthy = Opal.truthy, $send = Opal.send, $module = Opal.module; + + Opal.add_stubs(['$include', '$new', '$nil?', '$===', '$raise', '$each', '$add', '$merge', '$class', '$respond_to?', '$subtract', '$dup', '$join', '$to_a', '$equal?', '$instance_of?', '$==', '$instance_variable_get', '$is_a?', '$size', '$all?', '$include?', '$[]=', '$-', '$enum_for', '$[]', '$<<', '$replace', '$delete', '$select', '$each_key', '$to_proc', '$empty?', '$eql?', '$instance_eval', '$clear', '$<', '$<=', '$keys']); + + (function($base, $super, $parent_nesting) { + function $Set(){}; + var self = $Set = $klass($base, $super, 'Set', $Set); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Set_$$_1, TMP_Set_initialize_2, TMP_Set_dup_4, TMP_Set_$_5, TMP_Set_inspect_6, TMP_Set_$eq$eq_7, TMP_Set_add_9, TMP_Set_classify_10, TMP_Set_collect$B_13, TMP_Set_delete_15, TMP_Set_delete$q_16, TMP_Set_delete_if_17, TMP_Set_add$q_20, TMP_Set_each_21, TMP_Set_empty$q_22, TMP_Set_eql$q_23, TMP_Set_clear_25, TMP_Set_include$q_26, TMP_Set_merge_27, TMP_Set_replace_29, TMP_Set_size_30, TMP_Set_subtract_31, TMP_Set_$_33, TMP_Set_superset$q_34, TMP_Set_proper_superset$q_36, TMP_Set_subset$q_38, TMP_Set_proper_subset$q_40, TMP_Set_to_a_42; + + def.hash = nil; + + self.$include($$($nesting, 'Enumerable')); + Opal.defs(self, '$[]', TMP_Set_$$_1 = function($a) { + var $post_args, ary, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + ary = $post_args;; + return self.$new(ary); + }, TMP_Set_$$_1.$$arity = -1); + + Opal.def(self, '$initialize', TMP_Set_initialize_2 = function $$initialize(enum$) { + var $iter = TMP_Set_initialize_2.$$p, block = $iter || nil, TMP_3, self = this; + + if ($iter) TMP_Set_initialize_2.$$p = null; + + + if ($iter) TMP_Set_initialize_2.$$p = null;; + + if (enum$ == null) { + enum$ = nil; + }; + self.hash = $hash2([], {}); + if ($truthy(enum$['$nil?']())) { + return nil}; + if ($truthy($$($nesting, 'Enumerable')['$==='](enum$))) { + } else { + self.$raise($$($nesting, 'ArgumentError'), "value must be enumerable") + }; + if ($truthy(block)) { + return $send(enum$, 'each', [], (TMP_3 = function(item){var self = TMP_3.$$s || this; + + + + if (item == null) { + item = nil; + }; + return self.$add(Opal.yield1(block, item));}, TMP_3.$$s = self, TMP_3.$$arity = 1, TMP_3)) + } else { + return self.$merge(enum$) + }; + }, TMP_Set_initialize_2.$$arity = -1); + + Opal.def(self, '$dup', TMP_Set_dup_4 = function $$dup() { + var self = this, result = nil; + + + result = self.$class().$new(); + return result.$merge(self); + }, TMP_Set_dup_4.$$arity = 0); + + Opal.def(self, '$-', TMP_Set_$_5 = function(enum$) { + var self = this; + + + if ($truthy(enum$['$respond_to?']("each"))) { + } else { + self.$raise($$($nesting, 'ArgumentError'), "value must be enumerable") + }; + return self.$dup().$subtract(enum$); + }, TMP_Set_$_5.$$arity = 1); + Opal.alias(self, "difference", "-"); + + Opal.def(self, '$inspect', TMP_Set_inspect_6 = function $$inspect() { + var self = this; + + return "" + "#" + }, TMP_Set_inspect_6.$$arity = 0); + + Opal.def(self, '$==', TMP_Set_$eq$eq_7 = function(other) { + var $a, TMP_8, self = this; + + if ($truthy(self['$equal?'](other))) { + return true + } else if ($truthy(other['$instance_of?'](self.$class()))) { + return self.hash['$=='](other.$instance_variable_get("@hash")) + } else if ($truthy(($truthy($a = other['$is_a?']($$($nesting, 'Set'))) ? self.$size()['$=='](other.$size()) : $a))) { + return $send(other, 'all?', [], (TMP_8 = function(o){var self = TMP_8.$$s || this; + if (self.hash == null) self.hash = nil; + + + + if (o == null) { + o = nil; + }; + return self.hash['$include?'](o);}, TMP_8.$$s = self, TMP_8.$$arity = 1, TMP_8)) + } else { + return false + } + }, TMP_Set_$eq$eq_7.$$arity = 1); + + Opal.def(self, '$add', TMP_Set_add_9 = function $$add(o) { + var self = this, $writer = nil; + + + + $writer = [o, true]; + $send(self.hash, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + return self; + }, TMP_Set_add_9.$$arity = 1); + Opal.alias(self, "<<", "add"); + + Opal.def(self, '$classify', TMP_Set_classify_10 = function $$classify() { + var $iter = TMP_Set_classify_10.$$p, block = $iter || nil, TMP_11, TMP_12, self = this, result = nil; + + if ($iter) TMP_Set_classify_10.$$p = null; + + + if ($iter) TMP_Set_classify_10.$$p = null;; + if ((block !== nil)) { + } else { + return self.$enum_for("classify") + }; + result = $send($$($nesting, 'Hash'), 'new', [], (TMP_11 = function(h, k){var self = TMP_11.$$s || this, $writer = nil; + + + + if (h == null) { + h = nil; + }; + + if (k == null) { + k = nil; + }; + $writer = [k, self.$class().$new()]; + $send(h, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];}, TMP_11.$$s = self, TMP_11.$$arity = 2, TMP_11)); + $send(self, 'each', [], (TMP_12 = function(item){var self = TMP_12.$$s || this; + + + + if (item == null) { + item = nil; + }; + return result['$[]'](Opal.yield1(block, item)).$add(item);}, TMP_12.$$s = self, TMP_12.$$arity = 1, TMP_12)); + return result; + }, TMP_Set_classify_10.$$arity = 0); + + Opal.def(self, '$collect!', TMP_Set_collect$B_13 = function() { + var $iter = TMP_Set_collect$B_13.$$p, block = $iter || nil, TMP_14, self = this, result = nil; + + if ($iter) TMP_Set_collect$B_13.$$p = null; + + + if ($iter) TMP_Set_collect$B_13.$$p = null;; + if ((block !== nil)) { + } else { + return self.$enum_for("collect!") + }; + result = self.$class().$new(); + $send(self, 'each', [], (TMP_14 = function(item){var self = TMP_14.$$s || this; + + + + if (item == null) { + item = nil; + }; + return result['$<<'](Opal.yield1(block, item));}, TMP_14.$$s = self, TMP_14.$$arity = 1, TMP_14)); + return self.$replace(result); + }, TMP_Set_collect$B_13.$$arity = 0); + Opal.alias(self, "map!", "collect!"); + + Opal.def(self, '$delete', TMP_Set_delete_15 = function(o) { + var self = this; + + + self.hash.$delete(o); + return self; + }, TMP_Set_delete_15.$$arity = 1); + + Opal.def(self, '$delete?', TMP_Set_delete$q_16 = function(o) { + var self = this; + + if ($truthy(self['$include?'](o))) { + + self.$delete(o); + return self; + } else { + return nil + } + }, TMP_Set_delete$q_16.$$arity = 1); + + Opal.def(self, '$delete_if', TMP_Set_delete_if_17 = function $$delete_if() { + var TMP_18, TMP_19, $iter = TMP_Set_delete_if_17.$$p, $yield = $iter || nil, self = this; + + if ($iter) TMP_Set_delete_if_17.$$p = null; + + if (($yield !== nil)) { + } else { + return self.$enum_for("delete_if") + }; + $send($send(self, 'select', [], (TMP_18 = function(o){var self = TMP_18.$$s || this; + + + + if (o == null) { + o = nil; + }; + return Opal.yield1($yield, o);;}, TMP_18.$$s = self, TMP_18.$$arity = 1, TMP_18)), 'each', [], (TMP_19 = function(o){var self = TMP_19.$$s || this; + if (self.hash == null) self.hash = nil; + + + + if (o == null) { + o = nil; + }; + return self.hash.$delete(o);}, TMP_19.$$s = self, TMP_19.$$arity = 1, TMP_19)); + return self; + }, TMP_Set_delete_if_17.$$arity = 0); + + Opal.def(self, '$add?', TMP_Set_add$q_20 = function(o) { + var self = this; + + if ($truthy(self['$include?'](o))) { + return nil + } else { + return self.$add(o) + } + }, TMP_Set_add$q_20.$$arity = 1); + + Opal.def(self, '$each', TMP_Set_each_21 = function $$each() { + var $iter = TMP_Set_each_21.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Set_each_21.$$p = null; + + + if ($iter) TMP_Set_each_21.$$p = null;; + if ((block !== nil)) { + } else { + return self.$enum_for("each") + }; + $send(self.hash, 'each_key', [], block.$to_proc()); + return self; + }, TMP_Set_each_21.$$arity = 0); + + Opal.def(self, '$empty?', TMP_Set_empty$q_22 = function() { + var self = this; + + return self.hash['$empty?']() + }, TMP_Set_empty$q_22.$$arity = 0); + + Opal.def(self, '$eql?', TMP_Set_eql$q_23 = function(other) { + var TMP_24, self = this; + + return self.hash['$eql?']($send(other, 'instance_eval', [], (TMP_24 = function(){var self = TMP_24.$$s || this; + if (self.hash == null) self.hash = nil; + + return self.hash}, TMP_24.$$s = self, TMP_24.$$arity = 0, TMP_24))) + }, TMP_Set_eql$q_23.$$arity = 1); + + Opal.def(self, '$clear', TMP_Set_clear_25 = function $$clear() { + var self = this; + + + self.hash.$clear(); + return self; + }, TMP_Set_clear_25.$$arity = 0); + + Opal.def(self, '$include?', TMP_Set_include$q_26 = function(o) { + var self = this; + + return self.hash['$include?'](o) + }, TMP_Set_include$q_26.$$arity = 1); + Opal.alias(self, "member?", "include?"); + + Opal.def(self, '$merge', TMP_Set_merge_27 = function $$merge(enum$) { + var TMP_28, self = this; + + + $send(enum$, 'each', [], (TMP_28 = function(item){var self = TMP_28.$$s || this; + + + + if (item == null) { + item = nil; + }; + return self.$add(item);}, TMP_28.$$s = self, TMP_28.$$arity = 1, TMP_28)); + return self; + }, TMP_Set_merge_27.$$arity = 1); + + Opal.def(self, '$replace', TMP_Set_replace_29 = function $$replace(enum$) { + var self = this; + + + self.$clear(); + self.$merge(enum$); + return self; + }, TMP_Set_replace_29.$$arity = 1); + + Opal.def(self, '$size', TMP_Set_size_30 = function $$size() { + var self = this; + + return self.hash.$size() + }, TMP_Set_size_30.$$arity = 0); + Opal.alias(self, "length", "size"); + + Opal.def(self, '$subtract', TMP_Set_subtract_31 = function $$subtract(enum$) { + var TMP_32, self = this; + + + $send(enum$, 'each', [], (TMP_32 = function(item){var self = TMP_32.$$s || this; + + + + if (item == null) { + item = nil; + }; + return self.$delete(item);}, TMP_32.$$s = self, TMP_32.$$arity = 1, TMP_32)); + return self; + }, TMP_Set_subtract_31.$$arity = 1); + + Opal.def(self, '$|', TMP_Set_$_33 = function(enum$) { + var self = this; + + + if ($truthy(enum$['$respond_to?']("each"))) { + } else { + self.$raise($$($nesting, 'ArgumentError'), "value must be enumerable") + }; + return self.$dup().$merge(enum$); + }, TMP_Set_$_33.$$arity = 1); + + Opal.def(self, '$superset?', TMP_Set_superset$q_34 = function(set) { + var $a, TMP_35, self = this; + + + ($truthy($a = set['$is_a?']($$($nesting, 'Set'))) ? $a : self.$raise($$($nesting, 'ArgumentError'), "value must be a set")); + if ($truthy($rb_lt(self.$size(), set.$size()))) { + return false}; + return $send(set, 'all?', [], (TMP_35 = function(o){var self = TMP_35.$$s || this; + + + + if (o == null) { + o = nil; + }; + return self['$include?'](o);}, TMP_35.$$s = self, TMP_35.$$arity = 1, TMP_35)); + }, TMP_Set_superset$q_34.$$arity = 1); + Opal.alias(self, ">=", "superset?"); + + Opal.def(self, '$proper_superset?', TMP_Set_proper_superset$q_36 = function(set) { + var $a, TMP_37, self = this; + + + ($truthy($a = set['$is_a?']($$($nesting, 'Set'))) ? $a : self.$raise($$($nesting, 'ArgumentError'), "value must be a set")); + if ($truthy($rb_le(self.$size(), set.$size()))) { + return false}; + return $send(set, 'all?', [], (TMP_37 = function(o){var self = TMP_37.$$s || this; + + + + if (o == null) { + o = nil; + }; + return self['$include?'](o);}, TMP_37.$$s = self, TMP_37.$$arity = 1, TMP_37)); + }, TMP_Set_proper_superset$q_36.$$arity = 1); + Opal.alias(self, ">", "proper_superset?"); + + Opal.def(self, '$subset?', TMP_Set_subset$q_38 = function(set) { + var $a, TMP_39, self = this; + + + ($truthy($a = set['$is_a?']($$($nesting, 'Set'))) ? $a : self.$raise($$($nesting, 'ArgumentError'), "value must be a set")); + if ($truthy($rb_lt(set.$size(), self.$size()))) { + return false}; + return $send(self, 'all?', [], (TMP_39 = function(o){var self = TMP_39.$$s || this; + + + + if (o == null) { + o = nil; + }; + return set['$include?'](o);}, TMP_39.$$s = self, TMP_39.$$arity = 1, TMP_39)); + }, TMP_Set_subset$q_38.$$arity = 1); + Opal.alias(self, "<=", "subset?"); + + Opal.def(self, '$proper_subset?', TMP_Set_proper_subset$q_40 = function(set) { + var $a, TMP_41, self = this; + + + ($truthy($a = set['$is_a?']($$($nesting, 'Set'))) ? $a : self.$raise($$($nesting, 'ArgumentError'), "value must be a set")); + if ($truthy($rb_le(set.$size(), self.$size()))) { + return false}; + return $send(self, 'all?', [], (TMP_41 = function(o){var self = TMP_41.$$s || this; + + + + if (o == null) { + o = nil; + }; + return set['$include?'](o);}, TMP_41.$$s = self, TMP_41.$$arity = 1, TMP_41)); + }, TMP_Set_proper_subset$q_40.$$arity = 1); + Opal.alias(self, "<", "proper_subset?"); + Opal.alias(self, "+", "|"); + Opal.alias(self, "union", "|"); + return (Opal.def(self, '$to_a', TMP_Set_to_a_42 = function $$to_a() { + var self = this; + + return self.hash.$keys() + }, TMP_Set_to_a_42.$$arity = 0), nil) && 'to_a'; + })($nesting[0], null, $nesting); + return (function($base, $parent_nesting) { + function $Enumerable() {}; + var self = $Enumerable = $module($base, 'Enumerable', $Enumerable); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Enumerable_to_set_43; + + + Opal.def(self, '$to_set', TMP_Enumerable_to_set_43 = function $$to_set($a, $b) { + var $iter = TMP_Enumerable_to_set_43.$$p, block = $iter || nil, $post_args, klass, args, self = this; + + if ($iter) TMP_Enumerable_to_set_43.$$p = null; + + + if ($iter) TMP_Enumerable_to_set_43.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + if ($post_args.length > 0) { + klass = $post_args[0]; + $post_args.splice(0, 1); + } + if (klass == null) { + klass = $$($nesting, 'Set'); + }; + + args = $post_args;; + return $send(klass, 'new', [self].concat(Opal.to_a(args)), block.$to_proc()); + }, TMP_Enumerable_to_set_43.$$arity = -1) + })($nesting[0], $nesting); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/js/opal_ext/file"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $send = Opal.send, $klass = Opal.klass, $truthy = Opal.truthy, $gvars = Opal.gvars; + + Opal.add_stubs(['$new', '$attr_reader', '$delete', '$gsub', '$read', '$size', '$to_enum', '$chomp', '$each_line', '$readlines', '$split']); + + (function($base, $parent_nesting) { + function $Kernel() {}; + var self = $Kernel = $module($base, 'Kernel', $Kernel); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Kernel_open_1; + + + Opal.def(self, '$open', TMP_Kernel_open_1 = function $$open(path, $a) { + var $post_args, rest, $iter = TMP_Kernel_open_1.$$p, $yield = $iter || nil, self = this, file = nil; + + if ($iter) TMP_Kernel_open_1.$$p = null; + + + $post_args = Opal.slice.call(arguments, 1, arguments.length); + + rest = $post_args;; + file = $send($$($nesting, 'File'), 'new', [path].concat(Opal.to_a(rest))); + if (($yield !== nil)) { + return Opal.yield1($yield, file); + } else { + return file + }; + }, TMP_Kernel_open_1.$$arity = -2) + })($nesting[0], $nesting); + (function($base, $super, $parent_nesting) { + function $File(){}; + var self = $File = $klass($base, $super, 'File', $File); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_File_initialize_2, TMP_File_read_3, TMP_File_each_line_4, TMP_File_readlines_5; + + def.eof = def.path = nil; + + self.$attr_reader("eof"); + self.$attr_reader("lineno"); + self.$attr_reader("path"); + + Opal.def(self, '$initialize', TMP_File_initialize_2 = function $$initialize(path, flags) { + var self = this, encoding_flag_regexp = nil; + + + + if (flags == null) { + flags = "r"; + }; + self.path = path; + self.contents = nil; + self.eof = false; + self.lineno = 0; + flags = flags.$delete("b"); + encoding_flag_regexp = /:(.*)/; + flags = flags.$gsub(encoding_flag_regexp, ""); + return (self.flags = flags); + }, TMP_File_initialize_2.$$arity = -2); + + Opal.def(self, '$read', TMP_File_read_3 = function $$read() { + var self = this, res = nil; + + if ($truthy(self.eof)) { + return "" + } else { + + res = $$($nesting, 'File').$read(self.path); + self.eof = true; + self.lineno = res.$size(); + return res; + } + }, TMP_File_read_3.$$arity = 0); + + Opal.def(self, '$each_line', TMP_File_each_line_4 = function $$each_line(separator) { + var $iter = TMP_File_each_line_4.$$p, block = $iter || nil, self = this, lines = nil; + if ($gvars["/"] == null) $gvars["/"] = nil; + + if ($iter) TMP_File_each_line_4.$$p = null; + + + if ($iter) TMP_File_each_line_4.$$p = null;; + + if (separator == null) { + separator = $gvars["/"]; + }; + if ($truthy(self.eof)) { + return (function() {if ((block !== nil)) { + return self + } else { + return [].$to_enum() + }; return nil; })()}; + if ((block !== nil)) { + + lines = $$($nesting, 'File').$read(self.path); + + self.eof = false; + self.lineno = 0; + var chomped = lines.$chomp(), + trailing = lines.length != chomped.length, + splitted = chomped.split(separator); + for (var i = 0, length = splitted.length; i < length; i++) { + self.lineno += 1; + if (i < length - 1 || trailing) { + Opal.yield1(block, splitted[i] + separator); + } + else { + Opal.yield1(block, splitted[i]); + } + } + self.eof = true; + ; + return self; + } else { + return self.$read().$each_line() + }; + }, TMP_File_each_line_4.$$arity = -1); + + Opal.def(self, '$readlines', TMP_File_readlines_5 = function $$readlines() { + var self = this; + + return $$($nesting, 'File').$readlines(self.path) + }, TMP_File_readlines_5.$$arity = 0); + return (function(self, $parent_nesting) { + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_readlines_6, TMP_file$q_7, TMP_readable$q_8, TMP_read_9; + + + + Opal.def(self, '$readlines', TMP_readlines_6 = function $$readlines(path, separator) { + var self = this, content = nil; + if ($gvars["/"] == null) $gvars["/"] = nil; + + + + if (separator == null) { + separator = $gvars["/"]; + }; + content = $$($nesting, 'File').$read(path); + return content.$split(separator); + }, TMP_readlines_6.$$arity = -2); + + Opal.def(self, '$file?', TMP_file$q_7 = function(path) { + var self = this; + + return true + }, TMP_file$q_7.$$arity = 1); + + Opal.def(self, '$readable?', TMP_readable$q_8 = function(path) { + var self = this; + + return true + }, TMP_readable$q_8.$$arity = 1); + return (Opal.def(self, '$read', TMP_read_9 = function $$read(path) { + var self = this; + + return "" + }, TMP_read_9.$$arity = 1), nil) && 'read'; + })(Opal.get_singleton_class(self), $nesting); + })($nesting[0], null, $nesting); + return (function($base, $super, $parent_nesting) { + function $IO(){}; + var self = $IO = $klass($base, $super, 'IO', $IO); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_IO_read_10; + + return (Opal.defs(self, '$read', TMP_IO_read_10 = function $$read(path) { + var self = this; + + return $$($nesting, 'File').$read(path) + }, TMP_IO_read_10.$$arity = 1), nil) && 'read' + })($nesting[0], null, $nesting); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/js/opal_ext/match_data"] = function(Opal) { + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $send = Opal.send; + + Opal.add_stubs(['$[]=', '$-']); + return (function($base, $super, $parent_nesting) { + function $MatchData(){}; + var self = $MatchData = $klass($base, $super, 'MatchData', $MatchData); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_MatchData_$$$eq_1; + + def.matches = nil; + return (Opal.def(self, '$[]=', TMP_MatchData_$$$eq_1 = function(idx, val) { + var self = this, $writer = nil; + + + $writer = [idx, val]; + $send(self.matches, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + }, TMP_MatchData_$$$eq_1.$$arity = 2), nil) && '[]=' + })($nesting[0], null, $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/js/opal_ext/kernel"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module; + + return (function($base, $parent_nesting) { + function $Kernel() {}; + var self = $Kernel = $module($base, 'Kernel', $Kernel); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Kernel_freeze_1; + + + Opal.def(self, '$freeze', TMP_Kernel_freeze_1 = function $$freeze() { + var self = this; + + return self + }, TMP_Kernel_freeze_1.$$arity = 0) + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/js/opal_ext/thread_safe"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass; + + return (function($base, $parent_nesting) { + function $ThreadSafe() {}; + var self = $ThreadSafe = $module($base, 'ThreadSafe', $ThreadSafe); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + (function($base, $super, $parent_nesting) { + function $Cache(){}; + var self = $Cache = $klass($base, $super, 'Cache', $Cache); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return nil + })($nesting[0], $$$('::', 'Hash'), $nesting) + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/js/opal_ext/string"] = function(Opal) { + function $rb_lt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $truthy = Opal.truthy, $send = Opal.send; + + Opal.add_stubs(['$method_defined?', '$<', '$length', '$bytes', '$to_s', '$byteslice', '$==', '$with_index', '$select', '$[]', '$even?', '$_original_unpack']); + return (function($base, $super, $parent_nesting) { + function $String(){}; + var self = $String = $klass($base, $super, 'String', $String); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_String_limit_bytesize_1, TMP_String_unpack_2; + + + if ($truthy(self['$method_defined?']("limit_bytesize"))) { + } else { + + Opal.def(self, '$limit_bytesize', TMP_String_limit_bytesize_1 = function $$limit_bytesize(size) { + var self = this, result = nil; + + + if ($truthy($rb_lt(size, self.$bytes().$length()))) { + } else { + return self.$to_s() + }; + result = self.$byteslice(0, size); + return result.$to_s(); + }, TMP_String_limit_bytesize_1.$$arity = 1) + }; + if ($truthy(self['$method_defined?']("limit"))) { + } else { + Opal.alias(self, "limit", "limit_bytesize") + }; + Opal.alias(self, "_original_unpack", "unpack"); + return (Opal.def(self, '$unpack', TMP_String_unpack_2 = function $$unpack(format) { + var TMP_3, self = this; + + if (format['$==']("C3")) { + return $send(self['$[]'](0, 3).$bytes().$select(), 'with_index', [], (TMP_3 = function(_, i){var self = TMP_3.$$s || this; + + + + if (_ == null) { + _ = nil; + }; + + if (i == null) { + i = nil; + }; + return i['$even?']();}, TMP_3.$$s = self, TMP_3.$$arity = 2, TMP_3)) + } else { + return self.$_original_unpack(format) + } + }, TMP_String_unpack_2.$$arity = 1), nil) && 'unpack'; + })($nesting[0], null, $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/js/opal_ext/uri"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module; + + Opal.add_stubs(['$extend']); + return (function($base, $parent_nesting) { + function $URI() {}; + var self = $URI = $module($base, 'URI', $URI); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_URI_parse_1, TMP_URI_path_2; + + + Opal.defs(self, '$parse', TMP_URI_parse_1 = function $$parse(str) { + var self = this; + + return str.$extend($$($nesting, 'URI')) + }, TMP_URI_parse_1.$$arity = 1); + + Opal.def(self, '$path', TMP_URI_path_2 = function $$path() { + var self = this; + + return self + }, TMP_URI_path_2.$$arity = 0); + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/js/opal_ext"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice; + + Opal.add_stubs(['$require']); + + self.$require("asciidoctor/js/opal_ext/file"); + self.$require("asciidoctor/js/opal_ext/match_data"); + self.$require("asciidoctor/js/opal_ext/kernel"); + self.$require("asciidoctor/js/opal_ext/thread_safe"); + self.$require("asciidoctor/js/opal_ext/string"); + self.$require("asciidoctor/js/opal_ext/uri"); + +// Load specific implementation +self.$require("asciidoctor/js/opal_ext/graalvm"); +; +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/js/rx"] = function(Opal) { + function $rb_plus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $send = Opal.send, $gvars = Opal.gvars, $truthy = Opal.truthy; + + Opal.add_stubs(['$gsub', '$+', '$unpack_hex_range']); + return (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Asciidoctor_unpack_hex_range_1; + + + Opal.const_set($nesting[0], 'HEX_RANGE_RX', /([A-F0-9]{4})(?:-([A-F0-9]{4}))?/); + Opal.defs(self, '$unpack_hex_range', TMP_Asciidoctor_unpack_hex_range_1 = function $$unpack_hex_range(str) { + var TMP_2, self = this; + + return $send(str, 'gsub', [$$($nesting, 'HEX_RANGE_RX')], (TMP_2 = function(){var self = TMP_2.$$s || this, $a, $b; + + return "" + "\\u" + ((($a = $gvars['~']) === nil ? nil : $a['$[]'](1))) + (($truthy($a = (($b = $gvars['~']) === nil ? nil : $b['$[]'](2))) ? "" + "-\\u" + ((($b = $gvars['~']) === nil ? nil : $b['$[]'](2))) : $a))}, TMP_2.$$s = self, TMP_2.$$arity = 0, TMP_2)) + }, TMP_Asciidoctor_unpack_hex_range_1.$$arity = 1); + Opal.const_set($nesting[0], 'P_L', $rb_plus("A-Za-z", self.$unpack_hex_range("00AA00B500BA00C0-00D600D8-00F600F8-02C102C6-02D102E0-02E402EC02EE0370-037403760377037A-037D037F03860388-038A038C038E-03A103A3-03F503F7-0481048A-052F0531-055605590561-058705D0-05EA05F0-05F20620-064A066E066F0671-06D306D506E506E606EE06EF06FA-06FC06FF07100712-072F074D-07A507B107CA-07EA07F407F507FA0800-0815081A082408280840-085808A0-08B20904-0939093D09500958-09610971-09800985-098C098F09900993-09A809AA-09B009B209B6-09B909BD09CE09DC09DD09DF-09E109F009F10A05-0A0A0A0F0A100A13-0A280A2A-0A300A320A330A350A360A380A390A59-0A5C0A5E0A72-0A740A85-0A8D0A8F-0A910A93-0AA80AAA-0AB00AB20AB30AB5-0AB90ABD0AD00AE00AE10B05-0B0C0B0F0B100B13-0B280B2A-0B300B320B330B35-0B390B3D0B5C0B5D0B5F-0B610B710B830B85-0B8A0B8E-0B900B92-0B950B990B9A0B9C0B9E0B9F0BA30BA40BA8-0BAA0BAE-0BB90BD00C05-0C0C0C0E-0C100C12-0C280C2A-0C390C3D0C580C590C600C610C85-0C8C0C8E-0C900C92-0CA80CAA-0CB30CB5-0CB90CBD0CDE0CE00CE10CF10CF20D05-0D0C0D0E-0D100D12-0D3A0D3D0D4E0D600D610D7A-0D7F0D85-0D960D9A-0DB10DB3-0DBB0DBD0DC0-0DC60E01-0E300E320E330E40-0E460E810E820E840E870E880E8A0E8D0E94-0E970E99-0E9F0EA1-0EA30EA50EA70EAA0EAB0EAD-0EB00EB20EB30EBD0EC0-0EC40EC60EDC-0EDF0F000F40-0F470F49-0F6C0F88-0F8C1000-102A103F1050-1055105A-105D106110651066106E-10701075-1081108E10A0-10C510C710CD10D0-10FA10FC-1248124A-124D1250-12561258125A-125D1260-1288128A-128D1290-12B012B2-12B512B8-12BE12C012C2-12C512C8-12D612D8-13101312-13151318-135A1380-138F13A0-13F41401-166C166F-167F1681-169A16A0-16EA16F1-16F81700-170C170E-17111720-17311740-17511760-176C176E-17701780-17B317D717DC1820-18771880-18A818AA18B0-18F51900-191E1950-196D1970-19741980-19AB19C1-19C71A00-1A161A20-1A541AA71B05-1B331B45-1B4B1B83-1BA01BAE1BAF1BBA-1BE51C00-1C231C4D-1C4F1C5A-1C7D1CE9-1CEC1CEE-1CF11CF51CF61D00-1DBF1E00-1F151F18-1F1D1F20-1F451F48-1F4D1F50-1F571F591F5B1F5D1F5F-1F7D1F80-1FB41FB6-1FBC1FBE1FC2-1FC41FC6-1FCC1FD0-1FD31FD6-1FDB1FE0-1FEC1FF2-1FF41FF6-1FFC2071207F2090-209C21022107210A-211321152119-211D212421262128212A-212D212F-2139213C-213F2145-2149214E218321842C00-2C2E2C30-2C5E2C60-2CE42CEB-2CEE2CF22CF32D00-2D252D272D2D2D30-2D672D6F2D80-2D962DA0-2DA62DA8-2DAE2DB0-2DB62DB8-2DBE2DC0-2DC62DC8-2DCE2DD0-2DD62DD8-2DDE2E2F300530063031-3035303B303C3041-3096309D-309F30A1-30FA30FC-30FF3105-312D3131-318E31A0-31BA31F0-31FF3400-4DB54E00-9FCCA000-A48CA4D0-A4FDA500-A60CA610-A61FA62AA62BA640-A66EA67F-A69DA6A0-A6E5A717-A71FA722-A788A78B-A78EA790-A7ADA7B0A7B1A7F7-A801A803-A805A807-A80AA80C-A822A840-A873A882-A8B3A8F2-A8F7A8FBA90A-A925A930-A946A960-A97CA984-A9B2A9CFA9E0-A9E4A9E6-A9EFA9FA-A9FEAA00-AA28AA40-AA42AA44-AA4BAA60-AA76AA7AAA7E-AAAFAAB1AAB5AAB6AAB9-AABDAAC0AAC2AADB-AADDAAE0-AAEAAAF2-AAF4AB01-AB06AB09-AB0EAB11-AB16AB20-AB26AB28-AB2EAB30-AB5AAB5C-AB5FAB64AB65ABC0-ABE2AC00-D7A3D7B0-D7C6D7CB-D7FBF900-FA6DFA70-FAD9FB00-FB06FB13-FB17FB1DFB1F-FB28FB2A-FB36FB38-FB3CFB3EFB40FB41FB43FB44FB46-FBB1FBD3-FD3DFD50-FD8FFD92-FDC7FDF0-FDFBFE70-FE74FE76-FEFCFF21-FF3AFF41-FF5AFF66-FFBEFFC2-FFC7FFCA-FFCFFFD2-FFD7FFDA-FFDC"))); + Opal.const_set($nesting[0], 'P_Nl', self.$unpack_hex_range("16EE-16F02160-21822185-218830073021-30293038-303AA6E6-A6EF")); + Opal.const_set($nesting[0], 'P_Nd', $rb_plus("0-9", self.$unpack_hex_range("0660-066906F0-06F907C0-07C90966-096F09E6-09EF0A66-0A6F0AE6-0AEF0B66-0B6F0BE6-0BEF0C66-0C6F0CE6-0CEF0D66-0D6F0DE6-0DEF0E50-0E590ED0-0ED90F20-0F291040-10491090-109917E0-17E91810-18191946-194F19D0-19D91A80-1A891A90-1A991B50-1B591BB0-1BB91C40-1C491C50-1C59A620-A629A8D0-A8D9A900-A909A9D0-A9D9A9F0-A9F9AA50-AA59ABF0-ABF9FF10-FF19"))); + Opal.const_set($nesting[0], 'P_Pc', self.$unpack_hex_range("005F203F20402054FE33FE34FE4D-FE4FFF3F")); + Opal.const_set($nesting[0], 'CC_ALPHA', "" + ($$($nesting, 'P_L')) + ($$($nesting, 'P_Nl'))); + Opal.const_set($nesting[0], 'CG_ALPHA', "" + "[" + ($$($nesting, 'CC_ALPHA')) + "]"); + Opal.const_set($nesting[0], 'CC_ALNUM', "" + ($$($nesting, 'CC_ALPHA')) + ($$($nesting, 'P_Nd'))); + Opal.const_set($nesting[0], 'CG_ALNUM', "" + "[" + ($$($nesting, 'CC_ALNUM')) + "]"); + Opal.const_set($nesting[0], 'CC_WORD', "" + ($$($nesting, 'CC_ALNUM')) + ($$($nesting, 'P_Pc'))); + Opal.const_set($nesting[0], 'CG_WORD', "" + "[" + ($$($nesting, 'CC_WORD')) + "]"); + Opal.const_set($nesting[0], 'CG_BLANK', "[ \\t]"); + Opal.const_set($nesting[0], 'CC_EOL', "(?=\\n|$)"); + Opal.const_set($nesting[0], 'CG_GRAPH', "[^\\s\\x00-\\x1F\\x7F]"); + Opal.const_set($nesting[0], 'CC_ALL', "[\\s\\S]"); + Opal.const_set($nesting[0], 'CC_ANY', "[^\\n]"); + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["strscan"] = function(Opal) { + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $send = Opal.send; + + Opal.add_stubs(['$attr_reader', '$anchor', '$scan_until', '$length', '$size', '$rest', '$pos=', '$-', '$private']); + return (function($base, $super, $parent_nesting) { + function $StringScanner(){}; + var self = $StringScanner = $klass($base, $super, 'StringScanner', $StringScanner); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_StringScanner_initialize_1, TMP_StringScanner_beginning_of_line$q_2, TMP_StringScanner_scan_3, TMP_StringScanner_scan_until_4, TMP_StringScanner_$$_5, TMP_StringScanner_check_6, TMP_StringScanner_check_until_7, TMP_StringScanner_peek_8, TMP_StringScanner_eos$q_9, TMP_StringScanner_exist$q_10, TMP_StringScanner_skip_11, TMP_StringScanner_skip_until_12, TMP_StringScanner_get_byte_13, TMP_StringScanner_match$q_14, TMP_StringScanner_pos$eq_15, TMP_StringScanner_matched_size_16, TMP_StringScanner_post_match_17, TMP_StringScanner_pre_match_18, TMP_StringScanner_reset_19, TMP_StringScanner_rest_20, TMP_StringScanner_rest$q_21, TMP_StringScanner_rest_size_22, TMP_StringScanner_terminate_23, TMP_StringScanner_unscan_24, TMP_StringScanner_anchor_25; + + def.pos = def.string = def.working = def.matched = def.prev_pos = def.match = nil; + + self.$attr_reader("pos"); + self.$attr_reader("matched"); + + Opal.def(self, '$initialize', TMP_StringScanner_initialize_1 = function $$initialize(string) { + var self = this; + + + self.string = string; + self.pos = 0; + self.matched = nil; + self.working = string; + return (self.match = []); + }, TMP_StringScanner_initialize_1.$$arity = 1); + self.$attr_reader("string"); + + Opal.def(self, '$beginning_of_line?', TMP_StringScanner_beginning_of_line$q_2 = function() { + var self = this; + + return self.pos === 0 || self.string.charAt(self.pos - 1) === "\n" + }, TMP_StringScanner_beginning_of_line$q_2.$$arity = 0); + Opal.alias(self, "bol?", "beginning_of_line?"); + + Opal.def(self, '$scan', TMP_StringScanner_scan_3 = function $$scan(pattern) { + var self = this; + + + pattern = self.$anchor(pattern); + + var result = pattern.exec(self.working); + + if (result == null) { + return self.matched = nil; + } + else if (typeof(result) === 'object') { + self.prev_pos = self.pos; + self.pos += result[0].length; + self.working = self.working.substring(result[0].length); + self.matched = result[0]; + self.match = result; + + return result[0]; + } + else if (typeof(result) === 'string') { + self.pos += result.length; + self.working = self.working.substring(result.length); + + return result; + } + else { + return nil; + } + ; + }, TMP_StringScanner_scan_3.$$arity = 1); + + Opal.def(self, '$scan_until', TMP_StringScanner_scan_until_4 = function $$scan_until(pattern) { + var self = this; + + + pattern = self.$anchor(pattern); + + var pos = self.pos, + working = self.working, + result; + + while (true) { + result = pattern.exec(working); + pos += 1; + working = working.substr(1); + + if (result == null) { + if (working.length === 0) { + return self.matched = nil; + } + + continue; + } + + self.matched = self.string.substr(self.pos, pos - self.pos - 1 + result[0].length); + self.prev_pos = pos - 1; + self.pos = pos; + self.working = working.substr(result[0].length); + + return self.matched; + } + ; + }, TMP_StringScanner_scan_until_4.$$arity = 1); + + Opal.def(self, '$[]', TMP_StringScanner_$$_5 = function(idx) { + var self = this; + + + var match = self.match; + + if (idx < 0) { + idx += match.length; + } + + if (idx < 0 || idx >= match.length) { + return nil; + } + + if (match[idx] == null) { + return nil; + } + + return match[idx]; + + }, TMP_StringScanner_$$_5.$$arity = 1); + + Opal.def(self, '$check', TMP_StringScanner_check_6 = function $$check(pattern) { + var self = this; + + + pattern = self.$anchor(pattern); + + var result = pattern.exec(self.working); + + if (result == null) { + return self.matched = nil; + } + + return self.matched = result[0]; + ; + }, TMP_StringScanner_check_6.$$arity = 1); + + Opal.def(self, '$check_until', TMP_StringScanner_check_until_7 = function $$check_until(pattern) { + var self = this; + + + var prev_pos = self.prev_pos, + pos = self.pos; + + var result = self.$scan_until(pattern); + + if (result !== nil) { + self.matched = result.substr(-1); + self.working = self.string.substr(pos); + } + + self.prev_pos = prev_pos; + self.pos = pos; + + return result; + + }, TMP_StringScanner_check_until_7.$$arity = 1); + + Opal.def(self, '$peek', TMP_StringScanner_peek_8 = function $$peek(length) { + var self = this; + + return self.working.substring(0, length) + }, TMP_StringScanner_peek_8.$$arity = 1); + + Opal.def(self, '$eos?', TMP_StringScanner_eos$q_9 = function() { + var self = this; + + return self.working.length === 0 + }, TMP_StringScanner_eos$q_9.$$arity = 0); + + Opal.def(self, '$exist?', TMP_StringScanner_exist$q_10 = function(pattern) { + var self = this; + + + var result = pattern.exec(self.working); + + if (result == null) { + return nil; + } + else if (result.index == 0) { + return 0; + } + else { + return result.index + 1; + } + + }, TMP_StringScanner_exist$q_10.$$arity = 1); + + Opal.def(self, '$skip', TMP_StringScanner_skip_11 = function $$skip(pattern) { + var self = this; + + + pattern = self.$anchor(pattern); + + var result = pattern.exec(self.working); + + if (result == null) { + return self.matched = nil; + } + else { + var match_str = result[0]; + var match_len = match_str.length; + + self.matched = match_str; + self.prev_pos = self.pos; + self.pos += match_len; + self.working = self.working.substring(match_len); + + return match_len; + } + ; + }, TMP_StringScanner_skip_11.$$arity = 1); + + Opal.def(self, '$skip_until', TMP_StringScanner_skip_until_12 = function $$skip_until(pattern) { + var self = this; + + + var result = self.$scan_until(pattern); + + if (result === nil) { + return nil; + } + else { + self.matched = result.substr(-1); + + return result.length; + } + + }, TMP_StringScanner_skip_until_12.$$arity = 1); + + Opal.def(self, '$get_byte', TMP_StringScanner_get_byte_13 = function $$get_byte() { + var self = this; + + + var result = nil; + + if (self.pos < self.string.length) { + self.prev_pos = self.pos; + self.pos += 1; + result = self.matched = self.working.substring(0, 1); + self.working = self.working.substring(1); + } + else { + self.matched = nil; + } + + return result; + + }, TMP_StringScanner_get_byte_13.$$arity = 0); + Opal.alias(self, "getch", "get_byte"); + + Opal.def(self, '$match?', TMP_StringScanner_match$q_14 = function(pattern) { + var self = this; + + + pattern = self.$anchor(pattern); + + var result = pattern.exec(self.working); + + if (result == null) { + return nil; + } + else { + self.prev_pos = self.pos; + + return result[0].length; + } + ; + }, TMP_StringScanner_match$q_14.$$arity = 1); + + Opal.def(self, '$pos=', TMP_StringScanner_pos$eq_15 = function(pos) { + var self = this; + + + + if (pos < 0) { + pos += self.string.$length(); + } + ; + self.pos = pos; + return (self.working = self.string.slice(pos)); + }, TMP_StringScanner_pos$eq_15.$$arity = 1); + + Opal.def(self, '$matched_size', TMP_StringScanner_matched_size_16 = function $$matched_size() { + var self = this; + + + if (self.matched === nil) { + return nil; + } + + return self.matched.length + + }, TMP_StringScanner_matched_size_16.$$arity = 0); + + Opal.def(self, '$post_match', TMP_StringScanner_post_match_17 = function $$post_match() { + var self = this; + + + if (self.matched === nil) { + return nil; + } + + return self.string.substr(self.pos); + + }, TMP_StringScanner_post_match_17.$$arity = 0); + + Opal.def(self, '$pre_match', TMP_StringScanner_pre_match_18 = function $$pre_match() { + var self = this; + + + if (self.matched === nil) { + return nil; + } + + return self.string.substr(0, self.prev_pos); + + }, TMP_StringScanner_pre_match_18.$$arity = 0); + + Opal.def(self, '$reset', TMP_StringScanner_reset_19 = function $$reset() { + var self = this; + + + self.working = self.string; + self.matched = nil; + return (self.pos = 0); + }, TMP_StringScanner_reset_19.$$arity = 0); + + Opal.def(self, '$rest', TMP_StringScanner_rest_20 = function $$rest() { + var self = this; + + return self.working + }, TMP_StringScanner_rest_20.$$arity = 0); + + Opal.def(self, '$rest?', TMP_StringScanner_rest$q_21 = function() { + var self = this; + + return self.working.length !== 0 + }, TMP_StringScanner_rest$q_21.$$arity = 0); + + Opal.def(self, '$rest_size', TMP_StringScanner_rest_size_22 = function $$rest_size() { + var self = this; + + return self.$rest().$size() + }, TMP_StringScanner_rest_size_22.$$arity = 0); + + Opal.def(self, '$terminate', TMP_StringScanner_terminate_23 = function $$terminate() { + var self = this, $writer = nil; + + + self.match = nil; + + $writer = [self.string.$length()]; + $send(self, 'pos=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];; + }, TMP_StringScanner_terminate_23.$$arity = 0); + + Opal.def(self, '$unscan', TMP_StringScanner_unscan_24 = function $$unscan() { + var self = this; + + + self.pos = self.prev_pos; + self.prev_pos = nil; + self.match = nil; + return self; + }, TMP_StringScanner_unscan_24.$$arity = 0); + self.$private(); + return (Opal.def(self, '$anchor', TMP_StringScanner_anchor_25 = function $$anchor(pattern) { + var self = this; + + + var flags = pattern.toString().match(/\/([^\/]+)$/); + flags = flags ? flags[1] : undefined; + return new RegExp('^(?:' + pattern.source + ')', flags); + + }, TMP_StringScanner_anchor_25.$$arity = 1), nil) && 'anchor'; + })($nesting[0], null, $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/js"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice; + + Opal.add_stubs(['$require']); + + self.$require("asciidoctor/js/opal_ext"); + self.$require("asciidoctor/js/rx"); + return self.$require("strscan"); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["logger"] = function(Opal) { + function $rb_plus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); + } + function $rb_le(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs <= rhs : lhs['$<='](rhs); + } + function $rb_lt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $module = Opal.module, $send = Opal.send, $truthy = Opal.truthy; + + Opal.add_stubs(['$include', '$to_h', '$map', '$constants', '$const_get', '$to_s', '$format', '$chr', '$strftime', '$message_as_string', '$===', '$+', '$message', '$class', '$join', '$backtrace', '$inspect', '$attr_reader', '$attr_accessor', '$new', '$key', '$upcase', '$raise', '$add', '$to_proc', '$<=', '$<', '$write', '$call', '$[]', '$now']); + return (function($base, $super, $parent_nesting) { + function $Logger(){}; + var self = $Logger = $klass($base, $super, 'Logger', $Logger); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Logger_1, TMP_Logger_initialize_4, TMP_Logger_level$eq_5, TMP_Logger_info_6, TMP_Logger_debug_7, TMP_Logger_warn_8, TMP_Logger_error_9, TMP_Logger_fatal_10, TMP_Logger_unknown_11, TMP_Logger_info$q_12, TMP_Logger_debug$q_13, TMP_Logger_warn$q_14, TMP_Logger_error$q_15, TMP_Logger_fatal$q_16, TMP_Logger_add_17; + + def.level = def.progname = def.pipe = def.formatter = nil; + + (function($base, $parent_nesting) { + function $Severity() {}; + var self = $Severity = $module($base, 'Severity', $Severity); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + + Opal.const_set($nesting[0], 'DEBUG', 0); + Opal.const_set($nesting[0], 'INFO', 1); + Opal.const_set($nesting[0], 'WARN', 2); + Opal.const_set($nesting[0], 'ERROR', 3); + Opal.const_set($nesting[0], 'FATAL', 4); + Opal.const_set($nesting[0], 'UNKNOWN', 5); + })($nesting[0], $nesting); + self.$include($$($nesting, 'Severity')); + Opal.const_set($nesting[0], 'SEVERITY_LABELS', $send($$($nesting, 'Severity').$constants(), 'map', [], (TMP_Logger_1 = function(s){var self = TMP_Logger_1.$$s || this; + + + + if (s == null) { + s = nil; + }; + return [$$($nesting, 'Severity').$const_get(s), s.$to_s()];}, TMP_Logger_1.$$s = self, TMP_Logger_1.$$arity = 1, TMP_Logger_1)).$to_h()); + (function($base, $super, $parent_nesting) { + function $Formatter(){}; + var self = $Formatter = $klass($base, $super, 'Formatter', $Formatter); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Formatter_call_2, TMP_Formatter_message_as_string_3; + + + Opal.const_set($nesting[0], 'MESSAGE_FORMAT', "%s, [%s] %5s -- %s: %s\n"); + Opal.const_set($nesting[0], 'DATE_TIME_FORMAT', "%Y-%m-%dT%H:%M:%S.%6N"); + + Opal.def(self, '$call', TMP_Formatter_call_2 = function $$call(severity, time, progname, msg) { + var self = this; + + return self.$format($$($nesting, 'MESSAGE_FORMAT'), severity.$chr(), time.$strftime($$($nesting, 'DATE_TIME_FORMAT')), severity, progname, self.$message_as_string(msg)) + }, TMP_Formatter_call_2.$$arity = 4); + return (Opal.def(self, '$message_as_string', TMP_Formatter_message_as_string_3 = function $$message_as_string(msg) { + var $a, self = this, $case = nil; + + return (function() {$case = msg; + if ($$$('::', 'String')['$===']($case)) {return msg} + else if ($$$('::', 'Exception')['$===']($case)) {return $rb_plus("" + (msg.$message()) + " (" + (msg.$class()) + ")\n", ($truthy($a = msg.$backtrace()) ? $a : []).$join("\n"))} + else {return msg.$inspect()}})() + }, TMP_Formatter_message_as_string_3.$$arity = 1), nil) && 'message_as_string'; + })($nesting[0], null, $nesting); + self.$attr_reader("level"); + self.$attr_accessor("progname"); + self.$attr_accessor("formatter"); + + Opal.def(self, '$initialize', TMP_Logger_initialize_4 = function $$initialize(pipe) { + var self = this; + + + self.pipe = pipe; + self.level = $$($nesting, 'DEBUG'); + return (self.formatter = $$($nesting, 'Formatter').$new()); + }, TMP_Logger_initialize_4.$$arity = 1); + + Opal.def(self, '$level=', TMP_Logger_level$eq_5 = function(severity) { + var self = this, level = nil; + + if ($truthy($$$('::', 'Integer')['$==='](severity))) { + return (self.level = severity) + } else if ($truthy((level = $$($nesting, 'SEVERITY_LABELS').$key(severity.$to_s().$upcase())))) { + return (self.level = level) + } else { + return self.$raise($$($nesting, 'ArgumentError'), "" + "invalid log level: " + (severity)) + } + }, TMP_Logger_level$eq_5.$$arity = 1); + + Opal.def(self, '$info', TMP_Logger_info_6 = function $$info(progname) { + var $iter = TMP_Logger_info_6.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Logger_info_6.$$p = null; + + + if ($iter) TMP_Logger_info_6.$$p = null;; + + if (progname == null) { + progname = nil; + }; + return $send(self, 'add', [$$($nesting, 'INFO'), nil, progname], block.$to_proc()); + }, TMP_Logger_info_6.$$arity = -1); + + Opal.def(self, '$debug', TMP_Logger_debug_7 = function $$debug(progname) { + var $iter = TMP_Logger_debug_7.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Logger_debug_7.$$p = null; + + + if ($iter) TMP_Logger_debug_7.$$p = null;; + + if (progname == null) { + progname = nil; + }; + return $send(self, 'add', [$$($nesting, 'DEBUG'), nil, progname], block.$to_proc()); + }, TMP_Logger_debug_7.$$arity = -1); + + Opal.def(self, '$warn', TMP_Logger_warn_8 = function $$warn(progname) { + var $iter = TMP_Logger_warn_8.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Logger_warn_8.$$p = null; + + + if ($iter) TMP_Logger_warn_8.$$p = null;; + + if (progname == null) { + progname = nil; + }; + return $send(self, 'add', [$$($nesting, 'WARN'), nil, progname], block.$to_proc()); + }, TMP_Logger_warn_8.$$arity = -1); + + Opal.def(self, '$error', TMP_Logger_error_9 = function $$error(progname) { + var $iter = TMP_Logger_error_9.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Logger_error_9.$$p = null; + + + if ($iter) TMP_Logger_error_9.$$p = null;; + + if (progname == null) { + progname = nil; + }; + return $send(self, 'add', [$$($nesting, 'ERROR'), nil, progname], block.$to_proc()); + }, TMP_Logger_error_9.$$arity = -1); + + Opal.def(self, '$fatal', TMP_Logger_fatal_10 = function $$fatal(progname) { + var $iter = TMP_Logger_fatal_10.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Logger_fatal_10.$$p = null; + + + if ($iter) TMP_Logger_fatal_10.$$p = null;; + + if (progname == null) { + progname = nil; + }; + return $send(self, 'add', [$$($nesting, 'FATAL'), nil, progname], block.$to_proc()); + }, TMP_Logger_fatal_10.$$arity = -1); + + Opal.def(self, '$unknown', TMP_Logger_unknown_11 = function $$unknown(progname) { + var $iter = TMP_Logger_unknown_11.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Logger_unknown_11.$$p = null; + + + if ($iter) TMP_Logger_unknown_11.$$p = null;; + + if (progname == null) { + progname = nil; + }; + return $send(self, 'add', [$$($nesting, 'UNKNOWN'), nil, progname], block.$to_proc()); + }, TMP_Logger_unknown_11.$$arity = -1); + + Opal.def(self, '$info?', TMP_Logger_info$q_12 = function() { + var self = this; + + return $rb_le(self.level, $$($nesting, 'INFO')) + }, TMP_Logger_info$q_12.$$arity = 0); + + Opal.def(self, '$debug?', TMP_Logger_debug$q_13 = function() { + var self = this; + + return $rb_le(self.level, $$($nesting, 'DEBUG')) + }, TMP_Logger_debug$q_13.$$arity = 0); + + Opal.def(self, '$warn?', TMP_Logger_warn$q_14 = function() { + var self = this; + + return $rb_le(self.level, $$($nesting, 'WARN')) + }, TMP_Logger_warn$q_14.$$arity = 0); + + Opal.def(self, '$error?', TMP_Logger_error$q_15 = function() { + var self = this; + + return $rb_le(self.level, $$($nesting, 'ERROR')) + }, TMP_Logger_error$q_15.$$arity = 0); + + Opal.def(self, '$fatal?', TMP_Logger_fatal$q_16 = function() { + var self = this; + + return $rb_le(self.level, $$($nesting, 'FATAL')) + }, TMP_Logger_fatal$q_16.$$arity = 0); + return (Opal.def(self, '$add', TMP_Logger_add_17 = function $$add(severity, message, progname) { + var $iter = TMP_Logger_add_17.$$p, block = $iter || nil, $a, self = this; + + if ($iter) TMP_Logger_add_17.$$p = null; + + + if ($iter) TMP_Logger_add_17.$$p = null;; + + if (message == null) { + message = nil; + }; + + if (progname == null) { + progname = nil; + }; + if ($truthy($rb_lt((severity = ($truthy($a = severity) ? $a : $$($nesting, 'UNKNOWN'))), self.level))) { + return true}; + progname = ($truthy($a = progname) ? $a : self.progname); + if ($truthy(message)) { + } else if ((block !== nil)) { + message = Opal.yieldX(block, []) + } else { + + message = progname; + progname = self.progname; + }; + self.pipe.$write(self.formatter.$call(($truthy($a = $$($nesting, 'SEVERITY_LABELS')['$[]'](severity)) ? $a : "ANY"), $$$('::', 'Time').$now(), progname, message)); + return true; + }, TMP_Logger_add_17.$$arity = -2), nil) && 'add'; + })($nesting[0], null, $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/logging"] = function(Opal) { + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + function $rb_gt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $send = Opal.send, $truthy = Opal.truthy, $hash2 = Opal.hash2, $gvars = Opal.gvars; + + Opal.add_stubs(['$require', '$attr_reader', '$progname=', '$-', '$new', '$formatter=', '$level=', '$>', '$[]', '$===', '$inspect', '$map', '$constants', '$const_get', '$to_sym', '$<<', '$clear', '$empty?', '$max', '$attr_accessor', '$memoize_logger', '$private', '$alias_method', '$==', '$define_method', '$extend', '$logger', '$merge']); + + self.$require("logger"); + return (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + + (function($base, $super, $parent_nesting) { + function $Logger(){}; + var self = $Logger = $klass($base, $super, 'Logger', $Logger); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Logger_initialize_1, TMP_Logger_add_2; + + def.max_severity = nil; + + self.$attr_reader("max_severity"); + + Opal.def(self, '$initialize', TMP_Logger_initialize_1 = function $$initialize($a) { + var $post_args, args, $iter = TMP_Logger_initialize_1.$$p, $yield = $iter || nil, self = this, $writer = nil, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_Logger_initialize_1.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + $send(self, Opal.find_super_dispatcher(self, 'initialize', TMP_Logger_initialize_1, false), $zuper, $iter); + + $writer = ["asciidoctor"]; + $send(self, 'progname=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = [$$($nesting, 'BasicFormatter').$new()]; + $send(self, 'formatter=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = [$$($nesting, 'WARN')]; + $send(self, 'level=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];; + }, TMP_Logger_initialize_1.$$arity = -1); + + Opal.def(self, '$add', TMP_Logger_add_2 = function $$add(severity, message, progname) { + var $a, $iter = TMP_Logger_add_2.$$p, $yield = $iter || nil, self = this, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_Logger_add_2.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + + + if (message == null) { + message = nil; + }; + + if (progname == null) { + progname = nil; + }; + if ($truthy($rb_gt((severity = ($truthy($a = severity) ? $a : $$($nesting, 'UNKNOWN'))), (self.max_severity = ($truthy($a = self.max_severity) ? $a : severity))))) { + self.max_severity = severity}; + return $send(self, Opal.find_super_dispatcher(self, 'add', TMP_Logger_add_2, false), $zuper, $iter); + }, TMP_Logger_add_2.$$arity = -2); + (function($base, $super, $parent_nesting) { + function $BasicFormatter(){}; + var self = $BasicFormatter = $klass($base, $super, 'BasicFormatter', $BasicFormatter); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_BasicFormatter_call_3; + + + Opal.const_set($nesting[0], 'SEVERITY_LABELS', $hash2(["WARN", "FATAL"], {"WARN": "WARNING", "FATAL": "FAILED"})); + return (Opal.def(self, '$call', TMP_BasicFormatter_call_3 = function $$call(severity, _, progname, msg) { + var $a, self = this; + + return "" + (progname) + ": " + (($truthy($a = $$($nesting, 'SEVERITY_LABELS')['$[]'](severity)) ? $a : severity)) + ": " + ((function() {if ($truthy($$$('::', 'String')['$==='](msg))) { + return msg + } else { + return msg.$inspect() + }; return nil; })()) + "\n" + }, TMP_BasicFormatter_call_3.$$arity = 4), nil) && 'call'; + })($nesting[0], $$($nesting, 'Formatter'), $nesting); + return (function($base, $parent_nesting) { + function $AutoFormattingMessage() {}; + var self = $AutoFormattingMessage = $module($base, 'AutoFormattingMessage', $AutoFormattingMessage); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_AutoFormattingMessage_inspect_4; + + + Opal.def(self, '$inspect', TMP_AutoFormattingMessage_inspect_4 = function $$inspect() { + var self = this, sloc = nil; + + if ($truthy((sloc = self['$[]']("source_location")))) { + return "" + (sloc) + ": " + (self['$[]']("text")) + } else { + return self['$[]']("text") + } + }, TMP_AutoFormattingMessage_inspect_4.$$arity = 0) + })($nesting[0], $nesting); + })($nesting[0], $$$('::', 'Logger'), $nesting); + (function($base, $super, $parent_nesting) { + function $MemoryLogger(){}; + var self = $MemoryLogger = $klass($base, $super, 'MemoryLogger', $MemoryLogger); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_MemoryLogger_5, TMP_MemoryLogger_initialize_6, TMP_MemoryLogger_add_7, TMP_MemoryLogger_clear_8, TMP_MemoryLogger_empty$q_9, TMP_MemoryLogger_max_severity_10; + + def.messages = nil; + + Opal.const_set($nesting[0], 'SEVERITY_LABELS', $$$('::', 'Hash')['$[]']($send($$($nesting, 'Severity').$constants(), 'map', [], (TMP_MemoryLogger_5 = function(c){var self = TMP_MemoryLogger_5.$$s || this; + + + + if (c == null) { + c = nil; + }; + return [$$($nesting, 'Severity').$const_get(c), c.$to_sym()];}, TMP_MemoryLogger_5.$$s = self, TMP_MemoryLogger_5.$$arity = 1, TMP_MemoryLogger_5)))); + self.$attr_reader("messages"); + + Opal.def(self, '$initialize', TMP_MemoryLogger_initialize_6 = function $$initialize() { + var self = this, $writer = nil; + + + + $writer = [$$($nesting, 'WARN')]; + $send(self, 'level=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + return (self.messages = []); + }, TMP_MemoryLogger_initialize_6.$$arity = 0); + + Opal.def(self, '$add', TMP_MemoryLogger_add_7 = function $$add(severity, message, progname) { + var $a, $iter = TMP_MemoryLogger_add_7.$$p, $yield = $iter || nil, self = this; + + if ($iter) TMP_MemoryLogger_add_7.$$p = null; + + + if (message == null) { + message = nil; + }; + + if (progname == null) { + progname = nil; + }; + if ($truthy(message)) { + } else { + message = (function() {if (($yield !== nil)) { + return Opal.yieldX($yield, []); + } else { + return progname + }; return nil; })() + }; + self.messages['$<<']($hash2(["severity", "message"], {"severity": $$($nesting, 'SEVERITY_LABELS')['$[]'](($truthy($a = severity) ? $a : $$($nesting, 'UNKNOWN'))), "message": message})); + return true; + }, TMP_MemoryLogger_add_7.$$arity = -2); + + Opal.def(self, '$clear', TMP_MemoryLogger_clear_8 = function $$clear() { + var self = this; + + return self.messages.$clear() + }, TMP_MemoryLogger_clear_8.$$arity = 0); + + Opal.def(self, '$empty?', TMP_MemoryLogger_empty$q_9 = function() { + var self = this; + + return self.messages['$empty?']() + }, TMP_MemoryLogger_empty$q_9.$$arity = 0); + return (Opal.def(self, '$max_severity', TMP_MemoryLogger_max_severity_10 = function $$max_severity() { + var TMP_11, self = this; + + if ($truthy(self['$empty?']())) { + return nil + } else { + return $send(self.messages, 'map', [], (TMP_11 = function(m){var self = TMP_11.$$s || this; + + + + if (m == null) { + m = nil; + }; + return $$($nesting, 'Severity').$const_get(m['$[]']("severity"));}, TMP_11.$$s = self, TMP_11.$$arity = 1, TMP_11)).$max() + } + }, TMP_MemoryLogger_max_severity_10.$$arity = 0), nil) && 'max_severity'; + })($nesting[0], $$$('::', 'Logger'), $nesting); + (function($base, $super, $parent_nesting) { + function $NullLogger(){}; + var self = $NullLogger = $klass($base, $super, 'NullLogger', $NullLogger); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_NullLogger_initialize_12, TMP_NullLogger_add_13; + + def.max_severity = nil; + + self.$attr_reader("max_severity"); + + Opal.def(self, '$initialize', TMP_NullLogger_initialize_12 = function $$initialize() { + var self = this; + + return nil + }, TMP_NullLogger_initialize_12.$$arity = 0); + return (Opal.def(self, '$add', TMP_NullLogger_add_13 = function $$add(severity, message, progname) { + var $a, self = this; + + + + if (message == null) { + message = nil; + }; + + if (progname == null) { + progname = nil; + }; + if ($truthy($rb_gt((severity = ($truthy($a = severity) ? $a : $$($nesting, 'UNKNOWN'))), (self.max_severity = ($truthy($a = self.max_severity) ? $a : severity))))) { + self.max_severity = severity}; + return true; + }, TMP_NullLogger_add_13.$$arity = -2), nil) && 'add'; + })($nesting[0], $$$('::', 'Logger'), $nesting); + (function($base, $parent_nesting) { + function $LoggerManager() {}; + var self = $LoggerManager = $module($base, 'LoggerManager', $LoggerManager); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + + self.logger_class = $$($nesting, 'Logger'); + (function(self, $parent_nesting) { + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_logger_14, TMP_logger$eq_15, TMP_memoize_logger_16; + + + self.$attr_accessor("logger_class"); + + Opal.def(self, '$logger', TMP_logger_14 = function $$logger(pipe) { + var $a, self = this; + if (self.logger == null) self.logger = nil; + if (self.logger_class == null) self.logger_class = nil; + if ($gvars.stderr == null) $gvars.stderr = nil; + + + + if (pipe == null) { + pipe = $gvars.stderr; + }; + self.$memoize_logger(); + return (self.logger = ($truthy($a = self.logger) ? $a : self.logger_class.$new(pipe))); + }, TMP_logger_14.$$arity = -1); + + Opal.def(self, '$logger=', TMP_logger$eq_15 = function(logger) { + var $a, self = this; + if (self.logger_class == null) self.logger_class = nil; + if ($gvars.stderr == null) $gvars.stderr = nil; + + return (self.logger = ($truthy($a = logger) ? $a : self.logger_class.$new($gvars.stderr))) + }, TMP_logger$eq_15.$$arity = 1); + self.$private(); + return (Opal.def(self, '$memoize_logger', TMP_memoize_logger_16 = function $$memoize_logger() { + var self = this; + + return (function(self, $parent_nesting) { + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_17; + + + self.$alias_method("logger", "logger"); + if ($$($nesting, 'RUBY_ENGINE')['$==']("opal")) { + return $send(self, 'define_method', ["logger"], (TMP_17 = function(){var self = TMP_17.$$s || this; + if (self.logger == null) self.logger = nil; + + return self.logger}, TMP_17.$$s = self, TMP_17.$$arity = 0, TMP_17)) + } else { + return nil + }; + })(Opal.get_singleton_class(self), $nesting) + }, TMP_memoize_logger_16.$$arity = 0), nil) && 'memoize_logger'; + })(Opal.get_singleton_class(self), $nesting); + })($nesting[0], $nesting); + (function($base, $parent_nesting) { + function $Logging() {}; + var self = $Logging = $module($base, 'Logging', $Logging); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Logging_included_18, TMP_Logging_logger_19, TMP_Logging_message_with_context_20; + + + Opal.defs(self, '$included', TMP_Logging_included_18 = function $$included(into) { + var self = this; + + return into.$extend($$($nesting, 'Logging')) + }, TMP_Logging_included_18.$$arity = 1); + self.$private(); + + Opal.def(self, '$logger', TMP_Logging_logger_19 = function $$logger() { + var self = this; + + return $$($nesting, 'LoggerManager').$logger() + }, TMP_Logging_logger_19.$$arity = 0); + + Opal.def(self, '$message_with_context', TMP_Logging_message_with_context_20 = function $$message_with_context(text, context) { + var self = this; + + + + if (context == null) { + context = $hash2([], {}); + }; + return $hash2(["text"], {"text": text}).$merge(context).$extend($$$($$($nesting, 'Logger'), 'AutoFormattingMessage')); + }, TMP_Logging_message_with_context_20.$$arity = -2); + })($nesting[0], $nesting); + })($nesting[0], $nesting); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/timings"] = function(Opal) { + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + function $rb_plus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); + } + function $rb_gt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $hash2 = Opal.hash2, $send = Opal.send, $truthy = Opal.truthy, $gvars = Opal.gvars; + + Opal.add_stubs(['$now', '$[]=', '$-', '$delete', '$reduce', '$+', '$[]', '$>', '$time', '$puts', '$%', '$to_f', '$read_parse', '$convert', '$read_parse_convert', '$const_defined?', '$respond_to?', '$clock_gettime']); + return (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + (function($base, $super, $parent_nesting) { + function $Timings(){}; + var self = $Timings = $klass($base, $super, 'Timings', $Timings); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Timings_initialize_1, TMP_Timings_start_2, TMP_Timings_record_3, TMP_Timings_time_4, TMP_Timings_read_6, TMP_Timings_parse_7, TMP_Timings_read_parse_8, TMP_Timings_convert_9, TMP_Timings_read_parse_convert_10, TMP_Timings_write_11, TMP_Timings_total_12, TMP_Timings_print_report_13, $a, TMP_Timings_now_14, TMP_Timings_now_15; + + def.timers = def.log = nil; + + + Opal.def(self, '$initialize', TMP_Timings_initialize_1 = function $$initialize() { + var self = this; + + + self.log = $hash2([], {}); + return (self.timers = $hash2([], {})); + }, TMP_Timings_initialize_1.$$arity = 0); + + Opal.def(self, '$start', TMP_Timings_start_2 = function $$start(key) { + var self = this, $writer = nil; + + + $writer = [key, self.$now()]; + $send(self.timers, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + }, TMP_Timings_start_2.$$arity = 1); + + Opal.def(self, '$record', TMP_Timings_record_3 = function $$record(key) { + var self = this, $writer = nil; + + + $writer = [key, $rb_minus(self.$now(), self.timers.$delete(key))]; + $send(self.log, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + }, TMP_Timings_record_3.$$arity = 1); + + Opal.def(self, '$time', TMP_Timings_time_4 = function $$time($a) { + var $post_args, keys, TMP_5, self = this, time = nil; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + keys = $post_args;; + time = $send(keys, 'reduce', [0], (TMP_5 = function(sum, key){var self = TMP_5.$$s || this, $b; + if (self.log == null) self.log = nil; + + + + if (sum == null) { + sum = nil; + }; + + if (key == null) { + key = nil; + }; + return $rb_plus(sum, ($truthy($b = self.log['$[]'](key)) ? $b : 0));}, TMP_5.$$s = self, TMP_5.$$arity = 2, TMP_5)); + if ($truthy($rb_gt(time, 0))) { + return time + } else { + return nil + }; + }, TMP_Timings_time_4.$$arity = -1); + + Opal.def(self, '$read', TMP_Timings_read_6 = function $$read() { + var self = this; + + return self.$time("read") + }, TMP_Timings_read_6.$$arity = 0); + + Opal.def(self, '$parse', TMP_Timings_parse_7 = function $$parse() { + var self = this; + + return self.$time("parse") + }, TMP_Timings_parse_7.$$arity = 0); + + Opal.def(self, '$read_parse', TMP_Timings_read_parse_8 = function $$read_parse() { + var self = this; + + return self.$time("read", "parse") + }, TMP_Timings_read_parse_8.$$arity = 0); + + Opal.def(self, '$convert', TMP_Timings_convert_9 = function $$convert() { + var self = this; + + return self.$time("convert") + }, TMP_Timings_convert_9.$$arity = 0); + + Opal.def(self, '$read_parse_convert', TMP_Timings_read_parse_convert_10 = function $$read_parse_convert() { + var self = this; + + return self.$time("read", "parse", "convert") + }, TMP_Timings_read_parse_convert_10.$$arity = 0); + + Opal.def(self, '$write', TMP_Timings_write_11 = function $$write() { + var self = this; + + return self.$time("write") + }, TMP_Timings_write_11.$$arity = 0); + + Opal.def(self, '$total', TMP_Timings_total_12 = function $$total() { + var self = this; + + return self.$time("read", "parse", "convert", "write") + }, TMP_Timings_total_12.$$arity = 0); + + Opal.def(self, '$print_report', TMP_Timings_print_report_13 = function $$print_report(to, subject) { + var self = this; + if ($gvars.stdout == null) $gvars.stdout = nil; + + + + if (to == null) { + to = $gvars.stdout; + }; + + if (subject == null) { + subject = nil; + }; + if ($truthy(subject)) { + to.$puts("" + "Input file: " + (subject))}; + to.$puts("" + " Time to read and parse source: " + ("%05.5f"['$%'](self.$read_parse().$to_f()))); + to.$puts("" + " Time to convert document: " + ("%05.5f"['$%'](self.$convert().$to_f()))); + return to.$puts("" + " Total time (read, parse and convert): " + ("%05.5f"['$%'](self.$read_parse_convert().$to_f()))); + }, TMP_Timings_print_report_13.$$arity = -1); + if ($truthy(($truthy($a = $$$('::', 'Process')['$const_defined?']("CLOCK_MONOTONIC")) ? $$$('::', 'Process')['$respond_to?']("clock_gettime") : $a))) { + + Opal.const_set($nesting[0], 'CLOCK_ID', $$$($$$('::', 'Process'), 'CLOCK_MONOTONIC')); + return (Opal.def(self, '$now', TMP_Timings_now_14 = function $$now() { + var self = this; + + return $$$('::', 'Process').$clock_gettime($$($nesting, 'CLOCK_ID')) + }, TMP_Timings_now_14.$$arity = 0), nil) && 'now'; + } else { + return (Opal.def(self, '$now', TMP_Timings_now_15 = function $$now() { + var self = this; + + return $$$('::', 'Time').$now() + }, TMP_Timings_now_15.$$arity = 0), nil) && 'now' + }; + })($nesting[0], null, $nesting) + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/version"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module; + + return (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + Opal.const_set($nesting[0], 'VERSION', "1.5.8") + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/core_ext/nil_or_empty"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $truthy = Opal.truthy; + + Opal.add_stubs(['$method_defined?']); + + (function($base, $super, $parent_nesting) { + function $NilClass(){}; + var self = $NilClass = $klass($base, $super, 'NilClass', $NilClass); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + if ($truthy(self['$method_defined?']("nil_or_empty?"))) { + return nil + } else { + return Opal.alias(self, "nil_or_empty?", "nil?") + } + })($nesting[0], null, $nesting); + (function($base, $super, $parent_nesting) { + function $String(){}; + var self = $String = $klass($base, $super, 'String', $String); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + if ($truthy(self['$method_defined?']("nil_or_empty?"))) { + return nil + } else { + return Opal.alias(self, "nil_or_empty?", "empty?") + } + })($nesting[0], null, $nesting); + (function($base, $super, $parent_nesting) { + function $Array(){}; + var self = $Array = $klass($base, $super, 'Array', $Array); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + if ($truthy(self['$method_defined?']("nil_or_empty?"))) { + return nil + } else { + return Opal.alias(self, "nil_or_empty?", "empty?") + } + })($nesting[0], null, $nesting); + (function($base, $super, $parent_nesting) { + function $Hash(){}; + var self = $Hash = $klass($base, $super, 'Hash', $Hash); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + if ($truthy(self['$method_defined?']("nil_or_empty?"))) { + return nil + } else { + return Opal.alias(self, "nil_or_empty?", "empty?") + } + })($nesting[0], null, $nesting); + return (function($base, $super, $parent_nesting) { + function $Numeric(){}; + var self = $Numeric = $klass($base, $super, 'Numeric', $Numeric); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + if ($truthy(self['$method_defined?']("nil_or_empty?"))) { + return nil + } else { + return Opal.alias(self, "nil_or_empty?", "nil?") + } + })($nesting[0], null, $nesting); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/core_ext/regexp/is_match"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $truthy = Opal.truthy; + + Opal.add_stubs(['$method_defined?']); + return (function($base, $super, $parent_nesting) { + function $Regexp(){}; + var self = $Regexp = $klass($base, $super, 'Regexp', $Regexp); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + if ($truthy(self['$method_defined?']("match?"))) { + return nil + } else { + return Opal.alias(self, "match?", "===") + } + })($nesting[0], null, $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/core_ext/string/limit_bytesize"] = function(Opal) { + function $rb_lt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); + } + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $truthy = Opal.truthy; + + Opal.add_stubs(['$method_defined?', '$<', '$bytesize', '$valid_encoding?', '$force_encoding', '$byteslice', '$-']); + return (function($base, $super, $parent_nesting) { + function $String(){}; + var self = $String = $klass($base, $super, 'String', $String); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_String_limit_bytesize_1; + + if ($truthy(self['$method_defined?']("limit_bytesize"))) { + return nil + } else { + return (Opal.def(self, '$limit_bytesize', TMP_String_limit_bytesize_1 = function $$limit_bytesize(size) { + var $a, self = this, result = nil; + + + if ($truthy($rb_lt(size, self.$bytesize()))) { + } else { + return self + }; + while (!($truthy((result = self.$byteslice(0, size)).$force_encoding($$$($$$('::', 'Encoding'), 'UTF_8'))['$valid_encoding?']()))) { + size = $rb_minus(size, 1) + }; + return result; + }, TMP_String_limit_bytesize_1.$$arity = 1), nil) && 'limit_bytesize' + } + })($nesting[0], null, $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/core_ext/1.8.7/io/binread"] = function(Opal) { + var TMP_binread_1, self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $truthy = Opal.truthy, $send = Opal.send; + + Opal.add_stubs(['$respond_to?', '$open', '$==', '$seek', '$read']); + if ($truthy($$($nesting, 'IO')['$respond_to?']("binread"))) { + return nil + } else { + return (Opal.defs($$($nesting, 'IO'), '$binread', TMP_binread_1 = function $$binread(name, length, offset) { + var TMP_2, self = this; + + + + if (length == null) { + length = nil; + }; + + if (offset == null) { + offset = 0; + }; + return $send($$($nesting, 'File'), 'open', [name, "rb"], (TMP_2 = function(f){var self = TMP_2.$$s || this; + + + + if (f == null) { + f = nil; + }; + if (offset['$=='](0)) { + } else { + f.$seek(offset) + }; + if ($truthy(length)) { + + return f.$read(length); + } else { + return f.$read() + };}, TMP_2.$$s = self, TMP_2.$$arity = 1, TMP_2)); + }, TMP_binread_1.$$arity = -2), nil) && 'binread' + } +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/core_ext/1.8.7/io/write"] = function(Opal) { + var TMP_write_1, self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $truthy = Opal.truthy, $send = Opal.send; + + Opal.add_stubs(['$respond_to?', '$open', '$write']); + if ($truthy($$($nesting, 'IO')['$respond_to?']("write"))) { + return nil + } else { + return (Opal.defs($$($nesting, 'IO'), '$write', TMP_write_1 = function $$write(name, string, offset, opts) { + var TMP_2, self = this; + + + + if (offset == null) { + offset = 0; + }; + + if (opts == null) { + opts = nil; + }; + return $send($$($nesting, 'File'), 'open', [name, "w"], (TMP_2 = function(f){var self = TMP_2.$$s || this; + + + + if (f == null) { + f = nil; + }; + return f.$write(string);}, TMP_2.$$s = self, TMP_2.$$arity = 1, TMP_2)); + }, TMP_write_1.$$arity = -3), nil) && 'write' + } +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/core_ext"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $truthy = Opal.truthy; + + Opal.add_stubs(['$require', '$==', '$!=']); + + self.$require("asciidoctor/core_ext/nil_or_empty"); + self.$require("asciidoctor/core_ext/regexp/is_match"); + if ($truthy($$($nesting, 'RUBY_MIN_VERSION_1_9'))) { + + self.$require("asciidoctor/core_ext/string/limit_bytesize"); + if ($$($nesting, 'RUBY_ENGINE')['$==']("opal")) { + + self.$require("asciidoctor/core_ext/1.8.7/io/binread"); + return self.$require("asciidoctor/core_ext/1.8.7/io/write"); + } else { + return nil + }; + } else if ($truthy($$($nesting, 'RUBY_ENGINE')['$!=']("opal"))) { + return nil + } else { + return nil + }; +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/helpers"] = function(Opal) { + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + function $rb_times(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs * rhs : lhs['$*'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $truthy = Opal.truthy, $send = Opal.send, $gvars = Opal.gvars, $hash2 = Opal.hash2; + + Opal.add_stubs(['$require', '$include?', '$include', '$==', '$===', '$raise', '$warn', '$logger', '$chomp', '$message', '$normalize_lines_from_string', '$normalize_lines_array', '$empty?', '$unpack', '$[]', '$slice', '$join', '$map', '$each_line', '$encode', '$force_encoding', '$length', '$rstrip', '$[]=', '$-', '$encoding', '$nil_or_empty?', '$match?', '$=~', '$gsub', '$each_byte', '$sprintf', '$rindex', '$basename', '$extname', '$directory?', '$dirname', '$mkdir_p', '$mkdir', '$divmod', '$*']); + return (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + (function($base, $parent_nesting) { + function $Helpers() {}; + var self = $Helpers = $module($base, 'Helpers', $Helpers); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Helpers_require_library_1, TMP_Helpers_normalize_lines_2, TMP_Helpers_normalize_lines_array_3, TMP_Helpers_normalize_lines_from_string_8, TMP_Helpers_uriish$q_10, TMP_Helpers_uri_prefix_11, TMP_Helpers_uri_encode_12, TMP_Helpers_rootname_15, TMP_Helpers_basename_16, TMP_Helpers_mkdir_p_17, TMP_Helpers_int_to_roman_18; + + + Opal.defs(self, '$require_library', TMP_Helpers_require_library_1 = function $$require_library(name, gem_name, on_failure) { + var self = this, e = nil, $case = nil; + + + + if (gem_name == null) { + gem_name = true; + }; + + if (on_failure == null) { + on_failure = "abort"; + }; + try { + return self.$require(name) + } catch ($err) { + if (Opal.rescue($err, [$$$('::', 'LoadError')])) {e = $err; + try { + + if ($truthy(self['$include?']($$($nesting, 'Logging')))) { + } else { + self.$include($$($nesting, 'Logging')) + }; + if ($truthy(gem_name)) { + + if (gem_name['$=='](true)) { + gem_name = name}; + $case = on_failure; + if ("abort"['$===']($case)) {self.$raise($$$('::', 'LoadError'), "" + "asciidoctor: FAILED: required gem '" + (gem_name) + "' is not installed. Processing aborted.")} + else if ("warn"['$===']($case)) {self.$logger().$warn("" + "optional gem '" + (gem_name) + "' is not installed. Functionality disabled.")}; + } else { + $case = on_failure; + if ("abort"['$===']($case)) {self.$raise($$$('::', 'LoadError'), "" + "asciidoctor: FAILED: " + (e.$message().$chomp(".")) + ". Processing aborted.")} + else if ("warn"['$===']($case)) {self.$logger().$warn("" + (e.$message().$chomp(".")) + ". Functionality disabled.")} + }; + return nil; + } finally { Opal.pop_exception() } + } else { throw $err; } + }; + }, TMP_Helpers_require_library_1.$$arity = -2); + Opal.defs(self, '$normalize_lines', TMP_Helpers_normalize_lines_2 = function $$normalize_lines(data) { + var self = this; + + if ($truthy($$$('::', 'String')['$==='](data))) { + + return self.$normalize_lines_from_string(data); + } else { + + return self.$normalize_lines_array(data); + } + }, TMP_Helpers_normalize_lines_2.$$arity = 1); + Opal.defs(self, '$normalize_lines_array', TMP_Helpers_normalize_lines_array_3 = function $$normalize_lines_array(data) { + var TMP_4, TMP_5, TMP_6, TMP_7, self = this, leading_bytes = nil, first_line = nil, utf8 = nil, leading_2_bytes = nil, $writer = nil; + + + if ($truthy(data['$empty?']())) { + return data}; + leading_bytes = (first_line = data['$[]'](0)).$unpack("C3"); + if ($truthy($$($nesting, 'COERCE_ENCODING'))) { + + utf8 = $$$($$$('::', 'Encoding'), 'UTF_8'); + if ((leading_2_bytes = leading_bytes.$slice(0, 2))['$==']($$($nesting, 'BOM_BYTES_UTF_16LE'))) { + + data = data.$join(); + return $send(data.$force_encoding($$$($$$('::', 'Encoding'), 'UTF_16LE')).$slice(1, data.$length()).$encode(utf8).$each_line(), 'map', [], (TMP_4 = function(line){var self = TMP_4.$$s || this; + + + + if (line == null) { + line = nil; + }; + return line.$rstrip();}, TMP_4.$$s = self, TMP_4.$$arity = 1, TMP_4)); + } else if (leading_2_bytes['$==']($$($nesting, 'BOM_BYTES_UTF_16BE'))) { + + + $writer = [0, first_line.$force_encoding($$$($$$('::', 'Encoding'), 'UTF_16BE')).$slice(1, first_line.$length())]; + $send(data, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + return $send(data, 'map', [], (TMP_5 = function(line){var self = TMP_5.$$s || this; + + + + if (line == null) { + line = nil; + }; + return line.$force_encoding($$$($$$('::', 'Encoding'), 'UTF_16BE')).$encode(utf8).$rstrip();}, TMP_5.$$s = self, TMP_5.$$arity = 1, TMP_5)); + } else if (leading_bytes['$==']($$($nesting, 'BOM_BYTES_UTF_8'))) { + + $writer = [0, first_line.$force_encoding(utf8).$slice(1, first_line.$length())]; + $send(data, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + return $send(data, 'map', [], (TMP_6 = function(line){var self = TMP_6.$$s || this; + + + + if (line == null) { + line = nil; + }; + if (line.$encoding()['$=='](utf8)) { + return line.$rstrip() + } else { + return line.$force_encoding(utf8).$rstrip() + };}, TMP_6.$$s = self, TMP_6.$$arity = 1, TMP_6)); + } else { + + if (leading_bytes['$==']($$($nesting, 'BOM_BYTES_UTF_8'))) { + + $writer = [0, first_line.$slice(3, first_line.$length())]; + $send(data, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + return $send(data, 'map', [], (TMP_7 = function(line){var self = TMP_7.$$s || this; + + + + if (line == null) { + line = nil; + }; + return line.$rstrip();}, TMP_7.$$s = self, TMP_7.$$arity = 1, TMP_7)); + }; + }, TMP_Helpers_normalize_lines_array_3.$$arity = 1); + Opal.defs(self, '$normalize_lines_from_string', TMP_Helpers_normalize_lines_from_string_8 = function $$normalize_lines_from_string(data) { + var TMP_9, self = this, leading_bytes = nil, utf8 = nil, leading_2_bytes = nil; + + + if ($truthy(data['$nil_or_empty?']())) { + return []}; + leading_bytes = data.$unpack("C3"); + if ($truthy($$($nesting, 'COERCE_ENCODING'))) { + + utf8 = $$$($$$('::', 'Encoding'), 'UTF_8'); + if ((leading_2_bytes = leading_bytes.$slice(0, 2))['$==']($$($nesting, 'BOM_BYTES_UTF_16LE'))) { + data = data.$force_encoding($$$($$$('::', 'Encoding'), 'UTF_16LE')).$slice(1, data.$length()).$encode(utf8) + } else if (leading_2_bytes['$==']($$($nesting, 'BOM_BYTES_UTF_16BE'))) { + data = data.$force_encoding($$$($$$('::', 'Encoding'), 'UTF_16BE')).$slice(1, data.$length()).$encode(utf8) + } else if (leading_bytes['$==']($$($nesting, 'BOM_BYTES_UTF_8'))) { + data = (function() {if (data.$encoding()['$=='](utf8)) { + + return data.$slice(1, data.$length()); + } else { + + return data.$force_encoding(utf8).$slice(1, data.$length()); + }; return nil; })() + } else if (data.$encoding()['$=='](utf8)) { + } else { + data = data.$force_encoding(utf8) + }; + } else if (leading_bytes['$==']($$($nesting, 'BOM_BYTES_UTF_8'))) { + data = data.$slice(3, data.$length())}; + return $send(data.$each_line(), 'map', [], (TMP_9 = function(line){var self = TMP_9.$$s || this; + + + + if (line == null) { + line = nil; + }; + return line.$rstrip();}, TMP_9.$$s = self, TMP_9.$$arity = 1, TMP_9)); + }, TMP_Helpers_normalize_lines_from_string_8.$$arity = 1); + Opal.defs(self, '$uriish?', TMP_Helpers_uriish$q_10 = function(str) { + var $a, self = this; + + return ($truthy($a = str['$include?'](":")) ? $$($nesting, 'UriSniffRx')['$match?'](str) : $a) + }, TMP_Helpers_uriish$q_10.$$arity = 1); + Opal.defs(self, '$uri_prefix', TMP_Helpers_uri_prefix_11 = function $$uri_prefix(str) { + var $a, self = this; + + if ($truthy(($truthy($a = str['$include?'](":")) ? $$($nesting, 'UriSniffRx')['$=~'](str) : $a))) { + return (($a = $gvars['~']) === nil ? nil : $a['$[]'](0)) + } else { + return nil + } + }, TMP_Helpers_uri_prefix_11.$$arity = 1); + Opal.const_set($nesting[0], 'REGEXP_ENCODE_URI_CHARS', /[^\w\-.!~*';:@=+$,()\[\]]/); + Opal.defs(self, '$uri_encode', TMP_Helpers_uri_encode_12 = function $$uri_encode(str) { + var TMP_13, self = this; + + return $send(str, 'gsub', [$$($nesting, 'REGEXP_ENCODE_URI_CHARS')], (TMP_13 = function(){var self = TMP_13.$$s || this, $a, TMP_14; + + return $send((($a = $gvars['~']) === nil ? nil : $a['$[]'](0)).$each_byte(), 'map', [], (TMP_14 = function(c){var self = TMP_14.$$s || this; + + + + if (c == null) { + c = nil; + }; + return self.$sprintf("%%%02X", c);}, TMP_14.$$s = self, TMP_14.$$arity = 1, TMP_14)).$join()}, TMP_13.$$s = self, TMP_13.$$arity = 0, TMP_13)) + }, TMP_Helpers_uri_encode_12.$$arity = 1); + Opal.defs(self, '$rootname', TMP_Helpers_rootname_15 = function $$rootname(filename) { + var $a, self = this; + + return filename.$slice(0, ($truthy($a = filename.$rindex(".")) ? $a : filename.$length())) + }, TMP_Helpers_rootname_15.$$arity = 1); + Opal.defs(self, '$basename', TMP_Helpers_basename_16 = function $$basename(filename, drop_ext) { + var self = this; + + + + if (drop_ext == null) { + drop_ext = nil; + }; + if ($truthy(drop_ext)) { + return $$$('::', 'File').$basename(filename, (function() {if (drop_ext['$=='](true)) { + + return $$$('::', 'File').$extname(filename); + } else { + return drop_ext + }; return nil; })()) + } else { + return $$$('::', 'File').$basename(filename) + }; + }, TMP_Helpers_basename_16.$$arity = -2); + Opal.defs(self, '$mkdir_p', TMP_Helpers_mkdir_p_17 = function $$mkdir_p(dir) { + var self = this, parent_dir = nil; + + if ($truthy($$$('::', 'File')['$directory?'](dir))) { + return nil + } else { + + if ((parent_dir = $$$('::', 'File').$dirname(dir))['$=='](".")) { + } else { + self.$mkdir_p(parent_dir) + }; + + try { + return $$$('::', 'Dir').$mkdir(dir) + } catch ($err) { + if (Opal.rescue($err, [$$$('::', 'SystemCallError')])) { + try { + if ($truthy($$$('::', 'File')['$directory?'](dir))) { + return nil + } else { + return self.$raise() + } + } finally { Opal.pop_exception() } + } else { throw $err; } + };; + } + }, TMP_Helpers_mkdir_p_17.$$arity = 1); + Opal.const_set($nesting[0], 'ROMAN_NUMERALS', $hash2(["M", "CM", "D", "CD", "C", "XC", "L", "XL", "X", "IX", "V", "IV", "I"], {"M": 1000, "CM": 900, "D": 500, "CD": 400, "C": 100, "XC": 90, "L": 50, "XL": 40, "X": 10, "IX": 9, "V": 5, "IV": 4, "I": 1})); + Opal.defs(self, '$int_to_roman', TMP_Helpers_int_to_roman_18 = function $$int_to_roman(val) { + var TMP_19, self = this; + + return $send($$($nesting, 'ROMAN_NUMERALS'), 'map', [], (TMP_19 = function(l, i){var self = TMP_19.$$s || this, $a, $b, repeat = nil; + + + + if (l == null) { + l = nil; + }; + + if (i == null) { + i = nil; + }; + $b = val.$divmod(i), $a = Opal.to_ary($b), (repeat = ($a[0] == null ? nil : $a[0])), (val = ($a[1] == null ? nil : $a[1])), $b; + return $rb_times(l, repeat);}, TMP_19.$$s = self, TMP_19.$$arity = 2, TMP_19)).$join() + }, TMP_Helpers_int_to_roman_18.$$arity = 1); + })($nesting[0], $nesting) + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/substitutors"] = function(Opal) { + function $rb_plus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); + } + function $rb_gt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); + } + function $rb_times(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs * rhs : lhs['$*'](rhs); + } + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + function $rb_lt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $hash2 = Opal.hash2, $hash = Opal.hash, $truthy = Opal.truthy, $send = Opal.send, $gvars = Opal.gvars; + + Opal.add_stubs(['$freeze', '$+', '$keys', '$chr', '$attr_reader', '$empty?', '$!', '$===', '$[]', '$join', '$include?', '$extract_passthroughs', '$each', '$sub_specialchars', '$sub_quotes', '$sub_attributes', '$sub_replacements', '$sub_macros', '$highlight_source', '$sub_callouts', '$sub_post_replacements', '$warn', '$logger', '$restore_passthroughs', '$split', '$apply_subs', '$compat_mode', '$gsub', '$==', '$length', '$>', '$*', '$-', '$end_with?', '$slice', '$parse_quoted_text_attributes', '$size', '$[]=', '$unescape_brackets', '$resolve_pass_subs', '$start_with?', '$extract_inner_passthrough', '$to_sym', '$attributes', '$basebackend?', '$=~', '$to_i', '$convert', '$new', '$clear', '$match?', '$convert_quoted_text', '$do_replacement', '$sub', '$shift', '$store_attribute', '$!=', '$attribute_undefined', '$counter', '$key?', '$downcase', '$attribute_missing', '$tr_s', '$delete', '$reject', '$strip', '$index', '$min', '$compact', '$map', '$chop', '$unescape_bracketed_text', '$pop', '$rstrip', '$extensions', '$inline_macros?', '$inline_macros', '$regexp', '$instance', '$names', '$config', '$dup', '$nil_or_empty?', '$parse_attributes', '$process_method', '$register', '$tr', '$basename', '$split_simple_csv', '$normalize_string', '$!~', '$parse', '$uri_encode', '$sub_inline_xrefs', '$sub_inline_anchors', '$find', '$footnotes', '$id', '$text', '$style', '$lstrip', '$parse_into', '$extname', '$catalog', '$fetch', '$outfilesuffix', '$natural_xrefs', '$key', '$attr?', '$attr', '$to_s', '$read_next_id', '$callouts', '$<', '$<<', '$shorthand_property_syntax', '$concat', '$each_char', '$drop', '$&', '$resolve_subs', '$nil?', '$require_library', '$sub_source', '$resolve_lines_to_highlight', '$highlight', '$find_by_alias', '$find_by_mimetype', '$name', '$option?', '$count', '$to_a', '$uniq', '$sort', '$resolve_block_subs']); + return (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + (function($base, $parent_nesting) { + function $Substitutors() {}; + var self = $Substitutors = $module($base, 'Substitutors', $Substitutors); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Substitutors_apply_subs_1, TMP_Substitutors_apply_normal_subs_3, TMP_Substitutors_apply_title_subs_4, TMP_Substitutors_apply_reftext_subs_5, TMP_Substitutors_apply_header_subs_6, TMP_Substitutors_extract_passthroughs_7, TMP_Substitutors_extract_inner_passthrough_11, TMP_Substitutors_restore_passthroughs_12, TMP_Substitutors_sub_quotes_14, TMP_Substitutors_sub_replacements_17, TMP_Substitutors_sub_specialchars_20, TMP_Substitutors_sub_specialchars_21, TMP_Substitutors_do_replacement_23, TMP_Substitutors_sub_attributes_24, TMP_Substitutors_sub_macros_29, TMP_Substitutors_sub_inline_anchors_46, TMP_Substitutors_sub_inline_xrefs_49, TMP_Substitutors_sub_callouts_51, TMP_Substitutors_sub_post_replacements_53, TMP_Substitutors_convert_quoted_text_56, TMP_Substitutors_parse_quoted_text_attributes_57, TMP_Substitutors_parse_attributes_58, TMP_Substitutors_expand_subs_59, TMP_Substitutors_unescape_bracketed_text_61, TMP_Substitutors_normalize_string_62, TMP_Substitutors_unescape_brackets_63, TMP_Substitutors_split_simple_csv_64, TMP_Substitutors_resolve_subs_67, TMP_Substitutors_resolve_block_subs_69, TMP_Substitutors_resolve_pass_subs_70, TMP_Substitutors_highlight_source_71, TMP_Substitutors_resolve_lines_to_highlight_76, TMP_Substitutors_sub_source_78, TMP_Substitutors_lock_in_subs_79; + + + Opal.const_set($nesting[0], 'SpecialCharsRx', /[<&>]/); + Opal.const_set($nesting[0], 'SpecialCharsTr', $hash2([">", "<", "&"], {">": ">", "<": "<", "&": "&"})); + Opal.const_set($nesting[0], 'QuotedTextSniffRx', $hash(false, /[*_`#^~]/, true, /[*'_+#^~]/)); + Opal.const_set($nesting[0], 'BASIC_SUBS', ["specialcharacters"]).$freeze(); + Opal.const_set($nesting[0], 'HEADER_SUBS', ["specialcharacters", "attributes"]).$freeze(); + Opal.const_set($nesting[0], 'NORMAL_SUBS', ["specialcharacters", "quotes", "attributes", "replacements", "macros", "post_replacements"]).$freeze(); + Opal.const_set($nesting[0], 'NONE_SUBS', []).$freeze(); + Opal.const_set($nesting[0], 'TITLE_SUBS', ["specialcharacters", "quotes", "replacements", "macros", "attributes", "post_replacements"]).$freeze(); + Opal.const_set($nesting[0], 'REFTEXT_SUBS', ["specialcharacters", "quotes", "replacements"]).$freeze(); + Opal.const_set($nesting[0], 'VERBATIM_SUBS', ["specialcharacters", "callouts"]).$freeze(); + Opal.const_set($nesting[0], 'SUB_GROUPS', $hash2(["none", "normal", "verbatim", "specialchars"], {"none": $$($nesting, 'NONE_SUBS'), "normal": $$($nesting, 'NORMAL_SUBS'), "verbatim": $$($nesting, 'VERBATIM_SUBS'), "specialchars": $$($nesting, 'BASIC_SUBS')})); + Opal.const_set($nesting[0], 'SUB_HINTS', $hash2(["a", "m", "n", "p", "q", "r", "c", "v"], {"a": "attributes", "m": "macros", "n": "normal", "p": "post_replacements", "q": "quotes", "r": "replacements", "c": "specialcharacters", "v": "verbatim"})); + Opal.const_set($nesting[0], 'SUB_OPTIONS', $hash2(["block", "inline"], {"block": $rb_plus($rb_plus($$($nesting, 'SUB_GROUPS').$keys(), $$($nesting, 'NORMAL_SUBS')), ["callouts"]), "inline": $rb_plus($$($nesting, 'SUB_GROUPS').$keys(), $$($nesting, 'NORMAL_SUBS'))})); + Opal.const_set($nesting[0], 'SUB_HIGHLIGHT', ["coderay", "pygments"]); + if ($truthy($$$('::', 'RUBY_MIN_VERSION_1_9'))) { + + Opal.const_set($nesting[0], 'CAN', "\u0018"); + Opal.const_set($nesting[0], 'DEL', "\u007F"); + Opal.const_set($nesting[0], 'PASS_START', "\u0096"); + Opal.const_set($nesting[0], 'PASS_END', "\u0097"); + } else { + + Opal.const_set($nesting[0], 'CAN', (24).$chr()); + Opal.const_set($nesting[0], 'DEL', (127).$chr()); + Opal.const_set($nesting[0], 'PASS_START', (150).$chr()); + Opal.const_set($nesting[0], 'PASS_END', (151).$chr()); + }; + Opal.const_set($nesting[0], 'PassSlotRx', new RegExp("" + ($$($nesting, 'PASS_START')) + "(\\d+)" + ($$($nesting, 'PASS_END')))); + Opal.const_set($nesting[0], 'HighlightedPassSlotRx', new RegExp("" + "]*>" + ($$($nesting, 'PASS_START')) + "[^\\d]*(\\d+)[^\\d]*]*>" + ($$($nesting, 'PASS_END')) + "")); + Opal.const_set($nesting[0], 'RS', "\\"); + Opal.const_set($nesting[0], 'R_SB', "]"); + Opal.const_set($nesting[0], 'ESC_R_SB', "\\]"); + Opal.const_set($nesting[0], 'PLUS', "+"); + Opal.const_set($nesting[0], 'PygmentsWrapperDivRx', /
    (.*)<\/div>/m); + Opal.const_set($nesting[0], 'PygmentsWrapperPreRx', /]*?>(.*?)<\/pre>\s*/m); + self.$attr_reader("passthroughs"); + + Opal.def(self, '$apply_subs', TMP_Substitutors_apply_subs_1 = function $$apply_subs(text, subs) { + var $a, TMP_2, self = this, multiline = nil, has_passthroughs = nil; + if (self.passthroughs == null) self.passthroughs = nil; + + + + if (subs == null) { + subs = $$($nesting, 'NORMAL_SUBS'); + }; + if ($truthy(($truthy($a = text['$empty?']()) ? $a : subs['$!']()))) { + return text}; + if ($truthy((multiline = $$$('::', 'Array')['$==='](text)))) { + text = (function() {if ($truthy(text['$[]'](1))) { + + return text.$join($$($nesting, 'LF')); + } else { + return text['$[]'](0) + }; return nil; })()}; + if ($truthy((has_passthroughs = subs['$include?']("macros")))) { + + text = self.$extract_passthroughs(text); + if ($truthy(self.passthroughs['$empty?']())) { + has_passthroughs = false};}; + $send(subs, 'each', [], (TMP_2 = function(type){var self = TMP_2.$$s || this, $case = nil; + + + + if (type == null) { + type = nil; + }; + return (function() {$case = type; + if ("specialcharacters"['$===']($case)) {return (text = self.$sub_specialchars(text))} + else if ("quotes"['$===']($case)) {return (text = self.$sub_quotes(text))} + else if ("attributes"['$===']($case)) {if ($truthy(text['$include?']($$($nesting, 'ATTR_REF_HEAD')))) { + return (text = self.$sub_attributes(text)) + } else { + return nil + }} + else if ("replacements"['$===']($case)) {return (text = self.$sub_replacements(text))} + else if ("macros"['$===']($case)) {return (text = self.$sub_macros(text))} + else if ("highlight"['$===']($case)) {return (text = self.$highlight_source(text, subs['$include?']("callouts")))} + else if ("callouts"['$===']($case)) {if ($truthy(subs['$include?']("highlight"))) { + return nil + } else { + return (text = self.$sub_callouts(text)) + }} + else if ("post_replacements"['$===']($case)) {return (text = self.$sub_post_replacements(text))} + else {return self.$logger().$warn("" + "unknown substitution type " + (type))}})();}, TMP_2.$$s = self, TMP_2.$$arity = 1, TMP_2)); + if ($truthy(has_passthroughs)) { + text = self.$restore_passthroughs(text)}; + if ($truthy(multiline)) { + + return text.$split($$($nesting, 'LF'), -1); + } else { + return text + }; + }, TMP_Substitutors_apply_subs_1.$$arity = -2); + + Opal.def(self, '$apply_normal_subs', TMP_Substitutors_apply_normal_subs_3 = function $$apply_normal_subs(text) { + var self = this; + + return self.$apply_subs(text) + }, TMP_Substitutors_apply_normal_subs_3.$$arity = 1); + + Opal.def(self, '$apply_title_subs', TMP_Substitutors_apply_title_subs_4 = function $$apply_title_subs(title) { + var self = this; + + return self.$apply_subs(title, $$($nesting, 'TITLE_SUBS')) + }, TMP_Substitutors_apply_title_subs_4.$$arity = 1); + + Opal.def(self, '$apply_reftext_subs', TMP_Substitutors_apply_reftext_subs_5 = function $$apply_reftext_subs(text) { + var self = this; + + return self.$apply_subs(text, $$($nesting, 'REFTEXT_SUBS')) + }, TMP_Substitutors_apply_reftext_subs_5.$$arity = 1); + + Opal.def(self, '$apply_header_subs', TMP_Substitutors_apply_header_subs_6 = function $$apply_header_subs(text) { + var self = this; + + return self.$apply_subs(text, $$($nesting, 'HEADER_SUBS')) + }, TMP_Substitutors_apply_header_subs_6.$$arity = 1); + + Opal.def(self, '$extract_passthroughs', TMP_Substitutors_extract_passthroughs_7 = function $$extract_passthroughs(text) { + var $a, $b, TMP_8, TMP_9, TMP_10, self = this, compat_mode = nil, passes = nil, pass_inline_char1 = nil, pass_inline_char2 = nil, pass_inline_rx = nil; + if (self.document == null) self.document = nil; + if (self.passthroughs == null) self.passthroughs = nil; + + + compat_mode = self.document.$compat_mode(); + passes = self.passthroughs; + if ($truthy(($truthy($a = ($truthy($b = text['$include?']("++")) ? $b : text['$include?']("$$"))) ? $a : text['$include?']("ss:")))) { + text = $send(text, 'gsub', [$$($nesting, 'InlinePassMacroRx')], (TMP_8 = function(){var self = TMP_8.$$s || this, $c, m = nil, preceding = nil, boundary = nil, attributes = nil, escape_count = nil, content = nil, old_behavior = nil, subs = nil, pass_key = nil, $writer = nil; + if ($gvars["~"] == null) $gvars["~"] = nil; + + + m = $gvars["~"]; + preceding = nil; + if ($truthy((boundary = m['$[]'](4)))) { + + if ($truthy(($truthy($c = compat_mode) ? boundary['$==']("++") : $c))) { + return (function() {if ($truthy(m['$[]'](2))) { + return "" + (m['$[]'](1)) + "[" + (m['$[]'](2)) + "]" + (m['$[]'](3)) + "++" + (self.$extract_passthroughs(m['$[]'](5))) + "++" + } else { + return "" + (m['$[]'](1)) + (m['$[]'](3)) + "++" + (self.$extract_passthroughs(m['$[]'](5))) + "++" + }; return nil; })();}; + attributes = m['$[]'](2); + escape_count = m['$[]'](3).$length(); + content = m['$[]'](5); + old_behavior = false; + if ($truthy(attributes)) { + if ($truthy($rb_gt(escape_count, 0))) { + return "" + (m['$[]'](1)) + "[" + (attributes) + "]" + ($rb_times($$($nesting, 'RS'), $rb_minus(escape_count, 1))) + (boundary) + (m['$[]'](5)) + (boundary); + } else if (m['$[]'](1)['$==']($$($nesting, 'RS'))) { + + preceding = "" + "[" + (attributes) + "]"; + attributes = nil; + } else { + + if ($truthy((($c = boundary['$==']("++")) ? attributes['$end_with?']("x-") : boundary['$==']("++")))) { + + old_behavior = true; + attributes = attributes.$slice(0, $rb_minus(attributes.$length(), 2));}; + attributes = self.$parse_quoted_text_attributes(attributes); + } + } else if ($truthy($rb_gt(escape_count, 0))) { + return "" + ($rb_times($$($nesting, 'RS'), $rb_minus(escape_count, 1))) + (boundary) + (m['$[]'](5)) + (boundary);}; + subs = (function() {if (boundary['$==']("+++")) { + return [] + } else { + return $$($nesting, 'BASIC_SUBS') + }; return nil; })(); + pass_key = passes.$size(); + if ($truthy(attributes)) { + if ($truthy(old_behavior)) { + + $writer = [pass_key, $hash2(["text", "subs", "type", "attributes"], {"text": content, "subs": $$($nesting, 'NORMAL_SUBS'), "type": "monospaced", "attributes": attributes})]; + $send(passes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + } else { + + $writer = [pass_key, $hash2(["text", "subs", "type", "attributes"], {"text": content, "subs": subs, "type": "unquoted", "attributes": attributes})]; + $send(passes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + } + } else { + + $writer = [pass_key, $hash2(["text", "subs"], {"text": content, "subs": subs})]; + $send(passes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + } else { + + if (m['$[]'](6)['$==']($$($nesting, 'RS'))) { + return m['$[]'](0).$slice(1, m['$[]'](0).$length());}; + + $writer = [(pass_key = passes.$size()), $hash2(["text", "subs"], {"text": self.$unescape_brackets(m['$[]'](8)), "subs": (function() {if ($truthy(m['$[]'](7))) { + + return self.$resolve_pass_subs(m['$[]'](7)); + } else { + return nil + }; return nil; })()})]; + $send(passes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + }; + return "" + (preceding) + ($$($nesting, 'PASS_START')) + (pass_key) + ($$($nesting, 'PASS_END'));}, TMP_8.$$s = self, TMP_8.$$arity = 0, TMP_8))}; + $b = $$($nesting, 'InlinePassRx')['$[]'](compat_mode), $a = Opal.to_ary($b), (pass_inline_char1 = ($a[0] == null ? nil : $a[0])), (pass_inline_char2 = ($a[1] == null ? nil : $a[1])), (pass_inline_rx = ($a[2] == null ? nil : $a[2])), $b; + if ($truthy(($truthy($a = text['$include?'](pass_inline_char1)) ? $a : ($truthy($b = pass_inline_char2) ? text['$include?'](pass_inline_char2) : $b)))) { + text = $send(text, 'gsub', [pass_inline_rx], (TMP_9 = function(){var self = TMP_9.$$s || this, $c, m = nil, preceding = nil, attributes = nil, quoted_text = nil, escape_mark = nil, format_mark = nil, content = nil, old_behavior = nil, pass_key = nil, $writer = nil, subs = nil; + if ($gvars["~"] == null) $gvars["~"] = nil; + + + m = $gvars["~"]; + preceding = m['$[]'](1); + attributes = m['$[]'](2); + if ($truthy((quoted_text = m['$[]'](3))['$start_with?']($$($nesting, 'RS')))) { + escape_mark = $$($nesting, 'RS')}; + format_mark = m['$[]'](4); + content = m['$[]'](5); + if ($truthy(compat_mode)) { + old_behavior = true + } else if ($truthy((old_behavior = ($truthy($c = attributes) ? attributes['$end_with?']("x-") : $c)))) { + attributes = attributes.$slice(0, $rb_minus(attributes.$length(), 2))}; + if ($truthy(attributes)) { + + if ($truthy((($c = format_mark['$==']("`")) ? old_behavior['$!']() : format_mark['$==']("`")))) { + return self.$extract_inner_passthrough(content, "" + (preceding) + "[" + (attributes) + "]" + (escape_mark), attributes);}; + if ($truthy(escape_mark)) { + return "" + (preceding) + "[" + (attributes) + "]" + (quoted_text.$slice(1, quoted_text.$length())); + } else if (preceding['$==']($$($nesting, 'RS'))) { + + preceding = "" + "[" + (attributes) + "]"; + attributes = nil; + } else { + attributes = self.$parse_quoted_text_attributes(attributes) + }; + } else if ($truthy((($c = format_mark['$==']("`")) ? old_behavior['$!']() : format_mark['$==']("`")))) { + return self.$extract_inner_passthrough(content, "" + (preceding) + (escape_mark)); + } else if ($truthy(escape_mark)) { + return "" + (preceding) + (quoted_text.$slice(1, quoted_text.$length()));}; + pass_key = passes.$size(); + if ($truthy(compat_mode)) { + + $writer = [pass_key, $hash2(["text", "subs", "attributes", "type"], {"text": content, "subs": $$($nesting, 'BASIC_SUBS'), "attributes": attributes, "type": "monospaced"})]; + $send(passes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + } else if ($truthy(attributes)) { + if ($truthy(old_behavior)) { + + subs = (function() {if (format_mark['$==']("`")) { + return $$($nesting, 'BASIC_SUBS') + } else { + return $$($nesting, 'NORMAL_SUBS') + }; return nil; })(); + + $writer = [pass_key, $hash2(["text", "subs", "attributes", "type"], {"text": content, "subs": subs, "attributes": attributes, "type": "monospaced"})]; + $send(passes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + } else { + + $writer = [pass_key, $hash2(["text", "subs", "attributes", "type"], {"text": content, "subs": $$($nesting, 'BASIC_SUBS'), "attributes": attributes, "type": "unquoted"})]; + $send(passes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + } + } else { + + $writer = [pass_key, $hash2(["text", "subs"], {"text": content, "subs": $$($nesting, 'BASIC_SUBS')})]; + $send(passes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + return "" + (preceding) + ($$($nesting, 'PASS_START')) + (pass_key) + ($$($nesting, 'PASS_END'));}, TMP_9.$$s = self, TMP_9.$$arity = 0, TMP_9))}; + if ($truthy(($truthy($a = text['$include?'](":")) ? ($truthy($b = text['$include?']("stem:")) ? $b : text['$include?']("math:")) : $a))) { + text = $send(text, 'gsub', [$$($nesting, 'InlineStemMacroRx')], (TMP_10 = function(){var self = TMP_10.$$s || this, $c, m = nil, type = nil, content = nil, subs = nil, $writer = nil, pass_key = nil; + if (self.document == null) self.document = nil; + if ($gvars["~"] == null) $gvars["~"] = nil; + + + m = $gvars["~"]; + if ($truthy((($c = $gvars['~']) === nil ? nil : $c['$[]'](0))['$start_with?']($$($nesting, 'RS')))) { + return m['$[]'](0).$slice(1, m['$[]'](0).$length());}; + if ((type = m['$[]'](1).$to_sym())['$==']("stem")) { + type = $$($nesting, 'STEM_TYPE_ALIASES')['$[]'](self.document.$attributes()['$[]']("stem")).$to_sym()}; + content = self.$unescape_brackets(m['$[]'](3)); + subs = (function() {if ($truthy(m['$[]'](2))) { + + return self.$resolve_pass_subs(m['$[]'](2)); + } else { + + if ($truthy(self.document['$basebackend?']("html"))) { + return $$($nesting, 'BASIC_SUBS') + } else { + return nil + }; + }; return nil; })(); + + $writer = [(pass_key = passes.$size()), $hash2(["text", "subs", "type"], {"text": content, "subs": subs, "type": type})]; + $send(passes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + return "" + ($$($nesting, 'PASS_START')) + (pass_key) + ($$($nesting, 'PASS_END'));}, TMP_10.$$s = self, TMP_10.$$arity = 0, TMP_10))}; + return text; + }, TMP_Substitutors_extract_passthroughs_7.$$arity = 1); + + Opal.def(self, '$extract_inner_passthrough', TMP_Substitutors_extract_inner_passthrough_11 = function $$extract_inner_passthrough(text, pre, attributes) { + var $a, $b, self = this, $writer = nil, pass_key = nil; + if (self.passthroughs == null) self.passthroughs = nil; + + + + if (attributes == null) { + attributes = nil; + }; + if ($truthy(($truthy($a = ($truthy($b = text['$end_with?']("+")) ? text['$start_with?']("+", "\\+") : $b)) ? $$($nesting, 'SinglePlusInlinePassRx')['$=~'](text) : $a))) { + if ($truthy((($a = $gvars['~']) === nil ? nil : $a['$[]'](1)))) { + return "" + (pre) + "`+" + ((($a = $gvars['~']) === nil ? nil : $a['$[]'](2))) + "+`" + } else { + + + $writer = [(pass_key = self.passthroughs.$size()), (function() {if ($truthy(attributes)) { + return $hash2(["text", "subs", "attributes", "type"], {"text": (($a = $gvars['~']) === nil ? nil : $a['$[]'](2)), "subs": $$($nesting, 'BASIC_SUBS'), "attributes": attributes, "type": "unquoted"}) + } else { + return $hash2(["text", "subs"], {"text": (($a = $gvars['~']) === nil ? nil : $a['$[]'](2)), "subs": $$($nesting, 'BASIC_SUBS')}) + }; return nil; })()]; + $send(self.passthroughs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + return "" + (pre) + "`" + ($$($nesting, 'PASS_START')) + (pass_key) + ($$($nesting, 'PASS_END')) + "`"; + } + } else { + return "" + (pre) + "`" + (text) + "`" + }; + }, TMP_Substitutors_extract_inner_passthrough_11.$$arity = -3); + + Opal.def(self, '$restore_passthroughs', TMP_Substitutors_restore_passthroughs_12 = function $$restore_passthroughs(text, outer) { + var TMP_13, self = this, passes = nil; + if (self.passthroughs == null) self.passthroughs = nil; + + + + if (outer == null) { + outer = true; + }; + return (function() { try { + + passes = self.passthroughs; + return $send(text, 'gsub', [$$($nesting, 'PassSlotRx')], (TMP_13 = function(){var self = TMP_13.$$s || this, $a, pass = nil, subbed_text = nil, type = nil; + + + pass = passes['$[]']((($a = $gvars['~']) === nil ? nil : $a['$[]'](1)).$to_i()); + subbed_text = self.$apply_subs(pass['$[]']("text"), pass['$[]']("subs")); + if ($truthy((type = pass['$[]']("type")))) { + subbed_text = $$($nesting, 'Inline').$new(self, "quoted", subbed_text, $hash2(["type", "attributes"], {"type": type, "attributes": pass['$[]']("attributes")})).$convert()}; + if ($truthy(subbed_text['$include?']($$($nesting, 'PASS_START')))) { + return self.$restore_passthroughs(subbed_text, false) + } else { + return subbed_text + };}, TMP_13.$$s = self, TMP_13.$$arity = 0, TMP_13)); + } finally { + (function() {if ($truthy(outer)) { + return passes.$clear() + } else { + return nil + }; return nil; })() + }; })(); + }, TMP_Substitutors_restore_passthroughs_12.$$arity = -2); + if ($$($nesting, 'RUBY_ENGINE')['$==']("opal")) { + + + Opal.def(self, '$sub_quotes', TMP_Substitutors_sub_quotes_14 = function $$sub_quotes(text) { + var TMP_15, self = this, compat = nil; + if (self.document == null) self.document = nil; + + + if ($truthy($$($nesting, 'QuotedTextSniffRx')['$[]']((compat = self.document.$compat_mode()))['$match?'](text))) { + $send($$($nesting, 'QUOTE_SUBS')['$[]'](compat), 'each', [], (TMP_15 = function(type, scope, pattern){var self = TMP_15.$$s || this, TMP_16; + + + + if (type == null) { + type = nil; + }; + + if (scope == null) { + scope = nil; + }; + + if (pattern == null) { + pattern = nil; + }; + return (text = $send(text, 'gsub', [pattern], (TMP_16 = function(){var self = TMP_16.$$s || this; + if ($gvars["~"] == null) $gvars["~"] = nil; + + return self.$convert_quoted_text($gvars["~"], type, scope)}, TMP_16.$$s = self, TMP_16.$$arity = 0, TMP_16)));}, TMP_15.$$s = self, TMP_15.$$arity = 3, TMP_15))}; + return text; + }, TMP_Substitutors_sub_quotes_14.$$arity = 1); + + Opal.def(self, '$sub_replacements', TMP_Substitutors_sub_replacements_17 = function $$sub_replacements(text) { + var TMP_18, self = this; + + + if ($truthy($$($nesting, 'ReplaceableTextRx')['$match?'](text))) { + $send($$($nesting, 'REPLACEMENTS'), 'each', [], (TMP_18 = function(pattern, replacement, restore){var self = TMP_18.$$s || this, TMP_19; + + + + if (pattern == null) { + pattern = nil; + }; + + if (replacement == null) { + replacement = nil; + }; + + if (restore == null) { + restore = nil; + }; + return (text = $send(text, 'gsub', [pattern], (TMP_19 = function(){var self = TMP_19.$$s || this; + if ($gvars["~"] == null) $gvars["~"] = nil; + + return self.$do_replacement($gvars["~"], replacement, restore)}, TMP_19.$$s = self, TMP_19.$$arity = 0, TMP_19)));}, TMP_18.$$s = self, TMP_18.$$arity = 3, TMP_18))}; + return text; + }, TMP_Substitutors_sub_replacements_17.$$arity = 1); + } else { + nil + }; + if ($truthy($$$('::', 'RUBY_MIN_VERSION_1_9'))) { + + Opal.def(self, '$sub_specialchars', TMP_Substitutors_sub_specialchars_20 = function $$sub_specialchars(text) { + var $a, $b, self = this; + + if ($truthy(($truthy($a = ($truthy($b = text['$include?']("<")) ? $b : text['$include?']("&"))) ? $a : text['$include?'](">")))) { + + return text.$gsub($$($nesting, 'SpecialCharsRx'), $$($nesting, 'SpecialCharsTr')); + } else { + return text + } + }, TMP_Substitutors_sub_specialchars_20.$$arity = 1) + } else { + + Opal.def(self, '$sub_specialchars', TMP_Substitutors_sub_specialchars_21 = function $$sub_specialchars(text) { + var $a, $b, TMP_22, self = this; + + if ($truthy(($truthy($a = ($truthy($b = text['$include?']("<")) ? $b : text['$include?']("&"))) ? $a : text['$include?'](">")))) { + + return $send(text, 'gsub', [$$($nesting, 'SpecialCharsRx')], (TMP_22 = function(){var self = TMP_22.$$s || this, $c; + + return $$($nesting, 'SpecialCharsTr')['$[]']((($c = $gvars['~']) === nil ? nil : $c['$[]'](0)))}, TMP_22.$$s = self, TMP_22.$$arity = 0, TMP_22)); + } else { + return text + } + }, TMP_Substitutors_sub_specialchars_21.$$arity = 1) + }; + Opal.alias(self, "sub_specialcharacters", "sub_specialchars"); + + Opal.def(self, '$do_replacement', TMP_Substitutors_do_replacement_23 = function $$do_replacement(m, replacement, restore) { + var self = this, captured = nil, $case = nil; + + if ($truthy((captured = m['$[]'](0))['$include?']($$($nesting, 'RS')))) { + return captured.$sub($$($nesting, 'RS'), "") + } else { + return (function() {$case = restore; + if ("none"['$===']($case)) {return replacement} + else if ("bounding"['$===']($case)) {return "" + (m['$[]'](1)) + (replacement) + (m['$[]'](2))} + else {return "" + (m['$[]'](1)) + (replacement)}})() + } + }, TMP_Substitutors_do_replacement_23.$$arity = 3); + + Opal.def(self, '$sub_attributes', TMP_Substitutors_sub_attributes_24 = function $$sub_attributes(text, opts) { + var TMP_25, TMP_26, TMP_27, TMP_28, self = this, doc_attrs = nil, drop = nil, drop_line = nil, drop_empty_line = nil, attribute_undefined = nil, attribute_missing = nil, lines = nil; + if (self.document == null) self.document = nil; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + doc_attrs = self.document.$attributes(); + drop = (drop_line = (drop_empty_line = (attribute_undefined = (attribute_missing = nil)))); + text = $send(text, 'gsub', [$$($nesting, 'AttributeReferenceRx')], (TMP_25 = function(){var self = TMP_25.$$s || this, $a, $b, $c, $case = nil, args = nil, _ = nil, value = nil, key = nil; + if (self.document == null) self.document = nil; + + if ($truthy(($truthy($a = (($b = $gvars['~']) === nil ? nil : $b['$[]'](1))['$==']($$($nesting, 'RS'))) ? $a : (($b = $gvars['~']) === nil ? nil : $b['$[]'](4))['$==']($$($nesting, 'RS'))))) { + return "" + "{" + ((($a = $gvars['~']) === nil ? nil : $a['$[]'](2))) + "}" + } else if ($truthy((($a = $gvars['~']) === nil ? nil : $a['$[]'](3)))) { + return (function() {$case = (args = (($a = $gvars['~']) === nil ? nil : $a['$[]'](2)).$split(":", 3)).$shift(); + if ("set"['$===']($case)) { + $b = $$($nesting, 'Parser').$store_attribute(args['$[]'](0), ($truthy($c = args['$[]'](1)) ? $c : ""), self.document), $a = Opal.to_ary($b), (_ = ($a[0] == null ? nil : $a[0])), (value = ($a[1] == null ? nil : $a[1])), $b; + if ($truthy(($truthy($a = value) ? $a : (attribute_undefined = ($truthy($b = attribute_undefined) ? $b : ($truthy($c = doc_attrs['$[]']("attribute-undefined")) ? $c : $$($nesting, 'Compliance').$attribute_undefined())))['$!=']("drop-line")))) { + return (drop = (drop_empty_line = $$($nesting, 'DEL'))) + } else { + return (drop = (drop_line = $$($nesting, 'CAN'))) + };} + else if ("counter2"['$===']($case)) { + $send(self.document, 'counter', Opal.to_a(args)); + return (drop = (drop_empty_line = $$($nesting, 'DEL')));} + else {return $send(self.document, 'counter', Opal.to_a(args))}})() + } else if ($truthy(doc_attrs['$key?']((key = (($a = $gvars['~']) === nil ? nil : $a['$[]'](2)).$downcase())))) { + return doc_attrs['$[]'](key) + } else if ($truthy((value = $$($nesting, 'INTRINSIC_ATTRIBUTES')['$[]'](key)))) { + return value + } else { + return (function() {$case = (attribute_missing = ($truthy($a = attribute_missing) ? $a : ($truthy($b = ($truthy($c = opts['$[]']("attribute_missing")) ? $c : doc_attrs['$[]']("attribute-missing"))) ? $b : $$($nesting, 'Compliance').$attribute_missing()))); + if ("drop"['$===']($case)) {return (drop = (drop_empty_line = $$($nesting, 'DEL')))} + else if ("drop-line"['$===']($case)) { + self.$logger().$warn("" + "dropping line containing reference to missing attribute: " + (key)); + return (drop = (drop_line = $$($nesting, 'CAN')));} + else if ("warn"['$===']($case)) { + self.$logger().$warn("" + "skipping reference to missing attribute: " + (key)); + return (($a = $gvars['~']) === nil ? nil : $a['$[]'](0));} + else {return (($a = $gvars['~']) === nil ? nil : $a['$[]'](0))}})() + }}, TMP_25.$$s = self, TMP_25.$$arity = 0, TMP_25)); + if ($truthy(drop)) { + if ($truthy(drop_empty_line)) { + + lines = text.$tr_s($$($nesting, 'DEL'), $$($nesting, 'DEL')).$split($$($nesting, 'LF'), -1); + if ($truthy(drop_line)) { + return $send(lines, 'reject', [], (TMP_26 = function(line){var self = TMP_26.$$s || this, $a, $b, $c; + + + + if (line == null) { + line = nil; + }; + return ($truthy($a = ($truthy($b = ($truthy($c = line['$==']($$($nesting, 'DEL'))) ? $c : line['$==']($$($nesting, 'CAN')))) ? $b : line['$start_with?']($$($nesting, 'CAN')))) ? $a : line['$include?']($$($nesting, 'CAN')));}, TMP_26.$$s = self, TMP_26.$$arity = 1, TMP_26)).$join($$($nesting, 'LF')).$delete($$($nesting, 'DEL')) + } else { + return $send(lines, 'reject', [], (TMP_27 = function(line){var self = TMP_27.$$s || this; + + + + if (line == null) { + line = nil; + }; + return line['$==']($$($nesting, 'DEL'));}, TMP_27.$$s = self, TMP_27.$$arity = 1, TMP_27)).$join($$($nesting, 'LF')).$delete($$($nesting, 'DEL')) + }; + } else if ($truthy(text['$include?']($$($nesting, 'LF')))) { + return $send(text.$split($$($nesting, 'LF'), -1), 'reject', [], (TMP_28 = function(line){var self = TMP_28.$$s || this, $a, $b; + + + + if (line == null) { + line = nil; + }; + return ($truthy($a = ($truthy($b = line['$==']($$($nesting, 'CAN'))) ? $b : line['$start_with?']($$($nesting, 'CAN')))) ? $a : line['$include?']($$($nesting, 'CAN')));}, TMP_28.$$s = self, TMP_28.$$arity = 1, TMP_28)).$join($$($nesting, 'LF')) + } else { + return "" + } + } else { + return text + }; + }, TMP_Substitutors_sub_attributes_24.$$arity = -2); + + Opal.def(self, '$sub_macros', TMP_Substitutors_sub_macros_29 = function $$sub_macros(text) {try { + + var $a, $b, TMP_30, TMP_33, TMP_35, TMP_37, TMP_39, TMP_40, TMP_41, TMP_42, TMP_43, TMP_44, self = this, found = nil, found_square_bracket = nil, $writer = nil, found_colon = nil, found_macroish = nil, found_macroish_short = nil, doc_attrs = nil, doc = nil, extensions = nil; + if (self.document == null) self.document = nil; + + + found = $hash2([], {}); + found_square_bracket = (($writer = ["square_bracket", text['$include?']("[")]), $send(found, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]); + found_colon = text['$include?'](":"); + found_macroish = (($writer = ["macroish", ($truthy($a = found_square_bracket) ? found_colon : $a)]), $send(found, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]); + found_macroish_short = ($truthy($a = found_macroish) ? text['$include?'](":[") : $a); + doc_attrs = (doc = self.document).$attributes(); + if ($truthy(doc_attrs['$key?']("experimental"))) { + + if ($truthy(($truthy($a = found_macroish_short) ? ($truthy($b = text['$include?']("kbd:")) ? $b : text['$include?']("btn:")) : $a))) { + text = $send(text, 'gsub', [$$($nesting, 'InlineKbdBtnMacroRx')], (TMP_30 = function(){var self = TMP_30.$$s || this, $c, TMP_31, TMP_32, keys = nil, delim_idx = nil, delim = nil; + + if ($truthy((($c = $gvars['~']) === nil ? nil : $c['$[]'](1)))) { + return (($c = $gvars['~']) === nil ? nil : $c['$[]'](0)).$slice(1, (($c = $gvars['~']) === nil ? nil : $c['$[]'](0)).$length()) + } else if ((($c = $gvars['~']) === nil ? nil : $c['$[]'](2))['$==']("kbd")) { + + if ($truthy((keys = (($c = $gvars['~']) === nil ? nil : $c['$[]'](3)).$strip())['$include?']($$($nesting, 'R_SB')))) { + keys = keys.$gsub($$($nesting, 'ESC_R_SB'), $$($nesting, 'R_SB'))}; + if ($truthy(($truthy($c = $rb_gt(keys.$length(), 1)) ? (delim_idx = (function() {if ($truthy((delim_idx = keys.$index(",", 1)))) { + return [delim_idx, keys.$index("+", 1)].$compact().$min() + } else { + + return keys.$index("+", 1); + }; return nil; })()) : $c))) { + + delim = keys.$slice(delim_idx, 1); + if ($truthy(keys['$end_with?'](delim))) { + + keys = $send(keys.$chop().$split(delim, -1), 'map', [], (TMP_31 = function(key){var self = TMP_31.$$s || this; + + + + if (key == null) { + key = nil; + }; + return key.$strip();}, TMP_31.$$s = self, TMP_31.$$arity = 1, TMP_31)); + + $writer = [-1, "" + (keys['$[]'](-1)) + (delim)]; + $send(keys, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + } else { + keys = $send(keys.$split(delim), 'map', [], (TMP_32 = function(key){var self = TMP_32.$$s || this; + + + + if (key == null) { + key = nil; + }; + return key.$strip();}, TMP_32.$$s = self, TMP_32.$$arity = 1, TMP_32)) + }; + } else { + keys = [keys] + }; + return $$($nesting, 'Inline').$new(self, "kbd", nil, $hash2(["attributes"], {"attributes": $hash2(["keys"], {"keys": keys})})).$convert(); + } else { + return $$($nesting, 'Inline').$new(self, "button", self.$unescape_bracketed_text((($c = $gvars['~']) === nil ? nil : $c['$[]'](3)))).$convert() + }}, TMP_30.$$s = self, TMP_30.$$arity = 0, TMP_30))}; + if ($truthy(($truthy($a = found_macroish) ? text['$include?']("menu:") : $a))) { + text = $send(text, 'gsub', [$$($nesting, 'InlineMenuMacroRx')], (TMP_33 = function(){var self = TMP_33.$$s || this, $c, TMP_34, m = nil, menu = nil, items = nil, delim = nil, submenus = nil, menuitem = nil; + if ($gvars["~"] == null) $gvars["~"] = nil; + + + m = $gvars["~"]; + if ($truthy((($c = $gvars['~']) === nil ? nil : $c['$[]'](0))['$start_with?']($$($nesting, 'RS')))) { + return m['$[]'](0).$slice(1, m['$[]'](0).$length());}; + $c = [m['$[]'](1), m['$[]'](2)], (menu = $c[0]), (items = $c[1]), $c; + if ($truthy(items)) { + + if ($truthy(items['$include?']($$($nesting, 'R_SB')))) { + items = items.$gsub($$($nesting, 'ESC_R_SB'), $$($nesting, 'R_SB'))}; + if ($truthy((delim = (function() {if ($truthy(items['$include?'](">"))) { + return ">" + } else { + + if ($truthy(items['$include?'](","))) { + return "," + } else { + return nil + }; + }; return nil; })()))) { + + submenus = $send(items.$split(delim), 'map', [], (TMP_34 = function(it){var self = TMP_34.$$s || this; + + + + if (it == null) { + it = nil; + }; + return it.$strip();}, TMP_34.$$s = self, TMP_34.$$arity = 1, TMP_34)); + menuitem = submenus.$pop(); + } else { + $c = [[], items.$rstrip()], (submenus = $c[0]), (menuitem = $c[1]), $c + }; + } else { + $c = [[], nil], (submenus = $c[0]), (menuitem = $c[1]), $c + }; + return $$($nesting, 'Inline').$new(self, "menu", nil, $hash2(["attributes"], {"attributes": $hash2(["menu", "submenus", "menuitem"], {"menu": menu, "submenus": submenus, "menuitem": menuitem})})).$convert();}, TMP_33.$$s = self, TMP_33.$$arity = 0, TMP_33))}; + if ($truthy(($truthy($a = text['$include?']("\"")) ? text['$include?'](">") : $a))) { + text = $send(text, 'gsub', [$$($nesting, 'InlineMenuRx')], (TMP_35 = function(){var self = TMP_35.$$s || this, $c, $d, TMP_36, m = nil, input = nil, menu = nil, submenus = nil, menuitem = nil; + if ($gvars["~"] == null) $gvars["~"] = nil; + + + m = $gvars["~"]; + if ($truthy((($c = $gvars['~']) === nil ? nil : $c['$[]'](0))['$start_with?']($$($nesting, 'RS')))) { + return m['$[]'](0).$slice(1, m['$[]'](0).$length());}; + input = m['$[]'](1); + $d = $send(input.$split(">"), 'map', [], (TMP_36 = function(it){var self = TMP_36.$$s || this; + + + + if (it == null) { + it = nil; + }; + return it.$strip();}, TMP_36.$$s = self, TMP_36.$$arity = 1, TMP_36)), $c = Opal.to_ary($d), (menu = ($c[0] == null ? nil : $c[0])), (submenus = $slice.call($c, 1)), $d; + menuitem = submenus.$pop(); + return $$($nesting, 'Inline').$new(self, "menu", nil, $hash2(["attributes"], {"attributes": $hash2(["menu", "submenus", "menuitem"], {"menu": menu, "submenus": submenus, "menuitem": menuitem})})).$convert();}, TMP_35.$$s = self, TMP_35.$$arity = 0, TMP_35))};}; + if ($truthy(($truthy($a = (extensions = doc.$extensions())) ? extensions['$inline_macros?']() : $a))) { + $send(extensions.$inline_macros(), 'each', [], (TMP_37 = function(extension){var self = TMP_37.$$s || this, TMP_38; + + + + if (extension == null) { + extension = nil; + }; + return (text = $send(text, 'gsub', [extension.$instance().$regexp()], (TMP_38 = function(){var self = TMP_38.$$s || this, $c, m = nil, target = nil, content = nil, extconf = nil, attributes = nil, replacement = nil; + if ($gvars["~"] == null) $gvars["~"] = nil; + + + m = $gvars["~"]; + if ($truthy((($c = $gvars['~']) === nil ? nil : $c['$[]'](0))['$start_with?']($$($nesting, 'RS')))) { + return m['$[]'](0).$slice(1, m['$[]'](0).$length());}; + if ($truthy((function() { try { + return m.$names() + } catch ($err) { + if (Opal.rescue($err, [$$($nesting, 'StandardError')])) { + try { + return [] + } finally { Opal.pop_exception() } + } else { throw $err; } + }})()['$empty?']())) { + $c = [m['$[]'](1), m['$[]'](2), extension.$config()], (target = $c[0]), (content = $c[1]), (extconf = $c[2]), $c + } else { + $c = [(function() { try { + return m['$[]']("target") + } catch ($err) { + if (Opal.rescue($err, [$$($nesting, 'StandardError')])) { + try { + return nil + } finally { Opal.pop_exception() } + } else { throw $err; } + }})(), (function() { try { + return m['$[]']("content") + } catch ($err) { + if (Opal.rescue($err, [$$($nesting, 'StandardError')])) { + try { + return nil + } finally { Opal.pop_exception() } + } else { throw $err; } + }})(), extension.$config()], (target = $c[0]), (content = $c[1]), (extconf = $c[2]), $c + }; + attributes = (function() {if ($truthy((attributes = extconf['$[]']("default_attrs")))) { + return attributes.$dup() + } else { + return $hash2([], {}) + }; return nil; })(); + if ($truthy(content['$nil_or_empty?']())) { + if ($truthy(($truthy($c = content) ? extconf['$[]']("content_model")['$!=']("attributes") : $c))) { + + $writer = ["text", content]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];} + } else { + + content = self.$unescape_bracketed_text(content); + if (extconf['$[]']("content_model")['$==']("attributes")) { + self.$parse_attributes(content, ($truthy($c = extconf['$[]']("pos_attrs")) ? $c : []), $hash2(["into"], {"into": attributes})) + } else { + + $writer = ["text", content]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + }; + replacement = extension.$process_method()['$[]'](self, ($truthy($c = target) ? $c : content), attributes); + if ($truthy($$($nesting, 'Inline')['$==='](replacement))) { + return replacement.$convert() + } else { + return replacement + };}, TMP_38.$$s = self, TMP_38.$$arity = 0, TMP_38)));}, TMP_37.$$s = self, TMP_37.$$arity = 1, TMP_37))}; + if ($truthy(($truthy($a = found_macroish) ? ($truthy($b = text['$include?']("image:")) ? $b : text['$include?']("icon:")) : $a))) { + text = $send(text, 'gsub', [$$($nesting, 'InlineImageMacroRx')], (TMP_39 = function(){var self = TMP_39.$$s || this, $c, m = nil, captured = nil, type = nil, posattrs = nil, target = nil, attrs = nil; + if ($gvars["~"] == null) $gvars["~"] = nil; + + + m = $gvars["~"]; + if ($truthy((captured = (($c = $gvars['~']) === nil ? nil : $c['$[]'](0)))['$start_with?']($$($nesting, 'RS')))) { + return captured.$slice(1, captured.$length()); + } else if ($truthy(captured['$start_with?']("icon:"))) { + $c = ["icon", ["size"]], (type = $c[0]), (posattrs = $c[1]), $c + } else { + $c = ["image", ["alt", "width", "height"]], (type = $c[0]), (posattrs = $c[1]), $c + }; + if ($truthy((target = m['$[]'](1))['$include?']($$($nesting, 'ATTR_REF_HEAD')))) { + target = self.$sub_attributes(target)}; + attrs = self.$parse_attributes(m['$[]'](2), posattrs, $hash2(["unescape_input"], {"unescape_input": true})); + if (type['$==']("icon")) { + } else { + doc.$register("images", [target, (($writer = ["imagesdir", doc_attrs['$[]']("imagesdir")]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])]) + }; + ($truthy($c = attrs['$[]']("alt")) ? $c : (($writer = ["alt", (($writer = ["default-alt", $$($nesting, 'Helpers').$basename(target, true).$tr("_-", " ")]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + return $$($nesting, 'Inline').$new(self, "image", nil, $hash2(["type", "target", "attributes"], {"type": type, "target": target, "attributes": attrs})).$convert();}, TMP_39.$$s = self, TMP_39.$$arity = 0, TMP_39))}; + if ($truthy(($truthy($a = ($truthy($b = text['$include?']("((")) ? text['$include?']("))") : $b)) ? $a : ($truthy($b = found_macroish_short) ? text['$include?']("dexterm") : $b)))) { + text = $send(text, 'gsub', [$$($nesting, 'InlineIndextermMacroRx')], (TMP_40 = function(){var self = TMP_40.$$s || this, $c, captured = nil, $case = nil, terms = nil, term = nil, visible = nil, before = nil, after = nil, subbed_term = nil; + + + captured = (($c = $gvars['~']) === nil ? nil : $c['$[]'](0)); + return (function() {$case = (($c = $gvars['~']) === nil ? nil : $c['$[]'](1)); + if ("indexterm"['$===']($case)) { + text = (($c = $gvars['~']) === nil ? nil : $c['$[]'](2)); + if ($truthy(captured['$start_with?']($$($nesting, 'RS')))) { + return captured.$slice(1, captured.$length());}; + terms = self.$split_simple_csv(self.$normalize_string(text, true)); + doc.$register("indexterms", terms); + return $$($nesting, 'Inline').$new(self, "indexterm", nil, $hash2(["attributes"], {"attributes": $hash2(["terms"], {"terms": terms})})).$convert();} + else if ("indexterm2"['$===']($case)) { + text = (($c = $gvars['~']) === nil ? nil : $c['$[]'](2)); + if ($truthy(captured['$start_with?']($$($nesting, 'RS')))) { + return captured.$slice(1, captured.$length());}; + term = self.$normalize_string(text, true); + doc.$register("indexterms", [term]); + return $$($nesting, 'Inline').$new(self, "indexterm", term, $hash2(["type"], {"type": "visible"})).$convert();} + else { + text = (($c = $gvars['~']) === nil ? nil : $c['$[]'](3)); + if ($truthy(captured['$start_with?']($$($nesting, 'RS')))) { + if ($truthy(($truthy($c = text['$start_with?']("(")) ? text['$end_with?'](")") : $c))) { + + text = text.$slice(1, $rb_minus(text.$length(), 2)); + $c = [true, "(", ")"], (visible = $c[0]), (before = $c[1]), (after = $c[2]), $c; + } else { + return captured.$slice(1, captured.$length()); + } + } else { + + visible = true; + if ($truthy(text['$start_with?']("("))) { + if ($truthy(text['$end_with?'](")"))) { + $c = [text.$slice(1, $rb_minus(text.$length(), 2)), false], (text = $c[0]), (visible = $c[1]), $c + } else { + $c = [text.$slice(1, text.$length()), "(", ""], (text = $c[0]), (before = $c[1]), (after = $c[2]), $c + } + } else if ($truthy(text['$end_with?'](")"))) { + $c = [text.$slice(0, $rb_minus(text.$length(), 1)), "", ")"], (text = $c[0]), (before = $c[1]), (after = $c[2]), $c}; + }; + if ($truthy(visible)) { + + term = self.$normalize_string(text); + doc.$register("indexterms", [term]); + subbed_term = $$($nesting, 'Inline').$new(self, "indexterm", term, $hash2(["type"], {"type": "visible"})).$convert(); + } else { + + terms = self.$split_simple_csv(self.$normalize_string(text)); + doc.$register("indexterms", terms); + subbed_term = $$($nesting, 'Inline').$new(self, "indexterm", nil, $hash2(["attributes"], {"attributes": $hash2(["terms"], {"terms": terms})})).$convert(); + }; + if ($truthy(before)) { + return "" + (before) + (subbed_term) + (after) + } else { + return subbed_term + };}})();}, TMP_40.$$s = self, TMP_40.$$arity = 0, TMP_40))}; + if ($truthy(($truthy($a = found_colon) ? text['$include?']("://") : $a))) { + text = $send(text, 'gsub', [$$($nesting, 'InlineLinkRx')], (TMP_41 = function(){var self = TMP_41.$$s || this, $c, $d, m = nil, target = nil, macro = nil, prefix = nil, suffix = nil, $case = nil, attrs = nil, link_opts = nil; + if ($gvars["~"] == null) $gvars["~"] = nil; + + + m = $gvars["~"]; + if ($truthy((target = (($c = $gvars['~']) === nil ? nil : $c['$[]'](2)))['$start_with?']($$($nesting, 'RS')))) { + return "" + (m['$[]'](1)) + (target.$slice(1, target.$length())) + (m['$[]'](3));}; + $c = [m['$[]'](1), ($truthy($d = (macro = m['$[]'](3))) ? $d : ""), ""], (prefix = $c[0]), (text = $c[1]), (suffix = $c[2]), $c; + if (prefix['$==']("link:")) { + if ($truthy(macro)) { + prefix = "" + } else { + return m['$[]'](0); + }}; + if ($truthy(($truthy($c = macro) ? $c : $$($nesting, 'UriTerminatorRx')['$!~'](target)))) { + } else { + + $case = (($c = $gvars['~']) === nil ? nil : $c['$[]'](0)); + if (")"['$===']($case)) { + target = target.$chop(); + suffix = ")";} + else if (";"['$===']($case)) {if ($truthy(($truthy($c = prefix['$start_with?']("<")) ? target['$end_with?'](">") : $c))) { + + prefix = prefix.$slice(4, prefix.$length()); + target = target.$slice(0, $rb_minus(target.$length(), 4)); + } else if ($truthy((target = target.$chop())['$end_with?'](")"))) { + + target = target.$chop(); + suffix = ");"; + } else { + suffix = ";" + }} + else if (":"['$===']($case)) {if ($truthy((target = target.$chop())['$end_with?'](")"))) { + + target = target.$chop(); + suffix = "):"; + } else { + suffix = ":" + }}; + if ($truthy(target['$end_with?']("://"))) { + Opal.ret(m['$[]'](0))}; + }; + $c = [nil, $hash2(["type"], {"type": "link"})], (attrs = $c[0]), (link_opts = $c[1]), $c; + if ($truthy(text['$empty?']())) { + } else { + + if ($truthy(text['$include?']($$($nesting, 'R_SB')))) { + text = text.$gsub($$($nesting, 'ESC_R_SB'), $$($nesting, 'R_SB'))}; + if ($truthy(($truthy($c = doc.$compat_mode()['$!']()) ? text['$include?']("=") : $c))) { + + text = ($truthy($c = (attrs = $$($nesting, 'AttributeList').$new(text, self).$parse())['$[]'](1)) ? $c : ""); + if ($truthy(attrs['$key?']("id"))) { + + $writer = ["id", attrs.$delete("id")]; + $send(link_opts, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];};}; + if ($truthy(text['$end_with?']("^"))) { + + text = text.$chop(); + if ($truthy(attrs)) { + ($truthy($c = attrs['$[]']("window")) ? $c : (($writer = ["window", "_blank"]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])) + } else { + attrs = $hash2(["window"], {"window": "_blank"}) + };}; + }; + if ($truthy(text['$empty?']())) { + + text = (function() {if ($truthy(doc_attrs['$key?']("hide-uri-scheme"))) { + + return target.$sub($$($nesting, 'UriSniffRx'), ""); + } else { + return target + }; return nil; })(); + if ($truthy(attrs)) { + + $writer = ["role", (function() {if ($truthy(attrs['$key?']("role"))) { + return "" + "bare " + (attrs['$[]']("role")) + } else { + return "bare" + }; return nil; })()]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + } else { + attrs = $hash2(["role"], {"role": "bare"}) + };}; + doc.$register("links", (($writer = ["target", target]), $send(link_opts, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + if ($truthy(attrs)) { + + $writer = ["attributes", attrs]; + $send(link_opts, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + return "" + (prefix) + ($$($nesting, 'Inline').$new(self, "anchor", text, link_opts).$convert()) + (suffix);}, TMP_41.$$s = self, TMP_41.$$arity = 0, TMP_41))}; + if ($truthy(($truthy($a = found_macroish) ? ($truthy($b = text['$include?']("link:")) ? $b : text['$include?']("mailto:")) : $a))) { + text = $send(text, 'gsub', [$$($nesting, 'InlineLinkMacroRx')], (TMP_42 = function(){var self = TMP_42.$$s || this, $c, m = nil, target = nil, mailto = nil, attrs = nil, link_opts = nil; + if ($gvars["~"] == null) $gvars["~"] = nil; + + + m = $gvars["~"]; + if ($truthy((($c = $gvars['~']) === nil ? nil : $c['$[]'](0))['$start_with?']($$($nesting, 'RS')))) { + return m['$[]'](0).$slice(1, m['$[]'](0).$length());}; + target = (function() {if ($truthy((mailto = m['$[]'](1)))) { + return "" + "mailto:" + (m['$[]'](2)) + } else { + return m['$[]'](2) + }; return nil; })(); + $c = [nil, $hash2(["type"], {"type": "link"})], (attrs = $c[0]), (link_opts = $c[1]), $c; + if ($truthy((text = m['$[]'](3))['$empty?']())) { + } else { + + if ($truthy(text['$include?']($$($nesting, 'R_SB')))) { + text = text.$gsub($$($nesting, 'ESC_R_SB'), $$($nesting, 'R_SB'))}; + if ($truthy(mailto)) { + if ($truthy(($truthy($c = doc.$compat_mode()['$!']()) ? text['$include?'](",") : $c))) { + + text = ($truthy($c = (attrs = $$($nesting, 'AttributeList').$new(text, self).$parse())['$[]'](1)) ? $c : ""); + if ($truthy(attrs['$key?']("id"))) { + + $writer = ["id", attrs.$delete("id")]; + $send(link_opts, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if ($truthy(attrs['$key?'](2))) { + if ($truthy(attrs['$key?'](3))) { + target = "" + (target) + "?subject=" + ($$($nesting, 'Helpers').$uri_encode(attrs['$[]'](2))) + "&body=" + ($$($nesting, 'Helpers').$uri_encode(attrs['$[]'](3))) + } else { + target = "" + (target) + "?subject=" + ($$($nesting, 'Helpers').$uri_encode(attrs['$[]'](2))) + }};} + } else if ($truthy(($truthy($c = doc.$compat_mode()['$!']()) ? text['$include?']("=") : $c))) { + + text = ($truthy($c = (attrs = $$($nesting, 'AttributeList').$new(text, self).$parse())['$[]'](1)) ? $c : ""); + if ($truthy(attrs['$key?']("id"))) { + + $writer = ["id", attrs.$delete("id")]; + $send(link_opts, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];};}; + if ($truthy(text['$end_with?']("^"))) { + + text = text.$chop(); + if ($truthy(attrs)) { + ($truthy($c = attrs['$[]']("window")) ? $c : (($writer = ["window", "_blank"]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])) + } else { + attrs = $hash2(["window"], {"window": "_blank"}) + };}; + }; + if ($truthy(text['$empty?']())) { + if ($truthy(mailto)) { + text = m['$[]'](2) + } else { + + if ($truthy(doc_attrs['$key?']("hide-uri-scheme"))) { + if ($truthy((text = target.$sub($$($nesting, 'UriSniffRx'), ""))['$empty?']())) { + text = target} + } else { + text = target + }; + if ($truthy(attrs)) { + + $writer = ["role", (function() {if ($truthy(attrs['$key?']("role"))) { + return "" + "bare " + (attrs['$[]']("role")) + } else { + return "bare" + }; return nil; })()]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + } else { + attrs = $hash2(["role"], {"role": "bare"}) + }; + }}; + doc.$register("links", (($writer = ["target", target]), $send(link_opts, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + if ($truthy(attrs)) { + + $writer = ["attributes", attrs]; + $send(link_opts, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + return $$($nesting, 'Inline').$new(self, "anchor", text, link_opts).$convert();}, TMP_42.$$s = self, TMP_42.$$arity = 0, TMP_42))}; + if ($truthy(text['$include?']("@"))) { + text = $send(text, 'gsub', [$$($nesting, 'InlineEmailRx')], (TMP_43 = function(){var self = TMP_43.$$s || this, $c, $d, address = nil, tip = nil, target = nil; + + + $c = [(($d = $gvars['~']) === nil ? nil : $d['$[]'](0)), (($d = $gvars['~']) === nil ? nil : $d['$[]'](1))], (address = $c[0]), (tip = $c[1]), $c; + if ($truthy(tip)) { + return (function() {if (tip['$==']($$($nesting, 'RS'))) { + + return address.$slice(1, address.$length()); + } else { + return address + }; return nil; })();}; + target = "" + "mailto:" + (address); + doc.$register("links", target); + return $$($nesting, 'Inline').$new(self, "anchor", address, $hash2(["type", "target"], {"type": "link", "target": target})).$convert();}, TMP_43.$$s = self, TMP_43.$$arity = 0, TMP_43))}; + if ($truthy(($truthy($a = found_macroish) ? text['$include?']("tnote") : $a))) { + text = $send(text, 'gsub', [$$($nesting, 'InlineFootnoteMacroRx')], (TMP_44 = function(){var self = TMP_44.$$s || this, $c, $d, $e, TMP_45, m = nil, id = nil, index = nil, type = nil, target = nil, footnote = nil; + if ($gvars["~"] == null) $gvars["~"] = nil; + + + m = $gvars["~"]; + if ($truthy((($c = $gvars['~']) === nil ? nil : $c['$[]'](0))['$start_with?']($$($nesting, 'RS')))) { + return m['$[]'](0).$slice(1, m['$[]'](0).$length());}; + if ($truthy(m['$[]'](1))) { + $d = ($truthy($e = m['$[]'](3)) ? $e : "").$split(",", 2), $c = Opal.to_ary($d), (id = ($c[0] == null ? nil : $c[0])), (text = ($c[1] == null ? nil : $c[1])), $d + } else { + $c = [m['$[]'](2), m['$[]'](3)], (id = $c[0]), (text = $c[1]), $c + }; + if ($truthy(id)) { + if ($truthy(text)) { + + text = self.$restore_passthroughs(self.$sub_inline_xrefs(self.$sub_inline_anchors(self.$normalize_string(text, true))), false); + index = doc.$counter("footnote-number"); + doc.$register("footnotes", $$$($$($nesting, 'Document'), 'Footnote').$new(index, id, text)); + $c = ["ref", nil], (type = $c[0]), (target = $c[1]), $c; + } else { + + if ($truthy((footnote = $send(doc.$footnotes(), 'find', [], (TMP_45 = function(candidate){var self = TMP_45.$$s || this; + + + + if (candidate == null) { + candidate = nil; + }; + return candidate.$id()['$=='](id);}, TMP_45.$$s = self, TMP_45.$$arity = 1, TMP_45))))) { + $c = [footnote.$index(), footnote.$text()], (index = $c[0]), (text = $c[1]), $c + } else { + + self.$logger().$warn("" + "invalid footnote reference: " + (id)); + $c = [nil, id], (index = $c[0]), (text = $c[1]), $c; + }; + $c = ["xref", id, nil], (type = $c[0]), (target = $c[1]), (id = $c[2]), $c; + } + } else if ($truthy(text)) { + + text = self.$restore_passthroughs(self.$sub_inline_xrefs(self.$sub_inline_anchors(self.$normalize_string(text, true))), false); + index = doc.$counter("footnote-number"); + doc.$register("footnotes", $$$($$($nesting, 'Document'), 'Footnote').$new(index, id, text)); + type = (target = nil); + } else { + return m['$[]'](0); + }; + return $$($nesting, 'Inline').$new(self, "footnote", text, $hash2(["attributes", "id", "target", "type"], {"attributes": $hash2(["index"], {"index": index}), "id": id, "target": target, "type": type})).$convert();}, TMP_44.$$s = self, TMP_44.$$arity = 0, TMP_44))}; + return self.$sub_inline_xrefs(self.$sub_inline_anchors(text, found), found); + } catch ($returner) { if ($returner === Opal.returner) { return $returner.$v } throw $returner; } + }, TMP_Substitutors_sub_macros_29.$$arity = 1); + + Opal.def(self, '$sub_inline_anchors', TMP_Substitutors_sub_inline_anchors_46 = function $$sub_inline_anchors(text, found) { + var $a, TMP_47, $b, $c, TMP_48, self = this; + if (self.context == null) self.context = nil; + if (self.parent == null) self.parent = nil; + + + + if (found == null) { + found = nil; + }; + if ($truthy((($a = self.context['$==']("list_item")) ? self.parent.$style()['$==']("bibliography") : self.context['$==']("list_item")))) { + text = $send(text, 'sub', [$$($nesting, 'InlineBiblioAnchorRx')], (TMP_47 = function(){var self = TMP_47.$$s || this, $b, $c; + + return $$($nesting, 'Inline').$new(self, "anchor", "" + "[" + (($truthy($b = (($c = $gvars['~']) === nil ? nil : $c['$[]'](2))) ? $b : (($c = $gvars['~']) === nil ? nil : $c['$[]'](1)))) + "]", $hash2(["type", "id", "target"], {"type": "bibref", "id": (($b = $gvars['~']) === nil ? nil : $b['$[]'](1)), "target": (($b = $gvars['~']) === nil ? nil : $b['$[]'](1))})).$convert()}, TMP_47.$$s = self, TMP_47.$$arity = 0, TMP_47))}; + if ($truthy(($truthy($a = ($truthy($b = ($truthy($c = found['$!']()) ? $c : found['$[]']("square_bracket"))) ? text['$include?']("[[") : $b)) ? $a : ($truthy($b = ($truthy($c = found['$!']()) ? $c : found['$[]']("macroish"))) ? text['$include?']("or:") : $b)))) { + text = $send(text, 'gsub', [$$($nesting, 'InlineAnchorRx')], (TMP_48 = function(){var self = TMP_48.$$s || this, $d, $e, id = nil, reftext = nil; + + + if ($truthy((($d = $gvars['~']) === nil ? nil : $d['$[]'](1)))) { + return (($d = $gvars['~']) === nil ? nil : $d['$[]'](0)).$slice(1, (($d = $gvars['~']) === nil ? nil : $d['$[]'](0)).$length());}; + if ($truthy((id = (($d = $gvars['~']) === nil ? nil : $d['$[]'](2))))) { + reftext = (($d = $gvars['~']) === nil ? nil : $d['$[]'](3)) + } else { + + id = (($d = $gvars['~']) === nil ? nil : $d['$[]'](4)); + if ($truthy(($truthy($d = (reftext = (($e = $gvars['~']) === nil ? nil : $e['$[]'](5)))) ? reftext['$include?']($$($nesting, 'R_SB')) : $d))) { + reftext = reftext.$gsub($$($nesting, 'ESC_R_SB'), $$($nesting, 'R_SB'))}; + }; + return $$($nesting, 'Inline').$new(self, "anchor", reftext, $hash2(["type", "id", "target"], {"type": "ref", "id": id, "target": id})).$convert();}, TMP_48.$$s = self, TMP_48.$$arity = 0, TMP_48))}; + return text; + }, TMP_Substitutors_sub_inline_anchors_46.$$arity = -2); + + Opal.def(self, '$sub_inline_xrefs', TMP_Substitutors_sub_inline_xrefs_49 = function $$sub_inline_xrefs(content, found) { + var $a, $b, TMP_50, self = this; + + + + if (found == null) { + found = nil; + }; + if ($truthy(($truthy($a = ($truthy($b = (function() {if ($truthy(found)) { + return found['$[]']("macroish") + } else { + + return content['$include?']("["); + }; return nil; })()) ? content['$include?']("xref:") : $b)) ? $a : ($truthy($b = content['$include?']("&")) ? content['$include?']("lt;&") : $b)))) { + content = $send(content, 'gsub', [$$($nesting, 'InlineXrefMacroRx')], (TMP_50 = function(){var self = TMP_50.$$s || this, $c, $d, m = nil, attrs = nil, doc = nil, refid = nil, text = nil, macro = nil, fragment = nil, hash_idx = nil, fragment_len = nil, path = nil, ext = nil, src2src = nil, target = nil; + if (self.document == null) self.document = nil; + if ($gvars["~"] == null) $gvars["~"] = nil; + if ($gvars.VERBOSE == null) $gvars.VERBOSE = nil; + + + m = $gvars["~"]; + if ($truthy((($c = $gvars['~']) === nil ? nil : $c['$[]'](0))['$start_with?']($$($nesting, 'RS')))) { + return m['$[]'](0).$slice(1, m['$[]'](0).$length());}; + $c = [$hash2([], {}), self.document], (attrs = $c[0]), (doc = $c[1]), $c; + if ($truthy((refid = m['$[]'](1)))) { + + $d = refid.$split(",", 2), $c = Opal.to_ary($d), (refid = ($c[0] == null ? nil : $c[0])), (text = ($c[1] == null ? nil : $c[1])), $d; + if ($truthy(text)) { + text = text.$lstrip()}; + } else { + + macro = true; + refid = m['$[]'](2); + if ($truthy((text = m['$[]'](3)))) { + + if ($truthy(text['$include?']($$($nesting, 'R_SB')))) { + text = text.$gsub($$($nesting, 'ESC_R_SB'), $$($nesting, 'R_SB'))}; + if ($truthy(($truthy($c = doc.$compat_mode()['$!']()) ? text['$include?']("=") : $c))) { + text = $$($nesting, 'AttributeList').$new(text, self).$parse_into(attrs)['$[]'](1)};}; + }; + if ($truthy(doc.$compat_mode())) { + fragment = refid + } else if ($truthy((hash_idx = refid.$index("#")))) { + if ($truthy($rb_gt(hash_idx, 0))) { + + if ($truthy($rb_gt((fragment_len = $rb_minus($rb_minus(refid.$length(), hash_idx), 1)), 0))) { + $c = [refid.$slice(0, hash_idx), refid.$slice($rb_plus(hash_idx, 1), fragment_len)], (path = $c[0]), (fragment = $c[1]), $c + } else { + path = refid.$slice(0, hash_idx) + }; + if ($truthy((ext = $$$('::', 'File').$extname(path))['$empty?']())) { + src2src = path + } else if ($truthy($$($nesting, 'ASCIIDOC_EXTENSIONS')['$[]'](ext))) { + src2src = (path = path.$slice(0, $rb_minus(path.$length(), ext.$length())))}; + } else { + $c = [refid, refid.$slice(1, refid.$length())], (target = $c[0]), (fragment = $c[1]), $c + } + } else if ($truthy(($truthy($c = macro) ? refid['$end_with?'](".adoc") : $c))) { + src2src = (path = refid.$slice(0, $rb_minus(refid.$length(), 5))) + } else { + fragment = refid + }; + if ($truthy(target)) { + + refid = fragment; + if ($truthy(($truthy($c = $gvars.VERBOSE) ? doc.$catalog()['$[]']("ids")['$key?'](refid)['$!']() : $c))) { + self.$logger().$warn("" + "invalid reference: " + (refid))}; + } else if ($truthy(path)) { + if ($truthy(($truthy($c = src2src) ? ($truthy($d = doc.$attributes()['$[]']("docname")['$=='](path)) ? $d : doc.$catalog()['$[]']("includes")['$[]'](path)) : $c))) { + if ($truthy(fragment)) { + + $c = [fragment, nil, "" + "#" + (fragment)], (refid = $c[0]), (path = $c[1]), (target = $c[2]), $c; + if ($truthy(($truthy($c = $gvars.VERBOSE) ? doc.$catalog()['$[]']("ids")['$key?'](refid)['$!']() : $c))) { + self.$logger().$warn("" + "invalid reference: " + (refid))}; + } else { + $c = [nil, nil, "#"], (refid = $c[0]), (path = $c[1]), (target = $c[2]), $c + } + } else { + + $c = [path, "" + (doc.$attributes()['$[]']("relfileprefix")) + (path) + ((function() {if ($truthy(src2src)) { + + return doc.$attributes().$fetch("relfilesuffix", doc.$outfilesuffix()); + } else { + return "" + }; return nil; })())], (refid = $c[0]), (path = $c[1]), $c; + if ($truthy(fragment)) { + $c = ["" + (refid) + "#" + (fragment), "" + (path) + "#" + (fragment)], (refid = $c[0]), (target = $c[1]), $c + } else { + target = path + }; + } + } else if ($truthy(($truthy($c = doc.$compat_mode()) ? $c : $$($nesting, 'Compliance').$natural_xrefs()['$!']()))) { + + $c = [fragment, "" + "#" + (fragment)], (refid = $c[0]), (target = $c[1]), $c; + if ($truthy(($truthy($c = $gvars.VERBOSE) ? doc.$catalog()['$[]']("ids")['$key?'](refid)['$!']() : $c))) { + self.$logger().$warn("" + "invalid reference: " + (refid))}; + } else if ($truthy(doc.$catalog()['$[]']("ids")['$key?'](fragment))) { + $c = [fragment, "" + "#" + (fragment)], (refid = $c[0]), (target = $c[1]), $c + } else if ($truthy(($truthy($c = (refid = doc.$catalog()['$[]']("ids").$key(fragment))) ? ($truthy($d = fragment['$include?'](" ")) ? $d : fragment.$downcase()['$!='](fragment)) : $c))) { + $c = [refid, "" + "#" + (refid)], (fragment = $c[0]), (target = $c[1]), $c + } else { + + $c = [fragment, "" + "#" + (fragment)], (refid = $c[0]), (target = $c[1]), $c; + if ($truthy($gvars.VERBOSE)) { + self.$logger().$warn("" + "invalid reference: " + (refid))}; + }; + $c = [path, fragment, refid], attrs['$[]=']("path", $c[0]), attrs['$[]=']("fragment", $c[1]), attrs['$[]=']("refid", $c[2]), $c; + return $$($nesting, 'Inline').$new(self, "anchor", text, $hash2(["type", "target", "attributes"], {"type": "xref", "target": target, "attributes": attrs})).$convert();}, TMP_50.$$s = self, TMP_50.$$arity = 0, TMP_50))}; + return content; + }, TMP_Substitutors_sub_inline_xrefs_49.$$arity = -2); + + Opal.def(self, '$sub_callouts', TMP_Substitutors_sub_callouts_51 = function $$sub_callouts(text) { + var TMP_52, self = this, callout_rx = nil, autonum = nil; + + + callout_rx = (function() {if ($truthy(self['$attr?']("line-comment"))) { + return $$($nesting, 'CalloutSourceRxMap')['$[]'](self.$attr("line-comment")) + } else { + return $$($nesting, 'CalloutSourceRx') + }; return nil; })(); + autonum = 0; + return $send(text, 'gsub', [callout_rx], (TMP_52 = function(){var self = TMP_52.$$s || this, $a; + if (self.document == null) self.document = nil; + + if ($truthy((($a = $gvars['~']) === nil ? nil : $a['$[]'](2)))) { + return (($a = $gvars['~']) === nil ? nil : $a['$[]'](0)).$sub($$($nesting, 'RS'), "") + } else { + return $$($nesting, 'Inline').$new(self, "callout", (function() {if ((($a = $gvars['~']) === nil ? nil : $a['$[]'](4))['$=='](".")) { + return (autonum = $rb_plus(autonum, 1)).$to_s() + } else { + return (($a = $gvars['~']) === nil ? nil : $a['$[]'](4)) + }; return nil; })(), $hash2(["id", "attributes"], {"id": self.document.$callouts().$read_next_id(), "attributes": $hash2(["guard"], {"guard": (($a = $gvars['~']) === nil ? nil : $a['$[]'](1))})})).$convert() + }}, TMP_52.$$s = self, TMP_52.$$arity = 0, TMP_52)); + }, TMP_Substitutors_sub_callouts_51.$$arity = 1); + + Opal.def(self, '$sub_post_replacements', TMP_Substitutors_sub_post_replacements_53 = function $$sub_post_replacements(text) { + var $a, TMP_54, TMP_55, self = this, lines = nil, last = nil; + if (self.document == null) self.document = nil; + if (self.attributes == null) self.attributes = nil; + + if ($truthy(($truthy($a = self.document.$attributes()['$key?']("hardbreaks")) ? $a : self.attributes['$key?']("hardbreaks-option")))) { + + lines = text.$split($$($nesting, 'LF'), -1); + if ($truthy($rb_lt(lines.$size(), 2))) { + return text}; + last = lines.$pop(); + return $send(lines, 'map', [], (TMP_54 = function(line){var self = TMP_54.$$s || this; + + + + if (line == null) { + line = nil; + }; + return $$($nesting, 'Inline').$new(self, "break", (function() {if ($truthy(line['$end_with?']($$($nesting, 'HARD_LINE_BREAK')))) { + + return line.$slice(0, $rb_minus(line.$length(), 2)); + } else { + return line + }; return nil; })(), $hash2(["type"], {"type": "line"})).$convert();}, TMP_54.$$s = self, TMP_54.$$arity = 1, TMP_54))['$<<'](last).$join($$($nesting, 'LF')); + } else if ($truthy(($truthy($a = text['$include?']($$($nesting, 'PLUS'))) ? text['$include?']($$($nesting, 'HARD_LINE_BREAK')) : $a))) { + return $send(text, 'gsub', [$$($nesting, 'HardLineBreakRx')], (TMP_55 = function(){var self = TMP_55.$$s || this, $b; + + return $$($nesting, 'Inline').$new(self, "break", (($b = $gvars['~']) === nil ? nil : $b['$[]'](1)), $hash2(["type"], {"type": "line"})).$convert()}, TMP_55.$$s = self, TMP_55.$$arity = 0, TMP_55)) + } else { + return text + } + }, TMP_Substitutors_sub_post_replacements_53.$$arity = 1); + + Opal.def(self, '$convert_quoted_text', TMP_Substitutors_convert_quoted_text_56 = function $$convert_quoted_text(match, type, scope) { + var $a, self = this, attrs = nil, unescaped_attrs = nil, attrlist = nil, id = nil, attributes = nil; + + + if ($truthy(match['$[]'](0)['$start_with?']($$($nesting, 'RS')))) { + if ($truthy((($a = scope['$==']("constrained")) ? (attrs = match['$[]'](2)) : scope['$==']("constrained")))) { + unescaped_attrs = "" + "[" + (attrs) + "]" + } else { + return match['$[]'](0).$slice(1, match['$[]'](0).$length()) + }}; + if (scope['$==']("constrained")) { + if ($truthy(unescaped_attrs)) { + return "" + (unescaped_attrs) + ($$($nesting, 'Inline').$new(self, "quoted", match['$[]'](3), $hash2(["type"], {"type": type})).$convert()) + } else { + + if ($truthy((attrlist = match['$[]'](2)))) { + + id = (attributes = self.$parse_quoted_text_attributes(attrlist)).$delete("id"); + if (type['$==']("mark")) { + type = "unquoted"};}; + return "" + (match['$[]'](1)) + ($$($nesting, 'Inline').$new(self, "quoted", match['$[]'](3), $hash2(["type", "id", "attributes"], {"type": type, "id": id, "attributes": attributes})).$convert()); + } + } else { + + if ($truthy((attrlist = match['$[]'](1)))) { + + id = (attributes = self.$parse_quoted_text_attributes(attrlist)).$delete("id"); + if (type['$==']("mark")) { + type = "unquoted"};}; + return $$($nesting, 'Inline').$new(self, "quoted", match['$[]'](2), $hash2(["type", "id", "attributes"], {"type": type, "id": id, "attributes": attributes})).$convert(); + }; + }, TMP_Substitutors_convert_quoted_text_56.$$arity = 3); + + Opal.def(self, '$parse_quoted_text_attributes', TMP_Substitutors_parse_quoted_text_attributes_57 = function $$parse_quoted_text_attributes(str) { + var $a, $b, self = this, segments = nil, id = nil, more_roles = nil, roles = nil, attrs = nil, $writer = nil; + + + if ($truthy(str['$include?']($$($nesting, 'ATTR_REF_HEAD')))) { + str = self.$sub_attributes(str)}; + if ($truthy(str['$include?'](","))) { + str = str.$slice(0, str.$index(","))}; + if ($truthy((str = str.$strip())['$empty?']())) { + return $hash2([], {}) + } else if ($truthy(($truthy($a = str['$start_with?'](".", "#")) ? $$($nesting, 'Compliance').$shorthand_property_syntax() : $a))) { + + segments = str.$split("#", 2); + if ($truthy($rb_gt(segments.$size(), 1))) { + $b = segments['$[]'](1).$split("."), $a = Opal.to_ary($b), (id = ($a[0] == null ? nil : $a[0])), (more_roles = $slice.call($a, 1)), $b + } else { + + id = nil; + more_roles = []; + }; + roles = (function() {if ($truthy(segments['$[]'](0)['$empty?']())) { + return [] + } else { + return segments['$[]'](0).$split(".") + }; return nil; })(); + if ($truthy($rb_gt(roles.$size(), 1))) { + roles.$shift()}; + if ($truthy($rb_gt(more_roles.$size(), 0))) { + roles.$concat(more_roles)}; + attrs = $hash2([], {}); + if ($truthy(id)) { + + $writer = ["id", id]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if ($truthy(roles['$empty?']())) { + } else { + + $writer = ["role", roles.$join(" ")]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + return attrs; + } else { + return $hash2(["role"], {"role": str}) + }; + }, TMP_Substitutors_parse_quoted_text_attributes_57.$$arity = 1); + + Opal.def(self, '$parse_attributes', TMP_Substitutors_parse_attributes_58 = function $$parse_attributes(attrlist, posattrs, opts) { + var $a, self = this, block = nil, into = nil; + if (self.document == null) self.document = nil; + + + + if (posattrs == null) { + posattrs = []; + }; + + if (opts == null) { + opts = $hash2([], {}); + }; + if ($truthy(($truthy($a = attrlist) ? attrlist['$empty?']()['$!']() : $a))) { + } else { + return $hash2([], {}) + }; + if ($truthy(($truthy($a = opts['$[]']("sub_input")) ? attrlist['$include?']($$($nesting, 'ATTR_REF_HEAD')) : $a))) { + attrlist = self.document.$sub_attributes(attrlist)}; + if ($truthy(opts['$[]']("unescape_input"))) { + attrlist = self.$unescape_bracketed_text(attrlist)}; + if ($truthy(opts['$[]']("sub_result"))) { + block = self}; + if ($truthy((into = opts['$[]']("into")))) { + return $$($nesting, 'AttributeList').$new(attrlist, block).$parse_into(into, posattrs) + } else { + return $$($nesting, 'AttributeList').$new(attrlist, block).$parse(posattrs) + }; + }, TMP_Substitutors_parse_attributes_58.$$arity = -2); + + Opal.def(self, '$expand_subs', TMP_Substitutors_expand_subs_59 = function $$expand_subs(subs) { + var $a, TMP_60, self = this, expanded_subs = nil; + + if ($truthy($$$('::', 'Symbol')['$==='](subs))) { + if (subs['$==']("none")) { + return nil + } else { + return ($truthy($a = $$($nesting, 'SUB_GROUPS')['$[]'](subs)) ? $a : [subs]) + } + } else { + + expanded_subs = []; + $send(subs, 'each', [], (TMP_60 = function(key){var self = TMP_60.$$s || this, sub_group = nil; + + + + if (key == null) { + key = nil; + }; + if (key['$==']("none")) { + return nil + } else if ($truthy((sub_group = $$($nesting, 'SUB_GROUPS')['$[]'](key)))) { + return (expanded_subs = $rb_plus(expanded_subs, sub_group)) + } else { + return expanded_subs['$<<'](key) + };}, TMP_60.$$s = self, TMP_60.$$arity = 1, TMP_60)); + if ($truthy(expanded_subs['$empty?']())) { + return nil + } else { + return expanded_subs + }; + } + }, TMP_Substitutors_expand_subs_59.$$arity = 1); + + Opal.def(self, '$unescape_bracketed_text', TMP_Substitutors_unescape_bracketed_text_61 = function $$unescape_bracketed_text(text) { + var self = this; + + + if ($truthy(text['$empty?']())) { + } else if ($truthy((text = text.$strip().$tr($$($nesting, 'LF'), " "))['$include?']($$($nesting, 'R_SB')))) { + text = text.$gsub($$($nesting, 'ESC_R_SB'), $$($nesting, 'R_SB'))}; + return text; + }, TMP_Substitutors_unescape_bracketed_text_61.$$arity = 1); + + Opal.def(self, '$normalize_string', TMP_Substitutors_normalize_string_62 = function $$normalize_string(str, unescape_brackets) { + var $a, self = this; + + + + if (unescape_brackets == null) { + unescape_brackets = false; + }; + if ($truthy(str['$empty?']())) { + } else { + + str = str.$strip().$tr($$($nesting, 'LF'), " "); + if ($truthy(($truthy($a = unescape_brackets) ? str['$include?']($$($nesting, 'R_SB')) : $a))) { + str = str.$gsub($$($nesting, 'ESC_R_SB'), $$($nesting, 'R_SB'))}; + }; + return str; + }, TMP_Substitutors_normalize_string_62.$$arity = -2); + + Opal.def(self, '$unescape_brackets', TMP_Substitutors_unescape_brackets_63 = function $$unescape_brackets(str) { + var self = this; + + + if ($truthy(str['$empty?']())) { + } else if ($truthy(str['$include?']($$($nesting, 'RS')))) { + str = str.$gsub($$($nesting, 'ESC_R_SB'), $$($nesting, 'R_SB'))}; + return str; + }, TMP_Substitutors_unescape_brackets_63.$$arity = 1); + + Opal.def(self, '$split_simple_csv', TMP_Substitutors_split_simple_csv_64 = function $$split_simple_csv(str) { + var TMP_65, TMP_66, self = this, values = nil, current = nil, quote_open = nil; + + + if ($truthy(str['$empty?']())) { + values = [] + } else if ($truthy(str['$include?']("\""))) { + + values = []; + current = []; + quote_open = false; + $send(str, 'each_char', [], (TMP_65 = function(c){var self = TMP_65.$$s || this, $case = nil; + + + + if (c == null) { + c = nil; + }; + return (function() {$case = c; + if (","['$===']($case)) {if ($truthy(quote_open)) { + return current['$<<'](c) + } else { + + values['$<<'](current.$join().$strip()); + return (current = []); + }} + else if ("\""['$===']($case)) {return (quote_open = quote_open['$!']())} + else {return current['$<<'](c)}})();}, TMP_65.$$s = self, TMP_65.$$arity = 1, TMP_65)); + values['$<<'](current.$join().$strip()); + } else { + values = $send(str.$split(","), 'map', [], (TMP_66 = function(it){var self = TMP_66.$$s || this; + + + + if (it == null) { + it = nil; + }; + return it.$strip();}, TMP_66.$$s = self, TMP_66.$$arity = 1, TMP_66)) + }; + return values; + }, TMP_Substitutors_split_simple_csv_64.$$arity = 1); + + Opal.def(self, '$resolve_subs', TMP_Substitutors_resolve_subs_67 = function $$resolve_subs(subs, type, defaults, subject) { + var TMP_68, self = this, candidates = nil, modifiers_present = nil, resolved = nil, invalid = nil; + + + + if (type == null) { + type = "block"; + }; + + if (defaults == null) { + defaults = nil; + }; + + if (subject == null) { + subject = nil; + }; + if ($truthy(subs['$nil_or_empty?']())) { + return nil}; + candidates = nil; + if ($truthy(subs['$include?'](" "))) { + subs = subs.$delete(" ")}; + modifiers_present = $$($nesting, 'SubModifierSniffRx')['$match?'](subs); + $send(subs.$split(","), 'each', [], (TMP_68 = function(key){var self = TMP_68.$$s || this, $a, $b, modifier_operation = nil, first = nil, resolved_keys = nil, resolved_key = nil, candidate = nil, $case = nil; + + + + if (key == null) { + key = nil; + }; + modifier_operation = nil; + if ($truthy(modifiers_present)) { + if ((first = key.$chr())['$==']("+")) { + + modifier_operation = "append"; + key = key.$slice(1, key.$length()); + } else if (first['$==']("-")) { + + modifier_operation = "remove"; + key = key.$slice(1, key.$length()); + } else if ($truthy(key['$end_with?']("+"))) { + + modifier_operation = "prepend"; + key = key.$chop();}}; + key = key.$to_sym(); + if ($truthy((($a = type['$==']("inline")) ? ($truthy($b = key['$==']("verbatim")) ? $b : key['$==']("v")) : type['$==']("inline")))) { + resolved_keys = $$($nesting, 'BASIC_SUBS') + } else if ($truthy($$($nesting, 'SUB_GROUPS')['$key?'](key))) { + resolved_keys = $$($nesting, 'SUB_GROUPS')['$[]'](key) + } else if ($truthy(($truthy($a = (($b = type['$==']("inline")) ? key.$length()['$=='](1) : type['$==']("inline"))) ? $$($nesting, 'SUB_HINTS')['$key?'](key) : $a))) { + + resolved_key = $$($nesting, 'SUB_HINTS')['$[]'](key); + if ($truthy((candidate = $$($nesting, 'SUB_GROUPS')['$[]'](resolved_key)))) { + resolved_keys = candidate + } else { + resolved_keys = [resolved_key] + }; + } else { + resolved_keys = [key] + }; + if ($truthy(modifier_operation)) { + + candidates = ($truthy($a = candidates) ? $a : (function() {if ($truthy(defaults)) { + + return defaults.$drop(0); + } else { + return [] + }; return nil; })()); + return (function() {$case = modifier_operation; + if ("append"['$===']($case)) {return (candidates = $rb_plus(candidates, resolved_keys))} + else if ("prepend"['$===']($case)) {return (candidates = $rb_plus(resolved_keys, candidates))} + else if ("remove"['$===']($case)) {return (candidates = $rb_minus(candidates, resolved_keys))} + else { return nil }})(); + } else { + + candidates = ($truthy($a = candidates) ? $a : []); + return (candidates = $rb_plus(candidates, resolved_keys)); + };}, TMP_68.$$s = self, TMP_68.$$arity = 1, TMP_68)); + if ($truthy(candidates)) { + } else { + return nil + }; + resolved = candidates['$&']($$($nesting, 'SUB_OPTIONS')['$[]'](type)); + if ($truthy($rb_minus(candidates, resolved)['$empty?']())) { + } else { + + invalid = $rb_minus(candidates, resolved); + self.$logger().$warn("" + "invalid substitution type" + ((function() {if ($truthy($rb_gt(invalid.$size(), 1))) { + return "s" + } else { + return "" + }; return nil; })()) + ((function() {if ($truthy(subject)) { + return " for " + } else { + return "" + }; return nil; })()) + (subject) + ": " + (invalid.$join(", "))); + }; + return resolved; + }, TMP_Substitutors_resolve_subs_67.$$arity = -2); + + Opal.def(self, '$resolve_block_subs', TMP_Substitutors_resolve_block_subs_69 = function $$resolve_block_subs(subs, defaults, subject) { + var self = this; + + return self.$resolve_subs(subs, "block", defaults, subject) + }, TMP_Substitutors_resolve_block_subs_69.$$arity = 3); + + Opal.def(self, '$resolve_pass_subs', TMP_Substitutors_resolve_pass_subs_70 = function $$resolve_pass_subs(subs) { + var self = this; + + return self.$resolve_subs(subs, "inline", nil, "passthrough macro") + }, TMP_Substitutors_resolve_pass_subs_70.$$arity = 1); + + Opal.def(self, '$highlight_source', TMP_Substitutors_highlight_source_71 = function $$highlight_source(source, process_callouts, highlighter) { + var $a, $b, $c, $d, $e, $f, TMP_72, TMP_74, self = this, $case = nil, highlighter_loaded = nil, lineno = nil, callout_on_last = nil, callout_marks = nil, last = nil, callout_rx = nil, linenums_mode = nil, highlight_lines = nil, start = nil, result = nil, lexer = nil, opts = nil, $writer = nil, autonum = nil, reached_code = nil; + if (self.document == null) self.document = nil; + if (self.passthroughs == null) self.passthroughs = nil; + + + + if (highlighter == null) { + highlighter = nil; + }; + $case = (highlighter = ($truthy($a = highlighter) ? $a : self.document.$attributes()['$[]']("source-highlighter"))); + if ("coderay"['$===']($case)) {if ($truthy(($truthy($a = ($truthy($b = (highlighter_loaded = (($c = $$$('::', 'CodeRay', 'skip_raise')) ? 'constant' : nil))) ? $b : (($d = $Substitutors.$$cvars['@@coderay_unavailable'], $d != null) ? 'class variable' : nil))) ? $a : self.document.$attributes()['$[]']("coderay-unavailable")))) { + } else if ($truthy($$($nesting, 'Helpers').$require_library("coderay", true, "warn")['$nil?']())) { + (Opal.class_variable_set($Substitutors, '@@coderay_unavailable', true)) + } else { + highlighter_loaded = true + }} + else if ("pygments"['$===']($case)) {if ($truthy(($truthy($a = ($truthy($b = (highlighter_loaded = (($e = $$$('::', 'Pygments', 'skip_raise')) ? 'constant' : nil))) ? $b : (($f = $Substitutors.$$cvars['@@pygments_unavailable'], $f != null) ? 'class variable' : nil))) ? $a : self.document.$attributes()['$[]']("pygments-unavailable")))) { + } else if ($truthy($$($nesting, 'Helpers').$require_library("pygments", "pygments.rb", "warn")['$nil?']())) { + (Opal.class_variable_set($Substitutors, '@@pygments_unavailable', true)) + } else { + highlighter_loaded = true + }} + else {highlighter_loaded = false}; + if ($truthy(highlighter_loaded)) { + } else { + return self.$sub_source(source, process_callouts) + }; + lineno = 0; + callout_on_last = false; + if ($truthy(process_callouts)) { + + callout_marks = $hash2([], {}); + last = -1; + callout_rx = (function() {if ($truthy(self['$attr?']("line-comment"))) { + return $$($nesting, 'CalloutExtractRxMap')['$[]'](self.$attr("line-comment")) + } else { + return $$($nesting, 'CalloutExtractRx') + }; return nil; })(); + source = $send(source.$split($$($nesting, 'LF'), -1), 'map', [], (TMP_72 = function(line){var self = TMP_72.$$s || this, TMP_73; + + + + if (line == null) { + line = nil; + }; + lineno = $rb_plus(lineno, 1); + return $send(line, 'gsub', [callout_rx], (TMP_73 = function(){var self = TMP_73.$$s || this, $g, $writer = nil; + + if ($truthy((($g = $gvars['~']) === nil ? nil : $g['$[]'](2)))) { + return (($g = $gvars['~']) === nil ? nil : $g['$[]'](0)).$sub($$($nesting, 'RS'), "") + } else { + + ($truthy($g = callout_marks['$[]'](lineno)) ? $g : (($writer = [lineno, []]), $send(callout_marks, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]))['$<<']([(($g = $gvars['~']) === nil ? nil : $g['$[]'](1)), (($g = $gvars['~']) === nil ? nil : $g['$[]'](4))]); + last = lineno; + return nil; + }}, TMP_73.$$s = self, TMP_73.$$arity = 0, TMP_73));}, TMP_72.$$s = self, TMP_72.$$arity = 1, TMP_72)).$join($$($nesting, 'LF')); + callout_on_last = last['$=='](lineno); + if ($truthy(callout_marks['$empty?']())) { + callout_marks = nil}; + } else { + callout_marks = nil + }; + linenums_mode = nil; + highlight_lines = nil; + $case = highlighter; + if ("coderay"['$===']($case)) { + if ($truthy((linenums_mode = (function() {if ($truthy(self['$attr?']("linenums", nil, false))) { + return ($truthy($a = self.document.$attributes()['$[]']("coderay-linenums-mode")) ? $a : "table").$to_sym() + } else { + return nil + }; return nil; })()))) { + + if ($truthy($rb_lt((start = self.$attr("start", nil, 1).$to_i()), 1))) { + start = 1}; + if ($truthy(self['$attr?']("highlight", nil, false))) { + highlight_lines = self.$resolve_lines_to_highlight(source, self.$attr("highlight", nil, false))};}; + result = $$$($$$('::', 'CodeRay'), 'Duo')['$[]'](self.$attr("language", "text", false).$to_sym(), "html", $hash2(["css", "line_numbers", "line_number_start", "line_number_anchors", "highlight_lines", "bold_every"], {"css": ($truthy($a = self.document.$attributes()['$[]']("coderay-css")) ? $a : "class").$to_sym(), "line_numbers": linenums_mode, "line_number_start": start, "line_number_anchors": false, "highlight_lines": highlight_lines, "bold_every": false})).$highlight(source);} + else if ("pygments"['$===']($case)) { + lexer = ($truthy($a = $$$($$$('::', 'Pygments'), 'Lexer').$find_by_alias(self.$attr("language", "text", false))) ? $a : $$$($$$('::', 'Pygments'), 'Lexer').$find_by_mimetype("text/plain")); + opts = $hash2(["cssclass", "classprefix", "nobackground", "stripnl"], {"cssclass": "pyhl", "classprefix": "tok-", "nobackground": true, "stripnl": false}); + if (lexer.$name()['$==']("PHP")) { + + $writer = ["startinline", self['$option?']("mixed")['$!']()]; + $send(opts, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if (($truthy($a = self.document.$attributes()['$[]']("pygments-css")) ? $a : "class")['$==']("class")) { + } else { + + + $writer = ["noclasses", true]; + $send(opts, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["style", ($truthy($a = self.document.$attributes()['$[]']("pygments-style")) ? $a : $$$($$($nesting, 'Stylesheets'), 'DEFAULT_PYGMENTS_STYLE'))]; + $send(opts, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + }; + if ($truthy(self['$attr?']("highlight", nil, false))) { + if ($truthy((highlight_lines = self.$resolve_lines_to_highlight(source, self.$attr("highlight", nil, false)))['$empty?']())) { + } else { + + $writer = ["hl_lines", highlight_lines.$join(" ")]; + $send(opts, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }}; + if ($truthy(($truthy($a = ($truthy($b = self['$attr?']("linenums", nil, false)) ? (($writer = ["linenostart", (function() {if ($truthy($rb_lt((start = self.$attr("start", 1, false)).$to_i(), 1))) { + return 1 + } else { + return start + }; return nil; })()]), $send(opts, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]) : $b)) ? (($writer = ["linenos", ($truthy($b = self.document.$attributes()['$[]']("pygments-linenums-mode")) ? $b : "table")]), $send(opts, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])['$==']("table") : $a))) { + + linenums_mode = "table"; + if ($truthy((result = lexer.$highlight(source, $hash2(["options"], {"options": opts}))))) { + result = result.$sub($$($nesting, 'PygmentsWrapperDivRx'), "\\1").$gsub($$($nesting, 'PygmentsWrapperPreRx'), "\\1") + } else { + result = self.$sub_specialchars(source) + }; + } else if ($truthy((result = lexer.$highlight(source, $hash2(["options"], {"options": opts}))))) { + if ($truthy($$($nesting, 'PygmentsWrapperPreRx')['$=~'](result))) { + result = (($a = $gvars['~']) === nil ? nil : $a['$[]'](1))} + } else { + result = self.$sub_specialchars(source) + };}; + if ($truthy(self.passthroughs['$empty?']())) { + } else { + result = result.$gsub($$($nesting, 'HighlightedPassSlotRx'), "" + ($$($nesting, 'PASS_START')) + "\\1" + ($$($nesting, 'PASS_END'))) + }; + if ($truthy(($truthy($a = process_callouts) ? callout_marks : $a))) { + + lineno = 0; + autonum = 0; + reached_code = linenums_mode['$!=']("table"); + return $send(result.$split($$($nesting, 'LF'), -1), 'map', [], (TMP_74 = function(line){var self = TMP_74.$$s || this, $g, $h, TMP_75, conums = nil, tail = nil, pos = nil, guard = nil, conum = nil, conums_markup = nil; + if (self.document == null) self.document = nil; + + + + if (line == null) { + line = nil; + }; + if ($truthy(reached_code)) { + } else { + + if ($truthy(line['$include?'](""))) { + } else { + return line; + }; + reached_code = true; + }; + lineno = $rb_plus(lineno, 1); + if ($truthy((conums = callout_marks.$delete(lineno)))) { + + tail = nil; + if ($truthy(($truthy($g = ($truthy($h = callout_on_last) ? callout_marks['$empty?']() : $h)) ? linenums_mode['$==']("table") : $g))) { + if ($truthy((($g = highlighter['$==']("coderay")) ? (pos = line.$index("")) : highlighter['$==']("coderay")))) { + $g = [line.$slice(0, pos), line.$slice(pos, line.$length())], (line = $g[0]), (tail = $g[1]), $g + } else if ($truthy((($g = highlighter['$==']("pygments")) ? (pos = line['$start_with?']("")) : highlighter['$==']("pygments")))) { + $g = ["", line], (line = $g[0]), (tail = $g[1]), $g}}; + if (conums.$size()['$=='](1)) { + + $h = conums['$[]'](0), $g = Opal.to_ary($h), (guard = ($g[0] == null ? nil : $g[0])), (conum = ($g[1] == null ? nil : $g[1])), $h; + return "" + (line) + ($$($nesting, 'Inline').$new(self, "callout", (function() {if (conum['$=='](".")) { + return (autonum = $rb_plus(autonum, 1)).$to_s() + } else { + return conum + }; return nil; })(), $hash2(["id", "attributes"], {"id": self.document.$callouts().$read_next_id(), "attributes": $hash2(["guard"], {"guard": guard})})).$convert()) + (tail); + } else { + + conums_markup = $send(conums, 'map', [], (TMP_75 = function(guard_it, conum_it){var self = TMP_75.$$s || this; + if (self.document == null) self.document = nil; + + + + if (guard_it == null) { + guard_it = nil; + }; + + if (conum_it == null) { + conum_it = nil; + }; + return $$($nesting, 'Inline').$new(self, "callout", (function() {if (conum_it['$=='](".")) { + return (autonum = $rb_plus(autonum, 1)).$to_s() + } else { + return conum_it + }; return nil; })(), $hash2(["id", "attributes"], {"id": self.document.$callouts().$read_next_id(), "attributes": $hash2(["guard"], {"guard": guard_it})})).$convert();}, TMP_75.$$s = self, TMP_75.$$arity = 2, TMP_75)).$join(" "); + return "" + (line) + (conums_markup) + (tail); + }; + } else { + return line + };}, TMP_74.$$s = self, TMP_74.$$arity = 1, TMP_74)).$join($$($nesting, 'LF')); + } else { + return result + }; + }, TMP_Substitutors_highlight_source_71.$$arity = -3); + + Opal.def(self, '$resolve_lines_to_highlight', TMP_Substitutors_resolve_lines_to_highlight_76 = function $$resolve_lines_to_highlight(source, spec) { + var TMP_77, self = this, lines = nil; + + + lines = []; + if ($truthy(spec['$include?'](" "))) { + spec = spec.$delete(" ")}; + $send((function() {if ($truthy(spec['$include?'](","))) { + + return spec.$split(","); + } else { + + return spec.$split(";"); + }; return nil; })(), 'map', [], (TMP_77 = function(entry){var self = TMP_77.$$s || this, $a, $b, negate = nil, delim = nil, from = nil, to = nil, line_nums = nil; + + + + if (entry == null) { + entry = nil; + }; + negate = false; + if ($truthy(entry['$start_with?']("!"))) { + + entry = entry.$slice(1, entry.$length()); + negate = true;}; + if ($truthy((delim = (function() {if ($truthy(entry['$include?'](".."))) { + return ".." + } else { + + if ($truthy(entry['$include?']("-"))) { + return "-" + } else { + return nil + }; + }; return nil; })()))) { + + $b = entry.$split(delim, 2), $a = Opal.to_ary($b), (from = ($a[0] == null ? nil : $a[0])), (to = ($a[1] == null ? nil : $a[1])), $b; + if ($truthy(($truthy($a = to['$empty?']()) ? $a : $rb_lt((to = to.$to_i()), 0)))) { + to = $rb_plus(source.$count($$($nesting, 'LF')), 1)}; + line_nums = $$$('::', 'Range').$new(from.$to_i(), to).$to_a(); + if ($truthy(negate)) { + return (lines = $rb_minus(lines, line_nums)) + } else { + return lines.$concat(line_nums) + }; + } else if ($truthy(negate)) { + return lines.$delete(entry.$to_i()) + } else { + return lines['$<<'](entry.$to_i()) + };}, TMP_77.$$s = self, TMP_77.$$arity = 1, TMP_77)); + return lines.$sort().$uniq(); + }, TMP_Substitutors_resolve_lines_to_highlight_76.$$arity = 2); + + Opal.def(self, '$sub_source', TMP_Substitutors_sub_source_78 = function $$sub_source(source, process_callouts) { + var self = this; + + if ($truthy(process_callouts)) { + return self.$sub_callouts(self.$sub_specialchars(source)) + } else { + + return self.$sub_specialchars(source); + } + }, TMP_Substitutors_sub_source_78.$$arity = 2); + + Opal.def(self, '$lock_in_subs', TMP_Substitutors_lock_in_subs_79 = function $$lock_in_subs() { + var $a, $b, $c, $d, $e, self = this, default_subs = nil, $case = nil, custom_subs = nil, idx = nil, $writer = nil; + if (self.default_subs == null) self.default_subs = nil; + if (self.content_model == null) self.content_model = nil; + if (self.context == null) self.context = nil; + if (self.subs == null) self.subs = nil; + if (self.attributes == null) self.attributes = nil; + if (self.style == null) self.style = nil; + if (self.document == null) self.document = nil; + + + if ($truthy((default_subs = self.default_subs))) { + } else { + $case = self.content_model; + if ("simple"['$===']($case)) {default_subs = $$($nesting, 'NORMAL_SUBS')} + else if ("verbatim"['$===']($case)) {if ($truthy(($truthy($a = self.context['$==']("listing")) ? $a : (($b = self.context['$==']("literal")) ? self['$option?']("listparagraph")['$!']() : self.context['$==']("literal"))))) { + default_subs = $$($nesting, 'VERBATIM_SUBS') + } else if (self.context['$==']("verse")) { + default_subs = $$($nesting, 'NORMAL_SUBS') + } else { + default_subs = $$($nesting, 'BASIC_SUBS') + }} + else if ("raw"['$===']($case)) {default_subs = (function() {if (self.context['$==']("stem")) { + return $$($nesting, 'BASIC_SUBS') + } else { + return $$($nesting, 'NONE_SUBS') + }; return nil; })()} + else {return self.subs} + }; + if ($truthy((custom_subs = self.attributes['$[]']("subs")))) { + self.subs = ($truthy($a = self.$resolve_block_subs(custom_subs, default_subs, self.context)) ? $a : []) + } else { + self.subs = default_subs.$drop(0) + }; + if ($truthy(($truthy($a = ($truthy($b = ($truthy($c = ($truthy($d = (($e = self.context['$==']("listing")) ? self.style['$==']("source") : self.context['$==']("listing"))) ? self.attributes['$key?']("language") : $d)) ? self.document['$basebackend?']("html") : $c)) ? $$($nesting, 'SUB_HIGHLIGHT')['$include?'](self.document.$attributes()['$[]']("source-highlighter")) : $b)) ? (idx = self.subs.$index("specialcharacters")) : $a))) { + + $writer = [idx, "highlight"]; + $send(self.subs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + return self.subs; + }, TMP_Substitutors_lock_in_subs_79.$$arity = 0); + })($nesting[0], $nesting) + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/abstract_node"] = function(Opal) { + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + function $rb_plus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); + } + function $rb_lt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $hash2 = Opal.hash2, $truthy = Opal.truthy, $send = Opal.send; + + Opal.add_stubs(['$include', '$attr_reader', '$attr_accessor', '$==', '$document', '$to_s', '$key?', '$dup', '$[]', '$raise', '$converter', '$attributes', '$nil?', '$[]=', '$-', '$delete', '$+', '$update', '$nil_or_empty?', '$split', '$include?', '$empty?', '$join', '$apply_reftext_subs', '$attr?', '$extname', '$attr', '$image_uri', '$<', '$safe', '$uriish?', '$uri_encode_spaces', '$normalize_web_path', '$generate_data_uri_from_uri', '$generate_data_uri', '$slice', '$length', '$normalize_system_path', '$readable?', '$strict_encode64', '$binread', '$warn', '$logger', '$require_library', '$!', '$open', '$content_type', '$read', '$base_dir', '$root?', '$path_resolver', '$system_path', '$web_path', '$===', '$!=', '$normalize_lines_array', '$to_a', '$each_line', '$open_uri', '$fetch', '$read_asset', '$gsub']); + return (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + (function($base, $super, $parent_nesting) { + function $AbstractNode(){}; + var self = $AbstractNode = $klass($base, $super, 'AbstractNode', $AbstractNode); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_AbstractNode_initialize_1, TMP_AbstractNode_block$q_2, TMP_AbstractNode_inline$q_3, TMP_AbstractNode_converter_4, TMP_AbstractNode_parent$eq_5, TMP_AbstractNode_attr_6, TMP_AbstractNode_attr$q_7, TMP_AbstractNode_set_attr_8, TMP_AbstractNode_remove_attr_9, TMP_AbstractNode_option$q_10, TMP_AbstractNode_set_option_11, TMP_AbstractNode_update_attributes_12, TMP_AbstractNode_role_13, TMP_AbstractNode_roles_14, TMP_AbstractNode_role$q_15, TMP_AbstractNode_has_role$q_16, TMP_AbstractNode_add_role_17, TMP_AbstractNode_remove_role_18, TMP_AbstractNode_reftext_19, TMP_AbstractNode_reftext$q_20, TMP_AbstractNode_icon_uri_21, TMP_AbstractNode_image_uri_22, TMP_AbstractNode_media_uri_23, TMP_AbstractNode_generate_data_uri_24, TMP_AbstractNode_generate_data_uri_from_uri_25, TMP_AbstractNode_normalize_asset_path_27, TMP_AbstractNode_normalize_system_path_28, TMP_AbstractNode_normalize_web_path_29, TMP_AbstractNode_read_asset_30, TMP_AbstractNode_read_contents_32, TMP_AbstractNode_uri_encode_spaces_35, TMP_AbstractNode_is_uri$q_36; + + def.document = def.attributes = def.parent = nil; + + self.$include($$($nesting, 'Logging')); + self.$include($$($nesting, 'Substitutors')); + self.$attr_reader("attributes"); + self.$attr_reader("context"); + self.$attr_reader("document"); + self.$attr_accessor("id"); + self.$attr_reader("node_name"); + self.$attr_reader("parent"); + + Opal.def(self, '$initialize', TMP_AbstractNode_initialize_1 = function $$initialize(parent, context, opts) { + var $a, self = this; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + if (context['$==']("document")) { + $a = [self, nil], (self.document = $a[0]), (self.parent = $a[1]), $a + } else if ($truthy(parent)) { + $a = [parent.$document(), parent], (self.document = $a[0]), (self.parent = $a[1]), $a + } else { + self.document = (self.parent = nil) + }; + self.node_name = (self.context = context).$to_s(); + self.attributes = (function() {if ($truthy(opts['$key?']("attributes"))) { + return opts['$[]']("attributes").$dup() + } else { + return $hash2([], {}) + }; return nil; })(); + return (self.passthroughs = $hash2([], {})); + }, TMP_AbstractNode_initialize_1.$$arity = -3); + + Opal.def(self, '$block?', TMP_AbstractNode_block$q_2 = function() { + var self = this; + + return self.$raise($$$('::', 'NotImplementedError')) + }, TMP_AbstractNode_block$q_2.$$arity = 0); + + Opal.def(self, '$inline?', TMP_AbstractNode_inline$q_3 = function() { + var self = this; + + return self.$raise($$$('::', 'NotImplementedError')) + }, TMP_AbstractNode_inline$q_3.$$arity = 0); + + Opal.def(self, '$converter', TMP_AbstractNode_converter_4 = function $$converter() { + var self = this; + + return self.document.$converter() + }, TMP_AbstractNode_converter_4.$$arity = 0); + + Opal.def(self, '$parent=', TMP_AbstractNode_parent$eq_5 = function(parent) { + var $a, self = this; + + return $a = [parent, parent.$document()], (self.parent = $a[0]), (self.document = $a[1]), $a + }, TMP_AbstractNode_parent$eq_5.$$arity = 1); + + Opal.def(self, '$attr', TMP_AbstractNode_attr_6 = function $$attr(name, default_val, inherit) { + var $a, $b, self = this; + + + + if (default_val == null) { + default_val = nil; + }; + + if (inherit == null) { + inherit = true; + }; + name = name.$to_s(); + return ($truthy($a = self.attributes['$[]'](name)) ? $a : (function() {if ($truthy(($truthy($b = inherit) ? self.parent : $b))) { + return ($truthy($b = self.document.$attributes()['$[]'](name)) ? $b : default_val) + } else { + return default_val + }; return nil; })()); + }, TMP_AbstractNode_attr_6.$$arity = -2); + + Opal.def(self, '$attr?', TMP_AbstractNode_attr$q_7 = function(name, expect_val, inherit) { + var $a, $b, $c, self = this; + + + + if (expect_val == null) { + expect_val = nil; + }; + + if (inherit == null) { + inherit = true; + }; + name = name.$to_s(); + if ($truthy(expect_val['$nil?']())) { + return ($truthy($a = self.attributes['$key?'](name)) ? $a : ($truthy($b = ($truthy($c = inherit) ? self.parent : $c)) ? self.document.$attributes()['$key?'](name) : $b)) + } else { + return expect_val['$=='](($truthy($a = self.attributes['$[]'](name)) ? $a : (function() {if ($truthy(($truthy($b = inherit) ? self.parent : $b))) { + return self.document.$attributes()['$[]'](name) + } else { + return nil + }; return nil; })())) + }; + }, TMP_AbstractNode_attr$q_7.$$arity = -2); + + Opal.def(self, '$set_attr', TMP_AbstractNode_set_attr_8 = function $$set_attr(name, value, overwrite) { + var $a, self = this, $writer = nil; + + + + if (value == null) { + value = ""; + }; + + if (overwrite == null) { + overwrite = true; + }; + if ($truthy((($a = overwrite['$=='](false)) ? self.attributes['$key?'](name) : overwrite['$=='](false)))) { + return false + } else { + + + $writer = [name, value]; + $send(self.attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + return true; + }; + }, TMP_AbstractNode_set_attr_8.$$arity = -2); + + Opal.def(self, '$remove_attr', TMP_AbstractNode_remove_attr_9 = function $$remove_attr(name) { + var self = this; + + return self.attributes.$delete(name) + }, TMP_AbstractNode_remove_attr_9.$$arity = 1); + + Opal.def(self, '$option?', TMP_AbstractNode_option$q_10 = function(name) { + var self = this; + + return self.attributes['$key?']("" + (name) + "-option") + }, TMP_AbstractNode_option$q_10.$$arity = 1); + + Opal.def(self, '$set_option', TMP_AbstractNode_set_option_11 = function $$set_option(name) { + var self = this, attrs = nil, key = nil, $writer = nil; + + if ($truthy((attrs = self.attributes)['$[]']("options"))) { + if ($truthy(attrs['$[]']((key = "" + (name) + "-option")))) { + return nil + } else { + + + $writer = ["options", $rb_plus(attrs['$[]']("options"), "" + "," + (name))]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = [key, ""]; + $send(attrs, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];; + } + } else { + + + $writer = ["options", name]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["" + (name) + "-option", ""]; + $send(attrs, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];; + } + }, TMP_AbstractNode_set_option_11.$$arity = 1); + + Opal.def(self, '$update_attributes', TMP_AbstractNode_update_attributes_12 = function $$update_attributes(attributes) { + var self = this; + + + self.attributes.$update(attributes); + return nil; + }, TMP_AbstractNode_update_attributes_12.$$arity = 1); + + Opal.def(self, '$role', TMP_AbstractNode_role_13 = function $$role() { + var $a, self = this; + + return ($truthy($a = self.attributes['$[]']("role")) ? $a : self.document.$attributes()['$[]']("role")) + }, TMP_AbstractNode_role_13.$$arity = 0); + + Opal.def(self, '$roles', TMP_AbstractNode_roles_14 = function $$roles() { + var $a, self = this, val = nil; + + if ($truthy((val = ($truthy($a = self.attributes['$[]']("role")) ? $a : self.document.$attributes()['$[]']("role")))['$nil_or_empty?']())) { + return [] + } else { + return val.$split() + } + }, TMP_AbstractNode_roles_14.$$arity = 0); + + Opal.def(self, '$role?', TMP_AbstractNode_role$q_15 = function(expect_val) { + var $a, self = this; + + + + if (expect_val == null) { + expect_val = nil; + }; + if ($truthy(expect_val)) { + return expect_val['$=='](($truthy($a = self.attributes['$[]']("role")) ? $a : self.document.$attributes()['$[]']("role"))) + } else { + return ($truthy($a = self.attributes['$key?']("role")) ? $a : self.document.$attributes()['$key?']("role")) + }; + }, TMP_AbstractNode_role$q_15.$$arity = -1); + + Opal.def(self, '$has_role?', TMP_AbstractNode_has_role$q_16 = function(name) { + var $a, self = this, val = nil; + + if ($truthy((val = ($truthy($a = self.attributes['$[]']("role")) ? $a : self.document.$attributes()['$[]']("role"))))) { + return ((("" + " ") + (val)) + " ")['$include?']("" + " " + (name) + " ") + } else { + return false + } + }, TMP_AbstractNode_has_role$q_16.$$arity = 1); + + Opal.def(self, '$add_role', TMP_AbstractNode_add_role_17 = function $$add_role(name) { + var self = this, val = nil, $writer = nil; + + if ($truthy((val = self.attributes['$[]']("role"))['$nil_or_empty?']())) { + + + $writer = ["role", name]; + $send(self.attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + return true; + } else if ($truthy(((("" + " ") + (val)) + " ")['$include?']("" + " " + (name) + " "))) { + return false + } else { + + + $writer = ["role", "" + (val) + " " + (name)]; + $send(self.attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + return true; + } + }, TMP_AbstractNode_add_role_17.$$arity = 1); + + Opal.def(self, '$remove_role', TMP_AbstractNode_remove_role_18 = function $$remove_role(name) { + var self = this, val = nil, $writer = nil; + + if ($truthy((val = self.attributes['$[]']("role"))['$nil_or_empty?']())) { + return false + } else if ($truthy((val = val.$split()).$delete(name))) { + + if ($truthy(val['$empty?']())) { + self.attributes.$delete("role") + } else { + + $writer = ["role", val.$join(" ")]; + $send(self.attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + return true; + } else { + return false + } + }, TMP_AbstractNode_remove_role_18.$$arity = 1); + + Opal.def(self, '$reftext', TMP_AbstractNode_reftext_19 = function $$reftext() { + var self = this, val = nil; + + if ($truthy((val = self.attributes['$[]']("reftext")))) { + + return self.$apply_reftext_subs(val); + } else { + return nil + } + }, TMP_AbstractNode_reftext_19.$$arity = 0); + + Opal.def(self, '$reftext?', TMP_AbstractNode_reftext$q_20 = function() { + var self = this; + + return self.attributes['$key?']("reftext") + }, TMP_AbstractNode_reftext$q_20.$$arity = 0); + + Opal.def(self, '$icon_uri', TMP_AbstractNode_icon_uri_21 = function $$icon_uri(name) { + var self = this, icon = nil; + + + if ($truthy(self['$attr?']("icon"))) { + if ($truthy($$$('::', 'File').$extname((icon = self.$attr("icon")))['$empty?']())) { + icon = "" + (icon) + "." + (self.document.$attr("icontype", "png"))} + } else { + icon = "" + (name) + "." + (self.document.$attr("icontype", "png")) + }; + return self.$image_uri(icon, "iconsdir"); + }, TMP_AbstractNode_icon_uri_21.$$arity = 1); + + Opal.def(self, '$image_uri', TMP_AbstractNode_image_uri_22 = function $$image_uri(target_image, asset_dir_key) { + var $a, $b, $c, $d, self = this, doc = nil, images_base = nil; + + + + if (asset_dir_key == null) { + asset_dir_key = "imagesdir"; + }; + if ($truthy(($truthy($a = $rb_lt((doc = self.document).$safe(), $$$($$($nesting, 'SafeMode'), 'SECURE'))) ? doc['$attr?']("data-uri") : $a))) { + if ($truthy(($truthy($a = ($truthy($b = $$($nesting, 'Helpers')['$uriish?'](target_image)) ? (target_image = self.$uri_encode_spaces(target_image)) : $b)) ? $a : ($truthy($b = ($truthy($c = ($truthy($d = asset_dir_key) ? (images_base = doc.$attr(asset_dir_key)) : $d)) ? $$($nesting, 'Helpers')['$uriish?'](images_base) : $c)) ? (target_image = self.$normalize_web_path(target_image, images_base, false)) : $b)))) { + if ($truthy(doc['$attr?']("allow-uri-read"))) { + return self.$generate_data_uri_from_uri(target_image, doc['$attr?']("cache-uri")) + } else { + return target_image + } + } else { + return self.$generate_data_uri(target_image, asset_dir_key) + } + } else { + return self.$normalize_web_path(target_image, (function() {if ($truthy(asset_dir_key)) { + + return doc.$attr(asset_dir_key); + } else { + return nil + }; return nil; })()) + }; + }, TMP_AbstractNode_image_uri_22.$$arity = -2); + + Opal.def(self, '$media_uri', TMP_AbstractNode_media_uri_23 = function $$media_uri(target, asset_dir_key) { + var self = this; + + + + if (asset_dir_key == null) { + asset_dir_key = "imagesdir"; + }; + return self.$normalize_web_path(target, (function() {if ($truthy(asset_dir_key)) { + return self.document.$attr(asset_dir_key) + } else { + return nil + }; return nil; })()); + }, TMP_AbstractNode_media_uri_23.$$arity = -2); + + Opal.def(self, '$generate_data_uri', TMP_AbstractNode_generate_data_uri_24 = function $$generate_data_uri(target_image, asset_dir_key) { + var self = this, ext = nil, mimetype = nil, image_path = nil; + + + + if (asset_dir_key == null) { + asset_dir_key = nil; + }; + ext = $$$('::', 'File').$extname(target_image); + mimetype = (function() {if (ext['$=='](".svg")) { + return "image/svg+xml" + } else { + return "" + "image/" + (ext.$slice(1, ext.$length())) + }; return nil; })(); + if ($truthy(asset_dir_key)) { + image_path = self.$normalize_system_path(target_image, self.document.$attr(asset_dir_key), nil, $hash2(["target_name"], {"target_name": "image"})) + } else { + image_path = self.$normalize_system_path(target_image) + }; + if ($truthy($$$('::', 'File')['$readable?'](image_path))) { + return "" + "data:" + (mimetype) + ";base64," + ($$$('::', 'Base64').$strict_encode64($$$('::', 'IO').$binread(image_path))) + } else { + + self.$logger().$warn("" + "image to embed not found or not readable: " + (image_path)); + return "" + "data:" + (mimetype) + ";base64,"; + }; + }, TMP_AbstractNode_generate_data_uri_24.$$arity = -2); + + Opal.def(self, '$generate_data_uri_from_uri', TMP_AbstractNode_generate_data_uri_from_uri_25 = function $$generate_data_uri_from_uri(image_uri, cache_uri) { + var TMP_26, self = this, mimetype = nil, bindata = nil; + + + + if (cache_uri == null) { + cache_uri = false; + }; + if ($truthy(cache_uri)) { + $$($nesting, 'Helpers').$require_library("open-uri/cached", "open-uri-cached") + } else if ($truthy($$$('::', 'RUBY_ENGINE_OPAL')['$!']())) { + $$$('::', 'OpenURI')}; + + try { + + mimetype = nil; + bindata = $send(self, 'open', [image_uri, "rb"], (TMP_26 = function(f){var self = TMP_26.$$s || this; + + + + if (f == null) { + f = nil; + }; + mimetype = f.$content_type(); + return f.$read();}, TMP_26.$$s = self, TMP_26.$$arity = 1, TMP_26)); + return "" + "data:" + (mimetype) + ";base64," + ($$$('::', 'Base64').$strict_encode64(bindata)); + } catch ($err) { + if (Opal.rescue($err, [$$($nesting, 'StandardError')])) { + try { + + self.$logger().$warn("" + "could not retrieve image data from URI: " + (image_uri)); + return image_uri; + } finally { Opal.pop_exception() } + } else { throw $err; } + };; + }, TMP_AbstractNode_generate_data_uri_from_uri_25.$$arity = -2); + + Opal.def(self, '$normalize_asset_path', TMP_AbstractNode_normalize_asset_path_27 = function $$normalize_asset_path(asset_ref, asset_name, autocorrect) { + var self = this; + + + + if (asset_name == null) { + asset_name = "path"; + }; + + if (autocorrect == null) { + autocorrect = true; + }; + return self.$normalize_system_path(asset_ref, self.document.$base_dir(), nil, $hash2(["target_name", "recover"], {"target_name": asset_name, "recover": autocorrect})); + }, TMP_AbstractNode_normalize_asset_path_27.$$arity = -2); + + Opal.def(self, '$normalize_system_path', TMP_AbstractNode_normalize_system_path_28 = function $$normalize_system_path(target, start, jail, opts) { + var self = this, doc = nil; + + + + if (start == null) { + start = nil; + }; + + if (jail == null) { + jail = nil; + }; + + if (opts == null) { + opts = $hash2([], {}); + }; + if ($truthy($rb_lt((doc = self.document).$safe(), $$$($$($nesting, 'SafeMode'), 'SAFE')))) { + if ($truthy(start)) { + if ($truthy(doc.$path_resolver()['$root?'](start))) { + } else { + start = $$$('::', 'File').$join(doc.$base_dir(), start) + } + } else { + start = doc.$base_dir() + } + } else { + + if ($truthy(start)) { + } else { + start = doc.$base_dir() + }; + if ($truthy(jail)) { + } else { + jail = doc.$base_dir() + }; + }; + return doc.$path_resolver().$system_path(target, start, jail, opts); + }, TMP_AbstractNode_normalize_system_path_28.$$arity = -2); + + Opal.def(self, '$normalize_web_path', TMP_AbstractNode_normalize_web_path_29 = function $$normalize_web_path(target, start, preserve_uri_target) { + var $a, self = this; + + + + if (start == null) { + start = nil; + }; + + if (preserve_uri_target == null) { + preserve_uri_target = true; + }; + if ($truthy(($truthy($a = preserve_uri_target) ? $$($nesting, 'Helpers')['$uriish?'](target) : $a))) { + return self.$uri_encode_spaces(target) + } else { + return self.document.$path_resolver().$web_path(target, start) + }; + }, TMP_AbstractNode_normalize_web_path_29.$$arity = -2); + + Opal.def(self, '$read_asset', TMP_AbstractNode_read_asset_30 = function $$read_asset(path, opts) { + var TMP_31, $a, self = this; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + if ($truthy($$$('::', 'Hash')['$==='](opts))) { + } else { + opts = $hash2(["warn_on_failure"], {"warn_on_failure": opts['$!='](false)}) + }; + if ($truthy($$$('::', 'File')['$readable?'](path))) { + if ($truthy(opts['$[]']("normalize"))) { + return $$($nesting, 'Helpers').$normalize_lines_array($send($$$('::', 'File'), 'open', [path, "rb"], (TMP_31 = function(f){var self = TMP_31.$$s || this; + + + + if (f == null) { + f = nil; + }; + return f.$each_line().$to_a();}, TMP_31.$$s = self, TMP_31.$$arity = 1, TMP_31))).$join($$($nesting, 'LF')) + } else { + return $$$('::', 'IO').$read(path) + } + } else if ($truthy(opts['$[]']("warn_on_failure"))) { + + self.$logger().$warn("" + (($truthy($a = self.$attr("docfile")) ? $a : "")) + ": " + (($truthy($a = opts['$[]']("label")) ? $a : "file")) + " does not exist or cannot be read: " + (path)); + return nil; + } else { + return nil + }; + }, TMP_AbstractNode_read_asset_30.$$arity = -2); + + Opal.def(self, '$read_contents', TMP_AbstractNode_read_contents_32 = function $$read_contents(target, opts) { + var $a, $b, $c, TMP_33, TMP_34, self = this, doc = nil, start = nil; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + doc = self.document; + if ($truthy(($truthy($a = $$($nesting, 'Helpers')['$uriish?'](target)) ? $a : ($truthy($b = ($truthy($c = (start = opts['$[]']("start"))) ? $$($nesting, 'Helpers')['$uriish?'](start) : $c)) ? (target = doc.$path_resolver().$web_path(target, start)) : $b)))) { + if ($truthy(doc['$attr?']("allow-uri-read"))) { + + if ($truthy(doc['$attr?']("cache-uri"))) { + $$($nesting, 'Helpers').$require_library("open-uri/cached", "open-uri-cached")}; + + try { + if ($truthy(opts['$[]']("normalize"))) { + return $$($nesting, 'Helpers').$normalize_lines_array($send($$$('::', 'OpenURI'), 'open_uri', [target], (TMP_33 = function(f){var self = TMP_33.$$s || this; + + + + if (f == null) { + f = nil; + }; + return f.$each_line().$to_a();}, TMP_33.$$s = self, TMP_33.$$arity = 1, TMP_33))).$join($$($nesting, 'LF')) + } else { + return $send($$$('::', 'OpenURI'), 'open_uri', [target], (TMP_34 = function(f){var self = TMP_34.$$s || this; + + + + if (f == null) { + f = nil; + }; + return f.$read();}, TMP_34.$$s = self, TMP_34.$$arity = 1, TMP_34)) + } + } catch ($err) { + if (Opal.rescue($err, [$$($nesting, 'StandardError')])) { + try { + + if ($truthy(opts.$fetch("warn_on_failure", true))) { + self.$logger().$warn("" + "could not retrieve contents of " + (($truthy($a = opts['$[]']("label")) ? $a : "asset")) + " at URI: " + (target))}; + return nil; + } finally { Opal.pop_exception() } + } else { throw $err; } + };; + } else { + + if ($truthy(opts.$fetch("warn_on_failure", true))) { + self.$logger().$warn("" + "cannot retrieve contents of " + (($truthy($a = opts['$[]']("label")) ? $a : "asset")) + " at URI: " + (target) + " (allow-uri-read attribute not enabled)")}; + return nil; + } + } else { + + target = self.$normalize_system_path(target, opts['$[]']("start"), nil, $hash2(["target_name"], {"target_name": ($truthy($a = opts['$[]']("label")) ? $a : "asset")})); + return self.$read_asset(target, $hash2(["normalize", "warn_on_failure", "label"], {"normalize": opts['$[]']("normalize"), "warn_on_failure": opts.$fetch("warn_on_failure", true), "label": opts['$[]']("label")})); + }; + }, TMP_AbstractNode_read_contents_32.$$arity = -2); + + Opal.def(self, '$uri_encode_spaces', TMP_AbstractNode_uri_encode_spaces_35 = function $$uri_encode_spaces(str) { + var self = this; + + if ($truthy(str['$include?'](" "))) { + + return str.$gsub(" ", "%20"); + } else { + return str + } + }, TMP_AbstractNode_uri_encode_spaces_35.$$arity = 1); + return (Opal.def(self, '$is_uri?', TMP_AbstractNode_is_uri$q_36 = function(str) { + var self = this; + + return $$($nesting, 'Helpers')['$uriish?'](str) + }, TMP_AbstractNode_is_uri$q_36.$$arity = 1), nil) && 'is_uri?'; + })($nesting[0], null, $nesting) + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/abstract_block"] = function(Opal) { + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + function $rb_gt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); + } + function $rb_plus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $hash2 = Opal.hash2, $send = Opal.send, $truthy = Opal.truthy; + + Opal.add_stubs(['$attr_reader', '$attr_writer', '$attr_accessor', '$==', '$!=', '$level', '$file', '$lineno', '$playback_attributes', '$convert', '$converter', '$join', '$map', '$to_s', '$parent', '$parent=', '$-', '$<<', '$!', '$empty?', '$>', '$find_by_internal', '$to_proc', '$[]', '$has_role?', '$replace', '$raise', '$===', '$header?', '$each', '$flatten', '$context', '$blocks', '$+', '$find_index', '$next_adjacent_block', '$select', '$sub_specialchars', '$match?', '$sub_replacements', '$title', '$apply_title_subs', '$include?', '$delete', '$reftext', '$sprintf', '$sub_quotes', '$compat_mode', '$attributes', '$chomp', '$increment_and_store_counter', '$index=', '$numbered', '$sectname', '$counter', '$numeral=', '$numeral', '$caption=', '$assign_numeral', '$reindex_sections']); + return (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + (function($base, $super, $parent_nesting) { + function $AbstractBlock(){}; + var self = $AbstractBlock = $klass($base, $super, 'AbstractBlock', $AbstractBlock); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_AbstractBlock_initialize_1, TMP_AbstractBlock_block$q_2, TMP_AbstractBlock_inline$q_3, TMP_AbstractBlock_file_4, TMP_AbstractBlock_lineno_5, TMP_AbstractBlock_convert_6, TMP_AbstractBlock_content_7, TMP_AbstractBlock_context$eq_9, TMP_AbstractBlock_$lt$lt_10, TMP_AbstractBlock_blocks$q_11, TMP_AbstractBlock_sections$q_12, TMP_AbstractBlock_find_by_13, TMP_AbstractBlock_find_by_internal_14, TMP_AbstractBlock_next_adjacent_block_17, TMP_AbstractBlock_sections_18, TMP_AbstractBlock_alt_20, TMP_AbstractBlock_caption_21, TMP_AbstractBlock_captioned_title_22, TMP_AbstractBlock_list_marker_keyword_23, TMP_AbstractBlock_title_24, TMP_AbstractBlock_title$q_25, TMP_AbstractBlock_title$eq_26, TMP_AbstractBlock_sub$q_27, TMP_AbstractBlock_remove_sub_28, TMP_AbstractBlock_xreftext_29, TMP_AbstractBlock_assign_caption_30, TMP_AbstractBlock_assign_numeral_31, TMP_AbstractBlock_reindex_sections_32; + + def.source_location = def.document = def.attributes = def.blocks = def.next_section_index = def.context = def.style = def.id = def.header = def.caption = def.title_converted = def.converted_title = def.title = def.subs = def.numeral = def.next_section_ordinal = nil; + + self.$attr_reader("blocks"); + self.$attr_writer("caption"); + self.$attr_accessor("content_model"); + self.$attr_accessor("level"); + self.$attr_accessor("numeral"); + Opal.alias(self, "number", "numeral"); + Opal.alias(self, "number=", "numeral="); + self.$attr_accessor("source_location"); + self.$attr_accessor("style"); + self.$attr_reader("subs"); + + Opal.def(self, '$initialize', TMP_AbstractBlock_initialize_1 = function $$initialize(parent, context, opts) { + var $a, $iter = TMP_AbstractBlock_initialize_1.$$p, $yield = $iter || nil, self = this, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_AbstractBlock_initialize_1.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + + + if (opts == null) { + opts = $hash2([], {}); + }; + $send(self, Opal.find_super_dispatcher(self, 'initialize', TMP_AbstractBlock_initialize_1, false), $zuper, $iter); + self.content_model = "compound"; + self.blocks = []; + self.subs = []; + self.id = (self.title = (self.title_converted = (self.caption = (self.numeral = (self.style = (self.default_subs = (self.source_location = nil))))))); + if (context['$==']("document")) { + self.level = 0 + } else if ($truthy(($truthy($a = parent) ? context['$!=']("section") : $a))) { + self.level = parent.$level() + } else { + self.level = nil + }; + self.next_section_index = 0; + return (self.next_section_ordinal = 1); + }, TMP_AbstractBlock_initialize_1.$$arity = -3); + + Opal.def(self, '$block?', TMP_AbstractBlock_block$q_2 = function() { + var self = this; + + return true + }, TMP_AbstractBlock_block$q_2.$$arity = 0); + + Opal.def(self, '$inline?', TMP_AbstractBlock_inline$q_3 = function() { + var self = this; + + return false + }, TMP_AbstractBlock_inline$q_3.$$arity = 0); + + Opal.def(self, '$file', TMP_AbstractBlock_file_4 = function $$file() { + var $a, self = this; + + return ($truthy($a = self.source_location) ? self.source_location.$file() : $a) + }, TMP_AbstractBlock_file_4.$$arity = 0); + + Opal.def(self, '$lineno', TMP_AbstractBlock_lineno_5 = function $$lineno() { + var $a, self = this; + + return ($truthy($a = self.source_location) ? self.source_location.$lineno() : $a) + }, TMP_AbstractBlock_lineno_5.$$arity = 0); + + Opal.def(self, '$convert', TMP_AbstractBlock_convert_6 = function $$convert() { + var self = this; + + + self.document.$playback_attributes(self.attributes); + return self.$converter().$convert(self); + }, TMP_AbstractBlock_convert_6.$$arity = 0); + Opal.alias(self, "render", "convert"); + + Opal.def(self, '$content', TMP_AbstractBlock_content_7 = function $$content() { + var TMP_8, self = this; + + return $send(self.blocks, 'map', [], (TMP_8 = function(b){var self = TMP_8.$$s || this; + + + + if (b == null) { + b = nil; + }; + return b.$convert();}, TMP_8.$$s = self, TMP_8.$$arity = 1, TMP_8)).$join($$($nesting, 'LF')) + }, TMP_AbstractBlock_content_7.$$arity = 0); + + Opal.def(self, '$context=', TMP_AbstractBlock_context$eq_9 = function(context) { + var self = this; + + return (self.node_name = (self.context = context).$to_s()) + }, TMP_AbstractBlock_context$eq_9.$$arity = 1); + + Opal.def(self, '$<<', TMP_AbstractBlock_$lt$lt_10 = function(block) { + var self = this, $writer = nil; + + + if (block.$parent()['$=='](self)) { + } else { + + $writer = [self]; + $send(block, 'parent=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + self.blocks['$<<'](block); + return self; + }, TMP_AbstractBlock_$lt$lt_10.$$arity = 1); + Opal.alias(self, "append", "<<"); + + Opal.def(self, '$blocks?', TMP_AbstractBlock_blocks$q_11 = function() { + var self = this; + + return self.blocks['$empty?']()['$!']() + }, TMP_AbstractBlock_blocks$q_11.$$arity = 0); + + Opal.def(self, '$sections?', TMP_AbstractBlock_sections$q_12 = function() { + var self = this; + + return $rb_gt(self.next_section_index, 0) + }, TMP_AbstractBlock_sections$q_12.$$arity = 0); + + Opal.def(self, '$find_by', TMP_AbstractBlock_find_by_13 = function $$find_by(selector) { + var $iter = TMP_AbstractBlock_find_by_13.$$p, block = $iter || nil, self = this, result = nil; + + if ($iter) TMP_AbstractBlock_find_by_13.$$p = null; + + + if ($iter) TMP_AbstractBlock_find_by_13.$$p = null;; + + if (selector == null) { + selector = $hash2([], {}); + }; + try { + return $send(self, 'find_by_internal', [selector, (result = [])], block.$to_proc()) + } catch ($err) { + if (Opal.rescue($err, [$$$('::', 'StopIteration')])) { + try { + return result + } finally { Opal.pop_exception() } + } else { throw $err; } + }; + }, TMP_AbstractBlock_find_by_13.$$arity = -1); + Opal.alias(self, "query", "find_by"); + + Opal.def(self, '$find_by_internal', TMP_AbstractBlock_find_by_internal_14 = function $$find_by_internal(selector, result) { + var $iter = TMP_AbstractBlock_find_by_internal_14.$$p, block = $iter || nil, $a, $b, $c, $d, TMP_15, TMP_16, self = this, any_context = nil, context_selector = nil, style_selector = nil, role_selector = nil, id_selector = nil, verdict = nil, $case = nil; + + if ($iter) TMP_AbstractBlock_find_by_internal_14.$$p = null; + + + if ($iter) TMP_AbstractBlock_find_by_internal_14.$$p = null;; + + if (selector == null) { + selector = $hash2([], {}); + }; + + if (result == null) { + result = []; + }; + if ($truthy(($truthy($a = ($truthy($b = ($truthy($c = ($truthy($d = (any_context = (context_selector = selector['$[]']("context"))['$!']())) ? $d : context_selector['$=='](self.context))) ? ($truthy($d = (style_selector = selector['$[]']("style"))['$!']()) ? $d : style_selector['$=='](self.style)) : $c)) ? ($truthy($c = (role_selector = selector['$[]']("role"))['$!']()) ? $c : self['$has_role?'](role_selector)) : $b)) ? ($truthy($b = (id_selector = selector['$[]']("id"))['$!']()) ? $b : id_selector['$=='](self.id)) : $a))) { + if ($truthy(id_selector)) { + + result.$replace((function() {if ((block !== nil)) { + + if ($truthy(Opal.yield1(block, self))) { + return [self] + } else { + return [] + }; + } else { + return [self] + }; return nil; })()); + self.$raise($$$('::', 'StopIteration')); + } else if ((block !== nil)) { + if ($truthy((verdict = Opal.yield1(block, self)))) { + $case = verdict; + if ("skip_children"['$===']($case)) { + result['$<<'](self); + return result;} + else if ("skip"['$===']($case)) {return result} + else {result['$<<'](self)}} + } else { + result['$<<'](self) + }}; + if ($truthy(($truthy($a = (($b = self.context['$==']("document")) ? ($truthy($c = any_context) ? $c : context_selector['$==']("section")) : self.context['$==']("document"))) ? self['$header?']() : $a))) { + $send(self.header, 'find_by_internal', [selector, result], block.$to_proc())}; + if (context_selector['$==']("document")) { + } else if (self.context['$==']("dlist")) { + if ($truthy(($truthy($a = any_context) ? $a : context_selector['$!=']("section")))) { + $send(self.blocks.$flatten(), 'each', [], (TMP_15 = function(li){var self = TMP_15.$$s || this; + + + + if (li == null) { + li = nil; + }; + if ($truthy(li)) { + return $send(li, 'find_by_internal', [selector, result], block.$to_proc()) + } else { + return nil + };}, TMP_15.$$s = self, TMP_15.$$arity = 1, TMP_15))} + } else if ($truthy($send(self.blocks, 'each', [], (TMP_16 = function(b){var self = TMP_16.$$s || this, $e; + + + + if (b == null) { + b = nil; + }; + if ($truthy((($e = context_selector['$==']("section")) ? b.$context()['$!=']("section") : context_selector['$==']("section")))) { + return nil;}; + return $send(b, 'find_by_internal', [selector, result], block.$to_proc());}, TMP_16.$$s = self, TMP_16.$$arity = 1, TMP_16)))) {}; + return result; + }, TMP_AbstractBlock_find_by_internal_14.$$arity = -1); + + Opal.def(self, '$next_adjacent_block', TMP_AbstractBlock_next_adjacent_block_17 = function $$next_adjacent_block() { + var self = this, sib = nil, p = nil; + + if (self.context['$==']("document")) { + return nil + } else if ($truthy((sib = (p = self.$parent()).$blocks()['$[]']($rb_plus(p.$blocks().$find_index(self), 1))))) { + return sib + } else { + return p.$next_adjacent_block() + } + }, TMP_AbstractBlock_next_adjacent_block_17.$$arity = 0); + + Opal.def(self, '$sections', TMP_AbstractBlock_sections_18 = function $$sections() { + var TMP_19, self = this; + + return $send(self.blocks, 'select', [], (TMP_19 = function(block){var self = TMP_19.$$s || this; + + + + if (block == null) { + block = nil; + }; + return block.$context()['$==']("section");}, TMP_19.$$s = self, TMP_19.$$arity = 1, TMP_19)) + }, TMP_AbstractBlock_sections_18.$$arity = 0); + + Opal.def(self, '$alt', TMP_AbstractBlock_alt_20 = function $$alt() { + var self = this, text = nil; + + if ($truthy((text = self.attributes['$[]']("alt")))) { + if (text['$=='](self.attributes['$[]']("default-alt"))) { + return self.$sub_specialchars(text) + } else { + + text = self.$sub_specialchars(text); + if ($truthy($$($nesting, 'ReplaceableTextRx')['$match?'](text))) { + + return self.$sub_replacements(text); + } else { + return text + }; + } + } else { + return nil + } + }, TMP_AbstractBlock_alt_20.$$arity = 0); + + Opal.def(self, '$caption', TMP_AbstractBlock_caption_21 = function $$caption() { + var self = this; + + if (self.context['$==']("admonition")) { + return self.attributes['$[]']("textlabel") + } else { + return self.caption + } + }, TMP_AbstractBlock_caption_21.$$arity = 0); + + Opal.def(self, '$captioned_title', TMP_AbstractBlock_captioned_title_22 = function $$captioned_title() { + var self = this; + + return "" + (self.caption) + (self.$title()) + }, TMP_AbstractBlock_captioned_title_22.$$arity = 0); + + Opal.def(self, '$list_marker_keyword', TMP_AbstractBlock_list_marker_keyword_23 = function $$list_marker_keyword(list_type) { + var $a, self = this; + + + + if (list_type == null) { + list_type = nil; + }; + return $$($nesting, 'ORDERED_LIST_KEYWORDS')['$[]'](($truthy($a = list_type) ? $a : self.style)); + }, TMP_AbstractBlock_list_marker_keyword_23.$$arity = -1); + + Opal.def(self, '$title', TMP_AbstractBlock_title_24 = function $$title() { + var $a, $b, self = this; + + if ($truthy(self.title_converted)) { + return self.converted_title + } else { + + return (self.converted_title = ($truthy($a = ($truthy($b = (self.title_converted = true)) ? self.title : $b)) ? self.$apply_title_subs(self.title) : $a)); + } + }, TMP_AbstractBlock_title_24.$$arity = 0); + + Opal.def(self, '$title?', TMP_AbstractBlock_title$q_25 = function() { + var self = this; + + if ($truthy(self.title)) { + return true + } else { + return false + } + }, TMP_AbstractBlock_title$q_25.$$arity = 0); + + Opal.def(self, '$title=', TMP_AbstractBlock_title$eq_26 = function(val) { + var $a, self = this; + + return $a = [val, nil], (self.title = $a[0]), (self.title_converted = $a[1]), $a + }, TMP_AbstractBlock_title$eq_26.$$arity = 1); + + Opal.def(self, '$sub?', TMP_AbstractBlock_sub$q_27 = function(name) { + var self = this; + + return self.subs['$include?'](name) + }, TMP_AbstractBlock_sub$q_27.$$arity = 1); + + Opal.def(self, '$remove_sub', TMP_AbstractBlock_remove_sub_28 = function $$remove_sub(sub) { + var self = this; + + + self.subs.$delete(sub); + return nil; + }, TMP_AbstractBlock_remove_sub_28.$$arity = 1); + + Opal.def(self, '$xreftext', TMP_AbstractBlock_xreftext_29 = function $$xreftext(xrefstyle) { + var $a, $b, self = this, val = nil, $case = nil, quoted_title = nil, prefix = nil; + + + + if (xrefstyle == null) { + xrefstyle = nil; + }; + if ($truthy(($truthy($a = (val = self.$reftext())) ? val['$empty?']()['$!']() : $a))) { + return val + } else if ($truthy(($truthy($a = ($truthy($b = xrefstyle) ? self.title : $b)) ? self.caption : $a))) { + return (function() {$case = xrefstyle; + if ("full"['$===']($case)) { + quoted_title = self.$sprintf(self.$sub_quotes((function() {if ($truthy(self.document.$compat_mode())) { + return "``%s''" + } else { + return "\"`%s`\"" + }; return nil; })()), self.$title()); + if ($truthy(($truthy($a = self.numeral) ? (prefix = self.document.$attributes()['$[]']((function() {if (self.context['$==']("image")) { + return "figure-caption" + } else { + return "" + (self.context) + "-caption" + }; return nil; })())) : $a))) { + return "" + (prefix) + " " + (self.numeral) + ", " + (quoted_title) + } else { + return "" + (self.caption.$chomp(". ")) + ", " + (quoted_title) + };} + else if ("short"['$===']($case)) {if ($truthy(($truthy($a = self.numeral) ? (prefix = self.document.$attributes()['$[]']((function() {if (self.context['$==']("image")) { + return "figure-caption" + } else { + return "" + (self.context) + "-caption" + }; return nil; })())) : $a))) { + return "" + (prefix) + " " + (self.numeral) + } else { + return self.caption.$chomp(". ") + }} + else {return self.$title()}})() + } else { + return self.$title() + }; + }, TMP_AbstractBlock_xreftext_29.$$arity = -1); + + Opal.def(self, '$assign_caption', TMP_AbstractBlock_assign_caption_30 = function $$assign_caption(value, key) { + var $a, $b, self = this, prefix = nil; + + + + if (value == null) { + value = nil; + }; + + if (key == null) { + key = nil; + }; + if ($truthy(($truthy($a = ($truthy($b = self.caption) ? $b : self.title['$!']())) ? $a : (self.caption = ($truthy($b = value) ? $b : self.document.$attributes()['$[]']("caption")))))) { + return nil + } else if ($truthy((prefix = self.document.$attributes()['$[]']("" + ((key = ($truthy($a = key) ? $a : self.context))) + "-caption")))) { + + self.caption = "" + (prefix) + " " + ((self.numeral = self.document.$increment_and_store_counter("" + (key) + "-number", self))) + ". "; + return nil; + } else { + return nil + }; + }, TMP_AbstractBlock_assign_caption_30.$$arity = -1); + + Opal.def(self, '$assign_numeral', TMP_AbstractBlock_assign_numeral_31 = function $$assign_numeral(section) { + var $a, self = this, $writer = nil, like = nil, sectname = nil, caption = nil; + + + self.next_section_index = $rb_plus((($writer = [self.next_section_index]), $send(section, 'index=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]), 1); + if ($truthy((like = section.$numbered()))) { + if ((sectname = section.$sectname())['$==']("appendix")) { + + + $writer = [self.document.$counter("appendix-number", "A")]; + $send(section, 'numeral=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + if ($truthy((caption = self.document.$attributes()['$[]']("appendix-caption")))) { + + $writer = ["" + (caption) + " " + (section.$numeral()) + ": "]; + $send(section, 'caption=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + } else { + + $writer = ["" + (section.$numeral()) + ". "]; + $send(section, 'caption=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + } else if ($truthy(($truthy($a = sectname['$==']("chapter")) ? $a : like['$==']("chapter")))) { + + $writer = [self.document.$counter("chapter-number", 1)]; + $send(section, 'numeral=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + } else { + + + $writer = [self.next_section_ordinal]; + $send(section, 'numeral=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + self.next_section_ordinal = $rb_plus(self.next_section_ordinal, 1); + }}; + return nil; + }, TMP_AbstractBlock_assign_numeral_31.$$arity = 1); + return (Opal.def(self, '$reindex_sections', TMP_AbstractBlock_reindex_sections_32 = function $$reindex_sections() { + var TMP_33, self = this; + + + self.next_section_index = 0; + self.next_section_ordinal = 1; + return $send(self.blocks, 'each', [], (TMP_33 = function(block){var self = TMP_33.$$s || this; + + + + if (block == null) { + block = nil; + }; + if (block.$context()['$==']("section")) { + + self.$assign_numeral(block); + return block.$reindex_sections(); + } else { + return nil + };}, TMP_33.$$s = self, TMP_33.$$arity = 1, TMP_33)); + }, TMP_AbstractBlock_reindex_sections_32.$$arity = 0), nil) && 'reindex_sections'; + })($nesting[0], $$($nesting, 'AbstractNode'), $nesting) + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/attribute_list"] = function(Opal) { + function $rb_plus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); + } + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + function $rb_times(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs * rhs : lhs['$*'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $hash = Opal.hash, $hash2 = Opal.hash2, $truthy = Opal.truthy, $send = Opal.send; + + Opal.add_stubs(['$new', '$[]', '$update', '$parse', '$parse_attribute', '$eos?', '$skip_delimiter', '$+', '$rekey', '$each_with_index', '$[]=', '$-', '$skip_blank', '$==', '$peek', '$parse_attribute_value', '$get_byte', '$start_with?', '$scan_name', '$!', '$!=', '$*', '$scan_to_delimiter', '$===', '$include?', '$delete', '$each', '$split', '$empty?', '$strip', '$apply_subs', '$scan_to_quote', '$gsub', '$skip', '$scan']); + return (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + (function($base, $super, $parent_nesting) { + function $AttributeList(){}; + var self = $AttributeList = $klass($base, $super, 'AttributeList', $AttributeList); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_AttributeList_initialize_1, TMP_AttributeList_parse_into_2, TMP_AttributeList_parse_3, TMP_AttributeList_rekey_4, TMP_AttributeList_rekey_5, TMP_AttributeList_parse_attribute_7, TMP_AttributeList_parse_attribute_value_9, TMP_AttributeList_skip_blank_10, TMP_AttributeList_skip_delimiter_11, TMP_AttributeList_scan_name_12, TMP_AttributeList_scan_to_delimiter_13, TMP_AttributeList_scan_to_quote_14; + + def.attributes = def.scanner = def.delimiter = def.block = def.delimiter_skip_pattern = def.delimiter_boundary_pattern = nil; + + Opal.const_set($nesting[0], 'BACKSLASH', "\\"); + Opal.const_set($nesting[0], 'APOS', "'"); + Opal.const_set($nesting[0], 'BoundaryRxs', $hash("\"", /.*?[^\\](?=")/, $$($nesting, 'APOS'), /.*?[^\\](?=')/, ",", /.*?(?=[ \t]*(,|$))/)); + Opal.const_set($nesting[0], 'EscapedQuotes', $hash("\"", "\\\"", $$($nesting, 'APOS'), "\\'")); + Opal.const_set($nesting[0], 'NameRx', new RegExp("" + ($$($nesting, 'CG_WORD')) + "[" + ($$($nesting, 'CC_WORD')) + "\\-.]*")); + Opal.const_set($nesting[0], 'BlankRx', /[ \t]+/); + Opal.const_set($nesting[0], 'SkipRxs', $hash2(["blank", ","], {"blank": $$($nesting, 'BlankRx'), ",": /[ \t]*(,|$)/})); + + Opal.def(self, '$initialize', TMP_AttributeList_initialize_1 = function $$initialize(source, block, delimiter) { + var self = this; + + + + if (block == null) { + block = nil; + }; + + if (delimiter == null) { + delimiter = ","; + }; + self.scanner = $$$('::', 'StringScanner').$new(source); + self.block = block; + self.delimiter = delimiter; + self.delimiter_skip_pattern = $$($nesting, 'SkipRxs')['$[]'](delimiter); + self.delimiter_boundary_pattern = $$($nesting, 'BoundaryRxs')['$[]'](delimiter); + return (self.attributes = nil); + }, TMP_AttributeList_initialize_1.$$arity = -2); + + Opal.def(self, '$parse_into', TMP_AttributeList_parse_into_2 = function $$parse_into(attributes, posattrs) { + var self = this; + + + + if (posattrs == null) { + posattrs = []; + }; + return attributes.$update(self.$parse(posattrs)); + }, TMP_AttributeList_parse_into_2.$$arity = -2); + + Opal.def(self, '$parse', TMP_AttributeList_parse_3 = function $$parse(posattrs) { + var $a, self = this, index = nil; + + + + if (posattrs == null) { + posattrs = []; + }; + if ($truthy(self.attributes)) { + return self.attributes}; + self.attributes = $hash2([], {}); + index = 0; + while ($truthy(self.$parse_attribute(index, posattrs))) { + + if ($truthy(self.scanner['$eos?']())) { + break;}; + self.$skip_delimiter(); + index = $rb_plus(index, 1); + }; + return self.attributes; + }, TMP_AttributeList_parse_3.$$arity = -1); + + Opal.def(self, '$rekey', TMP_AttributeList_rekey_4 = function $$rekey(posattrs) { + var self = this; + + return $$($nesting, 'AttributeList').$rekey(self.attributes, posattrs) + }, TMP_AttributeList_rekey_4.$$arity = 1); + Opal.defs(self, '$rekey', TMP_AttributeList_rekey_5 = function $$rekey(attributes, pos_attrs) { + var TMP_6, self = this; + + + $send(pos_attrs, 'each_with_index', [], (TMP_6 = function(key, index){var self = TMP_6.$$s || this, pos = nil, val = nil, $writer = nil; + + + + if (key == null) { + key = nil; + }; + + if (index == null) { + index = nil; + }; + if ($truthy(key)) { + } else { + return nil; + }; + pos = $rb_plus(index, 1); + if ($truthy((val = attributes['$[]'](pos)))) { + + $writer = [key, val]; + $send(attributes, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + } else { + return nil + };}, TMP_6.$$s = self, TMP_6.$$arity = 2, TMP_6)); + return attributes; + }, TMP_AttributeList_rekey_5.$$arity = 2); + + Opal.def(self, '$parse_attribute', TMP_AttributeList_parse_attribute_7 = function $$parse_attribute(index, pos_attrs) { + var $a, TMP_8, self = this, single_quoted_value = nil, first = nil, name = nil, value = nil, skipped = nil, c = nil, $case = nil, $writer = nil, resolved_name = nil, pos_name = nil; + + + + if (index == null) { + index = 0; + }; + + if (pos_attrs == null) { + pos_attrs = []; + }; + single_quoted_value = false; + self.$skip_blank(); + if ((first = self.scanner.$peek(1))['$==']("\"")) { + + name = self.$parse_attribute_value(self.scanner.$get_byte()); + value = nil; + } else if (first['$==']($$($nesting, 'APOS'))) { + + name = self.$parse_attribute_value(self.scanner.$get_byte()); + value = nil; + if ($truthy(name['$start_with?']($$($nesting, 'APOS')))) { + } else { + single_quoted_value = true + }; + } else { + + name = self.$scan_name(); + skipped = 0; + c = nil; + if ($truthy(self.scanner['$eos?']())) { + if ($truthy(name)) { + } else { + return false + } + } else { + + skipped = ($truthy($a = self.$skip_blank()) ? $a : 0); + c = self.scanner.$get_byte(); + }; + if ($truthy(($truthy($a = c['$!']()) ? $a : c['$=='](self.delimiter)))) { + value = nil + } else if ($truthy(($truthy($a = c['$!=']("=")) ? $a : name['$!']()))) { + + name = "" + (name) + ($rb_times(" ", skipped)) + (c) + (self.$scan_to_delimiter()); + value = nil; + } else { + + self.$skip_blank(); + if ($truthy(self.scanner.$peek(1))) { + if ((c = self.scanner.$get_byte())['$==']("\"")) { + value = self.$parse_attribute_value(c) + } else if (c['$==']($$($nesting, 'APOS'))) { + + value = self.$parse_attribute_value(c); + if ($truthy(value['$start_with?']($$($nesting, 'APOS')))) { + } else { + single_quoted_value = true + }; + } else if (c['$=='](self.delimiter)) { + value = "" + } else { + + value = "" + (c) + (self.$scan_to_delimiter()); + if (value['$==']("None")) { + return true}; + }}; + }; + }; + if ($truthy(value)) { + $case = name; + if ("options"['$===']($case) || "opts"['$===']($case)) { + if ($truthy(value['$include?'](","))) { + + if ($truthy(value['$include?'](" "))) { + value = value.$delete(" ")}; + $send(value.$split(","), 'each', [], (TMP_8 = function(opt){var self = TMP_8.$$s || this, $writer = nil; + if (self.attributes == null) self.attributes = nil; + + + + if (opt == null) { + opt = nil; + }; + if ($truthy(opt['$empty?']())) { + return nil + } else { + + $writer = ["" + (opt) + "-option", ""]; + $send(self.attributes, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + };}, TMP_8.$$s = self, TMP_8.$$arity = 1, TMP_8)); + } else { + + $writer = ["" + ((value = value.$strip())) + "-option", ""]; + $send(self.attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + + $writer = ["options", value]; + $send(self.attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];;} + else {if ($truthy(($truthy($a = single_quoted_value) ? self.block : $a))) { + $case = name; + if ("title"['$===']($case) || "reftext"['$===']($case)) { + $writer = [name, value]; + $send(self.attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];} + else { + $writer = [name, self.block.$apply_subs(value)]; + $send(self.attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];} + } else { + + $writer = [name, value]; + $send(self.attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }} + } else { + + resolved_name = (function() {if ($truthy(($truthy($a = single_quoted_value) ? self.block : $a))) { + + return self.block.$apply_subs(name); + } else { + return name + }; return nil; })(); + if ($truthy((pos_name = pos_attrs['$[]'](index)))) { + + $writer = [pos_name, resolved_name]; + $send(self.attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + + $writer = [$rb_plus(index, 1), resolved_name]; + $send(self.attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + }; + return true; + }, TMP_AttributeList_parse_attribute_7.$$arity = -1); + + Opal.def(self, '$parse_attribute_value', TMP_AttributeList_parse_attribute_value_9 = function $$parse_attribute_value(quote) { + var self = this, value = nil; + + + if (self.scanner.$peek(1)['$=='](quote)) { + + self.scanner.$get_byte(); + return "";}; + if ($truthy((value = self.$scan_to_quote(quote)))) { + + self.scanner.$get_byte(); + if ($truthy(value['$include?']($$($nesting, 'BACKSLASH')))) { + return value.$gsub($$($nesting, 'EscapedQuotes')['$[]'](quote), quote) + } else { + return value + }; + } else { + return "" + (quote) + (self.$scan_to_delimiter()) + }; + }, TMP_AttributeList_parse_attribute_value_9.$$arity = 1); + + Opal.def(self, '$skip_blank', TMP_AttributeList_skip_blank_10 = function $$skip_blank() { + var self = this; + + return self.scanner.$skip($$($nesting, 'BlankRx')) + }, TMP_AttributeList_skip_blank_10.$$arity = 0); + + Opal.def(self, '$skip_delimiter', TMP_AttributeList_skip_delimiter_11 = function $$skip_delimiter() { + var self = this; + + return self.scanner.$skip(self.delimiter_skip_pattern) + }, TMP_AttributeList_skip_delimiter_11.$$arity = 0); + + Opal.def(self, '$scan_name', TMP_AttributeList_scan_name_12 = function $$scan_name() { + var self = this; + + return self.scanner.$scan($$($nesting, 'NameRx')) + }, TMP_AttributeList_scan_name_12.$$arity = 0); + + Opal.def(self, '$scan_to_delimiter', TMP_AttributeList_scan_to_delimiter_13 = function $$scan_to_delimiter() { + var self = this; + + return self.scanner.$scan(self.delimiter_boundary_pattern) + }, TMP_AttributeList_scan_to_delimiter_13.$$arity = 0); + return (Opal.def(self, '$scan_to_quote', TMP_AttributeList_scan_to_quote_14 = function $$scan_to_quote(quote) { + var self = this; + + return self.scanner.$scan($$($nesting, 'BoundaryRxs')['$[]'](quote)) + }, TMP_AttributeList_scan_to_quote_14.$$arity = 1), nil) && 'scan_to_quote'; + })($nesting[0], null, $nesting) + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/block"] = function(Opal) { + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + function $rb_lt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $send = Opal.send, $hash2 = Opal.hash2, $truthy = Opal.truthy; + + Opal.add_stubs(['$default=', '$-', '$attr_accessor', '$[]', '$key?', '$==', '$===', '$drop', '$delete', '$[]=', '$lock_in_subs', '$nil_or_empty?', '$normalize_lines_from_string', '$apply_subs', '$join', '$<', '$size', '$empty?', '$rstrip', '$shift', '$pop', '$warn', '$logger', '$to_s', '$class', '$object_id', '$inspect']); + return (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + (function($base, $super, $parent_nesting) { + function $Block(){}; + var self = $Block = $klass($base, $super, 'Block', $Block); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Block_initialize_1, TMP_Block_content_2, TMP_Block_source_3, TMP_Block_to_s_4, $writer = nil; + + def.attributes = def.content_model = def.lines = def.subs = def.blocks = def.context = def.style = nil; + + + $writer = ["simple"]; + $send(Opal.const_set($nesting[0], 'DEFAULT_CONTENT_MODEL', $hash2(["audio", "image", "listing", "literal", "stem", "open", "page_break", "pass", "thematic_break", "video"], {"audio": "empty", "image": "empty", "listing": "verbatim", "literal": "verbatim", "stem": "raw", "open": "compound", "page_break": "empty", "pass": "raw", "thematic_break": "empty", "video": "empty"})), 'default=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + Opal.alias(self, "blockname", "context"); + self.$attr_accessor("lines"); + + Opal.def(self, '$initialize', TMP_Block_initialize_1 = function $$initialize(parent, context, opts) { + var $a, $iter = TMP_Block_initialize_1.$$p, $yield = $iter || nil, self = this, subs = nil, $writer = nil, raw_source = nil, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_Block_initialize_1.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + + + if (opts == null) { + opts = $hash2([], {}); + }; + $send(self, Opal.find_super_dispatcher(self, 'initialize', TMP_Block_initialize_1, false), $zuper, $iter); + self.content_model = ($truthy($a = opts['$[]']("content_model")) ? $a : $$($nesting, 'DEFAULT_CONTENT_MODEL')['$[]'](context)); + if ($truthy(opts['$key?']("subs"))) { + if ($truthy((subs = opts['$[]']("subs")))) { + + if (subs['$==']("default")) { + self.default_subs = opts['$[]']("default_subs") + } else if ($truthy($$$('::', 'Array')['$==='](subs))) { + + self.default_subs = subs.$drop(0); + self.attributes.$delete("subs"); + } else { + + self.default_subs = nil; + + $writer = ["subs", "" + (subs)]; + $send(self.attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + }; + self.$lock_in_subs(); + } else { + + self.default_subs = []; + self.attributes.$delete("subs"); + } + } else { + self.default_subs = nil + }; + if ($truthy((raw_source = opts['$[]']("source"))['$nil_or_empty?']())) { + return (self.lines = []) + } else if ($truthy($$$('::', 'String')['$==='](raw_source))) { + return (self.lines = $$($nesting, 'Helpers').$normalize_lines_from_string(raw_source)) + } else { + return (self.lines = raw_source.$drop(0)) + }; + }, TMP_Block_initialize_1.$$arity = -3); + + Opal.def(self, '$content', TMP_Block_content_2 = function $$content() { + var $a, $b, $iter = TMP_Block_content_2.$$p, $yield = $iter || nil, self = this, $case = nil, result = nil, first = nil, last = nil, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_Block_content_2.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + return (function() {$case = self.content_model; + if ("compound"['$===']($case)) {return $send(self, Opal.find_super_dispatcher(self, 'content', TMP_Block_content_2, false), $zuper, $iter)} + else if ("simple"['$===']($case)) {return self.$apply_subs(self.lines.$join($$($nesting, 'LF')), self.subs)} + else if ("verbatim"['$===']($case) || "raw"['$===']($case)) { + result = self.$apply_subs(self.lines, self.subs); + if ($truthy($rb_lt(result.$size(), 2))) { + return result['$[]'](0) + } else { + + while ($truthy(($truthy($b = (first = result['$[]'](0))) ? first.$rstrip()['$empty?']() : $b))) { + result.$shift() + }; + while ($truthy(($truthy($b = (last = result['$[]'](-1))) ? last.$rstrip()['$empty?']() : $b))) { + result.$pop() + }; + return result.$join($$($nesting, 'LF')); + };} + else { + if (self.content_model['$==']("empty")) { + } else { + self.$logger().$warn("" + "Unknown content model '" + (self.content_model) + "' for block: " + (self.$to_s())) + }; + return nil;}})() + }, TMP_Block_content_2.$$arity = 0); + + Opal.def(self, '$source', TMP_Block_source_3 = function $$source() { + var self = this; + + return self.lines.$join($$($nesting, 'LF')) + }, TMP_Block_source_3.$$arity = 0); + return (Opal.def(self, '$to_s', TMP_Block_to_s_4 = function $$to_s() { + var self = this, content_summary = nil; + + + content_summary = (function() {if (self.content_model['$==']("compound")) { + return "" + "blocks: " + (self.blocks.$size()) + } else { + return "" + "lines: " + (self.lines.$size()) + }; return nil; })(); + return "" + "#<" + (self.$class()) + "@" + (self.$object_id()) + " {context: " + (self.context.$inspect()) + ", content_model: " + (self.content_model.$inspect()) + ", style: " + (self.style.$inspect()) + ", " + (content_summary) + "}>"; + }, TMP_Block_to_s_4.$$arity = 0), nil) && 'to_s'; + })($nesting[0], $$($nesting, 'AbstractBlock'), $nesting) + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/callouts"] = function(Opal) { + function $rb_plus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); + } + function $rb_le(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs <= rhs : lhs['$<='](rhs); + } + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + function $rb_lt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $hash2 = Opal.hash2, $truthy = Opal.truthy, $send = Opal.send; + + Opal.add_stubs(['$next_list', '$<<', '$current_list', '$to_i', '$generate_next_callout_id', '$+', '$<=', '$size', '$[]', '$-', '$chop', '$join', '$map', '$==', '$<', '$generate_callout_id']); + return (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + (function($base, $super, $parent_nesting) { + function $Callouts(){}; + var self = $Callouts = $klass($base, $super, 'Callouts', $Callouts); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Callouts_initialize_1, TMP_Callouts_register_2, TMP_Callouts_read_next_id_3, TMP_Callouts_callout_ids_4, TMP_Callouts_current_list_6, TMP_Callouts_next_list_7, TMP_Callouts_rewind_8, TMP_Callouts_generate_next_callout_id_9, TMP_Callouts_generate_callout_id_10; + + def.co_index = def.lists = def.list_index = nil; + + + Opal.def(self, '$initialize', TMP_Callouts_initialize_1 = function $$initialize() { + var self = this; + + + self.lists = []; + self.list_index = 0; + return self.$next_list(); + }, TMP_Callouts_initialize_1.$$arity = 0); + + Opal.def(self, '$register', TMP_Callouts_register_2 = function $$register(li_ordinal) { + var self = this, id = nil; + + + self.$current_list()['$<<']($hash2(["ordinal", "id"], {"ordinal": li_ordinal.$to_i(), "id": (id = self.$generate_next_callout_id())})); + self.co_index = $rb_plus(self.co_index, 1); + return id; + }, TMP_Callouts_register_2.$$arity = 1); + + Opal.def(self, '$read_next_id', TMP_Callouts_read_next_id_3 = function $$read_next_id() { + var self = this, id = nil, list = nil; + + + id = nil; + list = self.$current_list(); + if ($truthy($rb_le(self.co_index, list.$size()))) { + id = list['$[]']($rb_minus(self.co_index, 1))['$[]']("id")}; + self.co_index = $rb_plus(self.co_index, 1); + return id; + }, TMP_Callouts_read_next_id_3.$$arity = 0); + + Opal.def(self, '$callout_ids', TMP_Callouts_callout_ids_4 = function $$callout_ids(li_ordinal) { + var TMP_5, self = this; + + return $send(self.$current_list(), 'map', [], (TMP_5 = function(it){var self = TMP_5.$$s || this; + + + + if (it == null) { + it = nil; + }; + if (it['$[]']("ordinal")['$=='](li_ordinal)) { + return "" + (it['$[]']("id")) + " " + } else { + return "" + };}, TMP_5.$$s = self, TMP_5.$$arity = 1, TMP_5)).$join().$chop() + }, TMP_Callouts_callout_ids_4.$$arity = 1); + + Opal.def(self, '$current_list', TMP_Callouts_current_list_6 = function $$current_list() { + var self = this; + + return self.lists['$[]']($rb_minus(self.list_index, 1)) + }, TMP_Callouts_current_list_6.$$arity = 0); + + Opal.def(self, '$next_list', TMP_Callouts_next_list_7 = function $$next_list() { + var self = this; + + + self.list_index = $rb_plus(self.list_index, 1); + if ($truthy($rb_lt(self.lists.$size(), self.list_index))) { + self.lists['$<<']([])}; + self.co_index = 1; + return nil; + }, TMP_Callouts_next_list_7.$$arity = 0); + + Opal.def(self, '$rewind', TMP_Callouts_rewind_8 = function $$rewind() { + var self = this; + + + self.list_index = 1; + self.co_index = 1; + return nil; + }, TMP_Callouts_rewind_8.$$arity = 0); + + Opal.def(self, '$generate_next_callout_id', TMP_Callouts_generate_next_callout_id_9 = function $$generate_next_callout_id() { + var self = this; + + return self.$generate_callout_id(self.list_index, self.co_index) + }, TMP_Callouts_generate_next_callout_id_9.$$arity = 0); + return (Opal.def(self, '$generate_callout_id', TMP_Callouts_generate_callout_id_10 = function $$generate_callout_id(list_index, co_index) { + var self = this; + + return "" + "CO" + (list_index) + "-" + (co_index) + }, TMP_Callouts_generate_callout_id_10.$$arity = 2), nil) && 'generate_callout_id'; + })($nesting[0], null, $nesting) + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/converter/base"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $hash2 = Opal.hash2, $truthy = Opal.truthy; + + Opal.add_stubs(['$include', '$node_name', '$empty?', '$send', '$content']); + return (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + + (function($base, $parent_nesting) { + function $Converter() {}; + var self = $Converter = $module($base, 'Converter', $Converter); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + nil + })($nesting[0], $nesting); + (function($base, $super, $parent_nesting) { + function $Base(){}; + var self = $Base = $klass($base, $super, 'Base', $Base); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + + self.$include($$($nesting, 'Logging')); + return self.$include($$($nesting, 'Converter')); + })($$($nesting, 'Converter'), null, $nesting); + (function($base, $super, $parent_nesting) { + function $BuiltIn(){}; + var self = $BuiltIn = $klass($base, $super, 'BuiltIn', $BuiltIn); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_BuiltIn_initialize_1, TMP_BuiltIn_convert_2, TMP_BuiltIn_content_3, TMP_BuiltIn_skip_4; + + + self.$include($$($nesting, 'Logging')); + + Opal.def(self, '$initialize', TMP_BuiltIn_initialize_1 = function $$initialize(backend, opts) { + var self = this; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + return nil; + }, TMP_BuiltIn_initialize_1.$$arity = -2); + + Opal.def(self, '$convert', TMP_BuiltIn_convert_2 = function $$convert(node, transform, opts) { + var $a, self = this; + + + + if (transform == null) { + transform = nil; + }; + + if (opts == null) { + opts = $hash2([], {}); + }; + transform = ($truthy($a = transform) ? $a : node.$node_name()); + if ($truthy(opts['$empty?']())) { + + return self.$send(transform, node); + } else { + + return self.$send(transform, node, opts); + }; + }, TMP_BuiltIn_convert_2.$$arity = -2); + Opal.alias(self, "handles?", "respond_to?"); + + Opal.def(self, '$content', TMP_BuiltIn_content_3 = function $$content(node) { + var self = this; + + return node.$content() + }, TMP_BuiltIn_content_3.$$arity = 1); + Opal.alias(self, "pass", "content"); + return (Opal.def(self, '$skip', TMP_BuiltIn_skip_4 = function $$skip(node) { + var self = this; + + return nil + }, TMP_BuiltIn_skip_4.$$arity = 1), nil) && 'skip'; + })($$($nesting, 'Converter'), null, $nesting); + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/converter/factory"] = function(Opal) { + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $truthy = Opal.truthy, $hash2 = Opal.hash2, $send = Opal.send; + + Opal.add_stubs(['$new', '$require', '$include?', '$include', '$warn', '$logger', '$register', '$default', '$resolve', '$create', '$converters', '$unregister_all', '$attr_reader', '$each', '$[]=', '$-', '$==', '$[]', '$clear', '$===', '$supports_templates?', '$to_s', '$key?']); + return (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + (function($base, $parent_nesting) { + function $Converter() {}; + var self = $Converter = $module($base, 'Converter', $Converter); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + (function($base, $super, $parent_nesting) { + function $Factory(){}; + var self = $Factory = $klass($base, $super, 'Factory', $Factory); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Factory_initialize_7, TMP_Factory_register_8, TMP_Factory_resolve_10, TMP_Factory_unregister_all_11, TMP_Factory_create_12; + + def.converters = def.star_converter = nil; + + self.__default__ = nil; + (function(self, $parent_nesting) { + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_default_1, TMP_register_2, TMP_resolve_3, TMP_create_4, TMP_converters_5, TMP_unregister_all_6; + + + + Opal.def(self, '$default', TMP_default_1 = function(initialize_singleton) { + var $a, $b, $c, self = this; + if (self.__default__ == null) self.__default__ = nil; + + + + if (initialize_singleton == null) { + initialize_singleton = true; + }; + if ($truthy(initialize_singleton)) { + } else { + return ($truthy($a = self.__default__) ? $a : self.$new()) + }; + return (self.__default__ = ($truthy($a = self.__default__) ? $a : (function() { try { + + if ($truthy((($c = $$$('::', 'Concurrent', 'skip_raise')) && ($b = $$$($c, 'Hash', 'skip_raise')) ? 'constant' : nil))) { + } else { + self.$require((function() {if ($truthy($$$('::', 'RUBY_MIN_VERSION_1_9'))) { + return "concurrent/hash" + } else { + return "asciidoctor/core_ext/1.8.7/concurrent/hash" + }; return nil; })()) + }; + return self.$new($$$($$$('::', 'Concurrent'), 'Hash').$new()); + } catch ($err) { + if (Opal.rescue($err, [$$$('::', 'LoadError')])) { + try { + + if ($truthy(self['$include?']($$($nesting, 'Logging')))) { + } else { + self.$include($$($nesting, 'Logging')) + }; + self.$logger().$warn("gem 'concurrent-ruby' is not installed. This gem is recommended when registering custom converters."); + return self.$new(); + } finally { Opal.pop_exception() } + } else { throw $err; } + }})())); + }, TMP_default_1.$$arity = -1); + + Opal.def(self, '$register', TMP_register_2 = function $$register(converter, backends) { + var self = this; + + + + if (backends == null) { + backends = ["*"]; + }; + return self.$default().$register(converter, backends); + }, TMP_register_2.$$arity = -2); + + Opal.def(self, '$resolve', TMP_resolve_3 = function $$resolve(backend) { + var self = this; + + return self.$default().$resolve(backend) + }, TMP_resolve_3.$$arity = 1); + + Opal.def(self, '$create', TMP_create_4 = function $$create(backend, opts) { + var self = this; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + return self.$default().$create(backend, opts); + }, TMP_create_4.$$arity = -2); + + Opal.def(self, '$converters', TMP_converters_5 = function $$converters() { + var self = this; + + return self.$default().$converters() + }, TMP_converters_5.$$arity = 0); + return (Opal.def(self, '$unregister_all', TMP_unregister_all_6 = function $$unregister_all() { + var self = this; + + return self.$default().$unregister_all() + }, TMP_unregister_all_6.$$arity = 0), nil) && 'unregister_all'; + })(Opal.get_singleton_class(self), $nesting); + self.$attr_reader("converters"); + + Opal.def(self, '$initialize', TMP_Factory_initialize_7 = function $$initialize(converters) { + var $a, self = this; + + + + if (converters == null) { + converters = nil; + }; + self.converters = ($truthy($a = converters) ? $a : $hash2([], {})); + return (self.star_converter = nil); + }, TMP_Factory_initialize_7.$$arity = -1); + + Opal.def(self, '$register', TMP_Factory_register_8 = function $$register(converter, backends) { + var TMP_9, self = this; + + + + if (backends == null) { + backends = ["*"]; + }; + $send(backends, 'each', [], (TMP_9 = function(backend){var self = TMP_9.$$s || this, $writer = nil; + if (self.converters == null) self.converters = nil; + + + + if (backend == null) { + backend = nil; + }; + + $writer = [backend, converter]; + $send(self.converters, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + if (backend['$==']("*")) { + return (self.star_converter = converter) + } else { + return nil + };}, TMP_9.$$s = self, TMP_9.$$arity = 1, TMP_9)); + return nil; + }, TMP_Factory_register_8.$$arity = -2); + + Opal.def(self, '$resolve', TMP_Factory_resolve_10 = function $$resolve(backend) { + var $a, $b, self = this; + + return ($truthy($a = self.converters) ? ($truthy($b = self.converters['$[]'](backend)) ? $b : self.star_converter) : $a) + }, TMP_Factory_resolve_10.$$arity = 1); + + Opal.def(self, '$unregister_all', TMP_Factory_unregister_all_11 = function $$unregister_all() { + var self = this; + + + self.converters.$clear(); + return (self.star_converter = nil); + }, TMP_Factory_unregister_all_11.$$arity = 0); + return (Opal.def(self, '$create', TMP_Factory_create_12 = function $$create(backend, opts) { + var $a, $b, $c, $d, $e, $f, $g, $h, $i, $j, $k, $l, $m, $n, $o, $p, $q, $r, self = this, converter = nil, base_converter = nil, $case = nil, template_converter = nil; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + if ($truthy((converter = self.$resolve(backend)))) { + + base_converter = (function() {if ($truthy($$$('::', 'Class')['$==='](converter))) { + + return converter.$new(backend, opts); + } else { + return converter + }; return nil; })(); + if ($truthy(($truthy($a = $$$($$($nesting, 'Converter'), 'BackendInfo')['$==='](base_converter)) ? base_converter['$supports_templates?']() : $a))) { + } else { + return base_converter + }; + } else { + $case = backend; + if ("html5"['$===']($case)) { + if ($truthy((($c = $$$('::', 'Asciidoctor', 'skip_raise')) && ($b = $$$($c, 'Converter', 'skip_raise')) && ($a = $$$($b, 'Html5Converter', 'skip_raise')) ? 'constant' : nil))) { + } else { + self.$require("asciidoctor/converter/html5".$to_s()) + }; + base_converter = $$($nesting, 'Html5Converter').$new(backend, opts);} + else if ("docbook5"['$===']($case)) { + if ($truthy((($f = $$$('::', 'Asciidoctor', 'skip_raise')) && ($e = $$$($f, 'Converter', 'skip_raise')) && ($d = $$$($e, 'DocBook5Converter', 'skip_raise')) ? 'constant' : nil))) { + } else { + self.$require("asciidoctor/converter/docbook5".$to_s()) + }; + base_converter = $$($nesting, 'DocBook5Converter').$new(backend, opts);} + else if ("docbook45"['$===']($case)) { + if ($truthy((($i = $$$('::', 'Asciidoctor', 'skip_raise')) && ($h = $$$($i, 'Converter', 'skip_raise')) && ($g = $$$($h, 'DocBook45Converter', 'skip_raise')) ? 'constant' : nil))) { + } else { + self.$require("asciidoctor/converter/docbook45".$to_s()) + }; + base_converter = $$($nesting, 'DocBook45Converter').$new(backend, opts);} + else if ("manpage"['$===']($case)) { + if ($truthy((($l = $$$('::', 'Asciidoctor', 'skip_raise')) && ($k = $$$($l, 'Converter', 'skip_raise')) && ($j = $$$($k, 'ManPageConverter', 'skip_raise')) ? 'constant' : nil))) { + } else { + self.$require("asciidoctor/converter/manpage".$to_s()) + }; + base_converter = $$($nesting, 'ManPageConverter').$new(backend, opts);} + }; + if ($truthy(opts['$key?']("template_dirs"))) { + } else { + return base_converter + }; + if ($truthy((($o = $$$('::', 'Asciidoctor', 'skip_raise')) && ($n = $$$($o, 'Converter', 'skip_raise')) && ($m = $$$($n, 'TemplateConverter', 'skip_raise')) ? 'constant' : nil))) { + } else { + self.$require("asciidoctor/converter/template".$to_s()) + }; + template_converter = $$($nesting, 'TemplateConverter').$new(backend, opts['$[]']("template_dirs"), opts); + if ($truthy((($r = $$$('::', 'Asciidoctor', 'skip_raise')) && ($q = $$$($r, 'Converter', 'skip_raise')) && ($p = $$$($q, 'CompositeConverter', 'skip_raise')) ? 'constant' : nil))) { + } else { + self.$require("asciidoctor/converter/composite".$to_s()) + }; + return $$($nesting, 'CompositeConverter').$new(backend, template_converter, base_converter); + }, TMP_Factory_create_12.$$arity = -2), nil) && 'create'; + })($nesting[0], null, $nesting) + })($nesting[0], $nesting) + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/converter"] = function(Opal) { + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $send = Opal.send, $truthy = Opal.truthy, $hash2 = Opal.hash2; + + Opal.add_stubs(['$register', '$==', '$send', '$include?', '$setup_backend_info', '$raise', '$class', '$sub', '$[]', '$slice', '$length', '$[]=', '$backend_info', '$-', '$extend', '$include', '$respond_to?', '$write', '$chomp', '$require']); + + (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + + (function($base, $parent_nesting) { + function $Converter() {}; + var self = $Converter = $module($base, 'Converter', $Converter); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Converter_initialize_13, TMP_Converter_convert_14; + + + (function($base, $parent_nesting) { + function $Config() {}; + var self = $Config = $module($base, 'Config', $Config); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Config_register_for_1; + + + Opal.def(self, '$register_for', TMP_Config_register_for_1 = function $$register_for($a) { + var $post_args, backends, TMP_2, TMP_3, self = this, metaclass = nil; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + backends = $post_args;; + $$($nesting, 'Factory').$register(self, backends); + metaclass = (function(self, $parent_nesting) { + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return self + })(Opal.get_singleton_class(self), $nesting); + if (backends['$=='](["*"])) { + $send(metaclass, 'send', ["define_method", "converts?"], (TMP_2 = function(name){var self = TMP_2.$$s || this; + + + + if (name == null) { + name = nil; + }; + return true;}, TMP_2.$$s = self, TMP_2.$$arity = 1, TMP_2)) + } else { + $send(metaclass, 'send', ["define_method", "converts?"], (TMP_3 = function(name){var self = TMP_3.$$s || this; + + + + if (name == null) { + name = nil; + }; + return backends['$include?'](name);}, TMP_3.$$s = self, TMP_3.$$arity = 1, TMP_3)) + }; + return nil; + }, TMP_Config_register_for_1.$$arity = -1) + })($nesting[0], $nesting); + (function($base, $parent_nesting) { + function $BackendInfo() {}; + var self = $BackendInfo = $module($base, 'BackendInfo', $BackendInfo); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_BackendInfo_backend_info_4, TMP_BackendInfo_setup_backend_info_5, TMP_BackendInfo_filetype_6, TMP_BackendInfo_basebackend_7, TMP_BackendInfo_outfilesuffix_8, TMP_BackendInfo_htmlsyntax_9, TMP_BackendInfo_supports_templates_10, TMP_BackendInfo_supports_templates$q_11; + + + + Opal.def(self, '$backend_info', TMP_BackendInfo_backend_info_4 = function $$backend_info() { + var $a, self = this; + if (self.backend_info == null) self.backend_info = nil; + + return (self.backend_info = ($truthy($a = self.backend_info) ? $a : self.$setup_backend_info())) + }, TMP_BackendInfo_backend_info_4.$$arity = 0); + + Opal.def(self, '$setup_backend_info', TMP_BackendInfo_setup_backend_info_5 = function $$setup_backend_info() { + var self = this, base = nil, ext = nil, type = nil, syntax = nil; + if (self.backend == null) self.backend = nil; + + + if ($truthy(self.backend)) { + } else { + self.$raise($$$('::', 'ArgumentError'), "" + "Cannot determine backend for converter: " + (self.$class())) + }; + base = self.backend.$sub($$($nesting, 'TrailingDigitsRx'), ""); + if ($truthy((ext = $$($nesting, 'DEFAULT_EXTENSIONS')['$[]'](base)))) { + type = ext.$slice(1, ext.$length()) + } else { + + base = "html"; + ext = ".html"; + type = "html"; + syntax = "html"; + }; + return $hash2(["basebackend", "outfilesuffix", "filetype", "htmlsyntax"], {"basebackend": base, "outfilesuffix": ext, "filetype": type, "htmlsyntax": syntax}); + }, TMP_BackendInfo_setup_backend_info_5.$$arity = 0); + + Opal.def(self, '$filetype', TMP_BackendInfo_filetype_6 = function $$filetype(value) { + var self = this, $writer = nil; + + + + if (value == null) { + value = nil; + }; + if ($truthy(value)) { + + $writer = ["filetype", value]; + $send(self.$backend_info(), '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + } else { + return self.$backend_info()['$[]']("filetype") + }; + }, TMP_BackendInfo_filetype_6.$$arity = -1); + + Opal.def(self, '$basebackend', TMP_BackendInfo_basebackend_7 = function $$basebackend(value) { + var self = this, $writer = nil; + + + + if (value == null) { + value = nil; + }; + if ($truthy(value)) { + + $writer = ["basebackend", value]; + $send(self.$backend_info(), '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + } else { + return self.$backend_info()['$[]']("basebackend") + }; + }, TMP_BackendInfo_basebackend_7.$$arity = -1); + + Opal.def(self, '$outfilesuffix', TMP_BackendInfo_outfilesuffix_8 = function $$outfilesuffix(value) { + var self = this, $writer = nil; + + + + if (value == null) { + value = nil; + }; + if ($truthy(value)) { + + $writer = ["outfilesuffix", value]; + $send(self.$backend_info(), '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + } else { + return self.$backend_info()['$[]']("outfilesuffix") + }; + }, TMP_BackendInfo_outfilesuffix_8.$$arity = -1); + + Opal.def(self, '$htmlsyntax', TMP_BackendInfo_htmlsyntax_9 = function $$htmlsyntax(value) { + var self = this, $writer = nil; + + + + if (value == null) { + value = nil; + }; + if ($truthy(value)) { + + $writer = ["htmlsyntax", value]; + $send(self.$backend_info(), '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + } else { + return self.$backend_info()['$[]']("htmlsyntax") + }; + }, TMP_BackendInfo_htmlsyntax_9.$$arity = -1); + + Opal.def(self, '$supports_templates', TMP_BackendInfo_supports_templates_10 = function $$supports_templates() { + var self = this, $writer = nil; + + + $writer = ["supports_templates", true]; + $send(self.$backend_info(), '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + }, TMP_BackendInfo_supports_templates_10.$$arity = 0); + + Opal.def(self, '$supports_templates?', TMP_BackendInfo_supports_templates$q_11 = function() { + var self = this; + + return self.$backend_info()['$[]']("supports_templates") + }, TMP_BackendInfo_supports_templates$q_11.$$arity = 0); + })($nesting[0], $nesting); + (function(self, $parent_nesting) { + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_included_12; + + return (Opal.def(self, '$included', TMP_included_12 = function $$included(converter) { + var self = this; + + return converter.$extend($$($nesting, 'Config')) + }, TMP_included_12.$$arity = 1), nil) && 'included' + })(Opal.get_singleton_class(self), $nesting); + self.$include($$($nesting, 'Config')); + self.$include($$($nesting, 'BackendInfo')); + + Opal.def(self, '$initialize', TMP_Converter_initialize_13 = function $$initialize(backend, opts) { + var self = this; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + self.backend = backend; + return self.$setup_backend_info(); + }, TMP_Converter_initialize_13.$$arity = -2); + + Opal.def(self, '$convert', TMP_Converter_convert_14 = function $$convert(node, transform, opts) { + var self = this; + + + + if (transform == null) { + transform = nil; + }; + + if (opts == null) { + opts = $hash2([], {}); + }; + return self.$raise($$$('::', 'NotImplementedError')); + }, TMP_Converter_convert_14.$$arity = -2); + Opal.alias(self, "handles?", "respond_to?"); + Opal.alias(self, "convert_with_options", "convert"); + })($nesting[0], $nesting); + (function($base, $parent_nesting) { + function $Writer() {}; + var self = $Writer = $module($base, 'Writer', $Writer); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Writer_write_15; + + + Opal.def(self, '$write', TMP_Writer_write_15 = function $$write(output, target) { + var self = this; + + + if ($truthy(target['$respond_to?']("write"))) { + + target.$write(output.$chomp()); + target.$write($$($nesting, 'LF')); + } else { + $$$('::', 'IO').$write(target, output) + }; + return nil; + }, TMP_Writer_write_15.$$arity = 2) + })($nesting[0], $nesting); + (function($base, $parent_nesting) { + function $VoidWriter() {}; + var self = $VoidWriter = $module($base, 'VoidWriter', $VoidWriter); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_VoidWriter_write_16; + + + self.$include($$($nesting, 'Writer')); + + Opal.def(self, '$write', TMP_VoidWriter_write_16 = function $$write(output, target) { + var self = this; + + return nil + }, TMP_VoidWriter_write_16.$$arity = 2); + })($nesting[0], $nesting); + })($nesting[0], $nesting); + self.$require("asciidoctor/converter/base"); + return self.$require("asciidoctor/converter/factory"); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/document"] = function(Opal) { + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + function $rb_ge(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs >= rhs : lhs['$>='](rhs); + } + function $rb_plus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); + } + function $rb_gt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); + } + function $rb_lt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $send = Opal.send, $truthy = Opal.truthy, $hash2 = Opal.hash2, $gvars = Opal.gvars; + + Opal.add_stubs(['$new', '$attr_reader', '$nil?', '$<<', '$[]', '$[]=', '$-', '$include?', '$strip', '$squeeze', '$gsub', '$empty?', '$!', '$rpartition', '$attr_accessor', '$delete', '$base_dir', '$options', '$inject', '$catalog', '$==', '$dup', '$attributes', '$safe', '$compat_mode', '$sourcemap', '$path_resolver', '$converter', '$extensions', '$each', '$end_with?', '$start_with?', '$slice', '$length', '$chop', '$downcase', '$extname', '$===', '$value_for_name', '$to_s', '$key?', '$freeze', '$attribute_undefined', '$attribute_missing', '$name_for_value', '$expand_path', '$pwd', '$>=', '$+', '$abs', '$to_i', '$delete_if', '$update_doctype_attributes', '$cursor', '$parse', '$restore_attributes', '$update_backend_attributes', '$utc', '$at', '$Integer', '$now', '$index', '$strftime', '$year', '$utc_offset', '$fetch', '$activate', '$create', '$to_proc', '$groups', '$preprocessors?', '$preprocessors', '$process_method', '$tree_processors?', '$tree_processors', '$!=', '$counter', '$nil_or_empty?', '$nextval', '$value', '$save_to', '$chr', '$ord', '$source', '$source_lines', '$doctitle', '$sectname=', '$title=', '$first_section', '$title', '$merge', '$>', '$<', '$find', '$context', '$assign_numeral', '$clear_playback_attributes', '$save_attributes', '$attribute_locked?', '$rewind', '$replace', '$name', '$negate', '$limit_bytesize', '$apply_attribute_value_subs', '$delete?', '$=~', '$apply_subs', '$resolve_pass_subs', '$apply_header_subs', '$create_converter', '$basebackend', '$outfilesuffix', '$filetype', '$sub', '$raise', '$Array', '$backend', '$default', '$start', '$doctype', '$content_model', '$warn', '$logger', '$content', '$convert', '$postprocessors?', '$postprocessors', '$record', '$write', '$respond_to?', '$chomp', '$write_alternate_pages', '$map', '$split', '$resolve_docinfo_subs', '$&', '$normalize_system_path', '$read_asset', '$docinfo_processors?', '$compact', '$join', '$resolve_subs', '$docinfo_processors', '$class', '$object_id', '$inspect', '$size']); + return (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + (function($base, $super, $parent_nesting) { + function $Document(){}; + var self = $Document = $klass($base, $super, 'Document', $Document); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Document_1, TMP_Document_initialize_8, TMP_Document_parse_12, TMP_Document_counter_15, TMP_Document_increment_and_store_counter_16, TMP_Document_nextval_17, TMP_Document_register_18, TMP_Document_footnotes$q_19, TMP_Document_footnotes_20, TMP_Document_callouts_21, TMP_Document_nested$q_22, TMP_Document_embedded$q_23, TMP_Document_extensions$q_24, TMP_Document_source_25, TMP_Document_source_lines_26, TMP_Document_basebackend$q_27, TMP_Document_title_28, TMP_Document_title$eq_29, TMP_Document_doctitle_30, TMP_Document_author_31, TMP_Document_authors_32, TMP_Document_revdate_33, TMP_Document_notitle_34, TMP_Document_noheader_35, TMP_Document_nofooter_36, TMP_Document_first_section_37, TMP_Document_has_header$q_39, TMP_Document_$lt$lt_40, TMP_Document_finalize_header_41, TMP_Document_save_attributes_42, TMP_Document_restore_attributes_44, TMP_Document_clear_playback_attributes_45, TMP_Document_playback_attributes_46, TMP_Document_set_attribute_48, TMP_Document_delete_attribute_49, TMP_Document_attribute_locked$q_50, TMP_Document_set_header_attribute_51, TMP_Document_apply_attribute_value_subs_52, TMP_Document_update_backend_attributes_53, TMP_Document_update_doctype_attributes_54, TMP_Document_create_converter_55, TMP_Document_convert_56, TMP_Document_write_58, TMP_Document_content_59, TMP_Document_docinfo_60, TMP_Document_resolve_docinfo_subs_63, TMP_Document_docinfo_processors$q_64, TMP_Document_to_s_65; + + def.attributes = def.safe = def.sourcemap = def.reader = def.base_dir = def.parsed = def.parent_document = def.extensions = def.options = def.counters = def.catalog = def.header = def.blocks = def.attributes_modified = def.id = def.header_attributes = def.max_attribute_value_size = def.attribute_overrides = def.backend = def.doctype = def.converter = def.timings = def.outfilesuffix = def.docinfo_processor_extensions = def.document = nil; + + Opal.const_set($nesting[0], 'ImageReference', $send($$$('::', 'Struct'), 'new', ["target", "imagesdir"], (TMP_Document_1 = function(){var self = TMP_Document_1.$$s || this; + + return Opal.alias(self, "to_s", "target")}, TMP_Document_1.$$s = self, TMP_Document_1.$$arity = 0, TMP_Document_1))); + Opal.const_set($nesting[0], 'Footnote', $$$('::', 'Struct').$new("index", "id", "text")); + (function($base, $super, $parent_nesting) { + function $AttributeEntry(){}; + var self = $AttributeEntry = $klass($base, $super, 'AttributeEntry', $AttributeEntry); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_AttributeEntry_initialize_2, TMP_AttributeEntry_save_to_3; + + + self.$attr_reader("name", "value", "negate"); + + Opal.def(self, '$initialize', TMP_AttributeEntry_initialize_2 = function $$initialize(name, value, negate) { + var self = this; + + + + if (negate == null) { + negate = nil; + }; + self.name = name; + self.value = value; + return (self.negate = (function() {if ($truthy(negate['$nil?']())) { + return value['$nil?']() + } else { + return negate + }; return nil; })()); + }, TMP_AttributeEntry_initialize_2.$$arity = -3); + return (Opal.def(self, '$save_to', TMP_AttributeEntry_save_to_3 = function $$save_to(block_attributes) { + var $a, self = this, $writer = nil; + + + ($truthy($a = block_attributes['$[]']("attribute_entries")) ? $a : (($writer = ["attribute_entries", []]), $send(block_attributes, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]))['$<<'](self); + return self; + }, TMP_AttributeEntry_save_to_3.$$arity = 1), nil) && 'save_to'; + })($nesting[0], null, $nesting); + (function($base, $super, $parent_nesting) { + function $Title(){}; + var self = $Title = $klass($base, $super, 'Title', $Title); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Title_initialize_4, TMP_Title_sanitized$q_5, TMP_Title_subtitle$q_6, TMP_Title_to_s_7; + + def.sanitized = def.subtitle = def.combined = nil; + + self.$attr_reader("main"); + Opal.alias(self, "title", "main"); + self.$attr_reader("subtitle"); + self.$attr_reader("combined"); + + Opal.def(self, '$initialize', TMP_Title_initialize_4 = function $$initialize(val, opts) { + var $a, $b, self = this, sep = nil, _ = nil; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + if ($truthy(($truthy($a = (self.sanitized = opts['$[]']("sanitize"))) ? val['$include?']("<") : $a))) { + val = val.$gsub($$($nesting, 'XmlSanitizeRx'), "").$squeeze(" ").$strip()}; + if ($truthy(($truthy($a = (sep = ($truthy($b = opts['$[]']("separator")) ? $b : ":"))['$empty?']()) ? $a : val['$include?']((sep = "" + (sep) + " "))['$!']()))) { + + self.main = val; + self.subtitle = nil; + } else { + $b = val.$rpartition(sep), $a = Opal.to_ary($b), (self.main = ($a[0] == null ? nil : $a[0])), (_ = ($a[1] == null ? nil : $a[1])), (self.subtitle = ($a[2] == null ? nil : $a[2])), $b + }; + return (self.combined = val); + }, TMP_Title_initialize_4.$$arity = -2); + + Opal.def(self, '$sanitized?', TMP_Title_sanitized$q_5 = function() { + var self = this; + + return self.sanitized + }, TMP_Title_sanitized$q_5.$$arity = 0); + + Opal.def(self, '$subtitle?', TMP_Title_subtitle$q_6 = function() { + var self = this; + + if ($truthy(self.subtitle)) { + return true + } else { + return false + } + }, TMP_Title_subtitle$q_6.$$arity = 0); + return (Opal.def(self, '$to_s', TMP_Title_to_s_7 = function $$to_s() { + var self = this; + + return self.combined + }, TMP_Title_to_s_7.$$arity = 0), nil) && 'to_s'; + })($nesting[0], null, $nesting); + Opal.const_set($nesting[0], 'Author', $$$('::', 'Struct').$new("name", "firstname", "middlename", "lastname", "initials", "email")); + self.$attr_reader("safe"); + self.$attr_reader("compat_mode"); + self.$attr_reader("backend"); + self.$attr_reader("doctype"); + self.$attr_accessor("sourcemap"); + self.$attr_reader("catalog"); + Opal.alias(self, "references", "catalog"); + self.$attr_reader("counters"); + self.$attr_reader("header"); + self.$attr_reader("base_dir"); + self.$attr_reader("options"); + self.$attr_reader("outfilesuffix"); + self.$attr_reader("parent_document"); + self.$attr_reader("reader"); + self.$attr_reader("path_resolver"); + self.$attr_reader("converter"); + self.$attr_reader("extensions"); + + Opal.def(self, '$initialize', TMP_Document_initialize_8 = function $$initialize(data, options) { + var $a, TMP_9, TMP_10, $b, $c, TMP_11, $d, $iter = TMP_Document_initialize_8.$$p, $yield = $iter || nil, self = this, parent_doc = nil, $writer = nil, attr_overrides = nil, parent_doctype = nil, initialize_extensions = nil, to_file = nil, safe_mode = nil, header_footer = nil, attrs = nil, safe_mode_name = nil, base_dir_val = nil, backend_val = nil, doctype_val = nil, size = nil, now = nil, localdate = nil, localyear = nil, localtime = nil, ext_registry = nil, ext_block = nil; + + if ($iter) TMP_Document_initialize_8.$$p = null; + + + if (data == null) { + data = nil; + }; + + if (options == null) { + options = $hash2([], {}); + }; + $send(self, Opal.find_super_dispatcher(self, 'initialize', TMP_Document_initialize_8, false), [self, "document"], null); + if ($truthy((parent_doc = options.$delete("parent")))) { + + self.parent_document = parent_doc; + ($truthy($a = options['$[]']("base_dir")) ? $a : (($writer = ["base_dir", parent_doc.$base_dir()]), $send(options, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + if ($truthy(parent_doc.$options()['$[]']("catalog_assets"))) { + + $writer = ["catalog_assets", true]; + $send(options, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + self.catalog = $send(parent_doc.$catalog(), 'inject', [$hash2([], {})], (TMP_9 = function(accum, $mlhs_tmp1){var self = TMP_9.$$s || this, $b, $c, key = nil, table = nil; + + + + if (accum == null) { + accum = nil; + }; + + if ($mlhs_tmp1 == null) { + $mlhs_tmp1 = nil; + }; + $c = $mlhs_tmp1, $b = Opal.to_ary($c), (key = ($b[0] == null ? nil : $b[0])), (table = ($b[1] == null ? nil : $b[1])), $c; + + $writer = [key, (function() {if (key['$==']("footnotes")) { + return [] + } else { + return table + }; return nil; })()]; + $send(accum, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + return accum;}, TMP_9.$$s = self, TMP_9.$$arity = 2, TMP_9.$$has_top_level_mlhs_arg = true, TMP_9)); + self.attribute_overrides = (attr_overrides = parent_doc.$attributes().$dup()); + parent_doctype = attr_overrides.$delete("doctype"); + attr_overrides.$delete("compat-mode"); + attr_overrides.$delete("toc"); + attr_overrides.$delete("toc-placement"); + attr_overrides.$delete("toc-position"); + self.safe = parent_doc.$safe(); + if ($truthy((self.compat_mode = parent_doc.$compat_mode()))) { + + $writer = ["compat-mode", ""]; + $send(self.attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + self.sourcemap = parent_doc.$sourcemap(); + self.timings = nil; + self.path_resolver = parent_doc.$path_resolver(); + self.converter = parent_doc.$converter(); + initialize_extensions = false; + self.extensions = parent_doc.$extensions(); + } else { + + self.parent_document = nil; + self.catalog = $hash2(["ids", "refs", "footnotes", "links", "images", "indexterms", "callouts", "includes"], {"ids": $hash2([], {}), "refs": $hash2([], {}), "footnotes": [], "links": [], "images": [], "indexterms": [], "callouts": $$($nesting, 'Callouts').$new(), "includes": $hash2([], {})}); + self.attribute_overrides = (attr_overrides = $hash2([], {})); + $send(($truthy($a = options['$[]']("attributes")) ? $a : $hash2([], {})), 'each', [], (TMP_10 = function(key, val){var self = TMP_10.$$s || this, $b; + + + + if (key == null) { + key = nil; + }; + + if (val == null) { + val = nil; + }; + if ($truthy(key['$end_with?']("@"))) { + if ($truthy(key['$start_with?']("!"))) { + $b = [key.$slice(1, $rb_minus(key.$length(), 2)), false], (key = $b[0]), (val = $b[1]), $b + } else if ($truthy(key['$end_with?']("!@"))) { + $b = [key.$slice(0, $rb_minus(key.$length(), 2)), false], (key = $b[0]), (val = $b[1]), $b + } else { + $b = [key.$chop(), "" + (val) + "@"], (key = $b[0]), (val = $b[1]), $b + } + } else if ($truthy(key['$start_with?']("!"))) { + $b = [key.$slice(1, key.$length()), (function() {if (val['$==']("@")) { + return false + } else { + return nil + }; return nil; })()], (key = $b[0]), (val = $b[1]), $b + } else if ($truthy(key['$end_with?']("!"))) { + $b = [key.$chop(), (function() {if (val['$==']("@")) { + return false + } else { + return nil + }; return nil; })()], (key = $b[0]), (val = $b[1]), $b}; + + $writer = [key.$downcase(), val]; + $send(attr_overrides, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];;}, TMP_10.$$s = self, TMP_10.$$arity = 2, TMP_10)); + if ($truthy((to_file = options['$[]']("to_file")))) { + + $writer = ["outfilesuffix", $$$('::', 'File').$extname(to_file)]; + $send(attr_overrides, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if ($truthy((safe_mode = options['$[]']("safe"))['$!']())) { + self.safe = $$$($$($nesting, 'SafeMode'), 'SECURE') + } else if ($truthy($$$('::', 'Integer')['$==='](safe_mode))) { + self.safe = safe_mode + } else { + + try { + self.safe = $$($nesting, 'SafeMode').$value_for_name(safe_mode.$to_s()) + } catch ($err) { + if (Opal.rescue($err, [$$($nesting, 'StandardError')])) { + try { + self.safe = $$$($$($nesting, 'SafeMode'), 'SECURE') + } finally { Opal.pop_exception() } + } else { throw $err; } + }; + }; + self.compat_mode = attr_overrides['$key?']("compat-mode"); + self.sourcemap = options['$[]']("sourcemap"); + self.timings = options.$delete("timings"); + self.path_resolver = $$($nesting, 'PathResolver').$new(); + self.converter = nil; + initialize_extensions = (($b = $$$('::', 'Asciidoctor', 'skip_raise')) && ($a = $$$($b, 'Extensions', 'skip_raise')) ? 'constant' : nil); + self.extensions = nil; + }; + self.parsed = false; + self.header = (self.header_attributes = nil); + self.counters = $hash2([], {}); + self.attributes_modified = $$$('::', 'Set').$new(); + self.docinfo_processor_extensions = $hash2([], {}); + header_footer = ($truthy($c = options['$[]']("header_footer")) ? $c : (($writer = ["header_footer", false]), $send(options, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + (self.options = options).$freeze(); + attrs = self.attributes; + + $writer = ["sectids", ""]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["toc-placement", "auto"]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + if ($truthy(header_footer)) { + + + $writer = ["copycss", ""]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["embedded", nil]; + $send(attr_overrides, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + } else { + + + $writer = ["notitle", ""]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["embedded", ""]; + $send(attr_overrides, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + }; + + $writer = ["stylesheet", ""]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["webfonts", ""]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["prewrap", ""]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["attribute-undefined", $$($nesting, 'Compliance').$attribute_undefined()]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["attribute-missing", $$($nesting, 'Compliance').$attribute_missing()]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["iconfont-remote", ""]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["caution-caption", "Caution"]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["important-caption", "Important"]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["note-caption", "Note"]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["tip-caption", "Tip"]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["warning-caption", "Warning"]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["example-caption", "Example"]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["figure-caption", "Figure"]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["table-caption", "Table"]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["toc-title", "Table of Contents"]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["section-refsig", "Section"]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["part-refsig", "Part"]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["chapter-refsig", "Chapter"]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["appendix-caption", (($writer = ["appendix-refsig", "Appendix"]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["untitled-label", "Untitled"]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["version-label", "Version"]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["last-update-label", "Last updated"]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["asciidoctor", ""]; + $send(attr_overrides, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["asciidoctor-version", $$($nesting, 'VERSION')]; + $send(attr_overrides, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["safe-mode-name", (safe_mode_name = $$($nesting, 'SafeMode').$name_for_value(self.safe))]; + $send(attr_overrides, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["" + "safe-mode-" + (safe_mode_name), ""]; + $send(attr_overrides, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["safe-mode-level", self.safe]; + $send(attr_overrides, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + ($truthy($c = attr_overrides['$[]']("max-include-depth")) ? $c : (($writer = ["max-include-depth", 64]), $send(attr_overrides, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + ($truthy($c = attr_overrides['$[]']("allow-uri-read")) ? $c : (($writer = ["allow-uri-read", nil]), $send(attr_overrides, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + + $writer = ["user-home", $$($nesting, 'USER_HOME')]; + $send(attr_overrides, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + if ($truthy(attr_overrides['$key?']("numbered"))) { + + $writer = ["sectnums", attr_overrides.$delete("numbered")]; + $send(attr_overrides, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if ($truthy((base_dir_val = options['$[]']("base_dir")))) { + self.base_dir = (($writer = ["docdir", $$$('::', 'File').$expand_path(base_dir_val)]), $send(attr_overrides, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]) + } else if ($truthy(attr_overrides['$[]']("docdir"))) { + self.base_dir = attr_overrides['$[]']("docdir") + } else { + self.base_dir = (($writer = ["docdir", $$$('::', 'Dir').$pwd()]), $send(attr_overrides, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]) + }; + if ($truthy((backend_val = options['$[]']("backend")))) { + + $writer = ["backend", "" + (backend_val)]; + $send(attr_overrides, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if ($truthy((doctype_val = options['$[]']("doctype")))) { + + $writer = ["doctype", "" + (doctype_val)]; + $send(attr_overrides, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if ($truthy($rb_ge(self.safe, $$$($$($nesting, 'SafeMode'), 'SERVER')))) { + + ($truthy($c = attr_overrides['$[]']("copycss")) ? $c : (($writer = ["copycss", nil]), $send(attr_overrides, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + ($truthy($c = attr_overrides['$[]']("source-highlighter")) ? $c : (($writer = ["source-highlighter", nil]), $send(attr_overrides, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + ($truthy($c = attr_overrides['$[]']("backend")) ? $c : (($writer = ["backend", $$($nesting, 'DEFAULT_BACKEND')]), $send(attr_overrides, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + if ($truthy(($truthy($c = parent_doc['$!']()) ? attr_overrides['$key?']("docfile") : $c))) { + + $writer = ["docfile", attr_overrides['$[]']("docfile")['$[]'](Opal.Range.$new($rb_plus(attr_overrides['$[]']("docdir").$length(), 1), -1, false))]; + $send(attr_overrides, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + + $writer = ["docdir", ""]; + $send(attr_overrides, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["user-home", "."]; + $send(attr_overrides, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + if ($truthy($rb_ge(self.safe, $$$($$($nesting, 'SafeMode'), 'SECURE')))) { + + if ($truthy(attr_overrides['$key?']("max-attribute-value-size"))) { + } else { + + $writer = ["max-attribute-value-size", 4096]; + $send(attr_overrides, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + if ($truthy(attr_overrides['$key?']("linkcss"))) { + } else { + + $writer = ["linkcss", ""]; + $send(attr_overrides, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + ($truthy($c = attr_overrides['$[]']("icons")) ? $c : (($writer = ["icons", nil]), $send(attr_overrides, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]));};}; + self.max_attribute_value_size = (function() {if ($truthy((size = ($truthy($c = attr_overrides['$[]']("max-attribute-value-size")) ? $c : (($writer = ["max-attribute-value-size", nil]), $send(attr_overrides, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]))))) { + return size.$to_i().$abs() + } else { + return nil + }; return nil; })(); + $send(attr_overrides, 'delete_if', [], (TMP_11 = function(key, val){var self = TMP_11.$$s || this, $d, verdict = nil; + + + + if (key == null) { + key = nil; + }; + + if (val == null) { + val = nil; + }; + if ($truthy(val)) { + + if ($truthy(($truthy($d = $$$('::', 'String')['$==='](val)) ? val['$end_with?']("@") : $d))) { + $d = [val.$chop(), true], (val = $d[0]), (verdict = $d[1]), $d}; + + $writer = [key, val]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + } else { + + attrs.$delete(key); + verdict = val['$=='](false); + }; + return verdict;}, TMP_11.$$s = self, TMP_11.$$arity = 2, TMP_11)); + if ($truthy(parent_doc)) { + + self.backend = attrs['$[]']("backend"); + if ((self.doctype = (($writer = ["doctype", parent_doctype]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]))['$==']($$($nesting, 'DEFAULT_DOCTYPE'))) { + } else { + self.$update_doctype_attributes($$($nesting, 'DEFAULT_DOCTYPE')) + }; + self.reader = $$($nesting, 'Reader').$new(data, options['$[]']("cursor")); + if ($truthy(self.sourcemap)) { + self.source_location = self.reader.$cursor()}; + $$($nesting, 'Parser').$parse(self.reader, self); + self.$restore_attributes(); + return (self.parsed = true); + } else { + + self.backend = nil; + if (($truthy($c = attrs['$[]']("backend")) ? $c : (($writer = ["backend", $$($nesting, 'DEFAULT_BACKEND')]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]))['$==']("manpage")) { + self.doctype = (($writer = ["doctype", (($writer = ["doctype", "manpage"]), $send(attr_overrides, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]) + } else { + self.doctype = ($truthy($c = attrs['$[]']("doctype")) ? $c : (($writer = ["doctype", $$($nesting, 'DEFAULT_DOCTYPE')]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])) + }; + self.$update_backend_attributes(attrs['$[]']("backend"), true); + now = (function() {if ($truthy($$$('::', 'ENV')['$[]']("SOURCE_DATE_EPOCH"))) { + return $$$('::', 'Time').$at(self.$Integer($$$('::', 'ENV')['$[]']("SOURCE_DATE_EPOCH"))).$utc() + } else { + return $$$('::', 'Time').$now() + }; return nil; })(); + if ($truthy((localdate = attrs['$[]']("localdate")))) { + localyear = ($truthy($c = attrs['$[]']("localyear")) ? $c : (($writer = ["localyear", (function() {if (localdate.$index("-")['$=='](4)) { + + return localdate.$slice(0, 4); + } else { + return nil + }; return nil; })()]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])) + } else { + + localdate = (($writer = ["localdate", now.$strftime("%F")]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]); + localyear = ($truthy($c = attrs['$[]']("localyear")) ? $c : (($writer = ["localyear", now.$year().$to_s()]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + }; + localtime = ($truthy($c = attrs['$[]']("localtime")) ? $c : (($writer = ["localtime", now.$strftime("" + "%T " + ((function() {if (now.$utc_offset()['$=='](0)) { + return "UTC" + } else { + return "%z" + }; return nil; })()))]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + ($truthy($c = attrs['$[]']("localdatetime")) ? $c : (($writer = ["localdatetime", "" + (localdate) + " " + (localtime)]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + ($truthy($c = attrs['$[]']("docdate")) ? $c : (($writer = ["docdate", localdate]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + ($truthy($c = attrs['$[]']("docyear")) ? $c : (($writer = ["docyear", localyear]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + ($truthy($c = attrs['$[]']("doctime")) ? $c : (($writer = ["doctime", localtime]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + ($truthy($c = attrs['$[]']("docdatetime")) ? $c : (($writer = ["docdatetime", "" + (localdate) + " " + (localtime)]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + ($truthy($c = attrs['$[]']("stylesdir")) ? $c : (($writer = ["stylesdir", "."]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + ($truthy($c = attrs['$[]']("iconsdir")) ? $c : (($writer = ["iconsdir", "" + (attrs.$fetch("imagesdir", "./images")) + "/icons"]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + if ($truthy(initialize_extensions)) { + if ($truthy((ext_registry = options['$[]']("extension_registry")))) { + if ($truthy(($truthy($c = $$$($$($nesting, 'Extensions'), 'Registry')['$==='](ext_registry)) ? $c : ($truthy($d = $$$('::', 'RUBY_ENGINE_JRUBY')) ? $$$($$$($$$('::', 'AsciidoctorJ'), 'Extensions'), 'ExtensionRegistry')['$==='](ext_registry) : $d)))) { + self.extensions = ext_registry.$activate(self)} + } else if ($truthy($$$('::', 'Proc')['$===']((ext_block = options['$[]']("extensions"))))) { + self.extensions = $send($$($nesting, 'Extensions'), 'create', [], ext_block.$to_proc()).$activate(self) + } else if ($truthy($$($nesting, 'Extensions').$groups()['$empty?']()['$!']())) { + self.extensions = $$$($$($nesting, 'Extensions'), 'Registry').$new().$activate(self)}}; + self.reader = $$($nesting, 'PreprocessorReader').$new(self, data, $$$($$($nesting, 'Reader'), 'Cursor').$new(attrs['$[]']("docfile"), self.base_dir), $hash2(["normalize"], {"normalize": true})); + if ($truthy(self.sourcemap)) { + return (self.source_location = self.reader.$cursor()) + } else { + return nil + }; + }; + }, TMP_Document_initialize_8.$$arity = -1); + + Opal.def(self, '$parse', TMP_Document_parse_12 = function $$parse(data) { + var $a, TMP_13, TMP_14, self = this, doc = nil, exts = nil; + + + + if (data == null) { + data = nil; + }; + if ($truthy(self.parsed)) { + return self + } else { + + doc = self; + if ($truthy(data)) { + + self.reader = $$($nesting, 'PreprocessorReader').$new(doc, data, $$$($$($nesting, 'Reader'), 'Cursor').$new(self.attributes['$[]']("docfile"), self.base_dir), $hash2(["normalize"], {"normalize": true})); + if ($truthy(self.sourcemap)) { + self.source_location = self.reader.$cursor()};}; + if ($truthy(($truthy($a = (exts = (function() {if ($truthy(self.parent_document)) { + return nil + } else { + return self.extensions + }; return nil; })())) ? exts['$preprocessors?']() : $a))) { + $send(exts.$preprocessors(), 'each', [], (TMP_13 = function(ext){var self = TMP_13.$$s || this, $b; + if (self.reader == null) self.reader = nil; + + + + if (ext == null) { + ext = nil; + }; + return (self.reader = ($truthy($b = ext.$process_method()['$[]'](doc, self.reader)) ? $b : self.reader));}, TMP_13.$$s = self, TMP_13.$$arity = 1, TMP_13))}; + $$($nesting, 'Parser').$parse(self.reader, doc, $hash2(["header_only"], {"header_only": self.options['$[]']("parse_header_only")})); + self.$restore_attributes(); + if ($truthy(($truthy($a = exts) ? exts['$tree_processors?']() : $a))) { + $send(exts.$tree_processors(), 'each', [], (TMP_14 = function(ext){var self = TMP_14.$$s || this, $b, $c, result = nil; + + + + if (ext == null) { + ext = nil; + }; + if ($truthy(($truthy($b = ($truthy($c = (result = ext.$process_method()['$[]'](doc))) ? $$($nesting, 'Document')['$==='](result) : $c)) ? result['$!='](doc) : $b))) { + return (doc = result) + } else { + return nil + };}, TMP_14.$$s = self, TMP_14.$$arity = 1, TMP_14))}; + self.parsed = true; + return doc; + }; + }, TMP_Document_parse_12.$$arity = -1); + + Opal.def(self, '$counter', TMP_Document_counter_15 = function $$counter(name, seed) { + var $a, self = this, attr_seed = nil, attr_val = nil, $writer = nil; + + + + if (seed == null) { + seed = nil; + }; + if ($truthy(self.parent_document)) { + return self.parent_document.$counter(name, seed)}; + if ($truthy(($truthy($a = (attr_seed = (attr_val = self.attributes['$[]'](name))['$nil_or_empty?']()['$!']())) ? self.counters['$key?'](name) : $a))) { + + $writer = [name, (($writer = [name, self.$nextval(attr_val)]), $send(self.counters, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])]; + $send(self.attributes, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + } else if ($truthy(seed)) { + + $writer = [name, (($writer = [name, (function() {if (seed['$=='](seed.$to_i().$to_s())) { + return seed.$to_i() + } else { + return seed + }; return nil; })()]), $send(self.counters, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])]; + $send(self.attributes, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + } else { + + $writer = [name, (($writer = [name, self.$nextval((function() {if ($truthy(attr_seed)) { + return attr_val + } else { + return 0 + }; return nil; })())]), $send(self.counters, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])]; + $send(self.attributes, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + }; + }, TMP_Document_counter_15.$$arity = -2); + + Opal.def(self, '$increment_and_store_counter', TMP_Document_increment_and_store_counter_16 = function $$increment_and_store_counter(counter_name, block) { + var self = this; + + return $$($nesting, 'AttributeEntry').$new(counter_name, self.$counter(counter_name)).$save_to(block.$attributes()).$value() + }, TMP_Document_increment_and_store_counter_16.$$arity = 2); + Opal.alias(self, "counter_increment", "increment_and_store_counter"); + + Opal.def(self, '$nextval', TMP_Document_nextval_17 = function $$nextval(current) { + var self = this, intval = nil; + + if ($truthy($$$('::', 'Integer')['$==='](current))) { + return $rb_plus(current, 1) + } else { + + intval = current.$to_i(); + if ($truthy(intval.$to_s()['$!='](current.$to_s()))) { + return $rb_plus(current['$[]'](0).$ord(), 1).$chr() + } else { + return $rb_plus(intval, 1) + }; + } + }, TMP_Document_nextval_17.$$arity = 1); + + Opal.def(self, '$register', TMP_Document_register_18 = function $$register(type, value) { + var $a, $b, self = this, $case = nil, id = nil, reftext = nil, $logical_op_recvr_tmp_1 = nil, $writer = nil, ref = nil, refs = nil; + + return (function() {$case = type; + if ("ids"['$===']($case)) { + $b = value, $a = Opal.to_ary($b), (id = ($a[0] == null ? nil : $a[0])), (reftext = ($a[1] == null ? nil : $a[1])), $b; + + $logical_op_recvr_tmp_1 = self.catalog['$[]']("ids"); + return ($truthy($a = $logical_op_recvr_tmp_1['$[]'](id)) ? $a : (($writer = [id, ($truthy($b = reftext) ? $b : $rb_plus($rb_plus("[", id), "]"))]), $send($logical_op_recvr_tmp_1, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]));;} + else if ("refs"['$===']($case)) { + $b = value, $a = Opal.to_ary($b), (id = ($a[0] == null ? nil : $a[0])), (ref = ($a[1] == null ? nil : $a[1])), (reftext = ($a[2] == null ? nil : $a[2])), $b; + if ($truthy((refs = self.catalog['$[]']("refs"))['$key?'](id))) { + return nil + } else { + + + $writer = [id, ($truthy($a = reftext) ? $a : $rb_plus($rb_plus("[", id), "]"))]; + $send(self.catalog['$[]']("ids"), '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = [id, ref]; + $send(refs, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];; + };} + else if ("footnotes"['$===']($case) || "indexterms"['$===']($case)) {return self.catalog['$[]'](type)['$<<'](value)} + else {if ($truthy(self.options['$[]']("catalog_assets"))) { + return self.catalog['$[]'](type)['$<<']((function() {if (type['$==']("images")) { + + return $$($nesting, 'ImageReference').$new(value['$[]'](0), value['$[]'](1)); + } else { + return value + }; return nil; })()) + } else { + return nil + }}})() + }, TMP_Document_register_18.$$arity = 2); + + Opal.def(self, '$footnotes?', TMP_Document_footnotes$q_19 = function() { + var self = this; + + if ($truthy(self.catalog['$[]']("footnotes")['$empty?']())) { + return false + } else { + return true + } + }, TMP_Document_footnotes$q_19.$$arity = 0); + + Opal.def(self, '$footnotes', TMP_Document_footnotes_20 = function $$footnotes() { + var self = this; + + return self.catalog['$[]']("footnotes") + }, TMP_Document_footnotes_20.$$arity = 0); + + Opal.def(self, '$callouts', TMP_Document_callouts_21 = function $$callouts() { + var self = this; + + return self.catalog['$[]']("callouts") + }, TMP_Document_callouts_21.$$arity = 0); + + Opal.def(self, '$nested?', TMP_Document_nested$q_22 = function() { + var self = this; + + if ($truthy(self.parent_document)) { + return true + } else { + return false + } + }, TMP_Document_nested$q_22.$$arity = 0); + + Opal.def(self, '$embedded?', TMP_Document_embedded$q_23 = function() { + var self = this; + + return self.attributes['$key?']("embedded") + }, TMP_Document_embedded$q_23.$$arity = 0); + + Opal.def(self, '$extensions?', TMP_Document_extensions$q_24 = function() { + var self = this; + + if ($truthy(self.extensions)) { + return true + } else { + return false + } + }, TMP_Document_extensions$q_24.$$arity = 0); + + Opal.def(self, '$source', TMP_Document_source_25 = function $$source() { + var self = this; + + if ($truthy(self.reader)) { + return self.reader.$source() + } else { + return nil + } + }, TMP_Document_source_25.$$arity = 0); + + Opal.def(self, '$source_lines', TMP_Document_source_lines_26 = function $$source_lines() { + var self = this; + + if ($truthy(self.reader)) { + return self.reader.$source_lines() + } else { + return nil + } + }, TMP_Document_source_lines_26.$$arity = 0); + + Opal.def(self, '$basebackend?', TMP_Document_basebackend$q_27 = function(base) { + var self = this; + + return self.attributes['$[]']("basebackend")['$=='](base) + }, TMP_Document_basebackend$q_27.$$arity = 1); + + Opal.def(self, '$title', TMP_Document_title_28 = function $$title() { + var self = this; + + return self.$doctitle() + }, TMP_Document_title_28.$$arity = 0); + + Opal.def(self, '$title=', TMP_Document_title$eq_29 = function(title) { + var self = this, sect = nil, $writer = nil; + + + if ($truthy((sect = self.header))) { + } else { + + $writer = ["header"]; + $send((sect = (self.header = $$($nesting, 'Section').$new(self, 0))), 'sectname=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + + $writer = [title]; + $send(sect, 'title=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];; + }, TMP_Document_title$eq_29.$$arity = 1); + + Opal.def(self, '$doctitle', TMP_Document_doctitle_30 = function $$doctitle(opts) { + var $a, self = this, val = nil, sect = nil, separator = nil; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + if ($truthy((val = self.attributes['$[]']("title")))) { + } else if ($truthy((sect = self.$first_section()))) { + val = sect.$title() + } else if ($truthy(($truthy($a = opts['$[]']("use_fallback")) ? (val = self.attributes['$[]']("untitled-label")) : $a)['$!']())) { + return nil}; + if ($truthy((separator = opts['$[]']("partition")))) { + return $$($nesting, 'Title').$new(val, opts.$merge($hash2(["separator"], {"separator": (function() {if (separator['$=='](true)) { + return self.attributes['$[]']("title-separator") + } else { + return separator + }; return nil; })()}))) + } else if ($truthy(($truthy($a = opts['$[]']("sanitize")) ? val['$include?']("<") : $a))) { + return val.$gsub($$($nesting, 'XmlSanitizeRx'), "").$squeeze(" ").$strip() + } else { + return val + }; + }, TMP_Document_doctitle_30.$$arity = -1); + Opal.alias(self, "name", "doctitle"); + + Opal.def(self, '$author', TMP_Document_author_31 = function $$author() { + var self = this; + + return self.attributes['$[]']("author") + }, TMP_Document_author_31.$$arity = 0); + + Opal.def(self, '$authors', TMP_Document_authors_32 = function $$authors() { + var $a, self = this, attrs = nil, authors = nil, num_authors = nil, idx = nil; + + if ($truthy((attrs = self.attributes)['$key?']("author"))) { + + authors = [$$($nesting, 'Author').$new(attrs['$[]']("author"), attrs['$[]']("firstname"), attrs['$[]']("middlename"), attrs['$[]']("lastname"), attrs['$[]']("authorinitials"), attrs['$[]']("email"))]; + if ($truthy($rb_gt((num_authors = ($truthy($a = attrs['$[]']("authorcount")) ? $a : 0)), 1))) { + + idx = 1; + while ($truthy($rb_lt(idx, num_authors))) { + + idx = $rb_plus(idx, 1); + authors['$<<']($$($nesting, 'Author').$new(attrs['$[]']("" + "author_" + (idx)), attrs['$[]']("" + "firstname_" + (idx)), attrs['$[]']("" + "middlename_" + (idx)), attrs['$[]']("" + "lastname_" + (idx)), attrs['$[]']("" + "authorinitials_" + (idx)), attrs['$[]']("" + "email_" + (idx)))); + };}; + return authors; + } else { + return [] + } + }, TMP_Document_authors_32.$$arity = 0); + + Opal.def(self, '$revdate', TMP_Document_revdate_33 = function $$revdate() { + var self = this; + + return self.attributes['$[]']("revdate") + }, TMP_Document_revdate_33.$$arity = 0); + + Opal.def(self, '$notitle', TMP_Document_notitle_34 = function $$notitle() { + var $a, self = this; + + return ($truthy($a = self.attributes['$key?']("showtitle")['$!']()) ? self.attributes['$key?']("notitle") : $a) + }, TMP_Document_notitle_34.$$arity = 0); + + Opal.def(self, '$noheader', TMP_Document_noheader_35 = function $$noheader() { + var self = this; + + return self.attributes['$key?']("noheader") + }, TMP_Document_noheader_35.$$arity = 0); + + Opal.def(self, '$nofooter', TMP_Document_nofooter_36 = function $$nofooter() { + var self = this; + + return self.attributes['$key?']("nofooter") + }, TMP_Document_nofooter_36.$$arity = 0); + + Opal.def(self, '$first_section', TMP_Document_first_section_37 = function $$first_section() { + var $a, TMP_38, self = this; + + return ($truthy($a = self.header) ? $a : $send(self.blocks, 'find', [], (TMP_38 = function(e){var self = TMP_38.$$s || this; + + + + if (e == null) { + e = nil; + }; + return e.$context()['$==']("section");}, TMP_38.$$s = self, TMP_38.$$arity = 1, TMP_38))) + }, TMP_Document_first_section_37.$$arity = 0); + + Opal.def(self, '$has_header?', TMP_Document_has_header$q_39 = function() { + var self = this; + + if ($truthy(self.header)) { + return true + } else { + return false + } + }, TMP_Document_has_header$q_39.$$arity = 0); + Opal.alias(self, "header?", "has_header?"); + + Opal.def(self, '$<<', TMP_Document_$lt$lt_40 = function(block) { + var $iter = TMP_Document_$lt$lt_40.$$p, $yield = $iter || nil, self = this, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_Document_$lt$lt_40.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + + if (block.$context()['$==']("section")) { + self.$assign_numeral(block)}; + return $send(self, Opal.find_super_dispatcher(self, '<<', TMP_Document_$lt$lt_40, false), $zuper, $iter); + }, TMP_Document_$lt$lt_40.$$arity = 1); + + Opal.def(self, '$finalize_header', TMP_Document_finalize_header_41 = function $$finalize_header(unrooted_attributes, header_valid) { + var self = this, $writer = nil; + + + + if (header_valid == null) { + header_valid = true; + }; + self.$clear_playback_attributes(unrooted_attributes); + self.$save_attributes(); + if ($truthy(header_valid)) { + } else { + + $writer = ["invalid-header", true]; + $send(unrooted_attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + return unrooted_attributes; + }, TMP_Document_finalize_header_41.$$arity = -2); + + Opal.def(self, '$save_attributes', TMP_Document_save_attributes_42 = function $$save_attributes() { + var $a, $b, TMP_43, self = this, attrs = nil, $writer = nil, val = nil, toc_position_val = nil, toc_val = nil, toc_placement = nil, default_toc_position = nil, default_toc_class = nil, position = nil, $case = nil; + + + if ((attrs = self.attributes)['$[]']("basebackend")['$==']("docbook")) { + + if ($truthy(($truthy($a = self['$attribute_locked?']("toc")) ? $a : self.attributes_modified['$include?']("toc")))) { + } else { + + $writer = ["toc", ""]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + if ($truthy(($truthy($a = self['$attribute_locked?']("sectnums")) ? $a : self.attributes_modified['$include?']("sectnums")))) { + } else { + + $writer = ["sectnums", ""]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + };}; + if ($truthy(($truthy($a = attrs['$key?']("doctitle")) ? $a : (val = self.$doctitle())['$!']()))) { + } else { + + $writer = ["doctitle", val]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + if ($truthy(self.id)) { + } else { + self.id = attrs['$[]']("css-signature") + }; + toc_position_val = (function() {if ($truthy((toc_val = (function() {if ($truthy(attrs.$delete("toc2"))) { + return "left" + } else { + return attrs['$[]']("toc") + }; return nil; })()))) { + if ($truthy(($truthy($a = (toc_placement = attrs.$fetch("toc-placement", "macro"))) ? toc_placement['$!=']("auto") : $a))) { + return toc_placement + } else { + return attrs['$[]']("toc-position") + } + } else { + return nil + }; return nil; })(); + if ($truthy(($truthy($a = toc_val) ? ($truthy($b = toc_val['$empty?']()['$!']()) ? $b : toc_position_val['$nil_or_empty?']()['$!']()) : $a))) { + + default_toc_position = "left"; + default_toc_class = "toc2"; + if ($truthy(toc_position_val['$nil_or_empty?']()['$!']())) { + position = toc_position_val + } else if ($truthy(toc_val['$empty?']()['$!']())) { + position = toc_val + } else { + position = default_toc_position + }; + + $writer = ["toc", ""]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["toc-placement", "auto"]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + $case = position; + if ("left"['$===']($case) || "<"['$===']($case) || "<"['$===']($case)) { + $writer = ["toc-position", "left"]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];} + else if ("right"['$===']($case) || ">"['$===']($case) || ">"['$===']($case)) { + $writer = ["toc-position", "right"]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];} + else if ("top"['$===']($case) || "^"['$===']($case)) { + $writer = ["toc-position", "top"]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];} + else if ("bottom"['$===']($case) || "v"['$===']($case)) { + $writer = ["toc-position", "bottom"]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];} + else if ("preamble"['$===']($case) || "macro"['$===']($case)) { + + $writer = ["toc-position", "content"]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["toc-placement", position]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + default_toc_class = nil;} + else { + attrs.$delete("toc-position"); + default_toc_class = nil;}; + if ($truthy(default_toc_class)) { + ($truthy($a = attrs['$[]']("toc-class")) ? $a : (($writer = ["toc-class", default_toc_class]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]))};}; + if ($truthy((self.compat_mode = attrs['$key?']("compat-mode")))) { + if ($truthy(attrs['$key?']("language"))) { + + $writer = ["source-language", attrs['$[]']("language")]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}}; + self.outfilesuffix = attrs['$[]']("outfilesuffix"); + self.header_attributes = attrs.$dup(); + if ($truthy(self.parent_document)) { + return nil + } else { + return $send($$($nesting, 'FLEXIBLE_ATTRIBUTES'), 'each', [], (TMP_43 = function(name){var self = TMP_43.$$s || this, $c; + if (self.attribute_overrides == null) self.attribute_overrides = nil; + + + + if (name == null) { + name = nil; + }; + if ($truthy(($truthy($c = self.attribute_overrides['$key?'](name)) ? self.attribute_overrides['$[]'](name) : $c))) { + return self.attribute_overrides.$delete(name) + } else { + return nil + };}, TMP_43.$$s = self, TMP_43.$$arity = 1, TMP_43)) + }; + }, TMP_Document_save_attributes_42.$$arity = 0); + + Opal.def(self, '$restore_attributes', TMP_Document_restore_attributes_44 = function $$restore_attributes() { + var self = this; + + + if ($truthy(self.parent_document)) { + } else { + self.catalog['$[]']("callouts").$rewind() + }; + return self.attributes.$replace(self.header_attributes); + }, TMP_Document_restore_attributes_44.$$arity = 0); + + Opal.def(self, '$clear_playback_attributes', TMP_Document_clear_playback_attributes_45 = function $$clear_playback_attributes(attributes) { + var self = this; + + return attributes.$delete("attribute_entries") + }, TMP_Document_clear_playback_attributes_45.$$arity = 1); + + Opal.def(self, '$playback_attributes', TMP_Document_playback_attributes_46 = function $$playback_attributes(block_attributes) { + var TMP_47, self = this; + + if ($truthy(block_attributes['$key?']("attribute_entries"))) { + return $send(block_attributes['$[]']("attribute_entries"), 'each', [], (TMP_47 = function(entry){var self = TMP_47.$$s || this, name = nil, $writer = nil; + if (self.attributes == null) self.attributes = nil; + + + + if (entry == null) { + entry = nil; + }; + name = entry.$name(); + if ($truthy(entry.$negate())) { + + self.attributes.$delete(name); + if (name['$==']("compat-mode")) { + return (self.compat_mode = false) + } else { + return nil + }; + } else { + + + $writer = [name, entry.$value()]; + $send(self.attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + if (name['$==']("compat-mode")) { + return (self.compat_mode = true) + } else { + return nil + }; + };}, TMP_47.$$s = self, TMP_47.$$arity = 1, TMP_47)) + } else { + return nil + } + }, TMP_Document_playback_attributes_46.$$arity = 1); + + Opal.def(self, '$set_attribute', TMP_Document_set_attribute_48 = function $$set_attribute(name, value) { + var self = this, resolved_value = nil, $case = nil, $writer = nil; + + + + if (value == null) { + value = ""; + }; + if ($truthy(self['$attribute_locked?'](name))) { + return false + } else { + + if ($truthy(self.max_attribute_value_size)) { + resolved_value = self.$apply_attribute_value_subs(value).$limit_bytesize(self.max_attribute_value_size) + } else { + resolved_value = self.$apply_attribute_value_subs(value) + }; + $case = name; + if ("backend"['$===']($case)) {self.$update_backend_attributes(resolved_value, self.attributes_modified['$delete?']("htmlsyntax"))} + else if ("doctype"['$===']($case)) {self.$update_doctype_attributes(resolved_value)} + else { + $writer = [name, resolved_value]; + $send(self.attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + self.attributes_modified['$<<'](name); + return resolved_value; + }; + }, TMP_Document_set_attribute_48.$$arity = -2); + + Opal.def(self, '$delete_attribute', TMP_Document_delete_attribute_49 = function $$delete_attribute(name) { + var self = this; + + if ($truthy(self['$attribute_locked?'](name))) { + return false + } else { + + self.attributes.$delete(name); + self.attributes_modified['$<<'](name); + return true; + } + }, TMP_Document_delete_attribute_49.$$arity = 1); + + Opal.def(self, '$attribute_locked?', TMP_Document_attribute_locked$q_50 = function(name) { + var self = this; + + return self.attribute_overrides['$key?'](name) + }, TMP_Document_attribute_locked$q_50.$$arity = 1); + + Opal.def(self, '$set_header_attribute', TMP_Document_set_header_attribute_51 = function $$set_header_attribute(name, value, overwrite) { + var $a, self = this, attrs = nil, $writer = nil; + + + + if (value == null) { + value = ""; + }; + + if (overwrite == null) { + overwrite = true; + }; + attrs = ($truthy($a = self.header_attributes) ? $a : self.attributes); + if ($truthy((($a = overwrite['$=='](false)) ? attrs['$key?'](name) : overwrite['$=='](false)))) { + return false + } else { + + + $writer = [name, value]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + return true; + }; + }, TMP_Document_set_header_attribute_51.$$arity = -2); + + Opal.def(self, '$apply_attribute_value_subs', TMP_Document_apply_attribute_value_subs_52 = function $$apply_attribute_value_subs(value) { + var $a, self = this; + + if ($truthy($$($nesting, 'AttributeEntryPassMacroRx')['$=~'](value))) { + if ($truthy((($a = $gvars['~']) === nil ? nil : $a['$[]'](1)))) { + + return self.$apply_subs((($a = $gvars['~']) === nil ? nil : $a['$[]'](2)), self.$resolve_pass_subs((($a = $gvars['~']) === nil ? nil : $a['$[]'](1)))); + } else { + return (($a = $gvars['~']) === nil ? nil : $a['$[]'](2)) + } + } else { + return self.$apply_header_subs(value) + } + }, TMP_Document_apply_attribute_value_subs_52.$$arity = 1); + + Opal.def(self, '$update_backend_attributes', TMP_Document_update_backend_attributes_53 = function $$update_backend_attributes(new_backend, force) { + var $a, $b, self = this, attrs = nil, current_backend = nil, current_basebackend = nil, current_doctype = nil, $writer = nil, resolved_backend = nil, new_basebackend = nil, new_filetype = nil, new_outfilesuffix = nil, current_filetype = nil, page_width = nil; + + + + if (force == null) { + force = nil; + }; + if ($truthy(($truthy($a = force) ? $a : ($truthy($b = new_backend) ? new_backend['$!='](self.backend) : $b)))) { + + $a = [self.backend, (attrs = self.attributes)['$[]']("basebackend"), self.doctype], (current_backend = $a[0]), (current_basebackend = $a[1]), (current_doctype = $a[2]), $a; + if ($truthy(new_backend['$start_with?']("xhtml"))) { + + + $writer = ["htmlsyntax", "xml"]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + new_backend = new_backend.$slice(1, new_backend.$length()); + } else if ($truthy(new_backend['$start_with?']("html"))) { + if (attrs['$[]']("htmlsyntax")['$==']("xml")) { + } else { + + $writer = ["htmlsyntax", "html"]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }}; + if ($truthy((resolved_backend = $$($nesting, 'BACKEND_ALIASES')['$[]'](new_backend)))) { + new_backend = resolved_backend}; + if ($truthy(current_doctype)) { + + if ($truthy(current_backend)) { + + attrs.$delete("" + "backend-" + (current_backend)); + attrs.$delete("" + "backend-" + (current_backend) + "-doctype-" + (current_doctype));}; + + $writer = ["" + "backend-" + (new_backend) + "-doctype-" + (current_doctype), ""]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["" + "doctype-" + (current_doctype), ""]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + } else if ($truthy(current_backend)) { + attrs.$delete("" + "backend-" + (current_backend))}; + + $writer = ["" + "backend-" + (new_backend), ""]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + self.backend = (($writer = ["backend", new_backend]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]); + if ($truthy($$$($$($nesting, 'Converter'), 'BackendInfo')['$===']((self.converter = self.$create_converter())))) { + + new_basebackend = self.converter.$basebackend(); + if ($truthy(self['$attribute_locked?']("outfilesuffix"))) { + } else { + + $writer = ["outfilesuffix", self.converter.$outfilesuffix()]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + new_filetype = self.converter.$filetype(); + } else if ($truthy(self.converter)) { + + new_basebackend = new_backend.$sub($$($nesting, 'TrailingDigitsRx'), ""); + if ($truthy((new_outfilesuffix = $$($nesting, 'DEFAULT_EXTENSIONS')['$[]'](new_basebackend)))) { + new_filetype = new_outfilesuffix.$slice(1, new_outfilesuffix.$length()) + } else { + $a = [".html", "html", "html"], (new_outfilesuffix = $a[0]), (new_basebackend = $a[1]), (new_filetype = $a[2]), $a + }; + if ($truthy(self['$attribute_locked?']("outfilesuffix"))) { + } else { + + $writer = ["outfilesuffix", new_outfilesuffix]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + } else { + self.$raise($$$('::', 'NotImplementedError'), "" + "asciidoctor: FAILED: missing converter for backend '" + (new_backend) + "'. Processing aborted.") + }; + if ($truthy((current_filetype = attrs['$[]']("filetype")))) { + attrs.$delete("" + "filetype-" + (current_filetype))}; + + $writer = ["filetype", new_filetype]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["" + "filetype-" + (new_filetype), ""]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + if ($truthy((page_width = $$($nesting, 'DEFAULT_PAGE_WIDTHS')['$[]'](new_basebackend)))) { + + $writer = ["pagewidth", page_width]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + } else { + attrs.$delete("pagewidth") + }; + if ($truthy(new_basebackend['$!='](current_basebackend))) { + + if ($truthy(current_doctype)) { + + if ($truthy(current_basebackend)) { + + attrs.$delete("" + "basebackend-" + (current_basebackend)); + attrs.$delete("" + "basebackend-" + (current_basebackend) + "-doctype-" + (current_doctype));}; + + $writer = ["" + "basebackend-" + (new_basebackend) + "-doctype-" + (current_doctype), ""]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + } else if ($truthy(current_basebackend)) { + attrs.$delete("" + "basebackend-" + (current_basebackend))}; + + $writer = ["" + "basebackend-" + (new_basebackend), ""]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["basebackend", new_basebackend]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];;}; + return new_backend; + } else { + return nil + }; + }, TMP_Document_update_backend_attributes_53.$$arity = -2); + + Opal.def(self, '$update_doctype_attributes', TMP_Document_update_doctype_attributes_54 = function $$update_doctype_attributes(new_doctype) { + var $a, self = this, attrs = nil, current_backend = nil, current_basebackend = nil, current_doctype = nil, $writer = nil; + + if ($truthy(($truthy($a = new_doctype) ? new_doctype['$!='](self.doctype) : $a))) { + + $a = [self.backend, (attrs = self.attributes)['$[]']("basebackend"), self.doctype], (current_backend = $a[0]), (current_basebackend = $a[1]), (current_doctype = $a[2]), $a; + if ($truthy(current_doctype)) { + + attrs.$delete("" + "doctype-" + (current_doctype)); + if ($truthy(current_backend)) { + + attrs.$delete("" + "backend-" + (current_backend) + "-doctype-" + (current_doctype)); + + $writer = ["" + "backend-" + (current_backend) + "-doctype-" + (new_doctype), ""]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];;}; + if ($truthy(current_basebackend)) { + + attrs.$delete("" + "basebackend-" + (current_basebackend) + "-doctype-" + (current_doctype)); + + $writer = ["" + "basebackend-" + (current_basebackend) + "-doctype-" + (new_doctype), ""]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];;}; + } else { + + if ($truthy(current_backend)) { + + $writer = ["" + "backend-" + (current_backend) + "-doctype-" + (new_doctype), ""]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if ($truthy(current_basebackend)) { + + $writer = ["" + "basebackend-" + (current_basebackend) + "-doctype-" + (new_doctype), ""]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + }; + + $writer = ["" + "doctype-" + (new_doctype), ""]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + return (self.doctype = (($writer = ["doctype", new_doctype]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + } else { + return nil + } + }, TMP_Document_update_doctype_attributes_54.$$arity = 1); + + Opal.def(self, '$create_converter', TMP_Document_create_converter_55 = function $$create_converter() { + var self = this, converter_opts = nil, $writer = nil, template_dir = nil, template_dirs = nil, converter = nil, converter_factory = nil; + + + converter_opts = $hash2([], {}); + + $writer = ["htmlsyntax", self.attributes['$[]']("htmlsyntax")]; + $send(converter_opts, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + if ($truthy((template_dir = self.options['$[]']("template_dir")))) { + template_dirs = [template_dir] + } else if ($truthy((template_dirs = self.options['$[]']("template_dirs")))) { + template_dirs = self.$Array(template_dirs)}; + if ($truthy(template_dirs)) { + + + $writer = ["template_dirs", template_dirs]; + $send(converter_opts, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["template_cache", self.options.$fetch("template_cache", true)]; + $send(converter_opts, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["template_engine", self.options['$[]']("template_engine")]; + $send(converter_opts, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["template_engine_options", self.options['$[]']("template_engine_options")]; + $send(converter_opts, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["eruby", self.options['$[]']("eruby")]; + $send(converter_opts, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["safe", self.safe]; + $send(converter_opts, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];;}; + if ($truthy((converter = self.options['$[]']("converter")))) { + converter_factory = $$$($$($nesting, 'Converter'), 'Factory').$new($$$('::', 'Hash')['$[]'](self.$backend(), converter)) + } else { + converter_factory = $$$($$($nesting, 'Converter'), 'Factory').$default(false) + }; + return converter_factory.$create(self.$backend(), converter_opts); + }, TMP_Document_create_converter_55.$$arity = 0); + + Opal.def(self, '$convert', TMP_Document_convert_56 = function $$convert(opts) { + var $a, TMP_57, self = this, $writer = nil, block = nil, output = nil, transform = nil, exts = nil; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + if ($truthy(self.timings)) { + self.timings.$start("convert")}; + if ($truthy(self.parsed)) { + } else { + self.$parse() + }; + if ($truthy(($truthy($a = $rb_ge(self.safe, $$$($$($nesting, 'SafeMode'), 'SERVER'))) ? $a : opts['$empty?']()))) { + } else { + + if ($truthy((($writer = ["outfile", opts['$[]']("outfile")]), $send(self.attributes, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]))) { + } else { + self.attributes.$delete("outfile") + }; + if ($truthy((($writer = ["outdir", opts['$[]']("outdir")]), $send(self.attributes, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]))) { + } else { + self.attributes.$delete("outdir") + }; + }; + if (self.$doctype()['$==']("inline")) { + if ($truthy((block = ($truthy($a = self.blocks['$[]'](0)) ? $a : self.header)))) { + if ($truthy(($truthy($a = block.$content_model()['$==']("compound")) ? $a : block.$content_model()['$==']("empty")))) { + self.$logger().$warn("no inline candidate; use the inline doctype to convert a single paragragh, verbatim, or raw block") + } else { + output = block.$content() + }} + } else { + + transform = (function() {if ($truthy((function() {if ($truthy(opts['$key?']("header_footer"))) { + return opts['$[]']("header_footer") + } else { + return self.options['$[]']("header_footer") + }; return nil; })())) { + return "document" + } else { + return "embedded" + }; return nil; })(); + output = self.converter.$convert(self, transform); + }; + if ($truthy(self.parent_document)) { + } else if ($truthy(($truthy($a = (exts = self.extensions)) ? exts['$postprocessors?']() : $a))) { + $send(exts.$postprocessors(), 'each', [], (TMP_57 = function(ext){var self = TMP_57.$$s || this; + + + + if (ext == null) { + ext = nil; + }; + return (output = ext.$process_method()['$[]'](self, output));}, TMP_57.$$s = self, TMP_57.$$arity = 1, TMP_57))}; + if ($truthy(self.timings)) { + self.timings.$record("convert")}; + return output; + }, TMP_Document_convert_56.$$arity = -1); + Opal.alias(self, "render", "convert"); + + Opal.def(self, '$write', TMP_Document_write_58 = function $$write(output, target) { + var $a, $b, self = this; + + + if ($truthy(self.timings)) { + self.timings.$start("write")}; + if ($truthy($$($nesting, 'Writer')['$==='](self.converter))) { + self.converter.$write(output, target) + } else { + + if ($truthy(target['$respond_to?']("write"))) { + if ($truthy(output['$nil_or_empty?']())) { + } else { + + target.$write(output.$chomp()); + target.$write($$($nesting, 'LF')); + } + } else if ($truthy($$($nesting, 'COERCE_ENCODING'))) { + $$$('::', 'IO').$write(target, output, $hash2(["encoding"], {"encoding": $$$($$$('::', 'Encoding'), 'UTF_8')})) + } else { + $$$('::', 'IO').$write(target, output) + }; + if ($truthy(($truthy($a = (($b = self.backend['$==']("manpage")) ? $$$('::', 'String')['$==='](target) : self.backend['$==']("manpage"))) ? self.converter['$respond_to?']("write_alternate_pages") : $a))) { + self.converter.$write_alternate_pages(self.attributes['$[]']("mannames"), self.attributes['$[]']("manvolnum"), target)}; + }; + if ($truthy(self.timings)) { + self.timings.$record("write")}; + return nil; + }, TMP_Document_write_58.$$arity = 2); + + Opal.def(self, '$content', TMP_Document_content_59 = function $$content() { + var $iter = TMP_Document_content_59.$$p, $yield = $iter || nil, self = this, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_Document_content_59.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + + self.attributes.$delete("title"); + return $send(self, Opal.find_super_dispatcher(self, 'content', TMP_Document_content_59, false), $zuper, $iter); + }, TMP_Document_content_59.$$arity = 0); + + Opal.def(self, '$docinfo', TMP_Document_docinfo_60 = function $$docinfo(location, suffix) { + var TMP_61, $a, TMP_62, self = this, content = nil, qualifier = nil, docinfo = nil, docinfo_file = nil, docinfo_dir = nil, docinfo_subs = nil, docinfo_path = nil, shd_content = nil, pvt_content = nil; + + + + if (location == null) { + location = "head"; + }; + + if (suffix == null) { + suffix = nil; + }; + if ($truthy($rb_ge(self.$safe(), $$$($$($nesting, 'SafeMode'), 'SECURE')))) { + return "" + } else { + + content = []; + if (location['$==']("head")) { + } else { + qualifier = "" + "-" + (location) + }; + if ($truthy(suffix)) { + } else { + suffix = self.outfilesuffix + }; + if ($truthy((docinfo = self.attributes['$[]']("docinfo"))['$nil_or_empty?']())) { + if ($truthy(self.attributes['$key?']("docinfo2"))) { + docinfo = ["private", "shared"] + } else if ($truthy(self.attributes['$key?']("docinfo1"))) { + docinfo = ["shared"] + } else { + docinfo = (function() {if ($truthy(docinfo)) { + return ["private"] + } else { + return nil + }; return nil; })() + } + } else { + docinfo = $send(docinfo.$split(","), 'map', [], (TMP_61 = function(it){var self = TMP_61.$$s || this; + + + + if (it == null) { + it = nil; + }; + return it.$strip();}, TMP_61.$$s = self, TMP_61.$$arity = 1, TMP_61)) + }; + if ($truthy(docinfo)) { + + $a = ["" + "docinfo" + (qualifier) + (suffix), self.attributes['$[]']("docinfodir"), self.$resolve_docinfo_subs()], (docinfo_file = $a[0]), (docinfo_dir = $a[1]), (docinfo_subs = $a[2]), $a; + if ($truthy(docinfo['$&'](["shared", "" + "shared-" + (location)])['$empty?']())) { + } else { + + docinfo_path = self.$normalize_system_path(docinfo_file, docinfo_dir); + if ($truthy((shd_content = self.$read_asset(docinfo_path, $hash2(["normalize"], {"normalize": true}))))) { + content['$<<'](self.$apply_subs(shd_content, docinfo_subs))}; + }; + if ($truthy(($truthy($a = self.attributes['$[]']("docname")['$nil_or_empty?']()) ? $a : docinfo['$&'](["private", "" + "private-" + (location)])['$empty?']()))) { + } else { + + docinfo_path = self.$normalize_system_path("" + (self.attributes['$[]']("docname")) + "-" + (docinfo_file), docinfo_dir); + if ($truthy((pvt_content = self.$read_asset(docinfo_path, $hash2(["normalize"], {"normalize": true}))))) { + content['$<<'](self.$apply_subs(pvt_content, docinfo_subs))}; + };}; + if ($truthy(($truthy($a = self.extensions) ? self['$docinfo_processors?'](location) : $a))) { + content = $rb_plus(content, $send(self.docinfo_processor_extensions['$[]'](location), 'map', [], (TMP_62 = function(ext){var self = TMP_62.$$s || this; + + + + if (ext == null) { + ext = nil; + }; + return ext.$process_method()['$[]'](self);}, TMP_62.$$s = self, TMP_62.$$arity = 1, TMP_62)).$compact())}; + return content.$join($$($nesting, 'LF')); + }; + }, TMP_Document_docinfo_60.$$arity = -1); + + Opal.def(self, '$resolve_docinfo_subs', TMP_Document_resolve_docinfo_subs_63 = function $$resolve_docinfo_subs() { + var self = this; + + if ($truthy(self.attributes['$key?']("docinfosubs"))) { + + return self.$resolve_subs(self.attributes['$[]']("docinfosubs"), "block", nil, "docinfo"); + } else { + return ["attributes"] + } + }, TMP_Document_resolve_docinfo_subs_63.$$arity = 0); + + Opal.def(self, '$docinfo_processors?', TMP_Document_docinfo_processors$q_64 = function(location) { + var $a, self = this, $writer = nil; + + + + if (location == null) { + location = "head"; + }; + if ($truthy(self.docinfo_processor_extensions['$key?'](location))) { + return self.docinfo_processor_extensions['$[]'](location)['$!='](false) + } else if ($truthy(($truthy($a = self.extensions) ? self.document.$extensions()['$docinfo_processors?'](location) : $a))) { + return (($writer = [location, self.document.$extensions().$docinfo_processors(location)]), $send(self.docinfo_processor_extensions, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])['$!']()['$!']() + } else { + + $writer = [location, false]; + $send(self.docinfo_processor_extensions, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + }; + }, TMP_Document_docinfo_processors$q_64.$$arity = -1); + return (Opal.def(self, '$to_s', TMP_Document_to_s_65 = function $$to_s() { + var self = this; + + return "" + "#<" + (self.$class()) + "@" + (self.$object_id()) + " {doctype: " + (self.$doctype().$inspect()) + ", doctitle: " + ((function() {if ($truthy(self.header['$!='](nil))) { + return self.header.$title() + } else { + return nil + }; return nil; })().$inspect()) + ", blocks: " + (self.blocks.$size()) + "}>" + }, TMP_Document_to_s_65.$$arity = 0), nil) && 'to_s'; + })($nesting[0], $$($nesting, 'AbstractBlock'), $nesting) + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/inline"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $hash2 = Opal.hash2, $send = Opal.send, $truthy = Opal.truthy; + + Opal.add_stubs(['$attr_reader', '$attr_accessor', '$[]', '$dup', '$convert', '$converter', '$attr', '$==', '$apply_reftext_subs', '$reftext']); + return (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + (function($base, $super, $parent_nesting) { + function $Inline(){}; + var self = $Inline = $klass($base, $super, 'Inline', $Inline); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Inline_initialize_1, TMP_Inline_block$q_2, TMP_Inline_inline$q_3, TMP_Inline_convert_4, TMP_Inline_alt_5, TMP_Inline_reftext$q_6, TMP_Inline_reftext_7, TMP_Inline_xreftext_8; + + def.text = def.type = nil; + + self.$attr_reader("text"); + self.$attr_reader("type"); + self.$attr_accessor("target"); + + Opal.def(self, '$initialize', TMP_Inline_initialize_1 = function $$initialize(parent, context, text, opts) { + var $iter = TMP_Inline_initialize_1.$$p, $yield = $iter || nil, self = this, attrs = nil; + + if ($iter) TMP_Inline_initialize_1.$$p = null; + + + if (text == null) { + text = nil; + }; + + if (opts == null) { + opts = $hash2([], {}); + }; + $send(self, Opal.find_super_dispatcher(self, 'initialize', TMP_Inline_initialize_1, false), [parent, context], null); + self.node_name = "" + "inline_" + (context); + self.text = text; + self.id = opts['$[]']("id"); + self.type = opts['$[]']("type"); + self.target = opts['$[]']("target"); + if ($truthy((attrs = opts['$[]']("attributes")))) { + return (self.attributes = attrs.$dup()) + } else { + return nil + }; + }, TMP_Inline_initialize_1.$$arity = -3); + + Opal.def(self, '$block?', TMP_Inline_block$q_2 = function() { + var self = this; + + return false + }, TMP_Inline_block$q_2.$$arity = 0); + + Opal.def(self, '$inline?', TMP_Inline_inline$q_3 = function() { + var self = this; + + return true + }, TMP_Inline_inline$q_3.$$arity = 0); + + Opal.def(self, '$convert', TMP_Inline_convert_4 = function $$convert() { + var self = this; + + return self.$converter().$convert(self) + }, TMP_Inline_convert_4.$$arity = 0); + Opal.alias(self, "render", "convert"); + + Opal.def(self, '$alt', TMP_Inline_alt_5 = function $$alt() { + var self = this; + + return self.$attr("alt") + }, TMP_Inline_alt_5.$$arity = 0); + + Opal.def(self, '$reftext?', TMP_Inline_reftext$q_6 = function() { + var $a, $b, self = this; + + return ($truthy($a = self.text) ? ($truthy($b = self.type['$==']("ref")) ? $b : self.type['$==']("bibref")) : $a) + }, TMP_Inline_reftext$q_6.$$arity = 0); + + Opal.def(self, '$reftext', TMP_Inline_reftext_7 = function $$reftext() { + var self = this, val = nil; + + if ($truthy((val = self.text))) { + + return self.$apply_reftext_subs(val); + } else { + return nil + } + }, TMP_Inline_reftext_7.$$arity = 0); + return (Opal.def(self, '$xreftext', TMP_Inline_xreftext_8 = function $$xreftext(xrefstyle) { + var self = this; + + + + if (xrefstyle == null) { + xrefstyle = nil; + }; + return self.$reftext(); + }, TMP_Inline_xreftext_8.$$arity = -1), nil) && 'xreftext'; + })($nesting[0], $$($nesting, 'AbstractNode'), $nesting) + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/list"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $hash2 = Opal.hash2, $send = Opal.send, $truthy = Opal.truthy; + + Opal.add_stubs(['$==', '$next_list', '$callouts', '$class', '$object_id', '$inspect', '$size', '$items', '$attr_accessor', '$level', '$drop', '$!', '$nil_or_empty?', '$apply_subs', '$empty?', '$===', '$[]', '$outline?', '$simple?', '$context', '$option?', '$shift', '$blocks', '$unshift', '$lines', '$source', '$parent']); + return (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + + (function($base, $super, $parent_nesting) { + function $List(){}; + var self = $List = $klass($base, $super, 'List', $List); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_List_initialize_1, TMP_List_outline$q_2, TMP_List_convert_3, TMP_List_to_s_4; + + def.context = def.document = def.style = nil; + + Opal.alias(self, "items", "blocks"); + Opal.alias(self, "content", "blocks"); + Opal.alias(self, "items?", "blocks?"); + + Opal.def(self, '$initialize', TMP_List_initialize_1 = function $$initialize(parent, context, opts) { + var $iter = TMP_List_initialize_1.$$p, $yield = $iter || nil, self = this, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_List_initialize_1.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + + + if (opts == null) { + opts = $hash2([], {}); + }; + return $send(self, Opal.find_super_dispatcher(self, 'initialize', TMP_List_initialize_1, false), $zuper, $iter); + }, TMP_List_initialize_1.$$arity = -3); + + Opal.def(self, '$outline?', TMP_List_outline$q_2 = function() { + var $a, self = this; + + return ($truthy($a = self.context['$==']("ulist")) ? $a : self.context['$==']("olist")) + }, TMP_List_outline$q_2.$$arity = 0); + + Opal.def(self, '$convert', TMP_List_convert_3 = function $$convert() { + var $iter = TMP_List_convert_3.$$p, $yield = $iter || nil, self = this, result = nil, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_List_convert_3.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + if (self.context['$==']("colist")) { + + result = $send(self, Opal.find_super_dispatcher(self, 'convert', TMP_List_convert_3, false), $zuper, $iter); + self.document.$callouts().$next_list(); + return result; + } else { + return $send(self, Opal.find_super_dispatcher(self, 'convert', TMP_List_convert_3, false), $zuper, $iter) + } + }, TMP_List_convert_3.$$arity = 0); + Opal.alias(self, "render", "convert"); + return (Opal.def(self, '$to_s', TMP_List_to_s_4 = function $$to_s() { + var self = this; + + return "" + "#<" + (self.$class()) + "@" + (self.$object_id()) + " {context: " + (self.context.$inspect()) + ", style: " + (self.style.$inspect()) + ", items: " + (self.$items().$size()) + "}>" + }, TMP_List_to_s_4.$$arity = 0), nil) && 'to_s'; + })($nesting[0], $$($nesting, 'AbstractBlock'), $nesting); + (function($base, $super, $parent_nesting) { + function $ListItem(){}; + var self = $ListItem = $klass($base, $super, 'ListItem', $ListItem); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_ListItem_initialize_5, TMP_ListItem_text$q_6, TMP_ListItem_text_7, TMP_ListItem_text$eq_8, TMP_ListItem_simple$q_9, TMP_ListItem_compound$q_10, TMP_ListItem_fold_first_11, TMP_ListItem_to_s_12; + + def.text = def.subs = def.blocks = nil; + + Opal.alias(self, "list", "parent"); + self.$attr_accessor("marker"); + + Opal.def(self, '$initialize', TMP_ListItem_initialize_5 = function $$initialize(parent, text) { + var $iter = TMP_ListItem_initialize_5.$$p, $yield = $iter || nil, self = this; + + if ($iter) TMP_ListItem_initialize_5.$$p = null; + + + if (text == null) { + text = nil; + }; + $send(self, Opal.find_super_dispatcher(self, 'initialize', TMP_ListItem_initialize_5, false), [parent, "list_item"], null); + self.text = text; + self.level = parent.$level(); + return (self.subs = $$($nesting, 'NORMAL_SUBS').$drop(0)); + }, TMP_ListItem_initialize_5.$$arity = -2); + + Opal.def(self, '$text?', TMP_ListItem_text$q_6 = function() { + var self = this; + + return self.text['$nil_or_empty?']()['$!']() + }, TMP_ListItem_text$q_6.$$arity = 0); + + Opal.def(self, '$text', TMP_ListItem_text_7 = function $$text() { + var $a, self = this; + + return ($truthy($a = self.text) ? self.$apply_subs(self.text, self.subs) : $a) + }, TMP_ListItem_text_7.$$arity = 0); + + Opal.def(self, '$text=', TMP_ListItem_text$eq_8 = function(val) { + var self = this; + + return (self.text = val) + }, TMP_ListItem_text$eq_8.$$arity = 1); + + Opal.def(self, '$simple?', TMP_ListItem_simple$q_9 = function() { + var $a, $b, $c, self = this, blk = nil; + + return ($truthy($a = self.blocks['$empty?']()) ? $a : ($truthy($b = (($c = self.blocks.$size()['$=='](1)) ? $$($nesting, 'List')['$===']((blk = self.blocks['$[]'](0))) : self.blocks.$size()['$=='](1))) ? blk['$outline?']() : $b)) + }, TMP_ListItem_simple$q_9.$$arity = 0); + + Opal.def(self, '$compound?', TMP_ListItem_compound$q_10 = function() { + var self = this; + + return self['$simple?']()['$!']() + }, TMP_ListItem_compound$q_10.$$arity = 0); + + Opal.def(self, '$fold_first', TMP_ListItem_fold_first_11 = function $$fold_first(continuation_connects_first_block, content_adjacent) { + var $a, $b, $c, $d, $e, self = this, first_block = nil, block = nil; + + + + if (continuation_connects_first_block == null) { + continuation_connects_first_block = false; + }; + + if (content_adjacent == null) { + content_adjacent = false; + }; + if ($truthy(($truthy($a = ($truthy($b = (first_block = self.blocks['$[]'](0))) ? $$($nesting, 'Block')['$==='](first_block) : $b)) ? ($truthy($b = (($c = first_block.$context()['$==']("paragraph")) ? continuation_connects_first_block['$!']() : first_block.$context()['$==']("paragraph"))) ? $b : ($truthy($c = ($truthy($d = ($truthy($e = content_adjacent) ? $e : continuation_connects_first_block['$!']())) ? first_block.$context()['$==']("literal") : $d)) ? first_block['$option?']("listparagraph") : $c)) : $a))) { + + block = self.$blocks().$shift(); + if ($truthy(self.text['$nil_or_empty?']())) { + } else { + block.$lines().$unshift(self.text) + }; + self.text = block.$source();}; + return nil; + }, TMP_ListItem_fold_first_11.$$arity = -1); + return (Opal.def(self, '$to_s', TMP_ListItem_to_s_12 = function $$to_s() { + var $a, self = this; + + return "" + "#<" + (self.$class()) + "@" + (self.$object_id()) + " {list_context: " + (self.$parent().$context().$inspect()) + ", text: " + (self.text.$inspect()) + ", blocks: " + (($truthy($a = self.blocks) ? $a : []).$size()) + "}>" + }, TMP_ListItem_to_s_12.$$arity = 0), nil) && 'to_s'; + })($nesting[0], $$($nesting, 'AbstractBlock'), $nesting); + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/parser"] = function(Opal) { + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + function $rb_plus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); + } + function $rb_gt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); + } + function $rb_lt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); + } + function $rb_times(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs * rhs : lhs['$*'](rhs); + } + function $rb_le(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs <= rhs : lhs['$<='](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $send = Opal.send, $truthy = Opal.truthy, $hash2 = Opal.hash2, $gvars = Opal.gvars; + + Opal.add_stubs(['$include', '$new', '$lambda', '$start_with?', '$match?', '$is_delimited_block?', '$raise', '$parse_document_header', '$[]', '$has_more_lines?', '$next_section', '$assign_numeral', '$<<', '$blocks', '$parse_block_metadata_lines', '$attributes', '$is_next_line_doctitle?', '$finalize_header', '$nil_or_empty?', '$title=', '$-', '$sourcemap', '$cursor', '$parse_section_title', '$id=', '$source_location=', '$header', '$attribute_locked?', '$[]=', '$id', '$parse_header_metadata', '$register', '$==', '$doctype', '$parse_manpage_header', '$=~', '$downcase', '$include?', '$sub_attributes', '$error', '$logger', '$message_with_context', '$cursor_at_line', '$backend', '$skip_blank_lines', '$save', '$update', '$is_next_line_section?', '$initialize_section', '$join', '$map', '$read_lines_until', '$to_proc', '$title', '$split', '$lstrip', '$restore_save', '$discard_save', '$context', '$empty?', '$has_header?', '$delete', '$!', '$!=', '$attr?', '$attr', '$key?', '$document', '$+', '$level', '$special', '$sectname', '$to_i', '$>', '$<', '$warn', '$next_block', '$blocks?', '$style', '$context=', '$style=', '$parent=', '$size', '$content_model', '$shift', '$unwrap_standalone_preamble', '$dup', '$fetch', '$parse_block_metadata_line', '$extensions', '$block_macros?', '$mark', '$read_line', '$terminator', '$to_s', '$masq', '$to_sym', '$registered_for_block?', '$cursor_at_mark', '$strict_verbatim_paragraphs', '$unshift_line', '$markdown_syntax', '$keys', '$chr', '$*', '$length', '$end_with?', '$===', '$parse_attributes', '$attribute_missing', '$clear', '$tr', '$basename', '$assign_caption', '$registered_for_block_macro?', '$config', '$process_method', '$replace', '$parse_callout_list', '$callouts', '$parse_list', '$match', '$parse_description_list', '$underline_style_section_titles', '$is_section_title?', '$peek_line', '$atx_section_title?', '$generate_id', '$level=', '$read_paragraph_lines', '$adjust_indentation!', '$set_option', '$map!', '$slice', '$pop', '$build_block', '$apply_subs', '$chop', '$catalog_inline_anchors', '$rekey', '$index', '$strip', '$parse_table', '$concat', '$each', '$title?', '$lock_in_subs', '$sub?', '$catalog_callouts', '$source', '$remove_sub', '$block_terminates_paragraph', '$<=', '$nil?', '$lines', '$parse_blocks', '$parse_list_item', '$items', '$scan', '$gsub', '$count', '$pre_match', '$advance', '$callout_ids', '$next_list', '$catalog_inline_anchor', '$source_location', '$marker=', '$catalog_inline_biblio_anchor', '$text=', '$resolve_ordered_list_marker', '$read_lines_for_list_item', '$skip_line_comments', '$unshift_lines', '$fold_first', '$text?', '$is_sibling_list_item?', '$find', '$delete_at', '$casecmp', '$sectname=', '$special=', '$numbered=', '$numbered', '$lineno', '$update_attributes', '$peek_lines', '$setext_section_title?', '$abs', '$line_length', '$cursor_at_prev_line', '$process_attribute_entries', '$next_line_empty?', '$process_authors', '$apply_header_subs', '$rstrip', '$each_with_index', '$compact', '$Array', '$squeeze', '$to_a', '$parse_style_attribute', '$process_attribute_entry', '$skip_comment_lines', '$store_attribute', '$sanitize_attribute_name', '$set_attribute', '$save_to', '$delete_attribute', '$ord', '$int_to_roman', '$resolve_list_marker', '$parse_colspecs', '$create_columns', '$format', '$starts_with_delimiter?', '$close_open_cell', '$parse_cellspec', '$delimiter', '$match_delimiter', '$post_match', '$buffer_has_unclosed_quotes?', '$skip_past_delimiter', '$buffer', '$buffer=', '$skip_past_escaped_delimiter', '$keep_cell_open', '$push_cellspec', '$close_cell', '$cell_open?', '$columns', '$assign_column_widths', '$has_header_option=', '$partition_header_footer', '$upto', '$shorthand_property_syntax', '$each_char', '$call', '$sub!', '$gsub!', '$%', '$begin']); + return (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + (function($base, $super, $parent_nesting) { + function $Parser(){}; + var self = $Parser = $klass($base, $super, 'Parser', $Parser); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Parser_1, TMP_Parser_2, TMP_Parser_3, TMP_Parser_initialize_4, TMP_Parser_parse_5, TMP_Parser_parse_document_header_6, TMP_Parser_parse_manpage_header_7, TMP_Parser_next_section_9, TMP_Parser_next_block_10, TMP_Parser_read_paragraph_lines_14, TMP_Parser_is_delimited_block$q_15, TMP_Parser_build_block_16, TMP_Parser_parse_blocks_17, TMP_Parser_parse_list_18, TMP_Parser_catalog_callouts_19, TMP_Parser_catalog_inline_anchor_21, TMP_Parser_catalog_inline_anchors_22, TMP_Parser_catalog_inline_biblio_anchor_24, TMP_Parser_parse_description_list_25, TMP_Parser_parse_callout_list_26, TMP_Parser_parse_list_item_27, TMP_Parser_read_lines_for_list_item_28, TMP_Parser_initialize_section_34, TMP_Parser_is_next_line_section$q_35, TMP_Parser_is_next_line_doctitle$q_36, TMP_Parser_is_section_title$q_37, TMP_Parser_atx_section_title$q_38, TMP_Parser_setext_section_title$q_39, TMP_Parser_parse_section_title_40, TMP_Parser_line_length_41, TMP_Parser_line_length_42, TMP_Parser_parse_header_metadata_43, TMP_Parser_process_authors_48, TMP_Parser_parse_block_metadata_lines_54, TMP_Parser_parse_block_metadata_line_55, TMP_Parser_process_attribute_entries_56, TMP_Parser_process_attribute_entry_57, TMP_Parser_store_attribute_58, TMP_Parser_resolve_list_marker_59, TMP_Parser_resolve_ordered_list_marker_60, TMP_Parser_is_sibling_list_item$q_62, TMP_Parser_parse_table_63, TMP_Parser_parse_colspecs_64, TMP_Parser_parse_cellspec_68, TMP_Parser_parse_style_attribute_69, TMP_Parser_adjust_indentation$B_73, TMP_Parser_sanitize_attribute_name_81; + + + self.$include($$($nesting, 'Logging')); + Opal.const_set($nesting[0], 'BlockMatchData', $$($nesting, 'Struct').$new("context", "masq", "tip", "terminator")); + Opal.const_set($nesting[0], 'TabRx', /\t/); + Opal.const_set($nesting[0], 'TabIndentRx', /^\t+/); + Opal.const_set($nesting[0], 'StartOfBlockProc', $send(self, 'lambda', [], (TMP_Parser_1 = function(l){var self = TMP_Parser_1.$$s || this, $a, $b; + + + + if (l == null) { + l = nil; + }; + return ($truthy($a = ($truthy($b = l['$start_with?']("[")) ? $$($nesting, 'BlockAttributeLineRx')['$match?'](l) : $b)) ? $a : self['$is_delimited_block?'](l));}, TMP_Parser_1.$$s = self, TMP_Parser_1.$$arity = 1, TMP_Parser_1))); + Opal.const_set($nesting[0], 'StartOfListProc', $send(self, 'lambda', [], (TMP_Parser_2 = function(l){var self = TMP_Parser_2.$$s || this; + + + + if (l == null) { + l = nil; + }; + return $$($nesting, 'AnyListRx')['$match?'](l);}, TMP_Parser_2.$$s = self, TMP_Parser_2.$$arity = 1, TMP_Parser_2))); + Opal.const_set($nesting[0], 'StartOfBlockOrListProc', $send(self, 'lambda', [], (TMP_Parser_3 = function(l){var self = TMP_Parser_3.$$s || this, $a, $b, $c; + + + + if (l == null) { + l = nil; + }; + return ($truthy($a = ($truthy($b = self['$is_delimited_block?'](l)) ? $b : ($truthy($c = l['$start_with?']("[")) ? $$($nesting, 'BlockAttributeLineRx')['$match?'](l) : $c))) ? $a : $$($nesting, 'AnyListRx')['$match?'](l));}, TMP_Parser_3.$$s = self, TMP_Parser_3.$$arity = 1, TMP_Parser_3))); + Opal.const_set($nesting[0], 'NoOp', nil); + Opal.const_set($nesting[0], 'TableCellHorzAlignments', $hash2(["<", ">", "^"], {"<": "left", ">": "right", "^": "center"})); + Opal.const_set($nesting[0], 'TableCellVertAlignments', $hash2(["<", ">", "^"], {"<": "top", ">": "bottom", "^": "middle"})); + Opal.const_set($nesting[0], 'TableCellStyles', $hash2(["d", "s", "e", "m", "h", "l", "v", "a"], {"d": "none", "s": "strong", "e": "emphasis", "m": "monospaced", "h": "header", "l": "literal", "v": "verse", "a": "asciidoc"})); + + Opal.def(self, '$initialize', TMP_Parser_initialize_4 = function $$initialize() { + var self = this; + + return self.$raise("Au contraire, mon frere. No parser instances will be running around.") + }, TMP_Parser_initialize_4.$$arity = 0); + Opal.defs(self, '$parse', TMP_Parser_parse_5 = function $$parse(reader, document, options) { + var $a, $b, $c, self = this, block_attributes = nil, new_section = nil; + + + + if (options == null) { + options = $hash2([], {}); + }; + block_attributes = self.$parse_document_header(reader, document); + if ($truthy(options['$[]']("header_only"))) { + } else { + while ($truthy(reader['$has_more_lines?']())) { + + $c = self.$next_section(reader, document, block_attributes), $b = Opal.to_ary($c), (new_section = ($b[0] == null ? nil : $b[0])), (block_attributes = ($b[1] == null ? nil : $b[1])), $c; + if ($truthy(new_section)) { + + document.$assign_numeral(new_section); + document.$blocks()['$<<'](new_section);}; + } + }; + return document; + }, TMP_Parser_parse_5.$$arity = -3); + Opal.defs(self, '$parse_document_header', TMP_Parser_parse_document_header_6 = function $$parse_document_header(reader, document) { + var $a, $b, self = this, block_attrs = nil, doc_attrs = nil, implicit_doctitle = nil, assigned_doctitle = nil, val = nil, $writer = nil, source_location = nil, _ = nil, doctitle = nil, atx = nil, separator = nil, section_title = nil, doc_id = nil, doc_role = nil, doc_reftext = nil; + + + block_attrs = self.$parse_block_metadata_lines(reader, document); + doc_attrs = document.$attributes(); + if ($truthy(($truthy($a = (implicit_doctitle = self['$is_next_line_doctitle?'](reader, block_attrs, doc_attrs['$[]']("leveloffset")))) ? block_attrs['$[]']("title") : $a))) { + return document.$finalize_header(block_attrs, false)}; + assigned_doctitle = nil; + if ($truthy((val = doc_attrs['$[]']("doctitle"))['$nil_or_empty?']())) { + } else { + + $writer = [(assigned_doctitle = val)]; + $send(document, 'title=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + if ($truthy(implicit_doctitle)) { + + if ($truthy(document.$sourcemap())) { + source_location = reader.$cursor()}; + $b = self.$parse_section_title(reader, document), $a = Opal.to_ary($b), document['$id='](($a[0] == null ? nil : $a[0])), (_ = ($a[1] == null ? nil : $a[1])), (doctitle = ($a[2] == null ? nil : $a[2])), (_ = ($a[3] == null ? nil : $a[3])), (atx = ($a[4] == null ? nil : $a[4])), $b; + if ($truthy(assigned_doctitle)) { + } else { + + $writer = [(assigned_doctitle = doctitle)]; + $send(document, 'title=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + if ($truthy(source_location)) { + + $writer = [source_location]; + $send(document.$header(), 'source_location=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if ($truthy(($truthy($a = atx) ? $a : document['$attribute_locked?']("compat-mode")))) { + } else { + + $writer = ["compat-mode", ""]; + $send(doc_attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + if ($truthy((separator = block_attrs['$[]']("separator")))) { + if ($truthy(document['$attribute_locked?']("title-separator"))) { + } else { + + $writer = ["title-separator", separator]; + $send(doc_attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }}; + + $writer = ["doctitle", (section_title = doctitle)]; + $send(doc_attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + if ($truthy((doc_id = block_attrs['$[]']("id")))) { + + $writer = [doc_id]; + $send(document, 'id=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + } else { + doc_id = document.$id() + }; + if ($truthy((doc_role = block_attrs['$[]']("role")))) { + + $writer = ["docrole", doc_role]; + $send(doc_attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if ($truthy((doc_reftext = block_attrs['$[]']("reftext")))) { + + $writer = ["reftext", doc_reftext]; + $send(doc_attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + block_attrs = $hash2([], {}); + self.$parse_header_metadata(reader, document); + if ($truthy(doc_id)) { + document.$register("refs", [doc_id, document])};}; + if ($truthy(($truthy($a = (val = doc_attrs['$[]']("doctitle"))['$nil_or_empty?']()) ? $a : val['$=='](section_title)))) { + } else { + + $writer = [(assigned_doctitle = val)]; + $send(document, 'title=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + if ($truthy(assigned_doctitle)) { + + $writer = ["doctitle", assigned_doctitle]; + $send(doc_attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if (document.$doctype()['$==']("manpage")) { + self.$parse_manpage_header(reader, document, block_attrs)}; + return document.$finalize_header(block_attrs); + }, TMP_Parser_parse_document_header_6.$$arity = 2); + Opal.defs(self, '$parse_manpage_header', TMP_Parser_parse_manpage_header_7 = function $$parse_manpage_header(reader, document, block_attributes) { + var $a, $b, TMP_8, self = this, doc_attrs = nil, $writer = nil, manvolnum = nil, mantitle = nil, manname = nil, name_section_level = nil, name_section = nil, name_section_buffer = nil, mannames = nil, error_msg = nil; + + + if ($truthy($$($nesting, 'ManpageTitleVolnumRx')['$=~']((doc_attrs = document.$attributes())['$[]']("doctitle")))) { + + + $writer = ["manvolnum", (manvolnum = (($a = $gvars['~']) === nil ? nil : $a['$[]'](2)))]; + $send(doc_attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["mantitle", (function() {if ($truthy((mantitle = (($a = $gvars['~']) === nil ? nil : $a['$[]'](1)))['$include?']($$($nesting, 'ATTR_REF_HEAD')))) { + + return document.$sub_attributes(mantitle); + } else { + return mantitle + }; return nil; })().$downcase()]; + $send(doc_attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + } else { + + self.$logger().$error(self.$message_with_context("non-conforming manpage title", $hash2(["source_location"], {"source_location": reader.$cursor_at_line(1)}))); + + $writer = ["mantitle", ($truthy($a = ($truthy($b = doc_attrs['$[]']("doctitle")) ? $b : doc_attrs['$[]']("docname"))) ? $a : "command")]; + $send(doc_attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["manvolnum", (manvolnum = "1")]; + $send(doc_attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + }; + if ($truthy(($truthy($a = (manname = doc_attrs['$[]']("manname"))) ? doc_attrs['$[]']("manpurpose") : $a))) { + + ($truthy($a = doc_attrs['$[]']("manname-title")) ? $a : (($writer = ["manname-title", "Name"]), $send(doc_attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + + $writer = ["mannames", [manname]]; + $send(doc_attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + if (document.$backend()['$==']("manpage")) { + + + $writer = ["docname", manname]; + $send(doc_attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["outfilesuffix", "" + "." + (manvolnum)]; + $send(doc_attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];;}; + } else { + + reader.$skip_blank_lines(); + reader.$save(); + block_attributes.$update(self.$parse_block_metadata_lines(reader, document)); + if ($truthy((name_section_level = self['$is_next_line_section?'](reader, $hash2([], {}))))) { + if (name_section_level['$=='](1)) { + + name_section = self.$initialize_section(reader, document, $hash2([], {})); + name_section_buffer = $send(reader.$read_lines_until($hash2(["break_on_blank_lines", "skip_line_comments"], {"break_on_blank_lines": true, "skip_line_comments": true})), 'map', [], "lstrip".$to_proc()).$join(" "); + if ($truthy($$($nesting, 'ManpageNamePurposeRx')['$=~'](name_section_buffer))) { + + ($truthy($a = doc_attrs['$[]']("manname-title")) ? $a : (($writer = ["manname-title", name_section.$title()]), $send(doc_attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + if ($truthy(name_section.$id())) { + + $writer = ["manname-id", name_section.$id()]; + $send(doc_attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + + $writer = ["manpurpose", (($a = $gvars['~']) === nil ? nil : $a['$[]'](2))]; + $send(doc_attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + if ($truthy((manname = (($a = $gvars['~']) === nil ? nil : $a['$[]'](1)))['$include?']($$($nesting, 'ATTR_REF_HEAD')))) { + manname = document.$sub_attributes(manname)}; + if ($truthy(manname['$include?'](","))) { + manname = (mannames = $send(manname.$split(","), 'map', [], (TMP_8 = function(n){var self = TMP_8.$$s || this; + + + + if (n == null) { + n = nil; + }; + return n.$lstrip();}, TMP_8.$$s = self, TMP_8.$$arity = 1, TMP_8)))['$[]'](0) + } else { + mannames = [manname] + }; + + $writer = ["manname", manname]; + $send(doc_attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["mannames", mannames]; + $send(doc_attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + if (document.$backend()['$==']("manpage")) { + + + $writer = ["docname", manname]; + $send(doc_attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["outfilesuffix", "" + "." + (manvolnum)]; + $send(doc_attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];;}; + } else { + error_msg = "non-conforming name section body" + }; + } else { + error_msg = "name section must be at level 1" + } + } else { + error_msg = "name section expected" + }; + if ($truthy(error_msg)) { + + reader.$restore_save(); + self.$logger().$error(self.$message_with_context(error_msg, $hash2(["source_location"], {"source_location": reader.$cursor()}))); + + $writer = ["manname", (manname = ($truthy($a = doc_attrs['$[]']("docname")) ? $a : "command"))]; + $send(doc_attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["mannames", [manname]]; + $send(doc_attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + if (document.$backend()['$==']("manpage")) { + + + $writer = ["docname", manname]; + $send(doc_attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["outfilesuffix", "" + "." + (manvolnum)]; + $send(doc_attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];;}; + } else { + reader.$discard_save() + }; + }; + return nil; + }, TMP_Parser_parse_manpage_header_7.$$arity = 3); + Opal.defs(self, '$next_section', TMP_Parser_next_section_9 = function $$next_section(reader, parent, attributes) { + var $a, $b, $c, $d, self = this, preamble = nil, intro = nil, part = nil, has_header = nil, book = nil, document = nil, $writer = nil, section = nil, current_level = nil, expected_next_level = nil, expected_next_level_alt = nil, title = nil, sectname = nil, next_level = nil, expected_condition = nil, new_section = nil, block_cursor = nil, new_block = nil, first_block = nil, child_block = nil; + + + + if (attributes == null) { + attributes = $hash2([], {}); + }; + preamble = (intro = (part = false)); + if ($truthy(($truthy($a = (($b = parent.$context()['$==']("document")) ? parent.$blocks()['$empty?']() : parent.$context()['$==']("document"))) ? ($truthy($b = ($truthy($c = (has_header = parent['$has_header?']())) ? $c : attributes.$delete("invalid-header"))) ? $b : self['$is_next_line_section?'](reader, attributes)['$!']()) : $a))) { + + book = (document = parent).$doctype()['$==']("book"); + if ($truthy(($truthy($a = has_header) ? $a : ($truthy($b = book) ? attributes['$[]'](1)['$!=']("abstract") : $b)))) { + + preamble = (intro = $$($nesting, 'Block').$new(parent, "preamble", $hash2(["content_model"], {"content_model": "compound"}))); + if ($truthy(($truthy($a = book) ? parent['$attr?']("preface-title") : $a))) { + + $writer = [parent.$attr("preface-title")]; + $send(preamble, 'title=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + parent.$blocks()['$<<'](preamble);}; + section = parent; + current_level = 0; + if ($truthy(parent.$attributes()['$key?']("fragment"))) { + expected_next_level = -1 + } else if ($truthy(book)) { + $a = [1, 0], (expected_next_level = $a[0]), (expected_next_level_alt = $a[1]), $a + } else { + expected_next_level = 1 + }; + } else { + + book = (document = parent.$document()).$doctype()['$==']("book"); + section = self.$initialize_section(reader, parent, attributes); + attributes = (function() {if ($truthy((title = attributes['$[]']("title")))) { + return $hash2(["title"], {"title": title}) + } else { + return $hash2([], {}) + }; return nil; })(); + expected_next_level = $rb_plus((current_level = section.$level()), 1); + if (current_level['$=='](0)) { + part = book + } else if ($truthy((($a = current_level['$=='](1)) ? section.$special() : current_level['$=='](1)))) { + if ($truthy(($truthy($a = ($truthy($b = (sectname = section.$sectname())['$==']("appendix")) ? $b : sectname['$==']("preface"))) ? $a : sectname['$==']("abstract")))) { + } else { + expected_next_level = nil + }}; + }; + reader.$skip_blank_lines(); + while ($truthy(reader['$has_more_lines?']())) { + + self.$parse_block_metadata_lines(reader, document, attributes); + if ($truthy((next_level = self['$is_next_line_section?'](reader, attributes)))) { + + if ($truthy(document['$attr?']("leveloffset"))) { + next_level = $rb_plus(next_level, document.$attr("leveloffset").$to_i())}; + if ($truthy($rb_gt(next_level, current_level))) { + + if ($truthy(expected_next_level)) { + if ($truthy(($truthy($b = ($truthy($c = next_level['$=='](expected_next_level)) ? $c : ($truthy($d = expected_next_level_alt) ? next_level['$=='](expected_next_level_alt) : $d))) ? $b : $rb_lt(expected_next_level, 0)))) { + } else { + + expected_condition = (function() {if ($truthy(expected_next_level_alt)) { + return "" + "expected levels " + (expected_next_level_alt) + " or " + (expected_next_level) + } else { + return "" + "expected level " + (expected_next_level) + }; return nil; })(); + self.$logger().$warn(self.$message_with_context("" + "section title out of sequence: " + (expected_condition) + ", got level " + (next_level), $hash2(["source_location"], {"source_location": reader.$cursor()}))); + } + } else { + self.$logger().$error(self.$message_with_context("" + (sectname) + " sections do not support nested sections", $hash2(["source_location"], {"source_location": reader.$cursor()}))) + }; + $c = self.$next_section(reader, section, attributes), $b = Opal.to_ary($c), (new_section = ($b[0] == null ? nil : $b[0])), (attributes = ($b[1] == null ? nil : $b[1])), $c; + section.$assign_numeral(new_section); + section.$blocks()['$<<'](new_section); + } else if ($truthy((($b = next_level['$=='](0)) ? section['$=='](document) : next_level['$=='](0)))) { + + if ($truthy(book)) { + } else { + self.$logger().$error(self.$message_with_context("level 0 sections can only be used when doctype is book", $hash2(["source_location"], {"source_location": reader.$cursor()}))) + }; + $c = self.$next_section(reader, section, attributes), $b = Opal.to_ary($c), (new_section = ($b[0] == null ? nil : $b[0])), (attributes = ($b[1] == null ? nil : $b[1])), $c; + section.$assign_numeral(new_section); + section.$blocks()['$<<'](new_section); + } else { + break; + }; + } else { + + block_cursor = reader.$cursor(); + if ($truthy((new_block = self.$next_block(reader, ($truthy($b = intro) ? $b : section), attributes, $hash2(["parse_metadata"], {"parse_metadata": false}))))) { + + if ($truthy(part)) { + if ($truthy(section['$blocks?']()['$!']())) { + if ($truthy(new_block.$style()['$!=']("partintro"))) { + if (new_block.$context()['$==']("paragraph")) { + + + $writer = ["open"]; + $send(new_block, 'context=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["partintro"]; + $send(new_block, 'style=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + } else { + + + $writer = [(intro = $$($nesting, 'Block').$new(section, "open", $hash2(["content_model"], {"content_model": "compound"})))]; + $send(new_block, 'parent=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["partintro"]; + $send(intro, 'style=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + section.$blocks()['$<<'](intro); + }} + } else if (section.$blocks().$size()['$=='](1)) { + + first_block = section.$blocks()['$[]'](0); + if ($truthy(($truthy($b = intro['$!']()) ? first_block.$content_model()['$==']("compound") : $b))) { + self.$logger().$error(self.$message_with_context("illegal block content outside of partintro block", $hash2(["source_location"], {"source_location": block_cursor}))) + } else if ($truthy(first_block.$content_model()['$!=']("compound"))) { + + + $writer = [(intro = $$($nesting, 'Block').$new(section, "open", $hash2(["content_model"], {"content_model": "compound"})))]; + $send(new_block, 'parent=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["partintro"]; + $send(intro, 'style=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + section.$blocks().$shift(); + if (first_block.$style()['$==']("partintro")) { + + + $writer = ["paragraph"]; + $send(first_block, 'context=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = [nil]; + $send(first_block, 'style=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];;}; + intro['$<<'](first_block); + section.$blocks()['$<<'](intro);};}}; + ($truthy($b = intro) ? $b : section).$blocks()['$<<'](new_block); + attributes = $hash2([], {});}; + }; + if ($truthy($b = reader.$skip_blank_lines())) { + $b + } else { + break; + }; + }; + if ($truthy(part)) { + if ($truthy(($truthy($a = section['$blocks?']()) ? section.$blocks()['$[]'](-1).$context()['$==']("section") : $a))) { + } else { + self.$logger().$error(self.$message_with_context("invalid part, must have at least one section (e.g., chapter, appendix, etc.)", $hash2(["source_location"], {"source_location": reader.$cursor()}))) + } + } else if ($truthy(preamble)) { + if ($truthy(preamble['$blocks?']())) { + if ($truthy(($truthy($a = ($truthy($b = book) ? $b : document.$blocks()['$[]'](1))) ? $a : $$($nesting, 'Compliance').$unwrap_standalone_preamble()['$!']()))) { + } else { + + document.$blocks().$shift(); + while ($truthy((child_block = preamble.$blocks().$shift()))) { + document['$<<'](child_block) + }; + } + } else { + document.$blocks().$shift() + }}; + return [(function() {if ($truthy(section['$!='](parent))) { + return section + } else { + return nil + }; return nil; })(), attributes.$dup()]; + }, TMP_Parser_next_section_9.$$arity = -3); + Opal.defs(self, '$next_block', TMP_Parser_next_block_10 = function $$next_block(reader, parent, attributes, options) {try { + + var $a, $b, $c, TMP_11, $d, TMP_12, TMP_13, self = this, skipped = nil, text_only = nil, document = nil, extensions = nil, block_extensions = nil, block_macro_extensions = nil, this_line = nil, doc_attrs = nil, style = nil, block = nil, block_context = nil, cloaked_context = nil, terminator = nil, delimited_block = nil, $writer = nil, indented = nil, md_syntax = nil, ch0 = nil, layout_break_chars = nil, ll = nil, blk_ctx = nil, target = nil, blk_attrs = nil, $case = nil, posattrs = nil, scaledwidth = nil, extension = nil, content = nil, default_attrs = nil, match = nil, float_id = nil, float_reftext = nil, float_title = nil, float_level = nil, lines = nil, in_list = nil, admonition_name = nil, credit_line = nil, attribution = nil, citetitle = nil, language = nil, comma_idx = nil, block_cursor = nil, block_reader = nil, content_model = nil, pos_attrs = nil, block_id = nil; + if ($gvars["~"] == null) $gvars["~"] = nil; + + + + if (attributes == null) { + attributes = $hash2([], {}); + }; + + if (options == null) { + options = $hash2([], {}); + }; + if ($truthy((skipped = reader.$skip_blank_lines()))) { + } else { + return nil + }; + if ($truthy(($truthy($a = (text_only = options['$[]']("text"))) ? $rb_gt(skipped, 0) : $a))) { + + options.$delete("text"); + text_only = false;}; + document = parent.$document(); + if ($truthy(options.$fetch("parse_metadata", true))) { + while ($truthy(self.$parse_block_metadata_line(reader, document, attributes, options))) { + + reader.$shift(); + ($truthy($b = reader.$skip_blank_lines()) ? $b : Opal.ret(nil)); + }}; + if ($truthy((extensions = document.$extensions()))) { + $a = [extensions['$blocks?'](), extensions['$block_macros?']()], (block_extensions = $a[0]), (block_macro_extensions = $a[1]), $a}; + reader.$mark(); + $a = [reader.$read_line(), document.$attributes(), attributes['$[]'](1)], (this_line = $a[0]), (doc_attrs = $a[1]), (style = $a[2]), $a; + block = (block_context = (cloaked_context = (terminator = nil))); + if ($truthy((delimited_block = self['$is_delimited_block?'](this_line, true)))) { + + block_context = (cloaked_context = delimited_block.$context()); + terminator = delimited_block.$terminator(); + if ($truthy(style['$!']())) { + style = (($writer = ["style", block_context.$to_s()]), $send(attributes, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]) + } else if ($truthy(style['$!='](block_context.$to_s()))) { + if ($truthy(delimited_block.$masq()['$include?'](style))) { + block_context = style.$to_sym() + } else if ($truthy(($truthy($a = delimited_block.$masq()['$include?']("admonition")) ? $$($nesting, 'ADMONITION_STYLES')['$include?'](style) : $a))) { + block_context = "admonition" + } else if ($truthy(($truthy($a = block_extensions) ? extensions['$registered_for_block?'](style, block_context) : $a))) { + block_context = style.$to_sym() + } else { + + self.$logger().$warn(self.$message_with_context("" + "invalid style for " + (block_context) + " block: " + (style), $hash2(["source_location"], {"source_location": reader.$cursor_at_mark()}))); + style = block_context.$to_s(); + }};}; + if ($truthy(delimited_block)) { + } else { + while ($truthy(true)) { + + if ($truthy(($truthy($b = ($truthy($c = style) ? $$($nesting, 'Compliance').$strict_verbatim_paragraphs() : $c)) ? $$($nesting, 'VERBATIM_STYLES')['$include?'](style) : $b))) { + + block_context = style.$to_sym(); + reader.$unshift_line(this_line); + break;;}; + if ($truthy(text_only)) { + indented = this_line['$start_with?'](" ", $$($nesting, 'TAB')) + } else { + + md_syntax = $$($nesting, 'Compliance').$markdown_syntax(); + if ($truthy(this_line['$start_with?'](" "))) { + + $b = [true, " "], (indented = $b[0]), (ch0 = $b[1]), $b; + if ($truthy(($truthy($b = ($truthy($c = md_syntax) ? $send(this_line.$lstrip(), 'start_with?', Opal.to_a($$($nesting, 'MARKDOWN_THEMATIC_BREAK_CHARS').$keys())) : $c)) ? $$($nesting, 'MarkdownThematicBreakRx')['$match?'](this_line) : $b))) { + + block = $$($nesting, 'Block').$new(parent, "thematic_break", $hash2(["content_model"], {"content_model": "empty"})); + break;;}; + } else if ($truthy(this_line['$start_with?']($$($nesting, 'TAB')))) { + $b = [true, $$($nesting, 'TAB')], (indented = $b[0]), (ch0 = $b[1]), $b + } else { + + $b = [false, this_line.$chr()], (indented = $b[0]), (ch0 = $b[1]), $b; + layout_break_chars = (function() {if ($truthy(md_syntax)) { + return $$($nesting, 'HYBRID_LAYOUT_BREAK_CHARS') + } else { + return $$($nesting, 'LAYOUT_BREAK_CHARS') + }; return nil; })(); + if ($truthy(($truthy($b = layout_break_chars['$key?'](ch0)) ? (function() {if ($truthy(md_syntax)) { + + return $$($nesting, 'ExtLayoutBreakRx')['$match?'](this_line); + } else { + + return (($c = this_line['$==']($rb_times(ch0, (ll = this_line.$length())))) ? $rb_gt(ll, 2) : this_line['$==']($rb_times(ch0, (ll = this_line.$length())))); + }; return nil; })() : $b))) { + + block = $$($nesting, 'Block').$new(parent, layout_break_chars['$[]'](ch0), $hash2(["content_model"], {"content_model": "empty"})); + break;; + } else if ($truthy(($truthy($b = this_line['$end_with?']("]")) ? this_line['$include?']("::") : $b))) { + if ($truthy(($truthy($b = ($truthy($c = ch0['$==']("i")) ? $c : this_line['$start_with?']("video:", "audio:"))) ? $$($nesting, 'BlockMediaMacroRx')['$=~'](this_line) : $b))) { + + $b = [(($c = $gvars['~']) === nil ? nil : $c['$[]'](1)).$to_sym(), (($c = $gvars['~']) === nil ? nil : $c['$[]'](2)), (($c = $gvars['~']) === nil ? nil : $c['$[]'](3))], (blk_ctx = $b[0]), (target = $b[1]), (blk_attrs = $b[2]), $b; + block = $$($nesting, 'Block').$new(parent, blk_ctx, $hash2(["content_model"], {"content_model": "empty"})); + if ($truthy(blk_attrs)) { + + $case = blk_ctx; + if ("video"['$===']($case)) {posattrs = ["poster", "width", "height"]} + else if ("audio"['$===']($case)) {posattrs = []} + else {posattrs = ["alt", "width", "height"]}; + block.$parse_attributes(blk_attrs, posattrs, $hash2(["sub_input", "into"], {"sub_input": true, "into": attributes}));}; + if ($truthy(attributes['$key?']("style"))) { + attributes.$delete("style")}; + if ($truthy(($truthy($b = target['$include?']($$($nesting, 'ATTR_REF_HEAD'))) ? (target = block.$sub_attributes(target, $hash2(["attribute_missing"], {"attribute_missing": "drop-line"})))['$empty?']() : $b))) { + if (($truthy($b = doc_attrs['$[]']("attribute-missing")) ? $b : $$($nesting, 'Compliance').$attribute_missing())['$==']("skip")) { + return $$($nesting, 'Block').$new(parent, "paragraph", $hash2(["content_model", "source"], {"content_model": "simple", "source": [this_line]})) + } else { + + attributes.$clear(); + return nil; + }}; + if (blk_ctx['$==']("image")) { + + document.$register("images", [target, (($writer = ["imagesdir", doc_attrs['$[]']("imagesdir")]), $send(attributes, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])]); + ($truthy($b = attributes['$[]']("alt")) ? $b : (($writer = ["alt", ($truthy($c = style) ? $c : (($writer = ["default-alt", $$($nesting, 'Helpers').$basename(target, true).$tr("_-", " ")]), $send(attributes, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]))]), $send(attributes, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + if ($truthy((scaledwidth = attributes.$delete("scaledwidth"))['$nil_or_empty?']())) { + } else { + + $writer = ["scaledwidth", (function() {if ($truthy($$($nesting, 'TrailingDigitsRx')['$match?'](scaledwidth))) { + return "" + (scaledwidth) + "%" + } else { + return scaledwidth + }; return nil; })()]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + if ($truthy(attributes['$key?']("title"))) { + + + $writer = [attributes.$delete("title")]; + $send(block, 'title=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + block.$assign_caption(attributes.$delete("caption"), "figure");};}; + + $writer = ["target", target]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + break;; + } else if ($truthy(($truthy($b = (($c = ch0['$==']("t")) ? this_line['$start_with?']("toc:") : ch0['$==']("t"))) ? $$($nesting, 'BlockTocMacroRx')['$=~'](this_line) : $b))) { + + block = $$($nesting, 'Block').$new(parent, "toc", $hash2(["content_model"], {"content_model": "empty"})); + if ($truthy((($b = $gvars['~']) === nil ? nil : $b['$[]'](1)))) { + block.$parse_attributes((($b = $gvars['~']) === nil ? nil : $b['$[]'](1)), [], $hash2(["into"], {"into": attributes}))}; + break;; + } else if ($truthy(($truthy($b = ($truthy($c = block_macro_extensions) ? $$($nesting, 'CustomBlockMacroRx')['$=~'](this_line) : $c)) ? (extension = extensions['$registered_for_block_macro?']((($c = $gvars['~']) === nil ? nil : $c['$[]'](1)))) : $b))) { + + $b = [(($c = $gvars['~']) === nil ? nil : $c['$[]'](2)), (($c = $gvars['~']) === nil ? nil : $c['$[]'](3))], (target = $b[0]), (content = $b[1]), $b; + if ($truthy(($truthy($b = ($truthy($c = target['$include?']($$($nesting, 'ATTR_REF_HEAD'))) ? (target = parent.$sub_attributes(target))['$empty?']() : $c)) ? ($truthy($c = doc_attrs['$[]']("attribute-missing")) ? $c : $$($nesting, 'Compliance').$attribute_missing())['$==']("drop-line") : $b))) { + + attributes.$clear(); + return nil;}; + if (extension.$config()['$[]']("content_model")['$==']("attributes")) { + if ($truthy(content)) { + document.$parse_attributes(content, ($truthy($b = extension.$config()['$[]']("pos_attrs")) ? $b : []), $hash2(["sub_input", "into"], {"sub_input": true, "into": attributes}))} + } else { + + $writer = ["text", ($truthy($b = content) ? $b : "")]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + if ($truthy((default_attrs = extension.$config()['$[]']("default_attrs")))) { + $send(attributes, 'update', [default_attrs], (TMP_11 = function(_, old_v){var self = TMP_11.$$s || this; + + + + if (_ == null) { + _ = nil; + }; + + if (old_v == null) { + old_v = nil; + }; + return old_v;}, TMP_11.$$s = self, TMP_11.$$arity = 2, TMP_11))}; + if ($truthy((block = extension.$process_method()['$[]'](parent, target, attributes)))) { + + attributes.$replace(block.$attributes()); + break;; + } else { + + attributes.$clear(); + return nil; + };}}; + }; + }; + if ($truthy(($truthy($b = ($truthy($c = indented['$!']()) ? (ch0 = ($truthy($d = ch0) ? $d : this_line.$chr()))['$==']("<") : $c)) ? $$($nesting, 'CalloutListRx')['$=~'](this_line) : $b))) { + + reader.$unshift_line(this_line); + block = self.$parse_callout_list(reader, $gvars["~"], parent, document.$callouts()); + + $writer = ["style", "arabic"]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + break;; + } else if ($truthy($$($nesting, 'UnorderedListRx')['$match?'](this_line))) { + + reader.$unshift_line(this_line); + if ($truthy(($truthy($b = ($truthy($c = style['$!']()) ? $$($nesting, 'Section')['$==='](parent) : $c)) ? parent.$sectname()['$==']("bibliography") : $b))) { + + $writer = ["style", (style = "bibliography")]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + block = self.$parse_list(reader, "ulist", parent, style); + break;; + } else if ($truthy((match = $$($nesting, 'OrderedListRx').$match(this_line)))) { + + reader.$unshift_line(this_line); + block = self.$parse_list(reader, "olist", parent, style); + if ($truthy(block.$style())) { + + $writer = ["style", block.$style()]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + break;; + } else if ($truthy((match = $$($nesting, 'DescriptionListRx').$match(this_line)))) { + + reader.$unshift_line(this_line); + block = self.$parse_description_list(reader, match, parent); + break;; + } else if ($truthy(($truthy($b = ($truthy($c = style['$==']("float")) ? $c : style['$==']("discrete"))) ? (function() {if ($truthy($$($nesting, 'Compliance').$underline_style_section_titles())) { + + return self['$is_section_title?'](this_line, reader.$peek_line()); + } else { + return ($truthy($c = indented['$!']()) ? self['$atx_section_title?'](this_line) : $c) + }; return nil; })() : $b))) { + + reader.$unshift_line(this_line); + $c = self.$parse_section_title(reader, document, attributes['$[]']("id")), $b = Opal.to_ary($c), (float_id = ($b[0] == null ? nil : $b[0])), (float_reftext = ($b[1] == null ? nil : $b[1])), (float_title = ($b[2] == null ? nil : $b[2])), (float_level = ($b[3] == null ? nil : $b[3])), $c; + if ($truthy(float_reftext)) { + + $writer = ["reftext", float_reftext]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + block = $$($nesting, 'Block').$new(parent, "floating_title", $hash2(["content_model"], {"content_model": "empty"})); + + $writer = [float_title]; + $send(block, 'title=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + attributes.$delete("title"); + + $writer = [($truthy($b = float_id) ? $b : (function() {if ($truthy(doc_attrs['$key?']("sectids"))) { + + return $$($nesting, 'Section').$generate_id(block.$title(), document); + } else { + return nil + }; return nil; })())]; + $send(block, 'id=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = [float_level]; + $send(block, 'level=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + break;; + } else if ($truthy(($truthy($b = style) ? style['$!=']("normal") : $b))) { + if ($truthy($$($nesting, 'PARAGRAPH_STYLES')['$include?'](style))) { + + block_context = style.$to_sym(); + cloaked_context = "paragraph"; + reader.$unshift_line(this_line); + break;; + } else if ($truthy($$($nesting, 'ADMONITION_STYLES')['$include?'](style))) { + + block_context = "admonition"; + cloaked_context = "paragraph"; + reader.$unshift_line(this_line); + break;; + } else if ($truthy(($truthy($b = block_extensions) ? extensions['$registered_for_block?'](style, "paragraph") : $b))) { + + block_context = style.$to_sym(); + cloaked_context = "paragraph"; + reader.$unshift_line(this_line); + break;; + } else { + + self.$logger().$warn(self.$message_with_context("" + "invalid style for paragraph: " + (style), $hash2(["source_location"], {"source_location": reader.$cursor_at_mark()}))); + style = nil; + }}; + reader.$unshift_line(this_line); + if ($truthy(($truthy($b = indented) ? style['$!']() : $b))) { + + lines = self.$read_paragraph_lines(reader, ($truthy($b = (in_list = $$($nesting, 'ListItem')['$==='](parent))) ? skipped['$=='](0) : $b), $hash2(["skip_line_comments"], {"skip_line_comments": text_only})); + self['$adjust_indentation!'](lines); + block = $$($nesting, 'Block').$new(parent, "literal", $hash2(["content_model", "source", "attributes"], {"content_model": "verbatim", "source": lines, "attributes": attributes})); + if ($truthy(in_list)) { + block.$set_option("listparagraph")}; + } else { + + lines = self.$read_paragraph_lines(reader, (($b = skipped['$=='](0)) ? $$($nesting, 'ListItem')['$==='](parent) : skipped['$=='](0)), $hash2(["skip_line_comments"], {"skip_line_comments": true})); + if ($truthy(text_only)) { + + if ($truthy(($truthy($b = indented) ? style['$==']("normal") : $b))) { + self['$adjust_indentation!'](lines)}; + block = $$($nesting, 'Block').$new(parent, "paragraph", $hash2(["content_model", "source", "attributes"], {"content_model": "simple", "source": lines, "attributes": attributes})); + } else if ($truthy(($truthy($b = ($truthy($c = $$($nesting, 'ADMONITION_STYLE_HEADS')['$include?'](ch0)) ? this_line['$include?'](":") : $c)) ? $$($nesting, 'AdmonitionParagraphRx')['$=~'](this_line) : $b))) { + + + $writer = [0, (($b = $gvars['~']) === nil ? nil : $b.$post_match())]; + $send(lines, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["name", (admonition_name = (($writer = ["style", (($b = $gvars['~']) === nil ? nil : $b['$[]'](1))]), $send(attributes, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]).$downcase())]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["textlabel", ($truthy($b = attributes.$delete("caption")) ? $b : doc_attrs['$[]']("" + (admonition_name) + "-caption"))]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + block = $$($nesting, 'Block').$new(parent, "admonition", $hash2(["content_model", "source", "attributes"], {"content_model": "simple", "source": lines, "attributes": attributes})); + } else if ($truthy(($truthy($b = ($truthy($c = md_syntax) ? ch0['$=='](">") : $c)) ? this_line['$start_with?']("> ") : $b))) { + + $send(lines, 'map!', [], (TMP_12 = function(line){var self = TMP_12.$$s || this; + + + + if (line == null) { + line = nil; + }; + if (line['$=='](">")) { + + return line.$slice(1, line.$length()); + } else { + + if ($truthy(line['$start_with?']("> "))) { + + return line.$slice(2, line.$length()); + } else { + return line + }; + };}, TMP_12.$$s = self, TMP_12.$$arity = 1, TMP_12)); + if ($truthy(lines['$[]'](-1)['$start_with?']("-- "))) { + + credit_line = (credit_line = lines.$pop()).$slice(3, credit_line.$length()); + while ($truthy(lines['$[]'](-1)['$empty?']())) { + lines.$pop() + };}; + + $writer = ["style", "quote"]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + block = self.$build_block("quote", "compound", false, parent, $$($nesting, 'Reader').$new(lines), attributes); + if ($truthy(credit_line)) { + + $c = block.$apply_subs(credit_line).$split(", ", 2), $b = Opal.to_ary($c), (attribution = ($b[0] == null ? nil : $b[0])), (citetitle = ($b[1] == null ? nil : $b[1])), $c; + if ($truthy(attribution)) { + + $writer = ["attribution", attribution]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if ($truthy(citetitle)) { + + $writer = ["citetitle", citetitle]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];};}; + } else if ($truthy(($truthy($b = ($truthy($c = (($d = ch0['$==']("\"")) ? $rb_gt(lines.$size(), 1) : ch0['$==']("\""))) ? lines['$[]'](-1)['$start_with?']("-- ") : $c)) ? lines['$[]'](-2)['$end_with?']("\"") : $b))) { + + + $writer = [0, this_line.$slice(1, this_line.$length())]; + $send(lines, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + credit_line = (credit_line = lines.$pop()).$slice(3, credit_line.$length()); + while ($truthy(lines['$[]'](-1)['$empty?']())) { + lines.$pop() + }; + lines['$<<'](lines.$pop().$chop()); + + $writer = ["style", "quote"]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + block = $$($nesting, 'Block').$new(parent, "quote", $hash2(["content_model", "source", "attributes"], {"content_model": "simple", "source": lines, "attributes": attributes})); + $c = block.$apply_subs(credit_line).$split(", ", 2), $b = Opal.to_ary($c), (attribution = ($b[0] == null ? nil : $b[0])), (citetitle = ($b[1] == null ? nil : $b[1])), $c; + if ($truthy(attribution)) { + + $writer = ["attribution", attribution]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if ($truthy(citetitle)) { + + $writer = ["citetitle", citetitle]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + } else { + + if ($truthy(($truthy($b = indented) ? style['$==']("normal") : $b))) { + self['$adjust_indentation!'](lines)}; + block = $$($nesting, 'Block').$new(parent, "paragraph", $hash2(["content_model", "source", "attributes"], {"content_model": "simple", "source": lines, "attributes": attributes})); + }; + self.$catalog_inline_anchors(lines.$join($$($nesting, 'LF')), block, document, reader); + }; + break;; + } + }; + if ($truthy(block)) { + } else { + + if ($truthy(($truthy($a = block_context['$==']("abstract")) ? $a : block_context['$==']("partintro")))) { + block_context = "open"}; + $case = block_context; + if ("admonition"['$===']($case)) { + + $writer = ["name", (admonition_name = style.$downcase())]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["textlabel", ($truthy($a = attributes.$delete("caption")) ? $a : doc_attrs['$[]']("" + (admonition_name) + "-caption"))]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + block = self.$build_block(block_context, "compound", terminator, parent, reader, attributes);} + else if ("comment"['$===']($case)) { + self.$build_block(block_context, "skip", terminator, parent, reader, attributes); + attributes.$clear(); + return nil;} + else if ("example"['$===']($case)) {block = self.$build_block(block_context, "compound", terminator, parent, reader, attributes)} + else if ("listing"['$===']($case) || "literal"['$===']($case)) {block = self.$build_block(block_context, "verbatim", terminator, parent, reader, attributes)} + else if ("source"['$===']($case)) { + $$($nesting, 'AttributeList').$rekey(attributes, [nil, "language", "linenums"]); + if ($truthy(attributes['$key?']("language"))) { + } else if ($truthy(doc_attrs['$key?']("source-language"))) { + + $writer = ["language", ($truthy($a = doc_attrs['$[]']("source-language")) ? $a : "text")]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if ($truthy(attributes['$key?']("linenums"))) { + } else if ($truthy(($truthy($a = attributes['$key?']("linenums-option")) ? $a : doc_attrs['$key?']("source-linenums-option")))) { + + $writer = ["linenums", ""]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if ($truthy(attributes['$key?']("indent"))) { + } else if ($truthy(doc_attrs['$key?']("source-indent"))) { + + $writer = ["indent", doc_attrs['$[]']("source-indent")]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + block = self.$build_block("listing", "verbatim", terminator, parent, reader, attributes);} + else if ("fenced_code"['$===']($case)) { + + $writer = ["style", "source"]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + if ((ll = this_line.$length())['$=='](3)) { + language = nil + } else if ($truthy((comma_idx = (language = this_line.$slice(3, ll)).$index(",")))) { + if ($truthy($rb_gt(comma_idx, 0))) { + + language = language.$slice(0, comma_idx).$strip(); + if ($truthy($rb_lt(comma_idx, $rb_minus(ll, 4)))) { + + $writer = ["linenums", ""]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + } else { + + language = nil; + if ($truthy($rb_gt(ll, 4))) { + + $writer = ["linenums", ""]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + } + } else { + language = language.$lstrip() + }; + if ($truthy(language['$nil_or_empty?']())) { + if ($truthy(doc_attrs['$key?']("source-language"))) { + + $writer = ["language", ($truthy($a = doc_attrs['$[]']("source-language")) ? $a : "text")]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];} + } else { + + $writer = ["language", language]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + if ($truthy(attributes['$key?']("linenums"))) { + } else if ($truthy(($truthy($a = attributes['$key?']("linenums-option")) ? $a : doc_attrs['$key?']("source-linenums-option")))) { + + $writer = ["linenums", ""]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if ($truthy(attributes['$key?']("indent"))) { + } else if ($truthy(doc_attrs['$key?']("source-indent"))) { + + $writer = ["indent", doc_attrs['$[]']("source-indent")]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + terminator = terminator.$slice(0, 3); + block = self.$build_block("listing", "verbatim", terminator, parent, reader, attributes);} + else if ("pass"['$===']($case)) {block = self.$build_block(block_context, "raw", terminator, parent, reader, attributes)} + else if ("stem"['$===']($case) || "latexmath"['$===']($case) || "asciimath"['$===']($case)) { + if (block_context['$==']("stem")) { + + $writer = ["style", $$($nesting, 'STEM_TYPE_ALIASES')['$[]'](($truthy($a = attributes['$[]'](2)) ? $a : doc_attrs['$[]']("stem")))]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + block = self.$build_block("stem", "raw", terminator, parent, reader, attributes);} + else if ("open"['$===']($case) || "sidebar"['$===']($case)) {block = self.$build_block(block_context, "compound", terminator, parent, reader, attributes)} + else if ("table"['$===']($case)) { + block_cursor = reader.$cursor(); + block_reader = $$($nesting, 'Reader').$new(reader.$read_lines_until($hash2(["terminator", "skip_line_comments", "context", "cursor"], {"terminator": terminator, "skip_line_comments": true, "context": "table", "cursor": "at_mark"})), block_cursor); + if ($truthy(terminator['$start_with?']("|", "!"))) { + } else { + ($truthy($a = attributes['$[]']("format")) ? $a : (($writer = ["format", (function() {if ($truthy(terminator['$start_with?'](","))) { + return "csv" + } else { + return "dsv" + }; return nil; })()]), $send(attributes, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])) + }; + block = self.$parse_table(block_reader, parent, attributes);} + else if ("quote"['$===']($case) || "verse"['$===']($case)) { + $$($nesting, 'AttributeList').$rekey(attributes, [nil, "attribution", "citetitle"]); + block = self.$build_block(block_context, (function() {if (block_context['$==']("verse")) { + return "verbatim" + } else { + return "compound" + }; return nil; })(), terminator, parent, reader, attributes);} + else {if ($truthy(($truthy($a = block_extensions) ? (extension = extensions['$registered_for_block?'](block_context, cloaked_context)) : $a))) { + + if ($truthy((content_model = extension.$config()['$[]']("content_model"))['$!=']("skip"))) { + + if ($truthy((pos_attrs = ($truthy($a = extension.$config()['$[]']("pos_attrs")) ? $a : []))['$empty?']()['$!']())) { + $$($nesting, 'AttributeList').$rekey(attributes, [nil].$concat(pos_attrs))}; + if ($truthy((default_attrs = extension.$config()['$[]']("default_attrs")))) { + $send(default_attrs, 'each', [], (TMP_13 = function(k, v){var self = TMP_13.$$s || this, $e; + + + + if (k == null) { + k = nil; + }; + + if (v == null) { + v = nil; + }; + return ($truthy($e = attributes['$[]'](k)) ? $e : (($writer = [k, v]), $send(attributes, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]));}, TMP_13.$$s = self, TMP_13.$$arity = 2, TMP_13))}; + + $writer = ["cloaked-context", cloaked_context]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];;}; + block = self.$build_block(block_context, content_model, terminator, parent, reader, attributes, $hash2(["extension"], {"extension": extension})); + if ($truthy(block)) { + } else { + + attributes.$clear(); + return nil; + }; + } else { + self.$raise("" + "Unsupported block type " + (block_context) + " at " + (reader.$cursor())) + }}; + }; + if ($truthy(document.$sourcemap())) { + + $writer = [reader.$cursor_at_mark()]; + $send(block, 'source_location=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if ($truthy(attributes['$key?']("title"))) { + + $writer = [attributes.$delete("title")]; + $send(block, 'title=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + + $writer = [attributes['$[]']("style")]; + $send(block, 'style=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + if ($truthy((block_id = ($truthy($a = block.$id()) ? $a : (($writer = [attributes['$[]']("id")]), $send(block, 'id=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]))))) { + if ($truthy(document.$register("refs", [block_id, block, ($truthy($a = attributes['$[]']("reftext")) ? $a : (function() {if ($truthy(block['$title?']())) { + return block.$title() + } else { + return nil + }; return nil; })())]))) { + } else { + self.$logger().$warn(self.$message_with_context("" + "id assigned to block already in use: " + (block_id), $hash2(["source_location"], {"source_location": reader.$cursor_at_mark()}))) + }}; + if ($truthy(attributes['$empty?']())) { + } else { + block.$attributes().$update(attributes) + }; + block.$lock_in_subs(); + if ($truthy(block['$sub?']("callouts"))) { + if ($truthy(self.$catalog_callouts(block.$source(), document))) { + } else { + block.$remove_sub("callouts") + }}; + return block; + } catch ($returner) { if ($returner === Opal.returner) { return $returner.$v } throw $returner; } + }, TMP_Parser_next_block_10.$$arity = -3); + Opal.defs(self, '$read_paragraph_lines', TMP_Parser_read_paragraph_lines_14 = function $$read_paragraph_lines(reader, break_at_list, opts) { + var self = this, $writer = nil, break_condition = nil; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + + $writer = ["break_on_blank_lines", true]; + $send(opts, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["break_on_list_continuation", true]; + $send(opts, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["preserve_last_line", true]; + $send(opts, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + break_condition = (function() {if ($truthy(break_at_list)) { + + if ($truthy($$($nesting, 'Compliance').$block_terminates_paragraph())) { + return $$($nesting, 'StartOfBlockOrListProc') + } else { + return $$($nesting, 'StartOfListProc') + }; + } else { + + if ($truthy($$($nesting, 'Compliance').$block_terminates_paragraph())) { + return $$($nesting, 'StartOfBlockProc') + } else { + return $$($nesting, 'NoOp') + }; + }; return nil; })(); + return $send(reader, 'read_lines_until', [opts], break_condition.$to_proc()); + }, TMP_Parser_read_paragraph_lines_14.$$arity = -3); + Opal.defs(self, '$is_delimited_block?', TMP_Parser_is_delimited_block$q_15 = function(line, return_match_data) { + var $a, $b, self = this, line_len = nil, tip = nil, tl = nil, fenced_code = nil, tip_3 = nil, context = nil, masq = nil; + + + + if (return_match_data == null) { + return_match_data = false; + }; + if ($truthy(($truthy($a = $rb_gt((line_len = line.$length()), 1)) ? $$($nesting, 'DELIMITED_BLOCK_HEADS')['$include?'](line.$slice(0, 2)) : $a))) { + } else { + return nil + }; + if (line_len['$=='](2)) { + + tip = line; + tl = 2; + } else { + + if ($truthy($rb_le(line_len, 4))) { + + tip = line; + tl = line_len; + } else { + + tip = line.$slice(0, 4); + tl = 4; + }; + fenced_code = false; + if ($truthy($$($nesting, 'Compliance').$markdown_syntax())) { + + tip_3 = (function() {if (tl['$=='](4)) { + return tip.$chop() + } else { + return tip + }; return nil; })(); + if (tip_3['$==']("```")) { + + if ($truthy((($a = tl['$=='](4)) ? tip['$end_with?']("`") : tl['$=='](4)))) { + return nil}; + tip = tip_3; + tl = 3; + fenced_code = true;};}; + if ($truthy((($a = tl['$=='](3)) ? fenced_code['$!']() : tl['$=='](3)))) { + return nil}; + }; + if ($truthy($$($nesting, 'DELIMITED_BLOCKS')['$key?'](tip))) { + if ($truthy(($truthy($a = $rb_lt(tl, 4)) ? $a : tl['$=='](line_len)))) { + if ($truthy(return_match_data)) { + + $b = $$($nesting, 'DELIMITED_BLOCKS')['$[]'](tip), $a = Opal.to_ary($b), (context = ($a[0] == null ? nil : $a[0])), (masq = ($a[1] == null ? nil : $a[1])), $b; + return $$($nesting, 'BlockMatchData').$new(context, masq, tip, tip); + } else { + return true + } + } else if ((("" + (tip)) + ($rb_times(tip.$slice(-1, 1), $rb_minus(line_len, tl))))['$=='](line)) { + if ($truthy(return_match_data)) { + + $b = $$($nesting, 'DELIMITED_BLOCKS')['$[]'](tip), $a = Opal.to_ary($b), (context = ($a[0] == null ? nil : $a[0])), (masq = ($a[1] == null ? nil : $a[1])), $b; + return $$($nesting, 'BlockMatchData').$new(context, masq, tip, line); + } else { + return true + } + } else { + return nil + } + } else { + return nil + }; + }, TMP_Parser_is_delimited_block$q_15.$$arity = -2); + Opal.defs(self, '$build_block', TMP_Parser_build_block_16 = function $$build_block(block_context, content_model, terminator, parent, reader, attributes, options) { + var $a, $b, self = this, skip_processing = nil, parse_as_content_model = nil, lines = nil, block_reader = nil, block_cursor = nil, indent = nil, tab_size = nil, extension = nil, block = nil, $writer = nil; + + + + if (options == null) { + options = $hash2([], {}); + }; + if (content_model['$==']("skip")) { + $a = [true, "simple"], (skip_processing = $a[0]), (parse_as_content_model = $a[1]), $a + } else if (content_model['$==']("raw")) { + $a = [false, "simple"], (skip_processing = $a[0]), (parse_as_content_model = $a[1]), $a + } else { + $a = [false, content_model], (skip_processing = $a[0]), (parse_as_content_model = $a[1]), $a + }; + if ($truthy(terminator['$nil?']())) { + + if (parse_as_content_model['$==']("verbatim")) { + lines = reader.$read_lines_until($hash2(["break_on_blank_lines", "break_on_list_continuation"], {"break_on_blank_lines": true, "break_on_list_continuation": true})) + } else { + + if (content_model['$==']("compound")) { + content_model = "simple"}; + lines = self.$read_paragraph_lines(reader, false, $hash2(["skip_line_comments", "skip_processing"], {"skip_line_comments": true, "skip_processing": skip_processing})); + }; + block_reader = nil; + } else if ($truthy(parse_as_content_model['$!=']("compound"))) { + + lines = reader.$read_lines_until($hash2(["terminator", "skip_processing", "context", "cursor"], {"terminator": terminator, "skip_processing": skip_processing, "context": block_context, "cursor": "at_mark"})); + block_reader = nil; + } else if (terminator['$=='](false)) { + + lines = nil; + block_reader = reader; + } else { + + lines = nil; + block_cursor = reader.$cursor(); + block_reader = $$($nesting, 'Reader').$new(reader.$read_lines_until($hash2(["terminator", "skip_processing", "context", "cursor"], {"terminator": terminator, "skip_processing": skip_processing, "context": block_context, "cursor": "at_mark"})), block_cursor); + }; + if (content_model['$==']("verbatim")) { + if ($truthy((indent = attributes['$[]']("indent")))) { + self['$adjust_indentation!'](lines, indent, ($truthy($a = attributes['$[]']("tabsize")) ? $a : parent.$document().$attributes()['$[]']("tabsize"))) + } else if ($truthy($rb_gt((tab_size = ($truthy($a = attributes['$[]']("tabsize")) ? $a : parent.$document().$attributes()['$[]']("tabsize")).$to_i()), 0))) { + self['$adjust_indentation!'](lines, nil, tab_size)} + } else if (content_model['$==']("skip")) { + return nil}; + if ($truthy((extension = options['$[]']("extension")))) { + + attributes.$delete("style"); + if ($truthy((block = extension.$process_method()['$[]'](parent, ($truthy($a = block_reader) ? $a : $$($nesting, 'Reader').$new(lines)), attributes.$dup())))) { + + attributes.$replace(block.$attributes()); + if ($truthy((($a = block.$content_model()['$==']("compound")) ? (lines = block.$lines())['$nil_or_empty?']()['$!']() : block.$content_model()['$==']("compound")))) { + + content_model = "compound"; + block_reader = $$($nesting, 'Reader').$new(lines);}; + } else { + return nil + }; + } else { + block = $$($nesting, 'Block').$new(parent, block_context, $hash2(["content_model", "source", "attributes"], {"content_model": content_model, "source": lines, "attributes": attributes})) + }; + if ($truthy(($truthy($a = ($truthy($b = attributes['$key?']("title")) ? block.$context()['$!=']("admonition") : $b)) ? parent.$document().$attributes()['$key?']("" + (block.$context()) + "-caption") : $a))) { + + + $writer = [attributes.$delete("title")]; + $send(block, 'title=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + block.$assign_caption(attributes.$delete("caption"));}; + if (content_model['$==']("compound")) { + self.$parse_blocks(block_reader, block)}; + return block; + }, TMP_Parser_build_block_16.$$arity = -7); + Opal.defs(self, '$parse_blocks', TMP_Parser_parse_blocks_17 = function $$parse_blocks(reader, parent) { + var $a, $b, $c, self = this, block = nil; + + while ($truthy(($truthy($b = ($truthy($c = (block = self.$next_block(reader, parent))) ? parent.$blocks()['$<<'](block) : $c)) ? $b : reader['$has_more_lines?']()))) { + + } + }, TMP_Parser_parse_blocks_17.$$arity = 2); + Opal.defs(self, '$parse_list', TMP_Parser_parse_list_18 = function $$parse_list(reader, list_type, parent, style) { + var $a, $b, $c, self = this, list_block = nil, list_rx = nil, list_item = nil; + if ($gvars["~"] == null) $gvars["~"] = nil; + + + list_block = $$($nesting, 'List').$new(parent, list_type); + while ($truthy(($truthy($b = reader['$has_more_lines?']()) ? (list_rx = ($truthy($c = list_rx) ? $c : $$($nesting, 'ListRxMap')['$[]'](list_type)))['$=~'](reader.$peek_line()) : $b))) { + + if ($truthy((list_item = self.$parse_list_item(reader, list_block, $gvars["~"], (($b = $gvars['~']) === nil ? nil : $b['$[]'](1)), style)))) { + list_block.$items()['$<<'](list_item)}; + if ($truthy($b = reader.$skip_blank_lines())) { + $b + } else { + break; + }; + }; + return list_block; + }, TMP_Parser_parse_list_18.$$arity = 4); + Opal.defs(self, '$catalog_callouts', TMP_Parser_catalog_callouts_19 = function $$catalog_callouts(text, document) { + var TMP_20, self = this, found = nil, autonum = nil; + + + found = false; + autonum = 0; + if ($truthy(text['$include?']("<"))) { + $send(text, 'scan', [$$($nesting, 'CalloutScanRx')], (TMP_20 = function(){var self = TMP_20.$$s || this, $a, $b, captured = nil, num = nil; + + + $a = [(($b = $gvars['~']) === nil ? nil : $b['$[]'](0)), (($b = $gvars['~']) === nil ? nil : $b['$[]'](2))], (captured = $a[0]), (num = $a[1]), $a; + if ($truthy(captured['$start_with?']("\\"))) { + } else { + document.$callouts().$register((function() {if (num['$=='](".")) { + return (autonum = $rb_plus(autonum, 1)).$to_s() + } else { + return num + }; return nil; })()) + }; + return (found = true);}, TMP_20.$$s = self, TMP_20.$$arity = 0, TMP_20))}; + return found; + }, TMP_Parser_catalog_callouts_19.$$arity = 2); + Opal.defs(self, '$catalog_inline_anchor', TMP_Parser_catalog_inline_anchor_21 = function $$catalog_inline_anchor(id, reftext, node, location, doc) { + var $a, self = this; + + + + if (doc == null) { + doc = nil; + }; + doc = ($truthy($a = doc) ? $a : node.$document()); + if ($truthy(($truthy($a = reftext) ? reftext['$include?']($$($nesting, 'ATTR_REF_HEAD')) : $a))) { + reftext = doc.$sub_attributes(reftext)}; + if ($truthy(doc.$register("refs", [id, $$($nesting, 'Inline').$new(node, "anchor", reftext, $hash2(["type", "id"], {"type": "ref", "id": id})), reftext]))) { + } else { + + if ($truthy($$($nesting, 'Reader')['$==='](location))) { + location = location.$cursor()}; + self.$logger().$warn(self.$message_with_context("" + "id assigned to anchor already in use: " + (id), $hash2(["source_location"], {"source_location": location}))); + }; + return nil; + }, TMP_Parser_catalog_inline_anchor_21.$$arity = -5); + Opal.defs(self, '$catalog_inline_anchors', TMP_Parser_catalog_inline_anchors_22 = function $$catalog_inline_anchors(text, block, document, reader) { + var $a, TMP_23, self = this; + + + if ($truthy(($truthy($a = text['$include?']("[[")) ? $a : text['$include?']("or:")))) { + $send(text, 'scan', [$$($nesting, 'InlineAnchorScanRx')], (TMP_23 = function(){var self = TMP_23.$$s || this, $b, m = nil, id = nil, reftext = nil, location = nil, offset = nil; + if ($gvars["~"] == null) $gvars["~"] = nil; + + + m = $gvars["~"]; + if ($truthy((id = (($b = $gvars['~']) === nil ? nil : $b['$[]'](1))))) { + if ($truthy((reftext = (($b = $gvars['~']) === nil ? nil : $b['$[]'](2))))) { + if ($truthy(($truthy($b = reftext['$include?']($$($nesting, 'ATTR_REF_HEAD'))) ? (reftext = document.$sub_attributes(reftext))['$empty?']() : $b))) { + return nil;}} + } else { + + id = (($b = $gvars['~']) === nil ? nil : $b['$[]'](3)); + if ($truthy((reftext = (($b = $gvars['~']) === nil ? nil : $b['$[]'](4))))) { + + if ($truthy(reftext['$include?']("]"))) { + reftext = reftext.$gsub("\\]", "]")}; + if ($truthy(($truthy($b = reftext['$include?']($$($nesting, 'ATTR_REF_HEAD'))) ? (reftext = document.$sub_attributes(reftext))['$empty?']() : $b))) { + return nil;};}; + }; + if ($truthy(document.$register("refs", [id, $$($nesting, 'Inline').$new(block, "anchor", reftext, $hash2(["type", "id"], {"type": "ref", "id": id})), reftext]))) { + return nil + } else { + + location = reader.$cursor_at_mark(); + if ($truthy($rb_gt((offset = $rb_plus(m.$pre_match().$count($$($nesting, 'LF')), (function() {if ($truthy(m['$[]'](0)['$start_with?']($$($nesting, 'LF')))) { + return 1 + } else { + return 0 + }; return nil; })())), 0))) { + (location = location.$dup()).$advance(offset)}; + return self.$logger().$warn(self.$message_with_context("" + "id assigned to anchor already in use: " + (id), $hash2(["source_location"], {"source_location": location}))); + };}, TMP_23.$$s = self, TMP_23.$$arity = 0, TMP_23))}; + return nil; + }, TMP_Parser_catalog_inline_anchors_22.$$arity = 4); + Opal.defs(self, '$catalog_inline_biblio_anchor', TMP_Parser_catalog_inline_biblio_anchor_24 = function $$catalog_inline_biblio_anchor(id, reftext, node, reader) { + var $a, self = this, styled_reftext = nil; + + + if ($truthy(node.$document().$register("refs", [id, $$($nesting, 'Inline').$new(node, "anchor", (styled_reftext = "" + "[" + (($truthy($a = reftext) ? $a : id)) + "]"), $hash2(["type", "id"], {"type": "bibref", "id": id})), styled_reftext]))) { + } else { + self.$logger().$warn(self.$message_with_context("" + "id assigned to bibliography anchor already in use: " + (id), $hash2(["source_location"], {"source_location": reader.$cursor()}))) + }; + return nil; + }, TMP_Parser_catalog_inline_biblio_anchor_24.$$arity = 4); + Opal.defs(self, '$parse_description_list', TMP_Parser_parse_description_list_25 = function $$parse_description_list(reader, match, parent) { + var $a, $b, $c, self = this, list_block = nil, previous_pair = nil, sibling_pattern = nil, term = nil, item = nil, $writer = nil; + + + list_block = $$($nesting, 'List').$new(parent, "dlist"); + previous_pair = nil; + sibling_pattern = $$($nesting, 'DescriptionListSiblingRx')['$[]'](match['$[]'](2)); + while ($truthy(($truthy($b = match) ? $b : ($truthy($c = reader['$has_more_lines?']()) ? (match = sibling_pattern.$match(reader.$peek_line())) : $c)))) { + + $c = self.$parse_list_item(reader, list_block, match, sibling_pattern), $b = Opal.to_ary($c), (term = ($b[0] == null ? nil : $b[0])), (item = ($b[1] == null ? nil : $b[1])), $c; + if ($truthy(($truthy($b = previous_pair) ? previous_pair['$[]'](1)['$!']() : $b))) { + + previous_pair['$[]'](0)['$<<'](term); + + $writer = [1, item]; + $send(previous_pair, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + } else { + list_block.$items()['$<<']((previous_pair = [[term], item])) + }; + match = nil; + }; + return list_block; + }, TMP_Parser_parse_description_list_25.$$arity = 3); + Opal.defs(self, '$parse_callout_list', TMP_Parser_parse_callout_list_26 = function $$parse_callout_list(reader, match, parent, callouts) { + var $a, $b, $c, self = this, list_block = nil, next_index = nil, autonum = nil, num = nil, list_item = nil, coids = nil, $writer = nil; + + + list_block = $$($nesting, 'List').$new(parent, "colist"); + next_index = 1; + autonum = 0; + while ($truthy(($truthy($b = match) ? $b : ($truthy($c = (match = $$($nesting, 'CalloutListRx').$match(reader.$peek_line()))) ? reader.$mark() : $c)))) { + + if ((num = match['$[]'](1))['$=='](".")) { + num = (autonum = $rb_plus(autonum, 1)).$to_s()}; + if (num['$=='](next_index.$to_s())) { + } else { + self.$logger().$warn(self.$message_with_context("" + "callout list item index: expected " + (next_index) + ", got " + (num), $hash2(["source_location"], {"source_location": reader.$cursor_at_mark()}))) + }; + if ($truthy((list_item = self.$parse_list_item(reader, list_block, match, "<1>")))) { + + list_block.$items()['$<<'](list_item); + if ($truthy((coids = callouts.$callout_ids(list_block.$items().$size()))['$empty?']())) { + self.$logger().$warn(self.$message_with_context("" + "no callout found for <" + (list_block.$items().$size()) + ">", $hash2(["source_location"], {"source_location": reader.$cursor_at_mark()}))) + } else { + + $writer = ["coids", coids]; + $send(list_item.$attributes(), '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + };}; + next_index = $rb_plus(next_index, 1); + match = nil; + }; + callouts.$next_list(); + return list_block; + }, TMP_Parser_parse_callout_list_26.$$arity = 4); + Opal.defs(self, '$parse_list_item', TMP_Parser_parse_list_item_27 = function $$parse_list_item(reader, list_block, match, sibling_trait, style) { + var $a, $b, self = this, list_type = nil, dlist = nil, list_term = nil, term_text = nil, item_text = nil, has_text = nil, list_item = nil, $writer = nil, sourcemap_assignment_deferred = nil, ordinal = nil, implicit_style = nil, block_cursor = nil, list_item_reader = nil, comment_lines = nil, subsequent_line = nil, continuation_connects_first_block = nil, content_adjacent = nil, block = nil; + + + + if (style == null) { + style = nil; + }; + if ((list_type = list_block.$context())['$==']("dlist")) { + + dlist = true; + list_term = $$($nesting, 'ListItem').$new(list_block, (term_text = match['$[]'](1))); + if ($truthy(($truthy($a = term_text['$start_with?']("[[")) ? $$($nesting, 'LeadingInlineAnchorRx')['$=~'](term_text) : $a))) { + self.$catalog_inline_anchor((($a = $gvars['~']) === nil ? nil : $a['$[]'](1)), ($truthy($a = (($b = $gvars['~']) === nil ? nil : $b['$[]'](2))) ? $a : (($b = $gvars['~']) === nil ? nil : $b.$post_match()).$lstrip()), list_term, reader)}; + if ($truthy((item_text = match['$[]'](3)))) { + has_text = true}; + list_item = $$($nesting, 'ListItem').$new(list_block, item_text); + if ($truthy(list_block.$document().$sourcemap())) { + + + $writer = [reader.$cursor()]; + $send(list_term, 'source_location=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + if ($truthy(has_text)) { + + $writer = [list_term.$source_location()]; + $send(list_item, 'source_location=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + } else { + sourcemap_assignment_deferred = true + };}; + } else { + + has_text = true; + list_item = $$($nesting, 'ListItem').$new(list_block, (item_text = match['$[]'](2))); + if ($truthy(list_block.$document().$sourcemap())) { + + $writer = [reader.$cursor()]; + $send(list_item, 'source_location=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if (list_type['$==']("ulist")) { + + + $writer = [sibling_trait]; + $send(list_item, 'marker=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + if ($truthy(item_text['$start_with?']("["))) { + if ($truthy(($truthy($a = style) ? style['$==']("bibliography") : $a))) { + if ($truthy($$($nesting, 'InlineBiblioAnchorRx')['$=~'](item_text))) { + self.$catalog_inline_biblio_anchor((($a = $gvars['~']) === nil ? nil : $a['$[]'](1)), (($a = $gvars['~']) === nil ? nil : $a['$[]'](2)), list_item, reader)} + } else if ($truthy(item_text['$start_with?']("[["))) { + if ($truthy($$($nesting, 'LeadingInlineAnchorRx')['$=~'](item_text))) { + self.$catalog_inline_anchor((($a = $gvars['~']) === nil ? nil : $a['$[]'](1)), (($a = $gvars['~']) === nil ? nil : $a['$[]'](2)), list_item, reader)} + } else if ($truthy(item_text['$start_with?']("[ ] ", "[x] ", "[*] "))) { + + + $writer = ["checklist-option", ""]; + $send(list_block.$attributes(), '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["checkbox", ""]; + $send(list_item.$attributes(), '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + if ($truthy(item_text['$start_with?']("[ "))) { + } else { + + $writer = ["checked", ""]; + $send(list_item.$attributes(), '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + + $writer = [item_text.$slice(4, item_text.$length())]; + $send(list_item, 'text=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];;}}; + } else if (list_type['$==']("olist")) { + + $b = self.$resolve_ordered_list_marker(sibling_trait, (ordinal = list_block.$items().$size()), true, reader), $a = Opal.to_ary($b), (sibling_trait = ($a[0] == null ? nil : $a[0])), (implicit_style = ($a[1] == null ? nil : $a[1])), $b; + + $writer = [sibling_trait]; + $send(list_item, 'marker=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + if ($truthy((($a = ordinal['$=='](0)) ? style['$!']() : ordinal['$=='](0)))) { + + $writer = [($truthy($a = implicit_style) ? $a : ($truthy($b = $$($nesting, 'ORDERED_LIST_STYLES')['$[]']($rb_minus(sibling_trait.$length(), 1))) ? $b : "arabic").$to_s())]; + $send(list_block, 'style=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if ($truthy(($truthy($a = item_text['$start_with?']("[[")) ? $$($nesting, 'LeadingInlineAnchorRx')['$=~'](item_text) : $a))) { + self.$catalog_inline_anchor((($a = $gvars['~']) === nil ? nil : $a['$[]'](1)), (($a = $gvars['~']) === nil ? nil : $a['$[]'](2)), list_item, reader)}; + } else { + + $writer = [sibling_trait]; + $send(list_item, 'marker=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + }; + reader.$shift(); + block_cursor = reader.$cursor(); + list_item_reader = $$($nesting, 'Reader').$new(self.$read_lines_for_list_item(reader, list_type, sibling_trait, has_text), block_cursor); + if ($truthy(list_item_reader['$has_more_lines?']())) { + + if ($truthy(sourcemap_assignment_deferred)) { + + $writer = [block_cursor]; + $send(list_item, 'source_location=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + comment_lines = list_item_reader.$skip_line_comments(); + if ($truthy((subsequent_line = list_item_reader.$peek_line()))) { + + if ($truthy(comment_lines['$empty?']())) { + } else { + list_item_reader.$unshift_lines(comment_lines) + }; + if ($truthy((continuation_connects_first_block = subsequent_line['$empty?']()))) { + content_adjacent = false + } else { + + content_adjacent = true; + if ($truthy(dlist)) { + } else { + has_text = nil + }; + }; + } else { + + continuation_connects_first_block = false; + content_adjacent = false; + }; + if ($truthy((block = self.$next_block(list_item_reader, list_item, $hash2([], {}), $hash2(["text"], {"text": has_text['$!']()}))))) { + list_item.$blocks()['$<<'](block)}; + while ($truthy(list_item_reader['$has_more_lines?']())) { + if ($truthy((block = self.$next_block(list_item_reader, list_item)))) { + list_item.$blocks()['$<<'](block)} + }; + list_item.$fold_first(continuation_connects_first_block, content_adjacent);}; + if ($truthy(dlist)) { + if ($truthy(($truthy($a = list_item['$text?']()) ? $a : list_item['$blocks?']()))) { + return [list_term, list_item] + } else { + return [list_term] + } + } else { + return list_item + }; + }, TMP_Parser_parse_list_item_27.$$arity = -5); + Opal.defs(self, '$read_lines_for_list_item', TMP_Parser_read_lines_for_list_item_28 = function $$read_lines_for_list_item(reader, list_type, sibling_trait, has_text) { + var $a, $b, $c, TMP_29, TMP_30, TMP_31, TMP_32, TMP_33, self = this, buffer = nil, continuation = nil, within_nested_list = nil, detached_continuation = nil, this_line = nil, prev_line = nil, $writer = nil, match = nil, nested_list_type = nil; + + + + if (sibling_trait == null) { + sibling_trait = nil; + }; + + if (has_text == null) { + has_text = true; + }; + buffer = []; + continuation = "inactive"; + within_nested_list = false; + detached_continuation = nil; + while ($truthy(reader['$has_more_lines?']())) { + + this_line = reader.$read_line(); + if ($truthy(self['$is_sibling_list_item?'](this_line, list_type, sibling_trait))) { + break;}; + prev_line = (function() {if ($truthy(buffer['$empty?']())) { + return nil + } else { + return buffer['$[]'](-1) + }; return nil; })(); + if (prev_line['$==']($$($nesting, 'LIST_CONTINUATION'))) { + + if (continuation['$==']("inactive")) { + + continuation = "active"; + has_text = true; + if ($truthy(within_nested_list)) { + } else { + + $writer = [-1, ""]; + $send(buffer, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + };}; + if (this_line['$==']($$($nesting, 'LIST_CONTINUATION'))) { + + if ($truthy(continuation['$!=']("frozen"))) { + + continuation = "frozen"; + buffer['$<<'](this_line);}; + this_line = nil; + continue;;};}; + if ($truthy((match = self['$is_delimited_block?'](this_line, true)))) { + if (continuation['$==']("active")) { + + buffer['$<<'](this_line); + buffer.$concat(reader.$read_lines_until($hash2(["terminator", "read_last_line", "context"], {"terminator": match.$terminator(), "read_last_line": true, "context": nil}))); + continuation = "inactive"; + } else { + break; + } + } else if ($truthy(($truthy($b = (($c = list_type['$==']("dlist")) ? continuation['$!=']("active") : list_type['$==']("dlist"))) ? $$($nesting, 'BlockAttributeLineRx')['$match?'](this_line) : $b))) { + break; + } else if ($truthy((($b = continuation['$==']("active")) ? this_line['$empty?']()['$!']() : continuation['$==']("active")))) { + if ($truthy($$($nesting, 'LiteralParagraphRx')['$match?'](this_line))) { + + reader.$unshift_line(this_line); + buffer.$concat($send(reader, 'read_lines_until', [$hash2(["preserve_last_line", "break_on_blank_lines", "break_on_list_continuation"], {"preserve_last_line": true, "break_on_blank_lines": true, "break_on_list_continuation": true})], (TMP_29 = function(line){var self = TMP_29.$$s || this, $d; + + + + if (line == null) { + line = nil; + }; + return (($d = list_type['$==']("dlist")) ? self['$is_sibling_list_item?'](line, list_type, sibling_trait) : list_type['$==']("dlist"));}, TMP_29.$$s = self, TMP_29.$$arity = 1, TMP_29))); + continuation = "inactive"; + } else if ($truthy(($truthy($b = ($truthy($c = $$($nesting, 'BlockTitleRx')['$match?'](this_line)) ? $c : $$($nesting, 'BlockAttributeLineRx')['$match?'](this_line))) ? $b : $$($nesting, 'AttributeEntryRx')['$match?'](this_line)))) { + buffer['$<<'](this_line) + } else { + + if ($truthy((nested_list_type = $send((function() {if ($truthy(within_nested_list)) { + return ["dlist"] + } else { + return $$($nesting, 'NESTABLE_LIST_CONTEXTS') + }; return nil; })(), 'find', [], (TMP_30 = function(ctx){var self = TMP_30.$$s || this; + + + + if (ctx == null) { + ctx = nil; + }; + return $$($nesting, 'ListRxMap')['$[]'](ctx)['$match?'](this_line);}, TMP_30.$$s = self, TMP_30.$$arity = 1, TMP_30))))) { + + within_nested_list = true; + if ($truthy((($b = nested_list_type['$==']("dlist")) ? (($c = $gvars['~']) === nil ? nil : $c['$[]'](3))['$nil_or_empty?']() : nested_list_type['$==']("dlist")))) { + has_text = false};}; + buffer['$<<'](this_line); + continuation = "inactive"; + } + } else if ($truthy(($truthy($b = prev_line) ? prev_line['$empty?']() : $b))) { + + if ($truthy(this_line['$empty?']())) { + + if ($truthy((this_line = ($truthy($b = reader.$skip_blank_lines()) ? reader.$read_line() : $b)))) { + } else { + break; + }; + if ($truthy(self['$is_sibling_list_item?'](this_line, list_type, sibling_trait))) { + break;};}; + if (this_line['$==']($$($nesting, 'LIST_CONTINUATION'))) { + + detached_continuation = buffer.$size(); + buffer['$<<'](this_line); + } else if ($truthy(has_text)) { + if ($truthy(self['$is_sibling_list_item?'](this_line, list_type, sibling_trait))) { + break; + } else if ($truthy((nested_list_type = $send($$($nesting, 'NESTABLE_LIST_CONTEXTS'), 'find', [], (TMP_31 = function(ctx){var self = TMP_31.$$s || this; + + + + if (ctx == null) { + ctx = nil; + }; + return $$($nesting, 'ListRxMap')['$[]'](ctx)['$=~'](this_line);}, TMP_31.$$s = self, TMP_31.$$arity = 1, TMP_31))))) { + + buffer['$<<'](this_line); + within_nested_list = true; + if ($truthy((($b = nested_list_type['$==']("dlist")) ? (($c = $gvars['~']) === nil ? nil : $c['$[]'](3))['$nil_or_empty?']() : nested_list_type['$==']("dlist")))) { + has_text = false}; + } else if ($truthy($$($nesting, 'LiteralParagraphRx')['$match?'](this_line))) { + + reader.$unshift_line(this_line); + buffer.$concat($send(reader, 'read_lines_until', [$hash2(["preserve_last_line", "break_on_blank_lines", "break_on_list_continuation"], {"preserve_last_line": true, "break_on_blank_lines": true, "break_on_list_continuation": true})], (TMP_32 = function(line){var self = TMP_32.$$s || this, $d; + + + + if (line == null) { + line = nil; + }; + return (($d = list_type['$==']("dlist")) ? self['$is_sibling_list_item?'](line, list_type, sibling_trait) : list_type['$==']("dlist"));}, TMP_32.$$s = self, TMP_32.$$arity = 1, TMP_32))); + } else { + break; + } + } else { + + if ($truthy(within_nested_list)) { + } else { + buffer.$pop() + }; + buffer['$<<'](this_line); + has_text = true; + }; + } else { + + if ($truthy(this_line['$empty?']()['$!']())) { + has_text = true}; + if ($truthy((nested_list_type = $send((function() {if ($truthy(within_nested_list)) { + return ["dlist"] + } else { + return $$($nesting, 'NESTABLE_LIST_CONTEXTS') + }; return nil; })(), 'find', [], (TMP_33 = function(ctx){var self = TMP_33.$$s || this; + + + + if (ctx == null) { + ctx = nil; + }; + return $$($nesting, 'ListRxMap')['$[]'](ctx)['$=~'](this_line);}, TMP_33.$$s = self, TMP_33.$$arity = 1, TMP_33))))) { + + within_nested_list = true; + if ($truthy((($b = nested_list_type['$==']("dlist")) ? (($c = $gvars['~']) === nil ? nil : $c['$[]'](3))['$nil_or_empty?']() : nested_list_type['$==']("dlist")))) { + has_text = false};}; + buffer['$<<'](this_line); + }; + this_line = nil; + }; + if ($truthy(this_line)) { + reader.$unshift_line(this_line)}; + if ($truthy(detached_continuation)) { + buffer.$delete_at(detached_continuation)}; + while ($truthy(($truthy($b = buffer['$empty?']()['$!']()) ? buffer['$[]'](-1)['$empty?']() : $b))) { + buffer.$pop() + }; + if ($truthy(($truthy($a = buffer['$empty?']()['$!']()) ? buffer['$[]'](-1)['$==']($$($nesting, 'LIST_CONTINUATION')) : $a))) { + buffer.$pop()}; + return buffer; + }, TMP_Parser_read_lines_for_list_item_28.$$arity = -3); + Opal.defs(self, '$initialize_section', TMP_Parser_initialize_section_34 = function $$initialize_section(reader, parent, attributes) { + var $a, $b, self = this, document = nil, book = nil, doctype = nil, source_location = nil, sect_style = nil, sect_id = nil, sect_reftext = nil, sect_title = nil, sect_level = nil, sect_atx = nil, $writer = nil, sect_name = nil, sect_special = nil, sect_numbered = nil, section = nil, id = nil; + + + + if (attributes == null) { + attributes = $hash2([], {}); + }; + document = parent.$document(); + book = (doctype = document.$doctype())['$==']("book"); + if ($truthy(document.$sourcemap())) { + source_location = reader.$cursor()}; + sect_style = attributes['$[]'](1); + $b = self.$parse_section_title(reader, document, attributes['$[]']("id")), $a = Opal.to_ary($b), (sect_id = ($a[0] == null ? nil : $a[0])), (sect_reftext = ($a[1] == null ? nil : $a[1])), (sect_title = ($a[2] == null ? nil : $a[2])), (sect_level = ($a[3] == null ? nil : $a[3])), (sect_atx = ($a[4] == null ? nil : $a[4])), $b; + if ($truthy(sect_reftext)) { + + $writer = ["reftext", sect_reftext]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + } else { + sect_reftext = attributes['$[]']("reftext") + }; + if ($truthy(sect_style)) { + if ($truthy(($truthy($a = book) ? sect_style['$==']("abstract") : $a))) { + $a = ["chapter", 1], (sect_name = $a[0]), (sect_level = $a[1]), $a + } else { + + $a = [sect_style, true], (sect_name = $a[0]), (sect_special = $a[1]), $a; + if (sect_level['$=='](0)) { + sect_level = 1}; + sect_numbered = sect_style['$==']("appendix"); + } + } else if ($truthy(book)) { + sect_name = (function() {if (sect_level['$=='](0)) { + return "part" + } else { + + if ($truthy($rb_gt(sect_level, 1))) { + return "section" + } else { + return "chapter" + }; + }; return nil; })() + } else if ($truthy((($a = doctype['$==']("manpage")) ? sect_title.$casecmp("synopsis")['$=='](0) : doctype['$==']("manpage")))) { + $a = ["synopsis", true], (sect_name = $a[0]), (sect_special = $a[1]), $a + } else { + sect_name = "section" + }; + section = $$($nesting, 'Section').$new(parent, sect_level); + $a = [sect_id, sect_title, sect_name, source_location], section['$id=']($a[0]), section['$title=']($a[1]), section['$sectname=']($a[2]), section['$source_location=']($a[3]), $a; + if ($truthy(sect_special)) { + + + $writer = [true]; + $send(section, 'special=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + if ($truthy(sect_numbered)) { + + $writer = [true]; + $send(section, 'numbered=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + } else if (document.$attributes()['$[]']("sectnums")['$==']("all")) { + + $writer = [(function() {if ($truthy(($truthy($a = book) ? sect_level['$=='](1) : $a))) { + return "chapter" + } else { + return true + }; return nil; })()]; + $send(section, 'numbered=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + } else if ($truthy(($truthy($a = document.$attributes()['$[]']("sectnums")) ? $rb_gt(sect_level, 0) : $a))) { + + $writer = [(function() {if ($truthy(section.$special())) { + return ($truthy($a = parent.$numbered()) ? true : $a) + } else { + return true + }; return nil; })()]; + $send(section, 'numbered=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + } else if ($truthy(($truthy($a = ($truthy($b = book) ? sect_level['$=='](0) : $b)) ? document.$attributes()['$[]']("partnums") : $a))) { + + $writer = [true]; + $send(section, 'numbered=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if ($truthy((id = ($truthy($a = section.$id()) ? $a : (($writer = [(function() {if ($truthy(document.$attributes()['$key?']("sectids"))) { + + return $$($nesting, 'Section').$generate_id(section.$title(), document); + } else { + return nil + }; return nil; })()]), $send(section, 'id=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]))))) { + if ($truthy(document.$register("refs", [id, section, ($truthy($a = sect_reftext) ? $a : section.$title())]))) { + } else { + self.$logger().$warn(self.$message_with_context("" + "id assigned to section already in use: " + (id), $hash2(["source_location"], {"source_location": reader.$cursor_at_line($rb_minus(reader.$lineno(), (function() {if ($truthy(sect_atx)) { + return 1 + } else { + return 2 + }; return nil; })()))}))) + }}; + section.$update_attributes(attributes); + reader.$skip_blank_lines(); + return section; + }, TMP_Parser_initialize_section_34.$$arity = -3); + Opal.defs(self, '$is_next_line_section?', TMP_Parser_is_next_line_section$q_35 = function(reader, attributes) { + var $a, $b, self = this, style = nil, next_lines = nil; + + if ($truthy(($truthy($a = (style = attributes['$[]'](1))) ? ($truthy($b = style['$==']("discrete")) ? $b : style['$==']("float")) : $a))) { + return nil + } else if ($truthy($$($nesting, 'Compliance').$underline_style_section_titles())) { + + next_lines = reader.$peek_lines(2, ($truthy($a = style) ? style['$==']("comment") : $a)); + return self['$is_section_title?'](($truthy($a = next_lines['$[]'](0)) ? $a : ""), next_lines['$[]'](1)); + } else { + return self['$atx_section_title?'](($truthy($a = reader.$peek_line()) ? $a : "")) + } + }, TMP_Parser_is_next_line_section$q_35.$$arity = 2); + Opal.defs(self, '$is_next_line_doctitle?', TMP_Parser_is_next_line_doctitle$q_36 = function(reader, attributes, leveloffset) { + var $a, self = this, sect_level = nil; + + if ($truthy(leveloffset)) { + return ($truthy($a = (sect_level = self['$is_next_line_section?'](reader, attributes))) ? $rb_plus(sect_level, leveloffset.$to_i())['$=='](0) : $a) + } else { + return self['$is_next_line_section?'](reader, attributes)['$=='](0) + } + }, TMP_Parser_is_next_line_doctitle$q_36.$$arity = 3); + Opal.defs(self, '$is_section_title?', TMP_Parser_is_section_title$q_37 = function(line1, line2) { + var $a, self = this; + + + + if (line2 == null) { + line2 = nil; + }; + return ($truthy($a = self['$atx_section_title?'](line1)) ? $a : (function() {if ($truthy(line2['$nil_or_empty?']())) { + return nil + } else { + return self['$setext_section_title?'](line1, line2) + }; return nil; })()); + }, TMP_Parser_is_section_title$q_37.$$arity = -2); + Opal.defs(self, '$atx_section_title?', TMP_Parser_atx_section_title$q_38 = function(line) { + var $a, self = this; + + if ($truthy((function() {if ($truthy($$($nesting, 'Compliance').$markdown_syntax())) { + + return ($truthy($a = line['$start_with?']("=", "#")) ? $$($nesting, 'ExtAtxSectionTitleRx')['$=~'](line) : $a); + } else { + + return ($truthy($a = line['$start_with?']("=")) ? $$($nesting, 'AtxSectionTitleRx')['$=~'](line) : $a); + }; return nil; })())) { + return $rb_minus((($a = $gvars['~']) === nil ? nil : $a['$[]'](1)).$length(), 1) + } else { + return nil + } + }, TMP_Parser_atx_section_title$q_38.$$arity = 1); + Opal.defs(self, '$setext_section_title?', TMP_Parser_setext_section_title$q_39 = function(line1, line2) { + var $a, $b, $c, self = this, level = nil, line2_ch1 = nil, line2_len = nil; + + if ($truthy(($truthy($a = ($truthy($b = ($truthy($c = (level = $$($nesting, 'SETEXT_SECTION_LEVELS')['$[]']((line2_ch1 = line2.$chr())))) ? $rb_times(line2_ch1, (line2_len = line2.$length()))['$=='](line2) : $c)) ? $$($nesting, 'SetextSectionTitleRx')['$match?'](line1) : $b)) ? $rb_lt($rb_minus(self.$line_length(line1), line2_len).$abs(), 2) : $a))) { + return level + } else { + return nil + } + }, TMP_Parser_setext_section_title$q_39.$$arity = 2); + Opal.defs(self, '$parse_section_title', TMP_Parser_parse_section_title_40 = function $$parse_section_title(reader, document, sect_id) { + var $a, $b, $c, $d, $e, self = this, sect_reftext = nil, line1 = nil, sect_level = nil, sect_title = nil, atx = nil, line2 = nil, line2_ch1 = nil, line2_len = nil; + + + + if (sect_id == null) { + sect_id = nil; + }; + sect_reftext = nil; + line1 = reader.$read_line(); + if ($truthy((function() {if ($truthy($$($nesting, 'Compliance').$markdown_syntax())) { + + return ($truthy($a = line1['$start_with?']("=", "#")) ? $$($nesting, 'ExtAtxSectionTitleRx')['$=~'](line1) : $a); + } else { + + return ($truthy($a = line1['$start_with?']("=")) ? $$($nesting, 'AtxSectionTitleRx')['$=~'](line1) : $a); + }; return nil; })())) { + + $a = [$rb_minus((($b = $gvars['~']) === nil ? nil : $b['$[]'](1)).$length(), 1), (($b = $gvars['~']) === nil ? nil : $b['$[]'](2)), true], (sect_level = $a[0]), (sect_title = $a[1]), (atx = $a[2]), $a; + if ($truthy(sect_id)) { + } else if ($truthy(($truthy($a = ($truthy($b = sect_title['$end_with?']("]]")) ? $$($nesting, 'InlineSectionAnchorRx')['$=~'](sect_title) : $b)) ? (($b = $gvars['~']) === nil ? nil : $b['$[]'](1))['$!']() : $a))) { + $a = [sect_title.$slice(0, $rb_minus(sect_title.$length(), (($b = $gvars['~']) === nil ? nil : $b['$[]'](0)).$length())), (($b = $gvars['~']) === nil ? nil : $b['$[]'](2)), (($b = $gvars['~']) === nil ? nil : $b['$[]'](3))], (sect_title = $a[0]), (sect_id = $a[1]), (sect_reftext = $a[2]), $a}; + } else if ($truthy(($truthy($a = ($truthy($b = ($truthy($c = ($truthy($d = ($truthy($e = $$($nesting, 'Compliance').$underline_style_section_titles()) ? (line2 = reader.$peek_line(true)) : $e)) ? (sect_level = $$($nesting, 'SETEXT_SECTION_LEVELS')['$[]']((line2_ch1 = line2.$chr()))) : $d)) ? $rb_times(line2_ch1, (line2_len = line2.$length()))['$=='](line2) : $c)) ? (sect_title = ($truthy($c = $$($nesting, 'SetextSectionTitleRx')['$=~'](line1)) ? (($d = $gvars['~']) === nil ? nil : $d['$[]'](1)) : $c)) : $b)) ? $rb_lt($rb_minus(self.$line_length(line1), line2_len).$abs(), 2) : $a))) { + + atx = false; + if ($truthy(sect_id)) { + } else if ($truthy(($truthy($a = ($truthy($b = sect_title['$end_with?']("]]")) ? $$($nesting, 'InlineSectionAnchorRx')['$=~'](sect_title) : $b)) ? (($b = $gvars['~']) === nil ? nil : $b['$[]'](1))['$!']() : $a))) { + $a = [sect_title.$slice(0, $rb_minus(sect_title.$length(), (($b = $gvars['~']) === nil ? nil : $b['$[]'](0)).$length())), (($b = $gvars['~']) === nil ? nil : $b['$[]'](2)), (($b = $gvars['~']) === nil ? nil : $b['$[]'](3))], (sect_title = $a[0]), (sect_id = $a[1]), (sect_reftext = $a[2]), $a}; + reader.$shift(); + } else { + self.$raise("" + "Unrecognized section at " + (reader.$cursor_at_prev_line())) + }; + if ($truthy(document['$attr?']("leveloffset"))) { + sect_level = $rb_plus(sect_level, document.$attr("leveloffset").$to_i())}; + return [sect_id, sect_reftext, sect_title, sect_level, atx]; + }, TMP_Parser_parse_section_title_40.$$arity = -3); + if ($truthy($$($nesting, 'FORCE_UNICODE_LINE_LENGTH'))) { + Opal.defs(self, '$line_length', TMP_Parser_line_length_41 = function $$line_length(line) { + var self = this; + + return line.$scan($$($nesting, 'UnicodeCharScanRx')).$size() + }, TMP_Parser_line_length_41.$$arity = 1) + } else { + Opal.defs(self, '$line_length', TMP_Parser_line_length_42 = function $$line_length(line) { + var self = this; + + return line.$length() + }, TMP_Parser_line_length_42.$$arity = 1) + }; + Opal.defs(self, '$parse_header_metadata', TMP_Parser_parse_header_metadata_43 = function $$parse_header_metadata(reader, document) { + var $a, TMP_44, TMP_45, TMP_46, self = this, doc_attrs = nil, implicit_authors = nil, metadata = nil, implicit_author = nil, implicit_authorinitials = nil, author_metadata = nil, rev_metadata = nil, rev_line = nil, match = nil, $writer = nil, component = nil, author_line = nil, authors = nil, author_idx = nil, author_key = nil, explicit = nil, sparse = nil, author_override = nil; + + + + if (document == null) { + document = nil; + }; + doc_attrs = ($truthy($a = document) ? document.$attributes() : $a); + self.$process_attribute_entries(reader, document); + $a = [(implicit_authors = $hash2([], {})), nil, nil], (metadata = $a[0]), (implicit_author = $a[1]), (implicit_authorinitials = $a[2]), $a; + if ($truthy(($truthy($a = reader['$has_more_lines?']()) ? reader['$next_line_empty?']()['$!']() : $a))) { + + if ($truthy((author_metadata = self.$process_authors(reader.$read_line()))['$empty?']())) { + } else { + + if ($truthy(document)) { + + $send(author_metadata, 'each', [], (TMP_44 = function(key, val){var self = TMP_44.$$s || this, $writer = nil; + + + + if (key == null) { + key = nil; + }; + + if (val == null) { + val = nil; + }; + if ($truthy(doc_attrs['$key?'](key))) { + return nil + } else { + + $writer = [key, (function() {if ($truthy($$$('::', 'String')['$==='](val))) { + + return document.$apply_header_subs(val); + } else { + return val + }; return nil; })()]; + $send(doc_attrs, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + };}, TMP_44.$$s = self, TMP_44.$$arity = 2, TMP_44)); + implicit_author = doc_attrs['$[]']("author"); + implicit_authorinitials = doc_attrs['$[]']("authorinitials"); + implicit_authors = doc_attrs['$[]']("authors");}; + metadata = author_metadata; + }; + self.$process_attribute_entries(reader, document); + rev_metadata = $hash2([], {}); + if ($truthy(($truthy($a = reader['$has_more_lines?']()) ? reader['$next_line_empty?']()['$!']() : $a))) { + + rev_line = reader.$read_line(); + if ($truthy((match = $$($nesting, 'RevisionInfoLineRx').$match(rev_line)))) { + + if ($truthy(match['$[]'](1))) { + + $writer = ["revnumber", match['$[]'](1).$rstrip()]; + $send(rev_metadata, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if ($truthy((component = match['$[]'](2).$strip())['$empty?']())) { + } else if ($truthy(($truthy($a = match['$[]'](1)['$!']()) ? component['$start_with?']("v") : $a))) { + + $writer = ["revnumber", component.$slice(1, component.$length())]; + $send(rev_metadata, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + } else { + + $writer = ["revdate", component]; + $send(rev_metadata, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + if ($truthy(match['$[]'](3))) { + + $writer = ["revremark", match['$[]'](3).$rstrip()]; + $send(rev_metadata, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + } else { + reader.$unshift_line(rev_line) + };}; + if ($truthy(rev_metadata['$empty?']())) { + } else { + + if ($truthy(document)) { + $send(rev_metadata, 'each', [], (TMP_45 = function(key, val){var self = TMP_45.$$s || this; + + + + if (key == null) { + key = nil; + }; + + if (val == null) { + val = nil; + }; + if ($truthy(doc_attrs['$key?'](key))) { + return nil + } else { + + $writer = [key, document.$apply_header_subs(val)]; + $send(doc_attrs, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + };}, TMP_45.$$s = self, TMP_45.$$arity = 2, TMP_45))}; + metadata.$update(rev_metadata); + }; + self.$process_attribute_entries(reader, document); + reader.$skip_blank_lines(); + } else { + author_metadata = $hash2([], {}) + }; + if ($truthy(document)) { + + if ($truthy(($truthy($a = doc_attrs['$key?']("author")) ? (author_line = doc_attrs['$[]']("author"))['$!='](implicit_author) : $a))) { + + author_metadata = self.$process_authors(author_line, true, false); + if ($truthy(doc_attrs['$[]']("authorinitials")['$!='](implicit_authorinitials))) { + author_metadata.$delete("authorinitials")}; + } else if ($truthy(($truthy($a = doc_attrs['$key?']("authors")) ? (author_line = doc_attrs['$[]']("authors"))['$!='](implicit_authors) : $a))) { + author_metadata = self.$process_authors(author_line, true) + } else { + + $a = [[], 1, "author_1", false, false], (authors = $a[0]), (author_idx = $a[1]), (author_key = $a[2]), (explicit = $a[3]), (sparse = $a[4]), $a; + while ($truthy(doc_attrs['$key?'](author_key))) { + + if ((author_override = doc_attrs['$[]'](author_key))['$=='](author_metadata['$[]'](author_key))) { + + authors['$<<'](nil); + sparse = true; + } else { + + authors['$<<'](author_override); + explicit = true; + }; + author_key = "" + "author_" + ((author_idx = $rb_plus(author_idx, 1))); + }; + if ($truthy(explicit)) { + + if ($truthy(sparse)) { + $send(authors, 'each_with_index', [], (TMP_46 = function(author, idx){var self = TMP_46.$$s || this, TMP_47, name_idx = nil; + + + + if (author == null) { + author = nil; + }; + + if (idx == null) { + idx = nil; + }; + if ($truthy(author)) { + return nil + } else { + + $writer = [idx, $send([author_metadata['$[]']("" + "firstname_" + ((name_idx = $rb_plus(idx, 1)))), author_metadata['$[]']("" + "middlename_" + (name_idx)), author_metadata['$[]']("" + "lastname_" + (name_idx))].$compact(), 'map', [], (TMP_47 = function(it){var self = TMP_47.$$s || this; + + + + if (it == null) { + it = nil; + }; + return it.$tr(" ", "_");}, TMP_47.$$s = self, TMP_47.$$arity = 1, TMP_47)).$join(" ")]; + $send(authors, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + };}, TMP_46.$$s = self, TMP_46.$$arity = 2, TMP_46))}; + author_metadata = self.$process_authors(authors, true, false); + } else { + author_metadata = $hash2([], {}) + }; + }; + if ($truthy(author_metadata['$empty?']())) { + ($truthy($a = metadata['$[]']("authorcount")) ? $a : (($writer = ["authorcount", (($writer = ["authorcount", 0]), $send(doc_attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])]), $send(metadata, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])) + } else { + + doc_attrs.$update(author_metadata); + if ($truthy(($truthy($a = doc_attrs['$key?']("email")['$!']()) ? doc_attrs['$key?']("email_1") : $a))) { + + $writer = ["email", doc_attrs['$[]']("email_1")]; + $send(doc_attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + };}; + return metadata; + }, TMP_Parser_parse_header_metadata_43.$$arity = -2); + Opal.defs(self, '$process_authors', TMP_Parser_process_authors_48 = function $$process_authors(author_line, names_only, multiple) { + var TMP_49, TMP_50, self = this, author_metadata = nil, author_idx = nil, keys = nil, author_entries = nil, $writer = nil; + + + + if (names_only == null) { + names_only = false; + }; + + if (multiple == null) { + multiple = true; + }; + author_metadata = $hash2([], {}); + author_idx = 0; + keys = ["author", "authorinitials", "firstname", "middlename", "lastname", "email"]; + author_entries = (function() {if ($truthy(multiple)) { + return $send(author_line.$split(";"), 'map', [], (TMP_49 = function(it){var self = TMP_49.$$s || this; + + + + if (it == null) { + it = nil; + }; + return it.$strip();}, TMP_49.$$s = self, TMP_49.$$arity = 1, TMP_49)) + } else { + return self.$Array(author_line) + }; return nil; })(); + $send(author_entries, 'each', [], (TMP_50 = function(author_entry){var self = TMP_50.$$s || this, TMP_51, TMP_52, $a, TMP_53, key_map = nil, $writer = nil, segments = nil, match = nil, author = nil, fname = nil, mname = nil, lname = nil; + + + + if (author_entry == null) { + author_entry = nil; + }; + if ($truthy(author_entry['$empty?']())) { + return nil;}; + author_idx = $rb_plus(author_idx, 1); + key_map = $hash2([], {}); + if (author_idx['$=='](1)) { + $send(keys, 'each', [], (TMP_51 = function(key){var self = TMP_51.$$s || this, $writer = nil; + + + + if (key == null) { + key = nil; + }; + $writer = [key.$to_sym(), key]; + $send(key_map, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];}, TMP_51.$$s = self, TMP_51.$$arity = 1, TMP_51)) + } else { + $send(keys, 'each', [], (TMP_52 = function(key){var self = TMP_52.$$s || this, $writer = nil; + + + + if (key == null) { + key = nil; + }; + $writer = [key.$to_sym(), "" + (key) + "_" + (author_idx)]; + $send(key_map, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];}, TMP_52.$$s = self, TMP_52.$$arity = 1, TMP_52)) + }; + if ($truthy(names_only)) { + + if ($truthy(author_entry['$include?']("<"))) { + + + $writer = [key_map['$[]']("author"), author_entry.$tr("_", " ")]; + $send(author_metadata, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + author_entry = author_entry.$gsub($$($nesting, 'XmlSanitizeRx'), "");}; + if ((segments = author_entry.$split(nil, 3)).$size()['$=='](3)) { + segments['$<<'](segments.$pop().$squeeze(" "))}; + } else if ($truthy((match = $$($nesting, 'AuthorInfoLineRx').$match(author_entry)))) { + (segments = match.$to_a()).$shift()}; + if ($truthy(segments)) { + + author = (($writer = [key_map['$[]']("firstname"), (fname = segments['$[]'](0).$tr("_", " "))]), $send(author_metadata, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]); + + $writer = [key_map['$[]']("authorinitials"), fname.$chr()]; + $send(author_metadata, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + if ($truthy(segments['$[]'](1))) { + if ($truthy(segments['$[]'](2))) { + + + $writer = [key_map['$[]']("middlename"), (mname = segments['$[]'](1).$tr("_", " "))]; + $send(author_metadata, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = [key_map['$[]']("lastname"), (lname = segments['$[]'](2).$tr("_", " "))]; + $send(author_metadata, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + author = $rb_plus($rb_plus($rb_plus($rb_plus(fname, " "), mname), " "), lname); + + $writer = [key_map['$[]']("authorinitials"), "" + (fname.$chr()) + (mname.$chr()) + (lname.$chr())]; + $send(author_metadata, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + } else { + + + $writer = [key_map['$[]']("lastname"), (lname = segments['$[]'](1).$tr("_", " "))]; + $send(author_metadata, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + author = $rb_plus($rb_plus(fname, " "), lname); + + $writer = [key_map['$[]']("authorinitials"), "" + (fname.$chr()) + (lname.$chr())]; + $send(author_metadata, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + }}; + ($truthy($a = author_metadata['$[]'](key_map['$[]']("author"))) ? $a : (($writer = [key_map['$[]']("author"), author]), $send(author_metadata, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + if ($truthy(($truthy($a = names_only) ? $a : segments['$[]'](3)['$!']()))) { + } else { + + $writer = [key_map['$[]']("email"), segments['$[]'](3)]; + $send(author_metadata, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + } else { + + + $writer = [key_map['$[]']("author"), (($writer = [key_map['$[]']("firstname"), (fname = author_entry.$squeeze(" ").$strip())]), $send(author_metadata, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])]; + $send(author_metadata, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = [key_map['$[]']("authorinitials"), fname.$chr()]; + $send(author_metadata, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + }; + if (author_idx['$=='](1)) { + + $writer = ["authors", author_metadata['$[]'](key_map['$[]']("author"))]; + $send(author_metadata, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + } else { + + if (author_idx['$=='](2)) { + $send(keys, 'each', [], (TMP_53 = function(key){var self = TMP_53.$$s || this; + + + + if (key == null) { + key = nil; + }; + if ($truthy(author_metadata['$key?'](key))) { + + $writer = ["" + (key) + "_1", author_metadata['$[]'](key)]; + $send(author_metadata, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + } else { + return nil + };}, TMP_53.$$s = self, TMP_53.$$arity = 1, TMP_53))}; + + $writer = ["authors", "" + (author_metadata['$[]']("authors")) + ", " + (author_metadata['$[]'](key_map['$[]']("author")))]; + $send(author_metadata, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];; + };}, TMP_50.$$s = self, TMP_50.$$arity = 1, TMP_50)); + + $writer = ["authorcount", author_idx]; + $send(author_metadata, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + return author_metadata; + }, TMP_Parser_process_authors_48.$$arity = -2); + Opal.defs(self, '$parse_block_metadata_lines', TMP_Parser_parse_block_metadata_lines_54 = function $$parse_block_metadata_lines(reader, document, attributes, options) { + var $a, $b, self = this; + + + + if (attributes == null) { + attributes = $hash2([], {}); + }; + + if (options == null) { + options = $hash2([], {}); + }; + while ($truthy(self.$parse_block_metadata_line(reader, document, attributes, options))) { + + reader.$shift(); + if ($truthy($b = reader.$skip_blank_lines())) { + $b + } else { + break; + }; + }; + return attributes; + }, TMP_Parser_parse_block_metadata_lines_54.$$arity = -3); + Opal.defs(self, '$parse_block_metadata_line', TMP_Parser_parse_block_metadata_line_55 = function $$parse_block_metadata_line(reader, document, attributes, options) { + var $a, $b, self = this, next_line = nil, normal = nil, $writer = nil, reftext = nil, current_style = nil, ll = nil; + if ($gvars["~"] == null) $gvars["~"] = nil; + + + + if (options == null) { + options = $hash2([], {}); + }; + if ($truthy(($truthy($a = (next_line = reader.$peek_line())) ? (function() {if ($truthy(options['$[]']("text"))) { + + return next_line['$start_with?']("[", "/"); + } else { + + return (normal = next_line['$start_with?']("[", ".", "/", ":")); + }; return nil; })() : $a))) { + if ($truthy(next_line['$start_with?']("["))) { + if ($truthy(next_line['$start_with?']("[["))) { + if ($truthy(($truthy($a = next_line['$end_with?']("]]")) ? $$($nesting, 'BlockAnchorRx')['$=~'](next_line) : $a))) { + + + $writer = ["id", (($a = $gvars['~']) === nil ? nil : $a['$[]'](1))]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + if ($truthy((reftext = (($a = $gvars['~']) === nil ? nil : $a['$[]'](2))))) { + + $writer = ["reftext", (function() {if ($truthy(reftext['$include?']($$($nesting, 'ATTR_REF_HEAD')))) { + + return document.$sub_attributes(reftext); + } else { + return reftext + }; return nil; })()]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + return true; + } else { + return nil + } + } else if ($truthy(($truthy($a = next_line['$end_with?']("]")) ? $$($nesting, 'BlockAttributeListRx')['$=~'](next_line) : $a))) { + + current_style = attributes['$[]'](1); + if ($truthy(document.$parse_attributes((($a = $gvars['~']) === nil ? nil : $a['$[]'](1)), [], $hash2(["sub_input", "sub_result", "into"], {"sub_input": true, "sub_result": true, "into": attributes}))['$[]'](1))) { + + $writer = [1, ($truthy($a = self.$parse_style_attribute(attributes, reader)) ? $a : current_style)]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + return true; + } else { + return nil + } + } else if ($truthy(($truthy($a = normal) ? next_line['$start_with?'](".") : $a))) { + if ($truthy($$($nesting, 'BlockTitleRx')['$=~'](next_line))) { + + + $writer = ["title", (($a = $gvars['~']) === nil ? nil : $a['$[]'](1))]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + return true; + } else { + return nil + } + } else if ($truthy(($truthy($a = normal['$!']()) ? $a : next_line['$start_with?']("/")))) { + if ($truthy(next_line['$start_with?']("//"))) { + if (next_line['$==']("//")) { + return true + } else if ($truthy(($truthy($a = normal) ? $rb_times("/", (ll = next_line.$length()))['$=='](next_line) : $a))) { + if (ll['$=='](3)) { + return nil + } else { + + reader.$read_lines_until($hash2(["terminator", "skip_first_line", "preserve_last_line", "skip_processing", "context"], {"terminator": next_line, "skip_first_line": true, "preserve_last_line": true, "skip_processing": true, "context": "comment"})); + return true; + } + } else if ($truthy(next_line['$start_with?']("///"))) { + return nil + } else { + return true + } + } else { + return nil + } + } else if ($truthy(($truthy($a = ($truthy($b = normal) ? next_line['$start_with?'](":") : $b)) ? $$($nesting, 'AttributeEntryRx')['$=~'](next_line) : $a))) { + + self.$process_attribute_entry(reader, document, attributes, $gvars["~"]); + return true; + } else { + return nil + } + } else { + return nil + }; + }, TMP_Parser_parse_block_metadata_line_55.$$arity = -4); + Opal.defs(self, '$process_attribute_entries', TMP_Parser_process_attribute_entries_56 = function $$process_attribute_entries(reader, document, attributes) { + var $a, self = this; + + + + if (attributes == null) { + attributes = nil; + }; + reader.$skip_comment_lines(); + while ($truthy(self.$process_attribute_entry(reader, document, attributes))) { + + reader.$shift(); + reader.$skip_comment_lines(); + }; + }, TMP_Parser_process_attribute_entries_56.$$arity = -3); + Opal.defs(self, '$process_attribute_entry', TMP_Parser_process_attribute_entry_57 = function $$process_attribute_entry(reader, document, attributes, match) { + var $a, $b, $c, self = this, value = nil, con = nil, next_line = nil, keep_open = nil; + + + + if (attributes == null) { + attributes = nil; + }; + + if (match == null) { + match = nil; + }; + if ($truthy((match = ($truthy($a = match) ? $a : (function() {if ($truthy(reader['$has_more_lines?']())) { + + return $$($nesting, 'AttributeEntryRx').$match(reader.$peek_line()); + } else { + return nil + }; return nil; })())))) { + + if ($truthy((value = match['$[]'](2))['$nil_or_empty?']())) { + value = "" + } else if ($truthy(value['$end_with?']($$($nesting, 'LINE_CONTINUATION'), $$($nesting, 'LINE_CONTINUATION_LEGACY')))) { + + $a = [value.$slice(-2, 2), value.$slice(0, $rb_minus(value.$length(), 2)).$rstrip()], (con = $a[0]), (value = $a[1]), $a; + while ($truthy(($truthy($b = reader.$advance()) ? (next_line = ($truthy($c = reader.$peek_line()) ? $c : ""))['$empty?']()['$!']() : $b))) { + + next_line = next_line.$lstrip(); + if ($truthy((keep_open = next_line['$end_with?'](con)))) { + next_line = next_line.$slice(0, $rb_minus(next_line.$length(), 2)).$rstrip()}; + value = "" + (value) + ((function() {if ($truthy(value['$end_with?']($$($nesting, 'HARD_LINE_BREAK')))) { + return $$($nesting, 'LF') + } else { + return " " + }; return nil; })()) + (next_line); + if ($truthy(keep_open)) { + } else { + break; + }; + };}; + self.$store_attribute(match['$[]'](1), value, document, attributes); + return true; + } else { + return nil + }; + }, TMP_Parser_process_attribute_entry_57.$$arity = -3); + Opal.defs(self, '$store_attribute', TMP_Parser_store_attribute_58 = function $$store_attribute(name, value, doc, attrs) { + var $a, self = this, resolved_value = nil; + + + + if (doc == null) { + doc = nil; + }; + + if (attrs == null) { + attrs = nil; + }; + if ($truthy(name['$end_with?']("!"))) { + $a = [name.$chop(), nil], (name = $a[0]), (value = $a[1]), $a + } else if ($truthy(name['$start_with?']("!"))) { + $a = [name.$slice(1, name.$length()), nil], (name = $a[0]), (value = $a[1]), $a}; + name = self.$sanitize_attribute_name(name); + if (name['$==']("numbered")) { + name = "sectnums"}; + if ($truthy(doc)) { + if ($truthy(value)) { + + if (name['$==']("leveloffset")) { + if ($truthy(value['$start_with?']("+"))) { + value = $rb_plus(doc.$attr("leveloffset", 0).$to_i(), value.$slice(1, value.$length()).$to_i()).$to_s() + } else if ($truthy(value['$start_with?']("-"))) { + value = $rb_minus(doc.$attr("leveloffset", 0).$to_i(), value.$slice(1, value.$length()).$to_i()).$to_s()}}; + if ($truthy((resolved_value = doc.$set_attribute(name, value)))) { + + value = resolved_value; + if ($truthy(attrs)) { + $$$($$($nesting, 'Document'), 'AttributeEntry').$new(name, value).$save_to(attrs)};}; + } else if ($truthy(($truthy($a = doc.$delete_attribute(name)) ? attrs : $a))) { + $$$($$($nesting, 'Document'), 'AttributeEntry').$new(name, value).$save_to(attrs)} + } else if ($truthy(attrs)) { + $$$($$($nesting, 'Document'), 'AttributeEntry').$new(name, value).$save_to(attrs)}; + return [name, value]; + }, TMP_Parser_store_attribute_58.$$arity = -3); + Opal.defs(self, '$resolve_list_marker', TMP_Parser_resolve_list_marker_59 = function $$resolve_list_marker(list_type, marker, ordinal, validate, reader) { + var self = this; + + + + if (ordinal == null) { + ordinal = 0; + }; + + if (validate == null) { + validate = false; + }; + + if (reader == null) { + reader = nil; + }; + if (list_type['$==']("ulist")) { + return marker + } else if (list_type['$==']("olist")) { + return self.$resolve_ordered_list_marker(marker, ordinal, validate, reader)['$[]'](0) + } else { + return "<1>" + }; + }, TMP_Parser_resolve_list_marker_59.$$arity = -3); + Opal.defs(self, '$resolve_ordered_list_marker', TMP_Parser_resolve_ordered_list_marker_60 = function $$resolve_ordered_list_marker(marker, ordinal, validate, reader) { + var TMP_61, $a, self = this, $case = nil, style = nil, expected = nil, actual = nil; + + + + if (ordinal == null) { + ordinal = 0; + }; + + if (validate == null) { + validate = false; + }; + + if (reader == null) { + reader = nil; + }; + if ($truthy(marker['$start_with?']("."))) { + return [marker]}; + $case = (style = $send($$($nesting, 'ORDERED_LIST_STYLES'), 'find', [], (TMP_61 = function(s){var self = TMP_61.$$s || this; + + + + if (s == null) { + s = nil; + }; + return $$($nesting, 'OrderedListMarkerRxMap')['$[]'](s)['$match?'](marker);}, TMP_61.$$s = self, TMP_61.$$arity = 1, TMP_61))); + if ("arabic"['$===']($case)) { + if ($truthy(validate)) { + + expected = $rb_plus(ordinal, 1); + actual = marker.$to_i();}; + marker = "1.";} + else if ("loweralpha"['$===']($case)) { + if ($truthy(validate)) { + + expected = $rb_plus("a"['$[]'](0).$ord(), ordinal).$chr(); + actual = marker.$chop();}; + marker = "a.";} + else if ("upperalpha"['$===']($case)) { + if ($truthy(validate)) { + + expected = $rb_plus("A"['$[]'](0).$ord(), ordinal).$chr(); + actual = marker.$chop();}; + marker = "A.";} + else if ("lowerroman"['$===']($case)) { + if ($truthy(validate)) { + + expected = $$($nesting, 'Helpers').$int_to_roman($rb_plus(ordinal, 1)).$downcase(); + actual = marker.$chop();}; + marker = "i)";} + else if ("upperroman"['$===']($case)) { + if ($truthy(validate)) { + + expected = $$($nesting, 'Helpers').$int_to_roman($rb_plus(ordinal, 1)); + actual = marker.$chop();}; + marker = "I)";}; + if ($truthy(($truthy($a = validate) ? expected['$!='](actual) : $a))) { + self.$logger().$warn(self.$message_with_context("" + "list item index: expected " + (expected) + ", got " + (actual), $hash2(["source_location"], {"source_location": reader.$cursor()})))}; + return [marker, style]; + }, TMP_Parser_resolve_ordered_list_marker_60.$$arity = -2); + Opal.defs(self, '$is_sibling_list_item?', TMP_Parser_is_sibling_list_item$q_62 = function(line, list_type, sibling_trait) { + var $a, self = this, matcher = nil, expected_marker = nil; + + + if ($truthy($$$('::', 'Regexp')['$==='](sibling_trait))) { + matcher = sibling_trait + } else { + + matcher = $$($nesting, 'ListRxMap')['$[]'](list_type); + expected_marker = sibling_trait; + }; + if ($truthy(matcher['$=~'](line))) { + if ($truthy(expected_marker)) { + return expected_marker['$=='](self.$resolve_list_marker(list_type, (($a = $gvars['~']) === nil ? nil : $a['$[]'](1)))) + } else { + return true + } + } else { + return false + }; + }, TMP_Parser_is_sibling_list_item$q_62.$$arity = 3); + Opal.defs(self, '$parse_table', TMP_Parser_parse_table_63 = function $$parse_table(table_reader, parent, attributes) { + var $a, $b, $c, $d, self = this, table = nil, $writer = nil, colspecs = nil, explicit_colspecs = nil, skipped = nil, parser_ctx = nil, format = nil, loop_idx = nil, implicit_header_boundary = nil, implicit_header = nil, line = nil, beyond_first = nil, next_cellspec = nil, m = nil, pre_match = nil, post_match = nil, $case = nil, cell_text = nil, $logical_op_recvr_tmp_2 = nil; + + + table = $$($nesting, 'Table').$new(parent, attributes); + if ($truthy(attributes['$key?']("title"))) { + + + $writer = [attributes.$delete("title")]; + $send(table, 'title=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + table.$assign_caption(attributes.$delete("caption"));}; + if ($truthy(($truthy($a = attributes['$key?']("cols")) ? (colspecs = self.$parse_colspecs(attributes['$[]']("cols")))['$empty?']()['$!']() : $a))) { + + table.$create_columns(colspecs); + explicit_colspecs = true;}; + skipped = ($truthy($a = table_reader.$skip_blank_lines()) ? $a : 0); + parser_ctx = $$$($$($nesting, 'Table'), 'ParserContext').$new(table_reader, table, attributes); + $a = [parser_ctx.$format(), -1, nil], (format = $a[0]), (loop_idx = $a[1]), (implicit_header_boundary = $a[2]), $a; + if ($truthy(($truthy($a = ($truthy($b = $rb_gt(skipped, 0)) ? $b : attributes['$key?']("header-option"))) ? $a : attributes['$key?']("noheader-option")))) { + } else { + implicit_header = true + }; + $a = false; while ($a || $truthy((line = table_reader.$read_line()))) {$a = false; + + if ($truthy(($truthy($b = (beyond_first = $rb_gt((loop_idx = $rb_plus(loop_idx, 1)), 0))) ? line['$empty?']() : $b))) { + + line = nil; + if ($truthy(implicit_header_boundary)) { + implicit_header_boundary = $rb_plus(implicit_header_boundary, 1)}; + } else if (format['$==']("psv")) { + if ($truthy(parser_ctx['$starts_with_delimiter?'](line))) { + + line = line.$slice(1, line.$length()); + parser_ctx.$close_open_cell(); + if ($truthy(implicit_header_boundary)) { + implicit_header_boundary = nil}; + } else { + + $c = self.$parse_cellspec(line, "start", parser_ctx.$delimiter()), $b = Opal.to_ary($c), (next_cellspec = ($b[0] == null ? nil : $b[0])), (line = ($b[1] == null ? nil : $b[1])), $c; + if ($truthy(next_cellspec)) { + + parser_ctx.$close_open_cell(next_cellspec); + if ($truthy(implicit_header_boundary)) { + implicit_header_boundary = nil}; + } else if ($truthy(($truthy($b = implicit_header_boundary) ? implicit_header_boundary['$=='](loop_idx) : $b))) { + $b = [false, nil], (implicit_header = $b[0]), (implicit_header_boundary = $b[1]), $b}; + }}; + if ($truthy(beyond_first)) { + } else { + + table_reader.$mark(); + if ($truthy(implicit_header)) { + if ($truthy(($truthy($b = table_reader['$has_more_lines?']()) ? table_reader.$peek_line()['$empty?']() : $b))) { + implicit_header_boundary = 1 + } else { + implicit_header = false + }}; + }; + $b = false; while ($b || $truthy(true)) {$b = false; + if ($truthy(($truthy($c = line) ? (m = parser_ctx.$match_delimiter(line)) : $c))) { + + $c = [m.$pre_match(), m.$post_match()], (pre_match = $c[0]), (post_match = $c[1]), $c; + $case = format; + if ("csv"['$===']($case)) { + if ($truthy(parser_ctx['$buffer_has_unclosed_quotes?'](pre_match))) { + + parser_ctx.$skip_past_delimiter(pre_match); + if ($truthy((line = post_match)['$empty?']())) { + break;}; + $b = true; continue;;}; + + $writer = ["" + (parser_ctx.$buffer()) + (pre_match)]; + $send(parser_ctx, 'buffer=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];;} + else if ("dsv"['$===']($case)) { + if ($truthy(pre_match['$end_with?']("\\"))) { + + parser_ctx.$skip_past_escaped_delimiter(pre_match); + if ($truthy((line = post_match)['$empty?']())) { + + + $writer = ["" + (parser_ctx.$buffer()) + ($$($nesting, 'LF'))]; + $send(parser_ctx, 'buffer=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + parser_ctx.$keep_cell_open(); + break;;}; + $b = true; continue;;}; + + $writer = ["" + (parser_ctx.$buffer()) + (pre_match)]; + $send(parser_ctx, 'buffer=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];;} + else { + if ($truthy(pre_match['$end_with?']("\\"))) { + + parser_ctx.$skip_past_escaped_delimiter(pre_match); + if ($truthy((line = post_match)['$empty?']())) { + + + $writer = ["" + (parser_ctx.$buffer()) + ($$($nesting, 'LF'))]; + $send(parser_ctx, 'buffer=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + parser_ctx.$keep_cell_open(); + break;;}; + $b = true; continue;;}; + $d = self.$parse_cellspec(pre_match), $c = Opal.to_ary($d), (next_cellspec = ($c[0] == null ? nil : $c[0])), (cell_text = ($c[1] == null ? nil : $c[1])), $d; + parser_ctx.$push_cellspec(next_cellspec); + + $writer = ["" + (parser_ctx.$buffer()) + (cell_text)]; + $send(parser_ctx, 'buffer=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];;}; + if ($truthy((line = post_match)['$empty?']())) { + line = nil}; + parser_ctx.$close_cell(); + } else { + + + $writer = ["" + (parser_ctx.$buffer()) + (line) + ($$($nesting, 'LF'))]; + $send(parser_ctx, 'buffer=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + $case = format; + if ("csv"['$===']($case)) {if ($truthy(parser_ctx['$buffer_has_unclosed_quotes?']())) { + + if ($truthy(($truthy($c = implicit_header_boundary) ? loop_idx['$=='](0) : $c))) { + $c = [false, nil], (implicit_header = $c[0]), (implicit_header_boundary = $c[1]), $c}; + parser_ctx.$keep_cell_open(); + } else { + parser_ctx.$close_cell(true) + }} + else if ("dsv"['$===']($case)) {parser_ctx.$close_cell(true)} + else {parser_ctx.$keep_cell_open()}; + break;; + } + }; + if ($truthy(parser_ctx['$cell_open?']())) { + if ($truthy(table_reader['$has_more_lines?']())) { + } else { + parser_ctx.$close_cell(true) + } + } else { + if ($truthy($b = table_reader.$skip_blank_lines())) { + $b + } else { + break; + } + }; + }; + if ($truthy(($truthy($a = (($logical_op_recvr_tmp_2 = table.$attributes()), ($truthy($b = $logical_op_recvr_tmp_2['$[]']("colcount")) ? $b : (($writer = ["colcount", table.$columns().$size()]), $send($logical_op_recvr_tmp_2, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])))['$=='](0)) ? $a : explicit_colspecs))) { + } else { + table.$assign_column_widths() + }; + if ($truthy(implicit_header)) { + + + $writer = [true]; + $send(table, 'has_header_option=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["header-option", ""]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["options", (function() {if ($truthy(attributes['$key?']("options"))) { + return "" + (attributes['$[]']("options")) + ",header" + } else { + return "header" + }; return nil; })()]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];;}; + table.$partition_header_footer(attributes); + return table; + }, TMP_Parser_parse_table_63.$$arity = 3); + Opal.defs(self, '$parse_colspecs', TMP_Parser_parse_colspecs_64 = function $$parse_colspecs(records) { + var TMP_65, TMP_66, self = this, specs = nil; + + + if ($truthy(records['$include?'](" "))) { + records = records.$delete(" ")}; + if (records['$=='](records.$to_i().$to_s())) { + return $send($$$('::', 'Array'), 'new', [records.$to_i()], (TMP_65 = function(){var self = TMP_65.$$s || this; + + return $hash2(["width"], {"width": 1})}, TMP_65.$$s = self, TMP_65.$$arity = 0, TMP_65))}; + specs = []; + $send((function() {if ($truthy(records['$include?'](","))) { + + return records.$split(",", -1); + } else { + + return records.$split(";", -1); + }; return nil; })(), 'each', [], (TMP_66 = function(record){var self = TMP_66.$$s || this, $a, $b, TMP_67, m = nil, spec = nil, colspec = nil, rowspec = nil, $writer = nil, width = nil; + + + + if (record == null) { + record = nil; + }; + if ($truthy(record['$empty?']())) { + return specs['$<<']($hash2(["width"], {"width": 1})) + } else if ($truthy((m = $$($nesting, 'ColumnSpecRx').$match(record)))) { + + spec = $hash2([], {}); + if ($truthy(m['$[]'](2))) { + + $b = m['$[]'](2).$split("."), $a = Opal.to_ary($b), (colspec = ($a[0] == null ? nil : $a[0])), (rowspec = ($a[1] == null ? nil : $a[1])), $b; + if ($truthy(($truthy($a = colspec['$nil_or_empty?']()['$!']()) ? $$($nesting, 'TableCellHorzAlignments')['$key?'](colspec) : $a))) { + + $writer = ["halign", $$($nesting, 'TableCellHorzAlignments')['$[]'](colspec)]; + $send(spec, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if ($truthy(($truthy($a = rowspec['$nil_or_empty?']()['$!']()) ? $$($nesting, 'TableCellVertAlignments')['$key?'](rowspec) : $a))) { + + $writer = ["valign", $$($nesting, 'TableCellVertAlignments')['$[]'](rowspec)]; + $send(spec, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];};}; + if ($truthy((width = m['$[]'](3)))) { + + $writer = ["width", (function() {if (width['$==']("~")) { + return -1 + } else { + return width.$to_i() + }; return nil; })()]; + $send(spec, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + } else { + + $writer = ["width", 1]; + $send(spec, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + if ($truthy(($truthy($a = m['$[]'](4)) ? $$($nesting, 'TableCellStyles')['$key?'](m['$[]'](4)) : $a))) { + + $writer = ["style", $$($nesting, 'TableCellStyles')['$[]'](m['$[]'](4))]; + $send(spec, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if ($truthy(m['$[]'](1))) { + return $send((1), 'upto', [m['$[]'](1).$to_i()], (TMP_67 = function(){var self = TMP_67.$$s || this; + + return specs['$<<'](spec.$dup())}, TMP_67.$$s = self, TMP_67.$$arity = 0, TMP_67)) + } else { + return specs['$<<'](spec) + }; + } else { + return nil + };}, TMP_66.$$s = self, TMP_66.$$arity = 1, TMP_66)); + return specs; + }, TMP_Parser_parse_colspecs_64.$$arity = 1); + Opal.defs(self, '$parse_cellspec', TMP_Parser_parse_cellspec_68 = function $$parse_cellspec(line, pos, delimiter) { + var $a, $b, self = this, m = nil, rest = nil, spec_part = nil, spec = nil, colspec = nil, rowspec = nil, $writer = nil; + + + + if (pos == null) { + pos = "end"; + }; + + if (delimiter == null) { + delimiter = nil; + }; + $a = [nil, ""], (m = $a[0]), (rest = $a[1]), $a; + if (pos['$==']("start")) { + if ($truthy(line['$include?'](delimiter))) { + + $b = line.$split(delimiter, 2), $a = Opal.to_ary($b), (spec_part = ($a[0] == null ? nil : $a[0])), (rest = ($a[1] == null ? nil : $a[1])), $b; + if ($truthy((m = $$($nesting, 'CellSpecStartRx').$match(spec_part)))) { + if ($truthy(m['$[]'](0)['$empty?']())) { + return [$hash2([], {}), rest]} + } else { + return [nil, line] + }; + } else { + return [nil, line] + } + } else if ($truthy((m = $$($nesting, 'CellSpecEndRx').$match(line)))) { + + if ($truthy(m['$[]'](0).$lstrip()['$empty?']())) { + return [$hash2([], {}), line.$rstrip()]}; + rest = m.$pre_match(); + } else { + return [$hash2([], {}), line] + }; + spec = $hash2([], {}); + if ($truthy(m['$[]'](1))) { + + $b = m['$[]'](1).$split("."), $a = Opal.to_ary($b), (colspec = ($a[0] == null ? nil : $a[0])), (rowspec = ($a[1] == null ? nil : $a[1])), $b; + colspec = (function() {if ($truthy(colspec['$nil_or_empty?']())) { + return 1 + } else { + return colspec.$to_i() + }; return nil; })(); + rowspec = (function() {if ($truthy(rowspec['$nil_or_empty?']())) { + return 1 + } else { + return rowspec.$to_i() + }; return nil; })(); + if (m['$[]'](2)['$==']("+")) { + + if (colspec['$=='](1)) { + } else { + + $writer = ["colspan", colspec]; + $send(spec, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + if (rowspec['$=='](1)) { + } else { + + $writer = ["rowspan", rowspec]; + $send(spec, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + } else if (m['$[]'](2)['$==']("*")) { + if (colspec['$=='](1)) { + } else { + + $writer = ["repeatcol", colspec]; + $send(spec, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }};}; + if ($truthy(m['$[]'](3))) { + + $b = m['$[]'](3).$split("."), $a = Opal.to_ary($b), (colspec = ($a[0] == null ? nil : $a[0])), (rowspec = ($a[1] == null ? nil : $a[1])), $b; + if ($truthy(($truthy($a = colspec['$nil_or_empty?']()['$!']()) ? $$($nesting, 'TableCellHorzAlignments')['$key?'](colspec) : $a))) { + + $writer = ["halign", $$($nesting, 'TableCellHorzAlignments')['$[]'](colspec)]; + $send(spec, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if ($truthy(($truthy($a = rowspec['$nil_or_empty?']()['$!']()) ? $$($nesting, 'TableCellVertAlignments')['$key?'](rowspec) : $a))) { + + $writer = ["valign", $$($nesting, 'TableCellVertAlignments')['$[]'](rowspec)]; + $send(spec, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];};}; + if ($truthy(($truthy($a = m['$[]'](4)) ? $$($nesting, 'TableCellStyles')['$key?'](m['$[]'](4)) : $a))) { + + $writer = ["style", $$($nesting, 'TableCellStyles')['$[]'](m['$[]'](4))]; + $send(spec, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + return [spec, rest]; + }, TMP_Parser_parse_cellspec_68.$$arity = -2); + Opal.defs(self, '$parse_style_attribute', TMP_Parser_parse_style_attribute_69 = function $$parse_style_attribute(attributes, reader) { + var $a, $b, TMP_70, TMP_71, TMP_72, self = this, raw_style = nil, type = nil, collector = nil, parsed = nil, save_current = nil, $writer = nil, parsed_style = nil, existing_role = nil, opts = nil, existing_opts = nil; + + + + if (reader == null) { + reader = nil; + }; + if ($truthy(($truthy($a = ($truthy($b = (raw_style = attributes['$[]'](1))) ? raw_style['$include?'](" ")['$!']() : $b)) ? $$($nesting, 'Compliance').$shorthand_property_syntax() : $a))) { + + $a = ["style", [], $hash2([], {})], (type = $a[0]), (collector = $a[1]), (parsed = $a[2]), $a; + save_current = $send(self, 'lambda', [], (TMP_70 = function(){var self = TMP_70.$$s || this, $c, $case = nil, $writer = nil; + + if ($truthy(collector['$empty?']())) { + if (type['$==']("style")) { + return nil + } else if ($truthy(reader)) { + return self.$logger().$warn(self.$message_with_context("" + "invalid empty " + (type) + " detected in style attribute", $hash2(["source_location"], {"source_location": reader.$cursor_at_prev_line()}))) + } else { + return self.$logger().$warn("" + "invalid empty " + (type) + " detected in style attribute") + } + } else { + + $case = type; + if ("role"['$===']($case) || "option"['$===']($case)) {($truthy($c = parsed['$[]'](type)) ? $c : (($writer = [type, []]), $send(parsed, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]))['$<<'](collector.$join())} + else if ("id"['$===']($case)) { + if ($truthy(parsed['$key?']("id"))) { + if ($truthy(reader)) { + self.$logger().$warn(self.$message_with_context("multiple ids detected in style attribute", $hash2(["source_location"], {"source_location": reader.$cursor_at_prev_line()}))) + } else { + self.$logger().$warn("multiple ids detected in style attribute") + }}; + + $writer = [type, collector.$join()]; + $send(parsed, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];;} + else { + $writer = [type, collector.$join()]; + $send(parsed, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + return (collector = []); + }}, TMP_70.$$s = self, TMP_70.$$arity = 0, TMP_70)); + $send(raw_style, 'each_char', [], (TMP_71 = function(c){var self = TMP_71.$$s || this, $c, $d, $case = nil; + + + + if (c == null) { + c = nil; + }; + if ($truthy(($truthy($c = ($truthy($d = c['$=='](".")) ? $d : c['$==']("#"))) ? $c : c['$==']("%")))) { + + save_current.$call(); + return (function() {$case = c; + if ("."['$===']($case)) {return (type = "role")} + else if ("#"['$===']($case)) {return (type = "id")} + else if ("%"['$===']($case)) {return (type = "option")} + else { return nil }})(); + } else { + return collector['$<<'](c) + };}, TMP_71.$$s = self, TMP_71.$$arity = 1, TMP_71)); + if (type['$==']("style")) { + + $writer = ["style", raw_style]; + $send(attributes, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + } else { + + save_current.$call(); + if ($truthy(parsed['$key?']("style"))) { + parsed_style = (($writer = ["style", parsed['$[]']("style")]), $send(attributes, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])}; + if ($truthy(parsed['$key?']("id"))) { + + $writer = ["id", parsed['$[]']("id")]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if ($truthy(parsed['$key?']("role"))) { + + $writer = ["role", (function() {if ($truthy((existing_role = attributes['$[]']("role"))['$nil_or_empty?']())) { + + return parsed['$[]']("role").$join(" "); + } else { + return "" + (existing_role) + " " + (parsed['$[]']("role").$join(" ")) + }; return nil; })()]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if ($truthy(parsed['$key?']("option"))) { + + $send((opts = parsed['$[]']("option")), 'each', [], (TMP_72 = function(opt){var self = TMP_72.$$s || this; + + + + if (opt == null) { + opt = nil; + }; + $writer = ["" + (opt) + "-option", ""]; + $send(attributes, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];}, TMP_72.$$s = self, TMP_72.$$arity = 1, TMP_72)); + + $writer = ["options", (function() {if ($truthy((existing_opts = attributes['$[]']("options"))['$nil_or_empty?']())) { + + return opts.$join(","); + } else { + return "" + (existing_opts) + "," + (opts.$join(",")) + }; return nil; })()]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];;}; + return parsed_style; + }; + } else { + + $writer = ["style", raw_style]; + $send(attributes, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + }; + }, TMP_Parser_parse_style_attribute_69.$$arity = -2); + Opal.defs(self, '$adjust_indentation!', TMP_Parser_adjust_indentation$B_73 = function(lines, indent, tab_size) { + var $a, TMP_74, TMP_77, TMP_78, TMP_79, TMP_80, self = this, full_tab_space = nil, gutter_width = nil, padding = nil; + + + + if (indent == null) { + indent = 0; + }; + + if (tab_size == null) { + tab_size = 0; + }; + if ($truthy(lines['$empty?']())) { + return nil}; + if ($truthy(($truthy($a = $rb_gt((tab_size = tab_size.$to_i()), 0)) ? lines.$join()['$include?']($$($nesting, 'TAB')) : $a))) { + + full_tab_space = $rb_times(" ", tab_size); + $send(lines, 'map!', [], (TMP_74 = function(line){var self = TMP_74.$$s || this, TMP_75, TMP_76, spaces_added = nil; + + + + if (line == null) { + line = nil; + }; + if ($truthy(line['$empty?']())) { + return line;}; + if ($truthy(line['$start_with?']($$($nesting, 'TAB')))) { + line = $send(line, 'sub', [$$($nesting, 'TabIndentRx')], (TMP_75 = function(){var self = TMP_75.$$s || this, $b; + + return $rb_times(full_tab_space, (($b = $gvars['~']) === nil ? nil : $b['$[]'](0)).$length())}, TMP_75.$$s = self, TMP_75.$$arity = 0, TMP_75))}; + if ($truthy(line['$include?']($$($nesting, 'TAB')))) { + + spaces_added = 0; + return line = $send(line, 'gsub', [$$($nesting, 'TabRx')], (TMP_76 = function(){var self = TMP_76.$$s || this, offset = nil, spaces = nil; + if ($gvars["~"] == null) $gvars["~"] = nil; + + if ((offset = $rb_plus($gvars["~"].$begin(0), spaces_added))['$%'](tab_size)['$=='](0)) { + + spaces_added = $rb_plus(spaces_added, $rb_minus(tab_size, 1)); + return full_tab_space; + } else { + + if ((spaces = $rb_minus(tab_size, offset['$%'](tab_size)))['$=='](1)) { + } else { + spaces_added = $rb_plus(spaces_added, $rb_minus(spaces, 1)) + }; + return $rb_times(" ", spaces); + }}, TMP_76.$$s = self, TMP_76.$$arity = 0, TMP_76)); + } else { + return line + };}, TMP_74.$$s = self, TMP_74.$$arity = 1, TMP_74));}; + if ($truthy(($truthy($a = indent) ? $rb_gt((indent = indent.$to_i()), -1) : $a))) { + } else { + return nil + }; + gutter_width = nil; + (function(){var $brk = Opal.new_brk(); try {return $send(lines, 'each', [], (TMP_77 = function(line){var self = TMP_77.$$s || this, $b, line_indent = nil; + + + + if (line == null) { + line = nil; + }; + if ($truthy(line['$empty?']())) { + return nil;}; + if ((line_indent = $rb_minus(line.$length(), line.$lstrip().$length()))['$=='](0)) { + + gutter_width = nil; + + Opal.brk(nil, $brk); + } else if ($truthy(($truthy($b = gutter_width) ? $rb_gt(line_indent, gutter_width) : $b))) { + return nil + } else { + return (gutter_width = line_indent) + };}, TMP_77.$$s = self, TMP_77.$$brk = $brk, TMP_77.$$arity = 1, TMP_77)) + } catch (err) { if (err === $brk) { return err.$v } else { throw err } }})(); + if (indent['$=='](0)) { + if ($truthy(gutter_width)) { + $send(lines, 'map!', [], (TMP_78 = function(line){var self = TMP_78.$$s || this; + + + + if (line == null) { + line = nil; + }; + if ($truthy(line['$empty?']())) { + return line + } else { + + return line.$slice(gutter_width, line.$length()); + };}, TMP_78.$$s = self, TMP_78.$$arity = 1, TMP_78))} + } else { + + padding = $rb_times(" ", indent); + if ($truthy(gutter_width)) { + $send(lines, 'map!', [], (TMP_79 = function(line){var self = TMP_79.$$s || this; + + + + if (line == null) { + line = nil; + }; + if ($truthy(line['$empty?']())) { + return line + } else { + return $rb_plus(padding, line.$slice(gutter_width, line.$length())) + };}, TMP_79.$$s = self, TMP_79.$$arity = 1, TMP_79)) + } else { + $send(lines, 'map!', [], (TMP_80 = function(line){var self = TMP_80.$$s || this; + + + + if (line == null) { + line = nil; + }; + if ($truthy(line['$empty?']())) { + return line + } else { + return $rb_plus(padding, line) + };}, TMP_80.$$s = self, TMP_80.$$arity = 1, TMP_80)) + }; + }; + return nil; + }, TMP_Parser_adjust_indentation$B_73.$$arity = -2); + return (Opal.defs(self, '$sanitize_attribute_name', TMP_Parser_sanitize_attribute_name_81 = function $$sanitize_attribute_name(name) { + var self = this; + + return name.$gsub($$($nesting, 'InvalidAttributeNameCharsRx'), "").$downcase() + }, TMP_Parser_sanitize_attribute_name_81.$$arity = 1), nil) && 'sanitize_attribute_name'; + })($nesting[0], null, $nesting) + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/path_resolver"] = function(Opal) { + function $rb_plus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); + } + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + function $rb_gt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $truthy = Opal.truthy, $hash2 = Opal.hash2, $send = Opal.send; + + Opal.add_stubs(['$include', '$attr_accessor', '$root?', '$posixify', '$expand_path', '$pwd', '$start_with?', '$==', '$match?', '$absolute_path?', '$+', '$length', '$descends_from?', '$slice', '$to_s', '$relative_path_from', '$new', '$include?', '$tr', '$partition_path', '$each', '$pop', '$<<', '$join_path', '$[]', '$web_root?', '$unc?', '$index', '$split', '$delete', '$[]=', '$-', '$join', '$raise', '$!', '$fetch', '$warn', '$logger', '$empty?', '$nil_or_empty?', '$chomp', '$!=', '$>', '$size', '$end_with?', '$uri_prefix', '$gsub']); + return (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + (function($base, $super, $parent_nesting) { + function $PathResolver(){}; + var self = $PathResolver = $klass($base, $super, 'PathResolver', $PathResolver); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_PathResolver_initialize_1, TMP_PathResolver_absolute_path$q_2, $a, TMP_PathResolver_root$q_3, TMP_PathResolver_unc$q_4, TMP_PathResolver_web_root$q_5, TMP_PathResolver_descends_from$q_6, TMP_PathResolver_relative_path_7, TMP_PathResolver_posixify_8, TMP_PathResolver_expand_path_9, TMP_PathResolver_partition_path_11, TMP_PathResolver_join_path_12, TMP_PathResolver_system_path_13, TMP_PathResolver_web_path_16; + + def.file_separator = def._partition_path_web = def._partition_path_sys = def.working_dir = nil; + + self.$include($$($nesting, 'Logging')); + Opal.const_set($nesting[0], 'DOT', "."); + Opal.const_set($nesting[0], 'DOT_DOT', ".."); + Opal.const_set($nesting[0], 'DOT_SLASH', "./"); + Opal.const_set($nesting[0], 'SLASH', "/"); + Opal.const_set($nesting[0], 'BACKSLASH', "\\"); + Opal.const_set($nesting[0], 'DOUBLE_SLASH', "//"); + Opal.const_set($nesting[0], 'WindowsRootRx', /^(?:[a-zA-Z]:)?[\\\/]/); + self.$attr_accessor("file_separator"); + self.$attr_accessor("working_dir"); + + Opal.def(self, '$initialize', TMP_PathResolver_initialize_1 = function $$initialize(file_separator, working_dir) { + var $a, $b, self = this; + + + + if (file_separator == null) { + file_separator = nil; + }; + + if (working_dir == null) { + working_dir = nil; + }; + self.file_separator = ($truthy($a = ($truthy($b = file_separator) ? $b : $$$($$$('::', 'File'), 'ALT_SEPARATOR'))) ? $a : $$$($$$('::', 'File'), 'SEPARATOR')); + self.working_dir = (function() {if ($truthy(working_dir)) { + + if ($truthy(self['$root?'](working_dir))) { + + return self.$posixify(working_dir); + } else { + + return $$$('::', 'File').$expand_path(working_dir); + }; + } else { + return $$$('::', 'Dir').$pwd() + }; return nil; })(); + self._partition_path_sys = $hash2([], {}); + return (self._partition_path_web = $hash2([], {})); + }, TMP_PathResolver_initialize_1.$$arity = -1); + + Opal.def(self, '$absolute_path?', TMP_PathResolver_absolute_path$q_2 = function(path) { + var $a, $b, self = this; + + return ($truthy($a = path['$start_with?']($$($nesting, 'SLASH'))) ? $a : (($b = self.file_separator['$==']($$($nesting, 'BACKSLASH'))) ? $$($nesting, 'WindowsRootRx')['$match?'](path) : self.file_separator['$==']($$($nesting, 'BACKSLASH')))) + }, TMP_PathResolver_absolute_path$q_2.$$arity = 1); + if ($truthy((($a = $$($nesting, 'RUBY_ENGINE')['$==']("opal")) ? $$$('::', 'JAVASCRIPT_IO_MODULE')['$==']("xmlhttprequest") : $$($nesting, 'RUBY_ENGINE')['$==']("opal")))) { + + Opal.def(self, '$root?', TMP_PathResolver_root$q_3 = function(path) { + var $a, self = this; + + return ($truthy($a = self['$absolute_path?'](path)) ? $a : path['$start_with?']("file://", "http://", "https://")) + }, TMP_PathResolver_root$q_3.$$arity = 1) + } else { + Opal.alias(self, "root?", "absolute_path?") + }; + + Opal.def(self, '$unc?', TMP_PathResolver_unc$q_4 = function(path) { + var self = this; + + return path['$start_with?']($$($nesting, 'DOUBLE_SLASH')) + }, TMP_PathResolver_unc$q_4.$$arity = 1); + + Opal.def(self, '$web_root?', TMP_PathResolver_web_root$q_5 = function(path) { + var self = this; + + return path['$start_with?']($$($nesting, 'SLASH')) + }, TMP_PathResolver_web_root$q_5.$$arity = 1); + + Opal.def(self, '$descends_from?', TMP_PathResolver_descends_from$q_6 = function(path, base) { + var $a, self = this; + + if (base['$=='](path)) { + return 0 + } else if (base['$==']($$($nesting, 'SLASH'))) { + return ($truthy($a = path['$start_with?']($$($nesting, 'SLASH'))) ? 1 : $a) + } else { + return ($truthy($a = path['$start_with?']($rb_plus(base, $$($nesting, 'SLASH')))) ? $rb_plus(base.$length(), 1) : $a) + } + }, TMP_PathResolver_descends_from$q_6.$$arity = 2); + + Opal.def(self, '$relative_path', TMP_PathResolver_relative_path_7 = function $$relative_path(path, base) { + var self = this, offset = nil; + + if ($truthy(self['$root?'](path))) { + if ($truthy((offset = self['$descends_from?'](path, base)))) { + return path.$slice(offset, path.$length()) + } else { + return $$($nesting, 'Pathname').$new(path).$relative_path_from($$($nesting, 'Pathname').$new(base)).$to_s() + } + } else { + return path + } + }, TMP_PathResolver_relative_path_7.$$arity = 2); + + Opal.def(self, '$posixify', TMP_PathResolver_posixify_8 = function $$posixify(path) { + var $a, self = this; + + if ($truthy(path)) { + if ($truthy((($a = self.file_separator['$==']($$($nesting, 'BACKSLASH'))) ? path['$include?']($$($nesting, 'BACKSLASH')) : self.file_separator['$==']($$($nesting, 'BACKSLASH'))))) { + + return path.$tr($$($nesting, 'BACKSLASH'), $$($nesting, 'SLASH')); + } else { + return path + } + } else { + return "" + } + }, TMP_PathResolver_posixify_8.$$arity = 1); + Opal.alias(self, "posixfy", "posixify"); + + Opal.def(self, '$expand_path', TMP_PathResolver_expand_path_9 = function $$expand_path(path) { + var $a, $b, TMP_10, self = this, path_segments = nil, path_root = nil, resolved_segments = nil; + + + $b = self.$partition_path(path), $a = Opal.to_ary($b), (path_segments = ($a[0] == null ? nil : $a[0])), (path_root = ($a[1] == null ? nil : $a[1])), $b; + if ($truthy(path['$include?']($$($nesting, 'DOT_DOT')))) { + + resolved_segments = []; + $send(path_segments, 'each', [], (TMP_10 = function(segment){var self = TMP_10.$$s || this; + + + + if (segment == null) { + segment = nil; + }; + if (segment['$==']($$($nesting, 'DOT_DOT'))) { + return resolved_segments.$pop() + } else { + return resolved_segments['$<<'](segment) + };}, TMP_10.$$s = self, TMP_10.$$arity = 1, TMP_10)); + return self.$join_path(resolved_segments, path_root); + } else { + return self.$join_path(path_segments, path_root) + }; + }, TMP_PathResolver_expand_path_9.$$arity = 1); + + Opal.def(self, '$partition_path', TMP_PathResolver_partition_path_11 = function $$partition_path(path, web) { + var self = this, result = nil, cache = nil, posix_path = nil, root = nil, path_segments = nil, $writer = nil; + + + + if (web == null) { + web = nil; + }; + if ($truthy((result = (cache = (function() {if ($truthy(web)) { + return self._partition_path_web + } else { + return self._partition_path_sys + }; return nil; })())['$[]'](path)))) { + return result}; + posix_path = self.$posixify(path); + if ($truthy(web)) { + if ($truthy(self['$web_root?'](posix_path))) { + root = $$($nesting, 'SLASH') + } else if ($truthy(posix_path['$start_with?']($$($nesting, 'DOT_SLASH')))) { + root = $$($nesting, 'DOT_SLASH')} + } else if ($truthy(self['$root?'](posix_path))) { + if ($truthy(self['$unc?'](posix_path))) { + root = $$($nesting, 'DOUBLE_SLASH') + } else if ($truthy(posix_path['$start_with?']($$($nesting, 'SLASH')))) { + root = $$($nesting, 'SLASH') + } else { + root = posix_path.$slice(0, $rb_plus(posix_path.$index($$($nesting, 'SLASH')), 1)) + } + } else if ($truthy(posix_path['$start_with?']($$($nesting, 'DOT_SLASH')))) { + root = $$($nesting, 'DOT_SLASH')}; + path_segments = (function() {if ($truthy(root)) { + + return posix_path.$slice(root.$length(), posix_path.$length()); + } else { + return posix_path + }; return nil; })().$split($$($nesting, 'SLASH')); + path_segments.$delete($$($nesting, 'DOT')); + + $writer = [path, [path_segments, root]]; + $send(cache, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];; + }, TMP_PathResolver_partition_path_11.$$arity = -2); + + Opal.def(self, '$join_path', TMP_PathResolver_join_path_12 = function $$join_path(segments, root) { + var self = this; + + + + if (root == null) { + root = nil; + }; + if ($truthy(root)) { + return "" + (root) + (segments.$join($$($nesting, 'SLASH'))) + } else { + + return segments.$join($$($nesting, 'SLASH')); + }; + }, TMP_PathResolver_join_path_12.$$arity = -2); + + Opal.def(self, '$system_path', TMP_PathResolver_system_path_13 = function $$system_path(target, start, jail, opts) { + var $a, $b, TMP_14, TMP_15, self = this, target_path = nil, target_segments = nil, _ = nil, jail_segments = nil, jail_root = nil, recheck = nil, start_segments = nil, start_root = nil, resolved_segments = nil, unresolved_segments = nil, warned = nil; + + + + if (start == null) { + start = nil; + }; + + if (jail == null) { + jail = nil; + }; + + if (opts == null) { + opts = $hash2([], {}); + }; + if ($truthy(jail)) { + + if ($truthy(self['$root?'](jail))) { + } else { + self.$raise($$$('::', 'SecurityError'), "" + "Jail is not an absolute path: " + (jail)) + }; + jail = self.$posixify(jail);}; + if ($truthy(target)) { + if ($truthy(self['$root?'](target))) { + + target_path = self.$expand_path(target); + if ($truthy(($truthy($a = jail) ? self['$descends_from?'](target_path, jail)['$!']() : $a))) { + if ($truthy(opts.$fetch("recover", true))) { + + self.$logger().$warn("" + (($truthy($a = opts['$[]']("target_name")) ? $a : "path")) + " is outside of jail; recovering automatically"); + $b = self.$partition_path(target_path), $a = Opal.to_ary($b), (target_segments = ($a[0] == null ? nil : $a[0])), (_ = ($a[1] == null ? nil : $a[1])), $b; + $b = self.$partition_path(jail), $a = Opal.to_ary($b), (jail_segments = ($a[0] == null ? nil : $a[0])), (jail_root = ($a[1] == null ? nil : $a[1])), $b; + return self.$join_path($rb_plus(jail_segments, target_segments), jail_root); + } else { + self.$raise($$$('::', 'SecurityError'), "" + (($truthy($a = opts['$[]']("target_name")) ? $a : "path")) + " " + (target) + " is outside of jail: " + (jail) + " (disallowed in safe mode)") + }}; + return target_path; + } else { + $b = self.$partition_path(target), $a = Opal.to_ary($b), (target_segments = ($a[0] == null ? nil : $a[0])), (_ = ($a[1] == null ? nil : $a[1])), $b + } + } else { + target_segments = [] + }; + if ($truthy(target_segments['$empty?']())) { + if ($truthy(start['$nil_or_empty?']())) { + return ($truthy($a = jail) ? $a : self.working_dir) + } else if ($truthy(self['$root?'](start))) { + if ($truthy(jail)) { + start = self.$posixify(start) + } else { + return self.$expand_path(start) + } + } else { + + $b = self.$partition_path(start), $a = Opal.to_ary($b), (target_segments = ($a[0] == null ? nil : $a[0])), (_ = ($a[1] == null ? nil : $a[1])), $b; + start = ($truthy($a = jail) ? $a : self.working_dir); + } + } else if ($truthy(start['$nil_or_empty?']())) { + start = ($truthy($a = jail) ? $a : self.working_dir) + } else if ($truthy(self['$root?'](start))) { + if ($truthy(jail)) { + start = self.$posixify(start)} + } else { + start = "" + (($truthy($a = jail) ? $a : self.working_dir).$chomp("/")) + "/" + (start) + }; + if ($truthy(($truthy($a = ($truthy($b = jail) ? (recheck = self['$descends_from?'](start, jail)['$!']()) : $b)) ? self.file_separator['$==']($$($nesting, 'BACKSLASH')) : $a))) { + + $b = self.$partition_path(start), $a = Opal.to_ary($b), (start_segments = ($a[0] == null ? nil : $a[0])), (start_root = ($a[1] == null ? nil : $a[1])), $b; + $b = self.$partition_path(jail), $a = Opal.to_ary($b), (jail_segments = ($a[0] == null ? nil : $a[0])), (jail_root = ($a[1] == null ? nil : $a[1])), $b; + if ($truthy(start_root['$!='](jail_root))) { + if ($truthy(opts.$fetch("recover", true))) { + + self.$logger().$warn("" + "start path for " + (($truthy($a = opts['$[]']("target_name")) ? $a : "path")) + " is outside of jail root; recovering automatically"); + start_segments = jail_segments; + recheck = false; + } else { + self.$raise($$$('::', 'SecurityError'), "" + "start path for " + (($truthy($a = opts['$[]']("target_name")) ? $a : "path")) + " " + (start) + " refers to location outside jail root: " + (jail) + " (disallowed in safe mode)") + }}; + } else { + $b = self.$partition_path(start), $a = Opal.to_ary($b), (start_segments = ($a[0] == null ? nil : $a[0])), (jail_root = ($a[1] == null ? nil : $a[1])), $b + }; + if ($truthy((resolved_segments = $rb_plus(start_segments, target_segments))['$include?']($$($nesting, 'DOT_DOT')))) { + + $a = [resolved_segments, []], (unresolved_segments = $a[0]), (resolved_segments = $a[1]), $a; + if ($truthy(jail)) { + + if ($truthy(jail_segments)) { + } else { + $b = self.$partition_path(jail), $a = Opal.to_ary($b), (jail_segments = ($a[0] == null ? nil : $a[0])), (_ = ($a[1] == null ? nil : $a[1])), $b + }; + warned = false; + $send(unresolved_segments, 'each', [], (TMP_14 = function(segment){var self = TMP_14.$$s || this, $c; + + + + if (segment == null) { + segment = nil; + }; + if (segment['$==']($$($nesting, 'DOT_DOT'))) { + if ($truthy($rb_gt(resolved_segments.$size(), jail_segments.$size()))) { + return resolved_segments.$pop() + } else if ($truthy(opts.$fetch("recover", true))) { + if ($truthy(warned)) { + return nil + } else { + + self.$logger().$warn("" + (($truthy($c = opts['$[]']("target_name")) ? $c : "path")) + " has illegal reference to ancestor of jail; recovering automatically"); + return (warned = true); + } + } else { + return self.$raise($$$('::', 'SecurityError'), "" + (($truthy($c = opts['$[]']("target_name")) ? $c : "path")) + " " + (target) + " refers to location outside jail: " + (jail) + " (disallowed in safe mode)") + } + } else { + return resolved_segments['$<<'](segment) + };}, TMP_14.$$s = self, TMP_14.$$arity = 1, TMP_14)); + } else { + $send(unresolved_segments, 'each', [], (TMP_15 = function(segment){var self = TMP_15.$$s || this; + + + + if (segment == null) { + segment = nil; + }; + if (segment['$==']($$($nesting, 'DOT_DOT'))) { + return resolved_segments.$pop() + } else { + return resolved_segments['$<<'](segment) + };}, TMP_15.$$s = self, TMP_15.$$arity = 1, TMP_15)) + };}; + if ($truthy(recheck)) { + + target_path = self.$join_path(resolved_segments, jail_root); + if ($truthy(self['$descends_from?'](target_path, jail))) { + return target_path + } else if ($truthy(opts.$fetch("recover", true))) { + + self.$logger().$warn("" + (($truthy($a = opts['$[]']("target_name")) ? $a : "path")) + " is outside of jail; recovering automatically"); + if ($truthy(jail_segments)) { + } else { + $b = self.$partition_path(jail), $a = Opal.to_ary($b), (jail_segments = ($a[0] == null ? nil : $a[0])), (_ = ($a[1] == null ? nil : $a[1])), $b + }; + return self.$join_path($rb_plus(jail_segments, target_segments), jail_root); + } else { + return self.$raise($$$('::', 'SecurityError'), "" + (($truthy($a = opts['$[]']("target_name")) ? $a : "path")) + " " + (target) + " is outside of jail: " + (jail) + " (disallowed in safe mode)") + }; + } else { + return self.$join_path(resolved_segments, jail_root) + }; + }, TMP_PathResolver_system_path_13.$$arity = -2); + return (Opal.def(self, '$web_path', TMP_PathResolver_web_path_16 = function $$web_path(target, start) { + var $a, $b, TMP_17, self = this, uri_prefix = nil, target_segments = nil, target_root = nil, resolved_segments = nil, resolved_path = nil; + + + + if (start == null) { + start = nil; + }; + target = self.$posixify(target); + start = self.$posixify(start); + uri_prefix = nil; + if ($truthy(($truthy($a = start['$nil_or_empty?']()) ? $a : self['$web_root?'](target)))) { + } else { + + target = (function() {if ($truthy(start['$end_with?']($$($nesting, 'SLASH')))) { + return "" + (start) + (target) + } else { + return "" + (start) + ($$($nesting, 'SLASH')) + (target) + }; return nil; })(); + if ($truthy((uri_prefix = $$($nesting, 'Helpers').$uri_prefix(target)))) { + target = target['$[]'](Opal.Range.$new(uri_prefix.$length(), -1, false))}; + }; + $b = self.$partition_path(target, true), $a = Opal.to_ary($b), (target_segments = ($a[0] == null ? nil : $a[0])), (target_root = ($a[1] == null ? nil : $a[1])), $b; + resolved_segments = []; + $send(target_segments, 'each', [], (TMP_17 = function(segment){var self = TMP_17.$$s || this, $c; + + + + if (segment == null) { + segment = nil; + }; + if (segment['$==']($$($nesting, 'DOT_DOT'))) { + if ($truthy(resolved_segments['$empty?']())) { + if ($truthy(($truthy($c = target_root) ? target_root['$!=']($$($nesting, 'DOT_SLASH')) : $c))) { + return nil + } else { + return resolved_segments['$<<'](segment) + } + } else if (resolved_segments['$[]'](-1)['$==']($$($nesting, 'DOT_DOT'))) { + return resolved_segments['$<<'](segment) + } else { + return resolved_segments.$pop() + } + } else { + return resolved_segments['$<<'](segment) + };}, TMP_17.$$s = self, TMP_17.$$arity = 1, TMP_17)); + if ($truthy((resolved_path = self.$join_path(resolved_segments, target_root))['$include?'](" "))) { + resolved_path = resolved_path.$gsub(" ", "%20")}; + if ($truthy(uri_prefix)) { + return "" + (uri_prefix) + (resolved_path) + } else { + return resolved_path + }; + }, TMP_PathResolver_web_path_16.$$arity = -2), nil) && 'web_path'; + })($nesting[0], null, $nesting) + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/reader"] = function(Opal) { + function $rb_plus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); + } + function $rb_gt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); + } + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + function $rb_times(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs * rhs : lhs['$*'](rhs); + } + function $rb_lt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); + } + function $rb_ge(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs >= rhs : lhs['$>='](rhs); + } + function $rb_divide(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs / rhs : lhs['$/'](rhs); + } + function $rb_le(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs <= rhs : lhs['$<='](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $hash2 = Opal.hash2, $truthy = Opal.truthy, $send = Opal.send, $gvars = Opal.gvars, $hash = Opal.hash; + + Opal.add_stubs(['$include', '$attr_reader', '$+', '$attr_accessor', '$!', '$===', '$split', '$file', '$dir', '$dirname', '$path', '$basename', '$lineno', '$prepare_lines', '$drop', '$[]', '$normalize_lines_from_string', '$normalize_lines_array', '$empty?', '$nil_or_empty?', '$peek_line', '$>', '$slice', '$length', '$process_line', '$times', '$shift', '$read_line', '$<<', '$-', '$unshift_all', '$has_more_lines?', '$join', '$read_lines', '$unshift', '$start_with?', '$==', '$*', '$read_lines_until', '$size', '$clear', '$cursor', '$[]=', '$!=', '$fetch', '$cursor_at_mark', '$warn', '$logger', '$message_with_context', '$new', '$each', '$instance_variables', '$instance_variable_get', '$dup', '$instance_variable_set', '$to_i', '$attributes', '$<', '$catalog', '$skip_front_matter!', '$pop', '$adjust_indentation!', '$attr', '$end_with?', '$include?', '$=~', '$preprocess_conditional_directive', '$preprocess_include_directive', '$pop_include', '$downcase', '$error', '$none?', '$key?', '$any?', '$all?', '$strip', '$resolve_expr_val', '$send', '$to_sym', '$replace_next_line', '$rstrip', '$sub_attributes', '$attribute_missing', '$include_processors?', '$find', '$handles?', '$instance', '$process_method', '$parse_attributes', '$>=', '$safe', '$resolve_include_path', '$split_delimited_value', '$/', '$to_a', '$uniq', '$sort', '$open', '$each_line', '$infinite?', '$push_include', '$delete', '$value?', '$force_encoding', '$create_include_cursor', '$rindex', '$delete_at', '$nil?', '$keys', '$read', '$uriish?', '$attr?', '$require_library', '$parse', '$normalize_system_path', '$file?', '$relative_path', '$path_resolver', '$base_dir', '$to_s', '$path=', '$extname', '$rootname', '$<=', '$to_f', '$extensions?', '$extensions', '$include_processors', '$class', '$object_id', '$inspect', '$map']); + return (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + + (function($base, $super, $parent_nesting) { + function $Reader(){}; + var self = $Reader = $klass($base, $super, 'Reader', $Reader); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Reader_initialize_4, TMP_Reader_prepare_lines_5, TMP_Reader_process_line_6, TMP_Reader_has_more_lines$q_7, TMP_Reader_empty$q_8, TMP_Reader_next_line_empty$q_9, TMP_Reader_peek_line_10, TMP_Reader_peek_lines_11, TMP_Reader_read_line_13, TMP_Reader_read_lines_14, TMP_Reader_read_15, TMP_Reader_advance_16, TMP_Reader_unshift_line_17, TMP_Reader_unshift_lines_18, TMP_Reader_replace_next_line_19, TMP_Reader_skip_blank_lines_20, TMP_Reader_skip_comment_lines_21, TMP_Reader_skip_line_comments_22, TMP_Reader_terminate_23, TMP_Reader_read_lines_until_24, TMP_Reader_shift_25, TMP_Reader_unshift_26, TMP_Reader_unshift_all_27, TMP_Reader_cursor_28, TMP_Reader_cursor_at_line_29, TMP_Reader_cursor_at_mark_30, TMP_Reader_cursor_before_mark_31, TMP_Reader_cursor_at_prev_line_32, TMP_Reader_mark_33, TMP_Reader_line_info_34, TMP_Reader_lines_35, TMP_Reader_string_36, TMP_Reader_source_37, TMP_Reader_save_38, TMP_Reader_restore_save_40, TMP_Reader_discard_save_42; + + def.file = def.lines = def.process_lines = def.look_ahead = def.unescape_next_line = def.lineno = def.dir = def.path = def.mark = def.source_lines = def.saved = nil; + + self.$include($$($nesting, 'Logging')); + (function($base, $super, $parent_nesting) { + function $Cursor(){}; + var self = $Cursor = $klass($base, $super, 'Cursor', $Cursor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Cursor_initialize_1, TMP_Cursor_advance_2, TMP_Cursor_line_info_3; + + def.lineno = def.path = nil; + + self.$attr_reader("file", "dir", "path", "lineno"); + + Opal.def(self, '$initialize', TMP_Cursor_initialize_1 = function $$initialize(file, dir, path, lineno) { + var $a, self = this; + + + + if (dir == null) { + dir = nil; + }; + + if (path == null) { + path = nil; + }; + + if (lineno == null) { + lineno = 1; + }; + return $a = [file, dir, path, lineno], (self.file = $a[0]), (self.dir = $a[1]), (self.path = $a[2]), (self.lineno = $a[3]), $a; + }, TMP_Cursor_initialize_1.$$arity = -2); + + Opal.def(self, '$advance', TMP_Cursor_advance_2 = function $$advance(num) { + var self = this; + + return (self.lineno = $rb_plus(self.lineno, num)) + }, TMP_Cursor_advance_2.$$arity = 1); + + Opal.def(self, '$line_info', TMP_Cursor_line_info_3 = function $$line_info() { + var self = this; + + return "" + (self.path) + ": line " + (self.lineno) + }, TMP_Cursor_line_info_3.$$arity = 0); + return Opal.alias(self, "to_s", "line_info"); + })($nesting[0], null, $nesting); + self.$attr_reader("file"); + self.$attr_reader("dir"); + self.$attr_reader("path"); + self.$attr_reader("lineno"); + self.$attr_reader("source_lines"); + self.$attr_accessor("process_lines"); + self.$attr_accessor("unterminated"); + + Opal.def(self, '$initialize', TMP_Reader_initialize_4 = function $$initialize(data, cursor, opts) { + var $a, $b, self = this; + + + + if (data == null) { + data = nil; + }; + + if (cursor == null) { + cursor = nil; + }; + + if (opts == null) { + opts = $hash2([], {}); + }; + if ($truthy(cursor['$!']())) { + + self.file = nil; + self.dir = "."; + self.path = ""; + self.lineno = 1; + } else if ($truthy($$$('::', 'String')['$==='](cursor))) { + + self.file = cursor; + $b = $$$('::', 'File').$split(self.file), $a = Opal.to_ary($b), (self.dir = ($a[0] == null ? nil : $a[0])), (self.path = ($a[1] == null ? nil : $a[1])), $b; + self.lineno = 1; + } else { + + if ($truthy((self.file = cursor.$file()))) { + + self.dir = ($truthy($a = cursor.$dir()) ? $a : $$$('::', 'File').$dirname(self.file)); + self.path = ($truthy($a = cursor.$path()) ? $a : $$$('::', 'File').$basename(self.file)); + } else { + + self.dir = ($truthy($a = cursor.$dir()) ? $a : "."); + self.path = ($truthy($a = cursor.$path()) ? $a : ""); + }; + self.lineno = ($truthy($a = cursor.$lineno()) ? $a : 1); + }; + self.lines = (function() {if ($truthy(data)) { + + return self.$prepare_lines(data, opts); + } else { + return [] + }; return nil; })(); + self.source_lines = self.lines.$drop(0); + self.mark = nil; + self.look_ahead = 0; + self.process_lines = true; + self.unescape_next_line = false; + self.unterminated = nil; + return (self.saved = nil); + }, TMP_Reader_initialize_4.$$arity = -1); + + Opal.def(self, '$prepare_lines', TMP_Reader_prepare_lines_5 = function $$prepare_lines(data, opts) { + var self = this; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + if ($truthy($$$('::', 'String')['$==='](data))) { + if ($truthy(opts['$[]']("normalize"))) { + return $$($nesting, 'Helpers').$normalize_lines_from_string(data) + } else { + return data.$split($$($nesting, 'LF'), -1) + } + } else if ($truthy(opts['$[]']("normalize"))) { + return $$($nesting, 'Helpers').$normalize_lines_array(data) + } else { + return data.$drop(0) + }; + }, TMP_Reader_prepare_lines_5.$$arity = -2); + + Opal.def(self, '$process_line', TMP_Reader_process_line_6 = function $$process_line(line) { + var self = this; + + + if ($truthy(self.process_lines)) { + self.look_ahead = $rb_plus(self.look_ahead, 1)}; + return line; + }, TMP_Reader_process_line_6.$$arity = 1); + + Opal.def(self, '$has_more_lines?', TMP_Reader_has_more_lines$q_7 = function() { + var self = this; + + if ($truthy(self.lines['$empty?']())) { + + self.look_ahead = 0; + return false; + } else { + return true + } + }, TMP_Reader_has_more_lines$q_7.$$arity = 0); + + Opal.def(self, '$empty?', TMP_Reader_empty$q_8 = function() { + var self = this; + + if ($truthy(self.lines['$empty?']())) { + + self.look_ahead = 0; + return true; + } else { + return false + } + }, TMP_Reader_empty$q_8.$$arity = 0); + Opal.alias(self, "eof?", "empty?"); + + Opal.def(self, '$next_line_empty?', TMP_Reader_next_line_empty$q_9 = function() { + var self = this; + + return self.$peek_line()['$nil_or_empty?']() + }, TMP_Reader_next_line_empty$q_9.$$arity = 0); + + Opal.def(self, '$peek_line', TMP_Reader_peek_line_10 = function $$peek_line(direct) { + var $a, self = this, line = nil; + + + + if (direct == null) { + direct = false; + }; + if ($truthy(($truthy($a = direct) ? $a : $rb_gt(self.look_ahead, 0)))) { + if ($truthy(self.unescape_next_line)) { + + return (line = self.lines['$[]'](0)).$slice(1, line.$length()); + } else { + return self.lines['$[]'](0) + } + } else if ($truthy(self.lines['$empty?']())) { + + self.look_ahead = 0; + return nil; + } else if ($truthy((line = self.$process_line(self.lines['$[]'](0))))) { + return line + } else { + return self.$peek_line() + }; + }, TMP_Reader_peek_line_10.$$arity = -1); + + Opal.def(self, '$peek_lines', TMP_Reader_peek_lines_11 = function $$peek_lines(num, direct) { + var $a, TMP_12, self = this, old_look_ahead = nil, result = nil; + + + + if (num == null) { + num = nil; + }; + + if (direct == null) { + direct = false; + }; + old_look_ahead = self.look_ahead; + result = []; + (function(){var $brk = Opal.new_brk(); try {return $send(($truthy($a = num) ? $a : $$($nesting, 'MAX_INT')), 'times', [], (TMP_12 = function(){var self = TMP_12.$$s || this, line = nil; + if (self.lineno == null) self.lineno = nil; + + if ($truthy((line = (function() {if ($truthy(direct)) { + return self.$shift() + } else { + return self.$read_line() + }; return nil; })()))) { + return result['$<<'](line) + } else { + + if ($truthy(direct)) { + self.lineno = $rb_minus(self.lineno, 1)}; + + Opal.brk(nil, $brk); + }}, TMP_12.$$s = self, TMP_12.$$brk = $brk, TMP_12.$$arity = 0, TMP_12)) + } catch (err) { if (err === $brk) { return err.$v } else { throw err } }})(); + if ($truthy(result['$empty?']())) { + } else { + + self.$unshift_all(result); + if ($truthy(direct)) { + self.look_ahead = old_look_ahead}; + }; + return result; + }, TMP_Reader_peek_lines_11.$$arity = -1); + + Opal.def(self, '$read_line', TMP_Reader_read_line_13 = function $$read_line() { + var $a, self = this; + + if ($truthy(($truthy($a = $rb_gt(self.look_ahead, 0)) ? $a : self['$has_more_lines?']()))) { + return self.$shift() + } else { + return nil + } + }, TMP_Reader_read_line_13.$$arity = 0); + + Opal.def(self, '$read_lines', TMP_Reader_read_lines_14 = function $$read_lines() { + var $a, self = this, lines = nil; + + + lines = []; + while ($truthy(self['$has_more_lines?']())) { + lines['$<<'](self.$shift()) + }; + return lines; + }, TMP_Reader_read_lines_14.$$arity = 0); + Opal.alias(self, "readlines", "read_lines"); + + Opal.def(self, '$read', TMP_Reader_read_15 = function $$read() { + var self = this; + + return self.$read_lines().$join($$($nesting, 'LF')) + }, TMP_Reader_read_15.$$arity = 0); + + Opal.def(self, '$advance', TMP_Reader_advance_16 = function $$advance() { + var self = this; + + if ($truthy(self.$shift())) { + return true + } else { + return false + } + }, TMP_Reader_advance_16.$$arity = 0); + + Opal.def(self, '$unshift_line', TMP_Reader_unshift_line_17 = function $$unshift_line(line_to_restore) { + var self = this; + + + self.$unshift(line_to_restore); + return nil; + }, TMP_Reader_unshift_line_17.$$arity = 1); + Opal.alias(self, "restore_line", "unshift_line"); + + Opal.def(self, '$unshift_lines', TMP_Reader_unshift_lines_18 = function $$unshift_lines(lines_to_restore) { + var self = this; + + + self.$unshift_all(lines_to_restore); + return nil; + }, TMP_Reader_unshift_lines_18.$$arity = 1); + Opal.alias(self, "restore_lines", "unshift_lines"); + + Opal.def(self, '$replace_next_line', TMP_Reader_replace_next_line_19 = function $$replace_next_line(replacement) { + var self = this; + + + self.$shift(); + self.$unshift(replacement); + return true; + }, TMP_Reader_replace_next_line_19.$$arity = 1); + Opal.alias(self, "replace_line", "replace_next_line"); + + Opal.def(self, '$skip_blank_lines', TMP_Reader_skip_blank_lines_20 = function $$skip_blank_lines() { + var $a, self = this, num_skipped = nil, next_line = nil; + + + if ($truthy(self['$empty?']())) { + return nil}; + num_skipped = 0; + while ($truthy((next_line = self.$peek_line()))) { + if ($truthy(next_line['$empty?']())) { + + self.$shift(); + num_skipped = $rb_plus(num_skipped, 1); + } else { + return num_skipped + } + }; + }, TMP_Reader_skip_blank_lines_20.$$arity = 0); + + Opal.def(self, '$skip_comment_lines', TMP_Reader_skip_comment_lines_21 = function $$skip_comment_lines() { + var $a, $b, self = this, next_line = nil, ll = nil; + + + if ($truthy(self['$empty?']())) { + return nil}; + while ($truthy(($truthy($b = (next_line = self.$peek_line())) ? next_line['$empty?']()['$!']() : $b))) { + if ($truthy(next_line['$start_with?']("//"))) { + if ($truthy(next_line['$start_with?']("///"))) { + if ($truthy(($truthy($b = $rb_gt((ll = next_line.$length()), 3)) ? next_line['$==']($rb_times("/", ll)) : $b))) { + self.$read_lines_until($hash2(["terminator", "skip_first_line", "read_last_line", "skip_processing", "context"], {"terminator": next_line, "skip_first_line": true, "read_last_line": true, "skip_processing": true, "context": "comment"})) + } else { + break; + } + } else { + self.$shift() + } + } else { + break; + } + }; + return nil; + }, TMP_Reader_skip_comment_lines_21.$$arity = 0); + + Opal.def(self, '$skip_line_comments', TMP_Reader_skip_line_comments_22 = function $$skip_line_comments() { + var $a, $b, self = this, comment_lines = nil, next_line = nil; + + + if ($truthy(self['$empty?']())) { + return []}; + comment_lines = []; + while ($truthy(($truthy($b = (next_line = self.$peek_line())) ? next_line['$empty?']()['$!']() : $b))) { + if ($truthy(next_line['$start_with?']("//"))) { + comment_lines['$<<'](self.$shift()) + } else { + break; + } + }; + return comment_lines; + }, TMP_Reader_skip_line_comments_22.$$arity = 0); + + Opal.def(self, '$terminate', TMP_Reader_terminate_23 = function $$terminate() { + var self = this; + + + self.lineno = $rb_plus(self.lineno, self.lines.$size()); + self.lines.$clear(); + self.look_ahead = 0; + return nil; + }, TMP_Reader_terminate_23.$$arity = 0); + + Opal.def(self, '$read_lines_until', TMP_Reader_read_lines_until_24 = function $$read_lines_until(options) { + var $a, $b, $c, $d, $iter = TMP_Reader_read_lines_until_24.$$p, $yield = $iter || nil, self = this, result = nil, restore_process_lines = nil, terminator = nil, start_cursor = nil, break_on_blank_lines = nil, break_on_list_continuation = nil, skip_comments = nil, complete = nil, line_read = nil, line_restored = nil, line = nil, $writer = nil, context = nil; + + if ($iter) TMP_Reader_read_lines_until_24.$$p = null; + + + if (options == null) { + options = $hash2([], {}); + }; + result = []; + if ($truthy(($truthy($a = self.process_lines) ? options['$[]']("skip_processing") : $a))) { + + self.process_lines = false; + restore_process_lines = true;}; + if ($truthy((terminator = options['$[]']("terminator")))) { + + start_cursor = ($truthy($a = options['$[]']("cursor")) ? $a : self.$cursor()); + break_on_blank_lines = false; + break_on_list_continuation = false; + } else { + + break_on_blank_lines = options['$[]']("break_on_blank_lines"); + break_on_list_continuation = options['$[]']("break_on_list_continuation"); + }; + skip_comments = options['$[]']("skip_line_comments"); + complete = (line_read = (line_restored = nil)); + if ($truthy(options['$[]']("skip_first_line"))) { + self.$shift()}; + while ($truthy(($truthy($b = complete['$!']()) ? (line = self.$read_line()) : $b))) { + + complete = (function() {while ($truthy(true)) { + + if ($truthy(($truthy($c = terminator) ? line['$=='](terminator) : $c))) { + return true}; + if ($truthy(($truthy($c = break_on_blank_lines) ? line['$empty?']() : $c))) { + return true}; + if ($truthy(($truthy($c = ($truthy($d = break_on_list_continuation) ? line_read : $d)) ? line['$==']($$($nesting, 'LIST_CONTINUATION')) : $c))) { + + + $writer = ["preserve_last_line", true]; + $send(options, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + return true;}; + if ($truthy((($c = ($yield !== nil)) ? Opal.yield1($yield, line) : ($yield !== nil)))) { + return true}; + return false; + }; return nil; })(); + if ($truthy(complete)) { + + if ($truthy(options['$[]']("read_last_line"))) { + + result['$<<'](line); + line_read = true;}; + if ($truthy(options['$[]']("preserve_last_line"))) { + + self.$unshift(line); + line_restored = true;}; + } else if ($truthy(($truthy($b = ($truthy($c = skip_comments) ? line['$start_with?']("//") : $c)) ? line['$start_with?']("///")['$!']() : $b))) { + } else { + + result['$<<'](line); + line_read = true; + }; + }; + if ($truthy(restore_process_lines)) { + + self.process_lines = true; + if ($truthy(($truthy($a = line_restored) ? terminator['$!']() : $a))) { + self.look_ahead = $rb_minus(self.look_ahead, 1)};}; + if ($truthy(($truthy($a = ($truthy($b = terminator) ? terminator['$!='](line) : $b)) ? (context = options.$fetch("context", terminator)) : $a))) { + + if (start_cursor['$==']("at_mark")) { + start_cursor = self.$cursor_at_mark()}; + self.$logger().$warn(self.$message_with_context("" + "unterminated " + (context) + " block", $hash2(["source_location"], {"source_location": start_cursor}))); + self.unterminated = true;}; + return result; + }, TMP_Reader_read_lines_until_24.$$arity = -1); + + Opal.def(self, '$shift', TMP_Reader_shift_25 = function $$shift() { + var self = this; + + + self.lineno = $rb_plus(self.lineno, 1); + if (self.look_ahead['$=='](0)) { + } else { + self.look_ahead = $rb_minus(self.look_ahead, 1) + }; + return self.lines.$shift(); + }, TMP_Reader_shift_25.$$arity = 0); + + Opal.def(self, '$unshift', TMP_Reader_unshift_26 = function $$unshift(line) { + var self = this; + + + self.lineno = $rb_minus(self.lineno, 1); + self.look_ahead = $rb_plus(self.look_ahead, 1); + return self.lines.$unshift(line); + }, TMP_Reader_unshift_26.$$arity = 1); + + Opal.def(self, '$unshift_all', TMP_Reader_unshift_all_27 = function $$unshift_all(lines) { + var self = this; + + + self.lineno = $rb_minus(self.lineno, lines.$size()); + self.look_ahead = $rb_plus(self.look_ahead, lines.$size()); + return $send(self.lines, 'unshift', Opal.to_a(lines)); + }, TMP_Reader_unshift_all_27.$$arity = 1); + + Opal.def(self, '$cursor', TMP_Reader_cursor_28 = function $$cursor() { + var self = this; + + return $$($nesting, 'Cursor').$new(self.file, self.dir, self.path, self.lineno) + }, TMP_Reader_cursor_28.$$arity = 0); + + Opal.def(self, '$cursor_at_line', TMP_Reader_cursor_at_line_29 = function $$cursor_at_line(lineno) { + var self = this; + + return $$($nesting, 'Cursor').$new(self.file, self.dir, self.path, lineno) + }, TMP_Reader_cursor_at_line_29.$$arity = 1); + + Opal.def(self, '$cursor_at_mark', TMP_Reader_cursor_at_mark_30 = function $$cursor_at_mark() { + var self = this; + + if ($truthy(self.mark)) { + return $send($$($nesting, 'Cursor'), 'new', Opal.to_a(self.mark)) + } else { + return self.$cursor() + } + }, TMP_Reader_cursor_at_mark_30.$$arity = 0); + + Opal.def(self, '$cursor_before_mark', TMP_Reader_cursor_before_mark_31 = function $$cursor_before_mark() { + var $a, $b, self = this, m_file = nil, m_dir = nil, m_path = nil, m_lineno = nil; + + if ($truthy(self.mark)) { + + $b = self.mark, $a = Opal.to_ary($b), (m_file = ($a[0] == null ? nil : $a[0])), (m_dir = ($a[1] == null ? nil : $a[1])), (m_path = ($a[2] == null ? nil : $a[2])), (m_lineno = ($a[3] == null ? nil : $a[3])), $b; + return $$($nesting, 'Cursor').$new(m_file, m_dir, m_path, $rb_minus(m_lineno, 1)); + } else { + return $$($nesting, 'Cursor').$new(self.file, self.dir, self.path, $rb_minus(self.lineno, 1)) + } + }, TMP_Reader_cursor_before_mark_31.$$arity = 0); + + Opal.def(self, '$cursor_at_prev_line', TMP_Reader_cursor_at_prev_line_32 = function $$cursor_at_prev_line() { + var self = this; + + return $$($nesting, 'Cursor').$new(self.file, self.dir, self.path, $rb_minus(self.lineno, 1)) + }, TMP_Reader_cursor_at_prev_line_32.$$arity = 0); + + Opal.def(self, '$mark', TMP_Reader_mark_33 = function $$mark() { + var self = this; + + return (self.mark = [self.file, self.dir, self.path, self.lineno]) + }, TMP_Reader_mark_33.$$arity = 0); + + Opal.def(self, '$line_info', TMP_Reader_line_info_34 = function $$line_info() { + var self = this; + + return "" + (self.path) + ": line " + (self.lineno) + }, TMP_Reader_line_info_34.$$arity = 0); + + Opal.def(self, '$lines', TMP_Reader_lines_35 = function $$lines() { + var self = this; + + return self.lines.$drop(0) + }, TMP_Reader_lines_35.$$arity = 0); + + Opal.def(self, '$string', TMP_Reader_string_36 = function $$string() { + var self = this; + + return self.lines.$join($$($nesting, 'LF')) + }, TMP_Reader_string_36.$$arity = 0); + + Opal.def(self, '$source', TMP_Reader_source_37 = function $$source() { + var self = this; + + return self.source_lines.$join($$($nesting, 'LF')) + }, TMP_Reader_source_37.$$arity = 0); + + Opal.def(self, '$save', TMP_Reader_save_38 = function $$save() { + var TMP_39, self = this, accum = nil; + + + accum = $hash2([], {}); + $send(self.$instance_variables(), 'each', [], (TMP_39 = function(name){var self = TMP_39.$$s || this, $a, $writer = nil, val = nil; + + + + if (name == null) { + name = nil; + }; + if ($truthy(($truthy($a = name['$==']("@saved")) ? $a : name['$==']("@source_lines")))) { + return nil + } else { + + $writer = [name, (function() {if ($truthy($$$('::', 'Array')['$===']((val = self.$instance_variable_get(name))))) { + return val.$dup() + } else { + return val + }; return nil; })()]; + $send(accum, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + };}, TMP_39.$$s = self, TMP_39.$$arity = 1, TMP_39)); + self.saved = accum; + return nil; + }, TMP_Reader_save_38.$$arity = 0); + + Opal.def(self, '$restore_save', TMP_Reader_restore_save_40 = function $$restore_save() { + var TMP_41, self = this; + + if ($truthy(self.saved)) { + + $send(self.saved, 'each', [], (TMP_41 = function(name, val){var self = TMP_41.$$s || this; + + + + if (name == null) { + name = nil; + }; + + if (val == null) { + val = nil; + }; + return self.$instance_variable_set(name, val);}, TMP_41.$$s = self, TMP_41.$$arity = 2, TMP_41)); + return (self.saved = nil); + } else { + return nil + } + }, TMP_Reader_restore_save_40.$$arity = 0); + + Opal.def(self, '$discard_save', TMP_Reader_discard_save_42 = function $$discard_save() { + var self = this; + + return (self.saved = nil) + }, TMP_Reader_discard_save_42.$$arity = 0); + return Opal.alias(self, "to_s", "line_info"); + })($nesting[0], null, $nesting); + (function($base, $super, $parent_nesting) { + function $PreprocessorReader(){}; + var self = $PreprocessorReader = $klass($base, $super, 'PreprocessorReader', $PreprocessorReader); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_PreprocessorReader_initialize_43, TMP_PreprocessorReader_prepare_lines_44, TMP_PreprocessorReader_process_line_45, TMP_PreprocessorReader_has_more_lines$q_46, TMP_PreprocessorReader_empty$q_47, TMP_PreprocessorReader_peek_line_48, TMP_PreprocessorReader_preprocess_conditional_directive_49, TMP_PreprocessorReader_preprocess_include_directive_54, TMP_PreprocessorReader_resolve_include_path_66, TMP_PreprocessorReader_push_include_67, TMP_PreprocessorReader_create_include_cursor_68, TMP_PreprocessorReader_pop_include_69, TMP_PreprocessorReader_include_depth_70, TMP_PreprocessorReader_exceeded_max_depth$q_71, TMP_PreprocessorReader_shift_72, TMP_PreprocessorReader_split_delimited_value_73, TMP_PreprocessorReader_skip_front_matter$B_74, TMP_PreprocessorReader_resolve_expr_val_75, TMP_PreprocessorReader_include_processors$q_76, TMP_PreprocessorReader_to_s_77; + + def.document = def.lineno = def.process_lines = def.look_ahead = def.skipping = def.include_stack = def.conditional_stack = def.path = def.include_processor_extensions = def.maxdepth = def.dir = def.lines = def.file = def.includes = def.unescape_next_line = nil; + + self.$attr_reader("include_stack"); + + Opal.def(self, '$initialize', TMP_PreprocessorReader_initialize_43 = function $$initialize(document, data, cursor, opts) { + var $iter = TMP_PreprocessorReader_initialize_43.$$p, $yield = $iter || nil, self = this, include_depth_default = nil; + + if ($iter) TMP_PreprocessorReader_initialize_43.$$p = null; + + + if (data == null) { + data = nil; + }; + + if (cursor == null) { + cursor = nil; + }; + + if (opts == null) { + opts = $hash2([], {}); + }; + self.document = document; + $send(self, Opal.find_super_dispatcher(self, 'initialize', TMP_PreprocessorReader_initialize_43, false), [data, cursor, opts], null); + include_depth_default = document.$attributes().$fetch("max-include-depth", 64).$to_i(); + if ($truthy($rb_lt(include_depth_default, 0))) { + include_depth_default = 0}; + self.maxdepth = $hash2(["abs", "rel"], {"abs": include_depth_default, "rel": include_depth_default}); + self.include_stack = []; + self.includes = document.$catalog()['$[]']("includes"); + self.skipping = false; + self.conditional_stack = []; + return (self.include_processor_extensions = nil); + }, TMP_PreprocessorReader_initialize_43.$$arity = -2); + + Opal.def(self, '$prepare_lines', TMP_PreprocessorReader_prepare_lines_44 = function $$prepare_lines(data, opts) { + var $a, $b, $iter = TMP_PreprocessorReader_prepare_lines_44.$$p, $yield = $iter || nil, self = this, result = nil, front_matter = nil, $writer = nil, first = nil, last = nil, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_PreprocessorReader_prepare_lines_44.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + + + if (opts == null) { + opts = $hash2([], {}); + }; + result = $send(self, Opal.find_super_dispatcher(self, 'prepare_lines', TMP_PreprocessorReader_prepare_lines_44, false), $zuper, $iter); + if ($truthy(($truthy($a = self.document) ? self.document.$attributes()['$[]']("skip-front-matter") : $a))) { + if ($truthy((front_matter = self['$skip_front_matter!'](result)))) { + + $writer = ["front-matter", front_matter.$join($$($nesting, 'LF'))]; + $send(self.document.$attributes(), '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}}; + if ($truthy(opts.$fetch("condense", true))) { + + while ($truthy(($truthy($b = (first = result['$[]'](0))) ? first['$empty?']() : $b))) { + ($truthy($b = result.$shift()) ? (self.lineno = $rb_plus(self.lineno, 1)) : $b) + }; + while ($truthy(($truthy($b = (last = result['$[]'](-1))) ? last['$empty?']() : $b))) { + result.$pop() + };}; + if ($truthy(opts['$[]']("indent"))) { + $$($nesting, 'Parser')['$adjust_indentation!'](result, opts['$[]']("indent"), self.document.$attr("tabsize"))}; + return result; + }, TMP_PreprocessorReader_prepare_lines_44.$$arity = -2); + + Opal.def(self, '$process_line', TMP_PreprocessorReader_process_line_45 = function $$process_line(line) { + var $a, $b, self = this; + + + if ($truthy(self.process_lines)) { + } else { + return line + }; + if ($truthy(line['$empty?']())) { + + self.look_ahead = $rb_plus(self.look_ahead, 1); + return line;}; + if ($truthy(($truthy($a = ($truthy($b = line['$end_with?']("]")) ? line['$start_with?']("[")['$!']() : $b)) ? line['$include?']("::") : $a))) { + if ($truthy(($truthy($a = line['$include?']("if")) ? $$($nesting, 'ConditionalDirectiveRx')['$=~'](line) : $a))) { + if ((($a = $gvars['~']) === nil ? nil : $a['$[]'](1))['$==']("\\")) { + + self.unescape_next_line = true; + self.look_ahead = $rb_plus(self.look_ahead, 1); + return line.$slice(1, line.$length()); + } else if ($truthy(self.$preprocess_conditional_directive((($a = $gvars['~']) === nil ? nil : $a['$[]'](2)), (($a = $gvars['~']) === nil ? nil : $a['$[]'](3)), (($a = $gvars['~']) === nil ? nil : $a['$[]'](4)), (($a = $gvars['~']) === nil ? nil : $a['$[]'](5))))) { + + self.$shift(); + return nil; + } else { + + self.look_ahead = $rb_plus(self.look_ahead, 1); + return line; + } + } else if ($truthy(self.skipping)) { + + self.$shift(); + return nil; + } else if ($truthy(($truthy($a = line['$start_with?']("inc", "\\inc")) ? $$($nesting, 'IncludeDirectiveRx')['$=~'](line) : $a))) { + if ((($a = $gvars['~']) === nil ? nil : $a['$[]'](1))['$==']("\\")) { + + self.unescape_next_line = true; + self.look_ahead = $rb_plus(self.look_ahead, 1); + return line.$slice(1, line.$length()); + } else if ($truthy(self.$preprocess_include_directive((($a = $gvars['~']) === nil ? nil : $a['$[]'](2)), (($a = $gvars['~']) === nil ? nil : $a['$[]'](3))))) { + return nil + } else { + + self.look_ahead = $rb_plus(self.look_ahead, 1); + return line; + } + } else { + + self.look_ahead = $rb_plus(self.look_ahead, 1); + return line; + } + } else if ($truthy(self.skipping)) { + + self.$shift(); + return nil; + } else { + + self.look_ahead = $rb_plus(self.look_ahead, 1); + return line; + }; + }, TMP_PreprocessorReader_process_line_45.$$arity = 1); + + Opal.def(self, '$has_more_lines?', TMP_PreprocessorReader_has_more_lines$q_46 = function() { + var self = this; + + if ($truthy(self.$peek_line())) { + return true + } else { + return false + } + }, TMP_PreprocessorReader_has_more_lines$q_46.$$arity = 0); + + Opal.def(self, '$empty?', TMP_PreprocessorReader_empty$q_47 = function() { + var self = this; + + if ($truthy(self.$peek_line())) { + return false + } else { + return true + } + }, TMP_PreprocessorReader_empty$q_47.$$arity = 0); + Opal.alias(self, "eof?", "empty?"); + + Opal.def(self, '$peek_line', TMP_PreprocessorReader_peek_line_48 = function $$peek_line(direct) { + var $iter = TMP_PreprocessorReader_peek_line_48.$$p, $yield = $iter || nil, self = this, line = nil, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_PreprocessorReader_peek_line_48.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + + + if (direct == null) { + direct = false; + }; + if ($truthy((line = $send(self, Opal.find_super_dispatcher(self, 'peek_line', TMP_PreprocessorReader_peek_line_48, false), $zuper, $iter)))) { + return line + } else if ($truthy(self.include_stack['$empty?']())) { + return nil + } else { + + self.$pop_include(); + return self.$peek_line(direct); + }; + }, TMP_PreprocessorReader_peek_line_48.$$arity = -1); + + Opal.def(self, '$preprocess_conditional_directive', TMP_PreprocessorReader_preprocess_conditional_directive_49 = function $$preprocess_conditional_directive(keyword, target, delimiter, text) { + var $a, $b, $c, TMP_50, TMP_51, TMP_52, TMP_53, self = this, no_target = nil, pair = nil, skip = nil, $case = nil, lhs = nil, op = nil, rhs = nil; + + + if ($truthy((no_target = target['$empty?']()))) { + } else { + target = target.$downcase() + }; + if ($truthy(($truthy($a = ($truthy($b = no_target) ? ($truthy($c = keyword['$==']("ifdef")) ? $c : keyword['$==']("ifndef")) : $b)) ? $a : ($truthy($b = text) ? keyword['$==']("endif") : $b)))) { + return false}; + if (keyword['$==']("endif")) { + + if ($truthy(self.conditional_stack['$empty?']())) { + self.$logger().$error(self.$message_with_context("" + "unmatched macro: endif::" + (target) + "[]", $hash2(["source_location"], {"source_location": self.$cursor()}))) + } else if ($truthy(($truthy($a = no_target) ? $a : target['$==']((pair = self.conditional_stack['$[]'](-1))['$[]']("target"))))) { + + self.conditional_stack.$pop(); + self.skipping = (function() {if ($truthy(self.conditional_stack['$empty?']())) { + return false + } else { + return self.conditional_stack['$[]'](-1)['$[]']("skipping") + }; return nil; })(); + } else { + self.$logger().$error(self.$message_with_context("" + "mismatched macro: endif::" + (target) + "[], expected endif::" + (pair['$[]']("target")) + "[]", $hash2(["source_location"], {"source_location": self.$cursor()}))) + }; + return true;}; + if ($truthy(self.skipping)) { + skip = false + } else { + $case = keyword; + if ("ifdef"['$===']($case)) {$case = delimiter; + if (","['$===']($case)) {skip = $send(target.$split(",", -1), 'none?', [], (TMP_50 = function(name){var self = TMP_50.$$s || this; + if (self.document == null) self.document = nil; + + + + if (name == null) { + name = nil; + }; + return self.document.$attributes()['$key?'](name);}, TMP_50.$$s = self, TMP_50.$$arity = 1, TMP_50))} + else if ("+"['$===']($case)) {skip = $send(target.$split("+", -1), 'any?', [], (TMP_51 = function(name){var self = TMP_51.$$s || this; + if (self.document == null) self.document = nil; + + + + if (name == null) { + name = nil; + }; + return self.document.$attributes()['$key?'](name)['$!']();}, TMP_51.$$s = self, TMP_51.$$arity = 1, TMP_51))} + else {skip = self.document.$attributes()['$key?'](target)['$!']()}} + else if ("ifndef"['$===']($case)) {$case = delimiter; + if (","['$===']($case)) {skip = $send(target.$split(",", -1), 'any?', [], (TMP_52 = function(name){var self = TMP_52.$$s || this; + if (self.document == null) self.document = nil; + + + + if (name == null) { + name = nil; + }; + return self.document.$attributes()['$key?'](name);}, TMP_52.$$s = self, TMP_52.$$arity = 1, TMP_52))} + else if ("+"['$===']($case)) {skip = $send(target.$split("+", -1), 'all?', [], (TMP_53 = function(name){var self = TMP_53.$$s || this; + if (self.document == null) self.document = nil; + + + + if (name == null) { + name = nil; + }; + return self.document.$attributes()['$key?'](name);}, TMP_53.$$s = self, TMP_53.$$arity = 1, TMP_53))} + else {skip = self.document.$attributes()['$key?'](target)}} + else if ("ifeval"['$===']($case)) { + if ($truthy(($truthy($a = no_target) ? $$($nesting, 'EvalExpressionRx')['$=~'](text.$strip()) : $a))) { + } else { + return false + }; + $a = [(($b = $gvars['~']) === nil ? nil : $b['$[]'](1)), (($b = $gvars['~']) === nil ? nil : $b['$[]'](2)), (($b = $gvars['~']) === nil ? nil : $b['$[]'](3))], (lhs = $a[0]), (op = $a[1]), (rhs = $a[2]), $a; + lhs = self.$resolve_expr_val(lhs); + rhs = self.$resolve_expr_val(rhs); + if (op['$==']("!=")) { + skip = lhs.$send("==", rhs) + } else { + skip = lhs.$send(op.$to_sym(), rhs)['$!']() + };} + }; + if ($truthy(($truthy($a = keyword['$==']("ifeval")) ? $a : text['$!']()))) { + + if ($truthy(skip)) { + self.skipping = true}; + self.conditional_stack['$<<']($hash2(["target", "skip", "skipping"], {"target": target, "skip": skip, "skipping": self.skipping})); + } else if ($truthy(($truthy($a = self.skipping) ? $a : skip))) { + } else { + + self.$replace_next_line(text.$rstrip()); + self.$unshift(""); + if ($truthy(text['$start_with?']("include::"))) { + self.look_ahead = $rb_minus(self.look_ahead, 1)}; + }; + return true; + }, TMP_PreprocessorReader_preprocess_conditional_directive_49.$$arity = 4); + + Opal.def(self, '$preprocess_include_directive', TMP_PreprocessorReader_preprocess_include_directive_54 = function $$preprocess_include_directive(target, attrlist) { + var $a, TMP_55, $b, TMP_56, TMP_57, TMP_58, TMP_60, TMP_63, TMP_64, TMP_65, self = this, doc = nil, expanded_target = nil, ext = nil, abs_maxdepth = nil, parsed_attrs = nil, inc_path = nil, target_type = nil, relpath = nil, inc_linenos = nil, inc_tags = nil, tag = nil, inc_lines = nil, inc_offset = nil, inc_lineno = nil, $writer = nil, tag_stack = nil, tags_used = nil, active_tag = nil, select = nil, base_select = nil, wildcard = nil, missing_tags = nil, inc_content = nil; + + + doc = self.document; + if ($truthy(($truthy($a = (expanded_target = target)['$include?']($$($nesting, 'ATTR_REF_HEAD'))) ? (expanded_target = doc.$sub_attributes(target, $hash2(["attribute_missing"], {"attribute_missing": "drop-line"})))['$empty?']() : $a))) { + + self.$shift(); + if (($truthy($a = doc.$attributes()['$[]']("attribute-missing")) ? $a : $$($nesting, 'Compliance').$attribute_missing())['$==']("skip")) { + self.$unshift("" + "Unresolved directive in " + (self.path) + " - include::" + (target) + "[" + (attrlist) + "]")}; + return true; + } else if ($truthy(($truthy($a = self['$include_processors?']()) ? (ext = $send(self.include_processor_extensions, 'find', [], (TMP_55 = function(candidate){var self = TMP_55.$$s || this; + + + + if (candidate == null) { + candidate = nil; + }; + return candidate.$instance()['$handles?'](expanded_target);}, TMP_55.$$s = self, TMP_55.$$arity = 1, TMP_55))) : $a))) { + + self.$shift(); + ext.$process_method()['$[]'](doc, self, expanded_target, doc.$parse_attributes(attrlist, [], $hash2(["sub_input"], {"sub_input": true}))); + return true; + } else if ($truthy($rb_ge(doc.$safe(), $$$($$($nesting, 'SafeMode'), 'SECURE')))) { + return self.$replace_next_line("" + "link:" + (expanded_target) + "[]") + } else if ($truthy($rb_gt((abs_maxdepth = self.maxdepth['$[]']("abs")), 0))) { + + if ($truthy($rb_ge(self.include_stack.$size(), abs_maxdepth))) { + + self.$logger().$error(self.$message_with_context("" + "maximum include depth of " + (self.maxdepth['$[]']("rel")) + " exceeded", $hash2(["source_location"], {"source_location": self.$cursor()}))); + return nil;}; + parsed_attrs = doc.$parse_attributes(attrlist, [], $hash2(["sub_input"], {"sub_input": true})); + $b = self.$resolve_include_path(expanded_target, attrlist, parsed_attrs), $a = Opal.to_ary($b), (inc_path = ($a[0] == null ? nil : $a[0])), (target_type = ($a[1] == null ? nil : $a[1])), (relpath = ($a[2] == null ? nil : $a[2])), $b; + if ($truthy(target_type)) { + } else { + return inc_path + }; + inc_linenos = (inc_tags = nil); + if ($truthy(attrlist)) { + if ($truthy(parsed_attrs['$key?']("lines"))) { + + inc_linenos = []; + $send(self.$split_delimited_value(parsed_attrs['$[]']("lines")), 'each', [], (TMP_56 = function(linedef){var self = TMP_56.$$s || this, $c, $d, from = nil, to = nil; + + + + if (linedef == null) { + linedef = nil; + }; + if ($truthy(linedef['$include?'](".."))) { + + $d = linedef.$split("..", 2), $c = Opal.to_ary($d), (from = ($c[0] == null ? nil : $c[0])), (to = ($c[1] == null ? nil : $c[1])), $d; + return (inc_linenos = $rb_plus(inc_linenos, (function() {if ($truthy(($truthy($c = to['$empty?']()) ? $c : $rb_lt((to = to.$to_i()), 0)))) { + return [from.$to_i(), $rb_divide(1, 0)] + } else { + return $$$('::', 'Range').$new(from.$to_i(), to).$to_a() + }; return nil; })())); + } else { + return inc_linenos['$<<'](linedef.$to_i()) + };}, TMP_56.$$s = self, TMP_56.$$arity = 1, TMP_56)); + inc_linenos = (function() {if ($truthy(inc_linenos['$empty?']())) { + return nil + } else { + return inc_linenos.$sort().$uniq() + }; return nil; })(); + } else if ($truthy(parsed_attrs['$key?']("tag"))) { + if ($truthy(($truthy($a = (tag = parsed_attrs['$[]']("tag"))['$empty?']()) ? $a : tag['$==']("!")))) { + } else { + inc_tags = (function() {if ($truthy(tag['$start_with?']("!"))) { + return $hash(tag.$slice(1, tag.$length()), false) + } else { + return $hash(tag, true) + }; return nil; })() + } + } else if ($truthy(parsed_attrs['$key?']("tags"))) { + + inc_tags = $hash2([], {}); + $send(self.$split_delimited_value(parsed_attrs['$[]']("tags")), 'each', [], (TMP_57 = function(tagdef){var self = TMP_57.$$s || this, $c, $writer = nil; + + + + if (tagdef == null) { + tagdef = nil; + }; + if ($truthy(($truthy($c = tagdef['$empty?']()) ? $c : tagdef['$==']("!")))) { + return nil + } else if ($truthy(tagdef['$start_with?']("!"))) { + + $writer = [tagdef.$slice(1, tagdef.$length()), false]; + $send(inc_tags, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + } else { + + $writer = [tagdef, true]; + $send(inc_tags, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + };}, TMP_57.$$s = self, TMP_57.$$arity = 1, TMP_57)); + if ($truthy(inc_tags['$empty?']())) { + inc_tags = nil};}}; + if ($truthy(inc_linenos)) { + + $a = [[], nil, 0], (inc_lines = $a[0]), (inc_offset = $a[1]), (inc_lineno = $a[2]), $a; + + try { + (function(){var $brk = Opal.new_brk(); try {return $send(self, 'open', [inc_path, "rb"], (TMP_58 = function(f){var self = TMP_58.$$s || this, TMP_59, select_remaining = nil; + + + + if (f == null) { + f = nil; + }; + select_remaining = nil; + return (function(){var $brk = Opal.new_brk(); try {return $send(f, 'each_line', [], (TMP_59 = function(l){var self = TMP_59.$$s || this, $c, $d, select = nil; + + + + if (l == null) { + l = nil; + }; + inc_lineno = $rb_plus(inc_lineno, 1); + if ($truthy(($truthy($c = select_remaining) ? $c : ($truthy($d = $$$('::', 'Float')['$===']((select = inc_linenos['$[]'](0)))) ? (select_remaining = select['$infinite?']()) : $d)))) { + + inc_offset = ($truthy($c = inc_offset) ? $c : inc_lineno); + return inc_lines['$<<'](l); + } else { + + if (select['$=='](inc_lineno)) { + + inc_offset = ($truthy($c = inc_offset) ? $c : inc_lineno); + inc_lines['$<<'](l); + inc_linenos.$shift();}; + if ($truthy(inc_linenos['$empty?']())) { + + Opal.brk(nil, $brk) + } else { + return nil + }; + };}, TMP_59.$$s = self, TMP_59.$$brk = $brk, TMP_59.$$arity = 1, TMP_59)) + } catch (err) { if (err === $brk) { return err.$v } else { throw err } }})();}, TMP_58.$$s = self, TMP_58.$$brk = $brk, TMP_58.$$arity = 1, TMP_58)) + } catch (err) { if (err === $brk) { return err.$v } else { throw err } }})() + } catch ($err) { + if (Opal.rescue($err, [$$($nesting, 'StandardError')])) { + try { + + self.$logger().$error(self.$message_with_context("" + "include " + (target_type) + " not readable: " + (inc_path), $hash2(["source_location"], {"source_location": self.$cursor()}))); + return self.$replace_next_line("" + "Unresolved directive in " + (self.path) + " - include::" + (expanded_target) + "[" + (attrlist) + "]"); + } finally { Opal.pop_exception() } + } else { throw $err; } + };; + self.$shift(); + if ($truthy(inc_offset)) { + + + $writer = ["partial-option", true]; + $send(parsed_attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + self.$push_include(inc_lines, inc_path, relpath, inc_offset, parsed_attrs);}; + } else if ($truthy(inc_tags)) { + + $a = [[], nil, 0, [], $$$('::', 'Set').$new(), nil], (inc_lines = $a[0]), (inc_offset = $a[1]), (inc_lineno = $a[2]), (tag_stack = $a[3]), (tags_used = $a[4]), (active_tag = $a[5]), $a; + if ($truthy(inc_tags['$key?']("**"))) { + if ($truthy(inc_tags['$key?']("*"))) { + + select = (base_select = inc_tags.$delete("**")); + wildcard = inc_tags.$delete("*"); + } else { + select = (base_select = (wildcard = inc_tags.$delete("**"))) + } + } else { + + select = (base_select = inc_tags['$value?'](true)['$!']()); + wildcard = inc_tags.$delete("*"); + }; + + try { + $send(self, 'open', [inc_path, "rb"], (TMP_60 = function(f){var self = TMP_60.$$s || this, $c, TMP_61, dbl_co = nil, dbl_sb = nil, encoding = nil; + + + + if (f == null) { + f = nil; + }; + $c = ["::", "[]"], (dbl_co = $c[0]), (dbl_sb = $c[1]), $c; + if ($truthy($$($nesting, 'COERCE_ENCODING'))) { + encoding = $$$($$$('::', 'Encoding'), 'UTF_8')}; + return $send(f, 'each_line', [], (TMP_61 = function(l){var self = TMP_61.$$s || this, $d, $e, TMP_62, this_tag = nil, include_cursor = nil, idx = nil; + + + + if (l == null) { + l = nil; + }; + inc_lineno = $rb_plus(inc_lineno, 1); + if ($truthy(encoding)) { + l.$force_encoding(encoding)}; + if ($truthy(($truthy($d = ($truthy($e = l['$include?'](dbl_co)) ? l['$include?'](dbl_sb) : $e)) ? $$($nesting, 'TagDirectiveRx')['$=~'](l) : $d))) { + if ($truthy((($d = $gvars['~']) === nil ? nil : $d['$[]'](1)))) { + if ((this_tag = (($d = $gvars['~']) === nil ? nil : $d['$[]'](2)))['$=='](active_tag)) { + + tag_stack.$pop(); + return $e = (function() {if ($truthy(tag_stack['$empty?']())) { + return [nil, base_select] + } else { + return tag_stack['$[]'](-1) + }; return nil; })(), $d = Opal.to_ary($e), (active_tag = ($d[0] == null ? nil : $d[0])), (select = ($d[1] == null ? nil : $d[1])), $e; + } else if ($truthy(inc_tags['$key?'](this_tag))) { + + include_cursor = self.$create_include_cursor(inc_path, expanded_target, inc_lineno); + if ($truthy((idx = $send(tag_stack, 'rindex', [], (TMP_62 = function(key, _){var self = TMP_62.$$s || this; + + + + if (key == null) { + key = nil; + }; + + if (_ == null) { + _ = nil; + }; + return key['$=='](this_tag);}, TMP_62.$$s = self, TMP_62.$$arity = 2, TMP_62))))) { + + if (idx['$=='](0)) { + tag_stack.$shift() + } else { + + tag_stack.$delete_at(idx); + }; + return self.$logger().$warn(self.$message_with_context("" + "mismatched end tag (expected '" + (active_tag) + "' but found '" + (this_tag) + "') at line " + (inc_lineno) + " of include " + (target_type) + ": " + (inc_path), $hash2(["source_location", "include_location"], {"source_location": self.$cursor(), "include_location": include_cursor}))); + } else { + return self.$logger().$warn(self.$message_with_context("" + "unexpected end tag '" + (this_tag) + "' at line " + (inc_lineno) + " of include " + (target_type) + ": " + (inc_path), $hash2(["source_location", "include_location"], {"source_location": self.$cursor(), "include_location": include_cursor}))) + }; + } else { + return nil + } + } else if ($truthy(inc_tags['$key?']((this_tag = (($d = $gvars['~']) === nil ? nil : $d['$[]'](2)))))) { + + tags_used['$<<'](this_tag); + return tag_stack['$<<']([(active_tag = this_tag), (select = inc_tags['$[]'](this_tag)), inc_lineno]); + } else if ($truthy(wildcard['$nil?']()['$!']())) { + + select = (function() {if ($truthy(($truthy($d = active_tag) ? select['$!']() : $d))) { + return false + } else { + return wildcard + }; return nil; })(); + return tag_stack['$<<']([(active_tag = this_tag), select, inc_lineno]); + } else { + return nil + } + } else if ($truthy(select)) { + + inc_offset = ($truthy($d = inc_offset) ? $d : inc_lineno); + return inc_lines['$<<'](l); + } else { + return nil + };}, TMP_61.$$s = self, TMP_61.$$arity = 1, TMP_61));}, TMP_60.$$s = self, TMP_60.$$arity = 1, TMP_60)) + } catch ($err) { + if (Opal.rescue($err, [$$($nesting, 'StandardError')])) { + try { + + self.$logger().$error(self.$message_with_context("" + "include " + (target_type) + " not readable: " + (inc_path), $hash2(["source_location"], {"source_location": self.$cursor()}))); + return self.$replace_next_line("" + "Unresolved directive in " + (self.path) + " - include::" + (expanded_target) + "[" + (attrlist) + "]"); + } finally { Opal.pop_exception() } + } else { throw $err; } + };; + if ($truthy(tag_stack['$empty?']())) { + } else { + $send(tag_stack, 'each', [], (TMP_63 = function(tag_name, _, tag_lineno){var self = TMP_63.$$s || this; + + + + if (tag_name == null) { + tag_name = nil; + }; + + if (_ == null) { + _ = nil; + }; + + if (tag_lineno == null) { + tag_lineno = nil; + }; + return self.$logger().$warn(self.$message_with_context("" + "detected unclosed tag '" + (tag_name) + "' starting at line " + (tag_lineno) + " of include " + (target_type) + ": " + (inc_path), $hash2(["source_location", "include_location"], {"source_location": self.$cursor(), "include_location": self.$create_include_cursor(inc_path, expanded_target, tag_lineno)})));}, TMP_63.$$s = self, TMP_63.$$arity = 3, TMP_63)) + }; + if ($truthy((missing_tags = $rb_minus(inc_tags.$keys().$to_a(), tags_used.$to_a()))['$empty?']())) { + } else { + self.$logger().$warn(self.$message_with_context("" + "tag" + ((function() {if ($truthy($rb_gt(missing_tags.$size(), 1))) { + return "s" + } else { + return "" + }; return nil; })()) + " '" + (missing_tags.$join(", ")) + "' not found in include " + (target_type) + ": " + (inc_path), $hash2(["source_location"], {"source_location": self.$cursor()}))) + }; + self.$shift(); + if ($truthy(inc_offset)) { + + if ($truthy(($truthy($a = ($truthy($b = base_select) ? wildcard : $b)) ? inc_tags['$empty?']() : $a))) { + } else { + + $writer = ["partial-option", true]; + $send(parsed_attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + self.$push_include(inc_lines, inc_path, relpath, inc_offset, parsed_attrs);}; + } else { + + try { + + inc_content = (function() {if (false) { + return $send($$$('::', 'File'), 'open', [inc_path, "rb"], (TMP_64 = function(f){var self = TMP_64.$$s || this; + + + + if (f == null) { + f = nil; + }; + return f.$read();}, TMP_64.$$s = self, TMP_64.$$arity = 1, TMP_64)) + } else { + return $send(self, 'open', [inc_path, "rb"], (TMP_65 = function(f){var self = TMP_65.$$s || this; + + + + if (f == null) { + f = nil; + }; + return f.$read();}, TMP_65.$$s = self, TMP_65.$$arity = 1, TMP_65)) + }; return nil; })(); + self.$shift(); + self.$push_include(inc_content, inc_path, relpath, 1, parsed_attrs); + } catch ($err) { + if (Opal.rescue($err, [$$($nesting, 'StandardError')])) { + try { + + self.$logger().$error(self.$message_with_context("" + "include " + (target_type) + " not readable: " + (inc_path), $hash2(["source_location"], {"source_location": self.$cursor()}))); + return self.$replace_next_line("" + "Unresolved directive in " + (self.path) + " - include::" + (expanded_target) + "[" + (attrlist) + "]"); + } finally { Opal.pop_exception() } + } else { throw $err; } + }; + }; + return true; + } else { + return nil + }; + }, TMP_PreprocessorReader_preprocess_include_directive_54.$$arity = 2); + + Opal.def(self, '$resolve_include_path', TMP_PreprocessorReader_resolve_include_path_66 = function $$resolve_include_path(target, attrlist, attributes) { + var $a, $b, self = this, doc = nil, inc_path = nil, relpath = nil; + + + doc = self.document; + if ($truthy(($truthy($a = $$($nesting, 'Helpers')['$uriish?'](target)) ? $a : (function() {if ($truthy($$$('::', 'String')['$==='](self.dir))) { + return nil + } else { + + return (target = "" + (self.dir) + "/" + (target)); + }; return nil; })()))) { + + if ($truthy(doc['$attr?']("allow-uri-read"))) { + } else { + return self.$replace_next_line("" + "link:" + (target) + "[" + (attrlist) + "]") + }; + if ($truthy(doc['$attr?']("cache-uri"))) { + if ($truthy((($b = $$$('::', 'OpenURI', 'skip_raise')) && ($a = $$$($b, 'Cache', 'skip_raise')) ? 'constant' : nil))) { + } else { + $$($nesting, 'Helpers').$require_library("open-uri/cached", "open-uri-cached") + } + } else if ($truthy($$$('::', 'RUBY_ENGINE_OPAL')['$!']())) { + $$$('::', 'OpenURI')}; + return [$$$('::', 'URI').$parse(target), "uri", target]; + } else { + + inc_path = doc.$normalize_system_path(target, self.dir, nil, $hash2(["target_name"], {"target_name": "include file"})); + if ($truthy($$$('::', 'File')['$file?'](inc_path))) { + } else if ($truthy(attributes['$key?']("optional-option"))) { + + self.$shift(); + return true; + } else { + + self.$logger().$error(self.$message_with_context("" + "include file not found: " + (inc_path), $hash2(["source_location"], {"source_location": self.$cursor()}))); + return self.$replace_next_line("" + "Unresolved directive in " + (self.path) + " - include::" + (target) + "[" + (attrlist) + "]"); + }; + relpath = doc.$path_resolver().$relative_path(inc_path, doc.$base_dir()); + return [inc_path, "file", relpath]; + }; + }, TMP_PreprocessorReader_resolve_include_path_66.$$arity = 3); + + Opal.def(self, '$push_include', TMP_PreprocessorReader_push_include_67 = function $$push_include(data, file, path, lineno, attributes) { + var $a, self = this, $writer = nil, dir = nil, depth = nil, old_leveloffset = nil; + + + + if (file == null) { + file = nil; + }; + + if (path == null) { + path = nil; + }; + + if (lineno == null) { + lineno = 1; + }; + + if (attributes == null) { + attributes = $hash2([], {}); + }; + self.include_stack['$<<']([self.lines, self.file, self.dir, self.path, self.lineno, self.maxdepth, self.process_lines]); + if ($truthy((self.file = file))) { + + if ($truthy($$$('::', 'String')['$==='](file))) { + self.dir = $$$('::', 'File').$dirname(file) + } else if ($truthy($$$('::', 'RUBY_ENGINE_OPAL'))) { + self.dir = $$$('::', 'URI').$parse($$$('::', 'File').$dirname((file = file.$to_s()))) + } else { + + + $writer = [(function() {if ((dir = $$$('::', 'File').$dirname(file.$path()))['$==']("/")) { + return "" + } else { + return dir + }; return nil; })()]; + $send((self.dir = file.$dup()), 'path=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + file = file.$to_s(); + }; + path = ($truthy($a = path) ? $a : $$$('::', 'File').$basename(file)); + self.process_lines = $$($nesting, 'ASCIIDOC_EXTENSIONS')['$[]']($$$('::', 'File').$extname(file)); + } else { + + self.dir = "."; + self.process_lines = true; + }; + if ($truthy(path)) { + + self.path = path; + if ($truthy(self.process_lines)) { + + $writer = [$$($nesting, 'Helpers').$rootname(path), (function() {if ($truthy(attributes['$[]']("partial-option"))) { + return nil + } else { + return true + }; return nil; })()]; + $send(self.includes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + } else { + self.path = "" + }; + self.lineno = lineno; + if ($truthy(attributes['$key?']("depth"))) { + + depth = attributes['$[]']("depth").$to_i(); + if ($truthy($rb_le(depth, 0))) { + depth = 1}; + self.maxdepth = $hash2(["abs", "rel"], {"abs": $rb_plus($rb_minus(self.include_stack.$size(), 1), depth), "rel": depth});}; + if ($truthy((self.lines = self.$prepare_lines(data, $hash2(["normalize", "condense", "indent"], {"normalize": true, "condense": false, "indent": attributes['$[]']("indent")})))['$empty?']())) { + self.$pop_include() + } else { + + if ($truthy(attributes['$key?']("leveloffset"))) { + + self.lines.$unshift(""); + self.lines.$unshift("" + ":leveloffset: " + (attributes['$[]']("leveloffset"))); + self.lines['$<<'](""); + if ($truthy((old_leveloffset = self.document.$attr("leveloffset")))) { + self.lines['$<<']("" + ":leveloffset: " + (old_leveloffset)) + } else { + self.lines['$<<'](":leveloffset!:") + }; + self.lineno = $rb_minus(self.lineno, 2);}; + self.look_ahead = 0; + }; + return self; + }, TMP_PreprocessorReader_push_include_67.$$arity = -2); + + Opal.def(self, '$create_include_cursor', TMP_PreprocessorReader_create_include_cursor_68 = function $$create_include_cursor(file, path, lineno) { + var self = this, dir = nil; + + + if ($truthy($$$('::', 'String')['$==='](file))) { + dir = $$$('::', 'File').$dirname(file) + } else if ($truthy($$$('::', 'RUBY_ENGINE_OPAL'))) { + dir = $$$('::', 'File').$dirname((file = file.$to_s())) + } else { + + dir = (function() {if ((dir = $$$('::', 'File').$dirname(file.$path()))['$==']("")) { + return "/" + } else { + return dir + }; return nil; })(); + file = file.$to_s(); + }; + return $$($nesting, 'Cursor').$new(file, dir, path, lineno); + }, TMP_PreprocessorReader_create_include_cursor_68.$$arity = 3); + + Opal.def(self, '$pop_include', TMP_PreprocessorReader_pop_include_69 = function $$pop_include() { + var $a, $b, self = this; + + if ($truthy($rb_gt(self.include_stack.$size(), 0))) { + + $b = self.include_stack.$pop(), $a = Opal.to_ary($b), (self.lines = ($a[0] == null ? nil : $a[0])), (self.file = ($a[1] == null ? nil : $a[1])), (self.dir = ($a[2] == null ? nil : $a[2])), (self.path = ($a[3] == null ? nil : $a[3])), (self.lineno = ($a[4] == null ? nil : $a[4])), (self.maxdepth = ($a[5] == null ? nil : $a[5])), (self.process_lines = ($a[6] == null ? nil : $a[6])), $b; + self.look_ahead = 0; + return nil; + } else { + return nil + } + }, TMP_PreprocessorReader_pop_include_69.$$arity = 0); + + Opal.def(self, '$include_depth', TMP_PreprocessorReader_include_depth_70 = function $$include_depth() { + var self = this; + + return self.include_stack.$size() + }, TMP_PreprocessorReader_include_depth_70.$$arity = 0); + + Opal.def(self, '$exceeded_max_depth?', TMP_PreprocessorReader_exceeded_max_depth$q_71 = function() { + var $a, self = this, abs_maxdepth = nil; + + if ($truthy(($truthy($a = $rb_gt((abs_maxdepth = self.maxdepth['$[]']("abs")), 0)) ? $rb_ge(self.include_stack.$size(), abs_maxdepth) : $a))) { + return self.maxdepth['$[]']("rel") + } else { + return false + } + }, TMP_PreprocessorReader_exceeded_max_depth$q_71.$$arity = 0); + + Opal.def(self, '$shift', TMP_PreprocessorReader_shift_72 = function $$shift() { + var $iter = TMP_PreprocessorReader_shift_72.$$p, $yield = $iter || nil, self = this, line = nil, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_PreprocessorReader_shift_72.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + if ($truthy(self.unescape_next_line)) { + + self.unescape_next_line = false; + return (line = $send(self, Opal.find_super_dispatcher(self, 'shift', TMP_PreprocessorReader_shift_72, false), $zuper, $iter)).$slice(1, line.$length()); + } else { + return $send(self, Opal.find_super_dispatcher(self, 'shift', TMP_PreprocessorReader_shift_72, false), $zuper, $iter) + } + }, TMP_PreprocessorReader_shift_72.$$arity = 0); + + Opal.def(self, '$split_delimited_value', TMP_PreprocessorReader_split_delimited_value_73 = function $$split_delimited_value(val) { + var self = this; + + if ($truthy(val['$include?'](","))) { + + return val.$split(","); + } else { + + return val.$split(";"); + } + }, TMP_PreprocessorReader_split_delimited_value_73.$$arity = 1); + + Opal.def(self, '$skip_front_matter!', TMP_PreprocessorReader_skip_front_matter$B_74 = function(data, increment_linenos) { + var $a, $b, self = this, front_matter = nil, original_data = nil; + + + + if (increment_linenos == null) { + increment_linenos = true; + }; + front_matter = nil; + if (data['$[]'](0)['$==']("---")) { + + original_data = data.$drop(0); + data.$shift(); + front_matter = []; + if ($truthy(increment_linenos)) { + self.lineno = $rb_plus(self.lineno, 1)}; + while ($truthy(($truthy($b = data['$empty?']()['$!']()) ? data['$[]'](0)['$!=']("---") : $b))) { + + front_matter['$<<'](data.$shift()); + if ($truthy(increment_linenos)) { + self.lineno = $rb_plus(self.lineno, 1)}; + }; + if ($truthy(data['$empty?']())) { + + $send(data, 'unshift', Opal.to_a(original_data)); + if ($truthy(increment_linenos)) { + self.lineno = 0}; + front_matter = nil; + } else { + + data.$shift(); + if ($truthy(increment_linenos)) { + self.lineno = $rb_plus(self.lineno, 1)}; + };}; + return front_matter; + }, TMP_PreprocessorReader_skip_front_matter$B_74.$$arity = -2); + + Opal.def(self, '$resolve_expr_val', TMP_PreprocessorReader_resolve_expr_val_75 = function $$resolve_expr_val(val) { + var $a, $b, self = this, quoted = nil; + + + if ($truthy(($truthy($a = ($truthy($b = val['$start_with?']("\"")) ? val['$end_with?']("\"") : $b)) ? $a : ($truthy($b = val['$start_with?']("'")) ? val['$end_with?']("'") : $b)))) { + + quoted = true; + val = val.$slice(1, $rb_minus(val.$length(), 1)); + } else { + quoted = false + }; + if ($truthy(val['$include?']($$($nesting, 'ATTR_REF_HEAD')))) { + val = self.document.$sub_attributes(val, $hash2(["attribute_missing"], {"attribute_missing": "drop"}))}; + if ($truthy(quoted)) { + return val + } else if ($truthy(val['$empty?']())) { + return nil + } else if (val['$==']("true")) { + return true + } else if (val['$==']("false")) { + return false + } else if ($truthy(val.$rstrip()['$empty?']())) { + return " " + } else if ($truthy(val['$include?']("."))) { + return val.$to_f() + } else { + return val.$to_i() + }; + }, TMP_PreprocessorReader_resolve_expr_val_75.$$arity = 1); + + Opal.def(self, '$include_processors?', TMP_PreprocessorReader_include_processors$q_76 = function() { + var $a, self = this; + + if ($truthy(self.include_processor_extensions['$nil?']())) { + if ($truthy(($truthy($a = self.document['$extensions?']()) ? self.document.$extensions()['$include_processors?']() : $a))) { + return (self.include_processor_extensions = self.document.$extensions().$include_processors())['$!']()['$!']() + } else { + return (self.include_processor_extensions = false) + } + } else { + return self.include_processor_extensions['$!='](false) + } + }, TMP_PreprocessorReader_include_processors$q_76.$$arity = 0); + return (Opal.def(self, '$to_s', TMP_PreprocessorReader_to_s_77 = function $$to_s() { + var TMP_78, self = this; + + return "" + "#<" + (self.$class()) + "@" + (self.$object_id()) + " {path: " + (self.path.$inspect()) + ", line #: " + (self.lineno) + ", include depth: " + (self.include_stack.$size()) + ", include stack: [" + ($send(self.include_stack, 'map', [], (TMP_78 = function(inc){var self = TMP_78.$$s || this; + + + + if (inc == null) { + inc = nil; + }; + return inc.$to_s();}, TMP_78.$$s = self, TMP_78.$$arity = 1, TMP_78)).$join(", ")) + "]}>" + }, TMP_PreprocessorReader_to_s_77.$$arity = 0), nil) && 'to_s'; + })($nesting[0], $$($nesting, 'Reader'), $nesting); + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/section"] = function(Opal) { + function $rb_plus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); + } + function $rb_gt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); + } + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $hash2 = Opal.hash2, $send = Opal.send, $truthy = Opal.truthy; + + Opal.add_stubs(['$attr_accessor', '$attr_reader', '$===', '$+', '$level', '$special', '$generate_id', '$title', '$==', '$>', '$sectnum', '$int_to_roman', '$to_i', '$reftext', '$!', '$empty?', '$sprintf', '$sub_quotes', '$compat_mode', '$[]', '$attributes', '$context', '$assign_numeral', '$class', '$object_id', '$inspect', '$size', '$length', '$chr', '$[]=', '$-', '$gsub', '$downcase', '$delete', '$tr_s', '$end_with?', '$chop', '$start_with?', '$slice', '$key?', '$catalog', '$unique_id_start_index']); + return (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + (function($base, $super, $parent_nesting) { + function $Section(){}; + var self = $Section = $klass($base, $super, 'Section', $Section); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Section_initialize_1, TMP_Section_generate_id_2, TMP_Section_sectnum_3, TMP_Section_xreftext_4, TMP_Section_$lt$lt_5, TMP_Section_to_s_6, TMP_Section_generate_id_7; + + def.document = def.level = def.numeral = def.parent = def.numbered = def.sectname = def.title = def.blocks = nil; + + self.$attr_accessor("index"); + self.$attr_accessor("sectname"); + self.$attr_accessor("special"); + self.$attr_accessor("numbered"); + self.$attr_reader("caption"); + + Opal.def(self, '$initialize', TMP_Section_initialize_1 = function $$initialize(parent, level, numbered, opts) { + var $a, $b, $iter = TMP_Section_initialize_1.$$p, $yield = $iter || nil, self = this; + + if ($iter) TMP_Section_initialize_1.$$p = null; + + + if (parent == null) { + parent = nil; + }; + + if (level == null) { + level = nil; + }; + + if (numbered == null) { + numbered = false; + }; + + if (opts == null) { + opts = $hash2([], {}); + }; + $send(self, Opal.find_super_dispatcher(self, 'initialize', TMP_Section_initialize_1, false), [parent, "section", opts], null); + if ($truthy($$($nesting, 'Section')['$==='](parent))) { + $a = [($truthy($b = level) ? $b : $rb_plus(parent.$level(), 1)), parent.$special()], (self.level = $a[0]), (self.special = $a[1]), $a + } else { + $a = [($truthy($b = level) ? $b : 1), false], (self.level = $a[0]), (self.special = $a[1]), $a + }; + self.numbered = numbered; + return (self.index = 0); + }, TMP_Section_initialize_1.$$arity = -1); + Opal.alias(self, "name", "title"); + + Opal.def(self, '$generate_id', TMP_Section_generate_id_2 = function $$generate_id() { + var self = this; + + return $$($nesting, 'Section').$generate_id(self.$title(), self.document) + }, TMP_Section_generate_id_2.$$arity = 0); + + Opal.def(self, '$sectnum', TMP_Section_sectnum_3 = function $$sectnum(delimiter, append) { + var $a, self = this; + + + + if (delimiter == null) { + delimiter = "."; + }; + + if (append == null) { + append = nil; + }; + append = ($truthy($a = append) ? $a : (function() {if (append['$=='](false)) { + return "" + } else { + return delimiter + }; return nil; })()); + if (self.level['$=='](1)) { + return "" + (self.numeral) + (append) + } else if ($truthy($rb_gt(self.level, 1))) { + if ($truthy($$($nesting, 'Section')['$==='](self.parent))) { + return "" + (self.parent.$sectnum(delimiter, delimiter)) + (self.numeral) + (append) + } else { + return "" + (self.numeral) + (append) + } + } else { + return "" + ($$($nesting, 'Helpers').$int_to_roman(self.numeral.$to_i())) + (append) + }; + }, TMP_Section_sectnum_3.$$arity = -1); + + Opal.def(self, '$xreftext', TMP_Section_xreftext_4 = function $$xreftext(xrefstyle) { + var $a, self = this, val = nil, $case = nil, type = nil, quoted_title = nil, signifier = nil; + + + + if (xrefstyle == null) { + xrefstyle = nil; + }; + if ($truthy(($truthy($a = (val = self.$reftext())) ? val['$empty?']()['$!']() : $a))) { + return val + } else if ($truthy(xrefstyle)) { + if ($truthy(self.numbered)) { + return (function() {$case = xrefstyle; + if ("full"['$===']($case)) { + if ($truthy(($truthy($a = (type = self.sectname)['$==']("chapter")) ? $a : type['$==']("appendix")))) { + quoted_title = self.$sprintf(self.$sub_quotes("_%s_"), self.$title()) + } else { + quoted_title = self.$sprintf(self.$sub_quotes((function() {if ($truthy(self.document.$compat_mode())) { + return "``%s''" + } else { + return "\"`%s`\"" + }; return nil; })()), self.$title()) + }; + if ($truthy((signifier = self.document.$attributes()['$[]']("" + (type) + "-refsig")))) { + return "" + (signifier) + " " + (self.$sectnum(".", ",")) + " " + (quoted_title) + } else { + return "" + (self.$sectnum(".", ",")) + " " + (quoted_title) + };} + else if ("short"['$===']($case)) {if ($truthy((signifier = self.document.$attributes()['$[]']("" + (self.sectname) + "-refsig")))) { + return "" + (signifier) + " " + (self.$sectnum(".", "")) + } else { + return self.$sectnum(".", "") + }} + else {if ($truthy(($truthy($a = (type = self.sectname)['$==']("chapter")) ? $a : type['$==']("appendix")))) { + + return self.$sprintf(self.$sub_quotes("_%s_"), self.$title()); + } else { + return self.$title() + }}})() + } else if ($truthy(($truthy($a = (type = self.sectname)['$==']("chapter")) ? $a : type['$==']("appendix")))) { + + return self.$sprintf(self.$sub_quotes("_%s_"), self.$title()); + } else { + return self.$title() + } + } else { + return self.$title() + }; + }, TMP_Section_xreftext_4.$$arity = -1); + + Opal.def(self, '$<<', TMP_Section_$lt$lt_5 = function(block) { + var $iter = TMP_Section_$lt$lt_5.$$p, $yield = $iter || nil, self = this, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_Section_$lt$lt_5.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + + if (block.$context()['$==']("section")) { + self.$assign_numeral(block)}; + return $send(self, Opal.find_super_dispatcher(self, '<<', TMP_Section_$lt$lt_5, false), $zuper, $iter); + }, TMP_Section_$lt$lt_5.$$arity = 1); + + Opal.def(self, '$to_s', TMP_Section_to_s_6 = function $$to_s() { + var $iter = TMP_Section_to_s_6.$$p, $yield = $iter || nil, self = this, formal_title = nil, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_Section_to_s_6.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + if ($truthy(self.title)) { + + formal_title = (function() {if ($truthy(self.numbered)) { + return "" + (self.$sectnum()) + " " + (self.title) + } else { + return self.title + }; return nil; })(); + return "" + "#<" + (self.$class()) + "@" + (self.$object_id()) + " {level: " + (self.level) + ", title: " + (formal_title.$inspect()) + ", blocks: " + (self.blocks.$size()) + "}>"; + } else { + return $send(self, Opal.find_super_dispatcher(self, 'to_s', TMP_Section_to_s_6, false), $zuper, $iter) + } + }, TMP_Section_to_s_6.$$arity = 0); + return (Opal.defs(self, '$generate_id', TMP_Section_generate_id_7 = function $$generate_id(title, document) { + var $a, $b, self = this, attrs = nil, pre = nil, sep = nil, no_sep = nil, $writer = nil, sep_sub = nil, gen_id = nil, ids = nil, cnt = nil, candidate_id = nil; + + + attrs = document.$attributes(); + pre = ($truthy($a = attrs['$[]']("idprefix")) ? $a : "_"); + if ($truthy((sep = attrs['$[]']("idseparator")))) { + if ($truthy(($truthy($a = sep.$length()['$=='](1)) ? $a : ($truthy($b = (no_sep = sep['$empty?']())['$!']()) ? (sep = (($writer = ["idseparator", sep.$chr()]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])) : $b)))) { + sep_sub = (function() {if ($truthy(($truthy($a = sep['$==']("-")) ? $a : sep['$=='](".")))) { + return " .-" + } else { + return "" + " " + (sep) + ".-" + }; return nil; })()} + } else { + $a = ["_", " _.-"], (sep = $a[0]), (sep_sub = $a[1]), $a + }; + gen_id = "" + (pre) + (title.$downcase().$gsub($$($nesting, 'InvalidSectionIdCharsRx'), "")); + if ($truthy(no_sep)) { + gen_id = gen_id.$delete(" ") + } else { + + gen_id = gen_id.$tr_s(sep_sub, sep); + if ($truthy(gen_id['$end_with?'](sep))) { + gen_id = gen_id.$chop()}; + if ($truthy(($truthy($a = pre['$empty?']()) ? gen_id['$start_with?'](sep) : $a))) { + gen_id = gen_id.$slice(1, gen_id.$length())}; + }; + if ($truthy(document.$catalog()['$[]']("ids")['$key?'](gen_id))) { + + $a = [document.$catalog()['$[]']("ids"), $$($nesting, 'Compliance').$unique_id_start_index()], (ids = $a[0]), (cnt = $a[1]), $a; + while ($truthy(ids['$key?']((candidate_id = "" + (gen_id) + (sep) + (cnt))))) { + cnt = $rb_plus(cnt, 1) + }; + return candidate_id; + } else { + return gen_id + }; + }, TMP_Section_generate_id_7.$$arity = 2), nil) && 'generate_id'; + })($nesting[0], $$($nesting, 'AbstractBlock'), $nesting) + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/stylesheets"] = function(Opal) { + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $truthy = Opal.truthy, $hash2 = Opal.hash2, $gvars = Opal.gvars, $send = Opal.send; + + Opal.add_stubs(['$join', '$new', '$rstrip', '$read', '$primary_stylesheet_data', '$write', '$primary_stylesheet_name', '$coderay_stylesheet_data', '$coderay_stylesheet_name', '$load_pygments', '$=~', '$css', '$[]', '$sub', '$[]=', '$-', '$pygments_stylesheet_data', '$pygments_stylesheet_name', '$!', '$nil?', '$require_library']); + return (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + (function($base, $super, $parent_nesting) { + function $Stylesheets(){}; + var self = $Stylesheets = $klass($base, $super, 'Stylesheets', $Stylesheets); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Stylesheets_instance_1, TMP_Stylesheets_primary_stylesheet_name_2, TMP_Stylesheets_primary_stylesheet_data_3, TMP_Stylesheets_embed_primary_stylesheet_4, TMP_Stylesheets_write_primary_stylesheet_5, TMP_Stylesheets_coderay_stylesheet_name_6, TMP_Stylesheets_coderay_stylesheet_data_7, TMP_Stylesheets_embed_coderay_stylesheet_8, TMP_Stylesheets_write_coderay_stylesheet_9, TMP_Stylesheets_pygments_stylesheet_name_10, TMP_Stylesheets_pygments_background_11, TMP_Stylesheets_pygments_stylesheet_data_12, TMP_Stylesheets_embed_pygments_stylesheet_13, TMP_Stylesheets_write_pygments_stylesheet_14, TMP_Stylesheets_load_pygments_15; + + def.primary_stylesheet_data = def.coderay_stylesheet_data = def.pygments_stylesheet_data = nil; + + Opal.const_set($nesting[0], 'DEFAULT_STYLESHEET_NAME', "asciidoctor.css"); + Opal.const_set($nesting[0], 'DEFAULT_PYGMENTS_STYLE', "default"); + Opal.const_set($nesting[0], 'STYLESHEETS_DATA_PATH', $$$('::', 'File').$join($$($nesting, 'DATA_PATH'), "stylesheets")); + Opal.const_set($nesting[0], 'PygmentsBgColorRx', /^\.pygments +\{ *background: *([^;]+);/); + self.__instance__ = self.$new(); + Opal.defs(self, '$instance', TMP_Stylesheets_instance_1 = function $$instance() { + var self = this; + if (self.__instance__ == null) self.__instance__ = nil; + + return self.__instance__ + }, TMP_Stylesheets_instance_1.$$arity = 0); + + Opal.def(self, '$primary_stylesheet_name', TMP_Stylesheets_primary_stylesheet_name_2 = function $$primary_stylesheet_name() { + var self = this; + + return $$($nesting, 'DEFAULT_STYLESHEET_NAME') + }, TMP_Stylesheets_primary_stylesheet_name_2.$$arity = 0); + + Opal.def(self, '$primary_stylesheet_data', TMP_Stylesheets_primary_stylesheet_data_3 = function $$primary_stylesheet_data() { + +var File = Opal.const_get_relative([], "File"); +var stylesheetsPath; +if (Opal.const_get_relative([], "JAVASCRIPT_PLATFORM")["$=="]("node")) { + if (File.$basename(__dirname) === "node" && File.$basename(File.$dirname(__dirname)) === "dist") { + stylesheetsPath = File.$join(File.$dirname(__dirname), "css"); + } else { + stylesheetsPath = File.$join(__dirname, "css"); + } +} else if (Opal.const_get_relative([], "JAVASCRIPT_ENGINE")["$=="]("nashorn")) { + if (File.$basename(__DIR__) === "nashorn" && File.$basename(File.$dirname(__DIR__)) === "dist") { + stylesheetsPath = File.$join(File.$dirname(__DIR__), "css"); + } else { + stylesheetsPath = File.$join(__DIR__, "css"); + } +} else { + stylesheetsPath = "css"; +} +return ((($a = self.primary_stylesheet_data) !== false && $a !== nil && $a != null) ? $a : self.primary_stylesheet_data = Opal.const_get_relative([], "IO").$read(File.$join(stylesheetsPath, "asciidoctor.css")).$chomp()); + + }, TMP_Stylesheets_primary_stylesheet_data_3.$$arity = 0); + + Opal.def(self, '$embed_primary_stylesheet', TMP_Stylesheets_embed_primary_stylesheet_4 = function $$embed_primary_stylesheet() { + var self = this; + + return "" + "" + }, TMP_Stylesheets_embed_primary_stylesheet_4.$$arity = 0); + + Opal.def(self, '$write_primary_stylesheet', TMP_Stylesheets_write_primary_stylesheet_5 = function $$write_primary_stylesheet(target_dir) { + var self = this; + + + + if (target_dir == null) { + target_dir = "."; + }; + return $$$('::', 'IO').$write($$$('::', 'File').$join(target_dir, self.$primary_stylesheet_name()), self.$primary_stylesheet_data()); + }, TMP_Stylesheets_write_primary_stylesheet_5.$$arity = -1); + + Opal.def(self, '$coderay_stylesheet_name', TMP_Stylesheets_coderay_stylesheet_name_6 = function $$coderay_stylesheet_name() { + var self = this; + + return "coderay-asciidoctor.css" + }, TMP_Stylesheets_coderay_stylesheet_name_6.$$arity = 0); + + Opal.def(self, '$coderay_stylesheet_data', TMP_Stylesheets_coderay_stylesheet_data_7 = function $$coderay_stylesheet_data() { + var $a, self = this; + + return (self.coderay_stylesheet_data = ($truthy($a = self.coderay_stylesheet_data) ? $a : $$$('::', 'IO').$read($$$('::', 'File').$join($$($nesting, 'STYLESHEETS_DATA_PATH'), "coderay-asciidoctor.css")).$rstrip())) + }, TMP_Stylesheets_coderay_stylesheet_data_7.$$arity = 0); + + Opal.def(self, '$embed_coderay_stylesheet', TMP_Stylesheets_embed_coderay_stylesheet_8 = function $$embed_coderay_stylesheet() { + var self = this; + + return "" + "" + }, TMP_Stylesheets_embed_coderay_stylesheet_8.$$arity = 0); + + Opal.def(self, '$write_coderay_stylesheet', TMP_Stylesheets_write_coderay_stylesheet_9 = function $$write_coderay_stylesheet(target_dir) { + var self = this; + + + + if (target_dir == null) { + target_dir = "."; + }; + return $$$('::', 'IO').$write($$$('::', 'File').$join(target_dir, self.$coderay_stylesheet_name()), self.$coderay_stylesheet_data()); + }, TMP_Stylesheets_write_coderay_stylesheet_9.$$arity = -1); + + Opal.def(self, '$pygments_stylesheet_name', TMP_Stylesheets_pygments_stylesheet_name_10 = function $$pygments_stylesheet_name(style) { + var $a, self = this; + + + + if (style == null) { + style = nil; + }; + return "" + "pygments-" + (($truthy($a = style) ? $a : $$($nesting, 'DEFAULT_PYGMENTS_STYLE'))) + ".css"; + }, TMP_Stylesheets_pygments_stylesheet_name_10.$$arity = -1); + + Opal.def(self, '$pygments_background', TMP_Stylesheets_pygments_background_11 = function $$pygments_background(style) { + var $a, $b, self = this; + + + + if (style == null) { + style = nil; + }; + if ($truthy(($truthy($a = self.$load_pygments()) ? $$($nesting, 'PygmentsBgColorRx')['$=~']($$$('::', 'Pygments').$css(".pygments", $hash2(["style"], {"style": ($truthy($b = style) ? $b : $$($nesting, 'DEFAULT_PYGMENTS_STYLE'))}))) : $a))) { + return (($a = $gvars['~']) === nil ? nil : $a['$[]'](1)) + } else { + return nil + }; + }, TMP_Stylesheets_pygments_background_11.$$arity = -1); + + Opal.def(self, '$pygments_stylesheet_data', TMP_Stylesheets_pygments_stylesheet_data_12 = function $$pygments_stylesheet_data(style) { + var $a, $b, self = this, $writer = nil; + + + + if (style == null) { + style = nil; + }; + if ($truthy(self.$load_pygments())) { + + style = ($truthy($a = style) ? $a : $$($nesting, 'DEFAULT_PYGMENTS_STYLE')); + return ($truthy($a = (self.pygments_stylesheet_data = ($truthy($b = self.pygments_stylesheet_data) ? $b : $hash2([], {})))['$[]'](style)) ? $a : (($writer = [style, ($truthy($b = $$$('::', 'Pygments').$css(".listingblock .pygments", $hash2(["classprefix", "style"], {"classprefix": "tok-", "style": style}))) ? $b : "/* Failed to load Pygments CSS. */").$sub(".listingblock .pygments {", ".listingblock .pygments, .listingblock .pygments code {")]), $send((self.pygments_stylesheet_data = ($truthy($b = self.pygments_stylesheet_data) ? $b : $hash2([], {}))), '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + } else { + return "/* Pygments CSS disabled. Pygments is not available. */" + }; + }, TMP_Stylesheets_pygments_stylesheet_data_12.$$arity = -1); + + Opal.def(self, '$embed_pygments_stylesheet', TMP_Stylesheets_embed_pygments_stylesheet_13 = function $$embed_pygments_stylesheet(style) { + var self = this; + + + + if (style == null) { + style = nil; + }; + return "" + ""; + }, TMP_Stylesheets_embed_pygments_stylesheet_13.$$arity = -1); + + Opal.def(self, '$write_pygments_stylesheet', TMP_Stylesheets_write_pygments_stylesheet_14 = function $$write_pygments_stylesheet(target_dir, style) { + var self = this; + + + + if (target_dir == null) { + target_dir = "."; + }; + + if (style == null) { + style = nil; + }; + return $$$('::', 'IO').$write($$$('::', 'File').$join(target_dir, self.$pygments_stylesheet_name(style)), self.$pygments_stylesheet_data(style)); + }, TMP_Stylesheets_write_pygments_stylesheet_14.$$arity = -1); + return (Opal.def(self, '$load_pygments', TMP_Stylesheets_load_pygments_15 = function $$load_pygments() { + var $a, self = this; + + if ($truthy((($a = $$$('::', 'Pygments', 'skip_raise')) ? 'constant' : nil))) { + return true + } else { + return $$($nesting, 'Helpers').$require_library("pygments", "pygments.rb", "ignore")['$nil?']()['$!']() + } + }, TMP_Stylesheets_load_pygments_15.$$arity = 0), nil) && 'load_pygments'; + })($nesting[0], null, $nesting) + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/table"] = function(Opal) { + function $rb_gt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); + } + function $rb_lt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); + } + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + function $rb_times(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs * rhs : lhs['$*'](rhs); + } + function $rb_divide(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs / rhs : lhs['$/'](rhs); + } + function $rb_plus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $send = Opal.send, $truthy = Opal.truthy, $hash2 = Opal.hash2, $gvars = Opal.gvars; + + Opal.add_stubs(['$attr_accessor', '$attr_reader', '$new', '$key?', '$[]', '$>', '$to_i', '$<', '$==', '$[]=', '$-', '$attributes', '$round', '$*', '$/', '$to_f', '$empty?', '$body', '$each', '$<<', '$size', '$+', '$assign_column_widths', '$warn', '$logger', '$update_attributes', '$assign_width', '$shift', '$style=', '$head=', '$pop', '$foot=', '$parent', '$sourcemap', '$dup', '$header_row?', '$table', '$delete', '$start_with?', '$rstrip', '$slice', '$length', '$advance', '$lstrip', '$strip', '$split', '$include?', '$readlines', '$unshift', '$nil?', '$=~', '$catalog_inline_anchor', '$apply_subs', '$convert', '$map', '$text', '$!', '$file', '$lineno', '$to_s', '$include', '$to_set', '$mark', '$nested?', '$document', '$error', '$message_with_context', '$cursor_at_prev_line', '$nil_or_empty?', '$escape', '$columns', '$match', '$chop', '$end_with?', '$gsub', '$push_cellspec', '$cell_open?', '$close_cell', '$take_cellspec', '$squeeze', '$upto', '$times', '$cursor_before_mark', '$rowspan', '$activate_rowspan', '$colspan', '$end_of_row?', '$!=', '$close_row', '$rows', '$effective_column_visits']); + return (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + + (function($base, $super, $parent_nesting) { + function $Table(){}; + var self = $Table = $klass($base, $super, 'Table', $Table); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Table_initialize_3, TMP_Table_header_row$q_4, TMP_Table_create_columns_5, TMP_Table_assign_column_widths_7, TMP_Table_partition_header_footer_11; + + def.attributes = def.document = def.has_header_option = def.rows = def.columns = nil; + + Opal.const_set($nesting[0], 'DEFAULT_PRECISION_FACTOR', 10000); + (function($base, $super, $parent_nesting) { + function $Rows(){}; + var self = $Rows = $klass($base, $super, 'Rows', $Rows); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Rows_initialize_1, TMP_Rows_by_section_2; + + def.head = def.body = def.foot = nil; + + self.$attr_accessor("head", "foot", "body"); + + Opal.def(self, '$initialize', TMP_Rows_initialize_1 = function $$initialize(head, foot, body) { + var self = this; + + + + if (head == null) { + head = []; + }; + + if (foot == null) { + foot = []; + }; + + if (body == null) { + body = []; + }; + self.head = head; + self.foot = foot; + return (self.body = body); + }, TMP_Rows_initialize_1.$$arity = -1); + Opal.alias(self, "[]", "send"); + return (Opal.def(self, '$by_section', TMP_Rows_by_section_2 = function $$by_section() { + var self = this; + + return [["head", self.head], ["body", self.body], ["foot", self.foot]] + }, TMP_Rows_by_section_2.$$arity = 0), nil) && 'by_section'; + })($nesting[0], null, $nesting); + self.$attr_accessor("columns"); + self.$attr_accessor("rows"); + self.$attr_accessor("has_header_option"); + self.$attr_reader("caption"); + + Opal.def(self, '$initialize', TMP_Table_initialize_3 = function $$initialize(parent, attributes) { + var $a, $b, $iter = TMP_Table_initialize_3.$$p, $yield = $iter || nil, self = this, pcwidth = nil, pcwidth_intval = nil, $writer = nil; + + if ($iter) TMP_Table_initialize_3.$$p = null; + + $send(self, Opal.find_super_dispatcher(self, 'initialize', TMP_Table_initialize_3, false), [parent, "table"], null); + self.rows = $$($nesting, 'Rows').$new(); + self.columns = []; + self.has_header_option = attributes['$key?']("header-option"); + if ($truthy((pcwidth = attributes['$[]']("width")))) { + if ($truthy(($truthy($a = $rb_gt((pcwidth_intval = pcwidth.$to_i()), 100)) ? $a : $rb_lt(pcwidth_intval, 1)))) { + if ($truthy((($a = pcwidth_intval['$=='](0)) ? ($truthy($b = pcwidth['$==']("0")) ? $b : pcwidth['$==']("0%")) : pcwidth_intval['$=='](0)))) { + } else { + pcwidth_intval = 100 + }} + } else { + pcwidth_intval = 100 + }; + + $writer = ["tablepcwidth", pcwidth_intval]; + $send(self.attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + if ($truthy(self.document.$attributes()['$key?']("pagewidth"))) { + ($truthy($a = self.attributes['$[]']("tableabswidth")) ? $a : (($writer = ["tableabswidth", $rb_times($rb_divide(self.attributes['$[]']("tablepcwidth").$to_f(), 100), self.document.$attributes()['$[]']("pagewidth")).$round()]), $send(self.attributes, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]))}; + if ($truthy(attributes['$key?']("rotate-option"))) { + + $writer = ["orientation", "landscape"]; + $send(attributes, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + } else { + return nil + }; + }, TMP_Table_initialize_3.$$arity = 2); + + Opal.def(self, '$header_row?', TMP_Table_header_row$q_4 = function() { + var $a, self = this; + + return ($truthy($a = self.has_header_option) ? self.rows.$body()['$empty?']() : $a) + }, TMP_Table_header_row$q_4.$$arity = 0); + + Opal.def(self, '$create_columns', TMP_Table_create_columns_5 = function $$create_columns(colspecs) { + var TMP_6, $a, self = this, cols = nil, autowidth_cols = nil, width_base = nil, num_cols = nil, $writer = nil; + + + cols = []; + autowidth_cols = nil; + width_base = 0; + $send(colspecs, 'each', [], (TMP_6 = function(colspec){var self = TMP_6.$$s || this, $a, colwidth = nil; + + + + if (colspec == null) { + colspec = nil; + }; + colwidth = colspec['$[]']("width"); + cols['$<<']($$($nesting, 'Column').$new(self, cols.$size(), colspec)); + if ($truthy($rb_lt(colwidth, 0))) { + return (autowidth_cols = ($truthy($a = autowidth_cols) ? $a : []))['$<<'](cols['$[]'](-1)) + } else { + return (width_base = $rb_plus(width_base, colwidth)) + };}, TMP_6.$$s = self, TMP_6.$$arity = 1, TMP_6)); + if ($truthy($rb_gt((num_cols = (self.columns = cols).$size()), 0))) { + + + $writer = ["colcount", num_cols]; + $send(self.attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + if ($truthy(($truthy($a = $rb_gt(width_base, 0)) ? $a : autowidth_cols))) { + } else { + width_base = nil + }; + self.$assign_column_widths(width_base, autowidth_cols);}; + return nil; + }, TMP_Table_create_columns_5.$$arity = 1); + + Opal.def(self, '$assign_column_widths', TMP_Table_assign_column_widths_7 = function $$assign_column_widths(width_base, autowidth_cols) { + var TMP_8, TMP_9, TMP_10, self = this, pf = nil, total_width = nil, col_pcwidth = nil, autowidth = nil, autowidth_attrs = nil; + + + + if (width_base == null) { + width_base = nil; + }; + + if (autowidth_cols == null) { + autowidth_cols = nil; + }; + pf = $$($nesting, 'DEFAULT_PRECISION_FACTOR'); + total_width = (col_pcwidth = 0); + if ($truthy(width_base)) { + + if ($truthy(autowidth_cols)) { + + if ($truthy($rb_gt(width_base, 100))) { + + autowidth = 0; + self.$logger().$warn("" + "total column width must not exceed 100% when using autowidth columns; got " + (width_base) + "%"); + } else { + + autowidth = $rb_divide($rb_times($rb_divide($rb_minus(100, width_base), autowidth_cols.$size()), pf).$to_i(), pf); + if (autowidth.$to_i()['$=='](autowidth)) { + autowidth = autowidth.$to_i()}; + width_base = 100; + }; + autowidth_attrs = $hash2(["width", "autowidth-option"], {"width": autowidth, "autowidth-option": ""}); + $send(autowidth_cols, 'each', [], (TMP_8 = function(col){var self = TMP_8.$$s || this; + + + + if (col == null) { + col = nil; + }; + return col.$update_attributes(autowidth_attrs);}, TMP_8.$$s = self, TMP_8.$$arity = 1, TMP_8));}; + $send(self.columns, 'each', [], (TMP_9 = function(col){var self = TMP_9.$$s || this; + + + + if (col == null) { + col = nil; + }; + return (total_width = $rb_plus(total_width, (col_pcwidth = col.$assign_width(nil, width_base, pf))));}, TMP_9.$$s = self, TMP_9.$$arity = 1, TMP_9)); + } else { + + col_pcwidth = $rb_divide($rb_divide($rb_times(100, pf), self.columns.$size()).$to_i(), pf); + if (col_pcwidth.$to_i()['$=='](col_pcwidth)) { + col_pcwidth = col_pcwidth.$to_i()}; + $send(self.columns, 'each', [], (TMP_10 = function(col){var self = TMP_10.$$s || this; + + + + if (col == null) { + col = nil; + }; + return (total_width = $rb_plus(total_width, col.$assign_width(col_pcwidth)));}, TMP_10.$$s = self, TMP_10.$$arity = 1, TMP_10)); + }; + if (total_width['$=='](100)) { + } else { + self.columns['$[]'](-1).$assign_width($rb_divide($rb_times($rb_plus($rb_minus(100, total_width), col_pcwidth), pf).$round(), pf)) + }; + return nil; + }, TMP_Table_assign_column_widths_7.$$arity = -1); + return (Opal.def(self, '$partition_header_footer', TMP_Table_partition_header_footer_11 = function $$partition_header_footer(attrs) { + var $a, TMP_12, self = this, $writer = nil, num_body_rows = nil, head = nil; + + + + $writer = ["rowcount", self.rows.$body().$size()]; + $send(self.attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + num_body_rows = self.rows.$body().$size(); + if ($truthy(($truthy($a = $rb_gt(num_body_rows, 0)) ? self.has_header_option : $a))) { + + head = self.rows.$body().$shift(); + num_body_rows = $rb_minus(num_body_rows, 1); + $send(head, 'each', [], (TMP_12 = function(c){var self = TMP_12.$$s || this; + + + + if (c == null) { + c = nil; + }; + $writer = [nil]; + $send(c, 'style=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];}, TMP_12.$$s = self, TMP_12.$$arity = 1, TMP_12)); + + $writer = [[head]]; + $send(self.rows, 'head=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];;}; + if ($truthy(($truthy($a = $rb_gt(num_body_rows, 0)) ? attrs['$key?']("footer-option") : $a))) { + + $writer = [[self.rows.$body().$pop()]]; + $send(self.rows, 'foot=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + return nil; + }, TMP_Table_partition_header_footer_11.$$arity = 1), nil) && 'partition_header_footer'; + })($nesting[0], $$($nesting, 'AbstractBlock'), $nesting); + (function($base, $super, $parent_nesting) { + function $Column(){}; + var self = $Column = $klass($base, $super, 'Column', $Column); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Column_initialize_13, TMP_Column_assign_width_14; + + def.attributes = nil; + + self.$attr_accessor("style"); + + Opal.def(self, '$initialize', TMP_Column_initialize_13 = function $$initialize(table, index, attributes) { + var $a, $iter = TMP_Column_initialize_13.$$p, $yield = $iter || nil, self = this, $writer = nil; + + if ($iter) TMP_Column_initialize_13.$$p = null; + + + if (attributes == null) { + attributes = $hash2([], {}); + }; + $send(self, Opal.find_super_dispatcher(self, 'initialize', TMP_Column_initialize_13, false), [table, "column"], null); + self.style = attributes['$[]']("style"); + + $writer = ["colnumber", $rb_plus(index, 1)]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + ($truthy($a = attributes['$[]']("width")) ? $a : (($writer = ["width", 1]), $send(attributes, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + ($truthy($a = attributes['$[]']("halign")) ? $a : (($writer = ["halign", "left"]), $send(attributes, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + ($truthy($a = attributes['$[]']("valign")) ? $a : (($writer = ["valign", "top"]), $send(attributes, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + return self.$update_attributes(attributes); + }, TMP_Column_initialize_13.$$arity = -3); + Opal.alias(self, "table", "parent"); + return (Opal.def(self, '$assign_width', TMP_Column_assign_width_14 = function $$assign_width(col_pcwidth, width_base, pf) { + var self = this, $writer = nil; + + + + if (width_base == null) { + width_base = nil; + }; + + if (pf == null) { + pf = 10000; + }; + if ($truthy(width_base)) { + + col_pcwidth = $rb_divide($rb_times($rb_times($rb_divide(self.attributes['$[]']("width").$to_f(), width_base), 100), pf).$to_i(), pf); + if (col_pcwidth.$to_i()['$=='](col_pcwidth)) { + col_pcwidth = col_pcwidth.$to_i()};}; + + $writer = ["colpcwidth", col_pcwidth]; + $send(self.attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + if ($truthy(self.$parent().$attributes()['$key?']("tableabswidth"))) { + + $writer = ["colabswidth", $rb_times($rb_divide(col_pcwidth, 100), self.$parent().$attributes()['$[]']("tableabswidth")).$round()]; + $send(self.attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + return col_pcwidth; + }, TMP_Column_assign_width_14.$$arity = -2), nil) && 'assign_width'; + })($$($nesting, 'Table'), $$($nesting, 'AbstractNode'), $nesting); + (function($base, $super, $parent_nesting) { + function $Cell(){}; + var self = $Cell = $klass($base, $super, 'Cell', $Cell); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Cell_initialize_15, TMP_Cell_text_16, TMP_Cell_text$eq_17, TMP_Cell_content_18, TMP_Cell_file_20, TMP_Cell_lineno_21, TMP_Cell_to_s_22; + + def.document = def.text = def.subs = def.style = def.inner_document = def.source_location = def.colspan = def.rowspan = def.attributes = nil; + + self.$attr_reader("source_location"); + self.$attr_accessor("style"); + self.$attr_accessor("subs"); + self.$attr_accessor("colspan"); + self.$attr_accessor("rowspan"); + Opal.alias(self, "column", "parent"); + self.$attr_reader("inner_document"); + + Opal.def(self, '$initialize', TMP_Cell_initialize_15 = function $$initialize(column, cell_text, attributes, opts) { + var $a, $b, $iter = TMP_Cell_initialize_15.$$p, $yield = $iter || nil, self = this, in_header_row = nil, cell_style = nil, asciidoc = nil, inner_document_cursor = nil, lines_advanced = nil, literal = nil, normal_psv = nil, parent_doctitle = nil, inner_document_lines = nil, unprocessed_line1 = nil, preprocessed_lines = nil, $writer = nil; + + if ($iter) TMP_Cell_initialize_15.$$p = null; + + + if (attributes == null) { + attributes = $hash2([], {}); + }; + + if (opts == null) { + opts = $hash2([], {}); + }; + $send(self, Opal.find_super_dispatcher(self, 'initialize', TMP_Cell_initialize_15, false), [column, "cell"], null); + if ($truthy(self.document.$sourcemap())) { + self.source_location = opts['$[]']("cursor").$dup()}; + if ($truthy(column)) { + + if ($truthy((in_header_row = column.$table()['$header_row?']()))) { + } else { + cell_style = column.$attributes()['$[]']("style") + }; + self.$update_attributes(column.$attributes());}; + if ($truthy(attributes)) { + + if ($truthy(attributes['$empty?']())) { + self.colspan = (self.rowspan = nil) + } else { + + $a = [attributes.$delete("colspan"), attributes.$delete("rowspan")], (self.colspan = $a[0]), (self.rowspan = $a[1]), $a; + if ($truthy(in_header_row)) { + } else { + cell_style = ($truthy($a = attributes['$[]']("style")) ? $a : cell_style) + }; + self.$update_attributes(attributes); + }; + if (cell_style['$==']("asciidoc")) { + + asciidoc = true; + inner_document_cursor = opts['$[]']("cursor"); + if ($truthy((cell_text = cell_text.$rstrip())['$start_with?']($$($nesting, 'LF')))) { + + lines_advanced = 1; + while ($truthy((cell_text = cell_text.$slice(1, cell_text.$length()))['$start_with?']($$($nesting, 'LF')))) { + lines_advanced = $rb_plus(lines_advanced, 1) + }; + inner_document_cursor.$advance(lines_advanced); + } else { + cell_text = cell_text.$lstrip() + }; + } else if ($truthy(($truthy($a = (literal = cell_style['$==']("literal"))) ? $a : cell_style['$==']("verse")))) { + + cell_text = cell_text.$rstrip(); + while ($truthy(cell_text['$start_with?']($$($nesting, 'LF')))) { + cell_text = cell_text.$slice(1, cell_text.$length()) + }; + } else { + + normal_psv = true; + cell_text = (function() {if ($truthy(cell_text)) { + return cell_text.$strip() + } else { + return "" + }; return nil; })(); + }; + } else { + + self.colspan = (self.rowspan = nil); + if (cell_style['$==']("asciidoc")) { + + asciidoc = true; + inner_document_cursor = opts['$[]']("cursor");}; + }; + if ($truthy(asciidoc)) { + + parent_doctitle = self.document.$attributes().$delete("doctitle"); + inner_document_lines = cell_text.$split($$($nesting, 'LF'), -1); + if ($truthy(inner_document_lines['$empty?']())) { + } else if ($truthy((unprocessed_line1 = inner_document_lines['$[]'](0))['$include?']("::"))) { + + preprocessed_lines = $$($nesting, 'PreprocessorReader').$new(self.document, [unprocessed_line1]).$readlines(); + if ($truthy((($a = unprocessed_line1['$=='](preprocessed_lines['$[]'](0))) ? $rb_lt(preprocessed_lines.$size(), 2) : unprocessed_line1['$=='](preprocessed_lines['$[]'](0))))) { + } else { + + inner_document_lines.$shift(); + if ($truthy(preprocessed_lines['$empty?']())) { + } else { + $send(inner_document_lines, 'unshift', Opal.to_a(preprocessed_lines)) + }; + };}; + self.inner_document = $$($nesting, 'Document').$new(inner_document_lines, $hash2(["header_footer", "parent", "cursor"], {"header_footer": false, "parent": self.document, "cursor": inner_document_cursor})); + if ($truthy(parent_doctitle['$nil?']())) { + } else { + + $writer = ["doctitle", parent_doctitle]; + $send(self.document.$attributes(), '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + self.subs = nil; + } else if ($truthy(literal)) { + self.subs = $$($nesting, 'BASIC_SUBS') + } else { + + if ($truthy(($truthy($a = ($truthy($b = normal_psv) ? cell_text['$start_with?']("[[") : $b)) ? $$($nesting, 'LeadingInlineAnchorRx')['$=~'](cell_text) : $a))) { + $$($nesting, 'Parser').$catalog_inline_anchor((($a = $gvars['~']) === nil ? nil : $a['$[]'](1)), (($a = $gvars['~']) === nil ? nil : $a['$[]'](2)), self, opts['$[]']("cursor"), self.document)}; + self.subs = $$($nesting, 'NORMAL_SUBS'); + }; + self.text = cell_text; + return (self.style = cell_style); + }, TMP_Cell_initialize_15.$$arity = -3); + + Opal.def(self, '$text', TMP_Cell_text_16 = function $$text() { + var self = this; + + return self.$apply_subs(self.text, self.subs) + }, TMP_Cell_text_16.$$arity = 0); + + Opal.def(self, '$text=', TMP_Cell_text$eq_17 = function(val) { + var self = this; + + return (self.text = val) + }, TMP_Cell_text$eq_17.$$arity = 1); + + Opal.def(self, '$content', TMP_Cell_content_18 = function $$content() { + var TMP_19, self = this; + + if (self.style['$==']("asciidoc")) { + return self.inner_document.$convert() + } else { + return $send(self.$text().$split($$($nesting, 'BlankLineRx')), 'map', [], (TMP_19 = function(p){var self = TMP_19.$$s || this, $a; + if (self.style == null) self.style = nil; + + + + if (p == null) { + p = nil; + }; + if ($truthy(($truthy($a = self.style['$!']()) ? $a : self.style['$==']("header")))) { + return p + } else { + return $$($nesting, 'Inline').$new(self.$parent(), "quoted", p, $hash2(["type"], {"type": self.style})).$convert() + };}, TMP_19.$$s = self, TMP_19.$$arity = 1, TMP_19)) + } + }, TMP_Cell_content_18.$$arity = 0); + + Opal.def(self, '$file', TMP_Cell_file_20 = function $$file() { + var $a, self = this; + + return ($truthy($a = self.source_location) ? self.source_location.$file() : $a) + }, TMP_Cell_file_20.$$arity = 0); + + Opal.def(self, '$lineno', TMP_Cell_lineno_21 = function $$lineno() { + var $a, self = this; + + return ($truthy($a = self.source_location) ? self.source_location.$lineno() : $a) + }, TMP_Cell_lineno_21.$$arity = 0); + return (Opal.def(self, '$to_s', TMP_Cell_to_s_22 = function $$to_s() { + var $a, $iter = TMP_Cell_to_s_22.$$p, $yield = $iter || nil, self = this, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_Cell_to_s_22.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + return "" + ($send(self, Opal.find_super_dispatcher(self, 'to_s', TMP_Cell_to_s_22, false), $zuper, $iter).$to_s()) + " - [text: " + (self.text) + ", colspan: " + (($truthy($a = self.colspan) ? $a : 1)) + ", rowspan: " + (($truthy($a = self.rowspan) ? $a : 1)) + ", attributes: " + (self.attributes) + "]" + }, TMP_Cell_to_s_22.$$arity = 0), nil) && 'to_s'; + })($$($nesting, 'Table'), $$($nesting, 'AbstractNode'), $nesting); + (function($base, $super, $parent_nesting) { + function $ParserContext(){}; + var self = $ParserContext = $klass($base, $super, 'ParserContext', $ParserContext); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_ParserContext_initialize_23, TMP_ParserContext_starts_with_delimiter$q_24, TMP_ParserContext_match_delimiter_25, TMP_ParserContext_skip_past_delimiter_26, TMP_ParserContext_skip_past_escaped_delimiter_27, TMP_ParserContext_buffer_has_unclosed_quotes$q_28, TMP_ParserContext_take_cellspec_29, TMP_ParserContext_push_cellspec_30, TMP_ParserContext_keep_cell_open_31, TMP_ParserContext_mark_cell_closed_32, TMP_ParserContext_cell_open$q_33, TMP_ParserContext_cell_closed$q_34, TMP_ParserContext_close_open_cell_35, TMP_ParserContext_close_cell_36, TMP_ParserContext_close_row_39, TMP_ParserContext_activate_rowspan_40, TMP_ParserContext_end_of_row$q_42, TMP_ParserContext_effective_column_visits_43, TMP_ParserContext_advance_44; + + def.delimiter = def.delimiter_re = def.buffer = def.cellspecs = def.cell_open = def.format = def.start_cursor_data = def.reader = def.table = def.current_row = def.colcount = def.column_visits = def.active_rowspans = def.linenum = nil; + + self.$include($$($nesting, 'Logging')); + Opal.const_set($nesting[0], 'FORMATS', ["psv", "csv", "dsv", "tsv"].$to_set()); + Opal.const_set($nesting[0], 'DELIMITERS', $hash2(["psv", "csv", "dsv", "tsv", "!sv"], {"psv": ["|", /\|/], "csv": [",", /,/], "dsv": [":", /:/], "tsv": ["\t", /\t/], "!sv": ["!", /!/]})); + self.$attr_accessor("table"); + self.$attr_accessor("format"); + self.$attr_reader("colcount"); + self.$attr_accessor("buffer"); + self.$attr_reader("delimiter"); + self.$attr_reader("delimiter_re"); + + Opal.def(self, '$initialize', TMP_ParserContext_initialize_23 = function $$initialize(reader, table, attributes) { + var $a, $b, self = this, xsv = nil, sep = nil; + + + + if (attributes == null) { + attributes = $hash2([], {}); + }; + self.start_cursor_data = (self.reader = reader).$mark(); + self.table = table; + if ($truthy(attributes['$key?']("format"))) { + if ($truthy($$($nesting, 'FORMATS')['$include?']((xsv = attributes['$[]']("format"))))) { + if (xsv['$==']("tsv")) { + self.format = "csv" + } else if ($truthy((($a = (self.format = xsv)['$==']("psv")) ? table.$document()['$nested?']() : (self.format = xsv)['$==']("psv")))) { + xsv = "!sv"} + } else { + + self.$logger().$error(self.$message_with_context("" + "illegal table format: " + (xsv), $hash2(["source_location"], {"source_location": reader.$cursor_at_prev_line()}))); + $a = ["psv", (function() {if ($truthy(table.$document()['$nested?']())) { + return "!sv" + } else { + return "psv" + }; return nil; })()], (self.format = $a[0]), (xsv = $a[1]), $a; + } + } else { + $a = ["psv", (function() {if ($truthy(table.$document()['$nested?']())) { + return "!sv" + } else { + return "psv" + }; return nil; })()], (self.format = $a[0]), (xsv = $a[1]), $a + }; + if ($truthy(attributes['$key?']("separator"))) { + if ($truthy((sep = attributes['$[]']("separator"))['$nil_or_empty?']())) { + $b = $$($nesting, 'DELIMITERS')['$[]'](xsv), $a = Opal.to_ary($b), (self.delimiter = ($a[0] == null ? nil : $a[0])), (self.delimiter_re = ($a[1] == null ? nil : $a[1])), $b + } else if (sep['$==']("\\t")) { + $b = $$($nesting, 'DELIMITERS')['$[]']("tsv"), $a = Opal.to_ary($b), (self.delimiter = ($a[0] == null ? nil : $a[0])), (self.delimiter_re = ($a[1] == null ? nil : $a[1])), $b + } else { + $a = [sep, new RegExp($$$('::', 'Regexp').$escape(sep))], (self.delimiter = $a[0]), (self.delimiter_re = $a[1]), $a + } + } else { + $b = $$($nesting, 'DELIMITERS')['$[]'](xsv), $a = Opal.to_ary($b), (self.delimiter = ($a[0] == null ? nil : $a[0])), (self.delimiter_re = ($a[1] == null ? nil : $a[1])), $b + }; + self.colcount = (function() {if ($truthy(table.$columns()['$empty?']())) { + return -1 + } else { + return table.$columns().$size() + }; return nil; })(); + self.buffer = ""; + self.cellspecs = []; + self.cell_open = false; + self.active_rowspans = [0]; + self.column_visits = 0; + self.current_row = []; + return (self.linenum = -1); + }, TMP_ParserContext_initialize_23.$$arity = -3); + + Opal.def(self, '$starts_with_delimiter?', TMP_ParserContext_starts_with_delimiter$q_24 = function(line) { + var self = this; + + return line['$start_with?'](self.delimiter) + }, TMP_ParserContext_starts_with_delimiter$q_24.$$arity = 1); + + Opal.def(self, '$match_delimiter', TMP_ParserContext_match_delimiter_25 = function $$match_delimiter(line) { + var self = this; + + return self.delimiter_re.$match(line) + }, TMP_ParserContext_match_delimiter_25.$$arity = 1); + + Opal.def(self, '$skip_past_delimiter', TMP_ParserContext_skip_past_delimiter_26 = function $$skip_past_delimiter(pre) { + var self = this; + + + self.buffer = "" + (self.buffer) + (pre) + (self.delimiter); + return nil; + }, TMP_ParserContext_skip_past_delimiter_26.$$arity = 1); + + Opal.def(self, '$skip_past_escaped_delimiter', TMP_ParserContext_skip_past_escaped_delimiter_27 = function $$skip_past_escaped_delimiter(pre) { + var self = this; + + + self.buffer = "" + (self.buffer) + (pre.$chop()) + (self.delimiter); + return nil; + }, TMP_ParserContext_skip_past_escaped_delimiter_27.$$arity = 1); + + Opal.def(self, '$buffer_has_unclosed_quotes?', TMP_ParserContext_buffer_has_unclosed_quotes$q_28 = function(append) { + var $a, $b, self = this, record = nil, trailing_quote = nil; + + + + if (append == null) { + append = nil; + }; + if ((record = (function() {if ($truthy(append)) { + return $rb_plus(self.buffer, append).$strip() + } else { + return self.buffer.$strip() + }; return nil; })())['$==']("\"")) { + return true + } else if ($truthy(record['$start_with?']("\""))) { + if ($truthy(($truthy($a = ($truthy($b = (trailing_quote = record['$end_with?']("\""))) ? record['$end_with?']("\"\"") : $b)) ? $a : record['$start_with?']("\"\"")))) { + return ($truthy($a = (record = record.$gsub("\"\"", ""))['$start_with?']("\"")) ? record['$end_with?']("\"")['$!']() : $a) + } else { + return trailing_quote['$!']() + } + } else { + return false + }; + }, TMP_ParserContext_buffer_has_unclosed_quotes$q_28.$$arity = -1); + + Opal.def(self, '$take_cellspec', TMP_ParserContext_take_cellspec_29 = function $$take_cellspec() { + var self = this; + + return self.cellspecs.$shift() + }, TMP_ParserContext_take_cellspec_29.$$arity = 0); + + Opal.def(self, '$push_cellspec', TMP_ParserContext_push_cellspec_30 = function $$push_cellspec(cellspec) { + var $a, self = this; + + + + if (cellspec == null) { + cellspec = $hash2([], {}); + }; + self.cellspecs['$<<'](($truthy($a = cellspec) ? $a : $hash2([], {}))); + return nil; + }, TMP_ParserContext_push_cellspec_30.$$arity = -1); + + Opal.def(self, '$keep_cell_open', TMP_ParserContext_keep_cell_open_31 = function $$keep_cell_open() { + var self = this; + + + self.cell_open = true; + return nil; + }, TMP_ParserContext_keep_cell_open_31.$$arity = 0); + + Opal.def(self, '$mark_cell_closed', TMP_ParserContext_mark_cell_closed_32 = function $$mark_cell_closed() { + var self = this; + + + self.cell_open = false; + return nil; + }, TMP_ParserContext_mark_cell_closed_32.$$arity = 0); + + Opal.def(self, '$cell_open?', TMP_ParserContext_cell_open$q_33 = function() { + var self = this; + + return self.cell_open + }, TMP_ParserContext_cell_open$q_33.$$arity = 0); + + Opal.def(self, '$cell_closed?', TMP_ParserContext_cell_closed$q_34 = function() { + var self = this; + + return self.cell_open['$!']() + }, TMP_ParserContext_cell_closed$q_34.$$arity = 0); + + Opal.def(self, '$close_open_cell', TMP_ParserContext_close_open_cell_35 = function $$close_open_cell(next_cellspec) { + var self = this; + + + + if (next_cellspec == null) { + next_cellspec = $hash2([], {}); + }; + self.$push_cellspec(next_cellspec); + if ($truthy(self['$cell_open?']())) { + self.$close_cell(true)}; + self.$advance(); + return nil; + }, TMP_ParserContext_close_open_cell_35.$$arity = -1); + + Opal.def(self, '$close_cell', TMP_ParserContext_close_cell_36 = function $$close_cell(eol) {try { + + var $a, $b, TMP_37, self = this, cell_text = nil, cellspec = nil, repeat = nil; + + + + if (eol == null) { + eol = false; + }; + if (self.format['$==']("psv")) { + + cell_text = self.buffer; + self.buffer = ""; + if ($truthy((cellspec = self.$take_cellspec()))) { + repeat = ($truthy($a = cellspec.$delete("repeatcol")) ? $a : 1) + } else { + + self.$logger().$error(self.$message_with_context("table missing leading separator; recovering automatically", $hash2(["source_location"], {"source_location": $send($$$($$($nesting, 'Reader'), 'Cursor'), 'new', Opal.to_a(self.start_cursor_data))}))); + cellspec = $hash2([], {}); + repeat = 1; + }; + } else { + + cell_text = self.buffer.$strip(); + self.buffer = ""; + cellspec = nil; + repeat = 1; + if ($truthy(($truthy($a = (($b = self.format['$==']("csv")) ? cell_text['$empty?']()['$!']() : self.format['$==']("csv"))) ? cell_text['$include?']("\"") : $a))) { + if ($truthy(($truthy($a = cell_text['$start_with?']("\"")) ? cell_text['$end_with?']("\"") : $a))) { + if ($truthy((cell_text = cell_text.$slice(1, $rb_minus(cell_text.$length(), 2))))) { + cell_text = cell_text.$strip().$squeeze("\"") + } else { + + self.$logger().$error(self.$message_with_context("unclosed quote in CSV data; setting cell to empty", $hash2(["source_location"], {"source_location": self.reader.$cursor_at_prev_line()}))); + cell_text = ""; + } + } else { + cell_text = cell_text.$squeeze("\"") + }}; + }; + $send((1), 'upto', [repeat], (TMP_37 = function(i){var self = TMP_37.$$s || this, $c, $d, TMP_38, $e, column = nil, extra_cols = nil, offset = nil, cell = nil; + if (self.colcount == null) self.colcount = nil; + if (self.table == null) self.table = nil; + if (self.current_row == null) self.current_row = nil; + if (self.reader == null) self.reader = nil; + if (self.column_visits == null) self.column_visits = nil; + if (self.linenum == null) self.linenum = nil; + + + + if (i == null) { + i = nil; + }; + if (self.colcount['$=='](-1)) { + + self.table.$columns()['$<<']((column = $$$($$($nesting, 'Table'), 'Column').$new(self.table, $rb_minus($rb_plus(self.table.$columns().$size(), i), 1)))); + if ($truthy(($truthy($c = ($truthy($d = cellspec) ? cellspec['$key?']("colspan") : $d)) ? $rb_gt((extra_cols = $rb_minus(cellspec['$[]']("colspan").$to_i(), 1)), 0) : $c))) { + + offset = self.table.$columns().$size(); + $send(extra_cols, 'times', [], (TMP_38 = function(j){var self = TMP_38.$$s || this; + if (self.table == null) self.table = nil; + + + + if (j == null) { + j = nil; + }; + return self.table.$columns()['$<<']($$$($$($nesting, 'Table'), 'Column').$new(self.table, $rb_plus(offset, j)));}, TMP_38.$$s = self, TMP_38.$$arity = 1, TMP_38));}; + } else if ($truthy((column = self.table.$columns()['$[]'](self.current_row.$size())))) { + } else { + + self.$logger().$error(self.$message_with_context("dropping cell because it exceeds specified number of columns", $hash2(["source_location"], {"source_location": self.reader.$cursor_before_mark()}))); + Opal.ret(nil); + }; + cell = $$$($$($nesting, 'Table'), 'Cell').$new(column, cell_text, cellspec, $hash2(["cursor"], {"cursor": self.reader.$cursor_before_mark()})); + self.reader.$mark(); + if ($truthy(($truthy($c = cell.$rowspan()['$!']()) ? $c : cell.$rowspan()['$=='](1)))) { + } else { + self.$activate_rowspan(cell.$rowspan(), ($truthy($c = cell.$colspan()) ? $c : 1)) + }; + self.column_visits = $rb_plus(self.column_visits, ($truthy($c = cell.$colspan()) ? $c : 1)); + self.current_row['$<<'](cell); + if ($truthy(($truthy($c = self['$end_of_row?']()) ? ($truthy($d = ($truthy($e = self.colcount['$!='](-1)) ? $e : $rb_gt(self.linenum, 0))) ? $d : ($truthy($e = eol) ? i['$=='](repeat) : $e)) : $c))) { + return self.$close_row() + } else { + return nil + };}, TMP_37.$$s = self, TMP_37.$$arity = 1, TMP_37)); + self.cell_open = false; + return nil; + } catch ($returner) { if ($returner === Opal.returner) { return $returner.$v } throw $returner; } + }, TMP_ParserContext_close_cell_36.$$arity = -1); + + Opal.def(self, '$close_row', TMP_ParserContext_close_row_39 = function $$close_row() { + var $a, self = this, $writer = nil; + + + self.table.$rows().$body()['$<<'](self.current_row); + if (self.colcount['$=='](-1)) { + self.colcount = self.column_visits}; + self.column_visits = 0; + self.current_row = []; + self.active_rowspans.$shift(); + ($truthy($a = self.active_rowspans['$[]'](0)) ? $a : (($writer = [0, 0]), $send(self.active_rowspans, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + return nil; + }, TMP_ParserContext_close_row_39.$$arity = 0); + + Opal.def(self, '$activate_rowspan', TMP_ParserContext_activate_rowspan_40 = function $$activate_rowspan(rowspan, colspan) { + var TMP_41, self = this; + + + $send((1).$upto($rb_minus(rowspan, 1)), 'each', [], (TMP_41 = function(i){var self = TMP_41.$$s || this, $a, $writer = nil; + if (self.active_rowspans == null) self.active_rowspans = nil; + + + + if (i == null) { + i = nil; + }; + $writer = [i, $rb_plus(($truthy($a = self.active_rowspans['$[]'](i)) ? $a : 0), colspan)]; + $send(self.active_rowspans, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];}, TMP_41.$$s = self, TMP_41.$$arity = 1, TMP_41)); + return nil; + }, TMP_ParserContext_activate_rowspan_40.$$arity = 2); + + Opal.def(self, '$end_of_row?', TMP_ParserContext_end_of_row$q_42 = function() { + var $a, self = this; + + return ($truthy($a = self.colcount['$=='](-1)) ? $a : self.$effective_column_visits()['$=='](self.colcount)) + }, TMP_ParserContext_end_of_row$q_42.$$arity = 0); + + Opal.def(self, '$effective_column_visits', TMP_ParserContext_effective_column_visits_43 = function $$effective_column_visits() { + var self = this; + + return $rb_plus(self.column_visits, self.active_rowspans['$[]'](0)) + }, TMP_ParserContext_effective_column_visits_43.$$arity = 0); + return (Opal.def(self, '$advance', TMP_ParserContext_advance_44 = function $$advance() { + var self = this; + + return (self.linenum = $rb_plus(self.linenum, 1)) + }, TMP_ParserContext_advance_44.$$arity = 0), nil) && 'advance'; + })($$($nesting, 'Table'), null, $nesting); + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/converter/composite"] = function(Opal) { + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $send = Opal.send, $truthy = Opal.truthy, $hash2 = Opal.hash2; + + Opal.add_stubs(['$attr_reader', '$each', '$compact', '$flatten', '$respond_to?', '$composed', '$node_name', '$convert', '$converter_for', '$[]', '$find_converter', '$[]=', '$-', '$handles?', '$raise']); + return (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + (function($base, $super, $parent_nesting) { + function $CompositeConverter(){}; + var self = $CompositeConverter = $klass($base, $super, 'CompositeConverter', $CompositeConverter); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_CompositeConverter_initialize_1, TMP_CompositeConverter_convert_3, TMP_CompositeConverter_converter_for_4, TMP_CompositeConverter_find_converter_5; + + def.converter_map = def.converters = nil; + + self.$attr_reader("converters"); + + Opal.def(self, '$initialize', TMP_CompositeConverter_initialize_1 = function $$initialize(backend, $a) { + var $post_args, converters, TMP_2, self = this; + + + + $post_args = Opal.slice.call(arguments, 1, arguments.length); + + converters = $post_args;; + self.backend = backend; + $send((self.converters = converters.$flatten().$compact()), 'each', [], (TMP_2 = function(converter){var self = TMP_2.$$s || this; + + + + if (converter == null) { + converter = nil; + }; + if ($truthy(converter['$respond_to?']("composed"))) { + return converter.$composed(self) + } else { + return nil + };}, TMP_2.$$s = self, TMP_2.$$arity = 1, TMP_2)); + return (self.converter_map = $hash2([], {})); + }, TMP_CompositeConverter_initialize_1.$$arity = -2); + + Opal.def(self, '$convert', TMP_CompositeConverter_convert_3 = function $$convert(node, transform, opts) { + var $a, self = this; + + + + if (transform == null) { + transform = nil; + }; + + if (opts == null) { + opts = $hash2([], {}); + }; + transform = ($truthy($a = transform) ? $a : node.$node_name()); + return self.$converter_for(transform).$convert(node, transform, opts); + }, TMP_CompositeConverter_convert_3.$$arity = -2); + Opal.alias(self, "convert_with_options", "convert"); + + Opal.def(self, '$converter_for', TMP_CompositeConverter_converter_for_4 = function $$converter_for(transform) { + var $a, self = this, $writer = nil; + + return ($truthy($a = self.converter_map['$[]'](transform)) ? $a : (($writer = [transform, self.$find_converter(transform)]), $send(self.converter_map, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])) + }, TMP_CompositeConverter_converter_for_4.$$arity = 1); + return (Opal.def(self, '$find_converter', TMP_CompositeConverter_find_converter_5 = function $$find_converter(transform) {try { + + var TMP_6, self = this; + + + $send(self.converters, 'each', [], (TMP_6 = function(candidate){var self = TMP_6.$$s || this; + + + + if (candidate == null) { + candidate = nil; + }; + if ($truthy(candidate['$handles?'](transform))) { + Opal.ret(candidate) + } else { + return nil + };}, TMP_6.$$s = self, TMP_6.$$arity = 1, TMP_6)); + return self.$raise("" + "Could not find a converter to handle transform: " + (transform)); + } catch ($returner) { if ($returner === Opal.returner) { return $returner.$v } throw $returner; } + }, TMP_CompositeConverter_find_converter_5.$$arity = 1), nil) && 'find_converter'; + })($$($nesting, 'Converter'), $$$($$($nesting, 'Converter'), 'Base'), $nesting) + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/converter/html5"] = function(Opal) { + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + function $rb_gt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); + } + function $rb_plus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); + } + function $rb_le(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs <= rhs : lhs['$<='](rhs); + } + function $rb_lt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); + } + function $rb_times(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs * rhs : lhs['$*'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $send = Opal.send, $hash2 = Opal.hash2, $truthy = Opal.truthy, $gvars = Opal.gvars; + + Opal.add_stubs(['$default=', '$-', '$==', '$[]', '$instance', '$empty?', '$attr', '$attr?', '$<<', '$include?', '$gsub', '$extname', '$slice', '$length', '$doctitle', '$normalize_web_path', '$embed_primary_stylesheet', '$read_asset', '$normalize_system_path', '$===', '$coderay_stylesheet_name', '$embed_coderay_stylesheet', '$pygments_stylesheet_name', '$embed_pygments_stylesheet', '$docinfo', '$id', '$sections?', '$doctype', '$join', '$noheader', '$outline', '$generate_manname_section', '$has_header?', '$notitle', '$title', '$header', '$each', '$authors', '$>', '$name', '$email', '$sub_macros', '$+', '$downcase', '$concat', '$content', '$footnotes?', '$!', '$footnotes', '$index', '$text', '$nofooter', '$inspect', '$!=', '$to_i', '$attributes', '$document', '$sections', '$level', '$caption', '$captioned_title', '$numbered', '$<=', '$<', '$sectname', '$sectnum', '$role', '$title?', '$icon_uri', '$compact', '$media_uri', '$option?', '$append_boolean_attribute', '$style', '$items', '$blocks?', '$text?', '$chomp', '$safe', '$read_svg_contents', '$alt', '$image_uri', '$encode_quotes', '$append_link_constraint_attrs', '$pygments_background', '$to_sym', '$*', '$count', '$start_with?', '$end_with?', '$list_marker_keyword', '$parent', '$warn', '$logger', '$context', '$error', '$new', '$size', '$columns', '$by_section', '$rows', '$colspan', '$rowspan', '$role?', '$unshift', '$shift', '$split', '$nil_or_empty?', '$type', '$catalog', '$xreftext', '$target', '$map', '$chop', '$upcase', '$read_contents', '$sub', '$match']); + return (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + (function($base, $super, $parent_nesting) { + function $Html5Converter(){}; + var self = $Html5Converter = $klass($base, $super, 'Html5Converter', $Html5Converter); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Html5Converter_initialize_1, TMP_Html5Converter_document_2, TMP_Html5Converter_embedded_5, TMP_Html5Converter_outline_7, TMP_Html5Converter_section_9, TMP_Html5Converter_admonition_10, TMP_Html5Converter_audio_11, TMP_Html5Converter_colist_12, TMP_Html5Converter_dlist_15, TMP_Html5Converter_example_22, TMP_Html5Converter_floating_title_23, TMP_Html5Converter_image_24, TMP_Html5Converter_listing_25, TMP_Html5Converter_literal_26, TMP_Html5Converter_stem_27, TMP_Html5Converter_olist_29, TMP_Html5Converter_open_31, TMP_Html5Converter_page_break_32, TMP_Html5Converter_paragraph_33, TMP_Html5Converter_preamble_34, TMP_Html5Converter_quote_35, TMP_Html5Converter_thematic_break_36, TMP_Html5Converter_sidebar_37, TMP_Html5Converter_table_38, TMP_Html5Converter_toc_43, TMP_Html5Converter_ulist_44, TMP_Html5Converter_verse_46, TMP_Html5Converter_video_47, TMP_Html5Converter_inline_anchor_48, TMP_Html5Converter_inline_break_49, TMP_Html5Converter_inline_button_50, TMP_Html5Converter_inline_callout_51, TMP_Html5Converter_inline_footnote_52, TMP_Html5Converter_inline_image_53, TMP_Html5Converter_inline_indexterm_56, TMP_Html5Converter_inline_kbd_57, TMP_Html5Converter_inline_menu_58, TMP_Html5Converter_inline_quoted_59, TMP_Html5Converter_append_boolean_attribute_60, TMP_Html5Converter_encode_quotes_61, TMP_Html5Converter_generate_manname_section_62, TMP_Html5Converter_append_link_constraint_attrs_63, TMP_Html5Converter_read_svg_contents_64, $writer = nil; + + def.xml_mode = def.void_element_slash = def.stylesheets = def.pygments_bg = def.refs = nil; + + + $writer = [["", "", false]]; + $send(Opal.const_set($nesting[0], 'QUOTE_TAGS', $hash2(["monospaced", "emphasis", "strong", "double", "single", "mark", "superscript", "subscript", "asciimath", "latexmath"], {"monospaced": ["", "", true], "emphasis": ["", "", true], "strong": ["", "", true], "double": ["“", "”", false], "single": ["‘", "’", false], "mark": ["", "", true], "superscript": ["", "", true], "subscript": ["", "", true], "asciimath": ["\\$", "\\$", false], "latexmath": ["\\(", "\\)", false]})), 'default=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + Opal.const_set($nesting[0], 'DropAnchorRx', /<(?:a[^>+]+|\/a)>/); + Opal.const_set($nesting[0], 'StemBreakRx', / *\\\n(?:\\?\n)*|\n\n+/); + Opal.const_set($nesting[0], 'SvgPreambleRx', /^.*?(?=]*>/); + Opal.const_set($nesting[0], 'DimensionAttributeRx', /\s(?:width|height|style)=(["']).*?\1/); + + Opal.def(self, '$initialize', TMP_Html5Converter_initialize_1 = function $$initialize(backend, opts) { + var self = this; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + self.xml_mode = opts['$[]']("htmlsyntax")['$==']("xml"); + self.void_element_slash = (function() {if ($truthy(self.xml_mode)) { + return "/" + } else { + return nil + }; return nil; })(); + return (self.stylesheets = $$($nesting, 'Stylesheets').$instance()); + }, TMP_Html5Converter_initialize_1.$$arity = -2); + + Opal.def(self, '$document', TMP_Html5Converter_document_2 = function $$document(node) { + var $a, $b, $c, TMP_3, TMP_4, self = this, slash = nil, br = nil, asset_uri_scheme = nil, cdn_base = nil, linkcss = nil, result = nil, lang_attribute = nil, authors = nil, icon_href = nil, icon_type = nil, icon_ext = nil, webfonts = nil, iconfont_stylesheet = nil, $case = nil, highlighter = nil, pygments_style = nil, docinfo_content = nil, body_attrs = nil, sectioned = nil, classes = nil, details = nil, idx = nil, highlightjs_path = nil, prettify_path = nil, eqnums_val = nil, eqnums_opt = nil; + + + slash = self.void_element_slash; + br = "" + ""; + if ($truthy((asset_uri_scheme = node.$attr("asset-uri-scheme", "https"))['$empty?']())) { + } else { + asset_uri_scheme = "" + (asset_uri_scheme) + ":" + }; + cdn_base = "" + (asset_uri_scheme) + "//cdnjs.cloudflare.com/ajax/libs"; + linkcss = node['$attr?']("linkcss"); + result = [""]; + lang_attribute = (function() {if ($truthy(node['$attr?']("nolang"))) { + return "" + } else { + return "" + " lang=\"" + (node.$attr("lang", "en")) + "\"" + }; return nil; })(); + result['$<<']("" + ""); + result['$<<']("" + "\n" + "\n" + "\n" + "\n" + ""); + if ($truthy(node['$attr?']("app-name"))) { + result['$<<']("" + "")}; + if ($truthy(node['$attr?']("description"))) { + result['$<<']("" + "")}; + if ($truthy(node['$attr?']("keywords"))) { + result['$<<']("" + "")}; + if ($truthy(node['$attr?']("authors"))) { + result['$<<']("" + "")}; + if ($truthy(node['$attr?']("copyright"))) { + result['$<<']("" + "")}; + if ($truthy(node['$attr?']("favicon"))) { + + if ($truthy((icon_href = node.$attr("favicon"))['$empty?']())) { + $a = ["favicon.ico", "image/x-icon"], (icon_href = $a[0]), (icon_type = $a[1]), $a + } else { + icon_type = (function() {if ((icon_ext = $$$('::', 'File').$extname(icon_href))['$=='](".ico")) { + return "image/x-icon" + } else { + return "" + "image/" + (icon_ext.$slice(1, icon_ext.$length())) + }; return nil; })() + }; + result['$<<']("" + "");}; + result['$<<']("" + "" + (node.$doctitle($hash2(["sanitize", "use_fallback"], {"sanitize": true, "use_fallback": true}))) + ""); + if ($truthy($$($nesting, 'DEFAULT_STYLESHEET_KEYS')['$include?'](node.$attr("stylesheet")))) { + + if ($truthy((webfonts = node.$attr("webfonts")))) { + result['$<<']("" + "")}; + if ($truthy(linkcss)) { + result['$<<']("" + "") + } else { + result['$<<'](self.stylesheets.$embed_primary_stylesheet()) + }; + } else if ($truthy(node['$attr?']("stylesheet"))) { + if ($truthy(linkcss)) { + result['$<<']("" + "") + } else { + result['$<<']("" + "") + }}; + if ($truthy(node['$attr?']("icons", "font"))) { + if ($truthy(node['$attr?']("iconfont-remote"))) { + result['$<<']("" + "") + } else { + + iconfont_stylesheet = "" + (node.$attr("iconfont-name", "font-awesome")) + ".css"; + result['$<<']("" + ""); + }}; + $case = (highlighter = node.$attr("source-highlighter")); + if ("coderay"['$===']($case)) {if (node.$attr("coderay-css", "class")['$==']("class")) { + if ($truthy(linkcss)) { + result['$<<']("" + "") + } else { + result['$<<'](self.stylesheets.$embed_coderay_stylesheet()) + }}} + else if ("pygments"['$===']($case)) {if (node.$attr("pygments-css", "class")['$==']("class")) { + + pygments_style = node.$attr("pygments-style"); + if ($truthy(linkcss)) { + result['$<<']("" + "") + } else { + result['$<<'](self.stylesheets.$embed_pygments_stylesheet(pygments_style)) + };}}; + if ($truthy((docinfo_content = node.$docinfo())['$empty?']())) { + } else { + result['$<<'](docinfo_content) + }; + result['$<<'](""); + body_attrs = (function() {if ($truthy(node.$id())) { + return ["" + "id=\"" + (node.$id()) + "\""] + } else { + return [] + }; return nil; })(); + if ($truthy(($truthy($a = ($truthy($b = ($truthy($c = (sectioned = node['$sections?']())) ? node['$attr?']("toc-class") : $c)) ? node['$attr?']("toc") : $b)) ? node['$attr?']("toc-placement", "auto") : $a))) { + classes = [node.$doctype(), node.$attr("toc-class"), "" + "toc-" + (node.$attr("toc-position", "header"))] + } else { + classes = [node.$doctype()] + }; + if ($truthy(node['$attr?']("docrole"))) { + classes['$<<'](node.$attr("docrole"))}; + body_attrs['$<<']("" + "class=\"" + (classes.$join(" ")) + "\""); + if ($truthy(node['$attr?']("max-width"))) { + body_attrs['$<<']("" + "style=\"max-width: " + (node.$attr("max-width")) + ";\"")}; + result['$<<']("" + ""); + if ($truthy(node.$noheader())) { + } else { + + result['$<<']("
    "); + if (node.$doctype()['$==']("manpage")) { + + result['$<<']("" + "

    " + (node.$doctitle()) + " Manual Page

    "); + if ($truthy(($truthy($a = ($truthy($b = sectioned) ? node['$attr?']("toc") : $b)) ? node['$attr?']("toc-placement", "auto") : $a))) { + result['$<<']("" + "
    \n" + "
    " + (node.$attr("toc-title")) + "
    \n" + (self.$outline(node)) + "\n" + "
    ")}; + if ($truthy(node['$attr?']("manpurpose"))) { + result['$<<'](self.$generate_manname_section(node))}; + } else { + + if ($truthy(node['$has_header?']())) { + + if ($truthy(node.$notitle())) { + } else { + result['$<<']("" + "

    " + (node.$header().$title()) + "

    ") + }; + details = []; + idx = 1; + $send(node.$authors(), 'each', [], (TMP_3 = function(author){var self = TMP_3.$$s || this; + + + + if (author == null) { + author = nil; + }; + details['$<<']("" + "" + (author.$name()) + "" + (br)); + if ($truthy(author.$email())) { + details['$<<']("" + "" + (node.$sub_macros(author.$email())) + "" + (br))}; + return (idx = $rb_plus(idx, 1));}, TMP_3.$$s = self, TMP_3.$$arity = 1, TMP_3)); + if ($truthy(node['$attr?']("revnumber"))) { + details['$<<']("" + "" + (($truthy($a = node.$attr("version-label")) ? $a : "").$downcase()) + " " + (node.$attr("revnumber")) + ((function() {if ($truthy(node['$attr?']("revdate"))) { + return "," + } else { + return "" + }; return nil; })()) + "")}; + if ($truthy(node['$attr?']("revdate"))) { + details['$<<']("" + "" + (node.$attr("revdate")) + "")}; + if ($truthy(node['$attr?']("revremark"))) { + details['$<<']("" + (br) + "" + (node.$attr("revremark")) + "")}; + if ($truthy(details['$empty?']())) { + } else { + + result['$<<']("
    "); + result.$concat(details); + result['$<<']("
    "); + };}; + if ($truthy(($truthy($a = ($truthy($b = sectioned) ? node['$attr?']("toc") : $b)) ? node['$attr?']("toc-placement", "auto") : $a))) { + result['$<<']("" + "
    \n" + "
    " + (node.$attr("toc-title")) + "
    \n" + (self.$outline(node)) + "\n" + "
    ")}; + }; + result['$<<']("
    "); + }; + result['$<<']("" + "
    \n" + (node.$content()) + "\n" + "
    "); + if ($truthy(($truthy($a = node['$footnotes?']()) ? node['$attr?']("nofootnotes")['$!']() : $a))) { + + result['$<<']("" + "
    \n" + ""); + $send(node.$footnotes(), 'each', [], (TMP_4 = function(footnote){var self = TMP_4.$$s || this; + + + + if (footnote == null) { + footnote = nil; + }; + return result['$<<']("" + "
    \n" + "" + (footnote.$index()) + ". " + (footnote.$text()) + "\n" + "
    ");}, TMP_4.$$s = self, TMP_4.$$arity = 1, TMP_4)); + result['$<<']("
    ");}; + if ($truthy(node.$nofooter())) { + } else { + + result['$<<']("
    "); + result['$<<']("
    "); + if ($truthy(node['$attr?']("revnumber"))) { + result['$<<']("" + (node.$attr("version-label")) + " " + (node.$attr("revnumber")) + (br))}; + if ($truthy(($truthy($a = node['$attr?']("last-update-label")) ? node['$attr?']("reproducible")['$!']() : $a))) { + result['$<<']("" + (node.$attr("last-update-label")) + " " + (node.$attr("docdatetime")))}; + result['$<<']("
    "); + result['$<<']("
    "); + }; + if ($truthy((docinfo_content = node.$docinfo("footer"))['$empty?']())) { + } else { + result['$<<'](docinfo_content) + }; + $case = highlighter; + if ("highlightjs"['$===']($case) || "highlight.js"['$===']($case)) { + highlightjs_path = node.$attr("highlightjsdir", "" + (cdn_base) + "/highlight.js/9.13.1"); + result['$<<']("" + ""); + result['$<<']("" + "\n" + "");} + else if ("prettify"['$===']($case)) { + prettify_path = node.$attr("prettifydir", "" + (cdn_base) + "/prettify/r298"); + result['$<<']("" + ""); + result['$<<']("" + "\n" + "");}; + if ($truthy(node['$attr?']("stem"))) { + + eqnums_val = node.$attr("eqnums", "none"); + if ($truthy(eqnums_val['$empty?']())) { + eqnums_val = "AMS"}; + eqnums_opt = "" + " equationNumbers: { autoNumber: \"" + (eqnums_val) + "\" } "; + result['$<<']("" + "\n" + "");}; + result['$<<'](""); + result['$<<'](""); + return result.$join($$($nesting, 'LF')); + }, TMP_Html5Converter_document_2.$$arity = 1); + + Opal.def(self, '$embedded', TMP_Html5Converter_embedded_5 = function $$embedded(node) { + var $a, $b, $c, TMP_6, self = this, result = nil, id_attr = nil, toc_p = nil; + + + result = []; + if (node.$doctype()['$==']("manpage")) { + + if ($truthy(node.$notitle())) { + } else { + + id_attr = (function() {if ($truthy(node.$id())) { + return "" + " id=\"" + (node.$id()) + "\"" + } else { + return "" + }; return nil; })(); + result['$<<']("" + "" + (node.$doctitle()) + " Manual Page"); + }; + if ($truthy(node['$attr?']("manpurpose"))) { + result['$<<'](self.$generate_manname_section(node))}; + } else if ($truthy(($truthy($a = node['$has_header?']()) ? node.$notitle()['$!']() : $a))) { + + id_attr = (function() {if ($truthy(node.$id())) { + return "" + " id=\"" + (node.$id()) + "\"" + } else { + return "" + }; return nil; })(); + result['$<<']("" + "" + (node.$header().$title()) + "");}; + if ($truthy(($truthy($a = ($truthy($b = ($truthy($c = node['$sections?']()) ? node['$attr?']("toc") : $c)) ? (toc_p = node.$attr("toc-placement"))['$!=']("macro") : $b)) ? toc_p['$!=']("preamble") : $a))) { + result['$<<']("" + "
    \n" + "
    " + (node.$attr("toc-title")) + "
    \n" + (self.$outline(node)) + "\n" + "
    ")}; + result['$<<'](node.$content()); + if ($truthy(($truthy($a = node['$footnotes?']()) ? node['$attr?']("nofootnotes")['$!']() : $a))) { + + result['$<<']("" + "
    \n" + ""); + $send(node.$footnotes(), 'each', [], (TMP_6 = function(footnote){var self = TMP_6.$$s || this; + + + + if (footnote == null) { + footnote = nil; + }; + return result['$<<']("" + "
    \n" + "" + (footnote.$index()) + ". " + (footnote.$text()) + "\n" + "
    ");}, TMP_6.$$s = self, TMP_6.$$arity = 1, TMP_6)); + result['$<<']("
    ");}; + return result.$join($$($nesting, 'LF')); + }, TMP_Html5Converter_embedded_5.$$arity = 1); + + Opal.def(self, '$outline', TMP_Html5Converter_outline_7 = function $$outline(node, opts) { + var $a, $b, TMP_8, self = this, sectnumlevels = nil, toclevels = nil, sections = nil, result = nil; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + if ($truthy(node['$sections?']())) { + } else { + return nil + }; + sectnumlevels = ($truthy($a = opts['$[]']("sectnumlevels")) ? $a : ($truthy($b = node.$document().$attributes()['$[]']("sectnumlevels")) ? $b : 3).$to_i()); + toclevels = ($truthy($a = opts['$[]']("toclevels")) ? $a : ($truthy($b = node.$document().$attributes()['$[]']("toclevels")) ? $b : 2).$to_i()); + sections = node.$sections(); + result = ["" + "
      "]; + $send(sections, 'each', [], (TMP_8 = function(section){var self = TMP_8.$$s || this, $c, slevel = nil, stitle = nil, signifier = nil, child_toc_level = nil; + + + + if (section == null) { + section = nil; + }; + slevel = section.$level(); + if ($truthy(section.$caption())) { + stitle = section.$captioned_title() + } else if ($truthy(($truthy($c = section.$numbered()) ? $rb_le(slevel, sectnumlevels) : $c))) { + if ($truthy(($truthy($c = $rb_lt(slevel, 2)) ? node.$document().$doctype()['$==']("book") : $c))) { + if (section.$sectname()['$==']("chapter")) { + stitle = "" + ((function() {if ($truthy((signifier = node.$document().$attributes()['$[]']("chapter-signifier")))) { + return "" + (signifier) + " " + } else { + return "" + }; return nil; })()) + (section.$sectnum()) + " " + (section.$title()) + } else if (section.$sectname()['$==']("part")) { + stitle = "" + ((function() {if ($truthy((signifier = node.$document().$attributes()['$[]']("part-signifier")))) { + return "" + (signifier) + " " + } else { + return "" + }; return nil; })()) + (section.$sectnum(nil, ":")) + " " + (section.$title()) + } else { + stitle = "" + (section.$sectnum()) + " " + (section.$title()) + } + } else { + stitle = "" + (section.$sectnum()) + " " + (section.$title()) + } + } else { + stitle = section.$title() + }; + if ($truthy(stitle['$include?']("" + (stitle) + ""); + result['$<<'](child_toc_level); + return result['$<<'](""); + } else { + return result['$<<']("" + "
    • " + (stitle) + "
    • ") + };}, TMP_8.$$s = self, TMP_8.$$arity = 1, TMP_8)); + result['$<<']("
    "); + return result.$join($$($nesting, 'LF')); + }, TMP_Html5Converter_outline_7.$$arity = -2); + + Opal.def(self, '$section', TMP_Html5Converter_section_9 = function $$section(node) { + var $a, $b, self = this, doc_attrs = nil, level = nil, title = nil, signifier = nil, id_attr = nil, id = nil, role = nil; + + + doc_attrs = node.$document().$attributes(); + level = node.$level(); + if ($truthy(node.$caption())) { + title = node.$captioned_title() + } else if ($truthy(($truthy($a = node.$numbered()) ? $rb_le(level, ($truthy($b = doc_attrs['$[]']("sectnumlevels")) ? $b : 3).$to_i()) : $a))) { + if ($truthy(($truthy($a = $rb_lt(level, 2)) ? node.$document().$doctype()['$==']("book") : $a))) { + if (node.$sectname()['$==']("chapter")) { + title = "" + ((function() {if ($truthy((signifier = doc_attrs['$[]']("chapter-signifier")))) { + return "" + (signifier) + " " + } else { + return "" + }; return nil; })()) + (node.$sectnum()) + " " + (node.$title()) + } else if (node.$sectname()['$==']("part")) { + title = "" + ((function() {if ($truthy((signifier = doc_attrs['$[]']("part-signifier")))) { + return "" + (signifier) + " " + } else { + return "" + }; return nil; })()) + (node.$sectnum(nil, ":")) + " " + (node.$title()) + } else { + title = "" + (node.$sectnum()) + " " + (node.$title()) + } + } else { + title = "" + (node.$sectnum()) + " " + (node.$title()) + } + } else { + title = node.$title() + }; + if ($truthy(node.$id())) { + + id_attr = "" + " id=\"" + ((id = node.$id())) + "\""; + if ($truthy(doc_attrs['$[]']("sectlinks"))) { + title = "" + "" + (title) + ""}; + if ($truthy(doc_attrs['$[]']("sectanchors"))) { + if (doc_attrs['$[]']("sectanchors")['$==']("after")) { + title = "" + (title) + "" + } else { + title = "" + "" + (title) + }}; + } else { + id_attr = "" + }; + if (level['$=='](0)) { + return "" + "" + (title) + "\n" + (node.$content()) + } else { + return "" + "
    \n" + "" + (title) + "\n" + ((function() {if (level['$=='](1)) { + return "" + "
    \n" + (node.$content()) + "\n" + "
    " + } else { + return node.$content() + }; return nil; })()) + "\n" + "
    " + }; + }, TMP_Html5Converter_section_9.$$arity = 1); + + Opal.def(self, '$admonition', TMP_Html5Converter_admonition_10 = function $$admonition(node) { + var $a, self = this, id_attr = nil, name = nil, title_element = nil, label = nil, role = nil; + + + id_attr = (function() {if ($truthy(node.$id())) { + return "" + " id=\"" + (node.$id()) + "\"" + } else { + return "" + }; return nil; })(); + name = node.$attr("name"); + title_element = (function() {if ($truthy(node['$title?']())) { + return "" + "
    " + (node.$title()) + "
    \n" + } else { + return "" + }; return nil; })(); + if ($truthy(node.$document()['$attr?']("icons"))) { + if ($truthy(($truthy($a = node.$document()['$attr?']("icons", "font")) ? node['$attr?']("icon")['$!']() : $a))) { + label = "" + "" + } else { + label = "" + "\""" + } + } else { + label = "" + "
    " + (node.$attr("textlabel")) + "
    " + }; + return "" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "
    \n" + (label) + "\n" + "\n" + (title_element) + (node.$content()) + "\n" + "
    \n" + "
    "; + }, TMP_Html5Converter_admonition_10.$$arity = 1); + + Opal.def(self, '$audio', TMP_Html5Converter_audio_11 = function $$audio(node) { + var $a, self = this, xml = nil, id_attribute = nil, classes = nil, class_attribute = nil, title_element = nil, start_t = nil, end_t = nil, time_anchor = nil; + + + xml = self.xml_mode; + id_attribute = (function() {if ($truthy(node.$id())) { + return "" + " id=\"" + (node.$id()) + "\"" + } else { + return "" + }; return nil; })(); + classes = ["audioblock", node.$role()].$compact(); + class_attribute = "" + " class=\"" + (classes.$join(" ")) + "\""; + title_element = (function() {if ($truthy(node['$title?']())) { + return "" + "
    " + (node.$title()) + "
    \n" + } else { + return "" + }; return nil; })(); + start_t = node.$attr("start", nil, false); + end_t = node.$attr("end", nil, false); + time_anchor = (function() {if ($truthy(($truthy($a = start_t) ? $a : end_t))) { + return "" + "#t=" + (($truthy($a = start_t) ? $a : "")) + ((function() {if ($truthy(end_t)) { + return "" + "," + (end_t) + } else { + return "" + }; return nil; })()) + } else { + return "" + }; return nil; })(); + return "" + "\n" + (title_element) + "
    \n" + "\n" + "
    \n" + ""; + }, TMP_Html5Converter_audio_11.$$arity = 1); + + Opal.def(self, '$colist', TMP_Html5Converter_colist_12 = function $$colist(node) { + var $a, TMP_13, TMP_14, self = this, result = nil, id_attribute = nil, classes = nil, class_attribute = nil, font_icons = nil, num = nil; + + + result = []; + id_attribute = (function() {if ($truthy(node.$id())) { + return "" + " id=\"" + (node.$id()) + "\"" + } else { + return "" + }; return nil; })(); + classes = ["colist", node.$style(), node.$role()].$compact(); + class_attribute = "" + " class=\"" + (classes.$join(" ")) + "\""; + result['$<<']("" + ""); + if ($truthy(node['$title?']())) { + result['$<<']("" + "
    " + (node.$title()) + "
    ")}; + if ($truthy(node.$document()['$attr?']("icons"))) { + + result['$<<'](""); + $a = [node.$document()['$attr?']("icons", "font"), 0], (font_icons = $a[0]), (num = $a[1]), $a; + $send(node.$items(), 'each', [], (TMP_13 = function(item){var self = TMP_13.$$s || this, num_label = nil; + if (self.void_element_slash == null) self.void_element_slash = nil; + + + + if (item == null) { + item = nil; + }; + num = $rb_plus(num, 1); + if ($truthy(font_icons)) { + num_label = "" + "" + (num) + "" + } else { + num_label = "" + "\""" + }; + return result['$<<']("" + "\n" + "\n" + "\n" + "");}, TMP_13.$$s = self, TMP_13.$$arity = 1, TMP_13)); + result['$<<']("
    " + (num_label) + "" + (item.$text()) + ((function() {if ($truthy(item['$blocks?']())) { + return $rb_plus($$($nesting, 'LF'), item.$content()) + } else { + return "" + }; return nil; })()) + "
    "); + } else { + + result['$<<']("
      "); + $send(node.$items(), 'each', [], (TMP_14 = function(item){var self = TMP_14.$$s || this; + + + + if (item == null) { + item = nil; + }; + return result['$<<']("" + "
    1. \n" + "

      " + (item.$text()) + "

      " + ((function() {if ($truthy(item['$blocks?']())) { + return $rb_plus($$($nesting, 'LF'), item.$content()) + } else { + return "" + }; return nil; })()) + "\n" + "
    2. ");}, TMP_14.$$s = self, TMP_14.$$arity = 1, TMP_14)); + result['$<<']("
    "); + }; + result['$<<'](""); + return result.$join($$($nesting, 'LF')); + }, TMP_Html5Converter_colist_12.$$arity = 1); + + Opal.def(self, '$dlist', TMP_Html5Converter_dlist_15 = function $$dlist(node) { + var TMP_16, $a, TMP_18, TMP_20, self = this, result = nil, id_attribute = nil, classes = nil, $case = nil, class_attribute = nil, slash = nil, col_style_attribute = nil, dt_style_attribute = nil; + + + result = []; + id_attribute = (function() {if ($truthy(node.$id())) { + return "" + " id=\"" + (node.$id()) + "\"" + } else { + return "" + }; return nil; })(); + classes = (function() {$case = node.$style(); + if ("qanda"['$===']($case)) {return ["qlist", "qanda", node.$role()]} + else if ("horizontal"['$===']($case)) {return ["hdlist", node.$role()]} + else {return ["dlist", node.$style(), node.$role()]}})().$compact(); + class_attribute = "" + " class=\"" + (classes.$join(" ")) + "\""; + result['$<<']("" + ""); + if ($truthy(node['$title?']())) { + result['$<<']("" + "
    " + (node.$title()) + "
    ")}; + $case = node.$style(); + if ("qanda"['$===']($case)) { + result['$<<']("
      "); + $send(node.$items(), 'each', [], (TMP_16 = function(terms, dd){var self = TMP_16.$$s || this, TMP_17; + + + + if (terms == null) { + terms = nil; + }; + + if (dd == null) { + dd = nil; + }; + result['$<<']("
    1. "); + $send([].concat(Opal.to_a(terms)), 'each', [], (TMP_17 = function(dt){var self = TMP_17.$$s || this; + + + + if (dt == null) { + dt = nil; + }; + return result['$<<']("" + "

      " + (dt.$text()) + "

      ");}, TMP_17.$$s = self, TMP_17.$$arity = 1, TMP_17)); + if ($truthy(dd)) { + + if ($truthy(dd['$text?']())) { + result['$<<']("" + "

      " + (dd.$text()) + "

      ")}; + if ($truthy(dd['$blocks?']())) { + result['$<<'](dd.$content())};}; + return result['$<<']("
    2. ");}, TMP_16.$$s = self, TMP_16.$$arity = 2, TMP_16)); + result['$<<']("
    ");} + else if ("horizontal"['$===']($case)) { + slash = self.void_element_slash; + result['$<<'](""); + if ($truthy(($truthy($a = node['$attr?']("labelwidth")) ? $a : node['$attr?']("itemwidth")))) { + + result['$<<'](""); + col_style_attribute = (function() {if ($truthy(node['$attr?']("labelwidth"))) { + return "" + " style=\"width: " + (node.$attr("labelwidth").$chomp("%")) + "%;\"" + } else { + return "" + }; return nil; })(); + result['$<<']("" + ""); + col_style_attribute = (function() {if ($truthy(node['$attr?']("itemwidth"))) { + return "" + " style=\"width: " + (node.$attr("itemwidth").$chomp("%")) + "%;\"" + } else { + return "" + }; return nil; })(); + result['$<<']("" + ""); + result['$<<']("");}; + $send(node.$items(), 'each', [], (TMP_18 = function(terms, dd){var self = TMP_18.$$s || this, TMP_19, terms_array = nil, last_term = nil; + + + + if (terms == null) { + terms = nil; + }; + + if (dd == null) { + dd = nil; + }; + result['$<<'](""); + result['$<<']("" + ""); + result['$<<'](""); + return result['$<<']("");}, TMP_18.$$s = self, TMP_18.$$arity = 2, TMP_18)); + result['$<<']("
    "); + terms_array = [].concat(Opal.to_a(terms)); + last_term = terms_array['$[]'](-1); + $send(terms_array, 'each', [], (TMP_19 = function(dt){var self = TMP_19.$$s || this; + + + + if (dt == null) { + dt = nil; + }; + result['$<<'](dt.$text()); + if ($truthy(dt['$!='](last_term))) { + return result['$<<']("" + "") + } else { + return nil + };}, TMP_19.$$s = self, TMP_19.$$arity = 1, TMP_19)); + result['$<<'](""); + if ($truthy(dd)) { + + if ($truthy(dd['$text?']())) { + result['$<<']("" + "

    " + (dd.$text()) + "

    ")}; + if ($truthy(dd['$blocks?']())) { + result['$<<'](dd.$content())};}; + result['$<<']("
    ");} + else { + result['$<<']("
    "); + dt_style_attribute = (function() {if ($truthy(node.$style())) { + return "" + } else { + return " class=\"hdlist1\"" + }; return nil; })(); + $send(node.$items(), 'each', [], (TMP_20 = function(terms, dd){var self = TMP_20.$$s || this, TMP_21; + + + + if (terms == null) { + terms = nil; + }; + + if (dd == null) { + dd = nil; + }; + $send([].concat(Opal.to_a(terms)), 'each', [], (TMP_21 = function(dt){var self = TMP_21.$$s || this; + + + + if (dt == null) { + dt = nil; + }; + return result['$<<']("" + "" + (dt.$text()) + "");}, TMP_21.$$s = self, TMP_21.$$arity = 1, TMP_21)); + if ($truthy(dd)) { + + result['$<<']("
    "); + if ($truthy(dd['$text?']())) { + result['$<<']("" + "

    " + (dd.$text()) + "

    ")}; + if ($truthy(dd['$blocks?']())) { + result['$<<'](dd.$content())}; + return result['$<<']("
    "); + } else { + return nil + };}, TMP_20.$$s = self, TMP_20.$$arity = 2, TMP_20)); + result['$<<']("
    ");}; + result['$<<'](""); + return result.$join($$($nesting, 'LF')); + }, TMP_Html5Converter_dlist_15.$$arity = 1); + + Opal.def(self, '$example', TMP_Html5Converter_example_22 = function $$example(node) { + var self = this, id_attribute = nil, title_element = nil, role = nil; + + + id_attribute = (function() {if ($truthy(node.$id())) { + return "" + " id=\"" + (node.$id()) + "\"" + } else { + return "" + }; return nil; })(); + title_element = (function() {if ($truthy(node['$title?']())) { + return "" + "
    " + (node.$captioned_title()) + "
    \n" + } else { + return "" + }; return nil; })(); + return "" + "\n" + (title_element) + "
    \n" + (node.$content()) + "\n" + "
    \n" + ""; + }, TMP_Html5Converter_example_22.$$arity = 1); + + Opal.def(self, '$floating_title', TMP_Html5Converter_floating_title_23 = function $$floating_title(node) { + var self = this, tag_name = nil, id_attribute = nil, classes = nil; + + + tag_name = "" + "h" + ($rb_plus(node.$level(), 1)); + id_attribute = (function() {if ($truthy(node.$id())) { + return "" + " id=\"" + (node.$id()) + "\"" + } else { + return "" + }; return nil; })(); + classes = [node.$style(), node.$role()].$compact(); + return "" + "<" + (tag_name) + (id_attribute) + " class=\"" + (classes.$join(" ")) + "\">" + (node.$title()) + ""; + }, TMP_Html5Converter_floating_title_23.$$arity = 1); + + Opal.def(self, '$image', TMP_Html5Converter_image_24 = function $$image(node) { + var $a, $b, $c, self = this, target = nil, width_attr = nil, height_attr = nil, svg = nil, obj = nil, img = nil, fallback = nil, id_attr = nil, classes = nil, class_attr = nil, title_el = nil; + + + target = node.$attr("target"); + width_attr = (function() {if ($truthy(node['$attr?']("width"))) { + return "" + " width=\"" + (node.$attr("width")) + "\"" + } else { + return "" + }; return nil; })(); + height_attr = (function() {if ($truthy(node['$attr?']("height"))) { + return "" + " height=\"" + (node.$attr("height")) + "\"" + } else { + return "" + }; return nil; })(); + if ($truthy(($truthy($a = ($truthy($b = ($truthy($c = node['$attr?']("format", "svg", false)) ? $c : target['$include?'](".svg"))) ? $rb_lt(node.$document().$safe(), $$$($$($nesting, 'SafeMode'), 'SECURE')) : $b)) ? ($truthy($b = (svg = node['$option?']("inline"))) ? $b : (obj = node['$option?']("interactive"))) : $a))) { + if ($truthy(svg)) { + img = ($truthy($a = self.$read_svg_contents(node, target)) ? $a : "" + "" + (node.$alt()) + "") + } else if ($truthy(obj)) { + + fallback = (function() {if ($truthy(node['$attr?']("fallback"))) { + return "" + "\""" + } else { + return "" + "" + (node.$alt()) + "" + }; return nil; })(); + img = "" + "" + (fallback) + "";}}; + img = ($truthy($a = img) ? $a : "" + "\"""); + if ($truthy(node['$attr?']("link", nil, false))) { + img = "" + "" + (img) + ""}; + id_attr = (function() {if ($truthy(node.$id())) { + return "" + " id=\"" + (node.$id()) + "\"" + } else { + return "" + }; return nil; })(); + classes = ["imageblock"]; + if ($truthy(node['$attr?']("float"))) { + classes['$<<'](node.$attr("float"))}; + if ($truthy(node['$attr?']("align"))) { + classes['$<<']("" + "text-" + (node.$attr("align")))}; + if ($truthy(node.$role())) { + classes['$<<'](node.$role())}; + class_attr = "" + " class=\"" + (classes.$join(" ")) + "\""; + title_el = (function() {if ($truthy(node['$title?']())) { + return "" + "\n
    " + (node.$captioned_title()) + "
    " + } else { + return "" + }; return nil; })(); + return "" + "\n" + "
    \n" + (img) + "\n" + "
    " + (title_el) + "\n" + ""; + }, TMP_Html5Converter_image_24.$$arity = 1); + + Opal.def(self, '$listing', TMP_Html5Converter_listing_25 = function $$listing(node) { + var $a, self = this, nowrap = nil, language = nil, code_attrs = nil, $case = nil, pre_class = nil, pre_start = nil, pre_end = nil, id_attribute = nil, title_element = nil, role = nil; + + + nowrap = ($truthy($a = node.$document()['$attr?']("prewrap")['$!']()) ? $a : node['$option?']("nowrap")); + if (node.$style()['$==']("source")) { + + if ($truthy((language = node.$attr("language", nil, false)))) { + code_attrs = "" + " data-lang=\"" + (language) + "\"" + } else { + code_attrs = "" + }; + $case = node.$document().$attr("source-highlighter"); + if ("coderay"['$===']($case)) {pre_class = "" + " class=\"CodeRay highlight" + ((function() {if ($truthy(nowrap)) { + return " nowrap" + } else { + return "" + }; return nil; })()) + "\""} + else if ("pygments"['$===']($case)) {if ($truthy(node.$document()['$attr?']("pygments-css", "inline"))) { + + if ($truthy((($a = self['pygments_bg'], $a != null && $a !== nil) ? 'instance-variable' : nil))) { + } else { + self.pygments_bg = self.stylesheets.$pygments_background(node.$document().$attr("pygments-style")) + }; + pre_class = "" + " class=\"pygments highlight" + ((function() {if ($truthy(nowrap)) { + return " nowrap" + } else { + return "" + }; return nil; })()) + "\" style=\"background: " + (self.pygments_bg) + "\""; + } else { + pre_class = "" + " class=\"pygments highlight" + ((function() {if ($truthy(nowrap)) { + return " nowrap" + } else { + return "" + }; return nil; })()) + "\"" + }} + else if ("highlightjs"['$===']($case) || "highlight.js"['$===']($case)) { + pre_class = "" + " class=\"highlightjs highlight" + ((function() {if ($truthy(nowrap)) { + return " nowrap" + } else { + return "" + }; return nil; })()) + "\""; + if ($truthy(language)) { + code_attrs = "" + " class=\"language-" + (language) + " hljs\"" + (code_attrs)};} + else if ("prettify"['$===']($case)) { + pre_class = "" + " class=\"prettyprint highlight" + ((function() {if ($truthy(nowrap)) { + return " nowrap" + } else { + return "" + }; return nil; })()) + ((function() {if ($truthy(node['$attr?']("linenums", nil, false))) { + return " linenums" + } else { + return "" + }; return nil; })()) + "\""; + if ($truthy(language)) { + code_attrs = "" + " class=\"language-" + (language) + "\"" + (code_attrs)};} + else if ("html-pipeline"['$===']($case)) { + pre_class = (function() {if ($truthy(language)) { + return "" + " lang=\"" + (language) + "\"" + } else { + return "" + }; return nil; })(); + code_attrs = "";} + else { + pre_class = "" + " class=\"highlight" + ((function() {if ($truthy(nowrap)) { + return " nowrap" + } else { + return "" + }; return nil; })()) + "\""; + if ($truthy(language)) { + code_attrs = "" + " class=\"language-" + (language) + "\"" + (code_attrs)};}; + pre_start = "" + ""; + pre_end = "
    "; + } else { + + pre_start = "" + ""; + pre_end = ""; + }; + id_attribute = (function() {if ($truthy(node.$id())) { + return "" + " id=\"" + (node.$id()) + "\"" + } else { + return "" + }; return nil; })(); + title_element = (function() {if ($truthy(node['$title?']())) { + return "" + "
    " + (node.$captioned_title()) + "
    \n" + } else { + return "" + }; return nil; })(); + return "" + "\n" + (title_element) + "
    \n" + (pre_start) + (node.$content()) + (pre_end) + "\n" + "
    \n" + ""; + }, TMP_Html5Converter_listing_25.$$arity = 1); + + Opal.def(self, '$literal', TMP_Html5Converter_literal_26 = function $$literal(node) { + var $a, self = this, id_attribute = nil, title_element = nil, nowrap = nil, role = nil; + + + id_attribute = (function() {if ($truthy(node.$id())) { + return "" + " id=\"" + (node.$id()) + "\"" + } else { + return "" + }; return nil; })(); + title_element = (function() {if ($truthy(node['$title?']())) { + return "" + "
    " + (node.$title()) + "
    \n" + } else { + return "" + }; return nil; })(); + nowrap = ($truthy($a = node.$document()['$attr?']("prewrap")['$!']()) ? $a : node['$option?']("nowrap")); + return "" + "\n" + (title_element) + "
    \n" + "" + (node.$content()) + "\n" + "
    \n" + ""; + }, TMP_Html5Converter_literal_26.$$arity = 1); + + Opal.def(self, '$stem', TMP_Html5Converter_stem_27 = function $$stem(node) { + var $a, $b, TMP_28, self = this, id_attribute = nil, title_element = nil, style = nil, open = nil, close = nil, equation = nil, br = nil, role = nil; + + + id_attribute = (function() {if ($truthy(node.$id())) { + return "" + " id=\"" + (node.$id()) + "\"" + } else { + return "" + }; return nil; })(); + title_element = (function() {if ($truthy(node['$title?']())) { + return "" + "
    " + (node.$title()) + "
    \n" + } else { + return "" + }; return nil; })(); + $b = $$($nesting, 'BLOCK_MATH_DELIMITERS')['$[]']((style = node.$style().$to_sym())), $a = Opal.to_ary($b), (open = ($a[0] == null ? nil : $a[0])), (close = ($a[1] == null ? nil : $a[1])), $b; + equation = node.$content(); + if ($truthy((($a = style['$==']("asciimath")) ? equation['$include?']($$($nesting, 'LF')) : style['$==']("asciimath")))) { + + br = "" + "" + ($$($nesting, 'LF')); + equation = $send(equation, 'gsub', [$$($nesting, 'StemBreakRx')], (TMP_28 = function(){var self = TMP_28.$$s || this, $c; + + return "" + (close) + ($rb_times(br, (($c = $gvars['~']) === nil ? nil : $c['$[]'](0)).$count($$($nesting, 'LF')))) + (open)}, TMP_28.$$s = self, TMP_28.$$arity = 0, TMP_28));}; + if ($truthy(($truthy($a = equation['$start_with?'](open)) ? equation['$end_with?'](close) : $a))) { + } else { + equation = "" + (open) + (equation) + (close) + }; + return "" + "\n" + (title_element) + "
    \n" + (equation) + "\n" + "
    \n" + ""; + }, TMP_Html5Converter_stem_27.$$arity = 1); + + Opal.def(self, '$olist', TMP_Html5Converter_olist_29 = function $$olist(node) { + var TMP_30, self = this, result = nil, id_attribute = nil, classes = nil, class_attribute = nil, type_attribute = nil, keyword = nil, start_attribute = nil, reversed_attribute = nil; + + + result = []; + id_attribute = (function() {if ($truthy(node.$id())) { + return "" + " id=\"" + (node.$id()) + "\"" + } else { + return "" + }; return nil; })(); + classes = ["olist", node.$style(), node.$role()].$compact(); + class_attribute = "" + " class=\"" + (classes.$join(" ")) + "\""; + result['$<<']("" + ""); + if ($truthy(node['$title?']())) { + result['$<<']("" + "
    " + (node.$title()) + "
    ")}; + type_attribute = (function() {if ($truthy((keyword = node.$list_marker_keyword()))) { + return "" + " type=\"" + (keyword) + "\"" + } else { + return "" + }; return nil; })(); + start_attribute = (function() {if ($truthy(node['$attr?']("start"))) { + return "" + " start=\"" + (node.$attr("start")) + "\"" + } else { + return "" + }; return nil; })(); + reversed_attribute = (function() {if ($truthy(node['$option?']("reversed"))) { + + return self.$append_boolean_attribute("reversed", self.xml_mode); + } else { + return "" + }; return nil; })(); + result['$<<']("" + "
      "); + $send(node.$items(), 'each', [], (TMP_30 = function(item){var self = TMP_30.$$s || this; + + + + if (item == null) { + item = nil; + }; + result['$<<']("
    1. "); + result['$<<']("" + "

      " + (item.$text()) + "

      "); + if ($truthy(item['$blocks?']())) { + result['$<<'](item.$content())}; + return result['$<<']("
    2. ");}, TMP_30.$$s = self, TMP_30.$$arity = 1, TMP_30)); + result['$<<']("
    "); + result['$<<'](""); + return result.$join($$($nesting, 'LF')); + }, TMP_Html5Converter_olist_29.$$arity = 1); + + Opal.def(self, '$open', TMP_Html5Converter_open_31 = function $$open(node) { + var $a, $b, $c, self = this, style = nil, id_attr = nil, title_el = nil, role = nil; + + if ((style = node.$style())['$==']("abstract")) { + if ($truthy((($a = node.$parent()['$=='](node.$document())) ? node.$document().$doctype()['$==']("book") : node.$parent()['$=='](node.$document())))) { + + self.$logger().$warn("abstract block cannot be used in a document without a title when doctype is book. Excluding block content."); + return ""; + } else { + + id_attr = (function() {if ($truthy(node.$id())) { + return "" + " id=\"" + (node.$id()) + "\"" + } else { + return "" + }; return nil; })(); + title_el = (function() {if ($truthy(node['$title?']())) { + return "" + "
    " + (node.$title()) + "
    \n" + } else { + return "" + }; return nil; })(); + return "" + "\n" + (title_el) + "
    \n" + (node.$content()) + "\n" + "
    \n" + ""; + } + } else if ($truthy((($a = style['$==']("partintro")) ? ($truthy($b = ($truthy($c = $rb_gt(node.$level(), 0)) ? $c : node.$parent().$context()['$!=']("section"))) ? $b : node.$document().$doctype()['$!=']("book")) : style['$==']("partintro")))) { + + self.$logger().$error("partintro block can only be used when doctype is book and must be a child of a book part. Excluding block content."); + return ""; + } else { + + id_attr = (function() {if ($truthy(node.$id())) { + return "" + " id=\"" + (node.$id()) + "\"" + } else { + return "" + }; return nil; })(); + title_el = (function() {if ($truthy(node['$title?']())) { + return "" + "
    " + (node.$title()) + "
    \n" + } else { + return "" + }; return nil; })(); + return "" + "" + }, TMP_Html5Converter_page_break_32.$$arity = 1); + + Opal.def(self, '$paragraph', TMP_Html5Converter_paragraph_33 = function $$paragraph(node) { + var self = this, class_attribute = nil, attributes = nil; + + + class_attribute = (function() {if ($truthy(node.$role())) { + return "" + "class=\"paragraph " + (node.$role()) + "\"" + } else { + return "class=\"paragraph\"" + }; return nil; })(); + attributes = (function() {if ($truthy(node.$id())) { + return "" + "id=\"" + (node.$id()) + "\" " + (class_attribute) + } else { + return class_attribute + }; return nil; })(); + if ($truthy(node['$title?']())) { + return "" + "
    \n" + "
    " + (node.$title()) + "
    \n" + "

    " + (node.$content()) + "

    \n" + "
    " + } else { + return "" + "
    \n" + "

    " + (node.$content()) + "

    \n" + "
    " + }; + }, TMP_Html5Converter_paragraph_33.$$arity = 1); + + Opal.def(self, '$preamble', TMP_Html5Converter_preamble_34 = function $$preamble(node) { + var $a, $b, self = this, doc = nil, toc = nil; + + + if ($truthy(($truthy($a = ($truthy($b = (doc = node.$document())['$attr?']("toc-placement", "preamble")) ? doc['$sections?']() : $b)) ? doc['$attr?']("toc") : $a))) { + toc = "" + "\n" + "
    \n" + "
    " + (doc.$attr("toc-title")) + "
    \n" + (self.$outline(doc)) + "\n" + "
    " + } else { + toc = "" + }; + return "" + "
    \n" + "
    \n" + (node.$content()) + "\n" + "
    " + (toc) + "\n" + "
    "; + }, TMP_Html5Converter_preamble_34.$$arity = 1); + + Opal.def(self, '$quote', TMP_Html5Converter_quote_35 = function $$quote(node) { + var $a, self = this, id_attribute = nil, classes = nil, class_attribute = nil, title_element = nil, attribution = nil, citetitle = nil, cite_element = nil, attribution_text = nil, attribution_element = nil; + + + id_attribute = (function() {if ($truthy(node.$id())) { + return "" + " id=\"" + (node.$id()) + "\"" + } else { + return "" + }; return nil; })(); + classes = ["quoteblock", node.$role()].$compact(); + class_attribute = "" + " class=\"" + (classes.$join(" ")) + "\""; + title_element = (function() {if ($truthy(node['$title?']())) { + return "" + "\n
    " + (node.$title()) + "
    " + } else { + return "" + }; return nil; })(); + attribution = (function() {if ($truthy(node['$attr?']("attribution"))) { + + return node.$attr("attribution"); + } else { + return nil + }; return nil; })(); + citetitle = (function() {if ($truthy(node['$attr?']("citetitle"))) { + + return node.$attr("citetitle"); + } else { + return nil + }; return nil; })(); + if ($truthy(($truthy($a = attribution) ? $a : citetitle))) { + + cite_element = (function() {if ($truthy(citetitle)) { + return "" + "" + (citetitle) + "" + } else { + return "" + }; return nil; })(); + attribution_text = (function() {if ($truthy(attribution)) { + return "" + "— " + (attribution) + ((function() {if ($truthy(citetitle)) { + return "" + "\n" + } else { + return "" + }; return nil; })()) + } else { + return "" + }; return nil; })(); + attribution_element = "" + "\n
    \n" + (attribution_text) + (cite_element) + "\n
    "; + } else { + attribution_element = "" + }; + return "" + "" + (title_element) + "\n" + "
    \n" + (node.$content()) + "\n" + "
    " + (attribution_element) + "\n" + ""; + }, TMP_Html5Converter_quote_35.$$arity = 1); + + Opal.def(self, '$thematic_break', TMP_Html5Converter_thematic_break_36 = function $$thematic_break(node) { + var self = this; + + return "" + "" + }, TMP_Html5Converter_thematic_break_36.$$arity = 1); + + Opal.def(self, '$sidebar', TMP_Html5Converter_sidebar_37 = function $$sidebar(node) { + var self = this, id_attribute = nil, title_element = nil, role = nil; + + + id_attribute = (function() {if ($truthy(node.$id())) { + return "" + " id=\"" + (node.$id()) + "\"" + } else { + return "" + }; return nil; })(); + title_element = (function() {if ($truthy(node['$title?']())) { + return "" + "
    " + (node.$title()) + "
    \n" + } else { + return "" + }; return nil; })(); + return "" + "\n" + "
    \n" + (title_element) + (node.$content()) + "\n" + "
    \n" + ""; + }, TMP_Html5Converter_sidebar_37.$$arity = 1); + + Opal.def(self, '$table', TMP_Html5Converter_table_38 = function $$table(node) { + var $a, TMP_39, TMP_40, self = this, result = nil, id_attribute = nil, classes = nil, stripes = nil, styles = nil, autowidth = nil, tablewidth = nil, role = nil, class_attribute = nil, style_attribute = nil, slash = nil; + + + result = []; + id_attribute = (function() {if ($truthy(node.$id())) { + return "" + " id=\"" + (node.$id()) + "\"" + } else { + return "" + }; return nil; })(); + classes = ["tableblock", "" + "frame-" + (node.$attr("frame", "all")), "" + "grid-" + (node.$attr("grid", "all"))]; + if ($truthy((stripes = node.$attr("stripes")))) { + classes['$<<']("" + "stripes-" + (stripes))}; + styles = []; + if ($truthy(($truthy($a = (autowidth = node.$attributes()['$[]']("autowidth-option"))) ? node['$attr?']("width", nil, false)['$!']() : $a))) { + classes['$<<']("fit-content") + } else if ((tablewidth = node.$attr("tablepcwidth"))['$=='](100)) { + classes['$<<']("stretch") + } else { + styles['$<<']("" + "width: " + (tablewidth) + "%;") + }; + if ($truthy(node['$attr?']("float"))) { + classes['$<<'](node.$attr("float"))}; + if ($truthy((role = node.$role()))) { + classes['$<<'](role)}; + class_attribute = "" + " class=\"" + (classes.$join(" ")) + "\""; + style_attribute = (function() {if ($truthy(styles['$empty?']())) { + return "" + } else { + return "" + " style=\"" + (styles.$join(" ")) + "\"" + }; return nil; })(); + result['$<<']("" + ""); + if ($truthy(node['$title?']())) { + result['$<<']("" + "" + (node.$captioned_title()) + "")}; + if ($truthy($rb_gt(node.$attr("rowcount"), 0))) { + + slash = self.void_element_slash; + result['$<<'](""); + if ($truthy(autowidth)) { + result = $rb_plus(result, $$($nesting, 'Array').$new(node.$columns().$size(), "" + "")) + } else { + $send(node.$columns(), 'each', [], (TMP_39 = function(col){var self = TMP_39.$$s || this; + + + + if (col == null) { + col = nil; + }; + return result['$<<']((function() {if ($truthy(col.$attributes()['$[]']("autowidth-option"))) { + return "" + "" + } else { + return "" + "" + }; return nil; })());}, TMP_39.$$s = self, TMP_39.$$arity = 1, TMP_39)) + }; + result['$<<'](""); + $send(node.$rows().$by_section(), 'each', [], (TMP_40 = function(tsec, rows){var self = TMP_40.$$s || this, TMP_41; + + + + if (tsec == null) { + tsec = nil; + }; + + if (rows == null) { + rows = nil; + }; + if ($truthy(rows['$empty?']())) { + return nil;}; + result['$<<']("" + ""); + $send(rows, 'each', [], (TMP_41 = function(row){var self = TMP_41.$$s || this, TMP_42; + + + + if (row == null) { + row = nil; + }; + result['$<<'](""); + $send(row, 'each', [], (TMP_42 = function(cell){var self = TMP_42.$$s || this, $b, cell_content = nil, $case = nil, cell_tag_name = nil, cell_class_attribute = nil, cell_colspan_attribute = nil, cell_rowspan_attribute = nil, cell_style_attribute = nil; + + + + if (cell == null) { + cell = nil; + }; + if (tsec['$==']("head")) { + cell_content = cell.$text() + } else { + $case = cell.$style(); + if ("asciidoc"['$===']($case)) {cell_content = "" + "
    " + (cell.$content()) + "
    "} + else if ("verse"['$===']($case)) {cell_content = "" + "
    " + (cell.$text()) + "
    "} + else if ("literal"['$===']($case)) {cell_content = "" + "
    " + (cell.$text()) + "
    "} + else {cell_content = (function() {if ($truthy((cell_content = cell.$content())['$empty?']())) { + return "" + } else { + return "" + "

    " + (cell_content.$join("" + "

    \n" + "

    ")) + "

    " + }; return nil; })()} + }; + cell_tag_name = (function() {if ($truthy(($truthy($b = tsec['$==']("head")) ? $b : cell.$style()['$==']("header")))) { + return "th" + } else { + return "td" + }; return nil; })(); + cell_class_attribute = "" + " class=\"tableblock halign-" + (cell.$attr("halign")) + " valign-" + (cell.$attr("valign")) + "\""; + cell_colspan_attribute = (function() {if ($truthy(cell.$colspan())) { + return "" + " colspan=\"" + (cell.$colspan()) + "\"" + } else { + return "" + }; return nil; })(); + cell_rowspan_attribute = (function() {if ($truthy(cell.$rowspan())) { + return "" + " rowspan=\"" + (cell.$rowspan()) + "\"" + } else { + return "" + }; return nil; })(); + cell_style_attribute = (function() {if ($truthy(node.$document()['$attr?']("cellbgcolor"))) { + return "" + " style=\"background-color: " + (node.$document().$attr("cellbgcolor")) + ";\"" + } else { + return "" + }; return nil; })(); + return result['$<<']("" + "<" + (cell_tag_name) + (cell_class_attribute) + (cell_colspan_attribute) + (cell_rowspan_attribute) + (cell_style_attribute) + ">" + (cell_content) + "");}, TMP_42.$$s = self, TMP_42.$$arity = 1, TMP_42)); + return result['$<<']("");}, TMP_41.$$s = self, TMP_41.$$arity = 1, TMP_41)); + return result['$<<']("" + "
    ");}, TMP_40.$$s = self, TMP_40.$$arity = 2, TMP_40));}; + result['$<<'](""); + return result.$join($$($nesting, 'LF')); + }, TMP_Html5Converter_table_38.$$arity = 1); + + Opal.def(self, '$toc', TMP_Html5Converter_toc_43 = function $$toc(node) { + var $a, $b, self = this, doc = nil, id_attr = nil, title_id_attr = nil, title = nil, levels = nil, role = nil; + + + if ($truthy(($truthy($a = ($truthy($b = (doc = node.$document())['$attr?']("toc-placement", "macro")) ? doc['$sections?']() : $b)) ? doc['$attr?']("toc") : $a))) { + } else { + return "" + }; + if ($truthy(node.$id())) { + + id_attr = "" + " id=\"" + (node.$id()) + "\""; + title_id_attr = "" + " id=\"" + (node.$id()) + "title\""; + } else { + + id_attr = " id=\"toc\""; + title_id_attr = " id=\"toctitle\""; + }; + title = (function() {if ($truthy(node['$title?']())) { + return node.$title() + } else { + + return doc.$attr("toc-title"); + }; return nil; })(); + levels = (function() {if ($truthy(node['$attr?']("levels"))) { + return node.$attr("levels").$to_i() + } else { + return nil + }; return nil; })(); + role = (function() {if ($truthy(node['$role?']())) { + return node.$role() + } else { + + return doc.$attr("toc-class", "toc"); + }; return nil; })(); + return "" + "\n" + "" + (title) + "\n" + (self.$outline(doc, $hash2(["toclevels"], {"toclevels": levels}))) + "\n" + ""; + }, TMP_Html5Converter_toc_43.$$arity = 1); + + Opal.def(self, '$ulist', TMP_Html5Converter_ulist_44 = function $$ulist(node) { + var TMP_45, self = this, result = nil, id_attribute = nil, div_classes = nil, marker_checked = nil, marker_unchecked = nil, checklist = nil, ul_class_attribute = nil; + + + result = []; + id_attribute = (function() {if ($truthy(node.$id())) { + return "" + " id=\"" + (node.$id()) + "\"" + } else { + return "" + }; return nil; })(); + div_classes = ["ulist", node.$style(), node.$role()].$compact(); + marker_checked = (marker_unchecked = ""); + if ($truthy((checklist = node['$option?']("checklist")))) { + + div_classes.$unshift(div_classes.$shift(), "checklist"); + ul_class_attribute = " class=\"checklist\""; + if ($truthy(node['$option?']("interactive"))) { + if ($truthy(self.xml_mode)) { + + marker_checked = " "; + marker_unchecked = " "; + } else { + + marker_checked = " "; + marker_unchecked = " "; + } + } else if ($truthy(node.$document()['$attr?']("icons", "font"))) { + + marker_checked = " "; + marker_unchecked = " "; + } else { + + marker_checked = "✓ "; + marker_unchecked = "❏ "; + }; + } else { + ul_class_attribute = (function() {if ($truthy(node.$style())) { + return "" + " class=\"" + (node.$style()) + "\"" + } else { + return "" + }; return nil; })() + }; + result['$<<']("" + ""); + if ($truthy(node['$title?']())) { + result['$<<']("" + "
    " + (node.$title()) + "
    ")}; + result['$<<']("" + ""); + $send(node.$items(), 'each', [], (TMP_45 = function(item){var self = TMP_45.$$s || this, $a; + + + + if (item == null) { + item = nil; + }; + result['$<<']("
  • "); + if ($truthy(($truthy($a = checklist) ? item['$attr?']("checkbox") : $a))) { + result['$<<']("" + "

    " + ((function() {if ($truthy(item['$attr?']("checked"))) { + return marker_checked + } else { + return marker_unchecked + }; return nil; })()) + (item.$text()) + "

    ") + } else { + result['$<<']("" + "

    " + (item.$text()) + "

    ") + }; + if ($truthy(item['$blocks?']())) { + result['$<<'](item.$content())}; + return result['$<<']("
  • ");}, TMP_45.$$s = self, TMP_45.$$arity = 1, TMP_45)); + result['$<<'](""); + result['$<<'](""); + return result.$join($$($nesting, 'LF')); + }, TMP_Html5Converter_ulist_44.$$arity = 1); + + Opal.def(self, '$verse', TMP_Html5Converter_verse_46 = function $$verse(node) { + var $a, self = this, id_attribute = nil, classes = nil, class_attribute = nil, title_element = nil, attribution = nil, citetitle = nil, cite_element = nil, attribution_text = nil, attribution_element = nil; + + + id_attribute = (function() {if ($truthy(node.$id())) { + return "" + " id=\"" + (node.$id()) + "\"" + } else { + return "" + }; return nil; })(); + classes = ["verseblock", node.$role()].$compact(); + class_attribute = "" + " class=\"" + (classes.$join(" ")) + "\""; + title_element = (function() {if ($truthy(node['$title?']())) { + return "" + "\n
    " + (node.$title()) + "
    " + } else { + return "" + }; return nil; })(); + attribution = (function() {if ($truthy(node['$attr?']("attribution"))) { + + return node.$attr("attribution"); + } else { + return nil + }; return nil; })(); + citetitle = (function() {if ($truthy(node['$attr?']("citetitle"))) { + + return node.$attr("citetitle"); + } else { + return nil + }; return nil; })(); + if ($truthy(($truthy($a = attribution) ? $a : citetitle))) { + + cite_element = (function() {if ($truthy(citetitle)) { + return "" + "" + (citetitle) + "" + } else { + return "" + }; return nil; })(); + attribution_text = (function() {if ($truthy(attribution)) { + return "" + "— " + (attribution) + ((function() {if ($truthy(citetitle)) { + return "" + "\n" + } else { + return "" + }; return nil; })()) + } else { + return "" + }; return nil; })(); + attribution_element = "" + "\n
    \n" + (attribution_text) + (cite_element) + "\n
    "; + } else { + attribution_element = "" + }; + return "" + "" + (title_element) + "\n" + "
    " + (node.$content()) + "
    " + (attribution_element) + "\n" + ""; + }, TMP_Html5Converter_verse_46.$$arity = 1); + + Opal.def(self, '$video', TMP_Html5Converter_video_47 = function $$video(node) { + var $a, $b, self = this, xml = nil, id_attribute = nil, classes = nil, class_attribute = nil, title_element = nil, width_attribute = nil, height_attribute = nil, $case = nil, asset_uri_scheme = nil, start_anchor = nil, delimiter = nil, autoplay_param = nil, loop_param = nil, rel_param_val = nil, start_param = nil, end_param = nil, has_loop_param = nil, controls_param = nil, fs_param = nil, fs_attribute = nil, modest_param = nil, theme_param = nil, hl_param = nil, target = nil, list = nil, list_param = nil, playlist = nil, poster_attribute = nil, val = nil, preload_attribute = nil, start_t = nil, end_t = nil, time_anchor = nil; + + + xml = self.xml_mode; + id_attribute = (function() {if ($truthy(node.$id())) { + return "" + " id=\"" + (node.$id()) + "\"" + } else { + return "" + }; return nil; })(); + classes = ["videoblock"]; + if ($truthy(node['$attr?']("float"))) { + classes['$<<'](node.$attr("float"))}; + if ($truthy(node['$attr?']("align"))) { + classes['$<<']("" + "text-" + (node.$attr("align")))}; + if ($truthy(node.$role())) { + classes['$<<'](node.$role())}; + class_attribute = "" + " class=\"" + (classes.$join(" ")) + "\""; + title_element = (function() {if ($truthy(node['$title?']())) { + return "" + "\n
    " + (node.$title()) + "
    " + } else { + return "" + }; return nil; })(); + width_attribute = (function() {if ($truthy(node['$attr?']("width"))) { + return "" + " width=\"" + (node.$attr("width")) + "\"" + } else { + return "" + }; return nil; })(); + height_attribute = (function() {if ($truthy(node['$attr?']("height"))) { + return "" + " height=\"" + (node.$attr("height")) + "\"" + } else { + return "" + }; return nil; })(); + return (function() {$case = node.$attr("poster"); + if ("vimeo"['$===']($case)) { + if ($truthy((asset_uri_scheme = node.$document().$attr("asset-uri-scheme", "https"))['$empty?']())) { + } else { + asset_uri_scheme = "" + (asset_uri_scheme) + ":" + }; + start_anchor = (function() {if ($truthy(node['$attr?']("start", nil, false))) { + return "" + "#at=" + (node.$attr("start")) + } else { + return "" + }; return nil; })(); + delimiter = "?"; + if ($truthy(node['$option?']("autoplay"))) { + + autoplay_param = "" + (delimiter) + "autoplay=1"; + delimiter = "&"; + } else { + autoplay_param = "" + }; + loop_param = (function() {if ($truthy(node['$option?']("loop"))) { + return "" + (delimiter) + "loop=1" + } else { + return "" + }; return nil; })(); + return "" + "" + (title_element) + "\n" + "
    \n" + "\n" + "
    \n" + "";} + else if ("youtube"['$===']($case)) { + if ($truthy((asset_uri_scheme = node.$document().$attr("asset-uri-scheme", "https"))['$empty?']())) { + } else { + asset_uri_scheme = "" + (asset_uri_scheme) + ":" + }; + rel_param_val = (function() {if ($truthy(node['$option?']("related"))) { + return 1 + } else { + return 0 + }; return nil; })(); + start_param = (function() {if ($truthy(node['$attr?']("start", nil, false))) { + return "" + "&start=" + (node.$attr("start")) + } else { + return "" + }; return nil; })(); + end_param = (function() {if ($truthy(node['$attr?']("end", nil, false))) { + return "" + "&end=" + (node.$attr("end")) + } else { + return "" + }; return nil; })(); + autoplay_param = (function() {if ($truthy(node['$option?']("autoplay"))) { + return "&autoplay=1" + } else { + return "" + }; return nil; })(); + loop_param = (function() {if ($truthy((has_loop_param = node['$option?']("loop")))) { + return "&loop=1" + } else { + return "" + }; return nil; })(); + controls_param = (function() {if ($truthy(node['$option?']("nocontrols"))) { + return "&controls=0" + } else { + return "" + }; return nil; })(); + if ($truthy(node['$option?']("nofullscreen"))) { + + fs_param = "&fs=0"; + fs_attribute = ""; + } else { + + fs_param = ""; + fs_attribute = self.$append_boolean_attribute("allowfullscreen", xml); + }; + modest_param = (function() {if ($truthy(node['$option?']("modest"))) { + return "&modestbranding=1" + } else { + return "" + }; return nil; })(); + theme_param = (function() {if ($truthy(node['$attr?']("theme", nil, false))) { + return "" + "&theme=" + (node.$attr("theme")) + } else { + return "" + }; return nil; })(); + hl_param = (function() {if ($truthy(node['$attr?']("lang"))) { + return "" + "&hl=" + (node.$attr("lang")) + } else { + return "" + }; return nil; })(); + $b = node.$attr("target").$split("/", 2), $a = Opal.to_ary($b), (target = ($a[0] == null ? nil : $a[0])), (list = ($a[1] == null ? nil : $a[1])), $b; + if ($truthy((list = ($truthy($a = list) ? $a : node.$attr("list", nil, false))))) { + list_param = "" + "&list=" + (list) + } else { + + $b = target.$split(",", 2), $a = Opal.to_ary($b), (target = ($a[0] == null ? nil : $a[0])), (playlist = ($a[1] == null ? nil : $a[1])), $b; + if ($truthy((playlist = ($truthy($a = playlist) ? $a : node.$attr("playlist", nil, false))))) { + list_param = "" + "&playlist=" + (playlist) + } else { + list_param = (function() {if ($truthy(has_loop_param)) { + return "" + "&playlist=" + (target) + } else { + return "" + }; return nil; })() + }; + }; + return "" + "" + (title_element) + "\n" + "
    \n" + "\n" + "
    \n" + "";} + else { + poster_attribute = (function() {if ($truthy((val = node.$attr("poster", nil, false))['$nil_or_empty?']())) { + return "" + } else { + return "" + " poster=\"" + (node.$media_uri(val)) + "\"" + }; return nil; })(); + preload_attribute = (function() {if ($truthy((val = node.$attr("preload", nil, false))['$nil_or_empty?']())) { + return "" + } else { + return "" + " preload=\"" + (val) + "\"" + }; return nil; })(); + start_t = node.$attr("start", nil, false); + end_t = node.$attr("end", nil, false); + time_anchor = (function() {if ($truthy(($truthy($a = start_t) ? $a : end_t))) { + return "" + "#t=" + (($truthy($a = start_t) ? $a : "")) + ((function() {if ($truthy(end_t)) { + return "" + "," + (end_t) + } else { + return "" + }; return nil; })()) + } else { + return "" + }; return nil; })(); + return "" + "" + (title_element) + "\n" + "
    \n" + "\n" + "
    \n" + "";}})(); + }, TMP_Html5Converter_video_47.$$arity = 1); + + Opal.def(self, '$inline_anchor', TMP_Html5Converter_inline_anchor_48 = function $$inline_anchor(node) { + var $a, self = this, $case = nil, path = nil, attrs = nil, text = nil, refid = nil, ref = nil; + + return (function() {$case = node.$type(); + if ("xref"['$===']($case)) { + if ($truthy((path = node.$attributes()['$[]']("path")))) { + + attrs = self.$append_link_constraint_attrs(node, (function() {if ($truthy(node.$role())) { + return ["" + " class=\"" + (node.$role()) + "\""] + } else { + return [] + }; return nil; })()).$join(); + text = ($truthy($a = node.$text()) ? $a : path); + } else { + + attrs = (function() {if ($truthy(node.$role())) { + return "" + " class=\"" + (node.$role()) + "\"" + } else { + return "" + }; return nil; })(); + if ($truthy((text = node.$text()))) { + } else { + + refid = node.$attributes()['$[]']("refid"); + if ($truthy($$($nesting, 'AbstractNode')['$===']((ref = (self.refs = ($truthy($a = self.refs) ? $a : node.$document().$catalog()['$[]']("refs")))['$[]'](refid))))) { + text = ($truthy($a = ref.$xreftext(node.$attr("xrefstyle"))) ? $a : "" + "[" + (refid) + "]") + } else { + text = "" + "[" + (refid) + "]" + }; + }; + }; + return "" + "" + (text) + "";} + else if ("ref"['$===']($case)) {return "" + ""} + else if ("link"['$===']($case)) { + attrs = (function() {if ($truthy(node.$id())) { + return ["" + " id=\"" + (node.$id()) + "\""] + } else { + return [] + }; return nil; })(); + if ($truthy(node.$role())) { + attrs['$<<']("" + " class=\"" + (node.$role()) + "\"")}; + if ($truthy(node['$attr?']("title", nil, false))) { + attrs['$<<']("" + " title=\"" + (node.$attr("title")) + "\"")}; + return "" + "" + (node.$text()) + "";} + else if ("bibref"['$===']($case)) {return "" + "" + (node.$text())} + else { + self.$logger().$warn("" + "unknown anchor type: " + (node.$type().$inspect())); + return nil;}})() + }, TMP_Html5Converter_inline_anchor_48.$$arity = 1); + + Opal.def(self, '$inline_break', TMP_Html5Converter_inline_break_49 = function $$inline_break(node) { + var self = this; + + return "" + (node.$text()) + "" + }, TMP_Html5Converter_inline_break_49.$$arity = 1); + + Opal.def(self, '$inline_button', TMP_Html5Converter_inline_button_50 = function $$inline_button(node) { + var self = this; + + return "" + "" + (node.$text()) + "" + }, TMP_Html5Converter_inline_button_50.$$arity = 1); + + Opal.def(self, '$inline_callout', TMP_Html5Converter_inline_callout_51 = function $$inline_callout(node) { + var self = this, src = nil; + + if ($truthy(node.$document()['$attr?']("icons", "font"))) { + return "" + "(" + (node.$text()) + ")" + } else if ($truthy(node.$document()['$attr?']("icons"))) { + + src = node.$icon_uri("" + "callouts/" + (node.$text())); + return "" + "\"""; + } else { + return "" + (node.$attributes()['$[]']("guard")) + "(" + (node.$text()) + ")" + } + }, TMP_Html5Converter_inline_callout_51.$$arity = 1); + + Opal.def(self, '$inline_footnote', TMP_Html5Converter_inline_footnote_52 = function $$inline_footnote(node) { + var self = this, index = nil, id_attr = nil; + + if ($truthy((index = node.$attr("index", nil, false)))) { + if (node.$type()['$==']("xref")) { + return "" + "[" + (index) + "]" + } else { + + id_attr = (function() {if ($truthy(node.$id())) { + return "" + " id=\"_footnote_" + (node.$id()) + "\"" + } else { + return "" + }; return nil; })(); + return "" + "[" + (index) + "]"; + } + } else if (node.$type()['$==']("xref")) { + return "" + "[" + (node.$text()) + "]" + } else { + return nil + } + }, TMP_Html5Converter_inline_footnote_52.$$arity = 1); + + Opal.def(self, '$inline_image', TMP_Html5Converter_inline_image_53 = function $$inline_image(node) { + var $a, TMP_54, TMP_55, $b, $c, $d, self = this, type = nil, class_attr_val = nil, title_attr = nil, img = nil, target = nil, attrs = nil, svg = nil, obj = nil, fallback = nil, role = nil; + + + if ($truthy((($a = (type = node.$type())['$==']("icon")) ? node.$document()['$attr?']("icons", "font") : (type = node.$type())['$==']("icon")))) { + + class_attr_val = "" + "fa fa-" + (node.$target()); + $send($hash2(["size", "rotate", "flip"], {"size": "fa-", "rotate": "fa-rotate-", "flip": "fa-flip-"}), 'each', [], (TMP_54 = function(key, prefix){var self = TMP_54.$$s || this; + + + + if (key == null) { + key = nil; + }; + + if (prefix == null) { + prefix = nil; + }; + if ($truthy(node['$attr?'](key))) { + return (class_attr_val = "" + (class_attr_val) + " " + (prefix) + (node.$attr(key))) + } else { + return nil + };}, TMP_54.$$s = self, TMP_54.$$arity = 2, TMP_54)); + title_attr = (function() {if ($truthy(node['$attr?']("title"))) { + return "" + " title=\"" + (node.$attr("title")) + "\"" + } else { + return "" + }; return nil; })(); + img = "" + ""; + } else if ($truthy((($a = type['$==']("icon")) ? node.$document()['$attr?']("icons")['$!']() : type['$==']("icon")))) { + img = "" + "[" + (node.$alt()) + "]" + } else { + + target = node.$target(); + attrs = $send(["width", "height", "title"], 'map', [], (TMP_55 = function(name){var self = TMP_55.$$s || this; + + + + if (name == null) { + name = nil; + }; + if ($truthy(node['$attr?'](name))) { + return "" + " " + (name) + "=\"" + (node.$attr(name)) + "\"" + } else { + return "" + };}, TMP_55.$$s = self, TMP_55.$$arity = 1, TMP_55)).$join(); + if ($truthy(($truthy($a = ($truthy($b = ($truthy($c = type['$!=']("icon")) ? ($truthy($d = node['$attr?']("format", "svg", false)) ? $d : target['$include?'](".svg")) : $c)) ? $rb_lt(node.$document().$safe(), $$$($$($nesting, 'SafeMode'), 'SECURE')) : $b)) ? ($truthy($b = (svg = node['$option?']("inline"))) ? $b : (obj = node['$option?']("interactive"))) : $a))) { + if ($truthy(svg)) { + img = ($truthy($a = self.$read_svg_contents(node, target)) ? $a : "" + "" + (node.$alt()) + "") + } else if ($truthy(obj)) { + + fallback = (function() {if ($truthy(node['$attr?']("fallback"))) { + return "" + "\""" + } else { + return "" + "" + (node.$alt()) + "" + }; return nil; })(); + img = "" + "" + (fallback) + "";}}; + img = ($truthy($a = img) ? $a : "" + "\"""); + }; + if ($truthy(node['$attr?']("link", nil, false))) { + img = "" + "" + (img) + ""}; + if ($truthy((role = node.$role()))) { + if ($truthy(node['$attr?']("float"))) { + class_attr_val = "" + (type) + " " + (node.$attr("float")) + " " + (role) + } else { + class_attr_val = "" + (type) + " " + (role) + } + } else if ($truthy(node['$attr?']("float"))) { + class_attr_val = "" + (type) + " " + (node.$attr("float")) + } else { + class_attr_val = type + }; + return "" + "" + (img) + ""; + }, TMP_Html5Converter_inline_image_53.$$arity = 1); + + Opal.def(self, '$inline_indexterm', TMP_Html5Converter_inline_indexterm_56 = function $$inline_indexterm(node) { + var self = this; + + if (node.$type()['$==']("visible")) { + return node.$text() + } else { + return "" + } + }, TMP_Html5Converter_inline_indexterm_56.$$arity = 1); + + Opal.def(self, '$inline_kbd', TMP_Html5Converter_inline_kbd_57 = function $$inline_kbd(node) { + var self = this, keys = nil; + + if ((keys = node.$attr("keys")).$size()['$=='](1)) { + return "" + "" + (keys['$[]'](0)) + "" + } else { + return "" + "" + (keys.$join("+")) + "" + } + }, TMP_Html5Converter_inline_kbd_57.$$arity = 1); + + Opal.def(self, '$inline_menu', TMP_Html5Converter_inline_menu_58 = function $$inline_menu(node) { + var self = this, caret = nil, submenu_joiner = nil, menu = nil, submenus = nil, menuitem = nil; + + + caret = (function() {if ($truthy(node.$document()['$attr?']("icons", "font"))) { + return "  " + } else { + return "  " + }; return nil; })(); + submenu_joiner = "" + "
    " + (caret) + ""; + menu = node.$attr("menu"); + if ($truthy((submenus = node.$attr("submenus"))['$empty?']())) { + if ($truthy((menuitem = node.$attr("menuitem", nil, false)))) { + return "" + "" + (menu) + "" + (caret) + "" + (menuitem) + "" + } else { + return "" + "" + (menu) + "" + } + } else { + return "" + "" + (menu) + "" + (caret) + "" + (submenus.$join(submenu_joiner)) + "" + (caret) + "" + (node.$attr("menuitem")) + "" + }; + }, TMP_Html5Converter_inline_menu_58.$$arity = 1); + + Opal.def(self, '$inline_quoted', TMP_Html5Converter_inline_quoted_59 = function $$inline_quoted(node) { + var $a, $b, self = this, open = nil, close = nil, is_tag = nil, class_attr = nil, id_attr = nil; + + + $b = $$($nesting, 'QUOTE_TAGS')['$[]'](node.$type()), $a = Opal.to_ary($b), (open = ($a[0] == null ? nil : $a[0])), (close = ($a[1] == null ? nil : $a[1])), (is_tag = ($a[2] == null ? nil : $a[2])), $b; + if ($truthy(node.$role())) { + class_attr = "" + " class=\"" + (node.$role()) + "\""}; + if ($truthy(node.$id())) { + id_attr = "" + " id=\"" + (node.$id()) + "\""}; + if ($truthy(($truthy($a = class_attr) ? $a : id_attr))) { + if ($truthy(is_tag)) { + return "" + (open.$chop()) + (($truthy($a = id_attr) ? $a : "")) + (($truthy($a = class_attr) ? $a : "")) + ">" + (node.$text()) + (close) + } else { + return "" + "" + (open) + (node.$text()) + (close) + "" + } + } else { + return "" + (open) + (node.$text()) + (close) + }; + }, TMP_Html5Converter_inline_quoted_59.$$arity = 1); + + Opal.def(self, '$append_boolean_attribute', TMP_Html5Converter_append_boolean_attribute_60 = function $$append_boolean_attribute(name, xml) { + var self = this; + + if ($truthy(xml)) { + return "" + " " + (name) + "=\"" + (name) + "\"" + } else { + return "" + " " + (name) + } + }, TMP_Html5Converter_append_boolean_attribute_60.$$arity = 2); + + Opal.def(self, '$encode_quotes', TMP_Html5Converter_encode_quotes_61 = function $$encode_quotes(val) { + var self = this; + + if ($truthy(val['$include?']("\""))) { + + return val.$gsub("\"", """); + } else { + return val + } + }, TMP_Html5Converter_encode_quotes_61.$$arity = 1); + + Opal.def(self, '$generate_manname_section', TMP_Html5Converter_generate_manname_section_62 = function $$generate_manname_section(node) { + var $a, self = this, manname_title = nil, next_section = nil, next_section_title = nil, manname_id_attr = nil, manname_id = nil; + + + manname_title = node.$attr("manname-title", "Name"); + if ($truthy(($truthy($a = (next_section = node.$sections()['$[]'](0))) ? (next_section_title = next_section.$title())['$=='](next_section_title.$upcase()) : $a))) { + manname_title = manname_title.$upcase()}; + manname_id_attr = (function() {if ($truthy((manname_id = node.$attr("manname-id")))) { + return "" + " id=\"" + (manname_id) + "\"" + } else { + return "" + }; return nil; })(); + return "" + "" + (manname_title) + "\n" + "
    \n" + "

    " + (node.$attr("manname")) + " - " + (node.$attr("manpurpose")) + "

    \n" + "
    "; + }, TMP_Html5Converter_generate_manname_section_62.$$arity = 1); + + Opal.def(self, '$append_link_constraint_attrs', TMP_Html5Converter_append_link_constraint_attrs_63 = function $$append_link_constraint_attrs(node, attrs) { + var $a, self = this, rel = nil, window = nil; + + + + if (attrs == null) { + attrs = []; + }; + if ($truthy(node['$option?']("nofollow"))) { + rel = "nofollow"}; + if ($truthy((window = node.$attributes()['$[]']("window")))) { + + attrs['$<<']("" + " target=\"" + (window) + "\""); + if ($truthy(($truthy($a = window['$==']("_blank")) ? $a : node['$option?']("noopener")))) { + attrs['$<<']((function() {if ($truthy(rel)) { + return "" + " rel=\"" + (rel) + " noopener\"" + } else { + return " rel=\"noopener\"" + }; return nil; })())}; + } else if ($truthy(rel)) { + attrs['$<<']("" + " rel=\"" + (rel) + "\"")}; + return attrs; + }, TMP_Html5Converter_append_link_constraint_attrs_63.$$arity = -2); + return (Opal.def(self, '$read_svg_contents', TMP_Html5Converter_read_svg_contents_64 = function $$read_svg_contents(node, target) { + var TMP_65, self = this, svg = nil, old_start_tag = nil, new_start_tag = nil; + + + if ($truthy((svg = node.$read_contents(target, $hash2(["start", "normalize", "label"], {"start": node.$document().$attr("imagesdir"), "normalize": true, "label": "SVG"}))))) { + + if ($truthy(svg['$start_with?'](""); + } else { + return nil + };}, TMP_65.$$s = self, TMP_65.$$arity = 1, TMP_65)); + if ($truthy(new_start_tag)) { + svg = "" + (new_start_tag) + (svg['$[]'](Opal.Range.$new(old_start_tag.$length(), -1, false)))};}; + return svg; + }, TMP_Html5Converter_read_svg_contents_64.$$arity = 2), nil) && 'read_svg_contents'; + })($$($nesting, 'Converter'), $$$($$($nesting, 'Converter'), 'BuiltIn'), $nesting) + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/extensions"] = function(Opal) { + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + function $rb_plus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); + } + function $rb_gt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); + } + function $rb_lt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); + } + var $a, self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $truthy = Opal.truthy, $module = Opal.module, $klass = Opal.klass, $hash2 = Opal.hash2, $send = Opal.send, $hash = Opal.hash; + + Opal.add_stubs(['$require', '$to_s', '$[]=', '$config', '$-', '$nil_or_empty?', '$name', '$grep', '$constants', '$include', '$const_get', '$extend', '$attr_reader', '$merge', '$class', '$update', '$raise', '$document', '$==', '$doctype', '$[]', '$+', '$level', '$delete', '$>', '$casecmp', '$new', '$title=', '$sectname=', '$special=', '$fetch', '$numbered=', '$!', '$key?', '$attr?', '$special', '$numbered', '$generate_id', '$title', '$id=', '$update_attributes', '$tr', '$basename', '$create_block', '$assign_caption', '$===', '$next_block', '$dup', '$<<', '$has_more_lines?', '$each', '$define_method', '$unshift', '$shift', '$send', '$empty?', '$size', '$call', '$option', '$flatten', '$respond_to?', '$include?', '$split', '$to_i', '$compact', '$inspect', '$attr_accessor', '$to_set', '$match?', '$resolve_regexp', '$method', '$register', '$values', '$groups', '$arity', '$instance_exec', '$to_proc', '$activate', '$add_document_processor', '$any?', '$select', '$add_syntax_processor', '$to_sym', '$instance_variable_get', '$kind', '$private', '$join', '$map', '$capitalize', '$instance_variable_set', '$resolve_args', '$freeze', '$process_block_given?', '$source_location', '$resolve_class', '$<', '$update_config', '$push', '$as_symbol', '$name=', '$pop', '$-@', '$next_auto_id', '$generate_name', '$class_for_name', '$reduce', '$const_defined?']); + + if ($truthy((($a = $$($nesting, 'Asciidoctor', 'skip_raise')) ? 'constant' : nil))) { + } else { + self.$require("asciidoctor".$to_s()) + }; + return (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + (function($base, $parent_nesting) { + function $Extensions() {}; + var self = $Extensions = $module($base, 'Extensions', $Extensions); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + + (function($base, $super, $parent_nesting) { + function $Processor(){}; + var self = $Processor = $klass($base, $super, 'Processor', $Processor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Processor_initialize_4, TMP_Processor_update_config_5, TMP_Processor_process_6, TMP_Processor_create_section_7, TMP_Processor_create_block_8, TMP_Processor_create_list_9, TMP_Processor_create_list_item_10, TMP_Processor_create_image_block_11, TMP_Processor_create_inline_12, TMP_Processor_parse_content_13, TMP_Processor_14; + + def.config = nil; + + (function(self, $parent_nesting) { + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_config_1, TMP_option_2, TMP_use_dsl_3; + + + + Opal.def(self, '$config', TMP_config_1 = function $$config() { + var $a, self = this; + if (self.config == null) self.config = nil; + + return (self.config = ($truthy($a = self.config) ? $a : $hash2([], {}))) + }, TMP_config_1.$$arity = 0); + + Opal.def(self, '$option', TMP_option_2 = function $$option(key, default_value) { + var self = this, $writer = nil; + + + $writer = [key, default_value]; + $send(self.$config(), '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + }, TMP_option_2.$$arity = 2); + + Opal.def(self, '$use_dsl', TMP_use_dsl_3 = function $$use_dsl() { + var self = this; + + if ($truthy(self.$name()['$nil_or_empty?']())) { + if ($truthy((Opal.Module.$$nesting = $nesting, self.$constants()).$grep("DSL"))) { + return self.$include(self.$const_get("DSL")) + } else { + return nil + } + } else if ($truthy((Opal.Module.$$nesting = $nesting, self.$constants()).$grep("DSL"))) { + return self.$extend(self.$const_get("DSL")) + } else { + return nil + } + }, TMP_use_dsl_3.$$arity = 0); + Opal.alias(self, "extend_dsl", "use_dsl"); + return Opal.alias(self, "include_dsl", "use_dsl"); + })(Opal.get_singleton_class(self), $nesting); + self.$attr_reader("config"); + + Opal.def(self, '$initialize', TMP_Processor_initialize_4 = function $$initialize(config) { + var self = this; + + + + if (config == null) { + config = $hash2([], {}); + }; + return (self.config = self.$class().$config().$merge(config)); + }, TMP_Processor_initialize_4.$$arity = -1); + + Opal.def(self, '$update_config', TMP_Processor_update_config_5 = function $$update_config(config) { + var self = this; + + return self.config.$update(config) + }, TMP_Processor_update_config_5.$$arity = 1); + + Opal.def(self, '$process', TMP_Processor_process_6 = function $$process($a) { + var $post_args, args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + return self.$raise($$$('::', 'NotImplementedError'), "" + "Asciidoctor::Extensions::Processor subclass must implement #" + ("process") + " method"); + }, TMP_Processor_process_6.$$arity = -1); + + Opal.def(self, '$create_section', TMP_Processor_create_section_7 = function $$create_section(parent, title, attrs, opts) { + var $a, self = this, doc = nil, book = nil, doctype = nil, level = nil, style = nil, sectname = nil, special = nil, sect = nil, $writer = nil, id = nil; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + doc = parent.$document(); + book = (doctype = doc.$doctype())['$==']("book"); + level = ($truthy($a = opts['$[]']("level")) ? $a : $rb_plus(parent.$level(), 1)); + if ($truthy((style = attrs.$delete("style")))) { + if ($truthy(($truthy($a = book) ? style['$==']("abstract") : $a))) { + $a = ["chapter", 1], (sectname = $a[0]), (level = $a[1]), $a + } else { + + $a = [style, true], (sectname = $a[0]), (special = $a[1]), $a; + if (level['$=='](0)) { + level = 1}; + } + } else if ($truthy(book)) { + sectname = (function() {if (level['$=='](0)) { + return "part" + } else { + + if ($truthy($rb_gt(level, 1))) { + return "section" + } else { + return "chapter" + }; + }; return nil; })() + } else if ($truthy((($a = doctype['$==']("manpage")) ? title.$casecmp("synopsis")['$=='](0) : doctype['$==']("manpage")))) { + $a = ["synopsis", true], (sectname = $a[0]), (special = $a[1]), $a + } else { + sectname = "section" + }; + sect = $$($nesting, 'Section').$new(parent, level); + $a = [title, sectname], sect['$title=']($a[0]), sect['$sectname=']($a[1]), $a; + if ($truthy(special)) { + + + $writer = [true]; + $send(sect, 'special=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + if ($truthy(opts.$fetch("numbered", style['$==']("appendix")))) { + + $writer = [true]; + $send(sect, 'numbered=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + } else if ($truthy(($truthy($a = opts['$key?']("numbered")['$!']()) ? doc['$attr?']("sectnums", "all") : $a))) { + + $writer = [(function() {if ($truthy(($truthy($a = book) ? level['$=='](1) : $a))) { + return "chapter" + } else { + return true + }; return nil; })()]; + $send(sect, 'numbered=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + } else if ($truthy($rb_gt(level, 0))) { + if ($truthy(opts.$fetch("numbered", doc['$attr?']("sectnums")))) { + + $writer = [(function() {if ($truthy(sect.$special())) { + return ($truthy($a = parent.$numbered()) ? true : $a) + } else { + return true + }; return nil; })()]; + $send(sect, 'numbered=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];} + } else if ($truthy(opts.$fetch("numbered", ($truthy($a = book) ? doc['$attr?']("partnums") : $a)))) { + + $writer = [true]; + $send(sect, 'numbered=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if ((id = attrs.$delete("id"))['$=='](false)) { + } else { + + $writer = [(($writer = ["id", ($truthy($a = id) ? $a : (function() {if ($truthy(doc['$attr?']("sectids"))) { + + return $$($nesting, 'Section').$generate_id(sect.$title(), doc); + } else { + return nil + }; return nil; })())]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])]; + $send(sect, 'id=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + sect.$update_attributes(attrs); + return sect; + }, TMP_Processor_create_section_7.$$arity = -4); + + Opal.def(self, '$create_block', TMP_Processor_create_block_8 = function $$create_block(parent, context, source, attrs, opts) { + var self = this; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + return $$($nesting, 'Block').$new(parent, context, $hash2(["source", "attributes"], {"source": source, "attributes": attrs}).$merge(opts)); + }, TMP_Processor_create_block_8.$$arity = -5); + + Opal.def(self, '$create_list', TMP_Processor_create_list_9 = function $$create_list(parent, context, attrs) { + var self = this, list = nil; + + + + if (attrs == null) { + attrs = nil; + }; + list = $$($nesting, 'List').$new(parent, context); + if ($truthy(attrs)) { + list.$update_attributes(attrs)}; + return list; + }, TMP_Processor_create_list_9.$$arity = -3); + + Opal.def(self, '$create_list_item', TMP_Processor_create_list_item_10 = function $$create_list_item(parent, text) { + var self = this; + + + + if (text == null) { + text = nil; + }; + return $$($nesting, 'ListItem').$new(parent, text); + }, TMP_Processor_create_list_item_10.$$arity = -2); + + Opal.def(self, '$create_image_block', TMP_Processor_create_image_block_11 = function $$create_image_block(parent, attrs, opts) { + var $a, self = this, target = nil, $writer = nil, title = nil, block = nil; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + if ($truthy((target = attrs['$[]']("target")))) { + } else { + self.$raise($$$('::', 'ArgumentError'), "Unable to create an image block, target attribute is required") + }; + ($truthy($a = attrs['$[]']("alt")) ? $a : (($writer = ["alt", (($writer = ["default-alt", $$($nesting, 'Helpers').$basename(target, true).$tr("_-", " ")]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + title = (function() {if ($truthy(attrs['$key?']("title"))) { + + return attrs.$delete("title"); + } else { + return nil + }; return nil; })(); + block = self.$create_block(parent, "image", nil, attrs, opts); + if ($truthy(title)) { + + + $writer = [title]; + $send(block, 'title=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + block.$assign_caption(attrs.$delete("caption"), ($truthy($a = opts['$[]']("caption_context")) ? $a : "figure"));}; + return block; + }, TMP_Processor_create_image_block_11.$$arity = -3); + + Opal.def(self, '$create_inline', TMP_Processor_create_inline_12 = function $$create_inline(parent, context, text, opts) { + var self = this; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + return $$($nesting, 'Inline').$new(parent, context, text, opts); + }, TMP_Processor_create_inline_12.$$arity = -4); + + Opal.def(self, '$parse_content', TMP_Processor_parse_content_13 = function $$parse_content(parent, content, attributes) { + var $a, $b, $c, self = this, reader = nil, block = nil; + + + + if (attributes == null) { + attributes = nil; + }; + reader = (function() {if ($truthy($$($nesting, 'Reader')['$==='](content))) { + return content + } else { + + return $$($nesting, 'Reader').$new(content); + }; return nil; })(); + while ($truthy(($truthy($b = ($truthy($c = (block = $$($nesting, 'Parser').$next_block(reader, parent, (function() {if ($truthy(attributes)) { + return attributes.$dup() + } else { + return $hash2([], {}) + }; return nil; })()))) ? parent['$<<'](block) : $c)) ? $b : reader['$has_more_lines?']()))) { + + }; + return parent; + }, TMP_Processor_parse_content_13.$$arity = -3); + return $send([["create_paragraph", "create_block", "paragraph"], ["create_open_block", "create_block", "open"], ["create_example_block", "create_block", "example"], ["create_pass_block", "create_block", "pass"], ["create_listing_block", "create_block", "listing"], ["create_literal_block", "create_block", "literal"], ["create_anchor", "create_inline", "anchor"]], 'each', [], (TMP_Processor_14 = function(method_name, delegate_method_name, context){var self = TMP_Processor_14.$$s || this, TMP_15; + + + + if (method_name == null) { + method_name = nil; + }; + + if (delegate_method_name == null) { + delegate_method_name = nil; + }; + + if (context == null) { + context = nil; + }; + return $send(self, 'define_method', [method_name], (TMP_15 = function($a){var self = TMP_15.$$s || this, $post_args, args; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + args.$unshift(args.$shift(), context); + return $send(self, 'send', [delegate_method_name].concat(Opal.to_a(args)));}, TMP_15.$$s = self, TMP_15.$$arity = -1, TMP_15));}, TMP_Processor_14.$$s = self, TMP_Processor_14.$$arity = 3, TMP_Processor_14)); + })($nesting[0], null, $nesting); + (function($base, $parent_nesting) { + function $ProcessorDsl() {}; + var self = $ProcessorDsl = $module($base, 'ProcessorDsl', $ProcessorDsl); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_ProcessorDsl_option_16, TMP_ProcessorDsl_process_17, TMP_ProcessorDsl_process_block_given$q_18; + + + + Opal.def(self, '$option', TMP_ProcessorDsl_option_16 = function $$option(key, value) { + var self = this, $writer = nil; + + + $writer = [key, value]; + $send(self.$config(), '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + }, TMP_ProcessorDsl_option_16.$$arity = 2); + + Opal.def(self, '$process', TMP_ProcessorDsl_process_17 = function $$process($a) { + var $iter = TMP_ProcessorDsl_process_17.$$p, block = $iter || nil, $post_args, args, $b, self = this; + if (self.process_block == null) self.process_block = nil; + + if ($iter) TMP_ProcessorDsl_process_17.$$p = null; + + + if ($iter) TMP_ProcessorDsl_process_17.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + if ((block !== nil)) { + + if ($truthy(args['$empty?']())) { + } else { + self.$raise($$$('::', 'ArgumentError'), "" + "wrong number of arguments (given " + (args.$size()) + ", expected 0)") + }; + return (self.process_block = block); + } else if ($truthy((($b = self['process_block'], $b != null && $b !== nil) ? 'instance-variable' : nil))) { + return $send(self.process_block, 'call', Opal.to_a(args)) + } else { + return self.$raise($$$('::', 'NotImplementedError')) + }; + }, TMP_ProcessorDsl_process_17.$$arity = -1); + + Opal.def(self, '$process_block_given?', TMP_ProcessorDsl_process_block_given$q_18 = function() { + var $a, self = this; + + return (($a = self['process_block'], $a != null && $a !== nil) ? 'instance-variable' : nil) + }, TMP_ProcessorDsl_process_block_given$q_18.$$arity = 0); + })($nesting[0], $nesting); + (function($base, $parent_nesting) { + function $DocumentProcessorDsl() {}; + var self = $DocumentProcessorDsl = $module($base, 'DocumentProcessorDsl', $DocumentProcessorDsl); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_DocumentProcessorDsl_prefer_19; + + + self.$include($$($nesting, 'ProcessorDsl')); + + Opal.def(self, '$prefer', TMP_DocumentProcessorDsl_prefer_19 = function $$prefer() { + var self = this; + + return self.$option("position", ">>") + }, TMP_DocumentProcessorDsl_prefer_19.$$arity = 0); + })($nesting[0], $nesting); + (function($base, $parent_nesting) { + function $SyntaxProcessorDsl() {}; + var self = $SyntaxProcessorDsl = $module($base, 'SyntaxProcessorDsl', $SyntaxProcessorDsl); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_SyntaxProcessorDsl_named_20, TMP_SyntaxProcessorDsl_content_model_21, TMP_SyntaxProcessorDsl_positional_attrs_22, TMP_SyntaxProcessorDsl_default_attrs_23, TMP_SyntaxProcessorDsl_resolves_attributes_24; + + + self.$include($$($nesting, 'ProcessorDsl')); + + Opal.def(self, '$named', TMP_SyntaxProcessorDsl_named_20 = function $$named(value) { + var self = this; + + if ($truthy($$($nesting, 'Processor')['$==='](self))) { + return (self.name = value) + } else { + return self.$option("name", value) + } + }, TMP_SyntaxProcessorDsl_named_20.$$arity = 1); + Opal.alias(self, "match_name", "named"); + + Opal.def(self, '$content_model', TMP_SyntaxProcessorDsl_content_model_21 = function $$content_model(value) { + var self = this; + + return self.$option("content_model", value) + }, TMP_SyntaxProcessorDsl_content_model_21.$$arity = 1); + Opal.alias(self, "parse_content_as", "content_model"); + Opal.alias(self, "parses_content_as", "content_model"); + + Opal.def(self, '$positional_attrs', TMP_SyntaxProcessorDsl_positional_attrs_22 = function $$positional_attrs($a) { + var $post_args, value, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + value = $post_args;; + return self.$option("pos_attrs", value.$flatten()); + }, TMP_SyntaxProcessorDsl_positional_attrs_22.$$arity = -1); + Opal.alias(self, "name_attributes", "positional_attrs"); + Opal.alias(self, "name_positional_attributes", "positional_attrs"); + + Opal.def(self, '$default_attrs', TMP_SyntaxProcessorDsl_default_attrs_23 = function $$default_attrs(value) { + var self = this; + + return self.$option("default_attrs", value) + }, TMP_SyntaxProcessorDsl_default_attrs_23.$$arity = 1); + + Opal.def(self, '$resolves_attributes', TMP_SyntaxProcessorDsl_resolves_attributes_24 = function $$resolves_attributes($a) { + var $post_args, args, $b, TMP_25, TMP_26, self = this, $case = nil, names = nil, defaults = nil; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + if ($truthy($rb_gt(args.$size(), 1))) { + } else if ($truthy((args = args.$fetch(0, true))['$respond_to?']("to_sym"))) { + args = [args]}; + return (function() {$case = args; + if (true['$===']($case)) { + self.$option("pos_attrs", []); + return self.$option("default_attrs", $hash2([], {}));} + else if ($$$('::', 'Array')['$===']($case)) { + $b = [[], $hash2([], {})], (names = $b[0]), (defaults = $b[1]), $b; + $send(args, 'each', [], (TMP_25 = function(arg){var self = TMP_25.$$s || this, $c, $d, name = nil, value = nil, idx = nil, $writer = nil; + + + + if (arg == null) { + arg = nil; + }; + if ($truthy((arg = arg.$to_s())['$include?']("="))) { + + $d = arg.$split("=", 2), $c = Opal.to_ary($d), (name = ($c[0] == null ? nil : $c[0])), (value = ($c[1] == null ? nil : $c[1])), $d; + if ($truthy(name['$include?'](":"))) { + + $d = name.$split(":", 2), $c = Opal.to_ary($d), (idx = ($c[0] == null ? nil : $c[0])), (name = ($c[1] == null ? nil : $c[1])), $d; + idx = (function() {if (idx['$==']("@")) { + return names.$size() + } else { + return idx.$to_i() + }; return nil; })(); + + $writer = [idx, name]; + $send(names, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];;}; + + $writer = [name, value]; + $send(defaults, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];; + } else if ($truthy(arg['$include?'](":"))) { + + $d = arg.$split(":", 2), $c = Opal.to_ary($d), (idx = ($c[0] == null ? nil : $c[0])), (name = ($c[1] == null ? nil : $c[1])), $d; + idx = (function() {if (idx['$==']("@")) { + return names.$size() + } else { + return idx.$to_i() + }; return nil; })(); + + $writer = [idx, name]; + $send(names, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];; + } else { + return names['$<<'](arg) + };}, TMP_25.$$s = self, TMP_25.$$arity = 1, TMP_25)); + self.$option("pos_attrs", names.$compact()); + return self.$option("default_attrs", defaults);} + else if ($$$('::', 'Hash')['$===']($case)) { + $b = [[], $hash2([], {})], (names = $b[0]), (defaults = $b[1]), $b; + $send(args, 'each', [], (TMP_26 = function(key, val){var self = TMP_26.$$s || this, $c, $d, name = nil, idx = nil, $writer = nil; + + + + if (key == null) { + key = nil; + }; + + if (val == null) { + val = nil; + }; + if ($truthy((name = key.$to_s())['$include?'](":"))) { + + $d = name.$split(":", 2), $c = Opal.to_ary($d), (idx = ($c[0] == null ? nil : $c[0])), (name = ($c[1] == null ? nil : $c[1])), $d; + idx = (function() {if (idx['$==']("@")) { + return names.$size() + } else { + return idx.$to_i() + }; return nil; })(); + + $writer = [idx, name]; + $send(names, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];;}; + if ($truthy(val)) { + + $writer = [name, val]; + $send(defaults, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + } else { + return nil + };}, TMP_26.$$s = self, TMP_26.$$arity = 2, TMP_26)); + self.$option("pos_attrs", names.$compact()); + return self.$option("default_attrs", defaults);} + else {return self.$raise($$$('::', 'ArgumentError'), "" + "unsupported attributes specification for macro: " + (args.$inspect()))}})(); + }, TMP_SyntaxProcessorDsl_resolves_attributes_24.$$arity = -1); + Opal.alias(self, "resolve_attributes", "resolves_attributes"); + })($nesting[0], $nesting); + (function($base, $super, $parent_nesting) { + function $Preprocessor(){}; + var self = $Preprocessor = $klass($base, $super, 'Preprocessor', $Preprocessor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Preprocessor_process_27; + + return (Opal.def(self, '$process', TMP_Preprocessor_process_27 = function $$process(document, reader) { + var self = this; + + return self.$raise($$$('::', 'NotImplementedError'), "" + "Asciidoctor::Extensions::Preprocessor subclass must implement #" + ("process") + " method") + }, TMP_Preprocessor_process_27.$$arity = 2), nil) && 'process' + })($nesting[0], $$($nesting, 'Processor'), $nesting); + Opal.const_set($$($nesting, 'Preprocessor'), 'DSL', $$($nesting, 'DocumentProcessorDsl')); + (function($base, $super, $parent_nesting) { + function $TreeProcessor(){}; + var self = $TreeProcessor = $klass($base, $super, 'TreeProcessor', $TreeProcessor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_TreeProcessor_process_28; + + return (Opal.def(self, '$process', TMP_TreeProcessor_process_28 = function $$process(document) { + var self = this; + + return self.$raise($$$('::', 'NotImplementedError'), "" + "Asciidoctor::Extensions::TreeProcessor subclass must implement #" + ("process") + " method") + }, TMP_TreeProcessor_process_28.$$arity = 1), nil) && 'process' + })($nesting[0], $$($nesting, 'Processor'), $nesting); + Opal.const_set($$($nesting, 'TreeProcessor'), 'DSL', $$($nesting, 'DocumentProcessorDsl')); + Opal.const_set($nesting[0], 'Treeprocessor', $$($nesting, 'TreeProcessor')); + (function($base, $super, $parent_nesting) { + function $Postprocessor(){}; + var self = $Postprocessor = $klass($base, $super, 'Postprocessor', $Postprocessor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Postprocessor_process_29; + + return (Opal.def(self, '$process', TMP_Postprocessor_process_29 = function $$process(document, output) { + var self = this; + + return self.$raise($$$('::', 'NotImplementedError'), "" + "Asciidoctor::Extensions::Postprocessor subclass must implement #" + ("process") + " method") + }, TMP_Postprocessor_process_29.$$arity = 2), nil) && 'process' + })($nesting[0], $$($nesting, 'Processor'), $nesting); + Opal.const_set($$($nesting, 'Postprocessor'), 'DSL', $$($nesting, 'DocumentProcessorDsl')); + (function($base, $super, $parent_nesting) { + function $IncludeProcessor(){}; + var self = $IncludeProcessor = $klass($base, $super, 'IncludeProcessor', $IncludeProcessor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_IncludeProcessor_process_30, TMP_IncludeProcessor_handles$q_31; + + + + Opal.def(self, '$process', TMP_IncludeProcessor_process_30 = function $$process(document, reader, target, attributes) { + var self = this; + + return self.$raise($$$('::', 'NotImplementedError'), "" + "Asciidoctor::Extensions::IncludeProcessor subclass must implement #" + ("process") + " method") + }, TMP_IncludeProcessor_process_30.$$arity = 4); + return (Opal.def(self, '$handles?', TMP_IncludeProcessor_handles$q_31 = function(target) { + var self = this; + + return true + }, TMP_IncludeProcessor_handles$q_31.$$arity = 1), nil) && 'handles?'; + })($nesting[0], $$($nesting, 'Processor'), $nesting); + (function($base, $parent_nesting) { + function $IncludeProcessorDsl() {}; + var self = $IncludeProcessorDsl = $module($base, 'IncludeProcessorDsl', $IncludeProcessorDsl); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_IncludeProcessorDsl_handles$q_32; + + + self.$include($$($nesting, 'DocumentProcessorDsl')); + + Opal.def(self, '$handles?', TMP_IncludeProcessorDsl_handles$q_32 = function($a) { + var $iter = TMP_IncludeProcessorDsl_handles$q_32.$$p, block = $iter || nil, $post_args, args, $b, self = this; + if (self.handles_block == null) self.handles_block = nil; + + if ($iter) TMP_IncludeProcessorDsl_handles$q_32.$$p = null; + + + if ($iter) TMP_IncludeProcessorDsl_handles$q_32.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + if ((block !== nil)) { + + if ($truthy(args['$empty?']())) { + } else { + self.$raise($$$('::', 'ArgumentError'), "" + "wrong number of arguments (given " + (args.$size()) + ", expected 0)") + }; + return (self.handles_block = block); + } else if ($truthy((($b = self['handles_block'], $b != null && $b !== nil) ? 'instance-variable' : nil))) { + return self.handles_block.$call(args['$[]'](0)) + } else { + return true + }; + }, TMP_IncludeProcessorDsl_handles$q_32.$$arity = -1); + })($nesting[0], $nesting); + Opal.const_set($$($nesting, 'IncludeProcessor'), 'DSL', $$($nesting, 'IncludeProcessorDsl')); + (function($base, $super, $parent_nesting) { + function $DocinfoProcessor(){}; + var self = $DocinfoProcessor = $klass($base, $super, 'DocinfoProcessor', $DocinfoProcessor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_DocinfoProcessor_initialize_33, TMP_DocinfoProcessor_process_34; + + def.config = nil; + + self.$attr_accessor("location"); + + Opal.def(self, '$initialize', TMP_DocinfoProcessor_initialize_33 = function $$initialize(config) { + var $a, $iter = TMP_DocinfoProcessor_initialize_33.$$p, $yield = $iter || nil, self = this, $writer = nil; + + if ($iter) TMP_DocinfoProcessor_initialize_33.$$p = null; + + + if (config == null) { + config = $hash2([], {}); + }; + $send(self, Opal.find_super_dispatcher(self, 'initialize', TMP_DocinfoProcessor_initialize_33, false), [config], null); + return ($truthy($a = self.config['$[]']("location")) ? $a : (($writer = ["location", "head"]), $send(self.config, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + }, TMP_DocinfoProcessor_initialize_33.$$arity = -1); + return (Opal.def(self, '$process', TMP_DocinfoProcessor_process_34 = function $$process(document) { + var self = this; + + return self.$raise($$$('::', 'NotImplementedError'), "" + "Asciidoctor::Extensions::DocinfoProcessor subclass must implement #" + ("process") + " method") + }, TMP_DocinfoProcessor_process_34.$$arity = 1), nil) && 'process'; + })($nesting[0], $$($nesting, 'Processor'), $nesting); + (function($base, $parent_nesting) { + function $DocinfoProcessorDsl() {}; + var self = $DocinfoProcessorDsl = $module($base, 'DocinfoProcessorDsl', $DocinfoProcessorDsl); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_DocinfoProcessorDsl_at_location_35; + + + self.$include($$($nesting, 'DocumentProcessorDsl')); + + Opal.def(self, '$at_location', TMP_DocinfoProcessorDsl_at_location_35 = function $$at_location(value) { + var self = this; + + return self.$option("location", value) + }, TMP_DocinfoProcessorDsl_at_location_35.$$arity = 1); + })($nesting[0], $nesting); + Opal.const_set($$($nesting, 'DocinfoProcessor'), 'DSL', $$($nesting, 'DocinfoProcessorDsl')); + (function($base, $super, $parent_nesting) { + function $BlockProcessor(){}; + var self = $BlockProcessor = $klass($base, $super, 'BlockProcessor', $BlockProcessor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_BlockProcessor_initialize_36, TMP_BlockProcessor_process_37; + + def.config = nil; + + self.$attr_accessor("name"); + + Opal.def(self, '$initialize', TMP_BlockProcessor_initialize_36 = function $$initialize(name, config) { + var $a, $iter = TMP_BlockProcessor_initialize_36.$$p, $yield = $iter || nil, self = this, $case = nil, $writer = nil; + + if ($iter) TMP_BlockProcessor_initialize_36.$$p = null; + + + if (name == null) { + name = nil; + }; + + if (config == null) { + config = $hash2([], {}); + }; + $send(self, Opal.find_super_dispatcher(self, 'initialize', TMP_BlockProcessor_initialize_36, false), [config], null); + self.name = ($truthy($a = name) ? $a : self.config['$[]']("name")); + $case = self.config['$[]']("contexts"); + if ($$$('::', 'NilClass')['$===']($case)) {($truthy($a = self.config['$[]']("contexts")) ? $a : (($writer = ["contexts", ["open", "paragraph"].$to_set()]), $send(self.config, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]))} + else if ($$$('::', 'Symbol')['$===']($case)) { + $writer = ["contexts", [self.config['$[]']("contexts")].$to_set()]; + $send(self.config, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];} + else { + $writer = ["contexts", self.config['$[]']("contexts").$to_set()]; + $send(self.config, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + return ($truthy($a = self.config['$[]']("content_model")) ? $a : (($writer = ["content_model", "compound"]), $send(self.config, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + }, TMP_BlockProcessor_initialize_36.$$arity = -1); + return (Opal.def(self, '$process', TMP_BlockProcessor_process_37 = function $$process(parent, reader, attributes) { + var self = this; + + return self.$raise($$$('::', 'NotImplementedError'), "" + "Asciidoctor::Extensions::BlockProcessor subclass must implement #" + ("process") + " method") + }, TMP_BlockProcessor_process_37.$$arity = 3), nil) && 'process'; + })($nesting[0], $$($nesting, 'Processor'), $nesting); + (function($base, $parent_nesting) { + function $BlockProcessorDsl() {}; + var self = $BlockProcessorDsl = $module($base, 'BlockProcessorDsl', $BlockProcessorDsl); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_BlockProcessorDsl_contexts_38; + + + self.$include($$($nesting, 'SyntaxProcessorDsl')); + + Opal.def(self, '$contexts', TMP_BlockProcessorDsl_contexts_38 = function $$contexts($a) { + var $post_args, value, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + value = $post_args;; + return self.$option("contexts", value.$flatten().$to_set()); + }, TMP_BlockProcessorDsl_contexts_38.$$arity = -1); + Opal.alias(self, "on_contexts", "contexts"); + Opal.alias(self, "on_context", "contexts"); + Opal.alias(self, "bound_to", "contexts"); + })($nesting[0], $nesting); + Opal.const_set($$($nesting, 'BlockProcessor'), 'DSL', $$($nesting, 'BlockProcessorDsl')); + (function($base, $super, $parent_nesting) { + function $MacroProcessor(){}; + var self = $MacroProcessor = $klass($base, $super, 'MacroProcessor', $MacroProcessor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_MacroProcessor_initialize_39, TMP_MacroProcessor_process_40; + + def.config = nil; + + self.$attr_accessor("name"); + + Opal.def(self, '$initialize', TMP_MacroProcessor_initialize_39 = function $$initialize(name, config) { + var $a, $iter = TMP_MacroProcessor_initialize_39.$$p, $yield = $iter || nil, self = this, $writer = nil; + + if ($iter) TMP_MacroProcessor_initialize_39.$$p = null; + + + if (name == null) { + name = nil; + }; + + if (config == null) { + config = $hash2([], {}); + }; + $send(self, Opal.find_super_dispatcher(self, 'initialize', TMP_MacroProcessor_initialize_39, false), [config], null); + self.name = ($truthy($a = name) ? $a : self.config['$[]']("name")); + return ($truthy($a = self.config['$[]']("content_model")) ? $a : (($writer = ["content_model", "attributes"]), $send(self.config, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + }, TMP_MacroProcessor_initialize_39.$$arity = -1); + return (Opal.def(self, '$process', TMP_MacroProcessor_process_40 = function $$process(parent, target, attributes) { + var self = this; + + return self.$raise($$$('::', 'NotImplementedError'), "" + "Asciidoctor::Extensions::MacroProcessor subclass must implement #" + ("process") + " method") + }, TMP_MacroProcessor_process_40.$$arity = 3), nil) && 'process'; + })($nesting[0], $$($nesting, 'Processor'), $nesting); + (function($base, $parent_nesting) { + function $MacroProcessorDsl() {}; + var self = $MacroProcessorDsl = $module($base, 'MacroProcessorDsl', $MacroProcessorDsl); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_MacroProcessorDsl_resolves_attributes_41; + + + self.$include($$($nesting, 'SyntaxProcessorDsl')); + + Opal.def(self, '$resolves_attributes', TMP_MacroProcessorDsl_resolves_attributes_41 = function $$resolves_attributes($a) { + var $post_args, args, $b, $iter = TMP_MacroProcessorDsl_resolves_attributes_41.$$p, $yield = $iter || nil, self = this, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_MacroProcessorDsl_resolves_attributes_41.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + if ($truthy((($b = args.$size()['$=='](1)) ? args['$[]'](0)['$!']() : args.$size()['$=='](1)))) { + + self.$option("content_model", "text"); + return nil;}; + $send(self, Opal.find_super_dispatcher(self, 'resolves_attributes', TMP_MacroProcessorDsl_resolves_attributes_41, false), $zuper, $iter); + return self.$option("content_model", "attributes"); + }, TMP_MacroProcessorDsl_resolves_attributes_41.$$arity = -1); + Opal.alias(self, "resolve_attributes", "resolves_attributes"); + })($nesting[0], $nesting); + (function($base, $super, $parent_nesting) { + function $BlockMacroProcessor(){}; + var self = $BlockMacroProcessor = $klass($base, $super, 'BlockMacroProcessor', $BlockMacroProcessor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_BlockMacroProcessor_name_42; + + def.name = nil; + return (Opal.def(self, '$name', TMP_BlockMacroProcessor_name_42 = function $$name() { + var self = this; + + + if ($truthy($$($nesting, 'MacroNameRx')['$match?'](self.name.$to_s()))) { + } else { + self.$raise($$$('::', 'ArgumentError'), "" + "invalid name for block macro: " + (self.name)) + }; + return self.name; + }, TMP_BlockMacroProcessor_name_42.$$arity = 0), nil) && 'name' + })($nesting[0], $$($nesting, 'MacroProcessor'), $nesting); + Opal.const_set($$($nesting, 'BlockMacroProcessor'), 'DSL', $$($nesting, 'MacroProcessorDsl')); + (function($base, $super, $parent_nesting) { + function $InlineMacroProcessor(){}; + var self = $InlineMacroProcessor = $klass($base, $super, 'InlineMacroProcessor', $InlineMacroProcessor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_InlineMacroProcessor_regexp_43, TMP_InlineMacroProcessor_resolve_regexp_44; + + def.config = def.name = nil; + + (Opal.class_variable_set($InlineMacroProcessor, '@@rx_cache', $hash2([], {}))); + + Opal.def(self, '$regexp', TMP_InlineMacroProcessor_regexp_43 = function $$regexp() { + var $a, self = this, $writer = nil; + + return ($truthy($a = self.config['$[]']("regexp")) ? $a : (($writer = ["regexp", self.$resolve_regexp(self.name.$to_s(), self.config['$[]']("format"))]), $send(self.config, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])) + }, TMP_InlineMacroProcessor_regexp_43.$$arity = 0); + return (Opal.def(self, '$resolve_regexp', TMP_InlineMacroProcessor_resolve_regexp_44 = function $$resolve_regexp(name, format) { + var $a, $b, self = this, $writer = nil; + + + if ($truthy($$($nesting, 'MacroNameRx')['$match?'](name))) { + } else { + self.$raise($$$('::', 'ArgumentError'), "" + "invalid name for inline macro: " + (name)) + }; + return ($truthy($a = (($b = $InlineMacroProcessor.$$cvars['@@rx_cache']) == null ? nil : $b)['$[]']([name, format])) ? $a : (($writer = [[name, format], new RegExp("" + "\\\\?" + (name) + ":" + ((function() {if (format['$==']("short")) { + return "(){0}" + } else { + return "(\\S+?)" + }; return nil; })()) + "\\[(|.*?[^\\\\])\\]")]), $send((($b = $InlineMacroProcessor.$$cvars['@@rx_cache']) == null ? nil : $b), '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + }, TMP_InlineMacroProcessor_resolve_regexp_44.$$arity = 2), nil) && 'resolve_regexp'; + })($nesting[0], $$($nesting, 'MacroProcessor'), $nesting); + (function($base, $parent_nesting) { + function $InlineMacroProcessorDsl() {}; + var self = $InlineMacroProcessorDsl = $module($base, 'InlineMacroProcessorDsl', $InlineMacroProcessorDsl); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_InlineMacroProcessorDsl_with_format_45, TMP_InlineMacroProcessorDsl_matches_46; + + + self.$include($$($nesting, 'MacroProcessorDsl')); + + Opal.def(self, '$with_format', TMP_InlineMacroProcessorDsl_with_format_45 = function $$with_format(value) { + var self = this; + + return self.$option("format", value) + }, TMP_InlineMacroProcessorDsl_with_format_45.$$arity = 1); + Opal.alias(self, "using_format", "with_format"); + + Opal.def(self, '$matches', TMP_InlineMacroProcessorDsl_matches_46 = function $$matches(value) { + var self = this; + + return self.$option("regexp", value) + }, TMP_InlineMacroProcessorDsl_matches_46.$$arity = 1); + Opal.alias(self, "match", "matches"); + Opal.alias(self, "matching", "matches"); + })($nesting[0], $nesting); + Opal.const_set($$($nesting, 'InlineMacroProcessor'), 'DSL', $$($nesting, 'InlineMacroProcessorDsl')); + (function($base, $super, $parent_nesting) { + function $Extension(){}; + var self = $Extension = $klass($base, $super, 'Extension', $Extension); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Extension_initialize_47; + + + self.$attr_reader("kind"); + self.$attr_reader("config"); + self.$attr_reader("instance"); + return (Opal.def(self, '$initialize', TMP_Extension_initialize_47 = function $$initialize(kind, instance, config) { + var self = this; + + + self.kind = kind; + self.instance = instance; + return (self.config = config); + }, TMP_Extension_initialize_47.$$arity = 3), nil) && 'initialize'; + })($nesting[0], null, $nesting); + (function($base, $super, $parent_nesting) { + function $ProcessorExtension(){}; + var self = $ProcessorExtension = $klass($base, $super, 'ProcessorExtension', $ProcessorExtension); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_ProcessorExtension_initialize_48; + + + self.$attr_reader("process_method"); + return (Opal.def(self, '$initialize', TMP_ProcessorExtension_initialize_48 = function $$initialize(kind, instance, process_method) { + var $a, $iter = TMP_ProcessorExtension_initialize_48.$$p, $yield = $iter || nil, self = this; + + if ($iter) TMP_ProcessorExtension_initialize_48.$$p = null; + + + if (process_method == null) { + process_method = nil; + }; + $send(self, Opal.find_super_dispatcher(self, 'initialize', TMP_ProcessorExtension_initialize_48, false), [kind, instance, instance.$config()], null); + return (self.process_method = ($truthy($a = process_method) ? $a : instance.$method("process"))); + }, TMP_ProcessorExtension_initialize_48.$$arity = -3), nil) && 'initialize'; + })($nesting[0], $$($nesting, 'Extension'), $nesting); + (function($base, $super, $parent_nesting) { + function $Group(){}; + var self = $Group = $klass($base, $super, 'Group', $Group); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Group_activate_50; + + + (function(self, $parent_nesting) { + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_register_49; + + return (Opal.def(self, '$register', TMP_register_49 = function $$register(name) { + var self = this; + + + + if (name == null) { + name = nil; + }; + return $$($nesting, 'Extensions').$register(name, self); + }, TMP_register_49.$$arity = -1), nil) && 'register' + })(Opal.get_singleton_class(self), $nesting); + return (Opal.def(self, '$activate', TMP_Group_activate_50 = function $$activate(registry) { + var self = this; + + return self.$raise($$$('::', 'NotImplementedError')) + }, TMP_Group_activate_50.$$arity = 1), nil) && 'activate'; + })($nesting[0], null, $nesting); + (function($base, $super, $parent_nesting) { + function $Registry(){}; + var self = $Registry = $klass($base, $super, 'Registry', $Registry); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Registry_initialize_51, TMP_Registry_activate_52, TMP_Registry_preprocessor_54, TMP_Registry_preprocessors$q_55, TMP_Registry_preprocessors_56, TMP_Registry_tree_processor_57, TMP_Registry_tree_processors$q_58, TMP_Registry_tree_processors_59, TMP_Registry_postprocessor_60, TMP_Registry_postprocessors$q_61, TMP_Registry_postprocessors_62, TMP_Registry_include_processor_63, TMP_Registry_include_processors$q_64, TMP_Registry_include_processors_65, TMP_Registry_docinfo_processor_66, TMP_Registry_docinfo_processors$q_67, TMP_Registry_docinfo_processors_69, TMP_Registry_block_71, TMP_Registry_blocks$q_72, TMP_Registry_registered_for_block$q_73, TMP_Registry_find_block_extension_74, TMP_Registry_block_macro_75, TMP_Registry_block_macros$q_76, TMP_Registry_registered_for_block_macro$q_77, TMP_Registry_find_block_macro_extension_78, TMP_Registry_inline_macro_79, TMP_Registry_inline_macros$q_80, TMP_Registry_registered_for_inline_macro$q_81, TMP_Registry_find_inline_macro_extension_82, TMP_Registry_inline_macros_83, TMP_Registry_prefer_84, TMP_Registry_add_document_processor_85, TMP_Registry_add_syntax_processor_87, TMP_Registry_resolve_args_89, TMP_Registry_as_symbol_90; + + def.groups = def.preprocessor_extensions = def.tree_processor_extensions = def.postprocessor_extensions = def.include_processor_extensions = def.docinfo_processor_extensions = def.block_extensions = def.block_macro_extensions = def.inline_macro_extensions = nil; + + self.$attr_reader("document"); + self.$attr_reader("groups"); + + Opal.def(self, '$initialize', TMP_Registry_initialize_51 = function $$initialize(groups) { + var self = this; + + + + if (groups == null) { + groups = $hash2([], {}); + }; + self.groups = groups; + self.preprocessor_extensions = (self.tree_processor_extensions = (self.postprocessor_extensions = (self.include_processor_extensions = (self.docinfo_processor_extensions = (self.block_extensions = (self.block_macro_extensions = (self.inline_macro_extensions = nil))))))); + return (self.document = nil); + }, TMP_Registry_initialize_51.$$arity = -1); + + Opal.def(self, '$activate', TMP_Registry_activate_52 = function $$activate(document) { + var TMP_53, self = this, ext_groups = nil; + + + self.document = document; + if ($truthy((ext_groups = $rb_plus($$($nesting, 'Extensions').$groups().$values(), self.groups.$values()))['$empty?']())) { + } else { + $send(ext_groups, 'each', [], (TMP_53 = function(group){var self = TMP_53.$$s || this, $case = nil; + + + + if (group == null) { + group = nil; + }; + return (function() {$case = group; + if ($$$('::', 'Proc')['$===']($case)) {return (function() {$case = group.$arity(); + if ((0)['$===']($case) || (-1)['$===']($case)) {return $send(self, 'instance_exec', [], group.$to_proc())} + else if ((1)['$===']($case)) {return group.$call(self)} + else { return nil }})()} + else if ($$$('::', 'Class')['$===']($case)) {return group.$new().$activate(self)} + else {return group.$activate(self)}})();}, TMP_53.$$s = self, TMP_53.$$arity = 1, TMP_53)) + }; + return self; + }, TMP_Registry_activate_52.$$arity = 1); + + Opal.def(self, '$preprocessor', TMP_Registry_preprocessor_54 = function $$preprocessor($a) { + var $iter = TMP_Registry_preprocessor_54.$$p, block = $iter || nil, $post_args, args, self = this; + + if ($iter) TMP_Registry_preprocessor_54.$$p = null; + + + if ($iter) TMP_Registry_preprocessor_54.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + return $send(self, 'add_document_processor', ["preprocessor", args], block.$to_proc()); + }, TMP_Registry_preprocessor_54.$$arity = -1); + + Opal.def(self, '$preprocessors?', TMP_Registry_preprocessors$q_55 = function() { + var self = this; + + return self.preprocessor_extensions['$!']()['$!']() + }, TMP_Registry_preprocessors$q_55.$$arity = 0); + + Opal.def(self, '$preprocessors', TMP_Registry_preprocessors_56 = function $$preprocessors() { + var self = this; + + return self.preprocessor_extensions + }, TMP_Registry_preprocessors_56.$$arity = 0); + + Opal.def(self, '$tree_processor', TMP_Registry_tree_processor_57 = function $$tree_processor($a) { + var $iter = TMP_Registry_tree_processor_57.$$p, block = $iter || nil, $post_args, args, self = this; + + if ($iter) TMP_Registry_tree_processor_57.$$p = null; + + + if ($iter) TMP_Registry_tree_processor_57.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + return $send(self, 'add_document_processor', ["tree_processor", args], block.$to_proc()); + }, TMP_Registry_tree_processor_57.$$arity = -1); + + Opal.def(self, '$tree_processors?', TMP_Registry_tree_processors$q_58 = function() { + var self = this; + + return self.tree_processor_extensions['$!']()['$!']() + }, TMP_Registry_tree_processors$q_58.$$arity = 0); + + Opal.def(self, '$tree_processors', TMP_Registry_tree_processors_59 = function $$tree_processors() { + var self = this; + + return self.tree_processor_extensions + }, TMP_Registry_tree_processors_59.$$arity = 0); + Opal.alias(self, "treeprocessor", "tree_processor"); + Opal.alias(self, "treeprocessors?", "tree_processors?"); + Opal.alias(self, "treeprocessors", "tree_processors"); + + Opal.def(self, '$postprocessor', TMP_Registry_postprocessor_60 = function $$postprocessor($a) { + var $iter = TMP_Registry_postprocessor_60.$$p, block = $iter || nil, $post_args, args, self = this; + + if ($iter) TMP_Registry_postprocessor_60.$$p = null; + + + if ($iter) TMP_Registry_postprocessor_60.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + return $send(self, 'add_document_processor', ["postprocessor", args], block.$to_proc()); + }, TMP_Registry_postprocessor_60.$$arity = -1); + + Opal.def(self, '$postprocessors?', TMP_Registry_postprocessors$q_61 = function() { + var self = this; + + return self.postprocessor_extensions['$!']()['$!']() + }, TMP_Registry_postprocessors$q_61.$$arity = 0); + + Opal.def(self, '$postprocessors', TMP_Registry_postprocessors_62 = function $$postprocessors() { + var self = this; + + return self.postprocessor_extensions + }, TMP_Registry_postprocessors_62.$$arity = 0); + + Opal.def(self, '$include_processor', TMP_Registry_include_processor_63 = function $$include_processor($a) { + var $iter = TMP_Registry_include_processor_63.$$p, block = $iter || nil, $post_args, args, self = this; + + if ($iter) TMP_Registry_include_processor_63.$$p = null; + + + if ($iter) TMP_Registry_include_processor_63.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + return $send(self, 'add_document_processor', ["include_processor", args], block.$to_proc()); + }, TMP_Registry_include_processor_63.$$arity = -1); + + Opal.def(self, '$include_processors?', TMP_Registry_include_processors$q_64 = function() { + var self = this; + + return self.include_processor_extensions['$!']()['$!']() + }, TMP_Registry_include_processors$q_64.$$arity = 0); + + Opal.def(self, '$include_processors', TMP_Registry_include_processors_65 = function $$include_processors() { + var self = this; + + return self.include_processor_extensions + }, TMP_Registry_include_processors_65.$$arity = 0); + + Opal.def(self, '$docinfo_processor', TMP_Registry_docinfo_processor_66 = function $$docinfo_processor($a) { + var $iter = TMP_Registry_docinfo_processor_66.$$p, block = $iter || nil, $post_args, args, self = this; + + if ($iter) TMP_Registry_docinfo_processor_66.$$p = null; + + + if ($iter) TMP_Registry_docinfo_processor_66.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + return $send(self, 'add_document_processor', ["docinfo_processor", args], block.$to_proc()); + }, TMP_Registry_docinfo_processor_66.$$arity = -1); + + Opal.def(self, '$docinfo_processors?', TMP_Registry_docinfo_processors$q_67 = function(location) { + var TMP_68, self = this; + + + + if (location == null) { + location = nil; + }; + if ($truthy(self.docinfo_processor_extensions)) { + if ($truthy(location)) { + return $send(self.docinfo_processor_extensions, 'any?', [], (TMP_68 = function(ext){var self = TMP_68.$$s || this; + + + + if (ext == null) { + ext = nil; + }; + return ext.$config()['$[]']("location")['$=='](location);}, TMP_68.$$s = self, TMP_68.$$arity = 1, TMP_68)) + } else { + return true + } + } else { + return false + }; + }, TMP_Registry_docinfo_processors$q_67.$$arity = -1); + + Opal.def(self, '$docinfo_processors', TMP_Registry_docinfo_processors_69 = function $$docinfo_processors(location) { + var TMP_70, self = this; + + + + if (location == null) { + location = nil; + }; + if ($truthy(self.docinfo_processor_extensions)) { + if ($truthy(location)) { + return $send(self.docinfo_processor_extensions, 'select', [], (TMP_70 = function(ext){var self = TMP_70.$$s || this; + + + + if (ext == null) { + ext = nil; + }; + return ext.$config()['$[]']("location")['$=='](location);}, TMP_70.$$s = self, TMP_70.$$arity = 1, TMP_70)) + } else { + return self.docinfo_processor_extensions + } + } else { + return nil + }; + }, TMP_Registry_docinfo_processors_69.$$arity = -1); + + Opal.def(self, '$block', TMP_Registry_block_71 = function $$block($a) { + var $iter = TMP_Registry_block_71.$$p, block = $iter || nil, $post_args, args, self = this; + + if ($iter) TMP_Registry_block_71.$$p = null; + + + if ($iter) TMP_Registry_block_71.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + return $send(self, 'add_syntax_processor', ["block", args], block.$to_proc()); + }, TMP_Registry_block_71.$$arity = -1); + + Opal.def(self, '$blocks?', TMP_Registry_blocks$q_72 = function() { + var self = this; + + return self.block_extensions['$!']()['$!']() + }, TMP_Registry_blocks$q_72.$$arity = 0); + + Opal.def(self, '$registered_for_block?', TMP_Registry_registered_for_block$q_73 = function(name, context) { + var self = this, ext = nil; + + if ($truthy((ext = self.block_extensions['$[]'](name.$to_sym())))) { + if ($truthy(ext.$config()['$[]']("contexts")['$include?'](context))) { + return ext + } else { + return false + } + } else { + return false + } + }, TMP_Registry_registered_for_block$q_73.$$arity = 2); + + Opal.def(self, '$find_block_extension', TMP_Registry_find_block_extension_74 = function $$find_block_extension(name) { + var self = this; + + return self.block_extensions['$[]'](name.$to_sym()) + }, TMP_Registry_find_block_extension_74.$$arity = 1); + + Opal.def(self, '$block_macro', TMP_Registry_block_macro_75 = function $$block_macro($a) { + var $iter = TMP_Registry_block_macro_75.$$p, block = $iter || nil, $post_args, args, self = this; + + if ($iter) TMP_Registry_block_macro_75.$$p = null; + + + if ($iter) TMP_Registry_block_macro_75.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + return $send(self, 'add_syntax_processor', ["block_macro", args], block.$to_proc()); + }, TMP_Registry_block_macro_75.$$arity = -1); + + Opal.def(self, '$block_macros?', TMP_Registry_block_macros$q_76 = function() { + var self = this; + + return self.block_macro_extensions['$!']()['$!']() + }, TMP_Registry_block_macros$q_76.$$arity = 0); + + Opal.def(self, '$registered_for_block_macro?', TMP_Registry_registered_for_block_macro$q_77 = function(name) { + var self = this, ext = nil; + + if ($truthy((ext = self.block_macro_extensions['$[]'](name.$to_sym())))) { + return ext + } else { + return false + } + }, TMP_Registry_registered_for_block_macro$q_77.$$arity = 1); + + Opal.def(self, '$find_block_macro_extension', TMP_Registry_find_block_macro_extension_78 = function $$find_block_macro_extension(name) { + var self = this; + + return self.block_macro_extensions['$[]'](name.$to_sym()) + }, TMP_Registry_find_block_macro_extension_78.$$arity = 1); + + Opal.def(self, '$inline_macro', TMP_Registry_inline_macro_79 = function $$inline_macro($a) { + var $iter = TMP_Registry_inline_macro_79.$$p, block = $iter || nil, $post_args, args, self = this; + + if ($iter) TMP_Registry_inline_macro_79.$$p = null; + + + if ($iter) TMP_Registry_inline_macro_79.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + return $send(self, 'add_syntax_processor', ["inline_macro", args], block.$to_proc()); + }, TMP_Registry_inline_macro_79.$$arity = -1); + + Opal.def(self, '$inline_macros?', TMP_Registry_inline_macros$q_80 = function() { + var self = this; + + return self.inline_macro_extensions['$!']()['$!']() + }, TMP_Registry_inline_macros$q_80.$$arity = 0); + + Opal.def(self, '$registered_for_inline_macro?', TMP_Registry_registered_for_inline_macro$q_81 = function(name) { + var self = this, ext = nil; + + if ($truthy((ext = self.inline_macro_extensions['$[]'](name.$to_sym())))) { + return ext + } else { + return false + } + }, TMP_Registry_registered_for_inline_macro$q_81.$$arity = 1); + + Opal.def(self, '$find_inline_macro_extension', TMP_Registry_find_inline_macro_extension_82 = function $$find_inline_macro_extension(name) { + var self = this; + + return self.inline_macro_extensions['$[]'](name.$to_sym()) + }, TMP_Registry_find_inline_macro_extension_82.$$arity = 1); + + Opal.def(self, '$inline_macros', TMP_Registry_inline_macros_83 = function $$inline_macros() { + var self = this; + + return self.inline_macro_extensions.$values() + }, TMP_Registry_inline_macros_83.$$arity = 0); + + Opal.def(self, '$prefer', TMP_Registry_prefer_84 = function $$prefer($a) { + var $iter = TMP_Registry_prefer_84.$$p, block = $iter || nil, $post_args, args, self = this, extension = nil, arg0 = nil, extensions_store = nil; + + if ($iter) TMP_Registry_prefer_84.$$p = null; + + + if ($iter) TMP_Registry_prefer_84.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + extension = (function() {if ($truthy($$($nesting, 'ProcessorExtension')['$===']((arg0 = args.$shift())))) { + return arg0 + } else { + + return $send(self, 'send', [arg0].concat(Opal.to_a(args)), block.$to_proc()); + }; return nil; })(); + extensions_store = self.$instance_variable_get(((("" + "@") + (extension.$kind())) + "_extensions").$to_sym()); + extensions_store.$unshift(extensions_store.$delete(extension)); + return extension; + }, TMP_Registry_prefer_84.$$arity = -1); + self.$private(); + + Opal.def(self, '$add_document_processor', TMP_Registry_add_document_processor_85 = function $$add_document_processor(kind, args) { + var $iter = TMP_Registry_add_document_processor_85.$$p, block = $iter || nil, TMP_86, $a, $b, $c, self = this, kind_name = nil, kind_class_symbol = nil, kind_class = nil, kind_java_class = nil, kind_store = nil, extension = nil, config = nil, processor = nil, processor_class = nil, processor_instance = nil; + + if ($iter) TMP_Registry_add_document_processor_85.$$p = null; + + + if ($iter) TMP_Registry_add_document_processor_85.$$p = null;; + kind_name = kind.$to_s().$tr("_", " "); + kind_class_symbol = $send(kind_name.$split(), 'map', [], (TMP_86 = function(it){var self = TMP_86.$$s || this; + + + + if (it == null) { + it = nil; + }; + return it.$capitalize();}, TMP_86.$$s = self, TMP_86.$$arity = 1, TMP_86)).$join().$to_sym(); + kind_class = $$($nesting, 'Extensions').$const_get(kind_class_symbol); + kind_java_class = (function() {if ($truthy((($a = $$$('::', 'AsciidoctorJ', 'skip_raise')) ? 'constant' : nil))) { + + return $$$($$$('::', 'AsciidoctorJ'), 'Extensions').$const_get(kind_class_symbol); + } else { + return nil + }; return nil; })(); + kind_store = ($truthy($b = self.$instance_variable_get(((("" + "@") + (kind)) + "_extensions").$to_sym())) ? $b : self.$instance_variable_set(((("" + "@") + (kind)) + "_extensions").$to_sym(), [])); + extension = (function() {if ((block !== nil)) { + + config = self.$resolve_args(args, 1); + processor = kind_class.$new(config); + if ($truthy(kind_class.$constants().$grep("DSL"))) { + processor.$extend(kind_class.$const_get("DSL"))}; + $send(processor, 'instance_exec', [], block.$to_proc()); + processor.$freeze(); + if ($truthy(processor['$process_block_given?']())) { + } else { + self.$raise($$$('::', 'ArgumentError'), "" + "No block specified to process " + (kind_name) + " extension at " + (block.$source_location())) + }; + return $$($nesting, 'ProcessorExtension').$new(kind, processor); + } else { + + $c = self.$resolve_args(args, 2), $b = Opal.to_ary($c), (processor = ($b[0] == null ? nil : $b[0])), (config = ($b[1] == null ? nil : $b[1])), $c; + if ($truthy((processor_class = $$($nesting, 'Extensions').$resolve_class(processor)))) { + + if ($truthy(($truthy($b = $rb_lt(processor_class, kind_class)) ? $b : ($truthy($c = kind_java_class) ? $rb_lt(processor_class, kind_java_class) : $c)))) { + } else { + self.$raise($$$('::', 'ArgumentError'), "" + "Invalid type for " + (kind_name) + " extension: " + (processor)) + }; + processor_instance = processor_class.$new(config); + processor_instance.$freeze(); + return $$($nesting, 'ProcessorExtension').$new(kind, processor_instance); + } else if ($truthy(($truthy($b = kind_class['$==='](processor)) ? $b : ($truthy($c = kind_java_class) ? kind_java_class['$==='](processor) : $c)))) { + + processor.$update_config(config); + processor.$freeze(); + return $$($nesting, 'ProcessorExtension').$new(kind, processor); + } else { + return self.$raise($$$('::', 'ArgumentError'), "" + "Invalid arguments specified for registering " + (kind_name) + " extension: " + (args)) + }; + }; return nil; })(); + if (extension.$config()['$[]']("position")['$=='](">>")) { + + kind_store.$unshift(extension); + } else { + + kind_store['$<<'](extension); + }; + return extension; + }, TMP_Registry_add_document_processor_85.$$arity = 2); + + Opal.def(self, '$add_syntax_processor', TMP_Registry_add_syntax_processor_87 = function $$add_syntax_processor(kind, args) { + var $iter = TMP_Registry_add_syntax_processor_87.$$p, block = $iter || nil, TMP_88, $a, $b, $c, self = this, kind_name = nil, kind_class_symbol = nil, kind_class = nil, kind_java_class = nil, kind_store = nil, name = nil, config = nil, processor = nil, $writer = nil, processor_class = nil, processor_instance = nil; + + if ($iter) TMP_Registry_add_syntax_processor_87.$$p = null; + + + if ($iter) TMP_Registry_add_syntax_processor_87.$$p = null;; + kind_name = kind.$to_s().$tr("_", " "); + kind_class_symbol = $send(kind_name.$split(), 'map', [], (TMP_88 = function(it){var self = TMP_88.$$s || this; + + + + if (it == null) { + it = nil; + }; + return it.$capitalize();}, TMP_88.$$s = self, TMP_88.$$arity = 1, TMP_88)).$push("Processor").$join().$to_sym(); + kind_class = $$($nesting, 'Extensions').$const_get(kind_class_symbol); + kind_java_class = (function() {if ($truthy((($a = $$$('::', 'AsciidoctorJ', 'skip_raise')) ? 'constant' : nil))) { + + return $$$($$$('::', 'AsciidoctorJ'), 'Extensions').$const_get(kind_class_symbol); + } else { + return nil + }; return nil; })(); + kind_store = ($truthy($b = self.$instance_variable_get(((("" + "@") + (kind)) + "_extensions").$to_sym())) ? $b : self.$instance_variable_set(((("" + "@") + (kind)) + "_extensions").$to_sym(), $hash2([], {}))); + if ((block !== nil)) { + + $c = self.$resolve_args(args, 2), $b = Opal.to_ary($c), (name = ($b[0] == null ? nil : $b[0])), (config = ($b[1] == null ? nil : $b[1])), $c; + processor = kind_class.$new(self.$as_symbol(name), config); + if ($truthy(kind_class.$constants().$grep("DSL"))) { + processor.$extend(kind_class.$const_get("DSL"))}; + if (block.$arity()['$=='](1)) { + Opal.yield1(block, processor) + } else { + $send(processor, 'instance_exec', [], block.$to_proc()) + }; + if ($truthy((name = self.$as_symbol(processor.$name())))) { + } else { + self.$raise($$$('::', 'ArgumentError'), "" + "No name specified for " + (kind_name) + " extension at " + (block.$source_location())) + }; + if ($truthy(processor['$process_block_given?']())) { + } else { + self.$raise($$$('::', 'NoMethodError'), "" + "No block specified to process " + (kind_name) + " extension at " + (block.$source_location())) + }; + processor.$freeze(); + + $writer = [name, $$($nesting, 'ProcessorExtension').$new(kind, processor)]; + $send(kind_store, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];; + } else { + + $c = self.$resolve_args(args, 3), $b = Opal.to_ary($c), (processor = ($b[0] == null ? nil : $b[0])), (name = ($b[1] == null ? nil : $b[1])), (config = ($b[2] == null ? nil : $b[2])), $c; + if ($truthy((processor_class = $$($nesting, 'Extensions').$resolve_class(processor)))) { + + if ($truthy(($truthy($b = $rb_lt(processor_class, kind_class)) ? $b : ($truthy($c = kind_java_class) ? $rb_lt(processor_class, kind_java_class) : $c)))) { + } else { + self.$raise($$$('::', 'ArgumentError'), "" + "Class specified for " + (kind_name) + " extension does not inherit from " + (kind_class) + ": " + (processor)) + }; + processor_instance = processor_class.$new(self.$as_symbol(name), config); + if ($truthy((name = self.$as_symbol(processor_instance.$name())))) { + } else { + self.$raise($$$('::', 'ArgumentError'), "" + "No name specified for " + (kind_name) + " extension: " + (processor)) + }; + processor_instance.$freeze(); + + $writer = [name, $$($nesting, 'ProcessorExtension').$new(kind, processor_instance)]; + $send(kind_store, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];; + } else if ($truthy(($truthy($b = kind_class['$==='](processor)) ? $b : ($truthy($c = kind_java_class) ? kind_java_class['$==='](processor) : $c)))) { + + processor.$update_config(config); + if ($truthy((name = (function() {if ($truthy(name)) { + + + $writer = [self.$as_symbol(name)]; + $send(processor, 'name=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];; + } else { + + return self.$as_symbol(processor.$name()); + }; return nil; })()))) { + } else { + self.$raise($$$('::', 'ArgumentError'), "" + "No name specified for " + (kind_name) + " extension: " + (processor)) + }; + processor.$freeze(); + + $writer = [name, $$($nesting, 'ProcessorExtension').$new(kind, processor)]; + $send(kind_store, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];; + } else { + return self.$raise($$$('::', 'ArgumentError'), "" + "Invalid arguments specified for registering " + (kind_name) + " extension: " + (args)) + }; + }; + }, TMP_Registry_add_syntax_processor_87.$$arity = 2); + + Opal.def(self, '$resolve_args', TMP_Registry_resolve_args_89 = function $$resolve_args(args, expect) { + var self = this, opts = nil, missing = nil; + + + opts = (function() {if ($truthy($$$('::', 'Hash')['$==='](args['$[]'](-1)))) { + return args.$pop() + } else { + return $hash2([], {}) + }; return nil; })(); + if (expect['$=='](1)) { + return opts}; + if ($truthy($rb_gt((missing = $rb_minus($rb_minus(expect, 1), args.$size())), 0))) { + args = $rb_plus(args, $$$('::', 'Array').$new(missing)) + } else if ($truthy($rb_lt(missing, 0))) { + args.$pop(missing['$-@']())}; + args['$<<'](opts); + return args; + }, TMP_Registry_resolve_args_89.$$arity = 2); + return (Opal.def(self, '$as_symbol', TMP_Registry_as_symbol_90 = function $$as_symbol(name) { + var self = this; + + if ($truthy(name)) { + return name.$to_sym() + } else { + return nil + } + }, TMP_Registry_as_symbol_90.$$arity = 1), nil) && 'as_symbol'; + })($nesting[0], null, $nesting); + (function(self, $parent_nesting) { + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_generate_name_91, TMP_next_auto_id_92, TMP_groups_93, TMP_create_94, TMP_register_95, TMP_unregister_all_96, TMP_unregister_97, TMP_resolve_class_99, TMP_class_for_name_100, TMP_class_for_name_101, TMP_class_for_name_103; + + + + Opal.def(self, '$generate_name', TMP_generate_name_91 = function $$generate_name() { + var self = this; + + return "" + "extgrp" + (self.$next_auto_id()) + }, TMP_generate_name_91.$$arity = 0); + + Opal.def(self, '$next_auto_id', TMP_next_auto_id_92 = function $$next_auto_id() { + var $a, self = this; + if (self.auto_id == null) self.auto_id = nil; + + + self.auto_id = ($truthy($a = self.auto_id) ? $a : -1); + return (self.auto_id = $rb_plus(self.auto_id, 1)); + }, TMP_next_auto_id_92.$$arity = 0); + + Opal.def(self, '$groups', TMP_groups_93 = function $$groups() { + var $a, self = this; + if (self.groups == null) self.groups = nil; + + return (self.groups = ($truthy($a = self.groups) ? $a : $hash2([], {}))) + }, TMP_groups_93.$$arity = 0); + + Opal.def(self, '$create', TMP_create_94 = function $$create(name) { + var $iter = TMP_create_94.$$p, block = $iter || nil, $a, self = this; + + if ($iter) TMP_create_94.$$p = null; + + + if ($iter) TMP_create_94.$$p = null;; + + if (name == null) { + name = nil; + }; + if ((block !== nil)) { + return $$($nesting, 'Registry').$new($hash(($truthy($a = name) ? $a : self.$generate_name()), block)) + } else { + return $$($nesting, 'Registry').$new() + }; + }, TMP_create_94.$$arity = -1); + Opal.alias(self, "build_registry", "create"); + + Opal.def(self, '$register', TMP_register_95 = function $$register($a) { + var $iter = TMP_register_95.$$p, block = $iter || nil, $post_args, args, $b, self = this, argc = nil, resolved_group = nil, group = nil, name = nil, $writer = nil; + + if ($iter) TMP_register_95.$$p = null; + + + if ($iter) TMP_register_95.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + argc = args.$size(); + if ((block !== nil)) { + resolved_group = block + } else if ($truthy((group = args.$pop()))) { + resolved_group = ($truthy($b = self.$resolve_class(group)) ? $b : group) + } else { + self.$raise($$$('::', 'ArgumentError'), "Extension group to register not specified") + }; + name = ($truthy($b = args.$pop()) ? $b : self.$generate_name()); + if ($truthy(args['$empty?']())) { + } else { + self.$raise($$$('::', 'ArgumentError'), "" + "Wrong number of arguments (" + (argc) + " for 1..2)") + }; + + $writer = [name.$to_sym(), resolved_group]; + $send(self.$groups(), '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];; + }, TMP_register_95.$$arity = -1); + + Opal.def(self, '$unregister_all', TMP_unregister_all_96 = function $$unregister_all() { + var self = this; + + + self.groups = $hash2([], {}); + return nil; + }, TMP_unregister_all_96.$$arity = 0); + + Opal.def(self, '$unregister', TMP_unregister_97 = function $$unregister($a) { + var $post_args, names, TMP_98, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + names = $post_args;; + $send(names, 'each', [], (TMP_98 = function(group){var self = TMP_98.$$s || this; + if (self.groups == null) self.groups = nil; + + + + if (group == null) { + group = nil; + }; + return self.groups.$delete(group.$to_sym());}, TMP_98.$$s = self, TMP_98.$$arity = 1, TMP_98)); + return nil; + }, TMP_unregister_97.$$arity = -1); + + Opal.def(self, '$resolve_class', TMP_resolve_class_99 = function $$resolve_class(object) { + var self = this, $case = nil; + + return (function() {$case = object; + if ($$$('::', 'Class')['$===']($case)) {return object} + else if ($$$('::', 'String')['$===']($case)) {return self.$class_for_name(object)} + else { return nil }})() + }, TMP_resolve_class_99.$$arity = 1); + if ($truthy($$$('::', 'RUBY_MIN_VERSION_2'))) { + return (Opal.def(self, '$class_for_name', TMP_class_for_name_100 = function $$class_for_name(qualified_name) { + var self = this, resolved = nil; + + try { + + resolved = $$$('::', 'Object').$const_get(qualified_name, false); + if ($truthy($$$('::', 'Class')['$==='](resolved))) { + } else { + self.$raise() + }; + return resolved; + } catch ($err) { + if (Opal.rescue($err, [$$($nesting, 'StandardError')])) { + try { + return self.$raise($$$('::', 'NameError'), "" + "Could not resolve class for name: " + (qualified_name)) + } finally { Opal.pop_exception() } + } else { throw $err; } + } + }, TMP_class_for_name_100.$$arity = 1), nil) && 'class_for_name' + } else if ($truthy($$$('::', 'RUBY_MIN_VERSION_1_9'))) { + return (Opal.def(self, '$class_for_name', TMP_class_for_name_101 = function $$class_for_name(qualified_name) { + var TMP_102, self = this, resolved = nil; + + try { + + resolved = $send(qualified_name.$split("::"), 'reduce', [$$$('::', 'Object')], (TMP_102 = function(current, name){var self = TMP_102.$$s || this; + + + + if (current == null) { + current = nil; + }; + + if (name == null) { + name = nil; + }; + if ($truthy(name['$empty?']())) { + return current + } else { + + return current.$const_get(name, false); + };}, TMP_102.$$s = self, TMP_102.$$arity = 2, TMP_102)); + if ($truthy($$$('::', 'Class')['$==='](resolved))) { + } else { + self.$raise() + }; + return resolved; + } catch ($err) { + if (Opal.rescue($err, [$$($nesting, 'StandardError')])) { + try { + return self.$raise($$$('::', 'NameError'), "" + "Could not resolve class for name: " + (qualified_name)) + } finally { Opal.pop_exception() } + } else { throw $err; } + } + }, TMP_class_for_name_101.$$arity = 1), nil) && 'class_for_name' + } else { + return (Opal.def(self, '$class_for_name', TMP_class_for_name_103 = function $$class_for_name(qualified_name) { + var TMP_104, self = this, resolved = nil; + + try { + + resolved = $send(qualified_name.$split("::"), 'reduce', [$$$('::', 'Object')], (TMP_104 = function(current, name){var self = TMP_104.$$s || this; + + + + if (current == null) { + current = nil; + }; + + if (name == null) { + name = nil; + }; + if ($truthy(name['$empty?']())) { + return current + } else { + + if ($truthy(current['$const_defined?'](name))) { + + return current.$const_get(name); + } else { + return self.$raise() + }; + };}, TMP_104.$$s = self, TMP_104.$$arity = 2, TMP_104)); + if ($truthy($$$('::', 'Class')['$==='](resolved))) { + } else { + self.$raise() + }; + return resolved; + } catch ($err) { + if (Opal.rescue($err, [$$($nesting, 'StandardError')])) { + try { + return self.$raise($$$('::', 'NameError'), "" + "Could not resolve class for name: " + (qualified_name)) + } finally { Opal.pop_exception() } + } else { throw $err; } + } + }, TMP_class_for_name_103.$$arity = 1), nil) && 'class_for_name' + }; + })(Opal.get_singleton_class(self), $nesting); + })($nesting[0], $nesting) + })($nesting[0], $nesting); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/js/opal_ext/browser/reader"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $truthy = Opal.truthy; + + Opal.add_stubs(['$posixify', '$new', '$base_dir', '$start_with?', '$uriish?', '$descends_from?', '$key?', '$attributes', '$replace_next_line', '$absolute_path?', '$==', '$empty?', '$!', '$slice', '$length']); + return (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + (function($base, $super, $parent_nesting) { + function $PreprocessorReader(){}; + var self = $PreprocessorReader = $klass($base, $super, 'PreprocessorReader', $PreprocessorReader); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_PreprocessorReader_resolve_include_path_1; + + def.path_resolver = def.document = def.include_stack = def.dir = nil; + return (Opal.def(self, '$resolve_include_path', TMP_PreprocessorReader_resolve_include_path_1 = function $$resolve_include_path(target, attrlist, attributes) { + var $a, self = this, p_target = nil, target_type = nil, base_dir = nil, inc_path = nil, relpath = nil, ctx_dir = nil, top_level = nil, offset = nil; + + + p_target = (self.path_resolver = ($truthy($a = self.path_resolver) ? $a : $$($nesting, 'PathResolver').$new("\\"))).$posixify(target); + $a = ["file", self.document.$base_dir()], (target_type = $a[0]), (base_dir = $a[1]), $a; + if ($truthy(p_target['$start_with?']("file://"))) { + inc_path = (relpath = p_target) + } else if ($truthy($$($nesting, 'Helpers')['$uriish?'](p_target))) { + + if ($truthy(($truthy($a = self.path_resolver['$descends_from?'](p_target, base_dir)) ? $a : self.document.$attributes()['$key?']("allow-uri-read")))) { + } else { + return self.$replace_next_line("" + "link:" + (target) + "[" + (attrlist) + "]") + }; + inc_path = (relpath = p_target); + } else if ($truthy(self.path_resolver['$absolute_path?'](p_target))) { + inc_path = (relpath = "" + "file://" + ((function() {if ($truthy(p_target['$start_with?']("/"))) { + return "" + } else { + return "/" + }; return nil; })()) + (p_target)) + } else if ((ctx_dir = (function() {if ($truthy((top_level = self.include_stack['$empty?']()))) { + return base_dir + } else { + return self.dir + }; return nil; })())['$=='](".")) { + inc_path = (relpath = p_target) + } else if ($truthy(($truthy($a = ctx_dir['$start_with?']("file://")) ? $a : $$($nesting, 'Helpers')['$uriish?'](ctx_dir)['$!']()))) { + + inc_path = "" + (ctx_dir) + "/" + (p_target); + if ($truthy(top_level)) { + relpath = p_target + } else if ($truthy(($truthy($a = base_dir['$=='](".")) ? $a : (offset = self.path_resolver['$descends_from?'](inc_path, base_dir))['$!']()))) { + relpath = inc_path + } else { + relpath = inc_path.$slice(offset, inc_path.$length()) + }; + } else if ($truthy(top_level)) { + inc_path = "" + (ctx_dir) + "/" + ((relpath = p_target)) + } else if ($truthy(($truthy($a = (offset = self.path_resolver['$descends_from?'](ctx_dir, base_dir))) ? $a : self.document.$attributes()['$key?']("allow-uri-read")))) { + + inc_path = "" + (ctx_dir) + "/" + (p_target); + relpath = (function() {if ($truthy(offset)) { + + return inc_path.$slice(offset, inc_path.$length()); + } else { + return p_target + }; return nil; })(); + } else { + return self.$replace_next_line("" + "link:" + (target) + "[" + (attrlist) + "]") + }; + return [inc_path, "file", relpath]; + }, TMP_PreprocessorReader_resolve_include_path_1.$$arity = 3), nil) && 'resolve_include_path' + })($nesting[0], $$($nesting, 'Reader'), $nesting) + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/js/postscript"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice; + + Opal.add_stubs(['$require', '$==']); + + self.$require("asciidoctor/converter/composite"); + self.$require("asciidoctor/converter/html5"); + self.$require("asciidoctor/extensions"); + if ($$($nesting, 'JAVASCRIPT_IO_MODULE')['$==']("xmlhttprequest")) { + return self.$require("asciidoctor/js/opal_ext/browser/reader") + } else { + return nil + }; +}; + +/* Generated by Opal 0.11.99.dev */ +(function(Opal) { + function $rb_ge(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs >= rhs : lhs['$>='](rhs); + } + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + function $rb_lt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); + } + var $a, self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $truthy = Opal.truthy, $gvars = Opal.gvars, $module = Opal.module, $hash2 = Opal.hash2, $send = Opal.send, $hash = Opal.hash; + if ($gvars[":"] == null) $gvars[":"] = nil; + + Opal.add_stubs(['$==', '$>=', '$require', '$unshift', '$dirname', '$each', '$constants', '$const_get', '$downcase', '$to_s', '$[]=', '$-', '$upcase', '$[]', '$values', '$new', '$attr_reader', '$instance_variable_set', '$send', '$<<', '$define', '$expand_path', '$join', '$home', '$pwd', '$!', '$!=', '$default_external', '$to_set', '$map', '$keys', '$slice', '$merge', '$default=', '$to_a', '$escape', '$drop', '$insert', '$dup', '$start', '$logger', '$logger=', '$===', '$split', '$gsub', '$respond_to?', '$raise', '$ancestors', '$class', '$path', '$utc', '$at', '$Integer', '$mtime', '$readlines', '$basename', '$extname', '$index', '$strftime', '$year', '$utc_offset', '$rewind', '$lines', '$each_line', '$record', '$parse', '$exception', '$message', '$set_backtrace', '$backtrace', '$stack_trace', '$stack_trace=', '$open', '$load', '$delete', '$key?', '$attributes', '$outfilesuffix', '$safe', '$normalize_system_path', '$mkdir_p', '$directory?', '$convert', '$write', '$<', '$attr?', '$attr', '$uriish?', '$include?', '$write_primary_stylesheet', '$instance', '$empty?', '$read_asset', '$file?', '$write_coderay_stylesheet', '$write_pygments_stylesheet']); + + if ($truthy((($a = $$($nesting, 'RUBY_ENGINE', 'skip_raise')) ? 'constant' : nil))) { + } else { + Opal.const_set($nesting[0], 'RUBY_ENGINE', "unknown") + }; + Opal.const_set($nesting[0], 'RUBY_ENGINE_OPAL', $$($nesting, 'RUBY_ENGINE')['$==']("opal")); + Opal.const_set($nesting[0], 'RUBY_ENGINE_JRUBY', $$($nesting, 'RUBY_ENGINE')['$==']("jruby")); + Opal.const_set($nesting[0], 'RUBY_MIN_VERSION_1_9', $rb_ge($$($nesting, 'RUBY_VERSION'), "1.9")); + Opal.const_set($nesting[0], 'RUBY_MIN_VERSION_2', $rb_ge($$($nesting, 'RUBY_VERSION'), "2")); + self.$require("set"); + if ($$($nesting, 'RUBY_ENGINE')['$==']("opal")) { + self.$require("asciidoctor/js") + } else { + nil + }; + $gvars[":"].$unshift($$($nesting, 'File').$dirname("asciidoctor.rb")); + self.$require("asciidoctor/logging"); + (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), $a, TMP_Asciidoctor_6, TMP_Asciidoctor_7, TMP_Asciidoctor_8, $writer = nil, quote_subs = nil, compat_quote_subs = nil; + + + Opal.const_set($nesting[0], 'RUBY_ENGINE', $$$('::', 'RUBY_ENGINE')); + (function($base, $parent_nesting) { + function $SafeMode() {}; + var self = $SafeMode = $module($base, 'SafeMode', $SafeMode); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_SafeMode_1, TMP_SafeMode_value_for_name_2, TMP_SafeMode_name_for_value_3, TMP_SafeMode_names_4, rec = nil; + + + Opal.const_set($nesting[0], 'UNSAFE', 0); + Opal.const_set($nesting[0], 'SAFE', 1); + Opal.const_set($nesting[0], 'SERVER', 10); + Opal.const_set($nesting[0], 'SECURE', 20); + rec = $hash2([], {}); + $send((Opal.Module.$$nesting = $nesting, self.$constants()), 'each', [], (TMP_SafeMode_1 = function(sym){var self = TMP_SafeMode_1.$$s || this, $writer = nil; + + + + if (sym == null) { + sym = nil; + }; + $writer = [self.$const_get(sym), sym.$to_s().$downcase()]; + $send(rec, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];}, TMP_SafeMode_1.$$s = self, TMP_SafeMode_1.$$arity = 1, TMP_SafeMode_1)); + self.names_by_value = rec; + Opal.defs(self, '$value_for_name', TMP_SafeMode_value_for_name_2 = function $$value_for_name(name) { + var self = this; + + return self.$const_get(name.$upcase()) + }, TMP_SafeMode_value_for_name_2.$$arity = 1); + Opal.defs(self, '$name_for_value', TMP_SafeMode_name_for_value_3 = function $$name_for_value(value) { + var self = this; + if (self.names_by_value == null) self.names_by_value = nil; + + return self.names_by_value['$[]'](value) + }, TMP_SafeMode_name_for_value_3.$$arity = 1); + Opal.defs(self, '$names', TMP_SafeMode_names_4 = function $$names() { + var self = this; + if (self.names_by_value == null) self.names_by_value = nil; + + return self.names_by_value.$values() + }, TMP_SafeMode_names_4.$$arity = 0); + })($nesting[0], $nesting); + (function($base, $parent_nesting) { + function $Compliance() {}; + var self = $Compliance = $module($base, 'Compliance', $Compliance); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Compliance_define_5; + + + self.keys = $$$('::', 'Set').$new(); + (function(self, $parent_nesting) { + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return self.$attr_reader("keys") + })(Opal.get_singleton_class(self), $nesting); + Opal.defs(self, '$define', TMP_Compliance_define_5 = function $$define(key, value) { + var self = this; + if (self.keys == null) self.keys = nil; + + + self.$instance_variable_set("" + "@" + (key), value); + (function(self, $parent_nesting) { + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return self + })(Opal.get_singleton_class(self), $nesting).$send("attr_accessor", key); + self.keys['$<<'](key); + return nil; + }, TMP_Compliance_define_5.$$arity = 2); + self.$define("block_terminates_paragraph", true); + self.$define("strict_verbatim_paragraphs", true); + self.$define("underline_style_section_titles", true); + self.$define("unwrap_standalone_preamble", true); + self.$define("attribute_missing", "skip"); + self.$define("attribute_undefined", "drop-line"); + self.$define("shorthand_property_syntax", true); + self.$define("natural_xrefs", true); + self.$define("unique_id_start_index", 2); + self.$define("markdown_syntax", true); + })($nesting[0], $nesting); + Opal.const_set($nesting[0], 'ROOT_PATH', $$$('::', 'File').$dirname($$$('::', 'File').$dirname($$$('::', 'File').$expand_path("asciidoctor.rb")))); + Opal.const_set($nesting[0], 'DATA_PATH', $$$('::', 'File').$join($$($nesting, 'ROOT_PATH'), "data")); + + try { + Opal.const_set($nesting[0], 'USER_HOME', $$$('::', 'Dir').$home()) + } catch ($err) { + if (Opal.rescue($err, [$$($nesting, 'StandardError')])) { + try { + Opal.const_set($nesting[0], 'USER_HOME', ($truthy($a = $$$('::', 'ENV')['$[]']("HOME")) ? $a : $$$('::', 'Dir').$pwd())) + } finally { Opal.pop_exception() } + } else { throw $err; } + };; + Opal.const_set($nesting[0], 'COERCE_ENCODING', ($truthy($a = $$$('::', 'RUBY_ENGINE_OPAL')['$!']()) ? $$$('::', 'RUBY_MIN_VERSION_1_9') : $a)); + Opal.const_set($nesting[0], 'FORCE_ENCODING', ($truthy($a = $$($nesting, 'COERCE_ENCODING')) ? $$$('::', 'Encoding').$default_external()['$!=']($$$($$$('::', 'Encoding'), 'UTF_8')) : $a)); + Opal.const_set($nesting[0], 'BOM_BYTES_UTF_8', [239, 187, 191]); + Opal.const_set($nesting[0], 'BOM_BYTES_UTF_16LE', [255, 254]); + Opal.const_set($nesting[0], 'BOM_BYTES_UTF_16BE', [254, 255]); + Opal.const_set($nesting[0], 'FORCE_UNICODE_LINE_LENGTH', $$$('::', 'RUBY_MIN_VERSION_1_9')['$!']()); + Opal.const_set($nesting[0], 'LF', Opal.const_set($nesting[0], 'EOL', "\n")); + Opal.const_set($nesting[0], 'NULL', "\u0000"); + Opal.const_set($nesting[0], 'TAB', "\t"); + Opal.const_set($nesting[0], 'MAX_INT', 9007199254740991); + Opal.const_set($nesting[0], 'DEFAULT_DOCTYPE', "article"); + Opal.const_set($nesting[0], 'DEFAULT_BACKEND', "html5"); + Opal.const_set($nesting[0], 'DEFAULT_STYLESHEET_KEYS', ["", "DEFAULT"].$to_set()); + Opal.const_set($nesting[0], 'DEFAULT_STYLESHEET_NAME', "asciidoctor.css"); + Opal.const_set($nesting[0], 'BACKEND_ALIASES', $hash2(["html", "docbook"], {"html": "html5", "docbook": "docbook5"})); + Opal.const_set($nesting[0], 'DEFAULT_PAGE_WIDTHS', $hash2(["docbook"], {"docbook": 425})); + Opal.const_set($nesting[0], 'DEFAULT_EXTENSIONS', $hash2(["html", "docbook", "pdf", "epub", "manpage", "asciidoc"], {"html": ".html", "docbook": ".xml", "pdf": ".pdf", "epub": ".epub", "manpage": ".man", "asciidoc": ".adoc"})); + Opal.const_set($nesting[0], 'ASCIIDOC_EXTENSIONS', $hash2([".adoc", ".asciidoc", ".asc", ".ad", ".txt"], {".adoc": true, ".asciidoc": true, ".asc": true, ".ad": true, ".txt": true})); + Opal.const_set($nesting[0], 'SETEXT_SECTION_LEVELS', $hash2(["=", "-", "~", "^", "+"], {"=": 0, "-": 1, "~": 2, "^": 3, "+": 4})); + Opal.const_set($nesting[0], 'ADMONITION_STYLES', ["NOTE", "TIP", "IMPORTANT", "WARNING", "CAUTION"].$to_set()); + Opal.const_set($nesting[0], 'ADMONITION_STYLE_HEADS', ["N", "T", "I", "W", "C"].$to_set()); + Opal.const_set($nesting[0], 'PARAGRAPH_STYLES', ["comment", "example", "literal", "listing", "normal", "open", "pass", "quote", "sidebar", "source", "verse", "abstract", "partintro"].$to_set()); + Opal.const_set($nesting[0], 'VERBATIM_STYLES', ["literal", "listing", "source", "verse"].$to_set()); + Opal.const_set($nesting[0], 'DELIMITED_BLOCKS', $hash2(["--", "----", "....", "====", "****", "____", "\"\"", "++++", "|===", ",===", ":===", "!===", "////", "```"], {"--": ["open", ["comment", "example", "literal", "listing", "pass", "quote", "sidebar", "source", "verse", "admonition", "abstract", "partintro"].$to_set()], "----": ["listing", ["literal", "source"].$to_set()], "....": ["literal", ["listing", "source"].$to_set()], "====": ["example", ["admonition"].$to_set()], "****": ["sidebar", $$$('::', 'Set').$new()], "____": ["quote", ["verse"].$to_set()], "\"\"": ["quote", ["verse"].$to_set()], "++++": ["pass", ["stem", "latexmath", "asciimath"].$to_set()], "|===": ["table", $$$('::', 'Set').$new()], ",===": ["table", $$$('::', 'Set').$new()], ":===": ["table", $$$('::', 'Set').$new()], "!===": ["table", $$$('::', 'Set').$new()], "////": ["comment", $$$('::', 'Set').$new()], "```": ["fenced_code", $$$('::', 'Set').$new()]})); + Opal.const_set($nesting[0], 'DELIMITED_BLOCK_HEADS', $send($$($nesting, 'DELIMITED_BLOCKS').$keys(), 'map', [], (TMP_Asciidoctor_6 = function(key){var self = TMP_Asciidoctor_6.$$s || this; + + + + if (key == null) { + key = nil; + }; + return key.$slice(0, 2);}, TMP_Asciidoctor_6.$$s = self, TMP_Asciidoctor_6.$$arity = 1, TMP_Asciidoctor_6)).$to_set()); + Opal.const_set($nesting[0], 'LAYOUT_BREAK_CHARS', $hash2(["'", "<"], {"'": "thematic_break", "<": "page_break"})); + Opal.const_set($nesting[0], 'MARKDOWN_THEMATIC_BREAK_CHARS', $hash2(["-", "*", "_"], {"-": "thematic_break", "*": "thematic_break", "_": "thematic_break"})); + Opal.const_set($nesting[0], 'HYBRID_LAYOUT_BREAK_CHARS', $$($nesting, 'LAYOUT_BREAK_CHARS').$merge($$($nesting, 'MARKDOWN_THEMATIC_BREAK_CHARS'))); + Opal.const_set($nesting[0], 'NESTABLE_LIST_CONTEXTS', ["ulist", "olist", "dlist"]); + Opal.const_set($nesting[0], 'ORDERED_LIST_STYLES', ["arabic", "loweralpha", "lowerroman", "upperalpha", "upperroman"]); + Opal.const_set($nesting[0], 'ORDERED_LIST_KEYWORDS', $hash2(["loweralpha", "lowerroman", "upperalpha", "upperroman"], {"loweralpha": "a", "lowerroman": "i", "upperalpha": "A", "upperroman": "I"})); + Opal.const_set($nesting[0], 'ATTR_REF_HEAD', "{"); + Opal.const_set($nesting[0], 'LIST_CONTINUATION', "+"); + Opal.const_set($nesting[0], 'HARD_LINE_BREAK', " +"); + Opal.const_set($nesting[0], 'LINE_CONTINUATION', " \\"); + Opal.const_set($nesting[0], 'LINE_CONTINUATION_LEGACY', " +"); + Opal.const_set($nesting[0], 'MATHJAX_VERSION', "2.7.4"); + Opal.const_set($nesting[0], 'BLOCK_MATH_DELIMITERS', $hash2(["asciimath", "latexmath"], {"asciimath": ["\\$", "\\$"], "latexmath": ["\\[", "\\]"]})); + Opal.const_set($nesting[0], 'INLINE_MATH_DELIMITERS', $hash2(["asciimath", "latexmath"], {"asciimath": ["\\$", "\\$"], "latexmath": ["\\(", "\\)"]})); + + $writer = ["asciimath"]; + $send(Opal.const_set($nesting[0], 'STEM_TYPE_ALIASES', $hash2(["latexmath", "latex", "tex"], {"latexmath": "latexmath", "latex": "latexmath", "tex": "latexmath"})), 'default=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + Opal.const_set($nesting[0], 'FONT_AWESOME_VERSION', "4.7.0"); + Opal.const_set($nesting[0], 'FLEXIBLE_ATTRIBUTES', ["sectnums"]); + if ($$($nesting, 'RUBY_ENGINE')['$==']("opal")) { + if ($truthy((($a = $$($nesting, 'CC_ANY', 'skip_raise')) ? 'constant' : nil))) { + } else { + Opal.const_set($nesting[0], 'CC_ANY', "[^\\n]") + } + } else { + nil + }; + Opal.const_set($nesting[0], 'AuthorInfoLineRx', new RegExp("" + "^(" + ($$($nesting, 'CG_WORD')) + "[" + ($$($nesting, 'CC_WORD')) + "\\-'.]*)(?: +(" + ($$($nesting, 'CG_WORD')) + "[" + ($$($nesting, 'CC_WORD')) + "\\-'.]*))?(?: +(" + ($$($nesting, 'CG_WORD')) + "[" + ($$($nesting, 'CC_WORD')) + "\\-'.]*))?(?: +<([^>]+)>)?$")); + Opal.const_set($nesting[0], 'RevisionInfoLineRx', new RegExp("" + "^(?:[^\\d{]*(" + ($$($nesting, 'CC_ANY')) + "*?),)? *(?!:)(" + ($$($nesting, 'CC_ANY')) + "*?)(?: *(?!^),?: *(" + ($$($nesting, 'CC_ANY')) + "*))?$")); + Opal.const_set($nesting[0], 'ManpageTitleVolnumRx', new RegExp("" + "^(" + ($$($nesting, 'CC_ANY')) + "+?) *\\( *(" + ($$($nesting, 'CC_ANY')) + "+?) *\\)$")); + Opal.const_set($nesting[0], 'ManpageNamePurposeRx', new RegExp("" + "^(" + ($$($nesting, 'CC_ANY')) + "+?) +- +(" + ($$($nesting, 'CC_ANY')) + "+)$")); + Opal.const_set($nesting[0], 'ConditionalDirectiveRx', new RegExp("" + "^(\\\\)?(ifdef|ifndef|ifeval|endif)::(\\S*?(?:([,+])\\S*?)?)\\[(" + ($$($nesting, 'CC_ANY')) + "+)?\\]$")); + Opal.const_set($nesting[0], 'EvalExpressionRx', new RegExp("" + "^(" + ($$($nesting, 'CC_ANY')) + "+?) *([=!><]=|[><]) *(" + ($$($nesting, 'CC_ANY')) + "+)$")); + Opal.const_set($nesting[0], 'IncludeDirectiveRx', new RegExp("" + "^(\\\\)?include::([^\\[][^\\[]*)\\[(" + ($$($nesting, 'CC_ANY')) + "+)?\\]$")); + Opal.const_set($nesting[0], 'TagDirectiveRx', /\b(?:tag|(e)nd)::(\S+?)\[\](?=$|[ \r])/m); + Opal.const_set($nesting[0], 'AttributeEntryRx', new RegExp("" + "^:(!?" + ($$($nesting, 'CG_WORD')) + "[^:]*):(?:[ \\t]+(" + ($$($nesting, 'CC_ANY')) + "*))?$")); + Opal.const_set($nesting[0], 'InvalidAttributeNameCharsRx', new RegExp("" + "[^-" + ($$($nesting, 'CC_WORD')) + "]")); + if ($$($nesting, 'RUBY_ENGINE')['$==']("opal")) { + Opal.const_set($nesting[0], 'AttributeEntryPassMacroRx', /^pass:([a-z]+(?:,[a-z]+)*)?\[([\S\s]*)\]$/) + } else { + nil + }; + Opal.const_set($nesting[0], 'AttributeReferenceRx', new RegExp("" + "(\\\\)?\\{(" + ($$($nesting, 'CG_WORD')) + "[-" + ($$($nesting, 'CC_WORD')) + "]*|(set|counter2?):" + ($$($nesting, 'CC_ANY')) + "+?)(\\\\)?\\}")); + Opal.const_set($nesting[0], 'BlockAnchorRx', new RegExp("" + "^\\[\\[(?:|([" + ($$($nesting, 'CC_ALPHA')) + "_:][" + ($$($nesting, 'CC_WORD')) + ":.-]*)(?:, *(" + ($$($nesting, 'CC_ANY')) + "+))?)\\]\\]$")); + Opal.const_set($nesting[0], 'BlockAttributeListRx', new RegExp("" + "^\\[(|[" + ($$($nesting, 'CC_WORD')) + ".#%{,\"']" + ($$($nesting, 'CC_ANY')) + "*)\\]$")); + Opal.const_set($nesting[0], 'BlockAttributeLineRx', new RegExp("" + "^\\[(?:|[" + ($$($nesting, 'CC_WORD')) + ".#%{,\"']" + ($$($nesting, 'CC_ANY')) + "*|\\[(?:|[" + ($$($nesting, 'CC_ALPHA')) + "_:][" + ($$($nesting, 'CC_WORD')) + ":.-]*(?:, *" + ($$($nesting, 'CC_ANY')) + "+)?)\\])\\]$")); + Opal.const_set($nesting[0], 'BlockTitleRx', new RegExp("" + "^\\.(\\.?[^ \\t.]" + ($$($nesting, 'CC_ANY')) + "*)$")); + Opal.const_set($nesting[0], 'AdmonitionParagraphRx', new RegExp("" + "^(" + ($$($nesting, 'ADMONITION_STYLES').$to_a().$join("|")) + "):[ \\t]+")); + Opal.const_set($nesting[0], 'LiteralParagraphRx', new RegExp("" + "^([ \\t]+" + ($$($nesting, 'CC_ANY')) + "*)$")); + Opal.const_set($nesting[0], 'AtxSectionTitleRx', new RegExp("" + "^(=={0,5})[ \\t]+(" + ($$($nesting, 'CC_ANY')) + "+?)(?:[ \\t]+\\1)?$")); + Opal.const_set($nesting[0], 'ExtAtxSectionTitleRx', new RegExp("" + "^(=={0,5}|#\\\#{0,5})[ \\t]+(" + ($$($nesting, 'CC_ANY')) + "+?)(?:[ \\t]+\\1)?$")); + Opal.const_set($nesting[0], 'SetextSectionTitleRx', new RegExp("" + "^((?!\\.)" + ($$($nesting, 'CC_ANY')) + "*?" + ($$($nesting, 'CG_WORD')) + ($$($nesting, 'CC_ANY')) + "*)$")); + Opal.const_set($nesting[0], 'InlineSectionAnchorRx', new RegExp("" + " (\\\\)?\\[\\[([" + ($$($nesting, 'CC_ALPHA')) + "_:][" + ($$($nesting, 'CC_WORD')) + ":.-]*)(?:, *(" + ($$($nesting, 'CC_ANY')) + "+))?\\]\\]$")); + Opal.const_set($nesting[0], 'InvalidSectionIdCharsRx', new RegExp("" + "<[^>]+>|&(?:[a-z][a-z]+\\d{0,2}|#\\d\\d\\d{0,4}|#x[\\da-f][\\da-f][\\da-f]{0,3});|[^ " + ($$($nesting, 'CC_WORD')) + "\\-.]+?")); + Opal.const_set($nesting[0], 'AnyListRx', new RegExp("" + "^(?:[ \\t]*(?:-|\\*\\**|\\.\\.*|\\u2022|\\d+\\.|[a-zA-Z]\\.|[IVXivx]+\\))[ \\t]|(?!//[^/])" + ($$($nesting, 'CC_ANY')) + "*?(?::::{0,2}|;;)(?:$|[ \\t])|[ \\t])")); + Opal.const_set($nesting[0], 'UnorderedListRx', new RegExp("" + "^[ \\t]*(-|\\*\\**|\\u2022)[ \\t]+(" + ($$($nesting, 'CC_ANY')) + "*)$")); + Opal.const_set($nesting[0], 'OrderedListRx', new RegExp("" + "^[ \\t]*(\\.\\.*|\\d+\\.|[a-zA-Z]\\.|[IVXivx]+\\))[ \\t]+(" + ($$($nesting, 'CC_ANY')) + "*)$")); + Opal.const_set($nesting[0], 'OrderedListMarkerRxMap', $hash2(["arabic", "loweralpha", "lowerroman", "upperalpha", "upperroman"], {"arabic": /\d+\./, "loweralpha": /[a-z]\./, "lowerroman": /[ivx]+\)/, "upperalpha": /[A-Z]\./, "upperroman": /[IVX]+\)/})); + Opal.const_set($nesting[0], 'DescriptionListRx', new RegExp("" + "^(?!//[^/])[ \\t]*(" + ($$($nesting, 'CC_ANY')) + "*?)(:::{0,2}|;;)(?:$|[ \\t]+(" + ($$($nesting, 'CC_ANY')) + "*)$)")); + Opal.const_set($nesting[0], 'DescriptionListSiblingRx', $hash2(["::", ":::", "::::", ";;"], {"::": new RegExp("" + "^(?!//[^/])[ \\t]*(" + ($$($nesting, 'CC_ANY')) + "*[^:]|)(::)(?:$|[ \\t]+(" + ($$($nesting, 'CC_ANY')) + "*)$)"), ":::": new RegExp("" + "^(?!//[^/])[ \\t]*(" + ($$($nesting, 'CC_ANY')) + "*[^:]|)(:::)(?:$|[ \\t]+(" + ($$($nesting, 'CC_ANY')) + "*)$)"), "::::": new RegExp("" + "^(?!//[^/])[ \\t]*(" + ($$($nesting, 'CC_ANY')) + "*[^:]|)(::::)(?:$|[ \\t]+(" + ($$($nesting, 'CC_ANY')) + "*)$)"), ";;": new RegExp("" + "^(?!//[^/])[ \\t]*(" + ($$($nesting, 'CC_ANY')) + "*?)(;;)(?:$|[ \\t]+(" + ($$($nesting, 'CC_ANY')) + "*)$)")})); + Opal.const_set($nesting[0], 'CalloutListRx', new RegExp("" + "^<(\\d+|\\.)>[ \\t]+(" + ($$($nesting, 'CC_ANY')) + "*)$")); + Opal.const_set($nesting[0], 'CalloutExtractRx', /((?:\/\/|#|--|;;) ?)?(\\)?(?=(?: ?\\?)*$)/); + Opal.const_set($nesting[0], 'CalloutExtractRxt', "(\\\\)?<()(\\d+|\\.)>(?=(?: ?\\\\?<(?:\\d+|\\.)>)*$)"); + Opal.const_set($nesting[0], 'CalloutExtractRxMap', $send($$$('::', 'Hash'), 'new', [], (TMP_Asciidoctor_7 = function(h, k){var self = TMP_Asciidoctor_7.$$s || this; + + + + if (h == null) { + h = nil; + }; + + if (k == null) { + k = nil; + }; + $writer = [k, new RegExp("" + "(" + ($$$('::', 'Regexp').$escape(k)) + " ?)?" + ($$($nesting, 'CalloutExtractRxt')))]; + $send(h, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];}, TMP_Asciidoctor_7.$$s = self, TMP_Asciidoctor_7.$$arity = 2, TMP_Asciidoctor_7))); + Opal.const_set($nesting[0], 'CalloutScanRx', new RegExp("" + "\\\\?(?=(?: ?\\\\?)*" + ($$($nesting, 'CC_EOL')) + ")")); + Opal.const_set($nesting[0], 'CalloutSourceRx', new RegExp("" + "((?://|#|--|;;) ?)?(\\\\)?<!?(|--)(\\d+|\\.)\\3>(?=(?: ?\\\\?<!?\\3(?:\\d+|\\.)\\3>)*" + ($$($nesting, 'CC_EOL')) + ")")); + Opal.const_set($nesting[0], 'CalloutSourceRxt', "" + "(\\\\)?<()(\\d+|\\.)>(?=(?: ?\\\\?<(?:\\d+|\\.)>)*" + ($$($nesting, 'CC_EOL')) + ")"); + Opal.const_set($nesting[0], 'CalloutSourceRxMap', $send($$$('::', 'Hash'), 'new', [], (TMP_Asciidoctor_8 = function(h, k){var self = TMP_Asciidoctor_8.$$s || this; + + + + if (h == null) { + h = nil; + }; + + if (k == null) { + k = nil; + }; + $writer = [k, new RegExp("" + "(" + ($$$('::', 'Regexp').$escape(k)) + " ?)?" + ($$($nesting, 'CalloutSourceRxt')))]; + $send(h, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];}, TMP_Asciidoctor_8.$$s = self, TMP_Asciidoctor_8.$$arity = 2, TMP_Asciidoctor_8))); + Opal.const_set($nesting[0], 'ListRxMap', $hash2(["ulist", "olist", "dlist", "colist"], {"ulist": $$($nesting, 'UnorderedListRx'), "olist": $$($nesting, 'OrderedListRx'), "dlist": $$($nesting, 'DescriptionListRx'), "colist": $$($nesting, 'CalloutListRx')})); + Opal.const_set($nesting[0], 'ColumnSpecRx', /^(?:(\d+)\*)?([<^>](?:\.[<^>]?)?|(?:[<^>]?\.)?[<^>])?(\d+%?|~)?([a-z])?$/); + Opal.const_set($nesting[0], 'CellSpecStartRx', /^[ \t]*(?:(\d+(?:\.\d*)?|(?:\d*\.)?\d+)([*+]))?([<^>](?:\.[<^>]?)?|(?:[<^>]?\.)?[<^>])?([a-z])?$/); + Opal.const_set($nesting[0], 'CellSpecEndRx', /[ \t]+(?:(\d+(?:\.\d*)?|(?:\d*\.)?\d+)([*+]))?([<^>](?:\.[<^>]?)?|(?:[<^>]?\.)?[<^>])?([a-z])?$/); + Opal.const_set($nesting[0], 'CustomBlockMacroRx', new RegExp("" + "^(" + ($$($nesting, 'CG_WORD')) + "[-" + ($$($nesting, 'CC_WORD')) + "]*)::(|\\S|\\S" + ($$($nesting, 'CC_ANY')) + "*?\\S)\\[(" + ($$($nesting, 'CC_ANY')) + "+)?\\]$")); + Opal.const_set($nesting[0], 'BlockMediaMacroRx', new RegExp("" + "^(image|video|audio)::(\\S|\\S" + ($$($nesting, 'CC_ANY')) + "*?\\S)\\[(" + ($$($nesting, 'CC_ANY')) + "+)?\\]$")); + Opal.const_set($nesting[0], 'BlockTocMacroRx', new RegExp("" + "^toc::\\[(" + ($$($nesting, 'CC_ANY')) + "+)?\\]$")); + Opal.const_set($nesting[0], 'InlineAnchorRx', new RegExp("" + "(\\\\)?(?:\\[\\[([" + ($$($nesting, 'CC_ALPHA')) + "_:][" + ($$($nesting, 'CC_WORD')) + ":.-]*)(?:, *(" + ($$($nesting, 'CC_ANY')) + "+?))?\\]\\]|anchor:([" + ($$($nesting, 'CC_ALPHA')) + "_:][" + ($$($nesting, 'CC_WORD')) + ":.-]*)\\[(?:\\]|(" + ($$($nesting, 'CC_ANY')) + "*?[^\\\\])\\]))")); + Opal.const_set($nesting[0], 'InlineAnchorScanRx', new RegExp("" + "(?:^|[^\\\\\\[])\\[\\[([" + ($$($nesting, 'CC_ALPHA')) + "_:][" + ($$($nesting, 'CC_WORD')) + ":.-]*)(?:, *(" + ($$($nesting, 'CC_ANY')) + "+?))?\\]\\]|(?:^|[^\\\\])anchor:([" + ($$($nesting, 'CC_ALPHA')) + "_:][" + ($$($nesting, 'CC_WORD')) + ":.-]*)\\[(?:\\]|(" + ($$($nesting, 'CC_ANY')) + "*?[^\\\\])\\])")); + Opal.const_set($nesting[0], 'LeadingInlineAnchorRx', new RegExp("" + "^\\[\\[([" + ($$($nesting, 'CC_ALPHA')) + "_:][" + ($$($nesting, 'CC_WORD')) + ":.-]*)(?:, *(" + ($$($nesting, 'CC_ANY')) + "+?))?\\]\\]")); + Opal.const_set($nesting[0], 'InlineBiblioAnchorRx', new RegExp("" + "^\\[\\[\\[([" + ($$($nesting, 'CC_ALPHA')) + "_:][" + ($$($nesting, 'CC_WORD')) + ":.-]*)(?:, *(" + ($$($nesting, 'CC_ANY')) + "+?))?\\]\\]\\]")); + Opal.const_set($nesting[0], 'InlineEmailRx', new RegExp("" + "([\\\\>:/])?" + ($$($nesting, 'CG_WORD')) + "[" + ($$($nesting, 'CC_WORD')) + ".%+-]*@" + ($$($nesting, 'CG_ALNUM')) + "[" + ($$($nesting, 'CC_ALNUM')) + ".-]*\\." + ($$($nesting, 'CG_ALPHA')) + "{2,4}\\b")); + Opal.const_set($nesting[0], 'InlineFootnoteMacroRx', new RegExp("" + "\\\\?footnote(?:(ref):|:([\\w-]+)?)\\[(?:|(" + ($$($nesting, 'CC_ALL')) + "*?[^\\\\]))\\]", 'm')); + Opal.const_set($nesting[0], 'InlineImageMacroRx', new RegExp("" + "\\\\?i(?:mage|con):([^:\\s\\[](?:[^\\n\\[]*[^\\s\\[])?)\\[(|" + ($$($nesting, 'CC_ALL')) + "*?[^\\\\])\\]", 'm')); + Opal.const_set($nesting[0], 'InlineIndextermMacroRx', new RegExp("" + "\\\\?(?:(indexterm2?):\\[(" + ($$($nesting, 'CC_ALL')) + "*?[^\\\\])\\]|\\(\\((" + ($$($nesting, 'CC_ALL')) + "+?)\\)\\)(?!\\)))", 'm')); + Opal.const_set($nesting[0], 'InlineKbdBtnMacroRx', new RegExp("" + "(\\\\)?(kbd|btn):\\[(" + ($$($nesting, 'CC_ALL')) + "*?[^\\\\])\\]", 'm')); + Opal.const_set($nesting[0], 'InlineLinkRx', new RegExp("" + "(^|link:|" + ($$($nesting, 'CG_BLANK')) + "|<|[>\\(\\)\\[\\];])(\\\\?(?:https?|file|ftp|irc)://[^\\s\\[\\]<]*[^\\s.,\\[\\]<])(?:\\[(|" + ($$($nesting, 'CC_ALL')) + "*?[^\\\\])\\])?", 'm')); + Opal.const_set($nesting[0], 'InlineLinkMacroRx', new RegExp("" + "\\\\?(?:link|(mailto)):(|[^:\\s\\[][^\\s\\[]*)\\[(|" + ($$($nesting, 'CC_ALL')) + "*?[^\\\\])\\]", 'm')); + Opal.const_set($nesting[0], 'MacroNameRx', new RegExp("" + "^" + ($$($nesting, 'CG_WORD')) + "[-" + ($$($nesting, 'CC_WORD')) + "]*$")); + Opal.const_set($nesting[0], 'InlineStemMacroRx', new RegExp("" + "\\\\?(stem|(?:latex|ascii)math):([a-z]+(?:,[a-z]+)*)?\\[(" + ($$($nesting, 'CC_ALL')) + "*?[^\\\\])\\]", 'm')); + Opal.const_set($nesting[0], 'InlineMenuMacroRx', new RegExp("" + "\\\\?menu:(" + ($$($nesting, 'CG_WORD')) + "|[" + ($$($nesting, 'CC_WORD')) + "&][^\\n\\[]*[^\\s\\[])\\[ *(" + ($$($nesting, 'CC_ALL')) + "*?[^\\\\])?\\]", 'm')); + Opal.const_set($nesting[0], 'InlineMenuRx', new RegExp("" + "\\\\?\"([" + ($$($nesting, 'CC_WORD')) + "&][^\"]*?[ \\n]+>[ \\n]+[^\"]*)\"")); + Opal.const_set($nesting[0], 'InlinePassRx', $hash(false, ["+", "`", new RegExp("" + "(^|[^" + ($$($nesting, 'CC_WORD')) + ";:])(?:\\[([^\\]]+)\\])?(\\\\?(\\+|`)(\\S|\\S" + ($$($nesting, 'CC_ALL')) + "*?\\S)\\4)(?!" + ($$($nesting, 'CG_WORD')) + ")", 'm')], true, ["`", nil, new RegExp("" + "(^|[^`" + ($$($nesting, 'CC_WORD')) + "])(?:\\[([^\\]]+)\\])?(\\\\?(`)([^`\\s]|[^`\\s]" + ($$($nesting, 'CC_ALL')) + "*?\\S)\\4)(?![`" + ($$($nesting, 'CC_WORD')) + "])", 'm')])); + Opal.const_set($nesting[0], 'SinglePlusInlinePassRx', new RegExp("" + "^(\\\\)?\\+(\\S|\\S" + ($$($nesting, 'CC_ALL')) + "*?\\S)\\+$", 'm')); + Opal.const_set($nesting[0], 'InlinePassMacroRx', new RegExp("" + "(?:(?:(\\\\?)\\[([^\\]]+)\\])?(\\\\{0,2})(\\+\\+\\+?|\\$\\$)(" + ($$($nesting, 'CC_ALL')) + "*?)\\4|(\\\\?)pass:([a-z]+(?:,[a-z]+)*)?\\[(|" + ($$($nesting, 'CC_ALL')) + "*?[^\\\\])\\])", 'm')); + Opal.const_set($nesting[0], 'InlineXrefMacroRx', new RegExp("" + "\\\\?(?:<<([" + ($$($nesting, 'CC_WORD')) + "#/.:{]" + ($$($nesting, 'CC_ALL')) + "*?)>>|xref:([" + ($$($nesting, 'CC_WORD')) + "#/.:{]" + ($$($nesting, 'CC_ALL')) + "*?)\\[(?:\\]|(" + ($$($nesting, 'CC_ALL')) + "*?[^\\\\])\\]))", 'm')); + if ($$($nesting, 'RUBY_ENGINE')['$==']("opal")) { + Opal.const_set($nesting[0], 'HardLineBreakRx', new RegExp("" + "^(" + ($$($nesting, 'CC_ANY')) + "*) \\+$", 'm')) + } else { + nil + }; + Opal.const_set($nesting[0], 'MarkdownThematicBreakRx', /^ {0,3}([-*_])( *)\1\2\1$/); + Opal.const_set($nesting[0], 'ExtLayoutBreakRx', /^(?:'{3,}|<{3,}|([-*_])( *)\1\2\1)$/); + Opal.const_set($nesting[0], 'BlankLineRx', /\n{2,}/); + Opal.const_set($nesting[0], 'EscapedSpaceRx', /\\([ \t\n])/); + Opal.const_set($nesting[0], 'ReplaceableTextRx', /[&']|--|\.\.\.|\([CRT]M?\)/); + Opal.const_set($nesting[0], 'SpaceDelimiterRx', /([^\\])[ \t\n]+/); + Opal.const_set($nesting[0], 'SubModifierSniffRx', /[+-]/); + Opal.const_set($nesting[0], 'TrailingDigitsRx', /\d+$/); + if ($$($nesting, 'RUBY_ENGINE')['$==']("opal")) { + } else { + nil + }; + Opal.const_set($nesting[0], 'UriSniffRx', new RegExp("" + "^" + ($$($nesting, 'CG_ALPHA')) + "[" + ($$($nesting, 'CC_ALNUM')) + ".+-]+:/{0,2}")); + Opal.const_set($nesting[0], 'UriTerminatorRx', /[);:]$/); + Opal.const_set($nesting[0], 'XmlSanitizeRx', /<[^>]+>/); + Opal.const_set($nesting[0], 'INTRINSIC_ATTRIBUTES', $hash2(["startsb", "endsb", "vbar", "caret", "asterisk", "tilde", "plus", "backslash", "backtick", "blank", "empty", "sp", "two-colons", "two-semicolons", "nbsp", "deg", "zwsp", "quot", "apos", "lsquo", "rsquo", "ldquo", "rdquo", "wj", "brvbar", "pp", "cpp", "amp", "lt", "gt"], {"startsb": "[", "endsb": "]", "vbar": "|", "caret": "^", "asterisk": "*", "tilde": "~", "plus": "+", "backslash": "\\", "backtick": "`", "blank": "", "empty": "", "sp": " ", "two-colons": "::", "two-semicolons": ";;", "nbsp": " ", "deg": "°", "zwsp": "​", "quot": """, "apos": "'", "lsquo": "‘", "rsquo": "’", "ldquo": "“", "rdquo": "”", "wj": "⁠", "brvbar": "¦", "pp": "++", "cpp": "C++", "amp": "&", "lt": "<", "gt": ">"})); + quote_subs = [["strong", "unconstrained", new RegExp("" + "\\\\?(?:\\[([^\\]]+)\\])?\\*\\*(" + ($$($nesting, 'CC_ALL')) + "+?)\\*\\*", 'm')], ["strong", "constrained", new RegExp("" + "(^|[^" + ($$($nesting, 'CC_WORD')) + ";:}])(?:\\[([^\\]]+)\\])?\\*(\\S|\\S" + ($$($nesting, 'CC_ALL')) + "*?\\S)\\*(?!" + ($$($nesting, 'CG_WORD')) + ")", 'm')], ["double", "constrained", new RegExp("" + "(^|[^" + ($$($nesting, 'CC_WORD')) + ";:}])(?:\\[([^\\]]+)\\])?\"`(\\S|\\S" + ($$($nesting, 'CC_ALL')) + "*?\\S)`\"(?!" + ($$($nesting, 'CG_WORD')) + ")", 'm')], ["single", "constrained", new RegExp("" + "(^|[^" + ($$($nesting, 'CC_WORD')) + ";:`}])(?:\\[([^\\]]+)\\])?'`(\\S|\\S" + ($$($nesting, 'CC_ALL')) + "*?\\S)`'(?!" + ($$($nesting, 'CG_WORD')) + ")", 'm')], ["monospaced", "unconstrained", new RegExp("" + "\\\\?(?:\\[([^\\]]+)\\])?``(" + ($$($nesting, 'CC_ALL')) + "+?)``", 'm')], ["monospaced", "constrained", new RegExp("" + "(^|[^" + ($$($nesting, 'CC_WORD')) + ";:\"'`}])(?:\\[([^\\]]+)\\])?`(\\S|\\S" + ($$($nesting, 'CC_ALL')) + "*?\\S)`(?![" + ($$($nesting, 'CC_WORD')) + "\"'`])", 'm')], ["emphasis", "unconstrained", new RegExp("" + "\\\\?(?:\\[([^\\]]+)\\])?__(" + ($$($nesting, 'CC_ALL')) + "+?)__", 'm')], ["emphasis", "constrained", new RegExp("" + "(^|[^" + ($$($nesting, 'CC_WORD')) + ";:}])(?:\\[([^\\]]+)\\])?_(\\S|\\S" + ($$($nesting, 'CC_ALL')) + "*?\\S)_(?!" + ($$($nesting, 'CG_WORD')) + ")", 'm')], ["mark", "unconstrained", new RegExp("" + "\\\\?(?:\\[([^\\]]+)\\])?##(" + ($$($nesting, 'CC_ALL')) + "+?)##", 'm')], ["mark", "constrained", new RegExp("" + "(^|[^" + ($$($nesting, 'CC_WORD')) + "&;:}])(?:\\[([^\\]]+)\\])?#(\\S|\\S" + ($$($nesting, 'CC_ALL')) + "*?\\S)#(?!" + ($$($nesting, 'CG_WORD')) + ")", 'm')], ["superscript", "unconstrained", /\\?(?:\[([^\]]+)\])?\^(\S+?)\^/], ["subscript", "unconstrained", /\\?(?:\[([^\]]+)\])?~(\S+?)~/]]; + compat_quote_subs = quote_subs.$drop(0); + + $writer = [2, ["double", "constrained", new RegExp("" + "(^|[^" + ($$($nesting, 'CC_WORD')) + ";:}])(?:\\[([^\\]]+)\\])?``(\\S|\\S" + ($$($nesting, 'CC_ALL')) + "*?\\S)''(?!" + ($$($nesting, 'CG_WORD')) + ")", 'm')]]; + $send(compat_quote_subs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = [3, ["single", "constrained", new RegExp("" + "(^|[^" + ($$($nesting, 'CC_WORD')) + ";:}])(?:\\[([^\\]]+)\\])?`(\\S|\\S" + ($$($nesting, 'CC_ALL')) + "*?\\S)'(?!" + ($$($nesting, 'CG_WORD')) + ")", 'm')]]; + $send(compat_quote_subs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = [4, ["monospaced", "unconstrained", new RegExp("" + "\\\\?(?:\\[([^\\]]+)\\])?\\+\\+(" + ($$($nesting, 'CC_ALL')) + "+?)\\+\\+", 'm')]]; + $send(compat_quote_subs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = [5, ["monospaced", "constrained", new RegExp("" + "(^|[^" + ($$($nesting, 'CC_WORD')) + ";:}])(?:\\[([^\\]]+)\\])?\\+(\\S|\\S" + ($$($nesting, 'CC_ALL')) + "*?\\S)\\+(?!" + ($$($nesting, 'CG_WORD')) + ")", 'm')]]; + $send(compat_quote_subs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + compat_quote_subs.$insert(3, ["emphasis", "constrained", new RegExp("" + "(^|[^" + ($$($nesting, 'CC_WORD')) + ";:}])(?:\\[([^\\]]+)\\])?'(\\S|\\S" + ($$($nesting, 'CC_ALL')) + "*?\\S)'(?!" + ($$($nesting, 'CG_WORD')) + ")", 'm')]); + Opal.const_set($nesting[0], 'QUOTE_SUBS', $hash(false, quote_subs, true, compat_quote_subs)); + quote_subs = nil; + compat_quote_subs = nil; + Opal.const_set($nesting[0], 'REPLACEMENTS', [[/\\?\(C\)/, "©", "none"], [/\\?\(R\)/, "®", "none"], [/\\?\(TM\)/, "™", "none"], [/(^|\n| |\\)--( |\n|$)/, " — ", "none"], [new RegExp("" + "(" + ($$($nesting, 'CG_WORD')) + ")\\\\?--(?=" + ($$($nesting, 'CG_WORD')) + ")"), "—​", "leading"], [/\\?\.\.\./, "…​", "leading"], [/\\?`'/, "’", "none"], [new RegExp("" + "(" + ($$($nesting, 'CG_ALNUM')) + ")\\\\?'(?=" + ($$($nesting, 'CG_ALPHA')) + ")"), "’", "leading"], [/\\?->/, "→", "none"], [/\\?=>/, "⇒", "none"], [/\\?<-/, "←", "none"], [/\\?<=/, "⇐", "none"], [/\\?(&)amp;((?:[a-zA-Z][a-zA-Z]+\d{0,2}|#\d\d\d{0,4}|#x[\da-fA-F][\da-fA-F][\da-fA-F]{0,3});)/, "", "bounding"]]); + (function(self, $parent_nesting) { + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_load_9, TMP_load_file_13, TMP_convert_15, TMP_convert_file_16; + + + + Opal.def(self, '$load', TMP_load_9 = function $$load(input, options) { + var $a, $b, TMP_10, TMP_11, TMP_12, self = this, timings = nil, logger = nil, $writer = nil, attrs = nil, attrs_arr = nil, lines = nil, input_path = nil, input_mtime = nil, docdate = nil, doctime = nil, doc = nil, ex = nil, context = nil, wrapped_ex = nil; + + + + if (options == null) { + options = $hash2([], {}); + }; + try { + + options = options.$dup(); + if ($truthy((timings = options['$[]']("timings")))) { + timings.$start("read")}; + if ($truthy(($truthy($a = (logger = options['$[]']("logger"))) ? logger['$!=']($$($nesting, 'LoggerManager').$logger()) : $a))) { + + $writer = [logger]; + $send($$($nesting, 'LoggerManager'), 'logger=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if ($truthy((attrs = options['$[]']("attributes"))['$!']())) { + attrs = $hash2([], {}) + } else if ($truthy(($truthy($a = $$$('::', 'Hash')['$==='](attrs)) ? $a : ($truthy($b = $$$('::', 'RUBY_ENGINE_JRUBY')) ? $$$($$$($$$('::', 'Java'), 'JavaUtil'), 'Map')['$==='](attrs) : $b)))) { + attrs = attrs.$dup() + } else if ($truthy($$$('::', 'Array')['$==='](attrs))) { + + $a = [$hash2([], {}), attrs], (attrs = $a[0]), (attrs_arr = $a[1]), $a; + $send(attrs_arr, 'each', [], (TMP_10 = function(entry){var self = TMP_10.$$s || this, $c, $d, k = nil, v = nil; + + + + if (entry == null) { + entry = nil; + }; + $d = entry.$split("=", 2), $c = Opal.to_ary($d), (k = ($c[0] == null ? nil : $c[0])), (v = ($c[1] == null ? nil : $c[1])), $d; + + $writer = [k, ($truthy($c = v) ? $c : "")]; + $send(attrs, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];;}, TMP_10.$$s = self, TMP_10.$$arity = 1, TMP_10)); + } else if ($truthy($$$('::', 'String')['$==='](attrs))) { + + $a = [$hash2([], {}), attrs.$gsub($$($nesting, 'SpaceDelimiterRx'), "" + "\\1" + ($$($nesting, 'NULL'))).$gsub($$($nesting, 'EscapedSpaceRx'), "\\1").$split($$($nesting, 'NULL'))], (attrs = $a[0]), (attrs_arr = $a[1]), $a; + $send(attrs_arr, 'each', [], (TMP_11 = function(entry){var self = TMP_11.$$s || this, $c, $d, k = nil, v = nil; + + + + if (entry == null) { + entry = nil; + }; + $d = entry.$split("=", 2), $c = Opal.to_ary($d), (k = ($c[0] == null ? nil : $c[0])), (v = ($c[1] == null ? nil : $c[1])), $d; + + $writer = [k, ($truthy($c = v) ? $c : "")]; + $send(attrs, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];;}, TMP_11.$$s = self, TMP_11.$$arity = 1, TMP_11)); + } else if ($truthy(($truthy($a = attrs['$respond_to?']("keys")) ? attrs['$respond_to?']("[]") : $a))) { + attrs = $$$('::', 'Hash')['$[]']($send(attrs.$keys(), 'map', [], (TMP_12 = function(k){var self = TMP_12.$$s || this; + + + + if (k == null) { + k = nil; + }; + return [k, attrs['$[]'](k)];}, TMP_12.$$s = self, TMP_12.$$arity = 1, TMP_12))) + } else { + self.$raise($$$('::', 'ArgumentError'), "" + "illegal type for attributes option: " + (attrs.$class().$ancestors().$join(" < "))) + }; + lines = nil; + if ($truthy($$$('::', 'File')['$==='](input))) { + + input_path = $$$('::', 'File').$expand_path(input.$path()); + input_mtime = (function() {if ($truthy($$$('::', 'ENV')['$[]']("SOURCE_DATE_EPOCH"))) { + return $$$('::', 'Time').$at(self.$Integer($$$('::', 'ENV')['$[]']("SOURCE_DATE_EPOCH"))).$utc() + } else { + return input.$mtime() + }; return nil; })(); + lines = input.$readlines(); + + $writer = ["docfile", input_path]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["docdir", $$$('::', 'File').$dirname(input_path)]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["docname", $$($nesting, 'Helpers').$basename(input_path, (($writer = ["docfilesuffix", $$$('::', 'File').$extname(input_path)]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]))]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + if ($truthy((docdate = attrs['$[]']("docdate")))) { + ($truthy($a = attrs['$[]']("docyear")) ? $a : (($writer = ["docyear", (function() {if (docdate.$index("-")['$=='](4)) { + + return docdate.$slice(0, 4); + } else { + return nil + }; return nil; })()]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])) + } else { + + docdate = (($writer = ["docdate", input_mtime.$strftime("%F")]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]); + ($truthy($a = attrs['$[]']("docyear")) ? $a : (($writer = ["docyear", input_mtime.$year().$to_s()]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + }; + doctime = ($truthy($a = attrs['$[]']("doctime")) ? $a : (($writer = ["doctime", input_mtime.$strftime("" + "%T " + ((function() {if (input_mtime.$utc_offset()['$=='](0)) { + return "UTC" + } else { + return "%z" + }; return nil; })()))]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + + $writer = ["docdatetime", "" + (docdate) + " " + (doctime)]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + } else if ($truthy(input['$respond_to?']("readlines"))) { + + + try { + input.$rewind() + } catch ($err) { + if (Opal.rescue($err, [$$($nesting, 'StandardError')])) { + try { + nil + } finally { Opal.pop_exception() } + } else { throw $err; } + };; + lines = input.$readlines(); + } else if ($truthy($$$('::', 'String')['$==='](input))) { + lines = (function() {if ($truthy($$$('::', 'RUBY_MIN_VERSION_2'))) { + return input.$lines() + } else { + return input.$each_line().$to_a() + }; return nil; })() + } else if ($truthy($$$('::', 'Array')['$==='](input))) { + lines = input.$drop(0) + } else { + self.$raise($$$('::', 'ArgumentError'), "" + "unsupported input type: " + (input.$class())) + }; + if ($truthy(timings)) { + + timings.$record("read"); + timings.$start("parse");}; + + $writer = ["attributes", attrs]; + $send(options, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + doc = (function() {if (options['$[]']("parse")['$=='](false)) { + + return $$($nesting, 'Document').$new(lines, options); + } else { + return $$($nesting, 'Document').$new(lines, options).$parse() + }; return nil; })(); + if ($truthy(timings)) { + timings.$record("parse")}; + return doc; + } catch ($err) { + if (Opal.rescue($err, [$$($nesting, 'StandardError')])) {ex = $err; + try { + + + try { + + context = "" + "asciidoctor: FAILED: " + (($truthy($a = attrs['$[]']("docfile")) ? $a : "")) + ": Failed to load AsciiDoc document"; + if ($truthy(ex['$respond_to?']("exception"))) { + + wrapped_ex = ex.$exception("" + (context) + " - " + (ex.$message())); + wrapped_ex.$set_backtrace(ex.$backtrace()); + } else { + + wrapped_ex = ex.$class().$new(context, ex); + + $writer = [ex.$stack_trace()]; + $send(wrapped_ex, 'stack_trace=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + }; + } catch ($err) { + if (Opal.rescue($err, [$$($nesting, 'StandardError')])) { + try { + wrapped_ex = ex + } finally { Opal.pop_exception() } + } else { throw $err; } + };; + return self.$raise(wrapped_ex); + } finally { Opal.pop_exception() } + } else { throw $err; } + }; + }, TMP_load_9.$$arity = -2); + + Opal.def(self, '$load_file', TMP_load_file_13 = function $$load_file(filename, options) { + var TMP_14, self = this; + + + + if (options == null) { + options = $hash2([], {}); + }; + return $send($$$('::', 'File'), 'open', [filename, "rb"], (TMP_14 = function(file){var self = TMP_14.$$s || this; + + + + if (file == null) { + file = nil; + }; + return self.$load(file, options);}, TMP_14.$$s = self, TMP_14.$$arity = 1, TMP_14)); + }, TMP_load_file_13.$$arity = -2); + + Opal.def(self, '$convert', TMP_convert_15 = function $$convert(input, options) { + var $a, $b, $c, $d, $e, self = this, to_file = nil, to_dir = nil, mkdirs = nil, $case = nil, write_to_same_dir = nil, stream_output = nil, write_to_target = nil, $writer = nil, input_path = nil, outdir = nil, doc = nil, outfile = nil, working_dir = nil, jail = nil, opts = nil, output = nil, stylesdir = nil, copy_asciidoctor_stylesheet = nil, copy_user_stylesheet = nil, stylesheet = nil, copy_coderay_stylesheet = nil, copy_pygments_stylesheet = nil, stylesoutdir = nil, stylesheet_src = nil, stylesheet_dest = nil, stylesheet_data = nil; + + + + if (options == null) { + options = $hash2([], {}); + }; + options = options.$dup(); + options.$delete("parse"); + to_file = options.$delete("to_file"); + to_dir = options.$delete("to_dir"); + mkdirs = ($truthy($a = options.$delete("mkdirs")) ? $a : false); + $case = to_file; + if (true['$===']($case) || nil['$===']($case)) { + write_to_same_dir = ($truthy($a = to_dir['$!']()) ? $$$('::', 'File')['$==='](input) : $a); + stream_output = false; + write_to_target = to_dir; + to_file = nil;} + else if (false['$===']($case)) { + write_to_same_dir = false; + stream_output = false; + write_to_target = false; + to_file = nil;} + else if ("/dev/null"['$===']($case)) {return self.$load(input, options)} + else { + write_to_same_dir = false; + write_to_target = (function() {if ($truthy((stream_output = to_file['$respond_to?']("write")))) { + return false + } else { + + + $writer = ["to_file", to_file]; + $send(options, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];; + }; return nil; })();}; + if ($truthy(options['$key?']("header_footer"))) { + } else if ($truthy(($truthy($a = write_to_same_dir) ? $a : write_to_target))) { + + $writer = ["header_footer", true]; + $send(options, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if ($truthy(write_to_same_dir)) { + + input_path = $$$('::', 'File').$expand_path(input.$path()); + + $writer = ["to_dir", (outdir = $$$('::', 'File').$dirname(input_path))]; + $send(options, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + } else if ($truthy(write_to_target)) { + if ($truthy(to_dir)) { + if ($truthy(to_file)) { + + $writer = ["to_dir", $$$('::', 'File').$dirname($$$('::', 'File').$expand_path($$$('::', 'File').$join(to_dir, to_file)))]; + $send(options, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + } else { + + $writer = ["to_dir", $$$('::', 'File').$expand_path(to_dir)]; + $send(options, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + } + } else if ($truthy(to_file)) { + + $writer = ["to_dir", $$$('::', 'File').$dirname($$$('::', 'File').$expand_path(to_file))]; + $send(options, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}}; + doc = self.$load(input, options); + if ($truthy(write_to_same_dir)) { + + outfile = $$$('::', 'File').$join(outdir, "" + (doc.$attributes()['$[]']("docname")) + (doc.$outfilesuffix())); + if (outfile['$=='](input_path)) { + self.$raise($$$('::', 'IOError'), "" + "input file and output file cannot be the same: " + (outfile))}; + } else if ($truthy(write_to_target)) { + + working_dir = (function() {if ($truthy(options['$key?']("base_dir"))) { + + return $$$('::', 'File').$expand_path(options['$[]']("base_dir")); + } else { + return $$$('::', 'Dir').$pwd() + }; return nil; })(); + jail = (function() {if ($truthy($rb_ge(doc.$safe(), $$$($$($nesting, 'SafeMode'), 'SAFE')))) { + return working_dir + } else { + return nil + }; return nil; })(); + if ($truthy(to_dir)) { + + outdir = doc.$normalize_system_path(to_dir, working_dir, jail, $hash2(["target_name", "recover"], {"target_name": "to_dir", "recover": false})); + if ($truthy(to_file)) { + + outfile = doc.$normalize_system_path(to_file, outdir, nil, $hash2(["target_name", "recover"], {"target_name": "to_dir", "recover": false})); + outdir = $$$('::', 'File').$dirname(outfile); + } else { + outfile = $$$('::', 'File').$join(outdir, "" + (doc.$attributes()['$[]']("docname")) + (doc.$outfilesuffix())) + }; + } else if ($truthy(to_file)) { + + outfile = doc.$normalize_system_path(to_file, working_dir, jail, $hash2(["target_name", "recover"], {"target_name": "to_dir", "recover": false})); + outdir = $$$('::', 'File').$dirname(outfile);}; + if ($truthy(($truthy($a = $$$('::', 'File')['$==='](input)) ? outfile['$==']($$$('::', 'File').$expand_path(input.$path())) : $a))) { + self.$raise($$$('::', 'IOError'), "" + "input file and output file cannot be the same: " + (outfile))}; + if ($truthy(mkdirs)) { + $$($nesting, 'Helpers').$mkdir_p(outdir) + } else if ($truthy($$$('::', 'File')['$directory?'](outdir))) { + } else { + self.$raise($$$('::', 'IOError'), "" + "target directory does not exist: " + (to_dir) + " (hint: set mkdirs option)") + }; + } else { + + outfile = to_file; + outdir = nil; + }; + opts = (function() {if ($truthy(($truthy($a = outfile) ? stream_output['$!']() : $a))) { + return $hash2(["outfile", "outdir"], {"outfile": outfile, "outdir": outdir}) + } else { + return $hash2([], {}) + }; return nil; })(); + output = doc.$convert(opts); + if ($truthy(outfile)) { + + doc.$write(output, outfile); + if ($truthy(($truthy($a = ($truthy($b = ($truthy($c = ($truthy($d = ($truthy($e = stream_output['$!']()) ? $rb_lt(doc.$safe(), $$$($$($nesting, 'SafeMode'), 'SECURE')) : $e)) ? doc['$attr?']("linkcss") : $d)) ? doc['$attr?']("copycss") : $c)) ? doc['$attr?']("basebackend-html") : $b)) ? ($truthy($b = (stylesdir = doc.$attr("stylesdir"))) ? $$($nesting, 'Helpers')['$uriish?'](stylesdir) : $b)['$!']() : $a))) { + + copy_asciidoctor_stylesheet = false; + copy_user_stylesheet = false; + if ($truthy((stylesheet = doc.$attr("stylesheet")))) { + if ($truthy($$($nesting, 'DEFAULT_STYLESHEET_KEYS')['$include?'](stylesheet))) { + copy_asciidoctor_stylesheet = true + } else if ($truthy($$($nesting, 'Helpers')['$uriish?'](stylesheet)['$!']())) { + copy_user_stylesheet = true}}; + copy_coderay_stylesheet = ($truthy($a = doc['$attr?']("source-highlighter", "coderay")) ? doc.$attr("coderay-css", "class")['$==']("class") : $a); + copy_pygments_stylesheet = ($truthy($a = doc['$attr?']("source-highlighter", "pygments")) ? doc.$attr("pygments-css", "class")['$==']("class") : $a); + if ($truthy(($truthy($a = ($truthy($b = ($truthy($c = copy_asciidoctor_stylesheet) ? $c : copy_user_stylesheet)) ? $b : copy_coderay_stylesheet)) ? $a : copy_pygments_stylesheet))) { + + stylesoutdir = doc.$normalize_system_path(stylesdir, outdir, (function() {if ($truthy($rb_ge(doc.$safe(), $$$($$($nesting, 'SafeMode'), 'SAFE')))) { + return outdir + } else { + return nil + }; return nil; })()); + if ($truthy(mkdirs)) { + $$($nesting, 'Helpers').$mkdir_p(stylesoutdir) + } else if ($truthy($$$('::', 'File')['$directory?'](stylesoutdir))) { + } else { + self.$raise($$$('::', 'IOError'), "" + "target stylesheet directory does not exist: " + (stylesoutdir) + " (hint: set mkdirs option)") + }; + if ($truthy(copy_asciidoctor_stylesheet)) { + $$($nesting, 'Stylesheets').$instance().$write_primary_stylesheet(stylesoutdir) + } else if ($truthy(copy_user_stylesheet)) { + + if ($truthy((stylesheet_src = doc.$attr("copycss"))['$empty?']())) { + stylesheet_src = doc.$normalize_system_path(stylesheet) + } else { + stylesheet_src = doc.$normalize_system_path(stylesheet_src) + }; + stylesheet_dest = doc.$normalize_system_path(stylesheet, stylesoutdir, (function() {if ($truthy($rb_ge(doc.$safe(), $$$($$($nesting, 'SafeMode'), 'SAFE')))) { + return outdir + } else { + return nil + }; return nil; })()); + if ($truthy(($truthy($a = stylesheet_src['$!='](stylesheet_dest)) ? (stylesheet_data = doc.$read_asset(stylesheet_src, $hash2(["warn_on_failure", "label"], {"warn_on_failure": $$$('::', 'File')['$file?'](stylesheet_dest)['$!'](), "label": "stylesheet"}))) : $a))) { + $$$('::', 'IO').$write(stylesheet_dest, stylesheet_data)};}; + if ($truthy(copy_coderay_stylesheet)) { + $$($nesting, 'Stylesheets').$instance().$write_coderay_stylesheet(stylesoutdir) + } else if ($truthy(copy_pygments_stylesheet)) { + $$($nesting, 'Stylesheets').$instance().$write_pygments_stylesheet(stylesoutdir, doc.$attr("pygments-style"))};};}; + return doc; + } else { + return output + }; + }, TMP_convert_15.$$arity = -2); + Opal.alias(self, "render", "convert"); + + Opal.def(self, '$convert_file', TMP_convert_file_16 = function $$convert_file(filename, options) { + var TMP_17, self = this; + + + + if (options == null) { + options = $hash2([], {}); + }; + return $send($$$('::', 'File'), 'open', [filename, "rb"], (TMP_17 = function(file){var self = TMP_17.$$s || this; + + + + if (file == null) { + file = nil; + }; + return self.$convert(file, options);}, TMP_17.$$s = self, TMP_17.$$arity = 1, TMP_17)); + }, TMP_convert_file_16.$$arity = -2); + Opal.alias(self, "render_file", "convert_file"); + if ($$($nesting, 'RUBY_ENGINE')['$==']("opal")) { + return nil + } else { + return nil + }; + })(Opal.get_singleton_class(self), $nesting); + if ($$($nesting, 'RUBY_ENGINE')['$==']("opal")) { + + self.$require("asciidoctor/timings"); + self.$require("asciidoctor/version"); + } else { + nil + }; + })($nesting[0], $nesting); + self.$require("asciidoctor/core_ext"); + self.$require("asciidoctor/helpers"); + self.$require("asciidoctor/substitutors"); + self.$require("asciidoctor/abstract_node"); + self.$require("asciidoctor/abstract_block"); + self.$require("asciidoctor/attribute_list"); + self.$require("asciidoctor/block"); + self.$require("asciidoctor/callouts"); + self.$require("asciidoctor/converter"); + self.$require("asciidoctor/document"); + self.$require("asciidoctor/inline"); + self.$require("asciidoctor/list"); + self.$require("asciidoctor/parser"); + self.$require("asciidoctor/path_resolver"); + self.$require("asciidoctor/reader"); + self.$require("asciidoctor/section"); + self.$require("asciidoctor/stylesheets"); + self.$require("asciidoctor/table"); + if ($$($nesting, 'RUBY_ENGINE')['$==']("opal")) { + return self.$require("asciidoctor/js/postscript") + } else { + return nil + }; +})(Opal); + + +/** + * Convert a JSON to an (Opal) Hash. + * @private + */ +var toHash = function (object) { + return object && !('$$smap' in object) ? Opal.hash(object) : object; +}; + +/** + * Convert an (Opal) Hash to JSON. + * @private + */ +var fromHash = function (hash) { + var object = {}; + var data = hash.$$smap; + for (var key in data) { + object[key] = data[key]; + } + return object; +}; + +/** + * @private + */ +var prepareOptions = function (options) { + if (options = toHash(options)) { + var attrs = options['$[]']('attributes'); + if (attrs && typeof attrs === 'object' && attrs.constructor.name === 'Object') { + options = options.$dup(); + options['$[]=']('attributes', toHash(attrs)); + } + } + return options; +}; + +function initializeClass (superClass, className, functions, defaultFunctions, argProxyFunctions) { + var scope = Opal.klass(Opal.Object, superClass, className, function () {}); + var postConstructFunction; + var initializeFunction; + var defaultFunctionsOverridden = {}; + for (var functionName in functions) { + if (functions.hasOwnProperty(functionName)) { + (function (functionName) { + var userFunction = functions[functionName]; + if (functionName === 'postConstruct') { + postConstructFunction = userFunction; + } else if (functionName === 'initialize') { + initializeFunction = userFunction; + } else { + if (defaultFunctions && defaultFunctions.hasOwnProperty(functionName)) { + defaultFunctionsOverridden[functionName] = true; + } + Opal.def(scope, '$' + functionName, function () { + var args; + if (argProxyFunctions && argProxyFunctions.hasOwnProperty(functionName)) { + args = argProxyFunctions[functionName](arguments); + } else { + args = arguments; + } + return userFunction.apply(this, args); + }); + } + }(functionName)); + } + } + var initialize; + if (typeof initializeFunction === 'function') { + initialize = function () { + initializeFunction.apply(this, arguments); + if (typeof postConstructFunction === 'function') { + postConstructFunction.bind(this)(); + } + }; + } else { + initialize = function () { + Opal.send(this, Opal.find_super_dispatcher(this, 'initialize', initialize)); + if (typeof postConstructFunction === 'function') { + postConstructFunction.bind(this)(); + } + }; + } + Opal.def(scope, '$initialize', initialize); + Opal.def(scope, 'super', function (func) { + if (typeof func === 'function') { + Opal.send(this, Opal.find_super_dispatcher(this, func.name, func)); + } else { + // Bind the initialize function to super(); + var argumentsList = Array.from(arguments); + for (var i = 0; i < argumentsList.length; i++) { + // convert all (Opal) Hash arguments to JSON. + if (typeof argumentsList[i] === 'object') { + argumentsList[i] = toHash(argumentsList[i]); + } + } + Opal.send(this, Opal.find_super_dispatcher(this, 'initialize', initialize), argumentsList); + } + }); + if (defaultFunctions) { + for (var defaultFunctionName in defaultFunctions) { + if (defaultFunctions.hasOwnProperty(defaultFunctionName) && !defaultFunctionsOverridden.hasOwnProperty(defaultFunctionName)) { + (function (defaultFunctionName) { + var defaultFunction = defaultFunctions[defaultFunctionName]; + Opal.def(scope, '$' + defaultFunctionName, function () { + return defaultFunction.apply(this, arguments); + }); + }(defaultFunctionName)); + } + } + } + return scope; +} + +// Asciidoctor API + +/** + * @namespace + * @description + * Methods for parsing AsciiDoc input files and converting documents. + * + * AsciiDoc documents comprise a header followed by zero or more sections. + * Sections are composed of blocks of content. For example: + *
    + *   = Doc Title
    + *
    + *   == Section 1
    + *
    + *   This is a paragraph block in the first section.
    + *
    + *   == Section 2
    + *
    + *   This section has a paragraph block and an olist block.
    + *
    + *   . Item 1
    + *   . Item 2
    + * 
    + * + * @example + * asciidoctor.convertFile('sample.adoc'); + */ +var Asciidoctor = Opal.Asciidoctor['$$class']; + +/** + * Get Asciidoctor core version number. + * + * @memberof Asciidoctor + * @returns {string} - returns the version number of Asciidoctor core. + */ +Asciidoctor.prototype.getCoreVersion = function () { + return this.$$const.VERSION; +}; + +/** + * Get Asciidoctor.js runtime environment informations. + * + * @memberof Asciidoctor + * @returns {Object} - returns the runtime environement including the ioModule, the platform, the engine and the framework. + */ +Asciidoctor.prototype.getRuntime = function () { + return { + ioModule: Opal.const_get_qualified('::', 'JAVASCRIPT_IO_MODULE'), + platform: Opal.const_get_qualified('::', 'JAVASCRIPT_PLATFORM'), + engine: Opal.const_get_qualified('::', 'JAVASCRIPT_ENGINE'), + framework: Opal.const_get_qualified('::', 'JAVASCRIPT_FRAMEWORK') + }; +}; + +/** + * Parse the AsciiDoc source input into an {@link Document} and convert it to the specified backend format. + * + * Accepts input as a Buffer or String. + * + * @param {string|Buffer} input - AsciiDoc input as String or Buffer + * @param {Object} options - a JSON of options to control processing (default: {}) + * @returns {string|Document} - returns the {@link Document} object if the converted String is written to a file, + * otherwise the converted String + * @memberof Asciidoctor + * @example + * var input = '= Hello, AsciiDoc!\n' + + * 'Guillaume Grossetie \n\n' + + * 'An introduction to http://asciidoc.org[AsciiDoc].\n\n' + + * '== First Section\n\n' + + * '* item 1\n' + + * '* item 2\n'; + * + * var html = asciidoctor.convert(input); + */ +Asciidoctor.prototype.convert = function (input, options) { + if (typeof input === 'object' && input.constructor.name === 'Buffer') { + input = input.toString('utf8'); + } + var result = this.$convert(input, prepareOptions(options)); + return result === Opal.nil ? '' : result; +}; + +/** + * Parse the AsciiDoc source input into an {@link Document} and convert it to the specified backend format. + * + * @param {string} filename - source filename + * @param {Object} options - a JSON of options to control processing (default: {}) + * @returns {string|Document} - returns the {@link Document} object if the converted String is written to a file, + * otherwise the converted String + * @memberof Asciidoctor + * @example + * var html = asciidoctor.convertFile('./document.adoc'); + */ +Asciidoctor.prototype.convertFile = function (filename, options) { + return this.$convert_file(filename, prepareOptions(options)); +}; + +/** + * Parse the AsciiDoc source input into an {@link Document} + * + * Accepts input as a Buffer or String. + * + * @param {string|Buffer} input - AsciiDoc input as String or Buffer + * @param {Object} options - a JSON of options to control processing (default: {}) + * @returns {Document} - returns the {@link Document} object + * @memberof Asciidoctor + */ +Asciidoctor.prototype.load = function (input, options) { + if (typeof input === 'object' && input.constructor.name === 'Buffer') { + input = input.toString('utf8'); + } + return this.$load(input, prepareOptions(options)); +}; + +/** + * Parse the contents of the AsciiDoc source file into an {@link Document} + * + * @param {string} filename - source filename + * @param {Object} options - a JSON of options to control processing (default: {}) + * @returns {Document} - returns the {@link Document} object + * @memberof Asciidoctor + */ +Asciidoctor.prototype.loadFile = function (filename, options) { + return this.$load_file(filename, prepareOptions(options)); +}; + +// AbstractBlock API + +/** + * @namespace + * @extends AbstractNode + */ +var AbstractBlock = Opal.Asciidoctor.AbstractBlock; + +/** + * Append a block to this block's list of child blocks. + * + * @memberof AbstractBlock + * @returns {AbstractBlock} - the parent block to which this block was appended. + * + */ +AbstractBlock.prototype.append = function (block) { + this.$append(block); + return this; +}; + +/* + * Apply the named inline substitutions to the specified text. + * + * If no substitutions are specified, the following substitutions are + * applied: + * + * specialcharacters, quotes, attributes, replacements, macros, and post_replacements + * @param {string} text - The text to substitute. + * @param {Array} subs - A list named substitutions to apply to the text. + * @memberof AbstractBlock + * @returns {string} - returns the substituted text. + */ +AbstractBlock.prototype.applySubstitutions = function (text, subs) { + return this.$apply_subs(text, subs); +}; + +/** + * Get the String title of this Block with title substitions applied + * + * The following substitutions are applied to block and section titles: + * + * specialcharacters, quotes, replacements, macros, attributes and post_replacements + * + * @memberof AbstractBlock + * @returns {string} - returns the converted String title for this Block, or undefined if the title is not set. + * @example + * block.title // "Foo 3^ # {two-colons} Bar(1)" + * block.getTitle(); // "Foo 3^ # :: Bar(1)" + */ +AbstractBlock.prototype.getTitle = function () { + var title = this.$title(); + return title === Opal.nil ? undefined : title; +}; + +/** + * Convenience method that returns the interpreted title of the Block + * with the caption prepended. + * Concatenates the value of this Block's caption instance variable and the + * return value of this Block's title method. No space is added between the + * two values. If the Block does not have a caption, the interpreted title is + * returned. + * + * @memberof AbstractBlock + * @returns {string} - the converted String title prefixed with the caption, or just the + * converted String title if no caption is set + */ +AbstractBlock.prototype.getCaptionedTitle = function () { + return this.$captioned_title(); +}; + +/** + * Get the style (block type qualifier) for this block. + * @memberof AbstractBlock + * @returns {string} - returns the style for this block + */ +AbstractBlock.prototype.getStyle = function () { + return this.style; +}; + +/** + * Get the caption for this block. + * @memberof AbstractBlock + * @returns {string} - returns the caption for this block + */ +AbstractBlock.prototype.getCaption = function () { + return this.$caption(); +}; + +/** + * Set the caption for this block. + * @param {string} caption - Caption + * @memberof AbstractBlock + */ +AbstractBlock.prototype.setCaption = function (caption) { + this.caption = caption; +}; + +/** + * Get the level of this section or the section level in which this block resides. + * @memberof AbstractBlock + * @returns {number} - returns the level of this section + */ +AbstractBlock.prototype.getLevel = function () { + return this.level; +}; + +/** + * Get the substitution keywords to be applied to the contents of this block. + * + * @memberof AbstractBlock + * @returns {Array} - the list of {string} substitution keywords associated with this block. + */ +AbstractBlock.prototype.getSubstitutions = function () { + return this.subs; +}; + +/** + * Check whether a given substitution keyword is present in the substitutions for this block. + * + * @memberof AbstractBlock + * @returns {boolean} - whether the substitution is present on this block. + */ +AbstractBlock.prototype.hasSubstitution = function (substitution) { + return this['$sub?'](substitution); +}; + +/** + * Remove the specified substitution keyword from the list of substitutions for this block. + * + * @memberof AbstractBlock + * @returns undefined + */ +AbstractBlock.prototype.removeSubstitution = function (substitution) { + this.$remove_sub(substitution); +}; + +/** + * Checks if the {@link AbstractBlock} contains any child blocks. + * @memberof AbstractBlock + * @returns {boolean} - whether the {@link AbstractBlock} has child blocks. + */ +AbstractBlock.prototype.hasBlocks = function () { + return this.blocks.length > 0; +}; + +/** + * Get the list of {@link AbstractBlock} sub-blocks for this block. + * @memberof AbstractBlock + * @returns {Array} - returns a list of {@link AbstractBlock} sub-blocks + */ +AbstractBlock.prototype.getBlocks = function () { + return this.blocks; +}; + +/** + * Get the converted result of the child blocks by converting the children appropriate to content model that this block supports. + * @memberof AbstractBlock + * @returns {string} - returns the converted result of the child blocks + */ +AbstractBlock.prototype.getContent = function () { + return this.$content(); +}; + +/** + * Get the converted content for this block. + * If the block has child blocks, the content method should cause them to be converted + * and returned as content that can be included in the parent block's template. + * @memberof AbstractBlock + * @returns {string} - returns the converted String content for this block + */ +AbstractBlock.prototype.convert = function () { + return this.$convert(); +}; + +/** + * Query for all descendant block-level nodes in the document tree + * that match the specified selector (context, style, id, and/or role). + * If a function block is given, it's used as an additional filter. + * If no selector or function block is supplied, all block-level nodes in the tree are returned. + * @param {Object} [selector] + * @param {function} [block] + * @example + * doc.findBy({'context': 'section'}); + * // => { level: 0, title: "Hello, AsciiDoc!", blocks: 0 } + * // => { level: 1, title: "First Section", blocks: 1 } + * + * doc.findBy({'context': 'section'}, function (section) { return section.getLevel() === 1; }); + * // => { level: 1, title: "First Section", blocks: 1 } + * + * doc.findBy({'context': 'listing', 'style': 'source'}); + * // => { context: :listing, content_model: :verbatim, style: "source", lines: 1 } + * + * @memberof AbstractBlock + * @returns {Array} - returns a list of block-level nodes that match the filter or an empty list if no matches are found + */ +AbstractBlock.prototype.findBy = function (selector, block) { + if (typeof block === 'undefined' && typeof selector === 'function') { + return Opal.send(this, 'find_by', null, selector); + } + else if (typeof block === 'function') { + return Opal.send(this, 'find_by', [toHash(selector)], block); + } + else { + return this.$find_by(toHash(selector)); + } +}; + +/** + * Get the source line number where this block started. + * @memberof AbstractBlock + * @returns {number} - returns the source line number where this block started + */ +AbstractBlock.prototype.getLineNumber = function () { + var lineno = this.$lineno(); + return lineno === Opal.nil ? undefined : lineno; +}; + +/** + * Check whether this block has any child Section objects. + * Only applies to Document and Section instances. + * @memberof AbstractBlock + * @returns {boolean} - true if this block has child Section objects, otherwise false + */ +AbstractBlock.prototype.hasSections = function () { + return this['$sections?'](); +}; + +/** + * Get the Array of child Section objects. + * Only applies to Document and Section instances. + * @memberof AbstractBlock + * @returns {Array} - returns an {Array} of {@link Section} objects + */ +AbstractBlock.prototype.getSections = function () { + return this.$sections(); +}; + +/** + * Get the numeral of this block (if section, relative to parent, otherwise absolute). + * Only assigned to section if automatic section numbering is enabled. + * Only assigned to formal block (block with title) if corresponding caption attribute is present. + * If the section is an appendix, the numeral is a letter (starting with A). + * @memberof AbstractBlock + * @returns {string} - returns the numeral + */ +AbstractBlock.prototype.getNumeral = function () { + // number was renamed to numeral + // https://github.com/asciidoctor/asciidoctor/commit/33ac4821e0375bcd5aa189c394ad7630717bcd55 + return this.$number(); +}; + +/** + * Set the numeral of this block. + * @memberof AbstractBlock + */ +AbstractBlock.prototype.setNumeral = function (value) { + // number was renamed to numeral + // https://github.com/asciidoctor/asciidoctor/commit/33ac4821e0375bcd5aa189c394ad7630717bcd55 + return this['$number='](value); +}; + +/** + * A convenience method that checks whether the title of this block is defined. + * + * @returns a {boolean} indicating whether this block has a title. + * @memberof AbstractBlock + */ +AbstractBlock.prototype.hasTitle = function () { + return this['$title?'](); +}; + +// Section API + +/** + * @namespace + * @extends AbstractBlock + */ +var Section = Opal.Asciidoctor.Section; + +/** + * Get the 0-based index order of this section within the parent block. + * @memberof Section + * @returns {number} + */ +Section.prototype.getIndex = function () { + return this.index; +}; + +/** + * Set the 0-based index order of this section within the parent block. + * @memberof Section + */ +Section.prototype.setIndex = function (value) { + this.index = value; +}; + +/** + * Get the section name of this section. + * @memberof Section + * @returns {string} + */ +Section.prototype.getSectionName = function () { + return this.sectname; +}; + +/** + * Set the section name of this section. + * @memberof Section + */ +Section.prototype.setSectionName = function (value) { + this.sectname = value; +}; + +/** + * Get the flag to indicate whether this is a special section or a child of one. + * @memberof Section + * @returns {boolean} + */ +Section.prototype.isSpecial = function () { + return this.special; +}; + +/** + * Set the flag to indicate whether this is a special section or a child of one. + * @memberof Section + */ +Section.prototype.setSpecial = function (value) { + this.special = value; +}; + +/** + * Get the state of the numbered attribute at this section (need to preserve for creating TOC). + * @memberof Section + * @returns {boolean} + */ +Section.prototype.isNumbered = function () { + return this.numbered; +}; + +/** + * Get the caption for this section (only relevant for appendices). + * @memberof Section + * @returns {string} + */ +Section.prototype.getCaption = function () { + var value = this.caption; + return value === Opal.nil ? undefined : value; +}; + +/** + * Get the name of the Section (title) + * @memberof Section + * @returns {string} + * @see {@link AbstractBlock#getTitle} + */ +Section.prototype.getName = function () { + return this.getTitle(); +}; + +/** + * @namespace + */ +var Block = Opal.Asciidoctor.Block; + +/** + * Get the source of this block. + * @memberof Block + * @returns {string} - returns the String source of this block. + */ +Block.prototype.getSource = function () { + return this.$source(); +}; + +/** + * Get the source lines of this block. + * @memberof Block + * @returns {Array} - returns the String {Array} of source lines for this block. + */ +Block.prototype.getSourceLines = function () { + return this.lines; +}; + +// AbstractNode API + +/** + * @namespace + */ +var AbstractNode = Opal.Asciidoctor.AbstractNode; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.getNodeName = function () { + return this.node_name; +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.getAttributes = function () { + return fromHash(this.attributes); +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.getAttribute = function (name, defaultValue, inherit) { + var value = this.$attr(name, defaultValue, inherit); + return value === Opal.nil ? undefined : value; +}; + +/** + * Check whether the specified attribute is present on this node. + * + * @memberof AbstractNode + * @returns {boolean} - true if the attribute is present, otherwise false + */ +AbstractNode.prototype.hasAttribute = function (name) { + return name in this.attributes.$$smap; +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.isAttribute = function (name, expectedValue, inherit) { + var result = this['$attr?'](name, expectedValue, inherit); + return result === Opal.nil ? false : result; +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.setAttribute = function (name, value, overwrite) { + if (typeof overwrite === 'undefined') overwrite = true; + return this.$set_attr(name, value, overwrite); +}; + +/** + * Remove the attribute from the current node. + * @param {string} name - The String attribute name to remove + * @returns {string} - returns the previous {String} value, or undefined if the attribute was not present. + * @memberof AbstractNode + */ +AbstractNode.prototype.removeAttribute = function (name) { + var value = this.$remove_attr(name); + return value === Opal.nil ? undefined : value; +}; + +/** + * Get the {@link Document} to which this node belongs. + * + * @memberof AbstractNode + * @returns {Document} - returns the {@link Document} object to which this node belongs. + */ +AbstractNode.prototype.getDocument = function () { + return this.document; +}; + +/** + * Get the {@link AbstractNode} to which this node is attached. + * + * @memberof AbstractNode + * @returns {AbstractNode} - returns the {@link AbstractNode} object to which this node is attached, + * or undefined if this node has no parent. + */ +AbstractNode.prototype.getParent = function () { + var parent = this.parent; + return parent === Opal.nil ? undefined : parent; +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.isInline = function () { + return this['$inline?'](); +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.isBlock = function () { + return this['$block?'](); +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.isRole = function (expected) { + return this['$role?'](expected); +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.getRole = function () { + return this.$role(); +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.hasRole = function (name) { + return this['$has_role?'](name); +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.getRoles = function () { + return this.$roles(); +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.addRole = function (name) { + return this.$add_role(name); +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.removeRole = function (name) { + return this.$remove_role(name); +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.isReftext = function () { + return this['$reftext?'](); +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.getReftext = function () { + return this.$reftext(); +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.getContext = function () { + var context = this.context; + // Automatically convert Opal pseudo-symbol to String + return typeof context === 'string' ? context : context.toString(); +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.getId = function () { + var id = this.id; + return id === Opal.nil ? undefined : id; +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.isOption = function (name) { + return this['$option?'](name); +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.setOption = function (name) { + return this.$set_option(name); +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.getIconUri = function (name) { + return this.$icon_uri(name); +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.getMediaUri = function (target, assetDirKey) { + return this.$media_uri(target, assetDirKey); +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.getImageUri = function (targetImage, assetDirKey) { + return this.$image_uri(targetImage, assetDirKey); +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.getConverter = function () { + return this.$converter(); +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.readContents = function (target, options) { + return this.$read_contents(target, toHash(options)); +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.readAsset = function (path, options) { + return this.$read_asset(path, toHash(options)); +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.normalizeWebPath = function (target, start, preserveTargetUri) { + return this.$normalize_web_path(target, start, preserveTargetUri); +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.normalizeSystemPath = function (target, start, jail, options) { + return this.$normalize_system_path(target, start, jail, toHash(options)); +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.normalizeAssetPath = function (assetRef, assetName, autoCorrect) { + return this.$normalize_asset_path(assetRef, assetName, autoCorrect); +}; + +// Document API + +/** + * The {@link Document} class represents a parsed AsciiDoc document. + * + * Document is the root node of a parsed AsciiDoc document.
    + * It provides an abstract syntax tree (AST) that represents the structure of the AsciiDoc document + * from which the Document object was parsed. + * + * Although the constructor can be used to create an empty document object, + * more commonly, you'll load the document object from AsciiDoc source + * using the primary API methods on {@link Asciidoctor}. + * When using one of these APIs, you almost always want to set the safe mode to 'safe' (or 'unsafe') + * to enable all of Asciidoctor's features. + * + *
    + *   var doc = Asciidoctor.load('= Hello, AsciiDoc!', {'safe': 'safe'});
    + *   // => Asciidoctor::Document { doctype: "article", doctitle: "Hello, Asciidoc!", blocks: 0 }
    + * 
    + * + * Instances of this class can be used to extract information from the document or alter its structure. + * As such, the Document object is most often used in extensions and by integrations. + * + * The most basic usage of the Document object is to retrieve the document's title. + * + *
    + *  var source = '= Document Title';
    + *  var doc = asciidoctor.load(source, {'safe': 'safe'});
    + *  console.log(doc.getTitle()); // 'Document Title'
    + * 
    + * + * You can also use the Document object to access document attributes defined in the header, such as the author and doctype. + * @namespace + * @extends AbstractBlock + */ + +var Document = Opal.Asciidoctor.Document; + +/** + * Returns a JSON {Object} of ids captured by the processor. + * + * @returns {Object} - returns a JSON {Object} of ids in the document. + * @memberof Document + */ +Document.prototype.getIds = function () { + return fromHash(this.catalog.$$smap.ids); +}; + +/** + * Returns a JSON {Object} of references captured by the processor. + * + * @returns {Object} - returns a JSON {Object} of {AbstractNode} in the document. + * @memberof Document + */ +Document.prototype.getRefs = function () { + return fromHash(this.catalog.$$smap.refs); +}; + +/** + * Returns an {Array} of Document/ImageReference} captured by the processor. + * + * @returns {Array} - returns an {Array} of {Document/ImageReference} in the document. + * Will return an empty array if the option "catalog_assets: true" was not defined on the processor. + * @memberof Document + */ +Document.prototype.getImages = function () { + return this.catalog.$$smap.images; +}; + +/** + * Returns an {Array} of index terms captured by the processor. + * + * @returns {Array} - returns an {Array} of index terms in the document. + * Will return an empty array if the function was called before the document was converted. + * @memberof Document + */ +Document.prototype.getIndexTerms = function () { + return this.catalog.$$smap.indexterms; +}; + +/** + * Returns an {Array} of links captured by the processor. + * + * @returns {Array} - returns an {Array} of links in the document. + * Will return an empty array if: + * - the function was called before the document was converted + * - the option "catalog_assets: true" was not defined on the processor + * @memberof Document + */ +Document.prototype.getLinks = function () { + return this.catalog.$$smap.links; +}; + +/** + * @returns {boolean} - returns true if the document has footnotes otherwise false + * @memberof Document + */ +Document.prototype.hasFootnotes = function () { + return this['$footnotes?'](); +}; + +/** + * Returns an {Array} of {Document/Footnote} captured by the processor. + * + * @returns {Array} - returns an {Array} of {Document/Footnote} in the document. + * Will return an empty array if the function was called before the document was converted. + * @memberof Document + */ +Document.prototype.getFootnotes = function () { + return this.$footnotes(); +}; + +/** + * @returns {string} - returns the level-0 section + * @memberof Document + */ +Document.prototype.getHeader = function () { + return this.header; +}; + +/** + * @memberof Document + */ +Document.prototype.setAttribute = function (name, value) { + return this.$set_attribute(name, value); +}; + +/** + + * @memberof Document + */ +Document.prototype.removeAttribute = function (name) { + this.attributes.$delete(name); + this.attribute_overrides.$delete(name); +}; + +/** + * @memberof Document + */ +Document.prototype.convert = function (options) { + var result = this.$convert(toHash(options)); + return result === Opal.nil ? '' : result; +}; + +/** + * @memberof Document + */ +Document.prototype.write = function (output, target) { + return this.$write(output, target); +}; + +/** + * @returns {string} - returns the full name of the author as a String + * @memberof Document + */ +Document.prototype.getAuthor = function () { + return this.$author(); +}; + +/** + * @memberof Document + */ +Document.prototype.getSource = function () { + return this.$source(); +}; + +/** + * @memberof Document + */ +Document.prototype.getSourceLines = function () { + return this.$source_lines(); +}; + +/** + * @memberof Document + */ +Document.prototype.isNested = function () { + return this['$nested?'](); +}; + +/** + * @memberof Document + */ +Document.prototype.isEmbedded = function () { + return this['$embedded?'](); +}; + +/** + * @memberof Document + */ +Document.prototype.hasExtensions = function () { + return this['$extensions?'](); +}; + +/** + * @memberof Document + */ +Document.prototype.getDoctype = function () { + return this.doctype; +}; + +/** + * @memberof Document + */ +Document.prototype.getBackend = function () { + return this.backend; +}; + +/** + * @memberof Document + */ +Document.prototype.isBasebackend = function (base) { + return this['$basebackend?'](base); +}; + +/** + * Get the title explicitly defined in the document attributes. + * @returns {string} + * @see {@link AbstractNode#getAttributes} + * @memberof Document + */ +Document.prototype.getTitle = function () { + var title = this.$title(); + return title === Opal.nil ? undefined : title; +}; + +/** + * @memberof Document + */ +Document.prototype.setTitle = function (title) { + return this['$title='](title); +}; + +/** + * @memberof Document + * @returns {Document/Title} - returns a {@link Document/Title} + */ +Document.prototype.getDocumentTitle = function (options) { + var doctitle = this.$doctitle(toHash(options)); + return doctitle === Opal.nil ? undefined : doctitle; +}; + +/** + * @memberof Document + * @see {@link Document#getDocumentTitle} + */ +Document.prototype.getDoctitle = Document.prototype.getDocumentTitle; + +/** + * Get the document catalog Hash. + * @memberof Document + */ +Document.prototype.getCatalog = function () { + return fromHash(this.catalog); +}; + +/** + * @memberof Document + */ +Document.prototype.getReferences = Document.prototype.getCatalog; + +/** + * Get the document revision date from document header (document attribute revdate). + * @memberof Document + */ +Document.prototype.getRevisionDate = function () { + return this.getAttribute('revdate'); +}; + +/** + * @memberof Document + * @see Document#getRevisionDate + */ +Document.prototype.getRevdate = function () { + return this.getRevisionDate(); +}; + +/** + * Get the document revision number from document header (document attribute revnumber). + * @memberof Document + */ +Document.prototype.getRevisionNumber = function () { + return this.getAttribute('revnumber'); +}; + +/** + * Get the document revision remark from document header (document attribute revremark). + * @memberof Document + */ +Document.prototype.getRevisionRemark = function () { + return this.getAttribute('revremark'); +}; + + +/** + * Assign a value to the specified attribute in the document header. + * + * The assignment will be visible when the header attributes are restored, + * typically between processor phases (e.g., between parse and convert). + * + * @param {string} name - The {string} attribute name to assign + * @param {Object} value - The {Object} value to assign to the attribute (default: '') + * @param {boolean} overwrite - A {boolean} indicating whether to assign the attribute + * if already present in the attributes Hash (default: true) + * + * @memberof Document + * @returns {boolean} - returns true if the assignment was performed otherwise false + */ +Document.prototype.setHeaderAttribute = function (name, value, overwrite) { + if (typeof overwrite === 'undefined') overwrite = true; + if (typeof value === 'undefined') value = ''; + return this.$set_header_attribute(name, value, overwrite); +}; + +/** + * Convenience method to retrieve the authors of this document as an {Array} of {Document/Author} objects. + * + * This method is backed by the author-related attributes on the document. + * + * @memberof Document + * @returns {Array} - returns an {Array} of {Document/Author} objects. + */ +Document.prototype.getAuthors = function () { + return this.$authors(); +}; + +// Document.Footnote API + +/** + * @namespace + * @module Document/Footnote + */ +var Footnote = Document.Footnote; + +/** + * @memberof Document/Footnote + * @returns {number} - returns the footnote's index + */ +Footnote.prototype.getIndex = function () { + var index = this.$$data.index; + return index === Opal.nil ? undefined : index; +}; + +/** + * @memberof Document/Footnote + * @returns {string} - returns the footnote's id + */ +Footnote.prototype.getId = function () { + var id = this.$$data.id; + return id === Opal.nil ? undefined : id; +}; + +/** + * @memberof Document/Footnote + * @returns {string} - returns the footnote's text + */ +Footnote.prototype.getText = function () { + var text = this.$$data.text; + return text === Opal.nil ? undefined : text; +}; + +// Document.ImageReference API + +/** + * @namespace + * @module Document/ImageReference + */ +var ImageReference = Document.ImageReference; + +/** + * @memberof Document/ImageReference + * @returns {string} - returns the image's target + */ +ImageReference.prototype.getTarget = function () { + return this.$$data.target; +}; + +/** + * @memberof Document/ImageReference + * @returns {string} - returns the image's directory (imagesdir attribute) + */ +ImageReference.prototype.getImagesDirectory = function () { + var value = this.$$data.imagesdir; + return value === Opal.nil ? undefined : value; +}; + +// Document.Author API + +/** + * @namespace + * @module Document/Author + */ +var Author = Document.Author; + +/** + * @memberof Document/Author + * @returns {string} - returns the author's full name + */ +Author.prototype.getName = function () { + var name = this.$$data.name; + return name === Opal.nil ? undefined : name; +}; + +/** + * @memberof Document/Author + * @returns {string} - returns the author's first name + */ +Author.prototype.getFirstName = function () { + var firstName = this.$$data.firstname; + return firstName === Opal.nil ? undefined : firstName; +}; + +/** + * @memberof Document/Author + * @returns {string} - returns the author's middle name (or undefined if the author has no middle name) + */ +Author.prototype.getMiddleName = function () { + var middleName = this.$$data.middlename; + return middleName === Opal.nil ? undefined : middleName; +}; + +/** + * @memberof Document/Author + * @returns {string} - returns the author's last name + */ +Author.prototype.getLastName = function () { + var lastName = this.$$data.lastname; + return lastName === Opal.nil ? undefined : lastName; +}; + +/** + * @memberof Document/Author + * @returns {string} - returns the author's initials (by default based on the author's name) + */ +Author.prototype.getInitials = function () { + var initials = this.$$data.initials; + return initials === Opal.nil ? undefined : initials; +}; + +/** + * @memberof Document/Author + * @returns {string} - returns the author's email + */ +Author.prototype.getEmail = function () { + var email = this.$$data.email; + return email === Opal.nil ? undefined : email; +}; + +// private constructor +Document.RevisionInfo = function (date, number, remark) { + this.date = date; + this.number = number; + this.remark = remark; +}; + +/** + * @class + * @namespace + * @module Document/RevisionInfo + */ +var RevisionInfo = Document.RevisionInfo; + +/** + * Get the document revision date from document header (document attribute revdate). + * @memberof Document/RevisionInfo + */ +RevisionInfo.prototype.getDate = function () { + return this.date; +}; + +/** + * Get the document revision number from document header (document attribute revnumber). + * @memberof Document/RevisionInfo + */ +RevisionInfo.prototype.getNumber = function () { + return this.number; +}; + +/** + * Get the document revision remark from document header (document attribute revremark). + * A short summary of changes in this document revision. + * @memberof Document/RevisionInfo + */ +RevisionInfo.prototype.getRemark = function () { + return this.remark; +}; + +/** + * @memberof Document/RevisionInfo + * @returns {boolean} - returns true if the revision info is empty (ie. not defined), otherwise false + */ +RevisionInfo.prototype.isEmpty = function () { + return this.date === undefined && this.number === undefined && this.remark === undefined; +}; + +/** + * @memberof Document + * @returns {Document/RevisionInfo} - returns a {@link Document/RevisionInfo} + */ +Document.prototype.getRevisionInfo = function () { + return new Document.RevisionInfo(this.getRevisionDate(), this.getRevisionNumber(), this.getRevisionRemark()); +}; + +/** + * @memberof Document + * @returns {boolean} - returns true if the document contains revision info, otherwise false + */ +Document.prototype.hasRevisionInfo = function () { + var revisionInfo = this.getRevisionInfo(); + return !revisionInfo.isEmpty(); +}; + +/** + * @memberof Document + */ +Document.prototype.getNotitle = function () { + return this.$notitle(); +}; + +/** + * @memberof Document + */ +Document.prototype.getNoheader = function () { + return this.$noheader(); +}; + +/** + * @memberof Document + */ +Document.prototype.getNofooter = function () { + return this.$nofooter(); +}; + +/** + * @memberof Document + */ +Document.prototype.hasHeader = function () { + return this['$header?'](); +}; + +/** + * @memberof Document + */ +Document.prototype.deleteAttribute = function (name) { + return this.$delete_attribute(name); +}; + +/** + * @memberof Document + */ +Document.prototype.isAttributeLocked = function (name) { + return this['$attribute_locked?'](name); +}; + +/** + * @memberof Document + */ +Document.prototype.parse = function (data) { + return this.$parse(data); +}; + +/** + * @memberof Document + */ +Document.prototype.getDocinfo = function (docinfoLocation, suffix) { + return this.$docinfo(docinfoLocation, suffix); +}; + +/** + * @memberof Document + */ +Document.prototype.hasDocinfoProcessors = function (docinfoLocation) { + return this['$docinfo_processors?'](docinfoLocation); +}; + +/** + * @memberof Document + */ +Document.prototype.counterIncrement = function (counterName, block) { + return this.$counter_increment(counterName, block); +}; + +/** + * @memberof Document + */ +Document.prototype.counter = function (name, seed) { + return this.$counter(name, seed); +}; + +/** + * @memberof Document + */ +Document.prototype.getSafe = function () { + return this.safe; +}; + +/** + * @memberof Document + */ +Document.prototype.getCompatMode = function () { + return this.compat_mode; +}; + +/** + * @memberof Document + */ +Document.prototype.getSourcemap = function () { + return this.sourcemap; +}; + +/** + * @memberof Document + */ +Document.prototype.getCounters = function () { + return fromHash(this.counters); +}; + +/** + * @memberof Document + */ +Document.prototype.getCallouts = function () { + return this.$callouts(); +}; + +/** + * @memberof Document + */ +Document.prototype.getBaseDir = function () { + return this.base_dir; +}; + +/** + * @memberof Document + */ +Document.prototype.getOptions = function () { + return fromHash(this.options); +}; + +/** + * @memberof Document + */ +Document.prototype.getOutfilesuffix = function () { + return this.outfilesuffix; +}; + +/** + * @memberof Document + */ +Document.prototype.getParentDocument = function () { + return this.parent_document; +}; + +/** + * @memberof Document + */ +Document.prototype.getReader = function () { + return this.reader; +}; + +/** + * @memberof Document + */ +Document.prototype.getConverter = function () { + return this.converter; +}; + +/** + * @memberof Document + */ +Document.prototype.getExtensions = function () { + return this.extensions; +}; + +// Document.Title API + +/** + * @namespace + * @module Document/Title + */ +var Title = Document.Title; + +/** + * @memberof Document/Title + */ +Title.prototype.getMain = function () { + return this.main; +}; + +/** + * @memberof Document/Title + */ +Title.prototype.getCombined = function () { + return this.combined; +}; + +/** + * @memberof Document/Title + */ +Title.prototype.getSubtitle = function () { + var subtitle = this.subtitle; + return subtitle === Opal.nil ? undefined : subtitle; +}; + +/** + * @memberof Document/Title + */ +Title.prototype.isSanitized = function () { + var sanitized = this['$sanitized?'](); + return sanitized === Opal.nil ? false : sanitized; +}; + +/** + * @memberof Document/Title + */ +Title.prototype.hasSubtitle = function () { + return this['$subtitle?'](); +}; + +// Inline API + +/** + * @namespace + * @extends AbstractNode + */ +var Inline = Opal.Asciidoctor.Inline; + +/** + * Create a new Inline element. + * + * @memberof Inline + * @returns {Inline} - returns a new Inline element + */ +Opal.Asciidoctor.Inline['$$class'].prototype.create = function (parent, context, text, opts) { + return this.$new(parent, context, text, toHash(opts)); +}; + +/** + * Get the converted content for this inline node. + * + * @memberof Inline + * @returns {string} - returns the converted String content for this inline node + */ +Inline.prototype.convert = function () { + return this.$convert(); +}; + +/** + * Get the converted String text of this Inline node, if applicable. + * + * @memberof Inline + * @returns {string} - returns the converted String text for this Inline node, or undefined if not applicable for this node. + */ +Inline.prototype.getText = function () { + var text = this.$text(); + return text === Opal.nil ? undefined : text; +}; + +/** + * Get the String sub-type (aka qualifier) of this Inline node. + * + * This value is used to distinguish different variations of the same node + * category, such as different types of anchors. + * + * @memberof Inline + * @returns {string} - returns the string sub-type of this Inline node. + */ +Inline.prototype.getType = function () { + return this.$type(); +}; + +/** + * Get the primary String target of this Inline node. + * + * @memberof Inline + * @returns {string} - returns the string target of this Inline node. + */ +Inline.prototype.getTarget = function () { + var target = this.$target(); + return target === Opal.nil ? undefined : target; +}; + +// List API + +/** @namespace */ +var List = Opal.Asciidoctor.List; + +/** + * Get the Array of {@link ListItem} nodes for this {@link List}. + * + * @memberof List + * @returns {Array} - returns an Array of {@link ListItem} nodes. + */ +List.prototype.getItems = function () { + return this.blocks; +}; + +// ListItem API + +/** @namespace */ +var ListItem = Opal.Asciidoctor.ListItem; + +/** + * Get the converted String text of this ListItem node. + * + * @memberof ListItem + * @returns {string} - returns the converted String text for this ListItem node. + */ +ListItem.prototype.getText = function () { + return this.$text(); +}; + +/** + * Set the String source text of this ListItem node. + * + * @memberof ListItem + */ +ListItem.prototype.setText = function (text) { + return this.text = text; +}; + +// Reader API + +/** @namespace */ +var Reader = Opal.Asciidoctor.Reader; + +/** + * @memberof Reader + */ +Reader.prototype.pushInclude = function (data, file, path, lineno, attributes) { + return this.$push_include(data, file, path, lineno, toHash(attributes)); +}; + +/** + * Get the current location of the reader's cursor, which encapsulates the + * file, dir, path, and lineno of the file being read. + * + * @memberof Reader + */ +Reader.prototype.getCursor = function () { + return this.$cursor(); +}; + +/** + * Get a copy of the remaining {Array} of String lines managed by this Reader. + * + * @memberof Reader + * @returns {Array} - returns A copy of the String {Array} of lines remaining in this Reader. + */ +Reader.prototype.getLines = function () { + return this.$lines(); +}; + +/** + * Get the remaining lines managed by this Reader as a String. + * + * @memberof Reader + * @returns {string} - returns The remaining lines managed by this Reader as a String (joined by linefeed characters). + */ +Reader.prototype.getString = function () { + return this.$string(); +}; + +// Cursor API + +/** @namespace */ +var Cursor = Opal.Asciidoctor.Reader.Cursor; + +/** + * Get the file associated to the cursor. + * @memberof Cursor + */ +Cursor.prototype.getFile = function () { + var file = this.file; + return file === Opal.nil ? undefined : file; +}; + +/** + * Get the directory associated to the cursor. + * @memberof Cursor + * @returns {string} - returns the directory associated to the cursor + */ +Cursor.prototype.getDirectory = function () { + var dir = this.dir; + return dir === Opal.nil ? undefined : dir; +}; + +/** + * Get the path associated to the cursor. + * @memberof Cursor + * @returns {string} - returns the path associated to the cursor (or '') + */ +Cursor.prototype.getPath = function () { + var path = this.path; + return path === Opal.nil ? undefined : path; +}; + +/** + * Get the line number of the cursor. + * @memberof Cursor + * @returns {number} - returns the line number of the cursor + */ +Cursor.prototype.getLineNumber = function () { + return this.lineno; +}; + +// Logger API (available in Asciidoctor 1.5.7+) + +function initializeLoggerFormatterClass (className, functions) { + var superclass = Opal.const_get_qualified(Opal.Logger, 'Formatter'); + return initializeClass(superclass, className, functions, {}, { + 'call': function (args) { + for (var i = 0; i < args.length; i++) { + // convert all (Opal) Hash arguments to JSON. + if (typeof args[i] === 'object' && '$$smap' in args[i]) { + args[i] = fromHash(args[i]); + } + } + return args; + } + }); +} + +function initializeLoggerClass (className, functions) { + var superClass = Opal.const_get_qualified(Opal.Asciidoctor, 'Logger'); + return initializeClass(superClass, className, functions, {}, { + 'add': function (args) { + if (args.length >= 2 && typeof args[2] === 'object' && '$$smap' in args[2]) { + var message = args[2]; + var messageObject = fromHash(message); + messageObject.getText = function () { + return this['text']; + }; + messageObject.getSourceLocation = function () { + return this['source_location']; + }; + messageObject['$inspect'] = function () { + var sourceLocation = this.getSourceLocation(); + if (sourceLocation) { + return sourceLocation.getPath() + ': line ' + sourceLocation.getLineNumber() + ': ' + this.getText(); + } else { + return this.getText(); + } + }; + args[2] = messageObject; + } + return args; + } + }); +} + +/** + * @namespace + */ +var LoggerManager = Opal.const_get_qualified(Opal.Asciidoctor, 'LoggerManager', true); + +// Alias +Opal.Asciidoctor.LoggerManager = LoggerManager; + +if (LoggerManager) { + LoggerManager.getLogger = function () { + return this.$logger(); + }; + + LoggerManager.setLogger = function (logger) { + this.logger = logger; + }; + + LoggerManager.newLogger = function (name, functions) { + return initializeLoggerClass(name, functions).$new(); + }; + + LoggerManager.newFormatter = function (name, functions) { + return initializeLoggerFormatterClass(name, functions).$new(); + }; +} + +/** + * @namespace + */ +var LoggerSeverity = Opal.const_get_qualified(Opal.Logger, 'Severity', true); + +// Alias +Opal.Asciidoctor.LoggerSeverity = LoggerSeverity; + +if (LoggerSeverity) { + LoggerSeverity.get = function (severity) { + return LoggerSeverity.$constants()[severity]; + }; +} + +/** + * @namespace + */ +var LoggerFormatter = Opal.const_get_qualified(Opal.Logger, 'Formatter', true); + + +// Alias +Opal.Asciidoctor.LoggerFormatter = LoggerFormatter; + +if (LoggerFormatter) { + LoggerFormatter.prototype.call = function (severity, time, programName, message) { + return this.$call(LoggerSeverity.get(severity), time, programName, message); + }; +} + +/** + * @namespace + */ +var MemoryLogger = Opal.const_get_qualified(Opal.Asciidoctor, 'MemoryLogger', true); + +// Alias +Opal.Asciidoctor.MemoryLogger = MemoryLogger; + +if (MemoryLogger) { + MemoryLogger.prototype.getMessages = function () { + var messages = this.messages; + var result = []; + for (var i = 0; i < messages.length; i++) { + var message = messages[i]; + var messageObject = fromHash(message); + if (typeof messageObject.message === 'string') { + messageObject.getText = function () { + return this.message; + }; + } else { + // also convert the message attribute + messageObject.message = fromHash(messageObject.message); + messageObject.getText = function () { + return this.message['text']; + }; + } + messageObject.getSeverity = function () { + return this.severity.toString(); + }; + messageObject.getSourceLocation = function () { + return this.message['source_location']; + }; + result.push(messageObject); + } + return result; + }; +} + +/** + * @namespace + */ +var Logger = Opal.const_get_qualified(Opal.Asciidoctor, 'Logger', true); + +// Alias +Opal.Asciidoctor.Logger = Logger; + +if (Logger) { + Logger.prototype.getMaxSeverity = function () { + return this.max_severity; + }; + Logger.prototype.getFormatter = function () { + return this.formatter; + }; + Logger.prototype.setFormatter = function (formatter) { + return this.formatter = formatter; + }; + Logger.prototype.getLevel = function () { + return this.level; + }; + Logger.prototype.setLevel = function (level) { + return this.level = level; + }; + Logger.prototype.getProgramName = function () { + return this.progname; + }; + Logger.prototype.setProgramName = function (programName) { + return this.progname = programName; + }; +} + +/** + * @namespace + */ +var NullLogger = Opal.const_get_qualified(Opal.Asciidoctor, 'NullLogger', true); + +// Alias +Opal.Asciidoctor.NullLogger = NullLogger; + + +if (NullLogger) { + NullLogger.prototype.getMaxSeverity = function () { + return this.max_severity; + }; +} + + +// Alias +Opal.Asciidoctor.StopIteration = Opal.StopIteration; + +// Extensions API + +/** + * @private + */ +var toBlock = function (block) { + // arity is a mandatory field + block.$$arity = block.length; + return block; +}; + +var registerExtension = function (registry, type, processor, name) { + if (typeof processor === 'object' || processor.$$is_class) { + // processor is an instance or a class + return registry['$' + type](processor, name); + } else { + // processor is a function/lambda + return Opal.send(registry, type, name && [name], toBlock(processor)); + } +}; + +/** + * @namespace + * @description + * Extensions provide a way to participate in the parsing and converting + * phases of the AsciiDoc processor or extend the AsciiDoc syntax. + * + * The various extensions participate in AsciiDoc processing as follows: + * + * 1. After the source lines are normalized, {{@link Extensions/Preprocessor}}s modify or replace + * the source lines before parsing begins. {{@link Extensions/IncludeProcessor}}s are used to + * process include directives for targets which they claim to handle. + * 2. The Parser parses the block-level content into an abstract syntax tree. + * Custom blocks and block macros are processed by associated {{@link Extensions/BlockProcessor}}s + * and {{@link Extensions/BlockMacroProcessor}}s, respectively. + * 3. {{@link Extensions/TreeProcessor}}s are run on the abstract syntax tree. + * 4. Conversion of the document begins, at which point inline markup is processed + * and converted. Custom inline macros are processed by associated {InlineMacroProcessor}s. + * 5. {{@link Extensions/Postprocessor}}s modify or replace the converted document. + * 6. The output is written to the output stream. + * + * Extensions may be registered globally using the {Extensions.register} method + * or added to a custom {Registry} instance and passed as an option to a single + * Asciidoctor processor. + * + * @example + * Opal.Asciidoctor.Extensions.register(function () { + * this.block(function () { + * var self = this; + * self.named('shout'); + * self.onContext('paragraph'); + * self.process(function (parent, reader) { + * var lines = reader.getLines().map(function (l) { return l.toUpperCase(); }); + * return self.createBlock(parent, 'paragraph', lines); + * }); + * }); + * }); + */ +var Extensions = Opal.const_get_qualified(Opal.Asciidoctor, 'Extensions'); + +// Alias +Opal.Asciidoctor.Extensions = Extensions; + +/** + * Create a new {@link Extensions/Registry}. + * @param {string} name + * @param {function} block + * @memberof Extensions + * @returns {Extensions/Registry} - returns a {@link Extensions/Registry} + */ +Extensions.create = function (name, block) { + if (typeof name === 'function' && typeof block === 'undefined') { + return Opal.send(this, 'build_registry', null, toBlock(name)); + } else if (typeof block === 'function') { + return Opal.send(this, 'build_registry', [name], toBlock(block)); + } else { + return this.$build_registry(); + } +}; + +/** + * @memberof Extensions + */ +Extensions.register = function (name, block) { + if (typeof name === 'function' && typeof block === 'undefined') { + return Opal.send(this, 'register', null, toBlock(name)); + } else { + return Opal.send(this, 'register', [name], toBlock(block)); + } +}; + +/** + * Get statically-registerd extension groups. + * @memberof Extensions + */ +Extensions.getGroups = function () { + return fromHash(this.$groups()); +}; + +/** + * Unregister all statically-registered extension groups. + * @memberof Extensions + */ +Extensions.unregisterAll = function () { + this.$unregister_all(); +}; + +/** + * Unregister the specified statically-registered extension groups. + * + * NOTE Opal cannot delete an entry from a Hash that is indexed by symbol, so + * we have to resort to using low-level operations in this method. + * + * @memberof Extensions + */ +Extensions.unregister = function () { + var names = Array.prototype.concat.apply([], arguments); + var groups = this.$groups(); + var groupNameIdx = {}; + for (var i = 0, groupSymbolNames = groups.$$keys; i < groupSymbolNames.length; i++) { + var groupSymbolName = groupSymbolNames[i]; + groupNameIdx[groupSymbolName.toString()] = groupSymbolName; + } + for (var j = 0; j < names.length; j++) { + var groupStringName = names[j]; + if (groupStringName in groupNameIdx) Opal.hash_delete(groups, groupNameIdx[groupStringName]); + } +}; + +/** + * @namespace + * @module Extensions/Registry + */ +var Registry = Extensions.Registry; + +/** + * @memberof Extensions/Registry + */ +Registry.prototype.getGroups = Extensions.getGroups; + +/** + * @memberof Extensions/Registry + */ +Registry.prototype.unregisterAll = function () { + this.groups = Opal.hash(); +}; + +/** + * @memberof Extensions/Registry + */ +Registry.prototype.unregister = Extensions.unregister; + +/** + * @memberof Extensions/Registry + */ +Registry.prototype.prefer = function (name, processor) { + if (arguments.length === 1) { + processor = name; + name = null; + } + if (typeof processor === 'object' || processor.$$is_class) { + // processor is an instance or a class + return this['$prefer'](name, processor); + } else { + // processor is a function/lambda + return Opal.send(this, 'prefer', name && [name], toBlock(processor)); + } +}; + +/** + * @memberof Extensions/Registry + */ +Registry.prototype.block = function (name, processor) { + if (arguments.length === 1) { + processor = name; + name = null; + } + return registerExtension(this, 'block', processor, name); +}; + +/** + * @memberof Extensions/Registry + */ +Registry.prototype.inlineMacro = function (name, processor) { + if (arguments.length === 1) { + processor = name; + name = null; + } + return registerExtension(this, 'inline_macro', processor, name); +}; + +/** + * @memberof Extensions/Registry + */ +Registry.prototype.includeProcessor = function (name, processor) { + if (arguments.length === 1) { + processor = name; + name = null; + } + return registerExtension(this, 'include_processor', processor, name); +}; + +/** + * @memberof Extensions/Registry + */ +Registry.prototype.blockMacro = function (name, processor) { + if (arguments.length === 1) { + processor = name; + name = null; + } + return registerExtension(this, 'block_macro', processor, name); +}; + +/** + * @memberof Extensions/Registry + */ +Registry.prototype.treeProcessor = function (name, processor) { + if (arguments.length === 1) { + processor = name; + name = null; + } + return registerExtension(this, 'tree_processor', processor, name); +}; + +/** + * @memberof Extensions/Registry + */ +Registry.prototype.postprocessor = function (name, processor) { + if (arguments.length === 1) { + processor = name; + name = null; + } + return registerExtension(this, 'postprocessor', processor, name); +}; + +/** + * @memberof Extensions/Registry + */ +Registry.prototype.preprocessor = function (name, processor) { + if (arguments.length === 1) { + processor = name; + name = null; + } + return registerExtension(this, 'preprocessor', processor, name); +}; + +/** + * @memberof Extensions/Registry + */ + +Registry.prototype.docinfoProcessor = function (name, processor) { + if (arguments.length === 1) { + processor = name; + name = null; + } + return registerExtension(this, 'docinfo_processor', processor, name); +}; + +/** + * @namespace + * @module Extensions/Processor + */ +var Processor = Extensions.Processor; + +/** + * The extension will be added to the beginning of the list for that extension type. (default is append). + * @memberof Extensions/Processor + * @deprecated Please use the prefer function on the {@link Extensions/Registry}, + * the {@link Extensions/IncludeProcessor}, + * the {@link Extensions/TreeProcessor}, + * the {@link Extensions/Postprocessor}, + * the {@link Extensions/Preprocessor} + * or the {@link Extensions/DocinfoProcessor} + */ +Processor.prototype.prepend = function () { + this.$option('position', '>>'); +}; + +/** + * @memberof Extensions/Processor + */ +Processor.prototype.process = function (block) { + var handler = { + apply: function (target, thisArg, argumentsList) { + for (var i = 0; i < argumentsList.length; i++) { + // convert all (Opal) Hash arguments to JSON. + if (typeof argumentsList[i] === 'object' && '$$smap' in argumentsList[i]) { + argumentsList[i] = fromHash(argumentsList[i]); + } + } + return target.apply(thisArg, argumentsList); + } + }; + var blockProxy = new Proxy(block, handler); + return Opal.send(this, 'process', null, toBlock(blockProxy)); +}; + +/** + * @memberof Extensions/Processor + */ +Processor.prototype.named = function (name) { + return this.$named(name); +}; + +/** + * @memberof Extensions/Processor + */ +Processor.prototype.createBlock = function (parent, context, source, attrs, opts) { + return this.$create_block(parent, context, source, toHash(attrs), toHash(opts)); +}; + +/** + * Creates a list block node and links it to the specified parent. + * + * @param parent - The parent Block (Block, Section, or Document) of this new list block. + * @param {string} context - The list context (e.g., ulist, olist, colist, dlist) + * @param {Object} attrs - An object of attributes to set on this list block + * + * @memberof Extensions/Processor + */ +Processor.prototype.createList = function (parent, context, attrs) { + return this.$create_list(parent, context, toHash(attrs)); +}; + +/** + * Creates a list item node and links it to the specified parent. + * + * @param parent - The parent List of this new list item block. + * @param {string} text - The text of the list item. + * + * @memberof Extensions/Processor + */ +Processor.prototype.createListItem = function (parent, text) { + return this.$create_list_item(parent, text); +}; + +/** + * @memberof Extensions/Processor + */ +Processor.prototype.createImageBlock = function (parent, attrs, opts) { + return this.$create_image_block(parent, toHash(attrs), toHash(opts)); +}; + +/** + * @memberof Extensions/Processor + */ +Processor.prototype.createInline = function (parent, context, text, opts) { + if (opts && opts.attributes) { + opts.attributes = toHash(opts.attributes); + } + return this.$create_inline(parent, context, text, toHash(opts)); +}; + +/** + * @memberof Extensions/Processor + */ +Processor.prototype.parseContent = function (parent, content, attrs) { + return this.$parse_content(parent, content, attrs); +}; + +/** + * @memberof Extensions/Processor + */ +Processor.prototype.positionalAttributes = function (value) { + return this.$positional_attrs(value); +}; + +/** + * @memberof Extensions/Processor + */ +Processor.prototype.resolvesAttributes = function (args) { + return this.$resolves_attributes(args); +}; + +/** + * @namespace + * @module Extensions/BlockProcessor + */ +var BlockProcessor = Extensions.BlockProcessor; + +/** + * @memberof Extensions/BlockProcessor + */ +BlockProcessor.prototype.onContext = function (context) { + return this.$on_context(context); +}; + +/** + * @memberof Extensions/BlockProcessor + */ +BlockProcessor.prototype.onContexts = function () { + return this.$on_contexts(Array.prototype.slice.call(arguments)); +}; + +/** + * @memberof Extensions/BlockProcessor + */ +BlockProcessor.prototype.getName = function () { + var name = this.name; + return name === Opal.nil ? undefined : name; +}; + +/** + * @namespace + * @module Extensions/BlockMacroProcessor + */ +var BlockMacroProcessor = Extensions.BlockMacroProcessor; + +/** + * @memberof Extensions/BlockMacroProcessor + */ +BlockMacroProcessor.prototype.getName = function () { + var name = this.name; + return name === Opal.nil ? undefined : name; +}; + +/** + * @namespace + * @module Extensions/InlineMacroProcessor + */ +var InlineMacroProcessor = Extensions.InlineMacroProcessor; + +/** + * @memberof Extensions/InlineMacroProcessor + */ +InlineMacroProcessor.prototype.getName = function () { + var name = this.name; + return name === Opal.nil ? undefined : name; +}; + +/** + * @namespace + * @module Extensions/IncludeProcessor + */ +var IncludeProcessor = Extensions.IncludeProcessor; + +/** + * @memberof Extensions/IncludeProcessor + */ +IncludeProcessor.prototype.handles = function (block) { + return Opal.send(this, 'handles?', null, toBlock(block)); +}; + +/** + * @memberof Extensions/IncludeProcessor + */ +IncludeProcessor.prototype.prefer = function () { + this.$prefer(); +}; + +/** + * @namespace + * @module Extensions/TreeProcessor + */ +// eslint-disable-next-line no-unused-vars +var TreeProcessor = Extensions.TreeProcessor; + +/** + * @memberof Extensions/TreeProcessor + */ +TreeProcessor.prototype.prefer = function () { + this.$prefer(); +}; + +/** + * @namespace + * @module Extensions/Postprocessor + */ +// eslint-disable-next-line no-unused-vars +var Postprocessor = Extensions.Postprocessor; + +/** + * @memberof Extensions/Postprocessor + */ +Postprocessor.prototype.prefer = function () { + this.$prefer(); +}; + +/** + * @namespace + * @module Extensions/Preprocessor + */ +// eslint-disable-next-line no-unused-vars +var Preprocessor = Extensions.Preprocessor; + +/** + * @memberof Extensions/Preprocessor + */ +Preprocessor.prototype.prefer = function () { + this.$prefer(); +}; + +/** + * @namespace + * @module Extensions/DocinfoProcessor + */ +var DocinfoProcessor = Extensions.DocinfoProcessor; + +/** + * @memberof Extensions/DocinfoProcessor + */ +DocinfoProcessor.prototype.prefer = function () { + this.$prefer(); +}; + +/** + * @memberof Extensions/DocinfoProcessor + */ +DocinfoProcessor.prototype.atLocation = function (value) { + this.$at_location(value); +}; + +function initializeProcessorClass (superclassName, className, functions) { + var superClass = Opal.const_get_qualified(Extensions, superclassName); + return initializeClass(superClass, className, functions, { + 'handles?': function () { + return true; + } + }); +} + +// Postprocessor + +/** + * Create a postprocessor + * @description this API is experimental and subject to change + * @memberof Extensions + */ +Extensions.createPostprocessor = function (name, functions) { + if (arguments.length === 1) { + functions = name; + name = null; + } + return initializeProcessorClass('Postprocessor', name, functions); +}; + +/** + * Create and instantiate a postprocessor + * @description this API is experimental and subject to change + * @memberof Extensions + */ +Extensions.newPostprocessor = function (name, functions) { + if (arguments.length === 1) { + functions = name; + name = null; + } + return this.createPostprocessor(name, functions).$new(); +}; + +// Preprocessor + +/** + * Create a preprocessor + * @description this API is experimental and subject to change + * @memberof Extensions + */ +Extensions.createPreprocessor = function (name, functions) { + if (arguments.length === 1) { + functions = name; + name = null; + } + return initializeProcessorClass('Preprocessor', name, functions); +}; + +/** + * Create and instantiate a preprocessor + * @description this API is experimental and subject to change + * @memberof Extensions + */ +Extensions.newPreprocessor = function (name, functions) { + if (arguments.length === 1) { + functions = name; + name = null; + } + return this.createPreprocessor(name, functions).$new(); +}; + +// Tree Processor + +/** + * Create a tree processor + * @description this API is experimental and subject to change + * @memberof Extensions + */ +Extensions.createTreeProcessor = function (name, functions) { + if (arguments.length === 1) { + functions = name; + name = null; + } + return initializeProcessorClass('TreeProcessor', name, functions); +}; + +/** + * Create and instantiate a tree processor + * @description this API is experimental and subject to change + * @memberof Extensions + */ +Extensions.newTreeProcessor = function (name, functions) { + if (arguments.length === 1) { + functions = name; + name = null; + } + return this.createTreeProcessor(name, functions).$new(); +}; + +// Include Processor + +/** + * Create an include processor + * @description this API is experimental and subject to change + * @memberof Extensions + */ +Extensions.createIncludeProcessor = function (name, functions) { + if (arguments.length === 1) { + functions = name; + name = null; + } + return initializeProcessorClass('IncludeProcessor', name, functions); +}; + +/** + * Create and instantiate an include processor + * @description this API is experimental and subject to change + * @memberof Extensions + */ +Extensions.newIncludeProcessor = function (name, functions) { + if (arguments.length === 1) { + functions = name; + name = null; + } + return this.createIncludeProcessor(name, functions).$new(); +}; + +// Docinfo Processor + +/** + * Create a Docinfo processor + * @description this API is experimental and subject to change + * @memberof Extensions + */ +Extensions.createDocinfoProcessor = function (name, functions) { + if (arguments.length === 1) { + functions = name; + name = null; + } + return initializeProcessorClass('DocinfoProcessor', name, functions); +}; + +/** + * Create and instantiate a Docinfo processor + * @description this API is experimental and subject to change + * @memberof Extensions + */ +Extensions.newDocinfoProcessor = function (name, functions) { + if (arguments.length === 1) { + functions = name; + name = null; + } + return this.createDocinfoProcessor(name, functions).$new(); +}; + +// Block Processor + +/** + * Create a block processor + * @description this API is experimental and subject to change + * @memberof Extensions + */ +Extensions.createBlockProcessor = function (name, functions) { + if (arguments.length === 1) { + functions = name; + name = null; + } + return initializeProcessorClass('BlockProcessor', name, functions); +}; + +/** + * Create and instantiate a block processor + * @description this API is experimental and subject to change + * @memberof Extensions + */ +Extensions.newBlockProcessor = function (name, functions) { + if (arguments.length === 1) { + functions = name; + name = null; + } + return this.createBlockProcessor(name, functions).$new(); +}; + +// Inline Macro Processor + +/** + * Create an inline macro processor + * @description this API is experimental and subject to change + * @memberof Extensions + */ +Extensions.createInlineMacroProcessor = function (name, functions) { + if (arguments.length === 1) { + functions = name; + name = null; + } + return initializeProcessorClass('InlineMacroProcessor', name, functions); +}; + +/** + * Create and instantiate an inline macro processor + * @description this API is experimental and subject to change + * @memberof Extensions + */ +Extensions.newInlineMacroProcessor = function (name, functions) { + if (arguments.length === 1) { + functions = name; + name = null; + } + return this.createInlineMacroProcessor(name, functions).$new(); +}; + +// Block Macro Processor + +/** + * Create a block macro processor + * @description this API is experimental and subject to change + * @memberof Extensions + */ +Extensions.createBlockMacroProcessor = function (name, functions) { + if (arguments.length === 1) { + functions = name; + name = null; + } + return initializeProcessorClass('BlockMacroProcessor', name, functions); +}; + +/** + * Create and instantiate a block macro processor + * @description this API is experimental and subject to change + * @memberof Extensions + */ +Extensions.newBlockMacroProcessor = function (name, functions) { + if (arguments.length === 1) { + functions = name; + name = null; + } + return this.createBlockMacroProcessor(name, functions).$new(); +}; + +// Converter API + +/** + * @namespace + * @module Converter + */ +var Converter = Opal.const_get_qualified(Opal.Asciidoctor, 'Converter'); + +// Alias +Opal.Asciidoctor.Converter = Converter; + +/** + * Convert the specified node. + * + * @param {AbstractNode} node - the AbstractNode to convert + * @param {string} transform - an optional String transform that hints at + * which transformation should be applied to this node. + * @param {Object} opts - a JSON of options that provide additional hints about + * how to convert the node (default: {}) + * @returns the {Object} result of the conversion, typically a {string}. + * @memberof Converter + */ +Converter.prototype.convert = function (node, transform, opts) { + return this.$convert(node, transform, toHash(opts)); +}; + +// The built-in converter doesn't include Converter, so we have to force it +Converter.BuiltIn.prototype.convert = Converter.prototype.convert; + +// Converter Factory API + +/** + * @namespace + * @module Converter/Factory + */ +var ConverterFactory = Opal.Asciidoctor.Converter.Factory; + +// Alias +Opal.Asciidoctor.ConverterFactory = ConverterFactory; + +/** + * Register a custom converter in the global converter factory to handle conversion to the specified backends. + * If the backend value is an asterisk, the converter is used to handle any backend that does not have an explicit converter. + * + * @param converter - The Converter instance to register + * @param backends {Array} - A {string} {Array} of backend names that this converter should be registered to handle (optional, default: ['*']) + * @return {*} - Returns nothing + * @memberof Converter/Factory + */ +ConverterFactory.register = function (converter, backends) { + if (typeof converter === 'object' && typeof converter.$convert === 'undefined' && typeof converter.convert === 'function') { + Opal.def(converter, '$convert', converter.convert); + } + return this.$register(converter, backends); +}; + +/** + * Retrieves the singleton instance of the converter factory. + * + * @param {boolean} initialize - instantiate the singleton if it has not yet + * been instantiated. If this value is false and the singleton has not yet been + * instantiated, this method returns a fresh instance. + * @returns {Converter/Factory} an instance of the converter factory. + * @memberof Converter/Factory + */ +ConverterFactory.getDefault = function (initialize) { + return this.$default(initialize); +}; + +/** + * Create an instance of the converter bound to the specified backend. + * + * @param {string} backend - look for a converter bound to this keyword. + * @param {Object} opts - a JSON of options to pass to the converter (default: {}) + * @returns {Converter} - a converter instance for converting nodes in an Asciidoctor AST. + * @memberof Converter/Factory + */ +ConverterFactory.prototype.create = function (backend, opts) { + return this.$create(backend, toHash(opts)); +}; + +// Built-in converter + +/** + * @namespace + * @module Converter/Html5Converter + */ +var Html5Converter = Opal.Asciidoctor.Converter.Html5Converter; + +// Alias +Opal.Asciidoctor.Html5Converter = Html5Converter; + + +Html5Converter.prototype.convert = function (node, transform, opts) { + return this.$convert(node, transform, opts); +}; + + +var ASCIIDOCTOR_JS_VERSION = '1.5.9'; + + /** + * Get Asciidoctor.js version number. + * + * @memberof Asciidoctor + * @returns {string} - returns the version number of Asciidoctor.js. + */ + Asciidoctor.prototype.getVersion = function () { + return ASCIIDOCTOR_JS_VERSION; + }; + return Opal.Asciidoctor; +})); diff --git a/node_modules/asciidoctor.js/dist/nashorn/asciidoctor.js b/node_modules/asciidoctor.js/dist/nashorn/asciidoctor.js new file mode 100644 index 0000000..eeb2cd7 --- /dev/null +++ b/node_modules/asciidoctor.js/dist/nashorn/asciidoctor.js @@ -0,0 +1,46043 @@ +(function(undefined) { + // @note + // A few conventions for the documentation of this file: + // 1. Always use "//" (in contrast with "/**/") + // 2. The syntax used is Yardoc (yardoc.org), which is intended for Ruby (se below) + // 3. `@param` and `@return` types should be preceded by `JS.` when referring to + // JavaScript constructors (e.g. `JS.Function`) otherwise Ruby is assumed. + // 4. `nil` and `null` being unambiguous refer to the respective + // objects/values in Ruby and JavaScript + // 5. This is still WIP :) so please give feedback and suggestions on how + // to improve or for alternative solutions + // + // The way the code is digested before going through Yardoc is a secret kept + // in the docs repo (https://github.com/opal/docs/tree/master). + + var global_object = this, console; + + // Detect the global object + if (typeof(global) !== 'undefined') { global_object = global; } + if (typeof(window) !== 'undefined') { global_object = window; } + + // Setup a dummy console object if missing + if (typeof(global_object.console) === 'object') { + console = global_object.console; + } else if (global_object.console == null) { + console = global_object.console = {}; + } else { + console = {}; + } + + if (!('log' in console)) { console.log = function () {}; } + if (!('warn' in console)) { console.warn = console.log; } + + if (typeof(this.Opal) !== 'undefined') { + console.warn('Opal already loaded. Loading twice can cause troubles, please fix your setup.'); + return this.Opal; + } + + var nil; + + // The actual class for BasicObject + var BasicObject; + + // The actual Object class. + // The leading underscore is to avoid confusion with window.Object() + var _Object; + + // The actual Module class + var Module; + + // The actual Class class + var Class; + + // The Opal object that is exposed globally + var Opal = this.Opal = {}; + + // This is a useful reference to global object inside ruby files + Opal.global = global_object; + global_object.Opal = Opal; + + // Configure runtime behavior with regards to require and unsupported fearures + Opal.config = { + missing_require_severity: 'error', // error, warning, ignore + unsupported_features_severity: 'warning', // error, warning, ignore + enable_stack_trace: true // true, false + } + + // Minify common function calls + var $hasOwn = Object.hasOwnProperty; + var $bind = Function.prototype.bind; + var $setPrototype = Object.setPrototypeOf; + var $slice = Array.prototype.slice; + + // Nil object id is always 4 + var nil_id = 4; + + // Generates even sequential numbers greater than 4 + // (nil_id) to serve as unique ids for ruby objects + var unique_id = nil_id; + + // Return next unique id + Opal.uid = function() { + unique_id += 2; + return unique_id; + }; + + // Retrieve or assign the id of an object + Opal.id = function(obj) { + if (obj.$$is_number) return (obj * 2)+1; + if (obj.$$id != null) { + return obj.$$id; + }; + $defineProperty(obj, '$$id', Opal.uid()); + return obj.$$id; + }; + + // Globals table + Opal.gvars = {}; + + // Exit function, this should be replaced by platform specific implementation + // (See nodejs and chrome for examples) + Opal.exit = function(status) { if (Opal.gvars.DEBUG) console.log('Exited with status '+status); }; + + // keeps track of exceptions for $! + Opal.exceptions = []; + + // @private + // Pops an exception from the stack and updates `$!`. + Opal.pop_exception = function() { + Opal.gvars["!"] = Opal.exceptions.pop() || nil; + } + + // Inspect any kind of object, including non Ruby ones + Opal.inspect = function(obj) { + if (obj === undefined) { + return "undefined"; + } + else if (obj === null) { + return "null"; + } + else if (!obj.$$class) { + return obj.toString(); + } + else { + return obj.$inspect(); + } + } + + function $defineProperty(object, name, initialValue) { + if (typeof(object) === "string") { + // Special case for: + // s = "string" + // def s.m; end + // String class is the only class that: + // + compiles to JS primitive + // + allows method definition directly on instances + // numbers, true, false and nil do not support it. + object[name] = initialValue; + } else { + Object.defineProperty(object, name, { + value: initialValue, + enumerable: false, + configurable: true, + writable: true + }); + } + } + + Opal.defineProperty = $defineProperty; + + Opal.slice = $slice; + + + // Truth + // ----- + + Opal.truthy = function(val) { + return (val !== nil && val != null && (!val.$$is_boolean || val == true)); + }; + + Opal.falsy = function(val) { + return (val === nil || val == null || (val.$$is_boolean && val == false)) + }; + + + // Constants + // --------- + // + // For future reference: + // - The Rails autoloading guide (http://guides.rubyonrails.org/v5.0/autoloading_and_reloading_constants.html) + // - @ConradIrwin's 2012 post on “Everything you ever wanted to know about constant lookup in Ruby” (http://cirw.in/blog/constant-lookup.html) + // + // Legend of MRI concepts/names: + // - constant reference (cref): the module/class that acts as a namespace + // - nesting: the namespaces wrapping the current scope, e.g. nesting inside + // `module A; module B::C; end; end` is `[B::C, A]` + + // Get the constant in the scope of the current cref + function const_get_name(cref, name) { + if (cref) return cref.$$const[name]; + } + + // Walk up the nesting array looking for the constant + function const_lookup_nesting(nesting, name) { + var i, ii, result, constant; + + if (nesting.length === 0) return; + + // If the nesting is not empty the constant is looked up in its elements + // and in order. The ancestors of those elements are ignored. + for (i = 0, ii = nesting.length; i < ii; i++) { + constant = nesting[i].$$const[name]; + if (constant != null) return constant; + } + } + + // Walk up the ancestors chain looking for the constant + function const_lookup_ancestors(cref, name) { + var i, ii, result, ancestors; + + if (cref == null) return; + + ancestors = Opal.ancestors(cref); + + for (i = 0, ii = ancestors.length; i < ii; i++) { + if (ancestors[i].$$const && $hasOwn.call(ancestors[i].$$const, name)) { + return ancestors[i].$$const[name]; + } + } + } + + // Walk up Object's ancestors chain looking for the constant, + // but only if cref is missing or a module. + function const_lookup_Object(cref, name) { + if (cref == null || cref.$$is_module) { + return const_lookup_ancestors(_Object, name); + } + } + + // Call const_missing if nothing else worked + function const_missing(cref, name, skip_missing) { + if (!skip_missing) { + return (cref || _Object).$const_missing(name); + } + } + + // Look for the constant just in the current cref or call `#const_missing` + Opal.const_get_local = function(cref, name, skip_missing) { + var result; + + if (cref == null) return; + + if (cref === '::') cref = _Object; + + if (!cref.$$is_module && !cref.$$is_class) { + throw new Opal.TypeError(cref.toString() + " is not a class/module"); + } + + result = const_get_name(cref, name); if (result != null) return result; + result = const_missing(cref, name, skip_missing); if (result != null) return result; + } + + // Look for the constant relative to a cref or call `#const_missing` (when the + // constant is prefixed by `::`). + Opal.const_get_qualified = function(cref, name, skip_missing) { + var result, cache, cached, current_version = Opal.const_cache_version; + + if (cref == null) return; + + if (cref === '::') cref = _Object; + + if (!cref.$$is_module && !cref.$$is_class) { + throw new Opal.TypeError(cref.toString() + " is not a class/module"); + } + + if ((cache = cref.$$const_cache) == null) { + $defineProperty(cref, '$$const_cache', Object.create(null)); + cache = cref.$$const_cache; + } + cached = cache[name]; + + if (cached == null || cached[0] !== current_version) { + ((result = const_get_name(cref, name)) != null) || + ((result = const_lookup_ancestors(cref, name)) != null); + cache[name] = [current_version, result]; + } else { + result = cached[1]; + } + + return result != null ? result : const_missing(cref, name, skip_missing); + }; + + // Initialize the top level constant cache generation counter + Opal.const_cache_version = 1; + + // Look for the constant in the open using the current nesting and the nearest + // cref ancestors or call `#const_missing` (when the constant has no :: prefix). + Opal.const_get_relative = function(nesting, name, skip_missing) { + var cref = nesting[0], result, current_version = Opal.const_cache_version, cache, cached; + + if ((cache = nesting.$$const_cache) == null) { + $defineProperty(nesting, '$$const_cache', Object.create(null)); + cache = nesting.$$const_cache; + } + cached = cache[name]; + + if (cached == null || cached[0] !== current_version) { + ((result = const_get_name(cref, name)) != null) || + ((result = const_lookup_nesting(nesting, name)) != null) || + ((result = const_lookup_ancestors(cref, name)) != null) || + ((result = const_lookup_Object(cref, name)) != null); + + cache[name] = [current_version, result]; + } else { + result = cached[1]; + } + + return result != null ? result : const_missing(cref, name, skip_missing); + }; + + // Register the constant on a cref and opportunistically set the name of + // unnamed classes/modules. + Opal.const_set = function(cref, name, value) { + if (cref == null || cref === '::') cref = _Object; + + if (value.$$is_a_module) { + if (value.$$name == null || value.$$name === nil) value.$$name = name; + if (value.$$base_module == null) value.$$base_module = cref; + } + + cref.$$const = (cref.$$const || Object.create(null)); + cref.$$const[name] = value; + + // Add a short helper to navigate constants manually. + // @example + // Opal.$$.Regexp.$$.IGNORECASE + cref.$$ = cref.$$const; + + Opal.const_cache_version++; + + // Expose top level constants onto the Opal object + if (cref === _Object) Opal[name] = value; + + // Name new class directly onto current scope (Opal.Foo.Baz = klass) + $defineProperty(cref, name, value); + + return value; + }; + + // Get all the constants reachable from a given cref, by default will include + // inherited constants. + Opal.constants = function(cref, inherit) { + if (inherit == null) inherit = true; + + var module, modules = [cref], module_constants, i, ii, constants = {}, constant; + + if (inherit) modules = modules.concat(Opal.ancestors(cref)); + if (inherit && cref.$$is_module) modules = modules.concat([Opal.Object]).concat(Opal.ancestors(Opal.Object)); + + for (i = 0, ii = modules.length; i < ii; i++) { + module = modules[i]; + + // Don not show Objects constants unless we're querying Object itself + if (cref !== _Object && module == _Object) break; + + for (constant in module.$$const) { + constants[constant] = true; + } + } + + return Object.keys(constants); + }; + + // Remove a constant from a cref. + Opal.const_remove = function(cref, name) { + Opal.const_cache_version++; + + if (cref.$$const[name] != null) { + var old = cref.$$const[name]; + delete cref.$$const[name]; + return old; + } + + if (cref.$$autoload != null && cref.$$autoload[name] != null) { + delete cref.$$autoload[name]; + return nil; + } + + throw Opal.NameError.$new("constant "+cref+"::"+cref.$name()+" not defined"); + }; + + + // Modules & Classes + // ----------------- + + // A `class Foo; end` expression in ruby is compiled to call this runtime + // method which either returns an existing class of the given name, or creates + // a new class in the given `base` scope. + // + // If a constant with the given name exists, then we check to make sure that + // it is a class and also that the superclasses match. If either of these + // fail, then we raise a `TypeError`. Note, `superclass` may be null if one + // was not specified in the ruby code. + // + // We pass a constructor to this method of the form `function ClassName() {}` + // simply so that classes show up with nicely formatted names inside debuggers + // in the web browser (or node/sprockets). + // + // The `scope` is the current `self` value where the class is being created + // from. We use this to get the scope for where the class should be created. + // If `scope` is an object (not a class/module), we simple get its class and + // use that as the scope instead. + // + // @param scope [Object] where the class is being created + // @param superclass [Class,null] superclass of the new class (may be null) + // @param id [String] the name of the class to be created + // @param constructor [JS.Function] function to use as constructor + // + // @return new [Class] or existing ruby class + // + Opal.allocate_class = function(name, superclass, constructor) { + var klass = constructor; + + if (superclass != null && superclass.$$bridge) { + // Inheritance from bridged classes requires + // calling original JS constructors + klass = function SubclassOfNativeClass() { + var args = $slice.call(arguments), + self = new ($bind.apply(superclass, [null].concat(args)))(); + + // and replacing a __proto__ manually + $setPrototype(self, klass.prototype); + return self; + } + } + + $defineProperty(klass, '$$name', name); + $defineProperty(klass, '$$const', {}); + $defineProperty(klass, '$$is_class', true); + $defineProperty(klass, '$$is_a_module', true); + $defineProperty(klass, '$$super', superclass); + $defineProperty(klass, '$$cvars', {}); + $defineProperty(klass, '$$own_included_modules', []); + $defineProperty(klass, '$$own_prepended_modules', []); + $defineProperty(klass, '$$ancestors', []); + $defineProperty(klass, '$$ancestors_cache_version', null); + + $defineProperty(klass.prototype, '$$class', klass); + + // By default if there are no singleton class methods + // __proto__ is Class.prototype + // Later singleton methods generate a singleton_class + // and inject it into ancestors chain + if (Opal.Class) { + $setPrototype(klass, Opal.Class.prototype); + } + + if (superclass != null) { + $setPrototype(klass.prototype, superclass.prototype); + + if (superclass !== Opal.Module && superclass.$$meta) { + // If superclass has metaclass then we have explicitely inherit it. + Opal.build_class_singleton_class(klass); + } + }; + + return klass; + } + + + function find_existing_class(scope, name) { + // Try to find the class in the current scope + var klass = const_get_name(scope, name); + + // If the class exists in the scope, then we must use that + if (klass) { + // Make sure the existing constant is a class, or raise error + if (!klass.$$is_class) { + throw Opal.TypeError.$new(name + " is not a class"); + } + + return klass; + } + } + + function ensureSuperclassMatch(klass, superclass) { + if (klass.$$super !== superclass) { + throw Opal.TypeError.$new("superclass mismatch for class " + klass.$$name); + } + } + + Opal.klass = function(scope, superclass, name, constructor) { + var bridged; + + if (scope == null) { + // Global scope + scope = _Object; + } else if (!scope.$$is_class && !scope.$$is_module) { + // Scope is an object, use its class + scope = scope.$$class; + } + + // If the superclass is not an Opal-generated class then we're bridging a native JS class + if (superclass != null && !superclass.hasOwnProperty('$$is_class')) { + bridged = superclass; + superclass = _Object; + } + + var klass = find_existing_class(scope, name); + + if (klass) { + if (superclass) { + // Make sure existing class has same superclass + ensureSuperclassMatch(klass, superclass); + } + return klass; + } + + // Class doesnt exist, create a new one with given superclass... + + // Not specifying a superclass means we can assume it to be Object + if (superclass == null) { + superclass = _Object; + } + + if (bridged) { + Opal.bridge(bridged); + klass = bridged; + Opal.const_set(scope, name, klass); + } else { + // Create the class object (instance of Class) + klass = Opal.allocate_class(name, superclass, constructor); + Opal.const_set(scope, name, klass); + // Call .inherited() hook with new class on the superclass + if (superclass.$inherited) { + superclass.$inherited(klass); + } + } + + return klass; + + } + + // Define new module (or return existing module). The given `scope` is basically + // the current `self` value the `module` statement was defined in. If this is + // a ruby module or class, then it is used, otherwise if the scope is a ruby + // object then that objects real ruby class is used (e.g. if the scope is the + // main object, then the top level `Object` class is used as the scope). + // + // If a module of the given name is already defined in the scope, then that + // instance is just returned. + // + // If there is a class of the given name in the scope, then an error is + // generated instead (cannot have a class and module of same name in same scope). + // + // Otherwise, a new module is created in the scope with the given name, and that + // new instance is returned back (to be referenced at runtime). + // + // @param scope [Module, Class] class or module this definition is inside + // @param id [String] the name of the new (or existing) module + // + // @return [Module] + Opal.allocate_module = function(name, constructor) { + var module = constructor; + + $defineProperty(module, '$$name', name); + $defineProperty(module, '$$const', {}); + $defineProperty(module, '$$is_module', true); + $defineProperty(module, '$$is_a_module', true); + $defineProperty(module, '$$cvars', {}); + $defineProperty(module, '$$iclasses', []); + $defineProperty(module, '$$own_included_modules', []); + $defineProperty(module, '$$own_prepended_modules', []); + $defineProperty(module, '$$ancestors', [module]); + $defineProperty(module, '$$ancestors_cache_version', null); + + $setPrototype(module, Opal.Module.prototype); + + return module; + } + + function find_existing_module(scope, name) { + var module = const_get_name(scope, name); + if (module == null && scope === _Object) module = const_lookup_ancestors(_Object, name); + + if (module) { + if (!module.$$is_module && module !== _Object) { + throw Opal.TypeError.$new(name + " is not a module"); + } + } + + return module; + } + + Opal.module = function(scope, name, constructor) { + var module; + + if (scope == null) { + // Global scope + scope = _Object; + } else if (!scope.$$is_class && !scope.$$is_module) { + // Scope is an object, use its class + scope = scope.$$class; + } + + module = find_existing_module(scope, name); + + if (module) { + return module; + } + + // Module doesnt exist, create a new one... + module = Opal.allocate_module(name, constructor); + Opal.const_set(scope, name, module); + + return module; + } + + // Return the singleton class for the passed object. + // + // If the given object alredy has a singleton class, then it will be stored on + // the object as the `$$meta` property. If this exists, then it is simply + // returned back. + // + // Otherwise, a new singleton object for the class or object is created, set on + // the object at `$$meta` for future use, and then returned. + // + // @param object [Object] the ruby object + // @return [Class] the singleton class for object + Opal.get_singleton_class = function(object) { + if (object.$$meta) { + return object.$$meta; + } + + if (object.hasOwnProperty('$$is_class')) { + return Opal.build_class_singleton_class(object); + } else if (object.hasOwnProperty('$$is_module')) { + return Opal.build_module_singletin_class(object); + } else { + return Opal.build_object_singleton_class(object); + } + }; + + // Build the singleton class for an existing class. Class object are built + // with their singleton class already in the prototype chain and inheriting + // from their superclass object (up to `Class` itself). + // + // NOTE: Actually in MRI a class' singleton class inherits from its + // superclass' singleton class which in turn inherits from Class. + // + // @param klass [Class] + // @return [Class] + Opal.build_class_singleton_class = function(klass) { + var superclass, meta; + + if (klass.$$meta) { + return klass.$$meta; + } + + // The singleton_class superclass is the singleton_class of its superclass; + // but BasicObject has no superclass (its `$$super` is null), thus we + // fallback on `Class`. + superclass = klass === BasicObject ? Class : Opal.get_singleton_class(klass.$$super); + + meta = Opal.allocate_class(null, superclass, function(){}); + + $defineProperty(meta, '$$is_singleton', true); + $defineProperty(meta, '$$singleton_of', klass); + $defineProperty(klass, '$$meta', meta); + $setPrototype(klass, meta.prototype); + // Restoring ClassName.class + $defineProperty(klass, '$$class', Opal.Class); + + return meta; + }; + + Opal.build_module_singletin_class = function(mod) { + if (mod.$$meta) { + return mod.$$meta; + } + + var meta = Opal.allocate_class(null, Opal.Module, function(){}); + + $defineProperty(meta, '$$is_singleton', true); + $defineProperty(meta, '$$singleton_of', mod); + $defineProperty(mod, '$$meta', meta); + $setPrototype(mod, meta.prototype); + // Restoring ModuleName.class + $defineProperty(mod, '$$class', Opal.Module); + + return meta; + } + + // Build the singleton class for a Ruby (non class) Object. + // + // @param object [Object] + // @return [Class] + Opal.build_object_singleton_class = function(object) { + var superclass = object.$$class, + klass = Opal.allocate_class(nil, superclass, function(){}); + + $defineProperty(klass, '$$is_singleton', true); + $defineProperty(klass, '$$singleton_of', object); + + delete klass.prototype.$$class; + + $defineProperty(object, '$$meta', klass); + + $setPrototype(object, object.$$meta.prototype); + + return klass; + }; + + Opal.is_method = function(prop) { + return (prop[0] === '$' && prop[1] !== '$'); + } + + Opal.instance_methods = function(mod) { + var exclude = [], results = [], ancestors = Opal.ancestors(mod); + + for (var i = 0, l = ancestors.length; i < l; i++) { + var ancestor = ancestors[i], + proto = ancestor.prototype; + + if (proto.hasOwnProperty('$$dummy')) { + proto = proto.$$define_methods_on; + } + + var props = Object.getOwnPropertyNames(proto); + + for (var j = 0, ll = props.length; j < ll; j++) { + var prop = props[j]; + + if (Opal.is_method(prop)) { + var method_name = prop.slice(1), + method = proto[prop]; + + if (method.$$stub && exclude.indexOf(method_name) === -1) { + exclude.push(method_name); + } + + if (!method.$$stub && results.indexOf(method_name) === -1 && exclude.indexOf(method_name) === -1) { + results.push(method_name); + } + } + } + } + + return results; + } + + Opal.own_instance_methods = function(mod) { + var results = [], + proto = mod.prototype; + + if (proto.hasOwnProperty('$$dummy')) { + proto = proto.$$define_methods_on; + } + + var props = Object.getOwnPropertyNames(proto); + + for (var i = 0, length = props.length; i < length; i++) { + var prop = props[i]; + + if (Opal.is_method(prop)) { + var method = proto[prop]; + + if (!method.$$stub) { + var method_name = prop.slice(1); + results.push(method_name); + } + } + } + + return results; + } + + Opal.methods = function(obj) { + return Opal.instance_methods(Opal.get_singleton_class(obj)); + } + + Opal.own_methods = function(obj) { + return Opal.own_instance_methods(Opal.get_singleton_class(obj)); + } + + Opal.receiver_methods = function(obj) { + var mod = Opal.get_singleton_class(obj); + var singleton_methods = Opal.own_instance_methods(mod); + var instance_methods = Opal.own_instance_methods(mod.$$super); + return singleton_methods.concat(instance_methods); + } + + // Returns an object containing all pairs of names/values + // for all class variables defined in provided +module+ + // and its ancestors. + // + // @param module [Module] + // @return [Object] + Opal.class_variables = function(module) { + var ancestors = Opal.ancestors(module), + i, length = ancestors.length, + result = {}; + + for (i = length - 1; i >= 0; i--) { + var ancestor = ancestors[i]; + + for (var cvar in ancestor.$$cvars) { + result[cvar] = ancestor.$$cvars[cvar]; + } + } + + return result; + } + + // Sets class variable with specified +name+ to +value+ + // in provided +module+ + // + // @param module [Module] + // @param name [String] + // @param value [Object] + Opal.class_variable_set = function(module, name, value) { + var ancestors = Opal.ancestors(module), + i, length = ancestors.length; + + for (i = length - 2; i >= 0; i--) { + var ancestor = ancestors[i]; + + if ($hasOwn.call(ancestor.$$cvars, name)) { + ancestor.$$cvars[name] = value; + return value; + } + } + + module.$$cvars[name] = value; + + return value; + } + + function isRoot(proto) { + return proto.hasOwnProperty('$$iclass') && proto.hasOwnProperty('$$root'); + } + + function own_included_modules(module) { + var result = [], mod, proto = Object.getPrototypeOf(module.prototype); + + while (proto) { + if (proto.hasOwnProperty('$$class')) { + // superclass + break; + } + mod = protoToModule(proto); + if (mod) { + result.push(mod); + } + proto = Object.getPrototypeOf(proto); + } + + return result; + } + + function own_prepended_modules(module) { + var result = [], mod, proto = Object.getPrototypeOf(module.prototype); + + if (module.prototype.hasOwnProperty('$$dummy')) { + while (proto) { + if (proto === module.prototype.$$define_methods_on) { + break; + } + + mod = protoToModule(proto); + if (mod) { + result.push(mod); + } + + proto = Object.getPrototypeOf(proto); + } + } + + return result; + } + + + // The actual inclusion of a module into a class. + // + // ## Class `$$parent` and `iclass` + // + // To handle `super` calls, every class has a `$$parent`. This parent is + // used to resolve the next class for a super call. A normal class would + // have this point to its superclass. However, if a class includes a module + // then this would need to take into account the module. The module would + // also have to then point its `$$parent` to the actual superclass. We + // cannot modify modules like this, because it might be included in more + // then one class. To fix this, we actually insert an `iclass` as the class' + // `$$parent` which can then point to the superclass. The `iclass` acts as + // a proxy to the actual module, so the `super` chain can then search it for + // the required method. + // + // @param module [Module] the module to include + // @param includer [Module] the target class to include module into + // @return [null] + Opal.append_features = function(module, includer) { + var module_ancestors = Opal.ancestors(module); + var iclasses = []; + + if (module_ancestors.indexOf(includer) !== -1) { + throw Opal.ArgumentError.$new('cyclic include detected'); + } + + for (var i = 0, length = module_ancestors.length; i < length; i++) { + var ancestor = module_ancestors[i], iclass = create_iclass(ancestor); + $defineProperty(iclass, '$$included', true); + iclasses.push(iclass); + } + var includer_ancestors = Opal.ancestors(includer), + chain = chain_iclasses(iclasses), + start_chain_after, + end_chain_on; + + if (includer_ancestors.indexOf(module) === -1) { + // first time include + + // includer -> chain.first -> ...chain... -> chain.last -> includer.parent + start_chain_after = includer.prototype; + end_chain_on = Object.getPrototypeOf(includer.prototype); + } else { + // The module has been already included, + // we don't need to put it into the ancestors chain again, + // but this module may have new included modules. + // If it's true we need to copy them. + // + // The simplest way is to replace ancestors chain from + // parent + // | + // `module` iclass (has a $$root flag) + // | + // ...previos chain of module.included_modules ... + // | + // "next ancestor" (has a $$root flag or is a real class) + // + // to + // parent + // | + // `module` iclass (has a $$root flag) + // | + // ...regenerated chain of module.included_modules + // | + // "next ancestor" (has a $$root flag or is a real class) + // + // because there are no intermediate classes between `parent` and `next ancestor`. + // It doesn't break any prototypes of other objects as we don't change class references. + + var proto = includer.prototype, parent = proto, module_iclass = Object.getPrototypeOf(parent); + + while (module_iclass != null) { + if (isRoot(module_iclass) && module_iclass.$$module === module) { + break; + } + + parent = module_iclass; + module_iclass = Object.getPrototypeOf(module_iclass); + } + + var next_ancestor = Object.getPrototypeOf(module_iclass); + + // skip non-root iclasses (that were recursively included) + while (next_ancestor.hasOwnProperty('$$iclass') && !isRoot(next_ancestor)) { + next_ancestor = Object.getPrototypeOf(next_ancestor); + } + + start_chain_after = parent; + end_chain_on = next_ancestor; + } + + $setPrototype(start_chain_after, chain.first); + $setPrototype(chain.last, end_chain_on); + + // recalculate own_included_modules cache + includer.$$own_included_modules = own_included_modules(includer); + + Opal.const_cache_version++; + } + + Opal.prepend_features = function(module, prepender) { + // Here we change the ancestors chain from + // + // prepender + // | + // parent + // + // to: + // + // dummy(prepender) + // | + // iclass(module) + // | + // iclass(prepender) + // | + // parent + var module_ancestors = Opal.ancestors(module); + var iclasses = []; + + if (module_ancestors.indexOf(prepender) !== -1) { + throw Opal.ArgumentError.$new('cyclic prepend detected'); + } + + for (var i = 0, length = module_ancestors.length; i < length; i++) { + var ancestor = module_ancestors[i], iclass = create_iclass(ancestor); + $defineProperty(iclass, '$$prepended', true); + iclasses.push(iclass); + } + + var chain = chain_iclasses(iclasses), + dummy_prepender = prepender.prototype, + previous_parent = Object.getPrototypeOf(dummy_prepender), + prepender_iclass, + start_chain_after, + end_chain_on; + + if (dummy_prepender.hasOwnProperty('$$dummy')) { + // The module already has some prepended modules + // which means that we don't need to make it "dummy" + prepender_iclass = dummy_prepender.$$define_methods_on; + } else { + // Making the module "dummy" + prepender_iclass = create_dummy_iclass(prepender); + flush_methods_in(prepender); + $defineProperty(dummy_prepender, '$$dummy', true); + $defineProperty(dummy_prepender, '$$define_methods_on', prepender_iclass); + + // Converting + // dummy(prepender) -> previous_parent + // to + // dummy(prepender) -> iclass(prepender) -> previous_parent + $setPrototype(dummy_prepender, prepender_iclass); + $setPrototype(prepender_iclass, previous_parent); + } + + var prepender_ancestors = Opal.ancestors(prepender); + + if (prepender_ancestors.indexOf(module) === -1) { + // first time prepend + + start_chain_after = dummy_prepender; + + // next $$root or prepender_iclass or non-$$iclass + end_chain_on = Object.getPrototypeOf(dummy_prepender); + while (end_chain_on != null) { + if ( + end_chain_on.hasOwnProperty('$$root') || + end_chain_on === prepender_iclass || + !end_chain_on.hasOwnProperty('$$iclass') + ) { + break; + } + + end_chain_on = Object.getPrototypeOf(end_chain_on); + } + } else { + throw Opal.RuntimeError.$new("Prepending a module multiple times is not supported"); + } + + $setPrototype(start_chain_after, chain.first); + $setPrototype(chain.last, end_chain_on); + + // recalculate own_prepended_modules cache + prepender.$$own_prepended_modules = own_prepended_modules(prepender); + + Opal.const_cache_version++; + } + + function flush_methods_in(module) { + var proto = module.prototype, + props = Object.getOwnPropertyNames(proto); + + for (var i = 0; i < props.length; i++) { + var prop = props[i]; + if (Opal.is_method(prop)) { + delete proto[prop]; + } + } + } + + function create_iclass(module) { + var iclass = create_dummy_iclass(module); + + if (module.$$is_module) { + module.$$iclasses.push(iclass); + } + + return iclass; + } + + // Dummy iclass doesn't receive updates when the module gets a new method. + function create_dummy_iclass(module) { + var iclass = {}, + proto = module.prototype; + + if (proto.hasOwnProperty('$$dummy')) { + proto = proto.$$define_methods_on; + } + + var props = Object.getOwnPropertyNames(proto), + length = props.length, i; + + for (i = 0; i < length; i++) { + var prop = props[i]; + $defineProperty(iclass, prop, proto[prop]); + } + + $defineProperty(iclass, '$$iclass', true); + $defineProperty(iclass, '$$module', module); + + return iclass; + } + + function chain_iclasses(iclasses) { + var length = iclasses.length, first = iclasses[0]; + + $defineProperty(first, '$$root', true); + + if (length === 1) { + return { first: first, last: first }; + } + + var previous = first; + + for (var i = 1; i < length; i++) { + var current = iclasses[i]; + $setPrototype(previous, current); + previous = current; + } + + + return { first: iclasses[0], last: iclasses[length - 1] }; + } + + // For performance, some core Ruby classes are toll-free bridged to their + // native JavaScript counterparts (e.g. a Ruby Array is a JavaScript Array). + // + // This method is used to setup a native constructor (e.g. Array), to have + // its prototype act like a normal Ruby class. Firstly, a new Ruby class is + // created using the native constructor so that its prototype is set as the + // target for th new class. Note: all bridged classes are set to inherit + // from Object. + // + // Example: + // + // Opal.bridge(self, Function); + // + // @param klass [Class] the Ruby class to bridge + // @param constructor [JS.Function] native JavaScript constructor to use + // @return [Class] returns the passed Ruby class + // + Opal.bridge = function(constructor, klass) { + if (constructor.hasOwnProperty('$$bridge')) { + throw Opal.ArgumentError.$new("already bridged"); + } + + var klass_to_inject, klass_reference; + + if (klass == null) { + klass_to_inject = Opal.Object; + klass_reference = constructor; + } else { + klass_to_inject = klass; + klass_reference = klass; + } + + // constructor is a JS function with a prototype chain like: + // - constructor + // - super + // + // What we need to do is to inject our class (with its prototype chain) + // between constructor and super. For example, after injecting Ruby Object into JS Error we get: + // - constructor + // - Opal.Object + // - Opal.Kernel + // - Opal.BasicObject + // - super + // + + $setPrototype(constructor.prototype, klass_to_inject.prototype); + $defineProperty(constructor.prototype, '$$class', klass_reference); + $defineProperty(constructor, '$$bridge', true); + $defineProperty(constructor, '$$is_class', true); + $defineProperty(constructor, '$$is_a_module', true); + $defineProperty(constructor, '$$super', klass_to_inject); + $defineProperty(constructor, '$$const', {}); + $defineProperty(constructor, '$$own_included_modules', []); + $defineProperty(constructor, '$$own_prepended_modules', []); + $defineProperty(constructor, '$$ancestors', []); + $defineProperty(constructor, '$$ancestors_cache_version', null); + $setPrototype(constructor, Opal.Class.prototype); + }; + + function protoToModule(proto) { + if (proto.hasOwnProperty('$$dummy')) { + return; + } else if (proto.hasOwnProperty('$$iclass')) { + return proto.$$module; + } else if (proto.hasOwnProperty('$$class')) { + return proto.$$class; + } + } + + function own_ancestors(module) { + return module.$$own_prepended_modules.concat([module]).concat(module.$$own_included_modules); + } + + // The Array of ancestors for a given module/class + Opal.ancestors = function(module) { + if (!module) { return []; } + + if (module.$$ancestors_cache_version === Opal.const_cache_version) { + return module.$$ancestors; + } + + var result = [], i, mods, length; + + for (i = 0, mods = own_ancestors(module), length = mods.length; i < length; i++) { + result.push(mods[i]); + } + + if (module.$$super) { + for (i = 0, mods = Opal.ancestors(module.$$super), length = mods.length; i < length; i++) { + result.push(mods[i]); + } + } + + module.$$ancestors_cache_version = Opal.const_cache_version; + module.$$ancestors = result; + + return result; + } + + Opal.included_modules = function(module) { + var result = [], mod = null, proto = Object.getPrototypeOf(module.prototype); + + for (; proto && Object.getPrototypeOf(proto); proto = Object.getPrototypeOf(proto)) { + mod = protoToModule(proto); + if (mod && mod.$$is_module && proto.$$iclass && proto.$$included) { + result.push(mod); + } + } + + return result; + } + + + // Method Missing + // -------------- + + // Methods stubs are used to facilitate method_missing in opal. A stub is a + // placeholder function which just calls `method_missing` on the receiver. + // If no method with the given name is actually defined on an object, then it + // is obvious to say that the stub will be called instead, and then in turn + // method_missing will be called. + // + // When a file in ruby gets compiled to javascript, it includes a call to + // this function which adds stubs for every method name in the compiled file. + // It should then be safe to assume that method_missing will work for any + // method call detected. + // + // Method stubs are added to the BasicObject prototype, which every other + // ruby object inherits, so all objects should handle method missing. A stub + // is only added if the given property name (method name) is not already + // defined. + // + // Note: all ruby methods have a `$` prefix in javascript, so all stubs will + // have this prefix as well (to make this method more performant). + // + // Opal.add_stubs(["$foo", "$bar", "$baz="]); + // + // All stub functions will have a private `$$stub` property set to true so + // that other internal methods can detect if a method is just a stub or not. + // `Kernel#respond_to?` uses this property to detect a methods presence. + // + // @param stubs [Array] an array of method stubs to add + // @return [undefined] + Opal.add_stubs = function(stubs) { + var proto = Opal.BasicObject.prototype; + + for (var i = 0, length = stubs.length; i < length; i++) { + var stub = stubs[i], existing_method = proto[stub]; + + if (existing_method == null || existing_method.$$stub) { + Opal.add_stub_for(proto, stub); + } + } + }; + + // Add a method_missing stub function to the given prototype for the + // given name. + // + // @param prototype [Prototype] the target prototype + // @param stub [String] stub name to add (e.g. "$foo") + // @return [undefined] + Opal.add_stub_for = function(prototype, stub) { + var method_missing_stub = Opal.stub_for(stub); + $defineProperty(prototype, stub, method_missing_stub); + }; + + // Generate the method_missing stub for a given method name. + // + // @param method_name [String] The js-name of the method to stub (e.g. "$foo") + // @return [undefined] + Opal.stub_for = function(method_name) { + function method_missing_stub() { + // Copy any given block onto the method_missing dispatcher + this.$method_missing.$$p = method_missing_stub.$$p; + + // Set block property to null ready for the next call (stop false-positives) + method_missing_stub.$$p = null; + + // call method missing with correct args (remove '$' prefix on method name) + var args_ary = new Array(arguments.length); + for(var i = 0, l = args_ary.length; i < l; i++) { args_ary[i] = arguments[i]; } + + return this.$method_missing.apply(this, [method_name.slice(1)].concat(args_ary)); + } + + method_missing_stub.$$stub = true; + + return method_missing_stub; + }; + + + // Methods + // ------- + + // Arity count error dispatcher for methods + // + // @param actual [Fixnum] number of arguments given to method + // @param expected [Fixnum] expected number of arguments + // @param object [Object] owner of the method +meth+ + // @param meth [String] method name that got wrong number of arguments + // @raise [ArgumentError] + Opal.ac = function(actual, expected, object, meth) { + var inspect = ''; + if (object.$$is_a_module) { + inspect += object.$$name + '.'; + } + else { + inspect += object.$$class.$$name + '#'; + } + inspect += meth; + + throw Opal.ArgumentError.$new('[' + inspect + '] wrong number of arguments(' + actual + ' for ' + expected + ')'); + }; + + // Arity count error dispatcher for blocks + // + // @param actual [Fixnum] number of arguments given to block + // @param expected [Fixnum] expected number of arguments + // @param context [Object] context of the block definition + // @raise [ArgumentError] + Opal.block_ac = function(actual, expected, context) { + var inspect = "`block in " + context + "'"; + + throw Opal.ArgumentError.$new(inspect + ': wrong number of arguments (' + actual + ' for ' + expected + ')'); + }; + + // Super dispatcher + Opal.find_super_dispatcher = function(obj, mid, current_func, defcheck, defs) { + var jsid = '$' + mid, ancestors, super_method; + + if (obj.hasOwnProperty('$$meta')) { + ancestors = Opal.ancestors(obj.$$meta); + } else { + ancestors = Opal.ancestors(obj.$$class); + } + + var current_index = ancestors.indexOf(current_func.$$owner); + + for (var i = current_index + 1; i < ancestors.length; i++) { + var ancestor = ancestors[i], + proto = ancestor.prototype; + + if (proto.hasOwnProperty('$$dummy')) { + proto = proto.$$define_methods_on; + } + + if (proto.hasOwnProperty(jsid)) { + var method = proto[jsid]; + + if (!method.$$stub) { + super_method = method; + } + break; + } + } + + if (!defcheck && super_method == null && Opal.Kernel.$method_missing === obj.$method_missing) { + // method_missing hasn't been explicitly defined + throw Opal.NoMethodError.$new('super: no superclass method `'+mid+"' for "+obj, mid); + } + + return super_method; + }; + + // Iter dispatcher for super in a block + Opal.find_iter_super_dispatcher = function(obj, jsid, current_func, defcheck, implicit) { + var call_jsid = jsid; + + if (!current_func) { + throw Opal.RuntimeError.$new("super called outside of method"); + } + + if (implicit && current_func.$$define_meth) { + throw Opal.RuntimeError.$new("implicit argument passing of super from method defined by define_method() is not supported. Specify all arguments explicitly"); + } + + if (current_func.$$def) { + call_jsid = current_func.$$jsid; + } + + return Opal.find_super_dispatcher(obj, call_jsid, current_func, defcheck); + }; + + // Used to return as an expression. Sometimes, we can't simply return from + // a javascript function as if we were a method, as the return is used as + // an expression, or even inside a block which must "return" to the outer + // method. This helper simply throws an error which is then caught by the + // method. This approach is expensive, so it is only used when absolutely + // needed. + // + Opal.ret = function(val) { + Opal.returner.$v = val; + throw Opal.returner; + }; + + // Used to break out of a block. + Opal.brk = function(val, breaker) { + breaker.$v = val; + throw breaker; + }; + + // Builds a new unique breaker, this is to avoid multiple nested breaks to get + // in the way of each other. + Opal.new_brk = function() { + return new Error('unexpected break'); + }; + + // handles yield calls for 1 yielded arg + Opal.yield1 = function(block, arg) { + if (typeof(block) !== "function") { + throw Opal.LocalJumpError.$new("no block given"); + } + + var has_mlhs = block.$$has_top_level_mlhs_arg, + has_trailing_comma = block.$$has_trailing_comma_in_args; + + if (block.length > 1 || ((has_mlhs || has_trailing_comma) && block.length === 1)) { + arg = Opal.to_ary(arg); + } + + if ((block.length > 1 || (has_trailing_comma && block.length === 1)) && arg.$$is_array) { + return block.apply(null, arg); + } + else { + return block(arg); + } + }; + + // handles yield for > 1 yielded arg + Opal.yieldX = function(block, args) { + if (typeof(block) !== "function") { + throw Opal.LocalJumpError.$new("no block given"); + } + + if (block.length > 1 && args.length === 1) { + if (args[0].$$is_array) { + return block.apply(null, args[0]); + } + } + + if (!args.$$is_array) { + var args_ary = new Array(args.length); + for(var i = 0, l = args_ary.length; i < l; i++) { args_ary[i] = args[i]; } + + return block.apply(null, args_ary); + } + + return block.apply(null, args); + }; + + // Finds the corresponding exception match in candidates. Each candidate can + // be a value, or an array of values. Returns null if not found. + Opal.rescue = function(exception, candidates) { + for (var i = 0; i < candidates.length; i++) { + var candidate = candidates[i]; + + if (candidate.$$is_array) { + var result = Opal.rescue(exception, candidate); + + if (result) { + return result; + } + } + else if (candidate === Opal.JS.Error) { + return candidate; + } + else if (candidate['$==='](exception)) { + return candidate; + } + } + + return null; + }; + + Opal.is_a = function(object, klass) { + if (klass != null && object.$$meta === klass || object.$$class === klass) { + return true; + } + + if (object.$$is_number && klass.$$is_number_class) { + return true; + } + + var i, length, ancestors = Opal.ancestors(object.$$is_class ? Opal.get_singleton_class(object) : (object.$$meta || object.$$class)); + + for (i = 0, length = ancestors.length; i < length; i++) { + if (ancestors[i] === klass) { + return true; + } + } + + return false; + }; + + // Helpers for extracting kwsplats + // Used for: { **h } + Opal.to_hash = function(value) { + if (value.$$is_hash) { + return value; + } + else if (value['$respond_to?']('to_hash', true)) { + var hash = value.$to_hash(); + if (hash.$$is_hash) { + return hash; + } + else { + throw Opal.TypeError.$new("Can't convert " + value.$$class + + " to Hash (" + value.$$class + "#to_hash gives " + hash.$$class + ")"); + } + } + else { + throw Opal.TypeError.$new("no implicit conversion of " + value.$$class + " into Hash"); + } + }; + + // Helpers for implementing multiple assignment + // Our code for extracting the values and assigning them only works if the + // return value is a JS array. + // So if we get an Array subclass, extract the wrapped JS array from it + + // Used for: a, b = something (no splat) + Opal.to_ary = function(value) { + if (value.$$is_array) { + return value; + } + else if (value['$respond_to?']('to_ary', true)) { + var ary = value.$to_ary(); + if (ary === nil) { + return [value]; + } + else if (ary.$$is_array) { + return ary; + } + else { + throw Opal.TypeError.$new("Can't convert " + value.$$class + + " to Array (" + value.$$class + "#to_ary gives " + ary.$$class + ")"); + } + } + else { + return [value]; + } + }; + + // Used for: a, b = *something (with splat) + Opal.to_a = function(value) { + if (value.$$is_array) { + // A splatted array must be copied + return value.slice(); + } + else if (value['$respond_to?']('to_a', true)) { + var ary = value.$to_a(); + if (ary === nil) { + return [value]; + } + else if (ary.$$is_array) { + return ary; + } + else { + throw Opal.TypeError.$new("Can't convert " + value.$$class + + " to Array (" + value.$$class + "#to_a gives " + ary.$$class + ")"); + } + } + else { + return [value]; + } + }; + + // Used for extracting keyword arguments from arguments passed to + // JS function. If provided +arguments+ list doesn't have a Hash + // as a last item, returns a blank Hash. + // + // @param parameters [Array] + // @return [Hash] + // + Opal.extract_kwargs = function(parameters) { + var kwargs = parameters[parameters.length - 1]; + if (kwargs != null && kwargs['$respond_to?']('to_hash', true)) { + Array.prototype.splice.call(parameters, parameters.length - 1, 1); + return kwargs.$to_hash(); + } + else { + return Opal.hash2([], {}); + } + } + + // Used to get a list of rest keyword arguments. Method takes the given + // keyword args, i.e. the hash literal passed to the method containing all + // keyword arguemnts passed to method, as well as the used args which are + // the names of required and optional arguments defined. This method then + // just returns all key/value pairs which have not been used, in a new + // hash literal. + // + // @param given_args [Hash] all kwargs given to method + // @param used_args [Object] all keys used as named kwargs + // @return [Hash] + // + Opal.kwrestargs = function(given_args, used_args) { + var keys = [], + map = {}, + key = null, + given_map = given_args.$$smap; + + for (key in given_map) { + if (!used_args[key]) { + keys.push(key); + map[key] = given_map[key]; + } + } + + return Opal.hash2(keys, map); + }; + + // Calls passed method on a ruby object with arguments and block: + // + // Can take a method or a method name. + // + // 1. When method name gets passed it invokes it by its name + // and calls 'method_missing' when object doesn't have this method. + // Used internally by Opal to invoke method that takes a block or a splat. + // 2. When method (i.e. method body) gets passed, it doesn't trigger 'method_missing' + // because it doesn't know the name of the actual method. + // Used internally by Opal to invoke 'super'. + // + // @example + // var my_array = [1, 2, 3, 4] + // Opal.send(my_array, 'length') # => 4 + // Opal.send(my_array, my_array.$length) # => 4 + // + // Opal.send(my_array, 'reverse!') # => [4, 3, 2, 1] + // Opal.send(my_array, my_array['$reverse!']') # => [4, 3, 2, 1] + // + // @param recv [Object] ruby object + // @param method [Function, String] method body or name of the method + // @param args [Array] arguments that will be passed to the method call + // @param block [Function] ruby block + // @return [Object] returning value of the method call + Opal.send = function(recv, method, args, block) { + var body = (typeof(method) === 'string') ? recv['$'+method] : method; + + if (body != null) { + if (typeof block === 'function') { + body.$$p = block; + } + return body.apply(recv, args); + } + + return recv.$method_missing.apply(recv, [method].concat(args)); + } + + Opal.lambda = function(block) { + block.$$is_lambda = true; + return block; + } + + // Used to define methods on an object. This is a helper method, used by the + // compiled source to define methods on special case objects when the compiler + // can not determine the destination object, or the object is a Module + // instance. This can get called by `Module#define_method` as well. + // + // ## Modules + // + // Any method defined on a module will come through this runtime helper. + // The method is added to the module body, and the owner of the method is + // set to be the module itself. This is used later when choosing which + // method should show on a class if more than 1 included modules define + // the same method. Finally, if the module is in `module_function` mode, + // then the method is also defined onto the module itself. + // + // ## Classes + // + // This helper will only be called for classes when a method is being + // defined indirectly; either through `Module#define_method`, or by a + // literal `def` method inside an `instance_eval` or `class_eval` body. In + // either case, the method is simply added to the class' prototype. A special + // exception exists for `BasicObject` and `Object`. These two classes are + // special because they are used in toll-free bridged classes. In each of + // these two cases, extra work is required to define the methods on toll-free + // bridged class' prototypes as well. + // + // ## Objects + // + // If a simple ruby object is the object, then the method is simply just + // defined on the object as a singleton method. This would be the case when + // a method is defined inside an `instance_eval` block. + // + // @param obj [Object, Class] the actual obj to define method for + // @param jsid [String] the JavaScript friendly method name (e.g. '$foo') + // @param body [JS.Function] the literal JavaScript function used as method + // @return [null] + // + Opal.def = function(obj, jsid, body) { + // Special case for a method definition in the + // top-level namespace + if (obj === Opal.top) { + Opal.defn(Opal.Object, jsid, body) + } + // if instance_eval is invoked on a module/class, it sets inst_eval_mod + else if (!obj.$$eval && obj.$$is_a_module) { + Opal.defn(obj, jsid, body); + } + else { + Opal.defs(obj, jsid, body); + } + }; + + // Define method on a module or class (see Opal.def). + Opal.defn = function(module, jsid, body) { + body.$$owner = module; + + var proto = module.prototype; + if (proto.hasOwnProperty('$$dummy')) { + proto = proto.$$define_methods_on; + } + $defineProperty(proto, jsid, body); + + if (module.$$is_module) { + if (module.$$module_function) { + Opal.defs(module, jsid, body) + } + + for (var i = 0, iclasses = module.$$iclasses, length = iclasses.length; i < length; i++) { + var iclass = iclasses[i]; + $defineProperty(iclass, jsid, body); + } + } + + var singleton_of = module.$$singleton_of; + if (module.$method_added && !module.$method_added.$$stub && !singleton_of) { + module.$method_added(jsid.substr(1)); + } + else if (singleton_of && singleton_of.$singleton_method_added && !singleton_of.$singleton_method_added.$$stub) { + singleton_of.$singleton_method_added(jsid.substr(1)); + } + } + + // Define a singleton method on the given object (see Opal.def). + Opal.defs = function(obj, jsid, body) { + if (obj.$$is_string || obj.$$is_number) { + // That's simply impossible + return; + } + Opal.defn(Opal.get_singleton_class(obj), jsid, body) + }; + + // Called from #remove_method. + Opal.rdef = function(obj, jsid) { + if (!$hasOwn.call(obj.prototype, jsid)) { + throw Opal.NameError.$new("method '" + jsid.substr(1) + "' not defined in " + obj.$name()); + } + + delete obj.prototype[jsid]; + + if (obj.$$is_singleton) { + if (obj.prototype.$singleton_method_removed && !obj.prototype.$singleton_method_removed.$$stub) { + obj.prototype.$singleton_method_removed(jsid.substr(1)); + } + } + else { + if (obj.$method_removed && !obj.$method_removed.$$stub) { + obj.$method_removed(jsid.substr(1)); + } + } + }; + + // Called from #undef_method. + Opal.udef = function(obj, jsid) { + if (!obj.prototype[jsid] || obj.prototype[jsid].$$stub) { + throw Opal.NameError.$new("method '" + jsid.substr(1) + "' not defined in " + obj.$name()); + } + + Opal.add_stub_for(obj.prototype, jsid); + + if (obj.$$is_singleton) { + if (obj.prototype.$singleton_method_undefined && !obj.prototype.$singleton_method_undefined.$$stub) { + obj.prototype.$singleton_method_undefined(jsid.substr(1)); + } + } + else { + if (obj.$method_undefined && !obj.$method_undefined.$$stub) { + obj.$method_undefined(jsid.substr(1)); + } + } + }; + + function is_method_body(body) { + return (typeof(body) === "function" && !body.$$stub); + } + + Opal.alias = function(obj, name, old) { + var id = '$' + name, + old_id = '$' + old, + body = obj.prototype['$' + old], + alias; + + // When running inside #instance_eval the alias refers to class methods. + if (obj.$$eval) { + return Opal.alias(Opal.get_singleton_class(obj), name, old); + } + + if (!is_method_body(body)) { + var ancestor = obj.$$super; + + while (typeof(body) !== "function" && ancestor) { + body = ancestor[old_id]; + ancestor = ancestor.$$super; + } + + if (!is_method_body(body) && obj.$$is_module) { + // try to look into Object + body = Opal.Object.prototype[old_id] + } + + if (!is_method_body(body)) { + throw Opal.NameError.$new("undefined method `" + old + "' for class `" + obj.$name() + "'") + } + } + + // If the body is itself an alias use the original body + // to keep the max depth at 1. + if (body.$$alias_of) body = body.$$alias_of; + + // We need a wrapper because otherwise properties + // would be ovrewritten on the original body. + alias = function() { + var block = alias.$$p, args, i, ii; + + args = new Array(arguments.length); + for(i = 0, ii = arguments.length; i < ii; i++) { + args[i] = arguments[i]; + } + + if (block != null) { alias.$$p = null } + + return Opal.send(this, body, args, block); + }; + + // Try to make the browser pick the right name + alias.displayName = name; + alias.length = body.length; + alias.$$arity = body.$$arity; + alias.$$parameters = body.$$parameters; + alias.$$source_location = body.$$source_location; + alias.$$alias_of = body; + alias.$$alias_name = name; + + Opal.defn(obj, id, alias); + + return obj; + }; + + Opal.alias_native = function(obj, name, native_name) { + var id = '$' + name, + body = obj.prototype[native_name]; + + if (typeof(body) !== "function" || body.$$stub) { + throw Opal.NameError.$new("undefined native method `" + native_name + "' for class `" + obj.$name() + "'") + } + + Opal.defn(obj, id, body); + + return obj; + }; + + + // Hashes + // ------ + + Opal.hash_init = function(hash) { + hash.$$smap = Object.create(null); + hash.$$map = Object.create(null); + hash.$$keys = []; + }; + + Opal.hash_clone = function(from_hash, to_hash) { + to_hash.$$none = from_hash.$$none; + to_hash.$$proc = from_hash.$$proc; + + for (var i = 0, keys = from_hash.$$keys, smap = from_hash.$$smap, len = keys.length, key, value; i < len; i++) { + key = keys[i]; + + if (key.$$is_string) { + value = smap[key]; + } else { + value = key.value; + key = key.key; + } + + Opal.hash_put(to_hash, key, value); + } + }; + + Opal.hash_put = function(hash, key, value) { + if (key.$$is_string) { + if (!$hasOwn.call(hash.$$smap, key)) { + hash.$$keys.push(key); + } + hash.$$smap[key] = value; + return; + } + + var key_hash, bucket, last_bucket; + key_hash = hash.$$by_identity ? Opal.id(key) : key.$hash(); + + if (!$hasOwn.call(hash.$$map, key_hash)) { + bucket = {key: key, key_hash: key_hash, value: value}; + hash.$$keys.push(bucket); + hash.$$map[key_hash] = bucket; + return; + } + + bucket = hash.$$map[key_hash]; + + while (bucket) { + if (key === bucket.key || key['$eql?'](bucket.key)) { + last_bucket = undefined; + bucket.value = value; + break; + } + last_bucket = bucket; + bucket = bucket.next; + } + + if (last_bucket) { + bucket = {key: key, key_hash: key_hash, value: value}; + hash.$$keys.push(bucket); + last_bucket.next = bucket; + } + }; + + Opal.hash_get = function(hash, key) { + if (key.$$is_string) { + if ($hasOwn.call(hash.$$smap, key)) { + return hash.$$smap[key]; + } + return; + } + + var key_hash, bucket; + key_hash = hash.$$by_identity ? Opal.id(key) : key.$hash(); + + if ($hasOwn.call(hash.$$map, key_hash)) { + bucket = hash.$$map[key_hash]; + + while (bucket) { + if (key === bucket.key || key['$eql?'](bucket.key)) { + return bucket.value; + } + bucket = bucket.next; + } + } + }; + + Opal.hash_delete = function(hash, key) { + var i, keys = hash.$$keys, length = keys.length, value; + + if (key.$$is_string) { + if (!$hasOwn.call(hash.$$smap, key)) { + return; + } + + for (i = 0; i < length; i++) { + if (keys[i] === key) { + keys.splice(i, 1); + break; + } + } + + value = hash.$$smap[key]; + delete hash.$$smap[key]; + return value; + } + + var key_hash = key.$hash(); + + if (!$hasOwn.call(hash.$$map, key_hash)) { + return; + } + + var bucket = hash.$$map[key_hash], last_bucket; + + while (bucket) { + if (key === bucket.key || key['$eql?'](bucket.key)) { + value = bucket.value; + + for (i = 0; i < length; i++) { + if (keys[i] === bucket) { + keys.splice(i, 1); + break; + } + } + + if (last_bucket && bucket.next) { + last_bucket.next = bucket.next; + } + else if (last_bucket) { + delete last_bucket.next; + } + else if (bucket.next) { + hash.$$map[key_hash] = bucket.next; + } + else { + delete hash.$$map[key_hash]; + } + + return value; + } + last_bucket = bucket; + bucket = bucket.next; + } + }; + + Opal.hash_rehash = function(hash) { + for (var i = 0, length = hash.$$keys.length, key_hash, bucket, last_bucket; i < length; i++) { + + if (hash.$$keys[i].$$is_string) { + continue; + } + + key_hash = hash.$$keys[i].key.$hash(); + + if (key_hash === hash.$$keys[i].key_hash) { + continue; + } + + bucket = hash.$$map[hash.$$keys[i].key_hash]; + last_bucket = undefined; + + while (bucket) { + if (bucket === hash.$$keys[i]) { + if (last_bucket && bucket.next) { + last_bucket.next = bucket.next; + } + else if (last_bucket) { + delete last_bucket.next; + } + else if (bucket.next) { + hash.$$map[hash.$$keys[i].key_hash] = bucket.next; + } + else { + delete hash.$$map[hash.$$keys[i].key_hash]; + } + break; + } + last_bucket = bucket; + bucket = bucket.next; + } + + hash.$$keys[i].key_hash = key_hash; + + if (!$hasOwn.call(hash.$$map, key_hash)) { + hash.$$map[key_hash] = hash.$$keys[i]; + continue; + } + + bucket = hash.$$map[key_hash]; + last_bucket = undefined; + + while (bucket) { + if (bucket === hash.$$keys[i]) { + last_bucket = undefined; + break; + } + last_bucket = bucket; + bucket = bucket.next; + } + + if (last_bucket) { + last_bucket.next = hash.$$keys[i]; + } + } + }; + + Opal.hash = function() { + var arguments_length = arguments.length, args, hash, i, length, key, value; + + if (arguments_length === 1 && arguments[0].$$is_hash) { + return arguments[0]; + } + + hash = new Opal.Hash(); + Opal.hash_init(hash); + + if (arguments_length === 1 && arguments[0].$$is_array) { + args = arguments[0]; + length = args.length; + + for (i = 0; i < length; i++) { + if (args[i].length !== 2) { + throw Opal.ArgumentError.$new("value not of length 2: " + args[i].$inspect()); + } + + key = args[i][0]; + value = args[i][1]; + + Opal.hash_put(hash, key, value); + } + + return hash; + } + + if (arguments_length === 1) { + args = arguments[0]; + for (key in args) { + if ($hasOwn.call(args, key)) { + value = args[key]; + + Opal.hash_put(hash, key, value); + } + } + + return hash; + } + + if (arguments_length % 2 !== 0) { + throw Opal.ArgumentError.$new("odd number of arguments for Hash"); + } + + for (i = 0; i < arguments_length; i += 2) { + key = arguments[i]; + value = arguments[i + 1]; + + Opal.hash_put(hash, key, value); + } + + return hash; + }; + + // A faster Hash creator for hashes that just use symbols and + // strings as keys. The map and keys array can be constructed at + // compile time, so they are just added here by the constructor + // function. + // + Opal.hash2 = function(keys, smap) { + var hash = new Opal.Hash(); + + hash.$$smap = smap; + hash.$$map = Object.create(null); + hash.$$keys = keys; + + return hash; + }; + + // Create a new range instance with first and last values, and whether the + // range excludes the last value. + // + Opal.range = function(first, last, exc) { + var range = new Opal.Range(); + range.begin = first; + range.end = last; + range.excl = exc; + + return range; + }; + + // Get the ivar name for a given name. + // Mostly adds a trailing $ to reserved names. + // + Opal.ivar = function(name) { + if ( + // properties + name === "constructor" || + name === "displayName" || + name === "__count__" || + name === "__noSuchMethod__" || + name === "__parent__" || + name === "__proto__" || + + // methods + name === "hasOwnProperty" || + name === "valueOf" + ) + { + return name + "$"; + } + + return name; + }; + + + // Regexps + // ------- + + // Escape Regexp special chars letting the resulting string be used to build + // a new Regexp. + // + Opal.escape_regexp = function(str) { + return str.replace(/([-[\]\/{}()*+?.^$\\| ])/g, '\\$1') + .replace(/[\n]/g, '\\n') + .replace(/[\r]/g, '\\r') + .replace(/[\f]/g, '\\f') + .replace(/[\t]/g, '\\t'); + }; + + // Create a global Regexp from a RegExp object and cache the result + // on the object itself ($$g attribute). + // + Opal.global_regexp = function(pattern) { + if (pattern.global) { + return pattern; // RegExp already has the global flag + } + if (pattern.$$g == null) { + pattern.$$g = new RegExp(pattern.source, (pattern.multiline ? 'gm' : 'g') + (pattern.ignoreCase ? 'i' : '')); + } else { + pattern.$$g.lastIndex = null; // reset lastIndex property + } + return pattern.$$g; + }; + + // Create a global multiline Regexp from a RegExp object and cache the result + // on the object itself ($$gm or $$g attribute). + // + Opal.global_multiline_regexp = function(pattern) { + var result; + if (pattern.multiline) { + if (pattern.global) { + return pattern; // RegExp already has the global and multiline flag + } + // we are using the $$g attribute because the Regexp is already multiline + if (pattern.$$g != null) { + result = pattern.$$g; + } else { + result = pattern.$$g = new RegExp(pattern.source, 'gm' + (pattern.ignoreCase ? 'i' : '')); + } + } else if (pattern.$$gm != null) { + result = pattern.$$gm; + } else { + result = pattern.$$gm = new RegExp(pattern.source, 'gm' + (pattern.ignoreCase ? 'i' : '')); + } + result.lastIndex = null; // reset lastIndex property + return result; + }; + + // Require system + // -------------- + + Opal.modules = {}; + Opal.loaded_features = ['corelib/runtime']; + Opal.current_dir = '.'; + Opal.require_table = {'corelib/runtime': true}; + + Opal.normalize = function(path) { + var parts, part, new_parts = [], SEPARATOR = '/'; + + if (Opal.current_dir !== '.') { + path = Opal.current_dir.replace(/\/*$/, '/') + path; + } + + path = path.replace(/^\.\//, ''); + path = path.replace(/\.(rb|opal|js)$/, ''); + parts = path.split(SEPARATOR); + + for (var i = 0, ii = parts.length; i < ii; i++) { + part = parts[i]; + if (part === '') continue; + (part === '..') ? new_parts.pop() : new_parts.push(part) + } + + return new_parts.join(SEPARATOR); + }; + + Opal.loaded = function(paths) { + var i, l, path; + + for (i = 0, l = paths.length; i < l; i++) { + path = Opal.normalize(paths[i]); + + if (Opal.require_table[path]) { + continue; + } + + Opal.loaded_features.push(path); + Opal.require_table[path] = true; + } + }; + + Opal.load = function(path) { + path = Opal.normalize(path); + + Opal.loaded([path]); + + var module = Opal.modules[path]; + + if (module) { + module(Opal); + } + else { + var severity = Opal.config.missing_require_severity; + var message = 'cannot load such file -- ' + path; + + if (severity === "error") { + if (Opal.LoadError) { + throw Opal.LoadError.$new(message) + } else { + throw message + } + } + else if (severity === "warning") { + console.warn('WARNING: LoadError: ' + message); + } + } + + return true; + }; + + Opal.require = function(path) { + path = Opal.normalize(path); + + if (Opal.require_table[path]) { + return false; + } + + return Opal.load(path); + }; + + + // Initialization + // -------------- + function $BasicObject() {}; + function $Object() {}; + function $Module() {}; + function $Class() {}; + + Opal.BasicObject = BasicObject = Opal.allocate_class('BasicObject', null, $BasicObject); + Opal.Object = _Object = Opal.allocate_class('Object', Opal.BasicObject, $Object); + Opal.Module = Module = Opal.allocate_class('Module', Opal.Object, $Module); + Opal.Class = Class = Opal.allocate_class('Class', Opal.Module, $Class); + + $setPrototype(Opal.BasicObject, Opal.Class.prototype); + $setPrototype(Opal.Object, Opal.Class.prototype); + $setPrototype(Opal.Module, Opal.Class.prototype); + $setPrototype(Opal.Class, Opal.Class.prototype); + + // BasicObject can reach itself, avoid const_set to skip the $$base_module logic + BasicObject.$$const["BasicObject"] = BasicObject; + + // Assign basic constants + Opal.const_set(_Object, "BasicObject", BasicObject); + Opal.const_set(_Object, "Object", _Object); + Opal.const_set(_Object, "Module", Module); + Opal.const_set(_Object, "Class", Class); + + // Fix booted classes to have correct .class value + BasicObject.$$class = Class; + _Object.$$class = Class; + Module.$$class = Class; + Class.$$class = Class; + + // Forward .toString() to #to_s + $defineProperty(_Object.prototype, 'toString', function() { + var to_s = this.$to_s(); + if (to_s.$$is_string && typeof(to_s) === 'object') { + // a string created using new String('string') + return to_s.valueOf(); + } else { + return to_s; + } + }); + + // Make Kernel#require immediately available as it's needed to require all the + // other corelib files. + $defineProperty(_Object.prototype, '$require', Opal.require); + + // Add a short helper to navigate constants manually. + // @example + // Opal.$$.Regexp.$$.IGNORECASE + Opal.$$ = _Object.$$; + + // Instantiate the main object + Opal.top = new _Object(); + Opal.top.$to_s = Opal.top.$inspect = function() { return 'main' }; + + + // Nil + function $NilClass() {}; + Opal.NilClass = Opal.allocate_class('NilClass', Opal.Object, $NilClass); + Opal.const_set(_Object, 'NilClass', Opal.NilClass); + nil = Opal.nil = new Opal.NilClass(); + nil.$$id = nil_id; + nil.call = nil.apply = function() { throw Opal.LocalJumpError.$new('no block given'); }; + + // Errors + Opal.breaker = new Error('unexpected break (old)'); + Opal.returner = new Error('unexpected return'); + TypeError.$$super = Error; +}).call(this); +Opal.loaded(["corelib/runtime.js"]); +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/helpers"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $truthy = Opal.truthy; + + Opal.add_stubs(['$new', '$class', '$===', '$respond_to?', '$raise', '$type_error', '$__send__', '$coerce_to', '$nil?', '$<=>', '$coerce_to!', '$!=', '$[]', '$upcase']); + return (function($base, $parent_nesting) { + function $Opal() {}; + var self = $Opal = $module($base, 'Opal', $Opal); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Opal_bridge_1, TMP_Opal_type_error_2, TMP_Opal_coerce_to_3, TMP_Opal_coerce_to$B_4, TMP_Opal_coerce_to$q_5, TMP_Opal_try_convert_6, TMP_Opal_compare_7, TMP_Opal_destructure_8, TMP_Opal_respond_to$q_9, TMP_Opal_inspect_obj_10, TMP_Opal_instance_variable_name$B_11, TMP_Opal_class_variable_name$B_12, TMP_Opal_const_name$B_13, TMP_Opal_pristine_14; + + + Opal.defs(self, '$bridge', TMP_Opal_bridge_1 = function $$bridge(constructor, klass) { + var self = this; + + return Opal.bridge(constructor, klass); + }, TMP_Opal_bridge_1.$$arity = 2); + Opal.defs(self, '$type_error', TMP_Opal_type_error_2 = function $$type_error(object, type, method, coerced) { + var $a, self = this; + + + + if (method == null) { + method = nil; + }; + + if (coerced == null) { + coerced = nil; + }; + if ($truthy(($truthy($a = method) ? coerced : $a))) { + return $$($nesting, 'TypeError').$new("" + "can't convert " + (object.$class()) + " into " + (type) + " (" + (object.$class()) + "#" + (method) + " gives " + (coerced.$class()) + ")") + } else { + return $$($nesting, 'TypeError').$new("" + "no implicit conversion of " + (object.$class()) + " into " + (type)) + }; + }, TMP_Opal_type_error_2.$$arity = -3); + Opal.defs(self, '$coerce_to', TMP_Opal_coerce_to_3 = function $$coerce_to(object, type, method) { + var self = this; + + + if ($truthy(type['$==='](object))) { + return object}; + if ($truthy(object['$respond_to?'](method))) { + } else { + self.$raise(self.$type_error(object, type)) + }; + return object.$__send__(method); + }, TMP_Opal_coerce_to_3.$$arity = 3); + Opal.defs(self, '$coerce_to!', TMP_Opal_coerce_to$B_4 = function(object, type, method) { + var self = this, coerced = nil; + + + coerced = self.$coerce_to(object, type, method); + if ($truthy(type['$==='](coerced))) { + } else { + self.$raise(self.$type_error(object, type, method, coerced)) + }; + return coerced; + }, TMP_Opal_coerce_to$B_4.$$arity = 3); + Opal.defs(self, '$coerce_to?', TMP_Opal_coerce_to$q_5 = function(object, type, method) { + var self = this, coerced = nil; + + + if ($truthy(object['$respond_to?'](method))) { + } else { + return nil + }; + coerced = self.$coerce_to(object, type, method); + if ($truthy(coerced['$nil?']())) { + return nil}; + if ($truthy(type['$==='](coerced))) { + } else { + self.$raise(self.$type_error(object, type, method, coerced)) + }; + return coerced; + }, TMP_Opal_coerce_to$q_5.$$arity = 3); + Opal.defs(self, '$try_convert', TMP_Opal_try_convert_6 = function $$try_convert(object, type, method) { + var self = this; + + + if ($truthy(type['$==='](object))) { + return object}; + if ($truthy(object['$respond_to?'](method))) { + return object.$__send__(method) + } else { + return nil + }; + }, TMP_Opal_try_convert_6.$$arity = 3); + Opal.defs(self, '$compare', TMP_Opal_compare_7 = function $$compare(a, b) { + var self = this, compare = nil; + + + compare = a['$<=>'](b); + if ($truthy(compare === nil)) { + self.$raise($$($nesting, 'ArgumentError'), "" + "comparison of " + (a.$class()) + " with " + (b.$class()) + " failed")}; + return compare; + }, TMP_Opal_compare_7.$$arity = 2); + Opal.defs(self, '$destructure', TMP_Opal_destructure_8 = function $$destructure(args) { + var self = this; + + + if (args.length == 1) { + return args[0]; + } + else if (args.$$is_array) { + return args; + } + else { + var args_ary = new Array(args.length); + for(var i = 0, l = args_ary.length; i < l; i++) { args_ary[i] = args[i]; } + + return args_ary; + } + + }, TMP_Opal_destructure_8.$$arity = 1); + Opal.defs(self, '$respond_to?', TMP_Opal_respond_to$q_9 = function(obj, method, include_all) { + var self = this; + + + + if (include_all == null) { + include_all = false; + }; + + if (obj == null || !obj.$$class) { + return false; + } + ; + return obj['$respond_to?'](method, include_all); + }, TMP_Opal_respond_to$q_9.$$arity = -3); + Opal.defs(self, '$inspect_obj', TMP_Opal_inspect_obj_10 = function $$inspect_obj(obj) { + var self = this; + + return Opal.inspect(obj); + }, TMP_Opal_inspect_obj_10.$$arity = 1); + Opal.defs(self, '$instance_variable_name!', TMP_Opal_instance_variable_name$B_11 = function(name) { + var self = this; + + + name = $$($nesting, 'Opal')['$coerce_to!'](name, $$($nesting, 'String'), "to_str"); + if ($truthy(/^@[a-zA-Z_][a-zA-Z0-9_]*?$/.test(name))) { + } else { + self.$raise($$($nesting, 'NameError').$new("" + "'" + (name) + "' is not allowed as an instance variable name", name)) + }; + return name; + }, TMP_Opal_instance_variable_name$B_11.$$arity = 1); + Opal.defs(self, '$class_variable_name!', TMP_Opal_class_variable_name$B_12 = function(name) { + var self = this; + + + name = $$($nesting, 'Opal')['$coerce_to!'](name, $$($nesting, 'String'), "to_str"); + if ($truthy(name.length < 3 || name.slice(0,2) !== '@@')) { + self.$raise($$($nesting, 'NameError').$new("" + "`" + (name) + "' is not allowed as a class variable name", name))}; + return name; + }, TMP_Opal_class_variable_name$B_12.$$arity = 1); + Opal.defs(self, '$const_name!', TMP_Opal_const_name$B_13 = function(const_name) { + var self = this; + + + const_name = $$($nesting, 'Opal')['$coerce_to!'](const_name, $$($nesting, 'String'), "to_str"); + if ($truthy(const_name['$[]'](0)['$!='](const_name['$[]'](0).$upcase()))) { + self.$raise($$($nesting, 'NameError'), "" + "wrong constant name " + (const_name))}; + return const_name; + }, TMP_Opal_const_name$B_13.$$arity = 1); + Opal.defs(self, '$pristine', TMP_Opal_pristine_14 = function $$pristine(owner_class, $a) { + var $post_args, method_names, self = this; + + + + $post_args = Opal.slice.call(arguments, 1, arguments.length); + + method_names = $post_args;; + + var method_name, method; + for (var i = method_names.length - 1; i >= 0; i--) { + method_name = method_names[i]; + method = owner_class.prototype['$'+method_name]; + + if (method && !method.$$stub) { + method.$$pristine = true; + } + } + ; + return nil; + }, TMP_Opal_pristine_14.$$arity = -2); + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/module"] = function(Opal) { + function $rb_lt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); + } + function $rb_gt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $send = Opal.send, $truthy = Opal.truthy, $lambda = Opal.lambda, $range = Opal.range, $hash2 = Opal.hash2; + + Opal.add_stubs(['$module_eval', '$to_proc', '$===', '$raise', '$equal?', '$<', '$>', '$nil?', '$attr_reader', '$attr_writer', '$class_variable_name!', '$new', '$const_name!', '$=~', '$inject', '$split', '$const_get', '$==', '$!~', '$start_with?', '$bind', '$call', '$class', '$append_features', '$included', '$name', '$cover?', '$size', '$merge', '$compile', '$proc', '$any?', '$prepend_features', '$prepended', '$to_s', '$__id__', '$constants', '$include?', '$copy_class_variables', '$copy_constants']); + return (function($base, $super, $parent_nesting) { + function $Module(){}; + var self = $Module = $klass($base, $super, 'Module', $Module); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Module_allocate_1, TMP_Module_inherited_2, TMP_Module_initialize_3, TMP_Module_$eq$eq$eq_4, TMP_Module_$lt_5, TMP_Module_$lt$eq_6, TMP_Module_$gt_7, TMP_Module_$gt$eq_8, TMP_Module_$lt$eq$gt_9, TMP_Module_alias_method_10, TMP_Module_alias_native_11, TMP_Module_ancestors_12, TMP_Module_append_features_13, TMP_Module_attr_accessor_14, TMP_Module_attr_reader_15, TMP_Module_attr_writer_16, TMP_Module_autoload_17, TMP_Module_class_variables_18, TMP_Module_class_variable_get_19, TMP_Module_class_variable_set_20, TMP_Module_class_variable_defined$q_21, TMP_Module_remove_class_variable_22, TMP_Module_constants_23, TMP_Module_constants_24, TMP_Module_nesting_25, TMP_Module_const_defined$q_26, TMP_Module_const_get_27, TMP_Module_const_missing_29, TMP_Module_const_set_30, TMP_Module_public_constant_31, TMP_Module_define_method_32, TMP_Module_remove_method_34, TMP_Module_singleton_class$q_35, TMP_Module_include_36, TMP_Module_included_modules_37, TMP_Module_include$q_38, TMP_Module_instance_method_39, TMP_Module_instance_methods_40, TMP_Module_included_41, TMP_Module_extended_42, TMP_Module_extend_object_43, TMP_Module_method_added_44, TMP_Module_method_removed_45, TMP_Module_method_undefined_46, TMP_Module_module_eval_47, TMP_Module_module_exec_49, TMP_Module_method_defined$q_50, TMP_Module_module_function_51, TMP_Module_name_52, TMP_Module_prepend_53, TMP_Module_prepend_features_54, TMP_Module_prepended_55, TMP_Module_remove_const_56, TMP_Module_to_s_57, TMP_Module_undef_method_58, TMP_Module_instance_variables_59, TMP_Module_dup_60, TMP_Module_copy_class_variables_61, TMP_Module_copy_constants_62; + + + Opal.defs(self, '$allocate', TMP_Module_allocate_1 = function $$allocate() { + var self = this; + + + var module = Opal.allocate_module(nil, function(){}); + return module; + + }, TMP_Module_allocate_1.$$arity = 0); + Opal.defs(self, '$inherited', TMP_Module_inherited_2 = function $$inherited(klass) { + var self = this; + + + klass.$allocate = function() { + var module = Opal.allocate_module(nil, function(){}); + Object.setPrototypeOf(module, klass.prototype); + return module; + } + + }, TMP_Module_inherited_2.$$arity = 1); + + Opal.def(self, '$initialize', TMP_Module_initialize_3 = function $$initialize() { + var $iter = TMP_Module_initialize_3.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Module_initialize_3.$$p = null; + + + if ($iter) TMP_Module_initialize_3.$$p = null;; + if ((block !== nil)) { + return $send(self, 'module_eval', [], block.$to_proc()) + } else { + return nil + }; + }, TMP_Module_initialize_3.$$arity = 0); + + Opal.def(self, '$===', TMP_Module_$eq$eq$eq_4 = function(object) { + var self = this; + + + if ($truthy(object == null)) { + return false}; + return Opal.is_a(object, self);; + }, TMP_Module_$eq$eq$eq_4.$$arity = 1); + + Opal.def(self, '$<', TMP_Module_$lt_5 = function(other) { + var self = this; + + + if ($truthy($$($nesting, 'Module')['$==='](other))) { + } else { + self.$raise($$($nesting, 'TypeError'), "compared with non class/module") + }; + + var working = self, + ancestors, + i, length; + + if (working === other) { + return false; + } + + for (i = 0, ancestors = Opal.ancestors(self), length = ancestors.length; i < length; i++) { + if (ancestors[i] === other) { + return true; + } + } + + for (i = 0, ancestors = Opal.ancestors(other), length = ancestors.length; i < length; i++) { + if (ancestors[i] === self) { + return false; + } + } + + return nil; + ; + }, TMP_Module_$lt_5.$$arity = 1); + + Opal.def(self, '$<=', TMP_Module_$lt$eq_6 = function(other) { + var $a, self = this; + + return ($truthy($a = self['$equal?'](other)) ? $a : $rb_lt(self, other)) + }, TMP_Module_$lt$eq_6.$$arity = 1); + + Opal.def(self, '$>', TMP_Module_$gt_7 = function(other) { + var self = this; + + + if ($truthy($$($nesting, 'Module')['$==='](other))) { + } else { + self.$raise($$($nesting, 'TypeError'), "compared with non class/module") + }; + return $rb_lt(other, self); + }, TMP_Module_$gt_7.$$arity = 1); + + Opal.def(self, '$>=', TMP_Module_$gt$eq_8 = function(other) { + var $a, self = this; + + return ($truthy($a = self['$equal?'](other)) ? $a : $rb_gt(self, other)) + }, TMP_Module_$gt$eq_8.$$arity = 1); + + Opal.def(self, '$<=>', TMP_Module_$lt$eq$gt_9 = function(other) { + var self = this, lt = nil; + + + + if (self === other) { + return 0; + } + ; + if ($truthy($$($nesting, 'Module')['$==='](other))) { + } else { + return nil + }; + lt = $rb_lt(self, other); + if ($truthy(lt['$nil?']())) { + return nil}; + if ($truthy(lt)) { + return -1 + } else { + return 1 + }; + }, TMP_Module_$lt$eq$gt_9.$$arity = 1); + + Opal.def(self, '$alias_method', TMP_Module_alias_method_10 = function $$alias_method(newname, oldname) { + var self = this; + + + Opal.alias(self, newname, oldname); + return self; + }, TMP_Module_alias_method_10.$$arity = 2); + + Opal.def(self, '$alias_native', TMP_Module_alias_native_11 = function $$alias_native(mid, jsid) { + var self = this; + + + + if (jsid == null) { + jsid = mid; + }; + Opal.alias_native(self, mid, jsid); + return self; + }, TMP_Module_alias_native_11.$$arity = -2); + + Opal.def(self, '$ancestors', TMP_Module_ancestors_12 = function $$ancestors() { + var self = this; + + return Opal.ancestors(self); + }, TMP_Module_ancestors_12.$$arity = 0); + + Opal.def(self, '$append_features', TMP_Module_append_features_13 = function $$append_features(includer) { + var self = this; + + + Opal.append_features(self, includer); + return self; + }, TMP_Module_append_features_13.$$arity = 1); + + Opal.def(self, '$attr_accessor', TMP_Module_attr_accessor_14 = function $$attr_accessor($a) { + var $post_args, names, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + names = $post_args;; + $send(self, 'attr_reader', Opal.to_a(names)); + return $send(self, 'attr_writer', Opal.to_a(names)); + }, TMP_Module_attr_accessor_14.$$arity = -1); + Opal.alias(self, "attr", "attr_accessor"); + + Opal.def(self, '$attr_reader', TMP_Module_attr_reader_15 = function $$attr_reader($a) { + var $post_args, names, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + names = $post_args;; + + var proto = self.prototype; + + for (var i = names.length - 1; i >= 0; i--) { + var name = names[i], + id = '$' + name, + ivar = Opal.ivar(name); + + // the closure here is needed because name will change at the next + // cycle, I wish we could use let. + var body = (function(ivar) { + return function() { + if (this[ivar] == null) { + return nil; + } + else { + return this[ivar]; + } + }; + })(ivar); + + // initialize the instance variable as nil + Opal.defineProperty(proto, ivar, nil); + + body.$$parameters = []; + body.$$arity = 0; + + Opal.defn(self, id, body); + } + ; + return nil; + }, TMP_Module_attr_reader_15.$$arity = -1); + + Opal.def(self, '$attr_writer', TMP_Module_attr_writer_16 = function $$attr_writer($a) { + var $post_args, names, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + names = $post_args;; + + var proto = self.prototype; + + for (var i = names.length - 1; i >= 0; i--) { + var name = names[i], + id = '$' + name + '=', + ivar = Opal.ivar(name); + + // the closure here is needed because name will change at the next + // cycle, I wish we could use let. + var body = (function(ivar){ + return function(value) { + return this[ivar] = value; + } + })(ivar); + + body.$$parameters = [['req']]; + body.$$arity = 1; + + // initialize the instance variable as nil + Opal.defineProperty(proto, ivar, nil); + + Opal.defn(self, id, body); + } + ; + return nil; + }, TMP_Module_attr_writer_16.$$arity = -1); + + Opal.def(self, '$autoload', TMP_Module_autoload_17 = function $$autoload(const$, path) { + var self = this; + + + if (self.$$autoload == null) self.$$autoload = {}; + Opal.const_cache_version++; + self.$$autoload[const$] = path; + return nil; + + }, TMP_Module_autoload_17.$$arity = 2); + + Opal.def(self, '$class_variables', TMP_Module_class_variables_18 = function $$class_variables() { + var self = this; + + return Object.keys(Opal.class_variables(self)); + }, TMP_Module_class_variables_18.$$arity = 0); + + Opal.def(self, '$class_variable_get', TMP_Module_class_variable_get_19 = function $$class_variable_get(name) { + var self = this; + + + name = $$($nesting, 'Opal')['$class_variable_name!'](name); + + var value = Opal.class_variables(self)[name]; + if (value == null) { + self.$raise($$($nesting, 'NameError').$new("" + "uninitialized class variable " + (name) + " in " + (self), name)) + } + return value; + ; + }, TMP_Module_class_variable_get_19.$$arity = 1); + + Opal.def(self, '$class_variable_set', TMP_Module_class_variable_set_20 = function $$class_variable_set(name, value) { + var self = this; + + + name = $$($nesting, 'Opal')['$class_variable_name!'](name); + return Opal.class_variable_set(self, name, value);; + }, TMP_Module_class_variable_set_20.$$arity = 2); + + Opal.def(self, '$class_variable_defined?', TMP_Module_class_variable_defined$q_21 = function(name) { + var self = this; + + + name = $$($nesting, 'Opal')['$class_variable_name!'](name); + return Opal.class_variables(self).hasOwnProperty(name);; + }, TMP_Module_class_variable_defined$q_21.$$arity = 1); + + Opal.def(self, '$remove_class_variable', TMP_Module_remove_class_variable_22 = function $$remove_class_variable(name) { + var self = this; + + + name = $$($nesting, 'Opal')['$class_variable_name!'](name); + + if (Opal.hasOwnProperty.call(self.$$cvars, name)) { + var value = self.$$cvars[name]; + delete self.$$cvars[name]; + return value; + } else { + self.$raise($$($nesting, 'NameError'), "" + "cannot remove " + (name) + " for " + (self)) + } + ; + }, TMP_Module_remove_class_variable_22.$$arity = 1); + + Opal.def(self, '$constants', TMP_Module_constants_23 = function $$constants(inherit) { + var self = this; + + + + if (inherit == null) { + inherit = true; + }; + return Opal.constants(self, inherit);; + }, TMP_Module_constants_23.$$arity = -1); + Opal.defs(self, '$constants', TMP_Module_constants_24 = function $$constants(inherit) { + var self = this; + + + ; + + if (inherit == null) { + var nesting = (self.$$nesting || []).concat(Opal.Object), + constant, constants = {}, + i, ii; + + for(i = 0, ii = nesting.length; i < ii; i++) { + for (constant in nesting[i].$$const) { + constants[constant] = true; + } + } + return Object.keys(constants); + } else { + return Opal.constants(self, inherit) + } + ; + }, TMP_Module_constants_24.$$arity = -1); + Opal.defs(self, '$nesting', TMP_Module_nesting_25 = function $$nesting() { + var self = this; + + return self.$$nesting || []; + }, TMP_Module_nesting_25.$$arity = 0); + + Opal.def(self, '$const_defined?', TMP_Module_const_defined$q_26 = function(name, inherit) { + var self = this; + + + + if (inherit == null) { + inherit = true; + }; + name = $$($nesting, 'Opal')['$const_name!'](name); + if ($truthy(name['$=~']($$$($$($nesting, 'Opal'), 'CONST_NAME_REGEXP')))) { + } else { + self.$raise($$($nesting, 'NameError').$new("" + "wrong constant name " + (name), name)) + }; + + var module, modules = [self], module_constants, i, ii; + + // Add up ancestors if inherit is true + if (inherit) { + modules = modules.concat(Opal.ancestors(self)); + + // Add Object's ancestors if it's a module – modules have no ancestors otherwise + if (self.$$is_module) { + modules = modules.concat([Opal.Object]).concat(Opal.ancestors(Opal.Object)); + } + } + + for (i = 0, ii = modules.length; i < ii; i++) { + module = modules[i]; + if (module.$$const[name] != null) { + return true; + } + } + + return false; + ; + }, TMP_Module_const_defined$q_26.$$arity = -2); + + Opal.def(self, '$const_get', TMP_Module_const_get_27 = function $$const_get(name, inherit) { + var TMP_28, self = this; + + + + if (inherit == null) { + inherit = true; + }; + name = $$($nesting, 'Opal')['$const_name!'](name); + + if (name.indexOf('::') === 0 && name !== '::'){ + name = name.slice(2); + } + ; + if ($truthy(name.indexOf('::') != -1 && name != '::')) { + return $send(name.$split("::"), 'inject', [self], (TMP_28 = function(o, c){var self = TMP_28.$$s || this; + + + + if (o == null) { + o = nil; + }; + + if (c == null) { + c = nil; + }; + return o.$const_get(c);}, TMP_28.$$s = self, TMP_28.$$arity = 2, TMP_28))}; + if ($truthy(name['$=~']($$$($$($nesting, 'Opal'), 'CONST_NAME_REGEXP')))) { + } else { + self.$raise($$($nesting, 'NameError').$new("" + "wrong constant name " + (name), name)) + }; + + if (inherit) { + return $$([self], name); + } else { + return Opal.const_get_local(self, name); + } + ; + }, TMP_Module_const_get_27.$$arity = -2); + + Opal.def(self, '$const_missing', TMP_Module_const_missing_29 = function $$const_missing(name) { + var self = this, full_const_name = nil; + + + + if (self.$$autoload) { + var file = self.$$autoload[name]; + + if (file) { + self.$require(file); + + return self.$const_get(name); + } + } + ; + full_const_name = (function() {if (self['$==']($$($nesting, 'Object'))) { + return name + } else { + return "" + (self) + "::" + (name) + }; return nil; })(); + return self.$raise($$($nesting, 'NameError').$new("" + "uninitialized constant " + (full_const_name), name)); + }, TMP_Module_const_missing_29.$$arity = 1); + + Opal.def(self, '$const_set', TMP_Module_const_set_30 = function $$const_set(name, value) { + var $a, self = this; + + + name = $$($nesting, 'Opal')['$const_name!'](name); + if ($truthy(($truthy($a = name['$!~']($$$($$($nesting, 'Opal'), 'CONST_NAME_REGEXP'))) ? $a : name['$start_with?']("::")))) { + self.$raise($$($nesting, 'NameError').$new("" + "wrong constant name " + (name), name))}; + Opal.const_set(self, name, value); + return value; + }, TMP_Module_const_set_30.$$arity = 2); + + Opal.def(self, '$public_constant', TMP_Module_public_constant_31 = function $$public_constant(const_name) { + var self = this; + + return nil + }, TMP_Module_public_constant_31.$$arity = 1); + + Opal.def(self, '$define_method', TMP_Module_define_method_32 = function $$define_method(name, method) { + var $iter = TMP_Module_define_method_32.$$p, block = $iter || nil, $a, TMP_33, self = this, $case = nil; + + if ($iter) TMP_Module_define_method_32.$$p = null; + + + if ($iter) TMP_Module_define_method_32.$$p = null;; + ; + if ($truthy(method === undefined && block === nil)) { + self.$raise($$($nesting, 'ArgumentError'), "tried to create a Proc object without a block")}; + block = ($truthy($a = block) ? $a : (function() {$case = method; + if ($$($nesting, 'Proc')['$===']($case)) {return method} + else if ($$($nesting, 'Method')['$===']($case)) {return method.$to_proc().$$unbound} + else if ($$($nesting, 'UnboundMethod')['$===']($case)) {return $lambda((TMP_33 = function($b){var self = TMP_33.$$s || this, $post_args, args, bound = nil; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + bound = method.$bind(self); + return $send(bound, 'call', Opal.to_a(args));}, TMP_33.$$s = self, TMP_33.$$arity = -1, TMP_33))} + else {return self.$raise($$($nesting, 'TypeError'), "" + "wrong argument type " + (block.$class()) + " (expected Proc/Method)")}})()); + + var id = '$' + name; + + block.$$jsid = name; + block.$$s = null; + block.$$def = block; + block.$$define_meth = true; + + Opal.defn(self, id, block); + + return name; + ; + }, TMP_Module_define_method_32.$$arity = -2); + + Opal.def(self, '$remove_method', TMP_Module_remove_method_34 = function $$remove_method($a) { + var $post_args, names, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + names = $post_args;; + + for (var i = 0, length = names.length; i < length; i++) { + Opal.rdef(self, "$" + names[i]); + } + ; + return self; + }, TMP_Module_remove_method_34.$$arity = -1); + + Opal.def(self, '$singleton_class?', TMP_Module_singleton_class$q_35 = function() { + var self = this; + + return !!self.$$is_singleton; + }, TMP_Module_singleton_class$q_35.$$arity = 0); + + Opal.def(self, '$include', TMP_Module_include_36 = function $$include($a) { + var $post_args, mods, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + mods = $post_args;; + + for (var i = mods.length - 1; i >= 0; i--) { + var mod = mods[i]; + + if (!mod.$$is_module) { + self.$raise($$($nesting, 'TypeError'), "" + "wrong argument type " + ((mod).$class()) + " (expected Module)"); + } + + (mod).$append_features(self); + (mod).$included(self); + } + ; + return self; + }, TMP_Module_include_36.$$arity = -1); + + Opal.def(self, '$included_modules', TMP_Module_included_modules_37 = function $$included_modules() { + var self = this; + + return Opal.included_modules(self); + }, TMP_Module_included_modules_37.$$arity = 0); + + Opal.def(self, '$include?', TMP_Module_include$q_38 = function(mod) { + var self = this; + + + if (!mod.$$is_module) { + self.$raise($$($nesting, 'TypeError'), "" + "wrong argument type " + ((mod).$class()) + " (expected Module)"); + } + + var i, ii, mod2, ancestors = Opal.ancestors(self); + + for (i = 0, ii = ancestors.length; i < ii; i++) { + mod2 = ancestors[i]; + if (mod2 === mod && mod2 !== self) { + return true; + } + } + + return false; + + }, TMP_Module_include$q_38.$$arity = 1); + + Opal.def(self, '$instance_method', TMP_Module_instance_method_39 = function $$instance_method(name) { + var self = this; + + + var meth = self.prototype['$' + name]; + + if (!meth || meth.$$stub) { + self.$raise($$($nesting, 'NameError').$new("" + "undefined method `" + (name) + "' for class `" + (self.$name()) + "'", name)); + } + + return $$($nesting, 'UnboundMethod').$new(self, meth.$$owner || self, meth, name); + + }, TMP_Module_instance_method_39.$$arity = 1); + + Opal.def(self, '$instance_methods', TMP_Module_instance_methods_40 = function $$instance_methods(include_super) { + var self = this; + + + + if (include_super == null) { + include_super = true; + }; + + if ($truthy(include_super)) { + return Opal.instance_methods(self); + } else { + return Opal.own_instance_methods(self); + } + ; + }, TMP_Module_instance_methods_40.$$arity = -1); + + Opal.def(self, '$included', TMP_Module_included_41 = function $$included(mod) { + var self = this; + + return nil + }, TMP_Module_included_41.$$arity = 1); + + Opal.def(self, '$extended', TMP_Module_extended_42 = function $$extended(mod) { + var self = this; + + return nil + }, TMP_Module_extended_42.$$arity = 1); + + Opal.def(self, '$extend_object', TMP_Module_extend_object_43 = function $$extend_object(object) { + var self = this; + + return nil + }, TMP_Module_extend_object_43.$$arity = 1); + + Opal.def(self, '$method_added', TMP_Module_method_added_44 = function $$method_added($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return nil; + }, TMP_Module_method_added_44.$$arity = -1); + + Opal.def(self, '$method_removed', TMP_Module_method_removed_45 = function $$method_removed($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return nil; + }, TMP_Module_method_removed_45.$$arity = -1); + + Opal.def(self, '$method_undefined', TMP_Module_method_undefined_46 = function $$method_undefined($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return nil; + }, TMP_Module_method_undefined_46.$$arity = -1); + + Opal.def(self, '$module_eval', TMP_Module_module_eval_47 = function $$module_eval($a) { + var $iter = TMP_Module_module_eval_47.$$p, block = $iter || nil, $post_args, args, $b, TMP_48, self = this, string = nil, file = nil, _lineno = nil, default_eval_options = nil, compiling_options = nil, compiled = nil; + + if ($iter) TMP_Module_module_eval_47.$$p = null; + + + if ($iter) TMP_Module_module_eval_47.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + if ($truthy(($truthy($b = block['$nil?']()) ? !!Opal.compile : $b))) { + + if ($truthy($range(1, 3, false)['$cover?'](args.$size()))) { + } else { + $$($nesting, 'Kernel').$raise($$($nesting, 'ArgumentError'), "wrong number of arguments (0 for 1..3)") + }; + $b = [].concat(Opal.to_a(args)), (string = ($b[0] == null ? nil : $b[0])), (file = ($b[1] == null ? nil : $b[1])), (_lineno = ($b[2] == null ? nil : $b[2])), $b; + default_eval_options = $hash2(["file", "eval"], {"file": ($truthy($b = file) ? $b : "(eval)"), "eval": true}); + compiling_options = Opal.hash({ arity_check: false }).$merge(default_eval_options); + compiled = $$($nesting, 'Opal').$compile(string, compiling_options); + block = $send($$($nesting, 'Kernel'), 'proc', [], (TMP_48 = function(){var self = TMP_48.$$s || this; + + + return (function(self) { + return eval(compiled); + })(self) + }, TMP_48.$$s = self, TMP_48.$$arity = 0, TMP_48)); + } else if ($truthy(args['$any?']())) { + $$($nesting, 'Kernel').$raise($$($nesting, 'ArgumentError'), "" + ("" + "wrong number of arguments (" + (args.$size()) + " for 0)") + "\n\n NOTE:If you want to enable passing a String argument please add \"require 'opal-parser'\" to your script\n")}; + + var old = block.$$s, + result; + + block.$$s = null; + result = block.apply(self, [self]); + block.$$s = old; + + return result; + ; + }, TMP_Module_module_eval_47.$$arity = -1); + Opal.alias(self, "class_eval", "module_eval"); + + Opal.def(self, '$module_exec', TMP_Module_module_exec_49 = function $$module_exec($a) { + var $iter = TMP_Module_module_exec_49.$$p, block = $iter || nil, $post_args, args, self = this; + + if ($iter) TMP_Module_module_exec_49.$$p = null; + + + if ($iter) TMP_Module_module_exec_49.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + + if (block === nil) { + self.$raise($$($nesting, 'LocalJumpError'), "no block given") + } + + var block_self = block.$$s, result; + + block.$$s = null; + result = block.apply(self, args); + block.$$s = block_self; + + return result; + ; + }, TMP_Module_module_exec_49.$$arity = -1); + Opal.alias(self, "class_exec", "module_exec"); + + Opal.def(self, '$method_defined?', TMP_Module_method_defined$q_50 = function(method) { + var self = this; + + + var body = self.prototype['$' + method]; + return (!!body) && !body.$$stub; + + }, TMP_Module_method_defined$q_50.$$arity = 1); + + Opal.def(self, '$module_function', TMP_Module_module_function_51 = function $$module_function($a) { + var $post_args, methods, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + methods = $post_args;; + + if (methods.length === 0) { + self.$$module_function = true; + } + else { + for (var i = 0, length = methods.length; i < length; i++) { + var meth = methods[i], + id = '$' + meth, + func = self.prototype[id]; + + Opal.defs(self, id, func); + } + } + + return self; + ; + }, TMP_Module_module_function_51.$$arity = -1); + + Opal.def(self, '$name', TMP_Module_name_52 = function $$name() { + var self = this; + + + if (self.$$full_name) { + return self.$$full_name; + } + + var result = [], base = self; + + while (base) { + // Give up if any of the ancestors is unnamed + if (base.$$name === nil || base.$$name == null) return nil; + + result.unshift(base.$$name); + + base = base.$$base_module; + + if (base === Opal.Object) { + break; + } + } + + if (result.length === 0) { + return nil; + } + + return self.$$full_name = result.join('::'); + + }, TMP_Module_name_52.$$arity = 0); + + Opal.def(self, '$prepend', TMP_Module_prepend_53 = function $$prepend($a) { + var $post_args, mods, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + mods = $post_args;; + + if (mods.length === 0) { + self.$raise($$($nesting, 'ArgumentError'), "wrong number of arguments (given 0, expected 1+)") + } + + for (var i = mods.length - 1; i >= 0; i--) { + var mod = mods[i]; + + if (!mod.$$is_module) { + self.$raise($$($nesting, 'TypeError'), "" + "wrong argument type " + ((mod).$class()) + " (expected Module)"); + } + + (mod).$prepend_features(self); + (mod).$prepended(self); + } + ; + return self; + }, TMP_Module_prepend_53.$$arity = -1); + + Opal.def(self, '$prepend_features', TMP_Module_prepend_features_54 = function $$prepend_features(prepender) { + var self = this; + + + + if (!self.$$is_module) { + self.$raise($$($nesting, 'TypeError'), "" + "wrong argument type " + (self.$class()) + " (expected Module)"); + } + + Opal.prepend_features(self, prepender) + ; + return self; + }, TMP_Module_prepend_features_54.$$arity = 1); + + Opal.def(self, '$prepended', TMP_Module_prepended_55 = function $$prepended(mod) { + var self = this; + + return nil + }, TMP_Module_prepended_55.$$arity = 1); + + Opal.def(self, '$remove_const', TMP_Module_remove_const_56 = function $$remove_const(name) { + var self = this; + + return Opal.const_remove(self, name); + }, TMP_Module_remove_const_56.$$arity = 1); + + Opal.def(self, '$to_s', TMP_Module_to_s_57 = function $$to_s() { + var $a, self = this; + + return ($truthy($a = Opal.Module.$name.call(self)) ? $a : "" + "#<" + (self.$$is_module ? 'Module' : 'Class') + ":0x" + (self.$__id__().$to_s(16)) + ">") + }, TMP_Module_to_s_57.$$arity = 0); + + Opal.def(self, '$undef_method', TMP_Module_undef_method_58 = function $$undef_method($a) { + var $post_args, names, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + names = $post_args;; + + for (var i = 0, length = names.length; i < length; i++) { + Opal.udef(self, "$" + names[i]); + } + ; + return self; + }, TMP_Module_undef_method_58.$$arity = -1); + + Opal.def(self, '$instance_variables', TMP_Module_instance_variables_59 = function $$instance_variables() { + var self = this, consts = nil; + + + consts = (Opal.Module.$$nesting = $nesting, self.$constants()); + + var result = []; + + for (var name in self) { + if (self.hasOwnProperty(name) && name.charAt(0) !== '$' && name !== 'constructor' && !consts['$include?'](name)) { + result.push('@' + name); + } + } + + return result; + ; + }, TMP_Module_instance_variables_59.$$arity = 0); + + Opal.def(self, '$dup', TMP_Module_dup_60 = function $$dup() { + var $iter = TMP_Module_dup_60.$$p, $yield = $iter || nil, self = this, copy = nil, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_Module_dup_60.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + + copy = $send(self, Opal.find_super_dispatcher(self, 'dup', TMP_Module_dup_60, false), $zuper, $iter); + copy.$copy_class_variables(self); + copy.$copy_constants(self); + return copy; + }, TMP_Module_dup_60.$$arity = 0); + + Opal.def(self, '$copy_class_variables', TMP_Module_copy_class_variables_61 = function $$copy_class_variables(other) { + var self = this; + + + for (var name in other.$$cvars) { + self.$$cvars[name] = other.$$cvars[name]; + } + + }, TMP_Module_copy_class_variables_61.$$arity = 1); + return (Opal.def(self, '$copy_constants', TMP_Module_copy_constants_62 = function $$copy_constants(other) { + var self = this; + + + var name, other_constants = other.$$const; + + for (name in other_constants) { + Opal.const_set(self, name, other_constants[name]); + } + + }, TMP_Module_copy_constants_62.$$arity = 1), nil) && 'copy_constants'; + })($nesting[0], null, $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/class"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $send = Opal.send; + + Opal.add_stubs(['$require', '$class_eval', '$to_proc', '$initialize_copy', '$allocate', '$name', '$to_s']); + + self.$require("corelib/module"); + return (function($base, $super, $parent_nesting) { + function $Class(){}; + var self = $Class = $klass($base, $super, 'Class', $Class); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Class_new_1, TMP_Class_allocate_2, TMP_Class_inherited_3, TMP_Class_initialize_dup_4, TMP_Class_new_5, TMP_Class_superclass_6, TMP_Class_to_s_7; + + + Opal.defs(self, '$new', TMP_Class_new_1 = function(superclass) { + var $iter = TMP_Class_new_1.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Class_new_1.$$p = null; + + + if ($iter) TMP_Class_new_1.$$p = null;; + + if (superclass == null) { + superclass = $$($nesting, 'Object'); + }; + + if (!superclass.$$is_class) { + throw Opal.TypeError.$new("superclass must be a Class"); + } + + var klass = Opal.allocate_class(nil, superclass, function(){}); + superclass.$inherited(klass); + (function() {if ((block !== nil)) { + return $send((klass), 'class_eval', [], block.$to_proc()) + } else { + return nil + }; return nil; })() + return klass; + ; + }, TMP_Class_new_1.$$arity = -1); + + Opal.def(self, '$allocate', TMP_Class_allocate_2 = function $$allocate() { + var self = this; + + + var obj = new self(); + obj.$$id = Opal.uid(); + return obj; + + }, TMP_Class_allocate_2.$$arity = 0); + + Opal.def(self, '$inherited', TMP_Class_inherited_3 = function $$inherited(cls) { + var self = this; + + return nil + }, TMP_Class_inherited_3.$$arity = 1); + + Opal.def(self, '$initialize_dup', TMP_Class_initialize_dup_4 = function $$initialize_dup(original) { + var self = this; + + + self.$initialize_copy(original); + + self.$$name = null; + self.$$full_name = null; + ; + }, TMP_Class_initialize_dup_4.$$arity = 1); + + Opal.def(self, '$new', TMP_Class_new_5 = function($a) { + var $iter = TMP_Class_new_5.$$p, block = $iter || nil, $post_args, args, self = this; + + if ($iter) TMP_Class_new_5.$$p = null; + + + if ($iter) TMP_Class_new_5.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + + var object = self.$allocate(); + Opal.send(object, object.$initialize, args, block); + return object; + ; + }, TMP_Class_new_5.$$arity = -1); + + Opal.def(self, '$superclass', TMP_Class_superclass_6 = function $$superclass() { + var self = this; + + return self.$$super || nil; + }, TMP_Class_superclass_6.$$arity = 0); + return (Opal.def(self, '$to_s', TMP_Class_to_s_7 = function $$to_s() { + var $iter = TMP_Class_to_s_7.$$p, $yield = $iter || nil, self = this; + + if ($iter) TMP_Class_to_s_7.$$p = null; + + var singleton_of = self.$$singleton_of; + + if (singleton_of && (singleton_of.$$is_a_module)) { + return "" + "#"; + } + else if (singleton_of) { + // a singleton class created from an object + return "" + "#>"; + } + return $send(self, Opal.find_super_dispatcher(self, 'to_s', TMP_Class_to_s_7, false), [], null); + + }, TMP_Class_to_s_7.$$arity = 0), nil) && 'to_s'; + })($nesting[0], null, $nesting); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/basic_object"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $truthy = Opal.truthy, $range = Opal.range, $hash2 = Opal.hash2, $send = Opal.send; + + Opal.add_stubs(['$==', '$!', '$nil?', '$cover?', '$size', '$raise', '$merge', '$compile', '$proc', '$any?', '$inspect', '$new']); + return (function($base, $super, $parent_nesting) { + function $BasicObject(){}; + var self = $BasicObject = $klass($base, $super, 'BasicObject', $BasicObject); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_BasicObject_initialize_1, TMP_BasicObject_$eq$eq_2, TMP_BasicObject_eql$q_3, TMP_BasicObject___id___4, TMP_BasicObject___send___5, TMP_BasicObject_$B_6, TMP_BasicObject_$B$eq_7, TMP_BasicObject_instance_eval_8, TMP_BasicObject_instance_exec_10, TMP_BasicObject_singleton_method_added_11, TMP_BasicObject_singleton_method_removed_12, TMP_BasicObject_singleton_method_undefined_13, TMP_BasicObject_class_14, TMP_BasicObject_method_missing_15; + + + + Opal.def(self, '$initialize', TMP_BasicObject_initialize_1 = function $$initialize($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return nil; + }, TMP_BasicObject_initialize_1.$$arity = -1); + + Opal.def(self, '$==', TMP_BasicObject_$eq$eq_2 = function(other) { + var self = this; + + return self === other; + }, TMP_BasicObject_$eq$eq_2.$$arity = 1); + + Opal.def(self, '$eql?', TMP_BasicObject_eql$q_3 = function(other) { + var self = this; + + return self['$=='](other) + }, TMP_BasicObject_eql$q_3.$$arity = 1); + Opal.alias(self, "equal?", "=="); + + Opal.def(self, '$__id__', TMP_BasicObject___id___4 = function $$__id__() { + var self = this; + + + if (self.$$id != null) { + return self.$$id; + } + Opal.defineProperty(self, '$$id', Opal.uid()); + return self.$$id; + + }, TMP_BasicObject___id___4.$$arity = 0); + + Opal.def(self, '$__send__', TMP_BasicObject___send___5 = function $$__send__(symbol, $a) { + var $iter = TMP_BasicObject___send___5.$$p, block = $iter || nil, $post_args, args, self = this; + + if ($iter) TMP_BasicObject___send___5.$$p = null; + + + if ($iter) TMP_BasicObject___send___5.$$p = null;; + + $post_args = Opal.slice.call(arguments, 1, arguments.length); + + args = $post_args;; + + var func = self['$' + symbol] + + if (func) { + if (block !== nil) { + func.$$p = block; + } + + return func.apply(self, args); + } + + if (block !== nil) { + self.$method_missing.$$p = block; + } + + return self.$method_missing.apply(self, [symbol].concat(args)); + ; + }, TMP_BasicObject___send___5.$$arity = -2); + + Opal.def(self, '$!', TMP_BasicObject_$B_6 = function() { + var self = this; + + return false + }, TMP_BasicObject_$B_6.$$arity = 0); + + Opal.def(self, '$!=', TMP_BasicObject_$B$eq_7 = function(other) { + var self = this; + + return self['$=='](other)['$!']() + }, TMP_BasicObject_$B$eq_7.$$arity = 1); + + Opal.def(self, '$instance_eval', TMP_BasicObject_instance_eval_8 = function $$instance_eval($a) { + var $iter = TMP_BasicObject_instance_eval_8.$$p, block = $iter || nil, $post_args, args, $b, TMP_9, self = this, string = nil, file = nil, _lineno = nil, default_eval_options = nil, compiling_options = nil, compiled = nil; + + if ($iter) TMP_BasicObject_instance_eval_8.$$p = null; + + + if ($iter) TMP_BasicObject_instance_eval_8.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + if ($truthy(($truthy($b = block['$nil?']()) ? !!Opal.compile : $b))) { + + if ($truthy($range(1, 3, false)['$cover?'](args.$size()))) { + } else { + $$$('::', 'Kernel').$raise($$$('::', 'ArgumentError'), "wrong number of arguments (0 for 1..3)") + }; + $b = [].concat(Opal.to_a(args)), (string = ($b[0] == null ? nil : $b[0])), (file = ($b[1] == null ? nil : $b[1])), (_lineno = ($b[2] == null ? nil : $b[2])), $b; + default_eval_options = $hash2(["file", "eval"], {"file": ($truthy($b = file) ? $b : "(eval)"), "eval": true}); + compiling_options = Opal.hash({ arity_check: false }).$merge(default_eval_options); + compiled = $$$('::', 'Opal').$compile(string, compiling_options); + block = $send($$$('::', 'Kernel'), 'proc', [], (TMP_9 = function(){var self = TMP_9.$$s || this; + + + return (function(self) { + return eval(compiled); + })(self) + }, TMP_9.$$s = self, TMP_9.$$arity = 0, TMP_9)); + } else if ($truthy(args['$any?']())) { + $$$('::', 'Kernel').$raise($$$('::', 'ArgumentError'), "" + "wrong number of arguments (" + (args.$size()) + " for 0)")}; + + var old = block.$$s, + result; + + block.$$s = null; + + // Need to pass $$eval so that method definitions know if this is + // being done on a class/module. Cannot be compiler driven since + // send(:instance_eval) needs to work. + if (self.$$is_a_module) { + self.$$eval = true; + try { + result = block.call(self, self); + } + finally { + self.$$eval = false; + } + } + else { + result = block.call(self, self); + } + + block.$$s = old; + + return result; + ; + }, TMP_BasicObject_instance_eval_8.$$arity = -1); + + Opal.def(self, '$instance_exec', TMP_BasicObject_instance_exec_10 = function $$instance_exec($a) { + var $iter = TMP_BasicObject_instance_exec_10.$$p, block = $iter || nil, $post_args, args, self = this; + + if ($iter) TMP_BasicObject_instance_exec_10.$$p = null; + + + if ($iter) TMP_BasicObject_instance_exec_10.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + if ($truthy(block)) { + } else { + $$$('::', 'Kernel').$raise($$$('::', 'ArgumentError'), "no block given") + }; + + var block_self = block.$$s, + result; + + block.$$s = null; + + if (self.$$is_a_module) { + self.$$eval = true; + try { + result = block.apply(self, args); + } + finally { + self.$$eval = false; + } + } + else { + result = block.apply(self, args); + } + + block.$$s = block_self; + + return result; + ; + }, TMP_BasicObject_instance_exec_10.$$arity = -1); + + Opal.def(self, '$singleton_method_added', TMP_BasicObject_singleton_method_added_11 = function $$singleton_method_added($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return nil; + }, TMP_BasicObject_singleton_method_added_11.$$arity = -1); + + Opal.def(self, '$singleton_method_removed', TMP_BasicObject_singleton_method_removed_12 = function $$singleton_method_removed($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return nil; + }, TMP_BasicObject_singleton_method_removed_12.$$arity = -1); + + Opal.def(self, '$singleton_method_undefined', TMP_BasicObject_singleton_method_undefined_13 = function $$singleton_method_undefined($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return nil; + }, TMP_BasicObject_singleton_method_undefined_13.$$arity = -1); + + Opal.def(self, '$class', TMP_BasicObject_class_14 = function() { + var self = this; + + return self.$$class; + }, TMP_BasicObject_class_14.$$arity = 0); + return (Opal.def(self, '$method_missing', TMP_BasicObject_method_missing_15 = function $$method_missing(symbol, $a) { + var $iter = TMP_BasicObject_method_missing_15.$$p, block = $iter || nil, $post_args, args, self = this, message = nil; + + if ($iter) TMP_BasicObject_method_missing_15.$$p = null; + + + if ($iter) TMP_BasicObject_method_missing_15.$$p = null;; + + $post_args = Opal.slice.call(arguments, 1, arguments.length); + + args = $post_args;; + message = (function() {if ($truthy(self.$inspect && !self.$inspect.$$stub)) { + return "" + "undefined method `" + (symbol) + "' for " + (self.$inspect()) + ":" + (self.$$class) + } else { + return "" + "undefined method `" + (symbol) + "' for " + (self.$$class) + }; return nil; })(); + return $$$('::', 'Kernel').$raise($$$('::', 'NoMethodError').$new(message, symbol)); + }, TMP_BasicObject_method_missing_15.$$arity = -2), nil) && 'method_missing'; + })($nesting[0], null, $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/kernel"] = function(Opal) { + function $rb_le(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs <= rhs : lhs['$<='](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $truthy = Opal.truthy, $gvars = Opal.gvars, $hash2 = Opal.hash2, $send = Opal.send, $klass = Opal.klass; + + Opal.add_stubs(['$raise', '$new', '$inspect', '$!', '$=~', '$==', '$object_id', '$class', '$coerce_to?', '$<<', '$allocate', '$copy_instance_variables', '$copy_singleton_methods', '$initialize_clone', '$initialize_copy', '$define_method', '$singleton_class', '$to_proc', '$initialize_dup', '$for', '$empty?', '$pop', '$call', '$coerce_to', '$append_features', '$extend_object', '$extended', '$length', '$respond_to?', '$[]', '$nil?', '$to_a', '$to_int', '$fetch', '$Integer', '$Float', '$to_ary', '$to_str', '$to_s', '$__id__', '$instance_variable_name!', '$coerce_to!', '$===', '$enum_for', '$result', '$any?', '$print', '$format', '$puts', '$each', '$<=', '$exception', '$is_a?', '$rand', '$respond_to_missing?', '$try_convert!', '$expand_path', '$join', '$start_with?', '$new_seed', '$srand', '$sym', '$arg', '$open', '$include']); + + (function($base, $parent_nesting) { + function $Kernel() {}; + var self = $Kernel = $module($base, 'Kernel', $Kernel); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Kernel_method_missing_1, TMP_Kernel_$eq$_2, TMP_Kernel_$B$_3, TMP_Kernel_$eq$eq$eq_4, TMP_Kernel_$lt$eq$gt_5, TMP_Kernel_method_6, TMP_Kernel_methods_7, TMP_Kernel_public_methods_8, TMP_Kernel_Array_9, TMP_Kernel_at_exit_10, TMP_Kernel_caller_11, TMP_Kernel_class_12, TMP_Kernel_copy_instance_variables_13, TMP_Kernel_copy_singleton_methods_14, TMP_Kernel_clone_15, TMP_Kernel_initialize_clone_16, TMP_Kernel_define_singleton_method_17, TMP_Kernel_dup_18, TMP_Kernel_initialize_dup_19, TMP_Kernel_enum_for_20, TMP_Kernel_equal$q_21, TMP_Kernel_exit_22, TMP_Kernel_extend_23, TMP_Kernel_format_24, TMP_Kernel_hash_25, TMP_Kernel_initialize_copy_26, TMP_Kernel_inspect_27, TMP_Kernel_instance_of$q_28, TMP_Kernel_instance_variable_defined$q_29, TMP_Kernel_instance_variable_get_30, TMP_Kernel_instance_variable_set_31, TMP_Kernel_remove_instance_variable_32, TMP_Kernel_instance_variables_33, TMP_Kernel_Integer_34, TMP_Kernel_Float_35, TMP_Kernel_Hash_36, TMP_Kernel_is_a$q_37, TMP_Kernel_itself_38, TMP_Kernel_lambda_39, TMP_Kernel_load_40, TMP_Kernel_loop_41, TMP_Kernel_nil$q_43, TMP_Kernel_printf_44, TMP_Kernel_proc_45, TMP_Kernel_puts_46, TMP_Kernel_p_47, TMP_Kernel_print_49, TMP_Kernel_warn_50, TMP_Kernel_raise_51, TMP_Kernel_rand_52, TMP_Kernel_respond_to$q_53, TMP_Kernel_respond_to_missing$q_54, TMP_Kernel_require_55, TMP_Kernel_require_relative_56, TMP_Kernel_require_tree_57, TMP_Kernel_singleton_class_58, TMP_Kernel_sleep_59, TMP_Kernel_srand_60, TMP_Kernel_String_61, TMP_Kernel_tap_62, TMP_Kernel_to_proc_63, TMP_Kernel_to_s_64, TMP_Kernel_catch_65, TMP_Kernel_throw_66, TMP_Kernel_open_67, TMP_Kernel_yield_self_68; + + + + Opal.def(self, '$method_missing', TMP_Kernel_method_missing_1 = function $$method_missing(symbol, $a) { + var $iter = TMP_Kernel_method_missing_1.$$p, block = $iter || nil, $post_args, args, self = this; + + if ($iter) TMP_Kernel_method_missing_1.$$p = null; + + + if ($iter) TMP_Kernel_method_missing_1.$$p = null;; + + $post_args = Opal.slice.call(arguments, 1, arguments.length); + + args = $post_args;; + return self.$raise($$($nesting, 'NoMethodError').$new("" + "undefined method `" + (symbol) + "' for " + (self.$inspect()), symbol, args)); + }, TMP_Kernel_method_missing_1.$$arity = -2); + + Opal.def(self, '$=~', TMP_Kernel_$eq$_2 = function(obj) { + var self = this; + + return false + }, TMP_Kernel_$eq$_2.$$arity = 1); + + Opal.def(self, '$!~', TMP_Kernel_$B$_3 = function(obj) { + var self = this; + + return self['$=~'](obj)['$!']() + }, TMP_Kernel_$B$_3.$$arity = 1); + + Opal.def(self, '$===', TMP_Kernel_$eq$eq$eq_4 = function(other) { + var $a, self = this; + + return ($truthy($a = self.$object_id()['$=='](other.$object_id())) ? $a : self['$=='](other)) + }, TMP_Kernel_$eq$eq$eq_4.$$arity = 1); + + Opal.def(self, '$<=>', TMP_Kernel_$lt$eq$gt_5 = function(other) { + var self = this; + + + // set guard for infinite recursion + self.$$comparable = true; + + var x = self['$=='](other); + + if (x && x !== nil) { + return 0; + } + + return nil; + + }, TMP_Kernel_$lt$eq$gt_5.$$arity = 1); + + Opal.def(self, '$method', TMP_Kernel_method_6 = function $$method(name) { + var self = this; + + + var meth = self['$' + name]; + + if (!meth || meth.$$stub) { + self.$raise($$($nesting, 'NameError').$new("" + "undefined method `" + (name) + "' for class `" + (self.$class()) + "'", name)); + } + + return $$($nesting, 'Method').$new(self, meth.$$owner || self.$class(), meth, name); + + }, TMP_Kernel_method_6.$$arity = 1); + + Opal.def(self, '$methods', TMP_Kernel_methods_7 = function $$methods(all) { + var self = this; + + + + if (all == null) { + all = true; + }; + + if ($truthy(all)) { + return Opal.methods(self); + } else { + return Opal.own_methods(self); + } + ; + }, TMP_Kernel_methods_7.$$arity = -1); + + Opal.def(self, '$public_methods', TMP_Kernel_public_methods_8 = function $$public_methods(all) { + var self = this; + + + + if (all == null) { + all = true; + }; + + if ($truthy(all)) { + return Opal.methods(self); + } else { + return Opal.receiver_methods(self); + } + ; + }, TMP_Kernel_public_methods_8.$$arity = -1); + + Opal.def(self, '$Array', TMP_Kernel_Array_9 = function $$Array(object) { + var self = this; + + + var coerced; + + if (object === nil) { + return []; + } + + if (object.$$is_array) { + return object; + } + + coerced = $$($nesting, 'Opal')['$coerce_to?'](object, $$($nesting, 'Array'), "to_ary"); + if (coerced !== nil) { return coerced; } + + coerced = $$($nesting, 'Opal')['$coerce_to?'](object, $$($nesting, 'Array'), "to_a"); + if (coerced !== nil) { return coerced; } + + return [object]; + + }, TMP_Kernel_Array_9.$$arity = 1); + + Opal.def(self, '$at_exit', TMP_Kernel_at_exit_10 = function $$at_exit() { + var $iter = TMP_Kernel_at_exit_10.$$p, block = $iter || nil, $a, self = this; + if ($gvars.__at_exit__ == null) $gvars.__at_exit__ = nil; + + if ($iter) TMP_Kernel_at_exit_10.$$p = null; + + + if ($iter) TMP_Kernel_at_exit_10.$$p = null;; + $gvars.__at_exit__ = ($truthy($a = $gvars.__at_exit__) ? $a : []); + return $gvars.__at_exit__['$<<'](block); + }, TMP_Kernel_at_exit_10.$$arity = 0); + + Opal.def(self, '$caller', TMP_Kernel_caller_11 = function $$caller($a) { + var $post_args, args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + return []; + }, TMP_Kernel_caller_11.$$arity = -1); + + Opal.def(self, '$class', TMP_Kernel_class_12 = function() { + var self = this; + + return self.$$class; + }, TMP_Kernel_class_12.$$arity = 0); + + Opal.def(self, '$copy_instance_variables', TMP_Kernel_copy_instance_variables_13 = function $$copy_instance_variables(other) { + var self = this; + + + var keys = Object.keys(other), i, ii, name; + for (i = 0, ii = keys.length; i < ii; i++) { + name = keys[i]; + if (name.charAt(0) !== '$' && other.hasOwnProperty(name)) { + self[name] = other[name]; + } + } + + }, TMP_Kernel_copy_instance_variables_13.$$arity = 1); + + Opal.def(self, '$copy_singleton_methods', TMP_Kernel_copy_singleton_methods_14 = function $$copy_singleton_methods(other) { + var self = this; + + + var i, name, names, length; + + if (other.hasOwnProperty('$$meta')) { + var other_singleton_class = Opal.get_singleton_class(other); + var self_singleton_class = Opal.get_singleton_class(self); + names = Object.getOwnPropertyNames(other_singleton_class.prototype); + + for (i = 0, length = names.length; i < length; i++) { + name = names[i]; + if (Opal.is_method(name)) { + self_singleton_class.prototype[name] = other_singleton_class.prototype[name]; + } + } + + self_singleton_class.$$const = Object.assign({}, other_singleton_class.$$const); + Object.setPrototypeOf( + self_singleton_class.prototype, + Object.getPrototypeOf(other_singleton_class.prototype) + ); + } + + for (i = 0, names = Object.getOwnPropertyNames(other), length = names.length; i < length; i++) { + name = names[i]; + if (name.charAt(0) === '$' && name.charAt(1) !== '$' && other.hasOwnProperty(name)) { + self[name] = other[name]; + } + } + + }, TMP_Kernel_copy_singleton_methods_14.$$arity = 1); + + Opal.def(self, '$clone', TMP_Kernel_clone_15 = function $$clone($kwargs) { + var freeze, self = this, copy = nil; + + + + if ($kwargs == null) { + $kwargs = $hash2([], {}); + } else if (!$kwargs.$$is_hash) { + throw Opal.ArgumentError.$new('expected kwargs'); + }; + + freeze = $kwargs.$$smap["freeze"]; + if (freeze == null) { + freeze = true + }; + copy = self.$class().$allocate(); + copy.$copy_instance_variables(self); + copy.$copy_singleton_methods(self); + copy.$initialize_clone(self); + return copy; + }, TMP_Kernel_clone_15.$$arity = -1); + + Opal.def(self, '$initialize_clone', TMP_Kernel_initialize_clone_16 = function $$initialize_clone(other) { + var self = this; + + return self.$initialize_copy(other) + }, TMP_Kernel_initialize_clone_16.$$arity = 1); + + Opal.def(self, '$define_singleton_method', TMP_Kernel_define_singleton_method_17 = function $$define_singleton_method(name, method) { + var $iter = TMP_Kernel_define_singleton_method_17.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Kernel_define_singleton_method_17.$$p = null; + + + if ($iter) TMP_Kernel_define_singleton_method_17.$$p = null;; + ; + return $send(self.$singleton_class(), 'define_method', [name, method], block.$to_proc()); + }, TMP_Kernel_define_singleton_method_17.$$arity = -2); + + Opal.def(self, '$dup', TMP_Kernel_dup_18 = function $$dup() { + var self = this, copy = nil; + + + copy = self.$class().$allocate(); + copy.$copy_instance_variables(self); + copy.$initialize_dup(self); + return copy; + }, TMP_Kernel_dup_18.$$arity = 0); + + Opal.def(self, '$initialize_dup', TMP_Kernel_initialize_dup_19 = function $$initialize_dup(other) { + var self = this; + + return self.$initialize_copy(other) + }, TMP_Kernel_initialize_dup_19.$$arity = 1); + + Opal.def(self, '$enum_for', TMP_Kernel_enum_for_20 = function $$enum_for($a, $b) { + var $iter = TMP_Kernel_enum_for_20.$$p, block = $iter || nil, $post_args, method, args, self = this; + + if ($iter) TMP_Kernel_enum_for_20.$$p = null; + + + if ($iter) TMP_Kernel_enum_for_20.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + if ($post_args.length > 0) { + method = $post_args[0]; + $post_args.splice(0, 1); + } + if (method == null) { + method = "each"; + }; + + args = $post_args;; + return $send($$($nesting, 'Enumerator'), 'for', [self, method].concat(Opal.to_a(args)), block.$to_proc()); + }, TMP_Kernel_enum_for_20.$$arity = -1); + Opal.alias(self, "to_enum", "enum_for"); + + Opal.def(self, '$equal?', TMP_Kernel_equal$q_21 = function(other) { + var self = this; + + return self === other; + }, TMP_Kernel_equal$q_21.$$arity = 1); + + Opal.def(self, '$exit', TMP_Kernel_exit_22 = function $$exit(status) { + var $a, self = this, block = nil; + if ($gvars.__at_exit__ == null) $gvars.__at_exit__ = nil; + + + + if (status == null) { + status = true; + }; + $gvars.__at_exit__ = ($truthy($a = $gvars.__at_exit__) ? $a : []); + while (!($truthy($gvars.__at_exit__['$empty?']()))) { + + block = $gvars.__at_exit__.$pop(); + block.$call(); + }; + + if (status.$$is_boolean) { + status = status ? 0 : 1; + } else { + status = $$($nesting, 'Opal').$coerce_to(status, $$($nesting, 'Integer'), "to_int") + } + + Opal.exit(status); + ; + return nil; + }, TMP_Kernel_exit_22.$$arity = -1); + + Opal.def(self, '$extend', TMP_Kernel_extend_23 = function $$extend($a) { + var $post_args, mods, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + mods = $post_args;; + + var singleton = self.$singleton_class(); + + for (var i = mods.length - 1; i >= 0; i--) { + var mod = mods[i]; + + if (!mod.$$is_module) { + self.$raise($$($nesting, 'TypeError'), "" + "wrong argument type " + ((mod).$class()) + " (expected Module)"); + } + + (mod).$append_features(singleton); + (mod).$extend_object(self); + (mod).$extended(self); + } + ; + return self; + }, TMP_Kernel_extend_23.$$arity = -1); + + Opal.def(self, '$format', TMP_Kernel_format_24 = function $$format(format_string, $a) { + var $post_args, args, $b, self = this, ary = nil; + if ($gvars.DEBUG == null) $gvars.DEBUG = nil; + + + + $post_args = Opal.slice.call(arguments, 1, arguments.length); + + args = $post_args;; + if ($truthy((($b = args.$length()['$=='](1)) ? args['$[]'](0)['$respond_to?']("to_ary") : args.$length()['$=='](1)))) { + + ary = $$($nesting, 'Opal')['$coerce_to?'](args['$[]'](0), $$($nesting, 'Array'), "to_ary"); + if ($truthy(ary['$nil?']())) { + } else { + args = ary.$to_a() + };}; + + var result = '', + //used for slicing: + begin_slice = 0, + end_slice, + //used for iterating over the format string: + i, + len = format_string.length, + //used for processing field values: + arg, + str, + //used for processing %g and %G fields: + exponent, + //used for keeping track of width and precision: + width, + precision, + //used for holding temporary values: + tmp_num, + //used for processing %{} and %<> fileds: + hash_parameter_key, + closing_brace_char, + //used for processing %b, %B, %o, %x, and %X fields: + base_number, + base_prefix, + base_neg_zero_regex, + base_neg_zero_digit, + //used for processing arguments: + next_arg, + seq_arg_num = 1, + pos_arg_num = 0, + //used for keeping track of flags: + flags, + FNONE = 0, + FSHARP = 1, + FMINUS = 2, + FPLUS = 4, + FZERO = 8, + FSPACE = 16, + FWIDTH = 32, + FPREC = 64, + FPREC0 = 128; + + function CHECK_FOR_FLAGS() { + if (flags&FWIDTH) { self.$raise($$($nesting, 'ArgumentError'), "flag after width") } + if (flags&FPREC0) { self.$raise($$($nesting, 'ArgumentError'), "flag after precision") } + } + + function CHECK_FOR_WIDTH() { + if (flags&FWIDTH) { self.$raise($$($nesting, 'ArgumentError'), "width given twice") } + if (flags&FPREC0) { self.$raise($$($nesting, 'ArgumentError'), "width after precision") } + } + + function GET_NTH_ARG(num) { + if (num >= args.length) { self.$raise($$($nesting, 'ArgumentError'), "too few arguments") } + return args[num]; + } + + function GET_NEXT_ARG() { + switch (pos_arg_num) { + case -1: self.$raise($$($nesting, 'ArgumentError'), "" + "unnumbered(" + (seq_arg_num) + ") mixed with numbered") + case -2: self.$raise($$($nesting, 'ArgumentError'), "" + "unnumbered(" + (seq_arg_num) + ") mixed with named") + } + pos_arg_num = seq_arg_num++; + return GET_NTH_ARG(pos_arg_num - 1); + } + + function GET_POS_ARG(num) { + if (pos_arg_num > 0) { + self.$raise($$($nesting, 'ArgumentError'), "" + "numbered(" + (num) + ") after unnumbered(" + (pos_arg_num) + ")") + } + if (pos_arg_num === -2) { + self.$raise($$($nesting, 'ArgumentError'), "" + "numbered(" + (num) + ") after named") + } + if (num < 1) { + self.$raise($$($nesting, 'ArgumentError'), "" + "invalid index - " + (num) + "$") + } + pos_arg_num = -1; + return GET_NTH_ARG(num - 1); + } + + function GET_ARG() { + return (next_arg === undefined ? GET_NEXT_ARG() : next_arg); + } + + function READ_NUM(label) { + var num, str = ''; + for (;; i++) { + if (i === len) { + self.$raise($$($nesting, 'ArgumentError'), "malformed format string - %*[0-9]") + } + if (format_string.charCodeAt(i) < 48 || format_string.charCodeAt(i) > 57) { + i--; + num = parseInt(str, 10) || 0; + if (num > 2147483647) { + self.$raise($$($nesting, 'ArgumentError'), "" + (label) + " too big") + } + return num; + } + str += format_string.charAt(i); + } + } + + function READ_NUM_AFTER_ASTER(label) { + var arg, num = READ_NUM(label); + if (format_string.charAt(i + 1) === '$') { + i++; + arg = GET_POS_ARG(num); + } else { + arg = GET_NEXT_ARG(); + } + return (arg).$to_int(); + } + + for (i = format_string.indexOf('%'); i !== -1; i = format_string.indexOf('%', i)) { + str = undefined; + + flags = FNONE; + width = -1; + precision = -1; + next_arg = undefined; + + end_slice = i; + + i++; + + switch (format_string.charAt(i)) { + case '%': + begin_slice = i; + case '': + case '\n': + case '\0': + i++; + continue; + } + + format_sequence: for (; i < len; i++) { + switch (format_string.charAt(i)) { + + case ' ': + CHECK_FOR_FLAGS(); + flags |= FSPACE; + continue format_sequence; + + case '#': + CHECK_FOR_FLAGS(); + flags |= FSHARP; + continue format_sequence; + + case '+': + CHECK_FOR_FLAGS(); + flags |= FPLUS; + continue format_sequence; + + case '-': + CHECK_FOR_FLAGS(); + flags |= FMINUS; + continue format_sequence; + + case '0': + CHECK_FOR_FLAGS(); + flags |= FZERO; + continue format_sequence; + + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + tmp_num = READ_NUM('width'); + if (format_string.charAt(i + 1) === '$') { + if (i + 2 === len) { + str = '%'; + i++; + break format_sequence; + } + if (next_arg !== undefined) { + self.$raise($$($nesting, 'ArgumentError'), "" + "value given twice - %" + (tmp_num) + "$") + } + next_arg = GET_POS_ARG(tmp_num); + i++; + } else { + CHECK_FOR_WIDTH(); + flags |= FWIDTH; + width = tmp_num; + } + continue format_sequence; + + case '<': + case '\{': + closing_brace_char = (format_string.charAt(i) === '<' ? '>' : '\}'); + hash_parameter_key = ''; + + i++; + + for (;; i++) { + if (i === len) { + self.$raise($$($nesting, 'ArgumentError'), "malformed name - unmatched parenthesis") + } + if (format_string.charAt(i) === closing_brace_char) { + + if (pos_arg_num > 0) { + self.$raise($$($nesting, 'ArgumentError'), "" + "named " + (hash_parameter_key) + " after unnumbered(" + (pos_arg_num) + ")") + } + if (pos_arg_num === -1) { + self.$raise($$($nesting, 'ArgumentError'), "" + "named " + (hash_parameter_key) + " after numbered") + } + pos_arg_num = -2; + + if (args[0] === undefined || !args[0].$$is_hash) { + self.$raise($$($nesting, 'ArgumentError'), "one hash required") + } + + next_arg = (args[0]).$fetch(hash_parameter_key); + + if (closing_brace_char === '>') { + continue format_sequence; + } else { + str = next_arg.toString(); + if (precision !== -1) { str = str.slice(0, precision); } + if (flags&FMINUS) { + while (str.length < width) { str = str + ' '; } + } else { + while (str.length < width) { str = ' ' + str; } + } + break format_sequence; + } + } + hash_parameter_key += format_string.charAt(i); + } + + case '*': + i++; + CHECK_FOR_WIDTH(); + flags |= FWIDTH; + width = READ_NUM_AFTER_ASTER('width'); + if (width < 0) { + flags |= FMINUS; + width = -width; + } + continue format_sequence; + + case '.': + if (flags&FPREC0) { + self.$raise($$($nesting, 'ArgumentError'), "precision given twice") + } + flags |= FPREC|FPREC0; + precision = 0; + i++; + if (format_string.charAt(i) === '*') { + i++; + precision = READ_NUM_AFTER_ASTER('precision'); + if (precision < 0) { + flags &= ~FPREC; + } + continue format_sequence; + } + precision = READ_NUM('precision'); + continue format_sequence; + + case 'd': + case 'i': + case 'u': + arg = self.$Integer(GET_ARG()); + if (arg >= 0) { + str = arg.toString(); + while (str.length < precision) { str = '0' + str; } + if (flags&FMINUS) { + if (flags&FPLUS || flags&FSPACE) { str = (flags&FPLUS ? '+' : ' ') + str; } + while (str.length < width) { str = str + ' '; } + } else { + if (flags&FZERO && precision === -1) { + while (str.length < width - ((flags&FPLUS || flags&FSPACE) ? 1 : 0)) { str = '0' + str; } + if (flags&FPLUS || flags&FSPACE) { str = (flags&FPLUS ? '+' : ' ') + str; } + } else { + if (flags&FPLUS || flags&FSPACE) { str = (flags&FPLUS ? '+' : ' ') + str; } + while (str.length < width) { str = ' ' + str; } + } + } + } else { + str = (-arg).toString(); + while (str.length < precision) { str = '0' + str; } + if (flags&FMINUS) { + str = '-' + str; + while (str.length < width) { str = str + ' '; } + } else { + if (flags&FZERO && precision === -1) { + while (str.length < width - 1) { str = '0' + str; } + str = '-' + str; + } else { + str = '-' + str; + while (str.length < width) { str = ' ' + str; } + } + } + } + break format_sequence; + + case 'b': + case 'B': + case 'o': + case 'x': + case 'X': + switch (format_string.charAt(i)) { + case 'b': + case 'B': + base_number = 2; + base_prefix = '0b'; + base_neg_zero_regex = /^1+/; + base_neg_zero_digit = '1'; + break; + case 'o': + base_number = 8; + base_prefix = '0'; + base_neg_zero_regex = /^3?7+/; + base_neg_zero_digit = '7'; + break; + case 'x': + case 'X': + base_number = 16; + base_prefix = '0x'; + base_neg_zero_regex = /^f+/; + base_neg_zero_digit = 'f'; + break; + } + arg = self.$Integer(GET_ARG()); + if (arg >= 0) { + str = arg.toString(base_number); + while (str.length < precision) { str = '0' + str; } + if (flags&FMINUS) { + if (flags&FPLUS || flags&FSPACE) { str = (flags&FPLUS ? '+' : ' ') + str; } + if (flags&FSHARP && arg !== 0) { str = base_prefix + str; } + while (str.length < width) { str = str + ' '; } + } else { + if (flags&FZERO && precision === -1) { + while (str.length < width - ((flags&FPLUS || flags&FSPACE) ? 1 : 0) - ((flags&FSHARP && arg !== 0) ? base_prefix.length : 0)) { str = '0' + str; } + if (flags&FSHARP && arg !== 0) { str = base_prefix + str; } + if (flags&FPLUS || flags&FSPACE) { str = (flags&FPLUS ? '+' : ' ') + str; } + } else { + if (flags&FSHARP && arg !== 0) { str = base_prefix + str; } + if (flags&FPLUS || flags&FSPACE) { str = (flags&FPLUS ? '+' : ' ') + str; } + while (str.length < width) { str = ' ' + str; } + } + } + } else { + if (flags&FPLUS || flags&FSPACE) { + str = (-arg).toString(base_number); + while (str.length < precision) { str = '0' + str; } + if (flags&FMINUS) { + if (flags&FSHARP) { str = base_prefix + str; } + str = '-' + str; + while (str.length < width) { str = str + ' '; } + } else { + if (flags&FZERO && precision === -1) { + while (str.length < width - 1 - (flags&FSHARP ? 2 : 0)) { str = '0' + str; } + if (flags&FSHARP) { str = base_prefix + str; } + str = '-' + str; + } else { + if (flags&FSHARP) { str = base_prefix + str; } + str = '-' + str; + while (str.length < width) { str = ' ' + str; } + } + } + } else { + str = (arg >>> 0).toString(base_number).replace(base_neg_zero_regex, base_neg_zero_digit); + while (str.length < precision - 2) { str = base_neg_zero_digit + str; } + if (flags&FMINUS) { + str = '..' + str; + if (flags&FSHARP) { str = base_prefix + str; } + while (str.length < width) { str = str + ' '; } + } else { + if (flags&FZERO && precision === -1) { + while (str.length < width - 2 - (flags&FSHARP ? base_prefix.length : 0)) { str = base_neg_zero_digit + str; } + str = '..' + str; + if (flags&FSHARP) { str = base_prefix + str; } + } else { + str = '..' + str; + if (flags&FSHARP) { str = base_prefix + str; } + while (str.length < width) { str = ' ' + str; } + } + } + } + } + if (format_string.charAt(i) === format_string.charAt(i).toUpperCase()) { + str = str.toUpperCase(); + } + break format_sequence; + + case 'f': + case 'e': + case 'E': + case 'g': + case 'G': + arg = self.$Float(GET_ARG()); + if (arg >= 0 || isNaN(arg)) { + if (arg === Infinity) { + str = 'Inf'; + } else { + switch (format_string.charAt(i)) { + case 'f': + str = arg.toFixed(precision === -1 ? 6 : precision); + break; + case 'e': + case 'E': + str = arg.toExponential(precision === -1 ? 6 : precision); + break; + case 'g': + case 'G': + str = arg.toExponential(); + exponent = parseInt(str.split('e')[1], 10); + if (!(exponent < -4 || exponent >= (precision === -1 ? 6 : precision))) { + str = arg.toPrecision(precision === -1 ? (flags&FSHARP ? 6 : undefined) : precision); + } + break; + } + } + if (flags&FMINUS) { + if (flags&FPLUS || flags&FSPACE) { str = (flags&FPLUS ? '+' : ' ') + str; } + while (str.length < width) { str = str + ' '; } + } else { + if (flags&FZERO && arg !== Infinity && !isNaN(arg)) { + while (str.length < width - ((flags&FPLUS || flags&FSPACE) ? 1 : 0)) { str = '0' + str; } + if (flags&FPLUS || flags&FSPACE) { str = (flags&FPLUS ? '+' : ' ') + str; } + } else { + if (flags&FPLUS || flags&FSPACE) { str = (flags&FPLUS ? '+' : ' ') + str; } + while (str.length < width) { str = ' ' + str; } + } + } + } else { + if (arg === -Infinity) { + str = 'Inf'; + } else { + switch (format_string.charAt(i)) { + case 'f': + str = (-arg).toFixed(precision === -1 ? 6 : precision); + break; + case 'e': + case 'E': + str = (-arg).toExponential(precision === -1 ? 6 : precision); + break; + case 'g': + case 'G': + str = (-arg).toExponential(); + exponent = parseInt(str.split('e')[1], 10); + if (!(exponent < -4 || exponent >= (precision === -1 ? 6 : precision))) { + str = (-arg).toPrecision(precision === -1 ? (flags&FSHARP ? 6 : undefined) : precision); + } + break; + } + } + if (flags&FMINUS) { + str = '-' + str; + while (str.length < width) { str = str + ' '; } + } else { + if (flags&FZERO && arg !== -Infinity) { + while (str.length < width - 1) { str = '0' + str; } + str = '-' + str; + } else { + str = '-' + str; + while (str.length < width) { str = ' ' + str; } + } + } + } + if (format_string.charAt(i) === format_string.charAt(i).toUpperCase() && arg !== Infinity && arg !== -Infinity && !isNaN(arg)) { + str = str.toUpperCase(); + } + str = str.replace(/([eE][-+]?)([0-9])$/, '$10$2'); + break format_sequence; + + case 'a': + case 'A': + // Not implemented because there are no specs for this field type. + self.$raise($$($nesting, 'NotImplementedError'), "`A` and `a` format field types are not implemented in Opal yet") + + case 'c': + arg = GET_ARG(); + if ((arg)['$respond_to?']("to_ary")) { arg = (arg).$to_ary()[0]; } + if ((arg)['$respond_to?']("to_str")) { + str = (arg).$to_str(); + } else { + str = String.fromCharCode($$($nesting, 'Opal').$coerce_to(arg, $$($nesting, 'Integer'), "to_int")); + } + if (str.length !== 1) { + self.$raise($$($nesting, 'ArgumentError'), "%c requires a character") + } + if (flags&FMINUS) { + while (str.length < width) { str = str + ' '; } + } else { + while (str.length < width) { str = ' ' + str; } + } + break format_sequence; + + case 'p': + str = (GET_ARG()).$inspect(); + if (precision !== -1) { str = str.slice(0, precision); } + if (flags&FMINUS) { + while (str.length < width) { str = str + ' '; } + } else { + while (str.length < width) { str = ' ' + str; } + } + break format_sequence; + + case 's': + str = (GET_ARG()).$to_s(); + if (precision !== -1) { str = str.slice(0, precision); } + if (flags&FMINUS) { + while (str.length < width) { str = str + ' '; } + } else { + while (str.length < width) { str = ' ' + str; } + } + break format_sequence; + + default: + self.$raise($$($nesting, 'ArgumentError'), "" + "malformed format string - %" + (format_string.charAt(i))) + } + } + + if (str === undefined) { + self.$raise($$($nesting, 'ArgumentError'), "malformed format string - %") + } + + result += format_string.slice(begin_slice, end_slice) + str; + begin_slice = i + 1; + } + + if ($gvars.DEBUG && pos_arg_num >= 0 && seq_arg_num < args.length) { + self.$raise($$($nesting, 'ArgumentError'), "too many arguments for format string") + } + + return result + format_string.slice(begin_slice); + ; + }, TMP_Kernel_format_24.$$arity = -2); + + Opal.def(self, '$hash', TMP_Kernel_hash_25 = function $$hash() { + var self = this; + + return self.$__id__() + }, TMP_Kernel_hash_25.$$arity = 0); + + Opal.def(self, '$initialize_copy', TMP_Kernel_initialize_copy_26 = function $$initialize_copy(other) { + var self = this; + + return nil + }, TMP_Kernel_initialize_copy_26.$$arity = 1); + + Opal.def(self, '$inspect', TMP_Kernel_inspect_27 = function $$inspect() { + var self = this; + + return self.$to_s() + }, TMP_Kernel_inspect_27.$$arity = 0); + + Opal.def(self, '$instance_of?', TMP_Kernel_instance_of$q_28 = function(klass) { + var self = this; + + + if (!klass.$$is_class && !klass.$$is_module) { + self.$raise($$($nesting, 'TypeError'), "class or module required"); + } + + return self.$$class === klass; + + }, TMP_Kernel_instance_of$q_28.$$arity = 1); + + Opal.def(self, '$instance_variable_defined?', TMP_Kernel_instance_variable_defined$q_29 = function(name) { + var self = this; + + + name = $$($nesting, 'Opal')['$instance_variable_name!'](name); + return Opal.hasOwnProperty.call(self, name.substr(1));; + }, TMP_Kernel_instance_variable_defined$q_29.$$arity = 1); + + Opal.def(self, '$instance_variable_get', TMP_Kernel_instance_variable_get_30 = function $$instance_variable_get(name) { + var self = this; + + + name = $$($nesting, 'Opal')['$instance_variable_name!'](name); + + var ivar = self[Opal.ivar(name.substr(1))]; + + return ivar == null ? nil : ivar; + ; + }, TMP_Kernel_instance_variable_get_30.$$arity = 1); + + Opal.def(self, '$instance_variable_set', TMP_Kernel_instance_variable_set_31 = function $$instance_variable_set(name, value) { + var self = this; + + + name = $$($nesting, 'Opal')['$instance_variable_name!'](name); + return self[Opal.ivar(name.substr(1))] = value;; + }, TMP_Kernel_instance_variable_set_31.$$arity = 2); + + Opal.def(self, '$remove_instance_variable', TMP_Kernel_remove_instance_variable_32 = function $$remove_instance_variable(name) { + var self = this; + + + name = $$($nesting, 'Opal')['$instance_variable_name!'](name); + + var key = Opal.ivar(name.substr(1)), + val; + if (self.hasOwnProperty(key)) { + val = self[key]; + delete self[key]; + return val; + } + ; + return self.$raise($$($nesting, 'NameError'), "" + "instance variable " + (name) + " not defined"); + }, TMP_Kernel_remove_instance_variable_32.$$arity = 1); + + Opal.def(self, '$instance_variables', TMP_Kernel_instance_variables_33 = function $$instance_variables() { + var self = this; + + + var result = [], ivar; + + for (var name in self) { + if (self.hasOwnProperty(name) && name.charAt(0) !== '$') { + if (name.substr(-1) === '$') { + ivar = name.slice(0, name.length - 1); + } else { + ivar = name; + } + result.push('@' + ivar); + } + } + + return result; + + }, TMP_Kernel_instance_variables_33.$$arity = 0); + + Opal.def(self, '$Integer', TMP_Kernel_Integer_34 = function $$Integer(value, base) { + var self = this; + + + ; + + var i, str, base_digits; + + if (!value.$$is_string) { + if (base !== undefined) { + self.$raise($$($nesting, 'ArgumentError'), "base specified for non string value") + } + if (value === nil) { + self.$raise($$($nesting, 'TypeError'), "can't convert nil into Integer") + } + if (value.$$is_number) { + if (value === Infinity || value === -Infinity || isNaN(value)) { + self.$raise($$($nesting, 'FloatDomainError'), value) + } + return Math.floor(value); + } + if (value['$respond_to?']("to_int")) { + i = value.$to_int(); + if (i !== nil) { + return i; + } + } + return $$($nesting, 'Opal')['$coerce_to!'](value, $$($nesting, 'Integer'), "to_i"); + } + + if (value === "0") { + return 0; + } + + if (base === undefined) { + base = 0; + } else { + base = $$($nesting, 'Opal').$coerce_to(base, $$($nesting, 'Integer'), "to_int"); + if (base === 1 || base < 0 || base > 36) { + self.$raise($$($nesting, 'ArgumentError'), "" + "invalid radix " + (base)) + } + } + + str = value.toLowerCase(); + + str = str.replace(/(\d)_(?=\d)/g, '$1'); + + str = str.replace(/^(\s*[+-]?)(0[bodx]?)/, function (_, head, flag) { + switch (flag) { + case '0b': + if (base === 0 || base === 2) { + base = 2; + return head; + } + case '0': + case '0o': + if (base === 0 || base === 8) { + base = 8; + return head; + } + case '0d': + if (base === 0 || base === 10) { + base = 10; + return head; + } + case '0x': + if (base === 0 || base === 16) { + base = 16; + return head; + } + } + self.$raise($$($nesting, 'ArgumentError'), "" + "invalid value for Integer(): \"" + (value) + "\"") + }); + + base = (base === 0 ? 10 : base); + + base_digits = '0-' + (base <= 10 ? base - 1 : '9a-' + String.fromCharCode(97 + (base - 11))); + + if (!(new RegExp('^\\s*[+-]?[' + base_digits + ']+\\s*$')).test(str)) { + self.$raise($$($nesting, 'ArgumentError'), "" + "invalid value for Integer(): \"" + (value) + "\"") + } + + i = parseInt(str, base); + + if (isNaN(i)) { + self.$raise($$($nesting, 'ArgumentError'), "" + "invalid value for Integer(): \"" + (value) + "\"") + } + + return i; + ; + }, TMP_Kernel_Integer_34.$$arity = -2); + + Opal.def(self, '$Float', TMP_Kernel_Float_35 = function $$Float(value) { + var self = this; + + + var str; + + if (value === nil) { + self.$raise($$($nesting, 'TypeError'), "can't convert nil into Float") + } + + if (value.$$is_string) { + str = value.toString(); + + str = str.replace(/(\d)_(?=\d)/g, '$1'); + + //Special case for hex strings only: + if (/^\s*[-+]?0[xX][0-9a-fA-F]+\s*$/.test(str)) { + return self.$Integer(str); + } + + if (!/^\s*[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?\s*$/.test(str)) { + self.$raise($$($nesting, 'ArgumentError'), "" + "invalid value for Float(): \"" + (value) + "\"") + } + + return parseFloat(str); + } + + return $$($nesting, 'Opal')['$coerce_to!'](value, $$($nesting, 'Float'), "to_f"); + + }, TMP_Kernel_Float_35.$$arity = 1); + + Opal.def(self, '$Hash', TMP_Kernel_Hash_36 = function $$Hash(arg) { + var $a, self = this; + + + if ($truthy(($truthy($a = arg['$nil?']()) ? $a : arg['$==']([])))) { + return $hash2([], {})}; + if ($truthy($$($nesting, 'Hash')['$==='](arg))) { + return arg}; + return $$($nesting, 'Opal')['$coerce_to!'](arg, $$($nesting, 'Hash'), "to_hash"); + }, TMP_Kernel_Hash_36.$$arity = 1); + + Opal.def(self, '$is_a?', TMP_Kernel_is_a$q_37 = function(klass) { + var self = this; + + + if (!klass.$$is_class && !klass.$$is_module) { + self.$raise($$($nesting, 'TypeError'), "class or module required"); + } + + return Opal.is_a(self, klass); + + }, TMP_Kernel_is_a$q_37.$$arity = 1); + + Opal.def(self, '$itself', TMP_Kernel_itself_38 = function $$itself() { + var self = this; + + return self + }, TMP_Kernel_itself_38.$$arity = 0); + Opal.alias(self, "kind_of?", "is_a?"); + + Opal.def(self, '$lambda', TMP_Kernel_lambda_39 = function $$lambda() { + var $iter = TMP_Kernel_lambda_39.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Kernel_lambda_39.$$p = null; + + + if ($iter) TMP_Kernel_lambda_39.$$p = null;; + return Opal.lambda(block);; + }, TMP_Kernel_lambda_39.$$arity = 0); + + Opal.def(self, '$load', TMP_Kernel_load_40 = function $$load(file) { + var self = this; + + + file = $$($nesting, 'Opal')['$coerce_to!'](file, $$($nesting, 'String'), "to_str"); + return Opal.load(file); + }, TMP_Kernel_load_40.$$arity = 1); + + Opal.def(self, '$loop', TMP_Kernel_loop_41 = function $$loop() { + var TMP_42, $a, $iter = TMP_Kernel_loop_41.$$p, $yield = $iter || nil, self = this, e = nil; + + if ($iter) TMP_Kernel_loop_41.$$p = null; + + if (($yield !== nil)) { + } else { + return $send(self, 'enum_for', ["loop"], (TMP_42 = function(){var self = TMP_42.$$s || this; + + return $$$($$($nesting, 'Float'), 'INFINITY')}, TMP_42.$$s = self, TMP_42.$$arity = 0, TMP_42)) + }; + while ($truthy(true)) { + + try { + Opal.yieldX($yield, []) + } catch ($err) { + if (Opal.rescue($err, [$$($nesting, 'StopIteration')])) {e = $err; + try { + return e.$result() + } finally { Opal.pop_exception() } + } else { throw $err; } + }; + }; + return self; + }, TMP_Kernel_loop_41.$$arity = 0); + + Opal.def(self, '$nil?', TMP_Kernel_nil$q_43 = function() { + var self = this; + + return false + }, TMP_Kernel_nil$q_43.$$arity = 0); + Opal.alias(self, "object_id", "__id__"); + + Opal.def(self, '$printf', TMP_Kernel_printf_44 = function $$printf($a) { + var $post_args, args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + if ($truthy(args['$any?']())) { + self.$print($send(self, 'format', Opal.to_a(args)))}; + return nil; + }, TMP_Kernel_printf_44.$$arity = -1); + + Opal.def(self, '$proc', TMP_Kernel_proc_45 = function $$proc() { + var $iter = TMP_Kernel_proc_45.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Kernel_proc_45.$$p = null; + + + if ($iter) TMP_Kernel_proc_45.$$p = null;; + if ($truthy(block)) { + } else { + self.$raise($$($nesting, 'ArgumentError'), "tried to create Proc object without a block") + }; + block.$$is_lambda = false; + return block; + }, TMP_Kernel_proc_45.$$arity = 0); + + Opal.def(self, '$puts', TMP_Kernel_puts_46 = function $$puts($a) { + var $post_args, strs, self = this; + if ($gvars.stdout == null) $gvars.stdout = nil; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + strs = $post_args;; + return $send($gvars.stdout, 'puts', Opal.to_a(strs)); + }, TMP_Kernel_puts_46.$$arity = -1); + + Opal.def(self, '$p', TMP_Kernel_p_47 = function $$p($a) { + var $post_args, args, TMP_48, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + $send(args, 'each', [], (TMP_48 = function(obj){var self = TMP_48.$$s || this; + if ($gvars.stdout == null) $gvars.stdout = nil; + + + + if (obj == null) { + obj = nil; + }; + return $gvars.stdout.$puts(obj.$inspect());}, TMP_48.$$s = self, TMP_48.$$arity = 1, TMP_48)); + if ($truthy($rb_le(args.$length(), 1))) { + return args['$[]'](0) + } else { + return args + }; + }, TMP_Kernel_p_47.$$arity = -1); + + Opal.def(self, '$print', TMP_Kernel_print_49 = function $$print($a) { + var $post_args, strs, self = this; + if ($gvars.stdout == null) $gvars.stdout = nil; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + strs = $post_args;; + return $send($gvars.stdout, 'print', Opal.to_a(strs)); + }, TMP_Kernel_print_49.$$arity = -1); + + Opal.def(self, '$warn', TMP_Kernel_warn_50 = function $$warn($a) { + var $post_args, strs, $b, self = this; + if ($gvars.VERBOSE == null) $gvars.VERBOSE = nil; + if ($gvars.stderr == null) $gvars.stderr = nil; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + strs = $post_args;; + if ($truthy(($truthy($b = $gvars.VERBOSE['$nil?']()) ? $b : strs['$empty?']()))) { + return nil + } else { + return $send($gvars.stderr, 'puts', Opal.to_a(strs)) + }; + }, TMP_Kernel_warn_50.$$arity = -1); + + Opal.def(self, '$raise', TMP_Kernel_raise_51 = function $$raise(exception, string, _backtrace) { + var self = this; + if ($gvars["!"] == null) $gvars["!"] = nil; + + + ; + + if (string == null) { + string = nil; + }; + + if (_backtrace == null) { + _backtrace = nil; + }; + + if (exception == null && $gvars["!"] !== nil) { + throw $gvars["!"]; + } + if (exception == null) { + exception = $$($nesting, 'RuntimeError').$new(); + } + else if (exception.$$is_string) { + exception = $$($nesting, 'RuntimeError').$new(exception); + } + // using respond_to? and not an undefined check to avoid method_missing matching as true + else if (exception.$$is_class && exception['$respond_to?']("exception")) { + exception = exception.$exception(string); + } + else if (exception['$is_a?']($$($nesting, 'Exception'))) { + // exception is fine + } + else { + exception = $$($nesting, 'TypeError').$new("exception class/object expected"); + } + + if ($gvars["!"] !== nil) { + Opal.exceptions.push($gvars["!"]); + } + + $gvars["!"] = exception; + + throw exception; + ; + }, TMP_Kernel_raise_51.$$arity = -1); + Opal.alias(self, "fail", "raise"); + + Opal.def(self, '$rand', TMP_Kernel_rand_52 = function $$rand(max) { + var self = this; + + + ; + + if (max === undefined) { + return $$$($$($nesting, 'Random'), 'DEFAULT').$rand(); + } + + if (max.$$is_number) { + if (max < 0) { + max = Math.abs(max); + } + + if (max % 1 !== 0) { + max = max.$to_i(); + } + + if (max === 0) { + max = undefined; + } + } + ; + return $$$($$($nesting, 'Random'), 'DEFAULT').$rand(max); + }, TMP_Kernel_rand_52.$$arity = -1); + + Opal.def(self, '$respond_to?', TMP_Kernel_respond_to$q_53 = function(name, include_all) { + var self = this; + + + + if (include_all == null) { + include_all = false; + }; + if ($truthy(self['$respond_to_missing?'](name, include_all))) { + return true}; + + var body = self['$' + name]; + + if (typeof(body) === "function" && !body.$$stub) { + return true; + } + ; + return false; + }, TMP_Kernel_respond_to$q_53.$$arity = -2); + + Opal.def(self, '$respond_to_missing?', TMP_Kernel_respond_to_missing$q_54 = function(method_name, include_all) { + var self = this; + + + + if (include_all == null) { + include_all = false; + }; + return false; + }, TMP_Kernel_respond_to_missing$q_54.$$arity = -2); + + Opal.def(self, '$require', TMP_Kernel_require_55 = function $$require(file) { + var self = this; + + + file = $$($nesting, 'Opal')['$coerce_to!'](file, $$($nesting, 'String'), "to_str"); + return Opal.require(file); + }, TMP_Kernel_require_55.$$arity = 1); + + Opal.def(self, '$require_relative', TMP_Kernel_require_relative_56 = function $$require_relative(file) { + var self = this; + + + $$($nesting, 'Opal')['$try_convert!'](file, $$($nesting, 'String'), "to_str"); + file = $$($nesting, 'File').$expand_path($$($nesting, 'File').$join(Opal.current_file, "..", file)); + return Opal.require(file); + }, TMP_Kernel_require_relative_56.$$arity = 1); + + Opal.def(self, '$require_tree', TMP_Kernel_require_tree_57 = function $$require_tree(path) { + var self = this; + + + var result = []; + + path = $$($nesting, 'File').$expand_path(path) + path = Opal.normalize(path); + if (path === '.') path = ''; + for (var name in Opal.modules) { + if ((name)['$start_with?'](path)) { + result.push([name, Opal.require(name)]); + } + } + + return result; + + }, TMP_Kernel_require_tree_57.$$arity = 1); + Opal.alias(self, "send", "__send__"); + Opal.alias(self, "public_send", "__send__"); + + Opal.def(self, '$singleton_class', TMP_Kernel_singleton_class_58 = function $$singleton_class() { + var self = this; + + return Opal.get_singleton_class(self); + }, TMP_Kernel_singleton_class_58.$$arity = 0); + + Opal.def(self, '$sleep', TMP_Kernel_sleep_59 = function $$sleep(seconds) { + var self = this; + + + + if (seconds == null) { + seconds = nil; + }; + + if (seconds === nil) { + self.$raise($$($nesting, 'TypeError'), "can't convert NilClass into time interval") + } + if (!seconds.$$is_number) { + self.$raise($$($nesting, 'TypeError'), "" + "can't convert " + (seconds.$class()) + " into time interval") + } + if (seconds < 0) { + self.$raise($$($nesting, 'ArgumentError'), "time interval must be positive") + } + var get_time = Opal.global.performance ? + function() {return performance.now()} : + function() {return new Date()} + + var t = get_time(); + while (get_time() - t <= seconds * 1000); + return seconds; + ; + }, TMP_Kernel_sleep_59.$$arity = -1); + Opal.alias(self, "sprintf", "format"); + + Opal.def(self, '$srand', TMP_Kernel_srand_60 = function $$srand(seed) { + var self = this; + + + + if (seed == null) { + seed = $$($nesting, 'Random').$new_seed(); + }; + return $$($nesting, 'Random').$srand(seed); + }, TMP_Kernel_srand_60.$$arity = -1); + + Opal.def(self, '$String', TMP_Kernel_String_61 = function $$String(str) { + var $a, self = this; + + return ($truthy($a = $$($nesting, 'Opal')['$coerce_to?'](str, $$($nesting, 'String'), "to_str")) ? $a : $$($nesting, 'Opal')['$coerce_to!'](str, $$($nesting, 'String'), "to_s")) + }, TMP_Kernel_String_61.$$arity = 1); + + Opal.def(self, '$tap', TMP_Kernel_tap_62 = function $$tap() { + var $iter = TMP_Kernel_tap_62.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Kernel_tap_62.$$p = null; + + + if ($iter) TMP_Kernel_tap_62.$$p = null;; + Opal.yield1(block, self); + return self; + }, TMP_Kernel_tap_62.$$arity = 0); + + Opal.def(self, '$to_proc', TMP_Kernel_to_proc_63 = function $$to_proc() { + var self = this; + + return self + }, TMP_Kernel_to_proc_63.$$arity = 0); + + Opal.def(self, '$to_s', TMP_Kernel_to_s_64 = function $$to_s() { + var self = this; + + return "" + "#<" + (self.$class()) + ":0x" + (self.$__id__().$to_s(16)) + ">" + }, TMP_Kernel_to_s_64.$$arity = 0); + + Opal.def(self, '$catch', TMP_Kernel_catch_65 = function(sym) { + var $iter = TMP_Kernel_catch_65.$$p, $yield = $iter || nil, self = this, e = nil; + + if ($iter) TMP_Kernel_catch_65.$$p = null; + try { + return Opal.yieldX($yield, []); + } catch ($err) { + if (Opal.rescue($err, [$$($nesting, 'UncaughtThrowError')])) {e = $err; + try { + + if (e.$sym()['$=='](sym)) { + return e.$arg()}; + return self.$raise(); + } finally { Opal.pop_exception() } + } else { throw $err; } + } + }, TMP_Kernel_catch_65.$$arity = 1); + + Opal.def(self, '$throw', TMP_Kernel_throw_66 = function($a) { + var $post_args, args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + return self.$raise($$($nesting, 'UncaughtThrowError'), args); + }, TMP_Kernel_throw_66.$$arity = -1); + + Opal.def(self, '$open', TMP_Kernel_open_67 = function $$open($a) { + var $iter = TMP_Kernel_open_67.$$p, block = $iter || nil, $post_args, args, self = this; + + if ($iter) TMP_Kernel_open_67.$$p = null; + + + if ($iter) TMP_Kernel_open_67.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + return $send($$($nesting, 'File'), 'open', Opal.to_a(args), block.$to_proc()); + }, TMP_Kernel_open_67.$$arity = -1); + + Opal.def(self, '$yield_self', TMP_Kernel_yield_self_68 = function $$yield_self() { + var TMP_69, $iter = TMP_Kernel_yield_self_68.$$p, $yield = $iter || nil, self = this; + + if ($iter) TMP_Kernel_yield_self_68.$$p = null; + + if (($yield !== nil)) { + } else { + return $send(self, 'enum_for', ["yield_self"], (TMP_69 = function(){var self = TMP_69.$$s || this; + + return 1}, TMP_69.$$s = self, TMP_69.$$arity = 0, TMP_69)) + }; + return Opal.yield1($yield, self);; + }, TMP_Kernel_yield_self_68.$$arity = 0); + })($nesting[0], $nesting); + return (function($base, $super, $parent_nesting) { + function $Object(){}; + var self = $Object = $klass($base, $super, 'Object', $Object); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return self.$include($$($nesting, 'Kernel')) + })($nesting[0], null, $nesting); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/error"] = function(Opal) { + function $rb_plus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); + } + function $rb_gt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $send = Opal.send, $truthy = Opal.truthy, $module = Opal.module, $hash2 = Opal.hash2; + + Opal.add_stubs(['$new', '$clone', '$to_s', '$empty?', '$class', '$raise', '$+', '$attr_reader', '$[]', '$>', '$length', '$inspect']); + + (function($base, $super, $parent_nesting) { + function $Exception(){}; + var self = $Exception = $klass($base, $super, 'Exception', $Exception); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Exception_new_1, TMP_Exception_exception_2, TMP_Exception_initialize_3, TMP_Exception_backtrace_4, TMP_Exception_exception_5, TMP_Exception_message_6, TMP_Exception_inspect_7, TMP_Exception_set_backtrace_8, TMP_Exception_to_s_9; + + def.message = nil; + + var stack_trace_limit; + Opal.defs(self, '$new', TMP_Exception_new_1 = function($a) { + var $post_args, args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + + var message = (args.length > 0) ? args[0] : nil; + var error = new self(message); + error.name = self.$$name; + error.message = message; + Opal.send(error, error.$initialize, args); + + // Error.captureStackTrace() will use .name and .toString to build the + // first line of the stack trace so it must be called after the error + // has been initialized. + // https://nodejs.org/dist/latest-v6.x/docs/api/errors.html + if (Opal.config.enable_stack_trace && Error.captureStackTrace) { + // Passing Kernel.raise will cut the stack trace from that point above + Error.captureStackTrace(error, stack_trace_limit); + } + + return error; + ; + }, TMP_Exception_new_1.$$arity = -1); + stack_trace_limit = self.$new; + Opal.defs(self, '$exception', TMP_Exception_exception_2 = function $$exception($a) { + var $post_args, args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + return $send(self, 'new', Opal.to_a(args)); + }, TMP_Exception_exception_2.$$arity = -1); + + Opal.def(self, '$initialize', TMP_Exception_initialize_3 = function $$initialize($a) { + var $post_args, args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + return self.message = (args.length > 0) ? args[0] : nil;; + }, TMP_Exception_initialize_3.$$arity = -1); + + Opal.def(self, '$backtrace', TMP_Exception_backtrace_4 = function $$backtrace() { + var self = this; + + + if (self.backtrace) { + // nil is a valid backtrace + return self.backtrace; + } + + var backtrace = self.stack; + + if (typeof(backtrace) === 'string') { + return backtrace.split("\n").slice(0, 15); + } + else if (backtrace) { + return backtrace.slice(0, 15); + } + + return []; + + }, TMP_Exception_backtrace_4.$$arity = 0); + + Opal.def(self, '$exception', TMP_Exception_exception_5 = function $$exception(str) { + var self = this; + + + + if (str == null) { + str = nil; + }; + + if (str === nil || self === str) { + return self; + } + + var cloned = self.$clone(); + cloned.message = str; + return cloned; + ; + }, TMP_Exception_exception_5.$$arity = -1); + + Opal.def(self, '$message', TMP_Exception_message_6 = function $$message() { + var self = this; + + return self.$to_s() + }, TMP_Exception_message_6.$$arity = 0); + + Opal.def(self, '$inspect', TMP_Exception_inspect_7 = function $$inspect() { + var self = this, as_str = nil; + + + as_str = self.$to_s(); + if ($truthy(as_str['$empty?']())) { + return self.$class().$to_s() + } else { + return "" + "#<" + (self.$class().$to_s()) + ": " + (self.$to_s()) + ">" + }; + }, TMP_Exception_inspect_7.$$arity = 0); + + Opal.def(self, '$set_backtrace', TMP_Exception_set_backtrace_8 = function $$set_backtrace(backtrace) { + var self = this; + + + var valid = true, i, ii; + + if (backtrace === nil) { + self.backtrace = nil; + } else if (backtrace.$$is_string) { + self.backtrace = [backtrace]; + } else { + if (backtrace.$$is_array) { + for (i = 0, ii = backtrace.length; i < ii; i++) { + if (!backtrace[i].$$is_string) { + valid = false; + break; + } + } + } else { + valid = false; + } + + if (valid === false) { + self.$raise($$($nesting, 'TypeError'), "backtrace must be Array of String") + } + + self.backtrace = backtrace; + } + + return backtrace; + + }, TMP_Exception_set_backtrace_8.$$arity = 1); + return (Opal.def(self, '$to_s', TMP_Exception_to_s_9 = function $$to_s() { + var $a, $b, self = this; + + return ($truthy($a = ($truthy($b = self.message) ? self.message.$to_s() : $b)) ? $a : self.$class().$to_s()) + }, TMP_Exception_to_s_9.$$arity = 0), nil) && 'to_s'; + })($nesting[0], Error, $nesting); + (function($base, $super, $parent_nesting) { + function $ScriptError(){}; + var self = $ScriptError = $klass($base, $super, 'ScriptError', $ScriptError); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return nil + })($nesting[0], $$($nesting, 'Exception'), $nesting); + (function($base, $super, $parent_nesting) { + function $SyntaxError(){}; + var self = $SyntaxError = $klass($base, $super, 'SyntaxError', $SyntaxError); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return nil + })($nesting[0], $$($nesting, 'ScriptError'), $nesting); + (function($base, $super, $parent_nesting) { + function $LoadError(){}; + var self = $LoadError = $klass($base, $super, 'LoadError', $LoadError); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return nil + })($nesting[0], $$($nesting, 'ScriptError'), $nesting); + (function($base, $super, $parent_nesting) { + function $NotImplementedError(){}; + var self = $NotImplementedError = $klass($base, $super, 'NotImplementedError', $NotImplementedError); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return nil + })($nesting[0], $$($nesting, 'ScriptError'), $nesting); + (function($base, $super, $parent_nesting) { + function $SystemExit(){}; + var self = $SystemExit = $klass($base, $super, 'SystemExit', $SystemExit); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return nil + })($nesting[0], $$($nesting, 'Exception'), $nesting); + (function($base, $super, $parent_nesting) { + function $NoMemoryError(){}; + var self = $NoMemoryError = $klass($base, $super, 'NoMemoryError', $NoMemoryError); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return nil + })($nesting[0], $$($nesting, 'Exception'), $nesting); + (function($base, $super, $parent_nesting) { + function $SignalException(){}; + var self = $SignalException = $klass($base, $super, 'SignalException', $SignalException); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return nil + })($nesting[0], $$($nesting, 'Exception'), $nesting); + (function($base, $super, $parent_nesting) { + function $Interrupt(){}; + var self = $Interrupt = $klass($base, $super, 'Interrupt', $Interrupt); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return nil + })($nesting[0], $$($nesting, 'Exception'), $nesting); + (function($base, $super, $parent_nesting) { + function $SecurityError(){}; + var self = $SecurityError = $klass($base, $super, 'SecurityError', $SecurityError); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return nil + })($nesting[0], $$($nesting, 'Exception'), $nesting); + (function($base, $super, $parent_nesting) { + function $StandardError(){}; + var self = $StandardError = $klass($base, $super, 'StandardError', $StandardError); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return nil + })($nesting[0], $$($nesting, 'Exception'), $nesting); + (function($base, $super, $parent_nesting) { + function $EncodingError(){}; + var self = $EncodingError = $klass($base, $super, 'EncodingError', $EncodingError); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return nil + })($nesting[0], $$($nesting, 'StandardError'), $nesting); + (function($base, $super, $parent_nesting) { + function $ZeroDivisionError(){}; + var self = $ZeroDivisionError = $klass($base, $super, 'ZeroDivisionError', $ZeroDivisionError); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return nil + })($nesting[0], $$($nesting, 'StandardError'), $nesting); + (function($base, $super, $parent_nesting) { + function $NameError(){}; + var self = $NameError = $klass($base, $super, 'NameError', $NameError); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return nil + })($nesting[0], $$($nesting, 'StandardError'), $nesting); + (function($base, $super, $parent_nesting) { + function $NoMethodError(){}; + var self = $NoMethodError = $klass($base, $super, 'NoMethodError', $NoMethodError); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return nil + })($nesting[0], $$($nesting, 'NameError'), $nesting); + (function($base, $super, $parent_nesting) { + function $RuntimeError(){}; + var self = $RuntimeError = $klass($base, $super, 'RuntimeError', $RuntimeError); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return nil + })($nesting[0], $$($nesting, 'StandardError'), $nesting); + (function($base, $super, $parent_nesting) { + function $FrozenError(){}; + var self = $FrozenError = $klass($base, $super, 'FrozenError', $FrozenError); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return nil + })($nesting[0], $$($nesting, 'RuntimeError'), $nesting); + (function($base, $super, $parent_nesting) { + function $LocalJumpError(){}; + var self = $LocalJumpError = $klass($base, $super, 'LocalJumpError', $LocalJumpError); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return nil + })($nesting[0], $$($nesting, 'StandardError'), $nesting); + (function($base, $super, $parent_nesting) { + function $TypeError(){}; + var self = $TypeError = $klass($base, $super, 'TypeError', $TypeError); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return nil + })($nesting[0], $$($nesting, 'StandardError'), $nesting); + (function($base, $super, $parent_nesting) { + function $ArgumentError(){}; + var self = $ArgumentError = $klass($base, $super, 'ArgumentError', $ArgumentError); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return nil + })($nesting[0], $$($nesting, 'StandardError'), $nesting); + (function($base, $super, $parent_nesting) { + function $IndexError(){}; + var self = $IndexError = $klass($base, $super, 'IndexError', $IndexError); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return nil + })($nesting[0], $$($nesting, 'StandardError'), $nesting); + (function($base, $super, $parent_nesting) { + function $StopIteration(){}; + var self = $StopIteration = $klass($base, $super, 'StopIteration', $StopIteration); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return nil + })($nesting[0], $$($nesting, 'IndexError'), $nesting); + (function($base, $super, $parent_nesting) { + function $KeyError(){}; + var self = $KeyError = $klass($base, $super, 'KeyError', $KeyError); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return nil + })($nesting[0], $$($nesting, 'IndexError'), $nesting); + (function($base, $super, $parent_nesting) { + function $RangeError(){}; + var self = $RangeError = $klass($base, $super, 'RangeError', $RangeError); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return nil + })($nesting[0], $$($nesting, 'StandardError'), $nesting); + (function($base, $super, $parent_nesting) { + function $FloatDomainError(){}; + var self = $FloatDomainError = $klass($base, $super, 'FloatDomainError', $FloatDomainError); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return nil + })($nesting[0], $$($nesting, 'RangeError'), $nesting); + (function($base, $super, $parent_nesting) { + function $IOError(){}; + var self = $IOError = $klass($base, $super, 'IOError', $IOError); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return nil + })($nesting[0], $$($nesting, 'StandardError'), $nesting); + (function($base, $super, $parent_nesting) { + function $SystemCallError(){}; + var self = $SystemCallError = $klass($base, $super, 'SystemCallError', $SystemCallError); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return nil + })($nesting[0], $$($nesting, 'StandardError'), $nesting); + (function($base, $parent_nesting) { + function $Errno() {}; + var self = $Errno = $module($base, 'Errno', $Errno); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + (function($base, $super, $parent_nesting) { + function $EINVAL(){}; + var self = $EINVAL = $klass($base, $super, 'EINVAL', $EINVAL); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_EINVAL_new_10; + + return (Opal.defs(self, '$new', TMP_EINVAL_new_10 = function(name) { + var $iter = TMP_EINVAL_new_10.$$p, $yield = $iter || nil, self = this, message = nil; + + if ($iter) TMP_EINVAL_new_10.$$p = null; + + + if (name == null) { + name = nil; + }; + message = "Invalid argument"; + if ($truthy(name)) { + message = $rb_plus(message, "" + " - " + (name))}; + return $send(self, Opal.find_super_dispatcher(self, 'new', TMP_EINVAL_new_10, false, $EINVAL), [message], null); + }, TMP_EINVAL_new_10.$$arity = -1), nil) && 'new' + })($nesting[0], $$($nesting, 'SystemCallError'), $nesting) + })($nesting[0], $nesting); + (function($base, $super, $parent_nesting) { + function $UncaughtThrowError(){}; + var self = $UncaughtThrowError = $klass($base, $super, 'UncaughtThrowError', $UncaughtThrowError); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_UncaughtThrowError_initialize_11; + + def.sym = nil; + + self.$attr_reader("sym", "arg"); + return (Opal.def(self, '$initialize', TMP_UncaughtThrowError_initialize_11 = function $$initialize(args) { + var $iter = TMP_UncaughtThrowError_initialize_11.$$p, $yield = $iter || nil, self = this; + + if ($iter) TMP_UncaughtThrowError_initialize_11.$$p = null; + + self.sym = args['$[]'](0); + if ($truthy($rb_gt(args.$length(), 1))) { + self.arg = args['$[]'](1)}; + return $send(self, Opal.find_super_dispatcher(self, 'initialize', TMP_UncaughtThrowError_initialize_11, false), ["" + "uncaught throw " + (self.sym.$inspect())], null); + }, TMP_UncaughtThrowError_initialize_11.$$arity = 1), nil) && 'initialize'; + })($nesting[0], $$($nesting, 'ArgumentError'), $nesting); + (function($base, $super, $parent_nesting) { + function $NameError(){}; + var self = $NameError = $klass($base, $super, 'NameError', $NameError); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_NameError_initialize_12; + + + self.$attr_reader("name"); + return (Opal.def(self, '$initialize', TMP_NameError_initialize_12 = function $$initialize(message, name) { + var $iter = TMP_NameError_initialize_12.$$p, $yield = $iter || nil, self = this; + + if ($iter) TMP_NameError_initialize_12.$$p = null; + + + if (name == null) { + name = nil; + }; + $send(self, Opal.find_super_dispatcher(self, 'initialize', TMP_NameError_initialize_12, false), [message], null); + return (self.name = name); + }, TMP_NameError_initialize_12.$$arity = -2), nil) && 'initialize'; + })($nesting[0], null, $nesting); + (function($base, $super, $parent_nesting) { + function $NoMethodError(){}; + var self = $NoMethodError = $klass($base, $super, 'NoMethodError', $NoMethodError); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_NoMethodError_initialize_13; + + + self.$attr_reader("args"); + return (Opal.def(self, '$initialize', TMP_NoMethodError_initialize_13 = function $$initialize(message, name, args) { + var $iter = TMP_NoMethodError_initialize_13.$$p, $yield = $iter || nil, self = this; + + if ($iter) TMP_NoMethodError_initialize_13.$$p = null; + + + if (name == null) { + name = nil; + }; + + if (args == null) { + args = []; + }; + $send(self, Opal.find_super_dispatcher(self, 'initialize', TMP_NoMethodError_initialize_13, false), [message, name], null); + return (self.args = args); + }, TMP_NoMethodError_initialize_13.$$arity = -2), nil) && 'initialize'; + })($nesting[0], null, $nesting); + (function($base, $super, $parent_nesting) { + function $StopIteration(){}; + var self = $StopIteration = $klass($base, $super, 'StopIteration', $StopIteration); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return self.$attr_reader("result") + })($nesting[0], null, $nesting); + (function($base, $super, $parent_nesting) { + function $KeyError(){}; + var self = $KeyError = $klass($base, $super, 'KeyError', $KeyError); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_KeyError_initialize_14, TMP_KeyError_receiver_15, TMP_KeyError_key_16; + + def.receiver = def.key = nil; + + + Opal.def(self, '$initialize', TMP_KeyError_initialize_14 = function $$initialize(message, $kwargs) { + var receiver, key, $iter = TMP_KeyError_initialize_14.$$p, $yield = $iter || nil, self = this; + + if ($iter) TMP_KeyError_initialize_14.$$p = null; + + + if ($kwargs == null) { + $kwargs = $hash2([], {}); + } else if (!$kwargs.$$is_hash) { + throw Opal.ArgumentError.$new('expected kwargs'); + }; + + receiver = $kwargs.$$smap["receiver"]; + if (receiver == null) { + receiver = nil + }; + + key = $kwargs.$$smap["key"]; + if (key == null) { + key = nil + }; + $send(self, Opal.find_super_dispatcher(self, 'initialize', TMP_KeyError_initialize_14, false), [message], null); + self.receiver = receiver; + return (self.key = key); + }, TMP_KeyError_initialize_14.$$arity = -2); + + Opal.def(self, '$receiver', TMP_KeyError_receiver_15 = function $$receiver() { + var $a, self = this; + + return ($truthy($a = self.receiver) ? $a : self.$raise($$($nesting, 'ArgumentError'), "no receiver is available")) + }, TMP_KeyError_receiver_15.$$arity = 0); + return (Opal.def(self, '$key', TMP_KeyError_key_16 = function $$key() { + var $a, self = this; + + return ($truthy($a = self.key) ? $a : self.$raise($$($nesting, 'ArgumentError'), "no key is available")) + }, TMP_KeyError_key_16.$$arity = 0), nil) && 'key'; + })($nesting[0], null, $nesting); + return (function($base, $parent_nesting) { + function $JS() {}; + var self = $JS = $module($base, 'JS', $JS); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + (function($base, $super, $parent_nesting) { + function $Error(){}; + var self = $Error = $klass($base, $super, 'Error', $Error); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return nil + })($nesting[0], null, $nesting) + })($nesting[0], $nesting); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/constants"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice; + + + Opal.const_set($nesting[0], 'RUBY_PLATFORM', "opal"); + Opal.const_set($nesting[0], 'RUBY_ENGINE', "opal"); + Opal.const_set($nesting[0], 'RUBY_VERSION', "2.5.1"); + Opal.const_set($nesting[0], 'RUBY_ENGINE_VERSION', "0.11.99.dev"); + Opal.const_set($nesting[0], 'RUBY_RELEASE_DATE', "2018-12-25"); + Opal.const_set($nesting[0], 'RUBY_PATCHLEVEL', 0); + Opal.const_set($nesting[0], 'RUBY_REVISION', 0); + Opal.const_set($nesting[0], 'RUBY_COPYRIGHT', "opal - Copyright (C) 2013-2018 Adam Beynon and the Opal contributors"); + return Opal.const_set($nesting[0], 'RUBY_DESCRIPTION', "" + "opal " + ($$($nesting, 'RUBY_ENGINE_VERSION')) + " (" + ($$($nesting, 'RUBY_RELEASE_DATE')) + " revision " + ($$($nesting, 'RUBY_REVISION')) + ")"); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["opal/base"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice; + + Opal.add_stubs(['$require']); + + self.$require("corelib/runtime"); + self.$require("corelib/helpers"); + self.$require("corelib/module"); + self.$require("corelib/class"); + self.$require("corelib/basic_object"); + self.$require("corelib/kernel"); + self.$require("corelib/error"); + return self.$require("corelib/constants"); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/nil"] = function(Opal) { + function $rb_gt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $hash2 = Opal.hash2, $truthy = Opal.truthy; + + Opal.add_stubs(['$raise', '$name', '$new', '$>', '$length', '$Rational']); + + (function($base, $super, $parent_nesting) { + function $NilClass(){}; + var self = $NilClass = $klass($base, $super, 'NilClass', $NilClass); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_NilClass_$B_2, TMP_NilClass_$_3, TMP_NilClass_$_4, TMP_NilClass_$_5, TMP_NilClass_$eq$eq_6, TMP_NilClass_dup_7, TMP_NilClass_clone_8, TMP_NilClass_inspect_9, TMP_NilClass_nil$q_10, TMP_NilClass_singleton_class_11, TMP_NilClass_to_a_12, TMP_NilClass_to_h_13, TMP_NilClass_to_i_14, TMP_NilClass_to_s_15, TMP_NilClass_to_c_16, TMP_NilClass_rationalize_17, TMP_NilClass_to_r_18, TMP_NilClass_instance_variables_19; + + + def.$$meta = self; + (function(self, $parent_nesting) { + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_allocate_1; + + + + Opal.def(self, '$allocate', TMP_allocate_1 = function $$allocate() { + var self = this; + + return self.$raise($$($nesting, 'TypeError'), "" + "allocator undefined for " + (self.$name())) + }, TMP_allocate_1.$$arity = 0); + + + Opal.udef(self, '$' + "new");; + return nil;; + })(Opal.get_singleton_class(self), $nesting); + + Opal.def(self, '$!', TMP_NilClass_$B_2 = function() { + var self = this; + + return true + }, TMP_NilClass_$B_2.$$arity = 0); + + Opal.def(self, '$&', TMP_NilClass_$_3 = function(other) { + var self = this; + + return false + }, TMP_NilClass_$_3.$$arity = 1); + + Opal.def(self, '$|', TMP_NilClass_$_4 = function(other) { + var self = this; + + return other !== false && other !== nil; + }, TMP_NilClass_$_4.$$arity = 1); + + Opal.def(self, '$^', TMP_NilClass_$_5 = function(other) { + var self = this; + + return other !== false && other !== nil; + }, TMP_NilClass_$_5.$$arity = 1); + + Opal.def(self, '$==', TMP_NilClass_$eq$eq_6 = function(other) { + var self = this; + + return other === nil; + }, TMP_NilClass_$eq$eq_6.$$arity = 1); + + Opal.def(self, '$dup', TMP_NilClass_dup_7 = function $$dup() { + var self = this; + + return nil + }, TMP_NilClass_dup_7.$$arity = 0); + + Opal.def(self, '$clone', TMP_NilClass_clone_8 = function $$clone($kwargs) { + var freeze, self = this; + + + + if ($kwargs == null) { + $kwargs = $hash2([], {}); + } else if (!$kwargs.$$is_hash) { + throw Opal.ArgumentError.$new('expected kwargs'); + }; + + freeze = $kwargs.$$smap["freeze"]; + if (freeze == null) { + freeze = true + }; + return nil; + }, TMP_NilClass_clone_8.$$arity = -1); + + Opal.def(self, '$inspect', TMP_NilClass_inspect_9 = function $$inspect() { + var self = this; + + return "nil" + }, TMP_NilClass_inspect_9.$$arity = 0); + + Opal.def(self, '$nil?', TMP_NilClass_nil$q_10 = function() { + var self = this; + + return true + }, TMP_NilClass_nil$q_10.$$arity = 0); + + Opal.def(self, '$singleton_class', TMP_NilClass_singleton_class_11 = function $$singleton_class() { + var self = this; + + return $$($nesting, 'NilClass') + }, TMP_NilClass_singleton_class_11.$$arity = 0); + + Opal.def(self, '$to_a', TMP_NilClass_to_a_12 = function $$to_a() { + var self = this; + + return [] + }, TMP_NilClass_to_a_12.$$arity = 0); + + Opal.def(self, '$to_h', TMP_NilClass_to_h_13 = function $$to_h() { + var self = this; + + return Opal.hash(); + }, TMP_NilClass_to_h_13.$$arity = 0); + + Opal.def(self, '$to_i', TMP_NilClass_to_i_14 = function $$to_i() { + var self = this; + + return 0 + }, TMP_NilClass_to_i_14.$$arity = 0); + Opal.alias(self, "to_f", "to_i"); + + Opal.def(self, '$to_s', TMP_NilClass_to_s_15 = function $$to_s() { + var self = this; + + return "" + }, TMP_NilClass_to_s_15.$$arity = 0); + + Opal.def(self, '$to_c', TMP_NilClass_to_c_16 = function $$to_c() { + var self = this; + + return $$($nesting, 'Complex').$new(0, 0) + }, TMP_NilClass_to_c_16.$$arity = 0); + + Opal.def(self, '$rationalize', TMP_NilClass_rationalize_17 = function $$rationalize($a) { + var $post_args, args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + if ($truthy($rb_gt(args.$length(), 1))) { + self.$raise($$($nesting, 'ArgumentError'))}; + return self.$Rational(0, 1); + }, TMP_NilClass_rationalize_17.$$arity = -1); + + Opal.def(self, '$to_r', TMP_NilClass_to_r_18 = function $$to_r() { + var self = this; + + return self.$Rational(0, 1) + }, TMP_NilClass_to_r_18.$$arity = 0); + return (Opal.def(self, '$instance_variables', TMP_NilClass_instance_variables_19 = function $$instance_variables() { + var self = this; + + return [] + }, TMP_NilClass_instance_variables_19.$$arity = 0), nil) && 'instance_variables'; + })($nesting[0], null, $nesting); + return Opal.const_set($nesting[0], 'NIL', nil); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/boolean"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $hash2 = Opal.hash2; + + Opal.add_stubs(['$raise', '$name']); + + (function($base, $super, $parent_nesting) { + function $Boolean(){}; + var self = $Boolean = $klass($base, $super, 'Boolean', $Boolean); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Boolean___id___2, TMP_Boolean_$B_3, TMP_Boolean_$_4, TMP_Boolean_$_5, TMP_Boolean_$_6, TMP_Boolean_$eq$eq_7, TMP_Boolean_singleton_class_8, TMP_Boolean_to_s_9, TMP_Boolean_dup_10, TMP_Boolean_clone_11; + + + Opal.defineProperty(Boolean.prototype, '$$is_boolean', true); + Opal.defineProperty(Boolean.prototype, '$$meta', self); + (function(self, $parent_nesting) { + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_allocate_1; + + + + Opal.def(self, '$allocate', TMP_allocate_1 = function $$allocate() { + var self = this; + + return self.$raise($$($nesting, 'TypeError'), "" + "allocator undefined for " + (self.$name())) + }, TMP_allocate_1.$$arity = 0); + + + Opal.udef(self, '$' + "new");; + return nil;; + })(Opal.get_singleton_class(self), $nesting); + + Opal.def(self, '$__id__', TMP_Boolean___id___2 = function $$__id__() { + var self = this; + + return self.valueOf() ? 2 : 0; + }, TMP_Boolean___id___2.$$arity = 0); + Opal.alias(self, "object_id", "__id__"); + + Opal.def(self, '$!', TMP_Boolean_$B_3 = function() { + var self = this; + + return self != true; + }, TMP_Boolean_$B_3.$$arity = 0); + + Opal.def(self, '$&', TMP_Boolean_$_4 = function(other) { + var self = this; + + return (self == true) ? (other !== false && other !== nil) : false; + }, TMP_Boolean_$_4.$$arity = 1); + + Opal.def(self, '$|', TMP_Boolean_$_5 = function(other) { + var self = this; + + return (self == true) ? true : (other !== false && other !== nil); + }, TMP_Boolean_$_5.$$arity = 1); + + Opal.def(self, '$^', TMP_Boolean_$_6 = function(other) { + var self = this; + + return (self == true) ? (other === false || other === nil) : (other !== false && other !== nil); + }, TMP_Boolean_$_6.$$arity = 1); + + Opal.def(self, '$==', TMP_Boolean_$eq$eq_7 = function(other) { + var self = this; + + return (self == true) === other.valueOf(); + }, TMP_Boolean_$eq$eq_7.$$arity = 1); + Opal.alias(self, "equal?", "=="); + Opal.alias(self, "eql?", "=="); + + Opal.def(self, '$singleton_class', TMP_Boolean_singleton_class_8 = function $$singleton_class() { + var self = this; + + return $$($nesting, 'Boolean') + }, TMP_Boolean_singleton_class_8.$$arity = 0); + + Opal.def(self, '$to_s', TMP_Boolean_to_s_9 = function $$to_s() { + var self = this; + + return (self == true) ? 'true' : 'false'; + }, TMP_Boolean_to_s_9.$$arity = 0); + + Opal.def(self, '$dup', TMP_Boolean_dup_10 = function $$dup() { + var self = this; + + return self + }, TMP_Boolean_dup_10.$$arity = 0); + return (Opal.def(self, '$clone', TMP_Boolean_clone_11 = function $$clone($kwargs) { + var freeze, self = this; + + + + if ($kwargs == null) { + $kwargs = $hash2([], {}); + } else if (!$kwargs.$$is_hash) { + throw Opal.ArgumentError.$new('expected kwargs'); + }; + + freeze = $kwargs.$$smap["freeze"]; + if (freeze == null) { + freeze = true + }; + return self; + }, TMP_Boolean_clone_11.$$arity = -1), nil) && 'clone'; + })($nesting[0], Boolean, $nesting); + Opal.const_set($nesting[0], 'TrueClass', $$($nesting, 'Boolean')); + Opal.const_set($nesting[0], 'FalseClass', $$($nesting, 'Boolean')); + Opal.const_set($nesting[0], 'TRUE', true); + return Opal.const_set($nesting[0], 'FALSE', false); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/comparable"] = function(Opal) { + function $rb_gt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); + } + function $rb_lt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $truthy = Opal.truthy; + + Opal.add_stubs(['$===', '$>', '$<', '$equal?', '$<=>', '$normalize', '$raise', '$class']); + return (function($base, $parent_nesting) { + function $Comparable() {}; + var self = $Comparable = $module($base, 'Comparable', $Comparable); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Comparable_normalize_1, TMP_Comparable_$eq$eq_2, TMP_Comparable_$gt_3, TMP_Comparable_$gt$eq_4, TMP_Comparable_$lt_5, TMP_Comparable_$lt$eq_6, TMP_Comparable_between$q_7, TMP_Comparable_clamp_8; + + + Opal.defs(self, '$normalize', TMP_Comparable_normalize_1 = function $$normalize(what) { + var self = this; + + + if ($truthy($$($nesting, 'Integer')['$==='](what))) { + return what}; + if ($truthy($rb_gt(what, 0))) { + return 1}; + if ($truthy($rb_lt(what, 0))) { + return -1}; + return 0; + }, TMP_Comparable_normalize_1.$$arity = 1); + + Opal.def(self, '$==', TMP_Comparable_$eq$eq_2 = function(other) { + var self = this, cmp = nil; + + try { + + if ($truthy(self['$equal?'](other))) { + return true}; + + if (self["$<=>"] == Opal.Kernel["$<=>"]) { + return false; + } + + // check for infinite recursion + if (self.$$comparable) { + delete self.$$comparable; + return false; + } + ; + if ($truthy((cmp = self['$<=>'](other)))) { + } else { + return false + }; + return $$($nesting, 'Comparable').$normalize(cmp) == 0; + } catch ($err) { + if (Opal.rescue($err, [$$($nesting, 'StandardError')])) { + try { + return false + } finally { Opal.pop_exception() } + } else { throw $err; } + } + }, TMP_Comparable_$eq$eq_2.$$arity = 1); + + Opal.def(self, '$>', TMP_Comparable_$gt_3 = function(other) { + var self = this, cmp = nil; + + + if ($truthy((cmp = self['$<=>'](other)))) { + } else { + self.$raise($$($nesting, 'ArgumentError'), "" + "comparison of " + (self.$class()) + " with " + (other.$class()) + " failed") + }; + return $$($nesting, 'Comparable').$normalize(cmp) > 0; + }, TMP_Comparable_$gt_3.$$arity = 1); + + Opal.def(self, '$>=', TMP_Comparable_$gt$eq_4 = function(other) { + var self = this, cmp = nil; + + + if ($truthy((cmp = self['$<=>'](other)))) { + } else { + self.$raise($$($nesting, 'ArgumentError'), "" + "comparison of " + (self.$class()) + " with " + (other.$class()) + " failed") + }; + return $$($nesting, 'Comparable').$normalize(cmp) >= 0; + }, TMP_Comparable_$gt$eq_4.$$arity = 1); + + Opal.def(self, '$<', TMP_Comparable_$lt_5 = function(other) { + var self = this, cmp = nil; + + + if ($truthy((cmp = self['$<=>'](other)))) { + } else { + self.$raise($$($nesting, 'ArgumentError'), "" + "comparison of " + (self.$class()) + " with " + (other.$class()) + " failed") + }; + return $$($nesting, 'Comparable').$normalize(cmp) < 0; + }, TMP_Comparable_$lt_5.$$arity = 1); + + Opal.def(self, '$<=', TMP_Comparable_$lt$eq_6 = function(other) { + var self = this, cmp = nil; + + + if ($truthy((cmp = self['$<=>'](other)))) { + } else { + self.$raise($$($nesting, 'ArgumentError'), "" + "comparison of " + (self.$class()) + " with " + (other.$class()) + " failed") + }; + return $$($nesting, 'Comparable').$normalize(cmp) <= 0; + }, TMP_Comparable_$lt$eq_6.$$arity = 1); + + Opal.def(self, '$between?', TMP_Comparable_between$q_7 = function(min, max) { + var self = this; + + + if ($rb_lt(self, min)) { + return false}; + if ($rb_gt(self, max)) { + return false}; + return true; + }, TMP_Comparable_between$q_7.$$arity = 2); + + Opal.def(self, '$clamp', TMP_Comparable_clamp_8 = function $$clamp(min, max) { + var self = this, cmp = nil; + + + cmp = min['$<=>'](max); + if ($truthy(cmp)) { + } else { + self.$raise($$($nesting, 'ArgumentError'), "" + "comparison of " + (min.$class()) + " with " + (max.$class()) + " failed") + }; + if ($truthy($rb_gt($$($nesting, 'Comparable').$normalize(cmp), 0))) { + self.$raise($$($nesting, 'ArgumentError'), "min argument must be smaller than max argument")}; + if ($truthy($rb_lt($$($nesting, 'Comparable').$normalize(self['$<=>'](min)), 0))) { + return min}; + if ($truthy($rb_gt($$($nesting, 'Comparable').$normalize(self['$<=>'](max)), 0))) { + return max}; + return self; + }, TMP_Comparable_clamp_8.$$arity = 2); + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/regexp"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $send = Opal.send, $truthy = Opal.truthy, $gvars = Opal.gvars; + + Opal.add_stubs(['$nil?', '$[]', '$raise', '$escape', '$options', '$to_str', '$new', '$join', '$coerce_to!', '$!', '$match', '$coerce_to?', '$begin', '$coerce_to', '$=~', '$attr_reader', '$===', '$inspect', '$to_a']); + + (function($base, $super, $parent_nesting) { + function $RegexpError(){}; + var self = $RegexpError = $klass($base, $super, 'RegexpError', $RegexpError); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return nil + })($nesting[0], $$($nesting, 'StandardError'), $nesting); + (function($base, $super, $parent_nesting) { + function $Regexp(){}; + var self = $Regexp = $klass($base, $super, 'Regexp', $Regexp); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Regexp_$eq$eq_6, TMP_Regexp_$eq$eq$eq_7, TMP_Regexp_$eq$_8, TMP_Regexp_inspect_9, TMP_Regexp_match_10, TMP_Regexp_match$q_11, TMP_Regexp_$_12, TMP_Regexp_source_13, TMP_Regexp_options_14, TMP_Regexp_casefold$q_15; + + + Opal.const_set($nesting[0], 'IGNORECASE', 1); + Opal.const_set($nesting[0], 'EXTENDED', 2); + Opal.const_set($nesting[0], 'MULTILINE', 4); + Opal.defineProperty(RegExp.prototype, '$$is_regexp', true); + (function(self, $parent_nesting) { + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_allocate_1, TMP_escape_2, TMP_last_match_3, TMP_union_4, TMP_new_5; + + + + Opal.def(self, '$allocate', TMP_allocate_1 = function $$allocate() { + var $iter = TMP_allocate_1.$$p, $yield = $iter || nil, self = this, allocated = nil, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_allocate_1.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + + allocated = $send(self, Opal.find_super_dispatcher(self, 'allocate', TMP_allocate_1, false), $zuper, $iter); + allocated.uninitialized = true; + return allocated; + }, TMP_allocate_1.$$arity = 0); + + Opal.def(self, '$escape', TMP_escape_2 = function $$escape(string) { + var self = this; + + return Opal.escape_regexp(string); + }, TMP_escape_2.$$arity = 1); + + Opal.def(self, '$last_match', TMP_last_match_3 = function $$last_match(n) { + var self = this; + if ($gvars["~"] == null) $gvars["~"] = nil; + + + + if (n == null) { + n = nil; + }; + if ($truthy(n['$nil?']())) { + return $gvars["~"] + } else { + return $gvars["~"]['$[]'](n) + }; + }, TMP_last_match_3.$$arity = -1); + Opal.alias(self, "quote", "escape"); + + Opal.def(self, '$union', TMP_union_4 = function $$union($a) { + var $post_args, parts, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + parts = $post_args;; + + var is_first_part_array, quoted_validated, part, options, each_part_options; + if (parts.length == 0) { + return /(?!)/; + } + // return fast if there's only one element + if (parts.length == 1 && parts[0].$$is_regexp) { + return parts[0]; + } + // cover the 2 arrays passed as arguments case + is_first_part_array = parts[0].$$is_array; + if (parts.length > 1 && is_first_part_array) { + self.$raise($$($nesting, 'TypeError'), "no implicit conversion of Array into String") + } + // deal with splat issues (related to https://github.com/opal/opal/issues/858) + if (is_first_part_array) { + parts = parts[0]; + } + options = undefined; + quoted_validated = []; + for (var i=0; i < parts.length; i++) { + part = parts[i]; + if (part.$$is_string) { + quoted_validated.push(self.$escape(part)); + } + else if (part.$$is_regexp) { + each_part_options = (part).$options(); + if (options != undefined && options != each_part_options) { + self.$raise($$($nesting, 'TypeError'), "All expressions must use the same options") + } + options = each_part_options; + quoted_validated.push('('+part.source+')'); + } + else { + quoted_validated.push(self.$escape((part).$to_str())); + } + } + ; + return self.$new((quoted_validated).$join("|"), options); + }, TMP_union_4.$$arity = -1); + return (Opal.def(self, '$new', TMP_new_5 = function(regexp, options) { + var self = this; + + + ; + + if (regexp.$$is_regexp) { + return new RegExp(regexp); + } + + regexp = $$($nesting, 'Opal')['$coerce_to!'](regexp, $$($nesting, 'String'), "to_str"); + + if (regexp.charAt(regexp.length - 1) === '\\' && regexp.charAt(regexp.length - 2) !== '\\') { + self.$raise($$($nesting, 'RegexpError'), "" + "too short escape sequence: /" + (regexp) + "/") + } + + if (options === undefined || options['$!']()) { + return new RegExp(regexp); + } + + if (options.$$is_number) { + var temp = ''; + if ($$($nesting, 'IGNORECASE') & options) { temp += 'i'; } + if ($$($nesting, 'MULTILINE') & options) { temp += 'm'; } + options = temp; + } + else { + options = 'i'; + } + + return new RegExp(regexp, options); + ; + }, TMP_new_5.$$arity = -2), nil) && 'new'; + })(Opal.get_singleton_class(self), $nesting); + + Opal.def(self, '$==', TMP_Regexp_$eq$eq_6 = function(other) { + var self = this; + + return other instanceof RegExp && self.toString() === other.toString(); + }, TMP_Regexp_$eq$eq_6.$$arity = 1); + + Opal.def(self, '$===', TMP_Regexp_$eq$eq$eq_7 = function(string) { + var self = this; + + return self.$match($$($nesting, 'Opal')['$coerce_to?'](string, $$($nesting, 'String'), "to_str")) !== nil + }, TMP_Regexp_$eq$eq$eq_7.$$arity = 1); + + Opal.def(self, '$=~', TMP_Regexp_$eq$_8 = function(string) { + var $a, self = this; + if ($gvars["~"] == null) $gvars["~"] = nil; + + return ($truthy($a = self.$match(string)) ? $gvars["~"].$begin(0) : $a) + }, TMP_Regexp_$eq$_8.$$arity = 1); + Opal.alias(self, "eql?", "=="); + + Opal.def(self, '$inspect', TMP_Regexp_inspect_9 = function $$inspect() { + var self = this; + + + var regexp_format = /^\/(.*)\/([^\/]*)$/; + var value = self.toString(); + var matches = regexp_format.exec(value); + if (matches) { + var regexp_pattern = matches[1]; + var regexp_flags = matches[2]; + var chars = regexp_pattern.split(''); + var chars_length = chars.length; + var char_escaped = false; + var regexp_pattern_escaped = ''; + for (var i = 0; i < chars_length; i++) { + var current_char = chars[i]; + if (!char_escaped && current_char == '/') { + regexp_pattern_escaped = regexp_pattern_escaped.concat('\\'); + } + regexp_pattern_escaped = regexp_pattern_escaped.concat(current_char); + if (current_char == '\\') { + if (char_escaped) { + // does not over escape + char_escaped = false; + } else { + char_escaped = true; + } + } else { + char_escaped = false; + } + } + return '/' + regexp_pattern_escaped + '/' + regexp_flags; + } else { + return value; + } + + }, TMP_Regexp_inspect_9.$$arity = 0); + + Opal.def(self, '$match', TMP_Regexp_match_10 = function $$match(string, pos) { + var $iter = TMP_Regexp_match_10.$$p, block = $iter || nil, self = this; + if ($gvars["~"] == null) $gvars["~"] = nil; + + if ($iter) TMP_Regexp_match_10.$$p = null; + + + if ($iter) TMP_Regexp_match_10.$$p = null;; + ; + + if (self.uninitialized) { + self.$raise($$($nesting, 'TypeError'), "uninitialized Regexp") + } + + if (pos === undefined) { + if (string === nil) return ($gvars["~"] = nil); + var m = self.exec($$($nesting, 'Opal').$coerce_to(string, $$($nesting, 'String'), "to_str")); + if (m) { + ($gvars["~"] = $$($nesting, 'MatchData').$new(self, m)); + return block === nil ? $gvars["~"] : Opal.yield1(block, $gvars["~"]); + } else { + return ($gvars["~"] = nil); + } + } + + pos = $$($nesting, 'Opal').$coerce_to(pos, $$($nesting, 'Integer'), "to_int"); + + if (string === nil) { + return ($gvars["~"] = nil); + } + + string = $$($nesting, 'Opal').$coerce_to(string, $$($nesting, 'String'), "to_str"); + + if (pos < 0) { + pos += string.length; + if (pos < 0) { + return ($gvars["~"] = nil); + } + } + + // global RegExp maintains state, so not using self/this + var md, re = Opal.global_regexp(self); + + while (true) { + md = re.exec(string); + if (md === null) { + return ($gvars["~"] = nil); + } + if (md.index >= pos) { + ($gvars["~"] = $$($nesting, 'MatchData').$new(re, md)); + return block === nil ? $gvars["~"] : Opal.yield1(block, $gvars["~"]); + } + re.lastIndex = md.index + 1; + } + ; + }, TMP_Regexp_match_10.$$arity = -2); + + Opal.def(self, '$match?', TMP_Regexp_match$q_11 = function(string, pos) { + var self = this; + + + ; + + if (self.uninitialized) { + self.$raise($$($nesting, 'TypeError'), "uninitialized Regexp") + } + + if (pos === undefined) { + return string === nil ? false : self.test($$($nesting, 'Opal').$coerce_to(string, $$($nesting, 'String'), "to_str")); + } + + pos = $$($nesting, 'Opal').$coerce_to(pos, $$($nesting, 'Integer'), "to_int"); + + if (string === nil) { + return false; + } + + string = $$($nesting, 'Opal').$coerce_to(string, $$($nesting, 'String'), "to_str"); + + if (pos < 0) { + pos += string.length; + if (pos < 0) { + return false; + } + } + + // global RegExp maintains state, so not using self/this + var md, re = Opal.global_regexp(self); + + md = re.exec(string); + if (md === null || md.index < pos) { + return false; + } else { + return true; + } + ; + }, TMP_Regexp_match$q_11.$$arity = -2); + + Opal.def(self, '$~', TMP_Regexp_$_12 = function() { + var self = this; + if ($gvars._ == null) $gvars._ = nil; + + return self['$=~']($gvars._) + }, TMP_Regexp_$_12.$$arity = 0); + + Opal.def(self, '$source', TMP_Regexp_source_13 = function $$source() { + var self = this; + + return self.source; + }, TMP_Regexp_source_13.$$arity = 0); + + Opal.def(self, '$options', TMP_Regexp_options_14 = function $$options() { + var self = this; + + + if (self.uninitialized) { + self.$raise($$($nesting, 'TypeError'), "uninitialized Regexp") + } + var result = 0; + // should be supported in IE6 according to https://msdn.microsoft.com/en-us/library/7f5z26w4(v=vs.94).aspx + if (self.multiline) { + result |= $$($nesting, 'MULTILINE'); + } + if (self.ignoreCase) { + result |= $$($nesting, 'IGNORECASE'); + } + return result; + + }, TMP_Regexp_options_14.$$arity = 0); + + Opal.def(self, '$casefold?', TMP_Regexp_casefold$q_15 = function() { + var self = this; + + return self.ignoreCase; + }, TMP_Regexp_casefold$q_15.$$arity = 0); + return Opal.alias(self, "to_s", "source"); + })($nesting[0], RegExp, $nesting); + return (function($base, $super, $parent_nesting) { + function $MatchData(){}; + var self = $MatchData = $klass($base, $super, 'MatchData', $MatchData); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_MatchData_initialize_16, TMP_MatchData_$$_17, TMP_MatchData_offset_18, TMP_MatchData_$eq$eq_19, TMP_MatchData_begin_20, TMP_MatchData_end_21, TMP_MatchData_captures_22, TMP_MatchData_inspect_23, TMP_MatchData_length_24, TMP_MatchData_to_a_25, TMP_MatchData_to_s_26, TMP_MatchData_values_at_27; + + def.matches = nil; + + self.$attr_reader("post_match", "pre_match", "regexp", "string"); + + Opal.def(self, '$initialize', TMP_MatchData_initialize_16 = function $$initialize(regexp, match_groups) { + var self = this; + + + $gvars["~"] = self; + self.regexp = regexp; + self.begin = match_groups.index; + self.string = match_groups.input; + self.pre_match = match_groups.input.slice(0, match_groups.index); + self.post_match = match_groups.input.slice(match_groups.index + match_groups[0].length); + self.matches = []; + + for (var i = 0, length = match_groups.length; i < length; i++) { + var group = match_groups[i]; + + if (group == null) { + self.matches.push(nil); + } + else { + self.matches.push(group); + } + } + ; + }, TMP_MatchData_initialize_16.$$arity = 2); + + Opal.def(self, '$[]', TMP_MatchData_$$_17 = function($a) { + var $post_args, args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + return $send(self.matches, '[]', Opal.to_a(args)); + }, TMP_MatchData_$$_17.$$arity = -1); + + Opal.def(self, '$offset', TMP_MatchData_offset_18 = function $$offset(n) { + var self = this; + + + if (n !== 0) { + self.$raise($$($nesting, 'ArgumentError'), "MatchData#offset only supports 0th element") + } + return [self.begin, self.begin + self.matches[n].length]; + + }, TMP_MatchData_offset_18.$$arity = 1); + + Opal.def(self, '$==', TMP_MatchData_$eq$eq_19 = function(other) { + var $a, $b, $c, $d, self = this; + + + if ($truthy($$($nesting, 'MatchData')['$==='](other))) { + } else { + return false + }; + return ($truthy($a = ($truthy($b = ($truthy($c = ($truthy($d = self.string == other.string) ? self.regexp.toString() == other.regexp.toString() : $d)) ? self.pre_match == other.pre_match : $c)) ? self.post_match == other.post_match : $b)) ? self.begin == other.begin : $a); + }, TMP_MatchData_$eq$eq_19.$$arity = 1); + Opal.alias(self, "eql?", "=="); + + Opal.def(self, '$begin', TMP_MatchData_begin_20 = function $$begin(n) { + var self = this; + + + if (n !== 0) { + self.$raise($$($nesting, 'ArgumentError'), "MatchData#begin only supports 0th element") + } + return self.begin; + + }, TMP_MatchData_begin_20.$$arity = 1); + + Opal.def(self, '$end', TMP_MatchData_end_21 = function $$end(n) { + var self = this; + + + if (n !== 0) { + self.$raise($$($nesting, 'ArgumentError'), "MatchData#end only supports 0th element") + } + return self.begin + self.matches[n].length; + + }, TMP_MatchData_end_21.$$arity = 1); + + Opal.def(self, '$captures', TMP_MatchData_captures_22 = function $$captures() { + var self = this; + + return self.matches.slice(1) + }, TMP_MatchData_captures_22.$$arity = 0); + + Opal.def(self, '$inspect', TMP_MatchData_inspect_23 = function $$inspect() { + var self = this; + + + var str = "#"; + + }, TMP_MatchData_inspect_23.$$arity = 0); + + Opal.def(self, '$length', TMP_MatchData_length_24 = function $$length() { + var self = this; + + return self.matches.length + }, TMP_MatchData_length_24.$$arity = 0); + Opal.alias(self, "size", "length"); + + Opal.def(self, '$to_a', TMP_MatchData_to_a_25 = function $$to_a() { + var self = this; + + return self.matches + }, TMP_MatchData_to_a_25.$$arity = 0); + + Opal.def(self, '$to_s', TMP_MatchData_to_s_26 = function $$to_s() { + var self = this; + + return self.matches[0] + }, TMP_MatchData_to_s_26.$$arity = 0); + return (Opal.def(self, '$values_at', TMP_MatchData_values_at_27 = function $$values_at($a) { + var $post_args, args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + + var i, a, index, values = []; + + for (i = 0; i < args.length; i++) { + + if (args[i].$$is_range) { + a = (args[i]).$to_a(); + a.unshift(i, 1); + Array.prototype.splice.apply(args, a); + } + + index = $$($nesting, 'Opal')['$coerce_to!'](args[i], $$($nesting, 'Integer'), "to_int"); + + if (index < 0) { + index += self.matches.length; + if (index < 0) { + values.push(nil); + continue; + } + } + + values.push(self.matches[index]); + } + + return values; + ; + }, TMP_MatchData_values_at_27.$$arity = -1), nil) && 'values_at'; + })($nesting[0], null, $nesting); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/string"] = function(Opal) { + function $rb_divide(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs / rhs : lhs['$/'](rhs); + } + function $rb_plus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $truthy = Opal.truthy, $send = Opal.send, $gvars = Opal.gvars; + + Opal.add_stubs(['$require', '$include', '$coerce_to?', '$coerce_to', '$raise', '$===', '$format', '$to_s', '$respond_to?', '$to_str', '$<=>', '$==', '$=~', '$new', '$force_encoding', '$casecmp', '$empty?', '$ljust', '$ceil', '$/', '$+', '$rjust', '$floor', '$to_a', '$each_char', '$to_proc', '$coerce_to!', '$copy_singleton_methods', '$initialize_clone', '$initialize_dup', '$enum_for', '$size', '$chomp', '$[]', '$to_i', '$each_line', '$class', '$match', '$match?', '$captures', '$proc', '$succ', '$escape']); + + self.$require("corelib/comparable"); + self.$require("corelib/regexp"); + (function($base, $super, $parent_nesting) { + function $String(){}; + var self = $String = $klass($base, $super, 'String', $String); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_String___id___1, TMP_String_try_convert_2, TMP_String_new_3, TMP_String_initialize_4, TMP_String_$_5, TMP_String_$_6, TMP_String_$_7, TMP_String_$lt$eq$gt_8, TMP_String_$eq$eq_9, TMP_String_$eq$_10, TMP_String_$$_11, TMP_String_b_12, TMP_String_capitalize_13, TMP_String_casecmp_14, TMP_String_casecmp$q_15, TMP_String_center_16, TMP_String_chars_17, TMP_String_chomp_18, TMP_String_chop_19, TMP_String_chr_20, TMP_String_clone_21, TMP_String_dup_22, TMP_String_count_23, TMP_String_delete_24, TMP_String_delete_prefix_25, TMP_String_delete_suffix_26, TMP_String_downcase_27, TMP_String_each_char_28, TMP_String_each_line_30, TMP_String_empty$q_31, TMP_String_end_with$q_32, TMP_String_gsub_33, TMP_String_hash_34, TMP_String_hex_35, TMP_String_include$q_36, TMP_String_index_37, TMP_String_inspect_38, TMP_String_intern_39, TMP_String_lines_40, TMP_String_length_41, TMP_String_ljust_42, TMP_String_lstrip_43, TMP_String_ascii_only$q_44, TMP_String_match_45, TMP_String_match$q_46, TMP_String_next_47, TMP_String_oct_48, TMP_String_ord_49, TMP_String_partition_50, TMP_String_reverse_51, TMP_String_rindex_52, TMP_String_rjust_53, TMP_String_rpartition_54, TMP_String_rstrip_55, TMP_String_scan_56, TMP_String_split_57, TMP_String_squeeze_58, TMP_String_start_with$q_59, TMP_String_strip_60, TMP_String_sub_61, TMP_String_sum_62, TMP_String_swapcase_63, TMP_String_to_f_64, TMP_String_to_i_65, TMP_String_to_proc_66, TMP_String_to_s_68, TMP_String_tr_69, TMP_String_tr_s_70, TMP_String_upcase_71, TMP_String_upto_72, TMP_String_instance_variables_73, TMP_String__load_74, TMP_String_unicode_normalize_75, TMP_String_unicode_normalized$q_76, TMP_String_unpack_77, TMP_String_unpack1_78; + + + self.$include($$($nesting, 'Comparable')); + + Opal.defineProperty(String.prototype, '$$is_string', true); + + Opal.defineProperty(String.prototype, '$$cast', function(string) { + var klass = this.$$class; + if (klass === String) { + return string; + } else { + return new klass(string); + } + }); + ; + + Opal.def(self, '$__id__', TMP_String___id___1 = function $$__id__() { + var self = this; + + return self.toString(); + }, TMP_String___id___1.$$arity = 0); + Opal.alias(self, "object_id", "__id__"); + Opal.defs(self, '$try_convert', TMP_String_try_convert_2 = function $$try_convert(what) { + var self = this; + + return $$($nesting, 'Opal')['$coerce_to?'](what, $$($nesting, 'String'), "to_str") + }, TMP_String_try_convert_2.$$arity = 1); + Opal.defs(self, '$new', TMP_String_new_3 = function(str) { + var self = this; + + + + if (str == null) { + str = ""; + }; + str = $$($nesting, 'Opal').$coerce_to(str, $$($nesting, 'String'), "to_str"); + return new self(str);; + }, TMP_String_new_3.$$arity = -1); + + Opal.def(self, '$initialize', TMP_String_initialize_4 = function $$initialize(str) { + var self = this; + + + ; + + if (str === undefined) { + return self; + } + ; + return self.$raise($$($nesting, 'NotImplementedError'), "Mutable strings are not supported in Opal."); + }, TMP_String_initialize_4.$$arity = -1); + + Opal.def(self, '$%', TMP_String_$_5 = function(data) { + var self = this; + + if ($truthy($$($nesting, 'Array')['$==='](data))) { + return $send(self, 'format', [self].concat(Opal.to_a(data))) + } else { + return self.$format(self, data) + } + }, TMP_String_$_5.$$arity = 1); + + Opal.def(self, '$*', TMP_String_$_6 = function(count) { + var self = this; + + + count = $$($nesting, 'Opal').$coerce_to(count, $$($nesting, 'Integer'), "to_int"); + + if (count < 0) { + self.$raise($$($nesting, 'ArgumentError'), "negative argument") + } + + if (count === 0) { + return self.$$cast(''); + } + + var result = '', + string = self.toString(); + + // All credit for the bit-twiddling magic code below goes to Mozilla + // polyfill implementation of String.prototype.repeat() posted here: + // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/repeat + + if (string.length * count >= 1 << 28) { + self.$raise($$($nesting, 'RangeError'), "multiply count must not overflow maximum string size") + } + + for (;;) { + if ((count & 1) === 1) { + result += string; + } + count >>>= 1; + if (count === 0) { + break; + } + string += string; + } + + return self.$$cast(result); + + }, TMP_String_$_6.$$arity = 1); + + Opal.def(self, '$+', TMP_String_$_7 = function(other) { + var self = this; + + + other = $$($nesting, 'Opal').$coerce_to(other, $$($nesting, 'String'), "to_str"); + return self + other.$to_s(); + }, TMP_String_$_7.$$arity = 1); + + Opal.def(self, '$<=>', TMP_String_$lt$eq$gt_8 = function(other) { + var self = this; + + if ($truthy(other['$respond_to?']("to_str"))) { + + other = other.$to_str().$to_s(); + return self > other ? 1 : (self < other ? -1 : 0);; + } else { + + var cmp = other['$<=>'](self); + + if (cmp === nil) { + return nil; + } + else { + return cmp > 0 ? -1 : (cmp < 0 ? 1 : 0); + } + + } + }, TMP_String_$lt$eq$gt_8.$$arity = 1); + + Opal.def(self, '$==', TMP_String_$eq$eq_9 = function(other) { + var self = this; + + + if (other.$$is_string) { + return self.toString() === other.toString(); + } + if ($$($nesting, 'Opal')['$respond_to?'](other, "to_str")) { + return other['$=='](self); + } + return false; + + }, TMP_String_$eq$eq_9.$$arity = 1); + Opal.alias(self, "eql?", "=="); + Opal.alias(self, "===", "=="); + + Opal.def(self, '$=~', TMP_String_$eq$_10 = function(other) { + var self = this; + + + if (other.$$is_string) { + self.$raise($$($nesting, 'TypeError'), "type mismatch: String given"); + } + + return other['$=~'](self); + + }, TMP_String_$eq$_10.$$arity = 1); + + Opal.def(self, '$[]', TMP_String_$$_11 = function(index, length) { + var self = this; + + + ; + + var size = self.length, exclude; + + if (index.$$is_range) { + exclude = index.excl; + length = $$($nesting, 'Opal').$coerce_to(index.end, $$($nesting, 'Integer'), "to_int"); + index = $$($nesting, 'Opal').$coerce_to(index.begin, $$($nesting, 'Integer'), "to_int"); + + if (Math.abs(index) > size) { + return nil; + } + + if (index < 0) { + index += size; + } + + if (length < 0) { + length += size; + } + + if (!exclude) { + length += 1; + } + + length = length - index; + + if (length < 0) { + length = 0; + } + + return self.$$cast(self.substr(index, length)); + } + + + if (index.$$is_string) { + if (length != null) { + self.$raise($$($nesting, 'TypeError')) + } + return self.indexOf(index) !== -1 ? self.$$cast(index) : nil; + } + + + if (index.$$is_regexp) { + var match = self.match(index); + + if (match === null) { + ($gvars["~"] = nil) + return nil; + } + + ($gvars["~"] = $$($nesting, 'MatchData').$new(index, match)) + + if (length == null) { + return self.$$cast(match[0]); + } + + length = $$($nesting, 'Opal').$coerce_to(length, $$($nesting, 'Integer'), "to_int"); + + if (length < 0 && -length < match.length) { + return self.$$cast(match[length += match.length]); + } + + if (length >= 0 && length < match.length) { + return self.$$cast(match[length]); + } + + return nil; + } + + + index = $$($nesting, 'Opal').$coerce_to(index, $$($nesting, 'Integer'), "to_int"); + + if (index < 0) { + index += size; + } + + if (length == null) { + if (index >= size || index < 0) { + return nil; + } + return self.$$cast(self.substr(index, 1)); + } + + length = $$($nesting, 'Opal').$coerce_to(length, $$($nesting, 'Integer'), "to_int"); + + if (length < 0) { + return nil; + } + + if (index > size || index < 0) { + return nil; + } + + return self.$$cast(self.substr(index, length)); + ; + }, TMP_String_$$_11.$$arity = -2); + Opal.alias(self, "byteslice", "[]"); + + Opal.def(self, '$b', TMP_String_b_12 = function $$b() { + var self = this; + + return self.$force_encoding("binary") + }, TMP_String_b_12.$$arity = 0); + + Opal.def(self, '$capitalize', TMP_String_capitalize_13 = function $$capitalize() { + var self = this; + + return self.$$cast(self.charAt(0).toUpperCase() + self.substr(1).toLowerCase()); + }, TMP_String_capitalize_13.$$arity = 0); + + Opal.def(self, '$casecmp', TMP_String_casecmp_14 = function $$casecmp(other) { + var self = this; + + + if ($truthy(other['$respond_to?']("to_str"))) { + } else { + return nil + }; + other = $$($nesting, 'Opal').$coerce_to(other, $$($nesting, 'String'), "to_str").$to_s(); + + var ascii_only = /^[\x00-\x7F]*$/; + if (ascii_only.test(self) && ascii_only.test(other)) { + self = self.toLowerCase(); + other = other.toLowerCase(); + } + ; + return self['$<=>'](other); + }, TMP_String_casecmp_14.$$arity = 1); + + Opal.def(self, '$casecmp?', TMP_String_casecmp$q_15 = function(other) { + var self = this; + + + var cmp = self.$casecmp(other); + if (cmp === nil) { + return nil; + } else { + return cmp === 0; + } + + }, TMP_String_casecmp$q_15.$$arity = 1); + + Opal.def(self, '$center', TMP_String_center_16 = function $$center(width, padstr) { + var self = this; + + + + if (padstr == null) { + padstr = " "; + }; + width = $$($nesting, 'Opal').$coerce_to(width, $$($nesting, 'Integer'), "to_int"); + padstr = $$($nesting, 'Opal').$coerce_to(padstr, $$($nesting, 'String'), "to_str").$to_s(); + if ($truthy(padstr['$empty?']())) { + self.$raise($$($nesting, 'ArgumentError'), "zero width padding")}; + if ($truthy(width <= self.length)) { + return self}; + + var ljustified = self.$ljust($rb_divide($rb_plus(width, self.length), 2).$ceil(), padstr), + rjustified = self.$rjust($rb_divide($rb_plus(width, self.length), 2).$floor(), padstr); + + return self.$$cast(rjustified + ljustified.slice(self.length)); + ; + }, TMP_String_center_16.$$arity = -2); + + Opal.def(self, '$chars', TMP_String_chars_17 = function $$chars() { + var $iter = TMP_String_chars_17.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_String_chars_17.$$p = null; + + + if ($iter) TMP_String_chars_17.$$p = null;; + if ($truthy(block)) { + } else { + return self.$each_char().$to_a() + }; + return $send(self, 'each_char', [], block.$to_proc()); + }, TMP_String_chars_17.$$arity = 0); + + Opal.def(self, '$chomp', TMP_String_chomp_18 = function $$chomp(separator) { + var self = this; + if ($gvars["/"] == null) $gvars["/"] = nil; + + + + if (separator == null) { + separator = $gvars["/"]; + }; + if ($truthy(separator === nil || self.length === 0)) { + return self}; + separator = $$($nesting, 'Opal')['$coerce_to!'](separator, $$($nesting, 'String'), "to_str").$to_s(); + + var result; + + if (separator === "\n") { + result = self.replace(/\r?\n?$/, ''); + } + else if (separator === "") { + result = self.replace(/(\r?\n)+$/, ''); + } + else if (self.length > separator.length) { + var tail = self.substr(self.length - separator.length, separator.length); + + if (tail === separator) { + result = self.substr(0, self.length - separator.length); + } + } + + if (result != null) { + return self.$$cast(result); + } + ; + return self; + }, TMP_String_chomp_18.$$arity = -1); + + Opal.def(self, '$chop', TMP_String_chop_19 = function $$chop() { + var self = this; + + + var length = self.length, result; + + if (length <= 1) { + result = ""; + } else if (self.charAt(length - 1) === "\n" && self.charAt(length - 2) === "\r") { + result = self.substr(0, length - 2); + } else { + result = self.substr(0, length - 1); + } + + return self.$$cast(result); + + }, TMP_String_chop_19.$$arity = 0); + + Opal.def(self, '$chr', TMP_String_chr_20 = function $$chr() { + var self = this; + + return self.charAt(0); + }, TMP_String_chr_20.$$arity = 0); + + Opal.def(self, '$clone', TMP_String_clone_21 = function $$clone() { + var self = this, copy = nil; + + + copy = self.slice(); + copy.$copy_singleton_methods(self); + copy.$initialize_clone(self); + return copy; + }, TMP_String_clone_21.$$arity = 0); + + Opal.def(self, '$dup', TMP_String_dup_22 = function $$dup() { + var self = this, copy = nil; + + + copy = self.slice(); + copy.$initialize_dup(self); + return copy; + }, TMP_String_dup_22.$$arity = 0); + + Opal.def(self, '$count', TMP_String_count_23 = function $$count($a) { + var $post_args, sets, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + sets = $post_args;; + + if (sets.length === 0) { + self.$raise($$($nesting, 'ArgumentError'), "ArgumentError: wrong number of arguments (0 for 1+)") + } + var char_class = char_class_from_char_sets(sets); + if (char_class === null) { + return 0; + } + return self.length - self.replace(new RegExp(char_class, 'g'), '').length; + ; + }, TMP_String_count_23.$$arity = -1); + + Opal.def(self, '$delete', TMP_String_delete_24 = function($a) { + var $post_args, sets, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + sets = $post_args;; + + if (sets.length === 0) { + self.$raise($$($nesting, 'ArgumentError'), "ArgumentError: wrong number of arguments (0 for 1+)") + } + var char_class = char_class_from_char_sets(sets); + if (char_class === null) { + return self; + } + return self.$$cast(self.replace(new RegExp(char_class, 'g'), '')); + ; + }, TMP_String_delete_24.$$arity = -1); + + Opal.def(self, '$delete_prefix', TMP_String_delete_prefix_25 = function $$delete_prefix(prefix) { + var self = this; + + + if (!prefix.$$is_string) { + (prefix = $$($nesting, 'Opal').$coerce_to(prefix, $$($nesting, 'String'), "to_str")) + } + + if (self.slice(0, prefix.length) === prefix) { + return self.$$cast(self.slice(prefix.length)); + } else { + return self; + } + + }, TMP_String_delete_prefix_25.$$arity = 1); + + Opal.def(self, '$delete_suffix', TMP_String_delete_suffix_26 = function $$delete_suffix(suffix) { + var self = this; + + + if (!suffix.$$is_string) { + (suffix = $$($nesting, 'Opal').$coerce_to(suffix, $$($nesting, 'String'), "to_str")) + } + + if (self.slice(self.length - suffix.length) === suffix) { + return self.$$cast(self.slice(0, self.length - suffix.length)); + } else { + return self; + } + + }, TMP_String_delete_suffix_26.$$arity = 1); + + Opal.def(self, '$downcase', TMP_String_downcase_27 = function $$downcase() { + var self = this; + + return self.$$cast(self.toLowerCase()); + }, TMP_String_downcase_27.$$arity = 0); + + Opal.def(self, '$each_char', TMP_String_each_char_28 = function $$each_char() { + var $iter = TMP_String_each_char_28.$$p, block = $iter || nil, TMP_29, self = this; + + if ($iter) TMP_String_each_char_28.$$p = null; + + + if ($iter) TMP_String_each_char_28.$$p = null;; + if ((block !== nil)) { + } else { + return $send(self, 'enum_for', ["each_char"], (TMP_29 = function(){var self = TMP_29.$$s || this; + + return self.$size()}, TMP_29.$$s = self, TMP_29.$$arity = 0, TMP_29)) + }; + + for (var i = 0, length = self.length; i < length; i++) { + Opal.yield1(block, self.charAt(i)); + } + ; + return self; + }, TMP_String_each_char_28.$$arity = 0); + + Opal.def(self, '$each_line', TMP_String_each_line_30 = function $$each_line(separator) { + var $iter = TMP_String_each_line_30.$$p, block = $iter || nil, self = this; + if ($gvars["/"] == null) $gvars["/"] = nil; + + if ($iter) TMP_String_each_line_30.$$p = null; + + + if ($iter) TMP_String_each_line_30.$$p = null;; + + if (separator == null) { + separator = $gvars["/"]; + }; + if ((block !== nil)) { + } else { + return self.$enum_for("each_line", separator) + }; + + if (separator === nil) { + Opal.yield1(block, self); + + return self; + } + + separator = $$($nesting, 'Opal').$coerce_to(separator, $$($nesting, 'String'), "to_str") + + var a, i, n, length, chomped, trailing, splitted; + + if (separator.length === 0) { + for (a = self.split(/(\n{2,})/), i = 0, n = a.length; i < n; i += 2) { + if (a[i] || a[i + 1]) { + var value = (a[i] || "") + (a[i + 1] || ""); + Opal.yield1(block, self.$$cast(value)); + } + } + + return self; + } + + chomped = self.$chomp(separator); + trailing = self.length != chomped.length; + splitted = chomped.split(separator); + + for (i = 0, length = splitted.length; i < length; i++) { + if (i < length - 1 || trailing) { + Opal.yield1(block, self.$$cast(splitted[i] + separator)); + } + else { + Opal.yield1(block, self.$$cast(splitted[i])); + } + } + ; + return self; + }, TMP_String_each_line_30.$$arity = -1); + + Opal.def(self, '$empty?', TMP_String_empty$q_31 = function() { + var self = this; + + return self.length === 0; + }, TMP_String_empty$q_31.$$arity = 0); + + Opal.def(self, '$end_with?', TMP_String_end_with$q_32 = function($a) { + var $post_args, suffixes, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + suffixes = $post_args;; + + for (var i = 0, length = suffixes.length; i < length; i++) { + var suffix = $$($nesting, 'Opal').$coerce_to(suffixes[i], $$($nesting, 'String'), "to_str").$to_s(); + + if (self.length >= suffix.length && + self.substr(self.length - suffix.length, suffix.length) == suffix) { + return true; + } + } + ; + return false; + }, TMP_String_end_with$q_32.$$arity = -1); + Opal.alias(self, "equal?", "==="); + + Opal.def(self, '$gsub', TMP_String_gsub_33 = function $$gsub(pattern, replacement) { + var $iter = TMP_String_gsub_33.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_String_gsub_33.$$p = null; + + + if ($iter) TMP_String_gsub_33.$$p = null;; + ; + + if (replacement === undefined && block === nil) { + return self.$enum_for("gsub", pattern); + } + + var result = '', match_data = nil, index = 0, match, _replacement; + + if (pattern.$$is_regexp) { + pattern = Opal.global_multiline_regexp(pattern); + } else { + pattern = $$($nesting, 'Opal').$coerce_to(pattern, $$($nesting, 'String'), "to_str"); + pattern = new RegExp(pattern.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'), 'gm'); + } + + var lastIndex; + while (true) { + match = pattern.exec(self); + + if (match === null) { + ($gvars["~"] = nil) + result += self.slice(index); + break; + } + + match_data = $$($nesting, 'MatchData').$new(pattern, match); + + if (replacement === undefined) { + lastIndex = pattern.lastIndex; + _replacement = block(match[0]); + pattern.lastIndex = lastIndex; // save and restore lastIndex + } + else if (replacement.$$is_hash) { + _replacement = (replacement)['$[]'](match[0]).$to_s(); + } + else { + if (!replacement.$$is_string) { + replacement = $$($nesting, 'Opal').$coerce_to(replacement, $$($nesting, 'String'), "to_str"); + } + _replacement = replacement.replace(/([\\]+)([0-9+&`'])/g, function (original, slashes, command) { + if (slashes.length % 2 === 0) { + return original; + } + switch (command) { + case "+": + for (var i = match.length - 1; i > 0; i--) { + if (match[i] !== undefined) { + return slashes.slice(1) + match[i]; + } + } + return ''; + case "&": return slashes.slice(1) + match[0]; + case "`": return slashes.slice(1) + self.slice(0, match.index); + case "'": return slashes.slice(1) + self.slice(match.index + match[0].length); + default: return slashes.slice(1) + (match[command] || ''); + } + }).replace(/\\\\/g, '\\'); + } + + if (pattern.lastIndex === match.index) { + result += (_replacement + self.slice(index, match.index + 1)) + pattern.lastIndex += 1; + } + else { + result += (self.slice(index, match.index) + _replacement) + } + index = pattern.lastIndex; + } + + ($gvars["~"] = match_data) + return self.$$cast(result); + ; + }, TMP_String_gsub_33.$$arity = -2); + + Opal.def(self, '$hash', TMP_String_hash_34 = function $$hash() { + var self = this; + + return self.toString(); + }, TMP_String_hash_34.$$arity = 0); + + Opal.def(self, '$hex', TMP_String_hex_35 = function $$hex() { + var self = this; + + return self.$to_i(16) + }, TMP_String_hex_35.$$arity = 0); + + Opal.def(self, '$include?', TMP_String_include$q_36 = function(other) { + var self = this; + + + if (!other.$$is_string) { + (other = $$($nesting, 'Opal').$coerce_to(other, $$($nesting, 'String'), "to_str")) + } + return self.indexOf(other) !== -1; + + }, TMP_String_include$q_36.$$arity = 1); + + Opal.def(self, '$index', TMP_String_index_37 = function $$index(search, offset) { + var self = this; + + + ; + + var index, + match, + regex; + + if (offset === undefined) { + offset = 0; + } else { + offset = $$($nesting, 'Opal').$coerce_to(offset, $$($nesting, 'Integer'), "to_int"); + if (offset < 0) { + offset += self.length; + if (offset < 0) { + return nil; + } + } + } + + if (search.$$is_regexp) { + regex = Opal.global_multiline_regexp(search); + while (true) { + match = regex.exec(self); + if (match === null) { + ($gvars["~"] = nil); + index = -1; + break; + } + if (match.index >= offset) { + ($gvars["~"] = $$($nesting, 'MatchData').$new(regex, match)) + index = match.index; + break; + } + regex.lastIndex = match.index + 1; + } + } else { + search = $$($nesting, 'Opal').$coerce_to(search, $$($nesting, 'String'), "to_str"); + if (search.length === 0 && offset > self.length) { + index = -1; + } else { + index = self.indexOf(search, offset); + } + } + + return index === -1 ? nil : index; + ; + }, TMP_String_index_37.$$arity = -2); + + Opal.def(self, '$inspect', TMP_String_inspect_38 = function $$inspect() { + var self = this; + + + var escapable = /[\\\"\x00-\x1f\u007F-\u009F\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, + meta = { + '\u0007': '\\a', + '\u001b': '\\e', + '\b': '\\b', + '\t': '\\t', + '\n': '\\n', + '\f': '\\f', + '\r': '\\r', + '\v': '\\v', + '"' : '\\"', + '\\': '\\\\' + }, + escaped = self.replace(escapable, function (chr) { + return meta[chr] || '\\u' + ('0000' + chr.charCodeAt(0).toString(16).toUpperCase()).slice(-4); + }); + return '"' + escaped.replace(/\#[\$\@\{]/g, '\\$&') + '"'; + + }, TMP_String_inspect_38.$$arity = 0); + + Opal.def(self, '$intern', TMP_String_intern_39 = function $$intern() { + var self = this; + + return self.toString(); + }, TMP_String_intern_39.$$arity = 0); + + Opal.def(self, '$lines', TMP_String_lines_40 = function $$lines(separator) { + var $iter = TMP_String_lines_40.$$p, block = $iter || nil, self = this, e = nil; + if ($gvars["/"] == null) $gvars["/"] = nil; + + if ($iter) TMP_String_lines_40.$$p = null; + + + if ($iter) TMP_String_lines_40.$$p = null;; + + if (separator == null) { + separator = $gvars["/"]; + }; + e = $send(self, 'each_line', [separator], block.$to_proc()); + if ($truthy(block)) { + return self + } else { + return e.$to_a() + }; + }, TMP_String_lines_40.$$arity = -1); + + Opal.def(self, '$length', TMP_String_length_41 = function $$length() { + var self = this; + + return self.length; + }, TMP_String_length_41.$$arity = 0); + + Opal.def(self, '$ljust', TMP_String_ljust_42 = function $$ljust(width, padstr) { + var self = this; + + + + if (padstr == null) { + padstr = " "; + }; + width = $$($nesting, 'Opal').$coerce_to(width, $$($nesting, 'Integer'), "to_int"); + padstr = $$($nesting, 'Opal').$coerce_to(padstr, $$($nesting, 'String'), "to_str").$to_s(); + if ($truthy(padstr['$empty?']())) { + self.$raise($$($nesting, 'ArgumentError'), "zero width padding")}; + if ($truthy(width <= self.length)) { + return self}; + + var index = -1, + result = ""; + + width -= self.length; + + while (++index < width) { + result += padstr; + } + + return self.$$cast(self + result.slice(0, width)); + ; + }, TMP_String_ljust_42.$$arity = -2); + + Opal.def(self, '$lstrip', TMP_String_lstrip_43 = function $$lstrip() { + var self = this; + + return self.replace(/^\s*/, ''); + }, TMP_String_lstrip_43.$$arity = 0); + + Opal.def(self, '$ascii_only?', TMP_String_ascii_only$q_44 = function() { + var self = this; + + return self.match(/[ -~\n]*/)[0] === self; + }, TMP_String_ascii_only$q_44.$$arity = 0); + + Opal.def(self, '$match', TMP_String_match_45 = function $$match(pattern, pos) { + var $iter = TMP_String_match_45.$$p, block = $iter || nil, $a, self = this; + + if ($iter) TMP_String_match_45.$$p = null; + + + if ($iter) TMP_String_match_45.$$p = null;; + ; + if ($truthy(($truthy($a = $$($nesting, 'String')['$==='](pattern)) ? $a : pattern['$respond_to?']("to_str")))) { + pattern = $$($nesting, 'Regexp').$new(pattern.$to_str())}; + if ($truthy($$($nesting, 'Regexp')['$==='](pattern))) { + } else { + self.$raise($$($nesting, 'TypeError'), "" + "wrong argument type " + (pattern.$class()) + " (expected Regexp)") + }; + return $send(pattern, 'match', [self, pos], block.$to_proc()); + }, TMP_String_match_45.$$arity = -2); + + Opal.def(self, '$match?', TMP_String_match$q_46 = function(pattern, pos) { + var $a, self = this; + + + ; + if ($truthy(($truthy($a = $$($nesting, 'String')['$==='](pattern)) ? $a : pattern['$respond_to?']("to_str")))) { + pattern = $$($nesting, 'Regexp').$new(pattern.$to_str())}; + if ($truthy($$($nesting, 'Regexp')['$==='](pattern))) { + } else { + self.$raise($$($nesting, 'TypeError'), "" + "wrong argument type " + (pattern.$class()) + " (expected Regexp)") + }; + return pattern['$match?'](self, pos); + }, TMP_String_match$q_46.$$arity = -2); + + Opal.def(self, '$next', TMP_String_next_47 = function $$next() { + var self = this; + + + var i = self.length; + if (i === 0) { + return self.$$cast(''); + } + var result = self; + var first_alphanum_char_index = self.search(/[a-zA-Z0-9]/); + var carry = false; + var code; + while (i--) { + code = self.charCodeAt(i); + if ((code >= 48 && code <= 57) || + (code >= 65 && code <= 90) || + (code >= 97 && code <= 122)) { + switch (code) { + case 57: + carry = true; + code = 48; + break; + case 90: + carry = true; + code = 65; + break; + case 122: + carry = true; + code = 97; + break; + default: + carry = false; + code += 1; + } + } else { + if (first_alphanum_char_index === -1) { + if (code === 255) { + carry = true; + code = 0; + } else { + carry = false; + code += 1; + } + } else { + carry = true; + } + } + result = result.slice(0, i) + String.fromCharCode(code) + result.slice(i + 1); + if (carry && (i === 0 || i === first_alphanum_char_index)) { + switch (code) { + case 65: + break; + case 97: + break; + default: + code += 1; + } + if (i === 0) { + result = String.fromCharCode(code) + result; + } else { + result = result.slice(0, i) + String.fromCharCode(code) + result.slice(i); + } + carry = false; + } + if (!carry) { + break; + } + } + return self.$$cast(result); + + }, TMP_String_next_47.$$arity = 0); + + Opal.def(self, '$oct', TMP_String_oct_48 = function $$oct() { + var self = this; + + + var result, + string = self, + radix = 8; + + if (/^\s*_/.test(string)) { + return 0; + } + + string = string.replace(/^(\s*[+-]?)(0[bodx]?)(.+)$/i, function (original, head, flag, tail) { + switch (tail.charAt(0)) { + case '+': + case '-': + return original; + case '0': + if (tail.charAt(1) === 'x' && flag === '0x') { + return original; + } + } + switch (flag) { + case '0b': + radix = 2; + break; + case '0': + case '0o': + radix = 8; + break; + case '0d': + radix = 10; + break; + case '0x': + radix = 16; + break; + } + return head + tail; + }); + + result = parseInt(string.replace(/_(?!_)/g, ''), radix); + return isNaN(result) ? 0 : result; + + }, TMP_String_oct_48.$$arity = 0); + + Opal.def(self, '$ord', TMP_String_ord_49 = function $$ord() { + var self = this; + + return self.charCodeAt(0); + }, TMP_String_ord_49.$$arity = 0); + + Opal.def(self, '$partition', TMP_String_partition_50 = function $$partition(sep) { + var self = this; + + + var i, m; + + if (sep.$$is_regexp) { + m = sep.exec(self); + if (m === null) { + i = -1; + } else { + $$($nesting, 'MatchData').$new(sep, m); + sep = m[0]; + i = m.index; + } + } else { + sep = $$($nesting, 'Opal').$coerce_to(sep, $$($nesting, 'String'), "to_str"); + i = self.indexOf(sep); + } + + if (i === -1) { + return [self, '', '']; + } + + return [ + self.slice(0, i), + self.slice(i, i + sep.length), + self.slice(i + sep.length) + ]; + + }, TMP_String_partition_50.$$arity = 1); + + Opal.def(self, '$reverse', TMP_String_reverse_51 = function $$reverse() { + var self = this; + + return self.split('').reverse().join(''); + }, TMP_String_reverse_51.$$arity = 0); + + Opal.def(self, '$rindex', TMP_String_rindex_52 = function $$rindex(search, offset) { + var self = this; + + + ; + + var i, m, r, _m; + + if (offset === undefined) { + offset = self.length; + } else { + offset = $$($nesting, 'Opal').$coerce_to(offset, $$($nesting, 'Integer'), "to_int"); + if (offset < 0) { + offset += self.length; + if (offset < 0) { + return nil; + } + } + } + + if (search.$$is_regexp) { + m = null; + r = Opal.global_multiline_regexp(search); + while (true) { + _m = r.exec(self); + if (_m === null || _m.index > offset) { + break; + } + m = _m; + r.lastIndex = m.index + 1; + } + if (m === null) { + ($gvars["~"] = nil) + i = -1; + } else { + $$($nesting, 'MatchData').$new(r, m); + i = m.index; + } + } else { + search = $$($nesting, 'Opal').$coerce_to(search, $$($nesting, 'String'), "to_str"); + i = self.lastIndexOf(search, offset); + } + + return i === -1 ? nil : i; + ; + }, TMP_String_rindex_52.$$arity = -2); + + Opal.def(self, '$rjust', TMP_String_rjust_53 = function $$rjust(width, padstr) { + var self = this; + + + + if (padstr == null) { + padstr = " "; + }; + width = $$($nesting, 'Opal').$coerce_to(width, $$($nesting, 'Integer'), "to_int"); + padstr = $$($nesting, 'Opal').$coerce_to(padstr, $$($nesting, 'String'), "to_str").$to_s(); + if ($truthy(padstr['$empty?']())) { + self.$raise($$($nesting, 'ArgumentError'), "zero width padding")}; + if ($truthy(width <= self.length)) { + return self}; + + var chars = Math.floor(width - self.length), + patterns = Math.floor(chars / padstr.length), + result = Array(patterns + 1).join(padstr), + remaining = chars - result.length; + + return self.$$cast(result + padstr.slice(0, remaining) + self); + ; + }, TMP_String_rjust_53.$$arity = -2); + + Opal.def(self, '$rpartition', TMP_String_rpartition_54 = function $$rpartition(sep) { + var self = this; + + + var i, m, r, _m; + + if (sep.$$is_regexp) { + m = null; + r = Opal.global_multiline_regexp(sep); + + while (true) { + _m = r.exec(self); + if (_m === null) { + break; + } + m = _m; + r.lastIndex = m.index + 1; + } + + if (m === null) { + i = -1; + } else { + $$($nesting, 'MatchData').$new(r, m); + sep = m[0]; + i = m.index; + } + + } else { + sep = $$($nesting, 'Opal').$coerce_to(sep, $$($nesting, 'String'), "to_str"); + i = self.lastIndexOf(sep); + } + + if (i === -1) { + return ['', '', self]; + } + + return [ + self.slice(0, i), + self.slice(i, i + sep.length), + self.slice(i + sep.length) + ]; + + }, TMP_String_rpartition_54.$$arity = 1); + + Opal.def(self, '$rstrip', TMP_String_rstrip_55 = function $$rstrip() { + var self = this; + + return self.replace(/[\s\u0000]*$/, ''); + }, TMP_String_rstrip_55.$$arity = 0); + + Opal.def(self, '$scan', TMP_String_scan_56 = function $$scan(pattern) { + var $iter = TMP_String_scan_56.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_String_scan_56.$$p = null; + + + if ($iter) TMP_String_scan_56.$$p = null;; + + var result = [], + match_data = nil, + match; + + if (pattern.$$is_regexp) { + pattern = Opal.global_multiline_regexp(pattern); + } else { + pattern = $$($nesting, 'Opal').$coerce_to(pattern, $$($nesting, 'String'), "to_str"); + pattern = new RegExp(pattern.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'), 'gm'); + } + + while ((match = pattern.exec(self)) != null) { + match_data = $$($nesting, 'MatchData').$new(pattern, match); + if (block === nil) { + match.length == 1 ? result.push(match[0]) : result.push((match_data).$captures()); + } else { + match.length == 1 ? block(match[0]) : block.call(self, (match_data).$captures()); + } + if (pattern.lastIndex === match.index) { + pattern.lastIndex += 1; + } + } + + ($gvars["~"] = match_data) + + return (block !== nil ? self : result); + ; + }, TMP_String_scan_56.$$arity = 1); + Opal.alias(self, "size", "length"); + Opal.alias(self, "slice", "[]"); + + Opal.def(self, '$split', TMP_String_split_57 = function $$split(pattern, limit) { + var $a, self = this; + if ($gvars[";"] == null) $gvars[";"] = nil; + + + ; + ; + + if (self.length === 0) { + return []; + } + + if (limit === undefined) { + limit = 0; + } else { + limit = $$($nesting, 'Opal')['$coerce_to!'](limit, $$($nesting, 'Integer'), "to_int"); + if (limit === 1) { + return [self]; + } + } + + if (pattern === undefined || pattern === nil) { + pattern = ($truthy($a = $gvars[";"]) ? $a : " "); + } + + var result = [], + string = self.toString(), + index = 0, + match, + i, ii; + + if (pattern.$$is_regexp) { + pattern = Opal.global_multiline_regexp(pattern); + } else { + pattern = $$($nesting, 'Opal').$coerce_to(pattern, $$($nesting, 'String'), "to_str").$to_s(); + if (pattern === ' ') { + pattern = /\s+/gm; + string = string.replace(/^\s+/, ''); + } else { + pattern = new RegExp(pattern.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'), 'gm'); + } + } + + result = string.split(pattern); + + if (result.length === 1 && result[0] === string) { + return [self.$$cast(result[0])]; + } + + while ((i = result.indexOf(undefined)) !== -1) { + result.splice(i, 1); + } + + function castResult() { + for (i = 0; i < result.length; i++) { + result[i] = self.$$cast(result[i]); + } + } + + if (limit === 0) { + while (result[result.length - 1] === '') { + result.length -= 1; + } + castResult(); + return result; + } + + match = pattern.exec(string); + + if (limit < 0) { + if (match !== null && match[0] === '' && pattern.source.indexOf('(?=') === -1) { + for (i = 0, ii = match.length; i < ii; i++) { + result.push(''); + } + } + castResult(); + return result; + } + + if (match !== null && match[0] === '') { + result.splice(limit - 1, result.length - 1, result.slice(limit - 1).join('')); + castResult(); + return result; + } + + if (limit >= result.length) { + castResult(); + return result; + } + + i = 0; + while (match !== null) { + i++; + index = pattern.lastIndex; + if (i + 1 === limit) { + break; + } + match = pattern.exec(string); + } + result.splice(limit - 1, result.length - 1, string.slice(index)); + castResult(); + return result; + ; + }, TMP_String_split_57.$$arity = -1); + + Opal.def(self, '$squeeze', TMP_String_squeeze_58 = function $$squeeze($a) { + var $post_args, sets, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + sets = $post_args;; + + if (sets.length === 0) { + return self.$$cast(self.replace(/(.)\1+/g, '$1')); + } + var char_class = char_class_from_char_sets(sets); + if (char_class === null) { + return self; + } + return self.$$cast(self.replace(new RegExp('(' + char_class + ')\\1+', 'g'), '$1')); + ; + }, TMP_String_squeeze_58.$$arity = -1); + + Opal.def(self, '$start_with?', TMP_String_start_with$q_59 = function($a) { + var $post_args, prefixes, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + prefixes = $post_args;; + + for (var i = 0, length = prefixes.length; i < length; i++) { + var prefix = $$($nesting, 'Opal').$coerce_to(prefixes[i], $$($nesting, 'String'), "to_str").$to_s(); + + if (self.indexOf(prefix) === 0) { + return true; + } + } + + return false; + ; + }, TMP_String_start_with$q_59.$$arity = -1); + + Opal.def(self, '$strip', TMP_String_strip_60 = function $$strip() { + var self = this; + + return self.replace(/^\s*/, '').replace(/[\s\u0000]*$/, ''); + }, TMP_String_strip_60.$$arity = 0); + + Opal.def(self, '$sub', TMP_String_sub_61 = function $$sub(pattern, replacement) { + var $iter = TMP_String_sub_61.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_String_sub_61.$$p = null; + + + if ($iter) TMP_String_sub_61.$$p = null;; + ; + + if (!pattern.$$is_regexp) { + pattern = $$($nesting, 'Opal').$coerce_to(pattern, $$($nesting, 'String'), "to_str"); + pattern = new RegExp(pattern.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')); + } + + var result, match = pattern.exec(self); + + if (match === null) { + ($gvars["~"] = nil) + result = self.toString(); + } else { + $$($nesting, 'MatchData').$new(pattern, match) + + if (replacement === undefined) { + + if (block === nil) { + self.$raise($$($nesting, 'ArgumentError'), "wrong number of arguments (1 for 2)") + } + result = self.slice(0, match.index) + block(match[0]) + self.slice(match.index + match[0].length); + + } else if (replacement.$$is_hash) { + + result = self.slice(0, match.index) + (replacement)['$[]'](match[0]).$to_s() + self.slice(match.index + match[0].length); + + } else { + + replacement = $$($nesting, 'Opal').$coerce_to(replacement, $$($nesting, 'String'), "to_str"); + + replacement = replacement.replace(/([\\]+)([0-9+&`'])/g, function (original, slashes, command) { + if (slashes.length % 2 === 0) { + return original; + } + switch (command) { + case "+": + for (var i = match.length - 1; i > 0; i--) { + if (match[i] !== undefined) { + return slashes.slice(1) + match[i]; + } + } + return ''; + case "&": return slashes.slice(1) + match[0]; + case "`": return slashes.slice(1) + self.slice(0, match.index); + case "'": return slashes.slice(1) + self.slice(match.index + match[0].length); + default: return slashes.slice(1) + (match[command] || ''); + } + }).replace(/\\\\/g, '\\'); + + result = self.slice(0, match.index) + replacement + self.slice(match.index + match[0].length); + } + } + + return self.$$cast(result); + ; + }, TMP_String_sub_61.$$arity = -2); + Opal.alias(self, "succ", "next"); + + Opal.def(self, '$sum', TMP_String_sum_62 = function $$sum(n) { + var self = this; + + + + if (n == null) { + n = 16; + }; + + n = $$($nesting, 'Opal').$coerce_to(n, $$($nesting, 'Integer'), "to_int"); + + var result = 0, + length = self.length, + i = 0; + + for (; i < length; i++) { + result += self.charCodeAt(i); + } + + if (n <= 0) { + return result; + } + + return result & (Math.pow(2, n) - 1); + ; + }, TMP_String_sum_62.$$arity = -1); + + Opal.def(self, '$swapcase', TMP_String_swapcase_63 = function $$swapcase() { + var self = this; + + + var str = self.replace(/([a-z]+)|([A-Z]+)/g, function($0,$1,$2) { + return $1 ? $0.toUpperCase() : $0.toLowerCase(); + }); + + if (self.constructor === String) { + return str; + } + + return self.$class().$new(str); + + }, TMP_String_swapcase_63.$$arity = 0); + + Opal.def(self, '$to_f', TMP_String_to_f_64 = function $$to_f() { + var self = this; + + + if (self.charAt(0) === '_') { + return 0; + } + + var result = parseFloat(self.replace(/_/g, '')); + + if (isNaN(result) || result == Infinity || result == -Infinity) { + return 0; + } + else { + return result; + } + + }, TMP_String_to_f_64.$$arity = 0); + + Opal.def(self, '$to_i', TMP_String_to_i_65 = function $$to_i(base) { + var self = this; + + + + if (base == null) { + base = 10; + }; + + var result, + string = self.toLowerCase(), + radix = $$($nesting, 'Opal').$coerce_to(base, $$($nesting, 'Integer'), "to_int"); + + if (radix === 1 || radix < 0 || radix > 36) { + self.$raise($$($nesting, 'ArgumentError'), "" + "invalid radix " + (radix)) + } + + if (/^\s*_/.test(string)) { + return 0; + } + + string = string.replace(/^(\s*[+-]?)(0[bodx]?)(.+)$/, function (original, head, flag, tail) { + switch (tail.charAt(0)) { + case '+': + case '-': + return original; + case '0': + if (tail.charAt(1) === 'x' && flag === '0x' && (radix === 0 || radix === 16)) { + return original; + } + } + switch (flag) { + case '0b': + if (radix === 0 || radix === 2) { + radix = 2; + return head + tail; + } + break; + case '0': + case '0o': + if (radix === 0 || radix === 8) { + radix = 8; + return head + tail; + } + break; + case '0d': + if (radix === 0 || radix === 10) { + radix = 10; + return head + tail; + } + break; + case '0x': + if (radix === 0 || radix === 16) { + radix = 16; + return head + tail; + } + break; + } + return original + }); + + result = parseInt(string.replace(/_(?!_)/g, ''), radix); + return isNaN(result) ? 0 : result; + ; + }, TMP_String_to_i_65.$$arity = -1); + + Opal.def(self, '$to_proc', TMP_String_to_proc_66 = function $$to_proc() { + var TMP_67, $iter = TMP_String_to_proc_66.$$p, $yield = $iter || nil, self = this, method_name = nil; + + if ($iter) TMP_String_to_proc_66.$$p = null; + + method_name = $rb_plus("$", self.valueOf()); + return $send(self, 'proc', [], (TMP_67 = function($a){var self = TMP_67.$$s || this, $iter = TMP_67.$$p, block = $iter || nil, $post_args, args; + + + + if ($iter) TMP_67.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + + if (args.length === 0) { + self.$raise($$($nesting, 'ArgumentError'), "no receiver given") + } + + var recv = args[0]; + + if (recv == null) recv = nil; + + var body = recv[method_name]; + + if (!body) { + return recv.$method_missing.apply(recv, args); + } + + if (typeof block === 'function') { + body.$$p = block; + } + + if (args.length === 1) { + return body.call(recv); + } else { + return body.apply(recv, args.slice(1)); + } + ;}, TMP_67.$$s = self, TMP_67.$$arity = -1, TMP_67)); + }, TMP_String_to_proc_66.$$arity = 0); + + Opal.def(self, '$to_s', TMP_String_to_s_68 = function $$to_s() { + var self = this; + + return self.toString(); + }, TMP_String_to_s_68.$$arity = 0); + Opal.alias(self, "to_str", "to_s"); + Opal.alias(self, "to_sym", "intern"); + + Opal.def(self, '$tr', TMP_String_tr_69 = function $$tr(from, to) { + var self = this; + + + from = $$($nesting, 'Opal').$coerce_to(from, $$($nesting, 'String'), "to_str").$to_s(); + to = $$($nesting, 'Opal').$coerce_to(to, $$($nesting, 'String'), "to_str").$to_s(); + + if (from.length == 0 || from === to) { + return self; + } + + var i, in_range, c, ch, start, end, length; + var subs = {}; + var from_chars = from.split(''); + var from_length = from_chars.length; + var to_chars = to.split(''); + var to_length = to_chars.length; + + var inverse = false; + var global_sub = null; + if (from_chars[0] === '^' && from_chars.length > 1) { + inverse = true; + from_chars.shift(); + global_sub = to_chars[to_length - 1] + from_length -= 1; + } + + var from_chars_expanded = []; + var last_from = null; + in_range = false; + for (i = 0; i < from_length; i++) { + ch = from_chars[i]; + if (last_from == null) { + last_from = ch; + from_chars_expanded.push(ch); + } + else if (ch === '-') { + if (last_from === '-') { + from_chars_expanded.push('-'); + from_chars_expanded.push('-'); + } + else if (i == from_length - 1) { + from_chars_expanded.push('-'); + } + else { + in_range = true; + } + } + else if (in_range) { + start = last_from.charCodeAt(0); + end = ch.charCodeAt(0); + if (start > end) { + self.$raise($$($nesting, 'ArgumentError'), "" + "invalid range \"" + (String.fromCharCode(start)) + "-" + (String.fromCharCode(end)) + "\" in string transliteration") + } + for (c = start + 1; c < end; c++) { + from_chars_expanded.push(String.fromCharCode(c)); + } + from_chars_expanded.push(ch); + in_range = null; + last_from = null; + } + else { + from_chars_expanded.push(ch); + } + } + + from_chars = from_chars_expanded; + from_length = from_chars.length; + + if (inverse) { + for (i = 0; i < from_length; i++) { + subs[from_chars[i]] = true; + } + } + else { + if (to_length > 0) { + var to_chars_expanded = []; + var last_to = null; + in_range = false; + for (i = 0; i < to_length; i++) { + ch = to_chars[i]; + if (last_to == null) { + last_to = ch; + to_chars_expanded.push(ch); + } + else if (ch === '-') { + if (last_to === '-') { + to_chars_expanded.push('-'); + to_chars_expanded.push('-'); + } + else if (i == to_length - 1) { + to_chars_expanded.push('-'); + } + else { + in_range = true; + } + } + else if (in_range) { + start = last_to.charCodeAt(0); + end = ch.charCodeAt(0); + if (start > end) { + self.$raise($$($nesting, 'ArgumentError'), "" + "invalid range \"" + (String.fromCharCode(start)) + "-" + (String.fromCharCode(end)) + "\" in string transliteration") + } + for (c = start + 1; c < end; c++) { + to_chars_expanded.push(String.fromCharCode(c)); + } + to_chars_expanded.push(ch); + in_range = null; + last_to = null; + } + else { + to_chars_expanded.push(ch); + } + } + + to_chars = to_chars_expanded; + to_length = to_chars.length; + } + + var length_diff = from_length - to_length; + if (length_diff > 0) { + var pad_char = (to_length > 0 ? to_chars[to_length - 1] : ''); + for (i = 0; i < length_diff; i++) { + to_chars.push(pad_char); + } + } + + for (i = 0; i < from_length; i++) { + subs[from_chars[i]] = to_chars[i]; + } + } + + var new_str = '' + for (i = 0, length = self.length; i < length; i++) { + ch = self.charAt(i); + var sub = subs[ch]; + if (inverse) { + new_str += (sub == null ? global_sub : ch); + } + else { + new_str += (sub != null ? sub : ch); + } + } + return self.$$cast(new_str); + ; + }, TMP_String_tr_69.$$arity = 2); + + Opal.def(self, '$tr_s', TMP_String_tr_s_70 = function $$tr_s(from, to) { + var self = this; + + + from = $$($nesting, 'Opal').$coerce_to(from, $$($nesting, 'String'), "to_str").$to_s(); + to = $$($nesting, 'Opal').$coerce_to(to, $$($nesting, 'String'), "to_str").$to_s(); + + if (from.length == 0) { + return self; + } + + var i, in_range, c, ch, start, end, length; + var subs = {}; + var from_chars = from.split(''); + var from_length = from_chars.length; + var to_chars = to.split(''); + var to_length = to_chars.length; + + var inverse = false; + var global_sub = null; + if (from_chars[0] === '^' && from_chars.length > 1) { + inverse = true; + from_chars.shift(); + global_sub = to_chars[to_length - 1] + from_length -= 1; + } + + var from_chars_expanded = []; + var last_from = null; + in_range = false; + for (i = 0; i < from_length; i++) { + ch = from_chars[i]; + if (last_from == null) { + last_from = ch; + from_chars_expanded.push(ch); + } + else if (ch === '-') { + if (last_from === '-') { + from_chars_expanded.push('-'); + from_chars_expanded.push('-'); + } + else if (i == from_length - 1) { + from_chars_expanded.push('-'); + } + else { + in_range = true; + } + } + else if (in_range) { + start = last_from.charCodeAt(0); + end = ch.charCodeAt(0); + if (start > end) { + self.$raise($$($nesting, 'ArgumentError'), "" + "invalid range \"" + (String.fromCharCode(start)) + "-" + (String.fromCharCode(end)) + "\" in string transliteration") + } + for (c = start + 1; c < end; c++) { + from_chars_expanded.push(String.fromCharCode(c)); + } + from_chars_expanded.push(ch); + in_range = null; + last_from = null; + } + else { + from_chars_expanded.push(ch); + } + } + + from_chars = from_chars_expanded; + from_length = from_chars.length; + + if (inverse) { + for (i = 0; i < from_length; i++) { + subs[from_chars[i]] = true; + } + } + else { + if (to_length > 0) { + var to_chars_expanded = []; + var last_to = null; + in_range = false; + for (i = 0; i < to_length; i++) { + ch = to_chars[i]; + if (last_from == null) { + last_from = ch; + to_chars_expanded.push(ch); + } + else if (ch === '-') { + if (last_to === '-') { + to_chars_expanded.push('-'); + to_chars_expanded.push('-'); + } + else if (i == to_length - 1) { + to_chars_expanded.push('-'); + } + else { + in_range = true; + } + } + else if (in_range) { + start = last_from.charCodeAt(0); + end = ch.charCodeAt(0); + if (start > end) { + self.$raise($$($nesting, 'ArgumentError'), "" + "invalid range \"" + (String.fromCharCode(start)) + "-" + (String.fromCharCode(end)) + "\" in string transliteration") + } + for (c = start + 1; c < end; c++) { + to_chars_expanded.push(String.fromCharCode(c)); + } + to_chars_expanded.push(ch); + in_range = null; + last_from = null; + } + else { + to_chars_expanded.push(ch); + } + } + + to_chars = to_chars_expanded; + to_length = to_chars.length; + } + + var length_diff = from_length - to_length; + if (length_diff > 0) { + var pad_char = (to_length > 0 ? to_chars[to_length - 1] : ''); + for (i = 0; i < length_diff; i++) { + to_chars.push(pad_char); + } + } + + for (i = 0; i < from_length; i++) { + subs[from_chars[i]] = to_chars[i]; + } + } + var new_str = '' + var last_substitute = null + for (i = 0, length = self.length; i < length; i++) { + ch = self.charAt(i); + var sub = subs[ch] + if (inverse) { + if (sub == null) { + if (last_substitute == null) { + new_str += global_sub; + last_substitute = true; + } + } + else { + new_str += ch; + last_substitute = null; + } + } + else { + if (sub != null) { + if (last_substitute == null || last_substitute !== sub) { + new_str += sub; + last_substitute = sub; + } + } + else { + new_str += ch; + last_substitute = null; + } + } + } + return self.$$cast(new_str); + ; + }, TMP_String_tr_s_70.$$arity = 2); + + Opal.def(self, '$upcase', TMP_String_upcase_71 = function $$upcase() { + var self = this; + + return self.$$cast(self.toUpperCase()); + }, TMP_String_upcase_71.$$arity = 0); + + Opal.def(self, '$upto', TMP_String_upto_72 = function $$upto(stop, excl) { + var $iter = TMP_String_upto_72.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_String_upto_72.$$p = null; + + + if ($iter) TMP_String_upto_72.$$p = null;; + + if (excl == null) { + excl = false; + }; + if ((block !== nil)) { + } else { + return self.$enum_for("upto", stop, excl) + }; + stop = $$($nesting, 'Opal').$coerce_to(stop, $$($nesting, 'String'), "to_str"); + + var a, b, s = self.toString(); + + if (s.length === 1 && stop.length === 1) { + + a = s.charCodeAt(0); + b = stop.charCodeAt(0); + + while (a <= b) { + if (excl && a === b) { + break; + } + + block(String.fromCharCode(a)); + + a += 1; + } + + } else if (parseInt(s, 10).toString() === s && parseInt(stop, 10).toString() === stop) { + + a = parseInt(s, 10); + b = parseInt(stop, 10); + + while (a <= b) { + if (excl && a === b) { + break; + } + + block(a.toString()); + + a += 1; + } + + } else { + + while (s.length <= stop.length && s <= stop) { + if (excl && s === stop) { + break; + } + + block(s); + + s = (s).$succ(); + } + + } + return self; + ; + }, TMP_String_upto_72.$$arity = -2); + + function char_class_from_char_sets(sets) { + function explode_sequences_in_character_set(set) { + var result = '', + i, len = set.length, + curr_char, + skip_next_dash, + char_code_from, + char_code_upto, + char_code; + for (i = 0; i < len; i++) { + curr_char = set.charAt(i); + if (curr_char === '-' && i > 0 && i < (len - 1) && !skip_next_dash) { + char_code_from = set.charCodeAt(i - 1); + char_code_upto = set.charCodeAt(i + 1); + if (char_code_from > char_code_upto) { + self.$raise($$($nesting, 'ArgumentError'), "" + "invalid range \"" + (char_code_from) + "-" + (char_code_upto) + "\" in string transliteration") + } + for (char_code = char_code_from + 1; char_code < char_code_upto + 1; char_code++) { + result += String.fromCharCode(char_code); + } + skip_next_dash = true; + i++; + } else { + skip_next_dash = (curr_char === '\\'); + result += curr_char; + } + } + return result; + } + + function intersection(setA, setB) { + if (setA.length === 0) { + return setB; + } + var result = '', + i, len = setA.length, + chr; + for (i = 0; i < len; i++) { + chr = setA.charAt(i); + if (setB.indexOf(chr) !== -1) { + result += chr; + } + } + return result; + } + + var i, len, set, neg, chr, tmp, + pos_intersection = '', + neg_intersection = ''; + + for (i = 0, len = sets.length; i < len; i++) { + set = $$($nesting, 'Opal').$coerce_to(sets[i], $$($nesting, 'String'), "to_str"); + neg = (set.charAt(0) === '^' && set.length > 1); + set = explode_sequences_in_character_set(neg ? set.slice(1) : set); + if (neg) { + neg_intersection = intersection(neg_intersection, set); + } else { + pos_intersection = intersection(pos_intersection, set); + } + } + + if (pos_intersection.length > 0 && neg_intersection.length > 0) { + tmp = ''; + for (i = 0, len = pos_intersection.length; i < len; i++) { + chr = pos_intersection.charAt(i); + if (neg_intersection.indexOf(chr) === -1) { + tmp += chr; + } + } + pos_intersection = tmp; + neg_intersection = ''; + } + + if (pos_intersection.length > 0) { + return '[' + $$($nesting, 'Regexp').$escape(pos_intersection) + ']'; + } + + if (neg_intersection.length > 0) { + return '[^' + $$($nesting, 'Regexp').$escape(neg_intersection) + ']'; + } + + return null; + } + ; + + Opal.def(self, '$instance_variables', TMP_String_instance_variables_73 = function $$instance_variables() { + var self = this; + + return [] + }, TMP_String_instance_variables_73.$$arity = 0); + Opal.defs(self, '$_load', TMP_String__load_74 = function $$_load($a) { + var $post_args, args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + return $send(self, 'new', Opal.to_a(args)); + }, TMP_String__load_74.$$arity = -1); + + Opal.def(self, '$unicode_normalize', TMP_String_unicode_normalize_75 = function $$unicode_normalize(form) { + var self = this; + + + ; + return self.toString();; + }, TMP_String_unicode_normalize_75.$$arity = -1); + + Opal.def(self, '$unicode_normalized?', TMP_String_unicode_normalized$q_76 = function(form) { + var self = this; + + + ; + return true; + }, TMP_String_unicode_normalized$q_76.$$arity = -1); + + Opal.def(self, '$unpack', TMP_String_unpack_77 = function $$unpack(format) { + var self = this; + + return self.$raise("To use String#unpack, you must first require 'corelib/string/unpack'.") + }, TMP_String_unpack_77.$$arity = 1); + return (Opal.def(self, '$unpack1', TMP_String_unpack1_78 = function $$unpack1(format) { + var self = this; + + return self.$raise("To use String#unpack1, you must first require 'corelib/string/unpack'.") + }, TMP_String_unpack1_78.$$arity = 1), nil) && 'unpack1'; + })($nesting[0], String, $nesting); + return Opal.const_set($nesting[0], 'Symbol', $$($nesting, 'String')); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/enumerable"] = function(Opal) { + function $rb_gt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); + } + function $rb_times(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs * rhs : lhs['$*'](rhs); + } + function $rb_lt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); + } + function $rb_plus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); + } + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + function $rb_divide(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs / rhs : lhs['$/'](rhs); + } + function $rb_le(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs <= rhs : lhs['$<='](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $truthy = Opal.truthy, $send = Opal.send, $falsy = Opal.falsy, $hash2 = Opal.hash2, $lambda = Opal.lambda; + + Opal.add_stubs(['$each', '$public_send', '$destructure', '$to_enum', '$enumerator_size', '$new', '$yield', '$raise', '$slice_when', '$!', '$enum_for', '$flatten', '$map', '$warn', '$proc', '$==', '$nil?', '$respond_to?', '$coerce_to!', '$>', '$*', '$coerce_to', '$try_convert', '$<', '$+', '$-', '$ceil', '$/', '$size', '$__send__', '$length', '$<=', '$[]', '$push', '$<<', '$[]=', '$===', '$inspect', '$<=>', '$first', '$reverse', '$sort', '$to_proc', '$compare', '$call', '$dup', '$to_a', '$sort!', '$map!', '$key?', '$values', '$zip']); + return (function($base, $parent_nesting) { + function $Enumerable() {}; + var self = $Enumerable = $module($base, 'Enumerable', $Enumerable); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Enumerable_all$q_1, TMP_Enumerable_any$q_5, TMP_Enumerable_chunk_9, TMP_Enumerable_chunk_while_12, TMP_Enumerable_collect_14, TMP_Enumerable_collect_concat_16, TMP_Enumerable_count_19, TMP_Enumerable_cycle_23, TMP_Enumerable_detect_25, TMP_Enumerable_drop_27, TMP_Enumerable_drop_while_28, TMP_Enumerable_each_cons_29, TMP_Enumerable_each_entry_31, TMP_Enumerable_each_slice_33, TMP_Enumerable_each_with_index_35, TMP_Enumerable_each_with_object_37, TMP_Enumerable_entries_39, TMP_Enumerable_find_all_40, TMP_Enumerable_find_index_42, TMP_Enumerable_first_45, TMP_Enumerable_grep_48, TMP_Enumerable_grep_v_50, TMP_Enumerable_group_by_52, TMP_Enumerable_include$q_54, TMP_Enumerable_inject_56, TMP_Enumerable_lazy_57, TMP_Enumerable_enumerator_size_59, TMP_Enumerable_max_60, TMP_Enumerable_max_by_61, TMP_Enumerable_min_63, TMP_Enumerable_min_by_64, TMP_Enumerable_minmax_66, TMP_Enumerable_minmax_by_68, TMP_Enumerable_none$q_69, TMP_Enumerable_one$q_73, TMP_Enumerable_partition_77, TMP_Enumerable_reject_79, TMP_Enumerable_reverse_each_81, TMP_Enumerable_slice_before_83, TMP_Enumerable_slice_after_85, TMP_Enumerable_slice_when_88, TMP_Enumerable_sort_90, TMP_Enumerable_sort_by_92, TMP_Enumerable_sum_97, TMP_Enumerable_take_99, TMP_Enumerable_take_while_100, TMP_Enumerable_uniq_102, TMP_Enumerable_zip_104; + + + + function comparableForPattern(value) { + if (value.length === 0) { + value = [nil]; + } + + if (value.length > 1) { + value = [value]; + } + + return value; + } + ; + + Opal.def(self, '$all?', TMP_Enumerable_all$q_1 = function(pattern) {try { + + var $iter = TMP_Enumerable_all$q_1.$$p, block = $iter || nil, TMP_2, TMP_3, TMP_4, self = this; + + if ($iter) TMP_Enumerable_all$q_1.$$p = null; + + + if ($iter) TMP_Enumerable_all$q_1.$$p = null;; + ; + if ($truthy(pattern !== undefined)) { + $send(self, 'each', [], (TMP_2 = function($a){var self = TMP_2.$$s || this, $post_args, value, comparable = nil; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + value = $post_args;; + comparable = comparableForPattern(value); + if ($truthy($send(pattern, 'public_send', ["==="].concat(Opal.to_a(comparable))))) { + return nil + } else { + Opal.ret(false) + };}, TMP_2.$$s = self, TMP_2.$$arity = -1, TMP_2)) + } else if ((block !== nil)) { + $send(self, 'each', [], (TMP_3 = function($a){var self = TMP_3.$$s || this, $post_args, value; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + value = $post_args;; + if ($truthy(Opal.yieldX(block, Opal.to_a(value)))) { + return nil + } else { + Opal.ret(false) + };}, TMP_3.$$s = self, TMP_3.$$arity = -1, TMP_3)) + } else { + $send(self, 'each', [], (TMP_4 = function($a){var self = TMP_4.$$s || this, $post_args, value; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + value = $post_args;; + if ($truthy($$($nesting, 'Opal').$destructure(value))) { + return nil + } else { + Opal.ret(false) + };}, TMP_4.$$s = self, TMP_4.$$arity = -1, TMP_4)) + }; + return true; + } catch ($returner) { if ($returner === Opal.returner) { return $returner.$v } throw $returner; } + }, TMP_Enumerable_all$q_1.$$arity = -1); + + Opal.def(self, '$any?', TMP_Enumerable_any$q_5 = function(pattern) {try { + + var $iter = TMP_Enumerable_any$q_5.$$p, block = $iter || nil, TMP_6, TMP_7, TMP_8, self = this; + + if ($iter) TMP_Enumerable_any$q_5.$$p = null; + + + if ($iter) TMP_Enumerable_any$q_5.$$p = null;; + ; + if ($truthy(pattern !== undefined)) { + $send(self, 'each', [], (TMP_6 = function($a){var self = TMP_6.$$s || this, $post_args, value, comparable = nil; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + value = $post_args;; + comparable = comparableForPattern(value); + if ($truthy($send(pattern, 'public_send', ["==="].concat(Opal.to_a(comparable))))) { + Opal.ret(true) + } else { + return nil + };}, TMP_6.$$s = self, TMP_6.$$arity = -1, TMP_6)) + } else if ((block !== nil)) { + $send(self, 'each', [], (TMP_7 = function($a){var self = TMP_7.$$s || this, $post_args, value; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + value = $post_args;; + if ($truthy(Opal.yieldX(block, Opal.to_a(value)))) { + Opal.ret(true) + } else { + return nil + };}, TMP_7.$$s = self, TMP_7.$$arity = -1, TMP_7)) + } else { + $send(self, 'each', [], (TMP_8 = function($a){var self = TMP_8.$$s || this, $post_args, value; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + value = $post_args;; + if ($truthy($$($nesting, 'Opal').$destructure(value))) { + Opal.ret(true) + } else { + return nil + };}, TMP_8.$$s = self, TMP_8.$$arity = -1, TMP_8)) + }; + return false; + } catch ($returner) { if ($returner === Opal.returner) { return $returner.$v } throw $returner; } + }, TMP_Enumerable_any$q_5.$$arity = -1); + + Opal.def(self, '$chunk', TMP_Enumerable_chunk_9 = function $$chunk() { + var $iter = TMP_Enumerable_chunk_9.$$p, block = $iter || nil, TMP_10, TMP_11, self = this; + + if ($iter) TMP_Enumerable_chunk_9.$$p = null; + + + if ($iter) TMP_Enumerable_chunk_9.$$p = null;; + if ((block !== nil)) { + } else { + return $send(self, 'to_enum', ["chunk"], (TMP_10 = function(){var self = TMP_10.$$s || this; + + return self.$enumerator_size()}, TMP_10.$$s = self, TMP_10.$$arity = 0, TMP_10)) + }; + return $send($$$('::', 'Enumerator'), 'new', [], (TMP_11 = function(yielder){var self = TMP_11.$$s || this; + + + + if (yielder == null) { + yielder = nil; + }; + + var previous = nil, accumulate = []; + + function releaseAccumulate() { + if (accumulate.length > 0) { + yielder.$yield(previous, accumulate) + } + } + + self.$each.$$p = function(value) { + var key = Opal.yield1(block, value); + + if (key === nil) { + releaseAccumulate(); + accumulate = []; + previous = nil; + } else { + if (previous === nil || previous === key) { + accumulate.push(value); + } else { + releaseAccumulate(); + accumulate = [value]; + } + + previous = key; + } + } + + self.$each(); + + releaseAccumulate(); + ;}, TMP_11.$$s = self, TMP_11.$$arity = 1, TMP_11)); + }, TMP_Enumerable_chunk_9.$$arity = 0); + + Opal.def(self, '$chunk_while', TMP_Enumerable_chunk_while_12 = function $$chunk_while() { + var $iter = TMP_Enumerable_chunk_while_12.$$p, block = $iter || nil, TMP_13, self = this; + + if ($iter) TMP_Enumerable_chunk_while_12.$$p = null; + + + if ($iter) TMP_Enumerable_chunk_while_12.$$p = null;; + if ((block !== nil)) { + } else { + self.$raise($$($nesting, 'ArgumentError'), "no block given") + }; + return $send(self, 'slice_when', [], (TMP_13 = function(before, after){var self = TMP_13.$$s || this; + + + + if (before == null) { + before = nil; + }; + + if (after == null) { + after = nil; + }; + return Opal.yieldX(block, [before, after])['$!']();}, TMP_13.$$s = self, TMP_13.$$arity = 2, TMP_13)); + }, TMP_Enumerable_chunk_while_12.$$arity = 0); + + Opal.def(self, '$collect', TMP_Enumerable_collect_14 = function $$collect() { + var $iter = TMP_Enumerable_collect_14.$$p, block = $iter || nil, TMP_15, self = this; + + if ($iter) TMP_Enumerable_collect_14.$$p = null; + + + if ($iter) TMP_Enumerable_collect_14.$$p = null;; + if ((block !== nil)) { + } else { + return $send(self, 'enum_for', ["collect"], (TMP_15 = function(){var self = TMP_15.$$s || this; + + return self.$enumerator_size()}, TMP_15.$$s = self, TMP_15.$$arity = 0, TMP_15)) + }; + + var result = []; + + self.$each.$$p = function() { + var value = Opal.yieldX(block, arguments); + + result.push(value); + }; + + self.$each(); + + return result; + ; + }, TMP_Enumerable_collect_14.$$arity = 0); + + Opal.def(self, '$collect_concat', TMP_Enumerable_collect_concat_16 = function $$collect_concat() { + var $iter = TMP_Enumerable_collect_concat_16.$$p, block = $iter || nil, TMP_17, TMP_18, self = this; + + if ($iter) TMP_Enumerable_collect_concat_16.$$p = null; + + + if ($iter) TMP_Enumerable_collect_concat_16.$$p = null;; + if ((block !== nil)) { + } else { + return $send(self, 'enum_for', ["collect_concat"], (TMP_17 = function(){var self = TMP_17.$$s || this; + + return self.$enumerator_size()}, TMP_17.$$s = self, TMP_17.$$arity = 0, TMP_17)) + }; + return $send(self, 'map', [], (TMP_18 = function(item){var self = TMP_18.$$s || this; + + + + if (item == null) { + item = nil; + }; + return Opal.yield1(block, item);;}, TMP_18.$$s = self, TMP_18.$$arity = 1, TMP_18)).$flatten(1); + }, TMP_Enumerable_collect_concat_16.$$arity = 0); + + Opal.def(self, '$count', TMP_Enumerable_count_19 = function $$count(object) { + var $iter = TMP_Enumerable_count_19.$$p, block = $iter || nil, TMP_20, TMP_21, TMP_22, self = this, result = nil; + + if ($iter) TMP_Enumerable_count_19.$$p = null; + + + if ($iter) TMP_Enumerable_count_19.$$p = null;; + ; + result = 0; + + if (object != null && block !== nil) { + self.$warn("warning: given block not used") + } + ; + if ($truthy(object != null)) { + block = $send(self, 'proc', [], (TMP_20 = function($a){var self = TMP_20.$$s || this, $post_args, args; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + return $$($nesting, 'Opal').$destructure(args)['$=='](object);}, TMP_20.$$s = self, TMP_20.$$arity = -1, TMP_20)) + } else if ($truthy(block['$nil?']())) { + block = $send(self, 'proc', [], (TMP_21 = function(){var self = TMP_21.$$s || this; + + return true}, TMP_21.$$s = self, TMP_21.$$arity = 0, TMP_21))}; + $send(self, 'each', [], (TMP_22 = function($a){var self = TMP_22.$$s || this, $post_args, args; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + if ($truthy(Opal.yieldX(block, args))) { + return result++; + } else { + return nil + };}, TMP_22.$$s = self, TMP_22.$$arity = -1, TMP_22)); + return result; + }, TMP_Enumerable_count_19.$$arity = -1); + + Opal.def(self, '$cycle', TMP_Enumerable_cycle_23 = function $$cycle(n) { + var $iter = TMP_Enumerable_cycle_23.$$p, block = $iter || nil, TMP_24, self = this; + + if ($iter) TMP_Enumerable_cycle_23.$$p = null; + + + if ($iter) TMP_Enumerable_cycle_23.$$p = null;; + + if (n == null) { + n = nil; + }; + if ((block !== nil)) { + } else { + return $send(self, 'enum_for', ["cycle", n], (TMP_24 = function(){var self = TMP_24.$$s || this; + + if ($truthy(n['$nil?']())) { + if ($truthy(self['$respond_to?']("size"))) { + return $$$($$($nesting, 'Float'), 'INFINITY') + } else { + return nil + } + } else { + + n = $$($nesting, 'Opal')['$coerce_to!'](n, $$($nesting, 'Integer'), "to_int"); + if ($truthy($rb_gt(n, 0))) { + return $rb_times(self.$enumerator_size(), n) + } else { + return 0 + }; + }}, TMP_24.$$s = self, TMP_24.$$arity = 0, TMP_24)) + }; + if ($truthy(n['$nil?']())) { + } else { + + n = $$($nesting, 'Opal')['$coerce_to!'](n, $$($nesting, 'Integer'), "to_int"); + if ($truthy(n <= 0)) { + return nil}; + }; + + var result, + all = [], i, length, value; + + self.$each.$$p = function() { + var param = $$($nesting, 'Opal').$destructure(arguments), + value = Opal.yield1(block, param); + + all.push(param); + } + + self.$each(); + + if (result !== undefined) { + return result; + } + + if (all.length === 0) { + return nil; + } + + if (n === nil) { + while (true) { + for (i = 0, length = all.length; i < length; i++) { + value = Opal.yield1(block, all[i]); + } + } + } + else { + while (n > 1) { + for (i = 0, length = all.length; i < length; i++) { + value = Opal.yield1(block, all[i]); + } + + n--; + } + } + ; + }, TMP_Enumerable_cycle_23.$$arity = -1); + + Opal.def(self, '$detect', TMP_Enumerable_detect_25 = function $$detect(ifnone) {try { + + var $iter = TMP_Enumerable_detect_25.$$p, block = $iter || nil, TMP_26, self = this; + + if ($iter) TMP_Enumerable_detect_25.$$p = null; + + + if ($iter) TMP_Enumerable_detect_25.$$p = null;; + ; + if ((block !== nil)) { + } else { + return self.$enum_for("detect", ifnone) + }; + $send(self, 'each', [], (TMP_26 = function($a){var self = TMP_26.$$s || this, $post_args, args, value = nil; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + value = $$($nesting, 'Opal').$destructure(args); + if ($truthy(Opal.yield1(block, value))) { + Opal.ret(value) + } else { + return nil + };}, TMP_26.$$s = self, TMP_26.$$arity = -1, TMP_26)); + + if (ifnone !== undefined) { + if (typeof(ifnone) === 'function') { + return ifnone(); + } else { + return ifnone; + } + } + ; + return nil; + } catch ($returner) { if ($returner === Opal.returner) { return $returner.$v } throw $returner; } + }, TMP_Enumerable_detect_25.$$arity = -1); + + Opal.def(self, '$drop', TMP_Enumerable_drop_27 = function $$drop(number) { + var self = this; + + + number = $$($nesting, 'Opal').$coerce_to(number, $$($nesting, 'Integer'), "to_int"); + if ($truthy(number < 0)) { + self.$raise($$($nesting, 'ArgumentError'), "attempt to drop negative size")}; + + var result = [], + current = 0; + + self.$each.$$p = function() { + if (number <= current) { + result.push($$($nesting, 'Opal').$destructure(arguments)); + } + + current++; + }; + + self.$each() + + return result; + ; + }, TMP_Enumerable_drop_27.$$arity = 1); + + Opal.def(self, '$drop_while', TMP_Enumerable_drop_while_28 = function $$drop_while() { + var $iter = TMP_Enumerable_drop_while_28.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Enumerable_drop_while_28.$$p = null; + + + if ($iter) TMP_Enumerable_drop_while_28.$$p = null;; + if ((block !== nil)) { + } else { + return self.$enum_for("drop_while") + }; + + var result = [], + dropping = true; + + self.$each.$$p = function() { + var param = $$($nesting, 'Opal').$destructure(arguments); + + if (dropping) { + var value = Opal.yield1(block, param); + + if ($falsy(value)) { + dropping = false; + result.push(param); + } + } + else { + result.push(param); + } + }; + + self.$each(); + + return result; + ; + }, TMP_Enumerable_drop_while_28.$$arity = 0); + + Opal.def(self, '$each_cons', TMP_Enumerable_each_cons_29 = function $$each_cons(n) { + var $iter = TMP_Enumerable_each_cons_29.$$p, block = $iter || nil, TMP_30, self = this; + + if ($iter) TMP_Enumerable_each_cons_29.$$p = null; + + + if ($iter) TMP_Enumerable_each_cons_29.$$p = null;; + if ($truthy(arguments.length != 1)) { + self.$raise($$($nesting, 'ArgumentError'), "" + "wrong number of arguments (" + (arguments.length) + " for 1)")}; + n = $$($nesting, 'Opal').$try_convert(n, $$($nesting, 'Integer'), "to_int"); + if ($truthy(n <= 0)) { + self.$raise($$($nesting, 'ArgumentError'), "invalid size")}; + if ((block !== nil)) { + } else { + return $send(self, 'enum_for', ["each_cons", n], (TMP_30 = function(){var self = TMP_30.$$s || this, $a, enum_size = nil; + + + enum_size = self.$enumerator_size(); + if ($truthy(enum_size['$nil?']())) { + return nil + } else if ($truthy(($truthy($a = enum_size['$=='](0)) ? $a : $rb_lt(enum_size, n)))) { + return 0 + } else { + return $rb_plus($rb_minus(enum_size, n), 1) + };}, TMP_30.$$s = self, TMP_30.$$arity = 0, TMP_30)) + }; + + var buffer = [], result = nil; + + self.$each.$$p = function() { + var element = $$($nesting, 'Opal').$destructure(arguments); + buffer.push(element); + if (buffer.length > n) { + buffer.shift(); + } + if (buffer.length == n) { + Opal.yield1(block, buffer.slice(0, n)); + } + } + + self.$each(); + + return result; + ; + }, TMP_Enumerable_each_cons_29.$$arity = 1); + + Opal.def(self, '$each_entry', TMP_Enumerable_each_entry_31 = function $$each_entry($a) { + var $iter = TMP_Enumerable_each_entry_31.$$p, block = $iter || nil, $post_args, data, TMP_32, self = this; + + if ($iter) TMP_Enumerable_each_entry_31.$$p = null; + + + if ($iter) TMP_Enumerable_each_entry_31.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + data = $post_args;; + if ((block !== nil)) { + } else { + return $send(self, 'to_enum', ["each_entry"].concat(Opal.to_a(data)), (TMP_32 = function(){var self = TMP_32.$$s || this; + + return self.$enumerator_size()}, TMP_32.$$s = self, TMP_32.$$arity = 0, TMP_32)) + }; + + self.$each.$$p = function() { + var item = $$($nesting, 'Opal').$destructure(arguments); + + Opal.yield1(block, item); + } + + self.$each.apply(self, data); + + return self; + ; + }, TMP_Enumerable_each_entry_31.$$arity = -1); + + Opal.def(self, '$each_slice', TMP_Enumerable_each_slice_33 = function $$each_slice(n) { + var $iter = TMP_Enumerable_each_slice_33.$$p, block = $iter || nil, TMP_34, self = this; + + if ($iter) TMP_Enumerable_each_slice_33.$$p = null; + + + if ($iter) TMP_Enumerable_each_slice_33.$$p = null;; + n = $$($nesting, 'Opal').$coerce_to(n, $$($nesting, 'Integer'), "to_int"); + if ($truthy(n <= 0)) { + self.$raise($$($nesting, 'ArgumentError'), "invalid slice size")}; + if ((block !== nil)) { + } else { + return $send(self, 'enum_for', ["each_slice", n], (TMP_34 = function(){var self = TMP_34.$$s || this; + + if ($truthy(self['$respond_to?']("size"))) { + return $rb_divide(self.$size(), n).$ceil() + } else { + return nil + }}, TMP_34.$$s = self, TMP_34.$$arity = 0, TMP_34)) + }; + + var result, + slice = [] + + self.$each.$$p = function() { + var param = $$($nesting, 'Opal').$destructure(arguments); + + slice.push(param); + + if (slice.length === n) { + Opal.yield1(block, slice); + slice = []; + } + }; + + self.$each(); + + if (result !== undefined) { + return result; + } + + // our "last" group, if smaller than n then won't have been yielded + if (slice.length > 0) { + Opal.yield1(block, slice); + } + ; + return nil; + }, TMP_Enumerable_each_slice_33.$$arity = 1); + + Opal.def(self, '$each_with_index', TMP_Enumerable_each_with_index_35 = function $$each_with_index($a) { + var $iter = TMP_Enumerable_each_with_index_35.$$p, block = $iter || nil, $post_args, args, TMP_36, self = this; + + if ($iter) TMP_Enumerable_each_with_index_35.$$p = null; + + + if ($iter) TMP_Enumerable_each_with_index_35.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + if ((block !== nil)) { + } else { + return $send(self, 'enum_for', ["each_with_index"].concat(Opal.to_a(args)), (TMP_36 = function(){var self = TMP_36.$$s || this; + + return self.$enumerator_size()}, TMP_36.$$s = self, TMP_36.$$arity = 0, TMP_36)) + }; + + var result, + index = 0; + + self.$each.$$p = function() { + var param = $$($nesting, 'Opal').$destructure(arguments); + + block(param, index); + + index++; + }; + + self.$each.apply(self, args); + + if (result !== undefined) { + return result; + } + ; + return self; + }, TMP_Enumerable_each_with_index_35.$$arity = -1); + + Opal.def(self, '$each_with_object', TMP_Enumerable_each_with_object_37 = function $$each_with_object(object) { + var $iter = TMP_Enumerable_each_with_object_37.$$p, block = $iter || nil, TMP_38, self = this; + + if ($iter) TMP_Enumerable_each_with_object_37.$$p = null; + + + if ($iter) TMP_Enumerable_each_with_object_37.$$p = null;; + if ((block !== nil)) { + } else { + return $send(self, 'enum_for', ["each_with_object", object], (TMP_38 = function(){var self = TMP_38.$$s || this; + + return self.$enumerator_size()}, TMP_38.$$s = self, TMP_38.$$arity = 0, TMP_38)) + }; + + var result; + + self.$each.$$p = function() { + var param = $$($nesting, 'Opal').$destructure(arguments); + + block(param, object); + }; + + self.$each(); + + if (result !== undefined) { + return result; + } + ; + return object; + }, TMP_Enumerable_each_with_object_37.$$arity = 1); + + Opal.def(self, '$entries', TMP_Enumerable_entries_39 = function $$entries($a) { + var $post_args, args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + + var result = []; + + self.$each.$$p = function() { + result.push($$($nesting, 'Opal').$destructure(arguments)); + }; + + self.$each.apply(self, args); + + return result; + ; + }, TMP_Enumerable_entries_39.$$arity = -1); + Opal.alias(self, "find", "detect"); + + Opal.def(self, '$find_all', TMP_Enumerable_find_all_40 = function $$find_all() { + var $iter = TMP_Enumerable_find_all_40.$$p, block = $iter || nil, TMP_41, self = this; + + if ($iter) TMP_Enumerable_find_all_40.$$p = null; + + + if ($iter) TMP_Enumerable_find_all_40.$$p = null;; + if ((block !== nil)) { + } else { + return $send(self, 'enum_for', ["find_all"], (TMP_41 = function(){var self = TMP_41.$$s || this; + + return self.$enumerator_size()}, TMP_41.$$s = self, TMP_41.$$arity = 0, TMP_41)) + }; + + var result = []; + + self.$each.$$p = function() { + var param = $$($nesting, 'Opal').$destructure(arguments), + value = Opal.yield1(block, param); + + if ($truthy(value)) { + result.push(param); + } + }; + + self.$each(); + + return result; + ; + }, TMP_Enumerable_find_all_40.$$arity = 0); + + Opal.def(self, '$find_index', TMP_Enumerable_find_index_42 = function $$find_index(object) {try { + + var $iter = TMP_Enumerable_find_index_42.$$p, block = $iter || nil, TMP_43, TMP_44, self = this, index = nil; + + if ($iter) TMP_Enumerable_find_index_42.$$p = null; + + + if ($iter) TMP_Enumerable_find_index_42.$$p = null;; + ; + if ($truthy(object === undefined && block === nil)) { + return self.$enum_for("find_index")}; + + if (object != null && block !== nil) { + self.$warn("warning: given block not used") + } + ; + index = 0; + if ($truthy(object != null)) { + $send(self, 'each', [], (TMP_43 = function($a){var self = TMP_43.$$s || this, $post_args, value; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + value = $post_args;; + if ($$($nesting, 'Opal').$destructure(value)['$=='](object)) { + Opal.ret(index)}; + return index += 1;;}, TMP_43.$$s = self, TMP_43.$$arity = -1, TMP_43)) + } else { + $send(self, 'each', [], (TMP_44 = function($a){var self = TMP_44.$$s || this, $post_args, value; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + value = $post_args;; + if ($truthy(Opal.yieldX(block, Opal.to_a(value)))) { + Opal.ret(index)}; + return index += 1;;}, TMP_44.$$s = self, TMP_44.$$arity = -1, TMP_44)) + }; + return nil; + } catch ($returner) { if ($returner === Opal.returner) { return $returner.$v } throw $returner; } + }, TMP_Enumerable_find_index_42.$$arity = -1); + + Opal.def(self, '$first', TMP_Enumerable_first_45 = function $$first(number) {try { + + var TMP_46, TMP_47, self = this, result = nil, current = nil; + + + ; + if ($truthy(number === undefined)) { + return $send(self, 'each', [], (TMP_46 = function(value){var self = TMP_46.$$s || this; + + + + if (value == null) { + value = nil; + }; + Opal.ret(value);}, TMP_46.$$s = self, TMP_46.$$arity = 1, TMP_46)) + } else { + + result = []; + number = $$($nesting, 'Opal').$coerce_to(number, $$($nesting, 'Integer'), "to_int"); + if ($truthy(number < 0)) { + self.$raise($$($nesting, 'ArgumentError'), "attempt to take negative size")}; + if ($truthy(number == 0)) { + return []}; + current = 0; + $send(self, 'each', [], (TMP_47 = function($a){var self = TMP_47.$$s || this, $post_args, args; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + result.push($$($nesting, 'Opal').$destructure(args)); + if ($truthy(number <= ++current)) { + Opal.ret(result) + } else { + return nil + };}, TMP_47.$$s = self, TMP_47.$$arity = -1, TMP_47)); + return result; + }; + } catch ($returner) { if ($returner === Opal.returner) { return $returner.$v } throw $returner; } + }, TMP_Enumerable_first_45.$$arity = -1); + Opal.alias(self, "flat_map", "collect_concat"); + + Opal.def(self, '$grep', TMP_Enumerable_grep_48 = function $$grep(pattern) { + var $iter = TMP_Enumerable_grep_48.$$p, block = $iter || nil, TMP_49, self = this, result = nil; + + if ($iter) TMP_Enumerable_grep_48.$$p = null; + + + if ($iter) TMP_Enumerable_grep_48.$$p = null;; + result = []; + $send(self, 'each', [], (TMP_49 = function($a){var self = TMP_49.$$s || this, $post_args, value, cmp = nil; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + value = $post_args;; + cmp = comparableForPattern(value); + if ($truthy($send(pattern, '__send__', ["==="].concat(Opal.to_a(cmp))))) { + } else { + return nil; + }; + if ((block !== nil)) { + + if ($truthy($rb_gt(value.$length(), 1))) { + value = [value]}; + value = Opal.yieldX(block, Opal.to_a(value)); + } else if ($truthy($rb_le(value.$length(), 1))) { + value = value['$[]'](0)}; + return result.$push(value);}, TMP_49.$$s = self, TMP_49.$$arity = -1, TMP_49)); + return result; + }, TMP_Enumerable_grep_48.$$arity = 1); + + Opal.def(self, '$grep_v', TMP_Enumerable_grep_v_50 = function $$grep_v(pattern) { + var $iter = TMP_Enumerable_grep_v_50.$$p, block = $iter || nil, TMP_51, self = this, result = nil; + + if ($iter) TMP_Enumerable_grep_v_50.$$p = null; + + + if ($iter) TMP_Enumerable_grep_v_50.$$p = null;; + result = []; + $send(self, 'each', [], (TMP_51 = function($a){var self = TMP_51.$$s || this, $post_args, value, cmp = nil; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + value = $post_args;; + cmp = comparableForPattern(value); + if ($truthy($send(pattern, '__send__', ["==="].concat(Opal.to_a(cmp))))) { + return nil;}; + if ((block !== nil)) { + + if ($truthy($rb_gt(value.$length(), 1))) { + value = [value]}; + value = Opal.yieldX(block, Opal.to_a(value)); + } else if ($truthy($rb_le(value.$length(), 1))) { + value = value['$[]'](0)}; + return result.$push(value);}, TMP_51.$$s = self, TMP_51.$$arity = -1, TMP_51)); + return result; + }, TMP_Enumerable_grep_v_50.$$arity = 1); + + Opal.def(self, '$group_by', TMP_Enumerable_group_by_52 = function $$group_by() { + var $iter = TMP_Enumerable_group_by_52.$$p, block = $iter || nil, TMP_53, $a, self = this, hash = nil, $writer = nil; + + if ($iter) TMP_Enumerable_group_by_52.$$p = null; + + + if ($iter) TMP_Enumerable_group_by_52.$$p = null;; + if ((block !== nil)) { + } else { + return $send(self, 'enum_for', ["group_by"], (TMP_53 = function(){var self = TMP_53.$$s || this; + + return self.$enumerator_size()}, TMP_53.$$s = self, TMP_53.$$arity = 0, TMP_53)) + }; + hash = $hash2([], {}); + + var result; + + self.$each.$$p = function() { + var param = $$($nesting, 'Opal').$destructure(arguments), + value = Opal.yield1(block, param); + + ($truthy($a = hash['$[]'](value)) ? $a : (($writer = [value, []]), $send(hash, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]))['$<<'](param); + } + + self.$each(); + + if (result !== undefined) { + return result; + } + ; + return hash; + }, TMP_Enumerable_group_by_52.$$arity = 0); + + Opal.def(self, '$include?', TMP_Enumerable_include$q_54 = function(obj) {try { + + var TMP_55, self = this; + + + $send(self, 'each', [], (TMP_55 = function($a){var self = TMP_55.$$s || this, $post_args, args; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + if ($$($nesting, 'Opal').$destructure(args)['$=='](obj)) { + Opal.ret(true) + } else { + return nil + };}, TMP_55.$$s = self, TMP_55.$$arity = -1, TMP_55)); + return false; + } catch ($returner) { if ($returner === Opal.returner) { return $returner.$v } throw $returner; } + }, TMP_Enumerable_include$q_54.$$arity = 1); + + Opal.def(self, '$inject', TMP_Enumerable_inject_56 = function $$inject(object, sym) { + var $iter = TMP_Enumerable_inject_56.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Enumerable_inject_56.$$p = null; + + + if ($iter) TMP_Enumerable_inject_56.$$p = null;; + ; + ; + + var result = object; + + if (block !== nil && sym === undefined) { + self.$each.$$p = function() { + var value = $$($nesting, 'Opal').$destructure(arguments); + + if (result === undefined) { + result = value; + return; + } + + value = Opal.yieldX(block, [result, value]); + + result = value; + }; + } + else { + if (sym === undefined) { + if (!$$($nesting, 'Symbol')['$==='](object)) { + self.$raise($$($nesting, 'TypeError'), "" + (object.$inspect()) + " is not a Symbol"); + } + + sym = object; + result = undefined; + } + + self.$each.$$p = function() { + var value = $$($nesting, 'Opal').$destructure(arguments); + + if (result === undefined) { + result = value; + return; + } + + result = (result).$__send__(sym, value); + }; + } + + self.$each(); + + return result == undefined ? nil : result; + ; + }, TMP_Enumerable_inject_56.$$arity = -1); + + Opal.def(self, '$lazy', TMP_Enumerable_lazy_57 = function $$lazy() { + var TMP_58, self = this; + + return $send($$$($$($nesting, 'Enumerator'), 'Lazy'), 'new', [self, self.$enumerator_size()], (TMP_58 = function(enum$, $a){var self = TMP_58.$$s || this, $post_args, args; + + + + if (enum$ == null) { + enum$ = nil; + }; + + $post_args = Opal.slice.call(arguments, 1, arguments.length); + + args = $post_args;; + return $send(enum$, 'yield', Opal.to_a(args));}, TMP_58.$$s = self, TMP_58.$$arity = -2, TMP_58)) + }, TMP_Enumerable_lazy_57.$$arity = 0); + + Opal.def(self, '$enumerator_size', TMP_Enumerable_enumerator_size_59 = function $$enumerator_size() { + var self = this; + + if ($truthy(self['$respond_to?']("size"))) { + return self.$size() + } else { + return nil + } + }, TMP_Enumerable_enumerator_size_59.$$arity = 0); + Opal.alias(self, "map", "collect"); + + Opal.def(self, '$max', TMP_Enumerable_max_60 = function $$max(n) { + var $iter = TMP_Enumerable_max_60.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Enumerable_max_60.$$p = null; + + + if ($iter) TMP_Enumerable_max_60.$$p = null;; + ; + + if (n === undefined || n === nil) { + var result, value; + + self.$each.$$p = function() { + var item = $$($nesting, 'Opal').$destructure(arguments); + + if (result === undefined) { + result = item; + return; + } + + if (block !== nil) { + value = Opal.yieldX(block, [item, result]); + } else { + value = (item)['$<=>'](result); + } + + if (value === nil) { + self.$raise($$($nesting, 'ArgumentError'), "comparison failed"); + } + + if (value > 0) { + result = item; + } + } + + self.$each(); + + if (result === undefined) { + return nil; + } else { + return result; + } + } + ; + n = $$($nesting, 'Opal').$coerce_to(n, $$($nesting, 'Integer'), "to_int"); + return $send(self, 'sort', [], block.$to_proc()).$reverse().$first(n); + }, TMP_Enumerable_max_60.$$arity = -1); + + Opal.def(self, '$max_by', TMP_Enumerable_max_by_61 = function $$max_by() { + var $iter = TMP_Enumerable_max_by_61.$$p, block = $iter || nil, TMP_62, self = this; + + if ($iter) TMP_Enumerable_max_by_61.$$p = null; + + + if ($iter) TMP_Enumerable_max_by_61.$$p = null;; + if ($truthy(block)) { + } else { + return $send(self, 'enum_for', ["max_by"], (TMP_62 = function(){var self = TMP_62.$$s || this; + + return self.$enumerator_size()}, TMP_62.$$s = self, TMP_62.$$arity = 0, TMP_62)) + }; + + var result, + by; + + self.$each.$$p = function() { + var param = $$($nesting, 'Opal').$destructure(arguments), + value = Opal.yield1(block, param); + + if (result === undefined) { + result = param; + by = value; + return; + } + + if ((value)['$<=>'](by) > 0) { + result = param + by = value; + } + }; + + self.$each(); + + return result === undefined ? nil : result; + ; + }, TMP_Enumerable_max_by_61.$$arity = 0); + Opal.alias(self, "member?", "include?"); + + Opal.def(self, '$min', TMP_Enumerable_min_63 = function $$min() { + var $iter = TMP_Enumerable_min_63.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Enumerable_min_63.$$p = null; + + + if ($iter) TMP_Enumerable_min_63.$$p = null;; + + var result; + + if (block !== nil) { + self.$each.$$p = function() { + var param = $$($nesting, 'Opal').$destructure(arguments); + + if (result === undefined) { + result = param; + return; + } + + var value = block(param, result); + + if (value === nil) { + self.$raise($$($nesting, 'ArgumentError'), "comparison failed"); + } + + if (value < 0) { + result = param; + } + }; + } + else { + self.$each.$$p = function() { + var param = $$($nesting, 'Opal').$destructure(arguments); + + if (result === undefined) { + result = param; + return; + } + + if ($$($nesting, 'Opal').$compare(param, result) < 0) { + result = param; + } + }; + } + + self.$each(); + + return result === undefined ? nil : result; + ; + }, TMP_Enumerable_min_63.$$arity = 0); + + Opal.def(self, '$min_by', TMP_Enumerable_min_by_64 = function $$min_by() { + var $iter = TMP_Enumerable_min_by_64.$$p, block = $iter || nil, TMP_65, self = this; + + if ($iter) TMP_Enumerable_min_by_64.$$p = null; + + + if ($iter) TMP_Enumerable_min_by_64.$$p = null;; + if ($truthy(block)) { + } else { + return $send(self, 'enum_for', ["min_by"], (TMP_65 = function(){var self = TMP_65.$$s || this; + + return self.$enumerator_size()}, TMP_65.$$s = self, TMP_65.$$arity = 0, TMP_65)) + }; + + var result, + by; + + self.$each.$$p = function() { + var param = $$($nesting, 'Opal').$destructure(arguments), + value = Opal.yield1(block, param); + + if (result === undefined) { + result = param; + by = value; + return; + } + + if ((value)['$<=>'](by) < 0) { + result = param + by = value; + } + }; + + self.$each(); + + return result === undefined ? nil : result; + ; + }, TMP_Enumerable_min_by_64.$$arity = 0); + + Opal.def(self, '$minmax', TMP_Enumerable_minmax_66 = function $$minmax() { + var $iter = TMP_Enumerable_minmax_66.$$p, block = $iter || nil, $a, TMP_67, self = this; + + if ($iter) TMP_Enumerable_minmax_66.$$p = null; + + + if ($iter) TMP_Enumerable_minmax_66.$$p = null;; + block = ($truthy($a = block) ? $a : $send(self, 'proc', [], (TMP_67 = function(a, b){var self = TMP_67.$$s || this; + + + + if (a == null) { + a = nil; + }; + + if (b == null) { + b = nil; + }; + return a['$<=>'](b);}, TMP_67.$$s = self, TMP_67.$$arity = 2, TMP_67))); + + var min = nil, max = nil, first_time = true; + + self.$each.$$p = function() { + var element = $$($nesting, 'Opal').$destructure(arguments); + if (first_time) { + min = max = element; + first_time = false; + } else { + var min_cmp = block.$call(min, element); + + if (min_cmp === nil) { + self.$raise($$($nesting, 'ArgumentError'), "comparison failed") + } else if (min_cmp > 0) { + min = element; + } + + var max_cmp = block.$call(max, element); + + if (max_cmp === nil) { + self.$raise($$($nesting, 'ArgumentError'), "comparison failed") + } else if (max_cmp < 0) { + max = element; + } + } + } + + self.$each(); + + return [min, max]; + ; + }, TMP_Enumerable_minmax_66.$$arity = 0); + + Opal.def(self, '$minmax_by', TMP_Enumerable_minmax_by_68 = function $$minmax_by() { + var $iter = TMP_Enumerable_minmax_by_68.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Enumerable_minmax_by_68.$$p = null; + + + if ($iter) TMP_Enumerable_minmax_by_68.$$p = null;; + return self.$raise($$($nesting, 'NotImplementedError')); + }, TMP_Enumerable_minmax_by_68.$$arity = 0); + + Opal.def(self, '$none?', TMP_Enumerable_none$q_69 = function(pattern) {try { + + var $iter = TMP_Enumerable_none$q_69.$$p, block = $iter || nil, TMP_70, TMP_71, TMP_72, self = this; + + if ($iter) TMP_Enumerable_none$q_69.$$p = null; + + + if ($iter) TMP_Enumerable_none$q_69.$$p = null;; + ; + if ($truthy(pattern !== undefined)) { + $send(self, 'each', [], (TMP_70 = function($a){var self = TMP_70.$$s || this, $post_args, value, comparable = nil; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + value = $post_args;; + comparable = comparableForPattern(value); + if ($truthy($send(pattern, 'public_send', ["==="].concat(Opal.to_a(comparable))))) { + Opal.ret(false) + } else { + return nil + };}, TMP_70.$$s = self, TMP_70.$$arity = -1, TMP_70)) + } else if ((block !== nil)) { + $send(self, 'each', [], (TMP_71 = function($a){var self = TMP_71.$$s || this, $post_args, value; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + value = $post_args;; + if ($truthy(Opal.yieldX(block, Opal.to_a(value)))) { + Opal.ret(false) + } else { + return nil + };}, TMP_71.$$s = self, TMP_71.$$arity = -1, TMP_71)) + } else { + $send(self, 'each', [], (TMP_72 = function($a){var self = TMP_72.$$s || this, $post_args, value, item = nil; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + value = $post_args;; + item = $$($nesting, 'Opal').$destructure(value); + if ($truthy(item)) { + Opal.ret(false) + } else { + return nil + };}, TMP_72.$$s = self, TMP_72.$$arity = -1, TMP_72)) + }; + return true; + } catch ($returner) { if ($returner === Opal.returner) { return $returner.$v } throw $returner; } + }, TMP_Enumerable_none$q_69.$$arity = -1); + + Opal.def(self, '$one?', TMP_Enumerable_one$q_73 = function(pattern) {try { + + var $iter = TMP_Enumerable_one$q_73.$$p, block = $iter || nil, TMP_74, TMP_75, TMP_76, self = this, count = nil; + + if ($iter) TMP_Enumerable_one$q_73.$$p = null; + + + if ($iter) TMP_Enumerable_one$q_73.$$p = null;; + ; + count = 0; + if ($truthy(pattern !== undefined)) { + $send(self, 'each', [], (TMP_74 = function($a){var self = TMP_74.$$s || this, $post_args, value, comparable = nil; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + value = $post_args;; + comparable = comparableForPattern(value); + if ($truthy($send(pattern, 'public_send', ["==="].concat(Opal.to_a(comparable))))) { + + count = $rb_plus(count, 1); + if ($truthy($rb_gt(count, 1))) { + Opal.ret(false) + } else { + return nil + }; + } else { + return nil + };}, TMP_74.$$s = self, TMP_74.$$arity = -1, TMP_74)) + } else if ((block !== nil)) { + $send(self, 'each', [], (TMP_75 = function($a){var self = TMP_75.$$s || this, $post_args, value; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + value = $post_args;; + if ($truthy(Opal.yieldX(block, Opal.to_a(value)))) { + } else { + return nil; + }; + count = $rb_plus(count, 1); + if ($truthy($rb_gt(count, 1))) { + Opal.ret(false) + } else { + return nil + };}, TMP_75.$$s = self, TMP_75.$$arity = -1, TMP_75)) + } else { + $send(self, 'each', [], (TMP_76 = function($a){var self = TMP_76.$$s || this, $post_args, value; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + value = $post_args;; + if ($truthy($$($nesting, 'Opal').$destructure(value))) { + } else { + return nil; + }; + count = $rb_plus(count, 1); + if ($truthy($rb_gt(count, 1))) { + Opal.ret(false) + } else { + return nil + };}, TMP_76.$$s = self, TMP_76.$$arity = -1, TMP_76)) + }; + return count['$=='](1); + } catch ($returner) { if ($returner === Opal.returner) { return $returner.$v } throw $returner; } + }, TMP_Enumerable_one$q_73.$$arity = -1); + + Opal.def(self, '$partition', TMP_Enumerable_partition_77 = function $$partition() { + var $iter = TMP_Enumerable_partition_77.$$p, block = $iter || nil, TMP_78, self = this; + + if ($iter) TMP_Enumerable_partition_77.$$p = null; + + + if ($iter) TMP_Enumerable_partition_77.$$p = null;; + if ((block !== nil)) { + } else { + return $send(self, 'enum_for', ["partition"], (TMP_78 = function(){var self = TMP_78.$$s || this; + + return self.$enumerator_size()}, TMP_78.$$s = self, TMP_78.$$arity = 0, TMP_78)) + }; + + var truthy = [], falsy = [], result; + + self.$each.$$p = function() { + var param = $$($nesting, 'Opal').$destructure(arguments), + value = Opal.yield1(block, param); + + if ($truthy(value)) { + truthy.push(param); + } + else { + falsy.push(param); + } + }; + + self.$each(); + + return [truthy, falsy]; + ; + }, TMP_Enumerable_partition_77.$$arity = 0); + Opal.alias(self, "reduce", "inject"); + + Opal.def(self, '$reject', TMP_Enumerable_reject_79 = function $$reject() { + var $iter = TMP_Enumerable_reject_79.$$p, block = $iter || nil, TMP_80, self = this; + + if ($iter) TMP_Enumerable_reject_79.$$p = null; + + + if ($iter) TMP_Enumerable_reject_79.$$p = null;; + if ((block !== nil)) { + } else { + return $send(self, 'enum_for', ["reject"], (TMP_80 = function(){var self = TMP_80.$$s || this; + + return self.$enumerator_size()}, TMP_80.$$s = self, TMP_80.$$arity = 0, TMP_80)) + }; + + var result = []; + + self.$each.$$p = function() { + var param = $$($nesting, 'Opal').$destructure(arguments), + value = Opal.yield1(block, param); + + if ($falsy(value)) { + result.push(param); + } + }; + + self.$each(); + + return result; + ; + }, TMP_Enumerable_reject_79.$$arity = 0); + + Opal.def(self, '$reverse_each', TMP_Enumerable_reverse_each_81 = function $$reverse_each() { + var $iter = TMP_Enumerable_reverse_each_81.$$p, block = $iter || nil, TMP_82, self = this; + + if ($iter) TMP_Enumerable_reverse_each_81.$$p = null; + + + if ($iter) TMP_Enumerable_reverse_each_81.$$p = null;; + if ((block !== nil)) { + } else { + return $send(self, 'enum_for', ["reverse_each"], (TMP_82 = function(){var self = TMP_82.$$s || this; + + return self.$enumerator_size()}, TMP_82.$$s = self, TMP_82.$$arity = 0, TMP_82)) + }; + + var result = []; + + self.$each.$$p = function() { + result.push(arguments); + }; + + self.$each(); + + for (var i = result.length - 1; i >= 0; i--) { + Opal.yieldX(block, result[i]); + } + + return result; + ; + }, TMP_Enumerable_reverse_each_81.$$arity = 0); + Opal.alias(self, "select", "find_all"); + + Opal.def(self, '$slice_before', TMP_Enumerable_slice_before_83 = function $$slice_before(pattern) { + var $iter = TMP_Enumerable_slice_before_83.$$p, block = $iter || nil, TMP_84, self = this; + + if ($iter) TMP_Enumerable_slice_before_83.$$p = null; + + + if ($iter) TMP_Enumerable_slice_before_83.$$p = null;; + ; + if ($truthy(pattern === undefined && block === nil)) { + self.$raise($$($nesting, 'ArgumentError'), "both pattern and block are given")}; + if ($truthy(pattern !== undefined && block !== nil || arguments.length > 1)) { + self.$raise($$($nesting, 'ArgumentError'), "" + "wrong number of arguments (" + (arguments.length) + " expected 1)")}; + return $send($$($nesting, 'Enumerator'), 'new', [], (TMP_84 = function(e){var self = TMP_84.$$s || this; + + + + if (e == null) { + e = nil; + }; + + var slice = []; + + if (block !== nil) { + if (pattern === undefined) { + self.$each.$$p = function() { + var param = $$($nesting, 'Opal').$destructure(arguments), + value = Opal.yield1(block, param); + + if ($truthy(value) && slice.length > 0) { + e['$<<'](slice); + slice = []; + } + + slice.push(param); + }; + } + else { + self.$each.$$p = function() { + var param = $$($nesting, 'Opal').$destructure(arguments), + value = block(param, pattern.$dup()); + + if ($truthy(value) && slice.length > 0) { + e['$<<'](slice); + slice = []; + } + + slice.push(param); + }; + } + } + else { + self.$each.$$p = function() { + var param = $$($nesting, 'Opal').$destructure(arguments), + value = pattern['$==='](param); + + if ($truthy(value) && slice.length > 0) { + e['$<<'](slice); + slice = []; + } + + slice.push(param); + }; + } + + self.$each(); + + if (slice.length > 0) { + e['$<<'](slice); + } + ;}, TMP_84.$$s = self, TMP_84.$$arity = 1, TMP_84)); + }, TMP_Enumerable_slice_before_83.$$arity = -1); + + Opal.def(self, '$slice_after', TMP_Enumerable_slice_after_85 = function $$slice_after(pattern) { + var $iter = TMP_Enumerable_slice_after_85.$$p, block = $iter || nil, TMP_86, TMP_87, self = this; + + if ($iter) TMP_Enumerable_slice_after_85.$$p = null; + + + if ($iter) TMP_Enumerable_slice_after_85.$$p = null;; + ; + if ($truthy(pattern === undefined && block === nil)) { + self.$raise($$($nesting, 'ArgumentError'), "both pattern and block are given")}; + if ($truthy(pattern !== undefined && block !== nil || arguments.length > 1)) { + self.$raise($$($nesting, 'ArgumentError'), "" + "wrong number of arguments (" + (arguments.length) + " expected 1)")}; + if ($truthy(pattern !== undefined)) { + block = $send(self, 'proc', [], (TMP_86 = function(e){var self = TMP_86.$$s || this; + + + + if (e == null) { + e = nil; + }; + return pattern['$==='](e);}, TMP_86.$$s = self, TMP_86.$$arity = 1, TMP_86))}; + return $send($$($nesting, 'Enumerator'), 'new', [], (TMP_87 = function(yielder){var self = TMP_87.$$s || this; + + + + if (yielder == null) { + yielder = nil; + }; + + var accumulate; + + self.$each.$$p = function() { + var element = $$($nesting, 'Opal').$destructure(arguments), + end_chunk = Opal.yield1(block, element); + + if (accumulate == null) { + accumulate = []; + } + + if ($truthy(end_chunk)) { + accumulate.push(element); + yielder.$yield(accumulate); + accumulate = null; + } else { + accumulate.push(element) + } + } + + self.$each(); + + if (accumulate != null) { + yielder.$yield(accumulate); + } + ;}, TMP_87.$$s = self, TMP_87.$$arity = 1, TMP_87)); + }, TMP_Enumerable_slice_after_85.$$arity = -1); + + Opal.def(self, '$slice_when', TMP_Enumerable_slice_when_88 = function $$slice_when() { + var $iter = TMP_Enumerable_slice_when_88.$$p, block = $iter || nil, TMP_89, self = this; + + if ($iter) TMP_Enumerable_slice_when_88.$$p = null; + + + if ($iter) TMP_Enumerable_slice_when_88.$$p = null;; + if ((block !== nil)) { + } else { + self.$raise($$($nesting, 'ArgumentError'), "wrong number of arguments (0 for 1)") + }; + return $send($$($nesting, 'Enumerator'), 'new', [], (TMP_89 = function(yielder){var self = TMP_89.$$s || this; + + + + if (yielder == null) { + yielder = nil; + }; + + var slice = nil, last_after = nil; + + self.$each_cons.$$p = function() { + var params = $$($nesting, 'Opal').$destructure(arguments), + before = params[0], + after = params[1], + match = Opal.yieldX(block, [before, after]); + + last_after = after; + + if (slice === nil) { + slice = []; + } + + if ($truthy(match)) { + slice.push(before); + yielder.$yield(slice); + slice = []; + } else { + slice.push(before); + } + } + + self.$each_cons(2); + + if (slice !== nil) { + slice.push(last_after); + yielder.$yield(slice); + } + ;}, TMP_89.$$s = self, TMP_89.$$arity = 1, TMP_89)); + }, TMP_Enumerable_slice_when_88.$$arity = 0); + + Opal.def(self, '$sort', TMP_Enumerable_sort_90 = function $$sort() { + var $iter = TMP_Enumerable_sort_90.$$p, block = $iter || nil, TMP_91, self = this, ary = nil; + + if ($iter) TMP_Enumerable_sort_90.$$p = null; + + + if ($iter) TMP_Enumerable_sort_90.$$p = null;; + ary = self.$to_a(); + if ((block !== nil)) { + } else { + block = $lambda((TMP_91 = function(a, b){var self = TMP_91.$$s || this; + + + + if (a == null) { + a = nil; + }; + + if (b == null) { + b = nil; + }; + return a['$<=>'](b);}, TMP_91.$$s = self, TMP_91.$$arity = 2, TMP_91)) + }; + return $send(ary, 'sort', [], block.$to_proc()); + }, TMP_Enumerable_sort_90.$$arity = 0); + + Opal.def(self, '$sort_by', TMP_Enumerable_sort_by_92 = function $$sort_by() { + var $iter = TMP_Enumerable_sort_by_92.$$p, block = $iter || nil, TMP_93, TMP_94, TMP_95, TMP_96, self = this, dup = nil; + + if ($iter) TMP_Enumerable_sort_by_92.$$p = null; + + + if ($iter) TMP_Enumerable_sort_by_92.$$p = null;; + if ((block !== nil)) { + } else { + return $send(self, 'enum_for', ["sort_by"], (TMP_93 = function(){var self = TMP_93.$$s || this; + + return self.$enumerator_size()}, TMP_93.$$s = self, TMP_93.$$arity = 0, TMP_93)) + }; + dup = $send(self, 'map', [], (TMP_94 = function(){var self = TMP_94.$$s || this, arg = nil; + + + arg = $$($nesting, 'Opal').$destructure(arguments); + return [Opal.yield1(block, arg), arg];}, TMP_94.$$s = self, TMP_94.$$arity = 0, TMP_94)); + $send(dup, 'sort!', [], (TMP_95 = function(a, b){var self = TMP_95.$$s || this; + + + + if (a == null) { + a = nil; + }; + + if (b == null) { + b = nil; + }; + return (a[0])['$<=>'](b[0]);}, TMP_95.$$s = self, TMP_95.$$arity = 2, TMP_95)); + return $send(dup, 'map!', [], (TMP_96 = function(i){var self = TMP_96.$$s || this; + + + + if (i == null) { + i = nil; + }; + return i[1];;}, TMP_96.$$s = self, TMP_96.$$arity = 1, TMP_96)); + }, TMP_Enumerable_sort_by_92.$$arity = 0); + + Opal.def(self, '$sum', TMP_Enumerable_sum_97 = function $$sum(initial) { + var TMP_98, $iter = TMP_Enumerable_sum_97.$$p, $yield = $iter || nil, self = this, result = nil; + + if ($iter) TMP_Enumerable_sum_97.$$p = null; + + + if (initial == null) { + initial = 0; + }; + result = initial; + $send(self, 'each', [], (TMP_98 = function($a){var self = TMP_98.$$s || this, $post_args, args, item = nil; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + item = (function() {if (($yield !== nil)) { + return Opal.yieldX($yield, Opal.to_a(args)); + } else { + return $$($nesting, 'Opal').$destructure(args) + }; return nil; })(); + return (result = $rb_plus(result, item));}, TMP_98.$$s = self, TMP_98.$$arity = -1, TMP_98)); + return result; + }, TMP_Enumerable_sum_97.$$arity = -1); + + Opal.def(self, '$take', TMP_Enumerable_take_99 = function $$take(num) { + var self = this; + + return self.$first(num) + }, TMP_Enumerable_take_99.$$arity = 1); + + Opal.def(self, '$take_while', TMP_Enumerable_take_while_100 = function $$take_while() {try { + + var $iter = TMP_Enumerable_take_while_100.$$p, block = $iter || nil, TMP_101, self = this, result = nil; + + if ($iter) TMP_Enumerable_take_while_100.$$p = null; + + + if ($iter) TMP_Enumerable_take_while_100.$$p = null;; + if ($truthy(block)) { + } else { + return self.$enum_for("take_while") + }; + result = []; + return $send(self, 'each', [], (TMP_101 = function($a){var self = TMP_101.$$s || this, $post_args, args, value = nil; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + value = $$($nesting, 'Opal').$destructure(args); + if ($truthy(Opal.yield1(block, value))) { + } else { + Opal.ret(result) + }; + return result.push(value);;}, TMP_101.$$s = self, TMP_101.$$arity = -1, TMP_101)); + } catch ($returner) { if ($returner === Opal.returner) { return $returner.$v } throw $returner; } + }, TMP_Enumerable_take_while_100.$$arity = 0); + + Opal.def(self, '$uniq', TMP_Enumerable_uniq_102 = function $$uniq() { + var $iter = TMP_Enumerable_uniq_102.$$p, block = $iter || nil, TMP_103, self = this, hash = nil; + + if ($iter) TMP_Enumerable_uniq_102.$$p = null; + + + if ($iter) TMP_Enumerable_uniq_102.$$p = null;; + hash = $hash2([], {}); + $send(self, 'each', [], (TMP_103 = function($a){var self = TMP_103.$$s || this, $post_args, args, value = nil, produced = nil, $writer = nil; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + value = $$($nesting, 'Opal').$destructure(args); + produced = (function() {if ((block !== nil)) { + return Opal.yield1(block, value); + } else { + return value + }; return nil; })(); + if ($truthy(hash['$key?'](produced))) { + return nil + } else { + + $writer = [produced, value]; + $send(hash, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + };}, TMP_103.$$s = self, TMP_103.$$arity = -1, TMP_103)); + return hash.$values(); + }, TMP_Enumerable_uniq_102.$$arity = 0); + Opal.alias(self, "to_a", "entries"); + + Opal.def(self, '$zip', TMP_Enumerable_zip_104 = function $$zip($a) { + var $iter = TMP_Enumerable_zip_104.$$p, block = $iter || nil, $post_args, others, self = this; + + if ($iter) TMP_Enumerable_zip_104.$$p = null; + + + if ($iter) TMP_Enumerable_zip_104.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + others = $post_args;; + return $send(self.$to_a(), 'zip', Opal.to_a(others)); + }, TMP_Enumerable_zip_104.$$arity = -1); + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/enumerator"] = function(Opal) { + function $rb_plus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); + } + function $rb_lt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $truthy = Opal.truthy, $send = Opal.send, $falsy = Opal.falsy; + + Opal.add_stubs(['$require', '$include', '$allocate', '$new', '$to_proc', '$coerce_to', '$nil?', '$empty?', '$+', '$class', '$__send__', '$===', '$call', '$enum_for', '$size', '$destructure', '$inspect', '$any?', '$[]', '$raise', '$yield', '$each', '$enumerator_size', '$respond_to?', '$try_convert', '$<', '$for']); + + self.$require("corelib/enumerable"); + return (function($base, $super, $parent_nesting) { + function $Enumerator(){}; + var self = $Enumerator = $klass($base, $super, 'Enumerator', $Enumerator); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Enumerator_for_1, TMP_Enumerator_initialize_2, TMP_Enumerator_each_3, TMP_Enumerator_size_4, TMP_Enumerator_with_index_5, TMP_Enumerator_inspect_7; + + def.size = def.args = def.object = def.method = nil; + + self.$include($$($nesting, 'Enumerable')); + def.$$is_enumerator = true; + Opal.defs(self, '$for', TMP_Enumerator_for_1 = function(object, $a, $b) { + var $iter = TMP_Enumerator_for_1.$$p, block = $iter || nil, $post_args, method, args, self = this; + + if ($iter) TMP_Enumerator_for_1.$$p = null; + + + if ($iter) TMP_Enumerator_for_1.$$p = null;; + + $post_args = Opal.slice.call(arguments, 1, arguments.length); + + if ($post_args.length > 0) { + method = $post_args[0]; + $post_args.splice(0, 1); + } + if (method == null) { + method = "each"; + }; + + args = $post_args;; + + var obj = self.$allocate(); + + obj.object = object; + obj.size = block; + obj.method = method; + obj.args = args; + + return obj; + ; + }, TMP_Enumerator_for_1.$$arity = -2); + + Opal.def(self, '$initialize', TMP_Enumerator_initialize_2 = function $$initialize($a) { + var $iter = TMP_Enumerator_initialize_2.$$p, block = $iter || nil, $post_args, self = this; + + if ($iter) TMP_Enumerator_initialize_2.$$p = null; + + + if ($iter) TMP_Enumerator_initialize_2.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + if ($truthy(block)) { + + self.object = $send($$($nesting, 'Generator'), 'new', [], block.$to_proc()); + self.method = "each"; + self.args = []; + self.size = arguments[0] || nil; + if ($truthy(self.size)) { + return (self.size = $$($nesting, 'Opal').$coerce_to(self.size, $$($nesting, 'Integer'), "to_int")) + } else { + return nil + }; + } else { + + self.object = arguments[0]; + self.method = arguments[1] || "each"; + self.args = $slice.call(arguments, 2); + return (self.size = nil); + }; + }, TMP_Enumerator_initialize_2.$$arity = -1); + + Opal.def(self, '$each', TMP_Enumerator_each_3 = function $$each($a) { + var $iter = TMP_Enumerator_each_3.$$p, block = $iter || nil, $post_args, args, $b, self = this; + + if ($iter) TMP_Enumerator_each_3.$$p = null; + + + if ($iter) TMP_Enumerator_each_3.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + if ($truthy(($truthy($b = block['$nil?']()) ? args['$empty?']() : $b))) { + return self}; + args = $rb_plus(self.args, args); + if ($truthy(block['$nil?']())) { + return $send(self.$class(), 'new', [self.object, self.method].concat(Opal.to_a(args)))}; + return $send(self.object, '__send__', [self.method].concat(Opal.to_a(args)), block.$to_proc()); + }, TMP_Enumerator_each_3.$$arity = -1); + + Opal.def(self, '$size', TMP_Enumerator_size_4 = function $$size() { + var self = this; + + if ($truthy($$($nesting, 'Proc')['$==='](self.size))) { + return $send(self.size, 'call', Opal.to_a(self.args)) + } else { + return self.size + } + }, TMP_Enumerator_size_4.$$arity = 0); + + Opal.def(self, '$with_index', TMP_Enumerator_with_index_5 = function $$with_index(offset) { + var $iter = TMP_Enumerator_with_index_5.$$p, block = $iter || nil, TMP_6, self = this; + + if ($iter) TMP_Enumerator_with_index_5.$$p = null; + + + if ($iter) TMP_Enumerator_with_index_5.$$p = null;; + + if (offset == null) { + offset = 0; + }; + offset = (function() {if ($truthy(offset)) { + return $$($nesting, 'Opal').$coerce_to(offset, $$($nesting, 'Integer'), "to_int") + } else { + return 0 + }; return nil; })(); + if ($truthy(block)) { + } else { + return $send(self, 'enum_for', ["with_index", offset], (TMP_6 = function(){var self = TMP_6.$$s || this; + + return self.$size()}, TMP_6.$$s = self, TMP_6.$$arity = 0, TMP_6)) + }; + + var result, index = offset; + + self.$each.$$p = function() { + var param = $$($nesting, 'Opal').$destructure(arguments), + value = block(param, index); + + index++; + + return value; + } + + return self.$each(); + ; + }, TMP_Enumerator_with_index_5.$$arity = -1); + Opal.alias(self, "with_object", "each_with_object"); + + Opal.def(self, '$inspect', TMP_Enumerator_inspect_7 = function $$inspect() { + var self = this, result = nil; + + + result = "" + "#<" + (self.$class()) + ": " + (self.object.$inspect()) + ":" + (self.method); + if ($truthy(self.args['$any?']())) { + result = $rb_plus(result, "" + "(" + (self.args.$inspect()['$[]']($$($nesting, 'Range').$new(1, -2))) + ")")}; + return $rb_plus(result, ">"); + }, TMP_Enumerator_inspect_7.$$arity = 0); + (function($base, $super, $parent_nesting) { + function $Generator(){}; + var self = $Generator = $klass($base, $super, 'Generator', $Generator); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Generator_initialize_8, TMP_Generator_each_9; + + def.block = nil; + + self.$include($$($nesting, 'Enumerable')); + + Opal.def(self, '$initialize', TMP_Generator_initialize_8 = function $$initialize() { + var $iter = TMP_Generator_initialize_8.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Generator_initialize_8.$$p = null; + + + if ($iter) TMP_Generator_initialize_8.$$p = null;; + if ($truthy(block)) { + } else { + self.$raise($$($nesting, 'LocalJumpError'), "no block given") + }; + return (self.block = block); + }, TMP_Generator_initialize_8.$$arity = 0); + return (Opal.def(self, '$each', TMP_Generator_each_9 = function $$each($a) { + var $iter = TMP_Generator_each_9.$$p, block = $iter || nil, $post_args, args, self = this, yielder = nil; + + if ($iter) TMP_Generator_each_9.$$p = null; + + + if ($iter) TMP_Generator_each_9.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + yielder = $send($$($nesting, 'Yielder'), 'new', [], block.$to_proc()); + + try { + args.unshift(yielder); + + Opal.yieldX(self.block, args); + } + catch (e) { + if (e === $breaker) { + return $breaker.$v; + } + else { + throw e; + } + } + ; + return self; + }, TMP_Generator_each_9.$$arity = -1), nil) && 'each'; + })($nesting[0], null, $nesting); + (function($base, $super, $parent_nesting) { + function $Yielder(){}; + var self = $Yielder = $klass($base, $super, 'Yielder', $Yielder); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Yielder_initialize_10, TMP_Yielder_yield_11, TMP_Yielder_$lt$lt_12; + + def.block = nil; + + + Opal.def(self, '$initialize', TMP_Yielder_initialize_10 = function $$initialize() { + var $iter = TMP_Yielder_initialize_10.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Yielder_initialize_10.$$p = null; + + + if ($iter) TMP_Yielder_initialize_10.$$p = null;; + return (self.block = block); + }, TMP_Yielder_initialize_10.$$arity = 0); + + Opal.def(self, '$yield', TMP_Yielder_yield_11 = function($a) { + var $post_args, values, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + values = $post_args;; + + var value = Opal.yieldX(self.block, values); + + if (value === $breaker) { + throw $breaker; + } + + return value; + ; + }, TMP_Yielder_yield_11.$$arity = -1); + return (Opal.def(self, '$<<', TMP_Yielder_$lt$lt_12 = function($a) { + var $post_args, values, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + values = $post_args;; + $send(self, 'yield', Opal.to_a(values)); + return self; + }, TMP_Yielder_$lt$lt_12.$$arity = -1), nil) && '<<'; + })($nesting[0], null, $nesting); + return (function($base, $super, $parent_nesting) { + function $Lazy(){}; + var self = $Lazy = $klass($base, $super, 'Lazy', $Lazy); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Lazy_initialize_13, TMP_Lazy_lazy_16, TMP_Lazy_collect_17, TMP_Lazy_collect_concat_19, TMP_Lazy_drop_23, TMP_Lazy_drop_while_25, TMP_Lazy_enum_for_27, TMP_Lazy_find_all_28, TMP_Lazy_grep_30, TMP_Lazy_reject_33, TMP_Lazy_take_35, TMP_Lazy_take_while_37, TMP_Lazy_inspect_39; + + def.enumerator = nil; + + (function($base, $super, $parent_nesting) { + function $StopLazyError(){}; + var self = $StopLazyError = $klass($base, $super, 'StopLazyError', $StopLazyError); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return nil + })($nesting[0], $$($nesting, 'Exception'), $nesting); + + Opal.def(self, '$initialize', TMP_Lazy_initialize_13 = function $$initialize(object, size) { + var $iter = TMP_Lazy_initialize_13.$$p, block = $iter || nil, TMP_14, self = this; + + if ($iter) TMP_Lazy_initialize_13.$$p = null; + + + if ($iter) TMP_Lazy_initialize_13.$$p = null;; + + if (size == null) { + size = nil; + }; + if ((block !== nil)) { + } else { + self.$raise($$($nesting, 'ArgumentError'), "tried to call lazy new without a block") + }; + self.enumerator = object; + return $send(self, Opal.find_super_dispatcher(self, 'initialize', TMP_Lazy_initialize_13, false), [size], (TMP_14 = function(yielder, $a){var self = TMP_14.$$s || this, $post_args, each_args, TMP_15; + + + + if (yielder == null) { + yielder = nil; + }; + + $post_args = Opal.slice.call(arguments, 1, arguments.length); + + each_args = $post_args;; + try { + return $send(object, 'each', Opal.to_a(each_args), (TMP_15 = function($b){var self = TMP_15.$$s || this, $post_args, args; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + + args.unshift(yielder); + + Opal.yieldX(block, args); + ;}, TMP_15.$$s = self, TMP_15.$$arity = -1, TMP_15)) + } catch ($err) { + if (Opal.rescue($err, [$$($nesting, 'Exception')])) { + try { + return nil + } finally { Opal.pop_exception() } + } else { throw $err; } + };}, TMP_14.$$s = self, TMP_14.$$arity = -2, TMP_14)); + }, TMP_Lazy_initialize_13.$$arity = -2); + Opal.alias(self, "force", "to_a"); + + Opal.def(self, '$lazy', TMP_Lazy_lazy_16 = function $$lazy() { + var self = this; + + return self + }, TMP_Lazy_lazy_16.$$arity = 0); + + Opal.def(self, '$collect', TMP_Lazy_collect_17 = function $$collect() { + var $iter = TMP_Lazy_collect_17.$$p, block = $iter || nil, TMP_18, self = this; + + if ($iter) TMP_Lazy_collect_17.$$p = null; + + + if ($iter) TMP_Lazy_collect_17.$$p = null;; + if ($truthy(block)) { + } else { + self.$raise($$($nesting, 'ArgumentError'), "tried to call lazy map without a block") + }; + return $send($$($nesting, 'Lazy'), 'new', [self, self.$enumerator_size()], (TMP_18 = function(enum$, $a){var self = TMP_18.$$s || this, $post_args, args; + + + + if (enum$ == null) { + enum$ = nil; + }; + + $post_args = Opal.slice.call(arguments, 1, arguments.length); + + args = $post_args;; + + var value = Opal.yieldX(block, args); + + enum$.$yield(value); + ;}, TMP_18.$$s = self, TMP_18.$$arity = -2, TMP_18)); + }, TMP_Lazy_collect_17.$$arity = 0); + + Opal.def(self, '$collect_concat', TMP_Lazy_collect_concat_19 = function $$collect_concat() { + var $iter = TMP_Lazy_collect_concat_19.$$p, block = $iter || nil, TMP_20, self = this; + + if ($iter) TMP_Lazy_collect_concat_19.$$p = null; + + + if ($iter) TMP_Lazy_collect_concat_19.$$p = null;; + if ($truthy(block)) { + } else { + self.$raise($$($nesting, 'ArgumentError'), "tried to call lazy map without a block") + }; + return $send($$($nesting, 'Lazy'), 'new', [self, nil], (TMP_20 = function(enum$, $a){var self = TMP_20.$$s || this, $post_args, args, TMP_21, TMP_22; + + + + if (enum$ == null) { + enum$ = nil; + }; + + $post_args = Opal.slice.call(arguments, 1, arguments.length); + + args = $post_args;; + + var value = Opal.yieldX(block, args); + + if ((value)['$respond_to?']("force") && (value)['$respond_to?']("each")) { + $send((value), 'each', [], (TMP_21 = function(v){var self = TMP_21.$$s || this; + + + + if (v == null) { + v = nil; + }; + return enum$.$yield(v);}, TMP_21.$$s = self, TMP_21.$$arity = 1, TMP_21)) + } + else { + var array = $$($nesting, 'Opal').$try_convert(value, $$($nesting, 'Array'), "to_ary"); + + if (array === nil) { + enum$.$yield(value); + } + else { + $send((value), 'each', [], (TMP_22 = function(v){var self = TMP_22.$$s || this; + + + + if (v == null) { + v = nil; + }; + return enum$.$yield(v);}, TMP_22.$$s = self, TMP_22.$$arity = 1, TMP_22)); + } + } + ;}, TMP_20.$$s = self, TMP_20.$$arity = -2, TMP_20)); + }, TMP_Lazy_collect_concat_19.$$arity = 0); + + Opal.def(self, '$drop', TMP_Lazy_drop_23 = function $$drop(n) { + var TMP_24, self = this, current_size = nil, set_size = nil, dropped = nil; + + + n = $$($nesting, 'Opal').$coerce_to(n, $$($nesting, 'Integer'), "to_int"); + if ($truthy($rb_lt(n, 0))) { + self.$raise($$($nesting, 'ArgumentError'), "attempt to drop negative size")}; + current_size = self.$enumerator_size(); + set_size = (function() {if ($truthy($$($nesting, 'Integer')['$==='](current_size))) { + if ($truthy($rb_lt(n, current_size))) { + return n + } else { + return current_size + } + } else { + return current_size + }; return nil; })(); + dropped = 0; + return $send($$($nesting, 'Lazy'), 'new', [self, set_size], (TMP_24 = function(enum$, $a){var self = TMP_24.$$s || this, $post_args, args; + + + + if (enum$ == null) { + enum$ = nil; + }; + + $post_args = Opal.slice.call(arguments, 1, arguments.length); + + args = $post_args;; + if ($truthy($rb_lt(dropped, n))) { + return (dropped = $rb_plus(dropped, 1)) + } else { + return $send(enum$, 'yield', Opal.to_a(args)) + };}, TMP_24.$$s = self, TMP_24.$$arity = -2, TMP_24)); + }, TMP_Lazy_drop_23.$$arity = 1); + + Opal.def(self, '$drop_while', TMP_Lazy_drop_while_25 = function $$drop_while() { + var $iter = TMP_Lazy_drop_while_25.$$p, block = $iter || nil, TMP_26, self = this, succeeding = nil; + + if ($iter) TMP_Lazy_drop_while_25.$$p = null; + + + if ($iter) TMP_Lazy_drop_while_25.$$p = null;; + if ($truthy(block)) { + } else { + self.$raise($$($nesting, 'ArgumentError'), "tried to call lazy drop_while without a block") + }; + succeeding = true; + return $send($$($nesting, 'Lazy'), 'new', [self, nil], (TMP_26 = function(enum$, $a){var self = TMP_26.$$s || this, $post_args, args; + + + + if (enum$ == null) { + enum$ = nil; + }; + + $post_args = Opal.slice.call(arguments, 1, arguments.length); + + args = $post_args;; + if ($truthy(succeeding)) { + + var value = Opal.yieldX(block, args); + + if ($falsy(value)) { + succeeding = false; + + $send(enum$, 'yield', Opal.to_a(args)); + } + + } else { + return $send(enum$, 'yield', Opal.to_a(args)) + };}, TMP_26.$$s = self, TMP_26.$$arity = -2, TMP_26)); + }, TMP_Lazy_drop_while_25.$$arity = 0); + + Opal.def(self, '$enum_for', TMP_Lazy_enum_for_27 = function $$enum_for($a, $b) { + var $iter = TMP_Lazy_enum_for_27.$$p, block = $iter || nil, $post_args, method, args, self = this; + + if ($iter) TMP_Lazy_enum_for_27.$$p = null; + + + if ($iter) TMP_Lazy_enum_for_27.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + if ($post_args.length > 0) { + method = $post_args[0]; + $post_args.splice(0, 1); + } + if (method == null) { + method = "each"; + }; + + args = $post_args;; + return $send(self.$class(), 'for', [self, method].concat(Opal.to_a(args)), block.$to_proc()); + }, TMP_Lazy_enum_for_27.$$arity = -1); + + Opal.def(self, '$find_all', TMP_Lazy_find_all_28 = function $$find_all() { + var $iter = TMP_Lazy_find_all_28.$$p, block = $iter || nil, TMP_29, self = this; + + if ($iter) TMP_Lazy_find_all_28.$$p = null; + + + if ($iter) TMP_Lazy_find_all_28.$$p = null;; + if ($truthy(block)) { + } else { + self.$raise($$($nesting, 'ArgumentError'), "tried to call lazy select without a block") + }; + return $send($$($nesting, 'Lazy'), 'new', [self, nil], (TMP_29 = function(enum$, $a){var self = TMP_29.$$s || this, $post_args, args; + + + + if (enum$ == null) { + enum$ = nil; + }; + + $post_args = Opal.slice.call(arguments, 1, arguments.length); + + args = $post_args;; + + var value = Opal.yieldX(block, args); + + if ($truthy(value)) { + $send(enum$, 'yield', Opal.to_a(args)); + } + ;}, TMP_29.$$s = self, TMP_29.$$arity = -2, TMP_29)); + }, TMP_Lazy_find_all_28.$$arity = 0); + Opal.alias(self, "flat_map", "collect_concat"); + + Opal.def(self, '$grep', TMP_Lazy_grep_30 = function $$grep(pattern) { + var $iter = TMP_Lazy_grep_30.$$p, block = $iter || nil, TMP_31, TMP_32, self = this; + + if ($iter) TMP_Lazy_grep_30.$$p = null; + + + if ($iter) TMP_Lazy_grep_30.$$p = null;; + if ($truthy(block)) { + return $send($$($nesting, 'Lazy'), 'new', [self, nil], (TMP_31 = function(enum$, $a){var self = TMP_31.$$s || this, $post_args, args; + + + + if (enum$ == null) { + enum$ = nil; + }; + + $post_args = Opal.slice.call(arguments, 1, arguments.length); + + args = $post_args;; + + var param = $$($nesting, 'Opal').$destructure(args), + value = pattern['$==='](param); + + if ($truthy(value)) { + value = Opal.yield1(block, param); + + enum$.$yield(Opal.yield1(block, param)); + } + ;}, TMP_31.$$s = self, TMP_31.$$arity = -2, TMP_31)) + } else { + return $send($$($nesting, 'Lazy'), 'new', [self, nil], (TMP_32 = function(enum$, $a){var self = TMP_32.$$s || this, $post_args, args; + + + + if (enum$ == null) { + enum$ = nil; + }; + + $post_args = Opal.slice.call(arguments, 1, arguments.length); + + args = $post_args;; + + var param = $$($nesting, 'Opal').$destructure(args), + value = pattern['$==='](param); + + if ($truthy(value)) { + enum$.$yield(param); + } + ;}, TMP_32.$$s = self, TMP_32.$$arity = -2, TMP_32)) + }; + }, TMP_Lazy_grep_30.$$arity = 1); + Opal.alias(self, "map", "collect"); + Opal.alias(self, "select", "find_all"); + + Opal.def(self, '$reject', TMP_Lazy_reject_33 = function $$reject() { + var $iter = TMP_Lazy_reject_33.$$p, block = $iter || nil, TMP_34, self = this; + + if ($iter) TMP_Lazy_reject_33.$$p = null; + + + if ($iter) TMP_Lazy_reject_33.$$p = null;; + if ($truthy(block)) { + } else { + self.$raise($$($nesting, 'ArgumentError'), "tried to call lazy reject without a block") + }; + return $send($$($nesting, 'Lazy'), 'new', [self, nil], (TMP_34 = function(enum$, $a){var self = TMP_34.$$s || this, $post_args, args; + + + + if (enum$ == null) { + enum$ = nil; + }; + + $post_args = Opal.slice.call(arguments, 1, arguments.length); + + args = $post_args;; + + var value = Opal.yieldX(block, args); + + if ($falsy(value)) { + $send(enum$, 'yield', Opal.to_a(args)); + } + ;}, TMP_34.$$s = self, TMP_34.$$arity = -2, TMP_34)); + }, TMP_Lazy_reject_33.$$arity = 0); + + Opal.def(self, '$take', TMP_Lazy_take_35 = function $$take(n) { + var TMP_36, self = this, current_size = nil, set_size = nil, taken = nil; + + + n = $$($nesting, 'Opal').$coerce_to(n, $$($nesting, 'Integer'), "to_int"); + if ($truthy($rb_lt(n, 0))) { + self.$raise($$($nesting, 'ArgumentError'), "attempt to take negative size")}; + current_size = self.$enumerator_size(); + set_size = (function() {if ($truthy($$($nesting, 'Integer')['$==='](current_size))) { + if ($truthy($rb_lt(n, current_size))) { + return n + } else { + return current_size + } + } else { + return current_size + }; return nil; })(); + taken = 0; + return $send($$($nesting, 'Lazy'), 'new', [self, set_size], (TMP_36 = function(enum$, $a){var self = TMP_36.$$s || this, $post_args, args; + + + + if (enum$ == null) { + enum$ = nil; + }; + + $post_args = Opal.slice.call(arguments, 1, arguments.length); + + args = $post_args;; + if ($truthy($rb_lt(taken, n))) { + + $send(enum$, 'yield', Opal.to_a(args)); + return (taken = $rb_plus(taken, 1)); + } else { + return self.$raise($$($nesting, 'StopLazyError')) + };}, TMP_36.$$s = self, TMP_36.$$arity = -2, TMP_36)); + }, TMP_Lazy_take_35.$$arity = 1); + + Opal.def(self, '$take_while', TMP_Lazy_take_while_37 = function $$take_while() { + var $iter = TMP_Lazy_take_while_37.$$p, block = $iter || nil, TMP_38, self = this; + + if ($iter) TMP_Lazy_take_while_37.$$p = null; + + + if ($iter) TMP_Lazy_take_while_37.$$p = null;; + if ($truthy(block)) { + } else { + self.$raise($$($nesting, 'ArgumentError'), "tried to call lazy take_while without a block") + }; + return $send($$($nesting, 'Lazy'), 'new', [self, nil], (TMP_38 = function(enum$, $a){var self = TMP_38.$$s || this, $post_args, args; + + + + if (enum$ == null) { + enum$ = nil; + }; + + $post_args = Opal.slice.call(arguments, 1, arguments.length); + + args = $post_args;; + + var value = Opal.yieldX(block, args); + + if ($truthy(value)) { + $send(enum$, 'yield', Opal.to_a(args)); + } + else { + self.$raise($$($nesting, 'StopLazyError')); + } + ;}, TMP_38.$$s = self, TMP_38.$$arity = -2, TMP_38)); + }, TMP_Lazy_take_while_37.$$arity = 0); + Opal.alias(self, "to_enum", "enum_for"); + return (Opal.def(self, '$inspect', TMP_Lazy_inspect_39 = function $$inspect() { + var self = this; + + return "" + "#<" + (self.$class()) + ": " + (self.enumerator.$inspect()) + ">" + }, TMP_Lazy_inspect_39.$$arity = 0), nil) && 'inspect'; + })($nesting[0], self, $nesting); + })($nesting[0], null, $nesting); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/numeric"] = function(Opal) { + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + function $rb_times(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs * rhs : lhs['$*'](rhs); + } + function $rb_lt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); + } + function $rb_divide(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs / rhs : lhs['$/'](rhs); + } + function $rb_gt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $truthy = Opal.truthy, $hash2 = Opal.hash2; + + Opal.add_stubs(['$require', '$include', '$instance_of?', '$class', '$Float', '$respond_to?', '$coerce', '$__send__', '$===', '$raise', '$equal?', '$-', '$*', '$div', '$<', '$-@', '$ceil', '$to_f', '$denominator', '$to_r', '$==', '$floor', '$/', '$%', '$Complex', '$zero?', '$numerator', '$abs', '$arg', '$coerce_to!', '$round', '$to_i', '$truncate', '$>']); + + self.$require("corelib/comparable"); + return (function($base, $super, $parent_nesting) { + function $Numeric(){}; + var self = $Numeric = $klass($base, $super, 'Numeric', $Numeric); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Numeric_coerce_1, TMP_Numeric___coerced___2, TMP_Numeric_$lt$eq$gt_3, TMP_Numeric_$$_4, TMP_Numeric_$$_5, TMP_Numeric_$_6, TMP_Numeric_abs_7, TMP_Numeric_abs2_8, TMP_Numeric_angle_9, TMP_Numeric_ceil_10, TMP_Numeric_conj_11, TMP_Numeric_denominator_12, TMP_Numeric_div_13, TMP_Numeric_divmod_14, TMP_Numeric_fdiv_15, TMP_Numeric_floor_16, TMP_Numeric_i_17, TMP_Numeric_imag_18, TMP_Numeric_integer$q_19, TMP_Numeric_nonzero$q_20, TMP_Numeric_numerator_21, TMP_Numeric_polar_22, TMP_Numeric_quo_23, TMP_Numeric_real_24, TMP_Numeric_real$q_25, TMP_Numeric_rect_26, TMP_Numeric_round_27, TMP_Numeric_to_c_28, TMP_Numeric_to_int_29, TMP_Numeric_truncate_30, TMP_Numeric_zero$q_31, TMP_Numeric_positive$q_32, TMP_Numeric_negative$q_33, TMP_Numeric_dup_34, TMP_Numeric_clone_35, TMP_Numeric_finite$q_36, TMP_Numeric_infinite$q_37; + + + self.$include($$($nesting, 'Comparable')); + + Opal.def(self, '$coerce', TMP_Numeric_coerce_1 = function $$coerce(other) { + var self = this; + + + if ($truthy(other['$instance_of?'](self.$class()))) { + return [other, self]}; + return [self.$Float(other), self.$Float(self)]; + }, TMP_Numeric_coerce_1.$$arity = 1); + + Opal.def(self, '$__coerced__', TMP_Numeric___coerced___2 = function $$__coerced__(method, other) { + var $a, $b, self = this, a = nil, b = nil, $case = nil; + + if ($truthy(other['$respond_to?']("coerce"))) { + + $b = other.$coerce(self), $a = Opal.to_ary($b), (a = ($a[0] == null ? nil : $a[0])), (b = ($a[1] == null ? nil : $a[1])), $b; + return a.$__send__(method, b); + } else { + return (function() {$case = method; + if ("+"['$===']($case) || "-"['$===']($case) || "*"['$===']($case) || "/"['$===']($case) || "%"['$===']($case) || "&"['$===']($case) || "|"['$===']($case) || "^"['$===']($case) || "**"['$===']($case)) {return self.$raise($$($nesting, 'TypeError'), "" + (other.$class()) + " can't be coerced into Numeric")} + else if (">"['$===']($case) || ">="['$===']($case) || "<"['$===']($case) || "<="['$===']($case) || "<=>"['$===']($case)) {return self.$raise($$($nesting, 'ArgumentError'), "" + "comparison of " + (self.$class()) + " with " + (other.$class()) + " failed")} + else { return nil }})() + } + }, TMP_Numeric___coerced___2.$$arity = 2); + + Opal.def(self, '$<=>', TMP_Numeric_$lt$eq$gt_3 = function(other) { + var self = this; + + + if ($truthy(self['$equal?'](other))) { + return 0}; + return nil; + }, TMP_Numeric_$lt$eq$gt_3.$$arity = 1); + + Opal.def(self, '$+@', TMP_Numeric_$$_4 = function() { + var self = this; + + return self + }, TMP_Numeric_$$_4.$$arity = 0); + + Opal.def(self, '$-@', TMP_Numeric_$$_5 = function() { + var self = this; + + return $rb_minus(0, self) + }, TMP_Numeric_$$_5.$$arity = 0); + + Opal.def(self, '$%', TMP_Numeric_$_6 = function(other) { + var self = this; + + return $rb_minus(self, $rb_times(other, self.$div(other))) + }, TMP_Numeric_$_6.$$arity = 1); + + Opal.def(self, '$abs', TMP_Numeric_abs_7 = function $$abs() { + var self = this; + + if ($rb_lt(self, 0)) { + return self['$-@']() + } else { + return self + } + }, TMP_Numeric_abs_7.$$arity = 0); + + Opal.def(self, '$abs2', TMP_Numeric_abs2_8 = function $$abs2() { + var self = this; + + return $rb_times(self, self) + }, TMP_Numeric_abs2_8.$$arity = 0); + + Opal.def(self, '$angle', TMP_Numeric_angle_9 = function $$angle() { + var self = this; + + if ($rb_lt(self, 0)) { + return $$$($$($nesting, 'Math'), 'PI') + } else { + return 0 + } + }, TMP_Numeric_angle_9.$$arity = 0); + Opal.alias(self, "arg", "angle"); + + Opal.def(self, '$ceil', TMP_Numeric_ceil_10 = function $$ceil(ndigits) { + var self = this; + + + + if (ndigits == null) { + ndigits = 0; + }; + return self.$to_f().$ceil(ndigits); + }, TMP_Numeric_ceil_10.$$arity = -1); + + Opal.def(self, '$conj', TMP_Numeric_conj_11 = function $$conj() { + var self = this; + + return self + }, TMP_Numeric_conj_11.$$arity = 0); + Opal.alias(self, "conjugate", "conj"); + + Opal.def(self, '$denominator', TMP_Numeric_denominator_12 = function $$denominator() { + var self = this; + + return self.$to_r().$denominator() + }, TMP_Numeric_denominator_12.$$arity = 0); + + Opal.def(self, '$div', TMP_Numeric_div_13 = function $$div(other) { + var self = this; + + + if (other['$=='](0)) { + self.$raise($$($nesting, 'ZeroDivisionError'), "divided by o")}; + return $rb_divide(self, other).$floor(); + }, TMP_Numeric_div_13.$$arity = 1); + + Opal.def(self, '$divmod', TMP_Numeric_divmod_14 = function $$divmod(other) { + var self = this; + + return [self.$div(other), self['$%'](other)] + }, TMP_Numeric_divmod_14.$$arity = 1); + + Opal.def(self, '$fdiv', TMP_Numeric_fdiv_15 = function $$fdiv(other) { + var self = this; + + return $rb_divide(self.$to_f(), other) + }, TMP_Numeric_fdiv_15.$$arity = 1); + + Opal.def(self, '$floor', TMP_Numeric_floor_16 = function $$floor(ndigits) { + var self = this; + + + + if (ndigits == null) { + ndigits = 0; + }; + return self.$to_f().$floor(ndigits); + }, TMP_Numeric_floor_16.$$arity = -1); + + Opal.def(self, '$i', TMP_Numeric_i_17 = function $$i() { + var self = this; + + return self.$Complex(0, self) + }, TMP_Numeric_i_17.$$arity = 0); + + Opal.def(self, '$imag', TMP_Numeric_imag_18 = function $$imag() { + var self = this; + + return 0 + }, TMP_Numeric_imag_18.$$arity = 0); + Opal.alias(self, "imaginary", "imag"); + + Opal.def(self, '$integer?', TMP_Numeric_integer$q_19 = function() { + var self = this; + + return false + }, TMP_Numeric_integer$q_19.$$arity = 0); + Opal.alias(self, "magnitude", "abs"); + Opal.alias(self, "modulo", "%"); + + Opal.def(self, '$nonzero?', TMP_Numeric_nonzero$q_20 = function() { + var self = this; + + if ($truthy(self['$zero?']())) { + return nil + } else { + return self + } + }, TMP_Numeric_nonzero$q_20.$$arity = 0); + + Opal.def(self, '$numerator', TMP_Numeric_numerator_21 = function $$numerator() { + var self = this; + + return self.$to_r().$numerator() + }, TMP_Numeric_numerator_21.$$arity = 0); + Opal.alias(self, "phase", "arg"); + + Opal.def(self, '$polar', TMP_Numeric_polar_22 = function $$polar() { + var self = this; + + return [self.$abs(), self.$arg()] + }, TMP_Numeric_polar_22.$$arity = 0); + + Opal.def(self, '$quo', TMP_Numeric_quo_23 = function $$quo(other) { + var self = this; + + return $rb_divide($$($nesting, 'Opal')['$coerce_to!'](self, $$($nesting, 'Rational'), "to_r"), other) + }, TMP_Numeric_quo_23.$$arity = 1); + + Opal.def(self, '$real', TMP_Numeric_real_24 = function $$real() { + var self = this; + + return self + }, TMP_Numeric_real_24.$$arity = 0); + + Opal.def(self, '$real?', TMP_Numeric_real$q_25 = function() { + var self = this; + + return true + }, TMP_Numeric_real$q_25.$$arity = 0); + + Opal.def(self, '$rect', TMP_Numeric_rect_26 = function $$rect() { + var self = this; + + return [self, 0] + }, TMP_Numeric_rect_26.$$arity = 0); + Opal.alias(self, "rectangular", "rect"); + + Opal.def(self, '$round', TMP_Numeric_round_27 = function $$round(digits) { + var self = this; + + + ; + return self.$to_f().$round(digits); + }, TMP_Numeric_round_27.$$arity = -1); + + Opal.def(self, '$to_c', TMP_Numeric_to_c_28 = function $$to_c() { + var self = this; + + return self.$Complex(self, 0) + }, TMP_Numeric_to_c_28.$$arity = 0); + + Opal.def(self, '$to_int', TMP_Numeric_to_int_29 = function $$to_int() { + var self = this; + + return self.$to_i() + }, TMP_Numeric_to_int_29.$$arity = 0); + + Opal.def(self, '$truncate', TMP_Numeric_truncate_30 = function $$truncate(ndigits) { + var self = this; + + + + if (ndigits == null) { + ndigits = 0; + }; + return self.$to_f().$truncate(ndigits); + }, TMP_Numeric_truncate_30.$$arity = -1); + + Opal.def(self, '$zero?', TMP_Numeric_zero$q_31 = function() { + var self = this; + + return self['$=='](0) + }, TMP_Numeric_zero$q_31.$$arity = 0); + + Opal.def(self, '$positive?', TMP_Numeric_positive$q_32 = function() { + var self = this; + + return $rb_gt(self, 0) + }, TMP_Numeric_positive$q_32.$$arity = 0); + + Opal.def(self, '$negative?', TMP_Numeric_negative$q_33 = function() { + var self = this; + + return $rb_lt(self, 0) + }, TMP_Numeric_negative$q_33.$$arity = 0); + + Opal.def(self, '$dup', TMP_Numeric_dup_34 = function $$dup() { + var self = this; + + return self + }, TMP_Numeric_dup_34.$$arity = 0); + + Opal.def(self, '$clone', TMP_Numeric_clone_35 = function $$clone($kwargs) { + var freeze, self = this; + + + + if ($kwargs == null) { + $kwargs = $hash2([], {}); + } else if (!$kwargs.$$is_hash) { + throw Opal.ArgumentError.$new('expected kwargs'); + }; + + freeze = $kwargs.$$smap["freeze"]; + if (freeze == null) { + freeze = true + }; + return self; + }, TMP_Numeric_clone_35.$$arity = -1); + + Opal.def(self, '$finite?', TMP_Numeric_finite$q_36 = function() { + var self = this; + + return true + }, TMP_Numeric_finite$q_36.$$arity = 0); + return (Opal.def(self, '$infinite?', TMP_Numeric_infinite$q_37 = function() { + var self = this; + + return nil + }, TMP_Numeric_infinite$q_37.$$arity = 0), nil) && 'infinite?'; + })($nesting[0], null, $nesting); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/array"] = function(Opal) { + function $rb_gt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); + } + function $rb_times(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs * rhs : lhs['$*'](rhs); + } + function $rb_ge(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs >= rhs : lhs['$>='](rhs); + } + function $rb_lt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); + } + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $truthy = Opal.truthy, $hash2 = Opal.hash2, $send = Opal.send, $gvars = Opal.gvars; + + Opal.add_stubs(['$require', '$include', '$to_a', '$warn', '$raise', '$replace', '$respond_to?', '$to_ary', '$coerce_to', '$coerce_to?', '$===', '$join', '$to_str', '$class', '$hash', '$<=>', '$==', '$object_id', '$inspect', '$enum_for', '$bsearch_index', '$to_proc', '$nil?', '$coerce_to!', '$>', '$*', '$enumerator_size', '$empty?', '$size', '$map', '$equal?', '$dup', '$each', '$[]', '$dig', '$eql?', '$length', '$begin', '$end', '$exclude_end?', '$flatten', '$__id__', '$to_s', '$new', '$max', '$min', '$!', '$>=', '$**', '$delete_if', '$reverse', '$rotate', '$rand', '$at', '$keep_if', '$shuffle!', '$<', '$sort', '$sort_by', '$!=', '$times', '$[]=', '$-', '$<<', '$values', '$is_a?', '$last', '$first', '$upto', '$reject', '$pristine', '$singleton_class']); + + self.$require("corelib/enumerable"); + self.$require("corelib/numeric"); + return (function($base, $super, $parent_nesting) { + function $Array(){}; + var self = $Array = $klass($base, $super, 'Array', $Array); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Array_$$_1, TMP_Array_initialize_2, TMP_Array_try_convert_3, TMP_Array_$_4, TMP_Array_$_5, TMP_Array_$_6, TMP_Array_$_7, TMP_Array_$_8, TMP_Array_$lt$lt_9, TMP_Array_$lt$eq$gt_10, TMP_Array_$eq$eq_11, TMP_Array_$$_12, TMP_Array_$$$eq_13, TMP_Array_any$q_14, TMP_Array_assoc_15, TMP_Array_at_16, TMP_Array_bsearch_index_17, TMP_Array_bsearch_18, TMP_Array_cycle_19, TMP_Array_clear_21, TMP_Array_count_22, TMP_Array_initialize_copy_23, TMP_Array_collect_24, TMP_Array_collect$B_26, TMP_Array_combination_28, TMP_Array_repeated_combination_30, TMP_Array_compact_32, TMP_Array_compact$B_33, TMP_Array_concat_34, TMP_Array_delete_37, TMP_Array_delete_at_38, TMP_Array_delete_if_39, TMP_Array_dig_41, TMP_Array_drop_42, TMP_Array_dup_43, TMP_Array_each_44, TMP_Array_each_index_46, TMP_Array_empty$q_48, TMP_Array_eql$q_49, TMP_Array_fetch_50, TMP_Array_fill_51, TMP_Array_first_52, TMP_Array_flatten_53, TMP_Array_flatten$B_54, TMP_Array_hash_55, TMP_Array_include$q_56, TMP_Array_index_57, TMP_Array_insert_58, TMP_Array_inspect_59, TMP_Array_join_60, TMP_Array_keep_if_61, TMP_Array_last_63, TMP_Array_length_64, TMP_Array_max_65, TMP_Array_min_66, TMP_Array_permutation_67, TMP_Array_repeated_permutation_69, TMP_Array_pop_71, TMP_Array_product_72, TMP_Array_push_73, TMP_Array_rassoc_74, TMP_Array_reject_75, TMP_Array_reject$B_77, TMP_Array_replace_79, TMP_Array_reverse_80, TMP_Array_reverse$B_81, TMP_Array_reverse_each_82, TMP_Array_rindex_84, TMP_Array_rotate_85, TMP_Array_rotate$B_86, TMP_Array_sample_89, TMP_Array_select_90, TMP_Array_select$B_92, TMP_Array_shift_94, TMP_Array_shuffle_95, TMP_Array_shuffle$B_96, TMP_Array_slice$B_97, TMP_Array_sort_98, TMP_Array_sort$B_99, TMP_Array_sort_by$B_100, TMP_Array_take_102, TMP_Array_take_while_103, TMP_Array_to_a_104, TMP_Array_to_h_105, TMP_Array_transpose_106, TMP_Array_uniq_109, TMP_Array_uniq$B_110, TMP_Array_unshift_111, TMP_Array_values_at_112, TMP_Array_zip_115, TMP_Array_inherited_116, TMP_Array_instance_variables_117, TMP_Array_pack_119; + + + self.$include($$($nesting, 'Enumerable')); + Opal.defineProperty(Array.prototype, '$$is_array', true); + + function toArraySubclass(obj, klass) { + if (klass.$$name === Opal.Array) { + return obj; + } else { + return klass.$allocate().$replace((obj).$to_a()); + } + } + ; + Opal.defs(self, '$[]', TMP_Array_$$_1 = function($a) { + var $post_args, objects, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + objects = $post_args;; + return toArraySubclass(objects, self);; + }, TMP_Array_$$_1.$$arity = -1); + + Opal.def(self, '$initialize', TMP_Array_initialize_2 = function $$initialize(size, obj) { + var $iter = TMP_Array_initialize_2.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Array_initialize_2.$$p = null; + + + if ($iter) TMP_Array_initialize_2.$$p = null;; + + if (size == null) { + size = nil; + }; + + if (obj == null) { + obj = nil; + }; + + if (obj !== nil && block !== nil) { + self.$warn("warning: block supersedes default value argument") + } + + if (size > $$$($$($nesting, 'Integer'), 'MAX')) { + self.$raise($$($nesting, 'ArgumentError'), "array size too big") + } + + if (arguments.length > 2) { + self.$raise($$($nesting, 'ArgumentError'), "" + "wrong number of arguments (" + (arguments.length) + " for 0..2)") + } + + if (arguments.length === 0) { + self.splice(0, self.length); + return self; + } + + if (arguments.length === 1) { + if (size.$$is_array) { + self.$replace(size.$to_a()) + return self; + } else if (size['$respond_to?']("to_ary")) { + self.$replace(size.$to_ary()) + return self; + } + } + + size = $$($nesting, 'Opal').$coerce_to(size, $$($nesting, 'Integer'), "to_int") + + if (size < 0) { + self.$raise($$($nesting, 'ArgumentError'), "negative array size") + } + + self.splice(0, self.length); + var i, value; + + if (block === nil) { + for (i = 0; i < size; i++) { + self.push(obj); + } + } + else { + for (i = 0, value; i < size; i++) { + value = block(i); + self[i] = value; + } + } + + return self; + ; + }, TMP_Array_initialize_2.$$arity = -1); + Opal.defs(self, '$try_convert', TMP_Array_try_convert_3 = function $$try_convert(obj) { + var self = this; + + return $$($nesting, 'Opal')['$coerce_to?'](obj, $$($nesting, 'Array'), "to_ary") + }, TMP_Array_try_convert_3.$$arity = 1); + + Opal.def(self, '$&', TMP_Array_$_4 = function(other) { + var self = this; + + + other = (function() {if ($truthy($$($nesting, 'Array')['$==='](other))) { + return other.$to_a() + } else { + return $$($nesting, 'Opal').$coerce_to(other, $$($nesting, 'Array'), "to_ary").$to_a() + }; return nil; })(); + + var result = [], hash = $hash2([], {}), i, length, item; + + for (i = 0, length = other.length; i < length; i++) { + Opal.hash_put(hash, other[i], true); + } + + for (i = 0, length = self.length; i < length; i++) { + item = self[i]; + if (Opal.hash_delete(hash, item) !== undefined) { + result.push(item); + } + } + + return result; + ; + }, TMP_Array_$_4.$$arity = 1); + + Opal.def(self, '$|', TMP_Array_$_5 = function(other) { + var self = this; + + + other = (function() {if ($truthy($$($nesting, 'Array')['$==='](other))) { + return other.$to_a() + } else { + return $$($nesting, 'Opal').$coerce_to(other, $$($nesting, 'Array'), "to_ary").$to_a() + }; return nil; })(); + + var hash = $hash2([], {}), i, length, item; + + for (i = 0, length = self.length; i < length; i++) { + Opal.hash_put(hash, self[i], true); + } + + for (i = 0, length = other.length; i < length; i++) { + Opal.hash_put(hash, other[i], true); + } + + return hash.$keys(); + ; + }, TMP_Array_$_5.$$arity = 1); + + Opal.def(self, '$*', TMP_Array_$_6 = function(other) { + var self = this; + + + if ($truthy(other['$respond_to?']("to_str"))) { + return self.$join(other.$to_str())}; + other = $$($nesting, 'Opal').$coerce_to(other, $$($nesting, 'Integer'), "to_int"); + if ($truthy(other < 0)) { + self.$raise($$($nesting, 'ArgumentError'), "negative argument")}; + + var result = [], + converted = self.$to_a(); + + for (var i = 0; i < other; i++) { + result = result.concat(converted); + } + + return toArraySubclass(result, self.$class()); + ; + }, TMP_Array_$_6.$$arity = 1); + + Opal.def(self, '$+', TMP_Array_$_7 = function(other) { + var self = this; + + + other = (function() {if ($truthy($$($nesting, 'Array')['$==='](other))) { + return other.$to_a() + } else { + return $$($nesting, 'Opal').$coerce_to(other, $$($nesting, 'Array'), "to_ary").$to_a() + }; return nil; })(); + return self.concat(other);; + }, TMP_Array_$_7.$$arity = 1); + + Opal.def(self, '$-', TMP_Array_$_8 = function(other) { + var self = this; + + + other = (function() {if ($truthy($$($nesting, 'Array')['$==='](other))) { + return other.$to_a() + } else { + return $$($nesting, 'Opal').$coerce_to(other, $$($nesting, 'Array'), "to_ary").$to_a() + }; return nil; })(); + if ($truthy(self.length === 0)) { + return []}; + if ($truthy(other.length === 0)) { + return self.slice()}; + + var result = [], hash = $hash2([], {}), i, length, item; + + for (i = 0, length = other.length; i < length; i++) { + Opal.hash_put(hash, other[i], true); + } + + for (i = 0, length = self.length; i < length; i++) { + item = self[i]; + if (Opal.hash_get(hash, item) === undefined) { + result.push(item); + } + } + + return result; + ; + }, TMP_Array_$_8.$$arity = 1); + + Opal.def(self, '$<<', TMP_Array_$lt$lt_9 = function(object) { + var self = this; + + + self.push(object); + return self; + }, TMP_Array_$lt$lt_9.$$arity = 1); + + Opal.def(self, '$<=>', TMP_Array_$lt$eq$gt_10 = function(other) { + var self = this; + + + if ($truthy($$($nesting, 'Array')['$==='](other))) { + other = other.$to_a() + } else if ($truthy(other['$respond_to?']("to_ary"))) { + other = other.$to_ary().$to_a() + } else { + return nil + }; + + if (self.$hash() === other.$hash()) { + return 0; + } + + var count = Math.min(self.length, other.length); + + for (var i = 0; i < count; i++) { + var tmp = (self[i])['$<=>'](other[i]); + + if (tmp !== 0) { + return tmp; + } + } + + return (self.length)['$<=>'](other.length); + ; + }, TMP_Array_$lt$eq$gt_10.$$arity = 1); + + Opal.def(self, '$==', TMP_Array_$eq$eq_11 = function(other) { + var self = this; + + + var recursed = {}; + + function _eqeq(array, other) { + var i, length, a, b; + + if (array === other) + return true; + + if (!other.$$is_array) { + if ($$($nesting, 'Opal')['$respond_to?'](other, "to_ary")) { + return (other)['$=='](array); + } else { + return false; + } + } + + if (array.constructor !== Array) + array = (array).$to_a(); + if (other.constructor !== Array) + other = (other).$to_a(); + + if (array.length !== other.length) { + return false; + } + + recursed[(array).$object_id()] = true; + + for (i = 0, length = array.length; i < length; i++) { + a = array[i]; + b = other[i]; + if (a.$$is_array) { + if (b.$$is_array && b.length !== a.length) { + return false; + } + if (!recursed.hasOwnProperty((a).$object_id())) { + if (!_eqeq(a, b)) { + return false; + } + } + } else { + if (!(a)['$=='](b)) { + return false; + } + } + } + + return true; + } + + return _eqeq(self, other); + + }, TMP_Array_$eq$eq_11.$$arity = 1); + + function $array_slice_range(self, index) { + var size = self.length, + exclude, from, to, result; + + exclude = index.excl; + from = Opal.Opal.$coerce_to(index.begin, Opal.Integer, 'to_int'); + to = Opal.Opal.$coerce_to(index.end, Opal.Integer, 'to_int'); + + if (from < 0) { + from += size; + + if (from < 0) { + return nil; + } + } + + if (from > size) { + return nil; + } + + if (to < 0) { + to += size; + + if (to < 0) { + return []; + } + } + + if (!exclude) { + to += 1; + } + + result = self.slice(from, to); + return toArraySubclass(result, self.$class()); + } + + function $array_slice_index_length(self, index, length) { + var size = self.length, + exclude, from, to, result; + + index = Opal.Opal.$coerce_to(index, Opal.Integer, 'to_int'); + + if (index < 0) { + index += size; + + if (index < 0) { + return nil; + } + } + + if (length === undefined) { + if (index >= size || index < 0) { + return nil; + } + + return self[index]; + } + else { + length = Opal.Opal.$coerce_to(length, Opal.Integer, 'to_int'); + + if (length < 0 || index > size || index < 0) { + return nil; + } + + result = self.slice(index, index + length); + } + return toArraySubclass(result, self.$class()); + } + ; + + Opal.def(self, '$[]', TMP_Array_$$_12 = function(index, length) { + var self = this; + + + ; + + if (index.$$is_range) { + return $array_slice_range(self, index); + } + else { + return $array_slice_index_length(self, index, length); + } + ; + }, TMP_Array_$$_12.$$arity = -2); + + Opal.def(self, '$[]=', TMP_Array_$$$eq_13 = function(index, value, extra) { + var self = this, data = nil, length = nil; + + + ; + var i, size = self.length;; + if ($truthy($$($nesting, 'Range')['$==='](index))) { + + data = (function() {if ($truthy($$($nesting, 'Array')['$==='](value))) { + return value.$to_a() + } else if ($truthy(value['$respond_to?']("to_ary"))) { + return value.$to_ary().$to_a() + } else { + return [value] + }; return nil; })(); + + var exclude = index.excl, + from = $$($nesting, 'Opal').$coerce_to(index.begin, $$($nesting, 'Integer'), "to_int"), + to = $$($nesting, 'Opal').$coerce_to(index.end, $$($nesting, 'Integer'), "to_int"); + + if (from < 0) { + from += size; + + if (from < 0) { + self.$raise($$($nesting, 'RangeError'), "" + (index.$inspect()) + " out of range"); + } + } + + if (to < 0) { + to += size; + } + + if (!exclude) { + to += 1; + } + + if (from > size) { + for (i = size; i < from; i++) { + self[i] = nil; + } + } + + if (to < 0) { + self.splice.apply(self, [from, 0].concat(data)); + } + else { + self.splice.apply(self, [from, to - from].concat(data)); + } + + return value; + ; + } else { + + if ($truthy(extra === undefined)) { + length = 1 + } else { + + length = value; + value = extra; + data = (function() {if ($truthy($$($nesting, 'Array')['$==='](value))) { + return value.$to_a() + } else if ($truthy(value['$respond_to?']("to_ary"))) { + return value.$to_ary().$to_a() + } else { + return [value] + }; return nil; })(); + }; + + var old; + + index = $$($nesting, 'Opal').$coerce_to(index, $$($nesting, 'Integer'), "to_int"); + length = $$($nesting, 'Opal').$coerce_to(length, $$($nesting, 'Integer'), "to_int"); + + if (index < 0) { + old = index; + index += size; + + if (index < 0) { + self.$raise($$($nesting, 'IndexError'), "" + "index " + (old) + " too small for array; minimum " + (-self.length)); + } + } + + if (length < 0) { + self.$raise($$($nesting, 'IndexError'), "" + "negative length (" + (length) + ")") + } + + if (index > size) { + for (i = size; i < index; i++) { + self[i] = nil; + } + } + + if (extra === undefined) { + self[index] = value; + } + else { + self.splice.apply(self, [index, length].concat(data)); + } + + return value; + ; + }; + }, TMP_Array_$$$eq_13.$$arity = -3); + + Opal.def(self, '$any?', TMP_Array_any$q_14 = function(pattern) { + var $iter = TMP_Array_any$q_14.$$p, block = $iter || nil, self = this, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_Array_any$q_14.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + + + if ($iter) TMP_Array_any$q_14.$$p = null;; + ; + if (self.length === 0) return false; + return $send(self, Opal.find_super_dispatcher(self, 'any?', TMP_Array_any$q_14, false), $zuper, $iter); + }, TMP_Array_any$q_14.$$arity = -1); + + Opal.def(self, '$assoc', TMP_Array_assoc_15 = function $$assoc(object) { + var self = this; + + + for (var i = 0, length = self.length, item; i < length; i++) { + if (item = self[i], item.length && (item[0])['$=='](object)) { + return item; + } + } + + return nil; + + }, TMP_Array_assoc_15.$$arity = 1); + + Opal.def(self, '$at', TMP_Array_at_16 = function $$at(index) { + var self = this; + + + index = $$($nesting, 'Opal').$coerce_to(index, $$($nesting, 'Integer'), "to_int"); + + if (index < 0) { + index += self.length; + } + + if (index < 0 || index >= self.length) { + return nil; + } + + return self[index]; + ; + }, TMP_Array_at_16.$$arity = 1); + + Opal.def(self, '$bsearch_index', TMP_Array_bsearch_index_17 = function $$bsearch_index() { + var $iter = TMP_Array_bsearch_index_17.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Array_bsearch_index_17.$$p = null; + + + if ($iter) TMP_Array_bsearch_index_17.$$p = null;; + if ((block !== nil)) { + } else { + return self.$enum_for("bsearch_index") + }; + + var min = 0, + max = self.length, + mid, + val, + ret, + smaller = false, + satisfied = nil; + + while (min < max) { + mid = min + Math.floor((max - min) / 2); + val = self[mid]; + ret = Opal.yield1(block, val); + + if (ret === true) { + satisfied = mid; + smaller = true; + } + else if (ret === false || ret === nil) { + smaller = false; + } + else if (ret.$$is_number) { + if (ret === 0) { return mid; } + smaller = (ret < 0); + } + else { + self.$raise($$($nesting, 'TypeError'), "" + "wrong argument type " + ((ret).$class()) + " (must be numeric, true, false or nil)") + } + + if (smaller) { max = mid; } else { min = mid + 1; } + } + + return satisfied; + ; + }, TMP_Array_bsearch_index_17.$$arity = 0); + + Opal.def(self, '$bsearch', TMP_Array_bsearch_18 = function $$bsearch() { + var $iter = TMP_Array_bsearch_18.$$p, block = $iter || nil, self = this, index = nil; + + if ($iter) TMP_Array_bsearch_18.$$p = null; + + + if ($iter) TMP_Array_bsearch_18.$$p = null;; + if ((block !== nil)) { + } else { + return self.$enum_for("bsearch") + }; + index = $send(self, 'bsearch_index', [], block.$to_proc()); + + if (index != null && index.$$is_number) { + return self[index]; + } else { + return index; + } + ; + }, TMP_Array_bsearch_18.$$arity = 0); + + Opal.def(self, '$cycle', TMP_Array_cycle_19 = function $$cycle(n) { + var $iter = TMP_Array_cycle_19.$$p, block = $iter || nil, TMP_20, $a, self = this; + + if ($iter) TMP_Array_cycle_19.$$p = null; + + + if ($iter) TMP_Array_cycle_19.$$p = null;; + + if (n == null) { + n = nil; + }; + if ((block !== nil)) { + } else { + return $send(self, 'enum_for', ["cycle", n], (TMP_20 = function(){var self = TMP_20.$$s || this; + + if ($truthy(n['$nil?']())) { + return $$$($$($nesting, 'Float'), 'INFINITY') + } else { + + n = $$($nesting, 'Opal')['$coerce_to!'](n, $$($nesting, 'Integer'), "to_int"); + if ($truthy($rb_gt(n, 0))) { + return $rb_times(self.$enumerator_size(), n) + } else { + return 0 + }; + }}, TMP_20.$$s = self, TMP_20.$$arity = 0, TMP_20)) + }; + if ($truthy(($truthy($a = self['$empty?']()) ? $a : n['$=='](0)))) { + return nil}; + + var i, length, value; + + if (n === nil) { + while (true) { + for (i = 0, length = self.length; i < length; i++) { + value = Opal.yield1(block, self[i]); + } + } + } + else { + n = $$($nesting, 'Opal')['$coerce_to!'](n, $$($nesting, 'Integer'), "to_int"); + if (n <= 0) { + return self; + } + + while (n > 0) { + for (i = 0, length = self.length; i < length; i++) { + value = Opal.yield1(block, self[i]); + } + + n--; + } + } + ; + return self; + }, TMP_Array_cycle_19.$$arity = -1); + + Opal.def(self, '$clear', TMP_Array_clear_21 = function $$clear() { + var self = this; + + + self.splice(0, self.length); + return self; + }, TMP_Array_clear_21.$$arity = 0); + + Opal.def(self, '$count', TMP_Array_count_22 = function $$count(object) { + var $iter = TMP_Array_count_22.$$p, block = $iter || nil, $a, self = this, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_Array_count_22.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + + + if ($iter) TMP_Array_count_22.$$p = null;; + + if (object == null) { + object = nil; + }; + if ($truthy(($truthy($a = object) ? $a : block))) { + return $send(self, Opal.find_super_dispatcher(self, 'count', TMP_Array_count_22, false), $zuper, $iter) + } else { + return self.$size() + }; + }, TMP_Array_count_22.$$arity = -1); + + Opal.def(self, '$initialize_copy', TMP_Array_initialize_copy_23 = function $$initialize_copy(other) { + var self = this; + + return self.$replace(other) + }, TMP_Array_initialize_copy_23.$$arity = 1); + + Opal.def(self, '$collect', TMP_Array_collect_24 = function $$collect() { + var $iter = TMP_Array_collect_24.$$p, block = $iter || nil, TMP_25, self = this; + + if ($iter) TMP_Array_collect_24.$$p = null; + + + if ($iter) TMP_Array_collect_24.$$p = null;; + if ((block !== nil)) { + } else { + return $send(self, 'enum_for', ["collect"], (TMP_25 = function(){var self = TMP_25.$$s || this; + + return self.$size()}, TMP_25.$$s = self, TMP_25.$$arity = 0, TMP_25)) + }; + + var result = []; + + for (var i = 0, length = self.length; i < length; i++) { + var value = Opal.yield1(block, self[i]); + result.push(value); + } + + return result; + ; + }, TMP_Array_collect_24.$$arity = 0); + + Opal.def(self, '$collect!', TMP_Array_collect$B_26 = function() { + var $iter = TMP_Array_collect$B_26.$$p, block = $iter || nil, TMP_27, self = this; + + if ($iter) TMP_Array_collect$B_26.$$p = null; + + + if ($iter) TMP_Array_collect$B_26.$$p = null;; + if ((block !== nil)) { + } else { + return $send(self, 'enum_for', ["collect!"], (TMP_27 = function(){var self = TMP_27.$$s || this; + + return self.$size()}, TMP_27.$$s = self, TMP_27.$$arity = 0, TMP_27)) + }; + + for (var i = 0, length = self.length; i < length; i++) { + var value = Opal.yield1(block, self[i]); + self[i] = value; + } + ; + return self; + }, TMP_Array_collect$B_26.$$arity = 0); + + function binomial_coefficient(n, k) { + if (n === k || k === 0) { + return 1; + } + + if (k > 0 && n > k) { + return binomial_coefficient(n - 1, k - 1) + binomial_coefficient(n - 1, k); + } + + return 0; + } + ; + + Opal.def(self, '$combination', TMP_Array_combination_28 = function $$combination(n) { + var TMP_29, $iter = TMP_Array_combination_28.$$p, $yield = $iter || nil, self = this, num = nil; + + if ($iter) TMP_Array_combination_28.$$p = null; + + num = $$($nesting, 'Opal')['$coerce_to!'](n, $$($nesting, 'Integer'), "to_int"); + if (($yield !== nil)) { + } else { + return $send(self, 'enum_for', ["combination", num], (TMP_29 = function(){var self = TMP_29.$$s || this; + + return binomial_coefficient(self.length, num)}, TMP_29.$$s = self, TMP_29.$$arity = 0, TMP_29)) + }; + + var i, length, stack, chosen, lev, done, next; + + if (num === 0) { + Opal.yield1($yield, []) + } else if (num === 1) { + for (i = 0, length = self.length; i < length; i++) { + Opal.yield1($yield, [self[i]]) + } + } + else if (num === self.length) { + Opal.yield1($yield, self.slice()) + } + else if (num >= 0 && num < self.length) { + stack = []; + for (i = 0; i <= num + 1; i++) { + stack.push(0); + } + + chosen = []; + lev = 0; + done = false; + stack[0] = -1; + + while (!done) { + chosen[lev] = self[stack[lev+1]]; + while (lev < num - 1) { + lev++; + next = stack[lev+1] = stack[lev] + 1; + chosen[lev] = self[next]; + } + Opal.yield1($yield, chosen.slice()) + lev++; + do { + done = (lev === 0); + stack[lev]++; + lev--; + } while ( stack[lev+1] + num === self.length + lev + 1 ); + } + } + ; + return self; + }, TMP_Array_combination_28.$$arity = 1); + + Opal.def(self, '$repeated_combination', TMP_Array_repeated_combination_30 = function $$repeated_combination(n) { + var TMP_31, $iter = TMP_Array_repeated_combination_30.$$p, $yield = $iter || nil, self = this, num = nil; + + if ($iter) TMP_Array_repeated_combination_30.$$p = null; + + num = $$($nesting, 'Opal')['$coerce_to!'](n, $$($nesting, 'Integer'), "to_int"); + if (($yield !== nil)) { + } else { + return $send(self, 'enum_for', ["repeated_combination", num], (TMP_31 = function(){var self = TMP_31.$$s || this; + + return binomial_coefficient(self.length + num - 1, num);}, TMP_31.$$s = self, TMP_31.$$arity = 0, TMP_31)) + }; + + function iterate(max, from, buffer, self) { + if (buffer.length == max) { + var copy = buffer.slice(); + Opal.yield1($yield, copy) + return; + } + for (var i = from; i < self.length; i++) { + buffer.push(self[i]); + iterate(max, i, buffer, self); + buffer.pop(); + } + } + + if (num >= 0) { + iterate(num, 0, [], self); + } + ; + return self; + }, TMP_Array_repeated_combination_30.$$arity = 1); + + Opal.def(self, '$compact', TMP_Array_compact_32 = function $$compact() { + var self = this; + + + var result = []; + + for (var i = 0, length = self.length, item; i < length; i++) { + if ((item = self[i]) !== nil) { + result.push(item); + } + } + + return result; + + }, TMP_Array_compact_32.$$arity = 0); + + Opal.def(self, '$compact!', TMP_Array_compact$B_33 = function() { + var self = this; + + + var original = self.length; + + for (var i = 0, length = self.length; i < length; i++) { + if (self[i] === nil) { + self.splice(i, 1); + + length--; + i--; + } + } + + return self.length === original ? nil : self; + + }, TMP_Array_compact$B_33.$$arity = 0); + + Opal.def(self, '$concat', TMP_Array_concat_34 = function $$concat($a) { + var $post_args, others, TMP_35, TMP_36, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + others = $post_args;; + others = $send(others, 'map', [], (TMP_35 = function(other){var self = TMP_35.$$s || this; + + + + if (other == null) { + other = nil; + }; + other = (function() {if ($truthy($$($nesting, 'Array')['$==='](other))) { + return other.$to_a() + } else { + return $$($nesting, 'Opal').$coerce_to(other, $$($nesting, 'Array'), "to_ary").$to_a() + }; return nil; })(); + if ($truthy(other['$equal?'](self))) { + other = other.$dup()}; + return other;}, TMP_35.$$s = self, TMP_35.$$arity = 1, TMP_35)); + $send(others, 'each', [], (TMP_36 = function(other){var self = TMP_36.$$s || this; + + + + if (other == null) { + other = nil; + }; + + for (var i = 0, length = other.length; i < length; i++) { + self.push(other[i]); + } + ;}, TMP_36.$$s = self, TMP_36.$$arity = 1, TMP_36)); + return self; + }, TMP_Array_concat_34.$$arity = -1); + + Opal.def(self, '$delete', TMP_Array_delete_37 = function(object) { + var $iter = TMP_Array_delete_37.$$p, $yield = $iter || nil, self = this; + + if ($iter) TMP_Array_delete_37.$$p = null; + + var original = self.length; + + for (var i = 0, length = original; i < length; i++) { + if ((self[i])['$=='](object)) { + self.splice(i, 1); + + length--; + i--; + } + } + + if (self.length === original) { + if (($yield !== nil)) { + return Opal.yieldX($yield, []); + } + return nil; + } + return object; + + }, TMP_Array_delete_37.$$arity = 1); + + Opal.def(self, '$delete_at', TMP_Array_delete_at_38 = function $$delete_at(index) { + var self = this; + + + index = $$($nesting, 'Opal').$coerce_to(index, $$($nesting, 'Integer'), "to_int"); + + if (index < 0) { + index += self.length; + } + + if (index < 0 || index >= self.length) { + return nil; + } + + var result = self[index]; + + self.splice(index, 1); + + return result; + + }, TMP_Array_delete_at_38.$$arity = 1); + + Opal.def(self, '$delete_if', TMP_Array_delete_if_39 = function $$delete_if() { + var $iter = TMP_Array_delete_if_39.$$p, block = $iter || nil, TMP_40, self = this; + + if ($iter) TMP_Array_delete_if_39.$$p = null; + + + if ($iter) TMP_Array_delete_if_39.$$p = null;; + if ((block !== nil)) { + } else { + return $send(self, 'enum_for', ["delete_if"], (TMP_40 = function(){var self = TMP_40.$$s || this; + + return self.$size()}, TMP_40.$$s = self, TMP_40.$$arity = 0, TMP_40)) + }; + + for (var i = 0, length = self.length, value; i < length; i++) { + value = block(self[i]); + + if (value !== false && value !== nil) { + self.splice(i, 1); + + length--; + i--; + } + } + ; + return self; + }, TMP_Array_delete_if_39.$$arity = 0); + + Opal.def(self, '$dig', TMP_Array_dig_41 = function $$dig(idx, $a) { + var $post_args, idxs, self = this, item = nil; + + + + $post_args = Opal.slice.call(arguments, 1, arguments.length); + + idxs = $post_args;; + item = self['$[]'](idx); + + if (item === nil || idxs.length === 0) { + return item; + } + ; + if ($truthy(item['$respond_to?']("dig"))) { + } else { + self.$raise($$($nesting, 'TypeError'), "" + (item.$class()) + " does not have #dig method") + }; + return $send(item, 'dig', Opal.to_a(idxs)); + }, TMP_Array_dig_41.$$arity = -2); + + Opal.def(self, '$drop', TMP_Array_drop_42 = function $$drop(number) { + var self = this; + + + if (number < 0) { + self.$raise($$($nesting, 'ArgumentError')) + } + + return self.slice(number); + + }, TMP_Array_drop_42.$$arity = 1); + + Opal.def(self, '$dup', TMP_Array_dup_43 = function $$dup() { + var $iter = TMP_Array_dup_43.$$p, $yield = $iter || nil, self = this, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_Array_dup_43.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + + + if (self.$$class === Opal.Array && + self.$$class.$allocate.$$pristine && + self.$copy_instance_variables.$$pristine && + self.$initialize_dup.$$pristine) { + return self.slice(0); + } + ; + return $send(self, Opal.find_super_dispatcher(self, 'dup', TMP_Array_dup_43, false), $zuper, $iter); + }, TMP_Array_dup_43.$$arity = 0); + + Opal.def(self, '$each', TMP_Array_each_44 = function $$each() { + var $iter = TMP_Array_each_44.$$p, block = $iter || nil, TMP_45, self = this; + + if ($iter) TMP_Array_each_44.$$p = null; + + + if ($iter) TMP_Array_each_44.$$p = null;; + if ((block !== nil)) { + } else { + return $send(self, 'enum_for', ["each"], (TMP_45 = function(){var self = TMP_45.$$s || this; + + return self.$size()}, TMP_45.$$s = self, TMP_45.$$arity = 0, TMP_45)) + }; + + for (var i = 0, length = self.length; i < length; i++) { + var value = Opal.yield1(block, self[i]); + } + ; + return self; + }, TMP_Array_each_44.$$arity = 0); + + Opal.def(self, '$each_index', TMP_Array_each_index_46 = function $$each_index() { + var $iter = TMP_Array_each_index_46.$$p, block = $iter || nil, TMP_47, self = this; + + if ($iter) TMP_Array_each_index_46.$$p = null; + + + if ($iter) TMP_Array_each_index_46.$$p = null;; + if ((block !== nil)) { + } else { + return $send(self, 'enum_for', ["each_index"], (TMP_47 = function(){var self = TMP_47.$$s || this; + + return self.$size()}, TMP_47.$$s = self, TMP_47.$$arity = 0, TMP_47)) + }; + + for (var i = 0, length = self.length; i < length; i++) { + var value = Opal.yield1(block, i); + } + ; + return self; + }, TMP_Array_each_index_46.$$arity = 0); + + Opal.def(self, '$empty?', TMP_Array_empty$q_48 = function() { + var self = this; + + return self.length === 0; + }, TMP_Array_empty$q_48.$$arity = 0); + + Opal.def(self, '$eql?', TMP_Array_eql$q_49 = function(other) { + var self = this; + + + var recursed = {}; + + function _eql(array, other) { + var i, length, a, b; + + if (!other.$$is_array) { + return false; + } + + other = other.$to_a(); + + if (array.length !== other.length) { + return false; + } + + recursed[(array).$object_id()] = true; + + for (i = 0, length = array.length; i < length; i++) { + a = array[i]; + b = other[i]; + if (a.$$is_array) { + if (b.$$is_array && b.length !== a.length) { + return false; + } + if (!recursed.hasOwnProperty((a).$object_id())) { + if (!_eql(a, b)) { + return false; + } + } + } else { + if (!(a)['$eql?'](b)) { + return false; + } + } + } + + return true; + } + + return _eql(self, other); + + }, TMP_Array_eql$q_49.$$arity = 1); + + Opal.def(self, '$fetch', TMP_Array_fetch_50 = function $$fetch(index, defaults) { + var $iter = TMP_Array_fetch_50.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Array_fetch_50.$$p = null; + + + if ($iter) TMP_Array_fetch_50.$$p = null;; + ; + + var original = index; + + index = $$($nesting, 'Opal').$coerce_to(index, $$($nesting, 'Integer'), "to_int"); + + if (index < 0) { + index += self.length; + } + + if (index >= 0 && index < self.length) { + return self[index]; + } + + if (block !== nil && defaults != null) { + self.$warn("warning: block supersedes default value argument") + } + + if (block !== nil) { + return block(original); + } + + if (defaults != null) { + return defaults; + } + + if (self.length === 0) { + self.$raise($$($nesting, 'IndexError'), "" + "index " + (original) + " outside of array bounds: 0...0") + } + else { + self.$raise($$($nesting, 'IndexError'), "" + "index " + (original) + " outside of array bounds: -" + (self.length) + "..." + (self.length)); + } + ; + }, TMP_Array_fetch_50.$$arity = -2); + + Opal.def(self, '$fill', TMP_Array_fill_51 = function $$fill($a) { + var $iter = TMP_Array_fill_51.$$p, block = $iter || nil, $post_args, args, $b, $c, self = this, one = nil, two = nil, obj = nil, left = nil, right = nil; + + if ($iter) TMP_Array_fill_51.$$p = null; + + + if ($iter) TMP_Array_fill_51.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + var i, length, value;; + if ($truthy(block)) { + + if ($truthy(args.length > 2)) { + self.$raise($$($nesting, 'ArgumentError'), "" + "wrong number of arguments (" + (args.$length()) + " for 0..2)")}; + $c = args, $b = Opal.to_ary($c), (one = ($b[0] == null ? nil : $b[0])), (two = ($b[1] == null ? nil : $b[1])), $c; + } else { + + if ($truthy(args.length == 0)) { + self.$raise($$($nesting, 'ArgumentError'), "wrong number of arguments (0 for 1..3)") + } else if ($truthy(args.length > 3)) { + self.$raise($$($nesting, 'ArgumentError'), "" + "wrong number of arguments (" + (args.$length()) + " for 1..3)")}; + $c = args, $b = Opal.to_ary($c), (obj = ($b[0] == null ? nil : $b[0])), (one = ($b[1] == null ? nil : $b[1])), (two = ($b[2] == null ? nil : $b[2])), $c; + }; + if ($truthy($$($nesting, 'Range')['$==='](one))) { + + if ($truthy(two)) { + self.$raise($$($nesting, 'TypeError'), "length invalid with range")}; + left = $$($nesting, 'Opal').$coerce_to(one.$begin(), $$($nesting, 'Integer'), "to_int"); + if ($truthy(left < 0)) { + left += this.length}; + if ($truthy(left < 0)) { + self.$raise($$($nesting, 'RangeError'), "" + (one.$inspect()) + " out of range")}; + right = $$($nesting, 'Opal').$coerce_to(one.$end(), $$($nesting, 'Integer'), "to_int"); + if ($truthy(right < 0)) { + right += this.length}; + if ($truthy(one['$exclude_end?']())) { + } else { + right += 1 + }; + if ($truthy(right <= left)) { + return self}; + } else if ($truthy(one)) { + + left = $$($nesting, 'Opal').$coerce_to(one, $$($nesting, 'Integer'), "to_int"); + if ($truthy(left < 0)) { + left += this.length}; + if ($truthy(left < 0)) { + left = 0}; + if ($truthy(two)) { + + right = $$($nesting, 'Opal').$coerce_to(two, $$($nesting, 'Integer'), "to_int"); + if ($truthy(right == 0)) { + return self}; + right += left; + } else { + right = this.length + }; + } else { + + left = 0; + right = this.length; + }; + if ($truthy(left > this.length)) { + + for (i = this.length; i < right; i++) { + self[i] = nil; + } + }; + if ($truthy(right > this.length)) { + this.length = right}; + if ($truthy(block)) { + + for (length = this.length; left < right; left++) { + value = block(left); + self[left] = value; + } + + } else { + + for (length = this.length; left < right; left++) { + self[left] = obj; + } + + }; + return self; + }, TMP_Array_fill_51.$$arity = -1); + + Opal.def(self, '$first', TMP_Array_first_52 = function $$first(count) { + var self = this; + + + ; + + if (count == null) { + return self.length === 0 ? nil : self[0]; + } + + count = $$($nesting, 'Opal').$coerce_to(count, $$($nesting, 'Integer'), "to_int"); + + if (count < 0) { + self.$raise($$($nesting, 'ArgumentError'), "negative array size"); + } + + return self.slice(0, count); + ; + }, TMP_Array_first_52.$$arity = -1); + + Opal.def(self, '$flatten', TMP_Array_flatten_53 = function $$flatten(level) { + var self = this; + + + ; + + function _flatten(array, level) { + var result = [], + i, length, + item, ary; + + array = (array).$to_a(); + + for (i = 0, length = array.length; i < length; i++) { + item = array[i]; + + if (!$$($nesting, 'Opal')['$respond_to?'](item, "to_ary", true)) { + result.push(item); + continue; + } + + ary = (item).$to_ary(); + + if (ary === nil) { + result.push(item); + continue; + } + + if (!ary.$$is_array) { + self.$raise($$($nesting, 'TypeError')); + } + + if (ary === self) { + self.$raise($$($nesting, 'ArgumentError')); + } + + switch (level) { + case undefined: + result = result.concat(_flatten(ary)); + break; + case 0: + result.push(ary); + break; + default: + result.push.apply(result, _flatten(ary, level - 1)); + } + } + return result; + } + + if (level !== undefined) { + level = $$($nesting, 'Opal').$coerce_to(level, $$($nesting, 'Integer'), "to_int"); + } + + return toArraySubclass(_flatten(self, level), self.$class()); + ; + }, TMP_Array_flatten_53.$$arity = -1); + + Opal.def(self, '$flatten!', TMP_Array_flatten$B_54 = function(level) { + var self = this; + + + ; + + var flattened = self.$flatten(level); + + if (self.length == flattened.length) { + for (var i = 0, length = self.length; i < length; i++) { + if (self[i] !== flattened[i]) { + break; + } + } + + if (i == length) { + return nil; + } + } + + self.$replace(flattened); + ; + return self; + }, TMP_Array_flatten$B_54.$$arity = -1); + + Opal.def(self, '$hash', TMP_Array_hash_55 = function $$hash() { + var self = this; + + + var top = (Opal.hash_ids === undefined), + result = ['A'], + hash_id = self.$object_id(), + item, i, key; + + try { + if (top) { + Opal.hash_ids = Object.create(null); + } + + // return early for recursive structures + if (Opal.hash_ids[hash_id]) { + return 'self'; + } + + for (key in Opal.hash_ids) { + item = Opal.hash_ids[key]; + if (self['$eql?'](item)) { + return 'self'; + } + } + + Opal.hash_ids[hash_id] = self; + + for (i = 0; i < self.length; i++) { + item = self[i]; + result.push(item.$hash()); + } + + return result.join(','); + } finally { + if (top) { + Opal.hash_ids = undefined; + } + } + + }, TMP_Array_hash_55.$$arity = 0); + + Opal.def(self, '$include?', TMP_Array_include$q_56 = function(member) { + var self = this; + + + for (var i = 0, length = self.length; i < length; i++) { + if ((self[i])['$=='](member)) { + return true; + } + } + + return false; + + }, TMP_Array_include$q_56.$$arity = 1); + + Opal.def(self, '$index', TMP_Array_index_57 = function $$index(object) { + var $iter = TMP_Array_index_57.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Array_index_57.$$p = null; + + + if ($iter) TMP_Array_index_57.$$p = null;; + ; + + var i, length, value; + + if (object != null && block !== nil) { + self.$warn("warning: given block not used") + } + + if (object != null) { + for (i = 0, length = self.length; i < length; i++) { + if ((self[i])['$=='](object)) { + return i; + } + } + } + else if (block !== nil) { + for (i = 0, length = self.length; i < length; i++) { + value = block(self[i]); + + if (value !== false && value !== nil) { + return i; + } + } + } + else { + return self.$enum_for("index"); + } + + return nil; + ; + }, TMP_Array_index_57.$$arity = -1); + + Opal.def(self, '$insert', TMP_Array_insert_58 = function $$insert(index, $a) { + var $post_args, objects, self = this; + + + + $post_args = Opal.slice.call(arguments, 1, arguments.length); + + objects = $post_args;; + + index = $$($nesting, 'Opal').$coerce_to(index, $$($nesting, 'Integer'), "to_int"); + + if (objects.length > 0) { + if (index < 0) { + index += self.length + 1; + + if (index < 0) { + self.$raise($$($nesting, 'IndexError'), "" + (index) + " is out of bounds"); + } + } + if (index > self.length) { + for (var i = self.length; i < index; i++) { + self.push(nil); + } + } + + self.splice.apply(self, [index, 0].concat(objects)); + } + ; + return self; + }, TMP_Array_insert_58.$$arity = -2); + + Opal.def(self, '$inspect', TMP_Array_inspect_59 = function $$inspect() { + var self = this; + + + var result = [], + id = self.$__id__(); + + for (var i = 0, length = self.length; i < length; i++) { + var item = self['$[]'](i); + + if ((item).$__id__() === id) { + result.push('[...]'); + } + else { + result.push((item).$inspect()); + } + } + + return '[' + result.join(', ') + ']'; + + }, TMP_Array_inspect_59.$$arity = 0); + + Opal.def(self, '$join', TMP_Array_join_60 = function $$join(sep) { + var self = this; + if ($gvars[","] == null) $gvars[","] = nil; + + + + if (sep == null) { + sep = nil; + }; + if ($truthy(self.length === 0)) { + return ""}; + if ($truthy(sep === nil)) { + sep = $gvars[","]}; + + var result = []; + var i, length, item, tmp; + + for (i = 0, length = self.length; i < length; i++) { + item = self[i]; + + if ($$($nesting, 'Opal')['$respond_to?'](item, "to_str")) { + tmp = (item).$to_str(); + + if (tmp !== nil) { + result.push((tmp).$to_s()); + + continue; + } + } + + if ($$($nesting, 'Opal')['$respond_to?'](item, "to_ary")) { + tmp = (item).$to_ary(); + + if (tmp === self) { + self.$raise($$($nesting, 'ArgumentError')); + } + + if (tmp !== nil) { + result.push((tmp).$join(sep)); + + continue; + } + } + + if ($$($nesting, 'Opal')['$respond_to?'](item, "to_s")) { + tmp = (item).$to_s(); + + if (tmp !== nil) { + result.push(tmp); + + continue; + } + } + + self.$raise($$($nesting, 'NoMethodError').$new("" + (Opal.inspect(item)) + " doesn't respond to #to_str, #to_ary or #to_s", "to_str")); + } + + if (sep === nil) { + return result.join(''); + } + else { + return result.join($$($nesting, 'Opal')['$coerce_to!'](sep, $$($nesting, 'String'), "to_str").$to_s()); + } + ; + }, TMP_Array_join_60.$$arity = -1); + + Opal.def(self, '$keep_if', TMP_Array_keep_if_61 = function $$keep_if() { + var $iter = TMP_Array_keep_if_61.$$p, block = $iter || nil, TMP_62, self = this; + + if ($iter) TMP_Array_keep_if_61.$$p = null; + + + if ($iter) TMP_Array_keep_if_61.$$p = null;; + if ((block !== nil)) { + } else { + return $send(self, 'enum_for', ["keep_if"], (TMP_62 = function(){var self = TMP_62.$$s || this; + + return self.$size()}, TMP_62.$$s = self, TMP_62.$$arity = 0, TMP_62)) + }; + + for (var i = 0, length = self.length, value; i < length; i++) { + value = block(self[i]); + + if (value === false || value === nil) { + self.splice(i, 1); + + length--; + i--; + } + } + ; + return self; + }, TMP_Array_keep_if_61.$$arity = 0); + + Opal.def(self, '$last', TMP_Array_last_63 = function $$last(count) { + var self = this; + + + ; + + if (count == null) { + return self.length === 0 ? nil : self[self.length - 1]; + } + + count = $$($nesting, 'Opal').$coerce_to(count, $$($nesting, 'Integer'), "to_int"); + + if (count < 0) { + self.$raise($$($nesting, 'ArgumentError'), "negative array size"); + } + + if (count > self.length) { + count = self.length; + } + + return self.slice(self.length - count, self.length); + ; + }, TMP_Array_last_63.$$arity = -1); + + Opal.def(self, '$length', TMP_Array_length_64 = function $$length() { + var self = this; + + return self.length; + }, TMP_Array_length_64.$$arity = 0); + Opal.alias(self, "map", "collect"); + Opal.alias(self, "map!", "collect!"); + + Opal.def(self, '$max', TMP_Array_max_65 = function $$max(n) { + var $iter = TMP_Array_max_65.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Array_max_65.$$p = null; + + + if ($iter) TMP_Array_max_65.$$p = null;; + ; + return $send(self.$each(), 'max', [n], block.$to_proc()); + }, TMP_Array_max_65.$$arity = -1); + + Opal.def(self, '$min', TMP_Array_min_66 = function $$min() { + var $iter = TMP_Array_min_66.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Array_min_66.$$p = null; + + + if ($iter) TMP_Array_min_66.$$p = null;; + return $send(self.$each(), 'min', [], block.$to_proc()); + }, TMP_Array_min_66.$$arity = 0); + + // Returns the product of from, from-1, ..., from - how_many + 1. + function descending_factorial(from, how_many) { + var count = how_many >= 0 ? 1 : 0; + while (how_many) { + count *= from; + from--; + how_many--; + } + return count; + } + ; + + Opal.def(self, '$permutation', TMP_Array_permutation_67 = function $$permutation(num) { + var $iter = TMP_Array_permutation_67.$$p, block = $iter || nil, TMP_68, self = this, perm = nil, used = nil; + + if ($iter) TMP_Array_permutation_67.$$p = null; + + + if ($iter) TMP_Array_permutation_67.$$p = null;; + ; + if ((block !== nil)) { + } else { + return $send(self, 'enum_for', ["permutation", num], (TMP_68 = function(){var self = TMP_68.$$s || this; + + return descending_factorial(self.length, num === undefined ? self.length : num);}, TMP_68.$$s = self, TMP_68.$$arity = 0, TMP_68)) + }; + + var permute, offensive, output; + + if (num === undefined) { + num = self.length; + } + else { + num = $$($nesting, 'Opal').$coerce_to(num, $$($nesting, 'Integer'), "to_int") + } + + if (num < 0 || self.length < num) { + // no permutations, yield nothing + } + else if (num === 0) { + // exactly one permutation: the zero-length array + Opal.yield1(block, []) + } + else if (num === 1) { + // this is a special, easy case + for (var i = 0; i < self.length; i++) { + Opal.yield1(block, [self[i]]) + } + } + else { + // this is the general case + (perm = $$($nesting, 'Array').$new(num)); + (used = $$($nesting, 'Array').$new(self.length, false)); + + permute = function(num, perm, index, used, blk) { + self = this; + for(var i = 0; i < self.length; i++){ + if(used['$[]'](i)['$!']()) { + perm[index] = i; + if(index < num - 1) { + used[i] = true; + permute.call(self, num, perm, index + 1, used, blk); + used[i] = false; + } + else { + output = []; + for (var j = 0; j < perm.length; j++) { + output.push(self[perm[j]]); + } + Opal.yield1(blk, output); + } + } + } + } + + if ((block !== nil)) { + // offensive (both definitions) copy. + offensive = self.slice(); + permute.call(offensive, num, perm, 0, used, block); + } + else { + permute.call(self, num, perm, 0, used, block); + } + } + ; + return self; + }, TMP_Array_permutation_67.$$arity = -1); + + Opal.def(self, '$repeated_permutation', TMP_Array_repeated_permutation_69 = function $$repeated_permutation(n) { + var TMP_70, $iter = TMP_Array_repeated_permutation_69.$$p, $yield = $iter || nil, self = this, num = nil; + + if ($iter) TMP_Array_repeated_permutation_69.$$p = null; + + num = $$($nesting, 'Opal')['$coerce_to!'](n, $$($nesting, 'Integer'), "to_int"); + if (($yield !== nil)) { + } else { + return $send(self, 'enum_for', ["repeated_permutation", num], (TMP_70 = function(){var self = TMP_70.$$s || this; + + if ($truthy($rb_ge(num, 0))) { + return self.$size()['$**'](num) + } else { + return 0 + }}, TMP_70.$$s = self, TMP_70.$$arity = 0, TMP_70)) + }; + + function iterate(max, buffer, self) { + if (buffer.length == max) { + var copy = buffer.slice(); + Opal.yield1($yield, copy) + return; + } + for (var i = 0; i < self.length; i++) { + buffer.push(self[i]); + iterate(max, buffer, self); + buffer.pop(); + } + } + + iterate(num, [], self.slice()); + ; + return self; + }, TMP_Array_repeated_permutation_69.$$arity = 1); + + Opal.def(self, '$pop', TMP_Array_pop_71 = function $$pop(count) { + var self = this; + + + ; + if ($truthy(count === undefined)) { + + if ($truthy(self.length === 0)) { + return nil}; + return self.pop();}; + count = $$($nesting, 'Opal').$coerce_to(count, $$($nesting, 'Integer'), "to_int"); + if ($truthy(count < 0)) { + self.$raise($$($nesting, 'ArgumentError'), "negative array size")}; + if ($truthy(self.length === 0)) { + return []}; + if ($truthy(count > self.length)) { + return self.splice(0, self.length); + } else { + return self.splice(self.length - count, self.length); + }; + }, TMP_Array_pop_71.$$arity = -1); + + Opal.def(self, '$product', TMP_Array_product_72 = function $$product($a) { + var $iter = TMP_Array_product_72.$$p, block = $iter || nil, $post_args, args, self = this; + + if ($iter) TMP_Array_product_72.$$p = null; + + + if ($iter) TMP_Array_product_72.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + + var result = (block !== nil) ? null : [], + n = args.length + 1, + counters = new Array(n), + lengths = new Array(n), + arrays = new Array(n), + i, m, subarray, len, resultlen = 1; + + arrays[0] = self; + for (i = 1; i < n; i++) { + arrays[i] = $$($nesting, 'Opal').$coerce_to(args[i - 1], $$($nesting, 'Array'), "to_ary"); + } + + for (i = 0; i < n; i++) { + len = arrays[i].length; + if (len === 0) { + return result || self; + } + resultlen *= len; + if (resultlen > 2147483647) { + self.$raise($$($nesting, 'RangeError'), "too big to product") + } + lengths[i] = len; + counters[i] = 0; + } + + outer_loop: for (;;) { + subarray = []; + for (i = 0; i < n; i++) { + subarray.push(arrays[i][counters[i]]); + } + if (result) { + result.push(subarray); + } else { + Opal.yield1(block, subarray) + } + m = n - 1; + counters[m]++; + while (counters[m] === lengths[m]) { + counters[m] = 0; + if (--m < 0) break outer_loop; + counters[m]++; + } + } + + return result || self; + ; + }, TMP_Array_product_72.$$arity = -1); + + Opal.def(self, '$push', TMP_Array_push_73 = function $$push($a) { + var $post_args, objects, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + objects = $post_args;; + + for (var i = 0, length = objects.length; i < length; i++) { + self.push(objects[i]); + } + ; + return self; + }, TMP_Array_push_73.$$arity = -1); + Opal.alias(self, "append", "push"); + + Opal.def(self, '$rassoc', TMP_Array_rassoc_74 = function $$rassoc(object) { + var self = this; + + + for (var i = 0, length = self.length, item; i < length; i++) { + item = self[i]; + + if (item.length && item[1] !== undefined) { + if ((item[1])['$=='](object)) { + return item; + } + } + } + + return nil; + + }, TMP_Array_rassoc_74.$$arity = 1); + + Opal.def(self, '$reject', TMP_Array_reject_75 = function $$reject() { + var $iter = TMP_Array_reject_75.$$p, block = $iter || nil, TMP_76, self = this; + + if ($iter) TMP_Array_reject_75.$$p = null; + + + if ($iter) TMP_Array_reject_75.$$p = null;; + if ((block !== nil)) { + } else { + return $send(self, 'enum_for', ["reject"], (TMP_76 = function(){var self = TMP_76.$$s || this; + + return self.$size()}, TMP_76.$$s = self, TMP_76.$$arity = 0, TMP_76)) + }; + + var result = []; + + for (var i = 0, length = self.length, value; i < length; i++) { + value = block(self[i]); + + if (value === false || value === nil) { + result.push(self[i]); + } + } + return result; + ; + }, TMP_Array_reject_75.$$arity = 0); + + Opal.def(self, '$reject!', TMP_Array_reject$B_77 = function() { + var $iter = TMP_Array_reject$B_77.$$p, block = $iter || nil, TMP_78, self = this, original = nil; + + if ($iter) TMP_Array_reject$B_77.$$p = null; + + + if ($iter) TMP_Array_reject$B_77.$$p = null;; + if ((block !== nil)) { + } else { + return $send(self, 'enum_for', ["reject!"], (TMP_78 = function(){var self = TMP_78.$$s || this; + + return self.$size()}, TMP_78.$$s = self, TMP_78.$$arity = 0, TMP_78)) + }; + original = self.$length(); + $send(self, 'delete_if', [], block.$to_proc()); + if (self.$length()['$=='](original)) { + return nil + } else { + return self + }; + }, TMP_Array_reject$B_77.$$arity = 0); + + Opal.def(self, '$replace', TMP_Array_replace_79 = function $$replace(other) { + var self = this; + + + other = (function() {if ($truthy($$($nesting, 'Array')['$==='](other))) { + return other.$to_a() + } else { + return $$($nesting, 'Opal').$coerce_to(other, $$($nesting, 'Array'), "to_ary").$to_a() + }; return nil; })(); + + self.splice(0, self.length); + self.push.apply(self, other); + ; + return self; + }, TMP_Array_replace_79.$$arity = 1); + + Opal.def(self, '$reverse', TMP_Array_reverse_80 = function $$reverse() { + var self = this; + + return self.slice(0).reverse(); + }, TMP_Array_reverse_80.$$arity = 0); + + Opal.def(self, '$reverse!', TMP_Array_reverse$B_81 = function() { + var self = this; + + return self.reverse(); + }, TMP_Array_reverse$B_81.$$arity = 0); + + Opal.def(self, '$reverse_each', TMP_Array_reverse_each_82 = function $$reverse_each() { + var $iter = TMP_Array_reverse_each_82.$$p, block = $iter || nil, TMP_83, self = this; + + if ($iter) TMP_Array_reverse_each_82.$$p = null; + + + if ($iter) TMP_Array_reverse_each_82.$$p = null;; + if ((block !== nil)) { + } else { + return $send(self, 'enum_for', ["reverse_each"], (TMP_83 = function(){var self = TMP_83.$$s || this; + + return self.$size()}, TMP_83.$$s = self, TMP_83.$$arity = 0, TMP_83)) + }; + $send(self.$reverse(), 'each', [], block.$to_proc()); + return self; + }, TMP_Array_reverse_each_82.$$arity = 0); + + Opal.def(self, '$rindex', TMP_Array_rindex_84 = function $$rindex(object) { + var $iter = TMP_Array_rindex_84.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Array_rindex_84.$$p = null; + + + if ($iter) TMP_Array_rindex_84.$$p = null;; + ; + + var i, value; + + if (object != null && block !== nil) { + self.$warn("warning: given block not used") + } + + if (object != null) { + for (i = self.length - 1; i >= 0; i--) { + if (i >= self.length) { + break; + } + if ((self[i])['$=='](object)) { + return i; + } + } + } + else if (block !== nil) { + for (i = self.length - 1; i >= 0; i--) { + if (i >= self.length) { + break; + } + + value = block(self[i]); + + if (value !== false && value !== nil) { + return i; + } + } + } + else if (object == null) { + return self.$enum_for("rindex"); + } + + return nil; + ; + }, TMP_Array_rindex_84.$$arity = -1); + + Opal.def(self, '$rotate', TMP_Array_rotate_85 = function $$rotate(n) { + var self = this; + + + + if (n == null) { + n = 1; + }; + n = $$($nesting, 'Opal').$coerce_to(n, $$($nesting, 'Integer'), "to_int"); + + var ary, idx, firstPart, lastPart; + + if (self.length === 1) { + return self.slice(); + } + if (self.length === 0) { + return []; + } + + ary = self.slice(); + idx = n % ary.length; + + firstPart = ary.slice(idx); + lastPart = ary.slice(0, idx); + return firstPart.concat(lastPart); + ; + }, TMP_Array_rotate_85.$$arity = -1); + + Opal.def(self, '$rotate!', TMP_Array_rotate$B_86 = function(cnt) { + var self = this, ary = nil; + + + + if (cnt == null) { + cnt = 1; + }; + + if (self.length === 0 || self.length === 1) { + return self; + } + ; + cnt = $$($nesting, 'Opal').$coerce_to(cnt, $$($nesting, 'Integer'), "to_int"); + ary = self.$rotate(cnt); + return self.$replace(ary); + }, TMP_Array_rotate$B_86.$$arity = -1); + (function($base, $super, $parent_nesting) { + function $SampleRandom(){}; + var self = $SampleRandom = $klass($base, $super, 'SampleRandom', $SampleRandom); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_SampleRandom_initialize_87, TMP_SampleRandom_rand_88; + + def.rng = nil; + + + Opal.def(self, '$initialize', TMP_SampleRandom_initialize_87 = function $$initialize(rng) { + var self = this; + + return (self.rng = rng) + }, TMP_SampleRandom_initialize_87.$$arity = 1); + return (Opal.def(self, '$rand', TMP_SampleRandom_rand_88 = function $$rand(size) { + var self = this, random = nil; + + + random = $$($nesting, 'Opal').$coerce_to(self.rng.$rand(size), $$($nesting, 'Integer'), "to_int"); + if ($truthy(random < 0)) { + self.$raise($$($nesting, 'RangeError'), "random value must be >= 0")}; + if ($truthy(random < size)) { + } else { + self.$raise($$($nesting, 'RangeError'), "random value must be less than Array size") + }; + return random; + }, TMP_SampleRandom_rand_88.$$arity = 1), nil) && 'rand'; + })($nesting[0], null, $nesting); + + Opal.def(self, '$sample', TMP_Array_sample_89 = function $$sample(count, options) { + var $a, self = this, o = nil, rng = nil; + + + ; + ; + if ($truthy(count === undefined)) { + return self.$at($$($nesting, 'Kernel').$rand(self.length))}; + if ($truthy(options === undefined)) { + if ($truthy((o = $$($nesting, 'Opal')['$coerce_to?'](count, $$($nesting, 'Hash'), "to_hash")))) { + + options = o; + count = nil; + } else { + + options = nil; + count = $$($nesting, 'Opal').$coerce_to(count, $$($nesting, 'Integer'), "to_int"); + } + } else { + + count = $$($nesting, 'Opal').$coerce_to(count, $$($nesting, 'Integer'), "to_int"); + options = $$($nesting, 'Opal').$coerce_to(options, $$($nesting, 'Hash'), "to_hash"); + }; + if ($truthy(($truthy($a = count) ? count < 0 : $a))) { + self.$raise($$($nesting, 'ArgumentError'), "count must be greater than 0")}; + if ($truthy(options)) { + rng = options['$[]']("random")}; + rng = (function() {if ($truthy(($truthy($a = rng) ? rng['$respond_to?']("rand") : $a))) { + return $$($nesting, 'SampleRandom').$new(rng) + } else { + return $$($nesting, 'Kernel') + }; return nil; })(); + if ($truthy(count)) { + } else { + return self[rng.$rand(self.length)] + }; + + + var abandon, spin, result, i, j, k, targetIndex, oldValue; + + if (count > self.length) { + count = self.length; + } + + switch (count) { + case 0: + return []; + break; + case 1: + return [self[rng.$rand(self.length)]]; + break; + case 2: + i = rng.$rand(self.length); + j = rng.$rand(self.length); + if (i === j) { + j = i === 0 ? i + 1 : i - 1; + } + return [self[i], self[j]]; + break; + default: + if (self.length / count > 3) { + abandon = false; + spin = 0; + + result = $$($nesting, 'Array').$new(count); + i = 1; + + result[0] = rng.$rand(self.length); + while (i < count) { + k = rng.$rand(self.length); + j = 0; + + while (j < i) { + while (k === result[j]) { + spin++; + if (spin > 100) { + abandon = true; + break; + } + k = rng.$rand(self.length); + } + if (abandon) { break; } + + j++; + } + + if (abandon) { break; } + + result[i] = k; + + i++; + } + + if (!abandon) { + i = 0; + while (i < count) { + result[i] = self[result[i]]; + i++; + } + + return result; + } + } + + result = self.slice(); + + for (var c = 0; c < count; c++) { + targetIndex = rng.$rand(self.length); + oldValue = result[c]; + result[c] = result[targetIndex]; + result[targetIndex] = oldValue; + } + + return count === self.length ? result : (result)['$[]'](0, count); + } + ; + }, TMP_Array_sample_89.$$arity = -1); + + Opal.def(self, '$select', TMP_Array_select_90 = function $$select() { + var $iter = TMP_Array_select_90.$$p, block = $iter || nil, TMP_91, self = this; + + if ($iter) TMP_Array_select_90.$$p = null; + + + if ($iter) TMP_Array_select_90.$$p = null;; + if ((block !== nil)) { + } else { + return $send(self, 'enum_for', ["select"], (TMP_91 = function(){var self = TMP_91.$$s || this; + + return self.$size()}, TMP_91.$$s = self, TMP_91.$$arity = 0, TMP_91)) + }; + + var result = []; + + for (var i = 0, length = self.length, item, value; i < length; i++) { + item = self[i]; + + value = Opal.yield1(block, item); + + if (Opal.truthy(value)) { + result.push(item); + } + } + + return result; + ; + }, TMP_Array_select_90.$$arity = 0); + + Opal.def(self, '$select!', TMP_Array_select$B_92 = function() { + var $iter = TMP_Array_select$B_92.$$p, block = $iter || nil, TMP_93, self = this; + + if ($iter) TMP_Array_select$B_92.$$p = null; + + + if ($iter) TMP_Array_select$B_92.$$p = null;; + if ((block !== nil)) { + } else { + return $send(self, 'enum_for', ["select!"], (TMP_93 = function(){var self = TMP_93.$$s || this; + + return self.$size()}, TMP_93.$$s = self, TMP_93.$$arity = 0, TMP_93)) + }; + + var original = self.length; + $send(self, 'keep_if', [], block.$to_proc()); + return self.length === original ? nil : self; + ; + }, TMP_Array_select$B_92.$$arity = 0); + + Opal.def(self, '$shift', TMP_Array_shift_94 = function $$shift(count) { + var self = this; + + + ; + if ($truthy(count === undefined)) { + + if ($truthy(self.length === 0)) { + return nil}; + return self.shift();}; + count = $$($nesting, 'Opal').$coerce_to(count, $$($nesting, 'Integer'), "to_int"); + if ($truthy(count < 0)) { + self.$raise($$($nesting, 'ArgumentError'), "negative array size")}; + if ($truthy(self.length === 0)) { + return []}; + return self.splice(0, count);; + }, TMP_Array_shift_94.$$arity = -1); + Opal.alias(self, "size", "length"); + + Opal.def(self, '$shuffle', TMP_Array_shuffle_95 = function $$shuffle(rng) { + var self = this; + + + ; + return self.$dup().$to_a()['$shuffle!'](rng); + }, TMP_Array_shuffle_95.$$arity = -1); + + Opal.def(self, '$shuffle!', TMP_Array_shuffle$B_96 = function(rng) { + var self = this; + + + ; + + var randgen, i = self.length, j, tmp; + + if (rng !== undefined) { + rng = $$($nesting, 'Opal')['$coerce_to?'](rng, $$($nesting, 'Hash'), "to_hash"); + + if (rng !== nil) { + rng = rng['$[]']("random"); + + if (rng !== nil && rng['$respond_to?']("rand")) { + randgen = rng; + } + } + } + + while (i) { + if (randgen) { + j = randgen.$rand(i).$to_int(); + + if (j < 0) { + self.$raise($$($nesting, 'RangeError'), "" + "random number too small " + (j)) + } + + if (j >= i) { + self.$raise($$($nesting, 'RangeError'), "" + "random number too big " + (j)) + } + } + else { + j = self.$rand(i); + } + + tmp = self[--i]; + self[i] = self[j]; + self[j] = tmp; + } + + return self; + ; + }, TMP_Array_shuffle$B_96.$$arity = -1); + Opal.alias(self, "slice", "[]"); + + Opal.def(self, '$slice!', TMP_Array_slice$B_97 = function(index, length) { + var self = this, result = nil, range = nil, range_start = nil, range_end = nil, start = nil; + + + ; + result = nil; + if ($truthy(length === undefined)) { + if ($truthy($$($nesting, 'Range')['$==='](index))) { + + range = index; + result = self['$[]'](range); + range_start = $$($nesting, 'Opal').$coerce_to(range.$begin(), $$($nesting, 'Integer'), "to_int"); + range_end = $$($nesting, 'Opal').$coerce_to(range.$end(), $$($nesting, 'Integer'), "to_int"); + + if (range_start < 0) { + range_start += self.length; + } + + if (range_end < 0) { + range_end += self.length; + } else if (range_end >= self.length) { + range_end = self.length - 1; + if (range.excl) { + range_end += 1; + } + } + + var range_length = range_end - range_start; + if (range.excl) { + range_end -= 1; + } else { + range_length += 1; + } + + if (range_start < self.length && range_start >= 0 && range_end < self.length && range_end >= 0 && range_length > 0) { + self.splice(range_start, range_length); + } + ; + } else { + + start = $$($nesting, 'Opal').$coerce_to(index, $$($nesting, 'Integer'), "to_int"); + + if (start < 0) { + start += self.length; + } + + if (start < 0 || start >= self.length) { + return nil; + } + + result = self[start]; + + if (start === 0) { + self.shift(); + } else { + self.splice(start, 1); + } + ; + } + } else { + + start = $$($nesting, 'Opal').$coerce_to(index, $$($nesting, 'Integer'), "to_int"); + length = $$($nesting, 'Opal').$coerce_to(length, $$($nesting, 'Integer'), "to_int"); + + if (length < 0) { + return nil; + } + + var end = start + length; + + result = self['$[]'](start, length); + + if (start < 0) { + start += self.length; + } + + if (start + length > self.length) { + length = self.length - start; + } + + if (start < self.length && start >= 0) { + self.splice(start, length); + } + ; + }; + return result; + }, TMP_Array_slice$B_97.$$arity = -2); + + Opal.def(self, '$sort', TMP_Array_sort_98 = function $$sort() { + var $iter = TMP_Array_sort_98.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Array_sort_98.$$p = null; + + + if ($iter) TMP_Array_sort_98.$$p = null;; + if ($truthy(self.length > 1)) { + } else { + return self + }; + + if (block === nil) { + block = function(a, b) { + return (a)['$<=>'](b); + }; + } + + return self.slice().sort(function(x, y) { + var ret = block(x, y); + + if (ret === nil) { + self.$raise($$($nesting, 'ArgumentError'), "" + "comparison of " + ((x).$inspect()) + " with " + ((y).$inspect()) + " failed"); + } + + return $rb_gt(ret, 0) ? 1 : ($rb_lt(ret, 0) ? -1 : 0); + }); + ; + }, TMP_Array_sort_98.$$arity = 0); + + Opal.def(self, '$sort!', TMP_Array_sort$B_99 = function() { + var $iter = TMP_Array_sort$B_99.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Array_sort$B_99.$$p = null; + + + if ($iter) TMP_Array_sort$B_99.$$p = null;; + + var result; + + if ((block !== nil)) { + result = $send((self.slice()), 'sort', [], block.$to_proc()); + } + else { + result = (self.slice()).$sort(); + } + + self.length = 0; + for(var i = 0, length = result.length; i < length; i++) { + self.push(result[i]); + } + + return self; + ; + }, TMP_Array_sort$B_99.$$arity = 0); + + Opal.def(self, '$sort_by!', TMP_Array_sort_by$B_100 = function() { + var $iter = TMP_Array_sort_by$B_100.$$p, block = $iter || nil, TMP_101, self = this; + + if ($iter) TMP_Array_sort_by$B_100.$$p = null; + + + if ($iter) TMP_Array_sort_by$B_100.$$p = null;; + if ((block !== nil)) { + } else { + return $send(self, 'enum_for', ["sort_by!"], (TMP_101 = function(){var self = TMP_101.$$s || this; + + return self.$size()}, TMP_101.$$s = self, TMP_101.$$arity = 0, TMP_101)) + }; + return self.$replace($send(self, 'sort_by', [], block.$to_proc())); + }, TMP_Array_sort_by$B_100.$$arity = 0); + + Opal.def(self, '$take', TMP_Array_take_102 = function $$take(count) { + var self = this; + + + if (count < 0) { + self.$raise($$($nesting, 'ArgumentError')); + } + + return self.slice(0, count); + + }, TMP_Array_take_102.$$arity = 1); + + Opal.def(self, '$take_while', TMP_Array_take_while_103 = function $$take_while() { + var $iter = TMP_Array_take_while_103.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Array_take_while_103.$$p = null; + + + if ($iter) TMP_Array_take_while_103.$$p = null;; + + var result = []; + + for (var i = 0, length = self.length, item, value; i < length; i++) { + item = self[i]; + + value = block(item); + + if (value === false || value === nil) { + return result; + } + + result.push(item); + } + + return result; + ; + }, TMP_Array_take_while_103.$$arity = 0); + + Opal.def(self, '$to_a', TMP_Array_to_a_104 = function $$to_a() { + var self = this; + + return self + }, TMP_Array_to_a_104.$$arity = 0); + Opal.alias(self, "to_ary", "to_a"); + + Opal.def(self, '$to_h', TMP_Array_to_h_105 = function $$to_h() { + var self = this; + + + var i, len = self.length, ary, key, val, hash = $hash2([], {}); + + for (i = 0; i < len; i++) { + ary = $$($nesting, 'Opal')['$coerce_to?'](self[i], $$($nesting, 'Array'), "to_ary"); + if (!ary.$$is_array) { + self.$raise($$($nesting, 'TypeError'), "" + "wrong element type " + ((ary).$class()) + " at " + (i) + " (expected array)") + } + if (ary.length !== 2) { + self.$raise($$($nesting, 'ArgumentError'), "" + "wrong array length at " + (i) + " (expected 2, was " + ((ary).$length()) + ")") + } + key = ary[0]; + val = ary[1]; + Opal.hash_put(hash, key, val); + } + + return hash; + + }, TMP_Array_to_h_105.$$arity = 0); + Opal.alias(self, "to_s", "inspect"); + + Opal.def(self, '$transpose', TMP_Array_transpose_106 = function $$transpose() { + var TMP_107, self = this, result = nil, max = nil; + + + if ($truthy(self['$empty?']())) { + return []}; + result = []; + max = nil; + $send(self, 'each', [], (TMP_107 = function(row){var self = TMP_107.$$s || this, $a, TMP_108; + + + + if (row == null) { + row = nil; + }; + row = (function() {if ($truthy($$($nesting, 'Array')['$==='](row))) { + return row.$to_a() + } else { + return $$($nesting, 'Opal').$coerce_to(row, $$($nesting, 'Array'), "to_ary").$to_a() + }; return nil; })(); + max = ($truthy($a = max) ? $a : row.length); + if ($truthy((row.length)['$!='](max))) { + self.$raise($$($nesting, 'IndexError'), "" + "element size differs (" + (row.length) + " should be " + (max) + ")")}; + return $send((row.length), 'times', [], (TMP_108 = function(i){var self = TMP_108.$$s || this, $b, entry = nil, $writer = nil; + + + + if (i == null) { + i = nil; + }; + entry = ($truthy($b = result['$[]'](i)) ? $b : (($writer = [i, []]), $send(result, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + return entry['$<<'](row.$at(i));}, TMP_108.$$s = self, TMP_108.$$arity = 1, TMP_108));}, TMP_107.$$s = self, TMP_107.$$arity = 1, TMP_107)); + return result; + }, TMP_Array_transpose_106.$$arity = 0); + + Opal.def(self, '$uniq', TMP_Array_uniq_109 = function $$uniq() { + var $iter = TMP_Array_uniq_109.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Array_uniq_109.$$p = null; + + + if ($iter) TMP_Array_uniq_109.$$p = null;; + + var hash = $hash2([], {}), i, length, item, key; + + if (block === nil) { + for (i = 0, length = self.length; i < length; i++) { + item = self[i]; + if (Opal.hash_get(hash, item) === undefined) { + Opal.hash_put(hash, item, item); + } + } + } + else { + for (i = 0, length = self.length; i < length; i++) { + item = self[i]; + key = Opal.yield1(block, item); + if (Opal.hash_get(hash, key) === undefined) { + Opal.hash_put(hash, key, item); + } + } + } + + return toArraySubclass((hash).$values(), self.$class()); + ; + }, TMP_Array_uniq_109.$$arity = 0); + + Opal.def(self, '$uniq!', TMP_Array_uniq$B_110 = function() { + var $iter = TMP_Array_uniq$B_110.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Array_uniq$B_110.$$p = null; + + + if ($iter) TMP_Array_uniq$B_110.$$p = null;; + + var original_length = self.length, hash = $hash2([], {}), i, length, item, key; + + for (i = 0, length = original_length; i < length; i++) { + item = self[i]; + key = (block === nil ? item : Opal.yield1(block, item)); + + if (Opal.hash_get(hash, key) === undefined) { + Opal.hash_put(hash, key, item); + continue; + } + + self.splice(i, 1); + length--; + i--; + } + + return self.length === original_length ? nil : self; + ; + }, TMP_Array_uniq$B_110.$$arity = 0); + + Opal.def(self, '$unshift', TMP_Array_unshift_111 = function $$unshift($a) { + var $post_args, objects, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + objects = $post_args;; + + for (var i = objects.length - 1; i >= 0; i--) { + self.unshift(objects[i]); + } + ; + return self; + }, TMP_Array_unshift_111.$$arity = -1); + Opal.alias(self, "prepend", "unshift"); + + Opal.def(self, '$values_at', TMP_Array_values_at_112 = function $$values_at($a) { + var $post_args, args, TMP_113, self = this, out = nil; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + out = []; + $send(args, 'each', [], (TMP_113 = function(elem){var self = TMP_113.$$s || this, TMP_114, finish = nil, start = nil, i = nil; + + + + if (elem == null) { + elem = nil; + }; + if ($truthy(elem['$is_a?']($$($nesting, 'Range')))) { + + finish = $$($nesting, 'Opal').$coerce_to(elem.$last(), $$($nesting, 'Integer'), "to_int"); + start = $$($nesting, 'Opal').$coerce_to(elem.$first(), $$($nesting, 'Integer'), "to_int"); + + if (start < 0) { + start = start + self.length; + return nil;; + } + ; + + if (finish < 0) { + finish = finish + self.length; + } + if (elem['$exclude_end?']()) { + finish--; + } + if (finish < start) { + return nil;; + } + ; + return $send(start, 'upto', [finish], (TMP_114 = function(i){var self = TMP_114.$$s || this; + + + + if (i == null) { + i = nil; + }; + return out['$<<'](self.$at(i));}, TMP_114.$$s = self, TMP_114.$$arity = 1, TMP_114)); + } else { + + i = $$($nesting, 'Opal').$coerce_to(elem, $$($nesting, 'Integer'), "to_int"); + return out['$<<'](self.$at(i)); + };}, TMP_113.$$s = self, TMP_113.$$arity = 1, TMP_113)); + return out; + }, TMP_Array_values_at_112.$$arity = -1); + + Opal.def(self, '$zip', TMP_Array_zip_115 = function $$zip($a) { + var $iter = TMP_Array_zip_115.$$p, block = $iter || nil, $post_args, others, $b, self = this; + + if ($iter) TMP_Array_zip_115.$$p = null; + + + if ($iter) TMP_Array_zip_115.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + others = $post_args;; + + var result = [], size = self.length, part, o, i, j, jj; + + for (j = 0, jj = others.length; j < jj; j++) { + o = others[j]; + if (o.$$is_array) { + continue; + } + if (o.$$is_enumerator) { + if (o.$size() === Infinity) { + others[j] = o.$take(size); + } else { + others[j] = o.$to_a(); + } + continue; + } + others[j] = ($truthy($b = $$($nesting, 'Opal')['$coerce_to?'](o, $$($nesting, 'Array'), "to_ary")) ? $b : $$($nesting, 'Opal')['$coerce_to!'](o, $$($nesting, 'Enumerator'), "each")).$to_a(); + } + + for (i = 0; i < size; i++) { + part = [self[i]]; + + for (j = 0, jj = others.length; j < jj; j++) { + o = others[j][i]; + + if (o == null) { + o = nil; + } + + part[j + 1] = o; + } + + result[i] = part; + } + + if (block !== nil) { + for (i = 0; i < size; i++) { + block(result[i]); + } + + return nil; + } + + return result; + ; + }, TMP_Array_zip_115.$$arity = -1); + Opal.defs(self, '$inherited', TMP_Array_inherited_116 = function $$inherited(klass) { + var self = this; + + + klass.prototype.$to_a = function() { + return this.slice(0, this.length); + } + + }, TMP_Array_inherited_116.$$arity = 1); + + Opal.def(self, '$instance_variables', TMP_Array_instance_variables_117 = function $$instance_variables() { + var TMP_118, $iter = TMP_Array_instance_variables_117.$$p, $yield = $iter || nil, self = this, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_Array_instance_variables_117.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + return $send($send(self, Opal.find_super_dispatcher(self, 'instance_variables', TMP_Array_instance_variables_117, false), $zuper, $iter), 'reject', [], (TMP_118 = function(ivar){var self = TMP_118.$$s || this, $a; + + + + if (ivar == null) { + ivar = nil; + }; + return ($truthy($a = /^@\d+$/.test(ivar)) ? $a : ivar['$==']("@length"));}, TMP_118.$$s = self, TMP_118.$$arity = 1, TMP_118)) + }, TMP_Array_instance_variables_117.$$arity = 0); + $$($nesting, 'Opal').$pristine(self.$singleton_class(), "allocate"); + $$($nesting, 'Opal').$pristine(self, "copy_instance_variables", "initialize_dup"); + return (Opal.def(self, '$pack', TMP_Array_pack_119 = function $$pack($a) { + var $post_args, args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + return self.$raise("To use Array#pack, you must first require 'corelib/array/pack'."); + }, TMP_Array_pack_119.$$arity = -1), nil) && 'pack'; + })($nesting[0], Array, $nesting); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/hash"] = function(Opal) { + function $rb_ge(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs >= rhs : lhs['$>='](rhs); + } + function $rb_gt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); + } + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $send = Opal.send, $hash2 = Opal.hash2, $truthy = Opal.truthy; + + Opal.add_stubs(['$require', '$include', '$coerce_to?', '$[]', '$merge!', '$allocate', '$raise', '$coerce_to!', '$each', '$fetch', '$>=', '$>', '$==', '$compare_by_identity', '$lambda?', '$abs', '$arity', '$enum_for', '$size', '$respond_to?', '$class', '$dig', '$new', '$inspect', '$map', '$to_proc', '$flatten', '$eql?', '$default', '$dup', '$default_proc', '$default_proc=', '$-', '$default=', '$proc']); + + self.$require("corelib/enumerable"); + return (function($base, $super, $parent_nesting) { + function $Hash(){}; + var self = $Hash = $klass($base, $super, 'Hash', $Hash); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Hash_$$_1, TMP_Hash_allocate_2, TMP_Hash_try_convert_3, TMP_Hash_initialize_4, TMP_Hash_$eq$eq_5, TMP_Hash_$gt$eq_6, TMP_Hash_$gt_8, TMP_Hash_$lt_9, TMP_Hash_$lt$eq_10, TMP_Hash_$$_11, TMP_Hash_$$$eq_12, TMP_Hash_assoc_13, TMP_Hash_clear_14, TMP_Hash_clone_15, TMP_Hash_compact_16, TMP_Hash_compact$B_17, TMP_Hash_compare_by_identity_18, TMP_Hash_compare_by_identity$q_19, TMP_Hash_default_20, TMP_Hash_default$eq_21, TMP_Hash_default_proc_22, TMP_Hash_default_proc$eq_23, TMP_Hash_delete_24, TMP_Hash_delete_if_25, TMP_Hash_dig_27, TMP_Hash_each_28, TMP_Hash_each_key_30, TMP_Hash_each_value_32, TMP_Hash_empty$q_34, TMP_Hash_fetch_35, TMP_Hash_fetch_values_36, TMP_Hash_flatten_38, TMP_Hash_has_key$q_39, TMP_Hash_has_value$q_40, TMP_Hash_hash_41, TMP_Hash_index_42, TMP_Hash_indexes_43, TMP_Hash_inspect_44, TMP_Hash_invert_45, TMP_Hash_keep_if_46, TMP_Hash_keys_48, TMP_Hash_length_49, TMP_Hash_merge_50, TMP_Hash_merge$B_51, TMP_Hash_rassoc_52, TMP_Hash_rehash_53, TMP_Hash_reject_54, TMP_Hash_reject$B_56, TMP_Hash_replace_58, TMP_Hash_select_59, TMP_Hash_select$B_61, TMP_Hash_shift_63, TMP_Hash_slice_64, TMP_Hash_to_a_65, TMP_Hash_to_h_66, TMP_Hash_to_hash_67, TMP_Hash_to_proc_68, TMP_Hash_transform_keys_70, TMP_Hash_transform_keys$B_72, TMP_Hash_transform_values_74, TMP_Hash_transform_values$B_76, TMP_Hash_values_78; + + + self.$include($$($nesting, 'Enumerable')); + def.$$is_hash = true; + Opal.defs(self, '$[]', TMP_Hash_$$_1 = function($a) { + var $post_args, argv, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + argv = $post_args;; + + var hash, argc = argv.length, i; + + if (argc === 1) { + hash = $$($nesting, 'Opal')['$coerce_to?'](argv['$[]'](0), $$($nesting, 'Hash'), "to_hash"); + if (hash !== nil) { + return self.$allocate()['$merge!'](hash); + } + + argv = $$($nesting, 'Opal')['$coerce_to?'](argv['$[]'](0), $$($nesting, 'Array'), "to_ary"); + if (argv === nil) { + self.$raise($$($nesting, 'ArgumentError'), "odd number of arguments for Hash") + } + + argc = argv.length; + hash = self.$allocate(); + + for (i = 0; i < argc; i++) { + if (!argv[i].$$is_array) continue; + switch(argv[i].length) { + case 1: + hash.$store(argv[i][0], nil); + break; + case 2: + hash.$store(argv[i][0], argv[i][1]); + break; + default: + self.$raise($$($nesting, 'ArgumentError'), "" + "invalid number of elements (" + (argv[i].length) + " for 1..2)") + } + } + + return hash; + } + + if (argc % 2 !== 0) { + self.$raise($$($nesting, 'ArgumentError'), "odd number of arguments for Hash") + } + + hash = self.$allocate(); + + for (i = 0; i < argc; i += 2) { + hash.$store(argv[i], argv[i + 1]); + } + + return hash; + ; + }, TMP_Hash_$$_1.$$arity = -1); + Opal.defs(self, '$allocate', TMP_Hash_allocate_2 = function $$allocate() { + var self = this; + + + var hash = new self(); + + Opal.hash_init(hash); + + hash.$$none = nil; + hash.$$proc = nil; + + return hash; + + }, TMP_Hash_allocate_2.$$arity = 0); + Opal.defs(self, '$try_convert', TMP_Hash_try_convert_3 = function $$try_convert(obj) { + var self = this; + + return $$($nesting, 'Opal')['$coerce_to?'](obj, $$($nesting, 'Hash'), "to_hash") + }, TMP_Hash_try_convert_3.$$arity = 1); + + Opal.def(self, '$initialize', TMP_Hash_initialize_4 = function $$initialize(defaults) { + var $iter = TMP_Hash_initialize_4.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Hash_initialize_4.$$p = null; + + + if ($iter) TMP_Hash_initialize_4.$$p = null;; + ; + + if (defaults !== undefined && block !== nil) { + self.$raise($$($nesting, 'ArgumentError'), "wrong number of arguments (1 for 0)") + } + self.$$none = (defaults === undefined ? nil : defaults); + self.$$proc = block; + + return self; + ; + }, TMP_Hash_initialize_4.$$arity = -1); + + Opal.def(self, '$==', TMP_Hash_$eq$eq_5 = function(other) { + var self = this; + + + if (self === other) { + return true; + } + + if (!other.$$is_hash) { + return false; + } + + if (self.$$keys.length !== other.$$keys.length) { + return false; + } + + for (var i = 0, keys = self.$$keys, length = keys.length, key, value, other_value; i < length; i++) { + key = keys[i]; + + if (key.$$is_string) { + value = self.$$smap[key]; + other_value = other.$$smap[key]; + } else { + value = key.value; + other_value = Opal.hash_get(other, key.key); + } + + if (other_value === undefined || !value['$eql?'](other_value)) { + return false; + } + } + + return true; + + }, TMP_Hash_$eq$eq_5.$$arity = 1); + + Opal.def(self, '$>=', TMP_Hash_$gt$eq_6 = function(other) { + var TMP_7, self = this, result = nil; + + + other = $$($nesting, 'Opal')['$coerce_to!'](other, $$($nesting, 'Hash'), "to_hash"); + + if (self.$$keys.length < other.$$keys.length) { + return false + } + ; + result = true; + $send(other, 'each', [], (TMP_7 = function(other_key, other_val){var self = TMP_7.$$s || this, val = nil; + + + + if (other_key == null) { + other_key = nil; + }; + + if (other_val == null) { + other_val = nil; + }; + val = self.$fetch(other_key, null); + + if (val == null || val !== other_val) { + result = false; + return; + } + ;}, TMP_7.$$s = self, TMP_7.$$arity = 2, TMP_7)); + return result; + }, TMP_Hash_$gt$eq_6.$$arity = 1); + + Opal.def(self, '$>', TMP_Hash_$gt_8 = function(other) { + var self = this; + + + other = $$($nesting, 'Opal')['$coerce_to!'](other, $$($nesting, 'Hash'), "to_hash"); + + if (self.$$keys.length <= other.$$keys.length) { + return false + } + ; + return $rb_ge(self, other); + }, TMP_Hash_$gt_8.$$arity = 1); + + Opal.def(self, '$<', TMP_Hash_$lt_9 = function(other) { + var self = this; + + + other = $$($nesting, 'Opal')['$coerce_to!'](other, $$($nesting, 'Hash'), "to_hash"); + return $rb_gt(other, self); + }, TMP_Hash_$lt_9.$$arity = 1); + + Opal.def(self, '$<=', TMP_Hash_$lt$eq_10 = function(other) { + var self = this; + + + other = $$($nesting, 'Opal')['$coerce_to!'](other, $$($nesting, 'Hash'), "to_hash"); + return $rb_ge(other, self); + }, TMP_Hash_$lt$eq_10.$$arity = 1); + + Opal.def(self, '$[]', TMP_Hash_$$_11 = function(key) { + var self = this; + + + var value = Opal.hash_get(self, key); + + if (value !== undefined) { + return value; + } + + return self.$default(key); + + }, TMP_Hash_$$_11.$$arity = 1); + + Opal.def(self, '$[]=', TMP_Hash_$$$eq_12 = function(key, value) { + var self = this; + + + Opal.hash_put(self, key, value); + return value; + + }, TMP_Hash_$$$eq_12.$$arity = 2); + + Opal.def(self, '$assoc', TMP_Hash_assoc_13 = function $$assoc(object) { + var self = this; + + + for (var i = 0, keys = self.$$keys, length = keys.length, key; i < length; i++) { + key = keys[i]; + + if (key.$$is_string) { + if ((key)['$=='](object)) { + return [key, self.$$smap[key]]; + } + } else { + if ((key.key)['$=='](object)) { + return [key.key, key.value]; + } + } + } + + return nil; + + }, TMP_Hash_assoc_13.$$arity = 1); + + Opal.def(self, '$clear', TMP_Hash_clear_14 = function $$clear() { + var self = this; + + + Opal.hash_init(self); + return self; + + }, TMP_Hash_clear_14.$$arity = 0); + + Opal.def(self, '$clone', TMP_Hash_clone_15 = function $$clone() { + var self = this; + + + var hash = new self.$$class(); + + Opal.hash_init(hash); + Opal.hash_clone(self, hash); + + return hash; + + }, TMP_Hash_clone_15.$$arity = 0); + + Opal.def(self, '$compact', TMP_Hash_compact_16 = function $$compact() { + var self = this; + + + var hash = Opal.hash(); + + for (var i = 0, keys = self.$$keys, length = keys.length, key, value, obj; i < length; i++) { + key = keys[i]; + + if (key.$$is_string) { + value = self.$$smap[key]; + } else { + value = key.value; + key = key.key; + } + + if (value !== nil) { + Opal.hash_put(hash, key, value); + } + } + + return hash; + + }, TMP_Hash_compact_16.$$arity = 0); + + Opal.def(self, '$compact!', TMP_Hash_compact$B_17 = function() { + var self = this; + + + var changes_were_made = false; + + for (var i = 0, keys = self.$$keys, length = keys.length, key, value, obj; i < length; i++) { + key = keys[i]; + + if (key.$$is_string) { + value = self.$$smap[key]; + } else { + value = key.value; + key = key.key; + } + + if (value === nil) { + if (Opal.hash_delete(self, key) !== undefined) { + changes_were_made = true; + length--; + i--; + } + } + } + + return changes_were_made ? self : nil; + + }, TMP_Hash_compact$B_17.$$arity = 0); + + Opal.def(self, '$compare_by_identity', TMP_Hash_compare_by_identity_18 = function $$compare_by_identity() { + var self = this; + + + var i, ii, key, keys = self.$$keys, identity_hash; + + if (self.$$by_identity) return self; + if (self.$$keys.length === 0) { + self.$$by_identity = true + return self; + } + + identity_hash = $hash2([], {}).$compare_by_identity(); + for(i = 0, ii = keys.length; i < ii; i++) { + key = keys[i]; + if (!key.$$is_string) key = key.key; + Opal.hash_put(identity_hash, key, Opal.hash_get(self, key)); + } + + self.$$by_identity = true; + self.$$map = identity_hash.$$map; + self.$$smap = identity_hash.$$smap; + return self; + + }, TMP_Hash_compare_by_identity_18.$$arity = 0); + + Opal.def(self, '$compare_by_identity?', TMP_Hash_compare_by_identity$q_19 = function() { + var self = this; + + return self.$$by_identity === true; + }, TMP_Hash_compare_by_identity$q_19.$$arity = 0); + + Opal.def(self, '$default', TMP_Hash_default_20 = function(key) { + var self = this; + + + ; + + if (key !== undefined && self.$$proc !== nil && self.$$proc !== undefined) { + return self.$$proc.$call(self, key); + } + if (self.$$none === undefined) { + return nil; + } + return self.$$none; + ; + }, TMP_Hash_default_20.$$arity = -1); + + Opal.def(self, '$default=', TMP_Hash_default$eq_21 = function(object) { + var self = this; + + + self.$$proc = nil; + self.$$none = object; + + return object; + + }, TMP_Hash_default$eq_21.$$arity = 1); + + Opal.def(self, '$default_proc', TMP_Hash_default_proc_22 = function $$default_proc() { + var self = this; + + + if (self.$$proc !== undefined) { + return self.$$proc; + } + return nil; + + }, TMP_Hash_default_proc_22.$$arity = 0); + + Opal.def(self, '$default_proc=', TMP_Hash_default_proc$eq_23 = function(default_proc) { + var self = this; + + + var proc = default_proc; + + if (proc !== nil) { + proc = $$($nesting, 'Opal')['$coerce_to!'](proc, $$($nesting, 'Proc'), "to_proc"); + + if ((proc)['$lambda?']() && (proc).$arity().$abs() !== 2) { + self.$raise($$($nesting, 'TypeError'), "default_proc takes two arguments"); + } + } + + self.$$none = nil; + self.$$proc = proc; + + return default_proc; + + }, TMP_Hash_default_proc$eq_23.$$arity = 1); + + Opal.def(self, '$delete', TMP_Hash_delete_24 = function(key) { + var $iter = TMP_Hash_delete_24.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Hash_delete_24.$$p = null; + + + if ($iter) TMP_Hash_delete_24.$$p = null;; + + var value = Opal.hash_delete(self, key); + + if (value !== undefined) { + return value; + } + + if (block !== nil) { + return Opal.yield1(block, key); + } + + return nil; + ; + }, TMP_Hash_delete_24.$$arity = 1); + + Opal.def(self, '$delete_if', TMP_Hash_delete_if_25 = function $$delete_if() { + var $iter = TMP_Hash_delete_if_25.$$p, block = $iter || nil, TMP_26, self = this; + + if ($iter) TMP_Hash_delete_if_25.$$p = null; + + + if ($iter) TMP_Hash_delete_if_25.$$p = null;; + if ($truthy(block)) { + } else { + return $send(self, 'enum_for', ["delete_if"], (TMP_26 = function(){var self = TMP_26.$$s || this; + + return self.$size()}, TMP_26.$$s = self, TMP_26.$$arity = 0, TMP_26)) + }; + + for (var i = 0, keys = self.$$keys, length = keys.length, key, value, obj; i < length; i++) { + key = keys[i]; + + if (key.$$is_string) { + value = self.$$smap[key]; + } else { + value = key.value; + key = key.key; + } + + obj = block(key, value); + + if (obj !== false && obj !== nil) { + if (Opal.hash_delete(self, key) !== undefined) { + length--; + i--; + } + } + } + + return self; + ; + }, TMP_Hash_delete_if_25.$$arity = 0); + Opal.alias(self, "dup", "clone"); + + Opal.def(self, '$dig', TMP_Hash_dig_27 = function $$dig(key, $a) { + var $post_args, keys, self = this, item = nil; + + + + $post_args = Opal.slice.call(arguments, 1, arguments.length); + + keys = $post_args;; + item = self['$[]'](key); + + if (item === nil || keys.length === 0) { + return item; + } + ; + if ($truthy(item['$respond_to?']("dig"))) { + } else { + self.$raise($$($nesting, 'TypeError'), "" + (item.$class()) + " does not have #dig method") + }; + return $send(item, 'dig', Opal.to_a(keys)); + }, TMP_Hash_dig_27.$$arity = -2); + + Opal.def(self, '$each', TMP_Hash_each_28 = function $$each() { + var $iter = TMP_Hash_each_28.$$p, block = $iter || nil, TMP_29, self = this; + + if ($iter) TMP_Hash_each_28.$$p = null; + + + if ($iter) TMP_Hash_each_28.$$p = null;; + if ($truthy(block)) { + } else { + return $send(self, 'enum_for', ["each"], (TMP_29 = function(){var self = TMP_29.$$s || this; + + return self.$size()}, TMP_29.$$s = self, TMP_29.$$arity = 0, TMP_29)) + }; + + for (var i = 0, keys = self.$$keys, length = keys.length, key, value; i < length; i++) { + key = keys[i]; + + if (key.$$is_string) { + value = self.$$smap[key]; + } else { + value = key.value; + key = key.key; + } + + Opal.yield1(block, [key, value]); + } + + return self; + ; + }, TMP_Hash_each_28.$$arity = 0); + + Opal.def(self, '$each_key', TMP_Hash_each_key_30 = function $$each_key() { + var $iter = TMP_Hash_each_key_30.$$p, block = $iter || nil, TMP_31, self = this; + + if ($iter) TMP_Hash_each_key_30.$$p = null; + + + if ($iter) TMP_Hash_each_key_30.$$p = null;; + if ($truthy(block)) { + } else { + return $send(self, 'enum_for', ["each_key"], (TMP_31 = function(){var self = TMP_31.$$s || this; + + return self.$size()}, TMP_31.$$s = self, TMP_31.$$arity = 0, TMP_31)) + }; + + for (var i = 0, keys = self.$$keys, length = keys.length, key; i < length; i++) { + key = keys[i]; + + block(key.$$is_string ? key : key.key); + } + + return self; + ; + }, TMP_Hash_each_key_30.$$arity = 0); + Opal.alias(self, "each_pair", "each"); + + Opal.def(self, '$each_value', TMP_Hash_each_value_32 = function $$each_value() { + var $iter = TMP_Hash_each_value_32.$$p, block = $iter || nil, TMP_33, self = this; + + if ($iter) TMP_Hash_each_value_32.$$p = null; + + + if ($iter) TMP_Hash_each_value_32.$$p = null;; + if ($truthy(block)) { + } else { + return $send(self, 'enum_for', ["each_value"], (TMP_33 = function(){var self = TMP_33.$$s || this; + + return self.$size()}, TMP_33.$$s = self, TMP_33.$$arity = 0, TMP_33)) + }; + + for (var i = 0, keys = self.$$keys, length = keys.length, key; i < length; i++) { + key = keys[i]; + + block(key.$$is_string ? self.$$smap[key] : key.value); + } + + return self; + ; + }, TMP_Hash_each_value_32.$$arity = 0); + + Opal.def(self, '$empty?', TMP_Hash_empty$q_34 = function() { + var self = this; + + return self.$$keys.length === 0; + }, TMP_Hash_empty$q_34.$$arity = 0); + Opal.alias(self, "eql?", "=="); + + Opal.def(self, '$fetch', TMP_Hash_fetch_35 = function $$fetch(key, defaults) { + var $iter = TMP_Hash_fetch_35.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Hash_fetch_35.$$p = null; + + + if ($iter) TMP_Hash_fetch_35.$$p = null;; + ; + + var value = Opal.hash_get(self, key); + + if (value !== undefined) { + return value; + } + + if (block !== nil) { + return block(key); + } + + if (defaults !== undefined) { + return defaults; + } + ; + return self.$raise($$($nesting, 'KeyError').$new("" + "key not found: " + (key.$inspect()), $hash2(["key", "receiver"], {"key": key, "receiver": self}))); + }, TMP_Hash_fetch_35.$$arity = -2); + + Opal.def(self, '$fetch_values', TMP_Hash_fetch_values_36 = function $$fetch_values($a) { + var $iter = TMP_Hash_fetch_values_36.$$p, block = $iter || nil, $post_args, keys, TMP_37, self = this; + + if ($iter) TMP_Hash_fetch_values_36.$$p = null; + + + if ($iter) TMP_Hash_fetch_values_36.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + keys = $post_args;; + return $send(keys, 'map', [], (TMP_37 = function(key){var self = TMP_37.$$s || this; + + + + if (key == null) { + key = nil; + }; + return $send(self, 'fetch', [key], block.$to_proc());}, TMP_37.$$s = self, TMP_37.$$arity = 1, TMP_37)); + }, TMP_Hash_fetch_values_36.$$arity = -1); + + Opal.def(self, '$flatten', TMP_Hash_flatten_38 = function $$flatten(level) { + var self = this; + + + + if (level == null) { + level = 1; + }; + level = $$($nesting, 'Opal')['$coerce_to!'](level, $$($nesting, 'Integer'), "to_int"); + + var result = []; + + for (var i = 0, keys = self.$$keys, length = keys.length, key, value; i < length; i++) { + key = keys[i]; + + if (key.$$is_string) { + value = self.$$smap[key]; + } else { + value = key.value; + key = key.key; + } + + result.push(key); + + if (value.$$is_array) { + if (level === 1) { + result.push(value); + continue; + } + + result = result.concat((value).$flatten(level - 2)); + continue; + } + + result.push(value); + } + + return result; + ; + }, TMP_Hash_flatten_38.$$arity = -1); + + Opal.def(self, '$has_key?', TMP_Hash_has_key$q_39 = function(key) { + var self = this; + + return Opal.hash_get(self, key) !== undefined; + }, TMP_Hash_has_key$q_39.$$arity = 1); + + Opal.def(self, '$has_value?', TMP_Hash_has_value$q_40 = function(value) { + var self = this; + + + for (var i = 0, keys = self.$$keys, length = keys.length, key; i < length; i++) { + key = keys[i]; + + if (((key.$$is_string ? self.$$smap[key] : key.value))['$=='](value)) { + return true; + } + } + + return false; + + }, TMP_Hash_has_value$q_40.$$arity = 1); + + Opal.def(self, '$hash', TMP_Hash_hash_41 = function $$hash() { + var self = this; + + + var top = (Opal.hash_ids === undefined), + hash_id = self.$object_id(), + result = ['Hash'], + key, item; + + try { + if (top) { + Opal.hash_ids = Object.create(null); + } + + if (Opal[hash_id]) { + return 'self'; + } + + for (key in Opal.hash_ids) { + item = Opal.hash_ids[key]; + if (self['$eql?'](item)) { + return 'self'; + } + } + + Opal.hash_ids[hash_id] = self; + + for (var i = 0, keys = self.$$keys, length = keys.length; i < length; i++) { + key = keys[i]; + + if (key.$$is_string) { + result.push([key, self.$$smap[key].$hash()]); + } else { + result.push([key.key_hash, key.value.$hash()]); + } + } + + return result.sort().join(); + + } finally { + if (top) { + Opal.hash_ids = undefined; + } + } + + }, TMP_Hash_hash_41.$$arity = 0); + Opal.alias(self, "include?", "has_key?"); + + Opal.def(self, '$index', TMP_Hash_index_42 = function $$index(object) { + var self = this; + + + for (var i = 0, keys = self.$$keys, length = keys.length, key, value; i < length; i++) { + key = keys[i]; + + if (key.$$is_string) { + value = self.$$smap[key]; + } else { + value = key.value; + key = key.key; + } + + if ((value)['$=='](object)) { + return key; + } + } + + return nil; + + }, TMP_Hash_index_42.$$arity = 1); + + Opal.def(self, '$indexes', TMP_Hash_indexes_43 = function $$indexes($a) { + var $post_args, args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + + var result = []; + + for (var i = 0, length = args.length, key, value; i < length; i++) { + key = args[i]; + value = Opal.hash_get(self, key); + + if (value === undefined) { + result.push(self.$default()); + continue; + } + + result.push(value); + } + + return result; + ; + }, TMP_Hash_indexes_43.$$arity = -1); + Opal.alias(self, "indices", "indexes"); + var inspect_ids; + + Opal.def(self, '$inspect', TMP_Hash_inspect_44 = function $$inspect() { + var self = this; + + + var top = (inspect_ids === undefined), + hash_id = self.$object_id(), + result = []; + + try { + if (top) { + inspect_ids = {}; + } + + if (inspect_ids.hasOwnProperty(hash_id)) { + return '{...}'; + } + + inspect_ids[hash_id] = true; + + for (var i = 0, keys = self.$$keys, length = keys.length, key, value; i < length; i++) { + key = keys[i]; + + if (key.$$is_string) { + value = self.$$smap[key]; + } else { + value = key.value; + key = key.key; + } + + result.push(key.$inspect() + '=>' + value.$inspect()); + } + + return '{' + result.join(', ') + '}'; + + } finally { + if (top) { + inspect_ids = undefined; + } + } + + }, TMP_Hash_inspect_44.$$arity = 0); + + Opal.def(self, '$invert', TMP_Hash_invert_45 = function $$invert() { + var self = this; + + + var hash = Opal.hash(); + + for (var i = 0, keys = self.$$keys, length = keys.length, key, value; i < length; i++) { + key = keys[i]; + + if (key.$$is_string) { + value = self.$$smap[key]; + } else { + value = key.value; + key = key.key; + } + + Opal.hash_put(hash, value, key); + } + + return hash; + + }, TMP_Hash_invert_45.$$arity = 0); + + Opal.def(self, '$keep_if', TMP_Hash_keep_if_46 = function $$keep_if() { + var $iter = TMP_Hash_keep_if_46.$$p, block = $iter || nil, TMP_47, self = this; + + if ($iter) TMP_Hash_keep_if_46.$$p = null; + + + if ($iter) TMP_Hash_keep_if_46.$$p = null;; + if ($truthy(block)) { + } else { + return $send(self, 'enum_for', ["keep_if"], (TMP_47 = function(){var self = TMP_47.$$s || this; + + return self.$size()}, TMP_47.$$s = self, TMP_47.$$arity = 0, TMP_47)) + }; + + for (var i = 0, keys = self.$$keys, length = keys.length, key, value, obj; i < length; i++) { + key = keys[i]; + + if (key.$$is_string) { + value = self.$$smap[key]; + } else { + value = key.value; + key = key.key; + } + + obj = block(key, value); + + if (obj === false || obj === nil) { + if (Opal.hash_delete(self, key) !== undefined) { + length--; + i--; + } + } + } + + return self; + ; + }, TMP_Hash_keep_if_46.$$arity = 0); + Opal.alias(self, "key", "index"); + Opal.alias(self, "key?", "has_key?"); + + Opal.def(self, '$keys', TMP_Hash_keys_48 = function $$keys() { + var self = this; + + + var result = []; + + for (var i = 0, keys = self.$$keys, length = keys.length, key; i < length; i++) { + key = keys[i]; + + if (key.$$is_string) { + result.push(key); + } else { + result.push(key.key); + } + } + + return result; + + }, TMP_Hash_keys_48.$$arity = 0); + + Opal.def(self, '$length', TMP_Hash_length_49 = function $$length() { + var self = this; + + return self.$$keys.length; + }, TMP_Hash_length_49.$$arity = 0); + Opal.alias(self, "member?", "has_key?"); + + Opal.def(self, '$merge', TMP_Hash_merge_50 = function $$merge(other) { + var $iter = TMP_Hash_merge_50.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Hash_merge_50.$$p = null; + + + if ($iter) TMP_Hash_merge_50.$$p = null;; + return $send(self.$dup(), 'merge!', [other], block.$to_proc()); + }, TMP_Hash_merge_50.$$arity = 1); + + Opal.def(self, '$merge!', TMP_Hash_merge$B_51 = function(other) { + var $iter = TMP_Hash_merge$B_51.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Hash_merge$B_51.$$p = null; + + + if ($iter) TMP_Hash_merge$B_51.$$p = null;; + + if (!other.$$is_hash) { + other = $$($nesting, 'Opal')['$coerce_to!'](other, $$($nesting, 'Hash'), "to_hash"); + } + + var i, other_keys = other.$$keys, length = other_keys.length, key, value, other_value; + + if (block === nil) { + for (i = 0; i < length; i++) { + key = other_keys[i]; + + if (key.$$is_string) { + other_value = other.$$smap[key]; + } else { + other_value = key.value; + key = key.key; + } + + Opal.hash_put(self, key, other_value); + } + + return self; + } + + for (i = 0; i < length; i++) { + key = other_keys[i]; + + if (key.$$is_string) { + other_value = other.$$smap[key]; + } else { + other_value = key.value; + key = key.key; + } + + value = Opal.hash_get(self, key); + + if (value === undefined) { + Opal.hash_put(self, key, other_value); + continue; + } + + Opal.hash_put(self, key, block(key, value, other_value)); + } + + return self; + ; + }, TMP_Hash_merge$B_51.$$arity = 1); + + Opal.def(self, '$rassoc', TMP_Hash_rassoc_52 = function $$rassoc(object) { + var self = this; + + + for (var i = 0, keys = self.$$keys, length = keys.length, key, value; i < length; i++) { + key = keys[i]; + + if (key.$$is_string) { + value = self.$$smap[key]; + } else { + value = key.value; + key = key.key; + } + + if ((value)['$=='](object)) { + return [key, value]; + } + } + + return nil; + + }, TMP_Hash_rassoc_52.$$arity = 1); + + Opal.def(self, '$rehash', TMP_Hash_rehash_53 = function $$rehash() { + var self = this; + + + Opal.hash_rehash(self); + return self; + + }, TMP_Hash_rehash_53.$$arity = 0); + + Opal.def(self, '$reject', TMP_Hash_reject_54 = function $$reject() { + var $iter = TMP_Hash_reject_54.$$p, block = $iter || nil, TMP_55, self = this; + + if ($iter) TMP_Hash_reject_54.$$p = null; + + + if ($iter) TMP_Hash_reject_54.$$p = null;; + if ($truthy(block)) { + } else { + return $send(self, 'enum_for', ["reject"], (TMP_55 = function(){var self = TMP_55.$$s || this; + + return self.$size()}, TMP_55.$$s = self, TMP_55.$$arity = 0, TMP_55)) + }; + + var hash = Opal.hash(); + + for (var i = 0, keys = self.$$keys, length = keys.length, key, value, obj; i < length; i++) { + key = keys[i]; + + if (key.$$is_string) { + value = self.$$smap[key]; + } else { + value = key.value; + key = key.key; + } + + obj = block(key, value); + + if (obj === false || obj === nil) { + Opal.hash_put(hash, key, value); + } + } + + return hash; + ; + }, TMP_Hash_reject_54.$$arity = 0); + + Opal.def(self, '$reject!', TMP_Hash_reject$B_56 = function() { + var $iter = TMP_Hash_reject$B_56.$$p, block = $iter || nil, TMP_57, self = this; + + if ($iter) TMP_Hash_reject$B_56.$$p = null; + + + if ($iter) TMP_Hash_reject$B_56.$$p = null;; + if ($truthy(block)) { + } else { + return $send(self, 'enum_for', ["reject!"], (TMP_57 = function(){var self = TMP_57.$$s || this; + + return self.$size()}, TMP_57.$$s = self, TMP_57.$$arity = 0, TMP_57)) + }; + + var changes_were_made = false; + + for (var i = 0, keys = self.$$keys, length = keys.length, key, value, obj; i < length; i++) { + key = keys[i]; + + if (key.$$is_string) { + value = self.$$smap[key]; + } else { + value = key.value; + key = key.key; + } + + obj = block(key, value); + + if (obj !== false && obj !== nil) { + if (Opal.hash_delete(self, key) !== undefined) { + changes_were_made = true; + length--; + i--; + } + } + } + + return changes_were_made ? self : nil; + ; + }, TMP_Hash_reject$B_56.$$arity = 0); + + Opal.def(self, '$replace', TMP_Hash_replace_58 = function $$replace(other) { + var self = this, $writer = nil; + + + other = $$($nesting, 'Opal')['$coerce_to!'](other, $$($nesting, 'Hash'), "to_hash"); + + Opal.hash_init(self); + + for (var i = 0, other_keys = other.$$keys, length = other_keys.length, key, value, other_value; i < length; i++) { + key = other_keys[i]; + + if (key.$$is_string) { + other_value = other.$$smap[key]; + } else { + other_value = key.value; + key = key.key; + } + + Opal.hash_put(self, key, other_value); + } + ; + if ($truthy(other.$default_proc())) { + + $writer = [other.$default_proc()]; + $send(self, 'default_proc=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + } else { + + $writer = [other.$default()]; + $send(self, 'default=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + return self; + }, TMP_Hash_replace_58.$$arity = 1); + + Opal.def(self, '$select', TMP_Hash_select_59 = function $$select() { + var $iter = TMP_Hash_select_59.$$p, block = $iter || nil, TMP_60, self = this; + + if ($iter) TMP_Hash_select_59.$$p = null; + + + if ($iter) TMP_Hash_select_59.$$p = null;; + if ($truthy(block)) { + } else { + return $send(self, 'enum_for', ["select"], (TMP_60 = function(){var self = TMP_60.$$s || this; + + return self.$size()}, TMP_60.$$s = self, TMP_60.$$arity = 0, TMP_60)) + }; + + var hash = Opal.hash(); + + for (var i = 0, keys = self.$$keys, length = keys.length, key, value, obj; i < length; i++) { + key = keys[i]; + + if (key.$$is_string) { + value = self.$$smap[key]; + } else { + value = key.value; + key = key.key; + } + + obj = block(key, value); + + if (obj !== false && obj !== nil) { + Opal.hash_put(hash, key, value); + } + } + + return hash; + ; + }, TMP_Hash_select_59.$$arity = 0); + + Opal.def(self, '$select!', TMP_Hash_select$B_61 = function() { + var $iter = TMP_Hash_select$B_61.$$p, block = $iter || nil, TMP_62, self = this; + + if ($iter) TMP_Hash_select$B_61.$$p = null; + + + if ($iter) TMP_Hash_select$B_61.$$p = null;; + if ($truthy(block)) { + } else { + return $send(self, 'enum_for', ["select!"], (TMP_62 = function(){var self = TMP_62.$$s || this; + + return self.$size()}, TMP_62.$$s = self, TMP_62.$$arity = 0, TMP_62)) + }; + + var result = nil; + + for (var i = 0, keys = self.$$keys, length = keys.length, key, value, obj; i < length; i++) { + key = keys[i]; + + if (key.$$is_string) { + value = self.$$smap[key]; + } else { + value = key.value; + key = key.key; + } + + obj = block(key, value); + + if (obj === false || obj === nil) { + if (Opal.hash_delete(self, key) !== undefined) { + length--; + i--; + } + result = self; + } + } + + return result; + ; + }, TMP_Hash_select$B_61.$$arity = 0); + + Opal.def(self, '$shift', TMP_Hash_shift_63 = function $$shift() { + var self = this; + + + var keys = self.$$keys, + key; + + if (keys.length > 0) { + key = keys[0]; + + key = key.$$is_string ? key : key.key; + + return [key, Opal.hash_delete(self, key)]; + } + + return self.$default(nil); + + }, TMP_Hash_shift_63.$$arity = 0); + Opal.alias(self, "size", "length"); + + Opal.def(self, '$slice', TMP_Hash_slice_64 = function $$slice($a) { + var $post_args, keys, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + keys = $post_args;; + + var result = Opal.hash(); + + for (var i = 0, length = keys.length; i < length; i++) { + var key = keys[i], value = Opal.hash_get(self, key); + + if (value !== undefined) { + Opal.hash_put(result, key, value); + } + } + + return result; + ; + }, TMP_Hash_slice_64.$$arity = -1); + Opal.alias(self, "store", "[]="); + + Opal.def(self, '$to_a', TMP_Hash_to_a_65 = function $$to_a() { + var self = this; + + + var result = []; + + for (var i = 0, keys = self.$$keys, length = keys.length, key, value; i < length; i++) { + key = keys[i]; + + if (key.$$is_string) { + value = self.$$smap[key]; + } else { + value = key.value; + key = key.key; + } + + result.push([key, value]); + } + + return result; + + }, TMP_Hash_to_a_65.$$arity = 0); + + Opal.def(self, '$to_h', TMP_Hash_to_h_66 = function $$to_h() { + var self = this; + + + if (self.$$class === Opal.Hash) { + return self; + } + + var hash = new Opal.Hash(); + + Opal.hash_init(hash); + Opal.hash_clone(self, hash); + + return hash; + + }, TMP_Hash_to_h_66.$$arity = 0); + + Opal.def(self, '$to_hash', TMP_Hash_to_hash_67 = function $$to_hash() { + var self = this; + + return self + }, TMP_Hash_to_hash_67.$$arity = 0); + + Opal.def(self, '$to_proc', TMP_Hash_to_proc_68 = function $$to_proc() { + var TMP_69, self = this; + + return $send(self, 'proc', [], (TMP_69 = function(key){var self = TMP_69.$$s || this; + + + ; + + if (key == null) { + self.$raise($$($nesting, 'ArgumentError'), "no key given") + } + ; + return self['$[]'](key);}, TMP_69.$$s = self, TMP_69.$$arity = -1, TMP_69)) + }, TMP_Hash_to_proc_68.$$arity = 0); + Opal.alias(self, "to_s", "inspect"); + + Opal.def(self, '$transform_keys', TMP_Hash_transform_keys_70 = function $$transform_keys() { + var $iter = TMP_Hash_transform_keys_70.$$p, block = $iter || nil, TMP_71, self = this; + + if ($iter) TMP_Hash_transform_keys_70.$$p = null; + + + if ($iter) TMP_Hash_transform_keys_70.$$p = null;; + if ($truthy(block)) { + } else { + return $send(self, 'enum_for', ["transform_keys"], (TMP_71 = function(){var self = TMP_71.$$s || this; + + return self.$size()}, TMP_71.$$s = self, TMP_71.$$arity = 0, TMP_71)) + }; + + var result = Opal.hash(); + + for (var i = 0, keys = self.$$keys, length = keys.length, key, value; i < length; i++) { + key = keys[i]; + + if (key.$$is_string) { + value = self.$$smap[key]; + } else { + value = key.value; + key = key.key; + } + + key = Opal.yield1(block, key); + + Opal.hash_put(result, key, value); + } + + return result; + ; + }, TMP_Hash_transform_keys_70.$$arity = 0); + + Opal.def(self, '$transform_keys!', TMP_Hash_transform_keys$B_72 = function() { + var $iter = TMP_Hash_transform_keys$B_72.$$p, block = $iter || nil, TMP_73, self = this; + + if ($iter) TMP_Hash_transform_keys$B_72.$$p = null; + + + if ($iter) TMP_Hash_transform_keys$B_72.$$p = null;; + if ($truthy(block)) { + } else { + return $send(self, 'enum_for', ["transform_keys!"], (TMP_73 = function(){var self = TMP_73.$$s || this; + + return self.$size()}, TMP_73.$$s = self, TMP_73.$$arity = 0, TMP_73)) + }; + + var keys = Opal.slice.call(self.$$keys), + i, length = keys.length, key, value, new_key; + + for (i = 0; i < length; i++) { + key = keys[i]; + + if (key.$$is_string) { + value = self.$$smap[key]; + } else { + value = key.value; + key = key.key; + } + + new_key = Opal.yield1(block, key); + + Opal.hash_delete(self, key); + Opal.hash_put(self, new_key, value); + } + + return self; + ; + }, TMP_Hash_transform_keys$B_72.$$arity = 0); + + Opal.def(self, '$transform_values', TMP_Hash_transform_values_74 = function $$transform_values() { + var $iter = TMP_Hash_transform_values_74.$$p, block = $iter || nil, TMP_75, self = this; + + if ($iter) TMP_Hash_transform_values_74.$$p = null; + + + if ($iter) TMP_Hash_transform_values_74.$$p = null;; + if ($truthy(block)) { + } else { + return $send(self, 'enum_for', ["transform_values"], (TMP_75 = function(){var self = TMP_75.$$s || this; + + return self.$size()}, TMP_75.$$s = self, TMP_75.$$arity = 0, TMP_75)) + }; + + var result = Opal.hash(); + + for (var i = 0, keys = self.$$keys, length = keys.length, key, value; i < length; i++) { + key = keys[i]; + + if (key.$$is_string) { + value = self.$$smap[key]; + } else { + value = key.value; + key = key.key; + } + + value = Opal.yield1(block, value); + + Opal.hash_put(result, key, value); + } + + return result; + ; + }, TMP_Hash_transform_values_74.$$arity = 0); + + Opal.def(self, '$transform_values!', TMP_Hash_transform_values$B_76 = function() { + var $iter = TMP_Hash_transform_values$B_76.$$p, block = $iter || nil, TMP_77, self = this; + + if ($iter) TMP_Hash_transform_values$B_76.$$p = null; + + + if ($iter) TMP_Hash_transform_values$B_76.$$p = null;; + if ($truthy(block)) { + } else { + return $send(self, 'enum_for', ["transform_values!"], (TMP_77 = function(){var self = TMP_77.$$s || this; + + return self.$size()}, TMP_77.$$s = self, TMP_77.$$arity = 0, TMP_77)) + }; + + for (var i = 0, keys = self.$$keys, length = keys.length, key, value; i < length; i++) { + key = keys[i]; + + if (key.$$is_string) { + value = self.$$smap[key]; + } else { + value = key.value; + key = key.key; + } + + value = Opal.yield1(block, value); + + Opal.hash_put(self, key, value); + } + + return self; + ; + }, TMP_Hash_transform_values$B_76.$$arity = 0); + Opal.alias(self, "update", "merge!"); + Opal.alias(self, "value?", "has_value?"); + Opal.alias(self, "values_at", "indexes"); + return (Opal.def(self, '$values', TMP_Hash_values_78 = function $$values() { + var self = this; + + + var result = []; + + for (var i = 0, keys = self.$$keys, length = keys.length, key; i < length; i++) { + key = keys[i]; + + if (key.$$is_string) { + result.push(self.$$smap[key]); + } else { + result.push(key.value); + } + } + + return result; + + }, TMP_Hash_values_78.$$arity = 0), nil) && 'values'; + })($nesting[0], null, $nesting); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/number"] = function(Opal) { + function $rb_gt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); + } + function $rb_lt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); + } + function $rb_plus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); + } + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + function $rb_divide(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs / rhs : lhs['$/'](rhs); + } + function $rb_times(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs * rhs : lhs['$*'](rhs); + } + function $rb_le(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs <= rhs : lhs['$<='](rhs); + } + function $rb_ge(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs >= rhs : lhs['$>='](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $truthy = Opal.truthy, $send = Opal.send, $hash2 = Opal.hash2; + + Opal.add_stubs(['$require', '$bridge', '$raise', '$name', '$class', '$Float', '$respond_to?', '$coerce_to!', '$__coerced__', '$===', '$!', '$>', '$**', '$new', '$<', '$to_f', '$==', '$nan?', '$infinite?', '$enum_for', '$+', '$-', '$gcd', '$lcm', '$%', '$/', '$frexp', '$to_i', '$ldexp', '$rationalize', '$*', '$<<', '$to_r', '$truncate', '$-@', '$size', '$<=', '$>=', '$<=>', '$compare', '$any?']); + + self.$require("corelib/numeric"); + (function($base, $super, $parent_nesting) { + function $Number(){}; + var self = $Number = $klass($base, $super, 'Number', $Number); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Number_coerce_2, TMP_Number___id___3, TMP_Number_$_4, TMP_Number_$_5, TMP_Number_$_6, TMP_Number_$_7, TMP_Number_$_8, TMP_Number_$_9, TMP_Number_$_10, TMP_Number_$_11, TMP_Number_$lt_12, TMP_Number_$lt$eq_13, TMP_Number_$gt_14, TMP_Number_$gt$eq_15, TMP_Number_$lt$eq$gt_16, TMP_Number_$lt$lt_17, TMP_Number_$gt$gt_18, TMP_Number_$$_19, TMP_Number_$$_20, TMP_Number_$$_21, TMP_Number_$_22, TMP_Number_$$_23, TMP_Number_$eq$eq$eq_24, TMP_Number_$eq$eq_25, TMP_Number_abs_26, TMP_Number_abs2_27, TMP_Number_allbits$q_28, TMP_Number_anybits$q_29, TMP_Number_angle_30, TMP_Number_bit_length_31, TMP_Number_ceil_32, TMP_Number_chr_33, TMP_Number_denominator_34, TMP_Number_downto_35, TMP_Number_equal$q_37, TMP_Number_even$q_38, TMP_Number_floor_39, TMP_Number_gcd_40, TMP_Number_gcdlcm_41, TMP_Number_integer$q_42, TMP_Number_is_a$q_43, TMP_Number_instance_of$q_44, TMP_Number_lcm_45, TMP_Number_next_46, TMP_Number_nobits$q_47, TMP_Number_nonzero$q_48, TMP_Number_numerator_49, TMP_Number_odd$q_50, TMP_Number_ord_51, TMP_Number_pow_52, TMP_Number_pred_53, TMP_Number_quo_54, TMP_Number_rationalize_55, TMP_Number_remainder_56, TMP_Number_round_57, TMP_Number_step_58, TMP_Number_times_60, TMP_Number_to_f_62, TMP_Number_to_i_63, TMP_Number_to_r_64, TMP_Number_to_s_65, TMP_Number_truncate_66, TMP_Number_digits_67, TMP_Number_divmod_68, TMP_Number_upto_69, TMP_Number_zero$q_71, TMP_Number_size_72, TMP_Number_nan$q_73, TMP_Number_finite$q_74, TMP_Number_infinite$q_75, TMP_Number_positive$q_76, TMP_Number_negative$q_77; + + + $$($nesting, 'Opal').$bridge(Number, self); + Opal.defineProperty(Number.prototype, '$$is_number', true); + self.$$is_number_class = true; + (function(self, $parent_nesting) { + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_allocate_1; + + + + Opal.def(self, '$allocate', TMP_allocate_1 = function $$allocate() { + var self = this; + + return self.$raise($$($nesting, 'TypeError'), "" + "allocator undefined for " + (self.$name())) + }, TMP_allocate_1.$$arity = 0); + + + Opal.udef(self, '$' + "new");; + return nil;; + })(Opal.get_singleton_class(self), $nesting); + + Opal.def(self, '$coerce', TMP_Number_coerce_2 = function $$coerce(other) { + var self = this; + + + if (other === nil) { + self.$raise($$($nesting, 'TypeError'), "" + "can't convert " + (other.$class()) + " into Float"); + } + else if (other.$$is_string) { + return [self.$Float(other), self]; + } + else if (other['$respond_to?']("to_f")) { + return [$$($nesting, 'Opal')['$coerce_to!'](other, $$($nesting, 'Float'), "to_f"), self]; + } + else if (other.$$is_number) { + return [other, self]; + } + else { + self.$raise($$($nesting, 'TypeError'), "" + "can't convert " + (other.$class()) + " into Float"); + } + + }, TMP_Number_coerce_2.$$arity = 1); + + Opal.def(self, '$__id__', TMP_Number___id___3 = function $$__id__() { + var self = this; + + return (self * 2) + 1; + }, TMP_Number___id___3.$$arity = 0); + Opal.alias(self, "object_id", "__id__"); + + Opal.def(self, '$+', TMP_Number_$_4 = function(other) { + var self = this; + + + if (other.$$is_number) { + return self + other; + } + else { + return self.$__coerced__("+", other); + } + + }, TMP_Number_$_4.$$arity = 1); + + Opal.def(self, '$-', TMP_Number_$_5 = function(other) { + var self = this; + + + if (other.$$is_number) { + return self - other; + } + else { + return self.$__coerced__("-", other); + } + + }, TMP_Number_$_5.$$arity = 1); + + Opal.def(self, '$*', TMP_Number_$_6 = function(other) { + var self = this; + + + if (other.$$is_number) { + return self * other; + } + else { + return self.$__coerced__("*", other); + } + + }, TMP_Number_$_6.$$arity = 1); + + Opal.def(self, '$/', TMP_Number_$_7 = function(other) { + var self = this; + + + if (other.$$is_number) { + return self / other; + } + else { + return self.$__coerced__("/", other); + } + + }, TMP_Number_$_7.$$arity = 1); + Opal.alias(self, "fdiv", "/"); + + Opal.def(self, '$%', TMP_Number_$_8 = function(other) { + var self = this; + + + if (other.$$is_number) { + if (other == -Infinity) { + return other; + } + else if (other == 0) { + self.$raise($$($nesting, 'ZeroDivisionError'), "divided by 0"); + } + else if (other < 0 || self < 0) { + return (self % other + other) % other; + } + else { + return self % other; + } + } + else { + return self.$__coerced__("%", other); + } + + }, TMP_Number_$_8.$$arity = 1); + + Opal.def(self, '$&', TMP_Number_$_9 = function(other) { + var self = this; + + + if (other.$$is_number) { + return self & other; + } + else { + return self.$__coerced__("&", other); + } + + }, TMP_Number_$_9.$$arity = 1); + + Opal.def(self, '$|', TMP_Number_$_10 = function(other) { + var self = this; + + + if (other.$$is_number) { + return self | other; + } + else { + return self.$__coerced__("|", other); + } + + }, TMP_Number_$_10.$$arity = 1); + + Opal.def(self, '$^', TMP_Number_$_11 = function(other) { + var self = this; + + + if (other.$$is_number) { + return self ^ other; + } + else { + return self.$__coerced__("^", other); + } + + }, TMP_Number_$_11.$$arity = 1); + + Opal.def(self, '$<', TMP_Number_$lt_12 = function(other) { + var self = this; + + + if (other.$$is_number) { + return self < other; + } + else { + return self.$__coerced__("<", other); + } + + }, TMP_Number_$lt_12.$$arity = 1); + + Opal.def(self, '$<=', TMP_Number_$lt$eq_13 = function(other) { + var self = this; + + + if (other.$$is_number) { + return self <= other; + } + else { + return self.$__coerced__("<=", other); + } + + }, TMP_Number_$lt$eq_13.$$arity = 1); + + Opal.def(self, '$>', TMP_Number_$gt_14 = function(other) { + var self = this; + + + if (other.$$is_number) { + return self > other; + } + else { + return self.$__coerced__(">", other); + } + + }, TMP_Number_$gt_14.$$arity = 1); + + Opal.def(self, '$>=', TMP_Number_$gt$eq_15 = function(other) { + var self = this; + + + if (other.$$is_number) { + return self >= other; + } + else { + return self.$__coerced__(">=", other); + } + + }, TMP_Number_$gt$eq_15.$$arity = 1); + + var spaceship_operator = function(self, other) { + if (other.$$is_number) { + if (isNaN(self) || isNaN(other)) { + return nil; + } + + if (self > other) { + return 1; + } else if (self < other) { + return -1; + } else { + return 0; + } + } + else { + return self.$__coerced__("<=>", other); + } + } + ; + + Opal.def(self, '$<=>', TMP_Number_$lt$eq$gt_16 = function(other) { + var self = this; + + try { + return spaceship_operator(self, other); + } catch ($err) { + if (Opal.rescue($err, [$$($nesting, 'ArgumentError')])) { + try { + return nil + } finally { Opal.pop_exception() } + } else { throw $err; } + } + }, TMP_Number_$lt$eq$gt_16.$$arity = 1); + + Opal.def(self, '$<<', TMP_Number_$lt$lt_17 = function(count) { + var self = this; + + + count = $$($nesting, 'Opal')['$coerce_to!'](count, $$($nesting, 'Integer'), "to_int"); + return count > 0 ? self << count : self >> -count; + }, TMP_Number_$lt$lt_17.$$arity = 1); + + Opal.def(self, '$>>', TMP_Number_$gt$gt_18 = function(count) { + var self = this; + + + count = $$($nesting, 'Opal')['$coerce_to!'](count, $$($nesting, 'Integer'), "to_int"); + return count > 0 ? self >> count : self << -count; + }, TMP_Number_$gt$gt_18.$$arity = 1); + + Opal.def(self, '$[]', TMP_Number_$$_19 = function(bit) { + var self = this; + + + bit = $$($nesting, 'Opal')['$coerce_to!'](bit, $$($nesting, 'Integer'), "to_int"); + + if (bit < 0) { + return 0; + } + if (bit >= 32) { + return self < 0 ? 1 : 0; + } + return (self >> bit) & 1; + ; + }, TMP_Number_$$_19.$$arity = 1); + + Opal.def(self, '$+@', TMP_Number_$$_20 = function() { + var self = this; + + return +self; + }, TMP_Number_$$_20.$$arity = 0); + + Opal.def(self, '$-@', TMP_Number_$$_21 = function() { + var self = this; + + return -self; + }, TMP_Number_$$_21.$$arity = 0); + + Opal.def(self, '$~', TMP_Number_$_22 = function() { + var self = this; + + return ~self; + }, TMP_Number_$_22.$$arity = 0); + + Opal.def(self, '$**', TMP_Number_$$_23 = function(other) { + var $a, $b, self = this; + + if ($truthy($$($nesting, 'Integer')['$==='](other))) { + if ($truthy(($truthy($a = $$($nesting, 'Integer')['$==='](self)['$!']()) ? $a : $rb_gt(other, 0)))) { + return Math.pow(self, other); + } else { + return $$($nesting, 'Rational').$new(self, 1)['$**'](other) + } + } else if ($truthy((($a = $rb_lt(self, 0)) ? ($truthy($b = $$($nesting, 'Float')['$==='](other)) ? $b : $$($nesting, 'Rational')['$==='](other)) : $rb_lt(self, 0)))) { + return $$($nesting, 'Complex').$new(self, 0)['$**'](other.$to_f()) + } else if ($truthy(other.$$is_number != null)) { + return Math.pow(self, other); + } else { + return self.$__coerced__("**", other) + } + }, TMP_Number_$$_23.$$arity = 1); + + Opal.def(self, '$===', TMP_Number_$eq$eq$eq_24 = function(other) { + var self = this; + + + if (other.$$is_number) { + return self.valueOf() === other.valueOf(); + } + else if (other['$respond_to?']("==")) { + return other['$=='](self); + } + else { + return false; + } + + }, TMP_Number_$eq$eq$eq_24.$$arity = 1); + + Opal.def(self, '$==', TMP_Number_$eq$eq_25 = function(other) { + var self = this; + + + if (other.$$is_number) { + return self.valueOf() === other.valueOf(); + } + else if (other['$respond_to?']("==")) { + return other['$=='](self); + } + else { + return false; + } + + }, TMP_Number_$eq$eq_25.$$arity = 1); + + Opal.def(self, '$abs', TMP_Number_abs_26 = function $$abs() { + var self = this; + + return Math.abs(self); + }, TMP_Number_abs_26.$$arity = 0); + + Opal.def(self, '$abs2', TMP_Number_abs2_27 = function $$abs2() { + var self = this; + + return Math.abs(self * self); + }, TMP_Number_abs2_27.$$arity = 0); + + Opal.def(self, '$allbits?', TMP_Number_allbits$q_28 = function(mask) { + var self = this; + + + mask = $$($nesting, 'Opal')['$coerce_to!'](mask, $$($nesting, 'Integer'), "to_int"); + return (self & mask) == mask;; + }, TMP_Number_allbits$q_28.$$arity = 1); + + Opal.def(self, '$anybits?', TMP_Number_anybits$q_29 = function(mask) { + var self = this; + + + mask = $$($nesting, 'Opal')['$coerce_to!'](mask, $$($nesting, 'Integer'), "to_int"); + return (self & mask) !== 0;; + }, TMP_Number_anybits$q_29.$$arity = 1); + + Opal.def(self, '$angle', TMP_Number_angle_30 = function $$angle() { + var self = this; + + + if ($truthy(self['$nan?']())) { + return self}; + + if (self == 0) { + if (1 / self > 0) { + return 0; + } + else { + return Math.PI; + } + } + else if (self < 0) { + return Math.PI; + } + else { + return 0; + } + ; + }, TMP_Number_angle_30.$$arity = 0); + Opal.alias(self, "arg", "angle"); + Opal.alias(self, "phase", "angle"); + + Opal.def(self, '$bit_length', TMP_Number_bit_length_31 = function $$bit_length() { + var self = this; + + + if ($truthy($$($nesting, 'Integer')['$==='](self))) { + } else { + self.$raise($$($nesting, 'NoMethodError').$new("" + "undefined method `bit_length` for " + (self) + ":Float", "bit_length")) + }; + + if (self === 0 || self === -1) { + return 0; + } + + var result = 0, + value = self < 0 ? ~self : self; + + while (value != 0) { + result += 1; + value >>>= 1; + } + + return result; + ; + }, TMP_Number_bit_length_31.$$arity = 0); + + Opal.def(self, '$ceil', TMP_Number_ceil_32 = function $$ceil(ndigits) { + var self = this; + + + + if (ndigits == null) { + ndigits = 0; + }; + + var f = self.$to_f(); + + if (f % 1 === 0 && ndigits >= 0) { + return f; + } + + var factor = Math.pow(10, ndigits), + result = Math.ceil(f * factor) / factor; + + if (f % 1 === 0) { + result = Math.round(result); + } + + return result; + ; + }, TMP_Number_ceil_32.$$arity = -1); + + Opal.def(self, '$chr', TMP_Number_chr_33 = function $$chr(encoding) { + var self = this; + + + ; + return String.fromCharCode(self);; + }, TMP_Number_chr_33.$$arity = -1); + + Opal.def(self, '$denominator', TMP_Number_denominator_34 = function $$denominator() { + var $a, $iter = TMP_Number_denominator_34.$$p, $yield = $iter || nil, self = this, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_Number_denominator_34.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + if ($truthy(($truthy($a = self['$nan?']()) ? $a : self['$infinite?']()))) { + return 1 + } else { + return $send(self, Opal.find_super_dispatcher(self, 'denominator', TMP_Number_denominator_34, false), $zuper, $iter) + } + }, TMP_Number_denominator_34.$$arity = 0); + + Opal.def(self, '$downto', TMP_Number_downto_35 = function $$downto(stop) { + var $iter = TMP_Number_downto_35.$$p, block = $iter || nil, TMP_36, self = this; + + if ($iter) TMP_Number_downto_35.$$p = null; + + + if ($iter) TMP_Number_downto_35.$$p = null;; + if ((block !== nil)) { + } else { + return $send(self, 'enum_for', ["downto", stop], (TMP_36 = function(){var self = TMP_36.$$s || this; + + + if ($truthy($$($nesting, 'Numeric')['$==='](stop))) { + } else { + self.$raise($$($nesting, 'ArgumentError'), "" + "comparison of " + (self.$class()) + " with " + (stop.$class()) + " failed") + }; + if ($truthy($rb_gt(stop, self))) { + return 0 + } else { + return $rb_plus($rb_minus(self, stop), 1) + };}, TMP_36.$$s = self, TMP_36.$$arity = 0, TMP_36)) + }; + + if (!stop.$$is_number) { + self.$raise($$($nesting, 'ArgumentError'), "" + "comparison of " + (self.$class()) + " with " + (stop.$class()) + " failed") + } + for (var i = self; i >= stop; i--) { + block(i); + } + ; + return self; + }, TMP_Number_downto_35.$$arity = 1); + Opal.alias(self, "eql?", "=="); + + Opal.def(self, '$equal?', TMP_Number_equal$q_37 = function(other) { + var $a, self = this; + + return ($truthy($a = self['$=='](other)) ? $a : isNaN(self) && isNaN(other)) + }, TMP_Number_equal$q_37.$$arity = 1); + + Opal.def(self, '$even?', TMP_Number_even$q_38 = function() { + var self = this; + + return self % 2 === 0; + }, TMP_Number_even$q_38.$$arity = 0); + + Opal.def(self, '$floor', TMP_Number_floor_39 = function $$floor(ndigits) { + var self = this; + + + + if (ndigits == null) { + ndigits = 0; + }; + + var f = self.$to_f(); + + if (f % 1 === 0 && ndigits >= 0) { + return f; + } + + var factor = Math.pow(10, ndigits), + result = Math.floor(f * factor) / factor; + + if (f % 1 === 0) { + result = Math.round(result); + } + + return result; + ; + }, TMP_Number_floor_39.$$arity = -1); + + Opal.def(self, '$gcd', TMP_Number_gcd_40 = function $$gcd(other) { + var self = this; + + + if ($truthy($$($nesting, 'Integer')['$==='](other))) { + } else { + self.$raise($$($nesting, 'TypeError'), "not an integer") + }; + + var min = Math.abs(self), + max = Math.abs(other); + + while (min > 0) { + var tmp = min; + + min = max % min; + max = tmp; + } + + return max; + ; + }, TMP_Number_gcd_40.$$arity = 1); + + Opal.def(self, '$gcdlcm', TMP_Number_gcdlcm_41 = function $$gcdlcm(other) { + var self = this; + + return [self.$gcd(), self.$lcm()] + }, TMP_Number_gcdlcm_41.$$arity = 1); + + Opal.def(self, '$integer?', TMP_Number_integer$q_42 = function() { + var self = this; + + return self % 1 === 0; + }, TMP_Number_integer$q_42.$$arity = 0); + + Opal.def(self, '$is_a?', TMP_Number_is_a$q_43 = function(klass) { + var $a, $iter = TMP_Number_is_a$q_43.$$p, $yield = $iter || nil, self = this, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_Number_is_a$q_43.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + + if ($truthy((($a = klass['$==']($$($nesting, 'Integer'))) ? $$($nesting, 'Integer')['$==='](self) : klass['$==']($$($nesting, 'Integer'))))) { + return true}; + if ($truthy((($a = klass['$==']($$($nesting, 'Integer'))) ? $$($nesting, 'Integer')['$==='](self) : klass['$==']($$($nesting, 'Integer'))))) { + return true}; + if ($truthy((($a = klass['$==']($$($nesting, 'Float'))) ? $$($nesting, 'Float')['$==='](self) : klass['$==']($$($nesting, 'Float'))))) { + return true}; + return $send(self, Opal.find_super_dispatcher(self, 'is_a?', TMP_Number_is_a$q_43, false), $zuper, $iter); + }, TMP_Number_is_a$q_43.$$arity = 1); + Opal.alias(self, "kind_of?", "is_a?"); + + Opal.def(self, '$instance_of?', TMP_Number_instance_of$q_44 = function(klass) { + var $a, $iter = TMP_Number_instance_of$q_44.$$p, $yield = $iter || nil, self = this, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_Number_instance_of$q_44.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + + if ($truthy((($a = klass['$==']($$($nesting, 'Integer'))) ? $$($nesting, 'Integer')['$==='](self) : klass['$==']($$($nesting, 'Integer'))))) { + return true}; + if ($truthy((($a = klass['$==']($$($nesting, 'Integer'))) ? $$($nesting, 'Integer')['$==='](self) : klass['$==']($$($nesting, 'Integer'))))) { + return true}; + if ($truthy((($a = klass['$==']($$($nesting, 'Float'))) ? $$($nesting, 'Float')['$==='](self) : klass['$==']($$($nesting, 'Float'))))) { + return true}; + return $send(self, Opal.find_super_dispatcher(self, 'instance_of?', TMP_Number_instance_of$q_44, false), $zuper, $iter); + }, TMP_Number_instance_of$q_44.$$arity = 1); + + Opal.def(self, '$lcm', TMP_Number_lcm_45 = function $$lcm(other) { + var self = this; + + + if ($truthy($$($nesting, 'Integer')['$==='](other))) { + } else { + self.$raise($$($nesting, 'TypeError'), "not an integer") + }; + + if (self == 0 || other == 0) { + return 0; + } + else { + return Math.abs(self * other / self.$gcd(other)); + } + ; + }, TMP_Number_lcm_45.$$arity = 1); + Opal.alias(self, "magnitude", "abs"); + Opal.alias(self, "modulo", "%"); + + Opal.def(self, '$next', TMP_Number_next_46 = function $$next() { + var self = this; + + return self + 1; + }, TMP_Number_next_46.$$arity = 0); + + Opal.def(self, '$nobits?', TMP_Number_nobits$q_47 = function(mask) { + var self = this; + + + mask = $$($nesting, 'Opal')['$coerce_to!'](mask, $$($nesting, 'Integer'), "to_int"); + return (self & mask) == 0;; + }, TMP_Number_nobits$q_47.$$arity = 1); + + Opal.def(self, '$nonzero?', TMP_Number_nonzero$q_48 = function() { + var self = this; + + return self == 0 ? nil : self; + }, TMP_Number_nonzero$q_48.$$arity = 0); + + Opal.def(self, '$numerator', TMP_Number_numerator_49 = function $$numerator() { + var $a, $iter = TMP_Number_numerator_49.$$p, $yield = $iter || nil, self = this, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_Number_numerator_49.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + if ($truthy(($truthy($a = self['$nan?']()) ? $a : self['$infinite?']()))) { + return self + } else { + return $send(self, Opal.find_super_dispatcher(self, 'numerator', TMP_Number_numerator_49, false), $zuper, $iter) + } + }, TMP_Number_numerator_49.$$arity = 0); + + Opal.def(self, '$odd?', TMP_Number_odd$q_50 = function() { + var self = this; + + return self % 2 !== 0; + }, TMP_Number_odd$q_50.$$arity = 0); + + Opal.def(self, '$ord', TMP_Number_ord_51 = function $$ord() { + var self = this; + + return self + }, TMP_Number_ord_51.$$arity = 0); + + Opal.def(self, '$pow', TMP_Number_pow_52 = function $$pow(b, m) { + var self = this; + + + ; + + if (self == 0) { + self.$raise($$($nesting, 'ZeroDivisionError'), "divided by 0") + } + + if (m === undefined) { + return self['$**'](b); + } else { + if (!($$($nesting, 'Integer')['$==='](b))) { + self.$raise($$($nesting, 'TypeError'), "Integer#pow() 2nd argument not allowed unless a 1st argument is integer") + } + + if (b < 0) { + self.$raise($$($nesting, 'TypeError'), "Integer#pow() 1st argument cannot be negative when 2nd argument specified") + } + + if (!($$($nesting, 'Integer')['$==='](m))) { + self.$raise($$($nesting, 'TypeError'), "Integer#pow() 2nd argument not allowed unless all arguments are integers") + } + + if (m === 0) { + self.$raise($$($nesting, 'ZeroDivisionError'), "divided by 0") + } + + return self['$**'](b)['$%'](m) + } + ; + }, TMP_Number_pow_52.$$arity = -2); + + Opal.def(self, '$pred', TMP_Number_pred_53 = function $$pred() { + var self = this; + + return self - 1; + }, TMP_Number_pred_53.$$arity = 0); + + Opal.def(self, '$quo', TMP_Number_quo_54 = function $$quo(other) { + var $iter = TMP_Number_quo_54.$$p, $yield = $iter || nil, self = this, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_Number_quo_54.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + if ($truthy($$($nesting, 'Integer')['$==='](self))) { + return $send(self, Opal.find_super_dispatcher(self, 'quo', TMP_Number_quo_54, false), $zuper, $iter) + } else { + return $rb_divide(self, other) + } + }, TMP_Number_quo_54.$$arity = 1); + + Opal.def(self, '$rationalize', TMP_Number_rationalize_55 = function $$rationalize(eps) { + var $a, $b, self = this, f = nil, n = nil; + + + ; + + if (arguments.length > 1) { + self.$raise($$($nesting, 'ArgumentError'), "" + "wrong number of arguments (" + (arguments.length) + " for 0..1)"); + } + ; + if ($truthy($$($nesting, 'Integer')['$==='](self))) { + return $$($nesting, 'Rational').$new(self, 1) + } else if ($truthy(self['$infinite?']())) { + return self.$raise($$($nesting, 'FloatDomainError'), "Infinity") + } else if ($truthy(self['$nan?']())) { + return self.$raise($$($nesting, 'FloatDomainError'), "NaN") + } else if ($truthy(eps == null)) { + + $b = $$($nesting, 'Math').$frexp(self), $a = Opal.to_ary($b), (f = ($a[0] == null ? nil : $a[0])), (n = ($a[1] == null ? nil : $a[1])), $b; + f = $$($nesting, 'Math').$ldexp(f, $$$($$($nesting, 'Float'), 'MANT_DIG')).$to_i(); + n = $rb_minus(n, $$$($$($nesting, 'Float'), 'MANT_DIG')); + return $$($nesting, 'Rational').$new($rb_times(2, f), (1)['$<<']($rb_minus(1, n))).$rationalize($$($nesting, 'Rational').$new(1, (1)['$<<']($rb_minus(1, n)))); + } else { + return self.$to_r().$rationalize(eps) + }; + }, TMP_Number_rationalize_55.$$arity = -1); + + Opal.def(self, '$remainder', TMP_Number_remainder_56 = function $$remainder(y) { + var self = this; + + return $rb_minus(self, $rb_times(y, $rb_divide(self, y).$truncate())) + }, TMP_Number_remainder_56.$$arity = 1); + + Opal.def(self, '$round', TMP_Number_round_57 = function $$round(ndigits) { + var $a, $b, self = this, _ = nil, exp = nil; + + + ; + if ($truthy($$($nesting, 'Integer')['$==='](self))) { + + if ($truthy(ndigits == null)) { + return self}; + if ($truthy(($truthy($a = $$($nesting, 'Float')['$==='](ndigits)) ? ndigits['$infinite?']() : $a))) { + self.$raise($$($nesting, 'RangeError'), "Infinity")}; + ndigits = $$($nesting, 'Opal')['$coerce_to!'](ndigits, $$($nesting, 'Integer'), "to_int"); + if ($truthy($rb_lt(ndigits, $$$($$($nesting, 'Integer'), 'MIN')))) { + self.$raise($$($nesting, 'RangeError'), "out of bounds")}; + if ($truthy(ndigits >= 0)) { + return self}; + ndigits = ndigits['$-@'](); + + if (0.415241 * ndigits - 0.125 > self.$size()) { + return 0; + } + + var f = Math.pow(10, ndigits), + x = Math.floor((Math.abs(x) + f / 2) / f) * f; + + return self < 0 ? -x : x; + ; + } else { + + if ($truthy(($truthy($a = self['$nan?']()) ? ndigits == null : $a))) { + self.$raise($$($nesting, 'FloatDomainError'), "NaN")}; + ndigits = $$($nesting, 'Opal')['$coerce_to!'](ndigits || 0, $$($nesting, 'Integer'), "to_int"); + if ($truthy($rb_le(ndigits, 0))) { + if ($truthy(self['$nan?']())) { + self.$raise($$($nesting, 'RangeError'), "NaN") + } else if ($truthy(self['$infinite?']())) { + self.$raise($$($nesting, 'FloatDomainError'), "Infinity")} + } else if (ndigits['$=='](0)) { + return Math.round(self) + } else if ($truthy(($truthy($a = self['$nan?']()) ? $a : self['$infinite?']()))) { + return self}; + $b = $$($nesting, 'Math').$frexp(self), $a = Opal.to_ary($b), (_ = ($a[0] == null ? nil : $a[0])), (exp = ($a[1] == null ? nil : $a[1])), $b; + if ($truthy($rb_ge(ndigits, $rb_minus($rb_plus($$$($$($nesting, 'Float'), 'DIG'), 2), (function() {if ($truthy($rb_gt(exp, 0))) { + return $rb_divide(exp, 4) + } else { + return $rb_minus($rb_divide(exp, 3), 1) + }; return nil; })())))) { + return self}; + if ($truthy($rb_lt(ndigits, (function() {if ($truthy($rb_gt(exp, 0))) { + return $rb_plus($rb_divide(exp, 3), 1) + } else { + return $rb_divide(exp, 4) + }; return nil; })()['$-@']()))) { + return 0}; + return Math.round(self * Math.pow(10, ndigits)) / Math.pow(10, ndigits);; + }; + }, TMP_Number_round_57.$$arity = -1); + + Opal.def(self, '$step', TMP_Number_step_58 = function $$step($a, $b, $c) { + var $iter = TMP_Number_step_58.$$p, block = $iter || nil, $post_args, $kwargs, limit, step, to, by, TMP_59, self = this, positional_args = nil, keyword_args = nil; + + if ($iter) TMP_Number_step_58.$$p = null; + + + if ($iter) TMP_Number_step_58.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + $kwargs = Opal.extract_kwargs($post_args); + + if ($kwargs == null) { + $kwargs = $hash2([], {}); + } else if (!$kwargs.$$is_hash) { + throw Opal.ArgumentError.$new('expected kwargs'); + }; + + if ($post_args.length > 0) { + limit = $post_args[0]; + $post_args.splice(0, 1); + }; + + if ($post_args.length > 0) { + step = $post_args[0]; + $post_args.splice(0, 1); + }; + + to = $kwargs.$$smap["to"];; + + by = $kwargs.$$smap["by"];; + + if (limit !== undefined && to !== undefined) { + self.$raise($$($nesting, 'ArgumentError'), "to is given twice") + } + + if (step !== undefined && by !== undefined) { + self.$raise($$($nesting, 'ArgumentError'), "step is given twice") + } + + function validateParameters() { + if (to !== undefined) { + limit = to; + } + + if (limit === undefined) { + limit = nil; + } + + if (step === nil) { + self.$raise($$($nesting, 'TypeError'), "step must be numeric") + } + + if (step === 0) { + self.$raise($$($nesting, 'ArgumentError'), "step can't be 0") + } + + if (by !== undefined) { + step = by; + } + + if (step === nil || step == null) { + step = 1; + } + + var sign = step['$<=>'](0); + + if (sign === nil) { + self.$raise($$($nesting, 'ArgumentError'), "" + "0 can't be coerced into " + (step.$class())) + } + + if (limit === nil || limit == null) { + limit = sign > 0 ? $$$($$($nesting, 'Float'), 'INFINITY') : $$$($$($nesting, 'Float'), 'INFINITY')['$-@'](); + } + + $$($nesting, 'Opal').$compare(self, limit) + } + + function stepFloatSize() { + if ((step > 0 && self > limit) || (step < 0 && self < limit)) { + return 0; + } else if (step === Infinity || step === -Infinity) { + return 1; + } else { + var abs = Math.abs, floor = Math.floor, + err = (abs(self) + abs(limit) + abs(limit - self)) / abs(step) * $$$($$($nesting, 'Float'), 'EPSILON'); + + if (err === Infinity || err === -Infinity) { + return 0; + } else { + if (err > 0.5) { + err = 0.5; + } + + return floor((limit - self) / step + err) + 1 + } + } + } + + function stepSize() { + validateParameters(); + + if (step === 0) { + return Infinity; + } + + if (step % 1 !== 0) { + return stepFloatSize(); + } else if ((step > 0 && self > limit) || (step < 0 && self < limit)) { + return 0; + } else { + var ceil = Math.ceil, abs = Math.abs, + lhs = abs(self - limit) + 1, + rhs = abs(step); + + return ceil(lhs / rhs); + } + } + ; + if ((block !== nil)) { + } else { + + positional_args = []; + keyword_args = $hash2([], {}); + + if (limit !== undefined) { + positional_args.push(limit); + } + + if (step !== undefined) { + positional_args.push(step); + } + + if (to !== undefined) { + Opal.hash_put(keyword_args, "to", to); + } + + if (by !== undefined) { + Opal.hash_put(keyword_args, "by", by); + } + + if (keyword_args['$any?']()) { + positional_args.push(keyword_args); + } + ; + return $send(self, 'enum_for', ["step"].concat(Opal.to_a(positional_args)), (TMP_59 = function(){var self = TMP_59.$$s || this; + + return stepSize();}, TMP_59.$$s = self, TMP_59.$$arity = 0, TMP_59)); + }; + + validateParameters(); + + if (step === 0) { + while (true) { + block(self); + } + } + + if (self % 1 !== 0 || limit % 1 !== 0 || step % 1 !== 0) { + var n = stepFloatSize(); + + if (n > 0) { + if (step === Infinity || step === -Infinity) { + block(self); + } else { + var i = 0, d; + + if (step > 0) { + while (i < n) { + d = i * step + self; + if (limit < d) { + d = limit; + } + block(d); + i += 1; + } + } else { + while (i < n) { + d = i * step + self; + if (limit > d) { + d = limit; + } + block(d); + i += 1 + } + } + } + } + } else { + var value = self; + + if (step > 0) { + while (value <= limit) { + block(value); + value += step; + } + } else { + while (value >= limit) { + block(value); + value += step + } + } + } + + return self; + ; + }, TMP_Number_step_58.$$arity = -1); + Opal.alias(self, "succ", "next"); + + Opal.def(self, '$times', TMP_Number_times_60 = function $$times() { + var $iter = TMP_Number_times_60.$$p, block = $iter || nil, TMP_61, self = this; + + if ($iter) TMP_Number_times_60.$$p = null; + + + if ($iter) TMP_Number_times_60.$$p = null;; + if ($truthy(block)) { + } else { + return $send(self, 'enum_for', ["times"], (TMP_61 = function(){var self = TMP_61.$$s || this; + + return self}, TMP_61.$$s = self, TMP_61.$$arity = 0, TMP_61)) + }; + + for (var i = 0; i < self; i++) { + block(i); + } + ; + return self; + }, TMP_Number_times_60.$$arity = 0); + + Opal.def(self, '$to_f', TMP_Number_to_f_62 = function $$to_f() { + var self = this; + + return self + }, TMP_Number_to_f_62.$$arity = 0); + + Opal.def(self, '$to_i', TMP_Number_to_i_63 = function $$to_i() { + var self = this; + + return parseInt(self, 10); + }, TMP_Number_to_i_63.$$arity = 0); + Opal.alias(self, "to_int", "to_i"); + + Opal.def(self, '$to_r', TMP_Number_to_r_64 = function $$to_r() { + var $a, $b, self = this, f = nil, e = nil; + + if ($truthy($$($nesting, 'Integer')['$==='](self))) { + return $$($nesting, 'Rational').$new(self, 1) + } else { + + $b = $$($nesting, 'Math').$frexp(self), $a = Opal.to_ary($b), (f = ($a[0] == null ? nil : $a[0])), (e = ($a[1] == null ? nil : $a[1])), $b; + f = $$($nesting, 'Math').$ldexp(f, $$$($$($nesting, 'Float'), 'MANT_DIG')).$to_i(); + e = $rb_minus(e, $$$($$($nesting, 'Float'), 'MANT_DIG')); + return $rb_times(f, $$$($$($nesting, 'Float'), 'RADIX')['$**'](e)).$to_r(); + } + }, TMP_Number_to_r_64.$$arity = 0); + + Opal.def(self, '$to_s', TMP_Number_to_s_65 = function $$to_s(base) { + var $a, self = this; + + + + if (base == null) { + base = 10; + }; + base = $$($nesting, 'Opal')['$coerce_to!'](base, $$($nesting, 'Integer'), "to_int"); + if ($truthy(($truthy($a = $rb_lt(base, 2)) ? $a : $rb_gt(base, 36)))) { + self.$raise($$($nesting, 'ArgumentError'), "" + "invalid radix " + (base))}; + return self.toString(base);; + }, TMP_Number_to_s_65.$$arity = -1); + + Opal.def(self, '$truncate', TMP_Number_truncate_66 = function $$truncate(ndigits) { + var self = this; + + + + if (ndigits == null) { + ndigits = 0; + }; + + var f = self.$to_f(); + + if (f % 1 === 0 && ndigits >= 0) { + return f; + } + + var factor = Math.pow(10, ndigits), + result = parseInt(f * factor, 10) / factor; + + if (f % 1 === 0) { + result = Math.round(result); + } + + return result; + ; + }, TMP_Number_truncate_66.$$arity = -1); + Opal.alias(self, "inspect", "to_s"); + + Opal.def(self, '$digits', TMP_Number_digits_67 = function $$digits(base) { + var self = this; + + + + if (base == null) { + base = 10; + }; + if ($rb_lt(self, 0)) { + self.$raise($$$($$($nesting, 'Math'), 'DomainError'), "out of domain")}; + base = $$($nesting, 'Opal')['$coerce_to!'](base, $$($nesting, 'Integer'), "to_int"); + if ($truthy($rb_lt(base, 2))) { + self.$raise($$($nesting, 'ArgumentError'), "" + "invalid radix " + (base))}; + + var value = self, result = []; + + while (value !== 0) { + result.push(value % base); + value = parseInt(value / base, 10); + } + + return result; + ; + }, TMP_Number_digits_67.$$arity = -1); + + Opal.def(self, '$divmod', TMP_Number_divmod_68 = function $$divmod(other) { + var $a, $iter = TMP_Number_divmod_68.$$p, $yield = $iter || nil, self = this, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_Number_divmod_68.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + if ($truthy(($truthy($a = self['$nan?']()) ? $a : other['$nan?']()))) { + return self.$raise($$($nesting, 'FloatDomainError'), "NaN") + } else if ($truthy(self['$infinite?']())) { + return self.$raise($$($nesting, 'FloatDomainError'), "Infinity") + } else { + return $send(self, Opal.find_super_dispatcher(self, 'divmod', TMP_Number_divmod_68, false), $zuper, $iter) + } + }, TMP_Number_divmod_68.$$arity = 1); + + Opal.def(self, '$upto', TMP_Number_upto_69 = function $$upto(stop) { + var $iter = TMP_Number_upto_69.$$p, block = $iter || nil, TMP_70, self = this; + + if ($iter) TMP_Number_upto_69.$$p = null; + + + if ($iter) TMP_Number_upto_69.$$p = null;; + if ((block !== nil)) { + } else { + return $send(self, 'enum_for', ["upto", stop], (TMP_70 = function(){var self = TMP_70.$$s || this; + + + if ($truthy($$($nesting, 'Numeric')['$==='](stop))) { + } else { + self.$raise($$($nesting, 'ArgumentError'), "" + "comparison of " + (self.$class()) + " with " + (stop.$class()) + " failed") + }; + if ($truthy($rb_lt(stop, self))) { + return 0 + } else { + return $rb_plus($rb_minus(stop, self), 1) + };}, TMP_70.$$s = self, TMP_70.$$arity = 0, TMP_70)) + }; + + if (!stop.$$is_number) { + self.$raise($$($nesting, 'ArgumentError'), "" + "comparison of " + (self.$class()) + " with " + (stop.$class()) + " failed") + } + for (var i = self; i <= stop; i++) { + block(i); + } + ; + return self; + }, TMP_Number_upto_69.$$arity = 1); + + Opal.def(self, '$zero?', TMP_Number_zero$q_71 = function() { + var self = this; + + return self == 0; + }, TMP_Number_zero$q_71.$$arity = 0); + + Opal.def(self, '$size', TMP_Number_size_72 = function $$size() { + var self = this; + + return 4 + }, TMP_Number_size_72.$$arity = 0); + + Opal.def(self, '$nan?', TMP_Number_nan$q_73 = function() { + var self = this; + + return isNaN(self); + }, TMP_Number_nan$q_73.$$arity = 0); + + Opal.def(self, '$finite?', TMP_Number_finite$q_74 = function() { + var self = this; + + return self != Infinity && self != -Infinity && !isNaN(self); + }, TMP_Number_finite$q_74.$$arity = 0); + + Opal.def(self, '$infinite?', TMP_Number_infinite$q_75 = function() { + var self = this; + + + if (self == Infinity) { + return +1; + } + else if (self == -Infinity) { + return -1; + } + else { + return nil; + } + + }, TMP_Number_infinite$q_75.$$arity = 0); + + Opal.def(self, '$positive?', TMP_Number_positive$q_76 = function() { + var self = this; + + return self != 0 && (self == Infinity || 1 / self > 0); + }, TMP_Number_positive$q_76.$$arity = 0); + return (Opal.def(self, '$negative?', TMP_Number_negative$q_77 = function() { + var self = this; + + return self == -Infinity || 1 / self < 0; + }, TMP_Number_negative$q_77.$$arity = 0), nil) && 'negative?'; + })($nesting[0], $$($nesting, 'Numeric'), $nesting); + Opal.const_set($nesting[0], 'Fixnum', $$($nesting, 'Number')); + (function($base, $super, $parent_nesting) { + function $Integer(){}; + var self = $Integer = $klass($base, $super, 'Integer', $Integer); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + + self.$$is_number_class = true; + (function(self, $parent_nesting) { + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_allocate_78, TMP_$eq$eq$eq_79, TMP_sqrt_80; + + + + Opal.def(self, '$allocate', TMP_allocate_78 = function $$allocate() { + var self = this; + + return self.$raise($$($nesting, 'TypeError'), "" + "allocator undefined for " + (self.$name())) + }, TMP_allocate_78.$$arity = 0); + + Opal.udef(self, '$' + "new");; + + Opal.def(self, '$===', TMP_$eq$eq$eq_79 = function(other) { + var self = this; + + + if (!other.$$is_number) { + return false; + } + + return (other % 1) === 0; + + }, TMP_$eq$eq$eq_79.$$arity = 1); + return (Opal.def(self, '$sqrt', TMP_sqrt_80 = function $$sqrt(n) { + var self = this; + + + n = $$($nesting, 'Opal')['$coerce_to!'](n, $$($nesting, 'Integer'), "to_int"); + + if (n < 0) { + self.$raise($$$($$($nesting, 'Math'), 'DomainError'), "Numerical argument is out of domain - \"isqrt\"") + } + + return parseInt(Math.sqrt(n), 10); + ; + }, TMP_sqrt_80.$$arity = 1), nil) && 'sqrt'; + })(Opal.get_singleton_class(self), $nesting); + Opal.const_set($nesting[0], 'MAX', Math.pow(2, 30) - 1); + return Opal.const_set($nesting[0], 'MIN', -Math.pow(2, 30)); + })($nesting[0], $$($nesting, 'Numeric'), $nesting); + return (function($base, $super, $parent_nesting) { + function $Float(){}; + var self = $Float = $klass($base, $super, 'Float', $Float); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + + self.$$is_number_class = true; + (function(self, $parent_nesting) { + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_allocate_81, TMP_$eq$eq$eq_82; + + + + Opal.def(self, '$allocate', TMP_allocate_81 = function $$allocate() { + var self = this; + + return self.$raise($$($nesting, 'TypeError'), "" + "allocator undefined for " + (self.$name())) + }, TMP_allocate_81.$$arity = 0); + + Opal.udef(self, '$' + "new");; + return (Opal.def(self, '$===', TMP_$eq$eq$eq_82 = function(other) { + var self = this; + + return !!other.$$is_number; + }, TMP_$eq$eq$eq_82.$$arity = 1), nil) && '==='; + })(Opal.get_singleton_class(self), $nesting); + Opal.const_set($nesting[0], 'INFINITY', Infinity); + Opal.const_set($nesting[0], 'MAX', Number.MAX_VALUE); + Opal.const_set($nesting[0], 'MIN', Number.MIN_VALUE); + Opal.const_set($nesting[0], 'NAN', NaN); + Opal.const_set($nesting[0], 'DIG', 15); + Opal.const_set($nesting[0], 'MANT_DIG', 53); + Opal.const_set($nesting[0], 'RADIX', 2); + return Opal.const_set($nesting[0], 'EPSILON', Number.EPSILON || 2.2204460492503130808472633361816E-16); + })($nesting[0], $$($nesting, 'Numeric'), $nesting); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/range"] = function(Opal) { + function $rb_le(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs <= rhs : lhs['$<='](rhs); + } + function $rb_lt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); + } + function $rb_gt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); + } + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + function $rb_divide(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs / rhs : lhs['$/'](rhs); + } + function $rb_plus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); + } + function $rb_times(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs * rhs : lhs['$*'](rhs); + } + function $rb_ge(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs >= rhs : lhs['$>='](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $truthy = Opal.truthy, $send = Opal.send; + + Opal.add_stubs(['$require', '$include', '$attr_reader', '$raise', '$<=>', '$include?', '$<=', '$<', '$enum_for', '$upto', '$to_proc', '$respond_to?', '$class', '$succ', '$!', '$==', '$===', '$exclude_end?', '$eql?', '$begin', '$end', '$last', '$to_a', '$>', '$-', '$abs', '$to_i', '$coerce_to!', '$ceil', '$/', '$size', '$loop', '$+', '$*', '$>=', '$each_with_index', '$%', '$bsearch', '$inspect', '$[]', '$hash']); + + self.$require("corelib/enumerable"); + return (function($base, $super, $parent_nesting) { + function $Range(){}; + var self = $Range = $klass($base, $super, 'Range', $Range); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Range_initialize_1, TMP_Range_$eq$eq_2, TMP_Range_$eq$eq$eq_3, TMP_Range_cover$q_4, TMP_Range_each_5, TMP_Range_eql$q_6, TMP_Range_exclude_end$q_7, TMP_Range_first_8, TMP_Range_last_9, TMP_Range_max_10, TMP_Range_min_11, TMP_Range_size_12, TMP_Range_step_13, TMP_Range_bsearch_17, TMP_Range_to_s_18, TMP_Range_inspect_19, TMP_Range_marshal_load_20, TMP_Range_hash_21; + + def.begin = def.end = def.excl = nil; + + self.$include($$($nesting, 'Enumerable')); + def.$$is_range = true; + self.$attr_reader("begin", "end"); + + Opal.def(self, '$initialize', TMP_Range_initialize_1 = function $$initialize(first, last, exclude) { + var self = this; + + + + if (exclude == null) { + exclude = false; + }; + if ($truthy(self.begin)) { + self.$raise($$($nesting, 'NameError'), "'initialize' called twice")}; + if ($truthy(first['$<=>'](last))) { + } else { + self.$raise($$($nesting, 'ArgumentError'), "bad value for range") + }; + self.begin = first; + self.end = last; + return (self.excl = exclude); + }, TMP_Range_initialize_1.$$arity = -3); + + Opal.def(self, '$==', TMP_Range_$eq$eq_2 = function(other) { + var self = this; + + + if (!other.$$is_range) { + return false; + } + + return self.excl === other.excl && + self.begin == other.begin && + self.end == other.end; + + }, TMP_Range_$eq$eq_2.$$arity = 1); + + Opal.def(self, '$===', TMP_Range_$eq$eq$eq_3 = function(value) { + var self = this; + + return self['$include?'](value) + }, TMP_Range_$eq$eq$eq_3.$$arity = 1); + + Opal.def(self, '$cover?', TMP_Range_cover$q_4 = function(value) { + var $a, self = this, beg_cmp = nil, end_cmp = nil; + + + beg_cmp = self.begin['$<=>'](value); + if ($truthy(($truthy($a = beg_cmp) ? $rb_le(beg_cmp, 0) : $a))) { + } else { + return false + }; + end_cmp = value['$<=>'](self.end); + if ($truthy(self.excl)) { + return ($truthy($a = end_cmp) ? $rb_lt(end_cmp, 0) : $a) + } else { + return ($truthy($a = end_cmp) ? $rb_le(end_cmp, 0) : $a) + }; + }, TMP_Range_cover$q_4.$$arity = 1); + + Opal.def(self, '$each', TMP_Range_each_5 = function $$each() { + var $iter = TMP_Range_each_5.$$p, block = $iter || nil, $a, self = this, current = nil, last = nil; + + if ($iter) TMP_Range_each_5.$$p = null; + + + if ($iter) TMP_Range_each_5.$$p = null;; + if ((block !== nil)) { + } else { + return self.$enum_for("each") + }; + + var i, limit; + + if (self.begin.$$is_number && self.end.$$is_number) { + if (self.begin % 1 !== 0 || self.end % 1 !== 0) { + self.$raise($$($nesting, 'TypeError'), "can't iterate from Float") + } + + for (i = self.begin, limit = self.end + (function() {if ($truthy(self.excl)) { + return 0 + } else { + return 1 + }; return nil; })(); i < limit; i++) { + block(i); + } + + return self; + } + + if (self.begin.$$is_string && self.end.$$is_string) { + $send(self.begin, 'upto', [self.end, self.excl], block.$to_proc()) + return self; + } + ; + current = self.begin; + last = self.end; + if ($truthy(current['$respond_to?']("succ"))) { + } else { + self.$raise($$($nesting, 'TypeError'), "" + "can't iterate from " + (current.$class())) + }; + while ($truthy($rb_lt(current['$<=>'](last), 0))) { + + Opal.yield1(block, current); + current = current.$succ(); + }; + if ($truthy(($truthy($a = self.excl['$!']()) ? current['$=='](last) : $a))) { + Opal.yield1(block, current)}; + return self; + }, TMP_Range_each_5.$$arity = 0); + + Opal.def(self, '$eql?', TMP_Range_eql$q_6 = function(other) { + var $a, $b, self = this; + + + if ($truthy($$($nesting, 'Range')['$==='](other))) { + } else { + return false + }; + return ($truthy($a = ($truthy($b = self.excl['$==='](other['$exclude_end?']())) ? self.begin['$eql?'](other.$begin()) : $b)) ? self.end['$eql?'](other.$end()) : $a); + }, TMP_Range_eql$q_6.$$arity = 1); + + Opal.def(self, '$exclude_end?', TMP_Range_exclude_end$q_7 = function() { + var self = this; + + return self.excl + }, TMP_Range_exclude_end$q_7.$$arity = 0); + + Opal.def(self, '$first', TMP_Range_first_8 = function $$first(n) { + var $iter = TMP_Range_first_8.$$p, $yield = $iter || nil, self = this, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_Range_first_8.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + + ; + if ($truthy(n == null)) { + return self.begin}; + return $send(self, Opal.find_super_dispatcher(self, 'first', TMP_Range_first_8, false), $zuper, $iter); + }, TMP_Range_first_8.$$arity = -1); + Opal.alias(self, "include?", "cover?"); + + Opal.def(self, '$last', TMP_Range_last_9 = function $$last(n) { + var self = this; + + + ; + if ($truthy(n == null)) { + return self.end}; + return self.$to_a().$last(n); + }, TMP_Range_last_9.$$arity = -1); + + Opal.def(self, '$max', TMP_Range_max_10 = function $$max() { + var $a, $iter = TMP_Range_max_10.$$p, $yield = $iter || nil, self = this, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_Range_max_10.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + if (($yield !== nil)) { + return $send(self, Opal.find_super_dispatcher(self, 'max', TMP_Range_max_10, false), $zuper, $iter) + } else if ($truthy($rb_gt(self.begin, self.end))) { + return nil + } else if ($truthy(($truthy($a = self.excl) ? self.begin['$=='](self.end) : $a))) { + return nil + } else { + return self.excl ? self.end - 1 : self.end + } + }, TMP_Range_max_10.$$arity = 0); + Opal.alias(self, "member?", "cover?"); + + Opal.def(self, '$min', TMP_Range_min_11 = function $$min() { + var $a, $iter = TMP_Range_min_11.$$p, $yield = $iter || nil, self = this, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_Range_min_11.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + if (($yield !== nil)) { + return $send(self, Opal.find_super_dispatcher(self, 'min', TMP_Range_min_11, false), $zuper, $iter) + } else if ($truthy($rb_gt(self.begin, self.end))) { + return nil + } else if ($truthy(($truthy($a = self.excl) ? self.begin['$=='](self.end) : $a))) { + return nil + } else { + return self.begin + } + }, TMP_Range_min_11.$$arity = 0); + + Opal.def(self, '$size', TMP_Range_size_12 = function $$size() { + var $a, self = this, range_begin = nil, range_end = nil, infinity = nil; + + + range_begin = self.begin; + range_end = self.end; + if ($truthy(self.excl)) { + range_end = $rb_minus(range_end, 1)}; + if ($truthy(($truthy($a = $$($nesting, 'Numeric')['$==='](range_begin)) ? $$($nesting, 'Numeric')['$==='](range_end) : $a))) { + } else { + return nil + }; + if ($truthy($rb_lt(range_end, range_begin))) { + return 0}; + infinity = $$$($$($nesting, 'Float'), 'INFINITY'); + if ($truthy([range_begin.$abs(), range_end.$abs()]['$include?'](infinity))) { + return infinity}; + return (Math.abs(range_end - range_begin) + 1).$to_i(); + }, TMP_Range_size_12.$$arity = 0); + + Opal.def(self, '$step', TMP_Range_step_13 = function $$step(n) { + var TMP_14, TMP_15, TMP_16, $iter = TMP_Range_step_13.$$p, $yield = $iter || nil, self = this, i = nil; + + if ($iter) TMP_Range_step_13.$$p = null; + + + if (n == null) { + n = 1; + }; + + function coerceStepSize() { + if (!n.$$is_number) { + n = $$($nesting, 'Opal')['$coerce_to!'](n, $$($nesting, 'Integer'), "to_int") + } + + if (n < 0) { + self.$raise($$($nesting, 'ArgumentError'), "step can't be negative") + } else if (n === 0) { + self.$raise($$($nesting, 'ArgumentError'), "step can't be 0") + } + } + + function enumeratorSize() { + if (!self.begin['$respond_to?']("succ")) { + return nil; + } + + if (self.begin.$$is_string && self.end.$$is_string) { + return nil; + } + + if (n % 1 === 0) { + return $rb_divide(self.$size(), n).$ceil(); + } else { + // n is a float + var begin = self.begin, end = self.end, + abs = Math.abs, floor = Math.floor, + err = (abs(begin) + abs(end) + abs(end - begin)) / abs(n) * $$$($$($nesting, 'Float'), 'EPSILON'), + size; + + if (err > 0.5) { + err = 0.5; + } + + if (self.excl) { + size = floor((end - begin) / n - err); + if (size * n + begin < end) { + size++; + } + } else { + size = floor((end - begin) / n + err) + 1 + } + + return size; + } + } + ; + if (($yield !== nil)) { + } else { + return $send(self, 'enum_for', ["step", n], (TMP_14 = function(){var self = TMP_14.$$s || this; + + + coerceStepSize(); + return enumeratorSize(); + }, TMP_14.$$s = self, TMP_14.$$arity = 0, TMP_14)) + }; + coerceStepSize(); + if ($truthy(self.begin.$$is_number && self.end.$$is_number)) { + + i = 0; + (function(){var $brk = Opal.new_brk(); try {return $send(self, 'loop', [], (TMP_15 = function(){var self = TMP_15.$$s || this, current = nil; + if (self.begin == null) self.begin = nil; + if (self.excl == null) self.excl = nil; + if (self.end == null) self.end = nil; + + + current = $rb_plus(self.begin, $rb_times(i, n)); + if ($truthy(self.excl)) { + if ($truthy($rb_ge(current, self.end))) { + + Opal.brk(nil, $brk)} + } else if ($truthy($rb_gt(current, self.end))) { + + Opal.brk(nil, $brk)}; + Opal.yield1($yield, current); + return (i = $rb_plus(i, 1));}, TMP_15.$$s = self, TMP_15.$$brk = $brk, TMP_15.$$arity = 0, TMP_15)) + } catch (err) { if (err === $brk) { return err.$v } else { throw err } }})(); + } else { + + + if (self.begin.$$is_string && self.end.$$is_string && n % 1 !== 0) { + self.$raise($$($nesting, 'TypeError'), "no implicit conversion to float from string") + } + ; + $send(self, 'each_with_index', [], (TMP_16 = function(value, idx){var self = TMP_16.$$s || this; + + + + if (value == null) { + value = nil; + }; + + if (idx == null) { + idx = nil; + }; + if (idx['$%'](n)['$=='](0)) { + return Opal.yield1($yield, value); + } else { + return nil + };}, TMP_16.$$s = self, TMP_16.$$arity = 2, TMP_16)); + }; + return self; + }, TMP_Range_step_13.$$arity = -1); + + Opal.def(self, '$bsearch', TMP_Range_bsearch_17 = function $$bsearch() { + var $iter = TMP_Range_bsearch_17.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Range_bsearch_17.$$p = null; + + + if ($iter) TMP_Range_bsearch_17.$$p = null;; + if ((block !== nil)) { + } else { + return self.$enum_for("bsearch") + }; + if ($truthy(self.begin.$$is_number && self.end.$$is_number)) { + } else { + self.$raise($$($nesting, 'TypeError'), "" + "can't do binary search for " + (self.begin.$class())) + }; + return $send(self.$to_a(), 'bsearch', [], block.$to_proc()); + }, TMP_Range_bsearch_17.$$arity = 0); + + Opal.def(self, '$to_s', TMP_Range_to_s_18 = function $$to_s() { + var self = this; + + return "" + (self.begin) + ((function() {if ($truthy(self.excl)) { + return "..." + } else { + return ".." + }; return nil; })()) + (self.end) + }, TMP_Range_to_s_18.$$arity = 0); + + Opal.def(self, '$inspect', TMP_Range_inspect_19 = function $$inspect() { + var self = this; + + return "" + (self.begin.$inspect()) + ((function() {if ($truthy(self.excl)) { + return "..." + } else { + return ".." + }; return nil; })()) + (self.end.$inspect()) + }, TMP_Range_inspect_19.$$arity = 0); + + Opal.def(self, '$marshal_load', TMP_Range_marshal_load_20 = function $$marshal_load(args) { + var self = this; + + + self.begin = args['$[]']("begin"); + self.end = args['$[]']("end"); + return (self.excl = args['$[]']("excl")); + }, TMP_Range_marshal_load_20.$$arity = 1); + return (Opal.def(self, '$hash', TMP_Range_hash_21 = function $$hash() { + var self = this; + + return [self.begin, self.end, self.excl].$hash() + }, TMP_Range_hash_21.$$arity = 0), nil) && 'hash'; + })($nesting[0], null, $nesting); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/proc"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $truthy = Opal.truthy; + + Opal.add_stubs(['$raise', '$coerce_to!']); + return (function($base, $super, $parent_nesting) { + function $Proc(){}; + var self = $Proc = $klass($base, $super, 'Proc', $Proc); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Proc_new_1, TMP_Proc_call_2, TMP_Proc_to_proc_3, TMP_Proc_lambda$q_4, TMP_Proc_arity_5, TMP_Proc_source_location_6, TMP_Proc_binding_7, TMP_Proc_parameters_8, TMP_Proc_curry_9, TMP_Proc_dup_10; + + + Opal.defineProperty(Function.prototype, '$$is_proc', true); + Opal.defineProperty(Function.prototype, '$$is_lambda', false); + Opal.defs(self, '$new', TMP_Proc_new_1 = function() { + var $iter = TMP_Proc_new_1.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Proc_new_1.$$p = null; + + + if ($iter) TMP_Proc_new_1.$$p = null;; + if ($truthy(block)) { + } else { + self.$raise($$($nesting, 'ArgumentError'), "tried to create a Proc object without a block") + }; + return block; + }, TMP_Proc_new_1.$$arity = 0); + + Opal.def(self, '$call', TMP_Proc_call_2 = function $$call($a) { + var $iter = TMP_Proc_call_2.$$p, block = $iter || nil, $post_args, args, self = this; + + if ($iter) TMP_Proc_call_2.$$p = null; + + + if ($iter) TMP_Proc_call_2.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + + if (block !== nil) { + self.$$p = block; + } + + var result, $brk = self.$$brk; + + if ($brk) { + try { + if (self.$$is_lambda) { + result = self.apply(null, args); + } + else { + result = Opal.yieldX(self, args); + } + } catch (err) { + if (err === $brk) { + return $brk.$v + } + else { + throw err + } + } + } + else { + if (self.$$is_lambda) { + result = self.apply(null, args); + } + else { + result = Opal.yieldX(self, args); + } + } + + return result; + ; + }, TMP_Proc_call_2.$$arity = -1); + Opal.alias(self, "[]", "call"); + Opal.alias(self, "===", "call"); + Opal.alias(self, "yield", "call"); + + Opal.def(self, '$to_proc', TMP_Proc_to_proc_3 = function $$to_proc() { + var self = this; + + return self + }, TMP_Proc_to_proc_3.$$arity = 0); + + Opal.def(self, '$lambda?', TMP_Proc_lambda$q_4 = function() { + var self = this; + + return !!self.$$is_lambda; + }, TMP_Proc_lambda$q_4.$$arity = 0); + + Opal.def(self, '$arity', TMP_Proc_arity_5 = function $$arity() { + var self = this; + + + if (self.$$is_curried) { + return -1; + } else { + return self.$$arity; + } + + }, TMP_Proc_arity_5.$$arity = 0); + + Opal.def(self, '$source_location', TMP_Proc_source_location_6 = function $$source_location() { + var self = this; + + + if (self.$$is_curried) { return nil; }; + return nil; + }, TMP_Proc_source_location_6.$$arity = 0); + + Opal.def(self, '$binding', TMP_Proc_binding_7 = function $$binding() { + var self = this; + + + if (self.$$is_curried) { self.$raise($$($nesting, 'ArgumentError'), "Can't create Binding") }; + return nil; + }, TMP_Proc_binding_7.$$arity = 0); + + Opal.def(self, '$parameters', TMP_Proc_parameters_8 = function $$parameters() { + var self = this; + + + if (self.$$is_curried) { + return [["rest"]]; + } else if (self.$$parameters) { + if (self.$$is_lambda) { + return self.$$parameters; + } else { + var result = [], i, length; + + for (i = 0, length = self.$$parameters.length; i < length; i++) { + var parameter = self.$$parameters[i]; + + if (parameter[0] === 'req') { + // required arguments always have name + parameter = ['opt', parameter[1]]; + } + + result.push(parameter); + } + + return result; + } + } else { + return []; + } + + }, TMP_Proc_parameters_8.$$arity = 0); + + Opal.def(self, '$curry', TMP_Proc_curry_9 = function $$curry(arity) { + var self = this; + + + ; + + if (arity === undefined) { + arity = self.length; + } + else { + arity = $$($nesting, 'Opal')['$coerce_to!'](arity, $$($nesting, 'Integer'), "to_int"); + if (self.$$is_lambda && arity !== self.length) { + self.$raise($$($nesting, 'ArgumentError'), "" + "wrong number of arguments (" + (arity) + " for " + (self.length) + ")") + } + } + + function curried () { + var args = $slice.call(arguments), + length = args.length, + result; + + if (length > arity && self.$$is_lambda && !self.$$is_curried) { + self.$raise($$($nesting, 'ArgumentError'), "" + "wrong number of arguments (" + (length) + " for " + (arity) + ")") + } + + if (length >= arity) { + return self.$call.apply(self, args); + } + + result = function () { + return curried.apply(null, + args.concat($slice.call(arguments))); + } + result.$$is_lambda = self.$$is_lambda; + result.$$is_curried = true; + + return result; + }; + + curried.$$is_lambda = self.$$is_lambda; + curried.$$is_curried = true; + return curried; + ; + }, TMP_Proc_curry_9.$$arity = -1); + + Opal.def(self, '$dup', TMP_Proc_dup_10 = function $$dup() { + var self = this; + + + var original_proc = self.$$original_proc || self, + proc = function () { + return original_proc.apply(this, arguments); + }; + + for (var prop in self) { + if (self.hasOwnProperty(prop)) { + proc[prop] = self[prop]; + } + } + + return proc; + + }, TMP_Proc_dup_10.$$arity = 0); + return Opal.alias(self, "clone", "dup"); + })($nesting[0], Function, $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/method"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $truthy = Opal.truthy; + + Opal.add_stubs(['$attr_reader', '$arity', '$new', '$class', '$join', '$source_location', '$raise']); + + (function($base, $super, $parent_nesting) { + function $Method(){}; + var self = $Method = $klass($base, $super, 'Method', $Method); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Method_initialize_1, TMP_Method_arity_2, TMP_Method_parameters_3, TMP_Method_source_location_4, TMP_Method_comments_5, TMP_Method_call_6, TMP_Method_unbind_7, TMP_Method_to_proc_8, TMP_Method_inspect_9; + + def.method = def.receiver = def.owner = def.name = nil; + + self.$attr_reader("owner", "receiver", "name"); + + Opal.def(self, '$initialize', TMP_Method_initialize_1 = function $$initialize(receiver, owner, method, name) { + var self = this; + + + self.receiver = receiver; + self.owner = owner; + self.name = name; + return (self.method = method); + }, TMP_Method_initialize_1.$$arity = 4); + + Opal.def(self, '$arity', TMP_Method_arity_2 = function $$arity() { + var self = this; + + return self.method.$arity() + }, TMP_Method_arity_2.$$arity = 0); + + Opal.def(self, '$parameters', TMP_Method_parameters_3 = function $$parameters() { + var self = this; + + return self.method.$$parameters + }, TMP_Method_parameters_3.$$arity = 0); + + Opal.def(self, '$source_location', TMP_Method_source_location_4 = function $$source_location() { + var $a, self = this; + + return ($truthy($a = self.method.$$source_location) ? $a : ["(eval)", 0]) + }, TMP_Method_source_location_4.$$arity = 0); + + Opal.def(self, '$comments', TMP_Method_comments_5 = function $$comments() { + var $a, self = this; + + return ($truthy($a = self.method.$$comments) ? $a : []) + }, TMP_Method_comments_5.$$arity = 0); + + Opal.def(self, '$call', TMP_Method_call_6 = function $$call($a) { + var $iter = TMP_Method_call_6.$$p, block = $iter || nil, $post_args, args, self = this; + + if ($iter) TMP_Method_call_6.$$p = null; + + + if ($iter) TMP_Method_call_6.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + + self.method.$$p = block; + + return self.method.apply(self.receiver, args); + ; + }, TMP_Method_call_6.$$arity = -1); + Opal.alias(self, "[]", "call"); + + Opal.def(self, '$unbind', TMP_Method_unbind_7 = function $$unbind() { + var self = this; + + return $$($nesting, 'UnboundMethod').$new(self.receiver.$class(), self.owner, self.method, self.name) + }, TMP_Method_unbind_7.$$arity = 0); + + Opal.def(self, '$to_proc', TMP_Method_to_proc_8 = function $$to_proc() { + var self = this; + + + var proc = self.$call.bind(self); + proc.$$unbound = self.method; + proc.$$is_lambda = true; + return proc; + + }, TMP_Method_to_proc_8.$$arity = 0); + return (Opal.def(self, '$inspect', TMP_Method_inspect_9 = function $$inspect() { + var self = this; + + return "" + "#<" + (self.$class()) + ": " + (self.receiver.$class()) + "#" + (self.name) + " (defined in " + (self.owner) + " in " + (self.$source_location().$join(":")) + ")>" + }, TMP_Method_inspect_9.$$arity = 0), nil) && 'inspect'; + })($nesting[0], null, $nesting); + return (function($base, $super, $parent_nesting) { + function $UnboundMethod(){}; + var self = $UnboundMethod = $klass($base, $super, 'UnboundMethod', $UnboundMethod); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_UnboundMethod_initialize_10, TMP_UnboundMethod_arity_11, TMP_UnboundMethod_parameters_12, TMP_UnboundMethod_source_location_13, TMP_UnboundMethod_comments_14, TMP_UnboundMethod_bind_15, TMP_UnboundMethod_inspect_16; + + def.method = def.owner = def.name = def.source = nil; + + self.$attr_reader("source", "owner", "name"); + + Opal.def(self, '$initialize', TMP_UnboundMethod_initialize_10 = function $$initialize(source, owner, method, name) { + var self = this; + + + self.source = source; + self.owner = owner; + self.method = method; + return (self.name = name); + }, TMP_UnboundMethod_initialize_10.$$arity = 4); + + Opal.def(self, '$arity', TMP_UnboundMethod_arity_11 = function $$arity() { + var self = this; + + return self.method.$arity() + }, TMP_UnboundMethod_arity_11.$$arity = 0); + + Opal.def(self, '$parameters', TMP_UnboundMethod_parameters_12 = function $$parameters() { + var self = this; + + return self.method.$$parameters + }, TMP_UnboundMethod_parameters_12.$$arity = 0); + + Opal.def(self, '$source_location', TMP_UnboundMethod_source_location_13 = function $$source_location() { + var $a, self = this; + + return ($truthy($a = self.method.$$source_location) ? $a : ["(eval)", 0]) + }, TMP_UnboundMethod_source_location_13.$$arity = 0); + + Opal.def(self, '$comments', TMP_UnboundMethod_comments_14 = function $$comments() { + var $a, self = this; + + return ($truthy($a = self.method.$$comments) ? $a : []) + }, TMP_UnboundMethod_comments_14.$$arity = 0); + + Opal.def(self, '$bind', TMP_UnboundMethod_bind_15 = function $$bind(object) { + var self = this; + + + if (self.owner.$$is_module || Opal.is_a(object, self.owner)) { + return $$($nesting, 'Method').$new(object, self.owner, self.method, self.name); + } + else { + self.$raise($$($nesting, 'TypeError'), "" + "can't bind singleton method to a different class (expected " + (object) + ".kind_of?(" + (self.owner) + " to be true)"); + } + + }, TMP_UnboundMethod_bind_15.$$arity = 1); + return (Opal.def(self, '$inspect', TMP_UnboundMethod_inspect_16 = function $$inspect() { + var self = this; + + return "" + "#<" + (self.$class()) + ": " + (self.source) + "#" + (self.name) + " (defined in " + (self.owner) + " in " + (self.$source_location().$join(":")) + ")>" + }, TMP_UnboundMethod_inspect_16.$$arity = 0), nil) && 'inspect'; + })($nesting[0], null, $nesting); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/variables"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $gvars = Opal.gvars, $hash2 = Opal.hash2; + + Opal.add_stubs(['$new']); + + $gvars['&'] = $gvars['~'] = $gvars['`'] = $gvars["'"] = nil; + $gvars.LOADED_FEATURES = ($gvars["\""] = Opal.loaded_features); + $gvars.LOAD_PATH = ($gvars[":"] = []); + $gvars["/"] = "\n"; + $gvars[","] = nil; + Opal.const_set($nesting[0], 'ARGV', []); + Opal.const_set($nesting[0], 'ARGF', $$($nesting, 'Object').$new()); + Opal.const_set($nesting[0], 'ENV', $hash2([], {})); + $gvars.VERBOSE = false; + $gvars.DEBUG = false; + return ($gvars.SAFE = 0); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["opal/regexp_anchors"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module; + + Opal.add_stubs(['$==', '$new']); + return (function($base, $parent_nesting) { + function $Opal() {}; + var self = $Opal = $module($base, 'Opal', $Opal); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + + Opal.const_set($nesting[0], 'REGEXP_START', (function() {if ($$($nesting, 'RUBY_ENGINE')['$==']("opal")) { + return "^" + } else { + return nil + }; return nil; })()); + Opal.const_set($nesting[0], 'REGEXP_END', (function() {if ($$($nesting, 'RUBY_ENGINE')['$==']("opal")) { + return "$" + } else { + return nil + }; return nil; })()); + Opal.const_set($nesting[0], 'FORBIDDEN_STARTING_IDENTIFIER_CHARS', "\\u0001-\\u002F\\u003A-\\u0040\\u005B-\\u005E\\u0060\\u007B-\\u007F"); + Opal.const_set($nesting[0], 'FORBIDDEN_ENDING_IDENTIFIER_CHARS', "\\u0001-\\u0020\\u0022-\\u002F\\u003A-\\u003E\\u0040\\u005B-\\u005E\\u0060\\u007B-\\u007F"); + Opal.const_set($nesting[0], 'INLINE_IDENTIFIER_REGEXP', $$($nesting, 'Regexp').$new("" + "[^" + ($$($nesting, 'FORBIDDEN_STARTING_IDENTIFIER_CHARS')) + "]*[^" + ($$($nesting, 'FORBIDDEN_ENDING_IDENTIFIER_CHARS')) + "]")); + Opal.const_set($nesting[0], 'FORBIDDEN_CONST_NAME_CHARS', "\\u0001-\\u0020\\u0021-\\u002F\\u003B-\\u003F\\u0040\\u005B-\\u005E\\u0060\\u007B-\\u007F"); + Opal.const_set($nesting[0], 'CONST_NAME_REGEXP', $$($nesting, 'Regexp').$new("" + ($$($nesting, 'REGEXP_START')) + "(::)?[A-Z][^" + ($$($nesting, 'FORBIDDEN_CONST_NAME_CHARS')) + "]*" + ($$($nesting, 'REGEXP_END')))); + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["opal/mini"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice; + + Opal.add_stubs(['$require']); + + self.$require("opal/base"); + self.$require("corelib/nil"); + self.$require("corelib/boolean"); + self.$require("corelib/string"); + self.$require("corelib/comparable"); + self.$require("corelib/enumerable"); + self.$require("corelib/enumerator"); + self.$require("corelib/array"); + self.$require("corelib/hash"); + self.$require("corelib/number"); + self.$require("corelib/range"); + self.$require("corelib/proc"); + self.$require("corelib/method"); + self.$require("corelib/regexp"); + self.$require("corelib/variables"); + return self.$require("opal/regexp_anchors"); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/string/encoding"] = function(Opal) { + function $rb_plus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); + } + var TMP_12, TMP_15, TMP_18, TMP_21, TMP_24, self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $hash2 = Opal.hash2, $truthy = Opal.truthy, $send = Opal.send; + + Opal.add_stubs(['$require', '$+', '$[]', '$new', '$to_proc', '$each', '$const_set', '$sub', '$==', '$default_external', '$upcase', '$raise', '$attr_accessor', '$attr_reader', '$register', '$length', '$bytes', '$to_a', '$each_byte', '$bytesize', '$enum_for', '$force_encoding', '$dup', '$coerce_to!', '$find', '$getbyte']); + + self.$require("corelib/string"); + (function($base, $super, $parent_nesting) { + function $Encoding(){}; + var self = $Encoding = $klass($base, $super, 'Encoding', $Encoding); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Encoding_register_1, TMP_Encoding_find_3, TMP_Encoding_initialize_4, TMP_Encoding_ascii_compatible$q_5, TMP_Encoding_dummy$q_6, TMP_Encoding_to_s_7, TMP_Encoding_inspect_8, TMP_Encoding_each_byte_9, TMP_Encoding_getbyte_10, TMP_Encoding_bytesize_11; + + def.ascii = def.dummy = def.name = nil; + + Opal.defineProperty(self, '$$register', {}); + Opal.defs(self, '$register', TMP_Encoding_register_1 = function $$register(name, options) { + var $iter = TMP_Encoding_register_1.$$p, block = $iter || nil, $a, TMP_2, self = this, names = nil, encoding = nil, register = nil; + + if ($iter) TMP_Encoding_register_1.$$p = null; + + + if ($iter) TMP_Encoding_register_1.$$p = null;; + + if (options == null) { + options = $hash2([], {}); + }; + names = $rb_plus([name], ($truthy($a = options['$[]']("aliases")) ? $a : [])); + encoding = $send($$($nesting, 'Class'), 'new', [self], block.$to_proc()).$new(name, names, ($truthy($a = options['$[]']("ascii")) ? $a : false), ($truthy($a = options['$[]']("dummy")) ? $a : false)); + register = self["$$register"]; + return $send(names, 'each', [], (TMP_2 = function(encoding_name){var self = TMP_2.$$s || this; + + + + if (encoding_name == null) { + encoding_name = nil; + }; + self.$const_set(encoding_name.$sub("-", "_"), encoding); + return register["" + "$$" + (encoding_name)] = encoding;}, TMP_2.$$s = self, TMP_2.$$arity = 1, TMP_2)); + }, TMP_Encoding_register_1.$$arity = -2); + Opal.defs(self, '$find', TMP_Encoding_find_3 = function $$find(name) { + var $a, self = this, register = nil, encoding = nil; + + + if (name['$==']("default_external")) { + return self.$default_external()}; + register = self["$$register"]; + encoding = ($truthy($a = register["" + "$$" + (name)]) ? $a : register["" + "$$" + (name.$upcase())]); + if ($truthy(encoding)) { + } else { + self.$raise($$($nesting, 'ArgumentError'), "" + "unknown encoding name - " + (name)) + }; + return encoding; + }, TMP_Encoding_find_3.$$arity = 1); + (function(self, $parent_nesting) { + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return self.$attr_accessor("default_external") + })(Opal.get_singleton_class(self), $nesting); + self.$attr_reader("name", "names"); + + Opal.def(self, '$initialize', TMP_Encoding_initialize_4 = function $$initialize(name, names, ascii, dummy) { + var self = this; + + + self.name = name; + self.names = names; + self.ascii = ascii; + return (self.dummy = dummy); + }, TMP_Encoding_initialize_4.$$arity = 4); + + Opal.def(self, '$ascii_compatible?', TMP_Encoding_ascii_compatible$q_5 = function() { + var self = this; + + return self.ascii + }, TMP_Encoding_ascii_compatible$q_5.$$arity = 0); + + Opal.def(self, '$dummy?', TMP_Encoding_dummy$q_6 = function() { + var self = this; + + return self.dummy + }, TMP_Encoding_dummy$q_6.$$arity = 0); + + Opal.def(self, '$to_s', TMP_Encoding_to_s_7 = function $$to_s() { + var self = this; + + return self.name + }, TMP_Encoding_to_s_7.$$arity = 0); + + Opal.def(self, '$inspect', TMP_Encoding_inspect_8 = function $$inspect() { + var self = this; + + return "" + "#" + }, TMP_Encoding_inspect_8.$$arity = 0); + + Opal.def(self, '$each_byte', TMP_Encoding_each_byte_9 = function $$each_byte($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return self.$raise($$($nesting, 'NotImplementedError')); + }, TMP_Encoding_each_byte_9.$$arity = -1); + + Opal.def(self, '$getbyte', TMP_Encoding_getbyte_10 = function $$getbyte($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return self.$raise($$($nesting, 'NotImplementedError')); + }, TMP_Encoding_getbyte_10.$$arity = -1); + + Opal.def(self, '$bytesize', TMP_Encoding_bytesize_11 = function $$bytesize($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return self.$raise($$($nesting, 'NotImplementedError')); + }, TMP_Encoding_bytesize_11.$$arity = -1); + (function($base, $super, $parent_nesting) { + function $EncodingError(){}; + var self = $EncodingError = $klass($base, $super, 'EncodingError', $EncodingError); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return nil + })($nesting[0], $$($nesting, 'StandardError'), $nesting); + return (function($base, $super, $parent_nesting) { + function $CompatibilityError(){}; + var self = $CompatibilityError = $klass($base, $super, 'CompatibilityError', $CompatibilityError); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return nil + })($nesting[0], $$($nesting, 'EncodingError'), $nesting); + })($nesting[0], null, $nesting); + $send($$($nesting, 'Encoding'), 'register', ["UTF-8", $hash2(["aliases", "ascii"], {"aliases": ["CP65001"], "ascii": true})], (TMP_12 = function(){var self = TMP_12.$$s || this, TMP_each_byte_13, TMP_bytesize_14; + + + + Opal.def(self, '$each_byte', TMP_each_byte_13 = function $$each_byte(string) { + var $iter = TMP_each_byte_13.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_each_byte_13.$$p = null; + + + if ($iter) TMP_each_byte_13.$$p = null;; + + for (var i = 0, length = string.length; i < length; i++) { + var code = string.charCodeAt(i); + + if (code <= 0x7f) { + Opal.yield1(block, code); + } + else { + var encoded = encodeURIComponent(string.charAt(i)).substr(1).split('%'); + + for (var j = 0, encoded_length = encoded.length; j < encoded_length; j++) { + Opal.yield1(block, parseInt(encoded[j], 16)); + } + } + } + ; + }, TMP_each_byte_13.$$arity = 1); + return (Opal.def(self, '$bytesize', TMP_bytesize_14 = function $$bytesize(string) { + var self = this; + + return string.$bytes().$length() + }, TMP_bytesize_14.$$arity = 1), nil) && 'bytesize';}, TMP_12.$$s = self, TMP_12.$$arity = 0, TMP_12)); + $send($$($nesting, 'Encoding'), 'register', ["UTF-16LE"], (TMP_15 = function(){var self = TMP_15.$$s || this, TMP_each_byte_16, TMP_bytesize_17; + + + + Opal.def(self, '$each_byte', TMP_each_byte_16 = function $$each_byte(string) { + var $iter = TMP_each_byte_16.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_each_byte_16.$$p = null; + + + if ($iter) TMP_each_byte_16.$$p = null;; + + for (var i = 0, length = string.length; i < length; i++) { + var code = string.charCodeAt(i); + + Opal.yield1(block, code & 0xff); + Opal.yield1(block, code >> 8); + } + ; + }, TMP_each_byte_16.$$arity = 1); + return (Opal.def(self, '$bytesize', TMP_bytesize_17 = function $$bytesize(string) { + var self = this; + + return string.$bytes().$length() + }, TMP_bytesize_17.$$arity = 1), nil) && 'bytesize';}, TMP_15.$$s = self, TMP_15.$$arity = 0, TMP_15)); + $send($$($nesting, 'Encoding'), 'register', ["UTF-16BE"], (TMP_18 = function(){var self = TMP_18.$$s || this, TMP_each_byte_19, TMP_bytesize_20; + + + + Opal.def(self, '$each_byte', TMP_each_byte_19 = function $$each_byte(string) { + var $iter = TMP_each_byte_19.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_each_byte_19.$$p = null; + + + if ($iter) TMP_each_byte_19.$$p = null;; + + for (var i = 0, length = string.length; i < length; i++) { + var code = string.charCodeAt(i); + + Opal.yield1(block, code >> 8); + Opal.yield1(block, code & 0xff); + } + ; + }, TMP_each_byte_19.$$arity = 1); + return (Opal.def(self, '$bytesize', TMP_bytesize_20 = function $$bytesize(string) { + var self = this; + + return string.$bytes().$length() + }, TMP_bytesize_20.$$arity = 1), nil) && 'bytesize';}, TMP_18.$$s = self, TMP_18.$$arity = 0, TMP_18)); + $send($$($nesting, 'Encoding'), 'register', ["UTF-32LE"], (TMP_21 = function(){var self = TMP_21.$$s || this, TMP_each_byte_22, TMP_bytesize_23; + + + + Opal.def(self, '$each_byte', TMP_each_byte_22 = function $$each_byte(string) { + var $iter = TMP_each_byte_22.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_each_byte_22.$$p = null; + + + if ($iter) TMP_each_byte_22.$$p = null;; + + for (var i = 0, length = string.length; i < length; i++) { + var code = string.charCodeAt(i); + + Opal.yield1(block, code & 0xff); + Opal.yield1(block, code >> 8); + } + ; + }, TMP_each_byte_22.$$arity = 1); + return (Opal.def(self, '$bytesize', TMP_bytesize_23 = function $$bytesize(string) { + var self = this; + + return string.$bytes().$length() + }, TMP_bytesize_23.$$arity = 1), nil) && 'bytesize';}, TMP_21.$$s = self, TMP_21.$$arity = 0, TMP_21)); + $send($$($nesting, 'Encoding'), 'register', ["ASCII-8BIT", $hash2(["aliases", "ascii", "dummy"], {"aliases": ["BINARY", "US-ASCII", "ASCII"], "ascii": true, "dummy": true})], (TMP_24 = function(){var self = TMP_24.$$s || this, TMP_each_byte_25, TMP_bytesize_26; + + + + Opal.def(self, '$each_byte', TMP_each_byte_25 = function $$each_byte(string) { + var $iter = TMP_each_byte_25.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_each_byte_25.$$p = null; + + + if ($iter) TMP_each_byte_25.$$p = null;; + + for (var i = 0, length = string.length; i < length; i++) { + var code = string.charCodeAt(i); + Opal.yield1(block, code & 0xff); + Opal.yield1(block, code >> 8); + } + ; + }, TMP_each_byte_25.$$arity = 1); + return (Opal.def(self, '$bytesize', TMP_bytesize_26 = function $$bytesize(string) { + var self = this; + + return string.$bytes().$length() + }, TMP_bytesize_26.$$arity = 1), nil) && 'bytesize';}, TMP_24.$$s = self, TMP_24.$$arity = 0, TMP_24)); + return (function($base, $super, $parent_nesting) { + function $String(){}; + var self = $String = $klass($base, $super, 'String', $String); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_String_bytes_27, TMP_String_bytesize_28, TMP_String_each_byte_29, TMP_String_encode_30, TMP_String_force_encoding_31, TMP_String_getbyte_32, TMP_String_valid_encoding$q_33; + + def.encoding = nil; + + self.$attr_reader("encoding"); + Opal.defineProperty(String.prototype, 'encoding', $$$($$($nesting, 'Encoding'), 'UTF_16LE')); + + Opal.def(self, '$bytes', TMP_String_bytes_27 = function $$bytes() { + var self = this; + + return self.$each_byte().$to_a() + }, TMP_String_bytes_27.$$arity = 0); + + Opal.def(self, '$bytesize', TMP_String_bytesize_28 = function $$bytesize() { + var self = this; + + return self.encoding.$bytesize(self) + }, TMP_String_bytesize_28.$$arity = 0); + + Opal.def(self, '$each_byte', TMP_String_each_byte_29 = function $$each_byte() { + var $iter = TMP_String_each_byte_29.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_String_each_byte_29.$$p = null; + + + if ($iter) TMP_String_each_byte_29.$$p = null;; + if ((block !== nil)) { + } else { + return self.$enum_for("each_byte") + }; + $send(self.encoding, 'each_byte', [self], block.$to_proc()); + return self; + }, TMP_String_each_byte_29.$$arity = 0); + + Opal.def(self, '$encode', TMP_String_encode_30 = function $$encode(encoding) { + var self = this; + + return self.$dup().$force_encoding(encoding) + }, TMP_String_encode_30.$$arity = 1); + + Opal.def(self, '$force_encoding', TMP_String_force_encoding_31 = function $$force_encoding(encoding) { + var self = this; + + + if (encoding === self.encoding) { return self; } + + encoding = $$($nesting, 'Opal')['$coerce_to!'](encoding, $$($nesting, 'String'), "to_s"); + encoding = $$($nesting, 'Encoding').$find(encoding); + + if (encoding === self.encoding) { return self; } + + self.encoding = encoding; + return self; + + }, TMP_String_force_encoding_31.$$arity = 1); + + Opal.def(self, '$getbyte', TMP_String_getbyte_32 = function $$getbyte(idx) { + var self = this; + + return self.encoding.$getbyte(self, idx) + }, TMP_String_getbyte_32.$$arity = 1); + return (Opal.def(self, '$valid_encoding?', TMP_String_valid_encoding$q_33 = function() { + var self = this; + + return true + }, TMP_String_valid_encoding$q_33.$$arity = 0), nil) && 'valid_encoding?'; + })($nesting[0], null, $nesting); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/math"] = function(Opal) { + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + function $rb_divide(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs / rhs : lhs['$/'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $truthy = Opal.truthy; + + Opal.add_stubs(['$new', '$raise', '$Float', '$type_error', '$Integer', '$module_function', '$checked', '$float!', '$===', '$gamma', '$-', '$integer!', '$/', '$infinite?']); + return (function($base, $parent_nesting) { + function $Math() {}; + var self = $Math = $module($base, 'Math', $Math); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Math_checked_1, TMP_Math_float$B_2, TMP_Math_integer$B_3, TMP_Math_acos_4, TMP_Math_acosh_5, TMP_Math_asin_6, TMP_Math_asinh_7, TMP_Math_atan_8, TMP_Math_atan2_9, TMP_Math_atanh_10, TMP_Math_cbrt_11, TMP_Math_cos_12, TMP_Math_cosh_13, TMP_Math_erf_14, TMP_Math_erfc_15, TMP_Math_exp_16, TMP_Math_frexp_17, TMP_Math_gamma_18, TMP_Math_hypot_19, TMP_Math_ldexp_20, TMP_Math_lgamma_21, TMP_Math_log_22, TMP_Math_log10_23, TMP_Math_log2_24, TMP_Math_sin_25, TMP_Math_sinh_26, TMP_Math_sqrt_27, TMP_Math_tan_28, TMP_Math_tanh_29; + + + Opal.const_set($nesting[0], 'E', Math.E); + Opal.const_set($nesting[0], 'PI', Math.PI); + Opal.const_set($nesting[0], 'DomainError', $$($nesting, 'Class').$new($$($nesting, 'StandardError'))); + Opal.defs(self, '$checked', TMP_Math_checked_1 = function $$checked(method, $a) { + var $post_args, args, self = this; + + + + $post_args = Opal.slice.call(arguments, 1, arguments.length); + + args = $post_args;; + + if (isNaN(args[0]) || (args.length == 2 && isNaN(args[1]))) { + return NaN; + } + + var result = Math[method].apply(null, args); + + if (isNaN(result)) { + self.$raise($$($nesting, 'DomainError'), "" + "Numerical argument is out of domain - \"" + (method) + "\""); + } + + return result; + ; + }, TMP_Math_checked_1.$$arity = -2); + Opal.defs(self, '$float!', TMP_Math_float$B_2 = function(value) { + var self = this; + + try { + return self.$Float(value) + } catch ($err) { + if (Opal.rescue($err, [$$($nesting, 'ArgumentError')])) { + try { + return self.$raise($$($nesting, 'Opal').$type_error(value, $$($nesting, 'Float'))) + } finally { Opal.pop_exception() } + } else { throw $err; } + } + }, TMP_Math_float$B_2.$$arity = 1); + Opal.defs(self, '$integer!', TMP_Math_integer$B_3 = function(value) { + var self = this; + + try { + return self.$Integer(value) + } catch ($err) { + if (Opal.rescue($err, [$$($nesting, 'ArgumentError')])) { + try { + return self.$raise($$($nesting, 'Opal').$type_error(value, $$($nesting, 'Integer'))) + } finally { Opal.pop_exception() } + } else { throw $err; } + } + }, TMP_Math_integer$B_3.$$arity = 1); + self.$module_function(); + + Opal.def(self, '$acos', TMP_Math_acos_4 = function $$acos(x) { + var self = this; + + return $$($nesting, 'Math').$checked("acos", $$($nesting, 'Math')['$float!'](x)) + }, TMP_Math_acos_4.$$arity = 1); + if ($truthy((typeof(Math.acosh) !== "undefined"))) { + } else { + + Math.acosh = function(x) { + return Math.log(x + Math.sqrt(x * x - 1)); + } + + }; + + Opal.def(self, '$acosh', TMP_Math_acosh_5 = function $$acosh(x) { + var self = this; + + return $$($nesting, 'Math').$checked("acosh", $$($nesting, 'Math')['$float!'](x)) + }, TMP_Math_acosh_5.$$arity = 1); + + Opal.def(self, '$asin', TMP_Math_asin_6 = function $$asin(x) { + var self = this; + + return $$($nesting, 'Math').$checked("asin", $$($nesting, 'Math')['$float!'](x)) + }, TMP_Math_asin_6.$$arity = 1); + if ($truthy((typeof(Math.asinh) !== "undefined"))) { + } else { + + Math.asinh = function(x) { + return Math.log(x + Math.sqrt(x * x + 1)) + } + + }; + + Opal.def(self, '$asinh', TMP_Math_asinh_7 = function $$asinh(x) { + var self = this; + + return $$($nesting, 'Math').$checked("asinh", $$($nesting, 'Math')['$float!'](x)) + }, TMP_Math_asinh_7.$$arity = 1); + + Opal.def(self, '$atan', TMP_Math_atan_8 = function $$atan(x) { + var self = this; + + return $$($nesting, 'Math').$checked("atan", $$($nesting, 'Math')['$float!'](x)) + }, TMP_Math_atan_8.$$arity = 1); + + Opal.def(self, '$atan2', TMP_Math_atan2_9 = function $$atan2(y, x) { + var self = this; + + return $$($nesting, 'Math').$checked("atan2", $$($nesting, 'Math')['$float!'](y), $$($nesting, 'Math')['$float!'](x)) + }, TMP_Math_atan2_9.$$arity = 2); + if ($truthy((typeof(Math.atanh) !== "undefined"))) { + } else { + + Math.atanh = function(x) { + return 0.5 * Math.log((1 + x) / (1 - x)); + } + + }; + + Opal.def(self, '$atanh', TMP_Math_atanh_10 = function $$atanh(x) { + var self = this; + + return $$($nesting, 'Math').$checked("atanh", $$($nesting, 'Math')['$float!'](x)) + }, TMP_Math_atanh_10.$$arity = 1); + if ($truthy((typeof(Math.cbrt) !== "undefined"))) { + } else { + + Math.cbrt = function(x) { + if (x == 0) { + return 0; + } + + if (x < 0) { + return -Math.cbrt(-x); + } + + var r = x, + ex = 0; + + while (r < 0.125) { + r *= 8; + ex--; + } + + while (r > 1.0) { + r *= 0.125; + ex++; + } + + r = (-0.46946116 * r + 1.072302) * r + 0.3812513; + + while (ex < 0) { + r *= 0.5; + ex++; + } + + while (ex > 0) { + r *= 2; + ex--; + } + + r = (2.0 / 3.0) * r + (1.0 / 3.0) * x / (r * r); + r = (2.0 / 3.0) * r + (1.0 / 3.0) * x / (r * r); + r = (2.0 / 3.0) * r + (1.0 / 3.0) * x / (r * r); + r = (2.0 / 3.0) * r + (1.0 / 3.0) * x / (r * r); + + return r; + } + + }; + + Opal.def(self, '$cbrt', TMP_Math_cbrt_11 = function $$cbrt(x) { + var self = this; + + return $$($nesting, 'Math').$checked("cbrt", $$($nesting, 'Math')['$float!'](x)) + }, TMP_Math_cbrt_11.$$arity = 1); + + Opal.def(self, '$cos', TMP_Math_cos_12 = function $$cos(x) { + var self = this; + + return $$($nesting, 'Math').$checked("cos", $$($nesting, 'Math')['$float!'](x)) + }, TMP_Math_cos_12.$$arity = 1); + if ($truthy((typeof(Math.cosh) !== "undefined"))) { + } else { + + Math.cosh = function(x) { + return (Math.exp(x) + Math.exp(-x)) / 2; + } + + }; + + Opal.def(self, '$cosh', TMP_Math_cosh_13 = function $$cosh(x) { + var self = this; + + return $$($nesting, 'Math').$checked("cosh", $$($nesting, 'Math')['$float!'](x)) + }, TMP_Math_cosh_13.$$arity = 1); + if ($truthy((typeof(Math.erf) !== "undefined"))) { + } else { + + Opal.defineProperty(Math, 'erf', function(x) { + var A1 = 0.254829592, + A2 = -0.284496736, + A3 = 1.421413741, + A4 = -1.453152027, + A5 = 1.061405429, + P = 0.3275911; + + var sign = 1; + + if (x < 0) { + sign = -1; + } + + x = Math.abs(x); + + var t = 1.0 / (1.0 + P * x); + var y = 1.0 - (((((A5 * t + A4) * t) + A3) * t + A2) * t + A1) * t * Math.exp(-x * x); + + return sign * y; + }); + + }; + + Opal.def(self, '$erf', TMP_Math_erf_14 = function $$erf(x) { + var self = this; + + return $$($nesting, 'Math').$checked("erf", $$($nesting, 'Math')['$float!'](x)) + }, TMP_Math_erf_14.$$arity = 1); + if ($truthy((typeof(Math.erfc) !== "undefined"))) { + } else { + + Opal.defineProperty(Math, 'erfc', function(x) { + var z = Math.abs(x), + t = 1.0 / (0.5 * z + 1.0); + + var A1 = t * 0.17087277 + -0.82215223, + A2 = t * A1 + 1.48851587, + A3 = t * A2 + -1.13520398, + A4 = t * A3 + 0.27886807, + A5 = t * A4 + -0.18628806, + A6 = t * A5 + 0.09678418, + A7 = t * A6 + 0.37409196, + A8 = t * A7 + 1.00002368, + A9 = t * A8, + A10 = -z * z - 1.26551223 + A9; + + var a = t * Math.exp(A10); + + if (x < 0.0) { + return 2.0 - a; + } + else { + return a; + } + }); + + }; + + Opal.def(self, '$erfc', TMP_Math_erfc_15 = function $$erfc(x) { + var self = this; + + return $$($nesting, 'Math').$checked("erfc", $$($nesting, 'Math')['$float!'](x)) + }, TMP_Math_erfc_15.$$arity = 1); + + Opal.def(self, '$exp', TMP_Math_exp_16 = function $$exp(x) { + var self = this; + + return $$($nesting, 'Math').$checked("exp", $$($nesting, 'Math')['$float!'](x)) + }, TMP_Math_exp_16.$$arity = 1); + + Opal.def(self, '$frexp', TMP_Math_frexp_17 = function $$frexp(x) { + var self = this; + + + x = $$($nesting, 'Math')['$float!'](x); + + if (isNaN(x)) { + return [NaN, 0]; + } + + var ex = Math.floor(Math.log(Math.abs(x)) / Math.log(2)) + 1, + frac = x / Math.pow(2, ex); + + return [frac, ex]; + ; + }, TMP_Math_frexp_17.$$arity = 1); + + Opal.def(self, '$gamma', TMP_Math_gamma_18 = function $$gamma(n) { + var self = this; + + + n = $$($nesting, 'Math')['$float!'](n); + + var i, t, x, value, result, twoN, threeN, fourN, fiveN; + + var G = 4.7421875; + + var P = [ + 0.99999999999999709182, + 57.156235665862923517, + -59.597960355475491248, + 14.136097974741747174, + -0.49191381609762019978, + 0.33994649984811888699e-4, + 0.46523628927048575665e-4, + -0.98374475304879564677e-4, + 0.15808870322491248884e-3, + -0.21026444172410488319e-3, + 0.21743961811521264320e-3, + -0.16431810653676389022e-3, + 0.84418223983852743293e-4, + -0.26190838401581408670e-4, + 0.36899182659531622704e-5 + ]; + + + if (isNaN(n)) { + return NaN; + } + + if (n === 0 && 1 / n < 0) { + return -Infinity; + } + + if (n === -1 || n === -Infinity) { + self.$raise($$($nesting, 'DomainError'), "Numerical argument is out of domain - \"gamma\""); + } + + if ($$($nesting, 'Integer')['$==='](n)) { + if (n <= 0) { + return isFinite(n) ? Infinity : NaN; + } + + if (n > 171) { + return Infinity; + } + + value = n - 2; + result = n - 1; + + while (value > 1) { + result *= value; + value--; + } + + if (result == 0) { + result = 1; + } + + return result; + } + + if (n < 0.5) { + return Math.PI / (Math.sin(Math.PI * n) * $$($nesting, 'Math').$gamma($rb_minus(1, n))); + } + + if (n >= 171.35) { + return Infinity; + } + + if (n > 85.0) { + twoN = n * n; + threeN = twoN * n; + fourN = threeN * n; + fiveN = fourN * n; + + return Math.sqrt(2 * Math.PI / n) * Math.pow((n / Math.E), n) * + (1 + 1 / (12 * n) + 1 / (288 * twoN) - 139 / (51840 * threeN) - + 571 / (2488320 * fourN) + 163879 / (209018880 * fiveN) + + 5246819 / (75246796800 * fiveN * n)); + } + + n -= 1; + x = P[0]; + + for (i = 1; i < P.length; ++i) { + x += P[i] / (n + i); + } + + t = n + G + 0.5; + + return Math.sqrt(2 * Math.PI) * Math.pow(t, n + 0.5) * Math.exp(-t) * x; + ; + }, TMP_Math_gamma_18.$$arity = 1); + if ($truthy((typeof(Math.hypot) !== "undefined"))) { + } else { + + Math.hypot = function(x, y) { + return Math.sqrt(x * x + y * y) + } + + }; + + Opal.def(self, '$hypot', TMP_Math_hypot_19 = function $$hypot(x, y) { + var self = this; + + return $$($nesting, 'Math').$checked("hypot", $$($nesting, 'Math')['$float!'](x), $$($nesting, 'Math')['$float!'](y)) + }, TMP_Math_hypot_19.$$arity = 2); + + Opal.def(self, '$ldexp', TMP_Math_ldexp_20 = function $$ldexp(mantissa, exponent) { + var self = this; + + + mantissa = $$($nesting, 'Math')['$float!'](mantissa); + exponent = $$($nesting, 'Math')['$integer!'](exponent); + + if (isNaN(exponent)) { + self.$raise($$($nesting, 'RangeError'), "float NaN out of range of integer"); + } + + return mantissa * Math.pow(2, exponent); + ; + }, TMP_Math_ldexp_20.$$arity = 2); + + Opal.def(self, '$lgamma', TMP_Math_lgamma_21 = function $$lgamma(n) { + var self = this; + + + if (n == -1) { + return [Infinity, 1]; + } + else { + return [Math.log(Math.abs($$($nesting, 'Math').$gamma(n))), $$($nesting, 'Math').$gamma(n) < 0 ? -1 : 1]; + } + + }, TMP_Math_lgamma_21.$$arity = 1); + + Opal.def(self, '$log', TMP_Math_log_22 = function $$log(x, base) { + var self = this; + + + ; + if ($truthy($$($nesting, 'String')['$==='](x))) { + self.$raise($$($nesting, 'Opal').$type_error(x, $$($nesting, 'Float')))}; + if ($truthy(base == null)) { + return $$($nesting, 'Math').$checked("log", $$($nesting, 'Math')['$float!'](x)) + } else { + + if ($truthy($$($nesting, 'String')['$==='](base))) { + self.$raise($$($nesting, 'Opal').$type_error(base, $$($nesting, 'Float')))}; + return $rb_divide($$($nesting, 'Math').$checked("log", $$($nesting, 'Math')['$float!'](x)), $$($nesting, 'Math').$checked("log", $$($nesting, 'Math')['$float!'](base))); + }; + }, TMP_Math_log_22.$$arity = -2); + if ($truthy((typeof(Math.log10) !== "undefined"))) { + } else { + + Math.log10 = function(x) { + return Math.log(x) / Math.LN10; + } + + }; + + Opal.def(self, '$log10', TMP_Math_log10_23 = function $$log10(x) { + var self = this; + + + if ($truthy($$($nesting, 'String')['$==='](x))) { + self.$raise($$($nesting, 'Opal').$type_error(x, $$($nesting, 'Float')))}; + return $$($nesting, 'Math').$checked("log10", $$($nesting, 'Math')['$float!'](x)); + }, TMP_Math_log10_23.$$arity = 1); + if ($truthy((typeof(Math.log2) !== "undefined"))) { + } else { + + Math.log2 = function(x) { + return Math.log(x) / Math.LN2; + } + + }; + + Opal.def(self, '$log2', TMP_Math_log2_24 = function $$log2(x) { + var self = this; + + + if ($truthy($$($nesting, 'String')['$==='](x))) { + self.$raise($$($nesting, 'Opal').$type_error(x, $$($nesting, 'Float')))}; + return $$($nesting, 'Math').$checked("log2", $$($nesting, 'Math')['$float!'](x)); + }, TMP_Math_log2_24.$$arity = 1); + + Opal.def(self, '$sin', TMP_Math_sin_25 = function $$sin(x) { + var self = this; + + return $$($nesting, 'Math').$checked("sin", $$($nesting, 'Math')['$float!'](x)) + }, TMP_Math_sin_25.$$arity = 1); + if ($truthy((typeof(Math.sinh) !== "undefined"))) { + } else { + + Math.sinh = function(x) { + return (Math.exp(x) - Math.exp(-x)) / 2; + } + + }; + + Opal.def(self, '$sinh', TMP_Math_sinh_26 = function $$sinh(x) { + var self = this; + + return $$($nesting, 'Math').$checked("sinh", $$($nesting, 'Math')['$float!'](x)) + }, TMP_Math_sinh_26.$$arity = 1); + + Opal.def(self, '$sqrt', TMP_Math_sqrt_27 = function $$sqrt(x) { + var self = this; + + return $$($nesting, 'Math').$checked("sqrt", $$($nesting, 'Math')['$float!'](x)) + }, TMP_Math_sqrt_27.$$arity = 1); + + Opal.def(self, '$tan', TMP_Math_tan_28 = function $$tan(x) { + var self = this; + + + x = $$($nesting, 'Math')['$float!'](x); + if ($truthy(x['$infinite?']())) { + return $$$($$($nesting, 'Float'), 'NAN')}; + return $$($nesting, 'Math').$checked("tan", $$($nesting, 'Math')['$float!'](x)); + }, TMP_Math_tan_28.$$arity = 1); + if ($truthy((typeof(Math.tanh) !== "undefined"))) { + } else { + + Math.tanh = function(x) { + if (x == Infinity) { + return 1; + } + else if (x == -Infinity) { + return -1; + } + else { + return (Math.exp(x) - Math.exp(-x)) / (Math.exp(x) + Math.exp(-x)); + } + } + + }; + + Opal.def(self, '$tanh', TMP_Math_tanh_29 = function $$tanh(x) { + var self = this; + + return $$($nesting, 'Math').$checked("tanh", $$($nesting, 'Math')['$float!'](x)) + }, TMP_Math_tanh_29.$$arity = 1); + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/complex"] = function(Opal) { + function $rb_times(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs * rhs : lhs['$*'](rhs); + } + function $rb_plus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); + } + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + function $rb_divide(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs / rhs : lhs['$/'](rhs); + } + function $rb_gt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $truthy = Opal.truthy, $module = Opal.module; + + Opal.add_stubs(['$require', '$===', '$real?', '$raise', '$new', '$*', '$cos', '$sin', '$attr_reader', '$class', '$==', '$real', '$imag', '$Complex', '$-@', '$+', '$__coerced__', '$-', '$nan?', '$/', '$conj', '$abs2', '$quo', '$polar', '$exp', '$log', '$>', '$!=', '$divmod', '$**', '$hypot', '$atan2', '$lcm', '$denominator', '$finite?', '$infinite?', '$numerator', '$abs', '$arg', '$rationalize', '$to_f', '$to_i', '$to_r', '$inspect', '$positive?', '$zero?', '$Rational']); + + self.$require("corelib/numeric"); + (function($base, $super, $parent_nesting) { + function $Complex(){}; + var self = $Complex = $klass($base, $super, 'Complex', $Complex); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Complex_rect_1, TMP_Complex_polar_2, TMP_Complex_initialize_3, TMP_Complex_coerce_4, TMP_Complex_$eq$eq_5, TMP_Complex_$$_6, TMP_Complex_$_7, TMP_Complex_$_8, TMP_Complex_$_9, TMP_Complex_$_10, TMP_Complex_$$_11, TMP_Complex_abs_12, TMP_Complex_abs2_13, TMP_Complex_angle_14, TMP_Complex_conj_15, TMP_Complex_denominator_16, TMP_Complex_eql$q_17, TMP_Complex_fdiv_18, TMP_Complex_finite$q_19, TMP_Complex_hash_20, TMP_Complex_infinite$q_21, TMP_Complex_inspect_22, TMP_Complex_numerator_23, TMP_Complex_polar_24, TMP_Complex_rationalize_25, TMP_Complex_real$q_26, TMP_Complex_rect_27, TMP_Complex_to_f_28, TMP_Complex_to_i_29, TMP_Complex_to_r_30, TMP_Complex_to_s_31; + + def.real = def.imag = nil; + + Opal.defs(self, '$rect', TMP_Complex_rect_1 = function $$rect(real, imag) { + var $a, $b, $c, self = this; + + + + if (imag == null) { + imag = 0; + }; + if ($truthy(($truthy($a = ($truthy($b = ($truthy($c = $$($nesting, 'Numeric')['$==='](real)) ? real['$real?']() : $c)) ? $$($nesting, 'Numeric')['$==='](imag) : $b)) ? imag['$real?']() : $a))) { + } else { + self.$raise($$($nesting, 'TypeError'), "not a real") + }; + return self.$new(real, imag); + }, TMP_Complex_rect_1.$$arity = -2); + (function(self, $parent_nesting) { + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return Opal.alias(self, "rectangular", "rect") + })(Opal.get_singleton_class(self), $nesting); + Opal.defs(self, '$polar', TMP_Complex_polar_2 = function $$polar(r, theta) { + var $a, $b, $c, self = this; + + + + if (theta == null) { + theta = 0; + }; + if ($truthy(($truthy($a = ($truthy($b = ($truthy($c = $$($nesting, 'Numeric')['$==='](r)) ? r['$real?']() : $c)) ? $$($nesting, 'Numeric')['$==='](theta) : $b)) ? theta['$real?']() : $a))) { + } else { + self.$raise($$($nesting, 'TypeError'), "not a real") + }; + return self.$new($rb_times(r, $$($nesting, 'Math').$cos(theta)), $rb_times(r, $$($nesting, 'Math').$sin(theta))); + }, TMP_Complex_polar_2.$$arity = -2); + self.$attr_reader("real", "imag"); + + Opal.def(self, '$initialize', TMP_Complex_initialize_3 = function $$initialize(real, imag) { + var self = this; + + + + if (imag == null) { + imag = 0; + }; + self.real = real; + return (self.imag = imag); + }, TMP_Complex_initialize_3.$$arity = -2); + + Opal.def(self, '$coerce', TMP_Complex_coerce_4 = function $$coerce(other) { + var $a, self = this; + + if ($truthy($$($nesting, 'Complex')['$==='](other))) { + return [other, self] + } else if ($truthy(($truthy($a = $$($nesting, 'Numeric')['$==='](other)) ? other['$real?']() : $a))) { + return [$$($nesting, 'Complex').$new(other, 0), self] + } else { + return self.$raise($$($nesting, 'TypeError'), "" + (other.$class()) + " can't be coerced into Complex") + } + }, TMP_Complex_coerce_4.$$arity = 1); + + Opal.def(self, '$==', TMP_Complex_$eq$eq_5 = function(other) { + var $a, self = this; + + if ($truthy($$($nesting, 'Complex')['$==='](other))) { + return (($a = self.real['$=='](other.$real())) ? self.imag['$=='](other.$imag()) : self.real['$=='](other.$real())) + } else if ($truthy(($truthy($a = $$($nesting, 'Numeric')['$==='](other)) ? other['$real?']() : $a))) { + return (($a = self.real['$=='](other)) ? self.imag['$=='](0) : self.real['$=='](other)) + } else { + return other['$=='](self) + } + }, TMP_Complex_$eq$eq_5.$$arity = 1); + + Opal.def(self, '$-@', TMP_Complex_$$_6 = function() { + var self = this; + + return self.$Complex(self.real['$-@'](), self.imag['$-@']()) + }, TMP_Complex_$$_6.$$arity = 0); + + Opal.def(self, '$+', TMP_Complex_$_7 = function(other) { + var $a, self = this; + + if ($truthy($$($nesting, 'Complex')['$==='](other))) { + return self.$Complex($rb_plus(self.real, other.$real()), $rb_plus(self.imag, other.$imag())) + } else if ($truthy(($truthy($a = $$($nesting, 'Numeric')['$==='](other)) ? other['$real?']() : $a))) { + return self.$Complex($rb_plus(self.real, other), self.imag) + } else { + return self.$__coerced__("+", other) + } + }, TMP_Complex_$_7.$$arity = 1); + + Opal.def(self, '$-', TMP_Complex_$_8 = function(other) { + var $a, self = this; + + if ($truthy($$($nesting, 'Complex')['$==='](other))) { + return self.$Complex($rb_minus(self.real, other.$real()), $rb_minus(self.imag, other.$imag())) + } else if ($truthy(($truthy($a = $$($nesting, 'Numeric')['$==='](other)) ? other['$real?']() : $a))) { + return self.$Complex($rb_minus(self.real, other), self.imag) + } else { + return self.$__coerced__("-", other) + } + }, TMP_Complex_$_8.$$arity = 1); + + Opal.def(self, '$*', TMP_Complex_$_9 = function(other) { + var $a, self = this; + + if ($truthy($$($nesting, 'Complex')['$==='](other))) { + return self.$Complex($rb_minus($rb_times(self.real, other.$real()), $rb_times(self.imag, other.$imag())), $rb_plus($rb_times(self.real, other.$imag()), $rb_times(self.imag, other.$real()))) + } else if ($truthy(($truthy($a = $$($nesting, 'Numeric')['$==='](other)) ? other['$real?']() : $a))) { + return self.$Complex($rb_times(self.real, other), $rb_times(self.imag, other)) + } else { + return self.$__coerced__("*", other) + } + }, TMP_Complex_$_9.$$arity = 1); + + Opal.def(self, '$/', TMP_Complex_$_10 = function(other) { + var $a, $b, $c, $d, self = this; + + if ($truthy($$($nesting, 'Complex')['$==='](other))) { + if ($truthy(($truthy($a = ($truthy($b = ($truthy($c = ($truthy($d = $$($nesting, 'Number')['$==='](self.real)) ? self.real['$nan?']() : $d)) ? $c : ($truthy($d = $$($nesting, 'Number')['$==='](self.imag)) ? self.imag['$nan?']() : $d))) ? $b : ($truthy($c = $$($nesting, 'Number')['$==='](other.$real())) ? other.$real()['$nan?']() : $c))) ? $a : ($truthy($b = $$($nesting, 'Number')['$==='](other.$imag())) ? other.$imag()['$nan?']() : $b)))) { + return $$($nesting, 'Complex').$new($$$($$($nesting, 'Float'), 'NAN'), $$$($$($nesting, 'Float'), 'NAN')) + } else { + return $rb_divide($rb_times(self, other.$conj()), other.$abs2()) + } + } else if ($truthy(($truthy($a = $$($nesting, 'Numeric')['$==='](other)) ? other['$real?']() : $a))) { + return self.$Complex(self.real.$quo(other), self.imag.$quo(other)) + } else { + return self.$__coerced__("/", other) + } + }, TMP_Complex_$_10.$$arity = 1); + + Opal.def(self, '$**', TMP_Complex_$$_11 = function(other) { + var $a, $b, $c, $d, self = this, r = nil, theta = nil, ore = nil, oim = nil, nr = nil, ntheta = nil, x = nil, z = nil, n = nil, div = nil, mod = nil; + + + if (other['$=='](0)) { + return $$($nesting, 'Complex').$new(1, 0)}; + if ($truthy($$($nesting, 'Complex')['$==='](other))) { + + $b = self.$polar(), $a = Opal.to_ary($b), (r = ($a[0] == null ? nil : $a[0])), (theta = ($a[1] == null ? nil : $a[1])), $b; + ore = other.$real(); + oim = other.$imag(); + nr = $$($nesting, 'Math').$exp($rb_minus($rb_times(ore, $$($nesting, 'Math').$log(r)), $rb_times(oim, theta))); + ntheta = $rb_plus($rb_times(theta, ore), $rb_times(oim, $$($nesting, 'Math').$log(r))); + return $$($nesting, 'Complex').$polar(nr, ntheta); + } else if ($truthy($$($nesting, 'Integer')['$==='](other))) { + if ($truthy($rb_gt(other, 0))) { + + x = self; + z = x; + n = $rb_minus(other, 1); + while ($truthy(n['$!='](0))) { + + $c = n.$divmod(2), $b = Opal.to_ary($c), (div = ($b[0] == null ? nil : $b[0])), (mod = ($b[1] == null ? nil : $b[1])), $c; + while (mod['$=='](0)) { + + x = self.$Complex($rb_minus($rb_times(x.$real(), x.$real()), $rb_times(x.$imag(), x.$imag())), $rb_times($rb_times(2, x.$real()), x.$imag())); + n = div; + $d = n.$divmod(2), $c = Opal.to_ary($d), (div = ($c[0] == null ? nil : $c[0])), (mod = ($c[1] == null ? nil : $c[1])), $d; + }; + z = $rb_times(z, x); + n = $rb_minus(n, 1); + }; + return z; + } else { + return $rb_divide($$($nesting, 'Rational').$new(1, 1), self)['$**'](other['$-@']()) + } + } else if ($truthy(($truthy($a = $$($nesting, 'Float')['$==='](other)) ? $a : $$($nesting, 'Rational')['$==='](other)))) { + + $b = self.$polar(), $a = Opal.to_ary($b), (r = ($a[0] == null ? nil : $a[0])), (theta = ($a[1] == null ? nil : $a[1])), $b; + return $$($nesting, 'Complex').$polar(r['$**'](other), $rb_times(theta, other)); + } else { + return self.$__coerced__("**", other) + }; + }, TMP_Complex_$$_11.$$arity = 1); + + Opal.def(self, '$abs', TMP_Complex_abs_12 = function $$abs() { + var self = this; + + return $$($nesting, 'Math').$hypot(self.real, self.imag) + }, TMP_Complex_abs_12.$$arity = 0); + + Opal.def(self, '$abs2', TMP_Complex_abs2_13 = function $$abs2() { + var self = this; + + return $rb_plus($rb_times(self.real, self.real), $rb_times(self.imag, self.imag)) + }, TMP_Complex_abs2_13.$$arity = 0); + + Opal.def(self, '$angle', TMP_Complex_angle_14 = function $$angle() { + var self = this; + + return $$($nesting, 'Math').$atan2(self.imag, self.real) + }, TMP_Complex_angle_14.$$arity = 0); + Opal.alias(self, "arg", "angle"); + + Opal.def(self, '$conj', TMP_Complex_conj_15 = function $$conj() { + var self = this; + + return self.$Complex(self.real, self.imag['$-@']()) + }, TMP_Complex_conj_15.$$arity = 0); + Opal.alias(self, "conjugate", "conj"); + + Opal.def(self, '$denominator', TMP_Complex_denominator_16 = function $$denominator() { + var self = this; + + return self.real.$denominator().$lcm(self.imag.$denominator()) + }, TMP_Complex_denominator_16.$$arity = 0); + Opal.alias(self, "divide", "/"); + + Opal.def(self, '$eql?', TMP_Complex_eql$q_17 = function(other) { + var $a, $b, self = this; + + return ($truthy($a = ($truthy($b = $$($nesting, 'Complex')['$==='](other)) ? self.real.$class()['$=='](self.imag.$class()) : $b)) ? self['$=='](other) : $a) + }, TMP_Complex_eql$q_17.$$arity = 1); + + Opal.def(self, '$fdiv', TMP_Complex_fdiv_18 = function $$fdiv(other) { + var self = this; + + + if ($truthy($$($nesting, 'Numeric')['$==='](other))) { + } else { + self.$raise($$($nesting, 'TypeError'), "" + (other.$class()) + " can't be coerced into Complex") + }; + return $rb_divide(self, other); + }, TMP_Complex_fdiv_18.$$arity = 1); + + Opal.def(self, '$finite?', TMP_Complex_finite$q_19 = function() { + var $a, self = this; + + return ($truthy($a = self.real['$finite?']()) ? self.imag['$finite?']() : $a) + }, TMP_Complex_finite$q_19.$$arity = 0); + + Opal.def(self, '$hash', TMP_Complex_hash_20 = function $$hash() { + var self = this; + + return "" + "Complex:" + (self.real) + ":" + (self.imag) + }, TMP_Complex_hash_20.$$arity = 0); + Opal.alias(self, "imaginary", "imag"); + + Opal.def(self, '$infinite?', TMP_Complex_infinite$q_21 = function() { + var $a, self = this; + + return ($truthy($a = self.real['$infinite?']()) ? $a : self.imag['$infinite?']()) + }, TMP_Complex_infinite$q_21.$$arity = 0); + + Opal.def(self, '$inspect', TMP_Complex_inspect_22 = function $$inspect() { + var self = this; + + return "" + "(" + (self) + ")" + }, TMP_Complex_inspect_22.$$arity = 0); + Opal.alias(self, "magnitude", "abs"); + + Opal.udef(self, '$' + "negative?");; + + Opal.def(self, '$numerator', TMP_Complex_numerator_23 = function $$numerator() { + var self = this, d = nil; + + + d = self.$denominator(); + return self.$Complex($rb_times(self.real.$numerator(), $rb_divide(d, self.real.$denominator())), $rb_times(self.imag.$numerator(), $rb_divide(d, self.imag.$denominator()))); + }, TMP_Complex_numerator_23.$$arity = 0); + Opal.alias(self, "phase", "arg"); + + Opal.def(self, '$polar', TMP_Complex_polar_24 = function $$polar() { + var self = this; + + return [self.$abs(), self.$arg()] + }, TMP_Complex_polar_24.$$arity = 0); + + Opal.udef(self, '$' + "positive?");; + Opal.alias(self, "quo", "/"); + + Opal.def(self, '$rationalize', TMP_Complex_rationalize_25 = function $$rationalize(eps) { + var self = this; + + + ; + + if (arguments.length > 1) { + self.$raise($$($nesting, 'ArgumentError'), "" + "wrong number of arguments (" + (arguments.length) + " for 0..1)"); + } + ; + if ($truthy(self.imag['$!='](0))) { + self.$raise($$($nesting, 'RangeError'), "" + "can't' convert " + (self) + " into Rational")}; + return self.$real().$rationalize(eps); + }, TMP_Complex_rationalize_25.$$arity = -1); + + Opal.def(self, '$real?', TMP_Complex_real$q_26 = function() { + var self = this; + + return false + }, TMP_Complex_real$q_26.$$arity = 0); + + Opal.def(self, '$rect', TMP_Complex_rect_27 = function $$rect() { + var self = this; + + return [self.real, self.imag] + }, TMP_Complex_rect_27.$$arity = 0); + Opal.alias(self, "rectangular", "rect"); + + Opal.def(self, '$to_f', TMP_Complex_to_f_28 = function $$to_f() { + var self = this; + + + if (self.imag['$=='](0)) { + } else { + self.$raise($$($nesting, 'RangeError'), "" + "can't convert " + (self) + " into Float") + }; + return self.real.$to_f(); + }, TMP_Complex_to_f_28.$$arity = 0); + + Opal.def(self, '$to_i', TMP_Complex_to_i_29 = function $$to_i() { + var self = this; + + + if (self.imag['$=='](0)) { + } else { + self.$raise($$($nesting, 'RangeError'), "" + "can't convert " + (self) + " into Integer") + }; + return self.real.$to_i(); + }, TMP_Complex_to_i_29.$$arity = 0); + + Opal.def(self, '$to_r', TMP_Complex_to_r_30 = function $$to_r() { + var self = this; + + + if (self.imag['$=='](0)) { + } else { + self.$raise($$($nesting, 'RangeError'), "" + "can't convert " + (self) + " into Rational") + }; + return self.real.$to_r(); + }, TMP_Complex_to_r_30.$$arity = 0); + + Opal.def(self, '$to_s', TMP_Complex_to_s_31 = function $$to_s() { + var $a, $b, $c, self = this, result = nil; + + + result = self.real.$inspect(); + result = $rb_plus(result, (function() {if ($truthy(($truthy($a = ($truthy($b = ($truthy($c = $$($nesting, 'Number')['$==='](self.imag)) ? self.imag['$nan?']() : $c)) ? $b : self.imag['$positive?']())) ? $a : self.imag['$zero?']()))) { + return "+" + } else { + return "-" + }; return nil; })()); + result = $rb_plus(result, self.imag.$abs().$inspect()); + if ($truthy(($truthy($a = $$($nesting, 'Number')['$==='](self.imag)) ? ($truthy($b = self.imag['$nan?']()) ? $b : self.imag['$infinite?']()) : $a))) { + result = $rb_plus(result, "*")}; + return $rb_plus(result, "i"); + }, TMP_Complex_to_s_31.$$arity = 0); + return Opal.const_set($nesting[0], 'I', self.$new(0, 1)); + })($nesting[0], $$($nesting, 'Numeric'), $nesting); + (function($base, $parent_nesting) { + function $Kernel() {}; + var self = $Kernel = $module($base, 'Kernel', $Kernel); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Kernel_Complex_32; + + + Opal.def(self, '$Complex', TMP_Kernel_Complex_32 = function $$Complex(real, imag) { + var self = this; + + + + if (imag == null) { + imag = nil; + }; + if ($truthy(imag)) { + return $$($nesting, 'Complex').$new(real, imag) + } else { + return $$($nesting, 'Complex').$new(real, 0) + }; + }, TMP_Kernel_Complex_32.$$arity = -2) + })($nesting[0], $nesting); + return (function($base, $super, $parent_nesting) { + function $String(){}; + var self = $String = $klass($base, $super, 'String', $String); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_String_to_c_33; + + return (Opal.def(self, '$to_c', TMP_String_to_c_33 = function $$to_c() { + var self = this; + + + var str = self, + re = /[+-]?[\d_]+(\.[\d_]+)?(e\d+)?/, + match = str.match(re), + real, imag, denominator; + + function isFloat() { + return re.test(str); + } + + function cutFloat() { + var match = str.match(re); + var number = match[0]; + str = str.slice(number.length); + return number.replace(/_/g, ''); + } + + // handles both floats and rationals + function cutNumber() { + if (isFloat()) { + var numerator = parseFloat(cutFloat()); + + if (str[0] === '/') { + // rational real part + str = str.slice(1); + + if (isFloat()) { + var denominator = parseFloat(cutFloat()); + return self.$Rational(numerator, denominator); + } else { + // reverting '/' + str = '/' + str; + return numerator; + } + } else { + // float real part, no denominator + return numerator; + } + } else { + return null; + } + } + + real = cutNumber(); + + if (!real) { + if (str[0] === 'i') { + // i => Complex(0, 1) + return self.$Complex(0, 1); + } + if (str[0] === '-' && str[1] === 'i') { + // -i => Complex(0, -1) + return self.$Complex(0, -1); + } + if (str[0] === '+' && str[1] === 'i') { + // +i => Complex(0, 1) + return self.$Complex(0, 1); + } + // anything => Complex(0, 0) + return self.$Complex(0, 0); + } + + imag = cutNumber(); + if (!imag) { + if (str[0] === 'i') { + // 3i => Complex(0, 3) + return self.$Complex(0, real); + } else { + // 3 => Complex(3, 0) + return self.$Complex(real, 0); + } + } else { + // 3+2i => Complex(3, 2) + return self.$Complex(real, imag); + } + + }, TMP_String_to_c_33.$$arity = 0), nil) && 'to_c' + })($nesting[0], null, $nesting); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/rational"] = function(Opal) { + function $rb_lt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); + } + function $rb_divide(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs / rhs : lhs['$/'](rhs); + } + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + function $rb_times(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs * rhs : lhs['$*'](rhs); + } + function $rb_plus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); + } + function $rb_gt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); + } + function $rb_le(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs <= rhs : lhs['$<='](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $truthy = Opal.truthy, $module = Opal.module; + + Opal.add_stubs(['$require', '$to_i', '$==', '$raise', '$<', '$-@', '$new', '$gcd', '$/', '$nil?', '$===', '$reduce', '$to_r', '$equal?', '$!', '$coerce_to!', '$to_f', '$numerator', '$denominator', '$<=>', '$-', '$*', '$__coerced__', '$+', '$Rational', '$>', '$**', '$abs', '$ceil', '$with_precision', '$floor', '$<=', '$truncate', '$send', '$convert']); + + self.$require("corelib/numeric"); + (function($base, $super, $parent_nesting) { + function $Rational(){}; + var self = $Rational = $klass($base, $super, 'Rational', $Rational); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Rational_reduce_1, TMP_Rational_convert_2, TMP_Rational_initialize_3, TMP_Rational_numerator_4, TMP_Rational_denominator_5, TMP_Rational_coerce_6, TMP_Rational_$eq$eq_7, TMP_Rational_$lt$eq$gt_8, TMP_Rational_$_9, TMP_Rational_$_10, TMP_Rational_$_11, TMP_Rational_$_12, TMP_Rational_$$_13, TMP_Rational_abs_14, TMP_Rational_ceil_15, TMP_Rational_floor_16, TMP_Rational_hash_17, TMP_Rational_inspect_18, TMP_Rational_rationalize_19, TMP_Rational_round_20, TMP_Rational_to_f_21, TMP_Rational_to_i_22, TMP_Rational_to_r_23, TMP_Rational_to_s_24, TMP_Rational_truncate_25, TMP_Rational_with_precision_26; + + def.num = def.den = nil; + + Opal.defs(self, '$reduce', TMP_Rational_reduce_1 = function $$reduce(num, den) { + var self = this, gcd = nil; + + + num = num.$to_i(); + den = den.$to_i(); + if (den['$=='](0)) { + self.$raise($$($nesting, 'ZeroDivisionError'), "divided by 0") + } else if ($truthy($rb_lt(den, 0))) { + + num = num['$-@'](); + den = den['$-@'](); + } else if (den['$=='](1)) { + return self.$new(num, den)}; + gcd = num.$gcd(den); + return self.$new($rb_divide(num, gcd), $rb_divide(den, gcd)); + }, TMP_Rational_reduce_1.$$arity = 2); + Opal.defs(self, '$convert', TMP_Rational_convert_2 = function $$convert(num, den) { + var $a, $b, self = this; + + + if ($truthy(($truthy($a = num['$nil?']()) ? $a : den['$nil?']()))) { + self.$raise($$($nesting, 'TypeError'), "cannot convert nil into Rational")}; + if ($truthy(($truthy($a = $$($nesting, 'Integer')['$==='](num)) ? $$($nesting, 'Integer')['$==='](den) : $a))) { + return self.$reduce(num, den)}; + if ($truthy(($truthy($a = ($truthy($b = $$($nesting, 'Float')['$==='](num)) ? $b : $$($nesting, 'String')['$==='](num))) ? $a : $$($nesting, 'Complex')['$==='](num)))) { + num = num.$to_r()}; + if ($truthy(($truthy($a = ($truthy($b = $$($nesting, 'Float')['$==='](den)) ? $b : $$($nesting, 'String')['$==='](den))) ? $a : $$($nesting, 'Complex')['$==='](den)))) { + den = den.$to_r()}; + if ($truthy(($truthy($a = den['$equal?'](1)) ? $$($nesting, 'Integer')['$==='](num)['$!']() : $a))) { + return $$($nesting, 'Opal')['$coerce_to!'](num, $$($nesting, 'Rational'), "to_r") + } else if ($truthy(($truthy($a = $$($nesting, 'Numeric')['$==='](num)) ? $$($nesting, 'Numeric')['$==='](den) : $a))) { + return $rb_divide(num, den) + } else { + return self.$reduce(num, den) + }; + }, TMP_Rational_convert_2.$$arity = 2); + + Opal.def(self, '$initialize', TMP_Rational_initialize_3 = function $$initialize(num, den) { + var self = this; + + + self.num = num; + return (self.den = den); + }, TMP_Rational_initialize_3.$$arity = 2); + + Opal.def(self, '$numerator', TMP_Rational_numerator_4 = function $$numerator() { + var self = this; + + return self.num + }, TMP_Rational_numerator_4.$$arity = 0); + + Opal.def(self, '$denominator', TMP_Rational_denominator_5 = function $$denominator() { + var self = this; + + return self.den + }, TMP_Rational_denominator_5.$$arity = 0); + + Opal.def(self, '$coerce', TMP_Rational_coerce_6 = function $$coerce(other) { + var self = this, $case = nil; + + return (function() {$case = other; + if ($$($nesting, 'Rational')['$===']($case)) {return [other, self]} + else if ($$($nesting, 'Integer')['$===']($case)) {return [other.$to_r(), self]} + else if ($$($nesting, 'Float')['$===']($case)) {return [other, self.$to_f()]} + else { return nil }})() + }, TMP_Rational_coerce_6.$$arity = 1); + + Opal.def(self, '$==', TMP_Rational_$eq$eq_7 = function(other) { + var $a, self = this, $case = nil; + + return (function() {$case = other; + if ($$($nesting, 'Rational')['$===']($case)) {return (($a = self.num['$=='](other.$numerator())) ? self.den['$=='](other.$denominator()) : self.num['$=='](other.$numerator()))} + else if ($$($nesting, 'Integer')['$===']($case)) {return (($a = self.num['$=='](other)) ? self.den['$=='](1) : self.num['$=='](other))} + else if ($$($nesting, 'Float')['$===']($case)) {return self.$to_f()['$=='](other)} + else {return other['$=='](self)}})() + }, TMP_Rational_$eq$eq_7.$$arity = 1); + + Opal.def(self, '$<=>', TMP_Rational_$lt$eq$gt_8 = function(other) { + var self = this, $case = nil; + + return (function() {$case = other; + if ($$($nesting, 'Rational')['$===']($case)) {return $rb_minus($rb_times(self.num, other.$denominator()), $rb_times(self.den, other.$numerator()))['$<=>'](0)} + else if ($$($nesting, 'Integer')['$===']($case)) {return $rb_minus(self.num, $rb_times(self.den, other))['$<=>'](0)} + else if ($$($nesting, 'Float')['$===']($case)) {return self.$to_f()['$<=>'](other)} + else {return self.$__coerced__("<=>", other)}})() + }, TMP_Rational_$lt$eq$gt_8.$$arity = 1); + + Opal.def(self, '$+', TMP_Rational_$_9 = function(other) { + var self = this, $case = nil, num = nil, den = nil; + + return (function() {$case = other; + if ($$($nesting, 'Rational')['$===']($case)) { + num = $rb_plus($rb_times(self.num, other.$denominator()), $rb_times(self.den, other.$numerator())); + den = $rb_times(self.den, other.$denominator()); + return self.$Rational(num, den);} + else if ($$($nesting, 'Integer')['$===']($case)) {return self.$Rational($rb_plus(self.num, $rb_times(other, self.den)), self.den)} + else if ($$($nesting, 'Float')['$===']($case)) {return $rb_plus(self.$to_f(), other)} + else {return self.$__coerced__("+", other)}})() + }, TMP_Rational_$_9.$$arity = 1); + + Opal.def(self, '$-', TMP_Rational_$_10 = function(other) { + var self = this, $case = nil, num = nil, den = nil; + + return (function() {$case = other; + if ($$($nesting, 'Rational')['$===']($case)) { + num = $rb_minus($rb_times(self.num, other.$denominator()), $rb_times(self.den, other.$numerator())); + den = $rb_times(self.den, other.$denominator()); + return self.$Rational(num, den);} + else if ($$($nesting, 'Integer')['$===']($case)) {return self.$Rational($rb_minus(self.num, $rb_times(other, self.den)), self.den)} + else if ($$($nesting, 'Float')['$===']($case)) {return $rb_minus(self.$to_f(), other)} + else {return self.$__coerced__("-", other)}})() + }, TMP_Rational_$_10.$$arity = 1); + + Opal.def(self, '$*', TMP_Rational_$_11 = function(other) { + var self = this, $case = nil, num = nil, den = nil; + + return (function() {$case = other; + if ($$($nesting, 'Rational')['$===']($case)) { + num = $rb_times(self.num, other.$numerator()); + den = $rb_times(self.den, other.$denominator()); + return self.$Rational(num, den);} + else if ($$($nesting, 'Integer')['$===']($case)) {return self.$Rational($rb_times(self.num, other), self.den)} + else if ($$($nesting, 'Float')['$===']($case)) {return $rb_times(self.$to_f(), other)} + else {return self.$__coerced__("*", other)}})() + }, TMP_Rational_$_11.$$arity = 1); + + Opal.def(self, '$/', TMP_Rational_$_12 = function(other) { + var self = this, $case = nil, num = nil, den = nil; + + return (function() {$case = other; + if ($$($nesting, 'Rational')['$===']($case)) { + num = $rb_times(self.num, other.$denominator()); + den = $rb_times(self.den, other.$numerator()); + return self.$Rational(num, den);} + else if ($$($nesting, 'Integer')['$===']($case)) {if (other['$=='](0)) { + return $rb_divide(self.$to_f(), 0.0) + } else { + return self.$Rational(self.num, $rb_times(self.den, other)) + }} + else if ($$($nesting, 'Float')['$===']($case)) {return $rb_divide(self.$to_f(), other)} + else {return self.$__coerced__("/", other)}})() + }, TMP_Rational_$_12.$$arity = 1); + + Opal.def(self, '$**', TMP_Rational_$$_13 = function(other) { + var $a, self = this, $case = nil; + + return (function() {$case = other; + if ($$($nesting, 'Integer')['$===']($case)) {if ($truthy((($a = self['$=='](0)) ? $rb_lt(other, 0) : self['$=='](0)))) { + return $$$($$($nesting, 'Float'), 'INFINITY') + } else if ($truthy($rb_gt(other, 0))) { + return self.$Rational(self.num['$**'](other), self.den['$**'](other)) + } else if ($truthy($rb_lt(other, 0))) { + return self.$Rational(self.den['$**'](other['$-@']()), self.num['$**'](other['$-@']())) + } else { + return self.$Rational(1, 1) + }} + else if ($$($nesting, 'Float')['$===']($case)) {return self.$to_f()['$**'](other)} + else if ($$($nesting, 'Rational')['$===']($case)) {if (other['$=='](0)) { + return self.$Rational(1, 1) + } else if (other.$denominator()['$=='](1)) { + if ($truthy($rb_lt(other, 0))) { + return self.$Rational(self.den['$**'](other.$numerator().$abs()), self.num['$**'](other.$numerator().$abs())) + } else { + return self.$Rational(self.num['$**'](other.$numerator()), self.den['$**'](other.$numerator())) + } + } else if ($truthy((($a = self['$=='](0)) ? $rb_lt(other, 0) : self['$=='](0)))) { + return self.$raise($$($nesting, 'ZeroDivisionError'), "divided by 0") + } else { + return self.$to_f()['$**'](other) + }} + else {return self.$__coerced__("**", other)}})() + }, TMP_Rational_$$_13.$$arity = 1); + + Opal.def(self, '$abs', TMP_Rational_abs_14 = function $$abs() { + var self = this; + + return self.$Rational(self.num.$abs(), self.den.$abs()) + }, TMP_Rational_abs_14.$$arity = 0); + + Opal.def(self, '$ceil', TMP_Rational_ceil_15 = function $$ceil(precision) { + var self = this; + + + + if (precision == null) { + precision = 0; + }; + if (precision['$=='](0)) { + return $rb_divide(self.num['$-@'](), self.den)['$-@']().$ceil() + } else { + return self.$with_precision("ceil", precision) + }; + }, TMP_Rational_ceil_15.$$arity = -1); + Opal.alias(self, "divide", "/"); + + Opal.def(self, '$floor', TMP_Rational_floor_16 = function $$floor(precision) { + var self = this; + + + + if (precision == null) { + precision = 0; + }; + if (precision['$=='](0)) { + return $rb_divide(self.num['$-@'](), self.den)['$-@']().$floor() + } else { + return self.$with_precision("floor", precision) + }; + }, TMP_Rational_floor_16.$$arity = -1); + + Opal.def(self, '$hash', TMP_Rational_hash_17 = function $$hash() { + var self = this; + + return "" + "Rational:" + (self.num) + ":" + (self.den) + }, TMP_Rational_hash_17.$$arity = 0); + + Opal.def(self, '$inspect', TMP_Rational_inspect_18 = function $$inspect() { + var self = this; + + return "" + "(" + (self) + ")" + }, TMP_Rational_inspect_18.$$arity = 0); + Opal.alias(self, "quo", "/"); + + Opal.def(self, '$rationalize', TMP_Rational_rationalize_19 = function $$rationalize(eps) { + var self = this; + + + ; + + if (arguments.length > 1) { + self.$raise($$($nesting, 'ArgumentError'), "" + "wrong number of arguments (" + (arguments.length) + " for 0..1)"); + } + + if (eps == null) { + return self; + } + + var e = eps.$abs(), + a = $rb_minus(self, e), + b = $rb_plus(self, e); + + var p0 = 0, + p1 = 1, + q0 = 1, + q1 = 0, + p2, q2; + + var c, k, t; + + while (true) { + c = (a).$ceil(); + + if ($rb_le(c, b)) { + break; + } + + k = c - 1; + p2 = k * p1 + p0; + q2 = k * q1 + q0; + t = $rb_divide(1, $rb_minus(b, k)); + b = $rb_divide(1, $rb_minus(a, k)); + a = t; + + p0 = p1; + q0 = q1; + p1 = p2; + q1 = q2; + } + + return self.$Rational(c * p1 + p0, c * q1 + q0); + ; + }, TMP_Rational_rationalize_19.$$arity = -1); + + Opal.def(self, '$round', TMP_Rational_round_20 = function $$round(precision) { + var self = this, num = nil, den = nil, approx = nil; + + + + if (precision == null) { + precision = 0; + }; + if (precision['$=='](0)) { + } else { + return self.$with_precision("round", precision) + }; + if (self.num['$=='](0)) { + return 0}; + if (self.den['$=='](1)) { + return self.num}; + num = $rb_plus($rb_times(self.num.$abs(), 2), self.den); + den = $rb_times(self.den, 2); + approx = $rb_divide(num, den).$truncate(); + if ($truthy($rb_lt(self.num, 0))) { + return approx['$-@']() + } else { + return approx + }; + }, TMP_Rational_round_20.$$arity = -1); + + Opal.def(self, '$to_f', TMP_Rational_to_f_21 = function $$to_f() { + var self = this; + + return $rb_divide(self.num, self.den) + }, TMP_Rational_to_f_21.$$arity = 0); + + Opal.def(self, '$to_i', TMP_Rational_to_i_22 = function $$to_i() { + var self = this; + + return self.$truncate() + }, TMP_Rational_to_i_22.$$arity = 0); + + Opal.def(self, '$to_r', TMP_Rational_to_r_23 = function $$to_r() { + var self = this; + + return self + }, TMP_Rational_to_r_23.$$arity = 0); + + Opal.def(self, '$to_s', TMP_Rational_to_s_24 = function $$to_s() { + var self = this; + + return "" + (self.num) + "/" + (self.den) + }, TMP_Rational_to_s_24.$$arity = 0); + + Opal.def(self, '$truncate', TMP_Rational_truncate_25 = function $$truncate(precision) { + var self = this; + + + + if (precision == null) { + precision = 0; + }; + if (precision['$=='](0)) { + if ($truthy($rb_lt(self.num, 0))) { + return self.$ceil() + } else { + return self.$floor() + } + } else { + return self.$with_precision("truncate", precision) + }; + }, TMP_Rational_truncate_25.$$arity = -1); + return (Opal.def(self, '$with_precision', TMP_Rational_with_precision_26 = function $$with_precision(method, precision) { + var self = this, p = nil, s = nil; + + + if ($truthy($$($nesting, 'Integer')['$==='](precision))) { + } else { + self.$raise($$($nesting, 'TypeError'), "not an Integer") + }; + p = (10)['$**'](precision); + s = $rb_times(self, p); + if ($truthy($rb_lt(precision, 1))) { + return $rb_divide(s.$send(method), p).$to_i() + } else { + return self.$Rational(s.$send(method), p) + }; + }, TMP_Rational_with_precision_26.$$arity = 2), nil) && 'with_precision'; + })($nesting[0], $$($nesting, 'Numeric'), $nesting); + (function($base, $parent_nesting) { + function $Kernel() {}; + var self = $Kernel = $module($base, 'Kernel', $Kernel); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Kernel_Rational_27; + + + Opal.def(self, '$Rational', TMP_Kernel_Rational_27 = function $$Rational(numerator, denominator) { + var self = this; + + + + if (denominator == null) { + denominator = 1; + }; + return $$($nesting, 'Rational').$convert(numerator, denominator); + }, TMP_Kernel_Rational_27.$$arity = -2) + })($nesting[0], $nesting); + return (function($base, $super, $parent_nesting) { + function $String(){}; + var self = $String = $klass($base, $super, 'String', $String); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_String_to_r_28; + + return (Opal.def(self, '$to_r', TMP_String_to_r_28 = function $$to_r() { + var self = this; + + + var str = self.trimLeft(), + re = /^[+-]?[\d_]+(\.[\d_]+)?/, + match = str.match(re), + numerator, denominator; + + function isFloat() { + return re.test(str); + } + + function cutFloat() { + var match = str.match(re); + var number = match[0]; + str = str.slice(number.length); + return number.replace(/_/g, ''); + } + + if (isFloat()) { + numerator = parseFloat(cutFloat()); + + if (str[0] === '/') { + // rational real part + str = str.slice(1); + + if (isFloat()) { + denominator = parseFloat(cutFloat()); + return self.$Rational(numerator, denominator); + } else { + return self.$Rational(numerator, 1); + } + } else { + return self.$Rational(numerator, 1); + } + } else { + return self.$Rational(0, 1); + } + + }, TMP_String_to_r_28.$$arity = 0), nil) && 'to_r' + })($nesting[0], null, $nesting); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/time"] = function(Opal) { + function $rb_gt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); + } + function $rb_lt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); + } + function $rb_plus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); + } + function $rb_divide(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs / rhs : lhs['$/'](rhs); + } + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + function $rb_le(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs <= rhs : lhs['$<='](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $truthy = Opal.truthy, $range = Opal.range; + + Opal.add_stubs(['$require', '$include', '$===', '$raise', '$coerce_to!', '$respond_to?', '$to_str', '$to_i', '$new', '$<=>', '$to_f', '$nil?', '$>', '$<', '$strftime', '$year', '$month', '$day', '$+', '$round', '$/', '$-', '$copy_instance_variables', '$initialize_dup', '$is_a?', '$zero?', '$wday', '$utc?', '$mon', '$yday', '$hour', '$min', '$sec', '$rjust', '$ljust', '$zone', '$to_s', '$[]', '$cweek_cyear', '$isdst', '$<=', '$!=', '$==', '$ceil']); + + self.$require("corelib/comparable"); + return (function($base, $super, $parent_nesting) { + function $Time(){}; + var self = $Time = $klass($base, $super, 'Time', $Time); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Time_at_1, TMP_Time_new_2, TMP_Time_local_3, TMP_Time_gm_4, TMP_Time_now_5, TMP_Time_$_6, TMP_Time_$_7, TMP_Time_$lt$eq$gt_8, TMP_Time_$eq$eq_9, TMP_Time_asctime_10, TMP_Time_day_11, TMP_Time_yday_12, TMP_Time_isdst_13, TMP_Time_dup_14, TMP_Time_eql$q_15, TMP_Time_friday$q_16, TMP_Time_hash_17, TMP_Time_hour_18, TMP_Time_inspect_19, TMP_Time_min_20, TMP_Time_mon_21, TMP_Time_monday$q_22, TMP_Time_saturday$q_23, TMP_Time_sec_24, TMP_Time_succ_25, TMP_Time_usec_26, TMP_Time_zone_27, TMP_Time_getgm_28, TMP_Time_gmtime_29, TMP_Time_gmt$q_30, TMP_Time_gmt_offset_31, TMP_Time_strftime_32, TMP_Time_sunday$q_33, TMP_Time_thursday$q_34, TMP_Time_to_a_35, TMP_Time_to_f_36, TMP_Time_to_i_37, TMP_Time_tuesday$q_38, TMP_Time_wday_39, TMP_Time_wednesday$q_40, TMP_Time_year_41, TMP_Time_cweek_cyear_42; + + + self.$include($$($nesting, 'Comparable')); + + var days_of_week = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"], + short_days = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], + short_months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], + long_months = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]; + ; + Opal.defs(self, '$at', TMP_Time_at_1 = function $$at(seconds, frac) { + var self = this; + + + ; + + var result; + + if ($$($nesting, 'Time')['$==='](seconds)) { + if (frac !== undefined) { + self.$raise($$($nesting, 'TypeError'), "can't convert Time into an exact number") + } + result = new Date(seconds.getTime()); + result.is_utc = seconds.is_utc; + return result; + } + + if (!seconds.$$is_number) { + seconds = $$($nesting, 'Opal')['$coerce_to!'](seconds, $$($nesting, 'Integer'), "to_int"); + } + + if (frac === undefined) { + return new Date(seconds * 1000); + } + + if (!frac.$$is_number) { + frac = $$($nesting, 'Opal')['$coerce_to!'](frac, $$($nesting, 'Integer'), "to_int"); + } + + return new Date(seconds * 1000 + (frac / 1000)); + ; + }, TMP_Time_at_1.$$arity = -2); + + function time_params(year, month, day, hour, min, sec) { + if (year.$$is_string) { + year = parseInt(year, 10); + } else { + year = $$($nesting, 'Opal')['$coerce_to!'](year, $$($nesting, 'Integer'), "to_int"); + } + + if (month === nil) { + month = 1; + } else if (!month.$$is_number) { + if ((month)['$respond_to?']("to_str")) { + month = (month).$to_str(); + switch (month.toLowerCase()) { + case 'jan': month = 1; break; + case 'feb': month = 2; break; + case 'mar': month = 3; break; + case 'apr': month = 4; break; + case 'may': month = 5; break; + case 'jun': month = 6; break; + case 'jul': month = 7; break; + case 'aug': month = 8; break; + case 'sep': month = 9; break; + case 'oct': month = 10; break; + case 'nov': month = 11; break; + case 'dec': month = 12; break; + default: month = (month).$to_i(); + } + } else { + month = $$($nesting, 'Opal')['$coerce_to!'](month, $$($nesting, 'Integer'), "to_int"); + } + } + + if (month < 1 || month > 12) { + self.$raise($$($nesting, 'ArgumentError'), "" + "month out of range: " + (month)) + } + month = month - 1; + + if (day === nil) { + day = 1; + } else if (day.$$is_string) { + day = parseInt(day, 10); + } else { + day = $$($nesting, 'Opal')['$coerce_to!'](day, $$($nesting, 'Integer'), "to_int"); + } + + if (day < 1 || day > 31) { + self.$raise($$($nesting, 'ArgumentError'), "" + "day out of range: " + (day)) + } + + if (hour === nil) { + hour = 0; + } else if (hour.$$is_string) { + hour = parseInt(hour, 10); + } else { + hour = $$($nesting, 'Opal')['$coerce_to!'](hour, $$($nesting, 'Integer'), "to_int"); + } + + if (hour < 0 || hour > 24) { + self.$raise($$($nesting, 'ArgumentError'), "" + "hour out of range: " + (hour)) + } + + if (min === nil) { + min = 0; + } else if (min.$$is_string) { + min = parseInt(min, 10); + } else { + min = $$($nesting, 'Opal')['$coerce_to!'](min, $$($nesting, 'Integer'), "to_int"); + } + + if (min < 0 || min > 59) { + self.$raise($$($nesting, 'ArgumentError'), "" + "min out of range: " + (min)) + } + + if (sec === nil) { + sec = 0; + } else if (!sec.$$is_number) { + if (sec.$$is_string) { + sec = parseInt(sec, 10); + } else { + sec = $$($nesting, 'Opal')['$coerce_to!'](sec, $$($nesting, 'Integer'), "to_int"); + } + } + + if (sec < 0 || sec > 60) { + self.$raise($$($nesting, 'ArgumentError'), "" + "sec out of range: " + (sec)) + } + + return [year, month, day, hour, min, sec]; + } + ; + Opal.defs(self, '$new', TMP_Time_new_2 = function(year, month, day, hour, min, sec, utc_offset) { + var self = this; + + + ; + + if (month == null) { + month = nil; + }; + + if (day == null) { + day = nil; + }; + + if (hour == null) { + hour = nil; + }; + + if (min == null) { + min = nil; + }; + + if (sec == null) { + sec = nil; + }; + + if (utc_offset == null) { + utc_offset = nil; + }; + + var args, result; + + if (year === undefined) { + return new Date(); + } + + if (utc_offset !== nil) { + self.$raise($$($nesting, 'ArgumentError'), "Opal does not support explicitly specifying UTC offset for Time") + } + + args = time_params(year, month, day, hour, min, sec); + year = args[0]; + month = args[1]; + day = args[2]; + hour = args[3]; + min = args[4]; + sec = args[5]; + + result = new Date(year, month, day, hour, min, 0, sec * 1000); + if (year < 100) { + result.setFullYear(year); + } + return result; + ; + }, TMP_Time_new_2.$$arity = -1); + Opal.defs(self, '$local', TMP_Time_local_3 = function $$local(year, month, day, hour, min, sec, millisecond, _dummy1, _dummy2, _dummy3) { + var self = this; + + + + if (month == null) { + month = nil; + }; + + if (day == null) { + day = nil; + }; + + if (hour == null) { + hour = nil; + }; + + if (min == null) { + min = nil; + }; + + if (sec == null) { + sec = nil; + }; + + if (millisecond == null) { + millisecond = nil; + }; + + if (_dummy1 == null) { + _dummy1 = nil; + }; + + if (_dummy2 == null) { + _dummy2 = nil; + }; + + if (_dummy3 == null) { + _dummy3 = nil; + }; + + var args, result; + + if (arguments.length === 10) { + args = $slice.call(arguments); + year = args[5]; + month = args[4]; + day = args[3]; + hour = args[2]; + min = args[1]; + sec = args[0]; + } + + args = time_params(year, month, day, hour, min, sec); + year = args[0]; + month = args[1]; + day = args[2]; + hour = args[3]; + min = args[4]; + sec = args[5]; + + result = new Date(year, month, day, hour, min, 0, sec * 1000); + if (year < 100) { + result.setFullYear(year); + } + return result; + ; + }, TMP_Time_local_3.$$arity = -2); + Opal.defs(self, '$gm', TMP_Time_gm_4 = function $$gm(year, month, day, hour, min, sec, millisecond, _dummy1, _dummy2, _dummy3) { + var self = this; + + + + if (month == null) { + month = nil; + }; + + if (day == null) { + day = nil; + }; + + if (hour == null) { + hour = nil; + }; + + if (min == null) { + min = nil; + }; + + if (sec == null) { + sec = nil; + }; + + if (millisecond == null) { + millisecond = nil; + }; + + if (_dummy1 == null) { + _dummy1 = nil; + }; + + if (_dummy2 == null) { + _dummy2 = nil; + }; + + if (_dummy3 == null) { + _dummy3 = nil; + }; + + var args, result; + + if (arguments.length === 10) { + args = $slice.call(arguments); + year = args[5]; + month = args[4]; + day = args[3]; + hour = args[2]; + min = args[1]; + sec = args[0]; + } + + args = time_params(year, month, day, hour, min, sec); + year = args[0]; + month = args[1]; + day = args[2]; + hour = args[3]; + min = args[4]; + sec = args[5]; + + result = new Date(Date.UTC(year, month, day, hour, min, 0, sec * 1000)); + if (year < 100) { + result.setUTCFullYear(year); + } + result.is_utc = true; + return result; + ; + }, TMP_Time_gm_4.$$arity = -2); + (function(self, $parent_nesting) { + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + + Opal.alias(self, "mktime", "local"); + return Opal.alias(self, "utc", "gm"); + })(Opal.get_singleton_class(self), $nesting); + Opal.defs(self, '$now', TMP_Time_now_5 = function $$now() { + var self = this; + + return self.$new() + }, TMP_Time_now_5.$$arity = 0); + + Opal.def(self, '$+', TMP_Time_$_6 = function(other) { + var self = this; + + + if ($truthy($$($nesting, 'Time')['$==='](other))) { + self.$raise($$($nesting, 'TypeError'), "time + time?")}; + + if (!other.$$is_number) { + other = $$($nesting, 'Opal')['$coerce_to!'](other, $$($nesting, 'Integer'), "to_int"); + } + var result = new Date(self.getTime() + (other * 1000)); + result.is_utc = self.is_utc; + return result; + ; + }, TMP_Time_$_6.$$arity = 1); + + Opal.def(self, '$-', TMP_Time_$_7 = function(other) { + var self = this; + + + if ($truthy($$($nesting, 'Time')['$==='](other))) { + return (self.getTime() - other.getTime()) / 1000}; + + if (!other.$$is_number) { + other = $$($nesting, 'Opal')['$coerce_to!'](other, $$($nesting, 'Integer'), "to_int"); + } + var result = new Date(self.getTime() - (other * 1000)); + result.is_utc = self.is_utc; + return result; + ; + }, TMP_Time_$_7.$$arity = 1); + + Opal.def(self, '$<=>', TMP_Time_$lt$eq$gt_8 = function(other) { + var self = this, r = nil; + + if ($truthy($$($nesting, 'Time')['$==='](other))) { + return self.$to_f()['$<=>'](other.$to_f()) + } else { + + r = other['$<=>'](self); + if ($truthy(r['$nil?']())) { + return nil + } else if ($truthy($rb_gt(r, 0))) { + return -1 + } else if ($truthy($rb_lt(r, 0))) { + return 1 + } else { + return 0 + }; + } + }, TMP_Time_$lt$eq$gt_8.$$arity = 1); + + Opal.def(self, '$==', TMP_Time_$eq$eq_9 = function(other) { + var $a, self = this; + + return ($truthy($a = $$($nesting, 'Time')['$==='](other)) ? self.$to_f() === other.$to_f() : $a) + }, TMP_Time_$eq$eq_9.$$arity = 1); + + Opal.def(self, '$asctime', TMP_Time_asctime_10 = function $$asctime() { + var self = this; + + return self.$strftime("%a %b %e %H:%M:%S %Y") + }, TMP_Time_asctime_10.$$arity = 0); + Opal.alias(self, "ctime", "asctime"); + + Opal.def(self, '$day', TMP_Time_day_11 = function $$day() { + var self = this; + + return self.is_utc ? self.getUTCDate() : self.getDate(); + }, TMP_Time_day_11.$$arity = 0); + + Opal.def(self, '$yday', TMP_Time_yday_12 = function $$yday() { + var self = this, start_of_year = nil, start_of_day = nil, one_day = nil; + + + start_of_year = $$($nesting, 'Time').$new(self.$year()).$to_i(); + start_of_day = $$($nesting, 'Time').$new(self.$year(), self.$month(), self.$day()).$to_i(); + one_day = 86400; + return $rb_plus($rb_divide($rb_minus(start_of_day, start_of_year), one_day).$round(), 1); + }, TMP_Time_yday_12.$$arity = 0); + + Opal.def(self, '$isdst', TMP_Time_isdst_13 = function $$isdst() { + var self = this; + + + var jan = new Date(self.getFullYear(), 0, 1), + jul = new Date(self.getFullYear(), 6, 1); + return self.getTimezoneOffset() < Math.max(jan.getTimezoneOffset(), jul.getTimezoneOffset()); + + }, TMP_Time_isdst_13.$$arity = 0); + Opal.alias(self, "dst?", "isdst"); + + Opal.def(self, '$dup', TMP_Time_dup_14 = function $$dup() { + var self = this, copy = nil; + + + copy = new Date(self.getTime()); + copy.$copy_instance_variables(self); + copy.$initialize_dup(self); + return copy; + }, TMP_Time_dup_14.$$arity = 0); + + Opal.def(self, '$eql?', TMP_Time_eql$q_15 = function(other) { + var $a, self = this; + + return ($truthy($a = other['$is_a?']($$($nesting, 'Time'))) ? self['$<=>'](other)['$zero?']() : $a) + }, TMP_Time_eql$q_15.$$arity = 1); + + Opal.def(self, '$friday?', TMP_Time_friday$q_16 = function() { + var self = this; + + return self.$wday() == 5 + }, TMP_Time_friday$q_16.$$arity = 0); + + Opal.def(self, '$hash', TMP_Time_hash_17 = function $$hash() { + var self = this; + + return 'Time:' + self.getTime(); + }, TMP_Time_hash_17.$$arity = 0); + + Opal.def(self, '$hour', TMP_Time_hour_18 = function $$hour() { + var self = this; + + return self.is_utc ? self.getUTCHours() : self.getHours(); + }, TMP_Time_hour_18.$$arity = 0); + + Opal.def(self, '$inspect', TMP_Time_inspect_19 = function $$inspect() { + var self = this; + + if ($truthy(self['$utc?']())) { + return self.$strftime("%Y-%m-%d %H:%M:%S UTC") + } else { + return self.$strftime("%Y-%m-%d %H:%M:%S %z") + } + }, TMP_Time_inspect_19.$$arity = 0); + Opal.alias(self, "mday", "day"); + + Opal.def(self, '$min', TMP_Time_min_20 = function $$min() { + var self = this; + + return self.is_utc ? self.getUTCMinutes() : self.getMinutes(); + }, TMP_Time_min_20.$$arity = 0); + + Opal.def(self, '$mon', TMP_Time_mon_21 = function $$mon() { + var self = this; + + return (self.is_utc ? self.getUTCMonth() : self.getMonth()) + 1; + }, TMP_Time_mon_21.$$arity = 0); + + Opal.def(self, '$monday?', TMP_Time_monday$q_22 = function() { + var self = this; + + return self.$wday() == 1 + }, TMP_Time_monday$q_22.$$arity = 0); + Opal.alias(self, "month", "mon"); + + Opal.def(self, '$saturday?', TMP_Time_saturday$q_23 = function() { + var self = this; + + return self.$wday() == 6 + }, TMP_Time_saturday$q_23.$$arity = 0); + + Opal.def(self, '$sec', TMP_Time_sec_24 = function $$sec() { + var self = this; + + return self.is_utc ? self.getUTCSeconds() : self.getSeconds(); + }, TMP_Time_sec_24.$$arity = 0); + + Opal.def(self, '$succ', TMP_Time_succ_25 = function $$succ() { + var self = this; + + + var result = new Date(self.getTime() + 1000); + result.is_utc = self.is_utc; + return result; + + }, TMP_Time_succ_25.$$arity = 0); + + Opal.def(self, '$usec', TMP_Time_usec_26 = function $$usec() { + var self = this; + + return self.getMilliseconds() * 1000; + }, TMP_Time_usec_26.$$arity = 0); + + Opal.def(self, '$zone', TMP_Time_zone_27 = function $$zone() { + var self = this; + + + var string = self.toString(), + result; + + if (string.indexOf('(') == -1) { + result = string.match(/[A-Z]{3,4}/)[0]; + } + else { + result = string.match(/\((.+)\)(?:\s|$)/)[1] + } + + if (result == "GMT" && /(GMT\W*\d{4})/.test(string)) { + return RegExp.$1; + } + else { + return result; + } + + }, TMP_Time_zone_27.$$arity = 0); + + Opal.def(self, '$getgm', TMP_Time_getgm_28 = function $$getgm() { + var self = this; + + + var result = new Date(self.getTime()); + result.is_utc = true; + return result; + + }, TMP_Time_getgm_28.$$arity = 0); + Opal.alias(self, "getutc", "getgm"); + + Opal.def(self, '$gmtime', TMP_Time_gmtime_29 = function $$gmtime() { + var self = this; + + + self.is_utc = true; + return self; + + }, TMP_Time_gmtime_29.$$arity = 0); + Opal.alias(self, "utc", "gmtime"); + + Opal.def(self, '$gmt?', TMP_Time_gmt$q_30 = function() { + var self = this; + + return self.is_utc === true; + }, TMP_Time_gmt$q_30.$$arity = 0); + + Opal.def(self, '$gmt_offset', TMP_Time_gmt_offset_31 = function $$gmt_offset() { + var self = this; + + return -self.getTimezoneOffset() * 60; + }, TMP_Time_gmt_offset_31.$$arity = 0); + + Opal.def(self, '$strftime', TMP_Time_strftime_32 = function $$strftime(format) { + var self = this; + + + return format.replace(/%([\-_#^0]*:{0,2})(\d+)?([EO]*)(.)/g, function(full, flags, width, _, conv) { + var result = "", + zero = flags.indexOf('0') !== -1, + pad = flags.indexOf('-') === -1, + blank = flags.indexOf('_') !== -1, + upcase = flags.indexOf('^') !== -1, + invert = flags.indexOf('#') !== -1, + colons = (flags.match(':') || []).length; + + width = parseInt(width, 10); + + if (zero && blank) { + if (flags.indexOf('0') < flags.indexOf('_')) { + zero = false; + } + else { + blank = false; + } + } + + switch (conv) { + case 'Y': + result += self.$year(); + break; + + case 'C': + zero = !blank; + result += Math.round(self.$year() / 100); + break; + + case 'y': + zero = !blank; + result += (self.$year() % 100); + break; + + case 'm': + zero = !blank; + result += self.$mon(); + break; + + case 'B': + result += long_months[self.$mon() - 1]; + break; + + case 'b': + case 'h': + blank = !zero; + result += short_months[self.$mon() - 1]; + break; + + case 'd': + zero = !blank + result += self.$day(); + break; + + case 'e': + blank = !zero + result += self.$day(); + break; + + case 'j': + result += self.$yday(); + break; + + case 'H': + zero = !blank; + result += self.$hour(); + break; + + case 'k': + blank = !zero; + result += self.$hour(); + break; + + case 'I': + zero = !blank; + result += (self.$hour() % 12 || 12); + break; + + case 'l': + blank = !zero; + result += (self.$hour() % 12 || 12); + break; + + case 'P': + result += (self.$hour() >= 12 ? "pm" : "am"); + break; + + case 'p': + result += (self.$hour() >= 12 ? "PM" : "AM"); + break; + + case 'M': + zero = !blank; + result += self.$min(); + break; + + case 'S': + zero = !blank; + result += self.$sec() + break; + + case 'L': + zero = !blank; + width = isNaN(width) ? 3 : width; + result += self.getMilliseconds(); + break; + + case 'N': + width = isNaN(width) ? 9 : width; + result += (self.getMilliseconds().toString()).$rjust(3, "0"); + result = (result).$ljust(width, "0"); + break; + + case 'z': + var offset = self.getTimezoneOffset(), + hours = Math.floor(Math.abs(offset) / 60), + minutes = Math.abs(offset) % 60; + + result += offset < 0 ? "+" : "-"; + result += hours < 10 ? "0" : ""; + result += hours; + + if (colons > 0) { + result += ":"; + } + + result += minutes < 10 ? "0" : ""; + result += minutes; + + if (colons > 1) { + result += ":00"; + } + + break; + + case 'Z': + result += self.$zone(); + break; + + case 'A': + result += days_of_week[self.$wday()]; + break; + + case 'a': + result += short_days[self.$wday()]; + break; + + case 'u': + result += (self.$wday() + 1); + break; + + case 'w': + result += self.$wday(); + break; + + case 'V': + result += self.$cweek_cyear()['$[]'](0).$to_s().$rjust(2, "0"); + break; + + case 'G': + result += self.$cweek_cyear()['$[]'](1); + break; + + case 'g': + result += self.$cweek_cyear()['$[]'](1)['$[]']($range(-2, -1, false)); + break; + + case 's': + result += self.$to_i(); + break; + + case 'n': + result += "\n"; + break; + + case 't': + result += "\t"; + break; + + case '%': + result += "%"; + break; + + case 'c': + result += self.$strftime("%a %b %e %T %Y"); + break; + + case 'D': + case 'x': + result += self.$strftime("%m/%d/%y"); + break; + + case 'F': + result += self.$strftime("%Y-%m-%d"); + break; + + case 'v': + result += self.$strftime("%e-%^b-%4Y"); + break; + + case 'r': + result += self.$strftime("%I:%M:%S %p"); + break; + + case 'R': + result += self.$strftime("%H:%M"); + break; + + case 'T': + case 'X': + result += self.$strftime("%H:%M:%S"); + break; + + default: + return full; + } + + if (upcase) { + result = result.toUpperCase(); + } + + if (invert) { + result = result.replace(/[A-Z]/, function(c) { c.toLowerCase() }). + replace(/[a-z]/, function(c) { c.toUpperCase() }); + } + + if (pad && (zero || blank)) { + result = (result).$rjust(isNaN(width) ? 2 : width, blank ? " " : "0"); + } + + return result; + }); + + }, TMP_Time_strftime_32.$$arity = 1); + + Opal.def(self, '$sunday?', TMP_Time_sunday$q_33 = function() { + var self = this; + + return self.$wday() == 0 + }, TMP_Time_sunday$q_33.$$arity = 0); + + Opal.def(self, '$thursday?', TMP_Time_thursday$q_34 = function() { + var self = this; + + return self.$wday() == 4 + }, TMP_Time_thursday$q_34.$$arity = 0); + + Opal.def(self, '$to_a', TMP_Time_to_a_35 = function $$to_a() { + var self = this; + + return [self.$sec(), self.$min(), self.$hour(), self.$day(), self.$month(), self.$year(), self.$wday(), self.$yday(), self.$isdst(), self.$zone()] + }, TMP_Time_to_a_35.$$arity = 0); + + Opal.def(self, '$to_f', TMP_Time_to_f_36 = function $$to_f() { + var self = this; + + return self.getTime() / 1000; + }, TMP_Time_to_f_36.$$arity = 0); + + Opal.def(self, '$to_i', TMP_Time_to_i_37 = function $$to_i() { + var self = this; + + return parseInt(self.getTime() / 1000, 10); + }, TMP_Time_to_i_37.$$arity = 0); + Opal.alias(self, "to_s", "inspect"); + + Opal.def(self, '$tuesday?', TMP_Time_tuesday$q_38 = function() { + var self = this; + + return self.$wday() == 2 + }, TMP_Time_tuesday$q_38.$$arity = 0); + Opal.alias(self, "tv_sec", "to_i"); + Opal.alias(self, "tv_usec", "usec"); + Opal.alias(self, "utc?", "gmt?"); + Opal.alias(self, "gmtoff", "gmt_offset"); + Opal.alias(self, "utc_offset", "gmt_offset"); + + Opal.def(self, '$wday', TMP_Time_wday_39 = function $$wday() { + var self = this; + + return self.is_utc ? self.getUTCDay() : self.getDay(); + }, TMP_Time_wday_39.$$arity = 0); + + Opal.def(self, '$wednesday?', TMP_Time_wednesday$q_40 = function() { + var self = this; + + return self.$wday() == 3 + }, TMP_Time_wednesday$q_40.$$arity = 0); + + Opal.def(self, '$year', TMP_Time_year_41 = function $$year() { + var self = this; + + return self.is_utc ? self.getUTCFullYear() : self.getFullYear(); + }, TMP_Time_year_41.$$arity = 0); + return (Opal.def(self, '$cweek_cyear', TMP_Time_cweek_cyear_42 = function $$cweek_cyear() { + var $a, self = this, jan01 = nil, jan01_wday = nil, first_monday = nil, year = nil, offset = nil, week = nil, dec31 = nil, dec31_wday = nil; + + + jan01 = $$($nesting, 'Time').$new(self.$year(), 1, 1); + jan01_wday = jan01.$wday(); + first_monday = 0; + year = self.$year(); + if ($truthy(($truthy($a = $rb_le(jan01_wday, 4)) ? jan01_wday['$!='](0) : $a))) { + offset = $rb_minus(jan01_wday, 1) + } else { + + offset = $rb_minus($rb_minus(jan01_wday, 7), 1); + if (offset['$=='](-8)) { + offset = -1}; + }; + week = $rb_divide($rb_plus(self.$yday(), offset), 7.0).$ceil(); + if ($truthy($rb_le(week, 0))) { + return $$($nesting, 'Time').$new($rb_minus(self.$year(), 1), 12, 31).$cweek_cyear() + } else if (week['$=='](53)) { + + dec31 = $$($nesting, 'Time').$new(self.$year(), 12, 31); + dec31_wday = dec31.$wday(); + if ($truthy(($truthy($a = $rb_le(dec31_wday, 3)) ? dec31_wday['$!='](0) : $a))) { + + week = 1; + year = $rb_plus(year, 1);};}; + return [week, year]; + }, TMP_Time_cweek_cyear_42.$$arity = 0), nil) && 'cweek_cyear'; + })($nesting[0], Date, $nesting); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/struct"] = function(Opal) { + function $rb_gt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); + } + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + function $rb_lt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); + } + function $rb_ge(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs >= rhs : lhs['$>='](rhs); + } + function $rb_plus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $hash2 = Opal.hash2, $truthy = Opal.truthy, $send = Opal.send; + + Opal.add_stubs(['$require', '$include', '$const_name!', '$unshift', '$map', '$coerce_to!', '$new', '$each', '$define_struct_attribute', '$allocate', '$initialize', '$alias_method', '$module_eval', '$to_proc', '$const_set', '$==', '$raise', '$<<', '$members', '$define_method', '$instance_eval', '$class', '$last', '$>', '$length', '$-', '$keys', '$any?', '$join', '$[]', '$[]=', '$each_with_index', '$hash', '$===', '$<', '$-@', '$size', '$>=', '$include?', '$to_sym', '$instance_of?', '$__id__', '$eql?', '$enum_for', '$name', '$+', '$each_pair', '$inspect', '$each_with_object', '$flatten', '$to_a', '$respond_to?', '$dig']); + + self.$require("corelib/enumerable"); + return (function($base, $super, $parent_nesting) { + function $Struct(){}; + var self = $Struct = $klass($base, $super, 'Struct', $Struct); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Struct_new_1, TMP_Struct_define_struct_attribute_6, TMP_Struct_members_9, TMP_Struct_inherited_10, TMP_Struct_initialize_12, TMP_Struct_members_15, TMP_Struct_hash_16, TMP_Struct_$$_17, TMP_Struct_$$$eq_18, TMP_Struct_$eq$eq_19, TMP_Struct_eql$q_20, TMP_Struct_each_21, TMP_Struct_each_pair_24, TMP_Struct_length_27, TMP_Struct_to_a_28, TMP_Struct_inspect_30, TMP_Struct_to_h_32, TMP_Struct_values_at_34, TMP_Struct_dig_36; + + + self.$include($$($nesting, 'Enumerable')); + Opal.defs(self, '$new', TMP_Struct_new_1 = function(const_name, $a, $b) { + var $iter = TMP_Struct_new_1.$$p, block = $iter || nil, $post_args, $kwargs, args, keyword_init, TMP_2, TMP_3, self = this, klass = nil; + + if ($iter) TMP_Struct_new_1.$$p = null; + + + if ($iter) TMP_Struct_new_1.$$p = null;; + + $post_args = Opal.slice.call(arguments, 1, arguments.length); + + $kwargs = Opal.extract_kwargs($post_args); + + if ($kwargs == null) { + $kwargs = $hash2([], {}); + } else if (!$kwargs.$$is_hash) { + throw Opal.ArgumentError.$new('expected kwargs'); + }; + + args = $post_args;; + + keyword_init = $kwargs.$$smap["keyword_init"]; + if (keyword_init == null) { + keyword_init = false + }; + if ($truthy(const_name)) { + + try { + const_name = $$($nesting, 'Opal')['$const_name!'](const_name) + } catch ($err) { + if (Opal.rescue($err, [$$($nesting, 'TypeError'), $$($nesting, 'NameError')])) { + try { + + args.$unshift(const_name); + const_name = nil; + } finally { Opal.pop_exception() } + } else { throw $err; } + };}; + $send(args, 'map', [], (TMP_2 = function(arg){var self = TMP_2.$$s || this; + + + + if (arg == null) { + arg = nil; + }; + return $$($nesting, 'Opal')['$coerce_to!'](arg, $$($nesting, 'String'), "to_str");}, TMP_2.$$s = self, TMP_2.$$arity = 1, TMP_2)); + klass = $send($$($nesting, 'Class'), 'new', [self], (TMP_3 = function(){var self = TMP_3.$$s || this, TMP_4; + + + $send(args, 'each', [], (TMP_4 = function(arg){var self = TMP_4.$$s || this; + + + + if (arg == null) { + arg = nil; + }; + return self.$define_struct_attribute(arg);}, TMP_4.$$s = self, TMP_4.$$arity = 1, TMP_4)); + return (function(self, $parent_nesting) { + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_new_5; + + + + Opal.def(self, '$new', TMP_new_5 = function($a) { + var $post_args, args, self = this, instance = nil; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + instance = self.$allocate(); + instance.$$data = {}; + $send(instance, 'initialize', Opal.to_a(args)); + return instance; + }, TMP_new_5.$$arity = -1); + return self.$alias_method("[]", "new"); + })(Opal.get_singleton_class(self), $nesting);}, TMP_3.$$s = self, TMP_3.$$arity = 0, TMP_3)); + if ($truthy(block)) { + $send(klass, 'module_eval', [], block.$to_proc())}; + klass.$$keyword_init = keyword_init; + if ($truthy(const_name)) { + $$($nesting, 'Struct').$const_set(const_name, klass)}; + return klass; + }, TMP_Struct_new_1.$$arity = -2); + Opal.defs(self, '$define_struct_attribute', TMP_Struct_define_struct_attribute_6 = function $$define_struct_attribute(name) { + var TMP_7, TMP_8, self = this; + + + if (self['$==']($$($nesting, 'Struct'))) { + self.$raise($$($nesting, 'ArgumentError'), "you cannot define attributes to the Struct class")}; + self.$members()['$<<'](name); + $send(self, 'define_method', [name], (TMP_7 = function(){var self = TMP_7.$$s || this; + + return self.$$data[name];}, TMP_7.$$s = self, TMP_7.$$arity = 0, TMP_7)); + return $send(self, 'define_method', ["" + (name) + "="], (TMP_8 = function(value){var self = TMP_8.$$s || this; + + + + if (value == null) { + value = nil; + }; + return self.$$data[name] = value;;}, TMP_8.$$s = self, TMP_8.$$arity = 1, TMP_8)); + }, TMP_Struct_define_struct_attribute_6.$$arity = 1); + Opal.defs(self, '$members', TMP_Struct_members_9 = function $$members() { + var $a, self = this; + if (self.members == null) self.members = nil; + + + if (self['$==']($$($nesting, 'Struct'))) { + self.$raise($$($nesting, 'ArgumentError'), "the Struct class has no members")}; + return (self.members = ($truthy($a = self.members) ? $a : [])); + }, TMP_Struct_members_9.$$arity = 0); + Opal.defs(self, '$inherited', TMP_Struct_inherited_10 = function $$inherited(klass) { + var TMP_11, self = this, members = nil; + if (self.members == null) self.members = nil; + + + members = self.members; + return $send(klass, 'instance_eval', [], (TMP_11 = function(){var self = TMP_11.$$s || this; + + return (self.members = members)}, TMP_11.$$s = self, TMP_11.$$arity = 0, TMP_11)); + }, TMP_Struct_inherited_10.$$arity = 1); + + Opal.def(self, '$initialize', TMP_Struct_initialize_12 = function $$initialize($a) { + var $post_args, args, $b, TMP_13, TMP_14, self = this, kwargs = nil, extra = nil; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + if ($truthy(self.$class().$$keyword_init)) { + + kwargs = ($truthy($b = args.$last()) ? $b : $hash2([], {})); + if ($truthy(($truthy($b = $rb_gt(args.$length(), 1)) ? $b : (args.length === 1 && !kwargs.$$is_hash)))) { + self.$raise($$($nesting, 'ArgumentError'), "" + "wrong number of arguments (given " + (args.$length()) + ", expected 0)")}; + extra = $rb_minus(kwargs.$keys(), self.$class().$members()); + if ($truthy(extra['$any?']())) { + self.$raise($$($nesting, 'ArgumentError'), "" + "unknown keywords: " + (extra.$join(", ")))}; + return $send(self.$class().$members(), 'each', [], (TMP_13 = function(name){var self = TMP_13.$$s || this, $writer = nil; + + + + if (name == null) { + name = nil; + }; + $writer = [name, kwargs['$[]'](name)]; + $send(self, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];}, TMP_13.$$s = self, TMP_13.$$arity = 1, TMP_13)); + } else { + + if ($truthy($rb_gt(args.$length(), self.$class().$members().$length()))) { + self.$raise($$($nesting, 'ArgumentError'), "struct size differs")}; + return $send(self.$class().$members(), 'each_with_index', [], (TMP_14 = function(name, index){var self = TMP_14.$$s || this, $writer = nil; + + + + if (name == null) { + name = nil; + }; + + if (index == null) { + index = nil; + }; + $writer = [name, args['$[]'](index)]; + $send(self, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];}, TMP_14.$$s = self, TMP_14.$$arity = 2, TMP_14)); + }; + }, TMP_Struct_initialize_12.$$arity = -1); + + Opal.def(self, '$members', TMP_Struct_members_15 = function $$members() { + var self = this; + + return self.$class().$members() + }, TMP_Struct_members_15.$$arity = 0); + + Opal.def(self, '$hash', TMP_Struct_hash_16 = function $$hash() { + var self = this; + + return $$($nesting, 'Hash').$new(self.$$data).$hash() + }, TMP_Struct_hash_16.$$arity = 0); + + Opal.def(self, '$[]', TMP_Struct_$$_17 = function(name) { + var self = this; + + + if ($truthy($$($nesting, 'Integer')['$==='](name))) { + + if ($truthy($rb_lt(name, self.$class().$members().$size()['$-@']()))) { + self.$raise($$($nesting, 'IndexError'), "" + "offset " + (name) + " too small for struct(size:" + (self.$class().$members().$size()) + ")")}; + if ($truthy($rb_ge(name, self.$class().$members().$size()))) { + self.$raise($$($nesting, 'IndexError'), "" + "offset " + (name) + " too large for struct(size:" + (self.$class().$members().$size()) + ")")}; + name = self.$class().$members()['$[]'](name); + } else if ($truthy($$($nesting, 'String')['$==='](name))) { + + if(!self.$$data.hasOwnProperty(name)) { + self.$raise($$($nesting, 'NameError').$new("" + "no member '" + (name) + "' in struct", name)) + } + + } else { + self.$raise($$($nesting, 'TypeError'), "" + "no implicit conversion of " + (name.$class()) + " into Integer") + }; + name = $$($nesting, 'Opal')['$coerce_to!'](name, $$($nesting, 'String'), "to_str"); + return self.$$data[name];; + }, TMP_Struct_$$_17.$$arity = 1); + + Opal.def(self, '$[]=', TMP_Struct_$$$eq_18 = function(name, value) { + var self = this; + + + if ($truthy($$($nesting, 'Integer')['$==='](name))) { + + if ($truthy($rb_lt(name, self.$class().$members().$size()['$-@']()))) { + self.$raise($$($nesting, 'IndexError'), "" + "offset " + (name) + " too small for struct(size:" + (self.$class().$members().$size()) + ")")}; + if ($truthy($rb_ge(name, self.$class().$members().$size()))) { + self.$raise($$($nesting, 'IndexError'), "" + "offset " + (name) + " too large for struct(size:" + (self.$class().$members().$size()) + ")")}; + name = self.$class().$members()['$[]'](name); + } else if ($truthy($$($nesting, 'String')['$==='](name))) { + if ($truthy(self.$class().$members()['$include?'](name.$to_sym()))) { + } else { + self.$raise($$($nesting, 'NameError').$new("" + "no member '" + (name) + "' in struct", name)) + } + } else { + self.$raise($$($nesting, 'TypeError'), "" + "no implicit conversion of " + (name.$class()) + " into Integer") + }; + name = $$($nesting, 'Opal')['$coerce_to!'](name, $$($nesting, 'String'), "to_str"); + return self.$$data[name] = value;; + }, TMP_Struct_$$$eq_18.$$arity = 2); + + Opal.def(self, '$==', TMP_Struct_$eq$eq_19 = function(other) { + var self = this; + + + if ($truthy(other['$instance_of?'](self.$class()))) { + } else { + return false + }; + + var recursed1 = {}, recursed2 = {}; + + function _eqeq(struct, other) { + var key, a, b; + + recursed1[(struct).$__id__()] = true; + recursed2[(other).$__id__()] = true; + + for (key in struct.$$data) { + a = struct.$$data[key]; + b = other.$$data[key]; + + if ($$($nesting, 'Struct')['$==='](a)) { + if (!recursed1.hasOwnProperty((a).$__id__()) || !recursed2.hasOwnProperty((b).$__id__())) { + if (!_eqeq(a, b)) { + return false; + } + } + } else { + if (!(a)['$=='](b)) { + return false; + } + } + } + + return true; + } + + return _eqeq(self, other); + ; + }, TMP_Struct_$eq$eq_19.$$arity = 1); + + Opal.def(self, '$eql?', TMP_Struct_eql$q_20 = function(other) { + var self = this; + + + if ($truthy(other['$instance_of?'](self.$class()))) { + } else { + return false + }; + + var recursed1 = {}, recursed2 = {}; + + function _eqeq(struct, other) { + var key, a, b; + + recursed1[(struct).$__id__()] = true; + recursed2[(other).$__id__()] = true; + + for (key in struct.$$data) { + a = struct.$$data[key]; + b = other.$$data[key]; + + if ($$($nesting, 'Struct')['$==='](a)) { + if (!recursed1.hasOwnProperty((a).$__id__()) || !recursed2.hasOwnProperty((b).$__id__())) { + if (!_eqeq(a, b)) { + return false; + } + } + } else { + if (!(a)['$eql?'](b)) { + return false; + } + } + } + + return true; + } + + return _eqeq(self, other); + ; + }, TMP_Struct_eql$q_20.$$arity = 1); + + Opal.def(self, '$each', TMP_Struct_each_21 = function $$each() { + var TMP_22, TMP_23, $iter = TMP_Struct_each_21.$$p, $yield = $iter || nil, self = this; + + if ($iter) TMP_Struct_each_21.$$p = null; + + if (($yield !== nil)) { + } else { + return $send(self, 'enum_for', ["each"], (TMP_22 = function(){var self = TMP_22.$$s || this; + + return self.$size()}, TMP_22.$$s = self, TMP_22.$$arity = 0, TMP_22)) + }; + $send(self.$class().$members(), 'each', [], (TMP_23 = function(name){var self = TMP_23.$$s || this; + + + + if (name == null) { + name = nil; + }; + return Opal.yield1($yield, self['$[]'](name));;}, TMP_23.$$s = self, TMP_23.$$arity = 1, TMP_23)); + return self; + }, TMP_Struct_each_21.$$arity = 0); + + Opal.def(self, '$each_pair', TMP_Struct_each_pair_24 = function $$each_pair() { + var TMP_25, TMP_26, $iter = TMP_Struct_each_pair_24.$$p, $yield = $iter || nil, self = this; + + if ($iter) TMP_Struct_each_pair_24.$$p = null; + + if (($yield !== nil)) { + } else { + return $send(self, 'enum_for', ["each_pair"], (TMP_25 = function(){var self = TMP_25.$$s || this; + + return self.$size()}, TMP_25.$$s = self, TMP_25.$$arity = 0, TMP_25)) + }; + $send(self.$class().$members(), 'each', [], (TMP_26 = function(name){var self = TMP_26.$$s || this; + + + + if (name == null) { + name = nil; + }; + return Opal.yield1($yield, [name, self['$[]'](name)]);;}, TMP_26.$$s = self, TMP_26.$$arity = 1, TMP_26)); + return self; + }, TMP_Struct_each_pair_24.$$arity = 0); + + Opal.def(self, '$length', TMP_Struct_length_27 = function $$length() { + var self = this; + + return self.$class().$members().$length() + }, TMP_Struct_length_27.$$arity = 0); + Opal.alias(self, "size", "length"); + + Opal.def(self, '$to_a', TMP_Struct_to_a_28 = function $$to_a() { + var TMP_29, self = this; + + return $send(self.$class().$members(), 'map', [], (TMP_29 = function(name){var self = TMP_29.$$s || this; + + + + if (name == null) { + name = nil; + }; + return self['$[]'](name);}, TMP_29.$$s = self, TMP_29.$$arity = 1, TMP_29)) + }, TMP_Struct_to_a_28.$$arity = 0); + Opal.alias(self, "values", "to_a"); + + Opal.def(self, '$inspect', TMP_Struct_inspect_30 = function $$inspect() { + var $a, TMP_31, self = this, result = nil; + + + result = "#"); + return result; + }, TMP_Struct_inspect_30.$$arity = 0); + Opal.alias(self, "to_s", "inspect"); + + Opal.def(self, '$to_h', TMP_Struct_to_h_32 = function $$to_h() { + var TMP_33, self = this; + + return $send(self.$class().$members(), 'each_with_object', [$hash2([], {})], (TMP_33 = function(name, h){var self = TMP_33.$$s || this, $writer = nil; + + + + if (name == null) { + name = nil; + }; + + if (h == null) { + h = nil; + }; + $writer = [name, self['$[]'](name)]; + $send(h, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];}, TMP_33.$$s = self, TMP_33.$$arity = 2, TMP_33)) + }, TMP_Struct_to_h_32.$$arity = 0); + + Opal.def(self, '$values_at', TMP_Struct_values_at_34 = function $$values_at($a) { + var $post_args, args, TMP_35, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + args = $send(args, 'map', [], (TMP_35 = function(arg){var self = TMP_35.$$s || this; + + + + if (arg == null) { + arg = nil; + }; + return arg.$$is_range ? arg.$to_a() : arg;}, TMP_35.$$s = self, TMP_35.$$arity = 1, TMP_35)).$flatten(); + + var result = []; + for (var i = 0, len = args.length; i < len; i++) { + if (!args[i].$$is_number) { + self.$raise($$($nesting, 'TypeError'), "" + "no implicit conversion of " + ((args[i]).$class()) + " into Integer") + } + result.push(self['$[]'](args[i])); + } + return result; + ; + }, TMP_Struct_values_at_34.$$arity = -1); + return (Opal.def(self, '$dig', TMP_Struct_dig_36 = function $$dig(key, $a) { + var $post_args, keys, self = this, item = nil; + + + + $post_args = Opal.slice.call(arguments, 1, arguments.length); + + keys = $post_args;; + item = (function() {if ($truthy(key.$$is_string && self.$$data.hasOwnProperty(key))) { + return self.$$data[key] || nil; + } else { + return nil + }; return nil; })(); + + if (item === nil || keys.length === 0) { + return item; + } + ; + if ($truthy(item['$respond_to?']("dig"))) { + } else { + self.$raise($$($nesting, 'TypeError'), "" + (item.$class()) + " does not have #dig method") + }; + return $send(item, 'dig', Opal.to_a(keys)); + }, TMP_Struct_dig_36.$$arity = -2), nil) && 'dig'; + })($nesting[0], null, $nesting); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/io"] = function(Opal) { + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $module = Opal.module, $send = Opal.send, $gvars = Opal.gvars, $truthy = Opal.truthy, $writer = nil; + + Opal.add_stubs(['$attr_accessor', '$size', '$write', '$join', '$map', '$String', '$empty?', '$concat', '$chomp', '$getbyte', '$getc', '$raise', '$new', '$write_proc=', '$-', '$extend']); + + (function($base, $super, $parent_nesting) { + function $IO(){}; + var self = $IO = $klass($base, $super, 'IO', $IO); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_IO_tty$q_1, TMP_IO_closed$q_2, TMP_IO_write_3, TMP_IO_flush_4; + + def.tty = def.closed = nil; + + Opal.const_set($nesting[0], 'SEEK_SET', 0); + Opal.const_set($nesting[0], 'SEEK_CUR', 1); + Opal.const_set($nesting[0], 'SEEK_END', 2); + + Opal.def(self, '$tty?', TMP_IO_tty$q_1 = function() { + var self = this; + + return self.tty + }, TMP_IO_tty$q_1.$$arity = 0); + + Opal.def(self, '$closed?', TMP_IO_closed$q_2 = function() { + var self = this; + + return self.closed + }, TMP_IO_closed$q_2.$$arity = 0); + self.$attr_accessor("write_proc"); + + Opal.def(self, '$write', TMP_IO_write_3 = function $$write(string) { + var self = this; + + + self.write_proc(string); + return string.$size(); + }, TMP_IO_write_3.$$arity = 1); + self.$attr_accessor("sync", "tty"); + + Opal.def(self, '$flush', TMP_IO_flush_4 = function $$flush() { + var self = this; + + return nil + }, TMP_IO_flush_4.$$arity = 0); + (function($base, $parent_nesting) { + function $Writable() {}; + var self = $Writable = $module($base, 'Writable', $Writable); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Writable_$lt$lt_5, TMP_Writable_print_6, TMP_Writable_puts_8; + + + + Opal.def(self, '$<<', TMP_Writable_$lt$lt_5 = function(string) { + var self = this; + + + self.$write(string); + return self; + }, TMP_Writable_$lt$lt_5.$$arity = 1); + + Opal.def(self, '$print', TMP_Writable_print_6 = function $$print($a) { + var $post_args, args, TMP_7, self = this; + if ($gvars[","] == null) $gvars[","] = nil; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + self.$write($send(args, 'map', [], (TMP_7 = function(arg){var self = TMP_7.$$s || this; + + + + if (arg == null) { + arg = nil; + }; + return self.$String(arg);}, TMP_7.$$s = self, TMP_7.$$arity = 1, TMP_7)).$join($gvars[","])); + return nil; + }, TMP_Writable_print_6.$$arity = -1); + + Opal.def(self, '$puts', TMP_Writable_puts_8 = function $$puts($a) { + var $post_args, args, TMP_9, self = this, newline = nil; + if ($gvars["/"] == null) $gvars["/"] = nil; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + newline = $gvars["/"]; + if ($truthy(args['$empty?']())) { + self.$write($gvars["/"]) + } else { + self.$write($send(args, 'map', [], (TMP_9 = function(arg){var self = TMP_9.$$s || this; + + + + if (arg == null) { + arg = nil; + }; + return self.$String(arg).$chomp();}, TMP_9.$$s = self, TMP_9.$$arity = 1, TMP_9)).$concat([nil]).$join(newline)) + }; + return nil; + }, TMP_Writable_puts_8.$$arity = -1); + })($nesting[0], $nesting); + return (function($base, $parent_nesting) { + function $Readable() {}; + var self = $Readable = $module($base, 'Readable', $Readable); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Readable_readbyte_10, TMP_Readable_readchar_11, TMP_Readable_readline_12, TMP_Readable_readpartial_13; + + + + Opal.def(self, '$readbyte', TMP_Readable_readbyte_10 = function $$readbyte() { + var self = this; + + return self.$getbyte() + }, TMP_Readable_readbyte_10.$$arity = 0); + + Opal.def(self, '$readchar', TMP_Readable_readchar_11 = function $$readchar() { + var self = this; + + return self.$getc() + }, TMP_Readable_readchar_11.$$arity = 0); + + Opal.def(self, '$readline', TMP_Readable_readline_12 = function $$readline(sep) { + var self = this; + if ($gvars["/"] == null) $gvars["/"] = nil; + + + + if (sep == null) { + sep = $gvars["/"]; + }; + return self.$raise($$($nesting, 'NotImplementedError')); + }, TMP_Readable_readline_12.$$arity = -1); + + Opal.def(self, '$readpartial', TMP_Readable_readpartial_13 = function $$readpartial(integer, outbuf) { + var self = this; + + + + if (outbuf == null) { + outbuf = nil; + }; + return self.$raise($$($nesting, 'NotImplementedError')); + }, TMP_Readable_readpartial_13.$$arity = -2); + })($nesting[0], $nesting); + })($nesting[0], null, $nesting); + Opal.const_set($nesting[0], 'STDERR', ($gvars.stderr = $$($nesting, 'IO').$new())); + Opal.const_set($nesting[0], 'STDIN', ($gvars.stdin = $$($nesting, 'IO').$new())); + Opal.const_set($nesting[0], 'STDOUT', ($gvars.stdout = $$($nesting, 'IO').$new())); + var console = Opal.global.console; + + $writer = [typeof(process) === 'object' && typeof(process.stdout) === 'object' ? function(s){process.stdout.write(s)} : function(s){console.log(s)}]; + $send($$($nesting, 'STDOUT'), 'write_proc=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = [typeof(process) === 'object' && typeof(process.stderr) === 'object' ? function(s){process.stderr.write(s)} : function(s){console.warn(s)}]; + $send($$($nesting, 'STDERR'), 'write_proc=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + $$($nesting, 'STDOUT').$extend($$$($$($nesting, 'IO'), 'Writable')); + return $$($nesting, 'STDERR').$extend($$$($$($nesting, 'IO'), 'Writable')); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/main"] = function(Opal) { + var TMP_to_s_1, TMP_include_2, self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice; + + Opal.add_stubs(['$include']); + + Opal.defs(self, '$to_s', TMP_to_s_1 = function $$to_s() { + var self = this; + + return "main" + }, TMP_to_s_1.$$arity = 0); + return (Opal.defs(self, '$include', TMP_include_2 = function $$include(mod) { + var self = this; + + return $$($nesting, 'Object').$include(mod) + }, TMP_include_2.$$arity = 1), nil) && 'include'; +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/dir"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $truthy = Opal.truthy; + + Opal.add_stubs(['$[]']); + return (function($base, $super, $parent_nesting) { + function $Dir(){}; + var self = $Dir = $klass($base, $super, 'Dir', $Dir); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return (function(self, $parent_nesting) { + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_chdir_1, TMP_pwd_2, TMP_home_3; + + + + Opal.def(self, '$chdir', TMP_chdir_1 = function $$chdir(dir) { + var $iter = TMP_chdir_1.$$p, $yield = $iter || nil, self = this, prev_cwd = nil; + + if ($iter) TMP_chdir_1.$$p = null; + return (function() { try { + + prev_cwd = Opal.current_dir; + Opal.current_dir = dir; + return Opal.yieldX($yield, []);; + } finally { + Opal.current_dir = prev_cwd + }; })() + }, TMP_chdir_1.$$arity = 1); + + Opal.def(self, '$pwd', TMP_pwd_2 = function $$pwd() { + var self = this; + + return Opal.current_dir || '.'; + }, TMP_pwd_2.$$arity = 0); + Opal.alias(self, "getwd", "pwd"); + return (Opal.def(self, '$home', TMP_home_3 = function $$home() { + var $a, self = this; + + return ($truthy($a = $$($nesting, 'ENV')['$[]']("HOME")) ? $a : ".") + }, TMP_home_3.$$arity = 0), nil) && 'home'; + })(Opal.get_singleton_class(self), $nesting) + })($nesting[0], null, $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/file"] = function(Opal) { + function $rb_plus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); + } + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $truthy = Opal.truthy, $range = Opal.range, $send = Opal.send; + + Opal.add_stubs(['$home', '$raise', '$start_with?', '$+', '$sub', '$pwd', '$split', '$unshift', '$join', '$respond_to?', '$coerce_to!', '$basename', '$empty?', '$rindex', '$[]', '$nil?', '$==', '$-', '$length', '$gsub', '$find', '$=~', '$map', '$each_with_index', '$flatten', '$reject', '$to_proc', '$end_with?']); + return (function($base, $super, $parent_nesting) { + function $File(){}; + var self = $File = $klass($base, $super, 'File', $File); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), windows_root_rx = nil; + + + Opal.const_set($nesting[0], 'Separator', Opal.const_set($nesting[0], 'SEPARATOR', "/")); + Opal.const_set($nesting[0], 'ALT_SEPARATOR', nil); + Opal.const_set($nesting[0], 'PATH_SEPARATOR', ":"); + Opal.const_set($nesting[0], 'FNM_SYSCASE', 0); + windows_root_rx = /^[a-zA-Z]:(?:\\|\/)/; + return (function(self, $parent_nesting) { + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_expand_path_1, TMP_dirname_2, TMP_basename_3, TMP_extname_4, TMP_exist$q_5, TMP_directory$q_6, TMP_join_8, TMP_split_11; + + + + Opal.def(self, '$expand_path', TMP_expand_path_1 = function $$expand_path(path, basedir) { + var $a, self = this, sep = nil, sep_chars = nil, new_parts = nil, home = nil, home_path_regexp = nil, path_abs = nil, basedir_abs = nil, parts = nil, leading_sep = nil, abs = nil, new_path = nil; + + + + if (basedir == null) { + basedir = nil; + }; + sep = $$($nesting, 'SEPARATOR'); + sep_chars = $sep_chars(); + new_parts = []; + if ($truthy(path[0] === '~' || (basedir && basedir[0] === '~'))) { + + home = $$($nesting, 'Dir').$home(); + if ($truthy(home)) { + } else { + self.$raise($$($nesting, 'ArgumentError'), "couldn't find HOME environment -- expanding `~'") + }; + if ($truthy(home['$start_with?'](sep))) { + } else { + self.$raise($$($nesting, 'ArgumentError'), "non-absolute home") + }; + home = $rb_plus(home, sep); + home_path_regexp = new RegExp("" + "^\\~(?:" + (sep) + "|$)"); + path = path.$sub(home_path_regexp, home); + if ($truthy(basedir)) { + basedir = basedir.$sub(home_path_regexp, home)};}; + basedir = ($truthy($a = basedir) ? $a : $$($nesting, 'Dir').$pwd()); + path_abs = path.substr(0, sep.length) === sep || windows_root_rx.test(path); + basedir_abs = basedir.substr(0, sep.length) === sep || windows_root_rx.test(basedir); + if ($truthy(path_abs)) { + + parts = path.$split(new RegExp("" + "[" + (sep_chars) + "]")); + leading_sep = windows_root_rx.test(path) ? '' : path.$sub(new RegExp("" + "^([" + (sep_chars) + "]+).*$"), "\\1"); + abs = true; + } else { + + parts = $rb_plus(basedir.$split(new RegExp("" + "[" + (sep_chars) + "]")), path.$split(new RegExp("" + "[" + (sep_chars) + "]"))); + leading_sep = windows_root_rx.test(basedir) ? '' : basedir.$sub(new RegExp("" + "^([" + (sep_chars) + "]+).*$"), "\\1"); + abs = basedir_abs; + }; + + var part; + for (var i = 0, ii = parts.length; i < ii; i++) { + part = parts[i]; + + if ( + (part === nil) || + (part === '' && ((new_parts.length === 0) || abs)) || + (part === '.' && ((new_parts.length === 0) || abs)) + ) { + continue; + } + if (part === '..') { + new_parts.pop(); + } else { + new_parts.push(part); + } + } + + if (!abs && parts[0] !== '.') { + new_parts.$unshift(".") + } + ; + new_path = new_parts.$join(sep); + if ($truthy(abs)) { + new_path = $rb_plus(leading_sep, new_path)}; + return new_path; + }, TMP_expand_path_1.$$arity = -2); + Opal.alias(self, "realpath", "expand_path"); + + // Coerce a given path to a path string using #to_path and #to_str + function $coerce_to_path(path) { + if ($truthy((path)['$respond_to?']("to_path"))) { + path = path.$to_path(); + } + + path = $$($nesting, 'Opal')['$coerce_to!'](path, $$($nesting, 'String'), "to_str"); + + return path; + } + + // Return a RegExp compatible char class + function $sep_chars() { + if ($$($nesting, 'ALT_SEPARATOR') === nil) { + return Opal.escape_regexp($$($nesting, 'SEPARATOR')); + } else { + return Opal.escape_regexp($rb_plus($$($nesting, 'SEPARATOR'), $$($nesting, 'ALT_SEPARATOR'))); + } + } + ; + + Opal.def(self, '$dirname', TMP_dirname_2 = function $$dirname(path) { + var self = this, sep_chars = nil; + + + sep_chars = $sep_chars(); + path = $coerce_to_path(path); + + var absolute = path.match(new RegExp("" + "^[" + (sep_chars) + "]")); + + path = path.replace(new RegExp("" + "[" + (sep_chars) + "]+$"), ''); // remove trailing separators + path = path.replace(new RegExp("" + "[^" + (sep_chars) + "]+$"), ''); // remove trailing basename + path = path.replace(new RegExp("" + "[" + (sep_chars) + "]+$"), ''); // remove final trailing separators + + if (path === '') { + return absolute ? '/' : '.'; + } + + return path; + ; + }, TMP_dirname_2.$$arity = 1); + + Opal.def(self, '$basename', TMP_basename_3 = function $$basename(name, suffix) { + var self = this, sep_chars = nil; + + + + if (suffix == null) { + suffix = nil; + }; + sep_chars = $sep_chars(); + name = $coerce_to_path(name); + + if (name.length == 0) { + return name; + } + + if (suffix !== nil) { + suffix = $$($nesting, 'Opal')['$coerce_to!'](suffix, $$($nesting, 'String'), "to_str") + } else { + suffix = null; + } + + name = name.replace(new RegExp("" + "(.)[" + (sep_chars) + "]*$"), '$1'); + name = name.replace(new RegExp("" + "^(?:.*[" + (sep_chars) + "])?([^" + (sep_chars) + "]+)$"), '$1'); + + if (suffix === ".*") { + name = name.replace(/\.[^\.]+$/, ''); + } else if(suffix !== null) { + suffix = Opal.escape_regexp(suffix); + name = name.replace(new RegExp("" + (suffix) + "$"), ''); + } + + return name; + ; + }, TMP_basename_3.$$arity = -2); + + Opal.def(self, '$extname', TMP_extname_4 = function $$extname(path) { + var $a, self = this, filename = nil, last_dot_idx = nil; + + + path = $coerce_to_path(path); + filename = self.$basename(path); + if ($truthy(filename['$empty?']())) { + return ""}; + last_dot_idx = filename['$[]']($range(1, -1, false)).$rindex("."); + if ($truthy(($truthy($a = last_dot_idx['$nil?']()) ? $a : $rb_plus(last_dot_idx, 1)['$==']($rb_minus(filename.$length(), 1))))) { + return "" + } else { + return filename['$[]'](Opal.Range.$new($rb_plus(last_dot_idx, 1), -1, false)) + }; + }, TMP_extname_4.$$arity = 1); + + Opal.def(self, '$exist?', TMP_exist$q_5 = function(path) { + var self = this; + + return Opal.modules[path] != null + }, TMP_exist$q_5.$$arity = 1); + Opal.alias(self, "exists?", "exist?"); + + Opal.def(self, '$directory?', TMP_directory$q_6 = function(path) { + var TMP_7, self = this, files = nil, file = nil; + + + files = []; + + for (var key in Opal.modules) { + files.push(key) + } + ; + path = path.$gsub(new RegExp("" + "(^." + ($$($nesting, 'SEPARATOR')) + "+|" + ($$($nesting, 'SEPARATOR')) + "+$)")); + file = $send(files, 'find', [], (TMP_7 = function(f){var self = TMP_7.$$s || this; + + + + if (f == null) { + f = nil; + }; + return f['$=~'](new RegExp("" + "^" + (path)));}, TMP_7.$$s = self, TMP_7.$$arity = 1, TMP_7)); + return file; + }, TMP_directory$q_6.$$arity = 1); + + Opal.def(self, '$join', TMP_join_8 = function $$join($a) { + var $post_args, paths, TMP_9, TMP_10, self = this, result = nil; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + paths = $post_args;; + if ($truthy(paths['$empty?']())) { + return ""}; + result = ""; + paths = $send(paths.$flatten().$each_with_index(), 'map', [], (TMP_9 = function(item, index){var self = TMP_9.$$s || this, $b; + + + + if (item == null) { + item = nil; + }; + + if (index == null) { + index = nil; + }; + if ($truthy((($b = index['$=='](0)) ? item['$empty?']() : index['$=='](0)))) { + return $$($nesting, 'SEPARATOR') + } else if ($truthy((($b = paths.$length()['$==']($rb_plus(index, 1))) ? item['$empty?']() : paths.$length()['$==']($rb_plus(index, 1))))) { + return $$($nesting, 'SEPARATOR') + } else { + return item + };}, TMP_9.$$s = self, TMP_9.$$arity = 2, TMP_9)); + paths = $send(paths, 'reject', [], "empty?".$to_proc()); + $send(paths, 'each_with_index', [], (TMP_10 = function(item, index){var self = TMP_10.$$s || this, $b, next_item = nil; + + + + if (item == null) { + item = nil; + }; + + if (index == null) { + index = nil; + }; + next_item = paths['$[]']($rb_plus(index, 1)); + if ($truthy(next_item['$nil?']())) { + return (result = "" + (result) + (item)) + } else { + + if ($truthy(($truthy($b = item['$end_with?']($$($nesting, 'SEPARATOR'))) ? next_item['$start_with?']($$($nesting, 'SEPARATOR')) : $b))) { + item = item.$sub(new RegExp("" + ($$($nesting, 'SEPARATOR')) + "+$"), "")}; + return (result = (function() {if ($truthy(($truthy($b = item['$end_with?']($$($nesting, 'SEPARATOR'))) ? $b : next_item['$start_with?']($$($nesting, 'SEPARATOR'))))) { + return "" + (result) + (item) + } else { + return "" + (result) + (item) + ($$($nesting, 'SEPARATOR')) + }; return nil; })()); + };}, TMP_10.$$s = self, TMP_10.$$arity = 2, TMP_10)); + return result; + }, TMP_join_8.$$arity = -1); + return (Opal.def(self, '$split', TMP_split_11 = function $$split(path) { + var self = this; + + return path.$split($$($nesting, 'SEPARATOR')) + }, TMP_split_11.$$arity = 1), nil) && 'split'; + })(Opal.get_singleton_class(self), $nesting); + })($nesting[0], $$($nesting, 'IO'), $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/process"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $truthy = Opal.truthy; + + Opal.add_stubs(['$const_set', '$size', '$<<', '$__register_clock__', '$to_f', '$now', '$new', '$[]', '$raise']); + + (function($base, $super, $parent_nesting) { + function $Process(){}; + var self = $Process = $klass($base, $super, 'Process', $Process); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Process___register_clock___1, TMP_Process_pid_2, TMP_Process_times_3, TMP_Process_clock_gettime_4, monotonic = nil; + + + self.__clocks__ = []; + Opal.defs(self, '$__register_clock__', TMP_Process___register_clock___1 = function $$__register_clock__(name, func) { + var self = this; + if (self.__clocks__ == null) self.__clocks__ = nil; + + + self.$const_set(name, self.__clocks__.$size()); + return self.__clocks__['$<<'](func); + }, TMP_Process___register_clock___1.$$arity = 2); + self.$__register_clock__("CLOCK_REALTIME", function() { return Date.now() }); + monotonic = false; + + if (Opal.global.performance) { + monotonic = function() { + return performance.now() + }; + } + else if (Opal.global.process && process.hrtime) { + // let now be the base to get smaller numbers + var hrtime_base = process.hrtime(); + + monotonic = function() { + var hrtime = process.hrtime(hrtime_base); + var us = (hrtime[1] / 1000) | 0; // cut below microsecs; + return ((hrtime[0] * 1000) + (us / 1000)); + }; + } + ; + if ($truthy(monotonic)) { + self.$__register_clock__("CLOCK_MONOTONIC", monotonic)}; + Opal.defs(self, '$pid', TMP_Process_pid_2 = function $$pid() { + var self = this; + + return 0 + }, TMP_Process_pid_2.$$arity = 0); + Opal.defs(self, '$times', TMP_Process_times_3 = function $$times() { + var self = this, t = nil; + + + t = $$($nesting, 'Time').$now().$to_f(); + return $$$($$($nesting, 'Benchmark'), 'Tms').$new(t, t, t, t, t); + }, TMP_Process_times_3.$$arity = 0); + return (Opal.defs(self, '$clock_gettime', TMP_Process_clock_gettime_4 = function $$clock_gettime(clock_id, unit) { + var $a, self = this, clock = nil; + if (self.__clocks__ == null) self.__clocks__ = nil; + + + + if (unit == null) { + unit = "float_second"; + }; + ($truthy($a = (clock = self.__clocks__['$[]'](clock_id))) ? $a : self.$raise($$$($$($nesting, 'Errno'), 'EINVAL'), "" + "clock_gettime(" + (clock_id) + ") " + (self.__clocks__['$[]'](clock_id)))); + + var ms = clock(); + switch (unit) { + case 'float_second': return (ms / 1000); // number of seconds as a float (default) + case 'float_millisecond': return (ms / 1); // number of milliseconds as a float + case 'float_microsecond': return (ms * 1000); // number of microseconds as a float + case 'second': return ((ms / 1000) | 0); // number of seconds as an integer + case 'millisecond': return ((ms / 1) | 0); // number of milliseconds as an integer + case 'microsecond': return ((ms * 1000) | 0); // number of microseconds as an integer + case 'nanosecond': return ((ms * 1000000) | 0); // number of nanoseconds as an integer + default: self.$raise($$($nesting, 'ArgumentError'), "" + "unexpected unit: " + (unit)) + } + ; + }, TMP_Process_clock_gettime_4.$$arity = -2), nil) && 'clock_gettime'; + })($nesting[0], null, $nesting); + (function($base, $super, $parent_nesting) { + function $Signal(){}; + var self = $Signal = $klass($base, $super, 'Signal', $Signal); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Signal_trap_5; + + return (Opal.defs(self, '$trap', TMP_Signal_trap_5 = function $$trap($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return nil; + }, TMP_Signal_trap_5.$$arity = -1), nil) && 'trap' + })($nesting[0], null, $nesting); + return (function($base, $super, $parent_nesting) { + function $GC(){}; + var self = $GC = $klass($base, $super, 'GC', $GC); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_GC_start_6; + + return (Opal.defs(self, '$start', TMP_GC_start_6 = function $$start() { + var self = this; + + return nil + }, TMP_GC_start_6.$$arity = 0), nil) && 'start' + })($nesting[0], null, $nesting); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/random"] = function(Opal) { + function $rb_lt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $truthy = Opal.truthy, $send = Opal.send; + + Opal.add_stubs(['$attr_reader', '$new_seed', '$coerce_to!', '$reseed', '$rand', '$seed', '$<', '$raise', '$encode', '$join', '$new', '$chr', '$===', '$==', '$state', '$const_defined?', '$const_set']); + return (function($base, $super, $parent_nesting) { + function $Random(){}; + var self = $Random = $klass($base, $super, 'Random', $Random); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Random_initialize_1, TMP_Random_reseed_2, TMP_Random_new_seed_3, TMP_Random_rand_4, TMP_Random_srand_5, TMP_Random_urandom_6, TMP_Random_$eq$eq_8, TMP_Random_bytes_9, TMP_Random_rand_11, TMP_Random_generator$eq_12; + + + self.$attr_reader("seed", "state"); + + Opal.def(self, '$initialize', TMP_Random_initialize_1 = function $$initialize(seed) { + var self = this; + + + + if (seed == null) { + seed = $$($nesting, 'Random').$new_seed(); + }; + seed = $$($nesting, 'Opal')['$coerce_to!'](seed, $$($nesting, 'Integer'), "to_int"); + self.state = seed; + return self.$reseed(seed); + }, TMP_Random_initialize_1.$$arity = -1); + + Opal.def(self, '$reseed', TMP_Random_reseed_2 = function $$reseed(seed) { + var self = this; + + + self.seed = seed; + return self.$rng = Opal.$$rand.reseed(seed);; + }, TMP_Random_reseed_2.$$arity = 1); + Opal.defs(self, '$new_seed', TMP_Random_new_seed_3 = function $$new_seed() { + var self = this; + + return Opal.$$rand.new_seed(); + }, TMP_Random_new_seed_3.$$arity = 0); + Opal.defs(self, '$rand', TMP_Random_rand_4 = function $$rand(limit) { + var self = this; + + + ; + return $$($nesting, 'DEFAULT').$rand(limit); + }, TMP_Random_rand_4.$$arity = -1); + Opal.defs(self, '$srand', TMP_Random_srand_5 = function $$srand(n) { + var self = this, previous_seed = nil; + + + + if (n == null) { + n = $$($nesting, 'Random').$new_seed(); + }; + n = $$($nesting, 'Opal')['$coerce_to!'](n, $$($nesting, 'Integer'), "to_int"); + previous_seed = $$($nesting, 'DEFAULT').$seed(); + $$($nesting, 'DEFAULT').$reseed(n); + return previous_seed; + }, TMP_Random_srand_5.$$arity = -1); + Opal.defs(self, '$urandom', TMP_Random_urandom_6 = function $$urandom(size) { + var TMP_7, self = this; + + + size = $$($nesting, 'Opal')['$coerce_to!'](size, $$($nesting, 'Integer'), "to_int"); + if ($truthy($rb_lt(size, 0))) { + self.$raise($$($nesting, 'ArgumentError'), "negative string size (or size too big)")}; + return $send($$($nesting, 'Array'), 'new', [size], (TMP_7 = function(){var self = TMP_7.$$s || this; + + return self.$rand(255).$chr()}, TMP_7.$$s = self, TMP_7.$$arity = 0, TMP_7)).$join().$encode("ASCII-8BIT"); + }, TMP_Random_urandom_6.$$arity = 1); + + Opal.def(self, '$==', TMP_Random_$eq$eq_8 = function(other) { + var $a, self = this; + + + if ($truthy($$($nesting, 'Random')['$==='](other))) { + } else { + return false + }; + return (($a = self.$seed()['$=='](other.$seed())) ? self.$state()['$=='](other.$state()) : self.$seed()['$=='](other.$seed())); + }, TMP_Random_$eq$eq_8.$$arity = 1); + + Opal.def(self, '$bytes', TMP_Random_bytes_9 = function $$bytes(length) { + var TMP_10, self = this; + + + length = $$($nesting, 'Opal')['$coerce_to!'](length, $$($nesting, 'Integer'), "to_int"); + return $send($$($nesting, 'Array'), 'new', [length], (TMP_10 = function(){var self = TMP_10.$$s || this; + + return self.$rand(255).$chr()}, TMP_10.$$s = self, TMP_10.$$arity = 0, TMP_10)).$join().$encode("ASCII-8BIT"); + }, TMP_Random_bytes_9.$$arity = 1); + + Opal.def(self, '$rand', TMP_Random_rand_11 = function $$rand(limit) { + var self = this; + + + ; + + function randomFloat() { + self.state++; + return Opal.$$rand.rand(self.$rng); + } + + function randomInt() { + return Math.floor(randomFloat() * limit); + } + + function randomRange() { + var min = limit.begin, + max = limit.end; + + if (min === nil || max === nil) { + return nil; + } + + var length = max - min; + + if (length < 0) { + return nil; + } + + if (length === 0) { + return min; + } + + if (max % 1 === 0 && min % 1 === 0 && !limit.excl) { + length++; + } + + return self.$rand(length) + min; + } + + if (limit == null) { + return randomFloat(); + } else if (limit.$$is_range) { + return randomRange(); + } else if (limit.$$is_number) { + if (limit <= 0) { + self.$raise($$($nesting, 'ArgumentError'), "" + "invalid argument - " + (limit)) + } + + if (limit % 1 === 0) { + // integer + return randomInt(); + } else { + return randomFloat() * limit; + } + } else { + limit = $$($nesting, 'Opal')['$coerce_to!'](limit, $$($nesting, 'Integer'), "to_int"); + + if (limit <= 0) { + self.$raise($$($nesting, 'ArgumentError'), "" + "invalid argument - " + (limit)) + } + + return randomInt(); + } + ; + }, TMP_Random_rand_11.$$arity = -1); + return (Opal.defs(self, '$generator=', TMP_Random_generator$eq_12 = function(generator) { + var self = this; + + + Opal.$$rand = generator; + if ($truthy(self['$const_defined?']("DEFAULT"))) { + return $$($nesting, 'DEFAULT').$reseed() + } else { + return self.$const_set("DEFAULT", self.$new(self.$new_seed())) + }; + }, TMP_Random_generator$eq_12.$$arity = 1), nil) && 'generator='; + })($nesting[0], null, $nesting) +}; + +/* +This is based on an adaptation of Makoto Matsumoto and Takuji Nishimura's code +done by Sean McCullough and Dave Heitzman +, subsequently readapted from an updated version of +ruby's random.c (rev c38a183032a7826df1adabd8aa0725c713d53e1c). + +The original copyright notice from random.c follows. + + This is based on trimmed version of MT19937. To get the original version, + contact . + + The original copyright notice follows. + + A C-program for MT19937, with initialization improved 2002/2/10. + Coded by Takuji Nishimura and Makoto Matsumoto. + This is a faster version by taking Shawn Cokus's optimization, + Matthe Bellew's simplification, Isaku Wada's real version. + + Before using, initialize the state by using init_genrand(mt, seed) + or init_by_array(mt, init_key, key_length). + + Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura, + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + 3. The names of its contributors may not be used to endorse or promote + products derived from this software without specific prior written + permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + + Any feedback is very welcome. + http://www.math.keio.ac.jp/matumoto/emt.html + email: matumoto@math.keio.ac.jp +*/ +var MersenneTwister = (function() { + /* Period parameters */ + var N = 624; + var M = 397; + var MATRIX_A = 0x9908b0df; /* constant vector a */ + var UMASK = 0x80000000; /* most significant w-r bits */ + var LMASK = 0x7fffffff; /* least significant r bits */ + var MIXBITS = function(u,v) { return ( ((u) & UMASK) | ((v) & LMASK) ); }; + var TWIST = function(u,v) { return (MIXBITS((u),(v)) >>> 1) ^ ((v & 0x1) ? MATRIX_A : 0x0); }; + + function init(s) { + var mt = {left: 0, next: N, state: new Array(N)}; + init_genrand(mt, s); + return mt; + } + + /* initializes mt[N] with a seed */ + function init_genrand(mt, s) { + var j, i; + mt.state[0] = s >>> 0; + for (j=1; j> 30) >>> 0)) + j); + /* See Knuth TAOCP Vol2. 3rd Ed. P.106 for multiplier. */ + /* In the previous versions, MSBs of the seed affect */ + /* only MSBs of the array state[]. */ + /* 2002/01/09 modified by Makoto Matsumoto */ + mt.state[j] &= 0xffffffff; /* for >32 bit machines */ + } + mt.left = 1; + mt.next = N; + } + + /* generate N words at one time */ + function next_state(mt) { + var p = 0, _p = mt.state; + var j; + + mt.left = N; + mt.next = 0; + + for (j=N-M+1; --j; p++) + _p[p] = _p[p+(M)] ^ TWIST(_p[p+(0)], _p[p+(1)]); + + for (j=M; --j; p++) + _p[p] = _p[p+(M-N)] ^ TWIST(_p[p+(0)], _p[p+(1)]); + + _p[p] = _p[p+(M-N)] ^ TWIST(_p[p+(0)], _p[0]); + } + + /* generates a random number on [0,0xffffffff]-interval */ + function genrand_int32(mt) { + /* mt must be initialized */ + var y; + + if (--mt.left <= 0) next_state(mt); + y = mt.state[mt.next++]; + + /* Tempering */ + y ^= (y >>> 11); + y ^= (y << 7) & 0x9d2c5680; + y ^= (y << 15) & 0xefc60000; + y ^= (y >>> 18); + + return y >>> 0; + } + + function int_pair_to_real_exclusive(a, b) { + a >>>= 5; + b >>>= 6; + return(a*67108864.0+b)*(1.0/9007199254740992.0); + } + + // generates a random number on [0,1) with 53-bit resolution + function genrand_real(mt) { + /* mt must be initialized */ + var a = genrand_int32(mt), b = genrand_int32(mt); + return int_pair_to_real_exclusive(a, b); + } + + return { genrand_real: genrand_real, init: init }; +})(); +Opal.loaded(["corelib/random/MersenneTwister.js"]); +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/random/mersenne_twister"] = function(Opal) { + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $send = Opal.send; + + Opal.add_stubs(['$require', '$generator=', '$-']); + + self.$require("corelib/random/MersenneTwister"); + return (function($base, $super, $parent_nesting) { + function $Random(){}; + var self = $Random = $klass($base, $super, 'Random', $Random); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), $writer = nil; + + + var MAX_INT = Number.MAX_SAFE_INTEGER || Math.pow(2, 53) - 1; + Opal.const_set($nesting[0], 'MERSENNE_TWISTER_GENERATOR', { + new_seed: function() { return Math.round(Math.random() * MAX_INT); }, + reseed: function(seed) { return MersenneTwister.init(seed); }, + rand: function(mt) { return MersenneTwister.genrand_real(mt); } + }); + + $writer = [$$($nesting, 'MERSENNE_TWISTER_GENERATOR')]; + $send(self, 'generator=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];; + })($nesting[0], null, $nesting); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/unsupported"] = function(Opal) { + var TMP_public_35, TMP_private_36, self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $module = Opal.module; + + Opal.add_stubs(['$raise', '$warn', '$%']); + + + var warnings = {}; + + function handle_unsupported_feature(message) { + switch (Opal.config.unsupported_features_severity) { + case 'error': + $$($nesting, 'Kernel').$raise($$($nesting, 'NotImplementedError'), message) + break; + case 'warning': + warn(message) + break; + default: // ignore + // noop + } + } + + function warn(string) { + if (warnings[string]) { + return; + } + + warnings[string] = true; + self.$warn(string); + } +; + (function($base, $super, $parent_nesting) { + function $String(){}; + var self = $String = $klass($base, $super, 'String', $String); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_String_$lt$lt_1, TMP_String_capitalize$B_2, TMP_String_chomp$B_3, TMP_String_chop$B_4, TMP_String_downcase$B_5, TMP_String_gsub$B_6, TMP_String_lstrip$B_7, TMP_String_next$B_8, TMP_String_reverse$B_9, TMP_String_slice$B_10, TMP_String_squeeze$B_11, TMP_String_strip$B_12, TMP_String_sub$B_13, TMP_String_succ$B_14, TMP_String_swapcase$B_15, TMP_String_tr$B_16, TMP_String_tr_s$B_17, TMP_String_upcase$B_18, TMP_String_prepend_19, TMP_String_$$$eq_20, TMP_String_clear_21, TMP_String_encode$B_22, TMP_String_unicode_normalize$B_23; + + + var ERROR = "String#%s not supported. Mutable String methods are not supported in Opal."; + + Opal.def(self, '$<<', TMP_String_$lt$lt_1 = function($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return self.$raise($$($nesting, 'NotImplementedError'), (ERROR)['$%']("<<")); + }, TMP_String_$lt$lt_1.$$arity = -1); + + Opal.def(self, '$capitalize!', TMP_String_capitalize$B_2 = function($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return self.$raise($$($nesting, 'NotImplementedError'), (ERROR)['$%']("capitalize!")); + }, TMP_String_capitalize$B_2.$$arity = -1); + + Opal.def(self, '$chomp!', TMP_String_chomp$B_3 = function($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return self.$raise($$($nesting, 'NotImplementedError'), (ERROR)['$%']("chomp!")); + }, TMP_String_chomp$B_3.$$arity = -1); + + Opal.def(self, '$chop!', TMP_String_chop$B_4 = function($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return self.$raise($$($nesting, 'NotImplementedError'), (ERROR)['$%']("chop!")); + }, TMP_String_chop$B_4.$$arity = -1); + + Opal.def(self, '$downcase!', TMP_String_downcase$B_5 = function($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return self.$raise($$($nesting, 'NotImplementedError'), (ERROR)['$%']("downcase!")); + }, TMP_String_downcase$B_5.$$arity = -1); + + Opal.def(self, '$gsub!', TMP_String_gsub$B_6 = function($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return self.$raise($$($nesting, 'NotImplementedError'), (ERROR)['$%']("gsub!")); + }, TMP_String_gsub$B_6.$$arity = -1); + + Opal.def(self, '$lstrip!', TMP_String_lstrip$B_7 = function($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return self.$raise($$($nesting, 'NotImplementedError'), (ERROR)['$%']("lstrip!")); + }, TMP_String_lstrip$B_7.$$arity = -1); + + Opal.def(self, '$next!', TMP_String_next$B_8 = function($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return self.$raise($$($nesting, 'NotImplementedError'), (ERROR)['$%']("next!")); + }, TMP_String_next$B_8.$$arity = -1); + + Opal.def(self, '$reverse!', TMP_String_reverse$B_9 = function($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return self.$raise($$($nesting, 'NotImplementedError'), (ERROR)['$%']("reverse!")); + }, TMP_String_reverse$B_9.$$arity = -1); + + Opal.def(self, '$slice!', TMP_String_slice$B_10 = function($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return self.$raise($$($nesting, 'NotImplementedError'), (ERROR)['$%']("slice!")); + }, TMP_String_slice$B_10.$$arity = -1); + + Opal.def(self, '$squeeze!', TMP_String_squeeze$B_11 = function($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return self.$raise($$($nesting, 'NotImplementedError'), (ERROR)['$%']("squeeze!")); + }, TMP_String_squeeze$B_11.$$arity = -1); + + Opal.def(self, '$strip!', TMP_String_strip$B_12 = function($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return self.$raise($$($nesting, 'NotImplementedError'), (ERROR)['$%']("strip!")); + }, TMP_String_strip$B_12.$$arity = -1); + + Opal.def(self, '$sub!', TMP_String_sub$B_13 = function($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return self.$raise($$($nesting, 'NotImplementedError'), (ERROR)['$%']("sub!")); + }, TMP_String_sub$B_13.$$arity = -1); + + Opal.def(self, '$succ!', TMP_String_succ$B_14 = function($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return self.$raise($$($nesting, 'NotImplementedError'), (ERROR)['$%']("succ!")); + }, TMP_String_succ$B_14.$$arity = -1); + + Opal.def(self, '$swapcase!', TMP_String_swapcase$B_15 = function($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return self.$raise($$($nesting, 'NotImplementedError'), (ERROR)['$%']("swapcase!")); + }, TMP_String_swapcase$B_15.$$arity = -1); + + Opal.def(self, '$tr!', TMP_String_tr$B_16 = function($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return self.$raise($$($nesting, 'NotImplementedError'), (ERROR)['$%']("tr!")); + }, TMP_String_tr$B_16.$$arity = -1); + + Opal.def(self, '$tr_s!', TMP_String_tr_s$B_17 = function($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return self.$raise($$($nesting, 'NotImplementedError'), (ERROR)['$%']("tr_s!")); + }, TMP_String_tr_s$B_17.$$arity = -1); + + Opal.def(self, '$upcase!', TMP_String_upcase$B_18 = function($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return self.$raise($$($nesting, 'NotImplementedError'), (ERROR)['$%']("upcase!")); + }, TMP_String_upcase$B_18.$$arity = -1); + + Opal.def(self, '$prepend', TMP_String_prepend_19 = function $$prepend($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return self.$raise($$($nesting, 'NotImplementedError'), (ERROR)['$%']("prepend")); + }, TMP_String_prepend_19.$$arity = -1); + + Opal.def(self, '$[]=', TMP_String_$$$eq_20 = function($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return self.$raise($$($nesting, 'NotImplementedError'), (ERROR)['$%']("[]=")); + }, TMP_String_$$$eq_20.$$arity = -1); + + Opal.def(self, '$clear', TMP_String_clear_21 = function $$clear($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return self.$raise($$($nesting, 'NotImplementedError'), (ERROR)['$%']("clear")); + }, TMP_String_clear_21.$$arity = -1); + + Opal.def(self, '$encode!', TMP_String_encode$B_22 = function($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return self.$raise($$($nesting, 'NotImplementedError'), (ERROR)['$%']("encode!")); + }, TMP_String_encode$B_22.$$arity = -1); + return (Opal.def(self, '$unicode_normalize!', TMP_String_unicode_normalize$B_23 = function($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return self.$raise($$($nesting, 'NotImplementedError'), (ERROR)['$%']("unicode_normalize!")); + }, TMP_String_unicode_normalize$B_23.$$arity = -1), nil) && 'unicode_normalize!'; + })($nesting[0], null, $nesting); + (function($base, $parent_nesting) { + function $Kernel() {}; + var self = $Kernel = $module($base, 'Kernel', $Kernel); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Kernel_freeze_24, TMP_Kernel_frozen$q_25; + + + var ERROR = "Object freezing is not supported by Opal"; + + Opal.def(self, '$freeze', TMP_Kernel_freeze_24 = function $$freeze() { + var self = this; + + + handle_unsupported_feature(ERROR); + return self; + }, TMP_Kernel_freeze_24.$$arity = 0); + + Opal.def(self, '$frozen?', TMP_Kernel_frozen$q_25 = function() { + var self = this; + + + handle_unsupported_feature(ERROR); + return false; + }, TMP_Kernel_frozen$q_25.$$arity = 0); + })($nesting[0], $nesting); + (function($base, $parent_nesting) { + function $Kernel() {}; + var self = $Kernel = $module($base, 'Kernel', $Kernel); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Kernel_taint_26, TMP_Kernel_untaint_27, TMP_Kernel_tainted$q_28; + + + var ERROR = "Object tainting is not supported by Opal"; + + Opal.def(self, '$taint', TMP_Kernel_taint_26 = function $$taint() { + var self = this; + + + handle_unsupported_feature(ERROR); + return self; + }, TMP_Kernel_taint_26.$$arity = 0); + + Opal.def(self, '$untaint', TMP_Kernel_untaint_27 = function $$untaint() { + var self = this; + + + handle_unsupported_feature(ERROR); + return self; + }, TMP_Kernel_untaint_27.$$arity = 0); + + Opal.def(self, '$tainted?', TMP_Kernel_tainted$q_28 = function() { + var self = this; + + + handle_unsupported_feature(ERROR); + return false; + }, TMP_Kernel_tainted$q_28.$$arity = 0); + })($nesting[0], $nesting); + (function($base, $super, $parent_nesting) { + function $Module(){}; + var self = $Module = $klass($base, $super, 'Module', $Module); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Module_public_29, TMP_Module_private_class_method_30, TMP_Module_private_method_defined$q_31, TMP_Module_private_constant_32; + + + + Opal.def(self, '$public', TMP_Module_public_29 = function($a) { + var $post_args, methods, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + methods = $post_args;; + + if (methods.length === 0) { + self.$$module_function = false; + } + + return nil; + ; + }, TMP_Module_public_29.$$arity = -1); + Opal.alias(self, "private", "public"); + Opal.alias(self, "protected", "public"); + Opal.alias(self, "nesting", "public"); + + Opal.def(self, '$private_class_method', TMP_Module_private_class_method_30 = function $$private_class_method($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return self; + }, TMP_Module_private_class_method_30.$$arity = -1); + Opal.alias(self, "public_class_method", "private_class_method"); + + Opal.def(self, '$private_method_defined?', TMP_Module_private_method_defined$q_31 = function(obj) { + var self = this; + + return false + }, TMP_Module_private_method_defined$q_31.$$arity = 1); + + Opal.def(self, '$private_constant', TMP_Module_private_constant_32 = function $$private_constant($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return nil; + }, TMP_Module_private_constant_32.$$arity = -1); + Opal.alias(self, "protected_method_defined?", "private_method_defined?"); + Opal.alias(self, "public_instance_methods", "instance_methods"); + Opal.alias(self, "public_instance_method", "instance_method"); + return Opal.alias(self, "public_method_defined?", "method_defined?"); + })($nesting[0], null, $nesting); + (function($base, $parent_nesting) { + function $Kernel() {}; + var self = $Kernel = $module($base, 'Kernel', $Kernel); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Kernel_private_methods_33; + + + + Opal.def(self, '$private_methods', TMP_Kernel_private_methods_33 = function $$private_methods($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return []; + }, TMP_Kernel_private_methods_33.$$arity = -1); + Opal.alias(self, "private_instance_methods", "private_methods"); + })($nesting[0], $nesting); + (function($base, $parent_nesting) { + function $Kernel() {}; + var self = $Kernel = $module($base, 'Kernel', $Kernel); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Kernel_eval_34; + + + Opal.def(self, '$eval', TMP_Kernel_eval_34 = function($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return self.$raise($$($nesting, 'NotImplementedError'), "" + "To use Kernel#eval, you must first require 'opal-parser'. " + ("" + "See https://github.com/opal/opal/blob/" + ($$($nesting, 'RUBY_ENGINE_VERSION')) + "/docs/opal_parser.md for details.")); + }, TMP_Kernel_eval_34.$$arity = -1) + })($nesting[0], $nesting); + Opal.defs(self, '$public', TMP_public_35 = function($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return nil; + }, TMP_public_35.$$arity = -1); + return (Opal.defs(self, '$private', TMP_private_36 = function($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return nil; + }, TMP_private_36.$$arity = -1), nil) && 'private'; +}; + +/* Generated by Opal 0.11.99.dev */ +(function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice; + + Opal.add_stubs(['$require']); + + self.$require("opal/base"); + self.$require("opal/mini"); + self.$require("corelib/string/encoding"); + self.$require("corelib/math"); + self.$require("corelib/complex"); + self.$require("corelib/rational"); + self.$require("corelib/time"); + self.$require("corelib/struct"); + self.$require("corelib/io"); + self.$require("corelib/main"); + self.$require("corelib/dir"); + self.$require("corelib/file"); + self.$require("corelib/process"); + self.$require("corelib/random"); + self.$require("corelib/random/mersenne_twister.js"); + return self.$require("corelib/unsupported"); +})(Opal); + + +// Nashorn Module +(function (root, factory) { + // globals (root is window) + root.Asciidoctor = factory; +// eslint-disable-next-line no-unused-vars +}(this, function (moduleConfig) { +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/js/opal_ext/nashorn/io"] = function(Opal) { + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $send = Opal.send, $gvars = Opal.gvars, $writer = nil; + if ($gvars.stdout == null) $gvars.stdout = nil; + if ($gvars.stderr == null) $gvars.stderr = nil; + + Opal.add_stubs(['$write_proc=', '$-']); + + + $writer = [function(s){print(s)}]; + $send($gvars.stdout, 'write_proc=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = [function(s){print(s)}]; + $send($gvars.stderr, 'write_proc=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];; +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/js/opal_ext/nashorn/dir"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass; + + return (function($base, $super, $parent_nesting) { + function $Dir(){}; + var self = $Dir = $klass($base, $super, 'Dir', $Dir); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return (function(self, $parent_nesting) { + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_pwd_1; + + + + Opal.def(self, '$pwd', TMP_pwd_1 = function $$pwd() { + var self = this; + + return Java.type("java.nio.file.Paths").get("").toAbsolutePath().toString(); + }, TMP_pwd_1.$$arity = 0); + return Opal.alias(self, "getwd", "pwd"); + })(Opal.get_singleton_class(self), $nesting) + })($nesting[0], null, $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/js/opal_ext/nashorn/file"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass; + + return (function($base, $super, $parent_nesting) { + function $File(){}; + var self = $File = $klass($base, $super, 'File', $File); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_File_read_1; + + return (Opal.defs(self, '$read', TMP_File_read_1 = function $$read(path) { + var self = this; + + + var Paths = Java.type('java.nio.file.Paths'); + var Files = Java.type('java.nio.file.Files'); + var lines = Files.readAllLines(Paths.get(path), Java.type('java.nio.charset.StandardCharsets').UTF_8); + var data = []; + lines.forEach(function(line) { data.push(line); }); + return data.join("\n"); + + }, TMP_File_read_1.$$arity = 1), nil) && 'read' + })($nesting[0], null, $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/js/opal_ext/nashorn"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice; + + Opal.add_stubs(['$require']); + + + var platform, engine, framework, ioModule; + + if (typeof moduleConfig === 'object' && typeof moduleConfig.runtime === 'object') { + var runtime = moduleConfig.runtime; + platform = runtime.platform; + engine = runtime.engine; + framework = runtime.framework; + ioModule = runtime.ioModule; + } + ioModule = ioModule || 'java_nio'; + platform = platform || 'java'; + engine = engine || 'nashorn'; + framework = framework || ''; +; + Opal.const_set($nesting[0], 'JAVASCRIPT_IO_MODULE', ioModule); + Opal.const_set($nesting[0], 'JAVASCRIPT_PLATFORM', platform); + Opal.const_set($nesting[0], 'JAVASCRIPT_ENGINE', engine); + Opal.const_set($nesting[0], 'JAVASCRIPT_FRAMEWORK', framework); + self.$require("asciidoctor/js/opal_ext/nashorn/io"); + self.$require("asciidoctor/js/opal_ext/nashorn/dir"); + return self.$require("asciidoctor/js/opal_ext/nashorn/file"); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["set"] = function(Opal) { + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + function $rb_lt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); + } + function $rb_le(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs <= rhs : lhs['$<='](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $hash2 = Opal.hash2, $truthy = Opal.truthy, $send = Opal.send, $module = Opal.module; + + Opal.add_stubs(['$include', '$new', '$nil?', '$===', '$raise', '$each', '$add', '$merge', '$class', '$respond_to?', '$subtract', '$dup', '$join', '$to_a', '$equal?', '$instance_of?', '$==', '$instance_variable_get', '$is_a?', '$size', '$all?', '$include?', '$[]=', '$-', '$enum_for', '$[]', '$<<', '$replace', '$delete', '$select', '$each_key', '$to_proc', '$empty?', '$eql?', '$instance_eval', '$clear', '$<', '$<=', '$keys']); + + (function($base, $super, $parent_nesting) { + function $Set(){}; + var self = $Set = $klass($base, $super, 'Set', $Set); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Set_$$_1, TMP_Set_initialize_2, TMP_Set_dup_4, TMP_Set_$_5, TMP_Set_inspect_6, TMP_Set_$eq$eq_7, TMP_Set_add_9, TMP_Set_classify_10, TMP_Set_collect$B_13, TMP_Set_delete_15, TMP_Set_delete$q_16, TMP_Set_delete_if_17, TMP_Set_add$q_20, TMP_Set_each_21, TMP_Set_empty$q_22, TMP_Set_eql$q_23, TMP_Set_clear_25, TMP_Set_include$q_26, TMP_Set_merge_27, TMP_Set_replace_29, TMP_Set_size_30, TMP_Set_subtract_31, TMP_Set_$_33, TMP_Set_superset$q_34, TMP_Set_proper_superset$q_36, TMP_Set_subset$q_38, TMP_Set_proper_subset$q_40, TMP_Set_to_a_42; + + def.hash = nil; + + self.$include($$($nesting, 'Enumerable')); + Opal.defs(self, '$[]', TMP_Set_$$_1 = function($a) { + var $post_args, ary, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + ary = $post_args;; + return self.$new(ary); + }, TMP_Set_$$_1.$$arity = -1); + + Opal.def(self, '$initialize', TMP_Set_initialize_2 = function $$initialize(enum$) { + var $iter = TMP_Set_initialize_2.$$p, block = $iter || nil, TMP_3, self = this; + + if ($iter) TMP_Set_initialize_2.$$p = null; + + + if ($iter) TMP_Set_initialize_2.$$p = null;; + + if (enum$ == null) { + enum$ = nil; + }; + self.hash = $hash2([], {}); + if ($truthy(enum$['$nil?']())) { + return nil}; + if ($truthy($$($nesting, 'Enumerable')['$==='](enum$))) { + } else { + self.$raise($$($nesting, 'ArgumentError'), "value must be enumerable") + }; + if ($truthy(block)) { + return $send(enum$, 'each', [], (TMP_3 = function(item){var self = TMP_3.$$s || this; + + + + if (item == null) { + item = nil; + }; + return self.$add(Opal.yield1(block, item));}, TMP_3.$$s = self, TMP_3.$$arity = 1, TMP_3)) + } else { + return self.$merge(enum$) + }; + }, TMP_Set_initialize_2.$$arity = -1); + + Opal.def(self, '$dup', TMP_Set_dup_4 = function $$dup() { + var self = this, result = nil; + + + result = self.$class().$new(); + return result.$merge(self); + }, TMP_Set_dup_4.$$arity = 0); + + Opal.def(self, '$-', TMP_Set_$_5 = function(enum$) { + var self = this; + + + if ($truthy(enum$['$respond_to?']("each"))) { + } else { + self.$raise($$($nesting, 'ArgumentError'), "value must be enumerable") + }; + return self.$dup().$subtract(enum$); + }, TMP_Set_$_5.$$arity = 1); + Opal.alias(self, "difference", "-"); + + Opal.def(self, '$inspect', TMP_Set_inspect_6 = function $$inspect() { + var self = this; + + return "" + "#" + }, TMP_Set_inspect_6.$$arity = 0); + + Opal.def(self, '$==', TMP_Set_$eq$eq_7 = function(other) { + var $a, TMP_8, self = this; + + if ($truthy(self['$equal?'](other))) { + return true + } else if ($truthy(other['$instance_of?'](self.$class()))) { + return self.hash['$=='](other.$instance_variable_get("@hash")) + } else if ($truthy(($truthy($a = other['$is_a?']($$($nesting, 'Set'))) ? self.$size()['$=='](other.$size()) : $a))) { + return $send(other, 'all?', [], (TMP_8 = function(o){var self = TMP_8.$$s || this; + if (self.hash == null) self.hash = nil; + + + + if (o == null) { + o = nil; + }; + return self.hash['$include?'](o);}, TMP_8.$$s = self, TMP_8.$$arity = 1, TMP_8)) + } else { + return false + } + }, TMP_Set_$eq$eq_7.$$arity = 1); + + Opal.def(self, '$add', TMP_Set_add_9 = function $$add(o) { + var self = this, $writer = nil; + + + + $writer = [o, true]; + $send(self.hash, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + return self; + }, TMP_Set_add_9.$$arity = 1); + Opal.alias(self, "<<", "add"); + + Opal.def(self, '$classify', TMP_Set_classify_10 = function $$classify() { + var $iter = TMP_Set_classify_10.$$p, block = $iter || nil, TMP_11, TMP_12, self = this, result = nil; + + if ($iter) TMP_Set_classify_10.$$p = null; + + + if ($iter) TMP_Set_classify_10.$$p = null;; + if ((block !== nil)) { + } else { + return self.$enum_for("classify") + }; + result = $send($$($nesting, 'Hash'), 'new', [], (TMP_11 = function(h, k){var self = TMP_11.$$s || this, $writer = nil; + + + + if (h == null) { + h = nil; + }; + + if (k == null) { + k = nil; + }; + $writer = [k, self.$class().$new()]; + $send(h, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];}, TMP_11.$$s = self, TMP_11.$$arity = 2, TMP_11)); + $send(self, 'each', [], (TMP_12 = function(item){var self = TMP_12.$$s || this; + + + + if (item == null) { + item = nil; + }; + return result['$[]'](Opal.yield1(block, item)).$add(item);}, TMP_12.$$s = self, TMP_12.$$arity = 1, TMP_12)); + return result; + }, TMP_Set_classify_10.$$arity = 0); + + Opal.def(self, '$collect!', TMP_Set_collect$B_13 = function() { + var $iter = TMP_Set_collect$B_13.$$p, block = $iter || nil, TMP_14, self = this, result = nil; + + if ($iter) TMP_Set_collect$B_13.$$p = null; + + + if ($iter) TMP_Set_collect$B_13.$$p = null;; + if ((block !== nil)) { + } else { + return self.$enum_for("collect!") + }; + result = self.$class().$new(); + $send(self, 'each', [], (TMP_14 = function(item){var self = TMP_14.$$s || this; + + + + if (item == null) { + item = nil; + }; + return result['$<<'](Opal.yield1(block, item));}, TMP_14.$$s = self, TMP_14.$$arity = 1, TMP_14)); + return self.$replace(result); + }, TMP_Set_collect$B_13.$$arity = 0); + Opal.alias(self, "map!", "collect!"); + + Opal.def(self, '$delete', TMP_Set_delete_15 = function(o) { + var self = this; + + + self.hash.$delete(o); + return self; + }, TMP_Set_delete_15.$$arity = 1); + + Opal.def(self, '$delete?', TMP_Set_delete$q_16 = function(o) { + var self = this; + + if ($truthy(self['$include?'](o))) { + + self.$delete(o); + return self; + } else { + return nil + } + }, TMP_Set_delete$q_16.$$arity = 1); + + Opal.def(self, '$delete_if', TMP_Set_delete_if_17 = function $$delete_if() { + var TMP_18, TMP_19, $iter = TMP_Set_delete_if_17.$$p, $yield = $iter || nil, self = this; + + if ($iter) TMP_Set_delete_if_17.$$p = null; + + if (($yield !== nil)) { + } else { + return self.$enum_for("delete_if") + }; + $send($send(self, 'select', [], (TMP_18 = function(o){var self = TMP_18.$$s || this; + + + + if (o == null) { + o = nil; + }; + return Opal.yield1($yield, o);;}, TMP_18.$$s = self, TMP_18.$$arity = 1, TMP_18)), 'each', [], (TMP_19 = function(o){var self = TMP_19.$$s || this; + if (self.hash == null) self.hash = nil; + + + + if (o == null) { + o = nil; + }; + return self.hash.$delete(o);}, TMP_19.$$s = self, TMP_19.$$arity = 1, TMP_19)); + return self; + }, TMP_Set_delete_if_17.$$arity = 0); + + Opal.def(self, '$add?', TMP_Set_add$q_20 = function(o) { + var self = this; + + if ($truthy(self['$include?'](o))) { + return nil + } else { + return self.$add(o) + } + }, TMP_Set_add$q_20.$$arity = 1); + + Opal.def(self, '$each', TMP_Set_each_21 = function $$each() { + var $iter = TMP_Set_each_21.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Set_each_21.$$p = null; + + + if ($iter) TMP_Set_each_21.$$p = null;; + if ((block !== nil)) { + } else { + return self.$enum_for("each") + }; + $send(self.hash, 'each_key', [], block.$to_proc()); + return self; + }, TMP_Set_each_21.$$arity = 0); + + Opal.def(self, '$empty?', TMP_Set_empty$q_22 = function() { + var self = this; + + return self.hash['$empty?']() + }, TMP_Set_empty$q_22.$$arity = 0); + + Opal.def(self, '$eql?', TMP_Set_eql$q_23 = function(other) { + var TMP_24, self = this; + + return self.hash['$eql?']($send(other, 'instance_eval', [], (TMP_24 = function(){var self = TMP_24.$$s || this; + if (self.hash == null) self.hash = nil; + + return self.hash}, TMP_24.$$s = self, TMP_24.$$arity = 0, TMP_24))) + }, TMP_Set_eql$q_23.$$arity = 1); + + Opal.def(self, '$clear', TMP_Set_clear_25 = function $$clear() { + var self = this; + + + self.hash.$clear(); + return self; + }, TMP_Set_clear_25.$$arity = 0); + + Opal.def(self, '$include?', TMP_Set_include$q_26 = function(o) { + var self = this; + + return self.hash['$include?'](o) + }, TMP_Set_include$q_26.$$arity = 1); + Opal.alias(self, "member?", "include?"); + + Opal.def(self, '$merge', TMP_Set_merge_27 = function $$merge(enum$) { + var TMP_28, self = this; + + + $send(enum$, 'each', [], (TMP_28 = function(item){var self = TMP_28.$$s || this; + + + + if (item == null) { + item = nil; + }; + return self.$add(item);}, TMP_28.$$s = self, TMP_28.$$arity = 1, TMP_28)); + return self; + }, TMP_Set_merge_27.$$arity = 1); + + Opal.def(self, '$replace', TMP_Set_replace_29 = function $$replace(enum$) { + var self = this; + + + self.$clear(); + self.$merge(enum$); + return self; + }, TMP_Set_replace_29.$$arity = 1); + + Opal.def(self, '$size', TMP_Set_size_30 = function $$size() { + var self = this; + + return self.hash.$size() + }, TMP_Set_size_30.$$arity = 0); + Opal.alias(self, "length", "size"); + + Opal.def(self, '$subtract', TMP_Set_subtract_31 = function $$subtract(enum$) { + var TMP_32, self = this; + + + $send(enum$, 'each', [], (TMP_32 = function(item){var self = TMP_32.$$s || this; + + + + if (item == null) { + item = nil; + }; + return self.$delete(item);}, TMP_32.$$s = self, TMP_32.$$arity = 1, TMP_32)); + return self; + }, TMP_Set_subtract_31.$$arity = 1); + + Opal.def(self, '$|', TMP_Set_$_33 = function(enum$) { + var self = this; + + + if ($truthy(enum$['$respond_to?']("each"))) { + } else { + self.$raise($$($nesting, 'ArgumentError'), "value must be enumerable") + }; + return self.$dup().$merge(enum$); + }, TMP_Set_$_33.$$arity = 1); + + Opal.def(self, '$superset?', TMP_Set_superset$q_34 = function(set) { + var $a, TMP_35, self = this; + + + ($truthy($a = set['$is_a?']($$($nesting, 'Set'))) ? $a : self.$raise($$($nesting, 'ArgumentError'), "value must be a set")); + if ($truthy($rb_lt(self.$size(), set.$size()))) { + return false}; + return $send(set, 'all?', [], (TMP_35 = function(o){var self = TMP_35.$$s || this; + + + + if (o == null) { + o = nil; + }; + return self['$include?'](o);}, TMP_35.$$s = self, TMP_35.$$arity = 1, TMP_35)); + }, TMP_Set_superset$q_34.$$arity = 1); + Opal.alias(self, ">=", "superset?"); + + Opal.def(self, '$proper_superset?', TMP_Set_proper_superset$q_36 = function(set) { + var $a, TMP_37, self = this; + + + ($truthy($a = set['$is_a?']($$($nesting, 'Set'))) ? $a : self.$raise($$($nesting, 'ArgumentError'), "value must be a set")); + if ($truthy($rb_le(self.$size(), set.$size()))) { + return false}; + return $send(set, 'all?', [], (TMP_37 = function(o){var self = TMP_37.$$s || this; + + + + if (o == null) { + o = nil; + }; + return self['$include?'](o);}, TMP_37.$$s = self, TMP_37.$$arity = 1, TMP_37)); + }, TMP_Set_proper_superset$q_36.$$arity = 1); + Opal.alias(self, ">", "proper_superset?"); + + Opal.def(self, '$subset?', TMP_Set_subset$q_38 = function(set) { + var $a, TMP_39, self = this; + + + ($truthy($a = set['$is_a?']($$($nesting, 'Set'))) ? $a : self.$raise($$($nesting, 'ArgumentError'), "value must be a set")); + if ($truthy($rb_lt(set.$size(), self.$size()))) { + return false}; + return $send(self, 'all?', [], (TMP_39 = function(o){var self = TMP_39.$$s || this; + + + + if (o == null) { + o = nil; + }; + return set['$include?'](o);}, TMP_39.$$s = self, TMP_39.$$arity = 1, TMP_39)); + }, TMP_Set_subset$q_38.$$arity = 1); + Opal.alias(self, "<=", "subset?"); + + Opal.def(self, '$proper_subset?', TMP_Set_proper_subset$q_40 = function(set) { + var $a, TMP_41, self = this; + + + ($truthy($a = set['$is_a?']($$($nesting, 'Set'))) ? $a : self.$raise($$($nesting, 'ArgumentError'), "value must be a set")); + if ($truthy($rb_le(set.$size(), self.$size()))) { + return false}; + return $send(self, 'all?', [], (TMP_41 = function(o){var self = TMP_41.$$s || this; + + + + if (o == null) { + o = nil; + }; + return set['$include?'](o);}, TMP_41.$$s = self, TMP_41.$$arity = 1, TMP_41)); + }, TMP_Set_proper_subset$q_40.$$arity = 1); + Opal.alias(self, "<", "proper_subset?"); + Opal.alias(self, "+", "|"); + Opal.alias(self, "union", "|"); + return (Opal.def(self, '$to_a', TMP_Set_to_a_42 = function $$to_a() { + var self = this; + + return self.hash.$keys() + }, TMP_Set_to_a_42.$$arity = 0), nil) && 'to_a'; + })($nesting[0], null, $nesting); + return (function($base, $parent_nesting) { + function $Enumerable() {}; + var self = $Enumerable = $module($base, 'Enumerable', $Enumerable); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Enumerable_to_set_43; + + + Opal.def(self, '$to_set', TMP_Enumerable_to_set_43 = function $$to_set($a, $b) { + var $iter = TMP_Enumerable_to_set_43.$$p, block = $iter || nil, $post_args, klass, args, self = this; + + if ($iter) TMP_Enumerable_to_set_43.$$p = null; + + + if ($iter) TMP_Enumerable_to_set_43.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + if ($post_args.length > 0) { + klass = $post_args[0]; + $post_args.splice(0, 1); + } + if (klass == null) { + klass = $$($nesting, 'Set'); + }; + + args = $post_args;; + return $send(klass, 'new', [self].concat(Opal.to_a(args)), block.$to_proc()); + }, TMP_Enumerable_to_set_43.$$arity = -1) + })($nesting[0], $nesting); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/js/opal_ext/file"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $send = Opal.send, $klass = Opal.klass, $truthy = Opal.truthy, $gvars = Opal.gvars; + + Opal.add_stubs(['$new', '$attr_reader', '$delete', '$gsub', '$read', '$size', '$to_enum', '$chomp', '$each_line', '$readlines', '$split']); + + (function($base, $parent_nesting) { + function $Kernel() {}; + var self = $Kernel = $module($base, 'Kernel', $Kernel); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Kernel_open_1; + + + Opal.def(self, '$open', TMP_Kernel_open_1 = function $$open(path, $a) { + var $post_args, rest, $iter = TMP_Kernel_open_1.$$p, $yield = $iter || nil, self = this, file = nil; + + if ($iter) TMP_Kernel_open_1.$$p = null; + + + $post_args = Opal.slice.call(arguments, 1, arguments.length); + + rest = $post_args;; + file = $send($$($nesting, 'File'), 'new', [path].concat(Opal.to_a(rest))); + if (($yield !== nil)) { + return Opal.yield1($yield, file); + } else { + return file + }; + }, TMP_Kernel_open_1.$$arity = -2) + })($nesting[0], $nesting); + (function($base, $super, $parent_nesting) { + function $File(){}; + var self = $File = $klass($base, $super, 'File', $File); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_File_initialize_2, TMP_File_read_3, TMP_File_each_line_4, TMP_File_readlines_5; + + def.eof = def.path = nil; + + self.$attr_reader("eof"); + self.$attr_reader("lineno"); + self.$attr_reader("path"); + + Opal.def(self, '$initialize', TMP_File_initialize_2 = function $$initialize(path, flags) { + var self = this, encoding_flag_regexp = nil; + + + + if (flags == null) { + flags = "r"; + }; + self.path = path; + self.contents = nil; + self.eof = false; + self.lineno = 0; + flags = flags.$delete("b"); + encoding_flag_regexp = /:(.*)/; + flags = flags.$gsub(encoding_flag_regexp, ""); + return (self.flags = flags); + }, TMP_File_initialize_2.$$arity = -2); + + Opal.def(self, '$read', TMP_File_read_3 = function $$read() { + var self = this, res = nil; + + if ($truthy(self.eof)) { + return "" + } else { + + res = $$($nesting, 'File').$read(self.path); + self.eof = true; + self.lineno = res.$size(); + return res; + } + }, TMP_File_read_3.$$arity = 0); + + Opal.def(self, '$each_line', TMP_File_each_line_4 = function $$each_line(separator) { + var $iter = TMP_File_each_line_4.$$p, block = $iter || nil, self = this, lines = nil; + if ($gvars["/"] == null) $gvars["/"] = nil; + + if ($iter) TMP_File_each_line_4.$$p = null; + + + if ($iter) TMP_File_each_line_4.$$p = null;; + + if (separator == null) { + separator = $gvars["/"]; + }; + if ($truthy(self.eof)) { + return (function() {if ((block !== nil)) { + return self + } else { + return [].$to_enum() + }; return nil; })()}; + if ((block !== nil)) { + + lines = $$($nesting, 'File').$read(self.path); + + self.eof = false; + self.lineno = 0; + var chomped = lines.$chomp(), + trailing = lines.length != chomped.length, + splitted = chomped.split(separator); + for (var i = 0, length = splitted.length; i < length; i++) { + self.lineno += 1; + if (i < length - 1 || trailing) { + Opal.yield1(block, splitted[i] + separator); + } + else { + Opal.yield1(block, splitted[i]); + } + } + self.eof = true; + ; + return self; + } else { + return self.$read().$each_line() + }; + }, TMP_File_each_line_4.$$arity = -1); + + Opal.def(self, '$readlines', TMP_File_readlines_5 = function $$readlines() { + var self = this; + + return $$($nesting, 'File').$readlines(self.path) + }, TMP_File_readlines_5.$$arity = 0); + return (function(self, $parent_nesting) { + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_readlines_6, TMP_file$q_7, TMP_readable$q_8, TMP_read_9; + + + + Opal.def(self, '$readlines', TMP_readlines_6 = function $$readlines(path, separator) { + var self = this, content = nil; + if ($gvars["/"] == null) $gvars["/"] = nil; + + + + if (separator == null) { + separator = $gvars["/"]; + }; + content = $$($nesting, 'File').$read(path); + return content.$split(separator); + }, TMP_readlines_6.$$arity = -2); + + Opal.def(self, '$file?', TMP_file$q_7 = function(path) { + var self = this; + + return true + }, TMP_file$q_7.$$arity = 1); + + Opal.def(self, '$readable?', TMP_readable$q_8 = function(path) { + var self = this; + + return true + }, TMP_readable$q_8.$$arity = 1); + return (Opal.def(self, '$read', TMP_read_9 = function $$read(path) { + var self = this; + + return "" + }, TMP_read_9.$$arity = 1), nil) && 'read'; + })(Opal.get_singleton_class(self), $nesting); + })($nesting[0], null, $nesting); + return (function($base, $super, $parent_nesting) { + function $IO(){}; + var self = $IO = $klass($base, $super, 'IO', $IO); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_IO_read_10; + + return (Opal.defs(self, '$read', TMP_IO_read_10 = function $$read(path) { + var self = this; + + return $$($nesting, 'File').$read(path) + }, TMP_IO_read_10.$$arity = 1), nil) && 'read' + })($nesting[0], null, $nesting); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/js/opal_ext/match_data"] = function(Opal) { + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $send = Opal.send; + + Opal.add_stubs(['$[]=', '$-']); + return (function($base, $super, $parent_nesting) { + function $MatchData(){}; + var self = $MatchData = $klass($base, $super, 'MatchData', $MatchData); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_MatchData_$$$eq_1; + + def.matches = nil; + return (Opal.def(self, '$[]=', TMP_MatchData_$$$eq_1 = function(idx, val) { + var self = this, $writer = nil; + + + $writer = [idx, val]; + $send(self.matches, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + }, TMP_MatchData_$$$eq_1.$$arity = 2), nil) && '[]=' + })($nesting[0], null, $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/js/opal_ext/kernel"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module; + + return (function($base, $parent_nesting) { + function $Kernel() {}; + var self = $Kernel = $module($base, 'Kernel', $Kernel); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Kernel_freeze_1; + + + Opal.def(self, '$freeze', TMP_Kernel_freeze_1 = function $$freeze() { + var self = this; + + return self + }, TMP_Kernel_freeze_1.$$arity = 0) + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/js/opal_ext/thread_safe"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass; + + return (function($base, $parent_nesting) { + function $ThreadSafe() {}; + var self = $ThreadSafe = $module($base, 'ThreadSafe', $ThreadSafe); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + (function($base, $super, $parent_nesting) { + function $Cache(){}; + var self = $Cache = $klass($base, $super, 'Cache', $Cache); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return nil + })($nesting[0], $$$('::', 'Hash'), $nesting) + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/js/opal_ext/string"] = function(Opal) { + function $rb_lt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $truthy = Opal.truthy, $send = Opal.send; + + Opal.add_stubs(['$method_defined?', '$<', '$length', '$bytes', '$to_s', '$byteslice', '$==', '$with_index', '$select', '$[]', '$even?', '$_original_unpack']); + return (function($base, $super, $parent_nesting) { + function $String(){}; + var self = $String = $klass($base, $super, 'String', $String); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_String_limit_bytesize_1, TMP_String_unpack_2; + + + if ($truthy(self['$method_defined?']("limit_bytesize"))) { + } else { + + Opal.def(self, '$limit_bytesize', TMP_String_limit_bytesize_1 = function $$limit_bytesize(size) { + var self = this, result = nil; + + + if ($truthy($rb_lt(size, self.$bytes().$length()))) { + } else { + return self.$to_s() + }; + result = self.$byteslice(0, size); + return result.$to_s(); + }, TMP_String_limit_bytesize_1.$$arity = 1) + }; + if ($truthy(self['$method_defined?']("limit"))) { + } else { + Opal.alias(self, "limit", "limit_bytesize") + }; + Opal.alias(self, "_original_unpack", "unpack"); + return (Opal.def(self, '$unpack', TMP_String_unpack_2 = function $$unpack(format) { + var TMP_3, self = this; + + if (format['$==']("C3")) { + return $send(self['$[]'](0, 3).$bytes().$select(), 'with_index', [], (TMP_3 = function(_, i){var self = TMP_3.$$s || this; + + + + if (_ == null) { + _ = nil; + }; + + if (i == null) { + i = nil; + }; + return i['$even?']();}, TMP_3.$$s = self, TMP_3.$$arity = 2, TMP_3)) + } else { + return self.$_original_unpack(format) + } + }, TMP_String_unpack_2.$$arity = 1), nil) && 'unpack'; + })($nesting[0], null, $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/js/opal_ext/uri"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module; + + Opal.add_stubs(['$extend']); + return (function($base, $parent_nesting) { + function $URI() {}; + var self = $URI = $module($base, 'URI', $URI); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_URI_parse_1, TMP_URI_path_2; + + + Opal.defs(self, '$parse', TMP_URI_parse_1 = function $$parse(str) { + var self = this; + + return str.$extend($$($nesting, 'URI')) + }, TMP_URI_parse_1.$$arity = 1); + + Opal.def(self, '$path', TMP_URI_path_2 = function $$path() { + var self = this; + + return self + }, TMP_URI_path_2.$$arity = 0); + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/js/opal_ext"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice; + + Opal.add_stubs(['$require']); + + self.$require("asciidoctor/js/opal_ext/file"); + self.$require("asciidoctor/js/opal_ext/match_data"); + self.$require("asciidoctor/js/opal_ext/kernel"); + self.$require("asciidoctor/js/opal_ext/thread_safe"); + self.$require("asciidoctor/js/opal_ext/string"); + self.$require("asciidoctor/js/opal_ext/uri"); + +// Load specific implementation +self.$require("asciidoctor/js/opal_ext/nashorn"); +; +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/js/rx"] = function(Opal) { + function $rb_plus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $send = Opal.send, $gvars = Opal.gvars, $truthy = Opal.truthy; + + Opal.add_stubs(['$gsub', '$+', '$unpack_hex_range']); + return (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Asciidoctor_unpack_hex_range_1; + + + Opal.const_set($nesting[0], 'HEX_RANGE_RX', /([A-F0-9]{4})(?:-([A-F0-9]{4}))?/); + Opal.defs(self, '$unpack_hex_range', TMP_Asciidoctor_unpack_hex_range_1 = function $$unpack_hex_range(str) { + var TMP_2, self = this; + + return $send(str, 'gsub', [$$($nesting, 'HEX_RANGE_RX')], (TMP_2 = function(){var self = TMP_2.$$s || this, $a, $b; + + return "" + "\\u" + ((($a = $gvars['~']) === nil ? nil : $a['$[]'](1))) + (($truthy($a = (($b = $gvars['~']) === nil ? nil : $b['$[]'](2))) ? "" + "-\\u" + ((($b = $gvars['~']) === nil ? nil : $b['$[]'](2))) : $a))}, TMP_2.$$s = self, TMP_2.$$arity = 0, TMP_2)) + }, TMP_Asciidoctor_unpack_hex_range_1.$$arity = 1); + Opal.const_set($nesting[0], 'P_L', $rb_plus("A-Za-z", self.$unpack_hex_range("00AA00B500BA00C0-00D600D8-00F600F8-02C102C6-02D102E0-02E402EC02EE0370-037403760377037A-037D037F03860388-038A038C038E-03A103A3-03F503F7-0481048A-052F0531-055605590561-058705D0-05EA05F0-05F20620-064A066E066F0671-06D306D506E506E606EE06EF06FA-06FC06FF07100712-072F074D-07A507B107CA-07EA07F407F507FA0800-0815081A082408280840-085808A0-08B20904-0939093D09500958-09610971-09800985-098C098F09900993-09A809AA-09B009B209B6-09B909BD09CE09DC09DD09DF-09E109F009F10A05-0A0A0A0F0A100A13-0A280A2A-0A300A320A330A350A360A380A390A59-0A5C0A5E0A72-0A740A85-0A8D0A8F-0A910A93-0AA80AAA-0AB00AB20AB30AB5-0AB90ABD0AD00AE00AE10B05-0B0C0B0F0B100B13-0B280B2A-0B300B320B330B35-0B390B3D0B5C0B5D0B5F-0B610B710B830B85-0B8A0B8E-0B900B92-0B950B990B9A0B9C0B9E0B9F0BA30BA40BA8-0BAA0BAE-0BB90BD00C05-0C0C0C0E-0C100C12-0C280C2A-0C390C3D0C580C590C600C610C85-0C8C0C8E-0C900C92-0CA80CAA-0CB30CB5-0CB90CBD0CDE0CE00CE10CF10CF20D05-0D0C0D0E-0D100D12-0D3A0D3D0D4E0D600D610D7A-0D7F0D85-0D960D9A-0DB10DB3-0DBB0DBD0DC0-0DC60E01-0E300E320E330E40-0E460E810E820E840E870E880E8A0E8D0E94-0E970E99-0E9F0EA1-0EA30EA50EA70EAA0EAB0EAD-0EB00EB20EB30EBD0EC0-0EC40EC60EDC-0EDF0F000F40-0F470F49-0F6C0F88-0F8C1000-102A103F1050-1055105A-105D106110651066106E-10701075-1081108E10A0-10C510C710CD10D0-10FA10FC-1248124A-124D1250-12561258125A-125D1260-1288128A-128D1290-12B012B2-12B512B8-12BE12C012C2-12C512C8-12D612D8-13101312-13151318-135A1380-138F13A0-13F41401-166C166F-167F1681-169A16A0-16EA16F1-16F81700-170C170E-17111720-17311740-17511760-176C176E-17701780-17B317D717DC1820-18771880-18A818AA18B0-18F51900-191E1950-196D1970-19741980-19AB19C1-19C71A00-1A161A20-1A541AA71B05-1B331B45-1B4B1B83-1BA01BAE1BAF1BBA-1BE51C00-1C231C4D-1C4F1C5A-1C7D1CE9-1CEC1CEE-1CF11CF51CF61D00-1DBF1E00-1F151F18-1F1D1F20-1F451F48-1F4D1F50-1F571F591F5B1F5D1F5F-1F7D1F80-1FB41FB6-1FBC1FBE1FC2-1FC41FC6-1FCC1FD0-1FD31FD6-1FDB1FE0-1FEC1FF2-1FF41FF6-1FFC2071207F2090-209C21022107210A-211321152119-211D212421262128212A-212D212F-2139213C-213F2145-2149214E218321842C00-2C2E2C30-2C5E2C60-2CE42CEB-2CEE2CF22CF32D00-2D252D272D2D2D30-2D672D6F2D80-2D962DA0-2DA62DA8-2DAE2DB0-2DB62DB8-2DBE2DC0-2DC62DC8-2DCE2DD0-2DD62DD8-2DDE2E2F300530063031-3035303B303C3041-3096309D-309F30A1-30FA30FC-30FF3105-312D3131-318E31A0-31BA31F0-31FF3400-4DB54E00-9FCCA000-A48CA4D0-A4FDA500-A60CA610-A61FA62AA62BA640-A66EA67F-A69DA6A0-A6E5A717-A71FA722-A788A78B-A78EA790-A7ADA7B0A7B1A7F7-A801A803-A805A807-A80AA80C-A822A840-A873A882-A8B3A8F2-A8F7A8FBA90A-A925A930-A946A960-A97CA984-A9B2A9CFA9E0-A9E4A9E6-A9EFA9FA-A9FEAA00-AA28AA40-AA42AA44-AA4BAA60-AA76AA7AAA7E-AAAFAAB1AAB5AAB6AAB9-AABDAAC0AAC2AADB-AADDAAE0-AAEAAAF2-AAF4AB01-AB06AB09-AB0EAB11-AB16AB20-AB26AB28-AB2EAB30-AB5AAB5C-AB5FAB64AB65ABC0-ABE2AC00-D7A3D7B0-D7C6D7CB-D7FBF900-FA6DFA70-FAD9FB00-FB06FB13-FB17FB1DFB1F-FB28FB2A-FB36FB38-FB3CFB3EFB40FB41FB43FB44FB46-FBB1FBD3-FD3DFD50-FD8FFD92-FDC7FDF0-FDFBFE70-FE74FE76-FEFCFF21-FF3AFF41-FF5AFF66-FFBEFFC2-FFC7FFCA-FFCFFFD2-FFD7FFDA-FFDC"))); + Opal.const_set($nesting[0], 'P_Nl', self.$unpack_hex_range("16EE-16F02160-21822185-218830073021-30293038-303AA6E6-A6EF")); + Opal.const_set($nesting[0], 'P_Nd', $rb_plus("0-9", self.$unpack_hex_range("0660-066906F0-06F907C0-07C90966-096F09E6-09EF0A66-0A6F0AE6-0AEF0B66-0B6F0BE6-0BEF0C66-0C6F0CE6-0CEF0D66-0D6F0DE6-0DEF0E50-0E590ED0-0ED90F20-0F291040-10491090-109917E0-17E91810-18191946-194F19D0-19D91A80-1A891A90-1A991B50-1B591BB0-1BB91C40-1C491C50-1C59A620-A629A8D0-A8D9A900-A909A9D0-A9D9A9F0-A9F9AA50-AA59ABF0-ABF9FF10-FF19"))); + Opal.const_set($nesting[0], 'P_Pc', self.$unpack_hex_range("005F203F20402054FE33FE34FE4D-FE4FFF3F")); + Opal.const_set($nesting[0], 'CC_ALPHA', "" + ($$($nesting, 'P_L')) + ($$($nesting, 'P_Nl'))); + Opal.const_set($nesting[0], 'CG_ALPHA', "" + "[" + ($$($nesting, 'CC_ALPHA')) + "]"); + Opal.const_set($nesting[0], 'CC_ALNUM', "" + ($$($nesting, 'CC_ALPHA')) + ($$($nesting, 'P_Nd'))); + Opal.const_set($nesting[0], 'CG_ALNUM', "" + "[" + ($$($nesting, 'CC_ALNUM')) + "]"); + Opal.const_set($nesting[0], 'CC_WORD', "" + ($$($nesting, 'CC_ALNUM')) + ($$($nesting, 'P_Pc'))); + Opal.const_set($nesting[0], 'CG_WORD', "" + "[" + ($$($nesting, 'CC_WORD')) + "]"); + Opal.const_set($nesting[0], 'CG_BLANK', "[ \\t]"); + Opal.const_set($nesting[0], 'CC_EOL', "(?=\\n|$)"); + Opal.const_set($nesting[0], 'CG_GRAPH', "[^\\s\\x00-\\x1F\\x7F]"); + Opal.const_set($nesting[0], 'CC_ALL', "[\\s\\S]"); + Opal.const_set($nesting[0], 'CC_ANY', "[^\\n]"); + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["strscan"] = function(Opal) { + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $send = Opal.send; + + Opal.add_stubs(['$attr_reader', '$anchor', '$scan_until', '$length', '$size', '$rest', '$pos=', '$-', '$private']); + return (function($base, $super, $parent_nesting) { + function $StringScanner(){}; + var self = $StringScanner = $klass($base, $super, 'StringScanner', $StringScanner); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_StringScanner_initialize_1, TMP_StringScanner_beginning_of_line$q_2, TMP_StringScanner_scan_3, TMP_StringScanner_scan_until_4, TMP_StringScanner_$$_5, TMP_StringScanner_check_6, TMP_StringScanner_check_until_7, TMP_StringScanner_peek_8, TMP_StringScanner_eos$q_9, TMP_StringScanner_exist$q_10, TMP_StringScanner_skip_11, TMP_StringScanner_skip_until_12, TMP_StringScanner_get_byte_13, TMP_StringScanner_match$q_14, TMP_StringScanner_pos$eq_15, TMP_StringScanner_matched_size_16, TMP_StringScanner_post_match_17, TMP_StringScanner_pre_match_18, TMP_StringScanner_reset_19, TMP_StringScanner_rest_20, TMP_StringScanner_rest$q_21, TMP_StringScanner_rest_size_22, TMP_StringScanner_terminate_23, TMP_StringScanner_unscan_24, TMP_StringScanner_anchor_25; + + def.pos = def.string = def.working = def.matched = def.prev_pos = def.match = nil; + + self.$attr_reader("pos"); + self.$attr_reader("matched"); + + Opal.def(self, '$initialize', TMP_StringScanner_initialize_1 = function $$initialize(string) { + var self = this; + + + self.string = string; + self.pos = 0; + self.matched = nil; + self.working = string; + return (self.match = []); + }, TMP_StringScanner_initialize_1.$$arity = 1); + self.$attr_reader("string"); + + Opal.def(self, '$beginning_of_line?', TMP_StringScanner_beginning_of_line$q_2 = function() { + var self = this; + + return self.pos === 0 || self.string.charAt(self.pos - 1) === "\n" + }, TMP_StringScanner_beginning_of_line$q_2.$$arity = 0); + Opal.alias(self, "bol?", "beginning_of_line?"); + + Opal.def(self, '$scan', TMP_StringScanner_scan_3 = function $$scan(pattern) { + var self = this; + + + pattern = self.$anchor(pattern); + + var result = pattern.exec(self.working); + + if (result == null) { + return self.matched = nil; + } + else if (typeof(result) === 'object') { + self.prev_pos = self.pos; + self.pos += result[0].length; + self.working = self.working.substring(result[0].length); + self.matched = result[0]; + self.match = result; + + return result[0]; + } + else if (typeof(result) === 'string') { + self.pos += result.length; + self.working = self.working.substring(result.length); + + return result; + } + else { + return nil; + } + ; + }, TMP_StringScanner_scan_3.$$arity = 1); + + Opal.def(self, '$scan_until', TMP_StringScanner_scan_until_4 = function $$scan_until(pattern) { + var self = this; + + + pattern = self.$anchor(pattern); + + var pos = self.pos, + working = self.working, + result; + + while (true) { + result = pattern.exec(working); + pos += 1; + working = working.substr(1); + + if (result == null) { + if (working.length === 0) { + return self.matched = nil; + } + + continue; + } + + self.matched = self.string.substr(self.pos, pos - self.pos - 1 + result[0].length); + self.prev_pos = pos - 1; + self.pos = pos; + self.working = working.substr(result[0].length); + + return self.matched; + } + ; + }, TMP_StringScanner_scan_until_4.$$arity = 1); + + Opal.def(self, '$[]', TMP_StringScanner_$$_5 = function(idx) { + var self = this; + + + var match = self.match; + + if (idx < 0) { + idx += match.length; + } + + if (idx < 0 || idx >= match.length) { + return nil; + } + + if (match[idx] == null) { + return nil; + } + + return match[idx]; + + }, TMP_StringScanner_$$_5.$$arity = 1); + + Opal.def(self, '$check', TMP_StringScanner_check_6 = function $$check(pattern) { + var self = this; + + + pattern = self.$anchor(pattern); + + var result = pattern.exec(self.working); + + if (result == null) { + return self.matched = nil; + } + + return self.matched = result[0]; + ; + }, TMP_StringScanner_check_6.$$arity = 1); + + Opal.def(self, '$check_until', TMP_StringScanner_check_until_7 = function $$check_until(pattern) { + var self = this; + + + var prev_pos = self.prev_pos, + pos = self.pos; + + var result = self.$scan_until(pattern); + + if (result !== nil) { + self.matched = result.substr(-1); + self.working = self.string.substr(pos); + } + + self.prev_pos = prev_pos; + self.pos = pos; + + return result; + + }, TMP_StringScanner_check_until_7.$$arity = 1); + + Opal.def(self, '$peek', TMP_StringScanner_peek_8 = function $$peek(length) { + var self = this; + + return self.working.substring(0, length) + }, TMP_StringScanner_peek_8.$$arity = 1); + + Opal.def(self, '$eos?', TMP_StringScanner_eos$q_9 = function() { + var self = this; + + return self.working.length === 0 + }, TMP_StringScanner_eos$q_9.$$arity = 0); + + Opal.def(self, '$exist?', TMP_StringScanner_exist$q_10 = function(pattern) { + var self = this; + + + var result = pattern.exec(self.working); + + if (result == null) { + return nil; + } + else if (result.index == 0) { + return 0; + } + else { + return result.index + 1; + } + + }, TMP_StringScanner_exist$q_10.$$arity = 1); + + Opal.def(self, '$skip', TMP_StringScanner_skip_11 = function $$skip(pattern) { + var self = this; + + + pattern = self.$anchor(pattern); + + var result = pattern.exec(self.working); + + if (result == null) { + return self.matched = nil; + } + else { + var match_str = result[0]; + var match_len = match_str.length; + + self.matched = match_str; + self.prev_pos = self.pos; + self.pos += match_len; + self.working = self.working.substring(match_len); + + return match_len; + } + ; + }, TMP_StringScanner_skip_11.$$arity = 1); + + Opal.def(self, '$skip_until', TMP_StringScanner_skip_until_12 = function $$skip_until(pattern) { + var self = this; + + + var result = self.$scan_until(pattern); + + if (result === nil) { + return nil; + } + else { + self.matched = result.substr(-1); + + return result.length; + } + + }, TMP_StringScanner_skip_until_12.$$arity = 1); + + Opal.def(self, '$get_byte', TMP_StringScanner_get_byte_13 = function $$get_byte() { + var self = this; + + + var result = nil; + + if (self.pos < self.string.length) { + self.prev_pos = self.pos; + self.pos += 1; + result = self.matched = self.working.substring(0, 1); + self.working = self.working.substring(1); + } + else { + self.matched = nil; + } + + return result; + + }, TMP_StringScanner_get_byte_13.$$arity = 0); + Opal.alias(self, "getch", "get_byte"); + + Opal.def(self, '$match?', TMP_StringScanner_match$q_14 = function(pattern) { + var self = this; + + + pattern = self.$anchor(pattern); + + var result = pattern.exec(self.working); + + if (result == null) { + return nil; + } + else { + self.prev_pos = self.pos; + + return result[0].length; + } + ; + }, TMP_StringScanner_match$q_14.$$arity = 1); + + Opal.def(self, '$pos=', TMP_StringScanner_pos$eq_15 = function(pos) { + var self = this; + + + + if (pos < 0) { + pos += self.string.$length(); + } + ; + self.pos = pos; + return (self.working = self.string.slice(pos)); + }, TMP_StringScanner_pos$eq_15.$$arity = 1); + + Opal.def(self, '$matched_size', TMP_StringScanner_matched_size_16 = function $$matched_size() { + var self = this; + + + if (self.matched === nil) { + return nil; + } + + return self.matched.length + + }, TMP_StringScanner_matched_size_16.$$arity = 0); + + Opal.def(self, '$post_match', TMP_StringScanner_post_match_17 = function $$post_match() { + var self = this; + + + if (self.matched === nil) { + return nil; + } + + return self.string.substr(self.pos); + + }, TMP_StringScanner_post_match_17.$$arity = 0); + + Opal.def(self, '$pre_match', TMP_StringScanner_pre_match_18 = function $$pre_match() { + var self = this; + + + if (self.matched === nil) { + return nil; + } + + return self.string.substr(0, self.prev_pos); + + }, TMP_StringScanner_pre_match_18.$$arity = 0); + + Opal.def(self, '$reset', TMP_StringScanner_reset_19 = function $$reset() { + var self = this; + + + self.working = self.string; + self.matched = nil; + return (self.pos = 0); + }, TMP_StringScanner_reset_19.$$arity = 0); + + Opal.def(self, '$rest', TMP_StringScanner_rest_20 = function $$rest() { + var self = this; + + return self.working + }, TMP_StringScanner_rest_20.$$arity = 0); + + Opal.def(self, '$rest?', TMP_StringScanner_rest$q_21 = function() { + var self = this; + + return self.working.length !== 0 + }, TMP_StringScanner_rest$q_21.$$arity = 0); + + Opal.def(self, '$rest_size', TMP_StringScanner_rest_size_22 = function $$rest_size() { + var self = this; + + return self.$rest().$size() + }, TMP_StringScanner_rest_size_22.$$arity = 0); + + Opal.def(self, '$terminate', TMP_StringScanner_terminate_23 = function $$terminate() { + var self = this, $writer = nil; + + + self.match = nil; + + $writer = [self.string.$length()]; + $send(self, 'pos=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];; + }, TMP_StringScanner_terminate_23.$$arity = 0); + + Opal.def(self, '$unscan', TMP_StringScanner_unscan_24 = function $$unscan() { + var self = this; + + + self.pos = self.prev_pos; + self.prev_pos = nil; + self.match = nil; + return self; + }, TMP_StringScanner_unscan_24.$$arity = 0); + self.$private(); + return (Opal.def(self, '$anchor', TMP_StringScanner_anchor_25 = function $$anchor(pattern) { + var self = this; + + + var flags = pattern.toString().match(/\/([^\/]+)$/); + flags = flags ? flags[1] : undefined; + return new RegExp('^(?:' + pattern.source + ')', flags); + + }, TMP_StringScanner_anchor_25.$$arity = 1), nil) && 'anchor'; + })($nesting[0], null, $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/js"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice; + + Opal.add_stubs(['$require']); + + self.$require("asciidoctor/js/opal_ext"); + self.$require("asciidoctor/js/rx"); + return self.$require("strscan"); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["logger"] = function(Opal) { + function $rb_plus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); + } + function $rb_le(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs <= rhs : lhs['$<='](rhs); + } + function $rb_lt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $module = Opal.module, $send = Opal.send, $truthy = Opal.truthy; + + Opal.add_stubs(['$include', '$to_h', '$map', '$constants', '$const_get', '$to_s', '$format', '$chr', '$strftime', '$message_as_string', '$===', '$+', '$message', '$class', '$join', '$backtrace', '$inspect', '$attr_reader', '$attr_accessor', '$new', '$key', '$upcase', '$raise', '$add', '$to_proc', '$<=', '$<', '$write', '$call', '$[]', '$now']); + return (function($base, $super, $parent_nesting) { + function $Logger(){}; + var self = $Logger = $klass($base, $super, 'Logger', $Logger); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Logger_1, TMP_Logger_initialize_4, TMP_Logger_level$eq_5, TMP_Logger_info_6, TMP_Logger_debug_7, TMP_Logger_warn_8, TMP_Logger_error_9, TMP_Logger_fatal_10, TMP_Logger_unknown_11, TMP_Logger_info$q_12, TMP_Logger_debug$q_13, TMP_Logger_warn$q_14, TMP_Logger_error$q_15, TMP_Logger_fatal$q_16, TMP_Logger_add_17; + + def.level = def.progname = def.pipe = def.formatter = nil; + + (function($base, $parent_nesting) { + function $Severity() {}; + var self = $Severity = $module($base, 'Severity', $Severity); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + + Opal.const_set($nesting[0], 'DEBUG', 0); + Opal.const_set($nesting[0], 'INFO', 1); + Opal.const_set($nesting[0], 'WARN', 2); + Opal.const_set($nesting[0], 'ERROR', 3); + Opal.const_set($nesting[0], 'FATAL', 4); + Opal.const_set($nesting[0], 'UNKNOWN', 5); + })($nesting[0], $nesting); + self.$include($$($nesting, 'Severity')); + Opal.const_set($nesting[0], 'SEVERITY_LABELS', $send($$($nesting, 'Severity').$constants(), 'map', [], (TMP_Logger_1 = function(s){var self = TMP_Logger_1.$$s || this; + + + + if (s == null) { + s = nil; + }; + return [$$($nesting, 'Severity').$const_get(s), s.$to_s()];}, TMP_Logger_1.$$s = self, TMP_Logger_1.$$arity = 1, TMP_Logger_1)).$to_h()); + (function($base, $super, $parent_nesting) { + function $Formatter(){}; + var self = $Formatter = $klass($base, $super, 'Formatter', $Formatter); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Formatter_call_2, TMP_Formatter_message_as_string_3; + + + Opal.const_set($nesting[0], 'MESSAGE_FORMAT', "%s, [%s] %5s -- %s: %s\n"); + Opal.const_set($nesting[0], 'DATE_TIME_FORMAT', "%Y-%m-%dT%H:%M:%S.%6N"); + + Opal.def(self, '$call', TMP_Formatter_call_2 = function $$call(severity, time, progname, msg) { + var self = this; + + return self.$format($$($nesting, 'MESSAGE_FORMAT'), severity.$chr(), time.$strftime($$($nesting, 'DATE_TIME_FORMAT')), severity, progname, self.$message_as_string(msg)) + }, TMP_Formatter_call_2.$$arity = 4); + return (Opal.def(self, '$message_as_string', TMP_Formatter_message_as_string_3 = function $$message_as_string(msg) { + var $a, self = this, $case = nil; + + return (function() {$case = msg; + if ($$$('::', 'String')['$===']($case)) {return msg} + else if ($$$('::', 'Exception')['$===']($case)) {return $rb_plus("" + (msg.$message()) + " (" + (msg.$class()) + ")\n", ($truthy($a = msg.$backtrace()) ? $a : []).$join("\n"))} + else {return msg.$inspect()}})() + }, TMP_Formatter_message_as_string_3.$$arity = 1), nil) && 'message_as_string'; + })($nesting[0], null, $nesting); + self.$attr_reader("level"); + self.$attr_accessor("progname"); + self.$attr_accessor("formatter"); + + Opal.def(self, '$initialize', TMP_Logger_initialize_4 = function $$initialize(pipe) { + var self = this; + + + self.pipe = pipe; + self.level = $$($nesting, 'DEBUG'); + return (self.formatter = $$($nesting, 'Formatter').$new()); + }, TMP_Logger_initialize_4.$$arity = 1); + + Opal.def(self, '$level=', TMP_Logger_level$eq_5 = function(severity) { + var self = this, level = nil; + + if ($truthy($$$('::', 'Integer')['$==='](severity))) { + return (self.level = severity) + } else if ($truthy((level = $$($nesting, 'SEVERITY_LABELS').$key(severity.$to_s().$upcase())))) { + return (self.level = level) + } else { + return self.$raise($$($nesting, 'ArgumentError'), "" + "invalid log level: " + (severity)) + } + }, TMP_Logger_level$eq_5.$$arity = 1); + + Opal.def(self, '$info', TMP_Logger_info_6 = function $$info(progname) { + var $iter = TMP_Logger_info_6.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Logger_info_6.$$p = null; + + + if ($iter) TMP_Logger_info_6.$$p = null;; + + if (progname == null) { + progname = nil; + }; + return $send(self, 'add', [$$($nesting, 'INFO'), nil, progname], block.$to_proc()); + }, TMP_Logger_info_6.$$arity = -1); + + Opal.def(self, '$debug', TMP_Logger_debug_7 = function $$debug(progname) { + var $iter = TMP_Logger_debug_7.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Logger_debug_7.$$p = null; + + + if ($iter) TMP_Logger_debug_7.$$p = null;; + + if (progname == null) { + progname = nil; + }; + return $send(self, 'add', [$$($nesting, 'DEBUG'), nil, progname], block.$to_proc()); + }, TMP_Logger_debug_7.$$arity = -1); + + Opal.def(self, '$warn', TMP_Logger_warn_8 = function $$warn(progname) { + var $iter = TMP_Logger_warn_8.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Logger_warn_8.$$p = null; + + + if ($iter) TMP_Logger_warn_8.$$p = null;; + + if (progname == null) { + progname = nil; + }; + return $send(self, 'add', [$$($nesting, 'WARN'), nil, progname], block.$to_proc()); + }, TMP_Logger_warn_8.$$arity = -1); + + Opal.def(self, '$error', TMP_Logger_error_9 = function $$error(progname) { + var $iter = TMP_Logger_error_9.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Logger_error_9.$$p = null; + + + if ($iter) TMP_Logger_error_9.$$p = null;; + + if (progname == null) { + progname = nil; + }; + return $send(self, 'add', [$$($nesting, 'ERROR'), nil, progname], block.$to_proc()); + }, TMP_Logger_error_9.$$arity = -1); + + Opal.def(self, '$fatal', TMP_Logger_fatal_10 = function $$fatal(progname) { + var $iter = TMP_Logger_fatal_10.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Logger_fatal_10.$$p = null; + + + if ($iter) TMP_Logger_fatal_10.$$p = null;; + + if (progname == null) { + progname = nil; + }; + return $send(self, 'add', [$$($nesting, 'FATAL'), nil, progname], block.$to_proc()); + }, TMP_Logger_fatal_10.$$arity = -1); + + Opal.def(self, '$unknown', TMP_Logger_unknown_11 = function $$unknown(progname) { + var $iter = TMP_Logger_unknown_11.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Logger_unknown_11.$$p = null; + + + if ($iter) TMP_Logger_unknown_11.$$p = null;; + + if (progname == null) { + progname = nil; + }; + return $send(self, 'add', [$$($nesting, 'UNKNOWN'), nil, progname], block.$to_proc()); + }, TMP_Logger_unknown_11.$$arity = -1); + + Opal.def(self, '$info?', TMP_Logger_info$q_12 = function() { + var self = this; + + return $rb_le(self.level, $$($nesting, 'INFO')) + }, TMP_Logger_info$q_12.$$arity = 0); + + Opal.def(self, '$debug?', TMP_Logger_debug$q_13 = function() { + var self = this; + + return $rb_le(self.level, $$($nesting, 'DEBUG')) + }, TMP_Logger_debug$q_13.$$arity = 0); + + Opal.def(self, '$warn?', TMP_Logger_warn$q_14 = function() { + var self = this; + + return $rb_le(self.level, $$($nesting, 'WARN')) + }, TMP_Logger_warn$q_14.$$arity = 0); + + Opal.def(self, '$error?', TMP_Logger_error$q_15 = function() { + var self = this; + + return $rb_le(self.level, $$($nesting, 'ERROR')) + }, TMP_Logger_error$q_15.$$arity = 0); + + Opal.def(self, '$fatal?', TMP_Logger_fatal$q_16 = function() { + var self = this; + + return $rb_le(self.level, $$($nesting, 'FATAL')) + }, TMP_Logger_fatal$q_16.$$arity = 0); + return (Opal.def(self, '$add', TMP_Logger_add_17 = function $$add(severity, message, progname) { + var $iter = TMP_Logger_add_17.$$p, block = $iter || nil, $a, self = this; + + if ($iter) TMP_Logger_add_17.$$p = null; + + + if ($iter) TMP_Logger_add_17.$$p = null;; + + if (message == null) { + message = nil; + }; + + if (progname == null) { + progname = nil; + }; + if ($truthy($rb_lt((severity = ($truthy($a = severity) ? $a : $$($nesting, 'UNKNOWN'))), self.level))) { + return true}; + progname = ($truthy($a = progname) ? $a : self.progname); + if ($truthy(message)) { + } else if ((block !== nil)) { + message = Opal.yieldX(block, []) + } else { + + message = progname; + progname = self.progname; + }; + self.pipe.$write(self.formatter.$call(($truthy($a = $$($nesting, 'SEVERITY_LABELS')['$[]'](severity)) ? $a : "ANY"), $$$('::', 'Time').$now(), progname, message)); + return true; + }, TMP_Logger_add_17.$$arity = -2), nil) && 'add'; + })($nesting[0], null, $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/logging"] = function(Opal) { + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + function $rb_gt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $send = Opal.send, $truthy = Opal.truthy, $hash2 = Opal.hash2, $gvars = Opal.gvars; + + Opal.add_stubs(['$require', '$attr_reader', '$progname=', '$-', '$new', '$formatter=', '$level=', '$>', '$[]', '$===', '$inspect', '$map', '$constants', '$const_get', '$to_sym', '$<<', '$clear', '$empty?', '$max', '$attr_accessor', '$memoize_logger', '$private', '$alias_method', '$==', '$define_method', '$extend', '$logger', '$merge']); + + self.$require("logger"); + return (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + + (function($base, $super, $parent_nesting) { + function $Logger(){}; + var self = $Logger = $klass($base, $super, 'Logger', $Logger); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Logger_initialize_1, TMP_Logger_add_2; + + def.max_severity = nil; + + self.$attr_reader("max_severity"); + + Opal.def(self, '$initialize', TMP_Logger_initialize_1 = function $$initialize($a) { + var $post_args, args, $iter = TMP_Logger_initialize_1.$$p, $yield = $iter || nil, self = this, $writer = nil, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_Logger_initialize_1.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + $send(self, Opal.find_super_dispatcher(self, 'initialize', TMP_Logger_initialize_1, false), $zuper, $iter); + + $writer = ["asciidoctor"]; + $send(self, 'progname=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = [$$($nesting, 'BasicFormatter').$new()]; + $send(self, 'formatter=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = [$$($nesting, 'WARN')]; + $send(self, 'level=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];; + }, TMP_Logger_initialize_1.$$arity = -1); + + Opal.def(self, '$add', TMP_Logger_add_2 = function $$add(severity, message, progname) { + var $a, $iter = TMP_Logger_add_2.$$p, $yield = $iter || nil, self = this, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_Logger_add_2.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + + + if (message == null) { + message = nil; + }; + + if (progname == null) { + progname = nil; + }; + if ($truthy($rb_gt((severity = ($truthy($a = severity) ? $a : $$($nesting, 'UNKNOWN'))), (self.max_severity = ($truthy($a = self.max_severity) ? $a : severity))))) { + self.max_severity = severity}; + return $send(self, Opal.find_super_dispatcher(self, 'add', TMP_Logger_add_2, false), $zuper, $iter); + }, TMP_Logger_add_2.$$arity = -2); + (function($base, $super, $parent_nesting) { + function $BasicFormatter(){}; + var self = $BasicFormatter = $klass($base, $super, 'BasicFormatter', $BasicFormatter); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_BasicFormatter_call_3; + + + Opal.const_set($nesting[0], 'SEVERITY_LABELS', $hash2(["WARN", "FATAL"], {"WARN": "WARNING", "FATAL": "FAILED"})); + return (Opal.def(self, '$call', TMP_BasicFormatter_call_3 = function $$call(severity, _, progname, msg) { + var $a, self = this; + + return "" + (progname) + ": " + (($truthy($a = $$($nesting, 'SEVERITY_LABELS')['$[]'](severity)) ? $a : severity)) + ": " + ((function() {if ($truthy($$$('::', 'String')['$==='](msg))) { + return msg + } else { + return msg.$inspect() + }; return nil; })()) + "\n" + }, TMP_BasicFormatter_call_3.$$arity = 4), nil) && 'call'; + })($nesting[0], $$($nesting, 'Formatter'), $nesting); + return (function($base, $parent_nesting) { + function $AutoFormattingMessage() {}; + var self = $AutoFormattingMessage = $module($base, 'AutoFormattingMessage', $AutoFormattingMessage); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_AutoFormattingMessage_inspect_4; + + + Opal.def(self, '$inspect', TMP_AutoFormattingMessage_inspect_4 = function $$inspect() { + var self = this, sloc = nil; + + if ($truthy((sloc = self['$[]']("source_location")))) { + return "" + (sloc) + ": " + (self['$[]']("text")) + } else { + return self['$[]']("text") + } + }, TMP_AutoFormattingMessage_inspect_4.$$arity = 0) + })($nesting[0], $nesting); + })($nesting[0], $$$('::', 'Logger'), $nesting); + (function($base, $super, $parent_nesting) { + function $MemoryLogger(){}; + var self = $MemoryLogger = $klass($base, $super, 'MemoryLogger', $MemoryLogger); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_MemoryLogger_5, TMP_MemoryLogger_initialize_6, TMP_MemoryLogger_add_7, TMP_MemoryLogger_clear_8, TMP_MemoryLogger_empty$q_9, TMP_MemoryLogger_max_severity_10; + + def.messages = nil; + + Opal.const_set($nesting[0], 'SEVERITY_LABELS', $$$('::', 'Hash')['$[]']($send($$($nesting, 'Severity').$constants(), 'map', [], (TMP_MemoryLogger_5 = function(c){var self = TMP_MemoryLogger_5.$$s || this; + + + + if (c == null) { + c = nil; + }; + return [$$($nesting, 'Severity').$const_get(c), c.$to_sym()];}, TMP_MemoryLogger_5.$$s = self, TMP_MemoryLogger_5.$$arity = 1, TMP_MemoryLogger_5)))); + self.$attr_reader("messages"); + + Opal.def(self, '$initialize', TMP_MemoryLogger_initialize_6 = function $$initialize() { + var self = this, $writer = nil; + + + + $writer = [$$($nesting, 'WARN')]; + $send(self, 'level=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + return (self.messages = []); + }, TMP_MemoryLogger_initialize_6.$$arity = 0); + + Opal.def(self, '$add', TMP_MemoryLogger_add_7 = function $$add(severity, message, progname) { + var $a, $iter = TMP_MemoryLogger_add_7.$$p, $yield = $iter || nil, self = this; + + if ($iter) TMP_MemoryLogger_add_7.$$p = null; + + + if (message == null) { + message = nil; + }; + + if (progname == null) { + progname = nil; + }; + if ($truthy(message)) { + } else { + message = (function() {if (($yield !== nil)) { + return Opal.yieldX($yield, []); + } else { + return progname + }; return nil; })() + }; + self.messages['$<<']($hash2(["severity", "message"], {"severity": $$($nesting, 'SEVERITY_LABELS')['$[]'](($truthy($a = severity) ? $a : $$($nesting, 'UNKNOWN'))), "message": message})); + return true; + }, TMP_MemoryLogger_add_7.$$arity = -2); + + Opal.def(self, '$clear', TMP_MemoryLogger_clear_8 = function $$clear() { + var self = this; + + return self.messages.$clear() + }, TMP_MemoryLogger_clear_8.$$arity = 0); + + Opal.def(self, '$empty?', TMP_MemoryLogger_empty$q_9 = function() { + var self = this; + + return self.messages['$empty?']() + }, TMP_MemoryLogger_empty$q_9.$$arity = 0); + return (Opal.def(self, '$max_severity', TMP_MemoryLogger_max_severity_10 = function $$max_severity() { + var TMP_11, self = this; + + if ($truthy(self['$empty?']())) { + return nil + } else { + return $send(self.messages, 'map', [], (TMP_11 = function(m){var self = TMP_11.$$s || this; + + + + if (m == null) { + m = nil; + }; + return $$($nesting, 'Severity').$const_get(m['$[]']("severity"));}, TMP_11.$$s = self, TMP_11.$$arity = 1, TMP_11)).$max() + } + }, TMP_MemoryLogger_max_severity_10.$$arity = 0), nil) && 'max_severity'; + })($nesting[0], $$$('::', 'Logger'), $nesting); + (function($base, $super, $parent_nesting) { + function $NullLogger(){}; + var self = $NullLogger = $klass($base, $super, 'NullLogger', $NullLogger); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_NullLogger_initialize_12, TMP_NullLogger_add_13; + + def.max_severity = nil; + + self.$attr_reader("max_severity"); + + Opal.def(self, '$initialize', TMP_NullLogger_initialize_12 = function $$initialize() { + var self = this; + + return nil + }, TMP_NullLogger_initialize_12.$$arity = 0); + return (Opal.def(self, '$add', TMP_NullLogger_add_13 = function $$add(severity, message, progname) { + var $a, self = this; + + + + if (message == null) { + message = nil; + }; + + if (progname == null) { + progname = nil; + }; + if ($truthy($rb_gt((severity = ($truthy($a = severity) ? $a : $$($nesting, 'UNKNOWN'))), (self.max_severity = ($truthy($a = self.max_severity) ? $a : severity))))) { + self.max_severity = severity}; + return true; + }, TMP_NullLogger_add_13.$$arity = -2), nil) && 'add'; + })($nesting[0], $$$('::', 'Logger'), $nesting); + (function($base, $parent_nesting) { + function $LoggerManager() {}; + var self = $LoggerManager = $module($base, 'LoggerManager', $LoggerManager); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + + self.logger_class = $$($nesting, 'Logger'); + (function(self, $parent_nesting) { + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_logger_14, TMP_logger$eq_15, TMP_memoize_logger_16; + + + self.$attr_accessor("logger_class"); + + Opal.def(self, '$logger', TMP_logger_14 = function $$logger(pipe) { + var $a, self = this; + if (self.logger == null) self.logger = nil; + if (self.logger_class == null) self.logger_class = nil; + if ($gvars.stderr == null) $gvars.stderr = nil; + + + + if (pipe == null) { + pipe = $gvars.stderr; + }; + self.$memoize_logger(); + return (self.logger = ($truthy($a = self.logger) ? $a : self.logger_class.$new(pipe))); + }, TMP_logger_14.$$arity = -1); + + Opal.def(self, '$logger=', TMP_logger$eq_15 = function(logger) { + var $a, self = this; + if (self.logger_class == null) self.logger_class = nil; + if ($gvars.stderr == null) $gvars.stderr = nil; + + return (self.logger = ($truthy($a = logger) ? $a : self.logger_class.$new($gvars.stderr))) + }, TMP_logger$eq_15.$$arity = 1); + self.$private(); + return (Opal.def(self, '$memoize_logger', TMP_memoize_logger_16 = function $$memoize_logger() { + var self = this; + + return (function(self, $parent_nesting) { + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_17; + + + self.$alias_method("logger", "logger"); + if ($$($nesting, 'RUBY_ENGINE')['$==']("opal")) { + return $send(self, 'define_method', ["logger"], (TMP_17 = function(){var self = TMP_17.$$s || this; + if (self.logger == null) self.logger = nil; + + return self.logger}, TMP_17.$$s = self, TMP_17.$$arity = 0, TMP_17)) + } else { + return nil + }; + })(Opal.get_singleton_class(self), $nesting) + }, TMP_memoize_logger_16.$$arity = 0), nil) && 'memoize_logger'; + })(Opal.get_singleton_class(self), $nesting); + })($nesting[0], $nesting); + (function($base, $parent_nesting) { + function $Logging() {}; + var self = $Logging = $module($base, 'Logging', $Logging); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Logging_included_18, TMP_Logging_logger_19, TMP_Logging_message_with_context_20; + + + Opal.defs(self, '$included', TMP_Logging_included_18 = function $$included(into) { + var self = this; + + return into.$extend($$($nesting, 'Logging')) + }, TMP_Logging_included_18.$$arity = 1); + self.$private(); + + Opal.def(self, '$logger', TMP_Logging_logger_19 = function $$logger() { + var self = this; + + return $$($nesting, 'LoggerManager').$logger() + }, TMP_Logging_logger_19.$$arity = 0); + + Opal.def(self, '$message_with_context', TMP_Logging_message_with_context_20 = function $$message_with_context(text, context) { + var self = this; + + + + if (context == null) { + context = $hash2([], {}); + }; + return $hash2(["text"], {"text": text}).$merge(context).$extend($$$($$($nesting, 'Logger'), 'AutoFormattingMessage')); + }, TMP_Logging_message_with_context_20.$$arity = -2); + })($nesting[0], $nesting); + })($nesting[0], $nesting); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/timings"] = function(Opal) { + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + function $rb_plus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); + } + function $rb_gt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $hash2 = Opal.hash2, $send = Opal.send, $truthy = Opal.truthy, $gvars = Opal.gvars; + + Opal.add_stubs(['$now', '$[]=', '$-', '$delete', '$reduce', '$+', '$[]', '$>', '$time', '$puts', '$%', '$to_f', '$read_parse', '$convert', '$read_parse_convert', '$const_defined?', '$respond_to?', '$clock_gettime']); + return (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + (function($base, $super, $parent_nesting) { + function $Timings(){}; + var self = $Timings = $klass($base, $super, 'Timings', $Timings); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Timings_initialize_1, TMP_Timings_start_2, TMP_Timings_record_3, TMP_Timings_time_4, TMP_Timings_read_6, TMP_Timings_parse_7, TMP_Timings_read_parse_8, TMP_Timings_convert_9, TMP_Timings_read_parse_convert_10, TMP_Timings_write_11, TMP_Timings_total_12, TMP_Timings_print_report_13, $a, TMP_Timings_now_14, TMP_Timings_now_15; + + def.timers = def.log = nil; + + + Opal.def(self, '$initialize', TMP_Timings_initialize_1 = function $$initialize() { + var self = this; + + + self.log = $hash2([], {}); + return (self.timers = $hash2([], {})); + }, TMP_Timings_initialize_1.$$arity = 0); + + Opal.def(self, '$start', TMP_Timings_start_2 = function $$start(key) { + var self = this, $writer = nil; + + + $writer = [key, self.$now()]; + $send(self.timers, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + }, TMP_Timings_start_2.$$arity = 1); + + Opal.def(self, '$record', TMP_Timings_record_3 = function $$record(key) { + var self = this, $writer = nil; + + + $writer = [key, $rb_minus(self.$now(), self.timers.$delete(key))]; + $send(self.log, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + }, TMP_Timings_record_3.$$arity = 1); + + Opal.def(self, '$time', TMP_Timings_time_4 = function $$time($a) { + var $post_args, keys, TMP_5, self = this, time = nil; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + keys = $post_args;; + time = $send(keys, 'reduce', [0], (TMP_5 = function(sum, key){var self = TMP_5.$$s || this, $b; + if (self.log == null) self.log = nil; + + + + if (sum == null) { + sum = nil; + }; + + if (key == null) { + key = nil; + }; + return $rb_plus(sum, ($truthy($b = self.log['$[]'](key)) ? $b : 0));}, TMP_5.$$s = self, TMP_5.$$arity = 2, TMP_5)); + if ($truthy($rb_gt(time, 0))) { + return time + } else { + return nil + }; + }, TMP_Timings_time_4.$$arity = -1); + + Opal.def(self, '$read', TMP_Timings_read_6 = function $$read() { + var self = this; + + return self.$time("read") + }, TMP_Timings_read_6.$$arity = 0); + + Opal.def(self, '$parse', TMP_Timings_parse_7 = function $$parse() { + var self = this; + + return self.$time("parse") + }, TMP_Timings_parse_7.$$arity = 0); + + Opal.def(self, '$read_parse', TMP_Timings_read_parse_8 = function $$read_parse() { + var self = this; + + return self.$time("read", "parse") + }, TMP_Timings_read_parse_8.$$arity = 0); + + Opal.def(self, '$convert', TMP_Timings_convert_9 = function $$convert() { + var self = this; + + return self.$time("convert") + }, TMP_Timings_convert_9.$$arity = 0); + + Opal.def(self, '$read_parse_convert', TMP_Timings_read_parse_convert_10 = function $$read_parse_convert() { + var self = this; + + return self.$time("read", "parse", "convert") + }, TMP_Timings_read_parse_convert_10.$$arity = 0); + + Opal.def(self, '$write', TMP_Timings_write_11 = function $$write() { + var self = this; + + return self.$time("write") + }, TMP_Timings_write_11.$$arity = 0); + + Opal.def(self, '$total', TMP_Timings_total_12 = function $$total() { + var self = this; + + return self.$time("read", "parse", "convert", "write") + }, TMP_Timings_total_12.$$arity = 0); + + Opal.def(self, '$print_report', TMP_Timings_print_report_13 = function $$print_report(to, subject) { + var self = this; + if ($gvars.stdout == null) $gvars.stdout = nil; + + + + if (to == null) { + to = $gvars.stdout; + }; + + if (subject == null) { + subject = nil; + }; + if ($truthy(subject)) { + to.$puts("" + "Input file: " + (subject))}; + to.$puts("" + " Time to read and parse source: " + ("%05.5f"['$%'](self.$read_parse().$to_f()))); + to.$puts("" + " Time to convert document: " + ("%05.5f"['$%'](self.$convert().$to_f()))); + return to.$puts("" + " Total time (read, parse and convert): " + ("%05.5f"['$%'](self.$read_parse_convert().$to_f()))); + }, TMP_Timings_print_report_13.$$arity = -1); + if ($truthy(($truthy($a = $$$('::', 'Process')['$const_defined?']("CLOCK_MONOTONIC")) ? $$$('::', 'Process')['$respond_to?']("clock_gettime") : $a))) { + + Opal.const_set($nesting[0], 'CLOCK_ID', $$$($$$('::', 'Process'), 'CLOCK_MONOTONIC')); + return (Opal.def(self, '$now', TMP_Timings_now_14 = function $$now() { + var self = this; + + return $$$('::', 'Process').$clock_gettime($$($nesting, 'CLOCK_ID')) + }, TMP_Timings_now_14.$$arity = 0), nil) && 'now'; + } else { + return (Opal.def(self, '$now', TMP_Timings_now_15 = function $$now() { + var self = this; + + return $$$('::', 'Time').$now() + }, TMP_Timings_now_15.$$arity = 0), nil) && 'now' + }; + })($nesting[0], null, $nesting) + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/version"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module; + + return (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + Opal.const_set($nesting[0], 'VERSION', "1.5.8") + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/core_ext/nil_or_empty"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $truthy = Opal.truthy; + + Opal.add_stubs(['$method_defined?']); + + (function($base, $super, $parent_nesting) { + function $NilClass(){}; + var self = $NilClass = $klass($base, $super, 'NilClass', $NilClass); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + if ($truthy(self['$method_defined?']("nil_or_empty?"))) { + return nil + } else { + return Opal.alias(self, "nil_or_empty?", "nil?") + } + })($nesting[0], null, $nesting); + (function($base, $super, $parent_nesting) { + function $String(){}; + var self = $String = $klass($base, $super, 'String', $String); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + if ($truthy(self['$method_defined?']("nil_or_empty?"))) { + return nil + } else { + return Opal.alias(self, "nil_or_empty?", "empty?") + } + })($nesting[0], null, $nesting); + (function($base, $super, $parent_nesting) { + function $Array(){}; + var self = $Array = $klass($base, $super, 'Array', $Array); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + if ($truthy(self['$method_defined?']("nil_or_empty?"))) { + return nil + } else { + return Opal.alias(self, "nil_or_empty?", "empty?") + } + })($nesting[0], null, $nesting); + (function($base, $super, $parent_nesting) { + function $Hash(){}; + var self = $Hash = $klass($base, $super, 'Hash', $Hash); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + if ($truthy(self['$method_defined?']("nil_or_empty?"))) { + return nil + } else { + return Opal.alias(self, "nil_or_empty?", "empty?") + } + })($nesting[0], null, $nesting); + return (function($base, $super, $parent_nesting) { + function $Numeric(){}; + var self = $Numeric = $klass($base, $super, 'Numeric', $Numeric); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + if ($truthy(self['$method_defined?']("nil_or_empty?"))) { + return nil + } else { + return Opal.alias(self, "nil_or_empty?", "nil?") + } + })($nesting[0], null, $nesting); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/core_ext/regexp/is_match"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $truthy = Opal.truthy; + + Opal.add_stubs(['$method_defined?']); + return (function($base, $super, $parent_nesting) { + function $Regexp(){}; + var self = $Regexp = $klass($base, $super, 'Regexp', $Regexp); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + if ($truthy(self['$method_defined?']("match?"))) { + return nil + } else { + return Opal.alias(self, "match?", "===") + } + })($nesting[0], null, $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/core_ext/string/limit_bytesize"] = function(Opal) { + function $rb_lt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); + } + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $truthy = Opal.truthy; + + Opal.add_stubs(['$method_defined?', '$<', '$bytesize', '$valid_encoding?', '$force_encoding', '$byteslice', '$-']); + return (function($base, $super, $parent_nesting) { + function $String(){}; + var self = $String = $klass($base, $super, 'String', $String); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_String_limit_bytesize_1; + + if ($truthy(self['$method_defined?']("limit_bytesize"))) { + return nil + } else { + return (Opal.def(self, '$limit_bytesize', TMP_String_limit_bytesize_1 = function $$limit_bytesize(size) { + var $a, self = this, result = nil; + + + if ($truthy($rb_lt(size, self.$bytesize()))) { + } else { + return self + }; + while (!($truthy((result = self.$byteslice(0, size)).$force_encoding($$$($$$('::', 'Encoding'), 'UTF_8'))['$valid_encoding?']()))) { + size = $rb_minus(size, 1) + }; + return result; + }, TMP_String_limit_bytesize_1.$$arity = 1), nil) && 'limit_bytesize' + } + })($nesting[0], null, $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/core_ext/1.8.7/io/binread"] = function(Opal) { + var TMP_binread_1, self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $truthy = Opal.truthy, $send = Opal.send; + + Opal.add_stubs(['$respond_to?', '$open', '$==', '$seek', '$read']); + if ($truthy($$($nesting, 'IO')['$respond_to?']("binread"))) { + return nil + } else { + return (Opal.defs($$($nesting, 'IO'), '$binread', TMP_binread_1 = function $$binread(name, length, offset) { + var TMP_2, self = this; + + + + if (length == null) { + length = nil; + }; + + if (offset == null) { + offset = 0; + }; + return $send($$($nesting, 'File'), 'open', [name, "rb"], (TMP_2 = function(f){var self = TMP_2.$$s || this; + + + + if (f == null) { + f = nil; + }; + if (offset['$=='](0)) { + } else { + f.$seek(offset) + }; + if ($truthy(length)) { + + return f.$read(length); + } else { + return f.$read() + };}, TMP_2.$$s = self, TMP_2.$$arity = 1, TMP_2)); + }, TMP_binread_1.$$arity = -2), nil) && 'binread' + } +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/core_ext/1.8.7/io/write"] = function(Opal) { + var TMP_write_1, self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $truthy = Opal.truthy, $send = Opal.send; + + Opal.add_stubs(['$respond_to?', '$open', '$write']); + if ($truthy($$($nesting, 'IO')['$respond_to?']("write"))) { + return nil + } else { + return (Opal.defs($$($nesting, 'IO'), '$write', TMP_write_1 = function $$write(name, string, offset, opts) { + var TMP_2, self = this; + + + + if (offset == null) { + offset = 0; + }; + + if (opts == null) { + opts = nil; + }; + return $send($$($nesting, 'File'), 'open', [name, "w"], (TMP_2 = function(f){var self = TMP_2.$$s || this; + + + + if (f == null) { + f = nil; + }; + return f.$write(string);}, TMP_2.$$s = self, TMP_2.$$arity = 1, TMP_2)); + }, TMP_write_1.$$arity = -3), nil) && 'write' + } +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/core_ext"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $truthy = Opal.truthy; + + Opal.add_stubs(['$require', '$==', '$!=']); + + self.$require("asciidoctor/core_ext/nil_or_empty"); + self.$require("asciidoctor/core_ext/regexp/is_match"); + if ($truthy($$($nesting, 'RUBY_MIN_VERSION_1_9'))) { + + self.$require("asciidoctor/core_ext/string/limit_bytesize"); + if ($$($nesting, 'RUBY_ENGINE')['$==']("opal")) { + + self.$require("asciidoctor/core_ext/1.8.7/io/binread"); + return self.$require("asciidoctor/core_ext/1.8.7/io/write"); + } else { + return nil + }; + } else if ($truthy($$($nesting, 'RUBY_ENGINE')['$!=']("opal"))) { + return nil + } else { + return nil + }; +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/helpers"] = function(Opal) { + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + function $rb_times(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs * rhs : lhs['$*'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $truthy = Opal.truthy, $send = Opal.send, $gvars = Opal.gvars, $hash2 = Opal.hash2; + + Opal.add_stubs(['$require', '$include?', '$include', '$==', '$===', '$raise', '$warn', '$logger', '$chomp', '$message', '$normalize_lines_from_string', '$normalize_lines_array', '$empty?', '$unpack', '$[]', '$slice', '$join', '$map', '$each_line', '$encode', '$force_encoding', '$length', '$rstrip', '$[]=', '$-', '$encoding', '$nil_or_empty?', '$match?', '$=~', '$gsub', '$each_byte', '$sprintf', '$rindex', '$basename', '$extname', '$directory?', '$dirname', '$mkdir_p', '$mkdir', '$divmod', '$*']); + return (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + (function($base, $parent_nesting) { + function $Helpers() {}; + var self = $Helpers = $module($base, 'Helpers', $Helpers); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Helpers_require_library_1, TMP_Helpers_normalize_lines_2, TMP_Helpers_normalize_lines_array_3, TMP_Helpers_normalize_lines_from_string_8, TMP_Helpers_uriish$q_10, TMP_Helpers_uri_prefix_11, TMP_Helpers_uri_encode_12, TMP_Helpers_rootname_15, TMP_Helpers_basename_16, TMP_Helpers_mkdir_p_17, TMP_Helpers_int_to_roman_18; + + + Opal.defs(self, '$require_library', TMP_Helpers_require_library_1 = function $$require_library(name, gem_name, on_failure) { + var self = this, e = nil, $case = nil; + + + + if (gem_name == null) { + gem_name = true; + }; + + if (on_failure == null) { + on_failure = "abort"; + }; + try { + return self.$require(name) + } catch ($err) { + if (Opal.rescue($err, [$$$('::', 'LoadError')])) {e = $err; + try { + + if ($truthy(self['$include?']($$($nesting, 'Logging')))) { + } else { + self.$include($$($nesting, 'Logging')) + }; + if ($truthy(gem_name)) { + + if (gem_name['$=='](true)) { + gem_name = name}; + $case = on_failure; + if ("abort"['$===']($case)) {self.$raise($$$('::', 'LoadError'), "" + "asciidoctor: FAILED: required gem '" + (gem_name) + "' is not installed. Processing aborted.")} + else if ("warn"['$===']($case)) {self.$logger().$warn("" + "optional gem '" + (gem_name) + "' is not installed. Functionality disabled.")}; + } else { + $case = on_failure; + if ("abort"['$===']($case)) {self.$raise($$$('::', 'LoadError'), "" + "asciidoctor: FAILED: " + (e.$message().$chomp(".")) + ". Processing aborted.")} + else if ("warn"['$===']($case)) {self.$logger().$warn("" + (e.$message().$chomp(".")) + ". Functionality disabled.")} + }; + return nil; + } finally { Opal.pop_exception() } + } else { throw $err; } + }; + }, TMP_Helpers_require_library_1.$$arity = -2); + Opal.defs(self, '$normalize_lines', TMP_Helpers_normalize_lines_2 = function $$normalize_lines(data) { + var self = this; + + if ($truthy($$$('::', 'String')['$==='](data))) { + + return self.$normalize_lines_from_string(data); + } else { + + return self.$normalize_lines_array(data); + } + }, TMP_Helpers_normalize_lines_2.$$arity = 1); + Opal.defs(self, '$normalize_lines_array', TMP_Helpers_normalize_lines_array_3 = function $$normalize_lines_array(data) { + var TMP_4, TMP_5, TMP_6, TMP_7, self = this, leading_bytes = nil, first_line = nil, utf8 = nil, leading_2_bytes = nil, $writer = nil; + + + if ($truthy(data['$empty?']())) { + return data}; + leading_bytes = (first_line = data['$[]'](0)).$unpack("C3"); + if ($truthy($$($nesting, 'COERCE_ENCODING'))) { + + utf8 = $$$($$$('::', 'Encoding'), 'UTF_8'); + if ((leading_2_bytes = leading_bytes.$slice(0, 2))['$==']($$($nesting, 'BOM_BYTES_UTF_16LE'))) { + + data = data.$join(); + return $send(data.$force_encoding($$$($$$('::', 'Encoding'), 'UTF_16LE')).$slice(1, data.$length()).$encode(utf8).$each_line(), 'map', [], (TMP_4 = function(line){var self = TMP_4.$$s || this; + + + + if (line == null) { + line = nil; + }; + return line.$rstrip();}, TMP_4.$$s = self, TMP_4.$$arity = 1, TMP_4)); + } else if (leading_2_bytes['$==']($$($nesting, 'BOM_BYTES_UTF_16BE'))) { + + + $writer = [0, first_line.$force_encoding($$$($$$('::', 'Encoding'), 'UTF_16BE')).$slice(1, first_line.$length())]; + $send(data, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + return $send(data, 'map', [], (TMP_5 = function(line){var self = TMP_5.$$s || this; + + + + if (line == null) { + line = nil; + }; + return line.$force_encoding($$$($$$('::', 'Encoding'), 'UTF_16BE')).$encode(utf8).$rstrip();}, TMP_5.$$s = self, TMP_5.$$arity = 1, TMP_5)); + } else if (leading_bytes['$==']($$($nesting, 'BOM_BYTES_UTF_8'))) { + + $writer = [0, first_line.$force_encoding(utf8).$slice(1, first_line.$length())]; + $send(data, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + return $send(data, 'map', [], (TMP_6 = function(line){var self = TMP_6.$$s || this; + + + + if (line == null) { + line = nil; + }; + if (line.$encoding()['$=='](utf8)) { + return line.$rstrip() + } else { + return line.$force_encoding(utf8).$rstrip() + };}, TMP_6.$$s = self, TMP_6.$$arity = 1, TMP_6)); + } else { + + if (leading_bytes['$==']($$($nesting, 'BOM_BYTES_UTF_8'))) { + + $writer = [0, first_line.$slice(3, first_line.$length())]; + $send(data, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + return $send(data, 'map', [], (TMP_7 = function(line){var self = TMP_7.$$s || this; + + + + if (line == null) { + line = nil; + }; + return line.$rstrip();}, TMP_7.$$s = self, TMP_7.$$arity = 1, TMP_7)); + }; + }, TMP_Helpers_normalize_lines_array_3.$$arity = 1); + Opal.defs(self, '$normalize_lines_from_string', TMP_Helpers_normalize_lines_from_string_8 = function $$normalize_lines_from_string(data) { + var TMP_9, self = this, leading_bytes = nil, utf8 = nil, leading_2_bytes = nil; + + + if ($truthy(data['$nil_or_empty?']())) { + return []}; + leading_bytes = data.$unpack("C3"); + if ($truthy($$($nesting, 'COERCE_ENCODING'))) { + + utf8 = $$$($$$('::', 'Encoding'), 'UTF_8'); + if ((leading_2_bytes = leading_bytes.$slice(0, 2))['$==']($$($nesting, 'BOM_BYTES_UTF_16LE'))) { + data = data.$force_encoding($$$($$$('::', 'Encoding'), 'UTF_16LE')).$slice(1, data.$length()).$encode(utf8) + } else if (leading_2_bytes['$==']($$($nesting, 'BOM_BYTES_UTF_16BE'))) { + data = data.$force_encoding($$$($$$('::', 'Encoding'), 'UTF_16BE')).$slice(1, data.$length()).$encode(utf8) + } else if (leading_bytes['$==']($$($nesting, 'BOM_BYTES_UTF_8'))) { + data = (function() {if (data.$encoding()['$=='](utf8)) { + + return data.$slice(1, data.$length()); + } else { + + return data.$force_encoding(utf8).$slice(1, data.$length()); + }; return nil; })() + } else if (data.$encoding()['$=='](utf8)) { + } else { + data = data.$force_encoding(utf8) + }; + } else if (leading_bytes['$==']($$($nesting, 'BOM_BYTES_UTF_8'))) { + data = data.$slice(3, data.$length())}; + return $send(data.$each_line(), 'map', [], (TMP_9 = function(line){var self = TMP_9.$$s || this; + + + + if (line == null) { + line = nil; + }; + return line.$rstrip();}, TMP_9.$$s = self, TMP_9.$$arity = 1, TMP_9)); + }, TMP_Helpers_normalize_lines_from_string_8.$$arity = 1); + Opal.defs(self, '$uriish?', TMP_Helpers_uriish$q_10 = function(str) { + var $a, self = this; + + return ($truthy($a = str['$include?'](":")) ? $$($nesting, 'UriSniffRx')['$match?'](str) : $a) + }, TMP_Helpers_uriish$q_10.$$arity = 1); + Opal.defs(self, '$uri_prefix', TMP_Helpers_uri_prefix_11 = function $$uri_prefix(str) { + var $a, self = this; + + if ($truthy(($truthy($a = str['$include?'](":")) ? $$($nesting, 'UriSniffRx')['$=~'](str) : $a))) { + return (($a = $gvars['~']) === nil ? nil : $a['$[]'](0)) + } else { + return nil + } + }, TMP_Helpers_uri_prefix_11.$$arity = 1); + Opal.const_set($nesting[0], 'REGEXP_ENCODE_URI_CHARS', /[^\w\-.!~*';:@=+$,()\[\]]/); + Opal.defs(self, '$uri_encode', TMP_Helpers_uri_encode_12 = function $$uri_encode(str) { + var TMP_13, self = this; + + return $send(str, 'gsub', [$$($nesting, 'REGEXP_ENCODE_URI_CHARS')], (TMP_13 = function(){var self = TMP_13.$$s || this, $a, TMP_14; + + return $send((($a = $gvars['~']) === nil ? nil : $a['$[]'](0)).$each_byte(), 'map', [], (TMP_14 = function(c){var self = TMP_14.$$s || this; + + + + if (c == null) { + c = nil; + }; + return self.$sprintf("%%%02X", c);}, TMP_14.$$s = self, TMP_14.$$arity = 1, TMP_14)).$join()}, TMP_13.$$s = self, TMP_13.$$arity = 0, TMP_13)) + }, TMP_Helpers_uri_encode_12.$$arity = 1); + Opal.defs(self, '$rootname', TMP_Helpers_rootname_15 = function $$rootname(filename) { + var $a, self = this; + + return filename.$slice(0, ($truthy($a = filename.$rindex(".")) ? $a : filename.$length())) + }, TMP_Helpers_rootname_15.$$arity = 1); + Opal.defs(self, '$basename', TMP_Helpers_basename_16 = function $$basename(filename, drop_ext) { + var self = this; + + + + if (drop_ext == null) { + drop_ext = nil; + }; + if ($truthy(drop_ext)) { + return $$$('::', 'File').$basename(filename, (function() {if (drop_ext['$=='](true)) { + + return $$$('::', 'File').$extname(filename); + } else { + return drop_ext + }; return nil; })()) + } else { + return $$$('::', 'File').$basename(filename) + }; + }, TMP_Helpers_basename_16.$$arity = -2); + Opal.defs(self, '$mkdir_p', TMP_Helpers_mkdir_p_17 = function $$mkdir_p(dir) { + var self = this, parent_dir = nil; + + if ($truthy($$$('::', 'File')['$directory?'](dir))) { + return nil + } else { + + if ((parent_dir = $$$('::', 'File').$dirname(dir))['$=='](".")) { + } else { + self.$mkdir_p(parent_dir) + }; + + try { + return $$$('::', 'Dir').$mkdir(dir) + } catch ($err) { + if (Opal.rescue($err, [$$$('::', 'SystemCallError')])) { + try { + if ($truthy($$$('::', 'File')['$directory?'](dir))) { + return nil + } else { + return self.$raise() + } + } finally { Opal.pop_exception() } + } else { throw $err; } + };; + } + }, TMP_Helpers_mkdir_p_17.$$arity = 1); + Opal.const_set($nesting[0], 'ROMAN_NUMERALS', $hash2(["M", "CM", "D", "CD", "C", "XC", "L", "XL", "X", "IX", "V", "IV", "I"], {"M": 1000, "CM": 900, "D": 500, "CD": 400, "C": 100, "XC": 90, "L": 50, "XL": 40, "X": 10, "IX": 9, "V": 5, "IV": 4, "I": 1})); + Opal.defs(self, '$int_to_roman', TMP_Helpers_int_to_roman_18 = function $$int_to_roman(val) { + var TMP_19, self = this; + + return $send($$($nesting, 'ROMAN_NUMERALS'), 'map', [], (TMP_19 = function(l, i){var self = TMP_19.$$s || this, $a, $b, repeat = nil; + + + + if (l == null) { + l = nil; + }; + + if (i == null) { + i = nil; + }; + $b = val.$divmod(i), $a = Opal.to_ary($b), (repeat = ($a[0] == null ? nil : $a[0])), (val = ($a[1] == null ? nil : $a[1])), $b; + return $rb_times(l, repeat);}, TMP_19.$$s = self, TMP_19.$$arity = 2, TMP_19)).$join() + }, TMP_Helpers_int_to_roman_18.$$arity = 1); + })($nesting[0], $nesting) + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/substitutors"] = function(Opal) { + function $rb_plus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); + } + function $rb_gt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); + } + function $rb_times(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs * rhs : lhs['$*'](rhs); + } + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + function $rb_lt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $hash2 = Opal.hash2, $hash = Opal.hash, $truthy = Opal.truthy, $send = Opal.send, $gvars = Opal.gvars; + + Opal.add_stubs(['$freeze', '$+', '$keys', '$chr', '$attr_reader', '$empty?', '$!', '$===', '$[]', '$join', '$include?', '$extract_passthroughs', '$each', '$sub_specialchars', '$sub_quotes', '$sub_attributes', '$sub_replacements', '$sub_macros', '$highlight_source', '$sub_callouts', '$sub_post_replacements', '$warn', '$logger', '$restore_passthroughs', '$split', '$apply_subs', '$compat_mode', '$gsub', '$==', '$length', '$>', '$*', '$-', '$end_with?', '$slice', '$parse_quoted_text_attributes', '$size', '$[]=', '$unescape_brackets', '$resolve_pass_subs', '$start_with?', '$extract_inner_passthrough', '$to_sym', '$attributes', '$basebackend?', '$=~', '$to_i', '$convert', '$new', '$clear', '$match?', '$convert_quoted_text', '$do_replacement', '$sub', '$shift', '$store_attribute', '$!=', '$attribute_undefined', '$counter', '$key?', '$downcase', '$attribute_missing', '$tr_s', '$delete', '$reject', '$strip', '$index', '$min', '$compact', '$map', '$chop', '$unescape_bracketed_text', '$pop', '$rstrip', '$extensions', '$inline_macros?', '$inline_macros', '$regexp', '$instance', '$names', '$config', '$dup', '$nil_or_empty?', '$parse_attributes', '$process_method', '$register', '$tr', '$basename', '$split_simple_csv', '$normalize_string', '$!~', '$parse', '$uri_encode', '$sub_inline_xrefs', '$sub_inline_anchors', '$find', '$footnotes', '$id', '$text', '$style', '$lstrip', '$parse_into', '$extname', '$catalog', '$fetch', '$outfilesuffix', '$natural_xrefs', '$key', '$attr?', '$attr', '$to_s', '$read_next_id', '$callouts', '$<', '$<<', '$shorthand_property_syntax', '$concat', '$each_char', '$drop', '$&', '$resolve_subs', '$nil?', '$require_library', '$sub_source', '$resolve_lines_to_highlight', '$highlight', '$find_by_alias', '$find_by_mimetype', '$name', '$option?', '$count', '$to_a', '$uniq', '$sort', '$resolve_block_subs']); + return (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + (function($base, $parent_nesting) { + function $Substitutors() {}; + var self = $Substitutors = $module($base, 'Substitutors', $Substitutors); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Substitutors_apply_subs_1, TMP_Substitutors_apply_normal_subs_3, TMP_Substitutors_apply_title_subs_4, TMP_Substitutors_apply_reftext_subs_5, TMP_Substitutors_apply_header_subs_6, TMP_Substitutors_extract_passthroughs_7, TMP_Substitutors_extract_inner_passthrough_11, TMP_Substitutors_restore_passthroughs_12, TMP_Substitutors_sub_quotes_14, TMP_Substitutors_sub_replacements_17, TMP_Substitutors_sub_specialchars_20, TMP_Substitutors_sub_specialchars_21, TMP_Substitutors_do_replacement_23, TMP_Substitutors_sub_attributes_24, TMP_Substitutors_sub_macros_29, TMP_Substitutors_sub_inline_anchors_46, TMP_Substitutors_sub_inline_xrefs_49, TMP_Substitutors_sub_callouts_51, TMP_Substitutors_sub_post_replacements_53, TMP_Substitutors_convert_quoted_text_56, TMP_Substitutors_parse_quoted_text_attributes_57, TMP_Substitutors_parse_attributes_58, TMP_Substitutors_expand_subs_59, TMP_Substitutors_unescape_bracketed_text_61, TMP_Substitutors_normalize_string_62, TMP_Substitutors_unescape_brackets_63, TMP_Substitutors_split_simple_csv_64, TMP_Substitutors_resolve_subs_67, TMP_Substitutors_resolve_block_subs_69, TMP_Substitutors_resolve_pass_subs_70, TMP_Substitutors_highlight_source_71, TMP_Substitutors_resolve_lines_to_highlight_76, TMP_Substitutors_sub_source_78, TMP_Substitutors_lock_in_subs_79; + + + Opal.const_set($nesting[0], 'SpecialCharsRx', /[<&>]/); + Opal.const_set($nesting[0], 'SpecialCharsTr', $hash2([">", "<", "&"], {">": ">", "<": "<", "&": "&"})); + Opal.const_set($nesting[0], 'QuotedTextSniffRx', $hash(false, /[*_`#^~]/, true, /[*'_+#^~]/)); + Opal.const_set($nesting[0], 'BASIC_SUBS', ["specialcharacters"]).$freeze(); + Opal.const_set($nesting[0], 'HEADER_SUBS', ["specialcharacters", "attributes"]).$freeze(); + Opal.const_set($nesting[0], 'NORMAL_SUBS', ["specialcharacters", "quotes", "attributes", "replacements", "macros", "post_replacements"]).$freeze(); + Opal.const_set($nesting[0], 'NONE_SUBS', []).$freeze(); + Opal.const_set($nesting[0], 'TITLE_SUBS', ["specialcharacters", "quotes", "replacements", "macros", "attributes", "post_replacements"]).$freeze(); + Opal.const_set($nesting[0], 'REFTEXT_SUBS', ["specialcharacters", "quotes", "replacements"]).$freeze(); + Opal.const_set($nesting[0], 'VERBATIM_SUBS', ["specialcharacters", "callouts"]).$freeze(); + Opal.const_set($nesting[0], 'SUB_GROUPS', $hash2(["none", "normal", "verbatim", "specialchars"], {"none": $$($nesting, 'NONE_SUBS'), "normal": $$($nesting, 'NORMAL_SUBS'), "verbatim": $$($nesting, 'VERBATIM_SUBS'), "specialchars": $$($nesting, 'BASIC_SUBS')})); + Opal.const_set($nesting[0], 'SUB_HINTS', $hash2(["a", "m", "n", "p", "q", "r", "c", "v"], {"a": "attributes", "m": "macros", "n": "normal", "p": "post_replacements", "q": "quotes", "r": "replacements", "c": "specialcharacters", "v": "verbatim"})); + Opal.const_set($nesting[0], 'SUB_OPTIONS', $hash2(["block", "inline"], {"block": $rb_plus($rb_plus($$($nesting, 'SUB_GROUPS').$keys(), $$($nesting, 'NORMAL_SUBS')), ["callouts"]), "inline": $rb_plus($$($nesting, 'SUB_GROUPS').$keys(), $$($nesting, 'NORMAL_SUBS'))})); + Opal.const_set($nesting[0], 'SUB_HIGHLIGHT', ["coderay", "pygments"]); + if ($truthy($$$('::', 'RUBY_MIN_VERSION_1_9'))) { + + Opal.const_set($nesting[0], 'CAN', "\u0018"); + Opal.const_set($nesting[0], 'DEL', "\u007F"); + Opal.const_set($nesting[0], 'PASS_START', "\u0096"); + Opal.const_set($nesting[0], 'PASS_END', "\u0097"); + } else { + + Opal.const_set($nesting[0], 'CAN', (24).$chr()); + Opal.const_set($nesting[0], 'DEL', (127).$chr()); + Opal.const_set($nesting[0], 'PASS_START', (150).$chr()); + Opal.const_set($nesting[0], 'PASS_END', (151).$chr()); + }; + Opal.const_set($nesting[0], 'PassSlotRx', new RegExp("" + ($$($nesting, 'PASS_START')) + "(\\d+)" + ($$($nesting, 'PASS_END')))); + Opal.const_set($nesting[0], 'HighlightedPassSlotRx', new RegExp("" + "]*>" + ($$($nesting, 'PASS_START')) + "[^\\d]*(\\d+)[^\\d]*]*>" + ($$($nesting, 'PASS_END')) + "")); + Opal.const_set($nesting[0], 'RS', "\\"); + Opal.const_set($nesting[0], 'R_SB', "]"); + Opal.const_set($nesting[0], 'ESC_R_SB', "\\]"); + Opal.const_set($nesting[0], 'PLUS', "+"); + Opal.const_set($nesting[0], 'PygmentsWrapperDivRx', /
    (.*)<\/div>/m); + Opal.const_set($nesting[0], 'PygmentsWrapperPreRx', /]*?>(.*?)<\/pre>\s*/m); + self.$attr_reader("passthroughs"); + + Opal.def(self, '$apply_subs', TMP_Substitutors_apply_subs_1 = function $$apply_subs(text, subs) { + var $a, TMP_2, self = this, multiline = nil, has_passthroughs = nil; + if (self.passthroughs == null) self.passthroughs = nil; + + + + if (subs == null) { + subs = $$($nesting, 'NORMAL_SUBS'); + }; + if ($truthy(($truthy($a = text['$empty?']()) ? $a : subs['$!']()))) { + return text}; + if ($truthy((multiline = $$$('::', 'Array')['$==='](text)))) { + text = (function() {if ($truthy(text['$[]'](1))) { + + return text.$join($$($nesting, 'LF')); + } else { + return text['$[]'](0) + }; return nil; })()}; + if ($truthy((has_passthroughs = subs['$include?']("macros")))) { + + text = self.$extract_passthroughs(text); + if ($truthy(self.passthroughs['$empty?']())) { + has_passthroughs = false};}; + $send(subs, 'each', [], (TMP_2 = function(type){var self = TMP_2.$$s || this, $case = nil; + + + + if (type == null) { + type = nil; + }; + return (function() {$case = type; + if ("specialcharacters"['$===']($case)) {return (text = self.$sub_specialchars(text))} + else if ("quotes"['$===']($case)) {return (text = self.$sub_quotes(text))} + else if ("attributes"['$===']($case)) {if ($truthy(text['$include?']($$($nesting, 'ATTR_REF_HEAD')))) { + return (text = self.$sub_attributes(text)) + } else { + return nil + }} + else if ("replacements"['$===']($case)) {return (text = self.$sub_replacements(text))} + else if ("macros"['$===']($case)) {return (text = self.$sub_macros(text))} + else if ("highlight"['$===']($case)) {return (text = self.$highlight_source(text, subs['$include?']("callouts")))} + else if ("callouts"['$===']($case)) {if ($truthy(subs['$include?']("highlight"))) { + return nil + } else { + return (text = self.$sub_callouts(text)) + }} + else if ("post_replacements"['$===']($case)) {return (text = self.$sub_post_replacements(text))} + else {return self.$logger().$warn("" + "unknown substitution type " + (type))}})();}, TMP_2.$$s = self, TMP_2.$$arity = 1, TMP_2)); + if ($truthy(has_passthroughs)) { + text = self.$restore_passthroughs(text)}; + if ($truthy(multiline)) { + + return text.$split($$($nesting, 'LF'), -1); + } else { + return text + }; + }, TMP_Substitutors_apply_subs_1.$$arity = -2); + + Opal.def(self, '$apply_normal_subs', TMP_Substitutors_apply_normal_subs_3 = function $$apply_normal_subs(text) { + var self = this; + + return self.$apply_subs(text) + }, TMP_Substitutors_apply_normal_subs_3.$$arity = 1); + + Opal.def(self, '$apply_title_subs', TMP_Substitutors_apply_title_subs_4 = function $$apply_title_subs(title) { + var self = this; + + return self.$apply_subs(title, $$($nesting, 'TITLE_SUBS')) + }, TMP_Substitutors_apply_title_subs_4.$$arity = 1); + + Opal.def(self, '$apply_reftext_subs', TMP_Substitutors_apply_reftext_subs_5 = function $$apply_reftext_subs(text) { + var self = this; + + return self.$apply_subs(text, $$($nesting, 'REFTEXT_SUBS')) + }, TMP_Substitutors_apply_reftext_subs_5.$$arity = 1); + + Opal.def(self, '$apply_header_subs', TMP_Substitutors_apply_header_subs_6 = function $$apply_header_subs(text) { + var self = this; + + return self.$apply_subs(text, $$($nesting, 'HEADER_SUBS')) + }, TMP_Substitutors_apply_header_subs_6.$$arity = 1); + + Opal.def(self, '$extract_passthroughs', TMP_Substitutors_extract_passthroughs_7 = function $$extract_passthroughs(text) { + var $a, $b, TMP_8, TMP_9, TMP_10, self = this, compat_mode = nil, passes = nil, pass_inline_char1 = nil, pass_inline_char2 = nil, pass_inline_rx = nil; + if (self.document == null) self.document = nil; + if (self.passthroughs == null) self.passthroughs = nil; + + + compat_mode = self.document.$compat_mode(); + passes = self.passthroughs; + if ($truthy(($truthy($a = ($truthy($b = text['$include?']("++")) ? $b : text['$include?']("$$"))) ? $a : text['$include?']("ss:")))) { + text = $send(text, 'gsub', [$$($nesting, 'InlinePassMacroRx')], (TMP_8 = function(){var self = TMP_8.$$s || this, $c, m = nil, preceding = nil, boundary = nil, attributes = nil, escape_count = nil, content = nil, old_behavior = nil, subs = nil, pass_key = nil, $writer = nil; + if ($gvars["~"] == null) $gvars["~"] = nil; + + + m = $gvars["~"]; + preceding = nil; + if ($truthy((boundary = m['$[]'](4)))) { + + if ($truthy(($truthy($c = compat_mode) ? boundary['$==']("++") : $c))) { + return (function() {if ($truthy(m['$[]'](2))) { + return "" + (m['$[]'](1)) + "[" + (m['$[]'](2)) + "]" + (m['$[]'](3)) + "++" + (self.$extract_passthroughs(m['$[]'](5))) + "++" + } else { + return "" + (m['$[]'](1)) + (m['$[]'](3)) + "++" + (self.$extract_passthroughs(m['$[]'](5))) + "++" + }; return nil; })();}; + attributes = m['$[]'](2); + escape_count = m['$[]'](3).$length(); + content = m['$[]'](5); + old_behavior = false; + if ($truthy(attributes)) { + if ($truthy($rb_gt(escape_count, 0))) { + return "" + (m['$[]'](1)) + "[" + (attributes) + "]" + ($rb_times($$($nesting, 'RS'), $rb_minus(escape_count, 1))) + (boundary) + (m['$[]'](5)) + (boundary); + } else if (m['$[]'](1)['$==']($$($nesting, 'RS'))) { + + preceding = "" + "[" + (attributes) + "]"; + attributes = nil; + } else { + + if ($truthy((($c = boundary['$==']("++")) ? attributes['$end_with?']("x-") : boundary['$==']("++")))) { + + old_behavior = true; + attributes = attributes.$slice(0, $rb_minus(attributes.$length(), 2));}; + attributes = self.$parse_quoted_text_attributes(attributes); + } + } else if ($truthy($rb_gt(escape_count, 0))) { + return "" + ($rb_times($$($nesting, 'RS'), $rb_minus(escape_count, 1))) + (boundary) + (m['$[]'](5)) + (boundary);}; + subs = (function() {if (boundary['$==']("+++")) { + return [] + } else { + return $$($nesting, 'BASIC_SUBS') + }; return nil; })(); + pass_key = passes.$size(); + if ($truthy(attributes)) { + if ($truthy(old_behavior)) { + + $writer = [pass_key, $hash2(["text", "subs", "type", "attributes"], {"text": content, "subs": $$($nesting, 'NORMAL_SUBS'), "type": "monospaced", "attributes": attributes})]; + $send(passes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + } else { + + $writer = [pass_key, $hash2(["text", "subs", "type", "attributes"], {"text": content, "subs": subs, "type": "unquoted", "attributes": attributes})]; + $send(passes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + } + } else { + + $writer = [pass_key, $hash2(["text", "subs"], {"text": content, "subs": subs})]; + $send(passes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + } else { + + if (m['$[]'](6)['$==']($$($nesting, 'RS'))) { + return m['$[]'](0).$slice(1, m['$[]'](0).$length());}; + + $writer = [(pass_key = passes.$size()), $hash2(["text", "subs"], {"text": self.$unescape_brackets(m['$[]'](8)), "subs": (function() {if ($truthy(m['$[]'](7))) { + + return self.$resolve_pass_subs(m['$[]'](7)); + } else { + return nil + }; return nil; })()})]; + $send(passes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + }; + return "" + (preceding) + ($$($nesting, 'PASS_START')) + (pass_key) + ($$($nesting, 'PASS_END'));}, TMP_8.$$s = self, TMP_8.$$arity = 0, TMP_8))}; + $b = $$($nesting, 'InlinePassRx')['$[]'](compat_mode), $a = Opal.to_ary($b), (pass_inline_char1 = ($a[0] == null ? nil : $a[0])), (pass_inline_char2 = ($a[1] == null ? nil : $a[1])), (pass_inline_rx = ($a[2] == null ? nil : $a[2])), $b; + if ($truthy(($truthy($a = text['$include?'](pass_inline_char1)) ? $a : ($truthy($b = pass_inline_char2) ? text['$include?'](pass_inline_char2) : $b)))) { + text = $send(text, 'gsub', [pass_inline_rx], (TMP_9 = function(){var self = TMP_9.$$s || this, $c, m = nil, preceding = nil, attributes = nil, quoted_text = nil, escape_mark = nil, format_mark = nil, content = nil, old_behavior = nil, pass_key = nil, $writer = nil, subs = nil; + if ($gvars["~"] == null) $gvars["~"] = nil; + + + m = $gvars["~"]; + preceding = m['$[]'](1); + attributes = m['$[]'](2); + if ($truthy((quoted_text = m['$[]'](3))['$start_with?']($$($nesting, 'RS')))) { + escape_mark = $$($nesting, 'RS')}; + format_mark = m['$[]'](4); + content = m['$[]'](5); + if ($truthy(compat_mode)) { + old_behavior = true + } else if ($truthy((old_behavior = ($truthy($c = attributes) ? attributes['$end_with?']("x-") : $c)))) { + attributes = attributes.$slice(0, $rb_minus(attributes.$length(), 2))}; + if ($truthy(attributes)) { + + if ($truthy((($c = format_mark['$==']("`")) ? old_behavior['$!']() : format_mark['$==']("`")))) { + return self.$extract_inner_passthrough(content, "" + (preceding) + "[" + (attributes) + "]" + (escape_mark), attributes);}; + if ($truthy(escape_mark)) { + return "" + (preceding) + "[" + (attributes) + "]" + (quoted_text.$slice(1, quoted_text.$length())); + } else if (preceding['$==']($$($nesting, 'RS'))) { + + preceding = "" + "[" + (attributes) + "]"; + attributes = nil; + } else { + attributes = self.$parse_quoted_text_attributes(attributes) + }; + } else if ($truthy((($c = format_mark['$==']("`")) ? old_behavior['$!']() : format_mark['$==']("`")))) { + return self.$extract_inner_passthrough(content, "" + (preceding) + (escape_mark)); + } else if ($truthy(escape_mark)) { + return "" + (preceding) + (quoted_text.$slice(1, quoted_text.$length()));}; + pass_key = passes.$size(); + if ($truthy(compat_mode)) { + + $writer = [pass_key, $hash2(["text", "subs", "attributes", "type"], {"text": content, "subs": $$($nesting, 'BASIC_SUBS'), "attributes": attributes, "type": "monospaced"})]; + $send(passes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + } else if ($truthy(attributes)) { + if ($truthy(old_behavior)) { + + subs = (function() {if (format_mark['$==']("`")) { + return $$($nesting, 'BASIC_SUBS') + } else { + return $$($nesting, 'NORMAL_SUBS') + }; return nil; })(); + + $writer = [pass_key, $hash2(["text", "subs", "attributes", "type"], {"text": content, "subs": subs, "attributes": attributes, "type": "monospaced"})]; + $send(passes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + } else { + + $writer = [pass_key, $hash2(["text", "subs", "attributes", "type"], {"text": content, "subs": $$($nesting, 'BASIC_SUBS'), "attributes": attributes, "type": "unquoted"})]; + $send(passes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + } + } else { + + $writer = [pass_key, $hash2(["text", "subs"], {"text": content, "subs": $$($nesting, 'BASIC_SUBS')})]; + $send(passes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + return "" + (preceding) + ($$($nesting, 'PASS_START')) + (pass_key) + ($$($nesting, 'PASS_END'));}, TMP_9.$$s = self, TMP_9.$$arity = 0, TMP_9))}; + if ($truthy(($truthy($a = text['$include?'](":")) ? ($truthy($b = text['$include?']("stem:")) ? $b : text['$include?']("math:")) : $a))) { + text = $send(text, 'gsub', [$$($nesting, 'InlineStemMacroRx')], (TMP_10 = function(){var self = TMP_10.$$s || this, $c, m = nil, type = nil, content = nil, subs = nil, $writer = nil, pass_key = nil; + if (self.document == null) self.document = nil; + if ($gvars["~"] == null) $gvars["~"] = nil; + + + m = $gvars["~"]; + if ($truthy((($c = $gvars['~']) === nil ? nil : $c['$[]'](0))['$start_with?']($$($nesting, 'RS')))) { + return m['$[]'](0).$slice(1, m['$[]'](0).$length());}; + if ((type = m['$[]'](1).$to_sym())['$==']("stem")) { + type = $$($nesting, 'STEM_TYPE_ALIASES')['$[]'](self.document.$attributes()['$[]']("stem")).$to_sym()}; + content = self.$unescape_brackets(m['$[]'](3)); + subs = (function() {if ($truthy(m['$[]'](2))) { + + return self.$resolve_pass_subs(m['$[]'](2)); + } else { + + if ($truthy(self.document['$basebackend?']("html"))) { + return $$($nesting, 'BASIC_SUBS') + } else { + return nil + }; + }; return nil; })(); + + $writer = [(pass_key = passes.$size()), $hash2(["text", "subs", "type"], {"text": content, "subs": subs, "type": type})]; + $send(passes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + return "" + ($$($nesting, 'PASS_START')) + (pass_key) + ($$($nesting, 'PASS_END'));}, TMP_10.$$s = self, TMP_10.$$arity = 0, TMP_10))}; + return text; + }, TMP_Substitutors_extract_passthroughs_7.$$arity = 1); + + Opal.def(self, '$extract_inner_passthrough', TMP_Substitutors_extract_inner_passthrough_11 = function $$extract_inner_passthrough(text, pre, attributes) { + var $a, $b, self = this, $writer = nil, pass_key = nil; + if (self.passthroughs == null) self.passthroughs = nil; + + + + if (attributes == null) { + attributes = nil; + }; + if ($truthy(($truthy($a = ($truthy($b = text['$end_with?']("+")) ? text['$start_with?']("+", "\\+") : $b)) ? $$($nesting, 'SinglePlusInlinePassRx')['$=~'](text) : $a))) { + if ($truthy((($a = $gvars['~']) === nil ? nil : $a['$[]'](1)))) { + return "" + (pre) + "`+" + ((($a = $gvars['~']) === nil ? nil : $a['$[]'](2))) + "+`" + } else { + + + $writer = [(pass_key = self.passthroughs.$size()), (function() {if ($truthy(attributes)) { + return $hash2(["text", "subs", "attributes", "type"], {"text": (($a = $gvars['~']) === nil ? nil : $a['$[]'](2)), "subs": $$($nesting, 'BASIC_SUBS'), "attributes": attributes, "type": "unquoted"}) + } else { + return $hash2(["text", "subs"], {"text": (($a = $gvars['~']) === nil ? nil : $a['$[]'](2)), "subs": $$($nesting, 'BASIC_SUBS')}) + }; return nil; })()]; + $send(self.passthroughs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + return "" + (pre) + "`" + ($$($nesting, 'PASS_START')) + (pass_key) + ($$($nesting, 'PASS_END')) + "`"; + } + } else { + return "" + (pre) + "`" + (text) + "`" + }; + }, TMP_Substitutors_extract_inner_passthrough_11.$$arity = -3); + + Opal.def(self, '$restore_passthroughs', TMP_Substitutors_restore_passthroughs_12 = function $$restore_passthroughs(text, outer) { + var TMP_13, self = this, passes = nil; + if (self.passthroughs == null) self.passthroughs = nil; + + + + if (outer == null) { + outer = true; + }; + return (function() { try { + + passes = self.passthroughs; + return $send(text, 'gsub', [$$($nesting, 'PassSlotRx')], (TMP_13 = function(){var self = TMP_13.$$s || this, $a, pass = nil, subbed_text = nil, type = nil; + + + pass = passes['$[]']((($a = $gvars['~']) === nil ? nil : $a['$[]'](1)).$to_i()); + subbed_text = self.$apply_subs(pass['$[]']("text"), pass['$[]']("subs")); + if ($truthy((type = pass['$[]']("type")))) { + subbed_text = $$($nesting, 'Inline').$new(self, "quoted", subbed_text, $hash2(["type", "attributes"], {"type": type, "attributes": pass['$[]']("attributes")})).$convert()}; + if ($truthy(subbed_text['$include?']($$($nesting, 'PASS_START')))) { + return self.$restore_passthroughs(subbed_text, false) + } else { + return subbed_text + };}, TMP_13.$$s = self, TMP_13.$$arity = 0, TMP_13)); + } finally { + (function() {if ($truthy(outer)) { + return passes.$clear() + } else { + return nil + }; return nil; })() + }; })(); + }, TMP_Substitutors_restore_passthroughs_12.$$arity = -2); + if ($$($nesting, 'RUBY_ENGINE')['$==']("opal")) { + + + Opal.def(self, '$sub_quotes', TMP_Substitutors_sub_quotes_14 = function $$sub_quotes(text) { + var TMP_15, self = this, compat = nil; + if (self.document == null) self.document = nil; + + + if ($truthy($$($nesting, 'QuotedTextSniffRx')['$[]']((compat = self.document.$compat_mode()))['$match?'](text))) { + $send($$($nesting, 'QUOTE_SUBS')['$[]'](compat), 'each', [], (TMP_15 = function(type, scope, pattern){var self = TMP_15.$$s || this, TMP_16; + + + + if (type == null) { + type = nil; + }; + + if (scope == null) { + scope = nil; + }; + + if (pattern == null) { + pattern = nil; + }; + return (text = $send(text, 'gsub', [pattern], (TMP_16 = function(){var self = TMP_16.$$s || this; + if ($gvars["~"] == null) $gvars["~"] = nil; + + return self.$convert_quoted_text($gvars["~"], type, scope)}, TMP_16.$$s = self, TMP_16.$$arity = 0, TMP_16)));}, TMP_15.$$s = self, TMP_15.$$arity = 3, TMP_15))}; + return text; + }, TMP_Substitutors_sub_quotes_14.$$arity = 1); + + Opal.def(self, '$sub_replacements', TMP_Substitutors_sub_replacements_17 = function $$sub_replacements(text) { + var TMP_18, self = this; + + + if ($truthy($$($nesting, 'ReplaceableTextRx')['$match?'](text))) { + $send($$($nesting, 'REPLACEMENTS'), 'each', [], (TMP_18 = function(pattern, replacement, restore){var self = TMP_18.$$s || this, TMP_19; + + + + if (pattern == null) { + pattern = nil; + }; + + if (replacement == null) { + replacement = nil; + }; + + if (restore == null) { + restore = nil; + }; + return (text = $send(text, 'gsub', [pattern], (TMP_19 = function(){var self = TMP_19.$$s || this; + if ($gvars["~"] == null) $gvars["~"] = nil; + + return self.$do_replacement($gvars["~"], replacement, restore)}, TMP_19.$$s = self, TMP_19.$$arity = 0, TMP_19)));}, TMP_18.$$s = self, TMP_18.$$arity = 3, TMP_18))}; + return text; + }, TMP_Substitutors_sub_replacements_17.$$arity = 1); + } else { + nil + }; + if ($truthy($$$('::', 'RUBY_MIN_VERSION_1_9'))) { + + Opal.def(self, '$sub_specialchars', TMP_Substitutors_sub_specialchars_20 = function $$sub_specialchars(text) { + var $a, $b, self = this; + + if ($truthy(($truthy($a = ($truthy($b = text['$include?']("<")) ? $b : text['$include?']("&"))) ? $a : text['$include?'](">")))) { + + return text.$gsub($$($nesting, 'SpecialCharsRx'), $$($nesting, 'SpecialCharsTr')); + } else { + return text + } + }, TMP_Substitutors_sub_specialchars_20.$$arity = 1) + } else { + + Opal.def(self, '$sub_specialchars', TMP_Substitutors_sub_specialchars_21 = function $$sub_specialchars(text) { + var $a, $b, TMP_22, self = this; + + if ($truthy(($truthy($a = ($truthy($b = text['$include?']("<")) ? $b : text['$include?']("&"))) ? $a : text['$include?'](">")))) { + + return $send(text, 'gsub', [$$($nesting, 'SpecialCharsRx')], (TMP_22 = function(){var self = TMP_22.$$s || this, $c; + + return $$($nesting, 'SpecialCharsTr')['$[]']((($c = $gvars['~']) === nil ? nil : $c['$[]'](0)))}, TMP_22.$$s = self, TMP_22.$$arity = 0, TMP_22)); + } else { + return text + } + }, TMP_Substitutors_sub_specialchars_21.$$arity = 1) + }; + Opal.alias(self, "sub_specialcharacters", "sub_specialchars"); + + Opal.def(self, '$do_replacement', TMP_Substitutors_do_replacement_23 = function $$do_replacement(m, replacement, restore) { + var self = this, captured = nil, $case = nil; + + if ($truthy((captured = m['$[]'](0))['$include?']($$($nesting, 'RS')))) { + return captured.$sub($$($nesting, 'RS'), "") + } else { + return (function() {$case = restore; + if ("none"['$===']($case)) {return replacement} + else if ("bounding"['$===']($case)) {return "" + (m['$[]'](1)) + (replacement) + (m['$[]'](2))} + else {return "" + (m['$[]'](1)) + (replacement)}})() + } + }, TMP_Substitutors_do_replacement_23.$$arity = 3); + + Opal.def(self, '$sub_attributes', TMP_Substitutors_sub_attributes_24 = function $$sub_attributes(text, opts) { + var TMP_25, TMP_26, TMP_27, TMP_28, self = this, doc_attrs = nil, drop = nil, drop_line = nil, drop_empty_line = nil, attribute_undefined = nil, attribute_missing = nil, lines = nil; + if (self.document == null) self.document = nil; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + doc_attrs = self.document.$attributes(); + drop = (drop_line = (drop_empty_line = (attribute_undefined = (attribute_missing = nil)))); + text = $send(text, 'gsub', [$$($nesting, 'AttributeReferenceRx')], (TMP_25 = function(){var self = TMP_25.$$s || this, $a, $b, $c, $case = nil, args = nil, _ = nil, value = nil, key = nil; + if (self.document == null) self.document = nil; + + if ($truthy(($truthy($a = (($b = $gvars['~']) === nil ? nil : $b['$[]'](1))['$==']($$($nesting, 'RS'))) ? $a : (($b = $gvars['~']) === nil ? nil : $b['$[]'](4))['$==']($$($nesting, 'RS'))))) { + return "" + "{" + ((($a = $gvars['~']) === nil ? nil : $a['$[]'](2))) + "}" + } else if ($truthy((($a = $gvars['~']) === nil ? nil : $a['$[]'](3)))) { + return (function() {$case = (args = (($a = $gvars['~']) === nil ? nil : $a['$[]'](2)).$split(":", 3)).$shift(); + if ("set"['$===']($case)) { + $b = $$($nesting, 'Parser').$store_attribute(args['$[]'](0), ($truthy($c = args['$[]'](1)) ? $c : ""), self.document), $a = Opal.to_ary($b), (_ = ($a[0] == null ? nil : $a[0])), (value = ($a[1] == null ? nil : $a[1])), $b; + if ($truthy(($truthy($a = value) ? $a : (attribute_undefined = ($truthy($b = attribute_undefined) ? $b : ($truthy($c = doc_attrs['$[]']("attribute-undefined")) ? $c : $$($nesting, 'Compliance').$attribute_undefined())))['$!=']("drop-line")))) { + return (drop = (drop_empty_line = $$($nesting, 'DEL'))) + } else { + return (drop = (drop_line = $$($nesting, 'CAN'))) + };} + else if ("counter2"['$===']($case)) { + $send(self.document, 'counter', Opal.to_a(args)); + return (drop = (drop_empty_line = $$($nesting, 'DEL')));} + else {return $send(self.document, 'counter', Opal.to_a(args))}})() + } else if ($truthy(doc_attrs['$key?']((key = (($a = $gvars['~']) === nil ? nil : $a['$[]'](2)).$downcase())))) { + return doc_attrs['$[]'](key) + } else if ($truthy((value = $$($nesting, 'INTRINSIC_ATTRIBUTES')['$[]'](key)))) { + return value + } else { + return (function() {$case = (attribute_missing = ($truthy($a = attribute_missing) ? $a : ($truthy($b = ($truthy($c = opts['$[]']("attribute_missing")) ? $c : doc_attrs['$[]']("attribute-missing"))) ? $b : $$($nesting, 'Compliance').$attribute_missing()))); + if ("drop"['$===']($case)) {return (drop = (drop_empty_line = $$($nesting, 'DEL')))} + else if ("drop-line"['$===']($case)) { + self.$logger().$warn("" + "dropping line containing reference to missing attribute: " + (key)); + return (drop = (drop_line = $$($nesting, 'CAN')));} + else if ("warn"['$===']($case)) { + self.$logger().$warn("" + "skipping reference to missing attribute: " + (key)); + return (($a = $gvars['~']) === nil ? nil : $a['$[]'](0));} + else {return (($a = $gvars['~']) === nil ? nil : $a['$[]'](0))}})() + }}, TMP_25.$$s = self, TMP_25.$$arity = 0, TMP_25)); + if ($truthy(drop)) { + if ($truthy(drop_empty_line)) { + + lines = text.$tr_s($$($nesting, 'DEL'), $$($nesting, 'DEL')).$split($$($nesting, 'LF'), -1); + if ($truthy(drop_line)) { + return $send(lines, 'reject', [], (TMP_26 = function(line){var self = TMP_26.$$s || this, $a, $b, $c; + + + + if (line == null) { + line = nil; + }; + return ($truthy($a = ($truthy($b = ($truthy($c = line['$==']($$($nesting, 'DEL'))) ? $c : line['$==']($$($nesting, 'CAN')))) ? $b : line['$start_with?']($$($nesting, 'CAN')))) ? $a : line['$include?']($$($nesting, 'CAN')));}, TMP_26.$$s = self, TMP_26.$$arity = 1, TMP_26)).$join($$($nesting, 'LF')).$delete($$($nesting, 'DEL')) + } else { + return $send(lines, 'reject', [], (TMP_27 = function(line){var self = TMP_27.$$s || this; + + + + if (line == null) { + line = nil; + }; + return line['$==']($$($nesting, 'DEL'));}, TMP_27.$$s = self, TMP_27.$$arity = 1, TMP_27)).$join($$($nesting, 'LF')).$delete($$($nesting, 'DEL')) + }; + } else if ($truthy(text['$include?']($$($nesting, 'LF')))) { + return $send(text.$split($$($nesting, 'LF'), -1), 'reject', [], (TMP_28 = function(line){var self = TMP_28.$$s || this, $a, $b; + + + + if (line == null) { + line = nil; + }; + return ($truthy($a = ($truthy($b = line['$==']($$($nesting, 'CAN'))) ? $b : line['$start_with?']($$($nesting, 'CAN')))) ? $a : line['$include?']($$($nesting, 'CAN')));}, TMP_28.$$s = self, TMP_28.$$arity = 1, TMP_28)).$join($$($nesting, 'LF')) + } else { + return "" + } + } else { + return text + }; + }, TMP_Substitutors_sub_attributes_24.$$arity = -2); + + Opal.def(self, '$sub_macros', TMP_Substitutors_sub_macros_29 = function $$sub_macros(text) {try { + + var $a, $b, TMP_30, TMP_33, TMP_35, TMP_37, TMP_39, TMP_40, TMP_41, TMP_42, TMP_43, TMP_44, self = this, found = nil, found_square_bracket = nil, $writer = nil, found_colon = nil, found_macroish = nil, found_macroish_short = nil, doc_attrs = nil, doc = nil, extensions = nil; + if (self.document == null) self.document = nil; + + + found = $hash2([], {}); + found_square_bracket = (($writer = ["square_bracket", text['$include?']("[")]), $send(found, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]); + found_colon = text['$include?'](":"); + found_macroish = (($writer = ["macroish", ($truthy($a = found_square_bracket) ? found_colon : $a)]), $send(found, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]); + found_macroish_short = ($truthy($a = found_macroish) ? text['$include?'](":[") : $a); + doc_attrs = (doc = self.document).$attributes(); + if ($truthy(doc_attrs['$key?']("experimental"))) { + + if ($truthy(($truthy($a = found_macroish_short) ? ($truthy($b = text['$include?']("kbd:")) ? $b : text['$include?']("btn:")) : $a))) { + text = $send(text, 'gsub', [$$($nesting, 'InlineKbdBtnMacroRx')], (TMP_30 = function(){var self = TMP_30.$$s || this, $c, TMP_31, TMP_32, keys = nil, delim_idx = nil, delim = nil; + + if ($truthy((($c = $gvars['~']) === nil ? nil : $c['$[]'](1)))) { + return (($c = $gvars['~']) === nil ? nil : $c['$[]'](0)).$slice(1, (($c = $gvars['~']) === nil ? nil : $c['$[]'](0)).$length()) + } else if ((($c = $gvars['~']) === nil ? nil : $c['$[]'](2))['$==']("kbd")) { + + if ($truthy((keys = (($c = $gvars['~']) === nil ? nil : $c['$[]'](3)).$strip())['$include?']($$($nesting, 'R_SB')))) { + keys = keys.$gsub($$($nesting, 'ESC_R_SB'), $$($nesting, 'R_SB'))}; + if ($truthy(($truthy($c = $rb_gt(keys.$length(), 1)) ? (delim_idx = (function() {if ($truthy((delim_idx = keys.$index(",", 1)))) { + return [delim_idx, keys.$index("+", 1)].$compact().$min() + } else { + + return keys.$index("+", 1); + }; return nil; })()) : $c))) { + + delim = keys.$slice(delim_idx, 1); + if ($truthy(keys['$end_with?'](delim))) { + + keys = $send(keys.$chop().$split(delim, -1), 'map', [], (TMP_31 = function(key){var self = TMP_31.$$s || this; + + + + if (key == null) { + key = nil; + }; + return key.$strip();}, TMP_31.$$s = self, TMP_31.$$arity = 1, TMP_31)); + + $writer = [-1, "" + (keys['$[]'](-1)) + (delim)]; + $send(keys, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + } else { + keys = $send(keys.$split(delim), 'map', [], (TMP_32 = function(key){var self = TMP_32.$$s || this; + + + + if (key == null) { + key = nil; + }; + return key.$strip();}, TMP_32.$$s = self, TMP_32.$$arity = 1, TMP_32)) + }; + } else { + keys = [keys] + }; + return $$($nesting, 'Inline').$new(self, "kbd", nil, $hash2(["attributes"], {"attributes": $hash2(["keys"], {"keys": keys})})).$convert(); + } else { + return $$($nesting, 'Inline').$new(self, "button", self.$unescape_bracketed_text((($c = $gvars['~']) === nil ? nil : $c['$[]'](3)))).$convert() + }}, TMP_30.$$s = self, TMP_30.$$arity = 0, TMP_30))}; + if ($truthy(($truthy($a = found_macroish) ? text['$include?']("menu:") : $a))) { + text = $send(text, 'gsub', [$$($nesting, 'InlineMenuMacroRx')], (TMP_33 = function(){var self = TMP_33.$$s || this, $c, TMP_34, m = nil, menu = nil, items = nil, delim = nil, submenus = nil, menuitem = nil; + if ($gvars["~"] == null) $gvars["~"] = nil; + + + m = $gvars["~"]; + if ($truthy((($c = $gvars['~']) === nil ? nil : $c['$[]'](0))['$start_with?']($$($nesting, 'RS')))) { + return m['$[]'](0).$slice(1, m['$[]'](0).$length());}; + $c = [m['$[]'](1), m['$[]'](2)], (menu = $c[0]), (items = $c[1]), $c; + if ($truthy(items)) { + + if ($truthy(items['$include?']($$($nesting, 'R_SB')))) { + items = items.$gsub($$($nesting, 'ESC_R_SB'), $$($nesting, 'R_SB'))}; + if ($truthy((delim = (function() {if ($truthy(items['$include?'](">"))) { + return ">" + } else { + + if ($truthy(items['$include?'](","))) { + return "," + } else { + return nil + }; + }; return nil; })()))) { + + submenus = $send(items.$split(delim), 'map', [], (TMP_34 = function(it){var self = TMP_34.$$s || this; + + + + if (it == null) { + it = nil; + }; + return it.$strip();}, TMP_34.$$s = self, TMP_34.$$arity = 1, TMP_34)); + menuitem = submenus.$pop(); + } else { + $c = [[], items.$rstrip()], (submenus = $c[0]), (menuitem = $c[1]), $c + }; + } else { + $c = [[], nil], (submenus = $c[0]), (menuitem = $c[1]), $c + }; + return $$($nesting, 'Inline').$new(self, "menu", nil, $hash2(["attributes"], {"attributes": $hash2(["menu", "submenus", "menuitem"], {"menu": menu, "submenus": submenus, "menuitem": menuitem})})).$convert();}, TMP_33.$$s = self, TMP_33.$$arity = 0, TMP_33))}; + if ($truthy(($truthy($a = text['$include?']("\"")) ? text['$include?'](">") : $a))) { + text = $send(text, 'gsub', [$$($nesting, 'InlineMenuRx')], (TMP_35 = function(){var self = TMP_35.$$s || this, $c, $d, TMP_36, m = nil, input = nil, menu = nil, submenus = nil, menuitem = nil; + if ($gvars["~"] == null) $gvars["~"] = nil; + + + m = $gvars["~"]; + if ($truthy((($c = $gvars['~']) === nil ? nil : $c['$[]'](0))['$start_with?']($$($nesting, 'RS')))) { + return m['$[]'](0).$slice(1, m['$[]'](0).$length());}; + input = m['$[]'](1); + $d = $send(input.$split(">"), 'map', [], (TMP_36 = function(it){var self = TMP_36.$$s || this; + + + + if (it == null) { + it = nil; + }; + return it.$strip();}, TMP_36.$$s = self, TMP_36.$$arity = 1, TMP_36)), $c = Opal.to_ary($d), (menu = ($c[0] == null ? nil : $c[0])), (submenus = $slice.call($c, 1)), $d; + menuitem = submenus.$pop(); + return $$($nesting, 'Inline').$new(self, "menu", nil, $hash2(["attributes"], {"attributes": $hash2(["menu", "submenus", "menuitem"], {"menu": menu, "submenus": submenus, "menuitem": menuitem})})).$convert();}, TMP_35.$$s = self, TMP_35.$$arity = 0, TMP_35))};}; + if ($truthy(($truthy($a = (extensions = doc.$extensions())) ? extensions['$inline_macros?']() : $a))) { + $send(extensions.$inline_macros(), 'each', [], (TMP_37 = function(extension){var self = TMP_37.$$s || this, TMP_38; + + + + if (extension == null) { + extension = nil; + }; + return (text = $send(text, 'gsub', [extension.$instance().$regexp()], (TMP_38 = function(){var self = TMP_38.$$s || this, $c, m = nil, target = nil, content = nil, extconf = nil, attributes = nil, replacement = nil; + if ($gvars["~"] == null) $gvars["~"] = nil; + + + m = $gvars["~"]; + if ($truthy((($c = $gvars['~']) === nil ? nil : $c['$[]'](0))['$start_with?']($$($nesting, 'RS')))) { + return m['$[]'](0).$slice(1, m['$[]'](0).$length());}; + if ($truthy((function() { try { + return m.$names() + } catch ($err) { + if (Opal.rescue($err, [$$($nesting, 'StandardError')])) { + try { + return [] + } finally { Opal.pop_exception() } + } else { throw $err; } + }})()['$empty?']())) { + $c = [m['$[]'](1), m['$[]'](2), extension.$config()], (target = $c[0]), (content = $c[1]), (extconf = $c[2]), $c + } else { + $c = [(function() { try { + return m['$[]']("target") + } catch ($err) { + if (Opal.rescue($err, [$$($nesting, 'StandardError')])) { + try { + return nil + } finally { Opal.pop_exception() } + } else { throw $err; } + }})(), (function() { try { + return m['$[]']("content") + } catch ($err) { + if (Opal.rescue($err, [$$($nesting, 'StandardError')])) { + try { + return nil + } finally { Opal.pop_exception() } + } else { throw $err; } + }})(), extension.$config()], (target = $c[0]), (content = $c[1]), (extconf = $c[2]), $c + }; + attributes = (function() {if ($truthy((attributes = extconf['$[]']("default_attrs")))) { + return attributes.$dup() + } else { + return $hash2([], {}) + }; return nil; })(); + if ($truthy(content['$nil_or_empty?']())) { + if ($truthy(($truthy($c = content) ? extconf['$[]']("content_model")['$!=']("attributes") : $c))) { + + $writer = ["text", content]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];} + } else { + + content = self.$unescape_bracketed_text(content); + if (extconf['$[]']("content_model")['$==']("attributes")) { + self.$parse_attributes(content, ($truthy($c = extconf['$[]']("pos_attrs")) ? $c : []), $hash2(["into"], {"into": attributes})) + } else { + + $writer = ["text", content]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + }; + replacement = extension.$process_method()['$[]'](self, ($truthy($c = target) ? $c : content), attributes); + if ($truthy($$($nesting, 'Inline')['$==='](replacement))) { + return replacement.$convert() + } else { + return replacement + };}, TMP_38.$$s = self, TMP_38.$$arity = 0, TMP_38)));}, TMP_37.$$s = self, TMP_37.$$arity = 1, TMP_37))}; + if ($truthy(($truthy($a = found_macroish) ? ($truthy($b = text['$include?']("image:")) ? $b : text['$include?']("icon:")) : $a))) { + text = $send(text, 'gsub', [$$($nesting, 'InlineImageMacroRx')], (TMP_39 = function(){var self = TMP_39.$$s || this, $c, m = nil, captured = nil, type = nil, posattrs = nil, target = nil, attrs = nil; + if ($gvars["~"] == null) $gvars["~"] = nil; + + + m = $gvars["~"]; + if ($truthy((captured = (($c = $gvars['~']) === nil ? nil : $c['$[]'](0)))['$start_with?']($$($nesting, 'RS')))) { + return captured.$slice(1, captured.$length()); + } else if ($truthy(captured['$start_with?']("icon:"))) { + $c = ["icon", ["size"]], (type = $c[0]), (posattrs = $c[1]), $c + } else { + $c = ["image", ["alt", "width", "height"]], (type = $c[0]), (posattrs = $c[1]), $c + }; + if ($truthy((target = m['$[]'](1))['$include?']($$($nesting, 'ATTR_REF_HEAD')))) { + target = self.$sub_attributes(target)}; + attrs = self.$parse_attributes(m['$[]'](2), posattrs, $hash2(["unescape_input"], {"unescape_input": true})); + if (type['$==']("icon")) { + } else { + doc.$register("images", [target, (($writer = ["imagesdir", doc_attrs['$[]']("imagesdir")]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])]) + }; + ($truthy($c = attrs['$[]']("alt")) ? $c : (($writer = ["alt", (($writer = ["default-alt", $$($nesting, 'Helpers').$basename(target, true).$tr("_-", " ")]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + return $$($nesting, 'Inline').$new(self, "image", nil, $hash2(["type", "target", "attributes"], {"type": type, "target": target, "attributes": attrs})).$convert();}, TMP_39.$$s = self, TMP_39.$$arity = 0, TMP_39))}; + if ($truthy(($truthy($a = ($truthy($b = text['$include?']("((")) ? text['$include?']("))") : $b)) ? $a : ($truthy($b = found_macroish_short) ? text['$include?']("dexterm") : $b)))) { + text = $send(text, 'gsub', [$$($nesting, 'InlineIndextermMacroRx')], (TMP_40 = function(){var self = TMP_40.$$s || this, $c, captured = nil, $case = nil, terms = nil, term = nil, visible = nil, before = nil, after = nil, subbed_term = nil; + + + captured = (($c = $gvars['~']) === nil ? nil : $c['$[]'](0)); + return (function() {$case = (($c = $gvars['~']) === nil ? nil : $c['$[]'](1)); + if ("indexterm"['$===']($case)) { + text = (($c = $gvars['~']) === nil ? nil : $c['$[]'](2)); + if ($truthy(captured['$start_with?']($$($nesting, 'RS')))) { + return captured.$slice(1, captured.$length());}; + terms = self.$split_simple_csv(self.$normalize_string(text, true)); + doc.$register("indexterms", terms); + return $$($nesting, 'Inline').$new(self, "indexterm", nil, $hash2(["attributes"], {"attributes": $hash2(["terms"], {"terms": terms})})).$convert();} + else if ("indexterm2"['$===']($case)) { + text = (($c = $gvars['~']) === nil ? nil : $c['$[]'](2)); + if ($truthy(captured['$start_with?']($$($nesting, 'RS')))) { + return captured.$slice(1, captured.$length());}; + term = self.$normalize_string(text, true); + doc.$register("indexterms", [term]); + return $$($nesting, 'Inline').$new(self, "indexterm", term, $hash2(["type"], {"type": "visible"})).$convert();} + else { + text = (($c = $gvars['~']) === nil ? nil : $c['$[]'](3)); + if ($truthy(captured['$start_with?']($$($nesting, 'RS')))) { + if ($truthy(($truthy($c = text['$start_with?']("(")) ? text['$end_with?'](")") : $c))) { + + text = text.$slice(1, $rb_minus(text.$length(), 2)); + $c = [true, "(", ")"], (visible = $c[0]), (before = $c[1]), (after = $c[2]), $c; + } else { + return captured.$slice(1, captured.$length()); + } + } else { + + visible = true; + if ($truthy(text['$start_with?']("("))) { + if ($truthy(text['$end_with?'](")"))) { + $c = [text.$slice(1, $rb_minus(text.$length(), 2)), false], (text = $c[0]), (visible = $c[1]), $c + } else { + $c = [text.$slice(1, text.$length()), "(", ""], (text = $c[0]), (before = $c[1]), (after = $c[2]), $c + } + } else if ($truthy(text['$end_with?'](")"))) { + $c = [text.$slice(0, $rb_minus(text.$length(), 1)), "", ")"], (text = $c[0]), (before = $c[1]), (after = $c[2]), $c}; + }; + if ($truthy(visible)) { + + term = self.$normalize_string(text); + doc.$register("indexterms", [term]); + subbed_term = $$($nesting, 'Inline').$new(self, "indexterm", term, $hash2(["type"], {"type": "visible"})).$convert(); + } else { + + terms = self.$split_simple_csv(self.$normalize_string(text)); + doc.$register("indexterms", terms); + subbed_term = $$($nesting, 'Inline').$new(self, "indexterm", nil, $hash2(["attributes"], {"attributes": $hash2(["terms"], {"terms": terms})})).$convert(); + }; + if ($truthy(before)) { + return "" + (before) + (subbed_term) + (after) + } else { + return subbed_term + };}})();}, TMP_40.$$s = self, TMP_40.$$arity = 0, TMP_40))}; + if ($truthy(($truthy($a = found_colon) ? text['$include?']("://") : $a))) { + text = $send(text, 'gsub', [$$($nesting, 'InlineLinkRx')], (TMP_41 = function(){var self = TMP_41.$$s || this, $c, $d, m = nil, target = nil, macro = nil, prefix = nil, suffix = nil, $case = nil, attrs = nil, link_opts = nil; + if ($gvars["~"] == null) $gvars["~"] = nil; + + + m = $gvars["~"]; + if ($truthy((target = (($c = $gvars['~']) === nil ? nil : $c['$[]'](2)))['$start_with?']($$($nesting, 'RS')))) { + return "" + (m['$[]'](1)) + (target.$slice(1, target.$length())) + (m['$[]'](3));}; + $c = [m['$[]'](1), ($truthy($d = (macro = m['$[]'](3))) ? $d : ""), ""], (prefix = $c[0]), (text = $c[1]), (suffix = $c[2]), $c; + if (prefix['$==']("link:")) { + if ($truthy(macro)) { + prefix = "" + } else { + return m['$[]'](0); + }}; + if ($truthy(($truthy($c = macro) ? $c : $$($nesting, 'UriTerminatorRx')['$!~'](target)))) { + } else { + + $case = (($c = $gvars['~']) === nil ? nil : $c['$[]'](0)); + if (")"['$===']($case)) { + target = target.$chop(); + suffix = ")";} + else if (";"['$===']($case)) {if ($truthy(($truthy($c = prefix['$start_with?']("<")) ? target['$end_with?'](">") : $c))) { + + prefix = prefix.$slice(4, prefix.$length()); + target = target.$slice(0, $rb_minus(target.$length(), 4)); + } else if ($truthy((target = target.$chop())['$end_with?'](")"))) { + + target = target.$chop(); + suffix = ");"; + } else { + suffix = ";" + }} + else if (":"['$===']($case)) {if ($truthy((target = target.$chop())['$end_with?'](")"))) { + + target = target.$chop(); + suffix = "):"; + } else { + suffix = ":" + }}; + if ($truthy(target['$end_with?']("://"))) { + Opal.ret(m['$[]'](0))}; + }; + $c = [nil, $hash2(["type"], {"type": "link"})], (attrs = $c[0]), (link_opts = $c[1]), $c; + if ($truthy(text['$empty?']())) { + } else { + + if ($truthy(text['$include?']($$($nesting, 'R_SB')))) { + text = text.$gsub($$($nesting, 'ESC_R_SB'), $$($nesting, 'R_SB'))}; + if ($truthy(($truthy($c = doc.$compat_mode()['$!']()) ? text['$include?']("=") : $c))) { + + text = ($truthy($c = (attrs = $$($nesting, 'AttributeList').$new(text, self).$parse())['$[]'](1)) ? $c : ""); + if ($truthy(attrs['$key?']("id"))) { + + $writer = ["id", attrs.$delete("id")]; + $send(link_opts, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];};}; + if ($truthy(text['$end_with?']("^"))) { + + text = text.$chop(); + if ($truthy(attrs)) { + ($truthy($c = attrs['$[]']("window")) ? $c : (($writer = ["window", "_blank"]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])) + } else { + attrs = $hash2(["window"], {"window": "_blank"}) + };}; + }; + if ($truthy(text['$empty?']())) { + + text = (function() {if ($truthy(doc_attrs['$key?']("hide-uri-scheme"))) { + + return target.$sub($$($nesting, 'UriSniffRx'), ""); + } else { + return target + }; return nil; })(); + if ($truthy(attrs)) { + + $writer = ["role", (function() {if ($truthy(attrs['$key?']("role"))) { + return "" + "bare " + (attrs['$[]']("role")) + } else { + return "bare" + }; return nil; })()]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + } else { + attrs = $hash2(["role"], {"role": "bare"}) + };}; + doc.$register("links", (($writer = ["target", target]), $send(link_opts, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + if ($truthy(attrs)) { + + $writer = ["attributes", attrs]; + $send(link_opts, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + return "" + (prefix) + ($$($nesting, 'Inline').$new(self, "anchor", text, link_opts).$convert()) + (suffix);}, TMP_41.$$s = self, TMP_41.$$arity = 0, TMP_41))}; + if ($truthy(($truthy($a = found_macroish) ? ($truthy($b = text['$include?']("link:")) ? $b : text['$include?']("mailto:")) : $a))) { + text = $send(text, 'gsub', [$$($nesting, 'InlineLinkMacroRx')], (TMP_42 = function(){var self = TMP_42.$$s || this, $c, m = nil, target = nil, mailto = nil, attrs = nil, link_opts = nil; + if ($gvars["~"] == null) $gvars["~"] = nil; + + + m = $gvars["~"]; + if ($truthy((($c = $gvars['~']) === nil ? nil : $c['$[]'](0))['$start_with?']($$($nesting, 'RS')))) { + return m['$[]'](0).$slice(1, m['$[]'](0).$length());}; + target = (function() {if ($truthy((mailto = m['$[]'](1)))) { + return "" + "mailto:" + (m['$[]'](2)) + } else { + return m['$[]'](2) + }; return nil; })(); + $c = [nil, $hash2(["type"], {"type": "link"})], (attrs = $c[0]), (link_opts = $c[1]), $c; + if ($truthy((text = m['$[]'](3))['$empty?']())) { + } else { + + if ($truthy(text['$include?']($$($nesting, 'R_SB')))) { + text = text.$gsub($$($nesting, 'ESC_R_SB'), $$($nesting, 'R_SB'))}; + if ($truthy(mailto)) { + if ($truthy(($truthy($c = doc.$compat_mode()['$!']()) ? text['$include?'](",") : $c))) { + + text = ($truthy($c = (attrs = $$($nesting, 'AttributeList').$new(text, self).$parse())['$[]'](1)) ? $c : ""); + if ($truthy(attrs['$key?']("id"))) { + + $writer = ["id", attrs.$delete("id")]; + $send(link_opts, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if ($truthy(attrs['$key?'](2))) { + if ($truthy(attrs['$key?'](3))) { + target = "" + (target) + "?subject=" + ($$($nesting, 'Helpers').$uri_encode(attrs['$[]'](2))) + "&body=" + ($$($nesting, 'Helpers').$uri_encode(attrs['$[]'](3))) + } else { + target = "" + (target) + "?subject=" + ($$($nesting, 'Helpers').$uri_encode(attrs['$[]'](2))) + }};} + } else if ($truthy(($truthy($c = doc.$compat_mode()['$!']()) ? text['$include?']("=") : $c))) { + + text = ($truthy($c = (attrs = $$($nesting, 'AttributeList').$new(text, self).$parse())['$[]'](1)) ? $c : ""); + if ($truthy(attrs['$key?']("id"))) { + + $writer = ["id", attrs.$delete("id")]; + $send(link_opts, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];};}; + if ($truthy(text['$end_with?']("^"))) { + + text = text.$chop(); + if ($truthy(attrs)) { + ($truthy($c = attrs['$[]']("window")) ? $c : (($writer = ["window", "_blank"]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])) + } else { + attrs = $hash2(["window"], {"window": "_blank"}) + };}; + }; + if ($truthy(text['$empty?']())) { + if ($truthy(mailto)) { + text = m['$[]'](2) + } else { + + if ($truthy(doc_attrs['$key?']("hide-uri-scheme"))) { + if ($truthy((text = target.$sub($$($nesting, 'UriSniffRx'), ""))['$empty?']())) { + text = target} + } else { + text = target + }; + if ($truthy(attrs)) { + + $writer = ["role", (function() {if ($truthy(attrs['$key?']("role"))) { + return "" + "bare " + (attrs['$[]']("role")) + } else { + return "bare" + }; return nil; })()]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + } else { + attrs = $hash2(["role"], {"role": "bare"}) + }; + }}; + doc.$register("links", (($writer = ["target", target]), $send(link_opts, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + if ($truthy(attrs)) { + + $writer = ["attributes", attrs]; + $send(link_opts, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + return $$($nesting, 'Inline').$new(self, "anchor", text, link_opts).$convert();}, TMP_42.$$s = self, TMP_42.$$arity = 0, TMP_42))}; + if ($truthy(text['$include?']("@"))) { + text = $send(text, 'gsub', [$$($nesting, 'InlineEmailRx')], (TMP_43 = function(){var self = TMP_43.$$s || this, $c, $d, address = nil, tip = nil, target = nil; + + + $c = [(($d = $gvars['~']) === nil ? nil : $d['$[]'](0)), (($d = $gvars['~']) === nil ? nil : $d['$[]'](1))], (address = $c[0]), (tip = $c[1]), $c; + if ($truthy(tip)) { + return (function() {if (tip['$==']($$($nesting, 'RS'))) { + + return address.$slice(1, address.$length()); + } else { + return address + }; return nil; })();}; + target = "" + "mailto:" + (address); + doc.$register("links", target); + return $$($nesting, 'Inline').$new(self, "anchor", address, $hash2(["type", "target"], {"type": "link", "target": target})).$convert();}, TMP_43.$$s = self, TMP_43.$$arity = 0, TMP_43))}; + if ($truthy(($truthy($a = found_macroish) ? text['$include?']("tnote") : $a))) { + text = $send(text, 'gsub', [$$($nesting, 'InlineFootnoteMacroRx')], (TMP_44 = function(){var self = TMP_44.$$s || this, $c, $d, $e, TMP_45, m = nil, id = nil, index = nil, type = nil, target = nil, footnote = nil; + if ($gvars["~"] == null) $gvars["~"] = nil; + + + m = $gvars["~"]; + if ($truthy((($c = $gvars['~']) === nil ? nil : $c['$[]'](0))['$start_with?']($$($nesting, 'RS')))) { + return m['$[]'](0).$slice(1, m['$[]'](0).$length());}; + if ($truthy(m['$[]'](1))) { + $d = ($truthy($e = m['$[]'](3)) ? $e : "").$split(",", 2), $c = Opal.to_ary($d), (id = ($c[0] == null ? nil : $c[0])), (text = ($c[1] == null ? nil : $c[1])), $d + } else { + $c = [m['$[]'](2), m['$[]'](3)], (id = $c[0]), (text = $c[1]), $c + }; + if ($truthy(id)) { + if ($truthy(text)) { + + text = self.$restore_passthroughs(self.$sub_inline_xrefs(self.$sub_inline_anchors(self.$normalize_string(text, true))), false); + index = doc.$counter("footnote-number"); + doc.$register("footnotes", $$$($$($nesting, 'Document'), 'Footnote').$new(index, id, text)); + $c = ["ref", nil], (type = $c[0]), (target = $c[1]), $c; + } else { + + if ($truthy((footnote = $send(doc.$footnotes(), 'find', [], (TMP_45 = function(candidate){var self = TMP_45.$$s || this; + + + + if (candidate == null) { + candidate = nil; + }; + return candidate.$id()['$=='](id);}, TMP_45.$$s = self, TMP_45.$$arity = 1, TMP_45))))) { + $c = [footnote.$index(), footnote.$text()], (index = $c[0]), (text = $c[1]), $c + } else { + + self.$logger().$warn("" + "invalid footnote reference: " + (id)); + $c = [nil, id], (index = $c[0]), (text = $c[1]), $c; + }; + $c = ["xref", id, nil], (type = $c[0]), (target = $c[1]), (id = $c[2]), $c; + } + } else if ($truthy(text)) { + + text = self.$restore_passthroughs(self.$sub_inline_xrefs(self.$sub_inline_anchors(self.$normalize_string(text, true))), false); + index = doc.$counter("footnote-number"); + doc.$register("footnotes", $$$($$($nesting, 'Document'), 'Footnote').$new(index, id, text)); + type = (target = nil); + } else { + return m['$[]'](0); + }; + return $$($nesting, 'Inline').$new(self, "footnote", text, $hash2(["attributes", "id", "target", "type"], {"attributes": $hash2(["index"], {"index": index}), "id": id, "target": target, "type": type})).$convert();}, TMP_44.$$s = self, TMP_44.$$arity = 0, TMP_44))}; + return self.$sub_inline_xrefs(self.$sub_inline_anchors(text, found), found); + } catch ($returner) { if ($returner === Opal.returner) { return $returner.$v } throw $returner; } + }, TMP_Substitutors_sub_macros_29.$$arity = 1); + + Opal.def(self, '$sub_inline_anchors', TMP_Substitutors_sub_inline_anchors_46 = function $$sub_inline_anchors(text, found) { + var $a, TMP_47, $b, $c, TMP_48, self = this; + if (self.context == null) self.context = nil; + if (self.parent == null) self.parent = nil; + + + + if (found == null) { + found = nil; + }; + if ($truthy((($a = self.context['$==']("list_item")) ? self.parent.$style()['$==']("bibliography") : self.context['$==']("list_item")))) { + text = $send(text, 'sub', [$$($nesting, 'InlineBiblioAnchorRx')], (TMP_47 = function(){var self = TMP_47.$$s || this, $b, $c; + + return $$($nesting, 'Inline').$new(self, "anchor", "" + "[" + (($truthy($b = (($c = $gvars['~']) === nil ? nil : $c['$[]'](2))) ? $b : (($c = $gvars['~']) === nil ? nil : $c['$[]'](1)))) + "]", $hash2(["type", "id", "target"], {"type": "bibref", "id": (($b = $gvars['~']) === nil ? nil : $b['$[]'](1)), "target": (($b = $gvars['~']) === nil ? nil : $b['$[]'](1))})).$convert()}, TMP_47.$$s = self, TMP_47.$$arity = 0, TMP_47))}; + if ($truthy(($truthy($a = ($truthy($b = ($truthy($c = found['$!']()) ? $c : found['$[]']("square_bracket"))) ? text['$include?']("[[") : $b)) ? $a : ($truthy($b = ($truthy($c = found['$!']()) ? $c : found['$[]']("macroish"))) ? text['$include?']("or:") : $b)))) { + text = $send(text, 'gsub', [$$($nesting, 'InlineAnchorRx')], (TMP_48 = function(){var self = TMP_48.$$s || this, $d, $e, id = nil, reftext = nil; + + + if ($truthy((($d = $gvars['~']) === nil ? nil : $d['$[]'](1)))) { + return (($d = $gvars['~']) === nil ? nil : $d['$[]'](0)).$slice(1, (($d = $gvars['~']) === nil ? nil : $d['$[]'](0)).$length());}; + if ($truthy((id = (($d = $gvars['~']) === nil ? nil : $d['$[]'](2))))) { + reftext = (($d = $gvars['~']) === nil ? nil : $d['$[]'](3)) + } else { + + id = (($d = $gvars['~']) === nil ? nil : $d['$[]'](4)); + if ($truthy(($truthy($d = (reftext = (($e = $gvars['~']) === nil ? nil : $e['$[]'](5)))) ? reftext['$include?']($$($nesting, 'R_SB')) : $d))) { + reftext = reftext.$gsub($$($nesting, 'ESC_R_SB'), $$($nesting, 'R_SB'))}; + }; + return $$($nesting, 'Inline').$new(self, "anchor", reftext, $hash2(["type", "id", "target"], {"type": "ref", "id": id, "target": id})).$convert();}, TMP_48.$$s = self, TMP_48.$$arity = 0, TMP_48))}; + return text; + }, TMP_Substitutors_sub_inline_anchors_46.$$arity = -2); + + Opal.def(self, '$sub_inline_xrefs', TMP_Substitutors_sub_inline_xrefs_49 = function $$sub_inline_xrefs(content, found) { + var $a, $b, TMP_50, self = this; + + + + if (found == null) { + found = nil; + }; + if ($truthy(($truthy($a = ($truthy($b = (function() {if ($truthy(found)) { + return found['$[]']("macroish") + } else { + + return content['$include?']("["); + }; return nil; })()) ? content['$include?']("xref:") : $b)) ? $a : ($truthy($b = content['$include?']("&")) ? content['$include?']("lt;&") : $b)))) { + content = $send(content, 'gsub', [$$($nesting, 'InlineXrefMacroRx')], (TMP_50 = function(){var self = TMP_50.$$s || this, $c, $d, m = nil, attrs = nil, doc = nil, refid = nil, text = nil, macro = nil, fragment = nil, hash_idx = nil, fragment_len = nil, path = nil, ext = nil, src2src = nil, target = nil; + if (self.document == null) self.document = nil; + if ($gvars["~"] == null) $gvars["~"] = nil; + if ($gvars.VERBOSE == null) $gvars.VERBOSE = nil; + + + m = $gvars["~"]; + if ($truthy((($c = $gvars['~']) === nil ? nil : $c['$[]'](0))['$start_with?']($$($nesting, 'RS')))) { + return m['$[]'](0).$slice(1, m['$[]'](0).$length());}; + $c = [$hash2([], {}), self.document], (attrs = $c[0]), (doc = $c[1]), $c; + if ($truthy((refid = m['$[]'](1)))) { + + $d = refid.$split(",", 2), $c = Opal.to_ary($d), (refid = ($c[0] == null ? nil : $c[0])), (text = ($c[1] == null ? nil : $c[1])), $d; + if ($truthy(text)) { + text = text.$lstrip()}; + } else { + + macro = true; + refid = m['$[]'](2); + if ($truthy((text = m['$[]'](3)))) { + + if ($truthy(text['$include?']($$($nesting, 'R_SB')))) { + text = text.$gsub($$($nesting, 'ESC_R_SB'), $$($nesting, 'R_SB'))}; + if ($truthy(($truthy($c = doc.$compat_mode()['$!']()) ? text['$include?']("=") : $c))) { + text = $$($nesting, 'AttributeList').$new(text, self).$parse_into(attrs)['$[]'](1)};}; + }; + if ($truthy(doc.$compat_mode())) { + fragment = refid + } else if ($truthy((hash_idx = refid.$index("#")))) { + if ($truthy($rb_gt(hash_idx, 0))) { + + if ($truthy($rb_gt((fragment_len = $rb_minus($rb_minus(refid.$length(), hash_idx), 1)), 0))) { + $c = [refid.$slice(0, hash_idx), refid.$slice($rb_plus(hash_idx, 1), fragment_len)], (path = $c[0]), (fragment = $c[1]), $c + } else { + path = refid.$slice(0, hash_idx) + }; + if ($truthy((ext = $$$('::', 'File').$extname(path))['$empty?']())) { + src2src = path + } else if ($truthy($$($nesting, 'ASCIIDOC_EXTENSIONS')['$[]'](ext))) { + src2src = (path = path.$slice(0, $rb_minus(path.$length(), ext.$length())))}; + } else { + $c = [refid, refid.$slice(1, refid.$length())], (target = $c[0]), (fragment = $c[1]), $c + } + } else if ($truthy(($truthy($c = macro) ? refid['$end_with?'](".adoc") : $c))) { + src2src = (path = refid.$slice(0, $rb_minus(refid.$length(), 5))) + } else { + fragment = refid + }; + if ($truthy(target)) { + + refid = fragment; + if ($truthy(($truthy($c = $gvars.VERBOSE) ? doc.$catalog()['$[]']("ids")['$key?'](refid)['$!']() : $c))) { + self.$logger().$warn("" + "invalid reference: " + (refid))}; + } else if ($truthy(path)) { + if ($truthy(($truthy($c = src2src) ? ($truthy($d = doc.$attributes()['$[]']("docname")['$=='](path)) ? $d : doc.$catalog()['$[]']("includes")['$[]'](path)) : $c))) { + if ($truthy(fragment)) { + + $c = [fragment, nil, "" + "#" + (fragment)], (refid = $c[0]), (path = $c[1]), (target = $c[2]), $c; + if ($truthy(($truthy($c = $gvars.VERBOSE) ? doc.$catalog()['$[]']("ids")['$key?'](refid)['$!']() : $c))) { + self.$logger().$warn("" + "invalid reference: " + (refid))}; + } else { + $c = [nil, nil, "#"], (refid = $c[0]), (path = $c[1]), (target = $c[2]), $c + } + } else { + + $c = [path, "" + (doc.$attributes()['$[]']("relfileprefix")) + (path) + ((function() {if ($truthy(src2src)) { + + return doc.$attributes().$fetch("relfilesuffix", doc.$outfilesuffix()); + } else { + return "" + }; return nil; })())], (refid = $c[0]), (path = $c[1]), $c; + if ($truthy(fragment)) { + $c = ["" + (refid) + "#" + (fragment), "" + (path) + "#" + (fragment)], (refid = $c[0]), (target = $c[1]), $c + } else { + target = path + }; + } + } else if ($truthy(($truthy($c = doc.$compat_mode()) ? $c : $$($nesting, 'Compliance').$natural_xrefs()['$!']()))) { + + $c = [fragment, "" + "#" + (fragment)], (refid = $c[0]), (target = $c[1]), $c; + if ($truthy(($truthy($c = $gvars.VERBOSE) ? doc.$catalog()['$[]']("ids")['$key?'](refid)['$!']() : $c))) { + self.$logger().$warn("" + "invalid reference: " + (refid))}; + } else if ($truthy(doc.$catalog()['$[]']("ids")['$key?'](fragment))) { + $c = [fragment, "" + "#" + (fragment)], (refid = $c[0]), (target = $c[1]), $c + } else if ($truthy(($truthy($c = (refid = doc.$catalog()['$[]']("ids").$key(fragment))) ? ($truthy($d = fragment['$include?'](" ")) ? $d : fragment.$downcase()['$!='](fragment)) : $c))) { + $c = [refid, "" + "#" + (refid)], (fragment = $c[0]), (target = $c[1]), $c + } else { + + $c = [fragment, "" + "#" + (fragment)], (refid = $c[0]), (target = $c[1]), $c; + if ($truthy($gvars.VERBOSE)) { + self.$logger().$warn("" + "invalid reference: " + (refid))}; + }; + $c = [path, fragment, refid], attrs['$[]=']("path", $c[0]), attrs['$[]=']("fragment", $c[1]), attrs['$[]=']("refid", $c[2]), $c; + return $$($nesting, 'Inline').$new(self, "anchor", text, $hash2(["type", "target", "attributes"], {"type": "xref", "target": target, "attributes": attrs})).$convert();}, TMP_50.$$s = self, TMP_50.$$arity = 0, TMP_50))}; + return content; + }, TMP_Substitutors_sub_inline_xrefs_49.$$arity = -2); + + Opal.def(self, '$sub_callouts', TMP_Substitutors_sub_callouts_51 = function $$sub_callouts(text) { + var TMP_52, self = this, callout_rx = nil, autonum = nil; + + + callout_rx = (function() {if ($truthy(self['$attr?']("line-comment"))) { + return $$($nesting, 'CalloutSourceRxMap')['$[]'](self.$attr("line-comment")) + } else { + return $$($nesting, 'CalloutSourceRx') + }; return nil; })(); + autonum = 0; + return $send(text, 'gsub', [callout_rx], (TMP_52 = function(){var self = TMP_52.$$s || this, $a; + if (self.document == null) self.document = nil; + + if ($truthy((($a = $gvars['~']) === nil ? nil : $a['$[]'](2)))) { + return (($a = $gvars['~']) === nil ? nil : $a['$[]'](0)).$sub($$($nesting, 'RS'), "") + } else { + return $$($nesting, 'Inline').$new(self, "callout", (function() {if ((($a = $gvars['~']) === nil ? nil : $a['$[]'](4))['$=='](".")) { + return (autonum = $rb_plus(autonum, 1)).$to_s() + } else { + return (($a = $gvars['~']) === nil ? nil : $a['$[]'](4)) + }; return nil; })(), $hash2(["id", "attributes"], {"id": self.document.$callouts().$read_next_id(), "attributes": $hash2(["guard"], {"guard": (($a = $gvars['~']) === nil ? nil : $a['$[]'](1))})})).$convert() + }}, TMP_52.$$s = self, TMP_52.$$arity = 0, TMP_52)); + }, TMP_Substitutors_sub_callouts_51.$$arity = 1); + + Opal.def(self, '$sub_post_replacements', TMP_Substitutors_sub_post_replacements_53 = function $$sub_post_replacements(text) { + var $a, TMP_54, TMP_55, self = this, lines = nil, last = nil; + if (self.document == null) self.document = nil; + if (self.attributes == null) self.attributes = nil; + + if ($truthy(($truthy($a = self.document.$attributes()['$key?']("hardbreaks")) ? $a : self.attributes['$key?']("hardbreaks-option")))) { + + lines = text.$split($$($nesting, 'LF'), -1); + if ($truthy($rb_lt(lines.$size(), 2))) { + return text}; + last = lines.$pop(); + return $send(lines, 'map', [], (TMP_54 = function(line){var self = TMP_54.$$s || this; + + + + if (line == null) { + line = nil; + }; + return $$($nesting, 'Inline').$new(self, "break", (function() {if ($truthy(line['$end_with?']($$($nesting, 'HARD_LINE_BREAK')))) { + + return line.$slice(0, $rb_minus(line.$length(), 2)); + } else { + return line + }; return nil; })(), $hash2(["type"], {"type": "line"})).$convert();}, TMP_54.$$s = self, TMP_54.$$arity = 1, TMP_54))['$<<'](last).$join($$($nesting, 'LF')); + } else if ($truthy(($truthy($a = text['$include?']($$($nesting, 'PLUS'))) ? text['$include?']($$($nesting, 'HARD_LINE_BREAK')) : $a))) { + return $send(text, 'gsub', [$$($nesting, 'HardLineBreakRx')], (TMP_55 = function(){var self = TMP_55.$$s || this, $b; + + return $$($nesting, 'Inline').$new(self, "break", (($b = $gvars['~']) === nil ? nil : $b['$[]'](1)), $hash2(["type"], {"type": "line"})).$convert()}, TMP_55.$$s = self, TMP_55.$$arity = 0, TMP_55)) + } else { + return text + } + }, TMP_Substitutors_sub_post_replacements_53.$$arity = 1); + + Opal.def(self, '$convert_quoted_text', TMP_Substitutors_convert_quoted_text_56 = function $$convert_quoted_text(match, type, scope) { + var $a, self = this, attrs = nil, unescaped_attrs = nil, attrlist = nil, id = nil, attributes = nil; + + + if ($truthy(match['$[]'](0)['$start_with?']($$($nesting, 'RS')))) { + if ($truthy((($a = scope['$==']("constrained")) ? (attrs = match['$[]'](2)) : scope['$==']("constrained")))) { + unescaped_attrs = "" + "[" + (attrs) + "]" + } else { + return match['$[]'](0).$slice(1, match['$[]'](0).$length()) + }}; + if (scope['$==']("constrained")) { + if ($truthy(unescaped_attrs)) { + return "" + (unescaped_attrs) + ($$($nesting, 'Inline').$new(self, "quoted", match['$[]'](3), $hash2(["type"], {"type": type})).$convert()) + } else { + + if ($truthy((attrlist = match['$[]'](2)))) { + + id = (attributes = self.$parse_quoted_text_attributes(attrlist)).$delete("id"); + if (type['$==']("mark")) { + type = "unquoted"};}; + return "" + (match['$[]'](1)) + ($$($nesting, 'Inline').$new(self, "quoted", match['$[]'](3), $hash2(["type", "id", "attributes"], {"type": type, "id": id, "attributes": attributes})).$convert()); + } + } else { + + if ($truthy((attrlist = match['$[]'](1)))) { + + id = (attributes = self.$parse_quoted_text_attributes(attrlist)).$delete("id"); + if (type['$==']("mark")) { + type = "unquoted"};}; + return $$($nesting, 'Inline').$new(self, "quoted", match['$[]'](2), $hash2(["type", "id", "attributes"], {"type": type, "id": id, "attributes": attributes})).$convert(); + }; + }, TMP_Substitutors_convert_quoted_text_56.$$arity = 3); + + Opal.def(self, '$parse_quoted_text_attributes', TMP_Substitutors_parse_quoted_text_attributes_57 = function $$parse_quoted_text_attributes(str) { + var $a, $b, self = this, segments = nil, id = nil, more_roles = nil, roles = nil, attrs = nil, $writer = nil; + + + if ($truthy(str['$include?']($$($nesting, 'ATTR_REF_HEAD')))) { + str = self.$sub_attributes(str)}; + if ($truthy(str['$include?'](","))) { + str = str.$slice(0, str.$index(","))}; + if ($truthy((str = str.$strip())['$empty?']())) { + return $hash2([], {}) + } else if ($truthy(($truthy($a = str['$start_with?'](".", "#")) ? $$($nesting, 'Compliance').$shorthand_property_syntax() : $a))) { + + segments = str.$split("#", 2); + if ($truthy($rb_gt(segments.$size(), 1))) { + $b = segments['$[]'](1).$split("."), $a = Opal.to_ary($b), (id = ($a[0] == null ? nil : $a[0])), (more_roles = $slice.call($a, 1)), $b + } else { + + id = nil; + more_roles = []; + }; + roles = (function() {if ($truthy(segments['$[]'](0)['$empty?']())) { + return [] + } else { + return segments['$[]'](0).$split(".") + }; return nil; })(); + if ($truthy($rb_gt(roles.$size(), 1))) { + roles.$shift()}; + if ($truthy($rb_gt(more_roles.$size(), 0))) { + roles.$concat(more_roles)}; + attrs = $hash2([], {}); + if ($truthy(id)) { + + $writer = ["id", id]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if ($truthy(roles['$empty?']())) { + } else { + + $writer = ["role", roles.$join(" ")]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + return attrs; + } else { + return $hash2(["role"], {"role": str}) + }; + }, TMP_Substitutors_parse_quoted_text_attributes_57.$$arity = 1); + + Opal.def(self, '$parse_attributes', TMP_Substitutors_parse_attributes_58 = function $$parse_attributes(attrlist, posattrs, opts) { + var $a, self = this, block = nil, into = nil; + if (self.document == null) self.document = nil; + + + + if (posattrs == null) { + posattrs = []; + }; + + if (opts == null) { + opts = $hash2([], {}); + }; + if ($truthy(($truthy($a = attrlist) ? attrlist['$empty?']()['$!']() : $a))) { + } else { + return $hash2([], {}) + }; + if ($truthy(($truthy($a = opts['$[]']("sub_input")) ? attrlist['$include?']($$($nesting, 'ATTR_REF_HEAD')) : $a))) { + attrlist = self.document.$sub_attributes(attrlist)}; + if ($truthy(opts['$[]']("unescape_input"))) { + attrlist = self.$unescape_bracketed_text(attrlist)}; + if ($truthy(opts['$[]']("sub_result"))) { + block = self}; + if ($truthy((into = opts['$[]']("into")))) { + return $$($nesting, 'AttributeList').$new(attrlist, block).$parse_into(into, posattrs) + } else { + return $$($nesting, 'AttributeList').$new(attrlist, block).$parse(posattrs) + }; + }, TMP_Substitutors_parse_attributes_58.$$arity = -2); + + Opal.def(self, '$expand_subs', TMP_Substitutors_expand_subs_59 = function $$expand_subs(subs) { + var $a, TMP_60, self = this, expanded_subs = nil; + + if ($truthy($$$('::', 'Symbol')['$==='](subs))) { + if (subs['$==']("none")) { + return nil + } else { + return ($truthy($a = $$($nesting, 'SUB_GROUPS')['$[]'](subs)) ? $a : [subs]) + } + } else { + + expanded_subs = []; + $send(subs, 'each', [], (TMP_60 = function(key){var self = TMP_60.$$s || this, sub_group = nil; + + + + if (key == null) { + key = nil; + }; + if (key['$==']("none")) { + return nil + } else if ($truthy((sub_group = $$($nesting, 'SUB_GROUPS')['$[]'](key)))) { + return (expanded_subs = $rb_plus(expanded_subs, sub_group)) + } else { + return expanded_subs['$<<'](key) + };}, TMP_60.$$s = self, TMP_60.$$arity = 1, TMP_60)); + if ($truthy(expanded_subs['$empty?']())) { + return nil + } else { + return expanded_subs + }; + } + }, TMP_Substitutors_expand_subs_59.$$arity = 1); + + Opal.def(self, '$unescape_bracketed_text', TMP_Substitutors_unescape_bracketed_text_61 = function $$unescape_bracketed_text(text) { + var self = this; + + + if ($truthy(text['$empty?']())) { + } else if ($truthy((text = text.$strip().$tr($$($nesting, 'LF'), " "))['$include?']($$($nesting, 'R_SB')))) { + text = text.$gsub($$($nesting, 'ESC_R_SB'), $$($nesting, 'R_SB'))}; + return text; + }, TMP_Substitutors_unescape_bracketed_text_61.$$arity = 1); + + Opal.def(self, '$normalize_string', TMP_Substitutors_normalize_string_62 = function $$normalize_string(str, unescape_brackets) { + var $a, self = this; + + + + if (unescape_brackets == null) { + unescape_brackets = false; + }; + if ($truthy(str['$empty?']())) { + } else { + + str = str.$strip().$tr($$($nesting, 'LF'), " "); + if ($truthy(($truthy($a = unescape_brackets) ? str['$include?']($$($nesting, 'R_SB')) : $a))) { + str = str.$gsub($$($nesting, 'ESC_R_SB'), $$($nesting, 'R_SB'))}; + }; + return str; + }, TMP_Substitutors_normalize_string_62.$$arity = -2); + + Opal.def(self, '$unescape_brackets', TMP_Substitutors_unescape_brackets_63 = function $$unescape_brackets(str) { + var self = this; + + + if ($truthy(str['$empty?']())) { + } else if ($truthy(str['$include?']($$($nesting, 'RS')))) { + str = str.$gsub($$($nesting, 'ESC_R_SB'), $$($nesting, 'R_SB'))}; + return str; + }, TMP_Substitutors_unescape_brackets_63.$$arity = 1); + + Opal.def(self, '$split_simple_csv', TMP_Substitutors_split_simple_csv_64 = function $$split_simple_csv(str) { + var TMP_65, TMP_66, self = this, values = nil, current = nil, quote_open = nil; + + + if ($truthy(str['$empty?']())) { + values = [] + } else if ($truthy(str['$include?']("\""))) { + + values = []; + current = []; + quote_open = false; + $send(str, 'each_char', [], (TMP_65 = function(c){var self = TMP_65.$$s || this, $case = nil; + + + + if (c == null) { + c = nil; + }; + return (function() {$case = c; + if (","['$===']($case)) {if ($truthy(quote_open)) { + return current['$<<'](c) + } else { + + values['$<<'](current.$join().$strip()); + return (current = []); + }} + else if ("\""['$===']($case)) {return (quote_open = quote_open['$!']())} + else {return current['$<<'](c)}})();}, TMP_65.$$s = self, TMP_65.$$arity = 1, TMP_65)); + values['$<<'](current.$join().$strip()); + } else { + values = $send(str.$split(","), 'map', [], (TMP_66 = function(it){var self = TMP_66.$$s || this; + + + + if (it == null) { + it = nil; + }; + return it.$strip();}, TMP_66.$$s = self, TMP_66.$$arity = 1, TMP_66)) + }; + return values; + }, TMP_Substitutors_split_simple_csv_64.$$arity = 1); + + Opal.def(self, '$resolve_subs', TMP_Substitutors_resolve_subs_67 = function $$resolve_subs(subs, type, defaults, subject) { + var TMP_68, self = this, candidates = nil, modifiers_present = nil, resolved = nil, invalid = nil; + + + + if (type == null) { + type = "block"; + }; + + if (defaults == null) { + defaults = nil; + }; + + if (subject == null) { + subject = nil; + }; + if ($truthy(subs['$nil_or_empty?']())) { + return nil}; + candidates = nil; + if ($truthy(subs['$include?'](" "))) { + subs = subs.$delete(" ")}; + modifiers_present = $$($nesting, 'SubModifierSniffRx')['$match?'](subs); + $send(subs.$split(","), 'each', [], (TMP_68 = function(key){var self = TMP_68.$$s || this, $a, $b, modifier_operation = nil, first = nil, resolved_keys = nil, resolved_key = nil, candidate = nil, $case = nil; + + + + if (key == null) { + key = nil; + }; + modifier_operation = nil; + if ($truthy(modifiers_present)) { + if ((first = key.$chr())['$==']("+")) { + + modifier_operation = "append"; + key = key.$slice(1, key.$length()); + } else if (first['$==']("-")) { + + modifier_operation = "remove"; + key = key.$slice(1, key.$length()); + } else if ($truthy(key['$end_with?']("+"))) { + + modifier_operation = "prepend"; + key = key.$chop();}}; + key = key.$to_sym(); + if ($truthy((($a = type['$==']("inline")) ? ($truthy($b = key['$==']("verbatim")) ? $b : key['$==']("v")) : type['$==']("inline")))) { + resolved_keys = $$($nesting, 'BASIC_SUBS') + } else if ($truthy($$($nesting, 'SUB_GROUPS')['$key?'](key))) { + resolved_keys = $$($nesting, 'SUB_GROUPS')['$[]'](key) + } else if ($truthy(($truthy($a = (($b = type['$==']("inline")) ? key.$length()['$=='](1) : type['$==']("inline"))) ? $$($nesting, 'SUB_HINTS')['$key?'](key) : $a))) { + + resolved_key = $$($nesting, 'SUB_HINTS')['$[]'](key); + if ($truthy((candidate = $$($nesting, 'SUB_GROUPS')['$[]'](resolved_key)))) { + resolved_keys = candidate + } else { + resolved_keys = [resolved_key] + }; + } else { + resolved_keys = [key] + }; + if ($truthy(modifier_operation)) { + + candidates = ($truthy($a = candidates) ? $a : (function() {if ($truthy(defaults)) { + + return defaults.$drop(0); + } else { + return [] + }; return nil; })()); + return (function() {$case = modifier_operation; + if ("append"['$===']($case)) {return (candidates = $rb_plus(candidates, resolved_keys))} + else if ("prepend"['$===']($case)) {return (candidates = $rb_plus(resolved_keys, candidates))} + else if ("remove"['$===']($case)) {return (candidates = $rb_minus(candidates, resolved_keys))} + else { return nil }})(); + } else { + + candidates = ($truthy($a = candidates) ? $a : []); + return (candidates = $rb_plus(candidates, resolved_keys)); + };}, TMP_68.$$s = self, TMP_68.$$arity = 1, TMP_68)); + if ($truthy(candidates)) { + } else { + return nil + }; + resolved = candidates['$&']($$($nesting, 'SUB_OPTIONS')['$[]'](type)); + if ($truthy($rb_minus(candidates, resolved)['$empty?']())) { + } else { + + invalid = $rb_minus(candidates, resolved); + self.$logger().$warn("" + "invalid substitution type" + ((function() {if ($truthy($rb_gt(invalid.$size(), 1))) { + return "s" + } else { + return "" + }; return nil; })()) + ((function() {if ($truthy(subject)) { + return " for " + } else { + return "" + }; return nil; })()) + (subject) + ": " + (invalid.$join(", "))); + }; + return resolved; + }, TMP_Substitutors_resolve_subs_67.$$arity = -2); + + Opal.def(self, '$resolve_block_subs', TMP_Substitutors_resolve_block_subs_69 = function $$resolve_block_subs(subs, defaults, subject) { + var self = this; + + return self.$resolve_subs(subs, "block", defaults, subject) + }, TMP_Substitutors_resolve_block_subs_69.$$arity = 3); + + Opal.def(self, '$resolve_pass_subs', TMP_Substitutors_resolve_pass_subs_70 = function $$resolve_pass_subs(subs) { + var self = this; + + return self.$resolve_subs(subs, "inline", nil, "passthrough macro") + }, TMP_Substitutors_resolve_pass_subs_70.$$arity = 1); + + Opal.def(self, '$highlight_source', TMP_Substitutors_highlight_source_71 = function $$highlight_source(source, process_callouts, highlighter) { + var $a, $b, $c, $d, $e, $f, TMP_72, TMP_74, self = this, $case = nil, highlighter_loaded = nil, lineno = nil, callout_on_last = nil, callout_marks = nil, last = nil, callout_rx = nil, linenums_mode = nil, highlight_lines = nil, start = nil, result = nil, lexer = nil, opts = nil, $writer = nil, autonum = nil, reached_code = nil; + if (self.document == null) self.document = nil; + if (self.passthroughs == null) self.passthroughs = nil; + + + + if (highlighter == null) { + highlighter = nil; + }; + $case = (highlighter = ($truthy($a = highlighter) ? $a : self.document.$attributes()['$[]']("source-highlighter"))); + if ("coderay"['$===']($case)) {if ($truthy(($truthy($a = ($truthy($b = (highlighter_loaded = (($c = $$$('::', 'CodeRay', 'skip_raise')) ? 'constant' : nil))) ? $b : (($d = $Substitutors.$$cvars['@@coderay_unavailable'], $d != null) ? 'class variable' : nil))) ? $a : self.document.$attributes()['$[]']("coderay-unavailable")))) { + } else if ($truthy($$($nesting, 'Helpers').$require_library("coderay", true, "warn")['$nil?']())) { + (Opal.class_variable_set($Substitutors, '@@coderay_unavailable', true)) + } else { + highlighter_loaded = true + }} + else if ("pygments"['$===']($case)) {if ($truthy(($truthy($a = ($truthy($b = (highlighter_loaded = (($e = $$$('::', 'Pygments', 'skip_raise')) ? 'constant' : nil))) ? $b : (($f = $Substitutors.$$cvars['@@pygments_unavailable'], $f != null) ? 'class variable' : nil))) ? $a : self.document.$attributes()['$[]']("pygments-unavailable")))) { + } else if ($truthy($$($nesting, 'Helpers').$require_library("pygments", "pygments.rb", "warn")['$nil?']())) { + (Opal.class_variable_set($Substitutors, '@@pygments_unavailable', true)) + } else { + highlighter_loaded = true + }} + else {highlighter_loaded = false}; + if ($truthy(highlighter_loaded)) { + } else { + return self.$sub_source(source, process_callouts) + }; + lineno = 0; + callout_on_last = false; + if ($truthy(process_callouts)) { + + callout_marks = $hash2([], {}); + last = -1; + callout_rx = (function() {if ($truthy(self['$attr?']("line-comment"))) { + return $$($nesting, 'CalloutExtractRxMap')['$[]'](self.$attr("line-comment")) + } else { + return $$($nesting, 'CalloutExtractRx') + }; return nil; })(); + source = $send(source.$split($$($nesting, 'LF'), -1), 'map', [], (TMP_72 = function(line){var self = TMP_72.$$s || this, TMP_73; + + + + if (line == null) { + line = nil; + }; + lineno = $rb_plus(lineno, 1); + return $send(line, 'gsub', [callout_rx], (TMP_73 = function(){var self = TMP_73.$$s || this, $g, $writer = nil; + + if ($truthy((($g = $gvars['~']) === nil ? nil : $g['$[]'](2)))) { + return (($g = $gvars['~']) === nil ? nil : $g['$[]'](0)).$sub($$($nesting, 'RS'), "") + } else { + + ($truthy($g = callout_marks['$[]'](lineno)) ? $g : (($writer = [lineno, []]), $send(callout_marks, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]))['$<<']([(($g = $gvars['~']) === nil ? nil : $g['$[]'](1)), (($g = $gvars['~']) === nil ? nil : $g['$[]'](4))]); + last = lineno; + return nil; + }}, TMP_73.$$s = self, TMP_73.$$arity = 0, TMP_73));}, TMP_72.$$s = self, TMP_72.$$arity = 1, TMP_72)).$join($$($nesting, 'LF')); + callout_on_last = last['$=='](lineno); + if ($truthy(callout_marks['$empty?']())) { + callout_marks = nil}; + } else { + callout_marks = nil + }; + linenums_mode = nil; + highlight_lines = nil; + $case = highlighter; + if ("coderay"['$===']($case)) { + if ($truthy((linenums_mode = (function() {if ($truthy(self['$attr?']("linenums", nil, false))) { + return ($truthy($a = self.document.$attributes()['$[]']("coderay-linenums-mode")) ? $a : "table").$to_sym() + } else { + return nil + }; return nil; })()))) { + + if ($truthy($rb_lt((start = self.$attr("start", nil, 1).$to_i()), 1))) { + start = 1}; + if ($truthy(self['$attr?']("highlight", nil, false))) { + highlight_lines = self.$resolve_lines_to_highlight(source, self.$attr("highlight", nil, false))};}; + result = $$$($$$('::', 'CodeRay'), 'Duo')['$[]'](self.$attr("language", "text", false).$to_sym(), "html", $hash2(["css", "line_numbers", "line_number_start", "line_number_anchors", "highlight_lines", "bold_every"], {"css": ($truthy($a = self.document.$attributes()['$[]']("coderay-css")) ? $a : "class").$to_sym(), "line_numbers": linenums_mode, "line_number_start": start, "line_number_anchors": false, "highlight_lines": highlight_lines, "bold_every": false})).$highlight(source);} + else if ("pygments"['$===']($case)) { + lexer = ($truthy($a = $$$($$$('::', 'Pygments'), 'Lexer').$find_by_alias(self.$attr("language", "text", false))) ? $a : $$$($$$('::', 'Pygments'), 'Lexer').$find_by_mimetype("text/plain")); + opts = $hash2(["cssclass", "classprefix", "nobackground", "stripnl"], {"cssclass": "pyhl", "classprefix": "tok-", "nobackground": true, "stripnl": false}); + if (lexer.$name()['$==']("PHP")) { + + $writer = ["startinline", self['$option?']("mixed")['$!']()]; + $send(opts, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if (($truthy($a = self.document.$attributes()['$[]']("pygments-css")) ? $a : "class")['$==']("class")) { + } else { + + + $writer = ["noclasses", true]; + $send(opts, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["style", ($truthy($a = self.document.$attributes()['$[]']("pygments-style")) ? $a : $$$($$($nesting, 'Stylesheets'), 'DEFAULT_PYGMENTS_STYLE'))]; + $send(opts, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + }; + if ($truthy(self['$attr?']("highlight", nil, false))) { + if ($truthy((highlight_lines = self.$resolve_lines_to_highlight(source, self.$attr("highlight", nil, false)))['$empty?']())) { + } else { + + $writer = ["hl_lines", highlight_lines.$join(" ")]; + $send(opts, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }}; + if ($truthy(($truthy($a = ($truthy($b = self['$attr?']("linenums", nil, false)) ? (($writer = ["linenostart", (function() {if ($truthy($rb_lt((start = self.$attr("start", 1, false)).$to_i(), 1))) { + return 1 + } else { + return start + }; return nil; })()]), $send(opts, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]) : $b)) ? (($writer = ["linenos", ($truthy($b = self.document.$attributes()['$[]']("pygments-linenums-mode")) ? $b : "table")]), $send(opts, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])['$==']("table") : $a))) { + + linenums_mode = "table"; + if ($truthy((result = lexer.$highlight(source, $hash2(["options"], {"options": opts}))))) { + result = result.$sub($$($nesting, 'PygmentsWrapperDivRx'), "\\1").$gsub($$($nesting, 'PygmentsWrapperPreRx'), "\\1") + } else { + result = self.$sub_specialchars(source) + }; + } else if ($truthy((result = lexer.$highlight(source, $hash2(["options"], {"options": opts}))))) { + if ($truthy($$($nesting, 'PygmentsWrapperPreRx')['$=~'](result))) { + result = (($a = $gvars['~']) === nil ? nil : $a['$[]'](1))} + } else { + result = self.$sub_specialchars(source) + };}; + if ($truthy(self.passthroughs['$empty?']())) { + } else { + result = result.$gsub($$($nesting, 'HighlightedPassSlotRx'), "" + ($$($nesting, 'PASS_START')) + "\\1" + ($$($nesting, 'PASS_END'))) + }; + if ($truthy(($truthy($a = process_callouts) ? callout_marks : $a))) { + + lineno = 0; + autonum = 0; + reached_code = linenums_mode['$!=']("table"); + return $send(result.$split($$($nesting, 'LF'), -1), 'map', [], (TMP_74 = function(line){var self = TMP_74.$$s || this, $g, $h, TMP_75, conums = nil, tail = nil, pos = nil, guard = nil, conum = nil, conums_markup = nil; + if (self.document == null) self.document = nil; + + + + if (line == null) { + line = nil; + }; + if ($truthy(reached_code)) { + } else { + + if ($truthy(line['$include?'](""))) { + } else { + return line; + }; + reached_code = true; + }; + lineno = $rb_plus(lineno, 1); + if ($truthy((conums = callout_marks.$delete(lineno)))) { + + tail = nil; + if ($truthy(($truthy($g = ($truthy($h = callout_on_last) ? callout_marks['$empty?']() : $h)) ? linenums_mode['$==']("table") : $g))) { + if ($truthy((($g = highlighter['$==']("coderay")) ? (pos = line.$index("")) : highlighter['$==']("coderay")))) { + $g = [line.$slice(0, pos), line.$slice(pos, line.$length())], (line = $g[0]), (tail = $g[1]), $g + } else if ($truthy((($g = highlighter['$==']("pygments")) ? (pos = line['$start_with?']("")) : highlighter['$==']("pygments")))) { + $g = ["", line], (line = $g[0]), (tail = $g[1]), $g}}; + if (conums.$size()['$=='](1)) { + + $h = conums['$[]'](0), $g = Opal.to_ary($h), (guard = ($g[0] == null ? nil : $g[0])), (conum = ($g[1] == null ? nil : $g[1])), $h; + return "" + (line) + ($$($nesting, 'Inline').$new(self, "callout", (function() {if (conum['$=='](".")) { + return (autonum = $rb_plus(autonum, 1)).$to_s() + } else { + return conum + }; return nil; })(), $hash2(["id", "attributes"], {"id": self.document.$callouts().$read_next_id(), "attributes": $hash2(["guard"], {"guard": guard})})).$convert()) + (tail); + } else { + + conums_markup = $send(conums, 'map', [], (TMP_75 = function(guard_it, conum_it){var self = TMP_75.$$s || this; + if (self.document == null) self.document = nil; + + + + if (guard_it == null) { + guard_it = nil; + }; + + if (conum_it == null) { + conum_it = nil; + }; + return $$($nesting, 'Inline').$new(self, "callout", (function() {if (conum_it['$=='](".")) { + return (autonum = $rb_plus(autonum, 1)).$to_s() + } else { + return conum_it + }; return nil; })(), $hash2(["id", "attributes"], {"id": self.document.$callouts().$read_next_id(), "attributes": $hash2(["guard"], {"guard": guard_it})})).$convert();}, TMP_75.$$s = self, TMP_75.$$arity = 2, TMP_75)).$join(" "); + return "" + (line) + (conums_markup) + (tail); + }; + } else { + return line + };}, TMP_74.$$s = self, TMP_74.$$arity = 1, TMP_74)).$join($$($nesting, 'LF')); + } else { + return result + }; + }, TMP_Substitutors_highlight_source_71.$$arity = -3); + + Opal.def(self, '$resolve_lines_to_highlight', TMP_Substitutors_resolve_lines_to_highlight_76 = function $$resolve_lines_to_highlight(source, spec) { + var TMP_77, self = this, lines = nil; + + + lines = []; + if ($truthy(spec['$include?'](" "))) { + spec = spec.$delete(" ")}; + $send((function() {if ($truthy(spec['$include?'](","))) { + + return spec.$split(","); + } else { + + return spec.$split(";"); + }; return nil; })(), 'map', [], (TMP_77 = function(entry){var self = TMP_77.$$s || this, $a, $b, negate = nil, delim = nil, from = nil, to = nil, line_nums = nil; + + + + if (entry == null) { + entry = nil; + }; + negate = false; + if ($truthy(entry['$start_with?']("!"))) { + + entry = entry.$slice(1, entry.$length()); + negate = true;}; + if ($truthy((delim = (function() {if ($truthy(entry['$include?'](".."))) { + return ".." + } else { + + if ($truthy(entry['$include?']("-"))) { + return "-" + } else { + return nil + }; + }; return nil; })()))) { + + $b = entry.$split(delim, 2), $a = Opal.to_ary($b), (from = ($a[0] == null ? nil : $a[0])), (to = ($a[1] == null ? nil : $a[1])), $b; + if ($truthy(($truthy($a = to['$empty?']()) ? $a : $rb_lt((to = to.$to_i()), 0)))) { + to = $rb_plus(source.$count($$($nesting, 'LF')), 1)}; + line_nums = $$$('::', 'Range').$new(from.$to_i(), to).$to_a(); + if ($truthy(negate)) { + return (lines = $rb_minus(lines, line_nums)) + } else { + return lines.$concat(line_nums) + }; + } else if ($truthy(negate)) { + return lines.$delete(entry.$to_i()) + } else { + return lines['$<<'](entry.$to_i()) + };}, TMP_77.$$s = self, TMP_77.$$arity = 1, TMP_77)); + return lines.$sort().$uniq(); + }, TMP_Substitutors_resolve_lines_to_highlight_76.$$arity = 2); + + Opal.def(self, '$sub_source', TMP_Substitutors_sub_source_78 = function $$sub_source(source, process_callouts) { + var self = this; + + if ($truthy(process_callouts)) { + return self.$sub_callouts(self.$sub_specialchars(source)) + } else { + + return self.$sub_specialchars(source); + } + }, TMP_Substitutors_sub_source_78.$$arity = 2); + + Opal.def(self, '$lock_in_subs', TMP_Substitutors_lock_in_subs_79 = function $$lock_in_subs() { + var $a, $b, $c, $d, $e, self = this, default_subs = nil, $case = nil, custom_subs = nil, idx = nil, $writer = nil; + if (self.default_subs == null) self.default_subs = nil; + if (self.content_model == null) self.content_model = nil; + if (self.context == null) self.context = nil; + if (self.subs == null) self.subs = nil; + if (self.attributes == null) self.attributes = nil; + if (self.style == null) self.style = nil; + if (self.document == null) self.document = nil; + + + if ($truthy((default_subs = self.default_subs))) { + } else { + $case = self.content_model; + if ("simple"['$===']($case)) {default_subs = $$($nesting, 'NORMAL_SUBS')} + else if ("verbatim"['$===']($case)) {if ($truthy(($truthy($a = self.context['$==']("listing")) ? $a : (($b = self.context['$==']("literal")) ? self['$option?']("listparagraph")['$!']() : self.context['$==']("literal"))))) { + default_subs = $$($nesting, 'VERBATIM_SUBS') + } else if (self.context['$==']("verse")) { + default_subs = $$($nesting, 'NORMAL_SUBS') + } else { + default_subs = $$($nesting, 'BASIC_SUBS') + }} + else if ("raw"['$===']($case)) {default_subs = (function() {if (self.context['$==']("stem")) { + return $$($nesting, 'BASIC_SUBS') + } else { + return $$($nesting, 'NONE_SUBS') + }; return nil; })()} + else {return self.subs} + }; + if ($truthy((custom_subs = self.attributes['$[]']("subs")))) { + self.subs = ($truthy($a = self.$resolve_block_subs(custom_subs, default_subs, self.context)) ? $a : []) + } else { + self.subs = default_subs.$drop(0) + }; + if ($truthy(($truthy($a = ($truthy($b = ($truthy($c = ($truthy($d = (($e = self.context['$==']("listing")) ? self.style['$==']("source") : self.context['$==']("listing"))) ? self.attributes['$key?']("language") : $d)) ? self.document['$basebackend?']("html") : $c)) ? $$($nesting, 'SUB_HIGHLIGHT')['$include?'](self.document.$attributes()['$[]']("source-highlighter")) : $b)) ? (idx = self.subs.$index("specialcharacters")) : $a))) { + + $writer = [idx, "highlight"]; + $send(self.subs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + return self.subs; + }, TMP_Substitutors_lock_in_subs_79.$$arity = 0); + })($nesting[0], $nesting) + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/abstract_node"] = function(Opal) { + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + function $rb_plus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); + } + function $rb_lt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $hash2 = Opal.hash2, $truthy = Opal.truthy, $send = Opal.send; + + Opal.add_stubs(['$include', '$attr_reader', '$attr_accessor', '$==', '$document', '$to_s', '$key?', '$dup', '$[]', '$raise', '$converter', '$attributes', '$nil?', '$[]=', '$-', '$delete', '$+', '$update', '$nil_or_empty?', '$split', '$include?', '$empty?', '$join', '$apply_reftext_subs', '$attr?', '$extname', '$attr', '$image_uri', '$<', '$safe', '$uriish?', '$uri_encode_spaces', '$normalize_web_path', '$generate_data_uri_from_uri', '$generate_data_uri', '$slice', '$length', '$normalize_system_path', '$readable?', '$strict_encode64', '$binread', '$warn', '$logger', '$require_library', '$!', '$open', '$content_type', '$read', '$base_dir', '$root?', '$path_resolver', '$system_path', '$web_path', '$===', '$!=', '$normalize_lines_array', '$to_a', '$each_line', '$open_uri', '$fetch', '$read_asset', '$gsub']); + return (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + (function($base, $super, $parent_nesting) { + function $AbstractNode(){}; + var self = $AbstractNode = $klass($base, $super, 'AbstractNode', $AbstractNode); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_AbstractNode_initialize_1, TMP_AbstractNode_block$q_2, TMP_AbstractNode_inline$q_3, TMP_AbstractNode_converter_4, TMP_AbstractNode_parent$eq_5, TMP_AbstractNode_attr_6, TMP_AbstractNode_attr$q_7, TMP_AbstractNode_set_attr_8, TMP_AbstractNode_remove_attr_9, TMP_AbstractNode_option$q_10, TMP_AbstractNode_set_option_11, TMP_AbstractNode_update_attributes_12, TMP_AbstractNode_role_13, TMP_AbstractNode_roles_14, TMP_AbstractNode_role$q_15, TMP_AbstractNode_has_role$q_16, TMP_AbstractNode_add_role_17, TMP_AbstractNode_remove_role_18, TMP_AbstractNode_reftext_19, TMP_AbstractNode_reftext$q_20, TMP_AbstractNode_icon_uri_21, TMP_AbstractNode_image_uri_22, TMP_AbstractNode_media_uri_23, TMP_AbstractNode_generate_data_uri_24, TMP_AbstractNode_generate_data_uri_from_uri_25, TMP_AbstractNode_normalize_asset_path_27, TMP_AbstractNode_normalize_system_path_28, TMP_AbstractNode_normalize_web_path_29, TMP_AbstractNode_read_asset_30, TMP_AbstractNode_read_contents_32, TMP_AbstractNode_uri_encode_spaces_35, TMP_AbstractNode_is_uri$q_36; + + def.document = def.attributes = def.parent = nil; + + self.$include($$($nesting, 'Logging')); + self.$include($$($nesting, 'Substitutors')); + self.$attr_reader("attributes"); + self.$attr_reader("context"); + self.$attr_reader("document"); + self.$attr_accessor("id"); + self.$attr_reader("node_name"); + self.$attr_reader("parent"); + + Opal.def(self, '$initialize', TMP_AbstractNode_initialize_1 = function $$initialize(parent, context, opts) { + var $a, self = this; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + if (context['$==']("document")) { + $a = [self, nil], (self.document = $a[0]), (self.parent = $a[1]), $a + } else if ($truthy(parent)) { + $a = [parent.$document(), parent], (self.document = $a[0]), (self.parent = $a[1]), $a + } else { + self.document = (self.parent = nil) + }; + self.node_name = (self.context = context).$to_s(); + self.attributes = (function() {if ($truthy(opts['$key?']("attributes"))) { + return opts['$[]']("attributes").$dup() + } else { + return $hash2([], {}) + }; return nil; })(); + return (self.passthroughs = $hash2([], {})); + }, TMP_AbstractNode_initialize_1.$$arity = -3); + + Opal.def(self, '$block?', TMP_AbstractNode_block$q_2 = function() { + var self = this; + + return self.$raise($$$('::', 'NotImplementedError')) + }, TMP_AbstractNode_block$q_2.$$arity = 0); + + Opal.def(self, '$inline?', TMP_AbstractNode_inline$q_3 = function() { + var self = this; + + return self.$raise($$$('::', 'NotImplementedError')) + }, TMP_AbstractNode_inline$q_3.$$arity = 0); + + Opal.def(self, '$converter', TMP_AbstractNode_converter_4 = function $$converter() { + var self = this; + + return self.document.$converter() + }, TMP_AbstractNode_converter_4.$$arity = 0); + + Opal.def(self, '$parent=', TMP_AbstractNode_parent$eq_5 = function(parent) { + var $a, self = this; + + return $a = [parent, parent.$document()], (self.parent = $a[0]), (self.document = $a[1]), $a + }, TMP_AbstractNode_parent$eq_5.$$arity = 1); + + Opal.def(self, '$attr', TMP_AbstractNode_attr_6 = function $$attr(name, default_val, inherit) { + var $a, $b, self = this; + + + + if (default_val == null) { + default_val = nil; + }; + + if (inherit == null) { + inherit = true; + }; + name = name.$to_s(); + return ($truthy($a = self.attributes['$[]'](name)) ? $a : (function() {if ($truthy(($truthy($b = inherit) ? self.parent : $b))) { + return ($truthy($b = self.document.$attributes()['$[]'](name)) ? $b : default_val) + } else { + return default_val + }; return nil; })()); + }, TMP_AbstractNode_attr_6.$$arity = -2); + + Opal.def(self, '$attr?', TMP_AbstractNode_attr$q_7 = function(name, expect_val, inherit) { + var $a, $b, $c, self = this; + + + + if (expect_val == null) { + expect_val = nil; + }; + + if (inherit == null) { + inherit = true; + }; + name = name.$to_s(); + if ($truthy(expect_val['$nil?']())) { + return ($truthy($a = self.attributes['$key?'](name)) ? $a : ($truthy($b = ($truthy($c = inherit) ? self.parent : $c)) ? self.document.$attributes()['$key?'](name) : $b)) + } else { + return expect_val['$=='](($truthy($a = self.attributes['$[]'](name)) ? $a : (function() {if ($truthy(($truthy($b = inherit) ? self.parent : $b))) { + return self.document.$attributes()['$[]'](name) + } else { + return nil + }; return nil; })())) + }; + }, TMP_AbstractNode_attr$q_7.$$arity = -2); + + Opal.def(self, '$set_attr', TMP_AbstractNode_set_attr_8 = function $$set_attr(name, value, overwrite) { + var $a, self = this, $writer = nil; + + + + if (value == null) { + value = ""; + }; + + if (overwrite == null) { + overwrite = true; + }; + if ($truthy((($a = overwrite['$=='](false)) ? self.attributes['$key?'](name) : overwrite['$=='](false)))) { + return false + } else { + + + $writer = [name, value]; + $send(self.attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + return true; + }; + }, TMP_AbstractNode_set_attr_8.$$arity = -2); + + Opal.def(self, '$remove_attr', TMP_AbstractNode_remove_attr_9 = function $$remove_attr(name) { + var self = this; + + return self.attributes.$delete(name) + }, TMP_AbstractNode_remove_attr_9.$$arity = 1); + + Opal.def(self, '$option?', TMP_AbstractNode_option$q_10 = function(name) { + var self = this; + + return self.attributes['$key?']("" + (name) + "-option") + }, TMP_AbstractNode_option$q_10.$$arity = 1); + + Opal.def(self, '$set_option', TMP_AbstractNode_set_option_11 = function $$set_option(name) { + var self = this, attrs = nil, key = nil, $writer = nil; + + if ($truthy((attrs = self.attributes)['$[]']("options"))) { + if ($truthy(attrs['$[]']((key = "" + (name) + "-option")))) { + return nil + } else { + + + $writer = ["options", $rb_plus(attrs['$[]']("options"), "" + "," + (name))]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = [key, ""]; + $send(attrs, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];; + } + } else { + + + $writer = ["options", name]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["" + (name) + "-option", ""]; + $send(attrs, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];; + } + }, TMP_AbstractNode_set_option_11.$$arity = 1); + + Opal.def(self, '$update_attributes', TMP_AbstractNode_update_attributes_12 = function $$update_attributes(attributes) { + var self = this; + + + self.attributes.$update(attributes); + return nil; + }, TMP_AbstractNode_update_attributes_12.$$arity = 1); + + Opal.def(self, '$role', TMP_AbstractNode_role_13 = function $$role() { + var $a, self = this; + + return ($truthy($a = self.attributes['$[]']("role")) ? $a : self.document.$attributes()['$[]']("role")) + }, TMP_AbstractNode_role_13.$$arity = 0); + + Opal.def(self, '$roles', TMP_AbstractNode_roles_14 = function $$roles() { + var $a, self = this, val = nil; + + if ($truthy((val = ($truthy($a = self.attributes['$[]']("role")) ? $a : self.document.$attributes()['$[]']("role")))['$nil_or_empty?']())) { + return [] + } else { + return val.$split() + } + }, TMP_AbstractNode_roles_14.$$arity = 0); + + Opal.def(self, '$role?', TMP_AbstractNode_role$q_15 = function(expect_val) { + var $a, self = this; + + + + if (expect_val == null) { + expect_val = nil; + }; + if ($truthy(expect_val)) { + return expect_val['$=='](($truthy($a = self.attributes['$[]']("role")) ? $a : self.document.$attributes()['$[]']("role"))) + } else { + return ($truthy($a = self.attributes['$key?']("role")) ? $a : self.document.$attributes()['$key?']("role")) + }; + }, TMP_AbstractNode_role$q_15.$$arity = -1); + + Opal.def(self, '$has_role?', TMP_AbstractNode_has_role$q_16 = function(name) { + var $a, self = this, val = nil; + + if ($truthy((val = ($truthy($a = self.attributes['$[]']("role")) ? $a : self.document.$attributes()['$[]']("role"))))) { + return ((("" + " ") + (val)) + " ")['$include?']("" + " " + (name) + " ") + } else { + return false + } + }, TMP_AbstractNode_has_role$q_16.$$arity = 1); + + Opal.def(self, '$add_role', TMP_AbstractNode_add_role_17 = function $$add_role(name) { + var self = this, val = nil, $writer = nil; + + if ($truthy((val = self.attributes['$[]']("role"))['$nil_or_empty?']())) { + + + $writer = ["role", name]; + $send(self.attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + return true; + } else if ($truthy(((("" + " ") + (val)) + " ")['$include?']("" + " " + (name) + " "))) { + return false + } else { + + + $writer = ["role", "" + (val) + " " + (name)]; + $send(self.attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + return true; + } + }, TMP_AbstractNode_add_role_17.$$arity = 1); + + Opal.def(self, '$remove_role', TMP_AbstractNode_remove_role_18 = function $$remove_role(name) { + var self = this, val = nil, $writer = nil; + + if ($truthy((val = self.attributes['$[]']("role"))['$nil_or_empty?']())) { + return false + } else if ($truthy((val = val.$split()).$delete(name))) { + + if ($truthy(val['$empty?']())) { + self.attributes.$delete("role") + } else { + + $writer = ["role", val.$join(" ")]; + $send(self.attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + return true; + } else { + return false + } + }, TMP_AbstractNode_remove_role_18.$$arity = 1); + + Opal.def(self, '$reftext', TMP_AbstractNode_reftext_19 = function $$reftext() { + var self = this, val = nil; + + if ($truthy((val = self.attributes['$[]']("reftext")))) { + + return self.$apply_reftext_subs(val); + } else { + return nil + } + }, TMP_AbstractNode_reftext_19.$$arity = 0); + + Opal.def(self, '$reftext?', TMP_AbstractNode_reftext$q_20 = function() { + var self = this; + + return self.attributes['$key?']("reftext") + }, TMP_AbstractNode_reftext$q_20.$$arity = 0); + + Opal.def(self, '$icon_uri', TMP_AbstractNode_icon_uri_21 = function $$icon_uri(name) { + var self = this, icon = nil; + + + if ($truthy(self['$attr?']("icon"))) { + if ($truthy($$$('::', 'File').$extname((icon = self.$attr("icon")))['$empty?']())) { + icon = "" + (icon) + "." + (self.document.$attr("icontype", "png"))} + } else { + icon = "" + (name) + "." + (self.document.$attr("icontype", "png")) + }; + return self.$image_uri(icon, "iconsdir"); + }, TMP_AbstractNode_icon_uri_21.$$arity = 1); + + Opal.def(self, '$image_uri', TMP_AbstractNode_image_uri_22 = function $$image_uri(target_image, asset_dir_key) { + var $a, $b, $c, $d, self = this, doc = nil, images_base = nil; + + + + if (asset_dir_key == null) { + asset_dir_key = "imagesdir"; + }; + if ($truthy(($truthy($a = $rb_lt((doc = self.document).$safe(), $$$($$($nesting, 'SafeMode'), 'SECURE'))) ? doc['$attr?']("data-uri") : $a))) { + if ($truthy(($truthy($a = ($truthy($b = $$($nesting, 'Helpers')['$uriish?'](target_image)) ? (target_image = self.$uri_encode_spaces(target_image)) : $b)) ? $a : ($truthy($b = ($truthy($c = ($truthy($d = asset_dir_key) ? (images_base = doc.$attr(asset_dir_key)) : $d)) ? $$($nesting, 'Helpers')['$uriish?'](images_base) : $c)) ? (target_image = self.$normalize_web_path(target_image, images_base, false)) : $b)))) { + if ($truthy(doc['$attr?']("allow-uri-read"))) { + return self.$generate_data_uri_from_uri(target_image, doc['$attr?']("cache-uri")) + } else { + return target_image + } + } else { + return self.$generate_data_uri(target_image, asset_dir_key) + } + } else { + return self.$normalize_web_path(target_image, (function() {if ($truthy(asset_dir_key)) { + + return doc.$attr(asset_dir_key); + } else { + return nil + }; return nil; })()) + }; + }, TMP_AbstractNode_image_uri_22.$$arity = -2); + + Opal.def(self, '$media_uri', TMP_AbstractNode_media_uri_23 = function $$media_uri(target, asset_dir_key) { + var self = this; + + + + if (asset_dir_key == null) { + asset_dir_key = "imagesdir"; + }; + return self.$normalize_web_path(target, (function() {if ($truthy(asset_dir_key)) { + return self.document.$attr(asset_dir_key) + } else { + return nil + }; return nil; })()); + }, TMP_AbstractNode_media_uri_23.$$arity = -2); + + Opal.def(self, '$generate_data_uri', TMP_AbstractNode_generate_data_uri_24 = function $$generate_data_uri(target_image, asset_dir_key) { + var self = this, ext = nil, mimetype = nil, image_path = nil; + + + + if (asset_dir_key == null) { + asset_dir_key = nil; + }; + ext = $$$('::', 'File').$extname(target_image); + mimetype = (function() {if (ext['$=='](".svg")) { + return "image/svg+xml" + } else { + return "" + "image/" + (ext.$slice(1, ext.$length())) + }; return nil; })(); + if ($truthy(asset_dir_key)) { + image_path = self.$normalize_system_path(target_image, self.document.$attr(asset_dir_key), nil, $hash2(["target_name"], {"target_name": "image"})) + } else { + image_path = self.$normalize_system_path(target_image) + }; + if ($truthy($$$('::', 'File')['$readable?'](image_path))) { + return "" + "data:" + (mimetype) + ";base64," + ($$$('::', 'Base64').$strict_encode64($$$('::', 'IO').$binread(image_path))) + } else { + + self.$logger().$warn("" + "image to embed not found or not readable: " + (image_path)); + return "" + "data:" + (mimetype) + ";base64,"; + }; + }, TMP_AbstractNode_generate_data_uri_24.$$arity = -2); + + Opal.def(self, '$generate_data_uri_from_uri', TMP_AbstractNode_generate_data_uri_from_uri_25 = function $$generate_data_uri_from_uri(image_uri, cache_uri) { + var TMP_26, self = this, mimetype = nil, bindata = nil; + + + + if (cache_uri == null) { + cache_uri = false; + }; + if ($truthy(cache_uri)) { + $$($nesting, 'Helpers').$require_library("open-uri/cached", "open-uri-cached") + } else if ($truthy($$$('::', 'RUBY_ENGINE_OPAL')['$!']())) { + $$$('::', 'OpenURI')}; + + try { + + mimetype = nil; + bindata = $send(self, 'open', [image_uri, "rb"], (TMP_26 = function(f){var self = TMP_26.$$s || this; + + + + if (f == null) { + f = nil; + }; + mimetype = f.$content_type(); + return f.$read();}, TMP_26.$$s = self, TMP_26.$$arity = 1, TMP_26)); + return "" + "data:" + (mimetype) + ";base64," + ($$$('::', 'Base64').$strict_encode64(bindata)); + } catch ($err) { + if (Opal.rescue($err, [$$($nesting, 'StandardError')])) { + try { + + self.$logger().$warn("" + "could not retrieve image data from URI: " + (image_uri)); + return image_uri; + } finally { Opal.pop_exception() } + } else { throw $err; } + };; + }, TMP_AbstractNode_generate_data_uri_from_uri_25.$$arity = -2); + + Opal.def(self, '$normalize_asset_path', TMP_AbstractNode_normalize_asset_path_27 = function $$normalize_asset_path(asset_ref, asset_name, autocorrect) { + var self = this; + + + + if (asset_name == null) { + asset_name = "path"; + }; + + if (autocorrect == null) { + autocorrect = true; + }; + return self.$normalize_system_path(asset_ref, self.document.$base_dir(), nil, $hash2(["target_name", "recover"], {"target_name": asset_name, "recover": autocorrect})); + }, TMP_AbstractNode_normalize_asset_path_27.$$arity = -2); + + Opal.def(self, '$normalize_system_path', TMP_AbstractNode_normalize_system_path_28 = function $$normalize_system_path(target, start, jail, opts) { + var self = this, doc = nil; + + + + if (start == null) { + start = nil; + }; + + if (jail == null) { + jail = nil; + }; + + if (opts == null) { + opts = $hash2([], {}); + }; + if ($truthy($rb_lt((doc = self.document).$safe(), $$$($$($nesting, 'SafeMode'), 'SAFE')))) { + if ($truthy(start)) { + if ($truthy(doc.$path_resolver()['$root?'](start))) { + } else { + start = $$$('::', 'File').$join(doc.$base_dir(), start) + } + } else { + start = doc.$base_dir() + } + } else { + + if ($truthy(start)) { + } else { + start = doc.$base_dir() + }; + if ($truthy(jail)) { + } else { + jail = doc.$base_dir() + }; + }; + return doc.$path_resolver().$system_path(target, start, jail, opts); + }, TMP_AbstractNode_normalize_system_path_28.$$arity = -2); + + Opal.def(self, '$normalize_web_path', TMP_AbstractNode_normalize_web_path_29 = function $$normalize_web_path(target, start, preserve_uri_target) { + var $a, self = this; + + + + if (start == null) { + start = nil; + }; + + if (preserve_uri_target == null) { + preserve_uri_target = true; + }; + if ($truthy(($truthy($a = preserve_uri_target) ? $$($nesting, 'Helpers')['$uriish?'](target) : $a))) { + return self.$uri_encode_spaces(target) + } else { + return self.document.$path_resolver().$web_path(target, start) + }; + }, TMP_AbstractNode_normalize_web_path_29.$$arity = -2); + + Opal.def(self, '$read_asset', TMP_AbstractNode_read_asset_30 = function $$read_asset(path, opts) { + var TMP_31, $a, self = this; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + if ($truthy($$$('::', 'Hash')['$==='](opts))) { + } else { + opts = $hash2(["warn_on_failure"], {"warn_on_failure": opts['$!='](false)}) + }; + if ($truthy($$$('::', 'File')['$readable?'](path))) { + if ($truthy(opts['$[]']("normalize"))) { + return $$($nesting, 'Helpers').$normalize_lines_array($send($$$('::', 'File'), 'open', [path, "rb"], (TMP_31 = function(f){var self = TMP_31.$$s || this; + + + + if (f == null) { + f = nil; + }; + return f.$each_line().$to_a();}, TMP_31.$$s = self, TMP_31.$$arity = 1, TMP_31))).$join($$($nesting, 'LF')) + } else { + return $$$('::', 'IO').$read(path) + } + } else if ($truthy(opts['$[]']("warn_on_failure"))) { + + self.$logger().$warn("" + (($truthy($a = self.$attr("docfile")) ? $a : "")) + ": " + (($truthy($a = opts['$[]']("label")) ? $a : "file")) + " does not exist or cannot be read: " + (path)); + return nil; + } else { + return nil + }; + }, TMP_AbstractNode_read_asset_30.$$arity = -2); + + Opal.def(self, '$read_contents', TMP_AbstractNode_read_contents_32 = function $$read_contents(target, opts) { + var $a, $b, $c, TMP_33, TMP_34, self = this, doc = nil, start = nil; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + doc = self.document; + if ($truthy(($truthy($a = $$($nesting, 'Helpers')['$uriish?'](target)) ? $a : ($truthy($b = ($truthy($c = (start = opts['$[]']("start"))) ? $$($nesting, 'Helpers')['$uriish?'](start) : $c)) ? (target = doc.$path_resolver().$web_path(target, start)) : $b)))) { + if ($truthy(doc['$attr?']("allow-uri-read"))) { + + if ($truthy(doc['$attr?']("cache-uri"))) { + $$($nesting, 'Helpers').$require_library("open-uri/cached", "open-uri-cached")}; + + try { + if ($truthy(opts['$[]']("normalize"))) { + return $$($nesting, 'Helpers').$normalize_lines_array($send($$$('::', 'OpenURI'), 'open_uri', [target], (TMP_33 = function(f){var self = TMP_33.$$s || this; + + + + if (f == null) { + f = nil; + }; + return f.$each_line().$to_a();}, TMP_33.$$s = self, TMP_33.$$arity = 1, TMP_33))).$join($$($nesting, 'LF')) + } else { + return $send($$$('::', 'OpenURI'), 'open_uri', [target], (TMP_34 = function(f){var self = TMP_34.$$s || this; + + + + if (f == null) { + f = nil; + }; + return f.$read();}, TMP_34.$$s = self, TMP_34.$$arity = 1, TMP_34)) + } + } catch ($err) { + if (Opal.rescue($err, [$$($nesting, 'StandardError')])) { + try { + + if ($truthy(opts.$fetch("warn_on_failure", true))) { + self.$logger().$warn("" + "could not retrieve contents of " + (($truthy($a = opts['$[]']("label")) ? $a : "asset")) + " at URI: " + (target))}; + return nil; + } finally { Opal.pop_exception() } + } else { throw $err; } + };; + } else { + + if ($truthy(opts.$fetch("warn_on_failure", true))) { + self.$logger().$warn("" + "cannot retrieve contents of " + (($truthy($a = opts['$[]']("label")) ? $a : "asset")) + " at URI: " + (target) + " (allow-uri-read attribute not enabled)")}; + return nil; + } + } else { + + target = self.$normalize_system_path(target, opts['$[]']("start"), nil, $hash2(["target_name"], {"target_name": ($truthy($a = opts['$[]']("label")) ? $a : "asset")})); + return self.$read_asset(target, $hash2(["normalize", "warn_on_failure", "label"], {"normalize": opts['$[]']("normalize"), "warn_on_failure": opts.$fetch("warn_on_failure", true), "label": opts['$[]']("label")})); + }; + }, TMP_AbstractNode_read_contents_32.$$arity = -2); + + Opal.def(self, '$uri_encode_spaces', TMP_AbstractNode_uri_encode_spaces_35 = function $$uri_encode_spaces(str) { + var self = this; + + if ($truthy(str['$include?'](" "))) { + + return str.$gsub(" ", "%20"); + } else { + return str + } + }, TMP_AbstractNode_uri_encode_spaces_35.$$arity = 1); + return (Opal.def(self, '$is_uri?', TMP_AbstractNode_is_uri$q_36 = function(str) { + var self = this; + + return $$($nesting, 'Helpers')['$uriish?'](str) + }, TMP_AbstractNode_is_uri$q_36.$$arity = 1), nil) && 'is_uri?'; + })($nesting[0], null, $nesting) + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/abstract_block"] = function(Opal) { + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + function $rb_gt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); + } + function $rb_plus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $hash2 = Opal.hash2, $send = Opal.send, $truthy = Opal.truthy; + + Opal.add_stubs(['$attr_reader', '$attr_writer', '$attr_accessor', '$==', '$!=', '$level', '$file', '$lineno', '$playback_attributes', '$convert', '$converter', '$join', '$map', '$to_s', '$parent', '$parent=', '$-', '$<<', '$!', '$empty?', '$>', '$find_by_internal', '$to_proc', '$[]', '$has_role?', '$replace', '$raise', '$===', '$header?', '$each', '$flatten', '$context', '$blocks', '$+', '$find_index', '$next_adjacent_block', '$select', '$sub_specialchars', '$match?', '$sub_replacements', '$title', '$apply_title_subs', '$include?', '$delete', '$reftext', '$sprintf', '$sub_quotes', '$compat_mode', '$attributes', '$chomp', '$increment_and_store_counter', '$index=', '$numbered', '$sectname', '$counter', '$numeral=', '$numeral', '$caption=', '$assign_numeral', '$reindex_sections']); + return (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + (function($base, $super, $parent_nesting) { + function $AbstractBlock(){}; + var self = $AbstractBlock = $klass($base, $super, 'AbstractBlock', $AbstractBlock); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_AbstractBlock_initialize_1, TMP_AbstractBlock_block$q_2, TMP_AbstractBlock_inline$q_3, TMP_AbstractBlock_file_4, TMP_AbstractBlock_lineno_5, TMP_AbstractBlock_convert_6, TMP_AbstractBlock_content_7, TMP_AbstractBlock_context$eq_9, TMP_AbstractBlock_$lt$lt_10, TMP_AbstractBlock_blocks$q_11, TMP_AbstractBlock_sections$q_12, TMP_AbstractBlock_find_by_13, TMP_AbstractBlock_find_by_internal_14, TMP_AbstractBlock_next_adjacent_block_17, TMP_AbstractBlock_sections_18, TMP_AbstractBlock_alt_20, TMP_AbstractBlock_caption_21, TMP_AbstractBlock_captioned_title_22, TMP_AbstractBlock_list_marker_keyword_23, TMP_AbstractBlock_title_24, TMP_AbstractBlock_title$q_25, TMP_AbstractBlock_title$eq_26, TMP_AbstractBlock_sub$q_27, TMP_AbstractBlock_remove_sub_28, TMP_AbstractBlock_xreftext_29, TMP_AbstractBlock_assign_caption_30, TMP_AbstractBlock_assign_numeral_31, TMP_AbstractBlock_reindex_sections_32; + + def.source_location = def.document = def.attributes = def.blocks = def.next_section_index = def.context = def.style = def.id = def.header = def.caption = def.title_converted = def.converted_title = def.title = def.subs = def.numeral = def.next_section_ordinal = nil; + + self.$attr_reader("blocks"); + self.$attr_writer("caption"); + self.$attr_accessor("content_model"); + self.$attr_accessor("level"); + self.$attr_accessor("numeral"); + Opal.alias(self, "number", "numeral"); + Opal.alias(self, "number=", "numeral="); + self.$attr_accessor("source_location"); + self.$attr_accessor("style"); + self.$attr_reader("subs"); + + Opal.def(self, '$initialize', TMP_AbstractBlock_initialize_1 = function $$initialize(parent, context, opts) { + var $a, $iter = TMP_AbstractBlock_initialize_1.$$p, $yield = $iter || nil, self = this, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_AbstractBlock_initialize_1.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + + + if (opts == null) { + opts = $hash2([], {}); + }; + $send(self, Opal.find_super_dispatcher(self, 'initialize', TMP_AbstractBlock_initialize_1, false), $zuper, $iter); + self.content_model = "compound"; + self.blocks = []; + self.subs = []; + self.id = (self.title = (self.title_converted = (self.caption = (self.numeral = (self.style = (self.default_subs = (self.source_location = nil))))))); + if (context['$==']("document")) { + self.level = 0 + } else if ($truthy(($truthy($a = parent) ? context['$!=']("section") : $a))) { + self.level = parent.$level() + } else { + self.level = nil + }; + self.next_section_index = 0; + return (self.next_section_ordinal = 1); + }, TMP_AbstractBlock_initialize_1.$$arity = -3); + + Opal.def(self, '$block?', TMP_AbstractBlock_block$q_2 = function() { + var self = this; + + return true + }, TMP_AbstractBlock_block$q_2.$$arity = 0); + + Opal.def(self, '$inline?', TMP_AbstractBlock_inline$q_3 = function() { + var self = this; + + return false + }, TMP_AbstractBlock_inline$q_3.$$arity = 0); + + Opal.def(self, '$file', TMP_AbstractBlock_file_4 = function $$file() { + var $a, self = this; + + return ($truthy($a = self.source_location) ? self.source_location.$file() : $a) + }, TMP_AbstractBlock_file_4.$$arity = 0); + + Opal.def(self, '$lineno', TMP_AbstractBlock_lineno_5 = function $$lineno() { + var $a, self = this; + + return ($truthy($a = self.source_location) ? self.source_location.$lineno() : $a) + }, TMP_AbstractBlock_lineno_5.$$arity = 0); + + Opal.def(self, '$convert', TMP_AbstractBlock_convert_6 = function $$convert() { + var self = this; + + + self.document.$playback_attributes(self.attributes); + return self.$converter().$convert(self); + }, TMP_AbstractBlock_convert_6.$$arity = 0); + Opal.alias(self, "render", "convert"); + + Opal.def(self, '$content', TMP_AbstractBlock_content_7 = function $$content() { + var TMP_8, self = this; + + return $send(self.blocks, 'map', [], (TMP_8 = function(b){var self = TMP_8.$$s || this; + + + + if (b == null) { + b = nil; + }; + return b.$convert();}, TMP_8.$$s = self, TMP_8.$$arity = 1, TMP_8)).$join($$($nesting, 'LF')) + }, TMP_AbstractBlock_content_7.$$arity = 0); + + Opal.def(self, '$context=', TMP_AbstractBlock_context$eq_9 = function(context) { + var self = this; + + return (self.node_name = (self.context = context).$to_s()) + }, TMP_AbstractBlock_context$eq_9.$$arity = 1); + + Opal.def(self, '$<<', TMP_AbstractBlock_$lt$lt_10 = function(block) { + var self = this, $writer = nil; + + + if (block.$parent()['$=='](self)) { + } else { + + $writer = [self]; + $send(block, 'parent=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + self.blocks['$<<'](block); + return self; + }, TMP_AbstractBlock_$lt$lt_10.$$arity = 1); + Opal.alias(self, "append", "<<"); + + Opal.def(self, '$blocks?', TMP_AbstractBlock_blocks$q_11 = function() { + var self = this; + + return self.blocks['$empty?']()['$!']() + }, TMP_AbstractBlock_blocks$q_11.$$arity = 0); + + Opal.def(self, '$sections?', TMP_AbstractBlock_sections$q_12 = function() { + var self = this; + + return $rb_gt(self.next_section_index, 0) + }, TMP_AbstractBlock_sections$q_12.$$arity = 0); + + Opal.def(self, '$find_by', TMP_AbstractBlock_find_by_13 = function $$find_by(selector) { + var $iter = TMP_AbstractBlock_find_by_13.$$p, block = $iter || nil, self = this, result = nil; + + if ($iter) TMP_AbstractBlock_find_by_13.$$p = null; + + + if ($iter) TMP_AbstractBlock_find_by_13.$$p = null;; + + if (selector == null) { + selector = $hash2([], {}); + }; + try { + return $send(self, 'find_by_internal', [selector, (result = [])], block.$to_proc()) + } catch ($err) { + if (Opal.rescue($err, [$$$('::', 'StopIteration')])) { + try { + return result + } finally { Opal.pop_exception() } + } else { throw $err; } + }; + }, TMP_AbstractBlock_find_by_13.$$arity = -1); + Opal.alias(self, "query", "find_by"); + + Opal.def(self, '$find_by_internal', TMP_AbstractBlock_find_by_internal_14 = function $$find_by_internal(selector, result) { + var $iter = TMP_AbstractBlock_find_by_internal_14.$$p, block = $iter || nil, $a, $b, $c, $d, TMP_15, TMP_16, self = this, any_context = nil, context_selector = nil, style_selector = nil, role_selector = nil, id_selector = nil, verdict = nil, $case = nil; + + if ($iter) TMP_AbstractBlock_find_by_internal_14.$$p = null; + + + if ($iter) TMP_AbstractBlock_find_by_internal_14.$$p = null;; + + if (selector == null) { + selector = $hash2([], {}); + }; + + if (result == null) { + result = []; + }; + if ($truthy(($truthy($a = ($truthy($b = ($truthy($c = ($truthy($d = (any_context = (context_selector = selector['$[]']("context"))['$!']())) ? $d : context_selector['$=='](self.context))) ? ($truthy($d = (style_selector = selector['$[]']("style"))['$!']()) ? $d : style_selector['$=='](self.style)) : $c)) ? ($truthy($c = (role_selector = selector['$[]']("role"))['$!']()) ? $c : self['$has_role?'](role_selector)) : $b)) ? ($truthy($b = (id_selector = selector['$[]']("id"))['$!']()) ? $b : id_selector['$=='](self.id)) : $a))) { + if ($truthy(id_selector)) { + + result.$replace((function() {if ((block !== nil)) { + + if ($truthy(Opal.yield1(block, self))) { + return [self] + } else { + return [] + }; + } else { + return [self] + }; return nil; })()); + self.$raise($$$('::', 'StopIteration')); + } else if ((block !== nil)) { + if ($truthy((verdict = Opal.yield1(block, self)))) { + $case = verdict; + if ("skip_children"['$===']($case)) { + result['$<<'](self); + return result;} + else if ("skip"['$===']($case)) {return result} + else {result['$<<'](self)}} + } else { + result['$<<'](self) + }}; + if ($truthy(($truthy($a = (($b = self.context['$==']("document")) ? ($truthy($c = any_context) ? $c : context_selector['$==']("section")) : self.context['$==']("document"))) ? self['$header?']() : $a))) { + $send(self.header, 'find_by_internal', [selector, result], block.$to_proc())}; + if (context_selector['$==']("document")) { + } else if (self.context['$==']("dlist")) { + if ($truthy(($truthy($a = any_context) ? $a : context_selector['$!=']("section")))) { + $send(self.blocks.$flatten(), 'each', [], (TMP_15 = function(li){var self = TMP_15.$$s || this; + + + + if (li == null) { + li = nil; + }; + if ($truthy(li)) { + return $send(li, 'find_by_internal', [selector, result], block.$to_proc()) + } else { + return nil + };}, TMP_15.$$s = self, TMP_15.$$arity = 1, TMP_15))} + } else if ($truthy($send(self.blocks, 'each', [], (TMP_16 = function(b){var self = TMP_16.$$s || this, $e; + + + + if (b == null) { + b = nil; + }; + if ($truthy((($e = context_selector['$==']("section")) ? b.$context()['$!=']("section") : context_selector['$==']("section")))) { + return nil;}; + return $send(b, 'find_by_internal', [selector, result], block.$to_proc());}, TMP_16.$$s = self, TMP_16.$$arity = 1, TMP_16)))) {}; + return result; + }, TMP_AbstractBlock_find_by_internal_14.$$arity = -1); + + Opal.def(self, '$next_adjacent_block', TMP_AbstractBlock_next_adjacent_block_17 = function $$next_adjacent_block() { + var self = this, sib = nil, p = nil; + + if (self.context['$==']("document")) { + return nil + } else if ($truthy((sib = (p = self.$parent()).$blocks()['$[]']($rb_plus(p.$blocks().$find_index(self), 1))))) { + return sib + } else { + return p.$next_adjacent_block() + } + }, TMP_AbstractBlock_next_adjacent_block_17.$$arity = 0); + + Opal.def(self, '$sections', TMP_AbstractBlock_sections_18 = function $$sections() { + var TMP_19, self = this; + + return $send(self.blocks, 'select', [], (TMP_19 = function(block){var self = TMP_19.$$s || this; + + + + if (block == null) { + block = nil; + }; + return block.$context()['$==']("section");}, TMP_19.$$s = self, TMP_19.$$arity = 1, TMP_19)) + }, TMP_AbstractBlock_sections_18.$$arity = 0); + + Opal.def(self, '$alt', TMP_AbstractBlock_alt_20 = function $$alt() { + var self = this, text = nil; + + if ($truthy((text = self.attributes['$[]']("alt")))) { + if (text['$=='](self.attributes['$[]']("default-alt"))) { + return self.$sub_specialchars(text) + } else { + + text = self.$sub_specialchars(text); + if ($truthy($$($nesting, 'ReplaceableTextRx')['$match?'](text))) { + + return self.$sub_replacements(text); + } else { + return text + }; + } + } else { + return nil + } + }, TMP_AbstractBlock_alt_20.$$arity = 0); + + Opal.def(self, '$caption', TMP_AbstractBlock_caption_21 = function $$caption() { + var self = this; + + if (self.context['$==']("admonition")) { + return self.attributes['$[]']("textlabel") + } else { + return self.caption + } + }, TMP_AbstractBlock_caption_21.$$arity = 0); + + Opal.def(self, '$captioned_title', TMP_AbstractBlock_captioned_title_22 = function $$captioned_title() { + var self = this; + + return "" + (self.caption) + (self.$title()) + }, TMP_AbstractBlock_captioned_title_22.$$arity = 0); + + Opal.def(self, '$list_marker_keyword', TMP_AbstractBlock_list_marker_keyword_23 = function $$list_marker_keyword(list_type) { + var $a, self = this; + + + + if (list_type == null) { + list_type = nil; + }; + return $$($nesting, 'ORDERED_LIST_KEYWORDS')['$[]'](($truthy($a = list_type) ? $a : self.style)); + }, TMP_AbstractBlock_list_marker_keyword_23.$$arity = -1); + + Opal.def(self, '$title', TMP_AbstractBlock_title_24 = function $$title() { + var $a, $b, self = this; + + if ($truthy(self.title_converted)) { + return self.converted_title + } else { + + return (self.converted_title = ($truthy($a = ($truthy($b = (self.title_converted = true)) ? self.title : $b)) ? self.$apply_title_subs(self.title) : $a)); + } + }, TMP_AbstractBlock_title_24.$$arity = 0); + + Opal.def(self, '$title?', TMP_AbstractBlock_title$q_25 = function() { + var self = this; + + if ($truthy(self.title)) { + return true + } else { + return false + } + }, TMP_AbstractBlock_title$q_25.$$arity = 0); + + Opal.def(self, '$title=', TMP_AbstractBlock_title$eq_26 = function(val) { + var $a, self = this; + + return $a = [val, nil], (self.title = $a[0]), (self.title_converted = $a[1]), $a + }, TMP_AbstractBlock_title$eq_26.$$arity = 1); + + Opal.def(self, '$sub?', TMP_AbstractBlock_sub$q_27 = function(name) { + var self = this; + + return self.subs['$include?'](name) + }, TMP_AbstractBlock_sub$q_27.$$arity = 1); + + Opal.def(self, '$remove_sub', TMP_AbstractBlock_remove_sub_28 = function $$remove_sub(sub) { + var self = this; + + + self.subs.$delete(sub); + return nil; + }, TMP_AbstractBlock_remove_sub_28.$$arity = 1); + + Opal.def(self, '$xreftext', TMP_AbstractBlock_xreftext_29 = function $$xreftext(xrefstyle) { + var $a, $b, self = this, val = nil, $case = nil, quoted_title = nil, prefix = nil; + + + + if (xrefstyle == null) { + xrefstyle = nil; + }; + if ($truthy(($truthy($a = (val = self.$reftext())) ? val['$empty?']()['$!']() : $a))) { + return val + } else if ($truthy(($truthy($a = ($truthy($b = xrefstyle) ? self.title : $b)) ? self.caption : $a))) { + return (function() {$case = xrefstyle; + if ("full"['$===']($case)) { + quoted_title = self.$sprintf(self.$sub_quotes((function() {if ($truthy(self.document.$compat_mode())) { + return "``%s''" + } else { + return "\"`%s`\"" + }; return nil; })()), self.$title()); + if ($truthy(($truthy($a = self.numeral) ? (prefix = self.document.$attributes()['$[]']((function() {if (self.context['$==']("image")) { + return "figure-caption" + } else { + return "" + (self.context) + "-caption" + }; return nil; })())) : $a))) { + return "" + (prefix) + " " + (self.numeral) + ", " + (quoted_title) + } else { + return "" + (self.caption.$chomp(". ")) + ", " + (quoted_title) + };} + else if ("short"['$===']($case)) {if ($truthy(($truthy($a = self.numeral) ? (prefix = self.document.$attributes()['$[]']((function() {if (self.context['$==']("image")) { + return "figure-caption" + } else { + return "" + (self.context) + "-caption" + }; return nil; })())) : $a))) { + return "" + (prefix) + " " + (self.numeral) + } else { + return self.caption.$chomp(". ") + }} + else {return self.$title()}})() + } else { + return self.$title() + }; + }, TMP_AbstractBlock_xreftext_29.$$arity = -1); + + Opal.def(self, '$assign_caption', TMP_AbstractBlock_assign_caption_30 = function $$assign_caption(value, key) { + var $a, $b, self = this, prefix = nil; + + + + if (value == null) { + value = nil; + }; + + if (key == null) { + key = nil; + }; + if ($truthy(($truthy($a = ($truthy($b = self.caption) ? $b : self.title['$!']())) ? $a : (self.caption = ($truthy($b = value) ? $b : self.document.$attributes()['$[]']("caption")))))) { + return nil + } else if ($truthy((prefix = self.document.$attributes()['$[]']("" + ((key = ($truthy($a = key) ? $a : self.context))) + "-caption")))) { + + self.caption = "" + (prefix) + " " + ((self.numeral = self.document.$increment_and_store_counter("" + (key) + "-number", self))) + ". "; + return nil; + } else { + return nil + }; + }, TMP_AbstractBlock_assign_caption_30.$$arity = -1); + + Opal.def(self, '$assign_numeral', TMP_AbstractBlock_assign_numeral_31 = function $$assign_numeral(section) { + var $a, self = this, $writer = nil, like = nil, sectname = nil, caption = nil; + + + self.next_section_index = $rb_plus((($writer = [self.next_section_index]), $send(section, 'index=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]), 1); + if ($truthy((like = section.$numbered()))) { + if ((sectname = section.$sectname())['$==']("appendix")) { + + + $writer = [self.document.$counter("appendix-number", "A")]; + $send(section, 'numeral=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + if ($truthy((caption = self.document.$attributes()['$[]']("appendix-caption")))) { + + $writer = ["" + (caption) + " " + (section.$numeral()) + ": "]; + $send(section, 'caption=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + } else { + + $writer = ["" + (section.$numeral()) + ". "]; + $send(section, 'caption=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + } else if ($truthy(($truthy($a = sectname['$==']("chapter")) ? $a : like['$==']("chapter")))) { + + $writer = [self.document.$counter("chapter-number", 1)]; + $send(section, 'numeral=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + } else { + + + $writer = [self.next_section_ordinal]; + $send(section, 'numeral=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + self.next_section_ordinal = $rb_plus(self.next_section_ordinal, 1); + }}; + return nil; + }, TMP_AbstractBlock_assign_numeral_31.$$arity = 1); + return (Opal.def(self, '$reindex_sections', TMP_AbstractBlock_reindex_sections_32 = function $$reindex_sections() { + var TMP_33, self = this; + + + self.next_section_index = 0; + self.next_section_ordinal = 1; + return $send(self.blocks, 'each', [], (TMP_33 = function(block){var self = TMP_33.$$s || this; + + + + if (block == null) { + block = nil; + }; + if (block.$context()['$==']("section")) { + + self.$assign_numeral(block); + return block.$reindex_sections(); + } else { + return nil + };}, TMP_33.$$s = self, TMP_33.$$arity = 1, TMP_33)); + }, TMP_AbstractBlock_reindex_sections_32.$$arity = 0), nil) && 'reindex_sections'; + })($nesting[0], $$($nesting, 'AbstractNode'), $nesting) + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/attribute_list"] = function(Opal) { + function $rb_plus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); + } + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + function $rb_times(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs * rhs : lhs['$*'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $hash = Opal.hash, $hash2 = Opal.hash2, $truthy = Opal.truthy, $send = Opal.send; + + Opal.add_stubs(['$new', '$[]', '$update', '$parse', '$parse_attribute', '$eos?', '$skip_delimiter', '$+', '$rekey', '$each_with_index', '$[]=', '$-', '$skip_blank', '$==', '$peek', '$parse_attribute_value', '$get_byte', '$start_with?', '$scan_name', '$!', '$!=', '$*', '$scan_to_delimiter', '$===', '$include?', '$delete', '$each', '$split', '$empty?', '$strip', '$apply_subs', '$scan_to_quote', '$gsub', '$skip', '$scan']); + return (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + (function($base, $super, $parent_nesting) { + function $AttributeList(){}; + var self = $AttributeList = $klass($base, $super, 'AttributeList', $AttributeList); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_AttributeList_initialize_1, TMP_AttributeList_parse_into_2, TMP_AttributeList_parse_3, TMP_AttributeList_rekey_4, TMP_AttributeList_rekey_5, TMP_AttributeList_parse_attribute_7, TMP_AttributeList_parse_attribute_value_9, TMP_AttributeList_skip_blank_10, TMP_AttributeList_skip_delimiter_11, TMP_AttributeList_scan_name_12, TMP_AttributeList_scan_to_delimiter_13, TMP_AttributeList_scan_to_quote_14; + + def.attributes = def.scanner = def.delimiter = def.block = def.delimiter_skip_pattern = def.delimiter_boundary_pattern = nil; + + Opal.const_set($nesting[0], 'BACKSLASH', "\\"); + Opal.const_set($nesting[0], 'APOS', "'"); + Opal.const_set($nesting[0], 'BoundaryRxs', $hash("\"", /.*?[^\\](?=")/, $$($nesting, 'APOS'), /.*?[^\\](?=')/, ",", /.*?(?=[ \t]*(,|$))/)); + Opal.const_set($nesting[0], 'EscapedQuotes', $hash("\"", "\\\"", $$($nesting, 'APOS'), "\\'")); + Opal.const_set($nesting[0], 'NameRx', new RegExp("" + ($$($nesting, 'CG_WORD')) + "[" + ($$($nesting, 'CC_WORD')) + "\\-.]*")); + Opal.const_set($nesting[0], 'BlankRx', /[ \t]+/); + Opal.const_set($nesting[0], 'SkipRxs', $hash2(["blank", ","], {"blank": $$($nesting, 'BlankRx'), ",": /[ \t]*(,|$)/})); + + Opal.def(self, '$initialize', TMP_AttributeList_initialize_1 = function $$initialize(source, block, delimiter) { + var self = this; + + + + if (block == null) { + block = nil; + }; + + if (delimiter == null) { + delimiter = ","; + }; + self.scanner = $$$('::', 'StringScanner').$new(source); + self.block = block; + self.delimiter = delimiter; + self.delimiter_skip_pattern = $$($nesting, 'SkipRxs')['$[]'](delimiter); + self.delimiter_boundary_pattern = $$($nesting, 'BoundaryRxs')['$[]'](delimiter); + return (self.attributes = nil); + }, TMP_AttributeList_initialize_1.$$arity = -2); + + Opal.def(self, '$parse_into', TMP_AttributeList_parse_into_2 = function $$parse_into(attributes, posattrs) { + var self = this; + + + + if (posattrs == null) { + posattrs = []; + }; + return attributes.$update(self.$parse(posattrs)); + }, TMP_AttributeList_parse_into_2.$$arity = -2); + + Opal.def(self, '$parse', TMP_AttributeList_parse_3 = function $$parse(posattrs) { + var $a, self = this, index = nil; + + + + if (posattrs == null) { + posattrs = []; + }; + if ($truthy(self.attributes)) { + return self.attributes}; + self.attributes = $hash2([], {}); + index = 0; + while ($truthy(self.$parse_attribute(index, posattrs))) { + + if ($truthy(self.scanner['$eos?']())) { + break;}; + self.$skip_delimiter(); + index = $rb_plus(index, 1); + }; + return self.attributes; + }, TMP_AttributeList_parse_3.$$arity = -1); + + Opal.def(self, '$rekey', TMP_AttributeList_rekey_4 = function $$rekey(posattrs) { + var self = this; + + return $$($nesting, 'AttributeList').$rekey(self.attributes, posattrs) + }, TMP_AttributeList_rekey_4.$$arity = 1); + Opal.defs(self, '$rekey', TMP_AttributeList_rekey_5 = function $$rekey(attributes, pos_attrs) { + var TMP_6, self = this; + + + $send(pos_attrs, 'each_with_index', [], (TMP_6 = function(key, index){var self = TMP_6.$$s || this, pos = nil, val = nil, $writer = nil; + + + + if (key == null) { + key = nil; + }; + + if (index == null) { + index = nil; + }; + if ($truthy(key)) { + } else { + return nil; + }; + pos = $rb_plus(index, 1); + if ($truthy((val = attributes['$[]'](pos)))) { + + $writer = [key, val]; + $send(attributes, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + } else { + return nil + };}, TMP_6.$$s = self, TMP_6.$$arity = 2, TMP_6)); + return attributes; + }, TMP_AttributeList_rekey_5.$$arity = 2); + + Opal.def(self, '$parse_attribute', TMP_AttributeList_parse_attribute_7 = function $$parse_attribute(index, pos_attrs) { + var $a, TMP_8, self = this, single_quoted_value = nil, first = nil, name = nil, value = nil, skipped = nil, c = nil, $case = nil, $writer = nil, resolved_name = nil, pos_name = nil; + + + + if (index == null) { + index = 0; + }; + + if (pos_attrs == null) { + pos_attrs = []; + }; + single_quoted_value = false; + self.$skip_blank(); + if ((first = self.scanner.$peek(1))['$==']("\"")) { + + name = self.$parse_attribute_value(self.scanner.$get_byte()); + value = nil; + } else if (first['$==']($$($nesting, 'APOS'))) { + + name = self.$parse_attribute_value(self.scanner.$get_byte()); + value = nil; + if ($truthy(name['$start_with?']($$($nesting, 'APOS')))) { + } else { + single_quoted_value = true + }; + } else { + + name = self.$scan_name(); + skipped = 0; + c = nil; + if ($truthy(self.scanner['$eos?']())) { + if ($truthy(name)) { + } else { + return false + } + } else { + + skipped = ($truthy($a = self.$skip_blank()) ? $a : 0); + c = self.scanner.$get_byte(); + }; + if ($truthy(($truthy($a = c['$!']()) ? $a : c['$=='](self.delimiter)))) { + value = nil + } else if ($truthy(($truthy($a = c['$!=']("=")) ? $a : name['$!']()))) { + + name = "" + (name) + ($rb_times(" ", skipped)) + (c) + (self.$scan_to_delimiter()); + value = nil; + } else { + + self.$skip_blank(); + if ($truthy(self.scanner.$peek(1))) { + if ((c = self.scanner.$get_byte())['$==']("\"")) { + value = self.$parse_attribute_value(c) + } else if (c['$==']($$($nesting, 'APOS'))) { + + value = self.$parse_attribute_value(c); + if ($truthy(value['$start_with?']($$($nesting, 'APOS')))) { + } else { + single_quoted_value = true + }; + } else if (c['$=='](self.delimiter)) { + value = "" + } else { + + value = "" + (c) + (self.$scan_to_delimiter()); + if (value['$==']("None")) { + return true}; + }}; + }; + }; + if ($truthy(value)) { + $case = name; + if ("options"['$===']($case) || "opts"['$===']($case)) { + if ($truthy(value['$include?'](","))) { + + if ($truthy(value['$include?'](" "))) { + value = value.$delete(" ")}; + $send(value.$split(","), 'each', [], (TMP_8 = function(opt){var self = TMP_8.$$s || this, $writer = nil; + if (self.attributes == null) self.attributes = nil; + + + + if (opt == null) { + opt = nil; + }; + if ($truthy(opt['$empty?']())) { + return nil + } else { + + $writer = ["" + (opt) + "-option", ""]; + $send(self.attributes, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + };}, TMP_8.$$s = self, TMP_8.$$arity = 1, TMP_8)); + } else { + + $writer = ["" + ((value = value.$strip())) + "-option", ""]; + $send(self.attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + + $writer = ["options", value]; + $send(self.attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];;} + else {if ($truthy(($truthy($a = single_quoted_value) ? self.block : $a))) { + $case = name; + if ("title"['$===']($case) || "reftext"['$===']($case)) { + $writer = [name, value]; + $send(self.attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];} + else { + $writer = [name, self.block.$apply_subs(value)]; + $send(self.attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];} + } else { + + $writer = [name, value]; + $send(self.attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }} + } else { + + resolved_name = (function() {if ($truthy(($truthy($a = single_quoted_value) ? self.block : $a))) { + + return self.block.$apply_subs(name); + } else { + return name + }; return nil; })(); + if ($truthy((pos_name = pos_attrs['$[]'](index)))) { + + $writer = [pos_name, resolved_name]; + $send(self.attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + + $writer = [$rb_plus(index, 1), resolved_name]; + $send(self.attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + }; + return true; + }, TMP_AttributeList_parse_attribute_7.$$arity = -1); + + Opal.def(self, '$parse_attribute_value', TMP_AttributeList_parse_attribute_value_9 = function $$parse_attribute_value(quote) { + var self = this, value = nil; + + + if (self.scanner.$peek(1)['$=='](quote)) { + + self.scanner.$get_byte(); + return "";}; + if ($truthy((value = self.$scan_to_quote(quote)))) { + + self.scanner.$get_byte(); + if ($truthy(value['$include?']($$($nesting, 'BACKSLASH')))) { + return value.$gsub($$($nesting, 'EscapedQuotes')['$[]'](quote), quote) + } else { + return value + }; + } else { + return "" + (quote) + (self.$scan_to_delimiter()) + }; + }, TMP_AttributeList_parse_attribute_value_9.$$arity = 1); + + Opal.def(self, '$skip_blank', TMP_AttributeList_skip_blank_10 = function $$skip_blank() { + var self = this; + + return self.scanner.$skip($$($nesting, 'BlankRx')) + }, TMP_AttributeList_skip_blank_10.$$arity = 0); + + Opal.def(self, '$skip_delimiter', TMP_AttributeList_skip_delimiter_11 = function $$skip_delimiter() { + var self = this; + + return self.scanner.$skip(self.delimiter_skip_pattern) + }, TMP_AttributeList_skip_delimiter_11.$$arity = 0); + + Opal.def(self, '$scan_name', TMP_AttributeList_scan_name_12 = function $$scan_name() { + var self = this; + + return self.scanner.$scan($$($nesting, 'NameRx')) + }, TMP_AttributeList_scan_name_12.$$arity = 0); + + Opal.def(self, '$scan_to_delimiter', TMP_AttributeList_scan_to_delimiter_13 = function $$scan_to_delimiter() { + var self = this; + + return self.scanner.$scan(self.delimiter_boundary_pattern) + }, TMP_AttributeList_scan_to_delimiter_13.$$arity = 0); + return (Opal.def(self, '$scan_to_quote', TMP_AttributeList_scan_to_quote_14 = function $$scan_to_quote(quote) { + var self = this; + + return self.scanner.$scan($$($nesting, 'BoundaryRxs')['$[]'](quote)) + }, TMP_AttributeList_scan_to_quote_14.$$arity = 1), nil) && 'scan_to_quote'; + })($nesting[0], null, $nesting) + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/block"] = function(Opal) { + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + function $rb_lt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $send = Opal.send, $hash2 = Opal.hash2, $truthy = Opal.truthy; + + Opal.add_stubs(['$default=', '$-', '$attr_accessor', '$[]', '$key?', '$==', '$===', '$drop', '$delete', '$[]=', '$lock_in_subs', '$nil_or_empty?', '$normalize_lines_from_string', '$apply_subs', '$join', '$<', '$size', '$empty?', '$rstrip', '$shift', '$pop', '$warn', '$logger', '$to_s', '$class', '$object_id', '$inspect']); + return (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + (function($base, $super, $parent_nesting) { + function $Block(){}; + var self = $Block = $klass($base, $super, 'Block', $Block); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Block_initialize_1, TMP_Block_content_2, TMP_Block_source_3, TMP_Block_to_s_4, $writer = nil; + + def.attributes = def.content_model = def.lines = def.subs = def.blocks = def.context = def.style = nil; + + + $writer = ["simple"]; + $send(Opal.const_set($nesting[0], 'DEFAULT_CONTENT_MODEL', $hash2(["audio", "image", "listing", "literal", "stem", "open", "page_break", "pass", "thematic_break", "video"], {"audio": "empty", "image": "empty", "listing": "verbatim", "literal": "verbatim", "stem": "raw", "open": "compound", "page_break": "empty", "pass": "raw", "thematic_break": "empty", "video": "empty"})), 'default=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + Opal.alias(self, "blockname", "context"); + self.$attr_accessor("lines"); + + Opal.def(self, '$initialize', TMP_Block_initialize_1 = function $$initialize(parent, context, opts) { + var $a, $iter = TMP_Block_initialize_1.$$p, $yield = $iter || nil, self = this, subs = nil, $writer = nil, raw_source = nil, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_Block_initialize_1.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + + + if (opts == null) { + opts = $hash2([], {}); + }; + $send(self, Opal.find_super_dispatcher(self, 'initialize', TMP_Block_initialize_1, false), $zuper, $iter); + self.content_model = ($truthy($a = opts['$[]']("content_model")) ? $a : $$($nesting, 'DEFAULT_CONTENT_MODEL')['$[]'](context)); + if ($truthy(opts['$key?']("subs"))) { + if ($truthy((subs = opts['$[]']("subs")))) { + + if (subs['$==']("default")) { + self.default_subs = opts['$[]']("default_subs") + } else if ($truthy($$$('::', 'Array')['$==='](subs))) { + + self.default_subs = subs.$drop(0); + self.attributes.$delete("subs"); + } else { + + self.default_subs = nil; + + $writer = ["subs", "" + (subs)]; + $send(self.attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + }; + self.$lock_in_subs(); + } else { + + self.default_subs = []; + self.attributes.$delete("subs"); + } + } else { + self.default_subs = nil + }; + if ($truthy((raw_source = opts['$[]']("source"))['$nil_or_empty?']())) { + return (self.lines = []) + } else if ($truthy($$$('::', 'String')['$==='](raw_source))) { + return (self.lines = $$($nesting, 'Helpers').$normalize_lines_from_string(raw_source)) + } else { + return (self.lines = raw_source.$drop(0)) + }; + }, TMP_Block_initialize_1.$$arity = -3); + + Opal.def(self, '$content', TMP_Block_content_2 = function $$content() { + var $a, $b, $iter = TMP_Block_content_2.$$p, $yield = $iter || nil, self = this, $case = nil, result = nil, first = nil, last = nil, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_Block_content_2.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + return (function() {$case = self.content_model; + if ("compound"['$===']($case)) {return $send(self, Opal.find_super_dispatcher(self, 'content', TMP_Block_content_2, false), $zuper, $iter)} + else if ("simple"['$===']($case)) {return self.$apply_subs(self.lines.$join($$($nesting, 'LF')), self.subs)} + else if ("verbatim"['$===']($case) || "raw"['$===']($case)) { + result = self.$apply_subs(self.lines, self.subs); + if ($truthy($rb_lt(result.$size(), 2))) { + return result['$[]'](0) + } else { + + while ($truthy(($truthy($b = (first = result['$[]'](0))) ? first.$rstrip()['$empty?']() : $b))) { + result.$shift() + }; + while ($truthy(($truthy($b = (last = result['$[]'](-1))) ? last.$rstrip()['$empty?']() : $b))) { + result.$pop() + }; + return result.$join($$($nesting, 'LF')); + };} + else { + if (self.content_model['$==']("empty")) { + } else { + self.$logger().$warn("" + "Unknown content model '" + (self.content_model) + "' for block: " + (self.$to_s())) + }; + return nil;}})() + }, TMP_Block_content_2.$$arity = 0); + + Opal.def(self, '$source', TMP_Block_source_3 = function $$source() { + var self = this; + + return self.lines.$join($$($nesting, 'LF')) + }, TMP_Block_source_3.$$arity = 0); + return (Opal.def(self, '$to_s', TMP_Block_to_s_4 = function $$to_s() { + var self = this, content_summary = nil; + + + content_summary = (function() {if (self.content_model['$==']("compound")) { + return "" + "blocks: " + (self.blocks.$size()) + } else { + return "" + "lines: " + (self.lines.$size()) + }; return nil; })(); + return "" + "#<" + (self.$class()) + "@" + (self.$object_id()) + " {context: " + (self.context.$inspect()) + ", content_model: " + (self.content_model.$inspect()) + ", style: " + (self.style.$inspect()) + ", " + (content_summary) + "}>"; + }, TMP_Block_to_s_4.$$arity = 0), nil) && 'to_s'; + })($nesting[0], $$($nesting, 'AbstractBlock'), $nesting) + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/callouts"] = function(Opal) { + function $rb_plus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); + } + function $rb_le(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs <= rhs : lhs['$<='](rhs); + } + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + function $rb_lt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $hash2 = Opal.hash2, $truthy = Opal.truthy, $send = Opal.send; + + Opal.add_stubs(['$next_list', '$<<', '$current_list', '$to_i', '$generate_next_callout_id', '$+', '$<=', '$size', '$[]', '$-', '$chop', '$join', '$map', '$==', '$<', '$generate_callout_id']); + return (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + (function($base, $super, $parent_nesting) { + function $Callouts(){}; + var self = $Callouts = $klass($base, $super, 'Callouts', $Callouts); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Callouts_initialize_1, TMP_Callouts_register_2, TMP_Callouts_read_next_id_3, TMP_Callouts_callout_ids_4, TMP_Callouts_current_list_6, TMP_Callouts_next_list_7, TMP_Callouts_rewind_8, TMP_Callouts_generate_next_callout_id_9, TMP_Callouts_generate_callout_id_10; + + def.co_index = def.lists = def.list_index = nil; + + + Opal.def(self, '$initialize', TMP_Callouts_initialize_1 = function $$initialize() { + var self = this; + + + self.lists = []; + self.list_index = 0; + return self.$next_list(); + }, TMP_Callouts_initialize_1.$$arity = 0); + + Opal.def(self, '$register', TMP_Callouts_register_2 = function $$register(li_ordinal) { + var self = this, id = nil; + + + self.$current_list()['$<<']($hash2(["ordinal", "id"], {"ordinal": li_ordinal.$to_i(), "id": (id = self.$generate_next_callout_id())})); + self.co_index = $rb_plus(self.co_index, 1); + return id; + }, TMP_Callouts_register_2.$$arity = 1); + + Opal.def(self, '$read_next_id', TMP_Callouts_read_next_id_3 = function $$read_next_id() { + var self = this, id = nil, list = nil; + + + id = nil; + list = self.$current_list(); + if ($truthy($rb_le(self.co_index, list.$size()))) { + id = list['$[]']($rb_minus(self.co_index, 1))['$[]']("id")}; + self.co_index = $rb_plus(self.co_index, 1); + return id; + }, TMP_Callouts_read_next_id_3.$$arity = 0); + + Opal.def(self, '$callout_ids', TMP_Callouts_callout_ids_4 = function $$callout_ids(li_ordinal) { + var TMP_5, self = this; + + return $send(self.$current_list(), 'map', [], (TMP_5 = function(it){var self = TMP_5.$$s || this; + + + + if (it == null) { + it = nil; + }; + if (it['$[]']("ordinal")['$=='](li_ordinal)) { + return "" + (it['$[]']("id")) + " " + } else { + return "" + };}, TMP_5.$$s = self, TMP_5.$$arity = 1, TMP_5)).$join().$chop() + }, TMP_Callouts_callout_ids_4.$$arity = 1); + + Opal.def(self, '$current_list', TMP_Callouts_current_list_6 = function $$current_list() { + var self = this; + + return self.lists['$[]']($rb_minus(self.list_index, 1)) + }, TMP_Callouts_current_list_6.$$arity = 0); + + Opal.def(self, '$next_list', TMP_Callouts_next_list_7 = function $$next_list() { + var self = this; + + + self.list_index = $rb_plus(self.list_index, 1); + if ($truthy($rb_lt(self.lists.$size(), self.list_index))) { + self.lists['$<<']([])}; + self.co_index = 1; + return nil; + }, TMP_Callouts_next_list_7.$$arity = 0); + + Opal.def(self, '$rewind', TMP_Callouts_rewind_8 = function $$rewind() { + var self = this; + + + self.list_index = 1; + self.co_index = 1; + return nil; + }, TMP_Callouts_rewind_8.$$arity = 0); + + Opal.def(self, '$generate_next_callout_id', TMP_Callouts_generate_next_callout_id_9 = function $$generate_next_callout_id() { + var self = this; + + return self.$generate_callout_id(self.list_index, self.co_index) + }, TMP_Callouts_generate_next_callout_id_9.$$arity = 0); + return (Opal.def(self, '$generate_callout_id', TMP_Callouts_generate_callout_id_10 = function $$generate_callout_id(list_index, co_index) { + var self = this; + + return "" + "CO" + (list_index) + "-" + (co_index) + }, TMP_Callouts_generate_callout_id_10.$$arity = 2), nil) && 'generate_callout_id'; + })($nesting[0], null, $nesting) + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/converter/base"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $hash2 = Opal.hash2, $truthy = Opal.truthy; + + Opal.add_stubs(['$include', '$node_name', '$empty?', '$send', '$content']); + return (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + + (function($base, $parent_nesting) { + function $Converter() {}; + var self = $Converter = $module($base, 'Converter', $Converter); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + nil + })($nesting[0], $nesting); + (function($base, $super, $parent_nesting) { + function $Base(){}; + var self = $Base = $klass($base, $super, 'Base', $Base); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + + self.$include($$($nesting, 'Logging')); + return self.$include($$($nesting, 'Converter')); + })($$($nesting, 'Converter'), null, $nesting); + (function($base, $super, $parent_nesting) { + function $BuiltIn(){}; + var self = $BuiltIn = $klass($base, $super, 'BuiltIn', $BuiltIn); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_BuiltIn_initialize_1, TMP_BuiltIn_convert_2, TMP_BuiltIn_content_3, TMP_BuiltIn_skip_4; + + + self.$include($$($nesting, 'Logging')); + + Opal.def(self, '$initialize', TMP_BuiltIn_initialize_1 = function $$initialize(backend, opts) { + var self = this; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + return nil; + }, TMP_BuiltIn_initialize_1.$$arity = -2); + + Opal.def(self, '$convert', TMP_BuiltIn_convert_2 = function $$convert(node, transform, opts) { + var $a, self = this; + + + + if (transform == null) { + transform = nil; + }; + + if (opts == null) { + opts = $hash2([], {}); + }; + transform = ($truthy($a = transform) ? $a : node.$node_name()); + if ($truthy(opts['$empty?']())) { + + return self.$send(transform, node); + } else { + + return self.$send(transform, node, opts); + }; + }, TMP_BuiltIn_convert_2.$$arity = -2); + Opal.alias(self, "handles?", "respond_to?"); + + Opal.def(self, '$content', TMP_BuiltIn_content_3 = function $$content(node) { + var self = this; + + return node.$content() + }, TMP_BuiltIn_content_3.$$arity = 1); + Opal.alias(self, "pass", "content"); + return (Opal.def(self, '$skip', TMP_BuiltIn_skip_4 = function $$skip(node) { + var self = this; + + return nil + }, TMP_BuiltIn_skip_4.$$arity = 1), nil) && 'skip'; + })($$($nesting, 'Converter'), null, $nesting); + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/converter/factory"] = function(Opal) { + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $truthy = Opal.truthy, $hash2 = Opal.hash2, $send = Opal.send; + + Opal.add_stubs(['$new', '$require', '$include?', '$include', '$warn', '$logger', '$register', '$default', '$resolve', '$create', '$converters', '$unregister_all', '$attr_reader', '$each', '$[]=', '$-', '$==', '$[]', '$clear', '$===', '$supports_templates?', '$to_s', '$key?']); + return (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + (function($base, $parent_nesting) { + function $Converter() {}; + var self = $Converter = $module($base, 'Converter', $Converter); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + (function($base, $super, $parent_nesting) { + function $Factory(){}; + var self = $Factory = $klass($base, $super, 'Factory', $Factory); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Factory_initialize_7, TMP_Factory_register_8, TMP_Factory_resolve_10, TMP_Factory_unregister_all_11, TMP_Factory_create_12; + + def.converters = def.star_converter = nil; + + self.__default__ = nil; + (function(self, $parent_nesting) { + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_default_1, TMP_register_2, TMP_resolve_3, TMP_create_4, TMP_converters_5, TMP_unregister_all_6; + + + + Opal.def(self, '$default', TMP_default_1 = function(initialize_singleton) { + var $a, $b, $c, self = this; + if (self.__default__ == null) self.__default__ = nil; + + + + if (initialize_singleton == null) { + initialize_singleton = true; + }; + if ($truthy(initialize_singleton)) { + } else { + return ($truthy($a = self.__default__) ? $a : self.$new()) + }; + return (self.__default__ = ($truthy($a = self.__default__) ? $a : (function() { try { + + if ($truthy((($c = $$$('::', 'Concurrent', 'skip_raise')) && ($b = $$$($c, 'Hash', 'skip_raise')) ? 'constant' : nil))) { + } else { + self.$require((function() {if ($truthy($$$('::', 'RUBY_MIN_VERSION_1_9'))) { + return "concurrent/hash" + } else { + return "asciidoctor/core_ext/1.8.7/concurrent/hash" + }; return nil; })()) + }; + return self.$new($$$($$$('::', 'Concurrent'), 'Hash').$new()); + } catch ($err) { + if (Opal.rescue($err, [$$$('::', 'LoadError')])) { + try { + + if ($truthy(self['$include?']($$($nesting, 'Logging')))) { + } else { + self.$include($$($nesting, 'Logging')) + }; + self.$logger().$warn("gem 'concurrent-ruby' is not installed. This gem is recommended when registering custom converters."); + return self.$new(); + } finally { Opal.pop_exception() } + } else { throw $err; } + }})())); + }, TMP_default_1.$$arity = -1); + + Opal.def(self, '$register', TMP_register_2 = function $$register(converter, backends) { + var self = this; + + + + if (backends == null) { + backends = ["*"]; + }; + return self.$default().$register(converter, backends); + }, TMP_register_2.$$arity = -2); + + Opal.def(self, '$resolve', TMP_resolve_3 = function $$resolve(backend) { + var self = this; + + return self.$default().$resolve(backend) + }, TMP_resolve_3.$$arity = 1); + + Opal.def(self, '$create', TMP_create_4 = function $$create(backend, opts) { + var self = this; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + return self.$default().$create(backend, opts); + }, TMP_create_4.$$arity = -2); + + Opal.def(self, '$converters', TMP_converters_5 = function $$converters() { + var self = this; + + return self.$default().$converters() + }, TMP_converters_5.$$arity = 0); + return (Opal.def(self, '$unregister_all', TMP_unregister_all_6 = function $$unregister_all() { + var self = this; + + return self.$default().$unregister_all() + }, TMP_unregister_all_6.$$arity = 0), nil) && 'unregister_all'; + })(Opal.get_singleton_class(self), $nesting); + self.$attr_reader("converters"); + + Opal.def(self, '$initialize', TMP_Factory_initialize_7 = function $$initialize(converters) { + var $a, self = this; + + + + if (converters == null) { + converters = nil; + }; + self.converters = ($truthy($a = converters) ? $a : $hash2([], {})); + return (self.star_converter = nil); + }, TMP_Factory_initialize_7.$$arity = -1); + + Opal.def(self, '$register', TMP_Factory_register_8 = function $$register(converter, backends) { + var TMP_9, self = this; + + + + if (backends == null) { + backends = ["*"]; + }; + $send(backends, 'each', [], (TMP_9 = function(backend){var self = TMP_9.$$s || this, $writer = nil; + if (self.converters == null) self.converters = nil; + + + + if (backend == null) { + backend = nil; + }; + + $writer = [backend, converter]; + $send(self.converters, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + if (backend['$==']("*")) { + return (self.star_converter = converter) + } else { + return nil + };}, TMP_9.$$s = self, TMP_9.$$arity = 1, TMP_9)); + return nil; + }, TMP_Factory_register_8.$$arity = -2); + + Opal.def(self, '$resolve', TMP_Factory_resolve_10 = function $$resolve(backend) { + var $a, $b, self = this; + + return ($truthy($a = self.converters) ? ($truthy($b = self.converters['$[]'](backend)) ? $b : self.star_converter) : $a) + }, TMP_Factory_resolve_10.$$arity = 1); + + Opal.def(self, '$unregister_all', TMP_Factory_unregister_all_11 = function $$unregister_all() { + var self = this; + + + self.converters.$clear(); + return (self.star_converter = nil); + }, TMP_Factory_unregister_all_11.$$arity = 0); + return (Opal.def(self, '$create', TMP_Factory_create_12 = function $$create(backend, opts) { + var $a, $b, $c, $d, $e, $f, $g, $h, $i, $j, $k, $l, $m, $n, $o, $p, $q, $r, self = this, converter = nil, base_converter = nil, $case = nil, template_converter = nil; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + if ($truthy((converter = self.$resolve(backend)))) { + + base_converter = (function() {if ($truthy($$$('::', 'Class')['$==='](converter))) { + + return converter.$new(backend, opts); + } else { + return converter + }; return nil; })(); + if ($truthy(($truthy($a = $$$($$($nesting, 'Converter'), 'BackendInfo')['$==='](base_converter)) ? base_converter['$supports_templates?']() : $a))) { + } else { + return base_converter + }; + } else { + $case = backend; + if ("html5"['$===']($case)) { + if ($truthy((($c = $$$('::', 'Asciidoctor', 'skip_raise')) && ($b = $$$($c, 'Converter', 'skip_raise')) && ($a = $$$($b, 'Html5Converter', 'skip_raise')) ? 'constant' : nil))) { + } else { + self.$require("asciidoctor/converter/html5".$to_s()) + }; + base_converter = $$($nesting, 'Html5Converter').$new(backend, opts);} + else if ("docbook5"['$===']($case)) { + if ($truthy((($f = $$$('::', 'Asciidoctor', 'skip_raise')) && ($e = $$$($f, 'Converter', 'skip_raise')) && ($d = $$$($e, 'DocBook5Converter', 'skip_raise')) ? 'constant' : nil))) { + } else { + self.$require("asciidoctor/converter/docbook5".$to_s()) + }; + base_converter = $$($nesting, 'DocBook5Converter').$new(backend, opts);} + else if ("docbook45"['$===']($case)) { + if ($truthy((($i = $$$('::', 'Asciidoctor', 'skip_raise')) && ($h = $$$($i, 'Converter', 'skip_raise')) && ($g = $$$($h, 'DocBook45Converter', 'skip_raise')) ? 'constant' : nil))) { + } else { + self.$require("asciidoctor/converter/docbook45".$to_s()) + }; + base_converter = $$($nesting, 'DocBook45Converter').$new(backend, opts);} + else if ("manpage"['$===']($case)) { + if ($truthy((($l = $$$('::', 'Asciidoctor', 'skip_raise')) && ($k = $$$($l, 'Converter', 'skip_raise')) && ($j = $$$($k, 'ManPageConverter', 'skip_raise')) ? 'constant' : nil))) { + } else { + self.$require("asciidoctor/converter/manpage".$to_s()) + }; + base_converter = $$($nesting, 'ManPageConverter').$new(backend, opts);} + }; + if ($truthy(opts['$key?']("template_dirs"))) { + } else { + return base_converter + }; + if ($truthy((($o = $$$('::', 'Asciidoctor', 'skip_raise')) && ($n = $$$($o, 'Converter', 'skip_raise')) && ($m = $$$($n, 'TemplateConverter', 'skip_raise')) ? 'constant' : nil))) { + } else { + self.$require("asciidoctor/converter/template".$to_s()) + }; + template_converter = $$($nesting, 'TemplateConverter').$new(backend, opts['$[]']("template_dirs"), opts); + if ($truthy((($r = $$$('::', 'Asciidoctor', 'skip_raise')) && ($q = $$$($r, 'Converter', 'skip_raise')) && ($p = $$$($q, 'CompositeConverter', 'skip_raise')) ? 'constant' : nil))) { + } else { + self.$require("asciidoctor/converter/composite".$to_s()) + }; + return $$($nesting, 'CompositeConverter').$new(backend, template_converter, base_converter); + }, TMP_Factory_create_12.$$arity = -2), nil) && 'create'; + })($nesting[0], null, $nesting) + })($nesting[0], $nesting) + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/converter"] = function(Opal) { + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $send = Opal.send, $truthy = Opal.truthy, $hash2 = Opal.hash2; + + Opal.add_stubs(['$register', '$==', '$send', '$include?', '$setup_backend_info', '$raise', '$class', '$sub', '$[]', '$slice', '$length', '$[]=', '$backend_info', '$-', '$extend', '$include', '$respond_to?', '$write', '$chomp', '$require']); + + (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + + (function($base, $parent_nesting) { + function $Converter() {}; + var self = $Converter = $module($base, 'Converter', $Converter); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Converter_initialize_13, TMP_Converter_convert_14; + + + (function($base, $parent_nesting) { + function $Config() {}; + var self = $Config = $module($base, 'Config', $Config); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Config_register_for_1; + + + Opal.def(self, '$register_for', TMP_Config_register_for_1 = function $$register_for($a) { + var $post_args, backends, TMP_2, TMP_3, self = this, metaclass = nil; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + backends = $post_args;; + $$($nesting, 'Factory').$register(self, backends); + metaclass = (function(self, $parent_nesting) { + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return self + })(Opal.get_singleton_class(self), $nesting); + if (backends['$=='](["*"])) { + $send(metaclass, 'send', ["define_method", "converts?"], (TMP_2 = function(name){var self = TMP_2.$$s || this; + + + + if (name == null) { + name = nil; + }; + return true;}, TMP_2.$$s = self, TMP_2.$$arity = 1, TMP_2)) + } else { + $send(metaclass, 'send', ["define_method", "converts?"], (TMP_3 = function(name){var self = TMP_3.$$s || this; + + + + if (name == null) { + name = nil; + }; + return backends['$include?'](name);}, TMP_3.$$s = self, TMP_3.$$arity = 1, TMP_3)) + }; + return nil; + }, TMP_Config_register_for_1.$$arity = -1) + })($nesting[0], $nesting); + (function($base, $parent_nesting) { + function $BackendInfo() {}; + var self = $BackendInfo = $module($base, 'BackendInfo', $BackendInfo); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_BackendInfo_backend_info_4, TMP_BackendInfo_setup_backend_info_5, TMP_BackendInfo_filetype_6, TMP_BackendInfo_basebackend_7, TMP_BackendInfo_outfilesuffix_8, TMP_BackendInfo_htmlsyntax_9, TMP_BackendInfo_supports_templates_10, TMP_BackendInfo_supports_templates$q_11; + + + + Opal.def(self, '$backend_info', TMP_BackendInfo_backend_info_4 = function $$backend_info() { + var $a, self = this; + if (self.backend_info == null) self.backend_info = nil; + + return (self.backend_info = ($truthy($a = self.backend_info) ? $a : self.$setup_backend_info())) + }, TMP_BackendInfo_backend_info_4.$$arity = 0); + + Opal.def(self, '$setup_backend_info', TMP_BackendInfo_setup_backend_info_5 = function $$setup_backend_info() { + var self = this, base = nil, ext = nil, type = nil, syntax = nil; + if (self.backend == null) self.backend = nil; + + + if ($truthy(self.backend)) { + } else { + self.$raise($$$('::', 'ArgumentError'), "" + "Cannot determine backend for converter: " + (self.$class())) + }; + base = self.backend.$sub($$($nesting, 'TrailingDigitsRx'), ""); + if ($truthy((ext = $$($nesting, 'DEFAULT_EXTENSIONS')['$[]'](base)))) { + type = ext.$slice(1, ext.$length()) + } else { + + base = "html"; + ext = ".html"; + type = "html"; + syntax = "html"; + }; + return $hash2(["basebackend", "outfilesuffix", "filetype", "htmlsyntax"], {"basebackend": base, "outfilesuffix": ext, "filetype": type, "htmlsyntax": syntax}); + }, TMP_BackendInfo_setup_backend_info_5.$$arity = 0); + + Opal.def(self, '$filetype', TMP_BackendInfo_filetype_6 = function $$filetype(value) { + var self = this, $writer = nil; + + + + if (value == null) { + value = nil; + }; + if ($truthy(value)) { + + $writer = ["filetype", value]; + $send(self.$backend_info(), '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + } else { + return self.$backend_info()['$[]']("filetype") + }; + }, TMP_BackendInfo_filetype_6.$$arity = -1); + + Opal.def(self, '$basebackend', TMP_BackendInfo_basebackend_7 = function $$basebackend(value) { + var self = this, $writer = nil; + + + + if (value == null) { + value = nil; + }; + if ($truthy(value)) { + + $writer = ["basebackend", value]; + $send(self.$backend_info(), '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + } else { + return self.$backend_info()['$[]']("basebackend") + }; + }, TMP_BackendInfo_basebackend_7.$$arity = -1); + + Opal.def(self, '$outfilesuffix', TMP_BackendInfo_outfilesuffix_8 = function $$outfilesuffix(value) { + var self = this, $writer = nil; + + + + if (value == null) { + value = nil; + }; + if ($truthy(value)) { + + $writer = ["outfilesuffix", value]; + $send(self.$backend_info(), '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + } else { + return self.$backend_info()['$[]']("outfilesuffix") + }; + }, TMP_BackendInfo_outfilesuffix_8.$$arity = -1); + + Opal.def(self, '$htmlsyntax', TMP_BackendInfo_htmlsyntax_9 = function $$htmlsyntax(value) { + var self = this, $writer = nil; + + + + if (value == null) { + value = nil; + }; + if ($truthy(value)) { + + $writer = ["htmlsyntax", value]; + $send(self.$backend_info(), '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + } else { + return self.$backend_info()['$[]']("htmlsyntax") + }; + }, TMP_BackendInfo_htmlsyntax_9.$$arity = -1); + + Opal.def(self, '$supports_templates', TMP_BackendInfo_supports_templates_10 = function $$supports_templates() { + var self = this, $writer = nil; + + + $writer = ["supports_templates", true]; + $send(self.$backend_info(), '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + }, TMP_BackendInfo_supports_templates_10.$$arity = 0); + + Opal.def(self, '$supports_templates?', TMP_BackendInfo_supports_templates$q_11 = function() { + var self = this; + + return self.$backend_info()['$[]']("supports_templates") + }, TMP_BackendInfo_supports_templates$q_11.$$arity = 0); + })($nesting[0], $nesting); + (function(self, $parent_nesting) { + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_included_12; + + return (Opal.def(self, '$included', TMP_included_12 = function $$included(converter) { + var self = this; + + return converter.$extend($$($nesting, 'Config')) + }, TMP_included_12.$$arity = 1), nil) && 'included' + })(Opal.get_singleton_class(self), $nesting); + self.$include($$($nesting, 'Config')); + self.$include($$($nesting, 'BackendInfo')); + + Opal.def(self, '$initialize', TMP_Converter_initialize_13 = function $$initialize(backend, opts) { + var self = this; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + self.backend = backend; + return self.$setup_backend_info(); + }, TMP_Converter_initialize_13.$$arity = -2); + + Opal.def(self, '$convert', TMP_Converter_convert_14 = function $$convert(node, transform, opts) { + var self = this; + + + + if (transform == null) { + transform = nil; + }; + + if (opts == null) { + opts = $hash2([], {}); + }; + return self.$raise($$$('::', 'NotImplementedError')); + }, TMP_Converter_convert_14.$$arity = -2); + Opal.alias(self, "handles?", "respond_to?"); + Opal.alias(self, "convert_with_options", "convert"); + })($nesting[0], $nesting); + (function($base, $parent_nesting) { + function $Writer() {}; + var self = $Writer = $module($base, 'Writer', $Writer); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Writer_write_15; + + + Opal.def(self, '$write', TMP_Writer_write_15 = function $$write(output, target) { + var self = this; + + + if ($truthy(target['$respond_to?']("write"))) { + + target.$write(output.$chomp()); + target.$write($$($nesting, 'LF')); + } else { + $$$('::', 'IO').$write(target, output) + }; + return nil; + }, TMP_Writer_write_15.$$arity = 2) + })($nesting[0], $nesting); + (function($base, $parent_nesting) { + function $VoidWriter() {}; + var self = $VoidWriter = $module($base, 'VoidWriter', $VoidWriter); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_VoidWriter_write_16; + + + self.$include($$($nesting, 'Writer')); + + Opal.def(self, '$write', TMP_VoidWriter_write_16 = function $$write(output, target) { + var self = this; + + return nil + }, TMP_VoidWriter_write_16.$$arity = 2); + })($nesting[0], $nesting); + })($nesting[0], $nesting); + self.$require("asciidoctor/converter/base"); + return self.$require("asciidoctor/converter/factory"); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/document"] = function(Opal) { + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + function $rb_ge(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs >= rhs : lhs['$>='](rhs); + } + function $rb_plus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); + } + function $rb_gt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); + } + function $rb_lt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $send = Opal.send, $truthy = Opal.truthy, $hash2 = Opal.hash2, $gvars = Opal.gvars; + + Opal.add_stubs(['$new', '$attr_reader', '$nil?', '$<<', '$[]', '$[]=', '$-', '$include?', '$strip', '$squeeze', '$gsub', '$empty?', '$!', '$rpartition', '$attr_accessor', '$delete', '$base_dir', '$options', '$inject', '$catalog', '$==', '$dup', '$attributes', '$safe', '$compat_mode', '$sourcemap', '$path_resolver', '$converter', '$extensions', '$each', '$end_with?', '$start_with?', '$slice', '$length', '$chop', '$downcase', '$extname', '$===', '$value_for_name', '$to_s', '$key?', '$freeze', '$attribute_undefined', '$attribute_missing', '$name_for_value', '$expand_path', '$pwd', '$>=', '$+', '$abs', '$to_i', '$delete_if', '$update_doctype_attributes', '$cursor', '$parse', '$restore_attributes', '$update_backend_attributes', '$utc', '$at', '$Integer', '$now', '$index', '$strftime', '$year', '$utc_offset', '$fetch', '$activate', '$create', '$to_proc', '$groups', '$preprocessors?', '$preprocessors', '$process_method', '$tree_processors?', '$tree_processors', '$!=', '$counter', '$nil_or_empty?', '$nextval', '$value', '$save_to', '$chr', '$ord', '$source', '$source_lines', '$doctitle', '$sectname=', '$title=', '$first_section', '$title', '$merge', '$>', '$<', '$find', '$context', '$assign_numeral', '$clear_playback_attributes', '$save_attributes', '$attribute_locked?', '$rewind', '$replace', '$name', '$negate', '$limit_bytesize', '$apply_attribute_value_subs', '$delete?', '$=~', '$apply_subs', '$resolve_pass_subs', '$apply_header_subs', '$create_converter', '$basebackend', '$outfilesuffix', '$filetype', '$sub', '$raise', '$Array', '$backend', '$default', '$start', '$doctype', '$content_model', '$warn', '$logger', '$content', '$convert', '$postprocessors?', '$postprocessors', '$record', '$write', '$respond_to?', '$chomp', '$write_alternate_pages', '$map', '$split', '$resolve_docinfo_subs', '$&', '$normalize_system_path', '$read_asset', '$docinfo_processors?', '$compact', '$join', '$resolve_subs', '$docinfo_processors', '$class', '$object_id', '$inspect', '$size']); + return (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + (function($base, $super, $parent_nesting) { + function $Document(){}; + var self = $Document = $klass($base, $super, 'Document', $Document); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Document_1, TMP_Document_initialize_8, TMP_Document_parse_12, TMP_Document_counter_15, TMP_Document_increment_and_store_counter_16, TMP_Document_nextval_17, TMP_Document_register_18, TMP_Document_footnotes$q_19, TMP_Document_footnotes_20, TMP_Document_callouts_21, TMP_Document_nested$q_22, TMP_Document_embedded$q_23, TMP_Document_extensions$q_24, TMP_Document_source_25, TMP_Document_source_lines_26, TMP_Document_basebackend$q_27, TMP_Document_title_28, TMP_Document_title$eq_29, TMP_Document_doctitle_30, TMP_Document_author_31, TMP_Document_authors_32, TMP_Document_revdate_33, TMP_Document_notitle_34, TMP_Document_noheader_35, TMP_Document_nofooter_36, TMP_Document_first_section_37, TMP_Document_has_header$q_39, TMP_Document_$lt$lt_40, TMP_Document_finalize_header_41, TMP_Document_save_attributes_42, TMP_Document_restore_attributes_44, TMP_Document_clear_playback_attributes_45, TMP_Document_playback_attributes_46, TMP_Document_set_attribute_48, TMP_Document_delete_attribute_49, TMP_Document_attribute_locked$q_50, TMP_Document_set_header_attribute_51, TMP_Document_apply_attribute_value_subs_52, TMP_Document_update_backend_attributes_53, TMP_Document_update_doctype_attributes_54, TMP_Document_create_converter_55, TMP_Document_convert_56, TMP_Document_write_58, TMP_Document_content_59, TMP_Document_docinfo_60, TMP_Document_resolve_docinfo_subs_63, TMP_Document_docinfo_processors$q_64, TMP_Document_to_s_65; + + def.attributes = def.safe = def.sourcemap = def.reader = def.base_dir = def.parsed = def.parent_document = def.extensions = def.options = def.counters = def.catalog = def.header = def.blocks = def.attributes_modified = def.id = def.header_attributes = def.max_attribute_value_size = def.attribute_overrides = def.backend = def.doctype = def.converter = def.timings = def.outfilesuffix = def.docinfo_processor_extensions = def.document = nil; + + Opal.const_set($nesting[0], 'ImageReference', $send($$$('::', 'Struct'), 'new', ["target", "imagesdir"], (TMP_Document_1 = function(){var self = TMP_Document_1.$$s || this; + + return Opal.alias(self, "to_s", "target")}, TMP_Document_1.$$s = self, TMP_Document_1.$$arity = 0, TMP_Document_1))); + Opal.const_set($nesting[0], 'Footnote', $$$('::', 'Struct').$new("index", "id", "text")); + (function($base, $super, $parent_nesting) { + function $AttributeEntry(){}; + var self = $AttributeEntry = $klass($base, $super, 'AttributeEntry', $AttributeEntry); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_AttributeEntry_initialize_2, TMP_AttributeEntry_save_to_3; + + + self.$attr_reader("name", "value", "negate"); + + Opal.def(self, '$initialize', TMP_AttributeEntry_initialize_2 = function $$initialize(name, value, negate) { + var self = this; + + + + if (negate == null) { + negate = nil; + }; + self.name = name; + self.value = value; + return (self.negate = (function() {if ($truthy(negate['$nil?']())) { + return value['$nil?']() + } else { + return negate + }; return nil; })()); + }, TMP_AttributeEntry_initialize_2.$$arity = -3); + return (Opal.def(self, '$save_to', TMP_AttributeEntry_save_to_3 = function $$save_to(block_attributes) { + var $a, self = this, $writer = nil; + + + ($truthy($a = block_attributes['$[]']("attribute_entries")) ? $a : (($writer = ["attribute_entries", []]), $send(block_attributes, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]))['$<<'](self); + return self; + }, TMP_AttributeEntry_save_to_3.$$arity = 1), nil) && 'save_to'; + })($nesting[0], null, $nesting); + (function($base, $super, $parent_nesting) { + function $Title(){}; + var self = $Title = $klass($base, $super, 'Title', $Title); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Title_initialize_4, TMP_Title_sanitized$q_5, TMP_Title_subtitle$q_6, TMP_Title_to_s_7; + + def.sanitized = def.subtitle = def.combined = nil; + + self.$attr_reader("main"); + Opal.alias(self, "title", "main"); + self.$attr_reader("subtitle"); + self.$attr_reader("combined"); + + Opal.def(self, '$initialize', TMP_Title_initialize_4 = function $$initialize(val, opts) { + var $a, $b, self = this, sep = nil, _ = nil; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + if ($truthy(($truthy($a = (self.sanitized = opts['$[]']("sanitize"))) ? val['$include?']("<") : $a))) { + val = val.$gsub($$($nesting, 'XmlSanitizeRx'), "").$squeeze(" ").$strip()}; + if ($truthy(($truthy($a = (sep = ($truthy($b = opts['$[]']("separator")) ? $b : ":"))['$empty?']()) ? $a : val['$include?']((sep = "" + (sep) + " "))['$!']()))) { + + self.main = val; + self.subtitle = nil; + } else { + $b = val.$rpartition(sep), $a = Opal.to_ary($b), (self.main = ($a[0] == null ? nil : $a[0])), (_ = ($a[1] == null ? nil : $a[1])), (self.subtitle = ($a[2] == null ? nil : $a[2])), $b + }; + return (self.combined = val); + }, TMP_Title_initialize_4.$$arity = -2); + + Opal.def(self, '$sanitized?', TMP_Title_sanitized$q_5 = function() { + var self = this; + + return self.sanitized + }, TMP_Title_sanitized$q_5.$$arity = 0); + + Opal.def(self, '$subtitle?', TMP_Title_subtitle$q_6 = function() { + var self = this; + + if ($truthy(self.subtitle)) { + return true + } else { + return false + } + }, TMP_Title_subtitle$q_6.$$arity = 0); + return (Opal.def(self, '$to_s', TMP_Title_to_s_7 = function $$to_s() { + var self = this; + + return self.combined + }, TMP_Title_to_s_7.$$arity = 0), nil) && 'to_s'; + })($nesting[0], null, $nesting); + Opal.const_set($nesting[0], 'Author', $$$('::', 'Struct').$new("name", "firstname", "middlename", "lastname", "initials", "email")); + self.$attr_reader("safe"); + self.$attr_reader("compat_mode"); + self.$attr_reader("backend"); + self.$attr_reader("doctype"); + self.$attr_accessor("sourcemap"); + self.$attr_reader("catalog"); + Opal.alias(self, "references", "catalog"); + self.$attr_reader("counters"); + self.$attr_reader("header"); + self.$attr_reader("base_dir"); + self.$attr_reader("options"); + self.$attr_reader("outfilesuffix"); + self.$attr_reader("parent_document"); + self.$attr_reader("reader"); + self.$attr_reader("path_resolver"); + self.$attr_reader("converter"); + self.$attr_reader("extensions"); + + Opal.def(self, '$initialize', TMP_Document_initialize_8 = function $$initialize(data, options) { + var $a, TMP_9, TMP_10, $b, $c, TMP_11, $d, $iter = TMP_Document_initialize_8.$$p, $yield = $iter || nil, self = this, parent_doc = nil, $writer = nil, attr_overrides = nil, parent_doctype = nil, initialize_extensions = nil, to_file = nil, safe_mode = nil, header_footer = nil, attrs = nil, safe_mode_name = nil, base_dir_val = nil, backend_val = nil, doctype_val = nil, size = nil, now = nil, localdate = nil, localyear = nil, localtime = nil, ext_registry = nil, ext_block = nil; + + if ($iter) TMP_Document_initialize_8.$$p = null; + + + if (data == null) { + data = nil; + }; + + if (options == null) { + options = $hash2([], {}); + }; + $send(self, Opal.find_super_dispatcher(self, 'initialize', TMP_Document_initialize_8, false), [self, "document"], null); + if ($truthy((parent_doc = options.$delete("parent")))) { + + self.parent_document = parent_doc; + ($truthy($a = options['$[]']("base_dir")) ? $a : (($writer = ["base_dir", parent_doc.$base_dir()]), $send(options, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + if ($truthy(parent_doc.$options()['$[]']("catalog_assets"))) { + + $writer = ["catalog_assets", true]; + $send(options, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + self.catalog = $send(parent_doc.$catalog(), 'inject', [$hash2([], {})], (TMP_9 = function(accum, $mlhs_tmp1){var self = TMP_9.$$s || this, $b, $c, key = nil, table = nil; + + + + if (accum == null) { + accum = nil; + }; + + if ($mlhs_tmp1 == null) { + $mlhs_tmp1 = nil; + }; + $c = $mlhs_tmp1, $b = Opal.to_ary($c), (key = ($b[0] == null ? nil : $b[0])), (table = ($b[1] == null ? nil : $b[1])), $c; + + $writer = [key, (function() {if (key['$==']("footnotes")) { + return [] + } else { + return table + }; return nil; })()]; + $send(accum, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + return accum;}, TMP_9.$$s = self, TMP_9.$$arity = 2, TMP_9.$$has_top_level_mlhs_arg = true, TMP_9)); + self.attribute_overrides = (attr_overrides = parent_doc.$attributes().$dup()); + parent_doctype = attr_overrides.$delete("doctype"); + attr_overrides.$delete("compat-mode"); + attr_overrides.$delete("toc"); + attr_overrides.$delete("toc-placement"); + attr_overrides.$delete("toc-position"); + self.safe = parent_doc.$safe(); + if ($truthy((self.compat_mode = parent_doc.$compat_mode()))) { + + $writer = ["compat-mode", ""]; + $send(self.attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + self.sourcemap = parent_doc.$sourcemap(); + self.timings = nil; + self.path_resolver = parent_doc.$path_resolver(); + self.converter = parent_doc.$converter(); + initialize_extensions = false; + self.extensions = parent_doc.$extensions(); + } else { + + self.parent_document = nil; + self.catalog = $hash2(["ids", "refs", "footnotes", "links", "images", "indexterms", "callouts", "includes"], {"ids": $hash2([], {}), "refs": $hash2([], {}), "footnotes": [], "links": [], "images": [], "indexterms": [], "callouts": $$($nesting, 'Callouts').$new(), "includes": $hash2([], {})}); + self.attribute_overrides = (attr_overrides = $hash2([], {})); + $send(($truthy($a = options['$[]']("attributes")) ? $a : $hash2([], {})), 'each', [], (TMP_10 = function(key, val){var self = TMP_10.$$s || this, $b; + + + + if (key == null) { + key = nil; + }; + + if (val == null) { + val = nil; + }; + if ($truthy(key['$end_with?']("@"))) { + if ($truthy(key['$start_with?']("!"))) { + $b = [key.$slice(1, $rb_minus(key.$length(), 2)), false], (key = $b[0]), (val = $b[1]), $b + } else if ($truthy(key['$end_with?']("!@"))) { + $b = [key.$slice(0, $rb_minus(key.$length(), 2)), false], (key = $b[0]), (val = $b[1]), $b + } else { + $b = [key.$chop(), "" + (val) + "@"], (key = $b[0]), (val = $b[1]), $b + } + } else if ($truthy(key['$start_with?']("!"))) { + $b = [key.$slice(1, key.$length()), (function() {if (val['$==']("@")) { + return false + } else { + return nil + }; return nil; })()], (key = $b[0]), (val = $b[1]), $b + } else if ($truthy(key['$end_with?']("!"))) { + $b = [key.$chop(), (function() {if (val['$==']("@")) { + return false + } else { + return nil + }; return nil; })()], (key = $b[0]), (val = $b[1]), $b}; + + $writer = [key.$downcase(), val]; + $send(attr_overrides, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];;}, TMP_10.$$s = self, TMP_10.$$arity = 2, TMP_10)); + if ($truthy((to_file = options['$[]']("to_file")))) { + + $writer = ["outfilesuffix", $$$('::', 'File').$extname(to_file)]; + $send(attr_overrides, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if ($truthy((safe_mode = options['$[]']("safe"))['$!']())) { + self.safe = $$$($$($nesting, 'SafeMode'), 'SECURE') + } else if ($truthy($$$('::', 'Integer')['$==='](safe_mode))) { + self.safe = safe_mode + } else { + + try { + self.safe = $$($nesting, 'SafeMode').$value_for_name(safe_mode.$to_s()) + } catch ($err) { + if (Opal.rescue($err, [$$($nesting, 'StandardError')])) { + try { + self.safe = $$$($$($nesting, 'SafeMode'), 'SECURE') + } finally { Opal.pop_exception() } + } else { throw $err; } + }; + }; + self.compat_mode = attr_overrides['$key?']("compat-mode"); + self.sourcemap = options['$[]']("sourcemap"); + self.timings = options.$delete("timings"); + self.path_resolver = $$($nesting, 'PathResolver').$new(); + self.converter = nil; + initialize_extensions = (($b = $$$('::', 'Asciidoctor', 'skip_raise')) && ($a = $$$($b, 'Extensions', 'skip_raise')) ? 'constant' : nil); + self.extensions = nil; + }; + self.parsed = false; + self.header = (self.header_attributes = nil); + self.counters = $hash2([], {}); + self.attributes_modified = $$$('::', 'Set').$new(); + self.docinfo_processor_extensions = $hash2([], {}); + header_footer = ($truthy($c = options['$[]']("header_footer")) ? $c : (($writer = ["header_footer", false]), $send(options, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + (self.options = options).$freeze(); + attrs = self.attributes; + + $writer = ["sectids", ""]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["toc-placement", "auto"]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + if ($truthy(header_footer)) { + + + $writer = ["copycss", ""]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["embedded", nil]; + $send(attr_overrides, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + } else { + + + $writer = ["notitle", ""]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["embedded", ""]; + $send(attr_overrides, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + }; + + $writer = ["stylesheet", ""]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["webfonts", ""]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["prewrap", ""]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["attribute-undefined", $$($nesting, 'Compliance').$attribute_undefined()]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["attribute-missing", $$($nesting, 'Compliance').$attribute_missing()]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["iconfont-remote", ""]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["caution-caption", "Caution"]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["important-caption", "Important"]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["note-caption", "Note"]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["tip-caption", "Tip"]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["warning-caption", "Warning"]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["example-caption", "Example"]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["figure-caption", "Figure"]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["table-caption", "Table"]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["toc-title", "Table of Contents"]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["section-refsig", "Section"]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["part-refsig", "Part"]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["chapter-refsig", "Chapter"]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["appendix-caption", (($writer = ["appendix-refsig", "Appendix"]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["untitled-label", "Untitled"]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["version-label", "Version"]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["last-update-label", "Last updated"]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["asciidoctor", ""]; + $send(attr_overrides, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["asciidoctor-version", $$($nesting, 'VERSION')]; + $send(attr_overrides, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["safe-mode-name", (safe_mode_name = $$($nesting, 'SafeMode').$name_for_value(self.safe))]; + $send(attr_overrides, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["" + "safe-mode-" + (safe_mode_name), ""]; + $send(attr_overrides, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["safe-mode-level", self.safe]; + $send(attr_overrides, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + ($truthy($c = attr_overrides['$[]']("max-include-depth")) ? $c : (($writer = ["max-include-depth", 64]), $send(attr_overrides, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + ($truthy($c = attr_overrides['$[]']("allow-uri-read")) ? $c : (($writer = ["allow-uri-read", nil]), $send(attr_overrides, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + + $writer = ["user-home", $$($nesting, 'USER_HOME')]; + $send(attr_overrides, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + if ($truthy(attr_overrides['$key?']("numbered"))) { + + $writer = ["sectnums", attr_overrides.$delete("numbered")]; + $send(attr_overrides, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if ($truthy((base_dir_val = options['$[]']("base_dir")))) { + self.base_dir = (($writer = ["docdir", $$$('::', 'File').$expand_path(base_dir_val)]), $send(attr_overrides, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]) + } else if ($truthy(attr_overrides['$[]']("docdir"))) { + self.base_dir = attr_overrides['$[]']("docdir") + } else { + self.base_dir = (($writer = ["docdir", $$$('::', 'Dir').$pwd()]), $send(attr_overrides, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]) + }; + if ($truthy((backend_val = options['$[]']("backend")))) { + + $writer = ["backend", "" + (backend_val)]; + $send(attr_overrides, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if ($truthy((doctype_val = options['$[]']("doctype")))) { + + $writer = ["doctype", "" + (doctype_val)]; + $send(attr_overrides, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if ($truthy($rb_ge(self.safe, $$$($$($nesting, 'SafeMode'), 'SERVER')))) { + + ($truthy($c = attr_overrides['$[]']("copycss")) ? $c : (($writer = ["copycss", nil]), $send(attr_overrides, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + ($truthy($c = attr_overrides['$[]']("source-highlighter")) ? $c : (($writer = ["source-highlighter", nil]), $send(attr_overrides, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + ($truthy($c = attr_overrides['$[]']("backend")) ? $c : (($writer = ["backend", $$($nesting, 'DEFAULT_BACKEND')]), $send(attr_overrides, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + if ($truthy(($truthy($c = parent_doc['$!']()) ? attr_overrides['$key?']("docfile") : $c))) { + + $writer = ["docfile", attr_overrides['$[]']("docfile")['$[]'](Opal.Range.$new($rb_plus(attr_overrides['$[]']("docdir").$length(), 1), -1, false))]; + $send(attr_overrides, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + + $writer = ["docdir", ""]; + $send(attr_overrides, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["user-home", "."]; + $send(attr_overrides, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + if ($truthy($rb_ge(self.safe, $$$($$($nesting, 'SafeMode'), 'SECURE')))) { + + if ($truthy(attr_overrides['$key?']("max-attribute-value-size"))) { + } else { + + $writer = ["max-attribute-value-size", 4096]; + $send(attr_overrides, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + if ($truthy(attr_overrides['$key?']("linkcss"))) { + } else { + + $writer = ["linkcss", ""]; + $send(attr_overrides, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + ($truthy($c = attr_overrides['$[]']("icons")) ? $c : (($writer = ["icons", nil]), $send(attr_overrides, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]));};}; + self.max_attribute_value_size = (function() {if ($truthy((size = ($truthy($c = attr_overrides['$[]']("max-attribute-value-size")) ? $c : (($writer = ["max-attribute-value-size", nil]), $send(attr_overrides, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]))))) { + return size.$to_i().$abs() + } else { + return nil + }; return nil; })(); + $send(attr_overrides, 'delete_if', [], (TMP_11 = function(key, val){var self = TMP_11.$$s || this, $d, verdict = nil; + + + + if (key == null) { + key = nil; + }; + + if (val == null) { + val = nil; + }; + if ($truthy(val)) { + + if ($truthy(($truthy($d = $$$('::', 'String')['$==='](val)) ? val['$end_with?']("@") : $d))) { + $d = [val.$chop(), true], (val = $d[0]), (verdict = $d[1]), $d}; + + $writer = [key, val]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + } else { + + attrs.$delete(key); + verdict = val['$=='](false); + }; + return verdict;}, TMP_11.$$s = self, TMP_11.$$arity = 2, TMP_11)); + if ($truthy(parent_doc)) { + + self.backend = attrs['$[]']("backend"); + if ((self.doctype = (($writer = ["doctype", parent_doctype]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]))['$==']($$($nesting, 'DEFAULT_DOCTYPE'))) { + } else { + self.$update_doctype_attributes($$($nesting, 'DEFAULT_DOCTYPE')) + }; + self.reader = $$($nesting, 'Reader').$new(data, options['$[]']("cursor")); + if ($truthy(self.sourcemap)) { + self.source_location = self.reader.$cursor()}; + $$($nesting, 'Parser').$parse(self.reader, self); + self.$restore_attributes(); + return (self.parsed = true); + } else { + + self.backend = nil; + if (($truthy($c = attrs['$[]']("backend")) ? $c : (($writer = ["backend", $$($nesting, 'DEFAULT_BACKEND')]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]))['$==']("manpage")) { + self.doctype = (($writer = ["doctype", (($writer = ["doctype", "manpage"]), $send(attr_overrides, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]) + } else { + self.doctype = ($truthy($c = attrs['$[]']("doctype")) ? $c : (($writer = ["doctype", $$($nesting, 'DEFAULT_DOCTYPE')]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])) + }; + self.$update_backend_attributes(attrs['$[]']("backend"), true); + now = (function() {if ($truthy($$$('::', 'ENV')['$[]']("SOURCE_DATE_EPOCH"))) { + return $$$('::', 'Time').$at(self.$Integer($$$('::', 'ENV')['$[]']("SOURCE_DATE_EPOCH"))).$utc() + } else { + return $$$('::', 'Time').$now() + }; return nil; })(); + if ($truthy((localdate = attrs['$[]']("localdate")))) { + localyear = ($truthy($c = attrs['$[]']("localyear")) ? $c : (($writer = ["localyear", (function() {if (localdate.$index("-")['$=='](4)) { + + return localdate.$slice(0, 4); + } else { + return nil + }; return nil; })()]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])) + } else { + + localdate = (($writer = ["localdate", now.$strftime("%F")]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]); + localyear = ($truthy($c = attrs['$[]']("localyear")) ? $c : (($writer = ["localyear", now.$year().$to_s()]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + }; + localtime = ($truthy($c = attrs['$[]']("localtime")) ? $c : (($writer = ["localtime", now.$strftime("" + "%T " + ((function() {if (now.$utc_offset()['$=='](0)) { + return "UTC" + } else { + return "%z" + }; return nil; })()))]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + ($truthy($c = attrs['$[]']("localdatetime")) ? $c : (($writer = ["localdatetime", "" + (localdate) + " " + (localtime)]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + ($truthy($c = attrs['$[]']("docdate")) ? $c : (($writer = ["docdate", localdate]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + ($truthy($c = attrs['$[]']("docyear")) ? $c : (($writer = ["docyear", localyear]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + ($truthy($c = attrs['$[]']("doctime")) ? $c : (($writer = ["doctime", localtime]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + ($truthy($c = attrs['$[]']("docdatetime")) ? $c : (($writer = ["docdatetime", "" + (localdate) + " " + (localtime)]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + ($truthy($c = attrs['$[]']("stylesdir")) ? $c : (($writer = ["stylesdir", "."]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + ($truthy($c = attrs['$[]']("iconsdir")) ? $c : (($writer = ["iconsdir", "" + (attrs.$fetch("imagesdir", "./images")) + "/icons"]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + if ($truthy(initialize_extensions)) { + if ($truthy((ext_registry = options['$[]']("extension_registry")))) { + if ($truthy(($truthy($c = $$$($$($nesting, 'Extensions'), 'Registry')['$==='](ext_registry)) ? $c : ($truthy($d = $$$('::', 'RUBY_ENGINE_JRUBY')) ? $$$($$$($$$('::', 'AsciidoctorJ'), 'Extensions'), 'ExtensionRegistry')['$==='](ext_registry) : $d)))) { + self.extensions = ext_registry.$activate(self)} + } else if ($truthy($$$('::', 'Proc')['$===']((ext_block = options['$[]']("extensions"))))) { + self.extensions = $send($$($nesting, 'Extensions'), 'create', [], ext_block.$to_proc()).$activate(self) + } else if ($truthy($$($nesting, 'Extensions').$groups()['$empty?']()['$!']())) { + self.extensions = $$$($$($nesting, 'Extensions'), 'Registry').$new().$activate(self)}}; + self.reader = $$($nesting, 'PreprocessorReader').$new(self, data, $$$($$($nesting, 'Reader'), 'Cursor').$new(attrs['$[]']("docfile"), self.base_dir), $hash2(["normalize"], {"normalize": true})); + if ($truthy(self.sourcemap)) { + return (self.source_location = self.reader.$cursor()) + } else { + return nil + }; + }; + }, TMP_Document_initialize_8.$$arity = -1); + + Opal.def(self, '$parse', TMP_Document_parse_12 = function $$parse(data) { + var $a, TMP_13, TMP_14, self = this, doc = nil, exts = nil; + + + + if (data == null) { + data = nil; + }; + if ($truthy(self.parsed)) { + return self + } else { + + doc = self; + if ($truthy(data)) { + + self.reader = $$($nesting, 'PreprocessorReader').$new(doc, data, $$$($$($nesting, 'Reader'), 'Cursor').$new(self.attributes['$[]']("docfile"), self.base_dir), $hash2(["normalize"], {"normalize": true})); + if ($truthy(self.sourcemap)) { + self.source_location = self.reader.$cursor()};}; + if ($truthy(($truthy($a = (exts = (function() {if ($truthy(self.parent_document)) { + return nil + } else { + return self.extensions + }; return nil; })())) ? exts['$preprocessors?']() : $a))) { + $send(exts.$preprocessors(), 'each', [], (TMP_13 = function(ext){var self = TMP_13.$$s || this, $b; + if (self.reader == null) self.reader = nil; + + + + if (ext == null) { + ext = nil; + }; + return (self.reader = ($truthy($b = ext.$process_method()['$[]'](doc, self.reader)) ? $b : self.reader));}, TMP_13.$$s = self, TMP_13.$$arity = 1, TMP_13))}; + $$($nesting, 'Parser').$parse(self.reader, doc, $hash2(["header_only"], {"header_only": self.options['$[]']("parse_header_only")})); + self.$restore_attributes(); + if ($truthy(($truthy($a = exts) ? exts['$tree_processors?']() : $a))) { + $send(exts.$tree_processors(), 'each', [], (TMP_14 = function(ext){var self = TMP_14.$$s || this, $b, $c, result = nil; + + + + if (ext == null) { + ext = nil; + }; + if ($truthy(($truthy($b = ($truthy($c = (result = ext.$process_method()['$[]'](doc))) ? $$($nesting, 'Document')['$==='](result) : $c)) ? result['$!='](doc) : $b))) { + return (doc = result) + } else { + return nil + };}, TMP_14.$$s = self, TMP_14.$$arity = 1, TMP_14))}; + self.parsed = true; + return doc; + }; + }, TMP_Document_parse_12.$$arity = -1); + + Opal.def(self, '$counter', TMP_Document_counter_15 = function $$counter(name, seed) { + var $a, self = this, attr_seed = nil, attr_val = nil, $writer = nil; + + + + if (seed == null) { + seed = nil; + }; + if ($truthy(self.parent_document)) { + return self.parent_document.$counter(name, seed)}; + if ($truthy(($truthy($a = (attr_seed = (attr_val = self.attributes['$[]'](name))['$nil_or_empty?']()['$!']())) ? self.counters['$key?'](name) : $a))) { + + $writer = [name, (($writer = [name, self.$nextval(attr_val)]), $send(self.counters, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])]; + $send(self.attributes, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + } else if ($truthy(seed)) { + + $writer = [name, (($writer = [name, (function() {if (seed['$=='](seed.$to_i().$to_s())) { + return seed.$to_i() + } else { + return seed + }; return nil; })()]), $send(self.counters, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])]; + $send(self.attributes, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + } else { + + $writer = [name, (($writer = [name, self.$nextval((function() {if ($truthy(attr_seed)) { + return attr_val + } else { + return 0 + }; return nil; })())]), $send(self.counters, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])]; + $send(self.attributes, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + }; + }, TMP_Document_counter_15.$$arity = -2); + + Opal.def(self, '$increment_and_store_counter', TMP_Document_increment_and_store_counter_16 = function $$increment_and_store_counter(counter_name, block) { + var self = this; + + return $$($nesting, 'AttributeEntry').$new(counter_name, self.$counter(counter_name)).$save_to(block.$attributes()).$value() + }, TMP_Document_increment_and_store_counter_16.$$arity = 2); + Opal.alias(self, "counter_increment", "increment_and_store_counter"); + + Opal.def(self, '$nextval', TMP_Document_nextval_17 = function $$nextval(current) { + var self = this, intval = nil; + + if ($truthy($$$('::', 'Integer')['$==='](current))) { + return $rb_plus(current, 1) + } else { + + intval = current.$to_i(); + if ($truthy(intval.$to_s()['$!='](current.$to_s()))) { + return $rb_plus(current['$[]'](0).$ord(), 1).$chr() + } else { + return $rb_plus(intval, 1) + }; + } + }, TMP_Document_nextval_17.$$arity = 1); + + Opal.def(self, '$register', TMP_Document_register_18 = function $$register(type, value) { + var $a, $b, self = this, $case = nil, id = nil, reftext = nil, $logical_op_recvr_tmp_1 = nil, $writer = nil, ref = nil, refs = nil; + + return (function() {$case = type; + if ("ids"['$===']($case)) { + $b = value, $a = Opal.to_ary($b), (id = ($a[0] == null ? nil : $a[0])), (reftext = ($a[1] == null ? nil : $a[1])), $b; + + $logical_op_recvr_tmp_1 = self.catalog['$[]']("ids"); + return ($truthy($a = $logical_op_recvr_tmp_1['$[]'](id)) ? $a : (($writer = [id, ($truthy($b = reftext) ? $b : $rb_plus($rb_plus("[", id), "]"))]), $send($logical_op_recvr_tmp_1, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]));;} + else if ("refs"['$===']($case)) { + $b = value, $a = Opal.to_ary($b), (id = ($a[0] == null ? nil : $a[0])), (ref = ($a[1] == null ? nil : $a[1])), (reftext = ($a[2] == null ? nil : $a[2])), $b; + if ($truthy((refs = self.catalog['$[]']("refs"))['$key?'](id))) { + return nil + } else { + + + $writer = [id, ($truthy($a = reftext) ? $a : $rb_plus($rb_plus("[", id), "]"))]; + $send(self.catalog['$[]']("ids"), '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = [id, ref]; + $send(refs, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];; + };} + else if ("footnotes"['$===']($case) || "indexterms"['$===']($case)) {return self.catalog['$[]'](type)['$<<'](value)} + else {if ($truthy(self.options['$[]']("catalog_assets"))) { + return self.catalog['$[]'](type)['$<<']((function() {if (type['$==']("images")) { + + return $$($nesting, 'ImageReference').$new(value['$[]'](0), value['$[]'](1)); + } else { + return value + }; return nil; })()) + } else { + return nil + }}})() + }, TMP_Document_register_18.$$arity = 2); + + Opal.def(self, '$footnotes?', TMP_Document_footnotes$q_19 = function() { + var self = this; + + if ($truthy(self.catalog['$[]']("footnotes")['$empty?']())) { + return false + } else { + return true + } + }, TMP_Document_footnotes$q_19.$$arity = 0); + + Opal.def(self, '$footnotes', TMP_Document_footnotes_20 = function $$footnotes() { + var self = this; + + return self.catalog['$[]']("footnotes") + }, TMP_Document_footnotes_20.$$arity = 0); + + Opal.def(self, '$callouts', TMP_Document_callouts_21 = function $$callouts() { + var self = this; + + return self.catalog['$[]']("callouts") + }, TMP_Document_callouts_21.$$arity = 0); + + Opal.def(self, '$nested?', TMP_Document_nested$q_22 = function() { + var self = this; + + if ($truthy(self.parent_document)) { + return true + } else { + return false + } + }, TMP_Document_nested$q_22.$$arity = 0); + + Opal.def(self, '$embedded?', TMP_Document_embedded$q_23 = function() { + var self = this; + + return self.attributes['$key?']("embedded") + }, TMP_Document_embedded$q_23.$$arity = 0); + + Opal.def(self, '$extensions?', TMP_Document_extensions$q_24 = function() { + var self = this; + + if ($truthy(self.extensions)) { + return true + } else { + return false + } + }, TMP_Document_extensions$q_24.$$arity = 0); + + Opal.def(self, '$source', TMP_Document_source_25 = function $$source() { + var self = this; + + if ($truthy(self.reader)) { + return self.reader.$source() + } else { + return nil + } + }, TMP_Document_source_25.$$arity = 0); + + Opal.def(self, '$source_lines', TMP_Document_source_lines_26 = function $$source_lines() { + var self = this; + + if ($truthy(self.reader)) { + return self.reader.$source_lines() + } else { + return nil + } + }, TMP_Document_source_lines_26.$$arity = 0); + + Opal.def(self, '$basebackend?', TMP_Document_basebackend$q_27 = function(base) { + var self = this; + + return self.attributes['$[]']("basebackend")['$=='](base) + }, TMP_Document_basebackend$q_27.$$arity = 1); + + Opal.def(self, '$title', TMP_Document_title_28 = function $$title() { + var self = this; + + return self.$doctitle() + }, TMP_Document_title_28.$$arity = 0); + + Opal.def(self, '$title=', TMP_Document_title$eq_29 = function(title) { + var self = this, sect = nil, $writer = nil; + + + if ($truthy((sect = self.header))) { + } else { + + $writer = ["header"]; + $send((sect = (self.header = $$($nesting, 'Section').$new(self, 0))), 'sectname=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + + $writer = [title]; + $send(sect, 'title=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];; + }, TMP_Document_title$eq_29.$$arity = 1); + + Opal.def(self, '$doctitle', TMP_Document_doctitle_30 = function $$doctitle(opts) { + var $a, self = this, val = nil, sect = nil, separator = nil; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + if ($truthy((val = self.attributes['$[]']("title")))) { + } else if ($truthy((sect = self.$first_section()))) { + val = sect.$title() + } else if ($truthy(($truthy($a = opts['$[]']("use_fallback")) ? (val = self.attributes['$[]']("untitled-label")) : $a)['$!']())) { + return nil}; + if ($truthy((separator = opts['$[]']("partition")))) { + return $$($nesting, 'Title').$new(val, opts.$merge($hash2(["separator"], {"separator": (function() {if (separator['$=='](true)) { + return self.attributes['$[]']("title-separator") + } else { + return separator + }; return nil; })()}))) + } else if ($truthy(($truthy($a = opts['$[]']("sanitize")) ? val['$include?']("<") : $a))) { + return val.$gsub($$($nesting, 'XmlSanitizeRx'), "").$squeeze(" ").$strip() + } else { + return val + }; + }, TMP_Document_doctitle_30.$$arity = -1); + Opal.alias(self, "name", "doctitle"); + + Opal.def(self, '$author', TMP_Document_author_31 = function $$author() { + var self = this; + + return self.attributes['$[]']("author") + }, TMP_Document_author_31.$$arity = 0); + + Opal.def(self, '$authors', TMP_Document_authors_32 = function $$authors() { + var $a, self = this, attrs = nil, authors = nil, num_authors = nil, idx = nil; + + if ($truthy((attrs = self.attributes)['$key?']("author"))) { + + authors = [$$($nesting, 'Author').$new(attrs['$[]']("author"), attrs['$[]']("firstname"), attrs['$[]']("middlename"), attrs['$[]']("lastname"), attrs['$[]']("authorinitials"), attrs['$[]']("email"))]; + if ($truthy($rb_gt((num_authors = ($truthy($a = attrs['$[]']("authorcount")) ? $a : 0)), 1))) { + + idx = 1; + while ($truthy($rb_lt(idx, num_authors))) { + + idx = $rb_plus(idx, 1); + authors['$<<']($$($nesting, 'Author').$new(attrs['$[]']("" + "author_" + (idx)), attrs['$[]']("" + "firstname_" + (idx)), attrs['$[]']("" + "middlename_" + (idx)), attrs['$[]']("" + "lastname_" + (idx)), attrs['$[]']("" + "authorinitials_" + (idx)), attrs['$[]']("" + "email_" + (idx)))); + };}; + return authors; + } else { + return [] + } + }, TMP_Document_authors_32.$$arity = 0); + + Opal.def(self, '$revdate', TMP_Document_revdate_33 = function $$revdate() { + var self = this; + + return self.attributes['$[]']("revdate") + }, TMP_Document_revdate_33.$$arity = 0); + + Opal.def(self, '$notitle', TMP_Document_notitle_34 = function $$notitle() { + var $a, self = this; + + return ($truthy($a = self.attributes['$key?']("showtitle")['$!']()) ? self.attributes['$key?']("notitle") : $a) + }, TMP_Document_notitle_34.$$arity = 0); + + Opal.def(self, '$noheader', TMP_Document_noheader_35 = function $$noheader() { + var self = this; + + return self.attributes['$key?']("noheader") + }, TMP_Document_noheader_35.$$arity = 0); + + Opal.def(self, '$nofooter', TMP_Document_nofooter_36 = function $$nofooter() { + var self = this; + + return self.attributes['$key?']("nofooter") + }, TMP_Document_nofooter_36.$$arity = 0); + + Opal.def(self, '$first_section', TMP_Document_first_section_37 = function $$first_section() { + var $a, TMP_38, self = this; + + return ($truthy($a = self.header) ? $a : $send(self.blocks, 'find', [], (TMP_38 = function(e){var self = TMP_38.$$s || this; + + + + if (e == null) { + e = nil; + }; + return e.$context()['$==']("section");}, TMP_38.$$s = self, TMP_38.$$arity = 1, TMP_38))) + }, TMP_Document_first_section_37.$$arity = 0); + + Opal.def(self, '$has_header?', TMP_Document_has_header$q_39 = function() { + var self = this; + + if ($truthy(self.header)) { + return true + } else { + return false + } + }, TMP_Document_has_header$q_39.$$arity = 0); + Opal.alias(self, "header?", "has_header?"); + + Opal.def(self, '$<<', TMP_Document_$lt$lt_40 = function(block) { + var $iter = TMP_Document_$lt$lt_40.$$p, $yield = $iter || nil, self = this, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_Document_$lt$lt_40.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + + if (block.$context()['$==']("section")) { + self.$assign_numeral(block)}; + return $send(self, Opal.find_super_dispatcher(self, '<<', TMP_Document_$lt$lt_40, false), $zuper, $iter); + }, TMP_Document_$lt$lt_40.$$arity = 1); + + Opal.def(self, '$finalize_header', TMP_Document_finalize_header_41 = function $$finalize_header(unrooted_attributes, header_valid) { + var self = this, $writer = nil; + + + + if (header_valid == null) { + header_valid = true; + }; + self.$clear_playback_attributes(unrooted_attributes); + self.$save_attributes(); + if ($truthy(header_valid)) { + } else { + + $writer = ["invalid-header", true]; + $send(unrooted_attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + return unrooted_attributes; + }, TMP_Document_finalize_header_41.$$arity = -2); + + Opal.def(self, '$save_attributes', TMP_Document_save_attributes_42 = function $$save_attributes() { + var $a, $b, TMP_43, self = this, attrs = nil, $writer = nil, val = nil, toc_position_val = nil, toc_val = nil, toc_placement = nil, default_toc_position = nil, default_toc_class = nil, position = nil, $case = nil; + + + if ((attrs = self.attributes)['$[]']("basebackend")['$==']("docbook")) { + + if ($truthy(($truthy($a = self['$attribute_locked?']("toc")) ? $a : self.attributes_modified['$include?']("toc")))) { + } else { + + $writer = ["toc", ""]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + if ($truthy(($truthy($a = self['$attribute_locked?']("sectnums")) ? $a : self.attributes_modified['$include?']("sectnums")))) { + } else { + + $writer = ["sectnums", ""]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + };}; + if ($truthy(($truthy($a = attrs['$key?']("doctitle")) ? $a : (val = self.$doctitle())['$!']()))) { + } else { + + $writer = ["doctitle", val]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + if ($truthy(self.id)) { + } else { + self.id = attrs['$[]']("css-signature") + }; + toc_position_val = (function() {if ($truthy((toc_val = (function() {if ($truthy(attrs.$delete("toc2"))) { + return "left" + } else { + return attrs['$[]']("toc") + }; return nil; })()))) { + if ($truthy(($truthy($a = (toc_placement = attrs.$fetch("toc-placement", "macro"))) ? toc_placement['$!=']("auto") : $a))) { + return toc_placement + } else { + return attrs['$[]']("toc-position") + } + } else { + return nil + }; return nil; })(); + if ($truthy(($truthy($a = toc_val) ? ($truthy($b = toc_val['$empty?']()['$!']()) ? $b : toc_position_val['$nil_or_empty?']()['$!']()) : $a))) { + + default_toc_position = "left"; + default_toc_class = "toc2"; + if ($truthy(toc_position_val['$nil_or_empty?']()['$!']())) { + position = toc_position_val + } else if ($truthy(toc_val['$empty?']()['$!']())) { + position = toc_val + } else { + position = default_toc_position + }; + + $writer = ["toc", ""]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["toc-placement", "auto"]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + $case = position; + if ("left"['$===']($case) || "<"['$===']($case) || "<"['$===']($case)) { + $writer = ["toc-position", "left"]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];} + else if ("right"['$===']($case) || ">"['$===']($case) || ">"['$===']($case)) { + $writer = ["toc-position", "right"]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];} + else if ("top"['$===']($case) || "^"['$===']($case)) { + $writer = ["toc-position", "top"]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];} + else if ("bottom"['$===']($case) || "v"['$===']($case)) { + $writer = ["toc-position", "bottom"]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];} + else if ("preamble"['$===']($case) || "macro"['$===']($case)) { + + $writer = ["toc-position", "content"]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["toc-placement", position]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + default_toc_class = nil;} + else { + attrs.$delete("toc-position"); + default_toc_class = nil;}; + if ($truthy(default_toc_class)) { + ($truthy($a = attrs['$[]']("toc-class")) ? $a : (($writer = ["toc-class", default_toc_class]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]))};}; + if ($truthy((self.compat_mode = attrs['$key?']("compat-mode")))) { + if ($truthy(attrs['$key?']("language"))) { + + $writer = ["source-language", attrs['$[]']("language")]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}}; + self.outfilesuffix = attrs['$[]']("outfilesuffix"); + self.header_attributes = attrs.$dup(); + if ($truthy(self.parent_document)) { + return nil + } else { + return $send($$($nesting, 'FLEXIBLE_ATTRIBUTES'), 'each', [], (TMP_43 = function(name){var self = TMP_43.$$s || this, $c; + if (self.attribute_overrides == null) self.attribute_overrides = nil; + + + + if (name == null) { + name = nil; + }; + if ($truthy(($truthy($c = self.attribute_overrides['$key?'](name)) ? self.attribute_overrides['$[]'](name) : $c))) { + return self.attribute_overrides.$delete(name) + } else { + return nil + };}, TMP_43.$$s = self, TMP_43.$$arity = 1, TMP_43)) + }; + }, TMP_Document_save_attributes_42.$$arity = 0); + + Opal.def(self, '$restore_attributes', TMP_Document_restore_attributes_44 = function $$restore_attributes() { + var self = this; + + + if ($truthy(self.parent_document)) { + } else { + self.catalog['$[]']("callouts").$rewind() + }; + return self.attributes.$replace(self.header_attributes); + }, TMP_Document_restore_attributes_44.$$arity = 0); + + Opal.def(self, '$clear_playback_attributes', TMP_Document_clear_playback_attributes_45 = function $$clear_playback_attributes(attributes) { + var self = this; + + return attributes.$delete("attribute_entries") + }, TMP_Document_clear_playback_attributes_45.$$arity = 1); + + Opal.def(self, '$playback_attributes', TMP_Document_playback_attributes_46 = function $$playback_attributes(block_attributes) { + var TMP_47, self = this; + + if ($truthy(block_attributes['$key?']("attribute_entries"))) { + return $send(block_attributes['$[]']("attribute_entries"), 'each', [], (TMP_47 = function(entry){var self = TMP_47.$$s || this, name = nil, $writer = nil; + if (self.attributes == null) self.attributes = nil; + + + + if (entry == null) { + entry = nil; + }; + name = entry.$name(); + if ($truthy(entry.$negate())) { + + self.attributes.$delete(name); + if (name['$==']("compat-mode")) { + return (self.compat_mode = false) + } else { + return nil + }; + } else { + + + $writer = [name, entry.$value()]; + $send(self.attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + if (name['$==']("compat-mode")) { + return (self.compat_mode = true) + } else { + return nil + }; + };}, TMP_47.$$s = self, TMP_47.$$arity = 1, TMP_47)) + } else { + return nil + } + }, TMP_Document_playback_attributes_46.$$arity = 1); + + Opal.def(self, '$set_attribute', TMP_Document_set_attribute_48 = function $$set_attribute(name, value) { + var self = this, resolved_value = nil, $case = nil, $writer = nil; + + + + if (value == null) { + value = ""; + }; + if ($truthy(self['$attribute_locked?'](name))) { + return false + } else { + + if ($truthy(self.max_attribute_value_size)) { + resolved_value = self.$apply_attribute_value_subs(value).$limit_bytesize(self.max_attribute_value_size) + } else { + resolved_value = self.$apply_attribute_value_subs(value) + }; + $case = name; + if ("backend"['$===']($case)) {self.$update_backend_attributes(resolved_value, self.attributes_modified['$delete?']("htmlsyntax"))} + else if ("doctype"['$===']($case)) {self.$update_doctype_attributes(resolved_value)} + else { + $writer = [name, resolved_value]; + $send(self.attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + self.attributes_modified['$<<'](name); + return resolved_value; + }; + }, TMP_Document_set_attribute_48.$$arity = -2); + + Opal.def(self, '$delete_attribute', TMP_Document_delete_attribute_49 = function $$delete_attribute(name) { + var self = this; + + if ($truthy(self['$attribute_locked?'](name))) { + return false + } else { + + self.attributes.$delete(name); + self.attributes_modified['$<<'](name); + return true; + } + }, TMP_Document_delete_attribute_49.$$arity = 1); + + Opal.def(self, '$attribute_locked?', TMP_Document_attribute_locked$q_50 = function(name) { + var self = this; + + return self.attribute_overrides['$key?'](name) + }, TMP_Document_attribute_locked$q_50.$$arity = 1); + + Opal.def(self, '$set_header_attribute', TMP_Document_set_header_attribute_51 = function $$set_header_attribute(name, value, overwrite) { + var $a, self = this, attrs = nil, $writer = nil; + + + + if (value == null) { + value = ""; + }; + + if (overwrite == null) { + overwrite = true; + }; + attrs = ($truthy($a = self.header_attributes) ? $a : self.attributes); + if ($truthy((($a = overwrite['$=='](false)) ? attrs['$key?'](name) : overwrite['$=='](false)))) { + return false + } else { + + + $writer = [name, value]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + return true; + }; + }, TMP_Document_set_header_attribute_51.$$arity = -2); + + Opal.def(self, '$apply_attribute_value_subs', TMP_Document_apply_attribute_value_subs_52 = function $$apply_attribute_value_subs(value) { + var $a, self = this; + + if ($truthy($$($nesting, 'AttributeEntryPassMacroRx')['$=~'](value))) { + if ($truthy((($a = $gvars['~']) === nil ? nil : $a['$[]'](1)))) { + + return self.$apply_subs((($a = $gvars['~']) === nil ? nil : $a['$[]'](2)), self.$resolve_pass_subs((($a = $gvars['~']) === nil ? nil : $a['$[]'](1)))); + } else { + return (($a = $gvars['~']) === nil ? nil : $a['$[]'](2)) + } + } else { + return self.$apply_header_subs(value) + } + }, TMP_Document_apply_attribute_value_subs_52.$$arity = 1); + + Opal.def(self, '$update_backend_attributes', TMP_Document_update_backend_attributes_53 = function $$update_backend_attributes(new_backend, force) { + var $a, $b, self = this, attrs = nil, current_backend = nil, current_basebackend = nil, current_doctype = nil, $writer = nil, resolved_backend = nil, new_basebackend = nil, new_filetype = nil, new_outfilesuffix = nil, current_filetype = nil, page_width = nil; + + + + if (force == null) { + force = nil; + }; + if ($truthy(($truthy($a = force) ? $a : ($truthy($b = new_backend) ? new_backend['$!='](self.backend) : $b)))) { + + $a = [self.backend, (attrs = self.attributes)['$[]']("basebackend"), self.doctype], (current_backend = $a[0]), (current_basebackend = $a[1]), (current_doctype = $a[2]), $a; + if ($truthy(new_backend['$start_with?']("xhtml"))) { + + + $writer = ["htmlsyntax", "xml"]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + new_backend = new_backend.$slice(1, new_backend.$length()); + } else if ($truthy(new_backend['$start_with?']("html"))) { + if (attrs['$[]']("htmlsyntax")['$==']("xml")) { + } else { + + $writer = ["htmlsyntax", "html"]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }}; + if ($truthy((resolved_backend = $$($nesting, 'BACKEND_ALIASES')['$[]'](new_backend)))) { + new_backend = resolved_backend}; + if ($truthy(current_doctype)) { + + if ($truthy(current_backend)) { + + attrs.$delete("" + "backend-" + (current_backend)); + attrs.$delete("" + "backend-" + (current_backend) + "-doctype-" + (current_doctype));}; + + $writer = ["" + "backend-" + (new_backend) + "-doctype-" + (current_doctype), ""]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["" + "doctype-" + (current_doctype), ""]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + } else if ($truthy(current_backend)) { + attrs.$delete("" + "backend-" + (current_backend))}; + + $writer = ["" + "backend-" + (new_backend), ""]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + self.backend = (($writer = ["backend", new_backend]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]); + if ($truthy($$$($$($nesting, 'Converter'), 'BackendInfo')['$===']((self.converter = self.$create_converter())))) { + + new_basebackend = self.converter.$basebackend(); + if ($truthy(self['$attribute_locked?']("outfilesuffix"))) { + } else { + + $writer = ["outfilesuffix", self.converter.$outfilesuffix()]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + new_filetype = self.converter.$filetype(); + } else if ($truthy(self.converter)) { + + new_basebackend = new_backend.$sub($$($nesting, 'TrailingDigitsRx'), ""); + if ($truthy((new_outfilesuffix = $$($nesting, 'DEFAULT_EXTENSIONS')['$[]'](new_basebackend)))) { + new_filetype = new_outfilesuffix.$slice(1, new_outfilesuffix.$length()) + } else { + $a = [".html", "html", "html"], (new_outfilesuffix = $a[0]), (new_basebackend = $a[1]), (new_filetype = $a[2]), $a + }; + if ($truthy(self['$attribute_locked?']("outfilesuffix"))) { + } else { + + $writer = ["outfilesuffix", new_outfilesuffix]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + } else { + self.$raise($$$('::', 'NotImplementedError'), "" + "asciidoctor: FAILED: missing converter for backend '" + (new_backend) + "'. Processing aborted.") + }; + if ($truthy((current_filetype = attrs['$[]']("filetype")))) { + attrs.$delete("" + "filetype-" + (current_filetype))}; + + $writer = ["filetype", new_filetype]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["" + "filetype-" + (new_filetype), ""]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + if ($truthy((page_width = $$($nesting, 'DEFAULT_PAGE_WIDTHS')['$[]'](new_basebackend)))) { + + $writer = ["pagewidth", page_width]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + } else { + attrs.$delete("pagewidth") + }; + if ($truthy(new_basebackend['$!='](current_basebackend))) { + + if ($truthy(current_doctype)) { + + if ($truthy(current_basebackend)) { + + attrs.$delete("" + "basebackend-" + (current_basebackend)); + attrs.$delete("" + "basebackend-" + (current_basebackend) + "-doctype-" + (current_doctype));}; + + $writer = ["" + "basebackend-" + (new_basebackend) + "-doctype-" + (current_doctype), ""]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + } else if ($truthy(current_basebackend)) { + attrs.$delete("" + "basebackend-" + (current_basebackend))}; + + $writer = ["" + "basebackend-" + (new_basebackend), ""]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["basebackend", new_basebackend]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];;}; + return new_backend; + } else { + return nil + }; + }, TMP_Document_update_backend_attributes_53.$$arity = -2); + + Opal.def(self, '$update_doctype_attributes', TMP_Document_update_doctype_attributes_54 = function $$update_doctype_attributes(new_doctype) { + var $a, self = this, attrs = nil, current_backend = nil, current_basebackend = nil, current_doctype = nil, $writer = nil; + + if ($truthy(($truthy($a = new_doctype) ? new_doctype['$!='](self.doctype) : $a))) { + + $a = [self.backend, (attrs = self.attributes)['$[]']("basebackend"), self.doctype], (current_backend = $a[0]), (current_basebackend = $a[1]), (current_doctype = $a[2]), $a; + if ($truthy(current_doctype)) { + + attrs.$delete("" + "doctype-" + (current_doctype)); + if ($truthy(current_backend)) { + + attrs.$delete("" + "backend-" + (current_backend) + "-doctype-" + (current_doctype)); + + $writer = ["" + "backend-" + (current_backend) + "-doctype-" + (new_doctype), ""]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];;}; + if ($truthy(current_basebackend)) { + + attrs.$delete("" + "basebackend-" + (current_basebackend) + "-doctype-" + (current_doctype)); + + $writer = ["" + "basebackend-" + (current_basebackend) + "-doctype-" + (new_doctype), ""]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];;}; + } else { + + if ($truthy(current_backend)) { + + $writer = ["" + "backend-" + (current_backend) + "-doctype-" + (new_doctype), ""]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if ($truthy(current_basebackend)) { + + $writer = ["" + "basebackend-" + (current_basebackend) + "-doctype-" + (new_doctype), ""]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + }; + + $writer = ["" + "doctype-" + (new_doctype), ""]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + return (self.doctype = (($writer = ["doctype", new_doctype]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + } else { + return nil + } + }, TMP_Document_update_doctype_attributes_54.$$arity = 1); + + Opal.def(self, '$create_converter', TMP_Document_create_converter_55 = function $$create_converter() { + var self = this, converter_opts = nil, $writer = nil, template_dir = nil, template_dirs = nil, converter = nil, converter_factory = nil; + + + converter_opts = $hash2([], {}); + + $writer = ["htmlsyntax", self.attributes['$[]']("htmlsyntax")]; + $send(converter_opts, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + if ($truthy((template_dir = self.options['$[]']("template_dir")))) { + template_dirs = [template_dir] + } else if ($truthy((template_dirs = self.options['$[]']("template_dirs")))) { + template_dirs = self.$Array(template_dirs)}; + if ($truthy(template_dirs)) { + + + $writer = ["template_dirs", template_dirs]; + $send(converter_opts, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["template_cache", self.options.$fetch("template_cache", true)]; + $send(converter_opts, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["template_engine", self.options['$[]']("template_engine")]; + $send(converter_opts, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["template_engine_options", self.options['$[]']("template_engine_options")]; + $send(converter_opts, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["eruby", self.options['$[]']("eruby")]; + $send(converter_opts, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["safe", self.safe]; + $send(converter_opts, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];;}; + if ($truthy((converter = self.options['$[]']("converter")))) { + converter_factory = $$$($$($nesting, 'Converter'), 'Factory').$new($$$('::', 'Hash')['$[]'](self.$backend(), converter)) + } else { + converter_factory = $$$($$($nesting, 'Converter'), 'Factory').$default(false) + }; + return converter_factory.$create(self.$backend(), converter_opts); + }, TMP_Document_create_converter_55.$$arity = 0); + + Opal.def(self, '$convert', TMP_Document_convert_56 = function $$convert(opts) { + var $a, TMP_57, self = this, $writer = nil, block = nil, output = nil, transform = nil, exts = nil; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + if ($truthy(self.timings)) { + self.timings.$start("convert")}; + if ($truthy(self.parsed)) { + } else { + self.$parse() + }; + if ($truthy(($truthy($a = $rb_ge(self.safe, $$$($$($nesting, 'SafeMode'), 'SERVER'))) ? $a : opts['$empty?']()))) { + } else { + + if ($truthy((($writer = ["outfile", opts['$[]']("outfile")]), $send(self.attributes, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]))) { + } else { + self.attributes.$delete("outfile") + }; + if ($truthy((($writer = ["outdir", opts['$[]']("outdir")]), $send(self.attributes, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]))) { + } else { + self.attributes.$delete("outdir") + }; + }; + if (self.$doctype()['$==']("inline")) { + if ($truthy((block = ($truthy($a = self.blocks['$[]'](0)) ? $a : self.header)))) { + if ($truthy(($truthy($a = block.$content_model()['$==']("compound")) ? $a : block.$content_model()['$==']("empty")))) { + self.$logger().$warn("no inline candidate; use the inline doctype to convert a single paragragh, verbatim, or raw block") + } else { + output = block.$content() + }} + } else { + + transform = (function() {if ($truthy((function() {if ($truthy(opts['$key?']("header_footer"))) { + return opts['$[]']("header_footer") + } else { + return self.options['$[]']("header_footer") + }; return nil; })())) { + return "document" + } else { + return "embedded" + }; return nil; })(); + output = self.converter.$convert(self, transform); + }; + if ($truthy(self.parent_document)) { + } else if ($truthy(($truthy($a = (exts = self.extensions)) ? exts['$postprocessors?']() : $a))) { + $send(exts.$postprocessors(), 'each', [], (TMP_57 = function(ext){var self = TMP_57.$$s || this; + + + + if (ext == null) { + ext = nil; + }; + return (output = ext.$process_method()['$[]'](self, output));}, TMP_57.$$s = self, TMP_57.$$arity = 1, TMP_57))}; + if ($truthy(self.timings)) { + self.timings.$record("convert")}; + return output; + }, TMP_Document_convert_56.$$arity = -1); + Opal.alias(self, "render", "convert"); + + Opal.def(self, '$write', TMP_Document_write_58 = function $$write(output, target) { + var $a, $b, self = this; + + + if ($truthy(self.timings)) { + self.timings.$start("write")}; + if ($truthy($$($nesting, 'Writer')['$==='](self.converter))) { + self.converter.$write(output, target) + } else { + + if ($truthy(target['$respond_to?']("write"))) { + if ($truthy(output['$nil_or_empty?']())) { + } else { + + target.$write(output.$chomp()); + target.$write($$($nesting, 'LF')); + } + } else if ($truthy($$($nesting, 'COERCE_ENCODING'))) { + $$$('::', 'IO').$write(target, output, $hash2(["encoding"], {"encoding": $$$($$$('::', 'Encoding'), 'UTF_8')})) + } else { + $$$('::', 'IO').$write(target, output) + }; + if ($truthy(($truthy($a = (($b = self.backend['$==']("manpage")) ? $$$('::', 'String')['$==='](target) : self.backend['$==']("manpage"))) ? self.converter['$respond_to?']("write_alternate_pages") : $a))) { + self.converter.$write_alternate_pages(self.attributes['$[]']("mannames"), self.attributes['$[]']("manvolnum"), target)}; + }; + if ($truthy(self.timings)) { + self.timings.$record("write")}; + return nil; + }, TMP_Document_write_58.$$arity = 2); + + Opal.def(self, '$content', TMP_Document_content_59 = function $$content() { + var $iter = TMP_Document_content_59.$$p, $yield = $iter || nil, self = this, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_Document_content_59.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + + self.attributes.$delete("title"); + return $send(self, Opal.find_super_dispatcher(self, 'content', TMP_Document_content_59, false), $zuper, $iter); + }, TMP_Document_content_59.$$arity = 0); + + Opal.def(self, '$docinfo', TMP_Document_docinfo_60 = function $$docinfo(location, suffix) { + var TMP_61, $a, TMP_62, self = this, content = nil, qualifier = nil, docinfo = nil, docinfo_file = nil, docinfo_dir = nil, docinfo_subs = nil, docinfo_path = nil, shd_content = nil, pvt_content = nil; + + + + if (location == null) { + location = "head"; + }; + + if (suffix == null) { + suffix = nil; + }; + if ($truthy($rb_ge(self.$safe(), $$$($$($nesting, 'SafeMode'), 'SECURE')))) { + return "" + } else { + + content = []; + if (location['$==']("head")) { + } else { + qualifier = "" + "-" + (location) + }; + if ($truthy(suffix)) { + } else { + suffix = self.outfilesuffix + }; + if ($truthy((docinfo = self.attributes['$[]']("docinfo"))['$nil_or_empty?']())) { + if ($truthy(self.attributes['$key?']("docinfo2"))) { + docinfo = ["private", "shared"] + } else if ($truthy(self.attributes['$key?']("docinfo1"))) { + docinfo = ["shared"] + } else { + docinfo = (function() {if ($truthy(docinfo)) { + return ["private"] + } else { + return nil + }; return nil; })() + } + } else { + docinfo = $send(docinfo.$split(","), 'map', [], (TMP_61 = function(it){var self = TMP_61.$$s || this; + + + + if (it == null) { + it = nil; + }; + return it.$strip();}, TMP_61.$$s = self, TMP_61.$$arity = 1, TMP_61)) + }; + if ($truthy(docinfo)) { + + $a = ["" + "docinfo" + (qualifier) + (suffix), self.attributes['$[]']("docinfodir"), self.$resolve_docinfo_subs()], (docinfo_file = $a[0]), (docinfo_dir = $a[1]), (docinfo_subs = $a[2]), $a; + if ($truthy(docinfo['$&'](["shared", "" + "shared-" + (location)])['$empty?']())) { + } else { + + docinfo_path = self.$normalize_system_path(docinfo_file, docinfo_dir); + if ($truthy((shd_content = self.$read_asset(docinfo_path, $hash2(["normalize"], {"normalize": true}))))) { + content['$<<'](self.$apply_subs(shd_content, docinfo_subs))}; + }; + if ($truthy(($truthy($a = self.attributes['$[]']("docname")['$nil_or_empty?']()) ? $a : docinfo['$&'](["private", "" + "private-" + (location)])['$empty?']()))) { + } else { + + docinfo_path = self.$normalize_system_path("" + (self.attributes['$[]']("docname")) + "-" + (docinfo_file), docinfo_dir); + if ($truthy((pvt_content = self.$read_asset(docinfo_path, $hash2(["normalize"], {"normalize": true}))))) { + content['$<<'](self.$apply_subs(pvt_content, docinfo_subs))}; + };}; + if ($truthy(($truthy($a = self.extensions) ? self['$docinfo_processors?'](location) : $a))) { + content = $rb_plus(content, $send(self.docinfo_processor_extensions['$[]'](location), 'map', [], (TMP_62 = function(ext){var self = TMP_62.$$s || this; + + + + if (ext == null) { + ext = nil; + }; + return ext.$process_method()['$[]'](self);}, TMP_62.$$s = self, TMP_62.$$arity = 1, TMP_62)).$compact())}; + return content.$join($$($nesting, 'LF')); + }; + }, TMP_Document_docinfo_60.$$arity = -1); + + Opal.def(self, '$resolve_docinfo_subs', TMP_Document_resolve_docinfo_subs_63 = function $$resolve_docinfo_subs() { + var self = this; + + if ($truthy(self.attributes['$key?']("docinfosubs"))) { + + return self.$resolve_subs(self.attributes['$[]']("docinfosubs"), "block", nil, "docinfo"); + } else { + return ["attributes"] + } + }, TMP_Document_resolve_docinfo_subs_63.$$arity = 0); + + Opal.def(self, '$docinfo_processors?', TMP_Document_docinfo_processors$q_64 = function(location) { + var $a, self = this, $writer = nil; + + + + if (location == null) { + location = "head"; + }; + if ($truthy(self.docinfo_processor_extensions['$key?'](location))) { + return self.docinfo_processor_extensions['$[]'](location)['$!='](false) + } else if ($truthy(($truthy($a = self.extensions) ? self.document.$extensions()['$docinfo_processors?'](location) : $a))) { + return (($writer = [location, self.document.$extensions().$docinfo_processors(location)]), $send(self.docinfo_processor_extensions, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])['$!']()['$!']() + } else { + + $writer = [location, false]; + $send(self.docinfo_processor_extensions, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + }; + }, TMP_Document_docinfo_processors$q_64.$$arity = -1); + return (Opal.def(self, '$to_s', TMP_Document_to_s_65 = function $$to_s() { + var self = this; + + return "" + "#<" + (self.$class()) + "@" + (self.$object_id()) + " {doctype: " + (self.$doctype().$inspect()) + ", doctitle: " + ((function() {if ($truthy(self.header['$!='](nil))) { + return self.header.$title() + } else { + return nil + }; return nil; })().$inspect()) + ", blocks: " + (self.blocks.$size()) + "}>" + }, TMP_Document_to_s_65.$$arity = 0), nil) && 'to_s'; + })($nesting[0], $$($nesting, 'AbstractBlock'), $nesting) + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/inline"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $hash2 = Opal.hash2, $send = Opal.send, $truthy = Opal.truthy; + + Opal.add_stubs(['$attr_reader', '$attr_accessor', '$[]', '$dup', '$convert', '$converter', '$attr', '$==', '$apply_reftext_subs', '$reftext']); + return (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + (function($base, $super, $parent_nesting) { + function $Inline(){}; + var self = $Inline = $klass($base, $super, 'Inline', $Inline); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Inline_initialize_1, TMP_Inline_block$q_2, TMP_Inline_inline$q_3, TMP_Inline_convert_4, TMP_Inline_alt_5, TMP_Inline_reftext$q_6, TMP_Inline_reftext_7, TMP_Inline_xreftext_8; + + def.text = def.type = nil; + + self.$attr_reader("text"); + self.$attr_reader("type"); + self.$attr_accessor("target"); + + Opal.def(self, '$initialize', TMP_Inline_initialize_1 = function $$initialize(parent, context, text, opts) { + var $iter = TMP_Inline_initialize_1.$$p, $yield = $iter || nil, self = this, attrs = nil; + + if ($iter) TMP_Inline_initialize_1.$$p = null; + + + if (text == null) { + text = nil; + }; + + if (opts == null) { + opts = $hash2([], {}); + }; + $send(self, Opal.find_super_dispatcher(self, 'initialize', TMP_Inline_initialize_1, false), [parent, context], null); + self.node_name = "" + "inline_" + (context); + self.text = text; + self.id = opts['$[]']("id"); + self.type = opts['$[]']("type"); + self.target = opts['$[]']("target"); + if ($truthy((attrs = opts['$[]']("attributes")))) { + return (self.attributes = attrs.$dup()) + } else { + return nil + }; + }, TMP_Inline_initialize_1.$$arity = -3); + + Opal.def(self, '$block?', TMP_Inline_block$q_2 = function() { + var self = this; + + return false + }, TMP_Inline_block$q_2.$$arity = 0); + + Opal.def(self, '$inline?', TMP_Inline_inline$q_3 = function() { + var self = this; + + return true + }, TMP_Inline_inline$q_3.$$arity = 0); + + Opal.def(self, '$convert', TMP_Inline_convert_4 = function $$convert() { + var self = this; + + return self.$converter().$convert(self) + }, TMP_Inline_convert_4.$$arity = 0); + Opal.alias(self, "render", "convert"); + + Opal.def(self, '$alt', TMP_Inline_alt_5 = function $$alt() { + var self = this; + + return self.$attr("alt") + }, TMP_Inline_alt_5.$$arity = 0); + + Opal.def(self, '$reftext?', TMP_Inline_reftext$q_6 = function() { + var $a, $b, self = this; + + return ($truthy($a = self.text) ? ($truthy($b = self.type['$==']("ref")) ? $b : self.type['$==']("bibref")) : $a) + }, TMP_Inline_reftext$q_6.$$arity = 0); + + Opal.def(self, '$reftext', TMP_Inline_reftext_7 = function $$reftext() { + var self = this, val = nil; + + if ($truthy((val = self.text))) { + + return self.$apply_reftext_subs(val); + } else { + return nil + } + }, TMP_Inline_reftext_7.$$arity = 0); + return (Opal.def(self, '$xreftext', TMP_Inline_xreftext_8 = function $$xreftext(xrefstyle) { + var self = this; + + + + if (xrefstyle == null) { + xrefstyle = nil; + }; + return self.$reftext(); + }, TMP_Inline_xreftext_8.$$arity = -1), nil) && 'xreftext'; + })($nesting[0], $$($nesting, 'AbstractNode'), $nesting) + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/list"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $hash2 = Opal.hash2, $send = Opal.send, $truthy = Opal.truthy; + + Opal.add_stubs(['$==', '$next_list', '$callouts', '$class', '$object_id', '$inspect', '$size', '$items', '$attr_accessor', '$level', '$drop', '$!', '$nil_or_empty?', '$apply_subs', '$empty?', '$===', '$[]', '$outline?', '$simple?', '$context', '$option?', '$shift', '$blocks', '$unshift', '$lines', '$source', '$parent']); + return (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + + (function($base, $super, $parent_nesting) { + function $List(){}; + var self = $List = $klass($base, $super, 'List', $List); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_List_initialize_1, TMP_List_outline$q_2, TMP_List_convert_3, TMP_List_to_s_4; + + def.context = def.document = def.style = nil; + + Opal.alias(self, "items", "blocks"); + Opal.alias(self, "content", "blocks"); + Opal.alias(self, "items?", "blocks?"); + + Opal.def(self, '$initialize', TMP_List_initialize_1 = function $$initialize(parent, context, opts) { + var $iter = TMP_List_initialize_1.$$p, $yield = $iter || nil, self = this, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_List_initialize_1.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + + + if (opts == null) { + opts = $hash2([], {}); + }; + return $send(self, Opal.find_super_dispatcher(self, 'initialize', TMP_List_initialize_1, false), $zuper, $iter); + }, TMP_List_initialize_1.$$arity = -3); + + Opal.def(self, '$outline?', TMP_List_outline$q_2 = function() { + var $a, self = this; + + return ($truthy($a = self.context['$==']("ulist")) ? $a : self.context['$==']("olist")) + }, TMP_List_outline$q_2.$$arity = 0); + + Opal.def(self, '$convert', TMP_List_convert_3 = function $$convert() { + var $iter = TMP_List_convert_3.$$p, $yield = $iter || nil, self = this, result = nil, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_List_convert_3.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + if (self.context['$==']("colist")) { + + result = $send(self, Opal.find_super_dispatcher(self, 'convert', TMP_List_convert_3, false), $zuper, $iter); + self.document.$callouts().$next_list(); + return result; + } else { + return $send(self, Opal.find_super_dispatcher(self, 'convert', TMP_List_convert_3, false), $zuper, $iter) + } + }, TMP_List_convert_3.$$arity = 0); + Opal.alias(self, "render", "convert"); + return (Opal.def(self, '$to_s', TMP_List_to_s_4 = function $$to_s() { + var self = this; + + return "" + "#<" + (self.$class()) + "@" + (self.$object_id()) + " {context: " + (self.context.$inspect()) + ", style: " + (self.style.$inspect()) + ", items: " + (self.$items().$size()) + "}>" + }, TMP_List_to_s_4.$$arity = 0), nil) && 'to_s'; + })($nesting[0], $$($nesting, 'AbstractBlock'), $nesting); + (function($base, $super, $parent_nesting) { + function $ListItem(){}; + var self = $ListItem = $klass($base, $super, 'ListItem', $ListItem); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_ListItem_initialize_5, TMP_ListItem_text$q_6, TMP_ListItem_text_7, TMP_ListItem_text$eq_8, TMP_ListItem_simple$q_9, TMP_ListItem_compound$q_10, TMP_ListItem_fold_first_11, TMP_ListItem_to_s_12; + + def.text = def.subs = def.blocks = nil; + + Opal.alias(self, "list", "parent"); + self.$attr_accessor("marker"); + + Opal.def(self, '$initialize', TMP_ListItem_initialize_5 = function $$initialize(parent, text) { + var $iter = TMP_ListItem_initialize_5.$$p, $yield = $iter || nil, self = this; + + if ($iter) TMP_ListItem_initialize_5.$$p = null; + + + if (text == null) { + text = nil; + }; + $send(self, Opal.find_super_dispatcher(self, 'initialize', TMP_ListItem_initialize_5, false), [parent, "list_item"], null); + self.text = text; + self.level = parent.$level(); + return (self.subs = $$($nesting, 'NORMAL_SUBS').$drop(0)); + }, TMP_ListItem_initialize_5.$$arity = -2); + + Opal.def(self, '$text?', TMP_ListItem_text$q_6 = function() { + var self = this; + + return self.text['$nil_or_empty?']()['$!']() + }, TMP_ListItem_text$q_6.$$arity = 0); + + Opal.def(self, '$text', TMP_ListItem_text_7 = function $$text() { + var $a, self = this; + + return ($truthy($a = self.text) ? self.$apply_subs(self.text, self.subs) : $a) + }, TMP_ListItem_text_7.$$arity = 0); + + Opal.def(self, '$text=', TMP_ListItem_text$eq_8 = function(val) { + var self = this; + + return (self.text = val) + }, TMP_ListItem_text$eq_8.$$arity = 1); + + Opal.def(self, '$simple?', TMP_ListItem_simple$q_9 = function() { + var $a, $b, $c, self = this, blk = nil; + + return ($truthy($a = self.blocks['$empty?']()) ? $a : ($truthy($b = (($c = self.blocks.$size()['$=='](1)) ? $$($nesting, 'List')['$===']((blk = self.blocks['$[]'](0))) : self.blocks.$size()['$=='](1))) ? blk['$outline?']() : $b)) + }, TMP_ListItem_simple$q_9.$$arity = 0); + + Opal.def(self, '$compound?', TMP_ListItem_compound$q_10 = function() { + var self = this; + + return self['$simple?']()['$!']() + }, TMP_ListItem_compound$q_10.$$arity = 0); + + Opal.def(self, '$fold_first', TMP_ListItem_fold_first_11 = function $$fold_first(continuation_connects_first_block, content_adjacent) { + var $a, $b, $c, $d, $e, self = this, first_block = nil, block = nil; + + + + if (continuation_connects_first_block == null) { + continuation_connects_first_block = false; + }; + + if (content_adjacent == null) { + content_adjacent = false; + }; + if ($truthy(($truthy($a = ($truthy($b = (first_block = self.blocks['$[]'](0))) ? $$($nesting, 'Block')['$==='](first_block) : $b)) ? ($truthy($b = (($c = first_block.$context()['$==']("paragraph")) ? continuation_connects_first_block['$!']() : first_block.$context()['$==']("paragraph"))) ? $b : ($truthy($c = ($truthy($d = ($truthy($e = content_adjacent) ? $e : continuation_connects_first_block['$!']())) ? first_block.$context()['$==']("literal") : $d)) ? first_block['$option?']("listparagraph") : $c)) : $a))) { + + block = self.$blocks().$shift(); + if ($truthy(self.text['$nil_or_empty?']())) { + } else { + block.$lines().$unshift(self.text) + }; + self.text = block.$source();}; + return nil; + }, TMP_ListItem_fold_first_11.$$arity = -1); + return (Opal.def(self, '$to_s', TMP_ListItem_to_s_12 = function $$to_s() { + var $a, self = this; + + return "" + "#<" + (self.$class()) + "@" + (self.$object_id()) + " {list_context: " + (self.$parent().$context().$inspect()) + ", text: " + (self.text.$inspect()) + ", blocks: " + (($truthy($a = self.blocks) ? $a : []).$size()) + "}>" + }, TMP_ListItem_to_s_12.$$arity = 0), nil) && 'to_s'; + })($nesting[0], $$($nesting, 'AbstractBlock'), $nesting); + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/parser"] = function(Opal) { + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + function $rb_plus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); + } + function $rb_gt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); + } + function $rb_lt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); + } + function $rb_times(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs * rhs : lhs['$*'](rhs); + } + function $rb_le(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs <= rhs : lhs['$<='](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $send = Opal.send, $truthy = Opal.truthy, $hash2 = Opal.hash2, $gvars = Opal.gvars; + + Opal.add_stubs(['$include', '$new', '$lambda', '$start_with?', '$match?', '$is_delimited_block?', '$raise', '$parse_document_header', '$[]', '$has_more_lines?', '$next_section', '$assign_numeral', '$<<', '$blocks', '$parse_block_metadata_lines', '$attributes', '$is_next_line_doctitle?', '$finalize_header', '$nil_or_empty?', '$title=', '$-', '$sourcemap', '$cursor', '$parse_section_title', '$id=', '$source_location=', '$header', '$attribute_locked?', '$[]=', '$id', '$parse_header_metadata', '$register', '$==', '$doctype', '$parse_manpage_header', '$=~', '$downcase', '$include?', '$sub_attributes', '$error', '$logger', '$message_with_context', '$cursor_at_line', '$backend', '$skip_blank_lines', '$save', '$update', '$is_next_line_section?', '$initialize_section', '$join', '$map', '$read_lines_until', '$to_proc', '$title', '$split', '$lstrip', '$restore_save', '$discard_save', '$context', '$empty?', '$has_header?', '$delete', '$!', '$!=', '$attr?', '$attr', '$key?', '$document', '$+', '$level', '$special', '$sectname', '$to_i', '$>', '$<', '$warn', '$next_block', '$blocks?', '$style', '$context=', '$style=', '$parent=', '$size', '$content_model', '$shift', '$unwrap_standalone_preamble', '$dup', '$fetch', '$parse_block_metadata_line', '$extensions', '$block_macros?', '$mark', '$read_line', '$terminator', '$to_s', '$masq', '$to_sym', '$registered_for_block?', '$cursor_at_mark', '$strict_verbatim_paragraphs', '$unshift_line', '$markdown_syntax', '$keys', '$chr', '$*', '$length', '$end_with?', '$===', '$parse_attributes', '$attribute_missing', '$clear', '$tr', '$basename', '$assign_caption', '$registered_for_block_macro?', '$config', '$process_method', '$replace', '$parse_callout_list', '$callouts', '$parse_list', '$match', '$parse_description_list', '$underline_style_section_titles', '$is_section_title?', '$peek_line', '$atx_section_title?', '$generate_id', '$level=', '$read_paragraph_lines', '$adjust_indentation!', '$set_option', '$map!', '$slice', '$pop', '$build_block', '$apply_subs', '$chop', '$catalog_inline_anchors', '$rekey', '$index', '$strip', '$parse_table', '$concat', '$each', '$title?', '$lock_in_subs', '$sub?', '$catalog_callouts', '$source', '$remove_sub', '$block_terminates_paragraph', '$<=', '$nil?', '$lines', '$parse_blocks', '$parse_list_item', '$items', '$scan', '$gsub', '$count', '$pre_match', '$advance', '$callout_ids', '$next_list', '$catalog_inline_anchor', '$source_location', '$marker=', '$catalog_inline_biblio_anchor', '$text=', '$resolve_ordered_list_marker', '$read_lines_for_list_item', '$skip_line_comments', '$unshift_lines', '$fold_first', '$text?', '$is_sibling_list_item?', '$find', '$delete_at', '$casecmp', '$sectname=', '$special=', '$numbered=', '$numbered', '$lineno', '$update_attributes', '$peek_lines', '$setext_section_title?', '$abs', '$line_length', '$cursor_at_prev_line', '$process_attribute_entries', '$next_line_empty?', '$process_authors', '$apply_header_subs', '$rstrip', '$each_with_index', '$compact', '$Array', '$squeeze', '$to_a', '$parse_style_attribute', '$process_attribute_entry', '$skip_comment_lines', '$store_attribute', '$sanitize_attribute_name', '$set_attribute', '$save_to', '$delete_attribute', '$ord', '$int_to_roman', '$resolve_list_marker', '$parse_colspecs', '$create_columns', '$format', '$starts_with_delimiter?', '$close_open_cell', '$parse_cellspec', '$delimiter', '$match_delimiter', '$post_match', '$buffer_has_unclosed_quotes?', '$skip_past_delimiter', '$buffer', '$buffer=', '$skip_past_escaped_delimiter', '$keep_cell_open', '$push_cellspec', '$close_cell', '$cell_open?', '$columns', '$assign_column_widths', '$has_header_option=', '$partition_header_footer', '$upto', '$shorthand_property_syntax', '$each_char', '$call', '$sub!', '$gsub!', '$%', '$begin']); + return (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + (function($base, $super, $parent_nesting) { + function $Parser(){}; + var self = $Parser = $klass($base, $super, 'Parser', $Parser); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Parser_1, TMP_Parser_2, TMP_Parser_3, TMP_Parser_initialize_4, TMP_Parser_parse_5, TMP_Parser_parse_document_header_6, TMP_Parser_parse_manpage_header_7, TMP_Parser_next_section_9, TMP_Parser_next_block_10, TMP_Parser_read_paragraph_lines_14, TMP_Parser_is_delimited_block$q_15, TMP_Parser_build_block_16, TMP_Parser_parse_blocks_17, TMP_Parser_parse_list_18, TMP_Parser_catalog_callouts_19, TMP_Parser_catalog_inline_anchor_21, TMP_Parser_catalog_inline_anchors_22, TMP_Parser_catalog_inline_biblio_anchor_24, TMP_Parser_parse_description_list_25, TMP_Parser_parse_callout_list_26, TMP_Parser_parse_list_item_27, TMP_Parser_read_lines_for_list_item_28, TMP_Parser_initialize_section_34, TMP_Parser_is_next_line_section$q_35, TMP_Parser_is_next_line_doctitle$q_36, TMP_Parser_is_section_title$q_37, TMP_Parser_atx_section_title$q_38, TMP_Parser_setext_section_title$q_39, TMP_Parser_parse_section_title_40, TMP_Parser_line_length_41, TMP_Parser_line_length_42, TMP_Parser_parse_header_metadata_43, TMP_Parser_process_authors_48, TMP_Parser_parse_block_metadata_lines_54, TMP_Parser_parse_block_metadata_line_55, TMP_Parser_process_attribute_entries_56, TMP_Parser_process_attribute_entry_57, TMP_Parser_store_attribute_58, TMP_Parser_resolve_list_marker_59, TMP_Parser_resolve_ordered_list_marker_60, TMP_Parser_is_sibling_list_item$q_62, TMP_Parser_parse_table_63, TMP_Parser_parse_colspecs_64, TMP_Parser_parse_cellspec_68, TMP_Parser_parse_style_attribute_69, TMP_Parser_adjust_indentation$B_73, TMP_Parser_sanitize_attribute_name_81; + + + self.$include($$($nesting, 'Logging')); + Opal.const_set($nesting[0], 'BlockMatchData', $$($nesting, 'Struct').$new("context", "masq", "tip", "terminator")); + Opal.const_set($nesting[0], 'TabRx', /\t/); + Opal.const_set($nesting[0], 'TabIndentRx', /^\t+/); + Opal.const_set($nesting[0], 'StartOfBlockProc', $send(self, 'lambda', [], (TMP_Parser_1 = function(l){var self = TMP_Parser_1.$$s || this, $a, $b; + + + + if (l == null) { + l = nil; + }; + return ($truthy($a = ($truthy($b = l['$start_with?']("[")) ? $$($nesting, 'BlockAttributeLineRx')['$match?'](l) : $b)) ? $a : self['$is_delimited_block?'](l));}, TMP_Parser_1.$$s = self, TMP_Parser_1.$$arity = 1, TMP_Parser_1))); + Opal.const_set($nesting[0], 'StartOfListProc', $send(self, 'lambda', [], (TMP_Parser_2 = function(l){var self = TMP_Parser_2.$$s || this; + + + + if (l == null) { + l = nil; + }; + return $$($nesting, 'AnyListRx')['$match?'](l);}, TMP_Parser_2.$$s = self, TMP_Parser_2.$$arity = 1, TMP_Parser_2))); + Opal.const_set($nesting[0], 'StartOfBlockOrListProc', $send(self, 'lambda', [], (TMP_Parser_3 = function(l){var self = TMP_Parser_3.$$s || this, $a, $b, $c; + + + + if (l == null) { + l = nil; + }; + return ($truthy($a = ($truthy($b = self['$is_delimited_block?'](l)) ? $b : ($truthy($c = l['$start_with?']("[")) ? $$($nesting, 'BlockAttributeLineRx')['$match?'](l) : $c))) ? $a : $$($nesting, 'AnyListRx')['$match?'](l));}, TMP_Parser_3.$$s = self, TMP_Parser_3.$$arity = 1, TMP_Parser_3))); + Opal.const_set($nesting[0], 'NoOp', nil); + Opal.const_set($nesting[0], 'TableCellHorzAlignments', $hash2(["<", ">", "^"], {"<": "left", ">": "right", "^": "center"})); + Opal.const_set($nesting[0], 'TableCellVertAlignments', $hash2(["<", ">", "^"], {"<": "top", ">": "bottom", "^": "middle"})); + Opal.const_set($nesting[0], 'TableCellStyles', $hash2(["d", "s", "e", "m", "h", "l", "v", "a"], {"d": "none", "s": "strong", "e": "emphasis", "m": "monospaced", "h": "header", "l": "literal", "v": "verse", "a": "asciidoc"})); + + Opal.def(self, '$initialize', TMP_Parser_initialize_4 = function $$initialize() { + var self = this; + + return self.$raise("Au contraire, mon frere. No parser instances will be running around.") + }, TMP_Parser_initialize_4.$$arity = 0); + Opal.defs(self, '$parse', TMP_Parser_parse_5 = function $$parse(reader, document, options) { + var $a, $b, $c, self = this, block_attributes = nil, new_section = nil; + + + + if (options == null) { + options = $hash2([], {}); + }; + block_attributes = self.$parse_document_header(reader, document); + if ($truthy(options['$[]']("header_only"))) { + } else { + while ($truthy(reader['$has_more_lines?']())) { + + $c = self.$next_section(reader, document, block_attributes), $b = Opal.to_ary($c), (new_section = ($b[0] == null ? nil : $b[0])), (block_attributes = ($b[1] == null ? nil : $b[1])), $c; + if ($truthy(new_section)) { + + document.$assign_numeral(new_section); + document.$blocks()['$<<'](new_section);}; + } + }; + return document; + }, TMP_Parser_parse_5.$$arity = -3); + Opal.defs(self, '$parse_document_header', TMP_Parser_parse_document_header_6 = function $$parse_document_header(reader, document) { + var $a, $b, self = this, block_attrs = nil, doc_attrs = nil, implicit_doctitle = nil, assigned_doctitle = nil, val = nil, $writer = nil, source_location = nil, _ = nil, doctitle = nil, atx = nil, separator = nil, section_title = nil, doc_id = nil, doc_role = nil, doc_reftext = nil; + + + block_attrs = self.$parse_block_metadata_lines(reader, document); + doc_attrs = document.$attributes(); + if ($truthy(($truthy($a = (implicit_doctitle = self['$is_next_line_doctitle?'](reader, block_attrs, doc_attrs['$[]']("leveloffset")))) ? block_attrs['$[]']("title") : $a))) { + return document.$finalize_header(block_attrs, false)}; + assigned_doctitle = nil; + if ($truthy((val = doc_attrs['$[]']("doctitle"))['$nil_or_empty?']())) { + } else { + + $writer = [(assigned_doctitle = val)]; + $send(document, 'title=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + if ($truthy(implicit_doctitle)) { + + if ($truthy(document.$sourcemap())) { + source_location = reader.$cursor()}; + $b = self.$parse_section_title(reader, document), $a = Opal.to_ary($b), document['$id='](($a[0] == null ? nil : $a[0])), (_ = ($a[1] == null ? nil : $a[1])), (doctitle = ($a[2] == null ? nil : $a[2])), (_ = ($a[3] == null ? nil : $a[3])), (atx = ($a[4] == null ? nil : $a[4])), $b; + if ($truthy(assigned_doctitle)) { + } else { + + $writer = [(assigned_doctitle = doctitle)]; + $send(document, 'title=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + if ($truthy(source_location)) { + + $writer = [source_location]; + $send(document.$header(), 'source_location=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if ($truthy(($truthy($a = atx) ? $a : document['$attribute_locked?']("compat-mode")))) { + } else { + + $writer = ["compat-mode", ""]; + $send(doc_attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + if ($truthy((separator = block_attrs['$[]']("separator")))) { + if ($truthy(document['$attribute_locked?']("title-separator"))) { + } else { + + $writer = ["title-separator", separator]; + $send(doc_attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }}; + + $writer = ["doctitle", (section_title = doctitle)]; + $send(doc_attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + if ($truthy((doc_id = block_attrs['$[]']("id")))) { + + $writer = [doc_id]; + $send(document, 'id=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + } else { + doc_id = document.$id() + }; + if ($truthy((doc_role = block_attrs['$[]']("role")))) { + + $writer = ["docrole", doc_role]; + $send(doc_attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if ($truthy((doc_reftext = block_attrs['$[]']("reftext")))) { + + $writer = ["reftext", doc_reftext]; + $send(doc_attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + block_attrs = $hash2([], {}); + self.$parse_header_metadata(reader, document); + if ($truthy(doc_id)) { + document.$register("refs", [doc_id, document])};}; + if ($truthy(($truthy($a = (val = doc_attrs['$[]']("doctitle"))['$nil_or_empty?']()) ? $a : val['$=='](section_title)))) { + } else { + + $writer = [(assigned_doctitle = val)]; + $send(document, 'title=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + if ($truthy(assigned_doctitle)) { + + $writer = ["doctitle", assigned_doctitle]; + $send(doc_attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if (document.$doctype()['$==']("manpage")) { + self.$parse_manpage_header(reader, document, block_attrs)}; + return document.$finalize_header(block_attrs); + }, TMP_Parser_parse_document_header_6.$$arity = 2); + Opal.defs(self, '$parse_manpage_header', TMP_Parser_parse_manpage_header_7 = function $$parse_manpage_header(reader, document, block_attributes) { + var $a, $b, TMP_8, self = this, doc_attrs = nil, $writer = nil, manvolnum = nil, mantitle = nil, manname = nil, name_section_level = nil, name_section = nil, name_section_buffer = nil, mannames = nil, error_msg = nil; + + + if ($truthy($$($nesting, 'ManpageTitleVolnumRx')['$=~']((doc_attrs = document.$attributes())['$[]']("doctitle")))) { + + + $writer = ["manvolnum", (manvolnum = (($a = $gvars['~']) === nil ? nil : $a['$[]'](2)))]; + $send(doc_attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["mantitle", (function() {if ($truthy((mantitle = (($a = $gvars['~']) === nil ? nil : $a['$[]'](1)))['$include?']($$($nesting, 'ATTR_REF_HEAD')))) { + + return document.$sub_attributes(mantitle); + } else { + return mantitle + }; return nil; })().$downcase()]; + $send(doc_attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + } else { + + self.$logger().$error(self.$message_with_context("non-conforming manpage title", $hash2(["source_location"], {"source_location": reader.$cursor_at_line(1)}))); + + $writer = ["mantitle", ($truthy($a = ($truthy($b = doc_attrs['$[]']("doctitle")) ? $b : doc_attrs['$[]']("docname"))) ? $a : "command")]; + $send(doc_attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["manvolnum", (manvolnum = "1")]; + $send(doc_attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + }; + if ($truthy(($truthy($a = (manname = doc_attrs['$[]']("manname"))) ? doc_attrs['$[]']("manpurpose") : $a))) { + + ($truthy($a = doc_attrs['$[]']("manname-title")) ? $a : (($writer = ["manname-title", "Name"]), $send(doc_attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + + $writer = ["mannames", [manname]]; + $send(doc_attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + if (document.$backend()['$==']("manpage")) { + + + $writer = ["docname", manname]; + $send(doc_attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["outfilesuffix", "" + "." + (manvolnum)]; + $send(doc_attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];;}; + } else { + + reader.$skip_blank_lines(); + reader.$save(); + block_attributes.$update(self.$parse_block_metadata_lines(reader, document)); + if ($truthy((name_section_level = self['$is_next_line_section?'](reader, $hash2([], {}))))) { + if (name_section_level['$=='](1)) { + + name_section = self.$initialize_section(reader, document, $hash2([], {})); + name_section_buffer = $send(reader.$read_lines_until($hash2(["break_on_blank_lines", "skip_line_comments"], {"break_on_blank_lines": true, "skip_line_comments": true})), 'map', [], "lstrip".$to_proc()).$join(" "); + if ($truthy($$($nesting, 'ManpageNamePurposeRx')['$=~'](name_section_buffer))) { + + ($truthy($a = doc_attrs['$[]']("manname-title")) ? $a : (($writer = ["manname-title", name_section.$title()]), $send(doc_attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + if ($truthy(name_section.$id())) { + + $writer = ["manname-id", name_section.$id()]; + $send(doc_attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + + $writer = ["manpurpose", (($a = $gvars['~']) === nil ? nil : $a['$[]'](2))]; + $send(doc_attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + if ($truthy((manname = (($a = $gvars['~']) === nil ? nil : $a['$[]'](1)))['$include?']($$($nesting, 'ATTR_REF_HEAD')))) { + manname = document.$sub_attributes(manname)}; + if ($truthy(manname['$include?'](","))) { + manname = (mannames = $send(manname.$split(","), 'map', [], (TMP_8 = function(n){var self = TMP_8.$$s || this; + + + + if (n == null) { + n = nil; + }; + return n.$lstrip();}, TMP_8.$$s = self, TMP_8.$$arity = 1, TMP_8)))['$[]'](0) + } else { + mannames = [manname] + }; + + $writer = ["manname", manname]; + $send(doc_attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["mannames", mannames]; + $send(doc_attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + if (document.$backend()['$==']("manpage")) { + + + $writer = ["docname", manname]; + $send(doc_attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["outfilesuffix", "" + "." + (manvolnum)]; + $send(doc_attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];;}; + } else { + error_msg = "non-conforming name section body" + }; + } else { + error_msg = "name section must be at level 1" + } + } else { + error_msg = "name section expected" + }; + if ($truthy(error_msg)) { + + reader.$restore_save(); + self.$logger().$error(self.$message_with_context(error_msg, $hash2(["source_location"], {"source_location": reader.$cursor()}))); + + $writer = ["manname", (manname = ($truthy($a = doc_attrs['$[]']("docname")) ? $a : "command"))]; + $send(doc_attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["mannames", [manname]]; + $send(doc_attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + if (document.$backend()['$==']("manpage")) { + + + $writer = ["docname", manname]; + $send(doc_attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["outfilesuffix", "" + "." + (manvolnum)]; + $send(doc_attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];;}; + } else { + reader.$discard_save() + }; + }; + return nil; + }, TMP_Parser_parse_manpage_header_7.$$arity = 3); + Opal.defs(self, '$next_section', TMP_Parser_next_section_9 = function $$next_section(reader, parent, attributes) { + var $a, $b, $c, $d, self = this, preamble = nil, intro = nil, part = nil, has_header = nil, book = nil, document = nil, $writer = nil, section = nil, current_level = nil, expected_next_level = nil, expected_next_level_alt = nil, title = nil, sectname = nil, next_level = nil, expected_condition = nil, new_section = nil, block_cursor = nil, new_block = nil, first_block = nil, child_block = nil; + + + + if (attributes == null) { + attributes = $hash2([], {}); + }; + preamble = (intro = (part = false)); + if ($truthy(($truthy($a = (($b = parent.$context()['$==']("document")) ? parent.$blocks()['$empty?']() : parent.$context()['$==']("document"))) ? ($truthy($b = ($truthy($c = (has_header = parent['$has_header?']())) ? $c : attributes.$delete("invalid-header"))) ? $b : self['$is_next_line_section?'](reader, attributes)['$!']()) : $a))) { + + book = (document = parent).$doctype()['$==']("book"); + if ($truthy(($truthy($a = has_header) ? $a : ($truthy($b = book) ? attributes['$[]'](1)['$!=']("abstract") : $b)))) { + + preamble = (intro = $$($nesting, 'Block').$new(parent, "preamble", $hash2(["content_model"], {"content_model": "compound"}))); + if ($truthy(($truthy($a = book) ? parent['$attr?']("preface-title") : $a))) { + + $writer = [parent.$attr("preface-title")]; + $send(preamble, 'title=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + parent.$blocks()['$<<'](preamble);}; + section = parent; + current_level = 0; + if ($truthy(parent.$attributes()['$key?']("fragment"))) { + expected_next_level = -1 + } else if ($truthy(book)) { + $a = [1, 0], (expected_next_level = $a[0]), (expected_next_level_alt = $a[1]), $a + } else { + expected_next_level = 1 + }; + } else { + + book = (document = parent.$document()).$doctype()['$==']("book"); + section = self.$initialize_section(reader, parent, attributes); + attributes = (function() {if ($truthy((title = attributes['$[]']("title")))) { + return $hash2(["title"], {"title": title}) + } else { + return $hash2([], {}) + }; return nil; })(); + expected_next_level = $rb_plus((current_level = section.$level()), 1); + if (current_level['$=='](0)) { + part = book + } else if ($truthy((($a = current_level['$=='](1)) ? section.$special() : current_level['$=='](1)))) { + if ($truthy(($truthy($a = ($truthy($b = (sectname = section.$sectname())['$==']("appendix")) ? $b : sectname['$==']("preface"))) ? $a : sectname['$==']("abstract")))) { + } else { + expected_next_level = nil + }}; + }; + reader.$skip_blank_lines(); + while ($truthy(reader['$has_more_lines?']())) { + + self.$parse_block_metadata_lines(reader, document, attributes); + if ($truthy((next_level = self['$is_next_line_section?'](reader, attributes)))) { + + if ($truthy(document['$attr?']("leveloffset"))) { + next_level = $rb_plus(next_level, document.$attr("leveloffset").$to_i())}; + if ($truthy($rb_gt(next_level, current_level))) { + + if ($truthy(expected_next_level)) { + if ($truthy(($truthy($b = ($truthy($c = next_level['$=='](expected_next_level)) ? $c : ($truthy($d = expected_next_level_alt) ? next_level['$=='](expected_next_level_alt) : $d))) ? $b : $rb_lt(expected_next_level, 0)))) { + } else { + + expected_condition = (function() {if ($truthy(expected_next_level_alt)) { + return "" + "expected levels " + (expected_next_level_alt) + " or " + (expected_next_level) + } else { + return "" + "expected level " + (expected_next_level) + }; return nil; })(); + self.$logger().$warn(self.$message_with_context("" + "section title out of sequence: " + (expected_condition) + ", got level " + (next_level), $hash2(["source_location"], {"source_location": reader.$cursor()}))); + } + } else { + self.$logger().$error(self.$message_with_context("" + (sectname) + " sections do not support nested sections", $hash2(["source_location"], {"source_location": reader.$cursor()}))) + }; + $c = self.$next_section(reader, section, attributes), $b = Opal.to_ary($c), (new_section = ($b[0] == null ? nil : $b[0])), (attributes = ($b[1] == null ? nil : $b[1])), $c; + section.$assign_numeral(new_section); + section.$blocks()['$<<'](new_section); + } else if ($truthy((($b = next_level['$=='](0)) ? section['$=='](document) : next_level['$=='](0)))) { + + if ($truthy(book)) { + } else { + self.$logger().$error(self.$message_with_context("level 0 sections can only be used when doctype is book", $hash2(["source_location"], {"source_location": reader.$cursor()}))) + }; + $c = self.$next_section(reader, section, attributes), $b = Opal.to_ary($c), (new_section = ($b[0] == null ? nil : $b[0])), (attributes = ($b[1] == null ? nil : $b[1])), $c; + section.$assign_numeral(new_section); + section.$blocks()['$<<'](new_section); + } else { + break; + }; + } else { + + block_cursor = reader.$cursor(); + if ($truthy((new_block = self.$next_block(reader, ($truthy($b = intro) ? $b : section), attributes, $hash2(["parse_metadata"], {"parse_metadata": false}))))) { + + if ($truthy(part)) { + if ($truthy(section['$blocks?']()['$!']())) { + if ($truthy(new_block.$style()['$!=']("partintro"))) { + if (new_block.$context()['$==']("paragraph")) { + + + $writer = ["open"]; + $send(new_block, 'context=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["partintro"]; + $send(new_block, 'style=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + } else { + + + $writer = [(intro = $$($nesting, 'Block').$new(section, "open", $hash2(["content_model"], {"content_model": "compound"})))]; + $send(new_block, 'parent=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["partintro"]; + $send(intro, 'style=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + section.$blocks()['$<<'](intro); + }} + } else if (section.$blocks().$size()['$=='](1)) { + + first_block = section.$blocks()['$[]'](0); + if ($truthy(($truthy($b = intro['$!']()) ? first_block.$content_model()['$==']("compound") : $b))) { + self.$logger().$error(self.$message_with_context("illegal block content outside of partintro block", $hash2(["source_location"], {"source_location": block_cursor}))) + } else if ($truthy(first_block.$content_model()['$!=']("compound"))) { + + + $writer = [(intro = $$($nesting, 'Block').$new(section, "open", $hash2(["content_model"], {"content_model": "compound"})))]; + $send(new_block, 'parent=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["partintro"]; + $send(intro, 'style=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + section.$blocks().$shift(); + if (first_block.$style()['$==']("partintro")) { + + + $writer = ["paragraph"]; + $send(first_block, 'context=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = [nil]; + $send(first_block, 'style=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];;}; + intro['$<<'](first_block); + section.$blocks()['$<<'](intro);};}}; + ($truthy($b = intro) ? $b : section).$blocks()['$<<'](new_block); + attributes = $hash2([], {});}; + }; + if ($truthy($b = reader.$skip_blank_lines())) { + $b + } else { + break; + }; + }; + if ($truthy(part)) { + if ($truthy(($truthy($a = section['$blocks?']()) ? section.$blocks()['$[]'](-1).$context()['$==']("section") : $a))) { + } else { + self.$logger().$error(self.$message_with_context("invalid part, must have at least one section (e.g., chapter, appendix, etc.)", $hash2(["source_location"], {"source_location": reader.$cursor()}))) + } + } else if ($truthy(preamble)) { + if ($truthy(preamble['$blocks?']())) { + if ($truthy(($truthy($a = ($truthy($b = book) ? $b : document.$blocks()['$[]'](1))) ? $a : $$($nesting, 'Compliance').$unwrap_standalone_preamble()['$!']()))) { + } else { + + document.$blocks().$shift(); + while ($truthy((child_block = preamble.$blocks().$shift()))) { + document['$<<'](child_block) + }; + } + } else { + document.$blocks().$shift() + }}; + return [(function() {if ($truthy(section['$!='](parent))) { + return section + } else { + return nil + }; return nil; })(), attributes.$dup()]; + }, TMP_Parser_next_section_9.$$arity = -3); + Opal.defs(self, '$next_block', TMP_Parser_next_block_10 = function $$next_block(reader, parent, attributes, options) {try { + + var $a, $b, $c, TMP_11, $d, TMP_12, TMP_13, self = this, skipped = nil, text_only = nil, document = nil, extensions = nil, block_extensions = nil, block_macro_extensions = nil, this_line = nil, doc_attrs = nil, style = nil, block = nil, block_context = nil, cloaked_context = nil, terminator = nil, delimited_block = nil, $writer = nil, indented = nil, md_syntax = nil, ch0 = nil, layout_break_chars = nil, ll = nil, blk_ctx = nil, target = nil, blk_attrs = nil, $case = nil, posattrs = nil, scaledwidth = nil, extension = nil, content = nil, default_attrs = nil, match = nil, float_id = nil, float_reftext = nil, float_title = nil, float_level = nil, lines = nil, in_list = nil, admonition_name = nil, credit_line = nil, attribution = nil, citetitle = nil, language = nil, comma_idx = nil, block_cursor = nil, block_reader = nil, content_model = nil, pos_attrs = nil, block_id = nil; + if ($gvars["~"] == null) $gvars["~"] = nil; + + + + if (attributes == null) { + attributes = $hash2([], {}); + }; + + if (options == null) { + options = $hash2([], {}); + }; + if ($truthy((skipped = reader.$skip_blank_lines()))) { + } else { + return nil + }; + if ($truthy(($truthy($a = (text_only = options['$[]']("text"))) ? $rb_gt(skipped, 0) : $a))) { + + options.$delete("text"); + text_only = false;}; + document = parent.$document(); + if ($truthy(options.$fetch("parse_metadata", true))) { + while ($truthy(self.$parse_block_metadata_line(reader, document, attributes, options))) { + + reader.$shift(); + ($truthy($b = reader.$skip_blank_lines()) ? $b : Opal.ret(nil)); + }}; + if ($truthy((extensions = document.$extensions()))) { + $a = [extensions['$blocks?'](), extensions['$block_macros?']()], (block_extensions = $a[0]), (block_macro_extensions = $a[1]), $a}; + reader.$mark(); + $a = [reader.$read_line(), document.$attributes(), attributes['$[]'](1)], (this_line = $a[0]), (doc_attrs = $a[1]), (style = $a[2]), $a; + block = (block_context = (cloaked_context = (terminator = nil))); + if ($truthy((delimited_block = self['$is_delimited_block?'](this_line, true)))) { + + block_context = (cloaked_context = delimited_block.$context()); + terminator = delimited_block.$terminator(); + if ($truthy(style['$!']())) { + style = (($writer = ["style", block_context.$to_s()]), $send(attributes, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]) + } else if ($truthy(style['$!='](block_context.$to_s()))) { + if ($truthy(delimited_block.$masq()['$include?'](style))) { + block_context = style.$to_sym() + } else if ($truthy(($truthy($a = delimited_block.$masq()['$include?']("admonition")) ? $$($nesting, 'ADMONITION_STYLES')['$include?'](style) : $a))) { + block_context = "admonition" + } else if ($truthy(($truthy($a = block_extensions) ? extensions['$registered_for_block?'](style, block_context) : $a))) { + block_context = style.$to_sym() + } else { + + self.$logger().$warn(self.$message_with_context("" + "invalid style for " + (block_context) + " block: " + (style), $hash2(["source_location"], {"source_location": reader.$cursor_at_mark()}))); + style = block_context.$to_s(); + }};}; + if ($truthy(delimited_block)) { + } else { + while ($truthy(true)) { + + if ($truthy(($truthy($b = ($truthy($c = style) ? $$($nesting, 'Compliance').$strict_verbatim_paragraphs() : $c)) ? $$($nesting, 'VERBATIM_STYLES')['$include?'](style) : $b))) { + + block_context = style.$to_sym(); + reader.$unshift_line(this_line); + break;;}; + if ($truthy(text_only)) { + indented = this_line['$start_with?'](" ", $$($nesting, 'TAB')) + } else { + + md_syntax = $$($nesting, 'Compliance').$markdown_syntax(); + if ($truthy(this_line['$start_with?'](" "))) { + + $b = [true, " "], (indented = $b[0]), (ch0 = $b[1]), $b; + if ($truthy(($truthy($b = ($truthy($c = md_syntax) ? $send(this_line.$lstrip(), 'start_with?', Opal.to_a($$($nesting, 'MARKDOWN_THEMATIC_BREAK_CHARS').$keys())) : $c)) ? $$($nesting, 'MarkdownThematicBreakRx')['$match?'](this_line) : $b))) { + + block = $$($nesting, 'Block').$new(parent, "thematic_break", $hash2(["content_model"], {"content_model": "empty"})); + break;;}; + } else if ($truthy(this_line['$start_with?']($$($nesting, 'TAB')))) { + $b = [true, $$($nesting, 'TAB')], (indented = $b[0]), (ch0 = $b[1]), $b + } else { + + $b = [false, this_line.$chr()], (indented = $b[0]), (ch0 = $b[1]), $b; + layout_break_chars = (function() {if ($truthy(md_syntax)) { + return $$($nesting, 'HYBRID_LAYOUT_BREAK_CHARS') + } else { + return $$($nesting, 'LAYOUT_BREAK_CHARS') + }; return nil; })(); + if ($truthy(($truthy($b = layout_break_chars['$key?'](ch0)) ? (function() {if ($truthy(md_syntax)) { + + return $$($nesting, 'ExtLayoutBreakRx')['$match?'](this_line); + } else { + + return (($c = this_line['$==']($rb_times(ch0, (ll = this_line.$length())))) ? $rb_gt(ll, 2) : this_line['$==']($rb_times(ch0, (ll = this_line.$length())))); + }; return nil; })() : $b))) { + + block = $$($nesting, 'Block').$new(parent, layout_break_chars['$[]'](ch0), $hash2(["content_model"], {"content_model": "empty"})); + break;; + } else if ($truthy(($truthy($b = this_line['$end_with?']("]")) ? this_line['$include?']("::") : $b))) { + if ($truthy(($truthy($b = ($truthy($c = ch0['$==']("i")) ? $c : this_line['$start_with?']("video:", "audio:"))) ? $$($nesting, 'BlockMediaMacroRx')['$=~'](this_line) : $b))) { + + $b = [(($c = $gvars['~']) === nil ? nil : $c['$[]'](1)).$to_sym(), (($c = $gvars['~']) === nil ? nil : $c['$[]'](2)), (($c = $gvars['~']) === nil ? nil : $c['$[]'](3))], (blk_ctx = $b[0]), (target = $b[1]), (blk_attrs = $b[2]), $b; + block = $$($nesting, 'Block').$new(parent, blk_ctx, $hash2(["content_model"], {"content_model": "empty"})); + if ($truthy(blk_attrs)) { + + $case = blk_ctx; + if ("video"['$===']($case)) {posattrs = ["poster", "width", "height"]} + else if ("audio"['$===']($case)) {posattrs = []} + else {posattrs = ["alt", "width", "height"]}; + block.$parse_attributes(blk_attrs, posattrs, $hash2(["sub_input", "into"], {"sub_input": true, "into": attributes}));}; + if ($truthy(attributes['$key?']("style"))) { + attributes.$delete("style")}; + if ($truthy(($truthy($b = target['$include?']($$($nesting, 'ATTR_REF_HEAD'))) ? (target = block.$sub_attributes(target, $hash2(["attribute_missing"], {"attribute_missing": "drop-line"})))['$empty?']() : $b))) { + if (($truthy($b = doc_attrs['$[]']("attribute-missing")) ? $b : $$($nesting, 'Compliance').$attribute_missing())['$==']("skip")) { + return $$($nesting, 'Block').$new(parent, "paragraph", $hash2(["content_model", "source"], {"content_model": "simple", "source": [this_line]})) + } else { + + attributes.$clear(); + return nil; + }}; + if (blk_ctx['$==']("image")) { + + document.$register("images", [target, (($writer = ["imagesdir", doc_attrs['$[]']("imagesdir")]), $send(attributes, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])]); + ($truthy($b = attributes['$[]']("alt")) ? $b : (($writer = ["alt", ($truthy($c = style) ? $c : (($writer = ["default-alt", $$($nesting, 'Helpers').$basename(target, true).$tr("_-", " ")]), $send(attributes, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]))]), $send(attributes, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + if ($truthy((scaledwidth = attributes.$delete("scaledwidth"))['$nil_or_empty?']())) { + } else { + + $writer = ["scaledwidth", (function() {if ($truthy($$($nesting, 'TrailingDigitsRx')['$match?'](scaledwidth))) { + return "" + (scaledwidth) + "%" + } else { + return scaledwidth + }; return nil; })()]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + if ($truthy(attributes['$key?']("title"))) { + + + $writer = [attributes.$delete("title")]; + $send(block, 'title=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + block.$assign_caption(attributes.$delete("caption"), "figure");};}; + + $writer = ["target", target]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + break;; + } else if ($truthy(($truthy($b = (($c = ch0['$==']("t")) ? this_line['$start_with?']("toc:") : ch0['$==']("t"))) ? $$($nesting, 'BlockTocMacroRx')['$=~'](this_line) : $b))) { + + block = $$($nesting, 'Block').$new(parent, "toc", $hash2(["content_model"], {"content_model": "empty"})); + if ($truthy((($b = $gvars['~']) === nil ? nil : $b['$[]'](1)))) { + block.$parse_attributes((($b = $gvars['~']) === nil ? nil : $b['$[]'](1)), [], $hash2(["into"], {"into": attributes}))}; + break;; + } else if ($truthy(($truthy($b = ($truthy($c = block_macro_extensions) ? $$($nesting, 'CustomBlockMacroRx')['$=~'](this_line) : $c)) ? (extension = extensions['$registered_for_block_macro?']((($c = $gvars['~']) === nil ? nil : $c['$[]'](1)))) : $b))) { + + $b = [(($c = $gvars['~']) === nil ? nil : $c['$[]'](2)), (($c = $gvars['~']) === nil ? nil : $c['$[]'](3))], (target = $b[0]), (content = $b[1]), $b; + if ($truthy(($truthy($b = ($truthy($c = target['$include?']($$($nesting, 'ATTR_REF_HEAD'))) ? (target = parent.$sub_attributes(target))['$empty?']() : $c)) ? ($truthy($c = doc_attrs['$[]']("attribute-missing")) ? $c : $$($nesting, 'Compliance').$attribute_missing())['$==']("drop-line") : $b))) { + + attributes.$clear(); + return nil;}; + if (extension.$config()['$[]']("content_model")['$==']("attributes")) { + if ($truthy(content)) { + document.$parse_attributes(content, ($truthy($b = extension.$config()['$[]']("pos_attrs")) ? $b : []), $hash2(["sub_input", "into"], {"sub_input": true, "into": attributes}))} + } else { + + $writer = ["text", ($truthy($b = content) ? $b : "")]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + if ($truthy((default_attrs = extension.$config()['$[]']("default_attrs")))) { + $send(attributes, 'update', [default_attrs], (TMP_11 = function(_, old_v){var self = TMP_11.$$s || this; + + + + if (_ == null) { + _ = nil; + }; + + if (old_v == null) { + old_v = nil; + }; + return old_v;}, TMP_11.$$s = self, TMP_11.$$arity = 2, TMP_11))}; + if ($truthy((block = extension.$process_method()['$[]'](parent, target, attributes)))) { + + attributes.$replace(block.$attributes()); + break;; + } else { + + attributes.$clear(); + return nil; + };}}; + }; + }; + if ($truthy(($truthy($b = ($truthy($c = indented['$!']()) ? (ch0 = ($truthy($d = ch0) ? $d : this_line.$chr()))['$==']("<") : $c)) ? $$($nesting, 'CalloutListRx')['$=~'](this_line) : $b))) { + + reader.$unshift_line(this_line); + block = self.$parse_callout_list(reader, $gvars["~"], parent, document.$callouts()); + + $writer = ["style", "arabic"]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + break;; + } else if ($truthy($$($nesting, 'UnorderedListRx')['$match?'](this_line))) { + + reader.$unshift_line(this_line); + if ($truthy(($truthy($b = ($truthy($c = style['$!']()) ? $$($nesting, 'Section')['$==='](parent) : $c)) ? parent.$sectname()['$==']("bibliography") : $b))) { + + $writer = ["style", (style = "bibliography")]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + block = self.$parse_list(reader, "ulist", parent, style); + break;; + } else if ($truthy((match = $$($nesting, 'OrderedListRx').$match(this_line)))) { + + reader.$unshift_line(this_line); + block = self.$parse_list(reader, "olist", parent, style); + if ($truthy(block.$style())) { + + $writer = ["style", block.$style()]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + break;; + } else if ($truthy((match = $$($nesting, 'DescriptionListRx').$match(this_line)))) { + + reader.$unshift_line(this_line); + block = self.$parse_description_list(reader, match, parent); + break;; + } else if ($truthy(($truthy($b = ($truthy($c = style['$==']("float")) ? $c : style['$==']("discrete"))) ? (function() {if ($truthy($$($nesting, 'Compliance').$underline_style_section_titles())) { + + return self['$is_section_title?'](this_line, reader.$peek_line()); + } else { + return ($truthy($c = indented['$!']()) ? self['$atx_section_title?'](this_line) : $c) + }; return nil; })() : $b))) { + + reader.$unshift_line(this_line); + $c = self.$parse_section_title(reader, document, attributes['$[]']("id")), $b = Opal.to_ary($c), (float_id = ($b[0] == null ? nil : $b[0])), (float_reftext = ($b[1] == null ? nil : $b[1])), (float_title = ($b[2] == null ? nil : $b[2])), (float_level = ($b[3] == null ? nil : $b[3])), $c; + if ($truthy(float_reftext)) { + + $writer = ["reftext", float_reftext]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + block = $$($nesting, 'Block').$new(parent, "floating_title", $hash2(["content_model"], {"content_model": "empty"})); + + $writer = [float_title]; + $send(block, 'title=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + attributes.$delete("title"); + + $writer = [($truthy($b = float_id) ? $b : (function() {if ($truthy(doc_attrs['$key?']("sectids"))) { + + return $$($nesting, 'Section').$generate_id(block.$title(), document); + } else { + return nil + }; return nil; })())]; + $send(block, 'id=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = [float_level]; + $send(block, 'level=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + break;; + } else if ($truthy(($truthy($b = style) ? style['$!=']("normal") : $b))) { + if ($truthy($$($nesting, 'PARAGRAPH_STYLES')['$include?'](style))) { + + block_context = style.$to_sym(); + cloaked_context = "paragraph"; + reader.$unshift_line(this_line); + break;; + } else if ($truthy($$($nesting, 'ADMONITION_STYLES')['$include?'](style))) { + + block_context = "admonition"; + cloaked_context = "paragraph"; + reader.$unshift_line(this_line); + break;; + } else if ($truthy(($truthy($b = block_extensions) ? extensions['$registered_for_block?'](style, "paragraph") : $b))) { + + block_context = style.$to_sym(); + cloaked_context = "paragraph"; + reader.$unshift_line(this_line); + break;; + } else { + + self.$logger().$warn(self.$message_with_context("" + "invalid style for paragraph: " + (style), $hash2(["source_location"], {"source_location": reader.$cursor_at_mark()}))); + style = nil; + }}; + reader.$unshift_line(this_line); + if ($truthy(($truthy($b = indented) ? style['$!']() : $b))) { + + lines = self.$read_paragraph_lines(reader, ($truthy($b = (in_list = $$($nesting, 'ListItem')['$==='](parent))) ? skipped['$=='](0) : $b), $hash2(["skip_line_comments"], {"skip_line_comments": text_only})); + self['$adjust_indentation!'](lines); + block = $$($nesting, 'Block').$new(parent, "literal", $hash2(["content_model", "source", "attributes"], {"content_model": "verbatim", "source": lines, "attributes": attributes})); + if ($truthy(in_list)) { + block.$set_option("listparagraph")}; + } else { + + lines = self.$read_paragraph_lines(reader, (($b = skipped['$=='](0)) ? $$($nesting, 'ListItem')['$==='](parent) : skipped['$=='](0)), $hash2(["skip_line_comments"], {"skip_line_comments": true})); + if ($truthy(text_only)) { + + if ($truthy(($truthy($b = indented) ? style['$==']("normal") : $b))) { + self['$adjust_indentation!'](lines)}; + block = $$($nesting, 'Block').$new(parent, "paragraph", $hash2(["content_model", "source", "attributes"], {"content_model": "simple", "source": lines, "attributes": attributes})); + } else if ($truthy(($truthy($b = ($truthy($c = $$($nesting, 'ADMONITION_STYLE_HEADS')['$include?'](ch0)) ? this_line['$include?'](":") : $c)) ? $$($nesting, 'AdmonitionParagraphRx')['$=~'](this_line) : $b))) { + + + $writer = [0, (($b = $gvars['~']) === nil ? nil : $b.$post_match())]; + $send(lines, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["name", (admonition_name = (($writer = ["style", (($b = $gvars['~']) === nil ? nil : $b['$[]'](1))]), $send(attributes, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]).$downcase())]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["textlabel", ($truthy($b = attributes.$delete("caption")) ? $b : doc_attrs['$[]']("" + (admonition_name) + "-caption"))]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + block = $$($nesting, 'Block').$new(parent, "admonition", $hash2(["content_model", "source", "attributes"], {"content_model": "simple", "source": lines, "attributes": attributes})); + } else if ($truthy(($truthy($b = ($truthy($c = md_syntax) ? ch0['$=='](">") : $c)) ? this_line['$start_with?']("> ") : $b))) { + + $send(lines, 'map!', [], (TMP_12 = function(line){var self = TMP_12.$$s || this; + + + + if (line == null) { + line = nil; + }; + if (line['$=='](">")) { + + return line.$slice(1, line.$length()); + } else { + + if ($truthy(line['$start_with?']("> "))) { + + return line.$slice(2, line.$length()); + } else { + return line + }; + };}, TMP_12.$$s = self, TMP_12.$$arity = 1, TMP_12)); + if ($truthy(lines['$[]'](-1)['$start_with?']("-- "))) { + + credit_line = (credit_line = lines.$pop()).$slice(3, credit_line.$length()); + while ($truthy(lines['$[]'](-1)['$empty?']())) { + lines.$pop() + };}; + + $writer = ["style", "quote"]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + block = self.$build_block("quote", "compound", false, parent, $$($nesting, 'Reader').$new(lines), attributes); + if ($truthy(credit_line)) { + + $c = block.$apply_subs(credit_line).$split(", ", 2), $b = Opal.to_ary($c), (attribution = ($b[0] == null ? nil : $b[0])), (citetitle = ($b[1] == null ? nil : $b[1])), $c; + if ($truthy(attribution)) { + + $writer = ["attribution", attribution]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if ($truthy(citetitle)) { + + $writer = ["citetitle", citetitle]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];};}; + } else if ($truthy(($truthy($b = ($truthy($c = (($d = ch0['$==']("\"")) ? $rb_gt(lines.$size(), 1) : ch0['$==']("\""))) ? lines['$[]'](-1)['$start_with?']("-- ") : $c)) ? lines['$[]'](-2)['$end_with?']("\"") : $b))) { + + + $writer = [0, this_line.$slice(1, this_line.$length())]; + $send(lines, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + credit_line = (credit_line = lines.$pop()).$slice(3, credit_line.$length()); + while ($truthy(lines['$[]'](-1)['$empty?']())) { + lines.$pop() + }; + lines['$<<'](lines.$pop().$chop()); + + $writer = ["style", "quote"]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + block = $$($nesting, 'Block').$new(parent, "quote", $hash2(["content_model", "source", "attributes"], {"content_model": "simple", "source": lines, "attributes": attributes})); + $c = block.$apply_subs(credit_line).$split(", ", 2), $b = Opal.to_ary($c), (attribution = ($b[0] == null ? nil : $b[0])), (citetitle = ($b[1] == null ? nil : $b[1])), $c; + if ($truthy(attribution)) { + + $writer = ["attribution", attribution]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if ($truthy(citetitle)) { + + $writer = ["citetitle", citetitle]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + } else { + + if ($truthy(($truthy($b = indented) ? style['$==']("normal") : $b))) { + self['$adjust_indentation!'](lines)}; + block = $$($nesting, 'Block').$new(parent, "paragraph", $hash2(["content_model", "source", "attributes"], {"content_model": "simple", "source": lines, "attributes": attributes})); + }; + self.$catalog_inline_anchors(lines.$join($$($nesting, 'LF')), block, document, reader); + }; + break;; + } + }; + if ($truthy(block)) { + } else { + + if ($truthy(($truthy($a = block_context['$==']("abstract")) ? $a : block_context['$==']("partintro")))) { + block_context = "open"}; + $case = block_context; + if ("admonition"['$===']($case)) { + + $writer = ["name", (admonition_name = style.$downcase())]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["textlabel", ($truthy($a = attributes.$delete("caption")) ? $a : doc_attrs['$[]']("" + (admonition_name) + "-caption"))]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + block = self.$build_block(block_context, "compound", terminator, parent, reader, attributes);} + else if ("comment"['$===']($case)) { + self.$build_block(block_context, "skip", terminator, parent, reader, attributes); + attributes.$clear(); + return nil;} + else if ("example"['$===']($case)) {block = self.$build_block(block_context, "compound", terminator, parent, reader, attributes)} + else if ("listing"['$===']($case) || "literal"['$===']($case)) {block = self.$build_block(block_context, "verbatim", terminator, parent, reader, attributes)} + else if ("source"['$===']($case)) { + $$($nesting, 'AttributeList').$rekey(attributes, [nil, "language", "linenums"]); + if ($truthy(attributes['$key?']("language"))) { + } else if ($truthy(doc_attrs['$key?']("source-language"))) { + + $writer = ["language", ($truthy($a = doc_attrs['$[]']("source-language")) ? $a : "text")]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if ($truthy(attributes['$key?']("linenums"))) { + } else if ($truthy(($truthy($a = attributes['$key?']("linenums-option")) ? $a : doc_attrs['$key?']("source-linenums-option")))) { + + $writer = ["linenums", ""]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if ($truthy(attributes['$key?']("indent"))) { + } else if ($truthy(doc_attrs['$key?']("source-indent"))) { + + $writer = ["indent", doc_attrs['$[]']("source-indent")]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + block = self.$build_block("listing", "verbatim", terminator, parent, reader, attributes);} + else if ("fenced_code"['$===']($case)) { + + $writer = ["style", "source"]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + if ((ll = this_line.$length())['$=='](3)) { + language = nil + } else if ($truthy((comma_idx = (language = this_line.$slice(3, ll)).$index(",")))) { + if ($truthy($rb_gt(comma_idx, 0))) { + + language = language.$slice(0, comma_idx).$strip(); + if ($truthy($rb_lt(comma_idx, $rb_minus(ll, 4)))) { + + $writer = ["linenums", ""]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + } else { + + language = nil; + if ($truthy($rb_gt(ll, 4))) { + + $writer = ["linenums", ""]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + } + } else { + language = language.$lstrip() + }; + if ($truthy(language['$nil_or_empty?']())) { + if ($truthy(doc_attrs['$key?']("source-language"))) { + + $writer = ["language", ($truthy($a = doc_attrs['$[]']("source-language")) ? $a : "text")]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];} + } else { + + $writer = ["language", language]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + if ($truthy(attributes['$key?']("linenums"))) { + } else if ($truthy(($truthy($a = attributes['$key?']("linenums-option")) ? $a : doc_attrs['$key?']("source-linenums-option")))) { + + $writer = ["linenums", ""]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if ($truthy(attributes['$key?']("indent"))) { + } else if ($truthy(doc_attrs['$key?']("source-indent"))) { + + $writer = ["indent", doc_attrs['$[]']("source-indent")]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + terminator = terminator.$slice(0, 3); + block = self.$build_block("listing", "verbatim", terminator, parent, reader, attributes);} + else if ("pass"['$===']($case)) {block = self.$build_block(block_context, "raw", terminator, parent, reader, attributes)} + else if ("stem"['$===']($case) || "latexmath"['$===']($case) || "asciimath"['$===']($case)) { + if (block_context['$==']("stem")) { + + $writer = ["style", $$($nesting, 'STEM_TYPE_ALIASES')['$[]'](($truthy($a = attributes['$[]'](2)) ? $a : doc_attrs['$[]']("stem")))]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + block = self.$build_block("stem", "raw", terminator, parent, reader, attributes);} + else if ("open"['$===']($case) || "sidebar"['$===']($case)) {block = self.$build_block(block_context, "compound", terminator, parent, reader, attributes)} + else if ("table"['$===']($case)) { + block_cursor = reader.$cursor(); + block_reader = $$($nesting, 'Reader').$new(reader.$read_lines_until($hash2(["terminator", "skip_line_comments", "context", "cursor"], {"terminator": terminator, "skip_line_comments": true, "context": "table", "cursor": "at_mark"})), block_cursor); + if ($truthy(terminator['$start_with?']("|", "!"))) { + } else { + ($truthy($a = attributes['$[]']("format")) ? $a : (($writer = ["format", (function() {if ($truthy(terminator['$start_with?'](","))) { + return "csv" + } else { + return "dsv" + }; return nil; })()]), $send(attributes, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])) + }; + block = self.$parse_table(block_reader, parent, attributes);} + else if ("quote"['$===']($case) || "verse"['$===']($case)) { + $$($nesting, 'AttributeList').$rekey(attributes, [nil, "attribution", "citetitle"]); + block = self.$build_block(block_context, (function() {if (block_context['$==']("verse")) { + return "verbatim" + } else { + return "compound" + }; return nil; })(), terminator, parent, reader, attributes);} + else {if ($truthy(($truthy($a = block_extensions) ? (extension = extensions['$registered_for_block?'](block_context, cloaked_context)) : $a))) { + + if ($truthy((content_model = extension.$config()['$[]']("content_model"))['$!=']("skip"))) { + + if ($truthy((pos_attrs = ($truthy($a = extension.$config()['$[]']("pos_attrs")) ? $a : []))['$empty?']()['$!']())) { + $$($nesting, 'AttributeList').$rekey(attributes, [nil].$concat(pos_attrs))}; + if ($truthy((default_attrs = extension.$config()['$[]']("default_attrs")))) { + $send(default_attrs, 'each', [], (TMP_13 = function(k, v){var self = TMP_13.$$s || this, $e; + + + + if (k == null) { + k = nil; + }; + + if (v == null) { + v = nil; + }; + return ($truthy($e = attributes['$[]'](k)) ? $e : (($writer = [k, v]), $send(attributes, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]));}, TMP_13.$$s = self, TMP_13.$$arity = 2, TMP_13))}; + + $writer = ["cloaked-context", cloaked_context]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];;}; + block = self.$build_block(block_context, content_model, terminator, parent, reader, attributes, $hash2(["extension"], {"extension": extension})); + if ($truthy(block)) { + } else { + + attributes.$clear(); + return nil; + }; + } else { + self.$raise("" + "Unsupported block type " + (block_context) + " at " + (reader.$cursor())) + }}; + }; + if ($truthy(document.$sourcemap())) { + + $writer = [reader.$cursor_at_mark()]; + $send(block, 'source_location=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if ($truthy(attributes['$key?']("title"))) { + + $writer = [attributes.$delete("title")]; + $send(block, 'title=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + + $writer = [attributes['$[]']("style")]; + $send(block, 'style=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + if ($truthy((block_id = ($truthy($a = block.$id()) ? $a : (($writer = [attributes['$[]']("id")]), $send(block, 'id=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]))))) { + if ($truthy(document.$register("refs", [block_id, block, ($truthy($a = attributes['$[]']("reftext")) ? $a : (function() {if ($truthy(block['$title?']())) { + return block.$title() + } else { + return nil + }; return nil; })())]))) { + } else { + self.$logger().$warn(self.$message_with_context("" + "id assigned to block already in use: " + (block_id), $hash2(["source_location"], {"source_location": reader.$cursor_at_mark()}))) + }}; + if ($truthy(attributes['$empty?']())) { + } else { + block.$attributes().$update(attributes) + }; + block.$lock_in_subs(); + if ($truthy(block['$sub?']("callouts"))) { + if ($truthy(self.$catalog_callouts(block.$source(), document))) { + } else { + block.$remove_sub("callouts") + }}; + return block; + } catch ($returner) { if ($returner === Opal.returner) { return $returner.$v } throw $returner; } + }, TMP_Parser_next_block_10.$$arity = -3); + Opal.defs(self, '$read_paragraph_lines', TMP_Parser_read_paragraph_lines_14 = function $$read_paragraph_lines(reader, break_at_list, opts) { + var self = this, $writer = nil, break_condition = nil; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + + $writer = ["break_on_blank_lines", true]; + $send(opts, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["break_on_list_continuation", true]; + $send(opts, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["preserve_last_line", true]; + $send(opts, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + break_condition = (function() {if ($truthy(break_at_list)) { + + if ($truthy($$($nesting, 'Compliance').$block_terminates_paragraph())) { + return $$($nesting, 'StartOfBlockOrListProc') + } else { + return $$($nesting, 'StartOfListProc') + }; + } else { + + if ($truthy($$($nesting, 'Compliance').$block_terminates_paragraph())) { + return $$($nesting, 'StartOfBlockProc') + } else { + return $$($nesting, 'NoOp') + }; + }; return nil; })(); + return $send(reader, 'read_lines_until', [opts], break_condition.$to_proc()); + }, TMP_Parser_read_paragraph_lines_14.$$arity = -3); + Opal.defs(self, '$is_delimited_block?', TMP_Parser_is_delimited_block$q_15 = function(line, return_match_data) { + var $a, $b, self = this, line_len = nil, tip = nil, tl = nil, fenced_code = nil, tip_3 = nil, context = nil, masq = nil; + + + + if (return_match_data == null) { + return_match_data = false; + }; + if ($truthy(($truthy($a = $rb_gt((line_len = line.$length()), 1)) ? $$($nesting, 'DELIMITED_BLOCK_HEADS')['$include?'](line.$slice(0, 2)) : $a))) { + } else { + return nil + }; + if (line_len['$=='](2)) { + + tip = line; + tl = 2; + } else { + + if ($truthy($rb_le(line_len, 4))) { + + tip = line; + tl = line_len; + } else { + + tip = line.$slice(0, 4); + tl = 4; + }; + fenced_code = false; + if ($truthy($$($nesting, 'Compliance').$markdown_syntax())) { + + tip_3 = (function() {if (tl['$=='](4)) { + return tip.$chop() + } else { + return tip + }; return nil; })(); + if (tip_3['$==']("```")) { + + if ($truthy((($a = tl['$=='](4)) ? tip['$end_with?']("`") : tl['$=='](4)))) { + return nil}; + tip = tip_3; + tl = 3; + fenced_code = true;};}; + if ($truthy((($a = tl['$=='](3)) ? fenced_code['$!']() : tl['$=='](3)))) { + return nil}; + }; + if ($truthy($$($nesting, 'DELIMITED_BLOCKS')['$key?'](tip))) { + if ($truthy(($truthy($a = $rb_lt(tl, 4)) ? $a : tl['$=='](line_len)))) { + if ($truthy(return_match_data)) { + + $b = $$($nesting, 'DELIMITED_BLOCKS')['$[]'](tip), $a = Opal.to_ary($b), (context = ($a[0] == null ? nil : $a[0])), (masq = ($a[1] == null ? nil : $a[1])), $b; + return $$($nesting, 'BlockMatchData').$new(context, masq, tip, tip); + } else { + return true + } + } else if ((("" + (tip)) + ($rb_times(tip.$slice(-1, 1), $rb_minus(line_len, tl))))['$=='](line)) { + if ($truthy(return_match_data)) { + + $b = $$($nesting, 'DELIMITED_BLOCKS')['$[]'](tip), $a = Opal.to_ary($b), (context = ($a[0] == null ? nil : $a[0])), (masq = ($a[1] == null ? nil : $a[1])), $b; + return $$($nesting, 'BlockMatchData').$new(context, masq, tip, line); + } else { + return true + } + } else { + return nil + } + } else { + return nil + }; + }, TMP_Parser_is_delimited_block$q_15.$$arity = -2); + Opal.defs(self, '$build_block', TMP_Parser_build_block_16 = function $$build_block(block_context, content_model, terminator, parent, reader, attributes, options) { + var $a, $b, self = this, skip_processing = nil, parse_as_content_model = nil, lines = nil, block_reader = nil, block_cursor = nil, indent = nil, tab_size = nil, extension = nil, block = nil, $writer = nil; + + + + if (options == null) { + options = $hash2([], {}); + }; + if (content_model['$==']("skip")) { + $a = [true, "simple"], (skip_processing = $a[0]), (parse_as_content_model = $a[1]), $a + } else if (content_model['$==']("raw")) { + $a = [false, "simple"], (skip_processing = $a[0]), (parse_as_content_model = $a[1]), $a + } else { + $a = [false, content_model], (skip_processing = $a[0]), (parse_as_content_model = $a[1]), $a + }; + if ($truthy(terminator['$nil?']())) { + + if (parse_as_content_model['$==']("verbatim")) { + lines = reader.$read_lines_until($hash2(["break_on_blank_lines", "break_on_list_continuation"], {"break_on_blank_lines": true, "break_on_list_continuation": true})) + } else { + + if (content_model['$==']("compound")) { + content_model = "simple"}; + lines = self.$read_paragraph_lines(reader, false, $hash2(["skip_line_comments", "skip_processing"], {"skip_line_comments": true, "skip_processing": skip_processing})); + }; + block_reader = nil; + } else if ($truthy(parse_as_content_model['$!=']("compound"))) { + + lines = reader.$read_lines_until($hash2(["terminator", "skip_processing", "context", "cursor"], {"terminator": terminator, "skip_processing": skip_processing, "context": block_context, "cursor": "at_mark"})); + block_reader = nil; + } else if (terminator['$=='](false)) { + + lines = nil; + block_reader = reader; + } else { + + lines = nil; + block_cursor = reader.$cursor(); + block_reader = $$($nesting, 'Reader').$new(reader.$read_lines_until($hash2(["terminator", "skip_processing", "context", "cursor"], {"terminator": terminator, "skip_processing": skip_processing, "context": block_context, "cursor": "at_mark"})), block_cursor); + }; + if (content_model['$==']("verbatim")) { + if ($truthy((indent = attributes['$[]']("indent")))) { + self['$adjust_indentation!'](lines, indent, ($truthy($a = attributes['$[]']("tabsize")) ? $a : parent.$document().$attributes()['$[]']("tabsize"))) + } else if ($truthy($rb_gt((tab_size = ($truthy($a = attributes['$[]']("tabsize")) ? $a : parent.$document().$attributes()['$[]']("tabsize")).$to_i()), 0))) { + self['$adjust_indentation!'](lines, nil, tab_size)} + } else if (content_model['$==']("skip")) { + return nil}; + if ($truthy((extension = options['$[]']("extension")))) { + + attributes.$delete("style"); + if ($truthy((block = extension.$process_method()['$[]'](parent, ($truthy($a = block_reader) ? $a : $$($nesting, 'Reader').$new(lines)), attributes.$dup())))) { + + attributes.$replace(block.$attributes()); + if ($truthy((($a = block.$content_model()['$==']("compound")) ? (lines = block.$lines())['$nil_or_empty?']()['$!']() : block.$content_model()['$==']("compound")))) { + + content_model = "compound"; + block_reader = $$($nesting, 'Reader').$new(lines);}; + } else { + return nil + }; + } else { + block = $$($nesting, 'Block').$new(parent, block_context, $hash2(["content_model", "source", "attributes"], {"content_model": content_model, "source": lines, "attributes": attributes})) + }; + if ($truthy(($truthy($a = ($truthy($b = attributes['$key?']("title")) ? block.$context()['$!=']("admonition") : $b)) ? parent.$document().$attributes()['$key?']("" + (block.$context()) + "-caption") : $a))) { + + + $writer = [attributes.$delete("title")]; + $send(block, 'title=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + block.$assign_caption(attributes.$delete("caption"));}; + if (content_model['$==']("compound")) { + self.$parse_blocks(block_reader, block)}; + return block; + }, TMP_Parser_build_block_16.$$arity = -7); + Opal.defs(self, '$parse_blocks', TMP_Parser_parse_blocks_17 = function $$parse_blocks(reader, parent) { + var $a, $b, $c, self = this, block = nil; + + while ($truthy(($truthy($b = ($truthy($c = (block = self.$next_block(reader, parent))) ? parent.$blocks()['$<<'](block) : $c)) ? $b : reader['$has_more_lines?']()))) { + + } + }, TMP_Parser_parse_blocks_17.$$arity = 2); + Opal.defs(self, '$parse_list', TMP_Parser_parse_list_18 = function $$parse_list(reader, list_type, parent, style) { + var $a, $b, $c, self = this, list_block = nil, list_rx = nil, list_item = nil; + if ($gvars["~"] == null) $gvars["~"] = nil; + + + list_block = $$($nesting, 'List').$new(parent, list_type); + while ($truthy(($truthy($b = reader['$has_more_lines?']()) ? (list_rx = ($truthy($c = list_rx) ? $c : $$($nesting, 'ListRxMap')['$[]'](list_type)))['$=~'](reader.$peek_line()) : $b))) { + + if ($truthy((list_item = self.$parse_list_item(reader, list_block, $gvars["~"], (($b = $gvars['~']) === nil ? nil : $b['$[]'](1)), style)))) { + list_block.$items()['$<<'](list_item)}; + if ($truthy($b = reader.$skip_blank_lines())) { + $b + } else { + break; + }; + }; + return list_block; + }, TMP_Parser_parse_list_18.$$arity = 4); + Opal.defs(self, '$catalog_callouts', TMP_Parser_catalog_callouts_19 = function $$catalog_callouts(text, document) { + var TMP_20, self = this, found = nil, autonum = nil; + + + found = false; + autonum = 0; + if ($truthy(text['$include?']("<"))) { + $send(text, 'scan', [$$($nesting, 'CalloutScanRx')], (TMP_20 = function(){var self = TMP_20.$$s || this, $a, $b, captured = nil, num = nil; + + + $a = [(($b = $gvars['~']) === nil ? nil : $b['$[]'](0)), (($b = $gvars['~']) === nil ? nil : $b['$[]'](2))], (captured = $a[0]), (num = $a[1]), $a; + if ($truthy(captured['$start_with?']("\\"))) { + } else { + document.$callouts().$register((function() {if (num['$=='](".")) { + return (autonum = $rb_plus(autonum, 1)).$to_s() + } else { + return num + }; return nil; })()) + }; + return (found = true);}, TMP_20.$$s = self, TMP_20.$$arity = 0, TMP_20))}; + return found; + }, TMP_Parser_catalog_callouts_19.$$arity = 2); + Opal.defs(self, '$catalog_inline_anchor', TMP_Parser_catalog_inline_anchor_21 = function $$catalog_inline_anchor(id, reftext, node, location, doc) { + var $a, self = this; + + + + if (doc == null) { + doc = nil; + }; + doc = ($truthy($a = doc) ? $a : node.$document()); + if ($truthy(($truthy($a = reftext) ? reftext['$include?']($$($nesting, 'ATTR_REF_HEAD')) : $a))) { + reftext = doc.$sub_attributes(reftext)}; + if ($truthy(doc.$register("refs", [id, $$($nesting, 'Inline').$new(node, "anchor", reftext, $hash2(["type", "id"], {"type": "ref", "id": id})), reftext]))) { + } else { + + if ($truthy($$($nesting, 'Reader')['$==='](location))) { + location = location.$cursor()}; + self.$logger().$warn(self.$message_with_context("" + "id assigned to anchor already in use: " + (id), $hash2(["source_location"], {"source_location": location}))); + }; + return nil; + }, TMP_Parser_catalog_inline_anchor_21.$$arity = -5); + Opal.defs(self, '$catalog_inline_anchors', TMP_Parser_catalog_inline_anchors_22 = function $$catalog_inline_anchors(text, block, document, reader) { + var $a, TMP_23, self = this; + + + if ($truthy(($truthy($a = text['$include?']("[[")) ? $a : text['$include?']("or:")))) { + $send(text, 'scan', [$$($nesting, 'InlineAnchorScanRx')], (TMP_23 = function(){var self = TMP_23.$$s || this, $b, m = nil, id = nil, reftext = nil, location = nil, offset = nil; + if ($gvars["~"] == null) $gvars["~"] = nil; + + + m = $gvars["~"]; + if ($truthy((id = (($b = $gvars['~']) === nil ? nil : $b['$[]'](1))))) { + if ($truthy((reftext = (($b = $gvars['~']) === nil ? nil : $b['$[]'](2))))) { + if ($truthy(($truthy($b = reftext['$include?']($$($nesting, 'ATTR_REF_HEAD'))) ? (reftext = document.$sub_attributes(reftext))['$empty?']() : $b))) { + return nil;}} + } else { + + id = (($b = $gvars['~']) === nil ? nil : $b['$[]'](3)); + if ($truthy((reftext = (($b = $gvars['~']) === nil ? nil : $b['$[]'](4))))) { + + if ($truthy(reftext['$include?']("]"))) { + reftext = reftext.$gsub("\\]", "]")}; + if ($truthy(($truthy($b = reftext['$include?']($$($nesting, 'ATTR_REF_HEAD'))) ? (reftext = document.$sub_attributes(reftext))['$empty?']() : $b))) { + return nil;};}; + }; + if ($truthy(document.$register("refs", [id, $$($nesting, 'Inline').$new(block, "anchor", reftext, $hash2(["type", "id"], {"type": "ref", "id": id})), reftext]))) { + return nil + } else { + + location = reader.$cursor_at_mark(); + if ($truthy($rb_gt((offset = $rb_plus(m.$pre_match().$count($$($nesting, 'LF')), (function() {if ($truthy(m['$[]'](0)['$start_with?']($$($nesting, 'LF')))) { + return 1 + } else { + return 0 + }; return nil; })())), 0))) { + (location = location.$dup()).$advance(offset)}; + return self.$logger().$warn(self.$message_with_context("" + "id assigned to anchor already in use: " + (id), $hash2(["source_location"], {"source_location": location}))); + };}, TMP_23.$$s = self, TMP_23.$$arity = 0, TMP_23))}; + return nil; + }, TMP_Parser_catalog_inline_anchors_22.$$arity = 4); + Opal.defs(self, '$catalog_inline_biblio_anchor', TMP_Parser_catalog_inline_biblio_anchor_24 = function $$catalog_inline_biblio_anchor(id, reftext, node, reader) { + var $a, self = this, styled_reftext = nil; + + + if ($truthy(node.$document().$register("refs", [id, $$($nesting, 'Inline').$new(node, "anchor", (styled_reftext = "" + "[" + (($truthy($a = reftext) ? $a : id)) + "]"), $hash2(["type", "id"], {"type": "bibref", "id": id})), styled_reftext]))) { + } else { + self.$logger().$warn(self.$message_with_context("" + "id assigned to bibliography anchor already in use: " + (id), $hash2(["source_location"], {"source_location": reader.$cursor()}))) + }; + return nil; + }, TMP_Parser_catalog_inline_biblio_anchor_24.$$arity = 4); + Opal.defs(self, '$parse_description_list', TMP_Parser_parse_description_list_25 = function $$parse_description_list(reader, match, parent) { + var $a, $b, $c, self = this, list_block = nil, previous_pair = nil, sibling_pattern = nil, term = nil, item = nil, $writer = nil; + + + list_block = $$($nesting, 'List').$new(parent, "dlist"); + previous_pair = nil; + sibling_pattern = $$($nesting, 'DescriptionListSiblingRx')['$[]'](match['$[]'](2)); + while ($truthy(($truthy($b = match) ? $b : ($truthy($c = reader['$has_more_lines?']()) ? (match = sibling_pattern.$match(reader.$peek_line())) : $c)))) { + + $c = self.$parse_list_item(reader, list_block, match, sibling_pattern), $b = Opal.to_ary($c), (term = ($b[0] == null ? nil : $b[0])), (item = ($b[1] == null ? nil : $b[1])), $c; + if ($truthy(($truthy($b = previous_pair) ? previous_pair['$[]'](1)['$!']() : $b))) { + + previous_pair['$[]'](0)['$<<'](term); + + $writer = [1, item]; + $send(previous_pair, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + } else { + list_block.$items()['$<<']((previous_pair = [[term], item])) + }; + match = nil; + }; + return list_block; + }, TMP_Parser_parse_description_list_25.$$arity = 3); + Opal.defs(self, '$parse_callout_list', TMP_Parser_parse_callout_list_26 = function $$parse_callout_list(reader, match, parent, callouts) { + var $a, $b, $c, self = this, list_block = nil, next_index = nil, autonum = nil, num = nil, list_item = nil, coids = nil, $writer = nil; + + + list_block = $$($nesting, 'List').$new(parent, "colist"); + next_index = 1; + autonum = 0; + while ($truthy(($truthy($b = match) ? $b : ($truthy($c = (match = $$($nesting, 'CalloutListRx').$match(reader.$peek_line()))) ? reader.$mark() : $c)))) { + + if ((num = match['$[]'](1))['$=='](".")) { + num = (autonum = $rb_plus(autonum, 1)).$to_s()}; + if (num['$=='](next_index.$to_s())) { + } else { + self.$logger().$warn(self.$message_with_context("" + "callout list item index: expected " + (next_index) + ", got " + (num), $hash2(["source_location"], {"source_location": reader.$cursor_at_mark()}))) + }; + if ($truthy((list_item = self.$parse_list_item(reader, list_block, match, "<1>")))) { + + list_block.$items()['$<<'](list_item); + if ($truthy((coids = callouts.$callout_ids(list_block.$items().$size()))['$empty?']())) { + self.$logger().$warn(self.$message_with_context("" + "no callout found for <" + (list_block.$items().$size()) + ">", $hash2(["source_location"], {"source_location": reader.$cursor_at_mark()}))) + } else { + + $writer = ["coids", coids]; + $send(list_item.$attributes(), '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + };}; + next_index = $rb_plus(next_index, 1); + match = nil; + }; + callouts.$next_list(); + return list_block; + }, TMP_Parser_parse_callout_list_26.$$arity = 4); + Opal.defs(self, '$parse_list_item', TMP_Parser_parse_list_item_27 = function $$parse_list_item(reader, list_block, match, sibling_trait, style) { + var $a, $b, self = this, list_type = nil, dlist = nil, list_term = nil, term_text = nil, item_text = nil, has_text = nil, list_item = nil, $writer = nil, sourcemap_assignment_deferred = nil, ordinal = nil, implicit_style = nil, block_cursor = nil, list_item_reader = nil, comment_lines = nil, subsequent_line = nil, continuation_connects_first_block = nil, content_adjacent = nil, block = nil; + + + + if (style == null) { + style = nil; + }; + if ((list_type = list_block.$context())['$==']("dlist")) { + + dlist = true; + list_term = $$($nesting, 'ListItem').$new(list_block, (term_text = match['$[]'](1))); + if ($truthy(($truthy($a = term_text['$start_with?']("[[")) ? $$($nesting, 'LeadingInlineAnchorRx')['$=~'](term_text) : $a))) { + self.$catalog_inline_anchor((($a = $gvars['~']) === nil ? nil : $a['$[]'](1)), ($truthy($a = (($b = $gvars['~']) === nil ? nil : $b['$[]'](2))) ? $a : (($b = $gvars['~']) === nil ? nil : $b.$post_match()).$lstrip()), list_term, reader)}; + if ($truthy((item_text = match['$[]'](3)))) { + has_text = true}; + list_item = $$($nesting, 'ListItem').$new(list_block, item_text); + if ($truthy(list_block.$document().$sourcemap())) { + + + $writer = [reader.$cursor()]; + $send(list_term, 'source_location=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + if ($truthy(has_text)) { + + $writer = [list_term.$source_location()]; + $send(list_item, 'source_location=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + } else { + sourcemap_assignment_deferred = true + };}; + } else { + + has_text = true; + list_item = $$($nesting, 'ListItem').$new(list_block, (item_text = match['$[]'](2))); + if ($truthy(list_block.$document().$sourcemap())) { + + $writer = [reader.$cursor()]; + $send(list_item, 'source_location=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if (list_type['$==']("ulist")) { + + + $writer = [sibling_trait]; + $send(list_item, 'marker=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + if ($truthy(item_text['$start_with?']("["))) { + if ($truthy(($truthy($a = style) ? style['$==']("bibliography") : $a))) { + if ($truthy($$($nesting, 'InlineBiblioAnchorRx')['$=~'](item_text))) { + self.$catalog_inline_biblio_anchor((($a = $gvars['~']) === nil ? nil : $a['$[]'](1)), (($a = $gvars['~']) === nil ? nil : $a['$[]'](2)), list_item, reader)} + } else if ($truthy(item_text['$start_with?']("[["))) { + if ($truthy($$($nesting, 'LeadingInlineAnchorRx')['$=~'](item_text))) { + self.$catalog_inline_anchor((($a = $gvars['~']) === nil ? nil : $a['$[]'](1)), (($a = $gvars['~']) === nil ? nil : $a['$[]'](2)), list_item, reader)} + } else if ($truthy(item_text['$start_with?']("[ ] ", "[x] ", "[*] "))) { + + + $writer = ["checklist-option", ""]; + $send(list_block.$attributes(), '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["checkbox", ""]; + $send(list_item.$attributes(), '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + if ($truthy(item_text['$start_with?']("[ "))) { + } else { + + $writer = ["checked", ""]; + $send(list_item.$attributes(), '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + + $writer = [item_text.$slice(4, item_text.$length())]; + $send(list_item, 'text=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];;}}; + } else if (list_type['$==']("olist")) { + + $b = self.$resolve_ordered_list_marker(sibling_trait, (ordinal = list_block.$items().$size()), true, reader), $a = Opal.to_ary($b), (sibling_trait = ($a[0] == null ? nil : $a[0])), (implicit_style = ($a[1] == null ? nil : $a[1])), $b; + + $writer = [sibling_trait]; + $send(list_item, 'marker=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + if ($truthy((($a = ordinal['$=='](0)) ? style['$!']() : ordinal['$=='](0)))) { + + $writer = [($truthy($a = implicit_style) ? $a : ($truthy($b = $$($nesting, 'ORDERED_LIST_STYLES')['$[]']($rb_minus(sibling_trait.$length(), 1))) ? $b : "arabic").$to_s())]; + $send(list_block, 'style=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if ($truthy(($truthy($a = item_text['$start_with?']("[[")) ? $$($nesting, 'LeadingInlineAnchorRx')['$=~'](item_text) : $a))) { + self.$catalog_inline_anchor((($a = $gvars['~']) === nil ? nil : $a['$[]'](1)), (($a = $gvars['~']) === nil ? nil : $a['$[]'](2)), list_item, reader)}; + } else { + + $writer = [sibling_trait]; + $send(list_item, 'marker=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + }; + reader.$shift(); + block_cursor = reader.$cursor(); + list_item_reader = $$($nesting, 'Reader').$new(self.$read_lines_for_list_item(reader, list_type, sibling_trait, has_text), block_cursor); + if ($truthy(list_item_reader['$has_more_lines?']())) { + + if ($truthy(sourcemap_assignment_deferred)) { + + $writer = [block_cursor]; + $send(list_item, 'source_location=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + comment_lines = list_item_reader.$skip_line_comments(); + if ($truthy((subsequent_line = list_item_reader.$peek_line()))) { + + if ($truthy(comment_lines['$empty?']())) { + } else { + list_item_reader.$unshift_lines(comment_lines) + }; + if ($truthy((continuation_connects_first_block = subsequent_line['$empty?']()))) { + content_adjacent = false + } else { + + content_adjacent = true; + if ($truthy(dlist)) { + } else { + has_text = nil + }; + }; + } else { + + continuation_connects_first_block = false; + content_adjacent = false; + }; + if ($truthy((block = self.$next_block(list_item_reader, list_item, $hash2([], {}), $hash2(["text"], {"text": has_text['$!']()}))))) { + list_item.$blocks()['$<<'](block)}; + while ($truthy(list_item_reader['$has_more_lines?']())) { + if ($truthy((block = self.$next_block(list_item_reader, list_item)))) { + list_item.$blocks()['$<<'](block)} + }; + list_item.$fold_first(continuation_connects_first_block, content_adjacent);}; + if ($truthy(dlist)) { + if ($truthy(($truthy($a = list_item['$text?']()) ? $a : list_item['$blocks?']()))) { + return [list_term, list_item] + } else { + return [list_term] + } + } else { + return list_item + }; + }, TMP_Parser_parse_list_item_27.$$arity = -5); + Opal.defs(self, '$read_lines_for_list_item', TMP_Parser_read_lines_for_list_item_28 = function $$read_lines_for_list_item(reader, list_type, sibling_trait, has_text) { + var $a, $b, $c, TMP_29, TMP_30, TMP_31, TMP_32, TMP_33, self = this, buffer = nil, continuation = nil, within_nested_list = nil, detached_continuation = nil, this_line = nil, prev_line = nil, $writer = nil, match = nil, nested_list_type = nil; + + + + if (sibling_trait == null) { + sibling_trait = nil; + }; + + if (has_text == null) { + has_text = true; + }; + buffer = []; + continuation = "inactive"; + within_nested_list = false; + detached_continuation = nil; + while ($truthy(reader['$has_more_lines?']())) { + + this_line = reader.$read_line(); + if ($truthy(self['$is_sibling_list_item?'](this_line, list_type, sibling_trait))) { + break;}; + prev_line = (function() {if ($truthy(buffer['$empty?']())) { + return nil + } else { + return buffer['$[]'](-1) + }; return nil; })(); + if (prev_line['$==']($$($nesting, 'LIST_CONTINUATION'))) { + + if (continuation['$==']("inactive")) { + + continuation = "active"; + has_text = true; + if ($truthy(within_nested_list)) { + } else { + + $writer = [-1, ""]; + $send(buffer, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + };}; + if (this_line['$==']($$($nesting, 'LIST_CONTINUATION'))) { + + if ($truthy(continuation['$!=']("frozen"))) { + + continuation = "frozen"; + buffer['$<<'](this_line);}; + this_line = nil; + continue;;};}; + if ($truthy((match = self['$is_delimited_block?'](this_line, true)))) { + if (continuation['$==']("active")) { + + buffer['$<<'](this_line); + buffer.$concat(reader.$read_lines_until($hash2(["terminator", "read_last_line", "context"], {"terminator": match.$terminator(), "read_last_line": true, "context": nil}))); + continuation = "inactive"; + } else { + break; + } + } else if ($truthy(($truthy($b = (($c = list_type['$==']("dlist")) ? continuation['$!=']("active") : list_type['$==']("dlist"))) ? $$($nesting, 'BlockAttributeLineRx')['$match?'](this_line) : $b))) { + break; + } else if ($truthy((($b = continuation['$==']("active")) ? this_line['$empty?']()['$!']() : continuation['$==']("active")))) { + if ($truthy($$($nesting, 'LiteralParagraphRx')['$match?'](this_line))) { + + reader.$unshift_line(this_line); + buffer.$concat($send(reader, 'read_lines_until', [$hash2(["preserve_last_line", "break_on_blank_lines", "break_on_list_continuation"], {"preserve_last_line": true, "break_on_blank_lines": true, "break_on_list_continuation": true})], (TMP_29 = function(line){var self = TMP_29.$$s || this, $d; + + + + if (line == null) { + line = nil; + }; + return (($d = list_type['$==']("dlist")) ? self['$is_sibling_list_item?'](line, list_type, sibling_trait) : list_type['$==']("dlist"));}, TMP_29.$$s = self, TMP_29.$$arity = 1, TMP_29))); + continuation = "inactive"; + } else if ($truthy(($truthy($b = ($truthy($c = $$($nesting, 'BlockTitleRx')['$match?'](this_line)) ? $c : $$($nesting, 'BlockAttributeLineRx')['$match?'](this_line))) ? $b : $$($nesting, 'AttributeEntryRx')['$match?'](this_line)))) { + buffer['$<<'](this_line) + } else { + + if ($truthy((nested_list_type = $send((function() {if ($truthy(within_nested_list)) { + return ["dlist"] + } else { + return $$($nesting, 'NESTABLE_LIST_CONTEXTS') + }; return nil; })(), 'find', [], (TMP_30 = function(ctx){var self = TMP_30.$$s || this; + + + + if (ctx == null) { + ctx = nil; + }; + return $$($nesting, 'ListRxMap')['$[]'](ctx)['$match?'](this_line);}, TMP_30.$$s = self, TMP_30.$$arity = 1, TMP_30))))) { + + within_nested_list = true; + if ($truthy((($b = nested_list_type['$==']("dlist")) ? (($c = $gvars['~']) === nil ? nil : $c['$[]'](3))['$nil_or_empty?']() : nested_list_type['$==']("dlist")))) { + has_text = false};}; + buffer['$<<'](this_line); + continuation = "inactive"; + } + } else if ($truthy(($truthy($b = prev_line) ? prev_line['$empty?']() : $b))) { + + if ($truthy(this_line['$empty?']())) { + + if ($truthy((this_line = ($truthy($b = reader.$skip_blank_lines()) ? reader.$read_line() : $b)))) { + } else { + break; + }; + if ($truthy(self['$is_sibling_list_item?'](this_line, list_type, sibling_trait))) { + break;};}; + if (this_line['$==']($$($nesting, 'LIST_CONTINUATION'))) { + + detached_continuation = buffer.$size(); + buffer['$<<'](this_line); + } else if ($truthy(has_text)) { + if ($truthy(self['$is_sibling_list_item?'](this_line, list_type, sibling_trait))) { + break; + } else if ($truthy((nested_list_type = $send($$($nesting, 'NESTABLE_LIST_CONTEXTS'), 'find', [], (TMP_31 = function(ctx){var self = TMP_31.$$s || this; + + + + if (ctx == null) { + ctx = nil; + }; + return $$($nesting, 'ListRxMap')['$[]'](ctx)['$=~'](this_line);}, TMP_31.$$s = self, TMP_31.$$arity = 1, TMP_31))))) { + + buffer['$<<'](this_line); + within_nested_list = true; + if ($truthy((($b = nested_list_type['$==']("dlist")) ? (($c = $gvars['~']) === nil ? nil : $c['$[]'](3))['$nil_or_empty?']() : nested_list_type['$==']("dlist")))) { + has_text = false}; + } else if ($truthy($$($nesting, 'LiteralParagraphRx')['$match?'](this_line))) { + + reader.$unshift_line(this_line); + buffer.$concat($send(reader, 'read_lines_until', [$hash2(["preserve_last_line", "break_on_blank_lines", "break_on_list_continuation"], {"preserve_last_line": true, "break_on_blank_lines": true, "break_on_list_continuation": true})], (TMP_32 = function(line){var self = TMP_32.$$s || this, $d; + + + + if (line == null) { + line = nil; + }; + return (($d = list_type['$==']("dlist")) ? self['$is_sibling_list_item?'](line, list_type, sibling_trait) : list_type['$==']("dlist"));}, TMP_32.$$s = self, TMP_32.$$arity = 1, TMP_32))); + } else { + break; + } + } else { + + if ($truthy(within_nested_list)) { + } else { + buffer.$pop() + }; + buffer['$<<'](this_line); + has_text = true; + }; + } else { + + if ($truthy(this_line['$empty?']()['$!']())) { + has_text = true}; + if ($truthy((nested_list_type = $send((function() {if ($truthy(within_nested_list)) { + return ["dlist"] + } else { + return $$($nesting, 'NESTABLE_LIST_CONTEXTS') + }; return nil; })(), 'find', [], (TMP_33 = function(ctx){var self = TMP_33.$$s || this; + + + + if (ctx == null) { + ctx = nil; + }; + return $$($nesting, 'ListRxMap')['$[]'](ctx)['$=~'](this_line);}, TMP_33.$$s = self, TMP_33.$$arity = 1, TMP_33))))) { + + within_nested_list = true; + if ($truthy((($b = nested_list_type['$==']("dlist")) ? (($c = $gvars['~']) === nil ? nil : $c['$[]'](3))['$nil_or_empty?']() : nested_list_type['$==']("dlist")))) { + has_text = false};}; + buffer['$<<'](this_line); + }; + this_line = nil; + }; + if ($truthy(this_line)) { + reader.$unshift_line(this_line)}; + if ($truthy(detached_continuation)) { + buffer.$delete_at(detached_continuation)}; + while ($truthy(($truthy($b = buffer['$empty?']()['$!']()) ? buffer['$[]'](-1)['$empty?']() : $b))) { + buffer.$pop() + }; + if ($truthy(($truthy($a = buffer['$empty?']()['$!']()) ? buffer['$[]'](-1)['$==']($$($nesting, 'LIST_CONTINUATION')) : $a))) { + buffer.$pop()}; + return buffer; + }, TMP_Parser_read_lines_for_list_item_28.$$arity = -3); + Opal.defs(self, '$initialize_section', TMP_Parser_initialize_section_34 = function $$initialize_section(reader, parent, attributes) { + var $a, $b, self = this, document = nil, book = nil, doctype = nil, source_location = nil, sect_style = nil, sect_id = nil, sect_reftext = nil, sect_title = nil, sect_level = nil, sect_atx = nil, $writer = nil, sect_name = nil, sect_special = nil, sect_numbered = nil, section = nil, id = nil; + + + + if (attributes == null) { + attributes = $hash2([], {}); + }; + document = parent.$document(); + book = (doctype = document.$doctype())['$==']("book"); + if ($truthy(document.$sourcemap())) { + source_location = reader.$cursor()}; + sect_style = attributes['$[]'](1); + $b = self.$parse_section_title(reader, document, attributes['$[]']("id")), $a = Opal.to_ary($b), (sect_id = ($a[0] == null ? nil : $a[0])), (sect_reftext = ($a[1] == null ? nil : $a[1])), (sect_title = ($a[2] == null ? nil : $a[2])), (sect_level = ($a[3] == null ? nil : $a[3])), (sect_atx = ($a[4] == null ? nil : $a[4])), $b; + if ($truthy(sect_reftext)) { + + $writer = ["reftext", sect_reftext]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + } else { + sect_reftext = attributes['$[]']("reftext") + }; + if ($truthy(sect_style)) { + if ($truthy(($truthy($a = book) ? sect_style['$==']("abstract") : $a))) { + $a = ["chapter", 1], (sect_name = $a[0]), (sect_level = $a[1]), $a + } else { + + $a = [sect_style, true], (sect_name = $a[0]), (sect_special = $a[1]), $a; + if (sect_level['$=='](0)) { + sect_level = 1}; + sect_numbered = sect_style['$==']("appendix"); + } + } else if ($truthy(book)) { + sect_name = (function() {if (sect_level['$=='](0)) { + return "part" + } else { + + if ($truthy($rb_gt(sect_level, 1))) { + return "section" + } else { + return "chapter" + }; + }; return nil; })() + } else if ($truthy((($a = doctype['$==']("manpage")) ? sect_title.$casecmp("synopsis")['$=='](0) : doctype['$==']("manpage")))) { + $a = ["synopsis", true], (sect_name = $a[0]), (sect_special = $a[1]), $a + } else { + sect_name = "section" + }; + section = $$($nesting, 'Section').$new(parent, sect_level); + $a = [sect_id, sect_title, sect_name, source_location], section['$id=']($a[0]), section['$title=']($a[1]), section['$sectname=']($a[2]), section['$source_location=']($a[3]), $a; + if ($truthy(sect_special)) { + + + $writer = [true]; + $send(section, 'special=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + if ($truthy(sect_numbered)) { + + $writer = [true]; + $send(section, 'numbered=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + } else if (document.$attributes()['$[]']("sectnums")['$==']("all")) { + + $writer = [(function() {if ($truthy(($truthy($a = book) ? sect_level['$=='](1) : $a))) { + return "chapter" + } else { + return true + }; return nil; })()]; + $send(section, 'numbered=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + } else if ($truthy(($truthy($a = document.$attributes()['$[]']("sectnums")) ? $rb_gt(sect_level, 0) : $a))) { + + $writer = [(function() {if ($truthy(section.$special())) { + return ($truthy($a = parent.$numbered()) ? true : $a) + } else { + return true + }; return nil; })()]; + $send(section, 'numbered=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + } else if ($truthy(($truthy($a = ($truthy($b = book) ? sect_level['$=='](0) : $b)) ? document.$attributes()['$[]']("partnums") : $a))) { + + $writer = [true]; + $send(section, 'numbered=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if ($truthy((id = ($truthy($a = section.$id()) ? $a : (($writer = [(function() {if ($truthy(document.$attributes()['$key?']("sectids"))) { + + return $$($nesting, 'Section').$generate_id(section.$title(), document); + } else { + return nil + }; return nil; })()]), $send(section, 'id=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]))))) { + if ($truthy(document.$register("refs", [id, section, ($truthy($a = sect_reftext) ? $a : section.$title())]))) { + } else { + self.$logger().$warn(self.$message_with_context("" + "id assigned to section already in use: " + (id), $hash2(["source_location"], {"source_location": reader.$cursor_at_line($rb_minus(reader.$lineno(), (function() {if ($truthy(sect_atx)) { + return 1 + } else { + return 2 + }; return nil; })()))}))) + }}; + section.$update_attributes(attributes); + reader.$skip_blank_lines(); + return section; + }, TMP_Parser_initialize_section_34.$$arity = -3); + Opal.defs(self, '$is_next_line_section?', TMP_Parser_is_next_line_section$q_35 = function(reader, attributes) { + var $a, $b, self = this, style = nil, next_lines = nil; + + if ($truthy(($truthy($a = (style = attributes['$[]'](1))) ? ($truthy($b = style['$==']("discrete")) ? $b : style['$==']("float")) : $a))) { + return nil + } else if ($truthy($$($nesting, 'Compliance').$underline_style_section_titles())) { + + next_lines = reader.$peek_lines(2, ($truthy($a = style) ? style['$==']("comment") : $a)); + return self['$is_section_title?'](($truthy($a = next_lines['$[]'](0)) ? $a : ""), next_lines['$[]'](1)); + } else { + return self['$atx_section_title?'](($truthy($a = reader.$peek_line()) ? $a : "")) + } + }, TMP_Parser_is_next_line_section$q_35.$$arity = 2); + Opal.defs(self, '$is_next_line_doctitle?', TMP_Parser_is_next_line_doctitle$q_36 = function(reader, attributes, leveloffset) { + var $a, self = this, sect_level = nil; + + if ($truthy(leveloffset)) { + return ($truthy($a = (sect_level = self['$is_next_line_section?'](reader, attributes))) ? $rb_plus(sect_level, leveloffset.$to_i())['$=='](0) : $a) + } else { + return self['$is_next_line_section?'](reader, attributes)['$=='](0) + } + }, TMP_Parser_is_next_line_doctitle$q_36.$$arity = 3); + Opal.defs(self, '$is_section_title?', TMP_Parser_is_section_title$q_37 = function(line1, line2) { + var $a, self = this; + + + + if (line2 == null) { + line2 = nil; + }; + return ($truthy($a = self['$atx_section_title?'](line1)) ? $a : (function() {if ($truthy(line2['$nil_or_empty?']())) { + return nil + } else { + return self['$setext_section_title?'](line1, line2) + }; return nil; })()); + }, TMP_Parser_is_section_title$q_37.$$arity = -2); + Opal.defs(self, '$atx_section_title?', TMP_Parser_atx_section_title$q_38 = function(line) { + var $a, self = this; + + if ($truthy((function() {if ($truthy($$($nesting, 'Compliance').$markdown_syntax())) { + + return ($truthy($a = line['$start_with?']("=", "#")) ? $$($nesting, 'ExtAtxSectionTitleRx')['$=~'](line) : $a); + } else { + + return ($truthy($a = line['$start_with?']("=")) ? $$($nesting, 'AtxSectionTitleRx')['$=~'](line) : $a); + }; return nil; })())) { + return $rb_minus((($a = $gvars['~']) === nil ? nil : $a['$[]'](1)).$length(), 1) + } else { + return nil + } + }, TMP_Parser_atx_section_title$q_38.$$arity = 1); + Opal.defs(self, '$setext_section_title?', TMP_Parser_setext_section_title$q_39 = function(line1, line2) { + var $a, $b, $c, self = this, level = nil, line2_ch1 = nil, line2_len = nil; + + if ($truthy(($truthy($a = ($truthy($b = ($truthy($c = (level = $$($nesting, 'SETEXT_SECTION_LEVELS')['$[]']((line2_ch1 = line2.$chr())))) ? $rb_times(line2_ch1, (line2_len = line2.$length()))['$=='](line2) : $c)) ? $$($nesting, 'SetextSectionTitleRx')['$match?'](line1) : $b)) ? $rb_lt($rb_minus(self.$line_length(line1), line2_len).$abs(), 2) : $a))) { + return level + } else { + return nil + } + }, TMP_Parser_setext_section_title$q_39.$$arity = 2); + Opal.defs(self, '$parse_section_title', TMP_Parser_parse_section_title_40 = function $$parse_section_title(reader, document, sect_id) { + var $a, $b, $c, $d, $e, self = this, sect_reftext = nil, line1 = nil, sect_level = nil, sect_title = nil, atx = nil, line2 = nil, line2_ch1 = nil, line2_len = nil; + + + + if (sect_id == null) { + sect_id = nil; + }; + sect_reftext = nil; + line1 = reader.$read_line(); + if ($truthy((function() {if ($truthy($$($nesting, 'Compliance').$markdown_syntax())) { + + return ($truthy($a = line1['$start_with?']("=", "#")) ? $$($nesting, 'ExtAtxSectionTitleRx')['$=~'](line1) : $a); + } else { + + return ($truthy($a = line1['$start_with?']("=")) ? $$($nesting, 'AtxSectionTitleRx')['$=~'](line1) : $a); + }; return nil; })())) { + + $a = [$rb_minus((($b = $gvars['~']) === nil ? nil : $b['$[]'](1)).$length(), 1), (($b = $gvars['~']) === nil ? nil : $b['$[]'](2)), true], (sect_level = $a[0]), (sect_title = $a[1]), (atx = $a[2]), $a; + if ($truthy(sect_id)) { + } else if ($truthy(($truthy($a = ($truthy($b = sect_title['$end_with?']("]]")) ? $$($nesting, 'InlineSectionAnchorRx')['$=~'](sect_title) : $b)) ? (($b = $gvars['~']) === nil ? nil : $b['$[]'](1))['$!']() : $a))) { + $a = [sect_title.$slice(0, $rb_minus(sect_title.$length(), (($b = $gvars['~']) === nil ? nil : $b['$[]'](0)).$length())), (($b = $gvars['~']) === nil ? nil : $b['$[]'](2)), (($b = $gvars['~']) === nil ? nil : $b['$[]'](3))], (sect_title = $a[0]), (sect_id = $a[1]), (sect_reftext = $a[2]), $a}; + } else if ($truthy(($truthy($a = ($truthy($b = ($truthy($c = ($truthy($d = ($truthy($e = $$($nesting, 'Compliance').$underline_style_section_titles()) ? (line2 = reader.$peek_line(true)) : $e)) ? (sect_level = $$($nesting, 'SETEXT_SECTION_LEVELS')['$[]']((line2_ch1 = line2.$chr()))) : $d)) ? $rb_times(line2_ch1, (line2_len = line2.$length()))['$=='](line2) : $c)) ? (sect_title = ($truthy($c = $$($nesting, 'SetextSectionTitleRx')['$=~'](line1)) ? (($d = $gvars['~']) === nil ? nil : $d['$[]'](1)) : $c)) : $b)) ? $rb_lt($rb_minus(self.$line_length(line1), line2_len).$abs(), 2) : $a))) { + + atx = false; + if ($truthy(sect_id)) { + } else if ($truthy(($truthy($a = ($truthy($b = sect_title['$end_with?']("]]")) ? $$($nesting, 'InlineSectionAnchorRx')['$=~'](sect_title) : $b)) ? (($b = $gvars['~']) === nil ? nil : $b['$[]'](1))['$!']() : $a))) { + $a = [sect_title.$slice(0, $rb_minus(sect_title.$length(), (($b = $gvars['~']) === nil ? nil : $b['$[]'](0)).$length())), (($b = $gvars['~']) === nil ? nil : $b['$[]'](2)), (($b = $gvars['~']) === nil ? nil : $b['$[]'](3))], (sect_title = $a[0]), (sect_id = $a[1]), (sect_reftext = $a[2]), $a}; + reader.$shift(); + } else { + self.$raise("" + "Unrecognized section at " + (reader.$cursor_at_prev_line())) + }; + if ($truthy(document['$attr?']("leveloffset"))) { + sect_level = $rb_plus(sect_level, document.$attr("leveloffset").$to_i())}; + return [sect_id, sect_reftext, sect_title, sect_level, atx]; + }, TMP_Parser_parse_section_title_40.$$arity = -3); + if ($truthy($$($nesting, 'FORCE_UNICODE_LINE_LENGTH'))) { + Opal.defs(self, '$line_length', TMP_Parser_line_length_41 = function $$line_length(line) { + var self = this; + + return line.$scan($$($nesting, 'UnicodeCharScanRx')).$size() + }, TMP_Parser_line_length_41.$$arity = 1) + } else { + Opal.defs(self, '$line_length', TMP_Parser_line_length_42 = function $$line_length(line) { + var self = this; + + return line.$length() + }, TMP_Parser_line_length_42.$$arity = 1) + }; + Opal.defs(self, '$parse_header_metadata', TMP_Parser_parse_header_metadata_43 = function $$parse_header_metadata(reader, document) { + var $a, TMP_44, TMP_45, TMP_46, self = this, doc_attrs = nil, implicit_authors = nil, metadata = nil, implicit_author = nil, implicit_authorinitials = nil, author_metadata = nil, rev_metadata = nil, rev_line = nil, match = nil, $writer = nil, component = nil, author_line = nil, authors = nil, author_idx = nil, author_key = nil, explicit = nil, sparse = nil, author_override = nil; + + + + if (document == null) { + document = nil; + }; + doc_attrs = ($truthy($a = document) ? document.$attributes() : $a); + self.$process_attribute_entries(reader, document); + $a = [(implicit_authors = $hash2([], {})), nil, nil], (metadata = $a[0]), (implicit_author = $a[1]), (implicit_authorinitials = $a[2]), $a; + if ($truthy(($truthy($a = reader['$has_more_lines?']()) ? reader['$next_line_empty?']()['$!']() : $a))) { + + if ($truthy((author_metadata = self.$process_authors(reader.$read_line()))['$empty?']())) { + } else { + + if ($truthy(document)) { + + $send(author_metadata, 'each', [], (TMP_44 = function(key, val){var self = TMP_44.$$s || this, $writer = nil; + + + + if (key == null) { + key = nil; + }; + + if (val == null) { + val = nil; + }; + if ($truthy(doc_attrs['$key?'](key))) { + return nil + } else { + + $writer = [key, (function() {if ($truthy($$$('::', 'String')['$==='](val))) { + + return document.$apply_header_subs(val); + } else { + return val + }; return nil; })()]; + $send(doc_attrs, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + };}, TMP_44.$$s = self, TMP_44.$$arity = 2, TMP_44)); + implicit_author = doc_attrs['$[]']("author"); + implicit_authorinitials = doc_attrs['$[]']("authorinitials"); + implicit_authors = doc_attrs['$[]']("authors");}; + metadata = author_metadata; + }; + self.$process_attribute_entries(reader, document); + rev_metadata = $hash2([], {}); + if ($truthy(($truthy($a = reader['$has_more_lines?']()) ? reader['$next_line_empty?']()['$!']() : $a))) { + + rev_line = reader.$read_line(); + if ($truthy((match = $$($nesting, 'RevisionInfoLineRx').$match(rev_line)))) { + + if ($truthy(match['$[]'](1))) { + + $writer = ["revnumber", match['$[]'](1).$rstrip()]; + $send(rev_metadata, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if ($truthy((component = match['$[]'](2).$strip())['$empty?']())) { + } else if ($truthy(($truthy($a = match['$[]'](1)['$!']()) ? component['$start_with?']("v") : $a))) { + + $writer = ["revnumber", component.$slice(1, component.$length())]; + $send(rev_metadata, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + } else { + + $writer = ["revdate", component]; + $send(rev_metadata, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + if ($truthy(match['$[]'](3))) { + + $writer = ["revremark", match['$[]'](3).$rstrip()]; + $send(rev_metadata, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + } else { + reader.$unshift_line(rev_line) + };}; + if ($truthy(rev_metadata['$empty?']())) { + } else { + + if ($truthy(document)) { + $send(rev_metadata, 'each', [], (TMP_45 = function(key, val){var self = TMP_45.$$s || this; + + + + if (key == null) { + key = nil; + }; + + if (val == null) { + val = nil; + }; + if ($truthy(doc_attrs['$key?'](key))) { + return nil + } else { + + $writer = [key, document.$apply_header_subs(val)]; + $send(doc_attrs, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + };}, TMP_45.$$s = self, TMP_45.$$arity = 2, TMP_45))}; + metadata.$update(rev_metadata); + }; + self.$process_attribute_entries(reader, document); + reader.$skip_blank_lines(); + } else { + author_metadata = $hash2([], {}) + }; + if ($truthy(document)) { + + if ($truthy(($truthy($a = doc_attrs['$key?']("author")) ? (author_line = doc_attrs['$[]']("author"))['$!='](implicit_author) : $a))) { + + author_metadata = self.$process_authors(author_line, true, false); + if ($truthy(doc_attrs['$[]']("authorinitials")['$!='](implicit_authorinitials))) { + author_metadata.$delete("authorinitials")}; + } else if ($truthy(($truthy($a = doc_attrs['$key?']("authors")) ? (author_line = doc_attrs['$[]']("authors"))['$!='](implicit_authors) : $a))) { + author_metadata = self.$process_authors(author_line, true) + } else { + + $a = [[], 1, "author_1", false, false], (authors = $a[0]), (author_idx = $a[1]), (author_key = $a[2]), (explicit = $a[3]), (sparse = $a[4]), $a; + while ($truthy(doc_attrs['$key?'](author_key))) { + + if ((author_override = doc_attrs['$[]'](author_key))['$=='](author_metadata['$[]'](author_key))) { + + authors['$<<'](nil); + sparse = true; + } else { + + authors['$<<'](author_override); + explicit = true; + }; + author_key = "" + "author_" + ((author_idx = $rb_plus(author_idx, 1))); + }; + if ($truthy(explicit)) { + + if ($truthy(sparse)) { + $send(authors, 'each_with_index', [], (TMP_46 = function(author, idx){var self = TMP_46.$$s || this, TMP_47, name_idx = nil; + + + + if (author == null) { + author = nil; + }; + + if (idx == null) { + idx = nil; + }; + if ($truthy(author)) { + return nil + } else { + + $writer = [idx, $send([author_metadata['$[]']("" + "firstname_" + ((name_idx = $rb_plus(idx, 1)))), author_metadata['$[]']("" + "middlename_" + (name_idx)), author_metadata['$[]']("" + "lastname_" + (name_idx))].$compact(), 'map', [], (TMP_47 = function(it){var self = TMP_47.$$s || this; + + + + if (it == null) { + it = nil; + }; + return it.$tr(" ", "_");}, TMP_47.$$s = self, TMP_47.$$arity = 1, TMP_47)).$join(" ")]; + $send(authors, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + };}, TMP_46.$$s = self, TMP_46.$$arity = 2, TMP_46))}; + author_metadata = self.$process_authors(authors, true, false); + } else { + author_metadata = $hash2([], {}) + }; + }; + if ($truthy(author_metadata['$empty?']())) { + ($truthy($a = metadata['$[]']("authorcount")) ? $a : (($writer = ["authorcount", (($writer = ["authorcount", 0]), $send(doc_attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])]), $send(metadata, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])) + } else { + + doc_attrs.$update(author_metadata); + if ($truthy(($truthy($a = doc_attrs['$key?']("email")['$!']()) ? doc_attrs['$key?']("email_1") : $a))) { + + $writer = ["email", doc_attrs['$[]']("email_1")]; + $send(doc_attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + };}; + return metadata; + }, TMP_Parser_parse_header_metadata_43.$$arity = -2); + Opal.defs(self, '$process_authors', TMP_Parser_process_authors_48 = function $$process_authors(author_line, names_only, multiple) { + var TMP_49, TMP_50, self = this, author_metadata = nil, author_idx = nil, keys = nil, author_entries = nil, $writer = nil; + + + + if (names_only == null) { + names_only = false; + }; + + if (multiple == null) { + multiple = true; + }; + author_metadata = $hash2([], {}); + author_idx = 0; + keys = ["author", "authorinitials", "firstname", "middlename", "lastname", "email"]; + author_entries = (function() {if ($truthy(multiple)) { + return $send(author_line.$split(";"), 'map', [], (TMP_49 = function(it){var self = TMP_49.$$s || this; + + + + if (it == null) { + it = nil; + }; + return it.$strip();}, TMP_49.$$s = self, TMP_49.$$arity = 1, TMP_49)) + } else { + return self.$Array(author_line) + }; return nil; })(); + $send(author_entries, 'each', [], (TMP_50 = function(author_entry){var self = TMP_50.$$s || this, TMP_51, TMP_52, $a, TMP_53, key_map = nil, $writer = nil, segments = nil, match = nil, author = nil, fname = nil, mname = nil, lname = nil; + + + + if (author_entry == null) { + author_entry = nil; + }; + if ($truthy(author_entry['$empty?']())) { + return nil;}; + author_idx = $rb_plus(author_idx, 1); + key_map = $hash2([], {}); + if (author_idx['$=='](1)) { + $send(keys, 'each', [], (TMP_51 = function(key){var self = TMP_51.$$s || this, $writer = nil; + + + + if (key == null) { + key = nil; + }; + $writer = [key.$to_sym(), key]; + $send(key_map, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];}, TMP_51.$$s = self, TMP_51.$$arity = 1, TMP_51)) + } else { + $send(keys, 'each', [], (TMP_52 = function(key){var self = TMP_52.$$s || this, $writer = nil; + + + + if (key == null) { + key = nil; + }; + $writer = [key.$to_sym(), "" + (key) + "_" + (author_idx)]; + $send(key_map, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];}, TMP_52.$$s = self, TMP_52.$$arity = 1, TMP_52)) + }; + if ($truthy(names_only)) { + + if ($truthy(author_entry['$include?']("<"))) { + + + $writer = [key_map['$[]']("author"), author_entry.$tr("_", " ")]; + $send(author_metadata, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + author_entry = author_entry.$gsub($$($nesting, 'XmlSanitizeRx'), "");}; + if ((segments = author_entry.$split(nil, 3)).$size()['$=='](3)) { + segments['$<<'](segments.$pop().$squeeze(" "))}; + } else if ($truthy((match = $$($nesting, 'AuthorInfoLineRx').$match(author_entry)))) { + (segments = match.$to_a()).$shift()}; + if ($truthy(segments)) { + + author = (($writer = [key_map['$[]']("firstname"), (fname = segments['$[]'](0).$tr("_", " "))]), $send(author_metadata, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]); + + $writer = [key_map['$[]']("authorinitials"), fname.$chr()]; + $send(author_metadata, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + if ($truthy(segments['$[]'](1))) { + if ($truthy(segments['$[]'](2))) { + + + $writer = [key_map['$[]']("middlename"), (mname = segments['$[]'](1).$tr("_", " "))]; + $send(author_metadata, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = [key_map['$[]']("lastname"), (lname = segments['$[]'](2).$tr("_", " "))]; + $send(author_metadata, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + author = $rb_plus($rb_plus($rb_plus($rb_plus(fname, " "), mname), " "), lname); + + $writer = [key_map['$[]']("authorinitials"), "" + (fname.$chr()) + (mname.$chr()) + (lname.$chr())]; + $send(author_metadata, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + } else { + + + $writer = [key_map['$[]']("lastname"), (lname = segments['$[]'](1).$tr("_", " "))]; + $send(author_metadata, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + author = $rb_plus($rb_plus(fname, " "), lname); + + $writer = [key_map['$[]']("authorinitials"), "" + (fname.$chr()) + (lname.$chr())]; + $send(author_metadata, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + }}; + ($truthy($a = author_metadata['$[]'](key_map['$[]']("author"))) ? $a : (($writer = [key_map['$[]']("author"), author]), $send(author_metadata, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + if ($truthy(($truthy($a = names_only) ? $a : segments['$[]'](3)['$!']()))) { + } else { + + $writer = [key_map['$[]']("email"), segments['$[]'](3)]; + $send(author_metadata, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + } else { + + + $writer = [key_map['$[]']("author"), (($writer = [key_map['$[]']("firstname"), (fname = author_entry.$squeeze(" ").$strip())]), $send(author_metadata, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])]; + $send(author_metadata, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = [key_map['$[]']("authorinitials"), fname.$chr()]; + $send(author_metadata, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + }; + if (author_idx['$=='](1)) { + + $writer = ["authors", author_metadata['$[]'](key_map['$[]']("author"))]; + $send(author_metadata, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + } else { + + if (author_idx['$=='](2)) { + $send(keys, 'each', [], (TMP_53 = function(key){var self = TMP_53.$$s || this; + + + + if (key == null) { + key = nil; + }; + if ($truthy(author_metadata['$key?'](key))) { + + $writer = ["" + (key) + "_1", author_metadata['$[]'](key)]; + $send(author_metadata, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + } else { + return nil + };}, TMP_53.$$s = self, TMP_53.$$arity = 1, TMP_53))}; + + $writer = ["authors", "" + (author_metadata['$[]']("authors")) + ", " + (author_metadata['$[]'](key_map['$[]']("author")))]; + $send(author_metadata, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];; + };}, TMP_50.$$s = self, TMP_50.$$arity = 1, TMP_50)); + + $writer = ["authorcount", author_idx]; + $send(author_metadata, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + return author_metadata; + }, TMP_Parser_process_authors_48.$$arity = -2); + Opal.defs(self, '$parse_block_metadata_lines', TMP_Parser_parse_block_metadata_lines_54 = function $$parse_block_metadata_lines(reader, document, attributes, options) { + var $a, $b, self = this; + + + + if (attributes == null) { + attributes = $hash2([], {}); + }; + + if (options == null) { + options = $hash2([], {}); + }; + while ($truthy(self.$parse_block_metadata_line(reader, document, attributes, options))) { + + reader.$shift(); + if ($truthy($b = reader.$skip_blank_lines())) { + $b + } else { + break; + }; + }; + return attributes; + }, TMP_Parser_parse_block_metadata_lines_54.$$arity = -3); + Opal.defs(self, '$parse_block_metadata_line', TMP_Parser_parse_block_metadata_line_55 = function $$parse_block_metadata_line(reader, document, attributes, options) { + var $a, $b, self = this, next_line = nil, normal = nil, $writer = nil, reftext = nil, current_style = nil, ll = nil; + if ($gvars["~"] == null) $gvars["~"] = nil; + + + + if (options == null) { + options = $hash2([], {}); + }; + if ($truthy(($truthy($a = (next_line = reader.$peek_line())) ? (function() {if ($truthy(options['$[]']("text"))) { + + return next_line['$start_with?']("[", "/"); + } else { + + return (normal = next_line['$start_with?']("[", ".", "/", ":")); + }; return nil; })() : $a))) { + if ($truthy(next_line['$start_with?']("["))) { + if ($truthy(next_line['$start_with?']("[["))) { + if ($truthy(($truthy($a = next_line['$end_with?']("]]")) ? $$($nesting, 'BlockAnchorRx')['$=~'](next_line) : $a))) { + + + $writer = ["id", (($a = $gvars['~']) === nil ? nil : $a['$[]'](1))]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + if ($truthy((reftext = (($a = $gvars['~']) === nil ? nil : $a['$[]'](2))))) { + + $writer = ["reftext", (function() {if ($truthy(reftext['$include?']($$($nesting, 'ATTR_REF_HEAD')))) { + + return document.$sub_attributes(reftext); + } else { + return reftext + }; return nil; })()]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + return true; + } else { + return nil + } + } else if ($truthy(($truthy($a = next_line['$end_with?']("]")) ? $$($nesting, 'BlockAttributeListRx')['$=~'](next_line) : $a))) { + + current_style = attributes['$[]'](1); + if ($truthy(document.$parse_attributes((($a = $gvars['~']) === nil ? nil : $a['$[]'](1)), [], $hash2(["sub_input", "sub_result", "into"], {"sub_input": true, "sub_result": true, "into": attributes}))['$[]'](1))) { + + $writer = [1, ($truthy($a = self.$parse_style_attribute(attributes, reader)) ? $a : current_style)]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + return true; + } else { + return nil + } + } else if ($truthy(($truthy($a = normal) ? next_line['$start_with?'](".") : $a))) { + if ($truthy($$($nesting, 'BlockTitleRx')['$=~'](next_line))) { + + + $writer = ["title", (($a = $gvars['~']) === nil ? nil : $a['$[]'](1))]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + return true; + } else { + return nil + } + } else if ($truthy(($truthy($a = normal['$!']()) ? $a : next_line['$start_with?']("/")))) { + if ($truthy(next_line['$start_with?']("//"))) { + if (next_line['$==']("//")) { + return true + } else if ($truthy(($truthy($a = normal) ? $rb_times("/", (ll = next_line.$length()))['$=='](next_line) : $a))) { + if (ll['$=='](3)) { + return nil + } else { + + reader.$read_lines_until($hash2(["terminator", "skip_first_line", "preserve_last_line", "skip_processing", "context"], {"terminator": next_line, "skip_first_line": true, "preserve_last_line": true, "skip_processing": true, "context": "comment"})); + return true; + } + } else if ($truthy(next_line['$start_with?']("///"))) { + return nil + } else { + return true + } + } else { + return nil + } + } else if ($truthy(($truthy($a = ($truthy($b = normal) ? next_line['$start_with?'](":") : $b)) ? $$($nesting, 'AttributeEntryRx')['$=~'](next_line) : $a))) { + + self.$process_attribute_entry(reader, document, attributes, $gvars["~"]); + return true; + } else { + return nil + } + } else { + return nil + }; + }, TMP_Parser_parse_block_metadata_line_55.$$arity = -4); + Opal.defs(self, '$process_attribute_entries', TMP_Parser_process_attribute_entries_56 = function $$process_attribute_entries(reader, document, attributes) { + var $a, self = this; + + + + if (attributes == null) { + attributes = nil; + }; + reader.$skip_comment_lines(); + while ($truthy(self.$process_attribute_entry(reader, document, attributes))) { + + reader.$shift(); + reader.$skip_comment_lines(); + }; + }, TMP_Parser_process_attribute_entries_56.$$arity = -3); + Opal.defs(self, '$process_attribute_entry', TMP_Parser_process_attribute_entry_57 = function $$process_attribute_entry(reader, document, attributes, match) { + var $a, $b, $c, self = this, value = nil, con = nil, next_line = nil, keep_open = nil; + + + + if (attributes == null) { + attributes = nil; + }; + + if (match == null) { + match = nil; + }; + if ($truthy((match = ($truthy($a = match) ? $a : (function() {if ($truthy(reader['$has_more_lines?']())) { + + return $$($nesting, 'AttributeEntryRx').$match(reader.$peek_line()); + } else { + return nil + }; return nil; })())))) { + + if ($truthy((value = match['$[]'](2))['$nil_or_empty?']())) { + value = "" + } else if ($truthy(value['$end_with?']($$($nesting, 'LINE_CONTINUATION'), $$($nesting, 'LINE_CONTINUATION_LEGACY')))) { + + $a = [value.$slice(-2, 2), value.$slice(0, $rb_minus(value.$length(), 2)).$rstrip()], (con = $a[0]), (value = $a[1]), $a; + while ($truthy(($truthy($b = reader.$advance()) ? (next_line = ($truthy($c = reader.$peek_line()) ? $c : ""))['$empty?']()['$!']() : $b))) { + + next_line = next_line.$lstrip(); + if ($truthy((keep_open = next_line['$end_with?'](con)))) { + next_line = next_line.$slice(0, $rb_minus(next_line.$length(), 2)).$rstrip()}; + value = "" + (value) + ((function() {if ($truthy(value['$end_with?']($$($nesting, 'HARD_LINE_BREAK')))) { + return $$($nesting, 'LF') + } else { + return " " + }; return nil; })()) + (next_line); + if ($truthy(keep_open)) { + } else { + break; + }; + };}; + self.$store_attribute(match['$[]'](1), value, document, attributes); + return true; + } else { + return nil + }; + }, TMP_Parser_process_attribute_entry_57.$$arity = -3); + Opal.defs(self, '$store_attribute', TMP_Parser_store_attribute_58 = function $$store_attribute(name, value, doc, attrs) { + var $a, self = this, resolved_value = nil; + + + + if (doc == null) { + doc = nil; + }; + + if (attrs == null) { + attrs = nil; + }; + if ($truthy(name['$end_with?']("!"))) { + $a = [name.$chop(), nil], (name = $a[0]), (value = $a[1]), $a + } else if ($truthy(name['$start_with?']("!"))) { + $a = [name.$slice(1, name.$length()), nil], (name = $a[0]), (value = $a[1]), $a}; + name = self.$sanitize_attribute_name(name); + if (name['$==']("numbered")) { + name = "sectnums"}; + if ($truthy(doc)) { + if ($truthy(value)) { + + if (name['$==']("leveloffset")) { + if ($truthy(value['$start_with?']("+"))) { + value = $rb_plus(doc.$attr("leveloffset", 0).$to_i(), value.$slice(1, value.$length()).$to_i()).$to_s() + } else if ($truthy(value['$start_with?']("-"))) { + value = $rb_minus(doc.$attr("leveloffset", 0).$to_i(), value.$slice(1, value.$length()).$to_i()).$to_s()}}; + if ($truthy((resolved_value = doc.$set_attribute(name, value)))) { + + value = resolved_value; + if ($truthy(attrs)) { + $$$($$($nesting, 'Document'), 'AttributeEntry').$new(name, value).$save_to(attrs)};}; + } else if ($truthy(($truthy($a = doc.$delete_attribute(name)) ? attrs : $a))) { + $$$($$($nesting, 'Document'), 'AttributeEntry').$new(name, value).$save_to(attrs)} + } else if ($truthy(attrs)) { + $$$($$($nesting, 'Document'), 'AttributeEntry').$new(name, value).$save_to(attrs)}; + return [name, value]; + }, TMP_Parser_store_attribute_58.$$arity = -3); + Opal.defs(self, '$resolve_list_marker', TMP_Parser_resolve_list_marker_59 = function $$resolve_list_marker(list_type, marker, ordinal, validate, reader) { + var self = this; + + + + if (ordinal == null) { + ordinal = 0; + }; + + if (validate == null) { + validate = false; + }; + + if (reader == null) { + reader = nil; + }; + if (list_type['$==']("ulist")) { + return marker + } else if (list_type['$==']("olist")) { + return self.$resolve_ordered_list_marker(marker, ordinal, validate, reader)['$[]'](0) + } else { + return "<1>" + }; + }, TMP_Parser_resolve_list_marker_59.$$arity = -3); + Opal.defs(self, '$resolve_ordered_list_marker', TMP_Parser_resolve_ordered_list_marker_60 = function $$resolve_ordered_list_marker(marker, ordinal, validate, reader) { + var TMP_61, $a, self = this, $case = nil, style = nil, expected = nil, actual = nil; + + + + if (ordinal == null) { + ordinal = 0; + }; + + if (validate == null) { + validate = false; + }; + + if (reader == null) { + reader = nil; + }; + if ($truthy(marker['$start_with?']("."))) { + return [marker]}; + $case = (style = $send($$($nesting, 'ORDERED_LIST_STYLES'), 'find', [], (TMP_61 = function(s){var self = TMP_61.$$s || this; + + + + if (s == null) { + s = nil; + }; + return $$($nesting, 'OrderedListMarkerRxMap')['$[]'](s)['$match?'](marker);}, TMP_61.$$s = self, TMP_61.$$arity = 1, TMP_61))); + if ("arabic"['$===']($case)) { + if ($truthy(validate)) { + + expected = $rb_plus(ordinal, 1); + actual = marker.$to_i();}; + marker = "1.";} + else if ("loweralpha"['$===']($case)) { + if ($truthy(validate)) { + + expected = $rb_plus("a"['$[]'](0).$ord(), ordinal).$chr(); + actual = marker.$chop();}; + marker = "a.";} + else if ("upperalpha"['$===']($case)) { + if ($truthy(validate)) { + + expected = $rb_plus("A"['$[]'](0).$ord(), ordinal).$chr(); + actual = marker.$chop();}; + marker = "A.";} + else if ("lowerroman"['$===']($case)) { + if ($truthy(validate)) { + + expected = $$($nesting, 'Helpers').$int_to_roman($rb_plus(ordinal, 1)).$downcase(); + actual = marker.$chop();}; + marker = "i)";} + else if ("upperroman"['$===']($case)) { + if ($truthy(validate)) { + + expected = $$($nesting, 'Helpers').$int_to_roman($rb_plus(ordinal, 1)); + actual = marker.$chop();}; + marker = "I)";}; + if ($truthy(($truthy($a = validate) ? expected['$!='](actual) : $a))) { + self.$logger().$warn(self.$message_with_context("" + "list item index: expected " + (expected) + ", got " + (actual), $hash2(["source_location"], {"source_location": reader.$cursor()})))}; + return [marker, style]; + }, TMP_Parser_resolve_ordered_list_marker_60.$$arity = -2); + Opal.defs(self, '$is_sibling_list_item?', TMP_Parser_is_sibling_list_item$q_62 = function(line, list_type, sibling_trait) { + var $a, self = this, matcher = nil, expected_marker = nil; + + + if ($truthy($$$('::', 'Regexp')['$==='](sibling_trait))) { + matcher = sibling_trait + } else { + + matcher = $$($nesting, 'ListRxMap')['$[]'](list_type); + expected_marker = sibling_trait; + }; + if ($truthy(matcher['$=~'](line))) { + if ($truthy(expected_marker)) { + return expected_marker['$=='](self.$resolve_list_marker(list_type, (($a = $gvars['~']) === nil ? nil : $a['$[]'](1)))) + } else { + return true + } + } else { + return false + }; + }, TMP_Parser_is_sibling_list_item$q_62.$$arity = 3); + Opal.defs(self, '$parse_table', TMP_Parser_parse_table_63 = function $$parse_table(table_reader, parent, attributes) { + var $a, $b, $c, $d, self = this, table = nil, $writer = nil, colspecs = nil, explicit_colspecs = nil, skipped = nil, parser_ctx = nil, format = nil, loop_idx = nil, implicit_header_boundary = nil, implicit_header = nil, line = nil, beyond_first = nil, next_cellspec = nil, m = nil, pre_match = nil, post_match = nil, $case = nil, cell_text = nil, $logical_op_recvr_tmp_2 = nil; + + + table = $$($nesting, 'Table').$new(parent, attributes); + if ($truthy(attributes['$key?']("title"))) { + + + $writer = [attributes.$delete("title")]; + $send(table, 'title=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + table.$assign_caption(attributes.$delete("caption"));}; + if ($truthy(($truthy($a = attributes['$key?']("cols")) ? (colspecs = self.$parse_colspecs(attributes['$[]']("cols")))['$empty?']()['$!']() : $a))) { + + table.$create_columns(colspecs); + explicit_colspecs = true;}; + skipped = ($truthy($a = table_reader.$skip_blank_lines()) ? $a : 0); + parser_ctx = $$$($$($nesting, 'Table'), 'ParserContext').$new(table_reader, table, attributes); + $a = [parser_ctx.$format(), -1, nil], (format = $a[0]), (loop_idx = $a[1]), (implicit_header_boundary = $a[2]), $a; + if ($truthy(($truthy($a = ($truthy($b = $rb_gt(skipped, 0)) ? $b : attributes['$key?']("header-option"))) ? $a : attributes['$key?']("noheader-option")))) { + } else { + implicit_header = true + }; + $a = false; while ($a || $truthy((line = table_reader.$read_line()))) {$a = false; + + if ($truthy(($truthy($b = (beyond_first = $rb_gt((loop_idx = $rb_plus(loop_idx, 1)), 0))) ? line['$empty?']() : $b))) { + + line = nil; + if ($truthy(implicit_header_boundary)) { + implicit_header_boundary = $rb_plus(implicit_header_boundary, 1)}; + } else if (format['$==']("psv")) { + if ($truthy(parser_ctx['$starts_with_delimiter?'](line))) { + + line = line.$slice(1, line.$length()); + parser_ctx.$close_open_cell(); + if ($truthy(implicit_header_boundary)) { + implicit_header_boundary = nil}; + } else { + + $c = self.$parse_cellspec(line, "start", parser_ctx.$delimiter()), $b = Opal.to_ary($c), (next_cellspec = ($b[0] == null ? nil : $b[0])), (line = ($b[1] == null ? nil : $b[1])), $c; + if ($truthy(next_cellspec)) { + + parser_ctx.$close_open_cell(next_cellspec); + if ($truthy(implicit_header_boundary)) { + implicit_header_boundary = nil}; + } else if ($truthy(($truthy($b = implicit_header_boundary) ? implicit_header_boundary['$=='](loop_idx) : $b))) { + $b = [false, nil], (implicit_header = $b[0]), (implicit_header_boundary = $b[1]), $b}; + }}; + if ($truthy(beyond_first)) { + } else { + + table_reader.$mark(); + if ($truthy(implicit_header)) { + if ($truthy(($truthy($b = table_reader['$has_more_lines?']()) ? table_reader.$peek_line()['$empty?']() : $b))) { + implicit_header_boundary = 1 + } else { + implicit_header = false + }}; + }; + $b = false; while ($b || $truthy(true)) {$b = false; + if ($truthy(($truthy($c = line) ? (m = parser_ctx.$match_delimiter(line)) : $c))) { + + $c = [m.$pre_match(), m.$post_match()], (pre_match = $c[0]), (post_match = $c[1]), $c; + $case = format; + if ("csv"['$===']($case)) { + if ($truthy(parser_ctx['$buffer_has_unclosed_quotes?'](pre_match))) { + + parser_ctx.$skip_past_delimiter(pre_match); + if ($truthy((line = post_match)['$empty?']())) { + break;}; + $b = true; continue;;}; + + $writer = ["" + (parser_ctx.$buffer()) + (pre_match)]; + $send(parser_ctx, 'buffer=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];;} + else if ("dsv"['$===']($case)) { + if ($truthy(pre_match['$end_with?']("\\"))) { + + parser_ctx.$skip_past_escaped_delimiter(pre_match); + if ($truthy((line = post_match)['$empty?']())) { + + + $writer = ["" + (parser_ctx.$buffer()) + ($$($nesting, 'LF'))]; + $send(parser_ctx, 'buffer=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + parser_ctx.$keep_cell_open(); + break;;}; + $b = true; continue;;}; + + $writer = ["" + (parser_ctx.$buffer()) + (pre_match)]; + $send(parser_ctx, 'buffer=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];;} + else { + if ($truthy(pre_match['$end_with?']("\\"))) { + + parser_ctx.$skip_past_escaped_delimiter(pre_match); + if ($truthy((line = post_match)['$empty?']())) { + + + $writer = ["" + (parser_ctx.$buffer()) + ($$($nesting, 'LF'))]; + $send(parser_ctx, 'buffer=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + parser_ctx.$keep_cell_open(); + break;;}; + $b = true; continue;;}; + $d = self.$parse_cellspec(pre_match), $c = Opal.to_ary($d), (next_cellspec = ($c[0] == null ? nil : $c[0])), (cell_text = ($c[1] == null ? nil : $c[1])), $d; + parser_ctx.$push_cellspec(next_cellspec); + + $writer = ["" + (parser_ctx.$buffer()) + (cell_text)]; + $send(parser_ctx, 'buffer=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];;}; + if ($truthy((line = post_match)['$empty?']())) { + line = nil}; + parser_ctx.$close_cell(); + } else { + + + $writer = ["" + (parser_ctx.$buffer()) + (line) + ($$($nesting, 'LF'))]; + $send(parser_ctx, 'buffer=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + $case = format; + if ("csv"['$===']($case)) {if ($truthy(parser_ctx['$buffer_has_unclosed_quotes?']())) { + + if ($truthy(($truthy($c = implicit_header_boundary) ? loop_idx['$=='](0) : $c))) { + $c = [false, nil], (implicit_header = $c[0]), (implicit_header_boundary = $c[1]), $c}; + parser_ctx.$keep_cell_open(); + } else { + parser_ctx.$close_cell(true) + }} + else if ("dsv"['$===']($case)) {parser_ctx.$close_cell(true)} + else {parser_ctx.$keep_cell_open()}; + break;; + } + }; + if ($truthy(parser_ctx['$cell_open?']())) { + if ($truthy(table_reader['$has_more_lines?']())) { + } else { + parser_ctx.$close_cell(true) + } + } else { + if ($truthy($b = table_reader.$skip_blank_lines())) { + $b + } else { + break; + } + }; + }; + if ($truthy(($truthy($a = (($logical_op_recvr_tmp_2 = table.$attributes()), ($truthy($b = $logical_op_recvr_tmp_2['$[]']("colcount")) ? $b : (($writer = ["colcount", table.$columns().$size()]), $send($logical_op_recvr_tmp_2, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])))['$=='](0)) ? $a : explicit_colspecs))) { + } else { + table.$assign_column_widths() + }; + if ($truthy(implicit_header)) { + + + $writer = [true]; + $send(table, 'has_header_option=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["header-option", ""]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["options", (function() {if ($truthy(attributes['$key?']("options"))) { + return "" + (attributes['$[]']("options")) + ",header" + } else { + return "header" + }; return nil; })()]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];;}; + table.$partition_header_footer(attributes); + return table; + }, TMP_Parser_parse_table_63.$$arity = 3); + Opal.defs(self, '$parse_colspecs', TMP_Parser_parse_colspecs_64 = function $$parse_colspecs(records) { + var TMP_65, TMP_66, self = this, specs = nil; + + + if ($truthy(records['$include?'](" "))) { + records = records.$delete(" ")}; + if (records['$=='](records.$to_i().$to_s())) { + return $send($$$('::', 'Array'), 'new', [records.$to_i()], (TMP_65 = function(){var self = TMP_65.$$s || this; + + return $hash2(["width"], {"width": 1})}, TMP_65.$$s = self, TMP_65.$$arity = 0, TMP_65))}; + specs = []; + $send((function() {if ($truthy(records['$include?'](","))) { + + return records.$split(",", -1); + } else { + + return records.$split(";", -1); + }; return nil; })(), 'each', [], (TMP_66 = function(record){var self = TMP_66.$$s || this, $a, $b, TMP_67, m = nil, spec = nil, colspec = nil, rowspec = nil, $writer = nil, width = nil; + + + + if (record == null) { + record = nil; + }; + if ($truthy(record['$empty?']())) { + return specs['$<<']($hash2(["width"], {"width": 1})) + } else if ($truthy((m = $$($nesting, 'ColumnSpecRx').$match(record)))) { + + spec = $hash2([], {}); + if ($truthy(m['$[]'](2))) { + + $b = m['$[]'](2).$split("."), $a = Opal.to_ary($b), (colspec = ($a[0] == null ? nil : $a[0])), (rowspec = ($a[1] == null ? nil : $a[1])), $b; + if ($truthy(($truthy($a = colspec['$nil_or_empty?']()['$!']()) ? $$($nesting, 'TableCellHorzAlignments')['$key?'](colspec) : $a))) { + + $writer = ["halign", $$($nesting, 'TableCellHorzAlignments')['$[]'](colspec)]; + $send(spec, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if ($truthy(($truthy($a = rowspec['$nil_or_empty?']()['$!']()) ? $$($nesting, 'TableCellVertAlignments')['$key?'](rowspec) : $a))) { + + $writer = ["valign", $$($nesting, 'TableCellVertAlignments')['$[]'](rowspec)]; + $send(spec, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];};}; + if ($truthy((width = m['$[]'](3)))) { + + $writer = ["width", (function() {if (width['$==']("~")) { + return -1 + } else { + return width.$to_i() + }; return nil; })()]; + $send(spec, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + } else { + + $writer = ["width", 1]; + $send(spec, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + if ($truthy(($truthy($a = m['$[]'](4)) ? $$($nesting, 'TableCellStyles')['$key?'](m['$[]'](4)) : $a))) { + + $writer = ["style", $$($nesting, 'TableCellStyles')['$[]'](m['$[]'](4))]; + $send(spec, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if ($truthy(m['$[]'](1))) { + return $send((1), 'upto', [m['$[]'](1).$to_i()], (TMP_67 = function(){var self = TMP_67.$$s || this; + + return specs['$<<'](spec.$dup())}, TMP_67.$$s = self, TMP_67.$$arity = 0, TMP_67)) + } else { + return specs['$<<'](spec) + }; + } else { + return nil + };}, TMP_66.$$s = self, TMP_66.$$arity = 1, TMP_66)); + return specs; + }, TMP_Parser_parse_colspecs_64.$$arity = 1); + Opal.defs(self, '$parse_cellspec', TMP_Parser_parse_cellspec_68 = function $$parse_cellspec(line, pos, delimiter) { + var $a, $b, self = this, m = nil, rest = nil, spec_part = nil, spec = nil, colspec = nil, rowspec = nil, $writer = nil; + + + + if (pos == null) { + pos = "end"; + }; + + if (delimiter == null) { + delimiter = nil; + }; + $a = [nil, ""], (m = $a[0]), (rest = $a[1]), $a; + if (pos['$==']("start")) { + if ($truthy(line['$include?'](delimiter))) { + + $b = line.$split(delimiter, 2), $a = Opal.to_ary($b), (spec_part = ($a[0] == null ? nil : $a[0])), (rest = ($a[1] == null ? nil : $a[1])), $b; + if ($truthy((m = $$($nesting, 'CellSpecStartRx').$match(spec_part)))) { + if ($truthy(m['$[]'](0)['$empty?']())) { + return [$hash2([], {}), rest]} + } else { + return [nil, line] + }; + } else { + return [nil, line] + } + } else if ($truthy((m = $$($nesting, 'CellSpecEndRx').$match(line)))) { + + if ($truthy(m['$[]'](0).$lstrip()['$empty?']())) { + return [$hash2([], {}), line.$rstrip()]}; + rest = m.$pre_match(); + } else { + return [$hash2([], {}), line] + }; + spec = $hash2([], {}); + if ($truthy(m['$[]'](1))) { + + $b = m['$[]'](1).$split("."), $a = Opal.to_ary($b), (colspec = ($a[0] == null ? nil : $a[0])), (rowspec = ($a[1] == null ? nil : $a[1])), $b; + colspec = (function() {if ($truthy(colspec['$nil_or_empty?']())) { + return 1 + } else { + return colspec.$to_i() + }; return nil; })(); + rowspec = (function() {if ($truthy(rowspec['$nil_or_empty?']())) { + return 1 + } else { + return rowspec.$to_i() + }; return nil; })(); + if (m['$[]'](2)['$==']("+")) { + + if (colspec['$=='](1)) { + } else { + + $writer = ["colspan", colspec]; + $send(spec, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + if (rowspec['$=='](1)) { + } else { + + $writer = ["rowspan", rowspec]; + $send(spec, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + } else if (m['$[]'](2)['$==']("*")) { + if (colspec['$=='](1)) { + } else { + + $writer = ["repeatcol", colspec]; + $send(spec, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }};}; + if ($truthy(m['$[]'](3))) { + + $b = m['$[]'](3).$split("."), $a = Opal.to_ary($b), (colspec = ($a[0] == null ? nil : $a[0])), (rowspec = ($a[1] == null ? nil : $a[1])), $b; + if ($truthy(($truthy($a = colspec['$nil_or_empty?']()['$!']()) ? $$($nesting, 'TableCellHorzAlignments')['$key?'](colspec) : $a))) { + + $writer = ["halign", $$($nesting, 'TableCellHorzAlignments')['$[]'](colspec)]; + $send(spec, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if ($truthy(($truthy($a = rowspec['$nil_or_empty?']()['$!']()) ? $$($nesting, 'TableCellVertAlignments')['$key?'](rowspec) : $a))) { + + $writer = ["valign", $$($nesting, 'TableCellVertAlignments')['$[]'](rowspec)]; + $send(spec, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];};}; + if ($truthy(($truthy($a = m['$[]'](4)) ? $$($nesting, 'TableCellStyles')['$key?'](m['$[]'](4)) : $a))) { + + $writer = ["style", $$($nesting, 'TableCellStyles')['$[]'](m['$[]'](4))]; + $send(spec, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + return [spec, rest]; + }, TMP_Parser_parse_cellspec_68.$$arity = -2); + Opal.defs(self, '$parse_style_attribute', TMP_Parser_parse_style_attribute_69 = function $$parse_style_attribute(attributes, reader) { + var $a, $b, TMP_70, TMP_71, TMP_72, self = this, raw_style = nil, type = nil, collector = nil, parsed = nil, save_current = nil, $writer = nil, parsed_style = nil, existing_role = nil, opts = nil, existing_opts = nil; + + + + if (reader == null) { + reader = nil; + }; + if ($truthy(($truthy($a = ($truthy($b = (raw_style = attributes['$[]'](1))) ? raw_style['$include?'](" ")['$!']() : $b)) ? $$($nesting, 'Compliance').$shorthand_property_syntax() : $a))) { + + $a = ["style", [], $hash2([], {})], (type = $a[0]), (collector = $a[1]), (parsed = $a[2]), $a; + save_current = $send(self, 'lambda', [], (TMP_70 = function(){var self = TMP_70.$$s || this, $c, $case = nil, $writer = nil; + + if ($truthy(collector['$empty?']())) { + if (type['$==']("style")) { + return nil + } else if ($truthy(reader)) { + return self.$logger().$warn(self.$message_with_context("" + "invalid empty " + (type) + " detected in style attribute", $hash2(["source_location"], {"source_location": reader.$cursor_at_prev_line()}))) + } else { + return self.$logger().$warn("" + "invalid empty " + (type) + " detected in style attribute") + } + } else { + + $case = type; + if ("role"['$===']($case) || "option"['$===']($case)) {($truthy($c = parsed['$[]'](type)) ? $c : (($writer = [type, []]), $send(parsed, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]))['$<<'](collector.$join())} + else if ("id"['$===']($case)) { + if ($truthy(parsed['$key?']("id"))) { + if ($truthy(reader)) { + self.$logger().$warn(self.$message_with_context("multiple ids detected in style attribute", $hash2(["source_location"], {"source_location": reader.$cursor_at_prev_line()}))) + } else { + self.$logger().$warn("multiple ids detected in style attribute") + }}; + + $writer = [type, collector.$join()]; + $send(parsed, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];;} + else { + $writer = [type, collector.$join()]; + $send(parsed, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + return (collector = []); + }}, TMP_70.$$s = self, TMP_70.$$arity = 0, TMP_70)); + $send(raw_style, 'each_char', [], (TMP_71 = function(c){var self = TMP_71.$$s || this, $c, $d, $case = nil; + + + + if (c == null) { + c = nil; + }; + if ($truthy(($truthy($c = ($truthy($d = c['$=='](".")) ? $d : c['$==']("#"))) ? $c : c['$==']("%")))) { + + save_current.$call(); + return (function() {$case = c; + if ("."['$===']($case)) {return (type = "role")} + else if ("#"['$===']($case)) {return (type = "id")} + else if ("%"['$===']($case)) {return (type = "option")} + else { return nil }})(); + } else { + return collector['$<<'](c) + };}, TMP_71.$$s = self, TMP_71.$$arity = 1, TMP_71)); + if (type['$==']("style")) { + + $writer = ["style", raw_style]; + $send(attributes, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + } else { + + save_current.$call(); + if ($truthy(parsed['$key?']("style"))) { + parsed_style = (($writer = ["style", parsed['$[]']("style")]), $send(attributes, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])}; + if ($truthy(parsed['$key?']("id"))) { + + $writer = ["id", parsed['$[]']("id")]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if ($truthy(parsed['$key?']("role"))) { + + $writer = ["role", (function() {if ($truthy((existing_role = attributes['$[]']("role"))['$nil_or_empty?']())) { + + return parsed['$[]']("role").$join(" "); + } else { + return "" + (existing_role) + " " + (parsed['$[]']("role").$join(" ")) + }; return nil; })()]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if ($truthy(parsed['$key?']("option"))) { + + $send((opts = parsed['$[]']("option")), 'each', [], (TMP_72 = function(opt){var self = TMP_72.$$s || this; + + + + if (opt == null) { + opt = nil; + }; + $writer = ["" + (opt) + "-option", ""]; + $send(attributes, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];}, TMP_72.$$s = self, TMP_72.$$arity = 1, TMP_72)); + + $writer = ["options", (function() {if ($truthy((existing_opts = attributes['$[]']("options"))['$nil_or_empty?']())) { + + return opts.$join(","); + } else { + return "" + (existing_opts) + "," + (opts.$join(",")) + }; return nil; })()]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];;}; + return parsed_style; + }; + } else { + + $writer = ["style", raw_style]; + $send(attributes, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + }; + }, TMP_Parser_parse_style_attribute_69.$$arity = -2); + Opal.defs(self, '$adjust_indentation!', TMP_Parser_adjust_indentation$B_73 = function(lines, indent, tab_size) { + var $a, TMP_74, TMP_77, TMP_78, TMP_79, TMP_80, self = this, full_tab_space = nil, gutter_width = nil, padding = nil; + + + + if (indent == null) { + indent = 0; + }; + + if (tab_size == null) { + tab_size = 0; + }; + if ($truthy(lines['$empty?']())) { + return nil}; + if ($truthy(($truthy($a = $rb_gt((tab_size = tab_size.$to_i()), 0)) ? lines.$join()['$include?']($$($nesting, 'TAB')) : $a))) { + + full_tab_space = $rb_times(" ", tab_size); + $send(lines, 'map!', [], (TMP_74 = function(line){var self = TMP_74.$$s || this, TMP_75, TMP_76, spaces_added = nil; + + + + if (line == null) { + line = nil; + }; + if ($truthy(line['$empty?']())) { + return line;}; + if ($truthy(line['$start_with?']($$($nesting, 'TAB')))) { + line = $send(line, 'sub', [$$($nesting, 'TabIndentRx')], (TMP_75 = function(){var self = TMP_75.$$s || this, $b; + + return $rb_times(full_tab_space, (($b = $gvars['~']) === nil ? nil : $b['$[]'](0)).$length())}, TMP_75.$$s = self, TMP_75.$$arity = 0, TMP_75))}; + if ($truthy(line['$include?']($$($nesting, 'TAB')))) { + + spaces_added = 0; + return line = $send(line, 'gsub', [$$($nesting, 'TabRx')], (TMP_76 = function(){var self = TMP_76.$$s || this, offset = nil, spaces = nil; + if ($gvars["~"] == null) $gvars["~"] = nil; + + if ((offset = $rb_plus($gvars["~"].$begin(0), spaces_added))['$%'](tab_size)['$=='](0)) { + + spaces_added = $rb_plus(spaces_added, $rb_minus(tab_size, 1)); + return full_tab_space; + } else { + + if ((spaces = $rb_minus(tab_size, offset['$%'](tab_size)))['$=='](1)) { + } else { + spaces_added = $rb_plus(spaces_added, $rb_minus(spaces, 1)) + }; + return $rb_times(" ", spaces); + }}, TMP_76.$$s = self, TMP_76.$$arity = 0, TMP_76)); + } else { + return line + };}, TMP_74.$$s = self, TMP_74.$$arity = 1, TMP_74));}; + if ($truthy(($truthy($a = indent) ? $rb_gt((indent = indent.$to_i()), -1) : $a))) { + } else { + return nil + }; + gutter_width = nil; + (function(){var $brk = Opal.new_brk(); try {return $send(lines, 'each', [], (TMP_77 = function(line){var self = TMP_77.$$s || this, $b, line_indent = nil; + + + + if (line == null) { + line = nil; + }; + if ($truthy(line['$empty?']())) { + return nil;}; + if ((line_indent = $rb_minus(line.$length(), line.$lstrip().$length()))['$=='](0)) { + + gutter_width = nil; + + Opal.brk(nil, $brk); + } else if ($truthy(($truthy($b = gutter_width) ? $rb_gt(line_indent, gutter_width) : $b))) { + return nil + } else { + return (gutter_width = line_indent) + };}, TMP_77.$$s = self, TMP_77.$$brk = $brk, TMP_77.$$arity = 1, TMP_77)) + } catch (err) { if (err === $brk) { return err.$v } else { throw err } }})(); + if (indent['$=='](0)) { + if ($truthy(gutter_width)) { + $send(lines, 'map!', [], (TMP_78 = function(line){var self = TMP_78.$$s || this; + + + + if (line == null) { + line = nil; + }; + if ($truthy(line['$empty?']())) { + return line + } else { + + return line.$slice(gutter_width, line.$length()); + };}, TMP_78.$$s = self, TMP_78.$$arity = 1, TMP_78))} + } else { + + padding = $rb_times(" ", indent); + if ($truthy(gutter_width)) { + $send(lines, 'map!', [], (TMP_79 = function(line){var self = TMP_79.$$s || this; + + + + if (line == null) { + line = nil; + }; + if ($truthy(line['$empty?']())) { + return line + } else { + return $rb_plus(padding, line.$slice(gutter_width, line.$length())) + };}, TMP_79.$$s = self, TMP_79.$$arity = 1, TMP_79)) + } else { + $send(lines, 'map!', [], (TMP_80 = function(line){var self = TMP_80.$$s || this; + + + + if (line == null) { + line = nil; + }; + if ($truthy(line['$empty?']())) { + return line + } else { + return $rb_plus(padding, line) + };}, TMP_80.$$s = self, TMP_80.$$arity = 1, TMP_80)) + }; + }; + return nil; + }, TMP_Parser_adjust_indentation$B_73.$$arity = -2); + return (Opal.defs(self, '$sanitize_attribute_name', TMP_Parser_sanitize_attribute_name_81 = function $$sanitize_attribute_name(name) { + var self = this; + + return name.$gsub($$($nesting, 'InvalidAttributeNameCharsRx'), "").$downcase() + }, TMP_Parser_sanitize_attribute_name_81.$$arity = 1), nil) && 'sanitize_attribute_name'; + })($nesting[0], null, $nesting) + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/path_resolver"] = function(Opal) { + function $rb_plus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); + } + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + function $rb_gt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $truthy = Opal.truthy, $hash2 = Opal.hash2, $send = Opal.send; + + Opal.add_stubs(['$include', '$attr_accessor', '$root?', '$posixify', '$expand_path', '$pwd', '$start_with?', '$==', '$match?', '$absolute_path?', '$+', '$length', '$descends_from?', '$slice', '$to_s', '$relative_path_from', '$new', '$include?', '$tr', '$partition_path', '$each', '$pop', '$<<', '$join_path', '$[]', '$web_root?', '$unc?', '$index', '$split', '$delete', '$[]=', '$-', '$join', '$raise', '$!', '$fetch', '$warn', '$logger', '$empty?', '$nil_or_empty?', '$chomp', '$!=', '$>', '$size', '$end_with?', '$uri_prefix', '$gsub']); + return (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + (function($base, $super, $parent_nesting) { + function $PathResolver(){}; + var self = $PathResolver = $klass($base, $super, 'PathResolver', $PathResolver); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_PathResolver_initialize_1, TMP_PathResolver_absolute_path$q_2, $a, TMP_PathResolver_root$q_3, TMP_PathResolver_unc$q_4, TMP_PathResolver_web_root$q_5, TMP_PathResolver_descends_from$q_6, TMP_PathResolver_relative_path_7, TMP_PathResolver_posixify_8, TMP_PathResolver_expand_path_9, TMP_PathResolver_partition_path_11, TMP_PathResolver_join_path_12, TMP_PathResolver_system_path_13, TMP_PathResolver_web_path_16; + + def.file_separator = def._partition_path_web = def._partition_path_sys = def.working_dir = nil; + + self.$include($$($nesting, 'Logging')); + Opal.const_set($nesting[0], 'DOT', "."); + Opal.const_set($nesting[0], 'DOT_DOT', ".."); + Opal.const_set($nesting[0], 'DOT_SLASH', "./"); + Opal.const_set($nesting[0], 'SLASH', "/"); + Opal.const_set($nesting[0], 'BACKSLASH', "\\"); + Opal.const_set($nesting[0], 'DOUBLE_SLASH', "//"); + Opal.const_set($nesting[0], 'WindowsRootRx', /^(?:[a-zA-Z]:)?[\\\/]/); + self.$attr_accessor("file_separator"); + self.$attr_accessor("working_dir"); + + Opal.def(self, '$initialize', TMP_PathResolver_initialize_1 = function $$initialize(file_separator, working_dir) { + var $a, $b, self = this; + + + + if (file_separator == null) { + file_separator = nil; + }; + + if (working_dir == null) { + working_dir = nil; + }; + self.file_separator = ($truthy($a = ($truthy($b = file_separator) ? $b : $$$($$$('::', 'File'), 'ALT_SEPARATOR'))) ? $a : $$$($$$('::', 'File'), 'SEPARATOR')); + self.working_dir = (function() {if ($truthy(working_dir)) { + + if ($truthy(self['$root?'](working_dir))) { + + return self.$posixify(working_dir); + } else { + + return $$$('::', 'File').$expand_path(working_dir); + }; + } else { + return $$$('::', 'Dir').$pwd() + }; return nil; })(); + self._partition_path_sys = $hash2([], {}); + return (self._partition_path_web = $hash2([], {})); + }, TMP_PathResolver_initialize_1.$$arity = -1); + + Opal.def(self, '$absolute_path?', TMP_PathResolver_absolute_path$q_2 = function(path) { + var $a, $b, self = this; + + return ($truthy($a = path['$start_with?']($$($nesting, 'SLASH'))) ? $a : (($b = self.file_separator['$==']($$($nesting, 'BACKSLASH'))) ? $$($nesting, 'WindowsRootRx')['$match?'](path) : self.file_separator['$==']($$($nesting, 'BACKSLASH')))) + }, TMP_PathResolver_absolute_path$q_2.$$arity = 1); + if ($truthy((($a = $$($nesting, 'RUBY_ENGINE')['$==']("opal")) ? $$$('::', 'JAVASCRIPT_IO_MODULE')['$==']("xmlhttprequest") : $$($nesting, 'RUBY_ENGINE')['$==']("opal")))) { + + Opal.def(self, '$root?', TMP_PathResolver_root$q_3 = function(path) { + var $a, self = this; + + return ($truthy($a = self['$absolute_path?'](path)) ? $a : path['$start_with?']("file://", "http://", "https://")) + }, TMP_PathResolver_root$q_3.$$arity = 1) + } else { + Opal.alias(self, "root?", "absolute_path?") + }; + + Opal.def(self, '$unc?', TMP_PathResolver_unc$q_4 = function(path) { + var self = this; + + return path['$start_with?']($$($nesting, 'DOUBLE_SLASH')) + }, TMP_PathResolver_unc$q_4.$$arity = 1); + + Opal.def(self, '$web_root?', TMP_PathResolver_web_root$q_5 = function(path) { + var self = this; + + return path['$start_with?']($$($nesting, 'SLASH')) + }, TMP_PathResolver_web_root$q_5.$$arity = 1); + + Opal.def(self, '$descends_from?', TMP_PathResolver_descends_from$q_6 = function(path, base) { + var $a, self = this; + + if (base['$=='](path)) { + return 0 + } else if (base['$==']($$($nesting, 'SLASH'))) { + return ($truthy($a = path['$start_with?']($$($nesting, 'SLASH'))) ? 1 : $a) + } else { + return ($truthy($a = path['$start_with?']($rb_plus(base, $$($nesting, 'SLASH')))) ? $rb_plus(base.$length(), 1) : $a) + } + }, TMP_PathResolver_descends_from$q_6.$$arity = 2); + + Opal.def(self, '$relative_path', TMP_PathResolver_relative_path_7 = function $$relative_path(path, base) { + var self = this, offset = nil; + + if ($truthy(self['$root?'](path))) { + if ($truthy((offset = self['$descends_from?'](path, base)))) { + return path.$slice(offset, path.$length()) + } else { + return $$($nesting, 'Pathname').$new(path).$relative_path_from($$($nesting, 'Pathname').$new(base)).$to_s() + } + } else { + return path + } + }, TMP_PathResolver_relative_path_7.$$arity = 2); + + Opal.def(self, '$posixify', TMP_PathResolver_posixify_8 = function $$posixify(path) { + var $a, self = this; + + if ($truthy(path)) { + if ($truthy((($a = self.file_separator['$==']($$($nesting, 'BACKSLASH'))) ? path['$include?']($$($nesting, 'BACKSLASH')) : self.file_separator['$==']($$($nesting, 'BACKSLASH'))))) { + + return path.$tr($$($nesting, 'BACKSLASH'), $$($nesting, 'SLASH')); + } else { + return path + } + } else { + return "" + } + }, TMP_PathResolver_posixify_8.$$arity = 1); + Opal.alias(self, "posixfy", "posixify"); + + Opal.def(self, '$expand_path', TMP_PathResolver_expand_path_9 = function $$expand_path(path) { + var $a, $b, TMP_10, self = this, path_segments = nil, path_root = nil, resolved_segments = nil; + + + $b = self.$partition_path(path), $a = Opal.to_ary($b), (path_segments = ($a[0] == null ? nil : $a[0])), (path_root = ($a[1] == null ? nil : $a[1])), $b; + if ($truthy(path['$include?']($$($nesting, 'DOT_DOT')))) { + + resolved_segments = []; + $send(path_segments, 'each', [], (TMP_10 = function(segment){var self = TMP_10.$$s || this; + + + + if (segment == null) { + segment = nil; + }; + if (segment['$==']($$($nesting, 'DOT_DOT'))) { + return resolved_segments.$pop() + } else { + return resolved_segments['$<<'](segment) + };}, TMP_10.$$s = self, TMP_10.$$arity = 1, TMP_10)); + return self.$join_path(resolved_segments, path_root); + } else { + return self.$join_path(path_segments, path_root) + }; + }, TMP_PathResolver_expand_path_9.$$arity = 1); + + Opal.def(self, '$partition_path', TMP_PathResolver_partition_path_11 = function $$partition_path(path, web) { + var self = this, result = nil, cache = nil, posix_path = nil, root = nil, path_segments = nil, $writer = nil; + + + + if (web == null) { + web = nil; + }; + if ($truthy((result = (cache = (function() {if ($truthy(web)) { + return self._partition_path_web + } else { + return self._partition_path_sys + }; return nil; })())['$[]'](path)))) { + return result}; + posix_path = self.$posixify(path); + if ($truthy(web)) { + if ($truthy(self['$web_root?'](posix_path))) { + root = $$($nesting, 'SLASH') + } else if ($truthy(posix_path['$start_with?']($$($nesting, 'DOT_SLASH')))) { + root = $$($nesting, 'DOT_SLASH')} + } else if ($truthy(self['$root?'](posix_path))) { + if ($truthy(self['$unc?'](posix_path))) { + root = $$($nesting, 'DOUBLE_SLASH') + } else if ($truthy(posix_path['$start_with?']($$($nesting, 'SLASH')))) { + root = $$($nesting, 'SLASH') + } else { + root = posix_path.$slice(0, $rb_plus(posix_path.$index($$($nesting, 'SLASH')), 1)) + } + } else if ($truthy(posix_path['$start_with?']($$($nesting, 'DOT_SLASH')))) { + root = $$($nesting, 'DOT_SLASH')}; + path_segments = (function() {if ($truthy(root)) { + + return posix_path.$slice(root.$length(), posix_path.$length()); + } else { + return posix_path + }; return nil; })().$split($$($nesting, 'SLASH')); + path_segments.$delete($$($nesting, 'DOT')); + + $writer = [path, [path_segments, root]]; + $send(cache, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];; + }, TMP_PathResolver_partition_path_11.$$arity = -2); + + Opal.def(self, '$join_path', TMP_PathResolver_join_path_12 = function $$join_path(segments, root) { + var self = this; + + + + if (root == null) { + root = nil; + }; + if ($truthy(root)) { + return "" + (root) + (segments.$join($$($nesting, 'SLASH'))) + } else { + + return segments.$join($$($nesting, 'SLASH')); + }; + }, TMP_PathResolver_join_path_12.$$arity = -2); + + Opal.def(self, '$system_path', TMP_PathResolver_system_path_13 = function $$system_path(target, start, jail, opts) { + var $a, $b, TMP_14, TMP_15, self = this, target_path = nil, target_segments = nil, _ = nil, jail_segments = nil, jail_root = nil, recheck = nil, start_segments = nil, start_root = nil, resolved_segments = nil, unresolved_segments = nil, warned = nil; + + + + if (start == null) { + start = nil; + }; + + if (jail == null) { + jail = nil; + }; + + if (opts == null) { + opts = $hash2([], {}); + }; + if ($truthy(jail)) { + + if ($truthy(self['$root?'](jail))) { + } else { + self.$raise($$$('::', 'SecurityError'), "" + "Jail is not an absolute path: " + (jail)) + }; + jail = self.$posixify(jail);}; + if ($truthy(target)) { + if ($truthy(self['$root?'](target))) { + + target_path = self.$expand_path(target); + if ($truthy(($truthy($a = jail) ? self['$descends_from?'](target_path, jail)['$!']() : $a))) { + if ($truthy(opts.$fetch("recover", true))) { + + self.$logger().$warn("" + (($truthy($a = opts['$[]']("target_name")) ? $a : "path")) + " is outside of jail; recovering automatically"); + $b = self.$partition_path(target_path), $a = Opal.to_ary($b), (target_segments = ($a[0] == null ? nil : $a[0])), (_ = ($a[1] == null ? nil : $a[1])), $b; + $b = self.$partition_path(jail), $a = Opal.to_ary($b), (jail_segments = ($a[0] == null ? nil : $a[0])), (jail_root = ($a[1] == null ? nil : $a[1])), $b; + return self.$join_path($rb_plus(jail_segments, target_segments), jail_root); + } else { + self.$raise($$$('::', 'SecurityError'), "" + (($truthy($a = opts['$[]']("target_name")) ? $a : "path")) + " " + (target) + " is outside of jail: " + (jail) + " (disallowed in safe mode)") + }}; + return target_path; + } else { + $b = self.$partition_path(target), $a = Opal.to_ary($b), (target_segments = ($a[0] == null ? nil : $a[0])), (_ = ($a[1] == null ? nil : $a[1])), $b + } + } else { + target_segments = [] + }; + if ($truthy(target_segments['$empty?']())) { + if ($truthy(start['$nil_or_empty?']())) { + return ($truthy($a = jail) ? $a : self.working_dir) + } else if ($truthy(self['$root?'](start))) { + if ($truthy(jail)) { + start = self.$posixify(start) + } else { + return self.$expand_path(start) + } + } else { + + $b = self.$partition_path(start), $a = Opal.to_ary($b), (target_segments = ($a[0] == null ? nil : $a[0])), (_ = ($a[1] == null ? nil : $a[1])), $b; + start = ($truthy($a = jail) ? $a : self.working_dir); + } + } else if ($truthy(start['$nil_or_empty?']())) { + start = ($truthy($a = jail) ? $a : self.working_dir) + } else if ($truthy(self['$root?'](start))) { + if ($truthy(jail)) { + start = self.$posixify(start)} + } else { + start = "" + (($truthy($a = jail) ? $a : self.working_dir).$chomp("/")) + "/" + (start) + }; + if ($truthy(($truthy($a = ($truthy($b = jail) ? (recheck = self['$descends_from?'](start, jail)['$!']()) : $b)) ? self.file_separator['$==']($$($nesting, 'BACKSLASH')) : $a))) { + + $b = self.$partition_path(start), $a = Opal.to_ary($b), (start_segments = ($a[0] == null ? nil : $a[0])), (start_root = ($a[1] == null ? nil : $a[1])), $b; + $b = self.$partition_path(jail), $a = Opal.to_ary($b), (jail_segments = ($a[0] == null ? nil : $a[0])), (jail_root = ($a[1] == null ? nil : $a[1])), $b; + if ($truthy(start_root['$!='](jail_root))) { + if ($truthy(opts.$fetch("recover", true))) { + + self.$logger().$warn("" + "start path for " + (($truthy($a = opts['$[]']("target_name")) ? $a : "path")) + " is outside of jail root; recovering automatically"); + start_segments = jail_segments; + recheck = false; + } else { + self.$raise($$$('::', 'SecurityError'), "" + "start path for " + (($truthy($a = opts['$[]']("target_name")) ? $a : "path")) + " " + (start) + " refers to location outside jail root: " + (jail) + " (disallowed in safe mode)") + }}; + } else { + $b = self.$partition_path(start), $a = Opal.to_ary($b), (start_segments = ($a[0] == null ? nil : $a[0])), (jail_root = ($a[1] == null ? nil : $a[1])), $b + }; + if ($truthy((resolved_segments = $rb_plus(start_segments, target_segments))['$include?']($$($nesting, 'DOT_DOT')))) { + + $a = [resolved_segments, []], (unresolved_segments = $a[0]), (resolved_segments = $a[1]), $a; + if ($truthy(jail)) { + + if ($truthy(jail_segments)) { + } else { + $b = self.$partition_path(jail), $a = Opal.to_ary($b), (jail_segments = ($a[0] == null ? nil : $a[0])), (_ = ($a[1] == null ? nil : $a[1])), $b + }; + warned = false; + $send(unresolved_segments, 'each', [], (TMP_14 = function(segment){var self = TMP_14.$$s || this, $c; + + + + if (segment == null) { + segment = nil; + }; + if (segment['$==']($$($nesting, 'DOT_DOT'))) { + if ($truthy($rb_gt(resolved_segments.$size(), jail_segments.$size()))) { + return resolved_segments.$pop() + } else if ($truthy(opts.$fetch("recover", true))) { + if ($truthy(warned)) { + return nil + } else { + + self.$logger().$warn("" + (($truthy($c = opts['$[]']("target_name")) ? $c : "path")) + " has illegal reference to ancestor of jail; recovering automatically"); + return (warned = true); + } + } else { + return self.$raise($$$('::', 'SecurityError'), "" + (($truthy($c = opts['$[]']("target_name")) ? $c : "path")) + " " + (target) + " refers to location outside jail: " + (jail) + " (disallowed in safe mode)") + } + } else { + return resolved_segments['$<<'](segment) + };}, TMP_14.$$s = self, TMP_14.$$arity = 1, TMP_14)); + } else { + $send(unresolved_segments, 'each', [], (TMP_15 = function(segment){var self = TMP_15.$$s || this; + + + + if (segment == null) { + segment = nil; + }; + if (segment['$==']($$($nesting, 'DOT_DOT'))) { + return resolved_segments.$pop() + } else { + return resolved_segments['$<<'](segment) + };}, TMP_15.$$s = self, TMP_15.$$arity = 1, TMP_15)) + };}; + if ($truthy(recheck)) { + + target_path = self.$join_path(resolved_segments, jail_root); + if ($truthy(self['$descends_from?'](target_path, jail))) { + return target_path + } else if ($truthy(opts.$fetch("recover", true))) { + + self.$logger().$warn("" + (($truthy($a = opts['$[]']("target_name")) ? $a : "path")) + " is outside of jail; recovering automatically"); + if ($truthy(jail_segments)) { + } else { + $b = self.$partition_path(jail), $a = Opal.to_ary($b), (jail_segments = ($a[0] == null ? nil : $a[0])), (_ = ($a[1] == null ? nil : $a[1])), $b + }; + return self.$join_path($rb_plus(jail_segments, target_segments), jail_root); + } else { + return self.$raise($$$('::', 'SecurityError'), "" + (($truthy($a = opts['$[]']("target_name")) ? $a : "path")) + " " + (target) + " is outside of jail: " + (jail) + " (disallowed in safe mode)") + }; + } else { + return self.$join_path(resolved_segments, jail_root) + }; + }, TMP_PathResolver_system_path_13.$$arity = -2); + return (Opal.def(self, '$web_path', TMP_PathResolver_web_path_16 = function $$web_path(target, start) { + var $a, $b, TMP_17, self = this, uri_prefix = nil, target_segments = nil, target_root = nil, resolved_segments = nil, resolved_path = nil; + + + + if (start == null) { + start = nil; + }; + target = self.$posixify(target); + start = self.$posixify(start); + uri_prefix = nil; + if ($truthy(($truthy($a = start['$nil_or_empty?']()) ? $a : self['$web_root?'](target)))) { + } else { + + target = (function() {if ($truthy(start['$end_with?']($$($nesting, 'SLASH')))) { + return "" + (start) + (target) + } else { + return "" + (start) + ($$($nesting, 'SLASH')) + (target) + }; return nil; })(); + if ($truthy((uri_prefix = $$($nesting, 'Helpers').$uri_prefix(target)))) { + target = target['$[]'](Opal.Range.$new(uri_prefix.$length(), -1, false))}; + }; + $b = self.$partition_path(target, true), $a = Opal.to_ary($b), (target_segments = ($a[0] == null ? nil : $a[0])), (target_root = ($a[1] == null ? nil : $a[1])), $b; + resolved_segments = []; + $send(target_segments, 'each', [], (TMP_17 = function(segment){var self = TMP_17.$$s || this, $c; + + + + if (segment == null) { + segment = nil; + }; + if (segment['$==']($$($nesting, 'DOT_DOT'))) { + if ($truthy(resolved_segments['$empty?']())) { + if ($truthy(($truthy($c = target_root) ? target_root['$!=']($$($nesting, 'DOT_SLASH')) : $c))) { + return nil + } else { + return resolved_segments['$<<'](segment) + } + } else if (resolved_segments['$[]'](-1)['$==']($$($nesting, 'DOT_DOT'))) { + return resolved_segments['$<<'](segment) + } else { + return resolved_segments.$pop() + } + } else { + return resolved_segments['$<<'](segment) + };}, TMP_17.$$s = self, TMP_17.$$arity = 1, TMP_17)); + if ($truthy((resolved_path = self.$join_path(resolved_segments, target_root))['$include?'](" "))) { + resolved_path = resolved_path.$gsub(" ", "%20")}; + if ($truthy(uri_prefix)) { + return "" + (uri_prefix) + (resolved_path) + } else { + return resolved_path + }; + }, TMP_PathResolver_web_path_16.$$arity = -2), nil) && 'web_path'; + })($nesting[0], null, $nesting) + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/reader"] = function(Opal) { + function $rb_plus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); + } + function $rb_gt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); + } + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + function $rb_times(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs * rhs : lhs['$*'](rhs); + } + function $rb_lt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); + } + function $rb_ge(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs >= rhs : lhs['$>='](rhs); + } + function $rb_divide(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs / rhs : lhs['$/'](rhs); + } + function $rb_le(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs <= rhs : lhs['$<='](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $hash2 = Opal.hash2, $truthy = Opal.truthy, $send = Opal.send, $gvars = Opal.gvars, $hash = Opal.hash; + + Opal.add_stubs(['$include', '$attr_reader', '$+', '$attr_accessor', '$!', '$===', '$split', '$file', '$dir', '$dirname', '$path', '$basename', '$lineno', '$prepare_lines', '$drop', '$[]', '$normalize_lines_from_string', '$normalize_lines_array', '$empty?', '$nil_or_empty?', '$peek_line', '$>', '$slice', '$length', '$process_line', '$times', '$shift', '$read_line', '$<<', '$-', '$unshift_all', '$has_more_lines?', '$join', '$read_lines', '$unshift', '$start_with?', '$==', '$*', '$read_lines_until', '$size', '$clear', '$cursor', '$[]=', '$!=', '$fetch', '$cursor_at_mark', '$warn', '$logger', '$message_with_context', '$new', '$each', '$instance_variables', '$instance_variable_get', '$dup', '$instance_variable_set', '$to_i', '$attributes', '$<', '$catalog', '$skip_front_matter!', '$pop', '$adjust_indentation!', '$attr', '$end_with?', '$include?', '$=~', '$preprocess_conditional_directive', '$preprocess_include_directive', '$pop_include', '$downcase', '$error', '$none?', '$key?', '$any?', '$all?', '$strip', '$resolve_expr_val', '$send', '$to_sym', '$replace_next_line', '$rstrip', '$sub_attributes', '$attribute_missing', '$include_processors?', '$find', '$handles?', '$instance', '$process_method', '$parse_attributes', '$>=', '$safe', '$resolve_include_path', '$split_delimited_value', '$/', '$to_a', '$uniq', '$sort', '$open', '$each_line', '$infinite?', '$push_include', '$delete', '$value?', '$force_encoding', '$create_include_cursor', '$rindex', '$delete_at', '$nil?', '$keys', '$read', '$uriish?', '$attr?', '$require_library', '$parse', '$normalize_system_path', '$file?', '$relative_path', '$path_resolver', '$base_dir', '$to_s', '$path=', '$extname', '$rootname', '$<=', '$to_f', '$extensions?', '$extensions', '$include_processors', '$class', '$object_id', '$inspect', '$map']); + return (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + + (function($base, $super, $parent_nesting) { + function $Reader(){}; + var self = $Reader = $klass($base, $super, 'Reader', $Reader); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Reader_initialize_4, TMP_Reader_prepare_lines_5, TMP_Reader_process_line_6, TMP_Reader_has_more_lines$q_7, TMP_Reader_empty$q_8, TMP_Reader_next_line_empty$q_9, TMP_Reader_peek_line_10, TMP_Reader_peek_lines_11, TMP_Reader_read_line_13, TMP_Reader_read_lines_14, TMP_Reader_read_15, TMP_Reader_advance_16, TMP_Reader_unshift_line_17, TMP_Reader_unshift_lines_18, TMP_Reader_replace_next_line_19, TMP_Reader_skip_blank_lines_20, TMP_Reader_skip_comment_lines_21, TMP_Reader_skip_line_comments_22, TMP_Reader_terminate_23, TMP_Reader_read_lines_until_24, TMP_Reader_shift_25, TMP_Reader_unshift_26, TMP_Reader_unshift_all_27, TMP_Reader_cursor_28, TMP_Reader_cursor_at_line_29, TMP_Reader_cursor_at_mark_30, TMP_Reader_cursor_before_mark_31, TMP_Reader_cursor_at_prev_line_32, TMP_Reader_mark_33, TMP_Reader_line_info_34, TMP_Reader_lines_35, TMP_Reader_string_36, TMP_Reader_source_37, TMP_Reader_save_38, TMP_Reader_restore_save_40, TMP_Reader_discard_save_42; + + def.file = def.lines = def.process_lines = def.look_ahead = def.unescape_next_line = def.lineno = def.dir = def.path = def.mark = def.source_lines = def.saved = nil; + + self.$include($$($nesting, 'Logging')); + (function($base, $super, $parent_nesting) { + function $Cursor(){}; + var self = $Cursor = $klass($base, $super, 'Cursor', $Cursor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Cursor_initialize_1, TMP_Cursor_advance_2, TMP_Cursor_line_info_3; + + def.lineno = def.path = nil; + + self.$attr_reader("file", "dir", "path", "lineno"); + + Opal.def(self, '$initialize', TMP_Cursor_initialize_1 = function $$initialize(file, dir, path, lineno) { + var $a, self = this; + + + + if (dir == null) { + dir = nil; + }; + + if (path == null) { + path = nil; + }; + + if (lineno == null) { + lineno = 1; + }; + return $a = [file, dir, path, lineno], (self.file = $a[0]), (self.dir = $a[1]), (self.path = $a[2]), (self.lineno = $a[3]), $a; + }, TMP_Cursor_initialize_1.$$arity = -2); + + Opal.def(self, '$advance', TMP_Cursor_advance_2 = function $$advance(num) { + var self = this; + + return (self.lineno = $rb_plus(self.lineno, num)) + }, TMP_Cursor_advance_2.$$arity = 1); + + Opal.def(self, '$line_info', TMP_Cursor_line_info_3 = function $$line_info() { + var self = this; + + return "" + (self.path) + ": line " + (self.lineno) + }, TMP_Cursor_line_info_3.$$arity = 0); + return Opal.alias(self, "to_s", "line_info"); + })($nesting[0], null, $nesting); + self.$attr_reader("file"); + self.$attr_reader("dir"); + self.$attr_reader("path"); + self.$attr_reader("lineno"); + self.$attr_reader("source_lines"); + self.$attr_accessor("process_lines"); + self.$attr_accessor("unterminated"); + + Opal.def(self, '$initialize', TMP_Reader_initialize_4 = function $$initialize(data, cursor, opts) { + var $a, $b, self = this; + + + + if (data == null) { + data = nil; + }; + + if (cursor == null) { + cursor = nil; + }; + + if (opts == null) { + opts = $hash2([], {}); + }; + if ($truthy(cursor['$!']())) { + + self.file = nil; + self.dir = "."; + self.path = ""; + self.lineno = 1; + } else if ($truthy($$$('::', 'String')['$==='](cursor))) { + + self.file = cursor; + $b = $$$('::', 'File').$split(self.file), $a = Opal.to_ary($b), (self.dir = ($a[0] == null ? nil : $a[0])), (self.path = ($a[1] == null ? nil : $a[1])), $b; + self.lineno = 1; + } else { + + if ($truthy((self.file = cursor.$file()))) { + + self.dir = ($truthy($a = cursor.$dir()) ? $a : $$$('::', 'File').$dirname(self.file)); + self.path = ($truthy($a = cursor.$path()) ? $a : $$$('::', 'File').$basename(self.file)); + } else { + + self.dir = ($truthy($a = cursor.$dir()) ? $a : "."); + self.path = ($truthy($a = cursor.$path()) ? $a : ""); + }; + self.lineno = ($truthy($a = cursor.$lineno()) ? $a : 1); + }; + self.lines = (function() {if ($truthy(data)) { + + return self.$prepare_lines(data, opts); + } else { + return [] + }; return nil; })(); + self.source_lines = self.lines.$drop(0); + self.mark = nil; + self.look_ahead = 0; + self.process_lines = true; + self.unescape_next_line = false; + self.unterminated = nil; + return (self.saved = nil); + }, TMP_Reader_initialize_4.$$arity = -1); + + Opal.def(self, '$prepare_lines', TMP_Reader_prepare_lines_5 = function $$prepare_lines(data, opts) { + var self = this; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + if ($truthy($$$('::', 'String')['$==='](data))) { + if ($truthy(opts['$[]']("normalize"))) { + return $$($nesting, 'Helpers').$normalize_lines_from_string(data) + } else { + return data.$split($$($nesting, 'LF'), -1) + } + } else if ($truthy(opts['$[]']("normalize"))) { + return $$($nesting, 'Helpers').$normalize_lines_array(data) + } else { + return data.$drop(0) + }; + }, TMP_Reader_prepare_lines_5.$$arity = -2); + + Opal.def(self, '$process_line', TMP_Reader_process_line_6 = function $$process_line(line) { + var self = this; + + + if ($truthy(self.process_lines)) { + self.look_ahead = $rb_plus(self.look_ahead, 1)}; + return line; + }, TMP_Reader_process_line_6.$$arity = 1); + + Opal.def(self, '$has_more_lines?', TMP_Reader_has_more_lines$q_7 = function() { + var self = this; + + if ($truthy(self.lines['$empty?']())) { + + self.look_ahead = 0; + return false; + } else { + return true + } + }, TMP_Reader_has_more_lines$q_7.$$arity = 0); + + Opal.def(self, '$empty?', TMP_Reader_empty$q_8 = function() { + var self = this; + + if ($truthy(self.lines['$empty?']())) { + + self.look_ahead = 0; + return true; + } else { + return false + } + }, TMP_Reader_empty$q_8.$$arity = 0); + Opal.alias(self, "eof?", "empty?"); + + Opal.def(self, '$next_line_empty?', TMP_Reader_next_line_empty$q_9 = function() { + var self = this; + + return self.$peek_line()['$nil_or_empty?']() + }, TMP_Reader_next_line_empty$q_9.$$arity = 0); + + Opal.def(self, '$peek_line', TMP_Reader_peek_line_10 = function $$peek_line(direct) { + var $a, self = this, line = nil; + + + + if (direct == null) { + direct = false; + }; + if ($truthy(($truthy($a = direct) ? $a : $rb_gt(self.look_ahead, 0)))) { + if ($truthy(self.unescape_next_line)) { + + return (line = self.lines['$[]'](0)).$slice(1, line.$length()); + } else { + return self.lines['$[]'](0) + } + } else if ($truthy(self.lines['$empty?']())) { + + self.look_ahead = 0; + return nil; + } else if ($truthy((line = self.$process_line(self.lines['$[]'](0))))) { + return line + } else { + return self.$peek_line() + }; + }, TMP_Reader_peek_line_10.$$arity = -1); + + Opal.def(self, '$peek_lines', TMP_Reader_peek_lines_11 = function $$peek_lines(num, direct) { + var $a, TMP_12, self = this, old_look_ahead = nil, result = nil; + + + + if (num == null) { + num = nil; + }; + + if (direct == null) { + direct = false; + }; + old_look_ahead = self.look_ahead; + result = []; + (function(){var $brk = Opal.new_brk(); try {return $send(($truthy($a = num) ? $a : $$($nesting, 'MAX_INT')), 'times', [], (TMP_12 = function(){var self = TMP_12.$$s || this, line = nil; + if (self.lineno == null) self.lineno = nil; + + if ($truthy((line = (function() {if ($truthy(direct)) { + return self.$shift() + } else { + return self.$read_line() + }; return nil; })()))) { + return result['$<<'](line) + } else { + + if ($truthy(direct)) { + self.lineno = $rb_minus(self.lineno, 1)}; + + Opal.brk(nil, $brk); + }}, TMP_12.$$s = self, TMP_12.$$brk = $brk, TMP_12.$$arity = 0, TMP_12)) + } catch (err) { if (err === $brk) { return err.$v } else { throw err } }})(); + if ($truthy(result['$empty?']())) { + } else { + + self.$unshift_all(result); + if ($truthy(direct)) { + self.look_ahead = old_look_ahead}; + }; + return result; + }, TMP_Reader_peek_lines_11.$$arity = -1); + + Opal.def(self, '$read_line', TMP_Reader_read_line_13 = function $$read_line() { + var $a, self = this; + + if ($truthy(($truthy($a = $rb_gt(self.look_ahead, 0)) ? $a : self['$has_more_lines?']()))) { + return self.$shift() + } else { + return nil + } + }, TMP_Reader_read_line_13.$$arity = 0); + + Opal.def(self, '$read_lines', TMP_Reader_read_lines_14 = function $$read_lines() { + var $a, self = this, lines = nil; + + + lines = []; + while ($truthy(self['$has_more_lines?']())) { + lines['$<<'](self.$shift()) + }; + return lines; + }, TMP_Reader_read_lines_14.$$arity = 0); + Opal.alias(self, "readlines", "read_lines"); + + Opal.def(self, '$read', TMP_Reader_read_15 = function $$read() { + var self = this; + + return self.$read_lines().$join($$($nesting, 'LF')) + }, TMP_Reader_read_15.$$arity = 0); + + Opal.def(self, '$advance', TMP_Reader_advance_16 = function $$advance() { + var self = this; + + if ($truthy(self.$shift())) { + return true + } else { + return false + } + }, TMP_Reader_advance_16.$$arity = 0); + + Opal.def(self, '$unshift_line', TMP_Reader_unshift_line_17 = function $$unshift_line(line_to_restore) { + var self = this; + + + self.$unshift(line_to_restore); + return nil; + }, TMP_Reader_unshift_line_17.$$arity = 1); + Opal.alias(self, "restore_line", "unshift_line"); + + Opal.def(self, '$unshift_lines', TMP_Reader_unshift_lines_18 = function $$unshift_lines(lines_to_restore) { + var self = this; + + + self.$unshift_all(lines_to_restore); + return nil; + }, TMP_Reader_unshift_lines_18.$$arity = 1); + Opal.alias(self, "restore_lines", "unshift_lines"); + + Opal.def(self, '$replace_next_line', TMP_Reader_replace_next_line_19 = function $$replace_next_line(replacement) { + var self = this; + + + self.$shift(); + self.$unshift(replacement); + return true; + }, TMP_Reader_replace_next_line_19.$$arity = 1); + Opal.alias(self, "replace_line", "replace_next_line"); + + Opal.def(self, '$skip_blank_lines', TMP_Reader_skip_blank_lines_20 = function $$skip_blank_lines() { + var $a, self = this, num_skipped = nil, next_line = nil; + + + if ($truthy(self['$empty?']())) { + return nil}; + num_skipped = 0; + while ($truthy((next_line = self.$peek_line()))) { + if ($truthy(next_line['$empty?']())) { + + self.$shift(); + num_skipped = $rb_plus(num_skipped, 1); + } else { + return num_skipped + } + }; + }, TMP_Reader_skip_blank_lines_20.$$arity = 0); + + Opal.def(self, '$skip_comment_lines', TMP_Reader_skip_comment_lines_21 = function $$skip_comment_lines() { + var $a, $b, self = this, next_line = nil, ll = nil; + + + if ($truthy(self['$empty?']())) { + return nil}; + while ($truthy(($truthy($b = (next_line = self.$peek_line())) ? next_line['$empty?']()['$!']() : $b))) { + if ($truthy(next_line['$start_with?']("//"))) { + if ($truthy(next_line['$start_with?']("///"))) { + if ($truthy(($truthy($b = $rb_gt((ll = next_line.$length()), 3)) ? next_line['$==']($rb_times("/", ll)) : $b))) { + self.$read_lines_until($hash2(["terminator", "skip_first_line", "read_last_line", "skip_processing", "context"], {"terminator": next_line, "skip_first_line": true, "read_last_line": true, "skip_processing": true, "context": "comment"})) + } else { + break; + } + } else { + self.$shift() + } + } else { + break; + } + }; + return nil; + }, TMP_Reader_skip_comment_lines_21.$$arity = 0); + + Opal.def(self, '$skip_line_comments', TMP_Reader_skip_line_comments_22 = function $$skip_line_comments() { + var $a, $b, self = this, comment_lines = nil, next_line = nil; + + + if ($truthy(self['$empty?']())) { + return []}; + comment_lines = []; + while ($truthy(($truthy($b = (next_line = self.$peek_line())) ? next_line['$empty?']()['$!']() : $b))) { + if ($truthy(next_line['$start_with?']("//"))) { + comment_lines['$<<'](self.$shift()) + } else { + break; + } + }; + return comment_lines; + }, TMP_Reader_skip_line_comments_22.$$arity = 0); + + Opal.def(self, '$terminate', TMP_Reader_terminate_23 = function $$terminate() { + var self = this; + + + self.lineno = $rb_plus(self.lineno, self.lines.$size()); + self.lines.$clear(); + self.look_ahead = 0; + return nil; + }, TMP_Reader_terminate_23.$$arity = 0); + + Opal.def(self, '$read_lines_until', TMP_Reader_read_lines_until_24 = function $$read_lines_until(options) { + var $a, $b, $c, $d, $iter = TMP_Reader_read_lines_until_24.$$p, $yield = $iter || nil, self = this, result = nil, restore_process_lines = nil, terminator = nil, start_cursor = nil, break_on_blank_lines = nil, break_on_list_continuation = nil, skip_comments = nil, complete = nil, line_read = nil, line_restored = nil, line = nil, $writer = nil, context = nil; + + if ($iter) TMP_Reader_read_lines_until_24.$$p = null; + + + if (options == null) { + options = $hash2([], {}); + }; + result = []; + if ($truthy(($truthy($a = self.process_lines) ? options['$[]']("skip_processing") : $a))) { + + self.process_lines = false; + restore_process_lines = true;}; + if ($truthy((terminator = options['$[]']("terminator")))) { + + start_cursor = ($truthy($a = options['$[]']("cursor")) ? $a : self.$cursor()); + break_on_blank_lines = false; + break_on_list_continuation = false; + } else { + + break_on_blank_lines = options['$[]']("break_on_blank_lines"); + break_on_list_continuation = options['$[]']("break_on_list_continuation"); + }; + skip_comments = options['$[]']("skip_line_comments"); + complete = (line_read = (line_restored = nil)); + if ($truthy(options['$[]']("skip_first_line"))) { + self.$shift()}; + while ($truthy(($truthy($b = complete['$!']()) ? (line = self.$read_line()) : $b))) { + + complete = (function() {while ($truthy(true)) { + + if ($truthy(($truthy($c = terminator) ? line['$=='](terminator) : $c))) { + return true}; + if ($truthy(($truthy($c = break_on_blank_lines) ? line['$empty?']() : $c))) { + return true}; + if ($truthy(($truthy($c = ($truthy($d = break_on_list_continuation) ? line_read : $d)) ? line['$==']($$($nesting, 'LIST_CONTINUATION')) : $c))) { + + + $writer = ["preserve_last_line", true]; + $send(options, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + return true;}; + if ($truthy((($c = ($yield !== nil)) ? Opal.yield1($yield, line) : ($yield !== nil)))) { + return true}; + return false; + }; return nil; })(); + if ($truthy(complete)) { + + if ($truthy(options['$[]']("read_last_line"))) { + + result['$<<'](line); + line_read = true;}; + if ($truthy(options['$[]']("preserve_last_line"))) { + + self.$unshift(line); + line_restored = true;}; + } else if ($truthy(($truthy($b = ($truthy($c = skip_comments) ? line['$start_with?']("//") : $c)) ? line['$start_with?']("///")['$!']() : $b))) { + } else { + + result['$<<'](line); + line_read = true; + }; + }; + if ($truthy(restore_process_lines)) { + + self.process_lines = true; + if ($truthy(($truthy($a = line_restored) ? terminator['$!']() : $a))) { + self.look_ahead = $rb_minus(self.look_ahead, 1)};}; + if ($truthy(($truthy($a = ($truthy($b = terminator) ? terminator['$!='](line) : $b)) ? (context = options.$fetch("context", terminator)) : $a))) { + + if (start_cursor['$==']("at_mark")) { + start_cursor = self.$cursor_at_mark()}; + self.$logger().$warn(self.$message_with_context("" + "unterminated " + (context) + " block", $hash2(["source_location"], {"source_location": start_cursor}))); + self.unterminated = true;}; + return result; + }, TMP_Reader_read_lines_until_24.$$arity = -1); + + Opal.def(self, '$shift', TMP_Reader_shift_25 = function $$shift() { + var self = this; + + + self.lineno = $rb_plus(self.lineno, 1); + if (self.look_ahead['$=='](0)) { + } else { + self.look_ahead = $rb_minus(self.look_ahead, 1) + }; + return self.lines.$shift(); + }, TMP_Reader_shift_25.$$arity = 0); + + Opal.def(self, '$unshift', TMP_Reader_unshift_26 = function $$unshift(line) { + var self = this; + + + self.lineno = $rb_minus(self.lineno, 1); + self.look_ahead = $rb_plus(self.look_ahead, 1); + return self.lines.$unshift(line); + }, TMP_Reader_unshift_26.$$arity = 1); + + Opal.def(self, '$unshift_all', TMP_Reader_unshift_all_27 = function $$unshift_all(lines) { + var self = this; + + + self.lineno = $rb_minus(self.lineno, lines.$size()); + self.look_ahead = $rb_plus(self.look_ahead, lines.$size()); + return $send(self.lines, 'unshift', Opal.to_a(lines)); + }, TMP_Reader_unshift_all_27.$$arity = 1); + + Opal.def(self, '$cursor', TMP_Reader_cursor_28 = function $$cursor() { + var self = this; + + return $$($nesting, 'Cursor').$new(self.file, self.dir, self.path, self.lineno) + }, TMP_Reader_cursor_28.$$arity = 0); + + Opal.def(self, '$cursor_at_line', TMP_Reader_cursor_at_line_29 = function $$cursor_at_line(lineno) { + var self = this; + + return $$($nesting, 'Cursor').$new(self.file, self.dir, self.path, lineno) + }, TMP_Reader_cursor_at_line_29.$$arity = 1); + + Opal.def(self, '$cursor_at_mark', TMP_Reader_cursor_at_mark_30 = function $$cursor_at_mark() { + var self = this; + + if ($truthy(self.mark)) { + return $send($$($nesting, 'Cursor'), 'new', Opal.to_a(self.mark)) + } else { + return self.$cursor() + } + }, TMP_Reader_cursor_at_mark_30.$$arity = 0); + + Opal.def(self, '$cursor_before_mark', TMP_Reader_cursor_before_mark_31 = function $$cursor_before_mark() { + var $a, $b, self = this, m_file = nil, m_dir = nil, m_path = nil, m_lineno = nil; + + if ($truthy(self.mark)) { + + $b = self.mark, $a = Opal.to_ary($b), (m_file = ($a[0] == null ? nil : $a[0])), (m_dir = ($a[1] == null ? nil : $a[1])), (m_path = ($a[2] == null ? nil : $a[2])), (m_lineno = ($a[3] == null ? nil : $a[3])), $b; + return $$($nesting, 'Cursor').$new(m_file, m_dir, m_path, $rb_minus(m_lineno, 1)); + } else { + return $$($nesting, 'Cursor').$new(self.file, self.dir, self.path, $rb_minus(self.lineno, 1)) + } + }, TMP_Reader_cursor_before_mark_31.$$arity = 0); + + Opal.def(self, '$cursor_at_prev_line', TMP_Reader_cursor_at_prev_line_32 = function $$cursor_at_prev_line() { + var self = this; + + return $$($nesting, 'Cursor').$new(self.file, self.dir, self.path, $rb_minus(self.lineno, 1)) + }, TMP_Reader_cursor_at_prev_line_32.$$arity = 0); + + Opal.def(self, '$mark', TMP_Reader_mark_33 = function $$mark() { + var self = this; + + return (self.mark = [self.file, self.dir, self.path, self.lineno]) + }, TMP_Reader_mark_33.$$arity = 0); + + Opal.def(self, '$line_info', TMP_Reader_line_info_34 = function $$line_info() { + var self = this; + + return "" + (self.path) + ": line " + (self.lineno) + }, TMP_Reader_line_info_34.$$arity = 0); + + Opal.def(self, '$lines', TMP_Reader_lines_35 = function $$lines() { + var self = this; + + return self.lines.$drop(0) + }, TMP_Reader_lines_35.$$arity = 0); + + Opal.def(self, '$string', TMP_Reader_string_36 = function $$string() { + var self = this; + + return self.lines.$join($$($nesting, 'LF')) + }, TMP_Reader_string_36.$$arity = 0); + + Opal.def(self, '$source', TMP_Reader_source_37 = function $$source() { + var self = this; + + return self.source_lines.$join($$($nesting, 'LF')) + }, TMP_Reader_source_37.$$arity = 0); + + Opal.def(self, '$save', TMP_Reader_save_38 = function $$save() { + var TMP_39, self = this, accum = nil; + + + accum = $hash2([], {}); + $send(self.$instance_variables(), 'each', [], (TMP_39 = function(name){var self = TMP_39.$$s || this, $a, $writer = nil, val = nil; + + + + if (name == null) { + name = nil; + }; + if ($truthy(($truthy($a = name['$==']("@saved")) ? $a : name['$==']("@source_lines")))) { + return nil + } else { + + $writer = [name, (function() {if ($truthy($$$('::', 'Array')['$===']((val = self.$instance_variable_get(name))))) { + return val.$dup() + } else { + return val + }; return nil; })()]; + $send(accum, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + };}, TMP_39.$$s = self, TMP_39.$$arity = 1, TMP_39)); + self.saved = accum; + return nil; + }, TMP_Reader_save_38.$$arity = 0); + + Opal.def(self, '$restore_save', TMP_Reader_restore_save_40 = function $$restore_save() { + var TMP_41, self = this; + + if ($truthy(self.saved)) { + + $send(self.saved, 'each', [], (TMP_41 = function(name, val){var self = TMP_41.$$s || this; + + + + if (name == null) { + name = nil; + }; + + if (val == null) { + val = nil; + }; + return self.$instance_variable_set(name, val);}, TMP_41.$$s = self, TMP_41.$$arity = 2, TMP_41)); + return (self.saved = nil); + } else { + return nil + } + }, TMP_Reader_restore_save_40.$$arity = 0); + + Opal.def(self, '$discard_save', TMP_Reader_discard_save_42 = function $$discard_save() { + var self = this; + + return (self.saved = nil) + }, TMP_Reader_discard_save_42.$$arity = 0); + return Opal.alias(self, "to_s", "line_info"); + })($nesting[0], null, $nesting); + (function($base, $super, $parent_nesting) { + function $PreprocessorReader(){}; + var self = $PreprocessorReader = $klass($base, $super, 'PreprocessorReader', $PreprocessorReader); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_PreprocessorReader_initialize_43, TMP_PreprocessorReader_prepare_lines_44, TMP_PreprocessorReader_process_line_45, TMP_PreprocessorReader_has_more_lines$q_46, TMP_PreprocessorReader_empty$q_47, TMP_PreprocessorReader_peek_line_48, TMP_PreprocessorReader_preprocess_conditional_directive_49, TMP_PreprocessorReader_preprocess_include_directive_54, TMP_PreprocessorReader_resolve_include_path_66, TMP_PreprocessorReader_push_include_67, TMP_PreprocessorReader_create_include_cursor_68, TMP_PreprocessorReader_pop_include_69, TMP_PreprocessorReader_include_depth_70, TMP_PreprocessorReader_exceeded_max_depth$q_71, TMP_PreprocessorReader_shift_72, TMP_PreprocessorReader_split_delimited_value_73, TMP_PreprocessorReader_skip_front_matter$B_74, TMP_PreprocessorReader_resolve_expr_val_75, TMP_PreprocessorReader_include_processors$q_76, TMP_PreprocessorReader_to_s_77; + + def.document = def.lineno = def.process_lines = def.look_ahead = def.skipping = def.include_stack = def.conditional_stack = def.path = def.include_processor_extensions = def.maxdepth = def.dir = def.lines = def.file = def.includes = def.unescape_next_line = nil; + + self.$attr_reader("include_stack"); + + Opal.def(self, '$initialize', TMP_PreprocessorReader_initialize_43 = function $$initialize(document, data, cursor, opts) { + var $iter = TMP_PreprocessorReader_initialize_43.$$p, $yield = $iter || nil, self = this, include_depth_default = nil; + + if ($iter) TMP_PreprocessorReader_initialize_43.$$p = null; + + + if (data == null) { + data = nil; + }; + + if (cursor == null) { + cursor = nil; + }; + + if (opts == null) { + opts = $hash2([], {}); + }; + self.document = document; + $send(self, Opal.find_super_dispatcher(self, 'initialize', TMP_PreprocessorReader_initialize_43, false), [data, cursor, opts], null); + include_depth_default = document.$attributes().$fetch("max-include-depth", 64).$to_i(); + if ($truthy($rb_lt(include_depth_default, 0))) { + include_depth_default = 0}; + self.maxdepth = $hash2(["abs", "rel"], {"abs": include_depth_default, "rel": include_depth_default}); + self.include_stack = []; + self.includes = document.$catalog()['$[]']("includes"); + self.skipping = false; + self.conditional_stack = []; + return (self.include_processor_extensions = nil); + }, TMP_PreprocessorReader_initialize_43.$$arity = -2); + + Opal.def(self, '$prepare_lines', TMP_PreprocessorReader_prepare_lines_44 = function $$prepare_lines(data, opts) { + var $a, $b, $iter = TMP_PreprocessorReader_prepare_lines_44.$$p, $yield = $iter || nil, self = this, result = nil, front_matter = nil, $writer = nil, first = nil, last = nil, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_PreprocessorReader_prepare_lines_44.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + + + if (opts == null) { + opts = $hash2([], {}); + }; + result = $send(self, Opal.find_super_dispatcher(self, 'prepare_lines', TMP_PreprocessorReader_prepare_lines_44, false), $zuper, $iter); + if ($truthy(($truthy($a = self.document) ? self.document.$attributes()['$[]']("skip-front-matter") : $a))) { + if ($truthy((front_matter = self['$skip_front_matter!'](result)))) { + + $writer = ["front-matter", front_matter.$join($$($nesting, 'LF'))]; + $send(self.document.$attributes(), '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}}; + if ($truthy(opts.$fetch("condense", true))) { + + while ($truthy(($truthy($b = (first = result['$[]'](0))) ? first['$empty?']() : $b))) { + ($truthy($b = result.$shift()) ? (self.lineno = $rb_plus(self.lineno, 1)) : $b) + }; + while ($truthy(($truthy($b = (last = result['$[]'](-1))) ? last['$empty?']() : $b))) { + result.$pop() + };}; + if ($truthy(opts['$[]']("indent"))) { + $$($nesting, 'Parser')['$adjust_indentation!'](result, opts['$[]']("indent"), self.document.$attr("tabsize"))}; + return result; + }, TMP_PreprocessorReader_prepare_lines_44.$$arity = -2); + + Opal.def(self, '$process_line', TMP_PreprocessorReader_process_line_45 = function $$process_line(line) { + var $a, $b, self = this; + + + if ($truthy(self.process_lines)) { + } else { + return line + }; + if ($truthy(line['$empty?']())) { + + self.look_ahead = $rb_plus(self.look_ahead, 1); + return line;}; + if ($truthy(($truthy($a = ($truthy($b = line['$end_with?']("]")) ? line['$start_with?']("[")['$!']() : $b)) ? line['$include?']("::") : $a))) { + if ($truthy(($truthy($a = line['$include?']("if")) ? $$($nesting, 'ConditionalDirectiveRx')['$=~'](line) : $a))) { + if ((($a = $gvars['~']) === nil ? nil : $a['$[]'](1))['$==']("\\")) { + + self.unescape_next_line = true; + self.look_ahead = $rb_plus(self.look_ahead, 1); + return line.$slice(1, line.$length()); + } else if ($truthy(self.$preprocess_conditional_directive((($a = $gvars['~']) === nil ? nil : $a['$[]'](2)), (($a = $gvars['~']) === nil ? nil : $a['$[]'](3)), (($a = $gvars['~']) === nil ? nil : $a['$[]'](4)), (($a = $gvars['~']) === nil ? nil : $a['$[]'](5))))) { + + self.$shift(); + return nil; + } else { + + self.look_ahead = $rb_plus(self.look_ahead, 1); + return line; + } + } else if ($truthy(self.skipping)) { + + self.$shift(); + return nil; + } else if ($truthy(($truthy($a = line['$start_with?']("inc", "\\inc")) ? $$($nesting, 'IncludeDirectiveRx')['$=~'](line) : $a))) { + if ((($a = $gvars['~']) === nil ? nil : $a['$[]'](1))['$==']("\\")) { + + self.unescape_next_line = true; + self.look_ahead = $rb_plus(self.look_ahead, 1); + return line.$slice(1, line.$length()); + } else if ($truthy(self.$preprocess_include_directive((($a = $gvars['~']) === nil ? nil : $a['$[]'](2)), (($a = $gvars['~']) === nil ? nil : $a['$[]'](3))))) { + return nil + } else { + + self.look_ahead = $rb_plus(self.look_ahead, 1); + return line; + } + } else { + + self.look_ahead = $rb_plus(self.look_ahead, 1); + return line; + } + } else if ($truthy(self.skipping)) { + + self.$shift(); + return nil; + } else { + + self.look_ahead = $rb_plus(self.look_ahead, 1); + return line; + }; + }, TMP_PreprocessorReader_process_line_45.$$arity = 1); + + Opal.def(self, '$has_more_lines?', TMP_PreprocessorReader_has_more_lines$q_46 = function() { + var self = this; + + if ($truthy(self.$peek_line())) { + return true + } else { + return false + } + }, TMP_PreprocessorReader_has_more_lines$q_46.$$arity = 0); + + Opal.def(self, '$empty?', TMP_PreprocessorReader_empty$q_47 = function() { + var self = this; + + if ($truthy(self.$peek_line())) { + return false + } else { + return true + } + }, TMP_PreprocessorReader_empty$q_47.$$arity = 0); + Opal.alias(self, "eof?", "empty?"); + + Opal.def(self, '$peek_line', TMP_PreprocessorReader_peek_line_48 = function $$peek_line(direct) { + var $iter = TMP_PreprocessorReader_peek_line_48.$$p, $yield = $iter || nil, self = this, line = nil, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_PreprocessorReader_peek_line_48.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + + + if (direct == null) { + direct = false; + }; + if ($truthy((line = $send(self, Opal.find_super_dispatcher(self, 'peek_line', TMP_PreprocessorReader_peek_line_48, false), $zuper, $iter)))) { + return line + } else if ($truthy(self.include_stack['$empty?']())) { + return nil + } else { + + self.$pop_include(); + return self.$peek_line(direct); + }; + }, TMP_PreprocessorReader_peek_line_48.$$arity = -1); + + Opal.def(self, '$preprocess_conditional_directive', TMP_PreprocessorReader_preprocess_conditional_directive_49 = function $$preprocess_conditional_directive(keyword, target, delimiter, text) { + var $a, $b, $c, TMP_50, TMP_51, TMP_52, TMP_53, self = this, no_target = nil, pair = nil, skip = nil, $case = nil, lhs = nil, op = nil, rhs = nil; + + + if ($truthy((no_target = target['$empty?']()))) { + } else { + target = target.$downcase() + }; + if ($truthy(($truthy($a = ($truthy($b = no_target) ? ($truthy($c = keyword['$==']("ifdef")) ? $c : keyword['$==']("ifndef")) : $b)) ? $a : ($truthy($b = text) ? keyword['$==']("endif") : $b)))) { + return false}; + if (keyword['$==']("endif")) { + + if ($truthy(self.conditional_stack['$empty?']())) { + self.$logger().$error(self.$message_with_context("" + "unmatched macro: endif::" + (target) + "[]", $hash2(["source_location"], {"source_location": self.$cursor()}))) + } else if ($truthy(($truthy($a = no_target) ? $a : target['$==']((pair = self.conditional_stack['$[]'](-1))['$[]']("target"))))) { + + self.conditional_stack.$pop(); + self.skipping = (function() {if ($truthy(self.conditional_stack['$empty?']())) { + return false + } else { + return self.conditional_stack['$[]'](-1)['$[]']("skipping") + }; return nil; })(); + } else { + self.$logger().$error(self.$message_with_context("" + "mismatched macro: endif::" + (target) + "[], expected endif::" + (pair['$[]']("target")) + "[]", $hash2(["source_location"], {"source_location": self.$cursor()}))) + }; + return true;}; + if ($truthy(self.skipping)) { + skip = false + } else { + $case = keyword; + if ("ifdef"['$===']($case)) {$case = delimiter; + if (","['$===']($case)) {skip = $send(target.$split(",", -1), 'none?', [], (TMP_50 = function(name){var self = TMP_50.$$s || this; + if (self.document == null) self.document = nil; + + + + if (name == null) { + name = nil; + }; + return self.document.$attributes()['$key?'](name);}, TMP_50.$$s = self, TMP_50.$$arity = 1, TMP_50))} + else if ("+"['$===']($case)) {skip = $send(target.$split("+", -1), 'any?', [], (TMP_51 = function(name){var self = TMP_51.$$s || this; + if (self.document == null) self.document = nil; + + + + if (name == null) { + name = nil; + }; + return self.document.$attributes()['$key?'](name)['$!']();}, TMP_51.$$s = self, TMP_51.$$arity = 1, TMP_51))} + else {skip = self.document.$attributes()['$key?'](target)['$!']()}} + else if ("ifndef"['$===']($case)) {$case = delimiter; + if (","['$===']($case)) {skip = $send(target.$split(",", -1), 'any?', [], (TMP_52 = function(name){var self = TMP_52.$$s || this; + if (self.document == null) self.document = nil; + + + + if (name == null) { + name = nil; + }; + return self.document.$attributes()['$key?'](name);}, TMP_52.$$s = self, TMP_52.$$arity = 1, TMP_52))} + else if ("+"['$===']($case)) {skip = $send(target.$split("+", -1), 'all?', [], (TMP_53 = function(name){var self = TMP_53.$$s || this; + if (self.document == null) self.document = nil; + + + + if (name == null) { + name = nil; + }; + return self.document.$attributes()['$key?'](name);}, TMP_53.$$s = self, TMP_53.$$arity = 1, TMP_53))} + else {skip = self.document.$attributes()['$key?'](target)}} + else if ("ifeval"['$===']($case)) { + if ($truthy(($truthy($a = no_target) ? $$($nesting, 'EvalExpressionRx')['$=~'](text.$strip()) : $a))) { + } else { + return false + }; + $a = [(($b = $gvars['~']) === nil ? nil : $b['$[]'](1)), (($b = $gvars['~']) === nil ? nil : $b['$[]'](2)), (($b = $gvars['~']) === nil ? nil : $b['$[]'](3))], (lhs = $a[0]), (op = $a[1]), (rhs = $a[2]), $a; + lhs = self.$resolve_expr_val(lhs); + rhs = self.$resolve_expr_val(rhs); + if (op['$==']("!=")) { + skip = lhs.$send("==", rhs) + } else { + skip = lhs.$send(op.$to_sym(), rhs)['$!']() + };} + }; + if ($truthy(($truthy($a = keyword['$==']("ifeval")) ? $a : text['$!']()))) { + + if ($truthy(skip)) { + self.skipping = true}; + self.conditional_stack['$<<']($hash2(["target", "skip", "skipping"], {"target": target, "skip": skip, "skipping": self.skipping})); + } else if ($truthy(($truthy($a = self.skipping) ? $a : skip))) { + } else { + + self.$replace_next_line(text.$rstrip()); + self.$unshift(""); + if ($truthy(text['$start_with?']("include::"))) { + self.look_ahead = $rb_minus(self.look_ahead, 1)}; + }; + return true; + }, TMP_PreprocessorReader_preprocess_conditional_directive_49.$$arity = 4); + + Opal.def(self, '$preprocess_include_directive', TMP_PreprocessorReader_preprocess_include_directive_54 = function $$preprocess_include_directive(target, attrlist) { + var $a, TMP_55, $b, TMP_56, TMP_57, TMP_58, TMP_60, TMP_63, TMP_64, TMP_65, self = this, doc = nil, expanded_target = nil, ext = nil, abs_maxdepth = nil, parsed_attrs = nil, inc_path = nil, target_type = nil, relpath = nil, inc_linenos = nil, inc_tags = nil, tag = nil, inc_lines = nil, inc_offset = nil, inc_lineno = nil, $writer = nil, tag_stack = nil, tags_used = nil, active_tag = nil, select = nil, base_select = nil, wildcard = nil, missing_tags = nil, inc_content = nil; + + + doc = self.document; + if ($truthy(($truthy($a = (expanded_target = target)['$include?']($$($nesting, 'ATTR_REF_HEAD'))) ? (expanded_target = doc.$sub_attributes(target, $hash2(["attribute_missing"], {"attribute_missing": "drop-line"})))['$empty?']() : $a))) { + + self.$shift(); + if (($truthy($a = doc.$attributes()['$[]']("attribute-missing")) ? $a : $$($nesting, 'Compliance').$attribute_missing())['$==']("skip")) { + self.$unshift("" + "Unresolved directive in " + (self.path) + " - include::" + (target) + "[" + (attrlist) + "]")}; + return true; + } else if ($truthy(($truthy($a = self['$include_processors?']()) ? (ext = $send(self.include_processor_extensions, 'find', [], (TMP_55 = function(candidate){var self = TMP_55.$$s || this; + + + + if (candidate == null) { + candidate = nil; + }; + return candidate.$instance()['$handles?'](expanded_target);}, TMP_55.$$s = self, TMP_55.$$arity = 1, TMP_55))) : $a))) { + + self.$shift(); + ext.$process_method()['$[]'](doc, self, expanded_target, doc.$parse_attributes(attrlist, [], $hash2(["sub_input"], {"sub_input": true}))); + return true; + } else if ($truthy($rb_ge(doc.$safe(), $$$($$($nesting, 'SafeMode'), 'SECURE')))) { + return self.$replace_next_line("" + "link:" + (expanded_target) + "[]") + } else if ($truthy($rb_gt((abs_maxdepth = self.maxdepth['$[]']("abs")), 0))) { + + if ($truthy($rb_ge(self.include_stack.$size(), abs_maxdepth))) { + + self.$logger().$error(self.$message_with_context("" + "maximum include depth of " + (self.maxdepth['$[]']("rel")) + " exceeded", $hash2(["source_location"], {"source_location": self.$cursor()}))); + return nil;}; + parsed_attrs = doc.$parse_attributes(attrlist, [], $hash2(["sub_input"], {"sub_input": true})); + $b = self.$resolve_include_path(expanded_target, attrlist, parsed_attrs), $a = Opal.to_ary($b), (inc_path = ($a[0] == null ? nil : $a[0])), (target_type = ($a[1] == null ? nil : $a[1])), (relpath = ($a[2] == null ? nil : $a[2])), $b; + if ($truthy(target_type)) { + } else { + return inc_path + }; + inc_linenos = (inc_tags = nil); + if ($truthy(attrlist)) { + if ($truthy(parsed_attrs['$key?']("lines"))) { + + inc_linenos = []; + $send(self.$split_delimited_value(parsed_attrs['$[]']("lines")), 'each', [], (TMP_56 = function(linedef){var self = TMP_56.$$s || this, $c, $d, from = nil, to = nil; + + + + if (linedef == null) { + linedef = nil; + }; + if ($truthy(linedef['$include?'](".."))) { + + $d = linedef.$split("..", 2), $c = Opal.to_ary($d), (from = ($c[0] == null ? nil : $c[0])), (to = ($c[1] == null ? nil : $c[1])), $d; + return (inc_linenos = $rb_plus(inc_linenos, (function() {if ($truthy(($truthy($c = to['$empty?']()) ? $c : $rb_lt((to = to.$to_i()), 0)))) { + return [from.$to_i(), $rb_divide(1, 0)] + } else { + return $$$('::', 'Range').$new(from.$to_i(), to).$to_a() + }; return nil; })())); + } else { + return inc_linenos['$<<'](linedef.$to_i()) + };}, TMP_56.$$s = self, TMP_56.$$arity = 1, TMP_56)); + inc_linenos = (function() {if ($truthy(inc_linenos['$empty?']())) { + return nil + } else { + return inc_linenos.$sort().$uniq() + }; return nil; })(); + } else if ($truthy(parsed_attrs['$key?']("tag"))) { + if ($truthy(($truthy($a = (tag = parsed_attrs['$[]']("tag"))['$empty?']()) ? $a : tag['$==']("!")))) { + } else { + inc_tags = (function() {if ($truthy(tag['$start_with?']("!"))) { + return $hash(tag.$slice(1, tag.$length()), false) + } else { + return $hash(tag, true) + }; return nil; })() + } + } else if ($truthy(parsed_attrs['$key?']("tags"))) { + + inc_tags = $hash2([], {}); + $send(self.$split_delimited_value(parsed_attrs['$[]']("tags")), 'each', [], (TMP_57 = function(tagdef){var self = TMP_57.$$s || this, $c, $writer = nil; + + + + if (tagdef == null) { + tagdef = nil; + }; + if ($truthy(($truthy($c = tagdef['$empty?']()) ? $c : tagdef['$==']("!")))) { + return nil + } else if ($truthy(tagdef['$start_with?']("!"))) { + + $writer = [tagdef.$slice(1, tagdef.$length()), false]; + $send(inc_tags, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + } else { + + $writer = [tagdef, true]; + $send(inc_tags, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + };}, TMP_57.$$s = self, TMP_57.$$arity = 1, TMP_57)); + if ($truthy(inc_tags['$empty?']())) { + inc_tags = nil};}}; + if ($truthy(inc_linenos)) { + + $a = [[], nil, 0], (inc_lines = $a[0]), (inc_offset = $a[1]), (inc_lineno = $a[2]), $a; + + try { + (function(){var $brk = Opal.new_brk(); try {return $send(self, 'open', [inc_path, "rb"], (TMP_58 = function(f){var self = TMP_58.$$s || this, TMP_59, select_remaining = nil; + + + + if (f == null) { + f = nil; + }; + select_remaining = nil; + return (function(){var $brk = Opal.new_brk(); try {return $send(f, 'each_line', [], (TMP_59 = function(l){var self = TMP_59.$$s || this, $c, $d, select = nil; + + + + if (l == null) { + l = nil; + }; + inc_lineno = $rb_plus(inc_lineno, 1); + if ($truthy(($truthy($c = select_remaining) ? $c : ($truthy($d = $$$('::', 'Float')['$===']((select = inc_linenos['$[]'](0)))) ? (select_remaining = select['$infinite?']()) : $d)))) { + + inc_offset = ($truthy($c = inc_offset) ? $c : inc_lineno); + return inc_lines['$<<'](l); + } else { + + if (select['$=='](inc_lineno)) { + + inc_offset = ($truthy($c = inc_offset) ? $c : inc_lineno); + inc_lines['$<<'](l); + inc_linenos.$shift();}; + if ($truthy(inc_linenos['$empty?']())) { + + Opal.brk(nil, $brk) + } else { + return nil + }; + };}, TMP_59.$$s = self, TMP_59.$$brk = $brk, TMP_59.$$arity = 1, TMP_59)) + } catch (err) { if (err === $brk) { return err.$v } else { throw err } }})();}, TMP_58.$$s = self, TMP_58.$$brk = $brk, TMP_58.$$arity = 1, TMP_58)) + } catch (err) { if (err === $brk) { return err.$v } else { throw err } }})() + } catch ($err) { + if (Opal.rescue($err, [$$($nesting, 'StandardError')])) { + try { + + self.$logger().$error(self.$message_with_context("" + "include " + (target_type) + " not readable: " + (inc_path), $hash2(["source_location"], {"source_location": self.$cursor()}))); + return self.$replace_next_line("" + "Unresolved directive in " + (self.path) + " - include::" + (expanded_target) + "[" + (attrlist) + "]"); + } finally { Opal.pop_exception() } + } else { throw $err; } + };; + self.$shift(); + if ($truthy(inc_offset)) { + + + $writer = ["partial-option", true]; + $send(parsed_attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + self.$push_include(inc_lines, inc_path, relpath, inc_offset, parsed_attrs);}; + } else if ($truthy(inc_tags)) { + + $a = [[], nil, 0, [], $$$('::', 'Set').$new(), nil], (inc_lines = $a[0]), (inc_offset = $a[1]), (inc_lineno = $a[2]), (tag_stack = $a[3]), (tags_used = $a[4]), (active_tag = $a[5]), $a; + if ($truthy(inc_tags['$key?']("**"))) { + if ($truthy(inc_tags['$key?']("*"))) { + + select = (base_select = inc_tags.$delete("**")); + wildcard = inc_tags.$delete("*"); + } else { + select = (base_select = (wildcard = inc_tags.$delete("**"))) + } + } else { + + select = (base_select = inc_tags['$value?'](true)['$!']()); + wildcard = inc_tags.$delete("*"); + }; + + try { + $send(self, 'open', [inc_path, "rb"], (TMP_60 = function(f){var self = TMP_60.$$s || this, $c, TMP_61, dbl_co = nil, dbl_sb = nil, encoding = nil; + + + + if (f == null) { + f = nil; + }; + $c = ["::", "[]"], (dbl_co = $c[0]), (dbl_sb = $c[1]), $c; + if ($truthy($$($nesting, 'COERCE_ENCODING'))) { + encoding = $$$($$$('::', 'Encoding'), 'UTF_8')}; + return $send(f, 'each_line', [], (TMP_61 = function(l){var self = TMP_61.$$s || this, $d, $e, TMP_62, this_tag = nil, include_cursor = nil, idx = nil; + + + + if (l == null) { + l = nil; + }; + inc_lineno = $rb_plus(inc_lineno, 1); + if ($truthy(encoding)) { + l.$force_encoding(encoding)}; + if ($truthy(($truthy($d = ($truthy($e = l['$include?'](dbl_co)) ? l['$include?'](dbl_sb) : $e)) ? $$($nesting, 'TagDirectiveRx')['$=~'](l) : $d))) { + if ($truthy((($d = $gvars['~']) === nil ? nil : $d['$[]'](1)))) { + if ((this_tag = (($d = $gvars['~']) === nil ? nil : $d['$[]'](2)))['$=='](active_tag)) { + + tag_stack.$pop(); + return $e = (function() {if ($truthy(tag_stack['$empty?']())) { + return [nil, base_select] + } else { + return tag_stack['$[]'](-1) + }; return nil; })(), $d = Opal.to_ary($e), (active_tag = ($d[0] == null ? nil : $d[0])), (select = ($d[1] == null ? nil : $d[1])), $e; + } else if ($truthy(inc_tags['$key?'](this_tag))) { + + include_cursor = self.$create_include_cursor(inc_path, expanded_target, inc_lineno); + if ($truthy((idx = $send(tag_stack, 'rindex', [], (TMP_62 = function(key, _){var self = TMP_62.$$s || this; + + + + if (key == null) { + key = nil; + }; + + if (_ == null) { + _ = nil; + }; + return key['$=='](this_tag);}, TMP_62.$$s = self, TMP_62.$$arity = 2, TMP_62))))) { + + if (idx['$=='](0)) { + tag_stack.$shift() + } else { + + tag_stack.$delete_at(idx); + }; + return self.$logger().$warn(self.$message_with_context("" + "mismatched end tag (expected '" + (active_tag) + "' but found '" + (this_tag) + "') at line " + (inc_lineno) + " of include " + (target_type) + ": " + (inc_path), $hash2(["source_location", "include_location"], {"source_location": self.$cursor(), "include_location": include_cursor}))); + } else { + return self.$logger().$warn(self.$message_with_context("" + "unexpected end tag '" + (this_tag) + "' at line " + (inc_lineno) + " of include " + (target_type) + ": " + (inc_path), $hash2(["source_location", "include_location"], {"source_location": self.$cursor(), "include_location": include_cursor}))) + }; + } else { + return nil + } + } else if ($truthy(inc_tags['$key?']((this_tag = (($d = $gvars['~']) === nil ? nil : $d['$[]'](2)))))) { + + tags_used['$<<'](this_tag); + return tag_stack['$<<']([(active_tag = this_tag), (select = inc_tags['$[]'](this_tag)), inc_lineno]); + } else if ($truthy(wildcard['$nil?']()['$!']())) { + + select = (function() {if ($truthy(($truthy($d = active_tag) ? select['$!']() : $d))) { + return false + } else { + return wildcard + }; return nil; })(); + return tag_stack['$<<']([(active_tag = this_tag), select, inc_lineno]); + } else { + return nil + } + } else if ($truthy(select)) { + + inc_offset = ($truthy($d = inc_offset) ? $d : inc_lineno); + return inc_lines['$<<'](l); + } else { + return nil + };}, TMP_61.$$s = self, TMP_61.$$arity = 1, TMP_61));}, TMP_60.$$s = self, TMP_60.$$arity = 1, TMP_60)) + } catch ($err) { + if (Opal.rescue($err, [$$($nesting, 'StandardError')])) { + try { + + self.$logger().$error(self.$message_with_context("" + "include " + (target_type) + " not readable: " + (inc_path), $hash2(["source_location"], {"source_location": self.$cursor()}))); + return self.$replace_next_line("" + "Unresolved directive in " + (self.path) + " - include::" + (expanded_target) + "[" + (attrlist) + "]"); + } finally { Opal.pop_exception() } + } else { throw $err; } + };; + if ($truthy(tag_stack['$empty?']())) { + } else { + $send(tag_stack, 'each', [], (TMP_63 = function(tag_name, _, tag_lineno){var self = TMP_63.$$s || this; + + + + if (tag_name == null) { + tag_name = nil; + }; + + if (_ == null) { + _ = nil; + }; + + if (tag_lineno == null) { + tag_lineno = nil; + }; + return self.$logger().$warn(self.$message_with_context("" + "detected unclosed tag '" + (tag_name) + "' starting at line " + (tag_lineno) + " of include " + (target_type) + ": " + (inc_path), $hash2(["source_location", "include_location"], {"source_location": self.$cursor(), "include_location": self.$create_include_cursor(inc_path, expanded_target, tag_lineno)})));}, TMP_63.$$s = self, TMP_63.$$arity = 3, TMP_63)) + }; + if ($truthy((missing_tags = $rb_minus(inc_tags.$keys().$to_a(), tags_used.$to_a()))['$empty?']())) { + } else { + self.$logger().$warn(self.$message_with_context("" + "tag" + ((function() {if ($truthy($rb_gt(missing_tags.$size(), 1))) { + return "s" + } else { + return "" + }; return nil; })()) + " '" + (missing_tags.$join(", ")) + "' not found in include " + (target_type) + ": " + (inc_path), $hash2(["source_location"], {"source_location": self.$cursor()}))) + }; + self.$shift(); + if ($truthy(inc_offset)) { + + if ($truthy(($truthy($a = ($truthy($b = base_select) ? wildcard : $b)) ? inc_tags['$empty?']() : $a))) { + } else { + + $writer = ["partial-option", true]; + $send(parsed_attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + self.$push_include(inc_lines, inc_path, relpath, inc_offset, parsed_attrs);}; + } else { + + try { + + inc_content = (function() {if (false) { + return $send($$$('::', 'File'), 'open', [inc_path, "rb"], (TMP_64 = function(f){var self = TMP_64.$$s || this; + + + + if (f == null) { + f = nil; + }; + return f.$read();}, TMP_64.$$s = self, TMP_64.$$arity = 1, TMP_64)) + } else { + return $send(self, 'open', [inc_path, "rb"], (TMP_65 = function(f){var self = TMP_65.$$s || this; + + + + if (f == null) { + f = nil; + }; + return f.$read();}, TMP_65.$$s = self, TMP_65.$$arity = 1, TMP_65)) + }; return nil; })(); + self.$shift(); + self.$push_include(inc_content, inc_path, relpath, 1, parsed_attrs); + } catch ($err) { + if (Opal.rescue($err, [$$($nesting, 'StandardError')])) { + try { + + self.$logger().$error(self.$message_with_context("" + "include " + (target_type) + " not readable: " + (inc_path), $hash2(["source_location"], {"source_location": self.$cursor()}))); + return self.$replace_next_line("" + "Unresolved directive in " + (self.path) + " - include::" + (expanded_target) + "[" + (attrlist) + "]"); + } finally { Opal.pop_exception() } + } else { throw $err; } + }; + }; + return true; + } else { + return nil + }; + }, TMP_PreprocessorReader_preprocess_include_directive_54.$$arity = 2); + + Opal.def(self, '$resolve_include_path', TMP_PreprocessorReader_resolve_include_path_66 = function $$resolve_include_path(target, attrlist, attributes) { + var $a, $b, self = this, doc = nil, inc_path = nil, relpath = nil; + + + doc = self.document; + if ($truthy(($truthy($a = $$($nesting, 'Helpers')['$uriish?'](target)) ? $a : (function() {if ($truthy($$$('::', 'String')['$==='](self.dir))) { + return nil + } else { + + return (target = "" + (self.dir) + "/" + (target)); + }; return nil; })()))) { + + if ($truthy(doc['$attr?']("allow-uri-read"))) { + } else { + return self.$replace_next_line("" + "link:" + (target) + "[" + (attrlist) + "]") + }; + if ($truthy(doc['$attr?']("cache-uri"))) { + if ($truthy((($b = $$$('::', 'OpenURI', 'skip_raise')) && ($a = $$$($b, 'Cache', 'skip_raise')) ? 'constant' : nil))) { + } else { + $$($nesting, 'Helpers').$require_library("open-uri/cached", "open-uri-cached") + } + } else if ($truthy($$$('::', 'RUBY_ENGINE_OPAL')['$!']())) { + $$$('::', 'OpenURI')}; + return [$$$('::', 'URI').$parse(target), "uri", target]; + } else { + + inc_path = doc.$normalize_system_path(target, self.dir, nil, $hash2(["target_name"], {"target_name": "include file"})); + if ($truthy($$$('::', 'File')['$file?'](inc_path))) { + } else if ($truthy(attributes['$key?']("optional-option"))) { + + self.$shift(); + return true; + } else { + + self.$logger().$error(self.$message_with_context("" + "include file not found: " + (inc_path), $hash2(["source_location"], {"source_location": self.$cursor()}))); + return self.$replace_next_line("" + "Unresolved directive in " + (self.path) + " - include::" + (target) + "[" + (attrlist) + "]"); + }; + relpath = doc.$path_resolver().$relative_path(inc_path, doc.$base_dir()); + return [inc_path, "file", relpath]; + }; + }, TMP_PreprocessorReader_resolve_include_path_66.$$arity = 3); + + Opal.def(self, '$push_include', TMP_PreprocessorReader_push_include_67 = function $$push_include(data, file, path, lineno, attributes) { + var $a, self = this, $writer = nil, dir = nil, depth = nil, old_leveloffset = nil; + + + + if (file == null) { + file = nil; + }; + + if (path == null) { + path = nil; + }; + + if (lineno == null) { + lineno = 1; + }; + + if (attributes == null) { + attributes = $hash2([], {}); + }; + self.include_stack['$<<']([self.lines, self.file, self.dir, self.path, self.lineno, self.maxdepth, self.process_lines]); + if ($truthy((self.file = file))) { + + if ($truthy($$$('::', 'String')['$==='](file))) { + self.dir = $$$('::', 'File').$dirname(file) + } else if ($truthy($$$('::', 'RUBY_ENGINE_OPAL'))) { + self.dir = $$$('::', 'URI').$parse($$$('::', 'File').$dirname((file = file.$to_s()))) + } else { + + + $writer = [(function() {if ((dir = $$$('::', 'File').$dirname(file.$path()))['$==']("/")) { + return "" + } else { + return dir + }; return nil; })()]; + $send((self.dir = file.$dup()), 'path=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + file = file.$to_s(); + }; + path = ($truthy($a = path) ? $a : $$$('::', 'File').$basename(file)); + self.process_lines = $$($nesting, 'ASCIIDOC_EXTENSIONS')['$[]']($$$('::', 'File').$extname(file)); + } else { + + self.dir = "."; + self.process_lines = true; + }; + if ($truthy(path)) { + + self.path = path; + if ($truthy(self.process_lines)) { + + $writer = [$$($nesting, 'Helpers').$rootname(path), (function() {if ($truthy(attributes['$[]']("partial-option"))) { + return nil + } else { + return true + }; return nil; })()]; + $send(self.includes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + } else { + self.path = "" + }; + self.lineno = lineno; + if ($truthy(attributes['$key?']("depth"))) { + + depth = attributes['$[]']("depth").$to_i(); + if ($truthy($rb_le(depth, 0))) { + depth = 1}; + self.maxdepth = $hash2(["abs", "rel"], {"abs": $rb_plus($rb_minus(self.include_stack.$size(), 1), depth), "rel": depth});}; + if ($truthy((self.lines = self.$prepare_lines(data, $hash2(["normalize", "condense", "indent"], {"normalize": true, "condense": false, "indent": attributes['$[]']("indent")})))['$empty?']())) { + self.$pop_include() + } else { + + if ($truthy(attributes['$key?']("leveloffset"))) { + + self.lines.$unshift(""); + self.lines.$unshift("" + ":leveloffset: " + (attributes['$[]']("leveloffset"))); + self.lines['$<<'](""); + if ($truthy((old_leveloffset = self.document.$attr("leveloffset")))) { + self.lines['$<<']("" + ":leveloffset: " + (old_leveloffset)) + } else { + self.lines['$<<'](":leveloffset!:") + }; + self.lineno = $rb_minus(self.lineno, 2);}; + self.look_ahead = 0; + }; + return self; + }, TMP_PreprocessorReader_push_include_67.$$arity = -2); + + Opal.def(self, '$create_include_cursor', TMP_PreprocessorReader_create_include_cursor_68 = function $$create_include_cursor(file, path, lineno) { + var self = this, dir = nil; + + + if ($truthy($$$('::', 'String')['$==='](file))) { + dir = $$$('::', 'File').$dirname(file) + } else if ($truthy($$$('::', 'RUBY_ENGINE_OPAL'))) { + dir = $$$('::', 'File').$dirname((file = file.$to_s())) + } else { + + dir = (function() {if ((dir = $$$('::', 'File').$dirname(file.$path()))['$==']("")) { + return "/" + } else { + return dir + }; return nil; })(); + file = file.$to_s(); + }; + return $$($nesting, 'Cursor').$new(file, dir, path, lineno); + }, TMP_PreprocessorReader_create_include_cursor_68.$$arity = 3); + + Opal.def(self, '$pop_include', TMP_PreprocessorReader_pop_include_69 = function $$pop_include() { + var $a, $b, self = this; + + if ($truthy($rb_gt(self.include_stack.$size(), 0))) { + + $b = self.include_stack.$pop(), $a = Opal.to_ary($b), (self.lines = ($a[0] == null ? nil : $a[0])), (self.file = ($a[1] == null ? nil : $a[1])), (self.dir = ($a[2] == null ? nil : $a[2])), (self.path = ($a[3] == null ? nil : $a[3])), (self.lineno = ($a[4] == null ? nil : $a[4])), (self.maxdepth = ($a[5] == null ? nil : $a[5])), (self.process_lines = ($a[6] == null ? nil : $a[6])), $b; + self.look_ahead = 0; + return nil; + } else { + return nil + } + }, TMP_PreprocessorReader_pop_include_69.$$arity = 0); + + Opal.def(self, '$include_depth', TMP_PreprocessorReader_include_depth_70 = function $$include_depth() { + var self = this; + + return self.include_stack.$size() + }, TMP_PreprocessorReader_include_depth_70.$$arity = 0); + + Opal.def(self, '$exceeded_max_depth?', TMP_PreprocessorReader_exceeded_max_depth$q_71 = function() { + var $a, self = this, abs_maxdepth = nil; + + if ($truthy(($truthy($a = $rb_gt((abs_maxdepth = self.maxdepth['$[]']("abs")), 0)) ? $rb_ge(self.include_stack.$size(), abs_maxdepth) : $a))) { + return self.maxdepth['$[]']("rel") + } else { + return false + } + }, TMP_PreprocessorReader_exceeded_max_depth$q_71.$$arity = 0); + + Opal.def(self, '$shift', TMP_PreprocessorReader_shift_72 = function $$shift() { + var $iter = TMP_PreprocessorReader_shift_72.$$p, $yield = $iter || nil, self = this, line = nil, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_PreprocessorReader_shift_72.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + if ($truthy(self.unescape_next_line)) { + + self.unescape_next_line = false; + return (line = $send(self, Opal.find_super_dispatcher(self, 'shift', TMP_PreprocessorReader_shift_72, false), $zuper, $iter)).$slice(1, line.$length()); + } else { + return $send(self, Opal.find_super_dispatcher(self, 'shift', TMP_PreprocessorReader_shift_72, false), $zuper, $iter) + } + }, TMP_PreprocessorReader_shift_72.$$arity = 0); + + Opal.def(self, '$split_delimited_value', TMP_PreprocessorReader_split_delimited_value_73 = function $$split_delimited_value(val) { + var self = this; + + if ($truthy(val['$include?'](","))) { + + return val.$split(","); + } else { + + return val.$split(";"); + } + }, TMP_PreprocessorReader_split_delimited_value_73.$$arity = 1); + + Opal.def(self, '$skip_front_matter!', TMP_PreprocessorReader_skip_front_matter$B_74 = function(data, increment_linenos) { + var $a, $b, self = this, front_matter = nil, original_data = nil; + + + + if (increment_linenos == null) { + increment_linenos = true; + }; + front_matter = nil; + if (data['$[]'](0)['$==']("---")) { + + original_data = data.$drop(0); + data.$shift(); + front_matter = []; + if ($truthy(increment_linenos)) { + self.lineno = $rb_plus(self.lineno, 1)}; + while ($truthy(($truthy($b = data['$empty?']()['$!']()) ? data['$[]'](0)['$!=']("---") : $b))) { + + front_matter['$<<'](data.$shift()); + if ($truthy(increment_linenos)) { + self.lineno = $rb_plus(self.lineno, 1)}; + }; + if ($truthy(data['$empty?']())) { + + $send(data, 'unshift', Opal.to_a(original_data)); + if ($truthy(increment_linenos)) { + self.lineno = 0}; + front_matter = nil; + } else { + + data.$shift(); + if ($truthy(increment_linenos)) { + self.lineno = $rb_plus(self.lineno, 1)}; + };}; + return front_matter; + }, TMP_PreprocessorReader_skip_front_matter$B_74.$$arity = -2); + + Opal.def(self, '$resolve_expr_val', TMP_PreprocessorReader_resolve_expr_val_75 = function $$resolve_expr_val(val) { + var $a, $b, self = this, quoted = nil; + + + if ($truthy(($truthy($a = ($truthy($b = val['$start_with?']("\"")) ? val['$end_with?']("\"") : $b)) ? $a : ($truthy($b = val['$start_with?']("'")) ? val['$end_with?']("'") : $b)))) { + + quoted = true; + val = val.$slice(1, $rb_minus(val.$length(), 1)); + } else { + quoted = false + }; + if ($truthy(val['$include?']($$($nesting, 'ATTR_REF_HEAD')))) { + val = self.document.$sub_attributes(val, $hash2(["attribute_missing"], {"attribute_missing": "drop"}))}; + if ($truthy(quoted)) { + return val + } else if ($truthy(val['$empty?']())) { + return nil + } else if (val['$==']("true")) { + return true + } else if (val['$==']("false")) { + return false + } else if ($truthy(val.$rstrip()['$empty?']())) { + return " " + } else if ($truthy(val['$include?']("."))) { + return val.$to_f() + } else { + return val.$to_i() + }; + }, TMP_PreprocessorReader_resolve_expr_val_75.$$arity = 1); + + Opal.def(self, '$include_processors?', TMP_PreprocessorReader_include_processors$q_76 = function() { + var $a, self = this; + + if ($truthy(self.include_processor_extensions['$nil?']())) { + if ($truthy(($truthy($a = self.document['$extensions?']()) ? self.document.$extensions()['$include_processors?']() : $a))) { + return (self.include_processor_extensions = self.document.$extensions().$include_processors())['$!']()['$!']() + } else { + return (self.include_processor_extensions = false) + } + } else { + return self.include_processor_extensions['$!='](false) + } + }, TMP_PreprocessorReader_include_processors$q_76.$$arity = 0); + return (Opal.def(self, '$to_s', TMP_PreprocessorReader_to_s_77 = function $$to_s() { + var TMP_78, self = this; + + return "" + "#<" + (self.$class()) + "@" + (self.$object_id()) + " {path: " + (self.path.$inspect()) + ", line #: " + (self.lineno) + ", include depth: " + (self.include_stack.$size()) + ", include stack: [" + ($send(self.include_stack, 'map', [], (TMP_78 = function(inc){var self = TMP_78.$$s || this; + + + + if (inc == null) { + inc = nil; + }; + return inc.$to_s();}, TMP_78.$$s = self, TMP_78.$$arity = 1, TMP_78)).$join(", ")) + "]}>" + }, TMP_PreprocessorReader_to_s_77.$$arity = 0), nil) && 'to_s'; + })($nesting[0], $$($nesting, 'Reader'), $nesting); + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/section"] = function(Opal) { + function $rb_plus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); + } + function $rb_gt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); + } + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $hash2 = Opal.hash2, $send = Opal.send, $truthy = Opal.truthy; + + Opal.add_stubs(['$attr_accessor', '$attr_reader', '$===', '$+', '$level', '$special', '$generate_id', '$title', '$==', '$>', '$sectnum', '$int_to_roman', '$to_i', '$reftext', '$!', '$empty?', '$sprintf', '$sub_quotes', '$compat_mode', '$[]', '$attributes', '$context', '$assign_numeral', '$class', '$object_id', '$inspect', '$size', '$length', '$chr', '$[]=', '$-', '$gsub', '$downcase', '$delete', '$tr_s', '$end_with?', '$chop', '$start_with?', '$slice', '$key?', '$catalog', '$unique_id_start_index']); + return (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + (function($base, $super, $parent_nesting) { + function $Section(){}; + var self = $Section = $klass($base, $super, 'Section', $Section); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Section_initialize_1, TMP_Section_generate_id_2, TMP_Section_sectnum_3, TMP_Section_xreftext_4, TMP_Section_$lt$lt_5, TMP_Section_to_s_6, TMP_Section_generate_id_7; + + def.document = def.level = def.numeral = def.parent = def.numbered = def.sectname = def.title = def.blocks = nil; + + self.$attr_accessor("index"); + self.$attr_accessor("sectname"); + self.$attr_accessor("special"); + self.$attr_accessor("numbered"); + self.$attr_reader("caption"); + + Opal.def(self, '$initialize', TMP_Section_initialize_1 = function $$initialize(parent, level, numbered, opts) { + var $a, $b, $iter = TMP_Section_initialize_1.$$p, $yield = $iter || nil, self = this; + + if ($iter) TMP_Section_initialize_1.$$p = null; + + + if (parent == null) { + parent = nil; + }; + + if (level == null) { + level = nil; + }; + + if (numbered == null) { + numbered = false; + }; + + if (opts == null) { + opts = $hash2([], {}); + }; + $send(self, Opal.find_super_dispatcher(self, 'initialize', TMP_Section_initialize_1, false), [parent, "section", opts], null); + if ($truthy($$($nesting, 'Section')['$==='](parent))) { + $a = [($truthy($b = level) ? $b : $rb_plus(parent.$level(), 1)), parent.$special()], (self.level = $a[0]), (self.special = $a[1]), $a + } else { + $a = [($truthy($b = level) ? $b : 1), false], (self.level = $a[0]), (self.special = $a[1]), $a + }; + self.numbered = numbered; + return (self.index = 0); + }, TMP_Section_initialize_1.$$arity = -1); + Opal.alias(self, "name", "title"); + + Opal.def(self, '$generate_id', TMP_Section_generate_id_2 = function $$generate_id() { + var self = this; + + return $$($nesting, 'Section').$generate_id(self.$title(), self.document) + }, TMP_Section_generate_id_2.$$arity = 0); + + Opal.def(self, '$sectnum', TMP_Section_sectnum_3 = function $$sectnum(delimiter, append) { + var $a, self = this; + + + + if (delimiter == null) { + delimiter = "."; + }; + + if (append == null) { + append = nil; + }; + append = ($truthy($a = append) ? $a : (function() {if (append['$=='](false)) { + return "" + } else { + return delimiter + }; return nil; })()); + if (self.level['$=='](1)) { + return "" + (self.numeral) + (append) + } else if ($truthy($rb_gt(self.level, 1))) { + if ($truthy($$($nesting, 'Section')['$==='](self.parent))) { + return "" + (self.parent.$sectnum(delimiter, delimiter)) + (self.numeral) + (append) + } else { + return "" + (self.numeral) + (append) + } + } else { + return "" + ($$($nesting, 'Helpers').$int_to_roman(self.numeral.$to_i())) + (append) + }; + }, TMP_Section_sectnum_3.$$arity = -1); + + Opal.def(self, '$xreftext', TMP_Section_xreftext_4 = function $$xreftext(xrefstyle) { + var $a, self = this, val = nil, $case = nil, type = nil, quoted_title = nil, signifier = nil; + + + + if (xrefstyle == null) { + xrefstyle = nil; + }; + if ($truthy(($truthy($a = (val = self.$reftext())) ? val['$empty?']()['$!']() : $a))) { + return val + } else if ($truthy(xrefstyle)) { + if ($truthy(self.numbered)) { + return (function() {$case = xrefstyle; + if ("full"['$===']($case)) { + if ($truthy(($truthy($a = (type = self.sectname)['$==']("chapter")) ? $a : type['$==']("appendix")))) { + quoted_title = self.$sprintf(self.$sub_quotes("_%s_"), self.$title()) + } else { + quoted_title = self.$sprintf(self.$sub_quotes((function() {if ($truthy(self.document.$compat_mode())) { + return "``%s''" + } else { + return "\"`%s`\"" + }; return nil; })()), self.$title()) + }; + if ($truthy((signifier = self.document.$attributes()['$[]']("" + (type) + "-refsig")))) { + return "" + (signifier) + " " + (self.$sectnum(".", ",")) + " " + (quoted_title) + } else { + return "" + (self.$sectnum(".", ",")) + " " + (quoted_title) + };} + else if ("short"['$===']($case)) {if ($truthy((signifier = self.document.$attributes()['$[]']("" + (self.sectname) + "-refsig")))) { + return "" + (signifier) + " " + (self.$sectnum(".", "")) + } else { + return self.$sectnum(".", "") + }} + else {if ($truthy(($truthy($a = (type = self.sectname)['$==']("chapter")) ? $a : type['$==']("appendix")))) { + + return self.$sprintf(self.$sub_quotes("_%s_"), self.$title()); + } else { + return self.$title() + }}})() + } else if ($truthy(($truthy($a = (type = self.sectname)['$==']("chapter")) ? $a : type['$==']("appendix")))) { + + return self.$sprintf(self.$sub_quotes("_%s_"), self.$title()); + } else { + return self.$title() + } + } else { + return self.$title() + }; + }, TMP_Section_xreftext_4.$$arity = -1); + + Opal.def(self, '$<<', TMP_Section_$lt$lt_5 = function(block) { + var $iter = TMP_Section_$lt$lt_5.$$p, $yield = $iter || nil, self = this, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_Section_$lt$lt_5.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + + if (block.$context()['$==']("section")) { + self.$assign_numeral(block)}; + return $send(self, Opal.find_super_dispatcher(self, '<<', TMP_Section_$lt$lt_5, false), $zuper, $iter); + }, TMP_Section_$lt$lt_5.$$arity = 1); + + Opal.def(self, '$to_s', TMP_Section_to_s_6 = function $$to_s() { + var $iter = TMP_Section_to_s_6.$$p, $yield = $iter || nil, self = this, formal_title = nil, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_Section_to_s_6.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + if ($truthy(self.title)) { + + formal_title = (function() {if ($truthy(self.numbered)) { + return "" + (self.$sectnum()) + " " + (self.title) + } else { + return self.title + }; return nil; })(); + return "" + "#<" + (self.$class()) + "@" + (self.$object_id()) + " {level: " + (self.level) + ", title: " + (formal_title.$inspect()) + ", blocks: " + (self.blocks.$size()) + "}>"; + } else { + return $send(self, Opal.find_super_dispatcher(self, 'to_s', TMP_Section_to_s_6, false), $zuper, $iter) + } + }, TMP_Section_to_s_6.$$arity = 0); + return (Opal.defs(self, '$generate_id', TMP_Section_generate_id_7 = function $$generate_id(title, document) { + var $a, $b, self = this, attrs = nil, pre = nil, sep = nil, no_sep = nil, $writer = nil, sep_sub = nil, gen_id = nil, ids = nil, cnt = nil, candidate_id = nil; + + + attrs = document.$attributes(); + pre = ($truthy($a = attrs['$[]']("idprefix")) ? $a : "_"); + if ($truthy((sep = attrs['$[]']("idseparator")))) { + if ($truthy(($truthy($a = sep.$length()['$=='](1)) ? $a : ($truthy($b = (no_sep = sep['$empty?']())['$!']()) ? (sep = (($writer = ["idseparator", sep.$chr()]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])) : $b)))) { + sep_sub = (function() {if ($truthy(($truthy($a = sep['$==']("-")) ? $a : sep['$=='](".")))) { + return " .-" + } else { + return "" + " " + (sep) + ".-" + }; return nil; })()} + } else { + $a = ["_", " _.-"], (sep = $a[0]), (sep_sub = $a[1]), $a + }; + gen_id = "" + (pre) + (title.$downcase().$gsub($$($nesting, 'InvalidSectionIdCharsRx'), "")); + if ($truthy(no_sep)) { + gen_id = gen_id.$delete(" ") + } else { + + gen_id = gen_id.$tr_s(sep_sub, sep); + if ($truthy(gen_id['$end_with?'](sep))) { + gen_id = gen_id.$chop()}; + if ($truthy(($truthy($a = pre['$empty?']()) ? gen_id['$start_with?'](sep) : $a))) { + gen_id = gen_id.$slice(1, gen_id.$length())}; + }; + if ($truthy(document.$catalog()['$[]']("ids")['$key?'](gen_id))) { + + $a = [document.$catalog()['$[]']("ids"), $$($nesting, 'Compliance').$unique_id_start_index()], (ids = $a[0]), (cnt = $a[1]), $a; + while ($truthy(ids['$key?']((candidate_id = "" + (gen_id) + (sep) + (cnt))))) { + cnt = $rb_plus(cnt, 1) + }; + return candidate_id; + } else { + return gen_id + }; + }, TMP_Section_generate_id_7.$$arity = 2), nil) && 'generate_id'; + })($nesting[0], $$($nesting, 'AbstractBlock'), $nesting) + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/stylesheets"] = function(Opal) { + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $truthy = Opal.truthy, $hash2 = Opal.hash2, $gvars = Opal.gvars, $send = Opal.send; + + Opal.add_stubs(['$join', '$new', '$rstrip', '$read', '$primary_stylesheet_data', '$write', '$primary_stylesheet_name', '$coderay_stylesheet_data', '$coderay_stylesheet_name', '$load_pygments', '$=~', '$css', '$[]', '$sub', '$[]=', '$-', '$pygments_stylesheet_data', '$pygments_stylesheet_name', '$!', '$nil?', '$require_library']); + return (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + (function($base, $super, $parent_nesting) { + function $Stylesheets(){}; + var self = $Stylesheets = $klass($base, $super, 'Stylesheets', $Stylesheets); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Stylesheets_instance_1, TMP_Stylesheets_primary_stylesheet_name_2, TMP_Stylesheets_primary_stylesheet_data_3, TMP_Stylesheets_embed_primary_stylesheet_4, TMP_Stylesheets_write_primary_stylesheet_5, TMP_Stylesheets_coderay_stylesheet_name_6, TMP_Stylesheets_coderay_stylesheet_data_7, TMP_Stylesheets_embed_coderay_stylesheet_8, TMP_Stylesheets_write_coderay_stylesheet_9, TMP_Stylesheets_pygments_stylesheet_name_10, TMP_Stylesheets_pygments_background_11, TMP_Stylesheets_pygments_stylesheet_data_12, TMP_Stylesheets_embed_pygments_stylesheet_13, TMP_Stylesheets_write_pygments_stylesheet_14, TMP_Stylesheets_load_pygments_15; + + def.primary_stylesheet_data = def.coderay_stylesheet_data = def.pygments_stylesheet_data = nil; + + Opal.const_set($nesting[0], 'DEFAULT_STYLESHEET_NAME', "asciidoctor.css"); + Opal.const_set($nesting[0], 'DEFAULT_PYGMENTS_STYLE', "default"); + Opal.const_set($nesting[0], 'STYLESHEETS_DATA_PATH', $$$('::', 'File').$join($$($nesting, 'DATA_PATH'), "stylesheets")); + Opal.const_set($nesting[0], 'PygmentsBgColorRx', /^\.pygments +\{ *background: *([^;]+);/); + self.__instance__ = self.$new(); + Opal.defs(self, '$instance', TMP_Stylesheets_instance_1 = function $$instance() { + var self = this; + if (self.__instance__ == null) self.__instance__ = nil; + + return self.__instance__ + }, TMP_Stylesheets_instance_1.$$arity = 0); + + Opal.def(self, '$primary_stylesheet_name', TMP_Stylesheets_primary_stylesheet_name_2 = function $$primary_stylesheet_name() { + var self = this; + + return $$($nesting, 'DEFAULT_STYLESHEET_NAME') + }, TMP_Stylesheets_primary_stylesheet_name_2.$$arity = 0); + + Opal.def(self, '$primary_stylesheet_data', TMP_Stylesheets_primary_stylesheet_data_3 = function $$primary_stylesheet_data() { + +var File = Opal.const_get_relative([], "File"); +var stylesheetsPath; +if (Opal.const_get_relative([], "JAVASCRIPT_PLATFORM")["$=="]("node")) { + if (File.$basename(__dirname) === "node" && File.$basename(File.$dirname(__dirname)) === "dist") { + stylesheetsPath = File.$join(File.$dirname(__dirname), "css"); + } else { + stylesheetsPath = File.$join(__dirname, "css"); + } +} else if (Opal.const_get_relative([], "JAVASCRIPT_ENGINE")["$=="]("nashorn")) { + if (File.$basename(__DIR__) === "nashorn" && File.$basename(File.$dirname(__DIR__)) === "dist") { + stylesheetsPath = File.$join(File.$dirname(__DIR__), "css"); + } else { + stylesheetsPath = File.$join(__DIR__, "css"); + } +} else { + stylesheetsPath = "css"; +} +return ((($a = self.primary_stylesheet_data) !== false && $a !== nil && $a != null) ? $a : self.primary_stylesheet_data = Opal.const_get_relative([], "IO").$read(File.$join(stylesheetsPath, "asciidoctor.css")).$chomp()); + + }, TMP_Stylesheets_primary_stylesheet_data_3.$$arity = 0); + + Opal.def(self, '$embed_primary_stylesheet', TMP_Stylesheets_embed_primary_stylesheet_4 = function $$embed_primary_stylesheet() { + var self = this; + + return "" + "" + }, TMP_Stylesheets_embed_primary_stylesheet_4.$$arity = 0); + + Opal.def(self, '$write_primary_stylesheet', TMP_Stylesheets_write_primary_stylesheet_5 = function $$write_primary_stylesheet(target_dir) { + var self = this; + + + + if (target_dir == null) { + target_dir = "."; + }; + return $$$('::', 'IO').$write($$$('::', 'File').$join(target_dir, self.$primary_stylesheet_name()), self.$primary_stylesheet_data()); + }, TMP_Stylesheets_write_primary_stylesheet_5.$$arity = -1); + + Opal.def(self, '$coderay_stylesheet_name', TMP_Stylesheets_coderay_stylesheet_name_6 = function $$coderay_stylesheet_name() { + var self = this; + + return "coderay-asciidoctor.css" + }, TMP_Stylesheets_coderay_stylesheet_name_6.$$arity = 0); + + Opal.def(self, '$coderay_stylesheet_data', TMP_Stylesheets_coderay_stylesheet_data_7 = function $$coderay_stylesheet_data() { + var $a, self = this; + + return (self.coderay_stylesheet_data = ($truthy($a = self.coderay_stylesheet_data) ? $a : $$$('::', 'IO').$read($$$('::', 'File').$join($$($nesting, 'STYLESHEETS_DATA_PATH'), "coderay-asciidoctor.css")).$rstrip())) + }, TMP_Stylesheets_coderay_stylesheet_data_7.$$arity = 0); + + Opal.def(self, '$embed_coderay_stylesheet', TMP_Stylesheets_embed_coderay_stylesheet_8 = function $$embed_coderay_stylesheet() { + var self = this; + + return "" + "" + }, TMP_Stylesheets_embed_coderay_stylesheet_8.$$arity = 0); + + Opal.def(self, '$write_coderay_stylesheet', TMP_Stylesheets_write_coderay_stylesheet_9 = function $$write_coderay_stylesheet(target_dir) { + var self = this; + + + + if (target_dir == null) { + target_dir = "."; + }; + return $$$('::', 'IO').$write($$$('::', 'File').$join(target_dir, self.$coderay_stylesheet_name()), self.$coderay_stylesheet_data()); + }, TMP_Stylesheets_write_coderay_stylesheet_9.$$arity = -1); + + Opal.def(self, '$pygments_stylesheet_name', TMP_Stylesheets_pygments_stylesheet_name_10 = function $$pygments_stylesheet_name(style) { + var $a, self = this; + + + + if (style == null) { + style = nil; + }; + return "" + "pygments-" + (($truthy($a = style) ? $a : $$($nesting, 'DEFAULT_PYGMENTS_STYLE'))) + ".css"; + }, TMP_Stylesheets_pygments_stylesheet_name_10.$$arity = -1); + + Opal.def(self, '$pygments_background', TMP_Stylesheets_pygments_background_11 = function $$pygments_background(style) { + var $a, $b, self = this; + + + + if (style == null) { + style = nil; + }; + if ($truthy(($truthy($a = self.$load_pygments()) ? $$($nesting, 'PygmentsBgColorRx')['$=~']($$$('::', 'Pygments').$css(".pygments", $hash2(["style"], {"style": ($truthy($b = style) ? $b : $$($nesting, 'DEFAULT_PYGMENTS_STYLE'))}))) : $a))) { + return (($a = $gvars['~']) === nil ? nil : $a['$[]'](1)) + } else { + return nil + }; + }, TMP_Stylesheets_pygments_background_11.$$arity = -1); + + Opal.def(self, '$pygments_stylesheet_data', TMP_Stylesheets_pygments_stylesheet_data_12 = function $$pygments_stylesheet_data(style) { + var $a, $b, self = this, $writer = nil; + + + + if (style == null) { + style = nil; + }; + if ($truthy(self.$load_pygments())) { + + style = ($truthy($a = style) ? $a : $$($nesting, 'DEFAULT_PYGMENTS_STYLE')); + return ($truthy($a = (self.pygments_stylesheet_data = ($truthy($b = self.pygments_stylesheet_data) ? $b : $hash2([], {})))['$[]'](style)) ? $a : (($writer = [style, ($truthy($b = $$$('::', 'Pygments').$css(".listingblock .pygments", $hash2(["classprefix", "style"], {"classprefix": "tok-", "style": style}))) ? $b : "/* Failed to load Pygments CSS. */").$sub(".listingblock .pygments {", ".listingblock .pygments, .listingblock .pygments code {")]), $send((self.pygments_stylesheet_data = ($truthy($b = self.pygments_stylesheet_data) ? $b : $hash2([], {}))), '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + } else { + return "/* Pygments CSS disabled. Pygments is not available. */" + }; + }, TMP_Stylesheets_pygments_stylesheet_data_12.$$arity = -1); + + Opal.def(self, '$embed_pygments_stylesheet', TMP_Stylesheets_embed_pygments_stylesheet_13 = function $$embed_pygments_stylesheet(style) { + var self = this; + + + + if (style == null) { + style = nil; + }; + return "" + ""; + }, TMP_Stylesheets_embed_pygments_stylesheet_13.$$arity = -1); + + Opal.def(self, '$write_pygments_stylesheet', TMP_Stylesheets_write_pygments_stylesheet_14 = function $$write_pygments_stylesheet(target_dir, style) { + var self = this; + + + + if (target_dir == null) { + target_dir = "."; + }; + + if (style == null) { + style = nil; + }; + return $$$('::', 'IO').$write($$$('::', 'File').$join(target_dir, self.$pygments_stylesheet_name(style)), self.$pygments_stylesheet_data(style)); + }, TMP_Stylesheets_write_pygments_stylesheet_14.$$arity = -1); + return (Opal.def(self, '$load_pygments', TMP_Stylesheets_load_pygments_15 = function $$load_pygments() { + var $a, self = this; + + if ($truthy((($a = $$$('::', 'Pygments', 'skip_raise')) ? 'constant' : nil))) { + return true + } else { + return $$($nesting, 'Helpers').$require_library("pygments", "pygments.rb", "ignore")['$nil?']()['$!']() + } + }, TMP_Stylesheets_load_pygments_15.$$arity = 0), nil) && 'load_pygments'; + })($nesting[0], null, $nesting) + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/table"] = function(Opal) { + function $rb_gt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); + } + function $rb_lt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); + } + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + function $rb_times(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs * rhs : lhs['$*'](rhs); + } + function $rb_divide(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs / rhs : lhs['$/'](rhs); + } + function $rb_plus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $send = Opal.send, $truthy = Opal.truthy, $hash2 = Opal.hash2, $gvars = Opal.gvars; + + Opal.add_stubs(['$attr_accessor', '$attr_reader', '$new', '$key?', '$[]', '$>', '$to_i', '$<', '$==', '$[]=', '$-', '$attributes', '$round', '$*', '$/', '$to_f', '$empty?', '$body', '$each', '$<<', '$size', '$+', '$assign_column_widths', '$warn', '$logger', '$update_attributes', '$assign_width', '$shift', '$style=', '$head=', '$pop', '$foot=', '$parent', '$sourcemap', '$dup', '$header_row?', '$table', '$delete', '$start_with?', '$rstrip', '$slice', '$length', '$advance', '$lstrip', '$strip', '$split', '$include?', '$readlines', '$unshift', '$nil?', '$=~', '$catalog_inline_anchor', '$apply_subs', '$convert', '$map', '$text', '$!', '$file', '$lineno', '$to_s', '$include', '$to_set', '$mark', '$nested?', '$document', '$error', '$message_with_context', '$cursor_at_prev_line', '$nil_or_empty?', '$escape', '$columns', '$match', '$chop', '$end_with?', '$gsub', '$push_cellspec', '$cell_open?', '$close_cell', '$take_cellspec', '$squeeze', '$upto', '$times', '$cursor_before_mark', '$rowspan', '$activate_rowspan', '$colspan', '$end_of_row?', '$!=', '$close_row', '$rows', '$effective_column_visits']); + return (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + + (function($base, $super, $parent_nesting) { + function $Table(){}; + var self = $Table = $klass($base, $super, 'Table', $Table); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Table_initialize_3, TMP_Table_header_row$q_4, TMP_Table_create_columns_5, TMP_Table_assign_column_widths_7, TMP_Table_partition_header_footer_11; + + def.attributes = def.document = def.has_header_option = def.rows = def.columns = nil; + + Opal.const_set($nesting[0], 'DEFAULT_PRECISION_FACTOR', 10000); + (function($base, $super, $parent_nesting) { + function $Rows(){}; + var self = $Rows = $klass($base, $super, 'Rows', $Rows); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Rows_initialize_1, TMP_Rows_by_section_2; + + def.head = def.body = def.foot = nil; + + self.$attr_accessor("head", "foot", "body"); + + Opal.def(self, '$initialize', TMP_Rows_initialize_1 = function $$initialize(head, foot, body) { + var self = this; + + + + if (head == null) { + head = []; + }; + + if (foot == null) { + foot = []; + }; + + if (body == null) { + body = []; + }; + self.head = head; + self.foot = foot; + return (self.body = body); + }, TMP_Rows_initialize_1.$$arity = -1); + Opal.alias(self, "[]", "send"); + return (Opal.def(self, '$by_section', TMP_Rows_by_section_2 = function $$by_section() { + var self = this; + + return [["head", self.head], ["body", self.body], ["foot", self.foot]] + }, TMP_Rows_by_section_2.$$arity = 0), nil) && 'by_section'; + })($nesting[0], null, $nesting); + self.$attr_accessor("columns"); + self.$attr_accessor("rows"); + self.$attr_accessor("has_header_option"); + self.$attr_reader("caption"); + + Opal.def(self, '$initialize', TMP_Table_initialize_3 = function $$initialize(parent, attributes) { + var $a, $b, $iter = TMP_Table_initialize_3.$$p, $yield = $iter || nil, self = this, pcwidth = nil, pcwidth_intval = nil, $writer = nil; + + if ($iter) TMP_Table_initialize_3.$$p = null; + + $send(self, Opal.find_super_dispatcher(self, 'initialize', TMP_Table_initialize_3, false), [parent, "table"], null); + self.rows = $$($nesting, 'Rows').$new(); + self.columns = []; + self.has_header_option = attributes['$key?']("header-option"); + if ($truthy((pcwidth = attributes['$[]']("width")))) { + if ($truthy(($truthy($a = $rb_gt((pcwidth_intval = pcwidth.$to_i()), 100)) ? $a : $rb_lt(pcwidth_intval, 1)))) { + if ($truthy((($a = pcwidth_intval['$=='](0)) ? ($truthy($b = pcwidth['$==']("0")) ? $b : pcwidth['$==']("0%")) : pcwidth_intval['$=='](0)))) { + } else { + pcwidth_intval = 100 + }} + } else { + pcwidth_intval = 100 + }; + + $writer = ["tablepcwidth", pcwidth_intval]; + $send(self.attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + if ($truthy(self.document.$attributes()['$key?']("pagewidth"))) { + ($truthy($a = self.attributes['$[]']("tableabswidth")) ? $a : (($writer = ["tableabswidth", $rb_times($rb_divide(self.attributes['$[]']("tablepcwidth").$to_f(), 100), self.document.$attributes()['$[]']("pagewidth")).$round()]), $send(self.attributes, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]))}; + if ($truthy(attributes['$key?']("rotate-option"))) { + + $writer = ["orientation", "landscape"]; + $send(attributes, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + } else { + return nil + }; + }, TMP_Table_initialize_3.$$arity = 2); + + Opal.def(self, '$header_row?', TMP_Table_header_row$q_4 = function() { + var $a, self = this; + + return ($truthy($a = self.has_header_option) ? self.rows.$body()['$empty?']() : $a) + }, TMP_Table_header_row$q_4.$$arity = 0); + + Opal.def(self, '$create_columns', TMP_Table_create_columns_5 = function $$create_columns(colspecs) { + var TMP_6, $a, self = this, cols = nil, autowidth_cols = nil, width_base = nil, num_cols = nil, $writer = nil; + + + cols = []; + autowidth_cols = nil; + width_base = 0; + $send(colspecs, 'each', [], (TMP_6 = function(colspec){var self = TMP_6.$$s || this, $a, colwidth = nil; + + + + if (colspec == null) { + colspec = nil; + }; + colwidth = colspec['$[]']("width"); + cols['$<<']($$($nesting, 'Column').$new(self, cols.$size(), colspec)); + if ($truthy($rb_lt(colwidth, 0))) { + return (autowidth_cols = ($truthy($a = autowidth_cols) ? $a : []))['$<<'](cols['$[]'](-1)) + } else { + return (width_base = $rb_plus(width_base, colwidth)) + };}, TMP_6.$$s = self, TMP_6.$$arity = 1, TMP_6)); + if ($truthy($rb_gt((num_cols = (self.columns = cols).$size()), 0))) { + + + $writer = ["colcount", num_cols]; + $send(self.attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + if ($truthy(($truthy($a = $rb_gt(width_base, 0)) ? $a : autowidth_cols))) { + } else { + width_base = nil + }; + self.$assign_column_widths(width_base, autowidth_cols);}; + return nil; + }, TMP_Table_create_columns_5.$$arity = 1); + + Opal.def(self, '$assign_column_widths', TMP_Table_assign_column_widths_7 = function $$assign_column_widths(width_base, autowidth_cols) { + var TMP_8, TMP_9, TMP_10, self = this, pf = nil, total_width = nil, col_pcwidth = nil, autowidth = nil, autowidth_attrs = nil; + + + + if (width_base == null) { + width_base = nil; + }; + + if (autowidth_cols == null) { + autowidth_cols = nil; + }; + pf = $$($nesting, 'DEFAULT_PRECISION_FACTOR'); + total_width = (col_pcwidth = 0); + if ($truthy(width_base)) { + + if ($truthy(autowidth_cols)) { + + if ($truthy($rb_gt(width_base, 100))) { + + autowidth = 0; + self.$logger().$warn("" + "total column width must not exceed 100% when using autowidth columns; got " + (width_base) + "%"); + } else { + + autowidth = $rb_divide($rb_times($rb_divide($rb_minus(100, width_base), autowidth_cols.$size()), pf).$to_i(), pf); + if (autowidth.$to_i()['$=='](autowidth)) { + autowidth = autowidth.$to_i()}; + width_base = 100; + }; + autowidth_attrs = $hash2(["width", "autowidth-option"], {"width": autowidth, "autowidth-option": ""}); + $send(autowidth_cols, 'each', [], (TMP_8 = function(col){var self = TMP_8.$$s || this; + + + + if (col == null) { + col = nil; + }; + return col.$update_attributes(autowidth_attrs);}, TMP_8.$$s = self, TMP_8.$$arity = 1, TMP_8));}; + $send(self.columns, 'each', [], (TMP_9 = function(col){var self = TMP_9.$$s || this; + + + + if (col == null) { + col = nil; + }; + return (total_width = $rb_plus(total_width, (col_pcwidth = col.$assign_width(nil, width_base, pf))));}, TMP_9.$$s = self, TMP_9.$$arity = 1, TMP_9)); + } else { + + col_pcwidth = $rb_divide($rb_divide($rb_times(100, pf), self.columns.$size()).$to_i(), pf); + if (col_pcwidth.$to_i()['$=='](col_pcwidth)) { + col_pcwidth = col_pcwidth.$to_i()}; + $send(self.columns, 'each', [], (TMP_10 = function(col){var self = TMP_10.$$s || this; + + + + if (col == null) { + col = nil; + }; + return (total_width = $rb_plus(total_width, col.$assign_width(col_pcwidth)));}, TMP_10.$$s = self, TMP_10.$$arity = 1, TMP_10)); + }; + if (total_width['$=='](100)) { + } else { + self.columns['$[]'](-1).$assign_width($rb_divide($rb_times($rb_plus($rb_minus(100, total_width), col_pcwidth), pf).$round(), pf)) + }; + return nil; + }, TMP_Table_assign_column_widths_7.$$arity = -1); + return (Opal.def(self, '$partition_header_footer', TMP_Table_partition_header_footer_11 = function $$partition_header_footer(attrs) { + var $a, TMP_12, self = this, $writer = nil, num_body_rows = nil, head = nil; + + + + $writer = ["rowcount", self.rows.$body().$size()]; + $send(self.attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + num_body_rows = self.rows.$body().$size(); + if ($truthy(($truthy($a = $rb_gt(num_body_rows, 0)) ? self.has_header_option : $a))) { + + head = self.rows.$body().$shift(); + num_body_rows = $rb_minus(num_body_rows, 1); + $send(head, 'each', [], (TMP_12 = function(c){var self = TMP_12.$$s || this; + + + + if (c == null) { + c = nil; + }; + $writer = [nil]; + $send(c, 'style=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];}, TMP_12.$$s = self, TMP_12.$$arity = 1, TMP_12)); + + $writer = [[head]]; + $send(self.rows, 'head=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];;}; + if ($truthy(($truthy($a = $rb_gt(num_body_rows, 0)) ? attrs['$key?']("footer-option") : $a))) { + + $writer = [[self.rows.$body().$pop()]]; + $send(self.rows, 'foot=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + return nil; + }, TMP_Table_partition_header_footer_11.$$arity = 1), nil) && 'partition_header_footer'; + })($nesting[0], $$($nesting, 'AbstractBlock'), $nesting); + (function($base, $super, $parent_nesting) { + function $Column(){}; + var self = $Column = $klass($base, $super, 'Column', $Column); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Column_initialize_13, TMP_Column_assign_width_14; + + def.attributes = nil; + + self.$attr_accessor("style"); + + Opal.def(self, '$initialize', TMP_Column_initialize_13 = function $$initialize(table, index, attributes) { + var $a, $iter = TMP_Column_initialize_13.$$p, $yield = $iter || nil, self = this, $writer = nil; + + if ($iter) TMP_Column_initialize_13.$$p = null; + + + if (attributes == null) { + attributes = $hash2([], {}); + }; + $send(self, Opal.find_super_dispatcher(self, 'initialize', TMP_Column_initialize_13, false), [table, "column"], null); + self.style = attributes['$[]']("style"); + + $writer = ["colnumber", $rb_plus(index, 1)]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + ($truthy($a = attributes['$[]']("width")) ? $a : (($writer = ["width", 1]), $send(attributes, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + ($truthy($a = attributes['$[]']("halign")) ? $a : (($writer = ["halign", "left"]), $send(attributes, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + ($truthy($a = attributes['$[]']("valign")) ? $a : (($writer = ["valign", "top"]), $send(attributes, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + return self.$update_attributes(attributes); + }, TMP_Column_initialize_13.$$arity = -3); + Opal.alias(self, "table", "parent"); + return (Opal.def(self, '$assign_width', TMP_Column_assign_width_14 = function $$assign_width(col_pcwidth, width_base, pf) { + var self = this, $writer = nil; + + + + if (width_base == null) { + width_base = nil; + }; + + if (pf == null) { + pf = 10000; + }; + if ($truthy(width_base)) { + + col_pcwidth = $rb_divide($rb_times($rb_times($rb_divide(self.attributes['$[]']("width").$to_f(), width_base), 100), pf).$to_i(), pf); + if (col_pcwidth.$to_i()['$=='](col_pcwidth)) { + col_pcwidth = col_pcwidth.$to_i()};}; + + $writer = ["colpcwidth", col_pcwidth]; + $send(self.attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + if ($truthy(self.$parent().$attributes()['$key?']("tableabswidth"))) { + + $writer = ["colabswidth", $rb_times($rb_divide(col_pcwidth, 100), self.$parent().$attributes()['$[]']("tableabswidth")).$round()]; + $send(self.attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + return col_pcwidth; + }, TMP_Column_assign_width_14.$$arity = -2), nil) && 'assign_width'; + })($$($nesting, 'Table'), $$($nesting, 'AbstractNode'), $nesting); + (function($base, $super, $parent_nesting) { + function $Cell(){}; + var self = $Cell = $klass($base, $super, 'Cell', $Cell); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Cell_initialize_15, TMP_Cell_text_16, TMP_Cell_text$eq_17, TMP_Cell_content_18, TMP_Cell_file_20, TMP_Cell_lineno_21, TMP_Cell_to_s_22; + + def.document = def.text = def.subs = def.style = def.inner_document = def.source_location = def.colspan = def.rowspan = def.attributes = nil; + + self.$attr_reader("source_location"); + self.$attr_accessor("style"); + self.$attr_accessor("subs"); + self.$attr_accessor("colspan"); + self.$attr_accessor("rowspan"); + Opal.alias(self, "column", "parent"); + self.$attr_reader("inner_document"); + + Opal.def(self, '$initialize', TMP_Cell_initialize_15 = function $$initialize(column, cell_text, attributes, opts) { + var $a, $b, $iter = TMP_Cell_initialize_15.$$p, $yield = $iter || nil, self = this, in_header_row = nil, cell_style = nil, asciidoc = nil, inner_document_cursor = nil, lines_advanced = nil, literal = nil, normal_psv = nil, parent_doctitle = nil, inner_document_lines = nil, unprocessed_line1 = nil, preprocessed_lines = nil, $writer = nil; + + if ($iter) TMP_Cell_initialize_15.$$p = null; + + + if (attributes == null) { + attributes = $hash2([], {}); + }; + + if (opts == null) { + opts = $hash2([], {}); + }; + $send(self, Opal.find_super_dispatcher(self, 'initialize', TMP_Cell_initialize_15, false), [column, "cell"], null); + if ($truthy(self.document.$sourcemap())) { + self.source_location = opts['$[]']("cursor").$dup()}; + if ($truthy(column)) { + + if ($truthy((in_header_row = column.$table()['$header_row?']()))) { + } else { + cell_style = column.$attributes()['$[]']("style") + }; + self.$update_attributes(column.$attributes());}; + if ($truthy(attributes)) { + + if ($truthy(attributes['$empty?']())) { + self.colspan = (self.rowspan = nil) + } else { + + $a = [attributes.$delete("colspan"), attributes.$delete("rowspan")], (self.colspan = $a[0]), (self.rowspan = $a[1]), $a; + if ($truthy(in_header_row)) { + } else { + cell_style = ($truthy($a = attributes['$[]']("style")) ? $a : cell_style) + }; + self.$update_attributes(attributes); + }; + if (cell_style['$==']("asciidoc")) { + + asciidoc = true; + inner_document_cursor = opts['$[]']("cursor"); + if ($truthy((cell_text = cell_text.$rstrip())['$start_with?']($$($nesting, 'LF')))) { + + lines_advanced = 1; + while ($truthy((cell_text = cell_text.$slice(1, cell_text.$length()))['$start_with?']($$($nesting, 'LF')))) { + lines_advanced = $rb_plus(lines_advanced, 1) + }; + inner_document_cursor.$advance(lines_advanced); + } else { + cell_text = cell_text.$lstrip() + }; + } else if ($truthy(($truthy($a = (literal = cell_style['$==']("literal"))) ? $a : cell_style['$==']("verse")))) { + + cell_text = cell_text.$rstrip(); + while ($truthy(cell_text['$start_with?']($$($nesting, 'LF')))) { + cell_text = cell_text.$slice(1, cell_text.$length()) + }; + } else { + + normal_psv = true; + cell_text = (function() {if ($truthy(cell_text)) { + return cell_text.$strip() + } else { + return "" + }; return nil; })(); + }; + } else { + + self.colspan = (self.rowspan = nil); + if (cell_style['$==']("asciidoc")) { + + asciidoc = true; + inner_document_cursor = opts['$[]']("cursor");}; + }; + if ($truthy(asciidoc)) { + + parent_doctitle = self.document.$attributes().$delete("doctitle"); + inner_document_lines = cell_text.$split($$($nesting, 'LF'), -1); + if ($truthy(inner_document_lines['$empty?']())) { + } else if ($truthy((unprocessed_line1 = inner_document_lines['$[]'](0))['$include?']("::"))) { + + preprocessed_lines = $$($nesting, 'PreprocessorReader').$new(self.document, [unprocessed_line1]).$readlines(); + if ($truthy((($a = unprocessed_line1['$=='](preprocessed_lines['$[]'](0))) ? $rb_lt(preprocessed_lines.$size(), 2) : unprocessed_line1['$=='](preprocessed_lines['$[]'](0))))) { + } else { + + inner_document_lines.$shift(); + if ($truthy(preprocessed_lines['$empty?']())) { + } else { + $send(inner_document_lines, 'unshift', Opal.to_a(preprocessed_lines)) + }; + };}; + self.inner_document = $$($nesting, 'Document').$new(inner_document_lines, $hash2(["header_footer", "parent", "cursor"], {"header_footer": false, "parent": self.document, "cursor": inner_document_cursor})); + if ($truthy(parent_doctitle['$nil?']())) { + } else { + + $writer = ["doctitle", parent_doctitle]; + $send(self.document.$attributes(), '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + self.subs = nil; + } else if ($truthy(literal)) { + self.subs = $$($nesting, 'BASIC_SUBS') + } else { + + if ($truthy(($truthy($a = ($truthy($b = normal_psv) ? cell_text['$start_with?']("[[") : $b)) ? $$($nesting, 'LeadingInlineAnchorRx')['$=~'](cell_text) : $a))) { + $$($nesting, 'Parser').$catalog_inline_anchor((($a = $gvars['~']) === nil ? nil : $a['$[]'](1)), (($a = $gvars['~']) === nil ? nil : $a['$[]'](2)), self, opts['$[]']("cursor"), self.document)}; + self.subs = $$($nesting, 'NORMAL_SUBS'); + }; + self.text = cell_text; + return (self.style = cell_style); + }, TMP_Cell_initialize_15.$$arity = -3); + + Opal.def(self, '$text', TMP_Cell_text_16 = function $$text() { + var self = this; + + return self.$apply_subs(self.text, self.subs) + }, TMP_Cell_text_16.$$arity = 0); + + Opal.def(self, '$text=', TMP_Cell_text$eq_17 = function(val) { + var self = this; + + return (self.text = val) + }, TMP_Cell_text$eq_17.$$arity = 1); + + Opal.def(self, '$content', TMP_Cell_content_18 = function $$content() { + var TMP_19, self = this; + + if (self.style['$==']("asciidoc")) { + return self.inner_document.$convert() + } else { + return $send(self.$text().$split($$($nesting, 'BlankLineRx')), 'map', [], (TMP_19 = function(p){var self = TMP_19.$$s || this, $a; + if (self.style == null) self.style = nil; + + + + if (p == null) { + p = nil; + }; + if ($truthy(($truthy($a = self.style['$!']()) ? $a : self.style['$==']("header")))) { + return p + } else { + return $$($nesting, 'Inline').$new(self.$parent(), "quoted", p, $hash2(["type"], {"type": self.style})).$convert() + };}, TMP_19.$$s = self, TMP_19.$$arity = 1, TMP_19)) + } + }, TMP_Cell_content_18.$$arity = 0); + + Opal.def(self, '$file', TMP_Cell_file_20 = function $$file() { + var $a, self = this; + + return ($truthy($a = self.source_location) ? self.source_location.$file() : $a) + }, TMP_Cell_file_20.$$arity = 0); + + Opal.def(self, '$lineno', TMP_Cell_lineno_21 = function $$lineno() { + var $a, self = this; + + return ($truthy($a = self.source_location) ? self.source_location.$lineno() : $a) + }, TMP_Cell_lineno_21.$$arity = 0); + return (Opal.def(self, '$to_s', TMP_Cell_to_s_22 = function $$to_s() { + var $a, $iter = TMP_Cell_to_s_22.$$p, $yield = $iter || nil, self = this, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_Cell_to_s_22.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + return "" + ($send(self, Opal.find_super_dispatcher(self, 'to_s', TMP_Cell_to_s_22, false), $zuper, $iter).$to_s()) + " - [text: " + (self.text) + ", colspan: " + (($truthy($a = self.colspan) ? $a : 1)) + ", rowspan: " + (($truthy($a = self.rowspan) ? $a : 1)) + ", attributes: " + (self.attributes) + "]" + }, TMP_Cell_to_s_22.$$arity = 0), nil) && 'to_s'; + })($$($nesting, 'Table'), $$($nesting, 'AbstractNode'), $nesting); + (function($base, $super, $parent_nesting) { + function $ParserContext(){}; + var self = $ParserContext = $klass($base, $super, 'ParserContext', $ParserContext); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_ParserContext_initialize_23, TMP_ParserContext_starts_with_delimiter$q_24, TMP_ParserContext_match_delimiter_25, TMP_ParserContext_skip_past_delimiter_26, TMP_ParserContext_skip_past_escaped_delimiter_27, TMP_ParserContext_buffer_has_unclosed_quotes$q_28, TMP_ParserContext_take_cellspec_29, TMP_ParserContext_push_cellspec_30, TMP_ParserContext_keep_cell_open_31, TMP_ParserContext_mark_cell_closed_32, TMP_ParserContext_cell_open$q_33, TMP_ParserContext_cell_closed$q_34, TMP_ParserContext_close_open_cell_35, TMP_ParserContext_close_cell_36, TMP_ParserContext_close_row_39, TMP_ParserContext_activate_rowspan_40, TMP_ParserContext_end_of_row$q_42, TMP_ParserContext_effective_column_visits_43, TMP_ParserContext_advance_44; + + def.delimiter = def.delimiter_re = def.buffer = def.cellspecs = def.cell_open = def.format = def.start_cursor_data = def.reader = def.table = def.current_row = def.colcount = def.column_visits = def.active_rowspans = def.linenum = nil; + + self.$include($$($nesting, 'Logging')); + Opal.const_set($nesting[0], 'FORMATS', ["psv", "csv", "dsv", "tsv"].$to_set()); + Opal.const_set($nesting[0], 'DELIMITERS', $hash2(["psv", "csv", "dsv", "tsv", "!sv"], {"psv": ["|", /\|/], "csv": [",", /,/], "dsv": [":", /:/], "tsv": ["\t", /\t/], "!sv": ["!", /!/]})); + self.$attr_accessor("table"); + self.$attr_accessor("format"); + self.$attr_reader("colcount"); + self.$attr_accessor("buffer"); + self.$attr_reader("delimiter"); + self.$attr_reader("delimiter_re"); + + Opal.def(self, '$initialize', TMP_ParserContext_initialize_23 = function $$initialize(reader, table, attributes) { + var $a, $b, self = this, xsv = nil, sep = nil; + + + + if (attributes == null) { + attributes = $hash2([], {}); + }; + self.start_cursor_data = (self.reader = reader).$mark(); + self.table = table; + if ($truthy(attributes['$key?']("format"))) { + if ($truthy($$($nesting, 'FORMATS')['$include?']((xsv = attributes['$[]']("format"))))) { + if (xsv['$==']("tsv")) { + self.format = "csv" + } else if ($truthy((($a = (self.format = xsv)['$==']("psv")) ? table.$document()['$nested?']() : (self.format = xsv)['$==']("psv")))) { + xsv = "!sv"} + } else { + + self.$logger().$error(self.$message_with_context("" + "illegal table format: " + (xsv), $hash2(["source_location"], {"source_location": reader.$cursor_at_prev_line()}))); + $a = ["psv", (function() {if ($truthy(table.$document()['$nested?']())) { + return "!sv" + } else { + return "psv" + }; return nil; })()], (self.format = $a[0]), (xsv = $a[1]), $a; + } + } else { + $a = ["psv", (function() {if ($truthy(table.$document()['$nested?']())) { + return "!sv" + } else { + return "psv" + }; return nil; })()], (self.format = $a[0]), (xsv = $a[1]), $a + }; + if ($truthy(attributes['$key?']("separator"))) { + if ($truthy((sep = attributes['$[]']("separator"))['$nil_or_empty?']())) { + $b = $$($nesting, 'DELIMITERS')['$[]'](xsv), $a = Opal.to_ary($b), (self.delimiter = ($a[0] == null ? nil : $a[0])), (self.delimiter_re = ($a[1] == null ? nil : $a[1])), $b + } else if (sep['$==']("\\t")) { + $b = $$($nesting, 'DELIMITERS')['$[]']("tsv"), $a = Opal.to_ary($b), (self.delimiter = ($a[0] == null ? nil : $a[0])), (self.delimiter_re = ($a[1] == null ? nil : $a[1])), $b + } else { + $a = [sep, new RegExp($$$('::', 'Regexp').$escape(sep))], (self.delimiter = $a[0]), (self.delimiter_re = $a[1]), $a + } + } else { + $b = $$($nesting, 'DELIMITERS')['$[]'](xsv), $a = Opal.to_ary($b), (self.delimiter = ($a[0] == null ? nil : $a[0])), (self.delimiter_re = ($a[1] == null ? nil : $a[1])), $b + }; + self.colcount = (function() {if ($truthy(table.$columns()['$empty?']())) { + return -1 + } else { + return table.$columns().$size() + }; return nil; })(); + self.buffer = ""; + self.cellspecs = []; + self.cell_open = false; + self.active_rowspans = [0]; + self.column_visits = 0; + self.current_row = []; + return (self.linenum = -1); + }, TMP_ParserContext_initialize_23.$$arity = -3); + + Opal.def(self, '$starts_with_delimiter?', TMP_ParserContext_starts_with_delimiter$q_24 = function(line) { + var self = this; + + return line['$start_with?'](self.delimiter) + }, TMP_ParserContext_starts_with_delimiter$q_24.$$arity = 1); + + Opal.def(self, '$match_delimiter', TMP_ParserContext_match_delimiter_25 = function $$match_delimiter(line) { + var self = this; + + return self.delimiter_re.$match(line) + }, TMP_ParserContext_match_delimiter_25.$$arity = 1); + + Opal.def(self, '$skip_past_delimiter', TMP_ParserContext_skip_past_delimiter_26 = function $$skip_past_delimiter(pre) { + var self = this; + + + self.buffer = "" + (self.buffer) + (pre) + (self.delimiter); + return nil; + }, TMP_ParserContext_skip_past_delimiter_26.$$arity = 1); + + Opal.def(self, '$skip_past_escaped_delimiter', TMP_ParserContext_skip_past_escaped_delimiter_27 = function $$skip_past_escaped_delimiter(pre) { + var self = this; + + + self.buffer = "" + (self.buffer) + (pre.$chop()) + (self.delimiter); + return nil; + }, TMP_ParserContext_skip_past_escaped_delimiter_27.$$arity = 1); + + Opal.def(self, '$buffer_has_unclosed_quotes?', TMP_ParserContext_buffer_has_unclosed_quotes$q_28 = function(append) { + var $a, $b, self = this, record = nil, trailing_quote = nil; + + + + if (append == null) { + append = nil; + }; + if ((record = (function() {if ($truthy(append)) { + return $rb_plus(self.buffer, append).$strip() + } else { + return self.buffer.$strip() + }; return nil; })())['$==']("\"")) { + return true + } else if ($truthy(record['$start_with?']("\""))) { + if ($truthy(($truthy($a = ($truthy($b = (trailing_quote = record['$end_with?']("\""))) ? record['$end_with?']("\"\"") : $b)) ? $a : record['$start_with?']("\"\"")))) { + return ($truthy($a = (record = record.$gsub("\"\"", ""))['$start_with?']("\"")) ? record['$end_with?']("\"")['$!']() : $a) + } else { + return trailing_quote['$!']() + } + } else { + return false + }; + }, TMP_ParserContext_buffer_has_unclosed_quotes$q_28.$$arity = -1); + + Opal.def(self, '$take_cellspec', TMP_ParserContext_take_cellspec_29 = function $$take_cellspec() { + var self = this; + + return self.cellspecs.$shift() + }, TMP_ParserContext_take_cellspec_29.$$arity = 0); + + Opal.def(self, '$push_cellspec', TMP_ParserContext_push_cellspec_30 = function $$push_cellspec(cellspec) { + var $a, self = this; + + + + if (cellspec == null) { + cellspec = $hash2([], {}); + }; + self.cellspecs['$<<'](($truthy($a = cellspec) ? $a : $hash2([], {}))); + return nil; + }, TMP_ParserContext_push_cellspec_30.$$arity = -1); + + Opal.def(self, '$keep_cell_open', TMP_ParserContext_keep_cell_open_31 = function $$keep_cell_open() { + var self = this; + + + self.cell_open = true; + return nil; + }, TMP_ParserContext_keep_cell_open_31.$$arity = 0); + + Opal.def(self, '$mark_cell_closed', TMP_ParserContext_mark_cell_closed_32 = function $$mark_cell_closed() { + var self = this; + + + self.cell_open = false; + return nil; + }, TMP_ParserContext_mark_cell_closed_32.$$arity = 0); + + Opal.def(self, '$cell_open?', TMP_ParserContext_cell_open$q_33 = function() { + var self = this; + + return self.cell_open + }, TMP_ParserContext_cell_open$q_33.$$arity = 0); + + Opal.def(self, '$cell_closed?', TMP_ParserContext_cell_closed$q_34 = function() { + var self = this; + + return self.cell_open['$!']() + }, TMP_ParserContext_cell_closed$q_34.$$arity = 0); + + Opal.def(self, '$close_open_cell', TMP_ParserContext_close_open_cell_35 = function $$close_open_cell(next_cellspec) { + var self = this; + + + + if (next_cellspec == null) { + next_cellspec = $hash2([], {}); + }; + self.$push_cellspec(next_cellspec); + if ($truthy(self['$cell_open?']())) { + self.$close_cell(true)}; + self.$advance(); + return nil; + }, TMP_ParserContext_close_open_cell_35.$$arity = -1); + + Opal.def(self, '$close_cell', TMP_ParserContext_close_cell_36 = function $$close_cell(eol) {try { + + var $a, $b, TMP_37, self = this, cell_text = nil, cellspec = nil, repeat = nil; + + + + if (eol == null) { + eol = false; + }; + if (self.format['$==']("psv")) { + + cell_text = self.buffer; + self.buffer = ""; + if ($truthy((cellspec = self.$take_cellspec()))) { + repeat = ($truthy($a = cellspec.$delete("repeatcol")) ? $a : 1) + } else { + + self.$logger().$error(self.$message_with_context("table missing leading separator; recovering automatically", $hash2(["source_location"], {"source_location": $send($$$($$($nesting, 'Reader'), 'Cursor'), 'new', Opal.to_a(self.start_cursor_data))}))); + cellspec = $hash2([], {}); + repeat = 1; + }; + } else { + + cell_text = self.buffer.$strip(); + self.buffer = ""; + cellspec = nil; + repeat = 1; + if ($truthy(($truthy($a = (($b = self.format['$==']("csv")) ? cell_text['$empty?']()['$!']() : self.format['$==']("csv"))) ? cell_text['$include?']("\"") : $a))) { + if ($truthy(($truthy($a = cell_text['$start_with?']("\"")) ? cell_text['$end_with?']("\"") : $a))) { + if ($truthy((cell_text = cell_text.$slice(1, $rb_minus(cell_text.$length(), 2))))) { + cell_text = cell_text.$strip().$squeeze("\"") + } else { + + self.$logger().$error(self.$message_with_context("unclosed quote in CSV data; setting cell to empty", $hash2(["source_location"], {"source_location": self.reader.$cursor_at_prev_line()}))); + cell_text = ""; + } + } else { + cell_text = cell_text.$squeeze("\"") + }}; + }; + $send((1), 'upto', [repeat], (TMP_37 = function(i){var self = TMP_37.$$s || this, $c, $d, TMP_38, $e, column = nil, extra_cols = nil, offset = nil, cell = nil; + if (self.colcount == null) self.colcount = nil; + if (self.table == null) self.table = nil; + if (self.current_row == null) self.current_row = nil; + if (self.reader == null) self.reader = nil; + if (self.column_visits == null) self.column_visits = nil; + if (self.linenum == null) self.linenum = nil; + + + + if (i == null) { + i = nil; + }; + if (self.colcount['$=='](-1)) { + + self.table.$columns()['$<<']((column = $$$($$($nesting, 'Table'), 'Column').$new(self.table, $rb_minus($rb_plus(self.table.$columns().$size(), i), 1)))); + if ($truthy(($truthy($c = ($truthy($d = cellspec) ? cellspec['$key?']("colspan") : $d)) ? $rb_gt((extra_cols = $rb_minus(cellspec['$[]']("colspan").$to_i(), 1)), 0) : $c))) { + + offset = self.table.$columns().$size(); + $send(extra_cols, 'times', [], (TMP_38 = function(j){var self = TMP_38.$$s || this; + if (self.table == null) self.table = nil; + + + + if (j == null) { + j = nil; + }; + return self.table.$columns()['$<<']($$$($$($nesting, 'Table'), 'Column').$new(self.table, $rb_plus(offset, j)));}, TMP_38.$$s = self, TMP_38.$$arity = 1, TMP_38));}; + } else if ($truthy((column = self.table.$columns()['$[]'](self.current_row.$size())))) { + } else { + + self.$logger().$error(self.$message_with_context("dropping cell because it exceeds specified number of columns", $hash2(["source_location"], {"source_location": self.reader.$cursor_before_mark()}))); + Opal.ret(nil); + }; + cell = $$$($$($nesting, 'Table'), 'Cell').$new(column, cell_text, cellspec, $hash2(["cursor"], {"cursor": self.reader.$cursor_before_mark()})); + self.reader.$mark(); + if ($truthy(($truthy($c = cell.$rowspan()['$!']()) ? $c : cell.$rowspan()['$=='](1)))) { + } else { + self.$activate_rowspan(cell.$rowspan(), ($truthy($c = cell.$colspan()) ? $c : 1)) + }; + self.column_visits = $rb_plus(self.column_visits, ($truthy($c = cell.$colspan()) ? $c : 1)); + self.current_row['$<<'](cell); + if ($truthy(($truthy($c = self['$end_of_row?']()) ? ($truthy($d = ($truthy($e = self.colcount['$!='](-1)) ? $e : $rb_gt(self.linenum, 0))) ? $d : ($truthy($e = eol) ? i['$=='](repeat) : $e)) : $c))) { + return self.$close_row() + } else { + return nil + };}, TMP_37.$$s = self, TMP_37.$$arity = 1, TMP_37)); + self.cell_open = false; + return nil; + } catch ($returner) { if ($returner === Opal.returner) { return $returner.$v } throw $returner; } + }, TMP_ParserContext_close_cell_36.$$arity = -1); + + Opal.def(self, '$close_row', TMP_ParserContext_close_row_39 = function $$close_row() { + var $a, self = this, $writer = nil; + + + self.table.$rows().$body()['$<<'](self.current_row); + if (self.colcount['$=='](-1)) { + self.colcount = self.column_visits}; + self.column_visits = 0; + self.current_row = []; + self.active_rowspans.$shift(); + ($truthy($a = self.active_rowspans['$[]'](0)) ? $a : (($writer = [0, 0]), $send(self.active_rowspans, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + return nil; + }, TMP_ParserContext_close_row_39.$$arity = 0); + + Opal.def(self, '$activate_rowspan', TMP_ParserContext_activate_rowspan_40 = function $$activate_rowspan(rowspan, colspan) { + var TMP_41, self = this; + + + $send((1).$upto($rb_minus(rowspan, 1)), 'each', [], (TMP_41 = function(i){var self = TMP_41.$$s || this, $a, $writer = nil; + if (self.active_rowspans == null) self.active_rowspans = nil; + + + + if (i == null) { + i = nil; + }; + $writer = [i, $rb_plus(($truthy($a = self.active_rowspans['$[]'](i)) ? $a : 0), colspan)]; + $send(self.active_rowspans, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];}, TMP_41.$$s = self, TMP_41.$$arity = 1, TMP_41)); + return nil; + }, TMP_ParserContext_activate_rowspan_40.$$arity = 2); + + Opal.def(self, '$end_of_row?', TMP_ParserContext_end_of_row$q_42 = function() { + var $a, self = this; + + return ($truthy($a = self.colcount['$=='](-1)) ? $a : self.$effective_column_visits()['$=='](self.colcount)) + }, TMP_ParserContext_end_of_row$q_42.$$arity = 0); + + Opal.def(self, '$effective_column_visits', TMP_ParserContext_effective_column_visits_43 = function $$effective_column_visits() { + var self = this; + + return $rb_plus(self.column_visits, self.active_rowspans['$[]'](0)) + }, TMP_ParserContext_effective_column_visits_43.$$arity = 0); + return (Opal.def(self, '$advance', TMP_ParserContext_advance_44 = function $$advance() { + var self = this; + + return (self.linenum = $rb_plus(self.linenum, 1)) + }, TMP_ParserContext_advance_44.$$arity = 0), nil) && 'advance'; + })($$($nesting, 'Table'), null, $nesting); + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/converter/composite"] = function(Opal) { + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $send = Opal.send, $truthy = Opal.truthy, $hash2 = Opal.hash2; + + Opal.add_stubs(['$attr_reader', '$each', '$compact', '$flatten', '$respond_to?', '$composed', '$node_name', '$convert', '$converter_for', '$[]', '$find_converter', '$[]=', '$-', '$handles?', '$raise']); + return (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + (function($base, $super, $parent_nesting) { + function $CompositeConverter(){}; + var self = $CompositeConverter = $klass($base, $super, 'CompositeConverter', $CompositeConverter); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_CompositeConverter_initialize_1, TMP_CompositeConverter_convert_3, TMP_CompositeConverter_converter_for_4, TMP_CompositeConverter_find_converter_5; + + def.converter_map = def.converters = nil; + + self.$attr_reader("converters"); + + Opal.def(self, '$initialize', TMP_CompositeConverter_initialize_1 = function $$initialize(backend, $a) { + var $post_args, converters, TMP_2, self = this; + + + + $post_args = Opal.slice.call(arguments, 1, arguments.length); + + converters = $post_args;; + self.backend = backend; + $send((self.converters = converters.$flatten().$compact()), 'each', [], (TMP_2 = function(converter){var self = TMP_2.$$s || this; + + + + if (converter == null) { + converter = nil; + }; + if ($truthy(converter['$respond_to?']("composed"))) { + return converter.$composed(self) + } else { + return nil + };}, TMP_2.$$s = self, TMP_2.$$arity = 1, TMP_2)); + return (self.converter_map = $hash2([], {})); + }, TMP_CompositeConverter_initialize_1.$$arity = -2); + + Opal.def(self, '$convert', TMP_CompositeConverter_convert_3 = function $$convert(node, transform, opts) { + var $a, self = this; + + + + if (transform == null) { + transform = nil; + }; + + if (opts == null) { + opts = $hash2([], {}); + }; + transform = ($truthy($a = transform) ? $a : node.$node_name()); + return self.$converter_for(transform).$convert(node, transform, opts); + }, TMP_CompositeConverter_convert_3.$$arity = -2); + Opal.alias(self, "convert_with_options", "convert"); + + Opal.def(self, '$converter_for', TMP_CompositeConverter_converter_for_4 = function $$converter_for(transform) { + var $a, self = this, $writer = nil; + + return ($truthy($a = self.converter_map['$[]'](transform)) ? $a : (($writer = [transform, self.$find_converter(transform)]), $send(self.converter_map, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])) + }, TMP_CompositeConverter_converter_for_4.$$arity = 1); + return (Opal.def(self, '$find_converter', TMP_CompositeConverter_find_converter_5 = function $$find_converter(transform) {try { + + var TMP_6, self = this; + + + $send(self.converters, 'each', [], (TMP_6 = function(candidate){var self = TMP_6.$$s || this; + + + + if (candidate == null) { + candidate = nil; + }; + if ($truthy(candidate['$handles?'](transform))) { + Opal.ret(candidate) + } else { + return nil + };}, TMP_6.$$s = self, TMP_6.$$arity = 1, TMP_6)); + return self.$raise("" + "Could not find a converter to handle transform: " + (transform)); + } catch ($returner) { if ($returner === Opal.returner) { return $returner.$v } throw $returner; } + }, TMP_CompositeConverter_find_converter_5.$$arity = 1), nil) && 'find_converter'; + })($$($nesting, 'Converter'), $$$($$($nesting, 'Converter'), 'Base'), $nesting) + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/converter/html5"] = function(Opal) { + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + function $rb_gt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); + } + function $rb_plus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); + } + function $rb_le(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs <= rhs : lhs['$<='](rhs); + } + function $rb_lt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); + } + function $rb_times(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs * rhs : lhs['$*'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $send = Opal.send, $hash2 = Opal.hash2, $truthy = Opal.truthy, $gvars = Opal.gvars; + + Opal.add_stubs(['$default=', '$-', '$==', '$[]', '$instance', '$empty?', '$attr', '$attr?', '$<<', '$include?', '$gsub', '$extname', '$slice', '$length', '$doctitle', '$normalize_web_path', '$embed_primary_stylesheet', '$read_asset', '$normalize_system_path', '$===', '$coderay_stylesheet_name', '$embed_coderay_stylesheet', '$pygments_stylesheet_name', '$embed_pygments_stylesheet', '$docinfo', '$id', '$sections?', '$doctype', '$join', '$noheader', '$outline', '$generate_manname_section', '$has_header?', '$notitle', '$title', '$header', '$each', '$authors', '$>', '$name', '$email', '$sub_macros', '$+', '$downcase', '$concat', '$content', '$footnotes?', '$!', '$footnotes', '$index', '$text', '$nofooter', '$inspect', '$!=', '$to_i', '$attributes', '$document', '$sections', '$level', '$caption', '$captioned_title', '$numbered', '$<=', '$<', '$sectname', '$sectnum', '$role', '$title?', '$icon_uri', '$compact', '$media_uri', '$option?', '$append_boolean_attribute', '$style', '$items', '$blocks?', '$text?', '$chomp', '$safe', '$read_svg_contents', '$alt', '$image_uri', '$encode_quotes', '$append_link_constraint_attrs', '$pygments_background', '$to_sym', '$*', '$count', '$start_with?', '$end_with?', '$list_marker_keyword', '$parent', '$warn', '$logger', '$context', '$error', '$new', '$size', '$columns', '$by_section', '$rows', '$colspan', '$rowspan', '$role?', '$unshift', '$shift', '$split', '$nil_or_empty?', '$type', '$catalog', '$xreftext', '$target', '$map', '$chop', '$upcase', '$read_contents', '$sub', '$match']); + return (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + (function($base, $super, $parent_nesting) { + function $Html5Converter(){}; + var self = $Html5Converter = $klass($base, $super, 'Html5Converter', $Html5Converter); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Html5Converter_initialize_1, TMP_Html5Converter_document_2, TMP_Html5Converter_embedded_5, TMP_Html5Converter_outline_7, TMP_Html5Converter_section_9, TMP_Html5Converter_admonition_10, TMP_Html5Converter_audio_11, TMP_Html5Converter_colist_12, TMP_Html5Converter_dlist_15, TMP_Html5Converter_example_22, TMP_Html5Converter_floating_title_23, TMP_Html5Converter_image_24, TMP_Html5Converter_listing_25, TMP_Html5Converter_literal_26, TMP_Html5Converter_stem_27, TMP_Html5Converter_olist_29, TMP_Html5Converter_open_31, TMP_Html5Converter_page_break_32, TMP_Html5Converter_paragraph_33, TMP_Html5Converter_preamble_34, TMP_Html5Converter_quote_35, TMP_Html5Converter_thematic_break_36, TMP_Html5Converter_sidebar_37, TMP_Html5Converter_table_38, TMP_Html5Converter_toc_43, TMP_Html5Converter_ulist_44, TMP_Html5Converter_verse_46, TMP_Html5Converter_video_47, TMP_Html5Converter_inline_anchor_48, TMP_Html5Converter_inline_break_49, TMP_Html5Converter_inline_button_50, TMP_Html5Converter_inline_callout_51, TMP_Html5Converter_inline_footnote_52, TMP_Html5Converter_inline_image_53, TMP_Html5Converter_inline_indexterm_56, TMP_Html5Converter_inline_kbd_57, TMP_Html5Converter_inline_menu_58, TMP_Html5Converter_inline_quoted_59, TMP_Html5Converter_append_boolean_attribute_60, TMP_Html5Converter_encode_quotes_61, TMP_Html5Converter_generate_manname_section_62, TMP_Html5Converter_append_link_constraint_attrs_63, TMP_Html5Converter_read_svg_contents_64, $writer = nil; + + def.xml_mode = def.void_element_slash = def.stylesheets = def.pygments_bg = def.refs = nil; + + + $writer = [["", "", false]]; + $send(Opal.const_set($nesting[0], 'QUOTE_TAGS', $hash2(["monospaced", "emphasis", "strong", "double", "single", "mark", "superscript", "subscript", "asciimath", "latexmath"], {"monospaced": ["", "", true], "emphasis": ["", "", true], "strong": ["", "", true], "double": ["“", "”", false], "single": ["‘", "’", false], "mark": ["", "", true], "superscript": ["", "", true], "subscript": ["", "", true], "asciimath": ["\\$", "\\$", false], "latexmath": ["\\(", "\\)", false]})), 'default=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + Opal.const_set($nesting[0], 'DropAnchorRx', /<(?:a[^>+]+|\/a)>/); + Opal.const_set($nesting[0], 'StemBreakRx', / *\\\n(?:\\?\n)*|\n\n+/); + Opal.const_set($nesting[0], 'SvgPreambleRx', /^.*?(?=]*>/); + Opal.const_set($nesting[0], 'DimensionAttributeRx', /\s(?:width|height|style)=(["']).*?\1/); + + Opal.def(self, '$initialize', TMP_Html5Converter_initialize_1 = function $$initialize(backend, opts) { + var self = this; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + self.xml_mode = opts['$[]']("htmlsyntax")['$==']("xml"); + self.void_element_slash = (function() {if ($truthy(self.xml_mode)) { + return "/" + } else { + return nil + }; return nil; })(); + return (self.stylesheets = $$($nesting, 'Stylesheets').$instance()); + }, TMP_Html5Converter_initialize_1.$$arity = -2); + + Opal.def(self, '$document', TMP_Html5Converter_document_2 = function $$document(node) { + var $a, $b, $c, TMP_3, TMP_4, self = this, slash = nil, br = nil, asset_uri_scheme = nil, cdn_base = nil, linkcss = nil, result = nil, lang_attribute = nil, authors = nil, icon_href = nil, icon_type = nil, icon_ext = nil, webfonts = nil, iconfont_stylesheet = nil, $case = nil, highlighter = nil, pygments_style = nil, docinfo_content = nil, body_attrs = nil, sectioned = nil, classes = nil, details = nil, idx = nil, highlightjs_path = nil, prettify_path = nil, eqnums_val = nil, eqnums_opt = nil; + + + slash = self.void_element_slash; + br = "" + ""; + if ($truthy((asset_uri_scheme = node.$attr("asset-uri-scheme", "https"))['$empty?']())) { + } else { + asset_uri_scheme = "" + (asset_uri_scheme) + ":" + }; + cdn_base = "" + (asset_uri_scheme) + "//cdnjs.cloudflare.com/ajax/libs"; + linkcss = node['$attr?']("linkcss"); + result = [""]; + lang_attribute = (function() {if ($truthy(node['$attr?']("nolang"))) { + return "" + } else { + return "" + " lang=\"" + (node.$attr("lang", "en")) + "\"" + }; return nil; })(); + result['$<<']("" + ""); + result['$<<']("" + "\n" + "\n" + "\n" + "\n" + ""); + if ($truthy(node['$attr?']("app-name"))) { + result['$<<']("" + "")}; + if ($truthy(node['$attr?']("description"))) { + result['$<<']("" + "")}; + if ($truthy(node['$attr?']("keywords"))) { + result['$<<']("" + "")}; + if ($truthy(node['$attr?']("authors"))) { + result['$<<']("" + "")}; + if ($truthy(node['$attr?']("copyright"))) { + result['$<<']("" + "")}; + if ($truthy(node['$attr?']("favicon"))) { + + if ($truthy((icon_href = node.$attr("favicon"))['$empty?']())) { + $a = ["favicon.ico", "image/x-icon"], (icon_href = $a[0]), (icon_type = $a[1]), $a + } else { + icon_type = (function() {if ((icon_ext = $$$('::', 'File').$extname(icon_href))['$=='](".ico")) { + return "image/x-icon" + } else { + return "" + "image/" + (icon_ext.$slice(1, icon_ext.$length())) + }; return nil; })() + }; + result['$<<']("" + "");}; + result['$<<']("" + "" + (node.$doctitle($hash2(["sanitize", "use_fallback"], {"sanitize": true, "use_fallback": true}))) + ""); + if ($truthy($$($nesting, 'DEFAULT_STYLESHEET_KEYS')['$include?'](node.$attr("stylesheet")))) { + + if ($truthy((webfonts = node.$attr("webfonts")))) { + result['$<<']("" + "")}; + if ($truthy(linkcss)) { + result['$<<']("" + "") + } else { + result['$<<'](self.stylesheets.$embed_primary_stylesheet()) + }; + } else if ($truthy(node['$attr?']("stylesheet"))) { + if ($truthy(linkcss)) { + result['$<<']("" + "") + } else { + result['$<<']("" + "") + }}; + if ($truthy(node['$attr?']("icons", "font"))) { + if ($truthy(node['$attr?']("iconfont-remote"))) { + result['$<<']("" + "") + } else { + + iconfont_stylesheet = "" + (node.$attr("iconfont-name", "font-awesome")) + ".css"; + result['$<<']("" + ""); + }}; + $case = (highlighter = node.$attr("source-highlighter")); + if ("coderay"['$===']($case)) {if (node.$attr("coderay-css", "class")['$==']("class")) { + if ($truthy(linkcss)) { + result['$<<']("" + "") + } else { + result['$<<'](self.stylesheets.$embed_coderay_stylesheet()) + }}} + else if ("pygments"['$===']($case)) {if (node.$attr("pygments-css", "class")['$==']("class")) { + + pygments_style = node.$attr("pygments-style"); + if ($truthy(linkcss)) { + result['$<<']("" + "") + } else { + result['$<<'](self.stylesheets.$embed_pygments_stylesheet(pygments_style)) + };}}; + if ($truthy((docinfo_content = node.$docinfo())['$empty?']())) { + } else { + result['$<<'](docinfo_content) + }; + result['$<<'](""); + body_attrs = (function() {if ($truthy(node.$id())) { + return ["" + "id=\"" + (node.$id()) + "\""] + } else { + return [] + }; return nil; })(); + if ($truthy(($truthy($a = ($truthy($b = ($truthy($c = (sectioned = node['$sections?']())) ? node['$attr?']("toc-class") : $c)) ? node['$attr?']("toc") : $b)) ? node['$attr?']("toc-placement", "auto") : $a))) { + classes = [node.$doctype(), node.$attr("toc-class"), "" + "toc-" + (node.$attr("toc-position", "header"))] + } else { + classes = [node.$doctype()] + }; + if ($truthy(node['$attr?']("docrole"))) { + classes['$<<'](node.$attr("docrole"))}; + body_attrs['$<<']("" + "class=\"" + (classes.$join(" ")) + "\""); + if ($truthy(node['$attr?']("max-width"))) { + body_attrs['$<<']("" + "style=\"max-width: " + (node.$attr("max-width")) + ";\"")}; + result['$<<']("" + ""); + if ($truthy(node.$noheader())) { + } else { + + result['$<<']("
    "); + if (node.$doctype()['$==']("manpage")) { + + result['$<<']("" + "

    " + (node.$doctitle()) + " Manual Page

    "); + if ($truthy(($truthy($a = ($truthy($b = sectioned) ? node['$attr?']("toc") : $b)) ? node['$attr?']("toc-placement", "auto") : $a))) { + result['$<<']("" + "
    \n" + "
    " + (node.$attr("toc-title")) + "
    \n" + (self.$outline(node)) + "\n" + "
    ")}; + if ($truthy(node['$attr?']("manpurpose"))) { + result['$<<'](self.$generate_manname_section(node))}; + } else { + + if ($truthy(node['$has_header?']())) { + + if ($truthy(node.$notitle())) { + } else { + result['$<<']("" + "

    " + (node.$header().$title()) + "

    ") + }; + details = []; + idx = 1; + $send(node.$authors(), 'each', [], (TMP_3 = function(author){var self = TMP_3.$$s || this; + + + + if (author == null) { + author = nil; + }; + details['$<<']("" + "" + (author.$name()) + "" + (br)); + if ($truthy(author.$email())) { + details['$<<']("" + "" + (node.$sub_macros(author.$email())) + "" + (br))}; + return (idx = $rb_plus(idx, 1));}, TMP_3.$$s = self, TMP_3.$$arity = 1, TMP_3)); + if ($truthy(node['$attr?']("revnumber"))) { + details['$<<']("" + "" + (($truthy($a = node.$attr("version-label")) ? $a : "").$downcase()) + " " + (node.$attr("revnumber")) + ((function() {if ($truthy(node['$attr?']("revdate"))) { + return "," + } else { + return "" + }; return nil; })()) + "")}; + if ($truthy(node['$attr?']("revdate"))) { + details['$<<']("" + "" + (node.$attr("revdate")) + "")}; + if ($truthy(node['$attr?']("revremark"))) { + details['$<<']("" + (br) + "" + (node.$attr("revremark")) + "")}; + if ($truthy(details['$empty?']())) { + } else { + + result['$<<']("
    "); + result.$concat(details); + result['$<<']("
    "); + };}; + if ($truthy(($truthy($a = ($truthy($b = sectioned) ? node['$attr?']("toc") : $b)) ? node['$attr?']("toc-placement", "auto") : $a))) { + result['$<<']("" + "
    \n" + "
    " + (node.$attr("toc-title")) + "
    \n" + (self.$outline(node)) + "\n" + "
    ")}; + }; + result['$<<']("
    "); + }; + result['$<<']("" + "
    \n" + (node.$content()) + "\n" + "
    "); + if ($truthy(($truthy($a = node['$footnotes?']()) ? node['$attr?']("nofootnotes")['$!']() : $a))) { + + result['$<<']("" + "
    \n" + ""); + $send(node.$footnotes(), 'each', [], (TMP_4 = function(footnote){var self = TMP_4.$$s || this; + + + + if (footnote == null) { + footnote = nil; + }; + return result['$<<']("" + "
    \n" + "" + (footnote.$index()) + ". " + (footnote.$text()) + "\n" + "
    ");}, TMP_4.$$s = self, TMP_4.$$arity = 1, TMP_4)); + result['$<<']("
    ");}; + if ($truthy(node.$nofooter())) { + } else { + + result['$<<']("
    "); + result['$<<']("
    "); + if ($truthy(node['$attr?']("revnumber"))) { + result['$<<']("" + (node.$attr("version-label")) + " " + (node.$attr("revnumber")) + (br))}; + if ($truthy(($truthy($a = node['$attr?']("last-update-label")) ? node['$attr?']("reproducible")['$!']() : $a))) { + result['$<<']("" + (node.$attr("last-update-label")) + " " + (node.$attr("docdatetime")))}; + result['$<<']("
    "); + result['$<<']("
    "); + }; + if ($truthy((docinfo_content = node.$docinfo("footer"))['$empty?']())) { + } else { + result['$<<'](docinfo_content) + }; + $case = highlighter; + if ("highlightjs"['$===']($case) || "highlight.js"['$===']($case)) { + highlightjs_path = node.$attr("highlightjsdir", "" + (cdn_base) + "/highlight.js/9.13.1"); + result['$<<']("" + ""); + result['$<<']("" + "\n" + "");} + else if ("prettify"['$===']($case)) { + prettify_path = node.$attr("prettifydir", "" + (cdn_base) + "/prettify/r298"); + result['$<<']("" + ""); + result['$<<']("" + "\n" + "");}; + if ($truthy(node['$attr?']("stem"))) { + + eqnums_val = node.$attr("eqnums", "none"); + if ($truthy(eqnums_val['$empty?']())) { + eqnums_val = "AMS"}; + eqnums_opt = "" + " equationNumbers: { autoNumber: \"" + (eqnums_val) + "\" } "; + result['$<<']("" + "\n" + "");}; + result['$<<'](""); + result['$<<'](""); + return result.$join($$($nesting, 'LF')); + }, TMP_Html5Converter_document_2.$$arity = 1); + + Opal.def(self, '$embedded', TMP_Html5Converter_embedded_5 = function $$embedded(node) { + var $a, $b, $c, TMP_6, self = this, result = nil, id_attr = nil, toc_p = nil; + + + result = []; + if (node.$doctype()['$==']("manpage")) { + + if ($truthy(node.$notitle())) { + } else { + + id_attr = (function() {if ($truthy(node.$id())) { + return "" + " id=\"" + (node.$id()) + "\"" + } else { + return "" + }; return nil; })(); + result['$<<']("" + "" + (node.$doctitle()) + " Manual Page"); + }; + if ($truthy(node['$attr?']("manpurpose"))) { + result['$<<'](self.$generate_manname_section(node))}; + } else if ($truthy(($truthy($a = node['$has_header?']()) ? node.$notitle()['$!']() : $a))) { + + id_attr = (function() {if ($truthy(node.$id())) { + return "" + " id=\"" + (node.$id()) + "\"" + } else { + return "" + }; return nil; })(); + result['$<<']("" + "" + (node.$header().$title()) + "");}; + if ($truthy(($truthy($a = ($truthy($b = ($truthy($c = node['$sections?']()) ? node['$attr?']("toc") : $c)) ? (toc_p = node.$attr("toc-placement"))['$!=']("macro") : $b)) ? toc_p['$!=']("preamble") : $a))) { + result['$<<']("" + "
    \n" + "
    " + (node.$attr("toc-title")) + "
    \n" + (self.$outline(node)) + "\n" + "
    ")}; + result['$<<'](node.$content()); + if ($truthy(($truthy($a = node['$footnotes?']()) ? node['$attr?']("nofootnotes")['$!']() : $a))) { + + result['$<<']("" + "
    \n" + ""); + $send(node.$footnotes(), 'each', [], (TMP_6 = function(footnote){var self = TMP_6.$$s || this; + + + + if (footnote == null) { + footnote = nil; + }; + return result['$<<']("" + "
    \n" + "" + (footnote.$index()) + ". " + (footnote.$text()) + "\n" + "
    ");}, TMP_6.$$s = self, TMP_6.$$arity = 1, TMP_6)); + result['$<<']("
    ");}; + return result.$join($$($nesting, 'LF')); + }, TMP_Html5Converter_embedded_5.$$arity = 1); + + Opal.def(self, '$outline', TMP_Html5Converter_outline_7 = function $$outline(node, opts) { + var $a, $b, TMP_8, self = this, sectnumlevels = nil, toclevels = nil, sections = nil, result = nil; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + if ($truthy(node['$sections?']())) { + } else { + return nil + }; + sectnumlevels = ($truthy($a = opts['$[]']("sectnumlevels")) ? $a : ($truthy($b = node.$document().$attributes()['$[]']("sectnumlevels")) ? $b : 3).$to_i()); + toclevels = ($truthy($a = opts['$[]']("toclevels")) ? $a : ($truthy($b = node.$document().$attributes()['$[]']("toclevels")) ? $b : 2).$to_i()); + sections = node.$sections(); + result = ["" + "
      "]; + $send(sections, 'each', [], (TMP_8 = function(section){var self = TMP_8.$$s || this, $c, slevel = nil, stitle = nil, signifier = nil, child_toc_level = nil; + + + + if (section == null) { + section = nil; + }; + slevel = section.$level(); + if ($truthy(section.$caption())) { + stitle = section.$captioned_title() + } else if ($truthy(($truthy($c = section.$numbered()) ? $rb_le(slevel, sectnumlevels) : $c))) { + if ($truthy(($truthy($c = $rb_lt(slevel, 2)) ? node.$document().$doctype()['$==']("book") : $c))) { + if (section.$sectname()['$==']("chapter")) { + stitle = "" + ((function() {if ($truthy((signifier = node.$document().$attributes()['$[]']("chapter-signifier")))) { + return "" + (signifier) + " " + } else { + return "" + }; return nil; })()) + (section.$sectnum()) + " " + (section.$title()) + } else if (section.$sectname()['$==']("part")) { + stitle = "" + ((function() {if ($truthy((signifier = node.$document().$attributes()['$[]']("part-signifier")))) { + return "" + (signifier) + " " + } else { + return "" + }; return nil; })()) + (section.$sectnum(nil, ":")) + " " + (section.$title()) + } else { + stitle = "" + (section.$sectnum()) + " " + (section.$title()) + } + } else { + stitle = "" + (section.$sectnum()) + " " + (section.$title()) + } + } else { + stitle = section.$title() + }; + if ($truthy(stitle['$include?']("" + (stitle) + ""); + result['$<<'](child_toc_level); + return result['$<<'](""); + } else { + return result['$<<']("" + "
    • " + (stitle) + "
    • ") + };}, TMP_8.$$s = self, TMP_8.$$arity = 1, TMP_8)); + result['$<<']("
    "); + return result.$join($$($nesting, 'LF')); + }, TMP_Html5Converter_outline_7.$$arity = -2); + + Opal.def(self, '$section', TMP_Html5Converter_section_9 = function $$section(node) { + var $a, $b, self = this, doc_attrs = nil, level = nil, title = nil, signifier = nil, id_attr = nil, id = nil, role = nil; + + + doc_attrs = node.$document().$attributes(); + level = node.$level(); + if ($truthy(node.$caption())) { + title = node.$captioned_title() + } else if ($truthy(($truthy($a = node.$numbered()) ? $rb_le(level, ($truthy($b = doc_attrs['$[]']("sectnumlevels")) ? $b : 3).$to_i()) : $a))) { + if ($truthy(($truthy($a = $rb_lt(level, 2)) ? node.$document().$doctype()['$==']("book") : $a))) { + if (node.$sectname()['$==']("chapter")) { + title = "" + ((function() {if ($truthy((signifier = doc_attrs['$[]']("chapter-signifier")))) { + return "" + (signifier) + " " + } else { + return "" + }; return nil; })()) + (node.$sectnum()) + " " + (node.$title()) + } else if (node.$sectname()['$==']("part")) { + title = "" + ((function() {if ($truthy((signifier = doc_attrs['$[]']("part-signifier")))) { + return "" + (signifier) + " " + } else { + return "" + }; return nil; })()) + (node.$sectnum(nil, ":")) + " " + (node.$title()) + } else { + title = "" + (node.$sectnum()) + " " + (node.$title()) + } + } else { + title = "" + (node.$sectnum()) + " " + (node.$title()) + } + } else { + title = node.$title() + }; + if ($truthy(node.$id())) { + + id_attr = "" + " id=\"" + ((id = node.$id())) + "\""; + if ($truthy(doc_attrs['$[]']("sectlinks"))) { + title = "" + "" + (title) + ""}; + if ($truthy(doc_attrs['$[]']("sectanchors"))) { + if (doc_attrs['$[]']("sectanchors")['$==']("after")) { + title = "" + (title) + "" + } else { + title = "" + "" + (title) + }}; + } else { + id_attr = "" + }; + if (level['$=='](0)) { + return "" + "" + (title) + "\n" + (node.$content()) + } else { + return "" + "
    \n" + "" + (title) + "\n" + ((function() {if (level['$=='](1)) { + return "" + "
    \n" + (node.$content()) + "\n" + "
    " + } else { + return node.$content() + }; return nil; })()) + "\n" + "
    " + }; + }, TMP_Html5Converter_section_9.$$arity = 1); + + Opal.def(self, '$admonition', TMP_Html5Converter_admonition_10 = function $$admonition(node) { + var $a, self = this, id_attr = nil, name = nil, title_element = nil, label = nil, role = nil; + + + id_attr = (function() {if ($truthy(node.$id())) { + return "" + " id=\"" + (node.$id()) + "\"" + } else { + return "" + }; return nil; })(); + name = node.$attr("name"); + title_element = (function() {if ($truthy(node['$title?']())) { + return "" + "
    " + (node.$title()) + "
    \n" + } else { + return "" + }; return nil; })(); + if ($truthy(node.$document()['$attr?']("icons"))) { + if ($truthy(($truthy($a = node.$document()['$attr?']("icons", "font")) ? node['$attr?']("icon")['$!']() : $a))) { + label = "" + "" + } else { + label = "" + "\""" + } + } else { + label = "" + "
    " + (node.$attr("textlabel")) + "
    " + }; + return "" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "
    \n" + (label) + "\n" + "\n" + (title_element) + (node.$content()) + "\n" + "
    \n" + "
    "; + }, TMP_Html5Converter_admonition_10.$$arity = 1); + + Opal.def(self, '$audio', TMP_Html5Converter_audio_11 = function $$audio(node) { + var $a, self = this, xml = nil, id_attribute = nil, classes = nil, class_attribute = nil, title_element = nil, start_t = nil, end_t = nil, time_anchor = nil; + + + xml = self.xml_mode; + id_attribute = (function() {if ($truthy(node.$id())) { + return "" + " id=\"" + (node.$id()) + "\"" + } else { + return "" + }; return nil; })(); + classes = ["audioblock", node.$role()].$compact(); + class_attribute = "" + " class=\"" + (classes.$join(" ")) + "\""; + title_element = (function() {if ($truthy(node['$title?']())) { + return "" + "
    " + (node.$title()) + "
    \n" + } else { + return "" + }; return nil; })(); + start_t = node.$attr("start", nil, false); + end_t = node.$attr("end", nil, false); + time_anchor = (function() {if ($truthy(($truthy($a = start_t) ? $a : end_t))) { + return "" + "#t=" + (($truthy($a = start_t) ? $a : "")) + ((function() {if ($truthy(end_t)) { + return "" + "," + (end_t) + } else { + return "" + }; return nil; })()) + } else { + return "" + }; return nil; })(); + return "" + "\n" + (title_element) + "
    \n" + "\n" + "
    \n" + ""; + }, TMP_Html5Converter_audio_11.$$arity = 1); + + Opal.def(self, '$colist', TMP_Html5Converter_colist_12 = function $$colist(node) { + var $a, TMP_13, TMP_14, self = this, result = nil, id_attribute = nil, classes = nil, class_attribute = nil, font_icons = nil, num = nil; + + + result = []; + id_attribute = (function() {if ($truthy(node.$id())) { + return "" + " id=\"" + (node.$id()) + "\"" + } else { + return "" + }; return nil; })(); + classes = ["colist", node.$style(), node.$role()].$compact(); + class_attribute = "" + " class=\"" + (classes.$join(" ")) + "\""; + result['$<<']("" + ""); + if ($truthy(node['$title?']())) { + result['$<<']("" + "
    " + (node.$title()) + "
    ")}; + if ($truthy(node.$document()['$attr?']("icons"))) { + + result['$<<'](""); + $a = [node.$document()['$attr?']("icons", "font"), 0], (font_icons = $a[0]), (num = $a[1]), $a; + $send(node.$items(), 'each', [], (TMP_13 = function(item){var self = TMP_13.$$s || this, num_label = nil; + if (self.void_element_slash == null) self.void_element_slash = nil; + + + + if (item == null) { + item = nil; + }; + num = $rb_plus(num, 1); + if ($truthy(font_icons)) { + num_label = "" + "" + (num) + "" + } else { + num_label = "" + "\""" + }; + return result['$<<']("" + "\n" + "\n" + "\n" + "");}, TMP_13.$$s = self, TMP_13.$$arity = 1, TMP_13)); + result['$<<']("
    " + (num_label) + "" + (item.$text()) + ((function() {if ($truthy(item['$blocks?']())) { + return $rb_plus($$($nesting, 'LF'), item.$content()) + } else { + return "" + }; return nil; })()) + "
    "); + } else { + + result['$<<']("
      "); + $send(node.$items(), 'each', [], (TMP_14 = function(item){var self = TMP_14.$$s || this; + + + + if (item == null) { + item = nil; + }; + return result['$<<']("" + "
    1. \n" + "

      " + (item.$text()) + "

      " + ((function() {if ($truthy(item['$blocks?']())) { + return $rb_plus($$($nesting, 'LF'), item.$content()) + } else { + return "" + }; return nil; })()) + "\n" + "
    2. ");}, TMP_14.$$s = self, TMP_14.$$arity = 1, TMP_14)); + result['$<<']("
    "); + }; + result['$<<'](""); + return result.$join($$($nesting, 'LF')); + }, TMP_Html5Converter_colist_12.$$arity = 1); + + Opal.def(self, '$dlist', TMP_Html5Converter_dlist_15 = function $$dlist(node) { + var TMP_16, $a, TMP_18, TMP_20, self = this, result = nil, id_attribute = nil, classes = nil, $case = nil, class_attribute = nil, slash = nil, col_style_attribute = nil, dt_style_attribute = nil; + + + result = []; + id_attribute = (function() {if ($truthy(node.$id())) { + return "" + " id=\"" + (node.$id()) + "\"" + } else { + return "" + }; return nil; })(); + classes = (function() {$case = node.$style(); + if ("qanda"['$===']($case)) {return ["qlist", "qanda", node.$role()]} + else if ("horizontal"['$===']($case)) {return ["hdlist", node.$role()]} + else {return ["dlist", node.$style(), node.$role()]}})().$compact(); + class_attribute = "" + " class=\"" + (classes.$join(" ")) + "\""; + result['$<<']("" + ""); + if ($truthy(node['$title?']())) { + result['$<<']("" + "
    " + (node.$title()) + "
    ")}; + $case = node.$style(); + if ("qanda"['$===']($case)) { + result['$<<']("
      "); + $send(node.$items(), 'each', [], (TMP_16 = function(terms, dd){var self = TMP_16.$$s || this, TMP_17; + + + + if (terms == null) { + terms = nil; + }; + + if (dd == null) { + dd = nil; + }; + result['$<<']("
    1. "); + $send([].concat(Opal.to_a(terms)), 'each', [], (TMP_17 = function(dt){var self = TMP_17.$$s || this; + + + + if (dt == null) { + dt = nil; + }; + return result['$<<']("" + "

      " + (dt.$text()) + "

      ");}, TMP_17.$$s = self, TMP_17.$$arity = 1, TMP_17)); + if ($truthy(dd)) { + + if ($truthy(dd['$text?']())) { + result['$<<']("" + "

      " + (dd.$text()) + "

      ")}; + if ($truthy(dd['$blocks?']())) { + result['$<<'](dd.$content())};}; + return result['$<<']("
    2. ");}, TMP_16.$$s = self, TMP_16.$$arity = 2, TMP_16)); + result['$<<']("
    ");} + else if ("horizontal"['$===']($case)) { + slash = self.void_element_slash; + result['$<<'](""); + if ($truthy(($truthy($a = node['$attr?']("labelwidth")) ? $a : node['$attr?']("itemwidth")))) { + + result['$<<'](""); + col_style_attribute = (function() {if ($truthy(node['$attr?']("labelwidth"))) { + return "" + " style=\"width: " + (node.$attr("labelwidth").$chomp("%")) + "%;\"" + } else { + return "" + }; return nil; })(); + result['$<<']("" + ""); + col_style_attribute = (function() {if ($truthy(node['$attr?']("itemwidth"))) { + return "" + " style=\"width: " + (node.$attr("itemwidth").$chomp("%")) + "%;\"" + } else { + return "" + }; return nil; })(); + result['$<<']("" + ""); + result['$<<']("");}; + $send(node.$items(), 'each', [], (TMP_18 = function(terms, dd){var self = TMP_18.$$s || this, TMP_19, terms_array = nil, last_term = nil; + + + + if (terms == null) { + terms = nil; + }; + + if (dd == null) { + dd = nil; + }; + result['$<<'](""); + result['$<<']("" + ""); + result['$<<'](""); + return result['$<<']("");}, TMP_18.$$s = self, TMP_18.$$arity = 2, TMP_18)); + result['$<<']("
    "); + terms_array = [].concat(Opal.to_a(terms)); + last_term = terms_array['$[]'](-1); + $send(terms_array, 'each', [], (TMP_19 = function(dt){var self = TMP_19.$$s || this; + + + + if (dt == null) { + dt = nil; + }; + result['$<<'](dt.$text()); + if ($truthy(dt['$!='](last_term))) { + return result['$<<']("" + "") + } else { + return nil + };}, TMP_19.$$s = self, TMP_19.$$arity = 1, TMP_19)); + result['$<<'](""); + if ($truthy(dd)) { + + if ($truthy(dd['$text?']())) { + result['$<<']("" + "

    " + (dd.$text()) + "

    ")}; + if ($truthy(dd['$blocks?']())) { + result['$<<'](dd.$content())};}; + result['$<<']("
    ");} + else { + result['$<<']("
    "); + dt_style_attribute = (function() {if ($truthy(node.$style())) { + return "" + } else { + return " class=\"hdlist1\"" + }; return nil; })(); + $send(node.$items(), 'each', [], (TMP_20 = function(terms, dd){var self = TMP_20.$$s || this, TMP_21; + + + + if (terms == null) { + terms = nil; + }; + + if (dd == null) { + dd = nil; + }; + $send([].concat(Opal.to_a(terms)), 'each', [], (TMP_21 = function(dt){var self = TMP_21.$$s || this; + + + + if (dt == null) { + dt = nil; + }; + return result['$<<']("" + "" + (dt.$text()) + "");}, TMP_21.$$s = self, TMP_21.$$arity = 1, TMP_21)); + if ($truthy(dd)) { + + result['$<<']("
    "); + if ($truthy(dd['$text?']())) { + result['$<<']("" + "

    " + (dd.$text()) + "

    ")}; + if ($truthy(dd['$blocks?']())) { + result['$<<'](dd.$content())}; + return result['$<<']("
    "); + } else { + return nil + };}, TMP_20.$$s = self, TMP_20.$$arity = 2, TMP_20)); + result['$<<']("
    ");}; + result['$<<'](""); + return result.$join($$($nesting, 'LF')); + }, TMP_Html5Converter_dlist_15.$$arity = 1); + + Opal.def(self, '$example', TMP_Html5Converter_example_22 = function $$example(node) { + var self = this, id_attribute = nil, title_element = nil, role = nil; + + + id_attribute = (function() {if ($truthy(node.$id())) { + return "" + " id=\"" + (node.$id()) + "\"" + } else { + return "" + }; return nil; })(); + title_element = (function() {if ($truthy(node['$title?']())) { + return "" + "
    " + (node.$captioned_title()) + "
    \n" + } else { + return "" + }; return nil; })(); + return "" + "\n" + (title_element) + "
    \n" + (node.$content()) + "\n" + "
    \n" + ""; + }, TMP_Html5Converter_example_22.$$arity = 1); + + Opal.def(self, '$floating_title', TMP_Html5Converter_floating_title_23 = function $$floating_title(node) { + var self = this, tag_name = nil, id_attribute = nil, classes = nil; + + + tag_name = "" + "h" + ($rb_plus(node.$level(), 1)); + id_attribute = (function() {if ($truthy(node.$id())) { + return "" + " id=\"" + (node.$id()) + "\"" + } else { + return "" + }; return nil; })(); + classes = [node.$style(), node.$role()].$compact(); + return "" + "<" + (tag_name) + (id_attribute) + " class=\"" + (classes.$join(" ")) + "\">" + (node.$title()) + ""; + }, TMP_Html5Converter_floating_title_23.$$arity = 1); + + Opal.def(self, '$image', TMP_Html5Converter_image_24 = function $$image(node) { + var $a, $b, $c, self = this, target = nil, width_attr = nil, height_attr = nil, svg = nil, obj = nil, img = nil, fallback = nil, id_attr = nil, classes = nil, class_attr = nil, title_el = nil; + + + target = node.$attr("target"); + width_attr = (function() {if ($truthy(node['$attr?']("width"))) { + return "" + " width=\"" + (node.$attr("width")) + "\"" + } else { + return "" + }; return nil; })(); + height_attr = (function() {if ($truthy(node['$attr?']("height"))) { + return "" + " height=\"" + (node.$attr("height")) + "\"" + } else { + return "" + }; return nil; })(); + if ($truthy(($truthy($a = ($truthy($b = ($truthy($c = node['$attr?']("format", "svg", false)) ? $c : target['$include?'](".svg"))) ? $rb_lt(node.$document().$safe(), $$$($$($nesting, 'SafeMode'), 'SECURE')) : $b)) ? ($truthy($b = (svg = node['$option?']("inline"))) ? $b : (obj = node['$option?']("interactive"))) : $a))) { + if ($truthy(svg)) { + img = ($truthy($a = self.$read_svg_contents(node, target)) ? $a : "" + "" + (node.$alt()) + "") + } else if ($truthy(obj)) { + + fallback = (function() {if ($truthy(node['$attr?']("fallback"))) { + return "" + "\""" + } else { + return "" + "" + (node.$alt()) + "" + }; return nil; })(); + img = "" + "" + (fallback) + "";}}; + img = ($truthy($a = img) ? $a : "" + "\"""); + if ($truthy(node['$attr?']("link", nil, false))) { + img = "" + "" + (img) + ""}; + id_attr = (function() {if ($truthy(node.$id())) { + return "" + " id=\"" + (node.$id()) + "\"" + } else { + return "" + }; return nil; })(); + classes = ["imageblock"]; + if ($truthy(node['$attr?']("float"))) { + classes['$<<'](node.$attr("float"))}; + if ($truthy(node['$attr?']("align"))) { + classes['$<<']("" + "text-" + (node.$attr("align")))}; + if ($truthy(node.$role())) { + classes['$<<'](node.$role())}; + class_attr = "" + " class=\"" + (classes.$join(" ")) + "\""; + title_el = (function() {if ($truthy(node['$title?']())) { + return "" + "\n
    " + (node.$captioned_title()) + "
    " + } else { + return "" + }; return nil; })(); + return "" + "\n" + "
    \n" + (img) + "\n" + "
    " + (title_el) + "\n" + ""; + }, TMP_Html5Converter_image_24.$$arity = 1); + + Opal.def(self, '$listing', TMP_Html5Converter_listing_25 = function $$listing(node) { + var $a, self = this, nowrap = nil, language = nil, code_attrs = nil, $case = nil, pre_class = nil, pre_start = nil, pre_end = nil, id_attribute = nil, title_element = nil, role = nil; + + + nowrap = ($truthy($a = node.$document()['$attr?']("prewrap")['$!']()) ? $a : node['$option?']("nowrap")); + if (node.$style()['$==']("source")) { + + if ($truthy((language = node.$attr("language", nil, false)))) { + code_attrs = "" + " data-lang=\"" + (language) + "\"" + } else { + code_attrs = "" + }; + $case = node.$document().$attr("source-highlighter"); + if ("coderay"['$===']($case)) {pre_class = "" + " class=\"CodeRay highlight" + ((function() {if ($truthy(nowrap)) { + return " nowrap" + } else { + return "" + }; return nil; })()) + "\""} + else if ("pygments"['$===']($case)) {if ($truthy(node.$document()['$attr?']("pygments-css", "inline"))) { + + if ($truthy((($a = self['pygments_bg'], $a != null && $a !== nil) ? 'instance-variable' : nil))) { + } else { + self.pygments_bg = self.stylesheets.$pygments_background(node.$document().$attr("pygments-style")) + }; + pre_class = "" + " class=\"pygments highlight" + ((function() {if ($truthy(nowrap)) { + return " nowrap" + } else { + return "" + }; return nil; })()) + "\" style=\"background: " + (self.pygments_bg) + "\""; + } else { + pre_class = "" + " class=\"pygments highlight" + ((function() {if ($truthy(nowrap)) { + return " nowrap" + } else { + return "" + }; return nil; })()) + "\"" + }} + else if ("highlightjs"['$===']($case) || "highlight.js"['$===']($case)) { + pre_class = "" + " class=\"highlightjs highlight" + ((function() {if ($truthy(nowrap)) { + return " nowrap" + } else { + return "" + }; return nil; })()) + "\""; + if ($truthy(language)) { + code_attrs = "" + " class=\"language-" + (language) + " hljs\"" + (code_attrs)};} + else if ("prettify"['$===']($case)) { + pre_class = "" + " class=\"prettyprint highlight" + ((function() {if ($truthy(nowrap)) { + return " nowrap" + } else { + return "" + }; return nil; })()) + ((function() {if ($truthy(node['$attr?']("linenums", nil, false))) { + return " linenums" + } else { + return "" + }; return nil; })()) + "\""; + if ($truthy(language)) { + code_attrs = "" + " class=\"language-" + (language) + "\"" + (code_attrs)};} + else if ("html-pipeline"['$===']($case)) { + pre_class = (function() {if ($truthy(language)) { + return "" + " lang=\"" + (language) + "\"" + } else { + return "" + }; return nil; })(); + code_attrs = "";} + else { + pre_class = "" + " class=\"highlight" + ((function() {if ($truthy(nowrap)) { + return " nowrap" + } else { + return "" + }; return nil; })()) + "\""; + if ($truthy(language)) { + code_attrs = "" + " class=\"language-" + (language) + "\"" + (code_attrs)};}; + pre_start = "" + ""; + pre_end = "
    "; + } else { + + pre_start = "" + ""; + pre_end = ""; + }; + id_attribute = (function() {if ($truthy(node.$id())) { + return "" + " id=\"" + (node.$id()) + "\"" + } else { + return "" + }; return nil; })(); + title_element = (function() {if ($truthy(node['$title?']())) { + return "" + "
    " + (node.$captioned_title()) + "
    \n" + } else { + return "" + }; return nil; })(); + return "" + "\n" + (title_element) + "
    \n" + (pre_start) + (node.$content()) + (pre_end) + "\n" + "
    \n" + ""; + }, TMP_Html5Converter_listing_25.$$arity = 1); + + Opal.def(self, '$literal', TMP_Html5Converter_literal_26 = function $$literal(node) { + var $a, self = this, id_attribute = nil, title_element = nil, nowrap = nil, role = nil; + + + id_attribute = (function() {if ($truthy(node.$id())) { + return "" + " id=\"" + (node.$id()) + "\"" + } else { + return "" + }; return nil; })(); + title_element = (function() {if ($truthy(node['$title?']())) { + return "" + "
    " + (node.$title()) + "
    \n" + } else { + return "" + }; return nil; })(); + nowrap = ($truthy($a = node.$document()['$attr?']("prewrap")['$!']()) ? $a : node['$option?']("nowrap")); + return "" + "\n" + (title_element) + "
    \n" + "" + (node.$content()) + "\n" + "
    \n" + ""; + }, TMP_Html5Converter_literal_26.$$arity = 1); + + Opal.def(self, '$stem', TMP_Html5Converter_stem_27 = function $$stem(node) { + var $a, $b, TMP_28, self = this, id_attribute = nil, title_element = nil, style = nil, open = nil, close = nil, equation = nil, br = nil, role = nil; + + + id_attribute = (function() {if ($truthy(node.$id())) { + return "" + " id=\"" + (node.$id()) + "\"" + } else { + return "" + }; return nil; })(); + title_element = (function() {if ($truthy(node['$title?']())) { + return "" + "
    " + (node.$title()) + "
    \n" + } else { + return "" + }; return nil; })(); + $b = $$($nesting, 'BLOCK_MATH_DELIMITERS')['$[]']((style = node.$style().$to_sym())), $a = Opal.to_ary($b), (open = ($a[0] == null ? nil : $a[0])), (close = ($a[1] == null ? nil : $a[1])), $b; + equation = node.$content(); + if ($truthy((($a = style['$==']("asciimath")) ? equation['$include?']($$($nesting, 'LF')) : style['$==']("asciimath")))) { + + br = "" + "" + ($$($nesting, 'LF')); + equation = $send(equation, 'gsub', [$$($nesting, 'StemBreakRx')], (TMP_28 = function(){var self = TMP_28.$$s || this, $c; + + return "" + (close) + ($rb_times(br, (($c = $gvars['~']) === nil ? nil : $c['$[]'](0)).$count($$($nesting, 'LF')))) + (open)}, TMP_28.$$s = self, TMP_28.$$arity = 0, TMP_28));}; + if ($truthy(($truthy($a = equation['$start_with?'](open)) ? equation['$end_with?'](close) : $a))) { + } else { + equation = "" + (open) + (equation) + (close) + }; + return "" + "\n" + (title_element) + "
    \n" + (equation) + "\n" + "
    \n" + ""; + }, TMP_Html5Converter_stem_27.$$arity = 1); + + Opal.def(self, '$olist', TMP_Html5Converter_olist_29 = function $$olist(node) { + var TMP_30, self = this, result = nil, id_attribute = nil, classes = nil, class_attribute = nil, type_attribute = nil, keyword = nil, start_attribute = nil, reversed_attribute = nil; + + + result = []; + id_attribute = (function() {if ($truthy(node.$id())) { + return "" + " id=\"" + (node.$id()) + "\"" + } else { + return "" + }; return nil; })(); + classes = ["olist", node.$style(), node.$role()].$compact(); + class_attribute = "" + " class=\"" + (classes.$join(" ")) + "\""; + result['$<<']("" + ""); + if ($truthy(node['$title?']())) { + result['$<<']("" + "
    " + (node.$title()) + "
    ")}; + type_attribute = (function() {if ($truthy((keyword = node.$list_marker_keyword()))) { + return "" + " type=\"" + (keyword) + "\"" + } else { + return "" + }; return nil; })(); + start_attribute = (function() {if ($truthy(node['$attr?']("start"))) { + return "" + " start=\"" + (node.$attr("start")) + "\"" + } else { + return "" + }; return nil; })(); + reversed_attribute = (function() {if ($truthy(node['$option?']("reversed"))) { + + return self.$append_boolean_attribute("reversed", self.xml_mode); + } else { + return "" + }; return nil; })(); + result['$<<']("" + "
      "); + $send(node.$items(), 'each', [], (TMP_30 = function(item){var self = TMP_30.$$s || this; + + + + if (item == null) { + item = nil; + }; + result['$<<']("
    1. "); + result['$<<']("" + "

      " + (item.$text()) + "

      "); + if ($truthy(item['$blocks?']())) { + result['$<<'](item.$content())}; + return result['$<<']("
    2. ");}, TMP_30.$$s = self, TMP_30.$$arity = 1, TMP_30)); + result['$<<']("
    "); + result['$<<'](""); + return result.$join($$($nesting, 'LF')); + }, TMP_Html5Converter_olist_29.$$arity = 1); + + Opal.def(self, '$open', TMP_Html5Converter_open_31 = function $$open(node) { + var $a, $b, $c, self = this, style = nil, id_attr = nil, title_el = nil, role = nil; + + if ((style = node.$style())['$==']("abstract")) { + if ($truthy((($a = node.$parent()['$=='](node.$document())) ? node.$document().$doctype()['$==']("book") : node.$parent()['$=='](node.$document())))) { + + self.$logger().$warn("abstract block cannot be used in a document without a title when doctype is book. Excluding block content."); + return ""; + } else { + + id_attr = (function() {if ($truthy(node.$id())) { + return "" + " id=\"" + (node.$id()) + "\"" + } else { + return "" + }; return nil; })(); + title_el = (function() {if ($truthy(node['$title?']())) { + return "" + "
    " + (node.$title()) + "
    \n" + } else { + return "" + }; return nil; })(); + return "" + "\n" + (title_el) + "
    \n" + (node.$content()) + "\n" + "
    \n" + ""; + } + } else if ($truthy((($a = style['$==']("partintro")) ? ($truthy($b = ($truthy($c = $rb_gt(node.$level(), 0)) ? $c : node.$parent().$context()['$!=']("section"))) ? $b : node.$document().$doctype()['$!=']("book")) : style['$==']("partintro")))) { + + self.$logger().$error("partintro block can only be used when doctype is book and must be a child of a book part. Excluding block content."); + return ""; + } else { + + id_attr = (function() {if ($truthy(node.$id())) { + return "" + " id=\"" + (node.$id()) + "\"" + } else { + return "" + }; return nil; })(); + title_el = (function() {if ($truthy(node['$title?']())) { + return "" + "
    " + (node.$title()) + "
    \n" + } else { + return "" + }; return nil; })(); + return "" + "" + }, TMP_Html5Converter_page_break_32.$$arity = 1); + + Opal.def(self, '$paragraph', TMP_Html5Converter_paragraph_33 = function $$paragraph(node) { + var self = this, class_attribute = nil, attributes = nil; + + + class_attribute = (function() {if ($truthy(node.$role())) { + return "" + "class=\"paragraph " + (node.$role()) + "\"" + } else { + return "class=\"paragraph\"" + }; return nil; })(); + attributes = (function() {if ($truthy(node.$id())) { + return "" + "id=\"" + (node.$id()) + "\" " + (class_attribute) + } else { + return class_attribute + }; return nil; })(); + if ($truthy(node['$title?']())) { + return "" + "
    \n" + "
    " + (node.$title()) + "
    \n" + "

    " + (node.$content()) + "

    \n" + "
    " + } else { + return "" + "
    \n" + "

    " + (node.$content()) + "

    \n" + "
    " + }; + }, TMP_Html5Converter_paragraph_33.$$arity = 1); + + Opal.def(self, '$preamble', TMP_Html5Converter_preamble_34 = function $$preamble(node) { + var $a, $b, self = this, doc = nil, toc = nil; + + + if ($truthy(($truthy($a = ($truthy($b = (doc = node.$document())['$attr?']("toc-placement", "preamble")) ? doc['$sections?']() : $b)) ? doc['$attr?']("toc") : $a))) { + toc = "" + "\n" + "
    \n" + "
    " + (doc.$attr("toc-title")) + "
    \n" + (self.$outline(doc)) + "\n" + "
    " + } else { + toc = "" + }; + return "" + "
    \n" + "
    \n" + (node.$content()) + "\n" + "
    " + (toc) + "\n" + "
    "; + }, TMP_Html5Converter_preamble_34.$$arity = 1); + + Opal.def(self, '$quote', TMP_Html5Converter_quote_35 = function $$quote(node) { + var $a, self = this, id_attribute = nil, classes = nil, class_attribute = nil, title_element = nil, attribution = nil, citetitle = nil, cite_element = nil, attribution_text = nil, attribution_element = nil; + + + id_attribute = (function() {if ($truthy(node.$id())) { + return "" + " id=\"" + (node.$id()) + "\"" + } else { + return "" + }; return nil; })(); + classes = ["quoteblock", node.$role()].$compact(); + class_attribute = "" + " class=\"" + (classes.$join(" ")) + "\""; + title_element = (function() {if ($truthy(node['$title?']())) { + return "" + "\n
    " + (node.$title()) + "
    " + } else { + return "" + }; return nil; })(); + attribution = (function() {if ($truthy(node['$attr?']("attribution"))) { + + return node.$attr("attribution"); + } else { + return nil + }; return nil; })(); + citetitle = (function() {if ($truthy(node['$attr?']("citetitle"))) { + + return node.$attr("citetitle"); + } else { + return nil + }; return nil; })(); + if ($truthy(($truthy($a = attribution) ? $a : citetitle))) { + + cite_element = (function() {if ($truthy(citetitle)) { + return "" + "" + (citetitle) + "" + } else { + return "" + }; return nil; })(); + attribution_text = (function() {if ($truthy(attribution)) { + return "" + "— " + (attribution) + ((function() {if ($truthy(citetitle)) { + return "" + "\n" + } else { + return "" + }; return nil; })()) + } else { + return "" + }; return nil; })(); + attribution_element = "" + "\n
    \n" + (attribution_text) + (cite_element) + "\n
    "; + } else { + attribution_element = "" + }; + return "" + "" + (title_element) + "\n" + "
    \n" + (node.$content()) + "\n" + "
    " + (attribution_element) + "\n" + ""; + }, TMP_Html5Converter_quote_35.$$arity = 1); + + Opal.def(self, '$thematic_break', TMP_Html5Converter_thematic_break_36 = function $$thematic_break(node) { + var self = this; + + return "" + "" + }, TMP_Html5Converter_thematic_break_36.$$arity = 1); + + Opal.def(self, '$sidebar', TMP_Html5Converter_sidebar_37 = function $$sidebar(node) { + var self = this, id_attribute = nil, title_element = nil, role = nil; + + + id_attribute = (function() {if ($truthy(node.$id())) { + return "" + " id=\"" + (node.$id()) + "\"" + } else { + return "" + }; return nil; })(); + title_element = (function() {if ($truthy(node['$title?']())) { + return "" + "
    " + (node.$title()) + "
    \n" + } else { + return "" + }; return nil; })(); + return "" + "\n" + "
    \n" + (title_element) + (node.$content()) + "\n" + "
    \n" + ""; + }, TMP_Html5Converter_sidebar_37.$$arity = 1); + + Opal.def(self, '$table', TMP_Html5Converter_table_38 = function $$table(node) { + var $a, TMP_39, TMP_40, self = this, result = nil, id_attribute = nil, classes = nil, stripes = nil, styles = nil, autowidth = nil, tablewidth = nil, role = nil, class_attribute = nil, style_attribute = nil, slash = nil; + + + result = []; + id_attribute = (function() {if ($truthy(node.$id())) { + return "" + " id=\"" + (node.$id()) + "\"" + } else { + return "" + }; return nil; })(); + classes = ["tableblock", "" + "frame-" + (node.$attr("frame", "all")), "" + "grid-" + (node.$attr("grid", "all"))]; + if ($truthy((stripes = node.$attr("stripes")))) { + classes['$<<']("" + "stripes-" + (stripes))}; + styles = []; + if ($truthy(($truthy($a = (autowidth = node.$attributes()['$[]']("autowidth-option"))) ? node['$attr?']("width", nil, false)['$!']() : $a))) { + classes['$<<']("fit-content") + } else if ((tablewidth = node.$attr("tablepcwidth"))['$=='](100)) { + classes['$<<']("stretch") + } else { + styles['$<<']("" + "width: " + (tablewidth) + "%;") + }; + if ($truthy(node['$attr?']("float"))) { + classes['$<<'](node.$attr("float"))}; + if ($truthy((role = node.$role()))) { + classes['$<<'](role)}; + class_attribute = "" + " class=\"" + (classes.$join(" ")) + "\""; + style_attribute = (function() {if ($truthy(styles['$empty?']())) { + return "" + } else { + return "" + " style=\"" + (styles.$join(" ")) + "\"" + }; return nil; })(); + result['$<<']("" + ""); + if ($truthy(node['$title?']())) { + result['$<<']("" + "" + (node.$captioned_title()) + "")}; + if ($truthy($rb_gt(node.$attr("rowcount"), 0))) { + + slash = self.void_element_slash; + result['$<<'](""); + if ($truthy(autowidth)) { + result = $rb_plus(result, $$($nesting, 'Array').$new(node.$columns().$size(), "" + "")) + } else { + $send(node.$columns(), 'each', [], (TMP_39 = function(col){var self = TMP_39.$$s || this; + + + + if (col == null) { + col = nil; + }; + return result['$<<']((function() {if ($truthy(col.$attributes()['$[]']("autowidth-option"))) { + return "" + "" + } else { + return "" + "" + }; return nil; })());}, TMP_39.$$s = self, TMP_39.$$arity = 1, TMP_39)) + }; + result['$<<'](""); + $send(node.$rows().$by_section(), 'each', [], (TMP_40 = function(tsec, rows){var self = TMP_40.$$s || this, TMP_41; + + + + if (tsec == null) { + tsec = nil; + }; + + if (rows == null) { + rows = nil; + }; + if ($truthy(rows['$empty?']())) { + return nil;}; + result['$<<']("" + ""); + $send(rows, 'each', [], (TMP_41 = function(row){var self = TMP_41.$$s || this, TMP_42; + + + + if (row == null) { + row = nil; + }; + result['$<<'](""); + $send(row, 'each', [], (TMP_42 = function(cell){var self = TMP_42.$$s || this, $b, cell_content = nil, $case = nil, cell_tag_name = nil, cell_class_attribute = nil, cell_colspan_attribute = nil, cell_rowspan_attribute = nil, cell_style_attribute = nil; + + + + if (cell == null) { + cell = nil; + }; + if (tsec['$==']("head")) { + cell_content = cell.$text() + } else { + $case = cell.$style(); + if ("asciidoc"['$===']($case)) {cell_content = "" + "
    " + (cell.$content()) + "
    "} + else if ("verse"['$===']($case)) {cell_content = "" + "
    " + (cell.$text()) + "
    "} + else if ("literal"['$===']($case)) {cell_content = "" + "
    " + (cell.$text()) + "
    "} + else {cell_content = (function() {if ($truthy((cell_content = cell.$content())['$empty?']())) { + return "" + } else { + return "" + "

    " + (cell_content.$join("" + "

    \n" + "

    ")) + "

    " + }; return nil; })()} + }; + cell_tag_name = (function() {if ($truthy(($truthy($b = tsec['$==']("head")) ? $b : cell.$style()['$==']("header")))) { + return "th" + } else { + return "td" + }; return nil; })(); + cell_class_attribute = "" + " class=\"tableblock halign-" + (cell.$attr("halign")) + " valign-" + (cell.$attr("valign")) + "\""; + cell_colspan_attribute = (function() {if ($truthy(cell.$colspan())) { + return "" + " colspan=\"" + (cell.$colspan()) + "\"" + } else { + return "" + }; return nil; })(); + cell_rowspan_attribute = (function() {if ($truthy(cell.$rowspan())) { + return "" + " rowspan=\"" + (cell.$rowspan()) + "\"" + } else { + return "" + }; return nil; })(); + cell_style_attribute = (function() {if ($truthy(node.$document()['$attr?']("cellbgcolor"))) { + return "" + " style=\"background-color: " + (node.$document().$attr("cellbgcolor")) + ";\"" + } else { + return "" + }; return nil; })(); + return result['$<<']("" + "<" + (cell_tag_name) + (cell_class_attribute) + (cell_colspan_attribute) + (cell_rowspan_attribute) + (cell_style_attribute) + ">" + (cell_content) + "");}, TMP_42.$$s = self, TMP_42.$$arity = 1, TMP_42)); + return result['$<<']("");}, TMP_41.$$s = self, TMP_41.$$arity = 1, TMP_41)); + return result['$<<']("" + "
    ");}, TMP_40.$$s = self, TMP_40.$$arity = 2, TMP_40));}; + result['$<<'](""); + return result.$join($$($nesting, 'LF')); + }, TMP_Html5Converter_table_38.$$arity = 1); + + Opal.def(self, '$toc', TMP_Html5Converter_toc_43 = function $$toc(node) { + var $a, $b, self = this, doc = nil, id_attr = nil, title_id_attr = nil, title = nil, levels = nil, role = nil; + + + if ($truthy(($truthy($a = ($truthy($b = (doc = node.$document())['$attr?']("toc-placement", "macro")) ? doc['$sections?']() : $b)) ? doc['$attr?']("toc") : $a))) { + } else { + return "" + }; + if ($truthy(node.$id())) { + + id_attr = "" + " id=\"" + (node.$id()) + "\""; + title_id_attr = "" + " id=\"" + (node.$id()) + "title\""; + } else { + + id_attr = " id=\"toc\""; + title_id_attr = " id=\"toctitle\""; + }; + title = (function() {if ($truthy(node['$title?']())) { + return node.$title() + } else { + + return doc.$attr("toc-title"); + }; return nil; })(); + levels = (function() {if ($truthy(node['$attr?']("levels"))) { + return node.$attr("levels").$to_i() + } else { + return nil + }; return nil; })(); + role = (function() {if ($truthy(node['$role?']())) { + return node.$role() + } else { + + return doc.$attr("toc-class", "toc"); + }; return nil; })(); + return "" + "\n" + "" + (title) + "\n" + (self.$outline(doc, $hash2(["toclevels"], {"toclevels": levels}))) + "\n" + ""; + }, TMP_Html5Converter_toc_43.$$arity = 1); + + Opal.def(self, '$ulist', TMP_Html5Converter_ulist_44 = function $$ulist(node) { + var TMP_45, self = this, result = nil, id_attribute = nil, div_classes = nil, marker_checked = nil, marker_unchecked = nil, checklist = nil, ul_class_attribute = nil; + + + result = []; + id_attribute = (function() {if ($truthy(node.$id())) { + return "" + " id=\"" + (node.$id()) + "\"" + } else { + return "" + }; return nil; })(); + div_classes = ["ulist", node.$style(), node.$role()].$compact(); + marker_checked = (marker_unchecked = ""); + if ($truthy((checklist = node['$option?']("checklist")))) { + + div_classes.$unshift(div_classes.$shift(), "checklist"); + ul_class_attribute = " class=\"checklist\""; + if ($truthy(node['$option?']("interactive"))) { + if ($truthy(self.xml_mode)) { + + marker_checked = " "; + marker_unchecked = " "; + } else { + + marker_checked = " "; + marker_unchecked = " "; + } + } else if ($truthy(node.$document()['$attr?']("icons", "font"))) { + + marker_checked = " "; + marker_unchecked = " "; + } else { + + marker_checked = "✓ "; + marker_unchecked = "❏ "; + }; + } else { + ul_class_attribute = (function() {if ($truthy(node.$style())) { + return "" + " class=\"" + (node.$style()) + "\"" + } else { + return "" + }; return nil; })() + }; + result['$<<']("" + ""); + if ($truthy(node['$title?']())) { + result['$<<']("" + "
    " + (node.$title()) + "
    ")}; + result['$<<']("" + ""); + $send(node.$items(), 'each', [], (TMP_45 = function(item){var self = TMP_45.$$s || this, $a; + + + + if (item == null) { + item = nil; + }; + result['$<<']("
  • "); + if ($truthy(($truthy($a = checklist) ? item['$attr?']("checkbox") : $a))) { + result['$<<']("" + "

    " + ((function() {if ($truthy(item['$attr?']("checked"))) { + return marker_checked + } else { + return marker_unchecked + }; return nil; })()) + (item.$text()) + "

    ") + } else { + result['$<<']("" + "

    " + (item.$text()) + "

    ") + }; + if ($truthy(item['$blocks?']())) { + result['$<<'](item.$content())}; + return result['$<<']("
  • ");}, TMP_45.$$s = self, TMP_45.$$arity = 1, TMP_45)); + result['$<<'](""); + result['$<<'](""); + return result.$join($$($nesting, 'LF')); + }, TMP_Html5Converter_ulist_44.$$arity = 1); + + Opal.def(self, '$verse', TMP_Html5Converter_verse_46 = function $$verse(node) { + var $a, self = this, id_attribute = nil, classes = nil, class_attribute = nil, title_element = nil, attribution = nil, citetitle = nil, cite_element = nil, attribution_text = nil, attribution_element = nil; + + + id_attribute = (function() {if ($truthy(node.$id())) { + return "" + " id=\"" + (node.$id()) + "\"" + } else { + return "" + }; return nil; })(); + classes = ["verseblock", node.$role()].$compact(); + class_attribute = "" + " class=\"" + (classes.$join(" ")) + "\""; + title_element = (function() {if ($truthy(node['$title?']())) { + return "" + "\n
    " + (node.$title()) + "
    " + } else { + return "" + }; return nil; })(); + attribution = (function() {if ($truthy(node['$attr?']("attribution"))) { + + return node.$attr("attribution"); + } else { + return nil + }; return nil; })(); + citetitle = (function() {if ($truthy(node['$attr?']("citetitle"))) { + + return node.$attr("citetitle"); + } else { + return nil + }; return nil; })(); + if ($truthy(($truthy($a = attribution) ? $a : citetitle))) { + + cite_element = (function() {if ($truthy(citetitle)) { + return "" + "" + (citetitle) + "" + } else { + return "" + }; return nil; })(); + attribution_text = (function() {if ($truthy(attribution)) { + return "" + "— " + (attribution) + ((function() {if ($truthy(citetitle)) { + return "" + "\n" + } else { + return "" + }; return nil; })()) + } else { + return "" + }; return nil; })(); + attribution_element = "" + "\n
    \n" + (attribution_text) + (cite_element) + "\n
    "; + } else { + attribution_element = "" + }; + return "" + "" + (title_element) + "\n" + "
    " + (node.$content()) + "
    " + (attribution_element) + "\n" + ""; + }, TMP_Html5Converter_verse_46.$$arity = 1); + + Opal.def(self, '$video', TMP_Html5Converter_video_47 = function $$video(node) { + var $a, $b, self = this, xml = nil, id_attribute = nil, classes = nil, class_attribute = nil, title_element = nil, width_attribute = nil, height_attribute = nil, $case = nil, asset_uri_scheme = nil, start_anchor = nil, delimiter = nil, autoplay_param = nil, loop_param = nil, rel_param_val = nil, start_param = nil, end_param = nil, has_loop_param = nil, controls_param = nil, fs_param = nil, fs_attribute = nil, modest_param = nil, theme_param = nil, hl_param = nil, target = nil, list = nil, list_param = nil, playlist = nil, poster_attribute = nil, val = nil, preload_attribute = nil, start_t = nil, end_t = nil, time_anchor = nil; + + + xml = self.xml_mode; + id_attribute = (function() {if ($truthy(node.$id())) { + return "" + " id=\"" + (node.$id()) + "\"" + } else { + return "" + }; return nil; })(); + classes = ["videoblock"]; + if ($truthy(node['$attr?']("float"))) { + classes['$<<'](node.$attr("float"))}; + if ($truthy(node['$attr?']("align"))) { + classes['$<<']("" + "text-" + (node.$attr("align")))}; + if ($truthy(node.$role())) { + classes['$<<'](node.$role())}; + class_attribute = "" + " class=\"" + (classes.$join(" ")) + "\""; + title_element = (function() {if ($truthy(node['$title?']())) { + return "" + "\n
    " + (node.$title()) + "
    " + } else { + return "" + }; return nil; })(); + width_attribute = (function() {if ($truthy(node['$attr?']("width"))) { + return "" + " width=\"" + (node.$attr("width")) + "\"" + } else { + return "" + }; return nil; })(); + height_attribute = (function() {if ($truthy(node['$attr?']("height"))) { + return "" + " height=\"" + (node.$attr("height")) + "\"" + } else { + return "" + }; return nil; })(); + return (function() {$case = node.$attr("poster"); + if ("vimeo"['$===']($case)) { + if ($truthy((asset_uri_scheme = node.$document().$attr("asset-uri-scheme", "https"))['$empty?']())) { + } else { + asset_uri_scheme = "" + (asset_uri_scheme) + ":" + }; + start_anchor = (function() {if ($truthy(node['$attr?']("start", nil, false))) { + return "" + "#at=" + (node.$attr("start")) + } else { + return "" + }; return nil; })(); + delimiter = "?"; + if ($truthy(node['$option?']("autoplay"))) { + + autoplay_param = "" + (delimiter) + "autoplay=1"; + delimiter = "&"; + } else { + autoplay_param = "" + }; + loop_param = (function() {if ($truthy(node['$option?']("loop"))) { + return "" + (delimiter) + "loop=1" + } else { + return "" + }; return nil; })(); + return "" + "" + (title_element) + "\n" + "
    \n" + "\n" + "
    \n" + "";} + else if ("youtube"['$===']($case)) { + if ($truthy((asset_uri_scheme = node.$document().$attr("asset-uri-scheme", "https"))['$empty?']())) { + } else { + asset_uri_scheme = "" + (asset_uri_scheme) + ":" + }; + rel_param_val = (function() {if ($truthy(node['$option?']("related"))) { + return 1 + } else { + return 0 + }; return nil; })(); + start_param = (function() {if ($truthy(node['$attr?']("start", nil, false))) { + return "" + "&start=" + (node.$attr("start")) + } else { + return "" + }; return nil; })(); + end_param = (function() {if ($truthy(node['$attr?']("end", nil, false))) { + return "" + "&end=" + (node.$attr("end")) + } else { + return "" + }; return nil; })(); + autoplay_param = (function() {if ($truthy(node['$option?']("autoplay"))) { + return "&autoplay=1" + } else { + return "" + }; return nil; })(); + loop_param = (function() {if ($truthy((has_loop_param = node['$option?']("loop")))) { + return "&loop=1" + } else { + return "" + }; return nil; })(); + controls_param = (function() {if ($truthy(node['$option?']("nocontrols"))) { + return "&controls=0" + } else { + return "" + }; return nil; })(); + if ($truthy(node['$option?']("nofullscreen"))) { + + fs_param = "&fs=0"; + fs_attribute = ""; + } else { + + fs_param = ""; + fs_attribute = self.$append_boolean_attribute("allowfullscreen", xml); + }; + modest_param = (function() {if ($truthy(node['$option?']("modest"))) { + return "&modestbranding=1" + } else { + return "" + }; return nil; })(); + theme_param = (function() {if ($truthy(node['$attr?']("theme", nil, false))) { + return "" + "&theme=" + (node.$attr("theme")) + } else { + return "" + }; return nil; })(); + hl_param = (function() {if ($truthy(node['$attr?']("lang"))) { + return "" + "&hl=" + (node.$attr("lang")) + } else { + return "" + }; return nil; })(); + $b = node.$attr("target").$split("/", 2), $a = Opal.to_ary($b), (target = ($a[0] == null ? nil : $a[0])), (list = ($a[1] == null ? nil : $a[1])), $b; + if ($truthy((list = ($truthy($a = list) ? $a : node.$attr("list", nil, false))))) { + list_param = "" + "&list=" + (list) + } else { + + $b = target.$split(",", 2), $a = Opal.to_ary($b), (target = ($a[0] == null ? nil : $a[0])), (playlist = ($a[1] == null ? nil : $a[1])), $b; + if ($truthy((playlist = ($truthy($a = playlist) ? $a : node.$attr("playlist", nil, false))))) { + list_param = "" + "&playlist=" + (playlist) + } else { + list_param = (function() {if ($truthy(has_loop_param)) { + return "" + "&playlist=" + (target) + } else { + return "" + }; return nil; })() + }; + }; + return "" + "" + (title_element) + "\n" + "
    \n" + "\n" + "
    \n" + "";} + else { + poster_attribute = (function() {if ($truthy((val = node.$attr("poster", nil, false))['$nil_or_empty?']())) { + return "" + } else { + return "" + " poster=\"" + (node.$media_uri(val)) + "\"" + }; return nil; })(); + preload_attribute = (function() {if ($truthy((val = node.$attr("preload", nil, false))['$nil_or_empty?']())) { + return "" + } else { + return "" + " preload=\"" + (val) + "\"" + }; return nil; })(); + start_t = node.$attr("start", nil, false); + end_t = node.$attr("end", nil, false); + time_anchor = (function() {if ($truthy(($truthy($a = start_t) ? $a : end_t))) { + return "" + "#t=" + (($truthy($a = start_t) ? $a : "")) + ((function() {if ($truthy(end_t)) { + return "" + "," + (end_t) + } else { + return "" + }; return nil; })()) + } else { + return "" + }; return nil; })(); + return "" + "" + (title_element) + "\n" + "
    \n" + "\n" + "
    \n" + "";}})(); + }, TMP_Html5Converter_video_47.$$arity = 1); + + Opal.def(self, '$inline_anchor', TMP_Html5Converter_inline_anchor_48 = function $$inline_anchor(node) { + var $a, self = this, $case = nil, path = nil, attrs = nil, text = nil, refid = nil, ref = nil; + + return (function() {$case = node.$type(); + if ("xref"['$===']($case)) { + if ($truthy((path = node.$attributes()['$[]']("path")))) { + + attrs = self.$append_link_constraint_attrs(node, (function() {if ($truthy(node.$role())) { + return ["" + " class=\"" + (node.$role()) + "\""] + } else { + return [] + }; return nil; })()).$join(); + text = ($truthy($a = node.$text()) ? $a : path); + } else { + + attrs = (function() {if ($truthy(node.$role())) { + return "" + " class=\"" + (node.$role()) + "\"" + } else { + return "" + }; return nil; })(); + if ($truthy((text = node.$text()))) { + } else { + + refid = node.$attributes()['$[]']("refid"); + if ($truthy($$($nesting, 'AbstractNode')['$===']((ref = (self.refs = ($truthy($a = self.refs) ? $a : node.$document().$catalog()['$[]']("refs")))['$[]'](refid))))) { + text = ($truthy($a = ref.$xreftext(node.$attr("xrefstyle"))) ? $a : "" + "[" + (refid) + "]") + } else { + text = "" + "[" + (refid) + "]" + }; + }; + }; + return "" + "" + (text) + "";} + else if ("ref"['$===']($case)) {return "" + ""} + else if ("link"['$===']($case)) { + attrs = (function() {if ($truthy(node.$id())) { + return ["" + " id=\"" + (node.$id()) + "\""] + } else { + return [] + }; return nil; })(); + if ($truthy(node.$role())) { + attrs['$<<']("" + " class=\"" + (node.$role()) + "\"")}; + if ($truthy(node['$attr?']("title", nil, false))) { + attrs['$<<']("" + " title=\"" + (node.$attr("title")) + "\"")}; + return "" + "" + (node.$text()) + "";} + else if ("bibref"['$===']($case)) {return "" + "" + (node.$text())} + else { + self.$logger().$warn("" + "unknown anchor type: " + (node.$type().$inspect())); + return nil;}})() + }, TMP_Html5Converter_inline_anchor_48.$$arity = 1); + + Opal.def(self, '$inline_break', TMP_Html5Converter_inline_break_49 = function $$inline_break(node) { + var self = this; + + return "" + (node.$text()) + "" + }, TMP_Html5Converter_inline_break_49.$$arity = 1); + + Opal.def(self, '$inline_button', TMP_Html5Converter_inline_button_50 = function $$inline_button(node) { + var self = this; + + return "" + "" + (node.$text()) + "" + }, TMP_Html5Converter_inline_button_50.$$arity = 1); + + Opal.def(self, '$inline_callout', TMP_Html5Converter_inline_callout_51 = function $$inline_callout(node) { + var self = this, src = nil; + + if ($truthy(node.$document()['$attr?']("icons", "font"))) { + return "" + "(" + (node.$text()) + ")" + } else if ($truthy(node.$document()['$attr?']("icons"))) { + + src = node.$icon_uri("" + "callouts/" + (node.$text())); + return "" + "\"""; + } else { + return "" + (node.$attributes()['$[]']("guard")) + "(" + (node.$text()) + ")" + } + }, TMP_Html5Converter_inline_callout_51.$$arity = 1); + + Opal.def(self, '$inline_footnote', TMP_Html5Converter_inline_footnote_52 = function $$inline_footnote(node) { + var self = this, index = nil, id_attr = nil; + + if ($truthy((index = node.$attr("index", nil, false)))) { + if (node.$type()['$==']("xref")) { + return "" + "[" + (index) + "]" + } else { + + id_attr = (function() {if ($truthy(node.$id())) { + return "" + " id=\"_footnote_" + (node.$id()) + "\"" + } else { + return "" + }; return nil; })(); + return "" + "[" + (index) + "]"; + } + } else if (node.$type()['$==']("xref")) { + return "" + "[" + (node.$text()) + "]" + } else { + return nil + } + }, TMP_Html5Converter_inline_footnote_52.$$arity = 1); + + Opal.def(self, '$inline_image', TMP_Html5Converter_inline_image_53 = function $$inline_image(node) { + var $a, TMP_54, TMP_55, $b, $c, $d, self = this, type = nil, class_attr_val = nil, title_attr = nil, img = nil, target = nil, attrs = nil, svg = nil, obj = nil, fallback = nil, role = nil; + + + if ($truthy((($a = (type = node.$type())['$==']("icon")) ? node.$document()['$attr?']("icons", "font") : (type = node.$type())['$==']("icon")))) { + + class_attr_val = "" + "fa fa-" + (node.$target()); + $send($hash2(["size", "rotate", "flip"], {"size": "fa-", "rotate": "fa-rotate-", "flip": "fa-flip-"}), 'each', [], (TMP_54 = function(key, prefix){var self = TMP_54.$$s || this; + + + + if (key == null) { + key = nil; + }; + + if (prefix == null) { + prefix = nil; + }; + if ($truthy(node['$attr?'](key))) { + return (class_attr_val = "" + (class_attr_val) + " " + (prefix) + (node.$attr(key))) + } else { + return nil + };}, TMP_54.$$s = self, TMP_54.$$arity = 2, TMP_54)); + title_attr = (function() {if ($truthy(node['$attr?']("title"))) { + return "" + " title=\"" + (node.$attr("title")) + "\"" + } else { + return "" + }; return nil; })(); + img = "" + ""; + } else if ($truthy((($a = type['$==']("icon")) ? node.$document()['$attr?']("icons")['$!']() : type['$==']("icon")))) { + img = "" + "[" + (node.$alt()) + "]" + } else { + + target = node.$target(); + attrs = $send(["width", "height", "title"], 'map', [], (TMP_55 = function(name){var self = TMP_55.$$s || this; + + + + if (name == null) { + name = nil; + }; + if ($truthy(node['$attr?'](name))) { + return "" + " " + (name) + "=\"" + (node.$attr(name)) + "\"" + } else { + return "" + };}, TMP_55.$$s = self, TMP_55.$$arity = 1, TMP_55)).$join(); + if ($truthy(($truthy($a = ($truthy($b = ($truthy($c = type['$!=']("icon")) ? ($truthy($d = node['$attr?']("format", "svg", false)) ? $d : target['$include?'](".svg")) : $c)) ? $rb_lt(node.$document().$safe(), $$$($$($nesting, 'SafeMode'), 'SECURE')) : $b)) ? ($truthy($b = (svg = node['$option?']("inline"))) ? $b : (obj = node['$option?']("interactive"))) : $a))) { + if ($truthy(svg)) { + img = ($truthy($a = self.$read_svg_contents(node, target)) ? $a : "" + "" + (node.$alt()) + "") + } else if ($truthy(obj)) { + + fallback = (function() {if ($truthy(node['$attr?']("fallback"))) { + return "" + "\""" + } else { + return "" + "" + (node.$alt()) + "" + }; return nil; })(); + img = "" + "" + (fallback) + "";}}; + img = ($truthy($a = img) ? $a : "" + "\"""); + }; + if ($truthy(node['$attr?']("link", nil, false))) { + img = "" + "" + (img) + ""}; + if ($truthy((role = node.$role()))) { + if ($truthy(node['$attr?']("float"))) { + class_attr_val = "" + (type) + " " + (node.$attr("float")) + " " + (role) + } else { + class_attr_val = "" + (type) + " " + (role) + } + } else if ($truthy(node['$attr?']("float"))) { + class_attr_val = "" + (type) + " " + (node.$attr("float")) + } else { + class_attr_val = type + }; + return "" + "" + (img) + ""; + }, TMP_Html5Converter_inline_image_53.$$arity = 1); + + Opal.def(self, '$inline_indexterm', TMP_Html5Converter_inline_indexterm_56 = function $$inline_indexterm(node) { + var self = this; + + if (node.$type()['$==']("visible")) { + return node.$text() + } else { + return "" + } + }, TMP_Html5Converter_inline_indexterm_56.$$arity = 1); + + Opal.def(self, '$inline_kbd', TMP_Html5Converter_inline_kbd_57 = function $$inline_kbd(node) { + var self = this, keys = nil; + + if ((keys = node.$attr("keys")).$size()['$=='](1)) { + return "" + "" + (keys['$[]'](0)) + "" + } else { + return "" + "" + (keys.$join("+")) + "" + } + }, TMP_Html5Converter_inline_kbd_57.$$arity = 1); + + Opal.def(self, '$inline_menu', TMP_Html5Converter_inline_menu_58 = function $$inline_menu(node) { + var self = this, caret = nil, submenu_joiner = nil, menu = nil, submenus = nil, menuitem = nil; + + + caret = (function() {if ($truthy(node.$document()['$attr?']("icons", "font"))) { + return "  " + } else { + return "  " + }; return nil; })(); + submenu_joiner = "" + "
    " + (caret) + ""; + menu = node.$attr("menu"); + if ($truthy((submenus = node.$attr("submenus"))['$empty?']())) { + if ($truthy((menuitem = node.$attr("menuitem", nil, false)))) { + return "" + "" + (menu) + "" + (caret) + "" + (menuitem) + "" + } else { + return "" + "" + (menu) + "" + } + } else { + return "" + "" + (menu) + "" + (caret) + "" + (submenus.$join(submenu_joiner)) + "" + (caret) + "" + (node.$attr("menuitem")) + "" + }; + }, TMP_Html5Converter_inline_menu_58.$$arity = 1); + + Opal.def(self, '$inline_quoted', TMP_Html5Converter_inline_quoted_59 = function $$inline_quoted(node) { + var $a, $b, self = this, open = nil, close = nil, is_tag = nil, class_attr = nil, id_attr = nil; + + + $b = $$($nesting, 'QUOTE_TAGS')['$[]'](node.$type()), $a = Opal.to_ary($b), (open = ($a[0] == null ? nil : $a[0])), (close = ($a[1] == null ? nil : $a[1])), (is_tag = ($a[2] == null ? nil : $a[2])), $b; + if ($truthy(node.$role())) { + class_attr = "" + " class=\"" + (node.$role()) + "\""}; + if ($truthy(node.$id())) { + id_attr = "" + " id=\"" + (node.$id()) + "\""}; + if ($truthy(($truthy($a = class_attr) ? $a : id_attr))) { + if ($truthy(is_tag)) { + return "" + (open.$chop()) + (($truthy($a = id_attr) ? $a : "")) + (($truthy($a = class_attr) ? $a : "")) + ">" + (node.$text()) + (close) + } else { + return "" + "" + (open) + (node.$text()) + (close) + "" + } + } else { + return "" + (open) + (node.$text()) + (close) + }; + }, TMP_Html5Converter_inline_quoted_59.$$arity = 1); + + Opal.def(self, '$append_boolean_attribute', TMP_Html5Converter_append_boolean_attribute_60 = function $$append_boolean_attribute(name, xml) { + var self = this; + + if ($truthy(xml)) { + return "" + " " + (name) + "=\"" + (name) + "\"" + } else { + return "" + " " + (name) + } + }, TMP_Html5Converter_append_boolean_attribute_60.$$arity = 2); + + Opal.def(self, '$encode_quotes', TMP_Html5Converter_encode_quotes_61 = function $$encode_quotes(val) { + var self = this; + + if ($truthy(val['$include?']("\""))) { + + return val.$gsub("\"", """); + } else { + return val + } + }, TMP_Html5Converter_encode_quotes_61.$$arity = 1); + + Opal.def(self, '$generate_manname_section', TMP_Html5Converter_generate_manname_section_62 = function $$generate_manname_section(node) { + var $a, self = this, manname_title = nil, next_section = nil, next_section_title = nil, manname_id_attr = nil, manname_id = nil; + + + manname_title = node.$attr("manname-title", "Name"); + if ($truthy(($truthy($a = (next_section = node.$sections()['$[]'](0))) ? (next_section_title = next_section.$title())['$=='](next_section_title.$upcase()) : $a))) { + manname_title = manname_title.$upcase()}; + manname_id_attr = (function() {if ($truthy((manname_id = node.$attr("manname-id")))) { + return "" + " id=\"" + (manname_id) + "\"" + } else { + return "" + }; return nil; })(); + return "" + "" + (manname_title) + "\n" + "
    \n" + "

    " + (node.$attr("manname")) + " - " + (node.$attr("manpurpose")) + "

    \n" + "
    "; + }, TMP_Html5Converter_generate_manname_section_62.$$arity = 1); + + Opal.def(self, '$append_link_constraint_attrs', TMP_Html5Converter_append_link_constraint_attrs_63 = function $$append_link_constraint_attrs(node, attrs) { + var $a, self = this, rel = nil, window = nil; + + + + if (attrs == null) { + attrs = []; + }; + if ($truthy(node['$option?']("nofollow"))) { + rel = "nofollow"}; + if ($truthy((window = node.$attributes()['$[]']("window")))) { + + attrs['$<<']("" + " target=\"" + (window) + "\""); + if ($truthy(($truthy($a = window['$==']("_blank")) ? $a : node['$option?']("noopener")))) { + attrs['$<<']((function() {if ($truthy(rel)) { + return "" + " rel=\"" + (rel) + " noopener\"" + } else { + return " rel=\"noopener\"" + }; return nil; })())}; + } else if ($truthy(rel)) { + attrs['$<<']("" + " rel=\"" + (rel) + "\"")}; + return attrs; + }, TMP_Html5Converter_append_link_constraint_attrs_63.$$arity = -2); + return (Opal.def(self, '$read_svg_contents', TMP_Html5Converter_read_svg_contents_64 = function $$read_svg_contents(node, target) { + var TMP_65, self = this, svg = nil, old_start_tag = nil, new_start_tag = nil; + + + if ($truthy((svg = node.$read_contents(target, $hash2(["start", "normalize", "label"], {"start": node.$document().$attr("imagesdir"), "normalize": true, "label": "SVG"}))))) { + + if ($truthy(svg['$start_with?'](""); + } else { + return nil + };}, TMP_65.$$s = self, TMP_65.$$arity = 1, TMP_65)); + if ($truthy(new_start_tag)) { + svg = "" + (new_start_tag) + (svg['$[]'](Opal.Range.$new(old_start_tag.$length(), -1, false)))};}; + return svg; + }, TMP_Html5Converter_read_svg_contents_64.$$arity = 2), nil) && 'read_svg_contents'; + })($$($nesting, 'Converter'), $$$($$($nesting, 'Converter'), 'BuiltIn'), $nesting) + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/extensions"] = function(Opal) { + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + function $rb_plus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); + } + function $rb_gt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); + } + function $rb_lt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); + } + var $a, self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $truthy = Opal.truthy, $module = Opal.module, $klass = Opal.klass, $hash2 = Opal.hash2, $send = Opal.send, $hash = Opal.hash; + + Opal.add_stubs(['$require', '$to_s', '$[]=', '$config', '$-', '$nil_or_empty?', '$name', '$grep', '$constants', '$include', '$const_get', '$extend', '$attr_reader', '$merge', '$class', '$update', '$raise', '$document', '$==', '$doctype', '$[]', '$+', '$level', '$delete', '$>', '$casecmp', '$new', '$title=', '$sectname=', '$special=', '$fetch', '$numbered=', '$!', '$key?', '$attr?', '$special', '$numbered', '$generate_id', '$title', '$id=', '$update_attributes', '$tr', '$basename', '$create_block', '$assign_caption', '$===', '$next_block', '$dup', '$<<', '$has_more_lines?', '$each', '$define_method', '$unshift', '$shift', '$send', '$empty?', '$size', '$call', '$option', '$flatten', '$respond_to?', '$include?', '$split', '$to_i', '$compact', '$inspect', '$attr_accessor', '$to_set', '$match?', '$resolve_regexp', '$method', '$register', '$values', '$groups', '$arity', '$instance_exec', '$to_proc', '$activate', '$add_document_processor', '$any?', '$select', '$add_syntax_processor', '$to_sym', '$instance_variable_get', '$kind', '$private', '$join', '$map', '$capitalize', '$instance_variable_set', '$resolve_args', '$freeze', '$process_block_given?', '$source_location', '$resolve_class', '$<', '$update_config', '$push', '$as_symbol', '$name=', '$pop', '$-@', '$next_auto_id', '$generate_name', '$class_for_name', '$reduce', '$const_defined?']); + + if ($truthy((($a = $$($nesting, 'Asciidoctor', 'skip_raise')) ? 'constant' : nil))) { + } else { + self.$require("asciidoctor".$to_s()) + }; + return (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + (function($base, $parent_nesting) { + function $Extensions() {}; + var self = $Extensions = $module($base, 'Extensions', $Extensions); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + + (function($base, $super, $parent_nesting) { + function $Processor(){}; + var self = $Processor = $klass($base, $super, 'Processor', $Processor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Processor_initialize_4, TMP_Processor_update_config_5, TMP_Processor_process_6, TMP_Processor_create_section_7, TMP_Processor_create_block_8, TMP_Processor_create_list_9, TMP_Processor_create_list_item_10, TMP_Processor_create_image_block_11, TMP_Processor_create_inline_12, TMP_Processor_parse_content_13, TMP_Processor_14; + + def.config = nil; + + (function(self, $parent_nesting) { + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_config_1, TMP_option_2, TMP_use_dsl_3; + + + + Opal.def(self, '$config', TMP_config_1 = function $$config() { + var $a, self = this; + if (self.config == null) self.config = nil; + + return (self.config = ($truthy($a = self.config) ? $a : $hash2([], {}))) + }, TMP_config_1.$$arity = 0); + + Opal.def(self, '$option', TMP_option_2 = function $$option(key, default_value) { + var self = this, $writer = nil; + + + $writer = [key, default_value]; + $send(self.$config(), '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + }, TMP_option_2.$$arity = 2); + + Opal.def(self, '$use_dsl', TMP_use_dsl_3 = function $$use_dsl() { + var self = this; + + if ($truthy(self.$name()['$nil_or_empty?']())) { + if ($truthy((Opal.Module.$$nesting = $nesting, self.$constants()).$grep("DSL"))) { + return self.$include(self.$const_get("DSL")) + } else { + return nil + } + } else if ($truthy((Opal.Module.$$nesting = $nesting, self.$constants()).$grep("DSL"))) { + return self.$extend(self.$const_get("DSL")) + } else { + return nil + } + }, TMP_use_dsl_3.$$arity = 0); + Opal.alias(self, "extend_dsl", "use_dsl"); + return Opal.alias(self, "include_dsl", "use_dsl"); + })(Opal.get_singleton_class(self), $nesting); + self.$attr_reader("config"); + + Opal.def(self, '$initialize', TMP_Processor_initialize_4 = function $$initialize(config) { + var self = this; + + + + if (config == null) { + config = $hash2([], {}); + }; + return (self.config = self.$class().$config().$merge(config)); + }, TMP_Processor_initialize_4.$$arity = -1); + + Opal.def(self, '$update_config', TMP_Processor_update_config_5 = function $$update_config(config) { + var self = this; + + return self.config.$update(config) + }, TMP_Processor_update_config_5.$$arity = 1); + + Opal.def(self, '$process', TMP_Processor_process_6 = function $$process($a) { + var $post_args, args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + return self.$raise($$$('::', 'NotImplementedError'), "" + "Asciidoctor::Extensions::Processor subclass must implement #" + ("process") + " method"); + }, TMP_Processor_process_6.$$arity = -1); + + Opal.def(self, '$create_section', TMP_Processor_create_section_7 = function $$create_section(parent, title, attrs, opts) { + var $a, self = this, doc = nil, book = nil, doctype = nil, level = nil, style = nil, sectname = nil, special = nil, sect = nil, $writer = nil, id = nil; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + doc = parent.$document(); + book = (doctype = doc.$doctype())['$==']("book"); + level = ($truthy($a = opts['$[]']("level")) ? $a : $rb_plus(parent.$level(), 1)); + if ($truthy((style = attrs.$delete("style")))) { + if ($truthy(($truthy($a = book) ? style['$==']("abstract") : $a))) { + $a = ["chapter", 1], (sectname = $a[0]), (level = $a[1]), $a + } else { + + $a = [style, true], (sectname = $a[0]), (special = $a[1]), $a; + if (level['$=='](0)) { + level = 1}; + } + } else if ($truthy(book)) { + sectname = (function() {if (level['$=='](0)) { + return "part" + } else { + + if ($truthy($rb_gt(level, 1))) { + return "section" + } else { + return "chapter" + }; + }; return nil; })() + } else if ($truthy((($a = doctype['$==']("manpage")) ? title.$casecmp("synopsis")['$=='](0) : doctype['$==']("manpage")))) { + $a = ["synopsis", true], (sectname = $a[0]), (special = $a[1]), $a + } else { + sectname = "section" + }; + sect = $$($nesting, 'Section').$new(parent, level); + $a = [title, sectname], sect['$title=']($a[0]), sect['$sectname=']($a[1]), $a; + if ($truthy(special)) { + + + $writer = [true]; + $send(sect, 'special=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + if ($truthy(opts.$fetch("numbered", style['$==']("appendix")))) { + + $writer = [true]; + $send(sect, 'numbered=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + } else if ($truthy(($truthy($a = opts['$key?']("numbered")['$!']()) ? doc['$attr?']("sectnums", "all") : $a))) { + + $writer = [(function() {if ($truthy(($truthy($a = book) ? level['$=='](1) : $a))) { + return "chapter" + } else { + return true + }; return nil; })()]; + $send(sect, 'numbered=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + } else if ($truthy($rb_gt(level, 0))) { + if ($truthy(opts.$fetch("numbered", doc['$attr?']("sectnums")))) { + + $writer = [(function() {if ($truthy(sect.$special())) { + return ($truthy($a = parent.$numbered()) ? true : $a) + } else { + return true + }; return nil; })()]; + $send(sect, 'numbered=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];} + } else if ($truthy(opts.$fetch("numbered", ($truthy($a = book) ? doc['$attr?']("partnums") : $a)))) { + + $writer = [true]; + $send(sect, 'numbered=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if ((id = attrs.$delete("id"))['$=='](false)) { + } else { + + $writer = [(($writer = ["id", ($truthy($a = id) ? $a : (function() {if ($truthy(doc['$attr?']("sectids"))) { + + return $$($nesting, 'Section').$generate_id(sect.$title(), doc); + } else { + return nil + }; return nil; })())]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])]; + $send(sect, 'id=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + sect.$update_attributes(attrs); + return sect; + }, TMP_Processor_create_section_7.$$arity = -4); + + Opal.def(self, '$create_block', TMP_Processor_create_block_8 = function $$create_block(parent, context, source, attrs, opts) { + var self = this; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + return $$($nesting, 'Block').$new(parent, context, $hash2(["source", "attributes"], {"source": source, "attributes": attrs}).$merge(opts)); + }, TMP_Processor_create_block_8.$$arity = -5); + + Opal.def(self, '$create_list', TMP_Processor_create_list_9 = function $$create_list(parent, context, attrs) { + var self = this, list = nil; + + + + if (attrs == null) { + attrs = nil; + }; + list = $$($nesting, 'List').$new(parent, context); + if ($truthy(attrs)) { + list.$update_attributes(attrs)}; + return list; + }, TMP_Processor_create_list_9.$$arity = -3); + + Opal.def(self, '$create_list_item', TMP_Processor_create_list_item_10 = function $$create_list_item(parent, text) { + var self = this; + + + + if (text == null) { + text = nil; + }; + return $$($nesting, 'ListItem').$new(parent, text); + }, TMP_Processor_create_list_item_10.$$arity = -2); + + Opal.def(self, '$create_image_block', TMP_Processor_create_image_block_11 = function $$create_image_block(parent, attrs, opts) { + var $a, self = this, target = nil, $writer = nil, title = nil, block = nil; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + if ($truthy((target = attrs['$[]']("target")))) { + } else { + self.$raise($$$('::', 'ArgumentError'), "Unable to create an image block, target attribute is required") + }; + ($truthy($a = attrs['$[]']("alt")) ? $a : (($writer = ["alt", (($writer = ["default-alt", $$($nesting, 'Helpers').$basename(target, true).$tr("_-", " ")]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + title = (function() {if ($truthy(attrs['$key?']("title"))) { + + return attrs.$delete("title"); + } else { + return nil + }; return nil; })(); + block = self.$create_block(parent, "image", nil, attrs, opts); + if ($truthy(title)) { + + + $writer = [title]; + $send(block, 'title=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + block.$assign_caption(attrs.$delete("caption"), ($truthy($a = opts['$[]']("caption_context")) ? $a : "figure"));}; + return block; + }, TMP_Processor_create_image_block_11.$$arity = -3); + + Opal.def(self, '$create_inline', TMP_Processor_create_inline_12 = function $$create_inline(parent, context, text, opts) { + var self = this; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + return $$($nesting, 'Inline').$new(parent, context, text, opts); + }, TMP_Processor_create_inline_12.$$arity = -4); + + Opal.def(self, '$parse_content', TMP_Processor_parse_content_13 = function $$parse_content(parent, content, attributes) { + var $a, $b, $c, self = this, reader = nil, block = nil; + + + + if (attributes == null) { + attributes = nil; + }; + reader = (function() {if ($truthy($$($nesting, 'Reader')['$==='](content))) { + return content + } else { + + return $$($nesting, 'Reader').$new(content); + }; return nil; })(); + while ($truthy(($truthy($b = ($truthy($c = (block = $$($nesting, 'Parser').$next_block(reader, parent, (function() {if ($truthy(attributes)) { + return attributes.$dup() + } else { + return $hash2([], {}) + }; return nil; })()))) ? parent['$<<'](block) : $c)) ? $b : reader['$has_more_lines?']()))) { + + }; + return parent; + }, TMP_Processor_parse_content_13.$$arity = -3); + return $send([["create_paragraph", "create_block", "paragraph"], ["create_open_block", "create_block", "open"], ["create_example_block", "create_block", "example"], ["create_pass_block", "create_block", "pass"], ["create_listing_block", "create_block", "listing"], ["create_literal_block", "create_block", "literal"], ["create_anchor", "create_inline", "anchor"]], 'each', [], (TMP_Processor_14 = function(method_name, delegate_method_name, context){var self = TMP_Processor_14.$$s || this, TMP_15; + + + + if (method_name == null) { + method_name = nil; + }; + + if (delegate_method_name == null) { + delegate_method_name = nil; + }; + + if (context == null) { + context = nil; + }; + return $send(self, 'define_method', [method_name], (TMP_15 = function($a){var self = TMP_15.$$s || this, $post_args, args; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + args.$unshift(args.$shift(), context); + return $send(self, 'send', [delegate_method_name].concat(Opal.to_a(args)));}, TMP_15.$$s = self, TMP_15.$$arity = -1, TMP_15));}, TMP_Processor_14.$$s = self, TMP_Processor_14.$$arity = 3, TMP_Processor_14)); + })($nesting[0], null, $nesting); + (function($base, $parent_nesting) { + function $ProcessorDsl() {}; + var self = $ProcessorDsl = $module($base, 'ProcessorDsl', $ProcessorDsl); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_ProcessorDsl_option_16, TMP_ProcessorDsl_process_17, TMP_ProcessorDsl_process_block_given$q_18; + + + + Opal.def(self, '$option', TMP_ProcessorDsl_option_16 = function $$option(key, value) { + var self = this, $writer = nil; + + + $writer = [key, value]; + $send(self.$config(), '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + }, TMP_ProcessorDsl_option_16.$$arity = 2); + + Opal.def(self, '$process', TMP_ProcessorDsl_process_17 = function $$process($a) { + var $iter = TMP_ProcessorDsl_process_17.$$p, block = $iter || nil, $post_args, args, $b, self = this; + if (self.process_block == null) self.process_block = nil; + + if ($iter) TMP_ProcessorDsl_process_17.$$p = null; + + + if ($iter) TMP_ProcessorDsl_process_17.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + if ((block !== nil)) { + + if ($truthy(args['$empty?']())) { + } else { + self.$raise($$$('::', 'ArgumentError'), "" + "wrong number of arguments (given " + (args.$size()) + ", expected 0)") + }; + return (self.process_block = block); + } else if ($truthy((($b = self['process_block'], $b != null && $b !== nil) ? 'instance-variable' : nil))) { + return $send(self.process_block, 'call', Opal.to_a(args)) + } else { + return self.$raise($$$('::', 'NotImplementedError')) + }; + }, TMP_ProcessorDsl_process_17.$$arity = -1); + + Opal.def(self, '$process_block_given?', TMP_ProcessorDsl_process_block_given$q_18 = function() { + var $a, self = this; + + return (($a = self['process_block'], $a != null && $a !== nil) ? 'instance-variable' : nil) + }, TMP_ProcessorDsl_process_block_given$q_18.$$arity = 0); + })($nesting[0], $nesting); + (function($base, $parent_nesting) { + function $DocumentProcessorDsl() {}; + var self = $DocumentProcessorDsl = $module($base, 'DocumentProcessorDsl', $DocumentProcessorDsl); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_DocumentProcessorDsl_prefer_19; + + + self.$include($$($nesting, 'ProcessorDsl')); + + Opal.def(self, '$prefer', TMP_DocumentProcessorDsl_prefer_19 = function $$prefer() { + var self = this; + + return self.$option("position", ">>") + }, TMP_DocumentProcessorDsl_prefer_19.$$arity = 0); + })($nesting[0], $nesting); + (function($base, $parent_nesting) { + function $SyntaxProcessorDsl() {}; + var self = $SyntaxProcessorDsl = $module($base, 'SyntaxProcessorDsl', $SyntaxProcessorDsl); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_SyntaxProcessorDsl_named_20, TMP_SyntaxProcessorDsl_content_model_21, TMP_SyntaxProcessorDsl_positional_attrs_22, TMP_SyntaxProcessorDsl_default_attrs_23, TMP_SyntaxProcessorDsl_resolves_attributes_24; + + + self.$include($$($nesting, 'ProcessorDsl')); + + Opal.def(self, '$named', TMP_SyntaxProcessorDsl_named_20 = function $$named(value) { + var self = this; + + if ($truthy($$($nesting, 'Processor')['$==='](self))) { + return (self.name = value) + } else { + return self.$option("name", value) + } + }, TMP_SyntaxProcessorDsl_named_20.$$arity = 1); + Opal.alias(self, "match_name", "named"); + + Opal.def(self, '$content_model', TMP_SyntaxProcessorDsl_content_model_21 = function $$content_model(value) { + var self = this; + + return self.$option("content_model", value) + }, TMP_SyntaxProcessorDsl_content_model_21.$$arity = 1); + Opal.alias(self, "parse_content_as", "content_model"); + Opal.alias(self, "parses_content_as", "content_model"); + + Opal.def(self, '$positional_attrs', TMP_SyntaxProcessorDsl_positional_attrs_22 = function $$positional_attrs($a) { + var $post_args, value, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + value = $post_args;; + return self.$option("pos_attrs", value.$flatten()); + }, TMP_SyntaxProcessorDsl_positional_attrs_22.$$arity = -1); + Opal.alias(self, "name_attributes", "positional_attrs"); + Opal.alias(self, "name_positional_attributes", "positional_attrs"); + + Opal.def(self, '$default_attrs', TMP_SyntaxProcessorDsl_default_attrs_23 = function $$default_attrs(value) { + var self = this; + + return self.$option("default_attrs", value) + }, TMP_SyntaxProcessorDsl_default_attrs_23.$$arity = 1); + + Opal.def(self, '$resolves_attributes', TMP_SyntaxProcessorDsl_resolves_attributes_24 = function $$resolves_attributes($a) { + var $post_args, args, $b, TMP_25, TMP_26, self = this, $case = nil, names = nil, defaults = nil; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + if ($truthy($rb_gt(args.$size(), 1))) { + } else if ($truthy((args = args.$fetch(0, true))['$respond_to?']("to_sym"))) { + args = [args]}; + return (function() {$case = args; + if (true['$===']($case)) { + self.$option("pos_attrs", []); + return self.$option("default_attrs", $hash2([], {}));} + else if ($$$('::', 'Array')['$===']($case)) { + $b = [[], $hash2([], {})], (names = $b[0]), (defaults = $b[1]), $b; + $send(args, 'each', [], (TMP_25 = function(arg){var self = TMP_25.$$s || this, $c, $d, name = nil, value = nil, idx = nil, $writer = nil; + + + + if (arg == null) { + arg = nil; + }; + if ($truthy((arg = arg.$to_s())['$include?']("="))) { + + $d = arg.$split("=", 2), $c = Opal.to_ary($d), (name = ($c[0] == null ? nil : $c[0])), (value = ($c[1] == null ? nil : $c[1])), $d; + if ($truthy(name['$include?'](":"))) { + + $d = name.$split(":", 2), $c = Opal.to_ary($d), (idx = ($c[0] == null ? nil : $c[0])), (name = ($c[1] == null ? nil : $c[1])), $d; + idx = (function() {if (idx['$==']("@")) { + return names.$size() + } else { + return idx.$to_i() + }; return nil; })(); + + $writer = [idx, name]; + $send(names, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];;}; + + $writer = [name, value]; + $send(defaults, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];; + } else if ($truthy(arg['$include?'](":"))) { + + $d = arg.$split(":", 2), $c = Opal.to_ary($d), (idx = ($c[0] == null ? nil : $c[0])), (name = ($c[1] == null ? nil : $c[1])), $d; + idx = (function() {if (idx['$==']("@")) { + return names.$size() + } else { + return idx.$to_i() + }; return nil; })(); + + $writer = [idx, name]; + $send(names, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];; + } else { + return names['$<<'](arg) + };}, TMP_25.$$s = self, TMP_25.$$arity = 1, TMP_25)); + self.$option("pos_attrs", names.$compact()); + return self.$option("default_attrs", defaults);} + else if ($$$('::', 'Hash')['$===']($case)) { + $b = [[], $hash2([], {})], (names = $b[0]), (defaults = $b[1]), $b; + $send(args, 'each', [], (TMP_26 = function(key, val){var self = TMP_26.$$s || this, $c, $d, name = nil, idx = nil, $writer = nil; + + + + if (key == null) { + key = nil; + }; + + if (val == null) { + val = nil; + }; + if ($truthy((name = key.$to_s())['$include?'](":"))) { + + $d = name.$split(":", 2), $c = Opal.to_ary($d), (idx = ($c[0] == null ? nil : $c[0])), (name = ($c[1] == null ? nil : $c[1])), $d; + idx = (function() {if (idx['$==']("@")) { + return names.$size() + } else { + return idx.$to_i() + }; return nil; })(); + + $writer = [idx, name]; + $send(names, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];;}; + if ($truthy(val)) { + + $writer = [name, val]; + $send(defaults, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + } else { + return nil + };}, TMP_26.$$s = self, TMP_26.$$arity = 2, TMP_26)); + self.$option("pos_attrs", names.$compact()); + return self.$option("default_attrs", defaults);} + else {return self.$raise($$$('::', 'ArgumentError'), "" + "unsupported attributes specification for macro: " + (args.$inspect()))}})(); + }, TMP_SyntaxProcessorDsl_resolves_attributes_24.$$arity = -1); + Opal.alias(self, "resolve_attributes", "resolves_attributes"); + })($nesting[0], $nesting); + (function($base, $super, $parent_nesting) { + function $Preprocessor(){}; + var self = $Preprocessor = $klass($base, $super, 'Preprocessor', $Preprocessor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Preprocessor_process_27; + + return (Opal.def(self, '$process', TMP_Preprocessor_process_27 = function $$process(document, reader) { + var self = this; + + return self.$raise($$$('::', 'NotImplementedError'), "" + "Asciidoctor::Extensions::Preprocessor subclass must implement #" + ("process") + " method") + }, TMP_Preprocessor_process_27.$$arity = 2), nil) && 'process' + })($nesting[0], $$($nesting, 'Processor'), $nesting); + Opal.const_set($$($nesting, 'Preprocessor'), 'DSL', $$($nesting, 'DocumentProcessorDsl')); + (function($base, $super, $parent_nesting) { + function $TreeProcessor(){}; + var self = $TreeProcessor = $klass($base, $super, 'TreeProcessor', $TreeProcessor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_TreeProcessor_process_28; + + return (Opal.def(self, '$process', TMP_TreeProcessor_process_28 = function $$process(document) { + var self = this; + + return self.$raise($$$('::', 'NotImplementedError'), "" + "Asciidoctor::Extensions::TreeProcessor subclass must implement #" + ("process") + " method") + }, TMP_TreeProcessor_process_28.$$arity = 1), nil) && 'process' + })($nesting[0], $$($nesting, 'Processor'), $nesting); + Opal.const_set($$($nesting, 'TreeProcessor'), 'DSL', $$($nesting, 'DocumentProcessorDsl')); + Opal.const_set($nesting[0], 'Treeprocessor', $$($nesting, 'TreeProcessor')); + (function($base, $super, $parent_nesting) { + function $Postprocessor(){}; + var self = $Postprocessor = $klass($base, $super, 'Postprocessor', $Postprocessor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Postprocessor_process_29; + + return (Opal.def(self, '$process', TMP_Postprocessor_process_29 = function $$process(document, output) { + var self = this; + + return self.$raise($$$('::', 'NotImplementedError'), "" + "Asciidoctor::Extensions::Postprocessor subclass must implement #" + ("process") + " method") + }, TMP_Postprocessor_process_29.$$arity = 2), nil) && 'process' + })($nesting[0], $$($nesting, 'Processor'), $nesting); + Opal.const_set($$($nesting, 'Postprocessor'), 'DSL', $$($nesting, 'DocumentProcessorDsl')); + (function($base, $super, $parent_nesting) { + function $IncludeProcessor(){}; + var self = $IncludeProcessor = $klass($base, $super, 'IncludeProcessor', $IncludeProcessor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_IncludeProcessor_process_30, TMP_IncludeProcessor_handles$q_31; + + + + Opal.def(self, '$process', TMP_IncludeProcessor_process_30 = function $$process(document, reader, target, attributes) { + var self = this; + + return self.$raise($$$('::', 'NotImplementedError'), "" + "Asciidoctor::Extensions::IncludeProcessor subclass must implement #" + ("process") + " method") + }, TMP_IncludeProcessor_process_30.$$arity = 4); + return (Opal.def(self, '$handles?', TMP_IncludeProcessor_handles$q_31 = function(target) { + var self = this; + + return true + }, TMP_IncludeProcessor_handles$q_31.$$arity = 1), nil) && 'handles?'; + })($nesting[0], $$($nesting, 'Processor'), $nesting); + (function($base, $parent_nesting) { + function $IncludeProcessorDsl() {}; + var self = $IncludeProcessorDsl = $module($base, 'IncludeProcessorDsl', $IncludeProcessorDsl); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_IncludeProcessorDsl_handles$q_32; + + + self.$include($$($nesting, 'DocumentProcessorDsl')); + + Opal.def(self, '$handles?', TMP_IncludeProcessorDsl_handles$q_32 = function($a) { + var $iter = TMP_IncludeProcessorDsl_handles$q_32.$$p, block = $iter || nil, $post_args, args, $b, self = this; + if (self.handles_block == null) self.handles_block = nil; + + if ($iter) TMP_IncludeProcessorDsl_handles$q_32.$$p = null; + + + if ($iter) TMP_IncludeProcessorDsl_handles$q_32.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + if ((block !== nil)) { + + if ($truthy(args['$empty?']())) { + } else { + self.$raise($$$('::', 'ArgumentError'), "" + "wrong number of arguments (given " + (args.$size()) + ", expected 0)") + }; + return (self.handles_block = block); + } else if ($truthy((($b = self['handles_block'], $b != null && $b !== nil) ? 'instance-variable' : nil))) { + return self.handles_block.$call(args['$[]'](0)) + } else { + return true + }; + }, TMP_IncludeProcessorDsl_handles$q_32.$$arity = -1); + })($nesting[0], $nesting); + Opal.const_set($$($nesting, 'IncludeProcessor'), 'DSL', $$($nesting, 'IncludeProcessorDsl')); + (function($base, $super, $parent_nesting) { + function $DocinfoProcessor(){}; + var self = $DocinfoProcessor = $klass($base, $super, 'DocinfoProcessor', $DocinfoProcessor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_DocinfoProcessor_initialize_33, TMP_DocinfoProcessor_process_34; + + def.config = nil; + + self.$attr_accessor("location"); + + Opal.def(self, '$initialize', TMP_DocinfoProcessor_initialize_33 = function $$initialize(config) { + var $a, $iter = TMP_DocinfoProcessor_initialize_33.$$p, $yield = $iter || nil, self = this, $writer = nil; + + if ($iter) TMP_DocinfoProcessor_initialize_33.$$p = null; + + + if (config == null) { + config = $hash2([], {}); + }; + $send(self, Opal.find_super_dispatcher(self, 'initialize', TMP_DocinfoProcessor_initialize_33, false), [config], null); + return ($truthy($a = self.config['$[]']("location")) ? $a : (($writer = ["location", "head"]), $send(self.config, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + }, TMP_DocinfoProcessor_initialize_33.$$arity = -1); + return (Opal.def(self, '$process', TMP_DocinfoProcessor_process_34 = function $$process(document) { + var self = this; + + return self.$raise($$$('::', 'NotImplementedError'), "" + "Asciidoctor::Extensions::DocinfoProcessor subclass must implement #" + ("process") + " method") + }, TMP_DocinfoProcessor_process_34.$$arity = 1), nil) && 'process'; + })($nesting[0], $$($nesting, 'Processor'), $nesting); + (function($base, $parent_nesting) { + function $DocinfoProcessorDsl() {}; + var self = $DocinfoProcessorDsl = $module($base, 'DocinfoProcessorDsl', $DocinfoProcessorDsl); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_DocinfoProcessorDsl_at_location_35; + + + self.$include($$($nesting, 'DocumentProcessorDsl')); + + Opal.def(self, '$at_location', TMP_DocinfoProcessorDsl_at_location_35 = function $$at_location(value) { + var self = this; + + return self.$option("location", value) + }, TMP_DocinfoProcessorDsl_at_location_35.$$arity = 1); + })($nesting[0], $nesting); + Opal.const_set($$($nesting, 'DocinfoProcessor'), 'DSL', $$($nesting, 'DocinfoProcessorDsl')); + (function($base, $super, $parent_nesting) { + function $BlockProcessor(){}; + var self = $BlockProcessor = $klass($base, $super, 'BlockProcessor', $BlockProcessor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_BlockProcessor_initialize_36, TMP_BlockProcessor_process_37; + + def.config = nil; + + self.$attr_accessor("name"); + + Opal.def(self, '$initialize', TMP_BlockProcessor_initialize_36 = function $$initialize(name, config) { + var $a, $iter = TMP_BlockProcessor_initialize_36.$$p, $yield = $iter || nil, self = this, $case = nil, $writer = nil; + + if ($iter) TMP_BlockProcessor_initialize_36.$$p = null; + + + if (name == null) { + name = nil; + }; + + if (config == null) { + config = $hash2([], {}); + }; + $send(self, Opal.find_super_dispatcher(self, 'initialize', TMP_BlockProcessor_initialize_36, false), [config], null); + self.name = ($truthy($a = name) ? $a : self.config['$[]']("name")); + $case = self.config['$[]']("contexts"); + if ($$$('::', 'NilClass')['$===']($case)) {($truthy($a = self.config['$[]']("contexts")) ? $a : (($writer = ["contexts", ["open", "paragraph"].$to_set()]), $send(self.config, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]))} + else if ($$$('::', 'Symbol')['$===']($case)) { + $writer = ["contexts", [self.config['$[]']("contexts")].$to_set()]; + $send(self.config, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];} + else { + $writer = ["contexts", self.config['$[]']("contexts").$to_set()]; + $send(self.config, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + return ($truthy($a = self.config['$[]']("content_model")) ? $a : (($writer = ["content_model", "compound"]), $send(self.config, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + }, TMP_BlockProcessor_initialize_36.$$arity = -1); + return (Opal.def(self, '$process', TMP_BlockProcessor_process_37 = function $$process(parent, reader, attributes) { + var self = this; + + return self.$raise($$$('::', 'NotImplementedError'), "" + "Asciidoctor::Extensions::BlockProcessor subclass must implement #" + ("process") + " method") + }, TMP_BlockProcessor_process_37.$$arity = 3), nil) && 'process'; + })($nesting[0], $$($nesting, 'Processor'), $nesting); + (function($base, $parent_nesting) { + function $BlockProcessorDsl() {}; + var self = $BlockProcessorDsl = $module($base, 'BlockProcessorDsl', $BlockProcessorDsl); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_BlockProcessorDsl_contexts_38; + + + self.$include($$($nesting, 'SyntaxProcessorDsl')); + + Opal.def(self, '$contexts', TMP_BlockProcessorDsl_contexts_38 = function $$contexts($a) { + var $post_args, value, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + value = $post_args;; + return self.$option("contexts", value.$flatten().$to_set()); + }, TMP_BlockProcessorDsl_contexts_38.$$arity = -1); + Opal.alias(self, "on_contexts", "contexts"); + Opal.alias(self, "on_context", "contexts"); + Opal.alias(self, "bound_to", "contexts"); + })($nesting[0], $nesting); + Opal.const_set($$($nesting, 'BlockProcessor'), 'DSL', $$($nesting, 'BlockProcessorDsl')); + (function($base, $super, $parent_nesting) { + function $MacroProcessor(){}; + var self = $MacroProcessor = $klass($base, $super, 'MacroProcessor', $MacroProcessor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_MacroProcessor_initialize_39, TMP_MacroProcessor_process_40; + + def.config = nil; + + self.$attr_accessor("name"); + + Opal.def(self, '$initialize', TMP_MacroProcessor_initialize_39 = function $$initialize(name, config) { + var $a, $iter = TMP_MacroProcessor_initialize_39.$$p, $yield = $iter || nil, self = this, $writer = nil; + + if ($iter) TMP_MacroProcessor_initialize_39.$$p = null; + + + if (name == null) { + name = nil; + }; + + if (config == null) { + config = $hash2([], {}); + }; + $send(self, Opal.find_super_dispatcher(self, 'initialize', TMP_MacroProcessor_initialize_39, false), [config], null); + self.name = ($truthy($a = name) ? $a : self.config['$[]']("name")); + return ($truthy($a = self.config['$[]']("content_model")) ? $a : (($writer = ["content_model", "attributes"]), $send(self.config, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + }, TMP_MacroProcessor_initialize_39.$$arity = -1); + return (Opal.def(self, '$process', TMP_MacroProcessor_process_40 = function $$process(parent, target, attributes) { + var self = this; + + return self.$raise($$$('::', 'NotImplementedError'), "" + "Asciidoctor::Extensions::MacroProcessor subclass must implement #" + ("process") + " method") + }, TMP_MacroProcessor_process_40.$$arity = 3), nil) && 'process'; + })($nesting[0], $$($nesting, 'Processor'), $nesting); + (function($base, $parent_nesting) { + function $MacroProcessorDsl() {}; + var self = $MacroProcessorDsl = $module($base, 'MacroProcessorDsl', $MacroProcessorDsl); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_MacroProcessorDsl_resolves_attributes_41; + + + self.$include($$($nesting, 'SyntaxProcessorDsl')); + + Opal.def(self, '$resolves_attributes', TMP_MacroProcessorDsl_resolves_attributes_41 = function $$resolves_attributes($a) { + var $post_args, args, $b, $iter = TMP_MacroProcessorDsl_resolves_attributes_41.$$p, $yield = $iter || nil, self = this, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_MacroProcessorDsl_resolves_attributes_41.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + if ($truthy((($b = args.$size()['$=='](1)) ? args['$[]'](0)['$!']() : args.$size()['$=='](1)))) { + + self.$option("content_model", "text"); + return nil;}; + $send(self, Opal.find_super_dispatcher(self, 'resolves_attributes', TMP_MacroProcessorDsl_resolves_attributes_41, false), $zuper, $iter); + return self.$option("content_model", "attributes"); + }, TMP_MacroProcessorDsl_resolves_attributes_41.$$arity = -1); + Opal.alias(self, "resolve_attributes", "resolves_attributes"); + })($nesting[0], $nesting); + (function($base, $super, $parent_nesting) { + function $BlockMacroProcessor(){}; + var self = $BlockMacroProcessor = $klass($base, $super, 'BlockMacroProcessor', $BlockMacroProcessor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_BlockMacroProcessor_name_42; + + def.name = nil; + return (Opal.def(self, '$name', TMP_BlockMacroProcessor_name_42 = function $$name() { + var self = this; + + + if ($truthy($$($nesting, 'MacroNameRx')['$match?'](self.name.$to_s()))) { + } else { + self.$raise($$$('::', 'ArgumentError'), "" + "invalid name for block macro: " + (self.name)) + }; + return self.name; + }, TMP_BlockMacroProcessor_name_42.$$arity = 0), nil) && 'name' + })($nesting[0], $$($nesting, 'MacroProcessor'), $nesting); + Opal.const_set($$($nesting, 'BlockMacroProcessor'), 'DSL', $$($nesting, 'MacroProcessorDsl')); + (function($base, $super, $parent_nesting) { + function $InlineMacroProcessor(){}; + var self = $InlineMacroProcessor = $klass($base, $super, 'InlineMacroProcessor', $InlineMacroProcessor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_InlineMacroProcessor_regexp_43, TMP_InlineMacroProcessor_resolve_regexp_44; + + def.config = def.name = nil; + + (Opal.class_variable_set($InlineMacroProcessor, '@@rx_cache', $hash2([], {}))); + + Opal.def(self, '$regexp', TMP_InlineMacroProcessor_regexp_43 = function $$regexp() { + var $a, self = this, $writer = nil; + + return ($truthy($a = self.config['$[]']("regexp")) ? $a : (($writer = ["regexp", self.$resolve_regexp(self.name.$to_s(), self.config['$[]']("format"))]), $send(self.config, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])) + }, TMP_InlineMacroProcessor_regexp_43.$$arity = 0); + return (Opal.def(self, '$resolve_regexp', TMP_InlineMacroProcessor_resolve_regexp_44 = function $$resolve_regexp(name, format) { + var $a, $b, self = this, $writer = nil; + + + if ($truthy($$($nesting, 'MacroNameRx')['$match?'](name))) { + } else { + self.$raise($$$('::', 'ArgumentError'), "" + "invalid name for inline macro: " + (name)) + }; + return ($truthy($a = (($b = $InlineMacroProcessor.$$cvars['@@rx_cache']) == null ? nil : $b)['$[]']([name, format])) ? $a : (($writer = [[name, format], new RegExp("" + "\\\\?" + (name) + ":" + ((function() {if (format['$==']("short")) { + return "(){0}" + } else { + return "(\\S+?)" + }; return nil; })()) + "\\[(|.*?[^\\\\])\\]")]), $send((($b = $InlineMacroProcessor.$$cvars['@@rx_cache']) == null ? nil : $b), '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + }, TMP_InlineMacroProcessor_resolve_regexp_44.$$arity = 2), nil) && 'resolve_regexp'; + })($nesting[0], $$($nesting, 'MacroProcessor'), $nesting); + (function($base, $parent_nesting) { + function $InlineMacroProcessorDsl() {}; + var self = $InlineMacroProcessorDsl = $module($base, 'InlineMacroProcessorDsl', $InlineMacroProcessorDsl); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_InlineMacroProcessorDsl_with_format_45, TMP_InlineMacroProcessorDsl_matches_46; + + + self.$include($$($nesting, 'MacroProcessorDsl')); + + Opal.def(self, '$with_format', TMP_InlineMacroProcessorDsl_with_format_45 = function $$with_format(value) { + var self = this; + + return self.$option("format", value) + }, TMP_InlineMacroProcessorDsl_with_format_45.$$arity = 1); + Opal.alias(self, "using_format", "with_format"); + + Opal.def(self, '$matches', TMP_InlineMacroProcessorDsl_matches_46 = function $$matches(value) { + var self = this; + + return self.$option("regexp", value) + }, TMP_InlineMacroProcessorDsl_matches_46.$$arity = 1); + Opal.alias(self, "match", "matches"); + Opal.alias(self, "matching", "matches"); + })($nesting[0], $nesting); + Opal.const_set($$($nesting, 'InlineMacroProcessor'), 'DSL', $$($nesting, 'InlineMacroProcessorDsl')); + (function($base, $super, $parent_nesting) { + function $Extension(){}; + var self = $Extension = $klass($base, $super, 'Extension', $Extension); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Extension_initialize_47; + + + self.$attr_reader("kind"); + self.$attr_reader("config"); + self.$attr_reader("instance"); + return (Opal.def(self, '$initialize', TMP_Extension_initialize_47 = function $$initialize(kind, instance, config) { + var self = this; + + + self.kind = kind; + self.instance = instance; + return (self.config = config); + }, TMP_Extension_initialize_47.$$arity = 3), nil) && 'initialize'; + })($nesting[0], null, $nesting); + (function($base, $super, $parent_nesting) { + function $ProcessorExtension(){}; + var self = $ProcessorExtension = $klass($base, $super, 'ProcessorExtension', $ProcessorExtension); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_ProcessorExtension_initialize_48; + + + self.$attr_reader("process_method"); + return (Opal.def(self, '$initialize', TMP_ProcessorExtension_initialize_48 = function $$initialize(kind, instance, process_method) { + var $a, $iter = TMP_ProcessorExtension_initialize_48.$$p, $yield = $iter || nil, self = this; + + if ($iter) TMP_ProcessorExtension_initialize_48.$$p = null; + + + if (process_method == null) { + process_method = nil; + }; + $send(self, Opal.find_super_dispatcher(self, 'initialize', TMP_ProcessorExtension_initialize_48, false), [kind, instance, instance.$config()], null); + return (self.process_method = ($truthy($a = process_method) ? $a : instance.$method("process"))); + }, TMP_ProcessorExtension_initialize_48.$$arity = -3), nil) && 'initialize'; + })($nesting[0], $$($nesting, 'Extension'), $nesting); + (function($base, $super, $parent_nesting) { + function $Group(){}; + var self = $Group = $klass($base, $super, 'Group', $Group); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Group_activate_50; + + + (function(self, $parent_nesting) { + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_register_49; + + return (Opal.def(self, '$register', TMP_register_49 = function $$register(name) { + var self = this; + + + + if (name == null) { + name = nil; + }; + return $$($nesting, 'Extensions').$register(name, self); + }, TMP_register_49.$$arity = -1), nil) && 'register' + })(Opal.get_singleton_class(self), $nesting); + return (Opal.def(self, '$activate', TMP_Group_activate_50 = function $$activate(registry) { + var self = this; + + return self.$raise($$$('::', 'NotImplementedError')) + }, TMP_Group_activate_50.$$arity = 1), nil) && 'activate'; + })($nesting[0], null, $nesting); + (function($base, $super, $parent_nesting) { + function $Registry(){}; + var self = $Registry = $klass($base, $super, 'Registry', $Registry); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Registry_initialize_51, TMP_Registry_activate_52, TMP_Registry_preprocessor_54, TMP_Registry_preprocessors$q_55, TMP_Registry_preprocessors_56, TMP_Registry_tree_processor_57, TMP_Registry_tree_processors$q_58, TMP_Registry_tree_processors_59, TMP_Registry_postprocessor_60, TMP_Registry_postprocessors$q_61, TMP_Registry_postprocessors_62, TMP_Registry_include_processor_63, TMP_Registry_include_processors$q_64, TMP_Registry_include_processors_65, TMP_Registry_docinfo_processor_66, TMP_Registry_docinfo_processors$q_67, TMP_Registry_docinfo_processors_69, TMP_Registry_block_71, TMP_Registry_blocks$q_72, TMP_Registry_registered_for_block$q_73, TMP_Registry_find_block_extension_74, TMP_Registry_block_macro_75, TMP_Registry_block_macros$q_76, TMP_Registry_registered_for_block_macro$q_77, TMP_Registry_find_block_macro_extension_78, TMP_Registry_inline_macro_79, TMP_Registry_inline_macros$q_80, TMP_Registry_registered_for_inline_macro$q_81, TMP_Registry_find_inline_macro_extension_82, TMP_Registry_inline_macros_83, TMP_Registry_prefer_84, TMP_Registry_add_document_processor_85, TMP_Registry_add_syntax_processor_87, TMP_Registry_resolve_args_89, TMP_Registry_as_symbol_90; + + def.groups = def.preprocessor_extensions = def.tree_processor_extensions = def.postprocessor_extensions = def.include_processor_extensions = def.docinfo_processor_extensions = def.block_extensions = def.block_macro_extensions = def.inline_macro_extensions = nil; + + self.$attr_reader("document"); + self.$attr_reader("groups"); + + Opal.def(self, '$initialize', TMP_Registry_initialize_51 = function $$initialize(groups) { + var self = this; + + + + if (groups == null) { + groups = $hash2([], {}); + }; + self.groups = groups; + self.preprocessor_extensions = (self.tree_processor_extensions = (self.postprocessor_extensions = (self.include_processor_extensions = (self.docinfo_processor_extensions = (self.block_extensions = (self.block_macro_extensions = (self.inline_macro_extensions = nil))))))); + return (self.document = nil); + }, TMP_Registry_initialize_51.$$arity = -1); + + Opal.def(self, '$activate', TMP_Registry_activate_52 = function $$activate(document) { + var TMP_53, self = this, ext_groups = nil; + + + self.document = document; + if ($truthy((ext_groups = $rb_plus($$($nesting, 'Extensions').$groups().$values(), self.groups.$values()))['$empty?']())) { + } else { + $send(ext_groups, 'each', [], (TMP_53 = function(group){var self = TMP_53.$$s || this, $case = nil; + + + + if (group == null) { + group = nil; + }; + return (function() {$case = group; + if ($$$('::', 'Proc')['$===']($case)) {return (function() {$case = group.$arity(); + if ((0)['$===']($case) || (-1)['$===']($case)) {return $send(self, 'instance_exec', [], group.$to_proc())} + else if ((1)['$===']($case)) {return group.$call(self)} + else { return nil }})()} + else if ($$$('::', 'Class')['$===']($case)) {return group.$new().$activate(self)} + else {return group.$activate(self)}})();}, TMP_53.$$s = self, TMP_53.$$arity = 1, TMP_53)) + }; + return self; + }, TMP_Registry_activate_52.$$arity = 1); + + Opal.def(self, '$preprocessor', TMP_Registry_preprocessor_54 = function $$preprocessor($a) { + var $iter = TMP_Registry_preprocessor_54.$$p, block = $iter || nil, $post_args, args, self = this; + + if ($iter) TMP_Registry_preprocessor_54.$$p = null; + + + if ($iter) TMP_Registry_preprocessor_54.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + return $send(self, 'add_document_processor', ["preprocessor", args], block.$to_proc()); + }, TMP_Registry_preprocessor_54.$$arity = -1); + + Opal.def(self, '$preprocessors?', TMP_Registry_preprocessors$q_55 = function() { + var self = this; + + return self.preprocessor_extensions['$!']()['$!']() + }, TMP_Registry_preprocessors$q_55.$$arity = 0); + + Opal.def(self, '$preprocessors', TMP_Registry_preprocessors_56 = function $$preprocessors() { + var self = this; + + return self.preprocessor_extensions + }, TMP_Registry_preprocessors_56.$$arity = 0); + + Opal.def(self, '$tree_processor', TMP_Registry_tree_processor_57 = function $$tree_processor($a) { + var $iter = TMP_Registry_tree_processor_57.$$p, block = $iter || nil, $post_args, args, self = this; + + if ($iter) TMP_Registry_tree_processor_57.$$p = null; + + + if ($iter) TMP_Registry_tree_processor_57.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + return $send(self, 'add_document_processor', ["tree_processor", args], block.$to_proc()); + }, TMP_Registry_tree_processor_57.$$arity = -1); + + Opal.def(self, '$tree_processors?', TMP_Registry_tree_processors$q_58 = function() { + var self = this; + + return self.tree_processor_extensions['$!']()['$!']() + }, TMP_Registry_tree_processors$q_58.$$arity = 0); + + Opal.def(self, '$tree_processors', TMP_Registry_tree_processors_59 = function $$tree_processors() { + var self = this; + + return self.tree_processor_extensions + }, TMP_Registry_tree_processors_59.$$arity = 0); + Opal.alias(self, "treeprocessor", "tree_processor"); + Opal.alias(self, "treeprocessors?", "tree_processors?"); + Opal.alias(self, "treeprocessors", "tree_processors"); + + Opal.def(self, '$postprocessor', TMP_Registry_postprocessor_60 = function $$postprocessor($a) { + var $iter = TMP_Registry_postprocessor_60.$$p, block = $iter || nil, $post_args, args, self = this; + + if ($iter) TMP_Registry_postprocessor_60.$$p = null; + + + if ($iter) TMP_Registry_postprocessor_60.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + return $send(self, 'add_document_processor', ["postprocessor", args], block.$to_proc()); + }, TMP_Registry_postprocessor_60.$$arity = -1); + + Opal.def(self, '$postprocessors?', TMP_Registry_postprocessors$q_61 = function() { + var self = this; + + return self.postprocessor_extensions['$!']()['$!']() + }, TMP_Registry_postprocessors$q_61.$$arity = 0); + + Opal.def(self, '$postprocessors', TMP_Registry_postprocessors_62 = function $$postprocessors() { + var self = this; + + return self.postprocessor_extensions + }, TMP_Registry_postprocessors_62.$$arity = 0); + + Opal.def(self, '$include_processor', TMP_Registry_include_processor_63 = function $$include_processor($a) { + var $iter = TMP_Registry_include_processor_63.$$p, block = $iter || nil, $post_args, args, self = this; + + if ($iter) TMP_Registry_include_processor_63.$$p = null; + + + if ($iter) TMP_Registry_include_processor_63.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + return $send(self, 'add_document_processor', ["include_processor", args], block.$to_proc()); + }, TMP_Registry_include_processor_63.$$arity = -1); + + Opal.def(self, '$include_processors?', TMP_Registry_include_processors$q_64 = function() { + var self = this; + + return self.include_processor_extensions['$!']()['$!']() + }, TMP_Registry_include_processors$q_64.$$arity = 0); + + Opal.def(self, '$include_processors', TMP_Registry_include_processors_65 = function $$include_processors() { + var self = this; + + return self.include_processor_extensions + }, TMP_Registry_include_processors_65.$$arity = 0); + + Opal.def(self, '$docinfo_processor', TMP_Registry_docinfo_processor_66 = function $$docinfo_processor($a) { + var $iter = TMP_Registry_docinfo_processor_66.$$p, block = $iter || nil, $post_args, args, self = this; + + if ($iter) TMP_Registry_docinfo_processor_66.$$p = null; + + + if ($iter) TMP_Registry_docinfo_processor_66.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + return $send(self, 'add_document_processor', ["docinfo_processor", args], block.$to_proc()); + }, TMP_Registry_docinfo_processor_66.$$arity = -1); + + Opal.def(self, '$docinfo_processors?', TMP_Registry_docinfo_processors$q_67 = function(location) { + var TMP_68, self = this; + + + + if (location == null) { + location = nil; + }; + if ($truthy(self.docinfo_processor_extensions)) { + if ($truthy(location)) { + return $send(self.docinfo_processor_extensions, 'any?', [], (TMP_68 = function(ext){var self = TMP_68.$$s || this; + + + + if (ext == null) { + ext = nil; + }; + return ext.$config()['$[]']("location")['$=='](location);}, TMP_68.$$s = self, TMP_68.$$arity = 1, TMP_68)) + } else { + return true + } + } else { + return false + }; + }, TMP_Registry_docinfo_processors$q_67.$$arity = -1); + + Opal.def(self, '$docinfo_processors', TMP_Registry_docinfo_processors_69 = function $$docinfo_processors(location) { + var TMP_70, self = this; + + + + if (location == null) { + location = nil; + }; + if ($truthy(self.docinfo_processor_extensions)) { + if ($truthy(location)) { + return $send(self.docinfo_processor_extensions, 'select', [], (TMP_70 = function(ext){var self = TMP_70.$$s || this; + + + + if (ext == null) { + ext = nil; + }; + return ext.$config()['$[]']("location")['$=='](location);}, TMP_70.$$s = self, TMP_70.$$arity = 1, TMP_70)) + } else { + return self.docinfo_processor_extensions + } + } else { + return nil + }; + }, TMP_Registry_docinfo_processors_69.$$arity = -1); + + Opal.def(self, '$block', TMP_Registry_block_71 = function $$block($a) { + var $iter = TMP_Registry_block_71.$$p, block = $iter || nil, $post_args, args, self = this; + + if ($iter) TMP_Registry_block_71.$$p = null; + + + if ($iter) TMP_Registry_block_71.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + return $send(self, 'add_syntax_processor', ["block", args], block.$to_proc()); + }, TMP_Registry_block_71.$$arity = -1); + + Opal.def(self, '$blocks?', TMP_Registry_blocks$q_72 = function() { + var self = this; + + return self.block_extensions['$!']()['$!']() + }, TMP_Registry_blocks$q_72.$$arity = 0); + + Opal.def(self, '$registered_for_block?', TMP_Registry_registered_for_block$q_73 = function(name, context) { + var self = this, ext = nil; + + if ($truthy((ext = self.block_extensions['$[]'](name.$to_sym())))) { + if ($truthy(ext.$config()['$[]']("contexts")['$include?'](context))) { + return ext + } else { + return false + } + } else { + return false + } + }, TMP_Registry_registered_for_block$q_73.$$arity = 2); + + Opal.def(self, '$find_block_extension', TMP_Registry_find_block_extension_74 = function $$find_block_extension(name) { + var self = this; + + return self.block_extensions['$[]'](name.$to_sym()) + }, TMP_Registry_find_block_extension_74.$$arity = 1); + + Opal.def(self, '$block_macro', TMP_Registry_block_macro_75 = function $$block_macro($a) { + var $iter = TMP_Registry_block_macro_75.$$p, block = $iter || nil, $post_args, args, self = this; + + if ($iter) TMP_Registry_block_macro_75.$$p = null; + + + if ($iter) TMP_Registry_block_macro_75.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + return $send(self, 'add_syntax_processor', ["block_macro", args], block.$to_proc()); + }, TMP_Registry_block_macro_75.$$arity = -1); + + Opal.def(self, '$block_macros?', TMP_Registry_block_macros$q_76 = function() { + var self = this; + + return self.block_macro_extensions['$!']()['$!']() + }, TMP_Registry_block_macros$q_76.$$arity = 0); + + Opal.def(self, '$registered_for_block_macro?', TMP_Registry_registered_for_block_macro$q_77 = function(name) { + var self = this, ext = nil; + + if ($truthy((ext = self.block_macro_extensions['$[]'](name.$to_sym())))) { + return ext + } else { + return false + } + }, TMP_Registry_registered_for_block_macro$q_77.$$arity = 1); + + Opal.def(self, '$find_block_macro_extension', TMP_Registry_find_block_macro_extension_78 = function $$find_block_macro_extension(name) { + var self = this; + + return self.block_macro_extensions['$[]'](name.$to_sym()) + }, TMP_Registry_find_block_macro_extension_78.$$arity = 1); + + Opal.def(self, '$inline_macro', TMP_Registry_inline_macro_79 = function $$inline_macro($a) { + var $iter = TMP_Registry_inline_macro_79.$$p, block = $iter || nil, $post_args, args, self = this; + + if ($iter) TMP_Registry_inline_macro_79.$$p = null; + + + if ($iter) TMP_Registry_inline_macro_79.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + return $send(self, 'add_syntax_processor', ["inline_macro", args], block.$to_proc()); + }, TMP_Registry_inline_macro_79.$$arity = -1); + + Opal.def(self, '$inline_macros?', TMP_Registry_inline_macros$q_80 = function() { + var self = this; + + return self.inline_macro_extensions['$!']()['$!']() + }, TMP_Registry_inline_macros$q_80.$$arity = 0); + + Opal.def(self, '$registered_for_inline_macro?', TMP_Registry_registered_for_inline_macro$q_81 = function(name) { + var self = this, ext = nil; + + if ($truthy((ext = self.inline_macro_extensions['$[]'](name.$to_sym())))) { + return ext + } else { + return false + } + }, TMP_Registry_registered_for_inline_macro$q_81.$$arity = 1); + + Opal.def(self, '$find_inline_macro_extension', TMP_Registry_find_inline_macro_extension_82 = function $$find_inline_macro_extension(name) { + var self = this; + + return self.inline_macro_extensions['$[]'](name.$to_sym()) + }, TMP_Registry_find_inline_macro_extension_82.$$arity = 1); + + Opal.def(self, '$inline_macros', TMP_Registry_inline_macros_83 = function $$inline_macros() { + var self = this; + + return self.inline_macro_extensions.$values() + }, TMP_Registry_inline_macros_83.$$arity = 0); + + Opal.def(self, '$prefer', TMP_Registry_prefer_84 = function $$prefer($a) { + var $iter = TMP_Registry_prefer_84.$$p, block = $iter || nil, $post_args, args, self = this, extension = nil, arg0 = nil, extensions_store = nil; + + if ($iter) TMP_Registry_prefer_84.$$p = null; + + + if ($iter) TMP_Registry_prefer_84.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + extension = (function() {if ($truthy($$($nesting, 'ProcessorExtension')['$===']((arg0 = args.$shift())))) { + return arg0 + } else { + + return $send(self, 'send', [arg0].concat(Opal.to_a(args)), block.$to_proc()); + }; return nil; })(); + extensions_store = self.$instance_variable_get(((("" + "@") + (extension.$kind())) + "_extensions").$to_sym()); + extensions_store.$unshift(extensions_store.$delete(extension)); + return extension; + }, TMP_Registry_prefer_84.$$arity = -1); + self.$private(); + + Opal.def(self, '$add_document_processor', TMP_Registry_add_document_processor_85 = function $$add_document_processor(kind, args) { + var $iter = TMP_Registry_add_document_processor_85.$$p, block = $iter || nil, TMP_86, $a, $b, $c, self = this, kind_name = nil, kind_class_symbol = nil, kind_class = nil, kind_java_class = nil, kind_store = nil, extension = nil, config = nil, processor = nil, processor_class = nil, processor_instance = nil; + + if ($iter) TMP_Registry_add_document_processor_85.$$p = null; + + + if ($iter) TMP_Registry_add_document_processor_85.$$p = null;; + kind_name = kind.$to_s().$tr("_", " "); + kind_class_symbol = $send(kind_name.$split(), 'map', [], (TMP_86 = function(it){var self = TMP_86.$$s || this; + + + + if (it == null) { + it = nil; + }; + return it.$capitalize();}, TMP_86.$$s = self, TMP_86.$$arity = 1, TMP_86)).$join().$to_sym(); + kind_class = $$($nesting, 'Extensions').$const_get(kind_class_symbol); + kind_java_class = (function() {if ($truthy((($a = $$$('::', 'AsciidoctorJ', 'skip_raise')) ? 'constant' : nil))) { + + return $$$($$$('::', 'AsciidoctorJ'), 'Extensions').$const_get(kind_class_symbol); + } else { + return nil + }; return nil; })(); + kind_store = ($truthy($b = self.$instance_variable_get(((("" + "@") + (kind)) + "_extensions").$to_sym())) ? $b : self.$instance_variable_set(((("" + "@") + (kind)) + "_extensions").$to_sym(), [])); + extension = (function() {if ((block !== nil)) { + + config = self.$resolve_args(args, 1); + processor = kind_class.$new(config); + if ($truthy(kind_class.$constants().$grep("DSL"))) { + processor.$extend(kind_class.$const_get("DSL"))}; + $send(processor, 'instance_exec', [], block.$to_proc()); + processor.$freeze(); + if ($truthy(processor['$process_block_given?']())) { + } else { + self.$raise($$$('::', 'ArgumentError'), "" + "No block specified to process " + (kind_name) + " extension at " + (block.$source_location())) + }; + return $$($nesting, 'ProcessorExtension').$new(kind, processor); + } else { + + $c = self.$resolve_args(args, 2), $b = Opal.to_ary($c), (processor = ($b[0] == null ? nil : $b[0])), (config = ($b[1] == null ? nil : $b[1])), $c; + if ($truthy((processor_class = $$($nesting, 'Extensions').$resolve_class(processor)))) { + + if ($truthy(($truthy($b = $rb_lt(processor_class, kind_class)) ? $b : ($truthy($c = kind_java_class) ? $rb_lt(processor_class, kind_java_class) : $c)))) { + } else { + self.$raise($$$('::', 'ArgumentError'), "" + "Invalid type for " + (kind_name) + " extension: " + (processor)) + }; + processor_instance = processor_class.$new(config); + processor_instance.$freeze(); + return $$($nesting, 'ProcessorExtension').$new(kind, processor_instance); + } else if ($truthy(($truthy($b = kind_class['$==='](processor)) ? $b : ($truthy($c = kind_java_class) ? kind_java_class['$==='](processor) : $c)))) { + + processor.$update_config(config); + processor.$freeze(); + return $$($nesting, 'ProcessorExtension').$new(kind, processor); + } else { + return self.$raise($$$('::', 'ArgumentError'), "" + "Invalid arguments specified for registering " + (kind_name) + " extension: " + (args)) + }; + }; return nil; })(); + if (extension.$config()['$[]']("position")['$=='](">>")) { + + kind_store.$unshift(extension); + } else { + + kind_store['$<<'](extension); + }; + return extension; + }, TMP_Registry_add_document_processor_85.$$arity = 2); + + Opal.def(self, '$add_syntax_processor', TMP_Registry_add_syntax_processor_87 = function $$add_syntax_processor(kind, args) { + var $iter = TMP_Registry_add_syntax_processor_87.$$p, block = $iter || nil, TMP_88, $a, $b, $c, self = this, kind_name = nil, kind_class_symbol = nil, kind_class = nil, kind_java_class = nil, kind_store = nil, name = nil, config = nil, processor = nil, $writer = nil, processor_class = nil, processor_instance = nil; + + if ($iter) TMP_Registry_add_syntax_processor_87.$$p = null; + + + if ($iter) TMP_Registry_add_syntax_processor_87.$$p = null;; + kind_name = kind.$to_s().$tr("_", " "); + kind_class_symbol = $send(kind_name.$split(), 'map', [], (TMP_88 = function(it){var self = TMP_88.$$s || this; + + + + if (it == null) { + it = nil; + }; + return it.$capitalize();}, TMP_88.$$s = self, TMP_88.$$arity = 1, TMP_88)).$push("Processor").$join().$to_sym(); + kind_class = $$($nesting, 'Extensions').$const_get(kind_class_symbol); + kind_java_class = (function() {if ($truthy((($a = $$$('::', 'AsciidoctorJ', 'skip_raise')) ? 'constant' : nil))) { + + return $$$($$$('::', 'AsciidoctorJ'), 'Extensions').$const_get(kind_class_symbol); + } else { + return nil + }; return nil; })(); + kind_store = ($truthy($b = self.$instance_variable_get(((("" + "@") + (kind)) + "_extensions").$to_sym())) ? $b : self.$instance_variable_set(((("" + "@") + (kind)) + "_extensions").$to_sym(), $hash2([], {}))); + if ((block !== nil)) { + + $c = self.$resolve_args(args, 2), $b = Opal.to_ary($c), (name = ($b[0] == null ? nil : $b[0])), (config = ($b[1] == null ? nil : $b[1])), $c; + processor = kind_class.$new(self.$as_symbol(name), config); + if ($truthy(kind_class.$constants().$grep("DSL"))) { + processor.$extend(kind_class.$const_get("DSL"))}; + if (block.$arity()['$=='](1)) { + Opal.yield1(block, processor) + } else { + $send(processor, 'instance_exec', [], block.$to_proc()) + }; + if ($truthy((name = self.$as_symbol(processor.$name())))) { + } else { + self.$raise($$$('::', 'ArgumentError'), "" + "No name specified for " + (kind_name) + " extension at " + (block.$source_location())) + }; + if ($truthy(processor['$process_block_given?']())) { + } else { + self.$raise($$$('::', 'NoMethodError'), "" + "No block specified to process " + (kind_name) + " extension at " + (block.$source_location())) + }; + processor.$freeze(); + + $writer = [name, $$($nesting, 'ProcessorExtension').$new(kind, processor)]; + $send(kind_store, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];; + } else { + + $c = self.$resolve_args(args, 3), $b = Opal.to_ary($c), (processor = ($b[0] == null ? nil : $b[0])), (name = ($b[1] == null ? nil : $b[1])), (config = ($b[2] == null ? nil : $b[2])), $c; + if ($truthy((processor_class = $$($nesting, 'Extensions').$resolve_class(processor)))) { + + if ($truthy(($truthy($b = $rb_lt(processor_class, kind_class)) ? $b : ($truthy($c = kind_java_class) ? $rb_lt(processor_class, kind_java_class) : $c)))) { + } else { + self.$raise($$$('::', 'ArgumentError'), "" + "Class specified for " + (kind_name) + " extension does not inherit from " + (kind_class) + ": " + (processor)) + }; + processor_instance = processor_class.$new(self.$as_symbol(name), config); + if ($truthy((name = self.$as_symbol(processor_instance.$name())))) { + } else { + self.$raise($$$('::', 'ArgumentError'), "" + "No name specified for " + (kind_name) + " extension: " + (processor)) + }; + processor_instance.$freeze(); + + $writer = [name, $$($nesting, 'ProcessorExtension').$new(kind, processor_instance)]; + $send(kind_store, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];; + } else if ($truthy(($truthy($b = kind_class['$==='](processor)) ? $b : ($truthy($c = kind_java_class) ? kind_java_class['$==='](processor) : $c)))) { + + processor.$update_config(config); + if ($truthy((name = (function() {if ($truthy(name)) { + + + $writer = [self.$as_symbol(name)]; + $send(processor, 'name=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];; + } else { + + return self.$as_symbol(processor.$name()); + }; return nil; })()))) { + } else { + self.$raise($$$('::', 'ArgumentError'), "" + "No name specified for " + (kind_name) + " extension: " + (processor)) + }; + processor.$freeze(); + + $writer = [name, $$($nesting, 'ProcessorExtension').$new(kind, processor)]; + $send(kind_store, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];; + } else { + return self.$raise($$$('::', 'ArgumentError'), "" + "Invalid arguments specified for registering " + (kind_name) + " extension: " + (args)) + }; + }; + }, TMP_Registry_add_syntax_processor_87.$$arity = 2); + + Opal.def(self, '$resolve_args', TMP_Registry_resolve_args_89 = function $$resolve_args(args, expect) { + var self = this, opts = nil, missing = nil; + + + opts = (function() {if ($truthy($$$('::', 'Hash')['$==='](args['$[]'](-1)))) { + return args.$pop() + } else { + return $hash2([], {}) + }; return nil; })(); + if (expect['$=='](1)) { + return opts}; + if ($truthy($rb_gt((missing = $rb_minus($rb_minus(expect, 1), args.$size())), 0))) { + args = $rb_plus(args, $$$('::', 'Array').$new(missing)) + } else if ($truthy($rb_lt(missing, 0))) { + args.$pop(missing['$-@']())}; + args['$<<'](opts); + return args; + }, TMP_Registry_resolve_args_89.$$arity = 2); + return (Opal.def(self, '$as_symbol', TMP_Registry_as_symbol_90 = function $$as_symbol(name) { + var self = this; + + if ($truthy(name)) { + return name.$to_sym() + } else { + return nil + } + }, TMP_Registry_as_symbol_90.$$arity = 1), nil) && 'as_symbol'; + })($nesting[0], null, $nesting); + (function(self, $parent_nesting) { + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_generate_name_91, TMP_next_auto_id_92, TMP_groups_93, TMP_create_94, TMP_register_95, TMP_unregister_all_96, TMP_unregister_97, TMP_resolve_class_99, TMP_class_for_name_100, TMP_class_for_name_101, TMP_class_for_name_103; + + + + Opal.def(self, '$generate_name', TMP_generate_name_91 = function $$generate_name() { + var self = this; + + return "" + "extgrp" + (self.$next_auto_id()) + }, TMP_generate_name_91.$$arity = 0); + + Opal.def(self, '$next_auto_id', TMP_next_auto_id_92 = function $$next_auto_id() { + var $a, self = this; + if (self.auto_id == null) self.auto_id = nil; + + + self.auto_id = ($truthy($a = self.auto_id) ? $a : -1); + return (self.auto_id = $rb_plus(self.auto_id, 1)); + }, TMP_next_auto_id_92.$$arity = 0); + + Opal.def(self, '$groups', TMP_groups_93 = function $$groups() { + var $a, self = this; + if (self.groups == null) self.groups = nil; + + return (self.groups = ($truthy($a = self.groups) ? $a : $hash2([], {}))) + }, TMP_groups_93.$$arity = 0); + + Opal.def(self, '$create', TMP_create_94 = function $$create(name) { + var $iter = TMP_create_94.$$p, block = $iter || nil, $a, self = this; + + if ($iter) TMP_create_94.$$p = null; + + + if ($iter) TMP_create_94.$$p = null;; + + if (name == null) { + name = nil; + }; + if ((block !== nil)) { + return $$($nesting, 'Registry').$new($hash(($truthy($a = name) ? $a : self.$generate_name()), block)) + } else { + return $$($nesting, 'Registry').$new() + }; + }, TMP_create_94.$$arity = -1); + Opal.alias(self, "build_registry", "create"); + + Opal.def(self, '$register', TMP_register_95 = function $$register($a) { + var $iter = TMP_register_95.$$p, block = $iter || nil, $post_args, args, $b, self = this, argc = nil, resolved_group = nil, group = nil, name = nil, $writer = nil; + + if ($iter) TMP_register_95.$$p = null; + + + if ($iter) TMP_register_95.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + argc = args.$size(); + if ((block !== nil)) { + resolved_group = block + } else if ($truthy((group = args.$pop()))) { + resolved_group = ($truthy($b = self.$resolve_class(group)) ? $b : group) + } else { + self.$raise($$$('::', 'ArgumentError'), "Extension group to register not specified") + }; + name = ($truthy($b = args.$pop()) ? $b : self.$generate_name()); + if ($truthy(args['$empty?']())) { + } else { + self.$raise($$$('::', 'ArgumentError'), "" + "Wrong number of arguments (" + (argc) + " for 1..2)") + }; + + $writer = [name.$to_sym(), resolved_group]; + $send(self.$groups(), '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];; + }, TMP_register_95.$$arity = -1); + + Opal.def(self, '$unregister_all', TMP_unregister_all_96 = function $$unregister_all() { + var self = this; + + + self.groups = $hash2([], {}); + return nil; + }, TMP_unregister_all_96.$$arity = 0); + + Opal.def(self, '$unregister', TMP_unregister_97 = function $$unregister($a) { + var $post_args, names, TMP_98, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + names = $post_args;; + $send(names, 'each', [], (TMP_98 = function(group){var self = TMP_98.$$s || this; + if (self.groups == null) self.groups = nil; + + + + if (group == null) { + group = nil; + }; + return self.groups.$delete(group.$to_sym());}, TMP_98.$$s = self, TMP_98.$$arity = 1, TMP_98)); + return nil; + }, TMP_unregister_97.$$arity = -1); + + Opal.def(self, '$resolve_class', TMP_resolve_class_99 = function $$resolve_class(object) { + var self = this, $case = nil; + + return (function() {$case = object; + if ($$$('::', 'Class')['$===']($case)) {return object} + else if ($$$('::', 'String')['$===']($case)) {return self.$class_for_name(object)} + else { return nil }})() + }, TMP_resolve_class_99.$$arity = 1); + if ($truthy($$$('::', 'RUBY_MIN_VERSION_2'))) { + return (Opal.def(self, '$class_for_name', TMP_class_for_name_100 = function $$class_for_name(qualified_name) { + var self = this, resolved = nil; + + try { + + resolved = $$$('::', 'Object').$const_get(qualified_name, false); + if ($truthy($$$('::', 'Class')['$==='](resolved))) { + } else { + self.$raise() + }; + return resolved; + } catch ($err) { + if (Opal.rescue($err, [$$($nesting, 'StandardError')])) { + try { + return self.$raise($$$('::', 'NameError'), "" + "Could not resolve class for name: " + (qualified_name)) + } finally { Opal.pop_exception() } + } else { throw $err; } + } + }, TMP_class_for_name_100.$$arity = 1), nil) && 'class_for_name' + } else if ($truthy($$$('::', 'RUBY_MIN_VERSION_1_9'))) { + return (Opal.def(self, '$class_for_name', TMP_class_for_name_101 = function $$class_for_name(qualified_name) { + var TMP_102, self = this, resolved = nil; + + try { + + resolved = $send(qualified_name.$split("::"), 'reduce', [$$$('::', 'Object')], (TMP_102 = function(current, name){var self = TMP_102.$$s || this; + + + + if (current == null) { + current = nil; + }; + + if (name == null) { + name = nil; + }; + if ($truthy(name['$empty?']())) { + return current + } else { + + return current.$const_get(name, false); + };}, TMP_102.$$s = self, TMP_102.$$arity = 2, TMP_102)); + if ($truthy($$$('::', 'Class')['$==='](resolved))) { + } else { + self.$raise() + }; + return resolved; + } catch ($err) { + if (Opal.rescue($err, [$$($nesting, 'StandardError')])) { + try { + return self.$raise($$$('::', 'NameError'), "" + "Could not resolve class for name: " + (qualified_name)) + } finally { Opal.pop_exception() } + } else { throw $err; } + } + }, TMP_class_for_name_101.$$arity = 1), nil) && 'class_for_name' + } else { + return (Opal.def(self, '$class_for_name', TMP_class_for_name_103 = function $$class_for_name(qualified_name) { + var TMP_104, self = this, resolved = nil; + + try { + + resolved = $send(qualified_name.$split("::"), 'reduce', [$$$('::', 'Object')], (TMP_104 = function(current, name){var self = TMP_104.$$s || this; + + + + if (current == null) { + current = nil; + }; + + if (name == null) { + name = nil; + }; + if ($truthy(name['$empty?']())) { + return current + } else { + + if ($truthy(current['$const_defined?'](name))) { + + return current.$const_get(name); + } else { + return self.$raise() + }; + };}, TMP_104.$$s = self, TMP_104.$$arity = 2, TMP_104)); + if ($truthy($$$('::', 'Class')['$==='](resolved))) { + } else { + self.$raise() + }; + return resolved; + } catch ($err) { + if (Opal.rescue($err, [$$($nesting, 'StandardError')])) { + try { + return self.$raise($$$('::', 'NameError'), "" + "Could not resolve class for name: " + (qualified_name)) + } finally { Opal.pop_exception() } + } else { throw $err; } + } + }, TMP_class_for_name_103.$$arity = 1), nil) && 'class_for_name' + }; + })(Opal.get_singleton_class(self), $nesting); + })($nesting[0], $nesting) + })($nesting[0], $nesting); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/js/opal_ext/browser/reader"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $truthy = Opal.truthy; + + Opal.add_stubs(['$posixify', '$new', '$base_dir', '$start_with?', '$uriish?', '$descends_from?', '$key?', '$attributes', '$replace_next_line', '$absolute_path?', '$==', '$empty?', '$!', '$slice', '$length']); + return (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + (function($base, $super, $parent_nesting) { + function $PreprocessorReader(){}; + var self = $PreprocessorReader = $klass($base, $super, 'PreprocessorReader', $PreprocessorReader); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_PreprocessorReader_resolve_include_path_1; + + def.path_resolver = def.document = def.include_stack = def.dir = nil; + return (Opal.def(self, '$resolve_include_path', TMP_PreprocessorReader_resolve_include_path_1 = function $$resolve_include_path(target, attrlist, attributes) { + var $a, self = this, p_target = nil, target_type = nil, base_dir = nil, inc_path = nil, relpath = nil, ctx_dir = nil, top_level = nil, offset = nil; + + + p_target = (self.path_resolver = ($truthy($a = self.path_resolver) ? $a : $$($nesting, 'PathResolver').$new("\\"))).$posixify(target); + $a = ["file", self.document.$base_dir()], (target_type = $a[0]), (base_dir = $a[1]), $a; + if ($truthy(p_target['$start_with?']("file://"))) { + inc_path = (relpath = p_target) + } else if ($truthy($$($nesting, 'Helpers')['$uriish?'](p_target))) { + + if ($truthy(($truthy($a = self.path_resolver['$descends_from?'](p_target, base_dir)) ? $a : self.document.$attributes()['$key?']("allow-uri-read")))) { + } else { + return self.$replace_next_line("" + "link:" + (target) + "[" + (attrlist) + "]") + }; + inc_path = (relpath = p_target); + } else if ($truthy(self.path_resolver['$absolute_path?'](p_target))) { + inc_path = (relpath = "" + "file://" + ((function() {if ($truthy(p_target['$start_with?']("/"))) { + return "" + } else { + return "/" + }; return nil; })()) + (p_target)) + } else if ((ctx_dir = (function() {if ($truthy((top_level = self.include_stack['$empty?']()))) { + return base_dir + } else { + return self.dir + }; return nil; })())['$=='](".")) { + inc_path = (relpath = p_target) + } else if ($truthy(($truthy($a = ctx_dir['$start_with?']("file://")) ? $a : $$($nesting, 'Helpers')['$uriish?'](ctx_dir)['$!']()))) { + + inc_path = "" + (ctx_dir) + "/" + (p_target); + if ($truthy(top_level)) { + relpath = p_target + } else if ($truthy(($truthy($a = base_dir['$=='](".")) ? $a : (offset = self.path_resolver['$descends_from?'](inc_path, base_dir))['$!']()))) { + relpath = inc_path + } else { + relpath = inc_path.$slice(offset, inc_path.$length()) + }; + } else if ($truthy(top_level)) { + inc_path = "" + (ctx_dir) + "/" + ((relpath = p_target)) + } else if ($truthy(($truthy($a = (offset = self.path_resolver['$descends_from?'](ctx_dir, base_dir))) ? $a : self.document.$attributes()['$key?']("allow-uri-read")))) { + + inc_path = "" + (ctx_dir) + "/" + (p_target); + relpath = (function() {if ($truthy(offset)) { + + return inc_path.$slice(offset, inc_path.$length()); + } else { + return p_target + }; return nil; })(); + } else { + return self.$replace_next_line("" + "link:" + (target) + "[" + (attrlist) + "]") + }; + return [inc_path, "file", relpath]; + }, TMP_PreprocessorReader_resolve_include_path_1.$$arity = 3), nil) && 'resolve_include_path' + })($nesting[0], $$($nesting, 'Reader'), $nesting) + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/js/postscript"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice; + + Opal.add_stubs(['$require', '$==']); + + self.$require("asciidoctor/converter/composite"); + self.$require("asciidoctor/converter/html5"); + self.$require("asciidoctor/extensions"); + if ($$($nesting, 'JAVASCRIPT_IO_MODULE')['$==']("xmlhttprequest")) { + return self.$require("asciidoctor/js/opal_ext/browser/reader") + } else { + return nil + }; +}; + +/* Generated by Opal 0.11.99.dev */ +(function(Opal) { + function $rb_ge(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs >= rhs : lhs['$>='](rhs); + } + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + function $rb_lt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); + } + var $a, self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $truthy = Opal.truthy, $gvars = Opal.gvars, $module = Opal.module, $hash2 = Opal.hash2, $send = Opal.send, $hash = Opal.hash; + if ($gvars[":"] == null) $gvars[":"] = nil; + + Opal.add_stubs(['$==', '$>=', '$require', '$unshift', '$dirname', '$each', '$constants', '$const_get', '$downcase', '$to_s', '$[]=', '$-', '$upcase', '$[]', '$values', '$new', '$attr_reader', '$instance_variable_set', '$send', '$<<', '$define', '$expand_path', '$join', '$home', '$pwd', '$!', '$!=', '$default_external', '$to_set', '$map', '$keys', '$slice', '$merge', '$default=', '$to_a', '$escape', '$drop', '$insert', '$dup', '$start', '$logger', '$logger=', '$===', '$split', '$gsub', '$respond_to?', '$raise', '$ancestors', '$class', '$path', '$utc', '$at', '$Integer', '$mtime', '$readlines', '$basename', '$extname', '$index', '$strftime', '$year', '$utc_offset', '$rewind', '$lines', '$each_line', '$record', '$parse', '$exception', '$message', '$set_backtrace', '$backtrace', '$stack_trace', '$stack_trace=', '$open', '$load', '$delete', '$key?', '$attributes', '$outfilesuffix', '$safe', '$normalize_system_path', '$mkdir_p', '$directory?', '$convert', '$write', '$<', '$attr?', '$attr', '$uriish?', '$include?', '$write_primary_stylesheet', '$instance', '$empty?', '$read_asset', '$file?', '$write_coderay_stylesheet', '$write_pygments_stylesheet']); + + if ($truthy((($a = $$($nesting, 'RUBY_ENGINE', 'skip_raise')) ? 'constant' : nil))) { + } else { + Opal.const_set($nesting[0], 'RUBY_ENGINE', "unknown") + }; + Opal.const_set($nesting[0], 'RUBY_ENGINE_OPAL', $$($nesting, 'RUBY_ENGINE')['$==']("opal")); + Opal.const_set($nesting[0], 'RUBY_ENGINE_JRUBY', $$($nesting, 'RUBY_ENGINE')['$==']("jruby")); + Opal.const_set($nesting[0], 'RUBY_MIN_VERSION_1_9', $rb_ge($$($nesting, 'RUBY_VERSION'), "1.9")); + Opal.const_set($nesting[0], 'RUBY_MIN_VERSION_2', $rb_ge($$($nesting, 'RUBY_VERSION'), "2")); + self.$require("set"); + if ($$($nesting, 'RUBY_ENGINE')['$==']("opal")) { + self.$require("asciidoctor/js") + } else { + nil + }; + $gvars[":"].$unshift($$($nesting, 'File').$dirname("asciidoctor.rb")); + self.$require("asciidoctor/logging"); + (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), $a, TMP_Asciidoctor_6, TMP_Asciidoctor_7, TMP_Asciidoctor_8, $writer = nil, quote_subs = nil, compat_quote_subs = nil; + + + Opal.const_set($nesting[0], 'RUBY_ENGINE', $$$('::', 'RUBY_ENGINE')); + (function($base, $parent_nesting) { + function $SafeMode() {}; + var self = $SafeMode = $module($base, 'SafeMode', $SafeMode); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_SafeMode_1, TMP_SafeMode_value_for_name_2, TMP_SafeMode_name_for_value_3, TMP_SafeMode_names_4, rec = nil; + + + Opal.const_set($nesting[0], 'UNSAFE', 0); + Opal.const_set($nesting[0], 'SAFE', 1); + Opal.const_set($nesting[0], 'SERVER', 10); + Opal.const_set($nesting[0], 'SECURE', 20); + rec = $hash2([], {}); + $send((Opal.Module.$$nesting = $nesting, self.$constants()), 'each', [], (TMP_SafeMode_1 = function(sym){var self = TMP_SafeMode_1.$$s || this, $writer = nil; + + + + if (sym == null) { + sym = nil; + }; + $writer = [self.$const_get(sym), sym.$to_s().$downcase()]; + $send(rec, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];}, TMP_SafeMode_1.$$s = self, TMP_SafeMode_1.$$arity = 1, TMP_SafeMode_1)); + self.names_by_value = rec; + Opal.defs(self, '$value_for_name', TMP_SafeMode_value_for_name_2 = function $$value_for_name(name) { + var self = this; + + return self.$const_get(name.$upcase()) + }, TMP_SafeMode_value_for_name_2.$$arity = 1); + Opal.defs(self, '$name_for_value', TMP_SafeMode_name_for_value_3 = function $$name_for_value(value) { + var self = this; + if (self.names_by_value == null) self.names_by_value = nil; + + return self.names_by_value['$[]'](value) + }, TMP_SafeMode_name_for_value_3.$$arity = 1); + Opal.defs(self, '$names', TMP_SafeMode_names_4 = function $$names() { + var self = this; + if (self.names_by_value == null) self.names_by_value = nil; + + return self.names_by_value.$values() + }, TMP_SafeMode_names_4.$$arity = 0); + })($nesting[0], $nesting); + (function($base, $parent_nesting) { + function $Compliance() {}; + var self = $Compliance = $module($base, 'Compliance', $Compliance); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Compliance_define_5; + + + self.keys = $$$('::', 'Set').$new(); + (function(self, $parent_nesting) { + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return self.$attr_reader("keys") + })(Opal.get_singleton_class(self), $nesting); + Opal.defs(self, '$define', TMP_Compliance_define_5 = function $$define(key, value) { + var self = this; + if (self.keys == null) self.keys = nil; + + + self.$instance_variable_set("" + "@" + (key), value); + (function(self, $parent_nesting) { + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return self + })(Opal.get_singleton_class(self), $nesting).$send("attr_accessor", key); + self.keys['$<<'](key); + return nil; + }, TMP_Compliance_define_5.$$arity = 2); + self.$define("block_terminates_paragraph", true); + self.$define("strict_verbatim_paragraphs", true); + self.$define("underline_style_section_titles", true); + self.$define("unwrap_standalone_preamble", true); + self.$define("attribute_missing", "skip"); + self.$define("attribute_undefined", "drop-line"); + self.$define("shorthand_property_syntax", true); + self.$define("natural_xrefs", true); + self.$define("unique_id_start_index", 2); + self.$define("markdown_syntax", true); + })($nesting[0], $nesting); + Opal.const_set($nesting[0], 'ROOT_PATH', $$$('::', 'File').$dirname($$$('::', 'File').$dirname($$$('::', 'File').$expand_path("asciidoctor.rb")))); + Opal.const_set($nesting[0], 'DATA_PATH', $$$('::', 'File').$join($$($nesting, 'ROOT_PATH'), "data")); + + try { + Opal.const_set($nesting[0], 'USER_HOME', $$$('::', 'Dir').$home()) + } catch ($err) { + if (Opal.rescue($err, [$$($nesting, 'StandardError')])) { + try { + Opal.const_set($nesting[0], 'USER_HOME', ($truthy($a = $$$('::', 'ENV')['$[]']("HOME")) ? $a : $$$('::', 'Dir').$pwd())) + } finally { Opal.pop_exception() } + } else { throw $err; } + };; + Opal.const_set($nesting[0], 'COERCE_ENCODING', ($truthy($a = $$$('::', 'RUBY_ENGINE_OPAL')['$!']()) ? $$$('::', 'RUBY_MIN_VERSION_1_9') : $a)); + Opal.const_set($nesting[0], 'FORCE_ENCODING', ($truthy($a = $$($nesting, 'COERCE_ENCODING')) ? $$$('::', 'Encoding').$default_external()['$!=']($$$($$$('::', 'Encoding'), 'UTF_8')) : $a)); + Opal.const_set($nesting[0], 'BOM_BYTES_UTF_8', [239, 187, 191]); + Opal.const_set($nesting[0], 'BOM_BYTES_UTF_16LE', [255, 254]); + Opal.const_set($nesting[0], 'BOM_BYTES_UTF_16BE', [254, 255]); + Opal.const_set($nesting[0], 'FORCE_UNICODE_LINE_LENGTH', $$$('::', 'RUBY_MIN_VERSION_1_9')['$!']()); + Opal.const_set($nesting[0], 'LF', Opal.const_set($nesting[0], 'EOL', "\n")); + Opal.const_set($nesting[0], 'NULL', "\u0000"); + Opal.const_set($nesting[0], 'TAB', "\t"); + Opal.const_set($nesting[0], 'MAX_INT', 9007199254740991); + Opal.const_set($nesting[0], 'DEFAULT_DOCTYPE', "article"); + Opal.const_set($nesting[0], 'DEFAULT_BACKEND', "html5"); + Opal.const_set($nesting[0], 'DEFAULT_STYLESHEET_KEYS', ["", "DEFAULT"].$to_set()); + Opal.const_set($nesting[0], 'DEFAULT_STYLESHEET_NAME', "asciidoctor.css"); + Opal.const_set($nesting[0], 'BACKEND_ALIASES', $hash2(["html", "docbook"], {"html": "html5", "docbook": "docbook5"})); + Opal.const_set($nesting[0], 'DEFAULT_PAGE_WIDTHS', $hash2(["docbook"], {"docbook": 425})); + Opal.const_set($nesting[0], 'DEFAULT_EXTENSIONS', $hash2(["html", "docbook", "pdf", "epub", "manpage", "asciidoc"], {"html": ".html", "docbook": ".xml", "pdf": ".pdf", "epub": ".epub", "manpage": ".man", "asciidoc": ".adoc"})); + Opal.const_set($nesting[0], 'ASCIIDOC_EXTENSIONS', $hash2([".adoc", ".asciidoc", ".asc", ".ad", ".txt"], {".adoc": true, ".asciidoc": true, ".asc": true, ".ad": true, ".txt": true})); + Opal.const_set($nesting[0], 'SETEXT_SECTION_LEVELS', $hash2(["=", "-", "~", "^", "+"], {"=": 0, "-": 1, "~": 2, "^": 3, "+": 4})); + Opal.const_set($nesting[0], 'ADMONITION_STYLES', ["NOTE", "TIP", "IMPORTANT", "WARNING", "CAUTION"].$to_set()); + Opal.const_set($nesting[0], 'ADMONITION_STYLE_HEADS', ["N", "T", "I", "W", "C"].$to_set()); + Opal.const_set($nesting[0], 'PARAGRAPH_STYLES', ["comment", "example", "literal", "listing", "normal", "open", "pass", "quote", "sidebar", "source", "verse", "abstract", "partintro"].$to_set()); + Opal.const_set($nesting[0], 'VERBATIM_STYLES', ["literal", "listing", "source", "verse"].$to_set()); + Opal.const_set($nesting[0], 'DELIMITED_BLOCKS', $hash2(["--", "----", "....", "====", "****", "____", "\"\"", "++++", "|===", ",===", ":===", "!===", "////", "```"], {"--": ["open", ["comment", "example", "literal", "listing", "pass", "quote", "sidebar", "source", "verse", "admonition", "abstract", "partintro"].$to_set()], "----": ["listing", ["literal", "source"].$to_set()], "....": ["literal", ["listing", "source"].$to_set()], "====": ["example", ["admonition"].$to_set()], "****": ["sidebar", $$$('::', 'Set').$new()], "____": ["quote", ["verse"].$to_set()], "\"\"": ["quote", ["verse"].$to_set()], "++++": ["pass", ["stem", "latexmath", "asciimath"].$to_set()], "|===": ["table", $$$('::', 'Set').$new()], ",===": ["table", $$$('::', 'Set').$new()], ":===": ["table", $$$('::', 'Set').$new()], "!===": ["table", $$$('::', 'Set').$new()], "////": ["comment", $$$('::', 'Set').$new()], "```": ["fenced_code", $$$('::', 'Set').$new()]})); + Opal.const_set($nesting[0], 'DELIMITED_BLOCK_HEADS', $send($$($nesting, 'DELIMITED_BLOCKS').$keys(), 'map', [], (TMP_Asciidoctor_6 = function(key){var self = TMP_Asciidoctor_6.$$s || this; + + + + if (key == null) { + key = nil; + }; + return key.$slice(0, 2);}, TMP_Asciidoctor_6.$$s = self, TMP_Asciidoctor_6.$$arity = 1, TMP_Asciidoctor_6)).$to_set()); + Opal.const_set($nesting[0], 'LAYOUT_BREAK_CHARS', $hash2(["'", "<"], {"'": "thematic_break", "<": "page_break"})); + Opal.const_set($nesting[0], 'MARKDOWN_THEMATIC_BREAK_CHARS', $hash2(["-", "*", "_"], {"-": "thematic_break", "*": "thematic_break", "_": "thematic_break"})); + Opal.const_set($nesting[0], 'HYBRID_LAYOUT_BREAK_CHARS', $$($nesting, 'LAYOUT_BREAK_CHARS').$merge($$($nesting, 'MARKDOWN_THEMATIC_BREAK_CHARS'))); + Opal.const_set($nesting[0], 'NESTABLE_LIST_CONTEXTS', ["ulist", "olist", "dlist"]); + Opal.const_set($nesting[0], 'ORDERED_LIST_STYLES', ["arabic", "loweralpha", "lowerroman", "upperalpha", "upperroman"]); + Opal.const_set($nesting[0], 'ORDERED_LIST_KEYWORDS', $hash2(["loweralpha", "lowerroman", "upperalpha", "upperroman"], {"loweralpha": "a", "lowerroman": "i", "upperalpha": "A", "upperroman": "I"})); + Opal.const_set($nesting[0], 'ATTR_REF_HEAD', "{"); + Opal.const_set($nesting[0], 'LIST_CONTINUATION', "+"); + Opal.const_set($nesting[0], 'HARD_LINE_BREAK', " +"); + Opal.const_set($nesting[0], 'LINE_CONTINUATION', " \\"); + Opal.const_set($nesting[0], 'LINE_CONTINUATION_LEGACY', " +"); + Opal.const_set($nesting[0], 'MATHJAX_VERSION', "2.7.4"); + Opal.const_set($nesting[0], 'BLOCK_MATH_DELIMITERS', $hash2(["asciimath", "latexmath"], {"asciimath": ["\\$", "\\$"], "latexmath": ["\\[", "\\]"]})); + Opal.const_set($nesting[0], 'INLINE_MATH_DELIMITERS', $hash2(["asciimath", "latexmath"], {"asciimath": ["\\$", "\\$"], "latexmath": ["\\(", "\\)"]})); + + $writer = ["asciimath"]; + $send(Opal.const_set($nesting[0], 'STEM_TYPE_ALIASES', $hash2(["latexmath", "latex", "tex"], {"latexmath": "latexmath", "latex": "latexmath", "tex": "latexmath"})), 'default=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + Opal.const_set($nesting[0], 'FONT_AWESOME_VERSION', "4.7.0"); + Opal.const_set($nesting[0], 'FLEXIBLE_ATTRIBUTES', ["sectnums"]); + if ($$($nesting, 'RUBY_ENGINE')['$==']("opal")) { + if ($truthy((($a = $$($nesting, 'CC_ANY', 'skip_raise')) ? 'constant' : nil))) { + } else { + Opal.const_set($nesting[0], 'CC_ANY', "[^\\n]") + } + } else { + nil + }; + Opal.const_set($nesting[0], 'AuthorInfoLineRx', new RegExp("" + "^(" + ($$($nesting, 'CG_WORD')) + "[" + ($$($nesting, 'CC_WORD')) + "\\-'.]*)(?: +(" + ($$($nesting, 'CG_WORD')) + "[" + ($$($nesting, 'CC_WORD')) + "\\-'.]*))?(?: +(" + ($$($nesting, 'CG_WORD')) + "[" + ($$($nesting, 'CC_WORD')) + "\\-'.]*))?(?: +<([^>]+)>)?$")); + Opal.const_set($nesting[0], 'RevisionInfoLineRx', new RegExp("" + "^(?:[^\\d{]*(" + ($$($nesting, 'CC_ANY')) + "*?),)? *(?!:)(" + ($$($nesting, 'CC_ANY')) + "*?)(?: *(?!^),?: *(" + ($$($nesting, 'CC_ANY')) + "*))?$")); + Opal.const_set($nesting[0], 'ManpageTitleVolnumRx', new RegExp("" + "^(" + ($$($nesting, 'CC_ANY')) + "+?) *\\( *(" + ($$($nesting, 'CC_ANY')) + "+?) *\\)$")); + Opal.const_set($nesting[0], 'ManpageNamePurposeRx', new RegExp("" + "^(" + ($$($nesting, 'CC_ANY')) + "+?) +- +(" + ($$($nesting, 'CC_ANY')) + "+)$")); + Opal.const_set($nesting[0], 'ConditionalDirectiveRx', new RegExp("" + "^(\\\\)?(ifdef|ifndef|ifeval|endif)::(\\S*?(?:([,+])\\S*?)?)\\[(" + ($$($nesting, 'CC_ANY')) + "+)?\\]$")); + Opal.const_set($nesting[0], 'EvalExpressionRx', new RegExp("" + "^(" + ($$($nesting, 'CC_ANY')) + "+?) *([=!><]=|[><]) *(" + ($$($nesting, 'CC_ANY')) + "+)$")); + Opal.const_set($nesting[0], 'IncludeDirectiveRx', new RegExp("" + "^(\\\\)?include::([^\\[][^\\[]*)\\[(" + ($$($nesting, 'CC_ANY')) + "+)?\\]$")); + Opal.const_set($nesting[0], 'TagDirectiveRx', /\b(?:tag|(e)nd)::(\S+?)\[\](?=$|[ \r])/m); + Opal.const_set($nesting[0], 'AttributeEntryRx', new RegExp("" + "^:(!?" + ($$($nesting, 'CG_WORD')) + "[^:]*):(?:[ \\t]+(" + ($$($nesting, 'CC_ANY')) + "*))?$")); + Opal.const_set($nesting[0], 'InvalidAttributeNameCharsRx', new RegExp("" + "[^-" + ($$($nesting, 'CC_WORD')) + "]")); + if ($$($nesting, 'RUBY_ENGINE')['$==']("opal")) { + Opal.const_set($nesting[0], 'AttributeEntryPassMacroRx', /^pass:([a-z]+(?:,[a-z]+)*)?\[([\S\s]*)\]$/) + } else { + nil + }; + Opal.const_set($nesting[0], 'AttributeReferenceRx', new RegExp("" + "(\\\\)?\\{(" + ($$($nesting, 'CG_WORD')) + "[-" + ($$($nesting, 'CC_WORD')) + "]*|(set|counter2?):" + ($$($nesting, 'CC_ANY')) + "+?)(\\\\)?\\}")); + Opal.const_set($nesting[0], 'BlockAnchorRx', new RegExp("" + "^\\[\\[(?:|([" + ($$($nesting, 'CC_ALPHA')) + "_:][" + ($$($nesting, 'CC_WORD')) + ":.-]*)(?:, *(" + ($$($nesting, 'CC_ANY')) + "+))?)\\]\\]$")); + Opal.const_set($nesting[0], 'BlockAttributeListRx', new RegExp("" + "^\\[(|[" + ($$($nesting, 'CC_WORD')) + ".#%{,\"']" + ($$($nesting, 'CC_ANY')) + "*)\\]$")); + Opal.const_set($nesting[0], 'BlockAttributeLineRx', new RegExp("" + "^\\[(?:|[" + ($$($nesting, 'CC_WORD')) + ".#%{,\"']" + ($$($nesting, 'CC_ANY')) + "*|\\[(?:|[" + ($$($nesting, 'CC_ALPHA')) + "_:][" + ($$($nesting, 'CC_WORD')) + ":.-]*(?:, *" + ($$($nesting, 'CC_ANY')) + "+)?)\\])\\]$")); + Opal.const_set($nesting[0], 'BlockTitleRx', new RegExp("" + "^\\.(\\.?[^ \\t.]" + ($$($nesting, 'CC_ANY')) + "*)$")); + Opal.const_set($nesting[0], 'AdmonitionParagraphRx', new RegExp("" + "^(" + ($$($nesting, 'ADMONITION_STYLES').$to_a().$join("|")) + "):[ \\t]+")); + Opal.const_set($nesting[0], 'LiteralParagraphRx', new RegExp("" + "^([ \\t]+" + ($$($nesting, 'CC_ANY')) + "*)$")); + Opal.const_set($nesting[0], 'AtxSectionTitleRx', new RegExp("" + "^(=={0,5})[ \\t]+(" + ($$($nesting, 'CC_ANY')) + "+?)(?:[ \\t]+\\1)?$")); + Opal.const_set($nesting[0], 'ExtAtxSectionTitleRx', new RegExp("" + "^(=={0,5}|#\\\#{0,5})[ \\t]+(" + ($$($nesting, 'CC_ANY')) + "+?)(?:[ \\t]+\\1)?$")); + Opal.const_set($nesting[0], 'SetextSectionTitleRx', new RegExp("" + "^((?!\\.)" + ($$($nesting, 'CC_ANY')) + "*?" + ($$($nesting, 'CG_WORD')) + ($$($nesting, 'CC_ANY')) + "*)$")); + Opal.const_set($nesting[0], 'InlineSectionAnchorRx', new RegExp("" + " (\\\\)?\\[\\[([" + ($$($nesting, 'CC_ALPHA')) + "_:][" + ($$($nesting, 'CC_WORD')) + ":.-]*)(?:, *(" + ($$($nesting, 'CC_ANY')) + "+))?\\]\\]$")); + Opal.const_set($nesting[0], 'InvalidSectionIdCharsRx', new RegExp("" + "<[^>]+>|&(?:[a-z][a-z]+\\d{0,2}|#\\d\\d\\d{0,4}|#x[\\da-f][\\da-f][\\da-f]{0,3});|[^ " + ($$($nesting, 'CC_WORD')) + "\\-.]+?")); + Opal.const_set($nesting[0], 'AnyListRx', new RegExp("" + "^(?:[ \\t]*(?:-|\\*\\**|\\.\\.*|\\u2022|\\d+\\.|[a-zA-Z]\\.|[IVXivx]+\\))[ \\t]|(?!//[^/])" + ($$($nesting, 'CC_ANY')) + "*?(?::::{0,2}|;;)(?:$|[ \\t])|[ \\t])")); + Opal.const_set($nesting[0], 'UnorderedListRx', new RegExp("" + "^[ \\t]*(-|\\*\\**|\\u2022)[ \\t]+(" + ($$($nesting, 'CC_ANY')) + "*)$")); + Opal.const_set($nesting[0], 'OrderedListRx', new RegExp("" + "^[ \\t]*(\\.\\.*|\\d+\\.|[a-zA-Z]\\.|[IVXivx]+\\))[ \\t]+(" + ($$($nesting, 'CC_ANY')) + "*)$")); + Opal.const_set($nesting[0], 'OrderedListMarkerRxMap', $hash2(["arabic", "loweralpha", "lowerroman", "upperalpha", "upperroman"], {"arabic": /\d+\./, "loweralpha": /[a-z]\./, "lowerroman": /[ivx]+\)/, "upperalpha": /[A-Z]\./, "upperroman": /[IVX]+\)/})); + Opal.const_set($nesting[0], 'DescriptionListRx', new RegExp("" + "^(?!//[^/])[ \\t]*(" + ($$($nesting, 'CC_ANY')) + "*?)(:::{0,2}|;;)(?:$|[ \\t]+(" + ($$($nesting, 'CC_ANY')) + "*)$)")); + Opal.const_set($nesting[0], 'DescriptionListSiblingRx', $hash2(["::", ":::", "::::", ";;"], {"::": new RegExp("" + "^(?!//[^/])[ \\t]*(" + ($$($nesting, 'CC_ANY')) + "*[^:]|)(::)(?:$|[ \\t]+(" + ($$($nesting, 'CC_ANY')) + "*)$)"), ":::": new RegExp("" + "^(?!//[^/])[ \\t]*(" + ($$($nesting, 'CC_ANY')) + "*[^:]|)(:::)(?:$|[ \\t]+(" + ($$($nesting, 'CC_ANY')) + "*)$)"), "::::": new RegExp("" + "^(?!//[^/])[ \\t]*(" + ($$($nesting, 'CC_ANY')) + "*[^:]|)(::::)(?:$|[ \\t]+(" + ($$($nesting, 'CC_ANY')) + "*)$)"), ";;": new RegExp("" + "^(?!//[^/])[ \\t]*(" + ($$($nesting, 'CC_ANY')) + "*?)(;;)(?:$|[ \\t]+(" + ($$($nesting, 'CC_ANY')) + "*)$)")})); + Opal.const_set($nesting[0], 'CalloutListRx', new RegExp("" + "^<(\\d+|\\.)>[ \\t]+(" + ($$($nesting, 'CC_ANY')) + "*)$")); + Opal.const_set($nesting[0], 'CalloutExtractRx', /((?:\/\/|#|--|;;) ?)?(\\)?(?=(?: ?\\?)*$)/); + Opal.const_set($nesting[0], 'CalloutExtractRxt', "(\\\\)?<()(\\d+|\\.)>(?=(?: ?\\\\?<(?:\\d+|\\.)>)*$)"); + Opal.const_set($nesting[0], 'CalloutExtractRxMap', $send($$$('::', 'Hash'), 'new', [], (TMP_Asciidoctor_7 = function(h, k){var self = TMP_Asciidoctor_7.$$s || this; + + + + if (h == null) { + h = nil; + }; + + if (k == null) { + k = nil; + }; + $writer = [k, new RegExp("" + "(" + ($$$('::', 'Regexp').$escape(k)) + " ?)?" + ($$($nesting, 'CalloutExtractRxt')))]; + $send(h, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];}, TMP_Asciidoctor_7.$$s = self, TMP_Asciidoctor_7.$$arity = 2, TMP_Asciidoctor_7))); + Opal.const_set($nesting[0], 'CalloutScanRx', new RegExp("" + "\\\\?(?=(?: ?\\\\?)*" + ($$($nesting, 'CC_EOL')) + ")")); + Opal.const_set($nesting[0], 'CalloutSourceRx', new RegExp("" + "((?://|#|--|;;) ?)?(\\\\)?<!?(|--)(\\d+|\\.)\\3>(?=(?: ?\\\\?<!?\\3(?:\\d+|\\.)\\3>)*" + ($$($nesting, 'CC_EOL')) + ")")); + Opal.const_set($nesting[0], 'CalloutSourceRxt', "" + "(\\\\)?<()(\\d+|\\.)>(?=(?: ?\\\\?<(?:\\d+|\\.)>)*" + ($$($nesting, 'CC_EOL')) + ")"); + Opal.const_set($nesting[0], 'CalloutSourceRxMap', $send($$$('::', 'Hash'), 'new', [], (TMP_Asciidoctor_8 = function(h, k){var self = TMP_Asciidoctor_8.$$s || this; + + + + if (h == null) { + h = nil; + }; + + if (k == null) { + k = nil; + }; + $writer = [k, new RegExp("" + "(" + ($$$('::', 'Regexp').$escape(k)) + " ?)?" + ($$($nesting, 'CalloutSourceRxt')))]; + $send(h, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];}, TMP_Asciidoctor_8.$$s = self, TMP_Asciidoctor_8.$$arity = 2, TMP_Asciidoctor_8))); + Opal.const_set($nesting[0], 'ListRxMap', $hash2(["ulist", "olist", "dlist", "colist"], {"ulist": $$($nesting, 'UnorderedListRx'), "olist": $$($nesting, 'OrderedListRx'), "dlist": $$($nesting, 'DescriptionListRx'), "colist": $$($nesting, 'CalloutListRx')})); + Opal.const_set($nesting[0], 'ColumnSpecRx', /^(?:(\d+)\*)?([<^>](?:\.[<^>]?)?|(?:[<^>]?\.)?[<^>])?(\d+%?|~)?([a-z])?$/); + Opal.const_set($nesting[0], 'CellSpecStartRx', /^[ \t]*(?:(\d+(?:\.\d*)?|(?:\d*\.)?\d+)([*+]))?([<^>](?:\.[<^>]?)?|(?:[<^>]?\.)?[<^>])?([a-z])?$/); + Opal.const_set($nesting[0], 'CellSpecEndRx', /[ \t]+(?:(\d+(?:\.\d*)?|(?:\d*\.)?\d+)([*+]))?([<^>](?:\.[<^>]?)?|(?:[<^>]?\.)?[<^>])?([a-z])?$/); + Opal.const_set($nesting[0], 'CustomBlockMacroRx', new RegExp("" + "^(" + ($$($nesting, 'CG_WORD')) + "[-" + ($$($nesting, 'CC_WORD')) + "]*)::(|\\S|\\S" + ($$($nesting, 'CC_ANY')) + "*?\\S)\\[(" + ($$($nesting, 'CC_ANY')) + "+)?\\]$")); + Opal.const_set($nesting[0], 'BlockMediaMacroRx', new RegExp("" + "^(image|video|audio)::(\\S|\\S" + ($$($nesting, 'CC_ANY')) + "*?\\S)\\[(" + ($$($nesting, 'CC_ANY')) + "+)?\\]$")); + Opal.const_set($nesting[0], 'BlockTocMacroRx', new RegExp("" + "^toc::\\[(" + ($$($nesting, 'CC_ANY')) + "+)?\\]$")); + Opal.const_set($nesting[0], 'InlineAnchorRx', new RegExp("" + "(\\\\)?(?:\\[\\[([" + ($$($nesting, 'CC_ALPHA')) + "_:][" + ($$($nesting, 'CC_WORD')) + ":.-]*)(?:, *(" + ($$($nesting, 'CC_ANY')) + "+?))?\\]\\]|anchor:([" + ($$($nesting, 'CC_ALPHA')) + "_:][" + ($$($nesting, 'CC_WORD')) + ":.-]*)\\[(?:\\]|(" + ($$($nesting, 'CC_ANY')) + "*?[^\\\\])\\]))")); + Opal.const_set($nesting[0], 'InlineAnchorScanRx', new RegExp("" + "(?:^|[^\\\\\\[])\\[\\[([" + ($$($nesting, 'CC_ALPHA')) + "_:][" + ($$($nesting, 'CC_WORD')) + ":.-]*)(?:, *(" + ($$($nesting, 'CC_ANY')) + "+?))?\\]\\]|(?:^|[^\\\\])anchor:([" + ($$($nesting, 'CC_ALPHA')) + "_:][" + ($$($nesting, 'CC_WORD')) + ":.-]*)\\[(?:\\]|(" + ($$($nesting, 'CC_ANY')) + "*?[^\\\\])\\])")); + Opal.const_set($nesting[0], 'LeadingInlineAnchorRx', new RegExp("" + "^\\[\\[([" + ($$($nesting, 'CC_ALPHA')) + "_:][" + ($$($nesting, 'CC_WORD')) + ":.-]*)(?:, *(" + ($$($nesting, 'CC_ANY')) + "+?))?\\]\\]")); + Opal.const_set($nesting[0], 'InlineBiblioAnchorRx', new RegExp("" + "^\\[\\[\\[([" + ($$($nesting, 'CC_ALPHA')) + "_:][" + ($$($nesting, 'CC_WORD')) + ":.-]*)(?:, *(" + ($$($nesting, 'CC_ANY')) + "+?))?\\]\\]\\]")); + Opal.const_set($nesting[0], 'InlineEmailRx', new RegExp("" + "([\\\\>:/])?" + ($$($nesting, 'CG_WORD')) + "[" + ($$($nesting, 'CC_WORD')) + ".%+-]*@" + ($$($nesting, 'CG_ALNUM')) + "[" + ($$($nesting, 'CC_ALNUM')) + ".-]*\\." + ($$($nesting, 'CG_ALPHA')) + "{2,4}\\b")); + Opal.const_set($nesting[0], 'InlineFootnoteMacroRx', new RegExp("" + "\\\\?footnote(?:(ref):|:([\\w-]+)?)\\[(?:|(" + ($$($nesting, 'CC_ALL')) + "*?[^\\\\]))\\]", 'm')); + Opal.const_set($nesting[0], 'InlineImageMacroRx', new RegExp("" + "\\\\?i(?:mage|con):([^:\\s\\[](?:[^\\n\\[]*[^\\s\\[])?)\\[(|" + ($$($nesting, 'CC_ALL')) + "*?[^\\\\])\\]", 'm')); + Opal.const_set($nesting[0], 'InlineIndextermMacroRx', new RegExp("" + "\\\\?(?:(indexterm2?):\\[(" + ($$($nesting, 'CC_ALL')) + "*?[^\\\\])\\]|\\(\\((" + ($$($nesting, 'CC_ALL')) + "+?)\\)\\)(?!\\)))", 'm')); + Opal.const_set($nesting[0], 'InlineKbdBtnMacroRx', new RegExp("" + "(\\\\)?(kbd|btn):\\[(" + ($$($nesting, 'CC_ALL')) + "*?[^\\\\])\\]", 'm')); + Opal.const_set($nesting[0], 'InlineLinkRx', new RegExp("" + "(^|link:|" + ($$($nesting, 'CG_BLANK')) + "|<|[>\\(\\)\\[\\];])(\\\\?(?:https?|file|ftp|irc)://[^\\s\\[\\]<]*[^\\s.,\\[\\]<])(?:\\[(|" + ($$($nesting, 'CC_ALL')) + "*?[^\\\\])\\])?", 'm')); + Opal.const_set($nesting[0], 'InlineLinkMacroRx', new RegExp("" + "\\\\?(?:link|(mailto)):(|[^:\\s\\[][^\\s\\[]*)\\[(|" + ($$($nesting, 'CC_ALL')) + "*?[^\\\\])\\]", 'm')); + Opal.const_set($nesting[0], 'MacroNameRx', new RegExp("" + "^" + ($$($nesting, 'CG_WORD')) + "[-" + ($$($nesting, 'CC_WORD')) + "]*$")); + Opal.const_set($nesting[0], 'InlineStemMacroRx', new RegExp("" + "\\\\?(stem|(?:latex|ascii)math):([a-z]+(?:,[a-z]+)*)?\\[(" + ($$($nesting, 'CC_ALL')) + "*?[^\\\\])\\]", 'm')); + Opal.const_set($nesting[0], 'InlineMenuMacroRx', new RegExp("" + "\\\\?menu:(" + ($$($nesting, 'CG_WORD')) + "|[" + ($$($nesting, 'CC_WORD')) + "&][^\\n\\[]*[^\\s\\[])\\[ *(" + ($$($nesting, 'CC_ALL')) + "*?[^\\\\])?\\]", 'm')); + Opal.const_set($nesting[0], 'InlineMenuRx', new RegExp("" + "\\\\?\"([" + ($$($nesting, 'CC_WORD')) + "&][^\"]*?[ \\n]+>[ \\n]+[^\"]*)\"")); + Opal.const_set($nesting[0], 'InlinePassRx', $hash(false, ["+", "`", new RegExp("" + "(^|[^" + ($$($nesting, 'CC_WORD')) + ";:])(?:\\[([^\\]]+)\\])?(\\\\?(\\+|`)(\\S|\\S" + ($$($nesting, 'CC_ALL')) + "*?\\S)\\4)(?!" + ($$($nesting, 'CG_WORD')) + ")", 'm')], true, ["`", nil, new RegExp("" + "(^|[^`" + ($$($nesting, 'CC_WORD')) + "])(?:\\[([^\\]]+)\\])?(\\\\?(`)([^`\\s]|[^`\\s]" + ($$($nesting, 'CC_ALL')) + "*?\\S)\\4)(?![`" + ($$($nesting, 'CC_WORD')) + "])", 'm')])); + Opal.const_set($nesting[0], 'SinglePlusInlinePassRx', new RegExp("" + "^(\\\\)?\\+(\\S|\\S" + ($$($nesting, 'CC_ALL')) + "*?\\S)\\+$", 'm')); + Opal.const_set($nesting[0], 'InlinePassMacroRx', new RegExp("" + "(?:(?:(\\\\?)\\[([^\\]]+)\\])?(\\\\{0,2})(\\+\\+\\+?|\\$\\$)(" + ($$($nesting, 'CC_ALL')) + "*?)\\4|(\\\\?)pass:([a-z]+(?:,[a-z]+)*)?\\[(|" + ($$($nesting, 'CC_ALL')) + "*?[^\\\\])\\])", 'm')); + Opal.const_set($nesting[0], 'InlineXrefMacroRx', new RegExp("" + "\\\\?(?:<<([" + ($$($nesting, 'CC_WORD')) + "#/.:{]" + ($$($nesting, 'CC_ALL')) + "*?)>>|xref:([" + ($$($nesting, 'CC_WORD')) + "#/.:{]" + ($$($nesting, 'CC_ALL')) + "*?)\\[(?:\\]|(" + ($$($nesting, 'CC_ALL')) + "*?[^\\\\])\\]))", 'm')); + if ($$($nesting, 'RUBY_ENGINE')['$==']("opal")) { + Opal.const_set($nesting[0], 'HardLineBreakRx', new RegExp("" + "^(" + ($$($nesting, 'CC_ANY')) + "*) \\+$", 'm')) + } else { + nil + }; + Opal.const_set($nesting[0], 'MarkdownThematicBreakRx', /^ {0,3}([-*_])( *)\1\2\1$/); + Opal.const_set($nesting[0], 'ExtLayoutBreakRx', /^(?:'{3,}|<{3,}|([-*_])( *)\1\2\1)$/); + Opal.const_set($nesting[0], 'BlankLineRx', /\n{2,}/); + Opal.const_set($nesting[0], 'EscapedSpaceRx', /\\([ \t\n])/); + Opal.const_set($nesting[0], 'ReplaceableTextRx', /[&']|--|\.\.\.|\([CRT]M?\)/); + Opal.const_set($nesting[0], 'SpaceDelimiterRx', /([^\\])[ \t\n]+/); + Opal.const_set($nesting[0], 'SubModifierSniffRx', /[+-]/); + Opal.const_set($nesting[0], 'TrailingDigitsRx', /\d+$/); + if ($$($nesting, 'RUBY_ENGINE')['$==']("opal")) { + } else { + nil + }; + Opal.const_set($nesting[0], 'UriSniffRx', new RegExp("" + "^" + ($$($nesting, 'CG_ALPHA')) + "[" + ($$($nesting, 'CC_ALNUM')) + ".+-]+:/{0,2}")); + Opal.const_set($nesting[0], 'UriTerminatorRx', /[);:]$/); + Opal.const_set($nesting[0], 'XmlSanitizeRx', /<[^>]+>/); + Opal.const_set($nesting[0], 'INTRINSIC_ATTRIBUTES', $hash2(["startsb", "endsb", "vbar", "caret", "asterisk", "tilde", "plus", "backslash", "backtick", "blank", "empty", "sp", "two-colons", "two-semicolons", "nbsp", "deg", "zwsp", "quot", "apos", "lsquo", "rsquo", "ldquo", "rdquo", "wj", "brvbar", "pp", "cpp", "amp", "lt", "gt"], {"startsb": "[", "endsb": "]", "vbar": "|", "caret": "^", "asterisk": "*", "tilde": "~", "plus": "+", "backslash": "\\", "backtick": "`", "blank": "", "empty": "", "sp": " ", "two-colons": "::", "two-semicolons": ";;", "nbsp": " ", "deg": "°", "zwsp": "​", "quot": """, "apos": "'", "lsquo": "‘", "rsquo": "’", "ldquo": "“", "rdquo": "”", "wj": "⁠", "brvbar": "¦", "pp": "++", "cpp": "C++", "amp": "&", "lt": "<", "gt": ">"})); + quote_subs = [["strong", "unconstrained", new RegExp("" + "\\\\?(?:\\[([^\\]]+)\\])?\\*\\*(" + ($$($nesting, 'CC_ALL')) + "+?)\\*\\*", 'm')], ["strong", "constrained", new RegExp("" + "(^|[^" + ($$($nesting, 'CC_WORD')) + ";:}])(?:\\[([^\\]]+)\\])?\\*(\\S|\\S" + ($$($nesting, 'CC_ALL')) + "*?\\S)\\*(?!" + ($$($nesting, 'CG_WORD')) + ")", 'm')], ["double", "constrained", new RegExp("" + "(^|[^" + ($$($nesting, 'CC_WORD')) + ";:}])(?:\\[([^\\]]+)\\])?\"`(\\S|\\S" + ($$($nesting, 'CC_ALL')) + "*?\\S)`\"(?!" + ($$($nesting, 'CG_WORD')) + ")", 'm')], ["single", "constrained", new RegExp("" + "(^|[^" + ($$($nesting, 'CC_WORD')) + ";:`}])(?:\\[([^\\]]+)\\])?'`(\\S|\\S" + ($$($nesting, 'CC_ALL')) + "*?\\S)`'(?!" + ($$($nesting, 'CG_WORD')) + ")", 'm')], ["monospaced", "unconstrained", new RegExp("" + "\\\\?(?:\\[([^\\]]+)\\])?``(" + ($$($nesting, 'CC_ALL')) + "+?)``", 'm')], ["monospaced", "constrained", new RegExp("" + "(^|[^" + ($$($nesting, 'CC_WORD')) + ";:\"'`}])(?:\\[([^\\]]+)\\])?`(\\S|\\S" + ($$($nesting, 'CC_ALL')) + "*?\\S)`(?![" + ($$($nesting, 'CC_WORD')) + "\"'`])", 'm')], ["emphasis", "unconstrained", new RegExp("" + "\\\\?(?:\\[([^\\]]+)\\])?__(" + ($$($nesting, 'CC_ALL')) + "+?)__", 'm')], ["emphasis", "constrained", new RegExp("" + "(^|[^" + ($$($nesting, 'CC_WORD')) + ";:}])(?:\\[([^\\]]+)\\])?_(\\S|\\S" + ($$($nesting, 'CC_ALL')) + "*?\\S)_(?!" + ($$($nesting, 'CG_WORD')) + ")", 'm')], ["mark", "unconstrained", new RegExp("" + "\\\\?(?:\\[([^\\]]+)\\])?##(" + ($$($nesting, 'CC_ALL')) + "+?)##", 'm')], ["mark", "constrained", new RegExp("" + "(^|[^" + ($$($nesting, 'CC_WORD')) + "&;:}])(?:\\[([^\\]]+)\\])?#(\\S|\\S" + ($$($nesting, 'CC_ALL')) + "*?\\S)#(?!" + ($$($nesting, 'CG_WORD')) + ")", 'm')], ["superscript", "unconstrained", /\\?(?:\[([^\]]+)\])?\^(\S+?)\^/], ["subscript", "unconstrained", /\\?(?:\[([^\]]+)\])?~(\S+?)~/]]; + compat_quote_subs = quote_subs.$drop(0); + + $writer = [2, ["double", "constrained", new RegExp("" + "(^|[^" + ($$($nesting, 'CC_WORD')) + ";:}])(?:\\[([^\\]]+)\\])?``(\\S|\\S" + ($$($nesting, 'CC_ALL')) + "*?\\S)''(?!" + ($$($nesting, 'CG_WORD')) + ")", 'm')]]; + $send(compat_quote_subs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = [3, ["single", "constrained", new RegExp("" + "(^|[^" + ($$($nesting, 'CC_WORD')) + ";:}])(?:\\[([^\\]]+)\\])?`(\\S|\\S" + ($$($nesting, 'CC_ALL')) + "*?\\S)'(?!" + ($$($nesting, 'CG_WORD')) + ")", 'm')]]; + $send(compat_quote_subs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = [4, ["monospaced", "unconstrained", new RegExp("" + "\\\\?(?:\\[([^\\]]+)\\])?\\+\\+(" + ($$($nesting, 'CC_ALL')) + "+?)\\+\\+", 'm')]]; + $send(compat_quote_subs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = [5, ["monospaced", "constrained", new RegExp("" + "(^|[^" + ($$($nesting, 'CC_WORD')) + ";:}])(?:\\[([^\\]]+)\\])?\\+(\\S|\\S" + ($$($nesting, 'CC_ALL')) + "*?\\S)\\+(?!" + ($$($nesting, 'CG_WORD')) + ")", 'm')]]; + $send(compat_quote_subs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + compat_quote_subs.$insert(3, ["emphasis", "constrained", new RegExp("" + "(^|[^" + ($$($nesting, 'CC_WORD')) + ";:}])(?:\\[([^\\]]+)\\])?'(\\S|\\S" + ($$($nesting, 'CC_ALL')) + "*?\\S)'(?!" + ($$($nesting, 'CG_WORD')) + ")", 'm')]); + Opal.const_set($nesting[0], 'QUOTE_SUBS', $hash(false, quote_subs, true, compat_quote_subs)); + quote_subs = nil; + compat_quote_subs = nil; + Opal.const_set($nesting[0], 'REPLACEMENTS', [[/\\?\(C\)/, "©", "none"], [/\\?\(R\)/, "®", "none"], [/\\?\(TM\)/, "™", "none"], [/(^|\n| |\\)--( |\n|$)/, " — ", "none"], [new RegExp("" + "(" + ($$($nesting, 'CG_WORD')) + ")\\\\?--(?=" + ($$($nesting, 'CG_WORD')) + ")"), "—​", "leading"], [/\\?\.\.\./, "…​", "leading"], [/\\?`'/, "’", "none"], [new RegExp("" + "(" + ($$($nesting, 'CG_ALNUM')) + ")\\\\?'(?=" + ($$($nesting, 'CG_ALPHA')) + ")"), "’", "leading"], [/\\?->/, "→", "none"], [/\\?=>/, "⇒", "none"], [/\\?<-/, "←", "none"], [/\\?<=/, "⇐", "none"], [/\\?(&)amp;((?:[a-zA-Z][a-zA-Z]+\d{0,2}|#\d\d\d{0,4}|#x[\da-fA-F][\da-fA-F][\da-fA-F]{0,3});)/, "", "bounding"]]); + (function(self, $parent_nesting) { + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_load_9, TMP_load_file_13, TMP_convert_15, TMP_convert_file_16; + + + + Opal.def(self, '$load', TMP_load_9 = function $$load(input, options) { + var $a, $b, TMP_10, TMP_11, TMP_12, self = this, timings = nil, logger = nil, $writer = nil, attrs = nil, attrs_arr = nil, lines = nil, input_path = nil, input_mtime = nil, docdate = nil, doctime = nil, doc = nil, ex = nil, context = nil, wrapped_ex = nil; + + + + if (options == null) { + options = $hash2([], {}); + }; + try { + + options = options.$dup(); + if ($truthy((timings = options['$[]']("timings")))) { + timings.$start("read")}; + if ($truthy(($truthy($a = (logger = options['$[]']("logger"))) ? logger['$!=']($$($nesting, 'LoggerManager').$logger()) : $a))) { + + $writer = [logger]; + $send($$($nesting, 'LoggerManager'), 'logger=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if ($truthy((attrs = options['$[]']("attributes"))['$!']())) { + attrs = $hash2([], {}) + } else if ($truthy(($truthy($a = $$$('::', 'Hash')['$==='](attrs)) ? $a : ($truthy($b = $$$('::', 'RUBY_ENGINE_JRUBY')) ? $$$($$$($$$('::', 'Java'), 'JavaUtil'), 'Map')['$==='](attrs) : $b)))) { + attrs = attrs.$dup() + } else if ($truthy($$$('::', 'Array')['$==='](attrs))) { + + $a = [$hash2([], {}), attrs], (attrs = $a[0]), (attrs_arr = $a[1]), $a; + $send(attrs_arr, 'each', [], (TMP_10 = function(entry){var self = TMP_10.$$s || this, $c, $d, k = nil, v = nil; + + + + if (entry == null) { + entry = nil; + }; + $d = entry.$split("=", 2), $c = Opal.to_ary($d), (k = ($c[0] == null ? nil : $c[0])), (v = ($c[1] == null ? nil : $c[1])), $d; + + $writer = [k, ($truthy($c = v) ? $c : "")]; + $send(attrs, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];;}, TMP_10.$$s = self, TMP_10.$$arity = 1, TMP_10)); + } else if ($truthy($$$('::', 'String')['$==='](attrs))) { + + $a = [$hash2([], {}), attrs.$gsub($$($nesting, 'SpaceDelimiterRx'), "" + "\\1" + ($$($nesting, 'NULL'))).$gsub($$($nesting, 'EscapedSpaceRx'), "\\1").$split($$($nesting, 'NULL'))], (attrs = $a[0]), (attrs_arr = $a[1]), $a; + $send(attrs_arr, 'each', [], (TMP_11 = function(entry){var self = TMP_11.$$s || this, $c, $d, k = nil, v = nil; + + + + if (entry == null) { + entry = nil; + }; + $d = entry.$split("=", 2), $c = Opal.to_ary($d), (k = ($c[0] == null ? nil : $c[0])), (v = ($c[1] == null ? nil : $c[1])), $d; + + $writer = [k, ($truthy($c = v) ? $c : "")]; + $send(attrs, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];;}, TMP_11.$$s = self, TMP_11.$$arity = 1, TMP_11)); + } else if ($truthy(($truthy($a = attrs['$respond_to?']("keys")) ? attrs['$respond_to?']("[]") : $a))) { + attrs = $$$('::', 'Hash')['$[]']($send(attrs.$keys(), 'map', [], (TMP_12 = function(k){var self = TMP_12.$$s || this; + + + + if (k == null) { + k = nil; + }; + return [k, attrs['$[]'](k)];}, TMP_12.$$s = self, TMP_12.$$arity = 1, TMP_12))) + } else { + self.$raise($$$('::', 'ArgumentError'), "" + "illegal type for attributes option: " + (attrs.$class().$ancestors().$join(" < "))) + }; + lines = nil; + if ($truthy($$$('::', 'File')['$==='](input))) { + + input_path = $$$('::', 'File').$expand_path(input.$path()); + input_mtime = (function() {if ($truthy($$$('::', 'ENV')['$[]']("SOURCE_DATE_EPOCH"))) { + return $$$('::', 'Time').$at(self.$Integer($$$('::', 'ENV')['$[]']("SOURCE_DATE_EPOCH"))).$utc() + } else { + return input.$mtime() + }; return nil; })(); + lines = input.$readlines(); + + $writer = ["docfile", input_path]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["docdir", $$$('::', 'File').$dirname(input_path)]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["docname", $$($nesting, 'Helpers').$basename(input_path, (($writer = ["docfilesuffix", $$$('::', 'File').$extname(input_path)]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]))]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + if ($truthy((docdate = attrs['$[]']("docdate")))) { + ($truthy($a = attrs['$[]']("docyear")) ? $a : (($writer = ["docyear", (function() {if (docdate.$index("-")['$=='](4)) { + + return docdate.$slice(0, 4); + } else { + return nil + }; return nil; })()]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])) + } else { + + docdate = (($writer = ["docdate", input_mtime.$strftime("%F")]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]); + ($truthy($a = attrs['$[]']("docyear")) ? $a : (($writer = ["docyear", input_mtime.$year().$to_s()]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + }; + doctime = ($truthy($a = attrs['$[]']("doctime")) ? $a : (($writer = ["doctime", input_mtime.$strftime("" + "%T " + ((function() {if (input_mtime.$utc_offset()['$=='](0)) { + return "UTC" + } else { + return "%z" + }; return nil; })()))]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + + $writer = ["docdatetime", "" + (docdate) + " " + (doctime)]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + } else if ($truthy(input['$respond_to?']("readlines"))) { + + + try { + input.$rewind() + } catch ($err) { + if (Opal.rescue($err, [$$($nesting, 'StandardError')])) { + try { + nil + } finally { Opal.pop_exception() } + } else { throw $err; } + };; + lines = input.$readlines(); + } else if ($truthy($$$('::', 'String')['$==='](input))) { + lines = (function() {if ($truthy($$$('::', 'RUBY_MIN_VERSION_2'))) { + return input.$lines() + } else { + return input.$each_line().$to_a() + }; return nil; })() + } else if ($truthy($$$('::', 'Array')['$==='](input))) { + lines = input.$drop(0) + } else { + self.$raise($$$('::', 'ArgumentError'), "" + "unsupported input type: " + (input.$class())) + }; + if ($truthy(timings)) { + + timings.$record("read"); + timings.$start("parse");}; + + $writer = ["attributes", attrs]; + $send(options, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + doc = (function() {if (options['$[]']("parse")['$=='](false)) { + + return $$($nesting, 'Document').$new(lines, options); + } else { + return $$($nesting, 'Document').$new(lines, options).$parse() + }; return nil; })(); + if ($truthy(timings)) { + timings.$record("parse")}; + return doc; + } catch ($err) { + if (Opal.rescue($err, [$$($nesting, 'StandardError')])) {ex = $err; + try { + + + try { + + context = "" + "asciidoctor: FAILED: " + (($truthy($a = attrs['$[]']("docfile")) ? $a : "")) + ": Failed to load AsciiDoc document"; + if ($truthy(ex['$respond_to?']("exception"))) { + + wrapped_ex = ex.$exception("" + (context) + " - " + (ex.$message())); + wrapped_ex.$set_backtrace(ex.$backtrace()); + } else { + + wrapped_ex = ex.$class().$new(context, ex); + + $writer = [ex.$stack_trace()]; + $send(wrapped_ex, 'stack_trace=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + }; + } catch ($err) { + if (Opal.rescue($err, [$$($nesting, 'StandardError')])) { + try { + wrapped_ex = ex + } finally { Opal.pop_exception() } + } else { throw $err; } + };; + return self.$raise(wrapped_ex); + } finally { Opal.pop_exception() } + } else { throw $err; } + }; + }, TMP_load_9.$$arity = -2); + + Opal.def(self, '$load_file', TMP_load_file_13 = function $$load_file(filename, options) { + var TMP_14, self = this; + + + + if (options == null) { + options = $hash2([], {}); + }; + return $send($$$('::', 'File'), 'open', [filename, "rb"], (TMP_14 = function(file){var self = TMP_14.$$s || this; + + + + if (file == null) { + file = nil; + }; + return self.$load(file, options);}, TMP_14.$$s = self, TMP_14.$$arity = 1, TMP_14)); + }, TMP_load_file_13.$$arity = -2); + + Opal.def(self, '$convert', TMP_convert_15 = function $$convert(input, options) { + var $a, $b, $c, $d, $e, self = this, to_file = nil, to_dir = nil, mkdirs = nil, $case = nil, write_to_same_dir = nil, stream_output = nil, write_to_target = nil, $writer = nil, input_path = nil, outdir = nil, doc = nil, outfile = nil, working_dir = nil, jail = nil, opts = nil, output = nil, stylesdir = nil, copy_asciidoctor_stylesheet = nil, copy_user_stylesheet = nil, stylesheet = nil, copy_coderay_stylesheet = nil, copy_pygments_stylesheet = nil, stylesoutdir = nil, stylesheet_src = nil, stylesheet_dest = nil, stylesheet_data = nil; + + + + if (options == null) { + options = $hash2([], {}); + }; + options = options.$dup(); + options.$delete("parse"); + to_file = options.$delete("to_file"); + to_dir = options.$delete("to_dir"); + mkdirs = ($truthy($a = options.$delete("mkdirs")) ? $a : false); + $case = to_file; + if (true['$===']($case) || nil['$===']($case)) { + write_to_same_dir = ($truthy($a = to_dir['$!']()) ? $$$('::', 'File')['$==='](input) : $a); + stream_output = false; + write_to_target = to_dir; + to_file = nil;} + else if (false['$===']($case)) { + write_to_same_dir = false; + stream_output = false; + write_to_target = false; + to_file = nil;} + else if ("/dev/null"['$===']($case)) {return self.$load(input, options)} + else { + write_to_same_dir = false; + write_to_target = (function() {if ($truthy((stream_output = to_file['$respond_to?']("write")))) { + return false + } else { + + + $writer = ["to_file", to_file]; + $send(options, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];; + }; return nil; })();}; + if ($truthy(options['$key?']("header_footer"))) { + } else if ($truthy(($truthy($a = write_to_same_dir) ? $a : write_to_target))) { + + $writer = ["header_footer", true]; + $send(options, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if ($truthy(write_to_same_dir)) { + + input_path = $$$('::', 'File').$expand_path(input.$path()); + + $writer = ["to_dir", (outdir = $$$('::', 'File').$dirname(input_path))]; + $send(options, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + } else if ($truthy(write_to_target)) { + if ($truthy(to_dir)) { + if ($truthy(to_file)) { + + $writer = ["to_dir", $$$('::', 'File').$dirname($$$('::', 'File').$expand_path($$$('::', 'File').$join(to_dir, to_file)))]; + $send(options, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + } else { + + $writer = ["to_dir", $$$('::', 'File').$expand_path(to_dir)]; + $send(options, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + } + } else if ($truthy(to_file)) { + + $writer = ["to_dir", $$$('::', 'File').$dirname($$$('::', 'File').$expand_path(to_file))]; + $send(options, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}}; + doc = self.$load(input, options); + if ($truthy(write_to_same_dir)) { + + outfile = $$$('::', 'File').$join(outdir, "" + (doc.$attributes()['$[]']("docname")) + (doc.$outfilesuffix())); + if (outfile['$=='](input_path)) { + self.$raise($$$('::', 'IOError'), "" + "input file and output file cannot be the same: " + (outfile))}; + } else if ($truthy(write_to_target)) { + + working_dir = (function() {if ($truthy(options['$key?']("base_dir"))) { + + return $$$('::', 'File').$expand_path(options['$[]']("base_dir")); + } else { + return $$$('::', 'Dir').$pwd() + }; return nil; })(); + jail = (function() {if ($truthy($rb_ge(doc.$safe(), $$$($$($nesting, 'SafeMode'), 'SAFE')))) { + return working_dir + } else { + return nil + }; return nil; })(); + if ($truthy(to_dir)) { + + outdir = doc.$normalize_system_path(to_dir, working_dir, jail, $hash2(["target_name", "recover"], {"target_name": "to_dir", "recover": false})); + if ($truthy(to_file)) { + + outfile = doc.$normalize_system_path(to_file, outdir, nil, $hash2(["target_name", "recover"], {"target_name": "to_dir", "recover": false})); + outdir = $$$('::', 'File').$dirname(outfile); + } else { + outfile = $$$('::', 'File').$join(outdir, "" + (doc.$attributes()['$[]']("docname")) + (doc.$outfilesuffix())) + }; + } else if ($truthy(to_file)) { + + outfile = doc.$normalize_system_path(to_file, working_dir, jail, $hash2(["target_name", "recover"], {"target_name": "to_dir", "recover": false})); + outdir = $$$('::', 'File').$dirname(outfile);}; + if ($truthy(($truthy($a = $$$('::', 'File')['$==='](input)) ? outfile['$==']($$$('::', 'File').$expand_path(input.$path())) : $a))) { + self.$raise($$$('::', 'IOError'), "" + "input file and output file cannot be the same: " + (outfile))}; + if ($truthy(mkdirs)) { + $$($nesting, 'Helpers').$mkdir_p(outdir) + } else if ($truthy($$$('::', 'File')['$directory?'](outdir))) { + } else { + self.$raise($$$('::', 'IOError'), "" + "target directory does not exist: " + (to_dir) + " (hint: set mkdirs option)") + }; + } else { + + outfile = to_file; + outdir = nil; + }; + opts = (function() {if ($truthy(($truthy($a = outfile) ? stream_output['$!']() : $a))) { + return $hash2(["outfile", "outdir"], {"outfile": outfile, "outdir": outdir}) + } else { + return $hash2([], {}) + }; return nil; })(); + output = doc.$convert(opts); + if ($truthy(outfile)) { + + doc.$write(output, outfile); + if ($truthy(($truthy($a = ($truthy($b = ($truthy($c = ($truthy($d = ($truthy($e = stream_output['$!']()) ? $rb_lt(doc.$safe(), $$$($$($nesting, 'SafeMode'), 'SECURE')) : $e)) ? doc['$attr?']("linkcss") : $d)) ? doc['$attr?']("copycss") : $c)) ? doc['$attr?']("basebackend-html") : $b)) ? ($truthy($b = (stylesdir = doc.$attr("stylesdir"))) ? $$($nesting, 'Helpers')['$uriish?'](stylesdir) : $b)['$!']() : $a))) { + + copy_asciidoctor_stylesheet = false; + copy_user_stylesheet = false; + if ($truthy((stylesheet = doc.$attr("stylesheet")))) { + if ($truthy($$($nesting, 'DEFAULT_STYLESHEET_KEYS')['$include?'](stylesheet))) { + copy_asciidoctor_stylesheet = true + } else if ($truthy($$($nesting, 'Helpers')['$uriish?'](stylesheet)['$!']())) { + copy_user_stylesheet = true}}; + copy_coderay_stylesheet = ($truthy($a = doc['$attr?']("source-highlighter", "coderay")) ? doc.$attr("coderay-css", "class")['$==']("class") : $a); + copy_pygments_stylesheet = ($truthy($a = doc['$attr?']("source-highlighter", "pygments")) ? doc.$attr("pygments-css", "class")['$==']("class") : $a); + if ($truthy(($truthy($a = ($truthy($b = ($truthy($c = copy_asciidoctor_stylesheet) ? $c : copy_user_stylesheet)) ? $b : copy_coderay_stylesheet)) ? $a : copy_pygments_stylesheet))) { + + stylesoutdir = doc.$normalize_system_path(stylesdir, outdir, (function() {if ($truthy($rb_ge(doc.$safe(), $$$($$($nesting, 'SafeMode'), 'SAFE')))) { + return outdir + } else { + return nil + }; return nil; })()); + if ($truthy(mkdirs)) { + $$($nesting, 'Helpers').$mkdir_p(stylesoutdir) + } else if ($truthy($$$('::', 'File')['$directory?'](stylesoutdir))) { + } else { + self.$raise($$$('::', 'IOError'), "" + "target stylesheet directory does not exist: " + (stylesoutdir) + " (hint: set mkdirs option)") + }; + if ($truthy(copy_asciidoctor_stylesheet)) { + $$($nesting, 'Stylesheets').$instance().$write_primary_stylesheet(stylesoutdir) + } else if ($truthy(copy_user_stylesheet)) { + + if ($truthy((stylesheet_src = doc.$attr("copycss"))['$empty?']())) { + stylesheet_src = doc.$normalize_system_path(stylesheet) + } else { + stylesheet_src = doc.$normalize_system_path(stylesheet_src) + }; + stylesheet_dest = doc.$normalize_system_path(stylesheet, stylesoutdir, (function() {if ($truthy($rb_ge(doc.$safe(), $$$($$($nesting, 'SafeMode'), 'SAFE')))) { + return outdir + } else { + return nil + }; return nil; })()); + if ($truthy(($truthy($a = stylesheet_src['$!='](stylesheet_dest)) ? (stylesheet_data = doc.$read_asset(stylesheet_src, $hash2(["warn_on_failure", "label"], {"warn_on_failure": $$$('::', 'File')['$file?'](stylesheet_dest)['$!'](), "label": "stylesheet"}))) : $a))) { + $$$('::', 'IO').$write(stylesheet_dest, stylesheet_data)};}; + if ($truthy(copy_coderay_stylesheet)) { + $$($nesting, 'Stylesheets').$instance().$write_coderay_stylesheet(stylesoutdir) + } else if ($truthy(copy_pygments_stylesheet)) { + $$($nesting, 'Stylesheets').$instance().$write_pygments_stylesheet(stylesoutdir, doc.$attr("pygments-style"))};};}; + return doc; + } else { + return output + }; + }, TMP_convert_15.$$arity = -2); + Opal.alias(self, "render", "convert"); + + Opal.def(self, '$convert_file', TMP_convert_file_16 = function $$convert_file(filename, options) { + var TMP_17, self = this; + + + + if (options == null) { + options = $hash2([], {}); + }; + return $send($$$('::', 'File'), 'open', [filename, "rb"], (TMP_17 = function(file){var self = TMP_17.$$s || this; + + + + if (file == null) { + file = nil; + }; + return self.$convert(file, options);}, TMP_17.$$s = self, TMP_17.$$arity = 1, TMP_17)); + }, TMP_convert_file_16.$$arity = -2); + Opal.alias(self, "render_file", "convert_file"); + if ($$($nesting, 'RUBY_ENGINE')['$==']("opal")) { + return nil + } else { + return nil + }; + })(Opal.get_singleton_class(self), $nesting); + if ($$($nesting, 'RUBY_ENGINE')['$==']("opal")) { + + self.$require("asciidoctor/timings"); + self.$require("asciidoctor/version"); + } else { + nil + }; + })($nesting[0], $nesting); + self.$require("asciidoctor/core_ext"); + self.$require("asciidoctor/helpers"); + self.$require("asciidoctor/substitutors"); + self.$require("asciidoctor/abstract_node"); + self.$require("asciidoctor/abstract_block"); + self.$require("asciidoctor/attribute_list"); + self.$require("asciidoctor/block"); + self.$require("asciidoctor/callouts"); + self.$require("asciidoctor/converter"); + self.$require("asciidoctor/document"); + self.$require("asciidoctor/inline"); + self.$require("asciidoctor/list"); + self.$require("asciidoctor/parser"); + self.$require("asciidoctor/path_resolver"); + self.$require("asciidoctor/reader"); + self.$require("asciidoctor/section"); + self.$require("asciidoctor/stylesheets"); + self.$require("asciidoctor/table"); + if ($$($nesting, 'RUBY_ENGINE')['$==']("opal")) { + return self.$require("asciidoctor/js/postscript") + } else { + return nil + }; +})(Opal); + + +/** + * Convert a JSON to an (Opal) Hash. + * @private + */ +var toHash = function (object) { + return object && !('$$smap' in object) ? Opal.hash(object) : object; +}; + +/** + * Convert an (Opal) Hash to JSON. + * @private + */ +var fromHash = function (hash) { + var object = {}; + var data = hash.$$smap; + for (var key in data) { + object[key] = data[key]; + } + return object; +}; + +/** + * @private + */ +var prepareOptions = function (options) { + if (options = toHash(options)) { + var attrs = options['$[]']('attributes'); + if (attrs && typeof attrs === 'object' && attrs.constructor.name === 'Object') { + options = options.$dup(); + options['$[]=']('attributes', toHash(attrs)); + } + } + return options; +}; + +function initializeClass (superClass, className, functions, defaultFunctions, argProxyFunctions) { + var scope = Opal.klass(Opal.Object, superClass, className, function () {}); + var postConstructFunction; + var initializeFunction; + var defaultFunctionsOverridden = {}; + for (var functionName in functions) { + if (functions.hasOwnProperty(functionName)) { + (function (functionName) { + var userFunction = functions[functionName]; + if (functionName === 'postConstruct') { + postConstructFunction = userFunction; + } else if (functionName === 'initialize') { + initializeFunction = userFunction; + } else { + if (defaultFunctions && defaultFunctions.hasOwnProperty(functionName)) { + defaultFunctionsOverridden[functionName] = true; + } + Opal.def(scope, '$' + functionName, function () { + var args; + if (argProxyFunctions && argProxyFunctions.hasOwnProperty(functionName)) { + args = argProxyFunctions[functionName](arguments); + } else { + args = arguments; + } + return userFunction.apply(this, args); + }); + } + }(functionName)); + } + } + var initialize; + if (typeof initializeFunction === 'function') { + initialize = function () { + initializeFunction.apply(this, arguments); + if (typeof postConstructFunction === 'function') { + postConstructFunction.bind(this)(); + } + }; + } else { + initialize = function () { + Opal.send(this, Opal.find_super_dispatcher(this, 'initialize', initialize)); + if (typeof postConstructFunction === 'function') { + postConstructFunction.bind(this)(); + } + }; + } + Opal.def(scope, '$initialize', initialize); + Opal.def(scope, 'super', function (func) { + if (typeof func === 'function') { + Opal.send(this, Opal.find_super_dispatcher(this, func.name, func)); + } else { + // Bind the initialize function to super(); + var argumentsList = Array.from(arguments); + for (var i = 0; i < argumentsList.length; i++) { + // convert all (Opal) Hash arguments to JSON. + if (typeof argumentsList[i] === 'object') { + argumentsList[i] = toHash(argumentsList[i]); + } + } + Opal.send(this, Opal.find_super_dispatcher(this, 'initialize', initialize), argumentsList); + } + }); + if (defaultFunctions) { + for (var defaultFunctionName in defaultFunctions) { + if (defaultFunctions.hasOwnProperty(defaultFunctionName) && !defaultFunctionsOverridden.hasOwnProperty(defaultFunctionName)) { + (function (defaultFunctionName) { + var defaultFunction = defaultFunctions[defaultFunctionName]; + Opal.def(scope, '$' + defaultFunctionName, function () { + return defaultFunction.apply(this, arguments); + }); + }(defaultFunctionName)); + } + } + } + return scope; +} + +// Asciidoctor API + +/** + * @namespace + * @description + * Methods for parsing AsciiDoc input files and converting documents. + * + * AsciiDoc documents comprise a header followed by zero or more sections. + * Sections are composed of blocks of content. For example: + *
    + *   = Doc Title
    + *
    + *   == Section 1
    + *
    + *   This is a paragraph block in the first section.
    + *
    + *   == Section 2
    + *
    + *   This section has a paragraph block and an olist block.
    + *
    + *   . Item 1
    + *   . Item 2
    + * 
    + * + * @example + * asciidoctor.convertFile('sample.adoc'); + */ +var Asciidoctor = Opal.Asciidoctor['$$class']; + +/** + * Get Asciidoctor core version number. + * + * @memberof Asciidoctor + * @returns {string} - returns the version number of Asciidoctor core. + */ +Asciidoctor.prototype.getCoreVersion = function () { + return this.$$const.VERSION; +}; + +/** + * Get Asciidoctor.js runtime environment informations. + * + * @memberof Asciidoctor + * @returns {Object} - returns the runtime environement including the ioModule, the platform, the engine and the framework. + */ +Asciidoctor.prototype.getRuntime = function () { + return { + ioModule: Opal.const_get_qualified('::', 'JAVASCRIPT_IO_MODULE'), + platform: Opal.const_get_qualified('::', 'JAVASCRIPT_PLATFORM'), + engine: Opal.const_get_qualified('::', 'JAVASCRIPT_ENGINE'), + framework: Opal.const_get_qualified('::', 'JAVASCRIPT_FRAMEWORK') + }; +}; + +/** + * Parse the AsciiDoc source input into an {@link Document} and convert it to the specified backend format. + * + * Accepts input as a Buffer or String. + * + * @param {string|Buffer} input - AsciiDoc input as String or Buffer + * @param {Object} options - a JSON of options to control processing (default: {}) + * @returns {string|Document} - returns the {@link Document} object if the converted String is written to a file, + * otherwise the converted String + * @memberof Asciidoctor + * @example + * var input = '= Hello, AsciiDoc!\n' + + * 'Guillaume Grossetie \n\n' + + * 'An introduction to http://asciidoc.org[AsciiDoc].\n\n' + + * '== First Section\n\n' + + * '* item 1\n' + + * '* item 2\n'; + * + * var html = asciidoctor.convert(input); + */ +Asciidoctor.prototype.convert = function (input, options) { + if (typeof input === 'object' && input.constructor.name === 'Buffer') { + input = input.toString('utf8'); + } + var result = this.$convert(input, prepareOptions(options)); + return result === Opal.nil ? '' : result; +}; + +/** + * Parse the AsciiDoc source input into an {@link Document} and convert it to the specified backend format. + * + * @param {string} filename - source filename + * @param {Object} options - a JSON of options to control processing (default: {}) + * @returns {string|Document} - returns the {@link Document} object if the converted String is written to a file, + * otherwise the converted String + * @memberof Asciidoctor + * @example + * var html = asciidoctor.convertFile('./document.adoc'); + */ +Asciidoctor.prototype.convertFile = function (filename, options) { + return this.$convert_file(filename, prepareOptions(options)); +}; + +/** + * Parse the AsciiDoc source input into an {@link Document} + * + * Accepts input as a Buffer or String. + * + * @param {string|Buffer} input - AsciiDoc input as String or Buffer + * @param {Object} options - a JSON of options to control processing (default: {}) + * @returns {Document} - returns the {@link Document} object + * @memberof Asciidoctor + */ +Asciidoctor.prototype.load = function (input, options) { + if (typeof input === 'object' && input.constructor.name === 'Buffer') { + input = input.toString('utf8'); + } + return this.$load(input, prepareOptions(options)); +}; + +/** + * Parse the contents of the AsciiDoc source file into an {@link Document} + * + * @param {string} filename - source filename + * @param {Object} options - a JSON of options to control processing (default: {}) + * @returns {Document} - returns the {@link Document} object + * @memberof Asciidoctor + */ +Asciidoctor.prototype.loadFile = function (filename, options) { + return this.$load_file(filename, prepareOptions(options)); +}; + +// AbstractBlock API + +/** + * @namespace + * @extends AbstractNode + */ +var AbstractBlock = Opal.Asciidoctor.AbstractBlock; + +/** + * Append a block to this block's list of child blocks. + * + * @memberof AbstractBlock + * @returns {AbstractBlock} - the parent block to which this block was appended. + * + */ +AbstractBlock.prototype.append = function (block) { + this.$append(block); + return this; +}; + +/* + * Apply the named inline substitutions to the specified text. + * + * If no substitutions are specified, the following substitutions are + * applied: + * + * specialcharacters, quotes, attributes, replacements, macros, and post_replacements + * @param {string} text - The text to substitute. + * @param {Array} subs - A list named substitutions to apply to the text. + * @memberof AbstractBlock + * @returns {string} - returns the substituted text. + */ +AbstractBlock.prototype.applySubstitutions = function (text, subs) { + return this.$apply_subs(text, subs); +}; + +/** + * Get the String title of this Block with title substitions applied + * + * The following substitutions are applied to block and section titles: + * + * specialcharacters, quotes, replacements, macros, attributes and post_replacements + * + * @memberof AbstractBlock + * @returns {string} - returns the converted String title for this Block, or undefined if the title is not set. + * @example + * block.title // "Foo 3^ # {two-colons} Bar(1)" + * block.getTitle(); // "Foo 3^ # :: Bar(1)" + */ +AbstractBlock.prototype.getTitle = function () { + var title = this.$title(); + return title === Opal.nil ? undefined : title; +}; + +/** + * Convenience method that returns the interpreted title of the Block + * with the caption prepended. + * Concatenates the value of this Block's caption instance variable and the + * return value of this Block's title method. No space is added between the + * two values. If the Block does not have a caption, the interpreted title is + * returned. + * + * @memberof AbstractBlock + * @returns {string} - the converted String title prefixed with the caption, or just the + * converted String title if no caption is set + */ +AbstractBlock.prototype.getCaptionedTitle = function () { + return this.$captioned_title(); +}; + +/** + * Get the style (block type qualifier) for this block. + * @memberof AbstractBlock + * @returns {string} - returns the style for this block + */ +AbstractBlock.prototype.getStyle = function () { + return this.style; +}; + +/** + * Get the caption for this block. + * @memberof AbstractBlock + * @returns {string} - returns the caption for this block + */ +AbstractBlock.prototype.getCaption = function () { + return this.$caption(); +}; + +/** + * Set the caption for this block. + * @param {string} caption - Caption + * @memberof AbstractBlock + */ +AbstractBlock.prototype.setCaption = function (caption) { + this.caption = caption; +}; + +/** + * Get the level of this section or the section level in which this block resides. + * @memberof AbstractBlock + * @returns {number} - returns the level of this section + */ +AbstractBlock.prototype.getLevel = function () { + return this.level; +}; + +/** + * Get the substitution keywords to be applied to the contents of this block. + * + * @memberof AbstractBlock + * @returns {Array} - the list of {string} substitution keywords associated with this block. + */ +AbstractBlock.prototype.getSubstitutions = function () { + return this.subs; +}; + +/** + * Check whether a given substitution keyword is present in the substitutions for this block. + * + * @memberof AbstractBlock + * @returns {boolean} - whether the substitution is present on this block. + */ +AbstractBlock.prototype.hasSubstitution = function (substitution) { + return this['$sub?'](substitution); +}; + +/** + * Remove the specified substitution keyword from the list of substitutions for this block. + * + * @memberof AbstractBlock + * @returns undefined + */ +AbstractBlock.prototype.removeSubstitution = function (substitution) { + this.$remove_sub(substitution); +}; + +/** + * Checks if the {@link AbstractBlock} contains any child blocks. + * @memberof AbstractBlock + * @returns {boolean} - whether the {@link AbstractBlock} has child blocks. + */ +AbstractBlock.prototype.hasBlocks = function () { + return this.blocks.length > 0; +}; + +/** + * Get the list of {@link AbstractBlock} sub-blocks for this block. + * @memberof AbstractBlock + * @returns {Array} - returns a list of {@link AbstractBlock} sub-blocks + */ +AbstractBlock.prototype.getBlocks = function () { + return this.blocks; +}; + +/** + * Get the converted result of the child blocks by converting the children appropriate to content model that this block supports. + * @memberof AbstractBlock + * @returns {string} - returns the converted result of the child blocks + */ +AbstractBlock.prototype.getContent = function () { + return this.$content(); +}; + +/** + * Get the converted content for this block. + * If the block has child blocks, the content method should cause them to be converted + * and returned as content that can be included in the parent block's template. + * @memberof AbstractBlock + * @returns {string} - returns the converted String content for this block + */ +AbstractBlock.prototype.convert = function () { + return this.$convert(); +}; + +/** + * Query for all descendant block-level nodes in the document tree + * that match the specified selector (context, style, id, and/or role). + * If a function block is given, it's used as an additional filter. + * If no selector or function block is supplied, all block-level nodes in the tree are returned. + * @param {Object} [selector] + * @param {function} [block] + * @example + * doc.findBy({'context': 'section'}); + * // => { level: 0, title: "Hello, AsciiDoc!", blocks: 0 } + * // => { level: 1, title: "First Section", blocks: 1 } + * + * doc.findBy({'context': 'section'}, function (section) { return section.getLevel() === 1; }); + * // => { level: 1, title: "First Section", blocks: 1 } + * + * doc.findBy({'context': 'listing', 'style': 'source'}); + * // => { context: :listing, content_model: :verbatim, style: "source", lines: 1 } + * + * @memberof AbstractBlock + * @returns {Array} - returns a list of block-level nodes that match the filter or an empty list if no matches are found + */ +AbstractBlock.prototype.findBy = function (selector, block) { + if (typeof block === 'undefined' && typeof selector === 'function') { + return Opal.send(this, 'find_by', null, selector); + } + else if (typeof block === 'function') { + return Opal.send(this, 'find_by', [toHash(selector)], block); + } + else { + return this.$find_by(toHash(selector)); + } +}; + +/** + * Get the source line number where this block started. + * @memberof AbstractBlock + * @returns {number} - returns the source line number where this block started + */ +AbstractBlock.prototype.getLineNumber = function () { + var lineno = this.$lineno(); + return lineno === Opal.nil ? undefined : lineno; +}; + +/** + * Check whether this block has any child Section objects. + * Only applies to Document and Section instances. + * @memberof AbstractBlock + * @returns {boolean} - true if this block has child Section objects, otherwise false + */ +AbstractBlock.prototype.hasSections = function () { + return this['$sections?'](); +}; + +/** + * Get the Array of child Section objects. + * Only applies to Document and Section instances. + * @memberof AbstractBlock + * @returns {Array} - returns an {Array} of {@link Section} objects + */ +AbstractBlock.prototype.getSections = function () { + return this.$sections(); +}; + +/** + * Get the numeral of this block (if section, relative to parent, otherwise absolute). + * Only assigned to section if automatic section numbering is enabled. + * Only assigned to formal block (block with title) if corresponding caption attribute is present. + * If the section is an appendix, the numeral is a letter (starting with A). + * @memberof AbstractBlock + * @returns {string} - returns the numeral + */ +AbstractBlock.prototype.getNumeral = function () { + // number was renamed to numeral + // https://github.com/asciidoctor/asciidoctor/commit/33ac4821e0375bcd5aa189c394ad7630717bcd55 + return this.$number(); +}; + +/** + * Set the numeral of this block. + * @memberof AbstractBlock + */ +AbstractBlock.prototype.setNumeral = function (value) { + // number was renamed to numeral + // https://github.com/asciidoctor/asciidoctor/commit/33ac4821e0375bcd5aa189c394ad7630717bcd55 + return this['$number='](value); +}; + +/** + * A convenience method that checks whether the title of this block is defined. + * + * @returns a {boolean} indicating whether this block has a title. + * @memberof AbstractBlock + */ +AbstractBlock.prototype.hasTitle = function () { + return this['$title?'](); +}; + +// Section API + +/** + * @namespace + * @extends AbstractBlock + */ +var Section = Opal.Asciidoctor.Section; + +/** + * Get the 0-based index order of this section within the parent block. + * @memberof Section + * @returns {number} + */ +Section.prototype.getIndex = function () { + return this.index; +}; + +/** + * Set the 0-based index order of this section within the parent block. + * @memberof Section + */ +Section.prototype.setIndex = function (value) { + this.index = value; +}; + +/** + * Get the section name of this section. + * @memberof Section + * @returns {string} + */ +Section.prototype.getSectionName = function () { + return this.sectname; +}; + +/** + * Set the section name of this section. + * @memberof Section + */ +Section.prototype.setSectionName = function (value) { + this.sectname = value; +}; + +/** + * Get the flag to indicate whether this is a special section or a child of one. + * @memberof Section + * @returns {boolean} + */ +Section.prototype.isSpecial = function () { + return this.special; +}; + +/** + * Set the flag to indicate whether this is a special section or a child of one. + * @memberof Section + */ +Section.prototype.setSpecial = function (value) { + this.special = value; +}; + +/** + * Get the state of the numbered attribute at this section (need to preserve for creating TOC). + * @memberof Section + * @returns {boolean} + */ +Section.prototype.isNumbered = function () { + return this.numbered; +}; + +/** + * Get the caption for this section (only relevant for appendices). + * @memberof Section + * @returns {string} + */ +Section.prototype.getCaption = function () { + var value = this.caption; + return value === Opal.nil ? undefined : value; +}; + +/** + * Get the name of the Section (title) + * @memberof Section + * @returns {string} + * @see {@link AbstractBlock#getTitle} + */ +Section.prototype.getName = function () { + return this.getTitle(); +}; + +/** + * @namespace + */ +var Block = Opal.Asciidoctor.Block; + +/** + * Get the source of this block. + * @memberof Block + * @returns {string} - returns the String source of this block. + */ +Block.prototype.getSource = function () { + return this.$source(); +}; + +/** + * Get the source lines of this block. + * @memberof Block + * @returns {Array} - returns the String {Array} of source lines for this block. + */ +Block.prototype.getSourceLines = function () { + return this.lines; +}; + +// AbstractNode API + +/** + * @namespace + */ +var AbstractNode = Opal.Asciidoctor.AbstractNode; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.getNodeName = function () { + return this.node_name; +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.getAttributes = function () { + return fromHash(this.attributes); +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.getAttribute = function (name, defaultValue, inherit) { + var value = this.$attr(name, defaultValue, inherit); + return value === Opal.nil ? undefined : value; +}; + +/** + * Check whether the specified attribute is present on this node. + * + * @memberof AbstractNode + * @returns {boolean} - true if the attribute is present, otherwise false + */ +AbstractNode.prototype.hasAttribute = function (name) { + return name in this.attributes.$$smap; +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.isAttribute = function (name, expectedValue, inherit) { + var result = this['$attr?'](name, expectedValue, inherit); + return result === Opal.nil ? false : result; +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.setAttribute = function (name, value, overwrite) { + if (typeof overwrite === 'undefined') overwrite = true; + return this.$set_attr(name, value, overwrite); +}; + +/** + * Remove the attribute from the current node. + * @param {string} name - The String attribute name to remove + * @returns {string} - returns the previous {String} value, or undefined if the attribute was not present. + * @memberof AbstractNode + */ +AbstractNode.prototype.removeAttribute = function (name) { + var value = this.$remove_attr(name); + return value === Opal.nil ? undefined : value; +}; + +/** + * Get the {@link Document} to which this node belongs. + * + * @memberof AbstractNode + * @returns {Document} - returns the {@link Document} object to which this node belongs. + */ +AbstractNode.prototype.getDocument = function () { + return this.document; +}; + +/** + * Get the {@link AbstractNode} to which this node is attached. + * + * @memberof AbstractNode + * @returns {AbstractNode} - returns the {@link AbstractNode} object to which this node is attached, + * or undefined if this node has no parent. + */ +AbstractNode.prototype.getParent = function () { + var parent = this.parent; + return parent === Opal.nil ? undefined : parent; +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.isInline = function () { + return this['$inline?'](); +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.isBlock = function () { + return this['$block?'](); +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.isRole = function (expected) { + return this['$role?'](expected); +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.getRole = function () { + return this.$role(); +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.hasRole = function (name) { + return this['$has_role?'](name); +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.getRoles = function () { + return this.$roles(); +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.addRole = function (name) { + return this.$add_role(name); +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.removeRole = function (name) { + return this.$remove_role(name); +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.isReftext = function () { + return this['$reftext?'](); +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.getReftext = function () { + return this.$reftext(); +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.getContext = function () { + var context = this.context; + // Automatically convert Opal pseudo-symbol to String + return typeof context === 'string' ? context : context.toString(); +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.getId = function () { + var id = this.id; + return id === Opal.nil ? undefined : id; +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.isOption = function (name) { + return this['$option?'](name); +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.setOption = function (name) { + return this.$set_option(name); +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.getIconUri = function (name) { + return this.$icon_uri(name); +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.getMediaUri = function (target, assetDirKey) { + return this.$media_uri(target, assetDirKey); +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.getImageUri = function (targetImage, assetDirKey) { + return this.$image_uri(targetImage, assetDirKey); +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.getConverter = function () { + return this.$converter(); +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.readContents = function (target, options) { + return this.$read_contents(target, toHash(options)); +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.readAsset = function (path, options) { + return this.$read_asset(path, toHash(options)); +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.normalizeWebPath = function (target, start, preserveTargetUri) { + return this.$normalize_web_path(target, start, preserveTargetUri); +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.normalizeSystemPath = function (target, start, jail, options) { + return this.$normalize_system_path(target, start, jail, toHash(options)); +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.normalizeAssetPath = function (assetRef, assetName, autoCorrect) { + return this.$normalize_asset_path(assetRef, assetName, autoCorrect); +}; + +// Document API + +/** + * The {@link Document} class represents a parsed AsciiDoc document. + * + * Document is the root node of a parsed AsciiDoc document.
    + * It provides an abstract syntax tree (AST) that represents the structure of the AsciiDoc document + * from which the Document object was parsed. + * + * Although the constructor can be used to create an empty document object, + * more commonly, you'll load the document object from AsciiDoc source + * using the primary API methods on {@link Asciidoctor}. + * When using one of these APIs, you almost always want to set the safe mode to 'safe' (or 'unsafe') + * to enable all of Asciidoctor's features. + * + *
    + *   var doc = Asciidoctor.load('= Hello, AsciiDoc!', {'safe': 'safe'});
    + *   // => Asciidoctor::Document { doctype: "article", doctitle: "Hello, Asciidoc!", blocks: 0 }
    + * 
    + * + * Instances of this class can be used to extract information from the document or alter its structure. + * As such, the Document object is most often used in extensions and by integrations. + * + * The most basic usage of the Document object is to retrieve the document's title. + * + *
    + *  var source = '= Document Title';
    + *  var doc = asciidoctor.load(source, {'safe': 'safe'});
    + *  console.log(doc.getTitle()); // 'Document Title'
    + * 
    + * + * You can also use the Document object to access document attributes defined in the header, such as the author and doctype. + * @namespace + * @extends AbstractBlock + */ + +var Document = Opal.Asciidoctor.Document; + +/** + * Returns a JSON {Object} of ids captured by the processor. + * + * @returns {Object} - returns a JSON {Object} of ids in the document. + * @memberof Document + */ +Document.prototype.getIds = function () { + return fromHash(this.catalog.$$smap.ids); +}; + +/** + * Returns a JSON {Object} of references captured by the processor. + * + * @returns {Object} - returns a JSON {Object} of {AbstractNode} in the document. + * @memberof Document + */ +Document.prototype.getRefs = function () { + return fromHash(this.catalog.$$smap.refs); +}; + +/** + * Returns an {Array} of Document/ImageReference} captured by the processor. + * + * @returns {Array} - returns an {Array} of {Document/ImageReference} in the document. + * Will return an empty array if the option "catalog_assets: true" was not defined on the processor. + * @memberof Document + */ +Document.prototype.getImages = function () { + return this.catalog.$$smap.images; +}; + +/** + * Returns an {Array} of index terms captured by the processor. + * + * @returns {Array} - returns an {Array} of index terms in the document. + * Will return an empty array if the function was called before the document was converted. + * @memberof Document + */ +Document.prototype.getIndexTerms = function () { + return this.catalog.$$smap.indexterms; +}; + +/** + * Returns an {Array} of links captured by the processor. + * + * @returns {Array} - returns an {Array} of links in the document. + * Will return an empty array if: + * - the function was called before the document was converted + * - the option "catalog_assets: true" was not defined on the processor + * @memberof Document + */ +Document.prototype.getLinks = function () { + return this.catalog.$$smap.links; +}; + +/** + * @returns {boolean} - returns true if the document has footnotes otherwise false + * @memberof Document + */ +Document.prototype.hasFootnotes = function () { + return this['$footnotes?'](); +}; + +/** + * Returns an {Array} of {Document/Footnote} captured by the processor. + * + * @returns {Array} - returns an {Array} of {Document/Footnote} in the document. + * Will return an empty array if the function was called before the document was converted. + * @memberof Document + */ +Document.prototype.getFootnotes = function () { + return this.$footnotes(); +}; + +/** + * @returns {string} - returns the level-0 section + * @memberof Document + */ +Document.prototype.getHeader = function () { + return this.header; +}; + +/** + * @memberof Document + */ +Document.prototype.setAttribute = function (name, value) { + return this.$set_attribute(name, value); +}; + +/** + + * @memberof Document + */ +Document.prototype.removeAttribute = function (name) { + this.attributes.$delete(name); + this.attribute_overrides.$delete(name); +}; + +/** + * @memberof Document + */ +Document.prototype.convert = function (options) { + var result = this.$convert(toHash(options)); + return result === Opal.nil ? '' : result; +}; + +/** + * @memberof Document + */ +Document.prototype.write = function (output, target) { + return this.$write(output, target); +}; + +/** + * @returns {string} - returns the full name of the author as a String + * @memberof Document + */ +Document.prototype.getAuthor = function () { + return this.$author(); +}; + +/** + * @memberof Document + */ +Document.prototype.getSource = function () { + return this.$source(); +}; + +/** + * @memberof Document + */ +Document.prototype.getSourceLines = function () { + return this.$source_lines(); +}; + +/** + * @memberof Document + */ +Document.prototype.isNested = function () { + return this['$nested?'](); +}; + +/** + * @memberof Document + */ +Document.prototype.isEmbedded = function () { + return this['$embedded?'](); +}; + +/** + * @memberof Document + */ +Document.prototype.hasExtensions = function () { + return this['$extensions?'](); +}; + +/** + * @memberof Document + */ +Document.prototype.getDoctype = function () { + return this.doctype; +}; + +/** + * @memberof Document + */ +Document.prototype.getBackend = function () { + return this.backend; +}; + +/** + * @memberof Document + */ +Document.prototype.isBasebackend = function (base) { + return this['$basebackend?'](base); +}; + +/** + * Get the title explicitly defined in the document attributes. + * @returns {string} + * @see {@link AbstractNode#getAttributes} + * @memberof Document + */ +Document.prototype.getTitle = function () { + var title = this.$title(); + return title === Opal.nil ? undefined : title; +}; + +/** + * @memberof Document + */ +Document.prototype.setTitle = function (title) { + return this['$title='](title); +}; + +/** + * @memberof Document + * @returns {Document/Title} - returns a {@link Document/Title} + */ +Document.prototype.getDocumentTitle = function (options) { + var doctitle = this.$doctitle(toHash(options)); + return doctitle === Opal.nil ? undefined : doctitle; +}; + +/** + * @memberof Document + * @see {@link Document#getDocumentTitle} + */ +Document.prototype.getDoctitle = Document.prototype.getDocumentTitle; + +/** + * Get the document catalog Hash. + * @memberof Document + */ +Document.prototype.getCatalog = function () { + return fromHash(this.catalog); +}; + +/** + * @memberof Document + */ +Document.prototype.getReferences = Document.prototype.getCatalog; + +/** + * Get the document revision date from document header (document attribute revdate). + * @memberof Document + */ +Document.prototype.getRevisionDate = function () { + return this.getAttribute('revdate'); +}; + +/** + * @memberof Document + * @see Document#getRevisionDate + */ +Document.prototype.getRevdate = function () { + return this.getRevisionDate(); +}; + +/** + * Get the document revision number from document header (document attribute revnumber). + * @memberof Document + */ +Document.prototype.getRevisionNumber = function () { + return this.getAttribute('revnumber'); +}; + +/** + * Get the document revision remark from document header (document attribute revremark). + * @memberof Document + */ +Document.prototype.getRevisionRemark = function () { + return this.getAttribute('revremark'); +}; + + +/** + * Assign a value to the specified attribute in the document header. + * + * The assignment will be visible when the header attributes are restored, + * typically between processor phases (e.g., between parse and convert). + * + * @param {string} name - The {string} attribute name to assign + * @param {Object} value - The {Object} value to assign to the attribute (default: '') + * @param {boolean} overwrite - A {boolean} indicating whether to assign the attribute + * if already present in the attributes Hash (default: true) + * + * @memberof Document + * @returns {boolean} - returns true if the assignment was performed otherwise false + */ +Document.prototype.setHeaderAttribute = function (name, value, overwrite) { + if (typeof overwrite === 'undefined') overwrite = true; + if (typeof value === 'undefined') value = ''; + return this.$set_header_attribute(name, value, overwrite); +}; + +/** + * Convenience method to retrieve the authors of this document as an {Array} of {Document/Author} objects. + * + * This method is backed by the author-related attributes on the document. + * + * @memberof Document + * @returns {Array} - returns an {Array} of {Document/Author} objects. + */ +Document.prototype.getAuthors = function () { + return this.$authors(); +}; + +// Document.Footnote API + +/** + * @namespace + * @module Document/Footnote + */ +var Footnote = Document.Footnote; + +/** + * @memberof Document/Footnote + * @returns {number} - returns the footnote's index + */ +Footnote.prototype.getIndex = function () { + var index = this.$$data.index; + return index === Opal.nil ? undefined : index; +}; + +/** + * @memberof Document/Footnote + * @returns {string} - returns the footnote's id + */ +Footnote.prototype.getId = function () { + var id = this.$$data.id; + return id === Opal.nil ? undefined : id; +}; + +/** + * @memberof Document/Footnote + * @returns {string} - returns the footnote's text + */ +Footnote.prototype.getText = function () { + var text = this.$$data.text; + return text === Opal.nil ? undefined : text; +}; + +// Document.ImageReference API + +/** + * @namespace + * @module Document/ImageReference + */ +var ImageReference = Document.ImageReference; + +/** + * @memberof Document/ImageReference + * @returns {string} - returns the image's target + */ +ImageReference.prototype.getTarget = function () { + return this.$$data.target; +}; + +/** + * @memberof Document/ImageReference + * @returns {string} - returns the image's directory (imagesdir attribute) + */ +ImageReference.prototype.getImagesDirectory = function () { + var value = this.$$data.imagesdir; + return value === Opal.nil ? undefined : value; +}; + +// Document.Author API + +/** + * @namespace + * @module Document/Author + */ +var Author = Document.Author; + +/** + * @memberof Document/Author + * @returns {string} - returns the author's full name + */ +Author.prototype.getName = function () { + var name = this.$$data.name; + return name === Opal.nil ? undefined : name; +}; + +/** + * @memberof Document/Author + * @returns {string} - returns the author's first name + */ +Author.prototype.getFirstName = function () { + var firstName = this.$$data.firstname; + return firstName === Opal.nil ? undefined : firstName; +}; + +/** + * @memberof Document/Author + * @returns {string} - returns the author's middle name (or undefined if the author has no middle name) + */ +Author.prototype.getMiddleName = function () { + var middleName = this.$$data.middlename; + return middleName === Opal.nil ? undefined : middleName; +}; + +/** + * @memberof Document/Author + * @returns {string} - returns the author's last name + */ +Author.prototype.getLastName = function () { + var lastName = this.$$data.lastname; + return lastName === Opal.nil ? undefined : lastName; +}; + +/** + * @memberof Document/Author + * @returns {string} - returns the author's initials (by default based on the author's name) + */ +Author.prototype.getInitials = function () { + var initials = this.$$data.initials; + return initials === Opal.nil ? undefined : initials; +}; + +/** + * @memberof Document/Author + * @returns {string} - returns the author's email + */ +Author.prototype.getEmail = function () { + var email = this.$$data.email; + return email === Opal.nil ? undefined : email; +}; + +// private constructor +Document.RevisionInfo = function (date, number, remark) { + this.date = date; + this.number = number; + this.remark = remark; +}; + +/** + * @class + * @namespace + * @module Document/RevisionInfo + */ +var RevisionInfo = Document.RevisionInfo; + +/** + * Get the document revision date from document header (document attribute revdate). + * @memberof Document/RevisionInfo + */ +RevisionInfo.prototype.getDate = function () { + return this.date; +}; + +/** + * Get the document revision number from document header (document attribute revnumber). + * @memberof Document/RevisionInfo + */ +RevisionInfo.prototype.getNumber = function () { + return this.number; +}; + +/** + * Get the document revision remark from document header (document attribute revremark). + * A short summary of changes in this document revision. + * @memberof Document/RevisionInfo + */ +RevisionInfo.prototype.getRemark = function () { + return this.remark; +}; + +/** + * @memberof Document/RevisionInfo + * @returns {boolean} - returns true if the revision info is empty (ie. not defined), otherwise false + */ +RevisionInfo.prototype.isEmpty = function () { + return this.date === undefined && this.number === undefined && this.remark === undefined; +}; + +/** + * @memberof Document + * @returns {Document/RevisionInfo} - returns a {@link Document/RevisionInfo} + */ +Document.prototype.getRevisionInfo = function () { + return new Document.RevisionInfo(this.getRevisionDate(), this.getRevisionNumber(), this.getRevisionRemark()); +}; + +/** + * @memberof Document + * @returns {boolean} - returns true if the document contains revision info, otherwise false + */ +Document.prototype.hasRevisionInfo = function () { + var revisionInfo = this.getRevisionInfo(); + return !revisionInfo.isEmpty(); +}; + +/** + * @memberof Document + */ +Document.prototype.getNotitle = function () { + return this.$notitle(); +}; + +/** + * @memberof Document + */ +Document.prototype.getNoheader = function () { + return this.$noheader(); +}; + +/** + * @memberof Document + */ +Document.prototype.getNofooter = function () { + return this.$nofooter(); +}; + +/** + * @memberof Document + */ +Document.prototype.hasHeader = function () { + return this['$header?'](); +}; + +/** + * @memberof Document + */ +Document.prototype.deleteAttribute = function (name) { + return this.$delete_attribute(name); +}; + +/** + * @memberof Document + */ +Document.prototype.isAttributeLocked = function (name) { + return this['$attribute_locked?'](name); +}; + +/** + * @memberof Document + */ +Document.prototype.parse = function (data) { + return this.$parse(data); +}; + +/** + * @memberof Document + */ +Document.prototype.getDocinfo = function (docinfoLocation, suffix) { + return this.$docinfo(docinfoLocation, suffix); +}; + +/** + * @memberof Document + */ +Document.prototype.hasDocinfoProcessors = function (docinfoLocation) { + return this['$docinfo_processors?'](docinfoLocation); +}; + +/** + * @memberof Document + */ +Document.prototype.counterIncrement = function (counterName, block) { + return this.$counter_increment(counterName, block); +}; + +/** + * @memberof Document + */ +Document.prototype.counter = function (name, seed) { + return this.$counter(name, seed); +}; + +/** + * @memberof Document + */ +Document.prototype.getSafe = function () { + return this.safe; +}; + +/** + * @memberof Document + */ +Document.prototype.getCompatMode = function () { + return this.compat_mode; +}; + +/** + * @memberof Document + */ +Document.prototype.getSourcemap = function () { + return this.sourcemap; +}; + +/** + * @memberof Document + */ +Document.prototype.getCounters = function () { + return fromHash(this.counters); +}; + +/** + * @memberof Document + */ +Document.prototype.getCallouts = function () { + return this.$callouts(); +}; + +/** + * @memberof Document + */ +Document.prototype.getBaseDir = function () { + return this.base_dir; +}; + +/** + * @memberof Document + */ +Document.prototype.getOptions = function () { + return fromHash(this.options); +}; + +/** + * @memberof Document + */ +Document.prototype.getOutfilesuffix = function () { + return this.outfilesuffix; +}; + +/** + * @memberof Document + */ +Document.prototype.getParentDocument = function () { + return this.parent_document; +}; + +/** + * @memberof Document + */ +Document.prototype.getReader = function () { + return this.reader; +}; + +/** + * @memberof Document + */ +Document.prototype.getConverter = function () { + return this.converter; +}; + +/** + * @memberof Document + */ +Document.prototype.getExtensions = function () { + return this.extensions; +}; + +// Document.Title API + +/** + * @namespace + * @module Document/Title + */ +var Title = Document.Title; + +/** + * @memberof Document/Title + */ +Title.prototype.getMain = function () { + return this.main; +}; + +/** + * @memberof Document/Title + */ +Title.prototype.getCombined = function () { + return this.combined; +}; + +/** + * @memberof Document/Title + */ +Title.prototype.getSubtitle = function () { + var subtitle = this.subtitle; + return subtitle === Opal.nil ? undefined : subtitle; +}; + +/** + * @memberof Document/Title + */ +Title.prototype.isSanitized = function () { + var sanitized = this['$sanitized?'](); + return sanitized === Opal.nil ? false : sanitized; +}; + +/** + * @memberof Document/Title + */ +Title.prototype.hasSubtitle = function () { + return this['$subtitle?'](); +}; + +// Inline API + +/** + * @namespace + * @extends AbstractNode + */ +var Inline = Opal.Asciidoctor.Inline; + +/** + * Create a new Inline element. + * + * @memberof Inline + * @returns {Inline} - returns a new Inline element + */ +Opal.Asciidoctor.Inline['$$class'].prototype.create = function (parent, context, text, opts) { + return this.$new(parent, context, text, toHash(opts)); +}; + +/** + * Get the converted content for this inline node. + * + * @memberof Inline + * @returns {string} - returns the converted String content for this inline node + */ +Inline.prototype.convert = function () { + return this.$convert(); +}; + +/** + * Get the converted String text of this Inline node, if applicable. + * + * @memberof Inline + * @returns {string} - returns the converted String text for this Inline node, or undefined if not applicable for this node. + */ +Inline.prototype.getText = function () { + var text = this.$text(); + return text === Opal.nil ? undefined : text; +}; + +/** + * Get the String sub-type (aka qualifier) of this Inline node. + * + * This value is used to distinguish different variations of the same node + * category, such as different types of anchors. + * + * @memberof Inline + * @returns {string} - returns the string sub-type of this Inline node. + */ +Inline.prototype.getType = function () { + return this.$type(); +}; + +/** + * Get the primary String target of this Inline node. + * + * @memberof Inline + * @returns {string} - returns the string target of this Inline node. + */ +Inline.prototype.getTarget = function () { + var target = this.$target(); + return target === Opal.nil ? undefined : target; +}; + +// List API + +/** @namespace */ +var List = Opal.Asciidoctor.List; + +/** + * Get the Array of {@link ListItem} nodes for this {@link List}. + * + * @memberof List + * @returns {Array} - returns an Array of {@link ListItem} nodes. + */ +List.prototype.getItems = function () { + return this.blocks; +}; + +// ListItem API + +/** @namespace */ +var ListItem = Opal.Asciidoctor.ListItem; + +/** + * Get the converted String text of this ListItem node. + * + * @memberof ListItem + * @returns {string} - returns the converted String text for this ListItem node. + */ +ListItem.prototype.getText = function () { + return this.$text(); +}; + +/** + * Set the String source text of this ListItem node. + * + * @memberof ListItem + */ +ListItem.prototype.setText = function (text) { + return this.text = text; +}; + +// Reader API + +/** @namespace */ +var Reader = Opal.Asciidoctor.Reader; + +/** + * @memberof Reader + */ +Reader.prototype.pushInclude = function (data, file, path, lineno, attributes) { + return this.$push_include(data, file, path, lineno, toHash(attributes)); +}; + +/** + * Get the current location of the reader's cursor, which encapsulates the + * file, dir, path, and lineno of the file being read. + * + * @memberof Reader + */ +Reader.prototype.getCursor = function () { + return this.$cursor(); +}; + +/** + * Get a copy of the remaining {Array} of String lines managed by this Reader. + * + * @memberof Reader + * @returns {Array} - returns A copy of the String {Array} of lines remaining in this Reader. + */ +Reader.prototype.getLines = function () { + return this.$lines(); +}; + +/** + * Get the remaining lines managed by this Reader as a String. + * + * @memberof Reader + * @returns {string} - returns The remaining lines managed by this Reader as a String (joined by linefeed characters). + */ +Reader.prototype.getString = function () { + return this.$string(); +}; + +// Cursor API + +/** @namespace */ +var Cursor = Opal.Asciidoctor.Reader.Cursor; + +/** + * Get the file associated to the cursor. + * @memberof Cursor + */ +Cursor.prototype.getFile = function () { + var file = this.file; + return file === Opal.nil ? undefined : file; +}; + +/** + * Get the directory associated to the cursor. + * @memberof Cursor + * @returns {string} - returns the directory associated to the cursor + */ +Cursor.prototype.getDirectory = function () { + var dir = this.dir; + return dir === Opal.nil ? undefined : dir; +}; + +/** + * Get the path associated to the cursor. + * @memberof Cursor + * @returns {string} - returns the path associated to the cursor (or '') + */ +Cursor.prototype.getPath = function () { + var path = this.path; + return path === Opal.nil ? undefined : path; +}; + +/** + * Get the line number of the cursor. + * @memberof Cursor + * @returns {number} - returns the line number of the cursor + */ +Cursor.prototype.getLineNumber = function () { + return this.lineno; +}; + +// Logger API (available in Asciidoctor 1.5.7+) + +function initializeLoggerFormatterClass (className, functions) { + var superclass = Opal.const_get_qualified(Opal.Logger, 'Formatter'); + return initializeClass(superclass, className, functions, {}, { + 'call': function (args) { + for (var i = 0; i < args.length; i++) { + // convert all (Opal) Hash arguments to JSON. + if (typeof args[i] === 'object' && '$$smap' in args[i]) { + args[i] = fromHash(args[i]); + } + } + return args; + } + }); +} + +function initializeLoggerClass (className, functions) { + var superClass = Opal.const_get_qualified(Opal.Asciidoctor, 'Logger'); + return initializeClass(superClass, className, functions, {}, { + 'add': function (args) { + if (args.length >= 2 && typeof args[2] === 'object' && '$$smap' in args[2]) { + var message = args[2]; + var messageObject = fromHash(message); + messageObject.getText = function () { + return this['text']; + }; + messageObject.getSourceLocation = function () { + return this['source_location']; + }; + messageObject['$inspect'] = function () { + var sourceLocation = this.getSourceLocation(); + if (sourceLocation) { + return sourceLocation.getPath() + ': line ' + sourceLocation.getLineNumber() + ': ' + this.getText(); + } else { + return this.getText(); + } + }; + args[2] = messageObject; + } + return args; + } + }); +} + +/** + * @namespace + */ +var LoggerManager = Opal.const_get_qualified(Opal.Asciidoctor, 'LoggerManager', true); + +// Alias +Opal.Asciidoctor.LoggerManager = LoggerManager; + +if (LoggerManager) { + LoggerManager.getLogger = function () { + return this.$logger(); + }; + + LoggerManager.setLogger = function (logger) { + this.logger = logger; + }; + + LoggerManager.newLogger = function (name, functions) { + return initializeLoggerClass(name, functions).$new(); + }; + + LoggerManager.newFormatter = function (name, functions) { + return initializeLoggerFormatterClass(name, functions).$new(); + }; +} + +/** + * @namespace + */ +var LoggerSeverity = Opal.const_get_qualified(Opal.Logger, 'Severity', true); + +// Alias +Opal.Asciidoctor.LoggerSeverity = LoggerSeverity; + +if (LoggerSeverity) { + LoggerSeverity.get = function (severity) { + return LoggerSeverity.$constants()[severity]; + }; +} + +/** + * @namespace + */ +var LoggerFormatter = Opal.const_get_qualified(Opal.Logger, 'Formatter', true); + + +// Alias +Opal.Asciidoctor.LoggerFormatter = LoggerFormatter; + +if (LoggerFormatter) { + LoggerFormatter.prototype.call = function (severity, time, programName, message) { + return this.$call(LoggerSeverity.get(severity), time, programName, message); + }; +} + +/** + * @namespace + */ +var MemoryLogger = Opal.const_get_qualified(Opal.Asciidoctor, 'MemoryLogger', true); + +// Alias +Opal.Asciidoctor.MemoryLogger = MemoryLogger; + +if (MemoryLogger) { + MemoryLogger.prototype.getMessages = function () { + var messages = this.messages; + var result = []; + for (var i = 0; i < messages.length; i++) { + var message = messages[i]; + var messageObject = fromHash(message); + if (typeof messageObject.message === 'string') { + messageObject.getText = function () { + return this.message; + }; + } else { + // also convert the message attribute + messageObject.message = fromHash(messageObject.message); + messageObject.getText = function () { + return this.message['text']; + }; + } + messageObject.getSeverity = function () { + return this.severity.toString(); + }; + messageObject.getSourceLocation = function () { + return this.message['source_location']; + }; + result.push(messageObject); + } + return result; + }; +} + +/** + * @namespace + */ +var Logger = Opal.const_get_qualified(Opal.Asciidoctor, 'Logger', true); + +// Alias +Opal.Asciidoctor.Logger = Logger; + +if (Logger) { + Logger.prototype.getMaxSeverity = function () { + return this.max_severity; + }; + Logger.prototype.getFormatter = function () { + return this.formatter; + }; + Logger.prototype.setFormatter = function (formatter) { + return this.formatter = formatter; + }; + Logger.prototype.getLevel = function () { + return this.level; + }; + Logger.prototype.setLevel = function (level) { + return this.level = level; + }; + Logger.prototype.getProgramName = function () { + return this.progname; + }; + Logger.prototype.setProgramName = function (programName) { + return this.progname = programName; + }; +} + +/** + * @namespace + */ +var NullLogger = Opal.const_get_qualified(Opal.Asciidoctor, 'NullLogger', true); + +// Alias +Opal.Asciidoctor.NullLogger = NullLogger; + + +if (NullLogger) { + NullLogger.prototype.getMaxSeverity = function () { + return this.max_severity; + }; +} + + +// Alias +Opal.Asciidoctor.StopIteration = Opal.StopIteration; + +// Extensions API + +/** + * @private + */ +var toBlock = function (block) { + // arity is a mandatory field + block.$$arity = block.length; + return block; +}; + +var registerExtension = function (registry, type, processor, name) { + if (typeof processor === 'object' || processor.$$is_class) { + // processor is an instance or a class + return registry['$' + type](processor, name); + } else { + // processor is a function/lambda + return Opal.send(registry, type, name && [name], toBlock(processor)); + } +}; + +/** + * @namespace + * @description + * Extensions provide a way to participate in the parsing and converting + * phases of the AsciiDoc processor or extend the AsciiDoc syntax. + * + * The various extensions participate in AsciiDoc processing as follows: + * + * 1. After the source lines are normalized, {{@link Extensions/Preprocessor}}s modify or replace + * the source lines before parsing begins. {{@link Extensions/IncludeProcessor}}s are used to + * process include directives for targets which they claim to handle. + * 2. The Parser parses the block-level content into an abstract syntax tree. + * Custom blocks and block macros are processed by associated {{@link Extensions/BlockProcessor}}s + * and {{@link Extensions/BlockMacroProcessor}}s, respectively. + * 3. {{@link Extensions/TreeProcessor}}s are run on the abstract syntax tree. + * 4. Conversion of the document begins, at which point inline markup is processed + * and converted. Custom inline macros are processed by associated {InlineMacroProcessor}s. + * 5. {{@link Extensions/Postprocessor}}s modify or replace the converted document. + * 6. The output is written to the output stream. + * + * Extensions may be registered globally using the {Extensions.register} method + * or added to a custom {Registry} instance and passed as an option to a single + * Asciidoctor processor. + * + * @example + * Opal.Asciidoctor.Extensions.register(function () { + * this.block(function () { + * var self = this; + * self.named('shout'); + * self.onContext('paragraph'); + * self.process(function (parent, reader) { + * var lines = reader.getLines().map(function (l) { return l.toUpperCase(); }); + * return self.createBlock(parent, 'paragraph', lines); + * }); + * }); + * }); + */ +var Extensions = Opal.const_get_qualified(Opal.Asciidoctor, 'Extensions'); + +// Alias +Opal.Asciidoctor.Extensions = Extensions; + +/** + * Create a new {@link Extensions/Registry}. + * @param {string} name + * @param {function} block + * @memberof Extensions + * @returns {Extensions/Registry} - returns a {@link Extensions/Registry} + */ +Extensions.create = function (name, block) { + if (typeof name === 'function' && typeof block === 'undefined') { + return Opal.send(this, 'build_registry', null, toBlock(name)); + } else if (typeof block === 'function') { + return Opal.send(this, 'build_registry', [name], toBlock(block)); + } else { + return this.$build_registry(); + } +}; + +/** + * @memberof Extensions + */ +Extensions.register = function (name, block) { + if (typeof name === 'function' && typeof block === 'undefined') { + return Opal.send(this, 'register', null, toBlock(name)); + } else { + return Opal.send(this, 'register', [name], toBlock(block)); + } +}; + +/** + * Get statically-registerd extension groups. + * @memberof Extensions + */ +Extensions.getGroups = function () { + return fromHash(this.$groups()); +}; + +/** + * Unregister all statically-registered extension groups. + * @memberof Extensions + */ +Extensions.unregisterAll = function () { + this.$unregister_all(); +}; + +/** + * Unregister the specified statically-registered extension groups. + * + * NOTE Opal cannot delete an entry from a Hash that is indexed by symbol, so + * we have to resort to using low-level operations in this method. + * + * @memberof Extensions + */ +Extensions.unregister = function () { + var names = Array.prototype.concat.apply([], arguments); + var groups = this.$groups(); + var groupNameIdx = {}; + for (var i = 0, groupSymbolNames = groups.$$keys; i < groupSymbolNames.length; i++) { + var groupSymbolName = groupSymbolNames[i]; + groupNameIdx[groupSymbolName.toString()] = groupSymbolName; + } + for (var j = 0; j < names.length; j++) { + var groupStringName = names[j]; + if (groupStringName in groupNameIdx) Opal.hash_delete(groups, groupNameIdx[groupStringName]); + } +}; + +/** + * @namespace + * @module Extensions/Registry + */ +var Registry = Extensions.Registry; + +/** + * @memberof Extensions/Registry + */ +Registry.prototype.getGroups = Extensions.getGroups; + +/** + * @memberof Extensions/Registry + */ +Registry.prototype.unregisterAll = function () { + this.groups = Opal.hash(); +}; + +/** + * @memberof Extensions/Registry + */ +Registry.prototype.unregister = Extensions.unregister; + +/** + * @memberof Extensions/Registry + */ +Registry.prototype.prefer = function (name, processor) { + if (arguments.length === 1) { + processor = name; + name = null; + } + if (typeof processor === 'object' || processor.$$is_class) { + // processor is an instance or a class + return this['$prefer'](name, processor); + } else { + // processor is a function/lambda + return Opal.send(this, 'prefer', name && [name], toBlock(processor)); + } +}; + +/** + * @memberof Extensions/Registry + */ +Registry.prototype.block = function (name, processor) { + if (arguments.length === 1) { + processor = name; + name = null; + } + return registerExtension(this, 'block', processor, name); +}; + +/** + * @memberof Extensions/Registry + */ +Registry.prototype.inlineMacro = function (name, processor) { + if (arguments.length === 1) { + processor = name; + name = null; + } + return registerExtension(this, 'inline_macro', processor, name); +}; + +/** + * @memberof Extensions/Registry + */ +Registry.prototype.includeProcessor = function (name, processor) { + if (arguments.length === 1) { + processor = name; + name = null; + } + return registerExtension(this, 'include_processor', processor, name); +}; + +/** + * @memberof Extensions/Registry + */ +Registry.prototype.blockMacro = function (name, processor) { + if (arguments.length === 1) { + processor = name; + name = null; + } + return registerExtension(this, 'block_macro', processor, name); +}; + +/** + * @memberof Extensions/Registry + */ +Registry.prototype.treeProcessor = function (name, processor) { + if (arguments.length === 1) { + processor = name; + name = null; + } + return registerExtension(this, 'tree_processor', processor, name); +}; + +/** + * @memberof Extensions/Registry + */ +Registry.prototype.postprocessor = function (name, processor) { + if (arguments.length === 1) { + processor = name; + name = null; + } + return registerExtension(this, 'postprocessor', processor, name); +}; + +/** + * @memberof Extensions/Registry + */ +Registry.prototype.preprocessor = function (name, processor) { + if (arguments.length === 1) { + processor = name; + name = null; + } + return registerExtension(this, 'preprocessor', processor, name); +}; + +/** + * @memberof Extensions/Registry + */ + +Registry.prototype.docinfoProcessor = function (name, processor) { + if (arguments.length === 1) { + processor = name; + name = null; + } + return registerExtension(this, 'docinfo_processor', processor, name); +}; + +/** + * @namespace + * @module Extensions/Processor + */ +var Processor = Extensions.Processor; + +/** + * The extension will be added to the beginning of the list for that extension type. (default is append). + * @memberof Extensions/Processor + * @deprecated Please use the prefer function on the {@link Extensions/Registry}, + * the {@link Extensions/IncludeProcessor}, + * the {@link Extensions/TreeProcessor}, + * the {@link Extensions/Postprocessor}, + * the {@link Extensions/Preprocessor} + * or the {@link Extensions/DocinfoProcessor} + */ +Processor.prototype.prepend = function () { + this.$option('position', '>>'); +}; + +/** + * @memberof Extensions/Processor + */ +Processor.prototype.process = function (block) { + var handler = { + apply: function (target, thisArg, argumentsList) { + for (var i = 0; i < argumentsList.length; i++) { + // convert all (Opal) Hash arguments to JSON. + if (typeof argumentsList[i] === 'object' && '$$smap' in argumentsList[i]) { + argumentsList[i] = fromHash(argumentsList[i]); + } + } + return target.apply(thisArg, argumentsList); + } + }; + var blockProxy = new Proxy(block, handler); + return Opal.send(this, 'process', null, toBlock(blockProxy)); +}; + +/** + * @memberof Extensions/Processor + */ +Processor.prototype.named = function (name) { + return this.$named(name); +}; + +/** + * @memberof Extensions/Processor + */ +Processor.prototype.createBlock = function (parent, context, source, attrs, opts) { + return this.$create_block(parent, context, source, toHash(attrs), toHash(opts)); +}; + +/** + * Creates a list block node and links it to the specified parent. + * + * @param parent - The parent Block (Block, Section, or Document) of this new list block. + * @param {string} context - The list context (e.g., ulist, olist, colist, dlist) + * @param {Object} attrs - An object of attributes to set on this list block + * + * @memberof Extensions/Processor + */ +Processor.prototype.createList = function (parent, context, attrs) { + return this.$create_list(parent, context, toHash(attrs)); +}; + +/** + * Creates a list item node and links it to the specified parent. + * + * @param parent - The parent List of this new list item block. + * @param {string} text - The text of the list item. + * + * @memberof Extensions/Processor + */ +Processor.prototype.createListItem = function (parent, text) { + return this.$create_list_item(parent, text); +}; + +/** + * @memberof Extensions/Processor + */ +Processor.prototype.createImageBlock = function (parent, attrs, opts) { + return this.$create_image_block(parent, toHash(attrs), toHash(opts)); +}; + +/** + * @memberof Extensions/Processor + */ +Processor.prototype.createInline = function (parent, context, text, opts) { + if (opts && opts.attributes) { + opts.attributes = toHash(opts.attributes); + } + return this.$create_inline(parent, context, text, toHash(opts)); +}; + +/** + * @memberof Extensions/Processor + */ +Processor.prototype.parseContent = function (parent, content, attrs) { + return this.$parse_content(parent, content, attrs); +}; + +/** + * @memberof Extensions/Processor + */ +Processor.prototype.positionalAttributes = function (value) { + return this.$positional_attrs(value); +}; + +/** + * @memberof Extensions/Processor + */ +Processor.prototype.resolvesAttributes = function (args) { + return this.$resolves_attributes(args); +}; + +/** + * @namespace + * @module Extensions/BlockProcessor + */ +var BlockProcessor = Extensions.BlockProcessor; + +/** + * @memberof Extensions/BlockProcessor + */ +BlockProcessor.prototype.onContext = function (context) { + return this.$on_context(context); +}; + +/** + * @memberof Extensions/BlockProcessor + */ +BlockProcessor.prototype.onContexts = function () { + return this.$on_contexts(Array.prototype.slice.call(arguments)); +}; + +/** + * @memberof Extensions/BlockProcessor + */ +BlockProcessor.prototype.getName = function () { + var name = this.name; + return name === Opal.nil ? undefined : name; +}; + +/** + * @namespace + * @module Extensions/BlockMacroProcessor + */ +var BlockMacroProcessor = Extensions.BlockMacroProcessor; + +/** + * @memberof Extensions/BlockMacroProcessor + */ +BlockMacroProcessor.prototype.getName = function () { + var name = this.name; + return name === Opal.nil ? undefined : name; +}; + +/** + * @namespace + * @module Extensions/InlineMacroProcessor + */ +var InlineMacroProcessor = Extensions.InlineMacroProcessor; + +/** + * @memberof Extensions/InlineMacroProcessor + */ +InlineMacroProcessor.prototype.getName = function () { + var name = this.name; + return name === Opal.nil ? undefined : name; +}; + +/** + * @namespace + * @module Extensions/IncludeProcessor + */ +var IncludeProcessor = Extensions.IncludeProcessor; + +/** + * @memberof Extensions/IncludeProcessor + */ +IncludeProcessor.prototype.handles = function (block) { + return Opal.send(this, 'handles?', null, toBlock(block)); +}; + +/** + * @memberof Extensions/IncludeProcessor + */ +IncludeProcessor.prototype.prefer = function () { + this.$prefer(); +}; + +/** + * @namespace + * @module Extensions/TreeProcessor + */ +// eslint-disable-next-line no-unused-vars +var TreeProcessor = Extensions.TreeProcessor; + +/** + * @memberof Extensions/TreeProcessor + */ +TreeProcessor.prototype.prefer = function () { + this.$prefer(); +}; + +/** + * @namespace + * @module Extensions/Postprocessor + */ +// eslint-disable-next-line no-unused-vars +var Postprocessor = Extensions.Postprocessor; + +/** + * @memberof Extensions/Postprocessor + */ +Postprocessor.prototype.prefer = function () { + this.$prefer(); +}; + +/** + * @namespace + * @module Extensions/Preprocessor + */ +// eslint-disable-next-line no-unused-vars +var Preprocessor = Extensions.Preprocessor; + +/** + * @memberof Extensions/Preprocessor + */ +Preprocessor.prototype.prefer = function () { + this.$prefer(); +}; + +/** + * @namespace + * @module Extensions/DocinfoProcessor + */ +var DocinfoProcessor = Extensions.DocinfoProcessor; + +/** + * @memberof Extensions/DocinfoProcessor + */ +DocinfoProcessor.prototype.prefer = function () { + this.$prefer(); +}; + +/** + * @memberof Extensions/DocinfoProcessor + */ +DocinfoProcessor.prototype.atLocation = function (value) { + this.$at_location(value); +}; + +function initializeProcessorClass (superclassName, className, functions) { + var superClass = Opal.const_get_qualified(Extensions, superclassName); + return initializeClass(superClass, className, functions, { + 'handles?': function () { + return true; + } + }); +} + +// Postprocessor + +/** + * Create a postprocessor + * @description this API is experimental and subject to change + * @memberof Extensions + */ +Extensions.createPostprocessor = function (name, functions) { + if (arguments.length === 1) { + functions = name; + name = null; + } + return initializeProcessorClass('Postprocessor', name, functions); +}; + +/** + * Create and instantiate a postprocessor + * @description this API is experimental and subject to change + * @memberof Extensions + */ +Extensions.newPostprocessor = function (name, functions) { + if (arguments.length === 1) { + functions = name; + name = null; + } + return this.createPostprocessor(name, functions).$new(); +}; + +// Preprocessor + +/** + * Create a preprocessor + * @description this API is experimental and subject to change + * @memberof Extensions + */ +Extensions.createPreprocessor = function (name, functions) { + if (arguments.length === 1) { + functions = name; + name = null; + } + return initializeProcessorClass('Preprocessor', name, functions); +}; + +/** + * Create and instantiate a preprocessor + * @description this API is experimental and subject to change + * @memberof Extensions + */ +Extensions.newPreprocessor = function (name, functions) { + if (arguments.length === 1) { + functions = name; + name = null; + } + return this.createPreprocessor(name, functions).$new(); +}; + +// Tree Processor + +/** + * Create a tree processor + * @description this API is experimental and subject to change + * @memberof Extensions + */ +Extensions.createTreeProcessor = function (name, functions) { + if (arguments.length === 1) { + functions = name; + name = null; + } + return initializeProcessorClass('TreeProcessor', name, functions); +}; + +/** + * Create and instantiate a tree processor + * @description this API is experimental and subject to change + * @memberof Extensions + */ +Extensions.newTreeProcessor = function (name, functions) { + if (arguments.length === 1) { + functions = name; + name = null; + } + return this.createTreeProcessor(name, functions).$new(); +}; + +// Include Processor + +/** + * Create an include processor + * @description this API is experimental and subject to change + * @memberof Extensions + */ +Extensions.createIncludeProcessor = function (name, functions) { + if (arguments.length === 1) { + functions = name; + name = null; + } + return initializeProcessorClass('IncludeProcessor', name, functions); +}; + +/** + * Create and instantiate an include processor + * @description this API is experimental and subject to change + * @memberof Extensions + */ +Extensions.newIncludeProcessor = function (name, functions) { + if (arguments.length === 1) { + functions = name; + name = null; + } + return this.createIncludeProcessor(name, functions).$new(); +}; + +// Docinfo Processor + +/** + * Create a Docinfo processor + * @description this API is experimental and subject to change + * @memberof Extensions + */ +Extensions.createDocinfoProcessor = function (name, functions) { + if (arguments.length === 1) { + functions = name; + name = null; + } + return initializeProcessorClass('DocinfoProcessor', name, functions); +}; + +/** + * Create and instantiate a Docinfo processor + * @description this API is experimental and subject to change + * @memberof Extensions + */ +Extensions.newDocinfoProcessor = function (name, functions) { + if (arguments.length === 1) { + functions = name; + name = null; + } + return this.createDocinfoProcessor(name, functions).$new(); +}; + +// Block Processor + +/** + * Create a block processor + * @description this API is experimental and subject to change + * @memberof Extensions + */ +Extensions.createBlockProcessor = function (name, functions) { + if (arguments.length === 1) { + functions = name; + name = null; + } + return initializeProcessorClass('BlockProcessor', name, functions); +}; + +/** + * Create and instantiate a block processor + * @description this API is experimental and subject to change + * @memberof Extensions + */ +Extensions.newBlockProcessor = function (name, functions) { + if (arguments.length === 1) { + functions = name; + name = null; + } + return this.createBlockProcessor(name, functions).$new(); +}; + +// Inline Macro Processor + +/** + * Create an inline macro processor + * @description this API is experimental and subject to change + * @memberof Extensions + */ +Extensions.createInlineMacroProcessor = function (name, functions) { + if (arguments.length === 1) { + functions = name; + name = null; + } + return initializeProcessorClass('InlineMacroProcessor', name, functions); +}; + +/** + * Create and instantiate an inline macro processor + * @description this API is experimental and subject to change + * @memberof Extensions + */ +Extensions.newInlineMacroProcessor = function (name, functions) { + if (arguments.length === 1) { + functions = name; + name = null; + } + return this.createInlineMacroProcessor(name, functions).$new(); +}; + +// Block Macro Processor + +/** + * Create a block macro processor + * @description this API is experimental and subject to change + * @memberof Extensions + */ +Extensions.createBlockMacroProcessor = function (name, functions) { + if (arguments.length === 1) { + functions = name; + name = null; + } + return initializeProcessorClass('BlockMacroProcessor', name, functions); +}; + +/** + * Create and instantiate a block macro processor + * @description this API is experimental and subject to change + * @memberof Extensions + */ +Extensions.newBlockMacroProcessor = function (name, functions) { + if (arguments.length === 1) { + functions = name; + name = null; + } + return this.createBlockMacroProcessor(name, functions).$new(); +}; + +// Converter API + +/** + * @namespace + * @module Converter + */ +var Converter = Opal.const_get_qualified(Opal.Asciidoctor, 'Converter'); + +// Alias +Opal.Asciidoctor.Converter = Converter; + +/** + * Convert the specified node. + * + * @param {AbstractNode} node - the AbstractNode to convert + * @param {string} transform - an optional String transform that hints at + * which transformation should be applied to this node. + * @param {Object} opts - a JSON of options that provide additional hints about + * how to convert the node (default: {}) + * @returns the {Object} result of the conversion, typically a {string}. + * @memberof Converter + */ +Converter.prototype.convert = function (node, transform, opts) { + return this.$convert(node, transform, toHash(opts)); +}; + +// The built-in converter doesn't include Converter, so we have to force it +Converter.BuiltIn.prototype.convert = Converter.prototype.convert; + +// Converter Factory API + +/** + * @namespace + * @module Converter/Factory + */ +var ConverterFactory = Opal.Asciidoctor.Converter.Factory; + +// Alias +Opal.Asciidoctor.ConverterFactory = ConverterFactory; + +/** + * Register a custom converter in the global converter factory to handle conversion to the specified backends. + * If the backend value is an asterisk, the converter is used to handle any backend that does not have an explicit converter. + * + * @param converter - The Converter instance to register + * @param backends {Array} - A {string} {Array} of backend names that this converter should be registered to handle (optional, default: ['*']) + * @return {*} - Returns nothing + * @memberof Converter/Factory + */ +ConverterFactory.register = function (converter, backends) { + if (typeof converter === 'object' && typeof converter.$convert === 'undefined' && typeof converter.convert === 'function') { + Opal.def(converter, '$convert', converter.convert); + } + return this.$register(converter, backends); +}; + +/** + * Retrieves the singleton instance of the converter factory. + * + * @param {boolean} initialize - instantiate the singleton if it has not yet + * been instantiated. If this value is false and the singleton has not yet been + * instantiated, this method returns a fresh instance. + * @returns {Converter/Factory} an instance of the converter factory. + * @memberof Converter/Factory + */ +ConverterFactory.getDefault = function (initialize) { + return this.$default(initialize); +}; + +/** + * Create an instance of the converter bound to the specified backend. + * + * @param {string} backend - look for a converter bound to this keyword. + * @param {Object} opts - a JSON of options to pass to the converter (default: {}) + * @returns {Converter} - a converter instance for converting nodes in an Asciidoctor AST. + * @memberof Converter/Factory + */ +ConverterFactory.prototype.create = function (backend, opts) { + return this.$create(backend, toHash(opts)); +}; + +// Built-in converter + +/** + * @namespace + * @module Converter/Html5Converter + */ +var Html5Converter = Opal.Asciidoctor.Converter.Html5Converter; + +// Alias +Opal.Asciidoctor.Html5Converter = Html5Converter; + + +Html5Converter.prototype.convert = function (node, transform, opts) { + return this.$convert(node, transform, opts); +}; + + +var ASCIIDOCTOR_JS_VERSION = '1.5.9'; + + /** + * Get Asciidoctor.js version number. + * + * @memberof Asciidoctor + * @returns {string} - returns the version number of Asciidoctor.js. + */ + Asciidoctor.prototype.getVersion = function () { + return ASCIIDOCTOR_JS_VERSION; + }; + return Opal.Asciidoctor; +})); diff --git a/node_modules/asciidoctor.js/dist/node/asciidoctor.js b/node_modules/asciidoctor.js/dist/node/asciidoctor.js new file mode 100644 index 0000000..f86faef --- /dev/null +++ b/node_modules/asciidoctor.js/dist/node/asciidoctor.js @@ -0,0 +1,22658 @@ +/* eslint-env node, es6 */ +const functionCall = Function.call; +const Opal = require('opal-runtime').Opal; +// save and restore Function.call until https://github.com/opal/opal/issues/1846 is fixed +Function.call = functionCall; + +// Node module +(function (root, factory) { + module.exports = factory; +// eslint-disable-next-line no-unused-vars +}(this, function (moduleConfig) { +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/js/opal_ext/electron/io"] = function(Opal) { + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $send = Opal.send, $gvars = Opal.gvars, $writer = nil; + if ($gvars.stdout == null) $gvars.stdout = nil; + if ($gvars.stderr == null) $gvars.stderr = nil; + + Opal.add_stubs(['$write_proc=', '$-']); + + + $writer = [function(s){console.log(s)}]; + $send($gvars.stdout, 'write_proc=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = [function(s){console.error(s)}]; + $send($gvars.stderr, 'write_proc=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];; +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/js/opal_ext/node"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice; + + Opal.add_stubs(['$==', '$require']); + + + var isElectron = typeof navigator === 'object' && typeof navigator.userAgent === 'string' && typeof navigator.userAgent.indexOf('Electron') !== -1, + platform, + engine, + framework, + ioModule; + + if (typeof moduleConfig === 'object' && typeof moduleConfig.runtime === 'object') { + var runtime = moduleConfig.runtime; + platform = runtime.platform; + engine = runtime.engine; + framework = runtime.framework; + ioModule = runtime.ioModule; + } + + ioModule = ioModule || 'node'; + platform = platform || 'node'; + engine = engine || 'v8'; + if (isElectron) { + framework = framework || 'electron'; + } else { + framework = framework || ''; + } +; + Opal.const_set($nesting[0], 'JAVASCRIPT_IO_MODULE', ioModule); + Opal.const_set($nesting[0], 'JAVASCRIPT_PLATFORM', platform); + Opal.const_set($nesting[0], 'JAVASCRIPT_ENGINE', engine); + Opal.const_set($nesting[0], 'JAVASCRIPT_FRAMEWORK', framework); + if ($$($nesting, 'JAVASCRIPT_FRAMEWORK')['$==']("electron")) { + self.$require("asciidoctor/js/opal_ext/electron/io")}; + +// Load Opal modules +Opal.load("pathname"); +Opal.load("base64"); +Opal.load("open-uri"); +Opal.load("nodejs"); +; +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["set"] = function(Opal) { + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + function $rb_lt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); + } + function $rb_le(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs <= rhs : lhs['$<='](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $hash2 = Opal.hash2, $truthy = Opal.truthy, $send = Opal.send, $module = Opal.module; + + Opal.add_stubs(['$include', '$new', '$nil?', '$===', '$raise', '$each', '$add', '$merge', '$class', '$respond_to?', '$subtract', '$dup', '$join', '$to_a', '$equal?', '$instance_of?', '$==', '$instance_variable_get', '$is_a?', '$size', '$all?', '$include?', '$[]=', '$-', '$enum_for', '$[]', '$<<', '$replace', '$delete', '$select', '$each_key', '$to_proc', '$empty?', '$eql?', '$instance_eval', '$clear', '$<', '$<=', '$keys']); + + (function($base, $super, $parent_nesting) { + function $Set(){}; + var self = $Set = $klass($base, $super, 'Set', $Set); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Set_$$_1, TMP_Set_initialize_2, TMP_Set_dup_4, TMP_Set_$_5, TMP_Set_inspect_6, TMP_Set_$eq$eq_7, TMP_Set_add_9, TMP_Set_classify_10, TMP_Set_collect$B_13, TMP_Set_delete_15, TMP_Set_delete$q_16, TMP_Set_delete_if_17, TMP_Set_add$q_20, TMP_Set_each_21, TMP_Set_empty$q_22, TMP_Set_eql$q_23, TMP_Set_clear_25, TMP_Set_include$q_26, TMP_Set_merge_27, TMP_Set_replace_29, TMP_Set_size_30, TMP_Set_subtract_31, TMP_Set_$_33, TMP_Set_superset$q_34, TMP_Set_proper_superset$q_36, TMP_Set_subset$q_38, TMP_Set_proper_subset$q_40, TMP_Set_to_a_42; + + def.hash = nil; + + self.$include($$($nesting, 'Enumerable')); + Opal.defs(self, '$[]', TMP_Set_$$_1 = function($a) { + var $post_args, ary, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + ary = $post_args;; + return self.$new(ary); + }, TMP_Set_$$_1.$$arity = -1); + + Opal.def(self, '$initialize', TMP_Set_initialize_2 = function $$initialize(enum$) { + var $iter = TMP_Set_initialize_2.$$p, block = $iter || nil, TMP_3, self = this; + + if ($iter) TMP_Set_initialize_2.$$p = null; + + + if ($iter) TMP_Set_initialize_2.$$p = null;; + + if (enum$ == null) { + enum$ = nil; + }; + self.hash = $hash2([], {}); + if ($truthy(enum$['$nil?']())) { + return nil}; + if ($truthy($$($nesting, 'Enumerable')['$==='](enum$))) { + } else { + self.$raise($$($nesting, 'ArgumentError'), "value must be enumerable") + }; + if ($truthy(block)) { + return $send(enum$, 'each', [], (TMP_3 = function(item){var self = TMP_3.$$s || this; + + + + if (item == null) { + item = nil; + }; + return self.$add(Opal.yield1(block, item));}, TMP_3.$$s = self, TMP_3.$$arity = 1, TMP_3)) + } else { + return self.$merge(enum$) + }; + }, TMP_Set_initialize_2.$$arity = -1); + + Opal.def(self, '$dup', TMP_Set_dup_4 = function $$dup() { + var self = this, result = nil; + + + result = self.$class().$new(); + return result.$merge(self); + }, TMP_Set_dup_4.$$arity = 0); + + Opal.def(self, '$-', TMP_Set_$_5 = function(enum$) { + var self = this; + + + if ($truthy(enum$['$respond_to?']("each"))) { + } else { + self.$raise($$($nesting, 'ArgumentError'), "value must be enumerable") + }; + return self.$dup().$subtract(enum$); + }, TMP_Set_$_5.$$arity = 1); + Opal.alias(self, "difference", "-"); + + Opal.def(self, '$inspect', TMP_Set_inspect_6 = function $$inspect() { + var self = this; + + return "" + "#" + }, TMP_Set_inspect_6.$$arity = 0); + + Opal.def(self, '$==', TMP_Set_$eq$eq_7 = function(other) { + var $a, TMP_8, self = this; + + if ($truthy(self['$equal?'](other))) { + return true + } else if ($truthy(other['$instance_of?'](self.$class()))) { + return self.hash['$=='](other.$instance_variable_get("@hash")) + } else if ($truthy(($truthy($a = other['$is_a?']($$($nesting, 'Set'))) ? self.$size()['$=='](other.$size()) : $a))) { + return $send(other, 'all?', [], (TMP_8 = function(o){var self = TMP_8.$$s || this; + if (self.hash == null) self.hash = nil; + + + + if (o == null) { + o = nil; + }; + return self.hash['$include?'](o);}, TMP_8.$$s = self, TMP_8.$$arity = 1, TMP_8)) + } else { + return false + } + }, TMP_Set_$eq$eq_7.$$arity = 1); + + Opal.def(self, '$add', TMP_Set_add_9 = function $$add(o) { + var self = this, $writer = nil; + + + + $writer = [o, true]; + $send(self.hash, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + return self; + }, TMP_Set_add_9.$$arity = 1); + Opal.alias(self, "<<", "add"); + + Opal.def(self, '$classify', TMP_Set_classify_10 = function $$classify() { + var $iter = TMP_Set_classify_10.$$p, block = $iter || nil, TMP_11, TMP_12, self = this, result = nil; + + if ($iter) TMP_Set_classify_10.$$p = null; + + + if ($iter) TMP_Set_classify_10.$$p = null;; + if ((block !== nil)) { + } else { + return self.$enum_for("classify") + }; + result = $send($$($nesting, 'Hash'), 'new', [], (TMP_11 = function(h, k){var self = TMP_11.$$s || this, $writer = nil; + + + + if (h == null) { + h = nil; + }; + + if (k == null) { + k = nil; + }; + $writer = [k, self.$class().$new()]; + $send(h, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];}, TMP_11.$$s = self, TMP_11.$$arity = 2, TMP_11)); + $send(self, 'each', [], (TMP_12 = function(item){var self = TMP_12.$$s || this; + + + + if (item == null) { + item = nil; + }; + return result['$[]'](Opal.yield1(block, item)).$add(item);}, TMP_12.$$s = self, TMP_12.$$arity = 1, TMP_12)); + return result; + }, TMP_Set_classify_10.$$arity = 0); + + Opal.def(self, '$collect!', TMP_Set_collect$B_13 = function() { + var $iter = TMP_Set_collect$B_13.$$p, block = $iter || nil, TMP_14, self = this, result = nil; + + if ($iter) TMP_Set_collect$B_13.$$p = null; + + + if ($iter) TMP_Set_collect$B_13.$$p = null;; + if ((block !== nil)) { + } else { + return self.$enum_for("collect!") + }; + result = self.$class().$new(); + $send(self, 'each', [], (TMP_14 = function(item){var self = TMP_14.$$s || this; + + + + if (item == null) { + item = nil; + }; + return result['$<<'](Opal.yield1(block, item));}, TMP_14.$$s = self, TMP_14.$$arity = 1, TMP_14)); + return self.$replace(result); + }, TMP_Set_collect$B_13.$$arity = 0); + Opal.alias(self, "map!", "collect!"); + + Opal.def(self, '$delete', TMP_Set_delete_15 = function(o) { + var self = this; + + + self.hash.$delete(o); + return self; + }, TMP_Set_delete_15.$$arity = 1); + + Opal.def(self, '$delete?', TMP_Set_delete$q_16 = function(o) { + var self = this; + + if ($truthy(self['$include?'](o))) { + + self.$delete(o); + return self; + } else { + return nil + } + }, TMP_Set_delete$q_16.$$arity = 1); + + Opal.def(self, '$delete_if', TMP_Set_delete_if_17 = function $$delete_if() { + var TMP_18, TMP_19, $iter = TMP_Set_delete_if_17.$$p, $yield = $iter || nil, self = this; + + if ($iter) TMP_Set_delete_if_17.$$p = null; + + if (($yield !== nil)) { + } else { + return self.$enum_for("delete_if") + }; + $send($send(self, 'select', [], (TMP_18 = function(o){var self = TMP_18.$$s || this; + + + + if (o == null) { + o = nil; + }; + return Opal.yield1($yield, o);;}, TMP_18.$$s = self, TMP_18.$$arity = 1, TMP_18)), 'each', [], (TMP_19 = function(o){var self = TMP_19.$$s || this; + if (self.hash == null) self.hash = nil; + + + + if (o == null) { + o = nil; + }; + return self.hash.$delete(o);}, TMP_19.$$s = self, TMP_19.$$arity = 1, TMP_19)); + return self; + }, TMP_Set_delete_if_17.$$arity = 0); + + Opal.def(self, '$add?', TMP_Set_add$q_20 = function(o) { + var self = this; + + if ($truthy(self['$include?'](o))) { + return nil + } else { + return self.$add(o) + } + }, TMP_Set_add$q_20.$$arity = 1); + + Opal.def(self, '$each', TMP_Set_each_21 = function $$each() { + var $iter = TMP_Set_each_21.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Set_each_21.$$p = null; + + + if ($iter) TMP_Set_each_21.$$p = null;; + if ((block !== nil)) { + } else { + return self.$enum_for("each") + }; + $send(self.hash, 'each_key', [], block.$to_proc()); + return self; + }, TMP_Set_each_21.$$arity = 0); + + Opal.def(self, '$empty?', TMP_Set_empty$q_22 = function() { + var self = this; + + return self.hash['$empty?']() + }, TMP_Set_empty$q_22.$$arity = 0); + + Opal.def(self, '$eql?', TMP_Set_eql$q_23 = function(other) { + var TMP_24, self = this; + + return self.hash['$eql?']($send(other, 'instance_eval', [], (TMP_24 = function(){var self = TMP_24.$$s || this; + if (self.hash == null) self.hash = nil; + + return self.hash}, TMP_24.$$s = self, TMP_24.$$arity = 0, TMP_24))) + }, TMP_Set_eql$q_23.$$arity = 1); + + Opal.def(self, '$clear', TMP_Set_clear_25 = function $$clear() { + var self = this; + + + self.hash.$clear(); + return self; + }, TMP_Set_clear_25.$$arity = 0); + + Opal.def(self, '$include?', TMP_Set_include$q_26 = function(o) { + var self = this; + + return self.hash['$include?'](o) + }, TMP_Set_include$q_26.$$arity = 1); + Opal.alias(self, "member?", "include?"); + + Opal.def(self, '$merge', TMP_Set_merge_27 = function $$merge(enum$) { + var TMP_28, self = this; + + + $send(enum$, 'each', [], (TMP_28 = function(item){var self = TMP_28.$$s || this; + + + + if (item == null) { + item = nil; + }; + return self.$add(item);}, TMP_28.$$s = self, TMP_28.$$arity = 1, TMP_28)); + return self; + }, TMP_Set_merge_27.$$arity = 1); + + Opal.def(self, '$replace', TMP_Set_replace_29 = function $$replace(enum$) { + var self = this; + + + self.$clear(); + self.$merge(enum$); + return self; + }, TMP_Set_replace_29.$$arity = 1); + + Opal.def(self, '$size', TMP_Set_size_30 = function $$size() { + var self = this; + + return self.hash.$size() + }, TMP_Set_size_30.$$arity = 0); + Opal.alias(self, "length", "size"); + + Opal.def(self, '$subtract', TMP_Set_subtract_31 = function $$subtract(enum$) { + var TMP_32, self = this; + + + $send(enum$, 'each', [], (TMP_32 = function(item){var self = TMP_32.$$s || this; + + + + if (item == null) { + item = nil; + }; + return self.$delete(item);}, TMP_32.$$s = self, TMP_32.$$arity = 1, TMP_32)); + return self; + }, TMP_Set_subtract_31.$$arity = 1); + + Opal.def(self, '$|', TMP_Set_$_33 = function(enum$) { + var self = this; + + + if ($truthy(enum$['$respond_to?']("each"))) { + } else { + self.$raise($$($nesting, 'ArgumentError'), "value must be enumerable") + }; + return self.$dup().$merge(enum$); + }, TMP_Set_$_33.$$arity = 1); + + Opal.def(self, '$superset?', TMP_Set_superset$q_34 = function(set) { + var $a, TMP_35, self = this; + + + ($truthy($a = set['$is_a?']($$($nesting, 'Set'))) ? $a : self.$raise($$($nesting, 'ArgumentError'), "value must be a set")); + if ($truthy($rb_lt(self.$size(), set.$size()))) { + return false}; + return $send(set, 'all?', [], (TMP_35 = function(o){var self = TMP_35.$$s || this; + + + + if (o == null) { + o = nil; + }; + return self['$include?'](o);}, TMP_35.$$s = self, TMP_35.$$arity = 1, TMP_35)); + }, TMP_Set_superset$q_34.$$arity = 1); + Opal.alias(self, ">=", "superset?"); + + Opal.def(self, '$proper_superset?', TMP_Set_proper_superset$q_36 = function(set) { + var $a, TMP_37, self = this; + + + ($truthy($a = set['$is_a?']($$($nesting, 'Set'))) ? $a : self.$raise($$($nesting, 'ArgumentError'), "value must be a set")); + if ($truthy($rb_le(self.$size(), set.$size()))) { + return false}; + return $send(set, 'all?', [], (TMP_37 = function(o){var self = TMP_37.$$s || this; + + + + if (o == null) { + o = nil; + }; + return self['$include?'](o);}, TMP_37.$$s = self, TMP_37.$$arity = 1, TMP_37)); + }, TMP_Set_proper_superset$q_36.$$arity = 1); + Opal.alias(self, ">", "proper_superset?"); + + Opal.def(self, '$subset?', TMP_Set_subset$q_38 = function(set) { + var $a, TMP_39, self = this; + + + ($truthy($a = set['$is_a?']($$($nesting, 'Set'))) ? $a : self.$raise($$($nesting, 'ArgumentError'), "value must be a set")); + if ($truthy($rb_lt(set.$size(), self.$size()))) { + return false}; + return $send(self, 'all?', [], (TMP_39 = function(o){var self = TMP_39.$$s || this; + + + + if (o == null) { + o = nil; + }; + return set['$include?'](o);}, TMP_39.$$s = self, TMP_39.$$arity = 1, TMP_39)); + }, TMP_Set_subset$q_38.$$arity = 1); + Opal.alias(self, "<=", "subset?"); + + Opal.def(self, '$proper_subset?', TMP_Set_proper_subset$q_40 = function(set) { + var $a, TMP_41, self = this; + + + ($truthy($a = set['$is_a?']($$($nesting, 'Set'))) ? $a : self.$raise($$($nesting, 'ArgumentError'), "value must be a set")); + if ($truthy($rb_le(set.$size(), self.$size()))) { + return false}; + return $send(self, 'all?', [], (TMP_41 = function(o){var self = TMP_41.$$s || this; + + + + if (o == null) { + o = nil; + }; + return set['$include?'](o);}, TMP_41.$$s = self, TMP_41.$$arity = 1, TMP_41)); + }, TMP_Set_proper_subset$q_40.$$arity = 1); + Opal.alias(self, "<", "proper_subset?"); + Opal.alias(self, "+", "|"); + Opal.alias(self, "union", "|"); + return (Opal.def(self, '$to_a', TMP_Set_to_a_42 = function $$to_a() { + var self = this; + + return self.hash.$keys() + }, TMP_Set_to_a_42.$$arity = 0), nil) && 'to_a'; + })($nesting[0], null, $nesting); + return (function($base, $parent_nesting) { + function $Enumerable() {}; + var self = $Enumerable = $module($base, 'Enumerable', $Enumerable); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Enumerable_to_set_43; + + + Opal.def(self, '$to_set', TMP_Enumerable_to_set_43 = function $$to_set($a, $b) { + var $iter = TMP_Enumerable_to_set_43.$$p, block = $iter || nil, $post_args, klass, args, self = this; + + if ($iter) TMP_Enumerable_to_set_43.$$p = null; + + + if ($iter) TMP_Enumerable_to_set_43.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + if ($post_args.length > 0) { + klass = $post_args[0]; + $post_args.splice(0, 1); + } + if (klass == null) { + klass = $$($nesting, 'Set'); + }; + + args = $post_args;; + return $send(klass, 'new', [self].concat(Opal.to_a(args)), block.$to_proc()); + }, TMP_Enumerable_to_set_43.$$arity = -1) + })($nesting[0], $nesting); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/js/opal_ext/file"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $send = Opal.send, $klass = Opal.klass, $truthy = Opal.truthy, $gvars = Opal.gvars; + + Opal.add_stubs(['$new', '$attr_reader', '$delete', '$gsub', '$read', '$size', '$to_enum', '$chomp', '$each_line', '$readlines', '$split']); + + (function($base, $parent_nesting) { + function $Kernel() {}; + var self = $Kernel = $module($base, 'Kernel', $Kernel); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Kernel_open_1; + + + Opal.def(self, '$open', TMP_Kernel_open_1 = function $$open(path, $a) { + var $post_args, rest, $iter = TMP_Kernel_open_1.$$p, $yield = $iter || nil, self = this, file = nil; + + if ($iter) TMP_Kernel_open_1.$$p = null; + + + $post_args = Opal.slice.call(arguments, 1, arguments.length); + + rest = $post_args;; + file = $send($$($nesting, 'File'), 'new', [path].concat(Opal.to_a(rest))); + if (($yield !== nil)) { + return Opal.yield1($yield, file); + } else { + return file + }; + }, TMP_Kernel_open_1.$$arity = -2) + })($nesting[0], $nesting); + (function($base, $super, $parent_nesting) { + function $File(){}; + var self = $File = $klass($base, $super, 'File', $File); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_File_initialize_2, TMP_File_read_3, TMP_File_each_line_4, TMP_File_readlines_5; + + def.eof = def.path = nil; + + self.$attr_reader("eof"); + self.$attr_reader("lineno"); + self.$attr_reader("path"); + + Opal.def(self, '$initialize', TMP_File_initialize_2 = function $$initialize(path, flags) { + var self = this, encoding_flag_regexp = nil; + + + + if (flags == null) { + flags = "r"; + }; + self.path = path; + self.contents = nil; + self.eof = false; + self.lineno = 0; + flags = flags.$delete("b"); + encoding_flag_regexp = /:(.*)/; + flags = flags.$gsub(encoding_flag_regexp, ""); + return (self.flags = flags); + }, TMP_File_initialize_2.$$arity = -2); + + Opal.def(self, '$read', TMP_File_read_3 = function $$read() { + var self = this, res = nil; + + if ($truthy(self.eof)) { + return "" + } else { + + res = $$($nesting, 'File').$read(self.path); + self.eof = true; + self.lineno = res.$size(); + return res; + } + }, TMP_File_read_3.$$arity = 0); + + Opal.def(self, '$each_line', TMP_File_each_line_4 = function $$each_line(separator) { + var $iter = TMP_File_each_line_4.$$p, block = $iter || nil, self = this, lines = nil; + if ($gvars["/"] == null) $gvars["/"] = nil; + + if ($iter) TMP_File_each_line_4.$$p = null; + + + if ($iter) TMP_File_each_line_4.$$p = null;; + + if (separator == null) { + separator = $gvars["/"]; + }; + if ($truthy(self.eof)) { + return (function() {if ((block !== nil)) { + return self + } else { + return [].$to_enum() + }; return nil; })()}; + if ((block !== nil)) { + + lines = $$($nesting, 'File').$read(self.path); + + self.eof = false; + self.lineno = 0; + var chomped = lines.$chomp(), + trailing = lines.length != chomped.length, + splitted = chomped.split(separator); + for (var i = 0, length = splitted.length; i < length; i++) { + self.lineno += 1; + if (i < length - 1 || trailing) { + Opal.yield1(block, splitted[i] + separator); + } + else { + Opal.yield1(block, splitted[i]); + } + } + self.eof = true; + ; + return self; + } else { + return self.$read().$each_line() + }; + }, TMP_File_each_line_4.$$arity = -1); + + Opal.def(self, '$readlines', TMP_File_readlines_5 = function $$readlines() { + var self = this; + + return $$($nesting, 'File').$readlines(self.path) + }, TMP_File_readlines_5.$$arity = 0); + return (function(self, $parent_nesting) { + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_readlines_6, TMP_file$q_7, TMP_readable$q_8, TMP_read_9; + + + + Opal.def(self, '$readlines', TMP_readlines_6 = function $$readlines(path, separator) { + var self = this, content = nil; + if ($gvars["/"] == null) $gvars["/"] = nil; + + + + if (separator == null) { + separator = $gvars["/"]; + }; + content = $$($nesting, 'File').$read(path); + return content.$split(separator); + }, TMP_readlines_6.$$arity = -2); + + Opal.def(self, '$file?', TMP_file$q_7 = function(path) { + var self = this; + + return true + }, TMP_file$q_7.$$arity = 1); + + Opal.def(self, '$readable?', TMP_readable$q_8 = function(path) { + var self = this; + + return true + }, TMP_readable$q_8.$$arity = 1); + return (Opal.def(self, '$read', TMP_read_9 = function $$read(path) { + var self = this; + + return "" + }, TMP_read_9.$$arity = 1), nil) && 'read'; + })(Opal.get_singleton_class(self), $nesting); + })($nesting[0], null, $nesting); + return (function($base, $super, $parent_nesting) { + function $IO(){}; + var self = $IO = $klass($base, $super, 'IO', $IO); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_IO_read_10; + + return (Opal.defs(self, '$read', TMP_IO_read_10 = function $$read(path) { + var self = this; + + return $$($nesting, 'File').$read(path) + }, TMP_IO_read_10.$$arity = 1), nil) && 'read' + })($nesting[0], null, $nesting); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/js/opal_ext/match_data"] = function(Opal) { + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $send = Opal.send; + + Opal.add_stubs(['$[]=', '$-']); + return (function($base, $super, $parent_nesting) { + function $MatchData(){}; + var self = $MatchData = $klass($base, $super, 'MatchData', $MatchData); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_MatchData_$$$eq_1; + + def.matches = nil; + return (Opal.def(self, '$[]=', TMP_MatchData_$$$eq_1 = function(idx, val) { + var self = this, $writer = nil; + + + $writer = [idx, val]; + $send(self.matches, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + }, TMP_MatchData_$$$eq_1.$$arity = 2), nil) && '[]=' + })($nesting[0], null, $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/js/opal_ext/kernel"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module; + + return (function($base, $parent_nesting) { + function $Kernel() {}; + var self = $Kernel = $module($base, 'Kernel', $Kernel); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Kernel_freeze_1; + + + Opal.def(self, '$freeze', TMP_Kernel_freeze_1 = function $$freeze() { + var self = this; + + return self + }, TMP_Kernel_freeze_1.$$arity = 0) + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/js/opal_ext/thread_safe"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass; + + return (function($base, $parent_nesting) { + function $ThreadSafe() {}; + var self = $ThreadSafe = $module($base, 'ThreadSafe', $ThreadSafe); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + (function($base, $super, $parent_nesting) { + function $Cache(){}; + var self = $Cache = $klass($base, $super, 'Cache', $Cache); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return nil + })($nesting[0], $$$('::', 'Hash'), $nesting) + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/js/opal_ext/string"] = function(Opal) { + function $rb_lt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $truthy = Opal.truthy, $send = Opal.send; + + Opal.add_stubs(['$method_defined?', '$<', '$length', '$bytes', '$to_s', '$byteslice', '$==', '$with_index', '$select', '$[]', '$even?', '$_original_unpack']); + return (function($base, $super, $parent_nesting) { + function $String(){}; + var self = $String = $klass($base, $super, 'String', $String); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_String_limit_bytesize_1, TMP_String_unpack_2; + + + if ($truthy(self['$method_defined?']("limit_bytesize"))) { + } else { + + Opal.def(self, '$limit_bytesize', TMP_String_limit_bytesize_1 = function $$limit_bytesize(size) { + var self = this, result = nil; + + + if ($truthy($rb_lt(size, self.$bytes().$length()))) { + } else { + return self.$to_s() + }; + result = self.$byteslice(0, size); + return result.$to_s(); + }, TMP_String_limit_bytesize_1.$$arity = 1) + }; + if ($truthy(self['$method_defined?']("limit"))) { + } else { + Opal.alias(self, "limit", "limit_bytesize") + }; + Opal.alias(self, "_original_unpack", "unpack"); + return (Opal.def(self, '$unpack', TMP_String_unpack_2 = function $$unpack(format) { + var TMP_3, self = this; + + if (format['$==']("C3")) { + return $send(self['$[]'](0, 3).$bytes().$select(), 'with_index', [], (TMP_3 = function(_, i){var self = TMP_3.$$s || this; + + + + if (_ == null) { + _ = nil; + }; + + if (i == null) { + i = nil; + }; + return i['$even?']();}, TMP_3.$$s = self, TMP_3.$$arity = 2, TMP_3)) + } else { + return self.$_original_unpack(format) + } + }, TMP_String_unpack_2.$$arity = 1), nil) && 'unpack'; + })($nesting[0], null, $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/js/opal_ext/uri"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module; + + Opal.add_stubs(['$extend']); + return (function($base, $parent_nesting) { + function $URI() {}; + var self = $URI = $module($base, 'URI', $URI); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_URI_parse_1, TMP_URI_path_2; + + + Opal.defs(self, '$parse', TMP_URI_parse_1 = function $$parse(str) { + var self = this; + + return str.$extend($$($nesting, 'URI')) + }, TMP_URI_parse_1.$$arity = 1); + + Opal.def(self, '$path', TMP_URI_path_2 = function $$path() { + var self = this; + + return self + }, TMP_URI_path_2.$$arity = 0); + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/js/opal_ext"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice; + + Opal.add_stubs(['$require']); + + self.$require("asciidoctor/js/opal_ext/file"); + self.$require("asciidoctor/js/opal_ext/match_data"); + self.$require("asciidoctor/js/opal_ext/kernel"); + self.$require("asciidoctor/js/opal_ext/thread_safe"); + self.$require("asciidoctor/js/opal_ext/string"); + self.$require("asciidoctor/js/opal_ext/uri"); + +// Load specific implementation +self.$require("asciidoctor/js/opal_ext/node"); +; +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/js/rx"] = function(Opal) { + function $rb_plus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $send = Opal.send, $gvars = Opal.gvars, $truthy = Opal.truthy; + + Opal.add_stubs(['$gsub', '$+', '$unpack_hex_range']); + return (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Asciidoctor_unpack_hex_range_1; + + + Opal.const_set($nesting[0], 'HEX_RANGE_RX', /([A-F0-9]{4})(?:-([A-F0-9]{4}))?/); + Opal.defs(self, '$unpack_hex_range', TMP_Asciidoctor_unpack_hex_range_1 = function $$unpack_hex_range(str) { + var TMP_2, self = this; + + return $send(str, 'gsub', [$$($nesting, 'HEX_RANGE_RX')], (TMP_2 = function(){var self = TMP_2.$$s || this, $a, $b; + + return "" + "\\u" + ((($a = $gvars['~']) === nil ? nil : $a['$[]'](1))) + (($truthy($a = (($b = $gvars['~']) === nil ? nil : $b['$[]'](2))) ? "" + "-\\u" + ((($b = $gvars['~']) === nil ? nil : $b['$[]'](2))) : $a))}, TMP_2.$$s = self, TMP_2.$$arity = 0, TMP_2)) + }, TMP_Asciidoctor_unpack_hex_range_1.$$arity = 1); + Opal.const_set($nesting[0], 'P_L', $rb_plus("A-Za-z", self.$unpack_hex_range("00AA00B500BA00C0-00D600D8-00F600F8-02C102C6-02D102E0-02E402EC02EE0370-037403760377037A-037D037F03860388-038A038C038E-03A103A3-03F503F7-0481048A-052F0531-055605590561-058705D0-05EA05F0-05F20620-064A066E066F0671-06D306D506E506E606EE06EF06FA-06FC06FF07100712-072F074D-07A507B107CA-07EA07F407F507FA0800-0815081A082408280840-085808A0-08B20904-0939093D09500958-09610971-09800985-098C098F09900993-09A809AA-09B009B209B6-09B909BD09CE09DC09DD09DF-09E109F009F10A05-0A0A0A0F0A100A13-0A280A2A-0A300A320A330A350A360A380A390A59-0A5C0A5E0A72-0A740A85-0A8D0A8F-0A910A93-0AA80AAA-0AB00AB20AB30AB5-0AB90ABD0AD00AE00AE10B05-0B0C0B0F0B100B13-0B280B2A-0B300B320B330B35-0B390B3D0B5C0B5D0B5F-0B610B710B830B85-0B8A0B8E-0B900B92-0B950B990B9A0B9C0B9E0B9F0BA30BA40BA8-0BAA0BAE-0BB90BD00C05-0C0C0C0E-0C100C12-0C280C2A-0C390C3D0C580C590C600C610C85-0C8C0C8E-0C900C92-0CA80CAA-0CB30CB5-0CB90CBD0CDE0CE00CE10CF10CF20D05-0D0C0D0E-0D100D12-0D3A0D3D0D4E0D600D610D7A-0D7F0D85-0D960D9A-0DB10DB3-0DBB0DBD0DC0-0DC60E01-0E300E320E330E40-0E460E810E820E840E870E880E8A0E8D0E94-0E970E99-0E9F0EA1-0EA30EA50EA70EAA0EAB0EAD-0EB00EB20EB30EBD0EC0-0EC40EC60EDC-0EDF0F000F40-0F470F49-0F6C0F88-0F8C1000-102A103F1050-1055105A-105D106110651066106E-10701075-1081108E10A0-10C510C710CD10D0-10FA10FC-1248124A-124D1250-12561258125A-125D1260-1288128A-128D1290-12B012B2-12B512B8-12BE12C012C2-12C512C8-12D612D8-13101312-13151318-135A1380-138F13A0-13F41401-166C166F-167F1681-169A16A0-16EA16F1-16F81700-170C170E-17111720-17311740-17511760-176C176E-17701780-17B317D717DC1820-18771880-18A818AA18B0-18F51900-191E1950-196D1970-19741980-19AB19C1-19C71A00-1A161A20-1A541AA71B05-1B331B45-1B4B1B83-1BA01BAE1BAF1BBA-1BE51C00-1C231C4D-1C4F1C5A-1C7D1CE9-1CEC1CEE-1CF11CF51CF61D00-1DBF1E00-1F151F18-1F1D1F20-1F451F48-1F4D1F50-1F571F591F5B1F5D1F5F-1F7D1F80-1FB41FB6-1FBC1FBE1FC2-1FC41FC6-1FCC1FD0-1FD31FD6-1FDB1FE0-1FEC1FF2-1FF41FF6-1FFC2071207F2090-209C21022107210A-211321152119-211D212421262128212A-212D212F-2139213C-213F2145-2149214E218321842C00-2C2E2C30-2C5E2C60-2CE42CEB-2CEE2CF22CF32D00-2D252D272D2D2D30-2D672D6F2D80-2D962DA0-2DA62DA8-2DAE2DB0-2DB62DB8-2DBE2DC0-2DC62DC8-2DCE2DD0-2DD62DD8-2DDE2E2F300530063031-3035303B303C3041-3096309D-309F30A1-30FA30FC-30FF3105-312D3131-318E31A0-31BA31F0-31FF3400-4DB54E00-9FCCA000-A48CA4D0-A4FDA500-A60CA610-A61FA62AA62BA640-A66EA67F-A69DA6A0-A6E5A717-A71FA722-A788A78B-A78EA790-A7ADA7B0A7B1A7F7-A801A803-A805A807-A80AA80C-A822A840-A873A882-A8B3A8F2-A8F7A8FBA90A-A925A930-A946A960-A97CA984-A9B2A9CFA9E0-A9E4A9E6-A9EFA9FA-A9FEAA00-AA28AA40-AA42AA44-AA4BAA60-AA76AA7AAA7E-AAAFAAB1AAB5AAB6AAB9-AABDAAC0AAC2AADB-AADDAAE0-AAEAAAF2-AAF4AB01-AB06AB09-AB0EAB11-AB16AB20-AB26AB28-AB2EAB30-AB5AAB5C-AB5FAB64AB65ABC0-ABE2AC00-D7A3D7B0-D7C6D7CB-D7FBF900-FA6DFA70-FAD9FB00-FB06FB13-FB17FB1DFB1F-FB28FB2A-FB36FB38-FB3CFB3EFB40FB41FB43FB44FB46-FBB1FBD3-FD3DFD50-FD8FFD92-FDC7FDF0-FDFBFE70-FE74FE76-FEFCFF21-FF3AFF41-FF5AFF66-FFBEFFC2-FFC7FFCA-FFCFFFD2-FFD7FFDA-FFDC"))); + Opal.const_set($nesting[0], 'P_Nl', self.$unpack_hex_range("16EE-16F02160-21822185-218830073021-30293038-303AA6E6-A6EF")); + Opal.const_set($nesting[0], 'P_Nd', $rb_plus("0-9", self.$unpack_hex_range("0660-066906F0-06F907C0-07C90966-096F09E6-09EF0A66-0A6F0AE6-0AEF0B66-0B6F0BE6-0BEF0C66-0C6F0CE6-0CEF0D66-0D6F0DE6-0DEF0E50-0E590ED0-0ED90F20-0F291040-10491090-109917E0-17E91810-18191946-194F19D0-19D91A80-1A891A90-1A991B50-1B591BB0-1BB91C40-1C491C50-1C59A620-A629A8D0-A8D9A900-A909A9D0-A9D9A9F0-A9F9AA50-AA59ABF0-ABF9FF10-FF19"))); + Opal.const_set($nesting[0], 'P_Pc', self.$unpack_hex_range("005F203F20402054FE33FE34FE4D-FE4FFF3F")); + Opal.const_set($nesting[0], 'CC_ALPHA', "" + ($$($nesting, 'P_L')) + ($$($nesting, 'P_Nl'))); + Opal.const_set($nesting[0], 'CG_ALPHA', "" + "[" + ($$($nesting, 'CC_ALPHA')) + "]"); + Opal.const_set($nesting[0], 'CC_ALNUM', "" + ($$($nesting, 'CC_ALPHA')) + ($$($nesting, 'P_Nd'))); + Opal.const_set($nesting[0], 'CG_ALNUM', "" + "[" + ($$($nesting, 'CC_ALNUM')) + "]"); + Opal.const_set($nesting[0], 'CC_WORD', "" + ($$($nesting, 'CC_ALNUM')) + ($$($nesting, 'P_Pc'))); + Opal.const_set($nesting[0], 'CG_WORD', "" + "[" + ($$($nesting, 'CC_WORD')) + "]"); + Opal.const_set($nesting[0], 'CG_BLANK', "[ \\t]"); + Opal.const_set($nesting[0], 'CC_EOL', "(?=\\n|$)"); + Opal.const_set($nesting[0], 'CG_GRAPH', "[^\\s\\x00-\\x1F\\x7F]"); + Opal.const_set($nesting[0], 'CC_ALL', "[\\s\\S]"); + Opal.const_set($nesting[0], 'CC_ANY', "[^\\n]"); + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["strscan"] = function(Opal) { + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $send = Opal.send; + + Opal.add_stubs(['$attr_reader', '$anchor', '$scan_until', '$length', '$size', '$rest', '$pos=', '$-', '$private']); + return (function($base, $super, $parent_nesting) { + function $StringScanner(){}; + var self = $StringScanner = $klass($base, $super, 'StringScanner', $StringScanner); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_StringScanner_initialize_1, TMP_StringScanner_beginning_of_line$q_2, TMP_StringScanner_scan_3, TMP_StringScanner_scan_until_4, TMP_StringScanner_$$_5, TMP_StringScanner_check_6, TMP_StringScanner_check_until_7, TMP_StringScanner_peek_8, TMP_StringScanner_eos$q_9, TMP_StringScanner_exist$q_10, TMP_StringScanner_skip_11, TMP_StringScanner_skip_until_12, TMP_StringScanner_get_byte_13, TMP_StringScanner_match$q_14, TMP_StringScanner_pos$eq_15, TMP_StringScanner_matched_size_16, TMP_StringScanner_post_match_17, TMP_StringScanner_pre_match_18, TMP_StringScanner_reset_19, TMP_StringScanner_rest_20, TMP_StringScanner_rest$q_21, TMP_StringScanner_rest_size_22, TMP_StringScanner_terminate_23, TMP_StringScanner_unscan_24, TMP_StringScanner_anchor_25; + + def.pos = def.string = def.working = def.matched = def.prev_pos = def.match = nil; + + self.$attr_reader("pos"); + self.$attr_reader("matched"); + + Opal.def(self, '$initialize', TMP_StringScanner_initialize_1 = function $$initialize(string) { + var self = this; + + + self.string = string; + self.pos = 0; + self.matched = nil; + self.working = string; + return (self.match = []); + }, TMP_StringScanner_initialize_1.$$arity = 1); + self.$attr_reader("string"); + + Opal.def(self, '$beginning_of_line?', TMP_StringScanner_beginning_of_line$q_2 = function() { + var self = this; + + return self.pos === 0 || self.string.charAt(self.pos - 1) === "\n" + }, TMP_StringScanner_beginning_of_line$q_2.$$arity = 0); + Opal.alias(self, "bol?", "beginning_of_line?"); + + Opal.def(self, '$scan', TMP_StringScanner_scan_3 = function $$scan(pattern) { + var self = this; + + + pattern = self.$anchor(pattern); + + var result = pattern.exec(self.working); + + if (result == null) { + return self.matched = nil; + } + else if (typeof(result) === 'object') { + self.prev_pos = self.pos; + self.pos += result[0].length; + self.working = self.working.substring(result[0].length); + self.matched = result[0]; + self.match = result; + + return result[0]; + } + else if (typeof(result) === 'string') { + self.pos += result.length; + self.working = self.working.substring(result.length); + + return result; + } + else { + return nil; + } + ; + }, TMP_StringScanner_scan_3.$$arity = 1); + + Opal.def(self, '$scan_until', TMP_StringScanner_scan_until_4 = function $$scan_until(pattern) { + var self = this; + + + pattern = self.$anchor(pattern); + + var pos = self.pos, + working = self.working, + result; + + while (true) { + result = pattern.exec(working); + pos += 1; + working = working.substr(1); + + if (result == null) { + if (working.length === 0) { + return self.matched = nil; + } + + continue; + } + + self.matched = self.string.substr(self.pos, pos - self.pos - 1 + result[0].length); + self.prev_pos = pos - 1; + self.pos = pos; + self.working = working.substr(result[0].length); + + return self.matched; + } + ; + }, TMP_StringScanner_scan_until_4.$$arity = 1); + + Opal.def(self, '$[]', TMP_StringScanner_$$_5 = function(idx) { + var self = this; + + + var match = self.match; + + if (idx < 0) { + idx += match.length; + } + + if (idx < 0 || idx >= match.length) { + return nil; + } + + if (match[idx] == null) { + return nil; + } + + return match[idx]; + + }, TMP_StringScanner_$$_5.$$arity = 1); + + Opal.def(self, '$check', TMP_StringScanner_check_6 = function $$check(pattern) { + var self = this; + + + pattern = self.$anchor(pattern); + + var result = pattern.exec(self.working); + + if (result == null) { + return self.matched = nil; + } + + return self.matched = result[0]; + ; + }, TMP_StringScanner_check_6.$$arity = 1); + + Opal.def(self, '$check_until', TMP_StringScanner_check_until_7 = function $$check_until(pattern) { + var self = this; + + + var prev_pos = self.prev_pos, + pos = self.pos; + + var result = self.$scan_until(pattern); + + if (result !== nil) { + self.matched = result.substr(-1); + self.working = self.string.substr(pos); + } + + self.prev_pos = prev_pos; + self.pos = pos; + + return result; + + }, TMP_StringScanner_check_until_7.$$arity = 1); + + Opal.def(self, '$peek', TMP_StringScanner_peek_8 = function $$peek(length) { + var self = this; + + return self.working.substring(0, length) + }, TMP_StringScanner_peek_8.$$arity = 1); + + Opal.def(self, '$eos?', TMP_StringScanner_eos$q_9 = function() { + var self = this; + + return self.working.length === 0 + }, TMP_StringScanner_eos$q_9.$$arity = 0); + + Opal.def(self, '$exist?', TMP_StringScanner_exist$q_10 = function(pattern) { + var self = this; + + + var result = pattern.exec(self.working); + + if (result == null) { + return nil; + } + else if (result.index == 0) { + return 0; + } + else { + return result.index + 1; + } + + }, TMP_StringScanner_exist$q_10.$$arity = 1); + + Opal.def(self, '$skip', TMP_StringScanner_skip_11 = function $$skip(pattern) { + var self = this; + + + pattern = self.$anchor(pattern); + + var result = pattern.exec(self.working); + + if (result == null) { + return self.matched = nil; + } + else { + var match_str = result[0]; + var match_len = match_str.length; + + self.matched = match_str; + self.prev_pos = self.pos; + self.pos += match_len; + self.working = self.working.substring(match_len); + + return match_len; + } + ; + }, TMP_StringScanner_skip_11.$$arity = 1); + + Opal.def(self, '$skip_until', TMP_StringScanner_skip_until_12 = function $$skip_until(pattern) { + var self = this; + + + var result = self.$scan_until(pattern); + + if (result === nil) { + return nil; + } + else { + self.matched = result.substr(-1); + + return result.length; + } + + }, TMP_StringScanner_skip_until_12.$$arity = 1); + + Opal.def(self, '$get_byte', TMP_StringScanner_get_byte_13 = function $$get_byte() { + var self = this; + + + var result = nil; + + if (self.pos < self.string.length) { + self.prev_pos = self.pos; + self.pos += 1; + result = self.matched = self.working.substring(0, 1); + self.working = self.working.substring(1); + } + else { + self.matched = nil; + } + + return result; + + }, TMP_StringScanner_get_byte_13.$$arity = 0); + Opal.alias(self, "getch", "get_byte"); + + Opal.def(self, '$match?', TMP_StringScanner_match$q_14 = function(pattern) { + var self = this; + + + pattern = self.$anchor(pattern); + + var result = pattern.exec(self.working); + + if (result == null) { + return nil; + } + else { + self.prev_pos = self.pos; + + return result[0].length; + } + ; + }, TMP_StringScanner_match$q_14.$$arity = 1); + + Opal.def(self, '$pos=', TMP_StringScanner_pos$eq_15 = function(pos) { + var self = this; + + + + if (pos < 0) { + pos += self.string.$length(); + } + ; + self.pos = pos; + return (self.working = self.string.slice(pos)); + }, TMP_StringScanner_pos$eq_15.$$arity = 1); + + Opal.def(self, '$matched_size', TMP_StringScanner_matched_size_16 = function $$matched_size() { + var self = this; + + + if (self.matched === nil) { + return nil; + } + + return self.matched.length + + }, TMP_StringScanner_matched_size_16.$$arity = 0); + + Opal.def(self, '$post_match', TMP_StringScanner_post_match_17 = function $$post_match() { + var self = this; + + + if (self.matched === nil) { + return nil; + } + + return self.string.substr(self.pos); + + }, TMP_StringScanner_post_match_17.$$arity = 0); + + Opal.def(self, '$pre_match', TMP_StringScanner_pre_match_18 = function $$pre_match() { + var self = this; + + + if (self.matched === nil) { + return nil; + } + + return self.string.substr(0, self.prev_pos); + + }, TMP_StringScanner_pre_match_18.$$arity = 0); + + Opal.def(self, '$reset', TMP_StringScanner_reset_19 = function $$reset() { + var self = this; + + + self.working = self.string; + self.matched = nil; + return (self.pos = 0); + }, TMP_StringScanner_reset_19.$$arity = 0); + + Opal.def(self, '$rest', TMP_StringScanner_rest_20 = function $$rest() { + var self = this; + + return self.working + }, TMP_StringScanner_rest_20.$$arity = 0); + + Opal.def(self, '$rest?', TMP_StringScanner_rest$q_21 = function() { + var self = this; + + return self.working.length !== 0 + }, TMP_StringScanner_rest$q_21.$$arity = 0); + + Opal.def(self, '$rest_size', TMP_StringScanner_rest_size_22 = function $$rest_size() { + var self = this; + + return self.$rest().$size() + }, TMP_StringScanner_rest_size_22.$$arity = 0); + + Opal.def(self, '$terminate', TMP_StringScanner_terminate_23 = function $$terminate() { + var self = this, $writer = nil; + + + self.match = nil; + + $writer = [self.string.$length()]; + $send(self, 'pos=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];; + }, TMP_StringScanner_terminate_23.$$arity = 0); + + Opal.def(self, '$unscan', TMP_StringScanner_unscan_24 = function $$unscan() { + var self = this; + + + self.pos = self.prev_pos; + self.prev_pos = nil; + self.match = nil; + return self; + }, TMP_StringScanner_unscan_24.$$arity = 0); + self.$private(); + return (Opal.def(self, '$anchor', TMP_StringScanner_anchor_25 = function $$anchor(pattern) { + var self = this; + + + var flags = pattern.toString().match(/\/([^\/]+)$/); + flags = flags ? flags[1] : undefined; + return new RegExp('^(?:' + pattern.source + ')', flags); + + }, TMP_StringScanner_anchor_25.$$arity = 1), nil) && 'anchor'; + })($nesting[0], null, $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/js"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice; + + Opal.add_stubs(['$require']); + + self.$require("asciidoctor/js/opal_ext"); + self.$require("asciidoctor/js/rx"); + return self.$require("strscan"); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["logger"] = function(Opal) { + function $rb_plus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); + } + function $rb_le(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs <= rhs : lhs['$<='](rhs); + } + function $rb_lt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $module = Opal.module, $send = Opal.send, $truthy = Opal.truthy; + + Opal.add_stubs(['$include', '$to_h', '$map', '$constants', '$const_get', '$to_s', '$format', '$chr', '$strftime', '$message_as_string', '$===', '$+', '$message', '$class', '$join', '$backtrace', '$inspect', '$attr_reader', '$attr_accessor', '$new', '$key', '$upcase', '$raise', '$add', '$to_proc', '$<=', '$<', '$write', '$call', '$[]', '$now']); + return (function($base, $super, $parent_nesting) { + function $Logger(){}; + var self = $Logger = $klass($base, $super, 'Logger', $Logger); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Logger_1, TMP_Logger_initialize_4, TMP_Logger_level$eq_5, TMP_Logger_info_6, TMP_Logger_debug_7, TMP_Logger_warn_8, TMP_Logger_error_9, TMP_Logger_fatal_10, TMP_Logger_unknown_11, TMP_Logger_info$q_12, TMP_Logger_debug$q_13, TMP_Logger_warn$q_14, TMP_Logger_error$q_15, TMP_Logger_fatal$q_16, TMP_Logger_add_17; + + def.level = def.progname = def.pipe = def.formatter = nil; + + (function($base, $parent_nesting) { + function $Severity() {}; + var self = $Severity = $module($base, 'Severity', $Severity); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + + Opal.const_set($nesting[0], 'DEBUG', 0); + Opal.const_set($nesting[0], 'INFO', 1); + Opal.const_set($nesting[0], 'WARN', 2); + Opal.const_set($nesting[0], 'ERROR', 3); + Opal.const_set($nesting[0], 'FATAL', 4); + Opal.const_set($nesting[0], 'UNKNOWN', 5); + })($nesting[0], $nesting); + self.$include($$($nesting, 'Severity')); + Opal.const_set($nesting[0], 'SEVERITY_LABELS', $send($$($nesting, 'Severity').$constants(), 'map', [], (TMP_Logger_1 = function(s){var self = TMP_Logger_1.$$s || this; + + + + if (s == null) { + s = nil; + }; + return [$$($nesting, 'Severity').$const_get(s), s.$to_s()];}, TMP_Logger_1.$$s = self, TMP_Logger_1.$$arity = 1, TMP_Logger_1)).$to_h()); + (function($base, $super, $parent_nesting) { + function $Formatter(){}; + var self = $Formatter = $klass($base, $super, 'Formatter', $Formatter); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Formatter_call_2, TMP_Formatter_message_as_string_3; + + + Opal.const_set($nesting[0], 'MESSAGE_FORMAT', "%s, [%s] %5s -- %s: %s\n"); + Opal.const_set($nesting[0], 'DATE_TIME_FORMAT', "%Y-%m-%dT%H:%M:%S.%6N"); + + Opal.def(self, '$call', TMP_Formatter_call_2 = function $$call(severity, time, progname, msg) { + var self = this; + + return self.$format($$($nesting, 'MESSAGE_FORMAT'), severity.$chr(), time.$strftime($$($nesting, 'DATE_TIME_FORMAT')), severity, progname, self.$message_as_string(msg)) + }, TMP_Formatter_call_2.$$arity = 4); + return (Opal.def(self, '$message_as_string', TMP_Formatter_message_as_string_3 = function $$message_as_string(msg) { + var $a, self = this, $case = nil; + + return (function() {$case = msg; + if ($$$('::', 'String')['$===']($case)) {return msg} + else if ($$$('::', 'Exception')['$===']($case)) {return $rb_plus("" + (msg.$message()) + " (" + (msg.$class()) + ")\n", ($truthy($a = msg.$backtrace()) ? $a : []).$join("\n"))} + else {return msg.$inspect()}})() + }, TMP_Formatter_message_as_string_3.$$arity = 1), nil) && 'message_as_string'; + })($nesting[0], null, $nesting); + self.$attr_reader("level"); + self.$attr_accessor("progname"); + self.$attr_accessor("formatter"); + + Opal.def(self, '$initialize', TMP_Logger_initialize_4 = function $$initialize(pipe) { + var self = this; + + + self.pipe = pipe; + self.level = $$($nesting, 'DEBUG'); + return (self.formatter = $$($nesting, 'Formatter').$new()); + }, TMP_Logger_initialize_4.$$arity = 1); + + Opal.def(self, '$level=', TMP_Logger_level$eq_5 = function(severity) { + var self = this, level = nil; + + if ($truthy($$$('::', 'Integer')['$==='](severity))) { + return (self.level = severity) + } else if ($truthy((level = $$($nesting, 'SEVERITY_LABELS').$key(severity.$to_s().$upcase())))) { + return (self.level = level) + } else { + return self.$raise($$($nesting, 'ArgumentError'), "" + "invalid log level: " + (severity)) + } + }, TMP_Logger_level$eq_5.$$arity = 1); + + Opal.def(self, '$info', TMP_Logger_info_6 = function $$info(progname) { + var $iter = TMP_Logger_info_6.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Logger_info_6.$$p = null; + + + if ($iter) TMP_Logger_info_6.$$p = null;; + + if (progname == null) { + progname = nil; + }; + return $send(self, 'add', [$$($nesting, 'INFO'), nil, progname], block.$to_proc()); + }, TMP_Logger_info_6.$$arity = -1); + + Opal.def(self, '$debug', TMP_Logger_debug_7 = function $$debug(progname) { + var $iter = TMP_Logger_debug_7.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Logger_debug_7.$$p = null; + + + if ($iter) TMP_Logger_debug_7.$$p = null;; + + if (progname == null) { + progname = nil; + }; + return $send(self, 'add', [$$($nesting, 'DEBUG'), nil, progname], block.$to_proc()); + }, TMP_Logger_debug_7.$$arity = -1); + + Opal.def(self, '$warn', TMP_Logger_warn_8 = function $$warn(progname) { + var $iter = TMP_Logger_warn_8.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Logger_warn_8.$$p = null; + + + if ($iter) TMP_Logger_warn_8.$$p = null;; + + if (progname == null) { + progname = nil; + }; + return $send(self, 'add', [$$($nesting, 'WARN'), nil, progname], block.$to_proc()); + }, TMP_Logger_warn_8.$$arity = -1); + + Opal.def(self, '$error', TMP_Logger_error_9 = function $$error(progname) { + var $iter = TMP_Logger_error_9.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Logger_error_9.$$p = null; + + + if ($iter) TMP_Logger_error_9.$$p = null;; + + if (progname == null) { + progname = nil; + }; + return $send(self, 'add', [$$($nesting, 'ERROR'), nil, progname], block.$to_proc()); + }, TMP_Logger_error_9.$$arity = -1); + + Opal.def(self, '$fatal', TMP_Logger_fatal_10 = function $$fatal(progname) { + var $iter = TMP_Logger_fatal_10.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Logger_fatal_10.$$p = null; + + + if ($iter) TMP_Logger_fatal_10.$$p = null;; + + if (progname == null) { + progname = nil; + }; + return $send(self, 'add', [$$($nesting, 'FATAL'), nil, progname], block.$to_proc()); + }, TMP_Logger_fatal_10.$$arity = -1); + + Opal.def(self, '$unknown', TMP_Logger_unknown_11 = function $$unknown(progname) { + var $iter = TMP_Logger_unknown_11.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Logger_unknown_11.$$p = null; + + + if ($iter) TMP_Logger_unknown_11.$$p = null;; + + if (progname == null) { + progname = nil; + }; + return $send(self, 'add', [$$($nesting, 'UNKNOWN'), nil, progname], block.$to_proc()); + }, TMP_Logger_unknown_11.$$arity = -1); + + Opal.def(self, '$info?', TMP_Logger_info$q_12 = function() { + var self = this; + + return $rb_le(self.level, $$($nesting, 'INFO')) + }, TMP_Logger_info$q_12.$$arity = 0); + + Opal.def(self, '$debug?', TMP_Logger_debug$q_13 = function() { + var self = this; + + return $rb_le(self.level, $$($nesting, 'DEBUG')) + }, TMP_Logger_debug$q_13.$$arity = 0); + + Opal.def(self, '$warn?', TMP_Logger_warn$q_14 = function() { + var self = this; + + return $rb_le(self.level, $$($nesting, 'WARN')) + }, TMP_Logger_warn$q_14.$$arity = 0); + + Opal.def(self, '$error?', TMP_Logger_error$q_15 = function() { + var self = this; + + return $rb_le(self.level, $$($nesting, 'ERROR')) + }, TMP_Logger_error$q_15.$$arity = 0); + + Opal.def(self, '$fatal?', TMP_Logger_fatal$q_16 = function() { + var self = this; + + return $rb_le(self.level, $$($nesting, 'FATAL')) + }, TMP_Logger_fatal$q_16.$$arity = 0); + return (Opal.def(self, '$add', TMP_Logger_add_17 = function $$add(severity, message, progname) { + var $iter = TMP_Logger_add_17.$$p, block = $iter || nil, $a, self = this; + + if ($iter) TMP_Logger_add_17.$$p = null; + + + if ($iter) TMP_Logger_add_17.$$p = null;; + + if (message == null) { + message = nil; + }; + + if (progname == null) { + progname = nil; + }; + if ($truthy($rb_lt((severity = ($truthy($a = severity) ? $a : $$($nesting, 'UNKNOWN'))), self.level))) { + return true}; + progname = ($truthy($a = progname) ? $a : self.progname); + if ($truthy(message)) { + } else if ((block !== nil)) { + message = Opal.yieldX(block, []) + } else { + + message = progname; + progname = self.progname; + }; + self.pipe.$write(self.formatter.$call(($truthy($a = $$($nesting, 'SEVERITY_LABELS')['$[]'](severity)) ? $a : "ANY"), $$$('::', 'Time').$now(), progname, message)); + return true; + }, TMP_Logger_add_17.$$arity = -2), nil) && 'add'; + })($nesting[0], null, $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/logging"] = function(Opal) { + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + function $rb_gt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $send = Opal.send, $truthy = Opal.truthy, $hash2 = Opal.hash2, $gvars = Opal.gvars; + + Opal.add_stubs(['$require', '$attr_reader', '$progname=', '$-', '$new', '$formatter=', '$level=', '$>', '$[]', '$===', '$inspect', '$map', '$constants', '$const_get', '$to_sym', '$<<', '$clear', '$empty?', '$max', '$attr_accessor', '$memoize_logger', '$private', '$alias_method', '$==', '$define_method', '$extend', '$logger', '$merge']); + + self.$require("logger"); + return (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + + (function($base, $super, $parent_nesting) { + function $Logger(){}; + var self = $Logger = $klass($base, $super, 'Logger', $Logger); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Logger_initialize_1, TMP_Logger_add_2; + + def.max_severity = nil; + + self.$attr_reader("max_severity"); + + Opal.def(self, '$initialize', TMP_Logger_initialize_1 = function $$initialize($a) { + var $post_args, args, $iter = TMP_Logger_initialize_1.$$p, $yield = $iter || nil, self = this, $writer = nil, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_Logger_initialize_1.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + $send(self, Opal.find_super_dispatcher(self, 'initialize', TMP_Logger_initialize_1, false), $zuper, $iter); + + $writer = ["asciidoctor"]; + $send(self, 'progname=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = [$$($nesting, 'BasicFormatter').$new()]; + $send(self, 'formatter=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = [$$($nesting, 'WARN')]; + $send(self, 'level=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];; + }, TMP_Logger_initialize_1.$$arity = -1); + + Opal.def(self, '$add', TMP_Logger_add_2 = function $$add(severity, message, progname) { + var $a, $iter = TMP_Logger_add_2.$$p, $yield = $iter || nil, self = this, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_Logger_add_2.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + + + if (message == null) { + message = nil; + }; + + if (progname == null) { + progname = nil; + }; + if ($truthy($rb_gt((severity = ($truthy($a = severity) ? $a : $$($nesting, 'UNKNOWN'))), (self.max_severity = ($truthy($a = self.max_severity) ? $a : severity))))) { + self.max_severity = severity}; + return $send(self, Opal.find_super_dispatcher(self, 'add', TMP_Logger_add_2, false), $zuper, $iter); + }, TMP_Logger_add_2.$$arity = -2); + (function($base, $super, $parent_nesting) { + function $BasicFormatter(){}; + var self = $BasicFormatter = $klass($base, $super, 'BasicFormatter', $BasicFormatter); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_BasicFormatter_call_3; + + + Opal.const_set($nesting[0], 'SEVERITY_LABELS', $hash2(["WARN", "FATAL"], {"WARN": "WARNING", "FATAL": "FAILED"})); + return (Opal.def(self, '$call', TMP_BasicFormatter_call_3 = function $$call(severity, _, progname, msg) { + var $a, self = this; + + return "" + (progname) + ": " + (($truthy($a = $$($nesting, 'SEVERITY_LABELS')['$[]'](severity)) ? $a : severity)) + ": " + ((function() {if ($truthy($$$('::', 'String')['$==='](msg))) { + return msg + } else { + return msg.$inspect() + }; return nil; })()) + "\n" + }, TMP_BasicFormatter_call_3.$$arity = 4), nil) && 'call'; + })($nesting[0], $$($nesting, 'Formatter'), $nesting); + return (function($base, $parent_nesting) { + function $AutoFormattingMessage() {}; + var self = $AutoFormattingMessage = $module($base, 'AutoFormattingMessage', $AutoFormattingMessage); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_AutoFormattingMessage_inspect_4; + + + Opal.def(self, '$inspect', TMP_AutoFormattingMessage_inspect_4 = function $$inspect() { + var self = this, sloc = nil; + + if ($truthy((sloc = self['$[]']("source_location")))) { + return "" + (sloc) + ": " + (self['$[]']("text")) + } else { + return self['$[]']("text") + } + }, TMP_AutoFormattingMessage_inspect_4.$$arity = 0) + })($nesting[0], $nesting); + })($nesting[0], $$$('::', 'Logger'), $nesting); + (function($base, $super, $parent_nesting) { + function $MemoryLogger(){}; + var self = $MemoryLogger = $klass($base, $super, 'MemoryLogger', $MemoryLogger); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_MemoryLogger_5, TMP_MemoryLogger_initialize_6, TMP_MemoryLogger_add_7, TMP_MemoryLogger_clear_8, TMP_MemoryLogger_empty$q_9, TMP_MemoryLogger_max_severity_10; + + def.messages = nil; + + Opal.const_set($nesting[0], 'SEVERITY_LABELS', $$$('::', 'Hash')['$[]']($send($$($nesting, 'Severity').$constants(), 'map', [], (TMP_MemoryLogger_5 = function(c){var self = TMP_MemoryLogger_5.$$s || this; + + + + if (c == null) { + c = nil; + }; + return [$$($nesting, 'Severity').$const_get(c), c.$to_sym()];}, TMP_MemoryLogger_5.$$s = self, TMP_MemoryLogger_5.$$arity = 1, TMP_MemoryLogger_5)))); + self.$attr_reader("messages"); + + Opal.def(self, '$initialize', TMP_MemoryLogger_initialize_6 = function $$initialize() { + var self = this, $writer = nil; + + + + $writer = [$$($nesting, 'WARN')]; + $send(self, 'level=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + return (self.messages = []); + }, TMP_MemoryLogger_initialize_6.$$arity = 0); + + Opal.def(self, '$add', TMP_MemoryLogger_add_7 = function $$add(severity, message, progname) { + var $a, $iter = TMP_MemoryLogger_add_7.$$p, $yield = $iter || nil, self = this; + + if ($iter) TMP_MemoryLogger_add_7.$$p = null; + + + if (message == null) { + message = nil; + }; + + if (progname == null) { + progname = nil; + }; + if ($truthy(message)) { + } else { + message = (function() {if (($yield !== nil)) { + return Opal.yieldX($yield, []); + } else { + return progname + }; return nil; })() + }; + self.messages['$<<']($hash2(["severity", "message"], {"severity": $$($nesting, 'SEVERITY_LABELS')['$[]'](($truthy($a = severity) ? $a : $$($nesting, 'UNKNOWN'))), "message": message})); + return true; + }, TMP_MemoryLogger_add_7.$$arity = -2); + + Opal.def(self, '$clear', TMP_MemoryLogger_clear_8 = function $$clear() { + var self = this; + + return self.messages.$clear() + }, TMP_MemoryLogger_clear_8.$$arity = 0); + + Opal.def(self, '$empty?', TMP_MemoryLogger_empty$q_9 = function() { + var self = this; + + return self.messages['$empty?']() + }, TMP_MemoryLogger_empty$q_9.$$arity = 0); + return (Opal.def(self, '$max_severity', TMP_MemoryLogger_max_severity_10 = function $$max_severity() { + var TMP_11, self = this; + + if ($truthy(self['$empty?']())) { + return nil + } else { + return $send(self.messages, 'map', [], (TMP_11 = function(m){var self = TMP_11.$$s || this; + + + + if (m == null) { + m = nil; + }; + return $$($nesting, 'Severity').$const_get(m['$[]']("severity"));}, TMP_11.$$s = self, TMP_11.$$arity = 1, TMP_11)).$max() + } + }, TMP_MemoryLogger_max_severity_10.$$arity = 0), nil) && 'max_severity'; + })($nesting[0], $$$('::', 'Logger'), $nesting); + (function($base, $super, $parent_nesting) { + function $NullLogger(){}; + var self = $NullLogger = $klass($base, $super, 'NullLogger', $NullLogger); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_NullLogger_initialize_12, TMP_NullLogger_add_13; + + def.max_severity = nil; + + self.$attr_reader("max_severity"); + + Opal.def(self, '$initialize', TMP_NullLogger_initialize_12 = function $$initialize() { + var self = this; + + return nil + }, TMP_NullLogger_initialize_12.$$arity = 0); + return (Opal.def(self, '$add', TMP_NullLogger_add_13 = function $$add(severity, message, progname) { + var $a, self = this; + + + + if (message == null) { + message = nil; + }; + + if (progname == null) { + progname = nil; + }; + if ($truthy($rb_gt((severity = ($truthy($a = severity) ? $a : $$($nesting, 'UNKNOWN'))), (self.max_severity = ($truthy($a = self.max_severity) ? $a : severity))))) { + self.max_severity = severity}; + return true; + }, TMP_NullLogger_add_13.$$arity = -2), nil) && 'add'; + })($nesting[0], $$$('::', 'Logger'), $nesting); + (function($base, $parent_nesting) { + function $LoggerManager() {}; + var self = $LoggerManager = $module($base, 'LoggerManager', $LoggerManager); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + + self.logger_class = $$($nesting, 'Logger'); + (function(self, $parent_nesting) { + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_logger_14, TMP_logger$eq_15, TMP_memoize_logger_16; + + + self.$attr_accessor("logger_class"); + + Opal.def(self, '$logger', TMP_logger_14 = function $$logger(pipe) { + var $a, self = this; + if (self.logger == null) self.logger = nil; + if (self.logger_class == null) self.logger_class = nil; + if ($gvars.stderr == null) $gvars.stderr = nil; + + + + if (pipe == null) { + pipe = $gvars.stderr; + }; + self.$memoize_logger(); + return (self.logger = ($truthy($a = self.logger) ? $a : self.logger_class.$new(pipe))); + }, TMP_logger_14.$$arity = -1); + + Opal.def(self, '$logger=', TMP_logger$eq_15 = function(logger) { + var $a, self = this; + if (self.logger_class == null) self.logger_class = nil; + if ($gvars.stderr == null) $gvars.stderr = nil; + + return (self.logger = ($truthy($a = logger) ? $a : self.logger_class.$new($gvars.stderr))) + }, TMP_logger$eq_15.$$arity = 1); + self.$private(); + return (Opal.def(self, '$memoize_logger', TMP_memoize_logger_16 = function $$memoize_logger() { + var self = this; + + return (function(self, $parent_nesting) { + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_17; + + + self.$alias_method("logger", "logger"); + if ($$($nesting, 'RUBY_ENGINE')['$==']("opal")) { + return $send(self, 'define_method', ["logger"], (TMP_17 = function(){var self = TMP_17.$$s || this; + if (self.logger == null) self.logger = nil; + + return self.logger}, TMP_17.$$s = self, TMP_17.$$arity = 0, TMP_17)) + } else { + return nil + }; + })(Opal.get_singleton_class(self), $nesting) + }, TMP_memoize_logger_16.$$arity = 0), nil) && 'memoize_logger'; + })(Opal.get_singleton_class(self), $nesting); + })($nesting[0], $nesting); + (function($base, $parent_nesting) { + function $Logging() {}; + var self = $Logging = $module($base, 'Logging', $Logging); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Logging_included_18, TMP_Logging_logger_19, TMP_Logging_message_with_context_20; + + + Opal.defs(self, '$included', TMP_Logging_included_18 = function $$included(into) { + var self = this; + + return into.$extend($$($nesting, 'Logging')) + }, TMP_Logging_included_18.$$arity = 1); + self.$private(); + + Opal.def(self, '$logger', TMP_Logging_logger_19 = function $$logger() { + var self = this; + + return $$($nesting, 'LoggerManager').$logger() + }, TMP_Logging_logger_19.$$arity = 0); + + Opal.def(self, '$message_with_context', TMP_Logging_message_with_context_20 = function $$message_with_context(text, context) { + var self = this; + + + + if (context == null) { + context = $hash2([], {}); + }; + return $hash2(["text"], {"text": text}).$merge(context).$extend($$$($$($nesting, 'Logger'), 'AutoFormattingMessage')); + }, TMP_Logging_message_with_context_20.$$arity = -2); + })($nesting[0], $nesting); + })($nesting[0], $nesting); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/timings"] = function(Opal) { + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + function $rb_plus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); + } + function $rb_gt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $hash2 = Opal.hash2, $send = Opal.send, $truthy = Opal.truthy, $gvars = Opal.gvars; + + Opal.add_stubs(['$now', '$[]=', '$-', '$delete', '$reduce', '$+', '$[]', '$>', '$time', '$puts', '$%', '$to_f', '$read_parse', '$convert', '$read_parse_convert', '$const_defined?', '$respond_to?', '$clock_gettime']); + return (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + (function($base, $super, $parent_nesting) { + function $Timings(){}; + var self = $Timings = $klass($base, $super, 'Timings', $Timings); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Timings_initialize_1, TMP_Timings_start_2, TMP_Timings_record_3, TMP_Timings_time_4, TMP_Timings_read_6, TMP_Timings_parse_7, TMP_Timings_read_parse_8, TMP_Timings_convert_9, TMP_Timings_read_parse_convert_10, TMP_Timings_write_11, TMP_Timings_total_12, TMP_Timings_print_report_13, $a, TMP_Timings_now_14, TMP_Timings_now_15; + + def.timers = def.log = nil; + + + Opal.def(self, '$initialize', TMP_Timings_initialize_1 = function $$initialize() { + var self = this; + + + self.log = $hash2([], {}); + return (self.timers = $hash2([], {})); + }, TMP_Timings_initialize_1.$$arity = 0); + + Opal.def(self, '$start', TMP_Timings_start_2 = function $$start(key) { + var self = this, $writer = nil; + + + $writer = [key, self.$now()]; + $send(self.timers, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + }, TMP_Timings_start_2.$$arity = 1); + + Opal.def(self, '$record', TMP_Timings_record_3 = function $$record(key) { + var self = this, $writer = nil; + + + $writer = [key, $rb_minus(self.$now(), self.timers.$delete(key))]; + $send(self.log, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + }, TMP_Timings_record_3.$$arity = 1); + + Opal.def(self, '$time', TMP_Timings_time_4 = function $$time($a) { + var $post_args, keys, TMP_5, self = this, time = nil; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + keys = $post_args;; + time = $send(keys, 'reduce', [0], (TMP_5 = function(sum, key){var self = TMP_5.$$s || this, $b; + if (self.log == null) self.log = nil; + + + + if (sum == null) { + sum = nil; + }; + + if (key == null) { + key = nil; + }; + return $rb_plus(sum, ($truthy($b = self.log['$[]'](key)) ? $b : 0));}, TMP_5.$$s = self, TMP_5.$$arity = 2, TMP_5)); + if ($truthy($rb_gt(time, 0))) { + return time + } else { + return nil + }; + }, TMP_Timings_time_4.$$arity = -1); + + Opal.def(self, '$read', TMP_Timings_read_6 = function $$read() { + var self = this; + + return self.$time("read") + }, TMP_Timings_read_6.$$arity = 0); + + Opal.def(self, '$parse', TMP_Timings_parse_7 = function $$parse() { + var self = this; + + return self.$time("parse") + }, TMP_Timings_parse_7.$$arity = 0); + + Opal.def(self, '$read_parse', TMP_Timings_read_parse_8 = function $$read_parse() { + var self = this; + + return self.$time("read", "parse") + }, TMP_Timings_read_parse_8.$$arity = 0); + + Opal.def(self, '$convert', TMP_Timings_convert_9 = function $$convert() { + var self = this; + + return self.$time("convert") + }, TMP_Timings_convert_9.$$arity = 0); + + Opal.def(self, '$read_parse_convert', TMP_Timings_read_parse_convert_10 = function $$read_parse_convert() { + var self = this; + + return self.$time("read", "parse", "convert") + }, TMP_Timings_read_parse_convert_10.$$arity = 0); + + Opal.def(self, '$write', TMP_Timings_write_11 = function $$write() { + var self = this; + + return self.$time("write") + }, TMP_Timings_write_11.$$arity = 0); + + Opal.def(self, '$total', TMP_Timings_total_12 = function $$total() { + var self = this; + + return self.$time("read", "parse", "convert", "write") + }, TMP_Timings_total_12.$$arity = 0); + + Opal.def(self, '$print_report', TMP_Timings_print_report_13 = function $$print_report(to, subject) { + var self = this; + if ($gvars.stdout == null) $gvars.stdout = nil; + + + + if (to == null) { + to = $gvars.stdout; + }; + + if (subject == null) { + subject = nil; + }; + if ($truthy(subject)) { + to.$puts("" + "Input file: " + (subject))}; + to.$puts("" + " Time to read and parse source: " + ("%05.5f"['$%'](self.$read_parse().$to_f()))); + to.$puts("" + " Time to convert document: " + ("%05.5f"['$%'](self.$convert().$to_f()))); + return to.$puts("" + " Total time (read, parse and convert): " + ("%05.5f"['$%'](self.$read_parse_convert().$to_f()))); + }, TMP_Timings_print_report_13.$$arity = -1); + if ($truthy(($truthy($a = $$$('::', 'Process')['$const_defined?']("CLOCK_MONOTONIC")) ? $$$('::', 'Process')['$respond_to?']("clock_gettime") : $a))) { + + Opal.const_set($nesting[0], 'CLOCK_ID', $$$($$$('::', 'Process'), 'CLOCK_MONOTONIC')); + return (Opal.def(self, '$now', TMP_Timings_now_14 = function $$now() { + var self = this; + + return $$$('::', 'Process').$clock_gettime($$($nesting, 'CLOCK_ID')) + }, TMP_Timings_now_14.$$arity = 0), nil) && 'now'; + } else { + return (Opal.def(self, '$now', TMP_Timings_now_15 = function $$now() { + var self = this; + + return $$$('::', 'Time').$now() + }, TMP_Timings_now_15.$$arity = 0), nil) && 'now' + }; + })($nesting[0], null, $nesting) + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/version"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module; + + return (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + Opal.const_set($nesting[0], 'VERSION', "1.5.8") + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/core_ext/nil_or_empty"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $truthy = Opal.truthy; + + Opal.add_stubs(['$method_defined?']); + + (function($base, $super, $parent_nesting) { + function $NilClass(){}; + var self = $NilClass = $klass($base, $super, 'NilClass', $NilClass); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + if ($truthy(self['$method_defined?']("nil_or_empty?"))) { + return nil + } else { + return Opal.alias(self, "nil_or_empty?", "nil?") + } + })($nesting[0], null, $nesting); + (function($base, $super, $parent_nesting) { + function $String(){}; + var self = $String = $klass($base, $super, 'String', $String); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + if ($truthy(self['$method_defined?']("nil_or_empty?"))) { + return nil + } else { + return Opal.alias(self, "nil_or_empty?", "empty?") + } + })($nesting[0], null, $nesting); + (function($base, $super, $parent_nesting) { + function $Array(){}; + var self = $Array = $klass($base, $super, 'Array', $Array); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + if ($truthy(self['$method_defined?']("nil_or_empty?"))) { + return nil + } else { + return Opal.alias(self, "nil_or_empty?", "empty?") + } + })($nesting[0], null, $nesting); + (function($base, $super, $parent_nesting) { + function $Hash(){}; + var self = $Hash = $klass($base, $super, 'Hash', $Hash); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + if ($truthy(self['$method_defined?']("nil_or_empty?"))) { + return nil + } else { + return Opal.alias(self, "nil_or_empty?", "empty?") + } + })($nesting[0], null, $nesting); + return (function($base, $super, $parent_nesting) { + function $Numeric(){}; + var self = $Numeric = $klass($base, $super, 'Numeric', $Numeric); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + if ($truthy(self['$method_defined?']("nil_or_empty?"))) { + return nil + } else { + return Opal.alias(self, "nil_or_empty?", "nil?") + } + })($nesting[0], null, $nesting); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/core_ext/regexp/is_match"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $truthy = Opal.truthy; + + Opal.add_stubs(['$method_defined?']); + return (function($base, $super, $parent_nesting) { + function $Regexp(){}; + var self = $Regexp = $klass($base, $super, 'Regexp', $Regexp); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + if ($truthy(self['$method_defined?']("match?"))) { + return nil + } else { + return Opal.alias(self, "match?", "===") + } + })($nesting[0], null, $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/core_ext/string/limit_bytesize"] = function(Opal) { + function $rb_lt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); + } + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $truthy = Opal.truthy; + + Opal.add_stubs(['$method_defined?', '$<', '$bytesize', '$valid_encoding?', '$force_encoding', '$byteslice', '$-']); + return (function($base, $super, $parent_nesting) { + function $String(){}; + var self = $String = $klass($base, $super, 'String', $String); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_String_limit_bytesize_1; + + if ($truthy(self['$method_defined?']("limit_bytesize"))) { + return nil + } else { + return (Opal.def(self, '$limit_bytesize', TMP_String_limit_bytesize_1 = function $$limit_bytesize(size) { + var $a, self = this, result = nil; + + + if ($truthy($rb_lt(size, self.$bytesize()))) { + } else { + return self + }; + while (!($truthy((result = self.$byteslice(0, size)).$force_encoding($$$($$$('::', 'Encoding'), 'UTF_8'))['$valid_encoding?']()))) { + size = $rb_minus(size, 1) + }; + return result; + }, TMP_String_limit_bytesize_1.$$arity = 1), nil) && 'limit_bytesize' + } + })($nesting[0], null, $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/core_ext/1.8.7/io/binread"] = function(Opal) { + var TMP_binread_1, self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $truthy = Opal.truthy, $send = Opal.send; + + Opal.add_stubs(['$respond_to?', '$open', '$==', '$seek', '$read']); + if ($truthy($$($nesting, 'IO')['$respond_to?']("binread"))) { + return nil + } else { + return (Opal.defs($$($nesting, 'IO'), '$binread', TMP_binread_1 = function $$binread(name, length, offset) { + var TMP_2, self = this; + + + + if (length == null) { + length = nil; + }; + + if (offset == null) { + offset = 0; + }; + return $send($$($nesting, 'File'), 'open', [name, "rb"], (TMP_2 = function(f){var self = TMP_2.$$s || this; + + + + if (f == null) { + f = nil; + }; + if (offset['$=='](0)) { + } else { + f.$seek(offset) + }; + if ($truthy(length)) { + + return f.$read(length); + } else { + return f.$read() + };}, TMP_2.$$s = self, TMP_2.$$arity = 1, TMP_2)); + }, TMP_binread_1.$$arity = -2), nil) && 'binread' + } +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/core_ext/1.8.7/io/write"] = function(Opal) { + var TMP_write_1, self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $truthy = Opal.truthy, $send = Opal.send; + + Opal.add_stubs(['$respond_to?', '$open', '$write']); + if ($truthy($$($nesting, 'IO')['$respond_to?']("write"))) { + return nil + } else { + return (Opal.defs($$($nesting, 'IO'), '$write', TMP_write_1 = function $$write(name, string, offset, opts) { + var TMP_2, self = this; + + + + if (offset == null) { + offset = 0; + }; + + if (opts == null) { + opts = nil; + }; + return $send($$($nesting, 'File'), 'open', [name, "w"], (TMP_2 = function(f){var self = TMP_2.$$s || this; + + + + if (f == null) { + f = nil; + }; + return f.$write(string);}, TMP_2.$$s = self, TMP_2.$$arity = 1, TMP_2)); + }, TMP_write_1.$$arity = -3), nil) && 'write' + } +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/core_ext"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $truthy = Opal.truthy; + + Opal.add_stubs(['$require', '$==', '$!=']); + + self.$require("asciidoctor/core_ext/nil_or_empty"); + self.$require("asciidoctor/core_ext/regexp/is_match"); + if ($truthy($$($nesting, 'RUBY_MIN_VERSION_1_9'))) { + + self.$require("asciidoctor/core_ext/string/limit_bytesize"); + if ($$($nesting, 'RUBY_ENGINE')['$==']("opal")) { + + self.$require("asciidoctor/core_ext/1.8.7/io/binread"); + return self.$require("asciidoctor/core_ext/1.8.7/io/write"); + } else { + return nil + }; + } else if ($truthy($$($nesting, 'RUBY_ENGINE')['$!=']("opal"))) { + return nil + } else { + return nil + }; +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/helpers"] = function(Opal) { + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + function $rb_times(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs * rhs : lhs['$*'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $truthy = Opal.truthy, $send = Opal.send, $gvars = Opal.gvars, $hash2 = Opal.hash2; + + Opal.add_stubs(['$require', '$include?', '$include', '$==', '$===', '$raise', '$warn', '$logger', '$chomp', '$message', '$normalize_lines_from_string', '$normalize_lines_array', '$empty?', '$unpack', '$[]', '$slice', '$join', '$map', '$each_line', '$encode', '$force_encoding', '$length', '$rstrip', '$[]=', '$-', '$encoding', '$nil_or_empty?', '$match?', '$=~', '$gsub', '$each_byte', '$sprintf', '$rindex', '$basename', '$extname', '$directory?', '$dirname', '$mkdir_p', '$mkdir', '$divmod', '$*']); + return (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + (function($base, $parent_nesting) { + function $Helpers() {}; + var self = $Helpers = $module($base, 'Helpers', $Helpers); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Helpers_require_library_1, TMP_Helpers_normalize_lines_2, TMP_Helpers_normalize_lines_array_3, TMP_Helpers_normalize_lines_from_string_8, TMP_Helpers_uriish$q_10, TMP_Helpers_uri_prefix_11, TMP_Helpers_uri_encode_12, TMP_Helpers_rootname_15, TMP_Helpers_basename_16, TMP_Helpers_mkdir_p_17, TMP_Helpers_int_to_roman_18; + + + Opal.defs(self, '$require_library', TMP_Helpers_require_library_1 = function $$require_library(name, gem_name, on_failure) { + var self = this, e = nil, $case = nil; + + + + if (gem_name == null) { + gem_name = true; + }; + + if (on_failure == null) { + on_failure = "abort"; + }; + try { + return self.$require(name) + } catch ($err) { + if (Opal.rescue($err, [$$$('::', 'LoadError')])) {e = $err; + try { + + if ($truthy(self['$include?']($$($nesting, 'Logging')))) { + } else { + self.$include($$($nesting, 'Logging')) + }; + if ($truthy(gem_name)) { + + if (gem_name['$=='](true)) { + gem_name = name}; + $case = on_failure; + if ("abort"['$===']($case)) {self.$raise($$$('::', 'LoadError'), "" + "asciidoctor: FAILED: required gem '" + (gem_name) + "' is not installed. Processing aborted.")} + else if ("warn"['$===']($case)) {self.$logger().$warn("" + "optional gem '" + (gem_name) + "' is not installed. Functionality disabled.")}; + } else { + $case = on_failure; + if ("abort"['$===']($case)) {self.$raise($$$('::', 'LoadError'), "" + "asciidoctor: FAILED: " + (e.$message().$chomp(".")) + ". Processing aborted.")} + else if ("warn"['$===']($case)) {self.$logger().$warn("" + (e.$message().$chomp(".")) + ". Functionality disabled.")} + }; + return nil; + } finally { Opal.pop_exception() } + } else { throw $err; } + }; + }, TMP_Helpers_require_library_1.$$arity = -2); + Opal.defs(self, '$normalize_lines', TMP_Helpers_normalize_lines_2 = function $$normalize_lines(data) { + var self = this; + + if ($truthy($$$('::', 'String')['$==='](data))) { + + return self.$normalize_lines_from_string(data); + } else { + + return self.$normalize_lines_array(data); + } + }, TMP_Helpers_normalize_lines_2.$$arity = 1); + Opal.defs(self, '$normalize_lines_array', TMP_Helpers_normalize_lines_array_3 = function $$normalize_lines_array(data) { + var TMP_4, TMP_5, TMP_6, TMP_7, self = this, leading_bytes = nil, first_line = nil, utf8 = nil, leading_2_bytes = nil, $writer = nil; + + + if ($truthy(data['$empty?']())) { + return data}; + leading_bytes = (first_line = data['$[]'](0)).$unpack("C3"); + if ($truthy($$($nesting, 'COERCE_ENCODING'))) { + + utf8 = $$$($$$('::', 'Encoding'), 'UTF_8'); + if ((leading_2_bytes = leading_bytes.$slice(0, 2))['$==']($$($nesting, 'BOM_BYTES_UTF_16LE'))) { + + data = data.$join(); + return $send(data.$force_encoding($$$($$$('::', 'Encoding'), 'UTF_16LE')).$slice(1, data.$length()).$encode(utf8).$each_line(), 'map', [], (TMP_4 = function(line){var self = TMP_4.$$s || this; + + + + if (line == null) { + line = nil; + }; + return line.$rstrip();}, TMP_4.$$s = self, TMP_4.$$arity = 1, TMP_4)); + } else if (leading_2_bytes['$==']($$($nesting, 'BOM_BYTES_UTF_16BE'))) { + + + $writer = [0, first_line.$force_encoding($$$($$$('::', 'Encoding'), 'UTF_16BE')).$slice(1, first_line.$length())]; + $send(data, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + return $send(data, 'map', [], (TMP_5 = function(line){var self = TMP_5.$$s || this; + + + + if (line == null) { + line = nil; + }; + return line.$force_encoding($$$($$$('::', 'Encoding'), 'UTF_16BE')).$encode(utf8).$rstrip();}, TMP_5.$$s = self, TMP_5.$$arity = 1, TMP_5)); + } else if (leading_bytes['$==']($$($nesting, 'BOM_BYTES_UTF_8'))) { + + $writer = [0, first_line.$force_encoding(utf8).$slice(1, first_line.$length())]; + $send(data, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + return $send(data, 'map', [], (TMP_6 = function(line){var self = TMP_6.$$s || this; + + + + if (line == null) { + line = nil; + }; + if (line.$encoding()['$=='](utf8)) { + return line.$rstrip() + } else { + return line.$force_encoding(utf8).$rstrip() + };}, TMP_6.$$s = self, TMP_6.$$arity = 1, TMP_6)); + } else { + + if (leading_bytes['$==']($$($nesting, 'BOM_BYTES_UTF_8'))) { + + $writer = [0, first_line.$slice(3, first_line.$length())]; + $send(data, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + return $send(data, 'map', [], (TMP_7 = function(line){var self = TMP_7.$$s || this; + + + + if (line == null) { + line = nil; + }; + return line.$rstrip();}, TMP_7.$$s = self, TMP_7.$$arity = 1, TMP_7)); + }; + }, TMP_Helpers_normalize_lines_array_3.$$arity = 1); + Opal.defs(self, '$normalize_lines_from_string', TMP_Helpers_normalize_lines_from_string_8 = function $$normalize_lines_from_string(data) { + var TMP_9, self = this, leading_bytes = nil, utf8 = nil, leading_2_bytes = nil; + + + if ($truthy(data['$nil_or_empty?']())) { + return []}; + leading_bytes = data.$unpack("C3"); + if ($truthy($$($nesting, 'COERCE_ENCODING'))) { + + utf8 = $$$($$$('::', 'Encoding'), 'UTF_8'); + if ((leading_2_bytes = leading_bytes.$slice(0, 2))['$==']($$($nesting, 'BOM_BYTES_UTF_16LE'))) { + data = data.$force_encoding($$$($$$('::', 'Encoding'), 'UTF_16LE')).$slice(1, data.$length()).$encode(utf8) + } else if (leading_2_bytes['$==']($$($nesting, 'BOM_BYTES_UTF_16BE'))) { + data = data.$force_encoding($$$($$$('::', 'Encoding'), 'UTF_16BE')).$slice(1, data.$length()).$encode(utf8) + } else if (leading_bytes['$==']($$($nesting, 'BOM_BYTES_UTF_8'))) { + data = (function() {if (data.$encoding()['$=='](utf8)) { + + return data.$slice(1, data.$length()); + } else { + + return data.$force_encoding(utf8).$slice(1, data.$length()); + }; return nil; })() + } else if (data.$encoding()['$=='](utf8)) { + } else { + data = data.$force_encoding(utf8) + }; + } else if (leading_bytes['$==']($$($nesting, 'BOM_BYTES_UTF_8'))) { + data = data.$slice(3, data.$length())}; + return $send(data.$each_line(), 'map', [], (TMP_9 = function(line){var self = TMP_9.$$s || this; + + + + if (line == null) { + line = nil; + }; + return line.$rstrip();}, TMP_9.$$s = self, TMP_9.$$arity = 1, TMP_9)); + }, TMP_Helpers_normalize_lines_from_string_8.$$arity = 1); + Opal.defs(self, '$uriish?', TMP_Helpers_uriish$q_10 = function(str) { + var $a, self = this; + + return ($truthy($a = str['$include?'](":")) ? $$($nesting, 'UriSniffRx')['$match?'](str) : $a) + }, TMP_Helpers_uriish$q_10.$$arity = 1); + Opal.defs(self, '$uri_prefix', TMP_Helpers_uri_prefix_11 = function $$uri_prefix(str) { + var $a, self = this; + + if ($truthy(($truthy($a = str['$include?'](":")) ? $$($nesting, 'UriSniffRx')['$=~'](str) : $a))) { + return (($a = $gvars['~']) === nil ? nil : $a['$[]'](0)) + } else { + return nil + } + }, TMP_Helpers_uri_prefix_11.$$arity = 1); + Opal.const_set($nesting[0], 'REGEXP_ENCODE_URI_CHARS', /[^\w\-.!~*';:@=+$,()\[\]]/); + Opal.defs(self, '$uri_encode', TMP_Helpers_uri_encode_12 = function $$uri_encode(str) { + var TMP_13, self = this; + + return $send(str, 'gsub', [$$($nesting, 'REGEXP_ENCODE_URI_CHARS')], (TMP_13 = function(){var self = TMP_13.$$s || this, $a, TMP_14; + + return $send((($a = $gvars['~']) === nil ? nil : $a['$[]'](0)).$each_byte(), 'map', [], (TMP_14 = function(c){var self = TMP_14.$$s || this; + + + + if (c == null) { + c = nil; + }; + return self.$sprintf("%%%02X", c);}, TMP_14.$$s = self, TMP_14.$$arity = 1, TMP_14)).$join()}, TMP_13.$$s = self, TMP_13.$$arity = 0, TMP_13)) + }, TMP_Helpers_uri_encode_12.$$arity = 1); + Opal.defs(self, '$rootname', TMP_Helpers_rootname_15 = function $$rootname(filename) { + var $a, self = this; + + return filename.$slice(0, ($truthy($a = filename.$rindex(".")) ? $a : filename.$length())) + }, TMP_Helpers_rootname_15.$$arity = 1); + Opal.defs(self, '$basename', TMP_Helpers_basename_16 = function $$basename(filename, drop_ext) { + var self = this; + + + + if (drop_ext == null) { + drop_ext = nil; + }; + if ($truthy(drop_ext)) { + return $$$('::', 'File').$basename(filename, (function() {if (drop_ext['$=='](true)) { + + return $$$('::', 'File').$extname(filename); + } else { + return drop_ext + }; return nil; })()) + } else { + return $$$('::', 'File').$basename(filename) + }; + }, TMP_Helpers_basename_16.$$arity = -2); + Opal.defs(self, '$mkdir_p', TMP_Helpers_mkdir_p_17 = function $$mkdir_p(dir) { + var self = this, parent_dir = nil; + + if ($truthy($$$('::', 'File')['$directory?'](dir))) { + return nil + } else { + + if ((parent_dir = $$$('::', 'File').$dirname(dir))['$=='](".")) { + } else { + self.$mkdir_p(parent_dir) + }; + + try { + return $$$('::', 'Dir').$mkdir(dir) + } catch ($err) { + if (Opal.rescue($err, [$$$('::', 'SystemCallError')])) { + try { + if ($truthy($$$('::', 'File')['$directory?'](dir))) { + return nil + } else { + return self.$raise() + } + } finally { Opal.pop_exception() } + } else { throw $err; } + };; + } + }, TMP_Helpers_mkdir_p_17.$$arity = 1); + Opal.const_set($nesting[0], 'ROMAN_NUMERALS', $hash2(["M", "CM", "D", "CD", "C", "XC", "L", "XL", "X", "IX", "V", "IV", "I"], {"M": 1000, "CM": 900, "D": 500, "CD": 400, "C": 100, "XC": 90, "L": 50, "XL": 40, "X": 10, "IX": 9, "V": 5, "IV": 4, "I": 1})); + Opal.defs(self, '$int_to_roman', TMP_Helpers_int_to_roman_18 = function $$int_to_roman(val) { + var TMP_19, self = this; + + return $send($$($nesting, 'ROMAN_NUMERALS'), 'map', [], (TMP_19 = function(l, i){var self = TMP_19.$$s || this, $a, $b, repeat = nil; + + + + if (l == null) { + l = nil; + }; + + if (i == null) { + i = nil; + }; + $b = val.$divmod(i), $a = Opal.to_ary($b), (repeat = ($a[0] == null ? nil : $a[0])), (val = ($a[1] == null ? nil : $a[1])), $b; + return $rb_times(l, repeat);}, TMP_19.$$s = self, TMP_19.$$arity = 2, TMP_19)).$join() + }, TMP_Helpers_int_to_roman_18.$$arity = 1); + })($nesting[0], $nesting) + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/substitutors"] = function(Opal) { + function $rb_plus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); + } + function $rb_gt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); + } + function $rb_times(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs * rhs : lhs['$*'](rhs); + } + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + function $rb_lt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $hash2 = Opal.hash2, $hash = Opal.hash, $truthy = Opal.truthy, $send = Opal.send, $gvars = Opal.gvars; + + Opal.add_stubs(['$freeze', '$+', '$keys', '$chr', '$attr_reader', '$empty?', '$!', '$===', '$[]', '$join', '$include?', '$extract_passthroughs', '$each', '$sub_specialchars', '$sub_quotes', '$sub_attributes', '$sub_replacements', '$sub_macros', '$highlight_source', '$sub_callouts', '$sub_post_replacements', '$warn', '$logger', '$restore_passthroughs', '$split', '$apply_subs', '$compat_mode', '$gsub', '$==', '$length', '$>', '$*', '$-', '$end_with?', '$slice', '$parse_quoted_text_attributes', '$size', '$[]=', '$unescape_brackets', '$resolve_pass_subs', '$start_with?', '$extract_inner_passthrough', '$to_sym', '$attributes', '$basebackend?', '$=~', '$to_i', '$convert', '$new', '$clear', '$match?', '$convert_quoted_text', '$do_replacement', '$sub', '$shift', '$store_attribute', '$!=', '$attribute_undefined', '$counter', '$key?', '$downcase', '$attribute_missing', '$tr_s', '$delete', '$reject', '$strip', '$index', '$min', '$compact', '$map', '$chop', '$unescape_bracketed_text', '$pop', '$rstrip', '$extensions', '$inline_macros?', '$inline_macros', '$regexp', '$instance', '$names', '$config', '$dup', '$nil_or_empty?', '$parse_attributes', '$process_method', '$register', '$tr', '$basename', '$split_simple_csv', '$normalize_string', '$!~', '$parse', '$uri_encode', '$sub_inline_xrefs', '$sub_inline_anchors', '$find', '$footnotes', '$id', '$text', '$style', '$lstrip', '$parse_into', '$extname', '$catalog', '$fetch', '$outfilesuffix', '$natural_xrefs', '$key', '$attr?', '$attr', '$to_s', '$read_next_id', '$callouts', '$<', '$<<', '$shorthand_property_syntax', '$concat', '$each_char', '$drop', '$&', '$resolve_subs', '$nil?', '$require_library', '$sub_source', '$resolve_lines_to_highlight', '$highlight', '$find_by_alias', '$find_by_mimetype', '$name', '$option?', '$count', '$to_a', '$uniq', '$sort', '$resolve_block_subs']); + return (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + (function($base, $parent_nesting) { + function $Substitutors() {}; + var self = $Substitutors = $module($base, 'Substitutors', $Substitutors); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Substitutors_apply_subs_1, TMP_Substitutors_apply_normal_subs_3, TMP_Substitutors_apply_title_subs_4, TMP_Substitutors_apply_reftext_subs_5, TMP_Substitutors_apply_header_subs_6, TMP_Substitutors_extract_passthroughs_7, TMP_Substitutors_extract_inner_passthrough_11, TMP_Substitutors_restore_passthroughs_12, TMP_Substitutors_sub_quotes_14, TMP_Substitutors_sub_replacements_17, TMP_Substitutors_sub_specialchars_20, TMP_Substitutors_sub_specialchars_21, TMP_Substitutors_do_replacement_23, TMP_Substitutors_sub_attributes_24, TMP_Substitutors_sub_macros_29, TMP_Substitutors_sub_inline_anchors_46, TMP_Substitutors_sub_inline_xrefs_49, TMP_Substitutors_sub_callouts_51, TMP_Substitutors_sub_post_replacements_53, TMP_Substitutors_convert_quoted_text_56, TMP_Substitutors_parse_quoted_text_attributes_57, TMP_Substitutors_parse_attributes_58, TMP_Substitutors_expand_subs_59, TMP_Substitutors_unescape_bracketed_text_61, TMP_Substitutors_normalize_string_62, TMP_Substitutors_unescape_brackets_63, TMP_Substitutors_split_simple_csv_64, TMP_Substitutors_resolve_subs_67, TMP_Substitutors_resolve_block_subs_69, TMP_Substitutors_resolve_pass_subs_70, TMP_Substitutors_highlight_source_71, TMP_Substitutors_resolve_lines_to_highlight_76, TMP_Substitutors_sub_source_78, TMP_Substitutors_lock_in_subs_79; + + + Opal.const_set($nesting[0], 'SpecialCharsRx', /[<&>]/); + Opal.const_set($nesting[0], 'SpecialCharsTr', $hash2([">", "<", "&"], {">": ">", "<": "<", "&": "&"})); + Opal.const_set($nesting[0], 'QuotedTextSniffRx', $hash(false, /[*_`#^~]/, true, /[*'_+#^~]/)); + Opal.const_set($nesting[0], 'BASIC_SUBS', ["specialcharacters"]).$freeze(); + Opal.const_set($nesting[0], 'HEADER_SUBS', ["specialcharacters", "attributes"]).$freeze(); + Opal.const_set($nesting[0], 'NORMAL_SUBS', ["specialcharacters", "quotes", "attributes", "replacements", "macros", "post_replacements"]).$freeze(); + Opal.const_set($nesting[0], 'NONE_SUBS', []).$freeze(); + Opal.const_set($nesting[0], 'TITLE_SUBS', ["specialcharacters", "quotes", "replacements", "macros", "attributes", "post_replacements"]).$freeze(); + Opal.const_set($nesting[0], 'REFTEXT_SUBS', ["specialcharacters", "quotes", "replacements"]).$freeze(); + Opal.const_set($nesting[0], 'VERBATIM_SUBS', ["specialcharacters", "callouts"]).$freeze(); + Opal.const_set($nesting[0], 'SUB_GROUPS', $hash2(["none", "normal", "verbatim", "specialchars"], {"none": $$($nesting, 'NONE_SUBS'), "normal": $$($nesting, 'NORMAL_SUBS'), "verbatim": $$($nesting, 'VERBATIM_SUBS'), "specialchars": $$($nesting, 'BASIC_SUBS')})); + Opal.const_set($nesting[0], 'SUB_HINTS', $hash2(["a", "m", "n", "p", "q", "r", "c", "v"], {"a": "attributes", "m": "macros", "n": "normal", "p": "post_replacements", "q": "quotes", "r": "replacements", "c": "specialcharacters", "v": "verbatim"})); + Opal.const_set($nesting[0], 'SUB_OPTIONS', $hash2(["block", "inline"], {"block": $rb_plus($rb_plus($$($nesting, 'SUB_GROUPS').$keys(), $$($nesting, 'NORMAL_SUBS')), ["callouts"]), "inline": $rb_plus($$($nesting, 'SUB_GROUPS').$keys(), $$($nesting, 'NORMAL_SUBS'))})); + Opal.const_set($nesting[0], 'SUB_HIGHLIGHT', ["coderay", "pygments"]); + if ($truthy($$$('::', 'RUBY_MIN_VERSION_1_9'))) { + + Opal.const_set($nesting[0], 'CAN', "\u0018"); + Opal.const_set($nesting[0], 'DEL', "\u007F"); + Opal.const_set($nesting[0], 'PASS_START', "\u0096"); + Opal.const_set($nesting[0], 'PASS_END', "\u0097"); + } else { + + Opal.const_set($nesting[0], 'CAN', (24).$chr()); + Opal.const_set($nesting[0], 'DEL', (127).$chr()); + Opal.const_set($nesting[0], 'PASS_START', (150).$chr()); + Opal.const_set($nesting[0], 'PASS_END', (151).$chr()); + }; + Opal.const_set($nesting[0], 'PassSlotRx', new RegExp("" + ($$($nesting, 'PASS_START')) + "(\\d+)" + ($$($nesting, 'PASS_END')))); + Opal.const_set($nesting[0], 'HighlightedPassSlotRx', new RegExp("" + "]*>" + ($$($nesting, 'PASS_START')) + "[^\\d]*(\\d+)[^\\d]*]*>" + ($$($nesting, 'PASS_END')) + "")); + Opal.const_set($nesting[0], 'RS', "\\"); + Opal.const_set($nesting[0], 'R_SB', "]"); + Opal.const_set($nesting[0], 'ESC_R_SB', "\\]"); + Opal.const_set($nesting[0], 'PLUS', "+"); + Opal.const_set($nesting[0], 'PygmentsWrapperDivRx', /
    (.*)<\/div>/m); + Opal.const_set($nesting[0], 'PygmentsWrapperPreRx', /]*?>(.*?)<\/pre>\s*/m); + self.$attr_reader("passthroughs"); + + Opal.def(self, '$apply_subs', TMP_Substitutors_apply_subs_1 = function $$apply_subs(text, subs) { + var $a, TMP_2, self = this, multiline = nil, has_passthroughs = nil; + if (self.passthroughs == null) self.passthroughs = nil; + + + + if (subs == null) { + subs = $$($nesting, 'NORMAL_SUBS'); + }; + if ($truthy(($truthy($a = text['$empty?']()) ? $a : subs['$!']()))) { + return text}; + if ($truthy((multiline = $$$('::', 'Array')['$==='](text)))) { + text = (function() {if ($truthy(text['$[]'](1))) { + + return text.$join($$($nesting, 'LF')); + } else { + return text['$[]'](0) + }; return nil; })()}; + if ($truthy((has_passthroughs = subs['$include?']("macros")))) { + + text = self.$extract_passthroughs(text); + if ($truthy(self.passthroughs['$empty?']())) { + has_passthroughs = false};}; + $send(subs, 'each', [], (TMP_2 = function(type){var self = TMP_2.$$s || this, $case = nil; + + + + if (type == null) { + type = nil; + }; + return (function() {$case = type; + if ("specialcharacters"['$===']($case)) {return (text = self.$sub_specialchars(text))} + else if ("quotes"['$===']($case)) {return (text = self.$sub_quotes(text))} + else if ("attributes"['$===']($case)) {if ($truthy(text['$include?']($$($nesting, 'ATTR_REF_HEAD')))) { + return (text = self.$sub_attributes(text)) + } else { + return nil + }} + else if ("replacements"['$===']($case)) {return (text = self.$sub_replacements(text))} + else if ("macros"['$===']($case)) {return (text = self.$sub_macros(text))} + else if ("highlight"['$===']($case)) {return (text = self.$highlight_source(text, subs['$include?']("callouts")))} + else if ("callouts"['$===']($case)) {if ($truthy(subs['$include?']("highlight"))) { + return nil + } else { + return (text = self.$sub_callouts(text)) + }} + else if ("post_replacements"['$===']($case)) {return (text = self.$sub_post_replacements(text))} + else {return self.$logger().$warn("" + "unknown substitution type " + (type))}})();}, TMP_2.$$s = self, TMP_2.$$arity = 1, TMP_2)); + if ($truthy(has_passthroughs)) { + text = self.$restore_passthroughs(text)}; + if ($truthy(multiline)) { + + return text.$split($$($nesting, 'LF'), -1); + } else { + return text + }; + }, TMP_Substitutors_apply_subs_1.$$arity = -2); + + Opal.def(self, '$apply_normal_subs', TMP_Substitutors_apply_normal_subs_3 = function $$apply_normal_subs(text) { + var self = this; + + return self.$apply_subs(text) + }, TMP_Substitutors_apply_normal_subs_3.$$arity = 1); + + Opal.def(self, '$apply_title_subs', TMP_Substitutors_apply_title_subs_4 = function $$apply_title_subs(title) { + var self = this; + + return self.$apply_subs(title, $$($nesting, 'TITLE_SUBS')) + }, TMP_Substitutors_apply_title_subs_4.$$arity = 1); + + Opal.def(self, '$apply_reftext_subs', TMP_Substitutors_apply_reftext_subs_5 = function $$apply_reftext_subs(text) { + var self = this; + + return self.$apply_subs(text, $$($nesting, 'REFTEXT_SUBS')) + }, TMP_Substitutors_apply_reftext_subs_5.$$arity = 1); + + Opal.def(self, '$apply_header_subs', TMP_Substitutors_apply_header_subs_6 = function $$apply_header_subs(text) { + var self = this; + + return self.$apply_subs(text, $$($nesting, 'HEADER_SUBS')) + }, TMP_Substitutors_apply_header_subs_6.$$arity = 1); + + Opal.def(self, '$extract_passthroughs', TMP_Substitutors_extract_passthroughs_7 = function $$extract_passthroughs(text) { + var $a, $b, TMP_8, TMP_9, TMP_10, self = this, compat_mode = nil, passes = nil, pass_inline_char1 = nil, pass_inline_char2 = nil, pass_inline_rx = nil; + if (self.document == null) self.document = nil; + if (self.passthroughs == null) self.passthroughs = nil; + + + compat_mode = self.document.$compat_mode(); + passes = self.passthroughs; + if ($truthy(($truthy($a = ($truthy($b = text['$include?']("++")) ? $b : text['$include?']("$$"))) ? $a : text['$include?']("ss:")))) { + text = $send(text, 'gsub', [$$($nesting, 'InlinePassMacroRx')], (TMP_8 = function(){var self = TMP_8.$$s || this, $c, m = nil, preceding = nil, boundary = nil, attributes = nil, escape_count = nil, content = nil, old_behavior = nil, subs = nil, pass_key = nil, $writer = nil; + if ($gvars["~"] == null) $gvars["~"] = nil; + + + m = $gvars["~"]; + preceding = nil; + if ($truthy((boundary = m['$[]'](4)))) { + + if ($truthy(($truthy($c = compat_mode) ? boundary['$==']("++") : $c))) { + return (function() {if ($truthy(m['$[]'](2))) { + return "" + (m['$[]'](1)) + "[" + (m['$[]'](2)) + "]" + (m['$[]'](3)) + "++" + (self.$extract_passthroughs(m['$[]'](5))) + "++" + } else { + return "" + (m['$[]'](1)) + (m['$[]'](3)) + "++" + (self.$extract_passthroughs(m['$[]'](5))) + "++" + }; return nil; })();}; + attributes = m['$[]'](2); + escape_count = m['$[]'](3).$length(); + content = m['$[]'](5); + old_behavior = false; + if ($truthy(attributes)) { + if ($truthy($rb_gt(escape_count, 0))) { + return "" + (m['$[]'](1)) + "[" + (attributes) + "]" + ($rb_times($$($nesting, 'RS'), $rb_minus(escape_count, 1))) + (boundary) + (m['$[]'](5)) + (boundary); + } else if (m['$[]'](1)['$==']($$($nesting, 'RS'))) { + + preceding = "" + "[" + (attributes) + "]"; + attributes = nil; + } else { + + if ($truthy((($c = boundary['$==']("++")) ? attributes['$end_with?']("x-") : boundary['$==']("++")))) { + + old_behavior = true; + attributes = attributes.$slice(0, $rb_minus(attributes.$length(), 2));}; + attributes = self.$parse_quoted_text_attributes(attributes); + } + } else if ($truthy($rb_gt(escape_count, 0))) { + return "" + ($rb_times($$($nesting, 'RS'), $rb_minus(escape_count, 1))) + (boundary) + (m['$[]'](5)) + (boundary);}; + subs = (function() {if (boundary['$==']("+++")) { + return [] + } else { + return $$($nesting, 'BASIC_SUBS') + }; return nil; })(); + pass_key = passes.$size(); + if ($truthy(attributes)) { + if ($truthy(old_behavior)) { + + $writer = [pass_key, $hash2(["text", "subs", "type", "attributes"], {"text": content, "subs": $$($nesting, 'NORMAL_SUBS'), "type": "monospaced", "attributes": attributes})]; + $send(passes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + } else { + + $writer = [pass_key, $hash2(["text", "subs", "type", "attributes"], {"text": content, "subs": subs, "type": "unquoted", "attributes": attributes})]; + $send(passes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + } + } else { + + $writer = [pass_key, $hash2(["text", "subs"], {"text": content, "subs": subs})]; + $send(passes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + } else { + + if (m['$[]'](6)['$==']($$($nesting, 'RS'))) { + return m['$[]'](0).$slice(1, m['$[]'](0).$length());}; + + $writer = [(pass_key = passes.$size()), $hash2(["text", "subs"], {"text": self.$unescape_brackets(m['$[]'](8)), "subs": (function() {if ($truthy(m['$[]'](7))) { + + return self.$resolve_pass_subs(m['$[]'](7)); + } else { + return nil + }; return nil; })()})]; + $send(passes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + }; + return "" + (preceding) + ($$($nesting, 'PASS_START')) + (pass_key) + ($$($nesting, 'PASS_END'));}, TMP_8.$$s = self, TMP_8.$$arity = 0, TMP_8))}; + $b = $$($nesting, 'InlinePassRx')['$[]'](compat_mode), $a = Opal.to_ary($b), (pass_inline_char1 = ($a[0] == null ? nil : $a[0])), (pass_inline_char2 = ($a[1] == null ? nil : $a[1])), (pass_inline_rx = ($a[2] == null ? nil : $a[2])), $b; + if ($truthy(($truthy($a = text['$include?'](pass_inline_char1)) ? $a : ($truthy($b = pass_inline_char2) ? text['$include?'](pass_inline_char2) : $b)))) { + text = $send(text, 'gsub', [pass_inline_rx], (TMP_9 = function(){var self = TMP_9.$$s || this, $c, m = nil, preceding = nil, attributes = nil, quoted_text = nil, escape_mark = nil, format_mark = nil, content = nil, old_behavior = nil, pass_key = nil, $writer = nil, subs = nil; + if ($gvars["~"] == null) $gvars["~"] = nil; + + + m = $gvars["~"]; + preceding = m['$[]'](1); + attributes = m['$[]'](2); + if ($truthy((quoted_text = m['$[]'](3))['$start_with?']($$($nesting, 'RS')))) { + escape_mark = $$($nesting, 'RS')}; + format_mark = m['$[]'](4); + content = m['$[]'](5); + if ($truthy(compat_mode)) { + old_behavior = true + } else if ($truthy((old_behavior = ($truthy($c = attributes) ? attributes['$end_with?']("x-") : $c)))) { + attributes = attributes.$slice(0, $rb_minus(attributes.$length(), 2))}; + if ($truthy(attributes)) { + + if ($truthy((($c = format_mark['$==']("`")) ? old_behavior['$!']() : format_mark['$==']("`")))) { + return self.$extract_inner_passthrough(content, "" + (preceding) + "[" + (attributes) + "]" + (escape_mark), attributes);}; + if ($truthy(escape_mark)) { + return "" + (preceding) + "[" + (attributes) + "]" + (quoted_text.$slice(1, quoted_text.$length())); + } else if (preceding['$==']($$($nesting, 'RS'))) { + + preceding = "" + "[" + (attributes) + "]"; + attributes = nil; + } else { + attributes = self.$parse_quoted_text_attributes(attributes) + }; + } else if ($truthy((($c = format_mark['$==']("`")) ? old_behavior['$!']() : format_mark['$==']("`")))) { + return self.$extract_inner_passthrough(content, "" + (preceding) + (escape_mark)); + } else if ($truthy(escape_mark)) { + return "" + (preceding) + (quoted_text.$slice(1, quoted_text.$length()));}; + pass_key = passes.$size(); + if ($truthy(compat_mode)) { + + $writer = [pass_key, $hash2(["text", "subs", "attributes", "type"], {"text": content, "subs": $$($nesting, 'BASIC_SUBS'), "attributes": attributes, "type": "monospaced"})]; + $send(passes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + } else if ($truthy(attributes)) { + if ($truthy(old_behavior)) { + + subs = (function() {if (format_mark['$==']("`")) { + return $$($nesting, 'BASIC_SUBS') + } else { + return $$($nesting, 'NORMAL_SUBS') + }; return nil; })(); + + $writer = [pass_key, $hash2(["text", "subs", "attributes", "type"], {"text": content, "subs": subs, "attributes": attributes, "type": "monospaced"})]; + $send(passes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + } else { + + $writer = [pass_key, $hash2(["text", "subs", "attributes", "type"], {"text": content, "subs": $$($nesting, 'BASIC_SUBS'), "attributes": attributes, "type": "unquoted"})]; + $send(passes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + } + } else { + + $writer = [pass_key, $hash2(["text", "subs"], {"text": content, "subs": $$($nesting, 'BASIC_SUBS')})]; + $send(passes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + return "" + (preceding) + ($$($nesting, 'PASS_START')) + (pass_key) + ($$($nesting, 'PASS_END'));}, TMP_9.$$s = self, TMP_9.$$arity = 0, TMP_9))}; + if ($truthy(($truthy($a = text['$include?'](":")) ? ($truthy($b = text['$include?']("stem:")) ? $b : text['$include?']("math:")) : $a))) { + text = $send(text, 'gsub', [$$($nesting, 'InlineStemMacroRx')], (TMP_10 = function(){var self = TMP_10.$$s || this, $c, m = nil, type = nil, content = nil, subs = nil, $writer = nil, pass_key = nil; + if (self.document == null) self.document = nil; + if ($gvars["~"] == null) $gvars["~"] = nil; + + + m = $gvars["~"]; + if ($truthy((($c = $gvars['~']) === nil ? nil : $c['$[]'](0))['$start_with?']($$($nesting, 'RS')))) { + return m['$[]'](0).$slice(1, m['$[]'](0).$length());}; + if ((type = m['$[]'](1).$to_sym())['$==']("stem")) { + type = $$($nesting, 'STEM_TYPE_ALIASES')['$[]'](self.document.$attributes()['$[]']("stem")).$to_sym()}; + content = self.$unescape_brackets(m['$[]'](3)); + subs = (function() {if ($truthy(m['$[]'](2))) { + + return self.$resolve_pass_subs(m['$[]'](2)); + } else { + + if ($truthy(self.document['$basebackend?']("html"))) { + return $$($nesting, 'BASIC_SUBS') + } else { + return nil + }; + }; return nil; })(); + + $writer = [(pass_key = passes.$size()), $hash2(["text", "subs", "type"], {"text": content, "subs": subs, "type": type})]; + $send(passes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + return "" + ($$($nesting, 'PASS_START')) + (pass_key) + ($$($nesting, 'PASS_END'));}, TMP_10.$$s = self, TMP_10.$$arity = 0, TMP_10))}; + return text; + }, TMP_Substitutors_extract_passthroughs_7.$$arity = 1); + + Opal.def(self, '$extract_inner_passthrough', TMP_Substitutors_extract_inner_passthrough_11 = function $$extract_inner_passthrough(text, pre, attributes) { + var $a, $b, self = this, $writer = nil, pass_key = nil; + if (self.passthroughs == null) self.passthroughs = nil; + + + + if (attributes == null) { + attributes = nil; + }; + if ($truthy(($truthy($a = ($truthy($b = text['$end_with?']("+")) ? text['$start_with?']("+", "\\+") : $b)) ? $$($nesting, 'SinglePlusInlinePassRx')['$=~'](text) : $a))) { + if ($truthy((($a = $gvars['~']) === nil ? nil : $a['$[]'](1)))) { + return "" + (pre) + "`+" + ((($a = $gvars['~']) === nil ? nil : $a['$[]'](2))) + "+`" + } else { + + + $writer = [(pass_key = self.passthroughs.$size()), (function() {if ($truthy(attributes)) { + return $hash2(["text", "subs", "attributes", "type"], {"text": (($a = $gvars['~']) === nil ? nil : $a['$[]'](2)), "subs": $$($nesting, 'BASIC_SUBS'), "attributes": attributes, "type": "unquoted"}) + } else { + return $hash2(["text", "subs"], {"text": (($a = $gvars['~']) === nil ? nil : $a['$[]'](2)), "subs": $$($nesting, 'BASIC_SUBS')}) + }; return nil; })()]; + $send(self.passthroughs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + return "" + (pre) + "`" + ($$($nesting, 'PASS_START')) + (pass_key) + ($$($nesting, 'PASS_END')) + "`"; + } + } else { + return "" + (pre) + "`" + (text) + "`" + }; + }, TMP_Substitutors_extract_inner_passthrough_11.$$arity = -3); + + Opal.def(self, '$restore_passthroughs', TMP_Substitutors_restore_passthroughs_12 = function $$restore_passthroughs(text, outer) { + var TMP_13, self = this, passes = nil; + if (self.passthroughs == null) self.passthroughs = nil; + + + + if (outer == null) { + outer = true; + }; + return (function() { try { + + passes = self.passthroughs; + return $send(text, 'gsub', [$$($nesting, 'PassSlotRx')], (TMP_13 = function(){var self = TMP_13.$$s || this, $a, pass = nil, subbed_text = nil, type = nil; + + + pass = passes['$[]']((($a = $gvars['~']) === nil ? nil : $a['$[]'](1)).$to_i()); + subbed_text = self.$apply_subs(pass['$[]']("text"), pass['$[]']("subs")); + if ($truthy((type = pass['$[]']("type")))) { + subbed_text = $$($nesting, 'Inline').$new(self, "quoted", subbed_text, $hash2(["type", "attributes"], {"type": type, "attributes": pass['$[]']("attributes")})).$convert()}; + if ($truthy(subbed_text['$include?']($$($nesting, 'PASS_START')))) { + return self.$restore_passthroughs(subbed_text, false) + } else { + return subbed_text + };}, TMP_13.$$s = self, TMP_13.$$arity = 0, TMP_13)); + } finally { + (function() {if ($truthy(outer)) { + return passes.$clear() + } else { + return nil + }; return nil; })() + }; })(); + }, TMP_Substitutors_restore_passthroughs_12.$$arity = -2); + if ($$($nesting, 'RUBY_ENGINE')['$==']("opal")) { + + + Opal.def(self, '$sub_quotes', TMP_Substitutors_sub_quotes_14 = function $$sub_quotes(text) { + var TMP_15, self = this, compat = nil; + if (self.document == null) self.document = nil; + + + if ($truthy($$($nesting, 'QuotedTextSniffRx')['$[]']((compat = self.document.$compat_mode()))['$match?'](text))) { + $send($$($nesting, 'QUOTE_SUBS')['$[]'](compat), 'each', [], (TMP_15 = function(type, scope, pattern){var self = TMP_15.$$s || this, TMP_16; + + + + if (type == null) { + type = nil; + }; + + if (scope == null) { + scope = nil; + }; + + if (pattern == null) { + pattern = nil; + }; + return (text = $send(text, 'gsub', [pattern], (TMP_16 = function(){var self = TMP_16.$$s || this; + if ($gvars["~"] == null) $gvars["~"] = nil; + + return self.$convert_quoted_text($gvars["~"], type, scope)}, TMP_16.$$s = self, TMP_16.$$arity = 0, TMP_16)));}, TMP_15.$$s = self, TMP_15.$$arity = 3, TMP_15))}; + return text; + }, TMP_Substitutors_sub_quotes_14.$$arity = 1); + + Opal.def(self, '$sub_replacements', TMP_Substitutors_sub_replacements_17 = function $$sub_replacements(text) { + var TMP_18, self = this; + + + if ($truthy($$($nesting, 'ReplaceableTextRx')['$match?'](text))) { + $send($$($nesting, 'REPLACEMENTS'), 'each', [], (TMP_18 = function(pattern, replacement, restore){var self = TMP_18.$$s || this, TMP_19; + + + + if (pattern == null) { + pattern = nil; + }; + + if (replacement == null) { + replacement = nil; + }; + + if (restore == null) { + restore = nil; + }; + return (text = $send(text, 'gsub', [pattern], (TMP_19 = function(){var self = TMP_19.$$s || this; + if ($gvars["~"] == null) $gvars["~"] = nil; + + return self.$do_replacement($gvars["~"], replacement, restore)}, TMP_19.$$s = self, TMP_19.$$arity = 0, TMP_19)));}, TMP_18.$$s = self, TMP_18.$$arity = 3, TMP_18))}; + return text; + }, TMP_Substitutors_sub_replacements_17.$$arity = 1); + } else { + nil + }; + if ($truthy($$$('::', 'RUBY_MIN_VERSION_1_9'))) { + + Opal.def(self, '$sub_specialchars', TMP_Substitutors_sub_specialchars_20 = function $$sub_specialchars(text) { + var $a, $b, self = this; + + if ($truthy(($truthy($a = ($truthy($b = text['$include?']("<")) ? $b : text['$include?']("&"))) ? $a : text['$include?'](">")))) { + + return text.$gsub($$($nesting, 'SpecialCharsRx'), $$($nesting, 'SpecialCharsTr')); + } else { + return text + } + }, TMP_Substitutors_sub_specialchars_20.$$arity = 1) + } else { + + Opal.def(self, '$sub_specialchars', TMP_Substitutors_sub_specialchars_21 = function $$sub_specialchars(text) { + var $a, $b, TMP_22, self = this; + + if ($truthy(($truthy($a = ($truthy($b = text['$include?']("<")) ? $b : text['$include?']("&"))) ? $a : text['$include?'](">")))) { + + return $send(text, 'gsub', [$$($nesting, 'SpecialCharsRx')], (TMP_22 = function(){var self = TMP_22.$$s || this, $c; + + return $$($nesting, 'SpecialCharsTr')['$[]']((($c = $gvars['~']) === nil ? nil : $c['$[]'](0)))}, TMP_22.$$s = self, TMP_22.$$arity = 0, TMP_22)); + } else { + return text + } + }, TMP_Substitutors_sub_specialchars_21.$$arity = 1) + }; + Opal.alias(self, "sub_specialcharacters", "sub_specialchars"); + + Opal.def(self, '$do_replacement', TMP_Substitutors_do_replacement_23 = function $$do_replacement(m, replacement, restore) { + var self = this, captured = nil, $case = nil; + + if ($truthy((captured = m['$[]'](0))['$include?']($$($nesting, 'RS')))) { + return captured.$sub($$($nesting, 'RS'), "") + } else { + return (function() {$case = restore; + if ("none"['$===']($case)) {return replacement} + else if ("bounding"['$===']($case)) {return "" + (m['$[]'](1)) + (replacement) + (m['$[]'](2))} + else {return "" + (m['$[]'](1)) + (replacement)}})() + } + }, TMP_Substitutors_do_replacement_23.$$arity = 3); + + Opal.def(self, '$sub_attributes', TMP_Substitutors_sub_attributes_24 = function $$sub_attributes(text, opts) { + var TMP_25, TMP_26, TMP_27, TMP_28, self = this, doc_attrs = nil, drop = nil, drop_line = nil, drop_empty_line = nil, attribute_undefined = nil, attribute_missing = nil, lines = nil; + if (self.document == null) self.document = nil; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + doc_attrs = self.document.$attributes(); + drop = (drop_line = (drop_empty_line = (attribute_undefined = (attribute_missing = nil)))); + text = $send(text, 'gsub', [$$($nesting, 'AttributeReferenceRx')], (TMP_25 = function(){var self = TMP_25.$$s || this, $a, $b, $c, $case = nil, args = nil, _ = nil, value = nil, key = nil; + if (self.document == null) self.document = nil; + + if ($truthy(($truthy($a = (($b = $gvars['~']) === nil ? nil : $b['$[]'](1))['$==']($$($nesting, 'RS'))) ? $a : (($b = $gvars['~']) === nil ? nil : $b['$[]'](4))['$==']($$($nesting, 'RS'))))) { + return "" + "{" + ((($a = $gvars['~']) === nil ? nil : $a['$[]'](2))) + "}" + } else if ($truthy((($a = $gvars['~']) === nil ? nil : $a['$[]'](3)))) { + return (function() {$case = (args = (($a = $gvars['~']) === nil ? nil : $a['$[]'](2)).$split(":", 3)).$shift(); + if ("set"['$===']($case)) { + $b = $$($nesting, 'Parser').$store_attribute(args['$[]'](0), ($truthy($c = args['$[]'](1)) ? $c : ""), self.document), $a = Opal.to_ary($b), (_ = ($a[0] == null ? nil : $a[0])), (value = ($a[1] == null ? nil : $a[1])), $b; + if ($truthy(($truthy($a = value) ? $a : (attribute_undefined = ($truthy($b = attribute_undefined) ? $b : ($truthy($c = doc_attrs['$[]']("attribute-undefined")) ? $c : $$($nesting, 'Compliance').$attribute_undefined())))['$!=']("drop-line")))) { + return (drop = (drop_empty_line = $$($nesting, 'DEL'))) + } else { + return (drop = (drop_line = $$($nesting, 'CAN'))) + };} + else if ("counter2"['$===']($case)) { + $send(self.document, 'counter', Opal.to_a(args)); + return (drop = (drop_empty_line = $$($nesting, 'DEL')));} + else {return $send(self.document, 'counter', Opal.to_a(args))}})() + } else if ($truthy(doc_attrs['$key?']((key = (($a = $gvars['~']) === nil ? nil : $a['$[]'](2)).$downcase())))) { + return doc_attrs['$[]'](key) + } else if ($truthy((value = $$($nesting, 'INTRINSIC_ATTRIBUTES')['$[]'](key)))) { + return value + } else { + return (function() {$case = (attribute_missing = ($truthy($a = attribute_missing) ? $a : ($truthy($b = ($truthy($c = opts['$[]']("attribute_missing")) ? $c : doc_attrs['$[]']("attribute-missing"))) ? $b : $$($nesting, 'Compliance').$attribute_missing()))); + if ("drop"['$===']($case)) {return (drop = (drop_empty_line = $$($nesting, 'DEL')))} + else if ("drop-line"['$===']($case)) { + self.$logger().$warn("" + "dropping line containing reference to missing attribute: " + (key)); + return (drop = (drop_line = $$($nesting, 'CAN')));} + else if ("warn"['$===']($case)) { + self.$logger().$warn("" + "skipping reference to missing attribute: " + (key)); + return (($a = $gvars['~']) === nil ? nil : $a['$[]'](0));} + else {return (($a = $gvars['~']) === nil ? nil : $a['$[]'](0))}})() + }}, TMP_25.$$s = self, TMP_25.$$arity = 0, TMP_25)); + if ($truthy(drop)) { + if ($truthy(drop_empty_line)) { + + lines = text.$tr_s($$($nesting, 'DEL'), $$($nesting, 'DEL')).$split($$($nesting, 'LF'), -1); + if ($truthy(drop_line)) { + return $send(lines, 'reject', [], (TMP_26 = function(line){var self = TMP_26.$$s || this, $a, $b, $c; + + + + if (line == null) { + line = nil; + }; + return ($truthy($a = ($truthy($b = ($truthy($c = line['$==']($$($nesting, 'DEL'))) ? $c : line['$==']($$($nesting, 'CAN')))) ? $b : line['$start_with?']($$($nesting, 'CAN')))) ? $a : line['$include?']($$($nesting, 'CAN')));}, TMP_26.$$s = self, TMP_26.$$arity = 1, TMP_26)).$join($$($nesting, 'LF')).$delete($$($nesting, 'DEL')) + } else { + return $send(lines, 'reject', [], (TMP_27 = function(line){var self = TMP_27.$$s || this; + + + + if (line == null) { + line = nil; + }; + return line['$==']($$($nesting, 'DEL'));}, TMP_27.$$s = self, TMP_27.$$arity = 1, TMP_27)).$join($$($nesting, 'LF')).$delete($$($nesting, 'DEL')) + }; + } else if ($truthy(text['$include?']($$($nesting, 'LF')))) { + return $send(text.$split($$($nesting, 'LF'), -1), 'reject', [], (TMP_28 = function(line){var self = TMP_28.$$s || this, $a, $b; + + + + if (line == null) { + line = nil; + }; + return ($truthy($a = ($truthy($b = line['$==']($$($nesting, 'CAN'))) ? $b : line['$start_with?']($$($nesting, 'CAN')))) ? $a : line['$include?']($$($nesting, 'CAN')));}, TMP_28.$$s = self, TMP_28.$$arity = 1, TMP_28)).$join($$($nesting, 'LF')) + } else { + return "" + } + } else { + return text + }; + }, TMP_Substitutors_sub_attributes_24.$$arity = -2); + + Opal.def(self, '$sub_macros', TMP_Substitutors_sub_macros_29 = function $$sub_macros(text) {try { + + var $a, $b, TMP_30, TMP_33, TMP_35, TMP_37, TMP_39, TMP_40, TMP_41, TMP_42, TMP_43, TMP_44, self = this, found = nil, found_square_bracket = nil, $writer = nil, found_colon = nil, found_macroish = nil, found_macroish_short = nil, doc_attrs = nil, doc = nil, extensions = nil; + if (self.document == null) self.document = nil; + + + found = $hash2([], {}); + found_square_bracket = (($writer = ["square_bracket", text['$include?']("[")]), $send(found, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]); + found_colon = text['$include?'](":"); + found_macroish = (($writer = ["macroish", ($truthy($a = found_square_bracket) ? found_colon : $a)]), $send(found, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]); + found_macroish_short = ($truthy($a = found_macroish) ? text['$include?'](":[") : $a); + doc_attrs = (doc = self.document).$attributes(); + if ($truthy(doc_attrs['$key?']("experimental"))) { + + if ($truthy(($truthy($a = found_macroish_short) ? ($truthy($b = text['$include?']("kbd:")) ? $b : text['$include?']("btn:")) : $a))) { + text = $send(text, 'gsub', [$$($nesting, 'InlineKbdBtnMacroRx')], (TMP_30 = function(){var self = TMP_30.$$s || this, $c, TMP_31, TMP_32, keys = nil, delim_idx = nil, delim = nil; + + if ($truthy((($c = $gvars['~']) === nil ? nil : $c['$[]'](1)))) { + return (($c = $gvars['~']) === nil ? nil : $c['$[]'](0)).$slice(1, (($c = $gvars['~']) === nil ? nil : $c['$[]'](0)).$length()) + } else if ((($c = $gvars['~']) === nil ? nil : $c['$[]'](2))['$==']("kbd")) { + + if ($truthy((keys = (($c = $gvars['~']) === nil ? nil : $c['$[]'](3)).$strip())['$include?']($$($nesting, 'R_SB')))) { + keys = keys.$gsub($$($nesting, 'ESC_R_SB'), $$($nesting, 'R_SB'))}; + if ($truthy(($truthy($c = $rb_gt(keys.$length(), 1)) ? (delim_idx = (function() {if ($truthy((delim_idx = keys.$index(",", 1)))) { + return [delim_idx, keys.$index("+", 1)].$compact().$min() + } else { + + return keys.$index("+", 1); + }; return nil; })()) : $c))) { + + delim = keys.$slice(delim_idx, 1); + if ($truthy(keys['$end_with?'](delim))) { + + keys = $send(keys.$chop().$split(delim, -1), 'map', [], (TMP_31 = function(key){var self = TMP_31.$$s || this; + + + + if (key == null) { + key = nil; + }; + return key.$strip();}, TMP_31.$$s = self, TMP_31.$$arity = 1, TMP_31)); + + $writer = [-1, "" + (keys['$[]'](-1)) + (delim)]; + $send(keys, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + } else { + keys = $send(keys.$split(delim), 'map', [], (TMP_32 = function(key){var self = TMP_32.$$s || this; + + + + if (key == null) { + key = nil; + }; + return key.$strip();}, TMP_32.$$s = self, TMP_32.$$arity = 1, TMP_32)) + }; + } else { + keys = [keys] + }; + return $$($nesting, 'Inline').$new(self, "kbd", nil, $hash2(["attributes"], {"attributes": $hash2(["keys"], {"keys": keys})})).$convert(); + } else { + return $$($nesting, 'Inline').$new(self, "button", self.$unescape_bracketed_text((($c = $gvars['~']) === nil ? nil : $c['$[]'](3)))).$convert() + }}, TMP_30.$$s = self, TMP_30.$$arity = 0, TMP_30))}; + if ($truthy(($truthy($a = found_macroish) ? text['$include?']("menu:") : $a))) { + text = $send(text, 'gsub', [$$($nesting, 'InlineMenuMacroRx')], (TMP_33 = function(){var self = TMP_33.$$s || this, $c, TMP_34, m = nil, menu = nil, items = nil, delim = nil, submenus = nil, menuitem = nil; + if ($gvars["~"] == null) $gvars["~"] = nil; + + + m = $gvars["~"]; + if ($truthy((($c = $gvars['~']) === nil ? nil : $c['$[]'](0))['$start_with?']($$($nesting, 'RS')))) { + return m['$[]'](0).$slice(1, m['$[]'](0).$length());}; + $c = [m['$[]'](1), m['$[]'](2)], (menu = $c[0]), (items = $c[1]), $c; + if ($truthy(items)) { + + if ($truthy(items['$include?']($$($nesting, 'R_SB')))) { + items = items.$gsub($$($nesting, 'ESC_R_SB'), $$($nesting, 'R_SB'))}; + if ($truthy((delim = (function() {if ($truthy(items['$include?'](">"))) { + return ">" + } else { + + if ($truthy(items['$include?'](","))) { + return "," + } else { + return nil + }; + }; return nil; })()))) { + + submenus = $send(items.$split(delim), 'map', [], (TMP_34 = function(it){var self = TMP_34.$$s || this; + + + + if (it == null) { + it = nil; + }; + return it.$strip();}, TMP_34.$$s = self, TMP_34.$$arity = 1, TMP_34)); + menuitem = submenus.$pop(); + } else { + $c = [[], items.$rstrip()], (submenus = $c[0]), (menuitem = $c[1]), $c + }; + } else { + $c = [[], nil], (submenus = $c[0]), (menuitem = $c[1]), $c + }; + return $$($nesting, 'Inline').$new(self, "menu", nil, $hash2(["attributes"], {"attributes": $hash2(["menu", "submenus", "menuitem"], {"menu": menu, "submenus": submenus, "menuitem": menuitem})})).$convert();}, TMP_33.$$s = self, TMP_33.$$arity = 0, TMP_33))}; + if ($truthy(($truthy($a = text['$include?']("\"")) ? text['$include?'](">") : $a))) { + text = $send(text, 'gsub', [$$($nesting, 'InlineMenuRx')], (TMP_35 = function(){var self = TMP_35.$$s || this, $c, $d, TMP_36, m = nil, input = nil, menu = nil, submenus = nil, menuitem = nil; + if ($gvars["~"] == null) $gvars["~"] = nil; + + + m = $gvars["~"]; + if ($truthy((($c = $gvars['~']) === nil ? nil : $c['$[]'](0))['$start_with?']($$($nesting, 'RS')))) { + return m['$[]'](0).$slice(1, m['$[]'](0).$length());}; + input = m['$[]'](1); + $d = $send(input.$split(">"), 'map', [], (TMP_36 = function(it){var self = TMP_36.$$s || this; + + + + if (it == null) { + it = nil; + }; + return it.$strip();}, TMP_36.$$s = self, TMP_36.$$arity = 1, TMP_36)), $c = Opal.to_ary($d), (menu = ($c[0] == null ? nil : $c[0])), (submenus = $slice.call($c, 1)), $d; + menuitem = submenus.$pop(); + return $$($nesting, 'Inline').$new(self, "menu", nil, $hash2(["attributes"], {"attributes": $hash2(["menu", "submenus", "menuitem"], {"menu": menu, "submenus": submenus, "menuitem": menuitem})})).$convert();}, TMP_35.$$s = self, TMP_35.$$arity = 0, TMP_35))};}; + if ($truthy(($truthy($a = (extensions = doc.$extensions())) ? extensions['$inline_macros?']() : $a))) { + $send(extensions.$inline_macros(), 'each', [], (TMP_37 = function(extension){var self = TMP_37.$$s || this, TMP_38; + + + + if (extension == null) { + extension = nil; + }; + return (text = $send(text, 'gsub', [extension.$instance().$regexp()], (TMP_38 = function(){var self = TMP_38.$$s || this, $c, m = nil, target = nil, content = nil, extconf = nil, attributes = nil, replacement = nil; + if ($gvars["~"] == null) $gvars["~"] = nil; + + + m = $gvars["~"]; + if ($truthy((($c = $gvars['~']) === nil ? nil : $c['$[]'](0))['$start_with?']($$($nesting, 'RS')))) { + return m['$[]'](0).$slice(1, m['$[]'](0).$length());}; + if ($truthy((function() { try { + return m.$names() + } catch ($err) { + if (Opal.rescue($err, [$$($nesting, 'StandardError')])) { + try { + return [] + } finally { Opal.pop_exception() } + } else { throw $err; } + }})()['$empty?']())) { + $c = [m['$[]'](1), m['$[]'](2), extension.$config()], (target = $c[0]), (content = $c[1]), (extconf = $c[2]), $c + } else { + $c = [(function() { try { + return m['$[]']("target") + } catch ($err) { + if (Opal.rescue($err, [$$($nesting, 'StandardError')])) { + try { + return nil + } finally { Opal.pop_exception() } + } else { throw $err; } + }})(), (function() { try { + return m['$[]']("content") + } catch ($err) { + if (Opal.rescue($err, [$$($nesting, 'StandardError')])) { + try { + return nil + } finally { Opal.pop_exception() } + } else { throw $err; } + }})(), extension.$config()], (target = $c[0]), (content = $c[1]), (extconf = $c[2]), $c + }; + attributes = (function() {if ($truthy((attributes = extconf['$[]']("default_attrs")))) { + return attributes.$dup() + } else { + return $hash2([], {}) + }; return nil; })(); + if ($truthy(content['$nil_or_empty?']())) { + if ($truthy(($truthy($c = content) ? extconf['$[]']("content_model")['$!=']("attributes") : $c))) { + + $writer = ["text", content]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];} + } else { + + content = self.$unescape_bracketed_text(content); + if (extconf['$[]']("content_model")['$==']("attributes")) { + self.$parse_attributes(content, ($truthy($c = extconf['$[]']("pos_attrs")) ? $c : []), $hash2(["into"], {"into": attributes})) + } else { + + $writer = ["text", content]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + }; + replacement = extension.$process_method()['$[]'](self, ($truthy($c = target) ? $c : content), attributes); + if ($truthy($$($nesting, 'Inline')['$==='](replacement))) { + return replacement.$convert() + } else { + return replacement + };}, TMP_38.$$s = self, TMP_38.$$arity = 0, TMP_38)));}, TMP_37.$$s = self, TMP_37.$$arity = 1, TMP_37))}; + if ($truthy(($truthy($a = found_macroish) ? ($truthy($b = text['$include?']("image:")) ? $b : text['$include?']("icon:")) : $a))) { + text = $send(text, 'gsub', [$$($nesting, 'InlineImageMacroRx')], (TMP_39 = function(){var self = TMP_39.$$s || this, $c, m = nil, captured = nil, type = nil, posattrs = nil, target = nil, attrs = nil; + if ($gvars["~"] == null) $gvars["~"] = nil; + + + m = $gvars["~"]; + if ($truthy((captured = (($c = $gvars['~']) === nil ? nil : $c['$[]'](0)))['$start_with?']($$($nesting, 'RS')))) { + return captured.$slice(1, captured.$length()); + } else if ($truthy(captured['$start_with?']("icon:"))) { + $c = ["icon", ["size"]], (type = $c[0]), (posattrs = $c[1]), $c + } else { + $c = ["image", ["alt", "width", "height"]], (type = $c[0]), (posattrs = $c[1]), $c + }; + if ($truthy((target = m['$[]'](1))['$include?']($$($nesting, 'ATTR_REF_HEAD')))) { + target = self.$sub_attributes(target)}; + attrs = self.$parse_attributes(m['$[]'](2), posattrs, $hash2(["unescape_input"], {"unescape_input": true})); + if (type['$==']("icon")) { + } else { + doc.$register("images", [target, (($writer = ["imagesdir", doc_attrs['$[]']("imagesdir")]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])]) + }; + ($truthy($c = attrs['$[]']("alt")) ? $c : (($writer = ["alt", (($writer = ["default-alt", $$($nesting, 'Helpers').$basename(target, true).$tr("_-", " ")]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + return $$($nesting, 'Inline').$new(self, "image", nil, $hash2(["type", "target", "attributes"], {"type": type, "target": target, "attributes": attrs})).$convert();}, TMP_39.$$s = self, TMP_39.$$arity = 0, TMP_39))}; + if ($truthy(($truthy($a = ($truthy($b = text['$include?']("((")) ? text['$include?']("))") : $b)) ? $a : ($truthy($b = found_macroish_short) ? text['$include?']("dexterm") : $b)))) { + text = $send(text, 'gsub', [$$($nesting, 'InlineIndextermMacroRx')], (TMP_40 = function(){var self = TMP_40.$$s || this, $c, captured = nil, $case = nil, terms = nil, term = nil, visible = nil, before = nil, after = nil, subbed_term = nil; + + + captured = (($c = $gvars['~']) === nil ? nil : $c['$[]'](0)); + return (function() {$case = (($c = $gvars['~']) === nil ? nil : $c['$[]'](1)); + if ("indexterm"['$===']($case)) { + text = (($c = $gvars['~']) === nil ? nil : $c['$[]'](2)); + if ($truthy(captured['$start_with?']($$($nesting, 'RS')))) { + return captured.$slice(1, captured.$length());}; + terms = self.$split_simple_csv(self.$normalize_string(text, true)); + doc.$register("indexterms", terms); + return $$($nesting, 'Inline').$new(self, "indexterm", nil, $hash2(["attributes"], {"attributes": $hash2(["terms"], {"terms": terms})})).$convert();} + else if ("indexterm2"['$===']($case)) { + text = (($c = $gvars['~']) === nil ? nil : $c['$[]'](2)); + if ($truthy(captured['$start_with?']($$($nesting, 'RS')))) { + return captured.$slice(1, captured.$length());}; + term = self.$normalize_string(text, true); + doc.$register("indexterms", [term]); + return $$($nesting, 'Inline').$new(self, "indexterm", term, $hash2(["type"], {"type": "visible"})).$convert();} + else { + text = (($c = $gvars['~']) === nil ? nil : $c['$[]'](3)); + if ($truthy(captured['$start_with?']($$($nesting, 'RS')))) { + if ($truthy(($truthy($c = text['$start_with?']("(")) ? text['$end_with?'](")") : $c))) { + + text = text.$slice(1, $rb_minus(text.$length(), 2)); + $c = [true, "(", ")"], (visible = $c[0]), (before = $c[1]), (after = $c[2]), $c; + } else { + return captured.$slice(1, captured.$length()); + } + } else { + + visible = true; + if ($truthy(text['$start_with?']("("))) { + if ($truthy(text['$end_with?'](")"))) { + $c = [text.$slice(1, $rb_minus(text.$length(), 2)), false], (text = $c[0]), (visible = $c[1]), $c + } else { + $c = [text.$slice(1, text.$length()), "(", ""], (text = $c[0]), (before = $c[1]), (after = $c[2]), $c + } + } else if ($truthy(text['$end_with?'](")"))) { + $c = [text.$slice(0, $rb_minus(text.$length(), 1)), "", ")"], (text = $c[0]), (before = $c[1]), (after = $c[2]), $c}; + }; + if ($truthy(visible)) { + + term = self.$normalize_string(text); + doc.$register("indexterms", [term]); + subbed_term = $$($nesting, 'Inline').$new(self, "indexterm", term, $hash2(["type"], {"type": "visible"})).$convert(); + } else { + + terms = self.$split_simple_csv(self.$normalize_string(text)); + doc.$register("indexterms", terms); + subbed_term = $$($nesting, 'Inline').$new(self, "indexterm", nil, $hash2(["attributes"], {"attributes": $hash2(["terms"], {"terms": terms})})).$convert(); + }; + if ($truthy(before)) { + return "" + (before) + (subbed_term) + (after) + } else { + return subbed_term + };}})();}, TMP_40.$$s = self, TMP_40.$$arity = 0, TMP_40))}; + if ($truthy(($truthy($a = found_colon) ? text['$include?']("://") : $a))) { + text = $send(text, 'gsub', [$$($nesting, 'InlineLinkRx')], (TMP_41 = function(){var self = TMP_41.$$s || this, $c, $d, m = nil, target = nil, macro = nil, prefix = nil, suffix = nil, $case = nil, attrs = nil, link_opts = nil; + if ($gvars["~"] == null) $gvars["~"] = nil; + + + m = $gvars["~"]; + if ($truthy((target = (($c = $gvars['~']) === nil ? nil : $c['$[]'](2)))['$start_with?']($$($nesting, 'RS')))) { + return "" + (m['$[]'](1)) + (target.$slice(1, target.$length())) + (m['$[]'](3));}; + $c = [m['$[]'](1), ($truthy($d = (macro = m['$[]'](3))) ? $d : ""), ""], (prefix = $c[0]), (text = $c[1]), (suffix = $c[2]), $c; + if (prefix['$==']("link:")) { + if ($truthy(macro)) { + prefix = "" + } else { + return m['$[]'](0); + }}; + if ($truthy(($truthy($c = macro) ? $c : $$($nesting, 'UriTerminatorRx')['$!~'](target)))) { + } else { + + $case = (($c = $gvars['~']) === nil ? nil : $c['$[]'](0)); + if (")"['$===']($case)) { + target = target.$chop(); + suffix = ")";} + else if (";"['$===']($case)) {if ($truthy(($truthy($c = prefix['$start_with?']("<")) ? target['$end_with?'](">") : $c))) { + + prefix = prefix.$slice(4, prefix.$length()); + target = target.$slice(0, $rb_minus(target.$length(), 4)); + } else if ($truthy((target = target.$chop())['$end_with?'](")"))) { + + target = target.$chop(); + suffix = ");"; + } else { + suffix = ";" + }} + else if (":"['$===']($case)) {if ($truthy((target = target.$chop())['$end_with?'](")"))) { + + target = target.$chop(); + suffix = "):"; + } else { + suffix = ":" + }}; + if ($truthy(target['$end_with?']("://"))) { + Opal.ret(m['$[]'](0))}; + }; + $c = [nil, $hash2(["type"], {"type": "link"})], (attrs = $c[0]), (link_opts = $c[1]), $c; + if ($truthy(text['$empty?']())) { + } else { + + if ($truthy(text['$include?']($$($nesting, 'R_SB')))) { + text = text.$gsub($$($nesting, 'ESC_R_SB'), $$($nesting, 'R_SB'))}; + if ($truthy(($truthy($c = doc.$compat_mode()['$!']()) ? text['$include?']("=") : $c))) { + + text = ($truthy($c = (attrs = $$($nesting, 'AttributeList').$new(text, self).$parse())['$[]'](1)) ? $c : ""); + if ($truthy(attrs['$key?']("id"))) { + + $writer = ["id", attrs.$delete("id")]; + $send(link_opts, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];};}; + if ($truthy(text['$end_with?']("^"))) { + + text = text.$chop(); + if ($truthy(attrs)) { + ($truthy($c = attrs['$[]']("window")) ? $c : (($writer = ["window", "_blank"]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])) + } else { + attrs = $hash2(["window"], {"window": "_blank"}) + };}; + }; + if ($truthy(text['$empty?']())) { + + text = (function() {if ($truthy(doc_attrs['$key?']("hide-uri-scheme"))) { + + return target.$sub($$($nesting, 'UriSniffRx'), ""); + } else { + return target + }; return nil; })(); + if ($truthy(attrs)) { + + $writer = ["role", (function() {if ($truthy(attrs['$key?']("role"))) { + return "" + "bare " + (attrs['$[]']("role")) + } else { + return "bare" + }; return nil; })()]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + } else { + attrs = $hash2(["role"], {"role": "bare"}) + };}; + doc.$register("links", (($writer = ["target", target]), $send(link_opts, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + if ($truthy(attrs)) { + + $writer = ["attributes", attrs]; + $send(link_opts, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + return "" + (prefix) + ($$($nesting, 'Inline').$new(self, "anchor", text, link_opts).$convert()) + (suffix);}, TMP_41.$$s = self, TMP_41.$$arity = 0, TMP_41))}; + if ($truthy(($truthy($a = found_macroish) ? ($truthy($b = text['$include?']("link:")) ? $b : text['$include?']("mailto:")) : $a))) { + text = $send(text, 'gsub', [$$($nesting, 'InlineLinkMacroRx')], (TMP_42 = function(){var self = TMP_42.$$s || this, $c, m = nil, target = nil, mailto = nil, attrs = nil, link_opts = nil; + if ($gvars["~"] == null) $gvars["~"] = nil; + + + m = $gvars["~"]; + if ($truthy((($c = $gvars['~']) === nil ? nil : $c['$[]'](0))['$start_with?']($$($nesting, 'RS')))) { + return m['$[]'](0).$slice(1, m['$[]'](0).$length());}; + target = (function() {if ($truthy((mailto = m['$[]'](1)))) { + return "" + "mailto:" + (m['$[]'](2)) + } else { + return m['$[]'](2) + }; return nil; })(); + $c = [nil, $hash2(["type"], {"type": "link"})], (attrs = $c[0]), (link_opts = $c[1]), $c; + if ($truthy((text = m['$[]'](3))['$empty?']())) { + } else { + + if ($truthy(text['$include?']($$($nesting, 'R_SB')))) { + text = text.$gsub($$($nesting, 'ESC_R_SB'), $$($nesting, 'R_SB'))}; + if ($truthy(mailto)) { + if ($truthy(($truthy($c = doc.$compat_mode()['$!']()) ? text['$include?'](",") : $c))) { + + text = ($truthy($c = (attrs = $$($nesting, 'AttributeList').$new(text, self).$parse())['$[]'](1)) ? $c : ""); + if ($truthy(attrs['$key?']("id"))) { + + $writer = ["id", attrs.$delete("id")]; + $send(link_opts, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if ($truthy(attrs['$key?'](2))) { + if ($truthy(attrs['$key?'](3))) { + target = "" + (target) + "?subject=" + ($$($nesting, 'Helpers').$uri_encode(attrs['$[]'](2))) + "&body=" + ($$($nesting, 'Helpers').$uri_encode(attrs['$[]'](3))) + } else { + target = "" + (target) + "?subject=" + ($$($nesting, 'Helpers').$uri_encode(attrs['$[]'](2))) + }};} + } else if ($truthy(($truthy($c = doc.$compat_mode()['$!']()) ? text['$include?']("=") : $c))) { + + text = ($truthy($c = (attrs = $$($nesting, 'AttributeList').$new(text, self).$parse())['$[]'](1)) ? $c : ""); + if ($truthy(attrs['$key?']("id"))) { + + $writer = ["id", attrs.$delete("id")]; + $send(link_opts, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];};}; + if ($truthy(text['$end_with?']("^"))) { + + text = text.$chop(); + if ($truthy(attrs)) { + ($truthy($c = attrs['$[]']("window")) ? $c : (($writer = ["window", "_blank"]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])) + } else { + attrs = $hash2(["window"], {"window": "_blank"}) + };}; + }; + if ($truthy(text['$empty?']())) { + if ($truthy(mailto)) { + text = m['$[]'](2) + } else { + + if ($truthy(doc_attrs['$key?']("hide-uri-scheme"))) { + if ($truthy((text = target.$sub($$($nesting, 'UriSniffRx'), ""))['$empty?']())) { + text = target} + } else { + text = target + }; + if ($truthy(attrs)) { + + $writer = ["role", (function() {if ($truthy(attrs['$key?']("role"))) { + return "" + "bare " + (attrs['$[]']("role")) + } else { + return "bare" + }; return nil; })()]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + } else { + attrs = $hash2(["role"], {"role": "bare"}) + }; + }}; + doc.$register("links", (($writer = ["target", target]), $send(link_opts, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + if ($truthy(attrs)) { + + $writer = ["attributes", attrs]; + $send(link_opts, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + return $$($nesting, 'Inline').$new(self, "anchor", text, link_opts).$convert();}, TMP_42.$$s = self, TMP_42.$$arity = 0, TMP_42))}; + if ($truthy(text['$include?']("@"))) { + text = $send(text, 'gsub', [$$($nesting, 'InlineEmailRx')], (TMP_43 = function(){var self = TMP_43.$$s || this, $c, $d, address = nil, tip = nil, target = nil; + + + $c = [(($d = $gvars['~']) === nil ? nil : $d['$[]'](0)), (($d = $gvars['~']) === nil ? nil : $d['$[]'](1))], (address = $c[0]), (tip = $c[1]), $c; + if ($truthy(tip)) { + return (function() {if (tip['$==']($$($nesting, 'RS'))) { + + return address.$slice(1, address.$length()); + } else { + return address + }; return nil; })();}; + target = "" + "mailto:" + (address); + doc.$register("links", target); + return $$($nesting, 'Inline').$new(self, "anchor", address, $hash2(["type", "target"], {"type": "link", "target": target})).$convert();}, TMP_43.$$s = self, TMP_43.$$arity = 0, TMP_43))}; + if ($truthy(($truthy($a = found_macroish) ? text['$include?']("tnote") : $a))) { + text = $send(text, 'gsub', [$$($nesting, 'InlineFootnoteMacroRx')], (TMP_44 = function(){var self = TMP_44.$$s || this, $c, $d, $e, TMP_45, m = nil, id = nil, index = nil, type = nil, target = nil, footnote = nil; + if ($gvars["~"] == null) $gvars["~"] = nil; + + + m = $gvars["~"]; + if ($truthy((($c = $gvars['~']) === nil ? nil : $c['$[]'](0))['$start_with?']($$($nesting, 'RS')))) { + return m['$[]'](0).$slice(1, m['$[]'](0).$length());}; + if ($truthy(m['$[]'](1))) { + $d = ($truthy($e = m['$[]'](3)) ? $e : "").$split(",", 2), $c = Opal.to_ary($d), (id = ($c[0] == null ? nil : $c[0])), (text = ($c[1] == null ? nil : $c[1])), $d + } else { + $c = [m['$[]'](2), m['$[]'](3)], (id = $c[0]), (text = $c[1]), $c + }; + if ($truthy(id)) { + if ($truthy(text)) { + + text = self.$restore_passthroughs(self.$sub_inline_xrefs(self.$sub_inline_anchors(self.$normalize_string(text, true))), false); + index = doc.$counter("footnote-number"); + doc.$register("footnotes", $$$($$($nesting, 'Document'), 'Footnote').$new(index, id, text)); + $c = ["ref", nil], (type = $c[0]), (target = $c[1]), $c; + } else { + + if ($truthy((footnote = $send(doc.$footnotes(), 'find', [], (TMP_45 = function(candidate){var self = TMP_45.$$s || this; + + + + if (candidate == null) { + candidate = nil; + }; + return candidate.$id()['$=='](id);}, TMP_45.$$s = self, TMP_45.$$arity = 1, TMP_45))))) { + $c = [footnote.$index(), footnote.$text()], (index = $c[0]), (text = $c[1]), $c + } else { + + self.$logger().$warn("" + "invalid footnote reference: " + (id)); + $c = [nil, id], (index = $c[0]), (text = $c[1]), $c; + }; + $c = ["xref", id, nil], (type = $c[0]), (target = $c[1]), (id = $c[2]), $c; + } + } else if ($truthy(text)) { + + text = self.$restore_passthroughs(self.$sub_inline_xrefs(self.$sub_inline_anchors(self.$normalize_string(text, true))), false); + index = doc.$counter("footnote-number"); + doc.$register("footnotes", $$$($$($nesting, 'Document'), 'Footnote').$new(index, id, text)); + type = (target = nil); + } else { + return m['$[]'](0); + }; + return $$($nesting, 'Inline').$new(self, "footnote", text, $hash2(["attributes", "id", "target", "type"], {"attributes": $hash2(["index"], {"index": index}), "id": id, "target": target, "type": type})).$convert();}, TMP_44.$$s = self, TMP_44.$$arity = 0, TMP_44))}; + return self.$sub_inline_xrefs(self.$sub_inline_anchors(text, found), found); + } catch ($returner) { if ($returner === Opal.returner) { return $returner.$v } throw $returner; } + }, TMP_Substitutors_sub_macros_29.$$arity = 1); + + Opal.def(self, '$sub_inline_anchors', TMP_Substitutors_sub_inline_anchors_46 = function $$sub_inline_anchors(text, found) { + var $a, TMP_47, $b, $c, TMP_48, self = this; + if (self.context == null) self.context = nil; + if (self.parent == null) self.parent = nil; + + + + if (found == null) { + found = nil; + }; + if ($truthy((($a = self.context['$==']("list_item")) ? self.parent.$style()['$==']("bibliography") : self.context['$==']("list_item")))) { + text = $send(text, 'sub', [$$($nesting, 'InlineBiblioAnchorRx')], (TMP_47 = function(){var self = TMP_47.$$s || this, $b, $c; + + return $$($nesting, 'Inline').$new(self, "anchor", "" + "[" + (($truthy($b = (($c = $gvars['~']) === nil ? nil : $c['$[]'](2))) ? $b : (($c = $gvars['~']) === nil ? nil : $c['$[]'](1)))) + "]", $hash2(["type", "id", "target"], {"type": "bibref", "id": (($b = $gvars['~']) === nil ? nil : $b['$[]'](1)), "target": (($b = $gvars['~']) === nil ? nil : $b['$[]'](1))})).$convert()}, TMP_47.$$s = self, TMP_47.$$arity = 0, TMP_47))}; + if ($truthy(($truthy($a = ($truthy($b = ($truthy($c = found['$!']()) ? $c : found['$[]']("square_bracket"))) ? text['$include?']("[[") : $b)) ? $a : ($truthy($b = ($truthy($c = found['$!']()) ? $c : found['$[]']("macroish"))) ? text['$include?']("or:") : $b)))) { + text = $send(text, 'gsub', [$$($nesting, 'InlineAnchorRx')], (TMP_48 = function(){var self = TMP_48.$$s || this, $d, $e, id = nil, reftext = nil; + + + if ($truthy((($d = $gvars['~']) === nil ? nil : $d['$[]'](1)))) { + return (($d = $gvars['~']) === nil ? nil : $d['$[]'](0)).$slice(1, (($d = $gvars['~']) === nil ? nil : $d['$[]'](0)).$length());}; + if ($truthy((id = (($d = $gvars['~']) === nil ? nil : $d['$[]'](2))))) { + reftext = (($d = $gvars['~']) === nil ? nil : $d['$[]'](3)) + } else { + + id = (($d = $gvars['~']) === nil ? nil : $d['$[]'](4)); + if ($truthy(($truthy($d = (reftext = (($e = $gvars['~']) === nil ? nil : $e['$[]'](5)))) ? reftext['$include?']($$($nesting, 'R_SB')) : $d))) { + reftext = reftext.$gsub($$($nesting, 'ESC_R_SB'), $$($nesting, 'R_SB'))}; + }; + return $$($nesting, 'Inline').$new(self, "anchor", reftext, $hash2(["type", "id", "target"], {"type": "ref", "id": id, "target": id})).$convert();}, TMP_48.$$s = self, TMP_48.$$arity = 0, TMP_48))}; + return text; + }, TMP_Substitutors_sub_inline_anchors_46.$$arity = -2); + + Opal.def(self, '$sub_inline_xrefs', TMP_Substitutors_sub_inline_xrefs_49 = function $$sub_inline_xrefs(content, found) { + var $a, $b, TMP_50, self = this; + + + + if (found == null) { + found = nil; + }; + if ($truthy(($truthy($a = ($truthy($b = (function() {if ($truthy(found)) { + return found['$[]']("macroish") + } else { + + return content['$include?']("["); + }; return nil; })()) ? content['$include?']("xref:") : $b)) ? $a : ($truthy($b = content['$include?']("&")) ? content['$include?']("lt;&") : $b)))) { + content = $send(content, 'gsub', [$$($nesting, 'InlineXrefMacroRx')], (TMP_50 = function(){var self = TMP_50.$$s || this, $c, $d, m = nil, attrs = nil, doc = nil, refid = nil, text = nil, macro = nil, fragment = nil, hash_idx = nil, fragment_len = nil, path = nil, ext = nil, src2src = nil, target = nil; + if (self.document == null) self.document = nil; + if ($gvars["~"] == null) $gvars["~"] = nil; + if ($gvars.VERBOSE == null) $gvars.VERBOSE = nil; + + + m = $gvars["~"]; + if ($truthy((($c = $gvars['~']) === nil ? nil : $c['$[]'](0))['$start_with?']($$($nesting, 'RS')))) { + return m['$[]'](0).$slice(1, m['$[]'](0).$length());}; + $c = [$hash2([], {}), self.document], (attrs = $c[0]), (doc = $c[1]), $c; + if ($truthy((refid = m['$[]'](1)))) { + + $d = refid.$split(",", 2), $c = Opal.to_ary($d), (refid = ($c[0] == null ? nil : $c[0])), (text = ($c[1] == null ? nil : $c[1])), $d; + if ($truthy(text)) { + text = text.$lstrip()}; + } else { + + macro = true; + refid = m['$[]'](2); + if ($truthy((text = m['$[]'](3)))) { + + if ($truthy(text['$include?']($$($nesting, 'R_SB')))) { + text = text.$gsub($$($nesting, 'ESC_R_SB'), $$($nesting, 'R_SB'))}; + if ($truthy(($truthy($c = doc.$compat_mode()['$!']()) ? text['$include?']("=") : $c))) { + text = $$($nesting, 'AttributeList').$new(text, self).$parse_into(attrs)['$[]'](1)};}; + }; + if ($truthy(doc.$compat_mode())) { + fragment = refid + } else if ($truthy((hash_idx = refid.$index("#")))) { + if ($truthy($rb_gt(hash_idx, 0))) { + + if ($truthy($rb_gt((fragment_len = $rb_minus($rb_minus(refid.$length(), hash_idx), 1)), 0))) { + $c = [refid.$slice(0, hash_idx), refid.$slice($rb_plus(hash_idx, 1), fragment_len)], (path = $c[0]), (fragment = $c[1]), $c + } else { + path = refid.$slice(0, hash_idx) + }; + if ($truthy((ext = $$$('::', 'File').$extname(path))['$empty?']())) { + src2src = path + } else if ($truthy($$($nesting, 'ASCIIDOC_EXTENSIONS')['$[]'](ext))) { + src2src = (path = path.$slice(0, $rb_minus(path.$length(), ext.$length())))}; + } else { + $c = [refid, refid.$slice(1, refid.$length())], (target = $c[0]), (fragment = $c[1]), $c + } + } else if ($truthy(($truthy($c = macro) ? refid['$end_with?'](".adoc") : $c))) { + src2src = (path = refid.$slice(0, $rb_minus(refid.$length(), 5))) + } else { + fragment = refid + }; + if ($truthy(target)) { + + refid = fragment; + if ($truthy(($truthy($c = $gvars.VERBOSE) ? doc.$catalog()['$[]']("ids")['$key?'](refid)['$!']() : $c))) { + self.$logger().$warn("" + "invalid reference: " + (refid))}; + } else if ($truthy(path)) { + if ($truthy(($truthy($c = src2src) ? ($truthy($d = doc.$attributes()['$[]']("docname")['$=='](path)) ? $d : doc.$catalog()['$[]']("includes")['$[]'](path)) : $c))) { + if ($truthy(fragment)) { + + $c = [fragment, nil, "" + "#" + (fragment)], (refid = $c[0]), (path = $c[1]), (target = $c[2]), $c; + if ($truthy(($truthy($c = $gvars.VERBOSE) ? doc.$catalog()['$[]']("ids")['$key?'](refid)['$!']() : $c))) { + self.$logger().$warn("" + "invalid reference: " + (refid))}; + } else { + $c = [nil, nil, "#"], (refid = $c[0]), (path = $c[1]), (target = $c[2]), $c + } + } else { + + $c = [path, "" + (doc.$attributes()['$[]']("relfileprefix")) + (path) + ((function() {if ($truthy(src2src)) { + + return doc.$attributes().$fetch("relfilesuffix", doc.$outfilesuffix()); + } else { + return "" + }; return nil; })())], (refid = $c[0]), (path = $c[1]), $c; + if ($truthy(fragment)) { + $c = ["" + (refid) + "#" + (fragment), "" + (path) + "#" + (fragment)], (refid = $c[0]), (target = $c[1]), $c + } else { + target = path + }; + } + } else if ($truthy(($truthy($c = doc.$compat_mode()) ? $c : $$($nesting, 'Compliance').$natural_xrefs()['$!']()))) { + + $c = [fragment, "" + "#" + (fragment)], (refid = $c[0]), (target = $c[1]), $c; + if ($truthy(($truthy($c = $gvars.VERBOSE) ? doc.$catalog()['$[]']("ids")['$key?'](refid)['$!']() : $c))) { + self.$logger().$warn("" + "invalid reference: " + (refid))}; + } else if ($truthy(doc.$catalog()['$[]']("ids")['$key?'](fragment))) { + $c = [fragment, "" + "#" + (fragment)], (refid = $c[0]), (target = $c[1]), $c + } else if ($truthy(($truthy($c = (refid = doc.$catalog()['$[]']("ids").$key(fragment))) ? ($truthy($d = fragment['$include?'](" ")) ? $d : fragment.$downcase()['$!='](fragment)) : $c))) { + $c = [refid, "" + "#" + (refid)], (fragment = $c[0]), (target = $c[1]), $c + } else { + + $c = [fragment, "" + "#" + (fragment)], (refid = $c[0]), (target = $c[1]), $c; + if ($truthy($gvars.VERBOSE)) { + self.$logger().$warn("" + "invalid reference: " + (refid))}; + }; + $c = [path, fragment, refid], attrs['$[]=']("path", $c[0]), attrs['$[]=']("fragment", $c[1]), attrs['$[]=']("refid", $c[2]), $c; + return $$($nesting, 'Inline').$new(self, "anchor", text, $hash2(["type", "target", "attributes"], {"type": "xref", "target": target, "attributes": attrs})).$convert();}, TMP_50.$$s = self, TMP_50.$$arity = 0, TMP_50))}; + return content; + }, TMP_Substitutors_sub_inline_xrefs_49.$$arity = -2); + + Opal.def(self, '$sub_callouts', TMP_Substitutors_sub_callouts_51 = function $$sub_callouts(text) { + var TMP_52, self = this, callout_rx = nil, autonum = nil; + + + callout_rx = (function() {if ($truthy(self['$attr?']("line-comment"))) { + return $$($nesting, 'CalloutSourceRxMap')['$[]'](self.$attr("line-comment")) + } else { + return $$($nesting, 'CalloutSourceRx') + }; return nil; })(); + autonum = 0; + return $send(text, 'gsub', [callout_rx], (TMP_52 = function(){var self = TMP_52.$$s || this, $a; + if (self.document == null) self.document = nil; + + if ($truthy((($a = $gvars['~']) === nil ? nil : $a['$[]'](2)))) { + return (($a = $gvars['~']) === nil ? nil : $a['$[]'](0)).$sub($$($nesting, 'RS'), "") + } else { + return $$($nesting, 'Inline').$new(self, "callout", (function() {if ((($a = $gvars['~']) === nil ? nil : $a['$[]'](4))['$=='](".")) { + return (autonum = $rb_plus(autonum, 1)).$to_s() + } else { + return (($a = $gvars['~']) === nil ? nil : $a['$[]'](4)) + }; return nil; })(), $hash2(["id", "attributes"], {"id": self.document.$callouts().$read_next_id(), "attributes": $hash2(["guard"], {"guard": (($a = $gvars['~']) === nil ? nil : $a['$[]'](1))})})).$convert() + }}, TMP_52.$$s = self, TMP_52.$$arity = 0, TMP_52)); + }, TMP_Substitutors_sub_callouts_51.$$arity = 1); + + Opal.def(self, '$sub_post_replacements', TMP_Substitutors_sub_post_replacements_53 = function $$sub_post_replacements(text) { + var $a, TMP_54, TMP_55, self = this, lines = nil, last = nil; + if (self.document == null) self.document = nil; + if (self.attributes == null) self.attributes = nil; + + if ($truthy(($truthy($a = self.document.$attributes()['$key?']("hardbreaks")) ? $a : self.attributes['$key?']("hardbreaks-option")))) { + + lines = text.$split($$($nesting, 'LF'), -1); + if ($truthy($rb_lt(lines.$size(), 2))) { + return text}; + last = lines.$pop(); + return $send(lines, 'map', [], (TMP_54 = function(line){var self = TMP_54.$$s || this; + + + + if (line == null) { + line = nil; + }; + return $$($nesting, 'Inline').$new(self, "break", (function() {if ($truthy(line['$end_with?']($$($nesting, 'HARD_LINE_BREAK')))) { + + return line.$slice(0, $rb_minus(line.$length(), 2)); + } else { + return line + }; return nil; })(), $hash2(["type"], {"type": "line"})).$convert();}, TMP_54.$$s = self, TMP_54.$$arity = 1, TMP_54))['$<<'](last).$join($$($nesting, 'LF')); + } else if ($truthy(($truthy($a = text['$include?']($$($nesting, 'PLUS'))) ? text['$include?']($$($nesting, 'HARD_LINE_BREAK')) : $a))) { + return $send(text, 'gsub', [$$($nesting, 'HardLineBreakRx')], (TMP_55 = function(){var self = TMP_55.$$s || this, $b; + + return $$($nesting, 'Inline').$new(self, "break", (($b = $gvars['~']) === nil ? nil : $b['$[]'](1)), $hash2(["type"], {"type": "line"})).$convert()}, TMP_55.$$s = self, TMP_55.$$arity = 0, TMP_55)) + } else { + return text + } + }, TMP_Substitutors_sub_post_replacements_53.$$arity = 1); + + Opal.def(self, '$convert_quoted_text', TMP_Substitutors_convert_quoted_text_56 = function $$convert_quoted_text(match, type, scope) { + var $a, self = this, attrs = nil, unescaped_attrs = nil, attrlist = nil, id = nil, attributes = nil; + + + if ($truthy(match['$[]'](0)['$start_with?']($$($nesting, 'RS')))) { + if ($truthy((($a = scope['$==']("constrained")) ? (attrs = match['$[]'](2)) : scope['$==']("constrained")))) { + unescaped_attrs = "" + "[" + (attrs) + "]" + } else { + return match['$[]'](0).$slice(1, match['$[]'](0).$length()) + }}; + if (scope['$==']("constrained")) { + if ($truthy(unescaped_attrs)) { + return "" + (unescaped_attrs) + ($$($nesting, 'Inline').$new(self, "quoted", match['$[]'](3), $hash2(["type"], {"type": type})).$convert()) + } else { + + if ($truthy((attrlist = match['$[]'](2)))) { + + id = (attributes = self.$parse_quoted_text_attributes(attrlist)).$delete("id"); + if (type['$==']("mark")) { + type = "unquoted"};}; + return "" + (match['$[]'](1)) + ($$($nesting, 'Inline').$new(self, "quoted", match['$[]'](3), $hash2(["type", "id", "attributes"], {"type": type, "id": id, "attributes": attributes})).$convert()); + } + } else { + + if ($truthy((attrlist = match['$[]'](1)))) { + + id = (attributes = self.$parse_quoted_text_attributes(attrlist)).$delete("id"); + if (type['$==']("mark")) { + type = "unquoted"};}; + return $$($nesting, 'Inline').$new(self, "quoted", match['$[]'](2), $hash2(["type", "id", "attributes"], {"type": type, "id": id, "attributes": attributes})).$convert(); + }; + }, TMP_Substitutors_convert_quoted_text_56.$$arity = 3); + + Opal.def(self, '$parse_quoted_text_attributes', TMP_Substitutors_parse_quoted_text_attributes_57 = function $$parse_quoted_text_attributes(str) { + var $a, $b, self = this, segments = nil, id = nil, more_roles = nil, roles = nil, attrs = nil, $writer = nil; + + + if ($truthy(str['$include?']($$($nesting, 'ATTR_REF_HEAD')))) { + str = self.$sub_attributes(str)}; + if ($truthy(str['$include?'](","))) { + str = str.$slice(0, str.$index(","))}; + if ($truthy((str = str.$strip())['$empty?']())) { + return $hash2([], {}) + } else if ($truthy(($truthy($a = str['$start_with?'](".", "#")) ? $$($nesting, 'Compliance').$shorthand_property_syntax() : $a))) { + + segments = str.$split("#", 2); + if ($truthy($rb_gt(segments.$size(), 1))) { + $b = segments['$[]'](1).$split("."), $a = Opal.to_ary($b), (id = ($a[0] == null ? nil : $a[0])), (more_roles = $slice.call($a, 1)), $b + } else { + + id = nil; + more_roles = []; + }; + roles = (function() {if ($truthy(segments['$[]'](0)['$empty?']())) { + return [] + } else { + return segments['$[]'](0).$split(".") + }; return nil; })(); + if ($truthy($rb_gt(roles.$size(), 1))) { + roles.$shift()}; + if ($truthy($rb_gt(more_roles.$size(), 0))) { + roles.$concat(more_roles)}; + attrs = $hash2([], {}); + if ($truthy(id)) { + + $writer = ["id", id]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if ($truthy(roles['$empty?']())) { + } else { + + $writer = ["role", roles.$join(" ")]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + return attrs; + } else { + return $hash2(["role"], {"role": str}) + }; + }, TMP_Substitutors_parse_quoted_text_attributes_57.$$arity = 1); + + Opal.def(self, '$parse_attributes', TMP_Substitutors_parse_attributes_58 = function $$parse_attributes(attrlist, posattrs, opts) { + var $a, self = this, block = nil, into = nil; + if (self.document == null) self.document = nil; + + + + if (posattrs == null) { + posattrs = []; + }; + + if (opts == null) { + opts = $hash2([], {}); + }; + if ($truthy(($truthy($a = attrlist) ? attrlist['$empty?']()['$!']() : $a))) { + } else { + return $hash2([], {}) + }; + if ($truthy(($truthy($a = opts['$[]']("sub_input")) ? attrlist['$include?']($$($nesting, 'ATTR_REF_HEAD')) : $a))) { + attrlist = self.document.$sub_attributes(attrlist)}; + if ($truthy(opts['$[]']("unescape_input"))) { + attrlist = self.$unescape_bracketed_text(attrlist)}; + if ($truthy(opts['$[]']("sub_result"))) { + block = self}; + if ($truthy((into = opts['$[]']("into")))) { + return $$($nesting, 'AttributeList').$new(attrlist, block).$parse_into(into, posattrs) + } else { + return $$($nesting, 'AttributeList').$new(attrlist, block).$parse(posattrs) + }; + }, TMP_Substitutors_parse_attributes_58.$$arity = -2); + + Opal.def(self, '$expand_subs', TMP_Substitutors_expand_subs_59 = function $$expand_subs(subs) { + var $a, TMP_60, self = this, expanded_subs = nil; + + if ($truthy($$$('::', 'Symbol')['$==='](subs))) { + if (subs['$==']("none")) { + return nil + } else { + return ($truthy($a = $$($nesting, 'SUB_GROUPS')['$[]'](subs)) ? $a : [subs]) + } + } else { + + expanded_subs = []; + $send(subs, 'each', [], (TMP_60 = function(key){var self = TMP_60.$$s || this, sub_group = nil; + + + + if (key == null) { + key = nil; + }; + if (key['$==']("none")) { + return nil + } else if ($truthy((sub_group = $$($nesting, 'SUB_GROUPS')['$[]'](key)))) { + return (expanded_subs = $rb_plus(expanded_subs, sub_group)) + } else { + return expanded_subs['$<<'](key) + };}, TMP_60.$$s = self, TMP_60.$$arity = 1, TMP_60)); + if ($truthy(expanded_subs['$empty?']())) { + return nil + } else { + return expanded_subs + }; + } + }, TMP_Substitutors_expand_subs_59.$$arity = 1); + + Opal.def(self, '$unescape_bracketed_text', TMP_Substitutors_unescape_bracketed_text_61 = function $$unescape_bracketed_text(text) { + var self = this; + + + if ($truthy(text['$empty?']())) { + } else if ($truthy((text = text.$strip().$tr($$($nesting, 'LF'), " "))['$include?']($$($nesting, 'R_SB')))) { + text = text.$gsub($$($nesting, 'ESC_R_SB'), $$($nesting, 'R_SB'))}; + return text; + }, TMP_Substitutors_unescape_bracketed_text_61.$$arity = 1); + + Opal.def(self, '$normalize_string', TMP_Substitutors_normalize_string_62 = function $$normalize_string(str, unescape_brackets) { + var $a, self = this; + + + + if (unescape_brackets == null) { + unescape_brackets = false; + }; + if ($truthy(str['$empty?']())) { + } else { + + str = str.$strip().$tr($$($nesting, 'LF'), " "); + if ($truthy(($truthy($a = unescape_brackets) ? str['$include?']($$($nesting, 'R_SB')) : $a))) { + str = str.$gsub($$($nesting, 'ESC_R_SB'), $$($nesting, 'R_SB'))}; + }; + return str; + }, TMP_Substitutors_normalize_string_62.$$arity = -2); + + Opal.def(self, '$unescape_brackets', TMP_Substitutors_unescape_brackets_63 = function $$unescape_brackets(str) { + var self = this; + + + if ($truthy(str['$empty?']())) { + } else if ($truthy(str['$include?']($$($nesting, 'RS')))) { + str = str.$gsub($$($nesting, 'ESC_R_SB'), $$($nesting, 'R_SB'))}; + return str; + }, TMP_Substitutors_unescape_brackets_63.$$arity = 1); + + Opal.def(self, '$split_simple_csv', TMP_Substitutors_split_simple_csv_64 = function $$split_simple_csv(str) { + var TMP_65, TMP_66, self = this, values = nil, current = nil, quote_open = nil; + + + if ($truthy(str['$empty?']())) { + values = [] + } else if ($truthy(str['$include?']("\""))) { + + values = []; + current = []; + quote_open = false; + $send(str, 'each_char', [], (TMP_65 = function(c){var self = TMP_65.$$s || this, $case = nil; + + + + if (c == null) { + c = nil; + }; + return (function() {$case = c; + if (","['$===']($case)) {if ($truthy(quote_open)) { + return current['$<<'](c) + } else { + + values['$<<'](current.$join().$strip()); + return (current = []); + }} + else if ("\""['$===']($case)) {return (quote_open = quote_open['$!']())} + else {return current['$<<'](c)}})();}, TMP_65.$$s = self, TMP_65.$$arity = 1, TMP_65)); + values['$<<'](current.$join().$strip()); + } else { + values = $send(str.$split(","), 'map', [], (TMP_66 = function(it){var self = TMP_66.$$s || this; + + + + if (it == null) { + it = nil; + }; + return it.$strip();}, TMP_66.$$s = self, TMP_66.$$arity = 1, TMP_66)) + }; + return values; + }, TMP_Substitutors_split_simple_csv_64.$$arity = 1); + + Opal.def(self, '$resolve_subs', TMP_Substitutors_resolve_subs_67 = function $$resolve_subs(subs, type, defaults, subject) { + var TMP_68, self = this, candidates = nil, modifiers_present = nil, resolved = nil, invalid = nil; + + + + if (type == null) { + type = "block"; + }; + + if (defaults == null) { + defaults = nil; + }; + + if (subject == null) { + subject = nil; + }; + if ($truthy(subs['$nil_or_empty?']())) { + return nil}; + candidates = nil; + if ($truthy(subs['$include?'](" "))) { + subs = subs.$delete(" ")}; + modifiers_present = $$($nesting, 'SubModifierSniffRx')['$match?'](subs); + $send(subs.$split(","), 'each', [], (TMP_68 = function(key){var self = TMP_68.$$s || this, $a, $b, modifier_operation = nil, first = nil, resolved_keys = nil, resolved_key = nil, candidate = nil, $case = nil; + + + + if (key == null) { + key = nil; + }; + modifier_operation = nil; + if ($truthy(modifiers_present)) { + if ((first = key.$chr())['$==']("+")) { + + modifier_operation = "append"; + key = key.$slice(1, key.$length()); + } else if (first['$==']("-")) { + + modifier_operation = "remove"; + key = key.$slice(1, key.$length()); + } else if ($truthy(key['$end_with?']("+"))) { + + modifier_operation = "prepend"; + key = key.$chop();}}; + key = key.$to_sym(); + if ($truthy((($a = type['$==']("inline")) ? ($truthy($b = key['$==']("verbatim")) ? $b : key['$==']("v")) : type['$==']("inline")))) { + resolved_keys = $$($nesting, 'BASIC_SUBS') + } else if ($truthy($$($nesting, 'SUB_GROUPS')['$key?'](key))) { + resolved_keys = $$($nesting, 'SUB_GROUPS')['$[]'](key) + } else if ($truthy(($truthy($a = (($b = type['$==']("inline")) ? key.$length()['$=='](1) : type['$==']("inline"))) ? $$($nesting, 'SUB_HINTS')['$key?'](key) : $a))) { + + resolved_key = $$($nesting, 'SUB_HINTS')['$[]'](key); + if ($truthy((candidate = $$($nesting, 'SUB_GROUPS')['$[]'](resolved_key)))) { + resolved_keys = candidate + } else { + resolved_keys = [resolved_key] + }; + } else { + resolved_keys = [key] + }; + if ($truthy(modifier_operation)) { + + candidates = ($truthy($a = candidates) ? $a : (function() {if ($truthy(defaults)) { + + return defaults.$drop(0); + } else { + return [] + }; return nil; })()); + return (function() {$case = modifier_operation; + if ("append"['$===']($case)) {return (candidates = $rb_plus(candidates, resolved_keys))} + else if ("prepend"['$===']($case)) {return (candidates = $rb_plus(resolved_keys, candidates))} + else if ("remove"['$===']($case)) {return (candidates = $rb_minus(candidates, resolved_keys))} + else { return nil }})(); + } else { + + candidates = ($truthy($a = candidates) ? $a : []); + return (candidates = $rb_plus(candidates, resolved_keys)); + };}, TMP_68.$$s = self, TMP_68.$$arity = 1, TMP_68)); + if ($truthy(candidates)) { + } else { + return nil + }; + resolved = candidates['$&']($$($nesting, 'SUB_OPTIONS')['$[]'](type)); + if ($truthy($rb_minus(candidates, resolved)['$empty?']())) { + } else { + + invalid = $rb_minus(candidates, resolved); + self.$logger().$warn("" + "invalid substitution type" + ((function() {if ($truthy($rb_gt(invalid.$size(), 1))) { + return "s" + } else { + return "" + }; return nil; })()) + ((function() {if ($truthy(subject)) { + return " for " + } else { + return "" + }; return nil; })()) + (subject) + ": " + (invalid.$join(", "))); + }; + return resolved; + }, TMP_Substitutors_resolve_subs_67.$$arity = -2); + + Opal.def(self, '$resolve_block_subs', TMP_Substitutors_resolve_block_subs_69 = function $$resolve_block_subs(subs, defaults, subject) { + var self = this; + + return self.$resolve_subs(subs, "block", defaults, subject) + }, TMP_Substitutors_resolve_block_subs_69.$$arity = 3); + + Opal.def(self, '$resolve_pass_subs', TMP_Substitutors_resolve_pass_subs_70 = function $$resolve_pass_subs(subs) { + var self = this; + + return self.$resolve_subs(subs, "inline", nil, "passthrough macro") + }, TMP_Substitutors_resolve_pass_subs_70.$$arity = 1); + + Opal.def(self, '$highlight_source', TMP_Substitutors_highlight_source_71 = function $$highlight_source(source, process_callouts, highlighter) { + var $a, $b, $c, $d, $e, $f, TMP_72, TMP_74, self = this, $case = nil, highlighter_loaded = nil, lineno = nil, callout_on_last = nil, callout_marks = nil, last = nil, callout_rx = nil, linenums_mode = nil, highlight_lines = nil, start = nil, result = nil, lexer = nil, opts = nil, $writer = nil, autonum = nil, reached_code = nil; + if (self.document == null) self.document = nil; + if (self.passthroughs == null) self.passthroughs = nil; + + + + if (highlighter == null) { + highlighter = nil; + }; + $case = (highlighter = ($truthy($a = highlighter) ? $a : self.document.$attributes()['$[]']("source-highlighter"))); + if ("coderay"['$===']($case)) {if ($truthy(($truthy($a = ($truthy($b = (highlighter_loaded = (($c = $$$('::', 'CodeRay', 'skip_raise')) ? 'constant' : nil))) ? $b : (($d = $Substitutors.$$cvars['@@coderay_unavailable'], $d != null) ? 'class variable' : nil))) ? $a : self.document.$attributes()['$[]']("coderay-unavailable")))) { + } else if ($truthy($$($nesting, 'Helpers').$require_library("coderay", true, "warn")['$nil?']())) { + (Opal.class_variable_set($Substitutors, '@@coderay_unavailable', true)) + } else { + highlighter_loaded = true + }} + else if ("pygments"['$===']($case)) {if ($truthy(($truthy($a = ($truthy($b = (highlighter_loaded = (($e = $$$('::', 'Pygments', 'skip_raise')) ? 'constant' : nil))) ? $b : (($f = $Substitutors.$$cvars['@@pygments_unavailable'], $f != null) ? 'class variable' : nil))) ? $a : self.document.$attributes()['$[]']("pygments-unavailable")))) { + } else if ($truthy($$($nesting, 'Helpers').$require_library("pygments", "pygments.rb", "warn")['$nil?']())) { + (Opal.class_variable_set($Substitutors, '@@pygments_unavailable', true)) + } else { + highlighter_loaded = true + }} + else {highlighter_loaded = false}; + if ($truthy(highlighter_loaded)) { + } else { + return self.$sub_source(source, process_callouts) + }; + lineno = 0; + callout_on_last = false; + if ($truthy(process_callouts)) { + + callout_marks = $hash2([], {}); + last = -1; + callout_rx = (function() {if ($truthy(self['$attr?']("line-comment"))) { + return $$($nesting, 'CalloutExtractRxMap')['$[]'](self.$attr("line-comment")) + } else { + return $$($nesting, 'CalloutExtractRx') + }; return nil; })(); + source = $send(source.$split($$($nesting, 'LF'), -1), 'map', [], (TMP_72 = function(line){var self = TMP_72.$$s || this, TMP_73; + + + + if (line == null) { + line = nil; + }; + lineno = $rb_plus(lineno, 1); + return $send(line, 'gsub', [callout_rx], (TMP_73 = function(){var self = TMP_73.$$s || this, $g, $writer = nil; + + if ($truthy((($g = $gvars['~']) === nil ? nil : $g['$[]'](2)))) { + return (($g = $gvars['~']) === nil ? nil : $g['$[]'](0)).$sub($$($nesting, 'RS'), "") + } else { + + ($truthy($g = callout_marks['$[]'](lineno)) ? $g : (($writer = [lineno, []]), $send(callout_marks, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]))['$<<']([(($g = $gvars['~']) === nil ? nil : $g['$[]'](1)), (($g = $gvars['~']) === nil ? nil : $g['$[]'](4))]); + last = lineno; + return nil; + }}, TMP_73.$$s = self, TMP_73.$$arity = 0, TMP_73));}, TMP_72.$$s = self, TMP_72.$$arity = 1, TMP_72)).$join($$($nesting, 'LF')); + callout_on_last = last['$=='](lineno); + if ($truthy(callout_marks['$empty?']())) { + callout_marks = nil}; + } else { + callout_marks = nil + }; + linenums_mode = nil; + highlight_lines = nil; + $case = highlighter; + if ("coderay"['$===']($case)) { + if ($truthy((linenums_mode = (function() {if ($truthy(self['$attr?']("linenums", nil, false))) { + return ($truthy($a = self.document.$attributes()['$[]']("coderay-linenums-mode")) ? $a : "table").$to_sym() + } else { + return nil + }; return nil; })()))) { + + if ($truthy($rb_lt((start = self.$attr("start", nil, 1).$to_i()), 1))) { + start = 1}; + if ($truthy(self['$attr?']("highlight", nil, false))) { + highlight_lines = self.$resolve_lines_to_highlight(source, self.$attr("highlight", nil, false))};}; + result = $$$($$$('::', 'CodeRay'), 'Duo')['$[]'](self.$attr("language", "text", false).$to_sym(), "html", $hash2(["css", "line_numbers", "line_number_start", "line_number_anchors", "highlight_lines", "bold_every"], {"css": ($truthy($a = self.document.$attributes()['$[]']("coderay-css")) ? $a : "class").$to_sym(), "line_numbers": linenums_mode, "line_number_start": start, "line_number_anchors": false, "highlight_lines": highlight_lines, "bold_every": false})).$highlight(source);} + else if ("pygments"['$===']($case)) { + lexer = ($truthy($a = $$$($$$('::', 'Pygments'), 'Lexer').$find_by_alias(self.$attr("language", "text", false))) ? $a : $$$($$$('::', 'Pygments'), 'Lexer').$find_by_mimetype("text/plain")); + opts = $hash2(["cssclass", "classprefix", "nobackground", "stripnl"], {"cssclass": "pyhl", "classprefix": "tok-", "nobackground": true, "stripnl": false}); + if (lexer.$name()['$==']("PHP")) { + + $writer = ["startinline", self['$option?']("mixed")['$!']()]; + $send(opts, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if (($truthy($a = self.document.$attributes()['$[]']("pygments-css")) ? $a : "class")['$==']("class")) { + } else { + + + $writer = ["noclasses", true]; + $send(opts, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["style", ($truthy($a = self.document.$attributes()['$[]']("pygments-style")) ? $a : $$$($$($nesting, 'Stylesheets'), 'DEFAULT_PYGMENTS_STYLE'))]; + $send(opts, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + }; + if ($truthy(self['$attr?']("highlight", nil, false))) { + if ($truthy((highlight_lines = self.$resolve_lines_to_highlight(source, self.$attr("highlight", nil, false)))['$empty?']())) { + } else { + + $writer = ["hl_lines", highlight_lines.$join(" ")]; + $send(opts, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }}; + if ($truthy(($truthy($a = ($truthy($b = self['$attr?']("linenums", nil, false)) ? (($writer = ["linenostart", (function() {if ($truthy($rb_lt((start = self.$attr("start", 1, false)).$to_i(), 1))) { + return 1 + } else { + return start + }; return nil; })()]), $send(opts, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]) : $b)) ? (($writer = ["linenos", ($truthy($b = self.document.$attributes()['$[]']("pygments-linenums-mode")) ? $b : "table")]), $send(opts, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])['$==']("table") : $a))) { + + linenums_mode = "table"; + if ($truthy((result = lexer.$highlight(source, $hash2(["options"], {"options": opts}))))) { + result = result.$sub($$($nesting, 'PygmentsWrapperDivRx'), "\\1").$gsub($$($nesting, 'PygmentsWrapperPreRx'), "\\1") + } else { + result = self.$sub_specialchars(source) + }; + } else if ($truthy((result = lexer.$highlight(source, $hash2(["options"], {"options": opts}))))) { + if ($truthy($$($nesting, 'PygmentsWrapperPreRx')['$=~'](result))) { + result = (($a = $gvars['~']) === nil ? nil : $a['$[]'](1))} + } else { + result = self.$sub_specialchars(source) + };}; + if ($truthy(self.passthroughs['$empty?']())) { + } else { + result = result.$gsub($$($nesting, 'HighlightedPassSlotRx'), "" + ($$($nesting, 'PASS_START')) + "\\1" + ($$($nesting, 'PASS_END'))) + }; + if ($truthy(($truthy($a = process_callouts) ? callout_marks : $a))) { + + lineno = 0; + autonum = 0; + reached_code = linenums_mode['$!=']("table"); + return $send(result.$split($$($nesting, 'LF'), -1), 'map', [], (TMP_74 = function(line){var self = TMP_74.$$s || this, $g, $h, TMP_75, conums = nil, tail = nil, pos = nil, guard = nil, conum = nil, conums_markup = nil; + if (self.document == null) self.document = nil; + + + + if (line == null) { + line = nil; + }; + if ($truthy(reached_code)) { + } else { + + if ($truthy(line['$include?'](""))) { + } else { + return line; + }; + reached_code = true; + }; + lineno = $rb_plus(lineno, 1); + if ($truthy((conums = callout_marks.$delete(lineno)))) { + + tail = nil; + if ($truthy(($truthy($g = ($truthy($h = callout_on_last) ? callout_marks['$empty?']() : $h)) ? linenums_mode['$==']("table") : $g))) { + if ($truthy((($g = highlighter['$==']("coderay")) ? (pos = line.$index("")) : highlighter['$==']("coderay")))) { + $g = [line.$slice(0, pos), line.$slice(pos, line.$length())], (line = $g[0]), (tail = $g[1]), $g + } else if ($truthy((($g = highlighter['$==']("pygments")) ? (pos = line['$start_with?']("")) : highlighter['$==']("pygments")))) { + $g = ["", line], (line = $g[0]), (tail = $g[1]), $g}}; + if (conums.$size()['$=='](1)) { + + $h = conums['$[]'](0), $g = Opal.to_ary($h), (guard = ($g[0] == null ? nil : $g[0])), (conum = ($g[1] == null ? nil : $g[1])), $h; + return "" + (line) + ($$($nesting, 'Inline').$new(self, "callout", (function() {if (conum['$=='](".")) { + return (autonum = $rb_plus(autonum, 1)).$to_s() + } else { + return conum + }; return nil; })(), $hash2(["id", "attributes"], {"id": self.document.$callouts().$read_next_id(), "attributes": $hash2(["guard"], {"guard": guard})})).$convert()) + (tail); + } else { + + conums_markup = $send(conums, 'map', [], (TMP_75 = function(guard_it, conum_it){var self = TMP_75.$$s || this; + if (self.document == null) self.document = nil; + + + + if (guard_it == null) { + guard_it = nil; + }; + + if (conum_it == null) { + conum_it = nil; + }; + return $$($nesting, 'Inline').$new(self, "callout", (function() {if (conum_it['$=='](".")) { + return (autonum = $rb_plus(autonum, 1)).$to_s() + } else { + return conum_it + }; return nil; })(), $hash2(["id", "attributes"], {"id": self.document.$callouts().$read_next_id(), "attributes": $hash2(["guard"], {"guard": guard_it})})).$convert();}, TMP_75.$$s = self, TMP_75.$$arity = 2, TMP_75)).$join(" "); + return "" + (line) + (conums_markup) + (tail); + }; + } else { + return line + };}, TMP_74.$$s = self, TMP_74.$$arity = 1, TMP_74)).$join($$($nesting, 'LF')); + } else { + return result + }; + }, TMP_Substitutors_highlight_source_71.$$arity = -3); + + Opal.def(self, '$resolve_lines_to_highlight', TMP_Substitutors_resolve_lines_to_highlight_76 = function $$resolve_lines_to_highlight(source, spec) { + var TMP_77, self = this, lines = nil; + + + lines = []; + if ($truthy(spec['$include?'](" "))) { + spec = spec.$delete(" ")}; + $send((function() {if ($truthy(spec['$include?'](","))) { + + return spec.$split(","); + } else { + + return spec.$split(";"); + }; return nil; })(), 'map', [], (TMP_77 = function(entry){var self = TMP_77.$$s || this, $a, $b, negate = nil, delim = nil, from = nil, to = nil, line_nums = nil; + + + + if (entry == null) { + entry = nil; + }; + negate = false; + if ($truthy(entry['$start_with?']("!"))) { + + entry = entry.$slice(1, entry.$length()); + negate = true;}; + if ($truthy((delim = (function() {if ($truthy(entry['$include?'](".."))) { + return ".." + } else { + + if ($truthy(entry['$include?']("-"))) { + return "-" + } else { + return nil + }; + }; return nil; })()))) { + + $b = entry.$split(delim, 2), $a = Opal.to_ary($b), (from = ($a[0] == null ? nil : $a[0])), (to = ($a[1] == null ? nil : $a[1])), $b; + if ($truthy(($truthy($a = to['$empty?']()) ? $a : $rb_lt((to = to.$to_i()), 0)))) { + to = $rb_plus(source.$count($$($nesting, 'LF')), 1)}; + line_nums = $$$('::', 'Range').$new(from.$to_i(), to).$to_a(); + if ($truthy(negate)) { + return (lines = $rb_minus(lines, line_nums)) + } else { + return lines.$concat(line_nums) + }; + } else if ($truthy(negate)) { + return lines.$delete(entry.$to_i()) + } else { + return lines['$<<'](entry.$to_i()) + };}, TMP_77.$$s = self, TMP_77.$$arity = 1, TMP_77)); + return lines.$sort().$uniq(); + }, TMP_Substitutors_resolve_lines_to_highlight_76.$$arity = 2); + + Opal.def(self, '$sub_source', TMP_Substitutors_sub_source_78 = function $$sub_source(source, process_callouts) { + var self = this; + + if ($truthy(process_callouts)) { + return self.$sub_callouts(self.$sub_specialchars(source)) + } else { + + return self.$sub_specialchars(source); + } + }, TMP_Substitutors_sub_source_78.$$arity = 2); + + Opal.def(self, '$lock_in_subs', TMP_Substitutors_lock_in_subs_79 = function $$lock_in_subs() { + var $a, $b, $c, $d, $e, self = this, default_subs = nil, $case = nil, custom_subs = nil, idx = nil, $writer = nil; + if (self.default_subs == null) self.default_subs = nil; + if (self.content_model == null) self.content_model = nil; + if (self.context == null) self.context = nil; + if (self.subs == null) self.subs = nil; + if (self.attributes == null) self.attributes = nil; + if (self.style == null) self.style = nil; + if (self.document == null) self.document = nil; + + + if ($truthy((default_subs = self.default_subs))) { + } else { + $case = self.content_model; + if ("simple"['$===']($case)) {default_subs = $$($nesting, 'NORMAL_SUBS')} + else if ("verbatim"['$===']($case)) {if ($truthy(($truthy($a = self.context['$==']("listing")) ? $a : (($b = self.context['$==']("literal")) ? self['$option?']("listparagraph")['$!']() : self.context['$==']("literal"))))) { + default_subs = $$($nesting, 'VERBATIM_SUBS') + } else if (self.context['$==']("verse")) { + default_subs = $$($nesting, 'NORMAL_SUBS') + } else { + default_subs = $$($nesting, 'BASIC_SUBS') + }} + else if ("raw"['$===']($case)) {default_subs = (function() {if (self.context['$==']("stem")) { + return $$($nesting, 'BASIC_SUBS') + } else { + return $$($nesting, 'NONE_SUBS') + }; return nil; })()} + else {return self.subs} + }; + if ($truthy((custom_subs = self.attributes['$[]']("subs")))) { + self.subs = ($truthy($a = self.$resolve_block_subs(custom_subs, default_subs, self.context)) ? $a : []) + } else { + self.subs = default_subs.$drop(0) + }; + if ($truthy(($truthy($a = ($truthy($b = ($truthy($c = ($truthy($d = (($e = self.context['$==']("listing")) ? self.style['$==']("source") : self.context['$==']("listing"))) ? self.attributes['$key?']("language") : $d)) ? self.document['$basebackend?']("html") : $c)) ? $$($nesting, 'SUB_HIGHLIGHT')['$include?'](self.document.$attributes()['$[]']("source-highlighter")) : $b)) ? (idx = self.subs.$index("specialcharacters")) : $a))) { + + $writer = [idx, "highlight"]; + $send(self.subs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + return self.subs; + }, TMP_Substitutors_lock_in_subs_79.$$arity = 0); + })($nesting[0], $nesting) + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/abstract_node"] = function(Opal) { + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + function $rb_plus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); + } + function $rb_lt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $hash2 = Opal.hash2, $truthy = Opal.truthy, $send = Opal.send; + + Opal.add_stubs(['$include', '$attr_reader', '$attr_accessor', '$==', '$document', '$to_s', '$key?', '$dup', '$[]', '$raise', '$converter', '$attributes', '$nil?', '$[]=', '$-', '$delete', '$+', '$update', '$nil_or_empty?', '$split', '$include?', '$empty?', '$join', '$apply_reftext_subs', '$attr?', '$extname', '$attr', '$image_uri', '$<', '$safe', '$uriish?', '$uri_encode_spaces', '$normalize_web_path', '$generate_data_uri_from_uri', '$generate_data_uri', '$slice', '$length', '$normalize_system_path', '$readable?', '$strict_encode64', '$binread', '$warn', '$logger', '$require_library', '$!', '$open', '$content_type', '$read', '$base_dir', '$root?', '$path_resolver', '$system_path', '$web_path', '$===', '$!=', '$normalize_lines_array', '$to_a', '$each_line', '$open_uri', '$fetch', '$read_asset', '$gsub']); + return (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + (function($base, $super, $parent_nesting) { + function $AbstractNode(){}; + var self = $AbstractNode = $klass($base, $super, 'AbstractNode', $AbstractNode); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_AbstractNode_initialize_1, TMP_AbstractNode_block$q_2, TMP_AbstractNode_inline$q_3, TMP_AbstractNode_converter_4, TMP_AbstractNode_parent$eq_5, TMP_AbstractNode_attr_6, TMP_AbstractNode_attr$q_7, TMP_AbstractNode_set_attr_8, TMP_AbstractNode_remove_attr_9, TMP_AbstractNode_option$q_10, TMP_AbstractNode_set_option_11, TMP_AbstractNode_update_attributes_12, TMP_AbstractNode_role_13, TMP_AbstractNode_roles_14, TMP_AbstractNode_role$q_15, TMP_AbstractNode_has_role$q_16, TMP_AbstractNode_add_role_17, TMP_AbstractNode_remove_role_18, TMP_AbstractNode_reftext_19, TMP_AbstractNode_reftext$q_20, TMP_AbstractNode_icon_uri_21, TMP_AbstractNode_image_uri_22, TMP_AbstractNode_media_uri_23, TMP_AbstractNode_generate_data_uri_24, TMP_AbstractNode_generate_data_uri_from_uri_25, TMP_AbstractNode_normalize_asset_path_27, TMP_AbstractNode_normalize_system_path_28, TMP_AbstractNode_normalize_web_path_29, TMP_AbstractNode_read_asset_30, TMP_AbstractNode_read_contents_32, TMP_AbstractNode_uri_encode_spaces_35, TMP_AbstractNode_is_uri$q_36; + + def.document = def.attributes = def.parent = nil; + + self.$include($$($nesting, 'Logging')); + self.$include($$($nesting, 'Substitutors')); + self.$attr_reader("attributes"); + self.$attr_reader("context"); + self.$attr_reader("document"); + self.$attr_accessor("id"); + self.$attr_reader("node_name"); + self.$attr_reader("parent"); + + Opal.def(self, '$initialize', TMP_AbstractNode_initialize_1 = function $$initialize(parent, context, opts) { + var $a, self = this; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + if (context['$==']("document")) { + $a = [self, nil], (self.document = $a[0]), (self.parent = $a[1]), $a + } else if ($truthy(parent)) { + $a = [parent.$document(), parent], (self.document = $a[0]), (self.parent = $a[1]), $a + } else { + self.document = (self.parent = nil) + }; + self.node_name = (self.context = context).$to_s(); + self.attributes = (function() {if ($truthy(opts['$key?']("attributes"))) { + return opts['$[]']("attributes").$dup() + } else { + return $hash2([], {}) + }; return nil; })(); + return (self.passthroughs = $hash2([], {})); + }, TMP_AbstractNode_initialize_1.$$arity = -3); + + Opal.def(self, '$block?', TMP_AbstractNode_block$q_2 = function() { + var self = this; + + return self.$raise($$$('::', 'NotImplementedError')) + }, TMP_AbstractNode_block$q_2.$$arity = 0); + + Opal.def(self, '$inline?', TMP_AbstractNode_inline$q_3 = function() { + var self = this; + + return self.$raise($$$('::', 'NotImplementedError')) + }, TMP_AbstractNode_inline$q_3.$$arity = 0); + + Opal.def(self, '$converter', TMP_AbstractNode_converter_4 = function $$converter() { + var self = this; + + return self.document.$converter() + }, TMP_AbstractNode_converter_4.$$arity = 0); + + Opal.def(self, '$parent=', TMP_AbstractNode_parent$eq_5 = function(parent) { + var $a, self = this; + + return $a = [parent, parent.$document()], (self.parent = $a[0]), (self.document = $a[1]), $a + }, TMP_AbstractNode_parent$eq_5.$$arity = 1); + + Opal.def(self, '$attr', TMP_AbstractNode_attr_6 = function $$attr(name, default_val, inherit) { + var $a, $b, self = this; + + + + if (default_val == null) { + default_val = nil; + }; + + if (inherit == null) { + inherit = true; + }; + name = name.$to_s(); + return ($truthy($a = self.attributes['$[]'](name)) ? $a : (function() {if ($truthy(($truthy($b = inherit) ? self.parent : $b))) { + return ($truthy($b = self.document.$attributes()['$[]'](name)) ? $b : default_val) + } else { + return default_val + }; return nil; })()); + }, TMP_AbstractNode_attr_6.$$arity = -2); + + Opal.def(self, '$attr?', TMP_AbstractNode_attr$q_7 = function(name, expect_val, inherit) { + var $a, $b, $c, self = this; + + + + if (expect_val == null) { + expect_val = nil; + }; + + if (inherit == null) { + inherit = true; + }; + name = name.$to_s(); + if ($truthy(expect_val['$nil?']())) { + return ($truthy($a = self.attributes['$key?'](name)) ? $a : ($truthy($b = ($truthy($c = inherit) ? self.parent : $c)) ? self.document.$attributes()['$key?'](name) : $b)) + } else { + return expect_val['$=='](($truthy($a = self.attributes['$[]'](name)) ? $a : (function() {if ($truthy(($truthy($b = inherit) ? self.parent : $b))) { + return self.document.$attributes()['$[]'](name) + } else { + return nil + }; return nil; })())) + }; + }, TMP_AbstractNode_attr$q_7.$$arity = -2); + + Opal.def(self, '$set_attr', TMP_AbstractNode_set_attr_8 = function $$set_attr(name, value, overwrite) { + var $a, self = this, $writer = nil; + + + + if (value == null) { + value = ""; + }; + + if (overwrite == null) { + overwrite = true; + }; + if ($truthy((($a = overwrite['$=='](false)) ? self.attributes['$key?'](name) : overwrite['$=='](false)))) { + return false + } else { + + + $writer = [name, value]; + $send(self.attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + return true; + }; + }, TMP_AbstractNode_set_attr_8.$$arity = -2); + + Opal.def(self, '$remove_attr', TMP_AbstractNode_remove_attr_9 = function $$remove_attr(name) { + var self = this; + + return self.attributes.$delete(name) + }, TMP_AbstractNode_remove_attr_9.$$arity = 1); + + Opal.def(self, '$option?', TMP_AbstractNode_option$q_10 = function(name) { + var self = this; + + return self.attributes['$key?']("" + (name) + "-option") + }, TMP_AbstractNode_option$q_10.$$arity = 1); + + Opal.def(self, '$set_option', TMP_AbstractNode_set_option_11 = function $$set_option(name) { + var self = this, attrs = nil, key = nil, $writer = nil; + + if ($truthy((attrs = self.attributes)['$[]']("options"))) { + if ($truthy(attrs['$[]']((key = "" + (name) + "-option")))) { + return nil + } else { + + + $writer = ["options", $rb_plus(attrs['$[]']("options"), "" + "," + (name))]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = [key, ""]; + $send(attrs, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];; + } + } else { + + + $writer = ["options", name]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["" + (name) + "-option", ""]; + $send(attrs, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];; + } + }, TMP_AbstractNode_set_option_11.$$arity = 1); + + Opal.def(self, '$update_attributes', TMP_AbstractNode_update_attributes_12 = function $$update_attributes(attributes) { + var self = this; + + + self.attributes.$update(attributes); + return nil; + }, TMP_AbstractNode_update_attributes_12.$$arity = 1); + + Opal.def(self, '$role', TMP_AbstractNode_role_13 = function $$role() { + var $a, self = this; + + return ($truthy($a = self.attributes['$[]']("role")) ? $a : self.document.$attributes()['$[]']("role")) + }, TMP_AbstractNode_role_13.$$arity = 0); + + Opal.def(self, '$roles', TMP_AbstractNode_roles_14 = function $$roles() { + var $a, self = this, val = nil; + + if ($truthy((val = ($truthy($a = self.attributes['$[]']("role")) ? $a : self.document.$attributes()['$[]']("role")))['$nil_or_empty?']())) { + return [] + } else { + return val.$split() + } + }, TMP_AbstractNode_roles_14.$$arity = 0); + + Opal.def(self, '$role?', TMP_AbstractNode_role$q_15 = function(expect_val) { + var $a, self = this; + + + + if (expect_val == null) { + expect_val = nil; + }; + if ($truthy(expect_val)) { + return expect_val['$=='](($truthy($a = self.attributes['$[]']("role")) ? $a : self.document.$attributes()['$[]']("role"))) + } else { + return ($truthy($a = self.attributes['$key?']("role")) ? $a : self.document.$attributes()['$key?']("role")) + }; + }, TMP_AbstractNode_role$q_15.$$arity = -1); + + Opal.def(self, '$has_role?', TMP_AbstractNode_has_role$q_16 = function(name) { + var $a, self = this, val = nil; + + if ($truthy((val = ($truthy($a = self.attributes['$[]']("role")) ? $a : self.document.$attributes()['$[]']("role"))))) { + return ((("" + " ") + (val)) + " ")['$include?']("" + " " + (name) + " ") + } else { + return false + } + }, TMP_AbstractNode_has_role$q_16.$$arity = 1); + + Opal.def(self, '$add_role', TMP_AbstractNode_add_role_17 = function $$add_role(name) { + var self = this, val = nil, $writer = nil; + + if ($truthy((val = self.attributes['$[]']("role"))['$nil_or_empty?']())) { + + + $writer = ["role", name]; + $send(self.attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + return true; + } else if ($truthy(((("" + " ") + (val)) + " ")['$include?']("" + " " + (name) + " "))) { + return false + } else { + + + $writer = ["role", "" + (val) + " " + (name)]; + $send(self.attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + return true; + } + }, TMP_AbstractNode_add_role_17.$$arity = 1); + + Opal.def(self, '$remove_role', TMP_AbstractNode_remove_role_18 = function $$remove_role(name) { + var self = this, val = nil, $writer = nil; + + if ($truthy((val = self.attributes['$[]']("role"))['$nil_or_empty?']())) { + return false + } else if ($truthy((val = val.$split()).$delete(name))) { + + if ($truthy(val['$empty?']())) { + self.attributes.$delete("role") + } else { + + $writer = ["role", val.$join(" ")]; + $send(self.attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + return true; + } else { + return false + } + }, TMP_AbstractNode_remove_role_18.$$arity = 1); + + Opal.def(self, '$reftext', TMP_AbstractNode_reftext_19 = function $$reftext() { + var self = this, val = nil; + + if ($truthy((val = self.attributes['$[]']("reftext")))) { + + return self.$apply_reftext_subs(val); + } else { + return nil + } + }, TMP_AbstractNode_reftext_19.$$arity = 0); + + Opal.def(self, '$reftext?', TMP_AbstractNode_reftext$q_20 = function() { + var self = this; + + return self.attributes['$key?']("reftext") + }, TMP_AbstractNode_reftext$q_20.$$arity = 0); + + Opal.def(self, '$icon_uri', TMP_AbstractNode_icon_uri_21 = function $$icon_uri(name) { + var self = this, icon = nil; + + + if ($truthy(self['$attr?']("icon"))) { + if ($truthy($$$('::', 'File').$extname((icon = self.$attr("icon")))['$empty?']())) { + icon = "" + (icon) + "." + (self.document.$attr("icontype", "png"))} + } else { + icon = "" + (name) + "." + (self.document.$attr("icontype", "png")) + }; + return self.$image_uri(icon, "iconsdir"); + }, TMP_AbstractNode_icon_uri_21.$$arity = 1); + + Opal.def(self, '$image_uri', TMP_AbstractNode_image_uri_22 = function $$image_uri(target_image, asset_dir_key) { + var $a, $b, $c, $d, self = this, doc = nil, images_base = nil; + + + + if (asset_dir_key == null) { + asset_dir_key = "imagesdir"; + }; + if ($truthy(($truthy($a = $rb_lt((doc = self.document).$safe(), $$$($$($nesting, 'SafeMode'), 'SECURE'))) ? doc['$attr?']("data-uri") : $a))) { + if ($truthy(($truthy($a = ($truthy($b = $$($nesting, 'Helpers')['$uriish?'](target_image)) ? (target_image = self.$uri_encode_spaces(target_image)) : $b)) ? $a : ($truthy($b = ($truthy($c = ($truthy($d = asset_dir_key) ? (images_base = doc.$attr(asset_dir_key)) : $d)) ? $$($nesting, 'Helpers')['$uriish?'](images_base) : $c)) ? (target_image = self.$normalize_web_path(target_image, images_base, false)) : $b)))) { + if ($truthy(doc['$attr?']("allow-uri-read"))) { + return self.$generate_data_uri_from_uri(target_image, doc['$attr?']("cache-uri")) + } else { + return target_image + } + } else { + return self.$generate_data_uri(target_image, asset_dir_key) + } + } else { + return self.$normalize_web_path(target_image, (function() {if ($truthy(asset_dir_key)) { + + return doc.$attr(asset_dir_key); + } else { + return nil + }; return nil; })()) + }; + }, TMP_AbstractNode_image_uri_22.$$arity = -2); + + Opal.def(self, '$media_uri', TMP_AbstractNode_media_uri_23 = function $$media_uri(target, asset_dir_key) { + var self = this; + + + + if (asset_dir_key == null) { + asset_dir_key = "imagesdir"; + }; + return self.$normalize_web_path(target, (function() {if ($truthy(asset_dir_key)) { + return self.document.$attr(asset_dir_key) + } else { + return nil + }; return nil; })()); + }, TMP_AbstractNode_media_uri_23.$$arity = -2); + + Opal.def(self, '$generate_data_uri', TMP_AbstractNode_generate_data_uri_24 = function $$generate_data_uri(target_image, asset_dir_key) { + var self = this, ext = nil, mimetype = nil, image_path = nil; + + + + if (asset_dir_key == null) { + asset_dir_key = nil; + }; + ext = $$$('::', 'File').$extname(target_image); + mimetype = (function() {if (ext['$=='](".svg")) { + return "image/svg+xml" + } else { + return "" + "image/" + (ext.$slice(1, ext.$length())) + }; return nil; })(); + if ($truthy(asset_dir_key)) { + image_path = self.$normalize_system_path(target_image, self.document.$attr(asset_dir_key), nil, $hash2(["target_name"], {"target_name": "image"})) + } else { + image_path = self.$normalize_system_path(target_image) + }; + if ($truthy($$$('::', 'File')['$readable?'](image_path))) { + return "" + "data:" + (mimetype) + ";base64," + ($$$('::', 'Base64').$strict_encode64($$$('::', 'IO').$binread(image_path))) + } else { + + self.$logger().$warn("" + "image to embed not found or not readable: " + (image_path)); + return "" + "data:" + (mimetype) + ";base64,"; + }; + }, TMP_AbstractNode_generate_data_uri_24.$$arity = -2); + + Opal.def(self, '$generate_data_uri_from_uri', TMP_AbstractNode_generate_data_uri_from_uri_25 = function $$generate_data_uri_from_uri(image_uri, cache_uri) { + var TMP_26, self = this, mimetype = nil, bindata = nil; + + + + if (cache_uri == null) { + cache_uri = false; + }; + if ($truthy(cache_uri)) { + $$($nesting, 'Helpers').$require_library("open-uri/cached", "open-uri-cached") + } else if ($truthy($$$('::', 'RUBY_ENGINE_OPAL')['$!']())) { + $$$('::', 'OpenURI')}; + + try { + + mimetype = nil; + bindata = $send(self, 'open', [image_uri, "rb"], (TMP_26 = function(f){var self = TMP_26.$$s || this; + + + + if (f == null) { + f = nil; + }; + mimetype = f.$content_type(); + return f.$read();}, TMP_26.$$s = self, TMP_26.$$arity = 1, TMP_26)); + return "" + "data:" + (mimetype) + ";base64," + ($$$('::', 'Base64').$strict_encode64(bindata)); + } catch ($err) { + if (Opal.rescue($err, [$$($nesting, 'StandardError')])) { + try { + + self.$logger().$warn("" + "could not retrieve image data from URI: " + (image_uri)); + return image_uri; + } finally { Opal.pop_exception() } + } else { throw $err; } + };; + }, TMP_AbstractNode_generate_data_uri_from_uri_25.$$arity = -2); + + Opal.def(self, '$normalize_asset_path', TMP_AbstractNode_normalize_asset_path_27 = function $$normalize_asset_path(asset_ref, asset_name, autocorrect) { + var self = this; + + + + if (asset_name == null) { + asset_name = "path"; + }; + + if (autocorrect == null) { + autocorrect = true; + }; + return self.$normalize_system_path(asset_ref, self.document.$base_dir(), nil, $hash2(["target_name", "recover"], {"target_name": asset_name, "recover": autocorrect})); + }, TMP_AbstractNode_normalize_asset_path_27.$$arity = -2); + + Opal.def(self, '$normalize_system_path', TMP_AbstractNode_normalize_system_path_28 = function $$normalize_system_path(target, start, jail, opts) { + var self = this, doc = nil; + + + + if (start == null) { + start = nil; + }; + + if (jail == null) { + jail = nil; + }; + + if (opts == null) { + opts = $hash2([], {}); + }; + if ($truthy($rb_lt((doc = self.document).$safe(), $$$($$($nesting, 'SafeMode'), 'SAFE')))) { + if ($truthy(start)) { + if ($truthy(doc.$path_resolver()['$root?'](start))) { + } else { + start = $$$('::', 'File').$join(doc.$base_dir(), start) + } + } else { + start = doc.$base_dir() + } + } else { + + if ($truthy(start)) { + } else { + start = doc.$base_dir() + }; + if ($truthy(jail)) { + } else { + jail = doc.$base_dir() + }; + }; + return doc.$path_resolver().$system_path(target, start, jail, opts); + }, TMP_AbstractNode_normalize_system_path_28.$$arity = -2); + + Opal.def(self, '$normalize_web_path', TMP_AbstractNode_normalize_web_path_29 = function $$normalize_web_path(target, start, preserve_uri_target) { + var $a, self = this; + + + + if (start == null) { + start = nil; + }; + + if (preserve_uri_target == null) { + preserve_uri_target = true; + }; + if ($truthy(($truthy($a = preserve_uri_target) ? $$($nesting, 'Helpers')['$uriish?'](target) : $a))) { + return self.$uri_encode_spaces(target) + } else { + return self.document.$path_resolver().$web_path(target, start) + }; + }, TMP_AbstractNode_normalize_web_path_29.$$arity = -2); + + Opal.def(self, '$read_asset', TMP_AbstractNode_read_asset_30 = function $$read_asset(path, opts) { + var TMP_31, $a, self = this; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + if ($truthy($$$('::', 'Hash')['$==='](opts))) { + } else { + opts = $hash2(["warn_on_failure"], {"warn_on_failure": opts['$!='](false)}) + }; + if ($truthy($$$('::', 'File')['$readable?'](path))) { + if ($truthy(opts['$[]']("normalize"))) { + return $$($nesting, 'Helpers').$normalize_lines_array($send($$$('::', 'File'), 'open', [path, "rb"], (TMP_31 = function(f){var self = TMP_31.$$s || this; + + + + if (f == null) { + f = nil; + }; + return f.$each_line().$to_a();}, TMP_31.$$s = self, TMP_31.$$arity = 1, TMP_31))).$join($$($nesting, 'LF')) + } else { + return $$$('::', 'IO').$read(path) + } + } else if ($truthy(opts['$[]']("warn_on_failure"))) { + + self.$logger().$warn("" + (($truthy($a = self.$attr("docfile")) ? $a : "")) + ": " + (($truthy($a = opts['$[]']("label")) ? $a : "file")) + " does not exist or cannot be read: " + (path)); + return nil; + } else { + return nil + }; + }, TMP_AbstractNode_read_asset_30.$$arity = -2); + + Opal.def(self, '$read_contents', TMP_AbstractNode_read_contents_32 = function $$read_contents(target, opts) { + var $a, $b, $c, TMP_33, TMP_34, self = this, doc = nil, start = nil; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + doc = self.document; + if ($truthy(($truthy($a = $$($nesting, 'Helpers')['$uriish?'](target)) ? $a : ($truthy($b = ($truthy($c = (start = opts['$[]']("start"))) ? $$($nesting, 'Helpers')['$uriish?'](start) : $c)) ? (target = doc.$path_resolver().$web_path(target, start)) : $b)))) { + if ($truthy(doc['$attr?']("allow-uri-read"))) { + + if ($truthy(doc['$attr?']("cache-uri"))) { + $$($nesting, 'Helpers').$require_library("open-uri/cached", "open-uri-cached")}; + + try { + if ($truthy(opts['$[]']("normalize"))) { + return $$($nesting, 'Helpers').$normalize_lines_array($send($$$('::', 'OpenURI'), 'open_uri', [target], (TMP_33 = function(f){var self = TMP_33.$$s || this; + + + + if (f == null) { + f = nil; + }; + return f.$each_line().$to_a();}, TMP_33.$$s = self, TMP_33.$$arity = 1, TMP_33))).$join($$($nesting, 'LF')) + } else { + return $send($$$('::', 'OpenURI'), 'open_uri', [target], (TMP_34 = function(f){var self = TMP_34.$$s || this; + + + + if (f == null) { + f = nil; + }; + return f.$read();}, TMP_34.$$s = self, TMP_34.$$arity = 1, TMP_34)) + } + } catch ($err) { + if (Opal.rescue($err, [$$($nesting, 'StandardError')])) { + try { + + if ($truthy(opts.$fetch("warn_on_failure", true))) { + self.$logger().$warn("" + "could not retrieve contents of " + (($truthy($a = opts['$[]']("label")) ? $a : "asset")) + " at URI: " + (target))}; + return nil; + } finally { Opal.pop_exception() } + } else { throw $err; } + };; + } else { + + if ($truthy(opts.$fetch("warn_on_failure", true))) { + self.$logger().$warn("" + "cannot retrieve contents of " + (($truthy($a = opts['$[]']("label")) ? $a : "asset")) + " at URI: " + (target) + " (allow-uri-read attribute not enabled)")}; + return nil; + } + } else { + + target = self.$normalize_system_path(target, opts['$[]']("start"), nil, $hash2(["target_name"], {"target_name": ($truthy($a = opts['$[]']("label")) ? $a : "asset")})); + return self.$read_asset(target, $hash2(["normalize", "warn_on_failure", "label"], {"normalize": opts['$[]']("normalize"), "warn_on_failure": opts.$fetch("warn_on_failure", true), "label": opts['$[]']("label")})); + }; + }, TMP_AbstractNode_read_contents_32.$$arity = -2); + + Opal.def(self, '$uri_encode_spaces', TMP_AbstractNode_uri_encode_spaces_35 = function $$uri_encode_spaces(str) { + var self = this; + + if ($truthy(str['$include?'](" "))) { + + return str.$gsub(" ", "%20"); + } else { + return str + } + }, TMP_AbstractNode_uri_encode_spaces_35.$$arity = 1); + return (Opal.def(self, '$is_uri?', TMP_AbstractNode_is_uri$q_36 = function(str) { + var self = this; + + return $$($nesting, 'Helpers')['$uriish?'](str) + }, TMP_AbstractNode_is_uri$q_36.$$arity = 1), nil) && 'is_uri?'; + })($nesting[0], null, $nesting) + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/abstract_block"] = function(Opal) { + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + function $rb_gt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); + } + function $rb_plus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $hash2 = Opal.hash2, $send = Opal.send, $truthy = Opal.truthy; + + Opal.add_stubs(['$attr_reader', '$attr_writer', '$attr_accessor', '$==', '$!=', '$level', '$file', '$lineno', '$playback_attributes', '$convert', '$converter', '$join', '$map', '$to_s', '$parent', '$parent=', '$-', '$<<', '$!', '$empty?', '$>', '$find_by_internal', '$to_proc', '$[]', '$has_role?', '$replace', '$raise', '$===', '$header?', '$each', '$flatten', '$context', '$blocks', '$+', '$find_index', '$next_adjacent_block', '$select', '$sub_specialchars', '$match?', '$sub_replacements', '$title', '$apply_title_subs', '$include?', '$delete', '$reftext', '$sprintf', '$sub_quotes', '$compat_mode', '$attributes', '$chomp', '$increment_and_store_counter', '$index=', '$numbered', '$sectname', '$counter', '$numeral=', '$numeral', '$caption=', '$assign_numeral', '$reindex_sections']); + return (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + (function($base, $super, $parent_nesting) { + function $AbstractBlock(){}; + var self = $AbstractBlock = $klass($base, $super, 'AbstractBlock', $AbstractBlock); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_AbstractBlock_initialize_1, TMP_AbstractBlock_block$q_2, TMP_AbstractBlock_inline$q_3, TMP_AbstractBlock_file_4, TMP_AbstractBlock_lineno_5, TMP_AbstractBlock_convert_6, TMP_AbstractBlock_content_7, TMP_AbstractBlock_context$eq_9, TMP_AbstractBlock_$lt$lt_10, TMP_AbstractBlock_blocks$q_11, TMP_AbstractBlock_sections$q_12, TMP_AbstractBlock_find_by_13, TMP_AbstractBlock_find_by_internal_14, TMP_AbstractBlock_next_adjacent_block_17, TMP_AbstractBlock_sections_18, TMP_AbstractBlock_alt_20, TMP_AbstractBlock_caption_21, TMP_AbstractBlock_captioned_title_22, TMP_AbstractBlock_list_marker_keyword_23, TMP_AbstractBlock_title_24, TMP_AbstractBlock_title$q_25, TMP_AbstractBlock_title$eq_26, TMP_AbstractBlock_sub$q_27, TMP_AbstractBlock_remove_sub_28, TMP_AbstractBlock_xreftext_29, TMP_AbstractBlock_assign_caption_30, TMP_AbstractBlock_assign_numeral_31, TMP_AbstractBlock_reindex_sections_32; + + def.source_location = def.document = def.attributes = def.blocks = def.next_section_index = def.context = def.style = def.id = def.header = def.caption = def.title_converted = def.converted_title = def.title = def.subs = def.numeral = def.next_section_ordinal = nil; + + self.$attr_reader("blocks"); + self.$attr_writer("caption"); + self.$attr_accessor("content_model"); + self.$attr_accessor("level"); + self.$attr_accessor("numeral"); + Opal.alias(self, "number", "numeral"); + Opal.alias(self, "number=", "numeral="); + self.$attr_accessor("source_location"); + self.$attr_accessor("style"); + self.$attr_reader("subs"); + + Opal.def(self, '$initialize', TMP_AbstractBlock_initialize_1 = function $$initialize(parent, context, opts) { + var $a, $iter = TMP_AbstractBlock_initialize_1.$$p, $yield = $iter || nil, self = this, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_AbstractBlock_initialize_1.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + + + if (opts == null) { + opts = $hash2([], {}); + }; + $send(self, Opal.find_super_dispatcher(self, 'initialize', TMP_AbstractBlock_initialize_1, false), $zuper, $iter); + self.content_model = "compound"; + self.blocks = []; + self.subs = []; + self.id = (self.title = (self.title_converted = (self.caption = (self.numeral = (self.style = (self.default_subs = (self.source_location = nil))))))); + if (context['$==']("document")) { + self.level = 0 + } else if ($truthy(($truthy($a = parent) ? context['$!=']("section") : $a))) { + self.level = parent.$level() + } else { + self.level = nil + }; + self.next_section_index = 0; + return (self.next_section_ordinal = 1); + }, TMP_AbstractBlock_initialize_1.$$arity = -3); + + Opal.def(self, '$block?', TMP_AbstractBlock_block$q_2 = function() { + var self = this; + + return true + }, TMP_AbstractBlock_block$q_2.$$arity = 0); + + Opal.def(self, '$inline?', TMP_AbstractBlock_inline$q_3 = function() { + var self = this; + + return false + }, TMP_AbstractBlock_inline$q_3.$$arity = 0); + + Opal.def(self, '$file', TMP_AbstractBlock_file_4 = function $$file() { + var $a, self = this; + + return ($truthy($a = self.source_location) ? self.source_location.$file() : $a) + }, TMP_AbstractBlock_file_4.$$arity = 0); + + Opal.def(self, '$lineno', TMP_AbstractBlock_lineno_5 = function $$lineno() { + var $a, self = this; + + return ($truthy($a = self.source_location) ? self.source_location.$lineno() : $a) + }, TMP_AbstractBlock_lineno_5.$$arity = 0); + + Opal.def(self, '$convert', TMP_AbstractBlock_convert_6 = function $$convert() { + var self = this; + + + self.document.$playback_attributes(self.attributes); + return self.$converter().$convert(self); + }, TMP_AbstractBlock_convert_6.$$arity = 0); + Opal.alias(self, "render", "convert"); + + Opal.def(self, '$content', TMP_AbstractBlock_content_7 = function $$content() { + var TMP_8, self = this; + + return $send(self.blocks, 'map', [], (TMP_8 = function(b){var self = TMP_8.$$s || this; + + + + if (b == null) { + b = nil; + }; + return b.$convert();}, TMP_8.$$s = self, TMP_8.$$arity = 1, TMP_8)).$join($$($nesting, 'LF')) + }, TMP_AbstractBlock_content_7.$$arity = 0); + + Opal.def(self, '$context=', TMP_AbstractBlock_context$eq_9 = function(context) { + var self = this; + + return (self.node_name = (self.context = context).$to_s()) + }, TMP_AbstractBlock_context$eq_9.$$arity = 1); + + Opal.def(self, '$<<', TMP_AbstractBlock_$lt$lt_10 = function(block) { + var self = this, $writer = nil; + + + if (block.$parent()['$=='](self)) { + } else { + + $writer = [self]; + $send(block, 'parent=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + self.blocks['$<<'](block); + return self; + }, TMP_AbstractBlock_$lt$lt_10.$$arity = 1); + Opal.alias(self, "append", "<<"); + + Opal.def(self, '$blocks?', TMP_AbstractBlock_blocks$q_11 = function() { + var self = this; + + return self.blocks['$empty?']()['$!']() + }, TMP_AbstractBlock_blocks$q_11.$$arity = 0); + + Opal.def(self, '$sections?', TMP_AbstractBlock_sections$q_12 = function() { + var self = this; + + return $rb_gt(self.next_section_index, 0) + }, TMP_AbstractBlock_sections$q_12.$$arity = 0); + + Opal.def(self, '$find_by', TMP_AbstractBlock_find_by_13 = function $$find_by(selector) { + var $iter = TMP_AbstractBlock_find_by_13.$$p, block = $iter || nil, self = this, result = nil; + + if ($iter) TMP_AbstractBlock_find_by_13.$$p = null; + + + if ($iter) TMP_AbstractBlock_find_by_13.$$p = null;; + + if (selector == null) { + selector = $hash2([], {}); + }; + try { + return $send(self, 'find_by_internal', [selector, (result = [])], block.$to_proc()) + } catch ($err) { + if (Opal.rescue($err, [$$$('::', 'StopIteration')])) { + try { + return result + } finally { Opal.pop_exception() } + } else { throw $err; } + }; + }, TMP_AbstractBlock_find_by_13.$$arity = -1); + Opal.alias(self, "query", "find_by"); + + Opal.def(self, '$find_by_internal', TMP_AbstractBlock_find_by_internal_14 = function $$find_by_internal(selector, result) { + var $iter = TMP_AbstractBlock_find_by_internal_14.$$p, block = $iter || nil, $a, $b, $c, $d, TMP_15, TMP_16, self = this, any_context = nil, context_selector = nil, style_selector = nil, role_selector = nil, id_selector = nil, verdict = nil, $case = nil; + + if ($iter) TMP_AbstractBlock_find_by_internal_14.$$p = null; + + + if ($iter) TMP_AbstractBlock_find_by_internal_14.$$p = null;; + + if (selector == null) { + selector = $hash2([], {}); + }; + + if (result == null) { + result = []; + }; + if ($truthy(($truthy($a = ($truthy($b = ($truthy($c = ($truthy($d = (any_context = (context_selector = selector['$[]']("context"))['$!']())) ? $d : context_selector['$=='](self.context))) ? ($truthy($d = (style_selector = selector['$[]']("style"))['$!']()) ? $d : style_selector['$=='](self.style)) : $c)) ? ($truthy($c = (role_selector = selector['$[]']("role"))['$!']()) ? $c : self['$has_role?'](role_selector)) : $b)) ? ($truthy($b = (id_selector = selector['$[]']("id"))['$!']()) ? $b : id_selector['$=='](self.id)) : $a))) { + if ($truthy(id_selector)) { + + result.$replace((function() {if ((block !== nil)) { + + if ($truthy(Opal.yield1(block, self))) { + return [self] + } else { + return [] + }; + } else { + return [self] + }; return nil; })()); + self.$raise($$$('::', 'StopIteration')); + } else if ((block !== nil)) { + if ($truthy((verdict = Opal.yield1(block, self)))) { + $case = verdict; + if ("skip_children"['$===']($case)) { + result['$<<'](self); + return result;} + else if ("skip"['$===']($case)) {return result} + else {result['$<<'](self)}} + } else { + result['$<<'](self) + }}; + if ($truthy(($truthy($a = (($b = self.context['$==']("document")) ? ($truthy($c = any_context) ? $c : context_selector['$==']("section")) : self.context['$==']("document"))) ? self['$header?']() : $a))) { + $send(self.header, 'find_by_internal', [selector, result], block.$to_proc())}; + if (context_selector['$==']("document")) { + } else if (self.context['$==']("dlist")) { + if ($truthy(($truthy($a = any_context) ? $a : context_selector['$!=']("section")))) { + $send(self.blocks.$flatten(), 'each', [], (TMP_15 = function(li){var self = TMP_15.$$s || this; + + + + if (li == null) { + li = nil; + }; + if ($truthy(li)) { + return $send(li, 'find_by_internal', [selector, result], block.$to_proc()) + } else { + return nil + };}, TMP_15.$$s = self, TMP_15.$$arity = 1, TMP_15))} + } else if ($truthy($send(self.blocks, 'each', [], (TMP_16 = function(b){var self = TMP_16.$$s || this, $e; + + + + if (b == null) { + b = nil; + }; + if ($truthy((($e = context_selector['$==']("section")) ? b.$context()['$!=']("section") : context_selector['$==']("section")))) { + return nil;}; + return $send(b, 'find_by_internal', [selector, result], block.$to_proc());}, TMP_16.$$s = self, TMP_16.$$arity = 1, TMP_16)))) {}; + return result; + }, TMP_AbstractBlock_find_by_internal_14.$$arity = -1); + + Opal.def(self, '$next_adjacent_block', TMP_AbstractBlock_next_adjacent_block_17 = function $$next_adjacent_block() { + var self = this, sib = nil, p = nil; + + if (self.context['$==']("document")) { + return nil + } else if ($truthy((sib = (p = self.$parent()).$blocks()['$[]']($rb_plus(p.$blocks().$find_index(self), 1))))) { + return sib + } else { + return p.$next_adjacent_block() + } + }, TMP_AbstractBlock_next_adjacent_block_17.$$arity = 0); + + Opal.def(self, '$sections', TMP_AbstractBlock_sections_18 = function $$sections() { + var TMP_19, self = this; + + return $send(self.blocks, 'select', [], (TMP_19 = function(block){var self = TMP_19.$$s || this; + + + + if (block == null) { + block = nil; + }; + return block.$context()['$==']("section");}, TMP_19.$$s = self, TMP_19.$$arity = 1, TMP_19)) + }, TMP_AbstractBlock_sections_18.$$arity = 0); + + Opal.def(self, '$alt', TMP_AbstractBlock_alt_20 = function $$alt() { + var self = this, text = nil; + + if ($truthy((text = self.attributes['$[]']("alt")))) { + if (text['$=='](self.attributes['$[]']("default-alt"))) { + return self.$sub_specialchars(text) + } else { + + text = self.$sub_specialchars(text); + if ($truthy($$($nesting, 'ReplaceableTextRx')['$match?'](text))) { + + return self.$sub_replacements(text); + } else { + return text + }; + } + } else { + return nil + } + }, TMP_AbstractBlock_alt_20.$$arity = 0); + + Opal.def(self, '$caption', TMP_AbstractBlock_caption_21 = function $$caption() { + var self = this; + + if (self.context['$==']("admonition")) { + return self.attributes['$[]']("textlabel") + } else { + return self.caption + } + }, TMP_AbstractBlock_caption_21.$$arity = 0); + + Opal.def(self, '$captioned_title', TMP_AbstractBlock_captioned_title_22 = function $$captioned_title() { + var self = this; + + return "" + (self.caption) + (self.$title()) + }, TMP_AbstractBlock_captioned_title_22.$$arity = 0); + + Opal.def(self, '$list_marker_keyword', TMP_AbstractBlock_list_marker_keyword_23 = function $$list_marker_keyword(list_type) { + var $a, self = this; + + + + if (list_type == null) { + list_type = nil; + }; + return $$($nesting, 'ORDERED_LIST_KEYWORDS')['$[]'](($truthy($a = list_type) ? $a : self.style)); + }, TMP_AbstractBlock_list_marker_keyword_23.$$arity = -1); + + Opal.def(self, '$title', TMP_AbstractBlock_title_24 = function $$title() { + var $a, $b, self = this; + + if ($truthy(self.title_converted)) { + return self.converted_title + } else { + + return (self.converted_title = ($truthy($a = ($truthy($b = (self.title_converted = true)) ? self.title : $b)) ? self.$apply_title_subs(self.title) : $a)); + } + }, TMP_AbstractBlock_title_24.$$arity = 0); + + Opal.def(self, '$title?', TMP_AbstractBlock_title$q_25 = function() { + var self = this; + + if ($truthy(self.title)) { + return true + } else { + return false + } + }, TMP_AbstractBlock_title$q_25.$$arity = 0); + + Opal.def(self, '$title=', TMP_AbstractBlock_title$eq_26 = function(val) { + var $a, self = this; + + return $a = [val, nil], (self.title = $a[0]), (self.title_converted = $a[1]), $a + }, TMP_AbstractBlock_title$eq_26.$$arity = 1); + + Opal.def(self, '$sub?', TMP_AbstractBlock_sub$q_27 = function(name) { + var self = this; + + return self.subs['$include?'](name) + }, TMP_AbstractBlock_sub$q_27.$$arity = 1); + + Opal.def(self, '$remove_sub', TMP_AbstractBlock_remove_sub_28 = function $$remove_sub(sub) { + var self = this; + + + self.subs.$delete(sub); + return nil; + }, TMP_AbstractBlock_remove_sub_28.$$arity = 1); + + Opal.def(self, '$xreftext', TMP_AbstractBlock_xreftext_29 = function $$xreftext(xrefstyle) { + var $a, $b, self = this, val = nil, $case = nil, quoted_title = nil, prefix = nil; + + + + if (xrefstyle == null) { + xrefstyle = nil; + }; + if ($truthy(($truthy($a = (val = self.$reftext())) ? val['$empty?']()['$!']() : $a))) { + return val + } else if ($truthy(($truthy($a = ($truthy($b = xrefstyle) ? self.title : $b)) ? self.caption : $a))) { + return (function() {$case = xrefstyle; + if ("full"['$===']($case)) { + quoted_title = self.$sprintf(self.$sub_quotes((function() {if ($truthy(self.document.$compat_mode())) { + return "``%s''" + } else { + return "\"`%s`\"" + }; return nil; })()), self.$title()); + if ($truthy(($truthy($a = self.numeral) ? (prefix = self.document.$attributes()['$[]']((function() {if (self.context['$==']("image")) { + return "figure-caption" + } else { + return "" + (self.context) + "-caption" + }; return nil; })())) : $a))) { + return "" + (prefix) + " " + (self.numeral) + ", " + (quoted_title) + } else { + return "" + (self.caption.$chomp(". ")) + ", " + (quoted_title) + };} + else if ("short"['$===']($case)) {if ($truthy(($truthy($a = self.numeral) ? (prefix = self.document.$attributes()['$[]']((function() {if (self.context['$==']("image")) { + return "figure-caption" + } else { + return "" + (self.context) + "-caption" + }; return nil; })())) : $a))) { + return "" + (prefix) + " " + (self.numeral) + } else { + return self.caption.$chomp(". ") + }} + else {return self.$title()}})() + } else { + return self.$title() + }; + }, TMP_AbstractBlock_xreftext_29.$$arity = -1); + + Opal.def(self, '$assign_caption', TMP_AbstractBlock_assign_caption_30 = function $$assign_caption(value, key) { + var $a, $b, self = this, prefix = nil; + + + + if (value == null) { + value = nil; + }; + + if (key == null) { + key = nil; + }; + if ($truthy(($truthy($a = ($truthy($b = self.caption) ? $b : self.title['$!']())) ? $a : (self.caption = ($truthy($b = value) ? $b : self.document.$attributes()['$[]']("caption")))))) { + return nil + } else if ($truthy((prefix = self.document.$attributes()['$[]']("" + ((key = ($truthy($a = key) ? $a : self.context))) + "-caption")))) { + + self.caption = "" + (prefix) + " " + ((self.numeral = self.document.$increment_and_store_counter("" + (key) + "-number", self))) + ". "; + return nil; + } else { + return nil + }; + }, TMP_AbstractBlock_assign_caption_30.$$arity = -1); + + Opal.def(self, '$assign_numeral', TMP_AbstractBlock_assign_numeral_31 = function $$assign_numeral(section) { + var $a, self = this, $writer = nil, like = nil, sectname = nil, caption = nil; + + + self.next_section_index = $rb_plus((($writer = [self.next_section_index]), $send(section, 'index=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]), 1); + if ($truthy((like = section.$numbered()))) { + if ((sectname = section.$sectname())['$==']("appendix")) { + + + $writer = [self.document.$counter("appendix-number", "A")]; + $send(section, 'numeral=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + if ($truthy((caption = self.document.$attributes()['$[]']("appendix-caption")))) { + + $writer = ["" + (caption) + " " + (section.$numeral()) + ": "]; + $send(section, 'caption=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + } else { + + $writer = ["" + (section.$numeral()) + ". "]; + $send(section, 'caption=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + } else if ($truthy(($truthy($a = sectname['$==']("chapter")) ? $a : like['$==']("chapter")))) { + + $writer = [self.document.$counter("chapter-number", 1)]; + $send(section, 'numeral=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + } else { + + + $writer = [self.next_section_ordinal]; + $send(section, 'numeral=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + self.next_section_ordinal = $rb_plus(self.next_section_ordinal, 1); + }}; + return nil; + }, TMP_AbstractBlock_assign_numeral_31.$$arity = 1); + return (Opal.def(self, '$reindex_sections', TMP_AbstractBlock_reindex_sections_32 = function $$reindex_sections() { + var TMP_33, self = this; + + + self.next_section_index = 0; + self.next_section_ordinal = 1; + return $send(self.blocks, 'each', [], (TMP_33 = function(block){var self = TMP_33.$$s || this; + + + + if (block == null) { + block = nil; + }; + if (block.$context()['$==']("section")) { + + self.$assign_numeral(block); + return block.$reindex_sections(); + } else { + return nil + };}, TMP_33.$$s = self, TMP_33.$$arity = 1, TMP_33)); + }, TMP_AbstractBlock_reindex_sections_32.$$arity = 0), nil) && 'reindex_sections'; + })($nesting[0], $$($nesting, 'AbstractNode'), $nesting) + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/attribute_list"] = function(Opal) { + function $rb_plus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); + } + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + function $rb_times(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs * rhs : lhs['$*'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $hash = Opal.hash, $hash2 = Opal.hash2, $truthy = Opal.truthy, $send = Opal.send; + + Opal.add_stubs(['$new', '$[]', '$update', '$parse', '$parse_attribute', '$eos?', '$skip_delimiter', '$+', '$rekey', '$each_with_index', '$[]=', '$-', '$skip_blank', '$==', '$peek', '$parse_attribute_value', '$get_byte', '$start_with?', '$scan_name', '$!', '$!=', '$*', '$scan_to_delimiter', '$===', '$include?', '$delete', '$each', '$split', '$empty?', '$strip', '$apply_subs', '$scan_to_quote', '$gsub', '$skip', '$scan']); + return (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + (function($base, $super, $parent_nesting) { + function $AttributeList(){}; + var self = $AttributeList = $klass($base, $super, 'AttributeList', $AttributeList); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_AttributeList_initialize_1, TMP_AttributeList_parse_into_2, TMP_AttributeList_parse_3, TMP_AttributeList_rekey_4, TMP_AttributeList_rekey_5, TMP_AttributeList_parse_attribute_7, TMP_AttributeList_parse_attribute_value_9, TMP_AttributeList_skip_blank_10, TMP_AttributeList_skip_delimiter_11, TMP_AttributeList_scan_name_12, TMP_AttributeList_scan_to_delimiter_13, TMP_AttributeList_scan_to_quote_14; + + def.attributes = def.scanner = def.delimiter = def.block = def.delimiter_skip_pattern = def.delimiter_boundary_pattern = nil; + + Opal.const_set($nesting[0], 'BACKSLASH', "\\"); + Opal.const_set($nesting[0], 'APOS', "'"); + Opal.const_set($nesting[0], 'BoundaryRxs', $hash("\"", /.*?[^\\](?=")/, $$($nesting, 'APOS'), /.*?[^\\](?=')/, ",", /.*?(?=[ \t]*(,|$))/)); + Opal.const_set($nesting[0], 'EscapedQuotes', $hash("\"", "\\\"", $$($nesting, 'APOS'), "\\'")); + Opal.const_set($nesting[0], 'NameRx', new RegExp("" + ($$($nesting, 'CG_WORD')) + "[" + ($$($nesting, 'CC_WORD')) + "\\-.]*")); + Opal.const_set($nesting[0], 'BlankRx', /[ \t]+/); + Opal.const_set($nesting[0], 'SkipRxs', $hash2(["blank", ","], {"blank": $$($nesting, 'BlankRx'), ",": /[ \t]*(,|$)/})); + + Opal.def(self, '$initialize', TMP_AttributeList_initialize_1 = function $$initialize(source, block, delimiter) { + var self = this; + + + + if (block == null) { + block = nil; + }; + + if (delimiter == null) { + delimiter = ","; + }; + self.scanner = $$$('::', 'StringScanner').$new(source); + self.block = block; + self.delimiter = delimiter; + self.delimiter_skip_pattern = $$($nesting, 'SkipRxs')['$[]'](delimiter); + self.delimiter_boundary_pattern = $$($nesting, 'BoundaryRxs')['$[]'](delimiter); + return (self.attributes = nil); + }, TMP_AttributeList_initialize_1.$$arity = -2); + + Opal.def(self, '$parse_into', TMP_AttributeList_parse_into_2 = function $$parse_into(attributes, posattrs) { + var self = this; + + + + if (posattrs == null) { + posattrs = []; + }; + return attributes.$update(self.$parse(posattrs)); + }, TMP_AttributeList_parse_into_2.$$arity = -2); + + Opal.def(self, '$parse', TMP_AttributeList_parse_3 = function $$parse(posattrs) { + var $a, self = this, index = nil; + + + + if (posattrs == null) { + posattrs = []; + }; + if ($truthy(self.attributes)) { + return self.attributes}; + self.attributes = $hash2([], {}); + index = 0; + while ($truthy(self.$parse_attribute(index, posattrs))) { + + if ($truthy(self.scanner['$eos?']())) { + break;}; + self.$skip_delimiter(); + index = $rb_plus(index, 1); + }; + return self.attributes; + }, TMP_AttributeList_parse_3.$$arity = -1); + + Opal.def(self, '$rekey', TMP_AttributeList_rekey_4 = function $$rekey(posattrs) { + var self = this; + + return $$($nesting, 'AttributeList').$rekey(self.attributes, posattrs) + }, TMP_AttributeList_rekey_4.$$arity = 1); + Opal.defs(self, '$rekey', TMP_AttributeList_rekey_5 = function $$rekey(attributes, pos_attrs) { + var TMP_6, self = this; + + + $send(pos_attrs, 'each_with_index', [], (TMP_6 = function(key, index){var self = TMP_6.$$s || this, pos = nil, val = nil, $writer = nil; + + + + if (key == null) { + key = nil; + }; + + if (index == null) { + index = nil; + }; + if ($truthy(key)) { + } else { + return nil; + }; + pos = $rb_plus(index, 1); + if ($truthy((val = attributes['$[]'](pos)))) { + + $writer = [key, val]; + $send(attributes, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + } else { + return nil + };}, TMP_6.$$s = self, TMP_6.$$arity = 2, TMP_6)); + return attributes; + }, TMP_AttributeList_rekey_5.$$arity = 2); + + Opal.def(self, '$parse_attribute', TMP_AttributeList_parse_attribute_7 = function $$parse_attribute(index, pos_attrs) { + var $a, TMP_8, self = this, single_quoted_value = nil, first = nil, name = nil, value = nil, skipped = nil, c = nil, $case = nil, $writer = nil, resolved_name = nil, pos_name = nil; + + + + if (index == null) { + index = 0; + }; + + if (pos_attrs == null) { + pos_attrs = []; + }; + single_quoted_value = false; + self.$skip_blank(); + if ((first = self.scanner.$peek(1))['$==']("\"")) { + + name = self.$parse_attribute_value(self.scanner.$get_byte()); + value = nil; + } else if (first['$==']($$($nesting, 'APOS'))) { + + name = self.$parse_attribute_value(self.scanner.$get_byte()); + value = nil; + if ($truthy(name['$start_with?']($$($nesting, 'APOS')))) { + } else { + single_quoted_value = true + }; + } else { + + name = self.$scan_name(); + skipped = 0; + c = nil; + if ($truthy(self.scanner['$eos?']())) { + if ($truthy(name)) { + } else { + return false + } + } else { + + skipped = ($truthy($a = self.$skip_blank()) ? $a : 0); + c = self.scanner.$get_byte(); + }; + if ($truthy(($truthy($a = c['$!']()) ? $a : c['$=='](self.delimiter)))) { + value = nil + } else if ($truthy(($truthy($a = c['$!=']("=")) ? $a : name['$!']()))) { + + name = "" + (name) + ($rb_times(" ", skipped)) + (c) + (self.$scan_to_delimiter()); + value = nil; + } else { + + self.$skip_blank(); + if ($truthy(self.scanner.$peek(1))) { + if ((c = self.scanner.$get_byte())['$==']("\"")) { + value = self.$parse_attribute_value(c) + } else if (c['$==']($$($nesting, 'APOS'))) { + + value = self.$parse_attribute_value(c); + if ($truthy(value['$start_with?']($$($nesting, 'APOS')))) { + } else { + single_quoted_value = true + }; + } else if (c['$=='](self.delimiter)) { + value = "" + } else { + + value = "" + (c) + (self.$scan_to_delimiter()); + if (value['$==']("None")) { + return true}; + }}; + }; + }; + if ($truthy(value)) { + $case = name; + if ("options"['$===']($case) || "opts"['$===']($case)) { + if ($truthy(value['$include?'](","))) { + + if ($truthy(value['$include?'](" "))) { + value = value.$delete(" ")}; + $send(value.$split(","), 'each', [], (TMP_8 = function(opt){var self = TMP_8.$$s || this, $writer = nil; + if (self.attributes == null) self.attributes = nil; + + + + if (opt == null) { + opt = nil; + }; + if ($truthy(opt['$empty?']())) { + return nil + } else { + + $writer = ["" + (opt) + "-option", ""]; + $send(self.attributes, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + };}, TMP_8.$$s = self, TMP_8.$$arity = 1, TMP_8)); + } else { + + $writer = ["" + ((value = value.$strip())) + "-option", ""]; + $send(self.attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + + $writer = ["options", value]; + $send(self.attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];;} + else {if ($truthy(($truthy($a = single_quoted_value) ? self.block : $a))) { + $case = name; + if ("title"['$===']($case) || "reftext"['$===']($case)) { + $writer = [name, value]; + $send(self.attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];} + else { + $writer = [name, self.block.$apply_subs(value)]; + $send(self.attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];} + } else { + + $writer = [name, value]; + $send(self.attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }} + } else { + + resolved_name = (function() {if ($truthy(($truthy($a = single_quoted_value) ? self.block : $a))) { + + return self.block.$apply_subs(name); + } else { + return name + }; return nil; })(); + if ($truthy((pos_name = pos_attrs['$[]'](index)))) { + + $writer = [pos_name, resolved_name]; + $send(self.attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + + $writer = [$rb_plus(index, 1), resolved_name]; + $send(self.attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + }; + return true; + }, TMP_AttributeList_parse_attribute_7.$$arity = -1); + + Opal.def(self, '$parse_attribute_value', TMP_AttributeList_parse_attribute_value_9 = function $$parse_attribute_value(quote) { + var self = this, value = nil; + + + if (self.scanner.$peek(1)['$=='](quote)) { + + self.scanner.$get_byte(); + return "";}; + if ($truthy((value = self.$scan_to_quote(quote)))) { + + self.scanner.$get_byte(); + if ($truthy(value['$include?']($$($nesting, 'BACKSLASH')))) { + return value.$gsub($$($nesting, 'EscapedQuotes')['$[]'](quote), quote) + } else { + return value + }; + } else { + return "" + (quote) + (self.$scan_to_delimiter()) + }; + }, TMP_AttributeList_parse_attribute_value_9.$$arity = 1); + + Opal.def(self, '$skip_blank', TMP_AttributeList_skip_blank_10 = function $$skip_blank() { + var self = this; + + return self.scanner.$skip($$($nesting, 'BlankRx')) + }, TMP_AttributeList_skip_blank_10.$$arity = 0); + + Opal.def(self, '$skip_delimiter', TMP_AttributeList_skip_delimiter_11 = function $$skip_delimiter() { + var self = this; + + return self.scanner.$skip(self.delimiter_skip_pattern) + }, TMP_AttributeList_skip_delimiter_11.$$arity = 0); + + Opal.def(self, '$scan_name', TMP_AttributeList_scan_name_12 = function $$scan_name() { + var self = this; + + return self.scanner.$scan($$($nesting, 'NameRx')) + }, TMP_AttributeList_scan_name_12.$$arity = 0); + + Opal.def(self, '$scan_to_delimiter', TMP_AttributeList_scan_to_delimiter_13 = function $$scan_to_delimiter() { + var self = this; + + return self.scanner.$scan(self.delimiter_boundary_pattern) + }, TMP_AttributeList_scan_to_delimiter_13.$$arity = 0); + return (Opal.def(self, '$scan_to_quote', TMP_AttributeList_scan_to_quote_14 = function $$scan_to_quote(quote) { + var self = this; + + return self.scanner.$scan($$($nesting, 'BoundaryRxs')['$[]'](quote)) + }, TMP_AttributeList_scan_to_quote_14.$$arity = 1), nil) && 'scan_to_quote'; + })($nesting[0], null, $nesting) + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/block"] = function(Opal) { + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + function $rb_lt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $send = Opal.send, $hash2 = Opal.hash2, $truthy = Opal.truthy; + + Opal.add_stubs(['$default=', '$-', '$attr_accessor', '$[]', '$key?', '$==', '$===', '$drop', '$delete', '$[]=', '$lock_in_subs', '$nil_or_empty?', '$normalize_lines_from_string', '$apply_subs', '$join', '$<', '$size', '$empty?', '$rstrip', '$shift', '$pop', '$warn', '$logger', '$to_s', '$class', '$object_id', '$inspect']); + return (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + (function($base, $super, $parent_nesting) { + function $Block(){}; + var self = $Block = $klass($base, $super, 'Block', $Block); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Block_initialize_1, TMP_Block_content_2, TMP_Block_source_3, TMP_Block_to_s_4, $writer = nil; + + def.attributes = def.content_model = def.lines = def.subs = def.blocks = def.context = def.style = nil; + + + $writer = ["simple"]; + $send(Opal.const_set($nesting[0], 'DEFAULT_CONTENT_MODEL', $hash2(["audio", "image", "listing", "literal", "stem", "open", "page_break", "pass", "thematic_break", "video"], {"audio": "empty", "image": "empty", "listing": "verbatim", "literal": "verbatim", "stem": "raw", "open": "compound", "page_break": "empty", "pass": "raw", "thematic_break": "empty", "video": "empty"})), 'default=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + Opal.alias(self, "blockname", "context"); + self.$attr_accessor("lines"); + + Opal.def(self, '$initialize', TMP_Block_initialize_1 = function $$initialize(parent, context, opts) { + var $a, $iter = TMP_Block_initialize_1.$$p, $yield = $iter || nil, self = this, subs = nil, $writer = nil, raw_source = nil, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_Block_initialize_1.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + + + if (opts == null) { + opts = $hash2([], {}); + }; + $send(self, Opal.find_super_dispatcher(self, 'initialize', TMP_Block_initialize_1, false), $zuper, $iter); + self.content_model = ($truthy($a = opts['$[]']("content_model")) ? $a : $$($nesting, 'DEFAULT_CONTENT_MODEL')['$[]'](context)); + if ($truthy(opts['$key?']("subs"))) { + if ($truthy((subs = opts['$[]']("subs")))) { + + if (subs['$==']("default")) { + self.default_subs = opts['$[]']("default_subs") + } else if ($truthy($$$('::', 'Array')['$==='](subs))) { + + self.default_subs = subs.$drop(0); + self.attributes.$delete("subs"); + } else { + + self.default_subs = nil; + + $writer = ["subs", "" + (subs)]; + $send(self.attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + }; + self.$lock_in_subs(); + } else { + + self.default_subs = []; + self.attributes.$delete("subs"); + } + } else { + self.default_subs = nil + }; + if ($truthy((raw_source = opts['$[]']("source"))['$nil_or_empty?']())) { + return (self.lines = []) + } else if ($truthy($$$('::', 'String')['$==='](raw_source))) { + return (self.lines = $$($nesting, 'Helpers').$normalize_lines_from_string(raw_source)) + } else { + return (self.lines = raw_source.$drop(0)) + }; + }, TMP_Block_initialize_1.$$arity = -3); + + Opal.def(self, '$content', TMP_Block_content_2 = function $$content() { + var $a, $b, $iter = TMP_Block_content_2.$$p, $yield = $iter || nil, self = this, $case = nil, result = nil, first = nil, last = nil, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_Block_content_2.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + return (function() {$case = self.content_model; + if ("compound"['$===']($case)) {return $send(self, Opal.find_super_dispatcher(self, 'content', TMP_Block_content_2, false), $zuper, $iter)} + else if ("simple"['$===']($case)) {return self.$apply_subs(self.lines.$join($$($nesting, 'LF')), self.subs)} + else if ("verbatim"['$===']($case) || "raw"['$===']($case)) { + result = self.$apply_subs(self.lines, self.subs); + if ($truthy($rb_lt(result.$size(), 2))) { + return result['$[]'](0) + } else { + + while ($truthy(($truthy($b = (first = result['$[]'](0))) ? first.$rstrip()['$empty?']() : $b))) { + result.$shift() + }; + while ($truthy(($truthy($b = (last = result['$[]'](-1))) ? last.$rstrip()['$empty?']() : $b))) { + result.$pop() + }; + return result.$join($$($nesting, 'LF')); + };} + else { + if (self.content_model['$==']("empty")) { + } else { + self.$logger().$warn("" + "Unknown content model '" + (self.content_model) + "' for block: " + (self.$to_s())) + }; + return nil;}})() + }, TMP_Block_content_2.$$arity = 0); + + Opal.def(self, '$source', TMP_Block_source_3 = function $$source() { + var self = this; + + return self.lines.$join($$($nesting, 'LF')) + }, TMP_Block_source_3.$$arity = 0); + return (Opal.def(self, '$to_s', TMP_Block_to_s_4 = function $$to_s() { + var self = this, content_summary = nil; + + + content_summary = (function() {if (self.content_model['$==']("compound")) { + return "" + "blocks: " + (self.blocks.$size()) + } else { + return "" + "lines: " + (self.lines.$size()) + }; return nil; })(); + return "" + "#<" + (self.$class()) + "@" + (self.$object_id()) + " {context: " + (self.context.$inspect()) + ", content_model: " + (self.content_model.$inspect()) + ", style: " + (self.style.$inspect()) + ", " + (content_summary) + "}>"; + }, TMP_Block_to_s_4.$$arity = 0), nil) && 'to_s'; + })($nesting[0], $$($nesting, 'AbstractBlock'), $nesting) + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/callouts"] = function(Opal) { + function $rb_plus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); + } + function $rb_le(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs <= rhs : lhs['$<='](rhs); + } + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + function $rb_lt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $hash2 = Opal.hash2, $truthy = Opal.truthy, $send = Opal.send; + + Opal.add_stubs(['$next_list', '$<<', '$current_list', '$to_i', '$generate_next_callout_id', '$+', '$<=', '$size', '$[]', '$-', '$chop', '$join', '$map', '$==', '$<', '$generate_callout_id']); + return (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + (function($base, $super, $parent_nesting) { + function $Callouts(){}; + var self = $Callouts = $klass($base, $super, 'Callouts', $Callouts); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Callouts_initialize_1, TMP_Callouts_register_2, TMP_Callouts_read_next_id_3, TMP_Callouts_callout_ids_4, TMP_Callouts_current_list_6, TMP_Callouts_next_list_7, TMP_Callouts_rewind_8, TMP_Callouts_generate_next_callout_id_9, TMP_Callouts_generate_callout_id_10; + + def.co_index = def.lists = def.list_index = nil; + + + Opal.def(self, '$initialize', TMP_Callouts_initialize_1 = function $$initialize() { + var self = this; + + + self.lists = []; + self.list_index = 0; + return self.$next_list(); + }, TMP_Callouts_initialize_1.$$arity = 0); + + Opal.def(self, '$register', TMP_Callouts_register_2 = function $$register(li_ordinal) { + var self = this, id = nil; + + + self.$current_list()['$<<']($hash2(["ordinal", "id"], {"ordinal": li_ordinal.$to_i(), "id": (id = self.$generate_next_callout_id())})); + self.co_index = $rb_plus(self.co_index, 1); + return id; + }, TMP_Callouts_register_2.$$arity = 1); + + Opal.def(self, '$read_next_id', TMP_Callouts_read_next_id_3 = function $$read_next_id() { + var self = this, id = nil, list = nil; + + + id = nil; + list = self.$current_list(); + if ($truthy($rb_le(self.co_index, list.$size()))) { + id = list['$[]']($rb_minus(self.co_index, 1))['$[]']("id")}; + self.co_index = $rb_plus(self.co_index, 1); + return id; + }, TMP_Callouts_read_next_id_3.$$arity = 0); + + Opal.def(self, '$callout_ids', TMP_Callouts_callout_ids_4 = function $$callout_ids(li_ordinal) { + var TMP_5, self = this; + + return $send(self.$current_list(), 'map', [], (TMP_5 = function(it){var self = TMP_5.$$s || this; + + + + if (it == null) { + it = nil; + }; + if (it['$[]']("ordinal")['$=='](li_ordinal)) { + return "" + (it['$[]']("id")) + " " + } else { + return "" + };}, TMP_5.$$s = self, TMP_5.$$arity = 1, TMP_5)).$join().$chop() + }, TMP_Callouts_callout_ids_4.$$arity = 1); + + Opal.def(self, '$current_list', TMP_Callouts_current_list_6 = function $$current_list() { + var self = this; + + return self.lists['$[]']($rb_minus(self.list_index, 1)) + }, TMP_Callouts_current_list_6.$$arity = 0); + + Opal.def(self, '$next_list', TMP_Callouts_next_list_7 = function $$next_list() { + var self = this; + + + self.list_index = $rb_plus(self.list_index, 1); + if ($truthy($rb_lt(self.lists.$size(), self.list_index))) { + self.lists['$<<']([])}; + self.co_index = 1; + return nil; + }, TMP_Callouts_next_list_7.$$arity = 0); + + Opal.def(self, '$rewind', TMP_Callouts_rewind_8 = function $$rewind() { + var self = this; + + + self.list_index = 1; + self.co_index = 1; + return nil; + }, TMP_Callouts_rewind_8.$$arity = 0); + + Opal.def(self, '$generate_next_callout_id', TMP_Callouts_generate_next_callout_id_9 = function $$generate_next_callout_id() { + var self = this; + + return self.$generate_callout_id(self.list_index, self.co_index) + }, TMP_Callouts_generate_next_callout_id_9.$$arity = 0); + return (Opal.def(self, '$generate_callout_id', TMP_Callouts_generate_callout_id_10 = function $$generate_callout_id(list_index, co_index) { + var self = this; + + return "" + "CO" + (list_index) + "-" + (co_index) + }, TMP_Callouts_generate_callout_id_10.$$arity = 2), nil) && 'generate_callout_id'; + })($nesting[0], null, $nesting) + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/converter/base"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $hash2 = Opal.hash2, $truthy = Opal.truthy; + + Opal.add_stubs(['$include', '$node_name', '$empty?', '$send', '$content']); + return (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + + (function($base, $parent_nesting) { + function $Converter() {}; + var self = $Converter = $module($base, 'Converter', $Converter); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + nil + })($nesting[0], $nesting); + (function($base, $super, $parent_nesting) { + function $Base(){}; + var self = $Base = $klass($base, $super, 'Base', $Base); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + + self.$include($$($nesting, 'Logging')); + return self.$include($$($nesting, 'Converter')); + })($$($nesting, 'Converter'), null, $nesting); + (function($base, $super, $parent_nesting) { + function $BuiltIn(){}; + var self = $BuiltIn = $klass($base, $super, 'BuiltIn', $BuiltIn); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_BuiltIn_initialize_1, TMP_BuiltIn_convert_2, TMP_BuiltIn_content_3, TMP_BuiltIn_skip_4; + + + self.$include($$($nesting, 'Logging')); + + Opal.def(self, '$initialize', TMP_BuiltIn_initialize_1 = function $$initialize(backend, opts) { + var self = this; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + return nil; + }, TMP_BuiltIn_initialize_1.$$arity = -2); + + Opal.def(self, '$convert', TMP_BuiltIn_convert_2 = function $$convert(node, transform, opts) { + var $a, self = this; + + + + if (transform == null) { + transform = nil; + }; + + if (opts == null) { + opts = $hash2([], {}); + }; + transform = ($truthy($a = transform) ? $a : node.$node_name()); + if ($truthy(opts['$empty?']())) { + + return self.$send(transform, node); + } else { + + return self.$send(transform, node, opts); + }; + }, TMP_BuiltIn_convert_2.$$arity = -2); + Opal.alias(self, "handles?", "respond_to?"); + + Opal.def(self, '$content', TMP_BuiltIn_content_3 = function $$content(node) { + var self = this; + + return node.$content() + }, TMP_BuiltIn_content_3.$$arity = 1); + Opal.alias(self, "pass", "content"); + return (Opal.def(self, '$skip', TMP_BuiltIn_skip_4 = function $$skip(node) { + var self = this; + + return nil + }, TMP_BuiltIn_skip_4.$$arity = 1), nil) && 'skip'; + })($$($nesting, 'Converter'), null, $nesting); + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/converter/factory"] = function(Opal) { + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $truthy = Opal.truthy, $hash2 = Opal.hash2, $send = Opal.send; + + Opal.add_stubs(['$new', '$require', '$include?', '$include', '$warn', '$logger', '$register', '$default', '$resolve', '$create', '$converters', '$unregister_all', '$attr_reader', '$each', '$[]=', '$-', '$==', '$[]', '$clear', '$===', '$supports_templates?', '$to_s', '$key?']); + return (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + (function($base, $parent_nesting) { + function $Converter() {}; + var self = $Converter = $module($base, 'Converter', $Converter); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + (function($base, $super, $parent_nesting) { + function $Factory(){}; + var self = $Factory = $klass($base, $super, 'Factory', $Factory); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Factory_initialize_7, TMP_Factory_register_8, TMP_Factory_resolve_10, TMP_Factory_unregister_all_11, TMP_Factory_create_12; + + def.converters = def.star_converter = nil; + + self.__default__ = nil; + (function(self, $parent_nesting) { + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_default_1, TMP_register_2, TMP_resolve_3, TMP_create_4, TMP_converters_5, TMP_unregister_all_6; + + + + Opal.def(self, '$default', TMP_default_1 = function(initialize_singleton) { + var $a, $b, $c, self = this; + if (self.__default__ == null) self.__default__ = nil; + + + + if (initialize_singleton == null) { + initialize_singleton = true; + }; + if ($truthy(initialize_singleton)) { + } else { + return ($truthy($a = self.__default__) ? $a : self.$new()) + }; + return (self.__default__ = ($truthy($a = self.__default__) ? $a : (function() { try { + + if ($truthy((($c = $$$('::', 'Concurrent', 'skip_raise')) && ($b = $$$($c, 'Hash', 'skip_raise')) ? 'constant' : nil))) { + } else { + self.$require((function() {if ($truthy($$$('::', 'RUBY_MIN_VERSION_1_9'))) { + return "concurrent/hash" + } else { + return "asciidoctor/core_ext/1.8.7/concurrent/hash" + }; return nil; })()) + }; + return self.$new($$$($$$('::', 'Concurrent'), 'Hash').$new()); + } catch ($err) { + if (Opal.rescue($err, [$$$('::', 'LoadError')])) { + try { + + if ($truthy(self['$include?']($$($nesting, 'Logging')))) { + } else { + self.$include($$($nesting, 'Logging')) + }; + self.$logger().$warn("gem 'concurrent-ruby' is not installed. This gem is recommended when registering custom converters."); + return self.$new(); + } finally { Opal.pop_exception() } + } else { throw $err; } + }})())); + }, TMP_default_1.$$arity = -1); + + Opal.def(self, '$register', TMP_register_2 = function $$register(converter, backends) { + var self = this; + + + + if (backends == null) { + backends = ["*"]; + }; + return self.$default().$register(converter, backends); + }, TMP_register_2.$$arity = -2); + + Opal.def(self, '$resolve', TMP_resolve_3 = function $$resolve(backend) { + var self = this; + + return self.$default().$resolve(backend) + }, TMP_resolve_3.$$arity = 1); + + Opal.def(self, '$create', TMP_create_4 = function $$create(backend, opts) { + var self = this; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + return self.$default().$create(backend, opts); + }, TMP_create_4.$$arity = -2); + + Opal.def(self, '$converters', TMP_converters_5 = function $$converters() { + var self = this; + + return self.$default().$converters() + }, TMP_converters_5.$$arity = 0); + return (Opal.def(self, '$unregister_all', TMP_unregister_all_6 = function $$unregister_all() { + var self = this; + + return self.$default().$unregister_all() + }, TMP_unregister_all_6.$$arity = 0), nil) && 'unregister_all'; + })(Opal.get_singleton_class(self), $nesting); + self.$attr_reader("converters"); + + Opal.def(self, '$initialize', TMP_Factory_initialize_7 = function $$initialize(converters) { + var $a, self = this; + + + + if (converters == null) { + converters = nil; + }; + self.converters = ($truthy($a = converters) ? $a : $hash2([], {})); + return (self.star_converter = nil); + }, TMP_Factory_initialize_7.$$arity = -1); + + Opal.def(self, '$register', TMP_Factory_register_8 = function $$register(converter, backends) { + var TMP_9, self = this; + + + + if (backends == null) { + backends = ["*"]; + }; + $send(backends, 'each', [], (TMP_9 = function(backend){var self = TMP_9.$$s || this, $writer = nil; + if (self.converters == null) self.converters = nil; + + + + if (backend == null) { + backend = nil; + }; + + $writer = [backend, converter]; + $send(self.converters, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + if (backend['$==']("*")) { + return (self.star_converter = converter) + } else { + return nil + };}, TMP_9.$$s = self, TMP_9.$$arity = 1, TMP_9)); + return nil; + }, TMP_Factory_register_8.$$arity = -2); + + Opal.def(self, '$resolve', TMP_Factory_resolve_10 = function $$resolve(backend) { + var $a, $b, self = this; + + return ($truthy($a = self.converters) ? ($truthy($b = self.converters['$[]'](backend)) ? $b : self.star_converter) : $a) + }, TMP_Factory_resolve_10.$$arity = 1); + + Opal.def(self, '$unregister_all', TMP_Factory_unregister_all_11 = function $$unregister_all() { + var self = this; + + + self.converters.$clear(); + return (self.star_converter = nil); + }, TMP_Factory_unregister_all_11.$$arity = 0); + return (Opal.def(self, '$create', TMP_Factory_create_12 = function $$create(backend, opts) { + var $a, $b, $c, $d, $e, $f, $g, $h, $i, $j, $k, $l, $m, $n, $o, $p, $q, $r, self = this, converter = nil, base_converter = nil, $case = nil, template_converter = nil; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + if ($truthy((converter = self.$resolve(backend)))) { + + base_converter = (function() {if ($truthy($$$('::', 'Class')['$==='](converter))) { + + return converter.$new(backend, opts); + } else { + return converter + }; return nil; })(); + if ($truthy(($truthy($a = $$$($$($nesting, 'Converter'), 'BackendInfo')['$==='](base_converter)) ? base_converter['$supports_templates?']() : $a))) { + } else { + return base_converter + }; + } else { + $case = backend; + if ("html5"['$===']($case)) { + if ($truthy((($c = $$$('::', 'Asciidoctor', 'skip_raise')) && ($b = $$$($c, 'Converter', 'skip_raise')) && ($a = $$$($b, 'Html5Converter', 'skip_raise')) ? 'constant' : nil))) { + } else { + self.$require("asciidoctor/converter/html5".$to_s()) + }; + base_converter = $$($nesting, 'Html5Converter').$new(backend, opts);} + else if ("docbook5"['$===']($case)) { + if ($truthy((($f = $$$('::', 'Asciidoctor', 'skip_raise')) && ($e = $$$($f, 'Converter', 'skip_raise')) && ($d = $$$($e, 'DocBook5Converter', 'skip_raise')) ? 'constant' : nil))) { + } else { + self.$require("asciidoctor/converter/docbook5".$to_s()) + }; + base_converter = $$($nesting, 'DocBook5Converter').$new(backend, opts);} + else if ("docbook45"['$===']($case)) { + if ($truthy((($i = $$$('::', 'Asciidoctor', 'skip_raise')) && ($h = $$$($i, 'Converter', 'skip_raise')) && ($g = $$$($h, 'DocBook45Converter', 'skip_raise')) ? 'constant' : nil))) { + } else { + self.$require("asciidoctor/converter/docbook45".$to_s()) + }; + base_converter = $$($nesting, 'DocBook45Converter').$new(backend, opts);} + else if ("manpage"['$===']($case)) { + if ($truthy((($l = $$$('::', 'Asciidoctor', 'skip_raise')) && ($k = $$$($l, 'Converter', 'skip_raise')) && ($j = $$$($k, 'ManPageConverter', 'skip_raise')) ? 'constant' : nil))) { + } else { + self.$require("asciidoctor/converter/manpage".$to_s()) + }; + base_converter = $$($nesting, 'ManPageConverter').$new(backend, opts);} + }; + if ($truthy(opts['$key?']("template_dirs"))) { + } else { + return base_converter + }; + if ($truthy((($o = $$$('::', 'Asciidoctor', 'skip_raise')) && ($n = $$$($o, 'Converter', 'skip_raise')) && ($m = $$$($n, 'TemplateConverter', 'skip_raise')) ? 'constant' : nil))) { + } else { + self.$require("asciidoctor/converter/template".$to_s()) + }; + template_converter = $$($nesting, 'TemplateConverter').$new(backend, opts['$[]']("template_dirs"), opts); + if ($truthy((($r = $$$('::', 'Asciidoctor', 'skip_raise')) && ($q = $$$($r, 'Converter', 'skip_raise')) && ($p = $$$($q, 'CompositeConverter', 'skip_raise')) ? 'constant' : nil))) { + } else { + self.$require("asciidoctor/converter/composite".$to_s()) + }; + return $$($nesting, 'CompositeConverter').$new(backend, template_converter, base_converter); + }, TMP_Factory_create_12.$$arity = -2), nil) && 'create'; + })($nesting[0], null, $nesting) + })($nesting[0], $nesting) + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/converter"] = function(Opal) { + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $send = Opal.send, $truthy = Opal.truthy, $hash2 = Opal.hash2; + + Opal.add_stubs(['$register', '$==', '$send', '$include?', '$setup_backend_info', '$raise', '$class', '$sub', '$[]', '$slice', '$length', '$[]=', '$backend_info', '$-', '$extend', '$include', '$respond_to?', '$write', '$chomp', '$require']); + + (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + + (function($base, $parent_nesting) { + function $Converter() {}; + var self = $Converter = $module($base, 'Converter', $Converter); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Converter_initialize_13, TMP_Converter_convert_14; + + + (function($base, $parent_nesting) { + function $Config() {}; + var self = $Config = $module($base, 'Config', $Config); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Config_register_for_1; + + + Opal.def(self, '$register_for', TMP_Config_register_for_1 = function $$register_for($a) { + var $post_args, backends, TMP_2, TMP_3, self = this, metaclass = nil; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + backends = $post_args;; + $$($nesting, 'Factory').$register(self, backends); + metaclass = (function(self, $parent_nesting) { + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return self + })(Opal.get_singleton_class(self), $nesting); + if (backends['$=='](["*"])) { + $send(metaclass, 'send', ["define_method", "converts?"], (TMP_2 = function(name){var self = TMP_2.$$s || this; + + + + if (name == null) { + name = nil; + }; + return true;}, TMP_2.$$s = self, TMP_2.$$arity = 1, TMP_2)) + } else { + $send(metaclass, 'send', ["define_method", "converts?"], (TMP_3 = function(name){var self = TMP_3.$$s || this; + + + + if (name == null) { + name = nil; + }; + return backends['$include?'](name);}, TMP_3.$$s = self, TMP_3.$$arity = 1, TMP_3)) + }; + return nil; + }, TMP_Config_register_for_1.$$arity = -1) + })($nesting[0], $nesting); + (function($base, $parent_nesting) { + function $BackendInfo() {}; + var self = $BackendInfo = $module($base, 'BackendInfo', $BackendInfo); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_BackendInfo_backend_info_4, TMP_BackendInfo_setup_backend_info_5, TMP_BackendInfo_filetype_6, TMP_BackendInfo_basebackend_7, TMP_BackendInfo_outfilesuffix_8, TMP_BackendInfo_htmlsyntax_9, TMP_BackendInfo_supports_templates_10, TMP_BackendInfo_supports_templates$q_11; + + + + Opal.def(self, '$backend_info', TMP_BackendInfo_backend_info_4 = function $$backend_info() { + var $a, self = this; + if (self.backend_info == null) self.backend_info = nil; + + return (self.backend_info = ($truthy($a = self.backend_info) ? $a : self.$setup_backend_info())) + }, TMP_BackendInfo_backend_info_4.$$arity = 0); + + Opal.def(self, '$setup_backend_info', TMP_BackendInfo_setup_backend_info_5 = function $$setup_backend_info() { + var self = this, base = nil, ext = nil, type = nil, syntax = nil; + if (self.backend == null) self.backend = nil; + + + if ($truthy(self.backend)) { + } else { + self.$raise($$$('::', 'ArgumentError'), "" + "Cannot determine backend for converter: " + (self.$class())) + }; + base = self.backend.$sub($$($nesting, 'TrailingDigitsRx'), ""); + if ($truthy((ext = $$($nesting, 'DEFAULT_EXTENSIONS')['$[]'](base)))) { + type = ext.$slice(1, ext.$length()) + } else { + + base = "html"; + ext = ".html"; + type = "html"; + syntax = "html"; + }; + return $hash2(["basebackend", "outfilesuffix", "filetype", "htmlsyntax"], {"basebackend": base, "outfilesuffix": ext, "filetype": type, "htmlsyntax": syntax}); + }, TMP_BackendInfo_setup_backend_info_5.$$arity = 0); + + Opal.def(self, '$filetype', TMP_BackendInfo_filetype_6 = function $$filetype(value) { + var self = this, $writer = nil; + + + + if (value == null) { + value = nil; + }; + if ($truthy(value)) { + + $writer = ["filetype", value]; + $send(self.$backend_info(), '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + } else { + return self.$backend_info()['$[]']("filetype") + }; + }, TMP_BackendInfo_filetype_6.$$arity = -1); + + Opal.def(self, '$basebackend', TMP_BackendInfo_basebackend_7 = function $$basebackend(value) { + var self = this, $writer = nil; + + + + if (value == null) { + value = nil; + }; + if ($truthy(value)) { + + $writer = ["basebackend", value]; + $send(self.$backend_info(), '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + } else { + return self.$backend_info()['$[]']("basebackend") + }; + }, TMP_BackendInfo_basebackend_7.$$arity = -1); + + Opal.def(self, '$outfilesuffix', TMP_BackendInfo_outfilesuffix_8 = function $$outfilesuffix(value) { + var self = this, $writer = nil; + + + + if (value == null) { + value = nil; + }; + if ($truthy(value)) { + + $writer = ["outfilesuffix", value]; + $send(self.$backend_info(), '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + } else { + return self.$backend_info()['$[]']("outfilesuffix") + }; + }, TMP_BackendInfo_outfilesuffix_8.$$arity = -1); + + Opal.def(self, '$htmlsyntax', TMP_BackendInfo_htmlsyntax_9 = function $$htmlsyntax(value) { + var self = this, $writer = nil; + + + + if (value == null) { + value = nil; + }; + if ($truthy(value)) { + + $writer = ["htmlsyntax", value]; + $send(self.$backend_info(), '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + } else { + return self.$backend_info()['$[]']("htmlsyntax") + }; + }, TMP_BackendInfo_htmlsyntax_9.$$arity = -1); + + Opal.def(self, '$supports_templates', TMP_BackendInfo_supports_templates_10 = function $$supports_templates() { + var self = this, $writer = nil; + + + $writer = ["supports_templates", true]; + $send(self.$backend_info(), '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + }, TMP_BackendInfo_supports_templates_10.$$arity = 0); + + Opal.def(self, '$supports_templates?', TMP_BackendInfo_supports_templates$q_11 = function() { + var self = this; + + return self.$backend_info()['$[]']("supports_templates") + }, TMP_BackendInfo_supports_templates$q_11.$$arity = 0); + })($nesting[0], $nesting); + (function(self, $parent_nesting) { + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_included_12; + + return (Opal.def(self, '$included', TMP_included_12 = function $$included(converter) { + var self = this; + + return converter.$extend($$($nesting, 'Config')) + }, TMP_included_12.$$arity = 1), nil) && 'included' + })(Opal.get_singleton_class(self), $nesting); + self.$include($$($nesting, 'Config')); + self.$include($$($nesting, 'BackendInfo')); + + Opal.def(self, '$initialize', TMP_Converter_initialize_13 = function $$initialize(backend, opts) { + var self = this; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + self.backend = backend; + return self.$setup_backend_info(); + }, TMP_Converter_initialize_13.$$arity = -2); + + Opal.def(self, '$convert', TMP_Converter_convert_14 = function $$convert(node, transform, opts) { + var self = this; + + + + if (transform == null) { + transform = nil; + }; + + if (opts == null) { + opts = $hash2([], {}); + }; + return self.$raise($$$('::', 'NotImplementedError')); + }, TMP_Converter_convert_14.$$arity = -2); + Opal.alias(self, "handles?", "respond_to?"); + Opal.alias(self, "convert_with_options", "convert"); + })($nesting[0], $nesting); + (function($base, $parent_nesting) { + function $Writer() {}; + var self = $Writer = $module($base, 'Writer', $Writer); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Writer_write_15; + + + Opal.def(self, '$write', TMP_Writer_write_15 = function $$write(output, target) { + var self = this; + + + if ($truthy(target['$respond_to?']("write"))) { + + target.$write(output.$chomp()); + target.$write($$($nesting, 'LF')); + } else { + $$$('::', 'IO').$write(target, output) + }; + return nil; + }, TMP_Writer_write_15.$$arity = 2) + })($nesting[0], $nesting); + (function($base, $parent_nesting) { + function $VoidWriter() {}; + var self = $VoidWriter = $module($base, 'VoidWriter', $VoidWriter); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_VoidWriter_write_16; + + + self.$include($$($nesting, 'Writer')); + + Opal.def(self, '$write', TMP_VoidWriter_write_16 = function $$write(output, target) { + var self = this; + + return nil + }, TMP_VoidWriter_write_16.$$arity = 2); + })($nesting[0], $nesting); + })($nesting[0], $nesting); + self.$require("asciidoctor/converter/base"); + return self.$require("asciidoctor/converter/factory"); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/document"] = function(Opal) { + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + function $rb_ge(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs >= rhs : lhs['$>='](rhs); + } + function $rb_plus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); + } + function $rb_gt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); + } + function $rb_lt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $send = Opal.send, $truthy = Opal.truthy, $hash2 = Opal.hash2, $gvars = Opal.gvars; + + Opal.add_stubs(['$new', '$attr_reader', '$nil?', '$<<', '$[]', '$[]=', '$-', '$include?', '$strip', '$squeeze', '$gsub', '$empty?', '$!', '$rpartition', '$attr_accessor', '$delete', '$base_dir', '$options', '$inject', '$catalog', '$==', '$dup', '$attributes', '$safe', '$compat_mode', '$sourcemap', '$path_resolver', '$converter', '$extensions', '$each', '$end_with?', '$start_with?', '$slice', '$length', '$chop', '$downcase', '$extname', '$===', '$value_for_name', '$to_s', '$key?', '$freeze', '$attribute_undefined', '$attribute_missing', '$name_for_value', '$expand_path', '$pwd', '$>=', '$+', '$abs', '$to_i', '$delete_if', '$update_doctype_attributes', '$cursor', '$parse', '$restore_attributes', '$update_backend_attributes', '$utc', '$at', '$Integer', '$now', '$index', '$strftime', '$year', '$utc_offset', '$fetch', '$activate', '$create', '$to_proc', '$groups', '$preprocessors?', '$preprocessors', '$process_method', '$tree_processors?', '$tree_processors', '$!=', '$counter', '$nil_or_empty?', '$nextval', '$value', '$save_to', '$chr', '$ord', '$source', '$source_lines', '$doctitle', '$sectname=', '$title=', '$first_section', '$title', '$merge', '$>', '$<', '$find', '$context', '$assign_numeral', '$clear_playback_attributes', '$save_attributes', '$attribute_locked?', '$rewind', '$replace', '$name', '$negate', '$limit_bytesize', '$apply_attribute_value_subs', '$delete?', '$=~', '$apply_subs', '$resolve_pass_subs', '$apply_header_subs', '$create_converter', '$basebackend', '$outfilesuffix', '$filetype', '$sub', '$raise', '$Array', '$backend', '$default', '$start', '$doctype', '$content_model', '$warn', '$logger', '$content', '$convert', '$postprocessors?', '$postprocessors', '$record', '$write', '$respond_to?', '$chomp', '$write_alternate_pages', '$map', '$split', '$resolve_docinfo_subs', '$&', '$normalize_system_path', '$read_asset', '$docinfo_processors?', '$compact', '$join', '$resolve_subs', '$docinfo_processors', '$class', '$object_id', '$inspect', '$size']); + return (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + (function($base, $super, $parent_nesting) { + function $Document(){}; + var self = $Document = $klass($base, $super, 'Document', $Document); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Document_1, TMP_Document_initialize_8, TMP_Document_parse_12, TMP_Document_counter_15, TMP_Document_increment_and_store_counter_16, TMP_Document_nextval_17, TMP_Document_register_18, TMP_Document_footnotes$q_19, TMP_Document_footnotes_20, TMP_Document_callouts_21, TMP_Document_nested$q_22, TMP_Document_embedded$q_23, TMP_Document_extensions$q_24, TMP_Document_source_25, TMP_Document_source_lines_26, TMP_Document_basebackend$q_27, TMP_Document_title_28, TMP_Document_title$eq_29, TMP_Document_doctitle_30, TMP_Document_author_31, TMP_Document_authors_32, TMP_Document_revdate_33, TMP_Document_notitle_34, TMP_Document_noheader_35, TMP_Document_nofooter_36, TMP_Document_first_section_37, TMP_Document_has_header$q_39, TMP_Document_$lt$lt_40, TMP_Document_finalize_header_41, TMP_Document_save_attributes_42, TMP_Document_restore_attributes_44, TMP_Document_clear_playback_attributes_45, TMP_Document_playback_attributes_46, TMP_Document_set_attribute_48, TMP_Document_delete_attribute_49, TMP_Document_attribute_locked$q_50, TMP_Document_set_header_attribute_51, TMP_Document_apply_attribute_value_subs_52, TMP_Document_update_backend_attributes_53, TMP_Document_update_doctype_attributes_54, TMP_Document_create_converter_55, TMP_Document_convert_56, TMP_Document_write_58, TMP_Document_content_59, TMP_Document_docinfo_60, TMP_Document_resolve_docinfo_subs_63, TMP_Document_docinfo_processors$q_64, TMP_Document_to_s_65; + + def.attributes = def.safe = def.sourcemap = def.reader = def.base_dir = def.parsed = def.parent_document = def.extensions = def.options = def.counters = def.catalog = def.header = def.blocks = def.attributes_modified = def.id = def.header_attributes = def.max_attribute_value_size = def.attribute_overrides = def.backend = def.doctype = def.converter = def.timings = def.outfilesuffix = def.docinfo_processor_extensions = def.document = nil; + + Opal.const_set($nesting[0], 'ImageReference', $send($$$('::', 'Struct'), 'new', ["target", "imagesdir"], (TMP_Document_1 = function(){var self = TMP_Document_1.$$s || this; + + return Opal.alias(self, "to_s", "target")}, TMP_Document_1.$$s = self, TMP_Document_1.$$arity = 0, TMP_Document_1))); + Opal.const_set($nesting[0], 'Footnote', $$$('::', 'Struct').$new("index", "id", "text")); + (function($base, $super, $parent_nesting) { + function $AttributeEntry(){}; + var self = $AttributeEntry = $klass($base, $super, 'AttributeEntry', $AttributeEntry); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_AttributeEntry_initialize_2, TMP_AttributeEntry_save_to_3; + + + self.$attr_reader("name", "value", "negate"); + + Opal.def(self, '$initialize', TMP_AttributeEntry_initialize_2 = function $$initialize(name, value, negate) { + var self = this; + + + + if (negate == null) { + negate = nil; + }; + self.name = name; + self.value = value; + return (self.negate = (function() {if ($truthy(negate['$nil?']())) { + return value['$nil?']() + } else { + return negate + }; return nil; })()); + }, TMP_AttributeEntry_initialize_2.$$arity = -3); + return (Opal.def(self, '$save_to', TMP_AttributeEntry_save_to_3 = function $$save_to(block_attributes) { + var $a, self = this, $writer = nil; + + + ($truthy($a = block_attributes['$[]']("attribute_entries")) ? $a : (($writer = ["attribute_entries", []]), $send(block_attributes, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]))['$<<'](self); + return self; + }, TMP_AttributeEntry_save_to_3.$$arity = 1), nil) && 'save_to'; + })($nesting[0], null, $nesting); + (function($base, $super, $parent_nesting) { + function $Title(){}; + var self = $Title = $klass($base, $super, 'Title', $Title); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Title_initialize_4, TMP_Title_sanitized$q_5, TMP_Title_subtitle$q_6, TMP_Title_to_s_7; + + def.sanitized = def.subtitle = def.combined = nil; + + self.$attr_reader("main"); + Opal.alias(self, "title", "main"); + self.$attr_reader("subtitle"); + self.$attr_reader("combined"); + + Opal.def(self, '$initialize', TMP_Title_initialize_4 = function $$initialize(val, opts) { + var $a, $b, self = this, sep = nil, _ = nil; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + if ($truthy(($truthy($a = (self.sanitized = opts['$[]']("sanitize"))) ? val['$include?']("<") : $a))) { + val = val.$gsub($$($nesting, 'XmlSanitizeRx'), "").$squeeze(" ").$strip()}; + if ($truthy(($truthy($a = (sep = ($truthy($b = opts['$[]']("separator")) ? $b : ":"))['$empty?']()) ? $a : val['$include?']((sep = "" + (sep) + " "))['$!']()))) { + + self.main = val; + self.subtitle = nil; + } else { + $b = val.$rpartition(sep), $a = Opal.to_ary($b), (self.main = ($a[0] == null ? nil : $a[0])), (_ = ($a[1] == null ? nil : $a[1])), (self.subtitle = ($a[2] == null ? nil : $a[2])), $b + }; + return (self.combined = val); + }, TMP_Title_initialize_4.$$arity = -2); + + Opal.def(self, '$sanitized?', TMP_Title_sanitized$q_5 = function() { + var self = this; + + return self.sanitized + }, TMP_Title_sanitized$q_5.$$arity = 0); + + Opal.def(self, '$subtitle?', TMP_Title_subtitle$q_6 = function() { + var self = this; + + if ($truthy(self.subtitle)) { + return true + } else { + return false + } + }, TMP_Title_subtitle$q_6.$$arity = 0); + return (Opal.def(self, '$to_s', TMP_Title_to_s_7 = function $$to_s() { + var self = this; + + return self.combined + }, TMP_Title_to_s_7.$$arity = 0), nil) && 'to_s'; + })($nesting[0], null, $nesting); + Opal.const_set($nesting[0], 'Author', $$$('::', 'Struct').$new("name", "firstname", "middlename", "lastname", "initials", "email")); + self.$attr_reader("safe"); + self.$attr_reader("compat_mode"); + self.$attr_reader("backend"); + self.$attr_reader("doctype"); + self.$attr_accessor("sourcemap"); + self.$attr_reader("catalog"); + Opal.alias(self, "references", "catalog"); + self.$attr_reader("counters"); + self.$attr_reader("header"); + self.$attr_reader("base_dir"); + self.$attr_reader("options"); + self.$attr_reader("outfilesuffix"); + self.$attr_reader("parent_document"); + self.$attr_reader("reader"); + self.$attr_reader("path_resolver"); + self.$attr_reader("converter"); + self.$attr_reader("extensions"); + + Opal.def(self, '$initialize', TMP_Document_initialize_8 = function $$initialize(data, options) { + var $a, TMP_9, TMP_10, $b, $c, TMP_11, $d, $iter = TMP_Document_initialize_8.$$p, $yield = $iter || nil, self = this, parent_doc = nil, $writer = nil, attr_overrides = nil, parent_doctype = nil, initialize_extensions = nil, to_file = nil, safe_mode = nil, header_footer = nil, attrs = nil, safe_mode_name = nil, base_dir_val = nil, backend_val = nil, doctype_val = nil, size = nil, now = nil, localdate = nil, localyear = nil, localtime = nil, ext_registry = nil, ext_block = nil; + + if ($iter) TMP_Document_initialize_8.$$p = null; + + + if (data == null) { + data = nil; + }; + + if (options == null) { + options = $hash2([], {}); + }; + $send(self, Opal.find_super_dispatcher(self, 'initialize', TMP_Document_initialize_8, false), [self, "document"], null); + if ($truthy((parent_doc = options.$delete("parent")))) { + + self.parent_document = parent_doc; + ($truthy($a = options['$[]']("base_dir")) ? $a : (($writer = ["base_dir", parent_doc.$base_dir()]), $send(options, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + if ($truthy(parent_doc.$options()['$[]']("catalog_assets"))) { + + $writer = ["catalog_assets", true]; + $send(options, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + self.catalog = $send(parent_doc.$catalog(), 'inject', [$hash2([], {})], (TMP_9 = function(accum, $mlhs_tmp1){var self = TMP_9.$$s || this, $b, $c, key = nil, table = nil; + + + + if (accum == null) { + accum = nil; + }; + + if ($mlhs_tmp1 == null) { + $mlhs_tmp1 = nil; + }; + $c = $mlhs_tmp1, $b = Opal.to_ary($c), (key = ($b[0] == null ? nil : $b[0])), (table = ($b[1] == null ? nil : $b[1])), $c; + + $writer = [key, (function() {if (key['$==']("footnotes")) { + return [] + } else { + return table + }; return nil; })()]; + $send(accum, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + return accum;}, TMP_9.$$s = self, TMP_9.$$arity = 2, TMP_9.$$has_top_level_mlhs_arg = true, TMP_9)); + self.attribute_overrides = (attr_overrides = parent_doc.$attributes().$dup()); + parent_doctype = attr_overrides.$delete("doctype"); + attr_overrides.$delete("compat-mode"); + attr_overrides.$delete("toc"); + attr_overrides.$delete("toc-placement"); + attr_overrides.$delete("toc-position"); + self.safe = parent_doc.$safe(); + if ($truthy((self.compat_mode = parent_doc.$compat_mode()))) { + + $writer = ["compat-mode", ""]; + $send(self.attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + self.sourcemap = parent_doc.$sourcemap(); + self.timings = nil; + self.path_resolver = parent_doc.$path_resolver(); + self.converter = parent_doc.$converter(); + initialize_extensions = false; + self.extensions = parent_doc.$extensions(); + } else { + + self.parent_document = nil; + self.catalog = $hash2(["ids", "refs", "footnotes", "links", "images", "indexterms", "callouts", "includes"], {"ids": $hash2([], {}), "refs": $hash2([], {}), "footnotes": [], "links": [], "images": [], "indexterms": [], "callouts": $$($nesting, 'Callouts').$new(), "includes": $hash2([], {})}); + self.attribute_overrides = (attr_overrides = $hash2([], {})); + $send(($truthy($a = options['$[]']("attributes")) ? $a : $hash2([], {})), 'each', [], (TMP_10 = function(key, val){var self = TMP_10.$$s || this, $b; + + + + if (key == null) { + key = nil; + }; + + if (val == null) { + val = nil; + }; + if ($truthy(key['$end_with?']("@"))) { + if ($truthy(key['$start_with?']("!"))) { + $b = [key.$slice(1, $rb_minus(key.$length(), 2)), false], (key = $b[0]), (val = $b[1]), $b + } else if ($truthy(key['$end_with?']("!@"))) { + $b = [key.$slice(0, $rb_minus(key.$length(), 2)), false], (key = $b[0]), (val = $b[1]), $b + } else { + $b = [key.$chop(), "" + (val) + "@"], (key = $b[0]), (val = $b[1]), $b + } + } else if ($truthy(key['$start_with?']("!"))) { + $b = [key.$slice(1, key.$length()), (function() {if (val['$==']("@")) { + return false + } else { + return nil + }; return nil; })()], (key = $b[0]), (val = $b[1]), $b + } else if ($truthy(key['$end_with?']("!"))) { + $b = [key.$chop(), (function() {if (val['$==']("@")) { + return false + } else { + return nil + }; return nil; })()], (key = $b[0]), (val = $b[1]), $b}; + + $writer = [key.$downcase(), val]; + $send(attr_overrides, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];;}, TMP_10.$$s = self, TMP_10.$$arity = 2, TMP_10)); + if ($truthy((to_file = options['$[]']("to_file")))) { + + $writer = ["outfilesuffix", $$$('::', 'File').$extname(to_file)]; + $send(attr_overrides, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if ($truthy((safe_mode = options['$[]']("safe"))['$!']())) { + self.safe = $$$($$($nesting, 'SafeMode'), 'SECURE') + } else if ($truthy($$$('::', 'Integer')['$==='](safe_mode))) { + self.safe = safe_mode + } else { + + try { + self.safe = $$($nesting, 'SafeMode').$value_for_name(safe_mode.$to_s()) + } catch ($err) { + if (Opal.rescue($err, [$$($nesting, 'StandardError')])) { + try { + self.safe = $$$($$($nesting, 'SafeMode'), 'SECURE') + } finally { Opal.pop_exception() } + } else { throw $err; } + }; + }; + self.compat_mode = attr_overrides['$key?']("compat-mode"); + self.sourcemap = options['$[]']("sourcemap"); + self.timings = options.$delete("timings"); + self.path_resolver = $$($nesting, 'PathResolver').$new(); + self.converter = nil; + initialize_extensions = (($b = $$$('::', 'Asciidoctor', 'skip_raise')) && ($a = $$$($b, 'Extensions', 'skip_raise')) ? 'constant' : nil); + self.extensions = nil; + }; + self.parsed = false; + self.header = (self.header_attributes = nil); + self.counters = $hash2([], {}); + self.attributes_modified = $$$('::', 'Set').$new(); + self.docinfo_processor_extensions = $hash2([], {}); + header_footer = ($truthy($c = options['$[]']("header_footer")) ? $c : (($writer = ["header_footer", false]), $send(options, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + (self.options = options).$freeze(); + attrs = self.attributes; + + $writer = ["sectids", ""]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["toc-placement", "auto"]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + if ($truthy(header_footer)) { + + + $writer = ["copycss", ""]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["embedded", nil]; + $send(attr_overrides, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + } else { + + + $writer = ["notitle", ""]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["embedded", ""]; + $send(attr_overrides, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + }; + + $writer = ["stylesheet", ""]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["webfonts", ""]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["prewrap", ""]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["attribute-undefined", $$($nesting, 'Compliance').$attribute_undefined()]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["attribute-missing", $$($nesting, 'Compliance').$attribute_missing()]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["iconfont-remote", ""]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["caution-caption", "Caution"]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["important-caption", "Important"]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["note-caption", "Note"]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["tip-caption", "Tip"]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["warning-caption", "Warning"]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["example-caption", "Example"]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["figure-caption", "Figure"]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["table-caption", "Table"]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["toc-title", "Table of Contents"]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["section-refsig", "Section"]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["part-refsig", "Part"]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["chapter-refsig", "Chapter"]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["appendix-caption", (($writer = ["appendix-refsig", "Appendix"]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["untitled-label", "Untitled"]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["version-label", "Version"]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["last-update-label", "Last updated"]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["asciidoctor", ""]; + $send(attr_overrides, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["asciidoctor-version", $$($nesting, 'VERSION')]; + $send(attr_overrides, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["safe-mode-name", (safe_mode_name = $$($nesting, 'SafeMode').$name_for_value(self.safe))]; + $send(attr_overrides, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["" + "safe-mode-" + (safe_mode_name), ""]; + $send(attr_overrides, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["safe-mode-level", self.safe]; + $send(attr_overrides, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + ($truthy($c = attr_overrides['$[]']("max-include-depth")) ? $c : (($writer = ["max-include-depth", 64]), $send(attr_overrides, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + ($truthy($c = attr_overrides['$[]']("allow-uri-read")) ? $c : (($writer = ["allow-uri-read", nil]), $send(attr_overrides, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + + $writer = ["user-home", $$($nesting, 'USER_HOME')]; + $send(attr_overrides, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + if ($truthy(attr_overrides['$key?']("numbered"))) { + + $writer = ["sectnums", attr_overrides.$delete("numbered")]; + $send(attr_overrides, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if ($truthy((base_dir_val = options['$[]']("base_dir")))) { + self.base_dir = (($writer = ["docdir", $$$('::', 'File').$expand_path(base_dir_val)]), $send(attr_overrides, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]) + } else if ($truthy(attr_overrides['$[]']("docdir"))) { + self.base_dir = attr_overrides['$[]']("docdir") + } else { + self.base_dir = (($writer = ["docdir", $$$('::', 'Dir').$pwd()]), $send(attr_overrides, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]) + }; + if ($truthy((backend_val = options['$[]']("backend")))) { + + $writer = ["backend", "" + (backend_val)]; + $send(attr_overrides, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if ($truthy((doctype_val = options['$[]']("doctype")))) { + + $writer = ["doctype", "" + (doctype_val)]; + $send(attr_overrides, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if ($truthy($rb_ge(self.safe, $$$($$($nesting, 'SafeMode'), 'SERVER')))) { + + ($truthy($c = attr_overrides['$[]']("copycss")) ? $c : (($writer = ["copycss", nil]), $send(attr_overrides, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + ($truthy($c = attr_overrides['$[]']("source-highlighter")) ? $c : (($writer = ["source-highlighter", nil]), $send(attr_overrides, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + ($truthy($c = attr_overrides['$[]']("backend")) ? $c : (($writer = ["backend", $$($nesting, 'DEFAULT_BACKEND')]), $send(attr_overrides, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + if ($truthy(($truthy($c = parent_doc['$!']()) ? attr_overrides['$key?']("docfile") : $c))) { + + $writer = ["docfile", attr_overrides['$[]']("docfile")['$[]'](Opal.Range.$new($rb_plus(attr_overrides['$[]']("docdir").$length(), 1), -1, false))]; + $send(attr_overrides, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + + $writer = ["docdir", ""]; + $send(attr_overrides, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["user-home", "."]; + $send(attr_overrides, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + if ($truthy($rb_ge(self.safe, $$$($$($nesting, 'SafeMode'), 'SECURE')))) { + + if ($truthy(attr_overrides['$key?']("max-attribute-value-size"))) { + } else { + + $writer = ["max-attribute-value-size", 4096]; + $send(attr_overrides, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + if ($truthy(attr_overrides['$key?']("linkcss"))) { + } else { + + $writer = ["linkcss", ""]; + $send(attr_overrides, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + ($truthy($c = attr_overrides['$[]']("icons")) ? $c : (($writer = ["icons", nil]), $send(attr_overrides, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]));};}; + self.max_attribute_value_size = (function() {if ($truthy((size = ($truthy($c = attr_overrides['$[]']("max-attribute-value-size")) ? $c : (($writer = ["max-attribute-value-size", nil]), $send(attr_overrides, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]))))) { + return size.$to_i().$abs() + } else { + return nil + }; return nil; })(); + $send(attr_overrides, 'delete_if', [], (TMP_11 = function(key, val){var self = TMP_11.$$s || this, $d, verdict = nil; + + + + if (key == null) { + key = nil; + }; + + if (val == null) { + val = nil; + }; + if ($truthy(val)) { + + if ($truthy(($truthy($d = $$$('::', 'String')['$==='](val)) ? val['$end_with?']("@") : $d))) { + $d = [val.$chop(), true], (val = $d[0]), (verdict = $d[1]), $d}; + + $writer = [key, val]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + } else { + + attrs.$delete(key); + verdict = val['$=='](false); + }; + return verdict;}, TMP_11.$$s = self, TMP_11.$$arity = 2, TMP_11)); + if ($truthy(parent_doc)) { + + self.backend = attrs['$[]']("backend"); + if ((self.doctype = (($writer = ["doctype", parent_doctype]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]))['$==']($$($nesting, 'DEFAULT_DOCTYPE'))) { + } else { + self.$update_doctype_attributes($$($nesting, 'DEFAULT_DOCTYPE')) + }; + self.reader = $$($nesting, 'Reader').$new(data, options['$[]']("cursor")); + if ($truthy(self.sourcemap)) { + self.source_location = self.reader.$cursor()}; + $$($nesting, 'Parser').$parse(self.reader, self); + self.$restore_attributes(); + return (self.parsed = true); + } else { + + self.backend = nil; + if (($truthy($c = attrs['$[]']("backend")) ? $c : (($writer = ["backend", $$($nesting, 'DEFAULT_BACKEND')]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]))['$==']("manpage")) { + self.doctype = (($writer = ["doctype", (($writer = ["doctype", "manpage"]), $send(attr_overrides, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]) + } else { + self.doctype = ($truthy($c = attrs['$[]']("doctype")) ? $c : (($writer = ["doctype", $$($nesting, 'DEFAULT_DOCTYPE')]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])) + }; + self.$update_backend_attributes(attrs['$[]']("backend"), true); + now = (function() {if ($truthy($$$('::', 'ENV')['$[]']("SOURCE_DATE_EPOCH"))) { + return $$$('::', 'Time').$at(self.$Integer($$$('::', 'ENV')['$[]']("SOURCE_DATE_EPOCH"))).$utc() + } else { + return $$$('::', 'Time').$now() + }; return nil; })(); + if ($truthy((localdate = attrs['$[]']("localdate")))) { + localyear = ($truthy($c = attrs['$[]']("localyear")) ? $c : (($writer = ["localyear", (function() {if (localdate.$index("-")['$=='](4)) { + + return localdate.$slice(0, 4); + } else { + return nil + }; return nil; })()]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])) + } else { + + localdate = (($writer = ["localdate", now.$strftime("%F")]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]); + localyear = ($truthy($c = attrs['$[]']("localyear")) ? $c : (($writer = ["localyear", now.$year().$to_s()]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + }; + localtime = ($truthy($c = attrs['$[]']("localtime")) ? $c : (($writer = ["localtime", now.$strftime("" + "%T " + ((function() {if (now.$utc_offset()['$=='](0)) { + return "UTC" + } else { + return "%z" + }; return nil; })()))]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + ($truthy($c = attrs['$[]']("localdatetime")) ? $c : (($writer = ["localdatetime", "" + (localdate) + " " + (localtime)]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + ($truthy($c = attrs['$[]']("docdate")) ? $c : (($writer = ["docdate", localdate]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + ($truthy($c = attrs['$[]']("docyear")) ? $c : (($writer = ["docyear", localyear]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + ($truthy($c = attrs['$[]']("doctime")) ? $c : (($writer = ["doctime", localtime]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + ($truthy($c = attrs['$[]']("docdatetime")) ? $c : (($writer = ["docdatetime", "" + (localdate) + " " + (localtime)]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + ($truthy($c = attrs['$[]']("stylesdir")) ? $c : (($writer = ["stylesdir", "."]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + ($truthy($c = attrs['$[]']("iconsdir")) ? $c : (($writer = ["iconsdir", "" + (attrs.$fetch("imagesdir", "./images")) + "/icons"]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + if ($truthy(initialize_extensions)) { + if ($truthy((ext_registry = options['$[]']("extension_registry")))) { + if ($truthy(($truthy($c = $$$($$($nesting, 'Extensions'), 'Registry')['$==='](ext_registry)) ? $c : ($truthy($d = $$$('::', 'RUBY_ENGINE_JRUBY')) ? $$$($$$($$$('::', 'AsciidoctorJ'), 'Extensions'), 'ExtensionRegistry')['$==='](ext_registry) : $d)))) { + self.extensions = ext_registry.$activate(self)} + } else if ($truthy($$$('::', 'Proc')['$===']((ext_block = options['$[]']("extensions"))))) { + self.extensions = $send($$($nesting, 'Extensions'), 'create', [], ext_block.$to_proc()).$activate(self) + } else if ($truthy($$($nesting, 'Extensions').$groups()['$empty?']()['$!']())) { + self.extensions = $$$($$($nesting, 'Extensions'), 'Registry').$new().$activate(self)}}; + self.reader = $$($nesting, 'PreprocessorReader').$new(self, data, $$$($$($nesting, 'Reader'), 'Cursor').$new(attrs['$[]']("docfile"), self.base_dir), $hash2(["normalize"], {"normalize": true})); + if ($truthy(self.sourcemap)) { + return (self.source_location = self.reader.$cursor()) + } else { + return nil + }; + }; + }, TMP_Document_initialize_8.$$arity = -1); + + Opal.def(self, '$parse', TMP_Document_parse_12 = function $$parse(data) { + var $a, TMP_13, TMP_14, self = this, doc = nil, exts = nil; + + + + if (data == null) { + data = nil; + }; + if ($truthy(self.parsed)) { + return self + } else { + + doc = self; + if ($truthy(data)) { + + self.reader = $$($nesting, 'PreprocessorReader').$new(doc, data, $$$($$($nesting, 'Reader'), 'Cursor').$new(self.attributes['$[]']("docfile"), self.base_dir), $hash2(["normalize"], {"normalize": true})); + if ($truthy(self.sourcemap)) { + self.source_location = self.reader.$cursor()};}; + if ($truthy(($truthy($a = (exts = (function() {if ($truthy(self.parent_document)) { + return nil + } else { + return self.extensions + }; return nil; })())) ? exts['$preprocessors?']() : $a))) { + $send(exts.$preprocessors(), 'each', [], (TMP_13 = function(ext){var self = TMP_13.$$s || this, $b; + if (self.reader == null) self.reader = nil; + + + + if (ext == null) { + ext = nil; + }; + return (self.reader = ($truthy($b = ext.$process_method()['$[]'](doc, self.reader)) ? $b : self.reader));}, TMP_13.$$s = self, TMP_13.$$arity = 1, TMP_13))}; + $$($nesting, 'Parser').$parse(self.reader, doc, $hash2(["header_only"], {"header_only": self.options['$[]']("parse_header_only")})); + self.$restore_attributes(); + if ($truthy(($truthy($a = exts) ? exts['$tree_processors?']() : $a))) { + $send(exts.$tree_processors(), 'each', [], (TMP_14 = function(ext){var self = TMP_14.$$s || this, $b, $c, result = nil; + + + + if (ext == null) { + ext = nil; + }; + if ($truthy(($truthy($b = ($truthy($c = (result = ext.$process_method()['$[]'](doc))) ? $$($nesting, 'Document')['$==='](result) : $c)) ? result['$!='](doc) : $b))) { + return (doc = result) + } else { + return nil + };}, TMP_14.$$s = self, TMP_14.$$arity = 1, TMP_14))}; + self.parsed = true; + return doc; + }; + }, TMP_Document_parse_12.$$arity = -1); + + Opal.def(self, '$counter', TMP_Document_counter_15 = function $$counter(name, seed) { + var $a, self = this, attr_seed = nil, attr_val = nil, $writer = nil; + + + + if (seed == null) { + seed = nil; + }; + if ($truthy(self.parent_document)) { + return self.parent_document.$counter(name, seed)}; + if ($truthy(($truthy($a = (attr_seed = (attr_val = self.attributes['$[]'](name))['$nil_or_empty?']()['$!']())) ? self.counters['$key?'](name) : $a))) { + + $writer = [name, (($writer = [name, self.$nextval(attr_val)]), $send(self.counters, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])]; + $send(self.attributes, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + } else if ($truthy(seed)) { + + $writer = [name, (($writer = [name, (function() {if (seed['$=='](seed.$to_i().$to_s())) { + return seed.$to_i() + } else { + return seed + }; return nil; })()]), $send(self.counters, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])]; + $send(self.attributes, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + } else { + + $writer = [name, (($writer = [name, self.$nextval((function() {if ($truthy(attr_seed)) { + return attr_val + } else { + return 0 + }; return nil; })())]), $send(self.counters, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])]; + $send(self.attributes, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + }; + }, TMP_Document_counter_15.$$arity = -2); + + Opal.def(self, '$increment_and_store_counter', TMP_Document_increment_and_store_counter_16 = function $$increment_and_store_counter(counter_name, block) { + var self = this; + + return $$($nesting, 'AttributeEntry').$new(counter_name, self.$counter(counter_name)).$save_to(block.$attributes()).$value() + }, TMP_Document_increment_and_store_counter_16.$$arity = 2); + Opal.alias(self, "counter_increment", "increment_and_store_counter"); + + Opal.def(self, '$nextval', TMP_Document_nextval_17 = function $$nextval(current) { + var self = this, intval = nil; + + if ($truthy($$$('::', 'Integer')['$==='](current))) { + return $rb_plus(current, 1) + } else { + + intval = current.$to_i(); + if ($truthy(intval.$to_s()['$!='](current.$to_s()))) { + return $rb_plus(current['$[]'](0).$ord(), 1).$chr() + } else { + return $rb_plus(intval, 1) + }; + } + }, TMP_Document_nextval_17.$$arity = 1); + + Opal.def(self, '$register', TMP_Document_register_18 = function $$register(type, value) { + var $a, $b, self = this, $case = nil, id = nil, reftext = nil, $logical_op_recvr_tmp_1 = nil, $writer = nil, ref = nil, refs = nil; + + return (function() {$case = type; + if ("ids"['$===']($case)) { + $b = value, $a = Opal.to_ary($b), (id = ($a[0] == null ? nil : $a[0])), (reftext = ($a[1] == null ? nil : $a[1])), $b; + + $logical_op_recvr_tmp_1 = self.catalog['$[]']("ids"); + return ($truthy($a = $logical_op_recvr_tmp_1['$[]'](id)) ? $a : (($writer = [id, ($truthy($b = reftext) ? $b : $rb_plus($rb_plus("[", id), "]"))]), $send($logical_op_recvr_tmp_1, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]));;} + else if ("refs"['$===']($case)) { + $b = value, $a = Opal.to_ary($b), (id = ($a[0] == null ? nil : $a[0])), (ref = ($a[1] == null ? nil : $a[1])), (reftext = ($a[2] == null ? nil : $a[2])), $b; + if ($truthy((refs = self.catalog['$[]']("refs"))['$key?'](id))) { + return nil + } else { + + + $writer = [id, ($truthy($a = reftext) ? $a : $rb_plus($rb_plus("[", id), "]"))]; + $send(self.catalog['$[]']("ids"), '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = [id, ref]; + $send(refs, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];; + };} + else if ("footnotes"['$===']($case) || "indexterms"['$===']($case)) {return self.catalog['$[]'](type)['$<<'](value)} + else {if ($truthy(self.options['$[]']("catalog_assets"))) { + return self.catalog['$[]'](type)['$<<']((function() {if (type['$==']("images")) { + + return $$($nesting, 'ImageReference').$new(value['$[]'](0), value['$[]'](1)); + } else { + return value + }; return nil; })()) + } else { + return nil + }}})() + }, TMP_Document_register_18.$$arity = 2); + + Opal.def(self, '$footnotes?', TMP_Document_footnotes$q_19 = function() { + var self = this; + + if ($truthy(self.catalog['$[]']("footnotes")['$empty?']())) { + return false + } else { + return true + } + }, TMP_Document_footnotes$q_19.$$arity = 0); + + Opal.def(self, '$footnotes', TMP_Document_footnotes_20 = function $$footnotes() { + var self = this; + + return self.catalog['$[]']("footnotes") + }, TMP_Document_footnotes_20.$$arity = 0); + + Opal.def(self, '$callouts', TMP_Document_callouts_21 = function $$callouts() { + var self = this; + + return self.catalog['$[]']("callouts") + }, TMP_Document_callouts_21.$$arity = 0); + + Opal.def(self, '$nested?', TMP_Document_nested$q_22 = function() { + var self = this; + + if ($truthy(self.parent_document)) { + return true + } else { + return false + } + }, TMP_Document_nested$q_22.$$arity = 0); + + Opal.def(self, '$embedded?', TMP_Document_embedded$q_23 = function() { + var self = this; + + return self.attributes['$key?']("embedded") + }, TMP_Document_embedded$q_23.$$arity = 0); + + Opal.def(self, '$extensions?', TMP_Document_extensions$q_24 = function() { + var self = this; + + if ($truthy(self.extensions)) { + return true + } else { + return false + } + }, TMP_Document_extensions$q_24.$$arity = 0); + + Opal.def(self, '$source', TMP_Document_source_25 = function $$source() { + var self = this; + + if ($truthy(self.reader)) { + return self.reader.$source() + } else { + return nil + } + }, TMP_Document_source_25.$$arity = 0); + + Opal.def(self, '$source_lines', TMP_Document_source_lines_26 = function $$source_lines() { + var self = this; + + if ($truthy(self.reader)) { + return self.reader.$source_lines() + } else { + return nil + } + }, TMP_Document_source_lines_26.$$arity = 0); + + Opal.def(self, '$basebackend?', TMP_Document_basebackend$q_27 = function(base) { + var self = this; + + return self.attributes['$[]']("basebackend")['$=='](base) + }, TMP_Document_basebackend$q_27.$$arity = 1); + + Opal.def(self, '$title', TMP_Document_title_28 = function $$title() { + var self = this; + + return self.$doctitle() + }, TMP_Document_title_28.$$arity = 0); + + Opal.def(self, '$title=', TMP_Document_title$eq_29 = function(title) { + var self = this, sect = nil, $writer = nil; + + + if ($truthy((sect = self.header))) { + } else { + + $writer = ["header"]; + $send((sect = (self.header = $$($nesting, 'Section').$new(self, 0))), 'sectname=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + + $writer = [title]; + $send(sect, 'title=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];; + }, TMP_Document_title$eq_29.$$arity = 1); + + Opal.def(self, '$doctitle', TMP_Document_doctitle_30 = function $$doctitle(opts) { + var $a, self = this, val = nil, sect = nil, separator = nil; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + if ($truthy((val = self.attributes['$[]']("title")))) { + } else if ($truthy((sect = self.$first_section()))) { + val = sect.$title() + } else if ($truthy(($truthy($a = opts['$[]']("use_fallback")) ? (val = self.attributes['$[]']("untitled-label")) : $a)['$!']())) { + return nil}; + if ($truthy((separator = opts['$[]']("partition")))) { + return $$($nesting, 'Title').$new(val, opts.$merge($hash2(["separator"], {"separator": (function() {if (separator['$=='](true)) { + return self.attributes['$[]']("title-separator") + } else { + return separator + }; return nil; })()}))) + } else if ($truthy(($truthy($a = opts['$[]']("sanitize")) ? val['$include?']("<") : $a))) { + return val.$gsub($$($nesting, 'XmlSanitizeRx'), "").$squeeze(" ").$strip() + } else { + return val + }; + }, TMP_Document_doctitle_30.$$arity = -1); + Opal.alias(self, "name", "doctitle"); + + Opal.def(self, '$author', TMP_Document_author_31 = function $$author() { + var self = this; + + return self.attributes['$[]']("author") + }, TMP_Document_author_31.$$arity = 0); + + Opal.def(self, '$authors', TMP_Document_authors_32 = function $$authors() { + var $a, self = this, attrs = nil, authors = nil, num_authors = nil, idx = nil; + + if ($truthy((attrs = self.attributes)['$key?']("author"))) { + + authors = [$$($nesting, 'Author').$new(attrs['$[]']("author"), attrs['$[]']("firstname"), attrs['$[]']("middlename"), attrs['$[]']("lastname"), attrs['$[]']("authorinitials"), attrs['$[]']("email"))]; + if ($truthy($rb_gt((num_authors = ($truthy($a = attrs['$[]']("authorcount")) ? $a : 0)), 1))) { + + idx = 1; + while ($truthy($rb_lt(idx, num_authors))) { + + idx = $rb_plus(idx, 1); + authors['$<<']($$($nesting, 'Author').$new(attrs['$[]']("" + "author_" + (idx)), attrs['$[]']("" + "firstname_" + (idx)), attrs['$[]']("" + "middlename_" + (idx)), attrs['$[]']("" + "lastname_" + (idx)), attrs['$[]']("" + "authorinitials_" + (idx)), attrs['$[]']("" + "email_" + (idx)))); + };}; + return authors; + } else { + return [] + } + }, TMP_Document_authors_32.$$arity = 0); + + Opal.def(self, '$revdate', TMP_Document_revdate_33 = function $$revdate() { + var self = this; + + return self.attributes['$[]']("revdate") + }, TMP_Document_revdate_33.$$arity = 0); + + Opal.def(self, '$notitle', TMP_Document_notitle_34 = function $$notitle() { + var $a, self = this; + + return ($truthy($a = self.attributes['$key?']("showtitle")['$!']()) ? self.attributes['$key?']("notitle") : $a) + }, TMP_Document_notitle_34.$$arity = 0); + + Opal.def(self, '$noheader', TMP_Document_noheader_35 = function $$noheader() { + var self = this; + + return self.attributes['$key?']("noheader") + }, TMP_Document_noheader_35.$$arity = 0); + + Opal.def(self, '$nofooter', TMP_Document_nofooter_36 = function $$nofooter() { + var self = this; + + return self.attributes['$key?']("nofooter") + }, TMP_Document_nofooter_36.$$arity = 0); + + Opal.def(self, '$first_section', TMP_Document_first_section_37 = function $$first_section() { + var $a, TMP_38, self = this; + + return ($truthy($a = self.header) ? $a : $send(self.blocks, 'find', [], (TMP_38 = function(e){var self = TMP_38.$$s || this; + + + + if (e == null) { + e = nil; + }; + return e.$context()['$==']("section");}, TMP_38.$$s = self, TMP_38.$$arity = 1, TMP_38))) + }, TMP_Document_first_section_37.$$arity = 0); + + Opal.def(self, '$has_header?', TMP_Document_has_header$q_39 = function() { + var self = this; + + if ($truthy(self.header)) { + return true + } else { + return false + } + }, TMP_Document_has_header$q_39.$$arity = 0); + Opal.alias(self, "header?", "has_header?"); + + Opal.def(self, '$<<', TMP_Document_$lt$lt_40 = function(block) { + var $iter = TMP_Document_$lt$lt_40.$$p, $yield = $iter || nil, self = this, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_Document_$lt$lt_40.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + + if (block.$context()['$==']("section")) { + self.$assign_numeral(block)}; + return $send(self, Opal.find_super_dispatcher(self, '<<', TMP_Document_$lt$lt_40, false), $zuper, $iter); + }, TMP_Document_$lt$lt_40.$$arity = 1); + + Opal.def(self, '$finalize_header', TMP_Document_finalize_header_41 = function $$finalize_header(unrooted_attributes, header_valid) { + var self = this, $writer = nil; + + + + if (header_valid == null) { + header_valid = true; + }; + self.$clear_playback_attributes(unrooted_attributes); + self.$save_attributes(); + if ($truthy(header_valid)) { + } else { + + $writer = ["invalid-header", true]; + $send(unrooted_attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + return unrooted_attributes; + }, TMP_Document_finalize_header_41.$$arity = -2); + + Opal.def(self, '$save_attributes', TMP_Document_save_attributes_42 = function $$save_attributes() { + var $a, $b, TMP_43, self = this, attrs = nil, $writer = nil, val = nil, toc_position_val = nil, toc_val = nil, toc_placement = nil, default_toc_position = nil, default_toc_class = nil, position = nil, $case = nil; + + + if ((attrs = self.attributes)['$[]']("basebackend")['$==']("docbook")) { + + if ($truthy(($truthy($a = self['$attribute_locked?']("toc")) ? $a : self.attributes_modified['$include?']("toc")))) { + } else { + + $writer = ["toc", ""]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + if ($truthy(($truthy($a = self['$attribute_locked?']("sectnums")) ? $a : self.attributes_modified['$include?']("sectnums")))) { + } else { + + $writer = ["sectnums", ""]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + };}; + if ($truthy(($truthy($a = attrs['$key?']("doctitle")) ? $a : (val = self.$doctitle())['$!']()))) { + } else { + + $writer = ["doctitle", val]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + if ($truthy(self.id)) { + } else { + self.id = attrs['$[]']("css-signature") + }; + toc_position_val = (function() {if ($truthy((toc_val = (function() {if ($truthy(attrs.$delete("toc2"))) { + return "left" + } else { + return attrs['$[]']("toc") + }; return nil; })()))) { + if ($truthy(($truthy($a = (toc_placement = attrs.$fetch("toc-placement", "macro"))) ? toc_placement['$!=']("auto") : $a))) { + return toc_placement + } else { + return attrs['$[]']("toc-position") + } + } else { + return nil + }; return nil; })(); + if ($truthy(($truthy($a = toc_val) ? ($truthy($b = toc_val['$empty?']()['$!']()) ? $b : toc_position_val['$nil_or_empty?']()['$!']()) : $a))) { + + default_toc_position = "left"; + default_toc_class = "toc2"; + if ($truthy(toc_position_val['$nil_or_empty?']()['$!']())) { + position = toc_position_val + } else if ($truthy(toc_val['$empty?']()['$!']())) { + position = toc_val + } else { + position = default_toc_position + }; + + $writer = ["toc", ""]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["toc-placement", "auto"]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + $case = position; + if ("left"['$===']($case) || "<"['$===']($case) || "<"['$===']($case)) { + $writer = ["toc-position", "left"]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];} + else if ("right"['$===']($case) || ">"['$===']($case) || ">"['$===']($case)) { + $writer = ["toc-position", "right"]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];} + else if ("top"['$===']($case) || "^"['$===']($case)) { + $writer = ["toc-position", "top"]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];} + else if ("bottom"['$===']($case) || "v"['$===']($case)) { + $writer = ["toc-position", "bottom"]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];} + else if ("preamble"['$===']($case) || "macro"['$===']($case)) { + + $writer = ["toc-position", "content"]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["toc-placement", position]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + default_toc_class = nil;} + else { + attrs.$delete("toc-position"); + default_toc_class = nil;}; + if ($truthy(default_toc_class)) { + ($truthy($a = attrs['$[]']("toc-class")) ? $a : (($writer = ["toc-class", default_toc_class]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]))};}; + if ($truthy((self.compat_mode = attrs['$key?']("compat-mode")))) { + if ($truthy(attrs['$key?']("language"))) { + + $writer = ["source-language", attrs['$[]']("language")]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}}; + self.outfilesuffix = attrs['$[]']("outfilesuffix"); + self.header_attributes = attrs.$dup(); + if ($truthy(self.parent_document)) { + return nil + } else { + return $send($$($nesting, 'FLEXIBLE_ATTRIBUTES'), 'each', [], (TMP_43 = function(name){var self = TMP_43.$$s || this, $c; + if (self.attribute_overrides == null) self.attribute_overrides = nil; + + + + if (name == null) { + name = nil; + }; + if ($truthy(($truthy($c = self.attribute_overrides['$key?'](name)) ? self.attribute_overrides['$[]'](name) : $c))) { + return self.attribute_overrides.$delete(name) + } else { + return nil + };}, TMP_43.$$s = self, TMP_43.$$arity = 1, TMP_43)) + }; + }, TMP_Document_save_attributes_42.$$arity = 0); + + Opal.def(self, '$restore_attributes', TMP_Document_restore_attributes_44 = function $$restore_attributes() { + var self = this; + + + if ($truthy(self.parent_document)) { + } else { + self.catalog['$[]']("callouts").$rewind() + }; + return self.attributes.$replace(self.header_attributes); + }, TMP_Document_restore_attributes_44.$$arity = 0); + + Opal.def(self, '$clear_playback_attributes', TMP_Document_clear_playback_attributes_45 = function $$clear_playback_attributes(attributes) { + var self = this; + + return attributes.$delete("attribute_entries") + }, TMP_Document_clear_playback_attributes_45.$$arity = 1); + + Opal.def(self, '$playback_attributes', TMP_Document_playback_attributes_46 = function $$playback_attributes(block_attributes) { + var TMP_47, self = this; + + if ($truthy(block_attributes['$key?']("attribute_entries"))) { + return $send(block_attributes['$[]']("attribute_entries"), 'each', [], (TMP_47 = function(entry){var self = TMP_47.$$s || this, name = nil, $writer = nil; + if (self.attributes == null) self.attributes = nil; + + + + if (entry == null) { + entry = nil; + }; + name = entry.$name(); + if ($truthy(entry.$negate())) { + + self.attributes.$delete(name); + if (name['$==']("compat-mode")) { + return (self.compat_mode = false) + } else { + return nil + }; + } else { + + + $writer = [name, entry.$value()]; + $send(self.attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + if (name['$==']("compat-mode")) { + return (self.compat_mode = true) + } else { + return nil + }; + };}, TMP_47.$$s = self, TMP_47.$$arity = 1, TMP_47)) + } else { + return nil + } + }, TMP_Document_playback_attributes_46.$$arity = 1); + + Opal.def(self, '$set_attribute', TMP_Document_set_attribute_48 = function $$set_attribute(name, value) { + var self = this, resolved_value = nil, $case = nil, $writer = nil; + + + + if (value == null) { + value = ""; + }; + if ($truthy(self['$attribute_locked?'](name))) { + return false + } else { + + if ($truthy(self.max_attribute_value_size)) { + resolved_value = self.$apply_attribute_value_subs(value).$limit_bytesize(self.max_attribute_value_size) + } else { + resolved_value = self.$apply_attribute_value_subs(value) + }; + $case = name; + if ("backend"['$===']($case)) {self.$update_backend_attributes(resolved_value, self.attributes_modified['$delete?']("htmlsyntax"))} + else if ("doctype"['$===']($case)) {self.$update_doctype_attributes(resolved_value)} + else { + $writer = [name, resolved_value]; + $send(self.attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + self.attributes_modified['$<<'](name); + return resolved_value; + }; + }, TMP_Document_set_attribute_48.$$arity = -2); + + Opal.def(self, '$delete_attribute', TMP_Document_delete_attribute_49 = function $$delete_attribute(name) { + var self = this; + + if ($truthy(self['$attribute_locked?'](name))) { + return false + } else { + + self.attributes.$delete(name); + self.attributes_modified['$<<'](name); + return true; + } + }, TMP_Document_delete_attribute_49.$$arity = 1); + + Opal.def(self, '$attribute_locked?', TMP_Document_attribute_locked$q_50 = function(name) { + var self = this; + + return self.attribute_overrides['$key?'](name) + }, TMP_Document_attribute_locked$q_50.$$arity = 1); + + Opal.def(self, '$set_header_attribute', TMP_Document_set_header_attribute_51 = function $$set_header_attribute(name, value, overwrite) { + var $a, self = this, attrs = nil, $writer = nil; + + + + if (value == null) { + value = ""; + }; + + if (overwrite == null) { + overwrite = true; + }; + attrs = ($truthy($a = self.header_attributes) ? $a : self.attributes); + if ($truthy((($a = overwrite['$=='](false)) ? attrs['$key?'](name) : overwrite['$=='](false)))) { + return false + } else { + + + $writer = [name, value]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + return true; + }; + }, TMP_Document_set_header_attribute_51.$$arity = -2); + + Opal.def(self, '$apply_attribute_value_subs', TMP_Document_apply_attribute_value_subs_52 = function $$apply_attribute_value_subs(value) { + var $a, self = this; + + if ($truthy($$($nesting, 'AttributeEntryPassMacroRx')['$=~'](value))) { + if ($truthy((($a = $gvars['~']) === nil ? nil : $a['$[]'](1)))) { + + return self.$apply_subs((($a = $gvars['~']) === nil ? nil : $a['$[]'](2)), self.$resolve_pass_subs((($a = $gvars['~']) === nil ? nil : $a['$[]'](1)))); + } else { + return (($a = $gvars['~']) === nil ? nil : $a['$[]'](2)) + } + } else { + return self.$apply_header_subs(value) + } + }, TMP_Document_apply_attribute_value_subs_52.$$arity = 1); + + Opal.def(self, '$update_backend_attributes', TMP_Document_update_backend_attributes_53 = function $$update_backend_attributes(new_backend, force) { + var $a, $b, self = this, attrs = nil, current_backend = nil, current_basebackend = nil, current_doctype = nil, $writer = nil, resolved_backend = nil, new_basebackend = nil, new_filetype = nil, new_outfilesuffix = nil, current_filetype = nil, page_width = nil; + + + + if (force == null) { + force = nil; + }; + if ($truthy(($truthy($a = force) ? $a : ($truthy($b = new_backend) ? new_backend['$!='](self.backend) : $b)))) { + + $a = [self.backend, (attrs = self.attributes)['$[]']("basebackend"), self.doctype], (current_backend = $a[0]), (current_basebackend = $a[1]), (current_doctype = $a[2]), $a; + if ($truthy(new_backend['$start_with?']("xhtml"))) { + + + $writer = ["htmlsyntax", "xml"]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + new_backend = new_backend.$slice(1, new_backend.$length()); + } else if ($truthy(new_backend['$start_with?']("html"))) { + if (attrs['$[]']("htmlsyntax")['$==']("xml")) { + } else { + + $writer = ["htmlsyntax", "html"]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }}; + if ($truthy((resolved_backend = $$($nesting, 'BACKEND_ALIASES')['$[]'](new_backend)))) { + new_backend = resolved_backend}; + if ($truthy(current_doctype)) { + + if ($truthy(current_backend)) { + + attrs.$delete("" + "backend-" + (current_backend)); + attrs.$delete("" + "backend-" + (current_backend) + "-doctype-" + (current_doctype));}; + + $writer = ["" + "backend-" + (new_backend) + "-doctype-" + (current_doctype), ""]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["" + "doctype-" + (current_doctype), ""]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + } else if ($truthy(current_backend)) { + attrs.$delete("" + "backend-" + (current_backend))}; + + $writer = ["" + "backend-" + (new_backend), ""]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + self.backend = (($writer = ["backend", new_backend]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]); + if ($truthy($$$($$($nesting, 'Converter'), 'BackendInfo')['$===']((self.converter = self.$create_converter())))) { + + new_basebackend = self.converter.$basebackend(); + if ($truthy(self['$attribute_locked?']("outfilesuffix"))) { + } else { + + $writer = ["outfilesuffix", self.converter.$outfilesuffix()]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + new_filetype = self.converter.$filetype(); + } else if ($truthy(self.converter)) { + + new_basebackend = new_backend.$sub($$($nesting, 'TrailingDigitsRx'), ""); + if ($truthy((new_outfilesuffix = $$($nesting, 'DEFAULT_EXTENSIONS')['$[]'](new_basebackend)))) { + new_filetype = new_outfilesuffix.$slice(1, new_outfilesuffix.$length()) + } else { + $a = [".html", "html", "html"], (new_outfilesuffix = $a[0]), (new_basebackend = $a[1]), (new_filetype = $a[2]), $a + }; + if ($truthy(self['$attribute_locked?']("outfilesuffix"))) { + } else { + + $writer = ["outfilesuffix", new_outfilesuffix]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + } else { + self.$raise($$$('::', 'NotImplementedError'), "" + "asciidoctor: FAILED: missing converter for backend '" + (new_backend) + "'. Processing aborted.") + }; + if ($truthy((current_filetype = attrs['$[]']("filetype")))) { + attrs.$delete("" + "filetype-" + (current_filetype))}; + + $writer = ["filetype", new_filetype]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["" + "filetype-" + (new_filetype), ""]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + if ($truthy((page_width = $$($nesting, 'DEFAULT_PAGE_WIDTHS')['$[]'](new_basebackend)))) { + + $writer = ["pagewidth", page_width]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + } else { + attrs.$delete("pagewidth") + }; + if ($truthy(new_basebackend['$!='](current_basebackend))) { + + if ($truthy(current_doctype)) { + + if ($truthy(current_basebackend)) { + + attrs.$delete("" + "basebackend-" + (current_basebackend)); + attrs.$delete("" + "basebackend-" + (current_basebackend) + "-doctype-" + (current_doctype));}; + + $writer = ["" + "basebackend-" + (new_basebackend) + "-doctype-" + (current_doctype), ""]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + } else if ($truthy(current_basebackend)) { + attrs.$delete("" + "basebackend-" + (current_basebackend))}; + + $writer = ["" + "basebackend-" + (new_basebackend), ""]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["basebackend", new_basebackend]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];;}; + return new_backend; + } else { + return nil + }; + }, TMP_Document_update_backend_attributes_53.$$arity = -2); + + Opal.def(self, '$update_doctype_attributes', TMP_Document_update_doctype_attributes_54 = function $$update_doctype_attributes(new_doctype) { + var $a, self = this, attrs = nil, current_backend = nil, current_basebackend = nil, current_doctype = nil, $writer = nil; + + if ($truthy(($truthy($a = new_doctype) ? new_doctype['$!='](self.doctype) : $a))) { + + $a = [self.backend, (attrs = self.attributes)['$[]']("basebackend"), self.doctype], (current_backend = $a[0]), (current_basebackend = $a[1]), (current_doctype = $a[2]), $a; + if ($truthy(current_doctype)) { + + attrs.$delete("" + "doctype-" + (current_doctype)); + if ($truthy(current_backend)) { + + attrs.$delete("" + "backend-" + (current_backend) + "-doctype-" + (current_doctype)); + + $writer = ["" + "backend-" + (current_backend) + "-doctype-" + (new_doctype), ""]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];;}; + if ($truthy(current_basebackend)) { + + attrs.$delete("" + "basebackend-" + (current_basebackend) + "-doctype-" + (current_doctype)); + + $writer = ["" + "basebackend-" + (current_basebackend) + "-doctype-" + (new_doctype), ""]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];;}; + } else { + + if ($truthy(current_backend)) { + + $writer = ["" + "backend-" + (current_backend) + "-doctype-" + (new_doctype), ""]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if ($truthy(current_basebackend)) { + + $writer = ["" + "basebackend-" + (current_basebackend) + "-doctype-" + (new_doctype), ""]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + }; + + $writer = ["" + "doctype-" + (new_doctype), ""]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + return (self.doctype = (($writer = ["doctype", new_doctype]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + } else { + return nil + } + }, TMP_Document_update_doctype_attributes_54.$$arity = 1); + + Opal.def(self, '$create_converter', TMP_Document_create_converter_55 = function $$create_converter() { + var self = this, converter_opts = nil, $writer = nil, template_dir = nil, template_dirs = nil, converter = nil, converter_factory = nil; + + + converter_opts = $hash2([], {}); + + $writer = ["htmlsyntax", self.attributes['$[]']("htmlsyntax")]; + $send(converter_opts, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + if ($truthy((template_dir = self.options['$[]']("template_dir")))) { + template_dirs = [template_dir] + } else if ($truthy((template_dirs = self.options['$[]']("template_dirs")))) { + template_dirs = self.$Array(template_dirs)}; + if ($truthy(template_dirs)) { + + + $writer = ["template_dirs", template_dirs]; + $send(converter_opts, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["template_cache", self.options.$fetch("template_cache", true)]; + $send(converter_opts, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["template_engine", self.options['$[]']("template_engine")]; + $send(converter_opts, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["template_engine_options", self.options['$[]']("template_engine_options")]; + $send(converter_opts, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["eruby", self.options['$[]']("eruby")]; + $send(converter_opts, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["safe", self.safe]; + $send(converter_opts, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];;}; + if ($truthy((converter = self.options['$[]']("converter")))) { + converter_factory = $$$($$($nesting, 'Converter'), 'Factory').$new($$$('::', 'Hash')['$[]'](self.$backend(), converter)) + } else { + converter_factory = $$$($$($nesting, 'Converter'), 'Factory').$default(false) + }; + return converter_factory.$create(self.$backend(), converter_opts); + }, TMP_Document_create_converter_55.$$arity = 0); + + Opal.def(self, '$convert', TMP_Document_convert_56 = function $$convert(opts) { + var $a, TMP_57, self = this, $writer = nil, block = nil, output = nil, transform = nil, exts = nil; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + if ($truthy(self.timings)) { + self.timings.$start("convert")}; + if ($truthy(self.parsed)) { + } else { + self.$parse() + }; + if ($truthy(($truthy($a = $rb_ge(self.safe, $$$($$($nesting, 'SafeMode'), 'SERVER'))) ? $a : opts['$empty?']()))) { + } else { + + if ($truthy((($writer = ["outfile", opts['$[]']("outfile")]), $send(self.attributes, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]))) { + } else { + self.attributes.$delete("outfile") + }; + if ($truthy((($writer = ["outdir", opts['$[]']("outdir")]), $send(self.attributes, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]))) { + } else { + self.attributes.$delete("outdir") + }; + }; + if (self.$doctype()['$==']("inline")) { + if ($truthy((block = ($truthy($a = self.blocks['$[]'](0)) ? $a : self.header)))) { + if ($truthy(($truthy($a = block.$content_model()['$==']("compound")) ? $a : block.$content_model()['$==']("empty")))) { + self.$logger().$warn("no inline candidate; use the inline doctype to convert a single paragragh, verbatim, or raw block") + } else { + output = block.$content() + }} + } else { + + transform = (function() {if ($truthy((function() {if ($truthy(opts['$key?']("header_footer"))) { + return opts['$[]']("header_footer") + } else { + return self.options['$[]']("header_footer") + }; return nil; })())) { + return "document" + } else { + return "embedded" + }; return nil; })(); + output = self.converter.$convert(self, transform); + }; + if ($truthy(self.parent_document)) { + } else if ($truthy(($truthy($a = (exts = self.extensions)) ? exts['$postprocessors?']() : $a))) { + $send(exts.$postprocessors(), 'each', [], (TMP_57 = function(ext){var self = TMP_57.$$s || this; + + + + if (ext == null) { + ext = nil; + }; + return (output = ext.$process_method()['$[]'](self, output));}, TMP_57.$$s = self, TMP_57.$$arity = 1, TMP_57))}; + if ($truthy(self.timings)) { + self.timings.$record("convert")}; + return output; + }, TMP_Document_convert_56.$$arity = -1); + Opal.alias(self, "render", "convert"); + + Opal.def(self, '$write', TMP_Document_write_58 = function $$write(output, target) { + var $a, $b, self = this; + + + if ($truthy(self.timings)) { + self.timings.$start("write")}; + if ($truthy($$($nesting, 'Writer')['$==='](self.converter))) { + self.converter.$write(output, target) + } else { + + if ($truthy(target['$respond_to?']("write"))) { + if ($truthy(output['$nil_or_empty?']())) { + } else { + + target.$write(output.$chomp()); + target.$write($$($nesting, 'LF')); + } + } else if ($truthy($$($nesting, 'COERCE_ENCODING'))) { + $$$('::', 'IO').$write(target, output, $hash2(["encoding"], {"encoding": $$$($$$('::', 'Encoding'), 'UTF_8')})) + } else { + $$$('::', 'IO').$write(target, output) + }; + if ($truthy(($truthy($a = (($b = self.backend['$==']("manpage")) ? $$$('::', 'String')['$==='](target) : self.backend['$==']("manpage"))) ? self.converter['$respond_to?']("write_alternate_pages") : $a))) { + self.converter.$write_alternate_pages(self.attributes['$[]']("mannames"), self.attributes['$[]']("manvolnum"), target)}; + }; + if ($truthy(self.timings)) { + self.timings.$record("write")}; + return nil; + }, TMP_Document_write_58.$$arity = 2); + + Opal.def(self, '$content', TMP_Document_content_59 = function $$content() { + var $iter = TMP_Document_content_59.$$p, $yield = $iter || nil, self = this, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_Document_content_59.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + + self.attributes.$delete("title"); + return $send(self, Opal.find_super_dispatcher(self, 'content', TMP_Document_content_59, false), $zuper, $iter); + }, TMP_Document_content_59.$$arity = 0); + + Opal.def(self, '$docinfo', TMP_Document_docinfo_60 = function $$docinfo(location, suffix) { + var TMP_61, $a, TMP_62, self = this, content = nil, qualifier = nil, docinfo = nil, docinfo_file = nil, docinfo_dir = nil, docinfo_subs = nil, docinfo_path = nil, shd_content = nil, pvt_content = nil; + + + + if (location == null) { + location = "head"; + }; + + if (suffix == null) { + suffix = nil; + }; + if ($truthy($rb_ge(self.$safe(), $$$($$($nesting, 'SafeMode'), 'SECURE')))) { + return "" + } else { + + content = []; + if (location['$==']("head")) { + } else { + qualifier = "" + "-" + (location) + }; + if ($truthy(suffix)) { + } else { + suffix = self.outfilesuffix + }; + if ($truthy((docinfo = self.attributes['$[]']("docinfo"))['$nil_or_empty?']())) { + if ($truthy(self.attributes['$key?']("docinfo2"))) { + docinfo = ["private", "shared"] + } else if ($truthy(self.attributes['$key?']("docinfo1"))) { + docinfo = ["shared"] + } else { + docinfo = (function() {if ($truthy(docinfo)) { + return ["private"] + } else { + return nil + }; return nil; })() + } + } else { + docinfo = $send(docinfo.$split(","), 'map', [], (TMP_61 = function(it){var self = TMP_61.$$s || this; + + + + if (it == null) { + it = nil; + }; + return it.$strip();}, TMP_61.$$s = self, TMP_61.$$arity = 1, TMP_61)) + }; + if ($truthy(docinfo)) { + + $a = ["" + "docinfo" + (qualifier) + (suffix), self.attributes['$[]']("docinfodir"), self.$resolve_docinfo_subs()], (docinfo_file = $a[0]), (docinfo_dir = $a[1]), (docinfo_subs = $a[2]), $a; + if ($truthy(docinfo['$&'](["shared", "" + "shared-" + (location)])['$empty?']())) { + } else { + + docinfo_path = self.$normalize_system_path(docinfo_file, docinfo_dir); + if ($truthy((shd_content = self.$read_asset(docinfo_path, $hash2(["normalize"], {"normalize": true}))))) { + content['$<<'](self.$apply_subs(shd_content, docinfo_subs))}; + }; + if ($truthy(($truthy($a = self.attributes['$[]']("docname")['$nil_or_empty?']()) ? $a : docinfo['$&'](["private", "" + "private-" + (location)])['$empty?']()))) { + } else { + + docinfo_path = self.$normalize_system_path("" + (self.attributes['$[]']("docname")) + "-" + (docinfo_file), docinfo_dir); + if ($truthy((pvt_content = self.$read_asset(docinfo_path, $hash2(["normalize"], {"normalize": true}))))) { + content['$<<'](self.$apply_subs(pvt_content, docinfo_subs))}; + };}; + if ($truthy(($truthy($a = self.extensions) ? self['$docinfo_processors?'](location) : $a))) { + content = $rb_plus(content, $send(self.docinfo_processor_extensions['$[]'](location), 'map', [], (TMP_62 = function(ext){var self = TMP_62.$$s || this; + + + + if (ext == null) { + ext = nil; + }; + return ext.$process_method()['$[]'](self);}, TMP_62.$$s = self, TMP_62.$$arity = 1, TMP_62)).$compact())}; + return content.$join($$($nesting, 'LF')); + }; + }, TMP_Document_docinfo_60.$$arity = -1); + + Opal.def(self, '$resolve_docinfo_subs', TMP_Document_resolve_docinfo_subs_63 = function $$resolve_docinfo_subs() { + var self = this; + + if ($truthy(self.attributes['$key?']("docinfosubs"))) { + + return self.$resolve_subs(self.attributes['$[]']("docinfosubs"), "block", nil, "docinfo"); + } else { + return ["attributes"] + } + }, TMP_Document_resolve_docinfo_subs_63.$$arity = 0); + + Opal.def(self, '$docinfo_processors?', TMP_Document_docinfo_processors$q_64 = function(location) { + var $a, self = this, $writer = nil; + + + + if (location == null) { + location = "head"; + }; + if ($truthy(self.docinfo_processor_extensions['$key?'](location))) { + return self.docinfo_processor_extensions['$[]'](location)['$!='](false) + } else if ($truthy(($truthy($a = self.extensions) ? self.document.$extensions()['$docinfo_processors?'](location) : $a))) { + return (($writer = [location, self.document.$extensions().$docinfo_processors(location)]), $send(self.docinfo_processor_extensions, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])['$!']()['$!']() + } else { + + $writer = [location, false]; + $send(self.docinfo_processor_extensions, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + }; + }, TMP_Document_docinfo_processors$q_64.$$arity = -1); + return (Opal.def(self, '$to_s', TMP_Document_to_s_65 = function $$to_s() { + var self = this; + + return "" + "#<" + (self.$class()) + "@" + (self.$object_id()) + " {doctype: " + (self.$doctype().$inspect()) + ", doctitle: " + ((function() {if ($truthy(self.header['$!='](nil))) { + return self.header.$title() + } else { + return nil + }; return nil; })().$inspect()) + ", blocks: " + (self.blocks.$size()) + "}>" + }, TMP_Document_to_s_65.$$arity = 0), nil) && 'to_s'; + })($nesting[0], $$($nesting, 'AbstractBlock'), $nesting) + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/inline"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $hash2 = Opal.hash2, $send = Opal.send, $truthy = Opal.truthy; + + Opal.add_stubs(['$attr_reader', '$attr_accessor', '$[]', '$dup', '$convert', '$converter', '$attr', '$==', '$apply_reftext_subs', '$reftext']); + return (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + (function($base, $super, $parent_nesting) { + function $Inline(){}; + var self = $Inline = $klass($base, $super, 'Inline', $Inline); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Inline_initialize_1, TMP_Inline_block$q_2, TMP_Inline_inline$q_3, TMP_Inline_convert_4, TMP_Inline_alt_5, TMP_Inline_reftext$q_6, TMP_Inline_reftext_7, TMP_Inline_xreftext_8; + + def.text = def.type = nil; + + self.$attr_reader("text"); + self.$attr_reader("type"); + self.$attr_accessor("target"); + + Opal.def(self, '$initialize', TMP_Inline_initialize_1 = function $$initialize(parent, context, text, opts) { + var $iter = TMP_Inline_initialize_1.$$p, $yield = $iter || nil, self = this, attrs = nil; + + if ($iter) TMP_Inline_initialize_1.$$p = null; + + + if (text == null) { + text = nil; + }; + + if (opts == null) { + opts = $hash2([], {}); + }; + $send(self, Opal.find_super_dispatcher(self, 'initialize', TMP_Inline_initialize_1, false), [parent, context], null); + self.node_name = "" + "inline_" + (context); + self.text = text; + self.id = opts['$[]']("id"); + self.type = opts['$[]']("type"); + self.target = opts['$[]']("target"); + if ($truthy((attrs = opts['$[]']("attributes")))) { + return (self.attributes = attrs.$dup()) + } else { + return nil + }; + }, TMP_Inline_initialize_1.$$arity = -3); + + Opal.def(self, '$block?', TMP_Inline_block$q_2 = function() { + var self = this; + + return false + }, TMP_Inline_block$q_2.$$arity = 0); + + Opal.def(self, '$inline?', TMP_Inline_inline$q_3 = function() { + var self = this; + + return true + }, TMP_Inline_inline$q_3.$$arity = 0); + + Opal.def(self, '$convert', TMP_Inline_convert_4 = function $$convert() { + var self = this; + + return self.$converter().$convert(self) + }, TMP_Inline_convert_4.$$arity = 0); + Opal.alias(self, "render", "convert"); + + Opal.def(self, '$alt', TMP_Inline_alt_5 = function $$alt() { + var self = this; + + return self.$attr("alt") + }, TMP_Inline_alt_5.$$arity = 0); + + Opal.def(self, '$reftext?', TMP_Inline_reftext$q_6 = function() { + var $a, $b, self = this; + + return ($truthy($a = self.text) ? ($truthy($b = self.type['$==']("ref")) ? $b : self.type['$==']("bibref")) : $a) + }, TMP_Inline_reftext$q_6.$$arity = 0); + + Opal.def(self, '$reftext', TMP_Inline_reftext_7 = function $$reftext() { + var self = this, val = nil; + + if ($truthy((val = self.text))) { + + return self.$apply_reftext_subs(val); + } else { + return nil + } + }, TMP_Inline_reftext_7.$$arity = 0); + return (Opal.def(self, '$xreftext', TMP_Inline_xreftext_8 = function $$xreftext(xrefstyle) { + var self = this; + + + + if (xrefstyle == null) { + xrefstyle = nil; + }; + return self.$reftext(); + }, TMP_Inline_xreftext_8.$$arity = -1), nil) && 'xreftext'; + })($nesting[0], $$($nesting, 'AbstractNode'), $nesting) + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/list"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $hash2 = Opal.hash2, $send = Opal.send, $truthy = Opal.truthy; + + Opal.add_stubs(['$==', '$next_list', '$callouts', '$class', '$object_id', '$inspect', '$size', '$items', '$attr_accessor', '$level', '$drop', '$!', '$nil_or_empty?', '$apply_subs', '$empty?', '$===', '$[]', '$outline?', '$simple?', '$context', '$option?', '$shift', '$blocks', '$unshift', '$lines', '$source', '$parent']); + return (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + + (function($base, $super, $parent_nesting) { + function $List(){}; + var self = $List = $klass($base, $super, 'List', $List); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_List_initialize_1, TMP_List_outline$q_2, TMP_List_convert_3, TMP_List_to_s_4; + + def.context = def.document = def.style = nil; + + Opal.alias(self, "items", "blocks"); + Opal.alias(self, "content", "blocks"); + Opal.alias(self, "items?", "blocks?"); + + Opal.def(self, '$initialize', TMP_List_initialize_1 = function $$initialize(parent, context, opts) { + var $iter = TMP_List_initialize_1.$$p, $yield = $iter || nil, self = this, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_List_initialize_1.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + + + if (opts == null) { + opts = $hash2([], {}); + }; + return $send(self, Opal.find_super_dispatcher(self, 'initialize', TMP_List_initialize_1, false), $zuper, $iter); + }, TMP_List_initialize_1.$$arity = -3); + + Opal.def(self, '$outline?', TMP_List_outline$q_2 = function() { + var $a, self = this; + + return ($truthy($a = self.context['$==']("ulist")) ? $a : self.context['$==']("olist")) + }, TMP_List_outline$q_2.$$arity = 0); + + Opal.def(self, '$convert', TMP_List_convert_3 = function $$convert() { + var $iter = TMP_List_convert_3.$$p, $yield = $iter || nil, self = this, result = nil, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_List_convert_3.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + if (self.context['$==']("colist")) { + + result = $send(self, Opal.find_super_dispatcher(self, 'convert', TMP_List_convert_3, false), $zuper, $iter); + self.document.$callouts().$next_list(); + return result; + } else { + return $send(self, Opal.find_super_dispatcher(self, 'convert', TMP_List_convert_3, false), $zuper, $iter) + } + }, TMP_List_convert_3.$$arity = 0); + Opal.alias(self, "render", "convert"); + return (Opal.def(self, '$to_s', TMP_List_to_s_4 = function $$to_s() { + var self = this; + + return "" + "#<" + (self.$class()) + "@" + (self.$object_id()) + " {context: " + (self.context.$inspect()) + ", style: " + (self.style.$inspect()) + ", items: " + (self.$items().$size()) + "}>" + }, TMP_List_to_s_4.$$arity = 0), nil) && 'to_s'; + })($nesting[0], $$($nesting, 'AbstractBlock'), $nesting); + (function($base, $super, $parent_nesting) { + function $ListItem(){}; + var self = $ListItem = $klass($base, $super, 'ListItem', $ListItem); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_ListItem_initialize_5, TMP_ListItem_text$q_6, TMP_ListItem_text_7, TMP_ListItem_text$eq_8, TMP_ListItem_simple$q_9, TMP_ListItem_compound$q_10, TMP_ListItem_fold_first_11, TMP_ListItem_to_s_12; + + def.text = def.subs = def.blocks = nil; + + Opal.alias(self, "list", "parent"); + self.$attr_accessor("marker"); + + Opal.def(self, '$initialize', TMP_ListItem_initialize_5 = function $$initialize(parent, text) { + var $iter = TMP_ListItem_initialize_5.$$p, $yield = $iter || nil, self = this; + + if ($iter) TMP_ListItem_initialize_5.$$p = null; + + + if (text == null) { + text = nil; + }; + $send(self, Opal.find_super_dispatcher(self, 'initialize', TMP_ListItem_initialize_5, false), [parent, "list_item"], null); + self.text = text; + self.level = parent.$level(); + return (self.subs = $$($nesting, 'NORMAL_SUBS').$drop(0)); + }, TMP_ListItem_initialize_5.$$arity = -2); + + Opal.def(self, '$text?', TMP_ListItem_text$q_6 = function() { + var self = this; + + return self.text['$nil_or_empty?']()['$!']() + }, TMP_ListItem_text$q_6.$$arity = 0); + + Opal.def(self, '$text', TMP_ListItem_text_7 = function $$text() { + var $a, self = this; + + return ($truthy($a = self.text) ? self.$apply_subs(self.text, self.subs) : $a) + }, TMP_ListItem_text_7.$$arity = 0); + + Opal.def(self, '$text=', TMP_ListItem_text$eq_8 = function(val) { + var self = this; + + return (self.text = val) + }, TMP_ListItem_text$eq_8.$$arity = 1); + + Opal.def(self, '$simple?', TMP_ListItem_simple$q_9 = function() { + var $a, $b, $c, self = this, blk = nil; + + return ($truthy($a = self.blocks['$empty?']()) ? $a : ($truthy($b = (($c = self.blocks.$size()['$=='](1)) ? $$($nesting, 'List')['$===']((blk = self.blocks['$[]'](0))) : self.blocks.$size()['$=='](1))) ? blk['$outline?']() : $b)) + }, TMP_ListItem_simple$q_9.$$arity = 0); + + Opal.def(self, '$compound?', TMP_ListItem_compound$q_10 = function() { + var self = this; + + return self['$simple?']()['$!']() + }, TMP_ListItem_compound$q_10.$$arity = 0); + + Opal.def(self, '$fold_first', TMP_ListItem_fold_first_11 = function $$fold_first(continuation_connects_first_block, content_adjacent) { + var $a, $b, $c, $d, $e, self = this, first_block = nil, block = nil; + + + + if (continuation_connects_first_block == null) { + continuation_connects_first_block = false; + }; + + if (content_adjacent == null) { + content_adjacent = false; + }; + if ($truthy(($truthy($a = ($truthy($b = (first_block = self.blocks['$[]'](0))) ? $$($nesting, 'Block')['$==='](first_block) : $b)) ? ($truthy($b = (($c = first_block.$context()['$==']("paragraph")) ? continuation_connects_first_block['$!']() : first_block.$context()['$==']("paragraph"))) ? $b : ($truthy($c = ($truthy($d = ($truthy($e = content_adjacent) ? $e : continuation_connects_first_block['$!']())) ? first_block.$context()['$==']("literal") : $d)) ? first_block['$option?']("listparagraph") : $c)) : $a))) { + + block = self.$blocks().$shift(); + if ($truthy(self.text['$nil_or_empty?']())) { + } else { + block.$lines().$unshift(self.text) + }; + self.text = block.$source();}; + return nil; + }, TMP_ListItem_fold_first_11.$$arity = -1); + return (Opal.def(self, '$to_s', TMP_ListItem_to_s_12 = function $$to_s() { + var $a, self = this; + + return "" + "#<" + (self.$class()) + "@" + (self.$object_id()) + " {list_context: " + (self.$parent().$context().$inspect()) + ", text: " + (self.text.$inspect()) + ", blocks: " + (($truthy($a = self.blocks) ? $a : []).$size()) + "}>" + }, TMP_ListItem_to_s_12.$$arity = 0), nil) && 'to_s'; + })($nesting[0], $$($nesting, 'AbstractBlock'), $nesting); + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/parser"] = function(Opal) { + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + function $rb_plus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); + } + function $rb_gt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); + } + function $rb_lt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); + } + function $rb_times(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs * rhs : lhs['$*'](rhs); + } + function $rb_le(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs <= rhs : lhs['$<='](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $send = Opal.send, $truthy = Opal.truthy, $hash2 = Opal.hash2, $gvars = Opal.gvars; + + Opal.add_stubs(['$include', '$new', '$lambda', '$start_with?', '$match?', '$is_delimited_block?', '$raise', '$parse_document_header', '$[]', '$has_more_lines?', '$next_section', '$assign_numeral', '$<<', '$blocks', '$parse_block_metadata_lines', '$attributes', '$is_next_line_doctitle?', '$finalize_header', '$nil_or_empty?', '$title=', '$-', '$sourcemap', '$cursor', '$parse_section_title', '$id=', '$source_location=', '$header', '$attribute_locked?', '$[]=', '$id', '$parse_header_metadata', '$register', '$==', '$doctype', '$parse_manpage_header', '$=~', '$downcase', '$include?', '$sub_attributes', '$error', '$logger', '$message_with_context', '$cursor_at_line', '$backend', '$skip_blank_lines', '$save', '$update', '$is_next_line_section?', '$initialize_section', '$join', '$map', '$read_lines_until', '$to_proc', '$title', '$split', '$lstrip', '$restore_save', '$discard_save', '$context', '$empty?', '$has_header?', '$delete', '$!', '$!=', '$attr?', '$attr', '$key?', '$document', '$+', '$level', '$special', '$sectname', '$to_i', '$>', '$<', '$warn', '$next_block', '$blocks?', '$style', '$context=', '$style=', '$parent=', '$size', '$content_model', '$shift', '$unwrap_standalone_preamble', '$dup', '$fetch', '$parse_block_metadata_line', '$extensions', '$block_macros?', '$mark', '$read_line', '$terminator', '$to_s', '$masq', '$to_sym', '$registered_for_block?', '$cursor_at_mark', '$strict_verbatim_paragraphs', '$unshift_line', '$markdown_syntax', '$keys', '$chr', '$*', '$length', '$end_with?', '$===', '$parse_attributes', '$attribute_missing', '$clear', '$tr', '$basename', '$assign_caption', '$registered_for_block_macro?', '$config', '$process_method', '$replace', '$parse_callout_list', '$callouts', '$parse_list', '$match', '$parse_description_list', '$underline_style_section_titles', '$is_section_title?', '$peek_line', '$atx_section_title?', '$generate_id', '$level=', '$read_paragraph_lines', '$adjust_indentation!', '$set_option', '$map!', '$slice', '$pop', '$build_block', '$apply_subs', '$chop', '$catalog_inline_anchors', '$rekey', '$index', '$strip', '$parse_table', '$concat', '$each', '$title?', '$lock_in_subs', '$sub?', '$catalog_callouts', '$source', '$remove_sub', '$block_terminates_paragraph', '$<=', '$nil?', '$lines', '$parse_blocks', '$parse_list_item', '$items', '$scan', '$gsub', '$count', '$pre_match', '$advance', '$callout_ids', '$next_list', '$catalog_inline_anchor', '$source_location', '$marker=', '$catalog_inline_biblio_anchor', '$text=', '$resolve_ordered_list_marker', '$read_lines_for_list_item', '$skip_line_comments', '$unshift_lines', '$fold_first', '$text?', '$is_sibling_list_item?', '$find', '$delete_at', '$casecmp', '$sectname=', '$special=', '$numbered=', '$numbered', '$lineno', '$update_attributes', '$peek_lines', '$setext_section_title?', '$abs', '$line_length', '$cursor_at_prev_line', '$process_attribute_entries', '$next_line_empty?', '$process_authors', '$apply_header_subs', '$rstrip', '$each_with_index', '$compact', '$Array', '$squeeze', '$to_a', '$parse_style_attribute', '$process_attribute_entry', '$skip_comment_lines', '$store_attribute', '$sanitize_attribute_name', '$set_attribute', '$save_to', '$delete_attribute', '$ord', '$int_to_roman', '$resolve_list_marker', '$parse_colspecs', '$create_columns', '$format', '$starts_with_delimiter?', '$close_open_cell', '$parse_cellspec', '$delimiter', '$match_delimiter', '$post_match', '$buffer_has_unclosed_quotes?', '$skip_past_delimiter', '$buffer', '$buffer=', '$skip_past_escaped_delimiter', '$keep_cell_open', '$push_cellspec', '$close_cell', '$cell_open?', '$columns', '$assign_column_widths', '$has_header_option=', '$partition_header_footer', '$upto', '$shorthand_property_syntax', '$each_char', '$call', '$sub!', '$gsub!', '$%', '$begin']); + return (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + (function($base, $super, $parent_nesting) { + function $Parser(){}; + var self = $Parser = $klass($base, $super, 'Parser', $Parser); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Parser_1, TMP_Parser_2, TMP_Parser_3, TMP_Parser_initialize_4, TMP_Parser_parse_5, TMP_Parser_parse_document_header_6, TMP_Parser_parse_manpage_header_7, TMP_Parser_next_section_9, TMP_Parser_next_block_10, TMP_Parser_read_paragraph_lines_14, TMP_Parser_is_delimited_block$q_15, TMP_Parser_build_block_16, TMP_Parser_parse_blocks_17, TMP_Parser_parse_list_18, TMP_Parser_catalog_callouts_19, TMP_Parser_catalog_inline_anchor_21, TMP_Parser_catalog_inline_anchors_22, TMP_Parser_catalog_inline_biblio_anchor_24, TMP_Parser_parse_description_list_25, TMP_Parser_parse_callout_list_26, TMP_Parser_parse_list_item_27, TMP_Parser_read_lines_for_list_item_28, TMP_Parser_initialize_section_34, TMP_Parser_is_next_line_section$q_35, TMP_Parser_is_next_line_doctitle$q_36, TMP_Parser_is_section_title$q_37, TMP_Parser_atx_section_title$q_38, TMP_Parser_setext_section_title$q_39, TMP_Parser_parse_section_title_40, TMP_Parser_line_length_41, TMP_Parser_line_length_42, TMP_Parser_parse_header_metadata_43, TMP_Parser_process_authors_48, TMP_Parser_parse_block_metadata_lines_54, TMP_Parser_parse_block_metadata_line_55, TMP_Parser_process_attribute_entries_56, TMP_Parser_process_attribute_entry_57, TMP_Parser_store_attribute_58, TMP_Parser_resolve_list_marker_59, TMP_Parser_resolve_ordered_list_marker_60, TMP_Parser_is_sibling_list_item$q_62, TMP_Parser_parse_table_63, TMP_Parser_parse_colspecs_64, TMP_Parser_parse_cellspec_68, TMP_Parser_parse_style_attribute_69, TMP_Parser_adjust_indentation$B_73, TMP_Parser_sanitize_attribute_name_81; + + + self.$include($$($nesting, 'Logging')); + Opal.const_set($nesting[0], 'BlockMatchData', $$($nesting, 'Struct').$new("context", "masq", "tip", "terminator")); + Opal.const_set($nesting[0], 'TabRx', /\t/); + Opal.const_set($nesting[0], 'TabIndentRx', /^\t+/); + Opal.const_set($nesting[0], 'StartOfBlockProc', $send(self, 'lambda', [], (TMP_Parser_1 = function(l){var self = TMP_Parser_1.$$s || this, $a, $b; + + + + if (l == null) { + l = nil; + }; + return ($truthy($a = ($truthy($b = l['$start_with?']("[")) ? $$($nesting, 'BlockAttributeLineRx')['$match?'](l) : $b)) ? $a : self['$is_delimited_block?'](l));}, TMP_Parser_1.$$s = self, TMP_Parser_1.$$arity = 1, TMP_Parser_1))); + Opal.const_set($nesting[0], 'StartOfListProc', $send(self, 'lambda', [], (TMP_Parser_2 = function(l){var self = TMP_Parser_2.$$s || this; + + + + if (l == null) { + l = nil; + }; + return $$($nesting, 'AnyListRx')['$match?'](l);}, TMP_Parser_2.$$s = self, TMP_Parser_2.$$arity = 1, TMP_Parser_2))); + Opal.const_set($nesting[0], 'StartOfBlockOrListProc', $send(self, 'lambda', [], (TMP_Parser_3 = function(l){var self = TMP_Parser_3.$$s || this, $a, $b, $c; + + + + if (l == null) { + l = nil; + }; + return ($truthy($a = ($truthy($b = self['$is_delimited_block?'](l)) ? $b : ($truthy($c = l['$start_with?']("[")) ? $$($nesting, 'BlockAttributeLineRx')['$match?'](l) : $c))) ? $a : $$($nesting, 'AnyListRx')['$match?'](l));}, TMP_Parser_3.$$s = self, TMP_Parser_3.$$arity = 1, TMP_Parser_3))); + Opal.const_set($nesting[0], 'NoOp', nil); + Opal.const_set($nesting[0], 'TableCellHorzAlignments', $hash2(["<", ">", "^"], {"<": "left", ">": "right", "^": "center"})); + Opal.const_set($nesting[0], 'TableCellVertAlignments', $hash2(["<", ">", "^"], {"<": "top", ">": "bottom", "^": "middle"})); + Opal.const_set($nesting[0], 'TableCellStyles', $hash2(["d", "s", "e", "m", "h", "l", "v", "a"], {"d": "none", "s": "strong", "e": "emphasis", "m": "monospaced", "h": "header", "l": "literal", "v": "verse", "a": "asciidoc"})); + + Opal.def(self, '$initialize', TMP_Parser_initialize_4 = function $$initialize() { + var self = this; + + return self.$raise("Au contraire, mon frere. No parser instances will be running around.") + }, TMP_Parser_initialize_4.$$arity = 0); + Opal.defs(self, '$parse', TMP_Parser_parse_5 = function $$parse(reader, document, options) { + var $a, $b, $c, self = this, block_attributes = nil, new_section = nil; + + + + if (options == null) { + options = $hash2([], {}); + }; + block_attributes = self.$parse_document_header(reader, document); + if ($truthy(options['$[]']("header_only"))) { + } else { + while ($truthy(reader['$has_more_lines?']())) { + + $c = self.$next_section(reader, document, block_attributes), $b = Opal.to_ary($c), (new_section = ($b[0] == null ? nil : $b[0])), (block_attributes = ($b[1] == null ? nil : $b[1])), $c; + if ($truthy(new_section)) { + + document.$assign_numeral(new_section); + document.$blocks()['$<<'](new_section);}; + } + }; + return document; + }, TMP_Parser_parse_5.$$arity = -3); + Opal.defs(self, '$parse_document_header', TMP_Parser_parse_document_header_6 = function $$parse_document_header(reader, document) { + var $a, $b, self = this, block_attrs = nil, doc_attrs = nil, implicit_doctitle = nil, assigned_doctitle = nil, val = nil, $writer = nil, source_location = nil, _ = nil, doctitle = nil, atx = nil, separator = nil, section_title = nil, doc_id = nil, doc_role = nil, doc_reftext = nil; + + + block_attrs = self.$parse_block_metadata_lines(reader, document); + doc_attrs = document.$attributes(); + if ($truthy(($truthy($a = (implicit_doctitle = self['$is_next_line_doctitle?'](reader, block_attrs, doc_attrs['$[]']("leveloffset")))) ? block_attrs['$[]']("title") : $a))) { + return document.$finalize_header(block_attrs, false)}; + assigned_doctitle = nil; + if ($truthy((val = doc_attrs['$[]']("doctitle"))['$nil_or_empty?']())) { + } else { + + $writer = [(assigned_doctitle = val)]; + $send(document, 'title=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + if ($truthy(implicit_doctitle)) { + + if ($truthy(document.$sourcemap())) { + source_location = reader.$cursor()}; + $b = self.$parse_section_title(reader, document), $a = Opal.to_ary($b), document['$id='](($a[0] == null ? nil : $a[0])), (_ = ($a[1] == null ? nil : $a[1])), (doctitle = ($a[2] == null ? nil : $a[2])), (_ = ($a[3] == null ? nil : $a[3])), (atx = ($a[4] == null ? nil : $a[4])), $b; + if ($truthy(assigned_doctitle)) { + } else { + + $writer = [(assigned_doctitle = doctitle)]; + $send(document, 'title=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + if ($truthy(source_location)) { + + $writer = [source_location]; + $send(document.$header(), 'source_location=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if ($truthy(($truthy($a = atx) ? $a : document['$attribute_locked?']("compat-mode")))) { + } else { + + $writer = ["compat-mode", ""]; + $send(doc_attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + if ($truthy((separator = block_attrs['$[]']("separator")))) { + if ($truthy(document['$attribute_locked?']("title-separator"))) { + } else { + + $writer = ["title-separator", separator]; + $send(doc_attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }}; + + $writer = ["doctitle", (section_title = doctitle)]; + $send(doc_attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + if ($truthy((doc_id = block_attrs['$[]']("id")))) { + + $writer = [doc_id]; + $send(document, 'id=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + } else { + doc_id = document.$id() + }; + if ($truthy((doc_role = block_attrs['$[]']("role")))) { + + $writer = ["docrole", doc_role]; + $send(doc_attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if ($truthy((doc_reftext = block_attrs['$[]']("reftext")))) { + + $writer = ["reftext", doc_reftext]; + $send(doc_attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + block_attrs = $hash2([], {}); + self.$parse_header_metadata(reader, document); + if ($truthy(doc_id)) { + document.$register("refs", [doc_id, document])};}; + if ($truthy(($truthy($a = (val = doc_attrs['$[]']("doctitle"))['$nil_or_empty?']()) ? $a : val['$=='](section_title)))) { + } else { + + $writer = [(assigned_doctitle = val)]; + $send(document, 'title=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + if ($truthy(assigned_doctitle)) { + + $writer = ["doctitle", assigned_doctitle]; + $send(doc_attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if (document.$doctype()['$==']("manpage")) { + self.$parse_manpage_header(reader, document, block_attrs)}; + return document.$finalize_header(block_attrs); + }, TMP_Parser_parse_document_header_6.$$arity = 2); + Opal.defs(self, '$parse_manpage_header', TMP_Parser_parse_manpage_header_7 = function $$parse_manpage_header(reader, document, block_attributes) { + var $a, $b, TMP_8, self = this, doc_attrs = nil, $writer = nil, manvolnum = nil, mantitle = nil, manname = nil, name_section_level = nil, name_section = nil, name_section_buffer = nil, mannames = nil, error_msg = nil; + + + if ($truthy($$($nesting, 'ManpageTitleVolnumRx')['$=~']((doc_attrs = document.$attributes())['$[]']("doctitle")))) { + + + $writer = ["manvolnum", (manvolnum = (($a = $gvars['~']) === nil ? nil : $a['$[]'](2)))]; + $send(doc_attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["mantitle", (function() {if ($truthy((mantitle = (($a = $gvars['~']) === nil ? nil : $a['$[]'](1)))['$include?']($$($nesting, 'ATTR_REF_HEAD')))) { + + return document.$sub_attributes(mantitle); + } else { + return mantitle + }; return nil; })().$downcase()]; + $send(doc_attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + } else { + + self.$logger().$error(self.$message_with_context("non-conforming manpage title", $hash2(["source_location"], {"source_location": reader.$cursor_at_line(1)}))); + + $writer = ["mantitle", ($truthy($a = ($truthy($b = doc_attrs['$[]']("doctitle")) ? $b : doc_attrs['$[]']("docname"))) ? $a : "command")]; + $send(doc_attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["manvolnum", (manvolnum = "1")]; + $send(doc_attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + }; + if ($truthy(($truthy($a = (manname = doc_attrs['$[]']("manname"))) ? doc_attrs['$[]']("manpurpose") : $a))) { + + ($truthy($a = doc_attrs['$[]']("manname-title")) ? $a : (($writer = ["manname-title", "Name"]), $send(doc_attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + + $writer = ["mannames", [manname]]; + $send(doc_attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + if (document.$backend()['$==']("manpage")) { + + + $writer = ["docname", manname]; + $send(doc_attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["outfilesuffix", "" + "." + (manvolnum)]; + $send(doc_attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];;}; + } else { + + reader.$skip_blank_lines(); + reader.$save(); + block_attributes.$update(self.$parse_block_metadata_lines(reader, document)); + if ($truthy((name_section_level = self['$is_next_line_section?'](reader, $hash2([], {}))))) { + if (name_section_level['$=='](1)) { + + name_section = self.$initialize_section(reader, document, $hash2([], {})); + name_section_buffer = $send(reader.$read_lines_until($hash2(["break_on_blank_lines", "skip_line_comments"], {"break_on_blank_lines": true, "skip_line_comments": true})), 'map', [], "lstrip".$to_proc()).$join(" "); + if ($truthy($$($nesting, 'ManpageNamePurposeRx')['$=~'](name_section_buffer))) { + + ($truthy($a = doc_attrs['$[]']("manname-title")) ? $a : (($writer = ["manname-title", name_section.$title()]), $send(doc_attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + if ($truthy(name_section.$id())) { + + $writer = ["manname-id", name_section.$id()]; + $send(doc_attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + + $writer = ["manpurpose", (($a = $gvars['~']) === nil ? nil : $a['$[]'](2))]; + $send(doc_attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + if ($truthy((manname = (($a = $gvars['~']) === nil ? nil : $a['$[]'](1)))['$include?']($$($nesting, 'ATTR_REF_HEAD')))) { + manname = document.$sub_attributes(manname)}; + if ($truthy(manname['$include?'](","))) { + manname = (mannames = $send(manname.$split(","), 'map', [], (TMP_8 = function(n){var self = TMP_8.$$s || this; + + + + if (n == null) { + n = nil; + }; + return n.$lstrip();}, TMP_8.$$s = self, TMP_8.$$arity = 1, TMP_8)))['$[]'](0) + } else { + mannames = [manname] + }; + + $writer = ["manname", manname]; + $send(doc_attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["mannames", mannames]; + $send(doc_attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + if (document.$backend()['$==']("manpage")) { + + + $writer = ["docname", manname]; + $send(doc_attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["outfilesuffix", "" + "." + (manvolnum)]; + $send(doc_attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];;}; + } else { + error_msg = "non-conforming name section body" + }; + } else { + error_msg = "name section must be at level 1" + } + } else { + error_msg = "name section expected" + }; + if ($truthy(error_msg)) { + + reader.$restore_save(); + self.$logger().$error(self.$message_with_context(error_msg, $hash2(["source_location"], {"source_location": reader.$cursor()}))); + + $writer = ["manname", (manname = ($truthy($a = doc_attrs['$[]']("docname")) ? $a : "command"))]; + $send(doc_attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["mannames", [manname]]; + $send(doc_attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + if (document.$backend()['$==']("manpage")) { + + + $writer = ["docname", manname]; + $send(doc_attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["outfilesuffix", "" + "." + (manvolnum)]; + $send(doc_attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];;}; + } else { + reader.$discard_save() + }; + }; + return nil; + }, TMP_Parser_parse_manpage_header_7.$$arity = 3); + Opal.defs(self, '$next_section', TMP_Parser_next_section_9 = function $$next_section(reader, parent, attributes) { + var $a, $b, $c, $d, self = this, preamble = nil, intro = nil, part = nil, has_header = nil, book = nil, document = nil, $writer = nil, section = nil, current_level = nil, expected_next_level = nil, expected_next_level_alt = nil, title = nil, sectname = nil, next_level = nil, expected_condition = nil, new_section = nil, block_cursor = nil, new_block = nil, first_block = nil, child_block = nil; + + + + if (attributes == null) { + attributes = $hash2([], {}); + }; + preamble = (intro = (part = false)); + if ($truthy(($truthy($a = (($b = parent.$context()['$==']("document")) ? parent.$blocks()['$empty?']() : parent.$context()['$==']("document"))) ? ($truthy($b = ($truthy($c = (has_header = parent['$has_header?']())) ? $c : attributes.$delete("invalid-header"))) ? $b : self['$is_next_line_section?'](reader, attributes)['$!']()) : $a))) { + + book = (document = parent).$doctype()['$==']("book"); + if ($truthy(($truthy($a = has_header) ? $a : ($truthy($b = book) ? attributes['$[]'](1)['$!=']("abstract") : $b)))) { + + preamble = (intro = $$($nesting, 'Block').$new(parent, "preamble", $hash2(["content_model"], {"content_model": "compound"}))); + if ($truthy(($truthy($a = book) ? parent['$attr?']("preface-title") : $a))) { + + $writer = [parent.$attr("preface-title")]; + $send(preamble, 'title=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + parent.$blocks()['$<<'](preamble);}; + section = parent; + current_level = 0; + if ($truthy(parent.$attributes()['$key?']("fragment"))) { + expected_next_level = -1 + } else if ($truthy(book)) { + $a = [1, 0], (expected_next_level = $a[0]), (expected_next_level_alt = $a[1]), $a + } else { + expected_next_level = 1 + }; + } else { + + book = (document = parent.$document()).$doctype()['$==']("book"); + section = self.$initialize_section(reader, parent, attributes); + attributes = (function() {if ($truthy((title = attributes['$[]']("title")))) { + return $hash2(["title"], {"title": title}) + } else { + return $hash2([], {}) + }; return nil; })(); + expected_next_level = $rb_plus((current_level = section.$level()), 1); + if (current_level['$=='](0)) { + part = book + } else if ($truthy((($a = current_level['$=='](1)) ? section.$special() : current_level['$=='](1)))) { + if ($truthy(($truthy($a = ($truthy($b = (sectname = section.$sectname())['$==']("appendix")) ? $b : sectname['$==']("preface"))) ? $a : sectname['$==']("abstract")))) { + } else { + expected_next_level = nil + }}; + }; + reader.$skip_blank_lines(); + while ($truthy(reader['$has_more_lines?']())) { + + self.$parse_block_metadata_lines(reader, document, attributes); + if ($truthy((next_level = self['$is_next_line_section?'](reader, attributes)))) { + + if ($truthy(document['$attr?']("leveloffset"))) { + next_level = $rb_plus(next_level, document.$attr("leveloffset").$to_i())}; + if ($truthy($rb_gt(next_level, current_level))) { + + if ($truthy(expected_next_level)) { + if ($truthy(($truthy($b = ($truthy($c = next_level['$=='](expected_next_level)) ? $c : ($truthy($d = expected_next_level_alt) ? next_level['$=='](expected_next_level_alt) : $d))) ? $b : $rb_lt(expected_next_level, 0)))) { + } else { + + expected_condition = (function() {if ($truthy(expected_next_level_alt)) { + return "" + "expected levels " + (expected_next_level_alt) + " or " + (expected_next_level) + } else { + return "" + "expected level " + (expected_next_level) + }; return nil; })(); + self.$logger().$warn(self.$message_with_context("" + "section title out of sequence: " + (expected_condition) + ", got level " + (next_level), $hash2(["source_location"], {"source_location": reader.$cursor()}))); + } + } else { + self.$logger().$error(self.$message_with_context("" + (sectname) + " sections do not support nested sections", $hash2(["source_location"], {"source_location": reader.$cursor()}))) + }; + $c = self.$next_section(reader, section, attributes), $b = Opal.to_ary($c), (new_section = ($b[0] == null ? nil : $b[0])), (attributes = ($b[1] == null ? nil : $b[1])), $c; + section.$assign_numeral(new_section); + section.$blocks()['$<<'](new_section); + } else if ($truthy((($b = next_level['$=='](0)) ? section['$=='](document) : next_level['$=='](0)))) { + + if ($truthy(book)) { + } else { + self.$logger().$error(self.$message_with_context("level 0 sections can only be used when doctype is book", $hash2(["source_location"], {"source_location": reader.$cursor()}))) + }; + $c = self.$next_section(reader, section, attributes), $b = Opal.to_ary($c), (new_section = ($b[0] == null ? nil : $b[0])), (attributes = ($b[1] == null ? nil : $b[1])), $c; + section.$assign_numeral(new_section); + section.$blocks()['$<<'](new_section); + } else { + break; + }; + } else { + + block_cursor = reader.$cursor(); + if ($truthy((new_block = self.$next_block(reader, ($truthy($b = intro) ? $b : section), attributes, $hash2(["parse_metadata"], {"parse_metadata": false}))))) { + + if ($truthy(part)) { + if ($truthy(section['$blocks?']()['$!']())) { + if ($truthy(new_block.$style()['$!=']("partintro"))) { + if (new_block.$context()['$==']("paragraph")) { + + + $writer = ["open"]; + $send(new_block, 'context=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["partintro"]; + $send(new_block, 'style=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + } else { + + + $writer = [(intro = $$($nesting, 'Block').$new(section, "open", $hash2(["content_model"], {"content_model": "compound"})))]; + $send(new_block, 'parent=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["partintro"]; + $send(intro, 'style=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + section.$blocks()['$<<'](intro); + }} + } else if (section.$blocks().$size()['$=='](1)) { + + first_block = section.$blocks()['$[]'](0); + if ($truthy(($truthy($b = intro['$!']()) ? first_block.$content_model()['$==']("compound") : $b))) { + self.$logger().$error(self.$message_with_context("illegal block content outside of partintro block", $hash2(["source_location"], {"source_location": block_cursor}))) + } else if ($truthy(first_block.$content_model()['$!=']("compound"))) { + + + $writer = [(intro = $$($nesting, 'Block').$new(section, "open", $hash2(["content_model"], {"content_model": "compound"})))]; + $send(new_block, 'parent=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["partintro"]; + $send(intro, 'style=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + section.$blocks().$shift(); + if (first_block.$style()['$==']("partintro")) { + + + $writer = ["paragraph"]; + $send(first_block, 'context=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = [nil]; + $send(first_block, 'style=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];;}; + intro['$<<'](first_block); + section.$blocks()['$<<'](intro);};}}; + ($truthy($b = intro) ? $b : section).$blocks()['$<<'](new_block); + attributes = $hash2([], {});}; + }; + if ($truthy($b = reader.$skip_blank_lines())) { + $b + } else { + break; + }; + }; + if ($truthy(part)) { + if ($truthy(($truthy($a = section['$blocks?']()) ? section.$blocks()['$[]'](-1).$context()['$==']("section") : $a))) { + } else { + self.$logger().$error(self.$message_with_context("invalid part, must have at least one section (e.g., chapter, appendix, etc.)", $hash2(["source_location"], {"source_location": reader.$cursor()}))) + } + } else if ($truthy(preamble)) { + if ($truthy(preamble['$blocks?']())) { + if ($truthy(($truthy($a = ($truthy($b = book) ? $b : document.$blocks()['$[]'](1))) ? $a : $$($nesting, 'Compliance').$unwrap_standalone_preamble()['$!']()))) { + } else { + + document.$blocks().$shift(); + while ($truthy((child_block = preamble.$blocks().$shift()))) { + document['$<<'](child_block) + }; + } + } else { + document.$blocks().$shift() + }}; + return [(function() {if ($truthy(section['$!='](parent))) { + return section + } else { + return nil + }; return nil; })(), attributes.$dup()]; + }, TMP_Parser_next_section_9.$$arity = -3); + Opal.defs(self, '$next_block', TMP_Parser_next_block_10 = function $$next_block(reader, parent, attributes, options) {try { + + var $a, $b, $c, TMP_11, $d, TMP_12, TMP_13, self = this, skipped = nil, text_only = nil, document = nil, extensions = nil, block_extensions = nil, block_macro_extensions = nil, this_line = nil, doc_attrs = nil, style = nil, block = nil, block_context = nil, cloaked_context = nil, terminator = nil, delimited_block = nil, $writer = nil, indented = nil, md_syntax = nil, ch0 = nil, layout_break_chars = nil, ll = nil, blk_ctx = nil, target = nil, blk_attrs = nil, $case = nil, posattrs = nil, scaledwidth = nil, extension = nil, content = nil, default_attrs = nil, match = nil, float_id = nil, float_reftext = nil, float_title = nil, float_level = nil, lines = nil, in_list = nil, admonition_name = nil, credit_line = nil, attribution = nil, citetitle = nil, language = nil, comma_idx = nil, block_cursor = nil, block_reader = nil, content_model = nil, pos_attrs = nil, block_id = nil; + if ($gvars["~"] == null) $gvars["~"] = nil; + + + + if (attributes == null) { + attributes = $hash2([], {}); + }; + + if (options == null) { + options = $hash2([], {}); + }; + if ($truthy((skipped = reader.$skip_blank_lines()))) { + } else { + return nil + }; + if ($truthy(($truthy($a = (text_only = options['$[]']("text"))) ? $rb_gt(skipped, 0) : $a))) { + + options.$delete("text"); + text_only = false;}; + document = parent.$document(); + if ($truthy(options.$fetch("parse_metadata", true))) { + while ($truthy(self.$parse_block_metadata_line(reader, document, attributes, options))) { + + reader.$shift(); + ($truthy($b = reader.$skip_blank_lines()) ? $b : Opal.ret(nil)); + }}; + if ($truthy((extensions = document.$extensions()))) { + $a = [extensions['$blocks?'](), extensions['$block_macros?']()], (block_extensions = $a[0]), (block_macro_extensions = $a[1]), $a}; + reader.$mark(); + $a = [reader.$read_line(), document.$attributes(), attributes['$[]'](1)], (this_line = $a[0]), (doc_attrs = $a[1]), (style = $a[2]), $a; + block = (block_context = (cloaked_context = (terminator = nil))); + if ($truthy((delimited_block = self['$is_delimited_block?'](this_line, true)))) { + + block_context = (cloaked_context = delimited_block.$context()); + terminator = delimited_block.$terminator(); + if ($truthy(style['$!']())) { + style = (($writer = ["style", block_context.$to_s()]), $send(attributes, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]) + } else if ($truthy(style['$!='](block_context.$to_s()))) { + if ($truthy(delimited_block.$masq()['$include?'](style))) { + block_context = style.$to_sym() + } else if ($truthy(($truthy($a = delimited_block.$masq()['$include?']("admonition")) ? $$($nesting, 'ADMONITION_STYLES')['$include?'](style) : $a))) { + block_context = "admonition" + } else if ($truthy(($truthy($a = block_extensions) ? extensions['$registered_for_block?'](style, block_context) : $a))) { + block_context = style.$to_sym() + } else { + + self.$logger().$warn(self.$message_with_context("" + "invalid style for " + (block_context) + " block: " + (style), $hash2(["source_location"], {"source_location": reader.$cursor_at_mark()}))); + style = block_context.$to_s(); + }};}; + if ($truthy(delimited_block)) { + } else { + while ($truthy(true)) { + + if ($truthy(($truthy($b = ($truthy($c = style) ? $$($nesting, 'Compliance').$strict_verbatim_paragraphs() : $c)) ? $$($nesting, 'VERBATIM_STYLES')['$include?'](style) : $b))) { + + block_context = style.$to_sym(); + reader.$unshift_line(this_line); + break;;}; + if ($truthy(text_only)) { + indented = this_line['$start_with?'](" ", $$($nesting, 'TAB')) + } else { + + md_syntax = $$($nesting, 'Compliance').$markdown_syntax(); + if ($truthy(this_line['$start_with?'](" "))) { + + $b = [true, " "], (indented = $b[0]), (ch0 = $b[1]), $b; + if ($truthy(($truthy($b = ($truthy($c = md_syntax) ? $send(this_line.$lstrip(), 'start_with?', Opal.to_a($$($nesting, 'MARKDOWN_THEMATIC_BREAK_CHARS').$keys())) : $c)) ? $$($nesting, 'MarkdownThematicBreakRx')['$match?'](this_line) : $b))) { + + block = $$($nesting, 'Block').$new(parent, "thematic_break", $hash2(["content_model"], {"content_model": "empty"})); + break;;}; + } else if ($truthy(this_line['$start_with?']($$($nesting, 'TAB')))) { + $b = [true, $$($nesting, 'TAB')], (indented = $b[0]), (ch0 = $b[1]), $b + } else { + + $b = [false, this_line.$chr()], (indented = $b[0]), (ch0 = $b[1]), $b; + layout_break_chars = (function() {if ($truthy(md_syntax)) { + return $$($nesting, 'HYBRID_LAYOUT_BREAK_CHARS') + } else { + return $$($nesting, 'LAYOUT_BREAK_CHARS') + }; return nil; })(); + if ($truthy(($truthy($b = layout_break_chars['$key?'](ch0)) ? (function() {if ($truthy(md_syntax)) { + + return $$($nesting, 'ExtLayoutBreakRx')['$match?'](this_line); + } else { + + return (($c = this_line['$==']($rb_times(ch0, (ll = this_line.$length())))) ? $rb_gt(ll, 2) : this_line['$==']($rb_times(ch0, (ll = this_line.$length())))); + }; return nil; })() : $b))) { + + block = $$($nesting, 'Block').$new(parent, layout_break_chars['$[]'](ch0), $hash2(["content_model"], {"content_model": "empty"})); + break;; + } else if ($truthy(($truthy($b = this_line['$end_with?']("]")) ? this_line['$include?']("::") : $b))) { + if ($truthy(($truthy($b = ($truthy($c = ch0['$==']("i")) ? $c : this_line['$start_with?']("video:", "audio:"))) ? $$($nesting, 'BlockMediaMacroRx')['$=~'](this_line) : $b))) { + + $b = [(($c = $gvars['~']) === nil ? nil : $c['$[]'](1)).$to_sym(), (($c = $gvars['~']) === nil ? nil : $c['$[]'](2)), (($c = $gvars['~']) === nil ? nil : $c['$[]'](3))], (blk_ctx = $b[0]), (target = $b[1]), (blk_attrs = $b[2]), $b; + block = $$($nesting, 'Block').$new(parent, blk_ctx, $hash2(["content_model"], {"content_model": "empty"})); + if ($truthy(blk_attrs)) { + + $case = blk_ctx; + if ("video"['$===']($case)) {posattrs = ["poster", "width", "height"]} + else if ("audio"['$===']($case)) {posattrs = []} + else {posattrs = ["alt", "width", "height"]}; + block.$parse_attributes(blk_attrs, posattrs, $hash2(["sub_input", "into"], {"sub_input": true, "into": attributes}));}; + if ($truthy(attributes['$key?']("style"))) { + attributes.$delete("style")}; + if ($truthy(($truthy($b = target['$include?']($$($nesting, 'ATTR_REF_HEAD'))) ? (target = block.$sub_attributes(target, $hash2(["attribute_missing"], {"attribute_missing": "drop-line"})))['$empty?']() : $b))) { + if (($truthy($b = doc_attrs['$[]']("attribute-missing")) ? $b : $$($nesting, 'Compliance').$attribute_missing())['$==']("skip")) { + return $$($nesting, 'Block').$new(parent, "paragraph", $hash2(["content_model", "source"], {"content_model": "simple", "source": [this_line]})) + } else { + + attributes.$clear(); + return nil; + }}; + if (blk_ctx['$==']("image")) { + + document.$register("images", [target, (($writer = ["imagesdir", doc_attrs['$[]']("imagesdir")]), $send(attributes, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])]); + ($truthy($b = attributes['$[]']("alt")) ? $b : (($writer = ["alt", ($truthy($c = style) ? $c : (($writer = ["default-alt", $$($nesting, 'Helpers').$basename(target, true).$tr("_-", " ")]), $send(attributes, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]))]), $send(attributes, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + if ($truthy((scaledwidth = attributes.$delete("scaledwidth"))['$nil_or_empty?']())) { + } else { + + $writer = ["scaledwidth", (function() {if ($truthy($$($nesting, 'TrailingDigitsRx')['$match?'](scaledwidth))) { + return "" + (scaledwidth) + "%" + } else { + return scaledwidth + }; return nil; })()]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + if ($truthy(attributes['$key?']("title"))) { + + + $writer = [attributes.$delete("title")]; + $send(block, 'title=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + block.$assign_caption(attributes.$delete("caption"), "figure");};}; + + $writer = ["target", target]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + break;; + } else if ($truthy(($truthy($b = (($c = ch0['$==']("t")) ? this_line['$start_with?']("toc:") : ch0['$==']("t"))) ? $$($nesting, 'BlockTocMacroRx')['$=~'](this_line) : $b))) { + + block = $$($nesting, 'Block').$new(parent, "toc", $hash2(["content_model"], {"content_model": "empty"})); + if ($truthy((($b = $gvars['~']) === nil ? nil : $b['$[]'](1)))) { + block.$parse_attributes((($b = $gvars['~']) === nil ? nil : $b['$[]'](1)), [], $hash2(["into"], {"into": attributes}))}; + break;; + } else if ($truthy(($truthy($b = ($truthy($c = block_macro_extensions) ? $$($nesting, 'CustomBlockMacroRx')['$=~'](this_line) : $c)) ? (extension = extensions['$registered_for_block_macro?']((($c = $gvars['~']) === nil ? nil : $c['$[]'](1)))) : $b))) { + + $b = [(($c = $gvars['~']) === nil ? nil : $c['$[]'](2)), (($c = $gvars['~']) === nil ? nil : $c['$[]'](3))], (target = $b[0]), (content = $b[1]), $b; + if ($truthy(($truthy($b = ($truthy($c = target['$include?']($$($nesting, 'ATTR_REF_HEAD'))) ? (target = parent.$sub_attributes(target))['$empty?']() : $c)) ? ($truthy($c = doc_attrs['$[]']("attribute-missing")) ? $c : $$($nesting, 'Compliance').$attribute_missing())['$==']("drop-line") : $b))) { + + attributes.$clear(); + return nil;}; + if (extension.$config()['$[]']("content_model")['$==']("attributes")) { + if ($truthy(content)) { + document.$parse_attributes(content, ($truthy($b = extension.$config()['$[]']("pos_attrs")) ? $b : []), $hash2(["sub_input", "into"], {"sub_input": true, "into": attributes}))} + } else { + + $writer = ["text", ($truthy($b = content) ? $b : "")]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + if ($truthy((default_attrs = extension.$config()['$[]']("default_attrs")))) { + $send(attributes, 'update', [default_attrs], (TMP_11 = function(_, old_v){var self = TMP_11.$$s || this; + + + + if (_ == null) { + _ = nil; + }; + + if (old_v == null) { + old_v = nil; + }; + return old_v;}, TMP_11.$$s = self, TMP_11.$$arity = 2, TMP_11))}; + if ($truthy((block = extension.$process_method()['$[]'](parent, target, attributes)))) { + + attributes.$replace(block.$attributes()); + break;; + } else { + + attributes.$clear(); + return nil; + };}}; + }; + }; + if ($truthy(($truthy($b = ($truthy($c = indented['$!']()) ? (ch0 = ($truthy($d = ch0) ? $d : this_line.$chr()))['$==']("<") : $c)) ? $$($nesting, 'CalloutListRx')['$=~'](this_line) : $b))) { + + reader.$unshift_line(this_line); + block = self.$parse_callout_list(reader, $gvars["~"], parent, document.$callouts()); + + $writer = ["style", "arabic"]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + break;; + } else if ($truthy($$($nesting, 'UnorderedListRx')['$match?'](this_line))) { + + reader.$unshift_line(this_line); + if ($truthy(($truthy($b = ($truthy($c = style['$!']()) ? $$($nesting, 'Section')['$==='](parent) : $c)) ? parent.$sectname()['$==']("bibliography") : $b))) { + + $writer = ["style", (style = "bibliography")]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + block = self.$parse_list(reader, "ulist", parent, style); + break;; + } else if ($truthy((match = $$($nesting, 'OrderedListRx').$match(this_line)))) { + + reader.$unshift_line(this_line); + block = self.$parse_list(reader, "olist", parent, style); + if ($truthy(block.$style())) { + + $writer = ["style", block.$style()]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + break;; + } else if ($truthy((match = $$($nesting, 'DescriptionListRx').$match(this_line)))) { + + reader.$unshift_line(this_line); + block = self.$parse_description_list(reader, match, parent); + break;; + } else if ($truthy(($truthy($b = ($truthy($c = style['$==']("float")) ? $c : style['$==']("discrete"))) ? (function() {if ($truthy($$($nesting, 'Compliance').$underline_style_section_titles())) { + + return self['$is_section_title?'](this_line, reader.$peek_line()); + } else { + return ($truthy($c = indented['$!']()) ? self['$atx_section_title?'](this_line) : $c) + }; return nil; })() : $b))) { + + reader.$unshift_line(this_line); + $c = self.$parse_section_title(reader, document, attributes['$[]']("id")), $b = Opal.to_ary($c), (float_id = ($b[0] == null ? nil : $b[0])), (float_reftext = ($b[1] == null ? nil : $b[1])), (float_title = ($b[2] == null ? nil : $b[2])), (float_level = ($b[3] == null ? nil : $b[3])), $c; + if ($truthy(float_reftext)) { + + $writer = ["reftext", float_reftext]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + block = $$($nesting, 'Block').$new(parent, "floating_title", $hash2(["content_model"], {"content_model": "empty"})); + + $writer = [float_title]; + $send(block, 'title=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + attributes.$delete("title"); + + $writer = [($truthy($b = float_id) ? $b : (function() {if ($truthy(doc_attrs['$key?']("sectids"))) { + + return $$($nesting, 'Section').$generate_id(block.$title(), document); + } else { + return nil + }; return nil; })())]; + $send(block, 'id=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = [float_level]; + $send(block, 'level=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + break;; + } else if ($truthy(($truthy($b = style) ? style['$!=']("normal") : $b))) { + if ($truthy($$($nesting, 'PARAGRAPH_STYLES')['$include?'](style))) { + + block_context = style.$to_sym(); + cloaked_context = "paragraph"; + reader.$unshift_line(this_line); + break;; + } else if ($truthy($$($nesting, 'ADMONITION_STYLES')['$include?'](style))) { + + block_context = "admonition"; + cloaked_context = "paragraph"; + reader.$unshift_line(this_line); + break;; + } else if ($truthy(($truthy($b = block_extensions) ? extensions['$registered_for_block?'](style, "paragraph") : $b))) { + + block_context = style.$to_sym(); + cloaked_context = "paragraph"; + reader.$unshift_line(this_line); + break;; + } else { + + self.$logger().$warn(self.$message_with_context("" + "invalid style for paragraph: " + (style), $hash2(["source_location"], {"source_location": reader.$cursor_at_mark()}))); + style = nil; + }}; + reader.$unshift_line(this_line); + if ($truthy(($truthy($b = indented) ? style['$!']() : $b))) { + + lines = self.$read_paragraph_lines(reader, ($truthy($b = (in_list = $$($nesting, 'ListItem')['$==='](parent))) ? skipped['$=='](0) : $b), $hash2(["skip_line_comments"], {"skip_line_comments": text_only})); + self['$adjust_indentation!'](lines); + block = $$($nesting, 'Block').$new(parent, "literal", $hash2(["content_model", "source", "attributes"], {"content_model": "verbatim", "source": lines, "attributes": attributes})); + if ($truthy(in_list)) { + block.$set_option("listparagraph")}; + } else { + + lines = self.$read_paragraph_lines(reader, (($b = skipped['$=='](0)) ? $$($nesting, 'ListItem')['$==='](parent) : skipped['$=='](0)), $hash2(["skip_line_comments"], {"skip_line_comments": true})); + if ($truthy(text_only)) { + + if ($truthy(($truthy($b = indented) ? style['$==']("normal") : $b))) { + self['$adjust_indentation!'](lines)}; + block = $$($nesting, 'Block').$new(parent, "paragraph", $hash2(["content_model", "source", "attributes"], {"content_model": "simple", "source": lines, "attributes": attributes})); + } else if ($truthy(($truthy($b = ($truthy($c = $$($nesting, 'ADMONITION_STYLE_HEADS')['$include?'](ch0)) ? this_line['$include?'](":") : $c)) ? $$($nesting, 'AdmonitionParagraphRx')['$=~'](this_line) : $b))) { + + + $writer = [0, (($b = $gvars['~']) === nil ? nil : $b.$post_match())]; + $send(lines, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["name", (admonition_name = (($writer = ["style", (($b = $gvars['~']) === nil ? nil : $b['$[]'](1))]), $send(attributes, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]).$downcase())]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["textlabel", ($truthy($b = attributes.$delete("caption")) ? $b : doc_attrs['$[]']("" + (admonition_name) + "-caption"))]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + block = $$($nesting, 'Block').$new(parent, "admonition", $hash2(["content_model", "source", "attributes"], {"content_model": "simple", "source": lines, "attributes": attributes})); + } else if ($truthy(($truthy($b = ($truthy($c = md_syntax) ? ch0['$=='](">") : $c)) ? this_line['$start_with?']("> ") : $b))) { + + $send(lines, 'map!', [], (TMP_12 = function(line){var self = TMP_12.$$s || this; + + + + if (line == null) { + line = nil; + }; + if (line['$=='](">")) { + + return line.$slice(1, line.$length()); + } else { + + if ($truthy(line['$start_with?']("> "))) { + + return line.$slice(2, line.$length()); + } else { + return line + }; + };}, TMP_12.$$s = self, TMP_12.$$arity = 1, TMP_12)); + if ($truthy(lines['$[]'](-1)['$start_with?']("-- "))) { + + credit_line = (credit_line = lines.$pop()).$slice(3, credit_line.$length()); + while ($truthy(lines['$[]'](-1)['$empty?']())) { + lines.$pop() + };}; + + $writer = ["style", "quote"]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + block = self.$build_block("quote", "compound", false, parent, $$($nesting, 'Reader').$new(lines), attributes); + if ($truthy(credit_line)) { + + $c = block.$apply_subs(credit_line).$split(", ", 2), $b = Opal.to_ary($c), (attribution = ($b[0] == null ? nil : $b[0])), (citetitle = ($b[1] == null ? nil : $b[1])), $c; + if ($truthy(attribution)) { + + $writer = ["attribution", attribution]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if ($truthy(citetitle)) { + + $writer = ["citetitle", citetitle]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];};}; + } else if ($truthy(($truthy($b = ($truthy($c = (($d = ch0['$==']("\"")) ? $rb_gt(lines.$size(), 1) : ch0['$==']("\""))) ? lines['$[]'](-1)['$start_with?']("-- ") : $c)) ? lines['$[]'](-2)['$end_with?']("\"") : $b))) { + + + $writer = [0, this_line.$slice(1, this_line.$length())]; + $send(lines, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + credit_line = (credit_line = lines.$pop()).$slice(3, credit_line.$length()); + while ($truthy(lines['$[]'](-1)['$empty?']())) { + lines.$pop() + }; + lines['$<<'](lines.$pop().$chop()); + + $writer = ["style", "quote"]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + block = $$($nesting, 'Block').$new(parent, "quote", $hash2(["content_model", "source", "attributes"], {"content_model": "simple", "source": lines, "attributes": attributes})); + $c = block.$apply_subs(credit_line).$split(", ", 2), $b = Opal.to_ary($c), (attribution = ($b[0] == null ? nil : $b[0])), (citetitle = ($b[1] == null ? nil : $b[1])), $c; + if ($truthy(attribution)) { + + $writer = ["attribution", attribution]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if ($truthy(citetitle)) { + + $writer = ["citetitle", citetitle]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + } else { + + if ($truthy(($truthy($b = indented) ? style['$==']("normal") : $b))) { + self['$adjust_indentation!'](lines)}; + block = $$($nesting, 'Block').$new(parent, "paragraph", $hash2(["content_model", "source", "attributes"], {"content_model": "simple", "source": lines, "attributes": attributes})); + }; + self.$catalog_inline_anchors(lines.$join($$($nesting, 'LF')), block, document, reader); + }; + break;; + } + }; + if ($truthy(block)) { + } else { + + if ($truthy(($truthy($a = block_context['$==']("abstract")) ? $a : block_context['$==']("partintro")))) { + block_context = "open"}; + $case = block_context; + if ("admonition"['$===']($case)) { + + $writer = ["name", (admonition_name = style.$downcase())]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["textlabel", ($truthy($a = attributes.$delete("caption")) ? $a : doc_attrs['$[]']("" + (admonition_name) + "-caption"))]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + block = self.$build_block(block_context, "compound", terminator, parent, reader, attributes);} + else if ("comment"['$===']($case)) { + self.$build_block(block_context, "skip", terminator, parent, reader, attributes); + attributes.$clear(); + return nil;} + else if ("example"['$===']($case)) {block = self.$build_block(block_context, "compound", terminator, parent, reader, attributes)} + else if ("listing"['$===']($case) || "literal"['$===']($case)) {block = self.$build_block(block_context, "verbatim", terminator, parent, reader, attributes)} + else if ("source"['$===']($case)) { + $$($nesting, 'AttributeList').$rekey(attributes, [nil, "language", "linenums"]); + if ($truthy(attributes['$key?']("language"))) { + } else if ($truthy(doc_attrs['$key?']("source-language"))) { + + $writer = ["language", ($truthy($a = doc_attrs['$[]']("source-language")) ? $a : "text")]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if ($truthy(attributes['$key?']("linenums"))) { + } else if ($truthy(($truthy($a = attributes['$key?']("linenums-option")) ? $a : doc_attrs['$key?']("source-linenums-option")))) { + + $writer = ["linenums", ""]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if ($truthy(attributes['$key?']("indent"))) { + } else if ($truthy(doc_attrs['$key?']("source-indent"))) { + + $writer = ["indent", doc_attrs['$[]']("source-indent")]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + block = self.$build_block("listing", "verbatim", terminator, parent, reader, attributes);} + else if ("fenced_code"['$===']($case)) { + + $writer = ["style", "source"]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + if ((ll = this_line.$length())['$=='](3)) { + language = nil + } else if ($truthy((comma_idx = (language = this_line.$slice(3, ll)).$index(",")))) { + if ($truthy($rb_gt(comma_idx, 0))) { + + language = language.$slice(0, comma_idx).$strip(); + if ($truthy($rb_lt(comma_idx, $rb_minus(ll, 4)))) { + + $writer = ["linenums", ""]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + } else { + + language = nil; + if ($truthy($rb_gt(ll, 4))) { + + $writer = ["linenums", ""]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + } + } else { + language = language.$lstrip() + }; + if ($truthy(language['$nil_or_empty?']())) { + if ($truthy(doc_attrs['$key?']("source-language"))) { + + $writer = ["language", ($truthy($a = doc_attrs['$[]']("source-language")) ? $a : "text")]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];} + } else { + + $writer = ["language", language]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + if ($truthy(attributes['$key?']("linenums"))) { + } else if ($truthy(($truthy($a = attributes['$key?']("linenums-option")) ? $a : doc_attrs['$key?']("source-linenums-option")))) { + + $writer = ["linenums", ""]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if ($truthy(attributes['$key?']("indent"))) { + } else if ($truthy(doc_attrs['$key?']("source-indent"))) { + + $writer = ["indent", doc_attrs['$[]']("source-indent")]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + terminator = terminator.$slice(0, 3); + block = self.$build_block("listing", "verbatim", terminator, parent, reader, attributes);} + else if ("pass"['$===']($case)) {block = self.$build_block(block_context, "raw", terminator, parent, reader, attributes)} + else if ("stem"['$===']($case) || "latexmath"['$===']($case) || "asciimath"['$===']($case)) { + if (block_context['$==']("stem")) { + + $writer = ["style", $$($nesting, 'STEM_TYPE_ALIASES')['$[]'](($truthy($a = attributes['$[]'](2)) ? $a : doc_attrs['$[]']("stem")))]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + block = self.$build_block("stem", "raw", terminator, parent, reader, attributes);} + else if ("open"['$===']($case) || "sidebar"['$===']($case)) {block = self.$build_block(block_context, "compound", terminator, parent, reader, attributes)} + else if ("table"['$===']($case)) { + block_cursor = reader.$cursor(); + block_reader = $$($nesting, 'Reader').$new(reader.$read_lines_until($hash2(["terminator", "skip_line_comments", "context", "cursor"], {"terminator": terminator, "skip_line_comments": true, "context": "table", "cursor": "at_mark"})), block_cursor); + if ($truthy(terminator['$start_with?']("|", "!"))) { + } else { + ($truthy($a = attributes['$[]']("format")) ? $a : (($writer = ["format", (function() {if ($truthy(terminator['$start_with?'](","))) { + return "csv" + } else { + return "dsv" + }; return nil; })()]), $send(attributes, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])) + }; + block = self.$parse_table(block_reader, parent, attributes);} + else if ("quote"['$===']($case) || "verse"['$===']($case)) { + $$($nesting, 'AttributeList').$rekey(attributes, [nil, "attribution", "citetitle"]); + block = self.$build_block(block_context, (function() {if (block_context['$==']("verse")) { + return "verbatim" + } else { + return "compound" + }; return nil; })(), terminator, parent, reader, attributes);} + else {if ($truthy(($truthy($a = block_extensions) ? (extension = extensions['$registered_for_block?'](block_context, cloaked_context)) : $a))) { + + if ($truthy((content_model = extension.$config()['$[]']("content_model"))['$!=']("skip"))) { + + if ($truthy((pos_attrs = ($truthy($a = extension.$config()['$[]']("pos_attrs")) ? $a : []))['$empty?']()['$!']())) { + $$($nesting, 'AttributeList').$rekey(attributes, [nil].$concat(pos_attrs))}; + if ($truthy((default_attrs = extension.$config()['$[]']("default_attrs")))) { + $send(default_attrs, 'each', [], (TMP_13 = function(k, v){var self = TMP_13.$$s || this, $e; + + + + if (k == null) { + k = nil; + }; + + if (v == null) { + v = nil; + }; + return ($truthy($e = attributes['$[]'](k)) ? $e : (($writer = [k, v]), $send(attributes, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]));}, TMP_13.$$s = self, TMP_13.$$arity = 2, TMP_13))}; + + $writer = ["cloaked-context", cloaked_context]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];;}; + block = self.$build_block(block_context, content_model, terminator, parent, reader, attributes, $hash2(["extension"], {"extension": extension})); + if ($truthy(block)) { + } else { + + attributes.$clear(); + return nil; + }; + } else { + self.$raise("" + "Unsupported block type " + (block_context) + " at " + (reader.$cursor())) + }}; + }; + if ($truthy(document.$sourcemap())) { + + $writer = [reader.$cursor_at_mark()]; + $send(block, 'source_location=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if ($truthy(attributes['$key?']("title"))) { + + $writer = [attributes.$delete("title")]; + $send(block, 'title=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + + $writer = [attributes['$[]']("style")]; + $send(block, 'style=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + if ($truthy((block_id = ($truthy($a = block.$id()) ? $a : (($writer = [attributes['$[]']("id")]), $send(block, 'id=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]))))) { + if ($truthy(document.$register("refs", [block_id, block, ($truthy($a = attributes['$[]']("reftext")) ? $a : (function() {if ($truthy(block['$title?']())) { + return block.$title() + } else { + return nil + }; return nil; })())]))) { + } else { + self.$logger().$warn(self.$message_with_context("" + "id assigned to block already in use: " + (block_id), $hash2(["source_location"], {"source_location": reader.$cursor_at_mark()}))) + }}; + if ($truthy(attributes['$empty?']())) { + } else { + block.$attributes().$update(attributes) + }; + block.$lock_in_subs(); + if ($truthy(block['$sub?']("callouts"))) { + if ($truthy(self.$catalog_callouts(block.$source(), document))) { + } else { + block.$remove_sub("callouts") + }}; + return block; + } catch ($returner) { if ($returner === Opal.returner) { return $returner.$v } throw $returner; } + }, TMP_Parser_next_block_10.$$arity = -3); + Opal.defs(self, '$read_paragraph_lines', TMP_Parser_read_paragraph_lines_14 = function $$read_paragraph_lines(reader, break_at_list, opts) { + var self = this, $writer = nil, break_condition = nil; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + + $writer = ["break_on_blank_lines", true]; + $send(opts, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["break_on_list_continuation", true]; + $send(opts, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["preserve_last_line", true]; + $send(opts, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + break_condition = (function() {if ($truthy(break_at_list)) { + + if ($truthy($$($nesting, 'Compliance').$block_terminates_paragraph())) { + return $$($nesting, 'StartOfBlockOrListProc') + } else { + return $$($nesting, 'StartOfListProc') + }; + } else { + + if ($truthy($$($nesting, 'Compliance').$block_terminates_paragraph())) { + return $$($nesting, 'StartOfBlockProc') + } else { + return $$($nesting, 'NoOp') + }; + }; return nil; })(); + return $send(reader, 'read_lines_until', [opts], break_condition.$to_proc()); + }, TMP_Parser_read_paragraph_lines_14.$$arity = -3); + Opal.defs(self, '$is_delimited_block?', TMP_Parser_is_delimited_block$q_15 = function(line, return_match_data) { + var $a, $b, self = this, line_len = nil, tip = nil, tl = nil, fenced_code = nil, tip_3 = nil, context = nil, masq = nil; + + + + if (return_match_data == null) { + return_match_data = false; + }; + if ($truthy(($truthy($a = $rb_gt((line_len = line.$length()), 1)) ? $$($nesting, 'DELIMITED_BLOCK_HEADS')['$include?'](line.$slice(0, 2)) : $a))) { + } else { + return nil + }; + if (line_len['$=='](2)) { + + tip = line; + tl = 2; + } else { + + if ($truthy($rb_le(line_len, 4))) { + + tip = line; + tl = line_len; + } else { + + tip = line.$slice(0, 4); + tl = 4; + }; + fenced_code = false; + if ($truthy($$($nesting, 'Compliance').$markdown_syntax())) { + + tip_3 = (function() {if (tl['$=='](4)) { + return tip.$chop() + } else { + return tip + }; return nil; })(); + if (tip_3['$==']("```")) { + + if ($truthy((($a = tl['$=='](4)) ? tip['$end_with?']("`") : tl['$=='](4)))) { + return nil}; + tip = tip_3; + tl = 3; + fenced_code = true;};}; + if ($truthy((($a = tl['$=='](3)) ? fenced_code['$!']() : tl['$=='](3)))) { + return nil}; + }; + if ($truthy($$($nesting, 'DELIMITED_BLOCKS')['$key?'](tip))) { + if ($truthy(($truthy($a = $rb_lt(tl, 4)) ? $a : tl['$=='](line_len)))) { + if ($truthy(return_match_data)) { + + $b = $$($nesting, 'DELIMITED_BLOCKS')['$[]'](tip), $a = Opal.to_ary($b), (context = ($a[0] == null ? nil : $a[0])), (masq = ($a[1] == null ? nil : $a[1])), $b; + return $$($nesting, 'BlockMatchData').$new(context, masq, tip, tip); + } else { + return true + } + } else if ((("" + (tip)) + ($rb_times(tip.$slice(-1, 1), $rb_minus(line_len, tl))))['$=='](line)) { + if ($truthy(return_match_data)) { + + $b = $$($nesting, 'DELIMITED_BLOCKS')['$[]'](tip), $a = Opal.to_ary($b), (context = ($a[0] == null ? nil : $a[0])), (masq = ($a[1] == null ? nil : $a[1])), $b; + return $$($nesting, 'BlockMatchData').$new(context, masq, tip, line); + } else { + return true + } + } else { + return nil + } + } else { + return nil + }; + }, TMP_Parser_is_delimited_block$q_15.$$arity = -2); + Opal.defs(self, '$build_block', TMP_Parser_build_block_16 = function $$build_block(block_context, content_model, terminator, parent, reader, attributes, options) { + var $a, $b, self = this, skip_processing = nil, parse_as_content_model = nil, lines = nil, block_reader = nil, block_cursor = nil, indent = nil, tab_size = nil, extension = nil, block = nil, $writer = nil; + + + + if (options == null) { + options = $hash2([], {}); + }; + if (content_model['$==']("skip")) { + $a = [true, "simple"], (skip_processing = $a[0]), (parse_as_content_model = $a[1]), $a + } else if (content_model['$==']("raw")) { + $a = [false, "simple"], (skip_processing = $a[0]), (parse_as_content_model = $a[1]), $a + } else { + $a = [false, content_model], (skip_processing = $a[0]), (parse_as_content_model = $a[1]), $a + }; + if ($truthy(terminator['$nil?']())) { + + if (parse_as_content_model['$==']("verbatim")) { + lines = reader.$read_lines_until($hash2(["break_on_blank_lines", "break_on_list_continuation"], {"break_on_blank_lines": true, "break_on_list_continuation": true})) + } else { + + if (content_model['$==']("compound")) { + content_model = "simple"}; + lines = self.$read_paragraph_lines(reader, false, $hash2(["skip_line_comments", "skip_processing"], {"skip_line_comments": true, "skip_processing": skip_processing})); + }; + block_reader = nil; + } else if ($truthy(parse_as_content_model['$!=']("compound"))) { + + lines = reader.$read_lines_until($hash2(["terminator", "skip_processing", "context", "cursor"], {"terminator": terminator, "skip_processing": skip_processing, "context": block_context, "cursor": "at_mark"})); + block_reader = nil; + } else if (terminator['$=='](false)) { + + lines = nil; + block_reader = reader; + } else { + + lines = nil; + block_cursor = reader.$cursor(); + block_reader = $$($nesting, 'Reader').$new(reader.$read_lines_until($hash2(["terminator", "skip_processing", "context", "cursor"], {"terminator": terminator, "skip_processing": skip_processing, "context": block_context, "cursor": "at_mark"})), block_cursor); + }; + if (content_model['$==']("verbatim")) { + if ($truthy((indent = attributes['$[]']("indent")))) { + self['$adjust_indentation!'](lines, indent, ($truthy($a = attributes['$[]']("tabsize")) ? $a : parent.$document().$attributes()['$[]']("tabsize"))) + } else if ($truthy($rb_gt((tab_size = ($truthy($a = attributes['$[]']("tabsize")) ? $a : parent.$document().$attributes()['$[]']("tabsize")).$to_i()), 0))) { + self['$adjust_indentation!'](lines, nil, tab_size)} + } else if (content_model['$==']("skip")) { + return nil}; + if ($truthy((extension = options['$[]']("extension")))) { + + attributes.$delete("style"); + if ($truthy((block = extension.$process_method()['$[]'](parent, ($truthy($a = block_reader) ? $a : $$($nesting, 'Reader').$new(lines)), attributes.$dup())))) { + + attributes.$replace(block.$attributes()); + if ($truthy((($a = block.$content_model()['$==']("compound")) ? (lines = block.$lines())['$nil_or_empty?']()['$!']() : block.$content_model()['$==']("compound")))) { + + content_model = "compound"; + block_reader = $$($nesting, 'Reader').$new(lines);}; + } else { + return nil + }; + } else { + block = $$($nesting, 'Block').$new(parent, block_context, $hash2(["content_model", "source", "attributes"], {"content_model": content_model, "source": lines, "attributes": attributes})) + }; + if ($truthy(($truthy($a = ($truthy($b = attributes['$key?']("title")) ? block.$context()['$!=']("admonition") : $b)) ? parent.$document().$attributes()['$key?']("" + (block.$context()) + "-caption") : $a))) { + + + $writer = [attributes.$delete("title")]; + $send(block, 'title=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + block.$assign_caption(attributes.$delete("caption"));}; + if (content_model['$==']("compound")) { + self.$parse_blocks(block_reader, block)}; + return block; + }, TMP_Parser_build_block_16.$$arity = -7); + Opal.defs(self, '$parse_blocks', TMP_Parser_parse_blocks_17 = function $$parse_blocks(reader, parent) { + var $a, $b, $c, self = this, block = nil; + + while ($truthy(($truthy($b = ($truthy($c = (block = self.$next_block(reader, parent))) ? parent.$blocks()['$<<'](block) : $c)) ? $b : reader['$has_more_lines?']()))) { + + } + }, TMP_Parser_parse_blocks_17.$$arity = 2); + Opal.defs(self, '$parse_list', TMP_Parser_parse_list_18 = function $$parse_list(reader, list_type, parent, style) { + var $a, $b, $c, self = this, list_block = nil, list_rx = nil, list_item = nil; + if ($gvars["~"] == null) $gvars["~"] = nil; + + + list_block = $$($nesting, 'List').$new(parent, list_type); + while ($truthy(($truthy($b = reader['$has_more_lines?']()) ? (list_rx = ($truthy($c = list_rx) ? $c : $$($nesting, 'ListRxMap')['$[]'](list_type)))['$=~'](reader.$peek_line()) : $b))) { + + if ($truthy((list_item = self.$parse_list_item(reader, list_block, $gvars["~"], (($b = $gvars['~']) === nil ? nil : $b['$[]'](1)), style)))) { + list_block.$items()['$<<'](list_item)}; + if ($truthy($b = reader.$skip_blank_lines())) { + $b + } else { + break; + }; + }; + return list_block; + }, TMP_Parser_parse_list_18.$$arity = 4); + Opal.defs(self, '$catalog_callouts', TMP_Parser_catalog_callouts_19 = function $$catalog_callouts(text, document) { + var TMP_20, self = this, found = nil, autonum = nil; + + + found = false; + autonum = 0; + if ($truthy(text['$include?']("<"))) { + $send(text, 'scan', [$$($nesting, 'CalloutScanRx')], (TMP_20 = function(){var self = TMP_20.$$s || this, $a, $b, captured = nil, num = nil; + + + $a = [(($b = $gvars['~']) === nil ? nil : $b['$[]'](0)), (($b = $gvars['~']) === nil ? nil : $b['$[]'](2))], (captured = $a[0]), (num = $a[1]), $a; + if ($truthy(captured['$start_with?']("\\"))) { + } else { + document.$callouts().$register((function() {if (num['$=='](".")) { + return (autonum = $rb_plus(autonum, 1)).$to_s() + } else { + return num + }; return nil; })()) + }; + return (found = true);}, TMP_20.$$s = self, TMP_20.$$arity = 0, TMP_20))}; + return found; + }, TMP_Parser_catalog_callouts_19.$$arity = 2); + Opal.defs(self, '$catalog_inline_anchor', TMP_Parser_catalog_inline_anchor_21 = function $$catalog_inline_anchor(id, reftext, node, location, doc) { + var $a, self = this; + + + + if (doc == null) { + doc = nil; + }; + doc = ($truthy($a = doc) ? $a : node.$document()); + if ($truthy(($truthy($a = reftext) ? reftext['$include?']($$($nesting, 'ATTR_REF_HEAD')) : $a))) { + reftext = doc.$sub_attributes(reftext)}; + if ($truthy(doc.$register("refs", [id, $$($nesting, 'Inline').$new(node, "anchor", reftext, $hash2(["type", "id"], {"type": "ref", "id": id})), reftext]))) { + } else { + + if ($truthy($$($nesting, 'Reader')['$==='](location))) { + location = location.$cursor()}; + self.$logger().$warn(self.$message_with_context("" + "id assigned to anchor already in use: " + (id), $hash2(["source_location"], {"source_location": location}))); + }; + return nil; + }, TMP_Parser_catalog_inline_anchor_21.$$arity = -5); + Opal.defs(self, '$catalog_inline_anchors', TMP_Parser_catalog_inline_anchors_22 = function $$catalog_inline_anchors(text, block, document, reader) { + var $a, TMP_23, self = this; + + + if ($truthy(($truthy($a = text['$include?']("[[")) ? $a : text['$include?']("or:")))) { + $send(text, 'scan', [$$($nesting, 'InlineAnchorScanRx')], (TMP_23 = function(){var self = TMP_23.$$s || this, $b, m = nil, id = nil, reftext = nil, location = nil, offset = nil; + if ($gvars["~"] == null) $gvars["~"] = nil; + + + m = $gvars["~"]; + if ($truthy((id = (($b = $gvars['~']) === nil ? nil : $b['$[]'](1))))) { + if ($truthy((reftext = (($b = $gvars['~']) === nil ? nil : $b['$[]'](2))))) { + if ($truthy(($truthy($b = reftext['$include?']($$($nesting, 'ATTR_REF_HEAD'))) ? (reftext = document.$sub_attributes(reftext))['$empty?']() : $b))) { + return nil;}} + } else { + + id = (($b = $gvars['~']) === nil ? nil : $b['$[]'](3)); + if ($truthy((reftext = (($b = $gvars['~']) === nil ? nil : $b['$[]'](4))))) { + + if ($truthy(reftext['$include?']("]"))) { + reftext = reftext.$gsub("\\]", "]")}; + if ($truthy(($truthy($b = reftext['$include?']($$($nesting, 'ATTR_REF_HEAD'))) ? (reftext = document.$sub_attributes(reftext))['$empty?']() : $b))) { + return nil;};}; + }; + if ($truthy(document.$register("refs", [id, $$($nesting, 'Inline').$new(block, "anchor", reftext, $hash2(["type", "id"], {"type": "ref", "id": id})), reftext]))) { + return nil + } else { + + location = reader.$cursor_at_mark(); + if ($truthy($rb_gt((offset = $rb_plus(m.$pre_match().$count($$($nesting, 'LF')), (function() {if ($truthy(m['$[]'](0)['$start_with?']($$($nesting, 'LF')))) { + return 1 + } else { + return 0 + }; return nil; })())), 0))) { + (location = location.$dup()).$advance(offset)}; + return self.$logger().$warn(self.$message_with_context("" + "id assigned to anchor already in use: " + (id), $hash2(["source_location"], {"source_location": location}))); + };}, TMP_23.$$s = self, TMP_23.$$arity = 0, TMP_23))}; + return nil; + }, TMP_Parser_catalog_inline_anchors_22.$$arity = 4); + Opal.defs(self, '$catalog_inline_biblio_anchor', TMP_Parser_catalog_inline_biblio_anchor_24 = function $$catalog_inline_biblio_anchor(id, reftext, node, reader) { + var $a, self = this, styled_reftext = nil; + + + if ($truthy(node.$document().$register("refs", [id, $$($nesting, 'Inline').$new(node, "anchor", (styled_reftext = "" + "[" + (($truthy($a = reftext) ? $a : id)) + "]"), $hash2(["type", "id"], {"type": "bibref", "id": id})), styled_reftext]))) { + } else { + self.$logger().$warn(self.$message_with_context("" + "id assigned to bibliography anchor already in use: " + (id), $hash2(["source_location"], {"source_location": reader.$cursor()}))) + }; + return nil; + }, TMP_Parser_catalog_inline_biblio_anchor_24.$$arity = 4); + Opal.defs(self, '$parse_description_list', TMP_Parser_parse_description_list_25 = function $$parse_description_list(reader, match, parent) { + var $a, $b, $c, self = this, list_block = nil, previous_pair = nil, sibling_pattern = nil, term = nil, item = nil, $writer = nil; + + + list_block = $$($nesting, 'List').$new(parent, "dlist"); + previous_pair = nil; + sibling_pattern = $$($nesting, 'DescriptionListSiblingRx')['$[]'](match['$[]'](2)); + while ($truthy(($truthy($b = match) ? $b : ($truthy($c = reader['$has_more_lines?']()) ? (match = sibling_pattern.$match(reader.$peek_line())) : $c)))) { + + $c = self.$parse_list_item(reader, list_block, match, sibling_pattern), $b = Opal.to_ary($c), (term = ($b[0] == null ? nil : $b[0])), (item = ($b[1] == null ? nil : $b[1])), $c; + if ($truthy(($truthy($b = previous_pair) ? previous_pair['$[]'](1)['$!']() : $b))) { + + previous_pair['$[]'](0)['$<<'](term); + + $writer = [1, item]; + $send(previous_pair, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + } else { + list_block.$items()['$<<']((previous_pair = [[term], item])) + }; + match = nil; + }; + return list_block; + }, TMP_Parser_parse_description_list_25.$$arity = 3); + Opal.defs(self, '$parse_callout_list', TMP_Parser_parse_callout_list_26 = function $$parse_callout_list(reader, match, parent, callouts) { + var $a, $b, $c, self = this, list_block = nil, next_index = nil, autonum = nil, num = nil, list_item = nil, coids = nil, $writer = nil; + + + list_block = $$($nesting, 'List').$new(parent, "colist"); + next_index = 1; + autonum = 0; + while ($truthy(($truthy($b = match) ? $b : ($truthy($c = (match = $$($nesting, 'CalloutListRx').$match(reader.$peek_line()))) ? reader.$mark() : $c)))) { + + if ((num = match['$[]'](1))['$=='](".")) { + num = (autonum = $rb_plus(autonum, 1)).$to_s()}; + if (num['$=='](next_index.$to_s())) { + } else { + self.$logger().$warn(self.$message_with_context("" + "callout list item index: expected " + (next_index) + ", got " + (num), $hash2(["source_location"], {"source_location": reader.$cursor_at_mark()}))) + }; + if ($truthy((list_item = self.$parse_list_item(reader, list_block, match, "<1>")))) { + + list_block.$items()['$<<'](list_item); + if ($truthy((coids = callouts.$callout_ids(list_block.$items().$size()))['$empty?']())) { + self.$logger().$warn(self.$message_with_context("" + "no callout found for <" + (list_block.$items().$size()) + ">", $hash2(["source_location"], {"source_location": reader.$cursor_at_mark()}))) + } else { + + $writer = ["coids", coids]; + $send(list_item.$attributes(), '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + };}; + next_index = $rb_plus(next_index, 1); + match = nil; + }; + callouts.$next_list(); + return list_block; + }, TMP_Parser_parse_callout_list_26.$$arity = 4); + Opal.defs(self, '$parse_list_item', TMP_Parser_parse_list_item_27 = function $$parse_list_item(reader, list_block, match, sibling_trait, style) { + var $a, $b, self = this, list_type = nil, dlist = nil, list_term = nil, term_text = nil, item_text = nil, has_text = nil, list_item = nil, $writer = nil, sourcemap_assignment_deferred = nil, ordinal = nil, implicit_style = nil, block_cursor = nil, list_item_reader = nil, comment_lines = nil, subsequent_line = nil, continuation_connects_first_block = nil, content_adjacent = nil, block = nil; + + + + if (style == null) { + style = nil; + }; + if ((list_type = list_block.$context())['$==']("dlist")) { + + dlist = true; + list_term = $$($nesting, 'ListItem').$new(list_block, (term_text = match['$[]'](1))); + if ($truthy(($truthy($a = term_text['$start_with?']("[[")) ? $$($nesting, 'LeadingInlineAnchorRx')['$=~'](term_text) : $a))) { + self.$catalog_inline_anchor((($a = $gvars['~']) === nil ? nil : $a['$[]'](1)), ($truthy($a = (($b = $gvars['~']) === nil ? nil : $b['$[]'](2))) ? $a : (($b = $gvars['~']) === nil ? nil : $b.$post_match()).$lstrip()), list_term, reader)}; + if ($truthy((item_text = match['$[]'](3)))) { + has_text = true}; + list_item = $$($nesting, 'ListItem').$new(list_block, item_text); + if ($truthy(list_block.$document().$sourcemap())) { + + + $writer = [reader.$cursor()]; + $send(list_term, 'source_location=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + if ($truthy(has_text)) { + + $writer = [list_term.$source_location()]; + $send(list_item, 'source_location=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + } else { + sourcemap_assignment_deferred = true + };}; + } else { + + has_text = true; + list_item = $$($nesting, 'ListItem').$new(list_block, (item_text = match['$[]'](2))); + if ($truthy(list_block.$document().$sourcemap())) { + + $writer = [reader.$cursor()]; + $send(list_item, 'source_location=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if (list_type['$==']("ulist")) { + + + $writer = [sibling_trait]; + $send(list_item, 'marker=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + if ($truthy(item_text['$start_with?']("["))) { + if ($truthy(($truthy($a = style) ? style['$==']("bibliography") : $a))) { + if ($truthy($$($nesting, 'InlineBiblioAnchorRx')['$=~'](item_text))) { + self.$catalog_inline_biblio_anchor((($a = $gvars['~']) === nil ? nil : $a['$[]'](1)), (($a = $gvars['~']) === nil ? nil : $a['$[]'](2)), list_item, reader)} + } else if ($truthy(item_text['$start_with?']("[["))) { + if ($truthy($$($nesting, 'LeadingInlineAnchorRx')['$=~'](item_text))) { + self.$catalog_inline_anchor((($a = $gvars['~']) === nil ? nil : $a['$[]'](1)), (($a = $gvars['~']) === nil ? nil : $a['$[]'](2)), list_item, reader)} + } else if ($truthy(item_text['$start_with?']("[ ] ", "[x] ", "[*] "))) { + + + $writer = ["checklist-option", ""]; + $send(list_block.$attributes(), '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["checkbox", ""]; + $send(list_item.$attributes(), '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + if ($truthy(item_text['$start_with?']("[ "))) { + } else { + + $writer = ["checked", ""]; + $send(list_item.$attributes(), '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + + $writer = [item_text.$slice(4, item_text.$length())]; + $send(list_item, 'text=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];;}}; + } else if (list_type['$==']("olist")) { + + $b = self.$resolve_ordered_list_marker(sibling_trait, (ordinal = list_block.$items().$size()), true, reader), $a = Opal.to_ary($b), (sibling_trait = ($a[0] == null ? nil : $a[0])), (implicit_style = ($a[1] == null ? nil : $a[1])), $b; + + $writer = [sibling_trait]; + $send(list_item, 'marker=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + if ($truthy((($a = ordinal['$=='](0)) ? style['$!']() : ordinal['$=='](0)))) { + + $writer = [($truthy($a = implicit_style) ? $a : ($truthy($b = $$($nesting, 'ORDERED_LIST_STYLES')['$[]']($rb_minus(sibling_trait.$length(), 1))) ? $b : "arabic").$to_s())]; + $send(list_block, 'style=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if ($truthy(($truthy($a = item_text['$start_with?']("[[")) ? $$($nesting, 'LeadingInlineAnchorRx')['$=~'](item_text) : $a))) { + self.$catalog_inline_anchor((($a = $gvars['~']) === nil ? nil : $a['$[]'](1)), (($a = $gvars['~']) === nil ? nil : $a['$[]'](2)), list_item, reader)}; + } else { + + $writer = [sibling_trait]; + $send(list_item, 'marker=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + }; + reader.$shift(); + block_cursor = reader.$cursor(); + list_item_reader = $$($nesting, 'Reader').$new(self.$read_lines_for_list_item(reader, list_type, sibling_trait, has_text), block_cursor); + if ($truthy(list_item_reader['$has_more_lines?']())) { + + if ($truthy(sourcemap_assignment_deferred)) { + + $writer = [block_cursor]; + $send(list_item, 'source_location=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + comment_lines = list_item_reader.$skip_line_comments(); + if ($truthy((subsequent_line = list_item_reader.$peek_line()))) { + + if ($truthy(comment_lines['$empty?']())) { + } else { + list_item_reader.$unshift_lines(comment_lines) + }; + if ($truthy((continuation_connects_first_block = subsequent_line['$empty?']()))) { + content_adjacent = false + } else { + + content_adjacent = true; + if ($truthy(dlist)) { + } else { + has_text = nil + }; + }; + } else { + + continuation_connects_first_block = false; + content_adjacent = false; + }; + if ($truthy((block = self.$next_block(list_item_reader, list_item, $hash2([], {}), $hash2(["text"], {"text": has_text['$!']()}))))) { + list_item.$blocks()['$<<'](block)}; + while ($truthy(list_item_reader['$has_more_lines?']())) { + if ($truthy((block = self.$next_block(list_item_reader, list_item)))) { + list_item.$blocks()['$<<'](block)} + }; + list_item.$fold_first(continuation_connects_first_block, content_adjacent);}; + if ($truthy(dlist)) { + if ($truthy(($truthy($a = list_item['$text?']()) ? $a : list_item['$blocks?']()))) { + return [list_term, list_item] + } else { + return [list_term] + } + } else { + return list_item + }; + }, TMP_Parser_parse_list_item_27.$$arity = -5); + Opal.defs(self, '$read_lines_for_list_item', TMP_Parser_read_lines_for_list_item_28 = function $$read_lines_for_list_item(reader, list_type, sibling_trait, has_text) { + var $a, $b, $c, TMP_29, TMP_30, TMP_31, TMP_32, TMP_33, self = this, buffer = nil, continuation = nil, within_nested_list = nil, detached_continuation = nil, this_line = nil, prev_line = nil, $writer = nil, match = nil, nested_list_type = nil; + + + + if (sibling_trait == null) { + sibling_trait = nil; + }; + + if (has_text == null) { + has_text = true; + }; + buffer = []; + continuation = "inactive"; + within_nested_list = false; + detached_continuation = nil; + while ($truthy(reader['$has_more_lines?']())) { + + this_line = reader.$read_line(); + if ($truthy(self['$is_sibling_list_item?'](this_line, list_type, sibling_trait))) { + break;}; + prev_line = (function() {if ($truthy(buffer['$empty?']())) { + return nil + } else { + return buffer['$[]'](-1) + }; return nil; })(); + if (prev_line['$==']($$($nesting, 'LIST_CONTINUATION'))) { + + if (continuation['$==']("inactive")) { + + continuation = "active"; + has_text = true; + if ($truthy(within_nested_list)) { + } else { + + $writer = [-1, ""]; + $send(buffer, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + };}; + if (this_line['$==']($$($nesting, 'LIST_CONTINUATION'))) { + + if ($truthy(continuation['$!=']("frozen"))) { + + continuation = "frozen"; + buffer['$<<'](this_line);}; + this_line = nil; + continue;;};}; + if ($truthy((match = self['$is_delimited_block?'](this_line, true)))) { + if (continuation['$==']("active")) { + + buffer['$<<'](this_line); + buffer.$concat(reader.$read_lines_until($hash2(["terminator", "read_last_line", "context"], {"terminator": match.$terminator(), "read_last_line": true, "context": nil}))); + continuation = "inactive"; + } else { + break; + } + } else if ($truthy(($truthy($b = (($c = list_type['$==']("dlist")) ? continuation['$!=']("active") : list_type['$==']("dlist"))) ? $$($nesting, 'BlockAttributeLineRx')['$match?'](this_line) : $b))) { + break; + } else if ($truthy((($b = continuation['$==']("active")) ? this_line['$empty?']()['$!']() : continuation['$==']("active")))) { + if ($truthy($$($nesting, 'LiteralParagraphRx')['$match?'](this_line))) { + + reader.$unshift_line(this_line); + buffer.$concat($send(reader, 'read_lines_until', [$hash2(["preserve_last_line", "break_on_blank_lines", "break_on_list_continuation"], {"preserve_last_line": true, "break_on_blank_lines": true, "break_on_list_continuation": true})], (TMP_29 = function(line){var self = TMP_29.$$s || this, $d; + + + + if (line == null) { + line = nil; + }; + return (($d = list_type['$==']("dlist")) ? self['$is_sibling_list_item?'](line, list_type, sibling_trait) : list_type['$==']("dlist"));}, TMP_29.$$s = self, TMP_29.$$arity = 1, TMP_29))); + continuation = "inactive"; + } else if ($truthy(($truthy($b = ($truthy($c = $$($nesting, 'BlockTitleRx')['$match?'](this_line)) ? $c : $$($nesting, 'BlockAttributeLineRx')['$match?'](this_line))) ? $b : $$($nesting, 'AttributeEntryRx')['$match?'](this_line)))) { + buffer['$<<'](this_line) + } else { + + if ($truthy((nested_list_type = $send((function() {if ($truthy(within_nested_list)) { + return ["dlist"] + } else { + return $$($nesting, 'NESTABLE_LIST_CONTEXTS') + }; return nil; })(), 'find', [], (TMP_30 = function(ctx){var self = TMP_30.$$s || this; + + + + if (ctx == null) { + ctx = nil; + }; + return $$($nesting, 'ListRxMap')['$[]'](ctx)['$match?'](this_line);}, TMP_30.$$s = self, TMP_30.$$arity = 1, TMP_30))))) { + + within_nested_list = true; + if ($truthy((($b = nested_list_type['$==']("dlist")) ? (($c = $gvars['~']) === nil ? nil : $c['$[]'](3))['$nil_or_empty?']() : nested_list_type['$==']("dlist")))) { + has_text = false};}; + buffer['$<<'](this_line); + continuation = "inactive"; + } + } else if ($truthy(($truthy($b = prev_line) ? prev_line['$empty?']() : $b))) { + + if ($truthy(this_line['$empty?']())) { + + if ($truthy((this_line = ($truthy($b = reader.$skip_blank_lines()) ? reader.$read_line() : $b)))) { + } else { + break; + }; + if ($truthy(self['$is_sibling_list_item?'](this_line, list_type, sibling_trait))) { + break;};}; + if (this_line['$==']($$($nesting, 'LIST_CONTINUATION'))) { + + detached_continuation = buffer.$size(); + buffer['$<<'](this_line); + } else if ($truthy(has_text)) { + if ($truthy(self['$is_sibling_list_item?'](this_line, list_type, sibling_trait))) { + break; + } else if ($truthy((nested_list_type = $send($$($nesting, 'NESTABLE_LIST_CONTEXTS'), 'find', [], (TMP_31 = function(ctx){var self = TMP_31.$$s || this; + + + + if (ctx == null) { + ctx = nil; + }; + return $$($nesting, 'ListRxMap')['$[]'](ctx)['$=~'](this_line);}, TMP_31.$$s = self, TMP_31.$$arity = 1, TMP_31))))) { + + buffer['$<<'](this_line); + within_nested_list = true; + if ($truthy((($b = nested_list_type['$==']("dlist")) ? (($c = $gvars['~']) === nil ? nil : $c['$[]'](3))['$nil_or_empty?']() : nested_list_type['$==']("dlist")))) { + has_text = false}; + } else if ($truthy($$($nesting, 'LiteralParagraphRx')['$match?'](this_line))) { + + reader.$unshift_line(this_line); + buffer.$concat($send(reader, 'read_lines_until', [$hash2(["preserve_last_line", "break_on_blank_lines", "break_on_list_continuation"], {"preserve_last_line": true, "break_on_blank_lines": true, "break_on_list_continuation": true})], (TMP_32 = function(line){var self = TMP_32.$$s || this, $d; + + + + if (line == null) { + line = nil; + }; + return (($d = list_type['$==']("dlist")) ? self['$is_sibling_list_item?'](line, list_type, sibling_trait) : list_type['$==']("dlist"));}, TMP_32.$$s = self, TMP_32.$$arity = 1, TMP_32))); + } else { + break; + } + } else { + + if ($truthy(within_nested_list)) { + } else { + buffer.$pop() + }; + buffer['$<<'](this_line); + has_text = true; + }; + } else { + + if ($truthy(this_line['$empty?']()['$!']())) { + has_text = true}; + if ($truthy((nested_list_type = $send((function() {if ($truthy(within_nested_list)) { + return ["dlist"] + } else { + return $$($nesting, 'NESTABLE_LIST_CONTEXTS') + }; return nil; })(), 'find', [], (TMP_33 = function(ctx){var self = TMP_33.$$s || this; + + + + if (ctx == null) { + ctx = nil; + }; + return $$($nesting, 'ListRxMap')['$[]'](ctx)['$=~'](this_line);}, TMP_33.$$s = self, TMP_33.$$arity = 1, TMP_33))))) { + + within_nested_list = true; + if ($truthy((($b = nested_list_type['$==']("dlist")) ? (($c = $gvars['~']) === nil ? nil : $c['$[]'](3))['$nil_or_empty?']() : nested_list_type['$==']("dlist")))) { + has_text = false};}; + buffer['$<<'](this_line); + }; + this_line = nil; + }; + if ($truthy(this_line)) { + reader.$unshift_line(this_line)}; + if ($truthy(detached_continuation)) { + buffer.$delete_at(detached_continuation)}; + while ($truthy(($truthy($b = buffer['$empty?']()['$!']()) ? buffer['$[]'](-1)['$empty?']() : $b))) { + buffer.$pop() + }; + if ($truthy(($truthy($a = buffer['$empty?']()['$!']()) ? buffer['$[]'](-1)['$==']($$($nesting, 'LIST_CONTINUATION')) : $a))) { + buffer.$pop()}; + return buffer; + }, TMP_Parser_read_lines_for_list_item_28.$$arity = -3); + Opal.defs(self, '$initialize_section', TMP_Parser_initialize_section_34 = function $$initialize_section(reader, parent, attributes) { + var $a, $b, self = this, document = nil, book = nil, doctype = nil, source_location = nil, sect_style = nil, sect_id = nil, sect_reftext = nil, sect_title = nil, sect_level = nil, sect_atx = nil, $writer = nil, sect_name = nil, sect_special = nil, sect_numbered = nil, section = nil, id = nil; + + + + if (attributes == null) { + attributes = $hash2([], {}); + }; + document = parent.$document(); + book = (doctype = document.$doctype())['$==']("book"); + if ($truthy(document.$sourcemap())) { + source_location = reader.$cursor()}; + sect_style = attributes['$[]'](1); + $b = self.$parse_section_title(reader, document, attributes['$[]']("id")), $a = Opal.to_ary($b), (sect_id = ($a[0] == null ? nil : $a[0])), (sect_reftext = ($a[1] == null ? nil : $a[1])), (sect_title = ($a[2] == null ? nil : $a[2])), (sect_level = ($a[3] == null ? nil : $a[3])), (sect_atx = ($a[4] == null ? nil : $a[4])), $b; + if ($truthy(sect_reftext)) { + + $writer = ["reftext", sect_reftext]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + } else { + sect_reftext = attributes['$[]']("reftext") + }; + if ($truthy(sect_style)) { + if ($truthy(($truthy($a = book) ? sect_style['$==']("abstract") : $a))) { + $a = ["chapter", 1], (sect_name = $a[0]), (sect_level = $a[1]), $a + } else { + + $a = [sect_style, true], (sect_name = $a[0]), (sect_special = $a[1]), $a; + if (sect_level['$=='](0)) { + sect_level = 1}; + sect_numbered = sect_style['$==']("appendix"); + } + } else if ($truthy(book)) { + sect_name = (function() {if (sect_level['$=='](0)) { + return "part" + } else { + + if ($truthy($rb_gt(sect_level, 1))) { + return "section" + } else { + return "chapter" + }; + }; return nil; })() + } else if ($truthy((($a = doctype['$==']("manpage")) ? sect_title.$casecmp("synopsis")['$=='](0) : doctype['$==']("manpage")))) { + $a = ["synopsis", true], (sect_name = $a[0]), (sect_special = $a[1]), $a + } else { + sect_name = "section" + }; + section = $$($nesting, 'Section').$new(parent, sect_level); + $a = [sect_id, sect_title, sect_name, source_location], section['$id=']($a[0]), section['$title=']($a[1]), section['$sectname=']($a[2]), section['$source_location=']($a[3]), $a; + if ($truthy(sect_special)) { + + + $writer = [true]; + $send(section, 'special=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + if ($truthy(sect_numbered)) { + + $writer = [true]; + $send(section, 'numbered=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + } else if (document.$attributes()['$[]']("sectnums")['$==']("all")) { + + $writer = [(function() {if ($truthy(($truthy($a = book) ? sect_level['$=='](1) : $a))) { + return "chapter" + } else { + return true + }; return nil; })()]; + $send(section, 'numbered=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + } else if ($truthy(($truthy($a = document.$attributes()['$[]']("sectnums")) ? $rb_gt(sect_level, 0) : $a))) { + + $writer = [(function() {if ($truthy(section.$special())) { + return ($truthy($a = parent.$numbered()) ? true : $a) + } else { + return true + }; return nil; })()]; + $send(section, 'numbered=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + } else if ($truthy(($truthy($a = ($truthy($b = book) ? sect_level['$=='](0) : $b)) ? document.$attributes()['$[]']("partnums") : $a))) { + + $writer = [true]; + $send(section, 'numbered=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if ($truthy((id = ($truthy($a = section.$id()) ? $a : (($writer = [(function() {if ($truthy(document.$attributes()['$key?']("sectids"))) { + + return $$($nesting, 'Section').$generate_id(section.$title(), document); + } else { + return nil + }; return nil; })()]), $send(section, 'id=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]))))) { + if ($truthy(document.$register("refs", [id, section, ($truthy($a = sect_reftext) ? $a : section.$title())]))) { + } else { + self.$logger().$warn(self.$message_with_context("" + "id assigned to section already in use: " + (id), $hash2(["source_location"], {"source_location": reader.$cursor_at_line($rb_minus(reader.$lineno(), (function() {if ($truthy(sect_atx)) { + return 1 + } else { + return 2 + }; return nil; })()))}))) + }}; + section.$update_attributes(attributes); + reader.$skip_blank_lines(); + return section; + }, TMP_Parser_initialize_section_34.$$arity = -3); + Opal.defs(self, '$is_next_line_section?', TMP_Parser_is_next_line_section$q_35 = function(reader, attributes) { + var $a, $b, self = this, style = nil, next_lines = nil; + + if ($truthy(($truthy($a = (style = attributes['$[]'](1))) ? ($truthy($b = style['$==']("discrete")) ? $b : style['$==']("float")) : $a))) { + return nil + } else if ($truthy($$($nesting, 'Compliance').$underline_style_section_titles())) { + + next_lines = reader.$peek_lines(2, ($truthy($a = style) ? style['$==']("comment") : $a)); + return self['$is_section_title?'](($truthy($a = next_lines['$[]'](0)) ? $a : ""), next_lines['$[]'](1)); + } else { + return self['$atx_section_title?'](($truthy($a = reader.$peek_line()) ? $a : "")) + } + }, TMP_Parser_is_next_line_section$q_35.$$arity = 2); + Opal.defs(self, '$is_next_line_doctitle?', TMP_Parser_is_next_line_doctitle$q_36 = function(reader, attributes, leveloffset) { + var $a, self = this, sect_level = nil; + + if ($truthy(leveloffset)) { + return ($truthy($a = (sect_level = self['$is_next_line_section?'](reader, attributes))) ? $rb_plus(sect_level, leveloffset.$to_i())['$=='](0) : $a) + } else { + return self['$is_next_line_section?'](reader, attributes)['$=='](0) + } + }, TMP_Parser_is_next_line_doctitle$q_36.$$arity = 3); + Opal.defs(self, '$is_section_title?', TMP_Parser_is_section_title$q_37 = function(line1, line2) { + var $a, self = this; + + + + if (line2 == null) { + line2 = nil; + }; + return ($truthy($a = self['$atx_section_title?'](line1)) ? $a : (function() {if ($truthy(line2['$nil_or_empty?']())) { + return nil + } else { + return self['$setext_section_title?'](line1, line2) + }; return nil; })()); + }, TMP_Parser_is_section_title$q_37.$$arity = -2); + Opal.defs(self, '$atx_section_title?', TMP_Parser_atx_section_title$q_38 = function(line) { + var $a, self = this; + + if ($truthy((function() {if ($truthy($$($nesting, 'Compliance').$markdown_syntax())) { + + return ($truthy($a = line['$start_with?']("=", "#")) ? $$($nesting, 'ExtAtxSectionTitleRx')['$=~'](line) : $a); + } else { + + return ($truthy($a = line['$start_with?']("=")) ? $$($nesting, 'AtxSectionTitleRx')['$=~'](line) : $a); + }; return nil; })())) { + return $rb_minus((($a = $gvars['~']) === nil ? nil : $a['$[]'](1)).$length(), 1) + } else { + return nil + } + }, TMP_Parser_atx_section_title$q_38.$$arity = 1); + Opal.defs(self, '$setext_section_title?', TMP_Parser_setext_section_title$q_39 = function(line1, line2) { + var $a, $b, $c, self = this, level = nil, line2_ch1 = nil, line2_len = nil; + + if ($truthy(($truthy($a = ($truthy($b = ($truthy($c = (level = $$($nesting, 'SETEXT_SECTION_LEVELS')['$[]']((line2_ch1 = line2.$chr())))) ? $rb_times(line2_ch1, (line2_len = line2.$length()))['$=='](line2) : $c)) ? $$($nesting, 'SetextSectionTitleRx')['$match?'](line1) : $b)) ? $rb_lt($rb_minus(self.$line_length(line1), line2_len).$abs(), 2) : $a))) { + return level + } else { + return nil + } + }, TMP_Parser_setext_section_title$q_39.$$arity = 2); + Opal.defs(self, '$parse_section_title', TMP_Parser_parse_section_title_40 = function $$parse_section_title(reader, document, sect_id) { + var $a, $b, $c, $d, $e, self = this, sect_reftext = nil, line1 = nil, sect_level = nil, sect_title = nil, atx = nil, line2 = nil, line2_ch1 = nil, line2_len = nil; + + + + if (sect_id == null) { + sect_id = nil; + }; + sect_reftext = nil; + line1 = reader.$read_line(); + if ($truthy((function() {if ($truthy($$($nesting, 'Compliance').$markdown_syntax())) { + + return ($truthy($a = line1['$start_with?']("=", "#")) ? $$($nesting, 'ExtAtxSectionTitleRx')['$=~'](line1) : $a); + } else { + + return ($truthy($a = line1['$start_with?']("=")) ? $$($nesting, 'AtxSectionTitleRx')['$=~'](line1) : $a); + }; return nil; })())) { + + $a = [$rb_minus((($b = $gvars['~']) === nil ? nil : $b['$[]'](1)).$length(), 1), (($b = $gvars['~']) === nil ? nil : $b['$[]'](2)), true], (sect_level = $a[0]), (sect_title = $a[1]), (atx = $a[2]), $a; + if ($truthy(sect_id)) { + } else if ($truthy(($truthy($a = ($truthy($b = sect_title['$end_with?']("]]")) ? $$($nesting, 'InlineSectionAnchorRx')['$=~'](sect_title) : $b)) ? (($b = $gvars['~']) === nil ? nil : $b['$[]'](1))['$!']() : $a))) { + $a = [sect_title.$slice(0, $rb_minus(sect_title.$length(), (($b = $gvars['~']) === nil ? nil : $b['$[]'](0)).$length())), (($b = $gvars['~']) === nil ? nil : $b['$[]'](2)), (($b = $gvars['~']) === nil ? nil : $b['$[]'](3))], (sect_title = $a[0]), (sect_id = $a[1]), (sect_reftext = $a[2]), $a}; + } else if ($truthy(($truthy($a = ($truthy($b = ($truthy($c = ($truthy($d = ($truthy($e = $$($nesting, 'Compliance').$underline_style_section_titles()) ? (line2 = reader.$peek_line(true)) : $e)) ? (sect_level = $$($nesting, 'SETEXT_SECTION_LEVELS')['$[]']((line2_ch1 = line2.$chr()))) : $d)) ? $rb_times(line2_ch1, (line2_len = line2.$length()))['$=='](line2) : $c)) ? (sect_title = ($truthy($c = $$($nesting, 'SetextSectionTitleRx')['$=~'](line1)) ? (($d = $gvars['~']) === nil ? nil : $d['$[]'](1)) : $c)) : $b)) ? $rb_lt($rb_minus(self.$line_length(line1), line2_len).$abs(), 2) : $a))) { + + atx = false; + if ($truthy(sect_id)) { + } else if ($truthy(($truthy($a = ($truthy($b = sect_title['$end_with?']("]]")) ? $$($nesting, 'InlineSectionAnchorRx')['$=~'](sect_title) : $b)) ? (($b = $gvars['~']) === nil ? nil : $b['$[]'](1))['$!']() : $a))) { + $a = [sect_title.$slice(0, $rb_minus(sect_title.$length(), (($b = $gvars['~']) === nil ? nil : $b['$[]'](0)).$length())), (($b = $gvars['~']) === nil ? nil : $b['$[]'](2)), (($b = $gvars['~']) === nil ? nil : $b['$[]'](3))], (sect_title = $a[0]), (sect_id = $a[1]), (sect_reftext = $a[2]), $a}; + reader.$shift(); + } else { + self.$raise("" + "Unrecognized section at " + (reader.$cursor_at_prev_line())) + }; + if ($truthy(document['$attr?']("leveloffset"))) { + sect_level = $rb_plus(sect_level, document.$attr("leveloffset").$to_i())}; + return [sect_id, sect_reftext, sect_title, sect_level, atx]; + }, TMP_Parser_parse_section_title_40.$$arity = -3); + if ($truthy($$($nesting, 'FORCE_UNICODE_LINE_LENGTH'))) { + Opal.defs(self, '$line_length', TMP_Parser_line_length_41 = function $$line_length(line) { + var self = this; + + return line.$scan($$($nesting, 'UnicodeCharScanRx')).$size() + }, TMP_Parser_line_length_41.$$arity = 1) + } else { + Opal.defs(self, '$line_length', TMP_Parser_line_length_42 = function $$line_length(line) { + var self = this; + + return line.$length() + }, TMP_Parser_line_length_42.$$arity = 1) + }; + Opal.defs(self, '$parse_header_metadata', TMP_Parser_parse_header_metadata_43 = function $$parse_header_metadata(reader, document) { + var $a, TMP_44, TMP_45, TMP_46, self = this, doc_attrs = nil, implicit_authors = nil, metadata = nil, implicit_author = nil, implicit_authorinitials = nil, author_metadata = nil, rev_metadata = nil, rev_line = nil, match = nil, $writer = nil, component = nil, author_line = nil, authors = nil, author_idx = nil, author_key = nil, explicit = nil, sparse = nil, author_override = nil; + + + + if (document == null) { + document = nil; + }; + doc_attrs = ($truthy($a = document) ? document.$attributes() : $a); + self.$process_attribute_entries(reader, document); + $a = [(implicit_authors = $hash2([], {})), nil, nil], (metadata = $a[0]), (implicit_author = $a[1]), (implicit_authorinitials = $a[2]), $a; + if ($truthy(($truthy($a = reader['$has_more_lines?']()) ? reader['$next_line_empty?']()['$!']() : $a))) { + + if ($truthy((author_metadata = self.$process_authors(reader.$read_line()))['$empty?']())) { + } else { + + if ($truthy(document)) { + + $send(author_metadata, 'each', [], (TMP_44 = function(key, val){var self = TMP_44.$$s || this, $writer = nil; + + + + if (key == null) { + key = nil; + }; + + if (val == null) { + val = nil; + }; + if ($truthy(doc_attrs['$key?'](key))) { + return nil + } else { + + $writer = [key, (function() {if ($truthy($$$('::', 'String')['$==='](val))) { + + return document.$apply_header_subs(val); + } else { + return val + }; return nil; })()]; + $send(doc_attrs, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + };}, TMP_44.$$s = self, TMP_44.$$arity = 2, TMP_44)); + implicit_author = doc_attrs['$[]']("author"); + implicit_authorinitials = doc_attrs['$[]']("authorinitials"); + implicit_authors = doc_attrs['$[]']("authors");}; + metadata = author_metadata; + }; + self.$process_attribute_entries(reader, document); + rev_metadata = $hash2([], {}); + if ($truthy(($truthy($a = reader['$has_more_lines?']()) ? reader['$next_line_empty?']()['$!']() : $a))) { + + rev_line = reader.$read_line(); + if ($truthy((match = $$($nesting, 'RevisionInfoLineRx').$match(rev_line)))) { + + if ($truthy(match['$[]'](1))) { + + $writer = ["revnumber", match['$[]'](1).$rstrip()]; + $send(rev_metadata, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if ($truthy((component = match['$[]'](2).$strip())['$empty?']())) { + } else if ($truthy(($truthy($a = match['$[]'](1)['$!']()) ? component['$start_with?']("v") : $a))) { + + $writer = ["revnumber", component.$slice(1, component.$length())]; + $send(rev_metadata, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + } else { + + $writer = ["revdate", component]; + $send(rev_metadata, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + if ($truthy(match['$[]'](3))) { + + $writer = ["revremark", match['$[]'](3).$rstrip()]; + $send(rev_metadata, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + } else { + reader.$unshift_line(rev_line) + };}; + if ($truthy(rev_metadata['$empty?']())) { + } else { + + if ($truthy(document)) { + $send(rev_metadata, 'each', [], (TMP_45 = function(key, val){var self = TMP_45.$$s || this; + + + + if (key == null) { + key = nil; + }; + + if (val == null) { + val = nil; + }; + if ($truthy(doc_attrs['$key?'](key))) { + return nil + } else { + + $writer = [key, document.$apply_header_subs(val)]; + $send(doc_attrs, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + };}, TMP_45.$$s = self, TMP_45.$$arity = 2, TMP_45))}; + metadata.$update(rev_metadata); + }; + self.$process_attribute_entries(reader, document); + reader.$skip_blank_lines(); + } else { + author_metadata = $hash2([], {}) + }; + if ($truthy(document)) { + + if ($truthy(($truthy($a = doc_attrs['$key?']("author")) ? (author_line = doc_attrs['$[]']("author"))['$!='](implicit_author) : $a))) { + + author_metadata = self.$process_authors(author_line, true, false); + if ($truthy(doc_attrs['$[]']("authorinitials")['$!='](implicit_authorinitials))) { + author_metadata.$delete("authorinitials")}; + } else if ($truthy(($truthy($a = doc_attrs['$key?']("authors")) ? (author_line = doc_attrs['$[]']("authors"))['$!='](implicit_authors) : $a))) { + author_metadata = self.$process_authors(author_line, true) + } else { + + $a = [[], 1, "author_1", false, false], (authors = $a[0]), (author_idx = $a[1]), (author_key = $a[2]), (explicit = $a[3]), (sparse = $a[4]), $a; + while ($truthy(doc_attrs['$key?'](author_key))) { + + if ((author_override = doc_attrs['$[]'](author_key))['$=='](author_metadata['$[]'](author_key))) { + + authors['$<<'](nil); + sparse = true; + } else { + + authors['$<<'](author_override); + explicit = true; + }; + author_key = "" + "author_" + ((author_idx = $rb_plus(author_idx, 1))); + }; + if ($truthy(explicit)) { + + if ($truthy(sparse)) { + $send(authors, 'each_with_index', [], (TMP_46 = function(author, idx){var self = TMP_46.$$s || this, TMP_47, name_idx = nil; + + + + if (author == null) { + author = nil; + }; + + if (idx == null) { + idx = nil; + }; + if ($truthy(author)) { + return nil + } else { + + $writer = [idx, $send([author_metadata['$[]']("" + "firstname_" + ((name_idx = $rb_plus(idx, 1)))), author_metadata['$[]']("" + "middlename_" + (name_idx)), author_metadata['$[]']("" + "lastname_" + (name_idx))].$compact(), 'map', [], (TMP_47 = function(it){var self = TMP_47.$$s || this; + + + + if (it == null) { + it = nil; + }; + return it.$tr(" ", "_");}, TMP_47.$$s = self, TMP_47.$$arity = 1, TMP_47)).$join(" ")]; + $send(authors, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + };}, TMP_46.$$s = self, TMP_46.$$arity = 2, TMP_46))}; + author_metadata = self.$process_authors(authors, true, false); + } else { + author_metadata = $hash2([], {}) + }; + }; + if ($truthy(author_metadata['$empty?']())) { + ($truthy($a = metadata['$[]']("authorcount")) ? $a : (($writer = ["authorcount", (($writer = ["authorcount", 0]), $send(doc_attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])]), $send(metadata, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])) + } else { + + doc_attrs.$update(author_metadata); + if ($truthy(($truthy($a = doc_attrs['$key?']("email")['$!']()) ? doc_attrs['$key?']("email_1") : $a))) { + + $writer = ["email", doc_attrs['$[]']("email_1")]; + $send(doc_attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + };}; + return metadata; + }, TMP_Parser_parse_header_metadata_43.$$arity = -2); + Opal.defs(self, '$process_authors', TMP_Parser_process_authors_48 = function $$process_authors(author_line, names_only, multiple) { + var TMP_49, TMP_50, self = this, author_metadata = nil, author_idx = nil, keys = nil, author_entries = nil, $writer = nil; + + + + if (names_only == null) { + names_only = false; + }; + + if (multiple == null) { + multiple = true; + }; + author_metadata = $hash2([], {}); + author_idx = 0; + keys = ["author", "authorinitials", "firstname", "middlename", "lastname", "email"]; + author_entries = (function() {if ($truthy(multiple)) { + return $send(author_line.$split(";"), 'map', [], (TMP_49 = function(it){var self = TMP_49.$$s || this; + + + + if (it == null) { + it = nil; + }; + return it.$strip();}, TMP_49.$$s = self, TMP_49.$$arity = 1, TMP_49)) + } else { + return self.$Array(author_line) + }; return nil; })(); + $send(author_entries, 'each', [], (TMP_50 = function(author_entry){var self = TMP_50.$$s || this, TMP_51, TMP_52, $a, TMP_53, key_map = nil, $writer = nil, segments = nil, match = nil, author = nil, fname = nil, mname = nil, lname = nil; + + + + if (author_entry == null) { + author_entry = nil; + }; + if ($truthy(author_entry['$empty?']())) { + return nil;}; + author_idx = $rb_plus(author_idx, 1); + key_map = $hash2([], {}); + if (author_idx['$=='](1)) { + $send(keys, 'each', [], (TMP_51 = function(key){var self = TMP_51.$$s || this, $writer = nil; + + + + if (key == null) { + key = nil; + }; + $writer = [key.$to_sym(), key]; + $send(key_map, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];}, TMP_51.$$s = self, TMP_51.$$arity = 1, TMP_51)) + } else { + $send(keys, 'each', [], (TMP_52 = function(key){var self = TMP_52.$$s || this, $writer = nil; + + + + if (key == null) { + key = nil; + }; + $writer = [key.$to_sym(), "" + (key) + "_" + (author_idx)]; + $send(key_map, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];}, TMP_52.$$s = self, TMP_52.$$arity = 1, TMP_52)) + }; + if ($truthy(names_only)) { + + if ($truthy(author_entry['$include?']("<"))) { + + + $writer = [key_map['$[]']("author"), author_entry.$tr("_", " ")]; + $send(author_metadata, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + author_entry = author_entry.$gsub($$($nesting, 'XmlSanitizeRx'), "");}; + if ((segments = author_entry.$split(nil, 3)).$size()['$=='](3)) { + segments['$<<'](segments.$pop().$squeeze(" "))}; + } else if ($truthy((match = $$($nesting, 'AuthorInfoLineRx').$match(author_entry)))) { + (segments = match.$to_a()).$shift()}; + if ($truthy(segments)) { + + author = (($writer = [key_map['$[]']("firstname"), (fname = segments['$[]'](0).$tr("_", " "))]), $send(author_metadata, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]); + + $writer = [key_map['$[]']("authorinitials"), fname.$chr()]; + $send(author_metadata, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + if ($truthy(segments['$[]'](1))) { + if ($truthy(segments['$[]'](2))) { + + + $writer = [key_map['$[]']("middlename"), (mname = segments['$[]'](1).$tr("_", " "))]; + $send(author_metadata, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = [key_map['$[]']("lastname"), (lname = segments['$[]'](2).$tr("_", " "))]; + $send(author_metadata, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + author = $rb_plus($rb_plus($rb_plus($rb_plus(fname, " "), mname), " "), lname); + + $writer = [key_map['$[]']("authorinitials"), "" + (fname.$chr()) + (mname.$chr()) + (lname.$chr())]; + $send(author_metadata, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + } else { + + + $writer = [key_map['$[]']("lastname"), (lname = segments['$[]'](1).$tr("_", " "))]; + $send(author_metadata, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + author = $rb_plus($rb_plus(fname, " "), lname); + + $writer = [key_map['$[]']("authorinitials"), "" + (fname.$chr()) + (lname.$chr())]; + $send(author_metadata, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + }}; + ($truthy($a = author_metadata['$[]'](key_map['$[]']("author"))) ? $a : (($writer = [key_map['$[]']("author"), author]), $send(author_metadata, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + if ($truthy(($truthy($a = names_only) ? $a : segments['$[]'](3)['$!']()))) { + } else { + + $writer = [key_map['$[]']("email"), segments['$[]'](3)]; + $send(author_metadata, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + } else { + + + $writer = [key_map['$[]']("author"), (($writer = [key_map['$[]']("firstname"), (fname = author_entry.$squeeze(" ").$strip())]), $send(author_metadata, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])]; + $send(author_metadata, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = [key_map['$[]']("authorinitials"), fname.$chr()]; + $send(author_metadata, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + }; + if (author_idx['$=='](1)) { + + $writer = ["authors", author_metadata['$[]'](key_map['$[]']("author"))]; + $send(author_metadata, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + } else { + + if (author_idx['$=='](2)) { + $send(keys, 'each', [], (TMP_53 = function(key){var self = TMP_53.$$s || this; + + + + if (key == null) { + key = nil; + }; + if ($truthy(author_metadata['$key?'](key))) { + + $writer = ["" + (key) + "_1", author_metadata['$[]'](key)]; + $send(author_metadata, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + } else { + return nil + };}, TMP_53.$$s = self, TMP_53.$$arity = 1, TMP_53))}; + + $writer = ["authors", "" + (author_metadata['$[]']("authors")) + ", " + (author_metadata['$[]'](key_map['$[]']("author")))]; + $send(author_metadata, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];; + };}, TMP_50.$$s = self, TMP_50.$$arity = 1, TMP_50)); + + $writer = ["authorcount", author_idx]; + $send(author_metadata, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + return author_metadata; + }, TMP_Parser_process_authors_48.$$arity = -2); + Opal.defs(self, '$parse_block_metadata_lines', TMP_Parser_parse_block_metadata_lines_54 = function $$parse_block_metadata_lines(reader, document, attributes, options) { + var $a, $b, self = this; + + + + if (attributes == null) { + attributes = $hash2([], {}); + }; + + if (options == null) { + options = $hash2([], {}); + }; + while ($truthy(self.$parse_block_metadata_line(reader, document, attributes, options))) { + + reader.$shift(); + if ($truthy($b = reader.$skip_blank_lines())) { + $b + } else { + break; + }; + }; + return attributes; + }, TMP_Parser_parse_block_metadata_lines_54.$$arity = -3); + Opal.defs(self, '$parse_block_metadata_line', TMP_Parser_parse_block_metadata_line_55 = function $$parse_block_metadata_line(reader, document, attributes, options) { + var $a, $b, self = this, next_line = nil, normal = nil, $writer = nil, reftext = nil, current_style = nil, ll = nil; + if ($gvars["~"] == null) $gvars["~"] = nil; + + + + if (options == null) { + options = $hash2([], {}); + }; + if ($truthy(($truthy($a = (next_line = reader.$peek_line())) ? (function() {if ($truthy(options['$[]']("text"))) { + + return next_line['$start_with?']("[", "/"); + } else { + + return (normal = next_line['$start_with?']("[", ".", "/", ":")); + }; return nil; })() : $a))) { + if ($truthy(next_line['$start_with?']("["))) { + if ($truthy(next_line['$start_with?']("[["))) { + if ($truthy(($truthy($a = next_line['$end_with?']("]]")) ? $$($nesting, 'BlockAnchorRx')['$=~'](next_line) : $a))) { + + + $writer = ["id", (($a = $gvars['~']) === nil ? nil : $a['$[]'](1))]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + if ($truthy((reftext = (($a = $gvars['~']) === nil ? nil : $a['$[]'](2))))) { + + $writer = ["reftext", (function() {if ($truthy(reftext['$include?']($$($nesting, 'ATTR_REF_HEAD')))) { + + return document.$sub_attributes(reftext); + } else { + return reftext + }; return nil; })()]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + return true; + } else { + return nil + } + } else if ($truthy(($truthy($a = next_line['$end_with?']("]")) ? $$($nesting, 'BlockAttributeListRx')['$=~'](next_line) : $a))) { + + current_style = attributes['$[]'](1); + if ($truthy(document.$parse_attributes((($a = $gvars['~']) === nil ? nil : $a['$[]'](1)), [], $hash2(["sub_input", "sub_result", "into"], {"sub_input": true, "sub_result": true, "into": attributes}))['$[]'](1))) { + + $writer = [1, ($truthy($a = self.$parse_style_attribute(attributes, reader)) ? $a : current_style)]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + return true; + } else { + return nil + } + } else if ($truthy(($truthy($a = normal) ? next_line['$start_with?'](".") : $a))) { + if ($truthy($$($nesting, 'BlockTitleRx')['$=~'](next_line))) { + + + $writer = ["title", (($a = $gvars['~']) === nil ? nil : $a['$[]'](1))]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + return true; + } else { + return nil + } + } else if ($truthy(($truthy($a = normal['$!']()) ? $a : next_line['$start_with?']("/")))) { + if ($truthy(next_line['$start_with?']("//"))) { + if (next_line['$==']("//")) { + return true + } else if ($truthy(($truthy($a = normal) ? $rb_times("/", (ll = next_line.$length()))['$=='](next_line) : $a))) { + if (ll['$=='](3)) { + return nil + } else { + + reader.$read_lines_until($hash2(["terminator", "skip_first_line", "preserve_last_line", "skip_processing", "context"], {"terminator": next_line, "skip_first_line": true, "preserve_last_line": true, "skip_processing": true, "context": "comment"})); + return true; + } + } else if ($truthy(next_line['$start_with?']("///"))) { + return nil + } else { + return true + } + } else { + return nil + } + } else if ($truthy(($truthy($a = ($truthy($b = normal) ? next_line['$start_with?'](":") : $b)) ? $$($nesting, 'AttributeEntryRx')['$=~'](next_line) : $a))) { + + self.$process_attribute_entry(reader, document, attributes, $gvars["~"]); + return true; + } else { + return nil + } + } else { + return nil + }; + }, TMP_Parser_parse_block_metadata_line_55.$$arity = -4); + Opal.defs(self, '$process_attribute_entries', TMP_Parser_process_attribute_entries_56 = function $$process_attribute_entries(reader, document, attributes) { + var $a, self = this; + + + + if (attributes == null) { + attributes = nil; + }; + reader.$skip_comment_lines(); + while ($truthy(self.$process_attribute_entry(reader, document, attributes))) { + + reader.$shift(); + reader.$skip_comment_lines(); + }; + }, TMP_Parser_process_attribute_entries_56.$$arity = -3); + Opal.defs(self, '$process_attribute_entry', TMP_Parser_process_attribute_entry_57 = function $$process_attribute_entry(reader, document, attributes, match) { + var $a, $b, $c, self = this, value = nil, con = nil, next_line = nil, keep_open = nil; + + + + if (attributes == null) { + attributes = nil; + }; + + if (match == null) { + match = nil; + }; + if ($truthy((match = ($truthy($a = match) ? $a : (function() {if ($truthy(reader['$has_more_lines?']())) { + + return $$($nesting, 'AttributeEntryRx').$match(reader.$peek_line()); + } else { + return nil + }; return nil; })())))) { + + if ($truthy((value = match['$[]'](2))['$nil_or_empty?']())) { + value = "" + } else if ($truthy(value['$end_with?']($$($nesting, 'LINE_CONTINUATION'), $$($nesting, 'LINE_CONTINUATION_LEGACY')))) { + + $a = [value.$slice(-2, 2), value.$slice(0, $rb_minus(value.$length(), 2)).$rstrip()], (con = $a[0]), (value = $a[1]), $a; + while ($truthy(($truthy($b = reader.$advance()) ? (next_line = ($truthy($c = reader.$peek_line()) ? $c : ""))['$empty?']()['$!']() : $b))) { + + next_line = next_line.$lstrip(); + if ($truthy((keep_open = next_line['$end_with?'](con)))) { + next_line = next_line.$slice(0, $rb_minus(next_line.$length(), 2)).$rstrip()}; + value = "" + (value) + ((function() {if ($truthy(value['$end_with?']($$($nesting, 'HARD_LINE_BREAK')))) { + return $$($nesting, 'LF') + } else { + return " " + }; return nil; })()) + (next_line); + if ($truthy(keep_open)) { + } else { + break; + }; + };}; + self.$store_attribute(match['$[]'](1), value, document, attributes); + return true; + } else { + return nil + }; + }, TMP_Parser_process_attribute_entry_57.$$arity = -3); + Opal.defs(self, '$store_attribute', TMP_Parser_store_attribute_58 = function $$store_attribute(name, value, doc, attrs) { + var $a, self = this, resolved_value = nil; + + + + if (doc == null) { + doc = nil; + }; + + if (attrs == null) { + attrs = nil; + }; + if ($truthy(name['$end_with?']("!"))) { + $a = [name.$chop(), nil], (name = $a[0]), (value = $a[1]), $a + } else if ($truthy(name['$start_with?']("!"))) { + $a = [name.$slice(1, name.$length()), nil], (name = $a[0]), (value = $a[1]), $a}; + name = self.$sanitize_attribute_name(name); + if (name['$==']("numbered")) { + name = "sectnums"}; + if ($truthy(doc)) { + if ($truthy(value)) { + + if (name['$==']("leveloffset")) { + if ($truthy(value['$start_with?']("+"))) { + value = $rb_plus(doc.$attr("leveloffset", 0).$to_i(), value.$slice(1, value.$length()).$to_i()).$to_s() + } else if ($truthy(value['$start_with?']("-"))) { + value = $rb_minus(doc.$attr("leveloffset", 0).$to_i(), value.$slice(1, value.$length()).$to_i()).$to_s()}}; + if ($truthy((resolved_value = doc.$set_attribute(name, value)))) { + + value = resolved_value; + if ($truthy(attrs)) { + $$$($$($nesting, 'Document'), 'AttributeEntry').$new(name, value).$save_to(attrs)};}; + } else if ($truthy(($truthy($a = doc.$delete_attribute(name)) ? attrs : $a))) { + $$$($$($nesting, 'Document'), 'AttributeEntry').$new(name, value).$save_to(attrs)} + } else if ($truthy(attrs)) { + $$$($$($nesting, 'Document'), 'AttributeEntry').$new(name, value).$save_to(attrs)}; + return [name, value]; + }, TMP_Parser_store_attribute_58.$$arity = -3); + Opal.defs(self, '$resolve_list_marker', TMP_Parser_resolve_list_marker_59 = function $$resolve_list_marker(list_type, marker, ordinal, validate, reader) { + var self = this; + + + + if (ordinal == null) { + ordinal = 0; + }; + + if (validate == null) { + validate = false; + }; + + if (reader == null) { + reader = nil; + }; + if (list_type['$==']("ulist")) { + return marker + } else if (list_type['$==']("olist")) { + return self.$resolve_ordered_list_marker(marker, ordinal, validate, reader)['$[]'](0) + } else { + return "<1>" + }; + }, TMP_Parser_resolve_list_marker_59.$$arity = -3); + Opal.defs(self, '$resolve_ordered_list_marker', TMP_Parser_resolve_ordered_list_marker_60 = function $$resolve_ordered_list_marker(marker, ordinal, validate, reader) { + var TMP_61, $a, self = this, $case = nil, style = nil, expected = nil, actual = nil; + + + + if (ordinal == null) { + ordinal = 0; + }; + + if (validate == null) { + validate = false; + }; + + if (reader == null) { + reader = nil; + }; + if ($truthy(marker['$start_with?']("."))) { + return [marker]}; + $case = (style = $send($$($nesting, 'ORDERED_LIST_STYLES'), 'find', [], (TMP_61 = function(s){var self = TMP_61.$$s || this; + + + + if (s == null) { + s = nil; + }; + return $$($nesting, 'OrderedListMarkerRxMap')['$[]'](s)['$match?'](marker);}, TMP_61.$$s = self, TMP_61.$$arity = 1, TMP_61))); + if ("arabic"['$===']($case)) { + if ($truthy(validate)) { + + expected = $rb_plus(ordinal, 1); + actual = marker.$to_i();}; + marker = "1.";} + else if ("loweralpha"['$===']($case)) { + if ($truthy(validate)) { + + expected = $rb_plus("a"['$[]'](0).$ord(), ordinal).$chr(); + actual = marker.$chop();}; + marker = "a.";} + else if ("upperalpha"['$===']($case)) { + if ($truthy(validate)) { + + expected = $rb_plus("A"['$[]'](0).$ord(), ordinal).$chr(); + actual = marker.$chop();}; + marker = "A.";} + else if ("lowerroman"['$===']($case)) { + if ($truthy(validate)) { + + expected = $$($nesting, 'Helpers').$int_to_roman($rb_plus(ordinal, 1)).$downcase(); + actual = marker.$chop();}; + marker = "i)";} + else if ("upperroman"['$===']($case)) { + if ($truthy(validate)) { + + expected = $$($nesting, 'Helpers').$int_to_roman($rb_plus(ordinal, 1)); + actual = marker.$chop();}; + marker = "I)";}; + if ($truthy(($truthy($a = validate) ? expected['$!='](actual) : $a))) { + self.$logger().$warn(self.$message_with_context("" + "list item index: expected " + (expected) + ", got " + (actual), $hash2(["source_location"], {"source_location": reader.$cursor()})))}; + return [marker, style]; + }, TMP_Parser_resolve_ordered_list_marker_60.$$arity = -2); + Opal.defs(self, '$is_sibling_list_item?', TMP_Parser_is_sibling_list_item$q_62 = function(line, list_type, sibling_trait) { + var $a, self = this, matcher = nil, expected_marker = nil; + + + if ($truthy($$$('::', 'Regexp')['$==='](sibling_trait))) { + matcher = sibling_trait + } else { + + matcher = $$($nesting, 'ListRxMap')['$[]'](list_type); + expected_marker = sibling_trait; + }; + if ($truthy(matcher['$=~'](line))) { + if ($truthy(expected_marker)) { + return expected_marker['$=='](self.$resolve_list_marker(list_type, (($a = $gvars['~']) === nil ? nil : $a['$[]'](1)))) + } else { + return true + } + } else { + return false + }; + }, TMP_Parser_is_sibling_list_item$q_62.$$arity = 3); + Opal.defs(self, '$parse_table', TMP_Parser_parse_table_63 = function $$parse_table(table_reader, parent, attributes) { + var $a, $b, $c, $d, self = this, table = nil, $writer = nil, colspecs = nil, explicit_colspecs = nil, skipped = nil, parser_ctx = nil, format = nil, loop_idx = nil, implicit_header_boundary = nil, implicit_header = nil, line = nil, beyond_first = nil, next_cellspec = nil, m = nil, pre_match = nil, post_match = nil, $case = nil, cell_text = nil, $logical_op_recvr_tmp_2 = nil; + + + table = $$($nesting, 'Table').$new(parent, attributes); + if ($truthy(attributes['$key?']("title"))) { + + + $writer = [attributes.$delete("title")]; + $send(table, 'title=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + table.$assign_caption(attributes.$delete("caption"));}; + if ($truthy(($truthy($a = attributes['$key?']("cols")) ? (colspecs = self.$parse_colspecs(attributes['$[]']("cols")))['$empty?']()['$!']() : $a))) { + + table.$create_columns(colspecs); + explicit_colspecs = true;}; + skipped = ($truthy($a = table_reader.$skip_blank_lines()) ? $a : 0); + parser_ctx = $$$($$($nesting, 'Table'), 'ParserContext').$new(table_reader, table, attributes); + $a = [parser_ctx.$format(), -1, nil], (format = $a[0]), (loop_idx = $a[1]), (implicit_header_boundary = $a[2]), $a; + if ($truthy(($truthy($a = ($truthy($b = $rb_gt(skipped, 0)) ? $b : attributes['$key?']("header-option"))) ? $a : attributes['$key?']("noheader-option")))) { + } else { + implicit_header = true + }; + $a = false; while ($a || $truthy((line = table_reader.$read_line()))) {$a = false; + + if ($truthy(($truthy($b = (beyond_first = $rb_gt((loop_idx = $rb_plus(loop_idx, 1)), 0))) ? line['$empty?']() : $b))) { + + line = nil; + if ($truthy(implicit_header_boundary)) { + implicit_header_boundary = $rb_plus(implicit_header_boundary, 1)}; + } else if (format['$==']("psv")) { + if ($truthy(parser_ctx['$starts_with_delimiter?'](line))) { + + line = line.$slice(1, line.$length()); + parser_ctx.$close_open_cell(); + if ($truthy(implicit_header_boundary)) { + implicit_header_boundary = nil}; + } else { + + $c = self.$parse_cellspec(line, "start", parser_ctx.$delimiter()), $b = Opal.to_ary($c), (next_cellspec = ($b[0] == null ? nil : $b[0])), (line = ($b[1] == null ? nil : $b[1])), $c; + if ($truthy(next_cellspec)) { + + parser_ctx.$close_open_cell(next_cellspec); + if ($truthy(implicit_header_boundary)) { + implicit_header_boundary = nil}; + } else if ($truthy(($truthy($b = implicit_header_boundary) ? implicit_header_boundary['$=='](loop_idx) : $b))) { + $b = [false, nil], (implicit_header = $b[0]), (implicit_header_boundary = $b[1]), $b}; + }}; + if ($truthy(beyond_first)) { + } else { + + table_reader.$mark(); + if ($truthy(implicit_header)) { + if ($truthy(($truthy($b = table_reader['$has_more_lines?']()) ? table_reader.$peek_line()['$empty?']() : $b))) { + implicit_header_boundary = 1 + } else { + implicit_header = false + }}; + }; + $b = false; while ($b || $truthy(true)) {$b = false; + if ($truthy(($truthy($c = line) ? (m = parser_ctx.$match_delimiter(line)) : $c))) { + + $c = [m.$pre_match(), m.$post_match()], (pre_match = $c[0]), (post_match = $c[1]), $c; + $case = format; + if ("csv"['$===']($case)) { + if ($truthy(parser_ctx['$buffer_has_unclosed_quotes?'](pre_match))) { + + parser_ctx.$skip_past_delimiter(pre_match); + if ($truthy((line = post_match)['$empty?']())) { + break;}; + $b = true; continue;;}; + + $writer = ["" + (parser_ctx.$buffer()) + (pre_match)]; + $send(parser_ctx, 'buffer=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];;} + else if ("dsv"['$===']($case)) { + if ($truthy(pre_match['$end_with?']("\\"))) { + + parser_ctx.$skip_past_escaped_delimiter(pre_match); + if ($truthy((line = post_match)['$empty?']())) { + + + $writer = ["" + (parser_ctx.$buffer()) + ($$($nesting, 'LF'))]; + $send(parser_ctx, 'buffer=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + parser_ctx.$keep_cell_open(); + break;;}; + $b = true; continue;;}; + + $writer = ["" + (parser_ctx.$buffer()) + (pre_match)]; + $send(parser_ctx, 'buffer=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];;} + else { + if ($truthy(pre_match['$end_with?']("\\"))) { + + parser_ctx.$skip_past_escaped_delimiter(pre_match); + if ($truthy((line = post_match)['$empty?']())) { + + + $writer = ["" + (parser_ctx.$buffer()) + ($$($nesting, 'LF'))]; + $send(parser_ctx, 'buffer=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + parser_ctx.$keep_cell_open(); + break;;}; + $b = true; continue;;}; + $d = self.$parse_cellspec(pre_match), $c = Opal.to_ary($d), (next_cellspec = ($c[0] == null ? nil : $c[0])), (cell_text = ($c[1] == null ? nil : $c[1])), $d; + parser_ctx.$push_cellspec(next_cellspec); + + $writer = ["" + (parser_ctx.$buffer()) + (cell_text)]; + $send(parser_ctx, 'buffer=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];;}; + if ($truthy((line = post_match)['$empty?']())) { + line = nil}; + parser_ctx.$close_cell(); + } else { + + + $writer = ["" + (parser_ctx.$buffer()) + (line) + ($$($nesting, 'LF'))]; + $send(parser_ctx, 'buffer=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + $case = format; + if ("csv"['$===']($case)) {if ($truthy(parser_ctx['$buffer_has_unclosed_quotes?']())) { + + if ($truthy(($truthy($c = implicit_header_boundary) ? loop_idx['$=='](0) : $c))) { + $c = [false, nil], (implicit_header = $c[0]), (implicit_header_boundary = $c[1]), $c}; + parser_ctx.$keep_cell_open(); + } else { + parser_ctx.$close_cell(true) + }} + else if ("dsv"['$===']($case)) {parser_ctx.$close_cell(true)} + else {parser_ctx.$keep_cell_open()}; + break;; + } + }; + if ($truthy(parser_ctx['$cell_open?']())) { + if ($truthy(table_reader['$has_more_lines?']())) { + } else { + parser_ctx.$close_cell(true) + } + } else { + if ($truthy($b = table_reader.$skip_blank_lines())) { + $b + } else { + break; + } + }; + }; + if ($truthy(($truthy($a = (($logical_op_recvr_tmp_2 = table.$attributes()), ($truthy($b = $logical_op_recvr_tmp_2['$[]']("colcount")) ? $b : (($writer = ["colcount", table.$columns().$size()]), $send($logical_op_recvr_tmp_2, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])))['$=='](0)) ? $a : explicit_colspecs))) { + } else { + table.$assign_column_widths() + }; + if ($truthy(implicit_header)) { + + + $writer = [true]; + $send(table, 'has_header_option=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["header-option", ""]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["options", (function() {if ($truthy(attributes['$key?']("options"))) { + return "" + (attributes['$[]']("options")) + ",header" + } else { + return "header" + }; return nil; })()]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];;}; + table.$partition_header_footer(attributes); + return table; + }, TMP_Parser_parse_table_63.$$arity = 3); + Opal.defs(self, '$parse_colspecs', TMP_Parser_parse_colspecs_64 = function $$parse_colspecs(records) { + var TMP_65, TMP_66, self = this, specs = nil; + + + if ($truthy(records['$include?'](" "))) { + records = records.$delete(" ")}; + if (records['$=='](records.$to_i().$to_s())) { + return $send($$$('::', 'Array'), 'new', [records.$to_i()], (TMP_65 = function(){var self = TMP_65.$$s || this; + + return $hash2(["width"], {"width": 1})}, TMP_65.$$s = self, TMP_65.$$arity = 0, TMP_65))}; + specs = []; + $send((function() {if ($truthy(records['$include?'](","))) { + + return records.$split(",", -1); + } else { + + return records.$split(";", -1); + }; return nil; })(), 'each', [], (TMP_66 = function(record){var self = TMP_66.$$s || this, $a, $b, TMP_67, m = nil, spec = nil, colspec = nil, rowspec = nil, $writer = nil, width = nil; + + + + if (record == null) { + record = nil; + }; + if ($truthy(record['$empty?']())) { + return specs['$<<']($hash2(["width"], {"width": 1})) + } else if ($truthy((m = $$($nesting, 'ColumnSpecRx').$match(record)))) { + + spec = $hash2([], {}); + if ($truthy(m['$[]'](2))) { + + $b = m['$[]'](2).$split("."), $a = Opal.to_ary($b), (colspec = ($a[0] == null ? nil : $a[0])), (rowspec = ($a[1] == null ? nil : $a[1])), $b; + if ($truthy(($truthy($a = colspec['$nil_or_empty?']()['$!']()) ? $$($nesting, 'TableCellHorzAlignments')['$key?'](colspec) : $a))) { + + $writer = ["halign", $$($nesting, 'TableCellHorzAlignments')['$[]'](colspec)]; + $send(spec, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if ($truthy(($truthy($a = rowspec['$nil_or_empty?']()['$!']()) ? $$($nesting, 'TableCellVertAlignments')['$key?'](rowspec) : $a))) { + + $writer = ["valign", $$($nesting, 'TableCellVertAlignments')['$[]'](rowspec)]; + $send(spec, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];};}; + if ($truthy((width = m['$[]'](3)))) { + + $writer = ["width", (function() {if (width['$==']("~")) { + return -1 + } else { + return width.$to_i() + }; return nil; })()]; + $send(spec, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + } else { + + $writer = ["width", 1]; + $send(spec, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + if ($truthy(($truthy($a = m['$[]'](4)) ? $$($nesting, 'TableCellStyles')['$key?'](m['$[]'](4)) : $a))) { + + $writer = ["style", $$($nesting, 'TableCellStyles')['$[]'](m['$[]'](4))]; + $send(spec, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if ($truthy(m['$[]'](1))) { + return $send((1), 'upto', [m['$[]'](1).$to_i()], (TMP_67 = function(){var self = TMP_67.$$s || this; + + return specs['$<<'](spec.$dup())}, TMP_67.$$s = self, TMP_67.$$arity = 0, TMP_67)) + } else { + return specs['$<<'](spec) + }; + } else { + return nil + };}, TMP_66.$$s = self, TMP_66.$$arity = 1, TMP_66)); + return specs; + }, TMP_Parser_parse_colspecs_64.$$arity = 1); + Opal.defs(self, '$parse_cellspec', TMP_Parser_parse_cellspec_68 = function $$parse_cellspec(line, pos, delimiter) { + var $a, $b, self = this, m = nil, rest = nil, spec_part = nil, spec = nil, colspec = nil, rowspec = nil, $writer = nil; + + + + if (pos == null) { + pos = "end"; + }; + + if (delimiter == null) { + delimiter = nil; + }; + $a = [nil, ""], (m = $a[0]), (rest = $a[1]), $a; + if (pos['$==']("start")) { + if ($truthy(line['$include?'](delimiter))) { + + $b = line.$split(delimiter, 2), $a = Opal.to_ary($b), (spec_part = ($a[0] == null ? nil : $a[0])), (rest = ($a[1] == null ? nil : $a[1])), $b; + if ($truthy((m = $$($nesting, 'CellSpecStartRx').$match(spec_part)))) { + if ($truthy(m['$[]'](0)['$empty?']())) { + return [$hash2([], {}), rest]} + } else { + return [nil, line] + }; + } else { + return [nil, line] + } + } else if ($truthy((m = $$($nesting, 'CellSpecEndRx').$match(line)))) { + + if ($truthy(m['$[]'](0).$lstrip()['$empty?']())) { + return [$hash2([], {}), line.$rstrip()]}; + rest = m.$pre_match(); + } else { + return [$hash2([], {}), line] + }; + spec = $hash2([], {}); + if ($truthy(m['$[]'](1))) { + + $b = m['$[]'](1).$split("."), $a = Opal.to_ary($b), (colspec = ($a[0] == null ? nil : $a[0])), (rowspec = ($a[1] == null ? nil : $a[1])), $b; + colspec = (function() {if ($truthy(colspec['$nil_or_empty?']())) { + return 1 + } else { + return colspec.$to_i() + }; return nil; })(); + rowspec = (function() {if ($truthy(rowspec['$nil_or_empty?']())) { + return 1 + } else { + return rowspec.$to_i() + }; return nil; })(); + if (m['$[]'](2)['$==']("+")) { + + if (colspec['$=='](1)) { + } else { + + $writer = ["colspan", colspec]; + $send(spec, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + if (rowspec['$=='](1)) { + } else { + + $writer = ["rowspan", rowspec]; + $send(spec, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + } else if (m['$[]'](2)['$==']("*")) { + if (colspec['$=='](1)) { + } else { + + $writer = ["repeatcol", colspec]; + $send(spec, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }};}; + if ($truthy(m['$[]'](3))) { + + $b = m['$[]'](3).$split("."), $a = Opal.to_ary($b), (colspec = ($a[0] == null ? nil : $a[0])), (rowspec = ($a[1] == null ? nil : $a[1])), $b; + if ($truthy(($truthy($a = colspec['$nil_or_empty?']()['$!']()) ? $$($nesting, 'TableCellHorzAlignments')['$key?'](colspec) : $a))) { + + $writer = ["halign", $$($nesting, 'TableCellHorzAlignments')['$[]'](colspec)]; + $send(spec, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if ($truthy(($truthy($a = rowspec['$nil_or_empty?']()['$!']()) ? $$($nesting, 'TableCellVertAlignments')['$key?'](rowspec) : $a))) { + + $writer = ["valign", $$($nesting, 'TableCellVertAlignments')['$[]'](rowspec)]; + $send(spec, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];};}; + if ($truthy(($truthy($a = m['$[]'](4)) ? $$($nesting, 'TableCellStyles')['$key?'](m['$[]'](4)) : $a))) { + + $writer = ["style", $$($nesting, 'TableCellStyles')['$[]'](m['$[]'](4))]; + $send(spec, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + return [spec, rest]; + }, TMP_Parser_parse_cellspec_68.$$arity = -2); + Opal.defs(self, '$parse_style_attribute', TMP_Parser_parse_style_attribute_69 = function $$parse_style_attribute(attributes, reader) { + var $a, $b, TMP_70, TMP_71, TMP_72, self = this, raw_style = nil, type = nil, collector = nil, parsed = nil, save_current = nil, $writer = nil, parsed_style = nil, existing_role = nil, opts = nil, existing_opts = nil; + + + + if (reader == null) { + reader = nil; + }; + if ($truthy(($truthy($a = ($truthy($b = (raw_style = attributes['$[]'](1))) ? raw_style['$include?'](" ")['$!']() : $b)) ? $$($nesting, 'Compliance').$shorthand_property_syntax() : $a))) { + + $a = ["style", [], $hash2([], {})], (type = $a[0]), (collector = $a[1]), (parsed = $a[2]), $a; + save_current = $send(self, 'lambda', [], (TMP_70 = function(){var self = TMP_70.$$s || this, $c, $case = nil, $writer = nil; + + if ($truthy(collector['$empty?']())) { + if (type['$==']("style")) { + return nil + } else if ($truthy(reader)) { + return self.$logger().$warn(self.$message_with_context("" + "invalid empty " + (type) + " detected in style attribute", $hash2(["source_location"], {"source_location": reader.$cursor_at_prev_line()}))) + } else { + return self.$logger().$warn("" + "invalid empty " + (type) + " detected in style attribute") + } + } else { + + $case = type; + if ("role"['$===']($case) || "option"['$===']($case)) {($truthy($c = parsed['$[]'](type)) ? $c : (($writer = [type, []]), $send(parsed, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]))['$<<'](collector.$join())} + else if ("id"['$===']($case)) { + if ($truthy(parsed['$key?']("id"))) { + if ($truthy(reader)) { + self.$logger().$warn(self.$message_with_context("multiple ids detected in style attribute", $hash2(["source_location"], {"source_location": reader.$cursor_at_prev_line()}))) + } else { + self.$logger().$warn("multiple ids detected in style attribute") + }}; + + $writer = [type, collector.$join()]; + $send(parsed, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];;} + else { + $writer = [type, collector.$join()]; + $send(parsed, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + return (collector = []); + }}, TMP_70.$$s = self, TMP_70.$$arity = 0, TMP_70)); + $send(raw_style, 'each_char', [], (TMP_71 = function(c){var self = TMP_71.$$s || this, $c, $d, $case = nil; + + + + if (c == null) { + c = nil; + }; + if ($truthy(($truthy($c = ($truthy($d = c['$=='](".")) ? $d : c['$==']("#"))) ? $c : c['$==']("%")))) { + + save_current.$call(); + return (function() {$case = c; + if ("."['$===']($case)) {return (type = "role")} + else if ("#"['$===']($case)) {return (type = "id")} + else if ("%"['$===']($case)) {return (type = "option")} + else { return nil }})(); + } else { + return collector['$<<'](c) + };}, TMP_71.$$s = self, TMP_71.$$arity = 1, TMP_71)); + if (type['$==']("style")) { + + $writer = ["style", raw_style]; + $send(attributes, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + } else { + + save_current.$call(); + if ($truthy(parsed['$key?']("style"))) { + parsed_style = (($writer = ["style", parsed['$[]']("style")]), $send(attributes, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])}; + if ($truthy(parsed['$key?']("id"))) { + + $writer = ["id", parsed['$[]']("id")]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if ($truthy(parsed['$key?']("role"))) { + + $writer = ["role", (function() {if ($truthy((existing_role = attributes['$[]']("role"))['$nil_or_empty?']())) { + + return parsed['$[]']("role").$join(" "); + } else { + return "" + (existing_role) + " " + (parsed['$[]']("role").$join(" ")) + }; return nil; })()]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if ($truthy(parsed['$key?']("option"))) { + + $send((opts = parsed['$[]']("option")), 'each', [], (TMP_72 = function(opt){var self = TMP_72.$$s || this; + + + + if (opt == null) { + opt = nil; + }; + $writer = ["" + (opt) + "-option", ""]; + $send(attributes, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];}, TMP_72.$$s = self, TMP_72.$$arity = 1, TMP_72)); + + $writer = ["options", (function() {if ($truthy((existing_opts = attributes['$[]']("options"))['$nil_or_empty?']())) { + + return opts.$join(","); + } else { + return "" + (existing_opts) + "," + (opts.$join(",")) + }; return nil; })()]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];;}; + return parsed_style; + }; + } else { + + $writer = ["style", raw_style]; + $send(attributes, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + }; + }, TMP_Parser_parse_style_attribute_69.$$arity = -2); + Opal.defs(self, '$adjust_indentation!', TMP_Parser_adjust_indentation$B_73 = function(lines, indent, tab_size) { + var $a, TMP_74, TMP_77, TMP_78, TMP_79, TMP_80, self = this, full_tab_space = nil, gutter_width = nil, padding = nil; + + + + if (indent == null) { + indent = 0; + }; + + if (tab_size == null) { + tab_size = 0; + }; + if ($truthy(lines['$empty?']())) { + return nil}; + if ($truthy(($truthy($a = $rb_gt((tab_size = tab_size.$to_i()), 0)) ? lines.$join()['$include?']($$($nesting, 'TAB')) : $a))) { + + full_tab_space = $rb_times(" ", tab_size); + $send(lines, 'map!', [], (TMP_74 = function(line){var self = TMP_74.$$s || this, TMP_75, TMP_76, spaces_added = nil; + + + + if (line == null) { + line = nil; + }; + if ($truthy(line['$empty?']())) { + return line;}; + if ($truthy(line['$start_with?']($$($nesting, 'TAB')))) { + line = $send(line, 'sub', [$$($nesting, 'TabIndentRx')], (TMP_75 = function(){var self = TMP_75.$$s || this, $b; + + return $rb_times(full_tab_space, (($b = $gvars['~']) === nil ? nil : $b['$[]'](0)).$length())}, TMP_75.$$s = self, TMP_75.$$arity = 0, TMP_75))}; + if ($truthy(line['$include?']($$($nesting, 'TAB')))) { + + spaces_added = 0; + return line = $send(line, 'gsub', [$$($nesting, 'TabRx')], (TMP_76 = function(){var self = TMP_76.$$s || this, offset = nil, spaces = nil; + if ($gvars["~"] == null) $gvars["~"] = nil; + + if ((offset = $rb_plus($gvars["~"].$begin(0), spaces_added))['$%'](tab_size)['$=='](0)) { + + spaces_added = $rb_plus(spaces_added, $rb_minus(tab_size, 1)); + return full_tab_space; + } else { + + if ((spaces = $rb_minus(tab_size, offset['$%'](tab_size)))['$=='](1)) { + } else { + spaces_added = $rb_plus(spaces_added, $rb_minus(spaces, 1)) + }; + return $rb_times(" ", spaces); + }}, TMP_76.$$s = self, TMP_76.$$arity = 0, TMP_76)); + } else { + return line + };}, TMP_74.$$s = self, TMP_74.$$arity = 1, TMP_74));}; + if ($truthy(($truthy($a = indent) ? $rb_gt((indent = indent.$to_i()), -1) : $a))) { + } else { + return nil + }; + gutter_width = nil; + (function(){var $brk = Opal.new_brk(); try {return $send(lines, 'each', [], (TMP_77 = function(line){var self = TMP_77.$$s || this, $b, line_indent = nil; + + + + if (line == null) { + line = nil; + }; + if ($truthy(line['$empty?']())) { + return nil;}; + if ((line_indent = $rb_minus(line.$length(), line.$lstrip().$length()))['$=='](0)) { + + gutter_width = nil; + + Opal.brk(nil, $brk); + } else if ($truthy(($truthy($b = gutter_width) ? $rb_gt(line_indent, gutter_width) : $b))) { + return nil + } else { + return (gutter_width = line_indent) + };}, TMP_77.$$s = self, TMP_77.$$brk = $brk, TMP_77.$$arity = 1, TMP_77)) + } catch (err) { if (err === $brk) { return err.$v } else { throw err } }})(); + if (indent['$=='](0)) { + if ($truthy(gutter_width)) { + $send(lines, 'map!', [], (TMP_78 = function(line){var self = TMP_78.$$s || this; + + + + if (line == null) { + line = nil; + }; + if ($truthy(line['$empty?']())) { + return line + } else { + + return line.$slice(gutter_width, line.$length()); + };}, TMP_78.$$s = self, TMP_78.$$arity = 1, TMP_78))} + } else { + + padding = $rb_times(" ", indent); + if ($truthy(gutter_width)) { + $send(lines, 'map!', [], (TMP_79 = function(line){var self = TMP_79.$$s || this; + + + + if (line == null) { + line = nil; + }; + if ($truthy(line['$empty?']())) { + return line + } else { + return $rb_plus(padding, line.$slice(gutter_width, line.$length())) + };}, TMP_79.$$s = self, TMP_79.$$arity = 1, TMP_79)) + } else { + $send(lines, 'map!', [], (TMP_80 = function(line){var self = TMP_80.$$s || this; + + + + if (line == null) { + line = nil; + }; + if ($truthy(line['$empty?']())) { + return line + } else { + return $rb_plus(padding, line) + };}, TMP_80.$$s = self, TMP_80.$$arity = 1, TMP_80)) + }; + }; + return nil; + }, TMP_Parser_adjust_indentation$B_73.$$arity = -2); + return (Opal.defs(self, '$sanitize_attribute_name', TMP_Parser_sanitize_attribute_name_81 = function $$sanitize_attribute_name(name) { + var self = this; + + return name.$gsub($$($nesting, 'InvalidAttributeNameCharsRx'), "").$downcase() + }, TMP_Parser_sanitize_attribute_name_81.$$arity = 1), nil) && 'sanitize_attribute_name'; + })($nesting[0], null, $nesting) + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/path_resolver"] = function(Opal) { + function $rb_plus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); + } + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + function $rb_gt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $truthy = Opal.truthy, $hash2 = Opal.hash2, $send = Opal.send; + + Opal.add_stubs(['$include', '$attr_accessor', '$root?', '$posixify', '$expand_path', '$pwd', '$start_with?', '$==', '$match?', '$absolute_path?', '$+', '$length', '$descends_from?', '$slice', '$to_s', '$relative_path_from', '$new', '$include?', '$tr', '$partition_path', '$each', '$pop', '$<<', '$join_path', '$[]', '$web_root?', '$unc?', '$index', '$split', '$delete', '$[]=', '$-', '$join', '$raise', '$!', '$fetch', '$warn', '$logger', '$empty?', '$nil_or_empty?', '$chomp', '$!=', '$>', '$size', '$end_with?', '$uri_prefix', '$gsub']); + return (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + (function($base, $super, $parent_nesting) { + function $PathResolver(){}; + var self = $PathResolver = $klass($base, $super, 'PathResolver', $PathResolver); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_PathResolver_initialize_1, TMP_PathResolver_absolute_path$q_2, $a, TMP_PathResolver_root$q_3, TMP_PathResolver_unc$q_4, TMP_PathResolver_web_root$q_5, TMP_PathResolver_descends_from$q_6, TMP_PathResolver_relative_path_7, TMP_PathResolver_posixify_8, TMP_PathResolver_expand_path_9, TMP_PathResolver_partition_path_11, TMP_PathResolver_join_path_12, TMP_PathResolver_system_path_13, TMP_PathResolver_web_path_16; + + def.file_separator = def._partition_path_web = def._partition_path_sys = def.working_dir = nil; + + self.$include($$($nesting, 'Logging')); + Opal.const_set($nesting[0], 'DOT', "."); + Opal.const_set($nesting[0], 'DOT_DOT', ".."); + Opal.const_set($nesting[0], 'DOT_SLASH', "./"); + Opal.const_set($nesting[0], 'SLASH', "/"); + Opal.const_set($nesting[0], 'BACKSLASH', "\\"); + Opal.const_set($nesting[0], 'DOUBLE_SLASH', "//"); + Opal.const_set($nesting[0], 'WindowsRootRx', /^(?:[a-zA-Z]:)?[\\\/]/); + self.$attr_accessor("file_separator"); + self.$attr_accessor("working_dir"); + + Opal.def(self, '$initialize', TMP_PathResolver_initialize_1 = function $$initialize(file_separator, working_dir) { + var $a, $b, self = this; + + + + if (file_separator == null) { + file_separator = nil; + }; + + if (working_dir == null) { + working_dir = nil; + }; + self.file_separator = ($truthy($a = ($truthy($b = file_separator) ? $b : $$$($$$('::', 'File'), 'ALT_SEPARATOR'))) ? $a : $$$($$$('::', 'File'), 'SEPARATOR')); + self.working_dir = (function() {if ($truthy(working_dir)) { + + if ($truthy(self['$root?'](working_dir))) { + + return self.$posixify(working_dir); + } else { + + return $$$('::', 'File').$expand_path(working_dir); + }; + } else { + return $$$('::', 'Dir').$pwd() + }; return nil; })(); + self._partition_path_sys = $hash2([], {}); + return (self._partition_path_web = $hash2([], {})); + }, TMP_PathResolver_initialize_1.$$arity = -1); + + Opal.def(self, '$absolute_path?', TMP_PathResolver_absolute_path$q_2 = function(path) { + var $a, $b, self = this; + + return ($truthy($a = path['$start_with?']($$($nesting, 'SLASH'))) ? $a : (($b = self.file_separator['$==']($$($nesting, 'BACKSLASH'))) ? $$($nesting, 'WindowsRootRx')['$match?'](path) : self.file_separator['$==']($$($nesting, 'BACKSLASH')))) + }, TMP_PathResolver_absolute_path$q_2.$$arity = 1); + if ($truthy((($a = $$($nesting, 'RUBY_ENGINE')['$==']("opal")) ? $$$('::', 'JAVASCRIPT_IO_MODULE')['$==']("xmlhttprequest") : $$($nesting, 'RUBY_ENGINE')['$==']("opal")))) { + + Opal.def(self, '$root?', TMP_PathResolver_root$q_3 = function(path) { + var $a, self = this; + + return ($truthy($a = self['$absolute_path?'](path)) ? $a : path['$start_with?']("file://", "http://", "https://")) + }, TMP_PathResolver_root$q_3.$$arity = 1) + } else { + Opal.alias(self, "root?", "absolute_path?") + }; + + Opal.def(self, '$unc?', TMP_PathResolver_unc$q_4 = function(path) { + var self = this; + + return path['$start_with?']($$($nesting, 'DOUBLE_SLASH')) + }, TMP_PathResolver_unc$q_4.$$arity = 1); + + Opal.def(self, '$web_root?', TMP_PathResolver_web_root$q_5 = function(path) { + var self = this; + + return path['$start_with?']($$($nesting, 'SLASH')) + }, TMP_PathResolver_web_root$q_5.$$arity = 1); + + Opal.def(self, '$descends_from?', TMP_PathResolver_descends_from$q_6 = function(path, base) { + var $a, self = this; + + if (base['$=='](path)) { + return 0 + } else if (base['$==']($$($nesting, 'SLASH'))) { + return ($truthy($a = path['$start_with?']($$($nesting, 'SLASH'))) ? 1 : $a) + } else { + return ($truthy($a = path['$start_with?']($rb_plus(base, $$($nesting, 'SLASH')))) ? $rb_plus(base.$length(), 1) : $a) + } + }, TMP_PathResolver_descends_from$q_6.$$arity = 2); + + Opal.def(self, '$relative_path', TMP_PathResolver_relative_path_7 = function $$relative_path(path, base) { + var self = this, offset = nil; + + if ($truthy(self['$root?'](path))) { + if ($truthy((offset = self['$descends_from?'](path, base)))) { + return path.$slice(offset, path.$length()) + } else { + return $$($nesting, 'Pathname').$new(path).$relative_path_from($$($nesting, 'Pathname').$new(base)).$to_s() + } + } else { + return path + } + }, TMP_PathResolver_relative_path_7.$$arity = 2); + + Opal.def(self, '$posixify', TMP_PathResolver_posixify_8 = function $$posixify(path) { + var $a, self = this; + + if ($truthy(path)) { + if ($truthy((($a = self.file_separator['$==']($$($nesting, 'BACKSLASH'))) ? path['$include?']($$($nesting, 'BACKSLASH')) : self.file_separator['$==']($$($nesting, 'BACKSLASH'))))) { + + return path.$tr($$($nesting, 'BACKSLASH'), $$($nesting, 'SLASH')); + } else { + return path + } + } else { + return "" + } + }, TMP_PathResolver_posixify_8.$$arity = 1); + Opal.alias(self, "posixfy", "posixify"); + + Opal.def(self, '$expand_path', TMP_PathResolver_expand_path_9 = function $$expand_path(path) { + var $a, $b, TMP_10, self = this, path_segments = nil, path_root = nil, resolved_segments = nil; + + + $b = self.$partition_path(path), $a = Opal.to_ary($b), (path_segments = ($a[0] == null ? nil : $a[0])), (path_root = ($a[1] == null ? nil : $a[1])), $b; + if ($truthy(path['$include?']($$($nesting, 'DOT_DOT')))) { + + resolved_segments = []; + $send(path_segments, 'each', [], (TMP_10 = function(segment){var self = TMP_10.$$s || this; + + + + if (segment == null) { + segment = nil; + }; + if (segment['$==']($$($nesting, 'DOT_DOT'))) { + return resolved_segments.$pop() + } else { + return resolved_segments['$<<'](segment) + };}, TMP_10.$$s = self, TMP_10.$$arity = 1, TMP_10)); + return self.$join_path(resolved_segments, path_root); + } else { + return self.$join_path(path_segments, path_root) + }; + }, TMP_PathResolver_expand_path_9.$$arity = 1); + + Opal.def(self, '$partition_path', TMP_PathResolver_partition_path_11 = function $$partition_path(path, web) { + var self = this, result = nil, cache = nil, posix_path = nil, root = nil, path_segments = nil, $writer = nil; + + + + if (web == null) { + web = nil; + }; + if ($truthy((result = (cache = (function() {if ($truthy(web)) { + return self._partition_path_web + } else { + return self._partition_path_sys + }; return nil; })())['$[]'](path)))) { + return result}; + posix_path = self.$posixify(path); + if ($truthy(web)) { + if ($truthy(self['$web_root?'](posix_path))) { + root = $$($nesting, 'SLASH') + } else if ($truthy(posix_path['$start_with?']($$($nesting, 'DOT_SLASH')))) { + root = $$($nesting, 'DOT_SLASH')} + } else if ($truthy(self['$root?'](posix_path))) { + if ($truthy(self['$unc?'](posix_path))) { + root = $$($nesting, 'DOUBLE_SLASH') + } else if ($truthy(posix_path['$start_with?']($$($nesting, 'SLASH')))) { + root = $$($nesting, 'SLASH') + } else { + root = posix_path.$slice(0, $rb_plus(posix_path.$index($$($nesting, 'SLASH')), 1)) + } + } else if ($truthy(posix_path['$start_with?']($$($nesting, 'DOT_SLASH')))) { + root = $$($nesting, 'DOT_SLASH')}; + path_segments = (function() {if ($truthy(root)) { + + return posix_path.$slice(root.$length(), posix_path.$length()); + } else { + return posix_path + }; return nil; })().$split($$($nesting, 'SLASH')); + path_segments.$delete($$($nesting, 'DOT')); + + $writer = [path, [path_segments, root]]; + $send(cache, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];; + }, TMP_PathResolver_partition_path_11.$$arity = -2); + + Opal.def(self, '$join_path', TMP_PathResolver_join_path_12 = function $$join_path(segments, root) { + var self = this; + + + + if (root == null) { + root = nil; + }; + if ($truthy(root)) { + return "" + (root) + (segments.$join($$($nesting, 'SLASH'))) + } else { + + return segments.$join($$($nesting, 'SLASH')); + }; + }, TMP_PathResolver_join_path_12.$$arity = -2); + + Opal.def(self, '$system_path', TMP_PathResolver_system_path_13 = function $$system_path(target, start, jail, opts) { + var $a, $b, TMP_14, TMP_15, self = this, target_path = nil, target_segments = nil, _ = nil, jail_segments = nil, jail_root = nil, recheck = nil, start_segments = nil, start_root = nil, resolved_segments = nil, unresolved_segments = nil, warned = nil; + + + + if (start == null) { + start = nil; + }; + + if (jail == null) { + jail = nil; + }; + + if (opts == null) { + opts = $hash2([], {}); + }; + if ($truthy(jail)) { + + if ($truthy(self['$root?'](jail))) { + } else { + self.$raise($$$('::', 'SecurityError'), "" + "Jail is not an absolute path: " + (jail)) + }; + jail = self.$posixify(jail);}; + if ($truthy(target)) { + if ($truthy(self['$root?'](target))) { + + target_path = self.$expand_path(target); + if ($truthy(($truthy($a = jail) ? self['$descends_from?'](target_path, jail)['$!']() : $a))) { + if ($truthy(opts.$fetch("recover", true))) { + + self.$logger().$warn("" + (($truthy($a = opts['$[]']("target_name")) ? $a : "path")) + " is outside of jail; recovering automatically"); + $b = self.$partition_path(target_path), $a = Opal.to_ary($b), (target_segments = ($a[0] == null ? nil : $a[0])), (_ = ($a[1] == null ? nil : $a[1])), $b; + $b = self.$partition_path(jail), $a = Opal.to_ary($b), (jail_segments = ($a[0] == null ? nil : $a[0])), (jail_root = ($a[1] == null ? nil : $a[1])), $b; + return self.$join_path($rb_plus(jail_segments, target_segments), jail_root); + } else { + self.$raise($$$('::', 'SecurityError'), "" + (($truthy($a = opts['$[]']("target_name")) ? $a : "path")) + " " + (target) + " is outside of jail: " + (jail) + " (disallowed in safe mode)") + }}; + return target_path; + } else { + $b = self.$partition_path(target), $a = Opal.to_ary($b), (target_segments = ($a[0] == null ? nil : $a[0])), (_ = ($a[1] == null ? nil : $a[1])), $b + } + } else { + target_segments = [] + }; + if ($truthy(target_segments['$empty?']())) { + if ($truthy(start['$nil_or_empty?']())) { + return ($truthy($a = jail) ? $a : self.working_dir) + } else if ($truthy(self['$root?'](start))) { + if ($truthy(jail)) { + start = self.$posixify(start) + } else { + return self.$expand_path(start) + } + } else { + + $b = self.$partition_path(start), $a = Opal.to_ary($b), (target_segments = ($a[0] == null ? nil : $a[0])), (_ = ($a[1] == null ? nil : $a[1])), $b; + start = ($truthy($a = jail) ? $a : self.working_dir); + } + } else if ($truthy(start['$nil_or_empty?']())) { + start = ($truthy($a = jail) ? $a : self.working_dir) + } else if ($truthy(self['$root?'](start))) { + if ($truthy(jail)) { + start = self.$posixify(start)} + } else { + start = "" + (($truthy($a = jail) ? $a : self.working_dir).$chomp("/")) + "/" + (start) + }; + if ($truthy(($truthy($a = ($truthy($b = jail) ? (recheck = self['$descends_from?'](start, jail)['$!']()) : $b)) ? self.file_separator['$==']($$($nesting, 'BACKSLASH')) : $a))) { + + $b = self.$partition_path(start), $a = Opal.to_ary($b), (start_segments = ($a[0] == null ? nil : $a[0])), (start_root = ($a[1] == null ? nil : $a[1])), $b; + $b = self.$partition_path(jail), $a = Opal.to_ary($b), (jail_segments = ($a[0] == null ? nil : $a[0])), (jail_root = ($a[1] == null ? nil : $a[1])), $b; + if ($truthy(start_root['$!='](jail_root))) { + if ($truthy(opts.$fetch("recover", true))) { + + self.$logger().$warn("" + "start path for " + (($truthy($a = opts['$[]']("target_name")) ? $a : "path")) + " is outside of jail root; recovering automatically"); + start_segments = jail_segments; + recheck = false; + } else { + self.$raise($$$('::', 'SecurityError'), "" + "start path for " + (($truthy($a = opts['$[]']("target_name")) ? $a : "path")) + " " + (start) + " refers to location outside jail root: " + (jail) + " (disallowed in safe mode)") + }}; + } else { + $b = self.$partition_path(start), $a = Opal.to_ary($b), (start_segments = ($a[0] == null ? nil : $a[0])), (jail_root = ($a[1] == null ? nil : $a[1])), $b + }; + if ($truthy((resolved_segments = $rb_plus(start_segments, target_segments))['$include?']($$($nesting, 'DOT_DOT')))) { + + $a = [resolved_segments, []], (unresolved_segments = $a[0]), (resolved_segments = $a[1]), $a; + if ($truthy(jail)) { + + if ($truthy(jail_segments)) { + } else { + $b = self.$partition_path(jail), $a = Opal.to_ary($b), (jail_segments = ($a[0] == null ? nil : $a[0])), (_ = ($a[1] == null ? nil : $a[1])), $b + }; + warned = false; + $send(unresolved_segments, 'each', [], (TMP_14 = function(segment){var self = TMP_14.$$s || this, $c; + + + + if (segment == null) { + segment = nil; + }; + if (segment['$==']($$($nesting, 'DOT_DOT'))) { + if ($truthy($rb_gt(resolved_segments.$size(), jail_segments.$size()))) { + return resolved_segments.$pop() + } else if ($truthy(opts.$fetch("recover", true))) { + if ($truthy(warned)) { + return nil + } else { + + self.$logger().$warn("" + (($truthy($c = opts['$[]']("target_name")) ? $c : "path")) + " has illegal reference to ancestor of jail; recovering automatically"); + return (warned = true); + } + } else { + return self.$raise($$$('::', 'SecurityError'), "" + (($truthy($c = opts['$[]']("target_name")) ? $c : "path")) + " " + (target) + " refers to location outside jail: " + (jail) + " (disallowed in safe mode)") + } + } else { + return resolved_segments['$<<'](segment) + };}, TMP_14.$$s = self, TMP_14.$$arity = 1, TMP_14)); + } else { + $send(unresolved_segments, 'each', [], (TMP_15 = function(segment){var self = TMP_15.$$s || this; + + + + if (segment == null) { + segment = nil; + }; + if (segment['$==']($$($nesting, 'DOT_DOT'))) { + return resolved_segments.$pop() + } else { + return resolved_segments['$<<'](segment) + };}, TMP_15.$$s = self, TMP_15.$$arity = 1, TMP_15)) + };}; + if ($truthy(recheck)) { + + target_path = self.$join_path(resolved_segments, jail_root); + if ($truthy(self['$descends_from?'](target_path, jail))) { + return target_path + } else if ($truthy(opts.$fetch("recover", true))) { + + self.$logger().$warn("" + (($truthy($a = opts['$[]']("target_name")) ? $a : "path")) + " is outside of jail; recovering automatically"); + if ($truthy(jail_segments)) { + } else { + $b = self.$partition_path(jail), $a = Opal.to_ary($b), (jail_segments = ($a[0] == null ? nil : $a[0])), (_ = ($a[1] == null ? nil : $a[1])), $b + }; + return self.$join_path($rb_plus(jail_segments, target_segments), jail_root); + } else { + return self.$raise($$$('::', 'SecurityError'), "" + (($truthy($a = opts['$[]']("target_name")) ? $a : "path")) + " " + (target) + " is outside of jail: " + (jail) + " (disallowed in safe mode)") + }; + } else { + return self.$join_path(resolved_segments, jail_root) + }; + }, TMP_PathResolver_system_path_13.$$arity = -2); + return (Opal.def(self, '$web_path', TMP_PathResolver_web_path_16 = function $$web_path(target, start) { + var $a, $b, TMP_17, self = this, uri_prefix = nil, target_segments = nil, target_root = nil, resolved_segments = nil, resolved_path = nil; + + + + if (start == null) { + start = nil; + }; + target = self.$posixify(target); + start = self.$posixify(start); + uri_prefix = nil; + if ($truthy(($truthy($a = start['$nil_or_empty?']()) ? $a : self['$web_root?'](target)))) { + } else { + + target = (function() {if ($truthy(start['$end_with?']($$($nesting, 'SLASH')))) { + return "" + (start) + (target) + } else { + return "" + (start) + ($$($nesting, 'SLASH')) + (target) + }; return nil; })(); + if ($truthy((uri_prefix = $$($nesting, 'Helpers').$uri_prefix(target)))) { + target = target['$[]'](Opal.Range.$new(uri_prefix.$length(), -1, false))}; + }; + $b = self.$partition_path(target, true), $a = Opal.to_ary($b), (target_segments = ($a[0] == null ? nil : $a[0])), (target_root = ($a[1] == null ? nil : $a[1])), $b; + resolved_segments = []; + $send(target_segments, 'each', [], (TMP_17 = function(segment){var self = TMP_17.$$s || this, $c; + + + + if (segment == null) { + segment = nil; + }; + if (segment['$==']($$($nesting, 'DOT_DOT'))) { + if ($truthy(resolved_segments['$empty?']())) { + if ($truthy(($truthy($c = target_root) ? target_root['$!=']($$($nesting, 'DOT_SLASH')) : $c))) { + return nil + } else { + return resolved_segments['$<<'](segment) + } + } else if (resolved_segments['$[]'](-1)['$==']($$($nesting, 'DOT_DOT'))) { + return resolved_segments['$<<'](segment) + } else { + return resolved_segments.$pop() + } + } else { + return resolved_segments['$<<'](segment) + };}, TMP_17.$$s = self, TMP_17.$$arity = 1, TMP_17)); + if ($truthy((resolved_path = self.$join_path(resolved_segments, target_root))['$include?'](" "))) { + resolved_path = resolved_path.$gsub(" ", "%20")}; + if ($truthy(uri_prefix)) { + return "" + (uri_prefix) + (resolved_path) + } else { + return resolved_path + }; + }, TMP_PathResolver_web_path_16.$$arity = -2), nil) && 'web_path'; + })($nesting[0], null, $nesting) + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/reader"] = function(Opal) { + function $rb_plus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); + } + function $rb_gt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); + } + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + function $rb_times(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs * rhs : lhs['$*'](rhs); + } + function $rb_lt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); + } + function $rb_ge(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs >= rhs : lhs['$>='](rhs); + } + function $rb_divide(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs / rhs : lhs['$/'](rhs); + } + function $rb_le(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs <= rhs : lhs['$<='](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $hash2 = Opal.hash2, $truthy = Opal.truthy, $send = Opal.send, $gvars = Opal.gvars, $hash = Opal.hash; + + Opal.add_stubs(['$include', '$attr_reader', '$+', '$attr_accessor', '$!', '$===', '$split', '$file', '$dir', '$dirname', '$path', '$basename', '$lineno', '$prepare_lines', '$drop', '$[]', '$normalize_lines_from_string', '$normalize_lines_array', '$empty?', '$nil_or_empty?', '$peek_line', '$>', '$slice', '$length', '$process_line', '$times', '$shift', '$read_line', '$<<', '$-', '$unshift_all', '$has_more_lines?', '$join', '$read_lines', '$unshift', '$start_with?', '$==', '$*', '$read_lines_until', '$size', '$clear', '$cursor', '$[]=', '$!=', '$fetch', '$cursor_at_mark', '$warn', '$logger', '$message_with_context', '$new', '$each', '$instance_variables', '$instance_variable_get', '$dup', '$instance_variable_set', '$to_i', '$attributes', '$<', '$catalog', '$skip_front_matter!', '$pop', '$adjust_indentation!', '$attr', '$end_with?', '$include?', '$=~', '$preprocess_conditional_directive', '$preprocess_include_directive', '$pop_include', '$downcase', '$error', '$none?', '$key?', '$any?', '$all?', '$strip', '$resolve_expr_val', '$send', '$to_sym', '$replace_next_line', '$rstrip', '$sub_attributes', '$attribute_missing', '$include_processors?', '$find', '$handles?', '$instance', '$process_method', '$parse_attributes', '$>=', '$safe', '$resolve_include_path', '$split_delimited_value', '$/', '$to_a', '$uniq', '$sort', '$open', '$each_line', '$infinite?', '$push_include', '$delete', '$value?', '$force_encoding', '$create_include_cursor', '$rindex', '$delete_at', '$nil?', '$keys', '$read', '$uriish?', '$attr?', '$require_library', '$parse', '$normalize_system_path', '$file?', '$relative_path', '$path_resolver', '$base_dir', '$to_s', '$path=', '$extname', '$rootname', '$<=', '$to_f', '$extensions?', '$extensions', '$include_processors', '$class', '$object_id', '$inspect', '$map']); + return (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + + (function($base, $super, $parent_nesting) { + function $Reader(){}; + var self = $Reader = $klass($base, $super, 'Reader', $Reader); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Reader_initialize_4, TMP_Reader_prepare_lines_5, TMP_Reader_process_line_6, TMP_Reader_has_more_lines$q_7, TMP_Reader_empty$q_8, TMP_Reader_next_line_empty$q_9, TMP_Reader_peek_line_10, TMP_Reader_peek_lines_11, TMP_Reader_read_line_13, TMP_Reader_read_lines_14, TMP_Reader_read_15, TMP_Reader_advance_16, TMP_Reader_unshift_line_17, TMP_Reader_unshift_lines_18, TMP_Reader_replace_next_line_19, TMP_Reader_skip_blank_lines_20, TMP_Reader_skip_comment_lines_21, TMP_Reader_skip_line_comments_22, TMP_Reader_terminate_23, TMP_Reader_read_lines_until_24, TMP_Reader_shift_25, TMP_Reader_unshift_26, TMP_Reader_unshift_all_27, TMP_Reader_cursor_28, TMP_Reader_cursor_at_line_29, TMP_Reader_cursor_at_mark_30, TMP_Reader_cursor_before_mark_31, TMP_Reader_cursor_at_prev_line_32, TMP_Reader_mark_33, TMP_Reader_line_info_34, TMP_Reader_lines_35, TMP_Reader_string_36, TMP_Reader_source_37, TMP_Reader_save_38, TMP_Reader_restore_save_40, TMP_Reader_discard_save_42; + + def.file = def.lines = def.process_lines = def.look_ahead = def.unescape_next_line = def.lineno = def.dir = def.path = def.mark = def.source_lines = def.saved = nil; + + self.$include($$($nesting, 'Logging')); + (function($base, $super, $parent_nesting) { + function $Cursor(){}; + var self = $Cursor = $klass($base, $super, 'Cursor', $Cursor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Cursor_initialize_1, TMP_Cursor_advance_2, TMP_Cursor_line_info_3; + + def.lineno = def.path = nil; + + self.$attr_reader("file", "dir", "path", "lineno"); + + Opal.def(self, '$initialize', TMP_Cursor_initialize_1 = function $$initialize(file, dir, path, lineno) { + var $a, self = this; + + + + if (dir == null) { + dir = nil; + }; + + if (path == null) { + path = nil; + }; + + if (lineno == null) { + lineno = 1; + }; + return $a = [file, dir, path, lineno], (self.file = $a[0]), (self.dir = $a[1]), (self.path = $a[2]), (self.lineno = $a[3]), $a; + }, TMP_Cursor_initialize_1.$$arity = -2); + + Opal.def(self, '$advance', TMP_Cursor_advance_2 = function $$advance(num) { + var self = this; + + return (self.lineno = $rb_plus(self.lineno, num)) + }, TMP_Cursor_advance_2.$$arity = 1); + + Opal.def(self, '$line_info', TMP_Cursor_line_info_3 = function $$line_info() { + var self = this; + + return "" + (self.path) + ": line " + (self.lineno) + }, TMP_Cursor_line_info_3.$$arity = 0); + return Opal.alias(self, "to_s", "line_info"); + })($nesting[0], null, $nesting); + self.$attr_reader("file"); + self.$attr_reader("dir"); + self.$attr_reader("path"); + self.$attr_reader("lineno"); + self.$attr_reader("source_lines"); + self.$attr_accessor("process_lines"); + self.$attr_accessor("unterminated"); + + Opal.def(self, '$initialize', TMP_Reader_initialize_4 = function $$initialize(data, cursor, opts) { + var $a, $b, self = this; + + + + if (data == null) { + data = nil; + }; + + if (cursor == null) { + cursor = nil; + }; + + if (opts == null) { + opts = $hash2([], {}); + }; + if ($truthy(cursor['$!']())) { + + self.file = nil; + self.dir = "."; + self.path = ""; + self.lineno = 1; + } else if ($truthy($$$('::', 'String')['$==='](cursor))) { + + self.file = cursor; + $b = $$$('::', 'File').$split(self.file), $a = Opal.to_ary($b), (self.dir = ($a[0] == null ? nil : $a[0])), (self.path = ($a[1] == null ? nil : $a[1])), $b; + self.lineno = 1; + } else { + + if ($truthy((self.file = cursor.$file()))) { + + self.dir = ($truthy($a = cursor.$dir()) ? $a : $$$('::', 'File').$dirname(self.file)); + self.path = ($truthy($a = cursor.$path()) ? $a : $$$('::', 'File').$basename(self.file)); + } else { + + self.dir = ($truthy($a = cursor.$dir()) ? $a : "."); + self.path = ($truthy($a = cursor.$path()) ? $a : ""); + }; + self.lineno = ($truthy($a = cursor.$lineno()) ? $a : 1); + }; + self.lines = (function() {if ($truthy(data)) { + + return self.$prepare_lines(data, opts); + } else { + return [] + }; return nil; })(); + self.source_lines = self.lines.$drop(0); + self.mark = nil; + self.look_ahead = 0; + self.process_lines = true; + self.unescape_next_line = false; + self.unterminated = nil; + return (self.saved = nil); + }, TMP_Reader_initialize_4.$$arity = -1); + + Opal.def(self, '$prepare_lines', TMP_Reader_prepare_lines_5 = function $$prepare_lines(data, opts) { + var self = this; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + if ($truthy($$$('::', 'String')['$==='](data))) { + if ($truthy(opts['$[]']("normalize"))) { + return $$($nesting, 'Helpers').$normalize_lines_from_string(data) + } else { + return data.$split($$($nesting, 'LF'), -1) + } + } else if ($truthy(opts['$[]']("normalize"))) { + return $$($nesting, 'Helpers').$normalize_lines_array(data) + } else { + return data.$drop(0) + }; + }, TMP_Reader_prepare_lines_5.$$arity = -2); + + Opal.def(self, '$process_line', TMP_Reader_process_line_6 = function $$process_line(line) { + var self = this; + + + if ($truthy(self.process_lines)) { + self.look_ahead = $rb_plus(self.look_ahead, 1)}; + return line; + }, TMP_Reader_process_line_6.$$arity = 1); + + Opal.def(self, '$has_more_lines?', TMP_Reader_has_more_lines$q_7 = function() { + var self = this; + + if ($truthy(self.lines['$empty?']())) { + + self.look_ahead = 0; + return false; + } else { + return true + } + }, TMP_Reader_has_more_lines$q_7.$$arity = 0); + + Opal.def(self, '$empty?', TMP_Reader_empty$q_8 = function() { + var self = this; + + if ($truthy(self.lines['$empty?']())) { + + self.look_ahead = 0; + return true; + } else { + return false + } + }, TMP_Reader_empty$q_8.$$arity = 0); + Opal.alias(self, "eof?", "empty?"); + + Opal.def(self, '$next_line_empty?', TMP_Reader_next_line_empty$q_9 = function() { + var self = this; + + return self.$peek_line()['$nil_or_empty?']() + }, TMP_Reader_next_line_empty$q_9.$$arity = 0); + + Opal.def(self, '$peek_line', TMP_Reader_peek_line_10 = function $$peek_line(direct) { + var $a, self = this, line = nil; + + + + if (direct == null) { + direct = false; + }; + if ($truthy(($truthy($a = direct) ? $a : $rb_gt(self.look_ahead, 0)))) { + if ($truthy(self.unescape_next_line)) { + + return (line = self.lines['$[]'](0)).$slice(1, line.$length()); + } else { + return self.lines['$[]'](0) + } + } else if ($truthy(self.lines['$empty?']())) { + + self.look_ahead = 0; + return nil; + } else if ($truthy((line = self.$process_line(self.lines['$[]'](0))))) { + return line + } else { + return self.$peek_line() + }; + }, TMP_Reader_peek_line_10.$$arity = -1); + + Opal.def(self, '$peek_lines', TMP_Reader_peek_lines_11 = function $$peek_lines(num, direct) { + var $a, TMP_12, self = this, old_look_ahead = nil, result = nil; + + + + if (num == null) { + num = nil; + }; + + if (direct == null) { + direct = false; + }; + old_look_ahead = self.look_ahead; + result = []; + (function(){var $brk = Opal.new_brk(); try {return $send(($truthy($a = num) ? $a : $$($nesting, 'MAX_INT')), 'times', [], (TMP_12 = function(){var self = TMP_12.$$s || this, line = nil; + if (self.lineno == null) self.lineno = nil; + + if ($truthy((line = (function() {if ($truthy(direct)) { + return self.$shift() + } else { + return self.$read_line() + }; return nil; })()))) { + return result['$<<'](line) + } else { + + if ($truthy(direct)) { + self.lineno = $rb_minus(self.lineno, 1)}; + + Opal.brk(nil, $brk); + }}, TMP_12.$$s = self, TMP_12.$$brk = $brk, TMP_12.$$arity = 0, TMP_12)) + } catch (err) { if (err === $brk) { return err.$v } else { throw err } }})(); + if ($truthy(result['$empty?']())) { + } else { + + self.$unshift_all(result); + if ($truthy(direct)) { + self.look_ahead = old_look_ahead}; + }; + return result; + }, TMP_Reader_peek_lines_11.$$arity = -1); + + Opal.def(self, '$read_line', TMP_Reader_read_line_13 = function $$read_line() { + var $a, self = this; + + if ($truthy(($truthy($a = $rb_gt(self.look_ahead, 0)) ? $a : self['$has_more_lines?']()))) { + return self.$shift() + } else { + return nil + } + }, TMP_Reader_read_line_13.$$arity = 0); + + Opal.def(self, '$read_lines', TMP_Reader_read_lines_14 = function $$read_lines() { + var $a, self = this, lines = nil; + + + lines = []; + while ($truthy(self['$has_more_lines?']())) { + lines['$<<'](self.$shift()) + }; + return lines; + }, TMP_Reader_read_lines_14.$$arity = 0); + Opal.alias(self, "readlines", "read_lines"); + + Opal.def(self, '$read', TMP_Reader_read_15 = function $$read() { + var self = this; + + return self.$read_lines().$join($$($nesting, 'LF')) + }, TMP_Reader_read_15.$$arity = 0); + + Opal.def(self, '$advance', TMP_Reader_advance_16 = function $$advance() { + var self = this; + + if ($truthy(self.$shift())) { + return true + } else { + return false + } + }, TMP_Reader_advance_16.$$arity = 0); + + Opal.def(self, '$unshift_line', TMP_Reader_unshift_line_17 = function $$unshift_line(line_to_restore) { + var self = this; + + + self.$unshift(line_to_restore); + return nil; + }, TMP_Reader_unshift_line_17.$$arity = 1); + Opal.alias(self, "restore_line", "unshift_line"); + + Opal.def(self, '$unshift_lines', TMP_Reader_unshift_lines_18 = function $$unshift_lines(lines_to_restore) { + var self = this; + + + self.$unshift_all(lines_to_restore); + return nil; + }, TMP_Reader_unshift_lines_18.$$arity = 1); + Opal.alias(self, "restore_lines", "unshift_lines"); + + Opal.def(self, '$replace_next_line', TMP_Reader_replace_next_line_19 = function $$replace_next_line(replacement) { + var self = this; + + + self.$shift(); + self.$unshift(replacement); + return true; + }, TMP_Reader_replace_next_line_19.$$arity = 1); + Opal.alias(self, "replace_line", "replace_next_line"); + + Opal.def(self, '$skip_blank_lines', TMP_Reader_skip_blank_lines_20 = function $$skip_blank_lines() { + var $a, self = this, num_skipped = nil, next_line = nil; + + + if ($truthy(self['$empty?']())) { + return nil}; + num_skipped = 0; + while ($truthy((next_line = self.$peek_line()))) { + if ($truthy(next_line['$empty?']())) { + + self.$shift(); + num_skipped = $rb_plus(num_skipped, 1); + } else { + return num_skipped + } + }; + }, TMP_Reader_skip_blank_lines_20.$$arity = 0); + + Opal.def(self, '$skip_comment_lines', TMP_Reader_skip_comment_lines_21 = function $$skip_comment_lines() { + var $a, $b, self = this, next_line = nil, ll = nil; + + + if ($truthy(self['$empty?']())) { + return nil}; + while ($truthy(($truthy($b = (next_line = self.$peek_line())) ? next_line['$empty?']()['$!']() : $b))) { + if ($truthy(next_line['$start_with?']("//"))) { + if ($truthy(next_line['$start_with?']("///"))) { + if ($truthy(($truthy($b = $rb_gt((ll = next_line.$length()), 3)) ? next_line['$==']($rb_times("/", ll)) : $b))) { + self.$read_lines_until($hash2(["terminator", "skip_first_line", "read_last_line", "skip_processing", "context"], {"terminator": next_line, "skip_first_line": true, "read_last_line": true, "skip_processing": true, "context": "comment"})) + } else { + break; + } + } else { + self.$shift() + } + } else { + break; + } + }; + return nil; + }, TMP_Reader_skip_comment_lines_21.$$arity = 0); + + Opal.def(self, '$skip_line_comments', TMP_Reader_skip_line_comments_22 = function $$skip_line_comments() { + var $a, $b, self = this, comment_lines = nil, next_line = nil; + + + if ($truthy(self['$empty?']())) { + return []}; + comment_lines = []; + while ($truthy(($truthy($b = (next_line = self.$peek_line())) ? next_line['$empty?']()['$!']() : $b))) { + if ($truthy(next_line['$start_with?']("//"))) { + comment_lines['$<<'](self.$shift()) + } else { + break; + } + }; + return comment_lines; + }, TMP_Reader_skip_line_comments_22.$$arity = 0); + + Opal.def(self, '$terminate', TMP_Reader_terminate_23 = function $$terminate() { + var self = this; + + + self.lineno = $rb_plus(self.lineno, self.lines.$size()); + self.lines.$clear(); + self.look_ahead = 0; + return nil; + }, TMP_Reader_terminate_23.$$arity = 0); + + Opal.def(self, '$read_lines_until', TMP_Reader_read_lines_until_24 = function $$read_lines_until(options) { + var $a, $b, $c, $d, $iter = TMP_Reader_read_lines_until_24.$$p, $yield = $iter || nil, self = this, result = nil, restore_process_lines = nil, terminator = nil, start_cursor = nil, break_on_blank_lines = nil, break_on_list_continuation = nil, skip_comments = nil, complete = nil, line_read = nil, line_restored = nil, line = nil, $writer = nil, context = nil; + + if ($iter) TMP_Reader_read_lines_until_24.$$p = null; + + + if (options == null) { + options = $hash2([], {}); + }; + result = []; + if ($truthy(($truthy($a = self.process_lines) ? options['$[]']("skip_processing") : $a))) { + + self.process_lines = false; + restore_process_lines = true;}; + if ($truthy((terminator = options['$[]']("terminator")))) { + + start_cursor = ($truthy($a = options['$[]']("cursor")) ? $a : self.$cursor()); + break_on_blank_lines = false; + break_on_list_continuation = false; + } else { + + break_on_blank_lines = options['$[]']("break_on_blank_lines"); + break_on_list_continuation = options['$[]']("break_on_list_continuation"); + }; + skip_comments = options['$[]']("skip_line_comments"); + complete = (line_read = (line_restored = nil)); + if ($truthy(options['$[]']("skip_first_line"))) { + self.$shift()}; + while ($truthy(($truthy($b = complete['$!']()) ? (line = self.$read_line()) : $b))) { + + complete = (function() {while ($truthy(true)) { + + if ($truthy(($truthy($c = terminator) ? line['$=='](terminator) : $c))) { + return true}; + if ($truthy(($truthy($c = break_on_blank_lines) ? line['$empty?']() : $c))) { + return true}; + if ($truthy(($truthy($c = ($truthy($d = break_on_list_continuation) ? line_read : $d)) ? line['$==']($$($nesting, 'LIST_CONTINUATION')) : $c))) { + + + $writer = ["preserve_last_line", true]; + $send(options, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + return true;}; + if ($truthy((($c = ($yield !== nil)) ? Opal.yield1($yield, line) : ($yield !== nil)))) { + return true}; + return false; + }; return nil; })(); + if ($truthy(complete)) { + + if ($truthy(options['$[]']("read_last_line"))) { + + result['$<<'](line); + line_read = true;}; + if ($truthy(options['$[]']("preserve_last_line"))) { + + self.$unshift(line); + line_restored = true;}; + } else if ($truthy(($truthy($b = ($truthy($c = skip_comments) ? line['$start_with?']("//") : $c)) ? line['$start_with?']("///")['$!']() : $b))) { + } else { + + result['$<<'](line); + line_read = true; + }; + }; + if ($truthy(restore_process_lines)) { + + self.process_lines = true; + if ($truthy(($truthy($a = line_restored) ? terminator['$!']() : $a))) { + self.look_ahead = $rb_minus(self.look_ahead, 1)};}; + if ($truthy(($truthy($a = ($truthy($b = terminator) ? terminator['$!='](line) : $b)) ? (context = options.$fetch("context", terminator)) : $a))) { + + if (start_cursor['$==']("at_mark")) { + start_cursor = self.$cursor_at_mark()}; + self.$logger().$warn(self.$message_with_context("" + "unterminated " + (context) + " block", $hash2(["source_location"], {"source_location": start_cursor}))); + self.unterminated = true;}; + return result; + }, TMP_Reader_read_lines_until_24.$$arity = -1); + + Opal.def(self, '$shift', TMP_Reader_shift_25 = function $$shift() { + var self = this; + + + self.lineno = $rb_plus(self.lineno, 1); + if (self.look_ahead['$=='](0)) { + } else { + self.look_ahead = $rb_minus(self.look_ahead, 1) + }; + return self.lines.$shift(); + }, TMP_Reader_shift_25.$$arity = 0); + + Opal.def(self, '$unshift', TMP_Reader_unshift_26 = function $$unshift(line) { + var self = this; + + + self.lineno = $rb_minus(self.lineno, 1); + self.look_ahead = $rb_plus(self.look_ahead, 1); + return self.lines.$unshift(line); + }, TMP_Reader_unshift_26.$$arity = 1); + + Opal.def(self, '$unshift_all', TMP_Reader_unshift_all_27 = function $$unshift_all(lines) { + var self = this; + + + self.lineno = $rb_minus(self.lineno, lines.$size()); + self.look_ahead = $rb_plus(self.look_ahead, lines.$size()); + return $send(self.lines, 'unshift', Opal.to_a(lines)); + }, TMP_Reader_unshift_all_27.$$arity = 1); + + Opal.def(self, '$cursor', TMP_Reader_cursor_28 = function $$cursor() { + var self = this; + + return $$($nesting, 'Cursor').$new(self.file, self.dir, self.path, self.lineno) + }, TMP_Reader_cursor_28.$$arity = 0); + + Opal.def(self, '$cursor_at_line', TMP_Reader_cursor_at_line_29 = function $$cursor_at_line(lineno) { + var self = this; + + return $$($nesting, 'Cursor').$new(self.file, self.dir, self.path, lineno) + }, TMP_Reader_cursor_at_line_29.$$arity = 1); + + Opal.def(self, '$cursor_at_mark', TMP_Reader_cursor_at_mark_30 = function $$cursor_at_mark() { + var self = this; + + if ($truthy(self.mark)) { + return $send($$($nesting, 'Cursor'), 'new', Opal.to_a(self.mark)) + } else { + return self.$cursor() + } + }, TMP_Reader_cursor_at_mark_30.$$arity = 0); + + Opal.def(self, '$cursor_before_mark', TMP_Reader_cursor_before_mark_31 = function $$cursor_before_mark() { + var $a, $b, self = this, m_file = nil, m_dir = nil, m_path = nil, m_lineno = nil; + + if ($truthy(self.mark)) { + + $b = self.mark, $a = Opal.to_ary($b), (m_file = ($a[0] == null ? nil : $a[0])), (m_dir = ($a[1] == null ? nil : $a[1])), (m_path = ($a[2] == null ? nil : $a[2])), (m_lineno = ($a[3] == null ? nil : $a[3])), $b; + return $$($nesting, 'Cursor').$new(m_file, m_dir, m_path, $rb_minus(m_lineno, 1)); + } else { + return $$($nesting, 'Cursor').$new(self.file, self.dir, self.path, $rb_minus(self.lineno, 1)) + } + }, TMP_Reader_cursor_before_mark_31.$$arity = 0); + + Opal.def(self, '$cursor_at_prev_line', TMP_Reader_cursor_at_prev_line_32 = function $$cursor_at_prev_line() { + var self = this; + + return $$($nesting, 'Cursor').$new(self.file, self.dir, self.path, $rb_minus(self.lineno, 1)) + }, TMP_Reader_cursor_at_prev_line_32.$$arity = 0); + + Opal.def(self, '$mark', TMP_Reader_mark_33 = function $$mark() { + var self = this; + + return (self.mark = [self.file, self.dir, self.path, self.lineno]) + }, TMP_Reader_mark_33.$$arity = 0); + + Opal.def(self, '$line_info', TMP_Reader_line_info_34 = function $$line_info() { + var self = this; + + return "" + (self.path) + ": line " + (self.lineno) + }, TMP_Reader_line_info_34.$$arity = 0); + + Opal.def(self, '$lines', TMP_Reader_lines_35 = function $$lines() { + var self = this; + + return self.lines.$drop(0) + }, TMP_Reader_lines_35.$$arity = 0); + + Opal.def(self, '$string', TMP_Reader_string_36 = function $$string() { + var self = this; + + return self.lines.$join($$($nesting, 'LF')) + }, TMP_Reader_string_36.$$arity = 0); + + Opal.def(self, '$source', TMP_Reader_source_37 = function $$source() { + var self = this; + + return self.source_lines.$join($$($nesting, 'LF')) + }, TMP_Reader_source_37.$$arity = 0); + + Opal.def(self, '$save', TMP_Reader_save_38 = function $$save() { + var TMP_39, self = this, accum = nil; + + + accum = $hash2([], {}); + $send(self.$instance_variables(), 'each', [], (TMP_39 = function(name){var self = TMP_39.$$s || this, $a, $writer = nil, val = nil; + + + + if (name == null) { + name = nil; + }; + if ($truthy(($truthy($a = name['$==']("@saved")) ? $a : name['$==']("@source_lines")))) { + return nil + } else { + + $writer = [name, (function() {if ($truthy($$$('::', 'Array')['$===']((val = self.$instance_variable_get(name))))) { + return val.$dup() + } else { + return val + }; return nil; })()]; + $send(accum, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + };}, TMP_39.$$s = self, TMP_39.$$arity = 1, TMP_39)); + self.saved = accum; + return nil; + }, TMP_Reader_save_38.$$arity = 0); + + Opal.def(self, '$restore_save', TMP_Reader_restore_save_40 = function $$restore_save() { + var TMP_41, self = this; + + if ($truthy(self.saved)) { + + $send(self.saved, 'each', [], (TMP_41 = function(name, val){var self = TMP_41.$$s || this; + + + + if (name == null) { + name = nil; + }; + + if (val == null) { + val = nil; + }; + return self.$instance_variable_set(name, val);}, TMP_41.$$s = self, TMP_41.$$arity = 2, TMP_41)); + return (self.saved = nil); + } else { + return nil + } + }, TMP_Reader_restore_save_40.$$arity = 0); + + Opal.def(self, '$discard_save', TMP_Reader_discard_save_42 = function $$discard_save() { + var self = this; + + return (self.saved = nil) + }, TMP_Reader_discard_save_42.$$arity = 0); + return Opal.alias(self, "to_s", "line_info"); + })($nesting[0], null, $nesting); + (function($base, $super, $parent_nesting) { + function $PreprocessorReader(){}; + var self = $PreprocessorReader = $klass($base, $super, 'PreprocessorReader', $PreprocessorReader); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_PreprocessorReader_initialize_43, TMP_PreprocessorReader_prepare_lines_44, TMP_PreprocessorReader_process_line_45, TMP_PreprocessorReader_has_more_lines$q_46, TMP_PreprocessorReader_empty$q_47, TMP_PreprocessorReader_peek_line_48, TMP_PreprocessorReader_preprocess_conditional_directive_49, TMP_PreprocessorReader_preprocess_include_directive_54, TMP_PreprocessorReader_resolve_include_path_66, TMP_PreprocessorReader_push_include_67, TMP_PreprocessorReader_create_include_cursor_68, TMP_PreprocessorReader_pop_include_69, TMP_PreprocessorReader_include_depth_70, TMP_PreprocessorReader_exceeded_max_depth$q_71, TMP_PreprocessorReader_shift_72, TMP_PreprocessorReader_split_delimited_value_73, TMP_PreprocessorReader_skip_front_matter$B_74, TMP_PreprocessorReader_resolve_expr_val_75, TMP_PreprocessorReader_include_processors$q_76, TMP_PreprocessorReader_to_s_77; + + def.document = def.lineno = def.process_lines = def.look_ahead = def.skipping = def.include_stack = def.conditional_stack = def.path = def.include_processor_extensions = def.maxdepth = def.dir = def.lines = def.file = def.includes = def.unescape_next_line = nil; + + self.$attr_reader("include_stack"); + + Opal.def(self, '$initialize', TMP_PreprocessorReader_initialize_43 = function $$initialize(document, data, cursor, opts) { + var $iter = TMP_PreprocessorReader_initialize_43.$$p, $yield = $iter || nil, self = this, include_depth_default = nil; + + if ($iter) TMP_PreprocessorReader_initialize_43.$$p = null; + + + if (data == null) { + data = nil; + }; + + if (cursor == null) { + cursor = nil; + }; + + if (opts == null) { + opts = $hash2([], {}); + }; + self.document = document; + $send(self, Opal.find_super_dispatcher(self, 'initialize', TMP_PreprocessorReader_initialize_43, false), [data, cursor, opts], null); + include_depth_default = document.$attributes().$fetch("max-include-depth", 64).$to_i(); + if ($truthy($rb_lt(include_depth_default, 0))) { + include_depth_default = 0}; + self.maxdepth = $hash2(["abs", "rel"], {"abs": include_depth_default, "rel": include_depth_default}); + self.include_stack = []; + self.includes = document.$catalog()['$[]']("includes"); + self.skipping = false; + self.conditional_stack = []; + return (self.include_processor_extensions = nil); + }, TMP_PreprocessorReader_initialize_43.$$arity = -2); + + Opal.def(self, '$prepare_lines', TMP_PreprocessorReader_prepare_lines_44 = function $$prepare_lines(data, opts) { + var $a, $b, $iter = TMP_PreprocessorReader_prepare_lines_44.$$p, $yield = $iter || nil, self = this, result = nil, front_matter = nil, $writer = nil, first = nil, last = nil, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_PreprocessorReader_prepare_lines_44.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + + + if (opts == null) { + opts = $hash2([], {}); + }; + result = $send(self, Opal.find_super_dispatcher(self, 'prepare_lines', TMP_PreprocessorReader_prepare_lines_44, false), $zuper, $iter); + if ($truthy(($truthy($a = self.document) ? self.document.$attributes()['$[]']("skip-front-matter") : $a))) { + if ($truthy((front_matter = self['$skip_front_matter!'](result)))) { + + $writer = ["front-matter", front_matter.$join($$($nesting, 'LF'))]; + $send(self.document.$attributes(), '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}}; + if ($truthy(opts.$fetch("condense", true))) { + + while ($truthy(($truthy($b = (first = result['$[]'](0))) ? first['$empty?']() : $b))) { + ($truthy($b = result.$shift()) ? (self.lineno = $rb_plus(self.lineno, 1)) : $b) + }; + while ($truthy(($truthy($b = (last = result['$[]'](-1))) ? last['$empty?']() : $b))) { + result.$pop() + };}; + if ($truthy(opts['$[]']("indent"))) { + $$($nesting, 'Parser')['$adjust_indentation!'](result, opts['$[]']("indent"), self.document.$attr("tabsize"))}; + return result; + }, TMP_PreprocessorReader_prepare_lines_44.$$arity = -2); + + Opal.def(self, '$process_line', TMP_PreprocessorReader_process_line_45 = function $$process_line(line) { + var $a, $b, self = this; + + + if ($truthy(self.process_lines)) { + } else { + return line + }; + if ($truthy(line['$empty?']())) { + + self.look_ahead = $rb_plus(self.look_ahead, 1); + return line;}; + if ($truthy(($truthy($a = ($truthy($b = line['$end_with?']("]")) ? line['$start_with?']("[")['$!']() : $b)) ? line['$include?']("::") : $a))) { + if ($truthy(($truthy($a = line['$include?']("if")) ? $$($nesting, 'ConditionalDirectiveRx')['$=~'](line) : $a))) { + if ((($a = $gvars['~']) === nil ? nil : $a['$[]'](1))['$==']("\\")) { + + self.unescape_next_line = true; + self.look_ahead = $rb_plus(self.look_ahead, 1); + return line.$slice(1, line.$length()); + } else if ($truthy(self.$preprocess_conditional_directive((($a = $gvars['~']) === nil ? nil : $a['$[]'](2)), (($a = $gvars['~']) === nil ? nil : $a['$[]'](3)), (($a = $gvars['~']) === nil ? nil : $a['$[]'](4)), (($a = $gvars['~']) === nil ? nil : $a['$[]'](5))))) { + + self.$shift(); + return nil; + } else { + + self.look_ahead = $rb_plus(self.look_ahead, 1); + return line; + } + } else if ($truthy(self.skipping)) { + + self.$shift(); + return nil; + } else if ($truthy(($truthy($a = line['$start_with?']("inc", "\\inc")) ? $$($nesting, 'IncludeDirectiveRx')['$=~'](line) : $a))) { + if ((($a = $gvars['~']) === nil ? nil : $a['$[]'](1))['$==']("\\")) { + + self.unescape_next_line = true; + self.look_ahead = $rb_plus(self.look_ahead, 1); + return line.$slice(1, line.$length()); + } else if ($truthy(self.$preprocess_include_directive((($a = $gvars['~']) === nil ? nil : $a['$[]'](2)), (($a = $gvars['~']) === nil ? nil : $a['$[]'](3))))) { + return nil + } else { + + self.look_ahead = $rb_plus(self.look_ahead, 1); + return line; + } + } else { + + self.look_ahead = $rb_plus(self.look_ahead, 1); + return line; + } + } else if ($truthy(self.skipping)) { + + self.$shift(); + return nil; + } else { + + self.look_ahead = $rb_plus(self.look_ahead, 1); + return line; + }; + }, TMP_PreprocessorReader_process_line_45.$$arity = 1); + + Opal.def(self, '$has_more_lines?', TMP_PreprocessorReader_has_more_lines$q_46 = function() { + var self = this; + + if ($truthy(self.$peek_line())) { + return true + } else { + return false + } + }, TMP_PreprocessorReader_has_more_lines$q_46.$$arity = 0); + + Opal.def(self, '$empty?', TMP_PreprocessorReader_empty$q_47 = function() { + var self = this; + + if ($truthy(self.$peek_line())) { + return false + } else { + return true + } + }, TMP_PreprocessorReader_empty$q_47.$$arity = 0); + Opal.alias(self, "eof?", "empty?"); + + Opal.def(self, '$peek_line', TMP_PreprocessorReader_peek_line_48 = function $$peek_line(direct) { + var $iter = TMP_PreprocessorReader_peek_line_48.$$p, $yield = $iter || nil, self = this, line = nil, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_PreprocessorReader_peek_line_48.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + + + if (direct == null) { + direct = false; + }; + if ($truthy((line = $send(self, Opal.find_super_dispatcher(self, 'peek_line', TMP_PreprocessorReader_peek_line_48, false), $zuper, $iter)))) { + return line + } else if ($truthy(self.include_stack['$empty?']())) { + return nil + } else { + + self.$pop_include(); + return self.$peek_line(direct); + }; + }, TMP_PreprocessorReader_peek_line_48.$$arity = -1); + + Opal.def(self, '$preprocess_conditional_directive', TMP_PreprocessorReader_preprocess_conditional_directive_49 = function $$preprocess_conditional_directive(keyword, target, delimiter, text) { + var $a, $b, $c, TMP_50, TMP_51, TMP_52, TMP_53, self = this, no_target = nil, pair = nil, skip = nil, $case = nil, lhs = nil, op = nil, rhs = nil; + + + if ($truthy((no_target = target['$empty?']()))) { + } else { + target = target.$downcase() + }; + if ($truthy(($truthy($a = ($truthy($b = no_target) ? ($truthy($c = keyword['$==']("ifdef")) ? $c : keyword['$==']("ifndef")) : $b)) ? $a : ($truthy($b = text) ? keyword['$==']("endif") : $b)))) { + return false}; + if (keyword['$==']("endif")) { + + if ($truthy(self.conditional_stack['$empty?']())) { + self.$logger().$error(self.$message_with_context("" + "unmatched macro: endif::" + (target) + "[]", $hash2(["source_location"], {"source_location": self.$cursor()}))) + } else if ($truthy(($truthy($a = no_target) ? $a : target['$==']((pair = self.conditional_stack['$[]'](-1))['$[]']("target"))))) { + + self.conditional_stack.$pop(); + self.skipping = (function() {if ($truthy(self.conditional_stack['$empty?']())) { + return false + } else { + return self.conditional_stack['$[]'](-1)['$[]']("skipping") + }; return nil; })(); + } else { + self.$logger().$error(self.$message_with_context("" + "mismatched macro: endif::" + (target) + "[], expected endif::" + (pair['$[]']("target")) + "[]", $hash2(["source_location"], {"source_location": self.$cursor()}))) + }; + return true;}; + if ($truthy(self.skipping)) { + skip = false + } else { + $case = keyword; + if ("ifdef"['$===']($case)) {$case = delimiter; + if (","['$===']($case)) {skip = $send(target.$split(",", -1), 'none?', [], (TMP_50 = function(name){var self = TMP_50.$$s || this; + if (self.document == null) self.document = nil; + + + + if (name == null) { + name = nil; + }; + return self.document.$attributes()['$key?'](name);}, TMP_50.$$s = self, TMP_50.$$arity = 1, TMP_50))} + else if ("+"['$===']($case)) {skip = $send(target.$split("+", -1), 'any?', [], (TMP_51 = function(name){var self = TMP_51.$$s || this; + if (self.document == null) self.document = nil; + + + + if (name == null) { + name = nil; + }; + return self.document.$attributes()['$key?'](name)['$!']();}, TMP_51.$$s = self, TMP_51.$$arity = 1, TMP_51))} + else {skip = self.document.$attributes()['$key?'](target)['$!']()}} + else if ("ifndef"['$===']($case)) {$case = delimiter; + if (","['$===']($case)) {skip = $send(target.$split(",", -1), 'any?', [], (TMP_52 = function(name){var self = TMP_52.$$s || this; + if (self.document == null) self.document = nil; + + + + if (name == null) { + name = nil; + }; + return self.document.$attributes()['$key?'](name);}, TMP_52.$$s = self, TMP_52.$$arity = 1, TMP_52))} + else if ("+"['$===']($case)) {skip = $send(target.$split("+", -1), 'all?', [], (TMP_53 = function(name){var self = TMP_53.$$s || this; + if (self.document == null) self.document = nil; + + + + if (name == null) { + name = nil; + }; + return self.document.$attributes()['$key?'](name);}, TMP_53.$$s = self, TMP_53.$$arity = 1, TMP_53))} + else {skip = self.document.$attributes()['$key?'](target)}} + else if ("ifeval"['$===']($case)) { + if ($truthy(($truthy($a = no_target) ? $$($nesting, 'EvalExpressionRx')['$=~'](text.$strip()) : $a))) { + } else { + return false + }; + $a = [(($b = $gvars['~']) === nil ? nil : $b['$[]'](1)), (($b = $gvars['~']) === nil ? nil : $b['$[]'](2)), (($b = $gvars['~']) === nil ? nil : $b['$[]'](3))], (lhs = $a[0]), (op = $a[1]), (rhs = $a[2]), $a; + lhs = self.$resolve_expr_val(lhs); + rhs = self.$resolve_expr_val(rhs); + if (op['$==']("!=")) { + skip = lhs.$send("==", rhs) + } else { + skip = lhs.$send(op.$to_sym(), rhs)['$!']() + };} + }; + if ($truthy(($truthy($a = keyword['$==']("ifeval")) ? $a : text['$!']()))) { + + if ($truthy(skip)) { + self.skipping = true}; + self.conditional_stack['$<<']($hash2(["target", "skip", "skipping"], {"target": target, "skip": skip, "skipping": self.skipping})); + } else if ($truthy(($truthy($a = self.skipping) ? $a : skip))) { + } else { + + self.$replace_next_line(text.$rstrip()); + self.$unshift(""); + if ($truthy(text['$start_with?']("include::"))) { + self.look_ahead = $rb_minus(self.look_ahead, 1)}; + }; + return true; + }, TMP_PreprocessorReader_preprocess_conditional_directive_49.$$arity = 4); + + Opal.def(self, '$preprocess_include_directive', TMP_PreprocessorReader_preprocess_include_directive_54 = function $$preprocess_include_directive(target, attrlist) { + var $a, TMP_55, $b, TMP_56, TMP_57, TMP_58, TMP_60, TMP_63, TMP_64, TMP_65, self = this, doc = nil, expanded_target = nil, ext = nil, abs_maxdepth = nil, parsed_attrs = nil, inc_path = nil, target_type = nil, relpath = nil, inc_linenos = nil, inc_tags = nil, tag = nil, inc_lines = nil, inc_offset = nil, inc_lineno = nil, $writer = nil, tag_stack = nil, tags_used = nil, active_tag = nil, select = nil, base_select = nil, wildcard = nil, missing_tags = nil, inc_content = nil; + + + doc = self.document; + if ($truthy(($truthy($a = (expanded_target = target)['$include?']($$($nesting, 'ATTR_REF_HEAD'))) ? (expanded_target = doc.$sub_attributes(target, $hash2(["attribute_missing"], {"attribute_missing": "drop-line"})))['$empty?']() : $a))) { + + self.$shift(); + if (($truthy($a = doc.$attributes()['$[]']("attribute-missing")) ? $a : $$($nesting, 'Compliance').$attribute_missing())['$==']("skip")) { + self.$unshift("" + "Unresolved directive in " + (self.path) + " - include::" + (target) + "[" + (attrlist) + "]")}; + return true; + } else if ($truthy(($truthy($a = self['$include_processors?']()) ? (ext = $send(self.include_processor_extensions, 'find', [], (TMP_55 = function(candidate){var self = TMP_55.$$s || this; + + + + if (candidate == null) { + candidate = nil; + }; + return candidate.$instance()['$handles?'](expanded_target);}, TMP_55.$$s = self, TMP_55.$$arity = 1, TMP_55))) : $a))) { + + self.$shift(); + ext.$process_method()['$[]'](doc, self, expanded_target, doc.$parse_attributes(attrlist, [], $hash2(["sub_input"], {"sub_input": true}))); + return true; + } else if ($truthy($rb_ge(doc.$safe(), $$$($$($nesting, 'SafeMode'), 'SECURE')))) { + return self.$replace_next_line("" + "link:" + (expanded_target) + "[]") + } else if ($truthy($rb_gt((abs_maxdepth = self.maxdepth['$[]']("abs")), 0))) { + + if ($truthy($rb_ge(self.include_stack.$size(), abs_maxdepth))) { + + self.$logger().$error(self.$message_with_context("" + "maximum include depth of " + (self.maxdepth['$[]']("rel")) + " exceeded", $hash2(["source_location"], {"source_location": self.$cursor()}))); + return nil;}; + parsed_attrs = doc.$parse_attributes(attrlist, [], $hash2(["sub_input"], {"sub_input": true})); + $b = self.$resolve_include_path(expanded_target, attrlist, parsed_attrs), $a = Opal.to_ary($b), (inc_path = ($a[0] == null ? nil : $a[0])), (target_type = ($a[1] == null ? nil : $a[1])), (relpath = ($a[2] == null ? nil : $a[2])), $b; + if ($truthy(target_type)) { + } else { + return inc_path + }; + inc_linenos = (inc_tags = nil); + if ($truthy(attrlist)) { + if ($truthy(parsed_attrs['$key?']("lines"))) { + + inc_linenos = []; + $send(self.$split_delimited_value(parsed_attrs['$[]']("lines")), 'each', [], (TMP_56 = function(linedef){var self = TMP_56.$$s || this, $c, $d, from = nil, to = nil; + + + + if (linedef == null) { + linedef = nil; + }; + if ($truthy(linedef['$include?'](".."))) { + + $d = linedef.$split("..", 2), $c = Opal.to_ary($d), (from = ($c[0] == null ? nil : $c[0])), (to = ($c[1] == null ? nil : $c[1])), $d; + return (inc_linenos = $rb_plus(inc_linenos, (function() {if ($truthy(($truthy($c = to['$empty?']()) ? $c : $rb_lt((to = to.$to_i()), 0)))) { + return [from.$to_i(), $rb_divide(1, 0)] + } else { + return $$$('::', 'Range').$new(from.$to_i(), to).$to_a() + }; return nil; })())); + } else { + return inc_linenos['$<<'](linedef.$to_i()) + };}, TMP_56.$$s = self, TMP_56.$$arity = 1, TMP_56)); + inc_linenos = (function() {if ($truthy(inc_linenos['$empty?']())) { + return nil + } else { + return inc_linenos.$sort().$uniq() + }; return nil; })(); + } else if ($truthy(parsed_attrs['$key?']("tag"))) { + if ($truthy(($truthy($a = (tag = parsed_attrs['$[]']("tag"))['$empty?']()) ? $a : tag['$==']("!")))) { + } else { + inc_tags = (function() {if ($truthy(tag['$start_with?']("!"))) { + return $hash(tag.$slice(1, tag.$length()), false) + } else { + return $hash(tag, true) + }; return nil; })() + } + } else if ($truthy(parsed_attrs['$key?']("tags"))) { + + inc_tags = $hash2([], {}); + $send(self.$split_delimited_value(parsed_attrs['$[]']("tags")), 'each', [], (TMP_57 = function(tagdef){var self = TMP_57.$$s || this, $c, $writer = nil; + + + + if (tagdef == null) { + tagdef = nil; + }; + if ($truthy(($truthy($c = tagdef['$empty?']()) ? $c : tagdef['$==']("!")))) { + return nil + } else if ($truthy(tagdef['$start_with?']("!"))) { + + $writer = [tagdef.$slice(1, tagdef.$length()), false]; + $send(inc_tags, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + } else { + + $writer = [tagdef, true]; + $send(inc_tags, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + };}, TMP_57.$$s = self, TMP_57.$$arity = 1, TMP_57)); + if ($truthy(inc_tags['$empty?']())) { + inc_tags = nil};}}; + if ($truthy(inc_linenos)) { + + $a = [[], nil, 0], (inc_lines = $a[0]), (inc_offset = $a[1]), (inc_lineno = $a[2]), $a; + + try { + (function(){var $brk = Opal.new_brk(); try {return $send(self, 'open', [inc_path, "rb"], (TMP_58 = function(f){var self = TMP_58.$$s || this, TMP_59, select_remaining = nil; + + + + if (f == null) { + f = nil; + }; + select_remaining = nil; + return (function(){var $brk = Opal.new_brk(); try {return $send(f, 'each_line', [], (TMP_59 = function(l){var self = TMP_59.$$s || this, $c, $d, select = nil; + + + + if (l == null) { + l = nil; + }; + inc_lineno = $rb_plus(inc_lineno, 1); + if ($truthy(($truthy($c = select_remaining) ? $c : ($truthy($d = $$$('::', 'Float')['$===']((select = inc_linenos['$[]'](0)))) ? (select_remaining = select['$infinite?']()) : $d)))) { + + inc_offset = ($truthy($c = inc_offset) ? $c : inc_lineno); + return inc_lines['$<<'](l); + } else { + + if (select['$=='](inc_lineno)) { + + inc_offset = ($truthy($c = inc_offset) ? $c : inc_lineno); + inc_lines['$<<'](l); + inc_linenos.$shift();}; + if ($truthy(inc_linenos['$empty?']())) { + + Opal.brk(nil, $brk) + } else { + return nil + }; + };}, TMP_59.$$s = self, TMP_59.$$brk = $brk, TMP_59.$$arity = 1, TMP_59)) + } catch (err) { if (err === $brk) { return err.$v } else { throw err } }})();}, TMP_58.$$s = self, TMP_58.$$brk = $brk, TMP_58.$$arity = 1, TMP_58)) + } catch (err) { if (err === $brk) { return err.$v } else { throw err } }})() + } catch ($err) { + if (Opal.rescue($err, [$$($nesting, 'StandardError')])) { + try { + + self.$logger().$error(self.$message_with_context("" + "include " + (target_type) + " not readable: " + (inc_path), $hash2(["source_location"], {"source_location": self.$cursor()}))); + return self.$replace_next_line("" + "Unresolved directive in " + (self.path) + " - include::" + (expanded_target) + "[" + (attrlist) + "]"); + } finally { Opal.pop_exception() } + } else { throw $err; } + };; + self.$shift(); + if ($truthy(inc_offset)) { + + + $writer = ["partial-option", true]; + $send(parsed_attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + self.$push_include(inc_lines, inc_path, relpath, inc_offset, parsed_attrs);}; + } else if ($truthy(inc_tags)) { + + $a = [[], nil, 0, [], $$$('::', 'Set').$new(), nil], (inc_lines = $a[0]), (inc_offset = $a[1]), (inc_lineno = $a[2]), (tag_stack = $a[3]), (tags_used = $a[4]), (active_tag = $a[5]), $a; + if ($truthy(inc_tags['$key?']("**"))) { + if ($truthy(inc_tags['$key?']("*"))) { + + select = (base_select = inc_tags.$delete("**")); + wildcard = inc_tags.$delete("*"); + } else { + select = (base_select = (wildcard = inc_tags.$delete("**"))) + } + } else { + + select = (base_select = inc_tags['$value?'](true)['$!']()); + wildcard = inc_tags.$delete("*"); + }; + + try { + $send(self, 'open', [inc_path, "rb"], (TMP_60 = function(f){var self = TMP_60.$$s || this, $c, TMP_61, dbl_co = nil, dbl_sb = nil, encoding = nil; + + + + if (f == null) { + f = nil; + }; + $c = ["::", "[]"], (dbl_co = $c[0]), (dbl_sb = $c[1]), $c; + if ($truthy($$($nesting, 'COERCE_ENCODING'))) { + encoding = $$$($$$('::', 'Encoding'), 'UTF_8')}; + return $send(f, 'each_line', [], (TMP_61 = function(l){var self = TMP_61.$$s || this, $d, $e, TMP_62, this_tag = nil, include_cursor = nil, idx = nil; + + + + if (l == null) { + l = nil; + }; + inc_lineno = $rb_plus(inc_lineno, 1); + if ($truthy(encoding)) { + l.$force_encoding(encoding)}; + if ($truthy(($truthy($d = ($truthy($e = l['$include?'](dbl_co)) ? l['$include?'](dbl_sb) : $e)) ? $$($nesting, 'TagDirectiveRx')['$=~'](l) : $d))) { + if ($truthy((($d = $gvars['~']) === nil ? nil : $d['$[]'](1)))) { + if ((this_tag = (($d = $gvars['~']) === nil ? nil : $d['$[]'](2)))['$=='](active_tag)) { + + tag_stack.$pop(); + return $e = (function() {if ($truthy(tag_stack['$empty?']())) { + return [nil, base_select] + } else { + return tag_stack['$[]'](-1) + }; return nil; })(), $d = Opal.to_ary($e), (active_tag = ($d[0] == null ? nil : $d[0])), (select = ($d[1] == null ? nil : $d[1])), $e; + } else if ($truthy(inc_tags['$key?'](this_tag))) { + + include_cursor = self.$create_include_cursor(inc_path, expanded_target, inc_lineno); + if ($truthy((idx = $send(tag_stack, 'rindex', [], (TMP_62 = function(key, _){var self = TMP_62.$$s || this; + + + + if (key == null) { + key = nil; + }; + + if (_ == null) { + _ = nil; + }; + return key['$=='](this_tag);}, TMP_62.$$s = self, TMP_62.$$arity = 2, TMP_62))))) { + + if (idx['$=='](0)) { + tag_stack.$shift() + } else { + + tag_stack.$delete_at(idx); + }; + return self.$logger().$warn(self.$message_with_context("" + "mismatched end tag (expected '" + (active_tag) + "' but found '" + (this_tag) + "') at line " + (inc_lineno) + " of include " + (target_type) + ": " + (inc_path), $hash2(["source_location", "include_location"], {"source_location": self.$cursor(), "include_location": include_cursor}))); + } else { + return self.$logger().$warn(self.$message_with_context("" + "unexpected end tag '" + (this_tag) + "' at line " + (inc_lineno) + " of include " + (target_type) + ": " + (inc_path), $hash2(["source_location", "include_location"], {"source_location": self.$cursor(), "include_location": include_cursor}))) + }; + } else { + return nil + } + } else if ($truthy(inc_tags['$key?']((this_tag = (($d = $gvars['~']) === nil ? nil : $d['$[]'](2)))))) { + + tags_used['$<<'](this_tag); + return tag_stack['$<<']([(active_tag = this_tag), (select = inc_tags['$[]'](this_tag)), inc_lineno]); + } else if ($truthy(wildcard['$nil?']()['$!']())) { + + select = (function() {if ($truthy(($truthy($d = active_tag) ? select['$!']() : $d))) { + return false + } else { + return wildcard + }; return nil; })(); + return tag_stack['$<<']([(active_tag = this_tag), select, inc_lineno]); + } else { + return nil + } + } else if ($truthy(select)) { + + inc_offset = ($truthy($d = inc_offset) ? $d : inc_lineno); + return inc_lines['$<<'](l); + } else { + return nil + };}, TMP_61.$$s = self, TMP_61.$$arity = 1, TMP_61));}, TMP_60.$$s = self, TMP_60.$$arity = 1, TMP_60)) + } catch ($err) { + if (Opal.rescue($err, [$$($nesting, 'StandardError')])) { + try { + + self.$logger().$error(self.$message_with_context("" + "include " + (target_type) + " not readable: " + (inc_path), $hash2(["source_location"], {"source_location": self.$cursor()}))); + return self.$replace_next_line("" + "Unresolved directive in " + (self.path) + " - include::" + (expanded_target) + "[" + (attrlist) + "]"); + } finally { Opal.pop_exception() } + } else { throw $err; } + };; + if ($truthy(tag_stack['$empty?']())) { + } else { + $send(tag_stack, 'each', [], (TMP_63 = function(tag_name, _, tag_lineno){var self = TMP_63.$$s || this; + + + + if (tag_name == null) { + tag_name = nil; + }; + + if (_ == null) { + _ = nil; + }; + + if (tag_lineno == null) { + tag_lineno = nil; + }; + return self.$logger().$warn(self.$message_with_context("" + "detected unclosed tag '" + (tag_name) + "' starting at line " + (tag_lineno) + " of include " + (target_type) + ": " + (inc_path), $hash2(["source_location", "include_location"], {"source_location": self.$cursor(), "include_location": self.$create_include_cursor(inc_path, expanded_target, tag_lineno)})));}, TMP_63.$$s = self, TMP_63.$$arity = 3, TMP_63)) + }; + if ($truthy((missing_tags = $rb_minus(inc_tags.$keys().$to_a(), tags_used.$to_a()))['$empty?']())) { + } else { + self.$logger().$warn(self.$message_with_context("" + "tag" + ((function() {if ($truthy($rb_gt(missing_tags.$size(), 1))) { + return "s" + } else { + return "" + }; return nil; })()) + " '" + (missing_tags.$join(", ")) + "' not found in include " + (target_type) + ": " + (inc_path), $hash2(["source_location"], {"source_location": self.$cursor()}))) + }; + self.$shift(); + if ($truthy(inc_offset)) { + + if ($truthy(($truthy($a = ($truthy($b = base_select) ? wildcard : $b)) ? inc_tags['$empty?']() : $a))) { + } else { + + $writer = ["partial-option", true]; + $send(parsed_attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + self.$push_include(inc_lines, inc_path, relpath, inc_offset, parsed_attrs);}; + } else { + + try { + + inc_content = (function() {if (false) { + return $send($$$('::', 'File'), 'open', [inc_path, "rb"], (TMP_64 = function(f){var self = TMP_64.$$s || this; + + + + if (f == null) { + f = nil; + }; + return f.$read();}, TMP_64.$$s = self, TMP_64.$$arity = 1, TMP_64)) + } else { + return $send(self, 'open', [inc_path, "rb"], (TMP_65 = function(f){var self = TMP_65.$$s || this; + + + + if (f == null) { + f = nil; + }; + return f.$read();}, TMP_65.$$s = self, TMP_65.$$arity = 1, TMP_65)) + }; return nil; })(); + self.$shift(); + self.$push_include(inc_content, inc_path, relpath, 1, parsed_attrs); + } catch ($err) { + if (Opal.rescue($err, [$$($nesting, 'StandardError')])) { + try { + + self.$logger().$error(self.$message_with_context("" + "include " + (target_type) + " not readable: " + (inc_path), $hash2(["source_location"], {"source_location": self.$cursor()}))); + return self.$replace_next_line("" + "Unresolved directive in " + (self.path) + " - include::" + (expanded_target) + "[" + (attrlist) + "]"); + } finally { Opal.pop_exception() } + } else { throw $err; } + }; + }; + return true; + } else { + return nil + }; + }, TMP_PreprocessorReader_preprocess_include_directive_54.$$arity = 2); + + Opal.def(self, '$resolve_include_path', TMP_PreprocessorReader_resolve_include_path_66 = function $$resolve_include_path(target, attrlist, attributes) { + var $a, $b, self = this, doc = nil, inc_path = nil, relpath = nil; + + + doc = self.document; + if ($truthy(($truthy($a = $$($nesting, 'Helpers')['$uriish?'](target)) ? $a : (function() {if ($truthy($$$('::', 'String')['$==='](self.dir))) { + return nil + } else { + + return (target = "" + (self.dir) + "/" + (target)); + }; return nil; })()))) { + + if ($truthy(doc['$attr?']("allow-uri-read"))) { + } else { + return self.$replace_next_line("" + "link:" + (target) + "[" + (attrlist) + "]") + }; + if ($truthy(doc['$attr?']("cache-uri"))) { + if ($truthy((($b = $$$('::', 'OpenURI', 'skip_raise')) && ($a = $$$($b, 'Cache', 'skip_raise')) ? 'constant' : nil))) { + } else { + $$($nesting, 'Helpers').$require_library("open-uri/cached", "open-uri-cached") + } + } else if ($truthy($$$('::', 'RUBY_ENGINE_OPAL')['$!']())) { + $$$('::', 'OpenURI')}; + return [$$$('::', 'URI').$parse(target), "uri", target]; + } else { + + inc_path = doc.$normalize_system_path(target, self.dir, nil, $hash2(["target_name"], {"target_name": "include file"})); + if ($truthy($$$('::', 'File')['$file?'](inc_path))) { + } else if ($truthy(attributes['$key?']("optional-option"))) { + + self.$shift(); + return true; + } else { + + self.$logger().$error(self.$message_with_context("" + "include file not found: " + (inc_path), $hash2(["source_location"], {"source_location": self.$cursor()}))); + return self.$replace_next_line("" + "Unresolved directive in " + (self.path) + " - include::" + (target) + "[" + (attrlist) + "]"); + }; + relpath = doc.$path_resolver().$relative_path(inc_path, doc.$base_dir()); + return [inc_path, "file", relpath]; + }; + }, TMP_PreprocessorReader_resolve_include_path_66.$$arity = 3); + + Opal.def(self, '$push_include', TMP_PreprocessorReader_push_include_67 = function $$push_include(data, file, path, lineno, attributes) { + var $a, self = this, $writer = nil, dir = nil, depth = nil, old_leveloffset = nil; + + + + if (file == null) { + file = nil; + }; + + if (path == null) { + path = nil; + }; + + if (lineno == null) { + lineno = 1; + }; + + if (attributes == null) { + attributes = $hash2([], {}); + }; + self.include_stack['$<<']([self.lines, self.file, self.dir, self.path, self.lineno, self.maxdepth, self.process_lines]); + if ($truthy((self.file = file))) { + + if ($truthy($$$('::', 'String')['$==='](file))) { + self.dir = $$$('::', 'File').$dirname(file) + } else if ($truthy($$$('::', 'RUBY_ENGINE_OPAL'))) { + self.dir = $$$('::', 'URI').$parse($$$('::', 'File').$dirname((file = file.$to_s()))) + } else { + + + $writer = [(function() {if ((dir = $$$('::', 'File').$dirname(file.$path()))['$==']("/")) { + return "" + } else { + return dir + }; return nil; })()]; + $send((self.dir = file.$dup()), 'path=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + file = file.$to_s(); + }; + path = ($truthy($a = path) ? $a : $$$('::', 'File').$basename(file)); + self.process_lines = $$($nesting, 'ASCIIDOC_EXTENSIONS')['$[]']($$$('::', 'File').$extname(file)); + } else { + + self.dir = "."; + self.process_lines = true; + }; + if ($truthy(path)) { + + self.path = path; + if ($truthy(self.process_lines)) { + + $writer = [$$($nesting, 'Helpers').$rootname(path), (function() {if ($truthy(attributes['$[]']("partial-option"))) { + return nil + } else { + return true + }; return nil; })()]; + $send(self.includes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + } else { + self.path = "" + }; + self.lineno = lineno; + if ($truthy(attributes['$key?']("depth"))) { + + depth = attributes['$[]']("depth").$to_i(); + if ($truthy($rb_le(depth, 0))) { + depth = 1}; + self.maxdepth = $hash2(["abs", "rel"], {"abs": $rb_plus($rb_minus(self.include_stack.$size(), 1), depth), "rel": depth});}; + if ($truthy((self.lines = self.$prepare_lines(data, $hash2(["normalize", "condense", "indent"], {"normalize": true, "condense": false, "indent": attributes['$[]']("indent")})))['$empty?']())) { + self.$pop_include() + } else { + + if ($truthy(attributes['$key?']("leveloffset"))) { + + self.lines.$unshift(""); + self.lines.$unshift("" + ":leveloffset: " + (attributes['$[]']("leveloffset"))); + self.lines['$<<'](""); + if ($truthy((old_leveloffset = self.document.$attr("leveloffset")))) { + self.lines['$<<']("" + ":leveloffset: " + (old_leveloffset)) + } else { + self.lines['$<<'](":leveloffset!:") + }; + self.lineno = $rb_minus(self.lineno, 2);}; + self.look_ahead = 0; + }; + return self; + }, TMP_PreprocessorReader_push_include_67.$$arity = -2); + + Opal.def(self, '$create_include_cursor', TMP_PreprocessorReader_create_include_cursor_68 = function $$create_include_cursor(file, path, lineno) { + var self = this, dir = nil; + + + if ($truthy($$$('::', 'String')['$==='](file))) { + dir = $$$('::', 'File').$dirname(file) + } else if ($truthy($$$('::', 'RUBY_ENGINE_OPAL'))) { + dir = $$$('::', 'File').$dirname((file = file.$to_s())) + } else { + + dir = (function() {if ((dir = $$$('::', 'File').$dirname(file.$path()))['$==']("")) { + return "/" + } else { + return dir + }; return nil; })(); + file = file.$to_s(); + }; + return $$($nesting, 'Cursor').$new(file, dir, path, lineno); + }, TMP_PreprocessorReader_create_include_cursor_68.$$arity = 3); + + Opal.def(self, '$pop_include', TMP_PreprocessorReader_pop_include_69 = function $$pop_include() { + var $a, $b, self = this; + + if ($truthy($rb_gt(self.include_stack.$size(), 0))) { + + $b = self.include_stack.$pop(), $a = Opal.to_ary($b), (self.lines = ($a[0] == null ? nil : $a[0])), (self.file = ($a[1] == null ? nil : $a[1])), (self.dir = ($a[2] == null ? nil : $a[2])), (self.path = ($a[3] == null ? nil : $a[3])), (self.lineno = ($a[4] == null ? nil : $a[4])), (self.maxdepth = ($a[5] == null ? nil : $a[5])), (self.process_lines = ($a[6] == null ? nil : $a[6])), $b; + self.look_ahead = 0; + return nil; + } else { + return nil + } + }, TMP_PreprocessorReader_pop_include_69.$$arity = 0); + + Opal.def(self, '$include_depth', TMP_PreprocessorReader_include_depth_70 = function $$include_depth() { + var self = this; + + return self.include_stack.$size() + }, TMP_PreprocessorReader_include_depth_70.$$arity = 0); + + Opal.def(self, '$exceeded_max_depth?', TMP_PreprocessorReader_exceeded_max_depth$q_71 = function() { + var $a, self = this, abs_maxdepth = nil; + + if ($truthy(($truthy($a = $rb_gt((abs_maxdepth = self.maxdepth['$[]']("abs")), 0)) ? $rb_ge(self.include_stack.$size(), abs_maxdepth) : $a))) { + return self.maxdepth['$[]']("rel") + } else { + return false + } + }, TMP_PreprocessorReader_exceeded_max_depth$q_71.$$arity = 0); + + Opal.def(self, '$shift', TMP_PreprocessorReader_shift_72 = function $$shift() { + var $iter = TMP_PreprocessorReader_shift_72.$$p, $yield = $iter || nil, self = this, line = nil, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_PreprocessorReader_shift_72.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + if ($truthy(self.unescape_next_line)) { + + self.unescape_next_line = false; + return (line = $send(self, Opal.find_super_dispatcher(self, 'shift', TMP_PreprocessorReader_shift_72, false), $zuper, $iter)).$slice(1, line.$length()); + } else { + return $send(self, Opal.find_super_dispatcher(self, 'shift', TMP_PreprocessorReader_shift_72, false), $zuper, $iter) + } + }, TMP_PreprocessorReader_shift_72.$$arity = 0); + + Opal.def(self, '$split_delimited_value', TMP_PreprocessorReader_split_delimited_value_73 = function $$split_delimited_value(val) { + var self = this; + + if ($truthy(val['$include?'](","))) { + + return val.$split(","); + } else { + + return val.$split(";"); + } + }, TMP_PreprocessorReader_split_delimited_value_73.$$arity = 1); + + Opal.def(self, '$skip_front_matter!', TMP_PreprocessorReader_skip_front_matter$B_74 = function(data, increment_linenos) { + var $a, $b, self = this, front_matter = nil, original_data = nil; + + + + if (increment_linenos == null) { + increment_linenos = true; + }; + front_matter = nil; + if (data['$[]'](0)['$==']("---")) { + + original_data = data.$drop(0); + data.$shift(); + front_matter = []; + if ($truthy(increment_linenos)) { + self.lineno = $rb_plus(self.lineno, 1)}; + while ($truthy(($truthy($b = data['$empty?']()['$!']()) ? data['$[]'](0)['$!=']("---") : $b))) { + + front_matter['$<<'](data.$shift()); + if ($truthy(increment_linenos)) { + self.lineno = $rb_plus(self.lineno, 1)}; + }; + if ($truthy(data['$empty?']())) { + + $send(data, 'unshift', Opal.to_a(original_data)); + if ($truthy(increment_linenos)) { + self.lineno = 0}; + front_matter = nil; + } else { + + data.$shift(); + if ($truthy(increment_linenos)) { + self.lineno = $rb_plus(self.lineno, 1)}; + };}; + return front_matter; + }, TMP_PreprocessorReader_skip_front_matter$B_74.$$arity = -2); + + Opal.def(self, '$resolve_expr_val', TMP_PreprocessorReader_resolve_expr_val_75 = function $$resolve_expr_val(val) { + var $a, $b, self = this, quoted = nil; + + + if ($truthy(($truthy($a = ($truthy($b = val['$start_with?']("\"")) ? val['$end_with?']("\"") : $b)) ? $a : ($truthy($b = val['$start_with?']("'")) ? val['$end_with?']("'") : $b)))) { + + quoted = true; + val = val.$slice(1, $rb_minus(val.$length(), 1)); + } else { + quoted = false + }; + if ($truthy(val['$include?']($$($nesting, 'ATTR_REF_HEAD')))) { + val = self.document.$sub_attributes(val, $hash2(["attribute_missing"], {"attribute_missing": "drop"}))}; + if ($truthy(quoted)) { + return val + } else if ($truthy(val['$empty?']())) { + return nil + } else if (val['$==']("true")) { + return true + } else if (val['$==']("false")) { + return false + } else if ($truthy(val.$rstrip()['$empty?']())) { + return " " + } else if ($truthy(val['$include?']("."))) { + return val.$to_f() + } else { + return val.$to_i() + }; + }, TMP_PreprocessorReader_resolve_expr_val_75.$$arity = 1); + + Opal.def(self, '$include_processors?', TMP_PreprocessorReader_include_processors$q_76 = function() { + var $a, self = this; + + if ($truthy(self.include_processor_extensions['$nil?']())) { + if ($truthy(($truthy($a = self.document['$extensions?']()) ? self.document.$extensions()['$include_processors?']() : $a))) { + return (self.include_processor_extensions = self.document.$extensions().$include_processors())['$!']()['$!']() + } else { + return (self.include_processor_extensions = false) + } + } else { + return self.include_processor_extensions['$!='](false) + } + }, TMP_PreprocessorReader_include_processors$q_76.$$arity = 0); + return (Opal.def(self, '$to_s', TMP_PreprocessorReader_to_s_77 = function $$to_s() { + var TMP_78, self = this; + + return "" + "#<" + (self.$class()) + "@" + (self.$object_id()) + " {path: " + (self.path.$inspect()) + ", line #: " + (self.lineno) + ", include depth: " + (self.include_stack.$size()) + ", include stack: [" + ($send(self.include_stack, 'map', [], (TMP_78 = function(inc){var self = TMP_78.$$s || this; + + + + if (inc == null) { + inc = nil; + }; + return inc.$to_s();}, TMP_78.$$s = self, TMP_78.$$arity = 1, TMP_78)).$join(", ")) + "]}>" + }, TMP_PreprocessorReader_to_s_77.$$arity = 0), nil) && 'to_s'; + })($nesting[0], $$($nesting, 'Reader'), $nesting); + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/section"] = function(Opal) { + function $rb_plus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); + } + function $rb_gt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); + } + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $hash2 = Opal.hash2, $send = Opal.send, $truthy = Opal.truthy; + + Opal.add_stubs(['$attr_accessor', '$attr_reader', '$===', '$+', '$level', '$special', '$generate_id', '$title', '$==', '$>', '$sectnum', '$int_to_roman', '$to_i', '$reftext', '$!', '$empty?', '$sprintf', '$sub_quotes', '$compat_mode', '$[]', '$attributes', '$context', '$assign_numeral', '$class', '$object_id', '$inspect', '$size', '$length', '$chr', '$[]=', '$-', '$gsub', '$downcase', '$delete', '$tr_s', '$end_with?', '$chop', '$start_with?', '$slice', '$key?', '$catalog', '$unique_id_start_index']); + return (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + (function($base, $super, $parent_nesting) { + function $Section(){}; + var self = $Section = $klass($base, $super, 'Section', $Section); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Section_initialize_1, TMP_Section_generate_id_2, TMP_Section_sectnum_3, TMP_Section_xreftext_4, TMP_Section_$lt$lt_5, TMP_Section_to_s_6, TMP_Section_generate_id_7; + + def.document = def.level = def.numeral = def.parent = def.numbered = def.sectname = def.title = def.blocks = nil; + + self.$attr_accessor("index"); + self.$attr_accessor("sectname"); + self.$attr_accessor("special"); + self.$attr_accessor("numbered"); + self.$attr_reader("caption"); + + Opal.def(self, '$initialize', TMP_Section_initialize_1 = function $$initialize(parent, level, numbered, opts) { + var $a, $b, $iter = TMP_Section_initialize_1.$$p, $yield = $iter || nil, self = this; + + if ($iter) TMP_Section_initialize_1.$$p = null; + + + if (parent == null) { + parent = nil; + }; + + if (level == null) { + level = nil; + }; + + if (numbered == null) { + numbered = false; + }; + + if (opts == null) { + opts = $hash2([], {}); + }; + $send(self, Opal.find_super_dispatcher(self, 'initialize', TMP_Section_initialize_1, false), [parent, "section", opts], null); + if ($truthy($$($nesting, 'Section')['$==='](parent))) { + $a = [($truthy($b = level) ? $b : $rb_plus(parent.$level(), 1)), parent.$special()], (self.level = $a[0]), (self.special = $a[1]), $a + } else { + $a = [($truthy($b = level) ? $b : 1), false], (self.level = $a[0]), (self.special = $a[1]), $a + }; + self.numbered = numbered; + return (self.index = 0); + }, TMP_Section_initialize_1.$$arity = -1); + Opal.alias(self, "name", "title"); + + Opal.def(self, '$generate_id', TMP_Section_generate_id_2 = function $$generate_id() { + var self = this; + + return $$($nesting, 'Section').$generate_id(self.$title(), self.document) + }, TMP_Section_generate_id_2.$$arity = 0); + + Opal.def(self, '$sectnum', TMP_Section_sectnum_3 = function $$sectnum(delimiter, append) { + var $a, self = this; + + + + if (delimiter == null) { + delimiter = "."; + }; + + if (append == null) { + append = nil; + }; + append = ($truthy($a = append) ? $a : (function() {if (append['$=='](false)) { + return "" + } else { + return delimiter + }; return nil; })()); + if (self.level['$=='](1)) { + return "" + (self.numeral) + (append) + } else if ($truthy($rb_gt(self.level, 1))) { + if ($truthy($$($nesting, 'Section')['$==='](self.parent))) { + return "" + (self.parent.$sectnum(delimiter, delimiter)) + (self.numeral) + (append) + } else { + return "" + (self.numeral) + (append) + } + } else { + return "" + ($$($nesting, 'Helpers').$int_to_roman(self.numeral.$to_i())) + (append) + }; + }, TMP_Section_sectnum_3.$$arity = -1); + + Opal.def(self, '$xreftext', TMP_Section_xreftext_4 = function $$xreftext(xrefstyle) { + var $a, self = this, val = nil, $case = nil, type = nil, quoted_title = nil, signifier = nil; + + + + if (xrefstyle == null) { + xrefstyle = nil; + }; + if ($truthy(($truthy($a = (val = self.$reftext())) ? val['$empty?']()['$!']() : $a))) { + return val + } else if ($truthy(xrefstyle)) { + if ($truthy(self.numbered)) { + return (function() {$case = xrefstyle; + if ("full"['$===']($case)) { + if ($truthy(($truthy($a = (type = self.sectname)['$==']("chapter")) ? $a : type['$==']("appendix")))) { + quoted_title = self.$sprintf(self.$sub_quotes("_%s_"), self.$title()) + } else { + quoted_title = self.$sprintf(self.$sub_quotes((function() {if ($truthy(self.document.$compat_mode())) { + return "``%s''" + } else { + return "\"`%s`\"" + }; return nil; })()), self.$title()) + }; + if ($truthy((signifier = self.document.$attributes()['$[]']("" + (type) + "-refsig")))) { + return "" + (signifier) + " " + (self.$sectnum(".", ",")) + " " + (quoted_title) + } else { + return "" + (self.$sectnum(".", ",")) + " " + (quoted_title) + };} + else if ("short"['$===']($case)) {if ($truthy((signifier = self.document.$attributes()['$[]']("" + (self.sectname) + "-refsig")))) { + return "" + (signifier) + " " + (self.$sectnum(".", "")) + } else { + return self.$sectnum(".", "") + }} + else {if ($truthy(($truthy($a = (type = self.sectname)['$==']("chapter")) ? $a : type['$==']("appendix")))) { + + return self.$sprintf(self.$sub_quotes("_%s_"), self.$title()); + } else { + return self.$title() + }}})() + } else if ($truthy(($truthy($a = (type = self.sectname)['$==']("chapter")) ? $a : type['$==']("appendix")))) { + + return self.$sprintf(self.$sub_quotes("_%s_"), self.$title()); + } else { + return self.$title() + } + } else { + return self.$title() + }; + }, TMP_Section_xreftext_4.$$arity = -1); + + Opal.def(self, '$<<', TMP_Section_$lt$lt_5 = function(block) { + var $iter = TMP_Section_$lt$lt_5.$$p, $yield = $iter || nil, self = this, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_Section_$lt$lt_5.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + + if (block.$context()['$==']("section")) { + self.$assign_numeral(block)}; + return $send(self, Opal.find_super_dispatcher(self, '<<', TMP_Section_$lt$lt_5, false), $zuper, $iter); + }, TMP_Section_$lt$lt_5.$$arity = 1); + + Opal.def(self, '$to_s', TMP_Section_to_s_6 = function $$to_s() { + var $iter = TMP_Section_to_s_6.$$p, $yield = $iter || nil, self = this, formal_title = nil, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_Section_to_s_6.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + if ($truthy(self.title)) { + + formal_title = (function() {if ($truthy(self.numbered)) { + return "" + (self.$sectnum()) + " " + (self.title) + } else { + return self.title + }; return nil; })(); + return "" + "#<" + (self.$class()) + "@" + (self.$object_id()) + " {level: " + (self.level) + ", title: " + (formal_title.$inspect()) + ", blocks: " + (self.blocks.$size()) + "}>"; + } else { + return $send(self, Opal.find_super_dispatcher(self, 'to_s', TMP_Section_to_s_6, false), $zuper, $iter) + } + }, TMP_Section_to_s_6.$$arity = 0); + return (Opal.defs(self, '$generate_id', TMP_Section_generate_id_7 = function $$generate_id(title, document) { + var $a, $b, self = this, attrs = nil, pre = nil, sep = nil, no_sep = nil, $writer = nil, sep_sub = nil, gen_id = nil, ids = nil, cnt = nil, candidate_id = nil; + + + attrs = document.$attributes(); + pre = ($truthy($a = attrs['$[]']("idprefix")) ? $a : "_"); + if ($truthy((sep = attrs['$[]']("idseparator")))) { + if ($truthy(($truthy($a = sep.$length()['$=='](1)) ? $a : ($truthy($b = (no_sep = sep['$empty?']())['$!']()) ? (sep = (($writer = ["idseparator", sep.$chr()]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])) : $b)))) { + sep_sub = (function() {if ($truthy(($truthy($a = sep['$==']("-")) ? $a : sep['$=='](".")))) { + return " .-" + } else { + return "" + " " + (sep) + ".-" + }; return nil; })()} + } else { + $a = ["_", " _.-"], (sep = $a[0]), (sep_sub = $a[1]), $a + }; + gen_id = "" + (pre) + (title.$downcase().$gsub($$($nesting, 'InvalidSectionIdCharsRx'), "")); + if ($truthy(no_sep)) { + gen_id = gen_id.$delete(" ") + } else { + + gen_id = gen_id.$tr_s(sep_sub, sep); + if ($truthy(gen_id['$end_with?'](sep))) { + gen_id = gen_id.$chop()}; + if ($truthy(($truthy($a = pre['$empty?']()) ? gen_id['$start_with?'](sep) : $a))) { + gen_id = gen_id.$slice(1, gen_id.$length())}; + }; + if ($truthy(document.$catalog()['$[]']("ids")['$key?'](gen_id))) { + + $a = [document.$catalog()['$[]']("ids"), $$($nesting, 'Compliance').$unique_id_start_index()], (ids = $a[0]), (cnt = $a[1]), $a; + while ($truthy(ids['$key?']((candidate_id = "" + (gen_id) + (sep) + (cnt))))) { + cnt = $rb_plus(cnt, 1) + }; + return candidate_id; + } else { + return gen_id + }; + }, TMP_Section_generate_id_7.$$arity = 2), nil) && 'generate_id'; + })($nesting[0], $$($nesting, 'AbstractBlock'), $nesting) + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/stylesheets"] = function(Opal) { + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $truthy = Opal.truthy, $hash2 = Opal.hash2, $gvars = Opal.gvars, $send = Opal.send; + + Opal.add_stubs(['$join', '$new', '$rstrip', '$read', '$primary_stylesheet_data', '$write', '$primary_stylesheet_name', '$coderay_stylesheet_data', '$coderay_stylesheet_name', '$load_pygments', '$=~', '$css', '$[]', '$sub', '$[]=', '$-', '$pygments_stylesheet_data', '$pygments_stylesheet_name', '$!', '$nil?', '$require_library']); + return (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + (function($base, $super, $parent_nesting) { + function $Stylesheets(){}; + var self = $Stylesheets = $klass($base, $super, 'Stylesheets', $Stylesheets); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Stylesheets_instance_1, TMP_Stylesheets_primary_stylesheet_name_2, TMP_Stylesheets_primary_stylesheet_data_3, TMP_Stylesheets_embed_primary_stylesheet_4, TMP_Stylesheets_write_primary_stylesheet_5, TMP_Stylesheets_coderay_stylesheet_name_6, TMP_Stylesheets_coderay_stylesheet_data_7, TMP_Stylesheets_embed_coderay_stylesheet_8, TMP_Stylesheets_write_coderay_stylesheet_9, TMP_Stylesheets_pygments_stylesheet_name_10, TMP_Stylesheets_pygments_background_11, TMP_Stylesheets_pygments_stylesheet_data_12, TMP_Stylesheets_embed_pygments_stylesheet_13, TMP_Stylesheets_write_pygments_stylesheet_14, TMP_Stylesheets_load_pygments_15; + + def.primary_stylesheet_data = def.coderay_stylesheet_data = def.pygments_stylesheet_data = nil; + + Opal.const_set($nesting[0], 'DEFAULT_STYLESHEET_NAME', "asciidoctor.css"); + Opal.const_set($nesting[0], 'DEFAULT_PYGMENTS_STYLE', "default"); + Opal.const_set($nesting[0], 'STYLESHEETS_DATA_PATH', $$$('::', 'File').$join($$($nesting, 'DATA_PATH'), "stylesheets")); + Opal.const_set($nesting[0], 'PygmentsBgColorRx', /^\.pygments +\{ *background: *([^;]+);/); + self.__instance__ = self.$new(); + Opal.defs(self, '$instance', TMP_Stylesheets_instance_1 = function $$instance() { + var self = this; + if (self.__instance__ == null) self.__instance__ = nil; + + return self.__instance__ + }, TMP_Stylesheets_instance_1.$$arity = 0); + + Opal.def(self, '$primary_stylesheet_name', TMP_Stylesheets_primary_stylesheet_name_2 = function $$primary_stylesheet_name() { + var self = this; + + return $$($nesting, 'DEFAULT_STYLESHEET_NAME') + }, TMP_Stylesheets_primary_stylesheet_name_2.$$arity = 0); + + Opal.def(self, '$primary_stylesheet_data', TMP_Stylesheets_primary_stylesheet_data_3 = function $$primary_stylesheet_data() { + +var File = Opal.const_get_relative([], "File"); +var stylesheetsPath; +if (Opal.const_get_relative([], "JAVASCRIPT_PLATFORM")["$=="]("node")) { + if (File.$basename(__dirname) === "node" && File.$basename(File.$dirname(__dirname)) === "dist") { + stylesheetsPath = File.$join(File.$dirname(__dirname), "css"); + } else { + stylesheetsPath = File.$join(__dirname, "css"); + } +} else if (Opal.const_get_relative([], "JAVASCRIPT_ENGINE")["$=="]("nashorn")) { + if (File.$basename(__DIR__) === "nashorn" && File.$basename(File.$dirname(__DIR__)) === "dist") { + stylesheetsPath = File.$join(File.$dirname(__DIR__), "css"); + } else { + stylesheetsPath = File.$join(__DIR__, "css"); + } +} else { + stylesheetsPath = "css"; +} +return ((($a = self.primary_stylesheet_data) !== false && $a !== nil && $a != null) ? $a : self.primary_stylesheet_data = Opal.const_get_relative([], "IO").$read(File.$join(stylesheetsPath, "asciidoctor.css")).$chomp()); + + }, TMP_Stylesheets_primary_stylesheet_data_3.$$arity = 0); + + Opal.def(self, '$embed_primary_stylesheet', TMP_Stylesheets_embed_primary_stylesheet_4 = function $$embed_primary_stylesheet() { + var self = this; + + return "" + "" + }, TMP_Stylesheets_embed_primary_stylesheet_4.$$arity = 0); + + Opal.def(self, '$write_primary_stylesheet', TMP_Stylesheets_write_primary_stylesheet_5 = function $$write_primary_stylesheet(target_dir) { + var self = this; + + + + if (target_dir == null) { + target_dir = "."; + }; + return $$$('::', 'IO').$write($$$('::', 'File').$join(target_dir, self.$primary_stylesheet_name()), self.$primary_stylesheet_data()); + }, TMP_Stylesheets_write_primary_stylesheet_5.$$arity = -1); + + Opal.def(self, '$coderay_stylesheet_name', TMP_Stylesheets_coderay_stylesheet_name_6 = function $$coderay_stylesheet_name() { + var self = this; + + return "coderay-asciidoctor.css" + }, TMP_Stylesheets_coderay_stylesheet_name_6.$$arity = 0); + + Opal.def(self, '$coderay_stylesheet_data', TMP_Stylesheets_coderay_stylesheet_data_7 = function $$coderay_stylesheet_data() { + var $a, self = this; + + return (self.coderay_stylesheet_data = ($truthy($a = self.coderay_stylesheet_data) ? $a : $$$('::', 'IO').$read($$$('::', 'File').$join($$($nesting, 'STYLESHEETS_DATA_PATH'), "coderay-asciidoctor.css")).$rstrip())) + }, TMP_Stylesheets_coderay_stylesheet_data_7.$$arity = 0); + + Opal.def(self, '$embed_coderay_stylesheet', TMP_Stylesheets_embed_coderay_stylesheet_8 = function $$embed_coderay_stylesheet() { + var self = this; + + return "" + "" + }, TMP_Stylesheets_embed_coderay_stylesheet_8.$$arity = 0); + + Opal.def(self, '$write_coderay_stylesheet', TMP_Stylesheets_write_coderay_stylesheet_9 = function $$write_coderay_stylesheet(target_dir) { + var self = this; + + + + if (target_dir == null) { + target_dir = "."; + }; + return $$$('::', 'IO').$write($$$('::', 'File').$join(target_dir, self.$coderay_stylesheet_name()), self.$coderay_stylesheet_data()); + }, TMP_Stylesheets_write_coderay_stylesheet_9.$$arity = -1); + + Opal.def(self, '$pygments_stylesheet_name', TMP_Stylesheets_pygments_stylesheet_name_10 = function $$pygments_stylesheet_name(style) { + var $a, self = this; + + + + if (style == null) { + style = nil; + }; + return "" + "pygments-" + (($truthy($a = style) ? $a : $$($nesting, 'DEFAULT_PYGMENTS_STYLE'))) + ".css"; + }, TMP_Stylesheets_pygments_stylesheet_name_10.$$arity = -1); + + Opal.def(self, '$pygments_background', TMP_Stylesheets_pygments_background_11 = function $$pygments_background(style) { + var $a, $b, self = this; + + + + if (style == null) { + style = nil; + }; + if ($truthy(($truthy($a = self.$load_pygments()) ? $$($nesting, 'PygmentsBgColorRx')['$=~']($$$('::', 'Pygments').$css(".pygments", $hash2(["style"], {"style": ($truthy($b = style) ? $b : $$($nesting, 'DEFAULT_PYGMENTS_STYLE'))}))) : $a))) { + return (($a = $gvars['~']) === nil ? nil : $a['$[]'](1)) + } else { + return nil + }; + }, TMP_Stylesheets_pygments_background_11.$$arity = -1); + + Opal.def(self, '$pygments_stylesheet_data', TMP_Stylesheets_pygments_stylesheet_data_12 = function $$pygments_stylesheet_data(style) { + var $a, $b, self = this, $writer = nil; + + + + if (style == null) { + style = nil; + }; + if ($truthy(self.$load_pygments())) { + + style = ($truthy($a = style) ? $a : $$($nesting, 'DEFAULT_PYGMENTS_STYLE')); + return ($truthy($a = (self.pygments_stylesheet_data = ($truthy($b = self.pygments_stylesheet_data) ? $b : $hash2([], {})))['$[]'](style)) ? $a : (($writer = [style, ($truthy($b = $$$('::', 'Pygments').$css(".listingblock .pygments", $hash2(["classprefix", "style"], {"classprefix": "tok-", "style": style}))) ? $b : "/* Failed to load Pygments CSS. */").$sub(".listingblock .pygments {", ".listingblock .pygments, .listingblock .pygments code {")]), $send((self.pygments_stylesheet_data = ($truthy($b = self.pygments_stylesheet_data) ? $b : $hash2([], {}))), '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + } else { + return "/* Pygments CSS disabled. Pygments is not available. */" + }; + }, TMP_Stylesheets_pygments_stylesheet_data_12.$$arity = -1); + + Opal.def(self, '$embed_pygments_stylesheet', TMP_Stylesheets_embed_pygments_stylesheet_13 = function $$embed_pygments_stylesheet(style) { + var self = this; + + + + if (style == null) { + style = nil; + }; + return "" + ""; + }, TMP_Stylesheets_embed_pygments_stylesheet_13.$$arity = -1); + + Opal.def(self, '$write_pygments_stylesheet', TMP_Stylesheets_write_pygments_stylesheet_14 = function $$write_pygments_stylesheet(target_dir, style) { + var self = this; + + + + if (target_dir == null) { + target_dir = "."; + }; + + if (style == null) { + style = nil; + }; + return $$$('::', 'IO').$write($$$('::', 'File').$join(target_dir, self.$pygments_stylesheet_name(style)), self.$pygments_stylesheet_data(style)); + }, TMP_Stylesheets_write_pygments_stylesheet_14.$$arity = -1); + return (Opal.def(self, '$load_pygments', TMP_Stylesheets_load_pygments_15 = function $$load_pygments() { + var $a, self = this; + + if ($truthy((($a = $$$('::', 'Pygments', 'skip_raise')) ? 'constant' : nil))) { + return true + } else { + return $$($nesting, 'Helpers').$require_library("pygments", "pygments.rb", "ignore")['$nil?']()['$!']() + } + }, TMP_Stylesheets_load_pygments_15.$$arity = 0), nil) && 'load_pygments'; + })($nesting[0], null, $nesting) + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/table"] = function(Opal) { + function $rb_gt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); + } + function $rb_lt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); + } + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + function $rb_times(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs * rhs : lhs['$*'](rhs); + } + function $rb_divide(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs / rhs : lhs['$/'](rhs); + } + function $rb_plus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $send = Opal.send, $truthy = Opal.truthy, $hash2 = Opal.hash2, $gvars = Opal.gvars; + + Opal.add_stubs(['$attr_accessor', '$attr_reader', '$new', '$key?', '$[]', '$>', '$to_i', '$<', '$==', '$[]=', '$-', '$attributes', '$round', '$*', '$/', '$to_f', '$empty?', '$body', '$each', '$<<', '$size', '$+', '$assign_column_widths', '$warn', '$logger', '$update_attributes', '$assign_width', '$shift', '$style=', '$head=', '$pop', '$foot=', '$parent', '$sourcemap', '$dup', '$header_row?', '$table', '$delete', '$start_with?', '$rstrip', '$slice', '$length', '$advance', '$lstrip', '$strip', '$split', '$include?', '$readlines', '$unshift', '$nil?', '$=~', '$catalog_inline_anchor', '$apply_subs', '$convert', '$map', '$text', '$!', '$file', '$lineno', '$to_s', '$include', '$to_set', '$mark', '$nested?', '$document', '$error', '$message_with_context', '$cursor_at_prev_line', '$nil_or_empty?', '$escape', '$columns', '$match', '$chop', '$end_with?', '$gsub', '$push_cellspec', '$cell_open?', '$close_cell', '$take_cellspec', '$squeeze', '$upto', '$times', '$cursor_before_mark', '$rowspan', '$activate_rowspan', '$colspan', '$end_of_row?', '$!=', '$close_row', '$rows', '$effective_column_visits']); + return (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + + (function($base, $super, $parent_nesting) { + function $Table(){}; + var self = $Table = $klass($base, $super, 'Table', $Table); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Table_initialize_3, TMP_Table_header_row$q_4, TMP_Table_create_columns_5, TMP_Table_assign_column_widths_7, TMP_Table_partition_header_footer_11; + + def.attributes = def.document = def.has_header_option = def.rows = def.columns = nil; + + Opal.const_set($nesting[0], 'DEFAULT_PRECISION_FACTOR', 10000); + (function($base, $super, $parent_nesting) { + function $Rows(){}; + var self = $Rows = $klass($base, $super, 'Rows', $Rows); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Rows_initialize_1, TMP_Rows_by_section_2; + + def.head = def.body = def.foot = nil; + + self.$attr_accessor("head", "foot", "body"); + + Opal.def(self, '$initialize', TMP_Rows_initialize_1 = function $$initialize(head, foot, body) { + var self = this; + + + + if (head == null) { + head = []; + }; + + if (foot == null) { + foot = []; + }; + + if (body == null) { + body = []; + }; + self.head = head; + self.foot = foot; + return (self.body = body); + }, TMP_Rows_initialize_1.$$arity = -1); + Opal.alias(self, "[]", "send"); + return (Opal.def(self, '$by_section', TMP_Rows_by_section_2 = function $$by_section() { + var self = this; + + return [["head", self.head], ["body", self.body], ["foot", self.foot]] + }, TMP_Rows_by_section_2.$$arity = 0), nil) && 'by_section'; + })($nesting[0], null, $nesting); + self.$attr_accessor("columns"); + self.$attr_accessor("rows"); + self.$attr_accessor("has_header_option"); + self.$attr_reader("caption"); + + Opal.def(self, '$initialize', TMP_Table_initialize_3 = function $$initialize(parent, attributes) { + var $a, $b, $iter = TMP_Table_initialize_3.$$p, $yield = $iter || nil, self = this, pcwidth = nil, pcwidth_intval = nil, $writer = nil; + + if ($iter) TMP_Table_initialize_3.$$p = null; + + $send(self, Opal.find_super_dispatcher(self, 'initialize', TMP_Table_initialize_3, false), [parent, "table"], null); + self.rows = $$($nesting, 'Rows').$new(); + self.columns = []; + self.has_header_option = attributes['$key?']("header-option"); + if ($truthy((pcwidth = attributes['$[]']("width")))) { + if ($truthy(($truthy($a = $rb_gt((pcwidth_intval = pcwidth.$to_i()), 100)) ? $a : $rb_lt(pcwidth_intval, 1)))) { + if ($truthy((($a = pcwidth_intval['$=='](0)) ? ($truthy($b = pcwidth['$==']("0")) ? $b : pcwidth['$==']("0%")) : pcwidth_intval['$=='](0)))) { + } else { + pcwidth_intval = 100 + }} + } else { + pcwidth_intval = 100 + }; + + $writer = ["tablepcwidth", pcwidth_intval]; + $send(self.attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + if ($truthy(self.document.$attributes()['$key?']("pagewidth"))) { + ($truthy($a = self.attributes['$[]']("tableabswidth")) ? $a : (($writer = ["tableabswidth", $rb_times($rb_divide(self.attributes['$[]']("tablepcwidth").$to_f(), 100), self.document.$attributes()['$[]']("pagewidth")).$round()]), $send(self.attributes, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]))}; + if ($truthy(attributes['$key?']("rotate-option"))) { + + $writer = ["orientation", "landscape"]; + $send(attributes, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + } else { + return nil + }; + }, TMP_Table_initialize_3.$$arity = 2); + + Opal.def(self, '$header_row?', TMP_Table_header_row$q_4 = function() { + var $a, self = this; + + return ($truthy($a = self.has_header_option) ? self.rows.$body()['$empty?']() : $a) + }, TMP_Table_header_row$q_4.$$arity = 0); + + Opal.def(self, '$create_columns', TMP_Table_create_columns_5 = function $$create_columns(colspecs) { + var TMP_6, $a, self = this, cols = nil, autowidth_cols = nil, width_base = nil, num_cols = nil, $writer = nil; + + + cols = []; + autowidth_cols = nil; + width_base = 0; + $send(colspecs, 'each', [], (TMP_6 = function(colspec){var self = TMP_6.$$s || this, $a, colwidth = nil; + + + + if (colspec == null) { + colspec = nil; + }; + colwidth = colspec['$[]']("width"); + cols['$<<']($$($nesting, 'Column').$new(self, cols.$size(), colspec)); + if ($truthy($rb_lt(colwidth, 0))) { + return (autowidth_cols = ($truthy($a = autowidth_cols) ? $a : []))['$<<'](cols['$[]'](-1)) + } else { + return (width_base = $rb_plus(width_base, colwidth)) + };}, TMP_6.$$s = self, TMP_6.$$arity = 1, TMP_6)); + if ($truthy($rb_gt((num_cols = (self.columns = cols).$size()), 0))) { + + + $writer = ["colcount", num_cols]; + $send(self.attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + if ($truthy(($truthy($a = $rb_gt(width_base, 0)) ? $a : autowidth_cols))) { + } else { + width_base = nil + }; + self.$assign_column_widths(width_base, autowidth_cols);}; + return nil; + }, TMP_Table_create_columns_5.$$arity = 1); + + Opal.def(self, '$assign_column_widths', TMP_Table_assign_column_widths_7 = function $$assign_column_widths(width_base, autowidth_cols) { + var TMP_8, TMP_9, TMP_10, self = this, pf = nil, total_width = nil, col_pcwidth = nil, autowidth = nil, autowidth_attrs = nil; + + + + if (width_base == null) { + width_base = nil; + }; + + if (autowidth_cols == null) { + autowidth_cols = nil; + }; + pf = $$($nesting, 'DEFAULT_PRECISION_FACTOR'); + total_width = (col_pcwidth = 0); + if ($truthy(width_base)) { + + if ($truthy(autowidth_cols)) { + + if ($truthy($rb_gt(width_base, 100))) { + + autowidth = 0; + self.$logger().$warn("" + "total column width must not exceed 100% when using autowidth columns; got " + (width_base) + "%"); + } else { + + autowidth = $rb_divide($rb_times($rb_divide($rb_minus(100, width_base), autowidth_cols.$size()), pf).$to_i(), pf); + if (autowidth.$to_i()['$=='](autowidth)) { + autowidth = autowidth.$to_i()}; + width_base = 100; + }; + autowidth_attrs = $hash2(["width", "autowidth-option"], {"width": autowidth, "autowidth-option": ""}); + $send(autowidth_cols, 'each', [], (TMP_8 = function(col){var self = TMP_8.$$s || this; + + + + if (col == null) { + col = nil; + }; + return col.$update_attributes(autowidth_attrs);}, TMP_8.$$s = self, TMP_8.$$arity = 1, TMP_8));}; + $send(self.columns, 'each', [], (TMP_9 = function(col){var self = TMP_9.$$s || this; + + + + if (col == null) { + col = nil; + }; + return (total_width = $rb_plus(total_width, (col_pcwidth = col.$assign_width(nil, width_base, pf))));}, TMP_9.$$s = self, TMP_9.$$arity = 1, TMP_9)); + } else { + + col_pcwidth = $rb_divide($rb_divide($rb_times(100, pf), self.columns.$size()).$to_i(), pf); + if (col_pcwidth.$to_i()['$=='](col_pcwidth)) { + col_pcwidth = col_pcwidth.$to_i()}; + $send(self.columns, 'each', [], (TMP_10 = function(col){var self = TMP_10.$$s || this; + + + + if (col == null) { + col = nil; + }; + return (total_width = $rb_plus(total_width, col.$assign_width(col_pcwidth)));}, TMP_10.$$s = self, TMP_10.$$arity = 1, TMP_10)); + }; + if (total_width['$=='](100)) { + } else { + self.columns['$[]'](-1).$assign_width($rb_divide($rb_times($rb_plus($rb_minus(100, total_width), col_pcwidth), pf).$round(), pf)) + }; + return nil; + }, TMP_Table_assign_column_widths_7.$$arity = -1); + return (Opal.def(self, '$partition_header_footer', TMP_Table_partition_header_footer_11 = function $$partition_header_footer(attrs) { + var $a, TMP_12, self = this, $writer = nil, num_body_rows = nil, head = nil; + + + + $writer = ["rowcount", self.rows.$body().$size()]; + $send(self.attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + num_body_rows = self.rows.$body().$size(); + if ($truthy(($truthy($a = $rb_gt(num_body_rows, 0)) ? self.has_header_option : $a))) { + + head = self.rows.$body().$shift(); + num_body_rows = $rb_minus(num_body_rows, 1); + $send(head, 'each', [], (TMP_12 = function(c){var self = TMP_12.$$s || this; + + + + if (c == null) { + c = nil; + }; + $writer = [nil]; + $send(c, 'style=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];}, TMP_12.$$s = self, TMP_12.$$arity = 1, TMP_12)); + + $writer = [[head]]; + $send(self.rows, 'head=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];;}; + if ($truthy(($truthy($a = $rb_gt(num_body_rows, 0)) ? attrs['$key?']("footer-option") : $a))) { + + $writer = [[self.rows.$body().$pop()]]; + $send(self.rows, 'foot=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + return nil; + }, TMP_Table_partition_header_footer_11.$$arity = 1), nil) && 'partition_header_footer'; + })($nesting[0], $$($nesting, 'AbstractBlock'), $nesting); + (function($base, $super, $parent_nesting) { + function $Column(){}; + var self = $Column = $klass($base, $super, 'Column', $Column); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Column_initialize_13, TMP_Column_assign_width_14; + + def.attributes = nil; + + self.$attr_accessor("style"); + + Opal.def(self, '$initialize', TMP_Column_initialize_13 = function $$initialize(table, index, attributes) { + var $a, $iter = TMP_Column_initialize_13.$$p, $yield = $iter || nil, self = this, $writer = nil; + + if ($iter) TMP_Column_initialize_13.$$p = null; + + + if (attributes == null) { + attributes = $hash2([], {}); + }; + $send(self, Opal.find_super_dispatcher(self, 'initialize', TMP_Column_initialize_13, false), [table, "column"], null); + self.style = attributes['$[]']("style"); + + $writer = ["colnumber", $rb_plus(index, 1)]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + ($truthy($a = attributes['$[]']("width")) ? $a : (($writer = ["width", 1]), $send(attributes, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + ($truthy($a = attributes['$[]']("halign")) ? $a : (($writer = ["halign", "left"]), $send(attributes, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + ($truthy($a = attributes['$[]']("valign")) ? $a : (($writer = ["valign", "top"]), $send(attributes, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + return self.$update_attributes(attributes); + }, TMP_Column_initialize_13.$$arity = -3); + Opal.alias(self, "table", "parent"); + return (Opal.def(self, '$assign_width', TMP_Column_assign_width_14 = function $$assign_width(col_pcwidth, width_base, pf) { + var self = this, $writer = nil; + + + + if (width_base == null) { + width_base = nil; + }; + + if (pf == null) { + pf = 10000; + }; + if ($truthy(width_base)) { + + col_pcwidth = $rb_divide($rb_times($rb_times($rb_divide(self.attributes['$[]']("width").$to_f(), width_base), 100), pf).$to_i(), pf); + if (col_pcwidth.$to_i()['$=='](col_pcwidth)) { + col_pcwidth = col_pcwidth.$to_i()};}; + + $writer = ["colpcwidth", col_pcwidth]; + $send(self.attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + if ($truthy(self.$parent().$attributes()['$key?']("tableabswidth"))) { + + $writer = ["colabswidth", $rb_times($rb_divide(col_pcwidth, 100), self.$parent().$attributes()['$[]']("tableabswidth")).$round()]; + $send(self.attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + return col_pcwidth; + }, TMP_Column_assign_width_14.$$arity = -2), nil) && 'assign_width'; + })($$($nesting, 'Table'), $$($nesting, 'AbstractNode'), $nesting); + (function($base, $super, $parent_nesting) { + function $Cell(){}; + var self = $Cell = $klass($base, $super, 'Cell', $Cell); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Cell_initialize_15, TMP_Cell_text_16, TMP_Cell_text$eq_17, TMP_Cell_content_18, TMP_Cell_file_20, TMP_Cell_lineno_21, TMP_Cell_to_s_22; + + def.document = def.text = def.subs = def.style = def.inner_document = def.source_location = def.colspan = def.rowspan = def.attributes = nil; + + self.$attr_reader("source_location"); + self.$attr_accessor("style"); + self.$attr_accessor("subs"); + self.$attr_accessor("colspan"); + self.$attr_accessor("rowspan"); + Opal.alias(self, "column", "parent"); + self.$attr_reader("inner_document"); + + Opal.def(self, '$initialize', TMP_Cell_initialize_15 = function $$initialize(column, cell_text, attributes, opts) { + var $a, $b, $iter = TMP_Cell_initialize_15.$$p, $yield = $iter || nil, self = this, in_header_row = nil, cell_style = nil, asciidoc = nil, inner_document_cursor = nil, lines_advanced = nil, literal = nil, normal_psv = nil, parent_doctitle = nil, inner_document_lines = nil, unprocessed_line1 = nil, preprocessed_lines = nil, $writer = nil; + + if ($iter) TMP_Cell_initialize_15.$$p = null; + + + if (attributes == null) { + attributes = $hash2([], {}); + }; + + if (opts == null) { + opts = $hash2([], {}); + }; + $send(self, Opal.find_super_dispatcher(self, 'initialize', TMP_Cell_initialize_15, false), [column, "cell"], null); + if ($truthy(self.document.$sourcemap())) { + self.source_location = opts['$[]']("cursor").$dup()}; + if ($truthy(column)) { + + if ($truthy((in_header_row = column.$table()['$header_row?']()))) { + } else { + cell_style = column.$attributes()['$[]']("style") + }; + self.$update_attributes(column.$attributes());}; + if ($truthy(attributes)) { + + if ($truthy(attributes['$empty?']())) { + self.colspan = (self.rowspan = nil) + } else { + + $a = [attributes.$delete("colspan"), attributes.$delete("rowspan")], (self.colspan = $a[0]), (self.rowspan = $a[1]), $a; + if ($truthy(in_header_row)) { + } else { + cell_style = ($truthy($a = attributes['$[]']("style")) ? $a : cell_style) + }; + self.$update_attributes(attributes); + }; + if (cell_style['$==']("asciidoc")) { + + asciidoc = true; + inner_document_cursor = opts['$[]']("cursor"); + if ($truthy((cell_text = cell_text.$rstrip())['$start_with?']($$($nesting, 'LF')))) { + + lines_advanced = 1; + while ($truthy((cell_text = cell_text.$slice(1, cell_text.$length()))['$start_with?']($$($nesting, 'LF')))) { + lines_advanced = $rb_plus(lines_advanced, 1) + }; + inner_document_cursor.$advance(lines_advanced); + } else { + cell_text = cell_text.$lstrip() + }; + } else if ($truthy(($truthy($a = (literal = cell_style['$==']("literal"))) ? $a : cell_style['$==']("verse")))) { + + cell_text = cell_text.$rstrip(); + while ($truthy(cell_text['$start_with?']($$($nesting, 'LF')))) { + cell_text = cell_text.$slice(1, cell_text.$length()) + }; + } else { + + normal_psv = true; + cell_text = (function() {if ($truthy(cell_text)) { + return cell_text.$strip() + } else { + return "" + }; return nil; })(); + }; + } else { + + self.colspan = (self.rowspan = nil); + if (cell_style['$==']("asciidoc")) { + + asciidoc = true; + inner_document_cursor = opts['$[]']("cursor");}; + }; + if ($truthy(asciidoc)) { + + parent_doctitle = self.document.$attributes().$delete("doctitle"); + inner_document_lines = cell_text.$split($$($nesting, 'LF'), -1); + if ($truthy(inner_document_lines['$empty?']())) { + } else if ($truthy((unprocessed_line1 = inner_document_lines['$[]'](0))['$include?']("::"))) { + + preprocessed_lines = $$($nesting, 'PreprocessorReader').$new(self.document, [unprocessed_line1]).$readlines(); + if ($truthy((($a = unprocessed_line1['$=='](preprocessed_lines['$[]'](0))) ? $rb_lt(preprocessed_lines.$size(), 2) : unprocessed_line1['$=='](preprocessed_lines['$[]'](0))))) { + } else { + + inner_document_lines.$shift(); + if ($truthy(preprocessed_lines['$empty?']())) { + } else { + $send(inner_document_lines, 'unshift', Opal.to_a(preprocessed_lines)) + }; + };}; + self.inner_document = $$($nesting, 'Document').$new(inner_document_lines, $hash2(["header_footer", "parent", "cursor"], {"header_footer": false, "parent": self.document, "cursor": inner_document_cursor})); + if ($truthy(parent_doctitle['$nil?']())) { + } else { + + $writer = ["doctitle", parent_doctitle]; + $send(self.document.$attributes(), '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + self.subs = nil; + } else if ($truthy(literal)) { + self.subs = $$($nesting, 'BASIC_SUBS') + } else { + + if ($truthy(($truthy($a = ($truthy($b = normal_psv) ? cell_text['$start_with?']("[[") : $b)) ? $$($nesting, 'LeadingInlineAnchorRx')['$=~'](cell_text) : $a))) { + $$($nesting, 'Parser').$catalog_inline_anchor((($a = $gvars['~']) === nil ? nil : $a['$[]'](1)), (($a = $gvars['~']) === nil ? nil : $a['$[]'](2)), self, opts['$[]']("cursor"), self.document)}; + self.subs = $$($nesting, 'NORMAL_SUBS'); + }; + self.text = cell_text; + return (self.style = cell_style); + }, TMP_Cell_initialize_15.$$arity = -3); + + Opal.def(self, '$text', TMP_Cell_text_16 = function $$text() { + var self = this; + + return self.$apply_subs(self.text, self.subs) + }, TMP_Cell_text_16.$$arity = 0); + + Opal.def(self, '$text=', TMP_Cell_text$eq_17 = function(val) { + var self = this; + + return (self.text = val) + }, TMP_Cell_text$eq_17.$$arity = 1); + + Opal.def(self, '$content', TMP_Cell_content_18 = function $$content() { + var TMP_19, self = this; + + if (self.style['$==']("asciidoc")) { + return self.inner_document.$convert() + } else { + return $send(self.$text().$split($$($nesting, 'BlankLineRx')), 'map', [], (TMP_19 = function(p){var self = TMP_19.$$s || this, $a; + if (self.style == null) self.style = nil; + + + + if (p == null) { + p = nil; + }; + if ($truthy(($truthy($a = self.style['$!']()) ? $a : self.style['$==']("header")))) { + return p + } else { + return $$($nesting, 'Inline').$new(self.$parent(), "quoted", p, $hash2(["type"], {"type": self.style})).$convert() + };}, TMP_19.$$s = self, TMP_19.$$arity = 1, TMP_19)) + } + }, TMP_Cell_content_18.$$arity = 0); + + Opal.def(self, '$file', TMP_Cell_file_20 = function $$file() { + var $a, self = this; + + return ($truthy($a = self.source_location) ? self.source_location.$file() : $a) + }, TMP_Cell_file_20.$$arity = 0); + + Opal.def(self, '$lineno', TMP_Cell_lineno_21 = function $$lineno() { + var $a, self = this; + + return ($truthy($a = self.source_location) ? self.source_location.$lineno() : $a) + }, TMP_Cell_lineno_21.$$arity = 0); + return (Opal.def(self, '$to_s', TMP_Cell_to_s_22 = function $$to_s() { + var $a, $iter = TMP_Cell_to_s_22.$$p, $yield = $iter || nil, self = this, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_Cell_to_s_22.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + return "" + ($send(self, Opal.find_super_dispatcher(self, 'to_s', TMP_Cell_to_s_22, false), $zuper, $iter).$to_s()) + " - [text: " + (self.text) + ", colspan: " + (($truthy($a = self.colspan) ? $a : 1)) + ", rowspan: " + (($truthy($a = self.rowspan) ? $a : 1)) + ", attributes: " + (self.attributes) + "]" + }, TMP_Cell_to_s_22.$$arity = 0), nil) && 'to_s'; + })($$($nesting, 'Table'), $$($nesting, 'AbstractNode'), $nesting); + (function($base, $super, $parent_nesting) { + function $ParserContext(){}; + var self = $ParserContext = $klass($base, $super, 'ParserContext', $ParserContext); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_ParserContext_initialize_23, TMP_ParserContext_starts_with_delimiter$q_24, TMP_ParserContext_match_delimiter_25, TMP_ParserContext_skip_past_delimiter_26, TMP_ParserContext_skip_past_escaped_delimiter_27, TMP_ParserContext_buffer_has_unclosed_quotes$q_28, TMP_ParserContext_take_cellspec_29, TMP_ParserContext_push_cellspec_30, TMP_ParserContext_keep_cell_open_31, TMP_ParserContext_mark_cell_closed_32, TMP_ParserContext_cell_open$q_33, TMP_ParserContext_cell_closed$q_34, TMP_ParserContext_close_open_cell_35, TMP_ParserContext_close_cell_36, TMP_ParserContext_close_row_39, TMP_ParserContext_activate_rowspan_40, TMP_ParserContext_end_of_row$q_42, TMP_ParserContext_effective_column_visits_43, TMP_ParserContext_advance_44; + + def.delimiter = def.delimiter_re = def.buffer = def.cellspecs = def.cell_open = def.format = def.start_cursor_data = def.reader = def.table = def.current_row = def.colcount = def.column_visits = def.active_rowspans = def.linenum = nil; + + self.$include($$($nesting, 'Logging')); + Opal.const_set($nesting[0], 'FORMATS', ["psv", "csv", "dsv", "tsv"].$to_set()); + Opal.const_set($nesting[0], 'DELIMITERS', $hash2(["psv", "csv", "dsv", "tsv", "!sv"], {"psv": ["|", /\|/], "csv": [",", /,/], "dsv": [":", /:/], "tsv": ["\t", /\t/], "!sv": ["!", /!/]})); + self.$attr_accessor("table"); + self.$attr_accessor("format"); + self.$attr_reader("colcount"); + self.$attr_accessor("buffer"); + self.$attr_reader("delimiter"); + self.$attr_reader("delimiter_re"); + + Opal.def(self, '$initialize', TMP_ParserContext_initialize_23 = function $$initialize(reader, table, attributes) { + var $a, $b, self = this, xsv = nil, sep = nil; + + + + if (attributes == null) { + attributes = $hash2([], {}); + }; + self.start_cursor_data = (self.reader = reader).$mark(); + self.table = table; + if ($truthy(attributes['$key?']("format"))) { + if ($truthy($$($nesting, 'FORMATS')['$include?']((xsv = attributes['$[]']("format"))))) { + if (xsv['$==']("tsv")) { + self.format = "csv" + } else if ($truthy((($a = (self.format = xsv)['$==']("psv")) ? table.$document()['$nested?']() : (self.format = xsv)['$==']("psv")))) { + xsv = "!sv"} + } else { + + self.$logger().$error(self.$message_with_context("" + "illegal table format: " + (xsv), $hash2(["source_location"], {"source_location": reader.$cursor_at_prev_line()}))); + $a = ["psv", (function() {if ($truthy(table.$document()['$nested?']())) { + return "!sv" + } else { + return "psv" + }; return nil; })()], (self.format = $a[0]), (xsv = $a[1]), $a; + } + } else { + $a = ["psv", (function() {if ($truthy(table.$document()['$nested?']())) { + return "!sv" + } else { + return "psv" + }; return nil; })()], (self.format = $a[0]), (xsv = $a[1]), $a + }; + if ($truthy(attributes['$key?']("separator"))) { + if ($truthy((sep = attributes['$[]']("separator"))['$nil_or_empty?']())) { + $b = $$($nesting, 'DELIMITERS')['$[]'](xsv), $a = Opal.to_ary($b), (self.delimiter = ($a[0] == null ? nil : $a[0])), (self.delimiter_re = ($a[1] == null ? nil : $a[1])), $b + } else if (sep['$==']("\\t")) { + $b = $$($nesting, 'DELIMITERS')['$[]']("tsv"), $a = Opal.to_ary($b), (self.delimiter = ($a[0] == null ? nil : $a[0])), (self.delimiter_re = ($a[1] == null ? nil : $a[1])), $b + } else { + $a = [sep, new RegExp($$$('::', 'Regexp').$escape(sep))], (self.delimiter = $a[0]), (self.delimiter_re = $a[1]), $a + } + } else { + $b = $$($nesting, 'DELIMITERS')['$[]'](xsv), $a = Opal.to_ary($b), (self.delimiter = ($a[0] == null ? nil : $a[0])), (self.delimiter_re = ($a[1] == null ? nil : $a[1])), $b + }; + self.colcount = (function() {if ($truthy(table.$columns()['$empty?']())) { + return -1 + } else { + return table.$columns().$size() + }; return nil; })(); + self.buffer = ""; + self.cellspecs = []; + self.cell_open = false; + self.active_rowspans = [0]; + self.column_visits = 0; + self.current_row = []; + return (self.linenum = -1); + }, TMP_ParserContext_initialize_23.$$arity = -3); + + Opal.def(self, '$starts_with_delimiter?', TMP_ParserContext_starts_with_delimiter$q_24 = function(line) { + var self = this; + + return line['$start_with?'](self.delimiter) + }, TMP_ParserContext_starts_with_delimiter$q_24.$$arity = 1); + + Opal.def(self, '$match_delimiter', TMP_ParserContext_match_delimiter_25 = function $$match_delimiter(line) { + var self = this; + + return self.delimiter_re.$match(line) + }, TMP_ParserContext_match_delimiter_25.$$arity = 1); + + Opal.def(self, '$skip_past_delimiter', TMP_ParserContext_skip_past_delimiter_26 = function $$skip_past_delimiter(pre) { + var self = this; + + + self.buffer = "" + (self.buffer) + (pre) + (self.delimiter); + return nil; + }, TMP_ParserContext_skip_past_delimiter_26.$$arity = 1); + + Opal.def(self, '$skip_past_escaped_delimiter', TMP_ParserContext_skip_past_escaped_delimiter_27 = function $$skip_past_escaped_delimiter(pre) { + var self = this; + + + self.buffer = "" + (self.buffer) + (pre.$chop()) + (self.delimiter); + return nil; + }, TMP_ParserContext_skip_past_escaped_delimiter_27.$$arity = 1); + + Opal.def(self, '$buffer_has_unclosed_quotes?', TMP_ParserContext_buffer_has_unclosed_quotes$q_28 = function(append) { + var $a, $b, self = this, record = nil, trailing_quote = nil; + + + + if (append == null) { + append = nil; + }; + if ((record = (function() {if ($truthy(append)) { + return $rb_plus(self.buffer, append).$strip() + } else { + return self.buffer.$strip() + }; return nil; })())['$==']("\"")) { + return true + } else if ($truthy(record['$start_with?']("\""))) { + if ($truthy(($truthy($a = ($truthy($b = (trailing_quote = record['$end_with?']("\""))) ? record['$end_with?']("\"\"") : $b)) ? $a : record['$start_with?']("\"\"")))) { + return ($truthy($a = (record = record.$gsub("\"\"", ""))['$start_with?']("\"")) ? record['$end_with?']("\"")['$!']() : $a) + } else { + return trailing_quote['$!']() + } + } else { + return false + }; + }, TMP_ParserContext_buffer_has_unclosed_quotes$q_28.$$arity = -1); + + Opal.def(self, '$take_cellspec', TMP_ParserContext_take_cellspec_29 = function $$take_cellspec() { + var self = this; + + return self.cellspecs.$shift() + }, TMP_ParserContext_take_cellspec_29.$$arity = 0); + + Opal.def(self, '$push_cellspec', TMP_ParserContext_push_cellspec_30 = function $$push_cellspec(cellspec) { + var $a, self = this; + + + + if (cellspec == null) { + cellspec = $hash2([], {}); + }; + self.cellspecs['$<<'](($truthy($a = cellspec) ? $a : $hash2([], {}))); + return nil; + }, TMP_ParserContext_push_cellspec_30.$$arity = -1); + + Opal.def(self, '$keep_cell_open', TMP_ParserContext_keep_cell_open_31 = function $$keep_cell_open() { + var self = this; + + + self.cell_open = true; + return nil; + }, TMP_ParserContext_keep_cell_open_31.$$arity = 0); + + Opal.def(self, '$mark_cell_closed', TMP_ParserContext_mark_cell_closed_32 = function $$mark_cell_closed() { + var self = this; + + + self.cell_open = false; + return nil; + }, TMP_ParserContext_mark_cell_closed_32.$$arity = 0); + + Opal.def(self, '$cell_open?', TMP_ParserContext_cell_open$q_33 = function() { + var self = this; + + return self.cell_open + }, TMP_ParserContext_cell_open$q_33.$$arity = 0); + + Opal.def(self, '$cell_closed?', TMP_ParserContext_cell_closed$q_34 = function() { + var self = this; + + return self.cell_open['$!']() + }, TMP_ParserContext_cell_closed$q_34.$$arity = 0); + + Opal.def(self, '$close_open_cell', TMP_ParserContext_close_open_cell_35 = function $$close_open_cell(next_cellspec) { + var self = this; + + + + if (next_cellspec == null) { + next_cellspec = $hash2([], {}); + }; + self.$push_cellspec(next_cellspec); + if ($truthy(self['$cell_open?']())) { + self.$close_cell(true)}; + self.$advance(); + return nil; + }, TMP_ParserContext_close_open_cell_35.$$arity = -1); + + Opal.def(self, '$close_cell', TMP_ParserContext_close_cell_36 = function $$close_cell(eol) {try { + + var $a, $b, TMP_37, self = this, cell_text = nil, cellspec = nil, repeat = nil; + + + + if (eol == null) { + eol = false; + }; + if (self.format['$==']("psv")) { + + cell_text = self.buffer; + self.buffer = ""; + if ($truthy((cellspec = self.$take_cellspec()))) { + repeat = ($truthy($a = cellspec.$delete("repeatcol")) ? $a : 1) + } else { + + self.$logger().$error(self.$message_with_context("table missing leading separator; recovering automatically", $hash2(["source_location"], {"source_location": $send($$$($$($nesting, 'Reader'), 'Cursor'), 'new', Opal.to_a(self.start_cursor_data))}))); + cellspec = $hash2([], {}); + repeat = 1; + }; + } else { + + cell_text = self.buffer.$strip(); + self.buffer = ""; + cellspec = nil; + repeat = 1; + if ($truthy(($truthy($a = (($b = self.format['$==']("csv")) ? cell_text['$empty?']()['$!']() : self.format['$==']("csv"))) ? cell_text['$include?']("\"") : $a))) { + if ($truthy(($truthy($a = cell_text['$start_with?']("\"")) ? cell_text['$end_with?']("\"") : $a))) { + if ($truthy((cell_text = cell_text.$slice(1, $rb_minus(cell_text.$length(), 2))))) { + cell_text = cell_text.$strip().$squeeze("\"") + } else { + + self.$logger().$error(self.$message_with_context("unclosed quote in CSV data; setting cell to empty", $hash2(["source_location"], {"source_location": self.reader.$cursor_at_prev_line()}))); + cell_text = ""; + } + } else { + cell_text = cell_text.$squeeze("\"") + }}; + }; + $send((1), 'upto', [repeat], (TMP_37 = function(i){var self = TMP_37.$$s || this, $c, $d, TMP_38, $e, column = nil, extra_cols = nil, offset = nil, cell = nil; + if (self.colcount == null) self.colcount = nil; + if (self.table == null) self.table = nil; + if (self.current_row == null) self.current_row = nil; + if (self.reader == null) self.reader = nil; + if (self.column_visits == null) self.column_visits = nil; + if (self.linenum == null) self.linenum = nil; + + + + if (i == null) { + i = nil; + }; + if (self.colcount['$=='](-1)) { + + self.table.$columns()['$<<']((column = $$$($$($nesting, 'Table'), 'Column').$new(self.table, $rb_minus($rb_plus(self.table.$columns().$size(), i), 1)))); + if ($truthy(($truthy($c = ($truthy($d = cellspec) ? cellspec['$key?']("colspan") : $d)) ? $rb_gt((extra_cols = $rb_minus(cellspec['$[]']("colspan").$to_i(), 1)), 0) : $c))) { + + offset = self.table.$columns().$size(); + $send(extra_cols, 'times', [], (TMP_38 = function(j){var self = TMP_38.$$s || this; + if (self.table == null) self.table = nil; + + + + if (j == null) { + j = nil; + }; + return self.table.$columns()['$<<']($$$($$($nesting, 'Table'), 'Column').$new(self.table, $rb_plus(offset, j)));}, TMP_38.$$s = self, TMP_38.$$arity = 1, TMP_38));}; + } else if ($truthy((column = self.table.$columns()['$[]'](self.current_row.$size())))) { + } else { + + self.$logger().$error(self.$message_with_context("dropping cell because it exceeds specified number of columns", $hash2(["source_location"], {"source_location": self.reader.$cursor_before_mark()}))); + Opal.ret(nil); + }; + cell = $$$($$($nesting, 'Table'), 'Cell').$new(column, cell_text, cellspec, $hash2(["cursor"], {"cursor": self.reader.$cursor_before_mark()})); + self.reader.$mark(); + if ($truthy(($truthy($c = cell.$rowspan()['$!']()) ? $c : cell.$rowspan()['$=='](1)))) { + } else { + self.$activate_rowspan(cell.$rowspan(), ($truthy($c = cell.$colspan()) ? $c : 1)) + }; + self.column_visits = $rb_plus(self.column_visits, ($truthy($c = cell.$colspan()) ? $c : 1)); + self.current_row['$<<'](cell); + if ($truthy(($truthy($c = self['$end_of_row?']()) ? ($truthy($d = ($truthy($e = self.colcount['$!='](-1)) ? $e : $rb_gt(self.linenum, 0))) ? $d : ($truthy($e = eol) ? i['$=='](repeat) : $e)) : $c))) { + return self.$close_row() + } else { + return nil + };}, TMP_37.$$s = self, TMP_37.$$arity = 1, TMP_37)); + self.cell_open = false; + return nil; + } catch ($returner) { if ($returner === Opal.returner) { return $returner.$v } throw $returner; } + }, TMP_ParserContext_close_cell_36.$$arity = -1); + + Opal.def(self, '$close_row', TMP_ParserContext_close_row_39 = function $$close_row() { + var $a, self = this, $writer = nil; + + + self.table.$rows().$body()['$<<'](self.current_row); + if (self.colcount['$=='](-1)) { + self.colcount = self.column_visits}; + self.column_visits = 0; + self.current_row = []; + self.active_rowspans.$shift(); + ($truthy($a = self.active_rowspans['$[]'](0)) ? $a : (($writer = [0, 0]), $send(self.active_rowspans, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + return nil; + }, TMP_ParserContext_close_row_39.$$arity = 0); + + Opal.def(self, '$activate_rowspan', TMP_ParserContext_activate_rowspan_40 = function $$activate_rowspan(rowspan, colspan) { + var TMP_41, self = this; + + + $send((1).$upto($rb_minus(rowspan, 1)), 'each', [], (TMP_41 = function(i){var self = TMP_41.$$s || this, $a, $writer = nil; + if (self.active_rowspans == null) self.active_rowspans = nil; + + + + if (i == null) { + i = nil; + }; + $writer = [i, $rb_plus(($truthy($a = self.active_rowspans['$[]'](i)) ? $a : 0), colspan)]; + $send(self.active_rowspans, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];}, TMP_41.$$s = self, TMP_41.$$arity = 1, TMP_41)); + return nil; + }, TMP_ParserContext_activate_rowspan_40.$$arity = 2); + + Opal.def(self, '$end_of_row?', TMP_ParserContext_end_of_row$q_42 = function() { + var $a, self = this; + + return ($truthy($a = self.colcount['$=='](-1)) ? $a : self.$effective_column_visits()['$=='](self.colcount)) + }, TMP_ParserContext_end_of_row$q_42.$$arity = 0); + + Opal.def(self, '$effective_column_visits', TMP_ParserContext_effective_column_visits_43 = function $$effective_column_visits() { + var self = this; + + return $rb_plus(self.column_visits, self.active_rowspans['$[]'](0)) + }, TMP_ParserContext_effective_column_visits_43.$$arity = 0); + return (Opal.def(self, '$advance', TMP_ParserContext_advance_44 = function $$advance() { + var self = this; + + return (self.linenum = $rb_plus(self.linenum, 1)) + }, TMP_ParserContext_advance_44.$$arity = 0), nil) && 'advance'; + })($$($nesting, 'Table'), null, $nesting); + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/converter/composite"] = function(Opal) { + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $send = Opal.send, $truthy = Opal.truthy, $hash2 = Opal.hash2; + + Opal.add_stubs(['$attr_reader', '$each', '$compact', '$flatten', '$respond_to?', '$composed', '$node_name', '$convert', '$converter_for', '$[]', '$find_converter', '$[]=', '$-', '$handles?', '$raise']); + return (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + (function($base, $super, $parent_nesting) { + function $CompositeConverter(){}; + var self = $CompositeConverter = $klass($base, $super, 'CompositeConverter', $CompositeConverter); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_CompositeConverter_initialize_1, TMP_CompositeConverter_convert_3, TMP_CompositeConverter_converter_for_4, TMP_CompositeConverter_find_converter_5; + + def.converter_map = def.converters = nil; + + self.$attr_reader("converters"); + + Opal.def(self, '$initialize', TMP_CompositeConverter_initialize_1 = function $$initialize(backend, $a) { + var $post_args, converters, TMP_2, self = this; + + + + $post_args = Opal.slice.call(arguments, 1, arguments.length); + + converters = $post_args;; + self.backend = backend; + $send((self.converters = converters.$flatten().$compact()), 'each', [], (TMP_2 = function(converter){var self = TMP_2.$$s || this; + + + + if (converter == null) { + converter = nil; + }; + if ($truthy(converter['$respond_to?']("composed"))) { + return converter.$composed(self) + } else { + return nil + };}, TMP_2.$$s = self, TMP_2.$$arity = 1, TMP_2)); + return (self.converter_map = $hash2([], {})); + }, TMP_CompositeConverter_initialize_1.$$arity = -2); + + Opal.def(self, '$convert', TMP_CompositeConverter_convert_3 = function $$convert(node, transform, opts) { + var $a, self = this; + + + + if (transform == null) { + transform = nil; + }; + + if (opts == null) { + opts = $hash2([], {}); + }; + transform = ($truthy($a = transform) ? $a : node.$node_name()); + return self.$converter_for(transform).$convert(node, transform, opts); + }, TMP_CompositeConverter_convert_3.$$arity = -2); + Opal.alias(self, "convert_with_options", "convert"); + + Opal.def(self, '$converter_for', TMP_CompositeConverter_converter_for_4 = function $$converter_for(transform) { + var $a, self = this, $writer = nil; + + return ($truthy($a = self.converter_map['$[]'](transform)) ? $a : (($writer = [transform, self.$find_converter(transform)]), $send(self.converter_map, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])) + }, TMP_CompositeConverter_converter_for_4.$$arity = 1); + return (Opal.def(self, '$find_converter', TMP_CompositeConverter_find_converter_5 = function $$find_converter(transform) {try { + + var TMP_6, self = this; + + + $send(self.converters, 'each', [], (TMP_6 = function(candidate){var self = TMP_6.$$s || this; + + + + if (candidate == null) { + candidate = nil; + }; + if ($truthy(candidate['$handles?'](transform))) { + Opal.ret(candidate) + } else { + return nil + };}, TMP_6.$$s = self, TMP_6.$$arity = 1, TMP_6)); + return self.$raise("" + "Could not find a converter to handle transform: " + (transform)); + } catch ($returner) { if ($returner === Opal.returner) { return $returner.$v } throw $returner; } + }, TMP_CompositeConverter_find_converter_5.$$arity = 1), nil) && 'find_converter'; + })($$($nesting, 'Converter'), $$$($$($nesting, 'Converter'), 'Base'), $nesting) + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/converter/html5"] = function(Opal) { + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + function $rb_gt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); + } + function $rb_plus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); + } + function $rb_le(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs <= rhs : lhs['$<='](rhs); + } + function $rb_lt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); + } + function $rb_times(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs * rhs : lhs['$*'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $send = Opal.send, $hash2 = Opal.hash2, $truthy = Opal.truthy, $gvars = Opal.gvars; + + Opal.add_stubs(['$default=', '$-', '$==', '$[]', '$instance', '$empty?', '$attr', '$attr?', '$<<', '$include?', '$gsub', '$extname', '$slice', '$length', '$doctitle', '$normalize_web_path', '$embed_primary_stylesheet', '$read_asset', '$normalize_system_path', '$===', '$coderay_stylesheet_name', '$embed_coderay_stylesheet', '$pygments_stylesheet_name', '$embed_pygments_stylesheet', '$docinfo', '$id', '$sections?', '$doctype', '$join', '$noheader', '$outline', '$generate_manname_section', '$has_header?', '$notitle', '$title', '$header', '$each', '$authors', '$>', '$name', '$email', '$sub_macros', '$+', '$downcase', '$concat', '$content', '$footnotes?', '$!', '$footnotes', '$index', '$text', '$nofooter', '$inspect', '$!=', '$to_i', '$attributes', '$document', '$sections', '$level', '$caption', '$captioned_title', '$numbered', '$<=', '$<', '$sectname', '$sectnum', '$role', '$title?', '$icon_uri', '$compact', '$media_uri', '$option?', '$append_boolean_attribute', '$style', '$items', '$blocks?', '$text?', '$chomp', '$safe', '$read_svg_contents', '$alt', '$image_uri', '$encode_quotes', '$append_link_constraint_attrs', '$pygments_background', '$to_sym', '$*', '$count', '$start_with?', '$end_with?', '$list_marker_keyword', '$parent', '$warn', '$logger', '$context', '$error', '$new', '$size', '$columns', '$by_section', '$rows', '$colspan', '$rowspan', '$role?', '$unshift', '$shift', '$split', '$nil_or_empty?', '$type', '$catalog', '$xreftext', '$target', '$map', '$chop', '$upcase', '$read_contents', '$sub', '$match']); + return (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + (function($base, $super, $parent_nesting) { + function $Html5Converter(){}; + var self = $Html5Converter = $klass($base, $super, 'Html5Converter', $Html5Converter); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Html5Converter_initialize_1, TMP_Html5Converter_document_2, TMP_Html5Converter_embedded_5, TMP_Html5Converter_outline_7, TMP_Html5Converter_section_9, TMP_Html5Converter_admonition_10, TMP_Html5Converter_audio_11, TMP_Html5Converter_colist_12, TMP_Html5Converter_dlist_15, TMP_Html5Converter_example_22, TMP_Html5Converter_floating_title_23, TMP_Html5Converter_image_24, TMP_Html5Converter_listing_25, TMP_Html5Converter_literal_26, TMP_Html5Converter_stem_27, TMP_Html5Converter_olist_29, TMP_Html5Converter_open_31, TMP_Html5Converter_page_break_32, TMP_Html5Converter_paragraph_33, TMP_Html5Converter_preamble_34, TMP_Html5Converter_quote_35, TMP_Html5Converter_thematic_break_36, TMP_Html5Converter_sidebar_37, TMP_Html5Converter_table_38, TMP_Html5Converter_toc_43, TMP_Html5Converter_ulist_44, TMP_Html5Converter_verse_46, TMP_Html5Converter_video_47, TMP_Html5Converter_inline_anchor_48, TMP_Html5Converter_inline_break_49, TMP_Html5Converter_inline_button_50, TMP_Html5Converter_inline_callout_51, TMP_Html5Converter_inline_footnote_52, TMP_Html5Converter_inline_image_53, TMP_Html5Converter_inline_indexterm_56, TMP_Html5Converter_inline_kbd_57, TMP_Html5Converter_inline_menu_58, TMP_Html5Converter_inline_quoted_59, TMP_Html5Converter_append_boolean_attribute_60, TMP_Html5Converter_encode_quotes_61, TMP_Html5Converter_generate_manname_section_62, TMP_Html5Converter_append_link_constraint_attrs_63, TMP_Html5Converter_read_svg_contents_64, $writer = nil; + + def.xml_mode = def.void_element_slash = def.stylesheets = def.pygments_bg = def.refs = nil; + + + $writer = [["", "", false]]; + $send(Opal.const_set($nesting[0], 'QUOTE_TAGS', $hash2(["monospaced", "emphasis", "strong", "double", "single", "mark", "superscript", "subscript", "asciimath", "latexmath"], {"monospaced": ["", "", true], "emphasis": ["", "", true], "strong": ["", "", true], "double": ["“", "”", false], "single": ["‘", "’", false], "mark": ["", "", true], "superscript": ["", "", true], "subscript": ["", "", true], "asciimath": ["\\$", "\\$", false], "latexmath": ["\\(", "\\)", false]})), 'default=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + Opal.const_set($nesting[0], 'DropAnchorRx', /<(?:a[^>+]+|\/a)>/); + Opal.const_set($nesting[0], 'StemBreakRx', / *\\\n(?:\\?\n)*|\n\n+/); + Opal.const_set($nesting[0], 'SvgPreambleRx', /^.*?(?=]*>/); + Opal.const_set($nesting[0], 'DimensionAttributeRx', /\s(?:width|height|style)=(["']).*?\1/); + + Opal.def(self, '$initialize', TMP_Html5Converter_initialize_1 = function $$initialize(backend, opts) { + var self = this; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + self.xml_mode = opts['$[]']("htmlsyntax")['$==']("xml"); + self.void_element_slash = (function() {if ($truthy(self.xml_mode)) { + return "/" + } else { + return nil + }; return nil; })(); + return (self.stylesheets = $$($nesting, 'Stylesheets').$instance()); + }, TMP_Html5Converter_initialize_1.$$arity = -2); + + Opal.def(self, '$document', TMP_Html5Converter_document_2 = function $$document(node) { + var $a, $b, $c, TMP_3, TMP_4, self = this, slash = nil, br = nil, asset_uri_scheme = nil, cdn_base = nil, linkcss = nil, result = nil, lang_attribute = nil, authors = nil, icon_href = nil, icon_type = nil, icon_ext = nil, webfonts = nil, iconfont_stylesheet = nil, $case = nil, highlighter = nil, pygments_style = nil, docinfo_content = nil, body_attrs = nil, sectioned = nil, classes = nil, details = nil, idx = nil, highlightjs_path = nil, prettify_path = nil, eqnums_val = nil, eqnums_opt = nil; + + + slash = self.void_element_slash; + br = "" + ""; + if ($truthy((asset_uri_scheme = node.$attr("asset-uri-scheme", "https"))['$empty?']())) { + } else { + asset_uri_scheme = "" + (asset_uri_scheme) + ":" + }; + cdn_base = "" + (asset_uri_scheme) + "//cdnjs.cloudflare.com/ajax/libs"; + linkcss = node['$attr?']("linkcss"); + result = [""]; + lang_attribute = (function() {if ($truthy(node['$attr?']("nolang"))) { + return "" + } else { + return "" + " lang=\"" + (node.$attr("lang", "en")) + "\"" + }; return nil; })(); + result['$<<']("" + ""); + result['$<<']("" + "\n" + "\n" + "\n" + "\n" + ""); + if ($truthy(node['$attr?']("app-name"))) { + result['$<<']("" + "")}; + if ($truthy(node['$attr?']("description"))) { + result['$<<']("" + "")}; + if ($truthy(node['$attr?']("keywords"))) { + result['$<<']("" + "")}; + if ($truthy(node['$attr?']("authors"))) { + result['$<<']("" + "")}; + if ($truthy(node['$attr?']("copyright"))) { + result['$<<']("" + "")}; + if ($truthy(node['$attr?']("favicon"))) { + + if ($truthy((icon_href = node.$attr("favicon"))['$empty?']())) { + $a = ["favicon.ico", "image/x-icon"], (icon_href = $a[0]), (icon_type = $a[1]), $a + } else { + icon_type = (function() {if ((icon_ext = $$$('::', 'File').$extname(icon_href))['$=='](".ico")) { + return "image/x-icon" + } else { + return "" + "image/" + (icon_ext.$slice(1, icon_ext.$length())) + }; return nil; })() + }; + result['$<<']("" + "");}; + result['$<<']("" + "" + (node.$doctitle($hash2(["sanitize", "use_fallback"], {"sanitize": true, "use_fallback": true}))) + ""); + if ($truthy($$($nesting, 'DEFAULT_STYLESHEET_KEYS')['$include?'](node.$attr("stylesheet")))) { + + if ($truthy((webfonts = node.$attr("webfonts")))) { + result['$<<']("" + "")}; + if ($truthy(linkcss)) { + result['$<<']("" + "") + } else { + result['$<<'](self.stylesheets.$embed_primary_stylesheet()) + }; + } else if ($truthy(node['$attr?']("stylesheet"))) { + if ($truthy(linkcss)) { + result['$<<']("" + "") + } else { + result['$<<']("" + "") + }}; + if ($truthy(node['$attr?']("icons", "font"))) { + if ($truthy(node['$attr?']("iconfont-remote"))) { + result['$<<']("" + "") + } else { + + iconfont_stylesheet = "" + (node.$attr("iconfont-name", "font-awesome")) + ".css"; + result['$<<']("" + ""); + }}; + $case = (highlighter = node.$attr("source-highlighter")); + if ("coderay"['$===']($case)) {if (node.$attr("coderay-css", "class")['$==']("class")) { + if ($truthy(linkcss)) { + result['$<<']("" + "") + } else { + result['$<<'](self.stylesheets.$embed_coderay_stylesheet()) + }}} + else if ("pygments"['$===']($case)) {if (node.$attr("pygments-css", "class")['$==']("class")) { + + pygments_style = node.$attr("pygments-style"); + if ($truthy(linkcss)) { + result['$<<']("" + "") + } else { + result['$<<'](self.stylesheets.$embed_pygments_stylesheet(pygments_style)) + };}}; + if ($truthy((docinfo_content = node.$docinfo())['$empty?']())) { + } else { + result['$<<'](docinfo_content) + }; + result['$<<'](""); + body_attrs = (function() {if ($truthy(node.$id())) { + return ["" + "id=\"" + (node.$id()) + "\""] + } else { + return [] + }; return nil; })(); + if ($truthy(($truthy($a = ($truthy($b = ($truthy($c = (sectioned = node['$sections?']())) ? node['$attr?']("toc-class") : $c)) ? node['$attr?']("toc") : $b)) ? node['$attr?']("toc-placement", "auto") : $a))) { + classes = [node.$doctype(), node.$attr("toc-class"), "" + "toc-" + (node.$attr("toc-position", "header"))] + } else { + classes = [node.$doctype()] + }; + if ($truthy(node['$attr?']("docrole"))) { + classes['$<<'](node.$attr("docrole"))}; + body_attrs['$<<']("" + "class=\"" + (classes.$join(" ")) + "\""); + if ($truthy(node['$attr?']("max-width"))) { + body_attrs['$<<']("" + "style=\"max-width: " + (node.$attr("max-width")) + ";\"")}; + result['$<<']("" + ""); + if ($truthy(node.$noheader())) { + } else { + + result['$<<']("
    "); + if (node.$doctype()['$==']("manpage")) { + + result['$<<']("" + "

    " + (node.$doctitle()) + " Manual Page

    "); + if ($truthy(($truthy($a = ($truthy($b = sectioned) ? node['$attr?']("toc") : $b)) ? node['$attr?']("toc-placement", "auto") : $a))) { + result['$<<']("" + "
    \n" + "
    " + (node.$attr("toc-title")) + "
    \n" + (self.$outline(node)) + "\n" + "
    ")}; + if ($truthy(node['$attr?']("manpurpose"))) { + result['$<<'](self.$generate_manname_section(node))}; + } else { + + if ($truthy(node['$has_header?']())) { + + if ($truthy(node.$notitle())) { + } else { + result['$<<']("" + "

    " + (node.$header().$title()) + "

    ") + }; + details = []; + idx = 1; + $send(node.$authors(), 'each', [], (TMP_3 = function(author){var self = TMP_3.$$s || this; + + + + if (author == null) { + author = nil; + }; + details['$<<']("" + "" + (author.$name()) + "" + (br)); + if ($truthy(author.$email())) { + details['$<<']("" + "" + (node.$sub_macros(author.$email())) + "" + (br))}; + return (idx = $rb_plus(idx, 1));}, TMP_3.$$s = self, TMP_3.$$arity = 1, TMP_3)); + if ($truthy(node['$attr?']("revnumber"))) { + details['$<<']("" + "" + (($truthy($a = node.$attr("version-label")) ? $a : "").$downcase()) + " " + (node.$attr("revnumber")) + ((function() {if ($truthy(node['$attr?']("revdate"))) { + return "," + } else { + return "" + }; return nil; })()) + "")}; + if ($truthy(node['$attr?']("revdate"))) { + details['$<<']("" + "" + (node.$attr("revdate")) + "")}; + if ($truthy(node['$attr?']("revremark"))) { + details['$<<']("" + (br) + "" + (node.$attr("revremark")) + "")}; + if ($truthy(details['$empty?']())) { + } else { + + result['$<<']("
    "); + result.$concat(details); + result['$<<']("
    "); + };}; + if ($truthy(($truthy($a = ($truthy($b = sectioned) ? node['$attr?']("toc") : $b)) ? node['$attr?']("toc-placement", "auto") : $a))) { + result['$<<']("" + "
    \n" + "
    " + (node.$attr("toc-title")) + "
    \n" + (self.$outline(node)) + "\n" + "
    ")}; + }; + result['$<<']("
    "); + }; + result['$<<']("" + "
    \n" + (node.$content()) + "\n" + "
    "); + if ($truthy(($truthy($a = node['$footnotes?']()) ? node['$attr?']("nofootnotes")['$!']() : $a))) { + + result['$<<']("" + "
    \n" + ""); + $send(node.$footnotes(), 'each', [], (TMP_4 = function(footnote){var self = TMP_4.$$s || this; + + + + if (footnote == null) { + footnote = nil; + }; + return result['$<<']("" + "
    \n" + "" + (footnote.$index()) + ". " + (footnote.$text()) + "\n" + "
    ");}, TMP_4.$$s = self, TMP_4.$$arity = 1, TMP_4)); + result['$<<']("
    ");}; + if ($truthy(node.$nofooter())) { + } else { + + result['$<<']("
    "); + result['$<<']("
    "); + if ($truthy(node['$attr?']("revnumber"))) { + result['$<<']("" + (node.$attr("version-label")) + " " + (node.$attr("revnumber")) + (br))}; + if ($truthy(($truthy($a = node['$attr?']("last-update-label")) ? node['$attr?']("reproducible")['$!']() : $a))) { + result['$<<']("" + (node.$attr("last-update-label")) + " " + (node.$attr("docdatetime")))}; + result['$<<']("
    "); + result['$<<']("
    "); + }; + if ($truthy((docinfo_content = node.$docinfo("footer"))['$empty?']())) { + } else { + result['$<<'](docinfo_content) + }; + $case = highlighter; + if ("highlightjs"['$===']($case) || "highlight.js"['$===']($case)) { + highlightjs_path = node.$attr("highlightjsdir", "" + (cdn_base) + "/highlight.js/9.13.1"); + result['$<<']("" + ""); + result['$<<']("" + "\n" + "");} + else if ("prettify"['$===']($case)) { + prettify_path = node.$attr("prettifydir", "" + (cdn_base) + "/prettify/r298"); + result['$<<']("" + ""); + result['$<<']("" + "\n" + "");}; + if ($truthy(node['$attr?']("stem"))) { + + eqnums_val = node.$attr("eqnums", "none"); + if ($truthy(eqnums_val['$empty?']())) { + eqnums_val = "AMS"}; + eqnums_opt = "" + " equationNumbers: { autoNumber: \"" + (eqnums_val) + "\" } "; + result['$<<']("" + "\n" + "");}; + result['$<<'](""); + result['$<<'](""); + return result.$join($$($nesting, 'LF')); + }, TMP_Html5Converter_document_2.$$arity = 1); + + Opal.def(self, '$embedded', TMP_Html5Converter_embedded_5 = function $$embedded(node) { + var $a, $b, $c, TMP_6, self = this, result = nil, id_attr = nil, toc_p = nil; + + + result = []; + if (node.$doctype()['$==']("manpage")) { + + if ($truthy(node.$notitle())) { + } else { + + id_attr = (function() {if ($truthy(node.$id())) { + return "" + " id=\"" + (node.$id()) + "\"" + } else { + return "" + }; return nil; })(); + result['$<<']("" + "" + (node.$doctitle()) + " Manual Page"); + }; + if ($truthy(node['$attr?']("manpurpose"))) { + result['$<<'](self.$generate_manname_section(node))}; + } else if ($truthy(($truthy($a = node['$has_header?']()) ? node.$notitle()['$!']() : $a))) { + + id_attr = (function() {if ($truthy(node.$id())) { + return "" + " id=\"" + (node.$id()) + "\"" + } else { + return "" + }; return nil; })(); + result['$<<']("" + "" + (node.$header().$title()) + "");}; + if ($truthy(($truthy($a = ($truthy($b = ($truthy($c = node['$sections?']()) ? node['$attr?']("toc") : $c)) ? (toc_p = node.$attr("toc-placement"))['$!=']("macro") : $b)) ? toc_p['$!=']("preamble") : $a))) { + result['$<<']("" + "
    \n" + "
    " + (node.$attr("toc-title")) + "
    \n" + (self.$outline(node)) + "\n" + "
    ")}; + result['$<<'](node.$content()); + if ($truthy(($truthy($a = node['$footnotes?']()) ? node['$attr?']("nofootnotes")['$!']() : $a))) { + + result['$<<']("" + "
    \n" + ""); + $send(node.$footnotes(), 'each', [], (TMP_6 = function(footnote){var self = TMP_6.$$s || this; + + + + if (footnote == null) { + footnote = nil; + }; + return result['$<<']("" + "
    \n" + "" + (footnote.$index()) + ". " + (footnote.$text()) + "\n" + "
    ");}, TMP_6.$$s = self, TMP_6.$$arity = 1, TMP_6)); + result['$<<']("
    ");}; + return result.$join($$($nesting, 'LF')); + }, TMP_Html5Converter_embedded_5.$$arity = 1); + + Opal.def(self, '$outline', TMP_Html5Converter_outline_7 = function $$outline(node, opts) { + var $a, $b, TMP_8, self = this, sectnumlevels = nil, toclevels = nil, sections = nil, result = nil; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + if ($truthy(node['$sections?']())) { + } else { + return nil + }; + sectnumlevels = ($truthy($a = opts['$[]']("sectnumlevels")) ? $a : ($truthy($b = node.$document().$attributes()['$[]']("sectnumlevels")) ? $b : 3).$to_i()); + toclevels = ($truthy($a = opts['$[]']("toclevels")) ? $a : ($truthy($b = node.$document().$attributes()['$[]']("toclevels")) ? $b : 2).$to_i()); + sections = node.$sections(); + result = ["" + "
      "]; + $send(sections, 'each', [], (TMP_8 = function(section){var self = TMP_8.$$s || this, $c, slevel = nil, stitle = nil, signifier = nil, child_toc_level = nil; + + + + if (section == null) { + section = nil; + }; + slevel = section.$level(); + if ($truthy(section.$caption())) { + stitle = section.$captioned_title() + } else if ($truthy(($truthy($c = section.$numbered()) ? $rb_le(slevel, sectnumlevels) : $c))) { + if ($truthy(($truthy($c = $rb_lt(slevel, 2)) ? node.$document().$doctype()['$==']("book") : $c))) { + if (section.$sectname()['$==']("chapter")) { + stitle = "" + ((function() {if ($truthy((signifier = node.$document().$attributes()['$[]']("chapter-signifier")))) { + return "" + (signifier) + " " + } else { + return "" + }; return nil; })()) + (section.$sectnum()) + " " + (section.$title()) + } else if (section.$sectname()['$==']("part")) { + stitle = "" + ((function() {if ($truthy((signifier = node.$document().$attributes()['$[]']("part-signifier")))) { + return "" + (signifier) + " " + } else { + return "" + }; return nil; })()) + (section.$sectnum(nil, ":")) + " " + (section.$title()) + } else { + stitle = "" + (section.$sectnum()) + " " + (section.$title()) + } + } else { + stitle = "" + (section.$sectnum()) + " " + (section.$title()) + } + } else { + stitle = section.$title() + }; + if ($truthy(stitle['$include?']("" + (stitle) + ""); + result['$<<'](child_toc_level); + return result['$<<'](""); + } else { + return result['$<<']("" + "
    • " + (stitle) + "
    • ") + };}, TMP_8.$$s = self, TMP_8.$$arity = 1, TMP_8)); + result['$<<']("
    "); + return result.$join($$($nesting, 'LF')); + }, TMP_Html5Converter_outline_7.$$arity = -2); + + Opal.def(self, '$section', TMP_Html5Converter_section_9 = function $$section(node) { + var $a, $b, self = this, doc_attrs = nil, level = nil, title = nil, signifier = nil, id_attr = nil, id = nil, role = nil; + + + doc_attrs = node.$document().$attributes(); + level = node.$level(); + if ($truthy(node.$caption())) { + title = node.$captioned_title() + } else if ($truthy(($truthy($a = node.$numbered()) ? $rb_le(level, ($truthy($b = doc_attrs['$[]']("sectnumlevels")) ? $b : 3).$to_i()) : $a))) { + if ($truthy(($truthy($a = $rb_lt(level, 2)) ? node.$document().$doctype()['$==']("book") : $a))) { + if (node.$sectname()['$==']("chapter")) { + title = "" + ((function() {if ($truthy((signifier = doc_attrs['$[]']("chapter-signifier")))) { + return "" + (signifier) + " " + } else { + return "" + }; return nil; })()) + (node.$sectnum()) + " " + (node.$title()) + } else if (node.$sectname()['$==']("part")) { + title = "" + ((function() {if ($truthy((signifier = doc_attrs['$[]']("part-signifier")))) { + return "" + (signifier) + " " + } else { + return "" + }; return nil; })()) + (node.$sectnum(nil, ":")) + " " + (node.$title()) + } else { + title = "" + (node.$sectnum()) + " " + (node.$title()) + } + } else { + title = "" + (node.$sectnum()) + " " + (node.$title()) + } + } else { + title = node.$title() + }; + if ($truthy(node.$id())) { + + id_attr = "" + " id=\"" + ((id = node.$id())) + "\""; + if ($truthy(doc_attrs['$[]']("sectlinks"))) { + title = "" + "" + (title) + ""}; + if ($truthy(doc_attrs['$[]']("sectanchors"))) { + if (doc_attrs['$[]']("sectanchors")['$==']("after")) { + title = "" + (title) + "" + } else { + title = "" + "" + (title) + }}; + } else { + id_attr = "" + }; + if (level['$=='](0)) { + return "" + "" + (title) + "\n" + (node.$content()) + } else { + return "" + "
    \n" + "" + (title) + "\n" + ((function() {if (level['$=='](1)) { + return "" + "
    \n" + (node.$content()) + "\n" + "
    " + } else { + return node.$content() + }; return nil; })()) + "\n" + "
    " + }; + }, TMP_Html5Converter_section_9.$$arity = 1); + + Opal.def(self, '$admonition', TMP_Html5Converter_admonition_10 = function $$admonition(node) { + var $a, self = this, id_attr = nil, name = nil, title_element = nil, label = nil, role = nil; + + + id_attr = (function() {if ($truthy(node.$id())) { + return "" + " id=\"" + (node.$id()) + "\"" + } else { + return "" + }; return nil; })(); + name = node.$attr("name"); + title_element = (function() {if ($truthy(node['$title?']())) { + return "" + "
    " + (node.$title()) + "
    \n" + } else { + return "" + }; return nil; })(); + if ($truthy(node.$document()['$attr?']("icons"))) { + if ($truthy(($truthy($a = node.$document()['$attr?']("icons", "font")) ? node['$attr?']("icon")['$!']() : $a))) { + label = "" + "" + } else { + label = "" + "\""" + } + } else { + label = "" + "
    " + (node.$attr("textlabel")) + "
    " + }; + return "" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "
    \n" + (label) + "\n" + "\n" + (title_element) + (node.$content()) + "\n" + "
    \n" + "
    "; + }, TMP_Html5Converter_admonition_10.$$arity = 1); + + Opal.def(self, '$audio', TMP_Html5Converter_audio_11 = function $$audio(node) { + var $a, self = this, xml = nil, id_attribute = nil, classes = nil, class_attribute = nil, title_element = nil, start_t = nil, end_t = nil, time_anchor = nil; + + + xml = self.xml_mode; + id_attribute = (function() {if ($truthy(node.$id())) { + return "" + " id=\"" + (node.$id()) + "\"" + } else { + return "" + }; return nil; })(); + classes = ["audioblock", node.$role()].$compact(); + class_attribute = "" + " class=\"" + (classes.$join(" ")) + "\""; + title_element = (function() {if ($truthy(node['$title?']())) { + return "" + "
    " + (node.$title()) + "
    \n" + } else { + return "" + }; return nil; })(); + start_t = node.$attr("start", nil, false); + end_t = node.$attr("end", nil, false); + time_anchor = (function() {if ($truthy(($truthy($a = start_t) ? $a : end_t))) { + return "" + "#t=" + (($truthy($a = start_t) ? $a : "")) + ((function() {if ($truthy(end_t)) { + return "" + "," + (end_t) + } else { + return "" + }; return nil; })()) + } else { + return "" + }; return nil; })(); + return "" + "\n" + (title_element) + "
    \n" + "\n" + "
    \n" + ""; + }, TMP_Html5Converter_audio_11.$$arity = 1); + + Opal.def(self, '$colist', TMP_Html5Converter_colist_12 = function $$colist(node) { + var $a, TMP_13, TMP_14, self = this, result = nil, id_attribute = nil, classes = nil, class_attribute = nil, font_icons = nil, num = nil; + + + result = []; + id_attribute = (function() {if ($truthy(node.$id())) { + return "" + " id=\"" + (node.$id()) + "\"" + } else { + return "" + }; return nil; })(); + classes = ["colist", node.$style(), node.$role()].$compact(); + class_attribute = "" + " class=\"" + (classes.$join(" ")) + "\""; + result['$<<']("" + ""); + if ($truthy(node['$title?']())) { + result['$<<']("" + "
    " + (node.$title()) + "
    ")}; + if ($truthy(node.$document()['$attr?']("icons"))) { + + result['$<<'](""); + $a = [node.$document()['$attr?']("icons", "font"), 0], (font_icons = $a[0]), (num = $a[1]), $a; + $send(node.$items(), 'each', [], (TMP_13 = function(item){var self = TMP_13.$$s || this, num_label = nil; + if (self.void_element_slash == null) self.void_element_slash = nil; + + + + if (item == null) { + item = nil; + }; + num = $rb_plus(num, 1); + if ($truthy(font_icons)) { + num_label = "" + "" + (num) + "" + } else { + num_label = "" + "\""" + }; + return result['$<<']("" + "\n" + "\n" + "\n" + "");}, TMP_13.$$s = self, TMP_13.$$arity = 1, TMP_13)); + result['$<<']("
    " + (num_label) + "" + (item.$text()) + ((function() {if ($truthy(item['$blocks?']())) { + return $rb_plus($$($nesting, 'LF'), item.$content()) + } else { + return "" + }; return nil; })()) + "
    "); + } else { + + result['$<<']("
      "); + $send(node.$items(), 'each', [], (TMP_14 = function(item){var self = TMP_14.$$s || this; + + + + if (item == null) { + item = nil; + }; + return result['$<<']("" + "
    1. \n" + "

      " + (item.$text()) + "

      " + ((function() {if ($truthy(item['$blocks?']())) { + return $rb_plus($$($nesting, 'LF'), item.$content()) + } else { + return "" + }; return nil; })()) + "\n" + "
    2. ");}, TMP_14.$$s = self, TMP_14.$$arity = 1, TMP_14)); + result['$<<']("
    "); + }; + result['$<<'](""); + return result.$join($$($nesting, 'LF')); + }, TMP_Html5Converter_colist_12.$$arity = 1); + + Opal.def(self, '$dlist', TMP_Html5Converter_dlist_15 = function $$dlist(node) { + var TMP_16, $a, TMP_18, TMP_20, self = this, result = nil, id_attribute = nil, classes = nil, $case = nil, class_attribute = nil, slash = nil, col_style_attribute = nil, dt_style_attribute = nil; + + + result = []; + id_attribute = (function() {if ($truthy(node.$id())) { + return "" + " id=\"" + (node.$id()) + "\"" + } else { + return "" + }; return nil; })(); + classes = (function() {$case = node.$style(); + if ("qanda"['$===']($case)) {return ["qlist", "qanda", node.$role()]} + else if ("horizontal"['$===']($case)) {return ["hdlist", node.$role()]} + else {return ["dlist", node.$style(), node.$role()]}})().$compact(); + class_attribute = "" + " class=\"" + (classes.$join(" ")) + "\""; + result['$<<']("" + ""); + if ($truthy(node['$title?']())) { + result['$<<']("" + "
    " + (node.$title()) + "
    ")}; + $case = node.$style(); + if ("qanda"['$===']($case)) { + result['$<<']("
      "); + $send(node.$items(), 'each', [], (TMP_16 = function(terms, dd){var self = TMP_16.$$s || this, TMP_17; + + + + if (terms == null) { + terms = nil; + }; + + if (dd == null) { + dd = nil; + }; + result['$<<']("
    1. "); + $send([].concat(Opal.to_a(terms)), 'each', [], (TMP_17 = function(dt){var self = TMP_17.$$s || this; + + + + if (dt == null) { + dt = nil; + }; + return result['$<<']("" + "

      " + (dt.$text()) + "

      ");}, TMP_17.$$s = self, TMP_17.$$arity = 1, TMP_17)); + if ($truthy(dd)) { + + if ($truthy(dd['$text?']())) { + result['$<<']("" + "

      " + (dd.$text()) + "

      ")}; + if ($truthy(dd['$blocks?']())) { + result['$<<'](dd.$content())};}; + return result['$<<']("
    2. ");}, TMP_16.$$s = self, TMP_16.$$arity = 2, TMP_16)); + result['$<<']("
    ");} + else if ("horizontal"['$===']($case)) { + slash = self.void_element_slash; + result['$<<'](""); + if ($truthy(($truthy($a = node['$attr?']("labelwidth")) ? $a : node['$attr?']("itemwidth")))) { + + result['$<<'](""); + col_style_attribute = (function() {if ($truthy(node['$attr?']("labelwidth"))) { + return "" + " style=\"width: " + (node.$attr("labelwidth").$chomp("%")) + "%;\"" + } else { + return "" + }; return nil; })(); + result['$<<']("" + ""); + col_style_attribute = (function() {if ($truthy(node['$attr?']("itemwidth"))) { + return "" + " style=\"width: " + (node.$attr("itemwidth").$chomp("%")) + "%;\"" + } else { + return "" + }; return nil; })(); + result['$<<']("" + ""); + result['$<<']("");}; + $send(node.$items(), 'each', [], (TMP_18 = function(terms, dd){var self = TMP_18.$$s || this, TMP_19, terms_array = nil, last_term = nil; + + + + if (terms == null) { + terms = nil; + }; + + if (dd == null) { + dd = nil; + }; + result['$<<'](""); + result['$<<']("" + ""); + result['$<<'](""); + return result['$<<']("");}, TMP_18.$$s = self, TMP_18.$$arity = 2, TMP_18)); + result['$<<']("
    "); + terms_array = [].concat(Opal.to_a(terms)); + last_term = terms_array['$[]'](-1); + $send(terms_array, 'each', [], (TMP_19 = function(dt){var self = TMP_19.$$s || this; + + + + if (dt == null) { + dt = nil; + }; + result['$<<'](dt.$text()); + if ($truthy(dt['$!='](last_term))) { + return result['$<<']("" + "") + } else { + return nil + };}, TMP_19.$$s = self, TMP_19.$$arity = 1, TMP_19)); + result['$<<'](""); + if ($truthy(dd)) { + + if ($truthy(dd['$text?']())) { + result['$<<']("" + "

    " + (dd.$text()) + "

    ")}; + if ($truthy(dd['$blocks?']())) { + result['$<<'](dd.$content())};}; + result['$<<']("
    ");} + else { + result['$<<']("
    "); + dt_style_attribute = (function() {if ($truthy(node.$style())) { + return "" + } else { + return " class=\"hdlist1\"" + }; return nil; })(); + $send(node.$items(), 'each', [], (TMP_20 = function(terms, dd){var self = TMP_20.$$s || this, TMP_21; + + + + if (terms == null) { + terms = nil; + }; + + if (dd == null) { + dd = nil; + }; + $send([].concat(Opal.to_a(terms)), 'each', [], (TMP_21 = function(dt){var self = TMP_21.$$s || this; + + + + if (dt == null) { + dt = nil; + }; + return result['$<<']("" + "" + (dt.$text()) + "");}, TMP_21.$$s = self, TMP_21.$$arity = 1, TMP_21)); + if ($truthy(dd)) { + + result['$<<']("
    "); + if ($truthy(dd['$text?']())) { + result['$<<']("" + "

    " + (dd.$text()) + "

    ")}; + if ($truthy(dd['$blocks?']())) { + result['$<<'](dd.$content())}; + return result['$<<']("
    "); + } else { + return nil + };}, TMP_20.$$s = self, TMP_20.$$arity = 2, TMP_20)); + result['$<<']("
    ");}; + result['$<<'](""); + return result.$join($$($nesting, 'LF')); + }, TMP_Html5Converter_dlist_15.$$arity = 1); + + Opal.def(self, '$example', TMP_Html5Converter_example_22 = function $$example(node) { + var self = this, id_attribute = nil, title_element = nil, role = nil; + + + id_attribute = (function() {if ($truthy(node.$id())) { + return "" + " id=\"" + (node.$id()) + "\"" + } else { + return "" + }; return nil; })(); + title_element = (function() {if ($truthy(node['$title?']())) { + return "" + "
    " + (node.$captioned_title()) + "
    \n" + } else { + return "" + }; return nil; })(); + return "" + "\n" + (title_element) + "
    \n" + (node.$content()) + "\n" + "
    \n" + ""; + }, TMP_Html5Converter_example_22.$$arity = 1); + + Opal.def(self, '$floating_title', TMP_Html5Converter_floating_title_23 = function $$floating_title(node) { + var self = this, tag_name = nil, id_attribute = nil, classes = nil; + + + tag_name = "" + "h" + ($rb_plus(node.$level(), 1)); + id_attribute = (function() {if ($truthy(node.$id())) { + return "" + " id=\"" + (node.$id()) + "\"" + } else { + return "" + }; return nil; })(); + classes = [node.$style(), node.$role()].$compact(); + return "" + "<" + (tag_name) + (id_attribute) + " class=\"" + (classes.$join(" ")) + "\">" + (node.$title()) + ""; + }, TMP_Html5Converter_floating_title_23.$$arity = 1); + + Opal.def(self, '$image', TMP_Html5Converter_image_24 = function $$image(node) { + var $a, $b, $c, self = this, target = nil, width_attr = nil, height_attr = nil, svg = nil, obj = nil, img = nil, fallback = nil, id_attr = nil, classes = nil, class_attr = nil, title_el = nil; + + + target = node.$attr("target"); + width_attr = (function() {if ($truthy(node['$attr?']("width"))) { + return "" + " width=\"" + (node.$attr("width")) + "\"" + } else { + return "" + }; return nil; })(); + height_attr = (function() {if ($truthy(node['$attr?']("height"))) { + return "" + " height=\"" + (node.$attr("height")) + "\"" + } else { + return "" + }; return nil; })(); + if ($truthy(($truthy($a = ($truthy($b = ($truthy($c = node['$attr?']("format", "svg", false)) ? $c : target['$include?'](".svg"))) ? $rb_lt(node.$document().$safe(), $$$($$($nesting, 'SafeMode'), 'SECURE')) : $b)) ? ($truthy($b = (svg = node['$option?']("inline"))) ? $b : (obj = node['$option?']("interactive"))) : $a))) { + if ($truthy(svg)) { + img = ($truthy($a = self.$read_svg_contents(node, target)) ? $a : "" + "" + (node.$alt()) + "") + } else if ($truthy(obj)) { + + fallback = (function() {if ($truthy(node['$attr?']("fallback"))) { + return "" + "\""" + } else { + return "" + "" + (node.$alt()) + "" + }; return nil; })(); + img = "" + "" + (fallback) + "";}}; + img = ($truthy($a = img) ? $a : "" + "\"""); + if ($truthy(node['$attr?']("link", nil, false))) { + img = "" + "" + (img) + ""}; + id_attr = (function() {if ($truthy(node.$id())) { + return "" + " id=\"" + (node.$id()) + "\"" + } else { + return "" + }; return nil; })(); + classes = ["imageblock"]; + if ($truthy(node['$attr?']("float"))) { + classes['$<<'](node.$attr("float"))}; + if ($truthy(node['$attr?']("align"))) { + classes['$<<']("" + "text-" + (node.$attr("align")))}; + if ($truthy(node.$role())) { + classes['$<<'](node.$role())}; + class_attr = "" + " class=\"" + (classes.$join(" ")) + "\""; + title_el = (function() {if ($truthy(node['$title?']())) { + return "" + "\n
    " + (node.$captioned_title()) + "
    " + } else { + return "" + }; return nil; })(); + return "" + "\n" + "
    \n" + (img) + "\n" + "
    " + (title_el) + "\n" + ""; + }, TMP_Html5Converter_image_24.$$arity = 1); + + Opal.def(self, '$listing', TMP_Html5Converter_listing_25 = function $$listing(node) { + var $a, self = this, nowrap = nil, language = nil, code_attrs = nil, $case = nil, pre_class = nil, pre_start = nil, pre_end = nil, id_attribute = nil, title_element = nil, role = nil; + + + nowrap = ($truthy($a = node.$document()['$attr?']("prewrap")['$!']()) ? $a : node['$option?']("nowrap")); + if (node.$style()['$==']("source")) { + + if ($truthy((language = node.$attr("language", nil, false)))) { + code_attrs = "" + " data-lang=\"" + (language) + "\"" + } else { + code_attrs = "" + }; + $case = node.$document().$attr("source-highlighter"); + if ("coderay"['$===']($case)) {pre_class = "" + " class=\"CodeRay highlight" + ((function() {if ($truthy(nowrap)) { + return " nowrap" + } else { + return "" + }; return nil; })()) + "\""} + else if ("pygments"['$===']($case)) {if ($truthy(node.$document()['$attr?']("pygments-css", "inline"))) { + + if ($truthy((($a = self['pygments_bg'], $a != null && $a !== nil) ? 'instance-variable' : nil))) { + } else { + self.pygments_bg = self.stylesheets.$pygments_background(node.$document().$attr("pygments-style")) + }; + pre_class = "" + " class=\"pygments highlight" + ((function() {if ($truthy(nowrap)) { + return " nowrap" + } else { + return "" + }; return nil; })()) + "\" style=\"background: " + (self.pygments_bg) + "\""; + } else { + pre_class = "" + " class=\"pygments highlight" + ((function() {if ($truthy(nowrap)) { + return " nowrap" + } else { + return "" + }; return nil; })()) + "\"" + }} + else if ("highlightjs"['$===']($case) || "highlight.js"['$===']($case)) { + pre_class = "" + " class=\"highlightjs highlight" + ((function() {if ($truthy(nowrap)) { + return " nowrap" + } else { + return "" + }; return nil; })()) + "\""; + if ($truthy(language)) { + code_attrs = "" + " class=\"language-" + (language) + " hljs\"" + (code_attrs)};} + else if ("prettify"['$===']($case)) { + pre_class = "" + " class=\"prettyprint highlight" + ((function() {if ($truthy(nowrap)) { + return " nowrap" + } else { + return "" + }; return nil; })()) + ((function() {if ($truthy(node['$attr?']("linenums", nil, false))) { + return " linenums" + } else { + return "" + }; return nil; })()) + "\""; + if ($truthy(language)) { + code_attrs = "" + " class=\"language-" + (language) + "\"" + (code_attrs)};} + else if ("html-pipeline"['$===']($case)) { + pre_class = (function() {if ($truthy(language)) { + return "" + " lang=\"" + (language) + "\"" + } else { + return "" + }; return nil; })(); + code_attrs = "";} + else { + pre_class = "" + " class=\"highlight" + ((function() {if ($truthy(nowrap)) { + return " nowrap" + } else { + return "" + }; return nil; })()) + "\""; + if ($truthy(language)) { + code_attrs = "" + " class=\"language-" + (language) + "\"" + (code_attrs)};}; + pre_start = "" + ""; + pre_end = "
    "; + } else { + + pre_start = "" + ""; + pre_end = ""; + }; + id_attribute = (function() {if ($truthy(node.$id())) { + return "" + " id=\"" + (node.$id()) + "\"" + } else { + return "" + }; return nil; })(); + title_element = (function() {if ($truthy(node['$title?']())) { + return "" + "
    " + (node.$captioned_title()) + "
    \n" + } else { + return "" + }; return nil; })(); + return "" + "\n" + (title_element) + "
    \n" + (pre_start) + (node.$content()) + (pre_end) + "\n" + "
    \n" + ""; + }, TMP_Html5Converter_listing_25.$$arity = 1); + + Opal.def(self, '$literal', TMP_Html5Converter_literal_26 = function $$literal(node) { + var $a, self = this, id_attribute = nil, title_element = nil, nowrap = nil, role = nil; + + + id_attribute = (function() {if ($truthy(node.$id())) { + return "" + " id=\"" + (node.$id()) + "\"" + } else { + return "" + }; return nil; })(); + title_element = (function() {if ($truthy(node['$title?']())) { + return "" + "
    " + (node.$title()) + "
    \n" + } else { + return "" + }; return nil; })(); + nowrap = ($truthy($a = node.$document()['$attr?']("prewrap")['$!']()) ? $a : node['$option?']("nowrap")); + return "" + "\n" + (title_element) + "
    \n" + "" + (node.$content()) + "\n" + "
    \n" + ""; + }, TMP_Html5Converter_literal_26.$$arity = 1); + + Opal.def(self, '$stem', TMP_Html5Converter_stem_27 = function $$stem(node) { + var $a, $b, TMP_28, self = this, id_attribute = nil, title_element = nil, style = nil, open = nil, close = nil, equation = nil, br = nil, role = nil; + + + id_attribute = (function() {if ($truthy(node.$id())) { + return "" + " id=\"" + (node.$id()) + "\"" + } else { + return "" + }; return nil; })(); + title_element = (function() {if ($truthy(node['$title?']())) { + return "" + "
    " + (node.$title()) + "
    \n" + } else { + return "" + }; return nil; })(); + $b = $$($nesting, 'BLOCK_MATH_DELIMITERS')['$[]']((style = node.$style().$to_sym())), $a = Opal.to_ary($b), (open = ($a[0] == null ? nil : $a[0])), (close = ($a[1] == null ? nil : $a[1])), $b; + equation = node.$content(); + if ($truthy((($a = style['$==']("asciimath")) ? equation['$include?']($$($nesting, 'LF')) : style['$==']("asciimath")))) { + + br = "" + "" + ($$($nesting, 'LF')); + equation = $send(equation, 'gsub', [$$($nesting, 'StemBreakRx')], (TMP_28 = function(){var self = TMP_28.$$s || this, $c; + + return "" + (close) + ($rb_times(br, (($c = $gvars['~']) === nil ? nil : $c['$[]'](0)).$count($$($nesting, 'LF')))) + (open)}, TMP_28.$$s = self, TMP_28.$$arity = 0, TMP_28));}; + if ($truthy(($truthy($a = equation['$start_with?'](open)) ? equation['$end_with?'](close) : $a))) { + } else { + equation = "" + (open) + (equation) + (close) + }; + return "" + "\n" + (title_element) + "
    \n" + (equation) + "\n" + "
    \n" + ""; + }, TMP_Html5Converter_stem_27.$$arity = 1); + + Opal.def(self, '$olist', TMP_Html5Converter_olist_29 = function $$olist(node) { + var TMP_30, self = this, result = nil, id_attribute = nil, classes = nil, class_attribute = nil, type_attribute = nil, keyword = nil, start_attribute = nil, reversed_attribute = nil; + + + result = []; + id_attribute = (function() {if ($truthy(node.$id())) { + return "" + " id=\"" + (node.$id()) + "\"" + } else { + return "" + }; return nil; })(); + classes = ["olist", node.$style(), node.$role()].$compact(); + class_attribute = "" + " class=\"" + (classes.$join(" ")) + "\""; + result['$<<']("" + ""); + if ($truthy(node['$title?']())) { + result['$<<']("" + "
    " + (node.$title()) + "
    ")}; + type_attribute = (function() {if ($truthy((keyword = node.$list_marker_keyword()))) { + return "" + " type=\"" + (keyword) + "\"" + } else { + return "" + }; return nil; })(); + start_attribute = (function() {if ($truthy(node['$attr?']("start"))) { + return "" + " start=\"" + (node.$attr("start")) + "\"" + } else { + return "" + }; return nil; })(); + reversed_attribute = (function() {if ($truthy(node['$option?']("reversed"))) { + + return self.$append_boolean_attribute("reversed", self.xml_mode); + } else { + return "" + }; return nil; })(); + result['$<<']("" + "
      "); + $send(node.$items(), 'each', [], (TMP_30 = function(item){var self = TMP_30.$$s || this; + + + + if (item == null) { + item = nil; + }; + result['$<<']("
    1. "); + result['$<<']("" + "

      " + (item.$text()) + "

      "); + if ($truthy(item['$blocks?']())) { + result['$<<'](item.$content())}; + return result['$<<']("
    2. ");}, TMP_30.$$s = self, TMP_30.$$arity = 1, TMP_30)); + result['$<<']("
    "); + result['$<<'](""); + return result.$join($$($nesting, 'LF')); + }, TMP_Html5Converter_olist_29.$$arity = 1); + + Opal.def(self, '$open', TMP_Html5Converter_open_31 = function $$open(node) { + var $a, $b, $c, self = this, style = nil, id_attr = nil, title_el = nil, role = nil; + + if ((style = node.$style())['$==']("abstract")) { + if ($truthy((($a = node.$parent()['$=='](node.$document())) ? node.$document().$doctype()['$==']("book") : node.$parent()['$=='](node.$document())))) { + + self.$logger().$warn("abstract block cannot be used in a document without a title when doctype is book. Excluding block content."); + return ""; + } else { + + id_attr = (function() {if ($truthy(node.$id())) { + return "" + " id=\"" + (node.$id()) + "\"" + } else { + return "" + }; return nil; })(); + title_el = (function() {if ($truthy(node['$title?']())) { + return "" + "
    " + (node.$title()) + "
    \n" + } else { + return "" + }; return nil; })(); + return "" + "\n" + (title_el) + "
    \n" + (node.$content()) + "\n" + "
    \n" + ""; + } + } else if ($truthy((($a = style['$==']("partintro")) ? ($truthy($b = ($truthy($c = $rb_gt(node.$level(), 0)) ? $c : node.$parent().$context()['$!=']("section"))) ? $b : node.$document().$doctype()['$!=']("book")) : style['$==']("partintro")))) { + + self.$logger().$error("partintro block can only be used when doctype is book and must be a child of a book part. Excluding block content."); + return ""; + } else { + + id_attr = (function() {if ($truthy(node.$id())) { + return "" + " id=\"" + (node.$id()) + "\"" + } else { + return "" + }; return nil; })(); + title_el = (function() {if ($truthy(node['$title?']())) { + return "" + "
    " + (node.$title()) + "
    \n" + } else { + return "" + }; return nil; })(); + return "" + "" + }, TMP_Html5Converter_page_break_32.$$arity = 1); + + Opal.def(self, '$paragraph', TMP_Html5Converter_paragraph_33 = function $$paragraph(node) { + var self = this, class_attribute = nil, attributes = nil; + + + class_attribute = (function() {if ($truthy(node.$role())) { + return "" + "class=\"paragraph " + (node.$role()) + "\"" + } else { + return "class=\"paragraph\"" + }; return nil; })(); + attributes = (function() {if ($truthy(node.$id())) { + return "" + "id=\"" + (node.$id()) + "\" " + (class_attribute) + } else { + return class_attribute + }; return nil; })(); + if ($truthy(node['$title?']())) { + return "" + "
    \n" + "
    " + (node.$title()) + "
    \n" + "

    " + (node.$content()) + "

    \n" + "
    " + } else { + return "" + "
    \n" + "

    " + (node.$content()) + "

    \n" + "
    " + }; + }, TMP_Html5Converter_paragraph_33.$$arity = 1); + + Opal.def(self, '$preamble', TMP_Html5Converter_preamble_34 = function $$preamble(node) { + var $a, $b, self = this, doc = nil, toc = nil; + + + if ($truthy(($truthy($a = ($truthy($b = (doc = node.$document())['$attr?']("toc-placement", "preamble")) ? doc['$sections?']() : $b)) ? doc['$attr?']("toc") : $a))) { + toc = "" + "\n" + "
    \n" + "
    " + (doc.$attr("toc-title")) + "
    \n" + (self.$outline(doc)) + "\n" + "
    " + } else { + toc = "" + }; + return "" + "
    \n" + "
    \n" + (node.$content()) + "\n" + "
    " + (toc) + "\n" + "
    "; + }, TMP_Html5Converter_preamble_34.$$arity = 1); + + Opal.def(self, '$quote', TMP_Html5Converter_quote_35 = function $$quote(node) { + var $a, self = this, id_attribute = nil, classes = nil, class_attribute = nil, title_element = nil, attribution = nil, citetitle = nil, cite_element = nil, attribution_text = nil, attribution_element = nil; + + + id_attribute = (function() {if ($truthy(node.$id())) { + return "" + " id=\"" + (node.$id()) + "\"" + } else { + return "" + }; return nil; })(); + classes = ["quoteblock", node.$role()].$compact(); + class_attribute = "" + " class=\"" + (classes.$join(" ")) + "\""; + title_element = (function() {if ($truthy(node['$title?']())) { + return "" + "\n
    " + (node.$title()) + "
    " + } else { + return "" + }; return nil; })(); + attribution = (function() {if ($truthy(node['$attr?']("attribution"))) { + + return node.$attr("attribution"); + } else { + return nil + }; return nil; })(); + citetitle = (function() {if ($truthy(node['$attr?']("citetitle"))) { + + return node.$attr("citetitle"); + } else { + return nil + }; return nil; })(); + if ($truthy(($truthy($a = attribution) ? $a : citetitle))) { + + cite_element = (function() {if ($truthy(citetitle)) { + return "" + "" + (citetitle) + "" + } else { + return "" + }; return nil; })(); + attribution_text = (function() {if ($truthy(attribution)) { + return "" + "— " + (attribution) + ((function() {if ($truthy(citetitle)) { + return "" + "\n" + } else { + return "" + }; return nil; })()) + } else { + return "" + }; return nil; })(); + attribution_element = "" + "\n
    \n" + (attribution_text) + (cite_element) + "\n
    "; + } else { + attribution_element = "" + }; + return "" + "" + (title_element) + "\n" + "
    \n" + (node.$content()) + "\n" + "
    " + (attribution_element) + "\n" + ""; + }, TMP_Html5Converter_quote_35.$$arity = 1); + + Opal.def(self, '$thematic_break', TMP_Html5Converter_thematic_break_36 = function $$thematic_break(node) { + var self = this; + + return "" + "" + }, TMP_Html5Converter_thematic_break_36.$$arity = 1); + + Opal.def(self, '$sidebar', TMP_Html5Converter_sidebar_37 = function $$sidebar(node) { + var self = this, id_attribute = nil, title_element = nil, role = nil; + + + id_attribute = (function() {if ($truthy(node.$id())) { + return "" + " id=\"" + (node.$id()) + "\"" + } else { + return "" + }; return nil; })(); + title_element = (function() {if ($truthy(node['$title?']())) { + return "" + "
    " + (node.$title()) + "
    \n" + } else { + return "" + }; return nil; })(); + return "" + "\n" + "
    \n" + (title_element) + (node.$content()) + "\n" + "
    \n" + ""; + }, TMP_Html5Converter_sidebar_37.$$arity = 1); + + Opal.def(self, '$table', TMP_Html5Converter_table_38 = function $$table(node) { + var $a, TMP_39, TMP_40, self = this, result = nil, id_attribute = nil, classes = nil, stripes = nil, styles = nil, autowidth = nil, tablewidth = nil, role = nil, class_attribute = nil, style_attribute = nil, slash = nil; + + + result = []; + id_attribute = (function() {if ($truthy(node.$id())) { + return "" + " id=\"" + (node.$id()) + "\"" + } else { + return "" + }; return nil; })(); + classes = ["tableblock", "" + "frame-" + (node.$attr("frame", "all")), "" + "grid-" + (node.$attr("grid", "all"))]; + if ($truthy((stripes = node.$attr("stripes")))) { + classes['$<<']("" + "stripes-" + (stripes))}; + styles = []; + if ($truthy(($truthy($a = (autowidth = node.$attributes()['$[]']("autowidth-option"))) ? node['$attr?']("width", nil, false)['$!']() : $a))) { + classes['$<<']("fit-content") + } else if ((tablewidth = node.$attr("tablepcwidth"))['$=='](100)) { + classes['$<<']("stretch") + } else { + styles['$<<']("" + "width: " + (tablewidth) + "%;") + }; + if ($truthy(node['$attr?']("float"))) { + classes['$<<'](node.$attr("float"))}; + if ($truthy((role = node.$role()))) { + classes['$<<'](role)}; + class_attribute = "" + " class=\"" + (classes.$join(" ")) + "\""; + style_attribute = (function() {if ($truthy(styles['$empty?']())) { + return "" + } else { + return "" + " style=\"" + (styles.$join(" ")) + "\"" + }; return nil; })(); + result['$<<']("" + ""); + if ($truthy(node['$title?']())) { + result['$<<']("" + "" + (node.$captioned_title()) + "")}; + if ($truthy($rb_gt(node.$attr("rowcount"), 0))) { + + slash = self.void_element_slash; + result['$<<'](""); + if ($truthy(autowidth)) { + result = $rb_plus(result, $$($nesting, 'Array').$new(node.$columns().$size(), "" + "")) + } else { + $send(node.$columns(), 'each', [], (TMP_39 = function(col){var self = TMP_39.$$s || this; + + + + if (col == null) { + col = nil; + }; + return result['$<<']((function() {if ($truthy(col.$attributes()['$[]']("autowidth-option"))) { + return "" + "" + } else { + return "" + "" + }; return nil; })());}, TMP_39.$$s = self, TMP_39.$$arity = 1, TMP_39)) + }; + result['$<<'](""); + $send(node.$rows().$by_section(), 'each', [], (TMP_40 = function(tsec, rows){var self = TMP_40.$$s || this, TMP_41; + + + + if (tsec == null) { + tsec = nil; + }; + + if (rows == null) { + rows = nil; + }; + if ($truthy(rows['$empty?']())) { + return nil;}; + result['$<<']("" + ""); + $send(rows, 'each', [], (TMP_41 = function(row){var self = TMP_41.$$s || this, TMP_42; + + + + if (row == null) { + row = nil; + }; + result['$<<'](""); + $send(row, 'each', [], (TMP_42 = function(cell){var self = TMP_42.$$s || this, $b, cell_content = nil, $case = nil, cell_tag_name = nil, cell_class_attribute = nil, cell_colspan_attribute = nil, cell_rowspan_attribute = nil, cell_style_attribute = nil; + + + + if (cell == null) { + cell = nil; + }; + if (tsec['$==']("head")) { + cell_content = cell.$text() + } else { + $case = cell.$style(); + if ("asciidoc"['$===']($case)) {cell_content = "" + "
    " + (cell.$content()) + "
    "} + else if ("verse"['$===']($case)) {cell_content = "" + "
    " + (cell.$text()) + "
    "} + else if ("literal"['$===']($case)) {cell_content = "" + "
    " + (cell.$text()) + "
    "} + else {cell_content = (function() {if ($truthy((cell_content = cell.$content())['$empty?']())) { + return "" + } else { + return "" + "

    " + (cell_content.$join("" + "

    \n" + "

    ")) + "

    " + }; return nil; })()} + }; + cell_tag_name = (function() {if ($truthy(($truthy($b = tsec['$==']("head")) ? $b : cell.$style()['$==']("header")))) { + return "th" + } else { + return "td" + }; return nil; })(); + cell_class_attribute = "" + " class=\"tableblock halign-" + (cell.$attr("halign")) + " valign-" + (cell.$attr("valign")) + "\""; + cell_colspan_attribute = (function() {if ($truthy(cell.$colspan())) { + return "" + " colspan=\"" + (cell.$colspan()) + "\"" + } else { + return "" + }; return nil; })(); + cell_rowspan_attribute = (function() {if ($truthy(cell.$rowspan())) { + return "" + " rowspan=\"" + (cell.$rowspan()) + "\"" + } else { + return "" + }; return nil; })(); + cell_style_attribute = (function() {if ($truthy(node.$document()['$attr?']("cellbgcolor"))) { + return "" + " style=\"background-color: " + (node.$document().$attr("cellbgcolor")) + ";\"" + } else { + return "" + }; return nil; })(); + return result['$<<']("" + "<" + (cell_tag_name) + (cell_class_attribute) + (cell_colspan_attribute) + (cell_rowspan_attribute) + (cell_style_attribute) + ">" + (cell_content) + "");}, TMP_42.$$s = self, TMP_42.$$arity = 1, TMP_42)); + return result['$<<']("");}, TMP_41.$$s = self, TMP_41.$$arity = 1, TMP_41)); + return result['$<<']("" + "
    ");}, TMP_40.$$s = self, TMP_40.$$arity = 2, TMP_40));}; + result['$<<'](""); + return result.$join($$($nesting, 'LF')); + }, TMP_Html5Converter_table_38.$$arity = 1); + + Opal.def(self, '$toc', TMP_Html5Converter_toc_43 = function $$toc(node) { + var $a, $b, self = this, doc = nil, id_attr = nil, title_id_attr = nil, title = nil, levels = nil, role = nil; + + + if ($truthy(($truthy($a = ($truthy($b = (doc = node.$document())['$attr?']("toc-placement", "macro")) ? doc['$sections?']() : $b)) ? doc['$attr?']("toc") : $a))) { + } else { + return "" + }; + if ($truthy(node.$id())) { + + id_attr = "" + " id=\"" + (node.$id()) + "\""; + title_id_attr = "" + " id=\"" + (node.$id()) + "title\""; + } else { + + id_attr = " id=\"toc\""; + title_id_attr = " id=\"toctitle\""; + }; + title = (function() {if ($truthy(node['$title?']())) { + return node.$title() + } else { + + return doc.$attr("toc-title"); + }; return nil; })(); + levels = (function() {if ($truthy(node['$attr?']("levels"))) { + return node.$attr("levels").$to_i() + } else { + return nil + }; return nil; })(); + role = (function() {if ($truthy(node['$role?']())) { + return node.$role() + } else { + + return doc.$attr("toc-class", "toc"); + }; return nil; })(); + return "" + "\n" + "" + (title) + "\n" + (self.$outline(doc, $hash2(["toclevels"], {"toclevels": levels}))) + "\n" + ""; + }, TMP_Html5Converter_toc_43.$$arity = 1); + + Opal.def(self, '$ulist', TMP_Html5Converter_ulist_44 = function $$ulist(node) { + var TMP_45, self = this, result = nil, id_attribute = nil, div_classes = nil, marker_checked = nil, marker_unchecked = nil, checklist = nil, ul_class_attribute = nil; + + + result = []; + id_attribute = (function() {if ($truthy(node.$id())) { + return "" + " id=\"" + (node.$id()) + "\"" + } else { + return "" + }; return nil; })(); + div_classes = ["ulist", node.$style(), node.$role()].$compact(); + marker_checked = (marker_unchecked = ""); + if ($truthy((checklist = node['$option?']("checklist")))) { + + div_classes.$unshift(div_classes.$shift(), "checklist"); + ul_class_attribute = " class=\"checklist\""; + if ($truthy(node['$option?']("interactive"))) { + if ($truthy(self.xml_mode)) { + + marker_checked = " "; + marker_unchecked = " "; + } else { + + marker_checked = " "; + marker_unchecked = " "; + } + } else if ($truthy(node.$document()['$attr?']("icons", "font"))) { + + marker_checked = " "; + marker_unchecked = " "; + } else { + + marker_checked = "✓ "; + marker_unchecked = "❏ "; + }; + } else { + ul_class_attribute = (function() {if ($truthy(node.$style())) { + return "" + " class=\"" + (node.$style()) + "\"" + } else { + return "" + }; return nil; })() + }; + result['$<<']("" + ""); + if ($truthy(node['$title?']())) { + result['$<<']("" + "
    " + (node.$title()) + "
    ")}; + result['$<<']("" + ""); + $send(node.$items(), 'each', [], (TMP_45 = function(item){var self = TMP_45.$$s || this, $a; + + + + if (item == null) { + item = nil; + }; + result['$<<']("
  • "); + if ($truthy(($truthy($a = checklist) ? item['$attr?']("checkbox") : $a))) { + result['$<<']("" + "

    " + ((function() {if ($truthy(item['$attr?']("checked"))) { + return marker_checked + } else { + return marker_unchecked + }; return nil; })()) + (item.$text()) + "

    ") + } else { + result['$<<']("" + "

    " + (item.$text()) + "

    ") + }; + if ($truthy(item['$blocks?']())) { + result['$<<'](item.$content())}; + return result['$<<']("
  • ");}, TMP_45.$$s = self, TMP_45.$$arity = 1, TMP_45)); + result['$<<'](""); + result['$<<'](""); + return result.$join($$($nesting, 'LF')); + }, TMP_Html5Converter_ulist_44.$$arity = 1); + + Opal.def(self, '$verse', TMP_Html5Converter_verse_46 = function $$verse(node) { + var $a, self = this, id_attribute = nil, classes = nil, class_attribute = nil, title_element = nil, attribution = nil, citetitle = nil, cite_element = nil, attribution_text = nil, attribution_element = nil; + + + id_attribute = (function() {if ($truthy(node.$id())) { + return "" + " id=\"" + (node.$id()) + "\"" + } else { + return "" + }; return nil; })(); + classes = ["verseblock", node.$role()].$compact(); + class_attribute = "" + " class=\"" + (classes.$join(" ")) + "\""; + title_element = (function() {if ($truthy(node['$title?']())) { + return "" + "\n
    " + (node.$title()) + "
    " + } else { + return "" + }; return nil; })(); + attribution = (function() {if ($truthy(node['$attr?']("attribution"))) { + + return node.$attr("attribution"); + } else { + return nil + }; return nil; })(); + citetitle = (function() {if ($truthy(node['$attr?']("citetitle"))) { + + return node.$attr("citetitle"); + } else { + return nil + }; return nil; })(); + if ($truthy(($truthy($a = attribution) ? $a : citetitle))) { + + cite_element = (function() {if ($truthy(citetitle)) { + return "" + "" + (citetitle) + "" + } else { + return "" + }; return nil; })(); + attribution_text = (function() {if ($truthy(attribution)) { + return "" + "— " + (attribution) + ((function() {if ($truthy(citetitle)) { + return "" + "\n" + } else { + return "" + }; return nil; })()) + } else { + return "" + }; return nil; })(); + attribution_element = "" + "\n
    \n" + (attribution_text) + (cite_element) + "\n
    "; + } else { + attribution_element = "" + }; + return "" + "" + (title_element) + "\n" + "
    " + (node.$content()) + "
    " + (attribution_element) + "\n" + ""; + }, TMP_Html5Converter_verse_46.$$arity = 1); + + Opal.def(self, '$video', TMP_Html5Converter_video_47 = function $$video(node) { + var $a, $b, self = this, xml = nil, id_attribute = nil, classes = nil, class_attribute = nil, title_element = nil, width_attribute = nil, height_attribute = nil, $case = nil, asset_uri_scheme = nil, start_anchor = nil, delimiter = nil, autoplay_param = nil, loop_param = nil, rel_param_val = nil, start_param = nil, end_param = nil, has_loop_param = nil, controls_param = nil, fs_param = nil, fs_attribute = nil, modest_param = nil, theme_param = nil, hl_param = nil, target = nil, list = nil, list_param = nil, playlist = nil, poster_attribute = nil, val = nil, preload_attribute = nil, start_t = nil, end_t = nil, time_anchor = nil; + + + xml = self.xml_mode; + id_attribute = (function() {if ($truthy(node.$id())) { + return "" + " id=\"" + (node.$id()) + "\"" + } else { + return "" + }; return nil; })(); + classes = ["videoblock"]; + if ($truthy(node['$attr?']("float"))) { + classes['$<<'](node.$attr("float"))}; + if ($truthy(node['$attr?']("align"))) { + classes['$<<']("" + "text-" + (node.$attr("align")))}; + if ($truthy(node.$role())) { + classes['$<<'](node.$role())}; + class_attribute = "" + " class=\"" + (classes.$join(" ")) + "\""; + title_element = (function() {if ($truthy(node['$title?']())) { + return "" + "\n
    " + (node.$title()) + "
    " + } else { + return "" + }; return nil; })(); + width_attribute = (function() {if ($truthy(node['$attr?']("width"))) { + return "" + " width=\"" + (node.$attr("width")) + "\"" + } else { + return "" + }; return nil; })(); + height_attribute = (function() {if ($truthy(node['$attr?']("height"))) { + return "" + " height=\"" + (node.$attr("height")) + "\"" + } else { + return "" + }; return nil; })(); + return (function() {$case = node.$attr("poster"); + if ("vimeo"['$===']($case)) { + if ($truthy((asset_uri_scheme = node.$document().$attr("asset-uri-scheme", "https"))['$empty?']())) { + } else { + asset_uri_scheme = "" + (asset_uri_scheme) + ":" + }; + start_anchor = (function() {if ($truthy(node['$attr?']("start", nil, false))) { + return "" + "#at=" + (node.$attr("start")) + } else { + return "" + }; return nil; })(); + delimiter = "?"; + if ($truthy(node['$option?']("autoplay"))) { + + autoplay_param = "" + (delimiter) + "autoplay=1"; + delimiter = "&"; + } else { + autoplay_param = "" + }; + loop_param = (function() {if ($truthy(node['$option?']("loop"))) { + return "" + (delimiter) + "loop=1" + } else { + return "" + }; return nil; })(); + return "" + "" + (title_element) + "\n" + "
    \n" + "\n" + "
    \n" + "";} + else if ("youtube"['$===']($case)) { + if ($truthy((asset_uri_scheme = node.$document().$attr("asset-uri-scheme", "https"))['$empty?']())) { + } else { + asset_uri_scheme = "" + (asset_uri_scheme) + ":" + }; + rel_param_val = (function() {if ($truthy(node['$option?']("related"))) { + return 1 + } else { + return 0 + }; return nil; })(); + start_param = (function() {if ($truthy(node['$attr?']("start", nil, false))) { + return "" + "&start=" + (node.$attr("start")) + } else { + return "" + }; return nil; })(); + end_param = (function() {if ($truthy(node['$attr?']("end", nil, false))) { + return "" + "&end=" + (node.$attr("end")) + } else { + return "" + }; return nil; })(); + autoplay_param = (function() {if ($truthy(node['$option?']("autoplay"))) { + return "&autoplay=1" + } else { + return "" + }; return nil; })(); + loop_param = (function() {if ($truthy((has_loop_param = node['$option?']("loop")))) { + return "&loop=1" + } else { + return "" + }; return nil; })(); + controls_param = (function() {if ($truthy(node['$option?']("nocontrols"))) { + return "&controls=0" + } else { + return "" + }; return nil; })(); + if ($truthy(node['$option?']("nofullscreen"))) { + + fs_param = "&fs=0"; + fs_attribute = ""; + } else { + + fs_param = ""; + fs_attribute = self.$append_boolean_attribute("allowfullscreen", xml); + }; + modest_param = (function() {if ($truthy(node['$option?']("modest"))) { + return "&modestbranding=1" + } else { + return "" + }; return nil; })(); + theme_param = (function() {if ($truthy(node['$attr?']("theme", nil, false))) { + return "" + "&theme=" + (node.$attr("theme")) + } else { + return "" + }; return nil; })(); + hl_param = (function() {if ($truthy(node['$attr?']("lang"))) { + return "" + "&hl=" + (node.$attr("lang")) + } else { + return "" + }; return nil; })(); + $b = node.$attr("target").$split("/", 2), $a = Opal.to_ary($b), (target = ($a[0] == null ? nil : $a[0])), (list = ($a[1] == null ? nil : $a[1])), $b; + if ($truthy((list = ($truthy($a = list) ? $a : node.$attr("list", nil, false))))) { + list_param = "" + "&list=" + (list) + } else { + + $b = target.$split(",", 2), $a = Opal.to_ary($b), (target = ($a[0] == null ? nil : $a[0])), (playlist = ($a[1] == null ? nil : $a[1])), $b; + if ($truthy((playlist = ($truthy($a = playlist) ? $a : node.$attr("playlist", nil, false))))) { + list_param = "" + "&playlist=" + (playlist) + } else { + list_param = (function() {if ($truthy(has_loop_param)) { + return "" + "&playlist=" + (target) + } else { + return "" + }; return nil; })() + }; + }; + return "" + "" + (title_element) + "\n" + "
    \n" + "\n" + "
    \n" + "";} + else { + poster_attribute = (function() {if ($truthy((val = node.$attr("poster", nil, false))['$nil_or_empty?']())) { + return "" + } else { + return "" + " poster=\"" + (node.$media_uri(val)) + "\"" + }; return nil; })(); + preload_attribute = (function() {if ($truthy((val = node.$attr("preload", nil, false))['$nil_or_empty?']())) { + return "" + } else { + return "" + " preload=\"" + (val) + "\"" + }; return nil; })(); + start_t = node.$attr("start", nil, false); + end_t = node.$attr("end", nil, false); + time_anchor = (function() {if ($truthy(($truthy($a = start_t) ? $a : end_t))) { + return "" + "#t=" + (($truthy($a = start_t) ? $a : "")) + ((function() {if ($truthy(end_t)) { + return "" + "," + (end_t) + } else { + return "" + }; return nil; })()) + } else { + return "" + }; return nil; })(); + return "" + "" + (title_element) + "\n" + "
    \n" + "\n" + "
    \n" + "";}})(); + }, TMP_Html5Converter_video_47.$$arity = 1); + + Opal.def(self, '$inline_anchor', TMP_Html5Converter_inline_anchor_48 = function $$inline_anchor(node) { + var $a, self = this, $case = nil, path = nil, attrs = nil, text = nil, refid = nil, ref = nil; + + return (function() {$case = node.$type(); + if ("xref"['$===']($case)) { + if ($truthy((path = node.$attributes()['$[]']("path")))) { + + attrs = self.$append_link_constraint_attrs(node, (function() {if ($truthy(node.$role())) { + return ["" + " class=\"" + (node.$role()) + "\""] + } else { + return [] + }; return nil; })()).$join(); + text = ($truthy($a = node.$text()) ? $a : path); + } else { + + attrs = (function() {if ($truthy(node.$role())) { + return "" + " class=\"" + (node.$role()) + "\"" + } else { + return "" + }; return nil; })(); + if ($truthy((text = node.$text()))) { + } else { + + refid = node.$attributes()['$[]']("refid"); + if ($truthy($$($nesting, 'AbstractNode')['$===']((ref = (self.refs = ($truthy($a = self.refs) ? $a : node.$document().$catalog()['$[]']("refs")))['$[]'](refid))))) { + text = ($truthy($a = ref.$xreftext(node.$attr("xrefstyle"))) ? $a : "" + "[" + (refid) + "]") + } else { + text = "" + "[" + (refid) + "]" + }; + }; + }; + return "" + "" + (text) + "";} + else if ("ref"['$===']($case)) {return "" + ""} + else if ("link"['$===']($case)) { + attrs = (function() {if ($truthy(node.$id())) { + return ["" + " id=\"" + (node.$id()) + "\""] + } else { + return [] + }; return nil; })(); + if ($truthy(node.$role())) { + attrs['$<<']("" + " class=\"" + (node.$role()) + "\"")}; + if ($truthy(node['$attr?']("title", nil, false))) { + attrs['$<<']("" + " title=\"" + (node.$attr("title")) + "\"")}; + return "" + "" + (node.$text()) + "";} + else if ("bibref"['$===']($case)) {return "" + "" + (node.$text())} + else { + self.$logger().$warn("" + "unknown anchor type: " + (node.$type().$inspect())); + return nil;}})() + }, TMP_Html5Converter_inline_anchor_48.$$arity = 1); + + Opal.def(self, '$inline_break', TMP_Html5Converter_inline_break_49 = function $$inline_break(node) { + var self = this; + + return "" + (node.$text()) + "" + }, TMP_Html5Converter_inline_break_49.$$arity = 1); + + Opal.def(self, '$inline_button', TMP_Html5Converter_inline_button_50 = function $$inline_button(node) { + var self = this; + + return "" + "" + (node.$text()) + "" + }, TMP_Html5Converter_inline_button_50.$$arity = 1); + + Opal.def(self, '$inline_callout', TMP_Html5Converter_inline_callout_51 = function $$inline_callout(node) { + var self = this, src = nil; + + if ($truthy(node.$document()['$attr?']("icons", "font"))) { + return "" + "(" + (node.$text()) + ")" + } else if ($truthy(node.$document()['$attr?']("icons"))) { + + src = node.$icon_uri("" + "callouts/" + (node.$text())); + return "" + "\"""; + } else { + return "" + (node.$attributes()['$[]']("guard")) + "(" + (node.$text()) + ")" + } + }, TMP_Html5Converter_inline_callout_51.$$arity = 1); + + Opal.def(self, '$inline_footnote', TMP_Html5Converter_inline_footnote_52 = function $$inline_footnote(node) { + var self = this, index = nil, id_attr = nil; + + if ($truthy((index = node.$attr("index", nil, false)))) { + if (node.$type()['$==']("xref")) { + return "" + "[" + (index) + "]" + } else { + + id_attr = (function() {if ($truthy(node.$id())) { + return "" + " id=\"_footnote_" + (node.$id()) + "\"" + } else { + return "" + }; return nil; })(); + return "" + "[" + (index) + "]"; + } + } else if (node.$type()['$==']("xref")) { + return "" + "[" + (node.$text()) + "]" + } else { + return nil + } + }, TMP_Html5Converter_inline_footnote_52.$$arity = 1); + + Opal.def(self, '$inline_image', TMP_Html5Converter_inline_image_53 = function $$inline_image(node) { + var $a, TMP_54, TMP_55, $b, $c, $d, self = this, type = nil, class_attr_val = nil, title_attr = nil, img = nil, target = nil, attrs = nil, svg = nil, obj = nil, fallback = nil, role = nil; + + + if ($truthy((($a = (type = node.$type())['$==']("icon")) ? node.$document()['$attr?']("icons", "font") : (type = node.$type())['$==']("icon")))) { + + class_attr_val = "" + "fa fa-" + (node.$target()); + $send($hash2(["size", "rotate", "flip"], {"size": "fa-", "rotate": "fa-rotate-", "flip": "fa-flip-"}), 'each', [], (TMP_54 = function(key, prefix){var self = TMP_54.$$s || this; + + + + if (key == null) { + key = nil; + }; + + if (prefix == null) { + prefix = nil; + }; + if ($truthy(node['$attr?'](key))) { + return (class_attr_val = "" + (class_attr_val) + " " + (prefix) + (node.$attr(key))) + } else { + return nil + };}, TMP_54.$$s = self, TMP_54.$$arity = 2, TMP_54)); + title_attr = (function() {if ($truthy(node['$attr?']("title"))) { + return "" + " title=\"" + (node.$attr("title")) + "\"" + } else { + return "" + }; return nil; })(); + img = "" + ""; + } else if ($truthy((($a = type['$==']("icon")) ? node.$document()['$attr?']("icons")['$!']() : type['$==']("icon")))) { + img = "" + "[" + (node.$alt()) + "]" + } else { + + target = node.$target(); + attrs = $send(["width", "height", "title"], 'map', [], (TMP_55 = function(name){var self = TMP_55.$$s || this; + + + + if (name == null) { + name = nil; + }; + if ($truthy(node['$attr?'](name))) { + return "" + " " + (name) + "=\"" + (node.$attr(name)) + "\"" + } else { + return "" + };}, TMP_55.$$s = self, TMP_55.$$arity = 1, TMP_55)).$join(); + if ($truthy(($truthy($a = ($truthy($b = ($truthy($c = type['$!=']("icon")) ? ($truthy($d = node['$attr?']("format", "svg", false)) ? $d : target['$include?'](".svg")) : $c)) ? $rb_lt(node.$document().$safe(), $$$($$($nesting, 'SafeMode'), 'SECURE')) : $b)) ? ($truthy($b = (svg = node['$option?']("inline"))) ? $b : (obj = node['$option?']("interactive"))) : $a))) { + if ($truthy(svg)) { + img = ($truthy($a = self.$read_svg_contents(node, target)) ? $a : "" + "" + (node.$alt()) + "") + } else if ($truthy(obj)) { + + fallback = (function() {if ($truthy(node['$attr?']("fallback"))) { + return "" + "\""" + } else { + return "" + "" + (node.$alt()) + "" + }; return nil; })(); + img = "" + "" + (fallback) + "";}}; + img = ($truthy($a = img) ? $a : "" + "\"""); + }; + if ($truthy(node['$attr?']("link", nil, false))) { + img = "" + "" + (img) + ""}; + if ($truthy((role = node.$role()))) { + if ($truthy(node['$attr?']("float"))) { + class_attr_val = "" + (type) + " " + (node.$attr("float")) + " " + (role) + } else { + class_attr_val = "" + (type) + " " + (role) + } + } else if ($truthy(node['$attr?']("float"))) { + class_attr_val = "" + (type) + " " + (node.$attr("float")) + } else { + class_attr_val = type + }; + return "" + "" + (img) + ""; + }, TMP_Html5Converter_inline_image_53.$$arity = 1); + + Opal.def(self, '$inline_indexterm', TMP_Html5Converter_inline_indexterm_56 = function $$inline_indexterm(node) { + var self = this; + + if (node.$type()['$==']("visible")) { + return node.$text() + } else { + return "" + } + }, TMP_Html5Converter_inline_indexterm_56.$$arity = 1); + + Opal.def(self, '$inline_kbd', TMP_Html5Converter_inline_kbd_57 = function $$inline_kbd(node) { + var self = this, keys = nil; + + if ((keys = node.$attr("keys")).$size()['$=='](1)) { + return "" + "" + (keys['$[]'](0)) + "" + } else { + return "" + "" + (keys.$join("+")) + "" + } + }, TMP_Html5Converter_inline_kbd_57.$$arity = 1); + + Opal.def(self, '$inline_menu', TMP_Html5Converter_inline_menu_58 = function $$inline_menu(node) { + var self = this, caret = nil, submenu_joiner = nil, menu = nil, submenus = nil, menuitem = nil; + + + caret = (function() {if ($truthy(node.$document()['$attr?']("icons", "font"))) { + return "  " + } else { + return "  " + }; return nil; })(); + submenu_joiner = "" + "
    " + (caret) + ""; + menu = node.$attr("menu"); + if ($truthy((submenus = node.$attr("submenus"))['$empty?']())) { + if ($truthy((menuitem = node.$attr("menuitem", nil, false)))) { + return "" + "" + (menu) + "" + (caret) + "" + (menuitem) + "" + } else { + return "" + "" + (menu) + "" + } + } else { + return "" + "" + (menu) + "" + (caret) + "" + (submenus.$join(submenu_joiner)) + "" + (caret) + "" + (node.$attr("menuitem")) + "" + }; + }, TMP_Html5Converter_inline_menu_58.$$arity = 1); + + Opal.def(self, '$inline_quoted', TMP_Html5Converter_inline_quoted_59 = function $$inline_quoted(node) { + var $a, $b, self = this, open = nil, close = nil, is_tag = nil, class_attr = nil, id_attr = nil; + + + $b = $$($nesting, 'QUOTE_TAGS')['$[]'](node.$type()), $a = Opal.to_ary($b), (open = ($a[0] == null ? nil : $a[0])), (close = ($a[1] == null ? nil : $a[1])), (is_tag = ($a[2] == null ? nil : $a[2])), $b; + if ($truthy(node.$role())) { + class_attr = "" + " class=\"" + (node.$role()) + "\""}; + if ($truthy(node.$id())) { + id_attr = "" + " id=\"" + (node.$id()) + "\""}; + if ($truthy(($truthy($a = class_attr) ? $a : id_attr))) { + if ($truthy(is_tag)) { + return "" + (open.$chop()) + (($truthy($a = id_attr) ? $a : "")) + (($truthy($a = class_attr) ? $a : "")) + ">" + (node.$text()) + (close) + } else { + return "" + "" + (open) + (node.$text()) + (close) + "" + } + } else { + return "" + (open) + (node.$text()) + (close) + }; + }, TMP_Html5Converter_inline_quoted_59.$$arity = 1); + + Opal.def(self, '$append_boolean_attribute', TMP_Html5Converter_append_boolean_attribute_60 = function $$append_boolean_attribute(name, xml) { + var self = this; + + if ($truthy(xml)) { + return "" + " " + (name) + "=\"" + (name) + "\"" + } else { + return "" + " " + (name) + } + }, TMP_Html5Converter_append_boolean_attribute_60.$$arity = 2); + + Opal.def(self, '$encode_quotes', TMP_Html5Converter_encode_quotes_61 = function $$encode_quotes(val) { + var self = this; + + if ($truthy(val['$include?']("\""))) { + + return val.$gsub("\"", """); + } else { + return val + } + }, TMP_Html5Converter_encode_quotes_61.$$arity = 1); + + Opal.def(self, '$generate_manname_section', TMP_Html5Converter_generate_manname_section_62 = function $$generate_manname_section(node) { + var $a, self = this, manname_title = nil, next_section = nil, next_section_title = nil, manname_id_attr = nil, manname_id = nil; + + + manname_title = node.$attr("manname-title", "Name"); + if ($truthy(($truthy($a = (next_section = node.$sections()['$[]'](0))) ? (next_section_title = next_section.$title())['$=='](next_section_title.$upcase()) : $a))) { + manname_title = manname_title.$upcase()}; + manname_id_attr = (function() {if ($truthy((manname_id = node.$attr("manname-id")))) { + return "" + " id=\"" + (manname_id) + "\"" + } else { + return "" + }; return nil; })(); + return "" + "" + (manname_title) + "\n" + "
    \n" + "

    " + (node.$attr("manname")) + " - " + (node.$attr("manpurpose")) + "

    \n" + "
    "; + }, TMP_Html5Converter_generate_manname_section_62.$$arity = 1); + + Opal.def(self, '$append_link_constraint_attrs', TMP_Html5Converter_append_link_constraint_attrs_63 = function $$append_link_constraint_attrs(node, attrs) { + var $a, self = this, rel = nil, window = nil; + + + + if (attrs == null) { + attrs = []; + }; + if ($truthy(node['$option?']("nofollow"))) { + rel = "nofollow"}; + if ($truthy((window = node.$attributes()['$[]']("window")))) { + + attrs['$<<']("" + " target=\"" + (window) + "\""); + if ($truthy(($truthy($a = window['$==']("_blank")) ? $a : node['$option?']("noopener")))) { + attrs['$<<']((function() {if ($truthy(rel)) { + return "" + " rel=\"" + (rel) + " noopener\"" + } else { + return " rel=\"noopener\"" + }; return nil; })())}; + } else if ($truthy(rel)) { + attrs['$<<']("" + " rel=\"" + (rel) + "\"")}; + return attrs; + }, TMP_Html5Converter_append_link_constraint_attrs_63.$$arity = -2); + return (Opal.def(self, '$read_svg_contents', TMP_Html5Converter_read_svg_contents_64 = function $$read_svg_contents(node, target) { + var TMP_65, self = this, svg = nil, old_start_tag = nil, new_start_tag = nil; + + + if ($truthy((svg = node.$read_contents(target, $hash2(["start", "normalize", "label"], {"start": node.$document().$attr("imagesdir"), "normalize": true, "label": "SVG"}))))) { + + if ($truthy(svg['$start_with?'](""); + } else { + return nil + };}, TMP_65.$$s = self, TMP_65.$$arity = 1, TMP_65)); + if ($truthy(new_start_tag)) { + svg = "" + (new_start_tag) + (svg['$[]'](Opal.Range.$new(old_start_tag.$length(), -1, false)))};}; + return svg; + }, TMP_Html5Converter_read_svg_contents_64.$$arity = 2), nil) && 'read_svg_contents'; + })($$($nesting, 'Converter'), $$$($$($nesting, 'Converter'), 'BuiltIn'), $nesting) + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/extensions"] = function(Opal) { + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + function $rb_plus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); + } + function $rb_gt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); + } + function $rb_lt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); + } + var $a, self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $truthy = Opal.truthy, $module = Opal.module, $klass = Opal.klass, $hash2 = Opal.hash2, $send = Opal.send, $hash = Opal.hash; + + Opal.add_stubs(['$require', '$to_s', '$[]=', '$config', '$-', '$nil_or_empty?', '$name', '$grep', '$constants', '$include', '$const_get', '$extend', '$attr_reader', '$merge', '$class', '$update', '$raise', '$document', '$==', '$doctype', '$[]', '$+', '$level', '$delete', '$>', '$casecmp', '$new', '$title=', '$sectname=', '$special=', '$fetch', '$numbered=', '$!', '$key?', '$attr?', '$special', '$numbered', '$generate_id', '$title', '$id=', '$update_attributes', '$tr', '$basename', '$create_block', '$assign_caption', '$===', '$next_block', '$dup', '$<<', '$has_more_lines?', '$each', '$define_method', '$unshift', '$shift', '$send', '$empty?', '$size', '$call', '$option', '$flatten', '$respond_to?', '$include?', '$split', '$to_i', '$compact', '$inspect', '$attr_accessor', '$to_set', '$match?', '$resolve_regexp', '$method', '$register', '$values', '$groups', '$arity', '$instance_exec', '$to_proc', '$activate', '$add_document_processor', '$any?', '$select', '$add_syntax_processor', '$to_sym', '$instance_variable_get', '$kind', '$private', '$join', '$map', '$capitalize', '$instance_variable_set', '$resolve_args', '$freeze', '$process_block_given?', '$source_location', '$resolve_class', '$<', '$update_config', '$push', '$as_symbol', '$name=', '$pop', '$-@', '$next_auto_id', '$generate_name', '$class_for_name', '$reduce', '$const_defined?']); + + if ($truthy((($a = $$($nesting, 'Asciidoctor', 'skip_raise')) ? 'constant' : nil))) { + } else { + self.$require("asciidoctor".$to_s()) + }; + return (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + (function($base, $parent_nesting) { + function $Extensions() {}; + var self = $Extensions = $module($base, 'Extensions', $Extensions); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + + (function($base, $super, $parent_nesting) { + function $Processor(){}; + var self = $Processor = $klass($base, $super, 'Processor', $Processor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Processor_initialize_4, TMP_Processor_update_config_5, TMP_Processor_process_6, TMP_Processor_create_section_7, TMP_Processor_create_block_8, TMP_Processor_create_list_9, TMP_Processor_create_list_item_10, TMP_Processor_create_image_block_11, TMP_Processor_create_inline_12, TMP_Processor_parse_content_13, TMP_Processor_14; + + def.config = nil; + + (function(self, $parent_nesting) { + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_config_1, TMP_option_2, TMP_use_dsl_3; + + + + Opal.def(self, '$config', TMP_config_1 = function $$config() { + var $a, self = this; + if (self.config == null) self.config = nil; + + return (self.config = ($truthy($a = self.config) ? $a : $hash2([], {}))) + }, TMP_config_1.$$arity = 0); + + Opal.def(self, '$option', TMP_option_2 = function $$option(key, default_value) { + var self = this, $writer = nil; + + + $writer = [key, default_value]; + $send(self.$config(), '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + }, TMP_option_2.$$arity = 2); + + Opal.def(self, '$use_dsl', TMP_use_dsl_3 = function $$use_dsl() { + var self = this; + + if ($truthy(self.$name()['$nil_or_empty?']())) { + if ($truthy((Opal.Module.$$nesting = $nesting, self.$constants()).$grep("DSL"))) { + return self.$include(self.$const_get("DSL")) + } else { + return nil + } + } else if ($truthy((Opal.Module.$$nesting = $nesting, self.$constants()).$grep("DSL"))) { + return self.$extend(self.$const_get("DSL")) + } else { + return nil + } + }, TMP_use_dsl_3.$$arity = 0); + Opal.alias(self, "extend_dsl", "use_dsl"); + return Opal.alias(self, "include_dsl", "use_dsl"); + })(Opal.get_singleton_class(self), $nesting); + self.$attr_reader("config"); + + Opal.def(self, '$initialize', TMP_Processor_initialize_4 = function $$initialize(config) { + var self = this; + + + + if (config == null) { + config = $hash2([], {}); + }; + return (self.config = self.$class().$config().$merge(config)); + }, TMP_Processor_initialize_4.$$arity = -1); + + Opal.def(self, '$update_config', TMP_Processor_update_config_5 = function $$update_config(config) { + var self = this; + + return self.config.$update(config) + }, TMP_Processor_update_config_5.$$arity = 1); + + Opal.def(self, '$process', TMP_Processor_process_6 = function $$process($a) { + var $post_args, args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + return self.$raise($$$('::', 'NotImplementedError'), "" + "Asciidoctor::Extensions::Processor subclass must implement #" + ("process") + " method"); + }, TMP_Processor_process_6.$$arity = -1); + + Opal.def(self, '$create_section', TMP_Processor_create_section_7 = function $$create_section(parent, title, attrs, opts) { + var $a, self = this, doc = nil, book = nil, doctype = nil, level = nil, style = nil, sectname = nil, special = nil, sect = nil, $writer = nil, id = nil; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + doc = parent.$document(); + book = (doctype = doc.$doctype())['$==']("book"); + level = ($truthy($a = opts['$[]']("level")) ? $a : $rb_plus(parent.$level(), 1)); + if ($truthy((style = attrs.$delete("style")))) { + if ($truthy(($truthy($a = book) ? style['$==']("abstract") : $a))) { + $a = ["chapter", 1], (sectname = $a[0]), (level = $a[1]), $a + } else { + + $a = [style, true], (sectname = $a[0]), (special = $a[1]), $a; + if (level['$=='](0)) { + level = 1}; + } + } else if ($truthy(book)) { + sectname = (function() {if (level['$=='](0)) { + return "part" + } else { + + if ($truthy($rb_gt(level, 1))) { + return "section" + } else { + return "chapter" + }; + }; return nil; })() + } else if ($truthy((($a = doctype['$==']("manpage")) ? title.$casecmp("synopsis")['$=='](0) : doctype['$==']("manpage")))) { + $a = ["synopsis", true], (sectname = $a[0]), (special = $a[1]), $a + } else { + sectname = "section" + }; + sect = $$($nesting, 'Section').$new(parent, level); + $a = [title, sectname], sect['$title=']($a[0]), sect['$sectname=']($a[1]), $a; + if ($truthy(special)) { + + + $writer = [true]; + $send(sect, 'special=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + if ($truthy(opts.$fetch("numbered", style['$==']("appendix")))) { + + $writer = [true]; + $send(sect, 'numbered=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + } else if ($truthy(($truthy($a = opts['$key?']("numbered")['$!']()) ? doc['$attr?']("sectnums", "all") : $a))) { + + $writer = [(function() {if ($truthy(($truthy($a = book) ? level['$=='](1) : $a))) { + return "chapter" + } else { + return true + }; return nil; })()]; + $send(sect, 'numbered=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + } else if ($truthy($rb_gt(level, 0))) { + if ($truthy(opts.$fetch("numbered", doc['$attr?']("sectnums")))) { + + $writer = [(function() {if ($truthy(sect.$special())) { + return ($truthy($a = parent.$numbered()) ? true : $a) + } else { + return true + }; return nil; })()]; + $send(sect, 'numbered=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];} + } else if ($truthy(opts.$fetch("numbered", ($truthy($a = book) ? doc['$attr?']("partnums") : $a)))) { + + $writer = [true]; + $send(sect, 'numbered=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if ((id = attrs.$delete("id"))['$=='](false)) { + } else { + + $writer = [(($writer = ["id", ($truthy($a = id) ? $a : (function() {if ($truthy(doc['$attr?']("sectids"))) { + + return $$($nesting, 'Section').$generate_id(sect.$title(), doc); + } else { + return nil + }; return nil; })())]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])]; + $send(sect, 'id=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + sect.$update_attributes(attrs); + return sect; + }, TMP_Processor_create_section_7.$$arity = -4); + + Opal.def(self, '$create_block', TMP_Processor_create_block_8 = function $$create_block(parent, context, source, attrs, opts) { + var self = this; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + return $$($nesting, 'Block').$new(parent, context, $hash2(["source", "attributes"], {"source": source, "attributes": attrs}).$merge(opts)); + }, TMP_Processor_create_block_8.$$arity = -5); + + Opal.def(self, '$create_list', TMP_Processor_create_list_9 = function $$create_list(parent, context, attrs) { + var self = this, list = nil; + + + + if (attrs == null) { + attrs = nil; + }; + list = $$($nesting, 'List').$new(parent, context); + if ($truthy(attrs)) { + list.$update_attributes(attrs)}; + return list; + }, TMP_Processor_create_list_9.$$arity = -3); + + Opal.def(self, '$create_list_item', TMP_Processor_create_list_item_10 = function $$create_list_item(parent, text) { + var self = this; + + + + if (text == null) { + text = nil; + }; + return $$($nesting, 'ListItem').$new(parent, text); + }, TMP_Processor_create_list_item_10.$$arity = -2); + + Opal.def(self, '$create_image_block', TMP_Processor_create_image_block_11 = function $$create_image_block(parent, attrs, opts) { + var $a, self = this, target = nil, $writer = nil, title = nil, block = nil; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + if ($truthy((target = attrs['$[]']("target")))) { + } else { + self.$raise($$$('::', 'ArgumentError'), "Unable to create an image block, target attribute is required") + }; + ($truthy($a = attrs['$[]']("alt")) ? $a : (($writer = ["alt", (($writer = ["default-alt", $$($nesting, 'Helpers').$basename(target, true).$tr("_-", " ")]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + title = (function() {if ($truthy(attrs['$key?']("title"))) { + + return attrs.$delete("title"); + } else { + return nil + }; return nil; })(); + block = self.$create_block(parent, "image", nil, attrs, opts); + if ($truthy(title)) { + + + $writer = [title]; + $send(block, 'title=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + block.$assign_caption(attrs.$delete("caption"), ($truthy($a = opts['$[]']("caption_context")) ? $a : "figure"));}; + return block; + }, TMP_Processor_create_image_block_11.$$arity = -3); + + Opal.def(self, '$create_inline', TMP_Processor_create_inline_12 = function $$create_inline(parent, context, text, opts) { + var self = this; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + return $$($nesting, 'Inline').$new(parent, context, text, opts); + }, TMP_Processor_create_inline_12.$$arity = -4); + + Opal.def(self, '$parse_content', TMP_Processor_parse_content_13 = function $$parse_content(parent, content, attributes) { + var $a, $b, $c, self = this, reader = nil, block = nil; + + + + if (attributes == null) { + attributes = nil; + }; + reader = (function() {if ($truthy($$($nesting, 'Reader')['$==='](content))) { + return content + } else { + + return $$($nesting, 'Reader').$new(content); + }; return nil; })(); + while ($truthy(($truthy($b = ($truthy($c = (block = $$($nesting, 'Parser').$next_block(reader, parent, (function() {if ($truthy(attributes)) { + return attributes.$dup() + } else { + return $hash2([], {}) + }; return nil; })()))) ? parent['$<<'](block) : $c)) ? $b : reader['$has_more_lines?']()))) { + + }; + return parent; + }, TMP_Processor_parse_content_13.$$arity = -3); + return $send([["create_paragraph", "create_block", "paragraph"], ["create_open_block", "create_block", "open"], ["create_example_block", "create_block", "example"], ["create_pass_block", "create_block", "pass"], ["create_listing_block", "create_block", "listing"], ["create_literal_block", "create_block", "literal"], ["create_anchor", "create_inline", "anchor"]], 'each', [], (TMP_Processor_14 = function(method_name, delegate_method_name, context){var self = TMP_Processor_14.$$s || this, TMP_15; + + + + if (method_name == null) { + method_name = nil; + }; + + if (delegate_method_name == null) { + delegate_method_name = nil; + }; + + if (context == null) { + context = nil; + }; + return $send(self, 'define_method', [method_name], (TMP_15 = function($a){var self = TMP_15.$$s || this, $post_args, args; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + args.$unshift(args.$shift(), context); + return $send(self, 'send', [delegate_method_name].concat(Opal.to_a(args)));}, TMP_15.$$s = self, TMP_15.$$arity = -1, TMP_15));}, TMP_Processor_14.$$s = self, TMP_Processor_14.$$arity = 3, TMP_Processor_14)); + })($nesting[0], null, $nesting); + (function($base, $parent_nesting) { + function $ProcessorDsl() {}; + var self = $ProcessorDsl = $module($base, 'ProcessorDsl', $ProcessorDsl); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_ProcessorDsl_option_16, TMP_ProcessorDsl_process_17, TMP_ProcessorDsl_process_block_given$q_18; + + + + Opal.def(self, '$option', TMP_ProcessorDsl_option_16 = function $$option(key, value) { + var self = this, $writer = nil; + + + $writer = [key, value]; + $send(self.$config(), '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + }, TMP_ProcessorDsl_option_16.$$arity = 2); + + Opal.def(self, '$process', TMP_ProcessorDsl_process_17 = function $$process($a) { + var $iter = TMP_ProcessorDsl_process_17.$$p, block = $iter || nil, $post_args, args, $b, self = this; + if (self.process_block == null) self.process_block = nil; + + if ($iter) TMP_ProcessorDsl_process_17.$$p = null; + + + if ($iter) TMP_ProcessorDsl_process_17.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + if ((block !== nil)) { + + if ($truthy(args['$empty?']())) { + } else { + self.$raise($$$('::', 'ArgumentError'), "" + "wrong number of arguments (given " + (args.$size()) + ", expected 0)") + }; + return (self.process_block = block); + } else if ($truthy((($b = self['process_block'], $b != null && $b !== nil) ? 'instance-variable' : nil))) { + return $send(self.process_block, 'call', Opal.to_a(args)) + } else { + return self.$raise($$$('::', 'NotImplementedError')) + }; + }, TMP_ProcessorDsl_process_17.$$arity = -1); + + Opal.def(self, '$process_block_given?', TMP_ProcessorDsl_process_block_given$q_18 = function() { + var $a, self = this; + + return (($a = self['process_block'], $a != null && $a !== nil) ? 'instance-variable' : nil) + }, TMP_ProcessorDsl_process_block_given$q_18.$$arity = 0); + })($nesting[0], $nesting); + (function($base, $parent_nesting) { + function $DocumentProcessorDsl() {}; + var self = $DocumentProcessorDsl = $module($base, 'DocumentProcessorDsl', $DocumentProcessorDsl); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_DocumentProcessorDsl_prefer_19; + + + self.$include($$($nesting, 'ProcessorDsl')); + + Opal.def(self, '$prefer', TMP_DocumentProcessorDsl_prefer_19 = function $$prefer() { + var self = this; + + return self.$option("position", ">>") + }, TMP_DocumentProcessorDsl_prefer_19.$$arity = 0); + })($nesting[0], $nesting); + (function($base, $parent_nesting) { + function $SyntaxProcessorDsl() {}; + var self = $SyntaxProcessorDsl = $module($base, 'SyntaxProcessorDsl', $SyntaxProcessorDsl); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_SyntaxProcessorDsl_named_20, TMP_SyntaxProcessorDsl_content_model_21, TMP_SyntaxProcessorDsl_positional_attrs_22, TMP_SyntaxProcessorDsl_default_attrs_23, TMP_SyntaxProcessorDsl_resolves_attributes_24; + + + self.$include($$($nesting, 'ProcessorDsl')); + + Opal.def(self, '$named', TMP_SyntaxProcessorDsl_named_20 = function $$named(value) { + var self = this; + + if ($truthy($$($nesting, 'Processor')['$==='](self))) { + return (self.name = value) + } else { + return self.$option("name", value) + } + }, TMP_SyntaxProcessorDsl_named_20.$$arity = 1); + Opal.alias(self, "match_name", "named"); + + Opal.def(self, '$content_model', TMP_SyntaxProcessorDsl_content_model_21 = function $$content_model(value) { + var self = this; + + return self.$option("content_model", value) + }, TMP_SyntaxProcessorDsl_content_model_21.$$arity = 1); + Opal.alias(self, "parse_content_as", "content_model"); + Opal.alias(self, "parses_content_as", "content_model"); + + Opal.def(self, '$positional_attrs', TMP_SyntaxProcessorDsl_positional_attrs_22 = function $$positional_attrs($a) { + var $post_args, value, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + value = $post_args;; + return self.$option("pos_attrs", value.$flatten()); + }, TMP_SyntaxProcessorDsl_positional_attrs_22.$$arity = -1); + Opal.alias(self, "name_attributes", "positional_attrs"); + Opal.alias(self, "name_positional_attributes", "positional_attrs"); + + Opal.def(self, '$default_attrs', TMP_SyntaxProcessorDsl_default_attrs_23 = function $$default_attrs(value) { + var self = this; + + return self.$option("default_attrs", value) + }, TMP_SyntaxProcessorDsl_default_attrs_23.$$arity = 1); + + Opal.def(self, '$resolves_attributes', TMP_SyntaxProcessorDsl_resolves_attributes_24 = function $$resolves_attributes($a) { + var $post_args, args, $b, TMP_25, TMP_26, self = this, $case = nil, names = nil, defaults = nil; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + if ($truthy($rb_gt(args.$size(), 1))) { + } else if ($truthy((args = args.$fetch(0, true))['$respond_to?']("to_sym"))) { + args = [args]}; + return (function() {$case = args; + if (true['$===']($case)) { + self.$option("pos_attrs", []); + return self.$option("default_attrs", $hash2([], {}));} + else if ($$$('::', 'Array')['$===']($case)) { + $b = [[], $hash2([], {})], (names = $b[0]), (defaults = $b[1]), $b; + $send(args, 'each', [], (TMP_25 = function(arg){var self = TMP_25.$$s || this, $c, $d, name = nil, value = nil, idx = nil, $writer = nil; + + + + if (arg == null) { + arg = nil; + }; + if ($truthy((arg = arg.$to_s())['$include?']("="))) { + + $d = arg.$split("=", 2), $c = Opal.to_ary($d), (name = ($c[0] == null ? nil : $c[0])), (value = ($c[1] == null ? nil : $c[1])), $d; + if ($truthy(name['$include?'](":"))) { + + $d = name.$split(":", 2), $c = Opal.to_ary($d), (idx = ($c[0] == null ? nil : $c[0])), (name = ($c[1] == null ? nil : $c[1])), $d; + idx = (function() {if (idx['$==']("@")) { + return names.$size() + } else { + return idx.$to_i() + }; return nil; })(); + + $writer = [idx, name]; + $send(names, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];;}; + + $writer = [name, value]; + $send(defaults, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];; + } else if ($truthy(arg['$include?'](":"))) { + + $d = arg.$split(":", 2), $c = Opal.to_ary($d), (idx = ($c[0] == null ? nil : $c[0])), (name = ($c[1] == null ? nil : $c[1])), $d; + idx = (function() {if (idx['$==']("@")) { + return names.$size() + } else { + return idx.$to_i() + }; return nil; })(); + + $writer = [idx, name]; + $send(names, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];; + } else { + return names['$<<'](arg) + };}, TMP_25.$$s = self, TMP_25.$$arity = 1, TMP_25)); + self.$option("pos_attrs", names.$compact()); + return self.$option("default_attrs", defaults);} + else if ($$$('::', 'Hash')['$===']($case)) { + $b = [[], $hash2([], {})], (names = $b[0]), (defaults = $b[1]), $b; + $send(args, 'each', [], (TMP_26 = function(key, val){var self = TMP_26.$$s || this, $c, $d, name = nil, idx = nil, $writer = nil; + + + + if (key == null) { + key = nil; + }; + + if (val == null) { + val = nil; + }; + if ($truthy((name = key.$to_s())['$include?'](":"))) { + + $d = name.$split(":", 2), $c = Opal.to_ary($d), (idx = ($c[0] == null ? nil : $c[0])), (name = ($c[1] == null ? nil : $c[1])), $d; + idx = (function() {if (idx['$==']("@")) { + return names.$size() + } else { + return idx.$to_i() + }; return nil; })(); + + $writer = [idx, name]; + $send(names, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];;}; + if ($truthy(val)) { + + $writer = [name, val]; + $send(defaults, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + } else { + return nil + };}, TMP_26.$$s = self, TMP_26.$$arity = 2, TMP_26)); + self.$option("pos_attrs", names.$compact()); + return self.$option("default_attrs", defaults);} + else {return self.$raise($$$('::', 'ArgumentError'), "" + "unsupported attributes specification for macro: " + (args.$inspect()))}})(); + }, TMP_SyntaxProcessorDsl_resolves_attributes_24.$$arity = -1); + Opal.alias(self, "resolve_attributes", "resolves_attributes"); + })($nesting[0], $nesting); + (function($base, $super, $parent_nesting) { + function $Preprocessor(){}; + var self = $Preprocessor = $klass($base, $super, 'Preprocessor', $Preprocessor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Preprocessor_process_27; + + return (Opal.def(self, '$process', TMP_Preprocessor_process_27 = function $$process(document, reader) { + var self = this; + + return self.$raise($$$('::', 'NotImplementedError'), "" + "Asciidoctor::Extensions::Preprocessor subclass must implement #" + ("process") + " method") + }, TMP_Preprocessor_process_27.$$arity = 2), nil) && 'process' + })($nesting[0], $$($nesting, 'Processor'), $nesting); + Opal.const_set($$($nesting, 'Preprocessor'), 'DSL', $$($nesting, 'DocumentProcessorDsl')); + (function($base, $super, $parent_nesting) { + function $TreeProcessor(){}; + var self = $TreeProcessor = $klass($base, $super, 'TreeProcessor', $TreeProcessor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_TreeProcessor_process_28; + + return (Opal.def(self, '$process', TMP_TreeProcessor_process_28 = function $$process(document) { + var self = this; + + return self.$raise($$$('::', 'NotImplementedError'), "" + "Asciidoctor::Extensions::TreeProcessor subclass must implement #" + ("process") + " method") + }, TMP_TreeProcessor_process_28.$$arity = 1), nil) && 'process' + })($nesting[0], $$($nesting, 'Processor'), $nesting); + Opal.const_set($$($nesting, 'TreeProcessor'), 'DSL', $$($nesting, 'DocumentProcessorDsl')); + Opal.const_set($nesting[0], 'Treeprocessor', $$($nesting, 'TreeProcessor')); + (function($base, $super, $parent_nesting) { + function $Postprocessor(){}; + var self = $Postprocessor = $klass($base, $super, 'Postprocessor', $Postprocessor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Postprocessor_process_29; + + return (Opal.def(self, '$process', TMP_Postprocessor_process_29 = function $$process(document, output) { + var self = this; + + return self.$raise($$$('::', 'NotImplementedError'), "" + "Asciidoctor::Extensions::Postprocessor subclass must implement #" + ("process") + " method") + }, TMP_Postprocessor_process_29.$$arity = 2), nil) && 'process' + })($nesting[0], $$($nesting, 'Processor'), $nesting); + Opal.const_set($$($nesting, 'Postprocessor'), 'DSL', $$($nesting, 'DocumentProcessorDsl')); + (function($base, $super, $parent_nesting) { + function $IncludeProcessor(){}; + var self = $IncludeProcessor = $klass($base, $super, 'IncludeProcessor', $IncludeProcessor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_IncludeProcessor_process_30, TMP_IncludeProcessor_handles$q_31; + + + + Opal.def(self, '$process', TMP_IncludeProcessor_process_30 = function $$process(document, reader, target, attributes) { + var self = this; + + return self.$raise($$$('::', 'NotImplementedError'), "" + "Asciidoctor::Extensions::IncludeProcessor subclass must implement #" + ("process") + " method") + }, TMP_IncludeProcessor_process_30.$$arity = 4); + return (Opal.def(self, '$handles?', TMP_IncludeProcessor_handles$q_31 = function(target) { + var self = this; + + return true + }, TMP_IncludeProcessor_handles$q_31.$$arity = 1), nil) && 'handles?'; + })($nesting[0], $$($nesting, 'Processor'), $nesting); + (function($base, $parent_nesting) { + function $IncludeProcessorDsl() {}; + var self = $IncludeProcessorDsl = $module($base, 'IncludeProcessorDsl', $IncludeProcessorDsl); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_IncludeProcessorDsl_handles$q_32; + + + self.$include($$($nesting, 'DocumentProcessorDsl')); + + Opal.def(self, '$handles?', TMP_IncludeProcessorDsl_handles$q_32 = function($a) { + var $iter = TMP_IncludeProcessorDsl_handles$q_32.$$p, block = $iter || nil, $post_args, args, $b, self = this; + if (self.handles_block == null) self.handles_block = nil; + + if ($iter) TMP_IncludeProcessorDsl_handles$q_32.$$p = null; + + + if ($iter) TMP_IncludeProcessorDsl_handles$q_32.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + if ((block !== nil)) { + + if ($truthy(args['$empty?']())) { + } else { + self.$raise($$$('::', 'ArgumentError'), "" + "wrong number of arguments (given " + (args.$size()) + ", expected 0)") + }; + return (self.handles_block = block); + } else if ($truthy((($b = self['handles_block'], $b != null && $b !== nil) ? 'instance-variable' : nil))) { + return self.handles_block.$call(args['$[]'](0)) + } else { + return true + }; + }, TMP_IncludeProcessorDsl_handles$q_32.$$arity = -1); + })($nesting[0], $nesting); + Opal.const_set($$($nesting, 'IncludeProcessor'), 'DSL', $$($nesting, 'IncludeProcessorDsl')); + (function($base, $super, $parent_nesting) { + function $DocinfoProcessor(){}; + var self = $DocinfoProcessor = $klass($base, $super, 'DocinfoProcessor', $DocinfoProcessor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_DocinfoProcessor_initialize_33, TMP_DocinfoProcessor_process_34; + + def.config = nil; + + self.$attr_accessor("location"); + + Opal.def(self, '$initialize', TMP_DocinfoProcessor_initialize_33 = function $$initialize(config) { + var $a, $iter = TMP_DocinfoProcessor_initialize_33.$$p, $yield = $iter || nil, self = this, $writer = nil; + + if ($iter) TMP_DocinfoProcessor_initialize_33.$$p = null; + + + if (config == null) { + config = $hash2([], {}); + }; + $send(self, Opal.find_super_dispatcher(self, 'initialize', TMP_DocinfoProcessor_initialize_33, false), [config], null); + return ($truthy($a = self.config['$[]']("location")) ? $a : (($writer = ["location", "head"]), $send(self.config, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + }, TMP_DocinfoProcessor_initialize_33.$$arity = -1); + return (Opal.def(self, '$process', TMP_DocinfoProcessor_process_34 = function $$process(document) { + var self = this; + + return self.$raise($$$('::', 'NotImplementedError'), "" + "Asciidoctor::Extensions::DocinfoProcessor subclass must implement #" + ("process") + " method") + }, TMP_DocinfoProcessor_process_34.$$arity = 1), nil) && 'process'; + })($nesting[0], $$($nesting, 'Processor'), $nesting); + (function($base, $parent_nesting) { + function $DocinfoProcessorDsl() {}; + var self = $DocinfoProcessorDsl = $module($base, 'DocinfoProcessorDsl', $DocinfoProcessorDsl); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_DocinfoProcessorDsl_at_location_35; + + + self.$include($$($nesting, 'DocumentProcessorDsl')); + + Opal.def(self, '$at_location', TMP_DocinfoProcessorDsl_at_location_35 = function $$at_location(value) { + var self = this; + + return self.$option("location", value) + }, TMP_DocinfoProcessorDsl_at_location_35.$$arity = 1); + })($nesting[0], $nesting); + Opal.const_set($$($nesting, 'DocinfoProcessor'), 'DSL', $$($nesting, 'DocinfoProcessorDsl')); + (function($base, $super, $parent_nesting) { + function $BlockProcessor(){}; + var self = $BlockProcessor = $klass($base, $super, 'BlockProcessor', $BlockProcessor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_BlockProcessor_initialize_36, TMP_BlockProcessor_process_37; + + def.config = nil; + + self.$attr_accessor("name"); + + Opal.def(self, '$initialize', TMP_BlockProcessor_initialize_36 = function $$initialize(name, config) { + var $a, $iter = TMP_BlockProcessor_initialize_36.$$p, $yield = $iter || nil, self = this, $case = nil, $writer = nil; + + if ($iter) TMP_BlockProcessor_initialize_36.$$p = null; + + + if (name == null) { + name = nil; + }; + + if (config == null) { + config = $hash2([], {}); + }; + $send(self, Opal.find_super_dispatcher(self, 'initialize', TMP_BlockProcessor_initialize_36, false), [config], null); + self.name = ($truthy($a = name) ? $a : self.config['$[]']("name")); + $case = self.config['$[]']("contexts"); + if ($$$('::', 'NilClass')['$===']($case)) {($truthy($a = self.config['$[]']("contexts")) ? $a : (($writer = ["contexts", ["open", "paragraph"].$to_set()]), $send(self.config, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]))} + else if ($$$('::', 'Symbol')['$===']($case)) { + $writer = ["contexts", [self.config['$[]']("contexts")].$to_set()]; + $send(self.config, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];} + else { + $writer = ["contexts", self.config['$[]']("contexts").$to_set()]; + $send(self.config, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + return ($truthy($a = self.config['$[]']("content_model")) ? $a : (($writer = ["content_model", "compound"]), $send(self.config, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + }, TMP_BlockProcessor_initialize_36.$$arity = -1); + return (Opal.def(self, '$process', TMP_BlockProcessor_process_37 = function $$process(parent, reader, attributes) { + var self = this; + + return self.$raise($$$('::', 'NotImplementedError'), "" + "Asciidoctor::Extensions::BlockProcessor subclass must implement #" + ("process") + " method") + }, TMP_BlockProcessor_process_37.$$arity = 3), nil) && 'process'; + })($nesting[0], $$($nesting, 'Processor'), $nesting); + (function($base, $parent_nesting) { + function $BlockProcessorDsl() {}; + var self = $BlockProcessorDsl = $module($base, 'BlockProcessorDsl', $BlockProcessorDsl); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_BlockProcessorDsl_contexts_38; + + + self.$include($$($nesting, 'SyntaxProcessorDsl')); + + Opal.def(self, '$contexts', TMP_BlockProcessorDsl_contexts_38 = function $$contexts($a) { + var $post_args, value, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + value = $post_args;; + return self.$option("contexts", value.$flatten().$to_set()); + }, TMP_BlockProcessorDsl_contexts_38.$$arity = -1); + Opal.alias(self, "on_contexts", "contexts"); + Opal.alias(self, "on_context", "contexts"); + Opal.alias(self, "bound_to", "contexts"); + })($nesting[0], $nesting); + Opal.const_set($$($nesting, 'BlockProcessor'), 'DSL', $$($nesting, 'BlockProcessorDsl')); + (function($base, $super, $parent_nesting) { + function $MacroProcessor(){}; + var self = $MacroProcessor = $klass($base, $super, 'MacroProcessor', $MacroProcessor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_MacroProcessor_initialize_39, TMP_MacroProcessor_process_40; + + def.config = nil; + + self.$attr_accessor("name"); + + Opal.def(self, '$initialize', TMP_MacroProcessor_initialize_39 = function $$initialize(name, config) { + var $a, $iter = TMP_MacroProcessor_initialize_39.$$p, $yield = $iter || nil, self = this, $writer = nil; + + if ($iter) TMP_MacroProcessor_initialize_39.$$p = null; + + + if (name == null) { + name = nil; + }; + + if (config == null) { + config = $hash2([], {}); + }; + $send(self, Opal.find_super_dispatcher(self, 'initialize', TMP_MacroProcessor_initialize_39, false), [config], null); + self.name = ($truthy($a = name) ? $a : self.config['$[]']("name")); + return ($truthy($a = self.config['$[]']("content_model")) ? $a : (($writer = ["content_model", "attributes"]), $send(self.config, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + }, TMP_MacroProcessor_initialize_39.$$arity = -1); + return (Opal.def(self, '$process', TMP_MacroProcessor_process_40 = function $$process(parent, target, attributes) { + var self = this; + + return self.$raise($$$('::', 'NotImplementedError'), "" + "Asciidoctor::Extensions::MacroProcessor subclass must implement #" + ("process") + " method") + }, TMP_MacroProcessor_process_40.$$arity = 3), nil) && 'process'; + })($nesting[0], $$($nesting, 'Processor'), $nesting); + (function($base, $parent_nesting) { + function $MacroProcessorDsl() {}; + var self = $MacroProcessorDsl = $module($base, 'MacroProcessorDsl', $MacroProcessorDsl); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_MacroProcessorDsl_resolves_attributes_41; + + + self.$include($$($nesting, 'SyntaxProcessorDsl')); + + Opal.def(self, '$resolves_attributes', TMP_MacroProcessorDsl_resolves_attributes_41 = function $$resolves_attributes($a) { + var $post_args, args, $b, $iter = TMP_MacroProcessorDsl_resolves_attributes_41.$$p, $yield = $iter || nil, self = this, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_MacroProcessorDsl_resolves_attributes_41.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + if ($truthy((($b = args.$size()['$=='](1)) ? args['$[]'](0)['$!']() : args.$size()['$=='](1)))) { + + self.$option("content_model", "text"); + return nil;}; + $send(self, Opal.find_super_dispatcher(self, 'resolves_attributes', TMP_MacroProcessorDsl_resolves_attributes_41, false), $zuper, $iter); + return self.$option("content_model", "attributes"); + }, TMP_MacroProcessorDsl_resolves_attributes_41.$$arity = -1); + Opal.alias(self, "resolve_attributes", "resolves_attributes"); + })($nesting[0], $nesting); + (function($base, $super, $parent_nesting) { + function $BlockMacroProcessor(){}; + var self = $BlockMacroProcessor = $klass($base, $super, 'BlockMacroProcessor', $BlockMacroProcessor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_BlockMacroProcessor_name_42; + + def.name = nil; + return (Opal.def(self, '$name', TMP_BlockMacroProcessor_name_42 = function $$name() { + var self = this; + + + if ($truthy($$($nesting, 'MacroNameRx')['$match?'](self.name.$to_s()))) { + } else { + self.$raise($$$('::', 'ArgumentError'), "" + "invalid name for block macro: " + (self.name)) + }; + return self.name; + }, TMP_BlockMacroProcessor_name_42.$$arity = 0), nil) && 'name' + })($nesting[0], $$($nesting, 'MacroProcessor'), $nesting); + Opal.const_set($$($nesting, 'BlockMacroProcessor'), 'DSL', $$($nesting, 'MacroProcessorDsl')); + (function($base, $super, $parent_nesting) { + function $InlineMacroProcessor(){}; + var self = $InlineMacroProcessor = $klass($base, $super, 'InlineMacroProcessor', $InlineMacroProcessor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_InlineMacroProcessor_regexp_43, TMP_InlineMacroProcessor_resolve_regexp_44; + + def.config = def.name = nil; + + (Opal.class_variable_set($InlineMacroProcessor, '@@rx_cache', $hash2([], {}))); + + Opal.def(self, '$regexp', TMP_InlineMacroProcessor_regexp_43 = function $$regexp() { + var $a, self = this, $writer = nil; + + return ($truthy($a = self.config['$[]']("regexp")) ? $a : (($writer = ["regexp", self.$resolve_regexp(self.name.$to_s(), self.config['$[]']("format"))]), $send(self.config, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])) + }, TMP_InlineMacroProcessor_regexp_43.$$arity = 0); + return (Opal.def(self, '$resolve_regexp', TMP_InlineMacroProcessor_resolve_regexp_44 = function $$resolve_regexp(name, format) { + var $a, $b, self = this, $writer = nil; + + + if ($truthy($$($nesting, 'MacroNameRx')['$match?'](name))) { + } else { + self.$raise($$$('::', 'ArgumentError'), "" + "invalid name for inline macro: " + (name)) + }; + return ($truthy($a = (($b = $InlineMacroProcessor.$$cvars['@@rx_cache']) == null ? nil : $b)['$[]']([name, format])) ? $a : (($writer = [[name, format], new RegExp("" + "\\\\?" + (name) + ":" + ((function() {if (format['$==']("short")) { + return "(){0}" + } else { + return "(\\S+?)" + }; return nil; })()) + "\\[(|.*?[^\\\\])\\]")]), $send((($b = $InlineMacroProcessor.$$cvars['@@rx_cache']) == null ? nil : $b), '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + }, TMP_InlineMacroProcessor_resolve_regexp_44.$$arity = 2), nil) && 'resolve_regexp'; + })($nesting[0], $$($nesting, 'MacroProcessor'), $nesting); + (function($base, $parent_nesting) { + function $InlineMacroProcessorDsl() {}; + var self = $InlineMacroProcessorDsl = $module($base, 'InlineMacroProcessorDsl', $InlineMacroProcessorDsl); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_InlineMacroProcessorDsl_with_format_45, TMP_InlineMacroProcessorDsl_matches_46; + + + self.$include($$($nesting, 'MacroProcessorDsl')); + + Opal.def(self, '$with_format', TMP_InlineMacroProcessorDsl_with_format_45 = function $$with_format(value) { + var self = this; + + return self.$option("format", value) + }, TMP_InlineMacroProcessorDsl_with_format_45.$$arity = 1); + Opal.alias(self, "using_format", "with_format"); + + Opal.def(self, '$matches', TMP_InlineMacroProcessorDsl_matches_46 = function $$matches(value) { + var self = this; + + return self.$option("regexp", value) + }, TMP_InlineMacroProcessorDsl_matches_46.$$arity = 1); + Opal.alias(self, "match", "matches"); + Opal.alias(self, "matching", "matches"); + })($nesting[0], $nesting); + Opal.const_set($$($nesting, 'InlineMacroProcessor'), 'DSL', $$($nesting, 'InlineMacroProcessorDsl')); + (function($base, $super, $parent_nesting) { + function $Extension(){}; + var self = $Extension = $klass($base, $super, 'Extension', $Extension); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Extension_initialize_47; + + + self.$attr_reader("kind"); + self.$attr_reader("config"); + self.$attr_reader("instance"); + return (Opal.def(self, '$initialize', TMP_Extension_initialize_47 = function $$initialize(kind, instance, config) { + var self = this; + + + self.kind = kind; + self.instance = instance; + return (self.config = config); + }, TMP_Extension_initialize_47.$$arity = 3), nil) && 'initialize'; + })($nesting[0], null, $nesting); + (function($base, $super, $parent_nesting) { + function $ProcessorExtension(){}; + var self = $ProcessorExtension = $klass($base, $super, 'ProcessorExtension', $ProcessorExtension); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_ProcessorExtension_initialize_48; + + + self.$attr_reader("process_method"); + return (Opal.def(self, '$initialize', TMP_ProcessorExtension_initialize_48 = function $$initialize(kind, instance, process_method) { + var $a, $iter = TMP_ProcessorExtension_initialize_48.$$p, $yield = $iter || nil, self = this; + + if ($iter) TMP_ProcessorExtension_initialize_48.$$p = null; + + + if (process_method == null) { + process_method = nil; + }; + $send(self, Opal.find_super_dispatcher(self, 'initialize', TMP_ProcessorExtension_initialize_48, false), [kind, instance, instance.$config()], null); + return (self.process_method = ($truthy($a = process_method) ? $a : instance.$method("process"))); + }, TMP_ProcessorExtension_initialize_48.$$arity = -3), nil) && 'initialize'; + })($nesting[0], $$($nesting, 'Extension'), $nesting); + (function($base, $super, $parent_nesting) { + function $Group(){}; + var self = $Group = $klass($base, $super, 'Group', $Group); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Group_activate_50; + + + (function(self, $parent_nesting) { + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_register_49; + + return (Opal.def(self, '$register', TMP_register_49 = function $$register(name) { + var self = this; + + + + if (name == null) { + name = nil; + }; + return $$($nesting, 'Extensions').$register(name, self); + }, TMP_register_49.$$arity = -1), nil) && 'register' + })(Opal.get_singleton_class(self), $nesting); + return (Opal.def(self, '$activate', TMP_Group_activate_50 = function $$activate(registry) { + var self = this; + + return self.$raise($$$('::', 'NotImplementedError')) + }, TMP_Group_activate_50.$$arity = 1), nil) && 'activate'; + })($nesting[0], null, $nesting); + (function($base, $super, $parent_nesting) { + function $Registry(){}; + var self = $Registry = $klass($base, $super, 'Registry', $Registry); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Registry_initialize_51, TMP_Registry_activate_52, TMP_Registry_preprocessor_54, TMP_Registry_preprocessors$q_55, TMP_Registry_preprocessors_56, TMP_Registry_tree_processor_57, TMP_Registry_tree_processors$q_58, TMP_Registry_tree_processors_59, TMP_Registry_postprocessor_60, TMP_Registry_postprocessors$q_61, TMP_Registry_postprocessors_62, TMP_Registry_include_processor_63, TMP_Registry_include_processors$q_64, TMP_Registry_include_processors_65, TMP_Registry_docinfo_processor_66, TMP_Registry_docinfo_processors$q_67, TMP_Registry_docinfo_processors_69, TMP_Registry_block_71, TMP_Registry_blocks$q_72, TMP_Registry_registered_for_block$q_73, TMP_Registry_find_block_extension_74, TMP_Registry_block_macro_75, TMP_Registry_block_macros$q_76, TMP_Registry_registered_for_block_macro$q_77, TMP_Registry_find_block_macro_extension_78, TMP_Registry_inline_macro_79, TMP_Registry_inline_macros$q_80, TMP_Registry_registered_for_inline_macro$q_81, TMP_Registry_find_inline_macro_extension_82, TMP_Registry_inline_macros_83, TMP_Registry_prefer_84, TMP_Registry_add_document_processor_85, TMP_Registry_add_syntax_processor_87, TMP_Registry_resolve_args_89, TMP_Registry_as_symbol_90; + + def.groups = def.preprocessor_extensions = def.tree_processor_extensions = def.postprocessor_extensions = def.include_processor_extensions = def.docinfo_processor_extensions = def.block_extensions = def.block_macro_extensions = def.inline_macro_extensions = nil; + + self.$attr_reader("document"); + self.$attr_reader("groups"); + + Opal.def(self, '$initialize', TMP_Registry_initialize_51 = function $$initialize(groups) { + var self = this; + + + + if (groups == null) { + groups = $hash2([], {}); + }; + self.groups = groups; + self.preprocessor_extensions = (self.tree_processor_extensions = (self.postprocessor_extensions = (self.include_processor_extensions = (self.docinfo_processor_extensions = (self.block_extensions = (self.block_macro_extensions = (self.inline_macro_extensions = nil))))))); + return (self.document = nil); + }, TMP_Registry_initialize_51.$$arity = -1); + + Opal.def(self, '$activate', TMP_Registry_activate_52 = function $$activate(document) { + var TMP_53, self = this, ext_groups = nil; + + + self.document = document; + if ($truthy((ext_groups = $rb_plus($$($nesting, 'Extensions').$groups().$values(), self.groups.$values()))['$empty?']())) { + } else { + $send(ext_groups, 'each', [], (TMP_53 = function(group){var self = TMP_53.$$s || this, $case = nil; + + + + if (group == null) { + group = nil; + }; + return (function() {$case = group; + if ($$$('::', 'Proc')['$===']($case)) {return (function() {$case = group.$arity(); + if ((0)['$===']($case) || (-1)['$===']($case)) {return $send(self, 'instance_exec', [], group.$to_proc())} + else if ((1)['$===']($case)) {return group.$call(self)} + else { return nil }})()} + else if ($$$('::', 'Class')['$===']($case)) {return group.$new().$activate(self)} + else {return group.$activate(self)}})();}, TMP_53.$$s = self, TMP_53.$$arity = 1, TMP_53)) + }; + return self; + }, TMP_Registry_activate_52.$$arity = 1); + + Opal.def(self, '$preprocessor', TMP_Registry_preprocessor_54 = function $$preprocessor($a) { + var $iter = TMP_Registry_preprocessor_54.$$p, block = $iter || nil, $post_args, args, self = this; + + if ($iter) TMP_Registry_preprocessor_54.$$p = null; + + + if ($iter) TMP_Registry_preprocessor_54.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + return $send(self, 'add_document_processor', ["preprocessor", args], block.$to_proc()); + }, TMP_Registry_preprocessor_54.$$arity = -1); + + Opal.def(self, '$preprocessors?', TMP_Registry_preprocessors$q_55 = function() { + var self = this; + + return self.preprocessor_extensions['$!']()['$!']() + }, TMP_Registry_preprocessors$q_55.$$arity = 0); + + Opal.def(self, '$preprocessors', TMP_Registry_preprocessors_56 = function $$preprocessors() { + var self = this; + + return self.preprocessor_extensions + }, TMP_Registry_preprocessors_56.$$arity = 0); + + Opal.def(self, '$tree_processor', TMP_Registry_tree_processor_57 = function $$tree_processor($a) { + var $iter = TMP_Registry_tree_processor_57.$$p, block = $iter || nil, $post_args, args, self = this; + + if ($iter) TMP_Registry_tree_processor_57.$$p = null; + + + if ($iter) TMP_Registry_tree_processor_57.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + return $send(self, 'add_document_processor', ["tree_processor", args], block.$to_proc()); + }, TMP_Registry_tree_processor_57.$$arity = -1); + + Opal.def(self, '$tree_processors?', TMP_Registry_tree_processors$q_58 = function() { + var self = this; + + return self.tree_processor_extensions['$!']()['$!']() + }, TMP_Registry_tree_processors$q_58.$$arity = 0); + + Opal.def(self, '$tree_processors', TMP_Registry_tree_processors_59 = function $$tree_processors() { + var self = this; + + return self.tree_processor_extensions + }, TMP_Registry_tree_processors_59.$$arity = 0); + Opal.alias(self, "treeprocessor", "tree_processor"); + Opal.alias(self, "treeprocessors?", "tree_processors?"); + Opal.alias(self, "treeprocessors", "tree_processors"); + + Opal.def(self, '$postprocessor', TMP_Registry_postprocessor_60 = function $$postprocessor($a) { + var $iter = TMP_Registry_postprocessor_60.$$p, block = $iter || nil, $post_args, args, self = this; + + if ($iter) TMP_Registry_postprocessor_60.$$p = null; + + + if ($iter) TMP_Registry_postprocessor_60.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + return $send(self, 'add_document_processor', ["postprocessor", args], block.$to_proc()); + }, TMP_Registry_postprocessor_60.$$arity = -1); + + Opal.def(self, '$postprocessors?', TMP_Registry_postprocessors$q_61 = function() { + var self = this; + + return self.postprocessor_extensions['$!']()['$!']() + }, TMP_Registry_postprocessors$q_61.$$arity = 0); + + Opal.def(self, '$postprocessors', TMP_Registry_postprocessors_62 = function $$postprocessors() { + var self = this; + + return self.postprocessor_extensions + }, TMP_Registry_postprocessors_62.$$arity = 0); + + Opal.def(self, '$include_processor', TMP_Registry_include_processor_63 = function $$include_processor($a) { + var $iter = TMP_Registry_include_processor_63.$$p, block = $iter || nil, $post_args, args, self = this; + + if ($iter) TMP_Registry_include_processor_63.$$p = null; + + + if ($iter) TMP_Registry_include_processor_63.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + return $send(self, 'add_document_processor', ["include_processor", args], block.$to_proc()); + }, TMP_Registry_include_processor_63.$$arity = -1); + + Opal.def(self, '$include_processors?', TMP_Registry_include_processors$q_64 = function() { + var self = this; + + return self.include_processor_extensions['$!']()['$!']() + }, TMP_Registry_include_processors$q_64.$$arity = 0); + + Opal.def(self, '$include_processors', TMP_Registry_include_processors_65 = function $$include_processors() { + var self = this; + + return self.include_processor_extensions + }, TMP_Registry_include_processors_65.$$arity = 0); + + Opal.def(self, '$docinfo_processor', TMP_Registry_docinfo_processor_66 = function $$docinfo_processor($a) { + var $iter = TMP_Registry_docinfo_processor_66.$$p, block = $iter || nil, $post_args, args, self = this; + + if ($iter) TMP_Registry_docinfo_processor_66.$$p = null; + + + if ($iter) TMP_Registry_docinfo_processor_66.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + return $send(self, 'add_document_processor', ["docinfo_processor", args], block.$to_proc()); + }, TMP_Registry_docinfo_processor_66.$$arity = -1); + + Opal.def(self, '$docinfo_processors?', TMP_Registry_docinfo_processors$q_67 = function(location) { + var TMP_68, self = this; + + + + if (location == null) { + location = nil; + }; + if ($truthy(self.docinfo_processor_extensions)) { + if ($truthy(location)) { + return $send(self.docinfo_processor_extensions, 'any?', [], (TMP_68 = function(ext){var self = TMP_68.$$s || this; + + + + if (ext == null) { + ext = nil; + }; + return ext.$config()['$[]']("location")['$=='](location);}, TMP_68.$$s = self, TMP_68.$$arity = 1, TMP_68)) + } else { + return true + } + } else { + return false + }; + }, TMP_Registry_docinfo_processors$q_67.$$arity = -1); + + Opal.def(self, '$docinfo_processors', TMP_Registry_docinfo_processors_69 = function $$docinfo_processors(location) { + var TMP_70, self = this; + + + + if (location == null) { + location = nil; + }; + if ($truthy(self.docinfo_processor_extensions)) { + if ($truthy(location)) { + return $send(self.docinfo_processor_extensions, 'select', [], (TMP_70 = function(ext){var self = TMP_70.$$s || this; + + + + if (ext == null) { + ext = nil; + }; + return ext.$config()['$[]']("location")['$=='](location);}, TMP_70.$$s = self, TMP_70.$$arity = 1, TMP_70)) + } else { + return self.docinfo_processor_extensions + } + } else { + return nil + }; + }, TMP_Registry_docinfo_processors_69.$$arity = -1); + + Opal.def(self, '$block', TMP_Registry_block_71 = function $$block($a) { + var $iter = TMP_Registry_block_71.$$p, block = $iter || nil, $post_args, args, self = this; + + if ($iter) TMP_Registry_block_71.$$p = null; + + + if ($iter) TMP_Registry_block_71.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + return $send(self, 'add_syntax_processor', ["block", args], block.$to_proc()); + }, TMP_Registry_block_71.$$arity = -1); + + Opal.def(self, '$blocks?', TMP_Registry_blocks$q_72 = function() { + var self = this; + + return self.block_extensions['$!']()['$!']() + }, TMP_Registry_blocks$q_72.$$arity = 0); + + Opal.def(self, '$registered_for_block?', TMP_Registry_registered_for_block$q_73 = function(name, context) { + var self = this, ext = nil; + + if ($truthy((ext = self.block_extensions['$[]'](name.$to_sym())))) { + if ($truthy(ext.$config()['$[]']("contexts")['$include?'](context))) { + return ext + } else { + return false + } + } else { + return false + } + }, TMP_Registry_registered_for_block$q_73.$$arity = 2); + + Opal.def(self, '$find_block_extension', TMP_Registry_find_block_extension_74 = function $$find_block_extension(name) { + var self = this; + + return self.block_extensions['$[]'](name.$to_sym()) + }, TMP_Registry_find_block_extension_74.$$arity = 1); + + Opal.def(self, '$block_macro', TMP_Registry_block_macro_75 = function $$block_macro($a) { + var $iter = TMP_Registry_block_macro_75.$$p, block = $iter || nil, $post_args, args, self = this; + + if ($iter) TMP_Registry_block_macro_75.$$p = null; + + + if ($iter) TMP_Registry_block_macro_75.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + return $send(self, 'add_syntax_processor', ["block_macro", args], block.$to_proc()); + }, TMP_Registry_block_macro_75.$$arity = -1); + + Opal.def(self, '$block_macros?', TMP_Registry_block_macros$q_76 = function() { + var self = this; + + return self.block_macro_extensions['$!']()['$!']() + }, TMP_Registry_block_macros$q_76.$$arity = 0); + + Opal.def(self, '$registered_for_block_macro?', TMP_Registry_registered_for_block_macro$q_77 = function(name) { + var self = this, ext = nil; + + if ($truthy((ext = self.block_macro_extensions['$[]'](name.$to_sym())))) { + return ext + } else { + return false + } + }, TMP_Registry_registered_for_block_macro$q_77.$$arity = 1); + + Opal.def(self, '$find_block_macro_extension', TMP_Registry_find_block_macro_extension_78 = function $$find_block_macro_extension(name) { + var self = this; + + return self.block_macro_extensions['$[]'](name.$to_sym()) + }, TMP_Registry_find_block_macro_extension_78.$$arity = 1); + + Opal.def(self, '$inline_macro', TMP_Registry_inline_macro_79 = function $$inline_macro($a) { + var $iter = TMP_Registry_inline_macro_79.$$p, block = $iter || nil, $post_args, args, self = this; + + if ($iter) TMP_Registry_inline_macro_79.$$p = null; + + + if ($iter) TMP_Registry_inline_macro_79.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + return $send(self, 'add_syntax_processor', ["inline_macro", args], block.$to_proc()); + }, TMP_Registry_inline_macro_79.$$arity = -1); + + Opal.def(self, '$inline_macros?', TMP_Registry_inline_macros$q_80 = function() { + var self = this; + + return self.inline_macro_extensions['$!']()['$!']() + }, TMP_Registry_inline_macros$q_80.$$arity = 0); + + Opal.def(self, '$registered_for_inline_macro?', TMP_Registry_registered_for_inline_macro$q_81 = function(name) { + var self = this, ext = nil; + + if ($truthy((ext = self.inline_macro_extensions['$[]'](name.$to_sym())))) { + return ext + } else { + return false + } + }, TMP_Registry_registered_for_inline_macro$q_81.$$arity = 1); + + Opal.def(self, '$find_inline_macro_extension', TMP_Registry_find_inline_macro_extension_82 = function $$find_inline_macro_extension(name) { + var self = this; + + return self.inline_macro_extensions['$[]'](name.$to_sym()) + }, TMP_Registry_find_inline_macro_extension_82.$$arity = 1); + + Opal.def(self, '$inline_macros', TMP_Registry_inline_macros_83 = function $$inline_macros() { + var self = this; + + return self.inline_macro_extensions.$values() + }, TMP_Registry_inline_macros_83.$$arity = 0); + + Opal.def(self, '$prefer', TMP_Registry_prefer_84 = function $$prefer($a) { + var $iter = TMP_Registry_prefer_84.$$p, block = $iter || nil, $post_args, args, self = this, extension = nil, arg0 = nil, extensions_store = nil; + + if ($iter) TMP_Registry_prefer_84.$$p = null; + + + if ($iter) TMP_Registry_prefer_84.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + extension = (function() {if ($truthy($$($nesting, 'ProcessorExtension')['$===']((arg0 = args.$shift())))) { + return arg0 + } else { + + return $send(self, 'send', [arg0].concat(Opal.to_a(args)), block.$to_proc()); + }; return nil; })(); + extensions_store = self.$instance_variable_get(((("" + "@") + (extension.$kind())) + "_extensions").$to_sym()); + extensions_store.$unshift(extensions_store.$delete(extension)); + return extension; + }, TMP_Registry_prefer_84.$$arity = -1); + self.$private(); + + Opal.def(self, '$add_document_processor', TMP_Registry_add_document_processor_85 = function $$add_document_processor(kind, args) { + var $iter = TMP_Registry_add_document_processor_85.$$p, block = $iter || nil, TMP_86, $a, $b, $c, self = this, kind_name = nil, kind_class_symbol = nil, kind_class = nil, kind_java_class = nil, kind_store = nil, extension = nil, config = nil, processor = nil, processor_class = nil, processor_instance = nil; + + if ($iter) TMP_Registry_add_document_processor_85.$$p = null; + + + if ($iter) TMP_Registry_add_document_processor_85.$$p = null;; + kind_name = kind.$to_s().$tr("_", " "); + kind_class_symbol = $send(kind_name.$split(), 'map', [], (TMP_86 = function(it){var self = TMP_86.$$s || this; + + + + if (it == null) { + it = nil; + }; + return it.$capitalize();}, TMP_86.$$s = self, TMP_86.$$arity = 1, TMP_86)).$join().$to_sym(); + kind_class = $$($nesting, 'Extensions').$const_get(kind_class_symbol); + kind_java_class = (function() {if ($truthy((($a = $$$('::', 'AsciidoctorJ', 'skip_raise')) ? 'constant' : nil))) { + + return $$$($$$('::', 'AsciidoctorJ'), 'Extensions').$const_get(kind_class_symbol); + } else { + return nil + }; return nil; })(); + kind_store = ($truthy($b = self.$instance_variable_get(((("" + "@") + (kind)) + "_extensions").$to_sym())) ? $b : self.$instance_variable_set(((("" + "@") + (kind)) + "_extensions").$to_sym(), [])); + extension = (function() {if ((block !== nil)) { + + config = self.$resolve_args(args, 1); + processor = kind_class.$new(config); + if ($truthy(kind_class.$constants().$grep("DSL"))) { + processor.$extend(kind_class.$const_get("DSL"))}; + $send(processor, 'instance_exec', [], block.$to_proc()); + processor.$freeze(); + if ($truthy(processor['$process_block_given?']())) { + } else { + self.$raise($$$('::', 'ArgumentError'), "" + "No block specified to process " + (kind_name) + " extension at " + (block.$source_location())) + }; + return $$($nesting, 'ProcessorExtension').$new(kind, processor); + } else { + + $c = self.$resolve_args(args, 2), $b = Opal.to_ary($c), (processor = ($b[0] == null ? nil : $b[0])), (config = ($b[1] == null ? nil : $b[1])), $c; + if ($truthy((processor_class = $$($nesting, 'Extensions').$resolve_class(processor)))) { + + if ($truthy(($truthy($b = $rb_lt(processor_class, kind_class)) ? $b : ($truthy($c = kind_java_class) ? $rb_lt(processor_class, kind_java_class) : $c)))) { + } else { + self.$raise($$$('::', 'ArgumentError'), "" + "Invalid type for " + (kind_name) + " extension: " + (processor)) + }; + processor_instance = processor_class.$new(config); + processor_instance.$freeze(); + return $$($nesting, 'ProcessorExtension').$new(kind, processor_instance); + } else if ($truthy(($truthy($b = kind_class['$==='](processor)) ? $b : ($truthy($c = kind_java_class) ? kind_java_class['$==='](processor) : $c)))) { + + processor.$update_config(config); + processor.$freeze(); + return $$($nesting, 'ProcessorExtension').$new(kind, processor); + } else { + return self.$raise($$$('::', 'ArgumentError'), "" + "Invalid arguments specified for registering " + (kind_name) + " extension: " + (args)) + }; + }; return nil; })(); + if (extension.$config()['$[]']("position")['$=='](">>")) { + + kind_store.$unshift(extension); + } else { + + kind_store['$<<'](extension); + }; + return extension; + }, TMP_Registry_add_document_processor_85.$$arity = 2); + + Opal.def(self, '$add_syntax_processor', TMP_Registry_add_syntax_processor_87 = function $$add_syntax_processor(kind, args) { + var $iter = TMP_Registry_add_syntax_processor_87.$$p, block = $iter || nil, TMP_88, $a, $b, $c, self = this, kind_name = nil, kind_class_symbol = nil, kind_class = nil, kind_java_class = nil, kind_store = nil, name = nil, config = nil, processor = nil, $writer = nil, processor_class = nil, processor_instance = nil; + + if ($iter) TMP_Registry_add_syntax_processor_87.$$p = null; + + + if ($iter) TMP_Registry_add_syntax_processor_87.$$p = null;; + kind_name = kind.$to_s().$tr("_", " "); + kind_class_symbol = $send(kind_name.$split(), 'map', [], (TMP_88 = function(it){var self = TMP_88.$$s || this; + + + + if (it == null) { + it = nil; + }; + return it.$capitalize();}, TMP_88.$$s = self, TMP_88.$$arity = 1, TMP_88)).$push("Processor").$join().$to_sym(); + kind_class = $$($nesting, 'Extensions').$const_get(kind_class_symbol); + kind_java_class = (function() {if ($truthy((($a = $$$('::', 'AsciidoctorJ', 'skip_raise')) ? 'constant' : nil))) { + + return $$$($$$('::', 'AsciidoctorJ'), 'Extensions').$const_get(kind_class_symbol); + } else { + return nil + }; return nil; })(); + kind_store = ($truthy($b = self.$instance_variable_get(((("" + "@") + (kind)) + "_extensions").$to_sym())) ? $b : self.$instance_variable_set(((("" + "@") + (kind)) + "_extensions").$to_sym(), $hash2([], {}))); + if ((block !== nil)) { + + $c = self.$resolve_args(args, 2), $b = Opal.to_ary($c), (name = ($b[0] == null ? nil : $b[0])), (config = ($b[1] == null ? nil : $b[1])), $c; + processor = kind_class.$new(self.$as_symbol(name), config); + if ($truthy(kind_class.$constants().$grep("DSL"))) { + processor.$extend(kind_class.$const_get("DSL"))}; + if (block.$arity()['$=='](1)) { + Opal.yield1(block, processor) + } else { + $send(processor, 'instance_exec', [], block.$to_proc()) + }; + if ($truthy((name = self.$as_symbol(processor.$name())))) { + } else { + self.$raise($$$('::', 'ArgumentError'), "" + "No name specified for " + (kind_name) + " extension at " + (block.$source_location())) + }; + if ($truthy(processor['$process_block_given?']())) { + } else { + self.$raise($$$('::', 'NoMethodError'), "" + "No block specified to process " + (kind_name) + " extension at " + (block.$source_location())) + }; + processor.$freeze(); + + $writer = [name, $$($nesting, 'ProcessorExtension').$new(kind, processor)]; + $send(kind_store, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];; + } else { + + $c = self.$resolve_args(args, 3), $b = Opal.to_ary($c), (processor = ($b[0] == null ? nil : $b[0])), (name = ($b[1] == null ? nil : $b[1])), (config = ($b[2] == null ? nil : $b[2])), $c; + if ($truthy((processor_class = $$($nesting, 'Extensions').$resolve_class(processor)))) { + + if ($truthy(($truthy($b = $rb_lt(processor_class, kind_class)) ? $b : ($truthy($c = kind_java_class) ? $rb_lt(processor_class, kind_java_class) : $c)))) { + } else { + self.$raise($$$('::', 'ArgumentError'), "" + "Class specified for " + (kind_name) + " extension does not inherit from " + (kind_class) + ": " + (processor)) + }; + processor_instance = processor_class.$new(self.$as_symbol(name), config); + if ($truthy((name = self.$as_symbol(processor_instance.$name())))) { + } else { + self.$raise($$$('::', 'ArgumentError'), "" + "No name specified for " + (kind_name) + " extension: " + (processor)) + }; + processor_instance.$freeze(); + + $writer = [name, $$($nesting, 'ProcessorExtension').$new(kind, processor_instance)]; + $send(kind_store, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];; + } else if ($truthy(($truthy($b = kind_class['$==='](processor)) ? $b : ($truthy($c = kind_java_class) ? kind_java_class['$==='](processor) : $c)))) { + + processor.$update_config(config); + if ($truthy((name = (function() {if ($truthy(name)) { + + + $writer = [self.$as_symbol(name)]; + $send(processor, 'name=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];; + } else { + + return self.$as_symbol(processor.$name()); + }; return nil; })()))) { + } else { + self.$raise($$$('::', 'ArgumentError'), "" + "No name specified for " + (kind_name) + " extension: " + (processor)) + }; + processor.$freeze(); + + $writer = [name, $$($nesting, 'ProcessorExtension').$new(kind, processor)]; + $send(kind_store, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];; + } else { + return self.$raise($$$('::', 'ArgumentError'), "" + "Invalid arguments specified for registering " + (kind_name) + " extension: " + (args)) + }; + }; + }, TMP_Registry_add_syntax_processor_87.$$arity = 2); + + Opal.def(self, '$resolve_args', TMP_Registry_resolve_args_89 = function $$resolve_args(args, expect) { + var self = this, opts = nil, missing = nil; + + + opts = (function() {if ($truthy($$$('::', 'Hash')['$==='](args['$[]'](-1)))) { + return args.$pop() + } else { + return $hash2([], {}) + }; return nil; })(); + if (expect['$=='](1)) { + return opts}; + if ($truthy($rb_gt((missing = $rb_minus($rb_minus(expect, 1), args.$size())), 0))) { + args = $rb_plus(args, $$$('::', 'Array').$new(missing)) + } else if ($truthy($rb_lt(missing, 0))) { + args.$pop(missing['$-@']())}; + args['$<<'](opts); + return args; + }, TMP_Registry_resolve_args_89.$$arity = 2); + return (Opal.def(self, '$as_symbol', TMP_Registry_as_symbol_90 = function $$as_symbol(name) { + var self = this; + + if ($truthy(name)) { + return name.$to_sym() + } else { + return nil + } + }, TMP_Registry_as_symbol_90.$$arity = 1), nil) && 'as_symbol'; + })($nesting[0], null, $nesting); + (function(self, $parent_nesting) { + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_generate_name_91, TMP_next_auto_id_92, TMP_groups_93, TMP_create_94, TMP_register_95, TMP_unregister_all_96, TMP_unregister_97, TMP_resolve_class_99, TMP_class_for_name_100, TMP_class_for_name_101, TMP_class_for_name_103; + + + + Opal.def(self, '$generate_name', TMP_generate_name_91 = function $$generate_name() { + var self = this; + + return "" + "extgrp" + (self.$next_auto_id()) + }, TMP_generate_name_91.$$arity = 0); + + Opal.def(self, '$next_auto_id', TMP_next_auto_id_92 = function $$next_auto_id() { + var $a, self = this; + if (self.auto_id == null) self.auto_id = nil; + + + self.auto_id = ($truthy($a = self.auto_id) ? $a : -1); + return (self.auto_id = $rb_plus(self.auto_id, 1)); + }, TMP_next_auto_id_92.$$arity = 0); + + Opal.def(self, '$groups', TMP_groups_93 = function $$groups() { + var $a, self = this; + if (self.groups == null) self.groups = nil; + + return (self.groups = ($truthy($a = self.groups) ? $a : $hash2([], {}))) + }, TMP_groups_93.$$arity = 0); + + Opal.def(self, '$create', TMP_create_94 = function $$create(name) { + var $iter = TMP_create_94.$$p, block = $iter || nil, $a, self = this; + + if ($iter) TMP_create_94.$$p = null; + + + if ($iter) TMP_create_94.$$p = null;; + + if (name == null) { + name = nil; + }; + if ((block !== nil)) { + return $$($nesting, 'Registry').$new($hash(($truthy($a = name) ? $a : self.$generate_name()), block)) + } else { + return $$($nesting, 'Registry').$new() + }; + }, TMP_create_94.$$arity = -1); + Opal.alias(self, "build_registry", "create"); + + Opal.def(self, '$register', TMP_register_95 = function $$register($a) { + var $iter = TMP_register_95.$$p, block = $iter || nil, $post_args, args, $b, self = this, argc = nil, resolved_group = nil, group = nil, name = nil, $writer = nil; + + if ($iter) TMP_register_95.$$p = null; + + + if ($iter) TMP_register_95.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + argc = args.$size(); + if ((block !== nil)) { + resolved_group = block + } else if ($truthy((group = args.$pop()))) { + resolved_group = ($truthy($b = self.$resolve_class(group)) ? $b : group) + } else { + self.$raise($$$('::', 'ArgumentError'), "Extension group to register not specified") + }; + name = ($truthy($b = args.$pop()) ? $b : self.$generate_name()); + if ($truthy(args['$empty?']())) { + } else { + self.$raise($$$('::', 'ArgumentError'), "" + "Wrong number of arguments (" + (argc) + " for 1..2)") + }; + + $writer = [name.$to_sym(), resolved_group]; + $send(self.$groups(), '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];; + }, TMP_register_95.$$arity = -1); + + Opal.def(self, '$unregister_all', TMP_unregister_all_96 = function $$unregister_all() { + var self = this; + + + self.groups = $hash2([], {}); + return nil; + }, TMP_unregister_all_96.$$arity = 0); + + Opal.def(self, '$unregister', TMP_unregister_97 = function $$unregister($a) { + var $post_args, names, TMP_98, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + names = $post_args;; + $send(names, 'each', [], (TMP_98 = function(group){var self = TMP_98.$$s || this; + if (self.groups == null) self.groups = nil; + + + + if (group == null) { + group = nil; + }; + return self.groups.$delete(group.$to_sym());}, TMP_98.$$s = self, TMP_98.$$arity = 1, TMP_98)); + return nil; + }, TMP_unregister_97.$$arity = -1); + + Opal.def(self, '$resolve_class', TMP_resolve_class_99 = function $$resolve_class(object) { + var self = this, $case = nil; + + return (function() {$case = object; + if ($$$('::', 'Class')['$===']($case)) {return object} + else if ($$$('::', 'String')['$===']($case)) {return self.$class_for_name(object)} + else { return nil }})() + }, TMP_resolve_class_99.$$arity = 1); + if ($truthy($$$('::', 'RUBY_MIN_VERSION_2'))) { + return (Opal.def(self, '$class_for_name', TMP_class_for_name_100 = function $$class_for_name(qualified_name) { + var self = this, resolved = nil; + + try { + + resolved = $$$('::', 'Object').$const_get(qualified_name, false); + if ($truthy($$$('::', 'Class')['$==='](resolved))) { + } else { + self.$raise() + }; + return resolved; + } catch ($err) { + if (Opal.rescue($err, [$$($nesting, 'StandardError')])) { + try { + return self.$raise($$$('::', 'NameError'), "" + "Could not resolve class for name: " + (qualified_name)) + } finally { Opal.pop_exception() } + } else { throw $err; } + } + }, TMP_class_for_name_100.$$arity = 1), nil) && 'class_for_name' + } else if ($truthy($$$('::', 'RUBY_MIN_VERSION_1_9'))) { + return (Opal.def(self, '$class_for_name', TMP_class_for_name_101 = function $$class_for_name(qualified_name) { + var TMP_102, self = this, resolved = nil; + + try { + + resolved = $send(qualified_name.$split("::"), 'reduce', [$$$('::', 'Object')], (TMP_102 = function(current, name){var self = TMP_102.$$s || this; + + + + if (current == null) { + current = nil; + }; + + if (name == null) { + name = nil; + }; + if ($truthy(name['$empty?']())) { + return current + } else { + + return current.$const_get(name, false); + };}, TMP_102.$$s = self, TMP_102.$$arity = 2, TMP_102)); + if ($truthy($$$('::', 'Class')['$==='](resolved))) { + } else { + self.$raise() + }; + return resolved; + } catch ($err) { + if (Opal.rescue($err, [$$($nesting, 'StandardError')])) { + try { + return self.$raise($$$('::', 'NameError'), "" + "Could not resolve class for name: " + (qualified_name)) + } finally { Opal.pop_exception() } + } else { throw $err; } + } + }, TMP_class_for_name_101.$$arity = 1), nil) && 'class_for_name' + } else { + return (Opal.def(self, '$class_for_name', TMP_class_for_name_103 = function $$class_for_name(qualified_name) { + var TMP_104, self = this, resolved = nil; + + try { + + resolved = $send(qualified_name.$split("::"), 'reduce', [$$$('::', 'Object')], (TMP_104 = function(current, name){var self = TMP_104.$$s || this; + + + + if (current == null) { + current = nil; + }; + + if (name == null) { + name = nil; + }; + if ($truthy(name['$empty?']())) { + return current + } else { + + if ($truthy(current['$const_defined?'](name))) { + + return current.$const_get(name); + } else { + return self.$raise() + }; + };}, TMP_104.$$s = self, TMP_104.$$arity = 2, TMP_104)); + if ($truthy($$$('::', 'Class')['$==='](resolved))) { + } else { + self.$raise() + }; + return resolved; + } catch ($err) { + if (Opal.rescue($err, [$$($nesting, 'StandardError')])) { + try { + return self.$raise($$$('::', 'NameError'), "" + "Could not resolve class for name: " + (qualified_name)) + } finally { Opal.pop_exception() } + } else { throw $err; } + } + }, TMP_class_for_name_103.$$arity = 1), nil) && 'class_for_name' + }; + })(Opal.get_singleton_class(self), $nesting); + })($nesting[0], $nesting) + })($nesting[0], $nesting); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/js/opal_ext/browser/reader"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $truthy = Opal.truthy; + + Opal.add_stubs(['$posixify', '$new', '$base_dir', '$start_with?', '$uriish?', '$descends_from?', '$key?', '$attributes', '$replace_next_line', '$absolute_path?', '$==', '$empty?', '$!', '$slice', '$length']); + return (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + (function($base, $super, $parent_nesting) { + function $PreprocessorReader(){}; + var self = $PreprocessorReader = $klass($base, $super, 'PreprocessorReader', $PreprocessorReader); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_PreprocessorReader_resolve_include_path_1; + + def.path_resolver = def.document = def.include_stack = def.dir = nil; + return (Opal.def(self, '$resolve_include_path', TMP_PreprocessorReader_resolve_include_path_1 = function $$resolve_include_path(target, attrlist, attributes) { + var $a, self = this, p_target = nil, target_type = nil, base_dir = nil, inc_path = nil, relpath = nil, ctx_dir = nil, top_level = nil, offset = nil; + + + p_target = (self.path_resolver = ($truthy($a = self.path_resolver) ? $a : $$($nesting, 'PathResolver').$new("\\"))).$posixify(target); + $a = ["file", self.document.$base_dir()], (target_type = $a[0]), (base_dir = $a[1]), $a; + if ($truthy(p_target['$start_with?']("file://"))) { + inc_path = (relpath = p_target) + } else if ($truthy($$($nesting, 'Helpers')['$uriish?'](p_target))) { + + if ($truthy(($truthy($a = self.path_resolver['$descends_from?'](p_target, base_dir)) ? $a : self.document.$attributes()['$key?']("allow-uri-read")))) { + } else { + return self.$replace_next_line("" + "link:" + (target) + "[" + (attrlist) + "]") + }; + inc_path = (relpath = p_target); + } else if ($truthy(self.path_resolver['$absolute_path?'](p_target))) { + inc_path = (relpath = "" + "file://" + ((function() {if ($truthy(p_target['$start_with?']("/"))) { + return "" + } else { + return "/" + }; return nil; })()) + (p_target)) + } else if ((ctx_dir = (function() {if ($truthy((top_level = self.include_stack['$empty?']()))) { + return base_dir + } else { + return self.dir + }; return nil; })())['$=='](".")) { + inc_path = (relpath = p_target) + } else if ($truthy(($truthy($a = ctx_dir['$start_with?']("file://")) ? $a : $$($nesting, 'Helpers')['$uriish?'](ctx_dir)['$!']()))) { + + inc_path = "" + (ctx_dir) + "/" + (p_target); + if ($truthy(top_level)) { + relpath = p_target + } else if ($truthy(($truthy($a = base_dir['$=='](".")) ? $a : (offset = self.path_resolver['$descends_from?'](inc_path, base_dir))['$!']()))) { + relpath = inc_path + } else { + relpath = inc_path.$slice(offset, inc_path.$length()) + }; + } else if ($truthy(top_level)) { + inc_path = "" + (ctx_dir) + "/" + ((relpath = p_target)) + } else if ($truthy(($truthy($a = (offset = self.path_resolver['$descends_from?'](ctx_dir, base_dir))) ? $a : self.document.$attributes()['$key?']("allow-uri-read")))) { + + inc_path = "" + (ctx_dir) + "/" + (p_target); + relpath = (function() {if ($truthy(offset)) { + + return inc_path.$slice(offset, inc_path.$length()); + } else { + return p_target + }; return nil; })(); + } else { + return self.$replace_next_line("" + "link:" + (target) + "[" + (attrlist) + "]") + }; + return [inc_path, "file", relpath]; + }, TMP_PreprocessorReader_resolve_include_path_1.$$arity = 3), nil) && 'resolve_include_path' + })($nesting[0], $$($nesting, 'Reader'), $nesting) + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/js/postscript"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice; + + Opal.add_stubs(['$require', '$==']); + + self.$require("asciidoctor/converter/composite"); + self.$require("asciidoctor/converter/html5"); + self.$require("asciidoctor/extensions"); + if ($$($nesting, 'JAVASCRIPT_IO_MODULE')['$==']("xmlhttprequest")) { + return self.$require("asciidoctor/js/opal_ext/browser/reader") + } else { + return nil + }; +}; + +/* Generated by Opal 0.11.99.dev */ +(function(Opal) { + function $rb_ge(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs >= rhs : lhs['$>='](rhs); + } + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + function $rb_lt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); + } + var $a, self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $truthy = Opal.truthy, $gvars = Opal.gvars, $module = Opal.module, $hash2 = Opal.hash2, $send = Opal.send, $hash = Opal.hash; + if ($gvars[":"] == null) $gvars[":"] = nil; + + Opal.add_stubs(['$==', '$>=', '$require', '$unshift', '$dirname', '$each', '$constants', '$const_get', '$downcase', '$to_s', '$[]=', '$-', '$upcase', '$[]', '$values', '$new', '$attr_reader', '$instance_variable_set', '$send', '$<<', '$define', '$expand_path', '$join', '$home', '$pwd', '$!', '$!=', '$default_external', '$to_set', '$map', '$keys', '$slice', '$merge', '$default=', '$to_a', '$escape', '$drop', '$insert', '$dup', '$start', '$logger', '$logger=', '$===', '$split', '$gsub', '$respond_to?', '$raise', '$ancestors', '$class', '$path', '$utc', '$at', '$Integer', '$mtime', '$readlines', '$basename', '$extname', '$index', '$strftime', '$year', '$utc_offset', '$rewind', '$lines', '$each_line', '$record', '$parse', '$exception', '$message', '$set_backtrace', '$backtrace', '$stack_trace', '$stack_trace=', '$open', '$load', '$delete', '$key?', '$attributes', '$outfilesuffix', '$safe', '$normalize_system_path', '$mkdir_p', '$directory?', '$convert', '$write', '$<', '$attr?', '$attr', '$uriish?', '$include?', '$write_primary_stylesheet', '$instance', '$empty?', '$read_asset', '$file?', '$write_coderay_stylesheet', '$write_pygments_stylesheet']); + + if ($truthy((($a = $$($nesting, 'RUBY_ENGINE', 'skip_raise')) ? 'constant' : nil))) { + } else { + Opal.const_set($nesting[0], 'RUBY_ENGINE', "unknown") + }; + Opal.const_set($nesting[0], 'RUBY_ENGINE_OPAL', $$($nesting, 'RUBY_ENGINE')['$==']("opal")); + Opal.const_set($nesting[0], 'RUBY_ENGINE_JRUBY', $$($nesting, 'RUBY_ENGINE')['$==']("jruby")); + Opal.const_set($nesting[0], 'RUBY_MIN_VERSION_1_9', $rb_ge($$($nesting, 'RUBY_VERSION'), "1.9")); + Opal.const_set($nesting[0], 'RUBY_MIN_VERSION_2', $rb_ge($$($nesting, 'RUBY_VERSION'), "2")); + self.$require("set"); + if ($$($nesting, 'RUBY_ENGINE')['$==']("opal")) { + self.$require("asciidoctor/js") + } else { + nil + }; + $gvars[":"].$unshift($$($nesting, 'File').$dirname("asciidoctor.rb")); + self.$require("asciidoctor/logging"); + (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), $a, TMP_Asciidoctor_6, TMP_Asciidoctor_7, TMP_Asciidoctor_8, $writer = nil, quote_subs = nil, compat_quote_subs = nil; + + + Opal.const_set($nesting[0], 'RUBY_ENGINE', $$$('::', 'RUBY_ENGINE')); + (function($base, $parent_nesting) { + function $SafeMode() {}; + var self = $SafeMode = $module($base, 'SafeMode', $SafeMode); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_SafeMode_1, TMP_SafeMode_value_for_name_2, TMP_SafeMode_name_for_value_3, TMP_SafeMode_names_4, rec = nil; + + + Opal.const_set($nesting[0], 'UNSAFE', 0); + Opal.const_set($nesting[0], 'SAFE', 1); + Opal.const_set($nesting[0], 'SERVER', 10); + Opal.const_set($nesting[0], 'SECURE', 20); + rec = $hash2([], {}); + $send((Opal.Module.$$nesting = $nesting, self.$constants()), 'each', [], (TMP_SafeMode_1 = function(sym){var self = TMP_SafeMode_1.$$s || this, $writer = nil; + + + + if (sym == null) { + sym = nil; + }; + $writer = [self.$const_get(sym), sym.$to_s().$downcase()]; + $send(rec, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];}, TMP_SafeMode_1.$$s = self, TMP_SafeMode_1.$$arity = 1, TMP_SafeMode_1)); + self.names_by_value = rec; + Opal.defs(self, '$value_for_name', TMP_SafeMode_value_for_name_2 = function $$value_for_name(name) { + var self = this; + + return self.$const_get(name.$upcase()) + }, TMP_SafeMode_value_for_name_2.$$arity = 1); + Opal.defs(self, '$name_for_value', TMP_SafeMode_name_for_value_3 = function $$name_for_value(value) { + var self = this; + if (self.names_by_value == null) self.names_by_value = nil; + + return self.names_by_value['$[]'](value) + }, TMP_SafeMode_name_for_value_3.$$arity = 1); + Opal.defs(self, '$names', TMP_SafeMode_names_4 = function $$names() { + var self = this; + if (self.names_by_value == null) self.names_by_value = nil; + + return self.names_by_value.$values() + }, TMP_SafeMode_names_4.$$arity = 0); + })($nesting[0], $nesting); + (function($base, $parent_nesting) { + function $Compliance() {}; + var self = $Compliance = $module($base, 'Compliance', $Compliance); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Compliance_define_5; + + + self.keys = $$$('::', 'Set').$new(); + (function(self, $parent_nesting) { + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return self.$attr_reader("keys") + })(Opal.get_singleton_class(self), $nesting); + Opal.defs(self, '$define', TMP_Compliance_define_5 = function $$define(key, value) { + var self = this; + if (self.keys == null) self.keys = nil; + + + self.$instance_variable_set("" + "@" + (key), value); + (function(self, $parent_nesting) { + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return self + })(Opal.get_singleton_class(self), $nesting).$send("attr_accessor", key); + self.keys['$<<'](key); + return nil; + }, TMP_Compliance_define_5.$$arity = 2); + self.$define("block_terminates_paragraph", true); + self.$define("strict_verbatim_paragraphs", true); + self.$define("underline_style_section_titles", true); + self.$define("unwrap_standalone_preamble", true); + self.$define("attribute_missing", "skip"); + self.$define("attribute_undefined", "drop-line"); + self.$define("shorthand_property_syntax", true); + self.$define("natural_xrefs", true); + self.$define("unique_id_start_index", 2); + self.$define("markdown_syntax", true); + })($nesting[0], $nesting); + Opal.const_set($nesting[0], 'ROOT_PATH', $$$('::', 'File').$dirname($$$('::', 'File').$dirname($$$('::', 'File').$expand_path("asciidoctor.rb")))); + Opal.const_set($nesting[0], 'DATA_PATH', $$$('::', 'File').$join($$($nesting, 'ROOT_PATH'), "data")); + + try { + Opal.const_set($nesting[0], 'USER_HOME', $$$('::', 'Dir').$home()) + } catch ($err) { + if (Opal.rescue($err, [$$($nesting, 'StandardError')])) { + try { + Opal.const_set($nesting[0], 'USER_HOME', ($truthy($a = $$$('::', 'ENV')['$[]']("HOME")) ? $a : $$$('::', 'Dir').$pwd())) + } finally { Opal.pop_exception() } + } else { throw $err; } + };; + Opal.const_set($nesting[0], 'COERCE_ENCODING', ($truthy($a = $$$('::', 'RUBY_ENGINE_OPAL')['$!']()) ? $$$('::', 'RUBY_MIN_VERSION_1_9') : $a)); + Opal.const_set($nesting[0], 'FORCE_ENCODING', ($truthy($a = $$($nesting, 'COERCE_ENCODING')) ? $$$('::', 'Encoding').$default_external()['$!=']($$$($$$('::', 'Encoding'), 'UTF_8')) : $a)); + Opal.const_set($nesting[0], 'BOM_BYTES_UTF_8', [239, 187, 191]); + Opal.const_set($nesting[0], 'BOM_BYTES_UTF_16LE', [255, 254]); + Opal.const_set($nesting[0], 'BOM_BYTES_UTF_16BE', [254, 255]); + Opal.const_set($nesting[0], 'FORCE_UNICODE_LINE_LENGTH', $$$('::', 'RUBY_MIN_VERSION_1_9')['$!']()); + Opal.const_set($nesting[0], 'LF', Opal.const_set($nesting[0], 'EOL', "\n")); + Opal.const_set($nesting[0], 'NULL', "\u0000"); + Opal.const_set($nesting[0], 'TAB', "\t"); + Opal.const_set($nesting[0], 'MAX_INT', 9007199254740991); + Opal.const_set($nesting[0], 'DEFAULT_DOCTYPE', "article"); + Opal.const_set($nesting[0], 'DEFAULT_BACKEND', "html5"); + Opal.const_set($nesting[0], 'DEFAULT_STYLESHEET_KEYS', ["", "DEFAULT"].$to_set()); + Opal.const_set($nesting[0], 'DEFAULT_STYLESHEET_NAME', "asciidoctor.css"); + Opal.const_set($nesting[0], 'BACKEND_ALIASES', $hash2(["html", "docbook"], {"html": "html5", "docbook": "docbook5"})); + Opal.const_set($nesting[0], 'DEFAULT_PAGE_WIDTHS', $hash2(["docbook"], {"docbook": 425})); + Opal.const_set($nesting[0], 'DEFAULT_EXTENSIONS', $hash2(["html", "docbook", "pdf", "epub", "manpage", "asciidoc"], {"html": ".html", "docbook": ".xml", "pdf": ".pdf", "epub": ".epub", "manpage": ".man", "asciidoc": ".adoc"})); + Opal.const_set($nesting[0], 'ASCIIDOC_EXTENSIONS', $hash2([".adoc", ".asciidoc", ".asc", ".ad", ".txt"], {".adoc": true, ".asciidoc": true, ".asc": true, ".ad": true, ".txt": true})); + Opal.const_set($nesting[0], 'SETEXT_SECTION_LEVELS', $hash2(["=", "-", "~", "^", "+"], {"=": 0, "-": 1, "~": 2, "^": 3, "+": 4})); + Opal.const_set($nesting[0], 'ADMONITION_STYLES', ["NOTE", "TIP", "IMPORTANT", "WARNING", "CAUTION"].$to_set()); + Opal.const_set($nesting[0], 'ADMONITION_STYLE_HEADS', ["N", "T", "I", "W", "C"].$to_set()); + Opal.const_set($nesting[0], 'PARAGRAPH_STYLES', ["comment", "example", "literal", "listing", "normal", "open", "pass", "quote", "sidebar", "source", "verse", "abstract", "partintro"].$to_set()); + Opal.const_set($nesting[0], 'VERBATIM_STYLES', ["literal", "listing", "source", "verse"].$to_set()); + Opal.const_set($nesting[0], 'DELIMITED_BLOCKS', $hash2(["--", "----", "....", "====", "****", "____", "\"\"", "++++", "|===", ",===", ":===", "!===", "////", "```"], {"--": ["open", ["comment", "example", "literal", "listing", "pass", "quote", "sidebar", "source", "verse", "admonition", "abstract", "partintro"].$to_set()], "----": ["listing", ["literal", "source"].$to_set()], "....": ["literal", ["listing", "source"].$to_set()], "====": ["example", ["admonition"].$to_set()], "****": ["sidebar", $$$('::', 'Set').$new()], "____": ["quote", ["verse"].$to_set()], "\"\"": ["quote", ["verse"].$to_set()], "++++": ["pass", ["stem", "latexmath", "asciimath"].$to_set()], "|===": ["table", $$$('::', 'Set').$new()], ",===": ["table", $$$('::', 'Set').$new()], ":===": ["table", $$$('::', 'Set').$new()], "!===": ["table", $$$('::', 'Set').$new()], "////": ["comment", $$$('::', 'Set').$new()], "```": ["fenced_code", $$$('::', 'Set').$new()]})); + Opal.const_set($nesting[0], 'DELIMITED_BLOCK_HEADS', $send($$($nesting, 'DELIMITED_BLOCKS').$keys(), 'map', [], (TMP_Asciidoctor_6 = function(key){var self = TMP_Asciidoctor_6.$$s || this; + + + + if (key == null) { + key = nil; + }; + return key.$slice(0, 2);}, TMP_Asciidoctor_6.$$s = self, TMP_Asciidoctor_6.$$arity = 1, TMP_Asciidoctor_6)).$to_set()); + Opal.const_set($nesting[0], 'LAYOUT_BREAK_CHARS', $hash2(["'", "<"], {"'": "thematic_break", "<": "page_break"})); + Opal.const_set($nesting[0], 'MARKDOWN_THEMATIC_BREAK_CHARS', $hash2(["-", "*", "_"], {"-": "thematic_break", "*": "thematic_break", "_": "thematic_break"})); + Opal.const_set($nesting[0], 'HYBRID_LAYOUT_BREAK_CHARS', $$($nesting, 'LAYOUT_BREAK_CHARS').$merge($$($nesting, 'MARKDOWN_THEMATIC_BREAK_CHARS'))); + Opal.const_set($nesting[0], 'NESTABLE_LIST_CONTEXTS', ["ulist", "olist", "dlist"]); + Opal.const_set($nesting[0], 'ORDERED_LIST_STYLES', ["arabic", "loweralpha", "lowerroman", "upperalpha", "upperroman"]); + Opal.const_set($nesting[0], 'ORDERED_LIST_KEYWORDS', $hash2(["loweralpha", "lowerroman", "upperalpha", "upperroman"], {"loweralpha": "a", "lowerroman": "i", "upperalpha": "A", "upperroman": "I"})); + Opal.const_set($nesting[0], 'ATTR_REF_HEAD', "{"); + Opal.const_set($nesting[0], 'LIST_CONTINUATION', "+"); + Opal.const_set($nesting[0], 'HARD_LINE_BREAK', " +"); + Opal.const_set($nesting[0], 'LINE_CONTINUATION', " \\"); + Opal.const_set($nesting[0], 'LINE_CONTINUATION_LEGACY', " +"); + Opal.const_set($nesting[0], 'MATHJAX_VERSION', "2.7.4"); + Opal.const_set($nesting[0], 'BLOCK_MATH_DELIMITERS', $hash2(["asciimath", "latexmath"], {"asciimath": ["\\$", "\\$"], "latexmath": ["\\[", "\\]"]})); + Opal.const_set($nesting[0], 'INLINE_MATH_DELIMITERS', $hash2(["asciimath", "latexmath"], {"asciimath": ["\\$", "\\$"], "latexmath": ["\\(", "\\)"]})); + + $writer = ["asciimath"]; + $send(Opal.const_set($nesting[0], 'STEM_TYPE_ALIASES', $hash2(["latexmath", "latex", "tex"], {"latexmath": "latexmath", "latex": "latexmath", "tex": "latexmath"})), 'default=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + Opal.const_set($nesting[0], 'FONT_AWESOME_VERSION', "4.7.0"); + Opal.const_set($nesting[0], 'FLEXIBLE_ATTRIBUTES', ["sectnums"]); + if ($$($nesting, 'RUBY_ENGINE')['$==']("opal")) { + if ($truthy((($a = $$($nesting, 'CC_ANY', 'skip_raise')) ? 'constant' : nil))) { + } else { + Opal.const_set($nesting[0], 'CC_ANY', "[^\\n]") + } + } else { + nil + }; + Opal.const_set($nesting[0], 'AuthorInfoLineRx', new RegExp("" + "^(" + ($$($nesting, 'CG_WORD')) + "[" + ($$($nesting, 'CC_WORD')) + "\\-'.]*)(?: +(" + ($$($nesting, 'CG_WORD')) + "[" + ($$($nesting, 'CC_WORD')) + "\\-'.]*))?(?: +(" + ($$($nesting, 'CG_WORD')) + "[" + ($$($nesting, 'CC_WORD')) + "\\-'.]*))?(?: +<([^>]+)>)?$")); + Opal.const_set($nesting[0], 'RevisionInfoLineRx', new RegExp("" + "^(?:[^\\d{]*(" + ($$($nesting, 'CC_ANY')) + "*?),)? *(?!:)(" + ($$($nesting, 'CC_ANY')) + "*?)(?: *(?!^),?: *(" + ($$($nesting, 'CC_ANY')) + "*))?$")); + Opal.const_set($nesting[0], 'ManpageTitleVolnumRx', new RegExp("" + "^(" + ($$($nesting, 'CC_ANY')) + "+?) *\\( *(" + ($$($nesting, 'CC_ANY')) + "+?) *\\)$")); + Opal.const_set($nesting[0], 'ManpageNamePurposeRx', new RegExp("" + "^(" + ($$($nesting, 'CC_ANY')) + "+?) +- +(" + ($$($nesting, 'CC_ANY')) + "+)$")); + Opal.const_set($nesting[0], 'ConditionalDirectiveRx', new RegExp("" + "^(\\\\)?(ifdef|ifndef|ifeval|endif)::(\\S*?(?:([,+])\\S*?)?)\\[(" + ($$($nesting, 'CC_ANY')) + "+)?\\]$")); + Opal.const_set($nesting[0], 'EvalExpressionRx', new RegExp("" + "^(" + ($$($nesting, 'CC_ANY')) + "+?) *([=!><]=|[><]) *(" + ($$($nesting, 'CC_ANY')) + "+)$")); + Opal.const_set($nesting[0], 'IncludeDirectiveRx', new RegExp("" + "^(\\\\)?include::([^\\[][^\\[]*)\\[(" + ($$($nesting, 'CC_ANY')) + "+)?\\]$")); + Opal.const_set($nesting[0], 'TagDirectiveRx', /\b(?:tag|(e)nd)::(\S+?)\[\](?=$|[ \r])/m); + Opal.const_set($nesting[0], 'AttributeEntryRx', new RegExp("" + "^:(!?" + ($$($nesting, 'CG_WORD')) + "[^:]*):(?:[ \\t]+(" + ($$($nesting, 'CC_ANY')) + "*))?$")); + Opal.const_set($nesting[0], 'InvalidAttributeNameCharsRx', new RegExp("" + "[^-" + ($$($nesting, 'CC_WORD')) + "]")); + if ($$($nesting, 'RUBY_ENGINE')['$==']("opal")) { + Opal.const_set($nesting[0], 'AttributeEntryPassMacroRx', /^pass:([a-z]+(?:,[a-z]+)*)?\[([\S\s]*)\]$/) + } else { + nil + }; + Opal.const_set($nesting[0], 'AttributeReferenceRx', new RegExp("" + "(\\\\)?\\{(" + ($$($nesting, 'CG_WORD')) + "[-" + ($$($nesting, 'CC_WORD')) + "]*|(set|counter2?):" + ($$($nesting, 'CC_ANY')) + "+?)(\\\\)?\\}")); + Opal.const_set($nesting[0], 'BlockAnchorRx', new RegExp("" + "^\\[\\[(?:|([" + ($$($nesting, 'CC_ALPHA')) + "_:][" + ($$($nesting, 'CC_WORD')) + ":.-]*)(?:, *(" + ($$($nesting, 'CC_ANY')) + "+))?)\\]\\]$")); + Opal.const_set($nesting[0], 'BlockAttributeListRx', new RegExp("" + "^\\[(|[" + ($$($nesting, 'CC_WORD')) + ".#%{,\"']" + ($$($nesting, 'CC_ANY')) + "*)\\]$")); + Opal.const_set($nesting[0], 'BlockAttributeLineRx', new RegExp("" + "^\\[(?:|[" + ($$($nesting, 'CC_WORD')) + ".#%{,\"']" + ($$($nesting, 'CC_ANY')) + "*|\\[(?:|[" + ($$($nesting, 'CC_ALPHA')) + "_:][" + ($$($nesting, 'CC_WORD')) + ":.-]*(?:, *" + ($$($nesting, 'CC_ANY')) + "+)?)\\])\\]$")); + Opal.const_set($nesting[0], 'BlockTitleRx', new RegExp("" + "^\\.(\\.?[^ \\t.]" + ($$($nesting, 'CC_ANY')) + "*)$")); + Opal.const_set($nesting[0], 'AdmonitionParagraphRx', new RegExp("" + "^(" + ($$($nesting, 'ADMONITION_STYLES').$to_a().$join("|")) + "):[ \\t]+")); + Opal.const_set($nesting[0], 'LiteralParagraphRx', new RegExp("" + "^([ \\t]+" + ($$($nesting, 'CC_ANY')) + "*)$")); + Opal.const_set($nesting[0], 'AtxSectionTitleRx', new RegExp("" + "^(=={0,5})[ \\t]+(" + ($$($nesting, 'CC_ANY')) + "+?)(?:[ \\t]+\\1)?$")); + Opal.const_set($nesting[0], 'ExtAtxSectionTitleRx', new RegExp("" + "^(=={0,5}|#\\\#{0,5})[ \\t]+(" + ($$($nesting, 'CC_ANY')) + "+?)(?:[ \\t]+\\1)?$")); + Opal.const_set($nesting[0], 'SetextSectionTitleRx', new RegExp("" + "^((?!\\.)" + ($$($nesting, 'CC_ANY')) + "*?" + ($$($nesting, 'CG_WORD')) + ($$($nesting, 'CC_ANY')) + "*)$")); + Opal.const_set($nesting[0], 'InlineSectionAnchorRx', new RegExp("" + " (\\\\)?\\[\\[([" + ($$($nesting, 'CC_ALPHA')) + "_:][" + ($$($nesting, 'CC_WORD')) + ":.-]*)(?:, *(" + ($$($nesting, 'CC_ANY')) + "+))?\\]\\]$")); + Opal.const_set($nesting[0], 'InvalidSectionIdCharsRx', new RegExp("" + "<[^>]+>|&(?:[a-z][a-z]+\\d{0,2}|#\\d\\d\\d{0,4}|#x[\\da-f][\\da-f][\\da-f]{0,3});|[^ " + ($$($nesting, 'CC_WORD')) + "\\-.]+?")); + Opal.const_set($nesting[0], 'AnyListRx', new RegExp("" + "^(?:[ \\t]*(?:-|\\*\\**|\\.\\.*|\\u2022|\\d+\\.|[a-zA-Z]\\.|[IVXivx]+\\))[ \\t]|(?!//[^/])" + ($$($nesting, 'CC_ANY')) + "*?(?::::{0,2}|;;)(?:$|[ \\t])|[ \\t])")); + Opal.const_set($nesting[0], 'UnorderedListRx', new RegExp("" + "^[ \\t]*(-|\\*\\**|\\u2022)[ \\t]+(" + ($$($nesting, 'CC_ANY')) + "*)$")); + Opal.const_set($nesting[0], 'OrderedListRx', new RegExp("" + "^[ \\t]*(\\.\\.*|\\d+\\.|[a-zA-Z]\\.|[IVXivx]+\\))[ \\t]+(" + ($$($nesting, 'CC_ANY')) + "*)$")); + Opal.const_set($nesting[0], 'OrderedListMarkerRxMap', $hash2(["arabic", "loweralpha", "lowerroman", "upperalpha", "upperroman"], {"arabic": /\d+\./, "loweralpha": /[a-z]\./, "lowerroman": /[ivx]+\)/, "upperalpha": /[A-Z]\./, "upperroman": /[IVX]+\)/})); + Opal.const_set($nesting[0], 'DescriptionListRx', new RegExp("" + "^(?!//[^/])[ \\t]*(" + ($$($nesting, 'CC_ANY')) + "*?)(:::{0,2}|;;)(?:$|[ \\t]+(" + ($$($nesting, 'CC_ANY')) + "*)$)")); + Opal.const_set($nesting[0], 'DescriptionListSiblingRx', $hash2(["::", ":::", "::::", ";;"], {"::": new RegExp("" + "^(?!//[^/])[ \\t]*(" + ($$($nesting, 'CC_ANY')) + "*[^:]|)(::)(?:$|[ \\t]+(" + ($$($nesting, 'CC_ANY')) + "*)$)"), ":::": new RegExp("" + "^(?!//[^/])[ \\t]*(" + ($$($nesting, 'CC_ANY')) + "*[^:]|)(:::)(?:$|[ \\t]+(" + ($$($nesting, 'CC_ANY')) + "*)$)"), "::::": new RegExp("" + "^(?!//[^/])[ \\t]*(" + ($$($nesting, 'CC_ANY')) + "*[^:]|)(::::)(?:$|[ \\t]+(" + ($$($nesting, 'CC_ANY')) + "*)$)"), ";;": new RegExp("" + "^(?!//[^/])[ \\t]*(" + ($$($nesting, 'CC_ANY')) + "*?)(;;)(?:$|[ \\t]+(" + ($$($nesting, 'CC_ANY')) + "*)$)")})); + Opal.const_set($nesting[0], 'CalloutListRx', new RegExp("" + "^<(\\d+|\\.)>[ \\t]+(" + ($$($nesting, 'CC_ANY')) + "*)$")); + Opal.const_set($nesting[0], 'CalloutExtractRx', /((?:\/\/|#|--|;;) ?)?(\\)?(?=(?: ?\\?)*$)/); + Opal.const_set($nesting[0], 'CalloutExtractRxt', "(\\\\)?<()(\\d+|\\.)>(?=(?: ?\\\\?<(?:\\d+|\\.)>)*$)"); + Opal.const_set($nesting[0], 'CalloutExtractRxMap', $send($$$('::', 'Hash'), 'new', [], (TMP_Asciidoctor_7 = function(h, k){var self = TMP_Asciidoctor_7.$$s || this; + + + + if (h == null) { + h = nil; + }; + + if (k == null) { + k = nil; + }; + $writer = [k, new RegExp("" + "(" + ($$$('::', 'Regexp').$escape(k)) + " ?)?" + ($$($nesting, 'CalloutExtractRxt')))]; + $send(h, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];}, TMP_Asciidoctor_7.$$s = self, TMP_Asciidoctor_7.$$arity = 2, TMP_Asciidoctor_7))); + Opal.const_set($nesting[0], 'CalloutScanRx', new RegExp("" + "\\\\?(?=(?: ?\\\\?)*" + ($$($nesting, 'CC_EOL')) + ")")); + Opal.const_set($nesting[0], 'CalloutSourceRx', new RegExp("" + "((?://|#|--|;;) ?)?(\\\\)?<!?(|--)(\\d+|\\.)\\3>(?=(?: ?\\\\?<!?\\3(?:\\d+|\\.)\\3>)*" + ($$($nesting, 'CC_EOL')) + ")")); + Opal.const_set($nesting[0], 'CalloutSourceRxt', "" + "(\\\\)?<()(\\d+|\\.)>(?=(?: ?\\\\?<(?:\\d+|\\.)>)*" + ($$($nesting, 'CC_EOL')) + ")"); + Opal.const_set($nesting[0], 'CalloutSourceRxMap', $send($$$('::', 'Hash'), 'new', [], (TMP_Asciidoctor_8 = function(h, k){var self = TMP_Asciidoctor_8.$$s || this; + + + + if (h == null) { + h = nil; + }; + + if (k == null) { + k = nil; + }; + $writer = [k, new RegExp("" + "(" + ($$$('::', 'Regexp').$escape(k)) + " ?)?" + ($$($nesting, 'CalloutSourceRxt')))]; + $send(h, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];}, TMP_Asciidoctor_8.$$s = self, TMP_Asciidoctor_8.$$arity = 2, TMP_Asciidoctor_8))); + Opal.const_set($nesting[0], 'ListRxMap', $hash2(["ulist", "olist", "dlist", "colist"], {"ulist": $$($nesting, 'UnorderedListRx'), "olist": $$($nesting, 'OrderedListRx'), "dlist": $$($nesting, 'DescriptionListRx'), "colist": $$($nesting, 'CalloutListRx')})); + Opal.const_set($nesting[0], 'ColumnSpecRx', /^(?:(\d+)\*)?([<^>](?:\.[<^>]?)?|(?:[<^>]?\.)?[<^>])?(\d+%?|~)?([a-z])?$/); + Opal.const_set($nesting[0], 'CellSpecStartRx', /^[ \t]*(?:(\d+(?:\.\d*)?|(?:\d*\.)?\d+)([*+]))?([<^>](?:\.[<^>]?)?|(?:[<^>]?\.)?[<^>])?([a-z])?$/); + Opal.const_set($nesting[0], 'CellSpecEndRx', /[ \t]+(?:(\d+(?:\.\d*)?|(?:\d*\.)?\d+)([*+]))?([<^>](?:\.[<^>]?)?|(?:[<^>]?\.)?[<^>])?([a-z])?$/); + Opal.const_set($nesting[0], 'CustomBlockMacroRx', new RegExp("" + "^(" + ($$($nesting, 'CG_WORD')) + "[-" + ($$($nesting, 'CC_WORD')) + "]*)::(|\\S|\\S" + ($$($nesting, 'CC_ANY')) + "*?\\S)\\[(" + ($$($nesting, 'CC_ANY')) + "+)?\\]$")); + Opal.const_set($nesting[0], 'BlockMediaMacroRx', new RegExp("" + "^(image|video|audio)::(\\S|\\S" + ($$($nesting, 'CC_ANY')) + "*?\\S)\\[(" + ($$($nesting, 'CC_ANY')) + "+)?\\]$")); + Opal.const_set($nesting[0], 'BlockTocMacroRx', new RegExp("" + "^toc::\\[(" + ($$($nesting, 'CC_ANY')) + "+)?\\]$")); + Opal.const_set($nesting[0], 'InlineAnchorRx', new RegExp("" + "(\\\\)?(?:\\[\\[([" + ($$($nesting, 'CC_ALPHA')) + "_:][" + ($$($nesting, 'CC_WORD')) + ":.-]*)(?:, *(" + ($$($nesting, 'CC_ANY')) + "+?))?\\]\\]|anchor:([" + ($$($nesting, 'CC_ALPHA')) + "_:][" + ($$($nesting, 'CC_WORD')) + ":.-]*)\\[(?:\\]|(" + ($$($nesting, 'CC_ANY')) + "*?[^\\\\])\\]))")); + Opal.const_set($nesting[0], 'InlineAnchorScanRx', new RegExp("" + "(?:^|[^\\\\\\[])\\[\\[([" + ($$($nesting, 'CC_ALPHA')) + "_:][" + ($$($nesting, 'CC_WORD')) + ":.-]*)(?:, *(" + ($$($nesting, 'CC_ANY')) + "+?))?\\]\\]|(?:^|[^\\\\])anchor:([" + ($$($nesting, 'CC_ALPHA')) + "_:][" + ($$($nesting, 'CC_WORD')) + ":.-]*)\\[(?:\\]|(" + ($$($nesting, 'CC_ANY')) + "*?[^\\\\])\\])")); + Opal.const_set($nesting[0], 'LeadingInlineAnchorRx', new RegExp("" + "^\\[\\[([" + ($$($nesting, 'CC_ALPHA')) + "_:][" + ($$($nesting, 'CC_WORD')) + ":.-]*)(?:, *(" + ($$($nesting, 'CC_ANY')) + "+?))?\\]\\]")); + Opal.const_set($nesting[0], 'InlineBiblioAnchorRx', new RegExp("" + "^\\[\\[\\[([" + ($$($nesting, 'CC_ALPHA')) + "_:][" + ($$($nesting, 'CC_WORD')) + ":.-]*)(?:, *(" + ($$($nesting, 'CC_ANY')) + "+?))?\\]\\]\\]")); + Opal.const_set($nesting[0], 'InlineEmailRx', new RegExp("" + "([\\\\>:/])?" + ($$($nesting, 'CG_WORD')) + "[" + ($$($nesting, 'CC_WORD')) + ".%+-]*@" + ($$($nesting, 'CG_ALNUM')) + "[" + ($$($nesting, 'CC_ALNUM')) + ".-]*\\." + ($$($nesting, 'CG_ALPHA')) + "{2,4}\\b")); + Opal.const_set($nesting[0], 'InlineFootnoteMacroRx', new RegExp("" + "\\\\?footnote(?:(ref):|:([\\w-]+)?)\\[(?:|(" + ($$($nesting, 'CC_ALL')) + "*?[^\\\\]))\\]", 'm')); + Opal.const_set($nesting[0], 'InlineImageMacroRx', new RegExp("" + "\\\\?i(?:mage|con):([^:\\s\\[](?:[^\\n\\[]*[^\\s\\[])?)\\[(|" + ($$($nesting, 'CC_ALL')) + "*?[^\\\\])\\]", 'm')); + Opal.const_set($nesting[0], 'InlineIndextermMacroRx', new RegExp("" + "\\\\?(?:(indexterm2?):\\[(" + ($$($nesting, 'CC_ALL')) + "*?[^\\\\])\\]|\\(\\((" + ($$($nesting, 'CC_ALL')) + "+?)\\)\\)(?!\\)))", 'm')); + Opal.const_set($nesting[0], 'InlineKbdBtnMacroRx', new RegExp("" + "(\\\\)?(kbd|btn):\\[(" + ($$($nesting, 'CC_ALL')) + "*?[^\\\\])\\]", 'm')); + Opal.const_set($nesting[0], 'InlineLinkRx', new RegExp("" + "(^|link:|" + ($$($nesting, 'CG_BLANK')) + "|<|[>\\(\\)\\[\\];])(\\\\?(?:https?|file|ftp|irc)://[^\\s\\[\\]<]*[^\\s.,\\[\\]<])(?:\\[(|" + ($$($nesting, 'CC_ALL')) + "*?[^\\\\])\\])?", 'm')); + Opal.const_set($nesting[0], 'InlineLinkMacroRx', new RegExp("" + "\\\\?(?:link|(mailto)):(|[^:\\s\\[][^\\s\\[]*)\\[(|" + ($$($nesting, 'CC_ALL')) + "*?[^\\\\])\\]", 'm')); + Opal.const_set($nesting[0], 'MacroNameRx', new RegExp("" + "^" + ($$($nesting, 'CG_WORD')) + "[-" + ($$($nesting, 'CC_WORD')) + "]*$")); + Opal.const_set($nesting[0], 'InlineStemMacroRx', new RegExp("" + "\\\\?(stem|(?:latex|ascii)math):([a-z]+(?:,[a-z]+)*)?\\[(" + ($$($nesting, 'CC_ALL')) + "*?[^\\\\])\\]", 'm')); + Opal.const_set($nesting[0], 'InlineMenuMacroRx', new RegExp("" + "\\\\?menu:(" + ($$($nesting, 'CG_WORD')) + "|[" + ($$($nesting, 'CC_WORD')) + "&][^\\n\\[]*[^\\s\\[])\\[ *(" + ($$($nesting, 'CC_ALL')) + "*?[^\\\\])?\\]", 'm')); + Opal.const_set($nesting[0], 'InlineMenuRx', new RegExp("" + "\\\\?\"([" + ($$($nesting, 'CC_WORD')) + "&][^\"]*?[ \\n]+>[ \\n]+[^\"]*)\"")); + Opal.const_set($nesting[0], 'InlinePassRx', $hash(false, ["+", "`", new RegExp("" + "(^|[^" + ($$($nesting, 'CC_WORD')) + ";:])(?:\\[([^\\]]+)\\])?(\\\\?(\\+|`)(\\S|\\S" + ($$($nesting, 'CC_ALL')) + "*?\\S)\\4)(?!" + ($$($nesting, 'CG_WORD')) + ")", 'm')], true, ["`", nil, new RegExp("" + "(^|[^`" + ($$($nesting, 'CC_WORD')) + "])(?:\\[([^\\]]+)\\])?(\\\\?(`)([^`\\s]|[^`\\s]" + ($$($nesting, 'CC_ALL')) + "*?\\S)\\4)(?![`" + ($$($nesting, 'CC_WORD')) + "])", 'm')])); + Opal.const_set($nesting[0], 'SinglePlusInlinePassRx', new RegExp("" + "^(\\\\)?\\+(\\S|\\S" + ($$($nesting, 'CC_ALL')) + "*?\\S)\\+$", 'm')); + Opal.const_set($nesting[0], 'InlinePassMacroRx', new RegExp("" + "(?:(?:(\\\\?)\\[([^\\]]+)\\])?(\\\\{0,2})(\\+\\+\\+?|\\$\\$)(" + ($$($nesting, 'CC_ALL')) + "*?)\\4|(\\\\?)pass:([a-z]+(?:,[a-z]+)*)?\\[(|" + ($$($nesting, 'CC_ALL')) + "*?[^\\\\])\\])", 'm')); + Opal.const_set($nesting[0], 'InlineXrefMacroRx', new RegExp("" + "\\\\?(?:<<([" + ($$($nesting, 'CC_WORD')) + "#/.:{]" + ($$($nesting, 'CC_ALL')) + "*?)>>|xref:([" + ($$($nesting, 'CC_WORD')) + "#/.:{]" + ($$($nesting, 'CC_ALL')) + "*?)\\[(?:\\]|(" + ($$($nesting, 'CC_ALL')) + "*?[^\\\\])\\]))", 'm')); + if ($$($nesting, 'RUBY_ENGINE')['$==']("opal")) { + Opal.const_set($nesting[0], 'HardLineBreakRx', new RegExp("" + "^(" + ($$($nesting, 'CC_ANY')) + "*) \\+$", 'm')) + } else { + nil + }; + Opal.const_set($nesting[0], 'MarkdownThematicBreakRx', /^ {0,3}([-*_])( *)\1\2\1$/); + Opal.const_set($nesting[0], 'ExtLayoutBreakRx', /^(?:'{3,}|<{3,}|([-*_])( *)\1\2\1)$/); + Opal.const_set($nesting[0], 'BlankLineRx', /\n{2,}/); + Opal.const_set($nesting[0], 'EscapedSpaceRx', /\\([ \t\n])/); + Opal.const_set($nesting[0], 'ReplaceableTextRx', /[&']|--|\.\.\.|\([CRT]M?\)/); + Opal.const_set($nesting[0], 'SpaceDelimiterRx', /([^\\])[ \t\n]+/); + Opal.const_set($nesting[0], 'SubModifierSniffRx', /[+-]/); + Opal.const_set($nesting[0], 'TrailingDigitsRx', /\d+$/); + if ($$($nesting, 'RUBY_ENGINE')['$==']("opal")) { + } else { + nil + }; + Opal.const_set($nesting[0], 'UriSniffRx', new RegExp("" + "^" + ($$($nesting, 'CG_ALPHA')) + "[" + ($$($nesting, 'CC_ALNUM')) + ".+-]+:/{0,2}")); + Opal.const_set($nesting[0], 'UriTerminatorRx', /[);:]$/); + Opal.const_set($nesting[0], 'XmlSanitizeRx', /<[^>]+>/); + Opal.const_set($nesting[0], 'INTRINSIC_ATTRIBUTES', $hash2(["startsb", "endsb", "vbar", "caret", "asterisk", "tilde", "plus", "backslash", "backtick", "blank", "empty", "sp", "two-colons", "two-semicolons", "nbsp", "deg", "zwsp", "quot", "apos", "lsquo", "rsquo", "ldquo", "rdquo", "wj", "brvbar", "pp", "cpp", "amp", "lt", "gt"], {"startsb": "[", "endsb": "]", "vbar": "|", "caret": "^", "asterisk": "*", "tilde": "~", "plus": "+", "backslash": "\\", "backtick": "`", "blank": "", "empty": "", "sp": " ", "two-colons": "::", "two-semicolons": ";;", "nbsp": " ", "deg": "°", "zwsp": "​", "quot": """, "apos": "'", "lsquo": "‘", "rsquo": "’", "ldquo": "“", "rdquo": "”", "wj": "⁠", "brvbar": "¦", "pp": "++", "cpp": "C++", "amp": "&", "lt": "<", "gt": ">"})); + quote_subs = [["strong", "unconstrained", new RegExp("" + "\\\\?(?:\\[([^\\]]+)\\])?\\*\\*(" + ($$($nesting, 'CC_ALL')) + "+?)\\*\\*", 'm')], ["strong", "constrained", new RegExp("" + "(^|[^" + ($$($nesting, 'CC_WORD')) + ";:}])(?:\\[([^\\]]+)\\])?\\*(\\S|\\S" + ($$($nesting, 'CC_ALL')) + "*?\\S)\\*(?!" + ($$($nesting, 'CG_WORD')) + ")", 'm')], ["double", "constrained", new RegExp("" + "(^|[^" + ($$($nesting, 'CC_WORD')) + ";:}])(?:\\[([^\\]]+)\\])?\"`(\\S|\\S" + ($$($nesting, 'CC_ALL')) + "*?\\S)`\"(?!" + ($$($nesting, 'CG_WORD')) + ")", 'm')], ["single", "constrained", new RegExp("" + "(^|[^" + ($$($nesting, 'CC_WORD')) + ";:`}])(?:\\[([^\\]]+)\\])?'`(\\S|\\S" + ($$($nesting, 'CC_ALL')) + "*?\\S)`'(?!" + ($$($nesting, 'CG_WORD')) + ")", 'm')], ["monospaced", "unconstrained", new RegExp("" + "\\\\?(?:\\[([^\\]]+)\\])?``(" + ($$($nesting, 'CC_ALL')) + "+?)``", 'm')], ["monospaced", "constrained", new RegExp("" + "(^|[^" + ($$($nesting, 'CC_WORD')) + ";:\"'`}])(?:\\[([^\\]]+)\\])?`(\\S|\\S" + ($$($nesting, 'CC_ALL')) + "*?\\S)`(?![" + ($$($nesting, 'CC_WORD')) + "\"'`])", 'm')], ["emphasis", "unconstrained", new RegExp("" + "\\\\?(?:\\[([^\\]]+)\\])?__(" + ($$($nesting, 'CC_ALL')) + "+?)__", 'm')], ["emphasis", "constrained", new RegExp("" + "(^|[^" + ($$($nesting, 'CC_WORD')) + ";:}])(?:\\[([^\\]]+)\\])?_(\\S|\\S" + ($$($nesting, 'CC_ALL')) + "*?\\S)_(?!" + ($$($nesting, 'CG_WORD')) + ")", 'm')], ["mark", "unconstrained", new RegExp("" + "\\\\?(?:\\[([^\\]]+)\\])?##(" + ($$($nesting, 'CC_ALL')) + "+?)##", 'm')], ["mark", "constrained", new RegExp("" + "(^|[^" + ($$($nesting, 'CC_WORD')) + "&;:}])(?:\\[([^\\]]+)\\])?#(\\S|\\S" + ($$($nesting, 'CC_ALL')) + "*?\\S)#(?!" + ($$($nesting, 'CG_WORD')) + ")", 'm')], ["superscript", "unconstrained", /\\?(?:\[([^\]]+)\])?\^(\S+?)\^/], ["subscript", "unconstrained", /\\?(?:\[([^\]]+)\])?~(\S+?)~/]]; + compat_quote_subs = quote_subs.$drop(0); + + $writer = [2, ["double", "constrained", new RegExp("" + "(^|[^" + ($$($nesting, 'CC_WORD')) + ";:}])(?:\\[([^\\]]+)\\])?``(\\S|\\S" + ($$($nesting, 'CC_ALL')) + "*?\\S)''(?!" + ($$($nesting, 'CG_WORD')) + ")", 'm')]]; + $send(compat_quote_subs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = [3, ["single", "constrained", new RegExp("" + "(^|[^" + ($$($nesting, 'CC_WORD')) + ";:}])(?:\\[([^\\]]+)\\])?`(\\S|\\S" + ($$($nesting, 'CC_ALL')) + "*?\\S)'(?!" + ($$($nesting, 'CG_WORD')) + ")", 'm')]]; + $send(compat_quote_subs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = [4, ["monospaced", "unconstrained", new RegExp("" + "\\\\?(?:\\[([^\\]]+)\\])?\\+\\+(" + ($$($nesting, 'CC_ALL')) + "+?)\\+\\+", 'm')]]; + $send(compat_quote_subs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = [5, ["monospaced", "constrained", new RegExp("" + "(^|[^" + ($$($nesting, 'CC_WORD')) + ";:}])(?:\\[([^\\]]+)\\])?\\+(\\S|\\S" + ($$($nesting, 'CC_ALL')) + "*?\\S)\\+(?!" + ($$($nesting, 'CG_WORD')) + ")", 'm')]]; + $send(compat_quote_subs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + compat_quote_subs.$insert(3, ["emphasis", "constrained", new RegExp("" + "(^|[^" + ($$($nesting, 'CC_WORD')) + ";:}])(?:\\[([^\\]]+)\\])?'(\\S|\\S" + ($$($nesting, 'CC_ALL')) + "*?\\S)'(?!" + ($$($nesting, 'CG_WORD')) + ")", 'm')]); + Opal.const_set($nesting[0], 'QUOTE_SUBS', $hash(false, quote_subs, true, compat_quote_subs)); + quote_subs = nil; + compat_quote_subs = nil; + Opal.const_set($nesting[0], 'REPLACEMENTS', [[/\\?\(C\)/, "©", "none"], [/\\?\(R\)/, "®", "none"], [/\\?\(TM\)/, "™", "none"], [/(^|\n| |\\)--( |\n|$)/, " — ", "none"], [new RegExp("" + "(" + ($$($nesting, 'CG_WORD')) + ")\\\\?--(?=" + ($$($nesting, 'CG_WORD')) + ")"), "—​", "leading"], [/\\?\.\.\./, "…​", "leading"], [/\\?`'/, "’", "none"], [new RegExp("" + "(" + ($$($nesting, 'CG_ALNUM')) + ")\\\\?'(?=" + ($$($nesting, 'CG_ALPHA')) + ")"), "’", "leading"], [/\\?->/, "→", "none"], [/\\?=>/, "⇒", "none"], [/\\?<-/, "←", "none"], [/\\?<=/, "⇐", "none"], [/\\?(&)amp;((?:[a-zA-Z][a-zA-Z]+\d{0,2}|#\d\d\d{0,4}|#x[\da-fA-F][\da-fA-F][\da-fA-F]{0,3});)/, "", "bounding"]]); + (function(self, $parent_nesting) { + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_load_9, TMP_load_file_13, TMP_convert_15, TMP_convert_file_16; + + + + Opal.def(self, '$load', TMP_load_9 = function $$load(input, options) { + var $a, $b, TMP_10, TMP_11, TMP_12, self = this, timings = nil, logger = nil, $writer = nil, attrs = nil, attrs_arr = nil, lines = nil, input_path = nil, input_mtime = nil, docdate = nil, doctime = nil, doc = nil, ex = nil, context = nil, wrapped_ex = nil; + + + + if (options == null) { + options = $hash2([], {}); + }; + try { + + options = options.$dup(); + if ($truthy((timings = options['$[]']("timings")))) { + timings.$start("read")}; + if ($truthy(($truthy($a = (logger = options['$[]']("logger"))) ? logger['$!=']($$($nesting, 'LoggerManager').$logger()) : $a))) { + + $writer = [logger]; + $send($$($nesting, 'LoggerManager'), 'logger=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if ($truthy((attrs = options['$[]']("attributes"))['$!']())) { + attrs = $hash2([], {}) + } else if ($truthy(($truthy($a = $$$('::', 'Hash')['$==='](attrs)) ? $a : ($truthy($b = $$$('::', 'RUBY_ENGINE_JRUBY')) ? $$$($$$($$$('::', 'Java'), 'JavaUtil'), 'Map')['$==='](attrs) : $b)))) { + attrs = attrs.$dup() + } else if ($truthy($$$('::', 'Array')['$==='](attrs))) { + + $a = [$hash2([], {}), attrs], (attrs = $a[0]), (attrs_arr = $a[1]), $a; + $send(attrs_arr, 'each', [], (TMP_10 = function(entry){var self = TMP_10.$$s || this, $c, $d, k = nil, v = nil; + + + + if (entry == null) { + entry = nil; + }; + $d = entry.$split("=", 2), $c = Opal.to_ary($d), (k = ($c[0] == null ? nil : $c[0])), (v = ($c[1] == null ? nil : $c[1])), $d; + + $writer = [k, ($truthy($c = v) ? $c : "")]; + $send(attrs, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];;}, TMP_10.$$s = self, TMP_10.$$arity = 1, TMP_10)); + } else if ($truthy($$$('::', 'String')['$==='](attrs))) { + + $a = [$hash2([], {}), attrs.$gsub($$($nesting, 'SpaceDelimiterRx'), "" + "\\1" + ($$($nesting, 'NULL'))).$gsub($$($nesting, 'EscapedSpaceRx'), "\\1").$split($$($nesting, 'NULL'))], (attrs = $a[0]), (attrs_arr = $a[1]), $a; + $send(attrs_arr, 'each', [], (TMP_11 = function(entry){var self = TMP_11.$$s || this, $c, $d, k = nil, v = nil; + + + + if (entry == null) { + entry = nil; + }; + $d = entry.$split("=", 2), $c = Opal.to_ary($d), (k = ($c[0] == null ? nil : $c[0])), (v = ($c[1] == null ? nil : $c[1])), $d; + + $writer = [k, ($truthy($c = v) ? $c : "")]; + $send(attrs, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];;}, TMP_11.$$s = self, TMP_11.$$arity = 1, TMP_11)); + } else if ($truthy(($truthy($a = attrs['$respond_to?']("keys")) ? attrs['$respond_to?']("[]") : $a))) { + attrs = $$$('::', 'Hash')['$[]']($send(attrs.$keys(), 'map', [], (TMP_12 = function(k){var self = TMP_12.$$s || this; + + + + if (k == null) { + k = nil; + }; + return [k, attrs['$[]'](k)];}, TMP_12.$$s = self, TMP_12.$$arity = 1, TMP_12))) + } else { + self.$raise($$$('::', 'ArgumentError'), "" + "illegal type for attributes option: " + (attrs.$class().$ancestors().$join(" < "))) + }; + lines = nil; + if ($truthy($$$('::', 'File')['$==='](input))) { + + input_path = $$$('::', 'File').$expand_path(input.$path()); + input_mtime = (function() {if ($truthy($$$('::', 'ENV')['$[]']("SOURCE_DATE_EPOCH"))) { + return $$$('::', 'Time').$at(self.$Integer($$$('::', 'ENV')['$[]']("SOURCE_DATE_EPOCH"))).$utc() + } else { + return input.$mtime() + }; return nil; })(); + lines = input.$readlines(); + + $writer = ["docfile", input_path]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["docdir", $$$('::', 'File').$dirname(input_path)]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["docname", $$($nesting, 'Helpers').$basename(input_path, (($writer = ["docfilesuffix", $$$('::', 'File').$extname(input_path)]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]))]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + if ($truthy((docdate = attrs['$[]']("docdate")))) { + ($truthy($a = attrs['$[]']("docyear")) ? $a : (($writer = ["docyear", (function() {if (docdate.$index("-")['$=='](4)) { + + return docdate.$slice(0, 4); + } else { + return nil + }; return nil; })()]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])) + } else { + + docdate = (($writer = ["docdate", input_mtime.$strftime("%F")]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]); + ($truthy($a = attrs['$[]']("docyear")) ? $a : (($writer = ["docyear", input_mtime.$year().$to_s()]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + }; + doctime = ($truthy($a = attrs['$[]']("doctime")) ? $a : (($writer = ["doctime", input_mtime.$strftime("" + "%T " + ((function() {if (input_mtime.$utc_offset()['$=='](0)) { + return "UTC" + } else { + return "%z" + }; return nil; })()))]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + + $writer = ["docdatetime", "" + (docdate) + " " + (doctime)]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + } else if ($truthy(input['$respond_to?']("readlines"))) { + + + try { + input.$rewind() + } catch ($err) { + if (Opal.rescue($err, [$$($nesting, 'StandardError')])) { + try { + nil + } finally { Opal.pop_exception() } + } else { throw $err; } + };; + lines = input.$readlines(); + } else if ($truthy($$$('::', 'String')['$==='](input))) { + lines = (function() {if ($truthy($$$('::', 'RUBY_MIN_VERSION_2'))) { + return input.$lines() + } else { + return input.$each_line().$to_a() + }; return nil; })() + } else if ($truthy($$$('::', 'Array')['$==='](input))) { + lines = input.$drop(0) + } else { + self.$raise($$$('::', 'ArgumentError'), "" + "unsupported input type: " + (input.$class())) + }; + if ($truthy(timings)) { + + timings.$record("read"); + timings.$start("parse");}; + + $writer = ["attributes", attrs]; + $send(options, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + doc = (function() {if (options['$[]']("parse")['$=='](false)) { + + return $$($nesting, 'Document').$new(lines, options); + } else { + return $$($nesting, 'Document').$new(lines, options).$parse() + }; return nil; })(); + if ($truthy(timings)) { + timings.$record("parse")}; + return doc; + } catch ($err) { + if (Opal.rescue($err, [$$($nesting, 'StandardError')])) {ex = $err; + try { + + + try { + + context = "" + "asciidoctor: FAILED: " + (($truthy($a = attrs['$[]']("docfile")) ? $a : "")) + ": Failed to load AsciiDoc document"; + if ($truthy(ex['$respond_to?']("exception"))) { + + wrapped_ex = ex.$exception("" + (context) + " - " + (ex.$message())); + wrapped_ex.$set_backtrace(ex.$backtrace()); + } else { + + wrapped_ex = ex.$class().$new(context, ex); + + $writer = [ex.$stack_trace()]; + $send(wrapped_ex, 'stack_trace=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + }; + } catch ($err) { + if (Opal.rescue($err, [$$($nesting, 'StandardError')])) { + try { + wrapped_ex = ex + } finally { Opal.pop_exception() } + } else { throw $err; } + };; + return self.$raise(wrapped_ex); + } finally { Opal.pop_exception() } + } else { throw $err; } + }; + }, TMP_load_9.$$arity = -2); + + Opal.def(self, '$load_file', TMP_load_file_13 = function $$load_file(filename, options) { + var TMP_14, self = this; + + + + if (options == null) { + options = $hash2([], {}); + }; + return $send($$$('::', 'File'), 'open', [filename, "rb"], (TMP_14 = function(file){var self = TMP_14.$$s || this; + + + + if (file == null) { + file = nil; + }; + return self.$load(file, options);}, TMP_14.$$s = self, TMP_14.$$arity = 1, TMP_14)); + }, TMP_load_file_13.$$arity = -2); + + Opal.def(self, '$convert', TMP_convert_15 = function $$convert(input, options) { + var $a, $b, $c, $d, $e, self = this, to_file = nil, to_dir = nil, mkdirs = nil, $case = nil, write_to_same_dir = nil, stream_output = nil, write_to_target = nil, $writer = nil, input_path = nil, outdir = nil, doc = nil, outfile = nil, working_dir = nil, jail = nil, opts = nil, output = nil, stylesdir = nil, copy_asciidoctor_stylesheet = nil, copy_user_stylesheet = nil, stylesheet = nil, copy_coderay_stylesheet = nil, copy_pygments_stylesheet = nil, stylesoutdir = nil, stylesheet_src = nil, stylesheet_dest = nil, stylesheet_data = nil; + + + + if (options == null) { + options = $hash2([], {}); + }; + options = options.$dup(); + options.$delete("parse"); + to_file = options.$delete("to_file"); + to_dir = options.$delete("to_dir"); + mkdirs = ($truthy($a = options.$delete("mkdirs")) ? $a : false); + $case = to_file; + if (true['$===']($case) || nil['$===']($case)) { + write_to_same_dir = ($truthy($a = to_dir['$!']()) ? $$$('::', 'File')['$==='](input) : $a); + stream_output = false; + write_to_target = to_dir; + to_file = nil;} + else if (false['$===']($case)) { + write_to_same_dir = false; + stream_output = false; + write_to_target = false; + to_file = nil;} + else if ("/dev/null"['$===']($case)) {return self.$load(input, options)} + else { + write_to_same_dir = false; + write_to_target = (function() {if ($truthy((stream_output = to_file['$respond_to?']("write")))) { + return false + } else { + + + $writer = ["to_file", to_file]; + $send(options, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];; + }; return nil; })();}; + if ($truthy(options['$key?']("header_footer"))) { + } else if ($truthy(($truthy($a = write_to_same_dir) ? $a : write_to_target))) { + + $writer = ["header_footer", true]; + $send(options, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if ($truthy(write_to_same_dir)) { + + input_path = $$$('::', 'File').$expand_path(input.$path()); + + $writer = ["to_dir", (outdir = $$$('::', 'File').$dirname(input_path))]; + $send(options, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + } else if ($truthy(write_to_target)) { + if ($truthy(to_dir)) { + if ($truthy(to_file)) { + + $writer = ["to_dir", $$$('::', 'File').$dirname($$$('::', 'File').$expand_path($$$('::', 'File').$join(to_dir, to_file)))]; + $send(options, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + } else { + + $writer = ["to_dir", $$$('::', 'File').$expand_path(to_dir)]; + $send(options, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + } + } else if ($truthy(to_file)) { + + $writer = ["to_dir", $$$('::', 'File').$dirname($$$('::', 'File').$expand_path(to_file))]; + $send(options, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}}; + doc = self.$load(input, options); + if ($truthy(write_to_same_dir)) { + + outfile = $$$('::', 'File').$join(outdir, "" + (doc.$attributes()['$[]']("docname")) + (doc.$outfilesuffix())); + if (outfile['$=='](input_path)) { + self.$raise($$$('::', 'IOError'), "" + "input file and output file cannot be the same: " + (outfile))}; + } else if ($truthy(write_to_target)) { + + working_dir = (function() {if ($truthy(options['$key?']("base_dir"))) { + + return $$$('::', 'File').$expand_path(options['$[]']("base_dir")); + } else { + return $$$('::', 'Dir').$pwd() + }; return nil; })(); + jail = (function() {if ($truthy($rb_ge(doc.$safe(), $$$($$($nesting, 'SafeMode'), 'SAFE')))) { + return working_dir + } else { + return nil + }; return nil; })(); + if ($truthy(to_dir)) { + + outdir = doc.$normalize_system_path(to_dir, working_dir, jail, $hash2(["target_name", "recover"], {"target_name": "to_dir", "recover": false})); + if ($truthy(to_file)) { + + outfile = doc.$normalize_system_path(to_file, outdir, nil, $hash2(["target_name", "recover"], {"target_name": "to_dir", "recover": false})); + outdir = $$$('::', 'File').$dirname(outfile); + } else { + outfile = $$$('::', 'File').$join(outdir, "" + (doc.$attributes()['$[]']("docname")) + (doc.$outfilesuffix())) + }; + } else if ($truthy(to_file)) { + + outfile = doc.$normalize_system_path(to_file, working_dir, jail, $hash2(["target_name", "recover"], {"target_name": "to_dir", "recover": false})); + outdir = $$$('::', 'File').$dirname(outfile);}; + if ($truthy(($truthy($a = $$$('::', 'File')['$==='](input)) ? outfile['$==']($$$('::', 'File').$expand_path(input.$path())) : $a))) { + self.$raise($$$('::', 'IOError'), "" + "input file and output file cannot be the same: " + (outfile))}; + if ($truthy(mkdirs)) { + $$($nesting, 'Helpers').$mkdir_p(outdir) + } else if ($truthy($$$('::', 'File')['$directory?'](outdir))) { + } else { + self.$raise($$$('::', 'IOError'), "" + "target directory does not exist: " + (to_dir) + " (hint: set mkdirs option)") + }; + } else { + + outfile = to_file; + outdir = nil; + }; + opts = (function() {if ($truthy(($truthy($a = outfile) ? stream_output['$!']() : $a))) { + return $hash2(["outfile", "outdir"], {"outfile": outfile, "outdir": outdir}) + } else { + return $hash2([], {}) + }; return nil; })(); + output = doc.$convert(opts); + if ($truthy(outfile)) { + + doc.$write(output, outfile); + if ($truthy(($truthy($a = ($truthy($b = ($truthy($c = ($truthy($d = ($truthy($e = stream_output['$!']()) ? $rb_lt(doc.$safe(), $$$($$($nesting, 'SafeMode'), 'SECURE')) : $e)) ? doc['$attr?']("linkcss") : $d)) ? doc['$attr?']("copycss") : $c)) ? doc['$attr?']("basebackend-html") : $b)) ? ($truthy($b = (stylesdir = doc.$attr("stylesdir"))) ? $$($nesting, 'Helpers')['$uriish?'](stylesdir) : $b)['$!']() : $a))) { + + copy_asciidoctor_stylesheet = false; + copy_user_stylesheet = false; + if ($truthy((stylesheet = doc.$attr("stylesheet")))) { + if ($truthy($$($nesting, 'DEFAULT_STYLESHEET_KEYS')['$include?'](stylesheet))) { + copy_asciidoctor_stylesheet = true + } else if ($truthy($$($nesting, 'Helpers')['$uriish?'](stylesheet)['$!']())) { + copy_user_stylesheet = true}}; + copy_coderay_stylesheet = ($truthy($a = doc['$attr?']("source-highlighter", "coderay")) ? doc.$attr("coderay-css", "class")['$==']("class") : $a); + copy_pygments_stylesheet = ($truthy($a = doc['$attr?']("source-highlighter", "pygments")) ? doc.$attr("pygments-css", "class")['$==']("class") : $a); + if ($truthy(($truthy($a = ($truthy($b = ($truthy($c = copy_asciidoctor_stylesheet) ? $c : copy_user_stylesheet)) ? $b : copy_coderay_stylesheet)) ? $a : copy_pygments_stylesheet))) { + + stylesoutdir = doc.$normalize_system_path(stylesdir, outdir, (function() {if ($truthy($rb_ge(doc.$safe(), $$$($$($nesting, 'SafeMode'), 'SAFE')))) { + return outdir + } else { + return nil + }; return nil; })()); + if ($truthy(mkdirs)) { + $$($nesting, 'Helpers').$mkdir_p(stylesoutdir) + } else if ($truthy($$$('::', 'File')['$directory?'](stylesoutdir))) { + } else { + self.$raise($$$('::', 'IOError'), "" + "target stylesheet directory does not exist: " + (stylesoutdir) + " (hint: set mkdirs option)") + }; + if ($truthy(copy_asciidoctor_stylesheet)) { + $$($nesting, 'Stylesheets').$instance().$write_primary_stylesheet(stylesoutdir) + } else if ($truthy(copy_user_stylesheet)) { + + if ($truthy((stylesheet_src = doc.$attr("copycss"))['$empty?']())) { + stylesheet_src = doc.$normalize_system_path(stylesheet) + } else { + stylesheet_src = doc.$normalize_system_path(stylesheet_src) + }; + stylesheet_dest = doc.$normalize_system_path(stylesheet, stylesoutdir, (function() {if ($truthy($rb_ge(doc.$safe(), $$$($$($nesting, 'SafeMode'), 'SAFE')))) { + return outdir + } else { + return nil + }; return nil; })()); + if ($truthy(($truthy($a = stylesheet_src['$!='](stylesheet_dest)) ? (stylesheet_data = doc.$read_asset(stylesheet_src, $hash2(["warn_on_failure", "label"], {"warn_on_failure": $$$('::', 'File')['$file?'](stylesheet_dest)['$!'](), "label": "stylesheet"}))) : $a))) { + $$$('::', 'IO').$write(stylesheet_dest, stylesheet_data)};}; + if ($truthy(copy_coderay_stylesheet)) { + $$($nesting, 'Stylesheets').$instance().$write_coderay_stylesheet(stylesoutdir) + } else if ($truthy(copy_pygments_stylesheet)) { + $$($nesting, 'Stylesheets').$instance().$write_pygments_stylesheet(stylesoutdir, doc.$attr("pygments-style"))};};}; + return doc; + } else { + return output + }; + }, TMP_convert_15.$$arity = -2); + Opal.alias(self, "render", "convert"); + + Opal.def(self, '$convert_file', TMP_convert_file_16 = function $$convert_file(filename, options) { + var TMP_17, self = this; + + + + if (options == null) { + options = $hash2([], {}); + }; + return $send($$$('::', 'File'), 'open', [filename, "rb"], (TMP_17 = function(file){var self = TMP_17.$$s || this; + + + + if (file == null) { + file = nil; + }; + return self.$convert(file, options);}, TMP_17.$$s = self, TMP_17.$$arity = 1, TMP_17)); + }, TMP_convert_file_16.$$arity = -2); + Opal.alias(self, "render_file", "convert_file"); + if ($$($nesting, 'RUBY_ENGINE')['$==']("opal")) { + return nil + } else { + return nil + }; + })(Opal.get_singleton_class(self), $nesting); + if ($$($nesting, 'RUBY_ENGINE')['$==']("opal")) { + + self.$require("asciidoctor/timings"); + self.$require("asciidoctor/version"); + } else { + nil + }; + })($nesting[0], $nesting); + self.$require("asciidoctor/core_ext"); + self.$require("asciidoctor/helpers"); + self.$require("asciidoctor/substitutors"); + self.$require("asciidoctor/abstract_node"); + self.$require("asciidoctor/abstract_block"); + self.$require("asciidoctor/attribute_list"); + self.$require("asciidoctor/block"); + self.$require("asciidoctor/callouts"); + self.$require("asciidoctor/converter"); + self.$require("asciidoctor/document"); + self.$require("asciidoctor/inline"); + self.$require("asciidoctor/list"); + self.$require("asciidoctor/parser"); + self.$require("asciidoctor/path_resolver"); + self.$require("asciidoctor/reader"); + self.$require("asciidoctor/section"); + self.$require("asciidoctor/stylesheets"); + self.$require("asciidoctor/table"); + if ($$($nesting, 'RUBY_ENGINE')['$==']("opal")) { + return self.$require("asciidoctor/js/postscript") + } else { + return nil + }; +})(Opal); + + +/** + * Convert a JSON to an (Opal) Hash. + * @private + */ +var toHash = function (object) { + return object && !('$$smap' in object) ? Opal.hash(object) : object; +}; + +/** + * Convert an (Opal) Hash to JSON. + * @private + */ +var fromHash = function (hash) { + var object = {}; + var data = hash.$$smap; + for (var key in data) { + object[key] = data[key]; + } + return object; +}; + +/** + * @private + */ +var prepareOptions = function (options) { + if (options = toHash(options)) { + var attrs = options['$[]']('attributes'); + if (attrs && typeof attrs === 'object' && attrs.constructor.name === 'Object') { + options = options.$dup(); + options['$[]=']('attributes', toHash(attrs)); + } + } + return options; +}; + +function initializeClass (superClass, className, functions, defaultFunctions, argProxyFunctions) { + var scope = Opal.klass(Opal.Object, superClass, className, function () {}); + var postConstructFunction; + var initializeFunction; + var defaultFunctionsOverridden = {}; + for (var functionName in functions) { + if (functions.hasOwnProperty(functionName)) { + (function (functionName) { + var userFunction = functions[functionName]; + if (functionName === 'postConstruct') { + postConstructFunction = userFunction; + } else if (functionName === 'initialize') { + initializeFunction = userFunction; + } else { + if (defaultFunctions && defaultFunctions.hasOwnProperty(functionName)) { + defaultFunctionsOverridden[functionName] = true; + } + Opal.def(scope, '$' + functionName, function () { + var args; + if (argProxyFunctions && argProxyFunctions.hasOwnProperty(functionName)) { + args = argProxyFunctions[functionName](arguments); + } else { + args = arguments; + } + return userFunction.apply(this, args); + }); + } + }(functionName)); + } + } + var initialize; + if (typeof initializeFunction === 'function') { + initialize = function () { + initializeFunction.apply(this, arguments); + if (typeof postConstructFunction === 'function') { + postConstructFunction.bind(this)(); + } + }; + } else { + initialize = function () { + Opal.send(this, Opal.find_super_dispatcher(this, 'initialize', initialize)); + if (typeof postConstructFunction === 'function') { + postConstructFunction.bind(this)(); + } + }; + } + Opal.def(scope, '$initialize', initialize); + Opal.def(scope, 'super', function (func) { + if (typeof func === 'function') { + Opal.send(this, Opal.find_super_dispatcher(this, func.name, func)); + } else { + // Bind the initialize function to super(); + var argumentsList = Array.from(arguments); + for (var i = 0; i < argumentsList.length; i++) { + // convert all (Opal) Hash arguments to JSON. + if (typeof argumentsList[i] === 'object') { + argumentsList[i] = toHash(argumentsList[i]); + } + } + Opal.send(this, Opal.find_super_dispatcher(this, 'initialize', initialize), argumentsList); + } + }); + if (defaultFunctions) { + for (var defaultFunctionName in defaultFunctions) { + if (defaultFunctions.hasOwnProperty(defaultFunctionName) && !defaultFunctionsOverridden.hasOwnProperty(defaultFunctionName)) { + (function (defaultFunctionName) { + var defaultFunction = defaultFunctions[defaultFunctionName]; + Opal.def(scope, '$' + defaultFunctionName, function () { + return defaultFunction.apply(this, arguments); + }); + }(defaultFunctionName)); + } + } + } + return scope; +} + +// Asciidoctor API + +/** + * @namespace + * @description + * Methods for parsing AsciiDoc input files and converting documents. + * + * AsciiDoc documents comprise a header followed by zero or more sections. + * Sections are composed of blocks of content. For example: + *
    + *   = Doc Title
    + *
    + *   == Section 1
    + *
    + *   This is a paragraph block in the first section.
    + *
    + *   == Section 2
    + *
    + *   This section has a paragraph block and an olist block.
    + *
    + *   . Item 1
    + *   . Item 2
    + * 
    + * + * @example + * asciidoctor.convertFile('sample.adoc'); + */ +var Asciidoctor = Opal.Asciidoctor['$$class']; + +/** + * Get Asciidoctor core version number. + * + * @memberof Asciidoctor + * @returns {string} - returns the version number of Asciidoctor core. + */ +Asciidoctor.prototype.getCoreVersion = function () { + return this.$$const.VERSION; +}; + +/** + * Get Asciidoctor.js runtime environment informations. + * + * @memberof Asciidoctor + * @returns {Object} - returns the runtime environement including the ioModule, the platform, the engine and the framework. + */ +Asciidoctor.prototype.getRuntime = function () { + return { + ioModule: Opal.const_get_qualified('::', 'JAVASCRIPT_IO_MODULE'), + platform: Opal.const_get_qualified('::', 'JAVASCRIPT_PLATFORM'), + engine: Opal.const_get_qualified('::', 'JAVASCRIPT_ENGINE'), + framework: Opal.const_get_qualified('::', 'JAVASCRIPT_FRAMEWORK') + }; +}; + +/** + * Parse the AsciiDoc source input into an {@link Document} and convert it to the specified backend format. + * + * Accepts input as a Buffer or String. + * + * @param {string|Buffer} input - AsciiDoc input as String or Buffer + * @param {Object} options - a JSON of options to control processing (default: {}) + * @returns {string|Document} - returns the {@link Document} object if the converted String is written to a file, + * otherwise the converted String + * @memberof Asciidoctor + * @example + * var input = '= Hello, AsciiDoc!\n' + + * 'Guillaume Grossetie \n\n' + + * 'An introduction to http://asciidoc.org[AsciiDoc].\n\n' + + * '== First Section\n\n' + + * '* item 1\n' + + * '* item 2\n'; + * + * var html = asciidoctor.convert(input); + */ +Asciidoctor.prototype.convert = function (input, options) { + if (typeof input === 'object' && input.constructor.name === 'Buffer') { + input = input.toString('utf8'); + } + var result = this.$convert(input, prepareOptions(options)); + return result === Opal.nil ? '' : result; +}; + +/** + * Parse the AsciiDoc source input into an {@link Document} and convert it to the specified backend format. + * + * @param {string} filename - source filename + * @param {Object} options - a JSON of options to control processing (default: {}) + * @returns {string|Document} - returns the {@link Document} object if the converted String is written to a file, + * otherwise the converted String + * @memberof Asciidoctor + * @example + * var html = asciidoctor.convertFile('./document.adoc'); + */ +Asciidoctor.prototype.convertFile = function (filename, options) { + return this.$convert_file(filename, prepareOptions(options)); +}; + +/** + * Parse the AsciiDoc source input into an {@link Document} + * + * Accepts input as a Buffer or String. + * + * @param {string|Buffer} input - AsciiDoc input as String or Buffer + * @param {Object} options - a JSON of options to control processing (default: {}) + * @returns {Document} - returns the {@link Document} object + * @memberof Asciidoctor + */ +Asciidoctor.prototype.load = function (input, options) { + if (typeof input === 'object' && input.constructor.name === 'Buffer') { + input = input.toString('utf8'); + } + return this.$load(input, prepareOptions(options)); +}; + +/** + * Parse the contents of the AsciiDoc source file into an {@link Document} + * + * @param {string} filename - source filename + * @param {Object} options - a JSON of options to control processing (default: {}) + * @returns {Document} - returns the {@link Document} object + * @memberof Asciidoctor + */ +Asciidoctor.prototype.loadFile = function (filename, options) { + return this.$load_file(filename, prepareOptions(options)); +}; + +// AbstractBlock API + +/** + * @namespace + * @extends AbstractNode + */ +var AbstractBlock = Opal.Asciidoctor.AbstractBlock; + +/** + * Append a block to this block's list of child blocks. + * + * @memberof AbstractBlock + * @returns {AbstractBlock} - the parent block to which this block was appended. + * + */ +AbstractBlock.prototype.append = function (block) { + this.$append(block); + return this; +}; + +/* + * Apply the named inline substitutions to the specified text. + * + * If no substitutions are specified, the following substitutions are + * applied: + * + * specialcharacters, quotes, attributes, replacements, macros, and post_replacements + * @param {string} text - The text to substitute. + * @param {Array} subs - A list named substitutions to apply to the text. + * @memberof AbstractBlock + * @returns {string} - returns the substituted text. + */ +AbstractBlock.prototype.applySubstitutions = function (text, subs) { + return this.$apply_subs(text, subs); +}; + +/** + * Get the String title of this Block with title substitions applied + * + * The following substitutions are applied to block and section titles: + * + * specialcharacters, quotes, replacements, macros, attributes and post_replacements + * + * @memberof AbstractBlock + * @returns {string} - returns the converted String title for this Block, or undefined if the title is not set. + * @example + * block.title // "Foo 3^ # {two-colons} Bar(1)" + * block.getTitle(); // "Foo 3^ # :: Bar(1)" + */ +AbstractBlock.prototype.getTitle = function () { + var title = this.$title(); + return title === Opal.nil ? undefined : title; +}; + +/** + * Convenience method that returns the interpreted title of the Block + * with the caption prepended. + * Concatenates the value of this Block's caption instance variable and the + * return value of this Block's title method. No space is added between the + * two values. If the Block does not have a caption, the interpreted title is + * returned. + * + * @memberof AbstractBlock + * @returns {string} - the converted String title prefixed with the caption, or just the + * converted String title if no caption is set + */ +AbstractBlock.prototype.getCaptionedTitle = function () { + return this.$captioned_title(); +}; + +/** + * Get the style (block type qualifier) for this block. + * @memberof AbstractBlock + * @returns {string} - returns the style for this block + */ +AbstractBlock.prototype.getStyle = function () { + return this.style; +}; + +/** + * Get the caption for this block. + * @memberof AbstractBlock + * @returns {string} - returns the caption for this block + */ +AbstractBlock.prototype.getCaption = function () { + return this.$caption(); +}; + +/** + * Set the caption for this block. + * @param {string} caption - Caption + * @memberof AbstractBlock + */ +AbstractBlock.prototype.setCaption = function (caption) { + this.caption = caption; +}; + +/** + * Get the level of this section or the section level in which this block resides. + * @memberof AbstractBlock + * @returns {number} - returns the level of this section + */ +AbstractBlock.prototype.getLevel = function () { + return this.level; +}; + +/** + * Get the substitution keywords to be applied to the contents of this block. + * + * @memberof AbstractBlock + * @returns {Array} - the list of {string} substitution keywords associated with this block. + */ +AbstractBlock.prototype.getSubstitutions = function () { + return this.subs; +}; + +/** + * Check whether a given substitution keyword is present in the substitutions for this block. + * + * @memberof AbstractBlock + * @returns {boolean} - whether the substitution is present on this block. + */ +AbstractBlock.prototype.hasSubstitution = function (substitution) { + return this['$sub?'](substitution); +}; + +/** + * Remove the specified substitution keyword from the list of substitutions for this block. + * + * @memberof AbstractBlock + * @returns undefined + */ +AbstractBlock.prototype.removeSubstitution = function (substitution) { + this.$remove_sub(substitution); +}; + +/** + * Checks if the {@link AbstractBlock} contains any child blocks. + * @memberof AbstractBlock + * @returns {boolean} - whether the {@link AbstractBlock} has child blocks. + */ +AbstractBlock.prototype.hasBlocks = function () { + return this.blocks.length > 0; +}; + +/** + * Get the list of {@link AbstractBlock} sub-blocks for this block. + * @memberof AbstractBlock + * @returns {Array} - returns a list of {@link AbstractBlock} sub-blocks + */ +AbstractBlock.prototype.getBlocks = function () { + return this.blocks; +}; + +/** + * Get the converted result of the child blocks by converting the children appropriate to content model that this block supports. + * @memberof AbstractBlock + * @returns {string} - returns the converted result of the child blocks + */ +AbstractBlock.prototype.getContent = function () { + return this.$content(); +}; + +/** + * Get the converted content for this block. + * If the block has child blocks, the content method should cause them to be converted + * and returned as content that can be included in the parent block's template. + * @memberof AbstractBlock + * @returns {string} - returns the converted String content for this block + */ +AbstractBlock.prototype.convert = function () { + return this.$convert(); +}; + +/** + * Query for all descendant block-level nodes in the document tree + * that match the specified selector (context, style, id, and/or role). + * If a function block is given, it's used as an additional filter. + * If no selector or function block is supplied, all block-level nodes in the tree are returned. + * @param {Object} [selector] + * @param {function} [block] + * @example + * doc.findBy({'context': 'section'}); + * // => { level: 0, title: "Hello, AsciiDoc!", blocks: 0 } + * // => { level: 1, title: "First Section", blocks: 1 } + * + * doc.findBy({'context': 'section'}, function (section) { return section.getLevel() === 1; }); + * // => { level: 1, title: "First Section", blocks: 1 } + * + * doc.findBy({'context': 'listing', 'style': 'source'}); + * // => { context: :listing, content_model: :verbatim, style: "source", lines: 1 } + * + * @memberof AbstractBlock + * @returns {Array} - returns a list of block-level nodes that match the filter or an empty list if no matches are found + */ +AbstractBlock.prototype.findBy = function (selector, block) { + if (typeof block === 'undefined' && typeof selector === 'function') { + return Opal.send(this, 'find_by', null, selector); + } + else if (typeof block === 'function') { + return Opal.send(this, 'find_by', [toHash(selector)], block); + } + else { + return this.$find_by(toHash(selector)); + } +}; + +/** + * Get the source line number where this block started. + * @memberof AbstractBlock + * @returns {number} - returns the source line number where this block started + */ +AbstractBlock.prototype.getLineNumber = function () { + var lineno = this.$lineno(); + return lineno === Opal.nil ? undefined : lineno; +}; + +/** + * Check whether this block has any child Section objects. + * Only applies to Document and Section instances. + * @memberof AbstractBlock + * @returns {boolean} - true if this block has child Section objects, otherwise false + */ +AbstractBlock.prototype.hasSections = function () { + return this['$sections?'](); +}; + +/** + * Get the Array of child Section objects. + * Only applies to Document and Section instances. + * @memberof AbstractBlock + * @returns {Array} - returns an {Array} of {@link Section} objects + */ +AbstractBlock.prototype.getSections = function () { + return this.$sections(); +}; + +/** + * Get the numeral of this block (if section, relative to parent, otherwise absolute). + * Only assigned to section if automatic section numbering is enabled. + * Only assigned to formal block (block with title) if corresponding caption attribute is present. + * If the section is an appendix, the numeral is a letter (starting with A). + * @memberof AbstractBlock + * @returns {string} - returns the numeral + */ +AbstractBlock.prototype.getNumeral = function () { + // number was renamed to numeral + // https://github.com/asciidoctor/asciidoctor/commit/33ac4821e0375bcd5aa189c394ad7630717bcd55 + return this.$number(); +}; + +/** + * Set the numeral of this block. + * @memberof AbstractBlock + */ +AbstractBlock.prototype.setNumeral = function (value) { + // number was renamed to numeral + // https://github.com/asciidoctor/asciidoctor/commit/33ac4821e0375bcd5aa189c394ad7630717bcd55 + return this['$number='](value); +}; + +/** + * A convenience method that checks whether the title of this block is defined. + * + * @returns a {boolean} indicating whether this block has a title. + * @memberof AbstractBlock + */ +AbstractBlock.prototype.hasTitle = function () { + return this['$title?'](); +}; + +// Section API + +/** + * @namespace + * @extends AbstractBlock + */ +var Section = Opal.Asciidoctor.Section; + +/** + * Get the 0-based index order of this section within the parent block. + * @memberof Section + * @returns {number} + */ +Section.prototype.getIndex = function () { + return this.index; +}; + +/** + * Set the 0-based index order of this section within the parent block. + * @memberof Section + */ +Section.prototype.setIndex = function (value) { + this.index = value; +}; + +/** + * Get the section name of this section. + * @memberof Section + * @returns {string} + */ +Section.prototype.getSectionName = function () { + return this.sectname; +}; + +/** + * Set the section name of this section. + * @memberof Section + */ +Section.prototype.setSectionName = function (value) { + this.sectname = value; +}; + +/** + * Get the flag to indicate whether this is a special section or a child of one. + * @memberof Section + * @returns {boolean} + */ +Section.prototype.isSpecial = function () { + return this.special; +}; + +/** + * Set the flag to indicate whether this is a special section or a child of one. + * @memberof Section + */ +Section.prototype.setSpecial = function (value) { + this.special = value; +}; + +/** + * Get the state of the numbered attribute at this section (need to preserve for creating TOC). + * @memberof Section + * @returns {boolean} + */ +Section.prototype.isNumbered = function () { + return this.numbered; +}; + +/** + * Get the caption for this section (only relevant for appendices). + * @memberof Section + * @returns {string} + */ +Section.prototype.getCaption = function () { + var value = this.caption; + return value === Opal.nil ? undefined : value; +}; + +/** + * Get the name of the Section (title) + * @memberof Section + * @returns {string} + * @see {@link AbstractBlock#getTitle} + */ +Section.prototype.getName = function () { + return this.getTitle(); +}; + +/** + * @namespace + */ +var Block = Opal.Asciidoctor.Block; + +/** + * Get the source of this block. + * @memberof Block + * @returns {string} - returns the String source of this block. + */ +Block.prototype.getSource = function () { + return this.$source(); +}; + +/** + * Get the source lines of this block. + * @memberof Block + * @returns {Array} - returns the String {Array} of source lines for this block. + */ +Block.prototype.getSourceLines = function () { + return this.lines; +}; + +// AbstractNode API + +/** + * @namespace + */ +var AbstractNode = Opal.Asciidoctor.AbstractNode; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.getNodeName = function () { + return this.node_name; +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.getAttributes = function () { + return fromHash(this.attributes); +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.getAttribute = function (name, defaultValue, inherit) { + var value = this.$attr(name, defaultValue, inherit); + return value === Opal.nil ? undefined : value; +}; + +/** + * Check whether the specified attribute is present on this node. + * + * @memberof AbstractNode + * @returns {boolean} - true if the attribute is present, otherwise false + */ +AbstractNode.prototype.hasAttribute = function (name) { + return name in this.attributes.$$smap; +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.isAttribute = function (name, expectedValue, inherit) { + var result = this['$attr?'](name, expectedValue, inherit); + return result === Opal.nil ? false : result; +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.setAttribute = function (name, value, overwrite) { + if (typeof overwrite === 'undefined') overwrite = true; + return this.$set_attr(name, value, overwrite); +}; + +/** + * Remove the attribute from the current node. + * @param {string} name - The String attribute name to remove + * @returns {string} - returns the previous {String} value, or undefined if the attribute was not present. + * @memberof AbstractNode + */ +AbstractNode.prototype.removeAttribute = function (name) { + var value = this.$remove_attr(name); + return value === Opal.nil ? undefined : value; +}; + +/** + * Get the {@link Document} to which this node belongs. + * + * @memberof AbstractNode + * @returns {Document} - returns the {@link Document} object to which this node belongs. + */ +AbstractNode.prototype.getDocument = function () { + return this.document; +}; + +/** + * Get the {@link AbstractNode} to which this node is attached. + * + * @memberof AbstractNode + * @returns {AbstractNode} - returns the {@link AbstractNode} object to which this node is attached, + * or undefined if this node has no parent. + */ +AbstractNode.prototype.getParent = function () { + var parent = this.parent; + return parent === Opal.nil ? undefined : parent; +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.isInline = function () { + return this['$inline?'](); +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.isBlock = function () { + return this['$block?'](); +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.isRole = function (expected) { + return this['$role?'](expected); +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.getRole = function () { + return this.$role(); +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.hasRole = function (name) { + return this['$has_role?'](name); +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.getRoles = function () { + return this.$roles(); +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.addRole = function (name) { + return this.$add_role(name); +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.removeRole = function (name) { + return this.$remove_role(name); +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.isReftext = function () { + return this['$reftext?'](); +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.getReftext = function () { + return this.$reftext(); +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.getContext = function () { + var context = this.context; + // Automatically convert Opal pseudo-symbol to String + return typeof context === 'string' ? context : context.toString(); +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.getId = function () { + var id = this.id; + return id === Opal.nil ? undefined : id; +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.isOption = function (name) { + return this['$option?'](name); +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.setOption = function (name) { + return this.$set_option(name); +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.getIconUri = function (name) { + return this.$icon_uri(name); +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.getMediaUri = function (target, assetDirKey) { + return this.$media_uri(target, assetDirKey); +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.getImageUri = function (targetImage, assetDirKey) { + return this.$image_uri(targetImage, assetDirKey); +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.getConverter = function () { + return this.$converter(); +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.readContents = function (target, options) { + return this.$read_contents(target, toHash(options)); +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.readAsset = function (path, options) { + return this.$read_asset(path, toHash(options)); +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.normalizeWebPath = function (target, start, preserveTargetUri) { + return this.$normalize_web_path(target, start, preserveTargetUri); +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.normalizeSystemPath = function (target, start, jail, options) { + return this.$normalize_system_path(target, start, jail, toHash(options)); +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.normalizeAssetPath = function (assetRef, assetName, autoCorrect) { + return this.$normalize_asset_path(assetRef, assetName, autoCorrect); +}; + +// Document API + +/** + * The {@link Document} class represents a parsed AsciiDoc document. + * + * Document is the root node of a parsed AsciiDoc document.
    + * It provides an abstract syntax tree (AST) that represents the structure of the AsciiDoc document + * from which the Document object was parsed. + * + * Although the constructor can be used to create an empty document object, + * more commonly, you'll load the document object from AsciiDoc source + * using the primary API methods on {@link Asciidoctor}. + * When using one of these APIs, you almost always want to set the safe mode to 'safe' (or 'unsafe') + * to enable all of Asciidoctor's features. + * + *
    + *   var doc = Asciidoctor.load('= Hello, AsciiDoc!', {'safe': 'safe'});
    + *   // => Asciidoctor::Document { doctype: "article", doctitle: "Hello, Asciidoc!", blocks: 0 }
    + * 
    + * + * Instances of this class can be used to extract information from the document or alter its structure. + * As such, the Document object is most often used in extensions and by integrations. + * + * The most basic usage of the Document object is to retrieve the document's title. + * + *
    + *  var source = '= Document Title';
    + *  var doc = asciidoctor.load(source, {'safe': 'safe'});
    + *  console.log(doc.getTitle()); // 'Document Title'
    + * 
    + * + * You can also use the Document object to access document attributes defined in the header, such as the author and doctype. + * @namespace + * @extends AbstractBlock + */ + +var Document = Opal.Asciidoctor.Document; + +/** + * Returns a JSON {Object} of ids captured by the processor. + * + * @returns {Object} - returns a JSON {Object} of ids in the document. + * @memberof Document + */ +Document.prototype.getIds = function () { + return fromHash(this.catalog.$$smap.ids); +}; + +/** + * Returns a JSON {Object} of references captured by the processor. + * + * @returns {Object} - returns a JSON {Object} of {AbstractNode} in the document. + * @memberof Document + */ +Document.prototype.getRefs = function () { + return fromHash(this.catalog.$$smap.refs); +}; + +/** + * Returns an {Array} of Document/ImageReference} captured by the processor. + * + * @returns {Array} - returns an {Array} of {Document/ImageReference} in the document. + * Will return an empty array if the option "catalog_assets: true" was not defined on the processor. + * @memberof Document + */ +Document.prototype.getImages = function () { + return this.catalog.$$smap.images; +}; + +/** + * Returns an {Array} of index terms captured by the processor. + * + * @returns {Array} - returns an {Array} of index terms in the document. + * Will return an empty array if the function was called before the document was converted. + * @memberof Document + */ +Document.prototype.getIndexTerms = function () { + return this.catalog.$$smap.indexterms; +}; + +/** + * Returns an {Array} of links captured by the processor. + * + * @returns {Array} - returns an {Array} of links in the document. + * Will return an empty array if: + * - the function was called before the document was converted + * - the option "catalog_assets: true" was not defined on the processor + * @memberof Document + */ +Document.prototype.getLinks = function () { + return this.catalog.$$smap.links; +}; + +/** + * @returns {boolean} - returns true if the document has footnotes otherwise false + * @memberof Document + */ +Document.prototype.hasFootnotes = function () { + return this['$footnotes?'](); +}; + +/** + * Returns an {Array} of {Document/Footnote} captured by the processor. + * + * @returns {Array} - returns an {Array} of {Document/Footnote} in the document. + * Will return an empty array if the function was called before the document was converted. + * @memberof Document + */ +Document.prototype.getFootnotes = function () { + return this.$footnotes(); +}; + +/** + * @returns {string} - returns the level-0 section + * @memberof Document + */ +Document.prototype.getHeader = function () { + return this.header; +}; + +/** + * @memberof Document + */ +Document.prototype.setAttribute = function (name, value) { + return this.$set_attribute(name, value); +}; + +/** + + * @memberof Document + */ +Document.prototype.removeAttribute = function (name) { + this.attributes.$delete(name); + this.attribute_overrides.$delete(name); +}; + +/** + * @memberof Document + */ +Document.prototype.convert = function (options) { + var result = this.$convert(toHash(options)); + return result === Opal.nil ? '' : result; +}; + +/** + * @memberof Document + */ +Document.prototype.write = function (output, target) { + return this.$write(output, target); +}; + +/** + * @returns {string} - returns the full name of the author as a String + * @memberof Document + */ +Document.prototype.getAuthor = function () { + return this.$author(); +}; + +/** + * @memberof Document + */ +Document.prototype.getSource = function () { + return this.$source(); +}; + +/** + * @memberof Document + */ +Document.prototype.getSourceLines = function () { + return this.$source_lines(); +}; + +/** + * @memberof Document + */ +Document.prototype.isNested = function () { + return this['$nested?'](); +}; + +/** + * @memberof Document + */ +Document.prototype.isEmbedded = function () { + return this['$embedded?'](); +}; + +/** + * @memberof Document + */ +Document.prototype.hasExtensions = function () { + return this['$extensions?'](); +}; + +/** + * @memberof Document + */ +Document.prototype.getDoctype = function () { + return this.doctype; +}; + +/** + * @memberof Document + */ +Document.prototype.getBackend = function () { + return this.backend; +}; + +/** + * @memberof Document + */ +Document.prototype.isBasebackend = function (base) { + return this['$basebackend?'](base); +}; + +/** + * Get the title explicitly defined in the document attributes. + * @returns {string} + * @see {@link AbstractNode#getAttributes} + * @memberof Document + */ +Document.prototype.getTitle = function () { + var title = this.$title(); + return title === Opal.nil ? undefined : title; +}; + +/** + * @memberof Document + */ +Document.prototype.setTitle = function (title) { + return this['$title='](title); +}; + +/** + * @memberof Document + * @returns {Document/Title} - returns a {@link Document/Title} + */ +Document.prototype.getDocumentTitle = function (options) { + var doctitle = this.$doctitle(toHash(options)); + return doctitle === Opal.nil ? undefined : doctitle; +}; + +/** + * @memberof Document + * @see {@link Document#getDocumentTitle} + */ +Document.prototype.getDoctitle = Document.prototype.getDocumentTitle; + +/** + * Get the document catalog Hash. + * @memberof Document + */ +Document.prototype.getCatalog = function () { + return fromHash(this.catalog); +}; + +/** + * @memberof Document + */ +Document.prototype.getReferences = Document.prototype.getCatalog; + +/** + * Get the document revision date from document header (document attribute revdate). + * @memberof Document + */ +Document.prototype.getRevisionDate = function () { + return this.getAttribute('revdate'); +}; + +/** + * @memberof Document + * @see Document#getRevisionDate + */ +Document.prototype.getRevdate = function () { + return this.getRevisionDate(); +}; + +/** + * Get the document revision number from document header (document attribute revnumber). + * @memberof Document + */ +Document.prototype.getRevisionNumber = function () { + return this.getAttribute('revnumber'); +}; + +/** + * Get the document revision remark from document header (document attribute revremark). + * @memberof Document + */ +Document.prototype.getRevisionRemark = function () { + return this.getAttribute('revremark'); +}; + + +/** + * Assign a value to the specified attribute in the document header. + * + * The assignment will be visible when the header attributes are restored, + * typically between processor phases (e.g., between parse and convert). + * + * @param {string} name - The {string} attribute name to assign + * @param {Object} value - The {Object} value to assign to the attribute (default: '') + * @param {boolean} overwrite - A {boolean} indicating whether to assign the attribute + * if already present in the attributes Hash (default: true) + * + * @memberof Document + * @returns {boolean} - returns true if the assignment was performed otherwise false + */ +Document.prototype.setHeaderAttribute = function (name, value, overwrite) { + if (typeof overwrite === 'undefined') overwrite = true; + if (typeof value === 'undefined') value = ''; + return this.$set_header_attribute(name, value, overwrite); +}; + +/** + * Convenience method to retrieve the authors of this document as an {Array} of {Document/Author} objects. + * + * This method is backed by the author-related attributes on the document. + * + * @memberof Document + * @returns {Array} - returns an {Array} of {Document/Author} objects. + */ +Document.prototype.getAuthors = function () { + return this.$authors(); +}; + +// Document.Footnote API + +/** + * @namespace + * @module Document/Footnote + */ +var Footnote = Document.Footnote; + +/** + * @memberof Document/Footnote + * @returns {number} - returns the footnote's index + */ +Footnote.prototype.getIndex = function () { + var index = this.$$data.index; + return index === Opal.nil ? undefined : index; +}; + +/** + * @memberof Document/Footnote + * @returns {string} - returns the footnote's id + */ +Footnote.prototype.getId = function () { + var id = this.$$data.id; + return id === Opal.nil ? undefined : id; +}; + +/** + * @memberof Document/Footnote + * @returns {string} - returns the footnote's text + */ +Footnote.prototype.getText = function () { + var text = this.$$data.text; + return text === Opal.nil ? undefined : text; +}; + +// Document.ImageReference API + +/** + * @namespace + * @module Document/ImageReference + */ +var ImageReference = Document.ImageReference; + +/** + * @memberof Document/ImageReference + * @returns {string} - returns the image's target + */ +ImageReference.prototype.getTarget = function () { + return this.$$data.target; +}; + +/** + * @memberof Document/ImageReference + * @returns {string} - returns the image's directory (imagesdir attribute) + */ +ImageReference.prototype.getImagesDirectory = function () { + var value = this.$$data.imagesdir; + return value === Opal.nil ? undefined : value; +}; + +// Document.Author API + +/** + * @namespace + * @module Document/Author + */ +var Author = Document.Author; + +/** + * @memberof Document/Author + * @returns {string} - returns the author's full name + */ +Author.prototype.getName = function () { + var name = this.$$data.name; + return name === Opal.nil ? undefined : name; +}; + +/** + * @memberof Document/Author + * @returns {string} - returns the author's first name + */ +Author.prototype.getFirstName = function () { + var firstName = this.$$data.firstname; + return firstName === Opal.nil ? undefined : firstName; +}; + +/** + * @memberof Document/Author + * @returns {string} - returns the author's middle name (or undefined if the author has no middle name) + */ +Author.prototype.getMiddleName = function () { + var middleName = this.$$data.middlename; + return middleName === Opal.nil ? undefined : middleName; +}; + +/** + * @memberof Document/Author + * @returns {string} - returns the author's last name + */ +Author.prototype.getLastName = function () { + var lastName = this.$$data.lastname; + return lastName === Opal.nil ? undefined : lastName; +}; + +/** + * @memberof Document/Author + * @returns {string} - returns the author's initials (by default based on the author's name) + */ +Author.prototype.getInitials = function () { + var initials = this.$$data.initials; + return initials === Opal.nil ? undefined : initials; +}; + +/** + * @memberof Document/Author + * @returns {string} - returns the author's email + */ +Author.prototype.getEmail = function () { + var email = this.$$data.email; + return email === Opal.nil ? undefined : email; +}; + +// private constructor +Document.RevisionInfo = function (date, number, remark) { + this.date = date; + this.number = number; + this.remark = remark; +}; + +/** + * @class + * @namespace + * @module Document/RevisionInfo + */ +var RevisionInfo = Document.RevisionInfo; + +/** + * Get the document revision date from document header (document attribute revdate). + * @memberof Document/RevisionInfo + */ +RevisionInfo.prototype.getDate = function () { + return this.date; +}; + +/** + * Get the document revision number from document header (document attribute revnumber). + * @memberof Document/RevisionInfo + */ +RevisionInfo.prototype.getNumber = function () { + return this.number; +}; + +/** + * Get the document revision remark from document header (document attribute revremark). + * A short summary of changes in this document revision. + * @memberof Document/RevisionInfo + */ +RevisionInfo.prototype.getRemark = function () { + return this.remark; +}; + +/** + * @memberof Document/RevisionInfo + * @returns {boolean} - returns true if the revision info is empty (ie. not defined), otherwise false + */ +RevisionInfo.prototype.isEmpty = function () { + return this.date === undefined && this.number === undefined && this.remark === undefined; +}; + +/** + * @memberof Document + * @returns {Document/RevisionInfo} - returns a {@link Document/RevisionInfo} + */ +Document.prototype.getRevisionInfo = function () { + return new Document.RevisionInfo(this.getRevisionDate(), this.getRevisionNumber(), this.getRevisionRemark()); +}; + +/** + * @memberof Document + * @returns {boolean} - returns true if the document contains revision info, otherwise false + */ +Document.prototype.hasRevisionInfo = function () { + var revisionInfo = this.getRevisionInfo(); + return !revisionInfo.isEmpty(); +}; + +/** + * @memberof Document + */ +Document.prototype.getNotitle = function () { + return this.$notitle(); +}; + +/** + * @memberof Document + */ +Document.prototype.getNoheader = function () { + return this.$noheader(); +}; + +/** + * @memberof Document + */ +Document.prototype.getNofooter = function () { + return this.$nofooter(); +}; + +/** + * @memberof Document + */ +Document.prototype.hasHeader = function () { + return this['$header?'](); +}; + +/** + * @memberof Document + */ +Document.prototype.deleteAttribute = function (name) { + return this.$delete_attribute(name); +}; + +/** + * @memberof Document + */ +Document.prototype.isAttributeLocked = function (name) { + return this['$attribute_locked?'](name); +}; + +/** + * @memberof Document + */ +Document.prototype.parse = function (data) { + return this.$parse(data); +}; + +/** + * @memberof Document + */ +Document.prototype.getDocinfo = function (docinfoLocation, suffix) { + return this.$docinfo(docinfoLocation, suffix); +}; + +/** + * @memberof Document + */ +Document.prototype.hasDocinfoProcessors = function (docinfoLocation) { + return this['$docinfo_processors?'](docinfoLocation); +}; + +/** + * @memberof Document + */ +Document.prototype.counterIncrement = function (counterName, block) { + return this.$counter_increment(counterName, block); +}; + +/** + * @memberof Document + */ +Document.prototype.counter = function (name, seed) { + return this.$counter(name, seed); +}; + +/** + * @memberof Document + */ +Document.prototype.getSafe = function () { + return this.safe; +}; + +/** + * @memberof Document + */ +Document.prototype.getCompatMode = function () { + return this.compat_mode; +}; + +/** + * @memberof Document + */ +Document.prototype.getSourcemap = function () { + return this.sourcemap; +}; + +/** + * @memberof Document + */ +Document.prototype.getCounters = function () { + return fromHash(this.counters); +}; + +/** + * @memberof Document + */ +Document.prototype.getCallouts = function () { + return this.$callouts(); +}; + +/** + * @memberof Document + */ +Document.prototype.getBaseDir = function () { + return this.base_dir; +}; + +/** + * @memberof Document + */ +Document.prototype.getOptions = function () { + return fromHash(this.options); +}; + +/** + * @memberof Document + */ +Document.prototype.getOutfilesuffix = function () { + return this.outfilesuffix; +}; + +/** + * @memberof Document + */ +Document.prototype.getParentDocument = function () { + return this.parent_document; +}; + +/** + * @memberof Document + */ +Document.prototype.getReader = function () { + return this.reader; +}; + +/** + * @memberof Document + */ +Document.prototype.getConverter = function () { + return this.converter; +}; + +/** + * @memberof Document + */ +Document.prototype.getExtensions = function () { + return this.extensions; +}; + +// Document.Title API + +/** + * @namespace + * @module Document/Title + */ +var Title = Document.Title; + +/** + * @memberof Document/Title + */ +Title.prototype.getMain = function () { + return this.main; +}; + +/** + * @memberof Document/Title + */ +Title.prototype.getCombined = function () { + return this.combined; +}; + +/** + * @memberof Document/Title + */ +Title.prototype.getSubtitle = function () { + var subtitle = this.subtitle; + return subtitle === Opal.nil ? undefined : subtitle; +}; + +/** + * @memberof Document/Title + */ +Title.prototype.isSanitized = function () { + var sanitized = this['$sanitized?'](); + return sanitized === Opal.nil ? false : sanitized; +}; + +/** + * @memberof Document/Title + */ +Title.prototype.hasSubtitle = function () { + return this['$subtitle?'](); +}; + +// Inline API + +/** + * @namespace + * @extends AbstractNode + */ +var Inline = Opal.Asciidoctor.Inline; + +/** + * Create a new Inline element. + * + * @memberof Inline + * @returns {Inline} - returns a new Inline element + */ +Opal.Asciidoctor.Inline['$$class'].prototype.create = function (parent, context, text, opts) { + return this.$new(parent, context, text, toHash(opts)); +}; + +/** + * Get the converted content for this inline node. + * + * @memberof Inline + * @returns {string} - returns the converted String content for this inline node + */ +Inline.prototype.convert = function () { + return this.$convert(); +}; + +/** + * Get the converted String text of this Inline node, if applicable. + * + * @memberof Inline + * @returns {string} - returns the converted String text for this Inline node, or undefined if not applicable for this node. + */ +Inline.prototype.getText = function () { + var text = this.$text(); + return text === Opal.nil ? undefined : text; +}; + +/** + * Get the String sub-type (aka qualifier) of this Inline node. + * + * This value is used to distinguish different variations of the same node + * category, such as different types of anchors. + * + * @memberof Inline + * @returns {string} - returns the string sub-type of this Inline node. + */ +Inline.prototype.getType = function () { + return this.$type(); +}; + +/** + * Get the primary String target of this Inline node. + * + * @memberof Inline + * @returns {string} - returns the string target of this Inline node. + */ +Inline.prototype.getTarget = function () { + var target = this.$target(); + return target === Opal.nil ? undefined : target; +}; + +// List API + +/** @namespace */ +var List = Opal.Asciidoctor.List; + +/** + * Get the Array of {@link ListItem} nodes for this {@link List}. + * + * @memberof List + * @returns {Array} - returns an Array of {@link ListItem} nodes. + */ +List.prototype.getItems = function () { + return this.blocks; +}; + +// ListItem API + +/** @namespace */ +var ListItem = Opal.Asciidoctor.ListItem; + +/** + * Get the converted String text of this ListItem node. + * + * @memberof ListItem + * @returns {string} - returns the converted String text for this ListItem node. + */ +ListItem.prototype.getText = function () { + return this.$text(); +}; + +/** + * Set the String source text of this ListItem node. + * + * @memberof ListItem + */ +ListItem.prototype.setText = function (text) { + return this.text = text; +}; + +// Reader API + +/** @namespace */ +var Reader = Opal.Asciidoctor.Reader; + +/** + * @memberof Reader + */ +Reader.prototype.pushInclude = function (data, file, path, lineno, attributes) { + return this.$push_include(data, file, path, lineno, toHash(attributes)); +}; + +/** + * Get the current location of the reader's cursor, which encapsulates the + * file, dir, path, and lineno of the file being read. + * + * @memberof Reader + */ +Reader.prototype.getCursor = function () { + return this.$cursor(); +}; + +/** + * Get a copy of the remaining {Array} of String lines managed by this Reader. + * + * @memberof Reader + * @returns {Array} - returns A copy of the String {Array} of lines remaining in this Reader. + */ +Reader.prototype.getLines = function () { + return this.$lines(); +}; + +/** + * Get the remaining lines managed by this Reader as a String. + * + * @memberof Reader + * @returns {string} - returns The remaining lines managed by this Reader as a String (joined by linefeed characters). + */ +Reader.prototype.getString = function () { + return this.$string(); +}; + +// Cursor API + +/** @namespace */ +var Cursor = Opal.Asciidoctor.Reader.Cursor; + +/** + * Get the file associated to the cursor. + * @memberof Cursor + */ +Cursor.prototype.getFile = function () { + var file = this.file; + return file === Opal.nil ? undefined : file; +}; + +/** + * Get the directory associated to the cursor. + * @memberof Cursor + * @returns {string} - returns the directory associated to the cursor + */ +Cursor.prototype.getDirectory = function () { + var dir = this.dir; + return dir === Opal.nil ? undefined : dir; +}; + +/** + * Get the path associated to the cursor. + * @memberof Cursor + * @returns {string} - returns the path associated to the cursor (or '') + */ +Cursor.prototype.getPath = function () { + var path = this.path; + return path === Opal.nil ? undefined : path; +}; + +/** + * Get the line number of the cursor. + * @memberof Cursor + * @returns {number} - returns the line number of the cursor + */ +Cursor.prototype.getLineNumber = function () { + return this.lineno; +}; + +// Logger API (available in Asciidoctor 1.5.7+) + +function initializeLoggerFormatterClass (className, functions) { + var superclass = Opal.const_get_qualified(Opal.Logger, 'Formatter'); + return initializeClass(superclass, className, functions, {}, { + 'call': function (args) { + for (var i = 0; i < args.length; i++) { + // convert all (Opal) Hash arguments to JSON. + if (typeof args[i] === 'object' && '$$smap' in args[i]) { + args[i] = fromHash(args[i]); + } + } + return args; + } + }); +} + +function initializeLoggerClass (className, functions) { + var superClass = Opal.const_get_qualified(Opal.Asciidoctor, 'Logger'); + return initializeClass(superClass, className, functions, {}, { + 'add': function (args) { + if (args.length >= 2 && typeof args[2] === 'object' && '$$smap' in args[2]) { + var message = args[2]; + var messageObject = fromHash(message); + messageObject.getText = function () { + return this['text']; + }; + messageObject.getSourceLocation = function () { + return this['source_location']; + }; + messageObject['$inspect'] = function () { + var sourceLocation = this.getSourceLocation(); + if (sourceLocation) { + return sourceLocation.getPath() + ': line ' + sourceLocation.getLineNumber() + ': ' + this.getText(); + } else { + return this.getText(); + } + }; + args[2] = messageObject; + } + return args; + } + }); +} + +/** + * @namespace + */ +var LoggerManager = Opal.const_get_qualified(Opal.Asciidoctor, 'LoggerManager', true); + +// Alias +Opal.Asciidoctor.LoggerManager = LoggerManager; + +if (LoggerManager) { + LoggerManager.getLogger = function () { + return this.$logger(); + }; + + LoggerManager.setLogger = function (logger) { + this.logger = logger; + }; + + LoggerManager.newLogger = function (name, functions) { + return initializeLoggerClass(name, functions).$new(); + }; + + LoggerManager.newFormatter = function (name, functions) { + return initializeLoggerFormatterClass(name, functions).$new(); + }; +} + +/** + * @namespace + */ +var LoggerSeverity = Opal.const_get_qualified(Opal.Logger, 'Severity', true); + +// Alias +Opal.Asciidoctor.LoggerSeverity = LoggerSeverity; + +if (LoggerSeverity) { + LoggerSeverity.get = function (severity) { + return LoggerSeverity.$constants()[severity]; + }; +} + +/** + * @namespace + */ +var LoggerFormatter = Opal.const_get_qualified(Opal.Logger, 'Formatter', true); + + +// Alias +Opal.Asciidoctor.LoggerFormatter = LoggerFormatter; + +if (LoggerFormatter) { + LoggerFormatter.prototype.call = function (severity, time, programName, message) { + return this.$call(LoggerSeverity.get(severity), time, programName, message); + }; +} + +/** + * @namespace + */ +var MemoryLogger = Opal.const_get_qualified(Opal.Asciidoctor, 'MemoryLogger', true); + +// Alias +Opal.Asciidoctor.MemoryLogger = MemoryLogger; + +if (MemoryLogger) { + MemoryLogger.prototype.getMessages = function () { + var messages = this.messages; + var result = []; + for (var i = 0; i < messages.length; i++) { + var message = messages[i]; + var messageObject = fromHash(message); + if (typeof messageObject.message === 'string') { + messageObject.getText = function () { + return this.message; + }; + } else { + // also convert the message attribute + messageObject.message = fromHash(messageObject.message); + messageObject.getText = function () { + return this.message['text']; + }; + } + messageObject.getSeverity = function () { + return this.severity.toString(); + }; + messageObject.getSourceLocation = function () { + return this.message['source_location']; + }; + result.push(messageObject); + } + return result; + }; +} + +/** + * @namespace + */ +var Logger = Opal.const_get_qualified(Opal.Asciidoctor, 'Logger', true); + +// Alias +Opal.Asciidoctor.Logger = Logger; + +if (Logger) { + Logger.prototype.getMaxSeverity = function () { + return this.max_severity; + }; + Logger.prototype.getFormatter = function () { + return this.formatter; + }; + Logger.prototype.setFormatter = function (formatter) { + return this.formatter = formatter; + }; + Logger.prototype.getLevel = function () { + return this.level; + }; + Logger.prototype.setLevel = function (level) { + return this.level = level; + }; + Logger.prototype.getProgramName = function () { + return this.progname; + }; + Logger.prototype.setProgramName = function (programName) { + return this.progname = programName; + }; +} + +/** + * @namespace + */ +var NullLogger = Opal.const_get_qualified(Opal.Asciidoctor, 'NullLogger', true); + +// Alias +Opal.Asciidoctor.NullLogger = NullLogger; + + +if (NullLogger) { + NullLogger.prototype.getMaxSeverity = function () { + return this.max_severity; + }; +} + + +// Alias +Opal.Asciidoctor.StopIteration = Opal.StopIteration; + +// Extensions API + +/** + * @private + */ +var toBlock = function (block) { + // arity is a mandatory field + block.$$arity = block.length; + return block; +}; + +var registerExtension = function (registry, type, processor, name) { + if (typeof processor === 'object' || processor.$$is_class) { + // processor is an instance or a class + return registry['$' + type](processor, name); + } else { + // processor is a function/lambda + return Opal.send(registry, type, name && [name], toBlock(processor)); + } +}; + +/** + * @namespace + * @description + * Extensions provide a way to participate in the parsing and converting + * phases of the AsciiDoc processor or extend the AsciiDoc syntax. + * + * The various extensions participate in AsciiDoc processing as follows: + * + * 1. After the source lines are normalized, {{@link Extensions/Preprocessor}}s modify or replace + * the source lines before parsing begins. {{@link Extensions/IncludeProcessor}}s are used to + * process include directives for targets which they claim to handle. + * 2. The Parser parses the block-level content into an abstract syntax tree. + * Custom blocks and block macros are processed by associated {{@link Extensions/BlockProcessor}}s + * and {{@link Extensions/BlockMacroProcessor}}s, respectively. + * 3. {{@link Extensions/TreeProcessor}}s are run on the abstract syntax tree. + * 4. Conversion of the document begins, at which point inline markup is processed + * and converted. Custom inline macros are processed by associated {InlineMacroProcessor}s. + * 5. {{@link Extensions/Postprocessor}}s modify or replace the converted document. + * 6. The output is written to the output stream. + * + * Extensions may be registered globally using the {Extensions.register} method + * or added to a custom {Registry} instance and passed as an option to a single + * Asciidoctor processor. + * + * @example + * Opal.Asciidoctor.Extensions.register(function () { + * this.block(function () { + * var self = this; + * self.named('shout'); + * self.onContext('paragraph'); + * self.process(function (parent, reader) { + * var lines = reader.getLines().map(function (l) { return l.toUpperCase(); }); + * return self.createBlock(parent, 'paragraph', lines); + * }); + * }); + * }); + */ +var Extensions = Opal.const_get_qualified(Opal.Asciidoctor, 'Extensions'); + +// Alias +Opal.Asciidoctor.Extensions = Extensions; + +/** + * Create a new {@link Extensions/Registry}. + * @param {string} name + * @param {function} block + * @memberof Extensions + * @returns {Extensions/Registry} - returns a {@link Extensions/Registry} + */ +Extensions.create = function (name, block) { + if (typeof name === 'function' && typeof block === 'undefined') { + return Opal.send(this, 'build_registry', null, toBlock(name)); + } else if (typeof block === 'function') { + return Opal.send(this, 'build_registry', [name], toBlock(block)); + } else { + return this.$build_registry(); + } +}; + +/** + * @memberof Extensions + */ +Extensions.register = function (name, block) { + if (typeof name === 'function' && typeof block === 'undefined') { + return Opal.send(this, 'register', null, toBlock(name)); + } else { + return Opal.send(this, 'register', [name], toBlock(block)); + } +}; + +/** + * Get statically-registerd extension groups. + * @memberof Extensions + */ +Extensions.getGroups = function () { + return fromHash(this.$groups()); +}; + +/** + * Unregister all statically-registered extension groups. + * @memberof Extensions + */ +Extensions.unregisterAll = function () { + this.$unregister_all(); +}; + +/** + * Unregister the specified statically-registered extension groups. + * + * NOTE Opal cannot delete an entry from a Hash that is indexed by symbol, so + * we have to resort to using low-level operations in this method. + * + * @memberof Extensions + */ +Extensions.unregister = function () { + var names = Array.prototype.concat.apply([], arguments); + var groups = this.$groups(); + var groupNameIdx = {}; + for (var i = 0, groupSymbolNames = groups.$$keys; i < groupSymbolNames.length; i++) { + var groupSymbolName = groupSymbolNames[i]; + groupNameIdx[groupSymbolName.toString()] = groupSymbolName; + } + for (var j = 0; j < names.length; j++) { + var groupStringName = names[j]; + if (groupStringName in groupNameIdx) Opal.hash_delete(groups, groupNameIdx[groupStringName]); + } +}; + +/** + * @namespace + * @module Extensions/Registry + */ +var Registry = Extensions.Registry; + +/** + * @memberof Extensions/Registry + */ +Registry.prototype.getGroups = Extensions.getGroups; + +/** + * @memberof Extensions/Registry + */ +Registry.prototype.unregisterAll = function () { + this.groups = Opal.hash(); +}; + +/** + * @memberof Extensions/Registry + */ +Registry.prototype.unregister = Extensions.unregister; + +/** + * @memberof Extensions/Registry + */ +Registry.prototype.prefer = function (name, processor) { + if (arguments.length === 1) { + processor = name; + name = null; + } + if (typeof processor === 'object' || processor.$$is_class) { + // processor is an instance or a class + return this['$prefer'](name, processor); + } else { + // processor is a function/lambda + return Opal.send(this, 'prefer', name && [name], toBlock(processor)); + } +}; + +/** + * @memberof Extensions/Registry + */ +Registry.prototype.block = function (name, processor) { + if (arguments.length === 1) { + processor = name; + name = null; + } + return registerExtension(this, 'block', processor, name); +}; + +/** + * @memberof Extensions/Registry + */ +Registry.prototype.inlineMacro = function (name, processor) { + if (arguments.length === 1) { + processor = name; + name = null; + } + return registerExtension(this, 'inline_macro', processor, name); +}; + +/** + * @memberof Extensions/Registry + */ +Registry.prototype.includeProcessor = function (name, processor) { + if (arguments.length === 1) { + processor = name; + name = null; + } + return registerExtension(this, 'include_processor', processor, name); +}; + +/** + * @memberof Extensions/Registry + */ +Registry.prototype.blockMacro = function (name, processor) { + if (arguments.length === 1) { + processor = name; + name = null; + } + return registerExtension(this, 'block_macro', processor, name); +}; + +/** + * @memberof Extensions/Registry + */ +Registry.prototype.treeProcessor = function (name, processor) { + if (arguments.length === 1) { + processor = name; + name = null; + } + return registerExtension(this, 'tree_processor', processor, name); +}; + +/** + * @memberof Extensions/Registry + */ +Registry.prototype.postprocessor = function (name, processor) { + if (arguments.length === 1) { + processor = name; + name = null; + } + return registerExtension(this, 'postprocessor', processor, name); +}; + +/** + * @memberof Extensions/Registry + */ +Registry.prototype.preprocessor = function (name, processor) { + if (arguments.length === 1) { + processor = name; + name = null; + } + return registerExtension(this, 'preprocessor', processor, name); +}; + +/** + * @memberof Extensions/Registry + */ + +Registry.prototype.docinfoProcessor = function (name, processor) { + if (arguments.length === 1) { + processor = name; + name = null; + } + return registerExtension(this, 'docinfo_processor', processor, name); +}; + +/** + * @namespace + * @module Extensions/Processor + */ +var Processor = Extensions.Processor; + +/** + * The extension will be added to the beginning of the list for that extension type. (default is append). + * @memberof Extensions/Processor + * @deprecated Please use the prefer function on the {@link Extensions/Registry}, + * the {@link Extensions/IncludeProcessor}, + * the {@link Extensions/TreeProcessor}, + * the {@link Extensions/Postprocessor}, + * the {@link Extensions/Preprocessor} + * or the {@link Extensions/DocinfoProcessor} + */ +Processor.prototype.prepend = function () { + this.$option('position', '>>'); +}; + +/** + * @memberof Extensions/Processor + */ +Processor.prototype.process = function (block) { + var handler = { + apply: function (target, thisArg, argumentsList) { + for (var i = 0; i < argumentsList.length; i++) { + // convert all (Opal) Hash arguments to JSON. + if (typeof argumentsList[i] === 'object' && '$$smap' in argumentsList[i]) { + argumentsList[i] = fromHash(argumentsList[i]); + } + } + return target.apply(thisArg, argumentsList); + } + }; + var blockProxy = new Proxy(block, handler); + return Opal.send(this, 'process', null, toBlock(blockProxy)); +}; + +/** + * @memberof Extensions/Processor + */ +Processor.prototype.named = function (name) { + return this.$named(name); +}; + +/** + * @memberof Extensions/Processor + */ +Processor.prototype.createBlock = function (parent, context, source, attrs, opts) { + return this.$create_block(parent, context, source, toHash(attrs), toHash(opts)); +}; + +/** + * Creates a list block node and links it to the specified parent. + * + * @param parent - The parent Block (Block, Section, or Document) of this new list block. + * @param {string} context - The list context (e.g., ulist, olist, colist, dlist) + * @param {Object} attrs - An object of attributes to set on this list block + * + * @memberof Extensions/Processor + */ +Processor.prototype.createList = function (parent, context, attrs) { + return this.$create_list(parent, context, toHash(attrs)); +}; + +/** + * Creates a list item node and links it to the specified parent. + * + * @param parent - The parent List of this new list item block. + * @param {string} text - The text of the list item. + * + * @memberof Extensions/Processor + */ +Processor.prototype.createListItem = function (parent, text) { + return this.$create_list_item(parent, text); +}; + +/** + * @memberof Extensions/Processor + */ +Processor.prototype.createImageBlock = function (parent, attrs, opts) { + return this.$create_image_block(parent, toHash(attrs), toHash(opts)); +}; + +/** + * @memberof Extensions/Processor + */ +Processor.prototype.createInline = function (parent, context, text, opts) { + if (opts && opts.attributes) { + opts.attributes = toHash(opts.attributes); + } + return this.$create_inline(parent, context, text, toHash(opts)); +}; + +/** + * @memberof Extensions/Processor + */ +Processor.prototype.parseContent = function (parent, content, attrs) { + return this.$parse_content(parent, content, attrs); +}; + +/** + * @memberof Extensions/Processor + */ +Processor.prototype.positionalAttributes = function (value) { + return this.$positional_attrs(value); +}; + +/** + * @memberof Extensions/Processor + */ +Processor.prototype.resolvesAttributes = function (args) { + return this.$resolves_attributes(args); +}; + +/** + * @namespace + * @module Extensions/BlockProcessor + */ +var BlockProcessor = Extensions.BlockProcessor; + +/** + * @memberof Extensions/BlockProcessor + */ +BlockProcessor.prototype.onContext = function (context) { + return this.$on_context(context); +}; + +/** + * @memberof Extensions/BlockProcessor + */ +BlockProcessor.prototype.onContexts = function () { + return this.$on_contexts(Array.prototype.slice.call(arguments)); +}; + +/** + * @memberof Extensions/BlockProcessor + */ +BlockProcessor.prototype.getName = function () { + var name = this.name; + return name === Opal.nil ? undefined : name; +}; + +/** + * @namespace + * @module Extensions/BlockMacroProcessor + */ +var BlockMacroProcessor = Extensions.BlockMacroProcessor; + +/** + * @memberof Extensions/BlockMacroProcessor + */ +BlockMacroProcessor.prototype.getName = function () { + var name = this.name; + return name === Opal.nil ? undefined : name; +}; + +/** + * @namespace + * @module Extensions/InlineMacroProcessor + */ +var InlineMacroProcessor = Extensions.InlineMacroProcessor; + +/** + * @memberof Extensions/InlineMacroProcessor + */ +InlineMacroProcessor.prototype.getName = function () { + var name = this.name; + return name === Opal.nil ? undefined : name; +}; + +/** + * @namespace + * @module Extensions/IncludeProcessor + */ +var IncludeProcessor = Extensions.IncludeProcessor; + +/** + * @memberof Extensions/IncludeProcessor + */ +IncludeProcessor.prototype.handles = function (block) { + return Opal.send(this, 'handles?', null, toBlock(block)); +}; + +/** + * @memberof Extensions/IncludeProcessor + */ +IncludeProcessor.prototype.prefer = function () { + this.$prefer(); +}; + +/** + * @namespace + * @module Extensions/TreeProcessor + */ +// eslint-disable-next-line no-unused-vars +var TreeProcessor = Extensions.TreeProcessor; + +/** + * @memberof Extensions/TreeProcessor + */ +TreeProcessor.prototype.prefer = function () { + this.$prefer(); +}; + +/** + * @namespace + * @module Extensions/Postprocessor + */ +// eslint-disable-next-line no-unused-vars +var Postprocessor = Extensions.Postprocessor; + +/** + * @memberof Extensions/Postprocessor + */ +Postprocessor.prototype.prefer = function () { + this.$prefer(); +}; + +/** + * @namespace + * @module Extensions/Preprocessor + */ +// eslint-disable-next-line no-unused-vars +var Preprocessor = Extensions.Preprocessor; + +/** + * @memberof Extensions/Preprocessor + */ +Preprocessor.prototype.prefer = function () { + this.$prefer(); +}; + +/** + * @namespace + * @module Extensions/DocinfoProcessor + */ +var DocinfoProcessor = Extensions.DocinfoProcessor; + +/** + * @memberof Extensions/DocinfoProcessor + */ +DocinfoProcessor.prototype.prefer = function () { + this.$prefer(); +}; + +/** + * @memberof Extensions/DocinfoProcessor + */ +DocinfoProcessor.prototype.atLocation = function (value) { + this.$at_location(value); +}; + +function initializeProcessorClass (superclassName, className, functions) { + var superClass = Opal.const_get_qualified(Extensions, superclassName); + return initializeClass(superClass, className, functions, { + 'handles?': function () { + return true; + } + }); +} + +// Postprocessor + +/** + * Create a postprocessor + * @description this API is experimental and subject to change + * @memberof Extensions + */ +Extensions.createPostprocessor = function (name, functions) { + if (arguments.length === 1) { + functions = name; + name = null; + } + return initializeProcessorClass('Postprocessor', name, functions); +}; + +/** + * Create and instantiate a postprocessor + * @description this API is experimental and subject to change + * @memberof Extensions + */ +Extensions.newPostprocessor = function (name, functions) { + if (arguments.length === 1) { + functions = name; + name = null; + } + return this.createPostprocessor(name, functions).$new(); +}; + +// Preprocessor + +/** + * Create a preprocessor + * @description this API is experimental and subject to change + * @memberof Extensions + */ +Extensions.createPreprocessor = function (name, functions) { + if (arguments.length === 1) { + functions = name; + name = null; + } + return initializeProcessorClass('Preprocessor', name, functions); +}; + +/** + * Create and instantiate a preprocessor + * @description this API is experimental and subject to change + * @memberof Extensions + */ +Extensions.newPreprocessor = function (name, functions) { + if (arguments.length === 1) { + functions = name; + name = null; + } + return this.createPreprocessor(name, functions).$new(); +}; + +// Tree Processor + +/** + * Create a tree processor + * @description this API is experimental and subject to change + * @memberof Extensions + */ +Extensions.createTreeProcessor = function (name, functions) { + if (arguments.length === 1) { + functions = name; + name = null; + } + return initializeProcessorClass('TreeProcessor', name, functions); +}; + +/** + * Create and instantiate a tree processor + * @description this API is experimental and subject to change + * @memberof Extensions + */ +Extensions.newTreeProcessor = function (name, functions) { + if (arguments.length === 1) { + functions = name; + name = null; + } + return this.createTreeProcessor(name, functions).$new(); +}; + +// Include Processor + +/** + * Create an include processor + * @description this API is experimental and subject to change + * @memberof Extensions + */ +Extensions.createIncludeProcessor = function (name, functions) { + if (arguments.length === 1) { + functions = name; + name = null; + } + return initializeProcessorClass('IncludeProcessor', name, functions); +}; + +/** + * Create and instantiate an include processor + * @description this API is experimental and subject to change + * @memberof Extensions + */ +Extensions.newIncludeProcessor = function (name, functions) { + if (arguments.length === 1) { + functions = name; + name = null; + } + return this.createIncludeProcessor(name, functions).$new(); +}; + +// Docinfo Processor + +/** + * Create a Docinfo processor + * @description this API is experimental and subject to change + * @memberof Extensions + */ +Extensions.createDocinfoProcessor = function (name, functions) { + if (arguments.length === 1) { + functions = name; + name = null; + } + return initializeProcessorClass('DocinfoProcessor', name, functions); +}; + +/** + * Create and instantiate a Docinfo processor + * @description this API is experimental and subject to change + * @memberof Extensions + */ +Extensions.newDocinfoProcessor = function (name, functions) { + if (arguments.length === 1) { + functions = name; + name = null; + } + return this.createDocinfoProcessor(name, functions).$new(); +}; + +// Block Processor + +/** + * Create a block processor + * @description this API is experimental and subject to change + * @memberof Extensions + */ +Extensions.createBlockProcessor = function (name, functions) { + if (arguments.length === 1) { + functions = name; + name = null; + } + return initializeProcessorClass('BlockProcessor', name, functions); +}; + +/** + * Create and instantiate a block processor + * @description this API is experimental and subject to change + * @memberof Extensions + */ +Extensions.newBlockProcessor = function (name, functions) { + if (arguments.length === 1) { + functions = name; + name = null; + } + return this.createBlockProcessor(name, functions).$new(); +}; + +// Inline Macro Processor + +/** + * Create an inline macro processor + * @description this API is experimental and subject to change + * @memberof Extensions + */ +Extensions.createInlineMacroProcessor = function (name, functions) { + if (arguments.length === 1) { + functions = name; + name = null; + } + return initializeProcessorClass('InlineMacroProcessor', name, functions); +}; + +/** + * Create and instantiate an inline macro processor + * @description this API is experimental and subject to change + * @memberof Extensions + */ +Extensions.newInlineMacroProcessor = function (name, functions) { + if (arguments.length === 1) { + functions = name; + name = null; + } + return this.createInlineMacroProcessor(name, functions).$new(); +}; + +// Block Macro Processor + +/** + * Create a block macro processor + * @description this API is experimental and subject to change + * @memberof Extensions + */ +Extensions.createBlockMacroProcessor = function (name, functions) { + if (arguments.length === 1) { + functions = name; + name = null; + } + return initializeProcessorClass('BlockMacroProcessor', name, functions); +}; + +/** + * Create and instantiate a block macro processor + * @description this API is experimental and subject to change + * @memberof Extensions + */ +Extensions.newBlockMacroProcessor = function (name, functions) { + if (arguments.length === 1) { + functions = name; + name = null; + } + return this.createBlockMacroProcessor(name, functions).$new(); +}; + +// Converter API + +/** + * @namespace + * @module Converter + */ +var Converter = Opal.const_get_qualified(Opal.Asciidoctor, 'Converter'); + +// Alias +Opal.Asciidoctor.Converter = Converter; + +/** + * Convert the specified node. + * + * @param {AbstractNode} node - the AbstractNode to convert + * @param {string} transform - an optional String transform that hints at + * which transformation should be applied to this node. + * @param {Object} opts - a JSON of options that provide additional hints about + * how to convert the node (default: {}) + * @returns the {Object} result of the conversion, typically a {string}. + * @memberof Converter + */ +Converter.prototype.convert = function (node, transform, opts) { + return this.$convert(node, transform, toHash(opts)); +}; + +// The built-in converter doesn't include Converter, so we have to force it +Converter.BuiltIn.prototype.convert = Converter.prototype.convert; + +// Converter Factory API + +/** + * @namespace + * @module Converter/Factory + */ +var ConverterFactory = Opal.Asciidoctor.Converter.Factory; + +// Alias +Opal.Asciidoctor.ConverterFactory = ConverterFactory; + +/** + * Register a custom converter in the global converter factory to handle conversion to the specified backends. + * If the backend value is an asterisk, the converter is used to handle any backend that does not have an explicit converter. + * + * @param converter - The Converter instance to register + * @param backends {Array} - A {string} {Array} of backend names that this converter should be registered to handle (optional, default: ['*']) + * @return {*} - Returns nothing + * @memberof Converter/Factory + */ +ConverterFactory.register = function (converter, backends) { + if (typeof converter === 'object' && typeof converter.$convert === 'undefined' && typeof converter.convert === 'function') { + Opal.def(converter, '$convert', converter.convert); + } + return this.$register(converter, backends); +}; + +/** + * Retrieves the singleton instance of the converter factory. + * + * @param {boolean} initialize - instantiate the singleton if it has not yet + * been instantiated. If this value is false and the singleton has not yet been + * instantiated, this method returns a fresh instance. + * @returns {Converter/Factory} an instance of the converter factory. + * @memberof Converter/Factory + */ +ConverterFactory.getDefault = function (initialize) { + return this.$default(initialize); +}; + +/** + * Create an instance of the converter bound to the specified backend. + * + * @param {string} backend - look for a converter bound to this keyword. + * @param {Object} opts - a JSON of options to pass to the converter (default: {}) + * @returns {Converter} - a converter instance for converting nodes in an Asciidoctor AST. + * @memberof Converter/Factory + */ +ConverterFactory.prototype.create = function (backend, opts) { + return this.$create(backend, toHash(opts)); +}; + +// Built-in converter + +/** + * @namespace + * @module Converter/Html5Converter + */ +var Html5Converter = Opal.Asciidoctor.Converter.Html5Converter; + +// Alias +Opal.Asciidoctor.Html5Converter = Html5Converter; + + +Html5Converter.prototype.convert = function (node, transform, opts) { + return this.$convert(node, transform, opts); +}; + + +var ASCIIDOCTOR_JS_VERSION = '1.5.9'; + + /** + * Get Asciidoctor.js version number. + * + * @memberof Asciidoctor + * @returns {string} - returns the version number of Asciidoctor.js. + */ + Asciidoctor.prototype.getVersion = function () { + return ASCIIDOCTOR_JS_VERSION; + }; + return Opal.Asciidoctor; +})); diff --git a/node_modules/asciidoctor.js/dist/umd/asciidoctor.js b/node_modules/asciidoctor.js/dist/umd/asciidoctor.js new file mode 100644 index 0000000..c00e45f --- /dev/null +++ b/node_modules/asciidoctor.js/dist/umd/asciidoctor.js @@ -0,0 +1,46290 @@ +/* eslint-disable indent */ +if (typeof Opal === 'undefined' && typeof module === 'object' && module.exports) { + Opal = require('opal-runtime').Opal; +} + +if (typeof Opal === 'undefined') { + // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects#Fundamental_objects + var fundamentalObjects = [ + Function, + Boolean, + Error, + Number, + Date, + String, + RegExp, + Array + ]; + var backup = {}; + for (var index in fundamentalObjects) { + var fundamentalObject = fundamentalObjects[index]; + backup[fundamentalObject.name] = { + call: fundamentalObject.call, + apply: fundamentalObject.apply, + bind: fundamentalObject.bind + }; + } + +(function(undefined) { + // @note + // A few conventions for the documentation of this file: + // 1. Always use "//" (in contrast with "/**/") + // 2. The syntax used is Yardoc (yardoc.org), which is intended for Ruby (se below) + // 3. `@param` and `@return` types should be preceded by `JS.` when referring to + // JavaScript constructors (e.g. `JS.Function`) otherwise Ruby is assumed. + // 4. `nil` and `null` being unambiguous refer to the respective + // objects/values in Ruby and JavaScript + // 5. This is still WIP :) so please give feedback and suggestions on how + // to improve or for alternative solutions + // + // The way the code is digested before going through Yardoc is a secret kept + // in the docs repo (https://github.com/opal/docs/tree/master). + + var global_object = this, console; + + // Detect the global object + if (typeof(global) !== 'undefined') { global_object = global; } + if (typeof(window) !== 'undefined') { global_object = window; } + + // Setup a dummy console object if missing + if (typeof(global_object.console) === 'object') { + console = global_object.console; + } else if (global_object.console == null) { + console = global_object.console = {}; + } else { + console = {}; + } + + if (!('log' in console)) { console.log = function () {}; } + if (!('warn' in console)) { console.warn = console.log; } + + if (typeof(this.Opal) !== 'undefined') { + console.warn('Opal already loaded. Loading twice can cause troubles, please fix your setup.'); + return this.Opal; + } + + var nil; + + // The actual class for BasicObject + var BasicObject; + + // The actual Object class. + // The leading underscore is to avoid confusion with window.Object() + var _Object; + + // The actual Module class + var Module; + + // The actual Class class + var Class; + + // The Opal object that is exposed globally + var Opal = this.Opal = {}; + + // This is a useful reference to global object inside ruby files + Opal.global = global_object; + global_object.Opal = Opal; + + // Configure runtime behavior with regards to require and unsupported fearures + Opal.config = { + missing_require_severity: 'error', // error, warning, ignore + unsupported_features_severity: 'warning', // error, warning, ignore + enable_stack_trace: true // true, false + } + + // Minify common function calls + var $hasOwn = Object.hasOwnProperty; + var $bind = Function.prototype.bind; + var $setPrototype = Object.setPrototypeOf; + var $slice = Array.prototype.slice; + + // Nil object id is always 4 + var nil_id = 4; + + // Generates even sequential numbers greater than 4 + // (nil_id) to serve as unique ids for ruby objects + var unique_id = nil_id; + + // Return next unique id + Opal.uid = function() { + unique_id += 2; + return unique_id; + }; + + // Retrieve or assign the id of an object + Opal.id = function(obj) { + if (obj.$$is_number) return (obj * 2)+1; + if (obj.$$id != null) { + return obj.$$id; + }; + $defineProperty(obj, '$$id', Opal.uid()); + return obj.$$id; + }; + + // Globals table + Opal.gvars = {}; + + // Exit function, this should be replaced by platform specific implementation + // (See nodejs and chrome for examples) + Opal.exit = function(status) { if (Opal.gvars.DEBUG) console.log('Exited with status '+status); }; + + // keeps track of exceptions for $! + Opal.exceptions = []; + + // @private + // Pops an exception from the stack and updates `$!`. + Opal.pop_exception = function() { + Opal.gvars["!"] = Opal.exceptions.pop() || nil; + } + + // Inspect any kind of object, including non Ruby ones + Opal.inspect = function(obj) { + if (obj === undefined) { + return "undefined"; + } + else if (obj === null) { + return "null"; + } + else if (!obj.$$class) { + return obj.toString(); + } + else { + return obj.$inspect(); + } + } + + function $defineProperty(object, name, initialValue) { + if (typeof(object) === "string") { + // Special case for: + // s = "string" + // def s.m; end + // String class is the only class that: + // + compiles to JS primitive + // + allows method definition directly on instances + // numbers, true, false and nil do not support it. + object[name] = initialValue; + } else { + Object.defineProperty(object, name, { + value: initialValue, + enumerable: false, + configurable: true, + writable: true + }); + } + } + + Opal.defineProperty = $defineProperty; + + Opal.slice = $slice; + + + // Truth + // ----- + + Opal.truthy = function(val) { + return (val !== nil && val != null && (!val.$$is_boolean || val == true)); + }; + + Opal.falsy = function(val) { + return (val === nil || val == null || (val.$$is_boolean && val == false)) + }; + + + // Constants + // --------- + // + // For future reference: + // - The Rails autoloading guide (http://guides.rubyonrails.org/v5.0/autoloading_and_reloading_constants.html) + // - @ConradIrwin's 2012 post on “Everything you ever wanted to know about constant lookup in Ruby” (http://cirw.in/blog/constant-lookup.html) + // + // Legend of MRI concepts/names: + // - constant reference (cref): the module/class that acts as a namespace + // - nesting: the namespaces wrapping the current scope, e.g. nesting inside + // `module A; module B::C; end; end` is `[B::C, A]` + + // Get the constant in the scope of the current cref + function const_get_name(cref, name) { + if (cref) return cref.$$const[name]; + } + + // Walk up the nesting array looking for the constant + function const_lookup_nesting(nesting, name) { + var i, ii, result, constant; + + if (nesting.length === 0) return; + + // If the nesting is not empty the constant is looked up in its elements + // and in order. The ancestors of those elements are ignored. + for (i = 0, ii = nesting.length; i < ii; i++) { + constant = nesting[i].$$const[name]; + if (constant != null) return constant; + } + } + + // Walk up the ancestors chain looking for the constant + function const_lookup_ancestors(cref, name) { + var i, ii, result, ancestors; + + if (cref == null) return; + + ancestors = Opal.ancestors(cref); + + for (i = 0, ii = ancestors.length; i < ii; i++) { + if (ancestors[i].$$const && $hasOwn.call(ancestors[i].$$const, name)) { + return ancestors[i].$$const[name]; + } + } + } + + // Walk up Object's ancestors chain looking for the constant, + // but only if cref is missing or a module. + function const_lookup_Object(cref, name) { + if (cref == null || cref.$$is_module) { + return const_lookup_ancestors(_Object, name); + } + } + + // Call const_missing if nothing else worked + function const_missing(cref, name, skip_missing) { + if (!skip_missing) { + return (cref || _Object).$const_missing(name); + } + } + + // Look for the constant just in the current cref or call `#const_missing` + Opal.const_get_local = function(cref, name, skip_missing) { + var result; + + if (cref == null) return; + + if (cref === '::') cref = _Object; + + if (!cref.$$is_module && !cref.$$is_class) { + throw new Opal.TypeError(cref.toString() + " is not a class/module"); + } + + result = const_get_name(cref, name); if (result != null) return result; + result = const_missing(cref, name, skip_missing); if (result != null) return result; + } + + // Look for the constant relative to a cref or call `#const_missing` (when the + // constant is prefixed by `::`). + Opal.const_get_qualified = function(cref, name, skip_missing) { + var result, cache, cached, current_version = Opal.const_cache_version; + + if (cref == null) return; + + if (cref === '::') cref = _Object; + + if (!cref.$$is_module && !cref.$$is_class) { + throw new Opal.TypeError(cref.toString() + " is not a class/module"); + } + + if ((cache = cref.$$const_cache) == null) { + $defineProperty(cref, '$$const_cache', Object.create(null)); + cache = cref.$$const_cache; + } + cached = cache[name]; + + if (cached == null || cached[0] !== current_version) { + ((result = const_get_name(cref, name)) != null) || + ((result = const_lookup_ancestors(cref, name)) != null); + cache[name] = [current_version, result]; + } else { + result = cached[1]; + } + + return result != null ? result : const_missing(cref, name, skip_missing); + }; + + // Initialize the top level constant cache generation counter + Opal.const_cache_version = 1; + + // Look for the constant in the open using the current nesting and the nearest + // cref ancestors or call `#const_missing` (when the constant has no :: prefix). + Opal.const_get_relative = function(nesting, name, skip_missing) { + var cref = nesting[0], result, current_version = Opal.const_cache_version, cache, cached; + + if ((cache = nesting.$$const_cache) == null) { + $defineProperty(nesting, '$$const_cache', Object.create(null)); + cache = nesting.$$const_cache; + } + cached = cache[name]; + + if (cached == null || cached[0] !== current_version) { + ((result = const_get_name(cref, name)) != null) || + ((result = const_lookup_nesting(nesting, name)) != null) || + ((result = const_lookup_ancestors(cref, name)) != null) || + ((result = const_lookup_Object(cref, name)) != null); + + cache[name] = [current_version, result]; + } else { + result = cached[1]; + } + + return result != null ? result : const_missing(cref, name, skip_missing); + }; + + // Register the constant on a cref and opportunistically set the name of + // unnamed classes/modules. + Opal.const_set = function(cref, name, value) { + if (cref == null || cref === '::') cref = _Object; + + if (value.$$is_a_module) { + if (value.$$name == null || value.$$name === nil) value.$$name = name; + if (value.$$base_module == null) value.$$base_module = cref; + } + + cref.$$const = (cref.$$const || Object.create(null)); + cref.$$const[name] = value; + + // Add a short helper to navigate constants manually. + // @example + // Opal.$$.Regexp.$$.IGNORECASE + cref.$$ = cref.$$const; + + Opal.const_cache_version++; + + // Expose top level constants onto the Opal object + if (cref === _Object) Opal[name] = value; + + // Name new class directly onto current scope (Opal.Foo.Baz = klass) + $defineProperty(cref, name, value); + + return value; + }; + + // Get all the constants reachable from a given cref, by default will include + // inherited constants. + Opal.constants = function(cref, inherit) { + if (inherit == null) inherit = true; + + var module, modules = [cref], module_constants, i, ii, constants = {}, constant; + + if (inherit) modules = modules.concat(Opal.ancestors(cref)); + if (inherit && cref.$$is_module) modules = modules.concat([Opal.Object]).concat(Opal.ancestors(Opal.Object)); + + for (i = 0, ii = modules.length; i < ii; i++) { + module = modules[i]; + + // Don not show Objects constants unless we're querying Object itself + if (cref !== _Object && module == _Object) break; + + for (constant in module.$$const) { + constants[constant] = true; + } + } + + return Object.keys(constants); + }; + + // Remove a constant from a cref. + Opal.const_remove = function(cref, name) { + Opal.const_cache_version++; + + if (cref.$$const[name] != null) { + var old = cref.$$const[name]; + delete cref.$$const[name]; + return old; + } + + if (cref.$$autoload != null && cref.$$autoload[name] != null) { + delete cref.$$autoload[name]; + return nil; + } + + throw Opal.NameError.$new("constant "+cref+"::"+cref.$name()+" not defined"); + }; + + + // Modules & Classes + // ----------------- + + // A `class Foo; end` expression in ruby is compiled to call this runtime + // method which either returns an existing class of the given name, or creates + // a new class in the given `base` scope. + // + // If a constant with the given name exists, then we check to make sure that + // it is a class and also that the superclasses match. If either of these + // fail, then we raise a `TypeError`. Note, `superclass` may be null if one + // was not specified in the ruby code. + // + // We pass a constructor to this method of the form `function ClassName() {}` + // simply so that classes show up with nicely formatted names inside debuggers + // in the web browser (or node/sprockets). + // + // The `scope` is the current `self` value where the class is being created + // from. We use this to get the scope for where the class should be created. + // If `scope` is an object (not a class/module), we simple get its class and + // use that as the scope instead. + // + // @param scope [Object] where the class is being created + // @param superclass [Class,null] superclass of the new class (may be null) + // @param id [String] the name of the class to be created + // @param constructor [JS.Function] function to use as constructor + // + // @return new [Class] or existing ruby class + // + Opal.allocate_class = function(name, superclass, constructor) { + var klass = constructor; + + if (superclass != null && superclass.$$bridge) { + // Inheritance from bridged classes requires + // calling original JS constructors + klass = function SubclassOfNativeClass() { + var args = $slice.call(arguments), + self = new ($bind.apply(superclass, [null].concat(args)))(); + + // and replacing a __proto__ manually + $setPrototype(self, klass.prototype); + return self; + } + } + + $defineProperty(klass, '$$name', name); + $defineProperty(klass, '$$const', {}); + $defineProperty(klass, '$$is_class', true); + $defineProperty(klass, '$$is_a_module', true); + $defineProperty(klass, '$$super', superclass); + $defineProperty(klass, '$$cvars', {}); + $defineProperty(klass, '$$own_included_modules', []); + $defineProperty(klass, '$$own_prepended_modules', []); + $defineProperty(klass, '$$ancestors', []); + $defineProperty(klass, '$$ancestors_cache_version', null); + + $defineProperty(klass.prototype, '$$class', klass); + + // By default if there are no singleton class methods + // __proto__ is Class.prototype + // Later singleton methods generate a singleton_class + // and inject it into ancestors chain + if (Opal.Class) { + $setPrototype(klass, Opal.Class.prototype); + } + + if (superclass != null) { + $setPrototype(klass.prototype, superclass.prototype); + + if (superclass !== Opal.Module && superclass.$$meta) { + // If superclass has metaclass then we have explicitely inherit it. + Opal.build_class_singleton_class(klass); + } + }; + + return klass; + } + + + function find_existing_class(scope, name) { + // Try to find the class in the current scope + var klass = const_get_name(scope, name); + + // If the class exists in the scope, then we must use that + if (klass) { + // Make sure the existing constant is a class, or raise error + if (!klass.$$is_class) { + throw Opal.TypeError.$new(name + " is not a class"); + } + + return klass; + } + } + + function ensureSuperclassMatch(klass, superclass) { + if (klass.$$super !== superclass) { + throw Opal.TypeError.$new("superclass mismatch for class " + klass.$$name); + } + } + + Opal.klass = function(scope, superclass, name, constructor) { + var bridged; + + if (scope == null) { + // Global scope + scope = _Object; + } else if (!scope.$$is_class && !scope.$$is_module) { + // Scope is an object, use its class + scope = scope.$$class; + } + + // If the superclass is not an Opal-generated class then we're bridging a native JS class + if (superclass != null && !superclass.hasOwnProperty('$$is_class')) { + bridged = superclass; + superclass = _Object; + } + + var klass = find_existing_class(scope, name); + + if (klass) { + if (superclass) { + // Make sure existing class has same superclass + ensureSuperclassMatch(klass, superclass); + } + return klass; + } + + // Class doesnt exist, create a new one with given superclass... + + // Not specifying a superclass means we can assume it to be Object + if (superclass == null) { + superclass = _Object; + } + + if (bridged) { + Opal.bridge(bridged); + klass = bridged; + Opal.const_set(scope, name, klass); + } else { + // Create the class object (instance of Class) + klass = Opal.allocate_class(name, superclass, constructor); + Opal.const_set(scope, name, klass); + // Call .inherited() hook with new class on the superclass + if (superclass.$inherited) { + superclass.$inherited(klass); + } + } + + return klass; + + } + + // Define new module (or return existing module). The given `scope` is basically + // the current `self` value the `module` statement was defined in. If this is + // a ruby module or class, then it is used, otherwise if the scope is a ruby + // object then that objects real ruby class is used (e.g. if the scope is the + // main object, then the top level `Object` class is used as the scope). + // + // If a module of the given name is already defined in the scope, then that + // instance is just returned. + // + // If there is a class of the given name in the scope, then an error is + // generated instead (cannot have a class and module of same name in same scope). + // + // Otherwise, a new module is created in the scope with the given name, and that + // new instance is returned back (to be referenced at runtime). + // + // @param scope [Module, Class] class or module this definition is inside + // @param id [String] the name of the new (or existing) module + // + // @return [Module] + Opal.allocate_module = function(name, constructor) { + var module = constructor; + + $defineProperty(module, '$$name', name); + $defineProperty(module, '$$const', {}); + $defineProperty(module, '$$is_module', true); + $defineProperty(module, '$$is_a_module', true); + $defineProperty(module, '$$cvars', {}); + $defineProperty(module, '$$iclasses', []); + $defineProperty(module, '$$own_included_modules', []); + $defineProperty(module, '$$own_prepended_modules', []); + $defineProperty(module, '$$ancestors', [module]); + $defineProperty(module, '$$ancestors_cache_version', null); + + $setPrototype(module, Opal.Module.prototype); + + return module; + } + + function find_existing_module(scope, name) { + var module = const_get_name(scope, name); + if (module == null && scope === _Object) module = const_lookup_ancestors(_Object, name); + + if (module) { + if (!module.$$is_module && module !== _Object) { + throw Opal.TypeError.$new(name + " is not a module"); + } + } + + return module; + } + + Opal.module = function(scope, name, constructor) { + var module; + + if (scope == null) { + // Global scope + scope = _Object; + } else if (!scope.$$is_class && !scope.$$is_module) { + // Scope is an object, use its class + scope = scope.$$class; + } + + module = find_existing_module(scope, name); + + if (module) { + return module; + } + + // Module doesnt exist, create a new one... + module = Opal.allocate_module(name, constructor); + Opal.const_set(scope, name, module); + + return module; + } + + // Return the singleton class for the passed object. + // + // If the given object alredy has a singleton class, then it will be stored on + // the object as the `$$meta` property. If this exists, then it is simply + // returned back. + // + // Otherwise, a new singleton object for the class or object is created, set on + // the object at `$$meta` for future use, and then returned. + // + // @param object [Object] the ruby object + // @return [Class] the singleton class for object + Opal.get_singleton_class = function(object) { + if (object.$$meta) { + return object.$$meta; + } + + if (object.hasOwnProperty('$$is_class')) { + return Opal.build_class_singleton_class(object); + } else if (object.hasOwnProperty('$$is_module')) { + return Opal.build_module_singletin_class(object); + } else { + return Opal.build_object_singleton_class(object); + } + }; + + // Build the singleton class for an existing class. Class object are built + // with their singleton class already in the prototype chain and inheriting + // from their superclass object (up to `Class` itself). + // + // NOTE: Actually in MRI a class' singleton class inherits from its + // superclass' singleton class which in turn inherits from Class. + // + // @param klass [Class] + // @return [Class] + Opal.build_class_singleton_class = function(klass) { + var superclass, meta; + + if (klass.$$meta) { + return klass.$$meta; + } + + // The singleton_class superclass is the singleton_class of its superclass; + // but BasicObject has no superclass (its `$$super` is null), thus we + // fallback on `Class`. + superclass = klass === BasicObject ? Class : Opal.get_singleton_class(klass.$$super); + + meta = Opal.allocate_class(null, superclass, function(){}); + + $defineProperty(meta, '$$is_singleton', true); + $defineProperty(meta, '$$singleton_of', klass); + $defineProperty(klass, '$$meta', meta); + $setPrototype(klass, meta.prototype); + // Restoring ClassName.class + $defineProperty(klass, '$$class', Opal.Class); + + return meta; + }; + + Opal.build_module_singletin_class = function(mod) { + if (mod.$$meta) { + return mod.$$meta; + } + + var meta = Opal.allocate_class(null, Opal.Module, function(){}); + + $defineProperty(meta, '$$is_singleton', true); + $defineProperty(meta, '$$singleton_of', mod); + $defineProperty(mod, '$$meta', meta); + $setPrototype(mod, meta.prototype); + // Restoring ModuleName.class + $defineProperty(mod, '$$class', Opal.Module); + + return meta; + } + + // Build the singleton class for a Ruby (non class) Object. + // + // @param object [Object] + // @return [Class] + Opal.build_object_singleton_class = function(object) { + var superclass = object.$$class, + klass = Opal.allocate_class(nil, superclass, function(){}); + + $defineProperty(klass, '$$is_singleton', true); + $defineProperty(klass, '$$singleton_of', object); + + delete klass.prototype.$$class; + + $defineProperty(object, '$$meta', klass); + + $setPrototype(object, object.$$meta.prototype); + + return klass; + }; + + Opal.is_method = function(prop) { + return (prop[0] === '$' && prop[1] !== '$'); + } + + Opal.instance_methods = function(mod) { + var exclude = [], results = [], ancestors = Opal.ancestors(mod); + + for (var i = 0, l = ancestors.length; i < l; i++) { + var ancestor = ancestors[i], + proto = ancestor.prototype; + + if (proto.hasOwnProperty('$$dummy')) { + proto = proto.$$define_methods_on; + } + + var props = Object.getOwnPropertyNames(proto); + + for (var j = 0, ll = props.length; j < ll; j++) { + var prop = props[j]; + + if (Opal.is_method(prop)) { + var method_name = prop.slice(1), + method = proto[prop]; + + if (method.$$stub && exclude.indexOf(method_name) === -1) { + exclude.push(method_name); + } + + if (!method.$$stub && results.indexOf(method_name) === -1 && exclude.indexOf(method_name) === -1) { + results.push(method_name); + } + } + } + } + + return results; + } + + Opal.own_instance_methods = function(mod) { + var results = [], + proto = mod.prototype; + + if (proto.hasOwnProperty('$$dummy')) { + proto = proto.$$define_methods_on; + } + + var props = Object.getOwnPropertyNames(proto); + + for (var i = 0, length = props.length; i < length; i++) { + var prop = props[i]; + + if (Opal.is_method(prop)) { + var method = proto[prop]; + + if (!method.$$stub) { + var method_name = prop.slice(1); + results.push(method_name); + } + } + } + + return results; + } + + Opal.methods = function(obj) { + return Opal.instance_methods(Opal.get_singleton_class(obj)); + } + + Opal.own_methods = function(obj) { + return Opal.own_instance_methods(Opal.get_singleton_class(obj)); + } + + Opal.receiver_methods = function(obj) { + var mod = Opal.get_singleton_class(obj); + var singleton_methods = Opal.own_instance_methods(mod); + var instance_methods = Opal.own_instance_methods(mod.$$super); + return singleton_methods.concat(instance_methods); + } + + // Returns an object containing all pairs of names/values + // for all class variables defined in provided +module+ + // and its ancestors. + // + // @param module [Module] + // @return [Object] + Opal.class_variables = function(module) { + var ancestors = Opal.ancestors(module), + i, length = ancestors.length, + result = {}; + + for (i = length - 1; i >= 0; i--) { + var ancestor = ancestors[i]; + + for (var cvar in ancestor.$$cvars) { + result[cvar] = ancestor.$$cvars[cvar]; + } + } + + return result; + } + + // Sets class variable with specified +name+ to +value+ + // in provided +module+ + // + // @param module [Module] + // @param name [String] + // @param value [Object] + Opal.class_variable_set = function(module, name, value) { + var ancestors = Opal.ancestors(module), + i, length = ancestors.length; + + for (i = length - 2; i >= 0; i--) { + var ancestor = ancestors[i]; + + if ($hasOwn.call(ancestor.$$cvars, name)) { + ancestor.$$cvars[name] = value; + return value; + } + } + + module.$$cvars[name] = value; + + return value; + } + + function isRoot(proto) { + return proto.hasOwnProperty('$$iclass') && proto.hasOwnProperty('$$root'); + } + + function own_included_modules(module) { + var result = [], mod, proto = Object.getPrototypeOf(module.prototype); + + while (proto) { + if (proto.hasOwnProperty('$$class')) { + // superclass + break; + } + mod = protoToModule(proto); + if (mod) { + result.push(mod); + } + proto = Object.getPrototypeOf(proto); + } + + return result; + } + + function own_prepended_modules(module) { + var result = [], mod, proto = Object.getPrototypeOf(module.prototype); + + if (module.prototype.hasOwnProperty('$$dummy')) { + while (proto) { + if (proto === module.prototype.$$define_methods_on) { + break; + } + + mod = protoToModule(proto); + if (mod) { + result.push(mod); + } + + proto = Object.getPrototypeOf(proto); + } + } + + return result; + } + + + // The actual inclusion of a module into a class. + // + // ## Class `$$parent` and `iclass` + // + // To handle `super` calls, every class has a `$$parent`. This parent is + // used to resolve the next class for a super call. A normal class would + // have this point to its superclass. However, if a class includes a module + // then this would need to take into account the module. The module would + // also have to then point its `$$parent` to the actual superclass. We + // cannot modify modules like this, because it might be included in more + // then one class. To fix this, we actually insert an `iclass` as the class' + // `$$parent` which can then point to the superclass. The `iclass` acts as + // a proxy to the actual module, so the `super` chain can then search it for + // the required method. + // + // @param module [Module] the module to include + // @param includer [Module] the target class to include module into + // @return [null] + Opal.append_features = function(module, includer) { + var module_ancestors = Opal.ancestors(module); + var iclasses = []; + + if (module_ancestors.indexOf(includer) !== -1) { + throw Opal.ArgumentError.$new('cyclic include detected'); + } + + for (var i = 0, length = module_ancestors.length; i < length; i++) { + var ancestor = module_ancestors[i], iclass = create_iclass(ancestor); + $defineProperty(iclass, '$$included', true); + iclasses.push(iclass); + } + var includer_ancestors = Opal.ancestors(includer), + chain = chain_iclasses(iclasses), + start_chain_after, + end_chain_on; + + if (includer_ancestors.indexOf(module) === -1) { + // first time include + + // includer -> chain.first -> ...chain... -> chain.last -> includer.parent + start_chain_after = includer.prototype; + end_chain_on = Object.getPrototypeOf(includer.prototype); + } else { + // The module has been already included, + // we don't need to put it into the ancestors chain again, + // but this module may have new included modules. + // If it's true we need to copy them. + // + // The simplest way is to replace ancestors chain from + // parent + // | + // `module` iclass (has a $$root flag) + // | + // ...previos chain of module.included_modules ... + // | + // "next ancestor" (has a $$root flag or is a real class) + // + // to + // parent + // | + // `module` iclass (has a $$root flag) + // | + // ...regenerated chain of module.included_modules + // | + // "next ancestor" (has a $$root flag or is a real class) + // + // because there are no intermediate classes between `parent` and `next ancestor`. + // It doesn't break any prototypes of other objects as we don't change class references. + + var proto = includer.prototype, parent = proto, module_iclass = Object.getPrototypeOf(parent); + + while (module_iclass != null) { + if (isRoot(module_iclass) && module_iclass.$$module === module) { + break; + } + + parent = module_iclass; + module_iclass = Object.getPrototypeOf(module_iclass); + } + + var next_ancestor = Object.getPrototypeOf(module_iclass); + + // skip non-root iclasses (that were recursively included) + while (next_ancestor.hasOwnProperty('$$iclass') && !isRoot(next_ancestor)) { + next_ancestor = Object.getPrototypeOf(next_ancestor); + } + + start_chain_after = parent; + end_chain_on = next_ancestor; + } + + $setPrototype(start_chain_after, chain.first); + $setPrototype(chain.last, end_chain_on); + + // recalculate own_included_modules cache + includer.$$own_included_modules = own_included_modules(includer); + + Opal.const_cache_version++; + } + + Opal.prepend_features = function(module, prepender) { + // Here we change the ancestors chain from + // + // prepender + // | + // parent + // + // to: + // + // dummy(prepender) + // | + // iclass(module) + // | + // iclass(prepender) + // | + // parent + var module_ancestors = Opal.ancestors(module); + var iclasses = []; + + if (module_ancestors.indexOf(prepender) !== -1) { + throw Opal.ArgumentError.$new('cyclic prepend detected'); + } + + for (var i = 0, length = module_ancestors.length; i < length; i++) { + var ancestor = module_ancestors[i], iclass = create_iclass(ancestor); + $defineProperty(iclass, '$$prepended', true); + iclasses.push(iclass); + } + + var chain = chain_iclasses(iclasses), + dummy_prepender = prepender.prototype, + previous_parent = Object.getPrototypeOf(dummy_prepender), + prepender_iclass, + start_chain_after, + end_chain_on; + + if (dummy_prepender.hasOwnProperty('$$dummy')) { + // The module already has some prepended modules + // which means that we don't need to make it "dummy" + prepender_iclass = dummy_prepender.$$define_methods_on; + } else { + // Making the module "dummy" + prepender_iclass = create_dummy_iclass(prepender); + flush_methods_in(prepender); + $defineProperty(dummy_prepender, '$$dummy', true); + $defineProperty(dummy_prepender, '$$define_methods_on', prepender_iclass); + + // Converting + // dummy(prepender) -> previous_parent + // to + // dummy(prepender) -> iclass(prepender) -> previous_parent + $setPrototype(dummy_prepender, prepender_iclass); + $setPrototype(prepender_iclass, previous_parent); + } + + var prepender_ancestors = Opal.ancestors(prepender); + + if (prepender_ancestors.indexOf(module) === -1) { + // first time prepend + + start_chain_after = dummy_prepender; + + // next $$root or prepender_iclass or non-$$iclass + end_chain_on = Object.getPrototypeOf(dummy_prepender); + while (end_chain_on != null) { + if ( + end_chain_on.hasOwnProperty('$$root') || + end_chain_on === prepender_iclass || + !end_chain_on.hasOwnProperty('$$iclass') + ) { + break; + } + + end_chain_on = Object.getPrototypeOf(end_chain_on); + } + } else { + throw Opal.RuntimeError.$new("Prepending a module multiple times is not supported"); + } + + $setPrototype(start_chain_after, chain.first); + $setPrototype(chain.last, end_chain_on); + + // recalculate own_prepended_modules cache + prepender.$$own_prepended_modules = own_prepended_modules(prepender); + + Opal.const_cache_version++; + } + + function flush_methods_in(module) { + var proto = module.prototype, + props = Object.getOwnPropertyNames(proto); + + for (var i = 0; i < props.length; i++) { + var prop = props[i]; + if (Opal.is_method(prop)) { + delete proto[prop]; + } + } + } + + function create_iclass(module) { + var iclass = create_dummy_iclass(module); + + if (module.$$is_module) { + module.$$iclasses.push(iclass); + } + + return iclass; + } + + // Dummy iclass doesn't receive updates when the module gets a new method. + function create_dummy_iclass(module) { + var iclass = {}, + proto = module.prototype; + + if (proto.hasOwnProperty('$$dummy')) { + proto = proto.$$define_methods_on; + } + + var props = Object.getOwnPropertyNames(proto), + length = props.length, i; + + for (i = 0; i < length; i++) { + var prop = props[i]; + $defineProperty(iclass, prop, proto[prop]); + } + + $defineProperty(iclass, '$$iclass', true); + $defineProperty(iclass, '$$module', module); + + return iclass; + } + + function chain_iclasses(iclasses) { + var length = iclasses.length, first = iclasses[0]; + + $defineProperty(first, '$$root', true); + + if (length === 1) { + return { first: first, last: first }; + } + + var previous = first; + + for (var i = 1; i < length; i++) { + var current = iclasses[i]; + $setPrototype(previous, current); + previous = current; + } + + + return { first: iclasses[0], last: iclasses[length - 1] }; + } + + // For performance, some core Ruby classes are toll-free bridged to their + // native JavaScript counterparts (e.g. a Ruby Array is a JavaScript Array). + // + // This method is used to setup a native constructor (e.g. Array), to have + // its prototype act like a normal Ruby class. Firstly, a new Ruby class is + // created using the native constructor so that its prototype is set as the + // target for th new class. Note: all bridged classes are set to inherit + // from Object. + // + // Example: + // + // Opal.bridge(self, Function); + // + // @param klass [Class] the Ruby class to bridge + // @param constructor [JS.Function] native JavaScript constructor to use + // @return [Class] returns the passed Ruby class + // + Opal.bridge = function(constructor, klass) { + if (constructor.hasOwnProperty('$$bridge')) { + throw Opal.ArgumentError.$new("already bridged"); + } + + var klass_to_inject, klass_reference; + + if (klass == null) { + klass_to_inject = Opal.Object; + klass_reference = constructor; + } else { + klass_to_inject = klass; + klass_reference = klass; + } + + // constructor is a JS function with a prototype chain like: + // - constructor + // - super + // + // What we need to do is to inject our class (with its prototype chain) + // between constructor and super. For example, after injecting Ruby Object into JS Error we get: + // - constructor + // - Opal.Object + // - Opal.Kernel + // - Opal.BasicObject + // - super + // + + $setPrototype(constructor.prototype, klass_to_inject.prototype); + $defineProperty(constructor.prototype, '$$class', klass_reference); + $defineProperty(constructor, '$$bridge', true); + $defineProperty(constructor, '$$is_class', true); + $defineProperty(constructor, '$$is_a_module', true); + $defineProperty(constructor, '$$super', klass_to_inject); + $defineProperty(constructor, '$$const', {}); + $defineProperty(constructor, '$$own_included_modules', []); + $defineProperty(constructor, '$$own_prepended_modules', []); + $defineProperty(constructor, '$$ancestors', []); + $defineProperty(constructor, '$$ancestors_cache_version', null); + $setPrototype(constructor, Opal.Class.prototype); + }; + + function protoToModule(proto) { + if (proto.hasOwnProperty('$$dummy')) { + return; + } else if (proto.hasOwnProperty('$$iclass')) { + return proto.$$module; + } else if (proto.hasOwnProperty('$$class')) { + return proto.$$class; + } + } + + function own_ancestors(module) { + return module.$$own_prepended_modules.concat([module]).concat(module.$$own_included_modules); + } + + // The Array of ancestors for a given module/class + Opal.ancestors = function(module) { + if (!module) { return []; } + + if (module.$$ancestors_cache_version === Opal.const_cache_version) { + return module.$$ancestors; + } + + var result = [], i, mods, length; + + for (i = 0, mods = own_ancestors(module), length = mods.length; i < length; i++) { + result.push(mods[i]); + } + + if (module.$$super) { + for (i = 0, mods = Opal.ancestors(module.$$super), length = mods.length; i < length; i++) { + result.push(mods[i]); + } + } + + module.$$ancestors_cache_version = Opal.const_cache_version; + module.$$ancestors = result; + + return result; + } + + Opal.included_modules = function(module) { + var result = [], mod = null, proto = Object.getPrototypeOf(module.prototype); + + for (; proto && Object.getPrototypeOf(proto); proto = Object.getPrototypeOf(proto)) { + mod = protoToModule(proto); + if (mod && mod.$$is_module && proto.$$iclass && proto.$$included) { + result.push(mod); + } + } + + return result; + } + + + // Method Missing + // -------------- + + // Methods stubs are used to facilitate method_missing in opal. A stub is a + // placeholder function which just calls `method_missing` on the receiver. + // If no method with the given name is actually defined on an object, then it + // is obvious to say that the stub will be called instead, and then in turn + // method_missing will be called. + // + // When a file in ruby gets compiled to javascript, it includes a call to + // this function which adds stubs for every method name in the compiled file. + // It should then be safe to assume that method_missing will work for any + // method call detected. + // + // Method stubs are added to the BasicObject prototype, which every other + // ruby object inherits, so all objects should handle method missing. A stub + // is only added if the given property name (method name) is not already + // defined. + // + // Note: all ruby methods have a `$` prefix in javascript, so all stubs will + // have this prefix as well (to make this method more performant). + // + // Opal.add_stubs(["$foo", "$bar", "$baz="]); + // + // All stub functions will have a private `$$stub` property set to true so + // that other internal methods can detect if a method is just a stub or not. + // `Kernel#respond_to?` uses this property to detect a methods presence. + // + // @param stubs [Array] an array of method stubs to add + // @return [undefined] + Opal.add_stubs = function(stubs) { + var proto = Opal.BasicObject.prototype; + + for (var i = 0, length = stubs.length; i < length; i++) { + var stub = stubs[i], existing_method = proto[stub]; + + if (existing_method == null || existing_method.$$stub) { + Opal.add_stub_for(proto, stub); + } + } + }; + + // Add a method_missing stub function to the given prototype for the + // given name. + // + // @param prototype [Prototype] the target prototype + // @param stub [String] stub name to add (e.g. "$foo") + // @return [undefined] + Opal.add_stub_for = function(prototype, stub) { + var method_missing_stub = Opal.stub_for(stub); + $defineProperty(prototype, stub, method_missing_stub); + }; + + // Generate the method_missing stub for a given method name. + // + // @param method_name [String] The js-name of the method to stub (e.g. "$foo") + // @return [undefined] + Opal.stub_for = function(method_name) { + function method_missing_stub() { + // Copy any given block onto the method_missing dispatcher + this.$method_missing.$$p = method_missing_stub.$$p; + + // Set block property to null ready for the next call (stop false-positives) + method_missing_stub.$$p = null; + + // call method missing with correct args (remove '$' prefix on method name) + var args_ary = new Array(arguments.length); + for(var i = 0, l = args_ary.length; i < l; i++) { args_ary[i] = arguments[i]; } + + return this.$method_missing.apply(this, [method_name.slice(1)].concat(args_ary)); + } + + method_missing_stub.$$stub = true; + + return method_missing_stub; + }; + + + // Methods + // ------- + + // Arity count error dispatcher for methods + // + // @param actual [Fixnum] number of arguments given to method + // @param expected [Fixnum] expected number of arguments + // @param object [Object] owner of the method +meth+ + // @param meth [String] method name that got wrong number of arguments + // @raise [ArgumentError] + Opal.ac = function(actual, expected, object, meth) { + var inspect = ''; + if (object.$$is_a_module) { + inspect += object.$$name + '.'; + } + else { + inspect += object.$$class.$$name + '#'; + } + inspect += meth; + + throw Opal.ArgumentError.$new('[' + inspect + '] wrong number of arguments(' + actual + ' for ' + expected + ')'); + }; + + // Arity count error dispatcher for blocks + // + // @param actual [Fixnum] number of arguments given to block + // @param expected [Fixnum] expected number of arguments + // @param context [Object] context of the block definition + // @raise [ArgumentError] + Opal.block_ac = function(actual, expected, context) { + var inspect = "`block in " + context + "'"; + + throw Opal.ArgumentError.$new(inspect + ': wrong number of arguments (' + actual + ' for ' + expected + ')'); + }; + + // Super dispatcher + Opal.find_super_dispatcher = function(obj, mid, current_func, defcheck, defs) { + var jsid = '$' + mid, ancestors, super_method; + + if (obj.hasOwnProperty('$$meta')) { + ancestors = Opal.ancestors(obj.$$meta); + } else { + ancestors = Opal.ancestors(obj.$$class); + } + + var current_index = ancestors.indexOf(current_func.$$owner); + + for (var i = current_index + 1; i < ancestors.length; i++) { + var ancestor = ancestors[i], + proto = ancestor.prototype; + + if (proto.hasOwnProperty('$$dummy')) { + proto = proto.$$define_methods_on; + } + + if (proto.hasOwnProperty(jsid)) { + var method = proto[jsid]; + + if (!method.$$stub) { + super_method = method; + } + break; + } + } + + if (!defcheck && super_method == null && Opal.Kernel.$method_missing === obj.$method_missing) { + // method_missing hasn't been explicitly defined + throw Opal.NoMethodError.$new('super: no superclass method `'+mid+"' for "+obj, mid); + } + + return super_method; + }; + + // Iter dispatcher for super in a block + Opal.find_iter_super_dispatcher = function(obj, jsid, current_func, defcheck, implicit) { + var call_jsid = jsid; + + if (!current_func) { + throw Opal.RuntimeError.$new("super called outside of method"); + } + + if (implicit && current_func.$$define_meth) { + throw Opal.RuntimeError.$new("implicit argument passing of super from method defined by define_method() is not supported. Specify all arguments explicitly"); + } + + if (current_func.$$def) { + call_jsid = current_func.$$jsid; + } + + return Opal.find_super_dispatcher(obj, call_jsid, current_func, defcheck); + }; + + // Used to return as an expression. Sometimes, we can't simply return from + // a javascript function as if we were a method, as the return is used as + // an expression, or even inside a block which must "return" to the outer + // method. This helper simply throws an error which is then caught by the + // method. This approach is expensive, so it is only used when absolutely + // needed. + // + Opal.ret = function(val) { + Opal.returner.$v = val; + throw Opal.returner; + }; + + // Used to break out of a block. + Opal.brk = function(val, breaker) { + breaker.$v = val; + throw breaker; + }; + + // Builds a new unique breaker, this is to avoid multiple nested breaks to get + // in the way of each other. + Opal.new_brk = function() { + return new Error('unexpected break'); + }; + + // handles yield calls for 1 yielded arg + Opal.yield1 = function(block, arg) { + if (typeof(block) !== "function") { + throw Opal.LocalJumpError.$new("no block given"); + } + + var has_mlhs = block.$$has_top_level_mlhs_arg, + has_trailing_comma = block.$$has_trailing_comma_in_args; + + if (block.length > 1 || ((has_mlhs || has_trailing_comma) && block.length === 1)) { + arg = Opal.to_ary(arg); + } + + if ((block.length > 1 || (has_trailing_comma && block.length === 1)) && arg.$$is_array) { + return block.apply(null, arg); + } + else { + return block(arg); + } + }; + + // handles yield for > 1 yielded arg + Opal.yieldX = function(block, args) { + if (typeof(block) !== "function") { + throw Opal.LocalJumpError.$new("no block given"); + } + + if (block.length > 1 && args.length === 1) { + if (args[0].$$is_array) { + return block.apply(null, args[0]); + } + } + + if (!args.$$is_array) { + var args_ary = new Array(args.length); + for(var i = 0, l = args_ary.length; i < l; i++) { args_ary[i] = args[i]; } + + return block.apply(null, args_ary); + } + + return block.apply(null, args); + }; + + // Finds the corresponding exception match in candidates. Each candidate can + // be a value, or an array of values. Returns null if not found. + Opal.rescue = function(exception, candidates) { + for (var i = 0; i < candidates.length; i++) { + var candidate = candidates[i]; + + if (candidate.$$is_array) { + var result = Opal.rescue(exception, candidate); + + if (result) { + return result; + } + } + else if (candidate === Opal.JS.Error) { + return candidate; + } + else if (candidate['$==='](exception)) { + return candidate; + } + } + + return null; + }; + + Opal.is_a = function(object, klass) { + if (klass != null && object.$$meta === klass || object.$$class === klass) { + return true; + } + + if (object.$$is_number && klass.$$is_number_class) { + return true; + } + + var i, length, ancestors = Opal.ancestors(object.$$is_class ? Opal.get_singleton_class(object) : (object.$$meta || object.$$class)); + + for (i = 0, length = ancestors.length; i < length; i++) { + if (ancestors[i] === klass) { + return true; + } + } + + return false; + }; + + // Helpers for extracting kwsplats + // Used for: { **h } + Opal.to_hash = function(value) { + if (value.$$is_hash) { + return value; + } + else if (value['$respond_to?']('to_hash', true)) { + var hash = value.$to_hash(); + if (hash.$$is_hash) { + return hash; + } + else { + throw Opal.TypeError.$new("Can't convert " + value.$$class + + " to Hash (" + value.$$class + "#to_hash gives " + hash.$$class + ")"); + } + } + else { + throw Opal.TypeError.$new("no implicit conversion of " + value.$$class + " into Hash"); + } + }; + + // Helpers for implementing multiple assignment + // Our code for extracting the values and assigning them only works if the + // return value is a JS array. + // So if we get an Array subclass, extract the wrapped JS array from it + + // Used for: a, b = something (no splat) + Opal.to_ary = function(value) { + if (value.$$is_array) { + return value; + } + else if (value['$respond_to?']('to_ary', true)) { + var ary = value.$to_ary(); + if (ary === nil) { + return [value]; + } + else if (ary.$$is_array) { + return ary; + } + else { + throw Opal.TypeError.$new("Can't convert " + value.$$class + + " to Array (" + value.$$class + "#to_ary gives " + ary.$$class + ")"); + } + } + else { + return [value]; + } + }; + + // Used for: a, b = *something (with splat) + Opal.to_a = function(value) { + if (value.$$is_array) { + // A splatted array must be copied + return value.slice(); + } + else if (value['$respond_to?']('to_a', true)) { + var ary = value.$to_a(); + if (ary === nil) { + return [value]; + } + else if (ary.$$is_array) { + return ary; + } + else { + throw Opal.TypeError.$new("Can't convert " + value.$$class + + " to Array (" + value.$$class + "#to_a gives " + ary.$$class + ")"); + } + } + else { + return [value]; + } + }; + + // Used for extracting keyword arguments from arguments passed to + // JS function. If provided +arguments+ list doesn't have a Hash + // as a last item, returns a blank Hash. + // + // @param parameters [Array] + // @return [Hash] + // + Opal.extract_kwargs = function(parameters) { + var kwargs = parameters[parameters.length - 1]; + if (kwargs != null && kwargs['$respond_to?']('to_hash', true)) { + Array.prototype.splice.call(parameters, parameters.length - 1, 1); + return kwargs.$to_hash(); + } + else { + return Opal.hash2([], {}); + } + } + + // Used to get a list of rest keyword arguments. Method takes the given + // keyword args, i.e. the hash literal passed to the method containing all + // keyword arguemnts passed to method, as well as the used args which are + // the names of required and optional arguments defined. This method then + // just returns all key/value pairs which have not been used, in a new + // hash literal. + // + // @param given_args [Hash] all kwargs given to method + // @param used_args [Object] all keys used as named kwargs + // @return [Hash] + // + Opal.kwrestargs = function(given_args, used_args) { + var keys = [], + map = {}, + key = null, + given_map = given_args.$$smap; + + for (key in given_map) { + if (!used_args[key]) { + keys.push(key); + map[key] = given_map[key]; + } + } + + return Opal.hash2(keys, map); + }; + + // Calls passed method on a ruby object with arguments and block: + // + // Can take a method or a method name. + // + // 1. When method name gets passed it invokes it by its name + // and calls 'method_missing' when object doesn't have this method. + // Used internally by Opal to invoke method that takes a block or a splat. + // 2. When method (i.e. method body) gets passed, it doesn't trigger 'method_missing' + // because it doesn't know the name of the actual method. + // Used internally by Opal to invoke 'super'. + // + // @example + // var my_array = [1, 2, 3, 4] + // Opal.send(my_array, 'length') # => 4 + // Opal.send(my_array, my_array.$length) # => 4 + // + // Opal.send(my_array, 'reverse!') # => [4, 3, 2, 1] + // Opal.send(my_array, my_array['$reverse!']') # => [4, 3, 2, 1] + // + // @param recv [Object] ruby object + // @param method [Function, String] method body or name of the method + // @param args [Array] arguments that will be passed to the method call + // @param block [Function] ruby block + // @return [Object] returning value of the method call + Opal.send = function(recv, method, args, block) { + var body = (typeof(method) === 'string') ? recv['$'+method] : method; + + if (body != null) { + if (typeof block === 'function') { + body.$$p = block; + } + return body.apply(recv, args); + } + + return recv.$method_missing.apply(recv, [method].concat(args)); + } + + Opal.lambda = function(block) { + block.$$is_lambda = true; + return block; + } + + // Used to define methods on an object. This is a helper method, used by the + // compiled source to define methods on special case objects when the compiler + // can not determine the destination object, or the object is a Module + // instance. This can get called by `Module#define_method` as well. + // + // ## Modules + // + // Any method defined on a module will come through this runtime helper. + // The method is added to the module body, and the owner of the method is + // set to be the module itself. This is used later when choosing which + // method should show on a class if more than 1 included modules define + // the same method. Finally, if the module is in `module_function` mode, + // then the method is also defined onto the module itself. + // + // ## Classes + // + // This helper will only be called for classes when a method is being + // defined indirectly; either through `Module#define_method`, or by a + // literal `def` method inside an `instance_eval` or `class_eval` body. In + // either case, the method is simply added to the class' prototype. A special + // exception exists for `BasicObject` and `Object`. These two classes are + // special because they are used in toll-free bridged classes. In each of + // these two cases, extra work is required to define the methods on toll-free + // bridged class' prototypes as well. + // + // ## Objects + // + // If a simple ruby object is the object, then the method is simply just + // defined on the object as a singleton method. This would be the case when + // a method is defined inside an `instance_eval` block. + // + // @param obj [Object, Class] the actual obj to define method for + // @param jsid [String] the JavaScript friendly method name (e.g. '$foo') + // @param body [JS.Function] the literal JavaScript function used as method + // @return [null] + // + Opal.def = function(obj, jsid, body) { + // Special case for a method definition in the + // top-level namespace + if (obj === Opal.top) { + Opal.defn(Opal.Object, jsid, body) + } + // if instance_eval is invoked on a module/class, it sets inst_eval_mod + else if (!obj.$$eval && obj.$$is_a_module) { + Opal.defn(obj, jsid, body); + } + else { + Opal.defs(obj, jsid, body); + } + }; + + // Define method on a module or class (see Opal.def). + Opal.defn = function(module, jsid, body) { + body.$$owner = module; + + var proto = module.prototype; + if (proto.hasOwnProperty('$$dummy')) { + proto = proto.$$define_methods_on; + } + $defineProperty(proto, jsid, body); + + if (module.$$is_module) { + if (module.$$module_function) { + Opal.defs(module, jsid, body) + } + + for (var i = 0, iclasses = module.$$iclasses, length = iclasses.length; i < length; i++) { + var iclass = iclasses[i]; + $defineProperty(iclass, jsid, body); + } + } + + var singleton_of = module.$$singleton_of; + if (module.$method_added && !module.$method_added.$$stub && !singleton_of) { + module.$method_added(jsid.substr(1)); + } + else if (singleton_of && singleton_of.$singleton_method_added && !singleton_of.$singleton_method_added.$$stub) { + singleton_of.$singleton_method_added(jsid.substr(1)); + } + } + + // Define a singleton method on the given object (see Opal.def). + Opal.defs = function(obj, jsid, body) { + if (obj.$$is_string || obj.$$is_number) { + // That's simply impossible + return; + } + Opal.defn(Opal.get_singleton_class(obj), jsid, body) + }; + + // Called from #remove_method. + Opal.rdef = function(obj, jsid) { + if (!$hasOwn.call(obj.prototype, jsid)) { + throw Opal.NameError.$new("method '" + jsid.substr(1) + "' not defined in " + obj.$name()); + } + + delete obj.prototype[jsid]; + + if (obj.$$is_singleton) { + if (obj.prototype.$singleton_method_removed && !obj.prototype.$singleton_method_removed.$$stub) { + obj.prototype.$singleton_method_removed(jsid.substr(1)); + } + } + else { + if (obj.$method_removed && !obj.$method_removed.$$stub) { + obj.$method_removed(jsid.substr(1)); + } + } + }; + + // Called from #undef_method. + Opal.udef = function(obj, jsid) { + if (!obj.prototype[jsid] || obj.prototype[jsid].$$stub) { + throw Opal.NameError.$new("method '" + jsid.substr(1) + "' not defined in " + obj.$name()); + } + + Opal.add_stub_for(obj.prototype, jsid); + + if (obj.$$is_singleton) { + if (obj.prototype.$singleton_method_undefined && !obj.prototype.$singleton_method_undefined.$$stub) { + obj.prototype.$singleton_method_undefined(jsid.substr(1)); + } + } + else { + if (obj.$method_undefined && !obj.$method_undefined.$$stub) { + obj.$method_undefined(jsid.substr(1)); + } + } + }; + + function is_method_body(body) { + return (typeof(body) === "function" && !body.$$stub); + } + + Opal.alias = function(obj, name, old) { + var id = '$' + name, + old_id = '$' + old, + body = obj.prototype['$' + old], + alias; + + // When running inside #instance_eval the alias refers to class methods. + if (obj.$$eval) { + return Opal.alias(Opal.get_singleton_class(obj), name, old); + } + + if (!is_method_body(body)) { + var ancestor = obj.$$super; + + while (typeof(body) !== "function" && ancestor) { + body = ancestor[old_id]; + ancestor = ancestor.$$super; + } + + if (!is_method_body(body) && obj.$$is_module) { + // try to look into Object + body = Opal.Object.prototype[old_id] + } + + if (!is_method_body(body)) { + throw Opal.NameError.$new("undefined method `" + old + "' for class `" + obj.$name() + "'") + } + } + + // If the body is itself an alias use the original body + // to keep the max depth at 1. + if (body.$$alias_of) body = body.$$alias_of; + + // We need a wrapper because otherwise properties + // would be ovrewritten on the original body. + alias = function() { + var block = alias.$$p, args, i, ii; + + args = new Array(arguments.length); + for(i = 0, ii = arguments.length; i < ii; i++) { + args[i] = arguments[i]; + } + + if (block != null) { alias.$$p = null } + + return Opal.send(this, body, args, block); + }; + + // Try to make the browser pick the right name + alias.displayName = name; + alias.length = body.length; + alias.$$arity = body.$$arity; + alias.$$parameters = body.$$parameters; + alias.$$source_location = body.$$source_location; + alias.$$alias_of = body; + alias.$$alias_name = name; + + Opal.defn(obj, id, alias); + + return obj; + }; + + Opal.alias_native = function(obj, name, native_name) { + var id = '$' + name, + body = obj.prototype[native_name]; + + if (typeof(body) !== "function" || body.$$stub) { + throw Opal.NameError.$new("undefined native method `" + native_name + "' for class `" + obj.$name() + "'") + } + + Opal.defn(obj, id, body); + + return obj; + }; + + + // Hashes + // ------ + + Opal.hash_init = function(hash) { + hash.$$smap = Object.create(null); + hash.$$map = Object.create(null); + hash.$$keys = []; + }; + + Opal.hash_clone = function(from_hash, to_hash) { + to_hash.$$none = from_hash.$$none; + to_hash.$$proc = from_hash.$$proc; + + for (var i = 0, keys = from_hash.$$keys, smap = from_hash.$$smap, len = keys.length, key, value; i < len; i++) { + key = keys[i]; + + if (key.$$is_string) { + value = smap[key]; + } else { + value = key.value; + key = key.key; + } + + Opal.hash_put(to_hash, key, value); + } + }; + + Opal.hash_put = function(hash, key, value) { + if (key.$$is_string) { + if (!$hasOwn.call(hash.$$smap, key)) { + hash.$$keys.push(key); + } + hash.$$smap[key] = value; + return; + } + + var key_hash, bucket, last_bucket; + key_hash = hash.$$by_identity ? Opal.id(key) : key.$hash(); + + if (!$hasOwn.call(hash.$$map, key_hash)) { + bucket = {key: key, key_hash: key_hash, value: value}; + hash.$$keys.push(bucket); + hash.$$map[key_hash] = bucket; + return; + } + + bucket = hash.$$map[key_hash]; + + while (bucket) { + if (key === bucket.key || key['$eql?'](bucket.key)) { + last_bucket = undefined; + bucket.value = value; + break; + } + last_bucket = bucket; + bucket = bucket.next; + } + + if (last_bucket) { + bucket = {key: key, key_hash: key_hash, value: value}; + hash.$$keys.push(bucket); + last_bucket.next = bucket; + } + }; + + Opal.hash_get = function(hash, key) { + if (key.$$is_string) { + if ($hasOwn.call(hash.$$smap, key)) { + return hash.$$smap[key]; + } + return; + } + + var key_hash, bucket; + key_hash = hash.$$by_identity ? Opal.id(key) : key.$hash(); + + if ($hasOwn.call(hash.$$map, key_hash)) { + bucket = hash.$$map[key_hash]; + + while (bucket) { + if (key === bucket.key || key['$eql?'](bucket.key)) { + return bucket.value; + } + bucket = bucket.next; + } + } + }; + + Opal.hash_delete = function(hash, key) { + var i, keys = hash.$$keys, length = keys.length, value; + + if (key.$$is_string) { + if (!$hasOwn.call(hash.$$smap, key)) { + return; + } + + for (i = 0; i < length; i++) { + if (keys[i] === key) { + keys.splice(i, 1); + break; + } + } + + value = hash.$$smap[key]; + delete hash.$$smap[key]; + return value; + } + + var key_hash = key.$hash(); + + if (!$hasOwn.call(hash.$$map, key_hash)) { + return; + } + + var bucket = hash.$$map[key_hash], last_bucket; + + while (bucket) { + if (key === bucket.key || key['$eql?'](bucket.key)) { + value = bucket.value; + + for (i = 0; i < length; i++) { + if (keys[i] === bucket) { + keys.splice(i, 1); + break; + } + } + + if (last_bucket && bucket.next) { + last_bucket.next = bucket.next; + } + else if (last_bucket) { + delete last_bucket.next; + } + else if (bucket.next) { + hash.$$map[key_hash] = bucket.next; + } + else { + delete hash.$$map[key_hash]; + } + + return value; + } + last_bucket = bucket; + bucket = bucket.next; + } + }; + + Opal.hash_rehash = function(hash) { + for (var i = 0, length = hash.$$keys.length, key_hash, bucket, last_bucket; i < length; i++) { + + if (hash.$$keys[i].$$is_string) { + continue; + } + + key_hash = hash.$$keys[i].key.$hash(); + + if (key_hash === hash.$$keys[i].key_hash) { + continue; + } + + bucket = hash.$$map[hash.$$keys[i].key_hash]; + last_bucket = undefined; + + while (bucket) { + if (bucket === hash.$$keys[i]) { + if (last_bucket && bucket.next) { + last_bucket.next = bucket.next; + } + else if (last_bucket) { + delete last_bucket.next; + } + else if (bucket.next) { + hash.$$map[hash.$$keys[i].key_hash] = bucket.next; + } + else { + delete hash.$$map[hash.$$keys[i].key_hash]; + } + break; + } + last_bucket = bucket; + bucket = bucket.next; + } + + hash.$$keys[i].key_hash = key_hash; + + if (!$hasOwn.call(hash.$$map, key_hash)) { + hash.$$map[key_hash] = hash.$$keys[i]; + continue; + } + + bucket = hash.$$map[key_hash]; + last_bucket = undefined; + + while (bucket) { + if (bucket === hash.$$keys[i]) { + last_bucket = undefined; + break; + } + last_bucket = bucket; + bucket = bucket.next; + } + + if (last_bucket) { + last_bucket.next = hash.$$keys[i]; + } + } + }; + + Opal.hash = function() { + var arguments_length = arguments.length, args, hash, i, length, key, value; + + if (arguments_length === 1 && arguments[0].$$is_hash) { + return arguments[0]; + } + + hash = new Opal.Hash(); + Opal.hash_init(hash); + + if (arguments_length === 1 && arguments[0].$$is_array) { + args = arguments[0]; + length = args.length; + + for (i = 0; i < length; i++) { + if (args[i].length !== 2) { + throw Opal.ArgumentError.$new("value not of length 2: " + args[i].$inspect()); + } + + key = args[i][0]; + value = args[i][1]; + + Opal.hash_put(hash, key, value); + } + + return hash; + } + + if (arguments_length === 1) { + args = arguments[0]; + for (key in args) { + if ($hasOwn.call(args, key)) { + value = args[key]; + + Opal.hash_put(hash, key, value); + } + } + + return hash; + } + + if (arguments_length % 2 !== 0) { + throw Opal.ArgumentError.$new("odd number of arguments for Hash"); + } + + for (i = 0; i < arguments_length; i += 2) { + key = arguments[i]; + value = arguments[i + 1]; + + Opal.hash_put(hash, key, value); + } + + return hash; + }; + + // A faster Hash creator for hashes that just use symbols and + // strings as keys. The map and keys array can be constructed at + // compile time, so they are just added here by the constructor + // function. + // + Opal.hash2 = function(keys, smap) { + var hash = new Opal.Hash(); + + hash.$$smap = smap; + hash.$$map = Object.create(null); + hash.$$keys = keys; + + return hash; + }; + + // Create a new range instance with first and last values, and whether the + // range excludes the last value. + // + Opal.range = function(first, last, exc) { + var range = new Opal.Range(); + range.begin = first; + range.end = last; + range.excl = exc; + + return range; + }; + + // Get the ivar name for a given name. + // Mostly adds a trailing $ to reserved names. + // + Opal.ivar = function(name) { + if ( + // properties + name === "constructor" || + name === "displayName" || + name === "__count__" || + name === "__noSuchMethod__" || + name === "__parent__" || + name === "__proto__" || + + // methods + name === "hasOwnProperty" || + name === "valueOf" + ) + { + return name + "$"; + } + + return name; + }; + + + // Regexps + // ------- + + // Escape Regexp special chars letting the resulting string be used to build + // a new Regexp. + // + Opal.escape_regexp = function(str) { + return str.replace(/([-[\]\/{}()*+?.^$\\| ])/g, '\\$1') + .replace(/[\n]/g, '\\n') + .replace(/[\r]/g, '\\r') + .replace(/[\f]/g, '\\f') + .replace(/[\t]/g, '\\t'); + }; + + // Create a global Regexp from a RegExp object and cache the result + // on the object itself ($$g attribute). + // + Opal.global_regexp = function(pattern) { + if (pattern.global) { + return pattern; // RegExp already has the global flag + } + if (pattern.$$g == null) { + pattern.$$g = new RegExp(pattern.source, (pattern.multiline ? 'gm' : 'g') + (pattern.ignoreCase ? 'i' : '')); + } else { + pattern.$$g.lastIndex = null; // reset lastIndex property + } + return pattern.$$g; + }; + + // Create a global multiline Regexp from a RegExp object and cache the result + // on the object itself ($$gm or $$g attribute). + // + Opal.global_multiline_regexp = function(pattern) { + var result; + if (pattern.multiline) { + if (pattern.global) { + return pattern; // RegExp already has the global and multiline flag + } + // we are using the $$g attribute because the Regexp is already multiline + if (pattern.$$g != null) { + result = pattern.$$g; + } else { + result = pattern.$$g = new RegExp(pattern.source, 'gm' + (pattern.ignoreCase ? 'i' : '')); + } + } else if (pattern.$$gm != null) { + result = pattern.$$gm; + } else { + result = pattern.$$gm = new RegExp(pattern.source, 'gm' + (pattern.ignoreCase ? 'i' : '')); + } + result.lastIndex = null; // reset lastIndex property + return result; + }; + + // Require system + // -------------- + + Opal.modules = {}; + Opal.loaded_features = ['corelib/runtime']; + Opal.current_dir = '.'; + Opal.require_table = {'corelib/runtime': true}; + + Opal.normalize = function(path) { + var parts, part, new_parts = [], SEPARATOR = '/'; + + if (Opal.current_dir !== '.') { + path = Opal.current_dir.replace(/\/*$/, '/') + path; + } + + path = path.replace(/^\.\//, ''); + path = path.replace(/\.(rb|opal|js)$/, ''); + parts = path.split(SEPARATOR); + + for (var i = 0, ii = parts.length; i < ii; i++) { + part = parts[i]; + if (part === '') continue; + (part === '..') ? new_parts.pop() : new_parts.push(part) + } + + return new_parts.join(SEPARATOR); + }; + + Opal.loaded = function(paths) { + var i, l, path; + + for (i = 0, l = paths.length; i < l; i++) { + path = Opal.normalize(paths[i]); + + if (Opal.require_table[path]) { + continue; + } + + Opal.loaded_features.push(path); + Opal.require_table[path] = true; + } + }; + + Opal.load = function(path) { + path = Opal.normalize(path); + + Opal.loaded([path]); + + var module = Opal.modules[path]; + + if (module) { + module(Opal); + } + else { + var severity = Opal.config.missing_require_severity; + var message = 'cannot load such file -- ' + path; + + if (severity === "error") { + if (Opal.LoadError) { + throw Opal.LoadError.$new(message) + } else { + throw message + } + } + else if (severity === "warning") { + console.warn('WARNING: LoadError: ' + message); + } + } + + return true; + }; + + Opal.require = function(path) { + path = Opal.normalize(path); + + if (Opal.require_table[path]) { + return false; + } + + return Opal.load(path); + }; + + + // Initialization + // -------------- + function $BasicObject() {}; + function $Object() {}; + function $Module() {}; + function $Class() {}; + + Opal.BasicObject = BasicObject = Opal.allocate_class('BasicObject', null, $BasicObject); + Opal.Object = _Object = Opal.allocate_class('Object', Opal.BasicObject, $Object); + Opal.Module = Module = Opal.allocate_class('Module', Opal.Object, $Module); + Opal.Class = Class = Opal.allocate_class('Class', Opal.Module, $Class); + + $setPrototype(Opal.BasicObject, Opal.Class.prototype); + $setPrototype(Opal.Object, Opal.Class.prototype); + $setPrototype(Opal.Module, Opal.Class.prototype); + $setPrototype(Opal.Class, Opal.Class.prototype); + + // BasicObject can reach itself, avoid const_set to skip the $$base_module logic + BasicObject.$$const["BasicObject"] = BasicObject; + + // Assign basic constants + Opal.const_set(_Object, "BasicObject", BasicObject); + Opal.const_set(_Object, "Object", _Object); + Opal.const_set(_Object, "Module", Module); + Opal.const_set(_Object, "Class", Class); + + // Fix booted classes to have correct .class value + BasicObject.$$class = Class; + _Object.$$class = Class; + Module.$$class = Class; + Class.$$class = Class; + + // Forward .toString() to #to_s + $defineProperty(_Object.prototype, 'toString', function() { + var to_s = this.$to_s(); + if (to_s.$$is_string && typeof(to_s) === 'object') { + // a string created using new String('string') + return to_s.valueOf(); + } else { + return to_s; + } + }); + + // Make Kernel#require immediately available as it's needed to require all the + // other corelib files. + $defineProperty(_Object.prototype, '$require', Opal.require); + + // Add a short helper to navigate constants manually. + // @example + // Opal.$$.Regexp.$$.IGNORECASE + Opal.$$ = _Object.$$; + + // Instantiate the main object + Opal.top = new _Object(); + Opal.top.$to_s = Opal.top.$inspect = function() { return 'main' }; + + + // Nil + function $NilClass() {}; + Opal.NilClass = Opal.allocate_class('NilClass', Opal.Object, $NilClass); + Opal.const_set(_Object, 'NilClass', Opal.NilClass); + nil = Opal.nil = new Opal.NilClass(); + nil.$$id = nil_id; + nil.call = nil.apply = function() { throw Opal.LocalJumpError.$new('no block given'); }; + + // Errors + Opal.breaker = new Error('unexpected break (old)'); + Opal.returner = new Error('unexpected return'); + TypeError.$$super = Error; +}).call(this); +Opal.loaded(["corelib/runtime.js"]); +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/helpers"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $truthy = Opal.truthy; + + Opal.add_stubs(['$new', '$class', '$===', '$respond_to?', '$raise', '$type_error', '$__send__', '$coerce_to', '$nil?', '$<=>', '$coerce_to!', '$!=', '$[]', '$upcase']); + return (function($base, $parent_nesting) { + function $Opal() {}; + var self = $Opal = $module($base, 'Opal', $Opal); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Opal_bridge_1, TMP_Opal_type_error_2, TMP_Opal_coerce_to_3, TMP_Opal_coerce_to$B_4, TMP_Opal_coerce_to$q_5, TMP_Opal_try_convert_6, TMP_Opal_compare_7, TMP_Opal_destructure_8, TMP_Opal_respond_to$q_9, TMP_Opal_inspect_obj_10, TMP_Opal_instance_variable_name$B_11, TMP_Opal_class_variable_name$B_12, TMP_Opal_const_name$B_13, TMP_Opal_pristine_14; + + + Opal.defs(self, '$bridge', TMP_Opal_bridge_1 = function $$bridge(constructor, klass) { + var self = this; + + return Opal.bridge(constructor, klass); + }, TMP_Opal_bridge_1.$$arity = 2); + Opal.defs(self, '$type_error', TMP_Opal_type_error_2 = function $$type_error(object, type, method, coerced) { + var $a, self = this; + + + + if (method == null) { + method = nil; + }; + + if (coerced == null) { + coerced = nil; + }; + if ($truthy(($truthy($a = method) ? coerced : $a))) { + return $$($nesting, 'TypeError').$new("" + "can't convert " + (object.$class()) + " into " + (type) + " (" + (object.$class()) + "#" + (method) + " gives " + (coerced.$class()) + ")") + } else { + return $$($nesting, 'TypeError').$new("" + "no implicit conversion of " + (object.$class()) + " into " + (type)) + }; + }, TMP_Opal_type_error_2.$$arity = -3); + Opal.defs(self, '$coerce_to', TMP_Opal_coerce_to_3 = function $$coerce_to(object, type, method) { + var self = this; + + + if ($truthy(type['$==='](object))) { + return object}; + if ($truthy(object['$respond_to?'](method))) { + } else { + self.$raise(self.$type_error(object, type)) + }; + return object.$__send__(method); + }, TMP_Opal_coerce_to_3.$$arity = 3); + Opal.defs(self, '$coerce_to!', TMP_Opal_coerce_to$B_4 = function(object, type, method) { + var self = this, coerced = nil; + + + coerced = self.$coerce_to(object, type, method); + if ($truthy(type['$==='](coerced))) { + } else { + self.$raise(self.$type_error(object, type, method, coerced)) + }; + return coerced; + }, TMP_Opal_coerce_to$B_4.$$arity = 3); + Opal.defs(self, '$coerce_to?', TMP_Opal_coerce_to$q_5 = function(object, type, method) { + var self = this, coerced = nil; + + + if ($truthy(object['$respond_to?'](method))) { + } else { + return nil + }; + coerced = self.$coerce_to(object, type, method); + if ($truthy(coerced['$nil?']())) { + return nil}; + if ($truthy(type['$==='](coerced))) { + } else { + self.$raise(self.$type_error(object, type, method, coerced)) + }; + return coerced; + }, TMP_Opal_coerce_to$q_5.$$arity = 3); + Opal.defs(self, '$try_convert', TMP_Opal_try_convert_6 = function $$try_convert(object, type, method) { + var self = this; + + + if ($truthy(type['$==='](object))) { + return object}; + if ($truthy(object['$respond_to?'](method))) { + return object.$__send__(method) + } else { + return nil + }; + }, TMP_Opal_try_convert_6.$$arity = 3); + Opal.defs(self, '$compare', TMP_Opal_compare_7 = function $$compare(a, b) { + var self = this, compare = nil; + + + compare = a['$<=>'](b); + if ($truthy(compare === nil)) { + self.$raise($$($nesting, 'ArgumentError'), "" + "comparison of " + (a.$class()) + " with " + (b.$class()) + " failed")}; + return compare; + }, TMP_Opal_compare_7.$$arity = 2); + Opal.defs(self, '$destructure', TMP_Opal_destructure_8 = function $$destructure(args) { + var self = this; + + + if (args.length == 1) { + return args[0]; + } + else if (args.$$is_array) { + return args; + } + else { + var args_ary = new Array(args.length); + for(var i = 0, l = args_ary.length; i < l; i++) { args_ary[i] = args[i]; } + + return args_ary; + } + + }, TMP_Opal_destructure_8.$$arity = 1); + Opal.defs(self, '$respond_to?', TMP_Opal_respond_to$q_9 = function(obj, method, include_all) { + var self = this; + + + + if (include_all == null) { + include_all = false; + }; + + if (obj == null || !obj.$$class) { + return false; + } + ; + return obj['$respond_to?'](method, include_all); + }, TMP_Opal_respond_to$q_9.$$arity = -3); + Opal.defs(self, '$inspect_obj', TMP_Opal_inspect_obj_10 = function $$inspect_obj(obj) { + var self = this; + + return Opal.inspect(obj); + }, TMP_Opal_inspect_obj_10.$$arity = 1); + Opal.defs(self, '$instance_variable_name!', TMP_Opal_instance_variable_name$B_11 = function(name) { + var self = this; + + + name = $$($nesting, 'Opal')['$coerce_to!'](name, $$($nesting, 'String'), "to_str"); + if ($truthy(/^@[a-zA-Z_][a-zA-Z0-9_]*?$/.test(name))) { + } else { + self.$raise($$($nesting, 'NameError').$new("" + "'" + (name) + "' is not allowed as an instance variable name", name)) + }; + return name; + }, TMP_Opal_instance_variable_name$B_11.$$arity = 1); + Opal.defs(self, '$class_variable_name!', TMP_Opal_class_variable_name$B_12 = function(name) { + var self = this; + + + name = $$($nesting, 'Opal')['$coerce_to!'](name, $$($nesting, 'String'), "to_str"); + if ($truthy(name.length < 3 || name.slice(0,2) !== '@@')) { + self.$raise($$($nesting, 'NameError').$new("" + "`" + (name) + "' is not allowed as a class variable name", name))}; + return name; + }, TMP_Opal_class_variable_name$B_12.$$arity = 1); + Opal.defs(self, '$const_name!', TMP_Opal_const_name$B_13 = function(const_name) { + var self = this; + + + const_name = $$($nesting, 'Opal')['$coerce_to!'](const_name, $$($nesting, 'String'), "to_str"); + if ($truthy(const_name['$[]'](0)['$!='](const_name['$[]'](0).$upcase()))) { + self.$raise($$($nesting, 'NameError'), "" + "wrong constant name " + (const_name))}; + return const_name; + }, TMP_Opal_const_name$B_13.$$arity = 1); + Opal.defs(self, '$pristine', TMP_Opal_pristine_14 = function $$pristine(owner_class, $a) { + var $post_args, method_names, self = this; + + + + $post_args = Opal.slice.call(arguments, 1, arguments.length); + + method_names = $post_args;; + + var method_name, method; + for (var i = method_names.length - 1; i >= 0; i--) { + method_name = method_names[i]; + method = owner_class.prototype['$'+method_name]; + + if (method && !method.$$stub) { + method.$$pristine = true; + } + } + ; + return nil; + }, TMP_Opal_pristine_14.$$arity = -2); + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/module"] = function(Opal) { + function $rb_lt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); + } + function $rb_gt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $send = Opal.send, $truthy = Opal.truthy, $lambda = Opal.lambda, $range = Opal.range, $hash2 = Opal.hash2; + + Opal.add_stubs(['$module_eval', '$to_proc', '$===', '$raise', '$equal?', '$<', '$>', '$nil?', '$attr_reader', '$attr_writer', '$class_variable_name!', '$new', '$const_name!', '$=~', '$inject', '$split', '$const_get', '$==', '$!~', '$start_with?', '$bind', '$call', '$class', '$append_features', '$included', '$name', '$cover?', '$size', '$merge', '$compile', '$proc', '$any?', '$prepend_features', '$prepended', '$to_s', '$__id__', '$constants', '$include?', '$copy_class_variables', '$copy_constants']); + return (function($base, $super, $parent_nesting) { + function $Module(){}; + var self = $Module = $klass($base, $super, 'Module', $Module); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Module_allocate_1, TMP_Module_inherited_2, TMP_Module_initialize_3, TMP_Module_$eq$eq$eq_4, TMP_Module_$lt_5, TMP_Module_$lt$eq_6, TMP_Module_$gt_7, TMP_Module_$gt$eq_8, TMP_Module_$lt$eq$gt_9, TMP_Module_alias_method_10, TMP_Module_alias_native_11, TMP_Module_ancestors_12, TMP_Module_append_features_13, TMP_Module_attr_accessor_14, TMP_Module_attr_reader_15, TMP_Module_attr_writer_16, TMP_Module_autoload_17, TMP_Module_class_variables_18, TMP_Module_class_variable_get_19, TMP_Module_class_variable_set_20, TMP_Module_class_variable_defined$q_21, TMP_Module_remove_class_variable_22, TMP_Module_constants_23, TMP_Module_constants_24, TMP_Module_nesting_25, TMP_Module_const_defined$q_26, TMP_Module_const_get_27, TMP_Module_const_missing_29, TMP_Module_const_set_30, TMP_Module_public_constant_31, TMP_Module_define_method_32, TMP_Module_remove_method_34, TMP_Module_singleton_class$q_35, TMP_Module_include_36, TMP_Module_included_modules_37, TMP_Module_include$q_38, TMP_Module_instance_method_39, TMP_Module_instance_methods_40, TMP_Module_included_41, TMP_Module_extended_42, TMP_Module_extend_object_43, TMP_Module_method_added_44, TMP_Module_method_removed_45, TMP_Module_method_undefined_46, TMP_Module_module_eval_47, TMP_Module_module_exec_49, TMP_Module_method_defined$q_50, TMP_Module_module_function_51, TMP_Module_name_52, TMP_Module_prepend_53, TMP_Module_prepend_features_54, TMP_Module_prepended_55, TMP_Module_remove_const_56, TMP_Module_to_s_57, TMP_Module_undef_method_58, TMP_Module_instance_variables_59, TMP_Module_dup_60, TMP_Module_copy_class_variables_61, TMP_Module_copy_constants_62; + + + Opal.defs(self, '$allocate', TMP_Module_allocate_1 = function $$allocate() { + var self = this; + + + var module = Opal.allocate_module(nil, function(){}); + return module; + + }, TMP_Module_allocate_1.$$arity = 0); + Opal.defs(self, '$inherited', TMP_Module_inherited_2 = function $$inherited(klass) { + var self = this; + + + klass.$allocate = function() { + var module = Opal.allocate_module(nil, function(){}); + Object.setPrototypeOf(module, klass.prototype); + return module; + } + + }, TMP_Module_inherited_2.$$arity = 1); + + Opal.def(self, '$initialize', TMP_Module_initialize_3 = function $$initialize() { + var $iter = TMP_Module_initialize_3.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Module_initialize_3.$$p = null; + + + if ($iter) TMP_Module_initialize_3.$$p = null;; + if ((block !== nil)) { + return $send(self, 'module_eval', [], block.$to_proc()) + } else { + return nil + }; + }, TMP_Module_initialize_3.$$arity = 0); + + Opal.def(self, '$===', TMP_Module_$eq$eq$eq_4 = function(object) { + var self = this; + + + if ($truthy(object == null)) { + return false}; + return Opal.is_a(object, self);; + }, TMP_Module_$eq$eq$eq_4.$$arity = 1); + + Opal.def(self, '$<', TMP_Module_$lt_5 = function(other) { + var self = this; + + + if ($truthy($$($nesting, 'Module')['$==='](other))) { + } else { + self.$raise($$($nesting, 'TypeError'), "compared with non class/module") + }; + + var working = self, + ancestors, + i, length; + + if (working === other) { + return false; + } + + for (i = 0, ancestors = Opal.ancestors(self), length = ancestors.length; i < length; i++) { + if (ancestors[i] === other) { + return true; + } + } + + for (i = 0, ancestors = Opal.ancestors(other), length = ancestors.length; i < length; i++) { + if (ancestors[i] === self) { + return false; + } + } + + return nil; + ; + }, TMP_Module_$lt_5.$$arity = 1); + + Opal.def(self, '$<=', TMP_Module_$lt$eq_6 = function(other) { + var $a, self = this; + + return ($truthy($a = self['$equal?'](other)) ? $a : $rb_lt(self, other)) + }, TMP_Module_$lt$eq_6.$$arity = 1); + + Opal.def(self, '$>', TMP_Module_$gt_7 = function(other) { + var self = this; + + + if ($truthy($$($nesting, 'Module')['$==='](other))) { + } else { + self.$raise($$($nesting, 'TypeError'), "compared with non class/module") + }; + return $rb_lt(other, self); + }, TMP_Module_$gt_7.$$arity = 1); + + Opal.def(self, '$>=', TMP_Module_$gt$eq_8 = function(other) { + var $a, self = this; + + return ($truthy($a = self['$equal?'](other)) ? $a : $rb_gt(self, other)) + }, TMP_Module_$gt$eq_8.$$arity = 1); + + Opal.def(self, '$<=>', TMP_Module_$lt$eq$gt_9 = function(other) { + var self = this, lt = nil; + + + + if (self === other) { + return 0; + } + ; + if ($truthy($$($nesting, 'Module')['$==='](other))) { + } else { + return nil + }; + lt = $rb_lt(self, other); + if ($truthy(lt['$nil?']())) { + return nil}; + if ($truthy(lt)) { + return -1 + } else { + return 1 + }; + }, TMP_Module_$lt$eq$gt_9.$$arity = 1); + + Opal.def(self, '$alias_method', TMP_Module_alias_method_10 = function $$alias_method(newname, oldname) { + var self = this; + + + Opal.alias(self, newname, oldname); + return self; + }, TMP_Module_alias_method_10.$$arity = 2); + + Opal.def(self, '$alias_native', TMP_Module_alias_native_11 = function $$alias_native(mid, jsid) { + var self = this; + + + + if (jsid == null) { + jsid = mid; + }; + Opal.alias_native(self, mid, jsid); + return self; + }, TMP_Module_alias_native_11.$$arity = -2); + + Opal.def(self, '$ancestors', TMP_Module_ancestors_12 = function $$ancestors() { + var self = this; + + return Opal.ancestors(self); + }, TMP_Module_ancestors_12.$$arity = 0); + + Opal.def(self, '$append_features', TMP_Module_append_features_13 = function $$append_features(includer) { + var self = this; + + + Opal.append_features(self, includer); + return self; + }, TMP_Module_append_features_13.$$arity = 1); + + Opal.def(self, '$attr_accessor', TMP_Module_attr_accessor_14 = function $$attr_accessor($a) { + var $post_args, names, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + names = $post_args;; + $send(self, 'attr_reader', Opal.to_a(names)); + return $send(self, 'attr_writer', Opal.to_a(names)); + }, TMP_Module_attr_accessor_14.$$arity = -1); + Opal.alias(self, "attr", "attr_accessor"); + + Opal.def(self, '$attr_reader', TMP_Module_attr_reader_15 = function $$attr_reader($a) { + var $post_args, names, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + names = $post_args;; + + var proto = self.prototype; + + for (var i = names.length - 1; i >= 0; i--) { + var name = names[i], + id = '$' + name, + ivar = Opal.ivar(name); + + // the closure here is needed because name will change at the next + // cycle, I wish we could use let. + var body = (function(ivar) { + return function() { + if (this[ivar] == null) { + return nil; + } + else { + return this[ivar]; + } + }; + })(ivar); + + // initialize the instance variable as nil + Opal.defineProperty(proto, ivar, nil); + + body.$$parameters = []; + body.$$arity = 0; + + Opal.defn(self, id, body); + } + ; + return nil; + }, TMP_Module_attr_reader_15.$$arity = -1); + + Opal.def(self, '$attr_writer', TMP_Module_attr_writer_16 = function $$attr_writer($a) { + var $post_args, names, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + names = $post_args;; + + var proto = self.prototype; + + for (var i = names.length - 1; i >= 0; i--) { + var name = names[i], + id = '$' + name + '=', + ivar = Opal.ivar(name); + + // the closure here is needed because name will change at the next + // cycle, I wish we could use let. + var body = (function(ivar){ + return function(value) { + return this[ivar] = value; + } + })(ivar); + + body.$$parameters = [['req']]; + body.$$arity = 1; + + // initialize the instance variable as nil + Opal.defineProperty(proto, ivar, nil); + + Opal.defn(self, id, body); + } + ; + return nil; + }, TMP_Module_attr_writer_16.$$arity = -1); + + Opal.def(self, '$autoload', TMP_Module_autoload_17 = function $$autoload(const$, path) { + var self = this; + + + if (self.$$autoload == null) self.$$autoload = {}; + Opal.const_cache_version++; + self.$$autoload[const$] = path; + return nil; + + }, TMP_Module_autoload_17.$$arity = 2); + + Opal.def(self, '$class_variables', TMP_Module_class_variables_18 = function $$class_variables() { + var self = this; + + return Object.keys(Opal.class_variables(self)); + }, TMP_Module_class_variables_18.$$arity = 0); + + Opal.def(self, '$class_variable_get', TMP_Module_class_variable_get_19 = function $$class_variable_get(name) { + var self = this; + + + name = $$($nesting, 'Opal')['$class_variable_name!'](name); + + var value = Opal.class_variables(self)[name]; + if (value == null) { + self.$raise($$($nesting, 'NameError').$new("" + "uninitialized class variable " + (name) + " in " + (self), name)) + } + return value; + ; + }, TMP_Module_class_variable_get_19.$$arity = 1); + + Opal.def(self, '$class_variable_set', TMP_Module_class_variable_set_20 = function $$class_variable_set(name, value) { + var self = this; + + + name = $$($nesting, 'Opal')['$class_variable_name!'](name); + return Opal.class_variable_set(self, name, value);; + }, TMP_Module_class_variable_set_20.$$arity = 2); + + Opal.def(self, '$class_variable_defined?', TMP_Module_class_variable_defined$q_21 = function(name) { + var self = this; + + + name = $$($nesting, 'Opal')['$class_variable_name!'](name); + return Opal.class_variables(self).hasOwnProperty(name);; + }, TMP_Module_class_variable_defined$q_21.$$arity = 1); + + Opal.def(self, '$remove_class_variable', TMP_Module_remove_class_variable_22 = function $$remove_class_variable(name) { + var self = this; + + + name = $$($nesting, 'Opal')['$class_variable_name!'](name); + + if (Opal.hasOwnProperty.call(self.$$cvars, name)) { + var value = self.$$cvars[name]; + delete self.$$cvars[name]; + return value; + } else { + self.$raise($$($nesting, 'NameError'), "" + "cannot remove " + (name) + " for " + (self)) + } + ; + }, TMP_Module_remove_class_variable_22.$$arity = 1); + + Opal.def(self, '$constants', TMP_Module_constants_23 = function $$constants(inherit) { + var self = this; + + + + if (inherit == null) { + inherit = true; + }; + return Opal.constants(self, inherit);; + }, TMP_Module_constants_23.$$arity = -1); + Opal.defs(self, '$constants', TMP_Module_constants_24 = function $$constants(inherit) { + var self = this; + + + ; + + if (inherit == null) { + var nesting = (self.$$nesting || []).concat(Opal.Object), + constant, constants = {}, + i, ii; + + for(i = 0, ii = nesting.length; i < ii; i++) { + for (constant in nesting[i].$$const) { + constants[constant] = true; + } + } + return Object.keys(constants); + } else { + return Opal.constants(self, inherit) + } + ; + }, TMP_Module_constants_24.$$arity = -1); + Opal.defs(self, '$nesting', TMP_Module_nesting_25 = function $$nesting() { + var self = this; + + return self.$$nesting || []; + }, TMP_Module_nesting_25.$$arity = 0); + + Opal.def(self, '$const_defined?', TMP_Module_const_defined$q_26 = function(name, inherit) { + var self = this; + + + + if (inherit == null) { + inherit = true; + }; + name = $$($nesting, 'Opal')['$const_name!'](name); + if ($truthy(name['$=~']($$$($$($nesting, 'Opal'), 'CONST_NAME_REGEXP')))) { + } else { + self.$raise($$($nesting, 'NameError').$new("" + "wrong constant name " + (name), name)) + }; + + var module, modules = [self], module_constants, i, ii; + + // Add up ancestors if inherit is true + if (inherit) { + modules = modules.concat(Opal.ancestors(self)); + + // Add Object's ancestors if it's a module – modules have no ancestors otherwise + if (self.$$is_module) { + modules = modules.concat([Opal.Object]).concat(Opal.ancestors(Opal.Object)); + } + } + + for (i = 0, ii = modules.length; i < ii; i++) { + module = modules[i]; + if (module.$$const[name] != null) { + return true; + } + } + + return false; + ; + }, TMP_Module_const_defined$q_26.$$arity = -2); + + Opal.def(self, '$const_get', TMP_Module_const_get_27 = function $$const_get(name, inherit) { + var TMP_28, self = this; + + + + if (inherit == null) { + inherit = true; + }; + name = $$($nesting, 'Opal')['$const_name!'](name); + + if (name.indexOf('::') === 0 && name !== '::'){ + name = name.slice(2); + } + ; + if ($truthy(name.indexOf('::') != -1 && name != '::')) { + return $send(name.$split("::"), 'inject', [self], (TMP_28 = function(o, c){var self = TMP_28.$$s || this; + + + + if (o == null) { + o = nil; + }; + + if (c == null) { + c = nil; + }; + return o.$const_get(c);}, TMP_28.$$s = self, TMP_28.$$arity = 2, TMP_28))}; + if ($truthy(name['$=~']($$$($$($nesting, 'Opal'), 'CONST_NAME_REGEXP')))) { + } else { + self.$raise($$($nesting, 'NameError').$new("" + "wrong constant name " + (name), name)) + }; + + if (inherit) { + return $$([self], name); + } else { + return Opal.const_get_local(self, name); + } + ; + }, TMP_Module_const_get_27.$$arity = -2); + + Opal.def(self, '$const_missing', TMP_Module_const_missing_29 = function $$const_missing(name) { + var self = this, full_const_name = nil; + + + + if (self.$$autoload) { + var file = self.$$autoload[name]; + + if (file) { + self.$require(file); + + return self.$const_get(name); + } + } + ; + full_const_name = (function() {if (self['$==']($$($nesting, 'Object'))) { + return name + } else { + return "" + (self) + "::" + (name) + }; return nil; })(); + return self.$raise($$($nesting, 'NameError').$new("" + "uninitialized constant " + (full_const_name), name)); + }, TMP_Module_const_missing_29.$$arity = 1); + + Opal.def(self, '$const_set', TMP_Module_const_set_30 = function $$const_set(name, value) { + var $a, self = this; + + + name = $$($nesting, 'Opal')['$const_name!'](name); + if ($truthy(($truthy($a = name['$!~']($$$($$($nesting, 'Opal'), 'CONST_NAME_REGEXP'))) ? $a : name['$start_with?']("::")))) { + self.$raise($$($nesting, 'NameError').$new("" + "wrong constant name " + (name), name))}; + Opal.const_set(self, name, value); + return value; + }, TMP_Module_const_set_30.$$arity = 2); + + Opal.def(self, '$public_constant', TMP_Module_public_constant_31 = function $$public_constant(const_name) { + var self = this; + + return nil + }, TMP_Module_public_constant_31.$$arity = 1); + + Opal.def(self, '$define_method', TMP_Module_define_method_32 = function $$define_method(name, method) { + var $iter = TMP_Module_define_method_32.$$p, block = $iter || nil, $a, TMP_33, self = this, $case = nil; + + if ($iter) TMP_Module_define_method_32.$$p = null; + + + if ($iter) TMP_Module_define_method_32.$$p = null;; + ; + if ($truthy(method === undefined && block === nil)) { + self.$raise($$($nesting, 'ArgumentError'), "tried to create a Proc object without a block")}; + block = ($truthy($a = block) ? $a : (function() {$case = method; + if ($$($nesting, 'Proc')['$===']($case)) {return method} + else if ($$($nesting, 'Method')['$===']($case)) {return method.$to_proc().$$unbound} + else if ($$($nesting, 'UnboundMethod')['$===']($case)) {return $lambda((TMP_33 = function($b){var self = TMP_33.$$s || this, $post_args, args, bound = nil; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + bound = method.$bind(self); + return $send(bound, 'call', Opal.to_a(args));}, TMP_33.$$s = self, TMP_33.$$arity = -1, TMP_33))} + else {return self.$raise($$($nesting, 'TypeError'), "" + "wrong argument type " + (block.$class()) + " (expected Proc/Method)")}})()); + + var id = '$' + name; + + block.$$jsid = name; + block.$$s = null; + block.$$def = block; + block.$$define_meth = true; + + Opal.defn(self, id, block); + + return name; + ; + }, TMP_Module_define_method_32.$$arity = -2); + + Opal.def(self, '$remove_method', TMP_Module_remove_method_34 = function $$remove_method($a) { + var $post_args, names, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + names = $post_args;; + + for (var i = 0, length = names.length; i < length; i++) { + Opal.rdef(self, "$" + names[i]); + } + ; + return self; + }, TMP_Module_remove_method_34.$$arity = -1); + + Opal.def(self, '$singleton_class?', TMP_Module_singleton_class$q_35 = function() { + var self = this; + + return !!self.$$is_singleton; + }, TMP_Module_singleton_class$q_35.$$arity = 0); + + Opal.def(self, '$include', TMP_Module_include_36 = function $$include($a) { + var $post_args, mods, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + mods = $post_args;; + + for (var i = mods.length - 1; i >= 0; i--) { + var mod = mods[i]; + + if (!mod.$$is_module) { + self.$raise($$($nesting, 'TypeError'), "" + "wrong argument type " + ((mod).$class()) + " (expected Module)"); + } + + (mod).$append_features(self); + (mod).$included(self); + } + ; + return self; + }, TMP_Module_include_36.$$arity = -1); + + Opal.def(self, '$included_modules', TMP_Module_included_modules_37 = function $$included_modules() { + var self = this; + + return Opal.included_modules(self); + }, TMP_Module_included_modules_37.$$arity = 0); + + Opal.def(self, '$include?', TMP_Module_include$q_38 = function(mod) { + var self = this; + + + if (!mod.$$is_module) { + self.$raise($$($nesting, 'TypeError'), "" + "wrong argument type " + ((mod).$class()) + " (expected Module)"); + } + + var i, ii, mod2, ancestors = Opal.ancestors(self); + + for (i = 0, ii = ancestors.length; i < ii; i++) { + mod2 = ancestors[i]; + if (mod2 === mod && mod2 !== self) { + return true; + } + } + + return false; + + }, TMP_Module_include$q_38.$$arity = 1); + + Opal.def(self, '$instance_method', TMP_Module_instance_method_39 = function $$instance_method(name) { + var self = this; + + + var meth = self.prototype['$' + name]; + + if (!meth || meth.$$stub) { + self.$raise($$($nesting, 'NameError').$new("" + "undefined method `" + (name) + "' for class `" + (self.$name()) + "'", name)); + } + + return $$($nesting, 'UnboundMethod').$new(self, meth.$$owner || self, meth, name); + + }, TMP_Module_instance_method_39.$$arity = 1); + + Opal.def(self, '$instance_methods', TMP_Module_instance_methods_40 = function $$instance_methods(include_super) { + var self = this; + + + + if (include_super == null) { + include_super = true; + }; + + if ($truthy(include_super)) { + return Opal.instance_methods(self); + } else { + return Opal.own_instance_methods(self); + } + ; + }, TMP_Module_instance_methods_40.$$arity = -1); + + Opal.def(self, '$included', TMP_Module_included_41 = function $$included(mod) { + var self = this; + + return nil + }, TMP_Module_included_41.$$arity = 1); + + Opal.def(self, '$extended', TMP_Module_extended_42 = function $$extended(mod) { + var self = this; + + return nil + }, TMP_Module_extended_42.$$arity = 1); + + Opal.def(self, '$extend_object', TMP_Module_extend_object_43 = function $$extend_object(object) { + var self = this; + + return nil + }, TMP_Module_extend_object_43.$$arity = 1); + + Opal.def(self, '$method_added', TMP_Module_method_added_44 = function $$method_added($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return nil; + }, TMP_Module_method_added_44.$$arity = -1); + + Opal.def(self, '$method_removed', TMP_Module_method_removed_45 = function $$method_removed($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return nil; + }, TMP_Module_method_removed_45.$$arity = -1); + + Opal.def(self, '$method_undefined', TMP_Module_method_undefined_46 = function $$method_undefined($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return nil; + }, TMP_Module_method_undefined_46.$$arity = -1); + + Opal.def(self, '$module_eval', TMP_Module_module_eval_47 = function $$module_eval($a) { + var $iter = TMP_Module_module_eval_47.$$p, block = $iter || nil, $post_args, args, $b, TMP_48, self = this, string = nil, file = nil, _lineno = nil, default_eval_options = nil, compiling_options = nil, compiled = nil; + + if ($iter) TMP_Module_module_eval_47.$$p = null; + + + if ($iter) TMP_Module_module_eval_47.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + if ($truthy(($truthy($b = block['$nil?']()) ? !!Opal.compile : $b))) { + + if ($truthy($range(1, 3, false)['$cover?'](args.$size()))) { + } else { + $$($nesting, 'Kernel').$raise($$($nesting, 'ArgumentError'), "wrong number of arguments (0 for 1..3)") + }; + $b = [].concat(Opal.to_a(args)), (string = ($b[0] == null ? nil : $b[0])), (file = ($b[1] == null ? nil : $b[1])), (_lineno = ($b[2] == null ? nil : $b[2])), $b; + default_eval_options = $hash2(["file", "eval"], {"file": ($truthy($b = file) ? $b : "(eval)"), "eval": true}); + compiling_options = Opal.hash({ arity_check: false }).$merge(default_eval_options); + compiled = $$($nesting, 'Opal').$compile(string, compiling_options); + block = $send($$($nesting, 'Kernel'), 'proc', [], (TMP_48 = function(){var self = TMP_48.$$s || this; + + + return (function(self) { + return eval(compiled); + })(self) + }, TMP_48.$$s = self, TMP_48.$$arity = 0, TMP_48)); + } else if ($truthy(args['$any?']())) { + $$($nesting, 'Kernel').$raise($$($nesting, 'ArgumentError'), "" + ("" + "wrong number of arguments (" + (args.$size()) + " for 0)") + "\n\n NOTE:If you want to enable passing a String argument please add \"require 'opal-parser'\" to your script\n")}; + + var old = block.$$s, + result; + + block.$$s = null; + result = block.apply(self, [self]); + block.$$s = old; + + return result; + ; + }, TMP_Module_module_eval_47.$$arity = -1); + Opal.alias(self, "class_eval", "module_eval"); + + Opal.def(self, '$module_exec', TMP_Module_module_exec_49 = function $$module_exec($a) { + var $iter = TMP_Module_module_exec_49.$$p, block = $iter || nil, $post_args, args, self = this; + + if ($iter) TMP_Module_module_exec_49.$$p = null; + + + if ($iter) TMP_Module_module_exec_49.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + + if (block === nil) { + self.$raise($$($nesting, 'LocalJumpError'), "no block given") + } + + var block_self = block.$$s, result; + + block.$$s = null; + result = block.apply(self, args); + block.$$s = block_self; + + return result; + ; + }, TMP_Module_module_exec_49.$$arity = -1); + Opal.alias(self, "class_exec", "module_exec"); + + Opal.def(self, '$method_defined?', TMP_Module_method_defined$q_50 = function(method) { + var self = this; + + + var body = self.prototype['$' + method]; + return (!!body) && !body.$$stub; + + }, TMP_Module_method_defined$q_50.$$arity = 1); + + Opal.def(self, '$module_function', TMP_Module_module_function_51 = function $$module_function($a) { + var $post_args, methods, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + methods = $post_args;; + + if (methods.length === 0) { + self.$$module_function = true; + } + else { + for (var i = 0, length = methods.length; i < length; i++) { + var meth = methods[i], + id = '$' + meth, + func = self.prototype[id]; + + Opal.defs(self, id, func); + } + } + + return self; + ; + }, TMP_Module_module_function_51.$$arity = -1); + + Opal.def(self, '$name', TMP_Module_name_52 = function $$name() { + var self = this; + + + if (self.$$full_name) { + return self.$$full_name; + } + + var result = [], base = self; + + while (base) { + // Give up if any of the ancestors is unnamed + if (base.$$name === nil || base.$$name == null) return nil; + + result.unshift(base.$$name); + + base = base.$$base_module; + + if (base === Opal.Object) { + break; + } + } + + if (result.length === 0) { + return nil; + } + + return self.$$full_name = result.join('::'); + + }, TMP_Module_name_52.$$arity = 0); + + Opal.def(self, '$prepend', TMP_Module_prepend_53 = function $$prepend($a) { + var $post_args, mods, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + mods = $post_args;; + + if (mods.length === 0) { + self.$raise($$($nesting, 'ArgumentError'), "wrong number of arguments (given 0, expected 1+)") + } + + for (var i = mods.length - 1; i >= 0; i--) { + var mod = mods[i]; + + if (!mod.$$is_module) { + self.$raise($$($nesting, 'TypeError'), "" + "wrong argument type " + ((mod).$class()) + " (expected Module)"); + } + + (mod).$prepend_features(self); + (mod).$prepended(self); + } + ; + return self; + }, TMP_Module_prepend_53.$$arity = -1); + + Opal.def(self, '$prepend_features', TMP_Module_prepend_features_54 = function $$prepend_features(prepender) { + var self = this; + + + + if (!self.$$is_module) { + self.$raise($$($nesting, 'TypeError'), "" + "wrong argument type " + (self.$class()) + " (expected Module)"); + } + + Opal.prepend_features(self, prepender) + ; + return self; + }, TMP_Module_prepend_features_54.$$arity = 1); + + Opal.def(self, '$prepended', TMP_Module_prepended_55 = function $$prepended(mod) { + var self = this; + + return nil + }, TMP_Module_prepended_55.$$arity = 1); + + Opal.def(self, '$remove_const', TMP_Module_remove_const_56 = function $$remove_const(name) { + var self = this; + + return Opal.const_remove(self, name); + }, TMP_Module_remove_const_56.$$arity = 1); + + Opal.def(self, '$to_s', TMP_Module_to_s_57 = function $$to_s() { + var $a, self = this; + + return ($truthy($a = Opal.Module.$name.call(self)) ? $a : "" + "#<" + (self.$$is_module ? 'Module' : 'Class') + ":0x" + (self.$__id__().$to_s(16)) + ">") + }, TMP_Module_to_s_57.$$arity = 0); + + Opal.def(self, '$undef_method', TMP_Module_undef_method_58 = function $$undef_method($a) { + var $post_args, names, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + names = $post_args;; + + for (var i = 0, length = names.length; i < length; i++) { + Opal.udef(self, "$" + names[i]); + } + ; + return self; + }, TMP_Module_undef_method_58.$$arity = -1); + + Opal.def(self, '$instance_variables', TMP_Module_instance_variables_59 = function $$instance_variables() { + var self = this, consts = nil; + + + consts = (Opal.Module.$$nesting = $nesting, self.$constants()); + + var result = []; + + for (var name in self) { + if (self.hasOwnProperty(name) && name.charAt(0) !== '$' && name !== 'constructor' && !consts['$include?'](name)) { + result.push('@' + name); + } + } + + return result; + ; + }, TMP_Module_instance_variables_59.$$arity = 0); + + Opal.def(self, '$dup', TMP_Module_dup_60 = function $$dup() { + var $iter = TMP_Module_dup_60.$$p, $yield = $iter || nil, self = this, copy = nil, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_Module_dup_60.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + + copy = $send(self, Opal.find_super_dispatcher(self, 'dup', TMP_Module_dup_60, false), $zuper, $iter); + copy.$copy_class_variables(self); + copy.$copy_constants(self); + return copy; + }, TMP_Module_dup_60.$$arity = 0); + + Opal.def(self, '$copy_class_variables', TMP_Module_copy_class_variables_61 = function $$copy_class_variables(other) { + var self = this; + + + for (var name in other.$$cvars) { + self.$$cvars[name] = other.$$cvars[name]; + } + + }, TMP_Module_copy_class_variables_61.$$arity = 1); + return (Opal.def(self, '$copy_constants', TMP_Module_copy_constants_62 = function $$copy_constants(other) { + var self = this; + + + var name, other_constants = other.$$const; + + for (name in other_constants) { + Opal.const_set(self, name, other_constants[name]); + } + + }, TMP_Module_copy_constants_62.$$arity = 1), nil) && 'copy_constants'; + })($nesting[0], null, $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/class"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $send = Opal.send; + + Opal.add_stubs(['$require', '$class_eval', '$to_proc', '$initialize_copy', '$allocate', '$name', '$to_s']); + + self.$require("corelib/module"); + return (function($base, $super, $parent_nesting) { + function $Class(){}; + var self = $Class = $klass($base, $super, 'Class', $Class); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Class_new_1, TMP_Class_allocate_2, TMP_Class_inherited_3, TMP_Class_initialize_dup_4, TMP_Class_new_5, TMP_Class_superclass_6, TMP_Class_to_s_7; + + + Opal.defs(self, '$new', TMP_Class_new_1 = function(superclass) { + var $iter = TMP_Class_new_1.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Class_new_1.$$p = null; + + + if ($iter) TMP_Class_new_1.$$p = null;; + + if (superclass == null) { + superclass = $$($nesting, 'Object'); + }; + + if (!superclass.$$is_class) { + throw Opal.TypeError.$new("superclass must be a Class"); + } + + var klass = Opal.allocate_class(nil, superclass, function(){}); + superclass.$inherited(klass); + (function() {if ((block !== nil)) { + return $send((klass), 'class_eval', [], block.$to_proc()) + } else { + return nil + }; return nil; })() + return klass; + ; + }, TMP_Class_new_1.$$arity = -1); + + Opal.def(self, '$allocate', TMP_Class_allocate_2 = function $$allocate() { + var self = this; + + + var obj = new self(); + obj.$$id = Opal.uid(); + return obj; + + }, TMP_Class_allocate_2.$$arity = 0); + + Opal.def(self, '$inherited', TMP_Class_inherited_3 = function $$inherited(cls) { + var self = this; + + return nil + }, TMP_Class_inherited_3.$$arity = 1); + + Opal.def(self, '$initialize_dup', TMP_Class_initialize_dup_4 = function $$initialize_dup(original) { + var self = this; + + + self.$initialize_copy(original); + + self.$$name = null; + self.$$full_name = null; + ; + }, TMP_Class_initialize_dup_4.$$arity = 1); + + Opal.def(self, '$new', TMP_Class_new_5 = function($a) { + var $iter = TMP_Class_new_5.$$p, block = $iter || nil, $post_args, args, self = this; + + if ($iter) TMP_Class_new_5.$$p = null; + + + if ($iter) TMP_Class_new_5.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + + var object = self.$allocate(); + Opal.send(object, object.$initialize, args, block); + return object; + ; + }, TMP_Class_new_5.$$arity = -1); + + Opal.def(self, '$superclass', TMP_Class_superclass_6 = function $$superclass() { + var self = this; + + return self.$$super || nil; + }, TMP_Class_superclass_6.$$arity = 0); + return (Opal.def(self, '$to_s', TMP_Class_to_s_7 = function $$to_s() { + var $iter = TMP_Class_to_s_7.$$p, $yield = $iter || nil, self = this; + + if ($iter) TMP_Class_to_s_7.$$p = null; + + var singleton_of = self.$$singleton_of; + + if (singleton_of && (singleton_of.$$is_a_module)) { + return "" + "#"; + } + else if (singleton_of) { + // a singleton class created from an object + return "" + "#>"; + } + return $send(self, Opal.find_super_dispatcher(self, 'to_s', TMP_Class_to_s_7, false), [], null); + + }, TMP_Class_to_s_7.$$arity = 0), nil) && 'to_s'; + })($nesting[0], null, $nesting); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/basic_object"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $truthy = Opal.truthy, $range = Opal.range, $hash2 = Opal.hash2, $send = Opal.send; + + Opal.add_stubs(['$==', '$!', '$nil?', '$cover?', '$size', '$raise', '$merge', '$compile', '$proc', '$any?', '$inspect', '$new']); + return (function($base, $super, $parent_nesting) { + function $BasicObject(){}; + var self = $BasicObject = $klass($base, $super, 'BasicObject', $BasicObject); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_BasicObject_initialize_1, TMP_BasicObject_$eq$eq_2, TMP_BasicObject_eql$q_3, TMP_BasicObject___id___4, TMP_BasicObject___send___5, TMP_BasicObject_$B_6, TMP_BasicObject_$B$eq_7, TMP_BasicObject_instance_eval_8, TMP_BasicObject_instance_exec_10, TMP_BasicObject_singleton_method_added_11, TMP_BasicObject_singleton_method_removed_12, TMP_BasicObject_singleton_method_undefined_13, TMP_BasicObject_class_14, TMP_BasicObject_method_missing_15; + + + + Opal.def(self, '$initialize', TMP_BasicObject_initialize_1 = function $$initialize($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return nil; + }, TMP_BasicObject_initialize_1.$$arity = -1); + + Opal.def(self, '$==', TMP_BasicObject_$eq$eq_2 = function(other) { + var self = this; + + return self === other; + }, TMP_BasicObject_$eq$eq_2.$$arity = 1); + + Opal.def(self, '$eql?', TMP_BasicObject_eql$q_3 = function(other) { + var self = this; + + return self['$=='](other) + }, TMP_BasicObject_eql$q_3.$$arity = 1); + Opal.alias(self, "equal?", "=="); + + Opal.def(self, '$__id__', TMP_BasicObject___id___4 = function $$__id__() { + var self = this; + + + if (self.$$id != null) { + return self.$$id; + } + Opal.defineProperty(self, '$$id', Opal.uid()); + return self.$$id; + + }, TMP_BasicObject___id___4.$$arity = 0); + + Opal.def(self, '$__send__', TMP_BasicObject___send___5 = function $$__send__(symbol, $a) { + var $iter = TMP_BasicObject___send___5.$$p, block = $iter || nil, $post_args, args, self = this; + + if ($iter) TMP_BasicObject___send___5.$$p = null; + + + if ($iter) TMP_BasicObject___send___5.$$p = null;; + + $post_args = Opal.slice.call(arguments, 1, arguments.length); + + args = $post_args;; + + var func = self['$' + symbol] + + if (func) { + if (block !== nil) { + func.$$p = block; + } + + return func.apply(self, args); + } + + if (block !== nil) { + self.$method_missing.$$p = block; + } + + return self.$method_missing.apply(self, [symbol].concat(args)); + ; + }, TMP_BasicObject___send___5.$$arity = -2); + + Opal.def(self, '$!', TMP_BasicObject_$B_6 = function() { + var self = this; + + return false + }, TMP_BasicObject_$B_6.$$arity = 0); + + Opal.def(self, '$!=', TMP_BasicObject_$B$eq_7 = function(other) { + var self = this; + + return self['$=='](other)['$!']() + }, TMP_BasicObject_$B$eq_7.$$arity = 1); + + Opal.def(self, '$instance_eval', TMP_BasicObject_instance_eval_8 = function $$instance_eval($a) { + var $iter = TMP_BasicObject_instance_eval_8.$$p, block = $iter || nil, $post_args, args, $b, TMP_9, self = this, string = nil, file = nil, _lineno = nil, default_eval_options = nil, compiling_options = nil, compiled = nil; + + if ($iter) TMP_BasicObject_instance_eval_8.$$p = null; + + + if ($iter) TMP_BasicObject_instance_eval_8.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + if ($truthy(($truthy($b = block['$nil?']()) ? !!Opal.compile : $b))) { + + if ($truthy($range(1, 3, false)['$cover?'](args.$size()))) { + } else { + $$$('::', 'Kernel').$raise($$$('::', 'ArgumentError'), "wrong number of arguments (0 for 1..3)") + }; + $b = [].concat(Opal.to_a(args)), (string = ($b[0] == null ? nil : $b[0])), (file = ($b[1] == null ? nil : $b[1])), (_lineno = ($b[2] == null ? nil : $b[2])), $b; + default_eval_options = $hash2(["file", "eval"], {"file": ($truthy($b = file) ? $b : "(eval)"), "eval": true}); + compiling_options = Opal.hash({ arity_check: false }).$merge(default_eval_options); + compiled = $$$('::', 'Opal').$compile(string, compiling_options); + block = $send($$$('::', 'Kernel'), 'proc', [], (TMP_9 = function(){var self = TMP_9.$$s || this; + + + return (function(self) { + return eval(compiled); + })(self) + }, TMP_9.$$s = self, TMP_9.$$arity = 0, TMP_9)); + } else if ($truthy(args['$any?']())) { + $$$('::', 'Kernel').$raise($$$('::', 'ArgumentError'), "" + "wrong number of arguments (" + (args.$size()) + " for 0)")}; + + var old = block.$$s, + result; + + block.$$s = null; + + // Need to pass $$eval so that method definitions know if this is + // being done on a class/module. Cannot be compiler driven since + // send(:instance_eval) needs to work. + if (self.$$is_a_module) { + self.$$eval = true; + try { + result = block.call(self, self); + } + finally { + self.$$eval = false; + } + } + else { + result = block.call(self, self); + } + + block.$$s = old; + + return result; + ; + }, TMP_BasicObject_instance_eval_8.$$arity = -1); + + Opal.def(self, '$instance_exec', TMP_BasicObject_instance_exec_10 = function $$instance_exec($a) { + var $iter = TMP_BasicObject_instance_exec_10.$$p, block = $iter || nil, $post_args, args, self = this; + + if ($iter) TMP_BasicObject_instance_exec_10.$$p = null; + + + if ($iter) TMP_BasicObject_instance_exec_10.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + if ($truthy(block)) { + } else { + $$$('::', 'Kernel').$raise($$$('::', 'ArgumentError'), "no block given") + }; + + var block_self = block.$$s, + result; + + block.$$s = null; + + if (self.$$is_a_module) { + self.$$eval = true; + try { + result = block.apply(self, args); + } + finally { + self.$$eval = false; + } + } + else { + result = block.apply(self, args); + } + + block.$$s = block_self; + + return result; + ; + }, TMP_BasicObject_instance_exec_10.$$arity = -1); + + Opal.def(self, '$singleton_method_added', TMP_BasicObject_singleton_method_added_11 = function $$singleton_method_added($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return nil; + }, TMP_BasicObject_singleton_method_added_11.$$arity = -1); + + Opal.def(self, '$singleton_method_removed', TMP_BasicObject_singleton_method_removed_12 = function $$singleton_method_removed($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return nil; + }, TMP_BasicObject_singleton_method_removed_12.$$arity = -1); + + Opal.def(self, '$singleton_method_undefined', TMP_BasicObject_singleton_method_undefined_13 = function $$singleton_method_undefined($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return nil; + }, TMP_BasicObject_singleton_method_undefined_13.$$arity = -1); + + Opal.def(self, '$class', TMP_BasicObject_class_14 = function() { + var self = this; + + return self.$$class; + }, TMP_BasicObject_class_14.$$arity = 0); + return (Opal.def(self, '$method_missing', TMP_BasicObject_method_missing_15 = function $$method_missing(symbol, $a) { + var $iter = TMP_BasicObject_method_missing_15.$$p, block = $iter || nil, $post_args, args, self = this, message = nil; + + if ($iter) TMP_BasicObject_method_missing_15.$$p = null; + + + if ($iter) TMP_BasicObject_method_missing_15.$$p = null;; + + $post_args = Opal.slice.call(arguments, 1, arguments.length); + + args = $post_args;; + message = (function() {if ($truthy(self.$inspect && !self.$inspect.$$stub)) { + return "" + "undefined method `" + (symbol) + "' for " + (self.$inspect()) + ":" + (self.$$class) + } else { + return "" + "undefined method `" + (symbol) + "' for " + (self.$$class) + }; return nil; })(); + return $$$('::', 'Kernel').$raise($$$('::', 'NoMethodError').$new(message, symbol)); + }, TMP_BasicObject_method_missing_15.$$arity = -2), nil) && 'method_missing'; + })($nesting[0], null, $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/kernel"] = function(Opal) { + function $rb_le(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs <= rhs : lhs['$<='](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $truthy = Opal.truthy, $gvars = Opal.gvars, $hash2 = Opal.hash2, $send = Opal.send, $klass = Opal.klass; + + Opal.add_stubs(['$raise', '$new', '$inspect', '$!', '$=~', '$==', '$object_id', '$class', '$coerce_to?', '$<<', '$allocate', '$copy_instance_variables', '$copy_singleton_methods', '$initialize_clone', '$initialize_copy', '$define_method', '$singleton_class', '$to_proc', '$initialize_dup', '$for', '$empty?', '$pop', '$call', '$coerce_to', '$append_features', '$extend_object', '$extended', '$length', '$respond_to?', '$[]', '$nil?', '$to_a', '$to_int', '$fetch', '$Integer', '$Float', '$to_ary', '$to_str', '$to_s', '$__id__', '$instance_variable_name!', '$coerce_to!', '$===', '$enum_for', '$result', '$any?', '$print', '$format', '$puts', '$each', '$<=', '$exception', '$is_a?', '$rand', '$respond_to_missing?', '$try_convert!', '$expand_path', '$join', '$start_with?', '$new_seed', '$srand', '$sym', '$arg', '$open', '$include']); + + (function($base, $parent_nesting) { + function $Kernel() {}; + var self = $Kernel = $module($base, 'Kernel', $Kernel); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Kernel_method_missing_1, TMP_Kernel_$eq$_2, TMP_Kernel_$B$_3, TMP_Kernel_$eq$eq$eq_4, TMP_Kernel_$lt$eq$gt_5, TMP_Kernel_method_6, TMP_Kernel_methods_7, TMP_Kernel_public_methods_8, TMP_Kernel_Array_9, TMP_Kernel_at_exit_10, TMP_Kernel_caller_11, TMP_Kernel_class_12, TMP_Kernel_copy_instance_variables_13, TMP_Kernel_copy_singleton_methods_14, TMP_Kernel_clone_15, TMP_Kernel_initialize_clone_16, TMP_Kernel_define_singleton_method_17, TMP_Kernel_dup_18, TMP_Kernel_initialize_dup_19, TMP_Kernel_enum_for_20, TMP_Kernel_equal$q_21, TMP_Kernel_exit_22, TMP_Kernel_extend_23, TMP_Kernel_format_24, TMP_Kernel_hash_25, TMP_Kernel_initialize_copy_26, TMP_Kernel_inspect_27, TMP_Kernel_instance_of$q_28, TMP_Kernel_instance_variable_defined$q_29, TMP_Kernel_instance_variable_get_30, TMP_Kernel_instance_variable_set_31, TMP_Kernel_remove_instance_variable_32, TMP_Kernel_instance_variables_33, TMP_Kernel_Integer_34, TMP_Kernel_Float_35, TMP_Kernel_Hash_36, TMP_Kernel_is_a$q_37, TMP_Kernel_itself_38, TMP_Kernel_lambda_39, TMP_Kernel_load_40, TMP_Kernel_loop_41, TMP_Kernel_nil$q_43, TMP_Kernel_printf_44, TMP_Kernel_proc_45, TMP_Kernel_puts_46, TMP_Kernel_p_47, TMP_Kernel_print_49, TMP_Kernel_warn_50, TMP_Kernel_raise_51, TMP_Kernel_rand_52, TMP_Kernel_respond_to$q_53, TMP_Kernel_respond_to_missing$q_54, TMP_Kernel_require_55, TMP_Kernel_require_relative_56, TMP_Kernel_require_tree_57, TMP_Kernel_singleton_class_58, TMP_Kernel_sleep_59, TMP_Kernel_srand_60, TMP_Kernel_String_61, TMP_Kernel_tap_62, TMP_Kernel_to_proc_63, TMP_Kernel_to_s_64, TMP_Kernel_catch_65, TMP_Kernel_throw_66, TMP_Kernel_open_67, TMP_Kernel_yield_self_68; + + + + Opal.def(self, '$method_missing', TMP_Kernel_method_missing_1 = function $$method_missing(symbol, $a) { + var $iter = TMP_Kernel_method_missing_1.$$p, block = $iter || nil, $post_args, args, self = this; + + if ($iter) TMP_Kernel_method_missing_1.$$p = null; + + + if ($iter) TMP_Kernel_method_missing_1.$$p = null;; + + $post_args = Opal.slice.call(arguments, 1, arguments.length); + + args = $post_args;; + return self.$raise($$($nesting, 'NoMethodError').$new("" + "undefined method `" + (symbol) + "' for " + (self.$inspect()), symbol, args)); + }, TMP_Kernel_method_missing_1.$$arity = -2); + + Opal.def(self, '$=~', TMP_Kernel_$eq$_2 = function(obj) { + var self = this; + + return false + }, TMP_Kernel_$eq$_2.$$arity = 1); + + Opal.def(self, '$!~', TMP_Kernel_$B$_3 = function(obj) { + var self = this; + + return self['$=~'](obj)['$!']() + }, TMP_Kernel_$B$_3.$$arity = 1); + + Opal.def(self, '$===', TMP_Kernel_$eq$eq$eq_4 = function(other) { + var $a, self = this; + + return ($truthy($a = self.$object_id()['$=='](other.$object_id())) ? $a : self['$=='](other)) + }, TMP_Kernel_$eq$eq$eq_4.$$arity = 1); + + Opal.def(self, '$<=>', TMP_Kernel_$lt$eq$gt_5 = function(other) { + var self = this; + + + // set guard for infinite recursion + self.$$comparable = true; + + var x = self['$=='](other); + + if (x && x !== nil) { + return 0; + } + + return nil; + + }, TMP_Kernel_$lt$eq$gt_5.$$arity = 1); + + Opal.def(self, '$method', TMP_Kernel_method_6 = function $$method(name) { + var self = this; + + + var meth = self['$' + name]; + + if (!meth || meth.$$stub) { + self.$raise($$($nesting, 'NameError').$new("" + "undefined method `" + (name) + "' for class `" + (self.$class()) + "'", name)); + } + + return $$($nesting, 'Method').$new(self, meth.$$owner || self.$class(), meth, name); + + }, TMP_Kernel_method_6.$$arity = 1); + + Opal.def(self, '$methods', TMP_Kernel_methods_7 = function $$methods(all) { + var self = this; + + + + if (all == null) { + all = true; + }; + + if ($truthy(all)) { + return Opal.methods(self); + } else { + return Opal.own_methods(self); + } + ; + }, TMP_Kernel_methods_7.$$arity = -1); + + Opal.def(self, '$public_methods', TMP_Kernel_public_methods_8 = function $$public_methods(all) { + var self = this; + + + + if (all == null) { + all = true; + }; + + if ($truthy(all)) { + return Opal.methods(self); + } else { + return Opal.receiver_methods(self); + } + ; + }, TMP_Kernel_public_methods_8.$$arity = -1); + + Opal.def(self, '$Array', TMP_Kernel_Array_9 = function $$Array(object) { + var self = this; + + + var coerced; + + if (object === nil) { + return []; + } + + if (object.$$is_array) { + return object; + } + + coerced = $$($nesting, 'Opal')['$coerce_to?'](object, $$($nesting, 'Array'), "to_ary"); + if (coerced !== nil) { return coerced; } + + coerced = $$($nesting, 'Opal')['$coerce_to?'](object, $$($nesting, 'Array'), "to_a"); + if (coerced !== nil) { return coerced; } + + return [object]; + + }, TMP_Kernel_Array_9.$$arity = 1); + + Opal.def(self, '$at_exit', TMP_Kernel_at_exit_10 = function $$at_exit() { + var $iter = TMP_Kernel_at_exit_10.$$p, block = $iter || nil, $a, self = this; + if ($gvars.__at_exit__ == null) $gvars.__at_exit__ = nil; + + if ($iter) TMP_Kernel_at_exit_10.$$p = null; + + + if ($iter) TMP_Kernel_at_exit_10.$$p = null;; + $gvars.__at_exit__ = ($truthy($a = $gvars.__at_exit__) ? $a : []); + return $gvars.__at_exit__['$<<'](block); + }, TMP_Kernel_at_exit_10.$$arity = 0); + + Opal.def(self, '$caller', TMP_Kernel_caller_11 = function $$caller($a) { + var $post_args, args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + return []; + }, TMP_Kernel_caller_11.$$arity = -1); + + Opal.def(self, '$class', TMP_Kernel_class_12 = function() { + var self = this; + + return self.$$class; + }, TMP_Kernel_class_12.$$arity = 0); + + Opal.def(self, '$copy_instance_variables', TMP_Kernel_copy_instance_variables_13 = function $$copy_instance_variables(other) { + var self = this; + + + var keys = Object.keys(other), i, ii, name; + for (i = 0, ii = keys.length; i < ii; i++) { + name = keys[i]; + if (name.charAt(0) !== '$' && other.hasOwnProperty(name)) { + self[name] = other[name]; + } + } + + }, TMP_Kernel_copy_instance_variables_13.$$arity = 1); + + Opal.def(self, '$copy_singleton_methods', TMP_Kernel_copy_singleton_methods_14 = function $$copy_singleton_methods(other) { + var self = this; + + + var i, name, names, length; + + if (other.hasOwnProperty('$$meta')) { + var other_singleton_class = Opal.get_singleton_class(other); + var self_singleton_class = Opal.get_singleton_class(self); + names = Object.getOwnPropertyNames(other_singleton_class.prototype); + + for (i = 0, length = names.length; i < length; i++) { + name = names[i]; + if (Opal.is_method(name)) { + self_singleton_class.prototype[name] = other_singleton_class.prototype[name]; + } + } + + self_singleton_class.$$const = Object.assign({}, other_singleton_class.$$const); + Object.setPrototypeOf( + self_singleton_class.prototype, + Object.getPrototypeOf(other_singleton_class.prototype) + ); + } + + for (i = 0, names = Object.getOwnPropertyNames(other), length = names.length; i < length; i++) { + name = names[i]; + if (name.charAt(0) === '$' && name.charAt(1) !== '$' && other.hasOwnProperty(name)) { + self[name] = other[name]; + } + } + + }, TMP_Kernel_copy_singleton_methods_14.$$arity = 1); + + Opal.def(self, '$clone', TMP_Kernel_clone_15 = function $$clone($kwargs) { + var freeze, self = this, copy = nil; + + + + if ($kwargs == null) { + $kwargs = $hash2([], {}); + } else if (!$kwargs.$$is_hash) { + throw Opal.ArgumentError.$new('expected kwargs'); + }; + + freeze = $kwargs.$$smap["freeze"]; + if (freeze == null) { + freeze = true + }; + copy = self.$class().$allocate(); + copy.$copy_instance_variables(self); + copy.$copy_singleton_methods(self); + copy.$initialize_clone(self); + return copy; + }, TMP_Kernel_clone_15.$$arity = -1); + + Opal.def(self, '$initialize_clone', TMP_Kernel_initialize_clone_16 = function $$initialize_clone(other) { + var self = this; + + return self.$initialize_copy(other) + }, TMP_Kernel_initialize_clone_16.$$arity = 1); + + Opal.def(self, '$define_singleton_method', TMP_Kernel_define_singleton_method_17 = function $$define_singleton_method(name, method) { + var $iter = TMP_Kernel_define_singleton_method_17.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Kernel_define_singleton_method_17.$$p = null; + + + if ($iter) TMP_Kernel_define_singleton_method_17.$$p = null;; + ; + return $send(self.$singleton_class(), 'define_method', [name, method], block.$to_proc()); + }, TMP_Kernel_define_singleton_method_17.$$arity = -2); + + Opal.def(self, '$dup', TMP_Kernel_dup_18 = function $$dup() { + var self = this, copy = nil; + + + copy = self.$class().$allocate(); + copy.$copy_instance_variables(self); + copy.$initialize_dup(self); + return copy; + }, TMP_Kernel_dup_18.$$arity = 0); + + Opal.def(self, '$initialize_dup', TMP_Kernel_initialize_dup_19 = function $$initialize_dup(other) { + var self = this; + + return self.$initialize_copy(other) + }, TMP_Kernel_initialize_dup_19.$$arity = 1); + + Opal.def(self, '$enum_for', TMP_Kernel_enum_for_20 = function $$enum_for($a, $b) { + var $iter = TMP_Kernel_enum_for_20.$$p, block = $iter || nil, $post_args, method, args, self = this; + + if ($iter) TMP_Kernel_enum_for_20.$$p = null; + + + if ($iter) TMP_Kernel_enum_for_20.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + if ($post_args.length > 0) { + method = $post_args[0]; + $post_args.splice(0, 1); + } + if (method == null) { + method = "each"; + }; + + args = $post_args;; + return $send($$($nesting, 'Enumerator'), 'for', [self, method].concat(Opal.to_a(args)), block.$to_proc()); + }, TMP_Kernel_enum_for_20.$$arity = -1); + Opal.alias(self, "to_enum", "enum_for"); + + Opal.def(self, '$equal?', TMP_Kernel_equal$q_21 = function(other) { + var self = this; + + return self === other; + }, TMP_Kernel_equal$q_21.$$arity = 1); + + Opal.def(self, '$exit', TMP_Kernel_exit_22 = function $$exit(status) { + var $a, self = this, block = nil; + if ($gvars.__at_exit__ == null) $gvars.__at_exit__ = nil; + + + + if (status == null) { + status = true; + }; + $gvars.__at_exit__ = ($truthy($a = $gvars.__at_exit__) ? $a : []); + while (!($truthy($gvars.__at_exit__['$empty?']()))) { + + block = $gvars.__at_exit__.$pop(); + block.$call(); + }; + + if (status.$$is_boolean) { + status = status ? 0 : 1; + } else { + status = $$($nesting, 'Opal').$coerce_to(status, $$($nesting, 'Integer'), "to_int") + } + + Opal.exit(status); + ; + return nil; + }, TMP_Kernel_exit_22.$$arity = -1); + + Opal.def(self, '$extend', TMP_Kernel_extend_23 = function $$extend($a) { + var $post_args, mods, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + mods = $post_args;; + + var singleton = self.$singleton_class(); + + for (var i = mods.length - 1; i >= 0; i--) { + var mod = mods[i]; + + if (!mod.$$is_module) { + self.$raise($$($nesting, 'TypeError'), "" + "wrong argument type " + ((mod).$class()) + " (expected Module)"); + } + + (mod).$append_features(singleton); + (mod).$extend_object(self); + (mod).$extended(self); + } + ; + return self; + }, TMP_Kernel_extend_23.$$arity = -1); + + Opal.def(self, '$format', TMP_Kernel_format_24 = function $$format(format_string, $a) { + var $post_args, args, $b, self = this, ary = nil; + if ($gvars.DEBUG == null) $gvars.DEBUG = nil; + + + + $post_args = Opal.slice.call(arguments, 1, arguments.length); + + args = $post_args;; + if ($truthy((($b = args.$length()['$=='](1)) ? args['$[]'](0)['$respond_to?']("to_ary") : args.$length()['$=='](1)))) { + + ary = $$($nesting, 'Opal')['$coerce_to?'](args['$[]'](0), $$($nesting, 'Array'), "to_ary"); + if ($truthy(ary['$nil?']())) { + } else { + args = ary.$to_a() + };}; + + var result = '', + //used for slicing: + begin_slice = 0, + end_slice, + //used for iterating over the format string: + i, + len = format_string.length, + //used for processing field values: + arg, + str, + //used for processing %g and %G fields: + exponent, + //used for keeping track of width and precision: + width, + precision, + //used for holding temporary values: + tmp_num, + //used for processing %{} and %<> fileds: + hash_parameter_key, + closing_brace_char, + //used for processing %b, %B, %o, %x, and %X fields: + base_number, + base_prefix, + base_neg_zero_regex, + base_neg_zero_digit, + //used for processing arguments: + next_arg, + seq_arg_num = 1, + pos_arg_num = 0, + //used for keeping track of flags: + flags, + FNONE = 0, + FSHARP = 1, + FMINUS = 2, + FPLUS = 4, + FZERO = 8, + FSPACE = 16, + FWIDTH = 32, + FPREC = 64, + FPREC0 = 128; + + function CHECK_FOR_FLAGS() { + if (flags&FWIDTH) { self.$raise($$($nesting, 'ArgumentError'), "flag after width") } + if (flags&FPREC0) { self.$raise($$($nesting, 'ArgumentError'), "flag after precision") } + } + + function CHECK_FOR_WIDTH() { + if (flags&FWIDTH) { self.$raise($$($nesting, 'ArgumentError'), "width given twice") } + if (flags&FPREC0) { self.$raise($$($nesting, 'ArgumentError'), "width after precision") } + } + + function GET_NTH_ARG(num) { + if (num >= args.length) { self.$raise($$($nesting, 'ArgumentError'), "too few arguments") } + return args[num]; + } + + function GET_NEXT_ARG() { + switch (pos_arg_num) { + case -1: self.$raise($$($nesting, 'ArgumentError'), "" + "unnumbered(" + (seq_arg_num) + ") mixed with numbered") + case -2: self.$raise($$($nesting, 'ArgumentError'), "" + "unnumbered(" + (seq_arg_num) + ") mixed with named") + } + pos_arg_num = seq_arg_num++; + return GET_NTH_ARG(pos_arg_num - 1); + } + + function GET_POS_ARG(num) { + if (pos_arg_num > 0) { + self.$raise($$($nesting, 'ArgumentError'), "" + "numbered(" + (num) + ") after unnumbered(" + (pos_arg_num) + ")") + } + if (pos_arg_num === -2) { + self.$raise($$($nesting, 'ArgumentError'), "" + "numbered(" + (num) + ") after named") + } + if (num < 1) { + self.$raise($$($nesting, 'ArgumentError'), "" + "invalid index - " + (num) + "$") + } + pos_arg_num = -1; + return GET_NTH_ARG(num - 1); + } + + function GET_ARG() { + return (next_arg === undefined ? GET_NEXT_ARG() : next_arg); + } + + function READ_NUM(label) { + var num, str = ''; + for (;; i++) { + if (i === len) { + self.$raise($$($nesting, 'ArgumentError'), "malformed format string - %*[0-9]") + } + if (format_string.charCodeAt(i) < 48 || format_string.charCodeAt(i) > 57) { + i--; + num = parseInt(str, 10) || 0; + if (num > 2147483647) { + self.$raise($$($nesting, 'ArgumentError'), "" + (label) + " too big") + } + return num; + } + str += format_string.charAt(i); + } + } + + function READ_NUM_AFTER_ASTER(label) { + var arg, num = READ_NUM(label); + if (format_string.charAt(i + 1) === '$') { + i++; + arg = GET_POS_ARG(num); + } else { + arg = GET_NEXT_ARG(); + } + return (arg).$to_int(); + } + + for (i = format_string.indexOf('%'); i !== -1; i = format_string.indexOf('%', i)) { + str = undefined; + + flags = FNONE; + width = -1; + precision = -1; + next_arg = undefined; + + end_slice = i; + + i++; + + switch (format_string.charAt(i)) { + case '%': + begin_slice = i; + case '': + case '\n': + case '\0': + i++; + continue; + } + + format_sequence: for (; i < len; i++) { + switch (format_string.charAt(i)) { + + case ' ': + CHECK_FOR_FLAGS(); + flags |= FSPACE; + continue format_sequence; + + case '#': + CHECK_FOR_FLAGS(); + flags |= FSHARP; + continue format_sequence; + + case '+': + CHECK_FOR_FLAGS(); + flags |= FPLUS; + continue format_sequence; + + case '-': + CHECK_FOR_FLAGS(); + flags |= FMINUS; + continue format_sequence; + + case '0': + CHECK_FOR_FLAGS(); + flags |= FZERO; + continue format_sequence; + + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + tmp_num = READ_NUM('width'); + if (format_string.charAt(i + 1) === '$') { + if (i + 2 === len) { + str = '%'; + i++; + break format_sequence; + } + if (next_arg !== undefined) { + self.$raise($$($nesting, 'ArgumentError'), "" + "value given twice - %" + (tmp_num) + "$") + } + next_arg = GET_POS_ARG(tmp_num); + i++; + } else { + CHECK_FOR_WIDTH(); + flags |= FWIDTH; + width = tmp_num; + } + continue format_sequence; + + case '<': + case '\{': + closing_brace_char = (format_string.charAt(i) === '<' ? '>' : '\}'); + hash_parameter_key = ''; + + i++; + + for (;; i++) { + if (i === len) { + self.$raise($$($nesting, 'ArgumentError'), "malformed name - unmatched parenthesis") + } + if (format_string.charAt(i) === closing_brace_char) { + + if (pos_arg_num > 0) { + self.$raise($$($nesting, 'ArgumentError'), "" + "named " + (hash_parameter_key) + " after unnumbered(" + (pos_arg_num) + ")") + } + if (pos_arg_num === -1) { + self.$raise($$($nesting, 'ArgumentError'), "" + "named " + (hash_parameter_key) + " after numbered") + } + pos_arg_num = -2; + + if (args[0] === undefined || !args[0].$$is_hash) { + self.$raise($$($nesting, 'ArgumentError'), "one hash required") + } + + next_arg = (args[0]).$fetch(hash_parameter_key); + + if (closing_brace_char === '>') { + continue format_sequence; + } else { + str = next_arg.toString(); + if (precision !== -1) { str = str.slice(0, precision); } + if (flags&FMINUS) { + while (str.length < width) { str = str + ' '; } + } else { + while (str.length < width) { str = ' ' + str; } + } + break format_sequence; + } + } + hash_parameter_key += format_string.charAt(i); + } + + case '*': + i++; + CHECK_FOR_WIDTH(); + flags |= FWIDTH; + width = READ_NUM_AFTER_ASTER('width'); + if (width < 0) { + flags |= FMINUS; + width = -width; + } + continue format_sequence; + + case '.': + if (flags&FPREC0) { + self.$raise($$($nesting, 'ArgumentError'), "precision given twice") + } + flags |= FPREC|FPREC0; + precision = 0; + i++; + if (format_string.charAt(i) === '*') { + i++; + precision = READ_NUM_AFTER_ASTER('precision'); + if (precision < 0) { + flags &= ~FPREC; + } + continue format_sequence; + } + precision = READ_NUM('precision'); + continue format_sequence; + + case 'd': + case 'i': + case 'u': + arg = self.$Integer(GET_ARG()); + if (arg >= 0) { + str = arg.toString(); + while (str.length < precision) { str = '0' + str; } + if (flags&FMINUS) { + if (flags&FPLUS || flags&FSPACE) { str = (flags&FPLUS ? '+' : ' ') + str; } + while (str.length < width) { str = str + ' '; } + } else { + if (flags&FZERO && precision === -1) { + while (str.length < width - ((flags&FPLUS || flags&FSPACE) ? 1 : 0)) { str = '0' + str; } + if (flags&FPLUS || flags&FSPACE) { str = (flags&FPLUS ? '+' : ' ') + str; } + } else { + if (flags&FPLUS || flags&FSPACE) { str = (flags&FPLUS ? '+' : ' ') + str; } + while (str.length < width) { str = ' ' + str; } + } + } + } else { + str = (-arg).toString(); + while (str.length < precision) { str = '0' + str; } + if (flags&FMINUS) { + str = '-' + str; + while (str.length < width) { str = str + ' '; } + } else { + if (flags&FZERO && precision === -1) { + while (str.length < width - 1) { str = '0' + str; } + str = '-' + str; + } else { + str = '-' + str; + while (str.length < width) { str = ' ' + str; } + } + } + } + break format_sequence; + + case 'b': + case 'B': + case 'o': + case 'x': + case 'X': + switch (format_string.charAt(i)) { + case 'b': + case 'B': + base_number = 2; + base_prefix = '0b'; + base_neg_zero_regex = /^1+/; + base_neg_zero_digit = '1'; + break; + case 'o': + base_number = 8; + base_prefix = '0'; + base_neg_zero_regex = /^3?7+/; + base_neg_zero_digit = '7'; + break; + case 'x': + case 'X': + base_number = 16; + base_prefix = '0x'; + base_neg_zero_regex = /^f+/; + base_neg_zero_digit = 'f'; + break; + } + arg = self.$Integer(GET_ARG()); + if (arg >= 0) { + str = arg.toString(base_number); + while (str.length < precision) { str = '0' + str; } + if (flags&FMINUS) { + if (flags&FPLUS || flags&FSPACE) { str = (flags&FPLUS ? '+' : ' ') + str; } + if (flags&FSHARP && arg !== 0) { str = base_prefix + str; } + while (str.length < width) { str = str + ' '; } + } else { + if (flags&FZERO && precision === -1) { + while (str.length < width - ((flags&FPLUS || flags&FSPACE) ? 1 : 0) - ((flags&FSHARP && arg !== 0) ? base_prefix.length : 0)) { str = '0' + str; } + if (flags&FSHARP && arg !== 0) { str = base_prefix + str; } + if (flags&FPLUS || flags&FSPACE) { str = (flags&FPLUS ? '+' : ' ') + str; } + } else { + if (flags&FSHARP && arg !== 0) { str = base_prefix + str; } + if (flags&FPLUS || flags&FSPACE) { str = (flags&FPLUS ? '+' : ' ') + str; } + while (str.length < width) { str = ' ' + str; } + } + } + } else { + if (flags&FPLUS || flags&FSPACE) { + str = (-arg).toString(base_number); + while (str.length < precision) { str = '0' + str; } + if (flags&FMINUS) { + if (flags&FSHARP) { str = base_prefix + str; } + str = '-' + str; + while (str.length < width) { str = str + ' '; } + } else { + if (flags&FZERO && precision === -1) { + while (str.length < width - 1 - (flags&FSHARP ? 2 : 0)) { str = '0' + str; } + if (flags&FSHARP) { str = base_prefix + str; } + str = '-' + str; + } else { + if (flags&FSHARP) { str = base_prefix + str; } + str = '-' + str; + while (str.length < width) { str = ' ' + str; } + } + } + } else { + str = (arg >>> 0).toString(base_number).replace(base_neg_zero_regex, base_neg_zero_digit); + while (str.length < precision - 2) { str = base_neg_zero_digit + str; } + if (flags&FMINUS) { + str = '..' + str; + if (flags&FSHARP) { str = base_prefix + str; } + while (str.length < width) { str = str + ' '; } + } else { + if (flags&FZERO && precision === -1) { + while (str.length < width - 2 - (flags&FSHARP ? base_prefix.length : 0)) { str = base_neg_zero_digit + str; } + str = '..' + str; + if (flags&FSHARP) { str = base_prefix + str; } + } else { + str = '..' + str; + if (flags&FSHARP) { str = base_prefix + str; } + while (str.length < width) { str = ' ' + str; } + } + } + } + } + if (format_string.charAt(i) === format_string.charAt(i).toUpperCase()) { + str = str.toUpperCase(); + } + break format_sequence; + + case 'f': + case 'e': + case 'E': + case 'g': + case 'G': + arg = self.$Float(GET_ARG()); + if (arg >= 0 || isNaN(arg)) { + if (arg === Infinity) { + str = 'Inf'; + } else { + switch (format_string.charAt(i)) { + case 'f': + str = arg.toFixed(precision === -1 ? 6 : precision); + break; + case 'e': + case 'E': + str = arg.toExponential(precision === -1 ? 6 : precision); + break; + case 'g': + case 'G': + str = arg.toExponential(); + exponent = parseInt(str.split('e')[1], 10); + if (!(exponent < -4 || exponent >= (precision === -1 ? 6 : precision))) { + str = arg.toPrecision(precision === -1 ? (flags&FSHARP ? 6 : undefined) : precision); + } + break; + } + } + if (flags&FMINUS) { + if (flags&FPLUS || flags&FSPACE) { str = (flags&FPLUS ? '+' : ' ') + str; } + while (str.length < width) { str = str + ' '; } + } else { + if (flags&FZERO && arg !== Infinity && !isNaN(arg)) { + while (str.length < width - ((flags&FPLUS || flags&FSPACE) ? 1 : 0)) { str = '0' + str; } + if (flags&FPLUS || flags&FSPACE) { str = (flags&FPLUS ? '+' : ' ') + str; } + } else { + if (flags&FPLUS || flags&FSPACE) { str = (flags&FPLUS ? '+' : ' ') + str; } + while (str.length < width) { str = ' ' + str; } + } + } + } else { + if (arg === -Infinity) { + str = 'Inf'; + } else { + switch (format_string.charAt(i)) { + case 'f': + str = (-arg).toFixed(precision === -1 ? 6 : precision); + break; + case 'e': + case 'E': + str = (-arg).toExponential(precision === -1 ? 6 : precision); + break; + case 'g': + case 'G': + str = (-arg).toExponential(); + exponent = parseInt(str.split('e')[1], 10); + if (!(exponent < -4 || exponent >= (precision === -1 ? 6 : precision))) { + str = (-arg).toPrecision(precision === -1 ? (flags&FSHARP ? 6 : undefined) : precision); + } + break; + } + } + if (flags&FMINUS) { + str = '-' + str; + while (str.length < width) { str = str + ' '; } + } else { + if (flags&FZERO && arg !== -Infinity) { + while (str.length < width - 1) { str = '0' + str; } + str = '-' + str; + } else { + str = '-' + str; + while (str.length < width) { str = ' ' + str; } + } + } + } + if (format_string.charAt(i) === format_string.charAt(i).toUpperCase() && arg !== Infinity && arg !== -Infinity && !isNaN(arg)) { + str = str.toUpperCase(); + } + str = str.replace(/([eE][-+]?)([0-9])$/, '$10$2'); + break format_sequence; + + case 'a': + case 'A': + // Not implemented because there are no specs for this field type. + self.$raise($$($nesting, 'NotImplementedError'), "`A` and `a` format field types are not implemented in Opal yet") + + case 'c': + arg = GET_ARG(); + if ((arg)['$respond_to?']("to_ary")) { arg = (arg).$to_ary()[0]; } + if ((arg)['$respond_to?']("to_str")) { + str = (arg).$to_str(); + } else { + str = String.fromCharCode($$($nesting, 'Opal').$coerce_to(arg, $$($nesting, 'Integer'), "to_int")); + } + if (str.length !== 1) { + self.$raise($$($nesting, 'ArgumentError'), "%c requires a character") + } + if (flags&FMINUS) { + while (str.length < width) { str = str + ' '; } + } else { + while (str.length < width) { str = ' ' + str; } + } + break format_sequence; + + case 'p': + str = (GET_ARG()).$inspect(); + if (precision !== -1) { str = str.slice(0, precision); } + if (flags&FMINUS) { + while (str.length < width) { str = str + ' '; } + } else { + while (str.length < width) { str = ' ' + str; } + } + break format_sequence; + + case 's': + str = (GET_ARG()).$to_s(); + if (precision !== -1) { str = str.slice(0, precision); } + if (flags&FMINUS) { + while (str.length < width) { str = str + ' '; } + } else { + while (str.length < width) { str = ' ' + str; } + } + break format_sequence; + + default: + self.$raise($$($nesting, 'ArgumentError'), "" + "malformed format string - %" + (format_string.charAt(i))) + } + } + + if (str === undefined) { + self.$raise($$($nesting, 'ArgumentError'), "malformed format string - %") + } + + result += format_string.slice(begin_slice, end_slice) + str; + begin_slice = i + 1; + } + + if ($gvars.DEBUG && pos_arg_num >= 0 && seq_arg_num < args.length) { + self.$raise($$($nesting, 'ArgumentError'), "too many arguments for format string") + } + + return result + format_string.slice(begin_slice); + ; + }, TMP_Kernel_format_24.$$arity = -2); + + Opal.def(self, '$hash', TMP_Kernel_hash_25 = function $$hash() { + var self = this; + + return self.$__id__() + }, TMP_Kernel_hash_25.$$arity = 0); + + Opal.def(self, '$initialize_copy', TMP_Kernel_initialize_copy_26 = function $$initialize_copy(other) { + var self = this; + + return nil + }, TMP_Kernel_initialize_copy_26.$$arity = 1); + + Opal.def(self, '$inspect', TMP_Kernel_inspect_27 = function $$inspect() { + var self = this; + + return self.$to_s() + }, TMP_Kernel_inspect_27.$$arity = 0); + + Opal.def(self, '$instance_of?', TMP_Kernel_instance_of$q_28 = function(klass) { + var self = this; + + + if (!klass.$$is_class && !klass.$$is_module) { + self.$raise($$($nesting, 'TypeError'), "class or module required"); + } + + return self.$$class === klass; + + }, TMP_Kernel_instance_of$q_28.$$arity = 1); + + Opal.def(self, '$instance_variable_defined?', TMP_Kernel_instance_variable_defined$q_29 = function(name) { + var self = this; + + + name = $$($nesting, 'Opal')['$instance_variable_name!'](name); + return Opal.hasOwnProperty.call(self, name.substr(1));; + }, TMP_Kernel_instance_variable_defined$q_29.$$arity = 1); + + Opal.def(self, '$instance_variable_get', TMP_Kernel_instance_variable_get_30 = function $$instance_variable_get(name) { + var self = this; + + + name = $$($nesting, 'Opal')['$instance_variable_name!'](name); + + var ivar = self[Opal.ivar(name.substr(1))]; + + return ivar == null ? nil : ivar; + ; + }, TMP_Kernel_instance_variable_get_30.$$arity = 1); + + Opal.def(self, '$instance_variable_set', TMP_Kernel_instance_variable_set_31 = function $$instance_variable_set(name, value) { + var self = this; + + + name = $$($nesting, 'Opal')['$instance_variable_name!'](name); + return self[Opal.ivar(name.substr(1))] = value;; + }, TMP_Kernel_instance_variable_set_31.$$arity = 2); + + Opal.def(self, '$remove_instance_variable', TMP_Kernel_remove_instance_variable_32 = function $$remove_instance_variable(name) { + var self = this; + + + name = $$($nesting, 'Opal')['$instance_variable_name!'](name); + + var key = Opal.ivar(name.substr(1)), + val; + if (self.hasOwnProperty(key)) { + val = self[key]; + delete self[key]; + return val; + } + ; + return self.$raise($$($nesting, 'NameError'), "" + "instance variable " + (name) + " not defined"); + }, TMP_Kernel_remove_instance_variable_32.$$arity = 1); + + Opal.def(self, '$instance_variables', TMP_Kernel_instance_variables_33 = function $$instance_variables() { + var self = this; + + + var result = [], ivar; + + for (var name in self) { + if (self.hasOwnProperty(name) && name.charAt(0) !== '$') { + if (name.substr(-1) === '$') { + ivar = name.slice(0, name.length - 1); + } else { + ivar = name; + } + result.push('@' + ivar); + } + } + + return result; + + }, TMP_Kernel_instance_variables_33.$$arity = 0); + + Opal.def(self, '$Integer', TMP_Kernel_Integer_34 = function $$Integer(value, base) { + var self = this; + + + ; + + var i, str, base_digits; + + if (!value.$$is_string) { + if (base !== undefined) { + self.$raise($$($nesting, 'ArgumentError'), "base specified for non string value") + } + if (value === nil) { + self.$raise($$($nesting, 'TypeError'), "can't convert nil into Integer") + } + if (value.$$is_number) { + if (value === Infinity || value === -Infinity || isNaN(value)) { + self.$raise($$($nesting, 'FloatDomainError'), value) + } + return Math.floor(value); + } + if (value['$respond_to?']("to_int")) { + i = value.$to_int(); + if (i !== nil) { + return i; + } + } + return $$($nesting, 'Opal')['$coerce_to!'](value, $$($nesting, 'Integer'), "to_i"); + } + + if (value === "0") { + return 0; + } + + if (base === undefined) { + base = 0; + } else { + base = $$($nesting, 'Opal').$coerce_to(base, $$($nesting, 'Integer'), "to_int"); + if (base === 1 || base < 0 || base > 36) { + self.$raise($$($nesting, 'ArgumentError'), "" + "invalid radix " + (base)) + } + } + + str = value.toLowerCase(); + + str = str.replace(/(\d)_(?=\d)/g, '$1'); + + str = str.replace(/^(\s*[+-]?)(0[bodx]?)/, function (_, head, flag) { + switch (flag) { + case '0b': + if (base === 0 || base === 2) { + base = 2; + return head; + } + case '0': + case '0o': + if (base === 0 || base === 8) { + base = 8; + return head; + } + case '0d': + if (base === 0 || base === 10) { + base = 10; + return head; + } + case '0x': + if (base === 0 || base === 16) { + base = 16; + return head; + } + } + self.$raise($$($nesting, 'ArgumentError'), "" + "invalid value for Integer(): \"" + (value) + "\"") + }); + + base = (base === 0 ? 10 : base); + + base_digits = '0-' + (base <= 10 ? base - 1 : '9a-' + String.fromCharCode(97 + (base - 11))); + + if (!(new RegExp('^\\s*[+-]?[' + base_digits + ']+\\s*$')).test(str)) { + self.$raise($$($nesting, 'ArgumentError'), "" + "invalid value for Integer(): \"" + (value) + "\"") + } + + i = parseInt(str, base); + + if (isNaN(i)) { + self.$raise($$($nesting, 'ArgumentError'), "" + "invalid value for Integer(): \"" + (value) + "\"") + } + + return i; + ; + }, TMP_Kernel_Integer_34.$$arity = -2); + + Opal.def(self, '$Float', TMP_Kernel_Float_35 = function $$Float(value) { + var self = this; + + + var str; + + if (value === nil) { + self.$raise($$($nesting, 'TypeError'), "can't convert nil into Float") + } + + if (value.$$is_string) { + str = value.toString(); + + str = str.replace(/(\d)_(?=\d)/g, '$1'); + + //Special case for hex strings only: + if (/^\s*[-+]?0[xX][0-9a-fA-F]+\s*$/.test(str)) { + return self.$Integer(str); + } + + if (!/^\s*[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?\s*$/.test(str)) { + self.$raise($$($nesting, 'ArgumentError'), "" + "invalid value for Float(): \"" + (value) + "\"") + } + + return parseFloat(str); + } + + return $$($nesting, 'Opal')['$coerce_to!'](value, $$($nesting, 'Float'), "to_f"); + + }, TMP_Kernel_Float_35.$$arity = 1); + + Opal.def(self, '$Hash', TMP_Kernel_Hash_36 = function $$Hash(arg) { + var $a, self = this; + + + if ($truthy(($truthy($a = arg['$nil?']()) ? $a : arg['$==']([])))) { + return $hash2([], {})}; + if ($truthy($$($nesting, 'Hash')['$==='](arg))) { + return arg}; + return $$($nesting, 'Opal')['$coerce_to!'](arg, $$($nesting, 'Hash'), "to_hash"); + }, TMP_Kernel_Hash_36.$$arity = 1); + + Opal.def(self, '$is_a?', TMP_Kernel_is_a$q_37 = function(klass) { + var self = this; + + + if (!klass.$$is_class && !klass.$$is_module) { + self.$raise($$($nesting, 'TypeError'), "class or module required"); + } + + return Opal.is_a(self, klass); + + }, TMP_Kernel_is_a$q_37.$$arity = 1); + + Opal.def(self, '$itself', TMP_Kernel_itself_38 = function $$itself() { + var self = this; + + return self + }, TMP_Kernel_itself_38.$$arity = 0); + Opal.alias(self, "kind_of?", "is_a?"); + + Opal.def(self, '$lambda', TMP_Kernel_lambda_39 = function $$lambda() { + var $iter = TMP_Kernel_lambda_39.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Kernel_lambda_39.$$p = null; + + + if ($iter) TMP_Kernel_lambda_39.$$p = null;; + return Opal.lambda(block);; + }, TMP_Kernel_lambda_39.$$arity = 0); + + Opal.def(self, '$load', TMP_Kernel_load_40 = function $$load(file) { + var self = this; + + + file = $$($nesting, 'Opal')['$coerce_to!'](file, $$($nesting, 'String'), "to_str"); + return Opal.load(file); + }, TMP_Kernel_load_40.$$arity = 1); + + Opal.def(self, '$loop', TMP_Kernel_loop_41 = function $$loop() { + var TMP_42, $a, $iter = TMP_Kernel_loop_41.$$p, $yield = $iter || nil, self = this, e = nil; + + if ($iter) TMP_Kernel_loop_41.$$p = null; + + if (($yield !== nil)) { + } else { + return $send(self, 'enum_for', ["loop"], (TMP_42 = function(){var self = TMP_42.$$s || this; + + return $$$($$($nesting, 'Float'), 'INFINITY')}, TMP_42.$$s = self, TMP_42.$$arity = 0, TMP_42)) + }; + while ($truthy(true)) { + + try { + Opal.yieldX($yield, []) + } catch ($err) { + if (Opal.rescue($err, [$$($nesting, 'StopIteration')])) {e = $err; + try { + return e.$result() + } finally { Opal.pop_exception() } + } else { throw $err; } + }; + }; + return self; + }, TMP_Kernel_loop_41.$$arity = 0); + + Opal.def(self, '$nil?', TMP_Kernel_nil$q_43 = function() { + var self = this; + + return false + }, TMP_Kernel_nil$q_43.$$arity = 0); + Opal.alias(self, "object_id", "__id__"); + + Opal.def(self, '$printf', TMP_Kernel_printf_44 = function $$printf($a) { + var $post_args, args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + if ($truthy(args['$any?']())) { + self.$print($send(self, 'format', Opal.to_a(args)))}; + return nil; + }, TMP_Kernel_printf_44.$$arity = -1); + + Opal.def(self, '$proc', TMP_Kernel_proc_45 = function $$proc() { + var $iter = TMP_Kernel_proc_45.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Kernel_proc_45.$$p = null; + + + if ($iter) TMP_Kernel_proc_45.$$p = null;; + if ($truthy(block)) { + } else { + self.$raise($$($nesting, 'ArgumentError'), "tried to create Proc object without a block") + }; + block.$$is_lambda = false; + return block; + }, TMP_Kernel_proc_45.$$arity = 0); + + Opal.def(self, '$puts', TMP_Kernel_puts_46 = function $$puts($a) { + var $post_args, strs, self = this; + if ($gvars.stdout == null) $gvars.stdout = nil; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + strs = $post_args;; + return $send($gvars.stdout, 'puts', Opal.to_a(strs)); + }, TMP_Kernel_puts_46.$$arity = -1); + + Opal.def(self, '$p', TMP_Kernel_p_47 = function $$p($a) { + var $post_args, args, TMP_48, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + $send(args, 'each', [], (TMP_48 = function(obj){var self = TMP_48.$$s || this; + if ($gvars.stdout == null) $gvars.stdout = nil; + + + + if (obj == null) { + obj = nil; + }; + return $gvars.stdout.$puts(obj.$inspect());}, TMP_48.$$s = self, TMP_48.$$arity = 1, TMP_48)); + if ($truthy($rb_le(args.$length(), 1))) { + return args['$[]'](0) + } else { + return args + }; + }, TMP_Kernel_p_47.$$arity = -1); + + Opal.def(self, '$print', TMP_Kernel_print_49 = function $$print($a) { + var $post_args, strs, self = this; + if ($gvars.stdout == null) $gvars.stdout = nil; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + strs = $post_args;; + return $send($gvars.stdout, 'print', Opal.to_a(strs)); + }, TMP_Kernel_print_49.$$arity = -1); + + Opal.def(self, '$warn', TMP_Kernel_warn_50 = function $$warn($a) { + var $post_args, strs, $b, self = this; + if ($gvars.VERBOSE == null) $gvars.VERBOSE = nil; + if ($gvars.stderr == null) $gvars.stderr = nil; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + strs = $post_args;; + if ($truthy(($truthy($b = $gvars.VERBOSE['$nil?']()) ? $b : strs['$empty?']()))) { + return nil + } else { + return $send($gvars.stderr, 'puts', Opal.to_a(strs)) + }; + }, TMP_Kernel_warn_50.$$arity = -1); + + Opal.def(self, '$raise', TMP_Kernel_raise_51 = function $$raise(exception, string, _backtrace) { + var self = this; + if ($gvars["!"] == null) $gvars["!"] = nil; + + + ; + + if (string == null) { + string = nil; + }; + + if (_backtrace == null) { + _backtrace = nil; + }; + + if (exception == null && $gvars["!"] !== nil) { + throw $gvars["!"]; + } + if (exception == null) { + exception = $$($nesting, 'RuntimeError').$new(); + } + else if (exception.$$is_string) { + exception = $$($nesting, 'RuntimeError').$new(exception); + } + // using respond_to? and not an undefined check to avoid method_missing matching as true + else if (exception.$$is_class && exception['$respond_to?']("exception")) { + exception = exception.$exception(string); + } + else if (exception['$is_a?']($$($nesting, 'Exception'))) { + // exception is fine + } + else { + exception = $$($nesting, 'TypeError').$new("exception class/object expected"); + } + + if ($gvars["!"] !== nil) { + Opal.exceptions.push($gvars["!"]); + } + + $gvars["!"] = exception; + + throw exception; + ; + }, TMP_Kernel_raise_51.$$arity = -1); + Opal.alias(self, "fail", "raise"); + + Opal.def(self, '$rand', TMP_Kernel_rand_52 = function $$rand(max) { + var self = this; + + + ; + + if (max === undefined) { + return $$$($$($nesting, 'Random'), 'DEFAULT').$rand(); + } + + if (max.$$is_number) { + if (max < 0) { + max = Math.abs(max); + } + + if (max % 1 !== 0) { + max = max.$to_i(); + } + + if (max === 0) { + max = undefined; + } + } + ; + return $$$($$($nesting, 'Random'), 'DEFAULT').$rand(max); + }, TMP_Kernel_rand_52.$$arity = -1); + + Opal.def(self, '$respond_to?', TMP_Kernel_respond_to$q_53 = function(name, include_all) { + var self = this; + + + + if (include_all == null) { + include_all = false; + }; + if ($truthy(self['$respond_to_missing?'](name, include_all))) { + return true}; + + var body = self['$' + name]; + + if (typeof(body) === "function" && !body.$$stub) { + return true; + } + ; + return false; + }, TMP_Kernel_respond_to$q_53.$$arity = -2); + + Opal.def(self, '$respond_to_missing?', TMP_Kernel_respond_to_missing$q_54 = function(method_name, include_all) { + var self = this; + + + + if (include_all == null) { + include_all = false; + }; + return false; + }, TMP_Kernel_respond_to_missing$q_54.$$arity = -2); + + Opal.def(self, '$require', TMP_Kernel_require_55 = function $$require(file) { + var self = this; + + + file = $$($nesting, 'Opal')['$coerce_to!'](file, $$($nesting, 'String'), "to_str"); + return Opal.require(file); + }, TMP_Kernel_require_55.$$arity = 1); + + Opal.def(self, '$require_relative', TMP_Kernel_require_relative_56 = function $$require_relative(file) { + var self = this; + + + $$($nesting, 'Opal')['$try_convert!'](file, $$($nesting, 'String'), "to_str"); + file = $$($nesting, 'File').$expand_path($$($nesting, 'File').$join(Opal.current_file, "..", file)); + return Opal.require(file); + }, TMP_Kernel_require_relative_56.$$arity = 1); + + Opal.def(self, '$require_tree', TMP_Kernel_require_tree_57 = function $$require_tree(path) { + var self = this; + + + var result = []; + + path = $$($nesting, 'File').$expand_path(path) + path = Opal.normalize(path); + if (path === '.') path = ''; + for (var name in Opal.modules) { + if ((name)['$start_with?'](path)) { + result.push([name, Opal.require(name)]); + } + } + + return result; + + }, TMP_Kernel_require_tree_57.$$arity = 1); + Opal.alias(self, "send", "__send__"); + Opal.alias(self, "public_send", "__send__"); + + Opal.def(self, '$singleton_class', TMP_Kernel_singleton_class_58 = function $$singleton_class() { + var self = this; + + return Opal.get_singleton_class(self); + }, TMP_Kernel_singleton_class_58.$$arity = 0); + + Opal.def(self, '$sleep', TMP_Kernel_sleep_59 = function $$sleep(seconds) { + var self = this; + + + + if (seconds == null) { + seconds = nil; + }; + + if (seconds === nil) { + self.$raise($$($nesting, 'TypeError'), "can't convert NilClass into time interval") + } + if (!seconds.$$is_number) { + self.$raise($$($nesting, 'TypeError'), "" + "can't convert " + (seconds.$class()) + " into time interval") + } + if (seconds < 0) { + self.$raise($$($nesting, 'ArgumentError'), "time interval must be positive") + } + var get_time = Opal.global.performance ? + function() {return performance.now()} : + function() {return new Date()} + + var t = get_time(); + while (get_time() - t <= seconds * 1000); + return seconds; + ; + }, TMP_Kernel_sleep_59.$$arity = -1); + Opal.alias(self, "sprintf", "format"); + + Opal.def(self, '$srand', TMP_Kernel_srand_60 = function $$srand(seed) { + var self = this; + + + + if (seed == null) { + seed = $$($nesting, 'Random').$new_seed(); + }; + return $$($nesting, 'Random').$srand(seed); + }, TMP_Kernel_srand_60.$$arity = -1); + + Opal.def(self, '$String', TMP_Kernel_String_61 = function $$String(str) { + var $a, self = this; + + return ($truthy($a = $$($nesting, 'Opal')['$coerce_to?'](str, $$($nesting, 'String'), "to_str")) ? $a : $$($nesting, 'Opal')['$coerce_to!'](str, $$($nesting, 'String'), "to_s")) + }, TMP_Kernel_String_61.$$arity = 1); + + Opal.def(self, '$tap', TMP_Kernel_tap_62 = function $$tap() { + var $iter = TMP_Kernel_tap_62.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Kernel_tap_62.$$p = null; + + + if ($iter) TMP_Kernel_tap_62.$$p = null;; + Opal.yield1(block, self); + return self; + }, TMP_Kernel_tap_62.$$arity = 0); + + Opal.def(self, '$to_proc', TMP_Kernel_to_proc_63 = function $$to_proc() { + var self = this; + + return self + }, TMP_Kernel_to_proc_63.$$arity = 0); + + Opal.def(self, '$to_s', TMP_Kernel_to_s_64 = function $$to_s() { + var self = this; + + return "" + "#<" + (self.$class()) + ":0x" + (self.$__id__().$to_s(16)) + ">" + }, TMP_Kernel_to_s_64.$$arity = 0); + + Opal.def(self, '$catch', TMP_Kernel_catch_65 = function(sym) { + var $iter = TMP_Kernel_catch_65.$$p, $yield = $iter || nil, self = this, e = nil; + + if ($iter) TMP_Kernel_catch_65.$$p = null; + try { + return Opal.yieldX($yield, []); + } catch ($err) { + if (Opal.rescue($err, [$$($nesting, 'UncaughtThrowError')])) {e = $err; + try { + + if (e.$sym()['$=='](sym)) { + return e.$arg()}; + return self.$raise(); + } finally { Opal.pop_exception() } + } else { throw $err; } + } + }, TMP_Kernel_catch_65.$$arity = 1); + + Opal.def(self, '$throw', TMP_Kernel_throw_66 = function($a) { + var $post_args, args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + return self.$raise($$($nesting, 'UncaughtThrowError'), args); + }, TMP_Kernel_throw_66.$$arity = -1); + + Opal.def(self, '$open', TMP_Kernel_open_67 = function $$open($a) { + var $iter = TMP_Kernel_open_67.$$p, block = $iter || nil, $post_args, args, self = this; + + if ($iter) TMP_Kernel_open_67.$$p = null; + + + if ($iter) TMP_Kernel_open_67.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + return $send($$($nesting, 'File'), 'open', Opal.to_a(args), block.$to_proc()); + }, TMP_Kernel_open_67.$$arity = -1); + + Opal.def(self, '$yield_self', TMP_Kernel_yield_self_68 = function $$yield_self() { + var TMP_69, $iter = TMP_Kernel_yield_self_68.$$p, $yield = $iter || nil, self = this; + + if ($iter) TMP_Kernel_yield_self_68.$$p = null; + + if (($yield !== nil)) { + } else { + return $send(self, 'enum_for', ["yield_self"], (TMP_69 = function(){var self = TMP_69.$$s || this; + + return 1}, TMP_69.$$s = self, TMP_69.$$arity = 0, TMP_69)) + }; + return Opal.yield1($yield, self);; + }, TMP_Kernel_yield_self_68.$$arity = 0); + })($nesting[0], $nesting); + return (function($base, $super, $parent_nesting) { + function $Object(){}; + var self = $Object = $klass($base, $super, 'Object', $Object); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return self.$include($$($nesting, 'Kernel')) + })($nesting[0], null, $nesting); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/error"] = function(Opal) { + function $rb_plus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); + } + function $rb_gt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $send = Opal.send, $truthy = Opal.truthy, $module = Opal.module, $hash2 = Opal.hash2; + + Opal.add_stubs(['$new', '$clone', '$to_s', '$empty?', '$class', '$raise', '$+', '$attr_reader', '$[]', '$>', '$length', '$inspect']); + + (function($base, $super, $parent_nesting) { + function $Exception(){}; + var self = $Exception = $klass($base, $super, 'Exception', $Exception); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Exception_new_1, TMP_Exception_exception_2, TMP_Exception_initialize_3, TMP_Exception_backtrace_4, TMP_Exception_exception_5, TMP_Exception_message_6, TMP_Exception_inspect_7, TMP_Exception_set_backtrace_8, TMP_Exception_to_s_9; + + def.message = nil; + + var stack_trace_limit; + Opal.defs(self, '$new', TMP_Exception_new_1 = function($a) { + var $post_args, args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + + var message = (args.length > 0) ? args[0] : nil; + var error = new self(message); + error.name = self.$$name; + error.message = message; + Opal.send(error, error.$initialize, args); + + // Error.captureStackTrace() will use .name and .toString to build the + // first line of the stack trace so it must be called after the error + // has been initialized. + // https://nodejs.org/dist/latest-v6.x/docs/api/errors.html + if (Opal.config.enable_stack_trace && Error.captureStackTrace) { + // Passing Kernel.raise will cut the stack trace from that point above + Error.captureStackTrace(error, stack_trace_limit); + } + + return error; + ; + }, TMP_Exception_new_1.$$arity = -1); + stack_trace_limit = self.$new; + Opal.defs(self, '$exception', TMP_Exception_exception_2 = function $$exception($a) { + var $post_args, args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + return $send(self, 'new', Opal.to_a(args)); + }, TMP_Exception_exception_2.$$arity = -1); + + Opal.def(self, '$initialize', TMP_Exception_initialize_3 = function $$initialize($a) { + var $post_args, args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + return self.message = (args.length > 0) ? args[0] : nil;; + }, TMP_Exception_initialize_3.$$arity = -1); + + Opal.def(self, '$backtrace', TMP_Exception_backtrace_4 = function $$backtrace() { + var self = this; + + + if (self.backtrace) { + // nil is a valid backtrace + return self.backtrace; + } + + var backtrace = self.stack; + + if (typeof(backtrace) === 'string') { + return backtrace.split("\n").slice(0, 15); + } + else if (backtrace) { + return backtrace.slice(0, 15); + } + + return []; + + }, TMP_Exception_backtrace_4.$$arity = 0); + + Opal.def(self, '$exception', TMP_Exception_exception_5 = function $$exception(str) { + var self = this; + + + + if (str == null) { + str = nil; + }; + + if (str === nil || self === str) { + return self; + } + + var cloned = self.$clone(); + cloned.message = str; + return cloned; + ; + }, TMP_Exception_exception_5.$$arity = -1); + + Opal.def(self, '$message', TMP_Exception_message_6 = function $$message() { + var self = this; + + return self.$to_s() + }, TMP_Exception_message_6.$$arity = 0); + + Opal.def(self, '$inspect', TMP_Exception_inspect_7 = function $$inspect() { + var self = this, as_str = nil; + + + as_str = self.$to_s(); + if ($truthy(as_str['$empty?']())) { + return self.$class().$to_s() + } else { + return "" + "#<" + (self.$class().$to_s()) + ": " + (self.$to_s()) + ">" + }; + }, TMP_Exception_inspect_7.$$arity = 0); + + Opal.def(self, '$set_backtrace', TMP_Exception_set_backtrace_8 = function $$set_backtrace(backtrace) { + var self = this; + + + var valid = true, i, ii; + + if (backtrace === nil) { + self.backtrace = nil; + } else if (backtrace.$$is_string) { + self.backtrace = [backtrace]; + } else { + if (backtrace.$$is_array) { + for (i = 0, ii = backtrace.length; i < ii; i++) { + if (!backtrace[i].$$is_string) { + valid = false; + break; + } + } + } else { + valid = false; + } + + if (valid === false) { + self.$raise($$($nesting, 'TypeError'), "backtrace must be Array of String") + } + + self.backtrace = backtrace; + } + + return backtrace; + + }, TMP_Exception_set_backtrace_8.$$arity = 1); + return (Opal.def(self, '$to_s', TMP_Exception_to_s_9 = function $$to_s() { + var $a, $b, self = this; + + return ($truthy($a = ($truthy($b = self.message) ? self.message.$to_s() : $b)) ? $a : self.$class().$to_s()) + }, TMP_Exception_to_s_9.$$arity = 0), nil) && 'to_s'; + })($nesting[0], Error, $nesting); + (function($base, $super, $parent_nesting) { + function $ScriptError(){}; + var self = $ScriptError = $klass($base, $super, 'ScriptError', $ScriptError); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return nil + })($nesting[0], $$($nesting, 'Exception'), $nesting); + (function($base, $super, $parent_nesting) { + function $SyntaxError(){}; + var self = $SyntaxError = $klass($base, $super, 'SyntaxError', $SyntaxError); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return nil + })($nesting[0], $$($nesting, 'ScriptError'), $nesting); + (function($base, $super, $parent_nesting) { + function $LoadError(){}; + var self = $LoadError = $klass($base, $super, 'LoadError', $LoadError); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return nil + })($nesting[0], $$($nesting, 'ScriptError'), $nesting); + (function($base, $super, $parent_nesting) { + function $NotImplementedError(){}; + var self = $NotImplementedError = $klass($base, $super, 'NotImplementedError', $NotImplementedError); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return nil + })($nesting[0], $$($nesting, 'ScriptError'), $nesting); + (function($base, $super, $parent_nesting) { + function $SystemExit(){}; + var self = $SystemExit = $klass($base, $super, 'SystemExit', $SystemExit); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return nil + })($nesting[0], $$($nesting, 'Exception'), $nesting); + (function($base, $super, $parent_nesting) { + function $NoMemoryError(){}; + var self = $NoMemoryError = $klass($base, $super, 'NoMemoryError', $NoMemoryError); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return nil + })($nesting[0], $$($nesting, 'Exception'), $nesting); + (function($base, $super, $parent_nesting) { + function $SignalException(){}; + var self = $SignalException = $klass($base, $super, 'SignalException', $SignalException); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return nil + })($nesting[0], $$($nesting, 'Exception'), $nesting); + (function($base, $super, $parent_nesting) { + function $Interrupt(){}; + var self = $Interrupt = $klass($base, $super, 'Interrupt', $Interrupt); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return nil + })($nesting[0], $$($nesting, 'Exception'), $nesting); + (function($base, $super, $parent_nesting) { + function $SecurityError(){}; + var self = $SecurityError = $klass($base, $super, 'SecurityError', $SecurityError); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return nil + })($nesting[0], $$($nesting, 'Exception'), $nesting); + (function($base, $super, $parent_nesting) { + function $StandardError(){}; + var self = $StandardError = $klass($base, $super, 'StandardError', $StandardError); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return nil + })($nesting[0], $$($nesting, 'Exception'), $nesting); + (function($base, $super, $parent_nesting) { + function $EncodingError(){}; + var self = $EncodingError = $klass($base, $super, 'EncodingError', $EncodingError); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return nil + })($nesting[0], $$($nesting, 'StandardError'), $nesting); + (function($base, $super, $parent_nesting) { + function $ZeroDivisionError(){}; + var self = $ZeroDivisionError = $klass($base, $super, 'ZeroDivisionError', $ZeroDivisionError); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return nil + })($nesting[0], $$($nesting, 'StandardError'), $nesting); + (function($base, $super, $parent_nesting) { + function $NameError(){}; + var self = $NameError = $klass($base, $super, 'NameError', $NameError); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return nil + })($nesting[0], $$($nesting, 'StandardError'), $nesting); + (function($base, $super, $parent_nesting) { + function $NoMethodError(){}; + var self = $NoMethodError = $klass($base, $super, 'NoMethodError', $NoMethodError); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return nil + })($nesting[0], $$($nesting, 'NameError'), $nesting); + (function($base, $super, $parent_nesting) { + function $RuntimeError(){}; + var self = $RuntimeError = $klass($base, $super, 'RuntimeError', $RuntimeError); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return nil + })($nesting[0], $$($nesting, 'StandardError'), $nesting); + (function($base, $super, $parent_nesting) { + function $FrozenError(){}; + var self = $FrozenError = $klass($base, $super, 'FrozenError', $FrozenError); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return nil + })($nesting[0], $$($nesting, 'RuntimeError'), $nesting); + (function($base, $super, $parent_nesting) { + function $LocalJumpError(){}; + var self = $LocalJumpError = $klass($base, $super, 'LocalJumpError', $LocalJumpError); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return nil + })($nesting[0], $$($nesting, 'StandardError'), $nesting); + (function($base, $super, $parent_nesting) { + function $TypeError(){}; + var self = $TypeError = $klass($base, $super, 'TypeError', $TypeError); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return nil + })($nesting[0], $$($nesting, 'StandardError'), $nesting); + (function($base, $super, $parent_nesting) { + function $ArgumentError(){}; + var self = $ArgumentError = $klass($base, $super, 'ArgumentError', $ArgumentError); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return nil + })($nesting[0], $$($nesting, 'StandardError'), $nesting); + (function($base, $super, $parent_nesting) { + function $IndexError(){}; + var self = $IndexError = $klass($base, $super, 'IndexError', $IndexError); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return nil + })($nesting[0], $$($nesting, 'StandardError'), $nesting); + (function($base, $super, $parent_nesting) { + function $StopIteration(){}; + var self = $StopIteration = $klass($base, $super, 'StopIteration', $StopIteration); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return nil + })($nesting[0], $$($nesting, 'IndexError'), $nesting); + (function($base, $super, $parent_nesting) { + function $KeyError(){}; + var self = $KeyError = $klass($base, $super, 'KeyError', $KeyError); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return nil + })($nesting[0], $$($nesting, 'IndexError'), $nesting); + (function($base, $super, $parent_nesting) { + function $RangeError(){}; + var self = $RangeError = $klass($base, $super, 'RangeError', $RangeError); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return nil + })($nesting[0], $$($nesting, 'StandardError'), $nesting); + (function($base, $super, $parent_nesting) { + function $FloatDomainError(){}; + var self = $FloatDomainError = $klass($base, $super, 'FloatDomainError', $FloatDomainError); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return nil + })($nesting[0], $$($nesting, 'RangeError'), $nesting); + (function($base, $super, $parent_nesting) { + function $IOError(){}; + var self = $IOError = $klass($base, $super, 'IOError', $IOError); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return nil + })($nesting[0], $$($nesting, 'StandardError'), $nesting); + (function($base, $super, $parent_nesting) { + function $SystemCallError(){}; + var self = $SystemCallError = $klass($base, $super, 'SystemCallError', $SystemCallError); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return nil + })($nesting[0], $$($nesting, 'StandardError'), $nesting); + (function($base, $parent_nesting) { + function $Errno() {}; + var self = $Errno = $module($base, 'Errno', $Errno); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + (function($base, $super, $parent_nesting) { + function $EINVAL(){}; + var self = $EINVAL = $klass($base, $super, 'EINVAL', $EINVAL); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_EINVAL_new_10; + + return (Opal.defs(self, '$new', TMP_EINVAL_new_10 = function(name) { + var $iter = TMP_EINVAL_new_10.$$p, $yield = $iter || nil, self = this, message = nil; + + if ($iter) TMP_EINVAL_new_10.$$p = null; + + + if (name == null) { + name = nil; + }; + message = "Invalid argument"; + if ($truthy(name)) { + message = $rb_plus(message, "" + " - " + (name))}; + return $send(self, Opal.find_super_dispatcher(self, 'new', TMP_EINVAL_new_10, false, $EINVAL), [message], null); + }, TMP_EINVAL_new_10.$$arity = -1), nil) && 'new' + })($nesting[0], $$($nesting, 'SystemCallError'), $nesting) + })($nesting[0], $nesting); + (function($base, $super, $parent_nesting) { + function $UncaughtThrowError(){}; + var self = $UncaughtThrowError = $klass($base, $super, 'UncaughtThrowError', $UncaughtThrowError); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_UncaughtThrowError_initialize_11; + + def.sym = nil; + + self.$attr_reader("sym", "arg"); + return (Opal.def(self, '$initialize', TMP_UncaughtThrowError_initialize_11 = function $$initialize(args) { + var $iter = TMP_UncaughtThrowError_initialize_11.$$p, $yield = $iter || nil, self = this; + + if ($iter) TMP_UncaughtThrowError_initialize_11.$$p = null; + + self.sym = args['$[]'](0); + if ($truthy($rb_gt(args.$length(), 1))) { + self.arg = args['$[]'](1)}; + return $send(self, Opal.find_super_dispatcher(self, 'initialize', TMP_UncaughtThrowError_initialize_11, false), ["" + "uncaught throw " + (self.sym.$inspect())], null); + }, TMP_UncaughtThrowError_initialize_11.$$arity = 1), nil) && 'initialize'; + })($nesting[0], $$($nesting, 'ArgumentError'), $nesting); + (function($base, $super, $parent_nesting) { + function $NameError(){}; + var self = $NameError = $klass($base, $super, 'NameError', $NameError); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_NameError_initialize_12; + + + self.$attr_reader("name"); + return (Opal.def(self, '$initialize', TMP_NameError_initialize_12 = function $$initialize(message, name) { + var $iter = TMP_NameError_initialize_12.$$p, $yield = $iter || nil, self = this; + + if ($iter) TMP_NameError_initialize_12.$$p = null; + + + if (name == null) { + name = nil; + }; + $send(self, Opal.find_super_dispatcher(self, 'initialize', TMP_NameError_initialize_12, false), [message], null); + return (self.name = name); + }, TMP_NameError_initialize_12.$$arity = -2), nil) && 'initialize'; + })($nesting[0], null, $nesting); + (function($base, $super, $parent_nesting) { + function $NoMethodError(){}; + var self = $NoMethodError = $klass($base, $super, 'NoMethodError', $NoMethodError); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_NoMethodError_initialize_13; + + + self.$attr_reader("args"); + return (Opal.def(self, '$initialize', TMP_NoMethodError_initialize_13 = function $$initialize(message, name, args) { + var $iter = TMP_NoMethodError_initialize_13.$$p, $yield = $iter || nil, self = this; + + if ($iter) TMP_NoMethodError_initialize_13.$$p = null; + + + if (name == null) { + name = nil; + }; + + if (args == null) { + args = []; + }; + $send(self, Opal.find_super_dispatcher(self, 'initialize', TMP_NoMethodError_initialize_13, false), [message, name], null); + return (self.args = args); + }, TMP_NoMethodError_initialize_13.$$arity = -2), nil) && 'initialize'; + })($nesting[0], null, $nesting); + (function($base, $super, $parent_nesting) { + function $StopIteration(){}; + var self = $StopIteration = $klass($base, $super, 'StopIteration', $StopIteration); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return self.$attr_reader("result") + })($nesting[0], null, $nesting); + (function($base, $super, $parent_nesting) { + function $KeyError(){}; + var self = $KeyError = $klass($base, $super, 'KeyError', $KeyError); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_KeyError_initialize_14, TMP_KeyError_receiver_15, TMP_KeyError_key_16; + + def.receiver = def.key = nil; + + + Opal.def(self, '$initialize', TMP_KeyError_initialize_14 = function $$initialize(message, $kwargs) { + var receiver, key, $iter = TMP_KeyError_initialize_14.$$p, $yield = $iter || nil, self = this; + + if ($iter) TMP_KeyError_initialize_14.$$p = null; + + + if ($kwargs == null) { + $kwargs = $hash2([], {}); + } else if (!$kwargs.$$is_hash) { + throw Opal.ArgumentError.$new('expected kwargs'); + }; + + receiver = $kwargs.$$smap["receiver"]; + if (receiver == null) { + receiver = nil + }; + + key = $kwargs.$$smap["key"]; + if (key == null) { + key = nil + }; + $send(self, Opal.find_super_dispatcher(self, 'initialize', TMP_KeyError_initialize_14, false), [message], null); + self.receiver = receiver; + return (self.key = key); + }, TMP_KeyError_initialize_14.$$arity = -2); + + Opal.def(self, '$receiver', TMP_KeyError_receiver_15 = function $$receiver() { + var $a, self = this; + + return ($truthy($a = self.receiver) ? $a : self.$raise($$($nesting, 'ArgumentError'), "no receiver is available")) + }, TMP_KeyError_receiver_15.$$arity = 0); + return (Opal.def(self, '$key', TMP_KeyError_key_16 = function $$key() { + var $a, self = this; + + return ($truthy($a = self.key) ? $a : self.$raise($$($nesting, 'ArgumentError'), "no key is available")) + }, TMP_KeyError_key_16.$$arity = 0), nil) && 'key'; + })($nesting[0], null, $nesting); + return (function($base, $parent_nesting) { + function $JS() {}; + var self = $JS = $module($base, 'JS', $JS); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + (function($base, $super, $parent_nesting) { + function $Error(){}; + var self = $Error = $klass($base, $super, 'Error', $Error); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return nil + })($nesting[0], null, $nesting) + })($nesting[0], $nesting); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/constants"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice; + + + Opal.const_set($nesting[0], 'RUBY_PLATFORM', "opal"); + Opal.const_set($nesting[0], 'RUBY_ENGINE', "opal"); + Opal.const_set($nesting[0], 'RUBY_VERSION', "2.5.1"); + Opal.const_set($nesting[0], 'RUBY_ENGINE_VERSION', "0.11.99.dev"); + Opal.const_set($nesting[0], 'RUBY_RELEASE_DATE', "2018-12-25"); + Opal.const_set($nesting[0], 'RUBY_PATCHLEVEL', 0); + Opal.const_set($nesting[0], 'RUBY_REVISION', 0); + Opal.const_set($nesting[0], 'RUBY_COPYRIGHT', "opal - Copyright (C) 2013-2018 Adam Beynon and the Opal contributors"); + return Opal.const_set($nesting[0], 'RUBY_DESCRIPTION', "" + "opal " + ($$($nesting, 'RUBY_ENGINE_VERSION')) + " (" + ($$($nesting, 'RUBY_RELEASE_DATE')) + " revision " + ($$($nesting, 'RUBY_REVISION')) + ")"); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["opal/base"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice; + + Opal.add_stubs(['$require']); + + self.$require("corelib/runtime"); + self.$require("corelib/helpers"); + self.$require("corelib/module"); + self.$require("corelib/class"); + self.$require("corelib/basic_object"); + self.$require("corelib/kernel"); + self.$require("corelib/error"); + return self.$require("corelib/constants"); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/nil"] = function(Opal) { + function $rb_gt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $hash2 = Opal.hash2, $truthy = Opal.truthy; + + Opal.add_stubs(['$raise', '$name', '$new', '$>', '$length', '$Rational']); + + (function($base, $super, $parent_nesting) { + function $NilClass(){}; + var self = $NilClass = $klass($base, $super, 'NilClass', $NilClass); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_NilClass_$B_2, TMP_NilClass_$_3, TMP_NilClass_$_4, TMP_NilClass_$_5, TMP_NilClass_$eq$eq_6, TMP_NilClass_dup_7, TMP_NilClass_clone_8, TMP_NilClass_inspect_9, TMP_NilClass_nil$q_10, TMP_NilClass_singleton_class_11, TMP_NilClass_to_a_12, TMP_NilClass_to_h_13, TMP_NilClass_to_i_14, TMP_NilClass_to_s_15, TMP_NilClass_to_c_16, TMP_NilClass_rationalize_17, TMP_NilClass_to_r_18, TMP_NilClass_instance_variables_19; + + + def.$$meta = self; + (function(self, $parent_nesting) { + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_allocate_1; + + + + Opal.def(self, '$allocate', TMP_allocate_1 = function $$allocate() { + var self = this; + + return self.$raise($$($nesting, 'TypeError'), "" + "allocator undefined for " + (self.$name())) + }, TMP_allocate_1.$$arity = 0); + + + Opal.udef(self, '$' + "new");; + return nil;; + })(Opal.get_singleton_class(self), $nesting); + + Opal.def(self, '$!', TMP_NilClass_$B_2 = function() { + var self = this; + + return true + }, TMP_NilClass_$B_2.$$arity = 0); + + Opal.def(self, '$&', TMP_NilClass_$_3 = function(other) { + var self = this; + + return false + }, TMP_NilClass_$_3.$$arity = 1); + + Opal.def(self, '$|', TMP_NilClass_$_4 = function(other) { + var self = this; + + return other !== false && other !== nil; + }, TMP_NilClass_$_4.$$arity = 1); + + Opal.def(self, '$^', TMP_NilClass_$_5 = function(other) { + var self = this; + + return other !== false && other !== nil; + }, TMP_NilClass_$_5.$$arity = 1); + + Opal.def(self, '$==', TMP_NilClass_$eq$eq_6 = function(other) { + var self = this; + + return other === nil; + }, TMP_NilClass_$eq$eq_6.$$arity = 1); + + Opal.def(self, '$dup', TMP_NilClass_dup_7 = function $$dup() { + var self = this; + + return nil + }, TMP_NilClass_dup_7.$$arity = 0); + + Opal.def(self, '$clone', TMP_NilClass_clone_8 = function $$clone($kwargs) { + var freeze, self = this; + + + + if ($kwargs == null) { + $kwargs = $hash2([], {}); + } else if (!$kwargs.$$is_hash) { + throw Opal.ArgumentError.$new('expected kwargs'); + }; + + freeze = $kwargs.$$smap["freeze"]; + if (freeze == null) { + freeze = true + }; + return nil; + }, TMP_NilClass_clone_8.$$arity = -1); + + Opal.def(self, '$inspect', TMP_NilClass_inspect_9 = function $$inspect() { + var self = this; + + return "nil" + }, TMP_NilClass_inspect_9.$$arity = 0); + + Opal.def(self, '$nil?', TMP_NilClass_nil$q_10 = function() { + var self = this; + + return true + }, TMP_NilClass_nil$q_10.$$arity = 0); + + Opal.def(self, '$singleton_class', TMP_NilClass_singleton_class_11 = function $$singleton_class() { + var self = this; + + return $$($nesting, 'NilClass') + }, TMP_NilClass_singleton_class_11.$$arity = 0); + + Opal.def(self, '$to_a', TMP_NilClass_to_a_12 = function $$to_a() { + var self = this; + + return [] + }, TMP_NilClass_to_a_12.$$arity = 0); + + Opal.def(self, '$to_h', TMP_NilClass_to_h_13 = function $$to_h() { + var self = this; + + return Opal.hash(); + }, TMP_NilClass_to_h_13.$$arity = 0); + + Opal.def(self, '$to_i', TMP_NilClass_to_i_14 = function $$to_i() { + var self = this; + + return 0 + }, TMP_NilClass_to_i_14.$$arity = 0); + Opal.alias(self, "to_f", "to_i"); + + Opal.def(self, '$to_s', TMP_NilClass_to_s_15 = function $$to_s() { + var self = this; + + return "" + }, TMP_NilClass_to_s_15.$$arity = 0); + + Opal.def(self, '$to_c', TMP_NilClass_to_c_16 = function $$to_c() { + var self = this; + + return $$($nesting, 'Complex').$new(0, 0) + }, TMP_NilClass_to_c_16.$$arity = 0); + + Opal.def(self, '$rationalize', TMP_NilClass_rationalize_17 = function $$rationalize($a) { + var $post_args, args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + if ($truthy($rb_gt(args.$length(), 1))) { + self.$raise($$($nesting, 'ArgumentError'))}; + return self.$Rational(0, 1); + }, TMP_NilClass_rationalize_17.$$arity = -1); + + Opal.def(self, '$to_r', TMP_NilClass_to_r_18 = function $$to_r() { + var self = this; + + return self.$Rational(0, 1) + }, TMP_NilClass_to_r_18.$$arity = 0); + return (Opal.def(self, '$instance_variables', TMP_NilClass_instance_variables_19 = function $$instance_variables() { + var self = this; + + return [] + }, TMP_NilClass_instance_variables_19.$$arity = 0), nil) && 'instance_variables'; + })($nesting[0], null, $nesting); + return Opal.const_set($nesting[0], 'NIL', nil); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/boolean"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $hash2 = Opal.hash2; + + Opal.add_stubs(['$raise', '$name']); + + (function($base, $super, $parent_nesting) { + function $Boolean(){}; + var self = $Boolean = $klass($base, $super, 'Boolean', $Boolean); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Boolean___id___2, TMP_Boolean_$B_3, TMP_Boolean_$_4, TMP_Boolean_$_5, TMP_Boolean_$_6, TMP_Boolean_$eq$eq_7, TMP_Boolean_singleton_class_8, TMP_Boolean_to_s_9, TMP_Boolean_dup_10, TMP_Boolean_clone_11; + + + Opal.defineProperty(Boolean.prototype, '$$is_boolean', true); + Opal.defineProperty(Boolean.prototype, '$$meta', self); + (function(self, $parent_nesting) { + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_allocate_1; + + + + Opal.def(self, '$allocate', TMP_allocate_1 = function $$allocate() { + var self = this; + + return self.$raise($$($nesting, 'TypeError'), "" + "allocator undefined for " + (self.$name())) + }, TMP_allocate_1.$$arity = 0); + + + Opal.udef(self, '$' + "new");; + return nil;; + })(Opal.get_singleton_class(self), $nesting); + + Opal.def(self, '$__id__', TMP_Boolean___id___2 = function $$__id__() { + var self = this; + + return self.valueOf() ? 2 : 0; + }, TMP_Boolean___id___2.$$arity = 0); + Opal.alias(self, "object_id", "__id__"); + + Opal.def(self, '$!', TMP_Boolean_$B_3 = function() { + var self = this; + + return self != true; + }, TMP_Boolean_$B_3.$$arity = 0); + + Opal.def(self, '$&', TMP_Boolean_$_4 = function(other) { + var self = this; + + return (self == true) ? (other !== false && other !== nil) : false; + }, TMP_Boolean_$_4.$$arity = 1); + + Opal.def(self, '$|', TMP_Boolean_$_5 = function(other) { + var self = this; + + return (self == true) ? true : (other !== false && other !== nil); + }, TMP_Boolean_$_5.$$arity = 1); + + Opal.def(self, '$^', TMP_Boolean_$_6 = function(other) { + var self = this; + + return (self == true) ? (other === false || other === nil) : (other !== false && other !== nil); + }, TMP_Boolean_$_6.$$arity = 1); + + Opal.def(self, '$==', TMP_Boolean_$eq$eq_7 = function(other) { + var self = this; + + return (self == true) === other.valueOf(); + }, TMP_Boolean_$eq$eq_7.$$arity = 1); + Opal.alias(self, "equal?", "=="); + Opal.alias(self, "eql?", "=="); + + Opal.def(self, '$singleton_class', TMP_Boolean_singleton_class_8 = function $$singleton_class() { + var self = this; + + return $$($nesting, 'Boolean') + }, TMP_Boolean_singleton_class_8.$$arity = 0); + + Opal.def(self, '$to_s', TMP_Boolean_to_s_9 = function $$to_s() { + var self = this; + + return (self == true) ? 'true' : 'false'; + }, TMP_Boolean_to_s_9.$$arity = 0); + + Opal.def(self, '$dup', TMP_Boolean_dup_10 = function $$dup() { + var self = this; + + return self + }, TMP_Boolean_dup_10.$$arity = 0); + return (Opal.def(self, '$clone', TMP_Boolean_clone_11 = function $$clone($kwargs) { + var freeze, self = this; + + + + if ($kwargs == null) { + $kwargs = $hash2([], {}); + } else if (!$kwargs.$$is_hash) { + throw Opal.ArgumentError.$new('expected kwargs'); + }; + + freeze = $kwargs.$$smap["freeze"]; + if (freeze == null) { + freeze = true + }; + return self; + }, TMP_Boolean_clone_11.$$arity = -1), nil) && 'clone'; + })($nesting[0], Boolean, $nesting); + Opal.const_set($nesting[0], 'TrueClass', $$($nesting, 'Boolean')); + Opal.const_set($nesting[0], 'FalseClass', $$($nesting, 'Boolean')); + Opal.const_set($nesting[0], 'TRUE', true); + return Opal.const_set($nesting[0], 'FALSE', false); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/comparable"] = function(Opal) { + function $rb_gt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); + } + function $rb_lt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $truthy = Opal.truthy; + + Opal.add_stubs(['$===', '$>', '$<', '$equal?', '$<=>', '$normalize', '$raise', '$class']); + return (function($base, $parent_nesting) { + function $Comparable() {}; + var self = $Comparable = $module($base, 'Comparable', $Comparable); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Comparable_normalize_1, TMP_Comparable_$eq$eq_2, TMP_Comparable_$gt_3, TMP_Comparable_$gt$eq_4, TMP_Comparable_$lt_5, TMP_Comparable_$lt$eq_6, TMP_Comparable_between$q_7, TMP_Comparable_clamp_8; + + + Opal.defs(self, '$normalize', TMP_Comparable_normalize_1 = function $$normalize(what) { + var self = this; + + + if ($truthy($$($nesting, 'Integer')['$==='](what))) { + return what}; + if ($truthy($rb_gt(what, 0))) { + return 1}; + if ($truthy($rb_lt(what, 0))) { + return -1}; + return 0; + }, TMP_Comparable_normalize_1.$$arity = 1); + + Opal.def(self, '$==', TMP_Comparable_$eq$eq_2 = function(other) { + var self = this, cmp = nil; + + try { + + if ($truthy(self['$equal?'](other))) { + return true}; + + if (self["$<=>"] == Opal.Kernel["$<=>"]) { + return false; + } + + // check for infinite recursion + if (self.$$comparable) { + delete self.$$comparable; + return false; + } + ; + if ($truthy((cmp = self['$<=>'](other)))) { + } else { + return false + }; + return $$($nesting, 'Comparable').$normalize(cmp) == 0; + } catch ($err) { + if (Opal.rescue($err, [$$($nesting, 'StandardError')])) { + try { + return false + } finally { Opal.pop_exception() } + } else { throw $err; } + } + }, TMP_Comparable_$eq$eq_2.$$arity = 1); + + Opal.def(self, '$>', TMP_Comparable_$gt_3 = function(other) { + var self = this, cmp = nil; + + + if ($truthy((cmp = self['$<=>'](other)))) { + } else { + self.$raise($$($nesting, 'ArgumentError'), "" + "comparison of " + (self.$class()) + " with " + (other.$class()) + " failed") + }; + return $$($nesting, 'Comparable').$normalize(cmp) > 0; + }, TMP_Comparable_$gt_3.$$arity = 1); + + Opal.def(self, '$>=', TMP_Comparable_$gt$eq_4 = function(other) { + var self = this, cmp = nil; + + + if ($truthy((cmp = self['$<=>'](other)))) { + } else { + self.$raise($$($nesting, 'ArgumentError'), "" + "comparison of " + (self.$class()) + " with " + (other.$class()) + " failed") + }; + return $$($nesting, 'Comparable').$normalize(cmp) >= 0; + }, TMP_Comparable_$gt$eq_4.$$arity = 1); + + Opal.def(self, '$<', TMP_Comparable_$lt_5 = function(other) { + var self = this, cmp = nil; + + + if ($truthy((cmp = self['$<=>'](other)))) { + } else { + self.$raise($$($nesting, 'ArgumentError'), "" + "comparison of " + (self.$class()) + " with " + (other.$class()) + " failed") + }; + return $$($nesting, 'Comparable').$normalize(cmp) < 0; + }, TMP_Comparable_$lt_5.$$arity = 1); + + Opal.def(self, '$<=', TMP_Comparable_$lt$eq_6 = function(other) { + var self = this, cmp = nil; + + + if ($truthy((cmp = self['$<=>'](other)))) { + } else { + self.$raise($$($nesting, 'ArgumentError'), "" + "comparison of " + (self.$class()) + " with " + (other.$class()) + " failed") + }; + return $$($nesting, 'Comparable').$normalize(cmp) <= 0; + }, TMP_Comparable_$lt$eq_6.$$arity = 1); + + Opal.def(self, '$between?', TMP_Comparable_between$q_7 = function(min, max) { + var self = this; + + + if ($rb_lt(self, min)) { + return false}; + if ($rb_gt(self, max)) { + return false}; + return true; + }, TMP_Comparable_between$q_7.$$arity = 2); + + Opal.def(self, '$clamp', TMP_Comparable_clamp_8 = function $$clamp(min, max) { + var self = this, cmp = nil; + + + cmp = min['$<=>'](max); + if ($truthy(cmp)) { + } else { + self.$raise($$($nesting, 'ArgumentError'), "" + "comparison of " + (min.$class()) + " with " + (max.$class()) + " failed") + }; + if ($truthy($rb_gt($$($nesting, 'Comparable').$normalize(cmp), 0))) { + self.$raise($$($nesting, 'ArgumentError'), "min argument must be smaller than max argument")}; + if ($truthy($rb_lt($$($nesting, 'Comparable').$normalize(self['$<=>'](min)), 0))) { + return min}; + if ($truthy($rb_gt($$($nesting, 'Comparable').$normalize(self['$<=>'](max)), 0))) { + return max}; + return self; + }, TMP_Comparable_clamp_8.$$arity = 2); + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/regexp"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $send = Opal.send, $truthy = Opal.truthy, $gvars = Opal.gvars; + + Opal.add_stubs(['$nil?', '$[]', '$raise', '$escape', '$options', '$to_str', '$new', '$join', '$coerce_to!', '$!', '$match', '$coerce_to?', '$begin', '$coerce_to', '$=~', '$attr_reader', '$===', '$inspect', '$to_a']); + + (function($base, $super, $parent_nesting) { + function $RegexpError(){}; + var self = $RegexpError = $klass($base, $super, 'RegexpError', $RegexpError); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return nil + })($nesting[0], $$($nesting, 'StandardError'), $nesting); + (function($base, $super, $parent_nesting) { + function $Regexp(){}; + var self = $Regexp = $klass($base, $super, 'Regexp', $Regexp); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Regexp_$eq$eq_6, TMP_Regexp_$eq$eq$eq_7, TMP_Regexp_$eq$_8, TMP_Regexp_inspect_9, TMP_Regexp_match_10, TMP_Regexp_match$q_11, TMP_Regexp_$_12, TMP_Regexp_source_13, TMP_Regexp_options_14, TMP_Regexp_casefold$q_15; + + + Opal.const_set($nesting[0], 'IGNORECASE', 1); + Opal.const_set($nesting[0], 'EXTENDED', 2); + Opal.const_set($nesting[0], 'MULTILINE', 4); + Opal.defineProperty(RegExp.prototype, '$$is_regexp', true); + (function(self, $parent_nesting) { + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_allocate_1, TMP_escape_2, TMP_last_match_3, TMP_union_4, TMP_new_5; + + + + Opal.def(self, '$allocate', TMP_allocate_1 = function $$allocate() { + var $iter = TMP_allocate_1.$$p, $yield = $iter || nil, self = this, allocated = nil, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_allocate_1.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + + allocated = $send(self, Opal.find_super_dispatcher(self, 'allocate', TMP_allocate_1, false), $zuper, $iter); + allocated.uninitialized = true; + return allocated; + }, TMP_allocate_1.$$arity = 0); + + Opal.def(self, '$escape', TMP_escape_2 = function $$escape(string) { + var self = this; + + return Opal.escape_regexp(string); + }, TMP_escape_2.$$arity = 1); + + Opal.def(self, '$last_match', TMP_last_match_3 = function $$last_match(n) { + var self = this; + if ($gvars["~"] == null) $gvars["~"] = nil; + + + + if (n == null) { + n = nil; + }; + if ($truthy(n['$nil?']())) { + return $gvars["~"] + } else { + return $gvars["~"]['$[]'](n) + }; + }, TMP_last_match_3.$$arity = -1); + Opal.alias(self, "quote", "escape"); + + Opal.def(self, '$union', TMP_union_4 = function $$union($a) { + var $post_args, parts, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + parts = $post_args;; + + var is_first_part_array, quoted_validated, part, options, each_part_options; + if (parts.length == 0) { + return /(?!)/; + } + // return fast if there's only one element + if (parts.length == 1 && parts[0].$$is_regexp) { + return parts[0]; + } + // cover the 2 arrays passed as arguments case + is_first_part_array = parts[0].$$is_array; + if (parts.length > 1 && is_first_part_array) { + self.$raise($$($nesting, 'TypeError'), "no implicit conversion of Array into String") + } + // deal with splat issues (related to https://github.com/opal/opal/issues/858) + if (is_first_part_array) { + parts = parts[0]; + } + options = undefined; + quoted_validated = []; + for (var i=0; i < parts.length; i++) { + part = parts[i]; + if (part.$$is_string) { + quoted_validated.push(self.$escape(part)); + } + else if (part.$$is_regexp) { + each_part_options = (part).$options(); + if (options != undefined && options != each_part_options) { + self.$raise($$($nesting, 'TypeError'), "All expressions must use the same options") + } + options = each_part_options; + quoted_validated.push('('+part.source+')'); + } + else { + quoted_validated.push(self.$escape((part).$to_str())); + } + } + ; + return self.$new((quoted_validated).$join("|"), options); + }, TMP_union_4.$$arity = -1); + return (Opal.def(self, '$new', TMP_new_5 = function(regexp, options) { + var self = this; + + + ; + + if (regexp.$$is_regexp) { + return new RegExp(regexp); + } + + regexp = $$($nesting, 'Opal')['$coerce_to!'](regexp, $$($nesting, 'String'), "to_str"); + + if (regexp.charAt(regexp.length - 1) === '\\' && regexp.charAt(regexp.length - 2) !== '\\') { + self.$raise($$($nesting, 'RegexpError'), "" + "too short escape sequence: /" + (regexp) + "/") + } + + if (options === undefined || options['$!']()) { + return new RegExp(regexp); + } + + if (options.$$is_number) { + var temp = ''; + if ($$($nesting, 'IGNORECASE') & options) { temp += 'i'; } + if ($$($nesting, 'MULTILINE') & options) { temp += 'm'; } + options = temp; + } + else { + options = 'i'; + } + + return new RegExp(regexp, options); + ; + }, TMP_new_5.$$arity = -2), nil) && 'new'; + })(Opal.get_singleton_class(self), $nesting); + + Opal.def(self, '$==', TMP_Regexp_$eq$eq_6 = function(other) { + var self = this; + + return other instanceof RegExp && self.toString() === other.toString(); + }, TMP_Regexp_$eq$eq_6.$$arity = 1); + + Opal.def(self, '$===', TMP_Regexp_$eq$eq$eq_7 = function(string) { + var self = this; + + return self.$match($$($nesting, 'Opal')['$coerce_to?'](string, $$($nesting, 'String'), "to_str")) !== nil + }, TMP_Regexp_$eq$eq$eq_7.$$arity = 1); + + Opal.def(self, '$=~', TMP_Regexp_$eq$_8 = function(string) { + var $a, self = this; + if ($gvars["~"] == null) $gvars["~"] = nil; + + return ($truthy($a = self.$match(string)) ? $gvars["~"].$begin(0) : $a) + }, TMP_Regexp_$eq$_8.$$arity = 1); + Opal.alias(self, "eql?", "=="); + + Opal.def(self, '$inspect', TMP_Regexp_inspect_9 = function $$inspect() { + var self = this; + + + var regexp_format = /^\/(.*)\/([^\/]*)$/; + var value = self.toString(); + var matches = regexp_format.exec(value); + if (matches) { + var regexp_pattern = matches[1]; + var regexp_flags = matches[2]; + var chars = regexp_pattern.split(''); + var chars_length = chars.length; + var char_escaped = false; + var regexp_pattern_escaped = ''; + for (var i = 0; i < chars_length; i++) { + var current_char = chars[i]; + if (!char_escaped && current_char == '/') { + regexp_pattern_escaped = regexp_pattern_escaped.concat('\\'); + } + regexp_pattern_escaped = regexp_pattern_escaped.concat(current_char); + if (current_char == '\\') { + if (char_escaped) { + // does not over escape + char_escaped = false; + } else { + char_escaped = true; + } + } else { + char_escaped = false; + } + } + return '/' + regexp_pattern_escaped + '/' + regexp_flags; + } else { + return value; + } + + }, TMP_Regexp_inspect_9.$$arity = 0); + + Opal.def(self, '$match', TMP_Regexp_match_10 = function $$match(string, pos) { + var $iter = TMP_Regexp_match_10.$$p, block = $iter || nil, self = this; + if ($gvars["~"] == null) $gvars["~"] = nil; + + if ($iter) TMP_Regexp_match_10.$$p = null; + + + if ($iter) TMP_Regexp_match_10.$$p = null;; + ; + + if (self.uninitialized) { + self.$raise($$($nesting, 'TypeError'), "uninitialized Regexp") + } + + if (pos === undefined) { + if (string === nil) return ($gvars["~"] = nil); + var m = self.exec($$($nesting, 'Opal').$coerce_to(string, $$($nesting, 'String'), "to_str")); + if (m) { + ($gvars["~"] = $$($nesting, 'MatchData').$new(self, m)); + return block === nil ? $gvars["~"] : Opal.yield1(block, $gvars["~"]); + } else { + return ($gvars["~"] = nil); + } + } + + pos = $$($nesting, 'Opal').$coerce_to(pos, $$($nesting, 'Integer'), "to_int"); + + if (string === nil) { + return ($gvars["~"] = nil); + } + + string = $$($nesting, 'Opal').$coerce_to(string, $$($nesting, 'String'), "to_str"); + + if (pos < 0) { + pos += string.length; + if (pos < 0) { + return ($gvars["~"] = nil); + } + } + + // global RegExp maintains state, so not using self/this + var md, re = Opal.global_regexp(self); + + while (true) { + md = re.exec(string); + if (md === null) { + return ($gvars["~"] = nil); + } + if (md.index >= pos) { + ($gvars["~"] = $$($nesting, 'MatchData').$new(re, md)); + return block === nil ? $gvars["~"] : Opal.yield1(block, $gvars["~"]); + } + re.lastIndex = md.index + 1; + } + ; + }, TMP_Regexp_match_10.$$arity = -2); + + Opal.def(self, '$match?', TMP_Regexp_match$q_11 = function(string, pos) { + var self = this; + + + ; + + if (self.uninitialized) { + self.$raise($$($nesting, 'TypeError'), "uninitialized Regexp") + } + + if (pos === undefined) { + return string === nil ? false : self.test($$($nesting, 'Opal').$coerce_to(string, $$($nesting, 'String'), "to_str")); + } + + pos = $$($nesting, 'Opal').$coerce_to(pos, $$($nesting, 'Integer'), "to_int"); + + if (string === nil) { + return false; + } + + string = $$($nesting, 'Opal').$coerce_to(string, $$($nesting, 'String'), "to_str"); + + if (pos < 0) { + pos += string.length; + if (pos < 0) { + return false; + } + } + + // global RegExp maintains state, so not using self/this + var md, re = Opal.global_regexp(self); + + md = re.exec(string); + if (md === null || md.index < pos) { + return false; + } else { + return true; + } + ; + }, TMP_Regexp_match$q_11.$$arity = -2); + + Opal.def(self, '$~', TMP_Regexp_$_12 = function() { + var self = this; + if ($gvars._ == null) $gvars._ = nil; + + return self['$=~']($gvars._) + }, TMP_Regexp_$_12.$$arity = 0); + + Opal.def(self, '$source', TMP_Regexp_source_13 = function $$source() { + var self = this; + + return self.source; + }, TMP_Regexp_source_13.$$arity = 0); + + Opal.def(self, '$options', TMP_Regexp_options_14 = function $$options() { + var self = this; + + + if (self.uninitialized) { + self.$raise($$($nesting, 'TypeError'), "uninitialized Regexp") + } + var result = 0; + // should be supported in IE6 according to https://msdn.microsoft.com/en-us/library/7f5z26w4(v=vs.94).aspx + if (self.multiline) { + result |= $$($nesting, 'MULTILINE'); + } + if (self.ignoreCase) { + result |= $$($nesting, 'IGNORECASE'); + } + return result; + + }, TMP_Regexp_options_14.$$arity = 0); + + Opal.def(self, '$casefold?', TMP_Regexp_casefold$q_15 = function() { + var self = this; + + return self.ignoreCase; + }, TMP_Regexp_casefold$q_15.$$arity = 0); + return Opal.alias(self, "to_s", "source"); + })($nesting[0], RegExp, $nesting); + return (function($base, $super, $parent_nesting) { + function $MatchData(){}; + var self = $MatchData = $klass($base, $super, 'MatchData', $MatchData); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_MatchData_initialize_16, TMP_MatchData_$$_17, TMP_MatchData_offset_18, TMP_MatchData_$eq$eq_19, TMP_MatchData_begin_20, TMP_MatchData_end_21, TMP_MatchData_captures_22, TMP_MatchData_inspect_23, TMP_MatchData_length_24, TMP_MatchData_to_a_25, TMP_MatchData_to_s_26, TMP_MatchData_values_at_27; + + def.matches = nil; + + self.$attr_reader("post_match", "pre_match", "regexp", "string"); + + Opal.def(self, '$initialize', TMP_MatchData_initialize_16 = function $$initialize(regexp, match_groups) { + var self = this; + + + $gvars["~"] = self; + self.regexp = regexp; + self.begin = match_groups.index; + self.string = match_groups.input; + self.pre_match = match_groups.input.slice(0, match_groups.index); + self.post_match = match_groups.input.slice(match_groups.index + match_groups[0].length); + self.matches = []; + + for (var i = 0, length = match_groups.length; i < length; i++) { + var group = match_groups[i]; + + if (group == null) { + self.matches.push(nil); + } + else { + self.matches.push(group); + } + } + ; + }, TMP_MatchData_initialize_16.$$arity = 2); + + Opal.def(self, '$[]', TMP_MatchData_$$_17 = function($a) { + var $post_args, args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + return $send(self.matches, '[]', Opal.to_a(args)); + }, TMP_MatchData_$$_17.$$arity = -1); + + Opal.def(self, '$offset', TMP_MatchData_offset_18 = function $$offset(n) { + var self = this; + + + if (n !== 0) { + self.$raise($$($nesting, 'ArgumentError'), "MatchData#offset only supports 0th element") + } + return [self.begin, self.begin + self.matches[n].length]; + + }, TMP_MatchData_offset_18.$$arity = 1); + + Opal.def(self, '$==', TMP_MatchData_$eq$eq_19 = function(other) { + var $a, $b, $c, $d, self = this; + + + if ($truthy($$($nesting, 'MatchData')['$==='](other))) { + } else { + return false + }; + return ($truthy($a = ($truthy($b = ($truthy($c = ($truthy($d = self.string == other.string) ? self.regexp.toString() == other.regexp.toString() : $d)) ? self.pre_match == other.pre_match : $c)) ? self.post_match == other.post_match : $b)) ? self.begin == other.begin : $a); + }, TMP_MatchData_$eq$eq_19.$$arity = 1); + Opal.alias(self, "eql?", "=="); + + Opal.def(self, '$begin', TMP_MatchData_begin_20 = function $$begin(n) { + var self = this; + + + if (n !== 0) { + self.$raise($$($nesting, 'ArgumentError'), "MatchData#begin only supports 0th element") + } + return self.begin; + + }, TMP_MatchData_begin_20.$$arity = 1); + + Opal.def(self, '$end', TMP_MatchData_end_21 = function $$end(n) { + var self = this; + + + if (n !== 0) { + self.$raise($$($nesting, 'ArgumentError'), "MatchData#end only supports 0th element") + } + return self.begin + self.matches[n].length; + + }, TMP_MatchData_end_21.$$arity = 1); + + Opal.def(self, '$captures', TMP_MatchData_captures_22 = function $$captures() { + var self = this; + + return self.matches.slice(1) + }, TMP_MatchData_captures_22.$$arity = 0); + + Opal.def(self, '$inspect', TMP_MatchData_inspect_23 = function $$inspect() { + var self = this; + + + var str = "#"; + + }, TMP_MatchData_inspect_23.$$arity = 0); + + Opal.def(self, '$length', TMP_MatchData_length_24 = function $$length() { + var self = this; + + return self.matches.length + }, TMP_MatchData_length_24.$$arity = 0); + Opal.alias(self, "size", "length"); + + Opal.def(self, '$to_a', TMP_MatchData_to_a_25 = function $$to_a() { + var self = this; + + return self.matches + }, TMP_MatchData_to_a_25.$$arity = 0); + + Opal.def(self, '$to_s', TMP_MatchData_to_s_26 = function $$to_s() { + var self = this; + + return self.matches[0] + }, TMP_MatchData_to_s_26.$$arity = 0); + return (Opal.def(self, '$values_at', TMP_MatchData_values_at_27 = function $$values_at($a) { + var $post_args, args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + + var i, a, index, values = []; + + for (i = 0; i < args.length; i++) { + + if (args[i].$$is_range) { + a = (args[i]).$to_a(); + a.unshift(i, 1); + Array.prototype.splice.apply(args, a); + } + + index = $$($nesting, 'Opal')['$coerce_to!'](args[i], $$($nesting, 'Integer'), "to_int"); + + if (index < 0) { + index += self.matches.length; + if (index < 0) { + values.push(nil); + continue; + } + } + + values.push(self.matches[index]); + } + + return values; + ; + }, TMP_MatchData_values_at_27.$$arity = -1), nil) && 'values_at'; + })($nesting[0], null, $nesting); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/string"] = function(Opal) { + function $rb_divide(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs / rhs : lhs['$/'](rhs); + } + function $rb_plus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $truthy = Opal.truthy, $send = Opal.send, $gvars = Opal.gvars; + + Opal.add_stubs(['$require', '$include', '$coerce_to?', '$coerce_to', '$raise', '$===', '$format', '$to_s', '$respond_to?', '$to_str', '$<=>', '$==', '$=~', '$new', '$force_encoding', '$casecmp', '$empty?', '$ljust', '$ceil', '$/', '$+', '$rjust', '$floor', '$to_a', '$each_char', '$to_proc', '$coerce_to!', '$copy_singleton_methods', '$initialize_clone', '$initialize_dup', '$enum_for', '$size', '$chomp', '$[]', '$to_i', '$each_line', '$class', '$match', '$match?', '$captures', '$proc', '$succ', '$escape']); + + self.$require("corelib/comparable"); + self.$require("corelib/regexp"); + (function($base, $super, $parent_nesting) { + function $String(){}; + var self = $String = $klass($base, $super, 'String', $String); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_String___id___1, TMP_String_try_convert_2, TMP_String_new_3, TMP_String_initialize_4, TMP_String_$_5, TMP_String_$_6, TMP_String_$_7, TMP_String_$lt$eq$gt_8, TMP_String_$eq$eq_9, TMP_String_$eq$_10, TMP_String_$$_11, TMP_String_b_12, TMP_String_capitalize_13, TMP_String_casecmp_14, TMP_String_casecmp$q_15, TMP_String_center_16, TMP_String_chars_17, TMP_String_chomp_18, TMP_String_chop_19, TMP_String_chr_20, TMP_String_clone_21, TMP_String_dup_22, TMP_String_count_23, TMP_String_delete_24, TMP_String_delete_prefix_25, TMP_String_delete_suffix_26, TMP_String_downcase_27, TMP_String_each_char_28, TMP_String_each_line_30, TMP_String_empty$q_31, TMP_String_end_with$q_32, TMP_String_gsub_33, TMP_String_hash_34, TMP_String_hex_35, TMP_String_include$q_36, TMP_String_index_37, TMP_String_inspect_38, TMP_String_intern_39, TMP_String_lines_40, TMP_String_length_41, TMP_String_ljust_42, TMP_String_lstrip_43, TMP_String_ascii_only$q_44, TMP_String_match_45, TMP_String_match$q_46, TMP_String_next_47, TMP_String_oct_48, TMP_String_ord_49, TMP_String_partition_50, TMP_String_reverse_51, TMP_String_rindex_52, TMP_String_rjust_53, TMP_String_rpartition_54, TMP_String_rstrip_55, TMP_String_scan_56, TMP_String_split_57, TMP_String_squeeze_58, TMP_String_start_with$q_59, TMP_String_strip_60, TMP_String_sub_61, TMP_String_sum_62, TMP_String_swapcase_63, TMP_String_to_f_64, TMP_String_to_i_65, TMP_String_to_proc_66, TMP_String_to_s_68, TMP_String_tr_69, TMP_String_tr_s_70, TMP_String_upcase_71, TMP_String_upto_72, TMP_String_instance_variables_73, TMP_String__load_74, TMP_String_unicode_normalize_75, TMP_String_unicode_normalized$q_76, TMP_String_unpack_77, TMP_String_unpack1_78; + + + self.$include($$($nesting, 'Comparable')); + + Opal.defineProperty(String.prototype, '$$is_string', true); + + Opal.defineProperty(String.prototype, '$$cast', function(string) { + var klass = this.$$class; + if (klass === String) { + return string; + } else { + return new klass(string); + } + }); + ; + + Opal.def(self, '$__id__', TMP_String___id___1 = function $$__id__() { + var self = this; + + return self.toString(); + }, TMP_String___id___1.$$arity = 0); + Opal.alias(self, "object_id", "__id__"); + Opal.defs(self, '$try_convert', TMP_String_try_convert_2 = function $$try_convert(what) { + var self = this; + + return $$($nesting, 'Opal')['$coerce_to?'](what, $$($nesting, 'String'), "to_str") + }, TMP_String_try_convert_2.$$arity = 1); + Opal.defs(self, '$new', TMP_String_new_3 = function(str) { + var self = this; + + + + if (str == null) { + str = ""; + }; + str = $$($nesting, 'Opal').$coerce_to(str, $$($nesting, 'String'), "to_str"); + return new self(str);; + }, TMP_String_new_3.$$arity = -1); + + Opal.def(self, '$initialize', TMP_String_initialize_4 = function $$initialize(str) { + var self = this; + + + ; + + if (str === undefined) { + return self; + } + ; + return self.$raise($$($nesting, 'NotImplementedError'), "Mutable strings are not supported in Opal."); + }, TMP_String_initialize_4.$$arity = -1); + + Opal.def(self, '$%', TMP_String_$_5 = function(data) { + var self = this; + + if ($truthy($$($nesting, 'Array')['$==='](data))) { + return $send(self, 'format', [self].concat(Opal.to_a(data))) + } else { + return self.$format(self, data) + } + }, TMP_String_$_5.$$arity = 1); + + Opal.def(self, '$*', TMP_String_$_6 = function(count) { + var self = this; + + + count = $$($nesting, 'Opal').$coerce_to(count, $$($nesting, 'Integer'), "to_int"); + + if (count < 0) { + self.$raise($$($nesting, 'ArgumentError'), "negative argument") + } + + if (count === 0) { + return self.$$cast(''); + } + + var result = '', + string = self.toString(); + + // All credit for the bit-twiddling magic code below goes to Mozilla + // polyfill implementation of String.prototype.repeat() posted here: + // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/repeat + + if (string.length * count >= 1 << 28) { + self.$raise($$($nesting, 'RangeError'), "multiply count must not overflow maximum string size") + } + + for (;;) { + if ((count & 1) === 1) { + result += string; + } + count >>>= 1; + if (count === 0) { + break; + } + string += string; + } + + return self.$$cast(result); + + }, TMP_String_$_6.$$arity = 1); + + Opal.def(self, '$+', TMP_String_$_7 = function(other) { + var self = this; + + + other = $$($nesting, 'Opal').$coerce_to(other, $$($nesting, 'String'), "to_str"); + return self + other.$to_s(); + }, TMP_String_$_7.$$arity = 1); + + Opal.def(self, '$<=>', TMP_String_$lt$eq$gt_8 = function(other) { + var self = this; + + if ($truthy(other['$respond_to?']("to_str"))) { + + other = other.$to_str().$to_s(); + return self > other ? 1 : (self < other ? -1 : 0);; + } else { + + var cmp = other['$<=>'](self); + + if (cmp === nil) { + return nil; + } + else { + return cmp > 0 ? -1 : (cmp < 0 ? 1 : 0); + } + + } + }, TMP_String_$lt$eq$gt_8.$$arity = 1); + + Opal.def(self, '$==', TMP_String_$eq$eq_9 = function(other) { + var self = this; + + + if (other.$$is_string) { + return self.toString() === other.toString(); + } + if ($$($nesting, 'Opal')['$respond_to?'](other, "to_str")) { + return other['$=='](self); + } + return false; + + }, TMP_String_$eq$eq_9.$$arity = 1); + Opal.alias(self, "eql?", "=="); + Opal.alias(self, "===", "=="); + + Opal.def(self, '$=~', TMP_String_$eq$_10 = function(other) { + var self = this; + + + if (other.$$is_string) { + self.$raise($$($nesting, 'TypeError'), "type mismatch: String given"); + } + + return other['$=~'](self); + + }, TMP_String_$eq$_10.$$arity = 1); + + Opal.def(self, '$[]', TMP_String_$$_11 = function(index, length) { + var self = this; + + + ; + + var size = self.length, exclude; + + if (index.$$is_range) { + exclude = index.excl; + length = $$($nesting, 'Opal').$coerce_to(index.end, $$($nesting, 'Integer'), "to_int"); + index = $$($nesting, 'Opal').$coerce_to(index.begin, $$($nesting, 'Integer'), "to_int"); + + if (Math.abs(index) > size) { + return nil; + } + + if (index < 0) { + index += size; + } + + if (length < 0) { + length += size; + } + + if (!exclude) { + length += 1; + } + + length = length - index; + + if (length < 0) { + length = 0; + } + + return self.$$cast(self.substr(index, length)); + } + + + if (index.$$is_string) { + if (length != null) { + self.$raise($$($nesting, 'TypeError')) + } + return self.indexOf(index) !== -1 ? self.$$cast(index) : nil; + } + + + if (index.$$is_regexp) { + var match = self.match(index); + + if (match === null) { + ($gvars["~"] = nil) + return nil; + } + + ($gvars["~"] = $$($nesting, 'MatchData').$new(index, match)) + + if (length == null) { + return self.$$cast(match[0]); + } + + length = $$($nesting, 'Opal').$coerce_to(length, $$($nesting, 'Integer'), "to_int"); + + if (length < 0 && -length < match.length) { + return self.$$cast(match[length += match.length]); + } + + if (length >= 0 && length < match.length) { + return self.$$cast(match[length]); + } + + return nil; + } + + + index = $$($nesting, 'Opal').$coerce_to(index, $$($nesting, 'Integer'), "to_int"); + + if (index < 0) { + index += size; + } + + if (length == null) { + if (index >= size || index < 0) { + return nil; + } + return self.$$cast(self.substr(index, 1)); + } + + length = $$($nesting, 'Opal').$coerce_to(length, $$($nesting, 'Integer'), "to_int"); + + if (length < 0) { + return nil; + } + + if (index > size || index < 0) { + return nil; + } + + return self.$$cast(self.substr(index, length)); + ; + }, TMP_String_$$_11.$$arity = -2); + Opal.alias(self, "byteslice", "[]"); + + Opal.def(self, '$b', TMP_String_b_12 = function $$b() { + var self = this; + + return self.$force_encoding("binary") + }, TMP_String_b_12.$$arity = 0); + + Opal.def(self, '$capitalize', TMP_String_capitalize_13 = function $$capitalize() { + var self = this; + + return self.$$cast(self.charAt(0).toUpperCase() + self.substr(1).toLowerCase()); + }, TMP_String_capitalize_13.$$arity = 0); + + Opal.def(self, '$casecmp', TMP_String_casecmp_14 = function $$casecmp(other) { + var self = this; + + + if ($truthy(other['$respond_to?']("to_str"))) { + } else { + return nil + }; + other = $$($nesting, 'Opal').$coerce_to(other, $$($nesting, 'String'), "to_str").$to_s(); + + var ascii_only = /^[\x00-\x7F]*$/; + if (ascii_only.test(self) && ascii_only.test(other)) { + self = self.toLowerCase(); + other = other.toLowerCase(); + } + ; + return self['$<=>'](other); + }, TMP_String_casecmp_14.$$arity = 1); + + Opal.def(self, '$casecmp?', TMP_String_casecmp$q_15 = function(other) { + var self = this; + + + var cmp = self.$casecmp(other); + if (cmp === nil) { + return nil; + } else { + return cmp === 0; + } + + }, TMP_String_casecmp$q_15.$$arity = 1); + + Opal.def(self, '$center', TMP_String_center_16 = function $$center(width, padstr) { + var self = this; + + + + if (padstr == null) { + padstr = " "; + }; + width = $$($nesting, 'Opal').$coerce_to(width, $$($nesting, 'Integer'), "to_int"); + padstr = $$($nesting, 'Opal').$coerce_to(padstr, $$($nesting, 'String'), "to_str").$to_s(); + if ($truthy(padstr['$empty?']())) { + self.$raise($$($nesting, 'ArgumentError'), "zero width padding")}; + if ($truthy(width <= self.length)) { + return self}; + + var ljustified = self.$ljust($rb_divide($rb_plus(width, self.length), 2).$ceil(), padstr), + rjustified = self.$rjust($rb_divide($rb_plus(width, self.length), 2).$floor(), padstr); + + return self.$$cast(rjustified + ljustified.slice(self.length)); + ; + }, TMP_String_center_16.$$arity = -2); + + Opal.def(self, '$chars', TMP_String_chars_17 = function $$chars() { + var $iter = TMP_String_chars_17.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_String_chars_17.$$p = null; + + + if ($iter) TMP_String_chars_17.$$p = null;; + if ($truthy(block)) { + } else { + return self.$each_char().$to_a() + }; + return $send(self, 'each_char', [], block.$to_proc()); + }, TMP_String_chars_17.$$arity = 0); + + Opal.def(self, '$chomp', TMP_String_chomp_18 = function $$chomp(separator) { + var self = this; + if ($gvars["/"] == null) $gvars["/"] = nil; + + + + if (separator == null) { + separator = $gvars["/"]; + }; + if ($truthy(separator === nil || self.length === 0)) { + return self}; + separator = $$($nesting, 'Opal')['$coerce_to!'](separator, $$($nesting, 'String'), "to_str").$to_s(); + + var result; + + if (separator === "\n") { + result = self.replace(/\r?\n?$/, ''); + } + else if (separator === "") { + result = self.replace(/(\r?\n)+$/, ''); + } + else if (self.length > separator.length) { + var tail = self.substr(self.length - separator.length, separator.length); + + if (tail === separator) { + result = self.substr(0, self.length - separator.length); + } + } + + if (result != null) { + return self.$$cast(result); + } + ; + return self; + }, TMP_String_chomp_18.$$arity = -1); + + Opal.def(self, '$chop', TMP_String_chop_19 = function $$chop() { + var self = this; + + + var length = self.length, result; + + if (length <= 1) { + result = ""; + } else if (self.charAt(length - 1) === "\n" && self.charAt(length - 2) === "\r") { + result = self.substr(0, length - 2); + } else { + result = self.substr(0, length - 1); + } + + return self.$$cast(result); + + }, TMP_String_chop_19.$$arity = 0); + + Opal.def(self, '$chr', TMP_String_chr_20 = function $$chr() { + var self = this; + + return self.charAt(0); + }, TMP_String_chr_20.$$arity = 0); + + Opal.def(self, '$clone', TMP_String_clone_21 = function $$clone() { + var self = this, copy = nil; + + + copy = self.slice(); + copy.$copy_singleton_methods(self); + copy.$initialize_clone(self); + return copy; + }, TMP_String_clone_21.$$arity = 0); + + Opal.def(self, '$dup', TMP_String_dup_22 = function $$dup() { + var self = this, copy = nil; + + + copy = self.slice(); + copy.$initialize_dup(self); + return copy; + }, TMP_String_dup_22.$$arity = 0); + + Opal.def(self, '$count', TMP_String_count_23 = function $$count($a) { + var $post_args, sets, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + sets = $post_args;; + + if (sets.length === 0) { + self.$raise($$($nesting, 'ArgumentError'), "ArgumentError: wrong number of arguments (0 for 1+)") + } + var char_class = char_class_from_char_sets(sets); + if (char_class === null) { + return 0; + } + return self.length - self.replace(new RegExp(char_class, 'g'), '').length; + ; + }, TMP_String_count_23.$$arity = -1); + + Opal.def(self, '$delete', TMP_String_delete_24 = function($a) { + var $post_args, sets, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + sets = $post_args;; + + if (sets.length === 0) { + self.$raise($$($nesting, 'ArgumentError'), "ArgumentError: wrong number of arguments (0 for 1+)") + } + var char_class = char_class_from_char_sets(sets); + if (char_class === null) { + return self; + } + return self.$$cast(self.replace(new RegExp(char_class, 'g'), '')); + ; + }, TMP_String_delete_24.$$arity = -1); + + Opal.def(self, '$delete_prefix', TMP_String_delete_prefix_25 = function $$delete_prefix(prefix) { + var self = this; + + + if (!prefix.$$is_string) { + (prefix = $$($nesting, 'Opal').$coerce_to(prefix, $$($nesting, 'String'), "to_str")) + } + + if (self.slice(0, prefix.length) === prefix) { + return self.$$cast(self.slice(prefix.length)); + } else { + return self; + } + + }, TMP_String_delete_prefix_25.$$arity = 1); + + Opal.def(self, '$delete_suffix', TMP_String_delete_suffix_26 = function $$delete_suffix(suffix) { + var self = this; + + + if (!suffix.$$is_string) { + (suffix = $$($nesting, 'Opal').$coerce_to(suffix, $$($nesting, 'String'), "to_str")) + } + + if (self.slice(self.length - suffix.length) === suffix) { + return self.$$cast(self.slice(0, self.length - suffix.length)); + } else { + return self; + } + + }, TMP_String_delete_suffix_26.$$arity = 1); + + Opal.def(self, '$downcase', TMP_String_downcase_27 = function $$downcase() { + var self = this; + + return self.$$cast(self.toLowerCase()); + }, TMP_String_downcase_27.$$arity = 0); + + Opal.def(self, '$each_char', TMP_String_each_char_28 = function $$each_char() { + var $iter = TMP_String_each_char_28.$$p, block = $iter || nil, TMP_29, self = this; + + if ($iter) TMP_String_each_char_28.$$p = null; + + + if ($iter) TMP_String_each_char_28.$$p = null;; + if ((block !== nil)) { + } else { + return $send(self, 'enum_for', ["each_char"], (TMP_29 = function(){var self = TMP_29.$$s || this; + + return self.$size()}, TMP_29.$$s = self, TMP_29.$$arity = 0, TMP_29)) + }; + + for (var i = 0, length = self.length; i < length; i++) { + Opal.yield1(block, self.charAt(i)); + } + ; + return self; + }, TMP_String_each_char_28.$$arity = 0); + + Opal.def(self, '$each_line', TMP_String_each_line_30 = function $$each_line(separator) { + var $iter = TMP_String_each_line_30.$$p, block = $iter || nil, self = this; + if ($gvars["/"] == null) $gvars["/"] = nil; + + if ($iter) TMP_String_each_line_30.$$p = null; + + + if ($iter) TMP_String_each_line_30.$$p = null;; + + if (separator == null) { + separator = $gvars["/"]; + }; + if ((block !== nil)) { + } else { + return self.$enum_for("each_line", separator) + }; + + if (separator === nil) { + Opal.yield1(block, self); + + return self; + } + + separator = $$($nesting, 'Opal').$coerce_to(separator, $$($nesting, 'String'), "to_str") + + var a, i, n, length, chomped, trailing, splitted; + + if (separator.length === 0) { + for (a = self.split(/(\n{2,})/), i = 0, n = a.length; i < n; i += 2) { + if (a[i] || a[i + 1]) { + var value = (a[i] || "") + (a[i + 1] || ""); + Opal.yield1(block, self.$$cast(value)); + } + } + + return self; + } + + chomped = self.$chomp(separator); + trailing = self.length != chomped.length; + splitted = chomped.split(separator); + + for (i = 0, length = splitted.length; i < length; i++) { + if (i < length - 1 || trailing) { + Opal.yield1(block, self.$$cast(splitted[i] + separator)); + } + else { + Opal.yield1(block, self.$$cast(splitted[i])); + } + } + ; + return self; + }, TMP_String_each_line_30.$$arity = -1); + + Opal.def(self, '$empty?', TMP_String_empty$q_31 = function() { + var self = this; + + return self.length === 0; + }, TMP_String_empty$q_31.$$arity = 0); + + Opal.def(self, '$end_with?', TMP_String_end_with$q_32 = function($a) { + var $post_args, suffixes, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + suffixes = $post_args;; + + for (var i = 0, length = suffixes.length; i < length; i++) { + var suffix = $$($nesting, 'Opal').$coerce_to(suffixes[i], $$($nesting, 'String'), "to_str").$to_s(); + + if (self.length >= suffix.length && + self.substr(self.length - suffix.length, suffix.length) == suffix) { + return true; + } + } + ; + return false; + }, TMP_String_end_with$q_32.$$arity = -1); + Opal.alias(self, "equal?", "==="); + + Opal.def(self, '$gsub', TMP_String_gsub_33 = function $$gsub(pattern, replacement) { + var $iter = TMP_String_gsub_33.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_String_gsub_33.$$p = null; + + + if ($iter) TMP_String_gsub_33.$$p = null;; + ; + + if (replacement === undefined && block === nil) { + return self.$enum_for("gsub", pattern); + } + + var result = '', match_data = nil, index = 0, match, _replacement; + + if (pattern.$$is_regexp) { + pattern = Opal.global_multiline_regexp(pattern); + } else { + pattern = $$($nesting, 'Opal').$coerce_to(pattern, $$($nesting, 'String'), "to_str"); + pattern = new RegExp(pattern.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'), 'gm'); + } + + var lastIndex; + while (true) { + match = pattern.exec(self); + + if (match === null) { + ($gvars["~"] = nil) + result += self.slice(index); + break; + } + + match_data = $$($nesting, 'MatchData').$new(pattern, match); + + if (replacement === undefined) { + lastIndex = pattern.lastIndex; + _replacement = block(match[0]); + pattern.lastIndex = lastIndex; // save and restore lastIndex + } + else if (replacement.$$is_hash) { + _replacement = (replacement)['$[]'](match[0]).$to_s(); + } + else { + if (!replacement.$$is_string) { + replacement = $$($nesting, 'Opal').$coerce_to(replacement, $$($nesting, 'String'), "to_str"); + } + _replacement = replacement.replace(/([\\]+)([0-9+&`'])/g, function (original, slashes, command) { + if (slashes.length % 2 === 0) { + return original; + } + switch (command) { + case "+": + for (var i = match.length - 1; i > 0; i--) { + if (match[i] !== undefined) { + return slashes.slice(1) + match[i]; + } + } + return ''; + case "&": return slashes.slice(1) + match[0]; + case "`": return slashes.slice(1) + self.slice(0, match.index); + case "'": return slashes.slice(1) + self.slice(match.index + match[0].length); + default: return slashes.slice(1) + (match[command] || ''); + } + }).replace(/\\\\/g, '\\'); + } + + if (pattern.lastIndex === match.index) { + result += (_replacement + self.slice(index, match.index + 1)) + pattern.lastIndex += 1; + } + else { + result += (self.slice(index, match.index) + _replacement) + } + index = pattern.lastIndex; + } + + ($gvars["~"] = match_data) + return self.$$cast(result); + ; + }, TMP_String_gsub_33.$$arity = -2); + + Opal.def(self, '$hash', TMP_String_hash_34 = function $$hash() { + var self = this; + + return self.toString(); + }, TMP_String_hash_34.$$arity = 0); + + Opal.def(self, '$hex', TMP_String_hex_35 = function $$hex() { + var self = this; + + return self.$to_i(16) + }, TMP_String_hex_35.$$arity = 0); + + Opal.def(self, '$include?', TMP_String_include$q_36 = function(other) { + var self = this; + + + if (!other.$$is_string) { + (other = $$($nesting, 'Opal').$coerce_to(other, $$($nesting, 'String'), "to_str")) + } + return self.indexOf(other) !== -1; + + }, TMP_String_include$q_36.$$arity = 1); + + Opal.def(self, '$index', TMP_String_index_37 = function $$index(search, offset) { + var self = this; + + + ; + + var index, + match, + regex; + + if (offset === undefined) { + offset = 0; + } else { + offset = $$($nesting, 'Opal').$coerce_to(offset, $$($nesting, 'Integer'), "to_int"); + if (offset < 0) { + offset += self.length; + if (offset < 0) { + return nil; + } + } + } + + if (search.$$is_regexp) { + regex = Opal.global_multiline_regexp(search); + while (true) { + match = regex.exec(self); + if (match === null) { + ($gvars["~"] = nil); + index = -1; + break; + } + if (match.index >= offset) { + ($gvars["~"] = $$($nesting, 'MatchData').$new(regex, match)) + index = match.index; + break; + } + regex.lastIndex = match.index + 1; + } + } else { + search = $$($nesting, 'Opal').$coerce_to(search, $$($nesting, 'String'), "to_str"); + if (search.length === 0 && offset > self.length) { + index = -1; + } else { + index = self.indexOf(search, offset); + } + } + + return index === -1 ? nil : index; + ; + }, TMP_String_index_37.$$arity = -2); + + Opal.def(self, '$inspect', TMP_String_inspect_38 = function $$inspect() { + var self = this; + + + var escapable = /[\\\"\x00-\x1f\u007F-\u009F\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, + meta = { + '\u0007': '\\a', + '\u001b': '\\e', + '\b': '\\b', + '\t': '\\t', + '\n': '\\n', + '\f': '\\f', + '\r': '\\r', + '\v': '\\v', + '"' : '\\"', + '\\': '\\\\' + }, + escaped = self.replace(escapable, function (chr) { + return meta[chr] || '\\u' + ('0000' + chr.charCodeAt(0).toString(16).toUpperCase()).slice(-4); + }); + return '"' + escaped.replace(/\#[\$\@\{]/g, '\\$&') + '"'; + + }, TMP_String_inspect_38.$$arity = 0); + + Opal.def(self, '$intern', TMP_String_intern_39 = function $$intern() { + var self = this; + + return self.toString(); + }, TMP_String_intern_39.$$arity = 0); + + Opal.def(self, '$lines', TMP_String_lines_40 = function $$lines(separator) { + var $iter = TMP_String_lines_40.$$p, block = $iter || nil, self = this, e = nil; + if ($gvars["/"] == null) $gvars["/"] = nil; + + if ($iter) TMP_String_lines_40.$$p = null; + + + if ($iter) TMP_String_lines_40.$$p = null;; + + if (separator == null) { + separator = $gvars["/"]; + }; + e = $send(self, 'each_line', [separator], block.$to_proc()); + if ($truthy(block)) { + return self + } else { + return e.$to_a() + }; + }, TMP_String_lines_40.$$arity = -1); + + Opal.def(self, '$length', TMP_String_length_41 = function $$length() { + var self = this; + + return self.length; + }, TMP_String_length_41.$$arity = 0); + + Opal.def(self, '$ljust', TMP_String_ljust_42 = function $$ljust(width, padstr) { + var self = this; + + + + if (padstr == null) { + padstr = " "; + }; + width = $$($nesting, 'Opal').$coerce_to(width, $$($nesting, 'Integer'), "to_int"); + padstr = $$($nesting, 'Opal').$coerce_to(padstr, $$($nesting, 'String'), "to_str").$to_s(); + if ($truthy(padstr['$empty?']())) { + self.$raise($$($nesting, 'ArgumentError'), "zero width padding")}; + if ($truthy(width <= self.length)) { + return self}; + + var index = -1, + result = ""; + + width -= self.length; + + while (++index < width) { + result += padstr; + } + + return self.$$cast(self + result.slice(0, width)); + ; + }, TMP_String_ljust_42.$$arity = -2); + + Opal.def(self, '$lstrip', TMP_String_lstrip_43 = function $$lstrip() { + var self = this; + + return self.replace(/^\s*/, ''); + }, TMP_String_lstrip_43.$$arity = 0); + + Opal.def(self, '$ascii_only?', TMP_String_ascii_only$q_44 = function() { + var self = this; + + return self.match(/[ -~\n]*/)[0] === self; + }, TMP_String_ascii_only$q_44.$$arity = 0); + + Opal.def(self, '$match', TMP_String_match_45 = function $$match(pattern, pos) { + var $iter = TMP_String_match_45.$$p, block = $iter || nil, $a, self = this; + + if ($iter) TMP_String_match_45.$$p = null; + + + if ($iter) TMP_String_match_45.$$p = null;; + ; + if ($truthy(($truthy($a = $$($nesting, 'String')['$==='](pattern)) ? $a : pattern['$respond_to?']("to_str")))) { + pattern = $$($nesting, 'Regexp').$new(pattern.$to_str())}; + if ($truthy($$($nesting, 'Regexp')['$==='](pattern))) { + } else { + self.$raise($$($nesting, 'TypeError'), "" + "wrong argument type " + (pattern.$class()) + " (expected Regexp)") + }; + return $send(pattern, 'match', [self, pos], block.$to_proc()); + }, TMP_String_match_45.$$arity = -2); + + Opal.def(self, '$match?', TMP_String_match$q_46 = function(pattern, pos) { + var $a, self = this; + + + ; + if ($truthy(($truthy($a = $$($nesting, 'String')['$==='](pattern)) ? $a : pattern['$respond_to?']("to_str")))) { + pattern = $$($nesting, 'Regexp').$new(pattern.$to_str())}; + if ($truthy($$($nesting, 'Regexp')['$==='](pattern))) { + } else { + self.$raise($$($nesting, 'TypeError'), "" + "wrong argument type " + (pattern.$class()) + " (expected Regexp)") + }; + return pattern['$match?'](self, pos); + }, TMP_String_match$q_46.$$arity = -2); + + Opal.def(self, '$next', TMP_String_next_47 = function $$next() { + var self = this; + + + var i = self.length; + if (i === 0) { + return self.$$cast(''); + } + var result = self; + var first_alphanum_char_index = self.search(/[a-zA-Z0-9]/); + var carry = false; + var code; + while (i--) { + code = self.charCodeAt(i); + if ((code >= 48 && code <= 57) || + (code >= 65 && code <= 90) || + (code >= 97 && code <= 122)) { + switch (code) { + case 57: + carry = true; + code = 48; + break; + case 90: + carry = true; + code = 65; + break; + case 122: + carry = true; + code = 97; + break; + default: + carry = false; + code += 1; + } + } else { + if (first_alphanum_char_index === -1) { + if (code === 255) { + carry = true; + code = 0; + } else { + carry = false; + code += 1; + } + } else { + carry = true; + } + } + result = result.slice(0, i) + String.fromCharCode(code) + result.slice(i + 1); + if (carry && (i === 0 || i === first_alphanum_char_index)) { + switch (code) { + case 65: + break; + case 97: + break; + default: + code += 1; + } + if (i === 0) { + result = String.fromCharCode(code) + result; + } else { + result = result.slice(0, i) + String.fromCharCode(code) + result.slice(i); + } + carry = false; + } + if (!carry) { + break; + } + } + return self.$$cast(result); + + }, TMP_String_next_47.$$arity = 0); + + Opal.def(self, '$oct', TMP_String_oct_48 = function $$oct() { + var self = this; + + + var result, + string = self, + radix = 8; + + if (/^\s*_/.test(string)) { + return 0; + } + + string = string.replace(/^(\s*[+-]?)(0[bodx]?)(.+)$/i, function (original, head, flag, tail) { + switch (tail.charAt(0)) { + case '+': + case '-': + return original; + case '0': + if (tail.charAt(1) === 'x' && flag === '0x') { + return original; + } + } + switch (flag) { + case '0b': + radix = 2; + break; + case '0': + case '0o': + radix = 8; + break; + case '0d': + radix = 10; + break; + case '0x': + radix = 16; + break; + } + return head + tail; + }); + + result = parseInt(string.replace(/_(?!_)/g, ''), radix); + return isNaN(result) ? 0 : result; + + }, TMP_String_oct_48.$$arity = 0); + + Opal.def(self, '$ord', TMP_String_ord_49 = function $$ord() { + var self = this; + + return self.charCodeAt(0); + }, TMP_String_ord_49.$$arity = 0); + + Opal.def(self, '$partition', TMP_String_partition_50 = function $$partition(sep) { + var self = this; + + + var i, m; + + if (sep.$$is_regexp) { + m = sep.exec(self); + if (m === null) { + i = -1; + } else { + $$($nesting, 'MatchData').$new(sep, m); + sep = m[0]; + i = m.index; + } + } else { + sep = $$($nesting, 'Opal').$coerce_to(sep, $$($nesting, 'String'), "to_str"); + i = self.indexOf(sep); + } + + if (i === -1) { + return [self, '', '']; + } + + return [ + self.slice(0, i), + self.slice(i, i + sep.length), + self.slice(i + sep.length) + ]; + + }, TMP_String_partition_50.$$arity = 1); + + Opal.def(self, '$reverse', TMP_String_reverse_51 = function $$reverse() { + var self = this; + + return self.split('').reverse().join(''); + }, TMP_String_reverse_51.$$arity = 0); + + Opal.def(self, '$rindex', TMP_String_rindex_52 = function $$rindex(search, offset) { + var self = this; + + + ; + + var i, m, r, _m; + + if (offset === undefined) { + offset = self.length; + } else { + offset = $$($nesting, 'Opal').$coerce_to(offset, $$($nesting, 'Integer'), "to_int"); + if (offset < 0) { + offset += self.length; + if (offset < 0) { + return nil; + } + } + } + + if (search.$$is_regexp) { + m = null; + r = Opal.global_multiline_regexp(search); + while (true) { + _m = r.exec(self); + if (_m === null || _m.index > offset) { + break; + } + m = _m; + r.lastIndex = m.index + 1; + } + if (m === null) { + ($gvars["~"] = nil) + i = -1; + } else { + $$($nesting, 'MatchData').$new(r, m); + i = m.index; + } + } else { + search = $$($nesting, 'Opal').$coerce_to(search, $$($nesting, 'String'), "to_str"); + i = self.lastIndexOf(search, offset); + } + + return i === -1 ? nil : i; + ; + }, TMP_String_rindex_52.$$arity = -2); + + Opal.def(self, '$rjust', TMP_String_rjust_53 = function $$rjust(width, padstr) { + var self = this; + + + + if (padstr == null) { + padstr = " "; + }; + width = $$($nesting, 'Opal').$coerce_to(width, $$($nesting, 'Integer'), "to_int"); + padstr = $$($nesting, 'Opal').$coerce_to(padstr, $$($nesting, 'String'), "to_str").$to_s(); + if ($truthy(padstr['$empty?']())) { + self.$raise($$($nesting, 'ArgumentError'), "zero width padding")}; + if ($truthy(width <= self.length)) { + return self}; + + var chars = Math.floor(width - self.length), + patterns = Math.floor(chars / padstr.length), + result = Array(patterns + 1).join(padstr), + remaining = chars - result.length; + + return self.$$cast(result + padstr.slice(0, remaining) + self); + ; + }, TMP_String_rjust_53.$$arity = -2); + + Opal.def(self, '$rpartition', TMP_String_rpartition_54 = function $$rpartition(sep) { + var self = this; + + + var i, m, r, _m; + + if (sep.$$is_regexp) { + m = null; + r = Opal.global_multiline_regexp(sep); + + while (true) { + _m = r.exec(self); + if (_m === null) { + break; + } + m = _m; + r.lastIndex = m.index + 1; + } + + if (m === null) { + i = -1; + } else { + $$($nesting, 'MatchData').$new(r, m); + sep = m[0]; + i = m.index; + } + + } else { + sep = $$($nesting, 'Opal').$coerce_to(sep, $$($nesting, 'String'), "to_str"); + i = self.lastIndexOf(sep); + } + + if (i === -1) { + return ['', '', self]; + } + + return [ + self.slice(0, i), + self.slice(i, i + sep.length), + self.slice(i + sep.length) + ]; + + }, TMP_String_rpartition_54.$$arity = 1); + + Opal.def(self, '$rstrip', TMP_String_rstrip_55 = function $$rstrip() { + var self = this; + + return self.replace(/[\s\u0000]*$/, ''); + }, TMP_String_rstrip_55.$$arity = 0); + + Opal.def(self, '$scan', TMP_String_scan_56 = function $$scan(pattern) { + var $iter = TMP_String_scan_56.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_String_scan_56.$$p = null; + + + if ($iter) TMP_String_scan_56.$$p = null;; + + var result = [], + match_data = nil, + match; + + if (pattern.$$is_regexp) { + pattern = Opal.global_multiline_regexp(pattern); + } else { + pattern = $$($nesting, 'Opal').$coerce_to(pattern, $$($nesting, 'String'), "to_str"); + pattern = new RegExp(pattern.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'), 'gm'); + } + + while ((match = pattern.exec(self)) != null) { + match_data = $$($nesting, 'MatchData').$new(pattern, match); + if (block === nil) { + match.length == 1 ? result.push(match[0]) : result.push((match_data).$captures()); + } else { + match.length == 1 ? block(match[0]) : block.call(self, (match_data).$captures()); + } + if (pattern.lastIndex === match.index) { + pattern.lastIndex += 1; + } + } + + ($gvars["~"] = match_data) + + return (block !== nil ? self : result); + ; + }, TMP_String_scan_56.$$arity = 1); + Opal.alias(self, "size", "length"); + Opal.alias(self, "slice", "[]"); + + Opal.def(self, '$split', TMP_String_split_57 = function $$split(pattern, limit) { + var $a, self = this; + if ($gvars[";"] == null) $gvars[";"] = nil; + + + ; + ; + + if (self.length === 0) { + return []; + } + + if (limit === undefined) { + limit = 0; + } else { + limit = $$($nesting, 'Opal')['$coerce_to!'](limit, $$($nesting, 'Integer'), "to_int"); + if (limit === 1) { + return [self]; + } + } + + if (pattern === undefined || pattern === nil) { + pattern = ($truthy($a = $gvars[";"]) ? $a : " "); + } + + var result = [], + string = self.toString(), + index = 0, + match, + i, ii; + + if (pattern.$$is_regexp) { + pattern = Opal.global_multiline_regexp(pattern); + } else { + pattern = $$($nesting, 'Opal').$coerce_to(pattern, $$($nesting, 'String'), "to_str").$to_s(); + if (pattern === ' ') { + pattern = /\s+/gm; + string = string.replace(/^\s+/, ''); + } else { + pattern = new RegExp(pattern.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'), 'gm'); + } + } + + result = string.split(pattern); + + if (result.length === 1 && result[0] === string) { + return [self.$$cast(result[0])]; + } + + while ((i = result.indexOf(undefined)) !== -1) { + result.splice(i, 1); + } + + function castResult() { + for (i = 0; i < result.length; i++) { + result[i] = self.$$cast(result[i]); + } + } + + if (limit === 0) { + while (result[result.length - 1] === '') { + result.length -= 1; + } + castResult(); + return result; + } + + match = pattern.exec(string); + + if (limit < 0) { + if (match !== null && match[0] === '' && pattern.source.indexOf('(?=') === -1) { + for (i = 0, ii = match.length; i < ii; i++) { + result.push(''); + } + } + castResult(); + return result; + } + + if (match !== null && match[0] === '') { + result.splice(limit - 1, result.length - 1, result.slice(limit - 1).join('')); + castResult(); + return result; + } + + if (limit >= result.length) { + castResult(); + return result; + } + + i = 0; + while (match !== null) { + i++; + index = pattern.lastIndex; + if (i + 1 === limit) { + break; + } + match = pattern.exec(string); + } + result.splice(limit - 1, result.length - 1, string.slice(index)); + castResult(); + return result; + ; + }, TMP_String_split_57.$$arity = -1); + + Opal.def(self, '$squeeze', TMP_String_squeeze_58 = function $$squeeze($a) { + var $post_args, sets, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + sets = $post_args;; + + if (sets.length === 0) { + return self.$$cast(self.replace(/(.)\1+/g, '$1')); + } + var char_class = char_class_from_char_sets(sets); + if (char_class === null) { + return self; + } + return self.$$cast(self.replace(new RegExp('(' + char_class + ')\\1+', 'g'), '$1')); + ; + }, TMP_String_squeeze_58.$$arity = -1); + + Opal.def(self, '$start_with?', TMP_String_start_with$q_59 = function($a) { + var $post_args, prefixes, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + prefixes = $post_args;; + + for (var i = 0, length = prefixes.length; i < length; i++) { + var prefix = $$($nesting, 'Opal').$coerce_to(prefixes[i], $$($nesting, 'String'), "to_str").$to_s(); + + if (self.indexOf(prefix) === 0) { + return true; + } + } + + return false; + ; + }, TMP_String_start_with$q_59.$$arity = -1); + + Opal.def(self, '$strip', TMP_String_strip_60 = function $$strip() { + var self = this; + + return self.replace(/^\s*/, '').replace(/[\s\u0000]*$/, ''); + }, TMP_String_strip_60.$$arity = 0); + + Opal.def(self, '$sub', TMP_String_sub_61 = function $$sub(pattern, replacement) { + var $iter = TMP_String_sub_61.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_String_sub_61.$$p = null; + + + if ($iter) TMP_String_sub_61.$$p = null;; + ; + + if (!pattern.$$is_regexp) { + pattern = $$($nesting, 'Opal').$coerce_to(pattern, $$($nesting, 'String'), "to_str"); + pattern = new RegExp(pattern.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')); + } + + var result, match = pattern.exec(self); + + if (match === null) { + ($gvars["~"] = nil) + result = self.toString(); + } else { + $$($nesting, 'MatchData').$new(pattern, match) + + if (replacement === undefined) { + + if (block === nil) { + self.$raise($$($nesting, 'ArgumentError'), "wrong number of arguments (1 for 2)") + } + result = self.slice(0, match.index) + block(match[0]) + self.slice(match.index + match[0].length); + + } else if (replacement.$$is_hash) { + + result = self.slice(0, match.index) + (replacement)['$[]'](match[0]).$to_s() + self.slice(match.index + match[0].length); + + } else { + + replacement = $$($nesting, 'Opal').$coerce_to(replacement, $$($nesting, 'String'), "to_str"); + + replacement = replacement.replace(/([\\]+)([0-9+&`'])/g, function (original, slashes, command) { + if (slashes.length % 2 === 0) { + return original; + } + switch (command) { + case "+": + for (var i = match.length - 1; i > 0; i--) { + if (match[i] !== undefined) { + return slashes.slice(1) + match[i]; + } + } + return ''; + case "&": return slashes.slice(1) + match[0]; + case "`": return slashes.slice(1) + self.slice(0, match.index); + case "'": return slashes.slice(1) + self.slice(match.index + match[0].length); + default: return slashes.slice(1) + (match[command] || ''); + } + }).replace(/\\\\/g, '\\'); + + result = self.slice(0, match.index) + replacement + self.slice(match.index + match[0].length); + } + } + + return self.$$cast(result); + ; + }, TMP_String_sub_61.$$arity = -2); + Opal.alias(self, "succ", "next"); + + Opal.def(self, '$sum', TMP_String_sum_62 = function $$sum(n) { + var self = this; + + + + if (n == null) { + n = 16; + }; + + n = $$($nesting, 'Opal').$coerce_to(n, $$($nesting, 'Integer'), "to_int"); + + var result = 0, + length = self.length, + i = 0; + + for (; i < length; i++) { + result += self.charCodeAt(i); + } + + if (n <= 0) { + return result; + } + + return result & (Math.pow(2, n) - 1); + ; + }, TMP_String_sum_62.$$arity = -1); + + Opal.def(self, '$swapcase', TMP_String_swapcase_63 = function $$swapcase() { + var self = this; + + + var str = self.replace(/([a-z]+)|([A-Z]+)/g, function($0,$1,$2) { + return $1 ? $0.toUpperCase() : $0.toLowerCase(); + }); + + if (self.constructor === String) { + return str; + } + + return self.$class().$new(str); + + }, TMP_String_swapcase_63.$$arity = 0); + + Opal.def(self, '$to_f', TMP_String_to_f_64 = function $$to_f() { + var self = this; + + + if (self.charAt(0) === '_') { + return 0; + } + + var result = parseFloat(self.replace(/_/g, '')); + + if (isNaN(result) || result == Infinity || result == -Infinity) { + return 0; + } + else { + return result; + } + + }, TMP_String_to_f_64.$$arity = 0); + + Opal.def(self, '$to_i', TMP_String_to_i_65 = function $$to_i(base) { + var self = this; + + + + if (base == null) { + base = 10; + }; + + var result, + string = self.toLowerCase(), + radix = $$($nesting, 'Opal').$coerce_to(base, $$($nesting, 'Integer'), "to_int"); + + if (radix === 1 || radix < 0 || radix > 36) { + self.$raise($$($nesting, 'ArgumentError'), "" + "invalid radix " + (radix)) + } + + if (/^\s*_/.test(string)) { + return 0; + } + + string = string.replace(/^(\s*[+-]?)(0[bodx]?)(.+)$/, function (original, head, flag, tail) { + switch (tail.charAt(0)) { + case '+': + case '-': + return original; + case '0': + if (tail.charAt(1) === 'x' && flag === '0x' && (radix === 0 || radix === 16)) { + return original; + } + } + switch (flag) { + case '0b': + if (radix === 0 || radix === 2) { + radix = 2; + return head + tail; + } + break; + case '0': + case '0o': + if (radix === 0 || radix === 8) { + radix = 8; + return head + tail; + } + break; + case '0d': + if (radix === 0 || radix === 10) { + radix = 10; + return head + tail; + } + break; + case '0x': + if (radix === 0 || radix === 16) { + radix = 16; + return head + tail; + } + break; + } + return original + }); + + result = parseInt(string.replace(/_(?!_)/g, ''), radix); + return isNaN(result) ? 0 : result; + ; + }, TMP_String_to_i_65.$$arity = -1); + + Opal.def(self, '$to_proc', TMP_String_to_proc_66 = function $$to_proc() { + var TMP_67, $iter = TMP_String_to_proc_66.$$p, $yield = $iter || nil, self = this, method_name = nil; + + if ($iter) TMP_String_to_proc_66.$$p = null; + + method_name = $rb_plus("$", self.valueOf()); + return $send(self, 'proc', [], (TMP_67 = function($a){var self = TMP_67.$$s || this, $iter = TMP_67.$$p, block = $iter || nil, $post_args, args; + + + + if ($iter) TMP_67.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + + if (args.length === 0) { + self.$raise($$($nesting, 'ArgumentError'), "no receiver given") + } + + var recv = args[0]; + + if (recv == null) recv = nil; + + var body = recv[method_name]; + + if (!body) { + return recv.$method_missing.apply(recv, args); + } + + if (typeof block === 'function') { + body.$$p = block; + } + + if (args.length === 1) { + return body.call(recv); + } else { + return body.apply(recv, args.slice(1)); + } + ;}, TMP_67.$$s = self, TMP_67.$$arity = -1, TMP_67)); + }, TMP_String_to_proc_66.$$arity = 0); + + Opal.def(self, '$to_s', TMP_String_to_s_68 = function $$to_s() { + var self = this; + + return self.toString(); + }, TMP_String_to_s_68.$$arity = 0); + Opal.alias(self, "to_str", "to_s"); + Opal.alias(self, "to_sym", "intern"); + + Opal.def(self, '$tr', TMP_String_tr_69 = function $$tr(from, to) { + var self = this; + + + from = $$($nesting, 'Opal').$coerce_to(from, $$($nesting, 'String'), "to_str").$to_s(); + to = $$($nesting, 'Opal').$coerce_to(to, $$($nesting, 'String'), "to_str").$to_s(); + + if (from.length == 0 || from === to) { + return self; + } + + var i, in_range, c, ch, start, end, length; + var subs = {}; + var from_chars = from.split(''); + var from_length = from_chars.length; + var to_chars = to.split(''); + var to_length = to_chars.length; + + var inverse = false; + var global_sub = null; + if (from_chars[0] === '^' && from_chars.length > 1) { + inverse = true; + from_chars.shift(); + global_sub = to_chars[to_length - 1] + from_length -= 1; + } + + var from_chars_expanded = []; + var last_from = null; + in_range = false; + for (i = 0; i < from_length; i++) { + ch = from_chars[i]; + if (last_from == null) { + last_from = ch; + from_chars_expanded.push(ch); + } + else if (ch === '-') { + if (last_from === '-') { + from_chars_expanded.push('-'); + from_chars_expanded.push('-'); + } + else if (i == from_length - 1) { + from_chars_expanded.push('-'); + } + else { + in_range = true; + } + } + else if (in_range) { + start = last_from.charCodeAt(0); + end = ch.charCodeAt(0); + if (start > end) { + self.$raise($$($nesting, 'ArgumentError'), "" + "invalid range \"" + (String.fromCharCode(start)) + "-" + (String.fromCharCode(end)) + "\" in string transliteration") + } + for (c = start + 1; c < end; c++) { + from_chars_expanded.push(String.fromCharCode(c)); + } + from_chars_expanded.push(ch); + in_range = null; + last_from = null; + } + else { + from_chars_expanded.push(ch); + } + } + + from_chars = from_chars_expanded; + from_length = from_chars.length; + + if (inverse) { + for (i = 0; i < from_length; i++) { + subs[from_chars[i]] = true; + } + } + else { + if (to_length > 0) { + var to_chars_expanded = []; + var last_to = null; + in_range = false; + for (i = 0; i < to_length; i++) { + ch = to_chars[i]; + if (last_to == null) { + last_to = ch; + to_chars_expanded.push(ch); + } + else if (ch === '-') { + if (last_to === '-') { + to_chars_expanded.push('-'); + to_chars_expanded.push('-'); + } + else if (i == to_length - 1) { + to_chars_expanded.push('-'); + } + else { + in_range = true; + } + } + else if (in_range) { + start = last_to.charCodeAt(0); + end = ch.charCodeAt(0); + if (start > end) { + self.$raise($$($nesting, 'ArgumentError'), "" + "invalid range \"" + (String.fromCharCode(start)) + "-" + (String.fromCharCode(end)) + "\" in string transliteration") + } + for (c = start + 1; c < end; c++) { + to_chars_expanded.push(String.fromCharCode(c)); + } + to_chars_expanded.push(ch); + in_range = null; + last_to = null; + } + else { + to_chars_expanded.push(ch); + } + } + + to_chars = to_chars_expanded; + to_length = to_chars.length; + } + + var length_diff = from_length - to_length; + if (length_diff > 0) { + var pad_char = (to_length > 0 ? to_chars[to_length - 1] : ''); + for (i = 0; i < length_diff; i++) { + to_chars.push(pad_char); + } + } + + for (i = 0; i < from_length; i++) { + subs[from_chars[i]] = to_chars[i]; + } + } + + var new_str = '' + for (i = 0, length = self.length; i < length; i++) { + ch = self.charAt(i); + var sub = subs[ch]; + if (inverse) { + new_str += (sub == null ? global_sub : ch); + } + else { + new_str += (sub != null ? sub : ch); + } + } + return self.$$cast(new_str); + ; + }, TMP_String_tr_69.$$arity = 2); + + Opal.def(self, '$tr_s', TMP_String_tr_s_70 = function $$tr_s(from, to) { + var self = this; + + + from = $$($nesting, 'Opal').$coerce_to(from, $$($nesting, 'String'), "to_str").$to_s(); + to = $$($nesting, 'Opal').$coerce_to(to, $$($nesting, 'String'), "to_str").$to_s(); + + if (from.length == 0) { + return self; + } + + var i, in_range, c, ch, start, end, length; + var subs = {}; + var from_chars = from.split(''); + var from_length = from_chars.length; + var to_chars = to.split(''); + var to_length = to_chars.length; + + var inverse = false; + var global_sub = null; + if (from_chars[0] === '^' && from_chars.length > 1) { + inverse = true; + from_chars.shift(); + global_sub = to_chars[to_length - 1] + from_length -= 1; + } + + var from_chars_expanded = []; + var last_from = null; + in_range = false; + for (i = 0; i < from_length; i++) { + ch = from_chars[i]; + if (last_from == null) { + last_from = ch; + from_chars_expanded.push(ch); + } + else if (ch === '-') { + if (last_from === '-') { + from_chars_expanded.push('-'); + from_chars_expanded.push('-'); + } + else if (i == from_length - 1) { + from_chars_expanded.push('-'); + } + else { + in_range = true; + } + } + else if (in_range) { + start = last_from.charCodeAt(0); + end = ch.charCodeAt(0); + if (start > end) { + self.$raise($$($nesting, 'ArgumentError'), "" + "invalid range \"" + (String.fromCharCode(start)) + "-" + (String.fromCharCode(end)) + "\" in string transliteration") + } + for (c = start + 1; c < end; c++) { + from_chars_expanded.push(String.fromCharCode(c)); + } + from_chars_expanded.push(ch); + in_range = null; + last_from = null; + } + else { + from_chars_expanded.push(ch); + } + } + + from_chars = from_chars_expanded; + from_length = from_chars.length; + + if (inverse) { + for (i = 0; i < from_length; i++) { + subs[from_chars[i]] = true; + } + } + else { + if (to_length > 0) { + var to_chars_expanded = []; + var last_to = null; + in_range = false; + for (i = 0; i < to_length; i++) { + ch = to_chars[i]; + if (last_from == null) { + last_from = ch; + to_chars_expanded.push(ch); + } + else if (ch === '-') { + if (last_to === '-') { + to_chars_expanded.push('-'); + to_chars_expanded.push('-'); + } + else if (i == to_length - 1) { + to_chars_expanded.push('-'); + } + else { + in_range = true; + } + } + else if (in_range) { + start = last_from.charCodeAt(0); + end = ch.charCodeAt(0); + if (start > end) { + self.$raise($$($nesting, 'ArgumentError'), "" + "invalid range \"" + (String.fromCharCode(start)) + "-" + (String.fromCharCode(end)) + "\" in string transliteration") + } + for (c = start + 1; c < end; c++) { + to_chars_expanded.push(String.fromCharCode(c)); + } + to_chars_expanded.push(ch); + in_range = null; + last_from = null; + } + else { + to_chars_expanded.push(ch); + } + } + + to_chars = to_chars_expanded; + to_length = to_chars.length; + } + + var length_diff = from_length - to_length; + if (length_diff > 0) { + var pad_char = (to_length > 0 ? to_chars[to_length - 1] : ''); + for (i = 0; i < length_diff; i++) { + to_chars.push(pad_char); + } + } + + for (i = 0; i < from_length; i++) { + subs[from_chars[i]] = to_chars[i]; + } + } + var new_str = '' + var last_substitute = null + for (i = 0, length = self.length; i < length; i++) { + ch = self.charAt(i); + var sub = subs[ch] + if (inverse) { + if (sub == null) { + if (last_substitute == null) { + new_str += global_sub; + last_substitute = true; + } + } + else { + new_str += ch; + last_substitute = null; + } + } + else { + if (sub != null) { + if (last_substitute == null || last_substitute !== sub) { + new_str += sub; + last_substitute = sub; + } + } + else { + new_str += ch; + last_substitute = null; + } + } + } + return self.$$cast(new_str); + ; + }, TMP_String_tr_s_70.$$arity = 2); + + Opal.def(self, '$upcase', TMP_String_upcase_71 = function $$upcase() { + var self = this; + + return self.$$cast(self.toUpperCase()); + }, TMP_String_upcase_71.$$arity = 0); + + Opal.def(self, '$upto', TMP_String_upto_72 = function $$upto(stop, excl) { + var $iter = TMP_String_upto_72.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_String_upto_72.$$p = null; + + + if ($iter) TMP_String_upto_72.$$p = null;; + + if (excl == null) { + excl = false; + }; + if ((block !== nil)) { + } else { + return self.$enum_for("upto", stop, excl) + }; + stop = $$($nesting, 'Opal').$coerce_to(stop, $$($nesting, 'String'), "to_str"); + + var a, b, s = self.toString(); + + if (s.length === 1 && stop.length === 1) { + + a = s.charCodeAt(0); + b = stop.charCodeAt(0); + + while (a <= b) { + if (excl && a === b) { + break; + } + + block(String.fromCharCode(a)); + + a += 1; + } + + } else if (parseInt(s, 10).toString() === s && parseInt(stop, 10).toString() === stop) { + + a = parseInt(s, 10); + b = parseInt(stop, 10); + + while (a <= b) { + if (excl && a === b) { + break; + } + + block(a.toString()); + + a += 1; + } + + } else { + + while (s.length <= stop.length && s <= stop) { + if (excl && s === stop) { + break; + } + + block(s); + + s = (s).$succ(); + } + + } + return self; + ; + }, TMP_String_upto_72.$$arity = -2); + + function char_class_from_char_sets(sets) { + function explode_sequences_in_character_set(set) { + var result = '', + i, len = set.length, + curr_char, + skip_next_dash, + char_code_from, + char_code_upto, + char_code; + for (i = 0; i < len; i++) { + curr_char = set.charAt(i); + if (curr_char === '-' && i > 0 && i < (len - 1) && !skip_next_dash) { + char_code_from = set.charCodeAt(i - 1); + char_code_upto = set.charCodeAt(i + 1); + if (char_code_from > char_code_upto) { + self.$raise($$($nesting, 'ArgumentError'), "" + "invalid range \"" + (char_code_from) + "-" + (char_code_upto) + "\" in string transliteration") + } + for (char_code = char_code_from + 1; char_code < char_code_upto + 1; char_code++) { + result += String.fromCharCode(char_code); + } + skip_next_dash = true; + i++; + } else { + skip_next_dash = (curr_char === '\\'); + result += curr_char; + } + } + return result; + } + + function intersection(setA, setB) { + if (setA.length === 0) { + return setB; + } + var result = '', + i, len = setA.length, + chr; + for (i = 0; i < len; i++) { + chr = setA.charAt(i); + if (setB.indexOf(chr) !== -1) { + result += chr; + } + } + return result; + } + + var i, len, set, neg, chr, tmp, + pos_intersection = '', + neg_intersection = ''; + + for (i = 0, len = sets.length; i < len; i++) { + set = $$($nesting, 'Opal').$coerce_to(sets[i], $$($nesting, 'String'), "to_str"); + neg = (set.charAt(0) === '^' && set.length > 1); + set = explode_sequences_in_character_set(neg ? set.slice(1) : set); + if (neg) { + neg_intersection = intersection(neg_intersection, set); + } else { + pos_intersection = intersection(pos_intersection, set); + } + } + + if (pos_intersection.length > 0 && neg_intersection.length > 0) { + tmp = ''; + for (i = 0, len = pos_intersection.length; i < len; i++) { + chr = pos_intersection.charAt(i); + if (neg_intersection.indexOf(chr) === -1) { + tmp += chr; + } + } + pos_intersection = tmp; + neg_intersection = ''; + } + + if (pos_intersection.length > 0) { + return '[' + $$($nesting, 'Regexp').$escape(pos_intersection) + ']'; + } + + if (neg_intersection.length > 0) { + return '[^' + $$($nesting, 'Regexp').$escape(neg_intersection) + ']'; + } + + return null; + } + ; + + Opal.def(self, '$instance_variables', TMP_String_instance_variables_73 = function $$instance_variables() { + var self = this; + + return [] + }, TMP_String_instance_variables_73.$$arity = 0); + Opal.defs(self, '$_load', TMP_String__load_74 = function $$_load($a) { + var $post_args, args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + return $send(self, 'new', Opal.to_a(args)); + }, TMP_String__load_74.$$arity = -1); + + Opal.def(self, '$unicode_normalize', TMP_String_unicode_normalize_75 = function $$unicode_normalize(form) { + var self = this; + + + ; + return self.toString();; + }, TMP_String_unicode_normalize_75.$$arity = -1); + + Opal.def(self, '$unicode_normalized?', TMP_String_unicode_normalized$q_76 = function(form) { + var self = this; + + + ; + return true; + }, TMP_String_unicode_normalized$q_76.$$arity = -1); + + Opal.def(self, '$unpack', TMP_String_unpack_77 = function $$unpack(format) { + var self = this; + + return self.$raise("To use String#unpack, you must first require 'corelib/string/unpack'.") + }, TMP_String_unpack_77.$$arity = 1); + return (Opal.def(self, '$unpack1', TMP_String_unpack1_78 = function $$unpack1(format) { + var self = this; + + return self.$raise("To use String#unpack1, you must first require 'corelib/string/unpack'.") + }, TMP_String_unpack1_78.$$arity = 1), nil) && 'unpack1'; + })($nesting[0], String, $nesting); + return Opal.const_set($nesting[0], 'Symbol', $$($nesting, 'String')); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/enumerable"] = function(Opal) { + function $rb_gt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); + } + function $rb_times(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs * rhs : lhs['$*'](rhs); + } + function $rb_lt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); + } + function $rb_plus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); + } + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + function $rb_divide(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs / rhs : lhs['$/'](rhs); + } + function $rb_le(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs <= rhs : lhs['$<='](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $truthy = Opal.truthy, $send = Opal.send, $falsy = Opal.falsy, $hash2 = Opal.hash2, $lambda = Opal.lambda; + + Opal.add_stubs(['$each', '$public_send', '$destructure', '$to_enum', '$enumerator_size', '$new', '$yield', '$raise', '$slice_when', '$!', '$enum_for', '$flatten', '$map', '$warn', '$proc', '$==', '$nil?', '$respond_to?', '$coerce_to!', '$>', '$*', '$coerce_to', '$try_convert', '$<', '$+', '$-', '$ceil', '$/', '$size', '$__send__', '$length', '$<=', '$[]', '$push', '$<<', '$[]=', '$===', '$inspect', '$<=>', '$first', '$reverse', '$sort', '$to_proc', '$compare', '$call', '$dup', '$to_a', '$sort!', '$map!', '$key?', '$values', '$zip']); + return (function($base, $parent_nesting) { + function $Enumerable() {}; + var self = $Enumerable = $module($base, 'Enumerable', $Enumerable); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Enumerable_all$q_1, TMP_Enumerable_any$q_5, TMP_Enumerable_chunk_9, TMP_Enumerable_chunk_while_12, TMP_Enumerable_collect_14, TMP_Enumerable_collect_concat_16, TMP_Enumerable_count_19, TMP_Enumerable_cycle_23, TMP_Enumerable_detect_25, TMP_Enumerable_drop_27, TMP_Enumerable_drop_while_28, TMP_Enumerable_each_cons_29, TMP_Enumerable_each_entry_31, TMP_Enumerable_each_slice_33, TMP_Enumerable_each_with_index_35, TMP_Enumerable_each_with_object_37, TMP_Enumerable_entries_39, TMP_Enumerable_find_all_40, TMP_Enumerable_find_index_42, TMP_Enumerable_first_45, TMP_Enumerable_grep_48, TMP_Enumerable_grep_v_50, TMP_Enumerable_group_by_52, TMP_Enumerable_include$q_54, TMP_Enumerable_inject_56, TMP_Enumerable_lazy_57, TMP_Enumerable_enumerator_size_59, TMP_Enumerable_max_60, TMP_Enumerable_max_by_61, TMP_Enumerable_min_63, TMP_Enumerable_min_by_64, TMP_Enumerable_minmax_66, TMP_Enumerable_minmax_by_68, TMP_Enumerable_none$q_69, TMP_Enumerable_one$q_73, TMP_Enumerable_partition_77, TMP_Enumerable_reject_79, TMP_Enumerable_reverse_each_81, TMP_Enumerable_slice_before_83, TMP_Enumerable_slice_after_85, TMP_Enumerable_slice_when_88, TMP_Enumerable_sort_90, TMP_Enumerable_sort_by_92, TMP_Enumerable_sum_97, TMP_Enumerable_take_99, TMP_Enumerable_take_while_100, TMP_Enumerable_uniq_102, TMP_Enumerable_zip_104; + + + + function comparableForPattern(value) { + if (value.length === 0) { + value = [nil]; + } + + if (value.length > 1) { + value = [value]; + } + + return value; + } + ; + + Opal.def(self, '$all?', TMP_Enumerable_all$q_1 = function(pattern) {try { + + var $iter = TMP_Enumerable_all$q_1.$$p, block = $iter || nil, TMP_2, TMP_3, TMP_4, self = this; + + if ($iter) TMP_Enumerable_all$q_1.$$p = null; + + + if ($iter) TMP_Enumerable_all$q_1.$$p = null;; + ; + if ($truthy(pattern !== undefined)) { + $send(self, 'each', [], (TMP_2 = function($a){var self = TMP_2.$$s || this, $post_args, value, comparable = nil; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + value = $post_args;; + comparable = comparableForPattern(value); + if ($truthy($send(pattern, 'public_send', ["==="].concat(Opal.to_a(comparable))))) { + return nil + } else { + Opal.ret(false) + };}, TMP_2.$$s = self, TMP_2.$$arity = -1, TMP_2)) + } else if ((block !== nil)) { + $send(self, 'each', [], (TMP_3 = function($a){var self = TMP_3.$$s || this, $post_args, value; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + value = $post_args;; + if ($truthy(Opal.yieldX(block, Opal.to_a(value)))) { + return nil + } else { + Opal.ret(false) + };}, TMP_3.$$s = self, TMP_3.$$arity = -1, TMP_3)) + } else { + $send(self, 'each', [], (TMP_4 = function($a){var self = TMP_4.$$s || this, $post_args, value; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + value = $post_args;; + if ($truthy($$($nesting, 'Opal').$destructure(value))) { + return nil + } else { + Opal.ret(false) + };}, TMP_4.$$s = self, TMP_4.$$arity = -1, TMP_4)) + }; + return true; + } catch ($returner) { if ($returner === Opal.returner) { return $returner.$v } throw $returner; } + }, TMP_Enumerable_all$q_1.$$arity = -1); + + Opal.def(self, '$any?', TMP_Enumerable_any$q_5 = function(pattern) {try { + + var $iter = TMP_Enumerable_any$q_5.$$p, block = $iter || nil, TMP_6, TMP_7, TMP_8, self = this; + + if ($iter) TMP_Enumerable_any$q_5.$$p = null; + + + if ($iter) TMP_Enumerable_any$q_5.$$p = null;; + ; + if ($truthy(pattern !== undefined)) { + $send(self, 'each', [], (TMP_6 = function($a){var self = TMP_6.$$s || this, $post_args, value, comparable = nil; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + value = $post_args;; + comparable = comparableForPattern(value); + if ($truthy($send(pattern, 'public_send', ["==="].concat(Opal.to_a(comparable))))) { + Opal.ret(true) + } else { + return nil + };}, TMP_6.$$s = self, TMP_6.$$arity = -1, TMP_6)) + } else if ((block !== nil)) { + $send(self, 'each', [], (TMP_7 = function($a){var self = TMP_7.$$s || this, $post_args, value; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + value = $post_args;; + if ($truthy(Opal.yieldX(block, Opal.to_a(value)))) { + Opal.ret(true) + } else { + return nil + };}, TMP_7.$$s = self, TMP_7.$$arity = -1, TMP_7)) + } else { + $send(self, 'each', [], (TMP_8 = function($a){var self = TMP_8.$$s || this, $post_args, value; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + value = $post_args;; + if ($truthy($$($nesting, 'Opal').$destructure(value))) { + Opal.ret(true) + } else { + return nil + };}, TMP_8.$$s = self, TMP_8.$$arity = -1, TMP_8)) + }; + return false; + } catch ($returner) { if ($returner === Opal.returner) { return $returner.$v } throw $returner; } + }, TMP_Enumerable_any$q_5.$$arity = -1); + + Opal.def(self, '$chunk', TMP_Enumerable_chunk_9 = function $$chunk() { + var $iter = TMP_Enumerable_chunk_9.$$p, block = $iter || nil, TMP_10, TMP_11, self = this; + + if ($iter) TMP_Enumerable_chunk_9.$$p = null; + + + if ($iter) TMP_Enumerable_chunk_9.$$p = null;; + if ((block !== nil)) { + } else { + return $send(self, 'to_enum', ["chunk"], (TMP_10 = function(){var self = TMP_10.$$s || this; + + return self.$enumerator_size()}, TMP_10.$$s = self, TMP_10.$$arity = 0, TMP_10)) + }; + return $send($$$('::', 'Enumerator'), 'new', [], (TMP_11 = function(yielder){var self = TMP_11.$$s || this; + + + + if (yielder == null) { + yielder = nil; + }; + + var previous = nil, accumulate = []; + + function releaseAccumulate() { + if (accumulate.length > 0) { + yielder.$yield(previous, accumulate) + } + } + + self.$each.$$p = function(value) { + var key = Opal.yield1(block, value); + + if (key === nil) { + releaseAccumulate(); + accumulate = []; + previous = nil; + } else { + if (previous === nil || previous === key) { + accumulate.push(value); + } else { + releaseAccumulate(); + accumulate = [value]; + } + + previous = key; + } + } + + self.$each(); + + releaseAccumulate(); + ;}, TMP_11.$$s = self, TMP_11.$$arity = 1, TMP_11)); + }, TMP_Enumerable_chunk_9.$$arity = 0); + + Opal.def(self, '$chunk_while', TMP_Enumerable_chunk_while_12 = function $$chunk_while() { + var $iter = TMP_Enumerable_chunk_while_12.$$p, block = $iter || nil, TMP_13, self = this; + + if ($iter) TMP_Enumerable_chunk_while_12.$$p = null; + + + if ($iter) TMP_Enumerable_chunk_while_12.$$p = null;; + if ((block !== nil)) { + } else { + self.$raise($$($nesting, 'ArgumentError'), "no block given") + }; + return $send(self, 'slice_when', [], (TMP_13 = function(before, after){var self = TMP_13.$$s || this; + + + + if (before == null) { + before = nil; + }; + + if (after == null) { + after = nil; + }; + return Opal.yieldX(block, [before, after])['$!']();}, TMP_13.$$s = self, TMP_13.$$arity = 2, TMP_13)); + }, TMP_Enumerable_chunk_while_12.$$arity = 0); + + Opal.def(self, '$collect', TMP_Enumerable_collect_14 = function $$collect() { + var $iter = TMP_Enumerable_collect_14.$$p, block = $iter || nil, TMP_15, self = this; + + if ($iter) TMP_Enumerable_collect_14.$$p = null; + + + if ($iter) TMP_Enumerable_collect_14.$$p = null;; + if ((block !== nil)) { + } else { + return $send(self, 'enum_for', ["collect"], (TMP_15 = function(){var self = TMP_15.$$s || this; + + return self.$enumerator_size()}, TMP_15.$$s = self, TMP_15.$$arity = 0, TMP_15)) + }; + + var result = []; + + self.$each.$$p = function() { + var value = Opal.yieldX(block, arguments); + + result.push(value); + }; + + self.$each(); + + return result; + ; + }, TMP_Enumerable_collect_14.$$arity = 0); + + Opal.def(self, '$collect_concat', TMP_Enumerable_collect_concat_16 = function $$collect_concat() { + var $iter = TMP_Enumerable_collect_concat_16.$$p, block = $iter || nil, TMP_17, TMP_18, self = this; + + if ($iter) TMP_Enumerable_collect_concat_16.$$p = null; + + + if ($iter) TMP_Enumerable_collect_concat_16.$$p = null;; + if ((block !== nil)) { + } else { + return $send(self, 'enum_for', ["collect_concat"], (TMP_17 = function(){var self = TMP_17.$$s || this; + + return self.$enumerator_size()}, TMP_17.$$s = self, TMP_17.$$arity = 0, TMP_17)) + }; + return $send(self, 'map', [], (TMP_18 = function(item){var self = TMP_18.$$s || this; + + + + if (item == null) { + item = nil; + }; + return Opal.yield1(block, item);;}, TMP_18.$$s = self, TMP_18.$$arity = 1, TMP_18)).$flatten(1); + }, TMP_Enumerable_collect_concat_16.$$arity = 0); + + Opal.def(self, '$count', TMP_Enumerable_count_19 = function $$count(object) { + var $iter = TMP_Enumerable_count_19.$$p, block = $iter || nil, TMP_20, TMP_21, TMP_22, self = this, result = nil; + + if ($iter) TMP_Enumerable_count_19.$$p = null; + + + if ($iter) TMP_Enumerable_count_19.$$p = null;; + ; + result = 0; + + if (object != null && block !== nil) { + self.$warn("warning: given block not used") + } + ; + if ($truthy(object != null)) { + block = $send(self, 'proc', [], (TMP_20 = function($a){var self = TMP_20.$$s || this, $post_args, args; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + return $$($nesting, 'Opal').$destructure(args)['$=='](object);}, TMP_20.$$s = self, TMP_20.$$arity = -1, TMP_20)) + } else if ($truthy(block['$nil?']())) { + block = $send(self, 'proc', [], (TMP_21 = function(){var self = TMP_21.$$s || this; + + return true}, TMP_21.$$s = self, TMP_21.$$arity = 0, TMP_21))}; + $send(self, 'each', [], (TMP_22 = function($a){var self = TMP_22.$$s || this, $post_args, args; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + if ($truthy(Opal.yieldX(block, args))) { + return result++; + } else { + return nil + };}, TMP_22.$$s = self, TMP_22.$$arity = -1, TMP_22)); + return result; + }, TMP_Enumerable_count_19.$$arity = -1); + + Opal.def(self, '$cycle', TMP_Enumerable_cycle_23 = function $$cycle(n) { + var $iter = TMP_Enumerable_cycle_23.$$p, block = $iter || nil, TMP_24, self = this; + + if ($iter) TMP_Enumerable_cycle_23.$$p = null; + + + if ($iter) TMP_Enumerable_cycle_23.$$p = null;; + + if (n == null) { + n = nil; + }; + if ((block !== nil)) { + } else { + return $send(self, 'enum_for', ["cycle", n], (TMP_24 = function(){var self = TMP_24.$$s || this; + + if ($truthy(n['$nil?']())) { + if ($truthy(self['$respond_to?']("size"))) { + return $$$($$($nesting, 'Float'), 'INFINITY') + } else { + return nil + } + } else { + + n = $$($nesting, 'Opal')['$coerce_to!'](n, $$($nesting, 'Integer'), "to_int"); + if ($truthy($rb_gt(n, 0))) { + return $rb_times(self.$enumerator_size(), n) + } else { + return 0 + }; + }}, TMP_24.$$s = self, TMP_24.$$arity = 0, TMP_24)) + }; + if ($truthy(n['$nil?']())) { + } else { + + n = $$($nesting, 'Opal')['$coerce_to!'](n, $$($nesting, 'Integer'), "to_int"); + if ($truthy(n <= 0)) { + return nil}; + }; + + var result, + all = [], i, length, value; + + self.$each.$$p = function() { + var param = $$($nesting, 'Opal').$destructure(arguments), + value = Opal.yield1(block, param); + + all.push(param); + } + + self.$each(); + + if (result !== undefined) { + return result; + } + + if (all.length === 0) { + return nil; + } + + if (n === nil) { + while (true) { + for (i = 0, length = all.length; i < length; i++) { + value = Opal.yield1(block, all[i]); + } + } + } + else { + while (n > 1) { + for (i = 0, length = all.length; i < length; i++) { + value = Opal.yield1(block, all[i]); + } + + n--; + } + } + ; + }, TMP_Enumerable_cycle_23.$$arity = -1); + + Opal.def(self, '$detect', TMP_Enumerable_detect_25 = function $$detect(ifnone) {try { + + var $iter = TMP_Enumerable_detect_25.$$p, block = $iter || nil, TMP_26, self = this; + + if ($iter) TMP_Enumerable_detect_25.$$p = null; + + + if ($iter) TMP_Enumerable_detect_25.$$p = null;; + ; + if ((block !== nil)) { + } else { + return self.$enum_for("detect", ifnone) + }; + $send(self, 'each', [], (TMP_26 = function($a){var self = TMP_26.$$s || this, $post_args, args, value = nil; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + value = $$($nesting, 'Opal').$destructure(args); + if ($truthy(Opal.yield1(block, value))) { + Opal.ret(value) + } else { + return nil + };}, TMP_26.$$s = self, TMP_26.$$arity = -1, TMP_26)); + + if (ifnone !== undefined) { + if (typeof(ifnone) === 'function') { + return ifnone(); + } else { + return ifnone; + } + } + ; + return nil; + } catch ($returner) { if ($returner === Opal.returner) { return $returner.$v } throw $returner; } + }, TMP_Enumerable_detect_25.$$arity = -1); + + Opal.def(self, '$drop', TMP_Enumerable_drop_27 = function $$drop(number) { + var self = this; + + + number = $$($nesting, 'Opal').$coerce_to(number, $$($nesting, 'Integer'), "to_int"); + if ($truthy(number < 0)) { + self.$raise($$($nesting, 'ArgumentError'), "attempt to drop negative size")}; + + var result = [], + current = 0; + + self.$each.$$p = function() { + if (number <= current) { + result.push($$($nesting, 'Opal').$destructure(arguments)); + } + + current++; + }; + + self.$each() + + return result; + ; + }, TMP_Enumerable_drop_27.$$arity = 1); + + Opal.def(self, '$drop_while', TMP_Enumerable_drop_while_28 = function $$drop_while() { + var $iter = TMP_Enumerable_drop_while_28.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Enumerable_drop_while_28.$$p = null; + + + if ($iter) TMP_Enumerable_drop_while_28.$$p = null;; + if ((block !== nil)) { + } else { + return self.$enum_for("drop_while") + }; + + var result = [], + dropping = true; + + self.$each.$$p = function() { + var param = $$($nesting, 'Opal').$destructure(arguments); + + if (dropping) { + var value = Opal.yield1(block, param); + + if ($falsy(value)) { + dropping = false; + result.push(param); + } + } + else { + result.push(param); + } + }; + + self.$each(); + + return result; + ; + }, TMP_Enumerable_drop_while_28.$$arity = 0); + + Opal.def(self, '$each_cons', TMP_Enumerable_each_cons_29 = function $$each_cons(n) { + var $iter = TMP_Enumerable_each_cons_29.$$p, block = $iter || nil, TMP_30, self = this; + + if ($iter) TMP_Enumerable_each_cons_29.$$p = null; + + + if ($iter) TMP_Enumerable_each_cons_29.$$p = null;; + if ($truthy(arguments.length != 1)) { + self.$raise($$($nesting, 'ArgumentError'), "" + "wrong number of arguments (" + (arguments.length) + " for 1)")}; + n = $$($nesting, 'Opal').$try_convert(n, $$($nesting, 'Integer'), "to_int"); + if ($truthy(n <= 0)) { + self.$raise($$($nesting, 'ArgumentError'), "invalid size")}; + if ((block !== nil)) { + } else { + return $send(self, 'enum_for', ["each_cons", n], (TMP_30 = function(){var self = TMP_30.$$s || this, $a, enum_size = nil; + + + enum_size = self.$enumerator_size(); + if ($truthy(enum_size['$nil?']())) { + return nil + } else if ($truthy(($truthy($a = enum_size['$=='](0)) ? $a : $rb_lt(enum_size, n)))) { + return 0 + } else { + return $rb_plus($rb_minus(enum_size, n), 1) + };}, TMP_30.$$s = self, TMP_30.$$arity = 0, TMP_30)) + }; + + var buffer = [], result = nil; + + self.$each.$$p = function() { + var element = $$($nesting, 'Opal').$destructure(arguments); + buffer.push(element); + if (buffer.length > n) { + buffer.shift(); + } + if (buffer.length == n) { + Opal.yield1(block, buffer.slice(0, n)); + } + } + + self.$each(); + + return result; + ; + }, TMP_Enumerable_each_cons_29.$$arity = 1); + + Opal.def(self, '$each_entry', TMP_Enumerable_each_entry_31 = function $$each_entry($a) { + var $iter = TMP_Enumerable_each_entry_31.$$p, block = $iter || nil, $post_args, data, TMP_32, self = this; + + if ($iter) TMP_Enumerable_each_entry_31.$$p = null; + + + if ($iter) TMP_Enumerable_each_entry_31.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + data = $post_args;; + if ((block !== nil)) { + } else { + return $send(self, 'to_enum', ["each_entry"].concat(Opal.to_a(data)), (TMP_32 = function(){var self = TMP_32.$$s || this; + + return self.$enumerator_size()}, TMP_32.$$s = self, TMP_32.$$arity = 0, TMP_32)) + }; + + self.$each.$$p = function() { + var item = $$($nesting, 'Opal').$destructure(arguments); + + Opal.yield1(block, item); + } + + self.$each.apply(self, data); + + return self; + ; + }, TMP_Enumerable_each_entry_31.$$arity = -1); + + Opal.def(self, '$each_slice', TMP_Enumerable_each_slice_33 = function $$each_slice(n) { + var $iter = TMP_Enumerable_each_slice_33.$$p, block = $iter || nil, TMP_34, self = this; + + if ($iter) TMP_Enumerable_each_slice_33.$$p = null; + + + if ($iter) TMP_Enumerable_each_slice_33.$$p = null;; + n = $$($nesting, 'Opal').$coerce_to(n, $$($nesting, 'Integer'), "to_int"); + if ($truthy(n <= 0)) { + self.$raise($$($nesting, 'ArgumentError'), "invalid slice size")}; + if ((block !== nil)) { + } else { + return $send(self, 'enum_for', ["each_slice", n], (TMP_34 = function(){var self = TMP_34.$$s || this; + + if ($truthy(self['$respond_to?']("size"))) { + return $rb_divide(self.$size(), n).$ceil() + } else { + return nil + }}, TMP_34.$$s = self, TMP_34.$$arity = 0, TMP_34)) + }; + + var result, + slice = [] + + self.$each.$$p = function() { + var param = $$($nesting, 'Opal').$destructure(arguments); + + slice.push(param); + + if (slice.length === n) { + Opal.yield1(block, slice); + slice = []; + } + }; + + self.$each(); + + if (result !== undefined) { + return result; + } + + // our "last" group, if smaller than n then won't have been yielded + if (slice.length > 0) { + Opal.yield1(block, slice); + } + ; + return nil; + }, TMP_Enumerable_each_slice_33.$$arity = 1); + + Opal.def(self, '$each_with_index', TMP_Enumerable_each_with_index_35 = function $$each_with_index($a) { + var $iter = TMP_Enumerable_each_with_index_35.$$p, block = $iter || nil, $post_args, args, TMP_36, self = this; + + if ($iter) TMP_Enumerable_each_with_index_35.$$p = null; + + + if ($iter) TMP_Enumerable_each_with_index_35.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + if ((block !== nil)) { + } else { + return $send(self, 'enum_for', ["each_with_index"].concat(Opal.to_a(args)), (TMP_36 = function(){var self = TMP_36.$$s || this; + + return self.$enumerator_size()}, TMP_36.$$s = self, TMP_36.$$arity = 0, TMP_36)) + }; + + var result, + index = 0; + + self.$each.$$p = function() { + var param = $$($nesting, 'Opal').$destructure(arguments); + + block(param, index); + + index++; + }; + + self.$each.apply(self, args); + + if (result !== undefined) { + return result; + } + ; + return self; + }, TMP_Enumerable_each_with_index_35.$$arity = -1); + + Opal.def(self, '$each_with_object', TMP_Enumerable_each_with_object_37 = function $$each_with_object(object) { + var $iter = TMP_Enumerable_each_with_object_37.$$p, block = $iter || nil, TMP_38, self = this; + + if ($iter) TMP_Enumerable_each_with_object_37.$$p = null; + + + if ($iter) TMP_Enumerable_each_with_object_37.$$p = null;; + if ((block !== nil)) { + } else { + return $send(self, 'enum_for', ["each_with_object", object], (TMP_38 = function(){var self = TMP_38.$$s || this; + + return self.$enumerator_size()}, TMP_38.$$s = self, TMP_38.$$arity = 0, TMP_38)) + }; + + var result; + + self.$each.$$p = function() { + var param = $$($nesting, 'Opal').$destructure(arguments); + + block(param, object); + }; + + self.$each(); + + if (result !== undefined) { + return result; + } + ; + return object; + }, TMP_Enumerable_each_with_object_37.$$arity = 1); + + Opal.def(self, '$entries', TMP_Enumerable_entries_39 = function $$entries($a) { + var $post_args, args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + + var result = []; + + self.$each.$$p = function() { + result.push($$($nesting, 'Opal').$destructure(arguments)); + }; + + self.$each.apply(self, args); + + return result; + ; + }, TMP_Enumerable_entries_39.$$arity = -1); + Opal.alias(self, "find", "detect"); + + Opal.def(self, '$find_all', TMP_Enumerable_find_all_40 = function $$find_all() { + var $iter = TMP_Enumerable_find_all_40.$$p, block = $iter || nil, TMP_41, self = this; + + if ($iter) TMP_Enumerable_find_all_40.$$p = null; + + + if ($iter) TMP_Enumerable_find_all_40.$$p = null;; + if ((block !== nil)) { + } else { + return $send(self, 'enum_for', ["find_all"], (TMP_41 = function(){var self = TMP_41.$$s || this; + + return self.$enumerator_size()}, TMP_41.$$s = self, TMP_41.$$arity = 0, TMP_41)) + }; + + var result = []; + + self.$each.$$p = function() { + var param = $$($nesting, 'Opal').$destructure(arguments), + value = Opal.yield1(block, param); + + if ($truthy(value)) { + result.push(param); + } + }; + + self.$each(); + + return result; + ; + }, TMP_Enumerable_find_all_40.$$arity = 0); + + Opal.def(self, '$find_index', TMP_Enumerable_find_index_42 = function $$find_index(object) {try { + + var $iter = TMP_Enumerable_find_index_42.$$p, block = $iter || nil, TMP_43, TMP_44, self = this, index = nil; + + if ($iter) TMP_Enumerable_find_index_42.$$p = null; + + + if ($iter) TMP_Enumerable_find_index_42.$$p = null;; + ; + if ($truthy(object === undefined && block === nil)) { + return self.$enum_for("find_index")}; + + if (object != null && block !== nil) { + self.$warn("warning: given block not used") + } + ; + index = 0; + if ($truthy(object != null)) { + $send(self, 'each', [], (TMP_43 = function($a){var self = TMP_43.$$s || this, $post_args, value; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + value = $post_args;; + if ($$($nesting, 'Opal').$destructure(value)['$=='](object)) { + Opal.ret(index)}; + return index += 1;;}, TMP_43.$$s = self, TMP_43.$$arity = -1, TMP_43)) + } else { + $send(self, 'each', [], (TMP_44 = function($a){var self = TMP_44.$$s || this, $post_args, value; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + value = $post_args;; + if ($truthy(Opal.yieldX(block, Opal.to_a(value)))) { + Opal.ret(index)}; + return index += 1;;}, TMP_44.$$s = self, TMP_44.$$arity = -1, TMP_44)) + }; + return nil; + } catch ($returner) { if ($returner === Opal.returner) { return $returner.$v } throw $returner; } + }, TMP_Enumerable_find_index_42.$$arity = -1); + + Opal.def(self, '$first', TMP_Enumerable_first_45 = function $$first(number) {try { + + var TMP_46, TMP_47, self = this, result = nil, current = nil; + + + ; + if ($truthy(number === undefined)) { + return $send(self, 'each', [], (TMP_46 = function(value){var self = TMP_46.$$s || this; + + + + if (value == null) { + value = nil; + }; + Opal.ret(value);}, TMP_46.$$s = self, TMP_46.$$arity = 1, TMP_46)) + } else { + + result = []; + number = $$($nesting, 'Opal').$coerce_to(number, $$($nesting, 'Integer'), "to_int"); + if ($truthy(number < 0)) { + self.$raise($$($nesting, 'ArgumentError'), "attempt to take negative size")}; + if ($truthy(number == 0)) { + return []}; + current = 0; + $send(self, 'each', [], (TMP_47 = function($a){var self = TMP_47.$$s || this, $post_args, args; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + result.push($$($nesting, 'Opal').$destructure(args)); + if ($truthy(number <= ++current)) { + Opal.ret(result) + } else { + return nil + };}, TMP_47.$$s = self, TMP_47.$$arity = -1, TMP_47)); + return result; + }; + } catch ($returner) { if ($returner === Opal.returner) { return $returner.$v } throw $returner; } + }, TMP_Enumerable_first_45.$$arity = -1); + Opal.alias(self, "flat_map", "collect_concat"); + + Opal.def(self, '$grep', TMP_Enumerable_grep_48 = function $$grep(pattern) { + var $iter = TMP_Enumerable_grep_48.$$p, block = $iter || nil, TMP_49, self = this, result = nil; + + if ($iter) TMP_Enumerable_grep_48.$$p = null; + + + if ($iter) TMP_Enumerable_grep_48.$$p = null;; + result = []; + $send(self, 'each', [], (TMP_49 = function($a){var self = TMP_49.$$s || this, $post_args, value, cmp = nil; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + value = $post_args;; + cmp = comparableForPattern(value); + if ($truthy($send(pattern, '__send__', ["==="].concat(Opal.to_a(cmp))))) { + } else { + return nil; + }; + if ((block !== nil)) { + + if ($truthy($rb_gt(value.$length(), 1))) { + value = [value]}; + value = Opal.yieldX(block, Opal.to_a(value)); + } else if ($truthy($rb_le(value.$length(), 1))) { + value = value['$[]'](0)}; + return result.$push(value);}, TMP_49.$$s = self, TMP_49.$$arity = -1, TMP_49)); + return result; + }, TMP_Enumerable_grep_48.$$arity = 1); + + Opal.def(self, '$grep_v', TMP_Enumerable_grep_v_50 = function $$grep_v(pattern) { + var $iter = TMP_Enumerable_grep_v_50.$$p, block = $iter || nil, TMP_51, self = this, result = nil; + + if ($iter) TMP_Enumerable_grep_v_50.$$p = null; + + + if ($iter) TMP_Enumerable_grep_v_50.$$p = null;; + result = []; + $send(self, 'each', [], (TMP_51 = function($a){var self = TMP_51.$$s || this, $post_args, value, cmp = nil; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + value = $post_args;; + cmp = comparableForPattern(value); + if ($truthy($send(pattern, '__send__', ["==="].concat(Opal.to_a(cmp))))) { + return nil;}; + if ((block !== nil)) { + + if ($truthy($rb_gt(value.$length(), 1))) { + value = [value]}; + value = Opal.yieldX(block, Opal.to_a(value)); + } else if ($truthy($rb_le(value.$length(), 1))) { + value = value['$[]'](0)}; + return result.$push(value);}, TMP_51.$$s = self, TMP_51.$$arity = -1, TMP_51)); + return result; + }, TMP_Enumerable_grep_v_50.$$arity = 1); + + Opal.def(self, '$group_by', TMP_Enumerable_group_by_52 = function $$group_by() { + var $iter = TMP_Enumerable_group_by_52.$$p, block = $iter || nil, TMP_53, $a, self = this, hash = nil, $writer = nil; + + if ($iter) TMP_Enumerable_group_by_52.$$p = null; + + + if ($iter) TMP_Enumerable_group_by_52.$$p = null;; + if ((block !== nil)) { + } else { + return $send(self, 'enum_for', ["group_by"], (TMP_53 = function(){var self = TMP_53.$$s || this; + + return self.$enumerator_size()}, TMP_53.$$s = self, TMP_53.$$arity = 0, TMP_53)) + }; + hash = $hash2([], {}); + + var result; + + self.$each.$$p = function() { + var param = $$($nesting, 'Opal').$destructure(arguments), + value = Opal.yield1(block, param); + + ($truthy($a = hash['$[]'](value)) ? $a : (($writer = [value, []]), $send(hash, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]))['$<<'](param); + } + + self.$each(); + + if (result !== undefined) { + return result; + } + ; + return hash; + }, TMP_Enumerable_group_by_52.$$arity = 0); + + Opal.def(self, '$include?', TMP_Enumerable_include$q_54 = function(obj) {try { + + var TMP_55, self = this; + + + $send(self, 'each', [], (TMP_55 = function($a){var self = TMP_55.$$s || this, $post_args, args; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + if ($$($nesting, 'Opal').$destructure(args)['$=='](obj)) { + Opal.ret(true) + } else { + return nil + };}, TMP_55.$$s = self, TMP_55.$$arity = -1, TMP_55)); + return false; + } catch ($returner) { if ($returner === Opal.returner) { return $returner.$v } throw $returner; } + }, TMP_Enumerable_include$q_54.$$arity = 1); + + Opal.def(self, '$inject', TMP_Enumerable_inject_56 = function $$inject(object, sym) { + var $iter = TMP_Enumerable_inject_56.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Enumerable_inject_56.$$p = null; + + + if ($iter) TMP_Enumerable_inject_56.$$p = null;; + ; + ; + + var result = object; + + if (block !== nil && sym === undefined) { + self.$each.$$p = function() { + var value = $$($nesting, 'Opal').$destructure(arguments); + + if (result === undefined) { + result = value; + return; + } + + value = Opal.yieldX(block, [result, value]); + + result = value; + }; + } + else { + if (sym === undefined) { + if (!$$($nesting, 'Symbol')['$==='](object)) { + self.$raise($$($nesting, 'TypeError'), "" + (object.$inspect()) + " is not a Symbol"); + } + + sym = object; + result = undefined; + } + + self.$each.$$p = function() { + var value = $$($nesting, 'Opal').$destructure(arguments); + + if (result === undefined) { + result = value; + return; + } + + result = (result).$__send__(sym, value); + }; + } + + self.$each(); + + return result == undefined ? nil : result; + ; + }, TMP_Enumerable_inject_56.$$arity = -1); + + Opal.def(self, '$lazy', TMP_Enumerable_lazy_57 = function $$lazy() { + var TMP_58, self = this; + + return $send($$$($$($nesting, 'Enumerator'), 'Lazy'), 'new', [self, self.$enumerator_size()], (TMP_58 = function(enum$, $a){var self = TMP_58.$$s || this, $post_args, args; + + + + if (enum$ == null) { + enum$ = nil; + }; + + $post_args = Opal.slice.call(arguments, 1, arguments.length); + + args = $post_args;; + return $send(enum$, 'yield', Opal.to_a(args));}, TMP_58.$$s = self, TMP_58.$$arity = -2, TMP_58)) + }, TMP_Enumerable_lazy_57.$$arity = 0); + + Opal.def(self, '$enumerator_size', TMP_Enumerable_enumerator_size_59 = function $$enumerator_size() { + var self = this; + + if ($truthy(self['$respond_to?']("size"))) { + return self.$size() + } else { + return nil + } + }, TMP_Enumerable_enumerator_size_59.$$arity = 0); + Opal.alias(self, "map", "collect"); + + Opal.def(self, '$max', TMP_Enumerable_max_60 = function $$max(n) { + var $iter = TMP_Enumerable_max_60.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Enumerable_max_60.$$p = null; + + + if ($iter) TMP_Enumerable_max_60.$$p = null;; + ; + + if (n === undefined || n === nil) { + var result, value; + + self.$each.$$p = function() { + var item = $$($nesting, 'Opal').$destructure(arguments); + + if (result === undefined) { + result = item; + return; + } + + if (block !== nil) { + value = Opal.yieldX(block, [item, result]); + } else { + value = (item)['$<=>'](result); + } + + if (value === nil) { + self.$raise($$($nesting, 'ArgumentError'), "comparison failed"); + } + + if (value > 0) { + result = item; + } + } + + self.$each(); + + if (result === undefined) { + return nil; + } else { + return result; + } + } + ; + n = $$($nesting, 'Opal').$coerce_to(n, $$($nesting, 'Integer'), "to_int"); + return $send(self, 'sort', [], block.$to_proc()).$reverse().$first(n); + }, TMP_Enumerable_max_60.$$arity = -1); + + Opal.def(self, '$max_by', TMP_Enumerable_max_by_61 = function $$max_by() { + var $iter = TMP_Enumerable_max_by_61.$$p, block = $iter || nil, TMP_62, self = this; + + if ($iter) TMP_Enumerable_max_by_61.$$p = null; + + + if ($iter) TMP_Enumerable_max_by_61.$$p = null;; + if ($truthy(block)) { + } else { + return $send(self, 'enum_for', ["max_by"], (TMP_62 = function(){var self = TMP_62.$$s || this; + + return self.$enumerator_size()}, TMP_62.$$s = self, TMP_62.$$arity = 0, TMP_62)) + }; + + var result, + by; + + self.$each.$$p = function() { + var param = $$($nesting, 'Opal').$destructure(arguments), + value = Opal.yield1(block, param); + + if (result === undefined) { + result = param; + by = value; + return; + } + + if ((value)['$<=>'](by) > 0) { + result = param + by = value; + } + }; + + self.$each(); + + return result === undefined ? nil : result; + ; + }, TMP_Enumerable_max_by_61.$$arity = 0); + Opal.alias(self, "member?", "include?"); + + Opal.def(self, '$min', TMP_Enumerable_min_63 = function $$min() { + var $iter = TMP_Enumerable_min_63.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Enumerable_min_63.$$p = null; + + + if ($iter) TMP_Enumerable_min_63.$$p = null;; + + var result; + + if (block !== nil) { + self.$each.$$p = function() { + var param = $$($nesting, 'Opal').$destructure(arguments); + + if (result === undefined) { + result = param; + return; + } + + var value = block(param, result); + + if (value === nil) { + self.$raise($$($nesting, 'ArgumentError'), "comparison failed"); + } + + if (value < 0) { + result = param; + } + }; + } + else { + self.$each.$$p = function() { + var param = $$($nesting, 'Opal').$destructure(arguments); + + if (result === undefined) { + result = param; + return; + } + + if ($$($nesting, 'Opal').$compare(param, result) < 0) { + result = param; + } + }; + } + + self.$each(); + + return result === undefined ? nil : result; + ; + }, TMP_Enumerable_min_63.$$arity = 0); + + Opal.def(self, '$min_by', TMP_Enumerable_min_by_64 = function $$min_by() { + var $iter = TMP_Enumerable_min_by_64.$$p, block = $iter || nil, TMP_65, self = this; + + if ($iter) TMP_Enumerable_min_by_64.$$p = null; + + + if ($iter) TMP_Enumerable_min_by_64.$$p = null;; + if ($truthy(block)) { + } else { + return $send(self, 'enum_for', ["min_by"], (TMP_65 = function(){var self = TMP_65.$$s || this; + + return self.$enumerator_size()}, TMP_65.$$s = self, TMP_65.$$arity = 0, TMP_65)) + }; + + var result, + by; + + self.$each.$$p = function() { + var param = $$($nesting, 'Opal').$destructure(arguments), + value = Opal.yield1(block, param); + + if (result === undefined) { + result = param; + by = value; + return; + } + + if ((value)['$<=>'](by) < 0) { + result = param + by = value; + } + }; + + self.$each(); + + return result === undefined ? nil : result; + ; + }, TMP_Enumerable_min_by_64.$$arity = 0); + + Opal.def(self, '$minmax', TMP_Enumerable_minmax_66 = function $$minmax() { + var $iter = TMP_Enumerable_minmax_66.$$p, block = $iter || nil, $a, TMP_67, self = this; + + if ($iter) TMP_Enumerable_minmax_66.$$p = null; + + + if ($iter) TMP_Enumerable_minmax_66.$$p = null;; + block = ($truthy($a = block) ? $a : $send(self, 'proc', [], (TMP_67 = function(a, b){var self = TMP_67.$$s || this; + + + + if (a == null) { + a = nil; + }; + + if (b == null) { + b = nil; + }; + return a['$<=>'](b);}, TMP_67.$$s = self, TMP_67.$$arity = 2, TMP_67))); + + var min = nil, max = nil, first_time = true; + + self.$each.$$p = function() { + var element = $$($nesting, 'Opal').$destructure(arguments); + if (first_time) { + min = max = element; + first_time = false; + } else { + var min_cmp = block.$call(min, element); + + if (min_cmp === nil) { + self.$raise($$($nesting, 'ArgumentError'), "comparison failed") + } else if (min_cmp > 0) { + min = element; + } + + var max_cmp = block.$call(max, element); + + if (max_cmp === nil) { + self.$raise($$($nesting, 'ArgumentError'), "comparison failed") + } else if (max_cmp < 0) { + max = element; + } + } + } + + self.$each(); + + return [min, max]; + ; + }, TMP_Enumerable_minmax_66.$$arity = 0); + + Opal.def(self, '$minmax_by', TMP_Enumerable_minmax_by_68 = function $$minmax_by() { + var $iter = TMP_Enumerable_minmax_by_68.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Enumerable_minmax_by_68.$$p = null; + + + if ($iter) TMP_Enumerable_minmax_by_68.$$p = null;; + return self.$raise($$($nesting, 'NotImplementedError')); + }, TMP_Enumerable_minmax_by_68.$$arity = 0); + + Opal.def(self, '$none?', TMP_Enumerable_none$q_69 = function(pattern) {try { + + var $iter = TMP_Enumerable_none$q_69.$$p, block = $iter || nil, TMP_70, TMP_71, TMP_72, self = this; + + if ($iter) TMP_Enumerable_none$q_69.$$p = null; + + + if ($iter) TMP_Enumerable_none$q_69.$$p = null;; + ; + if ($truthy(pattern !== undefined)) { + $send(self, 'each', [], (TMP_70 = function($a){var self = TMP_70.$$s || this, $post_args, value, comparable = nil; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + value = $post_args;; + comparable = comparableForPattern(value); + if ($truthy($send(pattern, 'public_send', ["==="].concat(Opal.to_a(comparable))))) { + Opal.ret(false) + } else { + return nil + };}, TMP_70.$$s = self, TMP_70.$$arity = -1, TMP_70)) + } else if ((block !== nil)) { + $send(self, 'each', [], (TMP_71 = function($a){var self = TMP_71.$$s || this, $post_args, value; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + value = $post_args;; + if ($truthy(Opal.yieldX(block, Opal.to_a(value)))) { + Opal.ret(false) + } else { + return nil + };}, TMP_71.$$s = self, TMP_71.$$arity = -1, TMP_71)) + } else { + $send(self, 'each', [], (TMP_72 = function($a){var self = TMP_72.$$s || this, $post_args, value, item = nil; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + value = $post_args;; + item = $$($nesting, 'Opal').$destructure(value); + if ($truthy(item)) { + Opal.ret(false) + } else { + return nil + };}, TMP_72.$$s = self, TMP_72.$$arity = -1, TMP_72)) + }; + return true; + } catch ($returner) { if ($returner === Opal.returner) { return $returner.$v } throw $returner; } + }, TMP_Enumerable_none$q_69.$$arity = -1); + + Opal.def(self, '$one?', TMP_Enumerable_one$q_73 = function(pattern) {try { + + var $iter = TMP_Enumerable_one$q_73.$$p, block = $iter || nil, TMP_74, TMP_75, TMP_76, self = this, count = nil; + + if ($iter) TMP_Enumerable_one$q_73.$$p = null; + + + if ($iter) TMP_Enumerable_one$q_73.$$p = null;; + ; + count = 0; + if ($truthy(pattern !== undefined)) { + $send(self, 'each', [], (TMP_74 = function($a){var self = TMP_74.$$s || this, $post_args, value, comparable = nil; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + value = $post_args;; + comparable = comparableForPattern(value); + if ($truthy($send(pattern, 'public_send', ["==="].concat(Opal.to_a(comparable))))) { + + count = $rb_plus(count, 1); + if ($truthy($rb_gt(count, 1))) { + Opal.ret(false) + } else { + return nil + }; + } else { + return nil + };}, TMP_74.$$s = self, TMP_74.$$arity = -1, TMP_74)) + } else if ((block !== nil)) { + $send(self, 'each', [], (TMP_75 = function($a){var self = TMP_75.$$s || this, $post_args, value; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + value = $post_args;; + if ($truthy(Opal.yieldX(block, Opal.to_a(value)))) { + } else { + return nil; + }; + count = $rb_plus(count, 1); + if ($truthy($rb_gt(count, 1))) { + Opal.ret(false) + } else { + return nil + };}, TMP_75.$$s = self, TMP_75.$$arity = -1, TMP_75)) + } else { + $send(self, 'each', [], (TMP_76 = function($a){var self = TMP_76.$$s || this, $post_args, value; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + value = $post_args;; + if ($truthy($$($nesting, 'Opal').$destructure(value))) { + } else { + return nil; + }; + count = $rb_plus(count, 1); + if ($truthy($rb_gt(count, 1))) { + Opal.ret(false) + } else { + return nil + };}, TMP_76.$$s = self, TMP_76.$$arity = -1, TMP_76)) + }; + return count['$=='](1); + } catch ($returner) { if ($returner === Opal.returner) { return $returner.$v } throw $returner; } + }, TMP_Enumerable_one$q_73.$$arity = -1); + + Opal.def(self, '$partition', TMP_Enumerable_partition_77 = function $$partition() { + var $iter = TMP_Enumerable_partition_77.$$p, block = $iter || nil, TMP_78, self = this; + + if ($iter) TMP_Enumerable_partition_77.$$p = null; + + + if ($iter) TMP_Enumerable_partition_77.$$p = null;; + if ((block !== nil)) { + } else { + return $send(self, 'enum_for', ["partition"], (TMP_78 = function(){var self = TMP_78.$$s || this; + + return self.$enumerator_size()}, TMP_78.$$s = self, TMP_78.$$arity = 0, TMP_78)) + }; + + var truthy = [], falsy = [], result; + + self.$each.$$p = function() { + var param = $$($nesting, 'Opal').$destructure(arguments), + value = Opal.yield1(block, param); + + if ($truthy(value)) { + truthy.push(param); + } + else { + falsy.push(param); + } + }; + + self.$each(); + + return [truthy, falsy]; + ; + }, TMP_Enumerable_partition_77.$$arity = 0); + Opal.alias(self, "reduce", "inject"); + + Opal.def(self, '$reject', TMP_Enumerable_reject_79 = function $$reject() { + var $iter = TMP_Enumerable_reject_79.$$p, block = $iter || nil, TMP_80, self = this; + + if ($iter) TMP_Enumerable_reject_79.$$p = null; + + + if ($iter) TMP_Enumerable_reject_79.$$p = null;; + if ((block !== nil)) { + } else { + return $send(self, 'enum_for', ["reject"], (TMP_80 = function(){var self = TMP_80.$$s || this; + + return self.$enumerator_size()}, TMP_80.$$s = self, TMP_80.$$arity = 0, TMP_80)) + }; + + var result = []; + + self.$each.$$p = function() { + var param = $$($nesting, 'Opal').$destructure(arguments), + value = Opal.yield1(block, param); + + if ($falsy(value)) { + result.push(param); + } + }; + + self.$each(); + + return result; + ; + }, TMP_Enumerable_reject_79.$$arity = 0); + + Opal.def(self, '$reverse_each', TMP_Enumerable_reverse_each_81 = function $$reverse_each() { + var $iter = TMP_Enumerable_reverse_each_81.$$p, block = $iter || nil, TMP_82, self = this; + + if ($iter) TMP_Enumerable_reverse_each_81.$$p = null; + + + if ($iter) TMP_Enumerable_reverse_each_81.$$p = null;; + if ((block !== nil)) { + } else { + return $send(self, 'enum_for', ["reverse_each"], (TMP_82 = function(){var self = TMP_82.$$s || this; + + return self.$enumerator_size()}, TMP_82.$$s = self, TMP_82.$$arity = 0, TMP_82)) + }; + + var result = []; + + self.$each.$$p = function() { + result.push(arguments); + }; + + self.$each(); + + for (var i = result.length - 1; i >= 0; i--) { + Opal.yieldX(block, result[i]); + } + + return result; + ; + }, TMP_Enumerable_reverse_each_81.$$arity = 0); + Opal.alias(self, "select", "find_all"); + + Opal.def(self, '$slice_before', TMP_Enumerable_slice_before_83 = function $$slice_before(pattern) { + var $iter = TMP_Enumerable_slice_before_83.$$p, block = $iter || nil, TMP_84, self = this; + + if ($iter) TMP_Enumerable_slice_before_83.$$p = null; + + + if ($iter) TMP_Enumerable_slice_before_83.$$p = null;; + ; + if ($truthy(pattern === undefined && block === nil)) { + self.$raise($$($nesting, 'ArgumentError'), "both pattern and block are given")}; + if ($truthy(pattern !== undefined && block !== nil || arguments.length > 1)) { + self.$raise($$($nesting, 'ArgumentError'), "" + "wrong number of arguments (" + (arguments.length) + " expected 1)")}; + return $send($$($nesting, 'Enumerator'), 'new', [], (TMP_84 = function(e){var self = TMP_84.$$s || this; + + + + if (e == null) { + e = nil; + }; + + var slice = []; + + if (block !== nil) { + if (pattern === undefined) { + self.$each.$$p = function() { + var param = $$($nesting, 'Opal').$destructure(arguments), + value = Opal.yield1(block, param); + + if ($truthy(value) && slice.length > 0) { + e['$<<'](slice); + slice = []; + } + + slice.push(param); + }; + } + else { + self.$each.$$p = function() { + var param = $$($nesting, 'Opal').$destructure(arguments), + value = block(param, pattern.$dup()); + + if ($truthy(value) && slice.length > 0) { + e['$<<'](slice); + slice = []; + } + + slice.push(param); + }; + } + } + else { + self.$each.$$p = function() { + var param = $$($nesting, 'Opal').$destructure(arguments), + value = pattern['$==='](param); + + if ($truthy(value) && slice.length > 0) { + e['$<<'](slice); + slice = []; + } + + slice.push(param); + }; + } + + self.$each(); + + if (slice.length > 0) { + e['$<<'](slice); + } + ;}, TMP_84.$$s = self, TMP_84.$$arity = 1, TMP_84)); + }, TMP_Enumerable_slice_before_83.$$arity = -1); + + Opal.def(self, '$slice_after', TMP_Enumerable_slice_after_85 = function $$slice_after(pattern) { + var $iter = TMP_Enumerable_slice_after_85.$$p, block = $iter || nil, TMP_86, TMP_87, self = this; + + if ($iter) TMP_Enumerable_slice_after_85.$$p = null; + + + if ($iter) TMP_Enumerable_slice_after_85.$$p = null;; + ; + if ($truthy(pattern === undefined && block === nil)) { + self.$raise($$($nesting, 'ArgumentError'), "both pattern and block are given")}; + if ($truthy(pattern !== undefined && block !== nil || arguments.length > 1)) { + self.$raise($$($nesting, 'ArgumentError'), "" + "wrong number of arguments (" + (arguments.length) + " expected 1)")}; + if ($truthy(pattern !== undefined)) { + block = $send(self, 'proc', [], (TMP_86 = function(e){var self = TMP_86.$$s || this; + + + + if (e == null) { + e = nil; + }; + return pattern['$==='](e);}, TMP_86.$$s = self, TMP_86.$$arity = 1, TMP_86))}; + return $send($$($nesting, 'Enumerator'), 'new', [], (TMP_87 = function(yielder){var self = TMP_87.$$s || this; + + + + if (yielder == null) { + yielder = nil; + }; + + var accumulate; + + self.$each.$$p = function() { + var element = $$($nesting, 'Opal').$destructure(arguments), + end_chunk = Opal.yield1(block, element); + + if (accumulate == null) { + accumulate = []; + } + + if ($truthy(end_chunk)) { + accumulate.push(element); + yielder.$yield(accumulate); + accumulate = null; + } else { + accumulate.push(element) + } + } + + self.$each(); + + if (accumulate != null) { + yielder.$yield(accumulate); + } + ;}, TMP_87.$$s = self, TMP_87.$$arity = 1, TMP_87)); + }, TMP_Enumerable_slice_after_85.$$arity = -1); + + Opal.def(self, '$slice_when', TMP_Enumerable_slice_when_88 = function $$slice_when() { + var $iter = TMP_Enumerable_slice_when_88.$$p, block = $iter || nil, TMP_89, self = this; + + if ($iter) TMP_Enumerable_slice_when_88.$$p = null; + + + if ($iter) TMP_Enumerable_slice_when_88.$$p = null;; + if ((block !== nil)) { + } else { + self.$raise($$($nesting, 'ArgumentError'), "wrong number of arguments (0 for 1)") + }; + return $send($$($nesting, 'Enumerator'), 'new', [], (TMP_89 = function(yielder){var self = TMP_89.$$s || this; + + + + if (yielder == null) { + yielder = nil; + }; + + var slice = nil, last_after = nil; + + self.$each_cons.$$p = function() { + var params = $$($nesting, 'Opal').$destructure(arguments), + before = params[0], + after = params[1], + match = Opal.yieldX(block, [before, after]); + + last_after = after; + + if (slice === nil) { + slice = []; + } + + if ($truthy(match)) { + slice.push(before); + yielder.$yield(slice); + slice = []; + } else { + slice.push(before); + } + } + + self.$each_cons(2); + + if (slice !== nil) { + slice.push(last_after); + yielder.$yield(slice); + } + ;}, TMP_89.$$s = self, TMP_89.$$arity = 1, TMP_89)); + }, TMP_Enumerable_slice_when_88.$$arity = 0); + + Opal.def(self, '$sort', TMP_Enumerable_sort_90 = function $$sort() { + var $iter = TMP_Enumerable_sort_90.$$p, block = $iter || nil, TMP_91, self = this, ary = nil; + + if ($iter) TMP_Enumerable_sort_90.$$p = null; + + + if ($iter) TMP_Enumerable_sort_90.$$p = null;; + ary = self.$to_a(); + if ((block !== nil)) { + } else { + block = $lambda((TMP_91 = function(a, b){var self = TMP_91.$$s || this; + + + + if (a == null) { + a = nil; + }; + + if (b == null) { + b = nil; + }; + return a['$<=>'](b);}, TMP_91.$$s = self, TMP_91.$$arity = 2, TMP_91)) + }; + return $send(ary, 'sort', [], block.$to_proc()); + }, TMP_Enumerable_sort_90.$$arity = 0); + + Opal.def(self, '$sort_by', TMP_Enumerable_sort_by_92 = function $$sort_by() { + var $iter = TMP_Enumerable_sort_by_92.$$p, block = $iter || nil, TMP_93, TMP_94, TMP_95, TMP_96, self = this, dup = nil; + + if ($iter) TMP_Enumerable_sort_by_92.$$p = null; + + + if ($iter) TMP_Enumerable_sort_by_92.$$p = null;; + if ((block !== nil)) { + } else { + return $send(self, 'enum_for', ["sort_by"], (TMP_93 = function(){var self = TMP_93.$$s || this; + + return self.$enumerator_size()}, TMP_93.$$s = self, TMP_93.$$arity = 0, TMP_93)) + }; + dup = $send(self, 'map', [], (TMP_94 = function(){var self = TMP_94.$$s || this, arg = nil; + + + arg = $$($nesting, 'Opal').$destructure(arguments); + return [Opal.yield1(block, arg), arg];}, TMP_94.$$s = self, TMP_94.$$arity = 0, TMP_94)); + $send(dup, 'sort!', [], (TMP_95 = function(a, b){var self = TMP_95.$$s || this; + + + + if (a == null) { + a = nil; + }; + + if (b == null) { + b = nil; + }; + return (a[0])['$<=>'](b[0]);}, TMP_95.$$s = self, TMP_95.$$arity = 2, TMP_95)); + return $send(dup, 'map!', [], (TMP_96 = function(i){var self = TMP_96.$$s || this; + + + + if (i == null) { + i = nil; + }; + return i[1];;}, TMP_96.$$s = self, TMP_96.$$arity = 1, TMP_96)); + }, TMP_Enumerable_sort_by_92.$$arity = 0); + + Opal.def(self, '$sum', TMP_Enumerable_sum_97 = function $$sum(initial) { + var TMP_98, $iter = TMP_Enumerable_sum_97.$$p, $yield = $iter || nil, self = this, result = nil; + + if ($iter) TMP_Enumerable_sum_97.$$p = null; + + + if (initial == null) { + initial = 0; + }; + result = initial; + $send(self, 'each', [], (TMP_98 = function($a){var self = TMP_98.$$s || this, $post_args, args, item = nil; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + item = (function() {if (($yield !== nil)) { + return Opal.yieldX($yield, Opal.to_a(args)); + } else { + return $$($nesting, 'Opal').$destructure(args) + }; return nil; })(); + return (result = $rb_plus(result, item));}, TMP_98.$$s = self, TMP_98.$$arity = -1, TMP_98)); + return result; + }, TMP_Enumerable_sum_97.$$arity = -1); + + Opal.def(self, '$take', TMP_Enumerable_take_99 = function $$take(num) { + var self = this; + + return self.$first(num) + }, TMP_Enumerable_take_99.$$arity = 1); + + Opal.def(self, '$take_while', TMP_Enumerable_take_while_100 = function $$take_while() {try { + + var $iter = TMP_Enumerable_take_while_100.$$p, block = $iter || nil, TMP_101, self = this, result = nil; + + if ($iter) TMP_Enumerable_take_while_100.$$p = null; + + + if ($iter) TMP_Enumerable_take_while_100.$$p = null;; + if ($truthy(block)) { + } else { + return self.$enum_for("take_while") + }; + result = []; + return $send(self, 'each', [], (TMP_101 = function($a){var self = TMP_101.$$s || this, $post_args, args, value = nil; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + value = $$($nesting, 'Opal').$destructure(args); + if ($truthy(Opal.yield1(block, value))) { + } else { + Opal.ret(result) + }; + return result.push(value);;}, TMP_101.$$s = self, TMP_101.$$arity = -1, TMP_101)); + } catch ($returner) { if ($returner === Opal.returner) { return $returner.$v } throw $returner; } + }, TMP_Enumerable_take_while_100.$$arity = 0); + + Opal.def(self, '$uniq', TMP_Enumerable_uniq_102 = function $$uniq() { + var $iter = TMP_Enumerable_uniq_102.$$p, block = $iter || nil, TMP_103, self = this, hash = nil; + + if ($iter) TMP_Enumerable_uniq_102.$$p = null; + + + if ($iter) TMP_Enumerable_uniq_102.$$p = null;; + hash = $hash2([], {}); + $send(self, 'each', [], (TMP_103 = function($a){var self = TMP_103.$$s || this, $post_args, args, value = nil, produced = nil, $writer = nil; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + value = $$($nesting, 'Opal').$destructure(args); + produced = (function() {if ((block !== nil)) { + return Opal.yield1(block, value); + } else { + return value + }; return nil; })(); + if ($truthy(hash['$key?'](produced))) { + return nil + } else { + + $writer = [produced, value]; + $send(hash, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + };}, TMP_103.$$s = self, TMP_103.$$arity = -1, TMP_103)); + return hash.$values(); + }, TMP_Enumerable_uniq_102.$$arity = 0); + Opal.alias(self, "to_a", "entries"); + + Opal.def(self, '$zip', TMP_Enumerable_zip_104 = function $$zip($a) { + var $iter = TMP_Enumerable_zip_104.$$p, block = $iter || nil, $post_args, others, self = this; + + if ($iter) TMP_Enumerable_zip_104.$$p = null; + + + if ($iter) TMP_Enumerable_zip_104.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + others = $post_args;; + return $send(self.$to_a(), 'zip', Opal.to_a(others)); + }, TMP_Enumerable_zip_104.$$arity = -1); + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/enumerator"] = function(Opal) { + function $rb_plus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); + } + function $rb_lt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $truthy = Opal.truthy, $send = Opal.send, $falsy = Opal.falsy; + + Opal.add_stubs(['$require', '$include', '$allocate', '$new', '$to_proc', '$coerce_to', '$nil?', '$empty?', '$+', '$class', '$__send__', '$===', '$call', '$enum_for', '$size', '$destructure', '$inspect', '$any?', '$[]', '$raise', '$yield', '$each', '$enumerator_size', '$respond_to?', '$try_convert', '$<', '$for']); + + self.$require("corelib/enumerable"); + return (function($base, $super, $parent_nesting) { + function $Enumerator(){}; + var self = $Enumerator = $klass($base, $super, 'Enumerator', $Enumerator); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Enumerator_for_1, TMP_Enumerator_initialize_2, TMP_Enumerator_each_3, TMP_Enumerator_size_4, TMP_Enumerator_with_index_5, TMP_Enumerator_inspect_7; + + def.size = def.args = def.object = def.method = nil; + + self.$include($$($nesting, 'Enumerable')); + def.$$is_enumerator = true; + Opal.defs(self, '$for', TMP_Enumerator_for_1 = function(object, $a, $b) { + var $iter = TMP_Enumerator_for_1.$$p, block = $iter || nil, $post_args, method, args, self = this; + + if ($iter) TMP_Enumerator_for_1.$$p = null; + + + if ($iter) TMP_Enumerator_for_1.$$p = null;; + + $post_args = Opal.slice.call(arguments, 1, arguments.length); + + if ($post_args.length > 0) { + method = $post_args[0]; + $post_args.splice(0, 1); + } + if (method == null) { + method = "each"; + }; + + args = $post_args;; + + var obj = self.$allocate(); + + obj.object = object; + obj.size = block; + obj.method = method; + obj.args = args; + + return obj; + ; + }, TMP_Enumerator_for_1.$$arity = -2); + + Opal.def(self, '$initialize', TMP_Enumerator_initialize_2 = function $$initialize($a) { + var $iter = TMP_Enumerator_initialize_2.$$p, block = $iter || nil, $post_args, self = this; + + if ($iter) TMP_Enumerator_initialize_2.$$p = null; + + + if ($iter) TMP_Enumerator_initialize_2.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + if ($truthy(block)) { + + self.object = $send($$($nesting, 'Generator'), 'new', [], block.$to_proc()); + self.method = "each"; + self.args = []; + self.size = arguments[0] || nil; + if ($truthy(self.size)) { + return (self.size = $$($nesting, 'Opal').$coerce_to(self.size, $$($nesting, 'Integer'), "to_int")) + } else { + return nil + }; + } else { + + self.object = arguments[0]; + self.method = arguments[1] || "each"; + self.args = $slice.call(arguments, 2); + return (self.size = nil); + }; + }, TMP_Enumerator_initialize_2.$$arity = -1); + + Opal.def(self, '$each', TMP_Enumerator_each_3 = function $$each($a) { + var $iter = TMP_Enumerator_each_3.$$p, block = $iter || nil, $post_args, args, $b, self = this; + + if ($iter) TMP_Enumerator_each_3.$$p = null; + + + if ($iter) TMP_Enumerator_each_3.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + if ($truthy(($truthy($b = block['$nil?']()) ? args['$empty?']() : $b))) { + return self}; + args = $rb_plus(self.args, args); + if ($truthy(block['$nil?']())) { + return $send(self.$class(), 'new', [self.object, self.method].concat(Opal.to_a(args)))}; + return $send(self.object, '__send__', [self.method].concat(Opal.to_a(args)), block.$to_proc()); + }, TMP_Enumerator_each_3.$$arity = -1); + + Opal.def(self, '$size', TMP_Enumerator_size_4 = function $$size() { + var self = this; + + if ($truthy($$($nesting, 'Proc')['$==='](self.size))) { + return $send(self.size, 'call', Opal.to_a(self.args)) + } else { + return self.size + } + }, TMP_Enumerator_size_4.$$arity = 0); + + Opal.def(self, '$with_index', TMP_Enumerator_with_index_5 = function $$with_index(offset) { + var $iter = TMP_Enumerator_with_index_5.$$p, block = $iter || nil, TMP_6, self = this; + + if ($iter) TMP_Enumerator_with_index_5.$$p = null; + + + if ($iter) TMP_Enumerator_with_index_5.$$p = null;; + + if (offset == null) { + offset = 0; + }; + offset = (function() {if ($truthy(offset)) { + return $$($nesting, 'Opal').$coerce_to(offset, $$($nesting, 'Integer'), "to_int") + } else { + return 0 + }; return nil; })(); + if ($truthy(block)) { + } else { + return $send(self, 'enum_for', ["with_index", offset], (TMP_6 = function(){var self = TMP_6.$$s || this; + + return self.$size()}, TMP_6.$$s = self, TMP_6.$$arity = 0, TMP_6)) + }; + + var result, index = offset; + + self.$each.$$p = function() { + var param = $$($nesting, 'Opal').$destructure(arguments), + value = block(param, index); + + index++; + + return value; + } + + return self.$each(); + ; + }, TMP_Enumerator_with_index_5.$$arity = -1); + Opal.alias(self, "with_object", "each_with_object"); + + Opal.def(self, '$inspect', TMP_Enumerator_inspect_7 = function $$inspect() { + var self = this, result = nil; + + + result = "" + "#<" + (self.$class()) + ": " + (self.object.$inspect()) + ":" + (self.method); + if ($truthy(self.args['$any?']())) { + result = $rb_plus(result, "" + "(" + (self.args.$inspect()['$[]']($$($nesting, 'Range').$new(1, -2))) + ")")}; + return $rb_plus(result, ">"); + }, TMP_Enumerator_inspect_7.$$arity = 0); + (function($base, $super, $parent_nesting) { + function $Generator(){}; + var self = $Generator = $klass($base, $super, 'Generator', $Generator); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Generator_initialize_8, TMP_Generator_each_9; + + def.block = nil; + + self.$include($$($nesting, 'Enumerable')); + + Opal.def(self, '$initialize', TMP_Generator_initialize_8 = function $$initialize() { + var $iter = TMP_Generator_initialize_8.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Generator_initialize_8.$$p = null; + + + if ($iter) TMP_Generator_initialize_8.$$p = null;; + if ($truthy(block)) { + } else { + self.$raise($$($nesting, 'LocalJumpError'), "no block given") + }; + return (self.block = block); + }, TMP_Generator_initialize_8.$$arity = 0); + return (Opal.def(self, '$each', TMP_Generator_each_9 = function $$each($a) { + var $iter = TMP_Generator_each_9.$$p, block = $iter || nil, $post_args, args, self = this, yielder = nil; + + if ($iter) TMP_Generator_each_9.$$p = null; + + + if ($iter) TMP_Generator_each_9.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + yielder = $send($$($nesting, 'Yielder'), 'new', [], block.$to_proc()); + + try { + args.unshift(yielder); + + Opal.yieldX(self.block, args); + } + catch (e) { + if (e === $breaker) { + return $breaker.$v; + } + else { + throw e; + } + } + ; + return self; + }, TMP_Generator_each_9.$$arity = -1), nil) && 'each'; + })($nesting[0], null, $nesting); + (function($base, $super, $parent_nesting) { + function $Yielder(){}; + var self = $Yielder = $klass($base, $super, 'Yielder', $Yielder); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Yielder_initialize_10, TMP_Yielder_yield_11, TMP_Yielder_$lt$lt_12; + + def.block = nil; + + + Opal.def(self, '$initialize', TMP_Yielder_initialize_10 = function $$initialize() { + var $iter = TMP_Yielder_initialize_10.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Yielder_initialize_10.$$p = null; + + + if ($iter) TMP_Yielder_initialize_10.$$p = null;; + return (self.block = block); + }, TMP_Yielder_initialize_10.$$arity = 0); + + Opal.def(self, '$yield', TMP_Yielder_yield_11 = function($a) { + var $post_args, values, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + values = $post_args;; + + var value = Opal.yieldX(self.block, values); + + if (value === $breaker) { + throw $breaker; + } + + return value; + ; + }, TMP_Yielder_yield_11.$$arity = -1); + return (Opal.def(self, '$<<', TMP_Yielder_$lt$lt_12 = function($a) { + var $post_args, values, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + values = $post_args;; + $send(self, 'yield', Opal.to_a(values)); + return self; + }, TMP_Yielder_$lt$lt_12.$$arity = -1), nil) && '<<'; + })($nesting[0], null, $nesting); + return (function($base, $super, $parent_nesting) { + function $Lazy(){}; + var self = $Lazy = $klass($base, $super, 'Lazy', $Lazy); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Lazy_initialize_13, TMP_Lazy_lazy_16, TMP_Lazy_collect_17, TMP_Lazy_collect_concat_19, TMP_Lazy_drop_23, TMP_Lazy_drop_while_25, TMP_Lazy_enum_for_27, TMP_Lazy_find_all_28, TMP_Lazy_grep_30, TMP_Lazy_reject_33, TMP_Lazy_take_35, TMP_Lazy_take_while_37, TMP_Lazy_inspect_39; + + def.enumerator = nil; + + (function($base, $super, $parent_nesting) { + function $StopLazyError(){}; + var self = $StopLazyError = $klass($base, $super, 'StopLazyError', $StopLazyError); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return nil + })($nesting[0], $$($nesting, 'Exception'), $nesting); + + Opal.def(self, '$initialize', TMP_Lazy_initialize_13 = function $$initialize(object, size) { + var $iter = TMP_Lazy_initialize_13.$$p, block = $iter || nil, TMP_14, self = this; + + if ($iter) TMP_Lazy_initialize_13.$$p = null; + + + if ($iter) TMP_Lazy_initialize_13.$$p = null;; + + if (size == null) { + size = nil; + }; + if ((block !== nil)) { + } else { + self.$raise($$($nesting, 'ArgumentError'), "tried to call lazy new without a block") + }; + self.enumerator = object; + return $send(self, Opal.find_super_dispatcher(self, 'initialize', TMP_Lazy_initialize_13, false), [size], (TMP_14 = function(yielder, $a){var self = TMP_14.$$s || this, $post_args, each_args, TMP_15; + + + + if (yielder == null) { + yielder = nil; + }; + + $post_args = Opal.slice.call(arguments, 1, arguments.length); + + each_args = $post_args;; + try { + return $send(object, 'each', Opal.to_a(each_args), (TMP_15 = function($b){var self = TMP_15.$$s || this, $post_args, args; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + + args.unshift(yielder); + + Opal.yieldX(block, args); + ;}, TMP_15.$$s = self, TMP_15.$$arity = -1, TMP_15)) + } catch ($err) { + if (Opal.rescue($err, [$$($nesting, 'Exception')])) { + try { + return nil + } finally { Opal.pop_exception() } + } else { throw $err; } + };}, TMP_14.$$s = self, TMP_14.$$arity = -2, TMP_14)); + }, TMP_Lazy_initialize_13.$$arity = -2); + Opal.alias(self, "force", "to_a"); + + Opal.def(self, '$lazy', TMP_Lazy_lazy_16 = function $$lazy() { + var self = this; + + return self + }, TMP_Lazy_lazy_16.$$arity = 0); + + Opal.def(self, '$collect', TMP_Lazy_collect_17 = function $$collect() { + var $iter = TMP_Lazy_collect_17.$$p, block = $iter || nil, TMP_18, self = this; + + if ($iter) TMP_Lazy_collect_17.$$p = null; + + + if ($iter) TMP_Lazy_collect_17.$$p = null;; + if ($truthy(block)) { + } else { + self.$raise($$($nesting, 'ArgumentError'), "tried to call lazy map without a block") + }; + return $send($$($nesting, 'Lazy'), 'new', [self, self.$enumerator_size()], (TMP_18 = function(enum$, $a){var self = TMP_18.$$s || this, $post_args, args; + + + + if (enum$ == null) { + enum$ = nil; + }; + + $post_args = Opal.slice.call(arguments, 1, arguments.length); + + args = $post_args;; + + var value = Opal.yieldX(block, args); + + enum$.$yield(value); + ;}, TMP_18.$$s = self, TMP_18.$$arity = -2, TMP_18)); + }, TMP_Lazy_collect_17.$$arity = 0); + + Opal.def(self, '$collect_concat', TMP_Lazy_collect_concat_19 = function $$collect_concat() { + var $iter = TMP_Lazy_collect_concat_19.$$p, block = $iter || nil, TMP_20, self = this; + + if ($iter) TMP_Lazy_collect_concat_19.$$p = null; + + + if ($iter) TMP_Lazy_collect_concat_19.$$p = null;; + if ($truthy(block)) { + } else { + self.$raise($$($nesting, 'ArgumentError'), "tried to call lazy map without a block") + }; + return $send($$($nesting, 'Lazy'), 'new', [self, nil], (TMP_20 = function(enum$, $a){var self = TMP_20.$$s || this, $post_args, args, TMP_21, TMP_22; + + + + if (enum$ == null) { + enum$ = nil; + }; + + $post_args = Opal.slice.call(arguments, 1, arguments.length); + + args = $post_args;; + + var value = Opal.yieldX(block, args); + + if ((value)['$respond_to?']("force") && (value)['$respond_to?']("each")) { + $send((value), 'each', [], (TMP_21 = function(v){var self = TMP_21.$$s || this; + + + + if (v == null) { + v = nil; + }; + return enum$.$yield(v);}, TMP_21.$$s = self, TMP_21.$$arity = 1, TMP_21)) + } + else { + var array = $$($nesting, 'Opal').$try_convert(value, $$($nesting, 'Array'), "to_ary"); + + if (array === nil) { + enum$.$yield(value); + } + else { + $send((value), 'each', [], (TMP_22 = function(v){var self = TMP_22.$$s || this; + + + + if (v == null) { + v = nil; + }; + return enum$.$yield(v);}, TMP_22.$$s = self, TMP_22.$$arity = 1, TMP_22)); + } + } + ;}, TMP_20.$$s = self, TMP_20.$$arity = -2, TMP_20)); + }, TMP_Lazy_collect_concat_19.$$arity = 0); + + Opal.def(self, '$drop', TMP_Lazy_drop_23 = function $$drop(n) { + var TMP_24, self = this, current_size = nil, set_size = nil, dropped = nil; + + + n = $$($nesting, 'Opal').$coerce_to(n, $$($nesting, 'Integer'), "to_int"); + if ($truthy($rb_lt(n, 0))) { + self.$raise($$($nesting, 'ArgumentError'), "attempt to drop negative size")}; + current_size = self.$enumerator_size(); + set_size = (function() {if ($truthy($$($nesting, 'Integer')['$==='](current_size))) { + if ($truthy($rb_lt(n, current_size))) { + return n + } else { + return current_size + } + } else { + return current_size + }; return nil; })(); + dropped = 0; + return $send($$($nesting, 'Lazy'), 'new', [self, set_size], (TMP_24 = function(enum$, $a){var self = TMP_24.$$s || this, $post_args, args; + + + + if (enum$ == null) { + enum$ = nil; + }; + + $post_args = Opal.slice.call(arguments, 1, arguments.length); + + args = $post_args;; + if ($truthy($rb_lt(dropped, n))) { + return (dropped = $rb_plus(dropped, 1)) + } else { + return $send(enum$, 'yield', Opal.to_a(args)) + };}, TMP_24.$$s = self, TMP_24.$$arity = -2, TMP_24)); + }, TMP_Lazy_drop_23.$$arity = 1); + + Opal.def(self, '$drop_while', TMP_Lazy_drop_while_25 = function $$drop_while() { + var $iter = TMP_Lazy_drop_while_25.$$p, block = $iter || nil, TMP_26, self = this, succeeding = nil; + + if ($iter) TMP_Lazy_drop_while_25.$$p = null; + + + if ($iter) TMP_Lazy_drop_while_25.$$p = null;; + if ($truthy(block)) { + } else { + self.$raise($$($nesting, 'ArgumentError'), "tried to call lazy drop_while without a block") + }; + succeeding = true; + return $send($$($nesting, 'Lazy'), 'new', [self, nil], (TMP_26 = function(enum$, $a){var self = TMP_26.$$s || this, $post_args, args; + + + + if (enum$ == null) { + enum$ = nil; + }; + + $post_args = Opal.slice.call(arguments, 1, arguments.length); + + args = $post_args;; + if ($truthy(succeeding)) { + + var value = Opal.yieldX(block, args); + + if ($falsy(value)) { + succeeding = false; + + $send(enum$, 'yield', Opal.to_a(args)); + } + + } else { + return $send(enum$, 'yield', Opal.to_a(args)) + };}, TMP_26.$$s = self, TMP_26.$$arity = -2, TMP_26)); + }, TMP_Lazy_drop_while_25.$$arity = 0); + + Opal.def(self, '$enum_for', TMP_Lazy_enum_for_27 = function $$enum_for($a, $b) { + var $iter = TMP_Lazy_enum_for_27.$$p, block = $iter || nil, $post_args, method, args, self = this; + + if ($iter) TMP_Lazy_enum_for_27.$$p = null; + + + if ($iter) TMP_Lazy_enum_for_27.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + if ($post_args.length > 0) { + method = $post_args[0]; + $post_args.splice(0, 1); + } + if (method == null) { + method = "each"; + }; + + args = $post_args;; + return $send(self.$class(), 'for', [self, method].concat(Opal.to_a(args)), block.$to_proc()); + }, TMP_Lazy_enum_for_27.$$arity = -1); + + Opal.def(self, '$find_all', TMP_Lazy_find_all_28 = function $$find_all() { + var $iter = TMP_Lazy_find_all_28.$$p, block = $iter || nil, TMP_29, self = this; + + if ($iter) TMP_Lazy_find_all_28.$$p = null; + + + if ($iter) TMP_Lazy_find_all_28.$$p = null;; + if ($truthy(block)) { + } else { + self.$raise($$($nesting, 'ArgumentError'), "tried to call lazy select without a block") + }; + return $send($$($nesting, 'Lazy'), 'new', [self, nil], (TMP_29 = function(enum$, $a){var self = TMP_29.$$s || this, $post_args, args; + + + + if (enum$ == null) { + enum$ = nil; + }; + + $post_args = Opal.slice.call(arguments, 1, arguments.length); + + args = $post_args;; + + var value = Opal.yieldX(block, args); + + if ($truthy(value)) { + $send(enum$, 'yield', Opal.to_a(args)); + } + ;}, TMP_29.$$s = self, TMP_29.$$arity = -2, TMP_29)); + }, TMP_Lazy_find_all_28.$$arity = 0); + Opal.alias(self, "flat_map", "collect_concat"); + + Opal.def(self, '$grep', TMP_Lazy_grep_30 = function $$grep(pattern) { + var $iter = TMP_Lazy_grep_30.$$p, block = $iter || nil, TMP_31, TMP_32, self = this; + + if ($iter) TMP_Lazy_grep_30.$$p = null; + + + if ($iter) TMP_Lazy_grep_30.$$p = null;; + if ($truthy(block)) { + return $send($$($nesting, 'Lazy'), 'new', [self, nil], (TMP_31 = function(enum$, $a){var self = TMP_31.$$s || this, $post_args, args; + + + + if (enum$ == null) { + enum$ = nil; + }; + + $post_args = Opal.slice.call(arguments, 1, arguments.length); + + args = $post_args;; + + var param = $$($nesting, 'Opal').$destructure(args), + value = pattern['$==='](param); + + if ($truthy(value)) { + value = Opal.yield1(block, param); + + enum$.$yield(Opal.yield1(block, param)); + } + ;}, TMP_31.$$s = self, TMP_31.$$arity = -2, TMP_31)) + } else { + return $send($$($nesting, 'Lazy'), 'new', [self, nil], (TMP_32 = function(enum$, $a){var self = TMP_32.$$s || this, $post_args, args; + + + + if (enum$ == null) { + enum$ = nil; + }; + + $post_args = Opal.slice.call(arguments, 1, arguments.length); + + args = $post_args;; + + var param = $$($nesting, 'Opal').$destructure(args), + value = pattern['$==='](param); + + if ($truthy(value)) { + enum$.$yield(param); + } + ;}, TMP_32.$$s = self, TMP_32.$$arity = -2, TMP_32)) + }; + }, TMP_Lazy_grep_30.$$arity = 1); + Opal.alias(self, "map", "collect"); + Opal.alias(self, "select", "find_all"); + + Opal.def(self, '$reject', TMP_Lazy_reject_33 = function $$reject() { + var $iter = TMP_Lazy_reject_33.$$p, block = $iter || nil, TMP_34, self = this; + + if ($iter) TMP_Lazy_reject_33.$$p = null; + + + if ($iter) TMP_Lazy_reject_33.$$p = null;; + if ($truthy(block)) { + } else { + self.$raise($$($nesting, 'ArgumentError'), "tried to call lazy reject without a block") + }; + return $send($$($nesting, 'Lazy'), 'new', [self, nil], (TMP_34 = function(enum$, $a){var self = TMP_34.$$s || this, $post_args, args; + + + + if (enum$ == null) { + enum$ = nil; + }; + + $post_args = Opal.slice.call(arguments, 1, arguments.length); + + args = $post_args;; + + var value = Opal.yieldX(block, args); + + if ($falsy(value)) { + $send(enum$, 'yield', Opal.to_a(args)); + } + ;}, TMP_34.$$s = self, TMP_34.$$arity = -2, TMP_34)); + }, TMP_Lazy_reject_33.$$arity = 0); + + Opal.def(self, '$take', TMP_Lazy_take_35 = function $$take(n) { + var TMP_36, self = this, current_size = nil, set_size = nil, taken = nil; + + + n = $$($nesting, 'Opal').$coerce_to(n, $$($nesting, 'Integer'), "to_int"); + if ($truthy($rb_lt(n, 0))) { + self.$raise($$($nesting, 'ArgumentError'), "attempt to take negative size")}; + current_size = self.$enumerator_size(); + set_size = (function() {if ($truthy($$($nesting, 'Integer')['$==='](current_size))) { + if ($truthy($rb_lt(n, current_size))) { + return n + } else { + return current_size + } + } else { + return current_size + }; return nil; })(); + taken = 0; + return $send($$($nesting, 'Lazy'), 'new', [self, set_size], (TMP_36 = function(enum$, $a){var self = TMP_36.$$s || this, $post_args, args; + + + + if (enum$ == null) { + enum$ = nil; + }; + + $post_args = Opal.slice.call(arguments, 1, arguments.length); + + args = $post_args;; + if ($truthy($rb_lt(taken, n))) { + + $send(enum$, 'yield', Opal.to_a(args)); + return (taken = $rb_plus(taken, 1)); + } else { + return self.$raise($$($nesting, 'StopLazyError')) + };}, TMP_36.$$s = self, TMP_36.$$arity = -2, TMP_36)); + }, TMP_Lazy_take_35.$$arity = 1); + + Opal.def(self, '$take_while', TMP_Lazy_take_while_37 = function $$take_while() { + var $iter = TMP_Lazy_take_while_37.$$p, block = $iter || nil, TMP_38, self = this; + + if ($iter) TMP_Lazy_take_while_37.$$p = null; + + + if ($iter) TMP_Lazy_take_while_37.$$p = null;; + if ($truthy(block)) { + } else { + self.$raise($$($nesting, 'ArgumentError'), "tried to call lazy take_while without a block") + }; + return $send($$($nesting, 'Lazy'), 'new', [self, nil], (TMP_38 = function(enum$, $a){var self = TMP_38.$$s || this, $post_args, args; + + + + if (enum$ == null) { + enum$ = nil; + }; + + $post_args = Opal.slice.call(arguments, 1, arguments.length); + + args = $post_args;; + + var value = Opal.yieldX(block, args); + + if ($truthy(value)) { + $send(enum$, 'yield', Opal.to_a(args)); + } + else { + self.$raise($$($nesting, 'StopLazyError')); + } + ;}, TMP_38.$$s = self, TMP_38.$$arity = -2, TMP_38)); + }, TMP_Lazy_take_while_37.$$arity = 0); + Opal.alias(self, "to_enum", "enum_for"); + return (Opal.def(self, '$inspect', TMP_Lazy_inspect_39 = function $$inspect() { + var self = this; + + return "" + "#<" + (self.$class()) + ": " + (self.enumerator.$inspect()) + ">" + }, TMP_Lazy_inspect_39.$$arity = 0), nil) && 'inspect'; + })($nesting[0], self, $nesting); + })($nesting[0], null, $nesting); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/numeric"] = function(Opal) { + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + function $rb_times(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs * rhs : lhs['$*'](rhs); + } + function $rb_lt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); + } + function $rb_divide(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs / rhs : lhs['$/'](rhs); + } + function $rb_gt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $truthy = Opal.truthy, $hash2 = Opal.hash2; + + Opal.add_stubs(['$require', '$include', '$instance_of?', '$class', '$Float', '$respond_to?', '$coerce', '$__send__', '$===', '$raise', '$equal?', '$-', '$*', '$div', '$<', '$-@', '$ceil', '$to_f', '$denominator', '$to_r', '$==', '$floor', '$/', '$%', '$Complex', '$zero?', '$numerator', '$abs', '$arg', '$coerce_to!', '$round', '$to_i', '$truncate', '$>']); + + self.$require("corelib/comparable"); + return (function($base, $super, $parent_nesting) { + function $Numeric(){}; + var self = $Numeric = $klass($base, $super, 'Numeric', $Numeric); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Numeric_coerce_1, TMP_Numeric___coerced___2, TMP_Numeric_$lt$eq$gt_3, TMP_Numeric_$$_4, TMP_Numeric_$$_5, TMP_Numeric_$_6, TMP_Numeric_abs_7, TMP_Numeric_abs2_8, TMP_Numeric_angle_9, TMP_Numeric_ceil_10, TMP_Numeric_conj_11, TMP_Numeric_denominator_12, TMP_Numeric_div_13, TMP_Numeric_divmod_14, TMP_Numeric_fdiv_15, TMP_Numeric_floor_16, TMP_Numeric_i_17, TMP_Numeric_imag_18, TMP_Numeric_integer$q_19, TMP_Numeric_nonzero$q_20, TMP_Numeric_numerator_21, TMP_Numeric_polar_22, TMP_Numeric_quo_23, TMP_Numeric_real_24, TMP_Numeric_real$q_25, TMP_Numeric_rect_26, TMP_Numeric_round_27, TMP_Numeric_to_c_28, TMP_Numeric_to_int_29, TMP_Numeric_truncate_30, TMP_Numeric_zero$q_31, TMP_Numeric_positive$q_32, TMP_Numeric_negative$q_33, TMP_Numeric_dup_34, TMP_Numeric_clone_35, TMP_Numeric_finite$q_36, TMP_Numeric_infinite$q_37; + + + self.$include($$($nesting, 'Comparable')); + + Opal.def(self, '$coerce', TMP_Numeric_coerce_1 = function $$coerce(other) { + var self = this; + + + if ($truthy(other['$instance_of?'](self.$class()))) { + return [other, self]}; + return [self.$Float(other), self.$Float(self)]; + }, TMP_Numeric_coerce_1.$$arity = 1); + + Opal.def(self, '$__coerced__', TMP_Numeric___coerced___2 = function $$__coerced__(method, other) { + var $a, $b, self = this, a = nil, b = nil, $case = nil; + + if ($truthy(other['$respond_to?']("coerce"))) { + + $b = other.$coerce(self), $a = Opal.to_ary($b), (a = ($a[0] == null ? nil : $a[0])), (b = ($a[1] == null ? nil : $a[1])), $b; + return a.$__send__(method, b); + } else { + return (function() {$case = method; + if ("+"['$===']($case) || "-"['$===']($case) || "*"['$===']($case) || "/"['$===']($case) || "%"['$===']($case) || "&"['$===']($case) || "|"['$===']($case) || "^"['$===']($case) || "**"['$===']($case)) {return self.$raise($$($nesting, 'TypeError'), "" + (other.$class()) + " can't be coerced into Numeric")} + else if (">"['$===']($case) || ">="['$===']($case) || "<"['$===']($case) || "<="['$===']($case) || "<=>"['$===']($case)) {return self.$raise($$($nesting, 'ArgumentError'), "" + "comparison of " + (self.$class()) + " with " + (other.$class()) + " failed")} + else { return nil }})() + } + }, TMP_Numeric___coerced___2.$$arity = 2); + + Opal.def(self, '$<=>', TMP_Numeric_$lt$eq$gt_3 = function(other) { + var self = this; + + + if ($truthy(self['$equal?'](other))) { + return 0}; + return nil; + }, TMP_Numeric_$lt$eq$gt_3.$$arity = 1); + + Opal.def(self, '$+@', TMP_Numeric_$$_4 = function() { + var self = this; + + return self + }, TMP_Numeric_$$_4.$$arity = 0); + + Opal.def(self, '$-@', TMP_Numeric_$$_5 = function() { + var self = this; + + return $rb_minus(0, self) + }, TMP_Numeric_$$_5.$$arity = 0); + + Opal.def(self, '$%', TMP_Numeric_$_6 = function(other) { + var self = this; + + return $rb_minus(self, $rb_times(other, self.$div(other))) + }, TMP_Numeric_$_6.$$arity = 1); + + Opal.def(self, '$abs', TMP_Numeric_abs_7 = function $$abs() { + var self = this; + + if ($rb_lt(self, 0)) { + return self['$-@']() + } else { + return self + } + }, TMP_Numeric_abs_7.$$arity = 0); + + Opal.def(self, '$abs2', TMP_Numeric_abs2_8 = function $$abs2() { + var self = this; + + return $rb_times(self, self) + }, TMP_Numeric_abs2_8.$$arity = 0); + + Opal.def(self, '$angle', TMP_Numeric_angle_9 = function $$angle() { + var self = this; + + if ($rb_lt(self, 0)) { + return $$$($$($nesting, 'Math'), 'PI') + } else { + return 0 + } + }, TMP_Numeric_angle_9.$$arity = 0); + Opal.alias(self, "arg", "angle"); + + Opal.def(self, '$ceil', TMP_Numeric_ceil_10 = function $$ceil(ndigits) { + var self = this; + + + + if (ndigits == null) { + ndigits = 0; + }; + return self.$to_f().$ceil(ndigits); + }, TMP_Numeric_ceil_10.$$arity = -1); + + Opal.def(self, '$conj', TMP_Numeric_conj_11 = function $$conj() { + var self = this; + + return self + }, TMP_Numeric_conj_11.$$arity = 0); + Opal.alias(self, "conjugate", "conj"); + + Opal.def(self, '$denominator', TMP_Numeric_denominator_12 = function $$denominator() { + var self = this; + + return self.$to_r().$denominator() + }, TMP_Numeric_denominator_12.$$arity = 0); + + Opal.def(self, '$div', TMP_Numeric_div_13 = function $$div(other) { + var self = this; + + + if (other['$=='](0)) { + self.$raise($$($nesting, 'ZeroDivisionError'), "divided by o")}; + return $rb_divide(self, other).$floor(); + }, TMP_Numeric_div_13.$$arity = 1); + + Opal.def(self, '$divmod', TMP_Numeric_divmod_14 = function $$divmod(other) { + var self = this; + + return [self.$div(other), self['$%'](other)] + }, TMP_Numeric_divmod_14.$$arity = 1); + + Opal.def(self, '$fdiv', TMP_Numeric_fdiv_15 = function $$fdiv(other) { + var self = this; + + return $rb_divide(self.$to_f(), other) + }, TMP_Numeric_fdiv_15.$$arity = 1); + + Opal.def(self, '$floor', TMP_Numeric_floor_16 = function $$floor(ndigits) { + var self = this; + + + + if (ndigits == null) { + ndigits = 0; + }; + return self.$to_f().$floor(ndigits); + }, TMP_Numeric_floor_16.$$arity = -1); + + Opal.def(self, '$i', TMP_Numeric_i_17 = function $$i() { + var self = this; + + return self.$Complex(0, self) + }, TMP_Numeric_i_17.$$arity = 0); + + Opal.def(self, '$imag', TMP_Numeric_imag_18 = function $$imag() { + var self = this; + + return 0 + }, TMP_Numeric_imag_18.$$arity = 0); + Opal.alias(self, "imaginary", "imag"); + + Opal.def(self, '$integer?', TMP_Numeric_integer$q_19 = function() { + var self = this; + + return false + }, TMP_Numeric_integer$q_19.$$arity = 0); + Opal.alias(self, "magnitude", "abs"); + Opal.alias(self, "modulo", "%"); + + Opal.def(self, '$nonzero?', TMP_Numeric_nonzero$q_20 = function() { + var self = this; + + if ($truthy(self['$zero?']())) { + return nil + } else { + return self + } + }, TMP_Numeric_nonzero$q_20.$$arity = 0); + + Opal.def(self, '$numerator', TMP_Numeric_numerator_21 = function $$numerator() { + var self = this; + + return self.$to_r().$numerator() + }, TMP_Numeric_numerator_21.$$arity = 0); + Opal.alias(self, "phase", "arg"); + + Opal.def(self, '$polar', TMP_Numeric_polar_22 = function $$polar() { + var self = this; + + return [self.$abs(), self.$arg()] + }, TMP_Numeric_polar_22.$$arity = 0); + + Opal.def(self, '$quo', TMP_Numeric_quo_23 = function $$quo(other) { + var self = this; + + return $rb_divide($$($nesting, 'Opal')['$coerce_to!'](self, $$($nesting, 'Rational'), "to_r"), other) + }, TMP_Numeric_quo_23.$$arity = 1); + + Opal.def(self, '$real', TMP_Numeric_real_24 = function $$real() { + var self = this; + + return self + }, TMP_Numeric_real_24.$$arity = 0); + + Opal.def(self, '$real?', TMP_Numeric_real$q_25 = function() { + var self = this; + + return true + }, TMP_Numeric_real$q_25.$$arity = 0); + + Opal.def(self, '$rect', TMP_Numeric_rect_26 = function $$rect() { + var self = this; + + return [self, 0] + }, TMP_Numeric_rect_26.$$arity = 0); + Opal.alias(self, "rectangular", "rect"); + + Opal.def(self, '$round', TMP_Numeric_round_27 = function $$round(digits) { + var self = this; + + + ; + return self.$to_f().$round(digits); + }, TMP_Numeric_round_27.$$arity = -1); + + Opal.def(self, '$to_c', TMP_Numeric_to_c_28 = function $$to_c() { + var self = this; + + return self.$Complex(self, 0) + }, TMP_Numeric_to_c_28.$$arity = 0); + + Opal.def(self, '$to_int', TMP_Numeric_to_int_29 = function $$to_int() { + var self = this; + + return self.$to_i() + }, TMP_Numeric_to_int_29.$$arity = 0); + + Opal.def(self, '$truncate', TMP_Numeric_truncate_30 = function $$truncate(ndigits) { + var self = this; + + + + if (ndigits == null) { + ndigits = 0; + }; + return self.$to_f().$truncate(ndigits); + }, TMP_Numeric_truncate_30.$$arity = -1); + + Opal.def(self, '$zero?', TMP_Numeric_zero$q_31 = function() { + var self = this; + + return self['$=='](0) + }, TMP_Numeric_zero$q_31.$$arity = 0); + + Opal.def(self, '$positive?', TMP_Numeric_positive$q_32 = function() { + var self = this; + + return $rb_gt(self, 0) + }, TMP_Numeric_positive$q_32.$$arity = 0); + + Opal.def(self, '$negative?', TMP_Numeric_negative$q_33 = function() { + var self = this; + + return $rb_lt(self, 0) + }, TMP_Numeric_negative$q_33.$$arity = 0); + + Opal.def(self, '$dup', TMP_Numeric_dup_34 = function $$dup() { + var self = this; + + return self + }, TMP_Numeric_dup_34.$$arity = 0); + + Opal.def(self, '$clone', TMP_Numeric_clone_35 = function $$clone($kwargs) { + var freeze, self = this; + + + + if ($kwargs == null) { + $kwargs = $hash2([], {}); + } else if (!$kwargs.$$is_hash) { + throw Opal.ArgumentError.$new('expected kwargs'); + }; + + freeze = $kwargs.$$smap["freeze"]; + if (freeze == null) { + freeze = true + }; + return self; + }, TMP_Numeric_clone_35.$$arity = -1); + + Opal.def(self, '$finite?', TMP_Numeric_finite$q_36 = function() { + var self = this; + + return true + }, TMP_Numeric_finite$q_36.$$arity = 0); + return (Opal.def(self, '$infinite?', TMP_Numeric_infinite$q_37 = function() { + var self = this; + + return nil + }, TMP_Numeric_infinite$q_37.$$arity = 0), nil) && 'infinite?'; + })($nesting[0], null, $nesting); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/array"] = function(Opal) { + function $rb_gt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); + } + function $rb_times(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs * rhs : lhs['$*'](rhs); + } + function $rb_ge(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs >= rhs : lhs['$>='](rhs); + } + function $rb_lt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); + } + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $truthy = Opal.truthy, $hash2 = Opal.hash2, $send = Opal.send, $gvars = Opal.gvars; + + Opal.add_stubs(['$require', '$include', '$to_a', '$warn', '$raise', '$replace', '$respond_to?', '$to_ary', '$coerce_to', '$coerce_to?', '$===', '$join', '$to_str', '$class', '$hash', '$<=>', '$==', '$object_id', '$inspect', '$enum_for', '$bsearch_index', '$to_proc', '$nil?', '$coerce_to!', '$>', '$*', '$enumerator_size', '$empty?', '$size', '$map', '$equal?', '$dup', '$each', '$[]', '$dig', '$eql?', '$length', '$begin', '$end', '$exclude_end?', '$flatten', '$__id__', '$to_s', '$new', '$max', '$min', '$!', '$>=', '$**', '$delete_if', '$reverse', '$rotate', '$rand', '$at', '$keep_if', '$shuffle!', '$<', '$sort', '$sort_by', '$!=', '$times', '$[]=', '$-', '$<<', '$values', '$is_a?', '$last', '$first', '$upto', '$reject', '$pristine', '$singleton_class']); + + self.$require("corelib/enumerable"); + self.$require("corelib/numeric"); + return (function($base, $super, $parent_nesting) { + function $Array(){}; + var self = $Array = $klass($base, $super, 'Array', $Array); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Array_$$_1, TMP_Array_initialize_2, TMP_Array_try_convert_3, TMP_Array_$_4, TMP_Array_$_5, TMP_Array_$_6, TMP_Array_$_7, TMP_Array_$_8, TMP_Array_$lt$lt_9, TMP_Array_$lt$eq$gt_10, TMP_Array_$eq$eq_11, TMP_Array_$$_12, TMP_Array_$$$eq_13, TMP_Array_any$q_14, TMP_Array_assoc_15, TMP_Array_at_16, TMP_Array_bsearch_index_17, TMP_Array_bsearch_18, TMP_Array_cycle_19, TMP_Array_clear_21, TMP_Array_count_22, TMP_Array_initialize_copy_23, TMP_Array_collect_24, TMP_Array_collect$B_26, TMP_Array_combination_28, TMP_Array_repeated_combination_30, TMP_Array_compact_32, TMP_Array_compact$B_33, TMP_Array_concat_34, TMP_Array_delete_37, TMP_Array_delete_at_38, TMP_Array_delete_if_39, TMP_Array_dig_41, TMP_Array_drop_42, TMP_Array_dup_43, TMP_Array_each_44, TMP_Array_each_index_46, TMP_Array_empty$q_48, TMP_Array_eql$q_49, TMP_Array_fetch_50, TMP_Array_fill_51, TMP_Array_first_52, TMP_Array_flatten_53, TMP_Array_flatten$B_54, TMP_Array_hash_55, TMP_Array_include$q_56, TMP_Array_index_57, TMP_Array_insert_58, TMP_Array_inspect_59, TMP_Array_join_60, TMP_Array_keep_if_61, TMP_Array_last_63, TMP_Array_length_64, TMP_Array_max_65, TMP_Array_min_66, TMP_Array_permutation_67, TMP_Array_repeated_permutation_69, TMP_Array_pop_71, TMP_Array_product_72, TMP_Array_push_73, TMP_Array_rassoc_74, TMP_Array_reject_75, TMP_Array_reject$B_77, TMP_Array_replace_79, TMP_Array_reverse_80, TMP_Array_reverse$B_81, TMP_Array_reverse_each_82, TMP_Array_rindex_84, TMP_Array_rotate_85, TMP_Array_rotate$B_86, TMP_Array_sample_89, TMP_Array_select_90, TMP_Array_select$B_92, TMP_Array_shift_94, TMP_Array_shuffle_95, TMP_Array_shuffle$B_96, TMP_Array_slice$B_97, TMP_Array_sort_98, TMP_Array_sort$B_99, TMP_Array_sort_by$B_100, TMP_Array_take_102, TMP_Array_take_while_103, TMP_Array_to_a_104, TMP_Array_to_h_105, TMP_Array_transpose_106, TMP_Array_uniq_109, TMP_Array_uniq$B_110, TMP_Array_unshift_111, TMP_Array_values_at_112, TMP_Array_zip_115, TMP_Array_inherited_116, TMP_Array_instance_variables_117, TMP_Array_pack_119; + + + self.$include($$($nesting, 'Enumerable')); + Opal.defineProperty(Array.prototype, '$$is_array', true); + + function toArraySubclass(obj, klass) { + if (klass.$$name === Opal.Array) { + return obj; + } else { + return klass.$allocate().$replace((obj).$to_a()); + } + } + ; + Opal.defs(self, '$[]', TMP_Array_$$_1 = function($a) { + var $post_args, objects, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + objects = $post_args;; + return toArraySubclass(objects, self);; + }, TMP_Array_$$_1.$$arity = -1); + + Opal.def(self, '$initialize', TMP_Array_initialize_2 = function $$initialize(size, obj) { + var $iter = TMP_Array_initialize_2.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Array_initialize_2.$$p = null; + + + if ($iter) TMP_Array_initialize_2.$$p = null;; + + if (size == null) { + size = nil; + }; + + if (obj == null) { + obj = nil; + }; + + if (obj !== nil && block !== nil) { + self.$warn("warning: block supersedes default value argument") + } + + if (size > $$$($$($nesting, 'Integer'), 'MAX')) { + self.$raise($$($nesting, 'ArgumentError'), "array size too big") + } + + if (arguments.length > 2) { + self.$raise($$($nesting, 'ArgumentError'), "" + "wrong number of arguments (" + (arguments.length) + " for 0..2)") + } + + if (arguments.length === 0) { + self.splice(0, self.length); + return self; + } + + if (arguments.length === 1) { + if (size.$$is_array) { + self.$replace(size.$to_a()) + return self; + } else if (size['$respond_to?']("to_ary")) { + self.$replace(size.$to_ary()) + return self; + } + } + + size = $$($nesting, 'Opal').$coerce_to(size, $$($nesting, 'Integer'), "to_int") + + if (size < 0) { + self.$raise($$($nesting, 'ArgumentError'), "negative array size") + } + + self.splice(0, self.length); + var i, value; + + if (block === nil) { + for (i = 0; i < size; i++) { + self.push(obj); + } + } + else { + for (i = 0, value; i < size; i++) { + value = block(i); + self[i] = value; + } + } + + return self; + ; + }, TMP_Array_initialize_2.$$arity = -1); + Opal.defs(self, '$try_convert', TMP_Array_try_convert_3 = function $$try_convert(obj) { + var self = this; + + return $$($nesting, 'Opal')['$coerce_to?'](obj, $$($nesting, 'Array'), "to_ary") + }, TMP_Array_try_convert_3.$$arity = 1); + + Opal.def(self, '$&', TMP_Array_$_4 = function(other) { + var self = this; + + + other = (function() {if ($truthy($$($nesting, 'Array')['$==='](other))) { + return other.$to_a() + } else { + return $$($nesting, 'Opal').$coerce_to(other, $$($nesting, 'Array'), "to_ary").$to_a() + }; return nil; })(); + + var result = [], hash = $hash2([], {}), i, length, item; + + for (i = 0, length = other.length; i < length; i++) { + Opal.hash_put(hash, other[i], true); + } + + for (i = 0, length = self.length; i < length; i++) { + item = self[i]; + if (Opal.hash_delete(hash, item) !== undefined) { + result.push(item); + } + } + + return result; + ; + }, TMP_Array_$_4.$$arity = 1); + + Opal.def(self, '$|', TMP_Array_$_5 = function(other) { + var self = this; + + + other = (function() {if ($truthy($$($nesting, 'Array')['$==='](other))) { + return other.$to_a() + } else { + return $$($nesting, 'Opal').$coerce_to(other, $$($nesting, 'Array'), "to_ary").$to_a() + }; return nil; })(); + + var hash = $hash2([], {}), i, length, item; + + for (i = 0, length = self.length; i < length; i++) { + Opal.hash_put(hash, self[i], true); + } + + for (i = 0, length = other.length; i < length; i++) { + Opal.hash_put(hash, other[i], true); + } + + return hash.$keys(); + ; + }, TMP_Array_$_5.$$arity = 1); + + Opal.def(self, '$*', TMP_Array_$_6 = function(other) { + var self = this; + + + if ($truthy(other['$respond_to?']("to_str"))) { + return self.$join(other.$to_str())}; + other = $$($nesting, 'Opal').$coerce_to(other, $$($nesting, 'Integer'), "to_int"); + if ($truthy(other < 0)) { + self.$raise($$($nesting, 'ArgumentError'), "negative argument")}; + + var result = [], + converted = self.$to_a(); + + for (var i = 0; i < other; i++) { + result = result.concat(converted); + } + + return toArraySubclass(result, self.$class()); + ; + }, TMP_Array_$_6.$$arity = 1); + + Opal.def(self, '$+', TMP_Array_$_7 = function(other) { + var self = this; + + + other = (function() {if ($truthy($$($nesting, 'Array')['$==='](other))) { + return other.$to_a() + } else { + return $$($nesting, 'Opal').$coerce_to(other, $$($nesting, 'Array'), "to_ary").$to_a() + }; return nil; })(); + return self.concat(other);; + }, TMP_Array_$_7.$$arity = 1); + + Opal.def(self, '$-', TMP_Array_$_8 = function(other) { + var self = this; + + + other = (function() {if ($truthy($$($nesting, 'Array')['$==='](other))) { + return other.$to_a() + } else { + return $$($nesting, 'Opal').$coerce_to(other, $$($nesting, 'Array'), "to_ary").$to_a() + }; return nil; })(); + if ($truthy(self.length === 0)) { + return []}; + if ($truthy(other.length === 0)) { + return self.slice()}; + + var result = [], hash = $hash2([], {}), i, length, item; + + for (i = 0, length = other.length; i < length; i++) { + Opal.hash_put(hash, other[i], true); + } + + for (i = 0, length = self.length; i < length; i++) { + item = self[i]; + if (Opal.hash_get(hash, item) === undefined) { + result.push(item); + } + } + + return result; + ; + }, TMP_Array_$_8.$$arity = 1); + + Opal.def(self, '$<<', TMP_Array_$lt$lt_9 = function(object) { + var self = this; + + + self.push(object); + return self; + }, TMP_Array_$lt$lt_9.$$arity = 1); + + Opal.def(self, '$<=>', TMP_Array_$lt$eq$gt_10 = function(other) { + var self = this; + + + if ($truthy($$($nesting, 'Array')['$==='](other))) { + other = other.$to_a() + } else if ($truthy(other['$respond_to?']("to_ary"))) { + other = other.$to_ary().$to_a() + } else { + return nil + }; + + if (self.$hash() === other.$hash()) { + return 0; + } + + var count = Math.min(self.length, other.length); + + for (var i = 0; i < count; i++) { + var tmp = (self[i])['$<=>'](other[i]); + + if (tmp !== 0) { + return tmp; + } + } + + return (self.length)['$<=>'](other.length); + ; + }, TMP_Array_$lt$eq$gt_10.$$arity = 1); + + Opal.def(self, '$==', TMP_Array_$eq$eq_11 = function(other) { + var self = this; + + + var recursed = {}; + + function _eqeq(array, other) { + var i, length, a, b; + + if (array === other) + return true; + + if (!other.$$is_array) { + if ($$($nesting, 'Opal')['$respond_to?'](other, "to_ary")) { + return (other)['$=='](array); + } else { + return false; + } + } + + if (array.constructor !== Array) + array = (array).$to_a(); + if (other.constructor !== Array) + other = (other).$to_a(); + + if (array.length !== other.length) { + return false; + } + + recursed[(array).$object_id()] = true; + + for (i = 0, length = array.length; i < length; i++) { + a = array[i]; + b = other[i]; + if (a.$$is_array) { + if (b.$$is_array && b.length !== a.length) { + return false; + } + if (!recursed.hasOwnProperty((a).$object_id())) { + if (!_eqeq(a, b)) { + return false; + } + } + } else { + if (!(a)['$=='](b)) { + return false; + } + } + } + + return true; + } + + return _eqeq(self, other); + + }, TMP_Array_$eq$eq_11.$$arity = 1); + + function $array_slice_range(self, index) { + var size = self.length, + exclude, from, to, result; + + exclude = index.excl; + from = Opal.Opal.$coerce_to(index.begin, Opal.Integer, 'to_int'); + to = Opal.Opal.$coerce_to(index.end, Opal.Integer, 'to_int'); + + if (from < 0) { + from += size; + + if (from < 0) { + return nil; + } + } + + if (from > size) { + return nil; + } + + if (to < 0) { + to += size; + + if (to < 0) { + return []; + } + } + + if (!exclude) { + to += 1; + } + + result = self.slice(from, to); + return toArraySubclass(result, self.$class()); + } + + function $array_slice_index_length(self, index, length) { + var size = self.length, + exclude, from, to, result; + + index = Opal.Opal.$coerce_to(index, Opal.Integer, 'to_int'); + + if (index < 0) { + index += size; + + if (index < 0) { + return nil; + } + } + + if (length === undefined) { + if (index >= size || index < 0) { + return nil; + } + + return self[index]; + } + else { + length = Opal.Opal.$coerce_to(length, Opal.Integer, 'to_int'); + + if (length < 0 || index > size || index < 0) { + return nil; + } + + result = self.slice(index, index + length); + } + return toArraySubclass(result, self.$class()); + } + ; + + Opal.def(self, '$[]', TMP_Array_$$_12 = function(index, length) { + var self = this; + + + ; + + if (index.$$is_range) { + return $array_slice_range(self, index); + } + else { + return $array_slice_index_length(self, index, length); + } + ; + }, TMP_Array_$$_12.$$arity = -2); + + Opal.def(self, '$[]=', TMP_Array_$$$eq_13 = function(index, value, extra) { + var self = this, data = nil, length = nil; + + + ; + var i, size = self.length;; + if ($truthy($$($nesting, 'Range')['$==='](index))) { + + data = (function() {if ($truthy($$($nesting, 'Array')['$==='](value))) { + return value.$to_a() + } else if ($truthy(value['$respond_to?']("to_ary"))) { + return value.$to_ary().$to_a() + } else { + return [value] + }; return nil; })(); + + var exclude = index.excl, + from = $$($nesting, 'Opal').$coerce_to(index.begin, $$($nesting, 'Integer'), "to_int"), + to = $$($nesting, 'Opal').$coerce_to(index.end, $$($nesting, 'Integer'), "to_int"); + + if (from < 0) { + from += size; + + if (from < 0) { + self.$raise($$($nesting, 'RangeError'), "" + (index.$inspect()) + " out of range"); + } + } + + if (to < 0) { + to += size; + } + + if (!exclude) { + to += 1; + } + + if (from > size) { + for (i = size; i < from; i++) { + self[i] = nil; + } + } + + if (to < 0) { + self.splice.apply(self, [from, 0].concat(data)); + } + else { + self.splice.apply(self, [from, to - from].concat(data)); + } + + return value; + ; + } else { + + if ($truthy(extra === undefined)) { + length = 1 + } else { + + length = value; + value = extra; + data = (function() {if ($truthy($$($nesting, 'Array')['$==='](value))) { + return value.$to_a() + } else if ($truthy(value['$respond_to?']("to_ary"))) { + return value.$to_ary().$to_a() + } else { + return [value] + }; return nil; })(); + }; + + var old; + + index = $$($nesting, 'Opal').$coerce_to(index, $$($nesting, 'Integer'), "to_int"); + length = $$($nesting, 'Opal').$coerce_to(length, $$($nesting, 'Integer'), "to_int"); + + if (index < 0) { + old = index; + index += size; + + if (index < 0) { + self.$raise($$($nesting, 'IndexError'), "" + "index " + (old) + " too small for array; minimum " + (-self.length)); + } + } + + if (length < 0) { + self.$raise($$($nesting, 'IndexError'), "" + "negative length (" + (length) + ")") + } + + if (index > size) { + for (i = size; i < index; i++) { + self[i] = nil; + } + } + + if (extra === undefined) { + self[index] = value; + } + else { + self.splice.apply(self, [index, length].concat(data)); + } + + return value; + ; + }; + }, TMP_Array_$$$eq_13.$$arity = -3); + + Opal.def(self, '$any?', TMP_Array_any$q_14 = function(pattern) { + var $iter = TMP_Array_any$q_14.$$p, block = $iter || nil, self = this, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_Array_any$q_14.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + + + if ($iter) TMP_Array_any$q_14.$$p = null;; + ; + if (self.length === 0) return false; + return $send(self, Opal.find_super_dispatcher(self, 'any?', TMP_Array_any$q_14, false), $zuper, $iter); + }, TMP_Array_any$q_14.$$arity = -1); + + Opal.def(self, '$assoc', TMP_Array_assoc_15 = function $$assoc(object) { + var self = this; + + + for (var i = 0, length = self.length, item; i < length; i++) { + if (item = self[i], item.length && (item[0])['$=='](object)) { + return item; + } + } + + return nil; + + }, TMP_Array_assoc_15.$$arity = 1); + + Opal.def(self, '$at', TMP_Array_at_16 = function $$at(index) { + var self = this; + + + index = $$($nesting, 'Opal').$coerce_to(index, $$($nesting, 'Integer'), "to_int"); + + if (index < 0) { + index += self.length; + } + + if (index < 0 || index >= self.length) { + return nil; + } + + return self[index]; + ; + }, TMP_Array_at_16.$$arity = 1); + + Opal.def(self, '$bsearch_index', TMP_Array_bsearch_index_17 = function $$bsearch_index() { + var $iter = TMP_Array_bsearch_index_17.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Array_bsearch_index_17.$$p = null; + + + if ($iter) TMP_Array_bsearch_index_17.$$p = null;; + if ((block !== nil)) { + } else { + return self.$enum_for("bsearch_index") + }; + + var min = 0, + max = self.length, + mid, + val, + ret, + smaller = false, + satisfied = nil; + + while (min < max) { + mid = min + Math.floor((max - min) / 2); + val = self[mid]; + ret = Opal.yield1(block, val); + + if (ret === true) { + satisfied = mid; + smaller = true; + } + else if (ret === false || ret === nil) { + smaller = false; + } + else if (ret.$$is_number) { + if (ret === 0) { return mid; } + smaller = (ret < 0); + } + else { + self.$raise($$($nesting, 'TypeError'), "" + "wrong argument type " + ((ret).$class()) + " (must be numeric, true, false or nil)") + } + + if (smaller) { max = mid; } else { min = mid + 1; } + } + + return satisfied; + ; + }, TMP_Array_bsearch_index_17.$$arity = 0); + + Opal.def(self, '$bsearch', TMP_Array_bsearch_18 = function $$bsearch() { + var $iter = TMP_Array_bsearch_18.$$p, block = $iter || nil, self = this, index = nil; + + if ($iter) TMP_Array_bsearch_18.$$p = null; + + + if ($iter) TMP_Array_bsearch_18.$$p = null;; + if ((block !== nil)) { + } else { + return self.$enum_for("bsearch") + }; + index = $send(self, 'bsearch_index', [], block.$to_proc()); + + if (index != null && index.$$is_number) { + return self[index]; + } else { + return index; + } + ; + }, TMP_Array_bsearch_18.$$arity = 0); + + Opal.def(self, '$cycle', TMP_Array_cycle_19 = function $$cycle(n) { + var $iter = TMP_Array_cycle_19.$$p, block = $iter || nil, TMP_20, $a, self = this; + + if ($iter) TMP_Array_cycle_19.$$p = null; + + + if ($iter) TMP_Array_cycle_19.$$p = null;; + + if (n == null) { + n = nil; + }; + if ((block !== nil)) { + } else { + return $send(self, 'enum_for', ["cycle", n], (TMP_20 = function(){var self = TMP_20.$$s || this; + + if ($truthy(n['$nil?']())) { + return $$$($$($nesting, 'Float'), 'INFINITY') + } else { + + n = $$($nesting, 'Opal')['$coerce_to!'](n, $$($nesting, 'Integer'), "to_int"); + if ($truthy($rb_gt(n, 0))) { + return $rb_times(self.$enumerator_size(), n) + } else { + return 0 + }; + }}, TMP_20.$$s = self, TMP_20.$$arity = 0, TMP_20)) + }; + if ($truthy(($truthy($a = self['$empty?']()) ? $a : n['$=='](0)))) { + return nil}; + + var i, length, value; + + if (n === nil) { + while (true) { + for (i = 0, length = self.length; i < length; i++) { + value = Opal.yield1(block, self[i]); + } + } + } + else { + n = $$($nesting, 'Opal')['$coerce_to!'](n, $$($nesting, 'Integer'), "to_int"); + if (n <= 0) { + return self; + } + + while (n > 0) { + for (i = 0, length = self.length; i < length; i++) { + value = Opal.yield1(block, self[i]); + } + + n--; + } + } + ; + return self; + }, TMP_Array_cycle_19.$$arity = -1); + + Opal.def(self, '$clear', TMP_Array_clear_21 = function $$clear() { + var self = this; + + + self.splice(0, self.length); + return self; + }, TMP_Array_clear_21.$$arity = 0); + + Opal.def(self, '$count', TMP_Array_count_22 = function $$count(object) { + var $iter = TMP_Array_count_22.$$p, block = $iter || nil, $a, self = this, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_Array_count_22.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + + + if ($iter) TMP_Array_count_22.$$p = null;; + + if (object == null) { + object = nil; + }; + if ($truthy(($truthy($a = object) ? $a : block))) { + return $send(self, Opal.find_super_dispatcher(self, 'count', TMP_Array_count_22, false), $zuper, $iter) + } else { + return self.$size() + }; + }, TMP_Array_count_22.$$arity = -1); + + Opal.def(self, '$initialize_copy', TMP_Array_initialize_copy_23 = function $$initialize_copy(other) { + var self = this; + + return self.$replace(other) + }, TMP_Array_initialize_copy_23.$$arity = 1); + + Opal.def(self, '$collect', TMP_Array_collect_24 = function $$collect() { + var $iter = TMP_Array_collect_24.$$p, block = $iter || nil, TMP_25, self = this; + + if ($iter) TMP_Array_collect_24.$$p = null; + + + if ($iter) TMP_Array_collect_24.$$p = null;; + if ((block !== nil)) { + } else { + return $send(self, 'enum_for', ["collect"], (TMP_25 = function(){var self = TMP_25.$$s || this; + + return self.$size()}, TMP_25.$$s = self, TMP_25.$$arity = 0, TMP_25)) + }; + + var result = []; + + for (var i = 0, length = self.length; i < length; i++) { + var value = Opal.yield1(block, self[i]); + result.push(value); + } + + return result; + ; + }, TMP_Array_collect_24.$$arity = 0); + + Opal.def(self, '$collect!', TMP_Array_collect$B_26 = function() { + var $iter = TMP_Array_collect$B_26.$$p, block = $iter || nil, TMP_27, self = this; + + if ($iter) TMP_Array_collect$B_26.$$p = null; + + + if ($iter) TMP_Array_collect$B_26.$$p = null;; + if ((block !== nil)) { + } else { + return $send(self, 'enum_for', ["collect!"], (TMP_27 = function(){var self = TMP_27.$$s || this; + + return self.$size()}, TMP_27.$$s = self, TMP_27.$$arity = 0, TMP_27)) + }; + + for (var i = 0, length = self.length; i < length; i++) { + var value = Opal.yield1(block, self[i]); + self[i] = value; + } + ; + return self; + }, TMP_Array_collect$B_26.$$arity = 0); + + function binomial_coefficient(n, k) { + if (n === k || k === 0) { + return 1; + } + + if (k > 0 && n > k) { + return binomial_coefficient(n - 1, k - 1) + binomial_coefficient(n - 1, k); + } + + return 0; + } + ; + + Opal.def(self, '$combination', TMP_Array_combination_28 = function $$combination(n) { + var TMP_29, $iter = TMP_Array_combination_28.$$p, $yield = $iter || nil, self = this, num = nil; + + if ($iter) TMP_Array_combination_28.$$p = null; + + num = $$($nesting, 'Opal')['$coerce_to!'](n, $$($nesting, 'Integer'), "to_int"); + if (($yield !== nil)) { + } else { + return $send(self, 'enum_for', ["combination", num], (TMP_29 = function(){var self = TMP_29.$$s || this; + + return binomial_coefficient(self.length, num)}, TMP_29.$$s = self, TMP_29.$$arity = 0, TMP_29)) + }; + + var i, length, stack, chosen, lev, done, next; + + if (num === 0) { + Opal.yield1($yield, []) + } else if (num === 1) { + for (i = 0, length = self.length; i < length; i++) { + Opal.yield1($yield, [self[i]]) + } + } + else if (num === self.length) { + Opal.yield1($yield, self.slice()) + } + else if (num >= 0 && num < self.length) { + stack = []; + for (i = 0; i <= num + 1; i++) { + stack.push(0); + } + + chosen = []; + lev = 0; + done = false; + stack[0] = -1; + + while (!done) { + chosen[lev] = self[stack[lev+1]]; + while (lev < num - 1) { + lev++; + next = stack[lev+1] = stack[lev] + 1; + chosen[lev] = self[next]; + } + Opal.yield1($yield, chosen.slice()) + lev++; + do { + done = (lev === 0); + stack[lev]++; + lev--; + } while ( stack[lev+1] + num === self.length + lev + 1 ); + } + } + ; + return self; + }, TMP_Array_combination_28.$$arity = 1); + + Opal.def(self, '$repeated_combination', TMP_Array_repeated_combination_30 = function $$repeated_combination(n) { + var TMP_31, $iter = TMP_Array_repeated_combination_30.$$p, $yield = $iter || nil, self = this, num = nil; + + if ($iter) TMP_Array_repeated_combination_30.$$p = null; + + num = $$($nesting, 'Opal')['$coerce_to!'](n, $$($nesting, 'Integer'), "to_int"); + if (($yield !== nil)) { + } else { + return $send(self, 'enum_for', ["repeated_combination", num], (TMP_31 = function(){var self = TMP_31.$$s || this; + + return binomial_coefficient(self.length + num - 1, num);}, TMP_31.$$s = self, TMP_31.$$arity = 0, TMP_31)) + }; + + function iterate(max, from, buffer, self) { + if (buffer.length == max) { + var copy = buffer.slice(); + Opal.yield1($yield, copy) + return; + } + for (var i = from; i < self.length; i++) { + buffer.push(self[i]); + iterate(max, i, buffer, self); + buffer.pop(); + } + } + + if (num >= 0) { + iterate(num, 0, [], self); + } + ; + return self; + }, TMP_Array_repeated_combination_30.$$arity = 1); + + Opal.def(self, '$compact', TMP_Array_compact_32 = function $$compact() { + var self = this; + + + var result = []; + + for (var i = 0, length = self.length, item; i < length; i++) { + if ((item = self[i]) !== nil) { + result.push(item); + } + } + + return result; + + }, TMP_Array_compact_32.$$arity = 0); + + Opal.def(self, '$compact!', TMP_Array_compact$B_33 = function() { + var self = this; + + + var original = self.length; + + for (var i = 0, length = self.length; i < length; i++) { + if (self[i] === nil) { + self.splice(i, 1); + + length--; + i--; + } + } + + return self.length === original ? nil : self; + + }, TMP_Array_compact$B_33.$$arity = 0); + + Opal.def(self, '$concat', TMP_Array_concat_34 = function $$concat($a) { + var $post_args, others, TMP_35, TMP_36, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + others = $post_args;; + others = $send(others, 'map', [], (TMP_35 = function(other){var self = TMP_35.$$s || this; + + + + if (other == null) { + other = nil; + }; + other = (function() {if ($truthy($$($nesting, 'Array')['$==='](other))) { + return other.$to_a() + } else { + return $$($nesting, 'Opal').$coerce_to(other, $$($nesting, 'Array'), "to_ary").$to_a() + }; return nil; })(); + if ($truthy(other['$equal?'](self))) { + other = other.$dup()}; + return other;}, TMP_35.$$s = self, TMP_35.$$arity = 1, TMP_35)); + $send(others, 'each', [], (TMP_36 = function(other){var self = TMP_36.$$s || this; + + + + if (other == null) { + other = nil; + }; + + for (var i = 0, length = other.length; i < length; i++) { + self.push(other[i]); + } + ;}, TMP_36.$$s = self, TMP_36.$$arity = 1, TMP_36)); + return self; + }, TMP_Array_concat_34.$$arity = -1); + + Opal.def(self, '$delete', TMP_Array_delete_37 = function(object) { + var $iter = TMP_Array_delete_37.$$p, $yield = $iter || nil, self = this; + + if ($iter) TMP_Array_delete_37.$$p = null; + + var original = self.length; + + for (var i = 0, length = original; i < length; i++) { + if ((self[i])['$=='](object)) { + self.splice(i, 1); + + length--; + i--; + } + } + + if (self.length === original) { + if (($yield !== nil)) { + return Opal.yieldX($yield, []); + } + return nil; + } + return object; + + }, TMP_Array_delete_37.$$arity = 1); + + Opal.def(self, '$delete_at', TMP_Array_delete_at_38 = function $$delete_at(index) { + var self = this; + + + index = $$($nesting, 'Opal').$coerce_to(index, $$($nesting, 'Integer'), "to_int"); + + if (index < 0) { + index += self.length; + } + + if (index < 0 || index >= self.length) { + return nil; + } + + var result = self[index]; + + self.splice(index, 1); + + return result; + + }, TMP_Array_delete_at_38.$$arity = 1); + + Opal.def(self, '$delete_if', TMP_Array_delete_if_39 = function $$delete_if() { + var $iter = TMP_Array_delete_if_39.$$p, block = $iter || nil, TMP_40, self = this; + + if ($iter) TMP_Array_delete_if_39.$$p = null; + + + if ($iter) TMP_Array_delete_if_39.$$p = null;; + if ((block !== nil)) { + } else { + return $send(self, 'enum_for', ["delete_if"], (TMP_40 = function(){var self = TMP_40.$$s || this; + + return self.$size()}, TMP_40.$$s = self, TMP_40.$$arity = 0, TMP_40)) + }; + + for (var i = 0, length = self.length, value; i < length; i++) { + value = block(self[i]); + + if (value !== false && value !== nil) { + self.splice(i, 1); + + length--; + i--; + } + } + ; + return self; + }, TMP_Array_delete_if_39.$$arity = 0); + + Opal.def(self, '$dig', TMP_Array_dig_41 = function $$dig(idx, $a) { + var $post_args, idxs, self = this, item = nil; + + + + $post_args = Opal.slice.call(arguments, 1, arguments.length); + + idxs = $post_args;; + item = self['$[]'](idx); + + if (item === nil || idxs.length === 0) { + return item; + } + ; + if ($truthy(item['$respond_to?']("dig"))) { + } else { + self.$raise($$($nesting, 'TypeError'), "" + (item.$class()) + " does not have #dig method") + }; + return $send(item, 'dig', Opal.to_a(idxs)); + }, TMP_Array_dig_41.$$arity = -2); + + Opal.def(self, '$drop', TMP_Array_drop_42 = function $$drop(number) { + var self = this; + + + if (number < 0) { + self.$raise($$($nesting, 'ArgumentError')) + } + + return self.slice(number); + + }, TMP_Array_drop_42.$$arity = 1); + + Opal.def(self, '$dup', TMP_Array_dup_43 = function $$dup() { + var $iter = TMP_Array_dup_43.$$p, $yield = $iter || nil, self = this, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_Array_dup_43.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + + + if (self.$$class === Opal.Array && + self.$$class.$allocate.$$pristine && + self.$copy_instance_variables.$$pristine && + self.$initialize_dup.$$pristine) { + return self.slice(0); + } + ; + return $send(self, Opal.find_super_dispatcher(self, 'dup', TMP_Array_dup_43, false), $zuper, $iter); + }, TMP_Array_dup_43.$$arity = 0); + + Opal.def(self, '$each', TMP_Array_each_44 = function $$each() { + var $iter = TMP_Array_each_44.$$p, block = $iter || nil, TMP_45, self = this; + + if ($iter) TMP_Array_each_44.$$p = null; + + + if ($iter) TMP_Array_each_44.$$p = null;; + if ((block !== nil)) { + } else { + return $send(self, 'enum_for', ["each"], (TMP_45 = function(){var self = TMP_45.$$s || this; + + return self.$size()}, TMP_45.$$s = self, TMP_45.$$arity = 0, TMP_45)) + }; + + for (var i = 0, length = self.length; i < length; i++) { + var value = Opal.yield1(block, self[i]); + } + ; + return self; + }, TMP_Array_each_44.$$arity = 0); + + Opal.def(self, '$each_index', TMP_Array_each_index_46 = function $$each_index() { + var $iter = TMP_Array_each_index_46.$$p, block = $iter || nil, TMP_47, self = this; + + if ($iter) TMP_Array_each_index_46.$$p = null; + + + if ($iter) TMP_Array_each_index_46.$$p = null;; + if ((block !== nil)) { + } else { + return $send(self, 'enum_for', ["each_index"], (TMP_47 = function(){var self = TMP_47.$$s || this; + + return self.$size()}, TMP_47.$$s = self, TMP_47.$$arity = 0, TMP_47)) + }; + + for (var i = 0, length = self.length; i < length; i++) { + var value = Opal.yield1(block, i); + } + ; + return self; + }, TMP_Array_each_index_46.$$arity = 0); + + Opal.def(self, '$empty?', TMP_Array_empty$q_48 = function() { + var self = this; + + return self.length === 0; + }, TMP_Array_empty$q_48.$$arity = 0); + + Opal.def(self, '$eql?', TMP_Array_eql$q_49 = function(other) { + var self = this; + + + var recursed = {}; + + function _eql(array, other) { + var i, length, a, b; + + if (!other.$$is_array) { + return false; + } + + other = other.$to_a(); + + if (array.length !== other.length) { + return false; + } + + recursed[(array).$object_id()] = true; + + for (i = 0, length = array.length; i < length; i++) { + a = array[i]; + b = other[i]; + if (a.$$is_array) { + if (b.$$is_array && b.length !== a.length) { + return false; + } + if (!recursed.hasOwnProperty((a).$object_id())) { + if (!_eql(a, b)) { + return false; + } + } + } else { + if (!(a)['$eql?'](b)) { + return false; + } + } + } + + return true; + } + + return _eql(self, other); + + }, TMP_Array_eql$q_49.$$arity = 1); + + Opal.def(self, '$fetch', TMP_Array_fetch_50 = function $$fetch(index, defaults) { + var $iter = TMP_Array_fetch_50.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Array_fetch_50.$$p = null; + + + if ($iter) TMP_Array_fetch_50.$$p = null;; + ; + + var original = index; + + index = $$($nesting, 'Opal').$coerce_to(index, $$($nesting, 'Integer'), "to_int"); + + if (index < 0) { + index += self.length; + } + + if (index >= 0 && index < self.length) { + return self[index]; + } + + if (block !== nil && defaults != null) { + self.$warn("warning: block supersedes default value argument") + } + + if (block !== nil) { + return block(original); + } + + if (defaults != null) { + return defaults; + } + + if (self.length === 0) { + self.$raise($$($nesting, 'IndexError'), "" + "index " + (original) + " outside of array bounds: 0...0") + } + else { + self.$raise($$($nesting, 'IndexError'), "" + "index " + (original) + " outside of array bounds: -" + (self.length) + "..." + (self.length)); + } + ; + }, TMP_Array_fetch_50.$$arity = -2); + + Opal.def(self, '$fill', TMP_Array_fill_51 = function $$fill($a) { + var $iter = TMP_Array_fill_51.$$p, block = $iter || nil, $post_args, args, $b, $c, self = this, one = nil, two = nil, obj = nil, left = nil, right = nil; + + if ($iter) TMP_Array_fill_51.$$p = null; + + + if ($iter) TMP_Array_fill_51.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + var i, length, value;; + if ($truthy(block)) { + + if ($truthy(args.length > 2)) { + self.$raise($$($nesting, 'ArgumentError'), "" + "wrong number of arguments (" + (args.$length()) + " for 0..2)")}; + $c = args, $b = Opal.to_ary($c), (one = ($b[0] == null ? nil : $b[0])), (two = ($b[1] == null ? nil : $b[1])), $c; + } else { + + if ($truthy(args.length == 0)) { + self.$raise($$($nesting, 'ArgumentError'), "wrong number of arguments (0 for 1..3)") + } else if ($truthy(args.length > 3)) { + self.$raise($$($nesting, 'ArgumentError'), "" + "wrong number of arguments (" + (args.$length()) + " for 1..3)")}; + $c = args, $b = Opal.to_ary($c), (obj = ($b[0] == null ? nil : $b[0])), (one = ($b[1] == null ? nil : $b[1])), (two = ($b[2] == null ? nil : $b[2])), $c; + }; + if ($truthy($$($nesting, 'Range')['$==='](one))) { + + if ($truthy(two)) { + self.$raise($$($nesting, 'TypeError'), "length invalid with range")}; + left = $$($nesting, 'Opal').$coerce_to(one.$begin(), $$($nesting, 'Integer'), "to_int"); + if ($truthy(left < 0)) { + left += this.length}; + if ($truthy(left < 0)) { + self.$raise($$($nesting, 'RangeError'), "" + (one.$inspect()) + " out of range")}; + right = $$($nesting, 'Opal').$coerce_to(one.$end(), $$($nesting, 'Integer'), "to_int"); + if ($truthy(right < 0)) { + right += this.length}; + if ($truthy(one['$exclude_end?']())) { + } else { + right += 1 + }; + if ($truthy(right <= left)) { + return self}; + } else if ($truthy(one)) { + + left = $$($nesting, 'Opal').$coerce_to(one, $$($nesting, 'Integer'), "to_int"); + if ($truthy(left < 0)) { + left += this.length}; + if ($truthy(left < 0)) { + left = 0}; + if ($truthy(two)) { + + right = $$($nesting, 'Opal').$coerce_to(two, $$($nesting, 'Integer'), "to_int"); + if ($truthy(right == 0)) { + return self}; + right += left; + } else { + right = this.length + }; + } else { + + left = 0; + right = this.length; + }; + if ($truthy(left > this.length)) { + + for (i = this.length; i < right; i++) { + self[i] = nil; + } + }; + if ($truthy(right > this.length)) { + this.length = right}; + if ($truthy(block)) { + + for (length = this.length; left < right; left++) { + value = block(left); + self[left] = value; + } + + } else { + + for (length = this.length; left < right; left++) { + self[left] = obj; + } + + }; + return self; + }, TMP_Array_fill_51.$$arity = -1); + + Opal.def(self, '$first', TMP_Array_first_52 = function $$first(count) { + var self = this; + + + ; + + if (count == null) { + return self.length === 0 ? nil : self[0]; + } + + count = $$($nesting, 'Opal').$coerce_to(count, $$($nesting, 'Integer'), "to_int"); + + if (count < 0) { + self.$raise($$($nesting, 'ArgumentError'), "negative array size"); + } + + return self.slice(0, count); + ; + }, TMP_Array_first_52.$$arity = -1); + + Opal.def(self, '$flatten', TMP_Array_flatten_53 = function $$flatten(level) { + var self = this; + + + ; + + function _flatten(array, level) { + var result = [], + i, length, + item, ary; + + array = (array).$to_a(); + + for (i = 0, length = array.length; i < length; i++) { + item = array[i]; + + if (!$$($nesting, 'Opal')['$respond_to?'](item, "to_ary", true)) { + result.push(item); + continue; + } + + ary = (item).$to_ary(); + + if (ary === nil) { + result.push(item); + continue; + } + + if (!ary.$$is_array) { + self.$raise($$($nesting, 'TypeError')); + } + + if (ary === self) { + self.$raise($$($nesting, 'ArgumentError')); + } + + switch (level) { + case undefined: + result = result.concat(_flatten(ary)); + break; + case 0: + result.push(ary); + break; + default: + result.push.apply(result, _flatten(ary, level - 1)); + } + } + return result; + } + + if (level !== undefined) { + level = $$($nesting, 'Opal').$coerce_to(level, $$($nesting, 'Integer'), "to_int"); + } + + return toArraySubclass(_flatten(self, level), self.$class()); + ; + }, TMP_Array_flatten_53.$$arity = -1); + + Opal.def(self, '$flatten!', TMP_Array_flatten$B_54 = function(level) { + var self = this; + + + ; + + var flattened = self.$flatten(level); + + if (self.length == flattened.length) { + for (var i = 0, length = self.length; i < length; i++) { + if (self[i] !== flattened[i]) { + break; + } + } + + if (i == length) { + return nil; + } + } + + self.$replace(flattened); + ; + return self; + }, TMP_Array_flatten$B_54.$$arity = -1); + + Opal.def(self, '$hash', TMP_Array_hash_55 = function $$hash() { + var self = this; + + + var top = (Opal.hash_ids === undefined), + result = ['A'], + hash_id = self.$object_id(), + item, i, key; + + try { + if (top) { + Opal.hash_ids = Object.create(null); + } + + // return early for recursive structures + if (Opal.hash_ids[hash_id]) { + return 'self'; + } + + for (key in Opal.hash_ids) { + item = Opal.hash_ids[key]; + if (self['$eql?'](item)) { + return 'self'; + } + } + + Opal.hash_ids[hash_id] = self; + + for (i = 0; i < self.length; i++) { + item = self[i]; + result.push(item.$hash()); + } + + return result.join(','); + } finally { + if (top) { + Opal.hash_ids = undefined; + } + } + + }, TMP_Array_hash_55.$$arity = 0); + + Opal.def(self, '$include?', TMP_Array_include$q_56 = function(member) { + var self = this; + + + for (var i = 0, length = self.length; i < length; i++) { + if ((self[i])['$=='](member)) { + return true; + } + } + + return false; + + }, TMP_Array_include$q_56.$$arity = 1); + + Opal.def(self, '$index', TMP_Array_index_57 = function $$index(object) { + var $iter = TMP_Array_index_57.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Array_index_57.$$p = null; + + + if ($iter) TMP_Array_index_57.$$p = null;; + ; + + var i, length, value; + + if (object != null && block !== nil) { + self.$warn("warning: given block not used") + } + + if (object != null) { + for (i = 0, length = self.length; i < length; i++) { + if ((self[i])['$=='](object)) { + return i; + } + } + } + else if (block !== nil) { + for (i = 0, length = self.length; i < length; i++) { + value = block(self[i]); + + if (value !== false && value !== nil) { + return i; + } + } + } + else { + return self.$enum_for("index"); + } + + return nil; + ; + }, TMP_Array_index_57.$$arity = -1); + + Opal.def(self, '$insert', TMP_Array_insert_58 = function $$insert(index, $a) { + var $post_args, objects, self = this; + + + + $post_args = Opal.slice.call(arguments, 1, arguments.length); + + objects = $post_args;; + + index = $$($nesting, 'Opal').$coerce_to(index, $$($nesting, 'Integer'), "to_int"); + + if (objects.length > 0) { + if (index < 0) { + index += self.length + 1; + + if (index < 0) { + self.$raise($$($nesting, 'IndexError'), "" + (index) + " is out of bounds"); + } + } + if (index > self.length) { + for (var i = self.length; i < index; i++) { + self.push(nil); + } + } + + self.splice.apply(self, [index, 0].concat(objects)); + } + ; + return self; + }, TMP_Array_insert_58.$$arity = -2); + + Opal.def(self, '$inspect', TMP_Array_inspect_59 = function $$inspect() { + var self = this; + + + var result = [], + id = self.$__id__(); + + for (var i = 0, length = self.length; i < length; i++) { + var item = self['$[]'](i); + + if ((item).$__id__() === id) { + result.push('[...]'); + } + else { + result.push((item).$inspect()); + } + } + + return '[' + result.join(', ') + ']'; + + }, TMP_Array_inspect_59.$$arity = 0); + + Opal.def(self, '$join', TMP_Array_join_60 = function $$join(sep) { + var self = this; + if ($gvars[","] == null) $gvars[","] = nil; + + + + if (sep == null) { + sep = nil; + }; + if ($truthy(self.length === 0)) { + return ""}; + if ($truthy(sep === nil)) { + sep = $gvars[","]}; + + var result = []; + var i, length, item, tmp; + + for (i = 0, length = self.length; i < length; i++) { + item = self[i]; + + if ($$($nesting, 'Opal')['$respond_to?'](item, "to_str")) { + tmp = (item).$to_str(); + + if (tmp !== nil) { + result.push((tmp).$to_s()); + + continue; + } + } + + if ($$($nesting, 'Opal')['$respond_to?'](item, "to_ary")) { + tmp = (item).$to_ary(); + + if (tmp === self) { + self.$raise($$($nesting, 'ArgumentError')); + } + + if (tmp !== nil) { + result.push((tmp).$join(sep)); + + continue; + } + } + + if ($$($nesting, 'Opal')['$respond_to?'](item, "to_s")) { + tmp = (item).$to_s(); + + if (tmp !== nil) { + result.push(tmp); + + continue; + } + } + + self.$raise($$($nesting, 'NoMethodError').$new("" + (Opal.inspect(item)) + " doesn't respond to #to_str, #to_ary or #to_s", "to_str")); + } + + if (sep === nil) { + return result.join(''); + } + else { + return result.join($$($nesting, 'Opal')['$coerce_to!'](sep, $$($nesting, 'String'), "to_str").$to_s()); + } + ; + }, TMP_Array_join_60.$$arity = -1); + + Opal.def(self, '$keep_if', TMP_Array_keep_if_61 = function $$keep_if() { + var $iter = TMP_Array_keep_if_61.$$p, block = $iter || nil, TMP_62, self = this; + + if ($iter) TMP_Array_keep_if_61.$$p = null; + + + if ($iter) TMP_Array_keep_if_61.$$p = null;; + if ((block !== nil)) { + } else { + return $send(self, 'enum_for', ["keep_if"], (TMP_62 = function(){var self = TMP_62.$$s || this; + + return self.$size()}, TMP_62.$$s = self, TMP_62.$$arity = 0, TMP_62)) + }; + + for (var i = 0, length = self.length, value; i < length; i++) { + value = block(self[i]); + + if (value === false || value === nil) { + self.splice(i, 1); + + length--; + i--; + } + } + ; + return self; + }, TMP_Array_keep_if_61.$$arity = 0); + + Opal.def(self, '$last', TMP_Array_last_63 = function $$last(count) { + var self = this; + + + ; + + if (count == null) { + return self.length === 0 ? nil : self[self.length - 1]; + } + + count = $$($nesting, 'Opal').$coerce_to(count, $$($nesting, 'Integer'), "to_int"); + + if (count < 0) { + self.$raise($$($nesting, 'ArgumentError'), "negative array size"); + } + + if (count > self.length) { + count = self.length; + } + + return self.slice(self.length - count, self.length); + ; + }, TMP_Array_last_63.$$arity = -1); + + Opal.def(self, '$length', TMP_Array_length_64 = function $$length() { + var self = this; + + return self.length; + }, TMP_Array_length_64.$$arity = 0); + Opal.alias(self, "map", "collect"); + Opal.alias(self, "map!", "collect!"); + + Opal.def(self, '$max', TMP_Array_max_65 = function $$max(n) { + var $iter = TMP_Array_max_65.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Array_max_65.$$p = null; + + + if ($iter) TMP_Array_max_65.$$p = null;; + ; + return $send(self.$each(), 'max', [n], block.$to_proc()); + }, TMP_Array_max_65.$$arity = -1); + + Opal.def(self, '$min', TMP_Array_min_66 = function $$min() { + var $iter = TMP_Array_min_66.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Array_min_66.$$p = null; + + + if ($iter) TMP_Array_min_66.$$p = null;; + return $send(self.$each(), 'min', [], block.$to_proc()); + }, TMP_Array_min_66.$$arity = 0); + + // Returns the product of from, from-1, ..., from - how_many + 1. + function descending_factorial(from, how_many) { + var count = how_many >= 0 ? 1 : 0; + while (how_many) { + count *= from; + from--; + how_many--; + } + return count; + } + ; + + Opal.def(self, '$permutation', TMP_Array_permutation_67 = function $$permutation(num) { + var $iter = TMP_Array_permutation_67.$$p, block = $iter || nil, TMP_68, self = this, perm = nil, used = nil; + + if ($iter) TMP_Array_permutation_67.$$p = null; + + + if ($iter) TMP_Array_permutation_67.$$p = null;; + ; + if ((block !== nil)) { + } else { + return $send(self, 'enum_for', ["permutation", num], (TMP_68 = function(){var self = TMP_68.$$s || this; + + return descending_factorial(self.length, num === undefined ? self.length : num);}, TMP_68.$$s = self, TMP_68.$$arity = 0, TMP_68)) + }; + + var permute, offensive, output; + + if (num === undefined) { + num = self.length; + } + else { + num = $$($nesting, 'Opal').$coerce_to(num, $$($nesting, 'Integer'), "to_int") + } + + if (num < 0 || self.length < num) { + // no permutations, yield nothing + } + else if (num === 0) { + // exactly one permutation: the zero-length array + Opal.yield1(block, []) + } + else if (num === 1) { + // this is a special, easy case + for (var i = 0; i < self.length; i++) { + Opal.yield1(block, [self[i]]) + } + } + else { + // this is the general case + (perm = $$($nesting, 'Array').$new(num)); + (used = $$($nesting, 'Array').$new(self.length, false)); + + permute = function(num, perm, index, used, blk) { + self = this; + for(var i = 0; i < self.length; i++){ + if(used['$[]'](i)['$!']()) { + perm[index] = i; + if(index < num - 1) { + used[i] = true; + permute.call(self, num, perm, index + 1, used, blk); + used[i] = false; + } + else { + output = []; + for (var j = 0; j < perm.length; j++) { + output.push(self[perm[j]]); + } + Opal.yield1(blk, output); + } + } + } + } + + if ((block !== nil)) { + // offensive (both definitions) copy. + offensive = self.slice(); + permute.call(offensive, num, perm, 0, used, block); + } + else { + permute.call(self, num, perm, 0, used, block); + } + } + ; + return self; + }, TMP_Array_permutation_67.$$arity = -1); + + Opal.def(self, '$repeated_permutation', TMP_Array_repeated_permutation_69 = function $$repeated_permutation(n) { + var TMP_70, $iter = TMP_Array_repeated_permutation_69.$$p, $yield = $iter || nil, self = this, num = nil; + + if ($iter) TMP_Array_repeated_permutation_69.$$p = null; + + num = $$($nesting, 'Opal')['$coerce_to!'](n, $$($nesting, 'Integer'), "to_int"); + if (($yield !== nil)) { + } else { + return $send(self, 'enum_for', ["repeated_permutation", num], (TMP_70 = function(){var self = TMP_70.$$s || this; + + if ($truthy($rb_ge(num, 0))) { + return self.$size()['$**'](num) + } else { + return 0 + }}, TMP_70.$$s = self, TMP_70.$$arity = 0, TMP_70)) + }; + + function iterate(max, buffer, self) { + if (buffer.length == max) { + var copy = buffer.slice(); + Opal.yield1($yield, copy) + return; + } + for (var i = 0; i < self.length; i++) { + buffer.push(self[i]); + iterate(max, buffer, self); + buffer.pop(); + } + } + + iterate(num, [], self.slice()); + ; + return self; + }, TMP_Array_repeated_permutation_69.$$arity = 1); + + Opal.def(self, '$pop', TMP_Array_pop_71 = function $$pop(count) { + var self = this; + + + ; + if ($truthy(count === undefined)) { + + if ($truthy(self.length === 0)) { + return nil}; + return self.pop();}; + count = $$($nesting, 'Opal').$coerce_to(count, $$($nesting, 'Integer'), "to_int"); + if ($truthy(count < 0)) { + self.$raise($$($nesting, 'ArgumentError'), "negative array size")}; + if ($truthy(self.length === 0)) { + return []}; + if ($truthy(count > self.length)) { + return self.splice(0, self.length); + } else { + return self.splice(self.length - count, self.length); + }; + }, TMP_Array_pop_71.$$arity = -1); + + Opal.def(self, '$product', TMP_Array_product_72 = function $$product($a) { + var $iter = TMP_Array_product_72.$$p, block = $iter || nil, $post_args, args, self = this; + + if ($iter) TMP_Array_product_72.$$p = null; + + + if ($iter) TMP_Array_product_72.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + + var result = (block !== nil) ? null : [], + n = args.length + 1, + counters = new Array(n), + lengths = new Array(n), + arrays = new Array(n), + i, m, subarray, len, resultlen = 1; + + arrays[0] = self; + for (i = 1; i < n; i++) { + arrays[i] = $$($nesting, 'Opal').$coerce_to(args[i - 1], $$($nesting, 'Array'), "to_ary"); + } + + for (i = 0; i < n; i++) { + len = arrays[i].length; + if (len === 0) { + return result || self; + } + resultlen *= len; + if (resultlen > 2147483647) { + self.$raise($$($nesting, 'RangeError'), "too big to product") + } + lengths[i] = len; + counters[i] = 0; + } + + outer_loop: for (;;) { + subarray = []; + for (i = 0; i < n; i++) { + subarray.push(arrays[i][counters[i]]); + } + if (result) { + result.push(subarray); + } else { + Opal.yield1(block, subarray) + } + m = n - 1; + counters[m]++; + while (counters[m] === lengths[m]) { + counters[m] = 0; + if (--m < 0) break outer_loop; + counters[m]++; + } + } + + return result || self; + ; + }, TMP_Array_product_72.$$arity = -1); + + Opal.def(self, '$push', TMP_Array_push_73 = function $$push($a) { + var $post_args, objects, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + objects = $post_args;; + + for (var i = 0, length = objects.length; i < length; i++) { + self.push(objects[i]); + } + ; + return self; + }, TMP_Array_push_73.$$arity = -1); + Opal.alias(self, "append", "push"); + + Opal.def(self, '$rassoc', TMP_Array_rassoc_74 = function $$rassoc(object) { + var self = this; + + + for (var i = 0, length = self.length, item; i < length; i++) { + item = self[i]; + + if (item.length && item[1] !== undefined) { + if ((item[1])['$=='](object)) { + return item; + } + } + } + + return nil; + + }, TMP_Array_rassoc_74.$$arity = 1); + + Opal.def(self, '$reject', TMP_Array_reject_75 = function $$reject() { + var $iter = TMP_Array_reject_75.$$p, block = $iter || nil, TMP_76, self = this; + + if ($iter) TMP_Array_reject_75.$$p = null; + + + if ($iter) TMP_Array_reject_75.$$p = null;; + if ((block !== nil)) { + } else { + return $send(self, 'enum_for', ["reject"], (TMP_76 = function(){var self = TMP_76.$$s || this; + + return self.$size()}, TMP_76.$$s = self, TMP_76.$$arity = 0, TMP_76)) + }; + + var result = []; + + for (var i = 0, length = self.length, value; i < length; i++) { + value = block(self[i]); + + if (value === false || value === nil) { + result.push(self[i]); + } + } + return result; + ; + }, TMP_Array_reject_75.$$arity = 0); + + Opal.def(self, '$reject!', TMP_Array_reject$B_77 = function() { + var $iter = TMP_Array_reject$B_77.$$p, block = $iter || nil, TMP_78, self = this, original = nil; + + if ($iter) TMP_Array_reject$B_77.$$p = null; + + + if ($iter) TMP_Array_reject$B_77.$$p = null;; + if ((block !== nil)) { + } else { + return $send(self, 'enum_for', ["reject!"], (TMP_78 = function(){var self = TMP_78.$$s || this; + + return self.$size()}, TMP_78.$$s = self, TMP_78.$$arity = 0, TMP_78)) + }; + original = self.$length(); + $send(self, 'delete_if', [], block.$to_proc()); + if (self.$length()['$=='](original)) { + return nil + } else { + return self + }; + }, TMP_Array_reject$B_77.$$arity = 0); + + Opal.def(self, '$replace', TMP_Array_replace_79 = function $$replace(other) { + var self = this; + + + other = (function() {if ($truthy($$($nesting, 'Array')['$==='](other))) { + return other.$to_a() + } else { + return $$($nesting, 'Opal').$coerce_to(other, $$($nesting, 'Array'), "to_ary").$to_a() + }; return nil; })(); + + self.splice(0, self.length); + self.push.apply(self, other); + ; + return self; + }, TMP_Array_replace_79.$$arity = 1); + + Opal.def(self, '$reverse', TMP_Array_reverse_80 = function $$reverse() { + var self = this; + + return self.slice(0).reverse(); + }, TMP_Array_reverse_80.$$arity = 0); + + Opal.def(self, '$reverse!', TMP_Array_reverse$B_81 = function() { + var self = this; + + return self.reverse(); + }, TMP_Array_reverse$B_81.$$arity = 0); + + Opal.def(self, '$reverse_each', TMP_Array_reverse_each_82 = function $$reverse_each() { + var $iter = TMP_Array_reverse_each_82.$$p, block = $iter || nil, TMP_83, self = this; + + if ($iter) TMP_Array_reverse_each_82.$$p = null; + + + if ($iter) TMP_Array_reverse_each_82.$$p = null;; + if ((block !== nil)) { + } else { + return $send(self, 'enum_for', ["reverse_each"], (TMP_83 = function(){var self = TMP_83.$$s || this; + + return self.$size()}, TMP_83.$$s = self, TMP_83.$$arity = 0, TMP_83)) + }; + $send(self.$reverse(), 'each', [], block.$to_proc()); + return self; + }, TMP_Array_reverse_each_82.$$arity = 0); + + Opal.def(self, '$rindex', TMP_Array_rindex_84 = function $$rindex(object) { + var $iter = TMP_Array_rindex_84.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Array_rindex_84.$$p = null; + + + if ($iter) TMP_Array_rindex_84.$$p = null;; + ; + + var i, value; + + if (object != null && block !== nil) { + self.$warn("warning: given block not used") + } + + if (object != null) { + for (i = self.length - 1; i >= 0; i--) { + if (i >= self.length) { + break; + } + if ((self[i])['$=='](object)) { + return i; + } + } + } + else if (block !== nil) { + for (i = self.length - 1; i >= 0; i--) { + if (i >= self.length) { + break; + } + + value = block(self[i]); + + if (value !== false && value !== nil) { + return i; + } + } + } + else if (object == null) { + return self.$enum_for("rindex"); + } + + return nil; + ; + }, TMP_Array_rindex_84.$$arity = -1); + + Opal.def(self, '$rotate', TMP_Array_rotate_85 = function $$rotate(n) { + var self = this; + + + + if (n == null) { + n = 1; + }; + n = $$($nesting, 'Opal').$coerce_to(n, $$($nesting, 'Integer'), "to_int"); + + var ary, idx, firstPart, lastPart; + + if (self.length === 1) { + return self.slice(); + } + if (self.length === 0) { + return []; + } + + ary = self.slice(); + idx = n % ary.length; + + firstPart = ary.slice(idx); + lastPart = ary.slice(0, idx); + return firstPart.concat(lastPart); + ; + }, TMP_Array_rotate_85.$$arity = -1); + + Opal.def(self, '$rotate!', TMP_Array_rotate$B_86 = function(cnt) { + var self = this, ary = nil; + + + + if (cnt == null) { + cnt = 1; + }; + + if (self.length === 0 || self.length === 1) { + return self; + } + ; + cnt = $$($nesting, 'Opal').$coerce_to(cnt, $$($nesting, 'Integer'), "to_int"); + ary = self.$rotate(cnt); + return self.$replace(ary); + }, TMP_Array_rotate$B_86.$$arity = -1); + (function($base, $super, $parent_nesting) { + function $SampleRandom(){}; + var self = $SampleRandom = $klass($base, $super, 'SampleRandom', $SampleRandom); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_SampleRandom_initialize_87, TMP_SampleRandom_rand_88; + + def.rng = nil; + + + Opal.def(self, '$initialize', TMP_SampleRandom_initialize_87 = function $$initialize(rng) { + var self = this; + + return (self.rng = rng) + }, TMP_SampleRandom_initialize_87.$$arity = 1); + return (Opal.def(self, '$rand', TMP_SampleRandom_rand_88 = function $$rand(size) { + var self = this, random = nil; + + + random = $$($nesting, 'Opal').$coerce_to(self.rng.$rand(size), $$($nesting, 'Integer'), "to_int"); + if ($truthy(random < 0)) { + self.$raise($$($nesting, 'RangeError'), "random value must be >= 0")}; + if ($truthy(random < size)) { + } else { + self.$raise($$($nesting, 'RangeError'), "random value must be less than Array size") + }; + return random; + }, TMP_SampleRandom_rand_88.$$arity = 1), nil) && 'rand'; + })($nesting[0], null, $nesting); + + Opal.def(self, '$sample', TMP_Array_sample_89 = function $$sample(count, options) { + var $a, self = this, o = nil, rng = nil; + + + ; + ; + if ($truthy(count === undefined)) { + return self.$at($$($nesting, 'Kernel').$rand(self.length))}; + if ($truthy(options === undefined)) { + if ($truthy((o = $$($nesting, 'Opal')['$coerce_to?'](count, $$($nesting, 'Hash'), "to_hash")))) { + + options = o; + count = nil; + } else { + + options = nil; + count = $$($nesting, 'Opal').$coerce_to(count, $$($nesting, 'Integer'), "to_int"); + } + } else { + + count = $$($nesting, 'Opal').$coerce_to(count, $$($nesting, 'Integer'), "to_int"); + options = $$($nesting, 'Opal').$coerce_to(options, $$($nesting, 'Hash'), "to_hash"); + }; + if ($truthy(($truthy($a = count) ? count < 0 : $a))) { + self.$raise($$($nesting, 'ArgumentError'), "count must be greater than 0")}; + if ($truthy(options)) { + rng = options['$[]']("random")}; + rng = (function() {if ($truthy(($truthy($a = rng) ? rng['$respond_to?']("rand") : $a))) { + return $$($nesting, 'SampleRandom').$new(rng) + } else { + return $$($nesting, 'Kernel') + }; return nil; })(); + if ($truthy(count)) { + } else { + return self[rng.$rand(self.length)] + }; + + + var abandon, spin, result, i, j, k, targetIndex, oldValue; + + if (count > self.length) { + count = self.length; + } + + switch (count) { + case 0: + return []; + break; + case 1: + return [self[rng.$rand(self.length)]]; + break; + case 2: + i = rng.$rand(self.length); + j = rng.$rand(self.length); + if (i === j) { + j = i === 0 ? i + 1 : i - 1; + } + return [self[i], self[j]]; + break; + default: + if (self.length / count > 3) { + abandon = false; + spin = 0; + + result = $$($nesting, 'Array').$new(count); + i = 1; + + result[0] = rng.$rand(self.length); + while (i < count) { + k = rng.$rand(self.length); + j = 0; + + while (j < i) { + while (k === result[j]) { + spin++; + if (spin > 100) { + abandon = true; + break; + } + k = rng.$rand(self.length); + } + if (abandon) { break; } + + j++; + } + + if (abandon) { break; } + + result[i] = k; + + i++; + } + + if (!abandon) { + i = 0; + while (i < count) { + result[i] = self[result[i]]; + i++; + } + + return result; + } + } + + result = self.slice(); + + for (var c = 0; c < count; c++) { + targetIndex = rng.$rand(self.length); + oldValue = result[c]; + result[c] = result[targetIndex]; + result[targetIndex] = oldValue; + } + + return count === self.length ? result : (result)['$[]'](0, count); + } + ; + }, TMP_Array_sample_89.$$arity = -1); + + Opal.def(self, '$select', TMP_Array_select_90 = function $$select() { + var $iter = TMP_Array_select_90.$$p, block = $iter || nil, TMP_91, self = this; + + if ($iter) TMP_Array_select_90.$$p = null; + + + if ($iter) TMP_Array_select_90.$$p = null;; + if ((block !== nil)) { + } else { + return $send(self, 'enum_for', ["select"], (TMP_91 = function(){var self = TMP_91.$$s || this; + + return self.$size()}, TMP_91.$$s = self, TMP_91.$$arity = 0, TMP_91)) + }; + + var result = []; + + for (var i = 0, length = self.length, item, value; i < length; i++) { + item = self[i]; + + value = Opal.yield1(block, item); + + if (Opal.truthy(value)) { + result.push(item); + } + } + + return result; + ; + }, TMP_Array_select_90.$$arity = 0); + + Opal.def(self, '$select!', TMP_Array_select$B_92 = function() { + var $iter = TMP_Array_select$B_92.$$p, block = $iter || nil, TMP_93, self = this; + + if ($iter) TMP_Array_select$B_92.$$p = null; + + + if ($iter) TMP_Array_select$B_92.$$p = null;; + if ((block !== nil)) { + } else { + return $send(self, 'enum_for', ["select!"], (TMP_93 = function(){var self = TMP_93.$$s || this; + + return self.$size()}, TMP_93.$$s = self, TMP_93.$$arity = 0, TMP_93)) + }; + + var original = self.length; + $send(self, 'keep_if', [], block.$to_proc()); + return self.length === original ? nil : self; + ; + }, TMP_Array_select$B_92.$$arity = 0); + + Opal.def(self, '$shift', TMP_Array_shift_94 = function $$shift(count) { + var self = this; + + + ; + if ($truthy(count === undefined)) { + + if ($truthy(self.length === 0)) { + return nil}; + return self.shift();}; + count = $$($nesting, 'Opal').$coerce_to(count, $$($nesting, 'Integer'), "to_int"); + if ($truthy(count < 0)) { + self.$raise($$($nesting, 'ArgumentError'), "negative array size")}; + if ($truthy(self.length === 0)) { + return []}; + return self.splice(0, count);; + }, TMP_Array_shift_94.$$arity = -1); + Opal.alias(self, "size", "length"); + + Opal.def(self, '$shuffle', TMP_Array_shuffle_95 = function $$shuffle(rng) { + var self = this; + + + ; + return self.$dup().$to_a()['$shuffle!'](rng); + }, TMP_Array_shuffle_95.$$arity = -1); + + Opal.def(self, '$shuffle!', TMP_Array_shuffle$B_96 = function(rng) { + var self = this; + + + ; + + var randgen, i = self.length, j, tmp; + + if (rng !== undefined) { + rng = $$($nesting, 'Opal')['$coerce_to?'](rng, $$($nesting, 'Hash'), "to_hash"); + + if (rng !== nil) { + rng = rng['$[]']("random"); + + if (rng !== nil && rng['$respond_to?']("rand")) { + randgen = rng; + } + } + } + + while (i) { + if (randgen) { + j = randgen.$rand(i).$to_int(); + + if (j < 0) { + self.$raise($$($nesting, 'RangeError'), "" + "random number too small " + (j)) + } + + if (j >= i) { + self.$raise($$($nesting, 'RangeError'), "" + "random number too big " + (j)) + } + } + else { + j = self.$rand(i); + } + + tmp = self[--i]; + self[i] = self[j]; + self[j] = tmp; + } + + return self; + ; + }, TMP_Array_shuffle$B_96.$$arity = -1); + Opal.alias(self, "slice", "[]"); + + Opal.def(self, '$slice!', TMP_Array_slice$B_97 = function(index, length) { + var self = this, result = nil, range = nil, range_start = nil, range_end = nil, start = nil; + + + ; + result = nil; + if ($truthy(length === undefined)) { + if ($truthy($$($nesting, 'Range')['$==='](index))) { + + range = index; + result = self['$[]'](range); + range_start = $$($nesting, 'Opal').$coerce_to(range.$begin(), $$($nesting, 'Integer'), "to_int"); + range_end = $$($nesting, 'Opal').$coerce_to(range.$end(), $$($nesting, 'Integer'), "to_int"); + + if (range_start < 0) { + range_start += self.length; + } + + if (range_end < 0) { + range_end += self.length; + } else if (range_end >= self.length) { + range_end = self.length - 1; + if (range.excl) { + range_end += 1; + } + } + + var range_length = range_end - range_start; + if (range.excl) { + range_end -= 1; + } else { + range_length += 1; + } + + if (range_start < self.length && range_start >= 0 && range_end < self.length && range_end >= 0 && range_length > 0) { + self.splice(range_start, range_length); + } + ; + } else { + + start = $$($nesting, 'Opal').$coerce_to(index, $$($nesting, 'Integer'), "to_int"); + + if (start < 0) { + start += self.length; + } + + if (start < 0 || start >= self.length) { + return nil; + } + + result = self[start]; + + if (start === 0) { + self.shift(); + } else { + self.splice(start, 1); + } + ; + } + } else { + + start = $$($nesting, 'Opal').$coerce_to(index, $$($nesting, 'Integer'), "to_int"); + length = $$($nesting, 'Opal').$coerce_to(length, $$($nesting, 'Integer'), "to_int"); + + if (length < 0) { + return nil; + } + + var end = start + length; + + result = self['$[]'](start, length); + + if (start < 0) { + start += self.length; + } + + if (start + length > self.length) { + length = self.length - start; + } + + if (start < self.length && start >= 0) { + self.splice(start, length); + } + ; + }; + return result; + }, TMP_Array_slice$B_97.$$arity = -2); + + Opal.def(self, '$sort', TMP_Array_sort_98 = function $$sort() { + var $iter = TMP_Array_sort_98.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Array_sort_98.$$p = null; + + + if ($iter) TMP_Array_sort_98.$$p = null;; + if ($truthy(self.length > 1)) { + } else { + return self + }; + + if (block === nil) { + block = function(a, b) { + return (a)['$<=>'](b); + }; + } + + return self.slice().sort(function(x, y) { + var ret = block(x, y); + + if (ret === nil) { + self.$raise($$($nesting, 'ArgumentError'), "" + "comparison of " + ((x).$inspect()) + " with " + ((y).$inspect()) + " failed"); + } + + return $rb_gt(ret, 0) ? 1 : ($rb_lt(ret, 0) ? -1 : 0); + }); + ; + }, TMP_Array_sort_98.$$arity = 0); + + Opal.def(self, '$sort!', TMP_Array_sort$B_99 = function() { + var $iter = TMP_Array_sort$B_99.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Array_sort$B_99.$$p = null; + + + if ($iter) TMP_Array_sort$B_99.$$p = null;; + + var result; + + if ((block !== nil)) { + result = $send((self.slice()), 'sort', [], block.$to_proc()); + } + else { + result = (self.slice()).$sort(); + } + + self.length = 0; + for(var i = 0, length = result.length; i < length; i++) { + self.push(result[i]); + } + + return self; + ; + }, TMP_Array_sort$B_99.$$arity = 0); + + Opal.def(self, '$sort_by!', TMP_Array_sort_by$B_100 = function() { + var $iter = TMP_Array_sort_by$B_100.$$p, block = $iter || nil, TMP_101, self = this; + + if ($iter) TMP_Array_sort_by$B_100.$$p = null; + + + if ($iter) TMP_Array_sort_by$B_100.$$p = null;; + if ((block !== nil)) { + } else { + return $send(self, 'enum_for', ["sort_by!"], (TMP_101 = function(){var self = TMP_101.$$s || this; + + return self.$size()}, TMP_101.$$s = self, TMP_101.$$arity = 0, TMP_101)) + }; + return self.$replace($send(self, 'sort_by', [], block.$to_proc())); + }, TMP_Array_sort_by$B_100.$$arity = 0); + + Opal.def(self, '$take', TMP_Array_take_102 = function $$take(count) { + var self = this; + + + if (count < 0) { + self.$raise($$($nesting, 'ArgumentError')); + } + + return self.slice(0, count); + + }, TMP_Array_take_102.$$arity = 1); + + Opal.def(self, '$take_while', TMP_Array_take_while_103 = function $$take_while() { + var $iter = TMP_Array_take_while_103.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Array_take_while_103.$$p = null; + + + if ($iter) TMP_Array_take_while_103.$$p = null;; + + var result = []; + + for (var i = 0, length = self.length, item, value; i < length; i++) { + item = self[i]; + + value = block(item); + + if (value === false || value === nil) { + return result; + } + + result.push(item); + } + + return result; + ; + }, TMP_Array_take_while_103.$$arity = 0); + + Opal.def(self, '$to_a', TMP_Array_to_a_104 = function $$to_a() { + var self = this; + + return self + }, TMP_Array_to_a_104.$$arity = 0); + Opal.alias(self, "to_ary", "to_a"); + + Opal.def(self, '$to_h', TMP_Array_to_h_105 = function $$to_h() { + var self = this; + + + var i, len = self.length, ary, key, val, hash = $hash2([], {}); + + for (i = 0; i < len; i++) { + ary = $$($nesting, 'Opal')['$coerce_to?'](self[i], $$($nesting, 'Array'), "to_ary"); + if (!ary.$$is_array) { + self.$raise($$($nesting, 'TypeError'), "" + "wrong element type " + ((ary).$class()) + " at " + (i) + " (expected array)") + } + if (ary.length !== 2) { + self.$raise($$($nesting, 'ArgumentError'), "" + "wrong array length at " + (i) + " (expected 2, was " + ((ary).$length()) + ")") + } + key = ary[0]; + val = ary[1]; + Opal.hash_put(hash, key, val); + } + + return hash; + + }, TMP_Array_to_h_105.$$arity = 0); + Opal.alias(self, "to_s", "inspect"); + + Opal.def(self, '$transpose', TMP_Array_transpose_106 = function $$transpose() { + var TMP_107, self = this, result = nil, max = nil; + + + if ($truthy(self['$empty?']())) { + return []}; + result = []; + max = nil; + $send(self, 'each', [], (TMP_107 = function(row){var self = TMP_107.$$s || this, $a, TMP_108; + + + + if (row == null) { + row = nil; + }; + row = (function() {if ($truthy($$($nesting, 'Array')['$==='](row))) { + return row.$to_a() + } else { + return $$($nesting, 'Opal').$coerce_to(row, $$($nesting, 'Array'), "to_ary").$to_a() + }; return nil; })(); + max = ($truthy($a = max) ? $a : row.length); + if ($truthy((row.length)['$!='](max))) { + self.$raise($$($nesting, 'IndexError'), "" + "element size differs (" + (row.length) + " should be " + (max) + ")")}; + return $send((row.length), 'times', [], (TMP_108 = function(i){var self = TMP_108.$$s || this, $b, entry = nil, $writer = nil; + + + + if (i == null) { + i = nil; + }; + entry = ($truthy($b = result['$[]'](i)) ? $b : (($writer = [i, []]), $send(result, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + return entry['$<<'](row.$at(i));}, TMP_108.$$s = self, TMP_108.$$arity = 1, TMP_108));}, TMP_107.$$s = self, TMP_107.$$arity = 1, TMP_107)); + return result; + }, TMP_Array_transpose_106.$$arity = 0); + + Opal.def(self, '$uniq', TMP_Array_uniq_109 = function $$uniq() { + var $iter = TMP_Array_uniq_109.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Array_uniq_109.$$p = null; + + + if ($iter) TMP_Array_uniq_109.$$p = null;; + + var hash = $hash2([], {}), i, length, item, key; + + if (block === nil) { + for (i = 0, length = self.length; i < length; i++) { + item = self[i]; + if (Opal.hash_get(hash, item) === undefined) { + Opal.hash_put(hash, item, item); + } + } + } + else { + for (i = 0, length = self.length; i < length; i++) { + item = self[i]; + key = Opal.yield1(block, item); + if (Opal.hash_get(hash, key) === undefined) { + Opal.hash_put(hash, key, item); + } + } + } + + return toArraySubclass((hash).$values(), self.$class()); + ; + }, TMP_Array_uniq_109.$$arity = 0); + + Opal.def(self, '$uniq!', TMP_Array_uniq$B_110 = function() { + var $iter = TMP_Array_uniq$B_110.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Array_uniq$B_110.$$p = null; + + + if ($iter) TMP_Array_uniq$B_110.$$p = null;; + + var original_length = self.length, hash = $hash2([], {}), i, length, item, key; + + for (i = 0, length = original_length; i < length; i++) { + item = self[i]; + key = (block === nil ? item : Opal.yield1(block, item)); + + if (Opal.hash_get(hash, key) === undefined) { + Opal.hash_put(hash, key, item); + continue; + } + + self.splice(i, 1); + length--; + i--; + } + + return self.length === original_length ? nil : self; + ; + }, TMP_Array_uniq$B_110.$$arity = 0); + + Opal.def(self, '$unshift', TMP_Array_unshift_111 = function $$unshift($a) { + var $post_args, objects, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + objects = $post_args;; + + for (var i = objects.length - 1; i >= 0; i--) { + self.unshift(objects[i]); + } + ; + return self; + }, TMP_Array_unshift_111.$$arity = -1); + Opal.alias(self, "prepend", "unshift"); + + Opal.def(self, '$values_at', TMP_Array_values_at_112 = function $$values_at($a) { + var $post_args, args, TMP_113, self = this, out = nil; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + out = []; + $send(args, 'each', [], (TMP_113 = function(elem){var self = TMP_113.$$s || this, TMP_114, finish = nil, start = nil, i = nil; + + + + if (elem == null) { + elem = nil; + }; + if ($truthy(elem['$is_a?']($$($nesting, 'Range')))) { + + finish = $$($nesting, 'Opal').$coerce_to(elem.$last(), $$($nesting, 'Integer'), "to_int"); + start = $$($nesting, 'Opal').$coerce_to(elem.$first(), $$($nesting, 'Integer'), "to_int"); + + if (start < 0) { + start = start + self.length; + return nil;; + } + ; + + if (finish < 0) { + finish = finish + self.length; + } + if (elem['$exclude_end?']()) { + finish--; + } + if (finish < start) { + return nil;; + } + ; + return $send(start, 'upto', [finish], (TMP_114 = function(i){var self = TMP_114.$$s || this; + + + + if (i == null) { + i = nil; + }; + return out['$<<'](self.$at(i));}, TMP_114.$$s = self, TMP_114.$$arity = 1, TMP_114)); + } else { + + i = $$($nesting, 'Opal').$coerce_to(elem, $$($nesting, 'Integer'), "to_int"); + return out['$<<'](self.$at(i)); + };}, TMP_113.$$s = self, TMP_113.$$arity = 1, TMP_113)); + return out; + }, TMP_Array_values_at_112.$$arity = -1); + + Opal.def(self, '$zip', TMP_Array_zip_115 = function $$zip($a) { + var $iter = TMP_Array_zip_115.$$p, block = $iter || nil, $post_args, others, $b, self = this; + + if ($iter) TMP_Array_zip_115.$$p = null; + + + if ($iter) TMP_Array_zip_115.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + others = $post_args;; + + var result = [], size = self.length, part, o, i, j, jj; + + for (j = 0, jj = others.length; j < jj; j++) { + o = others[j]; + if (o.$$is_array) { + continue; + } + if (o.$$is_enumerator) { + if (o.$size() === Infinity) { + others[j] = o.$take(size); + } else { + others[j] = o.$to_a(); + } + continue; + } + others[j] = ($truthy($b = $$($nesting, 'Opal')['$coerce_to?'](o, $$($nesting, 'Array'), "to_ary")) ? $b : $$($nesting, 'Opal')['$coerce_to!'](o, $$($nesting, 'Enumerator'), "each")).$to_a(); + } + + for (i = 0; i < size; i++) { + part = [self[i]]; + + for (j = 0, jj = others.length; j < jj; j++) { + o = others[j][i]; + + if (o == null) { + o = nil; + } + + part[j + 1] = o; + } + + result[i] = part; + } + + if (block !== nil) { + for (i = 0; i < size; i++) { + block(result[i]); + } + + return nil; + } + + return result; + ; + }, TMP_Array_zip_115.$$arity = -1); + Opal.defs(self, '$inherited', TMP_Array_inherited_116 = function $$inherited(klass) { + var self = this; + + + klass.prototype.$to_a = function() { + return this.slice(0, this.length); + } + + }, TMP_Array_inherited_116.$$arity = 1); + + Opal.def(self, '$instance_variables', TMP_Array_instance_variables_117 = function $$instance_variables() { + var TMP_118, $iter = TMP_Array_instance_variables_117.$$p, $yield = $iter || nil, self = this, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_Array_instance_variables_117.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + return $send($send(self, Opal.find_super_dispatcher(self, 'instance_variables', TMP_Array_instance_variables_117, false), $zuper, $iter), 'reject', [], (TMP_118 = function(ivar){var self = TMP_118.$$s || this, $a; + + + + if (ivar == null) { + ivar = nil; + }; + return ($truthy($a = /^@\d+$/.test(ivar)) ? $a : ivar['$==']("@length"));}, TMP_118.$$s = self, TMP_118.$$arity = 1, TMP_118)) + }, TMP_Array_instance_variables_117.$$arity = 0); + $$($nesting, 'Opal').$pristine(self.$singleton_class(), "allocate"); + $$($nesting, 'Opal').$pristine(self, "copy_instance_variables", "initialize_dup"); + return (Opal.def(self, '$pack', TMP_Array_pack_119 = function $$pack($a) { + var $post_args, args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + return self.$raise("To use Array#pack, you must first require 'corelib/array/pack'."); + }, TMP_Array_pack_119.$$arity = -1), nil) && 'pack'; + })($nesting[0], Array, $nesting); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/hash"] = function(Opal) { + function $rb_ge(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs >= rhs : lhs['$>='](rhs); + } + function $rb_gt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); + } + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $send = Opal.send, $hash2 = Opal.hash2, $truthy = Opal.truthy; + + Opal.add_stubs(['$require', '$include', '$coerce_to?', '$[]', '$merge!', '$allocate', '$raise', '$coerce_to!', '$each', '$fetch', '$>=', '$>', '$==', '$compare_by_identity', '$lambda?', '$abs', '$arity', '$enum_for', '$size', '$respond_to?', '$class', '$dig', '$new', '$inspect', '$map', '$to_proc', '$flatten', '$eql?', '$default', '$dup', '$default_proc', '$default_proc=', '$-', '$default=', '$proc']); + + self.$require("corelib/enumerable"); + return (function($base, $super, $parent_nesting) { + function $Hash(){}; + var self = $Hash = $klass($base, $super, 'Hash', $Hash); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Hash_$$_1, TMP_Hash_allocate_2, TMP_Hash_try_convert_3, TMP_Hash_initialize_4, TMP_Hash_$eq$eq_5, TMP_Hash_$gt$eq_6, TMP_Hash_$gt_8, TMP_Hash_$lt_9, TMP_Hash_$lt$eq_10, TMP_Hash_$$_11, TMP_Hash_$$$eq_12, TMP_Hash_assoc_13, TMP_Hash_clear_14, TMP_Hash_clone_15, TMP_Hash_compact_16, TMP_Hash_compact$B_17, TMP_Hash_compare_by_identity_18, TMP_Hash_compare_by_identity$q_19, TMP_Hash_default_20, TMP_Hash_default$eq_21, TMP_Hash_default_proc_22, TMP_Hash_default_proc$eq_23, TMP_Hash_delete_24, TMP_Hash_delete_if_25, TMP_Hash_dig_27, TMP_Hash_each_28, TMP_Hash_each_key_30, TMP_Hash_each_value_32, TMP_Hash_empty$q_34, TMP_Hash_fetch_35, TMP_Hash_fetch_values_36, TMP_Hash_flatten_38, TMP_Hash_has_key$q_39, TMP_Hash_has_value$q_40, TMP_Hash_hash_41, TMP_Hash_index_42, TMP_Hash_indexes_43, TMP_Hash_inspect_44, TMP_Hash_invert_45, TMP_Hash_keep_if_46, TMP_Hash_keys_48, TMP_Hash_length_49, TMP_Hash_merge_50, TMP_Hash_merge$B_51, TMP_Hash_rassoc_52, TMP_Hash_rehash_53, TMP_Hash_reject_54, TMP_Hash_reject$B_56, TMP_Hash_replace_58, TMP_Hash_select_59, TMP_Hash_select$B_61, TMP_Hash_shift_63, TMP_Hash_slice_64, TMP_Hash_to_a_65, TMP_Hash_to_h_66, TMP_Hash_to_hash_67, TMP_Hash_to_proc_68, TMP_Hash_transform_keys_70, TMP_Hash_transform_keys$B_72, TMP_Hash_transform_values_74, TMP_Hash_transform_values$B_76, TMP_Hash_values_78; + + + self.$include($$($nesting, 'Enumerable')); + def.$$is_hash = true; + Opal.defs(self, '$[]', TMP_Hash_$$_1 = function($a) { + var $post_args, argv, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + argv = $post_args;; + + var hash, argc = argv.length, i; + + if (argc === 1) { + hash = $$($nesting, 'Opal')['$coerce_to?'](argv['$[]'](0), $$($nesting, 'Hash'), "to_hash"); + if (hash !== nil) { + return self.$allocate()['$merge!'](hash); + } + + argv = $$($nesting, 'Opal')['$coerce_to?'](argv['$[]'](0), $$($nesting, 'Array'), "to_ary"); + if (argv === nil) { + self.$raise($$($nesting, 'ArgumentError'), "odd number of arguments for Hash") + } + + argc = argv.length; + hash = self.$allocate(); + + for (i = 0; i < argc; i++) { + if (!argv[i].$$is_array) continue; + switch(argv[i].length) { + case 1: + hash.$store(argv[i][0], nil); + break; + case 2: + hash.$store(argv[i][0], argv[i][1]); + break; + default: + self.$raise($$($nesting, 'ArgumentError'), "" + "invalid number of elements (" + (argv[i].length) + " for 1..2)") + } + } + + return hash; + } + + if (argc % 2 !== 0) { + self.$raise($$($nesting, 'ArgumentError'), "odd number of arguments for Hash") + } + + hash = self.$allocate(); + + for (i = 0; i < argc; i += 2) { + hash.$store(argv[i], argv[i + 1]); + } + + return hash; + ; + }, TMP_Hash_$$_1.$$arity = -1); + Opal.defs(self, '$allocate', TMP_Hash_allocate_2 = function $$allocate() { + var self = this; + + + var hash = new self(); + + Opal.hash_init(hash); + + hash.$$none = nil; + hash.$$proc = nil; + + return hash; + + }, TMP_Hash_allocate_2.$$arity = 0); + Opal.defs(self, '$try_convert', TMP_Hash_try_convert_3 = function $$try_convert(obj) { + var self = this; + + return $$($nesting, 'Opal')['$coerce_to?'](obj, $$($nesting, 'Hash'), "to_hash") + }, TMP_Hash_try_convert_3.$$arity = 1); + + Opal.def(self, '$initialize', TMP_Hash_initialize_4 = function $$initialize(defaults) { + var $iter = TMP_Hash_initialize_4.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Hash_initialize_4.$$p = null; + + + if ($iter) TMP_Hash_initialize_4.$$p = null;; + ; + + if (defaults !== undefined && block !== nil) { + self.$raise($$($nesting, 'ArgumentError'), "wrong number of arguments (1 for 0)") + } + self.$$none = (defaults === undefined ? nil : defaults); + self.$$proc = block; + + return self; + ; + }, TMP_Hash_initialize_4.$$arity = -1); + + Opal.def(self, '$==', TMP_Hash_$eq$eq_5 = function(other) { + var self = this; + + + if (self === other) { + return true; + } + + if (!other.$$is_hash) { + return false; + } + + if (self.$$keys.length !== other.$$keys.length) { + return false; + } + + for (var i = 0, keys = self.$$keys, length = keys.length, key, value, other_value; i < length; i++) { + key = keys[i]; + + if (key.$$is_string) { + value = self.$$smap[key]; + other_value = other.$$smap[key]; + } else { + value = key.value; + other_value = Opal.hash_get(other, key.key); + } + + if (other_value === undefined || !value['$eql?'](other_value)) { + return false; + } + } + + return true; + + }, TMP_Hash_$eq$eq_5.$$arity = 1); + + Opal.def(self, '$>=', TMP_Hash_$gt$eq_6 = function(other) { + var TMP_7, self = this, result = nil; + + + other = $$($nesting, 'Opal')['$coerce_to!'](other, $$($nesting, 'Hash'), "to_hash"); + + if (self.$$keys.length < other.$$keys.length) { + return false + } + ; + result = true; + $send(other, 'each', [], (TMP_7 = function(other_key, other_val){var self = TMP_7.$$s || this, val = nil; + + + + if (other_key == null) { + other_key = nil; + }; + + if (other_val == null) { + other_val = nil; + }; + val = self.$fetch(other_key, null); + + if (val == null || val !== other_val) { + result = false; + return; + } + ;}, TMP_7.$$s = self, TMP_7.$$arity = 2, TMP_7)); + return result; + }, TMP_Hash_$gt$eq_6.$$arity = 1); + + Opal.def(self, '$>', TMP_Hash_$gt_8 = function(other) { + var self = this; + + + other = $$($nesting, 'Opal')['$coerce_to!'](other, $$($nesting, 'Hash'), "to_hash"); + + if (self.$$keys.length <= other.$$keys.length) { + return false + } + ; + return $rb_ge(self, other); + }, TMP_Hash_$gt_8.$$arity = 1); + + Opal.def(self, '$<', TMP_Hash_$lt_9 = function(other) { + var self = this; + + + other = $$($nesting, 'Opal')['$coerce_to!'](other, $$($nesting, 'Hash'), "to_hash"); + return $rb_gt(other, self); + }, TMP_Hash_$lt_9.$$arity = 1); + + Opal.def(self, '$<=', TMP_Hash_$lt$eq_10 = function(other) { + var self = this; + + + other = $$($nesting, 'Opal')['$coerce_to!'](other, $$($nesting, 'Hash'), "to_hash"); + return $rb_ge(other, self); + }, TMP_Hash_$lt$eq_10.$$arity = 1); + + Opal.def(self, '$[]', TMP_Hash_$$_11 = function(key) { + var self = this; + + + var value = Opal.hash_get(self, key); + + if (value !== undefined) { + return value; + } + + return self.$default(key); + + }, TMP_Hash_$$_11.$$arity = 1); + + Opal.def(self, '$[]=', TMP_Hash_$$$eq_12 = function(key, value) { + var self = this; + + + Opal.hash_put(self, key, value); + return value; + + }, TMP_Hash_$$$eq_12.$$arity = 2); + + Opal.def(self, '$assoc', TMP_Hash_assoc_13 = function $$assoc(object) { + var self = this; + + + for (var i = 0, keys = self.$$keys, length = keys.length, key; i < length; i++) { + key = keys[i]; + + if (key.$$is_string) { + if ((key)['$=='](object)) { + return [key, self.$$smap[key]]; + } + } else { + if ((key.key)['$=='](object)) { + return [key.key, key.value]; + } + } + } + + return nil; + + }, TMP_Hash_assoc_13.$$arity = 1); + + Opal.def(self, '$clear', TMP_Hash_clear_14 = function $$clear() { + var self = this; + + + Opal.hash_init(self); + return self; + + }, TMP_Hash_clear_14.$$arity = 0); + + Opal.def(self, '$clone', TMP_Hash_clone_15 = function $$clone() { + var self = this; + + + var hash = new self.$$class(); + + Opal.hash_init(hash); + Opal.hash_clone(self, hash); + + return hash; + + }, TMP_Hash_clone_15.$$arity = 0); + + Opal.def(self, '$compact', TMP_Hash_compact_16 = function $$compact() { + var self = this; + + + var hash = Opal.hash(); + + for (var i = 0, keys = self.$$keys, length = keys.length, key, value, obj; i < length; i++) { + key = keys[i]; + + if (key.$$is_string) { + value = self.$$smap[key]; + } else { + value = key.value; + key = key.key; + } + + if (value !== nil) { + Opal.hash_put(hash, key, value); + } + } + + return hash; + + }, TMP_Hash_compact_16.$$arity = 0); + + Opal.def(self, '$compact!', TMP_Hash_compact$B_17 = function() { + var self = this; + + + var changes_were_made = false; + + for (var i = 0, keys = self.$$keys, length = keys.length, key, value, obj; i < length; i++) { + key = keys[i]; + + if (key.$$is_string) { + value = self.$$smap[key]; + } else { + value = key.value; + key = key.key; + } + + if (value === nil) { + if (Opal.hash_delete(self, key) !== undefined) { + changes_were_made = true; + length--; + i--; + } + } + } + + return changes_were_made ? self : nil; + + }, TMP_Hash_compact$B_17.$$arity = 0); + + Opal.def(self, '$compare_by_identity', TMP_Hash_compare_by_identity_18 = function $$compare_by_identity() { + var self = this; + + + var i, ii, key, keys = self.$$keys, identity_hash; + + if (self.$$by_identity) return self; + if (self.$$keys.length === 0) { + self.$$by_identity = true + return self; + } + + identity_hash = $hash2([], {}).$compare_by_identity(); + for(i = 0, ii = keys.length; i < ii; i++) { + key = keys[i]; + if (!key.$$is_string) key = key.key; + Opal.hash_put(identity_hash, key, Opal.hash_get(self, key)); + } + + self.$$by_identity = true; + self.$$map = identity_hash.$$map; + self.$$smap = identity_hash.$$smap; + return self; + + }, TMP_Hash_compare_by_identity_18.$$arity = 0); + + Opal.def(self, '$compare_by_identity?', TMP_Hash_compare_by_identity$q_19 = function() { + var self = this; + + return self.$$by_identity === true; + }, TMP_Hash_compare_by_identity$q_19.$$arity = 0); + + Opal.def(self, '$default', TMP_Hash_default_20 = function(key) { + var self = this; + + + ; + + if (key !== undefined && self.$$proc !== nil && self.$$proc !== undefined) { + return self.$$proc.$call(self, key); + } + if (self.$$none === undefined) { + return nil; + } + return self.$$none; + ; + }, TMP_Hash_default_20.$$arity = -1); + + Opal.def(self, '$default=', TMP_Hash_default$eq_21 = function(object) { + var self = this; + + + self.$$proc = nil; + self.$$none = object; + + return object; + + }, TMP_Hash_default$eq_21.$$arity = 1); + + Opal.def(self, '$default_proc', TMP_Hash_default_proc_22 = function $$default_proc() { + var self = this; + + + if (self.$$proc !== undefined) { + return self.$$proc; + } + return nil; + + }, TMP_Hash_default_proc_22.$$arity = 0); + + Opal.def(self, '$default_proc=', TMP_Hash_default_proc$eq_23 = function(default_proc) { + var self = this; + + + var proc = default_proc; + + if (proc !== nil) { + proc = $$($nesting, 'Opal')['$coerce_to!'](proc, $$($nesting, 'Proc'), "to_proc"); + + if ((proc)['$lambda?']() && (proc).$arity().$abs() !== 2) { + self.$raise($$($nesting, 'TypeError'), "default_proc takes two arguments"); + } + } + + self.$$none = nil; + self.$$proc = proc; + + return default_proc; + + }, TMP_Hash_default_proc$eq_23.$$arity = 1); + + Opal.def(self, '$delete', TMP_Hash_delete_24 = function(key) { + var $iter = TMP_Hash_delete_24.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Hash_delete_24.$$p = null; + + + if ($iter) TMP_Hash_delete_24.$$p = null;; + + var value = Opal.hash_delete(self, key); + + if (value !== undefined) { + return value; + } + + if (block !== nil) { + return Opal.yield1(block, key); + } + + return nil; + ; + }, TMP_Hash_delete_24.$$arity = 1); + + Opal.def(self, '$delete_if', TMP_Hash_delete_if_25 = function $$delete_if() { + var $iter = TMP_Hash_delete_if_25.$$p, block = $iter || nil, TMP_26, self = this; + + if ($iter) TMP_Hash_delete_if_25.$$p = null; + + + if ($iter) TMP_Hash_delete_if_25.$$p = null;; + if ($truthy(block)) { + } else { + return $send(self, 'enum_for', ["delete_if"], (TMP_26 = function(){var self = TMP_26.$$s || this; + + return self.$size()}, TMP_26.$$s = self, TMP_26.$$arity = 0, TMP_26)) + }; + + for (var i = 0, keys = self.$$keys, length = keys.length, key, value, obj; i < length; i++) { + key = keys[i]; + + if (key.$$is_string) { + value = self.$$smap[key]; + } else { + value = key.value; + key = key.key; + } + + obj = block(key, value); + + if (obj !== false && obj !== nil) { + if (Opal.hash_delete(self, key) !== undefined) { + length--; + i--; + } + } + } + + return self; + ; + }, TMP_Hash_delete_if_25.$$arity = 0); + Opal.alias(self, "dup", "clone"); + + Opal.def(self, '$dig', TMP_Hash_dig_27 = function $$dig(key, $a) { + var $post_args, keys, self = this, item = nil; + + + + $post_args = Opal.slice.call(arguments, 1, arguments.length); + + keys = $post_args;; + item = self['$[]'](key); + + if (item === nil || keys.length === 0) { + return item; + } + ; + if ($truthy(item['$respond_to?']("dig"))) { + } else { + self.$raise($$($nesting, 'TypeError'), "" + (item.$class()) + " does not have #dig method") + }; + return $send(item, 'dig', Opal.to_a(keys)); + }, TMP_Hash_dig_27.$$arity = -2); + + Opal.def(self, '$each', TMP_Hash_each_28 = function $$each() { + var $iter = TMP_Hash_each_28.$$p, block = $iter || nil, TMP_29, self = this; + + if ($iter) TMP_Hash_each_28.$$p = null; + + + if ($iter) TMP_Hash_each_28.$$p = null;; + if ($truthy(block)) { + } else { + return $send(self, 'enum_for', ["each"], (TMP_29 = function(){var self = TMP_29.$$s || this; + + return self.$size()}, TMP_29.$$s = self, TMP_29.$$arity = 0, TMP_29)) + }; + + for (var i = 0, keys = self.$$keys, length = keys.length, key, value; i < length; i++) { + key = keys[i]; + + if (key.$$is_string) { + value = self.$$smap[key]; + } else { + value = key.value; + key = key.key; + } + + Opal.yield1(block, [key, value]); + } + + return self; + ; + }, TMP_Hash_each_28.$$arity = 0); + + Opal.def(self, '$each_key', TMP_Hash_each_key_30 = function $$each_key() { + var $iter = TMP_Hash_each_key_30.$$p, block = $iter || nil, TMP_31, self = this; + + if ($iter) TMP_Hash_each_key_30.$$p = null; + + + if ($iter) TMP_Hash_each_key_30.$$p = null;; + if ($truthy(block)) { + } else { + return $send(self, 'enum_for', ["each_key"], (TMP_31 = function(){var self = TMP_31.$$s || this; + + return self.$size()}, TMP_31.$$s = self, TMP_31.$$arity = 0, TMP_31)) + }; + + for (var i = 0, keys = self.$$keys, length = keys.length, key; i < length; i++) { + key = keys[i]; + + block(key.$$is_string ? key : key.key); + } + + return self; + ; + }, TMP_Hash_each_key_30.$$arity = 0); + Opal.alias(self, "each_pair", "each"); + + Opal.def(self, '$each_value', TMP_Hash_each_value_32 = function $$each_value() { + var $iter = TMP_Hash_each_value_32.$$p, block = $iter || nil, TMP_33, self = this; + + if ($iter) TMP_Hash_each_value_32.$$p = null; + + + if ($iter) TMP_Hash_each_value_32.$$p = null;; + if ($truthy(block)) { + } else { + return $send(self, 'enum_for', ["each_value"], (TMP_33 = function(){var self = TMP_33.$$s || this; + + return self.$size()}, TMP_33.$$s = self, TMP_33.$$arity = 0, TMP_33)) + }; + + for (var i = 0, keys = self.$$keys, length = keys.length, key; i < length; i++) { + key = keys[i]; + + block(key.$$is_string ? self.$$smap[key] : key.value); + } + + return self; + ; + }, TMP_Hash_each_value_32.$$arity = 0); + + Opal.def(self, '$empty?', TMP_Hash_empty$q_34 = function() { + var self = this; + + return self.$$keys.length === 0; + }, TMP_Hash_empty$q_34.$$arity = 0); + Opal.alias(self, "eql?", "=="); + + Opal.def(self, '$fetch', TMP_Hash_fetch_35 = function $$fetch(key, defaults) { + var $iter = TMP_Hash_fetch_35.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Hash_fetch_35.$$p = null; + + + if ($iter) TMP_Hash_fetch_35.$$p = null;; + ; + + var value = Opal.hash_get(self, key); + + if (value !== undefined) { + return value; + } + + if (block !== nil) { + return block(key); + } + + if (defaults !== undefined) { + return defaults; + } + ; + return self.$raise($$($nesting, 'KeyError').$new("" + "key not found: " + (key.$inspect()), $hash2(["key", "receiver"], {"key": key, "receiver": self}))); + }, TMP_Hash_fetch_35.$$arity = -2); + + Opal.def(self, '$fetch_values', TMP_Hash_fetch_values_36 = function $$fetch_values($a) { + var $iter = TMP_Hash_fetch_values_36.$$p, block = $iter || nil, $post_args, keys, TMP_37, self = this; + + if ($iter) TMP_Hash_fetch_values_36.$$p = null; + + + if ($iter) TMP_Hash_fetch_values_36.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + keys = $post_args;; + return $send(keys, 'map', [], (TMP_37 = function(key){var self = TMP_37.$$s || this; + + + + if (key == null) { + key = nil; + }; + return $send(self, 'fetch', [key], block.$to_proc());}, TMP_37.$$s = self, TMP_37.$$arity = 1, TMP_37)); + }, TMP_Hash_fetch_values_36.$$arity = -1); + + Opal.def(self, '$flatten', TMP_Hash_flatten_38 = function $$flatten(level) { + var self = this; + + + + if (level == null) { + level = 1; + }; + level = $$($nesting, 'Opal')['$coerce_to!'](level, $$($nesting, 'Integer'), "to_int"); + + var result = []; + + for (var i = 0, keys = self.$$keys, length = keys.length, key, value; i < length; i++) { + key = keys[i]; + + if (key.$$is_string) { + value = self.$$smap[key]; + } else { + value = key.value; + key = key.key; + } + + result.push(key); + + if (value.$$is_array) { + if (level === 1) { + result.push(value); + continue; + } + + result = result.concat((value).$flatten(level - 2)); + continue; + } + + result.push(value); + } + + return result; + ; + }, TMP_Hash_flatten_38.$$arity = -1); + + Opal.def(self, '$has_key?', TMP_Hash_has_key$q_39 = function(key) { + var self = this; + + return Opal.hash_get(self, key) !== undefined; + }, TMP_Hash_has_key$q_39.$$arity = 1); + + Opal.def(self, '$has_value?', TMP_Hash_has_value$q_40 = function(value) { + var self = this; + + + for (var i = 0, keys = self.$$keys, length = keys.length, key; i < length; i++) { + key = keys[i]; + + if (((key.$$is_string ? self.$$smap[key] : key.value))['$=='](value)) { + return true; + } + } + + return false; + + }, TMP_Hash_has_value$q_40.$$arity = 1); + + Opal.def(self, '$hash', TMP_Hash_hash_41 = function $$hash() { + var self = this; + + + var top = (Opal.hash_ids === undefined), + hash_id = self.$object_id(), + result = ['Hash'], + key, item; + + try { + if (top) { + Opal.hash_ids = Object.create(null); + } + + if (Opal[hash_id]) { + return 'self'; + } + + for (key in Opal.hash_ids) { + item = Opal.hash_ids[key]; + if (self['$eql?'](item)) { + return 'self'; + } + } + + Opal.hash_ids[hash_id] = self; + + for (var i = 0, keys = self.$$keys, length = keys.length; i < length; i++) { + key = keys[i]; + + if (key.$$is_string) { + result.push([key, self.$$smap[key].$hash()]); + } else { + result.push([key.key_hash, key.value.$hash()]); + } + } + + return result.sort().join(); + + } finally { + if (top) { + Opal.hash_ids = undefined; + } + } + + }, TMP_Hash_hash_41.$$arity = 0); + Opal.alias(self, "include?", "has_key?"); + + Opal.def(self, '$index', TMP_Hash_index_42 = function $$index(object) { + var self = this; + + + for (var i = 0, keys = self.$$keys, length = keys.length, key, value; i < length; i++) { + key = keys[i]; + + if (key.$$is_string) { + value = self.$$smap[key]; + } else { + value = key.value; + key = key.key; + } + + if ((value)['$=='](object)) { + return key; + } + } + + return nil; + + }, TMP_Hash_index_42.$$arity = 1); + + Opal.def(self, '$indexes', TMP_Hash_indexes_43 = function $$indexes($a) { + var $post_args, args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + + var result = []; + + for (var i = 0, length = args.length, key, value; i < length; i++) { + key = args[i]; + value = Opal.hash_get(self, key); + + if (value === undefined) { + result.push(self.$default()); + continue; + } + + result.push(value); + } + + return result; + ; + }, TMP_Hash_indexes_43.$$arity = -1); + Opal.alias(self, "indices", "indexes"); + var inspect_ids; + + Opal.def(self, '$inspect', TMP_Hash_inspect_44 = function $$inspect() { + var self = this; + + + var top = (inspect_ids === undefined), + hash_id = self.$object_id(), + result = []; + + try { + if (top) { + inspect_ids = {}; + } + + if (inspect_ids.hasOwnProperty(hash_id)) { + return '{...}'; + } + + inspect_ids[hash_id] = true; + + for (var i = 0, keys = self.$$keys, length = keys.length, key, value; i < length; i++) { + key = keys[i]; + + if (key.$$is_string) { + value = self.$$smap[key]; + } else { + value = key.value; + key = key.key; + } + + result.push(key.$inspect() + '=>' + value.$inspect()); + } + + return '{' + result.join(', ') + '}'; + + } finally { + if (top) { + inspect_ids = undefined; + } + } + + }, TMP_Hash_inspect_44.$$arity = 0); + + Opal.def(self, '$invert', TMP_Hash_invert_45 = function $$invert() { + var self = this; + + + var hash = Opal.hash(); + + for (var i = 0, keys = self.$$keys, length = keys.length, key, value; i < length; i++) { + key = keys[i]; + + if (key.$$is_string) { + value = self.$$smap[key]; + } else { + value = key.value; + key = key.key; + } + + Opal.hash_put(hash, value, key); + } + + return hash; + + }, TMP_Hash_invert_45.$$arity = 0); + + Opal.def(self, '$keep_if', TMP_Hash_keep_if_46 = function $$keep_if() { + var $iter = TMP_Hash_keep_if_46.$$p, block = $iter || nil, TMP_47, self = this; + + if ($iter) TMP_Hash_keep_if_46.$$p = null; + + + if ($iter) TMP_Hash_keep_if_46.$$p = null;; + if ($truthy(block)) { + } else { + return $send(self, 'enum_for', ["keep_if"], (TMP_47 = function(){var self = TMP_47.$$s || this; + + return self.$size()}, TMP_47.$$s = self, TMP_47.$$arity = 0, TMP_47)) + }; + + for (var i = 0, keys = self.$$keys, length = keys.length, key, value, obj; i < length; i++) { + key = keys[i]; + + if (key.$$is_string) { + value = self.$$smap[key]; + } else { + value = key.value; + key = key.key; + } + + obj = block(key, value); + + if (obj === false || obj === nil) { + if (Opal.hash_delete(self, key) !== undefined) { + length--; + i--; + } + } + } + + return self; + ; + }, TMP_Hash_keep_if_46.$$arity = 0); + Opal.alias(self, "key", "index"); + Opal.alias(self, "key?", "has_key?"); + + Opal.def(self, '$keys', TMP_Hash_keys_48 = function $$keys() { + var self = this; + + + var result = []; + + for (var i = 0, keys = self.$$keys, length = keys.length, key; i < length; i++) { + key = keys[i]; + + if (key.$$is_string) { + result.push(key); + } else { + result.push(key.key); + } + } + + return result; + + }, TMP_Hash_keys_48.$$arity = 0); + + Opal.def(self, '$length', TMP_Hash_length_49 = function $$length() { + var self = this; + + return self.$$keys.length; + }, TMP_Hash_length_49.$$arity = 0); + Opal.alias(self, "member?", "has_key?"); + + Opal.def(self, '$merge', TMP_Hash_merge_50 = function $$merge(other) { + var $iter = TMP_Hash_merge_50.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Hash_merge_50.$$p = null; + + + if ($iter) TMP_Hash_merge_50.$$p = null;; + return $send(self.$dup(), 'merge!', [other], block.$to_proc()); + }, TMP_Hash_merge_50.$$arity = 1); + + Opal.def(self, '$merge!', TMP_Hash_merge$B_51 = function(other) { + var $iter = TMP_Hash_merge$B_51.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Hash_merge$B_51.$$p = null; + + + if ($iter) TMP_Hash_merge$B_51.$$p = null;; + + if (!other.$$is_hash) { + other = $$($nesting, 'Opal')['$coerce_to!'](other, $$($nesting, 'Hash'), "to_hash"); + } + + var i, other_keys = other.$$keys, length = other_keys.length, key, value, other_value; + + if (block === nil) { + for (i = 0; i < length; i++) { + key = other_keys[i]; + + if (key.$$is_string) { + other_value = other.$$smap[key]; + } else { + other_value = key.value; + key = key.key; + } + + Opal.hash_put(self, key, other_value); + } + + return self; + } + + for (i = 0; i < length; i++) { + key = other_keys[i]; + + if (key.$$is_string) { + other_value = other.$$smap[key]; + } else { + other_value = key.value; + key = key.key; + } + + value = Opal.hash_get(self, key); + + if (value === undefined) { + Opal.hash_put(self, key, other_value); + continue; + } + + Opal.hash_put(self, key, block(key, value, other_value)); + } + + return self; + ; + }, TMP_Hash_merge$B_51.$$arity = 1); + + Opal.def(self, '$rassoc', TMP_Hash_rassoc_52 = function $$rassoc(object) { + var self = this; + + + for (var i = 0, keys = self.$$keys, length = keys.length, key, value; i < length; i++) { + key = keys[i]; + + if (key.$$is_string) { + value = self.$$smap[key]; + } else { + value = key.value; + key = key.key; + } + + if ((value)['$=='](object)) { + return [key, value]; + } + } + + return nil; + + }, TMP_Hash_rassoc_52.$$arity = 1); + + Opal.def(self, '$rehash', TMP_Hash_rehash_53 = function $$rehash() { + var self = this; + + + Opal.hash_rehash(self); + return self; + + }, TMP_Hash_rehash_53.$$arity = 0); + + Opal.def(self, '$reject', TMP_Hash_reject_54 = function $$reject() { + var $iter = TMP_Hash_reject_54.$$p, block = $iter || nil, TMP_55, self = this; + + if ($iter) TMP_Hash_reject_54.$$p = null; + + + if ($iter) TMP_Hash_reject_54.$$p = null;; + if ($truthy(block)) { + } else { + return $send(self, 'enum_for', ["reject"], (TMP_55 = function(){var self = TMP_55.$$s || this; + + return self.$size()}, TMP_55.$$s = self, TMP_55.$$arity = 0, TMP_55)) + }; + + var hash = Opal.hash(); + + for (var i = 0, keys = self.$$keys, length = keys.length, key, value, obj; i < length; i++) { + key = keys[i]; + + if (key.$$is_string) { + value = self.$$smap[key]; + } else { + value = key.value; + key = key.key; + } + + obj = block(key, value); + + if (obj === false || obj === nil) { + Opal.hash_put(hash, key, value); + } + } + + return hash; + ; + }, TMP_Hash_reject_54.$$arity = 0); + + Opal.def(self, '$reject!', TMP_Hash_reject$B_56 = function() { + var $iter = TMP_Hash_reject$B_56.$$p, block = $iter || nil, TMP_57, self = this; + + if ($iter) TMP_Hash_reject$B_56.$$p = null; + + + if ($iter) TMP_Hash_reject$B_56.$$p = null;; + if ($truthy(block)) { + } else { + return $send(self, 'enum_for', ["reject!"], (TMP_57 = function(){var self = TMP_57.$$s || this; + + return self.$size()}, TMP_57.$$s = self, TMP_57.$$arity = 0, TMP_57)) + }; + + var changes_were_made = false; + + for (var i = 0, keys = self.$$keys, length = keys.length, key, value, obj; i < length; i++) { + key = keys[i]; + + if (key.$$is_string) { + value = self.$$smap[key]; + } else { + value = key.value; + key = key.key; + } + + obj = block(key, value); + + if (obj !== false && obj !== nil) { + if (Opal.hash_delete(self, key) !== undefined) { + changes_were_made = true; + length--; + i--; + } + } + } + + return changes_were_made ? self : nil; + ; + }, TMP_Hash_reject$B_56.$$arity = 0); + + Opal.def(self, '$replace', TMP_Hash_replace_58 = function $$replace(other) { + var self = this, $writer = nil; + + + other = $$($nesting, 'Opal')['$coerce_to!'](other, $$($nesting, 'Hash'), "to_hash"); + + Opal.hash_init(self); + + for (var i = 0, other_keys = other.$$keys, length = other_keys.length, key, value, other_value; i < length; i++) { + key = other_keys[i]; + + if (key.$$is_string) { + other_value = other.$$smap[key]; + } else { + other_value = key.value; + key = key.key; + } + + Opal.hash_put(self, key, other_value); + } + ; + if ($truthy(other.$default_proc())) { + + $writer = [other.$default_proc()]; + $send(self, 'default_proc=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + } else { + + $writer = [other.$default()]; + $send(self, 'default=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + return self; + }, TMP_Hash_replace_58.$$arity = 1); + + Opal.def(self, '$select', TMP_Hash_select_59 = function $$select() { + var $iter = TMP_Hash_select_59.$$p, block = $iter || nil, TMP_60, self = this; + + if ($iter) TMP_Hash_select_59.$$p = null; + + + if ($iter) TMP_Hash_select_59.$$p = null;; + if ($truthy(block)) { + } else { + return $send(self, 'enum_for', ["select"], (TMP_60 = function(){var self = TMP_60.$$s || this; + + return self.$size()}, TMP_60.$$s = self, TMP_60.$$arity = 0, TMP_60)) + }; + + var hash = Opal.hash(); + + for (var i = 0, keys = self.$$keys, length = keys.length, key, value, obj; i < length; i++) { + key = keys[i]; + + if (key.$$is_string) { + value = self.$$smap[key]; + } else { + value = key.value; + key = key.key; + } + + obj = block(key, value); + + if (obj !== false && obj !== nil) { + Opal.hash_put(hash, key, value); + } + } + + return hash; + ; + }, TMP_Hash_select_59.$$arity = 0); + + Opal.def(self, '$select!', TMP_Hash_select$B_61 = function() { + var $iter = TMP_Hash_select$B_61.$$p, block = $iter || nil, TMP_62, self = this; + + if ($iter) TMP_Hash_select$B_61.$$p = null; + + + if ($iter) TMP_Hash_select$B_61.$$p = null;; + if ($truthy(block)) { + } else { + return $send(self, 'enum_for', ["select!"], (TMP_62 = function(){var self = TMP_62.$$s || this; + + return self.$size()}, TMP_62.$$s = self, TMP_62.$$arity = 0, TMP_62)) + }; + + var result = nil; + + for (var i = 0, keys = self.$$keys, length = keys.length, key, value, obj; i < length; i++) { + key = keys[i]; + + if (key.$$is_string) { + value = self.$$smap[key]; + } else { + value = key.value; + key = key.key; + } + + obj = block(key, value); + + if (obj === false || obj === nil) { + if (Opal.hash_delete(self, key) !== undefined) { + length--; + i--; + } + result = self; + } + } + + return result; + ; + }, TMP_Hash_select$B_61.$$arity = 0); + + Opal.def(self, '$shift', TMP_Hash_shift_63 = function $$shift() { + var self = this; + + + var keys = self.$$keys, + key; + + if (keys.length > 0) { + key = keys[0]; + + key = key.$$is_string ? key : key.key; + + return [key, Opal.hash_delete(self, key)]; + } + + return self.$default(nil); + + }, TMP_Hash_shift_63.$$arity = 0); + Opal.alias(self, "size", "length"); + + Opal.def(self, '$slice', TMP_Hash_slice_64 = function $$slice($a) { + var $post_args, keys, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + keys = $post_args;; + + var result = Opal.hash(); + + for (var i = 0, length = keys.length; i < length; i++) { + var key = keys[i], value = Opal.hash_get(self, key); + + if (value !== undefined) { + Opal.hash_put(result, key, value); + } + } + + return result; + ; + }, TMP_Hash_slice_64.$$arity = -1); + Opal.alias(self, "store", "[]="); + + Opal.def(self, '$to_a', TMP_Hash_to_a_65 = function $$to_a() { + var self = this; + + + var result = []; + + for (var i = 0, keys = self.$$keys, length = keys.length, key, value; i < length; i++) { + key = keys[i]; + + if (key.$$is_string) { + value = self.$$smap[key]; + } else { + value = key.value; + key = key.key; + } + + result.push([key, value]); + } + + return result; + + }, TMP_Hash_to_a_65.$$arity = 0); + + Opal.def(self, '$to_h', TMP_Hash_to_h_66 = function $$to_h() { + var self = this; + + + if (self.$$class === Opal.Hash) { + return self; + } + + var hash = new Opal.Hash(); + + Opal.hash_init(hash); + Opal.hash_clone(self, hash); + + return hash; + + }, TMP_Hash_to_h_66.$$arity = 0); + + Opal.def(self, '$to_hash', TMP_Hash_to_hash_67 = function $$to_hash() { + var self = this; + + return self + }, TMP_Hash_to_hash_67.$$arity = 0); + + Opal.def(self, '$to_proc', TMP_Hash_to_proc_68 = function $$to_proc() { + var TMP_69, self = this; + + return $send(self, 'proc', [], (TMP_69 = function(key){var self = TMP_69.$$s || this; + + + ; + + if (key == null) { + self.$raise($$($nesting, 'ArgumentError'), "no key given") + } + ; + return self['$[]'](key);}, TMP_69.$$s = self, TMP_69.$$arity = -1, TMP_69)) + }, TMP_Hash_to_proc_68.$$arity = 0); + Opal.alias(self, "to_s", "inspect"); + + Opal.def(self, '$transform_keys', TMP_Hash_transform_keys_70 = function $$transform_keys() { + var $iter = TMP_Hash_transform_keys_70.$$p, block = $iter || nil, TMP_71, self = this; + + if ($iter) TMP_Hash_transform_keys_70.$$p = null; + + + if ($iter) TMP_Hash_transform_keys_70.$$p = null;; + if ($truthy(block)) { + } else { + return $send(self, 'enum_for', ["transform_keys"], (TMP_71 = function(){var self = TMP_71.$$s || this; + + return self.$size()}, TMP_71.$$s = self, TMP_71.$$arity = 0, TMP_71)) + }; + + var result = Opal.hash(); + + for (var i = 0, keys = self.$$keys, length = keys.length, key, value; i < length; i++) { + key = keys[i]; + + if (key.$$is_string) { + value = self.$$smap[key]; + } else { + value = key.value; + key = key.key; + } + + key = Opal.yield1(block, key); + + Opal.hash_put(result, key, value); + } + + return result; + ; + }, TMP_Hash_transform_keys_70.$$arity = 0); + + Opal.def(self, '$transform_keys!', TMP_Hash_transform_keys$B_72 = function() { + var $iter = TMP_Hash_transform_keys$B_72.$$p, block = $iter || nil, TMP_73, self = this; + + if ($iter) TMP_Hash_transform_keys$B_72.$$p = null; + + + if ($iter) TMP_Hash_transform_keys$B_72.$$p = null;; + if ($truthy(block)) { + } else { + return $send(self, 'enum_for', ["transform_keys!"], (TMP_73 = function(){var self = TMP_73.$$s || this; + + return self.$size()}, TMP_73.$$s = self, TMP_73.$$arity = 0, TMP_73)) + }; + + var keys = Opal.slice.call(self.$$keys), + i, length = keys.length, key, value, new_key; + + for (i = 0; i < length; i++) { + key = keys[i]; + + if (key.$$is_string) { + value = self.$$smap[key]; + } else { + value = key.value; + key = key.key; + } + + new_key = Opal.yield1(block, key); + + Opal.hash_delete(self, key); + Opal.hash_put(self, new_key, value); + } + + return self; + ; + }, TMP_Hash_transform_keys$B_72.$$arity = 0); + + Opal.def(self, '$transform_values', TMP_Hash_transform_values_74 = function $$transform_values() { + var $iter = TMP_Hash_transform_values_74.$$p, block = $iter || nil, TMP_75, self = this; + + if ($iter) TMP_Hash_transform_values_74.$$p = null; + + + if ($iter) TMP_Hash_transform_values_74.$$p = null;; + if ($truthy(block)) { + } else { + return $send(self, 'enum_for', ["transform_values"], (TMP_75 = function(){var self = TMP_75.$$s || this; + + return self.$size()}, TMP_75.$$s = self, TMP_75.$$arity = 0, TMP_75)) + }; + + var result = Opal.hash(); + + for (var i = 0, keys = self.$$keys, length = keys.length, key, value; i < length; i++) { + key = keys[i]; + + if (key.$$is_string) { + value = self.$$smap[key]; + } else { + value = key.value; + key = key.key; + } + + value = Opal.yield1(block, value); + + Opal.hash_put(result, key, value); + } + + return result; + ; + }, TMP_Hash_transform_values_74.$$arity = 0); + + Opal.def(self, '$transform_values!', TMP_Hash_transform_values$B_76 = function() { + var $iter = TMP_Hash_transform_values$B_76.$$p, block = $iter || nil, TMP_77, self = this; + + if ($iter) TMP_Hash_transform_values$B_76.$$p = null; + + + if ($iter) TMP_Hash_transform_values$B_76.$$p = null;; + if ($truthy(block)) { + } else { + return $send(self, 'enum_for', ["transform_values!"], (TMP_77 = function(){var self = TMP_77.$$s || this; + + return self.$size()}, TMP_77.$$s = self, TMP_77.$$arity = 0, TMP_77)) + }; + + for (var i = 0, keys = self.$$keys, length = keys.length, key, value; i < length; i++) { + key = keys[i]; + + if (key.$$is_string) { + value = self.$$smap[key]; + } else { + value = key.value; + key = key.key; + } + + value = Opal.yield1(block, value); + + Opal.hash_put(self, key, value); + } + + return self; + ; + }, TMP_Hash_transform_values$B_76.$$arity = 0); + Opal.alias(self, "update", "merge!"); + Opal.alias(self, "value?", "has_value?"); + Opal.alias(self, "values_at", "indexes"); + return (Opal.def(self, '$values', TMP_Hash_values_78 = function $$values() { + var self = this; + + + var result = []; + + for (var i = 0, keys = self.$$keys, length = keys.length, key; i < length; i++) { + key = keys[i]; + + if (key.$$is_string) { + result.push(self.$$smap[key]); + } else { + result.push(key.value); + } + } + + return result; + + }, TMP_Hash_values_78.$$arity = 0), nil) && 'values'; + })($nesting[0], null, $nesting); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/number"] = function(Opal) { + function $rb_gt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); + } + function $rb_lt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); + } + function $rb_plus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); + } + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + function $rb_divide(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs / rhs : lhs['$/'](rhs); + } + function $rb_times(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs * rhs : lhs['$*'](rhs); + } + function $rb_le(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs <= rhs : lhs['$<='](rhs); + } + function $rb_ge(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs >= rhs : lhs['$>='](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $truthy = Opal.truthy, $send = Opal.send, $hash2 = Opal.hash2; + + Opal.add_stubs(['$require', '$bridge', '$raise', '$name', '$class', '$Float', '$respond_to?', '$coerce_to!', '$__coerced__', '$===', '$!', '$>', '$**', '$new', '$<', '$to_f', '$==', '$nan?', '$infinite?', '$enum_for', '$+', '$-', '$gcd', '$lcm', '$%', '$/', '$frexp', '$to_i', '$ldexp', '$rationalize', '$*', '$<<', '$to_r', '$truncate', '$-@', '$size', '$<=', '$>=', '$<=>', '$compare', '$any?']); + + self.$require("corelib/numeric"); + (function($base, $super, $parent_nesting) { + function $Number(){}; + var self = $Number = $klass($base, $super, 'Number', $Number); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Number_coerce_2, TMP_Number___id___3, TMP_Number_$_4, TMP_Number_$_5, TMP_Number_$_6, TMP_Number_$_7, TMP_Number_$_8, TMP_Number_$_9, TMP_Number_$_10, TMP_Number_$_11, TMP_Number_$lt_12, TMP_Number_$lt$eq_13, TMP_Number_$gt_14, TMP_Number_$gt$eq_15, TMP_Number_$lt$eq$gt_16, TMP_Number_$lt$lt_17, TMP_Number_$gt$gt_18, TMP_Number_$$_19, TMP_Number_$$_20, TMP_Number_$$_21, TMP_Number_$_22, TMP_Number_$$_23, TMP_Number_$eq$eq$eq_24, TMP_Number_$eq$eq_25, TMP_Number_abs_26, TMP_Number_abs2_27, TMP_Number_allbits$q_28, TMP_Number_anybits$q_29, TMP_Number_angle_30, TMP_Number_bit_length_31, TMP_Number_ceil_32, TMP_Number_chr_33, TMP_Number_denominator_34, TMP_Number_downto_35, TMP_Number_equal$q_37, TMP_Number_even$q_38, TMP_Number_floor_39, TMP_Number_gcd_40, TMP_Number_gcdlcm_41, TMP_Number_integer$q_42, TMP_Number_is_a$q_43, TMP_Number_instance_of$q_44, TMP_Number_lcm_45, TMP_Number_next_46, TMP_Number_nobits$q_47, TMP_Number_nonzero$q_48, TMP_Number_numerator_49, TMP_Number_odd$q_50, TMP_Number_ord_51, TMP_Number_pow_52, TMP_Number_pred_53, TMP_Number_quo_54, TMP_Number_rationalize_55, TMP_Number_remainder_56, TMP_Number_round_57, TMP_Number_step_58, TMP_Number_times_60, TMP_Number_to_f_62, TMP_Number_to_i_63, TMP_Number_to_r_64, TMP_Number_to_s_65, TMP_Number_truncate_66, TMP_Number_digits_67, TMP_Number_divmod_68, TMP_Number_upto_69, TMP_Number_zero$q_71, TMP_Number_size_72, TMP_Number_nan$q_73, TMP_Number_finite$q_74, TMP_Number_infinite$q_75, TMP_Number_positive$q_76, TMP_Number_negative$q_77; + + + $$($nesting, 'Opal').$bridge(Number, self); + Opal.defineProperty(Number.prototype, '$$is_number', true); + self.$$is_number_class = true; + (function(self, $parent_nesting) { + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_allocate_1; + + + + Opal.def(self, '$allocate', TMP_allocate_1 = function $$allocate() { + var self = this; + + return self.$raise($$($nesting, 'TypeError'), "" + "allocator undefined for " + (self.$name())) + }, TMP_allocate_1.$$arity = 0); + + + Opal.udef(self, '$' + "new");; + return nil;; + })(Opal.get_singleton_class(self), $nesting); + + Opal.def(self, '$coerce', TMP_Number_coerce_2 = function $$coerce(other) { + var self = this; + + + if (other === nil) { + self.$raise($$($nesting, 'TypeError'), "" + "can't convert " + (other.$class()) + " into Float"); + } + else if (other.$$is_string) { + return [self.$Float(other), self]; + } + else if (other['$respond_to?']("to_f")) { + return [$$($nesting, 'Opal')['$coerce_to!'](other, $$($nesting, 'Float'), "to_f"), self]; + } + else if (other.$$is_number) { + return [other, self]; + } + else { + self.$raise($$($nesting, 'TypeError'), "" + "can't convert " + (other.$class()) + " into Float"); + } + + }, TMP_Number_coerce_2.$$arity = 1); + + Opal.def(self, '$__id__', TMP_Number___id___3 = function $$__id__() { + var self = this; + + return (self * 2) + 1; + }, TMP_Number___id___3.$$arity = 0); + Opal.alias(self, "object_id", "__id__"); + + Opal.def(self, '$+', TMP_Number_$_4 = function(other) { + var self = this; + + + if (other.$$is_number) { + return self + other; + } + else { + return self.$__coerced__("+", other); + } + + }, TMP_Number_$_4.$$arity = 1); + + Opal.def(self, '$-', TMP_Number_$_5 = function(other) { + var self = this; + + + if (other.$$is_number) { + return self - other; + } + else { + return self.$__coerced__("-", other); + } + + }, TMP_Number_$_5.$$arity = 1); + + Opal.def(self, '$*', TMP_Number_$_6 = function(other) { + var self = this; + + + if (other.$$is_number) { + return self * other; + } + else { + return self.$__coerced__("*", other); + } + + }, TMP_Number_$_6.$$arity = 1); + + Opal.def(self, '$/', TMP_Number_$_7 = function(other) { + var self = this; + + + if (other.$$is_number) { + return self / other; + } + else { + return self.$__coerced__("/", other); + } + + }, TMP_Number_$_7.$$arity = 1); + Opal.alias(self, "fdiv", "/"); + + Opal.def(self, '$%', TMP_Number_$_8 = function(other) { + var self = this; + + + if (other.$$is_number) { + if (other == -Infinity) { + return other; + } + else if (other == 0) { + self.$raise($$($nesting, 'ZeroDivisionError'), "divided by 0"); + } + else if (other < 0 || self < 0) { + return (self % other + other) % other; + } + else { + return self % other; + } + } + else { + return self.$__coerced__("%", other); + } + + }, TMP_Number_$_8.$$arity = 1); + + Opal.def(self, '$&', TMP_Number_$_9 = function(other) { + var self = this; + + + if (other.$$is_number) { + return self & other; + } + else { + return self.$__coerced__("&", other); + } + + }, TMP_Number_$_9.$$arity = 1); + + Opal.def(self, '$|', TMP_Number_$_10 = function(other) { + var self = this; + + + if (other.$$is_number) { + return self | other; + } + else { + return self.$__coerced__("|", other); + } + + }, TMP_Number_$_10.$$arity = 1); + + Opal.def(self, '$^', TMP_Number_$_11 = function(other) { + var self = this; + + + if (other.$$is_number) { + return self ^ other; + } + else { + return self.$__coerced__("^", other); + } + + }, TMP_Number_$_11.$$arity = 1); + + Opal.def(self, '$<', TMP_Number_$lt_12 = function(other) { + var self = this; + + + if (other.$$is_number) { + return self < other; + } + else { + return self.$__coerced__("<", other); + } + + }, TMP_Number_$lt_12.$$arity = 1); + + Opal.def(self, '$<=', TMP_Number_$lt$eq_13 = function(other) { + var self = this; + + + if (other.$$is_number) { + return self <= other; + } + else { + return self.$__coerced__("<=", other); + } + + }, TMP_Number_$lt$eq_13.$$arity = 1); + + Opal.def(self, '$>', TMP_Number_$gt_14 = function(other) { + var self = this; + + + if (other.$$is_number) { + return self > other; + } + else { + return self.$__coerced__(">", other); + } + + }, TMP_Number_$gt_14.$$arity = 1); + + Opal.def(self, '$>=', TMP_Number_$gt$eq_15 = function(other) { + var self = this; + + + if (other.$$is_number) { + return self >= other; + } + else { + return self.$__coerced__(">=", other); + } + + }, TMP_Number_$gt$eq_15.$$arity = 1); + + var spaceship_operator = function(self, other) { + if (other.$$is_number) { + if (isNaN(self) || isNaN(other)) { + return nil; + } + + if (self > other) { + return 1; + } else if (self < other) { + return -1; + } else { + return 0; + } + } + else { + return self.$__coerced__("<=>", other); + } + } + ; + + Opal.def(self, '$<=>', TMP_Number_$lt$eq$gt_16 = function(other) { + var self = this; + + try { + return spaceship_operator(self, other); + } catch ($err) { + if (Opal.rescue($err, [$$($nesting, 'ArgumentError')])) { + try { + return nil + } finally { Opal.pop_exception() } + } else { throw $err; } + } + }, TMP_Number_$lt$eq$gt_16.$$arity = 1); + + Opal.def(self, '$<<', TMP_Number_$lt$lt_17 = function(count) { + var self = this; + + + count = $$($nesting, 'Opal')['$coerce_to!'](count, $$($nesting, 'Integer'), "to_int"); + return count > 0 ? self << count : self >> -count; + }, TMP_Number_$lt$lt_17.$$arity = 1); + + Opal.def(self, '$>>', TMP_Number_$gt$gt_18 = function(count) { + var self = this; + + + count = $$($nesting, 'Opal')['$coerce_to!'](count, $$($nesting, 'Integer'), "to_int"); + return count > 0 ? self >> count : self << -count; + }, TMP_Number_$gt$gt_18.$$arity = 1); + + Opal.def(self, '$[]', TMP_Number_$$_19 = function(bit) { + var self = this; + + + bit = $$($nesting, 'Opal')['$coerce_to!'](bit, $$($nesting, 'Integer'), "to_int"); + + if (bit < 0) { + return 0; + } + if (bit >= 32) { + return self < 0 ? 1 : 0; + } + return (self >> bit) & 1; + ; + }, TMP_Number_$$_19.$$arity = 1); + + Opal.def(self, '$+@', TMP_Number_$$_20 = function() { + var self = this; + + return +self; + }, TMP_Number_$$_20.$$arity = 0); + + Opal.def(self, '$-@', TMP_Number_$$_21 = function() { + var self = this; + + return -self; + }, TMP_Number_$$_21.$$arity = 0); + + Opal.def(self, '$~', TMP_Number_$_22 = function() { + var self = this; + + return ~self; + }, TMP_Number_$_22.$$arity = 0); + + Opal.def(self, '$**', TMP_Number_$$_23 = function(other) { + var $a, $b, self = this; + + if ($truthy($$($nesting, 'Integer')['$==='](other))) { + if ($truthy(($truthy($a = $$($nesting, 'Integer')['$==='](self)['$!']()) ? $a : $rb_gt(other, 0)))) { + return Math.pow(self, other); + } else { + return $$($nesting, 'Rational').$new(self, 1)['$**'](other) + } + } else if ($truthy((($a = $rb_lt(self, 0)) ? ($truthy($b = $$($nesting, 'Float')['$==='](other)) ? $b : $$($nesting, 'Rational')['$==='](other)) : $rb_lt(self, 0)))) { + return $$($nesting, 'Complex').$new(self, 0)['$**'](other.$to_f()) + } else if ($truthy(other.$$is_number != null)) { + return Math.pow(self, other); + } else { + return self.$__coerced__("**", other) + } + }, TMP_Number_$$_23.$$arity = 1); + + Opal.def(self, '$===', TMP_Number_$eq$eq$eq_24 = function(other) { + var self = this; + + + if (other.$$is_number) { + return self.valueOf() === other.valueOf(); + } + else if (other['$respond_to?']("==")) { + return other['$=='](self); + } + else { + return false; + } + + }, TMP_Number_$eq$eq$eq_24.$$arity = 1); + + Opal.def(self, '$==', TMP_Number_$eq$eq_25 = function(other) { + var self = this; + + + if (other.$$is_number) { + return self.valueOf() === other.valueOf(); + } + else if (other['$respond_to?']("==")) { + return other['$=='](self); + } + else { + return false; + } + + }, TMP_Number_$eq$eq_25.$$arity = 1); + + Opal.def(self, '$abs', TMP_Number_abs_26 = function $$abs() { + var self = this; + + return Math.abs(self); + }, TMP_Number_abs_26.$$arity = 0); + + Opal.def(self, '$abs2', TMP_Number_abs2_27 = function $$abs2() { + var self = this; + + return Math.abs(self * self); + }, TMP_Number_abs2_27.$$arity = 0); + + Opal.def(self, '$allbits?', TMP_Number_allbits$q_28 = function(mask) { + var self = this; + + + mask = $$($nesting, 'Opal')['$coerce_to!'](mask, $$($nesting, 'Integer'), "to_int"); + return (self & mask) == mask;; + }, TMP_Number_allbits$q_28.$$arity = 1); + + Opal.def(self, '$anybits?', TMP_Number_anybits$q_29 = function(mask) { + var self = this; + + + mask = $$($nesting, 'Opal')['$coerce_to!'](mask, $$($nesting, 'Integer'), "to_int"); + return (self & mask) !== 0;; + }, TMP_Number_anybits$q_29.$$arity = 1); + + Opal.def(self, '$angle', TMP_Number_angle_30 = function $$angle() { + var self = this; + + + if ($truthy(self['$nan?']())) { + return self}; + + if (self == 0) { + if (1 / self > 0) { + return 0; + } + else { + return Math.PI; + } + } + else if (self < 0) { + return Math.PI; + } + else { + return 0; + } + ; + }, TMP_Number_angle_30.$$arity = 0); + Opal.alias(self, "arg", "angle"); + Opal.alias(self, "phase", "angle"); + + Opal.def(self, '$bit_length', TMP_Number_bit_length_31 = function $$bit_length() { + var self = this; + + + if ($truthy($$($nesting, 'Integer')['$==='](self))) { + } else { + self.$raise($$($nesting, 'NoMethodError').$new("" + "undefined method `bit_length` for " + (self) + ":Float", "bit_length")) + }; + + if (self === 0 || self === -1) { + return 0; + } + + var result = 0, + value = self < 0 ? ~self : self; + + while (value != 0) { + result += 1; + value >>>= 1; + } + + return result; + ; + }, TMP_Number_bit_length_31.$$arity = 0); + + Opal.def(self, '$ceil', TMP_Number_ceil_32 = function $$ceil(ndigits) { + var self = this; + + + + if (ndigits == null) { + ndigits = 0; + }; + + var f = self.$to_f(); + + if (f % 1 === 0 && ndigits >= 0) { + return f; + } + + var factor = Math.pow(10, ndigits), + result = Math.ceil(f * factor) / factor; + + if (f % 1 === 0) { + result = Math.round(result); + } + + return result; + ; + }, TMP_Number_ceil_32.$$arity = -1); + + Opal.def(self, '$chr', TMP_Number_chr_33 = function $$chr(encoding) { + var self = this; + + + ; + return String.fromCharCode(self);; + }, TMP_Number_chr_33.$$arity = -1); + + Opal.def(self, '$denominator', TMP_Number_denominator_34 = function $$denominator() { + var $a, $iter = TMP_Number_denominator_34.$$p, $yield = $iter || nil, self = this, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_Number_denominator_34.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + if ($truthy(($truthy($a = self['$nan?']()) ? $a : self['$infinite?']()))) { + return 1 + } else { + return $send(self, Opal.find_super_dispatcher(self, 'denominator', TMP_Number_denominator_34, false), $zuper, $iter) + } + }, TMP_Number_denominator_34.$$arity = 0); + + Opal.def(self, '$downto', TMP_Number_downto_35 = function $$downto(stop) { + var $iter = TMP_Number_downto_35.$$p, block = $iter || nil, TMP_36, self = this; + + if ($iter) TMP_Number_downto_35.$$p = null; + + + if ($iter) TMP_Number_downto_35.$$p = null;; + if ((block !== nil)) { + } else { + return $send(self, 'enum_for', ["downto", stop], (TMP_36 = function(){var self = TMP_36.$$s || this; + + + if ($truthy($$($nesting, 'Numeric')['$==='](stop))) { + } else { + self.$raise($$($nesting, 'ArgumentError'), "" + "comparison of " + (self.$class()) + " with " + (stop.$class()) + " failed") + }; + if ($truthy($rb_gt(stop, self))) { + return 0 + } else { + return $rb_plus($rb_minus(self, stop), 1) + };}, TMP_36.$$s = self, TMP_36.$$arity = 0, TMP_36)) + }; + + if (!stop.$$is_number) { + self.$raise($$($nesting, 'ArgumentError'), "" + "comparison of " + (self.$class()) + " with " + (stop.$class()) + " failed") + } + for (var i = self; i >= stop; i--) { + block(i); + } + ; + return self; + }, TMP_Number_downto_35.$$arity = 1); + Opal.alias(self, "eql?", "=="); + + Opal.def(self, '$equal?', TMP_Number_equal$q_37 = function(other) { + var $a, self = this; + + return ($truthy($a = self['$=='](other)) ? $a : isNaN(self) && isNaN(other)) + }, TMP_Number_equal$q_37.$$arity = 1); + + Opal.def(self, '$even?', TMP_Number_even$q_38 = function() { + var self = this; + + return self % 2 === 0; + }, TMP_Number_even$q_38.$$arity = 0); + + Opal.def(self, '$floor', TMP_Number_floor_39 = function $$floor(ndigits) { + var self = this; + + + + if (ndigits == null) { + ndigits = 0; + }; + + var f = self.$to_f(); + + if (f % 1 === 0 && ndigits >= 0) { + return f; + } + + var factor = Math.pow(10, ndigits), + result = Math.floor(f * factor) / factor; + + if (f % 1 === 0) { + result = Math.round(result); + } + + return result; + ; + }, TMP_Number_floor_39.$$arity = -1); + + Opal.def(self, '$gcd', TMP_Number_gcd_40 = function $$gcd(other) { + var self = this; + + + if ($truthy($$($nesting, 'Integer')['$==='](other))) { + } else { + self.$raise($$($nesting, 'TypeError'), "not an integer") + }; + + var min = Math.abs(self), + max = Math.abs(other); + + while (min > 0) { + var tmp = min; + + min = max % min; + max = tmp; + } + + return max; + ; + }, TMP_Number_gcd_40.$$arity = 1); + + Opal.def(self, '$gcdlcm', TMP_Number_gcdlcm_41 = function $$gcdlcm(other) { + var self = this; + + return [self.$gcd(), self.$lcm()] + }, TMP_Number_gcdlcm_41.$$arity = 1); + + Opal.def(self, '$integer?', TMP_Number_integer$q_42 = function() { + var self = this; + + return self % 1 === 0; + }, TMP_Number_integer$q_42.$$arity = 0); + + Opal.def(self, '$is_a?', TMP_Number_is_a$q_43 = function(klass) { + var $a, $iter = TMP_Number_is_a$q_43.$$p, $yield = $iter || nil, self = this, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_Number_is_a$q_43.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + + if ($truthy((($a = klass['$==']($$($nesting, 'Integer'))) ? $$($nesting, 'Integer')['$==='](self) : klass['$==']($$($nesting, 'Integer'))))) { + return true}; + if ($truthy((($a = klass['$==']($$($nesting, 'Integer'))) ? $$($nesting, 'Integer')['$==='](self) : klass['$==']($$($nesting, 'Integer'))))) { + return true}; + if ($truthy((($a = klass['$==']($$($nesting, 'Float'))) ? $$($nesting, 'Float')['$==='](self) : klass['$==']($$($nesting, 'Float'))))) { + return true}; + return $send(self, Opal.find_super_dispatcher(self, 'is_a?', TMP_Number_is_a$q_43, false), $zuper, $iter); + }, TMP_Number_is_a$q_43.$$arity = 1); + Opal.alias(self, "kind_of?", "is_a?"); + + Opal.def(self, '$instance_of?', TMP_Number_instance_of$q_44 = function(klass) { + var $a, $iter = TMP_Number_instance_of$q_44.$$p, $yield = $iter || nil, self = this, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_Number_instance_of$q_44.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + + if ($truthy((($a = klass['$==']($$($nesting, 'Integer'))) ? $$($nesting, 'Integer')['$==='](self) : klass['$==']($$($nesting, 'Integer'))))) { + return true}; + if ($truthy((($a = klass['$==']($$($nesting, 'Integer'))) ? $$($nesting, 'Integer')['$==='](self) : klass['$==']($$($nesting, 'Integer'))))) { + return true}; + if ($truthy((($a = klass['$==']($$($nesting, 'Float'))) ? $$($nesting, 'Float')['$==='](self) : klass['$==']($$($nesting, 'Float'))))) { + return true}; + return $send(self, Opal.find_super_dispatcher(self, 'instance_of?', TMP_Number_instance_of$q_44, false), $zuper, $iter); + }, TMP_Number_instance_of$q_44.$$arity = 1); + + Opal.def(self, '$lcm', TMP_Number_lcm_45 = function $$lcm(other) { + var self = this; + + + if ($truthy($$($nesting, 'Integer')['$==='](other))) { + } else { + self.$raise($$($nesting, 'TypeError'), "not an integer") + }; + + if (self == 0 || other == 0) { + return 0; + } + else { + return Math.abs(self * other / self.$gcd(other)); + } + ; + }, TMP_Number_lcm_45.$$arity = 1); + Opal.alias(self, "magnitude", "abs"); + Opal.alias(self, "modulo", "%"); + + Opal.def(self, '$next', TMP_Number_next_46 = function $$next() { + var self = this; + + return self + 1; + }, TMP_Number_next_46.$$arity = 0); + + Opal.def(self, '$nobits?', TMP_Number_nobits$q_47 = function(mask) { + var self = this; + + + mask = $$($nesting, 'Opal')['$coerce_to!'](mask, $$($nesting, 'Integer'), "to_int"); + return (self & mask) == 0;; + }, TMP_Number_nobits$q_47.$$arity = 1); + + Opal.def(self, '$nonzero?', TMP_Number_nonzero$q_48 = function() { + var self = this; + + return self == 0 ? nil : self; + }, TMP_Number_nonzero$q_48.$$arity = 0); + + Opal.def(self, '$numerator', TMP_Number_numerator_49 = function $$numerator() { + var $a, $iter = TMP_Number_numerator_49.$$p, $yield = $iter || nil, self = this, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_Number_numerator_49.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + if ($truthy(($truthy($a = self['$nan?']()) ? $a : self['$infinite?']()))) { + return self + } else { + return $send(self, Opal.find_super_dispatcher(self, 'numerator', TMP_Number_numerator_49, false), $zuper, $iter) + } + }, TMP_Number_numerator_49.$$arity = 0); + + Opal.def(self, '$odd?', TMP_Number_odd$q_50 = function() { + var self = this; + + return self % 2 !== 0; + }, TMP_Number_odd$q_50.$$arity = 0); + + Opal.def(self, '$ord', TMP_Number_ord_51 = function $$ord() { + var self = this; + + return self + }, TMP_Number_ord_51.$$arity = 0); + + Opal.def(self, '$pow', TMP_Number_pow_52 = function $$pow(b, m) { + var self = this; + + + ; + + if (self == 0) { + self.$raise($$($nesting, 'ZeroDivisionError'), "divided by 0") + } + + if (m === undefined) { + return self['$**'](b); + } else { + if (!($$($nesting, 'Integer')['$==='](b))) { + self.$raise($$($nesting, 'TypeError'), "Integer#pow() 2nd argument not allowed unless a 1st argument is integer") + } + + if (b < 0) { + self.$raise($$($nesting, 'TypeError'), "Integer#pow() 1st argument cannot be negative when 2nd argument specified") + } + + if (!($$($nesting, 'Integer')['$==='](m))) { + self.$raise($$($nesting, 'TypeError'), "Integer#pow() 2nd argument not allowed unless all arguments are integers") + } + + if (m === 0) { + self.$raise($$($nesting, 'ZeroDivisionError'), "divided by 0") + } + + return self['$**'](b)['$%'](m) + } + ; + }, TMP_Number_pow_52.$$arity = -2); + + Opal.def(self, '$pred', TMP_Number_pred_53 = function $$pred() { + var self = this; + + return self - 1; + }, TMP_Number_pred_53.$$arity = 0); + + Opal.def(self, '$quo', TMP_Number_quo_54 = function $$quo(other) { + var $iter = TMP_Number_quo_54.$$p, $yield = $iter || nil, self = this, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_Number_quo_54.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + if ($truthy($$($nesting, 'Integer')['$==='](self))) { + return $send(self, Opal.find_super_dispatcher(self, 'quo', TMP_Number_quo_54, false), $zuper, $iter) + } else { + return $rb_divide(self, other) + } + }, TMP_Number_quo_54.$$arity = 1); + + Opal.def(self, '$rationalize', TMP_Number_rationalize_55 = function $$rationalize(eps) { + var $a, $b, self = this, f = nil, n = nil; + + + ; + + if (arguments.length > 1) { + self.$raise($$($nesting, 'ArgumentError'), "" + "wrong number of arguments (" + (arguments.length) + " for 0..1)"); + } + ; + if ($truthy($$($nesting, 'Integer')['$==='](self))) { + return $$($nesting, 'Rational').$new(self, 1) + } else if ($truthy(self['$infinite?']())) { + return self.$raise($$($nesting, 'FloatDomainError'), "Infinity") + } else if ($truthy(self['$nan?']())) { + return self.$raise($$($nesting, 'FloatDomainError'), "NaN") + } else if ($truthy(eps == null)) { + + $b = $$($nesting, 'Math').$frexp(self), $a = Opal.to_ary($b), (f = ($a[0] == null ? nil : $a[0])), (n = ($a[1] == null ? nil : $a[1])), $b; + f = $$($nesting, 'Math').$ldexp(f, $$$($$($nesting, 'Float'), 'MANT_DIG')).$to_i(); + n = $rb_minus(n, $$$($$($nesting, 'Float'), 'MANT_DIG')); + return $$($nesting, 'Rational').$new($rb_times(2, f), (1)['$<<']($rb_minus(1, n))).$rationalize($$($nesting, 'Rational').$new(1, (1)['$<<']($rb_minus(1, n)))); + } else { + return self.$to_r().$rationalize(eps) + }; + }, TMP_Number_rationalize_55.$$arity = -1); + + Opal.def(self, '$remainder', TMP_Number_remainder_56 = function $$remainder(y) { + var self = this; + + return $rb_minus(self, $rb_times(y, $rb_divide(self, y).$truncate())) + }, TMP_Number_remainder_56.$$arity = 1); + + Opal.def(self, '$round', TMP_Number_round_57 = function $$round(ndigits) { + var $a, $b, self = this, _ = nil, exp = nil; + + + ; + if ($truthy($$($nesting, 'Integer')['$==='](self))) { + + if ($truthy(ndigits == null)) { + return self}; + if ($truthy(($truthy($a = $$($nesting, 'Float')['$==='](ndigits)) ? ndigits['$infinite?']() : $a))) { + self.$raise($$($nesting, 'RangeError'), "Infinity")}; + ndigits = $$($nesting, 'Opal')['$coerce_to!'](ndigits, $$($nesting, 'Integer'), "to_int"); + if ($truthy($rb_lt(ndigits, $$$($$($nesting, 'Integer'), 'MIN')))) { + self.$raise($$($nesting, 'RangeError'), "out of bounds")}; + if ($truthy(ndigits >= 0)) { + return self}; + ndigits = ndigits['$-@'](); + + if (0.415241 * ndigits - 0.125 > self.$size()) { + return 0; + } + + var f = Math.pow(10, ndigits), + x = Math.floor((Math.abs(x) + f / 2) / f) * f; + + return self < 0 ? -x : x; + ; + } else { + + if ($truthy(($truthy($a = self['$nan?']()) ? ndigits == null : $a))) { + self.$raise($$($nesting, 'FloatDomainError'), "NaN")}; + ndigits = $$($nesting, 'Opal')['$coerce_to!'](ndigits || 0, $$($nesting, 'Integer'), "to_int"); + if ($truthy($rb_le(ndigits, 0))) { + if ($truthy(self['$nan?']())) { + self.$raise($$($nesting, 'RangeError'), "NaN") + } else if ($truthy(self['$infinite?']())) { + self.$raise($$($nesting, 'FloatDomainError'), "Infinity")} + } else if (ndigits['$=='](0)) { + return Math.round(self) + } else if ($truthy(($truthy($a = self['$nan?']()) ? $a : self['$infinite?']()))) { + return self}; + $b = $$($nesting, 'Math').$frexp(self), $a = Opal.to_ary($b), (_ = ($a[0] == null ? nil : $a[0])), (exp = ($a[1] == null ? nil : $a[1])), $b; + if ($truthy($rb_ge(ndigits, $rb_minus($rb_plus($$$($$($nesting, 'Float'), 'DIG'), 2), (function() {if ($truthy($rb_gt(exp, 0))) { + return $rb_divide(exp, 4) + } else { + return $rb_minus($rb_divide(exp, 3), 1) + }; return nil; })())))) { + return self}; + if ($truthy($rb_lt(ndigits, (function() {if ($truthy($rb_gt(exp, 0))) { + return $rb_plus($rb_divide(exp, 3), 1) + } else { + return $rb_divide(exp, 4) + }; return nil; })()['$-@']()))) { + return 0}; + return Math.round(self * Math.pow(10, ndigits)) / Math.pow(10, ndigits);; + }; + }, TMP_Number_round_57.$$arity = -1); + + Opal.def(self, '$step', TMP_Number_step_58 = function $$step($a, $b, $c) { + var $iter = TMP_Number_step_58.$$p, block = $iter || nil, $post_args, $kwargs, limit, step, to, by, TMP_59, self = this, positional_args = nil, keyword_args = nil; + + if ($iter) TMP_Number_step_58.$$p = null; + + + if ($iter) TMP_Number_step_58.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + $kwargs = Opal.extract_kwargs($post_args); + + if ($kwargs == null) { + $kwargs = $hash2([], {}); + } else if (!$kwargs.$$is_hash) { + throw Opal.ArgumentError.$new('expected kwargs'); + }; + + if ($post_args.length > 0) { + limit = $post_args[0]; + $post_args.splice(0, 1); + }; + + if ($post_args.length > 0) { + step = $post_args[0]; + $post_args.splice(0, 1); + }; + + to = $kwargs.$$smap["to"];; + + by = $kwargs.$$smap["by"];; + + if (limit !== undefined && to !== undefined) { + self.$raise($$($nesting, 'ArgumentError'), "to is given twice") + } + + if (step !== undefined && by !== undefined) { + self.$raise($$($nesting, 'ArgumentError'), "step is given twice") + } + + function validateParameters() { + if (to !== undefined) { + limit = to; + } + + if (limit === undefined) { + limit = nil; + } + + if (step === nil) { + self.$raise($$($nesting, 'TypeError'), "step must be numeric") + } + + if (step === 0) { + self.$raise($$($nesting, 'ArgumentError'), "step can't be 0") + } + + if (by !== undefined) { + step = by; + } + + if (step === nil || step == null) { + step = 1; + } + + var sign = step['$<=>'](0); + + if (sign === nil) { + self.$raise($$($nesting, 'ArgumentError'), "" + "0 can't be coerced into " + (step.$class())) + } + + if (limit === nil || limit == null) { + limit = sign > 0 ? $$$($$($nesting, 'Float'), 'INFINITY') : $$$($$($nesting, 'Float'), 'INFINITY')['$-@'](); + } + + $$($nesting, 'Opal').$compare(self, limit) + } + + function stepFloatSize() { + if ((step > 0 && self > limit) || (step < 0 && self < limit)) { + return 0; + } else if (step === Infinity || step === -Infinity) { + return 1; + } else { + var abs = Math.abs, floor = Math.floor, + err = (abs(self) + abs(limit) + abs(limit - self)) / abs(step) * $$$($$($nesting, 'Float'), 'EPSILON'); + + if (err === Infinity || err === -Infinity) { + return 0; + } else { + if (err > 0.5) { + err = 0.5; + } + + return floor((limit - self) / step + err) + 1 + } + } + } + + function stepSize() { + validateParameters(); + + if (step === 0) { + return Infinity; + } + + if (step % 1 !== 0) { + return stepFloatSize(); + } else if ((step > 0 && self > limit) || (step < 0 && self < limit)) { + return 0; + } else { + var ceil = Math.ceil, abs = Math.abs, + lhs = abs(self - limit) + 1, + rhs = abs(step); + + return ceil(lhs / rhs); + } + } + ; + if ((block !== nil)) { + } else { + + positional_args = []; + keyword_args = $hash2([], {}); + + if (limit !== undefined) { + positional_args.push(limit); + } + + if (step !== undefined) { + positional_args.push(step); + } + + if (to !== undefined) { + Opal.hash_put(keyword_args, "to", to); + } + + if (by !== undefined) { + Opal.hash_put(keyword_args, "by", by); + } + + if (keyword_args['$any?']()) { + positional_args.push(keyword_args); + } + ; + return $send(self, 'enum_for', ["step"].concat(Opal.to_a(positional_args)), (TMP_59 = function(){var self = TMP_59.$$s || this; + + return stepSize();}, TMP_59.$$s = self, TMP_59.$$arity = 0, TMP_59)); + }; + + validateParameters(); + + if (step === 0) { + while (true) { + block(self); + } + } + + if (self % 1 !== 0 || limit % 1 !== 0 || step % 1 !== 0) { + var n = stepFloatSize(); + + if (n > 0) { + if (step === Infinity || step === -Infinity) { + block(self); + } else { + var i = 0, d; + + if (step > 0) { + while (i < n) { + d = i * step + self; + if (limit < d) { + d = limit; + } + block(d); + i += 1; + } + } else { + while (i < n) { + d = i * step + self; + if (limit > d) { + d = limit; + } + block(d); + i += 1 + } + } + } + } + } else { + var value = self; + + if (step > 0) { + while (value <= limit) { + block(value); + value += step; + } + } else { + while (value >= limit) { + block(value); + value += step + } + } + } + + return self; + ; + }, TMP_Number_step_58.$$arity = -1); + Opal.alias(self, "succ", "next"); + + Opal.def(self, '$times', TMP_Number_times_60 = function $$times() { + var $iter = TMP_Number_times_60.$$p, block = $iter || nil, TMP_61, self = this; + + if ($iter) TMP_Number_times_60.$$p = null; + + + if ($iter) TMP_Number_times_60.$$p = null;; + if ($truthy(block)) { + } else { + return $send(self, 'enum_for', ["times"], (TMP_61 = function(){var self = TMP_61.$$s || this; + + return self}, TMP_61.$$s = self, TMP_61.$$arity = 0, TMP_61)) + }; + + for (var i = 0; i < self; i++) { + block(i); + } + ; + return self; + }, TMP_Number_times_60.$$arity = 0); + + Opal.def(self, '$to_f', TMP_Number_to_f_62 = function $$to_f() { + var self = this; + + return self + }, TMP_Number_to_f_62.$$arity = 0); + + Opal.def(self, '$to_i', TMP_Number_to_i_63 = function $$to_i() { + var self = this; + + return parseInt(self, 10); + }, TMP_Number_to_i_63.$$arity = 0); + Opal.alias(self, "to_int", "to_i"); + + Opal.def(self, '$to_r', TMP_Number_to_r_64 = function $$to_r() { + var $a, $b, self = this, f = nil, e = nil; + + if ($truthy($$($nesting, 'Integer')['$==='](self))) { + return $$($nesting, 'Rational').$new(self, 1) + } else { + + $b = $$($nesting, 'Math').$frexp(self), $a = Opal.to_ary($b), (f = ($a[0] == null ? nil : $a[0])), (e = ($a[1] == null ? nil : $a[1])), $b; + f = $$($nesting, 'Math').$ldexp(f, $$$($$($nesting, 'Float'), 'MANT_DIG')).$to_i(); + e = $rb_minus(e, $$$($$($nesting, 'Float'), 'MANT_DIG')); + return $rb_times(f, $$$($$($nesting, 'Float'), 'RADIX')['$**'](e)).$to_r(); + } + }, TMP_Number_to_r_64.$$arity = 0); + + Opal.def(self, '$to_s', TMP_Number_to_s_65 = function $$to_s(base) { + var $a, self = this; + + + + if (base == null) { + base = 10; + }; + base = $$($nesting, 'Opal')['$coerce_to!'](base, $$($nesting, 'Integer'), "to_int"); + if ($truthy(($truthy($a = $rb_lt(base, 2)) ? $a : $rb_gt(base, 36)))) { + self.$raise($$($nesting, 'ArgumentError'), "" + "invalid radix " + (base))}; + return self.toString(base);; + }, TMP_Number_to_s_65.$$arity = -1); + + Opal.def(self, '$truncate', TMP_Number_truncate_66 = function $$truncate(ndigits) { + var self = this; + + + + if (ndigits == null) { + ndigits = 0; + }; + + var f = self.$to_f(); + + if (f % 1 === 0 && ndigits >= 0) { + return f; + } + + var factor = Math.pow(10, ndigits), + result = parseInt(f * factor, 10) / factor; + + if (f % 1 === 0) { + result = Math.round(result); + } + + return result; + ; + }, TMP_Number_truncate_66.$$arity = -1); + Opal.alias(self, "inspect", "to_s"); + + Opal.def(self, '$digits', TMP_Number_digits_67 = function $$digits(base) { + var self = this; + + + + if (base == null) { + base = 10; + }; + if ($rb_lt(self, 0)) { + self.$raise($$$($$($nesting, 'Math'), 'DomainError'), "out of domain")}; + base = $$($nesting, 'Opal')['$coerce_to!'](base, $$($nesting, 'Integer'), "to_int"); + if ($truthy($rb_lt(base, 2))) { + self.$raise($$($nesting, 'ArgumentError'), "" + "invalid radix " + (base))}; + + var value = self, result = []; + + while (value !== 0) { + result.push(value % base); + value = parseInt(value / base, 10); + } + + return result; + ; + }, TMP_Number_digits_67.$$arity = -1); + + Opal.def(self, '$divmod', TMP_Number_divmod_68 = function $$divmod(other) { + var $a, $iter = TMP_Number_divmod_68.$$p, $yield = $iter || nil, self = this, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_Number_divmod_68.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + if ($truthy(($truthy($a = self['$nan?']()) ? $a : other['$nan?']()))) { + return self.$raise($$($nesting, 'FloatDomainError'), "NaN") + } else if ($truthy(self['$infinite?']())) { + return self.$raise($$($nesting, 'FloatDomainError'), "Infinity") + } else { + return $send(self, Opal.find_super_dispatcher(self, 'divmod', TMP_Number_divmod_68, false), $zuper, $iter) + } + }, TMP_Number_divmod_68.$$arity = 1); + + Opal.def(self, '$upto', TMP_Number_upto_69 = function $$upto(stop) { + var $iter = TMP_Number_upto_69.$$p, block = $iter || nil, TMP_70, self = this; + + if ($iter) TMP_Number_upto_69.$$p = null; + + + if ($iter) TMP_Number_upto_69.$$p = null;; + if ((block !== nil)) { + } else { + return $send(self, 'enum_for', ["upto", stop], (TMP_70 = function(){var self = TMP_70.$$s || this; + + + if ($truthy($$($nesting, 'Numeric')['$==='](stop))) { + } else { + self.$raise($$($nesting, 'ArgumentError'), "" + "comparison of " + (self.$class()) + " with " + (stop.$class()) + " failed") + }; + if ($truthy($rb_lt(stop, self))) { + return 0 + } else { + return $rb_plus($rb_minus(stop, self), 1) + };}, TMP_70.$$s = self, TMP_70.$$arity = 0, TMP_70)) + }; + + if (!stop.$$is_number) { + self.$raise($$($nesting, 'ArgumentError'), "" + "comparison of " + (self.$class()) + " with " + (stop.$class()) + " failed") + } + for (var i = self; i <= stop; i++) { + block(i); + } + ; + return self; + }, TMP_Number_upto_69.$$arity = 1); + + Opal.def(self, '$zero?', TMP_Number_zero$q_71 = function() { + var self = this; + + return self == 0; + }, TMP_Number_zero$q_71.$$arity = 0); + + Opal.def(self, '$size', TMP_Number_size_72 = function $$size() { + var self = this; + + return 4 + }, TMP_Number_size_72.$$arity = 0); + + Opal.def(self, '$nan?', TMP_Number_nan$q_73 = function() { + var self = this; + + return isNaN(self); + }, TMP_Number_nan$q_73.$$arity = 0); + + Opal.def(self, '$finite?', TMP_Number_finite$q_74 = function() { + var self = this; + + return self != Infinity && self != -Infinity && !isNaN(self); + }, TMP_Number_finite$q_74.$$arity = 0); + + Opal.def(self, '$infinite?', TMP_Number_infinite$q_75 = function() { + var self = this; + + + if (self == Infinity) { + return +1; + } + else if (self == -Infinity) { + return -1; + } + else { + return nil; + } + + }, TMP_Number_infinite$q_75.$$arity = 0); + + Opal.def(self, '$positive?', TMP_Number_positive$q_76 = function() { + var self = this; + + return self != 0 && (self == Infinity || 1 / self > 0); + }, TMP_Number_positive$q_76.$$arity = 0); + return (Opal.def(self, '$negative?', TMP_Number_negative$q_77 = function() { + var self = this; + + return self == -Infinity || 1 / self < 0; + }, TMP_Number_negative$q_77.$$arity = 0), nil) && 'negative?'; + })($nesting[0], $$($nesting, 'Numeric'), $nesting); + Opal.const_set($nesting[0], 'Fixnum', $$($nesting, 'Number')); + (function($base, $super, $parent_nesting) { + function $Integer(){}; + var self = $Integer = $klass($base, $super, 'Integer', $Integer); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + + self.$$is_number_class = true; + (function(self, $parent_nesting) { + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_allocate_78, TMP_$eq$eq$eq_79, TMP_sqrt_80; + + + + Opal.def(self, '$allocate', TMP_allocate_78 = function $$allocate() { + var self = this; + + return self.$raise($$($nesting, 'TypeError'), "" + "allocator undefined for " + (self.$name())) + }, TMP_allocate_78.$$arity = 0); + + Opal.udef(self, '$' + "new");; + + Opal.def(self, '$===', TMP_$eq$eq$eq_79 = function(other) { + var self = this; + + + if (!other.$$is_number) { + return false; + } + + return (other % 1) === 0; + + }, TMP_$eq$eq$eq_79.$$arity = 1); + return (Opal.def(self, '$sqrt', TMP_sqrt_80 = function $$sqrt(n) { + var self = this; + + + n = $$($nesting, 'Opal')['$coerce_to!'](n, $$($nesting, 'Integer'), "to_int"); + + if (n < 0) { + self.$raise($$$($$($nesting, 'Math'), 'DomainError'), "Numerical argument is out of domain - \"isqrt\"") + } + + return parseInt(Math.sqrt(n), 10); + ; + }, TMP_sqrt_80.$$arity = 1), nil) && 'sqrt'; + })(Opal.get_singleton_class(self), $nesting); + Opal.const_set($nesting[0], 'MAX', Math.pow(2, 30) - 1); + return Opal.const_set($nesting[0], 'MIN', -Math.pow(2, 30)); + })($nesting[0], $$($nesting, 'Numeric'), $nesting); + return (function($base, $super, $parent_nesting) { + function $Float(){}; + var self = $Float = $klass($base, $super, 'Float', $Float); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + + self.$$is_number_class = true; + (function(self, $parent_nesting) { + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_allocate_81, TMP_$eq$eq$eq_82; + + + + Opal.def(self, '$allocate', TMP_allocate_81 = function $$allocate() { + var self = this; + + return self.$raise($$($nesting, 'TypeError'), "" + "allocator undefined for " + (self.$name())) + }, TMP_allocate_81.$$arity = 0); + + Opal.udef(self, '$' + "new");; + return (Opal.def(self, '$===', TMP_$eq$eq$eq_82 = function(other) { + var self = this; + + return !!other.$$is_number; + }, TMP_$eq$eq$eq_82.$$arity = 1), nil) && '==='; + })(Opal.get_singleton_class(self), $nesting); + Opal.const_set($nesting[0], 'INFINITY', Infinity); + Opal.const_set($nesting[0], 'MAX', Number.MAX_VALUE); + Opal.const_set($nesting[0], 'MIN', Number.MIN_VALUE); + Opal.const_set($nesting[0], 'NAN', NaN); + Opal.const_set($nesting[0], 'DIG', 15); + Opal.const_set($nesting[0], 'MANT_DIG', 53); + Opal.const_set($nesting[0], 'RADIX', 2); + return Opal.const_set($nesting[0], 'EPSILON', Number.EPSILON || 2.2204460492503130808472633361816E-16); + })($nesting[0], $$($nesting, 'Numeric'), $nesting); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/range"] = function(Opal) { + function $rb_le(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs <= rhs : lhs['$<='](rhs); + } + function $rb_lt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); + } + function $rb_gt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); + } + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + function $rb_divide(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs / rhs : lhs['$/'](rhs); + } + function $rb_plus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); + } + function $rb_times(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs * rhs : lhs['$*'](rhs); + } + function $rb_ge(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs >= rhs : lhs['$>='](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $truthy = Opal.truthy, $send = Opal.send; + + Opal.add_stubs(['$require', '$include', '$attr_reader', '$raise', '$<=>', '$include?', '$<=', '$<', '$enum_for', '$upto', '$to_proc', '$respond_to?', '$class', '$succ', '$!', '$==', '$===', '$exclude_end?', '$eql?', '$begin', '$end', '$last', '$to_a', '$>', '$-', '$abs', '$to_i', '$coerce_to!', '$ceil', '$/', '$size', '$loop', '$+', '$*', '$>=', '$each_with_index', '$%', '$bsearch', '$inspect', '$[]', '$hash']); + + self.$require("corelib/enumerable"); + return (function($base, $super, $parent_nesting) { + function $Range(){}; + var self = $Range = $klass($base, $super, 'Range', $Range); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Range_initialize_1, TMP_Range_$eq$eq_2, TMP_Range_$eq$eq$eq_3, TMP_Range_cover$q_4, TMP_Range_each_5, TMP_Range_eql$q_6, TMP_Range_exclude_end$q_7, TMP_Range_first_8, TMP_Range_last_9, TMP_Range_max_10, TMP_Range_min_11, TMP_Range_size_12, TMP_Range_step_13, TMP_Range_bsearch_17, TMP_Range_to_s_18, TMP_Range_inspect_19, TMP_Range_marshal_load_20, TMP_Range_hash_21; + + def.begin = def.end = def.excl = nil; + + self.$include($$($nesting, 'Enumerable')); + def.$$is_range = true; + self.$attr_reader("begin", "end"); + + Opal.def(self, '$initialize', TMP_Range_initialize_1 = function $$initialize(first, last, exclude) { + var self = this; + + + + if (exclude == null) { + exclude = false; + }; + if ($truthy(self.begin)) { + self.$raise($$($nesting, 'NameError'), "'initialize' called twice")}; + if ($truthy(first['$<=>'](last))) { + } else { + self.$raise($$($nesting, 'ArgumentError'), "bad value for range") + }; + self.begin = first; + self.end = last; + return (self.excl = exclude); + }, TMP_Range_initialize_1.$$arity = -3); + + Opal.def(self, '$==', TMP_Range_$eq$eq_2 = function(other) { + var self = this; + + + if (!other.$$is_range) { + return false; + } + + return self.excl === other.excl && + self.begin == other.begin && + self.end == other.end; + + }, TMP_Range_$eq$eq_2.$$arity = 1); + + Opal.def(self, '$===', TMP_Range_$eq$eq$eq_3 = function(value) { + var self = this; + + return self['$include?'](value) + }, TMP_Range_$eq$eq$eq_3.$$arity = 1); + + Opal.def(self, '$cover?', TMP_Range_cover$q_4 = function(value) { + var $a, self = this, beg_cmp = nil, end_cmp = nil; + + + beg_cmp = self.begin['$<=>'](value); + if ($truthy(($truthy($a = beg_cmp) ? $rb_le(beg_cmp, 0) : $a))) { + } else { + return false + }; + end_cmp = value['$<=>'](self.end); + if ($truthy(self.excl)) { + return ($truthy($a = end_cmp) ? $rb_lt(end_cmp, 0) : $a) + } else { + return ($truthy($a = end_cmp) ? $rb_le(end_cmp, 0) : $a) + }; + }, TMP_Range_cover$q_4.$$arity = 1); + + Opal.def(self, '$each', TMP_Range_each_5 = function $$each() { + var $iter = TMP_Range_each_5.$$p, block = $iter || nil, $a, self = this, current = nil, last = nil; + + if ($iter) TMP_Range_each_5.$$p = null; + + + if ($iter) TMP_Range_each_5.$$p = null;; + if ((block !== nil)) { + } else { + return self.$enum_for("each") + }; + + var i, limit; + + if (self.begin.$$is_number && self.end.$$is_number) { + if (self.begin % 1 !== 0 || self.end % 1 !== 0) { + self.$raise($$($nesting, 'TypeError'), "can't iterate from Float") + } + + for (i = self.begin, limit = self.end + (function() {if ($truthy(self.excl)) { + return 0 + } else { + return 1 + }; return nil; })(); i < limit; i++) { + block(i); + } + + return self; + } + + if (self.begin.$$is_string && self.end.$$is_string) { + $send(self.begin, 'upto', [self.end, self.excl], block.$to_proc()) + return self; + } + ; + current = self.begin; + last = self.end; + if ($truthy(current['$respond_to?']("succ"))) { + } else { + self.$raise($$($nesting, 'TypeError'), "" + "can't iterate from " + (current.$class())) + }; + while ($truthy($rb_lt(current['$<=>'](last), 0))) { + + Opal.yield1(block, current); + current = current.$succ(); + }; + if ($truthy(($truthy($a = self.excl['$!']()) ? current['$=='](last) : $a))) { + Opal.yield1(block, current)}; + return self; + }, TMP_Range_each_5.$$arity = 0); + + Opal.def(self, '$eql?', TMP_Range_eql$q_6 = function(other) { + var $a, $b, self = this; + + + if ($truthy($$($nesting, 'Range')['$==='](other))) { + } else { + return false + }; + return ($truthy($a = ($truthy($b = self.excl['$==='](other['$exclude_end?']())) ? self.begin['$eql?'](other.$begin()) : $b)) ? self.end['$eql?'](other.$end()) : $a); + }, TMP_Range_eql$q_6.$$arity = 1); + + Opal.def(self, '$exclude_end?', TMP_Range_exclude_end$q_7 = function() { + var self = this; + + return self.excl + }, TMP_Range_exclude_end$q_7.$$arity = 0); + + Opal.def(self, '$first', TMP_Range_first_8 = function $$first(n) { + var $iter = TMP_Range_first_8.$$p, $yield = $iter || nil, self = this, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_Range_first_8.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + + ; + if ($truthy(n == null)) { + return self.begin}; + return $send(self, Opal.find_super_dispatcher(self, 'first', TMP_Range_first_8, false), $zuper, $iter); + }, TMP_Range_first_8.$$arity = -1); + Opal.alias(self, "include?", "cover?"); + + Opal.def(self, '$last', TMP_Range_last_9 = function $$last(n) { + var self = this; + + + ; + if ($truthy(n == null)) { + return self.end}; + return self.$to_a().$last(n); + }, TMP_Range_last_9.$$arity = -1); + + Opal.def(self, '$max', TMP_Range_max_10 = function $$max() { + var $a, $iter = TMP_Range_max_10.$$p, $yield = $iter || nil, self = this, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_Range_max_10.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + if (($yield !== nil)) { + return $send(self, Opal.find_super_dispatcher(self, 'max', TMP_Range_max_10, false), $zuper, $iter) + } else if ($truthy($rb_gt(self.begin, self.end))) { + return nil + } else if ($truthy(($truthy($a = self.excl) ? self.begin['$=='](self.end) : $a))) { + return nil + } else { + return self.excl ? self.end - 1 : self.end + } + }, TMP_Range_max_10.$$arity = 0); + Opal.alias(self, "member?", "cover?"); + + Opal.def(self, '$min', TMP_Range_min_11 = function $$min() { + var $a, $iter = TMP_Range_min_11.$$p, $yield = $iter || nil, self = this, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_Range_min_11.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + if (($yield !== nil)) { + return $send(self, Opal.find_super_dispatcher(self, 'min', TMP_Range_min_11, false), $zuper, $iter) + } else if ($truthy($rb_gt(self.begin, self.end))) { + return nil + } else if ($truthy(($truthy($a = self.excl) ? self.begin['$=='](self.end) : $a))) { + return nil + } else { + return self.begin + } + }, TMP_Range_min_11.$$arity = 0); + + Opal.def(self, '$size', TMP_Range_size_12 = function $$size() { + var $a, self = this, range_begin = nil, range_end = nil, infinity = nil; + + + range_begin = self.begin; + range_end = self.end; + if ($truthy(self.excl)) { + range_end = $rb_minus(range_end, 1)}; + if ($truthy(($truthy($a = $$($nesting, 'Numeric')['$==='](range_begin)) ? $$($nesting, 'Numeric')['$==='](range_end) : $a))) { + } else { + return nil + }; + if ($truthy($rb_lt(range_end, range_begin))) { + return 0}; + infinity = $$$($$($nesting, 'Float'), 'INFINITY'); + if ($truthy([range_begin.$abs(), range_end.$abs()]['$include?'](infinity))) { + return infinity}; + return (Math.abs(range_end - range_begin) + 1).$to_i(); + }, TMP_Range_size_12.$$arity = 0); + + Opal.def(self, '$step', TMP_Range_step_13 = function $$step(n) { + var TMP_14, TMP_15, TMP_16, $iter = TMP_Range_step_13.$$p, $yield = $iter || nil, self = this, i = nil; + + if ($iter) TMP_Range_step_13.$$p = null; + + + if (n == null) { + n = 1; + }; + + function coerceStepSize() { + if (!n.$$is_number) { + n = $$($nesting, 'Opal')['$coerce_to!'](n, $$($nesting, 'Integer'), "to_int") + } + + if (n < 0) { + self.$raise($$($nesting, 'ArgumentError'), "step can't be negative") + } else if (n === 0) { + self.$raise($$($nesting, 'ArgumentError'), "step can't be 0") + } + } + + function enumeratorSize() { + if (!self.begin['$respond_to?']("succ")) { + return nil; + } + + if (self.begin.$$is_string && self.end.$$is_string) { + return nil; + } + + if (n % 1 === 0) { + return $rb_divide(self.$size(), n).$ceil(); + } else { + // n is a float + var begin = self.begin, end = self.end, + abs = Math.abs, floor = Math.floor, + err = (abs(begin) + abs(end) + abs(end - begin)) / abs(n) * $$$($$($nesting, 'Float'), 'EPSILON'), + size; + + if (err > 0.5) { + err = 0.5; + } + + if (self.excl) { + size = floor((end - begin) / n - err); + if (size * n + begin < end) { + size++; + } + } else { + size = floor((end - begin) / n + err) + 1 + } + + return size; + } + } + ; + if (($yield !== nil)) { + } else { + return $send(self, 'enum_for', ["step", n], (TMP_14 = function(){var self = TMP_14.$$s || this; + + + coerceStepSize(); + return enumeratorSize(); + }, TMP_14.$$s = self, TMP_14.$$arity = 0, TMP_14)) + }; + coerceStepSize(); + if ($truthy(self.begin.$$is_number && self.end.$$is_number)) { + + i = 0; + (function(){var $brk = Opal.new_brk(); try {return $send(self, 'loop', [], (TMP_15 = function(){var self = TMP_15.$$s || this, current = nil; + if (self.begin == null) self.begin = nil; + if (self.excl == null) self.excl = nil; + if (self.end == null) self.end = nil; + + + current = $rb_plus(self.begin, $rb_times(i, n)); + if ($truthy(self.excl)) { + if ($truthy($rb_ge(current, self.end))) { + + Opal.brk(nil, $brk)} + } else if ($truthy($rb_gt(current, self.end))) { + + Opal.brk(nil, $brk)}; + Opal.yield1($yield, current); + return (i = $rb_plus(i, 1));}, TMP_15.$$s = self, TMP_15.$$brk = $brk, TMP_15.$$arity = 0, TMP_15)) + } catch (err) { if (err === $brk) { return err.$v } else { throw err } }})(); + } else { + + + if (self.begin.$$is_string && self.end.$$is_string && n % 1 !== 0) { + self.$raise($$($nesting, 'TypeError'), "no implicit conversion to float from string") + } + ; + $send(self, 'each_with_index', [], (TMP_16 = function(value, idx){var self = TMP_16.$$s || this; + + + + if (value == null) { + value = nil; + }; + + if (idx == null) { + idx = nil; + }; + if (idx['$%'](n)['$=='](0)) { + return Opal.yield1($yield, value); + } else { + return nil + };}, TMP_16.$$s = self, TMP_16.$$arity = 2, TMP_16)); + }; + return self; + }, TMP_Range_step_13.$$arity = -1); + + Opal.def(self, '$bsearch', TMP_Range_bsearch_17 = function $$bsearch() { + var $iter = TMP_Range_bsearch_17.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Range_bsearch_17.$$p = null; + + + if ($iter) TMP_Range_bsearch_17.$$p = null;; + if ((block !== nil)) { + } else { + return self.$enum_for("bsearch") + }; + if ($truthy(self.begin.$$is_number && self.end.$$is_number)) { + } else { + self.$raise($$($nesting, 'TypeError'), "" + "can't do binary search for " + (self.begin.$class())) + }; + return $send(self.$to_a(), 'bsearch', [], block.$to_proc()); + }, TMP_Range_bsearch_17.$$arity = 0); + + Opal.def(self, '$to_s', TMP_Range_to_s_18 = function $$to_s() { + var self = this; + + return "" + (self.begin) + ((function() {if ($truthy(self.excl)) { + return "..." + } else { + return ".." + }; return nil; })()) + (self.end) + }, TMP_Range_to_s_18.$$arity = 0); + + Opal.def(self, '$inspect', TMP_Range_inspect_19 = function $$inspect() { + var self = this; + + return "" + (self.begin.$inspect()) + ((function() {if ($truthy(self.excl)) { + return "..." + } else { + return ".." + }; return nil; })()) + (self.end.$inspect()) + }, TMP_Range_inspect_19.$$arity = 0); + + Opal.def(self, '$marshal_load', TMP_Range_marshal_load_20 = function $$marshal_load(args) { + var self = this; + + + self.begin = args['$[]']("begin"); + self.end = args['$[]']("end"); + return (self.excl = args['$[]']("excl")); + }, TMP_Range_marshal_load_20.$$arity = 1); + return (Opal.def(self, '$hash', TMP_Range_hash_21 = function $$hash() { + var self = this; + + return [self.begin, self.end, self.excl].$hash() + }, TMP_Range_hash_21.$$arity = 0), nil) && 'hash'; + })($nesting[0], null, $nesting); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/proc"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $truthy = Opal.truthy; + + Opal.add_stubs(['$raise', '$coerce_to!']); + return (function($base, $super, $parent_nesting) { + function $Proc(){}; + var self = $Proc = $klass($base, $super, 'Proc', $Proc); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Proc_new_1, TMP_Proc_call_2, TMP_Proc_to_proc_3, TMP_Proc_lambda$q_4, TMP_Proc_arity_5, TMP_Proc_source_location_6, TMP_Proc_binding_7, TMP_Proc_parameters_8, TMP_Proc_curry_9, TMP_Proc_dup_10; + + + Opal.defineProperty(Function.prototype, '$$is_proc', true); + Opal.defineProperty(Function.prototype, '$$is_lambda', false); + Opal.defs(self, '$new', TMP_Proc_new_1 = function() { + var $iter = TMP_Proc_new_1.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Proc_new_1.$$p = null; + + + if ($iter) TMP_Proc_new_1.$$p = null;; + if ($truthy(block)) { + } else { + self.$raise($$($nesting, 'ArgumentError'), "tried to create a Proc object without a block") + }; + return block; + }, TMP_Proc_new_1.$$arity = 0); + + Opal.def(self, '$call', TMP_Proc_call_2 = function $$call($a) { + var $iter = TMP_Proc_call_2.$$p, block = $iter || nil, $post_args, args, self = this; + + if ($iter) TMP_Proc_call_2.$$p = null; + + + if ($iter) TMP_Proc_call_2.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + + if (block !== nil) { + self.$$p = block; + } + + var result, $brk = self.$$brk; + + if ($brk) { + try { + if (self.$$is_lambda) { + result = self.apply(null, args); + } + else { + result = Opal.yieldX(self, args); + } + } catch (err) { + if (err === $brk) { + return $brk.$v + } + else { + throw err + } + } + } + else { + if (self.$$is_lambda) { + result = self.apply(null, args); + } + else { + result = Opal.yieldX(self, args); + } + } + + return result; + ; + }, TMP_Proc_call_2.$$arity = -1); + Opal.alias(self, "[]", "call"); + Opal.alias(self, "===", "call"); + Opal.alias(self, "yield", "call"); + + Opal.def(self, '$to_proc', TMP_Proc_to_proc_3 = function $$to_proc() { + var self = this; + + return self + }, TMP_Proc_to_proc_3.$$arity = 0); + + Opal.def(self, '$lambda?', TMP_Proc_lambda$q_4 = function() { + var self = this; + + return !!self.$$is_lambda; + }, TMP_Proc_lambda$q_4.$$arity = 0); + + Opal.def(self, '$arity', TMP_Proc_arity_5 = function $$arity() { + var self = this; + + + if (self.$$is_curried) { + return -1; + } else { + return self.$$arity; + } + + }, TMP_Proc_arity_5.$$arity = 0); + + Opal.def(self, '$source_location', TMP_Proc_source_location_6 = function $$source_location() { + var self = this; + + + if (self.$$is_curried) { return nil; }; + return nil; + }, TMP_Proc_source_location_6.$$arity = 0); + + Opal.def(self, '$binding', TMP_Proc_binding_7 = function $$binding() { + var self = this; + + + if (self.$$is_curried) { self.$raise($$($nesting, 'ArgumentError'), "Can't create Binding") }; + return nil; + }, TMP_Proc_binding_7.$$arity = 0); + + Opal.def(self, '$parameters', TMP_Proc_parameters_8 = function $$parameters() { + var self = this; + + + if (self.$$is_curried) { + return [["rest"]]; + } else if (self.$$parameters) { + if (self.$$is_lambda) { + return self.$$parameters; + } else { + var result = [], i, length; + + for (i = 0, length = self.$$parameters.length; i < length; i++) { + var parameter = self.$$parameters[i]; + + if (parameter[0] === 'req') { + // required arguments always have name + parameter = ['opt', parameter[1]]; + } + + result.push(parameter); + } + + return result; + } + } else { + return []; + } + + }, TMP_Proc_parameters_8.$$arity = 0); + + Opal.def(self, '$curry', TMP_Proc_curry_9 = function $$curry(arity) { + var self = this; + + + ; + + if (arity === undefined) { + arity = self.length; + } + else { + arity = $$($nesting, 'Opal')['$coerce_to!'](arity, $$($nesting, 'Integer'), "to_int"); + if (self.$$is_lambda && arity !== self.length) { + self.$raise($$($nesting, 'ArgumentError'), "" + "wrong number of arguments (" + (arity) + " for " + (self.length) + ")") + } + } + + function curried () { + var args = $slice.call(arguments), + length = args.length, + result; + + if (length > arity && self.$$is_lambda && !self.$$is_curried) { + self.$raise($$($nesting, 'ArgumentError'), "" + "wrong number of arguments (" + (length) + " for " + (arity) + ")") + } + + if (length >= arity) { + return self.$call.apply(self, args); + } + + result = function () { + return curried.apply(null, + args.concat($slice.call(arguments))); + } + result.$$is_lambda = self.$$is_lambda; + result.$$is_curried = true; + + return result; + }; + + curried.$$is_lambda = self.$$is_lambda; + curried.$$is_curried = true; + return curried; + ; + }, TMP_Proc_curry_9.$$arity = -1); + + Opal.def(self, '$dup', TMP_Proc_dup_10 = function $$dup() { + var self = this; + + + var original_proc = self.$$original_proc || self, + proc = function () { + return original_proc.apply(this, arguments); + }; + + for (var prop in self) { + if (self.hasOwnProperty(prop)) { + proc[prop] = self[prop]; + } + } + + return proc; + + }, TMP_Proc_dup_10.$$arity = 0); + return Opal.alias(self, "clone", "dup"); + })($nesting[0], Function, $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/method"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $truthy = Opal.truthy; + + Opal.add_stubs(['$attr_reader', '$arity', '$new', '$class', '$join', '$source_location', '$raise']); + + (function($base, $super, $parent_nesting) { + function $Method(){}; + var self = $Method = $klass($base, $super, 'Method', $Method); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Method_initialize_1, TMP_Method_arity_2, TMP_Method_parameters_3, TMP_Method_source_location_4, TMP_Method_comments_5, TMP_Method_call_6, TMP_Method_unbind_7, TMP_Method_to_proc_8, TMP_Method_inspect_9; + + def.method = def.receiver = def.owner = def.name = nil; + + self.$attr_reader("owner", "receiver", "name"); + + Opal.def(self, '$initialize', TMP_Method_initialize_1 = function $$initialize(receiver, owner, method, name) { + var self = this; + + + self.receiver = receiver; + self.owner = owner; + self.name = name; + return (self.method = method); + }, TMP_Method_initialize_1.$$arity = 4); + + Opal.def(self, '$arity', TMP_Method_arity_2 = function $$arity() { + var self = this; + + return self.method.$arity() + }, TMP_Method_arity_2.$$arity = 0); + + Opal.def(self, '$parameters', TMP_Method_parameters_3 = function $$parameters() { + var self = this; + + return self.method.$$parameters + }, TMP_Method_parameters_3.$$arity = 0); + + Opal.def(self, '$source_location', TMP_Method_source_location_4 = function $$source_location() { + var $a, self = this; + + return ($truthy($a = self.method.$$source_location) ? $a : ["(eval)", 0]) + }, TMP_Method_source_location_4.$$arity = 0); + + Opal.def(self, '$comments', TMP_Method_comments_5 = function $$comments() { + var $a, self = this; + + return ($truthy($a = self.method.$$comments) ? $a : []) + }, TMP_Method_comments_5.$$arity = 0); + + Opal.def(self, '$call', TMP_Method_call_6 = function $$call($a) { + var $iter = TMP_Method_call_6.$$p, block = $iter || nil, $post_args, args, self = this; + + if ($iter) TMP_Method_call_6.$$p = null; + + + if ($iter) TMP_Method_call_6.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + + self.method.$$p = block; + + return self.method.apply(self.receiver, args); + ; + }, TMP_Method_call_6.$$arity = -1); + Opal.alias(self, "[]", "call"); + + Opal.def(self, '$unbind', TMP_Method_unbind_7 = function $$unbind() { + var self = this; + + return $$($nesting, 'UnboundMethod').$new(self.receiver.$class(), self.owner, self.method, self.name) + }, TMP_Method_unbind_7.$$arity = 0); + + Opal.def(self, '$to_proc', TMP_Method_to_proc_8 = function $$to_proc() { + var self = this; + + + var proc = self.$call.bind(self); + proc.$$unbound = self.method; + proc.$$is_lambda = true; + return proc; + + }, TMP_Method_to_proc_8.$$arity = 0); + return (Opal.def(self, '$inspect', TMP_Method_inspect_9 = function $$inspect() { + var self = this; + + return "" + "#<" + (self.$class()) + ": " + (self.receiver.$class()) + "#" + (self.name) + " (defined in " + (self.owner) + " in " + (self.$source_location().$join(":")) + ")>" + }, TMP_Method_inspect_9.$$arity = 0), nil) && 'inspect'; + })($nesting[0], null, $nesting); + return (function($base, $super, $parent_nesting) { + function $UnboundMethod(){}; + var self = $UnboundMethod = $klass($base, $super, 'UnboundMethod', $UnboundMethod); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_UnboundMethod_initialize_10, TMP_UnboundMethod_arity_11, TMP_UnboundMethod_parameters_12, TMP_UnboundMethod_source_location_13, TMP_UnboundMethod_comments_14, TMP_UnboundMethod_bind_15, TMP_UnboundMethod_inspect_16; + + def.method = def.owner = def.name = def.source = nil; + + self.$attr_reader("source", "owner", "name"); + + Opal.def(self, '$initialize', TMP_UnboundMethod_initialize_10 = function $$initialize(source, owner, method, name) { + var self = this; + + + self.source = source; + self.owner = owner; + self.method = method; + return (self.name = name); + }, TMP_UnboundMethod_initialize_10.$$arity = 4); + + Opal.def(self, '$arity', TMP_UnboundMethod_arity_11 = function $$arity() { + var self = this; + + return self.method.$arity() + }, TMP_UnboundMethod_arity_11.$$arity = 0); + + Opal.def(self, '$parameters', TMP_UnboundMethod_parameters_12 = function $$parameters() { + var self = this; + + return self.method.$$parameters + }, TMP_UnboundMethod_parameters_12.$$arity = 0); + + Opal.def(self, '$source_location', TMP_UnboundMethod_source_location_13 = function $$source_location() { + var $a, self = this; + + return ($truthy($a = self.method.$$source_location) ? $a : ["(eval)", 0]) + }, TMP_UnboundMethod_source_location_13.$$arity = 0); + + Opal.def(self, '$comments', TMP_UnboundMethod_comments_14 = function $$comments() { + var $a, self = this; + + return ($truthy($a = self.method.$$comments) ? $a : []) + }, TMP_UnboundMethod_comments_14.$$arity = 0); + + Opal.def(self, '$bind', TMP_UnboundMethod_bind_15 = function $$bind(object) { + var self = this; + + + if (self.owner.$$is_module || Opal.is_a(object, self.owner)) { + return $$($nesting, 'Method').$new(object, self.owner, self.method, self.name); + } + else { + self.$raise($$($nesting, 'TypeError'), "" + "can't bind singleton method to a different class (expected " + (object) + ".kind_of?(" + (self.owner) + " to be true)"); + } + + }, TMP_UnboundMethod_bind_15.$$arity = 1); + return (Opal.def(self, '$inspect', TMP_UnboundMethod_inspect_16 = function $$inspect() { + var self = this; + + return "" + "#<" + (self.$class()) + ": " + (self.source) + "#" + (self.name) + " (defined in " + (self.owner) + " in " + (self.$source_location().$join(":")) + ")>" + }, TMP_UnboundMethod_inspect_16.$$arity = 0), nil) && 'inspect'; + })($nesting[0], null, $nesting); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/variables"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $gvars = Opal.gvars, $hash2 = Opal.hash2; + + Opal.add_stubs(['$new']); + + $gvars['&'] = $gvars['~'] = $gvars['`'] = $gvars["'"] = nil; + $gvars.LOADED_FEATURES = ($gvars["\""] = Opal.loaded_features); + $gvars.LOAD_PATH = ($gvars[":"] = []); + $gvars["/"] = "\n"; + $gvars[","] = nil; + Opal.const_set($nesting[0], 'ARGV', []); + Opal.const_set($nesting[0], 'ARGF', $$($nesting, 'Object').$new()); + Opal.const_set($nesting[0], 'ENV', $hash2([], {})); + $gvars.VERBOSE = false; + $gvars.DEBUG = false; + return ($gvars.SAFE = 0); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["opal/regexp_anchors"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module; + + Opal.add_stubs(['$==', '$new']); + return (function($base, $parent_nesting) { + function $Opal() {}; + var self = $Opal = $module($base, 'Opal', $Opal); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + + Opal.const_set($nesting[0], 'REGEXP_START', (function() {if ($$($nesting, 'RUBY_ENGINE')['$==']("opal")) { + return "^" + } else { + return nil + }; return nil; })()); + Opal.const_set($nesting[0], 'REGEXP_END', (function() {if ($$($nesting, 'RUBY_ENGINE')['$==']("opal")) { + return "$" + } else { + return nil + }; return nil; })()); + Opal.const_set($nesting[0], 'FORBIDDEN_STARTING_IDENTIFIER_CHARS', "\\u0001-\\u002F\\u003A-\\u0040\\u005B-\\u005E\\u0060\\u007B-\\u007F"); + Opal.const_set($nesting[0], 'FORBIDDEN_ENDING_IDENTIFIER_CHARS', "\\u0001-\\u0020\\u0022-\\u002F\\u003A-\\u003E\\u0040\\u005B-\\u005E\\u0060\\u007B-\\u007F"); + Opal.const_set($nesting[0], 'INLINE_IDENTIFIER_REGEXP', $$($nesting, 'Regexp').$new("" + "[^" + ($$($nesting, 'FORBIDDEN_STARTING_IDENTIFIER_CHARS')) + "]*[^" + ($$($nesting, 'FORBIDDEN_ENDING_IDENTIFIER_CHARS')) + "]")); + Opal.const_set($nesting[0], 'FORBIDDEN_CONST_NAME_CHARS', "\\u0001-\\u0020\\u0021-\\u002F\\u003B-\\u003F\\u0040\\u005B-\\u005E\\u0060\\u007B-\\u007F"); + Opal.const_set($nesting[0], 'CONST_NAME_REGEXP', $$($nesting, 'Regexp').$new("" + ($$($nesting, 'REGEXP_START')) + "(::)?[A-Z][^" + ($$($nesting, 'FORBIDDEN_CONST_NAME_CHARS')) + "]*" + ($$($nesting, 'REGEXP_END')))); + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["opal/mini"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice; + + Opal.add_stubs(['$require']); + + self.$require("opal/base"); + self.$require("corelib/nil"); + self.$require("corelib/boolean"); + self.$require("corelib/string"); + self.$require("corelib/comparable"); + self.$require("corelib/enumerable"); + self.$require("corelib/enumerator"); + self.$require("corelib/array"); + self.$require("corelib/hash"); + self.$require("corelib/number"); + self.$require("corelib/range"); + self.$require("corelib/proc"); + self.$require("corelib/method"); + self.$require("corelib/regexp"); + self.$require("corelib/variables"); + return self.$require("opal/regexp_anchors"); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/string/encoding"] = function(Opal) { + function $rb_plus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); + } + var TMP_12, TMP_15, TMP_18, TMP_21, TMP_24, self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $hash2 = Opal.hash2, $truthy = Opal.truthy, $send = Opal.send; + + Opal.add_stubs(['$require', '$+', '$[]', '$new', '$to_proc', '$each', '$const_set', '$sub', '$==', '$default_external', '$upcase', '$raise', '$attr_accessor', '$attr_reader', '$register', '$length', '$bytes', '$to_a', '$each_byte', '$bytesize', '$enum_for', '$force_encoding', '$dup', '$coerce_to!', '$find', '$getbyte']); + + self.$require("corelib/string"); + (function($base, $super, $parent_nesting) { + function $Encoding(){}; + var self = $Encoding = $klass($base, $super, 'Encoding', $Encoding); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Encoding_register_1, TMP_Encoding_find_3, TMP_Encoding_initialize_4, TMP_Encoding_ascii_compatible$q_5, TMP_Encoding_dummy$q_6, TMP_Encoding_to_s_7, TMP_Encoding_inspect_8, TMP_Encoding_each_byte_9, TMP_Encoding_getbyte_10, TMP_Encoding_bytesize_11; + + def.ascii = def.dummy = def.name = nil; + + Opal.defineProperty(self, '$$register', {}); + Opal.defs(self, '$register', TMP_Encoding_register_1 = function $$register(name, options) { + var $iter = TMP_Encoding_register_1.$$p, block = $iter || nil, $a, TMP_2, self = this, names = nil, encoding = nil, register = nil; + + if ($iter) TMP_Encoding_register_1.$$p = null; + + + if ($iter) TMP_Encoding_register_1.$$p = null;; + + if (options == null) { + options = $hash2([], {}); + }; + names = $rb_plus([name], ($truthy($a = options['$[]']("aliases")) ? $a : [])); + encoding = $send($$($nesting, 'Class'), 'new', [self], block.$to_proc()).$new(name, names, ($truthy($a = options['$[]']("ascii")) ? $a : false), ($truthy($a = options['$[]']("dummy")) ? $a : false)); + register = self["$$register"]; + return $send(names, 'each', [], (TMP_2 = function(encoding_name){var self = TMP_2.$$s || this; + + + + if (encoding_name == null) { + encoding_name = nil; + }; + self.$const_set(encoding_name.$sub("-", "_"), encoding); + return register["" + "$$" + (encoding_name)] = encoding;}, TMP_2.$$s = self, TMP_2.$$arity = 1, TMP_2)); + }, TMP_Encoding_register_1.$$arity = -2); + Opal.defs(self, '$find', TMP_Encoding_find_3 = function $$find(name) { + var $a, self = this, register = nil, encoding = nil; + + + if (name['$==']("default_external")) { + return self.$default_external()}; + register = self["$$register"]; + encoding = ($truthy($a = register["" + "$$" + (name)]) ? $a : register["" + "$$" + (name.$upcase())]); + if ($truthy(encoding)) { + } else { + self.$raise($$($nesting, 'ArgumentError'), "" + "unknown encoding name - " + (name)) + }; + return encoding; + }, TMP_Encoding_find_3.$$arity = 1); + (function(self, $parent_nesting) { + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return self.$attr_accessor("default_external") + })(Opal.get_singleton_class(self), $nesting); + self.$attr_reader("name", "names"); + + Opal.def(self, '$initialize', TMP_Encoding_initialize_4 = function $$initialize(name, names, ascii, dummy) { + var self = this; + + + self.name = name; + self.names = names; + self.ascii = ascii; + return (self.dummy = dummy); + }, TMP_Encoding_initialize_4.$$arity = 4); + + Opal.def(self, '$ascii_compatible?', TMP_Encoding_ascii_compatible$q_5 = function() { + var self = this; + + return self.ascii + }, TMP_Encoding_ascii_compatible$q_5.$$arity = 0); + + Opal.def(self, '$dummy?', TMP_Encoding_dummy$q_6 = function() { + var self = this; + + return self.dummy + }, TMP_Encoding_dummy$q_6.$$arity = 0); + + Opal.def(self, '$to_s', TMP_Encoding_to_s_7 = function $$to_s() { + var self = this; + + return self.name + }, TMP_Encoding_to_s_7.$$arity = 0); + + Opal.def(self, '$inspect', TMP_Encoding_inspect_8 = function $$inspect() { + var self = this; + + return "" + "#" + }, TMP_Encoding_inspect_8.$$arity = 0); + + Opal.def(self, '$each_byte', TMP_Encoding_each_byte_9 = function $$each_byte($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return self.$raise($$($nesting, 'NotImplementedError')); + }, TMP_Encoding_each_byte_9.$$arity = -1); + + Opal.def(self, '$getbyte', TMP_Encoding_getbyte_10 = function $$getbyte($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return self.$raise($$($nesting, 'NotImplementedError')); + }, TMP_Encoding_getbyte_10.$$arity = -1); + + Opal.def(self, '$bytesize', TMP_Encoding_bytesize_11 = function $$bytesize($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return self.$raise($$($nesting, 'NotImplementedError')); + }, TMP_Encoding_bytesize_11.$$arity = -1); + (function($base, $super, $parent_nesting) { + function $EncodingError(){}; + var self = $EncodingError = $klass($base, $super, 'EncodingError', $EncodingError); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return nil + })($nesting[0], $$($nesting, 'StandardError'), $nesting); + return (function($base, $super, $parent_nesting) { + function $CompatibilityError(){}; + var self = $CompatibilityError = $klass($base, $super, 'CompatibilityError', $CompatibilityError); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return nil + })($nesting[0], $$($nesting, 'EncodingError'), $nesting); + })($nesting[0], null, $nesting); + $send($$($nesting, 'Encoding'), 'register', ["UTF-8", $hash2(["aliases", "ascii"], {"aliases": ["CP65001"], "ascii": true})], (TMP_12 = function(){var self = TMP_12.$$s || this, TMP_each_byte_13, TMP_bytesize_14; + + + + Opal.def(self, '$each_byte', TMP_each_byte_13 = function $$each_byte(string) { + var $iter = TMP_each_byte_13.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_each_byte_13.$$p = null; + + + if ($iter) TMP_each_byte_13.$$p = null;; + + for (var i = 0, length = string.length; i < length; i++) { + var code = string.charCodeAt(i); + + if (code <= 0x7f) { + Opal.yield1(block, code); + } + else { + var encoded = encodeURIComponent(string.charAt(i)).substr(1).split('%'); + + for (var j = 0, encoded_length = encoded.length; j < encoded_length; j++) { + Opal.yield1(block, parseInt(encoded[j], 16)); + } + } + } + ; + }, TMP_each_byte_13.$$arity = 1); + return (Opal.def(self, '$bytesize', TMP_bytesize_14 = function $$bytesize(string) { + var self = this; + + return string.$bytes().$length() + }, TMP_bytesize_14.$$arity = 1), nil) && 'bytesize';}, TMP_12.$$s = self, TMP_12.$$arity = 0, TMP_12)); + $send($$($nesting, 'Encoding'), 'register', ["UTF-16LE"], (TMP_15 = function(){var self = TMP_15.$$s || this, TMP_each_byte_16, TMP_bytesize_17; + + + + Opal.def(self, '$each_byte', TMP_each_byte_16 = function $$each_byte(string) { + var $iter = TMP_each_byte_16.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_each_byte_16.$$p = null; + + + if ($iter) TMP_each_byte_16.$$p = null;; + + for (var i = 0, length = string.length; i < length; i++) { + var code = string.charCodeAt(i); + + Opal.yield1(block, code & 0xff); + Opal.yield1(block, code >> 8); + } + ; + }, TMP_each_byte_16.$$arity = 1); + return (Opal.def(self, '$bytesize', TMP_bytesize_17 = function $$bytesize(string) { + var self = this; + + return string.$bytes().$length() + }, TMP_bytesize_17.$$arity = 1), nil) && 'bytesize';}, TMP_15.$$s = self, TMP_15.$$arity = 0, TMP_15)); + $send($$($nesting, 'Encoding'), 'register', ["UTF-16BE"], (TMP_18 = function(){var self = TMP_18.$$s || this, TMP_each_byte_19, TMP_bytesize_20; + + + + Opal.def(self, '$each_byte', TMP_each_byte_19 = function $$each_byte(string) { + var $iter = TMP_each_byte_19.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_each_byte_19.$$p = null; + + + if ($iter) TMP_each_byte_19.$$p = null;; + + for (var i = 0, length = string.length; i < length; i++) { + var code = string.charCodeAt(i); + + Opal.yield1(block, code >> 8); + Opal.yield1(block, code & 0xff); + } + ; + }, TMP_each_byte_19.$$arity = 1); + return (Opal.def(self, '$bytesize', TMP_bytesize_20 = function $$bytesize(string) { + var self = this; + + return string.$bytes().$length() + }, TMP_bytesize_20.$$arity = 1), nil) && 'bytesize';}, TMP_18.$$s = self, TMP_18.$$arity = 0, TMP_18)); + $send($$($nesting, 'Encoding'), 'register', ["UTF-32LE"], (TMP_21 = function(){var self = TMP_21.$$s || this, TMP_each_byte_22, TMP_bytesize_23; + + + + Opal.def(self, '$each_byte', TMP_each_byte_22 = function $$each_byte(string) { + var $iter = TMP_each_byte_22.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_each_byte_22.$$p = null; + + + if ($iter) TMP_each_byte_22.$$p = null;; + + for (var i = 0, length = string.length; i < length; i++) { + var code = string.charCodeAt(i); + + Opal.yield1(block, code & 0xff); + Opal.yield1(block, code >> 8); + } + ; + }, TMP_each_byte_22.$$arity = 1); + return (Opal.def(self, '$bytesize', TMP_bytesize_23 = function $$bytesize(string) { + var self = this; + + return string.$bytes().$length() + }, TMP_bytesize_23.$$arity = 1), nil) && 'bytesize';}, TMP_21.$$s = self, TMP_21.$$arity = 0, TMP_21)); + $send($$($nesting, 'Encoding'), 'register', ["ASCII-8BIT", $hash2(["aliases", "ascii", "dummy"], {"aliases": ["BINARY", "US-ASCII", "ASCII"], "ascii": true, "dummy": true})], (TMP_24 = function(){var self = TMP_24.$$s || this, TMP_each_byte_25, TMP_bytesize_26; + + + + Opal.def(self, '$each_byte', TMP_each_byte_25 = function $$each_byte(string) { + var $iter = TMP_each_byte_25.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_each_byte_25.$$p = null; + + + if ($iter) TMP_each_byte_25.$$p = null;; + + for (var i = 0, length = string.length; i < length; i++) { + var code = string.charCodeAt(i); + Opal.yield1(block, code & 0xff); + Opal.yield1(block, code >> 8); + } + ; + }, TMP_each_byte_25.$$arity = 1); + return (Opal.def(self, '$bytesize', TMP_bytesize_26 = function $$bytesize(string) { + var self = this; + + return string.$bytes().$length() + }, TMP_bytesize_26.$$arity = 1), nil) && 'bytesize';}, TMP_24.$$s = self, TMP_24.$$arity = 0, TMP_24)); + return (function($base, $super, $parent_nesting) { + function $String(){}; + var self = $String = $klass($base, $super, 'String', $String); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_String_bytes_27, TMP_String_bytesize_28, TMP_String_each_byte_29, TMP_String_encode_30, TMP_String_force_encoding_31, TMP_String_getbyte_32, TMP_String_valid_encoding$q_33; + + def.encoding = nil; + + self.$attr_reader("encoding"); + Opal.defineProperty(String.prototype, 'encoding', $$$($$($nesting, 'Encoding'), 'UTF_16LE')); + + Opal.def(self, '$bytes', TMP_String_bytes_27 = function $$bytes() { + var self = this; + + return self.$each_byte().$to_a() + }, TMP_String_bytes_27.$$arity = 0); + + Opal.def(self, '$bytesize', TMP_String_bytesize_28 = function $$bytesize() { + var self = this; + + return self.encoding.$bytesize(self) + }, TMP_String_bytesize_28.$$arity = 0); + + Opal.def(self, '$each_byte', TMP_String_each_byte_29 = function $$each_byte() { + var $iter = TMP_String_each_byte_29.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_String_each_byte_29.$$p = null; + + + if ($iter) TMP_String_each_byte_29.$$p = null;; + if ((block !== nil)) { + } else { + return self.$enum_for("each_byte") + }; + $send(self.encoding, 'each_byte', [self], block.$to_proc()); + return self; + }, TMP_String_each_byte_29.$$arity = 0); + + Opal.def(self, '$encode', TMP_String_encode_30 = function $$encode(encoding) { + var self = this; + + return self.$dup().$force_encoding(encoding) + }, TMP_String_encode_30.$$arity = 1); + + Opal.def(self, '$force_encoding', TMP_String_force_encoding_31 = function $$force_encoding(encoding) { + var self = this; + + + if (encoding === self.encoding) { return self; } + + encoding = $$($nesting, 'Opal')['$coerce_to!'](encoding, $$($nesting, 'String'), "to_s"); + encoding = $$($nesting, 'Encoding').$find(encoding); + + if (encoding === self.encoding) { return self; } + + self.encoding = encoding; + return self; + + }, TMP_String_force_encoding_31.$$arity = 1); + + Opal.def(self, '$getbyte', TMP_String_getbyte_32 = function $$getbyte(idx) { + var self = this; + + return self.encoding.$getbyte(self, idx) + }, TMP_String_getbyte_32.$$arity = 1); + return (Opal.def(self, '$valid_encoding?', TMP_String_valid_encoding$q_33 = function() { + var self = this; + + return true + }, TMP_String_valid_encoding$q_33.$$arity = 0), nil) && 'valid_encoding?'; + })($nesting[0], null, $nesting); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/math"] = function(Opal) { + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + function $rb_divide(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs / rhs : lhs['$/'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $truthy = Opal.truthy; + + Opal.add_stubs(['$new', '$raise', '$Float', '$type_error', '$Integer', '$module_function', '$checked', '$float!', '$===', '$gamma', '$-', '$integer!', '$/', '$infinite?']); + return (function($base, $parent_nesting) { + function $Math() {}; + var self = $Math = $module($base, 'Math', $Math); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Math_checked_1, TMP_Math_float$B_2, TMP_Math_integer$B_3, TMP_Math_acos_4, TMP_Math_acosh_5, TMP_Math_asin_6, TMP_Math_asinh_7, TMP_Math_atan_8, TMP_Math_atan2_9, TMP_Math_atanh_10, TMP_Math_cbrt_11, TMP_Math_cos_12, TMP_Math_cosh_13, TMP_Math_erf_14, TMP_Math_erfc_15, TMP_Math_exp_16, TMP_Math_frexp_17, TMP_Math_gamma_18, TMP_Math_hypot_19, TMP_Math_ldexp_20, TMP_Math_lgamma_21, TMP_Math_log_22, TMP_Math_log10_23, TMP_Math_log2_24, TMP_Math_sin_25, TMP_Math_sinh_26, TMP_Math_sqrt_27, TMP_Math_tan_28, TMP_Math_tanh_29; + + + Opal.const_set($nesting[0], 'E', Math.E); + Opal.const_set($nesting[0], 'PI', Math.PI); + Opal.const_set($nesting[0], 'DomainError', $$($nesting, 'Class').$new($$($nesting, 'StandardError'))); + Opal.defs(self, '$checked', TMP_Math_checked_1 = function $$checked(method, $a) { + var $post_args, args, self = this; + + + + $post_args = Opal.slice.call(arguments, 1, arguments.length); + + args = $post_args;; + + if (isNaN(args[0]) || (args.length == 2 && isNaN(args[1]))) { + return NaN; + } + + var result = Math[method].apply(null, args); + + if (isNaN(result)) { + self.$raise($$($nesting, 'DomainError'), "" + "Numerical argument is out of domain - \"" + (method) + "\""); + } + + return result; + ; + }, TMP_Math_checked_1.$$arity = -2); + Opal.defs(self, '$float!', TMP_Math_float$B_2 = function(value) { + var self = this; + + try { + return self.$Float(value) + } catch ($err) { + if (Opal.rescue($err, [$$($nesting, 'ArgumentError')])) { + try { + return self.$raise($$($nesting, 'Opal').$type_error(value, $$($nesting, 'Float'))) + } finally { Opal.pop_exception() } + } else { throw $err; } + } + }, TMP_Math_float$B_2.$$arity = 1); + Opal.defs(self, '$integer!', TMP_Math_integer$B_3 = function(value) { + var self = this; + + try { + return self.$Integer(value) + } catch ($err) { + if (Opal.rescue($err, [$$($nesting, 'ArgumentError')])) { + try { + return self.$raise($$($nesting, 'Opal').$type_error(value, $$($nesting, 'Integer'))) + } finally { Opal.pop_exception() } + } else { throw $err; } + } + }, TMP_Math_integer$B_3.$$arity = 1); + self.$module_function(); + + Opal.def(self, '$acos', TMP_Math_acos_4 = function $$acos(x) { + var self = this; + + return $$($nesting, 'Math').$checked("acos", $$($nesting, 'Math')['$float!'](x)) + }, TMP_Math_acos_4.$$arity = 1); + if ($truthy((typeof(Math.acosh) !== "undefined"))) { + } else { + + Math.acosh = function(x) { + return Math.log(x + Math.sqrt(x * x - 1)); + } + + }; + + Opal.def(self, '$acosh', TMP_Math_acosh_5 = function $$acosh(x) { + var self = this; + + return $$($nesting, 'Math').$checked("acosh", $$($nesting, 'Math')['$float!'](x)) + }, TMP_Math_acosh_5.$$arity = 1); + + Opal.def(self, '$asin', TMP_Math_asin_6 = function $$asin(x) { + var self = this; + + return $$($nesting, 'Math').$checked("asin", $$($nesting, 'Math')['$float!'](x)) + }, TMP_Math_asin_6.$$arity = 1); + if ($truthy((typeof(Math.asinh) !== "undefined"))) { + } else { + + Math.asinh = function(x) { + return Math.log(x + Math.sqrt(x * x + 1)) + } + + }; + + Opal.def(self, '$asinh', TMP_Math_asinh_7 = function $$asinh(x) { + var self = this; + + return $$($nesting, 'Math').$checked("asinh", $$($nesting, 'Math')['$float!'](x)) + }, TMP_Math_asinh_7.$$arity = 1); + + Opal.def(self, '$atan', TMP_Math_atan_8 = function $$atan(x) { + var self = this; + + return $$($nesting, 'Math').$checked("atan", $$($nesting, 'Math')['$float!'](x)) + }, TMP_Math_atan_8.$$arity = 1); + + Opal.def(self, '$atan2', TMP_Math_atan2_9 = function $$atan2(y, x) { + var self = this; + + return $$($nesting, 'Math').$checked("atan2", $$($nesting, 'Math')['$float!'](y), $$($nesting, 'Math')['$float!'](x)) + }, TMP_Math_atan2_9.$$arity = 2); + if ($truthy((typeof(Math.atanh) !== "undefined"))) { + } else { + + Math.atanh = function(x) { + return 0.5 * Math.log((1 + x) / (1 - x)); + } + + }; + + Opal.def(self, '$atanh', TMP_Math_atanh_10 = function $$atanh(x) { + var self = this; + + return $$($nesting, 'Math').$checked("atanh", $$($nesting, 'Math')['$float!'](x)) + }, TMP_Math_atanh_10.$$arity = 1); + if ($truthy((typeof(Math.cbrt) !== "undefined"))) { + } else { + + Math.cbrt = function(x) { + if (x == 0) { + return 0; + } + + if (x < 0) { + return -Math.cbrt(-x); + } + + var r = x, + ex = 0; + + while (r < 0.125) { + r *= 8; + ex--; + } + + while (r > 1.0) { + r *= 0.125; + ex++; + } + + r = (-0.46946116 * r + 1.072302) * r + 0.3812513; + + while (ex < 0) { + r *= 0.5; + ex++; + } + + while (ex > 0) { + r *= 2; + ex--; + } + + r = (2.0 / 3.0) * r + (1.0 / 3.0) * x / (r * r); + r = (2.0 / 3.0) * r + (1.0 / 3.0) * x / (r * r); + r = (2.0 / 3.0) * r + (1.0 / 3.0) * x / (r * r); + r = (2.0 / 3.0) * r + (1.0 / 3.0) * x / (r * r); + + return r; + } + + }; + + Opal.def(self, '$cbrt', TMP_Math_cbrt_11 = function $$cbrt(x) { + var self = this; + + return $$($nesting, 'Math').$checked("cbrt", $$($nesting, 'Math')['$float!'](x)) + }, TMP_Math_cbrt_11.$$arity = 1); + + Opal.def(self, '$cos', TMP_Math_cos_12 = function $$cos(x) { + var self = this; + + return $$($nesting, 'Math').$checked("cos", $$($nesting, 'Math')['$float!'](x)) + }, TMP_Math_cos_12.$$arity = 1); + if ($truthy((typeof(Math.cosh) !== "undefined"))) { + } else { + + Math.cosh = function(x) { + return (Math.exp(x) + Math.exp(-x)) / 2; + } + + }; + + Opal.def(self, '$cosh', TMP_Math_cosh_13 = function $$cosh(x) { + var self = this; + + return $$($nesting, 'Math').$checked("cosh", $$($nesting, 'Math')['$float!'](x)) + }, TMP_Math_cosh_13.$$arity = 1); + if ($truthy((typeof(Math.erf) !== "undefined"))) { + } else { + + Opal.defineProperty(Math, 'erf', function(x) { + var A1 = 0.254829592, + A2 = -0.284496736, + A3 = 1.421413741, + A4 = -1.453152027, + A5 = 1.061405429, + P = 0.3275911; + + var sign = 1; + + if (x < 0) { + sign = -1; + } + + x = Math.abs(x); + + var t = 1.0 / (1.0 + P * x); + var y = 1.0 - (((((A5 * t + A4) * t) + A3) * t + A2) * t + A1) * t * Math.exp(-x * x); + + return sign * y; + }); + + }; + + Opal.def(self, '$erf', TMP_Math_erf_14 = function $$erf(x) { + var self = this; + + return $$($nesting, 'Math').$checked("erf", $$($nesting, 'Math')['$float!'](x)) + }, TMP_Math_erf_14.$$arity = 1); + if ($truthy((typeof(Math.erfc) !== "undefined"))) { + } else { + + Opal.defineProperty(Math, 'erfc', function(x) { + var z = Math.abs(x), + t = 1.0 / (0.5 * z + 1.0); + + var A1 = t * 0.17087277 + -0.82215223, + A2 = t * A1 + 1.48851587, + A3 = t * A2 + -1.13520398, + A4 = t * A3 + 0.27886807, + A5 = t * A4 + -0.18628806, + A6 = t * A5 + 0.09678418, + A7 = t * A6 + 0.37409196, + A8 = t * A7 + 1.00002368, + A9 = t * A8, + A10 = -z * z - 1.26551223 + A9; + + var a = t * Math.exp(A10); + + if (x < 0.0) { + return 2.0 - a; + } + else { + return a; + } + }); + + }; + + Opal.def(self, '$erfc', TMP_Math_erfc_15 = function $$erfc(x) { + var self = this; + + return $$($nesting, 'Math').$checked("erfc", $$($nesting, 'Math')['$float!'](x)) + }, TMP_Math_erfc_15.$$arity = 1); + + Opal.def(self, '$exp', TMP_Math_exp_16 = function $$exp(x) { + var self = this; + + return $$($nesting, 'Math').$checked("exp", $$($nesting, 'Math')['$float!'](x)) + }, TMP_Math_exp_16.$$arity = 1); + + Opal.def(self, '$frexp', TMP_Math_frexp_17 = function $$frexp(x) { + var self = this; + + + x = $$($nesting, 'Math')['$float!'](x); + + if (isNaN(x)) { + return [NaN, 0]; + } + + var ex = Math.floor(Math.log(Math.abs(x)) / Math.log(2)) + 1, + frac = x / Math.pow(2, ex); + + return [frac, ex]; + ; + }, TMP_Math_frexp_17.$$arity = 1); + + Opal.def(self, '$gamma', TMP_Math_gamma_18 = function $$gamma(n) { + var self = this; + + + n = $$($nesting, 'Math')['$float!'](n); + + var i, t, x, value, result, twoN, threeN, fourN, fiveN; + + var G = 4.7421875; + + var P = [ + 0.99999999999999709182, + 57.156235665862923517, + -59.597960355475491248, + 14.136097974741747174, + -0.49191381609762019978, + 0.33994649984811888699e-4, + 0.46523628927048575665e-4, + -0.98374475304879564677e-4, + 0.15808870322491248884e-3, + -0.21026444172410488319e-3, + 0.21743961811521264320e-3, + -0.16431810653676389022e-3, + 0.84418223983852743293e-4, + -0.26190838401581408670e-4, + 0.36899182659531622704e-5 + ]; + + + if (isNaN(n)) { + return NaN; + } + + if (n === 0 && 1 / n < 0) { + return -Infinity; + } + + if (n === -1 || n === -Infinity) { + self.$raise($$($nesting, 'DomainError'), "Numerical argument is out of domain - \"gamma\""); + } + + if ($$($nesting, 'Integer')['$==='](n)) { + if (n <= 0) { + return isFinite(n) ? Infinity : NaN; + } + + if (n > 171) { + return Infinity; + } + + value = n - 2; + result = n - 1; + + while (value > 1) { + result *= value; + value--; + } + + if (result == 0) { + result = 1; + } + + return result; + } + + if (n < 0.5) { + return Math.PI / (Math.sin(Math.PI * n) * $$($nesting, 'Math').$gamma($rb_minus(1, n))); + } + + if (n >= 171.35) { + return Infinity; + } + + if (n > 85.0) { + twoN = n * n; + threeN = twoN * n; + fourN = threeN * n; + fiveN = fourN * n; + + return Math.sqrt(2 * Math.PI / n) * Math.pow((n / Math.E), n) * + (1 + 1 / (12 * n) + 1 / (288 * twoN) - 139 / (51840 * threeN) - + 571 / (2488320 * fourN) + 163879 / (209018880 * fiveN) + + 5246819 / (75246796800 * fiveN * n)); + } + + n -= 1; + x = P[0]; + + for (i = 1; i < P.length; ++i) { + x += P[i] / (n + i); + } + + t = n + G + 0.5; + + return Math.sqrt(2 * Math.PI) * Math.pow(t, n + 0.5) * Math.exp(-t) * x; + ; + }, TMP_Math_gamma_18.$$arity = 1); + if ($truthy((typeof(Math.hypot) !== "undefined"))) { + } else { + + Math.hypot = function(x, y) { + return Math.sqrt(x * x + y * y) + } + + }; + + Opal.def(self, '$hypot', TMP_Math_hypot_19 = function $$hypot(x, y) { + var self = this; + + return $$($nesting, 'Math').$checked("hypot", $$($nesting, 'Math')['$float!'](x), $$($nesting, 'Math')['$float!'](y)) + }, TMP_Math_hypot_19.$$arity = 2); + + Opal.def(self, '$ldexp', TMP_Math_ldexp_20 = function $$ldexp(mantissa, exponent) { + var self = this; + + + mantissa = $$($nesting, 'Math')['$float!'](mantissa); + exponent = $$($nesting, 'Math')['$integer!'](exponent); + + if (isNaN(exponent)) { + self.$raise($$($nesting, 'RangeError'), "float NaN out of range of integer"); + } + + return mantissa * Math.pow(2, exponent); + ; + }, TMP_Math_ldexp_20.$$arity = 2); + + Opal.def(self, '$lgamma', TMP_Math_lgamma_21 = function $$lgamma(n) { + var self = this; + + + if (n == -1) { + return [Infinity, 1]; + } + else { + return [Math.log(Math.abs($$($nesting, 'Math').$gamma(n))), $$($nesting, 'Math').$gamma(n) < 0 ? -1 : 1]; + } + + }, TMP_Math_lgamma_21.$$arity = 1); + + Opal.def(self, '$log', TMP_Math_log_22 = function $$log(x, base) { + var self = this; + + + ; + if ($truthy($$($nesting, 'String')['$==='](x))) { + self.$raise($$($nesting, 'Opal').$type_error(x, $$($nesting, 'Float')))}; + if ($truthy(base == null)) { + return $$($nesting, 'Math').$checked("log", $$($nesting, 'Math')['$float!'](x)) + } else { + + if ($truthy($$($nesting, 'String')['$==='](base))) { + self.$raise($$($nesting, 'Opal').$type_error(base, $$($nesting, 'Float')))}; + return $rb_divide($$($nesting, 'Math').$checked("log", $$($nesting, 'Math')['$float!'](x)), $$($nesting, 'Math').$checked("log", $$($nesting, 'Math')['$float!'](base))); + }; + }, TMP_Math_log_22.$$arity = -2); + if ($truthy((typeof(Math.log10) !== "undefined"))) { + } else { + + Math.log10 = function(x) { + return Math.log(x) / Math.LN10; + } + + }; + + Opal.def(self, '$log10', TMP_Math_log10_23 = function $$log10(x) { + var self = this; + + + if ($truthy($$($nesting, 'String')['$==='](x))) { + self.$raise($$($nesting, 'Opal').$type_error(x, $$($nesting, 'Float')))}; + return $$($nesting, 'Math').$checked("log10", $$($nesting, 'Math')['$float!'](x)); + }, TMP_Math_log10_23.$$arity = 1); + if ($truthy((typeof(Math.log2) !== "undefined"))) { + } else { + + Math.log2 = function(x) { + return Math.log(x) / Math.LN2; + } + + }; + + Opal.def(self, '$log2', TMP_Math_log2_24 = function $$log2(x) { + var self = this; + + + if ($truthy($$($nesting, 'String')['$==='](x))) { + self.$raise($$($nesting, 'Opal').$type_error(x, $$($nesting, 'Float')))}; + return $$($nesting, 'Math').$checked("log2", $$($nesting, 'Math')['$float!'](x)); + }, TMP_Math_log2_24.$$arity = 1); + + Opal.def(self, '$sin', TMP_Math_sin_25 = function $$sin(x) { + var self = this; + + return $$($nesting, 'Math').$checked("sin", $$($nesting, 'Math')['$float!'](x)) + }, TMP_Math_sin_25.$$arity = 1); + if ($truthy((typeof(Math.sinh) !== "undefined"))) { + } else { + + Math.sinh = function(x) { + return (Math.exp(x) - Math.exp(-x)) / 2; + } + + }; + + Opal.def(self, '$sinh', TMP_Math_sinh_26 = function $$sinh(x) { + var self = this; + + return $$($nesting, 'Math').$checked("sinh", $$($nesting, 'Math')['$float!'](x)) + }, TMP_Math_sinh_26.$$arity = 1); + + Opal.def(self, '$sqrt', TMP_Math_sqrt_27 = function $$sqrt(x) { + var self = this; + + return $$($nesting, 'Math').$checked("sqrt", $$($nesting, 'Math')['$float!'](x)) + }, TMP_Math_sqrt_27.$$arity = 1); + + Opal.def(self, '$tan', TMP_Math_tan_28 = function $$tan(x) { + var self = this; + + + x = $$($nesting, 'Math')['$float!'](x); + if ($truthy(x['$infinite?']())) { + return $$$($$($nesting, 'Float'), 'NAN')}; + return $$($nesting, 'Math').$checked("tan", $$($nesting, 'Math')['$float!'](x)); + }, TMP_Math_tan_28.$$arity = 1); + if ($truthy((typeof(Math.tanh) !== "undefined"))) { + } else { + + Math.tanh = function(x) { + if (x == Infinity) { + return 1; + } + else if (x == -Infinity) { + return -1; + } + else { + return (Math.exp(x) - Math.exp(-x)) / (Math.exp(x) + Math.exp(-x)); + } + } + + }; + + Opal.def(self, '$tanh', TMP_Math_tanh_29 = function $$tanh(x) { + var self = this; + + return $$($nesting, 'Math').$checked("tanh", $$($nesting, 'Math')['$float!'](x)) + }, TMP_Math_tanh_29.$$arity = 1); + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/complex"] = function(Opal) { + function $rb_times(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs * rhs : lhs['$*'](rhs); + } + function $rb_plus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); + } + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + function $rb_divide(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs / rhs : lhs['$/'](rhs); + } + function $rb_gt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $truthy = Opal.truthy, $module = Opal.module; + + Opal.add_stubs(['$require', '$===', '$real?', '$raise', '$new', '$*', '$cos', '$sin', '$attr_reader', '$class', '$==', '$real', '$imag', '$Complex', '$-@', '$+', '$__coerced__', '$-', '$nan?', '$/', '$conj', '$abs2', '$quo', '$polar', '$exp', '$log', '$>', '$!=', '$divmod', '$**', '$hypot', '$atan2', '$lcm', '$denominator', '$finite?', '$infinite?', '$numerator', '$abs', '$arg', '$rationalize', '$to_f', '$to_i', '$to_r', '$inspect', '$positive?', '$zero?', '$Rational']); + + self.$require("corelib/numeric"); + (function($base, $super, $parent_nesting) { + function $Complex(){}; + var self = $Complex = $klass($base, $super, 'Complex', $Complex); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Complex_rect_1, TMP_Complex_polar_2, TMP_Complex_initialize_3, TMP_Complex_coerce_4, TMP_Complex_$eq$eq_5, TMP_Complex_$$_6, TMP_Complex_$_7, TMP_Complex_$_8, TMP_Complex_$_9, TMP_Complex_$_10, TMP_Complex_$$_11, TMP_Complex_abs_12, TMP_Complex_abs2_13, TMP_Complex_angle_14, TMP_Complex_conj_15, TMP_Complex_denominator_16, TMP_Complex_eql$q_17, TMP_Complex_fdiv_18, TMP_Complex_finite$q_19, TMP_Complex_hash_20, TMP_Complex_infinite$q_21, TMP_Complex_inspect_22, TMP_Complex_numerator_23, TMP_Complex_polar_24, TMP_Complex_rationalize_25, TMP_Complex_real$q_26, TMP_Complex_rect_27, TMP_Complex_to_f_28, TMP_Complex_to_i_29, TMP_Complex_to_r_30, TMP_Complex_to_s_31; + + def.real = def.imag = nil; + + Opal.defs(self, '$rect', TMP_Complex_rect_1 = function $$rect(real, imag) { + var $a, $b, $c, self = this; + + + + if (imag == null) { + imag = 0; + }; + if ($truthy(($truthy($a = ($truthy($b = ($truthy($c = $$($nesting, 'Numeric')['$==='](real)) ? real['$real?']() : $c)) ? $$($nesting, 'Numeric')['$==='](imag) : $b)) ? imag['$real?']() : $a))) { + } else { + self.$raise($$($nesting, 'TypeError'), "not a real") + }; + return self.$new(real, imag); + }, TMP_Complex_rect_1.$$arity = -2); + (function(self, $parent_nesting) { + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return Opal.alias(self, "rectangular", "rect") + })(Opal.get_singleton_class(self), $nesting); + Opal.defs(self, '$polar', TMP_Complex_polar_2 = function $$polar(r, theta) { + var $a, $b, $c, self = this; + + + + if (theta == null) { + theta = 0; + }; + if ($truthy(($truthy($a = ($truthy($b = ($truthy($c = $$($nesting, 'Numeric')['$==='](r)) ? r['$real?']() : $c)) ? $$($nesting, 'Numeric')['$==='](theta) : $b)) ? theta['$real?']() : $a))) { + } else { + self.$raise($$($nesting, 'TypeError'), "not a real") + }; + return self.$new($rb_times(r, $$($nesting, 'Math').$cos(theta)), $rb_times(r, $$($nesting, 'Math').$sin(theta))); + }, TMP_Complex_polar_2.$$arity = -2); + self.$attr_reader("real", "imag"); + + Opal.def(self, '$initialize', TMP_Complex_initialize_3 = function $$initialize(real, imag) { + var self = this; + + + + if (imag == null) { + imag = 0; + }; + self.real = real; + return (self.imag = imag); + }, TMP_Complex_initialize_3.$$arity = -2); + + Opal.def(self, '$coerce', TMP_Complex_coerce_4 = function $$coerce(other) { + var $a, self = this; + + if ($truthy($$($nesting, 'Complex')['$==='](other))) { + return [other, self] + } else if ($truthy(($truthy($a = $$($nesting, 'Numeric')['$==='](other)) ? other['$real?']() : $a))) { + return [$$($nesting, 'Complex').$new(other, 0), self] + } else { + return self.$raise($$($nesting, 'TypeError'), "" + (other.$class()) + " can't be coerced into Complex") + } + }, TMP_Complex_coerce_4.$$arity = 1); + + Opal.def(self, '$==', TMP_Complex_$eq$eq_5 = function(other) { + var $a, self = this; + + if ($truthy($$($nesting, 'Complex')['$==='](other))) { + return (($a = self.real['$=='](other.$real())) ? self.imag['$=='](other.$imag()) : self.real['$=='](other.$real())) + } else if ($truthy(($truthy($a = $$($nesting, 'Numeric')['$==='](other)) ? other['$real?']() : $a))) { + return (($a = self.real['$=='](other)) ? self.imag['$=='](0) : self.real['$=='](other)) + } else { + return other['$=='](self) + } + }, TMP_Complex_$eq$eq_5.$$arity = 1); + + Opal.def(self, '$-@', TMP_Complex_$$_6 = function() { + var self = this; + + return self.$Complex(self.real['$-@'](), self.imag['$-@']()) + }, TMP_Complex_$$_6.$$arity = 0); + + Opal.def(self, '$+', TMP_Complex_$_7 = function(other) { + var $a, self = this; + + if ($truthy($$($nesting, 'Complex')['$==='](other))) { + return self.$Complex($rb_plus(self.real, other.$real()), $rb_plus(self.imag, other.$imag())) + } else if ($truthy(($truthy($a = $$($nesting, 'Numeric')['$==='](other)) ? other['$real?']() : $a))) { + return self.$Complex($rb_plus(self.real, other), self.imag) + } else { + return self.$__coerced__("+", other) + } + }, TMP_Complex_$_7.$$arity = 1); + + Opal.def(self, '$-', TMP_Complex_$_8 = function(other) { + var $a, self = this; + + if ($truthy($$($nesting, 'Complex')['$==='](other))) { + return self.$Complex($rb_minus(self.real, other.$real()), $rb_minus(self.imag, other.$imag())) + } else if ($truthy(($truthy($a = $$($nesting, 'Numeric')['$==='](other)) ? other['$real?']() : $a))) { + return self.$Complex($rb_minus(self.real, other), self.imag) + } else { + return self.$__coerced__("-", other) + } + }, TMP_Complex_$_8.$$arity = 1); + + Opal.def(self, '$*', TMP_Complex_$_9 = function(other) { + var $a, self = this; + + if ($truthy($$($nesting, 'Complex')['$==='](other))) { + return self.$Complex($rb_minus($rb_times(self.real, other.$real()), $rb_times(self.imag, other.$imag())), $rb_plus($rb_times(self.real, other.$imag()), $rb_times(self.imag, other.$real()))) + } else if ($truthy(($truthy($a = $$($nesting, 'Numeric')['$==='](other)) ? other['$real?']() : $a))) { + return self.$Complex($rb_times(self.real, other), $rb_times(self.imag, other)) + } else { + return self.$__coerced__("*", other) + } + }, TMP_Complex_$_9.$$arity = 1); + + Opal.def(self, '$/', TMP_Complex_$_10 = function(other) { + var $a, $b, $c, $d, self = this; + + if ($truthy($$($nesting, 'Complex')['$==='](other))) { + if ($truthy(($truthy($a = ($truthy($b = ($truthy($c = ($truthy($d = $$($nesting, 'Number')['$==='](self.real)) ? self.real['$nan?']() : $d)) ? $c : ($truthy($d = $$($nesting, 'Number')['$==='](self.imag)) ? self.imag['$nan?']() : $d))) ? $b : ($truthy($c = $$($nesting, 'Number')['$==='](other.$real())) ? other.$real()['$nan?']() : $c))) ? $a : ($truthy($b = $$($nesting, 'Number')['$==='](other.$imag())) ? other.$imag()['$nan?']() : $b)))) { + return $$($nesting, 'Complex').$new($$$($$($nesting, 'Float'), 'NAN'), $$$($$($nesting, 'Float'), 'NAN')) + } else { + return $rb_divide($rb_times(self, other.$conj()), other.$abs2()) + } + } else if ($truthy(($truthy($a = $$($nesting, 'Numeric')['$==='](other)) ? other['$real?']() : $a))) { + return self.$Complex(self.real.$quo(other), self.imag.$quo(other)) + } else { + return self.$__coerced__("/", other) + } + }, TMP_Complex_$_10.$$arity = 1); + + Opal.def(self, '$**', TMP_Complex_$$_11 = function(other) { + var $a, $b, $c, $d, self = this, r = nil, theta = nil, ore = nil, oim = nil, nr = nil, ntheta = nil, x = nil, z = nil, n = nil, div = nil, mod = nil; + + + if (other['$=='](0)) { + return $$($nesting, 'Complex').$new(1, 0)}; + if ($truthy($$($nesting, 'Complex')['$==='](other))) { + + $b = self.$polar(), $a = Opal.to_ary($b), (r = ($a[0] == null ? nil : $a[0])), (theta = ($a[1] == null ? nil : $a[1])), $b; + ore = other.$real(); + oim = other.$imag(); + nr = $$($nesting, 'Math').$exp($rb_minus($rb_times(ore, $$($nesting, 'Math').$log(r)), $rb_times(oim, theta))); + ntheta = $rb_plus($rb_times(theta, ore), $rb_times(oim, $$($nesting, 'Math').$log(r))); + return $$($nesting, 'Complex').$polar(nr, ntheta); + } else if ($truthy($$($nesting, 'Integer')['$==='](other))) { + if ($truthy($rb_gt(other, 0))) { + + x = self; + z = x; + n = $rb_minus(other, 1); + while ($truthy(n['$!='](0))) { + + $c = n.$divmod(2), $b = Opal.to_ary($c), (div = ($b[0] == null ? nil : $b[0])), (mod = ($b[1] == null ? nil : $b[1])), $c; + while (mod['$=='](0)) { + + x = self.$Complex($rb_minus($rb_times(x.$real(), x.$real()), $rb_times(x.$imag(), x.$imag())), $rb_times($rb_times(2, x.$real()), x.$imag())); + n = div; + $d = n.$divmod(2), $c = Opal.to_ary($d), (div = ($c[0] == null ? nil : $c[0])), (mod = ($c[1] == null ? nil : $c[1])), $d; + }; + z = $rb_times(z, x); + n = $rb_minus(n, 1); + }; + return z; + } else { + return $rb_divide($$($nesting, 'Rational').$new(1, 1), self)['$**'](other['$-@']()) + } + } else if ($truthy(($truthy($a = $$($nesting, 'Float')['$==='](other)) ? $a : $$($nesting, 'Rational')['$==='](other)))) { + + $b = self.$polar(), $a = Opal.to_ary($b), (r = ($a[0] == null ? nil : $a[0])), (theta = ($a[1] == null ? nil : $a[1])), $b; + return $$($nesting, 'Complex').$polar(r['$**'](other), $rb_times(theta, other)); + } else { + return self.$__coerced__("**", other) + }; + }, TMP_Complex_$$_11.$$arity = 1); + + Opal.def(self, '$abs', TMP_Complex_abs_12 = function $$abs() { + var self = this; + + return $$($nesting, 'Math').$hypot(self.real, self.imag) + }, TMP_Complex_abs_12.$$arity = 0); + + Opal.def(self, '$abs2', TMP_Complex_abs2_13 = function $$abs2() { + var self = this; + + return $rb_plus($rb_times(self.real, self.real), $rb_times(self.imag, self.imag)) + }, TMP_Complex_abs2_13.$$arity = 0); + + Opal.def(self, '$angle', TMP_Complex_angle_14 = function $$angle() { + var self = this; + + return $$($nesting, 'Math').$atan2(self.imag, self.real) + }, TMP_Complex_angle_14.$$arity = 0); + Opal.alias(self, "arg", "angle"); + + Opal.def(self, '$conj', TMP_Complex_conj_15 = function $$conj() { + var self = this; + + return self.$Complex(self.real, self.imag['$-@']()) + }, TMP_Complex_conj_15.$$arity = 0); + Opal.alias(self, "conjugate", "conj"); + + Opal.def(self, '$denominator', TMP_Complex_denominator_16 = function $$denominator() { + var self = this; + + return self.real.$denominator().$lcm(self.imag.$denominator()) + }, TMP_Complex_denominator_16.$$arity = 0); + Opal.alias(self, "divide", "/"); + + Opal.def(self, '$eql?', TMP_Complex_eql$q_17 = function(other) { + var $a, $b, self = this; + + return ($truthy($a = ($truthy($b = $$($nesting, 'Complex')['$==='](other)) ? self.real.$class()['$=='](self.imag.$class()) : $b)) ? self['$=='](other) : $a) + }, TMP_Complex_eql$q_17.$$arity = 1); + + Opal.def(self, '$fdiv', TMP_Complex_fdiv_18 = function $$fdiv(other) { + var self = this; + + + if ($truthy($$($nesting, 'Numeric')['$==='](other))) { + } else { + self.$raise($$($nesting, 'TypeError'), "" + (other.$class()) + " can't be coerced into Complex") + }; + return $rb_divide(self, other); + }, TMP_Complex_fdiv_18.$$arity = 1); + + Opal.def(self, '$finite?', TMP_Complex_finite$q_19 = function() { + var $a, self = this; + + return ($truthy($a = self.real['$finite?']()) ? self.imag['$finite?']() : $a) + }, TMP_Complex_finite$q_19.$$arity = 0); + + Opal.def(self, '$hash', TMP_Complex_hash_20 = function $$hash() { + var self = this; + + return "" + "Complex:" + (self.real) + ":" + (self.imag) + }, TMP_Complex_hash_20.$$arity = 0); + Opal.alias(self, "imaginary", "imag"); + + Opal.def(self, '$infinite?', TMP_Complex_infinite$q_21 = function() { + var $a, self = this; + + return ($truthy($a = self.real['$infinite?']()) ? $a : self.imag['$infinite?']()) + }, TMP_Complex_infinite$q_21.$$arity = 0); + + Opal.def(self, '$inspect', TMP_Complex_inspect_22 = function $$inspect() { + var self = this; + + return "" + "(" + (self) + ")" + }, TMP_Complex_inspect_22.$$arity = 0); + Opal.alias(self, "magnitude", "abs"); + + Opal.udef(self, '$' + "negative?");; + + Opal.def(self, '$numerator', TMP_Complex_numerator_23 = function $$numerator() { + var self = this, d = nil; + + + d = self.$denominator(); + return self.$Complex($rb_times(self.real.$numerator(), $rb_divide(d, self.real.$denominator())), $rb_times(self.imag.$numerator(), $rb_divide(d, self.imag.$denominator()))); + }, TMP_Complex_numerator_23.$$arity = 0); + Opal.alias(self, "phase", "arg"); + + Opal.def(self, '$polar', TMP_Complex_polar_24 = function $$polar() { + var self = this; + + return [self.$abs(), self.$arg()] + }, TMP_Complex_polar_24.$$arity = 0); + + Opal.udef(self, '$' + "positive?");; + Opal.alias(self, "quo", "/"); + + Opal.def(self, '$rationalize', TMP_Complex_rationalize_25 = function $$rationalize(eps) { + var self = this; + + + ; + + if (arguments.length > 1) { + self.$raise($$($nesting, 'ArgumentError'), "" + "wrong number of arguments (" + (arguments.length) + " for 0..1)"); + } + ; + if ($truthy(self.imag['$!='](0))) { + self.$raise($$($nesting, 'RangeError'), "" + "can't' convert " + (self) + " into Rational")}; + return self.$real().$rationalize(eps); + }, TMP_Complex_rationalize_25.$$arity = -1); + + Opal.def(self, '$real?', TMP_Complex_real$q_26 = function() { + var self = this; + + return false + }, TMP_Complex_real$q_26.$$arity = 0); + + Opal.def(self, '$rect', TMP_Complex_rect_27 = function $$rect() { + var self = this; + + return [self.real, self.imag] + }, TMP_Complex_rect_27.$$arity = 0); + Opal.alias(self, "rectangular", "rect"); + + Opal.def(self, '$to_f', TMP_Complex_to_f_28 = function $$to_f() { + var self = this; + + + if (self.imag['$=='](0)) { + } else { + self.$raise($$($nesting, 'RangeError'), "" + "can't convert " + (self) + " into Float") + }; + return self.real.$to_f(); + }, TMP_Complex_to_f_28.$$arity = 0); + + Opal.def(self, '$to_i', TMP_Complex_to_i_29 = function $$to_i() { + var self = this; + + + if (self.imag['$=='](0)) { + } else { + self.$raise($$($nesting, 'RangeError'), "" + "can't convert " + (self) + " into Integer") + }; + return self.real.$to_i(); + }, TMP_Complex_to_i_29.$$arity = 0); + + Opal.def(self, '$to_r', TMP_Complex_to_r_30 = function $$to_r() { + var self = this; + + + if (self.imag['$=='](0)) { + } else { + self.$raise($$($nesting, 'RangeError'), "" + "can't convert " + (self) + " into Rational") + }; + return self.real.$to_r(); + }, TMP_Complex_to_r_30.$$arity = 0); + + Opal.def(self, '$to_s', TMP_Complex_to_s_31 = function $$to_s() { + var $a, $b, $c, self = this, result = nil; + + + result = self.real.$inspect(); + result = $rb_plus(result, (function() {if ($truthy(($truthy($a = ($truthy($b = ($truthy($c = $$($nesting, 'Number')['$==='](self.imag)) ? self.imag['$nan?']() : $c)) ? $b : self.imag['$positive?']())) ? $a : self.imag['$zero?']()))) { + return "+" + } else { + return "-" + }; return nil; })()); + result = $rb_plus(result, self.imag.$abs().$inspect()); + if ($truthy(($truthy($a = $$($nesting, 'Number')['$==='](self.imag)) ? ($truthy($b = self.imag['$nan?']()) ? $b : self.imag['$infinite?']()) : $a))) { + result = $rb_plus(result, "*")}; + return $rb_plus(result, "i"); + }, TMP_Complex_to_s_31.$$arity = 0); + return Opal.const_set($nesting[0], 'I', self.$new(0, 1)); + })($nesting[0], $$($nesting, 'Numeric'), $nesting); + (function($base, $parent_nesting) { + function $Kernel() {}; + var self = $Kernel = $module($base, 'Kernel', $Kernel); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Kernel_Complex_32; + + + Opal.def(self, '$Complex', TMP_Kernel_Complex_32 = function $$Complex(real, imag) { + var self = this; + + + + if (imag == null) { + imag = nil; + }; + if ($truthy(imag)) { + return $$($nesting, 'Complex').$new(real, imag) + } else { + return $$($nesting, 'Complex').$new(real, 0) + }; + }, TMP_Kernel_Complex_32.$$arity = -2) + })($nesting[0], $nesting); + return (function($base, $super, $parent_nesting) { + function $String(){}; + var self = $String = $klass($base, $super, 'String', $String); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_String_to_c_33; + + return (Opal.def(self, '$to_c', TMP_String_to_c_33 = function $$to_c() { + var self = this; + + + var str = self, + re = /[+-]?[\d_]+(\.[\d_]+)?(e\d+)?/, + match = str.match(re), + real, imag, denominator; + + function isFloat() { + return re.test(str); + } + + function cutFloat() { + var match = str.match(re); + var number = match[0]; + str = str.slice(number.length); + return number.replace(/_/g, ''); + } + + // handles both floats and rationals + function cutNumber() { + if (isFloat()) { + var numerator = parseFloat(cutFloat()); + + if (str[0] === '/') { + // rational real part + str = str.slice(1); + + if (isFloat()) { + var denominator = parseFloat(cutFloat()); + return self.$Rational(numerator, denominator); + } else { + // reverting '/' + str = '/' + str; + return numerator; + } + } else { + // float real part, no denominator + return numerator; + } + } else { + return null; + } + } + + real = cutNumber(); + + if (!real) { + if (str[0] === 'i') { + // i => Complex(0, 1) + return self.$Complex(0, 1); + } + if (str[0] === '-' && str[1] === 'i') { + // -i => Complex(0, -1) + return self.$Complex(0, -1); + } + if (str[0] === '+' && str[1] === 'i') { + // +i => Complex(0, 1) + return self.$Complex(0, 1); + } + // anything => Complex(0, 0) + return self.$Complex(0, 0); + } + + imag = cutNumber(); + if (!imag) { + if (str[0] === 'i') { + // 3i => Complex(0, 3) + return self.$Complex(0, real); + } else { + // 3 => Complex(3, 0) + return self.$Complex(real, 0); + } + } else { + // 3+2i => Complex(3, 2) + return self.$Complex(real, imag); + } + + }, TMP_String_to_c_33.$$arity = 0), nil) && 'to_c' + })($nesting[0], null, $nesting); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/rational"] = function(Opal) { + function $rb_lt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); + } + function $rb_divide(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs / rhs : lhs['$/'](rhs); + } + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + function $rb_times(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs * rhs : lhs['$*'](rhs); + } + function $rb_plus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); + } + function $rb_gt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); + } + function $rb_le(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs <= rhs : lhs['$<='](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $truthy = Opal.truthy, $module = Opal.module; + + Opal.add_stubs(['$require', '$to_i', '$==', '$raise', '$<', '$-@', '$new', '$gcd', '$/', '$nil?', '$===', '$reduce', '$to_r', '$equal?', '$!', '$coerce_to!', '$to_f', '$numerator', '$denominator', '$<=>', '$-', '$*', '$__coerced__', '$+', '$Rational', '$>', '$**', '$abs', '$ceil', '$with_precision', '$floor', '$<=', '$truncate', '$send', '$convert']); + + self.$require("corelib/numeric"); + (function($base, $super, $parent_nesting) { + function $Rational(){}; + var self = $Rational = $klass($base, $super, 'Rational', $Rational); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Rational_reduce_1, TMP_Rational_convert_2, TMP_Rational_initialize_3, TMP_Rational_numerator_4, TMP_Rational_denominator_5, TMP_Rational_coerce_6, TMP_Rational_$eq$eq_7, TMP_Rational_$lt$eq$gt_8, TMP_Rational_$_9, TMP_Rational_$_10, TMP_Rational_$_11, TMP_Rational_$_12, TMP_Rational_$$_13, TMP_Rational_abs_14, TMP_Rational_ceil_15, TMP_Rational_floor_16, TMP_Rational_hash_17, TMP_Rational_inspect_18, TMP_Rational_rationalize_19, TMP_Rational_round_20, TMP_Rational_to_f_21, TMP_Rational_to_i_22, TMP_Rational_to_r_23, TMP_Rational_to_s_24, TMP_Rational_truncate_25, TMP_Rational_with_precision_26; + + def.num = def.den = nil; + + Opal.defs(self, '$reduce', TMP_Rational_reduce_1 = function $$reduce(num, den) { + var self = this, gcd = nil; + + + num = num.$to_i(); + den = den.$to_i(); + if (den['$=='](0)) { + self.$raise($$($nesting, 'ZeroDivisionError'), "divided by 0") + } else if ($truthy($rb_lt(den, 0))) { + + num = num['$-@'](); + den = den['$-@'](); + } else if (den['$=='](1)) { + return self.$new(num, den)}; + gcd = num.$gcd(den); + return self.$new($rb_divide(num, gcd), $rb_divide(den, gcd)); + }, TMP_Rational_reduce_1.$$arity = 2); + Opal.defs(self, '$convert', TMP_Rational_convert_2 = function $$convert(num, den) { + var $a, $b, self = this; + + + if ($truthy(($truthy($a = num['$nil?']()) ? $a : den['$nil?']()))) { + self.$raise($$($nesting, 'TypeError'), "cannot convert nil into Rational")}; + if ($truthy(($truthy($a = $$($nesting, 'Integer')['$==='](num)) ? $$($nesting, 'Integer')['$==='](den) : $a))) { + return self.$reduce(num, den)}; + if ($truthy(($truthy($a = ($truthy($b = $$($nesting, 'Float')['$==='](num)) ? $b : $$($nesting, 'String')['$==='](num))) ? $a : $$($nesting, 'Complex')['$==='](num)))) { + num = num.$to_r()}; + if ($truthy(($truthy($a = ($truthy($b = $$($nesting, 'Float')['$==='](den)) ? $b : $$($nesting, 'String')['$==='](den))) ? $a : $$($nesting, 'Complex')['$==='](den)))) { + den = den.$to_r()}; + if ($truthy(($truthy($a = den['$equal?'](1)) ? $$($nesting, 'Integer')['$==='](num)['$!']() : $a))) { + return $$($nesting, 'Opal')['$coerce_to!'](num, $$($nesting, 'Rational'), "to_r") + } else if ($truthy(($truthy($a = $$($nesting, 'Numeric')['$==='](num)) ? $$($nesting, 'Numeric')['$==='](den) : $a))) { + return $rb_divide(num, den) + } else { + return self.$reduce(num, den) + }; + }, TMP_Rational_convert_2.$$arity = 2); + + Opal.def(self, '$initialize', TMP_Rational_initialize_3 = function $$initialize(num, den) { + var self = this; + + + self.num = num; + return (self.den = den); + }, TMP_Rational_initialize_3.$$arity = 2); + + Opal.def(self, '$numerator', TMP_Rational_numerator_4 = function $$numerator() { + var self = this; + + return self.num + }, TMP_Rational_numerator_4.$$arity = 0); + + Opal.def(self, '$denominator', TMP_Rational_denominator_5 = function $$denominator() { + var self = this; + + return self.den + }, TMP_Rational_denominator_5.$$arity = 0); + + Opal.def(self, '$coerce', TMP_Rational_coerce_6 = function $$coerce(other) { + var self = this, $case = nil; + + return (function() {$case = other; + if ($$($nesting, 'Rational')['$===']($case)) {return [other, self]} + else if ($$($nesting, 'Integer')['$===']($case)) {return [other.$to_r(), self]} + else if ($$($nesting, 'Float')['$===']($case)) {return [other, self.$to_f()]} + else { return nil }})() + }, TMP_Rational_coerce_6.$$arity = 1); + + Opal.def(self, '$==', TMP_Rational_$eq$eq_7 = function(other) { + var $a, self = this, $case = nil; + + return (function() {$case = other; + if ($$($nesting, 'Rational')['$===']($case)) {return (($a = self.num['$=='](other.$numerator())) ? self.den['$=='](other.$denominator()) : self.num['$=='](other.$numerator()))} + else if ($$($nesting, 'Integer')['$===']($case)) {return (($a = self.num['$=='](other)) ? self.den['$=='](1) : self.num['$=='](other))} + else if ($$($nesting, 'Float')['$===']($case)) {return self.$to_f()['$=='](other)} + else {return other['$=='](self)}})() + }, TMP_Rational_$eq$eq_7.$$arity = 1); + + Opal.def(self, '$<=>', TMP_Rational_$lt$eq$gt_8 = function(other) { + var self = this, $case = nil; + + return (function() {$case = other; + if ($$($nesting, 'Rational')['$===']($case)) {return $rb_minus($rb_times(self.num, other.$denominator()), $rb_times(self.den, other.$numerator()))['$<=>'](0)} + else if ($$($nesting, 'Integer')['$===']($case)) {return $rb_minus(self.num, $rb_times(self.den, other))['$<=>'](0)} + else if ($$($nesting, 'Float')['$===']($case)) {return self.$to_f()['$<=>'](other)} + else {return self.$__coerced__("<=>", other)}})() + }, TMP_Rational_$lt$eq$gt_8.$$arity = 1); + + Opal.def(self, '$+', TMP_Rational_$_9 = function(other) { + var self = this, $case = nil, num = nil, den = nil; + + return (function() {$case = other; + if ($$($nesting, 'Rational')['$===']($case)) { + num = $rb_plus($rb_times(self.num, other.$denominator()), $rb_times(self.den, other.$numerator())); + den = $rb_times(self.den, other.$denominator()); + return self.$Rational(num, den);} + else if ($$($nesting, 'Integer')['$===']($case)) {return self.$Rational($rb_plus(self.num, $rb_times(other, self.den)), self.den)} + else if ($$($nesting, 'Float')['$===']($case)) {return $rb_plus(self.$to_f(), other)} + else {return self.$__coerced__("+", other)}})() + }, TMP_Rational_$_9.$$arity = 1); + + Opal.def(self, '$-', TMP_Rational_$_10 = function(other) { + var self = this, $case = nil, num = nil, den = nil; + + return (function() {$case = other; + if ($$($nesting, 'Rational')['$===']($case)) { + num = $rb_minus($rb_times(self.num, other.$denominator()), $rb_times(self.den, other.$numerator())); + den = $rb_times(self.den, other.$denominator()); + return self.$Rational(num, den);} + else if ($$($nesting, 'Integer')['$===']($case)) {return self.$Rational($rb_minus(self.num, $rb_times(other, self.den)), self.den)} + else if ($$($nesting, 'Float')['$===']($case)) {return $rb_minus(self.$to_f(), other)} + else {return self.$__coerced__("-", other)}})() + }, TMP_Rational_$_10.$$arity = 1); + + Opal.def(self, '$*', TMP_Rational_$_11 = function(other) { + var self = this, $case = nil, num = nil, den = nil; + + return (function() {$case = other; + if ($$($nesting, 'Rational')['$===']($case)) { + num = $rb_times(self.num, other.$numerator()); + den = $rb_times(self.den, other.$denominator()); + return self.$Rational(num, den);} + else if ($$($nesting, 'Integer')['$===']($case)) {return self.$Rational($rb_times(self.num, other), self.den)} + else if ($$($nesting, 'Float')['$===']($case)) {return $rb_times(self.$to_f(), other)} + else {return self.$__coerced__("*", other)}})() + }, TMP_Rational_$_11.$$arity = 1); + + Opal.def(self, '$/', TMP_Rational_$_12 = function(other) { + var self = this, $case = nil, num = nil, den = nil; + + return (function() {$case = other; + if ($$($nesting, 'Rational')['$===']($case)) { + num = $rb_times(self.num, other.$denominator()); + den = $rb_times(self.den, other.$numerator()); + return self.$Rational(num, den);} + else if ($$($nesting, 'Integer')['$===']($case)) {if (other['$=='](0)) { + return $rb_divide(self.$to_f(), 0.0) + } else { + return self.$Rational(self.num, $rb_times(self.den, other)) + }} + else if ($$($nesting, 'Float')['$===']($case)) {return $rb_divide(self.$to_f(), other)} + else {return self.$__coerced__("/", other)}})() + }, TMP_Rational_$_12.$$arity = 1); + + Opal.def(self, '$**', TMP_Rational_$$_13 = function(other) { + var $a, self = this, $case = nil; + + return (function() {$case = other; + if ($$($nesting, 'Integer')['$===']($case)) {if ($truthy((($a = self['$=='](0)) ? $rb_lt(other, 0) : self['$=='](0)))) { + return $$$($$($nesting, 'Float'), 'INFINITY') + } else if ($truthy($rb_gt(other, 0))) { + return self.$Rational(self.num['$**'](other), self.den['$**'](other)) + } else if ($truthy($rb_lt(other, 0))) { + return self.$Rational(self.den['$**'](other['$-@']()), self.num['$**'](other['$-@']())) + } else { + return self.$Rational(1, 1) + }} + else if ($$($nesting, 'Float')['$===']($case)) {return self.$to_f()['$**'](other)} + else if ($$($nesting, 'Rational')['$===']($case)) {if (other['$=='](0)) { + return self.$Rational(1, 1) + } else if (other.$denominator()['$=='](1)) { + if ($truthy($rb_lt(other, 0))) { + return self.$Rational(self.den['$**'](other.$numerator().$abs()), self.num['$**'](other.$numerator().$abs())) + } else { + return self.$Rational(self.num['$**'](other.$numerator()), self.den['$**'](other.$numerator())) + } + } else if ($truthy((($a = self['$=='](0)) ? $rb_lt(other, 0) : self['$=='](0)))) { + return self.$raise($$($nesting, 'ZeroDivisionError'), "divided by 0") + } else { + return self.$to_f()['$**'](other) + }} + else {return self.$__coerced__("**", other)}})() + }, TMP_Rational_$$_13.$$arity = 1); + + Opal.def(self, '$abs', TMP_Rational_abs_14 = function $$abs() { + var self = this; + + return self.$Rational(self.num.$abs(), self.den.$abs()) + }, TMP_Rational_abs_14.$$arity = 0); + + Opal.def(self, '$ceil', TMP_Rational_ceil_15 = function $$ceil(precision) { + var self = this; + + + + if (precision == null) { + precision = 0; + }; + if (precision['$=='](0)) { + return $rb_divide(self.num['$-@'](), self.den)['$-@']().$ceil() + } else { + return self.$with_precision("ceil", precision) + }; + }, TMP_Rational_ceil_15.$$arity = -1); + Opal.alias(self, "divide", "/"); + + Opal.def(self, '$floor', TMP_Rational_floor_16 = function $$floor(precision) { + var self = this; + + + + if (precision == null) { + precision = 0; + }; + if (precision['$=='](0)) { + return $rb_divide(self.num['$-@'](), self.den)['$-@']().$floor() + } else { + return self.$with_precision("floor", precision) + }; + }, TMP_Rational_floor_16.$$arity = -1); + + Opal.def(self, '$hash', TMP_Rational_hash_17 = function $$hash() { + var self = this; + + return "" + "Rational:" + (self.num) + ":" + (self.den) + }, TMP_Rational_hash_17.$$arity = 0); + + Opal.def(self, '$inspect', TMP_Rational_inspect_18 = function $$inspect() { + var self = this; + + return "" + "(" + (self) + ")" + }, TMP_Rational_inspect_18.$$arity = 0); + Opal.alias(self, "quo", "/"); + + Opal.def(self, '$rationalize', TMP_Rational_rationalize_19 = function $$rationalize(eps) { + var self = this; + + + ; + + if (arguments.length > 1) { + self.$raise($$($nesting, 'ArgumentError'), "" + "wrong number of arguments (" + (arguments.length) + " for 0..1)"); + } + + if (eps == null) { + return self; + } + + var e = eps.$abs(), + a = $rb_minus(self, e), + b = $rb_plus(self, e); + + var p0 = 0, + p1 = 1, + q0 = 1, + q1 = 0, + p2, q2; + + var c, k, t; + + while (true) { + c = (a).$ceil(); + + if ($rb_le(c, b)) { + break; + } + + k = c - 1; + p2 = k * p1 + p0; + q2 = k * q1 + q0; + t = $rb_divide(1, $rb_minus(b, k)); + b = $rb_divide(1, $rb_minus(a, k)); + a = t; + + p0 = p1; + q0 = q1; + p1 = p2; + q1 = q2; + } + + return self.$Rational(c * p1 + p0, c * q1 + q0); + ; + }, TMP_Rational_rationalize_19.$$arity = -1); + + Opal.def(self, '$round', TMP_Rational_round_20 = function $$round(precision) { + var self = this, num = nil, den = nil, approx = nil; + + + + if (precision == null) { + precision = 0; + }; + if (precision['$=='](0)) { + } else { + return self.$with_precision("round", precision) + }; + if (self.num['$=='](0)) { + return 0}; + if (self.den['$=='](1)) { + return self.num}; + num = $rb_plus($rb_times(self.num.$abs(), 2), self.den); + den = $rb_times(self.den, 2); + approx = $rb_divide(num, den).$truncate(); + if ($truthy($rb_lt(self.num, 0))) { + return approx['$-@']() + } else { + return approx + }; + }, TMP_Rational_round_20.$$arity = -1); + + Opal.def(self, '$to_f', TMP_Rational_to_f_21 = function $$to_f() { + var self = this; + + return $rb_divide(self.num, self.den) + }, TMP_Rational_to_f_21.$$arity = 0); + + Opal.def(self, '$to_i', TMP_Rational_to_i_22 = function $$to_i() { + var self = this; + + return self.$truncate() + }, TMP_Rational_to_i_22.$$arity = 0); + + Opal.def(self, '$to_r', TMP_Rational_to_r_23 = function $$to_r() { + var self = this; + + return self + }, TMP_Rational_to_r_23.$$arity = 0); + + Opal.def(self, '$to_s', TMP_Rational_to_s_24 = function $$to_s() { + var self = this; + + return "" + (self.num) + "/" + (self.den) + }, TMP_Rational_to_s_24.$$arity = 0); + + Opal.def(self, '$truncate', TMP_Rational_truncate_25 = function $$truncate(precision) { + var self = this; + + + + if (precision == null) { + precision = 0; + }; + if (precision['$=='](0)) { + if ($truthy($rb_lt(self.num, 0))) { + return self.$ceil() + } else { + return self.$floor() + } + } else { + return self.$with_precision("truncate", precision) + }; + }, TMP_Rational_truncate_25.$$arity = -1); + return (Opal.def(self, '$with_precision', TMP_Rational_with_precision_26 = function $$with_precision(method, precision) { + var self = this, p = nil, s = nil; + + + if ($truthy($$($nesting, 'Integer')['$==='](precision))) { + } else { + self.$raise($$($nesting, 'TypeError'), "not an Integer") + }; + p = (10)['$**'](precision); + s = $rb_times(self, p); + if ($truthy($rb_lt(precision, 1))) { + return $rb_divide(s.$send(method), p).$to_i() + } else { + return self.$Rational(s.$send(method), p) + }; + }, TMP_Rational_with_precision_26.$$arity = 2), nil) && 'with_precision'; + })($nesting[0], $$($nesting, 'Numeric'), $nesting); + (function($base, $parent_nesting) { + function $Kernel() {}; + var self = $Kernel = $module($base, 'Kernel', $Kernel); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Kernel_Rational_27; + + + Opal.def(self, '$Rational', TMP_Kernel_Rational_27 = function $$Rational(numerator, denominator) { + var self = this; + + + + if (denominator == null) { + denominator = 1; + }; + return $$($nesting, 'Rational').$convert(numerator, denominator); + }, TMP_Kernel_Rational_27.$$arity = -2) + })($nesting[0], $nesting); + return (function($base, $super, $parent_nesting) { + function $String(){}; + var self = $String = $klass($base, $super, 'String', $String); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_String_to_r_28; + + return (Opal.def(self, '$to_r', TMP_String_to_r_28 = function $$to_r() { + var self = this; + + + var str = self.trimLeft(), + re = /^[+-]?[\d_]+(\.[\d_]+)?/, + match = str.match(re), + numerator, denominator; + + function isFloat() { + return re.test(str); + } + + function cutFloat() { + var match = str.match(re); + var number = match[0]; + str = str.slice(number.length); + return number.replace(/_/g, ''); + } + + if (isFloat()) { + numerator = parseFloat(cutFloat()); + + if (str[0] === '/') { + // rational real part + str = str.slice(1); + + if (isFloat()) { + denominator = parseFloat(cutFloat()); + return self.$Rational(numerator, denominator); + } else { + return self.$Rational(numerator, 1); + } + } else { + return self.$Rational(numerator, 1); + } + } else { + return self.$Rational(0, 1); + } + + }, TMP_String_to_r_28.$$arity = 0), nil) && 'to_r' + })($nesting[0], null, $nesting); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/time"] = function(Opal) { + function $rb_gt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); + } + function $rb_lt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); + } + function $rb_plus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); + } + function $rb_divide(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs / rhs : lhs['$/'](rhs); + } + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + function $rb_le(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs <= rhs : lhs['$<='](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $truthy = Opal.truthy, $range = Opal.range; + + Opal.add_stubs(['$require', '$include', '$===', '$raise', '$coerce_to!', '$respond_to?', '$to_str', '$to_i', '$new', '$<=>', '$to_f', '$nil?', '$>', '$<', '$strftime', '$year', '$month', '$day', '$+', '$round', '$/', '$-', '$copy_instance_variables', '$initialize_dup', '$is_a?', '$zero?', '$wday', '$utc?', '$mon', '$yday', '$hour', '$min', '$sec', '$rjust', '$ljust', '$zone', '$to_s', '$[]', '$cweek_cyear', '$isdst', '$<=', '$!=', '$==', '$ceil']); + + self.$require("corelib/comparable"); + return (function($base, $super, $parent_nesting) { + function $Time(){}; + var self = $Time = $klass($base, $super, 'Time', $Time); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Time_at_1, TMP_Time_new_2, TMP_Time_local_3, TMP_Time_gm_4, TMP_Time_now_5, TMP_Time_$_6, TMP_Time_$_7, TMP_Time_$lt$eq$gt_8, TMP_Time_$eq$eq_9, TMP_Time_asctime_10, TMP_Time_day_11, TMP_Time_yday_12, TMP_Time_isdst_13, TMP_Time_dup_14, TMP_Time_eql$q_15, TMP_Time_friday$q_16, TMP_Time_hash_17, TMP_Time_hour_18, TMP_Time_inspect_19, TMP_Time_min_20, TMP_Time_mon_21, TMP_Time_monday$q_22, TMP_Time_saturday$q_23, TMP_Time_sec_24, TMP_Time_succ_25, TMP_Time_usec_26, TMP_Time_zone_27, TMP_Time_getgm_28, TMP_Time_gmtime_29, TMP_Time_gmt$q_30, TMP_Time_gmt_offset_31, TMP_Time_strftime_32, TMP_Time_sunday$q_33, TMP_Time_thursday$q_34, TMP_Time_to_a_35, TMP_Time_to_f_36, TMP_Time_to_i_37, TMP_Time_tuesday$q_38, TMP_Time_wday_39, TMP_Time_wednesday$q_40, TMP_Time_year_41, TMP_Time_cweek_cyear_42; + + + self.$include($$($nesting, 'Comparable')); + + var days_of_week = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"], + short_days = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], + short_months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], + long_months = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]; + ; + Opal.defs(self, '$at', TMP_Time_at_1 = function $$at(seconds, frac) { + var self = this; + + + ; + + var result; + + if ($$($nesting, 'Time')['$==='](seconds)) { + if (frac !== undefined) { + self.$raise($$($nesting, 'TypeError'), "can't convert Time into an exact number") + } + result = new Date(seconds.getTime()); + result.is_utc = seconds.is_utc; + return result; + } + + if (!seconds.$$is_number) { + seconds = $$($nesting, 'Opal')['$coerce_to!'](seconds, $$($nesting, 'Integer'), "to_int"); + } + + if (frac === undefined) { + return new Date(seconds * 1000); + } + + if (!frac.$$is_number) { + frac = $$($nesting, 'Opal')['$coerce_to!'](frac, $$($nesting, 'Integer'), "to_int"); + } + + return new Date(seconds * 1000 + (frac / 1000)); + ; + }, TMP_Time_at_1.$$arity = -2); + + function time_params(year, month, day, hour, min, sec) { + if (year.$$is_string) { + year = parseInt(year, 10); + } else { + year = $$($nesting, 'Opal')['$coerce_to!'](year, $$($nesting, 'Integer'), "to_int"); + } + + if (month === nil) { + month = 1; + } else if (!month.$$is_number) { + if ((month)['$respond_to?']("to_str")) { + month = (month).$to_str(); + switch (month.toLowerCase()) { + case 'jan': month = 1; break; + case 'feb': month = 2; break; + case 'mar': month = 3; break; + case 'apr': month = 4; break; + case 'may': month = 5; break; + case 'jun': month = 6; break; + case 'jul': month = 7; break; + case 'aug': month = 8; break; + case 'sep': month = 9; break; + case 'oct': month = 10; break; + case 'nov': month = 11; break; + case 'dec': month = 12; break; + default: month = (month).$to_i(); + } + } else { + month = $$($nesting, 'Opal')['$coerce_to!'](month, $$($nesting, 'Integer'), "to_int"); + } + } + + if (month < 1 || month > 12) { + self.$raise($$($nesting, 'ArgumentError'), "" + "month out of range: " + (month)) + } + month = month - 1; + + if (day === nil) { + day = 1; + } else if (day.$$is_string) { + day = parseInt(day, 10); + } else { + day = $$($nesting, 'Opal')['$coerce_to!'](day, $$($nesting, 'Integer'), "to_int"); + } + + if (day < 1 || day > 31) { + self.$raise($$($nesting, 'ArgumentError'), "" + "day out of range: " + (day)) + } + + if (hour === nil) { + hour = 0; + } else if (hour.$$is_string) { + hour = parseInt(hour, 10); + } else { + hour = $$($nesting, 'Opal')['$coerce_to!'](hour, $$($nesting, 'Integer'), "to_int"); + } + + if (hour < 0 || hour > 24) { + self.$raise($$($nesting, 'ArgumentError'), "" + "hour out of range: " + (hour)) + } + + if (min === nil) { + min = 0; + } else if (min.$$is_string) { + min = parseInt(min, 10); + } else { + min = $$($nesting, 'Opal')['$coerce_to!'](min, $$($nesting, 'Integer'), "to_int"); + } + + if (min < 0 || min > 59) { + self.$raise($$($nesting, 'ArgumentError'), "" + "min out of range: " + (min)) + } + + if (sec === nil) { + sec = 0; + } else if (!sec.$$is_number) { + if (sec.$$is_string) { + sec = parseInt(sec, 10); + } else { + sec = $$($nesting, 'Opal')['$coerce_to!'](sec, $$($nesting, 'Integer'), "to_int"); + } + } + + if (sec < 0 || sec > 60) { + self.$raise($$($nesting, 'ArgumentError'), "" + "sec out of range: " + (sec)) + } + + return [year, month, day, hour, min, sec]; + } + ; + Opal.defs(self, '$new', TMP_Time_new_2 = function(year, month, day, hour, min, sec, utc_offset) { + var self = this; + + + ; + + if (month == null) { + month = nil; + }; + + if (day == null) { + day = nil; + }; + + if (hour == null) { + hour = nil; + }; + + if (min == null) { + min = nil; + }; + + if (sec == null) { + sec = nil; + }; + + if (utc_offset == null) { + utc_offset = nil; + }; + + var args, result; + + if (year === undefined) { + return new Date(); + } + + if (utc_offset !== nil) { + self.$raise($$($nesting, 'ArgumentError'), "Opal does not support explicitly specifying UTC offset for Time") + } + + args = time_params(year, month, day, hour, min, sec); + year = args[0]; + month = args[1]; + day = args[2]; + hour = args[3]; + min = args[4]; + sec = args[5]; + + result = new Date(year, month, day, hour, min, 0, sec * 1000); + if (year < 100) { + result.setFullYear(year); + } + return result; + ; + }, TMP_Time_new_2.$$arity = -1); + Opal.defs(self, '$local', TMP_Time_local_3 = function $$local(year, month, day, hour, min, sec, millisecond, _dummy1, _dummy2, _dummy3) { + var self = this; + + + + if (month == null) { + month = nil; + }; + + if (day == null) { + day = nil; + }; + + if (hour == null) { + hour = nil; + }; + + if (min == null) { + min = nil; + }; + + if (sec == null) { + sec = nil; + }; + + if (millisecond == null) { + millisecond = nil; + }; + + if (_dummy1 == null) { + _dummy1 = nil; + }; + + if (_dummy2 == null) { + _dummy2 = nil; + }; + + if (_dummy3 == null) { + _dummy3 = nil; + }; + + var args, result; + + if (arguments.length === 10) { + args = $slice.call(arguments); + year = args[5]; + month = args[4]; + day = args[3]; + hour = args[2]; + min = args[1]; + sec = args[0]; + } + + args = time_params(year, month, day, hour, min, sec); + year = args[0]; + month = args[1]; + day = args[2]; + hour = args[3]; + min = args[4]; + sec = args[5]; + + result = new Date(year, month, day, hour, min, 0, sec * 1000); + if (year < 100) { + result.setFullYear(year); + } + return result; + ; + }, TMP_Time_local_3.$$arity = -2); + Opal.defs(self, '$gm', TMP_Time_gm_4 = function $$gm(year, month, day, hour, min, sec, millisecond, _dummy1, _dummy2, _dummy3) { + var self = this; + + + + if (month == null) { + month = nil; + }; + + if (day == null) { + day = nil; + }; + + if (hour == null) { + hour = nil; + }; + + if (min == null) { + min = nil; + }; + + if (sec == null) { + sec = nil; + }; + + if (millisecond == null) { + millisecond = nil; + }; + + if (_dummy1 == null) { + _dummy1 = nil; + }; + + if (_dummy2 == null) { + _dummy2 = nil; + }; + + if (_dummy3 == null) { + _dummy3 = nil; + }; + + var args, result; + + if (arguments.length === 10) { + args = $slice.call(arguments); + year = args[5]; + month = args[4]; + day = args[3]; + hour = args[2]; + min = args[1]; + sec = args[0]; + } + + args = time_params(year, month, day, hour, min, sec); + year = args[0]; + month = args[1]; + day = args[2]; + hour = args[3]; + min = args[4]; + sec = args[5]; + + result = new Date(Date.UTC(year, month, day, hour, min, 0, sec * 1000)); + if (year < 100) { + result.setUTCFullYear(year); + } + result.is_utc = true; + return result; + ; + }, TMP_Time_gm_4.$$arity = -2); + (function(self, $parent_nesting) { + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + + Opal.alias(self, "mktime", "local"); + return Opal.alias(self, "utc", "gm"); + })(Opal.get_singleton_class(self), $nesting); + Opal.defs(self, '$now', TMP_Time_now_5 = function $$now() { + var self = this; + + return self.$new() + }, TMP_Time_now_5.$$arity = 0); + + Opal.def(self, '$+', TMP_Time_$_6 = function(other) { + var self = this; + + + if ($truthy($$($nesting, 'Time')['$==='](other))) { + self.$raise($$($nesting, 'TypeError'), "time + time?")}; + + if (!other.$$is_number) { + other = $$($nesting, 'Opal')['$coerce_to!'](other, $$($nesting, 'Integer'), "to_int"); + } + var result = new Date(self.getTime() + (other * 1000)); + result.is_utc = self.is_utc; + return result; + ; + }, TMP_Time_$_6.$$arity = 1); + + Opal.def(self, '$-', TMP_Time_$_7 = function(other) { + var self = this; + + + if ($truthy($$($nesting, 'Time')['$==='](other))) { + return (self.getTime() - other.getTime()) / 1000}; + + if (!other.$$is_number) { + other = $$($nesting, 'Opal')['$coerce_to!'](other, $$($nesting, 'Integer'), "to_int"); + } + var result = new Date(self.getTime() - (other * 1000)); + result.is_utc = self.is_utc; + return result; + ; + }, TMP_Time_$_7.$$arity = 1); + + Opal.def(self, '$<=>', TMP_Time_$lt$eq$gt_8 = function(other) { + var self = this, r = nil; + + if ($truthy($$($nesting, 'Time')['$==='](other))) { + return self.$to_f()['$<=>'](other.$to_f()) + } else { + + r = other['$<=>'](self); + if ($truthy(r['$nil?']())) { + return nil + } else if ($truthy($rb_gt(r, 0))) { + return -1 + } else if ($truthy($rb_lt(r, 0))) { + return 1 + } else { + return 0 + }; + } + }, TMP_Time_$lt$eq$gt_8.$$arity = 1); + + Opal.def(self, '$==', TMP_Time_$eq$eq_9 = function(other) { + var $a, self = this; + + return ($truthy($a = $$($nesting, 'Time')['$==='](other)) ? self.$to_f() === other.$to_f() : $a) + }, TMP_Time_$eq$eq_9.$$arity = 1); + + Opal.def(self, '$asctime', TMP_Time_asctime_10 = function $$asctime() { + var self = this; + + return self.$strftime("%a %b %e %H:%M:%S %Y") + }, TMP_Time_asctime_10.$$arity = 0); + Opal.alias(self, "ctime", "asctime"); + + Opal.def(self, '$day', TMP_Time_day_11 = function $$day() { + var self = this; + + return self.is_utc ? self.getUTCDate() : self.getDate(); + }, TMP_Time_day_11.$$arity = 0); + + Opal.def(self, '$yday', TMP_Time_yday_12 = function $$yday() { + var self = this, start_of_year = nil, start_of_day = nil, one_day = nil; + + + start_of_year = $$($nesting, 'Time').$new(self.$year()).$to_i(); + start_of_day = $$($nesting, 'Time').$new(self.$year(), self.$month(), self.$day()).$to_i(); + one_day = 86400; + return $rb_plus($rb_divide($rb_minus(start_of_day, start_of_year), one_day).$round(), 1); + }, TMP_Time_yday_12.$$arity = 0); + + Opal.def(self, '$isdst', TMP_Time_isdst_13 = function $$isdst() { + var self = this; + + + var jan = new Date(self.getFullYear(), 0, 1), + jul = new Date(self.getFullYear(), 6, 1); + return self.getTimezoneOffset() < Math.max(jan.getTimezoneOffset(), jul.getTimezoneOffset()); + + }, TMP_Time_isdst_13.$$arity = 0); + Opal.alias(self, "dst?", "isdst"); + + Opal.def(self, '$dup', TMP_Time_dup_14 = function $$dup() { + var self = this, copy = nil; + + + copy = new Date(self.getTime()); + copy.$copy_instance_variables(self); + copy.$initialize_dup(self); + return copy; + }, TMP_Time_dup_14.$$arity = 0); + + Opal.def(self, '$eql?', TMP_Time_eql$q_15 = function(other) { + var $a, self = this; + + return ($truthy($a = other['$is_a?']($$($nesting, 'Time'))) ? self['$<=>'](other)['$zero?']() : $a) + }, TMP_Time_eql$q_15.$$arity = 1); + + Opal.def(self, '$friday?', TMP_Time_friday$q_16 = function() { + var self = this; + + return self.$wday() == 5 + }, TMP_Time_friday$q_16.$$arity = 0); + + Opal.def(self, '$hash', TMP_Time_hash_17 = function $$hash() { + var self = this; + + return 'Time:' + self.getTime(); + }, TMP_Time_hash_17.$$arity = 0); + + Opal.def(self, '$hour', TMP_Time_hour_18 = function $$hour() { + var self = this; + + return self.is_utc ? self.getUTCHours() : self.getHours(); + }, TMP_Time_hour_18.$$arity = 0); + + Opal.def(self, '$inspect', TMP_Time_inspect_19 = function $$inspect() { + var self = this; + + if ($truthy(self['$utc?']())) { + return self.$strftime("%Y-%m-%d %H:%M:%S UTC") + } else { + return self.$strftime("%Y-%m-%d %H:%M:%S %z") + } + }, TMP_Time_inspect_19.$$arity = 0); + Opal.alias(self, "mday", "day"); + + Opal.def(self, '$min', TMP_Time_min_20 = function $$min() { + var self = this; + + return self.is_utc ? self.getUTCMinutes() : self.getMinutes(); + }, TMP_Time_min_20.$$arity = 0); + + Opal.def(self, '$mon', TMP_Time_mon_21 = function $$mon() { + var self = this; + + return (self.is_utc ? self.getUTCMonth() : self.getMonth()) + 1; + }, TMP_Time_mon_21.$$arity = 0); + + Opal.def(self, '$monday?', TMP_Time_monday$q_22 = function() { + var self = this; + + return self.$wday() == 1 + }, TMP_Time_monday$q_22.$$arity = 0); + Opal.alias(self, "month", "mon"); + + Opal.def(self, '$saturday?', TMP_Time_saturday$q_23 = function() { + var self = this; + + return self.$wday() == 6 + }, TMP_Time_saturday$q_23.$$arity = 0); + + Opal.def(self, '$sec', TMP_Time_sec_24 = function $$sec() { + var self = this; + + return self.is_utc ? self.getUTCSeconds() : self.getSeconds(); + }, TMP_Time_sec_24.$$arity = 0); + + Opal.def(self, '$succ', TMP_Time_succ_25 = function $$succ() { + var self = this; + + + var result = new Date(self.getTime() + 1000); + result.is_utc = self.is_utc; + return result; + + }, TMP_Time_succ_25.$$arity = 0); + + Opal.def(self, '$usec', TMP_Time_usec_26 = function $$usec() { + var self = this; + + return self.getMilliseconds() * 1000; + }, TMP_Time_usec_26.$$arity = 0); + + Opal.def(self, '$zone', TMP_Time_zone_27 = function $$zone() { + var self = this; + + + var string = self.toString(), + result; + + if (string.indexOf('(') == -1) { + result = string.match(/[A-Z]{3,4}/)[0]; + } + else { + result = string.match(/\((.+)\)(?:\s|$)/)[1] + } + + if (result == "GMT" && /(GMT\W*\d{4})/.test(string)) { + return RegExp.$1; + } + else { + return result; + } + + }, TMP_Time_zone_27.$$arity = 0); + + Opal.def(self, '$getgm', TMP_Time_getgm_28 = function $$getgm() { + var self = this; + + + var result = new Date(self.getTime()); + result.is_utc = true; + return result; + + }, TMP_Time_getgm_28.$$arity = 0); + Opal.alias(self, "getutc", "getgm"); + + Opal.def(self, '$gmtime', TMP_Time_gmtime_29 = function $$gmtime() { + var self = this; + + + self.is_utc = true; + return self; + + }, TMP_Time_gmtime_29.$$arity = 0); + Opal.alias(self, "utc", "gmtime"); + + Opal.def(self, '$gmt?', TMP_Time_gmt$q_30 = function() { + var self = this; + + return self.is_utc === true; + }, TMP_Time_gmt$q_30.$$arity = 0); + + Opal.def(self, '$gmt_offset', TMP_Time_gmt_offset_31 = function $$gmt_offset() { + var self = this; + + return -self.getTimezoneOffset() * 60; + }, TMP_Time_gmt_offset_31.$$arity = 0); + + Opal.def(self, '$strftime', TMP_Time_strftime_32 = function $$strftime(format) { + var self = this; + + + return format.replace(/%([\-_#^0]*:{0,2})(\d+)?([EO]*)(.)/g, function(full, flags, width, _, conv) { + var result = "", + zero = flags.indexOf('0') !== -1, + pad = flags.indexOf('-') === -1, + blank = flags.indexOf('_') !== -1, + upcase = flags.indexOf('^') !== -1, + invert = flags.indexOf('#') !== -1, + colons = (flags.match(':') || []).length; + + width = parseInt(width, 10); + + if (zero && blank) { + if (flags.indexOf('0') < flags.indexOf('_')) { + zero = false; + } + else { + blank = false; + } + } + + switch (conv) { + case 'Y': + result += self.$year(); + break; + + case 'C': + zero = !blank; + result += Math.round(self.$year() / 100); + break; + + case 'y': + zero = !blank; + result += (self.$year() % 100); + break; + + case 'm': + zero = !blank; + result += self.$mon(); + break; + + case 'B': + result += long_months[self.$mon() - 1]; + break; + + case 'b': + case 'h': + blank = !zero; + result += short_months[self.$mon() - 1]; + break; + + case 'd': + zero = !blank + result += self.$day(); + break; + + case 'e': + blank = !zero + result += self.$day(); + break; + + case 'j': + result += self.$yday(); + break; + + case 'H': + zero = !blank; + result += self.$hour(); + break; + + case 'k': + blank = !zero; + result += self.$hour(); + break; + + case 'I': + zero = !blank; + result += (self.$hour() % 12 || 12); + break; + + case 'l': + blank = !zero; + result += (self.$hour() % 12 || 12); + break; + + case 'P': + result += (self.$hour() >= 12 ? "pm" : "am"); + break; + + case 'p': + result += (self.$hour() >= 12 ? "PM" : "AM"); + break; + + case 'M': + zero = !blank; + result += self.$min(); + break; + + case 'S': + zero = !blank; + result += self.$sec() + break; + + case 'L': + zero = !blank; + width = isNaN(width) ? 3 : width; + result += self.getMilliseconds(); + break; + + case 'N': + width = isNaN(width) ? 9 : width; + result += (self.getMilliseconds().toString()).$rjust(3, "0"); + result = (result).$ljust(width, "0"); + break; + + case 'z': + var offset = self.getTimezoneOffset(), + hours = Math.floor(Math.abs(offset) / 60), + minutes = Math.abs(offset) % 60; + + result += offset < 0 ? "+" : "-"; + result += hours < 10 ? "0" : ""; + result += hours; + + if (colons > 0) { + result += ":"; + } + + result += minutes < 10 ? "0" : ""; + result += minutes; + + if (colons > 1) { + result += ":00"; + } + + break; + + case 'Z': + result += self.$zone(); + break; + + case 'A': + result += days_of_week[self.$wday()]; + break; + + case 'a': + result += short_days[self.$wday()]; + break; + + case 'u': + result += (self.$wday() + 1); + break; + + case 'w': + result += self.$wday(); + break; + + case 'V': + result += self.$cweek_cyear()['$[]'](0).$to_s().$rjust(2, "0"); + break; + + case 'G': + result += self.$cweek_cyear()['$[]'](1); + break; + + case 'g': + result += self.$cweek_cyear()['$[]'](1)['$[]']($range(-2, -1, false)); + break; + + case 's': + result += self.$to_i(); + break; + + case 'n': + result += "\n"; + break; + + case 't': + result += "\t"; + break; + + case '%': + result += "%"; + break; + + case 'c': + result += self.$strftime("%a %b %e %T %Y"); + break; + + case 'D': + case 'x': + result += self.$strftime("%m/%d/%y"); + break; + + case 'F': + result += self.$strftime("%Y-%m-%d"); + break; + + case 'v': + result += self.$strftime("%e-%^b-%4Y"); + break; + + case 'r': + result += self.$strftime("%I:%M:%S %p"); + break; + + case 'R': + result += self.$strftime("%H:%M"); + break; + + case 'T': + case 'X': + result += self.$strftime("%H:%M:%S"); + break; + + default: + return full; + } + + if (upcase) { + result = result.toUpperCase(); + } + + if (invert) { + result = result.replace(/[A-Z]/, function(c) { c.toLowerCase() }). + replace(/[a-z]/, function(c) { c.toUpperCase() }); + } + + if (pad && (zero || blank)) { + result = (result).$rjust(isNaN(width) ? 2 : width, blank ? " " : "0"); + } + + return result; + }); + + }, TMP_Time_strftime_32.$$arity = 1); + + Opal.def(self, '$sunday?', TMP_Time_sunday$q_33 = function() { + var self = this; + + return self.$wday() == 0 + }, TMP_Time_sunday$q_33.$$arity = 0); + + Opal.def(self, '$thursday?', TMP_Time_thursday$q_34 = function() { + var self = this; + + return self.$wday() == 4 + }, TMP_Time_thursday$q_34.$$arity = 0); + + Opal.def(self, '$to_a', TMP_Time_to_a_35 = function $$to_a() { + var self = this; + + return [self.$sec(), self.$min(), self.$hour(), self.$day(), self.$month(), self.$year(), self.$wday(), self.$yday(), self.$isdst(), self.$zone()] + }, TMP_Time_to_a_35.$$arity = 0); + + Opal.def(self, '$to_f', TMP_Time_to_f_36 = function $$to_f() { + var self = this; + + return self.getTime() / 1000; + }, TMP_Time_to_f_36.$$arity = 0); + + Opal.def(self, '$to_i', TMP_Time_to_i_37 = function $$to_i() { + var self = this; + + return parseInt(self.getTime() / 1000, 10); + }, TMP_Time_to_i_37.$$arity = 0); + Opal.alias(self, "to_s", "inspect"); + + Opal.def(self, '$tuesday?', TMP_Time_tuesday$q_38 = function() { + var self = this; + + return self.$wday() == 2 + }, TMP_Time_tuesday$q_38.$$arity = 0); + Opal.alias(self, "tv_sec", "to_i"); + Opal.alias(self, "tv_usec", "usec"); + Opal.alias(self, "utc?", "gmt?"); + Opal.alias(self, "gmtoff", "gmt_offset"); + Opal.alias(self, "utc_offset", "gmt_offset"); + + Opal.def(self, '$wday', TMP_Time_wday_39 = function $$wday() { + var self = this; + + return self.is_utc ? self.getUTCDay() : self.getDay(); + }, TMP_Time_wday_39.$$arity = 0); + + Opal.def(self, '$wednesday?', TMP_Time_wednesday$q_40 = function() { + var self = this; + + return self.$wday() == 3 + }, TMP_Time_wednesday$q_40.$$arity = 0); + + Opal.def(self, '$year', TMP_Time_year_41 = function $$year() { + var self = this; + + return self.is_utc ? self.getUTCFullYear() : self.getFullYear(); + }, TMP_Time_year_41.$$arity = 0); + return (Opal.def(self, '$cweek_cyear', TMP_Time_cweek_cyear_42 = function $$cweek_cyear() { + var $a, self = this, jan01 = nil, jan01_wday = nil, first_monday = nil, year = nil, offset = nil, week = nil, dec31 = nil, dec31_wday = nil; + + + jan01 = $$($nesting, 'Time').$new(self.$year(), 1, 1); + jan01_wday = jan01.$wday(); + first_monday = 0; + year = self.$year(); + if ($truthy(($truthy($a = $rb_le(jan01_wday, 4)) ? jan01_wday['$!='](0) : $a))) { + offset = $rb_minus(jan01_wday, 1) + } else { + + offset = $rb_minus($rb_minus(jan01_wday, 7), 1); + if (offset['$=='](-8)) { + offset = -1}; + }; + week = $rb_divide($rb_plus(self.$yday(), offset), 7.0).$ceil(); + if ($truthy($rb_le(week, 0))) { + return $$($nesting, 'Time').$new($rb_minus(self.$year(), 1), 12, 31).$cweek_cyear() + } else if (week['$=='](53)) { + + dec31 = $$($nesting, 'Time').$new(self.$year(), 12, 31); + dec31_wday = dec31.$wday(); + if ($truthy(($truthy($a = $rb_le(dec31_wday, 3)) ? dec31_wday['$!='](0) : $a))) { + + week = 1; + year = $rb_plus(year, 1);};}; + return [week, year]; + }, TMP_Time_cweek_cyear_42.$$arity = 0), nil) && 'cweek_cyear'; + })($nesting[0], Date, $nesting); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/struct"] = function(Opal) { + function $rb_gt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); + } + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + function $rb_lt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); + } + function $rb_ge(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs >= rhs : lhs['$>='](rhs); + } + function $rb_plus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $hash2 = Opal.hash2, $truthy = Opal.truthy, $send = Opal.send; + + Opal.add_stubs(['$require', '$include', '$const_name!', '$unshift', '$map', '$coerce_to!', '$new', '$each', '$define_struct_attribute', '$allocate', '$initialize', '$alias_method', '$module_eval', '$to_proc', '$const_set', '$==', '$raise', '$<<', '$members', '$define_method', '$instance_eval', '$class', '$last', '$>', '$length', '$-', '$keys', '$any?', '$join', '$[]', '$[]=', '$each_with_index', '$hash', '$===', '$<', '$-@', '$size', '$>=', '$include?', '$to_sym', '$instance_of?', '$__id__', '$eql?', '$enum_for', '$name', '$+', '$each_pair', '$inspect', '$each_with_object', '$flatten', '$to_a', '$respond_to?', '$dig']); + + self.$require("corelib/enumerable"); + return (function($base, $super, $parent_nesting) { + function $Struct(){}; + var self = $Struct = $klass($base, $super, 'Struct', $Struct); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Struct_new_1, TMP_Struct_define_struct_attribute_6, TMP_Struct_members_9, TMP_Struct_inherited_10, TMP_Struct_initialize_12, TMP_Struct_members_15, TMP_Struct_hash_16, TMP_Struct_$$_17, TMP_Struct_$$$eq_18, TMP_Struct_$eq$eq_19, TMP_Struct_eql$q_20, TMP_Struct_each_21, TMP_Struct_each_pair_24, TMP_Struct_length_27, TMP_Struct_to_a_28, TMP_Struct_inspect_30, TMP_Struct_to_h_32, TMP_Struct_values_at_34, TMP_Struct_dig_36; + + + self.$include($$($nesting, 'Enumerable')); + Opal.defs(self, '$new', TMP_Struct_new_1 = function(const_name, $a, $b) { + var $iter = TMP_Struct_new_1.$$p, block = $iter || nil, $post_args, $kwargs, args, keyword_init, TMP_2, TMP_3, self = this, klass = nil; + + if ($iter) TMP_Struct_new_1.$$p = null; + + + if ($iter) TMP_Struct_new_1.$$p = null;; + + $post_args = Opal.slice.call(arguments, 1, arguments.length); + + $kwargs = Opal.extract_kwargs($post_args); + + if ($kwargs == null) { + $kwargs = $hash2([], {}); + } else if (!$kwargs.$$is_hash) { + throw Opal.ArgumentError.$new('expected kwargs'); + }; + + args = $post_args;; + + keyword_init = $kwargs.$$smap["keyword_init"]; + if (keyword_init == null) { + keyword_init = false + }; + if ($truthy(const_name)) { + + try { + const_name = $$($nesting, 'Opal')['$const_name!'](const_name) + } catch ($err) { + if (Opal.rescue($err, [$$($nesting, 'TypeError'), $$($nesting, 'NameError')])) { + try { + + args.$unshift(const_name); + const_name = nil; + } finally { Opal.pop_exception() } + } else { throw $err; } + };}; + $send(args, 'map', [], (TMP_2 = function(arg){var self = TMP_2.$$s || this; + + + + if (arg == null) { + arg = nil; + }; + return $$($nesting, 'Opal')['$coerce_to!'](arg, $$($nesting, 'String'), "to_str");}, TMP_2.$$s = self, TMP_2.$$arity = 1, TMP_2)); + klass = $send($$($nesting, 'Class'), 'new', [self], (TMP_3 = function(){var self = TMP_3.$$s || this, TMP_4; + + + $send(args, 'each', [], (TMP_4 = function(arg){var self = TMP_4.$$s || this; + + + + if (arg == null) { + arg = nil; + }; + return self.$define_struct_attribute(arg);}, TMP_4.$$s = self, TMP_4.$$arity = 1, TMP_4)); + return (function(self, $parent_nesting) { + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_new_5; + + + + Opal.def(self, '$new', TMP_new_5 = function($a) { + var $post_args, args, self = this, instance = nil; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + instance = self.$allocate(); + instance.$$data = {}; + $send(instance, 'initialize', Opal.to_a(args)); + return instance; + }, TMP_new_5.$$arity = -1); + return self.$alias_method("[]", "new"); + })(Opal.get_singleton_class(self), $nesting);}, TMP_3.$$s = self, TMP_3.$$arity = 0, TMP_3)); + if ($truthy(block)) { + $send(klass, 'module_eval', [], block.$to_proc())}; + klass.$$keyword_init = keyword_init; + if ($truthy(const_name)) { + $$($nesting, 'Struct').$const_set(const_name, klass)}; + return klass; + }, TMP_Struct_new_1.$$arity = -2); + Opal.defs(self, '$define_struct_attribute', TMP_Struct_define_struct_attribute_6 = function $$define_struct_attribute(name) { + var TMP_7, TMP_8, self = this; + + + if (self['$==']($$($nesting, 'Struct'))) { + self.$raise($$($nesting, 'ArgumentError'), "you cannot define attributes to the Struct class")}; + self.$members()['$<<'](name); + $send(self, 'define_method', [name], (TMP_7 = function(){var self = TMP_7.$$s || this; + + return self.$$data[name];}, TMP_7.$$s = self, TMP_7.$$arity = 0, TMP_7)); + return $send(self, 'define_method', ["" + (name) + "="], (TMP_8 = function(value){var self = TMP_8.$$s || this; + + + + if (value == null) { + value = nil; + }; + return self.$$data[name] = value;;}, TMP_8.$$s = self, TMP_8.$$arity = 1, TMP_8)); + }, TMP_Struct_define_struct_attribute_6.$$arity = 1); + Opal.defs(self, '$members', TMP_Struct_members_9 = function $$members() { + var $a, self = this; + if (self.members == null) self.members = nil; + + + if (self['$==']($$($nesting, 'Struct'))) { + self.$raise($$($nesting, 'ArgumentError'), "the Struct class has no members")}; + return (self.members = ($truthy($a = self.members) ? $a : [])); + }, TMP_Struct_members_9.$$arity = 0); + Opal.defs(self, '$inherited', TMP_Struct_inherited_10 = function $$inherited(klass) { + var TMP_11, self = this, members = nil; + if (self.members == null) self.members = nil; + + + members = self.members; + return $send(klass, 'instance_eval', [], (TMP_11 = function(){var self = TMP_11.$$s || this; + + return (self.members = members)}, TMP_11.$$s = self, TMP_11.$$arity = 0, TMP_11)); + }, TMP_Struct_inherited_10.$$arity = 1); + + Opal.def(self, '$initialize', TMP_Struct_initialize_12 = function $$initialize($a) { + var $post_args, args, $b, TMP_13, TMP_14, self = this, kwargs = nil, extra = nil; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + if ($truthy(self.$class().$$keyword_init)) { + + kwargs = ($truthy($b = args.$last()) ? $b : $hash2([], {})); + if ($truthy(($truthy($b = $rb_gt(args.$length(), 1)) ? $b : (args.length === 1 && !kwargs.$$is_hash)))) { + self.$raise($$($nesting, 'ArgumentError'), "" + "wrong number of arguments (given " + (args.$length()) + ", expected 0)")}; + extra = $rb_minus(kwargs.$keys(), self.$class().$members()); + if ($truthy(extra['$any?']())) { + self.$raise($$($nesting, 'ArgumentError'), "" + "unknown keywords: " + (extra.$join(", ")))}; + return $send(self.$class().$members(), 'each', [], (TMP_13 = function(name){var self = TMP_13.$$s || this, $writer = nil; + + + + if (name == null) { + name = nil; + }; + $writer = [name, kwargs['$[]'](name)]; + $send(self, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];}, TMP_13.$$s = self, TMP_13.$$arity = 1, TMP_13)); + } else { + + if ($truthy($rb_gt(args.$length(), self.$class().$members().$length()))) { + self.$raise($$($nesting, 'ArgumentError'), "struct size differs")}; + return $send(self.$class().$members(), 'each_with_index', [], (TMP_14 = function(name, index){var self = TMP_14.$$s || this, $writer = nil; + + + + if (name == null) { + name = nil; + }; + + if (index == null) { + index = nil; + }; + $writer = [name, args['$[]'](index)]; + $send(self, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];}, TMP_14.$$s = self, TMP_14.$$arity = 2, TMP_14)); + }; + }, TMP_Struct_initialize_12.$$arity = -1); + + Opal.def(self, '$members', TMP_Struct_members_15 = function $$members() { + var self = this; + + return self.$class().$members() + }, TMP_Struct_members_15.$$arity = 0); + + Opal.def(self, '$hash', TMP_Struct_hash_16 = function $$hash() { + var self = this; + + return $$($nesting, 'Hash').$new(self.$$data).$hash() + }, TMP_Struct_hash_16.$$arity = 0); + + Opal.def(self, '$[]', TMP_Struct_$$_17 = function(name) { + var self = this; + + + if ($truthy($$($nesting, 'Integer')['$==='](name))) { + + if ($truthy($rb_lt(name, self.$class().$members().$size()['$-@']()))) { + self.$raise($$($nesting, 'IndexError'), "" + "offset " + (name) + " too small for struct(size:" + (self.$class().$members().$size()) + ")")}; + if ($truthy($rb_ge(name, self.$class().$members().$size()))) { + self.$raise($$($nesting, 'IndexError'), "" + "offset " + (name) + " too large for struct(size:" + (self.$class().$members().$size()) + ")")}; + name = self.$class().$members()['$[]'](name); + } else if ($truthy($$($nesting, 'String')['$==='](name))) { + + if(!self.$$data.hasOwnProperty(name)) { + self.$raise($$($nesting, 'NameError').$new("" + "no member '" + (name) + "' in struct", name)) + } + + } else { + self.$raise($$($nesting, 'TypeError'), "" + "no implicit conversion of " + (name.$class()) + " into Integer") + }; + name = $$($nesting, 'Opal')['$coerce_to!'](name, $$($nesting, 'String'), "to_str"); + return self.$$data[name];; + }, TMP_Struct_$$_17.$$arity = 1); + + Opal.def(self, '$[]=', TMP_Struct_$$$eq_18 = function(name, value) { + var self = this; + + + if ($truthy($$($nesting, 'Integer')['$==='](name))) { + + if ($truthy($rb_lt(name, self.$class().$members().$size()['$-@']()))) { + self.$raise($$($nesting, 'IndexError'), "" + "offset " + (name) + " too small for struct(size:" + (self.$class().$members().$size()) + ")")}; + if ($truthy($rb_ge(name, self.$class().$members().$size()))) { + self.$raise($$($nesting, 'IndexError'), "" + "offset " + (name) + " too large for struct(size:" + (self.$class().$members().$size()) + ")")}; + name = self.$class().$members()['$[]'](name); + } else if ($truthy($$($nesting, 'String')['$==='](name))) { + if ($truthy(self.$class().$members()['$include?'](name.$to_sym()))) { + } else { + self.$raise($$($nesting, 'NameError').$new("" + "no member '" + (name) + "' in struct", name)) + } + } else { + self.$raise($$($nesting, 'TypeError'), "" + "no implicit conversion of " + (name.$class()) + " into Integer") + }; + name = $$($nesting, 'Opal')['$coerce_to!'](name, $$($nesting, 'String'), "to_str"); + return self.$$data[name] = value;; + }, TMP_Struct_$$$eq_18.$$arity = 2); + + Opal.def(self, '$==', TMP_Struct_$eq$eq_19 = function(other) { + var self = this; + + + if ($truthy(other['$instance_of?'](self.$class()))) { + } else { + return false + }; + + var recursed1 = {}, recursed2 = {}; + + function _eqeq(struct, other) { + var key, a, b; + + recursed1[(struct).$__id__()] = true; + recursed2[(other).$__id__()] = true; + + for (key in struct.$$data) { + a = struct.$$data[key]; + b = other.$$data[key]; + + if ($$($nesting, 'Struct')['$==='](a)) { + if (!recursed1.hasOwnProperty((a).$__id__()) || !recursed2.hasOwnProperty((b).$__id__())) { + if (!_eqeq(a, b)) { + return false; + } + } + } else { + if (!(a)['$=='](b)) { + return false; + } + } + } + + return true; + } + + return _eqeq(self, other); + ; + }, TMP_Struct_$eq$eq_19.$$arity = 1); + + Opal.def(self, '$eql?', TMP_Struct_eql$q_20 = function(other) { + var self = this; + + + if ($truthy(other['$instance_of?'](self.$class()))) { + } else { + return false + }; + + var recursed1 = {}, recursed2 = {}; + + function _eqeq(struct, other) { + var key, a, b; + + recursed1[(struct).$__id__()] = true; + recursed2[(other).$__id__()] = true; + + for (key in struct.$$data) { + a = struct.$$data[key]; + b = other.$$data[key]; + + if ($$($nesting, 'Struct')['$==='](a)) { + if (!recursed1.hasOwnProperty((a).$__id__()) || !recursed2.hasOwnProperty((b).$__id__())) { + if (!_eqeq(a, b)) { + return false; + } + } + } else { + if (!(a)['$eql?'](b)) { + return false; + } + } + } + + return true; + } + + return _eqeq(self, other); + ; + }, TMP_Struct_eql$q_20.$$arity = 1); + + Opal.def(self, '$each', TMP_Struct_each_21 = function $$each() { + var TMP_22, TMP_23, $iter = TMP_Struct_each_21.$$p, $yield = $iter || nil, self = this; + + if ($iter) TMP_Struct_each_21.$$p = null; + + if (($yield !== nil)) { + } else { + return $send(self, 'enum_for', ["each"], (TMP_22 = function(){var self = TMP_22.$$s || this; + + return self.$size()}, TMP_22.$$s = self, TMP_22.$$arity = 0, TMP_22)) + }; + $send(self.$class().$members(), 'each', [], (TMP_23 = function(name){var self = TMP_23.$$s || this; + + + + if (name == null) { + name = nil; + }; + return Opal.yield1($yield, self['$[]'](name));;}, TMP_23.$$s = self, TMP_23.$$arity = 1, TMP_23)); + return self; + }, TMP_Struct_each_21.$$arity = 0); + + Opal.def(self, '$each_pair', TMP_Struct_each_pair_24 = function $$each_pair() { + var TMP_25, TMP_26, $iter = TMP_Struct_each_pair_24.$$p, $yield = $iter || nil, self = this; + + if ($iter) TMP_Struct_each_pair_24.$$p = null; + + if (($yield !== nil)) { + } else { + return $send(self, 'enum_for', ["each_pair"], (TMP_25 = function(){var self = TMP_25.$$s || this; + + return self.$size()}, TMP_25.$$s = self, TMP_25.$$arity = 0, TMP_25)) + }; + $send(self.$class().$members(), 'each', [], (TMP_26 = function(name){var self = TMP_26.$$s || this; + + + + if (name == null) { + name = nil; + }; + return Opal.yield1($yield, [name, self['$[]'](name)]);;}, TMP_26.$$s = self, TMP_26.$$arity = 1, TMP_26)); + return self; + }, TMP_Struct_each_pair_24.$$arity = 0); + + Opal.def(self, '$length', TMP_Struct_length_27 = function $$length() { + var self = this; + + return self.$class().$members().$length() + }, TMP_Struct_length_27.$$arity = 0); + Opal.alias(self, "size", "length"); + + Opal.def(self, '$to_a', TMP_Struct_to_a_28 = function $$to_a() { + var TMP_29, self = this; + + return $send(self.$class().$members(), 'map', [], (TMP_29 = function(name){var self = TMP_29.$$s || this; + + + + if (name == null) { + name = nil; + }; + return self['$[]'](name);}, TMP_29.$$s = self, TMP_29.$$arity = 1, TMP_29)) + }, TMP_Struct_to_a_28.$$arity = 0); + Opal.alias(self, "values", "to_a"); + + Opal.def(self, '$inspect', TMP_Struct_inspect_30 = function $$inspect() { + var $a, TMP_31, self = this, result = nil; + + + result = "#"); + return result; + }, TMP_Struct_inspect_30.$$arity = 0); + Opal.alias(self, "to_s", "inspect"); + + Opal.def(self, '$to_h', TMP_Struct_to_h_32 = function $$to_h() { + var TMP_33, self = this; + + return $send(self.$class().$members(), 'each_with_object', [$hash2([], {})], (TMP_33 = function(name, h){var self = TMP_33.$$s || this, $writer = nil; + + + + if (name == null) { + name = nil; + }; + + if (h == null) { + h = nil; + }; + $writer = [name, self['$[]'](name)]; + $send(h, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];}, TMP_33.$$s = self, TMP_33.$$arity = 2, TMP_33)) + }, TMP_Struct_to_h_32.$$arity = 0); + + Opal.def(self, '$values_at', TMP_Struct_values_at_34 = function $$values_at($a) { + var $post_args, args, TMP_35, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + args = $send(args, 'map', [], (TMP_35 = function(arg){var self = TMP_35.$$s || this; + + + + if (arg == null) { + arg = nil; + }; + return arg.$$is_range ? arg.$to_a() : arg;}, TMP_35.$$s = self, TMP_35.$$arity = 1, TMP_35)).$flatten(); + + var result = []; + for (var i = 0, len = args.length; i < len; i++) { + if (!args[i].$$is_number) { + self.$raise($$($nesting, 'TypeError'), "" + "no implicit conversion of " + ((args[i]).$class()) + " into Integer") + } + result.push(self['$[]'](args[i])); + } + return result; + ; + }, TMP_Struct_values_at_34.$$arity = -1); + return (Opal.def(self, '$dig', TMP_Struct_dig_36 = function $$dig(key, $a) { + var $post_args, keys, self = this, item = nil; + + + + $post_args = Opal.slice.call(arguments, 1, arguments.length); + + keys = $post_args;; + item = (function() {if ($truthy(key.$$is_string && self.$$data.hasOwnProperty(key))) { + return self.$$data[key] || nil; + } else { + return nil + }; return nil; })(); + + if (item === nil || keys.length === 0) { + return item; + } + ; + if ($truthy(item['$respond_to?']("dig"))) { + } else { + self.$raise($$($nesting, 'TypeError'), "" + (item.$class()) + " does not have #dig method") + }; + return $send(item, 'dig', Opal.to_a(keys)); + }, TMP_Struct_dig_36.$$arity = -2), nil) && 'dig'; + })($nesting[0], null, $nesting); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/io"] = function(Opal) { + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $module = Opal.module, $send = Opal.send, $gvars = Opal.gvars, $truthy = Opal.truthy, $writer = nil; + + Opal.add_stubs(['$attr_accessor', '$size', '$write', '$join', '$map', '$String', '$empty?', '$concat', '$chomp', '$getbyte', '$getc', '$raise', '$new', '$write_proc=', '$-', '$extend']); + + (function($base, $super, $parent_nesting) { + function $IO(){}; + var self = $IO = $klass($base, $super, 'IO', $IO); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_IO_tty$q_1, TMP_IO_closed$q_2, TMP_IO_write_3, TMP_IO_flush_4; + + def.tty = def.closed = nil; + + Opal.const_set($nesting[0], 'SEEK_SET', 0); + Opal.const_set($nesting[0], 'SEEK_CUR', 1); + Opal.const_set($nesting[0], 'SEEK_END', 2); + + Opal.def(self, '$tty?', TMP_IO_tty$q_1 = function() { + var self = this; + + return self.tty + }, TMP_IO_tty$q_1.$$arity = 0); + + Opal.def(self, '$closed?', TMP_IO_closed$q_2 = function() { + var self = this; + + return self.closed + }, TMP_IO_closed$q_2.$$arity = 0); + self.$attr_accessor("write_proc"); + + Opal.def(self, '$write', TMP_IO_write_3 = function $$write(string) { + var self = this; + + + self.write_proc(string); + return string.$size(); + }, TMP_IO_write_3.$$arity = 1); + self.$attr_accessor("sync", "tty"); + + Opal.def(self, '$flush', TMP_IO_flush_4 = function $$flush() { + var self = this; + + return nil + }, TMP_IO_flush_4.$$arity = 0); + (function($base, $parent_nesting) { + function $Writable() {}; + var self = $Writable = $module($base, 'Writable', $Writable); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Writable_$lt$lt_5, TMP_Writable_print_6, TMP_Writable_puts_8; + + + + Opal.def(self, '$<<', TMP_Writable_$lt$lt_5 = function(string) { + var self = this; + + + self.$write(string); + return self; + }, TMP_Writable_$lt$lt_5.$$arity = 1); + + Opal.def(self, '$print', TMP_Writable_print_6 = function $$print($a) { + var $post_args, args, TMP_7, self = this; + if ($gvars[","] == null) $gvars[","] = nil; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + self.$write($send(args, 'map', [], (TMP_7 = function(arg){var self = TMP_7.$$s || this; + + + + if (arg == null) { + arg = nil; + }; + return self.$String(arg);}, TMP_7.$$s = self, TMP_7.$$arity = 1, TMP_7)).$join($gvars[","])); + return nil; + }, TMP_Writable_print_6.$$arity = -1); + + Opal.def(self, '$puts', TMP_Writable_puts_8 = function $$puts($a) { + var $post_args, args, TMP_9, self = this, newline = nil; + if ($gvars["/"] == null) $gvars["/"] = nil; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + newline = $gvars["/"]; + if ($truthy(args['$empty?']())) { + self.$write($gvars["/"]) + } else { + self.$write($send(args, 'map', [], (TMP_9 = function(arg){var self = TMP_9.$$s || this; + + + + if (arg == null) { + arg = nil; + }; + return self.$String(arg).$chomp();}, TMP_9.$$s = self, TMP_9.$$arity = 1, TMP_9)).$concat([nil]).$join(newline)) + }; + return nil; + }, TMP_Writable_puts_8.$$arity = -1); + })($nesting[0], $nesting); + return (function($base, $parent_nesting) { + function $Readable() {}; + var self = $Readable = $module($base, 'Readable', $Readable); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Readable_readbyte_10, TMP_Readable_readchar_11, TMP_Readable_readline_12, TMP_Readable_readpartial_13; + + + + Opal.def(self, '$readbyte', TMP_Readable_readbyte_10 = function $$readbyte() { + var self = this; + + return self.$getbyte() + }, TMP_Readable_readbyte_10.$$arity = 0); + + Opal.def(self, '$readchar', TMP_Readable_readchar_11 = function $$readchar() { + var self = this; + + return self.$getc() + }, TMP_Readable_readchar_11.$$arity = 0); + + Opal.def(self, '$readline', TMP_Readable_readline_12 = function $$readline(sep) { + var self = this; + if ($gvars["/"] == null) $gvars["/"] = nil; + + + + if (sep == null) { + sep = $gvars["/"]; + }; + return self.$raise($$($nesting, 'NotImplementedError')); + }, TMP_Readable_readline_12.$$arity = -1); + + Opal.def(self, '$readpartial', TMP_Readable_readpartial_13 = function $$readpartial(integer, outbuf) { + var self = this; + + + + if (outbuf == null) { + outbuf = nil; + }; + return self.$raise($$($nesting, 'NotImplementedError')); + }, TMP_Readable_readpartial_13.$$arity = -2); + })($nesting[0], $nesting); + })($nesting[0], null, $nesting); + Opal.const_set($nesting[0], 'STDERR', ($gvars.stderr = $$($nesting, 'IO').$new())); + Opal.const_set($nesting[0], 'STDIN', ($gvars.stdin = $$($nesting, 'IO').$new())); + Opal.const_set($nesting[0], 'STDOUT', ($gvars.stdout = $$($nesting, 'IO').$new())); + var console = Opal.global.console; + + $writer = [typeof(process) === 'object' && typeof(process.stdout) === 'object' ? function(s){process.stdout.write(s)} : function(s){console.log(s)}]; + $send($$($nesting, 'STDOUT'), 'write_proc=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = [typeof(process) === 'object' && typeof(process.stderr) === 'object' ? function(s){process.stderr.write(s)} : function(s){console.warn(s)}]; + $send($$($nesting, 'STDERR'), 'write_proc=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + $$($nesting, 'STDOUT').$extend($$$($$($nesting, 'IO'), 'Writable')); + return $$($nesting, 'STDERR').$extend($$$($$($nesting, 'IO'), 'Writable')); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/main"] = function(Opal) { + var TMP_to_s_1, TMP_include_2, self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice; + + Opal.add_stubs(['$include']); + + Opal.defs(self, '$to_s', TMP_to_s_1 = function $$to_s() { + var self = this; + + return "main" + }, TMP_to_s_1.$$arity = 0); + return (Opal.defs(self, '$include', TMP_include_2 = function $$include(mod) { + var self = this; + + return $$($nesting, 'Object').$include(mod) + }, TMP_include_2.$$arity = 1), nil) && 'include'; +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/dir"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $truthy = Opal.truthy; + + Opal.add_stubs(['$[]']); + return (function($base, $super, $parent_nesting) { + function $Dir(){}; + var self = $Dir = $klass($base, $super, 'Dir', $Dir); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return (function(self, $parent_nesting) { + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_chdir_1, TMP_pwd_2, TMP_home_3; + + + + Opal.def(self, '$chdir', TMP_chdir_1 = function $$chdir(dir) { + var $iter = TMP_chdir_1.$$p, $yield = $iter || nil, self = this, prev_cwd = nil; + + if ($iter) TMP_chdir_1.$$p = null; + return (function() { try { + + prev_cwd = Opal.current_dir; + Opal.current_dir = dir; + return Opal.yieldX($yield, []);; + } finally { + Opal.current_dir = prev_cwd + }; })() + }, TMP_chdir_1.$$arity = 1); + + Opal.def(self, '$pwd', TMP_pwd_2 = function $$pwd() { + var self = this; + + return Opal.current_dir || '.'; + }, TMP_pwd_2.$$arity = 0); + Opal.alias(self, "getwd", "pwd"); + return (Opal.def(self, '$home', TMP_home_3 = function $$home() { + var $a, self = this; + + return ($truthy($a = $$($nesting, 'ENV')['$[]']("HOME")) ? $a : ".") + }, TMP_home_3.$$arity = 0), nil) && 'home'; + })(Opal.get_singleton_class(self), $nesting) + })($nesting[0], null, $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/file"] = function(Opal) { + function $rb_plus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); + } + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $truthy = Opal.truthy, $range = Opal.range, $send = Opal.send; + + Opal.add_stubs(['$home', '$raise', '$start_with?', '$+', '$sub', '$pwd', '$split', '$unshift', '$join', '$respond_to?', '$coerce_to!', '$basename', '$empty?', '$rindex', '$[]', '$nil?', '$==', '$-', '$length', '$gsub', '$find', '$=~', '$map', '$each_with_index', '$flatten', '$reject', '$to_proc', '$end_with?']); + return (function($base, $super, $parent_nesting) { + function $File(){}; + var self = $File = $klass($base, $super, 'File', $File); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), windows_root_rx = nil; + + + Opal.const_set($nesting[0], 'Separator', Opal.const_set($nesting[0], 'SEPARATOR', "/")); + Opal.const_set($nesting[0], 'ALT_SEPARATOR', nil); + Opal.const_set($nesting[0], 'PATH_SEPARATOR', ":"); + Opal.const_set($nesting[0], 'FNM_SYSCASE', 0); + windows_root_rx = /^[a-zA-Z]:(?:\\|\/)/; + return (function(self, $parent_nesting) { + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_expand_path_1, TMP_dirname_2, TMP_basename_3, TMP_extname_4, TMP_exist$q_5, TMP_directory$q_6, TMP_join_8, TMP_split_11; + + + + Opal.def(self, '$expand_path', TMP_expand_path_1 = function $$expand_path(path, basedir) { + var $a, self = this, sep = nil, sep_chars = nil, new_parts = nil, home = nil, home_path_regexp = nil, path_abs = nil, basedir_abs = nil, parts = nil, leading_sep = nil, abs = nil, new_path = nil; + + + + if (basedir == null) { + basedir = nil; + }; + sep = $$($nesting, 'SEPARATOR'); + sep_chars = $sep_chars(); + new_parts = []; + if ($truthy(path[0] === '~' || (basedir && basedir[0] === '~'))) { + + home = $$($nesting, 'Dir').$home(); + if ($truthy(home)) { + } else { + self.$raise($$($nesting, 'ArgumentError'), "couldn't find HOME environment -- expanding `~'") + }; + if ($truthy(home['$start_with?'](sep))) { + } else { + self.$raise($$($nesting, 'ArgumentError'), "non-absolute home") + }; + home = $rb_plus(home, sep); + home_path_regexp = new RegExp("" + "^\\~(?:" + (sep) + "|$)"); + path = path.$sub(home_path_regexp, home); + if ($truthy(basedir)) { + basedir = basedir.$sub(home_path_regexp, home)};}; + basedir = ($truthy($a = basedir) ? $a : $$($nesting, 'Dir').$pwd()); + path_abs = path.substr(0, sep.length) === sep || windows_root_rx.test(path); + basedir_abs = basedir.substr(0, sep.length) === sep || windows_root_rx.test(basedir); + if ($truthy(path_abs)) { + + parts = path.$split(new RegExp("" + "[" + (sep_chars) + "]")); + leading_sep = windows_root_rx.test(path) ? '' : path.$sub(new RegExp("" + "^([" + (sep_chars) + "]+).*$"), "\\1"); + abs = true; + } else { + + parts = $rb_plus(basedir.$split(new RegExp("" + "[" + (sep_chars) + "]")), path.$split(new RegExp("" + "[" + (sep_chars) + "]"))); + leading_sep = windows_root_rx.test(basedir) ? '' : basedir.$sub(new RegExp("" + "^([" + (sep_chars) + "]+).*$"), "\\1"); + abs = basedir_abs; + }; + + var part; + for (var i = 0, ii = parts.length; i < ii; i++) { + part = parts[i]; + + if ( + (part === nil) || + (part === '' && ((new_parts.length === 0) || abs)) || + (part === '.' && ((new_parts.length === 0) || abs)) + ) { + continue; + } + if (part === '..') { + new_parts.pop(); + } else { + new_parts.push(part); + } + } + + if (!abs && parts[0] !== '.') { + new_parts.$unshift(".") + } + ; + new_path = new_parts.$join(sep); + if ($truthy(abs)) { + new_path = $rb_plus(leading_sep, new_path)}; + return new_path; + }, TMP_expand_path_1.$$arity = -2); + Opal.alias(self, "realpath", "expand_path"); + + // Coerce a given path to a path string using #to_path and #to_str + function $coerce_to_path(path) { + if ($truthy((path)['$respond_to?']("to_path"))) { + path = path.$to_path(); + } + + path = $$($nesting, 'Opal')['$coerce_to!'](path, $$($nesting, 'String'), "to_str"); + + return path; + } + + // Return a RegExp compatible char class + function $sep_chars() { + if ($$($nesting, 'ALT_SEPARATOR') === nil) { + return Opal.escape_regexp($$($nesting, 'SEPARATOR')); + } else { + return Opal.escape_regexp($rb_plus($$($nesting, 'SEPARATOR'), $$($nesting, 'ALT_SEPARATOR'))); + } + } + ; + + Opal.def(self, '$dirname', TMP_dirname_2 = function $$dirname(path) { + var self = this, sep_chars = nil; + + + sep_chars = $sep_chars(); + path = $coerce_to_path(path); + + var absolute = path.match(new RegExp("" + "^[" + (sep_chars) + "]")); + + path = path.replace(new RegExp("" + "[" + (sep_chars) + "]+$"), ''); // remove trailing separators + path = path.replace(new RegExp("" + "[^" + (sep_chars) + "]+$"), ''); // remove trailing basename + path = path.replace(new RegExp("" + "[" + (sep_chars) + "]+$"), ''); // remove final trailing separators + + if (path === '') { + return absolute ? '/' : '.'; + } + + return path; + ; + }, TMP_dirname_2.$$arity = 1); + + Opal.def(self, '$basename', TMP_basename_3 = function $$basename(name, suffix) { + var self = this, sep_chars = nil; + + + + if (suffix == null) { + suffix = nil; + }; + sep_chars = $sep_chars(); + name = $coerce_to_path(name); + + if (name.length == 0) { + return name; + } + + if (suffix !== nil) { + suffix = $$($nesting, 'Opal')['$coerce_to!'](suffix, $$($nesting, 'String'), "to_str") + } else { + suffix = null; + } + + name = name.replace(new RegExp("" + "(.)[" + (sep_chars) + "]*$"), '$1'); + name = name.replace(new RegExp("" + "^(?:.*[" + (sep_chars) + "])?([^" + (sep_chars) + "]+)$"), '$1'); + + if (suffix === ".*") { + name = name.replace(/\.[^\.]+$/, ''); + } else if(suffix !== null) { + suffix = Opal.escape_regexp(suffix); + name = name.replace(new RegExp("" + (suffix) + "$"), ''); + } + + return name; + ; + }, TMP_basename_3.$$arity = -2); + + Opal.def(self, '$extname', TMP_extname_4 = function $$extname(path) { + var $a, self = this, filename = nil, last_dot_idx = nil; + + + path = $coerce_to_path(path); + filename = self.$basename(path); + if ($truthy(filename['$empty?']())) { + return ""}; + last_dot_idx = filename['$[]']($range(1, -1, false)).$rindex("."); + if ($truthy(($truthy($a = last_dot_idx['$nil?']()) ? $a : $rb_plus(last_dot_idx, 1)['$==']($rb_minus(filename.$length(), 1))))) { + return "" + } else { + return filename['$[]'](Opal.Range.$new($rb_plus(last_dot_idx, 1), -1, false)) + }; + }, TMP_extname_4.$$arity = 1); + + Opal.def(self, '$exist?', TMP_exist$q_5 = function(path) { + var self = this; + + return Opal.modules[path] != null + }, TMP_exist$q_5.$$arity = 1); + Opal.alias(self, "exists?", "exist?"); + + Opal.def(self, '$directory?', TMP_directory$q_6 = function(path) { + var TMP_7, self = this, files = nil, file = nil; + + + files = []; + + for (var key in Opal.modules) { + files.push(key) + } + ; + path = path.$gsub(new RegExp("" + "(^." + ($$($nesting, 'SEPARATOR')) + "+|" + ($$($nesting, 'SEPARATOR')) + "+$)")); + file = $send(files, 'find', [], (TMP_7 = function(f){var self = TMP_7.$$s || this; + + + + if (f == null) { + f = nil; + }; + return f['$=~'](new RegExp("" + "^" + (path)));}, TMP_7.$$s = self, TMP_7.$$arity = 1, TMP_7)); + return file; + }, TMP_directory$q_6.$$arity = 1); + + Opal.def(self, '$join', TMP_join_8 = function $$join($a) { + var $post_args, paths, TMP_9, TMP_10, self = this, result = nil; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + paths = $post_args;; + if ($truthy(paths['$empty?']())) { + return ""}; + result = ""; + paths = $send(paths.$flatten().$each_with_index(), 'map', [], (TMP_9 = function(item, index){var self = TMP_9.$$s || this, $b; + + + + if (item == null) { + item = nil; + }; + + if (index == null) { + index = nil; + }; + if ($truthy((($b = index['$=='](0)) ? item['$empty?']() : index['$=='](0)))) { + return $$($nesting, 'SEPARATOR') + } else if ($truthy((($b = paths.$length()['$==']($rb_plus(index, 1))) ? item['$empty?']() : paths.$length()['$==']($rb_plus(index, 1))))) { + return $$($nesting, 'SEPARATOR') + } else { + return item + };}, TMP_9.$$s = self, TMP_9.$$arity = 2, TMP_9)); + paths = $send(paths, 'reject', [], "empty?".$to_proc()); + $send(paths, 'each_with_index', [], (TMP_10 = function(item, index){var self = TMP_10.$$s || this, $b, next_item = nil; + + + + if (item == null) { + item = nil; + }; + + if (index == null) { + index = nil; + }; + next_item = paths['$[]']($rb_plus(index, 1)); + if ($truthy(next_item['$nil?']())) { + return (result = "" + (result) + (item)) + } else { + + if ($truthy(($truthy($b = item['$end_with?']($$($nesting, 'SEPARATOR'))) ? next_item['$start_with?']($$($nesting, 'SEPARATOR')) : $b))) { + item = item.$sub(new RegExp("" + ($$($nesting, 'SEPARATOR')) + "+$"), "")}; + return (result = (function() {if ($truthy(($truthy($b = item['$end_with?']($$($nesting, 'SEPARATOR'))) ? $b : next_item['$start_with?']($$($nesting, 'SEPARATOR'))))) { + return "" + (result) + (item) + } else { + return "" + (result) + (item) + ($$($nesting, 'SEPARATOR')) + }; return nil; })()); + };}, TMP_10.$$s = self, TMP_10.$$arity = 2, TMP_10)); + return result; + }, TMP_join_8.$$arity = -1); + return (Opal.def(self, '$split', TMP_split_11 = function $$split(path) { + var self = this; + + return path.$split($$($nesting, 'SEPARATOR')) + }, TMP_split_11.$$arity = 1), nil) && 'split'; + })(Opal.get_singleton_class(self), $nesting); + })($nesting[0], $$($nesting, 'IO'), $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/process"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $truthy = Opal.truthy; + + Opal.add_stubs(['$const_set', '$size', '$<<', '$__register_clock__', '$to_f', '$now', '$new', '$[]', '$raise']); + + (function($base, $super, $parent_nesting) { + function $Process(){}; + var self = $Process = $klass($base, $super, 'Process', $Process); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Process___register_clock___1, TMP_Process_pid_2, TMP_Process_times_3, TMP_Process_clock_gettime_4, monotonic = nil; + + + self.__clocks__ = []; + Opal.defs(self, '$__register_clock__', TMP_Process___register_clock___1 = function $$__register_clock__(name, func) { + var self = this; + if (self.__clocks__ == null) self.__clocks__ = nil; + + + self.$const_set(name, self.__clocks__.$size()); + return self.__clocks__['$<<'](func); + }, TMP_Process___register_clock___1.$$arity = 2); + self.$__register_clock__("CLOCK_REALTIME", function() { return Date.now() }); + monotonic = false; + + if (Opal.global.performance) { + monotonic = function() { + return performance.now() + }; + } + else if (Opal.global.process && process.hrtime) { + // let now be the base to get smaller numbers + var hrtime_base = process.hrtime(); + + monotonic = function() { + var hrtime = process.hrtime(hrtime_base); + var us = (hrtime[1] / 1000) | 0; // cut below microsecs; + return ((hrtime[0] * 1000) + (us / 1000)); + }; + } + ; + if ($truthy(monotonic)) { + self.$__register_clock__("CLOCK_MONOTONIC", monotonic)}; + Opal.defs(self, '$pid', TMP_Process_pid_2 = function $$pid() { + var self = this; + + return 0 + }, TMP_Process_pid_2.$$arity = 0); + Opal.defs(self, '$times', TMP_Process_times_3 = function $$times() { + var self = this, t = nil; + + + t = $$($nesting, 'Time').$now().$to_f(); + return $$$($$($nesting, 'Benchmark'), 'Tms').$new(t, t, t, t, t); + }, TMP_Process_times_3.$$arity = 0); + return (Opal.defs(self, '$clock_gettime', TMP_Process_clock_gettime_4 = function $$clock_gettime(clock_id, unit) { + var $a, self = this, clock = nil; + if (self.__clocks__ == null) self.__clocks__ = nil; + + + + if (unit == null) { + unit = "float_second"; + }; + ($truthy($a = (clock = self.__clocks__['$[]'](clock_id))) ? $a : self.$raise($$$($$($nesting, 'Errno'), 'EINVAL'), "" + "clock_gettime(" + (clock_id) + ") " + (self.__clocks__['$[]'](clock_id)))); + + var ms = clock(); + switch (unit) { + case 'float_second': return (ms / 1000); // number of seconds as a float (default) + case 'float_millisecond': return (ms / 1); // number of milliseconds as a float + case 'float_microsecond': return (ms * 1000); // number of microseconds as a float + case 'second': return ((ms / 1000) | 0); // number of seconds as an integer + case 'millisecond': return ((ms / 1) | 0); // number of milliseconds as an integer + case 'microsecond': return ((ms * 1000) | 0); // number of microseconds as an integer + case 'nanosecond': return ((ms * 1000000) | 0); // number of nanoseconds as an integer + default: self.$raise($$($nesting, 'ArgumentError'), "" + "unexpected unit: " + (unit)) + } + ; + }, TMP_Process_clock_gettime_4.$$arity = -2), nil) && 'clock_gettime'; + })($nesting[0], null, $nesting); + (function($base, $super, $parent_nesting) { + function $Signal(){}; + var self = $Signal = $klass($base, $super, 'Signal', $Signal); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Signal_trap_5; + + return (Opal.defs(self, '$trap', TMP_Signal_trap_5 = function $$trap($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return nil; + }, TMP_Signal_trap_5.$$arity = -1), nil) && 'trap' + })($nesting[0], null, $nesting); + return (function($base, $super, $parent_nesting) { + function $GC(){}; + var self = $GC = $klass($base, $super, 'GC', $GC); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_GC_start_6; + + return (Opal.defs(self, '$start', TMP_GC_start_6 = function $$start() { + var self = this; + + return nil + }, TMP_GC_start_6.$$arity = 0), nil) && 'start' + })($nesting[0], null, $nesting); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/random"] = function(Opal) { + function $rb_lt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $truthy = Opal.truthy, $send = Opal.send; + + Opal.add_stubs(['$attr_reader', '$new_seed', '$coerce_to!', '$reseed', '$rand', '$seed', '$<', '$raise', '$encode', '$join', '$new', '$chr', '$===', '$==', '$state', '$const_defined?', '$const_set']); + return (function($base, $super, $parent_nesting) { + function $Random(){}; + var self = $Random = $klass($base, $super, 'Random', $Random); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Random_initialize_1, TMP_Random_reseed_2, TMP_Random_new_seed_3, TMP_Random_rand_4, TMP_Random_srand_5, TMP_Random_urandom_6, TMP_Random_$eq$eq_8, TMP_Random_bytes_9, TMP_Random_rand_11, TMP_Random_generator$eq_12; + + + self.$attr_reader("seed", "state"); + + Opal.def(self, '$initialize', TMP_Random_initialize_1 = function $$initialize(seed) { + var self = this; + + + + if (seed == null) { + seed = $$($nesting, 'Random').$new_seed(); + }; + seed = $$($nesting, 'Opal')['$coerce_to!'](seed, $$($nesting, 'Integer'), "to_int"); + self.state = seed; + return self.$reseed(seed); + }, TMP_Random_initialize_1.$$arity = -1); + + Opal.def(self, '$reseed', TMP_Random_reseed_2 = function $$reseed(seed) { + var self = this; + + + self.seed = seed; + return self.$rng = Opal.$$rand.reseed(seed);; + }, TMP_Random_reseed_2.$$arity = 1); + Opal.defs(self, '$new_seed', TMP_Random_new_seed_3 = function $$new_seed() { + var self = this; + + return Opal.$$rand.new_seed(); + }, TMP_Random_new_seed_3.$$arity = 0); + Opal.defs(self, '$rand', TMP_Random_rand_4 = function $$rand(limit) { + var self = this; + + + ; + return $$($nesting, 'DEFAULT').$rand(limit); + }, TMP_Random_rand_4.$$arity = -1); + Opal.defs(self, '$srand', TMP_Random_srand_5 = function $$srand(n) { + var self = this, previous_seed = nil; + + + + if (n == null) { + n = $$($nesting, 'Random').$new_seed(); + }; + n = $$($nesting, 'Opal')['$coerce_to!'](n, $$($nesting, 'Integer'), "to_int"); + previous_seed = $$($nesting, 'DEFAULT').$seed(); + $$($nesting, 'DEFAULT').$reseed(n); + return previous_seed; + }, TMP_Random_srand_5.$$arity = -1); + Opal.defs(self, '$urandom', TMP_Random_urandom_6 = function $$urandom(size) { + var TMP_7, self = this; + + + size = $$($nesting, 'Opal')['$coerce_to!'](size, $$($nesting, 'Integer'), "to_int"); + if ($truthy($rb_lt(size, 0))) { + self.$raise($$($nesting, 'ArgumentError'), "negative string size (or size too big)")}; + return $send($$($nesting, 'Array'), 'new', [size], (TMP_7 = function(){var self = TMP_7.$$s || this; + + return self.$rand(255).$chr()}, TMP_7.$$s = self, TMP_7.$$arity = 0, TMP_7)).$join().$encode("ASCII-8BIT"); + }, TMP_Random_urandom_6.$$arity = 1); + + Opal.def(self, '$==', TMP_Random_$eq$eq_8 = function(other) { + var $a, self = this; + + + if ($truthy($$($nesting, 'Random')['$==='](other))) { + } else { + return false + }; + return (($a = self.$seed()['$=='](other.$seed())) ? self.$state()['$=='](other.$state()) : self.$seed()['$=='](other.$seed())); + }, TMP_Random_$eq$eq_8.$$arity = 1); + + Opal.def(self, '$bytes', TMP_Random_bytes_9 = function $$bytes(length) { + var TMP_10, self = this; + + + length = $$($nesting, 'Opal')['$coerce_to!'](length, $$($nesting, 'Integer'), "to_int"); + return $send($$($nesting, 'Array'), 'new', [length], (TMP_10 = function(){var self = TMP_10.$$s || this; + + return self.$rand(255).$chr()}, TMP_10.$$s = self, TMP_10.$$arity = 0, TMP_10)).$join().$encode("ASCII-8BIT"); + }, TMP_Random_bytes_9.$$arity = 1); + + Opal.def(self, '$rand', TMP_Random_rand_11 = function $$rand(limit) { + var self = this; + + + ; + + function randomFloat() { + self.state++; + return Opal.$$rand.rand(self.$rng); + } + + function randomInt() { + return Math.floor(randomFloat() * limit); + } + + function randomRange() { + var min = limit.begin, + max = limit.end; + + if (min === nil || max === nil) { + return nil; + } + + var length = max - min; + + if (length < 0) { + return nil; + } + + if (length === 0) { + return min; + } + + if (max % 1 === 0 && min % 1 === 0 && !limit.excl) { + length++; + } + + return self.$rand(length) + min; + } + + if (limit == null) { + return randomFloat(); + } else if (limit.$$is_range) { + return randomRange(); + } else if (limit.$$is_number) { + if (limit <= 0) { + self.$raise($$($nesting, 'ArgumentError'), "" + "invalid argument - " + (limit)) + } + + if (limit % 1 === 0) { + // integer + return randomInt(); + } else { + return randomFloat() * limit; + } + } else { + limit = $$($nesting, 'Opal')['$coerce_to!'](limit, $$($nesting, 'Integer'), "to_int"); + + if (limit <= 0) { + self.$raise($$($nesting, 'ArgumentError'), "" + "invalid argument - " + (limit)) + } + + return randomInt(); + } + ; + }, TMP_Random_rand_11.$$arity = -1); + return (Opal.defs(self, '$generator=', TMP_Random_generator$eq_12 = function(generator) { + var self = this; + + + Opal.$$rand = generator; + if ($truthy(self['$const_defined?']("DEFAULT"))) { + return $$($nesting, 'DEFAULT').$reseed() + } else { + return self.$const_set("DEFAULT", self.$new(self.$new_seed())) + }; + }, TMP_Random_generator$eq_12.$$arity = 1), nil) && 'generator='; + })($nesting[0], null, $nesting) +}; + +/* +This is based on an adaptation of Makoto Matsumoto and Takuji Nishimura's code +done by Sean McCullough and Dave Heitzman +, subsequently readapted from an updated version of +ruby's random.c (rev c38a183032a7826df1adabd8aa0725c713d53e1c). + +The original copyright notice from random.c follows. + + This is based on trimmed version of MT19937. To get the original version, + contact . + + The original copyright notice follows. + + A C-program for MT19937, with initialization improved 2002/2/10. + Coded by Takuji Nishimura and Makoto Matsumoto. + This is a faster version by taking Shawn Cokus's optimization, + Matthe Bellew's simplification, Isaku Wada's real version. + + Before using, initialize the state by using init_genrand(mt, seed) + or init_by_array(mt, init_key, key_length). + + Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura, + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + 3. The names of its contributors may not be used to endorse or promote + products derived from this software without specific prior written + permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + + Any feedback is very welcome. + http://www.math.keio.ac.jp/matumoto/emt.html + email: matumoto@math.keio.ac.jp +*/ +var MersenneTwister = (function() { + /* Period parameters */ + var N = 624; + var M = 397; + var MATRIX_A = 0x9908b0df; /* constant vector a */ + var UMASK = 0x80000000; /* most significant w-r bits */ + var LMASK = 0x7fffffff; /* least significant r bits */ + var MIXBITS = function(u,v) { return ( ((u) & UMASK) | ((v) & LMASK) ); }; + var TWIST = function(u,v) { return (MIXBITS((u),(v)) >>> 1) ^ ((v & 0x1) ? MATRIX_A : 0x0); }; + + function init(s) { + var mt = {left: 0, next: N, state: new Array(N)}; + init_genrand(mt, s); + return mt; + } + + /* initializes mt[N] with a seed */ + function init_genrand(mt, s) { + var j, i; + mt.state[0] = s >>> 0; + for (j=1; j> 30) >>> 0)) + j); + /* See Knuth TAOCP Vol2. 3rd Ed. P.106 for multiplier. */ + /* In the previous versions, MSBs of the seed affect */ + /* only MSBs of the array state[]. */ + /* 2002/01/09 modified by Makoto Matsumoto */ + mt.state[j] &= 0xffffffff; /* for >32 bit machines */ + } + mt.left = 1; + mt.next = N; + } + + /* generate N words at one time */ + function next_state(mt) { + var p = 0, _p = mt.state; + var j; + + mt.left = N; + mt.next = 0; + + for (j=N-M+1; --j; p++) + _p[p] = _p[p+(M)] ^ TWIST(_p[p+(0)], _p[p+(1)]); + + for (j=M; --j; p++) + _p[p] = _p[p+(M-N)] ^ TWIST(_p[p+(0)], _p[p+(1)]); + + _p[p] = _p[p+(M-N)] ^ TWIST(_p[p+(0)], _p[0]); + } + + /* generates a random number on [0,0xffffffff]-interval */ + function genrand_int32(mt) { + /* mt must be initialized */ + var y; + + if (--mt.left <= 0) next_state(mt); + y = mt.state[mt.next++]; + + /* Tempering */ + y ^= (y >>> 11); + y ^= (y << 7) & 0x9d2c5680; + y ^= (y << 15) & 0xefc60000; + y ^= (y >>> 18); + + return y >>> 0; + } + + function int_pair_to_real_exclusive(a, b) { + a >>>= 5; + b >>>= 6; + return(a*67108864.0+b)*(1.0/9007199254740992.0); + } + + // generates a random number on [0,1) with 53-bit resolution + function genrand_real(mt) { + /* mt must be initialized */ + var a = genrand_int32(mt), b = genrand_int32(mt); + return int_pair_to_real_exclusive(a, b); + } + + return { genrand_real: genrand_real, init: init }; +})(); +Opal.loaded(["corelib/random/MersenneTwister.js"]); +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/random/mersenne_twister"] = function(Opal) { + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $send = Opal.send; + + Opal.add_stubs(['$require', '$generator=', '$-']); + + self.$require("corelib/random/MersenneTwister"); + return (function($base, $super, $parent_nesting) { + function $Random(){}; + var self = $Random = $klass($base, $super, 'Random', $Random); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), $writer = nil; + + + var MAX_INT = Number.MAX_SAFE_INTEGER || Math.pow(2, 53) - 1; + Opal.const_set($nesting[0], 'MERSENNE_TWISTER_GENERATOR', { + new_seed: function() { return Math.round(Math.random() * MAX_INT); }, + reseed: function(seed) { return MersenneTwister.init(seed); }, + rand: function(mt) { return MersenneTwister.genrand_real(mt); } + }); + + $writer = [$$($nesting, 'MERSENNE_TWISTER_GENERATOR')]; + $send(self, 'generator=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];; + })($nesting[0], null, $nesting); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["corelib/unsupported"] = function(Opal) { + var TMP_public_35, TMP_private_36, self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $module = Opal.module; + + Opal.add_stubs(['$raise', '$warn', '$%']); + + + var warnings = {}; + + function handle_unsupported_feature(message) { + switch (Opal.config.unsupported_features_severity) { + case 'error': + $$($nesting, 'Kernel').$raise($$($nesting, 'NotImplementedError'), message) + break; + case 'warning': + warn(message) + break; + default: // ignore + // noop + } + } + + function warn(string) { + if (warnings[string]) { + return; + } + + warnings[string] = true; + self.$warn(string); + } +; + (function($base, $super, $parent_nesting) { + function $String(){}; + var self = $String = $klass($base, $super, 'String', $String); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_String_$lt$lt_1, TMP_String_capitalize$B_2, TMP_String_chomp$B_3, TMP_String_chop$B_4, TMP_String_downcase$B_5, TMP_String_gsub$B_6, TMP_String_lstrip$B_7, TMP_String_next$B_8, TMP_String_reverse$B_9, TMP_String_slice$B_10, TMP_String_squeeze$B_11, TMP_String_strip$B_12, TMP_String_sub$B_13, TMP_String_succ$B_14, TMP_String_swapcase$B_15, TMP_String_tr$B_16, TMP_String_tr_s$B_17, TMP_String_upcase$B_18, TMP_String_prepend_19, TMP_String_$$$eq_20, TMP_String_clear_21, TMP_String_encode$B_22, TMP_String_unicode_normalize$B_23; + + + var ERROR = "String#%s not supported. Mutable String methods are not supported in Opal."; + + Opal.def(self, '$<<', TMP_String_$lt$lt_1 = function($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return self.$raise($$($nesting, 'NotImplementedError'), (ERROR)['$%']("<<")); + }, TMP_String_$lt$lt_1.$$arity = -1); + + Opal.def(self, '$capitalize!', TMP_String_capitalize$B_2 = function($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return self.$raise($$($nesting, 'NotImplementedError'), (ERROR)['$%']("capitalize!")); + }, TMP_String_capitalize$B_2.$$arity = -1); + + Opal.def(self, '$chomp!', TMP_String_chomp$B_3 = function($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return self.$raise($$($nesting, 'NotImplementedError'), (ERROR)['$%']("chomp!")); + }, TMP_String_chomp$B_3.$$arity = -1); + + Opal.def(self, '$chop!', TMP_String_chop$B_4 = function($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return self.$raise($$($nesting, 'NotImplementedError'), (ERROR)['$%']("chop!")); + }, TMP_String_chop$B_4.$$arity = -1); + + Opal.def(self, '$downcase!', TMP_String_downcase$B_5 = function($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return self.$raise($$($nesting, 'NotImplementedError'), (ERROR)['$%']("downcase!")); + }, TMP_String_downcase$B_5.$$arity = -1); + + Opal.def(self, '$gsub!', TMP_String_gsub$B_6 = function($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return self.$raise($$($nesting, 'NotImplementedError'), (ERROR)['$%']("gsub!")); + }, TMP_String_gsub$B_6.$$arity = -1); + + Opal.def(self, '$lstrip!', TMP_String_lstrip$B_7 = function($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return self.$raise($$($nesting, 'NotImplementedError'), (ERROR)['$%']("lstrip!")); + }, TMP_String_lstrip$B_7.$$arity = -1); + + Opal.def(self, '$next!', TMP_String_next$B_8 = function($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return self.$raise($$($nesting, 'NotImplementedError'), (ERROR)['$%']("next!")); + }, TMP_String_next$B_8.$$arity = -1); + + Opal.def(self, '$reverse!', TMP_String_reverse$B_9 = function($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return self.$raise($$($nesting, 'NotImplementedError'), (ERROR)['$%']("reverse!")); + }, TMP_String_reverse$B_9.$$arity = -1); + + Opal.def(self, '$slice!', TMP_String_slice$B_10 = function($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return self.$raise($$($nesting, 'NotImplementedError'), (ERROR)['$%']("slice!")); + }, TMP_String_slice$B_10.$$arity = -1); + + Opal.def(self, '$squeeze!', TMP_String_squeeze$B_11 = function($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return self.$raise($$($nesting, 'NotImplementedError'), (ERROR)['$%']("squeeze!")); + }, TMP_String_squeeze$B_11.$$arity = -1); + + Opal.def(self, '$strip!', TMP_String_strip$B_12 = function($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return self.$raise($$($nesting, 'NotImplementedError'), (ERROR)['$%']("strip!")); + }, TMP_String_strip$B_12.$$arity = -1); + + Opal.def(self, '$sub!', TMP_String_sub$B_13 = function($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return self.$raise($$($nesting, 'NotImplementedError'), (ERROR)['$%']("sub!")); + }, TMP_String_sub$B_13.$$arity = -1); + + Opal.def(self, '$succ!', TMP_String_succ$B_14 = function($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return self.$raise($$($nesting, 'NotImplementedError'), (ERROR)['$%']("succ!")); + }, TMP_String_succ$B_14.$$arity = -1); + + Opal.def(self, '$swapcase!', TMP_String_swapcase$B_15 = function($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return self.$raise($$($nesting, 'NotImplementedError'), (ERROR)['$%']("swapcase!")); + }, TMP_String_swapcase$B_15.$$arity = -1); + + Opal.def(self, '$tr!', TMP_String_tr$B_16 = function($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return self.$raise($$($nesting, 'NotImplementedError'), (ERROR)['$%']("tr!")); + }, TMP_String_tr$B_16.$$arity = -1); + + Opal.def(self, '$tr_s!', TMP_String_tr_s$B_17 = function($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return self.$raise($$($nesting, 'NotImplementedError'), (ERROR)['$%']("tr_s!")); + }, TMP_String_tr_s$B_17.$$arity = -1); + + Opal.def(self, '$upcase!', TMP_String_upcase$B_18 = function($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return self.$raise($$($nesting, 'NotImplementedError'), (ERROR)['$%']("upcase!")); + }, TMP_String_upcase$B_18.$$arity = -1); + + Opal.def(self, '$prepend', TMP_String_prepend_19 = function $$prepend($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return self.$raise($$($nesting, 'NotImplementedError'), (ERROR)['$%']("prepend")); + }, TMP_String_prepend_19.$$arity = -1); + + Opal.def(self, '$[]=', TMP_String_$$$eq_20 = function($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return self.$raise($$($nesting, 'NotImplementedError'), (ERROR)['$%']("[]=")); + }, TMP_String_$$$eq_20.$$arity = -1); + + Opal.def(self, '$clear', TMP_String_clear_21 = function $$clear($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return self.$raise($$($nesting, 'NotImplementedError'), (ERROR)['$%']("clear")); + }, TMP_String_clear_21.$$arity = -1); + + Opal.def(self, '$encode!', TMP_String_encode$B_22 = function($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return self.$raise($$($nesting, 'NotImplementedError'), (ERROR)['$%']("encode!")); + }, TMP_String_encode$B_22.$$arity = -1); + return (Opal.def(self, '$unicode_normalize!', TMP_String_unicode_normalize$B_23 = function($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return self.$raise($$($nesting, 'NotImplementedError'), (ERROR)['$%']("unicode_normalize!")); + }, TMP_String_unicode_normalize$B_23.$$arity = -1), nil) && 'unicode_normalize!'; + })($nesting[0], null, $nesting); + (function($base, $parent_nesting) { + function $Kernel() {}; + var self = $Kernel = $module($base, 'Kernel', $Kernel); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Kernel_freeze_24, TMP_Kernel_frozen$q_25; + + + var ERROR = "Object freezing is not supported by Opal"; + + Opal.def(self, '$freeze', TMP_Kernel_freeze_24 = function $$freeze() { + var self = this; + + + handle_unsupported_feature(ERROR); + return self; + }, TMP_Kernel_freeze_24.$$arity = 0); + + Opal.def(self, '$frozen?', TMP_Kernel_frozen$q_25 = function() { + var self = this; + + + handle_unsupported_feature(ERROR); + return false; + }, TMP_Kernel_frozen$q_25.$$arity = 0); + })($nesting[0], $nesting); + (function($base, $parent_nesting) { + function $Kernel() {}; + var self = $Kernel = $module($base, 'Kernel', $Kernel); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Kernel_taint_26, TMP_Kernel_untaint_27, TMP_Kernel_tainted$q_28; + + + var ERROR = "Object tainting is not supported by Opal"; + + Opal.def(self, '$taint', TMP_Kernel_taint_26 = function $$taint() { + var self = this; + + + handle_unsupported_feature(ERROR); + return self; + }, TMP_Kernel_taint_26.$$arity = 0); + + Opal.def(self, '$untaint', TMP_Kernel_untaint_27 = function $$untaint() { + var self = this; + + + handle_unsupported_feature(ERROR); + return self; + }, TMP_Kernel_untaint_27.$$arity = 0); + + Opal.def(self, '$tainted?', TMP_Kernel_tainted$q_28 = function() { + var self = this; + + + handle_unsupported_feature(ERROR); + return false; + }, TMP_Kernel_tainted$q_28.$$arity = 0); + })($nesting[0], $nesting); + (function($base, $super, $parent_nesting) { + function $Module(){}; + var self = $Module = $klass($base, $super, 'Module', $Module); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Module_public_29, TMP_Module_private_class_method_30, TMP_Module_private_method_defined$q_31, TMP_Module_private_constant_32; + + + + Opal.def(self, '$public', TMP_Module_public_29 = function($a) { + var $post_args, methods, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + methods = $post_args;; + + if (methods.length === 0) { + self.$$module_function = false; + } + + return nil; + ; + }, TMP_Module_public_29.$$arity = -1); + Opal.alias(self, "private", "public"); + Opal.alias(self, "protected", "public"); + Opal.alias(self, "nesting", "public"); + + Opal.def(self, '$private_class_method', TMP_Module_private_class_method_30 = function $$private_class_method($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return self; + }, TMP_Module_private_class_method_30.$$arity = -1); + Opal.alias(self, "public_class_method", "private_class_method"); + + Opal.def(self, '$private_method_defined?', TMP_Module_private_method_defined$q_31 = function(obj) { + var self = this; + + return false + }, TMP_Module_private_method_defined$q_31.$$arity = 1); + + Opal.def(self, '$private_constant', TMP_Module_private_constant_32 = function $$private_constant($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return nil; + }, TMP_Module_private_constant_32.$$arity = -1); + Opal.alias(self, "protected_method_defined?", "private_method_defined?"); + Opal.alias(self, "public_instance_methods", "instance_methods"); + Opal.alias(self, "public_instance_method", "instance_method"); + return Opal.alias(self, "public_method_defined?", "method_defined?"); + })($nesting[0], null, $nesting); + (function($base, $parent_nesting) { + function $Kernel() {}; + var self = $Kernel = $module($base, 'Kernel', $Kernel); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Kernel_private_methods_33; + + + + Opal.def(self, '$private_methods', TMP_Kernel_private_methods_33 = function $$private_methods($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return []; + }, TMP_Kernel_private_methods_33.$$arity = -1); + Opal.alias(self, "private_instance_methods", "private_methods"); + })($nesting[0], $nesting); + (function($base, $parent_nesting) { + function $Kernel() {}; + var self = $Kernel = $module($base, 'Kernel', $Kernel); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Kernel_eval_34; + + + Opal.def(self, '$eval', TMP_Kernel_eval_34 = function($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return self.$raise($$($nesting, 'NotImplementedError'), "" + "To use Kernel#eval, you must first require 'opal-parser'. " + ("" + "See https://github.com/opal/opal/blob/" + ($$($nesting, 'RUBY_ENGINE_VERSION')) + "/docs/opal_parser.md for details.")); + }, TMP_Kernel_eval_34.$$arity = -1) + })($nesting[0], $nesting); + Opal.defs(self, '$public', TMP_public_35 = function($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return nil; + }, TMP_public_35.$$arity = -1); + return (Opal.defs(self, '$private', TMP_private_36 = function($a) { + var $post_args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + ; + return nil; + }, TMP_private_36.$$arity = -1), nil) && 'private'; +}; + +/* Generated by Opal 0.11.99.dev */ +(function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice; + + Opal.add_stubs(['$require']); + + self.$require("opal/base"); + self.$require("opal/mini"); + self.$require("corelib/string/encoding"); + self.$require("corelib/math"); + self.$require("corelib/complex"); + self.$require("corelib/rational"); + self.$require("corelib/time"); + self.$require("corelib/struct"); + self.$require("corelib/io"); + self.$require("corelib/main"); + self.$require("corelib/dir"); + self.$require("corelib/file"); + self.$require("corelib/process"); + self.$require("corelib/random"); + self.$require("corelib/random/mersenne_twister.js"); + return self.$require("corelib/unsupported"); +})(Opal); + + + // restore Function methods (see https://github.com/opal/opal/issues/1846) + for (var index in fundamentalObjects) { + var fundamentalObject = fundamentalObjects[index]; + var name = fundamentalObject.name; + if (typeof fundamentalObject.call !== 'function') { + fundamentalObject.call = backup[name].call; + } + if (typeof fundamentalObject.apply !== 'function') { + fundamentalObject.apply = backup[name].apply; + } + if (typeof fundamentalObject.bind !== 'function') { + fundamentalObject.bind = backup[name].bind; + } + } +} + +// UMD Module +(function (root, factory) { + if (typeof module === 'object' && module.exports) { + // Node. Does not work with strict CommonJS, but + // only CommonJS-like environments that support module.exports, + // like Node. + module.exports = factory; + } else if (typeof define === 'function' && define.amd) { + // AMD. Register a named module. + define('asciidoctor', ['module'], function (module) { + return factory(module.config()); + }); + } else { + // Browser globals (root is window) + root.Asciidoctor = factory; + } +// eslint-disable-next-line no-unused-vars +}(this, function (moduleConfig) { +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/js/opal_ext/nashorn/dir"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass; + + return (function($base, $super, $parent_nesting) { + function $Dir(){}; + var self = $Dir = $klass($base, $super, 'Dir', $Dir); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return (function(self, $parent_nesting) { + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_pwd_1; + + + + Opal.def(self, '$pwd', TMP_pwd_1 = function $$pwd() { + var self = this; + + return Java.type("java.nio.file.Paths").get("").toAbsolutePath().toString(); + }, TMP_pwd_1.$$arity = 0); + return Opal.alias(self, "getwd", "pwd"); + })(Opal.get_singleton_class(self), $nesting) + })($nesting[0], null, $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/js/opal_ext/nashorn/file"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass; + + return (function($base, $super, $parent_nesting) { + function $File(){}; + var self = $File = $klass($base, $super, 'File', $File); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_File_read_1; + + return (Opal.defs(self, '$read', TMP_File_read_1 = function $$read(path) { + var self = this; + + + var Paths = Java.type('java.nio.file.Paths'); + var Files = Java.type('java.nio.file.Files'); + var lines = Files.readAllLines(Paths.get(path), Java.type('java.nio.charset.StandardCharsets').UTF_8); + var data = []; + lines.forEach(function(line) { data.push(line); }); + return data.join("\n"); + + }, TMP_File_read_1.$$arity = 1), nil) && 'read' + })($nesting[0], null, $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/js/opal_ext/nashorn/io"] = function(Opal) { + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $send = Opal.send, $gvars = Opal.gvars, $writer = nil; + if ($gvars.stdout == null) $gvars.stdout = nil; + if ($gvars.stderr == null) $gvars.stderr = nil; + + Opal.add_stubs(['$write_proc=', '$-']); + + + $writer = [function(s){print(s)}]; + $send($gvars.stdout, 'write_proc=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = [function(s){print(s)}]; + $send($gvars.stderr, 'write_proc=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];; +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/js/opal_ext/electron/io"] = function(Opal) { + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $send = Opal.send, $gvars = Opal.gvars, $writer = nil; + if ($gvars.stdout == null) $gvars.stdout = nil; + if ($gvars.stderr == null) $gvars.stderr = nil; + + Opal.add_stubs(['$write_proc=', '$-']); + + + $writer = [function(s){console.log(s)}]; + $send($gvars.stdout, 'write_proc=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = [function(s){console.error(s)}]; + $send($gvars.stderr, 'write_proc=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];; +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/js/opal_ext/phantomjs/file"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass; + + return (function($base, $super, $parent_nesting) { + function $File(){}; + var self = $File = $klass($base, $super, 'File', $File); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_File_read_1; + + return (Opal.defs(self, '$read', TMP_File_read_1 = function $$read(path) { + var self = this; + + return require('fs').read(path); + }, TMP_File_read_1.$$arity = 1), nil) && 'read' + })($nesting[0], null, $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/js/opal_ext/spidermonkey/file"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass; + + return (function($base, $super, $parent_nesting) { + function $File(){}; + var self = $File = $klass($base, $super, 'File', $File); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_File_read_1; + + return (Opal.defs(self, '$read', TMP_File_read_1 = function $$read(path) { + var self = this; + + return read(path); + }, TMP_File_read_1.$$arity = 1), nil) && 'read' + })($nesting[0], null, $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/js/opal_ext/browser/file"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass; + + Opal.add_stubs(['$new']); + return (function($base, $super, $parent_nesting) { + function $File(){}; + var self = $File = $klass($base, $super, 'File', $File); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_File_read_1; + + return (Opal.defs(self, '$read', TMP_File_read_1 = function $$read(path) { + var self = this; + + + var data = ''; + var status = -1; + try { + var xhr = new XMLHttpRequest(); + xhr.open('GET', path, false); + xhr.addEventListener('load', function() { + status = this.status; + // status is 0 for local file mode (i.e., file://) + if (status === 0 || status === 200) { + data = this.responseText; + } + }); + xhr.overrideMimeType('text/plain'); + xhr.send(); + } + catch (e) { + throw $$($nesting, 'IOError').$new('Error reading file or directory: ' + path + '; reason: ' + e.message); + } + // assume that no data in local file mode means it doesn't exist + if (status === 404 || (status === 0 && !data)) { + throw $$($nesting, 'IOError').$new('No such file or directory: ' + path); + } + return data; + + }, TMP_File_read_1.$$arity = 1), nil) && 'read' + })($nesting[0], null, $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/js/opal_ext/umd"] = function(Opal) { + var $a, self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $truthy = Opal.truthy; + + Opal.add_stubs(['$==', '$require']); + + + var isNode = typeof process === 'object' && typeof process.versions === 'object' && process.browser != true, + isElectron = typeof navigator === 'object' && typeof navigator.userAgent === 'string' && typeof navigator.userAgent.indexOf('Electron') !== -1, + isBrowser = typeof window === 'object', + isNashorn = typeof Java === 'object' && Java.type, + isRhino = typeof java === 'object', + isPhantomJS = typeof window === 'object' && typeof window.phantom === 'object', + isWebWorker = typeof importScripts === 'function', + isSpiderMonkey = typeof JSRuntime === 'object', + platform, + engine, + framework, + ioModule; + + if (typeof moduleConfig === 'object' && typeof moduleConfig.runtime === 'object') { + var runtime = moduleConfig.runtime; + platform = runtime.platform; + engine = runtime.engine; + framework = runtime.framework; + ioModule = runtime.ioModule; + } + + if (typeof platform === 'undefined') { + // Try to automatically detect the JavaScript platform, engine and framework + if (isNode) { + platform = platform || 'node'; + engine = engine || 'v8'; + if (isElectron) { + framework = framework || 'electron'; + } + } + else if (isNashorn) { + platform = platform || 'java'; + engine = engine || 'nashorn'; + } + else if (isRhino) { + platform = platform || 'java'; + engine = engine || 'rhino'; + } + else if (isSpiderMonkey) { + platform = platform || 'standalone'; + framework = framework || 'spidermonkey'; + } + else if (isBrowser) { + platform = platform || 'browser'; + if (isPhantomJS) { + framework = framework || 'phantomjs'; + } + } + // NOTE: WebWorker are not limited to browser + if (isWebWorker) { + framework = framework || 'webworker'; + } + } + + if (typeof platform === 'undefined') { + throw new Error('Unable to automatically detect the JavaScript platform, please configure Asciidoctor.js: `Asciidoctor({runtime: {platform: \'node\'}})`'); + } + + // Optional information + if (typeof framework === 'undefined') { + framework = ''; + } + if (typeof engine === 'undefined') { + engine = ''; + } + + // IO Module + if (typeof ioModule !== 'undefined') { + if (ioModule !== 'spidermonkey' + && ioModule !== 'phantomjs' + && ioModule !== 'node' + && ioModule !== 'java_nio' + && ioModule !== 'xmlhttprequest') { + throw new Error('Invalid IO module, `config.ioModule` must be one of: spidermonkey, phantomjs, node, java_nio or xmlhttprequest'); + } + } else { + if (framework === 'spidermonkey') { + ioModule = 'spidermonkey'; + } else if (framework === 'phantomjs') { + ioModule = 'phantomjs'; + } else if (platform === 'node') { + ioModule = 'node'; + } else if (engine === 'nashorn') { + ioModule = 'java_nio' + } else if (platform === 'browser' || typeof XmlHTTPRequest !== 'undefined') { + ioModule = 'xmlhttprequest' + } else { + throw new Error('Unable to automatically detect the IO module, please configure Asciidoctor.js: `Asciidoctor({runtime: {ioModule: \'node\'}})`'); + } + } +; + Opal.const_set($nesting[0], 'JAVASCRIPT_IO_MODULE', ioModule); + Opal.const_set($nesting[0], 'JAVASCRIPT_PLATFORM', platform); + Opal.const_set($nesting[0], 'JAVASCRIPT_ENGINE', engine); + Opal.const_set($nesting[0], 'JAVASCRIPT_FRAMEWORK', framework); + if ($truthy(($truthy($a = $$($nesting, 'JAVASCRIPT_ENGINE')['$==']("nashorn")) ? $a : $$($nesting, 'JAVASCRIPT_IO_MODULE')['$==']("java_nio")))) { + + self.$require("asciidoctor/js/opal_ext/nashorn/dir"); + self.$require("asciidoctor/js/opal_ext/nashorn/file"); + self.$require("asciidoctor/js/opal_ext/nashorn/io");}; + if ($$($nesting, 'JAVASCRIPT_FRAMEWORK')['$==']("electron")) { + self.$require("asciidoctor/js/opal_ext/electron/io")}; + if ($$($nesting, 'JAVASCRIPT_PLATFORM')['$==']("node")) { + Opal.load("nodejs")}; + if ($$($nesting, 'JAVASCRIPT_IO_MODULE')['$==']("phantomjs")) { + self.$require("asciidoctor/js/opal_ext/phantomjs/file")}; + if ($$($nesting, 'JAVASCRIPT_IO_MODULE')['$==']("spidermonkey")) { + self.$require("asciidoctor/js/opal_ext/spidermonkey/file")}; + if ($$($nesting, 'JAVASCRIPT_IO_MODULE')['$==']("xmlhttprequest")) { + return self.$require("asciidoctor/js/opal_ext/browser/file") + } else { + return nil + }; +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["set"] = function(Opal) { + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + function $rb_lt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); + } + function $rb_le(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs <= rhs : lhs['$<='](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $hash2 = Opal.hash2, $truthy = Opal.truthy, $send = Opal.send, $module = Opal.module; + + Opal.add_stubs(['$include', '$new', '$nil?', '$===', '$raise', '$each', '$add', '$merge', '$class', '$respond_to?', '$subtract', '$dup', '$join', '$to_a', '$equal?', '$instance_of?', '$==', '$instance_variable_get', '$is_a?', '$size', '$all?', '$include?', '$[]=', '$-', '$enum_for', '$[]', '$<<', '$replace', '$delete', '$select', '$each_key', '$to_proc', '$empty?', '$eql?', '$instance_eval', '$clear', '$<', '$<=', '$keys']); + + (function($base, $super, $parent_nesting) { + function $Set(){}; + var self = $Set = $klass($base, $super, 'Set', $Set); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Set_$$_1, TMP_Set_initialize_2, TMP_Set_dup_4, TMP_Set_$_5, TMP_Set_inspect_6, TMP_Set_$eq$eq_7, TMP_Set_add_9, TMP_Set_classify_10, TMP_Set_collect$B_13, TMP_Set_delete_15, TMP_Set_delete$q_16, TMP_Set_delete_if_17, TMP_Set_add$q_20, TMP_Set_each_21, TMP_Set_empty$q_22, TMP_Set_eql$q_23, TMP_Set_clear_25, TMP_Set_include$q_26, TMP_Set_merge_27, TMP_Set_replace_29, TMP_Set_size_30, TMP_Set_subtract_31, TMP_Set_$_33, TMP_Set_superset$q_34, TMP_Set_proper_superset$q_36, TMP_Set_subset$q_38, TMP_Set_proper_subset$q_40, TMP_Set_to_a_42; + + def.hash = nil; + + self.$include($$($nesting, 'Enumerable')); + Opal.defs(self, '$[]', TMP_Set_$$_1 = function($a) { + var $post_args, ary, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + ary = $post_args;; + return self.$new(ary); + }, TMP_Set_$$_1.$$arity = -1); + + Opal.def(self, '$initialize', TMP_Set_initialize_2 = function $$initialize(enum$) { + var $iter = TMP_Set_initialize_2.$$p, block = $iter || nil, TMP_3, self = this; + + if ($iter) TMP_Set_initialize_2.$$p = null; + + + if ($iter) TMP_Set_initialize_2.$$p = null;; + + if (enum$ == null) { + enum$ = nil; + }; + self.hash = $hash2([], {}); + if ($truthy(enum$['$nil?']())) { + return nil}; + if ($truthy($$($nesting, 'Enumerable')['$==='](enum$))) { + } else { + self.$raise($$($nesting, 'ArgumentError'), "value must be enumerable") + }; + if ($truthy(block)) { + return $send(enum$, 'each', [], (TMP_3 = function(item){var self = TMP_3.$$s || this; + + + + if (item == null) { + item = nil; + }; + return self.$add(Opal.yield1(block, item));}, TMP_3.$$s = self, TMP_3.$$arity = 1, TMP_3)) + } else { + return self.$merge(enum$) + }; + }, TMP_Set_initialize_2.$$arity = -1); + + Opal.def(self, '$dup', TMP_Set_dup_4 = function $$dup() { + var self = this, result = nil; + + + result = self.$class().$new(); + return result.$merge(self); + }, TMP_Set_dup_4.$$arity = 0); + + Opal.def(self, '$-', TMP_Set_$_5 = function(enum$) { + var self = this; + + + if ($truthy(enum$['$respond_to?']("each"))) { + } else { + self.$raise($$($nesting, 'ArgumentError'), "value must be enumerable") + }; + return self.$dup().$subtract(enum$); + }, TMP_Set_$_5.$$arity = 1); + Opal.alias(self, "difference", "-"); + + Opal.def(self, '$inspect', TMP_Set_inspect_6 = function $$inspect() { + var self = this; + + return "" + "#" + }, TMP_Set_inspect_6.$$arity = 0); + + Opal.def(self, '$==', TMP_Set_$eq$eq_7 = function(other) { + var $a, TMP_8, self = this; + + if ($truthy(self['$equal?'](other))) { + return true + } else if ($truthy(other['$instance_of?'](self.$class()))) { + return self.hash['$=='](other.$instance_variable_get("@hash")) + } else if ($truthy(($truthy($a = other['$is_a?']($$($nesting, 'Set'))) ? self.$size()['$=='](other.$size()) : $a))) { + return $send(other, 'all?', [], (TMP_8 = function(o){var self = TMP_8.$$s || this; + if (self.hash == null) self.hash = nil; + + + + if (o == null) { + o = nil; + }; + return self.hash['$include?'](o);}, TMP_8.$$s = self, TMP_8.$$arity = 1, TMP_8)) + } else { + return false + } + }, TMP_Set_$eq$eq_7.$$arity = 1); + + Opal.def(self, '$add', TMP_Set_add_9 = function $$add(o) { + var self = this, $writer = nil; + + + + $writer = [o, true]; + $send(self.hash, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + return self; + }, TMP_Set_add_9.$$arity = 1); + Opal.alias(self, "<<", "add"); + + Opal.def(self, '$classify', TMP_Set_classify_10 = function $$classify() { + var $iter = TMP_Set_classify_10.$$p, block = $iter || nil, TMP_11, TMP_12, self = this, result = nil; + + if ($iter) TMP_Set_classify_10.$$p = null; + + + if ($iter) TMP_Set_classify_10.$$p = null;; + if ((block !== nil)) { + } else { + return self.$enum_for("classify") + }; + result = $send($$($nesting, 'Hash'), 'new', [], (TMP_11 = function(h, k){var self = TMP_11.$$s || this, $writer = nil; + + + + if (h == null) { + h = nil; + }; + + if (k == null) { + k = nil; + }; + $writer = [k, self.$class().$new()]; + $send(h, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];}, TMP_11.$$s = self, TMP_11.$$arity = 2, TMP_11)); + $send(self, 'each', [], (TMP_12 = function(item){var self = TMP_12.$$s || this; + + + + if (item == null) { + item = nil; + }; + return result['$[]'](Opal.yield1(block, item)).$add(item);}, TMP_12.$$s = self, TMP_12.$$arity = 1, TMP_12)); + return result; + }, TMP_Set_classify_10.$$arity = 0); + + Opal.def(self, '$collect!', TMP_Set_collect$B_13 = function() { + var $iter = TMP_Set_collect$B_13.$$p, block = $iter || nil, TMP_14, self = this, result = nil; + + if ($iter) TMP_Set_collect$B_13.$$p = null; + + + if ($iter) TMP_Set_collect$B_13.$$p = null;; + if ((block !== nil)) { + } else { + return self.$enum_for("collect!") + }; + result = self.$class().$new(); + $send(self, 'each', [], (TMP_14 = function(item){var self = TMP_14.$$s || this; + + + + if (item == null) { + item = nil; + }; + return result['$<<'](Opal.yield1(block, item));}, TMP_14.$$s = self, TMP_14.$$arity = 1, TMP_14)); + return self.$replace(result); + }, TMP_Set_collect$B_13.$$arity = 0); + Opal.alias(self, "map!", "collect!"); + + Opal.def(self, '$delete', TMP_Set_delete_15 = function(o) { + var self = this; + + + self.hash.$delete(o); + return self; + }, TMP_Set_delete_15.$$arity = 1); + + Opal.def(self, '$delete?', TMP_Set_delete$q_16 = function(o) { + var self = this; + + if ($truthy(self['$include?'](o))) { + + self.$delete(o); + return self; + } else { + return nil + } + }, TMP_Set_delete$q_16.$$arity = 1); + + Opal.def(self, '$delete_if', TMP_Set_delete_if_17 = function $$delete_if() { + var TMP_18, TMP_19, $iter = TMP_Set_delete_if_17.$$p, $yield = $iter || nil, self = this; + + if ($iter) TMP_Set_delete_if_17.$$p = null; + + if (($yield !== nil)) { + } else { + return self.$enum_for("delete_if") + }; + $send($send(self, 'select', [], (TMP_18 = function(o){var self = TMP_18.$$s || this; + + + + if (o == null) { + o = nil; + }; + return Opal.yield1($yield, o);;}, TMP_18.$$s = self, TMP_18.$$arity = 1, TMP_18)), 'each', [], (TMP_19 = function(o){var self = TMP_19.$$s || this; + if (self.hash == null) self.hash = nil; + + + + if (o == null) { + o = nil; + }; + return self.hash.$delete(o);}, TMP_19.$$s = self, TMP_19.$$arity = 1, TMP_19)); + return self; + }, TMP_Set_delete_if_17.$$arity = 0); + + Opal.def(self, '$add?', TMP_Set_add$q_20 = function(o) { + var self = this; + + if ($truthy(self['$include?'](o))) { + return nil + } else { + return self.$add(o) + } + }, TMP_Set_add$q_20.$$arity = 1); + + Opal.def(self, '$each', TMP_Set_each_21 = function $$each() { + var $iter = TMP_Set_each_21.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Set_each_21.$$p = null; + + + if ($iter) TMP_Set_each_21.$$p = null;; + if ((block !== nil)) { + } else { + return self.$enum_for("each") + }; + $send(self.hash, 'each_key', [], block.$to_proc()); + return self; + }, TMP_Set_each_21.$$arity = 0); + + Opal.def(self, '$empty?', TMP_Set_empty$q_22 = function() { + var self = this; + + return self.hash['$empty?']() + }, TMP_Set_empty$q_22.$$arity = 0); + + Opal.def(self, '$eql?', TMP_Set_eql$q_23 = function(other) { + var TMP_24, self = this; + + return self.hash['$eql?']($send(other, 'instance_eval', [], (TMP_24 = function(){var self = TMP_24.$$s || this; + if (self.hash == null) self.hash = nil; + + return self.hash}, TMP_24.$$s = self, TMP_24.$$arity = 0, TMP_24))) + }, TMP_Set_eql$q_23.$$arity = 1); + + Opal.def(self, '$clear', TMP_Set_clear_25 = function $$clear() { + var self = this; + + + self.hash.$clear(); + return self; + }, TMP_Set_clear_25.$$arity = 0); + + Opal.def(self, '$include?', TMP_Set_include$q_26 = function(o) { + var self = this; + + return self.hash['$include?'](o) + }, TMP_Set_include$q_26.$$arity = 1); + Opal.alias(self, "member?", "include?"); + + Opal.def(self, '$merge', TMP_Set_merge_27 = function $$merge(enum$) { + var TMP_28, self = this; + + + $send(enum$, 'each', [], (TMP_28 = function(item){var self = TMP_28.$$s || this; + + + + if (item == null) { + item = nil; + }; + return self.$add(item);}, TMP_28.$$s = self, TMP_28.$$arity = 1, TMP_28)); + return self; + }, TMP_Set_merge_27.$$arity = 1); + + Opal.def(self, '$replace', TMP_Set_replace_29 = function $$replace(enum$) { + var self = this; + + + self.$clear(); + self.$merge(enum$); + return self; + }, TMP_Set_replace_29.$$arity = 1); + + Opal.def(self, '$size', TMP_Set_size_30 = function $$size() { + var self = this; + + return self.hash.$size() + }, TMP_Set_size_30.$$arity = 0); + Opal.alias(self, "length", "size"); + + Opal.def(self, '$subtract', TMP_Set_subtract_31 = function $$subtract(enum$) { + var TMP_32, self = this; + + + $send(enum$, 'each', [], (TMP_32 = function(item){var self = TMP_32.$$s || this; + + + + if (item == null) { + item = nil; + }; + return self.$delete(item);}, TMP_32.$$s = self, TMP_32.$$arity = 1, TMP_32)); + return self; + }, TMP_Set_subtract_31.$$arity = 1); + + Opal.def(self, '$|', TMP_Set_$_33 = function(enum$) { + var self = this; + + + if ($truthy(enum$['$respond_to?']("each"))) { + } else { + self.$raise($$($nesting, 'ArgumentError'), "value must be enumerable") + }; + return self.$dup().$merge(enum$); + }, TMP_Set_$_33.$$arity = 1); + + Opal.def(self, '$superset?', TMP_Set_superset$q_34 = function(set) { + var $a, TMP_35, self = this; + + + ($truthy($a = set['$is_a?']($$($nesting, 'Set'))) ? $a : self.$raise($$($nesting, 'ArgumentError'), "value must be a set")); + if ($truthy($rb_lt(self.$size(), set.$size()))) { + return false}; + return $send(set, 'all?', [], (TMP_35 = function(o){var self = TMP_35.$$s || this; + + + + if (o == null) { + o = nil; + }; + return self['$include?'](o);}, TMP_35.$$s = self, TMP_35.$$arity = 1, TMP_35)); + }, TMP_Set_superset$q_34.$$arity = 1); + Opal.alias(self, ">=", "superset?"); + + Opal.def(self, '$proper_superset?', TMP_Set_proper_superset$q_36 = function(set) { + var $a, TMP_37, self = this; + + + ($truthy($a = set['$is_a?']($$($nesting, 'Set'))) ? $a : self.$raise($$($nesting, 'ArgumentError'), "value must be a set")); + if ($truthy($rb_le(self.$size(), set.$size()))) { + return false}; + return $send(set, 'all?', [], (TMP_37 = function(o){var self = TMP_37.$$s || this; + + + + if (o == null) { + o = nil; + }; + return self['$include?'](o);}, TMP_37.$$s = self, TMP_37.$$arity = 1, TMP_37)); + }, TMP_Set_proper_superset$q_36.$$arity = 1); + Opal.alias(self, ">", "proper_superset?"); + + Opal.def(self, '$subset?', TMP_Set_subset$q_38 = function(set) { + var $a, TMP_39, self = this; + + + ($truthy($a = set['$is_a?']($$($nesting, 'Set'))) ? $a : self.$raise($$($nesting, 'ArgumentError'), "value must be a set")); + if ($truthy($rb_lt(set.$size(), self.$size()))) { + return false}; + return $send(self, 'all?', [], (TMP_39 = function(o){var self = TMP_39.$$s || this; + + + + if (o == null) { + o = nil; + }; + return set['$include?'](o);}, TMP_39.$$s = self, TMP_39.$$arity = 1, TMP_39)); + }, TMP_Set_subset$q_38.$$arity = 1); + Opal.alias(self, "<=", "subset?"); + + Opal.def(self, '$proper_subset?', TMP_Set_proper_subset$q_40 = function(set) { + var $a, TMP_41, self = this; + + + ($truthy($a = set['$is_a?']($$($nesting, 'Set'))) ? $a : self.$raise($$($nesting, 'ArgumentError'), "value must be a set")); + if ($truthy($rb_le(set.$size(), self.$size()))) { + return false}; + return $send(self, 'all?', [], (TMP_41 = function(o){var self = TMP_41.$$s || this; + + + + if (o == null) { + o = nil; + }; + return set['$include?'](o);}, TMP_41.$$s = self, TMP_41.$$arity = 1, TMP_41)); + }, TMP_Set_proper_subset$q_40.$$arity = 1); + Opal.alias(self, "<", "proper_subset?"); + Opal.alias(self, "+", "|"); + Opal.alias(self, "union", "|"); + return (Opal.def(self, '$to_a', TMP_Set_to_a_42 = function $$to_a() { + var self = this; + + return self.hash.$keys() + }, TMP_Set_to_a_42.$$arity = 0), nil) && 'to_a'; + })($nesting[0], null, $nesting); + return (function($base, $parent_nesting) { + function $Enumerable() {}; + var self = $Enumerable = $module($base, 'Enumerable', $Enumerable); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Enumerable_to_set_43; + + + Opal.def(self, '$to_set', TMP_Enumerable_to_set_43 = function $$to_set($a, $b) { + var $iter = TMP_Enumerable_to_set_43.$$p, block = $iter || nil, $post_args, klass, args, self = this; + + if ($iter) TMP_Enumerable_to_set_43.$$p = null; + + + if ($iter) TMP_Enumerable_to_set_43.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + if ($post_args.length > 0) { + klass = $post_args[0]; + $post_args.splice(0, 1); + } + if (klass == null) { + klass = $$($nesting, 'Set'); + }; + + args = $post_args;; + return $send(klass, 'new', [self].concat(Opal.to_a(args)), block.$to_proc()); + }, TMP_Enumerable_to_set_43.$$arity = -1) + })($nesting[0], $nesting); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/js/opal_ext/file"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $send = Opal.send, $klass = Opal.klass, $truthy = Opal.truthy, $gvars = Opal.gvars; + + Opal.add_stubs(['$new', '$attr_reader', '$delete', '$gsub', '$read', '$size', '$to_enum', '$chomp', '$each_line', '$readlines', '$split']); + + (function($base, $parent_nesting) { + function $Kernel() {}; + var self = $Kernel = $module($base, 'Kernel', $Kernel); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Kernel_open_1; + + + Opal.def(self, '$open', TMP_Kernel_open_1 = function $$open(path, $a) { + var $post_args, rest, $iter = TMP_Kernel_open_1.$$p, $yield = $iter || nil, self = this, file = nil; + + if ($iter) TMP_Kernel_open_1.$$p = null; + + + $post_args = Opal.slice.call(arguments, 1, arguments.length); + + rest = $post_args;; + file = $send($$($nesting, 'File'), 'new', [path].concat(Opal.to_a(rest))); + if (($yield !== nil)) { + return Opal.yield1($yield, file); + } else { + return file + }; + }, TMP_Kernel_open_1.$$arity = -2) + })($nesting[0], $nesting); + (function($base, $super, $parent_nesting) { + function $File(){}; + var self = $File = $klass($base, $super, 'File', $File); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_File_initialize_2, TMP_File_read_3, TMP_File_each_line_4, TMP_File_readlines_5; + + def.eof = def.path = nil; + + self.$attr_reader("eof"); + self.$attr_reader("lineno"); + self.$attr_reader("path"); + + Opal.def(self, '$initialize', TMP_File_initialize_2 = function $$initialize(path, flags) { + var self = this, encoding_flag_regexp = nil; + + + + if (flags == null) { + flags = "r"; + }; + self.path = path; + self.contents = nil; + self.eof = false; + self.lineno = 0; + flags = flags.$delete("b"); + encoding_flag_regexp = /:(.*)/; + flags = flags.$gsub(encoding_flag_regexp, ""); + return (self.flags = flags); + }, TMP_File_initialize_2.$$arity = -2); + + Opal.def(self, '$read', TMP_File_read_3 = function $$read() { + var self = this, res = nil; + + if ($truthy(self.eof)) { + return "" + } else { + + res = $$($nesting, 'File').$read(self.path); + self.eof = true; + self.lineno = res.$size(); + return res; + } + }, TMP_File_read_3.$$arity = 0); + + Opal.def(self, '$each_line', TMP_File_each_line_4 = function $$each_line(separator) { + var $iter = TMP_File_each_line_4.$$p, block = $iter || nil, self = this, lines = nil; + if ($gvars["/"] == null) $gvars["/"] = nil; + + if ($iter) TMP_File_each_line_4.$$p = null; + + + if ($iter) TMP_File_each_line_4.$$p = null;; + + if (separator == null) { + separator = $gvars["/"]; + }; + if ($truthy(self.eof)) { + return (function() {if ((block !== nil)) { + return self + } else { + return [].$to_enum() + }; return nil; })()}; + if ((block !== nil)) { + + lines = $$($nesting, 'File').$read(self.path); + + self.eof = false; + self.lineno = 0; + var chomped = lines.$chomp(), + trailing = lines.length != chomped.length, + splitted = chomped.split(separator); + for (var i = 0, length = splitted.length; i < length; i++) { + self.lineno += 1; + if (i < length - 1 || trailing) { + Opal.yield1(block, splitted[i] + separator); + } + else { + Opal.yield1(block, splitted[i]); + } + } + self.eof = true; + ; + return self; + } else { + return self.$read().$each_line() + }; + }, TMP_File_each_line_4.$$arity = -1); + + Opal.def(self, '$readlines', TMP_File_readlines_5 = function $$readlines() { + var self = this; + + return $$($nesting, 'File').$readlines(self.path) + }, TMP_File_readlines_5.$$arity = 0); + return (function(self, $parent_nesting) { + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_readlines_6, TMP_file$q_7, TMP_readable$q_8, TMP_read_9; + + + + Opal.def(self, '$readlines', TMP_readlines_6 = function $$readlines(path, separator) { + var self = this, content = nil; + if ($gvars["/"] == null) $gvars["/"] = nil; + + + + if (separator == null) { + separator = $gvars["/"]; + }; + content = $$($nesting, 'File').$read(path); + return content.$split(separator); + }, TMP_readlines_6.$$arity = -2); + + Opal.def(self, '$file?', TMP_file$q_7 = function(path) { + var self = this; + + return true + }, TMP_file$q_7.$$arity = 1); + + Opal.def(self, '$readable?', TMP_readable$q_8 = function(path) { + var self = this; + + return true + }, TMP_readable$q_8.$$arity = 1); + return (Opal.def(self, '$read', TMP_read_9 = function $$read(path) { + var self = this; + + return "" + }, TMP_read_9.$$arity = 1), nil) && 'read'; + })(Opal.get_singleton_class(self), $nesting); + })($nesting[0], null, $nesting); + return (function($base, $super, $parent_nesting) { + function $IO(){}; + var self = $IO = $klass($base, $super, 'IO', $IO); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_IO_read_10; + + return (Opal.defs(self, '$read', TMP_IO_read_10 = function $$read(path) { + var self = this; + + return $$($nesting, 'File').$read(path) + }, TMP_IO_read_10.$$arity = 1), nil) && 'read' + })($nesting[0], null, $nesting); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/js/opal_ext/match_data"] = function(Opal) { + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $send = Opal.send; + + Opal.add_stubs(['$[]=', '$-']); + return (function($base, $super, $parent_nesting) { + function $MatchData(){}; + var self = $MatchData = $klass($base, $super, 'MatchData', $MatchData); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_MatchData_$$$eq_1; + + def.matches = nil; + return (Opal.def(self, '$[]=', TMP_MatchData_$$$eq_1 = function(idx, val) { + var self = this, $writer = nil; + + + $writer = [idx, val]; + $send(self.matches, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + }, TMP_MatchData_$$$eq_1.$$arity = 2), nil) && '[]=' + })($nesting[0], null, $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/js/opal_ext/kernel"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module; + + return (function($base, $parent_nesting) { + function $Kernel() {}; + var self = $Kernel = $module($base, 'Kernel', $Kernel); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Kernel_freeze_1; + + + Opal.def(self, '$freeze', TMP_Kernel_freeze_1 = function $$freeze() { + var self = this; + + return self + }, TMP_Kernel_freeze_1.$$arity = 0) + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/js/opal_ext/thread_safe"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass; + + return (function($base, $parent_nesting) { + function $ThreadSafe() {}; + var self = $ThreadSafe = $module($base, 'ThreadSafe', $ThreadSafe); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + (function($base, $super, $parent_nesting) { + function $Cache(){}; + var self = $Cache = $klass($base, $super, 'Cache', $Cache); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return nil + })($nesting[0], $$$('::', 'Hash'), $nesting) + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/js/opal_ext/string"] = function(Opal) { + function $rb_lt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $truthy = Opal.truthy, $send = Opal.send; + + Opal.add_stubs(['$method_defined?', '$<', '$length', '$bytes', '$to_s', '$byteslice', '$==', '$with_index', '$select', '$[]', '$even?', '$_original_unpack']); + return (function($base, $super, $parent_nesting) { + function $String(){}; + var self = $String = $klass($base, $super, 'String', $String); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_String_limit_bytesize_1, TMP_String_unpack_2; + + + if ($truthy(self['$method_defined?']("limit_bytesize"))) { + } else { + + Opal.def(self, '$limit_bytesize', TMP_String_limit_bytesize_1 = function $$limit_bytesize(size) { + var self = this, result = nil; + + + if ($truthy($rb_lt(size, self.$bytes().$length()))) { + } else { + return self.$to_s() + }; + result = self.$byteslice(0, size); + return result.$to_s(); + }, TMP_String_limit_bytesize_1.$$arity = 1) + }; + if ($truthy(self['$method_defined?']("limit"))) { + } else { + Opal.alias(self, "limit", "limit_bytesize") + }; + Opal.alias(self, "_original_unpack", "unpack"); + return (Opal.def(self, '$unpack', TMP_String_unpack_2 = function $$unpack(format) { + var TMP_3, self = this; + + if (format['$==']("C3")) { + return $send(self['$[]'](0, 3).$bytes().$select(), 'with_index', [], (TMP_3 = function(_, i){var self = TMP_3.$$s || this; + + + + if (_ == null) { + _ = nil; + }; + + if (i == null) { + i = nil; + }; + return i['$even?']();}, TMP_3.$$s = self, TMP_3.$$arity = 2, TMP_3)) + } else { + return self.$_original_unpack(format) + } + }, TMP_String_unpack_2.$$arity = 1), nil) && 'unpack'; + })($nesting[0], null, $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/js/opal_ext/uri"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module; + + Opal.add_stubs(['$extend']); + return (function($base, $parent_nesting) { + function $URI() {}; + var self = $URI = $module($base, 'URI', $URI); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_URI_parse_1, TMP_URI_path_2; + + + Opal.defs(self, '$parse', TMP_URI_parse_1 = function $$parse(str) { + var self = this; + + return str.$extend($$($nesting, 'URI')) + }, TMP_URI_parse_1.$$arity = 1); + + Opal.def(self, '$path', TMP_URI_path_2 = function $$path() { + var self = this; + + return self + }, TMP_URI_path_2.$$arity = 0); + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/js/opal_ext"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice; + + Opal.add_stubs(['$require']); + + self.$require("asciidoctor/js/opal_ext/file"); + self.$require("asciidoctor/js/opal_ext/match_data"); + self.$require("asciidoctor/js/opal_ext/kernel"); + self.$require("asciidoctor/js/opal_ext/thread_safe"); + self.$require("asciidoctor/js/opal_ext/string"); + self.$require("asciidoctor/js/opal_ext/uri"); + +// Load specific implementation +self.$require("asciidoctor/js/opal_ext/umd"); +; +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/js/rx"] = function(Opal) { + function $rb_plus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $send = Opal.send, $gvars = Opal.gvars, $truthy = Opal.truthy; + + Opal.add_stubs(['$gsub', '$+', '$unpack_hex_range']); + return (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Asciidoctor_unpack_hex_range_1; + + + Opal.const_set($nesting[0], 'HEX_RANGE_RX', /([A-F0-9]{4})(?:-([A-F0-9]{4}))?/); + Opal.defs(self, '$unpack_hex_range', TMP_Asciidoctor_unpack_hex_range_1 = function $$unpack_hex_range(str) { + var TMP_2, self = this; + + return $send(str, 'gsub', [$$($nesting, 'HEX_RANGE_RX')], (TMP_2 = function(){var self = TMP_2.$$s || this, $a, $b; + + return "" + "\\u" + ((($a = $gvars['~']) === nil ? nil : $a['$[]'](1))) + (($truthy($a = (($b = $gvars['~']) === nil ? nil : $b['$[]'](2))) ? "" + "-\\u" + ((($b = $gvars['~']) === nil ? nil : $b['$[]'](2))) : $a))}, TMP_2.$$s = self, TMP_2.$$arity = 0, TMP_2)) + }, TMP_Asciidoctor_unpack_hex_range_1.$$arity = 1); + Opal.const_set($nesting[0], 'P_L', $rb_plus("A-Za-z", self.$unpack_hex_range("00AA00B500BA00C0-00D600D8-00F600F8-02C102C6-02D102E0-02E402EC02EE0370-037403760377037A-037D037F03860388-038A038C038E-03A103A3-03F503F7-0481048A-052F0531-055605590561-058705D0-05EA05F0-05F20620-064A066E066F0671-06D306D506E506E606EE06EF06FA-06FC06FF07100712-072F074D-07A507B107CA-07EA07F407F507FA0800-0815081A082408280840-085808A0-08B20904-0939093D09500958-09610971-09800985-098C098F09900993-09A809AA-09B009B209B6-09B909BD09CE09DC09DD09DF-09E109F009F10A05-0A0A0A0F0A100A13-0A280A2A-0A300A320A330A350A360A380A390A59-0A5C0A5E0A72-0A740A85-0A8D0A8F-0A910A93-0AA80AAA-0AB00AB20AB30AB5-0AB90ABD0AD00AE00AE10B05-0B0C0B0F0B100B13-0B280B2A-0B300B320B330B35-0B390B3D0B5C0B5D0B5F-0B610B710B830B85-0B8A0B8E-0B900B92-0B950B990B9A0B9C0B9E0B9F0BA30BA40BA8-0BAA0BAE-0BB90BD00C05-0C0C0C0E-0C100C12-0C280C2A-0C390C3D0C580C590C600C610C85-0C8C0C8E-0C900C92-0CA80CAA-0CB30CB5-0CB90CBD0CDE0CE00CE10CF10CF20D05-0D0C0D0E-0D100D12-0D3A0D3D0D4E0D600D610D7A-0D7F0D85-0D960D9A-0DB10DB3-0DBB0DBD0DC0-0DC60E01-0E300E320E330E40-0E460E810E820E840E870E880E8A0E8D0E94-0E970E99-0E9F0EA1-0EA30EA50EA70EAA0EAB0EAD-0EB00EB20EB30EBD0EC0-0EC40EC60EDC-0EDF0F000F40-0F470F49-0F6C0F88-0F8C1000-102A103F1050-1055105A-105D106110651066106E-10701075-1081108E10A0-10C510C710CD10D0-10FA10FC-1248124A-124D1250-12561258125A-125D1260-1288128A-128D1290-12B012B2-12B512B8-12BE12C012C2-12C512C8-12D612D8-13101312-13151318-135A1380-138F13A0-13F41401-166C166F-167F1681-169A16A0-16EA16F1-16F81700-170C170E-17111720-17311740-17511760-176C176E-17701780-17B317D717DC1820-18771880-18A818AA18B0-18F51900-191E1950-196D1970-19741980-19AB19C1-19C71A00-1A161A20-1A541AA71B05-1B331B45-1B4B1B83-1BA01BAE1BAF1BBA-1BE51C00-1C231C4D-1C4F1C5A-1C7D1CE9-1CEC1CEE-1CF11CF51CF61D00-1DBF1E00-1F151F18-1F1D1F20-1F451F48-1F4D1F50-1F571F591F5B1F5D1F5F-1F7D1F80-1FB41FB6-1FBC1FBE1FC2-1FC41FC6-1FCC1FD0-1FD31FD6-1FDB1FE0-1FEC1FF2-1FF41FF6-1FFC2071207F2090-209C21022107210A-211321152119-211D212421262128212A-212D212F-2139213C-213F2145-2149214E218321842C00-2C2E2C30-2C5E2C60-2CE42CEB-2CEE2CF22CF32D00-2D252D272D2D2D30-2D672D6F2D80-2D962DA0-2DA62DA8-2DAE2DB0-2DB62DB8-2DBE2DC0-2DC62DC8-2DCE2DD0-2DD62DD8-2DDE2E2F300530063031-3035303B303C3041-3096309D-309F30A1-30FA30FC-30FF3105-312D3131-318E31A0-31BA31F0-31FF3400-4DB54E00-9FCCA000-A48CA4D0-A4FDA500-A60CA610-A61FA62AA62BA640-A66EA67F-A69DA6A0-A6E5A717-A71FA722-A788A78B-A78EA790-A7ADA7B0A7B1A7F7-A801A803-A805A807-A80AA80C-A822A840-A873A882-A8B3A8F2-A8F7A8FBA90A-A925A930-A946A960-A97CA984-A9B2A9CFA9E0-A9E4A9E6-A9EFA9FA-A9FEAA00-AA28AA40-AA42AA44-AA4BAA60-AA76AA7AAA7E-AAAFAAB1AAB5AAB6AAB9-AABDAAC0AAC2AADB-AADDAAE0-AAEAAAF2-AAF4AB01-AB06AB09-AB0EAB11-AB16AB20-AB26AB28-AB2EAB30-AB5AAB5C-AB5FAB64AB65ABC0-ABE2AC00-D7A3D7B0-D7C6D7CB-D7FBF900-FA6DFA70-FAD9FB00-FB06FB13-FB17FB1DFB1F-FB28FB2A-FB36FB38-FB3CFB3EFB40FB41FB43FB44FB46-FBB1FBD3-FD3DFD50-FD8FFD92-FDC7FDF0-FDFBFE70-FE74FE76-FEFCFF21-FF3AFF41-FF5AFF66-FFBEFFC2-FFC7FFCA-FFCFFFD2-FFD7FFDA-FFDC"))); + Opal.const_set($nesting[0], 'P_Nl', self.$unpack_hex_range("16EE-16F02160-21822185-218830073021-30293038-303AA6E6-A6EF")); + Opal.const_set($nesting[0], 'P_Nd', $rb_plus("0-9", self.$unpack_hex_range("0660-066906F0-06F907C0-07C90966-096F09E6-09EF0A66-0A6F0AE6-0AEF0B66-0B6F0BE6-0BEF0C66-0C6F0CE6-0CEF0D66-0D6F0DE6-0DEF0E50-0E590ED0-0ED90F20-0F291040-10491090-109917E0-17E91810-18191946-194F19D0-19D91A80-1A891A90-1A991B50-1B591BB0-1BB91C40-1C491C50-1C59A620-A629A8D0-A8D9A900-A909A9D0-A9D9A9F0-A9F9AA50-AA59ABF0-ABF9FF10-FF19"))); + Opal.const_set($nesting[0], 'P_Pc', self.$unpack_hex_range("005F203F20402054FE33FE34FE4D-FE4FFF3F")); + Opal.const_set($nesting[0], 'CC_ALPHA', "" + ($$($nesting, 'P_L')) + ($$($nesting, 'P_Nl'))); + Opal.const_set($nesting[0], 'CG_ALPHA', "" + "[" + ($$($nesting, 'CC_ALPHA')) + "]"); + Opal.const_set($nesting[0], 'CC_ALNUM', "" + ($$($nesting, 'CC_ALPHA')) + ($$($nesting, 'P_Nd'))); + Opal.const_set($nesting[0], 'CG_ALNUM', "" + "[" + ($$($nesting, 'CC_ALNUM')) + "]"); + Opal.const_set($nesting[0], 'CC_WORD', "" + ($$($nesting, 'CC_ALNUM')) + ($$($nesting, 'P_Pc'))); + Opal.const_set($nesting[0], 'CG_WORD', "" + "[" + ($$($nesting, 'CC_WORD')) + "]"); + Opal.const_set($nesting[0], 'CG_BLANK', "[ \\t]"); + Opal.const_set($nesting[0], 'CC_EOL', "(?=\\n|$)"); + Opal.const_set($nesting[0], 'CG_GRAPH', "[^\\s\\x00-\\x1F\\x7F]"); + Opal.const_set($nesting[0], 'CC_ALL', "[\\s\\S]"); + Opal.const_set($nesting[0], 'CC_ANY', "[^\\n]"); + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["strscan"] = function(Opal) { + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $send = Opal.send; + + Opal.add_stubs(['$attr_reader', '$anchor', '$scan_until', '$length', '$size', '$rest', '$pos=', '$-', '$private']); + return (function($base, $super, $parent_nesting) { + function $StringScanner(){}; + var self = $StringScanner = $klass($base, $super, 'StringScanner', $StringScanner); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_StringScanner_initialize_1, TMP_StringScanner_beginning_of_line$q_2, TMP_StringScanner_scan_3, TMP_StringScanner_scan_until_4, TMP_StringScanner_$$_5, TMP_StringScanner_check_6, TMP_StringScanner_check_until_7, TMP_StringScanner_peek_8, TMP_StringScanner_eos$q_9, TMP_StringScanner_exist$q_10, TMP_StringScanner_skip_11, TMP_StringScanner_skip_until_12, TMP_StringScanner_get_byte_13, TMP_StringScanner_match$q_14, TMP_StringScanner_pos$eq_15, TMP_StringScanner_matched_size_16, TMP_StringScanner_post_match_17, TMP_StringScanner_pre_match_18, TMP_StringScanner_reset_19, TMP_StringScanner_rest_20, TMP_StringScanner_rest$q_21, TMP_StringScanner_rest_size_22, TMP_StringScanner_terminate_23, TMP_StringScanner_unscan_24, TMP_StringScanner_anchor_25; + + def.pos = def.string = def.working = def.matched = def.prev_pos = def.match = nil; + + self.$attr_reader("pos"); + self.$attr_reader("matched"); + + Opal.def(self, '$initialize', TMP_StringScanner_initialize_1 = function $$initialize(string) { + var self = this; + + + self.string = string; + self.pos = 0; + self.matched = nil; + self.working = string; + return (self.match = []); + }, TMP_StringScanner_initialize_1.$$arity = 1); + self.$attr_reader("string"); + + Opal.def(self, '$beginning_of_line?', TMP_StringScanner_beginning_of_line$q_2 = function() { + var self = this; + + return self.pos === 0 || self.string.charAt(self.pos - 1) === "\n" + }, TMP_StringScanner_beginning_of_line$q_2.$$arity = 0); + Opal.alias(self, "bol?", "beginning_of_line?"); + + Opal.def(self, '$scan', TMP_StringScanner_scan_3 = function $$scan(pattern) { + var self = this; + + + pattern = self.$anchor(pattern); + + var result = pattern.exec(self.working); + + if (result == null) { + return self.matched = nil; + } + else if (typeof(result) === 'object') { + self.prev_pos = self.pos; + self.pos += result[0].length; + self.working = self.working.substring(result[0].length); + self.matched = result[0]; + self.match = result; + + return result[0]; + } + else if (typeof(result) === 'string') { + self.pos += result.length; + self.working = self.working.substring(result.length); + + return result; + } + else { + return nil; + } + ; + }, TMP_StringScanner_scan_3.$$arity = 1); + + Opal.def(self, '$scan_until', TMP_StringScanner_scan_until_4 = function $$scan_until(pattern) { + var self = this; + + + pattern = self.$anchor(pattern); + + var pos = self.pos, + working = self.working, + result; + + while (true) { + result = pattern.exec(working); + pos += 1; + working = working.substr(1); + + if (result == null) { + if (working.length === 0) { + return self.matched = nil; + } + + continue; + } + + self.matched = self.string.substr(self.pos, pos - self.pos - 1 + result[0].length); + self.prev_pos = pos - 1; + self.pos = pos; + self.working = working.substr(result[0].length); + + return self.matched; + } + ; + }, TMP_StringScanner_scan_until_4.$$arity = 1); + + Opal.def(self, '$[]', TMP_StringScanner_$$_5 = function(idx) { + var self = this; + + + var match = self.match; + + if (idx < 0) { + idx += match.length; + } + + if (idx < 0 || idx >= match.length) { + return nil; + } + + if (match[idx] == null) { + return nil; + } + + return match[idx]; + + }, TMP_StringScanner_$$_5.$$arity = 1); + + Opal.def(self, '$check', TMP_StringScanner_check_6 = function $$check(pattern) { + var self = this; + + + pattern = self.$anchor(pattern); + + var result = pattern.exec(self.working); + + if (result == null) { + return self.matched = nil; + } + + return self.matched = result[0]; + ; + }, TMP_StringScanner_check_6.$$arity = 1); + + Opal.def(self, '$check_until', TMP_StringScanner_check_until_7 = function $$check_until(pattern) { + var self = this; + + + var prev_pos = self.prev_pos, + pos = self.pos; + + var result = self.$scan_until(pattern); + + if (result !== nil) { + self.matched = result.substr(-1); + self.working = self.string.substr(pos); + } + + self.prev_pos = prev_pos; + self.pos = pos; + + return result; + + }, TMP_StringScanner_check_until_7.$$arity = 1); + + Opal.def(self, '$peek', TMP_StringScanner_peek_8 = function $$peek(length) { + var self = this; + + return self.working.substring(0, length) + }, TMP_StringScanner_peek_8.$$arity = 1); + + Opal.def(self, '$eos?', TMP_StringScanner_eos$q_9 = function() { + var self = this; + + return self.working.length === 0 + }, TMP_StringScanner_eos$q_9.$$arity = 0); + + Opal.def(self, '$exist?', TMP_StringScanner_exist$q_10 = function(pattern) { + var self = this; + + + var result = pattern.exec(self.working); + + if (result == null) { + return nil; + } + else if (result.index == 0) { + return 0; + } + else { + return result.index + 1; + } + + }, TMP_StringScanner_exist$q_10.$$arity = 1); + + Opal.def(self, '$skip', TMP_StringScanner_skip_11 = function $$skip(pattern) { + var self = this; + + + pattern = self.$anchor(pattern); + + var result = pattern.exec(self.working); + + if (result == null) { + return self.matched = nil; + } + else { + var match_str = result[0]; + var match_len = match_str.length; + + self.matched = match_str; + self.prev_pos = self.pos; + self.pos += match_len; + self.working = self.working.substring(match_len); + + return match_len; + } + ; + }, TMP_StringScanner_skip_11.$$arity = 1); + + Opal.def(self, '$skip_until', TMP_StringScanner_skip_until_12 = function $$skip_until(pattern) { + var self = this; + + + var result = self.$scan_until(pattern); + + if (result === nil) { + return nil; + } + else { + self.matched = result.substr(-1); + + return result.length; + } + + }, TMP_StringScanner_skip_until_12.$$arity = 1); + + Opal.def(self, '$get_byte', TMP_StringScanner_get_byte_13 = function $$get_byte() { + var self = this; + + + var result = nil; + + if (self.pos < self.string.length) { + self.prev_pos = self.pos; + self.pos += 1; + result = self.matched = self.working.substring(0, 1); + self.working = self.working.substring(1); + } + else { + self.matched = nil; + } + + return result; + + }, TMP_StringScanner_get_byte_13.$$arity = 0); + Opal.alias(self, "getch", "get_byte"); + + Opal.def(self, '$match?', TMP_StringScanner_match$q_14 = function(pattern) { + var self = this; + + + pattern = self.$anchor(pattern); + + var result = pattern.exec(self.working); + + if (result == null) { + return nil; + } + else { + self.prev_pos = self.pos; + + return result[0].length; + } + ; + }, TMP_StringScanner_match$q_14.$$arity = 1); + + Opal.def(self, '$pos=', TMP_StringScanner_pos$eq_15 = function(pos) { + var self = this; + + + + if (pos < 0) { + pos += self.string.$length(); + } + ; + self.pos = pos; + return (self.working = self.string.slice(pos)); + }, TMP_StringScanner_pos$eq_15.$$arity = 1); + + Opal.def(self, '$matched_size', TMP_StringScanner_matched_size_16 = function $$matched_size() { + var self = this; + + + if (self.matched === nil) { + return nil; + } + + return self.matched.length + + }, TMP_StringScanner_matched_size_16.$$arity = 0); + + Opal.def(self, '$post_match', TMP_StringScanner_post_match_17 = function $$post_match() { + var self = this; + + + if (self.matched === nil) { + return nil; + } + + return self.string.substr(self.pos); + + }, TMP_StringScanner_post_match_17.$$arity = 0); + + Opal.def(self, '$pre_match', TMP_StringScanner_pre_match_18 = function $$pre_match() { + var self = this; + + + if (self.matched === nil) { + return nil; + } + + return self.string.substr(0, self.prev_pos); + + }, TMP_StringScanner_pre_match_18.$$arity = 0); + + Opal.def(self, '$reset', TMP_StringScanner_reset_19 = function $$reset() { + var self = this; + + + self.working = self.string; + self.matched = nil; + return (self.pos = 0); + }, TMP_StringScanner_reset_19.$$arity = 0); + + Opal.def(self, '$rest', TMP_StringScanner_rest_20 = function $$rest() { + var self = this; + + return self.working + }, TMP_StringScanner_rest_20.$$arity = 0); + + Opal.def(self, '$rest?', TMP_StringScanner_rest$q_21 = function() { + var self = this; + + return self.working.length !== 0 + }, TMP_StringScanner_rest$q_21.$$arity = 0); + + Opal.def(self, '$rest_size', TMP_StringScanner_rest_size_22 = function $$rest_size() { + var self = this; + + return self.$rest().$size() + }, TMP_StringScanner_rest_size_22.$$arity = 0); + + Opal.def(self, '$terminate', TMP_StringScanner_terminate_23 = function $$terminate() { + var self = this, $writer = nil; + + + self.match = nil; + + $writer = [self.string.$length()]; + $send(self, 'pos=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];; + }, TMP_StringScanner_terminate_23.$$arity = 0); + + Opal.def(self, '$unscan', TMP_StringScanner_unscan_24 = function $$unscan() { + var self = this; + + + self.pos = self.prev_pos; + self.prev_pos = nil; + self.match = nil; + return self; + }, TMP_StringScanner_unscan_24.$$arity = 0); + self.$private(); + return (Opal.def(self, '$anchor', TMP_StringScanner_anchor_25 = function $$anchor(pattern) { + var self = this; + + + var flags = pattern.toString().match(/\/([^\/]+)$/); + flags = flags ? flags[1] : undefined; + return new RegExp('^(?:' + pattern.source + ')', flags); + + }, TMP_StringScanner_anchor_25.$$arity = 1), nil) && 'anchor'; + })($nesting[0], null, $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/js"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice; + + Opal.add_stubs(['$require']); + + self.$require("asciidoctor/js/opal_ext"); + self.$require("asciidoctor/js/rx"); + return self.$require("strscan"); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["logger"] = function(Opal) { + function $rb_plus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); + } + function $rb_le(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs <= rhs : lhs['$<='](rhs); + } + function $rb_lt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $module = Opal.module, $send = Opal.send, $truthy = Opal.truthy; + + Opal.add_stubs(['$include', '$to_h', '$map', '$constants', '$const_get', '$to_s', '$format', '$chr', '$strftime', '$message_as_string', '$===', '$+', '$message', '$class', '$join', '$backtrace', '$inspect', '$attr_reader', '$attr_accessor', '$new', '$key', '$upcase', '$raise', '$add', '$to_proc', '$<=', '$<', '$write', '$call', '$[]', '$now']); + return (function($base, $super, $parent_nesting) { + function $Logger(){}; + var self = $Logger = $klass($base, $super, 'Logger', $Logger); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Logger_1, TMP_Logger_initialize_4, TMP_Logger_level$eq_5, TMP_Logger_info_6, TMP_Logger_debug_7, TMP_Logger_warn_8, TMP_Logger_error_9, TMP_Logger_fatal_10, TMP_Logger_unknown_11, TMP_Logger_info$q_12, TMP_Logger_debug$q_13, TMP_Logger_warn$q_14, TMP_Logger_error$q_15, TMP_Logger_fatal$q_16, TMP_Logger_add_17; + + def.level = def.progname = def.pipe = def.formatter = nil; + + (function($base, $parent_nesting) { + function $Severity() {}; + var self = $Severity = $module($base, 'Severity', $Severity); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + + Opal.const_set($nesting[0], 'DEBUG', 0); + Opal.const_set($nesting[0], 'INFO', 1); + Opal.const_set($nesting[0], 'WARN', 2); + Opal.const_set($nesting[0], 'ERROR', 3); + Opal.const_set($nesting[0], 'FATAL', 4); + Opal.const_set($nesting[0], 'UNKNOWN', 5); + })($nesting[0], $nesting); + self.$include($$($nesting, 'Severity')); + Opal.const_set($nesting[0], 'SEVERITY_LABELS', $send($$($nesting, 'Severity').$constants(), 'map', [], (TMP_Logger_1 = function(s){var self = TMP_Logger_1.$$s || this; + + + + if (s == null) { + s = nil; + }; + return [$$($nesting, 'Severity').$const_get(s), s.$to_s()];}, TMP_Logger_1.$$s = self, TMP_Logger_1.$$arity = 1, TMP_Logger_1)).$to_h()); + (function($base, $super, $parent_nesting) { + function $Formatter(){}; + var self = $Formatter = $klass($base, $super, 'Formatter', $Formatter); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Formatter_call_2, TMP_Formatter_message_as_string_3; + + + Opal.const_set($nesting[0], 'MESSAGE_FORMAT', "%s, [%s] %5s -- %s: %s\n"); + Opal.const_set($nesting[0], 'DATE_TIME_FORMAT', "%Y-%m-%dT%H:%M:%S.%6N"); + + Opal.def(self, '$call', TMP_Formatter_call_2 = function $$call(severity, time, progname, msg) { + var self = this; + + return self.$format($$($nesting, 'MESSAGE_FORMAT'), severity.$chr(), time.$strftime($$($nesting, 'DATE_TIME_FORMAT')), severity, progname, self.$message_as_string(msg)) + }, TMP_Formatter_call_2.$$arity = 4); + return (Opal.def(self, '$message_as_string', TMP_Formatter_message_as_string_3 = function $$message_as_string(msg) { + var $a, self = this, $case = nil; + + return (function() {$case = msg; + if ($$$('::', 'String')['$===']($case)) {return msg} + else if ($$$('::', 'Exception')['$===']($case)) {return $rb_plus("" + (msg.$message()) + " (" + (msg.$class()) + ")\n", ($truthy($a = msg.$backtrace()) ? $a : []).$join("\n"))} + else {return msg.$inspect()}})() + }, TMP_Formatter_message_as_string_3.$$arity = 1), nil) && 'message_as_string'; + })($nesting[0], null, $nesting); + self.$attr_reader("level"); + self.$attr_accessor("progname"); + self.$attr_accessor("formatter"); + + Opal.def(self, '$initialize', TMP_Logger_initialize_4 = function $$initialize(pipe) { + var self = this; + + + self.pipe = pipe; + self.level = $$($nesting, 'DEBUG'); + return (self.formatter = $$($nesting, 'Formatter').$new()); + }, TMP_Logger_initialize_4.$$arity = 1); + + Opal.def(self, '$level=', TMP_Logger_level$eq_5 = function(severity) { + var self = this, level = nil; + + if ($truthy($$$('::', 'Integer')['$==='](severity))) { + return (self.level = severity) + } else if ($truthy((level = $$($nesting, 'SEVERITY_LABELS').$key(severity.$to_s().$upcase())))) { + return (self.level = level) + } else { + return self.$raise($$($nesting, 'ArgumentError'), "" + "invalid log level: " + (severity)) + } + }, TMP_Logger_level$eq_5.$$arity = 1); + + Opal.def(self, '$info', TMP_Logger_info_6 = function $$info(progname) { + var $iter = TMP_Logger_info_6.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Logger_info_6.$$p = null; + + + if ($iter) TMP_Logger_info_6.$$p = null;; + + if (progname == null) { + progname = nil; + }; + return $send(self, 'add', [$$($nesting, 'INFO'), nil, progname], block.$to_proc()); + }, TMP_Logger_info_6.$$arity = -1); + + Opal.def(self, '$debug', TMP_Logger_debug_7 = function $$debug(progname) { + var $iter = TMP_Logger_debug_7.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Logger_debug_7.$$p = null; + + + if ($iter) TMP_Logger_debug_7.$$p = null;; + + if (progname == null) { + progname = nil; + }; + return $send(self, 'add', [$$($nesting, 'DEBUG'), nil, progname], block.$to_proc()); + }, TMP_Logger_debug_7.$$arity = -1); + + Opal.def(self, '$warn', TMP_Logger_warn_8 = function $$warn(progname) { + var $iter = TMP_Logger_warn_8.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Logger_warn_8.$$p = null; + + + if ($iter) TMP_Logger_warn_8.$$p = null;; + + if (progname == null) { + progname = nil; + }; + return $send(self, 'add', [$$($nesting, 'WARN'), nil, progname], block.$to_proc()); + }, TMP_Logger_warn_8.$$arity = -1); + + Opal.def(self, '$error', TMP_Logger_error_9 = function $$error(progname) { + var $iter = TMP_Logger_error_9.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Logger_error_9.$$p = null; + + + if ($iter) TMP_Logger_error_9.$$p = null;; + + if (progname == null) { + progname = nil; + }; + return $send(self, 'add', [$$($nesting, 'ERROR'), nil, progname], block.$to_proc()); + }, TMP_Logger_error_9.$$arity = -1); + + Opal.def(self, '$fatal', TMP_Logger_fatal_10 = function $$fatal(progname) { + var $iter = TMP_Logger_fatal_10.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Logger_fatal_10.$$p = null; + + + if ($iter) TMP_Logger_fatal_10.$$p = null;; + + if (progname == null) { + progname = nil; + }; + return $send(self, 'add', [$$($nesting, 'FATAL'), nil, progname], block.$to_proc()); + }, TMP_Logger_fatal_10.$$arity = -1); + + Opal.def(self, '$unknown', TMP_Logger_unknown_11 = function $$unknown(progname) { + var $iter = TMP_Logger_unknown_11.$$p, block = $iter || nil, self = this; + + if ($iter) TMP_Logger_unknown_11.$$p = null; + + + if ($iter) TMP_Logger_unknown_11.$$p = null;; + + if (progname == null) { + progname = nil; + }; + return $send(self, 'add', [$$($nesting, 'UNKNOWN'), nil, progname], block.$to_proc()); + }, TMP_Logger_unknown_11.$$arity = -1); + + Opal.def(self, '$info?', TMP_Logger_info$q_12 = function() { + var self = this; + + return $rb_le(self.level, $$($nesting, 'INFO')) + }, TMP_Logger_info$q_12.$$arity = 0); + + Opal.def(self, '$debug?', TMP_Logger_debug$q_13 = function() { + var self = this; + + return $rb_le(self.level, $$($nesting, 'DEBUG')) + }, TMP_Logger_debug$q_13.$$arity = 0); + + Opal.def(self, '$warn?', TMP_Logger_warn$q_14 = function() { + var self = this; + + return $rb_le(self.level, $$($nesting, 'WARN')) + }, TMP_Logger_warn$q_14.$$arity = 0); + + Opal.def(self, '$error?', TMP_Logger_error$q_15 = function() { + var self = this; + + return $rb_le(self.level, $$($nesting, 'ERROR')) + }, TMP_Logger_error$q_15.$$arity = 0); + + Opal.def(self, '$fatal?', TMP_Logger_fatal$q_16 = function() { + var self = this; + + return $rb_le(self.level, $$($nesting, 'FATAL')) + }, TMP_Logger_fatal$q_16.$$arity = 0); + return (Opal.def(self, '$add', TMP_Logger_add_17 = function $$add(severity, message, progname) { + var $iter = TMP_Logger_add_17.$$p, block = $iter || nil, $a, self = this; + + if ($iter) TMP_Logger_add_17.$$p = null; + + + if ($iter) TMP_Logger_add_17.$$p = null;; + + if (message == null) { + message = nil; + }; + + if (progname == null) { + progname = nil; + }; + if ($truthy($rb_lt((severity = ($truthy($a = severity) ? $a : $$($nesting, 'UNKNOWN'))), self.level))) { + return true}; + progname = ($truthy($a = progname) ? $a : self.progname); + if ($truthy(message)) { + } else if ((block !== nil)) { + message = Opal.yieldX(block, []) + } else { + + message = progname; + progname = self.progname; + }; + self.pipe.$write(self.formatter.$call(($truthy($a = $$($nesting, 'SEVERITY_LABELS')['$[]'](severity)) ? $a : "ANY"), $$$('::', 'Time').$now(), progname, message)); + return true; + }, TMP_Logger_add_17.$$arity = -2), nil) && 'add'; + })($nesting[0], null, $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/logging"] = function(Opal) { + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + function $rb_gt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $send = Opal.send, $truthy = Opal.truthy, $hash2 = Opal.hash2, $gvars = Opal.gvars; + + Opal.add_stubs(['$require', '$attr_reader', '$progname=', '$-', '$new', '$formatter=', '$level=', '$>', '$[]', '$===', '$inspect', '$map', '$constants', '$const_get', '$to_sym', '$<<', '$clear', '$empty?', '$max', '$attr_accessor', '$memoize_logger', '$private', '$alias_method', '$==', '$define_method', '$extend', '$logger', '$merge']); + + self.$require("logger"); + return (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + + (function($base, $super, $parent_nesting) { + function $Logger(){}; + var self = $Logger = $klass($base, $super, 'Logger', $Logger); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Logger_initialize_1, TMP_Logger_add_2; + + def.max_severity = nil; + + self.$attr_reader("max_severity"); + + Opal.def(self, '$initialize', TMP_Logger_initialize_1 = function $$initialize($a) { + var $post_args, args, $iter = TMP_Logger_initialize_1.$$p, $yield = $iter || nil, self = this, $writer = nil, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_Logger_initialize_1.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + $send(self, Opal.find_super_dispatcher(self, 'initialize', TMP_Logger_initialize_1, false), $zuper, $iter); + + $writer = ["asciidoctor"]; + $send(self, 'progname=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = [$$($nesting, 'BasicFormatter').$new()]; + $send(self, 'formatter=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = [$$($nesting, 'WARN')]; + $send(self, 'level=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];; + }, TMP_Logger_initialize_1.$$arity = -1); + + Opal.def(self, '$add', TMP_Logger_add_2 = function $$add(severity, message, progname) { + var $a, $iter = TMP_Logger_add_2.$$p, $yield = $iter || nil, self = this, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_Logger_add_2.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + + + if (message == null) { + message = nil; + }; + + if (progname == null) { + progname = nil; + }; + if ($truthy($rb_gt((severity = ($truthy($a = severity) ? $a : $$($nesting, 'UNKNOWN'))), (self.max_severity = ($truthy($a = self.max_severity) ? $a : severity))))) { + self.max_severity = severity}; + return $send(self, Opal.find_super_dispatcher(self, 'add', TMP_Logger_add_2, false), $zuper, $iter); + }, TMP_Logger_add_2.$$arity = -2); + (function($base, $super, $parent_nesting) { + function $BasicFormatter(){}; + var self = $BasicFormatter = $klass($base, $super, 'BasicFormatter', $BasicFormatter); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_BasicFormatter_call_3; + + + Opal.const_set($nesting[0], 'SEVERITY_LABELS', $hash2(["WARN", "FATAL"], {"WARN": "WARNING", "FATAL": "FAILED"})); + return (Opal.def(self, '$call', TMP_BasicFormatter_call_3 = function $$call(severity, _, progname, msg) { + var $a, self = this; + + return "" + (progname) + ": " + (($truthy($a = $$($nesting, 'SEVERITY_LABELS')['$[]'](severity)) ? $a : severity)) + ": " + ((function() {if ($truthy($$$('::', 'String')['$==='](msg))) { + return msg + } else { + return msg.$inspect() + }; return nil; })()) + "\n" + }, TMP_BasicFormatter_call_3.$$arity = 4), nil) && 'call'; + })($nesting[0], $$($nesting, 'Formatter'), $nesting); + return (function($base, $parent_nesting) { + function $AutoFormattingMessage() {}; + var self = $AutoFormattingMessage = $module($base, 'AutoFormattingMessage', $AutoFormattingMessage); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_AutoFormattingMessage_inspect_4; + + + Opal.def(self, '$inspect', TMP_AutoFormattingMessage_inspect_4 = function $$inspect() { + var self = this, sloc = nil; + + if ($truthy((sloc = self['$[]']("source_location")))) { + return "" + (sloc) + ": " + (self['$[]']("text")) + } else { + return self['$[]']("text") + } + }, TMP_AutoFormattingMessage_inspect_4.$$arity = 0) + })($nesting[0], $nesting); + })($nesting[0], $$$('::', 'Logger'), $nesting); + (function($base, $super, $parent_nesting) { + function $MemoryLogger(){}; + var self = $MemoryLogger = $klass($base, $super, 'MemoryLogger', $MemoryLogger); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_MemoryLogger_5, TMP_MemoryLogger_initialize_6, TMP_MemoryLogger_add_7, TMP_MemoryLogger_clear_8, TMP_MemoryLogger_empty$q_9, TMP_MemoryLogger_max_severity_10; + + def.messages = nil; + + Opal.const_set($nesting[0], 'SEVERITY_LABELS', $$$('::', 'Hash')['$[]']($send($$($nesting, 'Severity').$constants(), 'map', [], (TMP_MemoryLogger_5 = function(c){var self = TMP_MemoryLogger_5.$$s || this; + + + + if (c == null) { + c = nil; + }; + return [$$($nesting, 'Severity').$const_get(c), c.$to_sym()];}, TMP_MemoryLogger_5.$$s = self, TMP_MemoryLogger_5.$$arity = 1, TMP_MemoryLogger_5)))); + self.$attr_reader("messages"); + + Opal.def(self, '$initialize', TMP_MemoryLogger_initialize_6 = function $$initialize() { + var self = this, $writer = nil; + + + + $writer = [$$($nesting, 'WARN')]; + $send(self, 'level=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + return (self.messages = []); + }, TMP_MemoryLogger_initialize_6.$$arity = 0); + + Opal.def(self, '$add', TMP_MemoryLogger_add_7 = function $$add(severity, message, progname) { + var $a, $iter = TMP_MemoryLogger_add_7.$$p, $yield = $iter || nil, self = this; + + if ($iter) TMP_MemoryLogger_add_7.$$p = null; + + + if (message == null) { + message = nil; + }; + + if (progname == null) { + progname = nil; + }; + if ($truthy(message)) { + } else { + message = (function() {if (($yield !== nil)) { + return Opal.yieldX($yield, []); + } else { + return progname + }; return nil; })() + }; + self.messages['$<<']($hash2(["severity", "message"], {"severity": $$($nesting, 'SEVERITY_LABELS')['$[]'](($truthy($a = severity) ? $a : $$($nesting, 'UNKNOWN'))), "message": message})); + return true; + }, TMP_MemoryLogger_add_7.$$arity = -2); + + Opal.def(self, '$clear', TMP_MemoryLogger_clear_8 = function $$clear() { + var self = this; + + return self.messages.$clear() + }, TMP_MemoryLogger_clear_8.$$arity = 0); + + Opal.def(self, '$empty?', TMP_MemoryLogger_empty$q_9 = function() { + var self = this; + + return self.messages['$empty?']() + }, TMP_MemoryLogger_empty$q_9.$$arity = 0); + return (Opal.def(self, '$max_severity', TMP_MemoryLogger_max_severity_10 = function $$max_severity() { + var TMP_11, self = this; + + if ($truthy(self['$empty?']())) { + return nil + } else { + return $send(self.messages, 'map', [], (TMP_11 = function(m){var self = TMP_11.$$s || this; + + + + if (m == null) { + m = nil; + }; + return $$($nesting, 'Severity').$const_get(m['$[]']("severity"));}, TMP_11.$$s = self, TMP_11.$$arity = 1, TMP_11)).$max() + } + }, TMP_MemoryLogger_max_severity_10.$$arity = 0), nil) && 'max_severity'; + })($nesting[0], $$$('::', 'Logger'), $nesting); + (function($base, $super, $parent_nesting) { + function $NullLogger(){}; + var self = $NullLogger = $klass($base, $super, 'NullLogger', $NullLogger); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_NullLogger_initialize_12, TMP_NullLogger_add_13; + + def.max_severity = nil; + + self.$attr_reader("max_severity"); + + Opal.def(self, '$initialize', TMP_NullLogger_initialize_12 = function $$initialize() { + var self = this; + + return nil + }, TMP_NullLogger_initialize_12.$$arity = 0); + return (Opal.def(self, '$add', TMP_NullLogger_add_13 = function $$add(severity, message, progname) { + var $a, self = this; + + + + if (message == null) { + message = nil; + }; + + if (progname == null) { + progname = nil; + }; + if ($truthy($rb_gt((severity = ($truthy($a = severity) ? $a : $$($nesting, 'UNKNOWN'))), (self.max_severity = ($truthy($a = self.max_severity) ? $a : severity))))) { + self.max_severity = severity}; + return true; + }, TMP_NullLogger_add_13.$$arity = -2), nil) && 'add'; + })($nesting[0], $$$('::', 'Logger'), $nesting); + (function($base, $parent_nesting) { + function $LoggerManager() {}; + var self = $LoggerManager = $module($base, 'LoggerManager', $LoggerManager); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + + self.logger_class = $$($nesting, 'Logger'); + (function(self, $parent_nesting) { + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_logger_14, TMP_logger$eq_15, TMP_memoize_logger_16; + + + self.$attr_accessor("logger_class"); + + Opal.def(self, '$logger', TMP_logger_14 = function $$logger(pipe) { + var $a, self = this; + if (self.logger == null) self.logger = nil; + if (self.logger_class == null) self.logger_class = nil; + if ($gvars.stderr == null) $gvars.stderr = nil; + + + + if (pipe == null) { + pipe = $gvars.stderr; + }; + self.$memoize_logger(); + return (self.logger = ($truthy($a = self.logger) ? $a : self.logger_class.$new(pipe))); + }, TMP_logger_14.$$arity = -1); + + Opal.def(self, '$logger=', TMP_logger$eq_15 = function(logger) { + var $a, self = this; + if (self.logger_class == null) self.logger_class = nil; + if ($gvars.stderr == null) $gvars.stderr = nil; + + return (self.logger = ($truthy($a = logger) ? $a : self.logger_class.$new($gvars.stderr))) + }, TMP_logger$eq_15.$$arity = 1); + self.$private(); + return (Opal.def(self, '$memoize_logger', TMP_memoize_logger_16 = function $$memoize_logger() { + var self = this; + + return (function(self, $parent_nesting) { + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_17; + + + self.$alias_method("logger", "logger"); + if ($$($nesting, 'RUBY_ENGINE')['$==']("opal")) { + return $send(self, 'define_method', ["logger"], (TMP_17 = function(){var self = TMP_17.$$s || this; + if (self.logger == null) self.logger = nil; + + return self.logger}, TMP_17.$$s = self, TMP_17.$$arity = 0, TMP_17)) + } else { + return nil + }; + })(Opal.get_singleton_class(self), $nesting) + }, TMP_memoize_logger_16.$$arity = 0), nil) && 'memoize_logger'; + })(Opal.get_singleton_class(self), $nesting); + })($nesting[0], $nesting); + (function($base, $parent_nesting) { + function $Logging() {}; + var self = $Logging = $module($base, 'Logging', $Logging); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Logging_included_18, TMP_Logging_logger_19, TMP_Logging_message_with_context_20; + + + Opal.defs(self, '$included', TMP_Logging_included_18 = function $$included(into) { + var self = this; + + return into.$extend($$($nesting, 'Logging')) + }, TMP_Logging_included_18.$$arity = 1); + self.$private(); + + Opal.def(self, '$logger', TMP_Logging_logger_19 = function $$logger() { + var self = this; + + return $$($nesting, 'LoggerManager').$logger() + }, TMP_Logging_logger_19.$$arity = 0); + + Opal.def(self, '$message_with_context', TMP_Logging_message_with_context_20 = function $$message_with_context(text, context) { + var self = this; + + + + if (context == null) { + context = $hash2([], {}); + }; + return $hash2(["text"], {"text": text}).$merge(context).$extend($$$($$($nesting, 'Logger'), 'AutoFormattingMessage')); + }, TMP_Logging_message_with_context_20.$$arity = -2); + })($nesting[0], $nesting); + })($nesting[0], $nesting); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/timings"] = function(Opal) { + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + function $rb_plus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); + } + function $rb_gt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $hash2 = Opal.hash2, $send = Opal.send, $truthy = Opal.truthy, $gvars = Opal.gvars; + + Opal.add_stubs(['$now', '$[]=', '$-', '$delete', '$reduce', '$+', '$[]', '$>', '$time', '$puts', '$%', '$to_f', '$read_parse', '$convert', '$read_parse_convert', '$const_defined?', '$respond_to?', '$clock_gettime']); + return (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + (function($base, $super, $parent_nesting) { + function $Timings(){}; + var self = $Timings = $klass($base, $super, 'Timings', $Timings); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Timings_initialize_1, TMP_Timings_start_2, TMP_Timings_record_3, TMP_Timings_time_4, TMP_Timings_read_6, TMP_Timings_parse_7, TMP_Timings_read_parse_8, TMP_Timings_convert_9, TMP_Timings_read_parse_convert_10, TMP_Timings_write_11, TMP_Timings_total_12, TMP_Timings_print_report_13, $a, TMP_Timings_now_14, TMP_Timings_now_15; + + def.timers = def.log = nil; + + + Opal.def(self, '$initialize', TMP_Timings_initialize_1 = function $$initialize() { + var self = this; + + + self.log = $hash2([], {}); + return (self.timers = $hash2([], {})); + }, TMP_Timings_initialize_1.$$arity = 0); + + Opal.def(self, '$start', TMP_Timings_start_2 = function $$start(key) { + var self = this, $writer = nil; + + + $writer = [key, self.$now()]; + $send(self.timers, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + }, TMP_Timings_start_2.$$arity = 1); + + Opal.def(self, '$record', TMP_Timings_record_3 = function $$record(key) { + var self = this, $writer = nil; + + + $writer = [key, $rb_minus(self.$now(), self.timers.$delete(key))]; + $send(self.log, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + }, TMP_Timings_record_3.$$arity = 1); + + Opal.def(self, '$time', TMP_Timings_time_4 = function $$time($a) { + var $post_args, keys, TMP_5, self = this, time = nil; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + keys = $post_args;; + time = $send(keys, 'reduce', [0], (TMP_5 = function(sum, key){var self = TMP_5.$$s || this, $b; + if (self.log == null) self.log = nil; + + + + if (sum == null) { + sum = nil; + }; + + if (key == null) { + key = nil; + }; + return $rb_plus(sum, ($truthy($b = self.log['$[]'](key)) ? $b : 0));}, TMP_5.$$s = self, TMP_5.$$arity = 2, TMP_5)); + if ($truthy($rb_gt(time, 0))) { + return time + } else { + return nil + }; + }, TMP_Timings_time_4.$$arity = -1); + + Opal.def(self, '$read', TMP_Timings_read_6 = function $$read() { + var self = this; + + return self.$time("read") + }, TMP_Timings_read_6.$$arity = 0); + + Opal.def(self, '$parse', TMP_Timings_parse_7 = function $$parse() { + var self = this; + + return self.$time("parse") + }, TMP_Timings_parse_7.$$arity = 0); + + Opal.def(self, '$read_parse', TMP_Timings_read_parse_8 = function $$read_parse() { + var self = this; + + return self.$time("read", "parse") + }, TMP_Timings_read_parse_8.$$arity = 0); + + Opal.def(self, '$convert', TMP_Timings_convert_9 = function $$convert() { + var self = this; + + return self.$time("convert") + }, TMP_Timings_convert_9.$$arity = 0); + + Opal.def(self, '$read_parse_convert', TMP_Timings_read_parse_convert_10 = function $$read_parse_convert() { + var self = this; + + return self.$time("read", "parse", "convert") + }, TMP_Timings_read_parse_convert_10.$$arity = 0); + + Opal.def(self, '$write', TMP_Timings_write_11 = function $$write() { + var self = this; + + return self.$time("write") + }, TMP_Timings_write_11.$$arity = 0); + + Opal.def(self, '$total', TMP_Timings_total_12 = function $$total() { + var self = this; + + return self.$time("read", "parse", "convert", "write") + }, TMP_Timings_total_12.$$arity = 0); + + Opal.def(self, '$print_report', TMP_Timings_print_report_13 = function $$print_report(to, subject) { + var self = this; + if ($gvars.stdout == null) $gvars.stdout = nil; + + + + if (to == null) { + to = $gvars.stdout; + }; + + if (subject == null) { + subject = nil; + }; + if ($truthy(subject)) { + to.$puts("" + "Input file: " + (subject))}; + to.$puts("" + " Time to read and parse source: " + ("%05.5f"['$%'](self.$read_parse().$to_f()))); + to.$puts("" + " Time to convert document: " + ("%05.5f"['$%'](self.$convert().$to_f()))); + return to.$puts("" + " Total time (read, parse and convert): " + ("%05.5f"['$%'](self.$read_parse_convert().$to_f()))); + }, TMP_Timings_print_report_13.$$arity = -1); + if ($truthy(($truthy($a = $$$('::', 'Process')['$const_defined?']("CLOCK_MONOTONIC")) ? $$$('::', 'Process')['$respond_to?']("clock_gettime") : $a))) { + + Opal.const_set($nesting[0], 'CLOCK_ID', $$$($$$('::', 'Process'), 'CLOCK_MONOTONIC')); + return (Opal.def(self, '$now', TMP_Timings_now_14 = function $$now() { + var self = this; + + return $$$('::', 'Process').$clock_gettime($$($nesting, 'CLOCK_ID')) + }, TMP_Timings_now_14.$$arity = 0), nil) && 'now'; + } else { + return (Opal.def(self, '$now', TMP_Timings_now_15 = function $$now() { + var self = this; + + return $$$('::', 'Time').$now() + }, TMP_Timings_now_15.$$arity = 0), nil) && 'now' + }; + })($nesting[0], null, $nesting) + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/version"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module; + + return (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + Opal.const_set($nesting[0], 'VERSION', "1.5.8") + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/core_ext/nil_or_empty"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $truthy = Opal.truthy; + + Opal.add_stubs(['$method_defined?']); + + (function($base, $super, $parent_nesting) { + function $NilClass(){}; + var self = $NilClass = $klass($base, $super, 'NilClass', $NilClass); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + if ($truthy(self['$method_defined?']("nil_or_empty?"))) { + return nil + } else { + return Opal.alias(self, "nil_or_empty?", "nil?") + } + })($nesting[0], null, $nesting); + (function($base, $super, $parent_nesting) { + function $String(){}; + var self = $String = $klass($base, $super, 'String', $String); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + if ($truthy(self['$method_defined?']("nil_or_empty?"))) { + return nil + } else { + return Opal.alias(self, "nil_or_empty?", "empty?") + } + })($nesting[0], null, $nesting); + (function($base, $super, $parent_nesting) { + function $Array(){}; + var self = $Array = $klass($base, $super, 'Array', $Array); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + if ($truthy(self['$method_defined?']("nil_or_empty?"))) { + return nil + } else { + return Opal.alias(self, "nil_or_empty?", "empty?") + } + })($nesting[0], null, $nesting); + (function($base, $super, $parent_nesting) { + function $Hash(){}; + var self = $Hash = $klass($base, $super, 'Hash', $Hash); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + if ($truthy(self['$method_defined?']("nil_or_empty?"))) { + return nil + } else { + return Opal.alias(self, "nil_or_empty?", "empty?") + } + })($nesting[0], null, $nesting); + return (function($base, $super, $parent_nesting) { + function $Numeric(){}; + var self = $Numeric = $klass($base, $super, 'Numeric', $Numeric); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + if ($truthy(self['$method_defined?']("nil_or_empty?"))) { + return nil + } else { + return Opal.alias(self, "nil_or_empty?", "nil?") + } + })($nesting[0], null, $nesting); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/core_ext/regexp/is_match"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $truthy = Opal.truthy; + + Opal.add_stubs(['$method_defined?']); + return (function($base, $super, $parent_nesting) { + function $Regexp(){}; + var self = $Regexp = $klass($base, $super, 'Regexp', $Regexp); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + if ($truthy(self['$method_defined?']("match?"))) { + return nil + } else { + return Opal.alias(self, "match?", "===") + } + })($nesting[0], null, $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/core_ext/string/limit_bytesize"] = function(Opal) { + function $rb_lt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); + } + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $truthy = Opal.truthy; + + Opal.add_stubs(['$method_defined?', '$<', '$bytesize', '$valid_encoding?', '$force_encoding', '$byteslice', '$-']); + return (function($base, $super, $parent_nesting) { + function $String(){}; + var self = $String = $klass($base, $super, 'String', $String); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_String_limit_bytesize_1; + + if ($truthy(self['$method_defined?']("limit_bytesize"))) { + return nil + } else { + return (Opal.def(self, '$limit_bytesize', TMP_String_limit_bytesize_1 = function $$limit_bytesize(size) { + var $a, self = this, result = nil; + + + if ($truthy($rb_lt(size, self.$bytesize()))) { + } else { + return self + }; + while (!($truthy((result = self.$byteslice(0, size)).$force_encoding($$$($$$('::', 'Encoding'), 'UTF_8'))['$valid_encoding?']()))) { + size = $rb_minus(size, 1) + }; + return result; + }, TMP_String_limit_bytesize_1.$$arity = 1), nil) && 'limit_bytesize' + } + })($nesting[0], null, $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/core_ext/1.8.7/io/binread"] = function(Opal) { + var TMP_binread_1, self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $truthy = Opal.truthy, $send = Opal.send; + + Opal.add_stubs(['$respond_to?', '$open', '$==', '$seek', '$read']); + if ($truthy($$($nesting, 'IO')['$respond_to?']("binread"))) { + return nil + } else { + return (Opal.defs($$($nesting, 'IO'), '$binread', TMP_binread_1 = function $$binread(name, length, offset) { + var TMP_2, self = this; + + + + if (length == null) { + length = nil; + }; + + if (offset == null) { + offset = 0; + }; + return $send($$($nesting, 'File'), 'open', [name, "rb"], (TMP_2 = function(f){var self = TMP_2.$$s || this; + + + + if (f == null) { + f = nil; + }; + if (offset['$=='](0)) { + } else { + f.$seek(offset) + }; + if ($truthy(length)) { + + return f.$read(length); + } else { + return f.$read() + };}, TMP_2.$$s = self, TMP_2.$$arity = 1, TMP_2)); + }, TMP_binread_1.$$arity = -2), nil) && 'binread' + } +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/core_ext/1.8.7/io/write"] = function(Opal) { + var TMP_write_1, self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $truthy = Opal.truthy, $send = Opal.send; + + Opal.add_stubs(['$respond_to?', '$open', '$write']); + if ($truthy($$($nesting, 'IO')['$respond_to?']("write"))) { + return nil + } else { + return (Opal.defs($$($nesting, 'IO'), '$write', TMP_write_1 = function $$write(name, string, offset, opts) { + var TMP_2, self = this; + + + + if (offset == null) { + offset = 0; + }; + + if (opts == null) { + opts = nil; + }; + return $send($$($nesting, 'File'), 'open', [name, "w"], (TMP_2 = function(f){var self = TMP_2.$$s || this; + + + + if (f == null) { + f = nil; + }; + return f.$write(string);}, TMP_2.$$s = self, TMP_2.$$arity = 1, TMP_2)); + }, TMP_write_1.$$arity = -3), nil) && 'write' + } +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/core_ext"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $truthy = Opal.truthy; + + Opal.add_stubs(['$require', '$==', '$!=']); + + self.$require("asciidoctor/core_ext/nil_or_empty"); + self.$require("asciidoctor/core_ext/regexp/is_match"); + if ($truthy($$($nesting, 'RUBY_MIN_VERSION_1_9'))) { + + self.$require("asciidoctor/core_ext/string/limit_bytesize"); + if ($$($nesting, 'RUBY_ENGINE')['$==']("opal")) { + + self.$require("asciidoctor/core_ext/1.8.7/io/binread"); + return self.$require("asciidoctor/core_ext/1.8.7/io/write"); + } else { + return nil + }; + } else if ($truthy($$($nesting, 'RUBY_ENGINE')['$!=']("opal"))) { + return nil + } else { + return nil + }; +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/helpers"] = function(Opal) { + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + function $rb_times(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs * rhs : lhs['$*'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $truthy = Opal.truthy, $send = Opal.send, $gvars = Opal.gvars, $hash2 = Opal.hash2; + + Opal.add_stubs(['$require', '$include?', '$include', '$==', '$===', '$raise', '$warn', '$logger', '$chomp', '$message', '$normalize_lines_from_string', '$normalize_lines_array', '$empty?', '$unpack', '$[]', '$slice', '$join', '$map', '$each_line', '$encode', '$force_encoding', '$length', '$rstrip', '$[]=', '$-', '$encoding', '$nil_or_empty?', '$match?', '$=~', '$gsub', '$each_byte', '$sprintf', '$rindex', '$basename', '$extname', '$directory?', '$dirname', '$mkdir_p', '$mkdir', '$divmod', '$*']); + return (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + (function($base, $parent_nesting) { + function $Helpers() {}; + var self = $Helpers = $module($base, 'Helpers', $Helpers); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Helpers_require_library_1, TMP_Helpers_normalize_lines_2, TMP_Helpers_normalize_lines_array_3, TMP_Helpers_normalize_lines_from_string_8, TMP_Helpers_uriish$q_10, TMP_Helpers_uri_prefix_11, TMP_Helpers_uri_encode_12, TMP_Helpers_rootname_15, TMP_Helpers_basename_16, TMP_Helpers_mkdir_p_17, TMP_Helpers_int_to_roman_18; + + + Opal.defs(self, '$require_library', TMP_Helpers_require_library_1 = function $$require_library(name, gem_name, on_failure) { + var self = this, e = nil, $case = nil; + + + + if (gem_name == null) { + gem_name = true; + }; + + if (on_failure == null) { + on_failure = "abort"; + }; + try { + return self.$require(name) + } catch ($err) { + if (Opal.rescue($err, [$$$('::', 'LoadError')])) {e = $err; + try { + + if ($truthy(self['$include?']($$($nesting, 'Logging')))) { + } else { + self.$include($$($nesting, 'Logging')) + }; + if ($truthy(gem_name)) { + + if (gem_name['$=='](true)) { + gem_name = name}; + $case = on_failure; + if ("abort"['$===']($case)) {self.$raise($$$('::', 'LoadError'), "" + "asciidoctor: FAILED: required gem '" + (gem_name) + "' is not installed. Processing aborted.")} + else if ("warn"['$===']($case)) {self.$logger().$warn("" + "optional gem '" + (gem_name) + "' is not installed. Functionality disabled.")}; + } else { + $case = on_failure; + if ("abort"['$===']($case)) {self.$raise($$$('::', 'LoadError'), "" + "asciidoctor: FAILED: " + (e.$message().$chomp(".")) + ". Processing aborted.")} + else if ("warn"['$===']($case)) {self.$logger().$warn("" + (e.$message().$chomp(".")) + ". Functionality disabled.")} + }; + return nil; + } finally { Opal.pop_exception() } + } else { throw $err; } + }; + }, TMP_Helpers_require_library_1.$$arity = -2); + Opal.defs(self, '$normalize_lines', TMP_Helpers_normalize_lines_2 = function $$normalize_lines(data) { + var self = this; + + if ($truthy($$$('::', 'String')['$==='](data))) { + + return self.$normalize_lines_from_string(data); + } else { + + return self.$normalize_lines_array(data); + } + }, TMP_Helpers_normalize_lines_2.$$arity = 1); + Opal.defs(self, '$normalize_lines_array', TMP_Helpers_normalize_lines_array_3 = function $$normalize_lines_array(data) { + var TMP_4, TMP_5, TMP_6, TMP_7, self = this, leading_bytes = nil, first_line = nil, utf8 = nil, leading_2_bytes = nil, $writer = nil; + + + if ($truthy(data['$empty?']())) { + return data}; + leading_bytes = (first_line = data['$[]'](0)).$unpack("C3"); + if ($truthy($$($nesting, 'COERCE_ENCODING'))) { + + utf8 = $$$($$$('::', 'Encoding'), 'UTF_8'); + if ((leading_2_bytes = leading_bytes.$slice(0, 2))['$==']($$($nesting, 'BOM_BYTES_UTF_16LE'))) { + + data = data.$join(); + return $send(data.$force_encoding($$$($$$('::', 'Encoding'), 'UTF_16LE')).$slice(1, data.$length()).$encode(utf8).$each_line(), 'map', [], (TMP_4 = function(line){var self = TMP_4.$$s || this; + + + + if (line == null) { + line = nil; + }; + return line.$rstrip();}, TMP_4.$$s = self, TMP_4.$$arity = 1, TMP_4)); + } else if (leading_2_bytes['$==']($$($nesting, 'BOM_BYTES_UTF_16BE'))) { + + + $writer = [0, first_line.$force_encoding($$$($$$('::', 'Encoding'), 'UTF_16BE')).$slice(1, first_line.$length())]; + $send(data, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + return $send(data, 'map', [], (TMP_5 = function(line){var self = TMP_5.$$s || this; + + + + if (line == null) { + line = nil; + }; + return line.$force_encoding($$$($$$('::', 'Encoding'), 'UTF_16BE')).$encode(utf8).$rstrip();}, TMP_5.$$s = self, TMP_5.$$arity = 1, TMP_5)); + } else if (leading_bytes['$==']($$($nesting, 'BOM_BYTES_UTF_8'))) { + + $writer = [0, first_line.$force_encoding(utf8).$slice(1, first_line.$length())]; + $send(data, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + return $send(data, 'map', [], (TMP_6 = function(line){var self = TMP_6.$$s || this; + + + + if (line == null) { + line = nil; + }; + if (line.$encoding()['$=='](utf8)) { + return line.$rstrip() + } else { + return line.$force_encoding(utf8).$rstrip() + };}, TMP_6.$$s = self, TMP_6.$$arity = 1, TMP_6)); + } else { + + if (leading_bytes['$==']($$($nesting, 'BOM_BYTES_UTF_8'))) { + + $writer = [0, first_line.$slice(3, first_line.$length())]; + $send(data, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + return $send(data, 'map', [], (TMP_7 = function(line){var self = TMP_7.$$s || this; + + + + if (line == null) { + line = nil; + }; + return line.$rstrip();}, TMP_7.$$s = self, TMP_7.$$arity = 1, TMP_7)); + }; + }, TMP_Helpers_normalize_lines_array_3.$$arity = 1); + Opal.defs(self, '$normalize_lines_from_string', TMP_Helpers_normalize_lines_from_string_8 = function $$normalize_lines_from_string(data) { + var TMP_9, self = this, leading_bytes = nil, utf8 = nil, leading_2_bytes = nil; + + + if ($truthy(data['$nil_or_empty?']())) { + return []}; + leading_bytes = data.$unpack("C3"); + if ($truthy($$($nesting, 'COERCE_ENCODING'))) { + + utf8 = $$$($$$('::', 'Encoding'), 'UTF_8'); + if ((leading_2_bytes = leading_bytes.$slice(0, 2))['$==']($$($nesting, 'BOM_BYTES_UTF_16LE'))) { + data = data.$force_encoding($$$($$$('::', 'Encoding'), 'UTF_16LE')).$slice(1, data.$length()).$encode(utf8) + } else if (leading_2_bytes['$==']($$($nesting, 'BOM_BYTES_UTF_16BE'))) { + data = data.$force_encoding($$$($$$('::', 'Encoding'), 'UTF_16BE')).$slice(1, data.$length()).$encode(utf8) + } else if (leading_bytes['$==']($$($nesting, 'BOM_BYTES_UTF_8'))) { + data = (function() {if (data.$encoding()['$=='](utf8)) { + + return data.$slice(1, data.$length()); + } else { + + return data.$force_encoding(utf8).$slice(1, data.$length()); + }; return nil; })() + } else if (data.$encoding()['$=='](utf8)) { + } else { + data = data.$force_encoding(utf8) + }; + } else if (leading_bytes['$==']($$($nesting, 'BOM_BYTES_UTF_8'))) { + data = data.$slice(3, data.$length())}; + return $send(data.$each_line(), 'map', [], (TMP_9 = function(line){var self = TMP_9.$$s || this; + + + + if (line == null) { + line = nil; + }; + return line.$rstrip();}, TMP_9.$$s = self, TMP_9.$$arity = 1, TMP_9)); + }, TMP_Helpers_normalize_lines_from_string_8.$$arity = 1); + Opal.defs(self, '$uriish?', TMP_Helpers_uriish$q_10 = function(str) { + var $a, self = this; + + return ($truthy($a = str['$include?'](":")) ? $$($nesting, 'UriSniffRx')['$match?'](str) : $a) + }, TMP_Helpers_uriish$q_10.$$arity = 1); + Opal.defs(self, '$uri_prefix', TMP_Helpers_uri_prefix_11 = function $$uri_prefix(str) { + var $a, self = this; + + if ($truthy(($truthy($a = str['$include?'](":")) ? $$($nesting, 'UriSniffRx')['$=~'](str) : $a))) { + return (($a = $gvars['~']) === nil ? nil : $a['$[]'](0)) + } else { + return nil + } + }, TMP_Helpers_uri_prefix_11.$$arity = 1); + Opal.const_set($nesting[0], 'REGEXP_ENCODE_URI_CHARS', /[^\w\-.!~*';:@=+$,()\[\]]/); + Opal.defs(self, '$uri_encode', TMP_Helpers_uri_encode_12 = function $$uri_encode(str) { + var TMP_13, self = this; + + return $send(str, 'gsub', [$$($nesting, 'REGEXP_ENCODE_URI_CHARS')], (TMP_13 = function(){var self = TMP_13.$$s || this, $a, TMP_14; + + return $send((($a = $gvars['~']) === nil ? nil : $a['$[]'](0)).$each_byte(), 'map', [], (TMP_14 = function(c){var self = TMP_14.$$s || this; + + + + if (c == null) { + c = nil; + }; + return self.$sprintf("%%%02X", c);}, TMP_14.$$s = self, TMP_14.$$arity = 1, TMP_14)).$join()}, TMP_13.$$s = self, TMP_13.$$arity = 0, TMP_13)) + }, TMP_Helpers_uri_encode_12.$$arity = 1); + Opal.defs(self, '$rootname', TMP_Helpers_rootname_15 = function $$rootname(filename) { + var $a, self = this; + + return filename.$slice(0, ($truthy($a = filename.$rindex(".")) ? $a : filename.$length())) + }, TMP_Helpers_rootname_15.$$arity = 1); + Opal.defs(self, '$basename', TMP_Helpers_basename_16 = function $$basename(filename, drop_ext) { + var self = this; + + + + if (drop_ext == null) { + drop_ext = nil; + }; + if ($truthy(drop_ext)) { + return $$$('::', 'File').$basename(filename, (function() {if (drop_ext['$=='](true)) { + + return $$$('::', 'File').$extname(filename); + } else { + return drop_ext + }; return nil; })()) + } else { + return $$$('::', 'File').$basename(filename) + }; + }, TMP_Helpers_basename_16.$$arity = -2); + Opal.defs(self, '$mkdir_p', TMP_Helpers_mkdir_p_17 = function $$mkdir_p(dir) { + var self = this, parent_dir = nil; + + if ($truthy($$$('::', 'File')['$directory?'](dir))) { + return nil + } else { + + if ((parent_dir = $$$('::', 'File').$dirname(dir))['$=='](".")) { + } else { + self.$mkdir_p(parent_dir) + }; + + try { + return $$$('::', 'Dir').$mkdir(dir) + } catch ($err) { + if (Opal.rescue($err, [$$$('::', 'SystemCallError')])) { + try { + if ($truthy($$$('::', 'File')['$directory?'](dir))) { + return nil + } else { + return self.$raise() + } + } finally { Opal.pop_exception() } + } else { throw $err; } + };; + } + }, TMP_Helpers_mkdir_p_17.$$arity = 1); + Opal.const_set($nesting[0], 'ROMAN_NUMERALS', $hash2(["M", "CM", "D", "CD", "C", "XC", "L", "XL", "X", "IX", "V", "IV", "I"], {"M": 1000, "CM": 900, "D": 500, "CD": 400, "C": 100, "XC": 90, "L": 50, "XL": 40, "X": 10, "IX": 9, "V": 5, "IV": 4, "I": 1})); + Opal.defs(self, '$int_to_roman', TMP_Helpers_int_to_roman_18 = function $$int_to_roman(val) { + var TMP_19, self = this; + + return $send($$($nesting, 'ROMAN_NUMERALS'), 'map', [], (TMP_19 = function(l, i){var self = TMP_19.$$s || this, $a, $b, repeat = nil; + + + + if (l == null) { + l = nil; + }; + + if (i == null) { + i = nil; + }; + $b = val.$divmod(i), $a = Opal.to_ary($b), (repeat = ($a[0] == null ? nil : $a[0])), (val = ($a[1] == null ? nil : $a[1])), $b; + return $rb_times(l, repeat);}, TMP_19.$$s = self, TMP_19.$$arity = 2, TMP_19)).$join() + }, TMP_Helpers_int_to_roman_18.$$arity = 1); + })($nesting[0], $nesting) + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/substitutors"] = function(Opal) { + function $rb_plus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); + } + function $rb_gt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); + } + function $rb_times(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs * rhs : lhs['$*'](rhs); + } + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + function $rb_lt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $hash2 = Opal.hash2, $hash = Opal.hash, $truthy = Opal.truthy, $send = Opal.send, $gvars = Opal.gvars; + + Opal.add_stubs(['$freeze', '$+', '$keys', '$chr', '$attr_reader', '$empty?', '$!', '$===', '$[]', '$join', '$include?', '$extract_passthroughs', '$each', '$sub_specialchars', '$sub_quotes', '$sub_attributes', '$sub_replacements', '$sub_macros', '$highlight_source', '$sub_callouts', '$sub_post_replacements', '$warn', '$logger', '$restore_passthroughs', '$split', '$apply_subs', '$compat_mode', '$gsub', '$==', '$length', '$>', '$*', '$-', '$end_with?', '$slice', '$parse_quoted_text_attributes', '$size', '$[]=', '$unescape_brackets', '$resolve_pass_subs', '$start_with?', '$extract_inner_passthrough', '$to_sym', '$attributes', '$basebackend?', '$=~', '$to_i', '$convert', '$new', '$clear', '$match?', '$convert_quoted_text', '$do_replacement', '$sub', '$shift', '$store_attribute', '$!=', '$attribute_undefined', '$counter', '$key?', '$downcase', '$attribute_missing', '$tr_s', '$delete', '$reject', '$strip', '$index', '$min', '$compact', '$map', '$chop', '$unescape_bracketed_text', '$pop', '$rstrip', '$extensions', '$inline_macros?', '$inline_macros', '$regexp', '$instance', '$names', '$config', '$dup', '$nil_or_empty?', '$parse_attributes', '$process_method', '$register', '$tr', '$basename', '$split_simple_csv', '$normalize_string', '$!~', '$parse', '$uri_encode', '$sub_inline_xrefs', '$sub_inline_anchors', '$find', '$footnotes', '$id', '$text', '$style', '$lstrip', '$parse_into', '$extname', '$catalog', '$fetch', '$outfilesuffix', '$natural_xrefs', '$key', '$attr?', '$attr', '$to_s', '$read_next_id', '$callouts', '$<', '$<<', '$shorthand_property_syntax', '$concat', '$each_char', '$drop', '$&', '$resolve_subs', '$nil?', '$require_library', '$sub_source', '$resolve_lines_to_highlight', '$highlight', '$find_by_alias', '$find_by_mimetype', '$name', '$option?', '$count', '$to_a', '$uniq', '$sort', '$resolve_block_subs']); + return (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + (function($base, $parent_nesting) { + function $Substitutors() {}; + var self = $Substitutors = $module($base, 'Substitutors', $Substitutors); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Substitutors_apply_subs_1, TMP_Substitutors_apply_normal_subs_3, TMP_Substitutors_apply_title_subs_4, TMP_Substitutors_apply_reftext_subs_5, TMP_Substitutors_apply_header_subs_6, TMP_Substitutors_extract_passthroughs_7, TMP_Substitutors_extract_inner_passthrough_11, TMP_Substitutors_restore_passthroughs_12, TMP_Substitutors_sub_quotes_14, TMP_Substitutors_sub_replacements_17, TMP_Substitutors_sub_specialchars_20, TMP_Substitutors_sub_specialchars_21, TMP_Substitutors_do_replacement_23, TMP_Substitutors_sub_attributes_24, TMP_Substitutors_sub_macros_29, TMP_Substitutors_sub_inline_anchors_46, TMP_Substitutors_sub_inline_xrefs_49, TMP_Substitutors_sub_callouts_51, TMP_Substitutors_sub_post_replacements_53, TMP_Substitutors_convert_quoted_text_56, TMP_Substitutors_parse_quoted_text_attributes_57, TMP_Substitutors_parse_attributes_58, TMP_Substitutors_expand_subs_59, TMP_Substitutors_unescape_bracketed_text_61, TMP_Substitutors_normalize_string_62, TMP_Substitutors_unescape_brackets_63, TMP_Substitutors_split_simple_csv_64, TMP_Substitutors_resolve_subs_67, TMP_Substitutors_resolve_block_subs_69, TMP_Substitutors_resolve_pass_subs_70, TMP_Substitutors_highlight_source_71, TMP_Substitutors_resolve_lines_to_highlight_76, TMP_Substitutors_sub_source_78, TMP_Substitutors_lock_in_subs_79; + + + Opal.const_set($nesting[0], 'SpecialCharsRx', /[<&>]/); + Opal.const_set($nesting[0], 'SpecialCharsTr', $hash2([">", "<", "&"], {">": ">", "<": "<", "&": "&"})); + Opal.const_set($nesting[0], 'QuotedTextSniffRx', $hash(false, /[*_`#^~]/, true, /[*'_+#^~]/)); + Opal.const_set($nesting[0], 'BASIC_SUBS', ["specialcharacters"]).$freeze(); + Opal.const_set($nesting[0], 'HEADER_SUBS', ["specialcharacters", "attributes"]).$freeze(); + Opal.const_set($nesting[0], 'NORMAL_SUBS', ["specialcharacters", "quotes", "attributes", "replacements", "macros", "post_replacements"]).$freeze(); + Opal.const_set($nesting[0], 'NONE_SUBS', []).$freeze(); + Opal.const_set($nesting[0], 'TITLE_SUBS', ["specialcharacters", "quotes", "replacements", "macros", "attributes", "post_replacements"]).$freeze(); + Opal.const_set($nesting[0], 'REFTEXT_SUBS', ["specialcharacters", "quotes", "replacements"]).$freeze(); + Opal.const_set($nesting[0], 'VERBATIM_SUBS', ["specialcharacters", "callouts"]).$freeze(); + Opal.const_set($nesting[0], 'SUB_GROUPS', $hash2(["none", "normal", "verbatim", "specialchars"], {"none": $$($nesting, 'NONE_SUBS'), "normal": $$($nesting, 'NORMAL_SUBS'), "verbatim": $$($nesting, 'VERBATIM_SUBS'), "specialchars": $$($nesting, 'BASIC_SUBS')})); + Opal.const_set($nesting[0], 'SUB_HINTS', $hash2(["a", "m", "n", "p", "q", "r", "c", "v"], {"a": "attributes", "m": "macros", "n": "normal", "p": "post_replacements", "q": "quotes", "r": "replacements", "c": "specialcharacters", "v": "verbatim"})); + Opal.const_set($nesting[0], 'SUB_OPTIONS', $hash2(["block", "inline"], {"block": $rb_plus($rb_plus($$($nesting, 'SUB_GROUPS').$keys(), $$($nesting, 'NORMAL_SUBS')), ["callouts"]), "inline": $rb_plus($$($nesting, 'SUB_GROUPS').$keys(), $$($nesting, 'NORMAL_SUBS'))})); + Opal.const_set($nesting[0], 'SUB_HIGHLIGHT', ["coderay", "pygments"]); + if ($truthy($$$('::', 'RUBY_MIN_VERSION_1_9'))) { + + Opal.const_set($nesting[0], 'CAN', "\u0018"); + Opal.const_set($nesting[0], 'DEL', "\u007F"); + Opal.const_set($nesting[0], 'PASS_START', "\u0096"); + Opal.const_set($nesting[0], 'PASS_END', "\u0097"); + } else { + + Opal.const_set($nesting[0], 'CAN', (24).$chr()); + Opal.const_set($nesting[0], 'DEL', (127).$chr()); + Opal.const_set($nesting[0], 'PASS_START', (150).$chr()); + Opal.const_set($nesting[0], 'PASS_END', (151).$chr()); + }; + Opal.const_set($nesting[0], 'PassSlotRx', new RegExp("" + ($$($nesting, 'PASS_START')) + "(\\d+)" + ($$($nesting, 'PASS_END')))); + Opal.const_set($nesting[0], 'HighlightedPassSlotRx', new RegExp("" + "]*>" + ($$($nesting, 'PASS_START')) + "[^\\d]*(\\d+)[^\\d]*]*>" + ($$($nesting, 'PASS_END')) + "")); + Opal.const_set($nesting[0], 'RS', "\\"); + Opal.const_set($nesting[0], 'R_SB', "]"); + Opal.const_set($nesting[0], 'ESC_R_SB', "\\]"); + Opal.const_set($nesting[0], 'PLUS', "+"); + Opal.const_set($nesting[0], 'PygmentsWrapperDivRx', /
    (.*)<\/div>/m); + Opal.const_set($nesting[0], 'PygmentsWrapperPreRx', /]*?>(.*?)<\/pre>\s*/m); + self.$attr_reader("passthroughs"); + + Opal.def(self, '$apply_subs', TMP_Substitutors_apply_subs_1 = function $$apply_subs(text, subs) { + var $a, TMP_2, self = this, multiline = nil, has_passthroughs = nil; + if (self.passthroughs == null) self.passthroughs = nil; + + + + if (subs == null) { + subs = $$($nesting, 'NORMAL_SUBS'); + }; + if ($truthy(($truthy($a = text['$empty?']()) ? $a : subs['$!']()))) { + return text}; + if ($truthy((multiline = $$$('::', 'Array')['$==='](text)))) { + text = (function() {if ($truthy(text['$[]'](1))) { + + return text.$join($$($nesting, 'LF')); + } else { + return text['$[]'](0) + }; return nil; })()}; + if ($truthy((has_passthroughs = subs['$include?']("macros")))) { + + text = self.$extract_passthroughs(text); + if ($truthy(self.passthroughs['$empty?']())) { + has_passthroughs = false};}; + $send(subs, 'each', [], (TMP_2 = function(type){var self = TMP_2.$$s || this, $case = nil; + + + + if (type == null) { + type = nil; + }; + return (function() {$case = type; + if ("specialcharacters"['$===']($case)) {return (text = self.$sub_specialchars(text))} + else if ("quotes"['$===']($case)) {return (text = self.$sub_quotes(text))} + else if ("attributes"['$===']($case)) {if ($truthy(text['$include?']($$($nesting, 'ATTR_REF_HEAD')))) { + return (text = self.$sub_attributes(text)) + } else { + return nil + }} + else if ("replacements"['$===']($case)) {return (text = self.$sub_replacements(text))} + else if ("macros"['$===']($case)) {return (text = self.$sub_macros(text))} + else if ("highlight"['$===']($case)) {return (text = self.$highlight_source(text, subs['$include?']("callouts")))} + else if ("callouts"['$===']($case)) {if ($truthy(subs['$include?']("highlight"))) { + return nil + } else { + return (text = self.$sub_callouts(text)) + }} + else if ("post_replacements"['$===']($case)) {return (text = self.$sub_post_replacements(text))} + else {return self.$logger().$warn("" + "unknown substitution type " + (type))}})();}, TMP_2.$$s = self, TMP_2.$$arity = 1, TMP_2)); + if ($truthy(has_passthroughs)) { + text = self.$restore_passthroughs(text)}; + if ($truthy(multiline)) { + + return text.$split($$($nesting, 'LF'), -1); + } else { + return text + }; + }, TMP_Substitutors_apply_subs_1.$$arity = -2); + + Opal.def(self, '$apply_normal_subs', TMP_Substitutors_apply_normal_subs_3 = function $$apply_normal_subs(text) { + var self = this; + + return self.$apply_subs(text) + }, TMP_Substitutors_apply_normal_subs_3.$$arity = 1); + + Opal.def(self, '$apply_title_subs', TMP_Substitutors_apply_title_subs_4 = function $$apply_title_subs(title) { + var self = this; + + return self.$apply_subs(title, $$($nesting, 'TITLE_SUBS')) + }, TMP_Substitutors_apply_title_subs_4.$$arity = 1); + + Opal.def(self, '$apply_reftext_subs', TMP_Substitutors_apply_reftext_subs_5 = function $$apply_reftext_subs(text) { + var self = this; + + return self.$apply_subs(text, $$($nesting, 'REFTEXT_SUBS')) + }, TMP_Substitutors_apply_reftext_subs_5.$$arity = 1); + + Opal.def(self, '$apply_header_subs', TMP_Substitutors_apply_header_subs_6 = function $$apply_header_subs(text) { + var self = this; + + return self.$apply_subs(text, $$($nesting, 'HEADER_SUBS')) + }, TMP_Substitutors_apply_header_subs_6.$$arity = 1); + + Opal.def(self, '$extract_passthroughs', TMP_Substitutors_extract_passthroughs_7 = function $$extract_passthroughs(text) { + var $a, $b, TMP_8, TMP_9, TMP_10, self = this, compat_mode = nil, passes = nil, pass_inline_char1 = nil, pass_inline_char2 = nil, pass_inline_rx = nil; + if (self.document == null) self.document = nil; + if (self.passthroughs == null) self.passthroughs = nil; + + + compat_mode = self.document.$compat_mode(); + passes = self.passthroughs; + if ($truthy(($truthy($a = ($truthy($b = text['$include?']("++")) ? $b : text['$include?']("$$"))) ? $a : text['$include?']("ss:")))) { + text = $send(text, 'gsub', [$$($nesting, 'InlinePassMacroRx')], (TMP_8 = function(){var self = TMP_8.$$s || this, $c, m = nil, preceding = nil, boundary = nil, attributes = nil, escape_count = nil, content = nil, old_behavior = nil, subs = nil, pass_key = nil, $writer = nil; + if ($gvars["~"] == null) $gvars["~"] = nil; + + + m = $gvars["~"]; + preceding = nil; + if ($truthy((boundary = m['$[]'](4)))) { + + if ($truthy(($truthy($c = compat_mode) ? boundary['$==']("++") : $c))) { + return (function() {if ($truthy(m['$[]'](2))) { + return "" + (m['$[]'](1)) + "[" + (m['$[]'](2)) + "]" + (m['$[]'](3)) + "++" + (self.$extract_passthroughs(m['$[]'](5))) + "++" + } else { + return "" + (m['$[]'](1)) + (m['$[]'](3)) + "++" + (self.$extract_passthroughs(m['$[]'](5))) + "++" + }; return nil; })();}; + attributes = m['$[]'](2); + escape_count = m['$[]'](3).$length(); + content = m['$[]'](5); + old_behavior = false; + if ($truthy(attributes)) { + if ($truthy($rb_gt(escape_count, 0))) { + return "" + (m['$[]'](1)) + "[" + (attributes) + "]" + ($rb_times($$($nesting, 'RS'), $rb_minus(escape_count, 1))) + (boundary) + (m['$[]'](5)) + (boundary); + } else if (m['$[]'](1)['$==']($$($nesting, 'RS'))) { + + preceding = "" + "[" + (attributes) + "]"; + attributes = nil; + } else { + + if ($truthy((($c = boundary['$==']("++")) ? attributes['$end_with?']("x-") : boundary['$==']("++")))) { + + old_behavior = true; + attributes = attributes.$slice(0, $rb_minus(attributes.$length(), 2));}; + attributes = self.$parse_quoted_text_attributes(attributes); + } + } else if ($truthy($rb_gt(escape_count, 0))) { + return "" + ($rb_times($$($nesting, 'RS'), $rb_minus(escape_count, 1))) + (boundary) + (m['$[]'](5)) + (boundary);}; + subs = (function() {if (boundary['$==']("+++")) { + return [] + } else { + return $$($nesting, 'BASIC_SUBS') + }; return nil; })(); + pass_key = passes.$size(); + if ($truthy(attributes)) { + if ($truthy(old_behavior)) { + + $writer = [pass_key, $hash2(["text", "subs", "type", "attributes"], {"text": content, "subs": $$($nesting, 'NORMAL_SUBS'), "type": "monospaced", "attributes": attributes})]; + $send(passes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + } else { + + $writer = [pass_key, $hash2(["text", "subs", "type", "attributes"], {"text": content, "subs": subs, "type": "unquoted", "attributes": attributes})]; + $send(passes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + } + } else { + + $writer = [pass_key, $hash2(["text", "subs"], {"text": content, "subs": subs})]; + $send(passes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + } else { + + if (m['$[]'](6)['$==']($$($nesting, 'RS'))) { + return m['$[]'](0).$slice(1, m['$[]'](0).$length());}; + + $writer = [(pass_key = passes.$size()), $hash2(["text", "subs"], {"text": self.$unescape_brackets(m['$[]'](8)), "subs": (function() {if ($truthy(m['$[]'](7))) { + + return self.$resolve_pass_subs(m['$[]'](7)); + } else { + return nil + }; return nil; })()})]; + $send(passes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + }; + return "" + (preceding) + ($$($nesting, 'PASS_START')) + (pass_key) + ($$($nesting, 'PASS_END'));}, TMP_8.$$s = self, TMP_8.$$arity = 0, TMP_8))}; + $b = $$($nesting, 'InlinePassRx')['$[]'](compat_mode), $a = Opal.to_ary($b), (pass_inline_char1 = ($a[0] == null ? nil : $a[0])), (pass_inline_char2 = ($a[1] == null ? nil : $a[1])), (pass_inline_rx = ($a[2] == null ? nil : $a[2])), $b; + if ($truthy(($truthy($a = text['$include?'](pass_inline_char1)) ? $a : ($truthy($b = pass_inline_char2) ? text['$include?'](pass_inline_char2) : $b)))) { + text = $send(text, 'gsub', [pass_inline_rx], (TMP_9 = function(){var self = TMP_9.$$s || this, $c, m = nil, preceding = nil, attributes = nil, quoted_text = nil, escape_mark = nil, format_mark = nil, content = nil, old_behavior = nil, pass_key = nil, $writer = nil, subs = nil; + if ($gvars["~"] == null) $gvars["~"] = nil; + + + m = $gvars["~"]; + preceding = m['$[]'](1); + attributes = m['$[]'](2); + if ($truthy((quoted_text = m['$[]'](3))['$start_with?']($$($nesting, 'RS')))) { + escape_mark = $$($nesting, 'RS')}; + format_mark = m['$[]'](4); + content = m['$[]'](5); + if ($truthy(compat_mode)) { + old_behavior = true + } else if ($truthy((old_behavior = ($truthy($c = attributes) ? attributes['$end_with?']("x-") : $c)))) { + attributes = attributes.$slice(0, $rb_minus(attributes.$length(), 2))}; + if ($truthy(attributes)) { + + if ($truthy((($c = format_mark['$==']("`")) ? old_behavior['$!']() : format_mark['$==']("`")))) { + return self.$extract_inner_passthrough(content, "" + (preceding) + "[" + (attributes) + "]" + (escape_mark), attributes);}; + if ($truthy(escape_mark)) { + return "" + (preceding) + "[" + (attributes) + "]" + (quoted_text.$slice(1, quoted_text.$length())); + } else if (preceding['$==']($$($nesting, 'RS'))) { + + preceding = "" + "[" + (attributes) + "]"; + attributes = nil; + } else { + attributes = self.$parse_quoted_text_attributes(attributes) + }; + } else if ($truthy((($c = format_mark['$==']("`")) ? old_behavior['$!']() : format_mark['$==']("`")))) { + return self.$extract_inner_passthrough(content, "" + (preceding) + (escape_mark)); + } else if ($truthy(escape_mark)) { + return "" + (preceding) + (quoted_text.$slice(1, quoted_text.$length()));}; + pass_key = passes.$size(); + if ($truthy(compat_mode)) { + + $writer = [pass_key, $hash2(["text", "subs", "attributes", "type"], {"text": content, "subs": $$($nesting, 'BASIC_SUBS'), "attributes": attributes, "type": "monospaced"})]; + $send(passes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + } else if ($truthy(attributes)) { + if ($truthy(old_behavior)) { + + subs = (function() {if (format_mark['$==']("`")) { + return $$($nesting, 'BASIC_SUBS') + } else { + return $$($nesting, 'NORMAL_SUBS') + }; return nil; })(); + + $writer = [pass_key, $hash2(["text", "subs", "attributes", "type"], {"text": content, "subs": subs, "attributes": attributes, "type": "monospaced"})]; + $send(passes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + } else { + + $writer = [pass_key, $hash2(["text", "subs", "attributes", "type"], {"text": content, "subs": $$($nesting, 'BASIC_SUBS'), "attributes": attributes, "type": "unquoted"})]; + $send(passes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + } + } else { + + $writer = [pass_key, $hash2(["text", "subs"], {"text": content, "subs": $$($nesting, 'BASIC_SUBS')})]; + $send(passes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + return "" + (preceding) + ($$($nesting, 'PASS_START')) + (pass_key) + ($$($nesting, 'PASS_END'));}, TMP_9.$$s = self, TMP_9.$$arity = 0, TMP_9))}; + if ($truthy(($truthy($a = text['$include?'](":")) ? ($truthy($b = text['$include?']("stem:")) ? $b : text['$include?']("math:")) : $a))) { + text = $send(text, 'gsub', [$$($nesting, 'InlineStemMacroRx')], (TMP_10 = function(){var self = TMP_10.$$s || this, $c, m = nil, type = nil, content = nil, subs = nil, $writer = nil, pass_key = nil; + if (self.document == null) self.document = nil; + if ($gvars["~"] == null) $gvars["~"] = nil; + + + m = $gvars["~"]; + if ($truthy((($c = $gvars['~']) === nil ? nil : $c['$[]'](0))['$start_with?']($$($nesting, 'RS')))) { + return m['$[]'](0).$slice(1, m['$[]'](0).$length());}; + if ((type = m['$[]'](1).$to_sym())['$==']("stem")) { + type = $$($nesting, 'STEM_TYPE_ALIASES')['$[]'](self.document.$attributes()['$[]']("stem")).$to_sym()}; + content = self.$unescape_brackets(m['$[]'](3)); + subs = (function() {if ($truthy(m['$[]'](2))) { + + return self.$resolve_pass_subs(m['$[]'](2)); + } else { + + if ($truthy(self.document['$basebackend?']("html"))) { + return $$($nesting, 'BASIC_SUBS') + } else { + return nil + }; + }; return nil; })(); + + $writer = [(pass_key = passes.$size()), $hash2(["text", "subs", "type"], {"text": content, "subs": subs, "type": type})]; + $send(passes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + return "" + ($$($nesting, 'PASS_START')) + (pass_key) + ($$($nesting, 'PASS_END'));}, TMP_10.$$s = self, TMP_10.$$arity = 0, TMP_10))}; + return text; + }, TMP_Substitutors_extract_passthroughs_7.$$arity = 1); + + Opal.def(self, '$extract_inner_passthrough', TMP_Substitutors_extract_inner_passthrough_11 = function $$extract_inner_passthrough(text, pre, attributes) { + var $a, $b, self = this, $writer = nil, pass_key = nil; + if (self.passthroughs == null) self.passthroughs = nil; + + + + if (attributes == null) { + attributes = nil; + }; + if ($truthy(($truthy($a = ($truthy($b = text['$end_with?']("+")) ? text['$start_with?']("+", "\\+") : $b)) ? $$($nesting, 'SinglePlusInlinePassRx')['$=~'](text) : $a))) { + if ($truthy((($a = $gvars['~']) === nil ? nil : $a['$[]'](1)))) { + return "" + (pre) + "`+" + ((($a = $gvars['~']) === nil ? nil : $a['$[]'](2))) + "+`" + } else { + + + $writer = [(pass_key = self.passthroughs.$size()), (function() {if ($truthy(attributes)) { + return $hash2(["text", "subs", "attributes", "type"], {"text": (($a = $gvars['~']) === nil ? nil : $a['$[]'](2)), "subs": $$($nesting, 'BASIC_SUBS'), "attributes": attributes, "type": "unquoted"}) + } else { + return $hash2(["text", "subs"], {"text": (($a = $gvars['~']) === nil ? nil : $a['$[]'](2)), "subs": $$($nesting, 'BASIC_SUBS')}) + }; return nil; })()]; + $send(self.passthroughs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + return "" + (pre) + "`" + ($$($nesting, 'PASS_START')) + (pass_key) + ($$($nesting, 'PASS_END')) + "`"; + } + } else { + return "" + (pre) + "`" + (text) + "`" + }; + }, TMP_Substitutors_extract_inner_passthrough_11.$$arity = -3); + + Opal.def(self, '$restore_passthroughs', TMP_Substitutors_restore_passthroughs_12 = function $$restore_passthroughs(text, outer) { + var TMP_13, self = this, passes = nil; + if (self.passthroughs == null) self.passthroughs = nil; + + + + if (outer == null) { + outer = true; + }; + return (function() { try { + + passes = self.passthroughs; + return $send(text, 'gsub', [$$($nesting, 'PassSlotRx')], (TMP_13 = function(){var self = TMP_13.$$s || this, $a, pass = nil, subbed_text = nil, type = nil; + + + pass = passes['$[]']((($a = $gvars['~']) === nil ? nil : $a['$[]'](1)).$to_i()); + subbed_text = self.$apply_subs(pass['$[]']("text"), pass['$[]']("subs")); + if ($truthy((type = pass['$[]']("type")))) { + subbed_text = $$($nesting, 'Inline').$new(self, "quoted", subbed_text, $hash2(["type", "attributes"], {"type": type, "attributes": pass['$[]']("attributes")})).$convert()}; + if ($truthy(subbed_text['$include?']($$($nesting, 'PASS_START')))) { + return self.$restore_passthroughs(subbed_text, false) + } else { + return subbed_text + };}, TMP_13.$$s = self, TMP_13.$$arity = 0, TMP_13)); + } finally { + (function() {if ($truthy(outer)) { + return passes.$clear() + } else { + return nil + }; return nil; })() + }; })(); + }, TMP_Substitutors_restore_passthroughs_12.$$arity = -2); + if ($$($nesting, 'RUBY_ENGINE')['$==']("opal")) { + + + Opal.def(self, '$sub_quotes', TMP_Substitutors_sub_quotes_14 = function $$sub_quotes(text) { + var TMP_15, self = this, compat = nil; + if (self.document == null) self.document = nil; + + + if ($truthy($$($nesting, 'QuotedTextSniffRx')['$[]']((compat = self.document.$compat_mode()))['$match?'](text))) { + $send($$($nesting, 'QUOTE_SUBS')['$[]'](compat), 'each', [], (TMP_15 = function(type, scope, pattern){var self = TMP_15.$$s || this, TMP_16; + + + + if (type == null) { + type = nil; + }; + + if (scope == null) { + scope = nil; + }; + + if (pattern == null) { + pattern = nil; + }; + return (text = $send(text, 'gsub', [pattern], (TMP_16 = function(){var self = TMP_16.$$s || this; + if ($gvars["~"] == null) $gvars["~"] = nil; + + return self.$convert_quoted_text($gvars["~"], type, scope)}, TMP_16.$$s = self, TMP_16.$$arity = 0, TMP_16)));}, TMP_15.$$s = self, TMP_15.$$arity = 3, TMP_15))}; + return text; + }, TMP_Substitutors_sub_quotes_14.$$arity = 1); + + Opal.def(self, '$sub_replacements', TMP_Substitutors_sub_replacements_17 = function $$sub_replacements(text) { + var TMP_18, self = this; + + + if ($truthy($$($nesting, 'ReplaceableTextRx')['$match?'](text))) { + $send($$($nesting, 'REPLACEMENTS'), 'each', [], (TMP_18 = function(pattern, replacement, restore){var self = TMP_18.$$s || this, TMP_19; + + + + if (pattern == null) { + pattern = nil; + }; + + if (replacement == null) { + replacement = nil; + }; + + if (restore == null) { + restore = nil; + }; + return (text = $send(text, 'gsub', [pattern], (TMP_19 = function(){var self = TMP_19.$$s || this; + if ($gvars["~"] == null) $gvars["~"] = nil; + + return self.$do_replacement($gvars["~"], replacement, restore)}, TMP_19.$$s = self, TMP_19.$$arity = 0, TMP_19)));}, TMP_18.$$s = self, TMP_18.$$arity = 3, TMP_18))}; + return text; + }, TMP_Substitutors_sub_replacements_17.$$arity = 1); + } else { + nil + }; + if ($truthy($$$('::', 'RUBY_MIN_VERSION_1_9'))) { + + Opal.def(self, '$sub_specialchars', TMP_Substitutors_sub_specialchars_20 = function $$sub_specialchars(text) { + var $a, $b, self = this; + + if ($truthy(($truthy($a = ($truthy($b = text['$include?']("<")) ? $b : text['$include?']("&"))) ? $a : text['$include?'](">")))) { + + return text.$gsub($$($nesting, 'SpecialCharsRx'), $$($nesting, 'SpecialCharsTr')); + } else { + return text + } + }, TMP_Substitutors_sub_specialchars_20.$$arity = 1) + } else { + + Opal.def(self, '$sub_specialchars', TMP_Substitutors_sub_specialchars_21 = function $$sub_specialchars(text) { + var $a, $b, TMP_22, self = this; + + if ($truthy(($truthy($a = ($truthy($b = text['$include?']("<")) ? $b : text['$include?']("&"))) ? $a : text['$include?'](">")))) { + + return $send(text, 'gsub', [$$($nesting, 'SpecialCharsRx')], (TMP_22 = function(){var self = TMP_22.$$s || this, $c; + + return $$($nesting, 'SpecialCharsTr')['$[]']((($c = $gvars['~']) === nil ? nil : $c['$[]'](0)))}, TMP_22.$$s = self, TMP_22.$$arity = 0, TMP_22)); + } else { + return text + } + }, TMP_Substitutors_sub_specialchars_21.$$arity = 1) + }; + Opal.alias(self, "sub_specialcharacters", "sub_specialchars"); + + Opal.def(self, '$do_replacement', TMP_Substitutors_do_replacement_23 = function $$do_replacement(m, replacement, restore) { + var self = this, captured = nil, $case = nil; + + if ($truthy((captured = m['$[]'](0))['$include?']($$($nesting, 'RS')))) { + return captured.$sub($$($nesting, 'RS'), "") + } else { + return (function() {$case = restore; + if ("none"['$===']($case)) {return replacement} + else if ("bounding"['$===']($case)) {return "" + (m['$[]'](1)) + (replacement) + (m['$[]'](2))} + else {return "" + (m['$[]'](1)) + (replacement)}})() + } + }, TMP_Substitutors_do_replacement_23.$$arity = 3); + + Opal.def(self, '$sub_attributes', TMP_Substitutors_sub_attributes_24 = function $$sub_attributes(text, opts) { + var TMP_25, TMP_26, TMP_27, TMP_28, self = this, doc_attrs = nil, drop = nil, drop_line = nil, drop_empty_line = nil, attribute_undefined = nil, attribute_missing = nil, lines = nil; + if (self.document == null) self.document = nil; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + doc_attrs = self.document.$attributes(); + drop = (drop_line = (drop_empty_line = (attribute_undefined = (attribute_missing = nil)))); + text = $send(text, 'gsub', [$$($nesting, 'AttributeReferenceRx')], (TMP_25 = function(){var self = TMP_25.$$s || this, $a, $b, $c, $case = nil, args = nil, _ = nil, value = nil, key = nil; + if (self.document == null) self.document = nil; + + if ($truthy(($truthy($a = (($b = $gvars['~']) === nil ? nil : $b['$[]'](1))['$==']($$($nesting, 'RS'))) ? $a : (($b = $gvars['~']) === nil ? nil : $b['$[]'](4))['$==']($$($nesting, 'RS'))))) { + return "" + "{" + ((($a = $gvars['~']) === nil ? nil : $a['$[]'](2))) + "}" + } else if ($truthy((($a = $gvars['~']) === nil ? nil : $a['$[]'](3)))) { + return (function() {$case = (args = (($a = $gvars['~']) === nil ? nil : $a['$[]'](2)).$split(":", 3)).$shift(); + if ("set"['$===']($case)) { + $b = $$($nesting, 'Parser').$store_attribute(args['$[]'](0), ($truthy($c = args['$[]'](1)) ? $c : ""), self.document), $a = Opal.to_ary($b), (_ = ($a[0] == null ? nil : $a[0])), (value = ($a[1] == null ? nil : $a[1])), $b; + if ($truthy(($truthy($a = value) ? $a : (attribute_undefined = ($truthy($b = attribute_undefined) ? $b : ($truthy($c = doc_attrs['$[]']("attribute-undefined")) ? $c : $$($nesting, 'Compliance').$attribute_undefined())))['$!=']("drop-line")))) { + return (drop = (drop_empty_line = $$($nesting, 'DEL'))) + } else { + return (drop = (drop_line = $$($nesting, 'CAN'))) + };} + else if ("counter2"['$===']($case)) { + $send(self.document, 'counter', Opal.to_a(args)); + return (drop = (drop_empty_line = $$($nesting, 'DEL')));} + else {return $send(self.document, 'counter', Opal.to_a(args))}})() + } else if ($truthy(doc_attrs['$key?']((key = (($a = $gvars['~']) === nil ? nil : $a['$[]'](2)).$downcase())))) { + return doc_attrs['$[]'](key) + } else if ($truthy((value = $$($nesting, 'INTRINSIC_ATTRIBUTES')['$[]'](key)))) { + return value + } else { + return (function() {$case = (attribute_missing = ($truthy($a = attribute_missing) ? $a : ($truthy($b = ($truthy($c = opts['$[]']("attribute_missing")) ? $c : doc_attrs['$[]']("attribute-missing"))) ? $b : $$($nesting, 'Compliance').$attribute_missing()))); + if ("drop"['$===']($case)) {return (drop = (drop_empty_line = $$($nesting, 'DEL')))} + else if ("drop-line"['$===']($case)) { + self.$logger().$warn("" + "dropping line containing reference to missing attribute: " + (key)); + return (drop = (drop_line = $$($nesting, 'CAN')));} + else if ("warn"['$===']($case)) { + self.$logger().$warn("" + "skipping reference to missing attribute: " + (key)); + return (($a = $gvars['~']) === nil ? nil : $a['$[]'](0));} + else {return (($a = $gvars['~']) === nil ? nil : $a['$[]'](0))}})() + }}, TMP_25.$$s = self, TMP_25.$$arity = 0, TMP_25)); + if ($truthy(drop)) { + if ($truthy(drop_empty_line)) { + + lines = text.$tr_s($$($nesting, 'DEL'), $$($nesting, 'DEL')).$split($$($nesting, 'LF'), -1); + if ($truthy(drop_line)) { + return $send(lines, 'reject', [], (TMP_26 = function(line){var self = TMP_26.$$s || this, $a, $b, $c; + + + + if (line == null) { + line = nil; + }; + return ($truthy($a = ($truthy($b = ($truthy($c = line['$==']($$($nesting, 'DEL'))) ? $c : line['$==']($$($nesting, 'CAN')))) ? $b : line['$start_with?']($$($nesting, 'CAN')))) ? $a : line['$include?']($$($nesting, 'CAN')));}, TMP_26.$$s = self, TMP_26.$$arity = 1, TMP_26)).$join($$($nesting, 'LF')).$delete($$($nesting, 'DEL')) + } else { + return $send(lines, 'reject', [], (TMP_27 = function(line){var self = TMP_27.$$s || this; + + + + if (line == null) { + line = nil; + }; + return line['$==']($$($nesting, 'DEL'));}, TMP_27.$$s = self, TMP_27.$$arity = 1, TMP_27)).$join($$($nesting, 'LF')).$delete($$($nesting, 'DEL')) + }; + } else if ($truthy(text['$include?']($$($nesting, 'LF')))) { + return $send(text.$split($$($nesting, 'LF'), -1), 'reject', [], (TMP_28 = function(line){var self = TMP_28.$$s || this, $a, $b; + + + + if (line == null) { + line = nil; + }; + return ($truthy($a = ($truthy($b = line['$==']($$($nesting, 'CAN'))) ? $b : line['$start_with?']($$($nesting, 'CAN')))) ? $a : line['$include?']($$($nesting, 'CAN')));}, TMP_28.$$s = self, TMP_28.$$arity = 1, TMP_28)).$join($$($nesting, 'LF')) + } else { + return "" + } + } else { + return text + }; + }, TMP_Substitutors_sub_attributes_24.$$arity = -2); + + Opal.def(self, '$sub_macros', TMP_Substitutors_sub_macros_29 = function $$sub_macros(text) {try { + + var $a, $b, TMP_30, TMP_33, TMP_35, TMP_37, TMP_39, TMP_40, TMP_41, TMP_42, TMP_43, TMP_44, self = this, found = nil, found_square_bracket = nil, $writer = nil, found_colon = nil, found_macroish = nil, found_macroish_short = nil, doc_attrs = nil, doc = nil, extensions = nil; + if (self.document == null) self.document = nil; + + + found = $hash2([], {}); + found_square_bracket = (($writer = ["square_bracket", text['$include?']("[")]), $send(found, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]); + found_colon = text['$include?'](":"); + found_macroish = (($writer = ["macroish", ($truthy($a = found_square_bracket) ? found_colon : $a)]), $send(found, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]); + found_macroish_short = ($truthy($a = found_macroish) ? text['$include?'](":[") : $a); + doc_attrs = (doc = self.document).$attributes(); + if ($truthy(doc_attrs['$key?']("experimental"))) { + + if ($truthy(($truthy($a = found_macroish_short) ? ($truthy($b = text['$include?']("kbd:")) ? $b : text['$include?']("btn:")) : $a))) { + text = $send(text, 'gsub', [$$($nesting, 'InlineKbdBtnMacroRx')], (TMP_30 = function(){var self = TMP_30.$$s || this, $c, TMP_31, TMP_32, keys = nil, delim_idx = nil, delim = nil; + + if ($truthy((($c = $gvars['~']) === nil ? nil : $c['$[]'](1)))) { + return (($c = $gvars['~']) === nil ? nil : $c['$[]'](0)).$slice(1, (($c = $gvars['~']) === nil ? nil : $c['$[]'](0)).$length()) + } else if ((($c = $gvars['~']) === nil ? nil : $c['$[]'](2))['$==']("kbd")) { + + if ($truthy((keys = (($c = $gvars['~']) === nil ? nil : $c['$[]'](3)).$strip())['$include?']($$($nesting, 'R_SB')))) { + keys = keys.$gsub($$($nesting, 'ESC_R_SB'), $$($nesting, 'R_SB'))}; + if ($truthy(($truthy($c = $rb_gt(keys.$length(), 1)) ? (delim_idx = (function() {if ($truthy((delim_idx = keys.$index(",", 1)))) { + return [delim_idx, keys.$index("+", 1)].$compact().$min() + } else { + + return keys.$index("+", 1); + }; return nil; })()) : $c))) { + + delim = keys.$slice(delim_idx, 1); + if ($truthy(keys['$end_with?'](delim))) { + + keys = $send(keys.$chop().$split(delim, -1), 'map', [], (TMP_31 = function(key){var self = TMP_31.$$s || this; + + + + if (key == null) { + key = nil; + }; + return key.$strip();}, TMP_31.$$s = self, TMP_31.$$arity = 1, TMP_31)); + + $writer = [-1, "" + (keys['$[]'](-1)) + (delim)]; + $send(keys, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + } else { + keys = $send(keys.$split(delim), 'map', [], (TMP_32 = function(key){var self = TMP_32.$$s || this; + + + + if (key == null) { + key = nil; + }; + return key.$strip();}, TMP_32.$$s = self, TMP_32.$$arity = 1, TMP_32)) + }; + } else { + keys = [keys] + }; + return $$($nesting, 'Inline').$new(self, "kbd", nil, $hash2(["attributes"], {"attributes": $hash2(["keys"], {"keys": keys})})).$convert(); + } else { + return $$($nesting, 'Inline').$new(self, "button", self.$unescape_bracketed_text((($c = $gvars['~']) === nil ? nil : $c['$[]'](3)))).$convert() + }}, TMP_30.$$s = self, TMP_30.$$arity = 0, TMP_30))}; + if ($truthy(($truthy($a = found_macroish) ? text['$include?']("menu:") : $a))) { + text = $send(text, 'gsub', [$$($nesting, 'InlineMenuMacroRx')], (TMP_33 = function(){var self = TMP_33.$$s || this, $c, TMP_34, m = nil, menu = nil, items = nil, delim = nil, submenus = nil, menuitem = nil; + if ($gvars["~"] == null) $gvars["~"] = nil; + + + m = $gvars["~"]; + if ($truthy((($c = $gvars['~']) === nil ? nil : $c['$[]'](0))['$start_with?']($$($nesting, 'RS')))) { + return m['$[]'](0).$slice(1, m['$[]'](0).$length());}; + $c = [m['$[]'](1), m['$[]'](2)], (menu = $c[0]), (items = $c[1]), $c; + if ($truthy(items)) { + + if ($truthy(items['$include?']($$($nesting, 'R_SB')))) { + items = items.$gsub($$($nesting, 'ESC_R_SB'), $$($nesting, 'R_SB'))}; + if ($truthy((delim = (function() {if ($truthy(items['$include?'](">"))) { + return ">" + } else { + + if ($truthy(items['$include?'](","))) { + return "," + } else { + return nil + }; + }; return nil; })()))) { + + submenus = $send(items.$split(delim), 'map', [], (TMP_34 = function(it){var self = TMP_34.$$s || this; + + + + if (it == null) { + it = nil; + }; + return it.$strip();}, TMP_34.$$s = self, TMP_34.$$arity = 1, TMP_34)); + menuitem = submenus.$pop(); + } else { + $c = [[], items.$rstrip()], (submenus = $c[0]), (menuitem = $c[1]), $c + }; + } else { + $c = [[], nil], (submenus = $c[0]), (menuitem = $c[1]), $c + }; + return $$($nesting, 'Inline').$new(self, "menu", nil, $hash2(["attributes"], {"attributes": $hash2(["menu", "submenus", "menuitem"], {"menu": menu, "submenus": submenus, "menuitem": menuitem})})).$convert();}, TMP_33.$$s = self, TMP_33.$$arity = 0, TMP_33))}; + if ($truthy(($truthy($a = text['$include?']("\"")) ? text['$include?'](">") : $a))) { + text = $send(text, 'gsub', [$$($nesting, 'InlineMenuRx')], (TMP_35 = function(){var self = TMP_35.$$s || this, $c, $d, TMP_36, m = nil, input = nil, menu = nil, submenus = nil, menuitem = nil; + if ($gvars["~"] == null) $gvars["~"] = nil; + + + m = $gvars["~"]; + if ($truthy((($c = $gvars['~']) === nil ? nil : $c['$[]'](0))['$start_with?']($$($nesting, 'RS')))) { + return m['$[]'](0).$slice(1, m['$[]'](0).$length());}; + input = m['$[]'](1); + $d = $send(input.$split(">"), 'map', [], (TMP_36 = function(it){var self = TMP_36.$$s || this; + + + + if (it == null) { + it = nil; + }; + return it.$strip();}, TMP_36.$$s = self, TMP_36.$$arity = 1, TMP_36)), $c = Opal.to_ary($d), (menu = ($c[0] == null ? nil : $c[0])), (submenus = $slice.call($c, 1)), $d; + menuitem = submenus.$pop(); + return $$($nesting, 'Inline').$new(self, "menu", nil, $hash2(["attributes"], {"attributes": $hash2(["menu", "submenus", "menuitem"], {"menu": menu, "submenus": submenus, "menuitem": menuitem})})).$convert();}, TMP_35.$$s = self, TMP_35.$$arity = 0, TMP_35))};}; + if ($truthy(($truthy($a = (extensions = doc.$extensions())) ? extensions['$inline_macros?']() : $a))) { + $send(extensions.$inline_macros(), 'each', [], (TMP_37 = function(extension){var self = TMP_37.$$s || this, TMP_38; + + + + if (extension == null) { + extension = nil; + }; + return (text = $send(text, 'gsub', [extension.$instance().$regexp()], (TMP_38 = function(){var self = TMP_38.$$s || this, $c, m = nil, target = nil, content = nil, extconf = nil, attributes = nil, replacement = nil; + if ($gvars["~"] == null) $gvars["~"] = nil; + + + m = $gvars["~"]; + if ($truthy((($c = $gvars['~']) === nil ? nil : $c['$[]'](0))['$start_with?']($$($nesting, 'RS')))) { + return m['$[]'](0).$slice(1, m['$[]'](0).$length());}; + if ($truthy((function() { try { + return m.$names() + } catch ($err) { + if (Opal.rescue($err, [$$($nesting, 'StandardError')])) { + try { + return [] + } finally { Opal.pop_exception() } + } else { throw $err; } + }})()['$empty?']())) { + $c = [m['$[]'](1), m['$[]'](2), extension.$config()], (target = $c[0]), (content = $c[1]), (extconf = $c[2]), $c + } else { + $c = [(function() { try { + return m['$[]']("target") + } catch ($err) { + if (Opal.rescue($err, [$$($nesting, 'StandardError')])) { + try { + return nil + } finally { Opal.pop_exception() } + } else { throw $err; } + }})(), (function() { try { + return m['$[]']("content") + } catch ($err) { + if (Opal.rescue($err, [$$($nesting, 'StandardError')])) { + try { + return nil + } finally { Opal.pop_exception() } + } else { throw $err; } + }})(), extension.$config()], (target = $c[0]), (content = $c[1]), (extconf = $c[2]), $c + }; + attributes = (function() {if ($truthy((attributes = extconf['$[]']("default_attrs")))) { + return attributes.$dup() + } else { + return $hash2([], {}) + }; return nil; })(); + if ($truthy(content['$nil_or_empty?']())) { + if ($truthy(($truthy($c = content) ? extconf['$[]']("content_model")['$!=']("attributes") : $c))) { + + $writer = ["text", content]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];} + } else { + + content = self.$unescape_bracketed_text(content); + if (extconf['$[]']("content_model")['$==']("attributes")) { + self.$parse_attributes(content, ($truthy($c = extconf['$[]']("pos_attrs")) ? $c : []), $hash2(["into"], {"into": attributes})) + } else { + + $writer = ["text", content]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + }; + replacement = extension.$process_method()['$[]'](self, ($truthy($c = target) ? $c : content), attributes); + if ($truthy($$($nesting, 'Inline')['$==='](replacement))) { + return replacement.$convert() + } else { + return replacement + };}, TMP_38.$$s = self, TMP_38.$$arity = 0, TMP_38)));}, TMP_37.$$s = self, TMP_37.$$arity = 1, TMP_37))}; + if ($truthy(($truthy($a = found_macroish) ? ($truthy($b = text['$include?']("image:")) ? $b : text['$include?']("icon:")) : $a))) { + text = $send(text, 'gsub', [$$($nesting, 'InlineImageMacroRx')], (TMP_39 = function(){var self = TMP_39.$$s || this, $c, m = nil, captured = nil, type = nil, posattrs = nil, target = nil, attrs = nil; + if ($gvars["~"] == null) $gvars["~"] = nil; + + + m = $gvars["~"]; + if ($truthy((captured = (($c = $gvars['~']) === nil ? nil : $c['$[]'](0)))['$start_with?']($$($nesting, 'RS')))) { + return captured.$slice(1, captured.$length()); + } else if ($truthy(captured['$start_with?']("icon:"))) { + $c = ["icon", ["size"]], (type = $c[0]), (posattrs = $c[1]), $c + } else { + $c = ["image", ["alt", "width", "height"]], (type = $c[0]), (posattrs = $c[1]), $c + }; + if ($truthy((target = m['$[]'](1))['$include?']($$($nesting, 'ATTR_REF_HEAD')))) { + target = self.$sub_attributes(target)}; + attrs = self.$parse_attributes(m['$[]'](2), posattrs, $hash2(["unescape_input"], {"unescape_input": true})); + if (type['$==']("icon")) { + } else { + doc.$register("images", [target, (($writer = ["imagesdir", doc_attrs['$[]']("imagesdir")]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])]) + }; + ($truthy($c = attrs['$[]']("alt")) ? $c : (($writer = ["alt", (($writer = ["default-alt", $$($nesting, 'Helpers').$basename(target, true).$tr("_-", " ")]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + return $$($nesting, 'Inline').$new(self, "image", nil, $hash2(["type", "target", "attributes"], {"type": type, "target": target, "attributes": attrs})).$convert();}, TMP_39.$$s = self, TMP_39.$$arity = 0, TMP_39))}; + if ($truthy(($truthy($a = ($truthy($b = text['$include?']("((")) ? text['$include?']("))") : $b)) ? $a : ($truthy($b = found_macroish_short) ? text['$include?']("dexterm") : $b)))) { + text = $send(text, 'gsub', [$$($nesting, 'InlineIndextermMacroRx')], (TMP_40 = function(){var self = TMP_40.$$s || this, $c, captured = nil, $case = nil, terms = nil, term = nil, visible = nil, before = nil, after = nil, subbed_term = nil; + + + captured = (($c = $gvars['~']) === nil ? nil : $c['$[]'](0)); + return (function() {$case = (($c = $gvars['~']) === nil ? nil : $c['$[]'](1)); + if ("indexterm"['$===']($case)) { + text = (($c = $gvars['~']) === nil ? nil : $c['$[]'](2)); + if ($truthy(captured['$start_with?']($$($nesting, 'RS')))) { + return captured.$slice(1, captured.$length());}; + terms = self.$split_simple_csv(self.$normalize_string(text, true)); + doc.$register("indexterms", terms); + return $$($nesting, 'Inline').$new(self, "indexterm", nil, $hash2(["attributes"], {"attributes": $hash2(["terms"], {"terms": terms})})).$convert();} + else if ("indexterm2"['$===']($case)) { + text = (($c = $gvars['~']) === nil ? nil : $c['$[]'](2)); + if ($truthy(captured['$start_with?']($$($nesting, 'RS')))) { + return captured.$slice(1, captured.$length());}; + term = self.$normalize_string(text, true); + doc.$register("indexterms", [term]); + return $$($nesting, 'Inline').$new(self, "indexterm", term, $hash2(["type"], {"type": "visible"})).$convert();} + else { + text = (($c = $gvars['~']) === nil ? nil : $c['$[]'](3)); + if ($truthy(captured['$start_with?']($$($nesting, 'RS')))) { + if ($truthy(($truthy($c = text['$start_with?']("(")) ? text['$end_with?'](")") : $c))) { + + text = text.$slice(1, $rb_minus(text.$length(), 2)); + $c = [true, "(", ")"], (visible = $c[0]), (before = $c[1]), (after = $c[2]), $c; + } else { + return captured.$slice(1, captured.$length()); + } + } else { + + visible = true; + if ($truthy(text['$start_with?']("("))) { + if ($truthy(text['$end_with?'](")"))) { + $c = [text.$slice(1, $rb_minus(text.$length(), 2)), false], (text = $c[0]), (visible = $c[1]), $c + } else { + $c = [text.$slice(1, text.$length()), "(", ""], (text = $c[0]), (before = $c[1]), (after = $c[2]), $c + } + } else if ($truthy(text['$end_with?'](")"))) { + $c = [text.$slice(0, $rb_minus(text.$length(), 1)), "", ")"], (text = $c[0]), (before = $c[1]), (after = $c[2]), $c}; + }; + if ($truthy(visible)) { + + term = self.$normalize_string(text); + doc.$register("indexterms", [term]); + subbed_term = $$($nesting, 'Inline').$new(self, "indexterm", term, $hash2(["type"], {"type": "visible"})).$convert(); + } else { + + terms = self.$split_simple_csv(self.$normalize_string(text)); + doc.$register("indexterms", terms); + subbed_term = $$($nesting, 'Inline').$new(self, "indexterm", nil, $hash2(["attributes"], {"attributes": $hash2(["terms"], {"terms": terms})})).$convert(); + }; + if ($truthy(before)) { + return "" + (before) + (subbed_term) + (after) + } else { + return subbed_term + };}})();}, TMP_40.$$s = self, TMP_40.$$arity = 0, TMP_40))}; + if ($truthy(($truthy($a = found_colon) ? text['$include?']("://") : $a))) { + text = $send(text, 'gsub', [$$($nesting, 'InlineLinkRx')], (TMP_41 = function(){var self = TMP_41.$$s || this, $c, $d, m = nil, target = nil, macro = nil, prefix = nil, suffix = nil, $case = nil, attrs = nil, link_opts = nil; + if ($gvars["~"] == null) $gvars["~"] = nil; + + + m = $gvars["~"]; + if ($truthy((target = (($c = $gvars['~']) === nil ? nil : $c['$[]'](2)))['$start_with?']($$($nesting, 'RS')))) { + return "" + (m['$[]'](1)) + (target.$slice(1, target.$length())) + (m['$[]'](3));}; + $c = [m['$[]'](1), ($truthy($d = (macro = m['$[]'](3))) ? $d : ""), ""], (prefix = $c[0]), (text = $c[1]), (suffix = $c[2]), $c; + if (prefix['$==']("link:")) { + if ($truthy(macro)) { + prefix = "" + } else { + return m['$[]'](0); + }}; + if ($truthy(($truthy($c = macro) ? $c : $$($nesting, 'UriTerminatorRx')['$!~'](target)))) { + } else { + + $case = (($c = $gvars['~']) === nil ? nil : $c['$[]'](0)); + if (")"['$===']($case)) { + target = target.$chop(); + suffix = ")";} + else if (";"['$===']($case)) {if ($truthy(($truthy($c = prefix['$start_with?']("<")) ? target['$end_with?'](">") : $c))) { + + prefix = prefix.$slice(4, prefix.$length()); + target = target.$slice(0, $rb_minus(target.$length(), 4)); + } else if ($truthy((target = target.$chop())['$end_with?'](")"))) { + + target = target.$chop(); + suffix = ");"; + } else { + suffix = ";" + }} + else if (":"['$===']($case)) {if ($truthy((target = target.$chop())['$end_with?'](")"))) { + + target = target.$chop(); + suffix = "):"; + } else { + suffix = ":" + }}; + if ($truthy(target['$end_with?']("://"))) { + Opal.ret(m['$[]'](0))}; + }; + $c = [nil, $hash2(["type"], {"type": "link"})], (attrs = $c[0]), (link_opts = $c[1]), $c; + if ($truthy(text['$empty?']())) { + } else { + + if ($truthy(text['$include?']($$($nesting, 'R_SB')))) { + text = text.$gsub($$($nesting, 'ESC_R_SB'), $$($nesting, 'R_SB'))}; + if ($truthy(($truthy($c = doc.$compat_mode()['$!']()) ? text['$include?']("=") : $c))) { + + text = ($truthy($c = (attrs = $$($nesting, 'AttributeList').$new(text, self).$parse())['$[]'](1)) ? $c : ""); + if ($truthy(attrs['$key?']("id"))) { + + $writer = ["id", attrs.$delete("id")]; + $send(link_opts, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];};}; + if ($truthy(text['$end_with?']("^"))) { + + text = text.$chop(); + if ($truthy(attrs)) { + ($truthy($c = attrs['$[]']("window")) ? $c : (($writer = ["window", "_blank"]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])) + } else { + attrs = $hash2(["window"], {"window": "_blank"}) + };}; + }; + if ($truthy(text['$empty?']())) { + + text = (function() {if ($truthy(doc_attrs['$key?']("hide-uri-scheme"))) { + + return target.$sub($$($nesting, 'UriSniffRx'), ""); + } else { + return target + }; return nil; })(); + if ($truthy(attrs)) { + + $writer = ["role", (function() {if ($truthy(attrs['$key?']("role"))) { + return "" + "bare " + (attrs['$[]']("role")) + } else { + return "bare" + }; return nil; })()]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + } else { + attrs = $hash2(["role"], {"role": "bare"}) + };}; + doc.$register("links", (($writer = ["target", target]), $send(link_opts, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + if ($truthy(attrs)) { + + $writer = ["attributes", attrs]; + $send(link_opts, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + return "" + (prefix) + ($$($nesting, 'Inline').$new(self, "anchor", text, link_opts).$convert()) + (suffix);}, TMP_41.$$s = self, TMP_41.$$arity = 0, TMP_41))}; + if ($truthy(($truthy($a = found_macroish) ? ($truthy($b = text['$include?']("link:")) ? $b : text['$include?']("mailto:")) : $a))) { + text = $send(text, 'gsub', [$$($nesting, 'InlineLinkMacroRx')], (TMP_42 = function(){var self = TMP_42.$$s || this, $c, m = nil, target = nil, mailto = nil, attrs = nil, link_opts = nil; + if ($gvars["~"] == null) $gvars["~"] = nil; + + + m = $gvars["~"]; + if ($truthy((($c = $gvars['~']) === nil ? nil : $c['$[]'](0))['$start_with?']($$($nesting, 'RS')))) { + return m['$[]'](0).$slice(1, m['$[]'](0).$length());}; + target = (function() {if ($truthy((mailto = m['$[]'](1)))) { + return "" + "mailto:" + (m['$[]'](2)) + } else { + return m['$[]'](2) + }; return nil; })(); + $c = [nil, $hash2(["type"], {"type": "link"})], (attrs = $c[0]), (link_opts = $c[1]), $c; + if ($truthy((text = m['$[]'](3))['$empty?']())) { + } else { + + if ($truthy(text['$include?']($$($nesting, 'R_SB')))) { + text = text.$gsub($$($nesting, 'ESC_R_SB'), $$($nesting, 'R_SB'))}; + if ($truthy(mailto)) { + if ($truthy(($truthy($c = doc.$compat_mode()['$!']()) ? text['$include?'](",") : $c))) { + + text = ($truthy($c = (attrs = $$($nesting, 'AttributeList').$new(text, self).$parse())['$[]'](1)) ? $c : ""); + if ($truthy(attrs['$key?']("id"))) { + + $writer = ["id", attrs.$delete("id")]; + $send(link_opts, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if ($truthy(attrs['$key?'](2))) { + if ($truthy(attrs['$key?'](3))) { + target = "" + (target) + "?subject=" + ($$($nesting, 'Helpers').$uri_encode(attrs['$[]'](2))) + "&body=" + ($$($nesting, 'Helpers').$uri_encode(attrs['$[]'](3))) + } else { + target = "" + (target) + "?subject=" + ($$($nesting, 'Helpers').$uri_encode(attrs['$[]'](2))) + }};} + } else if ($truthy(($truthy($c = doc.$compat_mode()['$!']()) ? text['$include?']("=") : $c))) { + + text = ($truthy($c = (attrs = $$($nesting, 'AttributeList').$new(text, self).$parse())['$[]'](1)) ? $c : ""); + if ($truthy(attrs['$key?']("id"))) { + + $writer = ["id", attrs.$delete("id")]; + $send(link_opts, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];};}; + if ($truthy(text['$end_with?']("^"))) { + + text = text.$chop(); + if ($truthy(attrs)) { + ($truthy($c = attrs['$[]']("window")) ? $c : (($writer = ["window", "_blank"]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])) + } else { + attrs = $hash2(["window"], {"window": "_blank"}) + };}; + }; + if ($truthy(text['$empty?']())) { + if ($truthy(mailto)) { + text = m['$[]'](2) + } else { + + if ($truthy(doc_attrs['$key?']("hide-uri-scheme"))) { + if ($truthy((text = target.$sub($$($nesting, 'UriSniffRx'), ""))['$empty?']())) { + text = target} + } else { + text = target + }; + if ($truthy(attrs)) { + + $writer = ["role", (function() {if ($truthy(attrs['$key?']("role"))) { + return "" + "bare " + (attrs['$[]']("role")) + } else { + return "bare" + }; return nil; })()]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + } else { + attrs = $hash2(["role"], {"role": "bare"}) + }; + }}; + doc.$register("links", (($writer = ["target", target]), $send(link_opts, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + if ($truthy(attrs)) { + + $writer = ["attributes", attrs]; + $send(link_opts, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + return $$($nesting, 'Inline').$new(self, "anchor", text, link_opts).$convert();}, TMP_42.$$s = self, TMP_42.$$arity = 0, TMP_42))}; + if ($truthy(text['$include?']("@"))) { + text = $send(text, 'gsub', [$$($nesting, 'InlineEmailRx')], (TMP_43 = function(){var self = TMP_43.$$s || this, $c, $d, address = nil, tip = nil, target = nil; + + + $c = [(($d = $gvars['~']) === nil ? nil : $d['$[]'](0)), (($d = $gvars['~']) === nil ? nil : $d['$[]'](1))], (address = $c[0]), (tip = $c[1]), $c; + if ($truthy(tip)) { + return (function() {if (tip['$==']($$($nesting, 'RS'))) { + + return address.$slice(1, address.$length()); + } else { + return address + }; return nil; })();}; + target = "" + "mailto:" + (address); + doc.$register("links", target); + return $$($nesting, 'Inline').$new(self, "anchor", address, $hash2(["type", "target"], {"type": "link", "target": target})).$convert();}, TMP_43.$$s = self, TMP_43.$$arity = 0, TMP_43))}; + if ($truthy(($truthy($a = found_macroish) ? text['$include?']("tnote") : $a))) { + text = $send(text, 'gsub', [$$($nesting, 'InlineFootnoteMacroRx')], (TMP_44 = function(){var self = TMP_44.$$s || this, $c, $d, $e, TMP_45, m = nil, id = nil, index = nil, type = nil, target = nil, footnote = nil; + if ($gvars["~"] == null) $gvars["~"] = nil; + + + m = $gvars["~"]; + if ($truthy((($c = $gvars['~']) === nil ? nil : $c['$[]'](0))['$start_with?']($$($nesting, 'RS')))) { + return m['$[]'](0).$slice(1, m['$[]'](0).$length());}; + if ($truthy(m['$[]'](1))) { + $d = ($truthy($e = m['$[]'](3)) ? $e : "").$split(",", 2), $c = Opal.to_ary($d), (id = ($c[0] == null ? nil : $c[0])), (text = ($c[1] == null ? nil : $c[1])), $d + } else { + $c = [m['$[]'](2), m['$[]'](3)], (id = $c[0]), (text = $c[1]), $c + }; + if ($truthy(id)) { + if ($truthy(text)) { + + text = self.$restore_passthroughs(self.$sub_inline_xrefs(self.$sub_inline_anchors(self.$normalize_string(text, true))), false); + index = doc.$counter("footnote-number"); + doc.$register("footnotes", $$$($$($nesting, 'Document'), 'Footnote').$new(index, id, text)); + $c = ["ref", nil], (type = $c[0]), (target = $c[1]), $c; + } else { + + if ($truthy((footnote = $send(doc.$footnotes(), 'find', [], (TMP_45 = function(candidate){var self = TMP_45.$$s || this; + + + + if (candidate == null) { + candidate = nil; + }; + return candidate.$id()['$=='](id);}, TMP_45.$$s = self, TMP_45.$$arity = 1, TMP_45))))) { + $c = [footnote.$index(), footnote.$text()], (index = $c[0]), (text = $c[1]), $c + } else { + + self.$logger().$warn("" + "invalid footnote reference: " + (id)); + $c = [nil, id], (index = $c[0]), (text = $c[1]), $c; + }; + $c = ["xref", id, nil], (type = $c[0]), (target = $c[1]), (id = $c[2]), $c; + } + } else if ($truthy(text)) { + + text = self.$restore_passthroughs(self.$sub_inline_xrefs(self.$sub_inline_anchors(self.$normalize_string(text, true))), false); + index = doc.$counter("footnote-number"); + doc.$register("footnotes", $$$($$($nesting, 'Document'), 'Footnote').$new(index, id, text)); + type = (target = nil); + } else { + return m['$[]'](0); + }; + return $$($nesting, 'Inline').$new(self, "footnote", text, $hash2(["attributes", "id", "target", "type"], {"attributes": $hash2(["index"], {"index": index}), "id": id, "target": target, "type": type})).$convert();}, TMP_44.$$s = self, TMP_44.$$arity = 0, TMP_44))}; + return self.$sub_inline_xrefs(self.$sub_inline_anchors(text, found), found); + } catch ($returner) { if ($returner === Opal.returner) { return $returner.$v } throw $returner; } + }, TMP_Substitutors_sub_macros_29.$$arity = 1); + + Opal.def(self, '$sub_inline_anchors', TMP_Substitutors_sub_inline_anchors_46 = function $$sub_inline_anchors(text, found) { + var $a, TMP_47, $b, $c, TMP_48, self = this; + if (self.context == null) self.context = nil; + if (self.parent == null) self.parent = nil; + + + + if (found == null) { + found = nil; + }; + if ($truthy((($a = self.context['$==']("list_item")) ? self.parent.$style()['$==']("bibliography") : self.context['$==']("list_item")))) { + text = $send(text, 'sub', [$$($nesting, 'InlineBiblioAnchorRx')], (TMP_47 = function(){var self = TMP_47.$$s || this, $b, $c; + + return $$($nesting, 'Inline').$new(self, "anchor", "" + "[" + (($truthy($b = (($c = $gvars['~']) === nil ? nil : $c['$[]'](2))) ? $b : (($c = $gvars['~']) === nil ? nil : $c['$[]'](1)))) + "]", $hash2(["type", "id", "target"], {"type": "bibref", "id": (($b = $gvars['~']) === nil ? nil : $b['$[]'](1)), "target": (($b = $gvars['~']) === nil ? nil : $b['$[]'](1))})).$convert()}, TMP_47.$$s = self, TMP_47.$$arity = 0, TMP_47))}; + if ($truthy(($truthy($a = ($truthy($b = ($truthy($c = found['$!']()) ? $c : found['$[]']("square_bracket"))) ? text['$include?']("[[") : $b)) ? $a : ($truthy($b = ($truthy($c = found['$!']()) ? $c : found['$[]']("macroish"))) ? text['$include?']("or:") : $b)))) { + text = $send(text, 'gsub', [$$($nesting, 'InlineAnchorRx')], (TMP_48 = function(){var self = TMP_48.$$s || this, $d, $e, id = nil, reftext = nil; + + + if ($truthy((($d = $gvars['~']) === nil ? nil : $d['$[]'](1)))) { + return (($d = $gvars['~']) === nil ? nil : $d['$[]'](0)).$slice(1, (($d = $gvars['~']) === nil ? nil : $d['$[]'](0)).$length());}; + if ($truthy((id = (($d = $gvars['~']) === nil ? nil : $d['$[]'](2))))) { + reftext = (($d = $gvars['~']) === nil ? nil : $d['$[]'](3)) + } else { + + id = (($d = $gvars['~']) === nil ? nil : $d['$[]'](4)); + if ($truthy(($truthy($d = (reftext = (($e = $gvars['~']) === nil ? nil : $e['$[]'](5)))) ? reftext['$include?']($$($nesting, 'R_SB')) : $d))) { + reftext = reftext.$gsub($$($nesting, 'ESC_R_SB'), $$($nesting, 'R_SB'))}; + }; + return $$($nesting, 'Inline').$new(self, "anchor", reftext, $hash2(["type", "id", "target"], {"type": "ref", "id": id, "target": id})).$convert();}, TMP_48.$$s = self, TMP_48.$$arity = 0, TMP_48))}; + return text; + }, TMP_Substitutors_sub_inline_anchors_46.$$arity = -2); + + Opal.def(self, '$sub_inline_xrefs', TMP_Substitutors_sub_inline_xrefs_49 = function $$sub_inline_xrefs(content, found) { + var $a, $b, TMP_50, self = this; + + + + if (found == null) { + found = nil; + }; + if ($truthy(($truthy($a = ($truthy($b = (function() {if ($truthy(found)) { + return found['$[]']("macroish") + } else { + + return content['$include?']("["); + }; return nil; })()) ? content['$include?']("xref:") : $b)) ? $a : ($truthy($b = content['$include?']("&")) ? content['$include?']("lt;&") : $b)))) { + content = $send(content, 'gsub', [$$($nesting, 'InlineXrefMacroRx')], (TMP_50 = function(){var self = TMP_50.$$s || this, $c, $d, m = nil, attrs = nil, doc = nil, refid = nil, text = nil, macro = nil, fragment = nil, hash_idx = nil, fragment_len = nil, path = nil, ext = nil, src2src = nil, target = nil; + if (self.document == null) self.document = nil; + if ($gvars["~"] == null) $gvars["~"] = nil; + if ($gvars.VERBOSE == null) $gvars.VERBOSE = nil; + + + m = $gvars["~"]; + if ($truthy((($c = $gvars['~']) === nil ? nil : $c['$[]'](0))['$start_with?']($$($nesting, 'RS')))) { + return m['$[]'](0).$slice(1, m['$[]'](0).$length());}; + $c = [$hash2([], {}), self.document], (attrs = $c[0]), (doc = $c[1]), $c; + if ($truthy((refid = m['$[]'](1)))) { + + $d = refid.$split(",", 2), $c = Opal.to_ary($d), (refid = ($c[0] == null ? nil : $c[0])), (text = ($c[1] == null ? nil : $c[1])), $d; + if ($truthy(text)) { + text = text.$lstrip()}; + } else { + + macro = true; + refid = m['$[]'](2); + if ($truthy((text = m['$[]'](3)))) { + + if ($truthy(text['$include?']($$($nesting, 'R_SB')))) { + text = text.$gsub($$($nesting, 'ESC_R_SB'), $$($nesting, 'R_SB'))}; + if ($truthy(($truthy($c = doc.$compat_mode()['$!']()) ? text['$include?']("=") : $c))) { + text = $$($nesting, 'AttributeList').$new(text, self).$parse_into(attrs)['$[]'](1)};}; + }; + if ($truthy(doc.$compat_mode())) { + fragment = refid + } else if ($truthy((hash_idx = refid.$index("#")))) { + if ($truthy($rb_gt(hash_idx, 0))) { + + if ($truthy($rb_gt((fragment_len = $rb_minus($rb_minus(refid.$length(), hash_idx), 1)), 0))) { + $c = [refid.$slice(0, hash_idx), refid.$slice($rb_plus(hash_idx, 1), fragment_len)], (path = $c[0]), (fragment = $c[1]), $c + } else { + path = refid.$slice(0, hash_idx) + }; + if ($truthy((ext = $$$('::', 'File').$extname(path))['$empty?']())) { + src2src = path + } else if ($truthy($$($nesting, 'ASCIIDOC_EXTENSIONS')['$[]'](ext))) { + src2src = (path = path.$slice(0, $rb_minus(path.$length(), ext.$length())))}; + } else { + $c = [refid, refid.$slice(1, refid.$length())], (target = $c[0]), (fragment = $c[1]), $c + } + } else if ($truthy(($truthy($c = macro) ? refid['$end_with?'](".adoc") : $c))) { + src2src = (path = refid.$slice(0, $rb_minus(refid.$length(), 5))) + } else { + fragment = refid + }; + if ($truthy(target)) { + + refid = fragment; + if ($truthy(($truthy($c = $gvars.VERBOSE) ? doc.$catalog()['$[]']("ids")['$key?'](refid)['$!']() : $c))) { + self.$logger().$warn("" + "invalid reference: " + (refid))}; + } else if ($truthy(path)) { + if ($truthy(($truthy($c = src2src) ? ($truthy($d = doc.$attributes()['$[]']("docname")['$=='](path)) ? $d : doc.$catalog()['$[]']("includes")['$[]'](path)) : $c))) { + if ($truthy(fragment)) { + + $c = [fragment, nil, "" + "#" + (fragment)], (refid = $c[0]), (path = $c[1]), (target = $c[2]), $c; + if ($truthy(($truthy($c = $gvars.VERBOSE) ? doc.$catalog()['$[]']("ids")['$key?'](refid)['$!']() : $c))) { + self.$logger().$warn("" + "invalid reference: " + (refid))}; + } else { + $c = [nil, nil, "#"], (refid = $c[0]), (path = $c[1]), (target = $c[2]), $c + } + } else { + + $c = [path, "" + (doc.$attributes()['$[]']("relfileprefix")) + (path) + ((function() {if ($truthy(src2src)) { + + return doc.$attributes().$fetch("relfilesuffix", doc.$outfilesuffix()); + } else { + return "" + }; return nil; })())], (refid = $c[0]), (path = $c[1]), $c; + if ($truthy(fragment)) { + $c = ["" + (refid) + "#" + (fragment), "" + (path) + "#" + (fragment)], (refid = $c[0]), (target = $c[1]), $c + } else { + target = path + }; + } + } else if ($truthy(($truthy($c = doc.$compat_mode()) ? $c : $$($nesting, 'Compliance').$natural_xrefs()['$!']()))) { + + $c = [fragment, "" + "#" + (fragment)], (refid = $c[0]), (target = $c[1]), $c; + if ($truthy(($truthy($c = $gvars.VERBOSE) ? doc.$catalog()['$[]']("ids")['$key?'](refid)['$!']() : $c))) { + self.$logger().$warn("" + "invalid reference: " + (refid))}; + } else if ($truthy(doc.$catalog()['$[]']("ids")['$key?'](fragment))) { + $c = [fragment, "" + "#" + (fragment)], (refid = $c[0]), (target = $c[1]), $c + } else if ($truthy(($truthy($c = (refid = doc.$catalog()['$[]']("ids").$key(fragment))) ? ($truthy($d = fragment['$include?'](" ")) ? $d : fragment.$downcase()['$!='](fragment)) : $c))) { + $c = [refid, "" + "#" + (refid)], (fragment = $c[0]), (target = $c[1]), $c + } else { + + $c = [fragment, "" + "#" + (fragment)], (refid = $c[0]), (target = $c[1]), $c; + if ($truthy($gvars.VERBOSE)) { + self.$logger().$warn("" + "invalid reference: " + (refid))}; + }; + $c = [path, fragment, refid], attrs['$[]=']("path", $c[0]), attrs['$[]=']("fragment", $c[1]), attrs['$[]=']("refid", $c[2]), $c; + return $$($nesting, 'Inline').$new(self, "anchor", text, $hash2(["type", "target", "attributes"], {"type": "xref", "target": target, "attributes": attrs})).$convert();}, TMP_50.$$s = self, TMP_50.$$arity = 0, TMP_50))}; + return content; + }, TMP_Substitutors_sub_inline_xrefs_49.$$arity = -2); + + Opal.def(self, '$sub_callouts', TMP_Substitutors_sub_callouts_51 = function $$sub_callouts(text) { + var TMP_52, self = this, callout_rx = nil, autonum = nil; + + + callout_rx = (function() {if ($truthy(self['$attr?']("line-comment"))) { + return $$($nesting, 'CalloutSourceRxMap')['$[]'](self.$attr("line-comment")) + } else { + return $$($nesting, 'CalloutSourceRx') + }; return nil; })(); + autonum = 0; + return $send(text, 'gsub', [callout_rx], (TMP_52 = function(){var self = TMP_52.$$s || this, $a; + if (self.document == null) self.document = nil; + + if ($truthy((($a = $gvars['~']) === nil ? nil : $a['$[]'](2)))) { + return (($a = $gvars['~']) === nil ? nil : $a['$[]'](0)).$sub($$($nesting, 'RS'), "") + } else { + return $$($nesting, 'Inline').$new(self, "callout", (function() {if ((($a = $gvars['~']) === nil ? nil : $a['$[]'](4))['$=='](".")) { + return (autonum = $rb_plus(autonum, 1)).$to_s() + } else { + return (($a = $gvars['~']) === nil ? nil : $a['$[]'](4)) + }; return nil; })(), $hash2(["id", "attributes"], {"id": self.document.$callouts().$read_next_id(), "attributes": $hash2(["guard"], {"guard": (($a = $gvars['~']) === nil ? nil : $a['$[]'](1))})})).$convert() + }}, TMP_52.$$s = self, TMP_52.$$arity = 0, TMP_52)); + }, TMP_Substitutors_sub_callouts_51.$$arity = 1); + + Opal.def(self, '$sub_post_replacements', TMP_Substitutors_sub_post_replacements_53 = function $$sub_post_replacements(text) { + var $a, TMP_54, TMP_55, self = this, lines = nil, last = nil; + if (self.document == null) self.document = nil; + if (self.attributes == null) self.attributes = nil; + + if ($truthy(($truthy($a = self.document.$attributes()['$key?']("hardbreaks")) ? $a : self.attributes['$key?']("hardbreaks-option")))) { + + lines = text.$split($$($nesting, 'LF'), -1); + if ($truthy($rb_lt(lines.$size(), 2))) { + return text}; + last = lines.$pop(); + return $send(lines, 'map', [], (TMP_54 = function(line){var self = TMP_54.$$s || this; + + + + if (line == null) { + line = nil; + }; + return $$($nesting, 'Inline').$new(self, "break", (function() {if ($truthy(line['$end_with?']($$($nesting, 'HARD_LINE_BREAK')))) { + + return line.$slice(0, $rb_minus(line.$length(), 2)); + } else { + return line + }; return nil; })(), $hash2(["type"], {"type": "line"})).$convert();}, TMP_54.$$s = self, TMP_54.$$arity = 1, TMP_54))['$<<'](last).$join($$($nesting, 'LF')); + } else if ($truthy(($truthy($a = text['$include?']($$($nesting, 'PLUS'))) ? text['$include?']($$($nesting, 'HARD_LINE_BREAK')) : $a))) { + return $send(text, 'gsub', [$$($nesting, 'HardLineBreakRx')], (TMP_55 = function(){var self = TMP_55.$$s || this, $b; + + return $$($nesting, 'Inline').$new(self, "break", (($b = $gvars['~']) === nil ? nil : $b['$[]'](1)), $hash2(["type"], {"type": "line"})).$convert()}, TMP_55.$$s = self, TMP_55.$$arity = 0, TMP_55)) + } else { + return text + } + }, TMP_Substitutors_sub_post_replacements_53.$$arity = 1); + + Opal.def(self, '$convert_quoted_text', TMP_Substitutors_convert_quoted_text_56 = function $$convert_quoted_text(match, type, scope) { + var $a, self = this, attrs = nil, unescaped_attrs = nil, attrlist = nil, id = nil, attributes = nil; + + + if ($truthy(match['$[]'](0)['$start_with?']($$($nesting, 'RS')))) { + if ($truthy((($a = scope['$==']("constrained")) ? (attrs = match['$[]'](2)) : scope['$==']("constrained")))) { + unescaped_attrs = "" + "[" + (attrs) + "]" + } else { + return match['$[]'](0).$slice(1, match['$[]'](0).$length()) + }}; + if (scope['$==']("constrained")) { + if ($truthy(unescaped_attrs)) { + return "" + (unescaped_attrs) + ($$($nesting, 'Inline').$new(self, "quoted", match['$[]'](3), $hash2(["type"], {"type": type})).$convert()) + } else { + + if ($truthy((attrlist = match['$[]'](2)))) { + + id = (attributes = self.$parse_quoted_text_attributes(attrlist)).$delete("id"); + if (type['$==']("mark")) { + type = "unquoted"};}; + return "" + (match['$[]'](1)) + ($$($nesting, 'Inline').$new(self, "quoted", match['$[]'](3), $hash2(["type", "id", "attributes"], {"type": type, "id": id, "attributes": attributes})).$convert()); + } + } else { + + if ($truthy((attrlist = match['$[]'](1)))) { + + id = (attributes = self.$parse_quoted_text_attributes(attrlist)).$delete("id"); + if (type['$==']("mark")) { + type = "unquoted"};}; + return $$($nesting, 'Inline').$new(self, "quoted", match['$[]'](2), $hash2(["type", "id", "attributes"], {"type": type, "id": id, "attributes": attributes})).$convert(); + }; + }, TMP_Substitutors_convert_quoted_text_56.$$arity = 3); + + Opal.def(self, '$parse_quoted_text_attributes', TMP_Substitutors_parse_quoted_text_attributes_57 = function $$parse_quoted_text_attributes(str) { + var $a, $b, self = this, segments = nil, id = nil, more_roles = nil, roles = nil, attrs = nil, $writer = nil; + + + if ($truthy(str['$include?']($$($nesting, 'ATTR_REF_HEAD')))) { + str = self.$sub_attributes(str)}; + if ($truthy(str['$include?'](","))) { + str = str.$slice(0, str.$index(","))}; + if ($truthy((str = str.$strip())['$empty?']())) { + return $hash2([], {}) + } else if ($truthy(($truthy($a = str['$start_with?'](".", "#")) ? $$($nesting, 'Compliance').$shorthand_property_syntax() : $a))) { + + segments = str.$split("#", 2); + if ($truthy($rb_gt(segments.$size(), 1))) { + $b = segments['$[]'](1).$split("."), $a = Opal.to_ary($b), (id = ($a[0] == null ? nil : $a[0])), (more_roles = $slice.call($a, 1)), $b + } else { + + id = nil; + more_roles = []; + }; + roles = (function() {if ($truthy(segments['$[]'](0)['$empty?']())) { + return [] + } else { + return segments['$[]'](0).$split(".") + }; return nil; })(); + if ($truthy($rb_gt(roles.$size(), 1))) { + roles.$shift()}; + if ($truthy($rb_gt(more_roles.$size(), 0))) { + roles.$concat(more_roles)}; + attrs = $hash2([], {}); + if ($truthy(id)) { + + $writer = ["id", id]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if ($truthy(roles['$empty?']())) { + } else { + + $writer = ["role", roles.$join(" ")]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + return attrs; + } else { + return $hash2(["role"], {"role": str}) + }; + }, TMP_Substitutors_parse_quoted_text_attributes_57.$$arity = 1); + + Opal.def(self, '$parse_attributes', TMP_Substitutors_parse_attributes_58 = function $$parse_attributes(attrlist, posattrs, opts) { + var $a, self = this, block = nil, into = nil; + if (self.document == null) self.document = nil; + + + + if (posattrs == null) { + posattrs = []; + }; + + if (opts == null) { + opts = $hash2([], {}); + }; + if ($truthy(($truthy($a = attrlist) ? attrlist['$empty?']()['$!']() : $a))) { + } else { + return $hash2([], {}) + }; + if ($truthy(($truthy($a = opts['$[]']("sub_input")) ? attrlist['$include?']($$($nesting, 'ATTR_REF_HEAD')) : $a))) { + attrlist = self.document.$sub_attributes(attrlist)}; + if ($truthy(opts['$[]']("unescape_input"))) { + attrlist = self.$unescape_bracketed_text(attrlist)}; + if ($truthy(opts['$[]']("sub_result"))) { + block = self}; + if ($truthy((into = opts['$[]']("into")))) { + return $$($nesting, 'AttributeList').$new(attrlist, block).$parse_into(into, posattrs) + } else { + return $$($nesting, 'AttributeList').$new(attrlist, block).$parse(posattrs) + }; + }, TMP_Substitutors_parse_attributes_58.$$arity = -2); + + Opal.def(self, '$expand_subs', TMP_Substitutors_expand_subs_59 = function $$expand_subs(subs) { + var $a, TMP_60, self = this, expanded_subs = nil; + + if ($truthy($$$('::', 'Symbol')['$==='](subs))) { + if (subs['$==']("none")) { + return nil + } else { + return ($truthy($a = $$($nesting, 'SUB_GROUPS')['$[]'](subs)) ? $a : [subs]) + } + } else { + + expanded_subs = []; + $send(subs, 'each', [], (TMP_60 = function(key){var self = TMP_60.$$s || this, sub_group = nil; + + + + if (key == null) { + key = nil; + }; + if (key['$==']("none")) { + return nil + } else if ($truthy((sub_group = $$($nesting, 'SUB_GROUPS')['$[]'](key)))) { + return (expanded_subs = $rb_plus(expanded_subs, sub_group)) + } else { + return expanded_subs['$<<'](key) + };}, TMP_60.$$s = self, TMP_60.$$arity = 1, TMP_60)); + if ($truthy(expanded_subs['$empty?']())) { + return nil + } else { + return expanded_subs + }; + } + }, TMP_Substitutors_expand_subs_59.$$arity = 1); + + Opal.def(self, '$unescape_bracketed_text', TMP_Substitutors_unescape_bracketed_text_61 = function $$unescape_bracketed_text(text) { + var self = this; + + + if ($truthy(text['$empty?']())) { + } else if ($truthy((text = text.$strip().$tr($$($nesting, 'LF'), " "))['$include?']($$($nesting, 'R_SB')))) { + text = text.$gsub($$($nesting, 'ESC_R_SB'), $$($nesting, 'R_SB'))}; + return text; + }, TMP_Substitutors_unescape_bracketed_text_61.$$arity = 1); + + Opal.def(self, '$normalize_string', TMP_Substitutors_normalize_string_62 = function $$normalize_string(str, unescape_brackets) { + var $a, self = this; + + + + if (unescape_brackets == null) { + unescape_brackets = false; + }; + if ($truthy(str['$empty?']())) { + } else { + + str = str.$strip().$tr($$($nesting, 'LF'), " "); + if ($truthy(($truthy($a = unescape_brackets) ? str['$include?']($$($nesting, 'R_SB')) : $a))) { + str = str.$gsub($$($nesting, 'ESC_R_SB'), $$($nesting, 'R_SB'))}; + }; + return str; + }, TMP_Substitutors_normalize_string_62.$$arity = -2); + + Opal.def(self, '$unescape_brackets', TMP_Substitutors_unescape_brackets_63 = function $$unescape_brackets(str) { + var self = this; + + + if ($truthy(str['$empty?']())) { + } else if ($truthy(str['$include?']($$($nesting, 'RS')))) { + str = str.$gsub($$($nesting, 'ESC_R_SB'), $$($nesting, 'R_SB'))}; + return str; + }, TMP_Substitutors_unescape_brackets_63.$$arity = 1); + + Opal.def(self, '$split_simple_csv', TMP_Substitutors_split_simple_csv_64 = function $$split_simple_csv(str) { + var TMP_65, TMP_66, self = this, values = nil, current = nil, quote_open = nil; + + + if ($truthy(str['$empty?']())) { + values = [] + } else if ($truthy(str['$include?']("\""))) { + + values = []; + current = []; + quote_open = false; + $send(str, 'each_char', [], (TMP_65 = function(c){var self = TMP_65.$$s || this, $case = nil; + + + + if (c == null) { + c = nil; + }; + return (function() {$case = c; + if (","['$===']($case)) {if ($truthy(quote_open)) { + return current['$<<'](c) + } else { + + values['$<<'](current.$join().$strip()); + return (current = []); + }} + else if ("\""['$===']($case)) {return (quote_open = quote_open['$!']())} + else {return current['$<<'](c)}})();}, TMP_65.$$s = self, TMP_65.$$arity = 1, TMP_65)); + values['$<<'](current.$join().$strip()); + } else { + values = $send(str.$split(","), 'map', [], (TMP_66 = function(it){var self = TMP_66.$$s || this; + + + + if (it == null) { + it = nil; + }; + return it.$strip();}, TMP_66.$$s = self, TMP_66.$$arity = 1, TMP_66)) + }; + return values; + }, TMP_Substitutors_split_simple_csv_64.$$arity = 1); + + Opal.def(self, '$resolve_subs', TMP_Substitutors_resolve_subs_67 = function $$resolve_subs(subs, type, defaults, subject) { + var TMP_68, self = this, candidates = nil, modifiers_present = nil, resolved = nil, invalid = nil; + + + + if (type == null) { + type = "block"; + }; + + if (defaults == null) { + defaults = nil; + }; + + if (subject == null) { + subject = nil; + }; + if ($truthy(subs['$nil_or_empty?']())) { + return nil}; + candidates = nil; + if ($truthy(subs['$include?'](" "))) { + subs = subs.$delete(" ")}; + modifiers_present = $$($nesting, 'SubModifierSniffRx')['$match?'](subs); + $send(subs.$split(","), 'each', [], (TMP_68 = function(key){var self = TMP_68.$$s || this, $a, $b, modifier_operation = nil, first = nil, resolved_keys = nil, resolved_key = nil, candidate = nil, $case = nil; + + + + if (key == null) { + key = nil; + }; + modifier_operation = nil; + if ($truthy(modifiers_present)) { + if ((first = key.$chr())['$==']("+")) { + + modifier_operation = "append"; + key = key.$slice(1, key.$length()); + } else if (first['$==']("-")) { + + modifier_operation = "remove"; + key = key.$slice(1, key.$length()); + } else if ($truthy(key['$end_with?']("+"))) { + + modifier_operation = "prepend"; + key = key.$chop();}}; + key = key.$to_sym(); + if ($truthy((($a = type['$==']("inline")) ? ($truthy($b = key['$==']("verbatim")) ? $b : key['$==']("v")) : type['$==']("inline")))) { + resolved_keys = $$($nesting, 'BASIC_SUBS') + } else if ($truthy($$($nesting, 'SUB_GROUPS')['$key?'](key))) { + resolved_keys = $$($nesting, 'SUB_GROUPS')['$[]'](key) + } else if ($truthy(($truthy($a = (($b = type['$==']("inline")) ? key.$length()['$=='](1) : type['$==']("inline"))) ? $$($nesting, 'SUB_HINTS')['$key?'](key) : $a))) { + + resolved_key = $$($nesting, 'SUB_HINTS')['$[]'](key); + if ($truthy((candidate = $$($nesting, 'SUB_GROUPS')['$[]'](resolved_key)))) { + resolved_keys = candidate + } else { + resolved_keys = [resolved_key] + }; + } else { + resolved_keys = [key] + }; + if ($truthy(modifier_operation)) { + + candidates = ($truthy($a = candidates) ? $a : (function() {if ($truthy(defaults)) { + + return defaults.$drop(0); + } else { + return [] + }; return nil; })()); + return (function() {$case = modifier_operation; + if ("append"['$===']($case)) {return (candidates = $rb_plus(candidates, resolved_keys))} + else if ("prepend"['$===']($case)) {return (candidates = $rb_plus(resolved_keys, candidates))} + else if ("remove"['$===']($case)) {return (candidates = $rb_minus(candidates, resolved_keys))} + else { return nil }})(); + } else { + + candidates = ($truthy($a = candidates) ? $a : []); + return (candidates = $rb_plus(candidates, resolved_keys)); + };}, TMP_68.$$s = self, TMP_68.$$arity = 1, TMP_68)); + if ($truthy(candidates)) { + } else { + return nil + }; + resolved = candidates['$&']($$($nesting, 'SUB_OPTIONS')['$[]'](type)); + if ($truthy($rb_minus(candidates, resolved)['$empty?']())) { + } else { + + invalid = $rb_minus(candidates, resolved); + self.$logger().$warn("" + "invalid substitution type" + ((function() {if ($truthy($rb_gt(invalid.$size(), 1))) { + return "s" + } else { + return "" + }; return nil; })()) + ((function() {if ($truthy(subject)) { + return " for " + } else { + return "" + }; return nil; })()) + (subject) + ": " + (invalid.$join(", "))); + }; + return resolved; + }, TMP_Substitutors_resolve_subs_67.$$arity = -2); + + Opal.def(self, '$resolve_block_subs', TMP_Substitutors_resolve_block_subs_69 = function $$resolve_block_subs(subs, defaults, subject) { + var self = this; + + return self.$resolve_subs(subs, "block", defaults, subject) + }, TMP_Substitutors_resolve_block_subs_69.$$arity = 3); + + Opal.def(self, '$resolve_pass_subs', TMP_Substitutors_resolve_pass_subs_70 = function $$resolve_pass_subs(subs) { + var self = this; + + return self.$resolve_subs(subs, "inline", nil, "passthrough macro") + }, TMP_Substitutors_resolve_pass_subs_70.$$arity = 1); + + Opal.def(self, '$highlight_source', TMP_Substitutors_highlight_source_71 = function $$highlight_source(source, process_callouts, highlighter) { + var $a, $b, $c, $d, $e, $f, TMP_72, TMP_74, self = this, $case = nil, highlighter_loaded = nil, lineno = nil, callout_on_last = nil, callout_marks = nil, last = nil, callout_rx = nil, linenums_mode = nil, highlight_lines = nil, start = nil, result = nil, lexer = nil, opts = nil, $writer = nil, autonum = nil, reached_code = nil; + if (self.document == null) self.document = nil; + if (self.passthroughs == null) self.passthroughs = nil; + + + + if (highlighter == null) { + highlighter = nil; + }; + $case = (highlighter = ($truthy($a = highlighter) ? $a : self.document.$attributes()['$[]']("source-highlighter"))); + if ("coderay"['$===']($case)) {if ($truthy(($truthy($a = ($truthy($b = (highlighter_loaded = (($c = $$$('::', 'CodeRay', 'skip_raise')) ? 'constant' : nil))) ? $b : (($d = $Substitutors.$$cvars['@@coderay_unavailable'], $d != null) ? 'class variable' : nil))) ? $a : self.document.$attributes()['$[]']("coderay-unavailable")))) { + } else if ($truthy($$($nesting, 'Helpers').$require_library("coderay", true, "warn")['$nil?']())) { + (Opal.class_variable_set($Substitutors, '@@coderay_unavailable', true)) + } else { + highlighter_loaded = true + }} + else if ("pygments"['$===']($case)) {if ($truthy(($truthy($a = ($truthy($b = (highlighter_loaded = (($e = $$$('::', 'Pygments', 'skip_raise')) ? 'constant' : nil))) ? $b : (($f = $Substitutors.$$cvars['@@pygments_unavailable'], $f != null) ? 'class variable' : nil))) ? $a : self.document.$attributes()['$[]']("pygments-unavailable")))) { + } else if ($truthy($$($nesting, 'Helpers').$require_library("pygments", "pygments.rb", "warn")['$nil?']())) { + (Opal.class_variable_set($Substitutors, '@@pygments_unavailable', true)) + } else { + highlighter_loaded = true + }} + else {highlighter_loaded = false}; + if ($truthy(highlighter_loaded)) { + } else { + return self.$sub_source(source, process_callouts) + }; + lineno = 0; + callout_on_last = false; + if ($truthy(process_callouts)) { + + callout_marks = $hash2([], {}); + last = -1; + callout_rx = (function() {if ($truthy(self['$attr?']("line-comment"))) { + return $$($nesting, 'CalloutExtractRxMap')['$[]'](self.$attr("line-comment")) + } else { + return $$($nesting, 'CalloutExtractRx') + }; return nil; })(); + source = $send(source.$split($$($nesting, 'LF'), -1), 'map', [], (TMP_72 = function(line){var self = TMP_72.$$s || this, TMP_73; + + + + if (line == null) { + line = nil; + }; + lineno = $rb_plus(lineno, 1); + return $send(line, 'gsub', [callout_rx], (TMP_73 = function(){var self = TMP_73.$$s || this, $g, $writer = nil; + + if ($truthy((($g = $gvars['~']) === nil ? nil : $g['$[]'](2)))) { + return (($g = $gvars['~']) === nil ? nil : $g['$[]'](0)).$sub($$($nesting, 'RS'), "") + } else { + + ($truthy($g = callout_marks['$[]'](lineno)) ? $g : (($writer = [lineno, []]), $send(callout_marks, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]))['$<<']([(($g = $gvars['~']) === nil ? nil : $g['$[]'](1)), (($g = $gvars['~']) === nil ? nil : $g['$[]'](4))]); + last = lineno; + return nil; + }}, TMP_73.$$s = self, TMP_73.$$arity = 0, TMP_73));}, TMP_72.$$s = self, TMP_72.$$arity = 1, TMP_72)).$join($$($nesting, 'LF')); + callout_on_last = last['$=='](lineno); + if ($truthy(callout_marks['$empty?']())) { + callout_marks = nil}; + } else { + callout_marks = nil + }; + linenums_mode = nil; + highlight_lines = nil; + $case = highlighter; + if ("coderay"['$===']($case)) { + if ($truthy((linenums_mode = (function() {if ($truthy(self['$attr?']("linenums", nil, false))) { + return ($truthy($a = self.document.$attributes()['$[]']("coderay-linenums-mode")) ? $a : "table").$to_sym() + } else { + return nil + }; return nil; })()))) { + + if ($truthy($rb_lt((start = self.$attr("start", nil, 1).$to_i()), 1))) { + start = 1}; + if ($truthy(self['$attr?']("highlight", nil, false))) { + highlight_lines = self.$resolve_lines_to_highlight(source, self.$attr("highlight", nil, false))};}; + result = $$$($$$('::', 'CodeRay'), 'Duo')['$[]'](self.$attr("language", "text", false).$to_sym(), "html", $hash2(["css", "line_numbers", "line_number_start", "line_number_anchors", "highlight_lines", "bold_every"], {"css": ($truthy($a = self.document.$attributes()['$[]']("coderay-css")) ? $a : "class").$to_sym(), "line_numbers": linenums_mode, "line_number_start": start, "line_number_anchors": false, "highlight_lines": highlight_lines, "bold_every": false})).$highlight(source);} + else if ("pygments"['$===']($case)) { + lexer = ($truthy($a = $$$($$$('::', 'Pygments'), 'Lexer').$find_by_alias(self.$attr("language", "text", false))) ? $a : $$$($$$('::', 'Pygments'), 'Lexer').$find_by_mimetype("text/plain")); + opts = $hash2(["cssclass", "classprefix", "nobackground", "stripnl"], {"cssclass": "pyhl", "classprefix": "tok-", "nobackground": true, "stripnl": false}); + if (lexer.$name()['$==']("PHP")) { + + $writer = ["startinline", self['$option?']("mixed")['$!']()]; + $send(opts, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if (($truthy($a = self.document.$attributes()['$[]']("pygments-css")) ? $a : "class")['$==']("class")) { + } else { + + + $writer = ["noclasses", true]; + $send(opts, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["style", ($truthy($a = self.document.$attributes()['$[]']("pygments-style")) ? $a : $$$($$($nesting, 'Stylesheets'), 'DEFAULT_PYGMENTS_STYLE'))]; + $send(opts, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + }; + if ($truthy(self['$attr?']("highlight", nil, false))) { + if ($truthy((highlight_lines = self.$resolve_lines_to_highlight(source, self.$attr("highlight", nil, false)))['$empty?']())) { + } else { + + $writer = ["hl_lines", highlight_lines.$join(" ")]; + $send(opts, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }}; + if ($truthy(($truthy($a = ($truthy($b = self['$attr?']("linenums", nil, false)) ? (($writer = ["linenostart", (function() {if ($truthy($rb_lt((start = self.$attr("start", 1, false)).$to_i(), 1))) { + return 1 + } else { + return start + }; return nil; })()]), $send(opts, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]) : $b)) ? (($writer = ["linenos", ($truthy($b = self.document.$attributes()['$[]']("pygments-linenums-mode")) ? $b : "table")]), $send(opts, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])['$==']("table") : $a))) { + + linenums_mode = "table"; + if ($truthy((result = lexer.$highlight(source, $hash2(["options"], {"options": opts}))))) { + result = result.$sub($$($nesting, 'PygmentsWrapperDivRx'), "\\1").$gsub($$($nesting, 'PygmentsWrapperPreRx'), "\\1") + } else { + result = self.$sub_specialchars(source) + }; + } else if ($truthy((result = lexer.$highlight(source, $hash2(["options"], {"options": opts}))))) { + if ($truthy($$($nesting, 'PygmentsWrapperPreRx')['$=~'](result))) { + result = (($a = $gvars['~']) === nil ? nil : $a['$[]'](1))} + } else { + result = self.$sub_specialchars(source) + };}; + if ($truthy(self.passthroughs['$empty?']())) { + } else { + result = result.$gsub($$($nesting, 'HighlightedPassSlotRx'), "" + ($$($nesting, 'PASS_START')) + "\\1" + ($$($nesting, 'PASS_END'))) + }; + if ($truthy(($truthy($a = process_callouts) ? callout_marks : $a))) { + + lineno = 0; + autonum = 0; + reached_code = linenums_mode['$!=']("table"); + return $send(result.$split($$($nesting, 'LF'), -1), 'map', [], (TMP_74 = function(line){var self = TMP_74.$$s || this, $g, $h, TMP_75, conums = nil, tail = nil, pos = nil, guard = nil, conum = nil, conums_markup = nil; + if (self.document == null) self.document = nil; + + + + if (line == null) { + line = nil; + }; + if ($truthy(reached_code)) { + } else { + + if ($truthy(line['$include?'](""))) { + } else { + return line; + }; + reached_code = true; + }; + lineno = $rb_plus(lineno, 1); + if ($truthy((conums = callout_marks.$delete(lineno)))) { + + tail = nil; + if ($truthy(($truthy($g = ($truthy($h = callout_on_last) ? callout_marks['$empty?']() : $h)) ? linenums_mode['$==']("table") : $g))) { + if ($truthy((($g = highlighter['$==']("coderay")) ? (pos = line.$index("")) : highlighter['$==']("coderay")))) { + $g = [line.$slice(0, pos), line.$slice(pos, line.$length())], (line = $g[0]), (tail = $g[1]), $g + } else if ($truthy((($g = highlighter['$==']("pygments")) ? (pos = line['$start_with?']("")) : highlighter['$==']("pygments")))) { + $g = ["", line], (line = $g[0]), (tail = $g[1]), $g}}; + if (conums.$size()['$=='](1)) { + + $h = conums['$[]'](0), $g = Opal.to_ary($h), (guard = ($g[0] == null ? nil : $g[0])), (conum = ($g[1] == null ? nil : $g[1])), $h; + return "" + (line) + ($$($nesting, 'Inline').$new(self, "callout", (function() {if (conum['$=='](".")) { + return (autonum = $rb_plus(autonum, 1)).$to_s() + } else { + return conum + }; return nil; })(), $hash2(["id", "attributes"], {"id": self.document.$callouts().$read_next_id(), "attributes": $hash2(["guard"], {"guard": guard})})).$convert()) + (tail); + } else { + + conums_markup = $send(conums, 'map', [], (TMP_75 = function(guard_it, conum_it){var self = TMP_75.$$s || this; + if (self.document == null) self.document = nil; + + + + if (guard_it == null) { + guard_it = nil; + }; + + if (conum_it == null) { + conum_it = nil; + }; + return $$($nesting, 'Inline').$new(self, "callout", (function() {if (conum_it['$=='](".")) { + return (autonum = $rb_plus(autonum, 1)).$to_s() + } else { + return conum_it + }; return nil; })(), $hash2(["id", "attributes"], {"id": self.document.$callouts().$read_next_id(), "attributes": $hash2(["guard"], {"guard": guard_it})})).$convert();}, TMP_75.$$s = self, TMP_75.$$arity = 2, TMP_75)).$join(" "); + return "" + (line) + (conums_markup) + (tail); + }; + } else { + return line + };}, TMP_74.$$s = self, TMP_74.$$arity = 1, TMP_74)).$join($$($nesting, 'LF')); + } else { + return result + }; + }, TMP_Substitutors_highlight_source_71.$$arity = -3); + + Opal.def(self, '$resolve_lines_to_highlight', TMP_Substitutors_resolve_lines_to_highlight_76 = function $$resolve_lines_to_highlight(source, spec) { + var TMP_77, self = this, lines = nil; + + + lines = []; + if ($truthy(spec['$include?'](" "))) { + spec = spec.$delete(" ")}; + $send((function() {if ($truthy(spec['$include?'](","))) { + + return spec.$split(","); + } else { + + return spec.$split(";"); + }; return nil; })(), 'map', [], (TMP_77 = function(entry){var self = TMP_77.$$s || this, $a, $b, negate = nil, delim = nil, from = nil, to = nil, line_nums = nil; + + + + if (entry == null) { + entry = nil; + }; + negate = false; + if ($truthy(entry['$start_with?']("!"))) { + + entry = entry.$slice(1, entry.$length()); + negate = true;}; + if ($truthy((delim = (function() {if ($truthy(entry['$include?'](".."))) { + return ".." + } else { + + if ($truthy(entry['$include?']("-"))) { + return "-" + } else { + return nil + }; + }; return nil; })()))) { + + $b = entry.$split(delim, 2), $a = Opal.to_ary($b), (from = ($a[0] == null ? nil : $a[0])), (to = ($a[1] == null ? nil : $a[1])), $b; + if ($truthy(($truthy($a = to['$empty?']()) ? $a : $rb_lt((to = to.$to_i()), 0)))) { + to = $rb_plus(source.$count($$($nesting, 'LF')), 1)}; + line_nums = $$$('::', 'Range').$new(from.$to_i(), to).$to_a(); + if ($truthy(negate)) { + return (lines = $rb_minus(lines, line_nums)) + } else { + return lines.$concat(line_nums) + }; + } else if ($truthy(negate)) { + return lines.$delete(entry.$to_i()) + } else { + return lines['$<<'](entry.$to_i()) + };}, TMP_77.$$s = self, TMP_77.$$arity = 1, TMP_77)); + return lines.$sort().$uniq(); + }, TMP_Substitutors_resolve_lines_to_highlight_76.$$arity = 2); + + Opal.def(self, '$sub_source', TMP_Substitutors_sub_source_78 = function $$sub_source(source, process_callouts) { + var self = this; + + if ($truthy(process_callouts)) { + return self.$sub_callouts(self.$sub_specialchars(source)) + } else { + + return self.$sub_specialchars(source); + } + }, TMP_Substitutors_sub_source_78.$$arity = 2); + + Opal.def(self, '$lock_in_subs', TMP_Substitutors_lock_in_subs_79 = function $$lock_in_subs() { + var $a, $b, $c, $d, $e, self = this, default_subs = nil, $case = nil, custom_subs = nil, idx = nil, $writer = nil; + if (self.default_subs == null) self.default_subs = nil; + if (self.content_model == null) self.content_model = nil; + if (self.context == null) self.context = nil; + if (self.subs == null) self.subs = nil; + if (self.attributes == null) self.attributes = nil; + if (self.style == null) self.style = nil; + if (self.document == null) self.document = nil; + + + if ($truthy((default_subs = self.default_subs))) { + } else { + $case = self.content_model; + if ("simple"['$===']($case)) {default_subs = $$($nesting, 'NORMAL_SUBS')} + else if ("verbatim"['$===']($case)) {if ($truthy(($truthy($a = self.context['$==']("listing")) ? $a : (($b = self.context['$==']("literal")) ? self['$option?']("listparagraph")['$!']() : self.context['$==']("literal"))))) { + default_subs = $$($nesting, 'VERBATIM_SUBS') + } else if (self.context['$==']("verse")) { + default_subs = $$($nesting, 'NORMAL_SUBS') + } else { + default_subs = $$($nesting, 'BASIC_SUBS') + }} + else if ("raw"['$===']($case)) {default_subs = (function() {if (self.context['$==']("stem")) { + return $$($nesting, 'BASIC_SUBS') + } else { + return $$($nesting, 'NONE_SUBS') + }; return nil; })()} + else {return self.subs} + }; + if ($truthy((custom_subs = self.attributes['$[]']("subs")))) { + self.subs = ($truthy($a = self.$resolve_block_subs(custom_subs, default_subs, self.context)) ? $a : []) + } else { + self.subs = default_subs.$drop(0) + }; + if ($truthy(($truthy($a = ($truthy($b = ($truthy($c = ($truthy($d = (($e = self.context['$==']("listing")) ? self.style['$==']("source") : self.context['$==']("listing"))) ? self.attributes['$key?']("language") : $d)) ? self.document['$basebackend?']("html") : $c)) ? $$($nesting, 'SUB_HIGHLIGHT')['$include?'](self.document.$attributes()['$[]']("source-highlighter")) : $b)) ? (idx = self.subs.$index("specialcharacters")) : $a))) { + + $writer = [idx, "highlight"]; + $send(self.subs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + return self.subs; + }, TMP_Substitutors_lock_in_subs_79.$$arity = 0); + })($nesting[0], $nesting) + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/abstract_node"] = function(Opal) { + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + function $rb_plus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); + } + function $rb_lt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $hash2 = Opal.hash2, $truthy = Opal.truthy, $send = Opal.send; + + Opal.add_stubs(['$include', '$attr_reader', '$attr_accessor', '$==', '$document', '$to_s', '$key?', '$dup', '$[]', '$raise', '$converter', '$attributes', '$nil?', '$[]=', '$-', '$delete', '$+', '$update', '$nil_or_empty?', '$split', '$include?', '$empty?', '$join', '$apply_reftext_subs', '$attr?', '$extname', '$attr', '$image_uri', '$<', '$safe', '$uriish?', '$uri_encode_spaces', '$normalize_web_path', '$generate_data_uri_from_uri', '$generate_data_uri', '$slice', '$length', '$normalize_system_path', '$readable?', '$strict_encode64', '$binread', '$warn', '$logger', '$require_library', '$!', '$open', '$content_type', '$read', '$base_dir', '$root?', '$path_resolver', '$system_path', '$web_path', '$===', '$!=', '$normalize_lines_array', '$to_a', '$each_line', '$open_uri', '$fetch', '$read_asset', '$gsub']); + return (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + (function($base, $super, $parent_nesting) { + function $AbstractNode(){}; + var self = $AbstractNode = $klass($base, $super, 'AbstractNode', $AbstractNode); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_AbstractNode_initialize_1, TMP_AbstractNode_block$q_2, TMP_AbstractNode_inline$q_3, TMP_AbstractNode_converter_4, TMP_AbstractNode_parent$eq_5, TMP_AbstractNode_attr_6, TMP_AbstractNode_attr$q_7, TMP_AbstractNode_set_attr_8, TMP_AbstractNode_remove_attr_9, TMP_AbstractNode_option$q_10, TMP_AbstractNode_set_option_11, TMP_AbstractNode_update_attributes_12, TMP_AbstractNode_role_13, TMP_AbstractNode_roles_14, TMP_AbstractNode_role$q_15, TMP_AbstractNode_has_role$q_16, TMP_AbstractNode_add_role_17, TMP_AbstractNode_remove_role_18, TMP_AbstractNode_reftext_19, TMP_AbstractNode_reftext$q_20, TMP_AbstractNode_icon_uri_21, TMP_AbstractNode_image_uri_22, TMP_AbstractNode_media_uri_23, TMP_AbstractNode_generate_data_uri_24, TMP_AbstractNode_generate_data_uri_from_uri_25, TMP_AbstractNode_normalize_asset_path_27, TMP_AbstractNode_normalize_system_path_28, TMP_AbstractNode_normalize_web_path_29, TMP_AbstractNode_read_asset_30, TMP_AbstractNode_read_contents_32, TMP_AbstractNode_uri_encode_spaces_35, TMP_AbstractNode_is_uri$q_36; + + def.document = def.attributes = def.parent = nil; + + self.$include($$($nesting, 'Logging')); + self.$include($$($nesting, 'Substitutors')); + self.$attr_reader("attributes"); + self.$attr_reader("context"); + self.$attr_reader("document"); + self.$attr_accessor("id"); + self.$attr_reader("node_name"); + self.$attr_reader("parent"); + + Opal.def(self, '$initialize', TMP_AbstractNode_initialize_1 = function $$initialize(parent, context, opts) { + var $a, self = this; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + if (context['$==']("document")) { + $a = [self, nil], (self.document = $a[0]), (self.parent = $a[1]), $a + } else if ($truthy(parent)) { + $a = [parent.$document(), parent], (self.document = $a[0]), (self.parent = $a[1]), $a + } else { + self.document = (self.parent = nil) + }; + self.node_name = (self.context = context).$to_s(); + self.attributes = (function() {if ($truthy(opts['$key?']("attributes"))) { + return opts['$[]']("attributes").$dup() + } else { + return $hash2([], {}) + }; return nil; })(); + return (self.passthroughs = $hash2([], {})); + }, TMP_AbstractNode_initialize_1.$$arity = -3); + + Opal.def(self, '$block?', TMP_AbstractNode_block$q_2 = function() { + var self = this; + + return self.$raise($$$('::', 'NotImplementedError')) + }, TMP_AbstractNode_block$q_2.$$arity = 0); + + Opal.def(self, '$inline?', TMP_AbstractNode_inline$q_3 = function() { + var self = this; + + return self.$raise($$$('::', 'NotImplementedError')) + }, TMP_AbstractNode_inline$q_3.$$arity = 0); + + Opal.def(self, '$converter', TMP_AbstractNode_converter_4 = function $$converter() { + var self = this; + + return self.document.$converter() + }, TMP_AbstractNode_converter_4.$$arity = 0); + + Opal.def(self, '$parent=', TMP_AbstractNode_parent$eq_5 = function(parent) { + var $a, self = this; + + return $a = [parent, parent.$document()], (self.parent = $a[0]), (self.document = $a[1]), $a + }, TMP_AbstractNode_parent$eq_5.$$arity = 1); + + Opal.def(self, '$attr', TMP_AbstractNode_attr_6 = function $$attr(name, default_val, inherit) { + var $a, $b, self = this; + + + + if (default_val == null) { + default_val = nil; + }; + + if (inherit == null) { + inherit = true; + }; + name = name.$to_s(); + return ($truthy($a = self.attributes['$[]'](name)) ? $a : (function() {if ($truthy(($truthy($b = inherit) ? self.parent : $b))) { + return ($truthy($b = self.document.$attributes()['$[]'](name)) ? $b : default_val) + } else { + return default_val + }; return nil; })()); + }, TMP_AbstractNode_attr_6.$$arity = -2); + + Opal.def(self, '$attr?', TMP_AbstractNode_attr$q_7 = function(name, expect_val, inherit) { + var $a, $b, $c, self = this; + + + + if (expect_val == null) { + expect_val = nil; + }; + + if (inherit == null) { + inherit = true; + }; + name = name.$to_s(); + if ($truthy(expect_val['$nil?']())) { + return ($truthy($a = self.attributes['$key?'](name)) ? $a : ($truthy($b = ($truthy($c = inherit) ? self.parent : $c)) ? self.document.$attributes()['$key?'](name) : $b)) + } else { + return expect_val['$=='](($truthy($a = self.attributes['$[]'](name)) ? $a : (function() {if ($truthy(($truthy($b = inherit) ? self.parent : $b))) { + return self.document.$attributes()['$[]'](name) + } else { + return nil + }; return nil; })())) + }; + }, TMP_AbstractNode_attr$q_7.$$arity = -2); + + Opal.def(self, '$set_attr', TMP_AbstractNode_set_attr_8 = function $$set_attr(name, value, overwrite) { + var $a, self = this, $writer = nil; + + + + if (value == null) { + value = ""; + }; + + if (overwrite == null) { + overwrite = true; + }; + if ($truthy((($a = overwrite['$=='](false)) ? self.attributes['$key?'](name) : overwrite['$=='](false)))) { + return false + } else { + + + $writer = [name, value]; + $send(self.attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + return true; + }; + }, TMP_AbstractNode_set_attr_8.$$arity = -2); + + Opal.def(self, '$remove_attr', TMP_AbstractNode_remove_attr_9 = function $$remove_attr(name) { + var self = this; + + return self.attributes.$delete(name) + }, TMP_AbstractNode_remove_attr_9.$$arity = 1); + + Opal.def(self, '$option?', TMP_AbstractNode_option$q_10 = function(name) { + var self = this; + + return self.attributes['$key?']("" + (name) + "-option") + }, TMP_AbstractNode_option$q_10.$$arity = 1); + + Opal.def(self, '$set_option', TMP_AbstractNode_set_option_11 = function $$set_option(name) { + var self = this, attrs = nil, key = nil, $writer = nil; + + if ($truthy((attrs = self.attributes)['$[]']("options"))) { + if ($truthy(attrs['$[]']((key = "" + (name) + "-option")))) { + return nil + } else { + + + $writer = ["options", $rb_plus(attrs['$[]']("options"), "" + "," + (name))]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = [key, ""]; + $send(attrs, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];; + } + } else { + + + $writer = ["options", name]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["" + (name) + "-option", ""]; + $send(attrs, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];; + } + }, TMP_AbstractNode_set_option_11.$$arity = 1); + + Opal.def(self, '$update_attributes', TMP_AbstractNode_update_attributes_12 = function $$update_attributes(attributes) { + var self = this; + + + self.attributes.$update(attributes); + return nil; + }, TMP_AbstractNode_update_attributes_12.$$arity = 1); + + Opal.def(self, '$role', TMP_AbstractNode_role_13 = function $$role() { + var $a, self = this; + + return ($truthy($a = self.attributes['$[]']("role")) ? $a : self.document.$attributes()['$[]']("role")) + }, TMP_AbstractNode_role_13.$$arity = 0); + + Opal.def(self, '$roles', TMP_AbstractNode_roles_14 = function $$roles() { + var $a, self = this, val = nil; + + if ($truthy((val = ($truthy($a = self.attributes['$[]']("role")) ? $a : self.document.$attributes()['$[]']("role")))['$nil_or_empty?']())) { + return [] + } else { + return val.$split() + } + }, TMP_AbstractNode_roles_14.$$arity = 0); + + Opal.def(self, '$role?', TMP_AbstractNode_role$q_15 = function(expect_val) { + var $a, self = this; + + + + if (expect_val == null) { + expect_val = nil; + }; + if ($truthy(expect_val)) { + return expect_val['$=='](($truthy($a = self.attributes['$[]']("role")) ? $a : self.document.$attributes()['$[]']("role"))) + } else { + return ($truthy($a = self.attributes['$key?']("role")) ? $a : self.document.$attributes()['$key?']("role")) + }; + }, TMP_AbstractNode_role$q_15.$$arity = -1); + + Opal.def(self, '$has_role?', TMP_AbstractNode_has_role$q_16 = function(name) { + var $a, self = this, val = nil; + + if ($truthy((val = ($truthy($a = self.attributes['$[]']("role")) ? $a : self.document.$attributes()['$[]']("role"))))) { + return ((("" + " ") + (val)) + " ")['$include?']("" + " " + (name) + " ") + } else { + return false + } + }, TMP_AbstractNode_has_role$q_16.$$arity = 1); + + Opal.def(self, '$add_role', TMP_AbstractNode_add_role_17 = function $$add_role(name) { + var self = this, val = nil, $writer = nil; + + if ($truthy((val = self.attributes['$[]']("role"))['$nil_or_empty?']())) { + + + $writer = ["role", name]; + $send(self.attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + return true; + } else if ($truthy(((("" + " ") + (val)) + " ")['$include?']("" + " " + (name) + " "))) { + return false + } else { + + + $writer = ["role", "" + (val) + " " + (name)]; + $send(self.attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + return true; + } + }, TMP_AbstractNode_add_role_17.$$arity = 1); + + Opal.def(self, '$remove_role', TMP_AbstractNode_remove_role_18 = function $$remove_role(name) { + var self = this, val = nil, $writer = nil; + + if ($truthy((val = self.attributes['$[]']("role"))['$nil_or_empty?']())) { + return false + } else if ($truthy((val = val.$split()).$delete(name))) { + + if ($truthy(val['$empty?']())) { + self.attributes.$delete("role") + } else { + + $writer = ["role", val.$join(" ")]; + $send(self.attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + return true; + } else { + return false + } + }, TMP_AbstractNode_remove_role_18.$$arity = 1); + + Opal.def(self, '$reftext', TMP_AbstractNode_reftext_19 = function $$reftext() { + var self = this, val = nil; + + if ($truthy((val = self.attributes['$[]']("reftext")))) { + + return self.$apply_reftext_subs(val); + } else { + return nil + } + }, TMP_AbstractNode_reftext_19.$$arity = 0); + + Opal.def(self, '$reftext?', TMP_AbstractNode_reftext$q_20 = function() { + var self = this; + + return self.attributes['$key?']("reftext") + }, TMP_AbstractNode_reftext$q_20.$$arity = 0); + + Opal.def(self, '$icon_uri', TMP_AbstractNode_icon_uri_21 = function $$icon_uri(name) { + var self = this, icon = nil; + + + if ($truthy(self['$attr?']("icon"))) { + if ($truthy($$$('::', 'File').$extname((icon = self.$attr("icon")))['$empty?']())) { + icon = "" + (icon) + "." + (self.document.$attr("icontype", "png"))} + } else { + icon = "" + (name) + "." + (self.document.$attr("icontype", "png")) + }; + return self.$image_uri(icon, "iconsdir"); + }, TMP_AbstractNode_icon_uri_21.$$arity = 1); + + Opal.def(self, '$image_uri', TMP_AbstractNode_image_uri_22 = function $$image_uri(target_image, asset_dir_key) { + var $a, $b, $c, $d, self = this, doc = nil, images_base = nil; + + + + if (asset_dir_key == null) { + asset_dir_key = "imagesdir"; + }; + if ($truthy(($truthy($a = $rb_lt((doc = self.document).$safe(), $$$($$($nesting, 'SafeMode'), 'SECURE'))) ? doc['$attr?']("data-uri") : $a))) { + if ($truthy(($truthy($a = ($truthy($b = $$($nesting, 'Helpers')['$uriish?'](target_image)) ? (target_image = self.$uri_encode_spaces(target_image)) : $b)) ? $a : ($truthy($b = ($truthy($c = ($truthy($d = asset_dir_key) ? (images_base = doc.$attr(asset_dir_key)) : $d)) ? $$($nesting, 'Helpers')['$uriish?'](images_base) : $c)) ? (target_image = self.$normalize_web_path(target_image, images_base, false)) : $b)))) { + if ($truthy(doc['$attr?']("allow-uri-read"))) { + return self.$generate_data_uri_from_uri(target_image, doc['$attr?']("cache-uri")) + } else { + return target_image + } + } else { + return self.$generate_data_uri(target_image, asset_dir_key) + } + } else { + return self.$normalize_web_path(target_image, (function() {if ($truthy(asset_dir_key)) { + + return doc.$attr(asset_dir_key); + } else { + return nil + }; return nil; })()) + }; + }, TMP_AbstractNode_image_uri_22.$$arity = -2); + + Opal.def(self, '$media_uri', TMP_AbstractNode_media_uri_23 = function $$media_uri(target, asset_dir_key) { + var self = this; + + + + if (asset_dir_key == null) { + asset_dir_key = "imagesdir"; + }; + return self.$normalize_web_path(target, (function() {if ($truthy(asset_dir_key)) { + return self.document.$attr(asset_dir_key) + } else { + return nil + }; return nil; })()); + }, TMP_AbstractNode_media_uri_23.$$arity = -2); + + Opal.def(self, '$generate_data_uri', TMP_AbstractNode_generate_data_uri_24 = function $$generate_data_uri(target_image, asset_dir_key) { + var self = this, ext = nil, mimetype = nil, image_path = nil; + + + + if (asset_dir_key == null) { + asset_dir_key = nil; + }; + ext = $$$('::', 'File').$extname(target_image); + mimetype = (function() {if (ext['$=='](".svg")) { + return "image/svg+xml" + } else { + return "" + "image/" + (ext.$slice(1, ext.$length())) + }; return nil; })(); + if ($truthy(asset_dir_key)) { + image_path = self.$normalize_system_path(target_image, self.document.$attr(asset_dir_key), nil, $hash2(["target_name"], {"target_name": "image"})) + } else { + image_path = self.$normalize_system_path(target_image) + }; + if ($truthy($$$('::', 'File')['$readable?'](image_path))) { + return "" + "data:" + (mimetype) + ";base64," + ($$$('::', 'Base64').$strict_encode64($$$('::', 'IO').$binread(image_path))) + } else { + + self.$logger().$warn("" + "image to embed not found or not readable: " + (image_path)); + return "" + "data:" + (mimetype) + ";base64,"; + }; + }, TMP_AbstractNode_generate_data_uri_24.$$arity = -2); + + Opal.def(self, '$generate_data_uri_from_uri', TMP_AbstractNode_generate_data_uri_from_uri_25 = function $$generate_data_uri_from_uri(image_uri, cache_uri) { + var TMP_26, self = this, mimetype = nil, bindata = nil; + + + + if (cache_uri == null) { + cache_uri = false; + }; + if ($truthy(cache_uri)) { + $$($nesting, 'Helpers').$require_library("open-uri/cached", "open-uri-cached") + } else if ($truthy($$$('::', 'RUBY_ENGINE_OPAL')['$!']())) { + $$$('::', 'OpenURI')}; + + try { + + mimetype = nil; + bindata = $send(self, 'open', [image_uri, "rb"], (TMP_26 = function(f){var self = TMP_26.$$s || this; + + + + if (f == null) { + f = nil; + }; + mimetype = f.$content_type(); + return f.$read();}, TMP_26.$$s = self, TMP_26.$$arity = 1, TMP_26)); + return "" + "data:" + (mimetype) + ";base64," + ($$$('::', 'Base64').$strict_encode64(bindata)); + } catch ($err) { + if (Opal.rescue($err, [$$($nesting, 'StandardError')])) { + try { + + self.$logger().$warn("" + "could not retrieve image data from URI: " + (image_uri)); + return image_uri; + } finally { Opal.pop_exception() } + } else { throw $err; } + };; + }, TMP_AbstractNode_generate_data_uri_from_uri_25.$$arity = -2); + + Opal.def(self, '$normalize_asset_path', TMP_AbstractNode_normalize_asset_path_27 = function $$normalize_asset_path(asset_ref, asset_name, autocorrect) { + var self = this; + + + + if (asset_name == null) { + asset_name = "path"; + }; + + if (autocorrect == null) { + autocorrect = true; + }; + return self.$normalize_system_path(asset_ref, self.document.$base_dir(), nil, $hash2(["target_name", "recover"], {"target_name": asset_name, "recover": autocorrect})); + }, TMP_AbstractNode_normalize_asset_path_27.$$arity = -2); + + Opal.def(self, '$normalize_system_path', TMP_AbstractNode_normalize_system_path_28 = function $$normalize_system_path(target, start, jail, opts) { + var self = this, doc = nil; + + + + if (start == null) { + start = nil; + }; + + if (jail == null) { + jail = nil; + }; + + if (opts == null) { + opts = $hash2([], {}); + }; + if ($truthy($rb_lt((doc = self.document).$safe(), $$$($$($nesting, 'SafeMode'), 'SAFE')))) { + if ($truthy(start)) { + if ($truthy(doc.$path_resolver()['$root?'](start))) { + } else { + start = $$$('::', 'File').$join(doc.$base_dir(), start) + } + } else { + start = doc.$base_dir() + } + } else { + + if ($truthy(start)) { + } else { + start = doc.$base_dir() + }; + if ($truthy(jail)) { + } else { + jail = doc.$base_dir() + }; + }; + return doc.$path_resolver().$system_path(target, start, jail, opts); + }, TMP_AbstractNode_normalize_system_path_28.$$arity = -2); + + Opal.def(self, '$normalize_web_path', TMP_AbstractNode_normalize_web_path_29 = function $$normalize_web_path(target, start, preserve_uri_target) { + var $a, self = this; + + + + if (start == null) { + start = nil; + }; + + if (preserve_uri_target == null) { + preserve_uri_target = true; + }; + if ($truthy(($truthy($a = preserve_uri_target) ? $$($nesting, 'Helpers')['$uriish?'](target) : $a))) { + return self.$uri_encode_spaces(target) + } else { + return self.document.$path_resolver().$web_path(target, start) + }; + }, TMP_AbstractNode_normalize_web_path_29.$$arity = -2); + + Opal.def(self, '$read_asset', TMP_AbstractNode_read_asset_30 = function $$read_asset(path, opts) { + var TMP_31, $a, self = this; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + if ($truthy($$$('::', 'Hash')['$==='](opts))) { + } else { + opts = $hash2(["warn_on_failure"], {"warn_on_failure": opts['$!='](false)}) + }; + if ($truthy($$$('::', 'File')['$readable?'](path))) { + if ($truthy(opts['$[]']("normalize"))) { + return $$($nesting, 'Helpers').$normalize_lines_array($send($$$('::', 'File'), 'open', [path, "rb"], (TMP_31 = function(f){var self = TMP_31.$$s || this; + + + + if (f == null) { + f = nil; + }; + return f.$each_line().$to_a();}, TMP_31.$$s = self, TMP_31.$$arity = 1, TMP_31))).$join($$($nesting, 'LF')) + } else { + return $$$('::', 'IO').$read(path) + } + } else if ($truthy(opts['$[]']("warn_on_failure"))) { + + self.$logger().$warn("" + (($truthy($a = self.$attr("docfile")) ? $a : "")) + ": " + (($truthy($a = opts['$[]']("label")) ? $a : "file")) + " does not exist or cannot be read: " + (path)); + return nil; + } else { + return nil + }; + }, TMP_AbstractNode_read_asset_30.$$arity = -2); + + Opal.def(self, '$read_contents', TMP_AbstractNode_read_contents_32 = function $$read_contents(target, opts) { + var $a, $b, $c, TMP_33, TMP_34, self = this, doc = nil, start = nil; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + doc = self.document; + if ($truthy(($truthy($a = $$($nesting, 'Helpers')['$uriish?'](target)) ? $a : ($truthy($b = ($truthy($c = (start = opts['$[]']("start"))) ? $$($nesting, 'Helpers')['$uriish?'](start) : $c)) ? (target = doc.$path_resolver().$web_path(target, start)) : $b)))) { + if ($truthy(doc['$attr?']("allow-uri-read"))) { + + if ($truthy(doc['$attr?']("cache-uri"))) { + $$($nesting, 'Helpers').$require_library("open-uri/cached", "open-uri-cached")}; + + try { + if ($truthy(opts['$[]']("normalize"))) { + return $$($nesting, 'Helpers').$normalize_lines_array($send($$$('::', 'OpenURI'), 'open_uri', [target], (TMP_33 = function(f){var self = TMP_33.$$s || this; + + + + if (f == null) { + f = nil; + }; + return f.$each_line().$to_a();}, TMP_33.$$s = self, TMP_33.$$arity = 1, TMP_33))).$join($$($nesting, 'LF')) + } else { + return $send($$$('::', 'OpenURI'), 'open_uri', [target], (TMP_34 = function(f){var self = TMP_34.$$s || this; + + + + if (f == null) { + f = nil; + }; + return f.$read();}, TMP_34.$$s = self, TMP_34.$$arity = 1, TMP_34)) + } + } catch ($err) { + if (Opal.rescue($err, [$$($nesting, 'StandardError')])) { + try { + + if ($truthy(opts.$fetch("warn_on_failure", true))) { + self.$logger().$warn("" + "could not retrieve contents of " + (($truthy($a = opts['$[]']("label")) ? $a : "asset")) + " at URI: " + (target))}; + return nil; + } finally { Opal.pop_exception() } + } else { throw $err; } + };; + } else { + + if ($truthy(opts.$fetch("warn_on_failure", true))) { + self.$logger().$warn("" + "cannot retrieve contents of " + (($truthy($a = opts['$[]']("label")) ? $a : "asset")) + " at URI: " + (target) + " (allow-uri-read attribute not enabled)")}; + return nil; + } + } else { + + target = self.$normalize_system_path(target, opts['$[]']("start"), nil, $hash2(["target_name"], {"target_name": ($truthy($a = opts['$[]']("label")) ? $a : "asset")})); + return self.$read_asset(target, $hash2(["normalize", "warn_on_failure", "label"], {"normalize": opts['$[]']("normalize"), "warn_on_failure": opts.$fetch("warn_on_failure", true), "label": opts['$[]']("label")})); + }; + }, TMP_AbstractNode_read_contents_32.$$arity = -2); + + Opal.def(self, '$uri_encode_spaces', TMP_AbstractNode_uri_encode_spaces_35 = function $$uri_encode_spaces(str) { + var self = this; + + if ($truthy(str['$include?'](" "))) { + + return str.$gsub(" ", "%20"); + } else { + return str + } + }, TMP_AbstractNode_uri_encode_spaces_35.$$arity = 1); + return (Opal.def(self, '$is_uri?', TMP_AbstractNode_is_uri$q_36 = function(str) { + var self = this; + + return $$($nesting, 'Helpers')['$uriish?'](str) + }, TMP_AbstractNode_is_uri$q_36.$$arity = 1), nil) && 'is_uri?'; + })($nesting[0], null, $nesting) + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/abstract_block"] = function(Opal) { + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + function $rb_gt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); + } + function $rb_plus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $hash2 = Opal.hash2, $send = Opal.send, $truthy = Opal.truthy; + + Opal.add_stubs(['$attr_reader', '$attr_writer', '$attr_accessor', '$==', '$!=', '$level', '$file', '$lineno', '$playback_attributes', '$convert', '$converter', '$join', '$map', '$to_s', '$parent', '$parent=', '$-', '$<<', '$!', '$empty?', '$>', '$find_by_internal', '$to_proc', '$[]', '$has_role?', '$replace', '$raise', '$===', '$header?', '$each', '$flatten', '$context', '$blocks', '$+', '$find_index', '$next_adjacent_block', '$select', '$sub_specialchars', '$match?', '$sub_replacements', '$title', '$apply_title_subs', '$include?', '$delete', '$reftext', '$sprintf', '$sub_quotes', '$compat_mode', '$attributes', '$chomp', '$increment_and_store_counter', '$index=', '$numbered', '$sectname', '$counter', '$numeral=', '$numeral', '$caption=', '$assign_numeral', '$reindex_sections']); + return (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + (function($base, $super, $parent_nesting) { + function $AbstractBlock(){}; + var self = $AbstractBlock = $klass($base, $super, 'AbstractBlock', $AbstractBlock); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_AbstractBlock_initialize_1, TMP_AbstractBlock_block$q_2, TMP_AbstractBlock_inline$q_3, TMP_AbstractBlock_file_4, TMP_AbstractBlock_lineno_5, TMP_AbstractBlock_convert_6, TMP_AbstractBlock_content_7, TMP_AbstractBlock_context$eq_9, TMP_AbstractBlock_$lt$lt_10, TMP_AbstractBlock_blocks$q_11, TMP_AbstractBlock_sections$q_12, TMP_AbstractBlock_find_by_13, TMP_AbstractBlock_find_by_internal_14, TMP_AbstractBlock_next_adjacent_block_17, TMP_AbstractBlock_sections_18, TMP_AbstractBlock_alt_20, TMP_AbstractBlock_caption_21, TMP_AbstractBlock_captioned_title_22, TMP_AbstractBlock_list_marker_keyword_23, TMP_AbstractBlock_title_24, TMP_AbstractBlock_title$q_25, TMP_AbstractBlock_title$eq_26, TMP_AbstractBlock_sub$q_27, TMP_AbstractBlock_remove_sub_28, TMP_AbstractBlock_xreftext_29, TMP_AbstractBlock_assign_caption_30, TMP_AbstractBlock_assign_numeral_31, TMP_AbstractBlock_reindex_sections_32; + + def.source_location = def.document = def.attributes = def.blocks = def.next_section_index = def.context = def.style = def.id = def.header = def.caption = def.title_converted = def.converted_title = def.title = def.subs = def.numeral = def.next_section_ordinal = nil; + + self.$attr_reader("blocks"); + self.$attr_writer("caption"); + self.$attr_accessor("content_model"); + self.$attr_accessor("level"); + self.$attr_accessor("numeral"); + Opal.alias(self, "number", "numeral"); + Opal.alias(self, "number=", "numeral="); + self.$attr_accessor("source_location"); + self.$attr_accessor("style"); + self.$attr_reader("subs"); + + Opal.def(self, '$initialize', TMP_AbstractBlock_initialize_1 = function $$initialize(parent, context, opts) { + var $a, $iter = TMP_AbstractBlock_initialize_1.$$p, $yield = $iter || nil, self = this, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_AbstractBlock_initialize_1.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + + + if (opts == null) { + opts = $hash2([], {}); + }; + $send(self, Opal.find_super_dispatcher(self, 'initialize', TMP_AbstractBlock_initialize_1, false), $zuper, $iter); + self.content_model = "compound"; + self.blocks = []; + self.subs = []; + self.id = (self.title = (self.title_converted = (self.caption = (self.numeral = (self.style = (self.default_subs = (self.source_location = nil))))))); + if (context['$==']("document")) { + self.level = 0 + } else if ($truthy(($truthy($a = parent) ? context['$!=']("section") : $a))) { + self.level = parent.$level() + } else { + self.level = nil + }; + self.next_section_index = 0; + return (self.next_section_ordinal = 1); + }, TMP_AbstractBlock_initialize_1.$$arity = -3); + + Opal.def(self, '$block?', TMP_AbstractBlock_block$q_2 = function() { + var self = this; + + return true + }, TMP_AbstractBlock_block$q_2.$$arity = 0); + + Opal.def(self, '$inline?', TMP_AbstractBlock_inline$q_3 = function() { + var self = this; + + return false + }, TMP_AbstractBlock_inline$q_3.$$arity = 0); + + Opal.def(self, '$file', TMP_AbstractBlock_file_4 = function $$file() { + var $a, self = this; + + return ($truthy($a = self.source_location) ? self.source_location.$file() : $a) + }, TMP_AbstractBlock_file_4.$$arity = 0); + + Opal.def(self, '$lineno', TMP_AbstractBlock_lineno_5 = function $$lineno() { + var $a, self = this; + + return ($truthy($a = self.source_location) ? self.source_location.$lineno() : $a) + }, TMP_AbstractBlock_lineno_5.$$arity = 0); + + Opal.def(self, '$convert', TMP_AbstractBlock_convert_6 = function $$convert() { + var self = this; + + + self.document.$playback_attributes(self.attributes); + return self.$converter().$convert(self); + }, TMP_AbstractBlock_convert_6.$$arity = 0); + Opal.alias(self, "render", "convert"); + + Opal.def(self, '$content', TMP_AbstractBlock_content_7 = function $$content() { + var TMP_8, self = this; + + return $send(self.blocks, 'map', [], (TMP_8 = function(b){var self = TMP_8.$$s || this; + + + + if (b == null) { + b = nil; + }; + return b.$convert();}, TMP_8.$$s = self, TMP_8.$$arity = 1, TMP_8)).$join($$($nesting, 'LF')) + }, TMP_AbstractBlock_content_7.$$arity = 0); + + Opal.def(self, '$context=', TMP_AbstractBlock_context$eq_9 = function(context) { + var self = this; + + return (self.node_name = (self.context = context).$to_s()) + }, TMP_AbstractBlock_context$eq_9.$$arity = 1); + + Opal.def(self, '$<<', TMP_AbstractBlock_$lt$lt_10 = function(block) { + var self = this, $writer = nil; + + + if (block.$parent()['$=='](self)) { + } else { + + $writer = [self]; + $send(block, 'parent=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + self.blocks['$<<'](block); + return self; + }, TMP_AbstractBlock_$lt$lt_10.$$arity = 1); + Opal.alias(self, "append", "<<"); + + Opal.def(self, '$blocks?', TMP_AbstractBlock_blocks$q_11 = function() { + var self = this; + + return self.blocks['$empty?']()['$!']() + }, TMP_AbstractBlock_blocks$q_11.$$arity = 0); + + Opal.def(self, '$sections?', TMP_AbstractBlock_sections$q_12 = function() { + var self = this; + + return $rb_gt(self.next_section_index, 0) + }, TMP_AbstractBlock_sections$q_12.$$arity = 0); + + Opal.def(self, '$find_by', TMP_AbstractBlock_find_by_13 = function $$find_by(selector) { + var $iter = TMP_AbstractBlock_find_by_13.$$p, block = $iter || nil, self = this, result = nil; + + if ($iter) TMP_AbstractBlock_find_by_13.$$p = null; + + + if ($iter) TMP_AbstractBlock_find_by_13.$$p = null;; + + if (selector == null) { + selector = $hash2([], {}); + }; + try { + return $send(self, 'find_by_internal', [selector, (result = [])], block.$to_proc()) + } catch ($err) { + if (Opal.rescue($err, [$$$('::', 'StopIteration')])) { + try { + return result + } finally { Opal.pop_exception() } + } else { throw $err; } + }; + }, TMP_AbstractBlock_find_by_13.$$arity = -1); + Opal.alias(self, "query", "find_by"); + + Opal.def(self, '$find_by_internal', TMP_AbstractBlock_find_by_internal_14 = function $$find_by_internal(selector, result) { + var $iter = TMP_AbstractBlock_find_by_internal_14.$$p, block = $iter || nil, $a, $b, $c, $d, TMP_15, TMP_16, self = this, any_context = nil, context_selector = nil, style_selector = nil, role_selector = nil, id_selector = nil, verdict = nil, $case = nil; + + if ($iter) TMP_AbstractBlock_find_by_internal_14.$$p = null; + + + if ($iter) TMP_AbstractBlock_find_by_internal_14.$$p = null;; + + if (selector == null) { + selector = $hash2([], {}); + }; + + if (result == null) { + result = []; + }; + if ($truthy(($truthy($a = ($truthy($b = ($truthy($c = ($truthy($d = (any_context = (context_selector = selector['$[]']("context"))['$!']())) ? $d : context_selector['$=='](self.context))) ? ($truthy($d = (style_selector = selector['$[]']("style"))['$!']()) ? $d : style_selector['$=='](self.style)) : $c)) ? ($truthy($c = (role_selector = selector['$[]']("role"))['$!']()) ? $c : self['$has_role?'](role_selector)) : $b)) ? ($truthy($b = (id_selector = selector['$[]']("id"))['$!']()) ? $b : id_selector['$=='](self.id)) : $a))) { + if ($truthy(id_selector)) { + + result.$replace((function() {if ((block !== nil)) { + + if ($truthy(Opal.yield1(block, self))) { + return [self] + } else { + return [] + }; + } else { + return [self] + }; return nil; })()); + self.$raise($$$('::', 'StopIteration')); + } else if ((block !== nil)) { + if ($truthy((verdict = Opal.yield1(block, self)))) { + $case = verdict; + if ("skip_children"['$===']($case)) { + result['$<<'](self); + return result;} + else if ("skip"['$===']($case)) {return result} + else {result['$<<'](self)}} + } else { + result['$<<'](self) + }}; + if ($truthy(($truthy($a = (($b = self.context['$==']("document")) ? ($truthy($c = any_context) ? $c : context_selector['$==']("section")) : self.context['$==']("document"))) ? self['$header?']() : $a))) { + $send(self.header, 'find_by_internal', [selector, result], block.$to_proc())}; + if (context_selector['$==']("document")) { + } else if (self.context['$==']("dlist")) { + if ($truthy(($truthy($a = any_context) ? $a : context_selector['$!=']("section")))) { + $send(self.blocks.$flatten(), 'each', [], (TMP_15 = function(li){var self = TMP_15.$$s || this; + + + + if (li == null) { + li = nil; + }; + if ($truthy(li)) { + return $send(li, 'find_by_internal', [selector, result], block.$to_proc()) + } else { + return nil + };}, TMP_15.$$s = self, TMP_15.$$arity = 1, TMP_15))} + } else if ($truthy($send(self.blocks, 'each', [], (TMP_16 = function(b){var self = TMP_16.$$s || this, $e; + + + + if (b == null) { + b = nil; + }; + if ($truthy((($e = context_selector['$==']("section")) ? b.$context()['$!=']("section") : context_selector['$==']("section")))) { + return nil;}; + return $send(b, 'find_by_internal', [selector, result], block.$to_proc());}, TMP_16.$$s = self, TMP_16.$$arity = 1, TMP_16)))) {}; + return result; + }, TMP_AbstractBlock_find_by_internal_14.$$arity = -1); + + Opal.def(self, '$next_adjacent_block', TMP_AbstractBlock_next_adjacent_block_17 = function $$next_adjacent_block() { + var self = this, sib = nil, p = nil; + + if (self.context['$==']("document")) { + return nil + } else if ($truthy((sib = (p = self.$parent()).$blocks()['$[]']($rb_plus(p.$blocks().$find_index(self), 1))))) { + return sib + } else { + return p.$next_adjacent_block() + } + }, TMP_AbstractBlock_next_adjacent_block_17.$$arity = 0); + + Opal.def(self, '$sections', TMP_AbstractBlock_sections_18 = function $$sections() { + var TMP_19, self = this; + + return $send(self.blocks, 'select', [], (TMP_19 = function(block){var self = TMP_19.$$s || this; + + + + if (block == null) { + block = nil; + }; + return block.$context()['$==']("section");}, TMP_19.$$s = self, TMP_19.$$arity = 1, TMP_19)) + }, TMP_AbstractBlock_sections_18.$$arity = 0); + + Opal.def(self, '$alt', TMP_AbstractBlock_alt_20 = function $$alt() { + var self = this, text = nil; + + if ($truthy((text = self.attributes['$[]']("alt")))) { + if (text['$=='](self.attributes['$[]']("default-alt"))) { + return self.$sub_specialchars(text) + } else { + + text = self.$sub_specialchars(text); + if ($truthy($$($nesting, 'ReplaceableTextRx')['$match?'](text))) { + + return self.$sub_replacements(text); + } else { + return text + }; + } + } else { + return nil + } + }, TMP_AbstractBlock_alt_20.$$arity = 0); + + Opal.def(self, '$caption', TMP_AbstractBlock_caption_21 = function $$caption() { + var self = this; + + if (self.context['$==']("admonition")) { + return self.attributes['$[]']("textlabel") + } else { + return self.caption + } + }, TMP_AbstractBlock_caption_21.$$arity = 0); + + Opal.def(self, '$captioned_title', TMP_AbstractBlock_captioned_title_22 = function $$captioned_title() { + var self = this; + + return "" + (self.caption) + (self.$title()) + }, TMP_AbstractBlock_captioned_title_22.$$arity = 0); + + Opal.def(self, '$list_marker_keyword', TMP_AbstractBlock_list_marker_keyword_23 = function $$list_marker_keyword(list_type) { + var $a, self = this; + + + + if (list_type == null) { + list_type = nil; + }; + return $$($nesting, 'ORDERED_LIST_KEYWORDS')['$[]'](($truthy($a = list_type) ? $a : self.style)); + }, TMP_AbstractBlock_list_marker_keyword_23.$$arity = -1); + + Opal.def(self, '$title', TMP_AbstractBlock_title_24 = function $$title() { + var $a, $b, self = this; + + if ($truthy(self.title_converted)) { + return self.converted_title + } else { + + return (self.converted_title = ($truthy($a = ($truthy($b = (self.title_converted = true)) ? self.title : $b)) ? self.$apply_title_subs(self.title) : $a)); + } + }, TMP_AbstractBlock_title_24.$$arity = 0); + + Opal.def(self, '$title?', TMP_AbstractBlock_title$q_25 = function() { + var self = this; + + if ($truthy(self.title)) { + return true + } else { + return false + } + }, TMP_AbstractBlock_title$q_25.$$arity = 0); + + Opal.def(self, '$title=', TMP_AbstractBlock_title$eq_26 = function(val) { + var $a, self = this; + + return $a = [val, nil], (self.title = $a[0]), (self.title_converted = $a[1]), $a + }, TMP_AbstractBlock_title$eq_26.$$arity = 1); + + Opal.def(self, '$sub?', TMP_AbstractBlock_sub$q_27 = function(name) { + var self = this; + + return self.subs['$include?'](name) + }, TMP_AbstractBlock_sub$q_27.$$arity = 1); + + Opal.def(self, '$remove_sub', TMP_AbstractBlock_remove_sub_28 = function $$remove_sub(sub) { + var self = this; + + + self.subs.$delete(sub); + return nil; + }, TMP_AbstractBlock_remove_sub_28.$$arity = 1); + + Opal.def(self, '$xreftext', TMP_AbstractBlock_xreftext_29 = function $$xreftext(xrefstyle) { + var $a, $b, self = this, val = nil, $case = nil, quoted_title = nil, prefix = nil; + + + + if (xrefstyle == null) { + xrefstyle = nil; + }; + if ($truthy(($truthy($a = (val = self.$reftext())) ? val['$empty?']()['$!']() : $a))) { + return val + } else if ($truthy(($truthy($a = ($truthy($b = xrefstyle) ? self.title : $b)) ? self.caption : $a))) { + return (function() {$case = xrefstyle; + if ("full"['$===']($case)) { + quoted_title = self.$sprintf(self.$sub_quotes((function() {if ($truthy(self.document.$compat_mode())) { + return "``%s''" + } else { + return "\"`%s`\"" + }; return nil; })()), self.$title()); + if ($truthy(($truthy($a = self.numeral) ? (prefix = self.document.$attributes()['$[]']((function() {if (self.context['$==']("image")) { + return "figure-caption" + } else { + return "" + (self.context) + "-caption" + }; return nil; })())) : $a))) { + return "" + (prefix) + " " + (self.numeral) + ", " + (quoted_title) + } else { + return "" + (self.caption.$chomp(". ")) + ", " + (quoted_title) + };} + else if ("short"['$===']($case)) {if ($truthy(($truthy($a = self.numeral) ? (prefix = self.document.$attributes()['$[]']((function() {if (self.context['$==']("image")) { + return "figure-caption" + } else { + return "" + (self.context) + "-caption" + }; return nil; })())) : $a))) { + return "" + (prefix) + " " + (self.numeral) + } else { + return self.caption.$chomp(". ") + }} + else {return self.$title()}})() + } else { + return self.$title() + }; + }, TMP_AbstractBlock_xreftext_29.$$arity = -1); + + Opal.def(self, '$assign_caption', TMP_AbstractBlock_assign_caption_30 = function $$assign_caption(value, key) { + var $a, $b, self = this, prefix = nil; + + + + if (value == null) { + value = nil; + }; + + if (key == null) { + key = nil; + }; + if ($truthy(($truthy($a = ($truthy($b = self.caption) ? $b : self.title['$!']())) ? $a : (self.caption = ($truthy($b = value) ? $b : self.document.$attributes()['$[]']("caption")))))) { + return nil + } else if ($truthy((prefix = self.document.$attributes()['$[]']("" + ((key = ($truthy($a = key) ? $a : self.context))) + "-caption")))) { + + self.caption = "" + (prefix) + " " + ((self.numeral = self.document.$increment_and_store_counter("" + (key) + "-number", self))) + ". "; + return nil; + } else { + return nil + }; + }, TMP_AbstractBlock_assign_caption_30.$$arity = -1); + + Opal.def(self, '$assign_numeral', TMP_AbstractBlock_assign_numeral_31 = function $$assign_numeral(section) { + var $a, self = this, $writer = nil, like = nil, sectname = nil, caption = nil; + + + self.next_section_index = $rb_plus((($writer = [self.next_section_index]), $send(section, 'index=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]), 1); + if ($truthy((like = section.$numbered()))) { + if ((sectname = section.$sectname())['$==']("appendix")) { + + + $writer = [self.document.$counter("appendix-number", "A")]; + $send(section, 'numeral=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + if ($truthy((caption = self.document.$attributes()['$[]']("appendix-caption")))) { + + $writer = ["" + (caption) + " " + (section.$numeral()) + ": "]; + $send(section, 'caption=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + } else { + + $writer = ["" + (section.$numeral()) + ". "]; + $send(section, 'caption=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + } else if ($truthy(($truthy($a = sectname['$==']("chapter")) ? $a : like['$==']("chapter")))) { + + $writer = [self.document.$counter("chapter-number", 1)]; + $send(section, 'numeral=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + } else { + + + $writer = [self.next_section_ordinal]; + $send(section, 'numeral=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + self.next_section_ordinal = $rb_plus(self.next_section_ordinal, 1); + }}; + return nil; + }, TMP_AbstractBlock_assign_numeral_31.$$arity = 1); + return (Opal.def(self, '$reindex_sections', TMP_AbstractBlock_reindex_sections_32 = function $$reindex_sections() { + var TMP_33, self = this; + + + self.next_section_index = 0; + self.next_section_ordinal = 1; + return $send(self.blocks, 'each', [], (TMP_33 = function(block){var self = TMP_33.$$s || this; + + + + if (block == null) { + block = nil; + }; + if (block.$context()['$==']("section")) { + + self.$assign_numeral(block); + return block.$reindex_sections(); + } else { + return nil + };}, TMP_33.$$s = self, TMP_33.$$arity = 1, TMP_33)); + }, TMP_AbstractBlock_reindex_sections_32.$$arity = 0), nil) && 'reindex_sections'; + })($nesting[0], $$($nesting, 'AbstractNode'), $nesting) + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/attribute_list"] = function(Opal) { + function $rb_plus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); + } + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + function $rb_times(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs * rhs : lhs['$*'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $hash = Opal.hash, $hash2 = Opal.hash2, $truthy = Opal.truthy, $send = Opal.send; + + Opal.add_stubs(['$new', '$[]', '$update', '$parse', '$parse_attribute', '$eos?', '$skip_delimiter', '$+', '$rekey', '$each_with_index', '$[]=', '$-', '$skip_blank', '$==', '$peek', '$parse_attribute_value', '$get_byte', '$start_with?', '$scan_name', '$!', '$!=', '$*', '$scan_to_delimiter', '$===', '$include?', '$delete', '$each', '$split', '$empty?', '$strip', '$apply_subs', '$scan_to_quote', '$gsub', '$skip', '$scan']); + return (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + (function($base, $super, $parent_nesting) { + function $AttributeList(){}; + var self = $AttributeList = $klass($base, $super, 'AttributeList', $AttributeList); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_AttributeList_initialize_1, TMP_AttributeList_parse_into_2, TMP_AttributeList_parse_3, TMP_AttributeList_rekey_4, TMP_AttributeList_rekey_5, TMP_AttributeList_parse_attribute_7, TMP_AttributeList_parse_attribute_value_9, TMP_AttributeList_skip_blank_10, TMP_AttributeList_skip_delimiter_11, TMP_AttributeList_scan_name_12, TMP_AttributeList_scan_to_delimiter_13, TMP_AttributeList_scan_to_quote_14; + + def.attributes = def.scanner = def.delimiter = def.block = def.delimiter_skip_pattern = def.delimiter_boundary_pattern = nil; + + Opal.const_set($nesting[0], 'BACKSLASH', "\\"); + Opal.const_set($nesting[0], 'APOS', "'"); + Opal.const_set($nesting[0], 'BoundaryRxs', $hash("\"", /.*?[^\\](?=")/, $$($nesting, 'APOS'), /.*?[^\\](?=')/, ",", /.*?(?=[ \t]*(,|$))/)); + Opal.const_set($nesting[0], 'EscapedQuotes', $hash("\"", "\\\"", $$($nesting, 'APOS'), "\\'")); + Opal.const_set($nesting[0], 'NameRx', new RegExp("" + ($$($nesting, 'CG_WORD')) + "[" + ($$($nesting, 'CC_WORD')) + "\\-.]*")); + Opal.const_set($nesting[0], 'BlankRx', /[ \t]+/); + Opal.const_set($nesting[0], 'SkipRxs', $hash2(["blank", ","], {"blank": $$($nesting, 'BlankRx'), ",": /[ \t]*(,|$)/})); + + Opal.def(self, '$initialize', TMP_AttributeList_initialize_1 = function $$initialize(source, block, delimiter) { + var self = this; + + + + if (block == null) { + block = nil; + }; + + if (delimiter == null) { + delimiter = ","; + }; + self.scanner = $$$('::', 'StringScanner').$new(source); + self.block = block; + self.delimiter = delimiter; + self.delimiter_skip_pattern = $$($nesting, 'SkipRxs')['$[]'](delimiter); + self.delimiter_boundary_pattern = $$($nesting, 'BoundaryRxs')['$[]'](delimiter); + return (self.attributes = nil); + }, TMP_AttributeList_initialize_1.$$arity = -2); + + Opal.def(self, '$parse_into', TMP_AttributeList_parse_into_2 = function $$parse_into(attributes, posattrs) { + var self = this; + + + + if (posattrs == null) { + posattrs = []; + }; + return attributes.$update(self.$parse(posattrs)); + }, TMP_AttributeList_parse_into_2.$$arity = -2); + + Opal.def(self, '$parse', TMP_AttributeList_parse_3 = function $$parse(posattrs) { + var $a, self = this, index = nil; + + + + if (posattrs == null) { + posattrs = []; + }; + if ($truthy(self.attributes)) { + return self.attributes}; + self.attributes = $hash2([], {}); + index = 0; + while ($truthy(self.$parse_attribute(index, posattrs))) { + + if ($truthy(self.scanner['$eos?']())) { + break;}; + self.$skip_delimiter(); + index = $rb_plus(index, 1); + }; + return self.attributes; + }, TMP_AttributeList_parse_3.$$arity = -1); + + Opal.def(self, '$rekey', TMP_AttributeList_rekey_4 = function $$rekey(posattrs) { + var self = this; + + return $$($nesting, 'AttributeList').$rekey(self.attributes, posattrs) + }, TMP_AttributeList_rekey_4.$$arity = 1); + Opal.defs(self, '$rekey', TMP_AttributeList_rekey_5 = function $$rekey(attributes, pos_attrs) { + var TMP_6, self = this; + + + $send(pos_attrs, 'each_with_index', [], (TMP_6 = function(key, index){var self = TMP_6.$$s || this, pos = nil, val = nil, $writer = nil; + + + + if (key == null) { + key = nil; + }; + + if (index == null) { + index = nil; + }; + if ($truthy(key)) { + } else { + return nil; + }; + pos = $rb_plus(index, 1); + if ($truthy((val = attributes['$[]'](pos)))) { + + $writer = [key, val]; + $send(attributes, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + } else { + return nil + };}, TMP_6.$$s = self, TMP_6.$$arity = 2, TMP_6)); + return attributes; + }, TMP_AttributeList_rekey_5.$$arity = 2); + + Opal.def(self, '$parse_attribute', TMP_AttributeList_parse_attribute_7 = function $$parse_attribute(index, pos_attrs) { + var $a, TMP_8, self = this, single_quoted_value = nil, first = nil, name = nil, value = nil, skipped = nil, c = nil, $case = nil, $writer = nil, resolved_name = nil, pos_name = nil; + + + + if (index == null) { + index = 0; + }; + + if (pos_attrs == null) { + pos_attrs = []; + }; + single_quoted_value = false; + self.$skip_blank(); + if ((first = self.scanner.$peek(1))['$==']("\"")) { + + name = self.$parse_attribute_value(self.scanner.$get_byte()); + value = nil; + } else if (first['$==']($$($nesting, 'APOS'))) { + + name = self.$parse_attribute_value(self.scanner.$get_byte()); + value = nil; + if ($truthy(name['$start_with?']($$($nesting, 'APOS')))) { + } else { + single_quoted_value = true + }; + } else { + + name = self.$scan_name(); + skipped = 0; + c = nil; + if ($truthy(self.scanner['$eos?']())) { + if ($truthy(name)) { + } else { + return false + } + } else { + + skipped = ($truthy($a = self.$skip_blank()) ? $a : 0); + c = self.scanner.$get_byte(); + }; + if ($truthy(($truthy($a = c['$!']()) ? $a : c['$=='](self.delimiter)))) { + value = nil + } else if ($truthy(($truthy($a = c['$!=']("=")) ? $a : name['$!']()))) { + + name = "" + (name) + ($rb_times(" ", skipped)) + (c) + (self.$scan_to_delimiter()); + value = nil; + } else { + + self.$skip_blank(); + if ($truthy(self.scanner.$peek(1))) { + if ((c = self.scanner.$get_byte())['$==']("\"")) { + value = self.$parse_attribute_value(c) + } else if (c['$==']($$($nesting, 'APOS'))) { + + value = self.$parse_attribute_value(c); + if ($truthy(value['$start_with?']($$($nesting, 'APOS')))) { + } else { + single_quoted_value = true + }; + } else if (c['$=='](self.delimiter)) { + value = "" + } else { + + value = "" + (c) + (self.$scan_to_delimiter()); + if (value['$==']("None")) { + return true}; + }}; + }; + }; + if ($truthy(value)) { + $case = name; + if ("options"['$===']($case) || "opts"['$===']($case)) { + if ($truthy(value['$include?'](","))) { + + if ($truthy(value['$include?'](" "))) { + value = value.$delete(" ")}; + $send(value.$split(","), 'each', [], (TMP_8 = function(opt){var self = TMP_8.$$s || this, $writer = nil; + if (self.attributes == null) self.attributes = nil; + + + + if (opt == null) { + opt = nil; + }; + if ($truthy(opt['$empty?']())) { + return nil + } else { + + $writer = ["" + (opt) + "-option", ""]; + $send(self.attributes, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + };}, TMP_8.$$s = self, TMP_8.$$arity = 1, TMP_8)); + } else { + + $writer = ["" + ((value = value.$strip())) + "-option", ""]; + $send(self.attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + + $writer = ["options", value]; + $send(self.attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];;} + else {if ($truthy(($truthy($a = single_quoted_value) ? self.block : $a))) { + $case = name; + if ("title"['$===']($case) || "reftext"['$===']($case)) { + $writer = [name, value]; + $send(self.attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];} + else { + $writer = [name, self.block.$apply_subs(value)]; + $send(self.attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];} + } else { + + $writer = [name, value]; + $send(self.attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }} + } else { + + resolved_name = (function() {if ($truthy(($truthy($a = single_quoted_value) ? self.block : $a))) { + + return self.block.$apply_subs(name); + } else { + return name + }; return nil; })(); + if ($truthy((pos_name = pos_attrs['$[]'](index)))) { + + $writer = [pos_name, resolved_name]; + $send(self.attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + + $writer = [$rb_plus(index, 1), resolved_name]; + $send(self.attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + }; + return true; + }, TMP_AttributeList_parse_attribute_7.$$arity = -1); + + Opal.def(self, '$parse_attribute_value', TMP_AttributeList_parse_attribute_value_9 = function $$parse_attribute_value(quote) { + var self = this, value = nil; + + + if (self.scanner.$peek(1)['$=='](quote)) { + + self.scanner.$get_byte(); + return "";}; + if ($truthy((value = self.$scan_to_quote(quote)))) { + + self.scanner.$get_byte(); + if ($truthy(value['$include?']($$($nesting, 'BACKSLASH')))) { + return value.$gsub($$($nesting, 'EscapedQuotes')['$[]'](quote), quote) + } else { + return value + }; + } else { + return "" + (quote) + (self.$scan_to_delimiter()) + }; + }, TMP_AttributeList_parse_attribute_value_9.$$arity = 1); + + Opal.def(self, '$skip_blank', TMP_AttributeList_skip_blank_10 = function $$skip_blank() { + var self = this; + + return self.scanner.$skip($$($nesting, 'BlankRx')) + }, TMP_AttributeList_skip_blank_10.$$arity = 0); + + Opal.def(self, '$skip_delimiter', TMP_AttributeList_skip_delimiter_11 = function $$skip_delimiter() { + var self = this; + + return self.scanner.$skip(self.delimiter_skip_pattern) + }, TMP_AttributeList_skip_delimiter_11.$$arity = 0); + + Opal.def(self, '$scan_name', TMP_AttributeList_scan_name_12 = function $$scan_name() { + var self = this; + + return self.scanner.$scan($$($nesting, 'NameRx')) + }, TMP_AttributeList_scan_name_12.$$arity = 0); + + Opal.def(self, '$scan_to_delimiter', TMP_AttributeList_scan_to_delimiter_13 = function $$scan_to_delimiter() { + var self = this; + + return self.scanner.$scan(self.delimiter_boundary_pattern) + }, TMP_AttributeList_scan_to_delimiter_13.$$arity = 0); + return (Opal.def(self, '$scan_to_quote', TMP_AttributeList_scan_to_quote_14 = function $$scan_to_quote(quote) { + var self = this; + + return self.scanner.$scan($$($nesting, 'BoundaryRxs')['$[]'](quote)) + }, TMP_AttributeList_scan_to_quote_14.$$arity = 1), nil) && 'scan_to_quote'; + })($nesting[0], null, $nesting) + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/block"] = function(Opal) { + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + function $rb_lt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $send = Opal.send, $hash2 = Opal.hash2, $truthy = Opal.truthy; + + Opal.add_stubs(['$default=', '$-', '$attr_accessor', '$[]', '$key?', '$==', '$===', '$drop', '$delete', '$[]=', '$lock_in_subs', '$nil_or_empty?', '$normalize_lines_from_string', '$apply_subs', '$join', '$<', '$size', '$empty?', '$rstrip', '$shift', '$pop', '$warn', '$logger', '$to_s', '$class', '$object_id', '$inspect']); + return (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + (function($base, $super, $parent_nesting) { + function $Block(){}; + var self = $Block = $klass($base, $super, 'Block', $Block); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Block_initialize_1, TMP_Block_content_2, TMP_Block_source_3, TMP_Block_to_s_4, $writer = nil; + + def.attributes = def.content_model = def.lines = def.subs = def.blocks = def.context = def.style = nil; + + + $writer = ["simple"]; + $send(Opal.const_set($nesting[0], 'DEFAULT_CONTENT_MODEL', $hash2(["audio", "image", "listing", "literal", "stem", "open", "page_break", "pass", "thematic_break", "video"], {"audio": "empty", "image": "empty", "listing": "verbatim", "literal": "verbatim", "stem": "raw", "open": "compound", "page_break": "empty", "pass": "raw", "thematic_break": "empty", "video": "empty"})), 'default=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + Opal.alias(self, "blockname", "context"); + self.$attr_accessor("lines"); + + Opal.def(self, '$initialize', TMP_Block_initialize_1 = function $$initialize(parent, context, opts) { + var $a, $iter = TMP_Block_initialize_1.$$p, $yield = $iter || nil, self = this, subs = nil, $writer = nil, raw_source = nil, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_Block_initialize_1.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + + + if (opts == null) { + opts = $hash2([], {}); + }; + $send(self, Opal.find_super_dispatcher(self, 'initialize', TMP_Block_initialize_1, false), $zuper, $iter); + self.content_model = ($truthy($a = opts['$[]']("content_model")) ? $a : $$($nesting, 'DEFAULT_CONTENT_MODEL')['$[]'](context)); + if ($truthy(opts['$key?']("subs"))) { + if ($truthy((subs = opts['$[]']("subs")))) { + + if (subs['$==']("default")) { + self.default_subs = opts['$[]']("default_subs") + } else if ($truthy($$$('::', 'Array')['$==='](subs))) { + + self.default_subs = subs.$drop(0); + self.attributes.$delete("subs"); + } else { + + self.default_subs = nil; + + $writer = ["subs", "" + (subs)]; + $send(self.attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + }; + self.$lock_in_subs(); + } else { + + self.default_subs = []; + self.attributes.$delete("subs"); + } + } else { + self.default_subs = nil + }; + if ($truthy((raw_source = opts['$[]']("source"))['$nil_or_empty?']())) { + return (self.lines = []) + } else if ($truthy($$$('::', 'String')['$==='](raw_source))) { + return (self.lines = $$($nesting, 'Helpers').$normalize_lines_from_string(raw_source)) + } else { + return (self.lines = raw_source.$drop(0)) + }; + }, TMP_Block_initialize_1.$$arity = -3); + + Opal.def(self, '$content', TMP_Block_content_2 = function $$content() { + var $a, $b, $iter = TMP_Block_content_2.$$p, $yield = $iter || nil, self = this, $case = nil, result = nil, first = nil, last = nil, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_Block_content_2.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + return (function() {$case = self.content_model; + if ("compound"['$===']($case)) {return $send(self, Opal.find_super_dispatcher(self, 'content', TMP_Block_content_2, false), $zuper, $iter)} + else if ("simple"['$===']($case)) {return self.$apply_subs(self.lines.$join($$($nesting, 'LF')), self.subs)} + else if ("verbatim"['$===']($case) || "raw"['$===']($case)) { + result = self.$apply_subs(self.lines, self.subs); + if ($truthy($rb_lt(result.$size(), 2))) { + return result['$[]'](0) + } else { + + while ($truthy(($truthy($b = (first = result['$[]'](0))) ? first.$rstrip()['$empty?']() : $b))) { + result.$shift() + }; + while ($truthy(($truthy($b = (last = result['$[]'](-1))) ? last.$rstrip()['$empty?']() : $b))) { + result.$pop() + }; + return result.$join($$($nesting, 'LF')); + };} + else { + if (self.content_model['$==']("empty")) { + } else { + self.$logger().$warn("" + "Unknown content model '" + (self.content_model) + "' for block: " + (self.$to_s())) + }; + return nil;}})() + }, TMP_Block_content_2.$$arity = 0); + + Opal.def(self, '$source', TMP_Block_source_3 = function $$source() { + var self = this; + + return self.lines.$join($$($nesting, 'LF')) + }, TMP_Block_source_3.$$arity = 0); + return (Opal.def(self, '$to_s', TMP_Block_to_s_4 = function $$to_s() { + var self = this, content_summary = nil; + + + content_summary = (function() {if (self.content_model['$==']("compound")) { + return "" + "blocks: " + (self.blocks.$size()) + } else { + return "" + "lines: " + (self.lines.$size()) + }; return nil; })(); + return "" + "#<" + (self.$class()) + "@" + (self.$object_id()) + " {context: " + (self.context.$inspect()) + ", content_model: " + (self.content_model.$inspect()) + ", style: " + (self.style.$inspect()) + ", " + (content_summary) + "}>"; + }, TMP_Block_to_s_4.$$arity = 0), nil) && 'to_s'; + })($nesting[0], $$($nesting, 'AbstractBlock'), $nesting) + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/callouts"] = function(Opal) { + function $rb_plus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); + } + function $rb_le(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs <= rhs : lhs['$<='](rhs); + } + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + function $rb_lt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $hash2 = Opal.hash2, $truthy = Opal.truthy, $send = Opal.send; + + Opal.add_stubs(['$next_list', '$<<', '$current_list', '$to_i', '$generate_next_callout_id', '$+', '$<=', '$size', '$[]', '$-', '$chop', '$join', '$map', '$==', '$<', '$generate_callout_id']); + return (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + (function($base, $super, $parent_nesting) { + function $Callouts(){}; + var self = $Callouts = $klass($base, $super, 'Callouts', $Callouts); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Callouts_initialize_1, TMP_Callouts_register_2, TMP_Callouts_read_next_id_3, TMP_Callouts_callout_ids_4, TMP_Callouts_current_list_6, TMP_Callouts_next_list_7, TMP_Callouts_rewind_8, TMP_Callouts_generate_next_callout_id_9, TMP_Callouts_generate_callout_id_10; + + def.co_index = def.lists = def.list_index = nil; + + + Opal.def(self, '$initialize', TMP_Callouts_initialize_1 = function $$initialize() { + var self = this; + + + self.lists = []; + self.list_index = 0; + return self.$next_list(); + }, TMP_Callouts_initialize_1.$$arity = 0); + + Opal.def(self, '$register', TMP_Callouts_register_2 = function $$register(li_ordinal) { + var self = this, id = nil; + + + self.$current_list()['$<<']($hash2(["ordinal", "id"], {"ordinal": li_ordinal.$to_i(), "id": (id = self.$generate_next_callout_id())})); + self.co_index = $rb_plus(self.co_index, 1); + return id; + }, TMP_Callouts_register_2.$$arity = 1); + + Opal.def(self, '$read_next_id', TMP_Callouts_read_next_id_3 = function $$read_next_id() { + var self = this, id = nil, list = nil; + + + id = nil; + list = self.$current_list(); + if ($truthy($rb_le(self.co_index, list.$size()))) { + id = list['$[]']($rb_minus(self.co_index, 1))['$[]']("id")}; + self.co_index = $rb_plus(self.co_index, 1); + return id; + }, TMP_Callouts_read_next_id_3.$$arity = 0); + + Opal.def(self, '$callout_ids', TMP_Callouts_callout_ids_4 = function $$callout_ids(li_ordinal) { + var TMP_5, self = this; + + return $send(self.$current_list(), 'map', [], (TMP_5 = function(it){var self = TMP_5.$$s || this; + + + + if (it == null) { + it = nil; + }; + if (it['$[]']("ordinal")['$=='](li_ordinal)) { + return "" + (it['$[]']("id")) + " " + } else { + return "" + };}, TMP_5.$$s = self, TMP_5.$$arity = 1, TMP_5)).$join().$chop() + }, TMP_Callouts_callout_ids_4.$$arity = 1); + + Opal.def(self, '$current_list', TMP_Callouts_current_list_6 = function $$current_list() { + var self = this; + + return self.lists['$[]']($rb_minus(self.list_index, 1)) + }, TMP_Callouts_current_list_6.$$arity = 0); + + Opal.def(self, '$next_list', TMP_Callouts_next_list_7 = function $$next_list() { + var self = this; + + + self.list_index = $rb_plus(self.list_index, 1); + if ($truthy($rb_lt(self.lists.$size(), self.list_index))) { + self.lists['$<<']([])}; + self.co_index = 1; + return nil; + }, TMP_Callouts_next_list_7.$$arity = 0); + + Opal.def(self, '$rewind', TMP_Callouts_rewind_8 = function $$rewind() { + var self = this; + + + self.list_index = 1; + self.co_index = 1; + return nil; + }, TMP_Callouts_rewind_8.$$arity = 0); + + Opal.def(self, '$generate_next_callout_id', TMP_Callouts_generate_next_callout_id_9 = function $$generate_next_callout_id() { + var self = this; + + return self.$generate_callout_id(self.list_index, self.co_index) + }, TMP_Callouts_generate_next_callout_id_9.$$arity = 0); + return (Opal.def(self, '$generate_callout_id', TMP_Callouts_generate_callout_id_10 = function $$generate_callout_id(list_index, co_index) { + var self = this; + + return "" + "CO" + (list_index) + "-" + (co_index) + }, TMP_Callouts_generate_callout_id_10.$$arity = 2), nil) && 'generate_callout_id'; + })($nesting[0], null, $nesting) + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/converter/base"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $hash2 = Opal.hash2, $truthy = Opal.truthy; + + Opal.add_stubs(['$include', '$node_name', '$empty?', '$send', '$content']); + return (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + + (function($base, $parent_nesting) { + function $Converter() {}; + var self = $Converter = $module($base, 'Converter', $Converter); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + nil + })($nesting[0], $nesting); + (function($base, $super, $parent_nesting) { + function $Base(){}; + var self = $Base = $klass($base, $super, 'Base', $Base); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + + self.$include($$($nesting, 'Logging')); + return self.$include($$($nesting, 'Converter')); + })($$($nesting, 'Converter'), null, $nesting); + (function($base, $super, $parent_nesting) { + function $BuiltIn(){}; + var self = $BuiltIn = $klass($base, $super, 'BuiltIn', $BuiltIn); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_BuiltIn_initialize_1, TMP_BuiltIn_convert_2, TMP_BuiltIn_content_3, TMP_BuiltIn_skip_4; + + + self.$include($$($nesting, 'Logging')); + + Opal.def(self, '$initialize', TMP_BuiltIn_initialize_1 = function $$initialize(backend, opts) { + var self = this; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + return nil; + }, TMP_BuiltIn_initialize_1.$$arity = -2); + + Opal.def(self, '$convert', TMP_BuiltIn_convert_2 = function $$convert(node, transform, opts) { + var $a, self = this; + + + + if (transform == null) { + transform = nil; + }; + + if (opts == null) { + opts = $hash2([], {}); + }; + transform = ($truthy($a = transform) ? $a : node.$node_name()); + if ($truthy(opts['$empty?']())) { + + return self.$send(transform, node); + } else { + + return self.$send(transform, node, opts); + }; + }, TMP_BuiltIn_convert_2.$$arity = -2); + Opal.alias(self, "handles?", "respond_to?"); + + Opal.def(self, '$content', TMP_BuiltIn_content_3 = function $$content(node) { + var self = this; + + return node.$content() + }, TMP_BuiltIn_content_3.$$arity = 1); + Opal.alias(self, "pass", "content"); + return (Opal.def(self, '$skip', TMP_BuiltIn_skip_4 = function $$skip(node) { + var self = this; + + return nil + }, TMP_BuiltIn_skip_4.$$arity = 1), nil) && 'skip'; + })($$($nesting, 'Converter'), null, $nesting); + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/converter/factory"] = function(Opal) { + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $truthy = Opal.truthy, $hash2 = Opal.hash2, $send = Opal.send; + + Opal.add_stubs(['$new', '$require', '$include?', '$include', '$warn', '$logger', '$register', '$default', '$resolve', '$create', '$converters', '$unregister_all', '$attr_reader', '$each', '$[]=', '$-', '$==', '$[]', '$clear', '$===', '$supports_templates?', '$to_s', '$key?']); + return (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + (function($base, $parent_nesting) { + function $Converter() {}; + var self = $Converter = $module($base, 'Converter', $Converter); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + (function($base, $super, $parent_nesting) { + function $Factory(){}; + var self = $Factory = $klass($base, $super, 'Factory', $Factory); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Factory_initialize_7, TMP_Factory_register_8, TMP_Factory_resolve_10, TMP_Factory_unregister_all_11, TMP_Factory_create_12; + + def.converters = def.star_converter = nil; + + self.__default__ = nil; + (function(self, $parent_nesting) { + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_default_1, TMP_register_2, TMP_resolve_3, TMP_create_4, TMP_converters_5, TMP_unregister_all_6; + + + + Opal.def(self, '$default', TMP_default_1 = function(initialize_singleton) { + var $a, $b, $c, self = this; + if (self.__default__ == null) self.__default__ = nil; + + + + if (initialize_singleton == null) { + initialize_singleton = true; + }; + if ($truthy(initialize_singleton)) { + } else { + return ($truthy($a = self.__default__) ? $a : self.$new()) + }; + return (self.__default__ = ($truthy($a = self.__default__) ? $a : (function() { try { + + if ($truthy((($c = $$$('::', 'Concurrent', 'skip_raise')) && ($b = $$$($c, 'Hash', 'skip_raise')) ? 'constant' : nil))) { + } else { + self.$require((function() {if ($truthy($$$('::', 'RUBY_MIN_VERSION_1_9'))) { + return "concurrent/hash" + } else { + return "asciidoctor/core_ext/1.8.7/concurrent/hash" + }; return nil; })()) + }; + return self.$new($$$($$$('::', 'Concurrent'), 'Hash').$new()); + } catch ($err) { + if (Opal.rescue($err, [$$$('::', 'LoadError')])) { + try { + + if ($truthy(self['$include?']($$($nesting, 'Logging')))) { + } else { + self.$include($$($nesting, 'Logging')) + }; + self.$logger().$warn("gem 'concurrent-ruby' is not installed. This gem is recommended when registering custom converters."); + return self.$new(); + } finally { Opal.pop_exception() } + } else { throw $err; } + }})())); + }, TMP_default_1.$$arity = -1); + + Opal.def(self, '$register', TMP_register_2 = function $$register(converter, backends) { + var self = this; + + + + if (backends == null) { + backends = ["*"]; + }; + return self.$default().$register(converter, backends); + }, TMP_register_2.$$arity = -2); + + Opal.def(self, '$resolve', TMP_resolve_3 = function $$resolve(backend) { + var self = this; + + return self.$default().$resolve(backend) + }, TMP_resolve_3.$$arity = 1); + + Opal.def(self, '$create', TMP_create_4 = function $$create(backend, opts) { + var self = this; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + return self.$default().$create(backend, opts); + }, TMP_create_4.$$arity = -2); + + Opal.def(self, '$converters', TMP_converters_5 = function $$converters() { + var self = this; + + return self.$default().$converters() + }, TMP_converters_5.$$arity = 0); + return (Opal.def(self, '$unregister_all', TMP_unregister_all_6 = function $$unregister_all() { + var self = this; + + return self.$default().$unregister_all() + }, TMP_unregister_all_6.$$arity = 0), nil) && 'unregister_all'; + })(Opal.get_singleton_class(self), $nesting); + self.$attr_reader("converters"); + + Opal.def(self, '$initialize', TMP_Factory_initialize_7 = function $$initialize(converters) { + var $a, self = this; + + + + if (converters == null) { + converters = nil; + }; + self.converters = ($truthy($a = converters) ? $a : $hash2([], {})); + return (self.star_converter = nil); + }, TMP_Factory_initialize_7.$$arity = -1); + + Opal.def(self, '$register', TMP_Factory_register_8 = function $$register(converter, backends) { + var TMP_9, self = this; + + + + if (backends == null) { + backends = ["*"]; + }; + $send(backends, 'each', [], (TMP_9 = function(backend){var self = TMP_9.$$s || this, $writer = nil; + if (self.converters == null) self.converters = nil; + + + + if (backend == null) { + backend = nil; + }; + + $writer = [backend, converter]; + $send(self.converters, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + if (backend['$==']("*")) { + return (self.star_converter = converter) + } else { + return nil + };}, TMP_9.$$s = self, TMP_9.$$arity = 1, TMP_9)); + return nil; + }, TMP_Factory_register_8.$$arity = -2); + + Opal.def(self, '$resolve', TMP_Factory_resolve_10 = function $$resolve(backend) { + var $a, $b, self = this; + + return ($truthy($a = self.converters) ? ($truthy($b = self.converters['$[]'](backend)) ? $b : self.star_converter) : $a) + }, TMP_Factory_resolve_10.$$arity = 1); + + Opal.def(self, '$unregister_all', TMP_Factory_unregister_all_11 = function $$unregister_all() { + var self = this; + + + self.converters.$clear(); + return (self.star_converter = nil); + }, TMP_Factory_unregister_all_11.$$arity = 0); + return (Opal.def(self, '$create', TMP_Factory_create_12 = function $$create(backend, opts) { + var $a, $b, $c, $d, $e, $f, $g, $h, $i, $j, $k, $l, $m, $n, $o, $p, $q, $r, self = this, converter = nil, base_converter = nil, $case = nil, template_converter = nil; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + if ($truthy((converter = self.$resolve(backend)))) { + + base_converter = (function() {if ($truthy($$$('::', 'Class')['$==='](converter))) { + + return converter.$new(backend, opts); + } else { + return converter + }; return nil; })(); + if ($truthy(($truthy($a = $$$($$($nesting, 'Converter'), 'BackendInfo')['$==='](base_converter)) ? base_converter['$supports_templates?']() : $a))) { + } else { + return base_converter + }; + } else { + $case = backend; + if ("html5"['$===']($case)) { + if ($truthy((($c = $$$('::', 'Asciidoctor', 'skip_raise')) && ($b = $$$($c, 'Converter', 'skip_raise')) && ($a = $$$($b, 'Html5Converter', 'skip_raise')) ? 'constant' : nil))) { + } else { + self.$require("asciidoctor/converter/html5".$to_s()) + }; + base_converter = $$($nesting, 'Html5Converter').$new(backend, opts);} + else if ("docbook5"['$===']($case)) { + if ($truthy((($f = $$$('::', 'Asciidoctor', 'skip_raise')) && ($e = $$$($f, 'Converter', 'skip_raise')) && ($d = $$$($e, 'DocBook5Converter', 'skip_raise')) ? 'constant' : nil))) { + } else { + self.$require("asciidoctor/converter/docbook5".$to_s()) + }; + base_converter = $$($nesting, 'DocBook5Converter').$new(backend, opts);} + else if ("docbook45"['$===']($case)) { + if ($truthy((($i = $$$('::', 'Asciidoctor', 'skip_raise')) && ($h = $$$($i, 'Converter', 'skip_raise')) && ($g = $$$($h, 'DocBook45Converter', 'skip_raise')) ? 'constant' : nil))) { + } else { + self.$require("asciidoctor/converter/docbook45".$to_s()) + }; + base_converter = $$($nesting, 'DocBook45Converter').$new(backend, opts);} + else if ("manpage"['$===']($case)) { + if ($truthy((($l = $$$('::', 'Asciidoctor', 'skip_raise')) && ($k = $$$($l, 'Converter', 'skip_raise')) && ($j = $$$($k, 'ManPageConverter', 'skip_raise')) ? 'constant' : nil))) { + } else { + self.$require("asciidoctor/converter/manpage".$to_s()) + }; + base_converter = $$($nesting, 'ManPageConverter').$new(backend, opts);} + }; + if ($truthy(opts['$key?']("template_dirs"))) { + } else { + return base_converter + }; + if ($truthy((($o = $$$('::', 'Asciidoctor', 'skip_raise')) && ($n = $$$($o, 'Converter', 'skip_raise')) && ($m = $$$($n, 'TemplateConverter', 'skip_raise')) ? 'constant' : nil))) { + } else { + self.$require("asciidoctor/converter/template".$to_s()) + }; + template_converter = $$($nesting, 'TemplateConverter').$new(backend, opts['$[]']("template_dirs"), opts); + if ($truthy((($r = $$$('::', 'Asciidoctor', 'skip_raise')) && ($q = $$$($r, 'Converter', 'skip_raise')) && ($p = $$$($q, 'CompositeConverter', 'skip_raise')) ? 'constant' : nil))) { + } else { + self.$require("asciidoctor/converter/composite".$to_s()) + }; + return $$($nesting, 'CompositeConverter').$new(backend, template_converter, base_converter); + }, TMP_Factory_create_12.$$arity = -2), nil) && 'create'; + })($nesting[0], null, $nesting) + })($nesting[0], $nesting) + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/converter"] = function(Opal) { + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $send = Opal.send, $truthy = Opal.truthy, $hash2 = Opal.hash2; + + Opal.add_stubs(['$register', '$==', '$send', '$include?', '$setup_backend_info', '$raise', '$class', '$sub', '$[]', '$slice', '$length', '$[]=', '$backend_info', '$-', '$extend', '$include', '$respond_to?', '$write', '$chomp', '$require']); + + (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + + (function($base, $parent_nesting) { + function $Converter() {}; + var self = $Converter = $module($base, 'Converter', $Converter); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Converter_initialize_13, TMP_Converter_convert_14; + + + (function($base, $parent_nesting) { + function $Config() {}; + var self = $Config = $module($base, 'Config', $Config); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Config_register_for_1; + + + Opal.def(self, '$register_for', TMP_Config_register_for_1 = function $$register_for($a) { + var $post_args, backends, TMP_2, TMP_3, self = this, metaclass = nil; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + backends = $post_args;; + $$($nesting, 'Factory').$register(self, backends); + metaclass = (function(self, $parent_nesting) { + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return self + })(Opal.get_singleton_class(self), $nesting); + if (backends['$=='](["*"])) { + $send(metaclass, 'send', ["define_method", "converts?"], (TMP_2 = function(name){var self = TMP_2.$$s || this; + + + + if (name == null) { + name = nil; + }; + return true;}, TMP_2.$$s = self, TMP_2.$$arity = 1, TMP_2)) + } else { + $send(metaclass, 'send', ["define_method", "converts?"], (TMP_3 = function(name){var self = TMP_3.$$s || this; + + + + if (name == null) { + name = nil; + }; + return backends['$include?'](name);}, TMP_3.$$s = self, TMP_3.$$arity = 1, TMP_3)) + }; + return nil; + }, TMP_Config_register_for_1.$$arity = -1) + })($nesting[0], $nesting); + (function($base, $parent_nesting) { + function $BackendInfo() {}; + var self = $BackendInfo = $module($base, 'BackendInfo', $BackendInfo); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_BackendInfo_backend_info_4, TMP_BackendInfo_setup_backend_info_5, TMP_BackendInfo_filetype_6, TMP_BackendInfo_basebackend_7, TMP_BackendInfo_outfilesuffix_8, TMP_BackendInfo_htmlsyntax_9, TMP_BackendInfo_supports_templates_10, TMP_BackendInfo_supports_templates$q_11; + + + + Opal.def(self, '$backend_info', TMP_BackendInfo_backend_info_4 = function $$backend_info() { + var $a, self = this; + if (self.backend_info == null) self.backend_info = nil; + + return (self.backend_info = ($truthy($a = self.backend_info) ? $a : self.$setup_backend_info())) + }, TMP_BackendInfo_backend_info_4.$$arity = 0); + + Opal.def(self, '$setup_backend_info', TMP_BackendInfo_setup_backend_info_5 = function $$setup_backend_info() { + var self = this, base = nil, ext = nil, type = nil, syntax = nil; + if (self.backend == null) self.backend = nil; + + + if ($truthy(self.backend)) { + } else { + self.$raise($$$('::', 'ArgumentError'), "" + "Cannot determine backend for converter: " + (self.$class())) + }; + base = self.backend.$sub($$($nesting, 'TrailingDigitsRx'), ""); + if ($truthy((ext = $$($nesting, 'DEFAULT_EXTENSIONS')['$[]'](base)))) { + type = ext.$slice(1, ext.$length()) + } else { + + base = "html"; + ext = ".html"; + type = "html"; + syntax = "html"; + }; + return $hash2(["basebackend", "outfilesuffix", "filetype", "htmlsyntax"], {"basebackend": base, "outfilesuffix": ext, "filetype": type, "htmlsyntax": syntax}); + }, TMP_BackendInfo_setup_backend_info_5.$$arity = 0); + + Opal.def(self, '$filetype', TMP_BackendInfo_filetype_6 = function $$filetype(value) { + var self = this, $writer = nil; + + + + if (value == null) { + value = nil; + }; + if ($truthy(value)) { + + $writer = ["filetype", value]; + $send(self.$backend_info(), '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + } else { + return self.$backend_info()['$[]']("filetype") + }; + }, TMP_BackendInfo_filetype_6.$$arity = -1); + + Opal.def(self, '$basebackend', TMP_BackendInfo_basebackend_7 = function $$basebackend(value) { + var self = this, $writer = nil; + + + + if (value == null) { + value = nil; + }; + if ($truthy(value)) { + + $writer = ["basebackend", value]; + $send(self.$backend_info(), '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + } else { + return self.$backend_info()['$[]']("basebackend") + }; + }, TMP_BackendInfo_basebackend_7.$$arity = -1); + + Opal.def(self, '$outfilesuffix', TMP_BackendInfo_outfilesuffix_8 = function $$outfilesuffix(value) { + var self = this, $writer = nil; + + + + if (value == null) { + value = nil; + }; + if ($truthy(value)) { + + $writer = ["outfilesuffix", value]; + $send(self.$backend_info(), '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + } else { + return self.$backend_info()['$[]']("outfilesuffix") + }; + }, TMP_BackendInfo_outfilesuffix_8.$$arity = -1); + + Opal.def(self, '$htmlsyntax', TMP_BackendInfo_htmlsyntax_9 = function $$htmlsyntax(value) { + var self = this, $writer = nil; + + + + if (value == null) { + value = nil; + }; + if ($truthy(value)) { + + $writer = ["htmlsyntax", value]; + $send(self.$backend_info(), '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + } else { + return self.$backend_info()['$[]']("htmlsyntax") + }; + }, TMP_BackendInfo_htmlsyntax_9.$$arity = -1); + + Opal.def(self, '$supports_templates', TMP_BackendInfo_supports_templates_10 = function $$supports_templates() { + var self = this, $writer = nil; + + + $writer = ["supports_templates", true]; + $send(self.$backend_info(), '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + }, TMP_BackendInfo_supports_templates_10.$$arity = 0); + + Opal.def(self, '$supports_templates?', TMP_BackendInfo_supports_templates$q_11 = function() { + var self = this; + + return self.$backend_info()['$[]']("supports_templates") + }, TMP_BackendInfo_supports_templates$q_11.$$arity = 0); + })($nesting[0], $nesting); + (function(self, $parent_nesting) { + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_included_12; + + return (Opal.def(self, '$included', TMP_included_12 = function $$included(converter) { + var self = this; + + return converter.$extend($$($nesting, 'Config')) + }, TMP_included_12.$$arity = 1), nil) && 'included' + })(Opal.get_singleton_class(self), $nesting); + self.$include($$($nesting, 'Config')); + self.$include($$($nesting, 'BackendInfo')); + + Opal.def(self, '$initialize', TMP_Converter_initialize_13 = function $$initialize(backend, opts) { + var self = this; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + self.backend = backend; + return self.$setup_backend_info(); + }, TMP_Converter_initialize_13.$$arity = -2); + + Opal.def(self, '$convert', TMP_Converter_convert_14 = function $$convert(node, transform, opts) { + var self = this; + + + + if (transform == null) { + transform = nil; + }; + + if (opts == null) { + opts = $hash2([], {}); + }; + return self.$raise($$$('::', 'NotImplementedError')); + }, TMP_Converter_convert_14.$$arity = -2); + Opal.alias(self, "handles?", "respond_to?"); + Opal.alias(self, "convert_with_options", "convert"); + })($nesting[0], $nesting); + (function($base, $parent_nesting) { + function $Writer() {}; + var self = $Writer = $module($base, 'Writer', $Writer); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Writer_write_15; + + + Opal.def(self, '$write', TMP_Writer_write_15 = function $$write(output, target) { + var self = this; + + + if ($truthy(target['$respond_to?']("write"))) { + + target.$write(output.$chomp()); + target.$write($$($nesting, 'LF')); + } else { + $$$('::', 'IO').$write(target, output) + }; + return nil; + }, TMP_Writer_write_15.$$arity = 2) + })($nesting[0], $nesting); + (function($base, $parent_nesting) { + function $VoidWriter() {}; + var self = $VoidWriter = $module($base, 'VoidWriter', $VoidWriter); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_VoidWriter_write_16; + + + self.$include($$($nesting, 'Writer')); + + Opal.def(self, '$write', TMP_VoidWriter_write_16 = function $$write(output, target) { + var self = this; + + return nil + }, TMP_VoidWriter_write_16.$$arity = 2); + })($nesting[0], $nesting); + })($nesting[0], $nesting); + self.$require("asciidoctor/converter/base"); + return self.$require("asciidoctor/converter/factory"); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/document"] = function(Opal) { + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + function $rb_ge(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs >= rhs : lhs['$>='](rhs); + } + function $rb_plus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); + } + function $rb_gt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); + } + function $rb_lt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $send = Opal.send, $truthy = Opal.truthy, $hash2 = Opal.hash2, $gvars = Opal.gvars; + + Opal.add_stubs(['$new', '$attr_reader', '$nil?', '$<<', '$[]', '$[]=', '$-', '$include?', '$strip', '$squeeze', '$gsub', '$empty?', '$!', '$rpartition', '$attr_accessor', '$delete', '$base_dir', '$options', '$inject', '$catalog', '$==', '$dup', '$attributes', '$safe', '$compat_mode', '$sourcemap', '$path_resolver', '$converter', '$extensions', '$each', '$end_with?', '$start_with?', '$slice', '$length', '$chop', '$downcase', '$extname', '$===', '$value_for_name', '$to_s', '$key?', '$freeze', '$attribute_undefined', '$attribute_missing', '$name_for_value', '$expand_path', '$pwd', '$>=', '$+', '$abs', '$to_i', '$delete_if', '$update_doctype_attributes', '$cursor', '$parse', '$restore_attributes', '$update_backend_attributes', '$utc', '$at', '$Integer', '$now', '$index', '$strftime', '$year', '$utc_offset', '$fetch', '$activate', '$create', '$to_proc', '$groups', '$preprocessors?', '$preprocessors', '$process_method', '$tree_processors?', '$tree_processors', '$!=', '$counter', '$nil_or_empty?', '$nextval', '$value', '$save_to', '$chr', '$ord', '$source', '$source_lines', '$doctitle', '$sectname=', '$title=', '$first_section', '$title', '$merge', '$>', '$<', '$find', '$context', '$assign_numeral', '$clear_playback_attributes', '$save_attributes', '$attribute_locked?', '$rewind', '$replace', '$name', '$negate', '$limit_bytesize', '$apply_attribute_value_subs', '$delete?', '$=~', '$apply_subs', '$resolve_pass_subs', '$apply_header_subs', '$create_converter', '$basebackend', '$outfilesuffix', '$filetype', '$sub', '$raise', '$Array', '$backend', '$default', '$start', '$doctype', '$content_model', '$warn', '$logger', '$content', '$convert', '$postprocessors?', '$postprocessors', '$record', '$write', '$respond_to?', '$chomp', '$write_alternate_pages', '$map', '$split', '$resolve_docinfo_subs', '$&', '$normalize_system_path', '$read_asset', '$docinfo_processors?', '$compact', '$join', '$resolve_subs', '$docinfo_processors', '$class', '$object_id', '$inspect', '$size']); + return (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + (function($base, $super, $parent_nesting) { + function $Document(){}; + var self = $Document = $klass($base, $super, 'Document', $Document); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Document_1, TMP_Document_initialize_8, TMP_Document_parse_12, TMP_Document_counter_15, TMP_Document_increment_and_store_counter_16, TMP_Document_nextval_17, TMP_Document_register_18, TMP_Document_footnotes$q_19, TMP_Document_footnotes_20, TMP_Document_callouts_21, TMP_Document_nested$q_22, TMP_Document_embedded$q_23, TMP_Document_extensions$q_24, TMP_Document_source_25, TMP_Document_source_lines_26, TMP_Document_basebackend$q_27, TMP_Document_title_28, TMP_Document_title$eq_29, TMP_Document_doctitle_30, TMP_Document_author_31, TMP_Document_authors_32, TMP_Document_revdate_33, TMP_Document_notitle_34, TMP_Document_noheader_35, TMP_Document_nofooter_36, TMP_Document_first_section_37, TMP_Document_has_header$q_39, TMP_Document_$lt$lt_40, TMP_Document_finalize_header_41, TMP_Document_save_attributes_42, TMP_Document_restore_attributes_44, TMP_Document_clear_playback_attributes_45, TMP_Document_playback_attributes_46, TMP_Document_set_attribute_48, TMP_Document_delete_attribute_49, TMP_Document_attribute_locked$q_50, TMP_Document_set_header_attribute_51, TMP_Document_apply_attribute_value_subs_52, TMP_Document_update_backend_attributes_53, TMP_Document_update_doctype_attributes_54, TMP_Document_create_converter_55, TMP_Document_convert_56, TMP_Document_write_58, TMP_Document_content_59, TMP_Document_docinfo_60, TMP_Document_resolve_docinfo_subs_63, TMP_Document_docinfo_processors$q_64, TMP_Document_to_s_65; + + def.attributes = def.safe = def.sourcemap = def.reader = def.base_dir = def.parsed = def.parent_document = def.extensions = def.options = def.counters = def.catalog = def.header = def.blocks = def.attributes_modified = def.id = def.header_attributes = def.max_attribute_value_size = def.attribute_overrides = def.backend = def.doctype = def.converter = def.timings = def.outfilesuffix = def.docinfo_processor_extensions = def.document = nil; + + Opal.const_set($nesting[0], 'ImageReference', $send($$$('::', 'Struct'), 'new', ["target", "imagesdir"], (TMP_Document_1 = function(){var self = TMP_Document_1.$$s || this; + + return Opal.alias(self, "to_s", "target")}, TMP_Document_1.$$s = self, TMP_Document_1.$$arity = 0, TMP_Document_1))); + Opal.const_set($nesting[0], 'Footnote', $$$('::', 'Struct').$new("index", "id", "text")); + (function($base, $super, $parent_nesting) { + function $AttributeEntry(){}; + var self = $AttributeEntry = $klass($base, $super, 'AttributeEntry', $AttributeEntry); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_AttributeEntry_initialize_2, TMP_AttributeEntry_save_to_3; + + + self.$attr_reader("name", "value", "negate"); + + Opal.def(self, '$initialize', TMP_AttributeEntry_initialize_2 = function $$initialize(name, value, negate) { + var self = this; + + + + if (negate == null) { + negate = nil; + }; + self.name = name; + self.value = value; + return (self.negate = (function() {if ($truthy(negate['$nil?']())) { + return value['$nil?']() + } else { + return negate + }; return nil; })()); + }, TMP_AttributeEntry_initialize_2.$$arity = -3); + return (Opal.def(self, '$save_to', TMP_AttributeEntry_save_to_3 = function $$save_to(block_attributes) { + var $a, self = this, $writer = nil; + + + ($truthy($a = block_attributes['$[]']("attribute_entries")) ? $a : (($writer = ["attribute_entries", []]), $send(block_attributes, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]))['$<<'](self); + return self; + }, TMP_AttributeEntry_save_to_3.$$arity = 1), nil) && 'save_to'; + })($nesting[0], null, $nesting); + (function($base, $super, $parent_nesting) { + function $Title(){}; + var self = $Title = $klass($base, $super, 'Title', $Title); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Title_initialize_4, TMP_Title_sanitized$q_5, TMP_Title_subtitle$q_6, TMP_Title_to_s_7; + + def.sanitized = def.subtitle = def.combined = nil; + + self.$attr_reader("main"); + Opal.alias(self, "title", "main"); + self.$attr_reader("subtitle"); + self.$attr_reader("combined"); + + Opal.def(self, '$initialize', TMP_Title_initialize_4 = function $$initialize(val, opts) { + var $a, $b, self = this, sep = nil, _ = nil; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + if ($truthy(($truthy($a = (self.sanitized = opts['$[]']("sanitize"))) ? val['$include?']("<") : $a))) { + val = val.$gsub($$($nesting, 'XmlSanitizeRx'), "").$squeeze(" ").$strip()}; + if ($truthy(($truthy($a = (sep = ($truthy($b = opts['$[]']("separator")) ? $b : ":"))['$empty?']()) ? $a : val['$include?']((sep = "" + (sep) + " "))['$!']()))) { + + self.main = val; + self.subtitle = nil; + } else { + $b = val.$rpartition(sep), $a = Opal.to_ary($b), (self.main = ($a[0] == null ? nil : $a[0])), (_ = ($a[1] == null ? nil : $a[1])), (self.subtitle = ($a[2] == null ? nil : $a[2])), $b + }; + return (self.combined = val); + }, TMP_Title_initialize_4.$$arity = -2); + + Opal.def(self, '$sanitized?', TMP_Title_sanitized$q_5 = function() { + var self = this; + + return self.sanitized + }, TMP_Title_sanitized$q_5.$$arity = 0); + + Opal.def(self, '$subtitle?', TMP_Title_subtitle$q_6 = function() { + var self = this; + + if ($truthy(self.subtitle)) { + return true + } else { + return false + } + }, TMP_Title_subtitle$q_6.$$arity = 0); + return (Opal.def(self, '$to_s', TMP_Title_to_s_7 = function $$to_s() { + var self = this; + + return self.combined + }, TMP_Title_to_s_7.$$arity = 0), nil) && 'to_s'; + })($nesting[0], null, $nesting); + Opal.const_set($nesting[0], 'Author', $$$('::', 'Struct').$new("name", "firstname", "middlename", "lastname", "initials", "email")); + self.$attr_reader("safe"); + self.$attr_reader("compat_mode"); + self.$attr_reader("backend"); + self.$attr_reader("doctype"); + self.$attr_accessor("sourcemap"); + self.$attr_reader("catalog"); + Opal.alias(self, "references", "catalog"); + self.$attr_reader("counters"); + self.$attr_reader("header"); + self.$attr_reader("base_dir"); + self.$attr_reader("options"); + self.$attr_reader("outfilesuffix"); + self.$attr_reader("parent_document"); + self.$attr_reader("reader"); + self.$attr_reader("path_resolver"); + self.$attr_reader("converter"); + self.$attr_reader("extensions"); + + Opal.def(self, '$initialize', TMP_Document_initialize_8 = function $$initialize(data, options) { + var $a, TMP_9, TMP_10, $b, $c, TMP_11, $d, $iter = TMP_Document_initialize_8.$$p, $yield = $iter || nil, self = this, parent_doc = nil, $writer = nil, attr_overrides = nil, parent_doctype = nil, initialize_extensions = nil, to_file = nil, safe_mode = nil, header_footer = nil, attrs = nil, safe_mode_name = nil, base_dir_val = nil, backend_val = nil, doctype_val = nil, size = nil, now = nil, localdate = nil, localyear = nil, localtime = nil, ext_registry = nil, ext_block = nil; + + if ($iter) TMP_Document_initialize_8.$$p = null; + + + if (data == null) { + data = nil; + }; + + if (options == null) { + options = $hash2([], {}); + }; + $send(self, Opal.find_super_dispatcher(self, 'initialize', TMP_Document_initialize_8, false), [self, "document"], null); + if ($truthy((parent_doc = options.$delete("parent")))) { + + self.parent_document = parent_doc; + ($truthy($a = options['$[]']("base_dir")) ? $a : (($writer = ["base_dir", parent_doc.$base_dir()]), $send(options, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + if ($truthy(parent_doc.$options()['$[]']("catalog_assets"))) { + + $writer = ["catalog_assets", true]; + $send(options, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + self.catalog = $send(parent_doc.$catalog(), 'inject', [$hash2([], {})], (TMP_9 = function(accum, $mlhs_tmp1){var self = TMP_9.$$s || this, $b, $c, key = nil, table = nil; + + + + if (accum == null) { + accum = nil; + }; + + if ($mlhs_tmp1 == null) { + $mlhs_tmp1 = nil; + }; + $c = $mlhs_tmp1, $b = Opal.to_ary($c), (key = ($b[0] == null ? nil : $b[0])), (table = ($b[1] == null ? nil : $b[1])), $c; + + $writer = [key, (function() {if (key['$==']("footnotes")) { + return [] + } else { + return table + }; return nil; })()]; + $send(accum, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + return accum;}, TMP_9.$$s = self, TMP_9.$$arity = 2, TMP_9.$$has_top_level_mlhs_arg = true, TMP_9)); + self.attribute_overrides = (attr_overrides = parent_doc.$attributes().$dup()); + parent_doctype = attr_overrides.$delete("doctype"); + attr_overrides.$delete("compat-mode"); + attr_overrides.$delete("toc"); + attr_overrides.$delete("toc-placement"); + attr_overrides.$delete("toc-position"); + self.safe = parent_doc.$safe(); + if ($truthy((self.compat_mode = parent_doc.$compat_mode()))) { + + $writer = ["compat-mode", ""]; + $send(self.attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + self.sourcemap = parent_doc.$sourcemap(); + self.timings = nil; + self.path_resolver = parent_doc.$path_resolver(); + self.converter = parent_doc.$converter(); + initialize_extensions = false; + self.extensions = parent_doc.$extensions(); + } else { + + self.parent_document = nil; + self.catalog = $hash2(["ids", "refs", "footnotes", "links", "images", "indexterms", "callouts", "includes"], {"ids": $hash2([], {}), "refs": $hash2([], {}), "footnotes": [], "links": [], "images": [], "indexterms": [], "callouts": $$($nesting, 'Callouts').$new(), "includes": $hash2([], {})}); + self.attribute_overrides = (attr_overrides = $hash2([], {})); + $send(($truthy($a = options['$[]']("attributes")) ? $a : $hash2([], {})), 'each', [], (TMP_10 = function(key, val){var self = TMP_10.$$s || this, $b; + + + + if (key == null) { + key = nil; + }; + + if (val == null) { + val = nil; + }; + if ($truthy(key['$end_with?']("@"))) { + if ($truthy(key['$start_with?']("!"))) { + $b = [key.$slice(1, $rb_minus(key.$length(), 2)), false], (key = $b[0]), (val = $b[1]), $b + } else if ($truthy(key['$end_with?']("!@"))) { + $b = [key.$slice(0, $rb_minus(key.$length(), 2)), false], (key = $b[0]), (val = $b[1]), $b + } else { + $b = [key.$chop(), "" + (val) + "@"], (key = $b[0]), (val = $b[1]), $b + } + } else if ($truthy(key['$start_with?']("!"))) { + $b = [key.$slice(1, key.$length()), (function() {if (val['$==']("@")) { + return false + } else { + return nil + }; return nil; })()], (key = $b[0]), (val = $b[1]), $b + } else if ($truthy(key['$end_with?']("!"))) { + $b = [key.$chop(), (function() {if (val['$==']("@")) { + return false + } else { + return nil + }; return nil; })()], (key = $b[0]), (val = $b[1]), $b}; + + $writer = [key.$downcase(), val]; + $send(attr_overrides, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];;}, TMP_10.$$s = self, TMP_10.$$arity = 2, TMP_10)); + if ($truthy((to_file = options['$[]']("to_file")))) { + + $writer = ["outfilesuffix", $$$('::', 'File').$extname(to_file)]; + $send(attr_overrides, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if ($truthy((safe_mode = options['$[]']("safe"))['$!']())) { + self.safe = $$$($$($nesting, 'SafeMode'), 'SECURE') + } else if ($truthy($$$('::', 'Integer')['$==='](safe_mode))) { + self.safe = safe_mode + } else { + + try { + self.safe = $$($nesting, 'SafeMode').$value_for_name(safe_mode.$to_s()) + } catch ($err) { + if (Opal.rescue($err, [$$($nesting, 'StandardError')])) { + try { + self.safe = $$$($$($nesting, 'SafeMode'), 'SECURE') + } finally { Opal.pop_exception() } + } else { throw $err; } + }; + }; + self.compat_mode = attr_overrides['$key?']("compat-mode"); + self.sourcemap = options['$[]']("sourcemap"); + self.timings = options.$delete("timings"); + self.path_resolver = $$($nesting, 'PathResolver').$new(); + self.converter = nil; + initialize_extensions = (($b = $$$('::', 'Asciidoctor', 'skip_raise')) && ($a = $$$($b, 'Extensions', 'skip_raise')) ? 'constant' : nil); + self.extensions = nil; + }; + self.parsed = false; + self.header = (self.header_attributes = nil); + self.counters = $hash2([], {}); + self.attributes_modified = $$$('::', 'Set').$new(); + self.docinfo_processor_extensions = $hash2([], {}); + header_footer = ($truthy($c = options['$[]']("header_footer")) ? $c : (($writer = ["header_footer", false]), $send(options, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + (self.options = options).$freeze(); + attrs = self.attributes; + + $writer = ["sectids", ""]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["toc-placement", "auto"]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + if ($truthy(header_footer)) { + + + $writer = ["copycss", ""]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["embedded", nil]; + $send(attr_overrides, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + } else { + + + $writer = ["notitle", ""]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["embedded", ""]; + $send(attr_overrides, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + }; + + $writer = ["stylesheet", ""]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["webfonts", ""]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["prewrap", ""]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["attribute-undefined", $$($nesting, 'Compliance').$attribute_undefined()]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["attribute-missing", $$($nesting, 'Compliance').$attribute_missing()]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["iconfont-remote", ""]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["caution-caption", "Caution"]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["important-caption", "Important"]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["note-caption", "Note"]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["tip-caption", "Tip"]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["warning-caption", "Warning"]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["example-caption", "Example"]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["figure-caption", "Figure"]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["table-caption", "Table"]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["toc-title", "Table of Contents"]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["section-refsig", "Section"]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["part-refsig", "Part"]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["chapter-refsig", "Chapter"]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["appendix-caption", (($writer = ["appendix-refsig", "Appendix"]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["untitled-label", "Untitled"]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["version-label", "Version"]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["last-update-label", "Last updated"]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["asciidoctor", ""]; + $send(attr_overrides, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["asciidoctor-version", $$($nesting, 'VERSION')]; + $send(attr_overrides, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["safe-mode-name", (safe_mode_name = $$($nesting, 'SafeMode').$name_for_value(self.safe))]; + $send(attr_overrides, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["" + "safe-mode-" + (safe_mode_name), ""]; + $send(attr_overrides, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["safe-mode-level", self.safe]; + $send(attr_overrides, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + ($truthy($c = attr_overrides['$[]']("max-include-depth")) ? $c : (($writer = ["max-include-depth", 64]), $send(attr_overrides, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + ($truthy($c = attr_overrides['$[]']("allow-uri-read")) ? $c : (($writer = ["allow-uri-read", nil]), $send(attr_overrides, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + + $writer = ["user-home", $$($nesting, 'USER_HOME')]; + $send(attr_overrides, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + if ($truthy(attr_overrides['$key?']("numbered"))) { + + $writer = ["sectnums", attr_overrides.$delete("numbered")]; + $send(attr_overrides, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if ($truthy((base_dir_val = options['$[]']("base_dir")))) { + self.base_dir = (($writer = ["docdir", $$$('::', 'File').$expand_path(base_dir_val)]), $send(attr_overrides, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]) + } else if ($truthy(attr_overrides['$[]']("docdir"))) { + self.base_dir = attr_overrides['$[]']("docdir") + } else { + self.base_dir = (($writer = ["docdir", $$$('::', 'Dir').$pwd()]), $send(attr_overrides, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]) + }; + if ($truthy((backend_val = options['$[]']("backend")))) { + + $writer = ["backend", "" + (backend_val)]; + $send(attr_overrides, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if ($truthy((doctype_val = options['$[]']("doctype")))) { + + $writer = ["doctype", "" + (doctype_val)]; + $send(attr_overrides, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if ($truthy($rb_ge(self.safe, $$$($$($nesting, 'SafeMode'), 'SERVER')))) { + + ($truthy($c = attr_overrides['$[]']("copycss")) ? $c : (($writer = ["copycss", nil]), $send(attr_overrides, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + ($truthy($c = attr_overrides['$[]']("source-highlighter")) ? $c : (($writer = ["source-highlighter", nil]), $send(attr_overrides, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + ($truthy($c = attr_overrides['$[]']("backend")) ? $c : (($writer = ["backend", $$($nesting, 'DEFAULT_BACKEND')]), $send(attr_overrides, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + if ($truthy(($truthy($c = parent_doc['$!']()) ? attr_overrides['$key?']("docfile") : $c))) { + + $writer = ["docfile", attr_overrides['$[]']("docfile")['$[]'](Opal.Range.$new($rb_plus(attr_overrides['$[]']("docdir").$length(), 1), -1, false))]; + $send(attr_overrides, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + + $writer = ["docdir", ""]; + $send(attr_overrides, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["user-home", "."]; + $send(attr_overrides, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + if ($truthy($rb_ge(self.safe, $$$($$($nesting, 'SafeMode'), 'SECURE')))) { + + if ($truthy(attr_overrides['$key?']("max-attribute-value-size"))) { + } else { + + $writer = ["max-attribute-value-size", 4096]; + $send(attr_overrides, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + if ($truthy(attr_overrides['$key?']("linkcss"))) { + } else { + + $writer = ["linkcss", ""]; + $send(attr_overrides, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + ($truthy($c = attr_overrides['$[]']("icons")) ? $c : (($writer = ["icons", nil]), $send(attr_overrides, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]));};}; + self.max_attribute_value_size = (function() {if ($truthy((size = ($truthy($c = attr_overrides['$[]']("max-attribute-value-size")) ? $c : (($writer = ["max-attribute-value-size", nil]), $send(attr_overrides, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]))))) { + return size.$to_i().$abs() + } else { + return nil + }; return nil; })(); + $send(attr_overrides, 'delete_if', [], (TMP_11 = function(key, val){var self = TMP_11.$$s || this, $d, verdict = nil; + + + + if (key == null) { + key = nil; + }; + + if (val == null) { + val = nil; + }; + if ($truthy(val)) { + + if ($truthy(($truthy($d = $$$('::', 'String')['$==='](val)) ? val['$end_with?']("@") : $d))) { + $d = [val.$chop(), true], (val = $d[0]), (verdict = $d[1]), $d}; + + $writer = [key, val]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + } else { + + attrs.$delete(key); + verdict = val['$=='](false); + }; + return verdict;}, TMP_11.$$s = self, TMP_11.$$arity = 2, TMP_11)); + if ($truthy(parent_doc)) { + + self.backend = attrs['$[]']("backend"); + if ((self.doctype = (($writer = ["doctype", parent_doctype]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]))['$==']($$($nesting, 'DEFAULT_DOCTYPE'))) { + } else { + self.$update_doctype_attributes($$($nesting, 'DEFAULT_DOCTYPE')) + }; + self.reader = $$($nesting, 'Reader').$new(data, options['$[]']("cursor")); + if ($truthy(self.sourcemap)) { + self.source_location = self.reader.$cursor()}; + $$($nesting, 'Parser').$parse(self.reader, self); + self.$restore_attributes(); + return (self.parsed = true); + } else { + + self.backend = nil; + if (($truthy($c = attrs['$[]']("backend")) ? $c : (($writer = ["backend", $$($nesting, 'DEFAULT_BACKEND')]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]))['$==']("manpage")) { + self.doctype = (($writer = ["doctype", (($writer = ["doctype", "manpage"]), $send(attr_overrides, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]) + } else { + self.doctype = ($truthy($c = attrs['$[]']("doctype")) ? $c : (($writer = ["doctype", $$($nesting, 'DEFAULT_DOCTYPE')]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])) + }; + self.$update_backend_attributes(attrs['$[]']("backend"), true); + now = (function() {if ($truthy($$$('::', 'ENV')['$[]']("SOURCE_DATE_EPOCH"))) { + return $$$('::', 'Time').$at(self.$Integer($$$('::', 'ENV')['$[]']("SOURCE_DATE_EPOCH"))).$utc() + } else { + return $$$('::', 'Time').$now() + }; return nil; })(); + if ($truthy((localdate = attrs['$[]']("localdate")))) { + localyear = ($truthy($c = attrs['$[]']("localyear")) ? $c : (($writer = ["localyear", (function() {if (localdate.$index("-")['$=='](4)) { + + return localdate.$slice(0, 4); + } else { + return nil + }; return nil; })()]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])) + } else { + + localdate = (($writer = ["localdate", now.$strftime("%F")]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]); + localyear = ($truthy($c = attrs['$[]']("localyear")) ? $c : (($writer = ["localyear", now.$year().$to_s()]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + }; + localtime = ($truthy($c = attrs['$[]']("localtime")) ? $c : (($writer = ["localtime", now.$strftime("" + "%T " + ((function() {if (now.$utc_offset()['$=='](0)) { + return "UTC" + } else { + return "%z" + }; return nil; })()))]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + ($truthy($c = attrs['$[]']("localdatetime")) ? $c : (($writer = ["localdatetime", "" + (localdate) + " " + (localtime)]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + ($truthy($c = attrs['$[]']("docdate")) ? $c : (($writer = ["docdate", localdate]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + ($truthy($c = attrs['$[]']("docyear")) ? $c : (($writer = ["docyear", localyear]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + ($truthy($c = attrs['$[]']("doctime")) ? $c : (($writer = ["doctime", localtime]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + ($truthy($c = attrs['$[]']("docdatetime")) ? $c : (($writer = ["docdatetime", "" + (localdate) + " " + (localtime)]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + ($truthy($c = attrs['$[]']("stylesdir")) ? $c : (($writer = ["stylesdir", "."]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + ($truthy($c = attrs['$[]']("iconsdir")) ? $c : (($writer = ["iconsdir", "" + (attrs.$fetch("imagesdir", "./images")) + "/icons"]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + if ($truthy(initialize_extensions)) { + if ($truthy((ext_registry = options['$[]']("extension_registry")))) { + if ($truthy(($truthy($c = $$$($$($nesting, 'Extensions'), 'Registry')['$==='](ext_registry)) ? $c : ($truthy($d = $$$('::', 'RUBY_ENGINE_JRUBY')) ? $$$($$$($$$('::', 'AsciidoctorJ'), 'Extensions'), 'ExtensionRegistry')['$==='](ext_registry) : $d)))) { + self.extensions = ext_registry.$activate(self)} + } else if ($truthy($$$('::', 'Proc')['$===']((ext_block = options['$[]']("extensions"))))) { + self.extensions = $send($$($nesting, 'Extensions'), 'create', [], ext_block.$to_proc()).$activate(self) + } else if ($truthy($$($nesting, 'Extensions').$groups()['$empty?']()['$!']())) { + self.extensions = $$$($$($nesting, 'Extensions'), 'Registry').$new().$activate(self)}}; + self.reader = $$($nesting, 'PreprocessorReader').$new(self, data, $$$($$($nesting, 'Reader'), 'Cursor').$new(attrs['$[]']("docfile"), self.base_dir), $hash2(["normalize"], {"normalize": true})); + if ($truthy(self.sourcemap)) { + return (self.source_location = self.reader.$cursor()) + } else { + return nil + }; + }; + }, TMP_Document_initialize_8.$$arity = -1); + + Opal.def(self, '$parse', TMP_Document_parse_12 = function $$parse(data) { + var $a, TMP_13, TMP_14, self = this, doc = nil, exts = nil; + + + + if (data == null) { + data = nil; + }; + if ($truthy(self.parsed)) { + return self + } else { + + doc = self; + if ($truthy(data)) { + + self.reader = $$($nesting, 'PreprocessorReader').$new(doc, data, $$$($$($nesting, 'Reader'), 'Cursor').$new(self.attributes['$[]']("docfile"), self.base_dir), $hash2(["normalize"], {"normalize": true})); + if ($truthy(self.sourcemap)) { + self.source_location = self.reader.$cursor()};}; + if ($truthy(($truthy($a = (exts = (function() {if ($truthy(self.parent_document)) { + return nil + } else { + return self.extensions + }; return nil; })())) ? exts['$preprocessors?']() : $a))) { + $send(exts.$preprocessors(), 'each', [], (TMP_13 = function(ext){var self = TMP_13.$$s || this, $b; + if (self.reader == null) self.reader = nil; + + + + if (ext == null) { + ext = nil; + }; + return (self.reader = ($truthy($b = ext.$process_method()['$[]'](doc, self.reader)) ? $b : self.reader));}, TMP_13.$$s = self, TMP_13.$$arity = 1, TMP_13))}; + $$($nesting, 'Parser').$parse(self.reader, doc, $hash2(["header_only"], {"header_only": self.options['$[]']("parse_header_only")})); + self.$restore_attributes(); + if ($truthy(($truthy($a = exts) ? exts['$tree_processors?']() : $a))) { + $send(exts.$tree_processors(), 'each', [], (TMP_14 = function(ext){var self = TMP_14.$$s || this, $b, $c, result = nil; + + + + if (ext == null) { + ext = nil; + }; + if ($truthy(($truthy($b = ($truthy($c = (result = ext.$process_method()['$[]'](doc))) ? $$($nesting, 'Document')['$==='](result) : $c)) ? result['$!='](doc) : $b))) { + return (doc = result) + } else { + return nil + };}, TMP_14.$$s = self, TMP_14.$$arity = 1, TMP_14))}; + self.parsed = true; + return doc; + }; + }, TMP_Document_parse_12.$$arity = -1); + + Opal.def(self, '$counter', TMP_Document_counter_15 = function $$counter(name, seed) { + var $a, self = this, attr_seed = nil, attr_val = nil, $writer = nil; + + + + if (seed == null) { + seed = nil; + }; + if ($truthy(self.parent_document)) { + return self.parent_document.$counter(name, seed)}; + if ($truthy(($truthy($a = (attr_seed = (attr_val = self.attributes['$[]'](name))['$nil_or_empty?']()['$!']())) ? self.counters['$key?'](name) : $a))) { + + $writer = [name, (($writer = [name, self.$nextval(attr_val)]), $send(self.counters, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])]; + $send(self.attributes, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + } else if ($truthy(seed)) { + + $writer = [name, (($writer = [name, (function() {if (seed['$=='](seed.$to_i().$to_s())) { + return seed.$to_i() + } else { + return seed + }; return nil; })()]), $send(self.counters, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])]; + $send(self.attributes, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + } else { + + $writer = [name, (($writer = [name, self.$nextval((function() {if ($truthy(attr_seed)) { + return attr_val + } else { + return 0 + }; return nil; })())]), $send(self.counters, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])]; + $send(self.attributes, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + }; + }, TMP_Document_counter_15.$$arity = -2); + + Opal.def(self, '$increment_and_store_counter', TMP_Document_increment_and_store_counter_16 = function $$increment_and_store_counter(counter_name, block) { + var self = this; + + return $$($nesting, 'AttributeEntry').$new(counter_name, self.$counter(counter_name)).$save_to(block.$attributes()).$value() + }, TMP_Document_increment_and_store_counter_16.$$arity = 2); + Opal.alias(self, "counter_increment", "increment_and_store_counter"); + + Opal.def(self, '$nextval', TMP_Document_nextval_17 = function $$nextval(current) { + var self = this, intval = nil; + + if ($truthy($$$('::', 'Integer')['$==='](current))) { + return $rb_plus(current, 1) + } else { + + intval = current.$to_i(); + if ($truthy(intval.$to_s()['$!='](current.$to_s()))) { + return $rb_plus(current['$[]'](0).$ord(), 1).$chr() + } else { + return $rb_plus(intval, 1) + }; + } + }, TMP_Document_nextval_17.$$arity = 1); + + Opal.def(self, '$register', TMP_Document_register_18 = function $$register(type, value) { + var $a, $b, self = this, $case = nil, id = nil, reftext = nil, $logical_op_recvr_tmp_1 = nil, $writer = nil, ref = nil, refs = nil; + + return (function() {$case = type; + if ("ids"['$===']($case)) { + $b = value, $a = Opal.to_ary($b), (id = ($a[0] == null ? nil : $a[0])), (reftext = ($a[1] == null ? nil : $a[1])), $b; + + $logical_op_recvr_tmp_1 = self.catalog['$[]']("ids"); + return ($truthy($a = $logical_op_recvr_tmp_1['$[]'](id)) ? $a : (($writer = [id, ($truthy($b = reftext) ? $b : $rb_plus($rb_plus("[", id), "]"))]), $send($logical_op_recvr_tmp_1, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]));;} + else if ("refs"['$===']($case)) { + $b = value, $a = Opal.to_ary($b), (id = ($a[0] == null ? nil : $a[0])), (ref = ($a[1] == null ? nil : $a[1])), (reftext = ($a[2] == null ? nil : $a[2])), $b; + if ($truthy((refs = self.catalog['$[]']("refs"))['$key?'](id))) { + return nil + } else { + + + $writer = [id, ($truthy($a = reftext) ? $a : $rb_plus($rb_plus("[", id), "]"))]; + $send(self.catalog['$[]']("ids"), '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = [id, ref]; + $send(refs, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];; + };} + else if ("footnotes"['$===']($case) || "indexterms"['$===']($case)) {return self.catalog['$[]'](type)['$<<'](value)} + else {if ($truthy(self.options['$[]']("catalog_assets"))) { + return self.catalog['$[]'](type)['$<<']((function() {if (type['$==']("images")) { + + return $$($nesting, 'ImageReference').$new(value['$[]'](0), value['$[]'](1)); + } else { + return value + }; return nil; })()) + } else { + return nil + }}})() + }, TMP_Document_register_18.$$arity = 2); + + Opal.def(self, '$footnotes?', TMP_Document_footnotes$q_19 = function() { + var self = this; + + if ($truthy(self.catalog['$[]']("footnotes")['$empty?']())) { + return false + } else { + return true + } + }, TMP_Document_footnotes$q_19.$$arity = 0); + + Opal.def(self, '$footnotes', TMP_Document_footnotes_20 = function $$footnotes() { + var self = this; + + return self.catalog['$[]']("footnotes") + }, TMP_Document_footnotes_20.$$arity = 0); + + Opal.def(self, '$callouts', TMP_Document_callouts_21 = function $$callouts() { + var self = this; + + return self.catalog['$[]']("callouts") + }, TMP_Document_callouts_21.$$arity = 0); + + Opal.def(self, '$nested?', TMP_Document_nested$q_22 = function() { + var self = this; + + if ($truthy(self.parent_document)) { + return true + } else { + return false + } + }, TMP_Document_nested$q_22.$$arity = 0); + + Opal.def(self, '$embedded?', TMP_Document_embedded$q_23 = function() { + var self = this; + + return self.attributes['$key?']("embedded") + }, TMP_Document_embedded$q_23.$$arity = 0); + + Opal.def(self, '$extensions?', TMP_Document_extensions$q_24 = function() { + var self = this; + + if ($truthy(self.extensions)) { + return true + } else { + return false + } + }, TMP_Document_extensions$q_24.$$arity = 0); + + Opal.def(self, '$source', TMP_Document_source_25 = function $$source() { + var self = this; + + if ($truthy(self.reader)) { + return self.reader.$source() + } else { + return nil + } + }, TMP_Document_source_25.$$arity = 0); + + Opal.def(self, '$source_lines', TMP_Document_source_lines_26 = function $$source_lines() { + var self = this; + + if ($truthy(self.reader)) { + return self.reader.$source_lines() + } else { + return nil + } + }, TMP_Document_source_lines_26.$$arity = 0); + + Opal.def(self, '$basebackend?', TMP_Document_basebackend$q_27 = function(base) { + var self = this; + + return self.attributes['$[]']("basebackend")['$=='](base) + }, TMP_Document_basebackend$q_27.$$arity = 1); + + Opal.def(self, '$title', TMP_Document_title_28 = function $$title() { + var self = this; + + return self.$doctitle() + }, TMP_Document_title_28.$$arity = 0); + + Opal.def(self, '$title=', TMP_Document_title$eq_29 = function(title) { + var self = this, sect = nil, $writer = nil; + + + if ($truthy((sect = self.header))) { + } else { + + $writer = ["header"]; + $send((sect = (self.header = $$($nesting, 'Section').$new(self, 0))), 'sectname=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + + $writer = [title]; + $send(sect, 'title=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];; + }, TMP_Document_title$eq_29.$$arity = 1); + + Opal.def(self, '$doctitle', TMP_Document_doctitle_30 = function $$doctitle(opts) { + var $a, self = this, val = nil, sect = nil, separator = nil; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + if ($truthy((val = self.attributes['$[]']("title")))) { + } else if ($truthy((sect = self.$first_section()))) { + val = sect.$title() + } else if ($truthy(($truthy($a = opts['$[]']("use_fallback")) ? (val = self.attributes['$[]']("untitled-label")) : $a)['$!']())) { + return nil}; + if ($truthy((separator = opts['$[]']("partition")))) { + return $$($nesting, 'Title').$new(val, opts.$merge($hash2(["separator"], {"separator": (function() {if (separator['$=='](true)) { + return self.attributes['$[]']("title-separator") + } else { + return separator + }; return nil; })()}))) + } else if ($truthy(($truthy($a = opts['$[]']("sanitize")) ? val['$include?']("<") : $a))) { + return val.$gsub($$($nesting, 'XmlSanitizeRx'), "").$squeeze(" ").$strip() + } else { + return val + }; + }, TMP_Document_doctitle_30.$$arity = -1); + Opal.alias(self, "name", "doctitle"); + + Opal.def(self, '$author', TMP_Document_author_31 = function $$author() { + var self = this; + + return self.attributes['$[]']("author") + }, TMP_Document_author_31.$$arity = 0); + + Opal.def(self, '$authors', TMP_Document_authors_32 = function $$authors() { + var $a, self = this, attrs = nil, authors = nil, num_authors = nil, idx = nil; + + if ($truthy((attrs = self.attributes)['$key?']("author"))) { + + authors = [$$($nesting, 'Author').$new(attrs['$[]']("author"), attrs['$[]']("firstname"), attrs['$[]']("middlename"), attrs['$[]']("lastname"), attrs['$[]']("authorinitials"), attrs['$[]']("email"))]; + if ($truthy($rb_gt((num_authors = ($truthy($a = attrs['$[]']("authorcount")) ? $a : 0)), 1))) { + + idx = 1; + while ($truthy($rb_lt(idx, num_authors))) { + + idx = $rb_plus(idx, 1); + authors['$<<']($$($nesting, 'Author').$new(attrs['$[]']("" + "author_" + (idx)), attrs['$[]']("" + "firstname_" + (idx)), attrs['$[]']("" + "middlename_" + (idx)), attrs['$[]']("" + "lastname_" + (idx)), attrs['$[]']("" + "authorinitials_" + (idx)), attrs['$[]']("" + "email_" + (idx)))); + };}; + return authors; + } else { + return [] + } + }, TMP_Document_authors_32.$$arity = 0); + + Opal.def(self, '$revdate', TMP_Document_revdate_33 = function $$revdate() { + var self = this; + + return self.attributes['$[]']("revdate") + }, TMP_Document_revdate_33.$$arity = 0); + + Opal.def(self, '$notitle', TMP_Document_notitle_34 = function $$notitle() { + var $a, self = this; + + return ($truthy($a = self.attributes['$key?']("showtitle")['$!']()) ? self.attributes['$key?']("notitle") : $a) + }, TMP_Document_notitle_34.$$arity = 0); + + Opal.def(self, '$noheader', TMP_Document_noheader_35 = function $$noheader() { + var self = this; + + return self.attributes['$key?']("noheader") + }, TMP_Document_noheader_35.$$arity = 0); + + Opal.def(self, '$nofooter', TMP_Document_nofooter_36 = function $$nofooter() { + var self = this; + + return self.attributes['$key?']("nofooter") + }, TMP_Document_nofooter_36.$$arity = 0); + + Opal.def(self, '$first_section', TMP_Document_first_section_37 = function $$first_section() { + var $a, TMP_38, self = this; + + return ($truthy($a = self.header) ? $a : $send(self.blocks, 'find', [], (TMP_38 = function(e){var self = TMP_38.$$s || this; + + + + if (e == null) { + e = nil; + }; + return e.$context()['$==']("section");}, TMP_38.$$s = self, TMP_38.$$arity = 1, TMP_38))) + }, TMP_Document_first_section_37.$$arity = 0); + + Opal.def(self, '$has_header?', TMP_Document_has_header$q_39 = function() { + var self = this; + + if ($truthy(self.header)) { + return true + } else { + return false + } + }, TMP_Document_has_header$q_39.$$arity = 0); + Opal.alias(self, "header?", "has_header?"); + + Opal.def(self, '$<<', TMP_Document_$lt$lt_40 = function(block) { + var $iter = TMP_Document_$lt$lt_40.$$p, $yield = $iter || nil, self = this, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_Document_$lt$lt_40.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + + if (block.$context()['$==']("section")) { + self.$assign_numeral(block)}; + return $send(self, Opal.find_super_dispatcher(self, '<<', TMP_Document_$lt$lt_40, false), $zuper, $iter); + }, TMP_Document_$lt$lt_40.$$arity = 1); + + Opal.def(self, '$finalize_header', TMP_Document_finalize_header_41 = function $$finalize_header(unrooted_attributes, header_valid) { + var self = this, $writer = nil; + + + + if (header_valid == null) { + header_valid = true; + }; + self.$clear_playback_attributes(unrooted_attributes); + self.$save_attributes(); + if ($truthy(header_valid)) { + } else { + + $writer = ["invalid-header", true]; + $send(unrooted_attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + return unrooted_attributes; + }, TMP_Document_finalize_header_41.$$arity = -2); + + Opal.def(self, '$save_attributes', TMP_Document_save_attributes_42 = function $$save_attributes() { + var $a, $b, TMP_43, self = this, attrs = nil, $writer = nil, val = nil, toc_position_val = nil, toc_val = nil, toc_placement = nil, default_toc_position = nil, default_toc_class = nil, position = nil, $case = nil; + + + if ((attrs = self.attributes)['$[]']("basebackend")['$==']("docbook")) { + + if ($truthy(($truthy($a = self['$attribute_locked?']("toc")) ? $a : self.attributes_modified['$include?']("toc")))) { + } else { + + $writer = ["toc", ""]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + if ($truthy(($truthy($a = self['$attribute_locked?']("sectnums")) ? $a : self.attributes_modified['$include?']("sectnums")))) { + } else { + + $writer = ["sectnums", ""]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + };}; + if ($truthy(($truthy($a = attrs['$key?']("doctitle")) ? $a : (val = self.$doctitle())['$!']()))) { + } else { + + $writer = ["doctitle", val]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + if ($truthy(self.id)) { + } else { + self.id = attrs['$[]']("css-signature") + }; + toc_position_val = (function() {if ($truthy((toc_val = (function() {if ($truthy(attrs.$delete("toc2"))) { + return "left" + } else { + return attrs['$[]']("toc") + }; return nil; })()))) { + if ($truthy(($truthy($a = (toc_placement = attrs.$fetch("toc-placement", "macro"))) ? toc_placement['$!=']("auto") : $a))) { + return toc_placement + } else { + return attrs['$[]']("toc-position") + } + } else { + return nil + }; return nil; })(); + if ($truthy(($truthy($a = toc_val) ? ($truthy($b = toc_val['$empty?']()['$!']()) ? $b : toc_position_val['$nil_or_empty?']()['$!']()) : $a))) { + + default_toc_position = "left"; + default_toc_class = "toc2"; + if ($truthy(toc_position_val['$nil_or_empty?']()['$!']())) { + position = toc_position_val + } else if ($truthy(toc_val['$empty?']()['$!']())) { + position = toc_val + } else { + position = default_toc_position + }; + + $writer = ["toc", ""]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["toc-placement", "auto"]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + $case = position; + if ("left"['$===']($case) || "<"['$===']($case) || "<"['$===']($case)) { + $writer = ["toc-position", "left"]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];} + else if ("right"['$===']($case) || ">"['$===']($case) || ">"['$===']($case)) { + $writer = ["toc-position", "right"]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];} + else if ("top"['$===']($case) || "^"['$===']($case)) { + $writer = ["toc-position", "top"]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];} + else if ("bottom"['$===']($case) || "v"['$===']($case)) { + $writer = ["toc-position", "bottom"]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];} + else if ("preamble"['$===']($case) || "macro"['$===']($case)) { + + $writer = ["toc-position", "content"]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["toc-placement", position]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + default_toc_class = nil;} + else { + attrs.$delete("toc-position"); + default_toc_class = nil;}; + if ($truthy(default_toc_class)) { + ($truthy($a = attrs['$[]']("toc-class")) ? $a : (($writer = ["toc-class", default_toc_class]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]))};}; + if ($truthy((self.compat_mode = attrs['$key?']("compat-mode")))) { + if ($truthy(attrs['$key?']("language"))) { + + $writer = ["source-language", attrs['$[]']("language")]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}}; + self.outfilesuffix = attrs['$[]']("outfilesuffix"); + self.header_attributes = attrs.$dup(); + if ($truthy(self.parent_document)) { + return nil + } else { + return $send($$($nesting, 'FLEXIBLE_ATTRIBUTES'), 'each', [], (TMP_43 = function(name){var self = TMP_43.$$s || this, $c; + if (self.attribute_overrides == null) self.attribute_overrides = nil; + + + + if (name == null) { + name = nil; + }; + if ($truthy(($truthy($c = self.attribute_overrides['$key?'](name)) ? self.attribute_overrides['$[]'](name) : $c))) { + return self.attribute_overrides.$delete(name) + } else { + return nil + };}, TMP_43.$$s = self, TMP_43.$$arity = 1, TMP_43)) + }; + }, TMP_Document_save_attributes_42.$$arity = 0); + + Opal.def(self, '$restore_attributes', TMP_Document_restore_attributes_44 = function $$restore_attributes() { + var self = this; + + + if ($truthy(self.parent_document)) { + } else { + self.catalog['$[]']("callouts").$rewind() + }; + return self.attributes.$replace(self.header_attributes); + }, TMP_Document_restore_attributes_44.$$arity = 0); + + Opal.def(self, '$clear_playback_attributes', TMP_Document_clear_playback_attributes_45 = function $$clear_playback_attributes(attributes) { + var self = this; + + return attributes.$delete("attribute_entries") + }, TMP_Document_clear_playback_attributes_45.$$arity = 1); + + Opal.def(self, '$playback_attributes', TMP_Document_playback_attributes_46 = function $$playback_attributes(block_attributes) { + var TMP_47, self = this; + + if ($truthy(block_attributes['$key?']("attribute_entries"))) { + return $send(block_attributes['$[]']("attribute_entries"), 'each', [], (TMP_47 = function(entry){var self = TMP_47.$$s || this, name = nil, $writer = nil; + if (self.attributes == null) self.attributes = nil; + + + + if (entry == null) { + entry = nil; + }; + name = entry.$name(); + if ($truthy(entry.$negate())) { + + self.attributes.$delete(name); + if (name['$==']("compat-mode")) { + return (self.compat_mode = false) + } else { + return nil + }; + } else { + + + $writer = [name, entry.$value()]; + $send(self.attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + if (name['$==']("compat-mode")) { + return (self.compat_mode = true) + } else { + return nil + }; + };}, TMP_47.$$s = self, TMP_47.$$arity = 1, TMP_47)) + } else { + return nil + } + }, TMP_Document_playback_attributes_46.$$arity = 1); + + Opal.def(self, '$set_attribute', TMP_Document_set_attribute_48 = function $$set_attribute(name, value) { + var self = this, resolved_value = nil, $case = nil, $writer = nil; + + + + if (value == null) { + value = ""; + }; + if ($truthy(self['$attribute_locked?'](name))) { + return false + } else { + + if ($truthy(self.max_attribute_value_size)) { + resolved_value = self.$apply_attribute_value_subs(value).$limit_bytesize(self.max_attribute_value_size) + } else { + resolved_value = self.$apply_attribute_value_subs(value) + }; + $case = name; + if ("backend"['$===']($case)) {self.$update_backend_attributes(resolved_value, self.attributes_modified['$delete?']("htmlsyntax"))} + else if ("doctype"['$===']($case)) {self.$update_doctype_attributes(resolved_value)} + else { + $writer = [name, resolved_value]; + $send(self.attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + self.attributes_modified['$<<'](name); + return resolved_value; + }; + }, TMP_Document_set_attribute_48.$$arity = -2); + + Opal.def(self, '$delete_attribute', TMP_Document_delete_attribute_49 = function $$delete_attribute(name) { + var self = this; + + if ($truthy(self['$attribute_locked?'](name))) { + return false + } else { + + self.attributes.$delete(name); + self.attributes_modified['$<<'](name); + return true; + } + }, TMP_Document_delete_attribute_49.$$arity = 1); + + Opal.def(self, '$attribute_locked?', TMP_Document_attribute_locked$q_50 = function(name) { + var self = this; + + return self.attribute_overrides['$key?'](name) + }, TMP_Document_attribute_locked$q_50.$$arity = 1); + + Opal.def(self, '$set_header_attribute', TMP_Document_set_header_attribute_51 = function $$set_header_attribute(name, value, overwrite) { + var $a, self = this, attrs = nil, $writer = nil; + + + + if (value == null) { + value = ""; + }; + + if (overwrite == null) { + overwrite = true; + }; + attrs = ($truthy($a = self.header_attributes) ? $a : self.attributes); + if ($truthy((($a = overwrite['$=='](false)) ? attrs['$key?'](name) : overwrite['$=='](false)))) { + return false + } else { + + + $writer = [name, value]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + return true; + }; + }, TMP_Document_set_header_attribute_51.$$arity = -2); + + Opal.def(self, '$apply_attribute_value_subs', TMP_Document_apply_attribute_value_subs_52 = function $$apply_attribute_value_subs(value) { + var $a, self = this; + + if ($truthy($$($nesting, 'AttributeEntryPassMacroRx')['$=~'](value))) { + if ($truthy((($a = $gvars['~']) === nil ? nil : $a['$[]'](1)))) { + + return self.$apply_subs((($a = $gvars['~']) === nil ? nil : $a['$[]'](2)), self.$resolve_pass_subs((($a = $gvars['~']) === nil ? nil : $a['$[]'](1)))); + } else { + return (($a = $gvars['~']) === nil ? nil : $a['$[]'](2)) + } + } else { + return self.$apply_header_subs(value) + } + }, TMP_Document_apply_attribute_value_subs_52.$$arity = 1); + + Opal.def(self, '$update_backend_attributes', TMP_Document_update_backend_attributes_53 = function $$update_backend_attributes(new_backend, force) { + var $a, $b, self = this, attrs = nil, current_backend = nil, current_basebackend = nil, current_doctype = nil, $writer = nil, resolved_backend = nil, new_basebackend = nil, new_filetype = nil, new_outfilesuffix = nil, current_filetype = nil, page_width = nil; + + + + if (force == null) { + force = nil; + }; + if ($truthy(($truthy($a = force) ? $a : ($truthy($b = new_backend) ? new_backend['$!='](self.backend) : $b)))) { + + $a = [self.backend, (attrs = self.attributes)['$[]']("basebackend"), self.doctype], (current_backend = $a[0]), (current_basebackend = $a[1]), (current_doctype = $a[2]), $a; + if ($truthy(new_backend['$start_with?']("xhtml"))) { + + + $writer = ["htmlsyntax", "xml"]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + new_backend = new_backend.$slice(1, new_backend.$length()); + } else if ($truthy(new_backend['$start_with?']("html"))) { + if (attrs['$[]']("htmlsyntax")['$==']("xml")) { + } else { + + $writer = ["htmlsyntax", "html"]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }}; + if ($truthy((resolved_backend = $$($nesting, 'BACKEND_ALIASES')['$[]'](new_backend)))) { + new_backend = resolved_backend}; + if ($truthy(current_doctype)) { + + if ($truthy(current_backend)) { + + attrs.$delete("" + "backend-" + (current_backend)); + attrs.$delete("" + "backend-" + (current_backend) + "-doctype-" + (current_doctype));}; + + $writer = ["" + "backend-" + (new_backend) + "-doctype-" + (current_doctype), ""]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["" + "doctype-" + (current_doctype), ""]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + } else if ($truthy(current_backend)) { + attrs.$delete("" + "backend-" + (current_backend))}; + + $writer = ["" + "backend-" + (new_backend), ""]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + self.backend = (($writer = ["backend", new_backend]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]); + if ($truthy($$$($$($nesting, 'Converter'), 'BackendInfo')['$===']((self.converter = self.$create_converter())))) { + + new_basebackend = self.converter.$basebackend(); + if ($truthy(self['$attribute_locked?']("outfilesuffix"))) { + } else { + + $writer = ["outfilesuffix", self.converter.$outfilesuffix()]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + new_filetype = self.converter.$filetype(); + } else if ($truthy(self.converter)) { + + new_basebackend = new_backend.$sub($$($nesting, 'TrailingDigitsRx'), ""); + if ($truthy((new_outfilesuffix = $$($nesting, 'DEFAULT_EXTENSIONS')['$[]'](new_basebackend)))) { + new_filetype = new_outfilesuffix.$slice(1, new_outfilesuffix.$length()) + } else { + $a = [".html", "html", "html"], (new_outfilesuffix = $a[0]), (new_basebackend = $a[1]), (new_filetype = $a[2]), $a + }; + if ($truthy(self['$attribute_locked?']("outfilesuffix"))) { + } else { + + $writer = ["outfilesuffix", new_outfilesuffix]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + } else { + self.$raise($$$('::', 'NotImplementedError'), "" + "asciidoctor: FAILED: missing converter for backend '" + (new_backend) + "'. Processing aborted.") + }; + if ($truthy((current_filetype = attrs['$[]']("filetype")))) { + attrs.$delete("" + "filetype-" + (current_filetype))}; + + $writer = ["filetype", new_filetype]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["" + "filetype-" + (new_filetype), ""]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + if ($truthy((page_width = $$($nesting, 'DEFAULT_PAGE_WIDTHS')['$[]'](new_basebackend)))) { + + $writer = ["pagewidth", page_width]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + } else { + attrs.$delete("pagewidth") + }; + if ($truthy(new_basebackend['$!='](current_basebackend))) { + + if ($truthy(current_doctype)) { + + if ($truthy(current_basebackend)) { + + attrs.$delete("" + "basebackend-" + (current_basebackend)); + attrs.$delete("" + "basebackend-" + (current_basebackend) + "-doctype-" + (current_doctype));}; + + $writer = ["" + "basebackend-" + (new_basebackend) + "-doctype-" + (current_doctype), ""]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + } else if ($truthy(current_basebackend)) { + attrs.$delete("" + "basebackend-" + (current_basebackend))}; + + $writer = ["" + "basebackend-" + (new_basebackend), ""]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["basebackend", new_basebackend]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];;}; + return new_backend; + } else { + return nil + }; + }, TMP_Document_update_backend_attributes_53.$$arity = -2); + + Opal.def(self, '$update_doctype_attributes', TMP_Document_update_doctype_attributes_54 = function $$update_doctype_attributes(new_doctype) { + var $a, self = this, attrs = nil, current_backend = nil, current_basebackend = nil, current_doctype = nil, $writer = nil; + + if ($truthy(($truthy($a = new_doctype) ? new_doctype['$!='](self.doctype) : $a))) { + + $a = [self.backend, (attrs = self.attributes)['$[]']("basebackend"), self.doctype], (current_backend = $a[0]), (current_basebackend = $a[1]), (current_doctype = $a[2]), $a; + if ($truthy(current_doctype)) { + + attrs.$delete("" + "doctype-" + (current_doctype)); + if ($truthy(current_backend)) { + + attrs.$delete("" + "backend-" + (current_backend) + "-doctype-" + (current_doctype)); + + $writer = ["" + "backend-" + (current_backend) + "-doctype-" + (new_doctype), ""]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];;}; + if ($truthy(current_basebackend)) { + + attrs.$delete("" + "basebackend-" + (current_basebackend) + "-doctype-" + (current_doctype)); + + $writer = ["" + "basebackend-" + (current_basebackend) + "-doctype-" + (new_doctype), ""]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];;}; + } else { + + if ($truthy(current_backend)) { + + $writer = ["" + "backend-" + (current_backend) + "-doctype-" + (new_doctype), ""]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if ($truthy(current_basebackend)) { + + $writer = ["" + "basebackend-" + (current_basebackend) + "-doctype-" + (new_doctype), ""]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + }; + + $writer = ["" + "doctype-" + (new_doctype), ""]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + return (self.doctype = (($writer = ["doctype", new_doctype]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + } else { + return nil + } + }, TMP_Document_update_doctype_attributes_54.$$arity = 1); + + Opal.def(self, '$create_converter', TMP_Document_create_converter_55 = function $$create_converter() { + var self = this, converter_opts = nil, $writer = nil, template_dir = nil, template_dirs = nil, converter = nil, converter_factory = nil; + + + converter_opts = $hash2([], {}); + + $writer = ["htmlsyntax", self.attributes['$[]']("htmlsyntax")]; + $send(converter_opts, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + if ($truthy((template_dir = self.options['$[]']("template_dir")))) { + template_dirs = [template_dir] + } else if ($truthy((template_dirs = self.options['$[]']("template_dirs")))) { + template_dirs = self.$Array(template_dirs)}; + if ($truthy(template_dirs)) { + + + $writer = ["template_dirs", template_dirs]; + $send(converter_opts, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["template_cache", self.options.$fetch("template_cache", true)]; + $send(converter_opts, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["template_engine", self.options['$[]']("template_engine")]; + $send(converter_opts, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["template_engine_options", self.options['$[]']("template_engine_options")]; + $send(converter_opts, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["eruby", self.options['$[]']("eruby")]; + $send(converter_opts, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["safe", self.safe]; + $send(converter_opts, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];;}; + if ($truthy((converter = self.options['$[]']("converter")))) { + converter_factory = $$$($$($nesting, 'Converter'), 'Factory').$new($$$('::', 'Hash')['$[]'](self.$backend(), converter)) + } else { + converter_factory = $$$($$($nesting, 'Converter'), 'Factory').$default(false) + }; + return converter_factory.$create(self.$backend(), converter_opts); + }, TMP_Document_create_converter_55.$$arity = 0); + + Opal.def(self, '$convert', TMP_Document_convert_56 = function $$convert(opts) { + var $a, TMP_57, self = this, $writer = nil, block = nil, output = nil, transform = nil, exts = nil; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + if ($truthy(self.timings)) { + self.timings.$start("convert")}; + if ($truthy(self.parsed)) { + } else { + self.$parse() + }; + if ($truthy(($truthy($a = $rb_ge(self.safe, $$$($$($nesting, 'SafeMode'), 'SERVER'))) ? $a : opts['$empty?']()))) { + } else { + + if ($truthy((($writer = ["outfile", opts['$[]']("outfile")]), $send(self.attributes, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]))) { + } else { + self.attributes.$delete("outfile") + }; + if ($truthy((($writer = ["outdir", opts['$[]']("outdir")]), $send(self.attributes, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]))) { + } else { + self.attributes.$delete("outdir") + }; + }; + if (self.$doctype()['$==']("inline")) { + if ($truthy((block = ($truthy($a = self.blocks['$[]'](0)) ? $a : self.header)))) { + if ($truthy(($truthy($a = block.$content_model()['$==']("compound")) ? $a : block.$content_model()['$==']("empty")))) { + self.$logger().$warn("no inline candidate; use the inline doctype to convert a single paragragh, verbatim, or raw block") + } else { + output = block.$content() + }} + } else { + + transform = (function() {if ($truthy((function() {if ($truthy(opts['$key?']("header_footer"))) { + return opts['$[]']("header_footer") + } else { + return self.options['$[]']("header_footer") + }; return nil; })())) { + return "document" + } else { + return "embedded" + }; return nil; })(); + output = self.converter.$convert(self, transform); + }; + if ($truthy(self.parent_document)) { + } else if ($truthy(($truthy($a = (exts = self.extensions)) ? exts['$postprocessors?']() : $a))) { + $send(exts.$postprocessors(), 'each', [], (TMP_57 = function(ext){var self = TMP_57.$$s || this; + + + + if (ext == null) { + ext = nil; + }; + return (output = ext.$process_method()['$[]'](self, output));}, TMP_57.$$s = self, TMP_57.$$arity = 1, TMP_57))}; + if ($truthy(self.timings)) { + self.timings.$record("convert")}; + return output; + }, TMP_Document_convert_56.$$arity = -1); + Opal.alias(self, "render", "convert"); + + Opal.def(self, '$write', TMP_Document_write_58 = function $$write(output, target) { + var $a, $b, self = this; + + + if ($truthy(self.timings)) { + self.timings.$start("write")}; + if ($truthy($$($nesting, 'Writer')['$==='](self.converter))) { + self.converter.$write(output, target) + } else { + + if ($truthy(target['$respond_to?']("write"))) { + if ($truthy(output['$nil_or_empty?']())) { + } else { + + target.$write(output.$chomp()); + target.$write($$($nesting, 'LF')); + } + } else if ($truthy($$($nesting, 'COERCE_ENCODING'))) { + $$$('::', 'IO').$write(target, output, $hash2(["encoding"], {"encoding": $$$($$$('::', 'Encoding'), 'UTF_8')})) + } else { + $$$('::', 'IO').$write(target, output) + }; + if ($truthy(($truthy($a = (($b = self.backend['$==']("manpage")) ? $$$('::', 'String')['$==='](target) : self.backend['$==']("manpage"))) ? self.converter['$respond_to?']("write_alternate_pages") : $a))) { + self.converter.$write_alternate_pages(self.attributes['$[]']("mannames"), self.attributes['$[]']("manvolnum"), target)}; + }; + if ($truthy(self.timings)) { + self.timings.$record("write")}; + return nil; + }, TMP_Document_write_58.$$arity = 2); + + Opal.def(self, '$content', TMP_Document_content_59 = function $$content() { + var $iter = TMP_Document_content_59.$$p, $yield = $iter || nil, self = this, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_Document_content_59.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + + self.attributes.$delete("title"); + return $send(self, Opal.find_super_dispatcher(self, 'content', TMP_Document_content_59, false), $zuper, $iter); + }, TMP_Document_content_59.$$arity = 0); + + Opal.def(self, '$docinfo', TMP_Document_docinfo_60 = function $$docinfo(location, suffix) { + var TMP_61, $a, TMP_62, self = this, content = nil, qualifier = nil, docinfo = nil, docinfo_file = nil, docinfo_dir = nil, docinfo_subs = nil, docinfo_path = nil, shd_content = nil, pvt_content = nil; + + + + if (location == null) { + location = "head"; + }; + + if (suffix == null) { + suffix = nil; + }; + if ($truthy($rb_ge(self.$safe(), $$$($$($nesting, 'SafeMode'), 'SECURE')))) { + return "" + } else { + + content = []; + if (location['$==']("head")) { + } else { + qualifier = "" + "-" + (location) + }; + if ($truthy(suffix)) { + } else { + suffix = self.outfilesuffix + }; + if ($truthy((docinfo = self.attributes['$[]']("docinfo"))['$nil_or_empty?']())) { + if ($truthy(self.attributes['$key?']("docinfo2"))) { + docinfo = ["private", "shared"] + } else if ($truthy(self.attributes['$key?']("docinfo1"))) { + docinfo = ["shared"] + } else { + docinfo = (function() {if ($truthy(docinfo)) { + return ["private"] + } else { + return nil + }; return nil; })() + } + } else { + docinfo = $send(docinfo.$split(","), 'map', [], (TMP_61 = function(it){var self = TMP_61.$$s || this; + + + + if (it == null) { + it = nil; + }; + return it.$strip();}, TMP_61.$$s = self, TMP_61.$$arity = 1, TMP_61)) + }; + if ($truthy(docinfo)) { + + $a = ["" + "docinfo" + (qualifier) + (suffix), self.attributes['$[]']("docinfodir"), self.$resolve_docinfo_subs()], (docinfo_file = $a[0]), (docinfo_dir = $a[1]), (docinfo_subs = $a[2]), $a; + if ($truthy(docinfo['$&'](["shared", "" + "shared-" + (location)])['$empty?']())) { + } else { + + docinfo_path = self.$normalize_system_path(docinfo_file, docinfo_dir); + if ($truthy((shd_content = self.$read_asset(docinfo_path, $hash2(["normalize"], {"normalize": true}))))) { + content['$<<'](self.$apply_subs(shd_content, docinfo_subs))}; + }; + if ($truthy(($truthy($a = self.attributes['$[]']("docname")['$nil_or_empty?']()) ? $a : docinfo['$&'](["private", "" + "private-" + (location)])['$empty?']()))) { + } else { + + docinfo_path = self.$normalize_system_path("" + (self.attributes['$[]']("docname")) + "-" + (docinfo_file), docinfo_dir); + if ($truthy((pvt_content = self.$read_asset(docinfo_path, $hash2(["normalize"], {"normalize": true}))))) { + content['$<<'](self.$apply_subs(pvt_content, docinfo_subs))}; + };}; + if ($truthy(($truthy($a = self.extensions) ? self['$docinfo_processors?'](location) : $a))) { + content = $rb_plus(content, $send(self.docinfo_processor_extensions['$[]'](location), 'map', [], (TMP_62 = function(ext){var self = TMP_62.$$s || this; + + + + if (ext == null) { + ext = nil; + }; + return ext.$process_method()['$[]'](self);}, TMP_62.$$s = self, TMP_62.$$arity = 1, TMP_62)).$compact())}; + return content.$join($$($nesting, 'LF')); + }; + }, TMP_Document_docinfo_60.$$arity = -1); + + Opal.def(self, '$resolve_docinfo_subs', TMP_Document_resolve_docinfo_subs_63 = function $$resolve_docinfo_subs() { + var self = this; + + if ($truthy(self.attributes['$key?']("docinfosubs"))) { + + return self.$resolve_subs(self.attributes['$[]']("docinfosubs"), "block", nil, "docinfo"); + } else { + return ["attributes"] + } + }, TMP_Document_resolve_docinfo_subs_63.$$arity = 0); + + Opal.def(self, '$docinfo_processors?', TMP_Document_docinfo_processors$q_64 = function(location) { + var $a, self = this, $writer = nil; + + + + if (location == null) { + location = "head"; + }; + if ($truthy(self.docinfo_processor_extensions['$key?'](location))) { + return self.docinfo_processor_extensions['$[]'](location)['$!='](false) + } else if ($truthy(($truthy($a = self.extensions) ? self.document.$extensions()['$docinfo_processors?'](location) : $a))) { + return (($writer = [location, self.document.$extensions().$docinfo_processors(location)]), $send(self.docinfo_processor_extensions, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])['$!']()['$!']() + } else { + + $writer = [location, false]; + $send(self.docinfo_processor_extensions, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + }; + }, TMP_Document_docinfo_processors$q_64.$$arity = -1); + return (Opal.def(self, '$to_s', TMP_Document_to_s_65 = function $$to_s() { + var self = this; + + return "" + "#<" + (self.$class()) + "@" + (self.$object_id()) + " {doctype: " + (self.$doctype().$inspect()) + ", doctitle: " + ((function() {if ($truthy(self.header['$!='](nil))) { + return self.header.$title() + } else { + return nil + }; return nil; })().$inspect()) + ", blocks: " + (self.blocks.$size()) + "}>" + }, TMP_Document_to_s_65.$$arity = 0), nil) && 'to_s'; + })($nesting[0], $$($nesting, 'AbstractBlock'), $nesting) + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/inline"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $hash2 = Opal.hash2, $send = Opal.send, $truthy = Opal.truthy; + + Opal.add_stubs(['$attr_reader', '$attr_accessor', '$[]', '$dup', '$convert', '$converter', '$attr', '$==', '$apply_reftext_subs', '$reftext']); + return (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + (function($base, $super, $parent_nesting) { + function $Inline(){}; + var self = $Inline = $klass($base, $super, 'Inline', $Inline); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Inline_initialize_1, TMP_Inline_block$q_2, TMP_Inline_inline$q_3, TMP_Inline_convert_4, TMP_Inline_alt_5, TMP_Inline_reftext$q_6, TMP_Inline_reftext_7, TMP_Inline_xreftext_8; + + def.text = def.type = nil; + + self.$attr_reader("text"); + self.$attr_reader("type"); + self.$attr_accessor("target"); + + Opal.def(self, '$initialize', TMP_Inline_initialize_1 = function $$initialize(parent, context, text, opts) { + var $iter = TMP_Inline_initialize_1.$$p, $yield = $iter || nil, self = this, attrs = nil; + + if ($iter) TMP_Inline_initialize_1.$$p = null; + + + if (text == null) { + text = nil; + }; + + if (opts == null) { + opts = $hash2([], {}); + }; + $send(self, Opal.find_super_dispatcher(self, 'initialize', TMP_Inline_initialize_1, false), [parent, context], null); + self.node_name = "" + "inline_" + (context); + self.text = text; + self.id = opts['$[]']("id"); + self.type = opts['$[]']("type"); + self.target = opts['$[]']("target"); + if ($truthy((attrs = opts['$[]']("attributes")))) { + return (self.attributes = attrs.$dup()) + } else { + return nil + }; + }, TMP_Inline_initialize_1.$$arity = -3); + + Opal.def(self, '$block?', TMP_Inline_block$q_2 = function() { + var self = this; + + return false + }, TMP_Inline_block$q_2.$$arity = 0); + + Opal.def(self, '$inline?', TMP_Inline_inline$q_3 = function() { + var self = this; + + return true + }, TMP_Inline_inline$q_3.$$arity = 0); + + Opal.def(self, '$convert', TMP_Inline_convert_4 = function $$convert() { + var self = this; + + return self.$converter().$convert(self) + }, TMP_Inline_convert_4.$$arity = 0); + Opal.alias(self, "render", "convert"); + + Opal.def(self, '$alt', TMP_Inline_alt_5 = function $$alt() { + var self = this; + + return self.$attr("alt") + }, TMP_Inline_alt_5.$$arity = 0); + + Opal.def(self, '$reftext?', TMP_Inline_reftext$q_6 = function() { + var $a, $b, self = this; + + return ($truthy($a = self.text) ? ($truthy($b = self.type['$==']("ref")) ? $b : self.type['$==']("bibref")) : $a) + }, TMP_Inline_reftext$q_6.$$arity = 0); + + Opal.def(self, '$reftext', TMP_Inline_reftext_7 = function $$reftext() { + var self = this, val = nil; + + if ($truthy((val = self.text))) { + + return self.$apply_reftext_subs(val); + } else { + return nil + } + }, TMP_Inline_reftext_7.$$arity = 0); + return (Opal.def(self, '$xreftext', TMP_Inline_xreftext_8 = function $$xreftext(xrefstyle) { + var self = this; + + + + if (xrefstyle == null) { + xrefstyle = nil; + }; + return self.$reftext(); + }, TMP_Inline_xreftext_8.$$arity = -1), nil) && 'xreftext'; + })($nesting[0], $$($nesting, 'AbstractNode'), $nesting) + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/list"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $hash2 = Opal.hash2, $send = Opal.send, $truthy = Opal.truthy; + + Opal.add_stubs(['$==', '$next_list', '$callouts', '$class', '$object_id', '$inspect', '$size', '$items', '$attr_accessor', '$level', '$drop', '$!', '$nil_or_empty?', '$apply_subs', '$empty?', '$===', '$[]', '$outline?', '$simple?', '$context', '$option?', '$shift', '$blocks', '$unshift', '$lines', '$source', '$parent']); + return (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + + (function($base, $super, $parent_nesting) { + function $List(){}; + var self = $List = $klass($base, $super, 'List', $List); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_List_initialize_1, TMP_List_outline$q_2, TMP_List_convert_3, TMP_List_to_s_4; + + def.context = def.document = def.style = nil; + + Opal.alias(self, "items", "blocks"); + Opal.alias(self, "content", "blocks"); + Opal.alias(self, "items?", "blocks?"); + + Opal.def(self, '$initialize', TMP_List_initialize_1 = function $$initialize(parent, context, opts) { + var $iter = TMP_List_initialize_1.$$p, $yield = $iter || nil, self = this, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_List_initialize_1.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + + + if (opts == null) { + opts = $hash2([], {}); + }; + return $send(self, Opal.find_super_dispatcher(self, 'initialize', TMP_List_initialize_1, false), $zuper, $iter); + }, TMP_List_initialize_1.$$arity = -3); + + Opal.def(self, '$outline?', TMP_List_outline$q_2 = function() { + var $a, self = this; + + return ($truthy($a = self.context['$==']("ulist")) ? $a : self.context['$==']("olist")) + }, TMP_List_outline$q_2.$$arity = 0); + + Opal.def(self, '$convert', TMP_List_convert_3 = function $$convert() { + var $iter = TMP_List_convert_3.$$p, $yield = $iter || nil, self = this, result = nil, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_List_convert_3.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + if (self.context['$==']("colist")) { + + result = $send(self, Opal.find_super_dispatcher(self, 'convert', TMP_List_convert_3, false), $zuper, $iter); + self.document.$callouts().$next_list(); + return result; + } else { + return $send(self, Opal.find_super_dispatcher(self, 'convert', TMP_List_convert_3, false), $zuper, $iter) + } + }, TMP_List_convert_3.$$arity = 0); + Opal.alias(self, "render", "convert"); + return (Opal.def(self, '$to_s', TMP_List_to_s_4 = function $$to_s() { + var self = this; + + return "" + "#<" + (self.$class()) + "@" + (self.$object_id()) + " {context: " + (self.context.$inspect()) + ", style: " + (self.style.$inspect()) + ", items: " + (self.$items().$size()) + "}>" + }, TMP_List_to_s_4.$$arity = 0), nil) && 'to_s'; + })($nesting[0], $$($nesting, 'AbstractBlock'), $nesting); + (function($base, $super, $parent_nesting) { + function $ListItem(){}; + var self = $ListItem = $klass($base, $super, 'ListItem', $ListItem); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_ListItem_initialize_5, TMP_ListItem_text$q_6, TMP_ListItem_text_7, TMP_ListItem_text$eq_8, TMP_ListItem_simple$q_9, TMP_ListItem_compound$q_10, TMP_ListItem_fold_first_11, TMP_ListItem_to_s_12; + + def.text = def.subs = def.blocks = nil; + + Opal.alias(self, "list", "parent"); + self.$attr_accessor("marker"); + + Opal.def(self, '$initialize', TMP_ListItem_initialize_5 = function $$initialize(parent, text) { + var $iter = TMP_ListItem_initialize_5.$$p, $yield = $iter || nil, self = this; + + if ($iter) TMP_ListItem_initialize_5.$$p = null; + + + if (text == null) { + text = nil; + }; + $send(self, Opal.find_super_dispatcher(self, 'initialize', TMP_ListItem_initialize_5, false), [parent, "list_item"], null); + self.text = text; + self.level = parent.$level(); + return (self.subs = $$($nesting, 'NORMAL_SUBS').$drop(0)); + }, TMP_ListItem_initialize_5.$$arity = -2); + + Opal.def(self, '$text?', TMP_ListItem_text$q_6 = function() { + var self = this; + + return self.text['$nil_or_empty?']()['$!']() + }, TMP_ListItem_text$q_6.$$arity = 0); + + Opal.def(self, '$text', TMP_ListItem_text_7 = function $$text() { + var $a, self = this; + + return ($truthy($a = self.text) ? self.$apply_subs(self.text, self.subs) : $a) + }, TMP_ListItem_text_7.$$arity = 0); + + Opal.def(self, '$text=', TMP_ListItem_text$eq_8 = function(val) { + var self = this; + + return (self.text = val) + }, TMP_ListItem_text$eq_8.$$arity = 1); + + Opal.def(self, '$simple?', TMP_ListItem_simple$q_9 = function() { + var $a, $b, $c, self = this, blk = nil; + + return ($truthy($a = self.blocks['$empty?']()) ? $a : ($truthy($b = (($c = self.blocks.$size()['$=='](1)) ? $$($nesting, 'List')['$===']((blk = self.blocks['$[]'](0))) : self.blocks.$size()['$=='](1))) ? blk['$outline?']() : $b)) + }, TMP_ListItem_simple$q_9.$$arity = 0); + + Opal.def(self, '$compound?', TMP_ListItem_compound$q_10 = function() { + var self = this; + + return self['$simple?']()['$!']() + }, TMP_ListItem_compound$q_10.$$arity = 0); + + Opal.def(self, '$fold_first', TMP_ListItem_fold_first_11 = function $$fold_first(continuation_connects_first_block, content_adjacent) { + var $a, $b, $c, $d, $e, self = this, first_block = nil, block = nil; + + + + if (continuation_connects_first_block == null) { + continuation_connects_first_block = false; + }; + + if (content_adjacent == null) { + content_adjacent = false; + }; + if ($truthy(($truthy($a = ($truthy($b = (first_block = self.blocks['$[]'](0))) ? $$($nesting, 'Block')['$==='](first_block) : $b)) ? ($truthy($b = (($c = first_block.$context()['$==']("paragraph")) ? continuation_connects_first_block['$!']() : first_block.$context()['$==']("paragraph"))) ? $b : ($truthy($c = ($truthy($d = ($truthy($e = content_adjacent) ? $e : continuation_connects_first_block['$!']())) ? first_block.$context()['$==']("literal") : $d)) ? first_block['$option?']("listparagraph") : $c)) : $a))) { + + block = self.$blocks().$shift(); + if ($truthy(self.text['$nil_or_empty?']())) { + } else { + block.$lines().$unshift(self.text) + }; + self.text = block.$source();}; + return nil; + }, TMP_ListItem_fold_first_11.$$arity = -1); + return (Opal.def(self, '$to_s', TMP_ListItem_to_s_12 = function $$to_s() { + var $a, self = this; + + return "" + "#<" + (self.$class()) + "@" + (self.$object_id()) + " {list_context: " + (self.$parent().$context().$inspect()) + ", text: " + (self.text.$inspect()) + ", blocks: " + (($truthy($a = self.blocks) ? $a : []).$size()) + "}>" + }, TMP_ListItem_to_s_12.$$arity = 0), nil) && 'to_s'; + })($nesting[0], $$($nesting, 'AbstractBlock'), $nesting); + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/parser"] = function(Opal) { + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + function $rb_plus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); + } + function $rb_gt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); + } + function $rb_lt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); + } + function $rb_times(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs * rhs : lhs['$*'](rhs); + } + function $rb_le(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs <= rhs : lhs['$<='](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $send = Opal.send, $truthy = Opal.truthy, $hash2 = Opal.hash2, $gvars = Opal.gvars; + + Opal.add_stubs(['$include', '$new', '$lambda', '$start_with?', '$match?', '$is_delimited_block?', '$raise', '$parse_document_header', '$[]', '$has_more_lines?', '$next_section', '$assign_numeral', '$<<', '$blocks', '$parse_block_metadata_lines', '$attributes', '$is_next_line_doctitle?', '$finalize_header', '$nil_or_empty?', '$title=', '$-', '$sourcemap', '$cursor', '$parse_section_title', '$id=', '$source_location=', '$header', '$attribute_locked?', '$[]=', '$id', '$parse_header_metadata', '$register', '$==', '$doctype', '$parse_manpage_header', '$=~', '$downcase', '$include?', '$sub_attributes', '$error', '$logger', '$message_with_context', '$cursor_at_line', '$backend', '$skip_blank_lines', '$save', '$update', '$is_next_line_section?', '$initialize_section', '$join', '$map', '$read_lines_until', '$to_proc', '$title', '$split', '$lstrip', '$restore_save', '$discard_save', '$context', '$empty?', '$has_header?', '$delete', '$!', '$!=', '$attr?', '$attr', '$key?', '$document', '$+', '$level', '$special', '$sectname', '$to_i', '$>', '$<', '$warn', '$next_block', '$blocks?', '$style', '$context=', '$style=', '$parent=', '$size', '$content_model', '$shift', '$unwrap_standalone_preamble', '$dup', '$fetch', '$parse_block_metadata_line', '$extensions', '$block_macros?', '$mark', '$read_line', '$terminator', '$to_s', '$masq', '$to_sym', '$registered_for_block?', '$cursor_at_mark', '$strict_verbatim_paragraphs', '$unshift_line', '$markdown_syntax', '$keys', '$chr', '$*', '$length', '$end_with?', '$===', '$parse_attributes', '$attribute_missing', '$clear', '$tr', '$basename', '$assign_caption', '$registered_for_block_macro?', '$config', '$process_method', '$replace', '$parse_callout_list', '$callouts', '$parse_list', '$match', '$parse_description_list', '$underline_style_section_titles', '$is_section_title?', '$peek_line', '$atx_section_title?', '$generate_id', '$level=', '$read_paragraph_lines', '$adjust_indentation!', '$set_option', '$map!', '$slice', '$pop', '$build_block', '$apply_subs', '$chop', '$catalog_inline_anchors', '$rekey', '$index', '$strip', '$parse_table', '$concat', '$each', '$title?', '$lock_in_subs', '$sub?', '$catalog_callouts', '$source', '$remove_sub', '$block_terminates_paragraph', '$<=', '$nil?', '$lines', '$parse_blocks', '$parse_list_item', '$items', '$scan', '$gsub', '$count', '$pre_match', '$advance', '$callout_ids', '$next_list', '$catalog_inline_anchor', '$source_location', '$marker=', '$catalog_inline_biblio_anchor', '$text=', '$resolve_ordered_list_marker', '$read_lines_for_list_item', '$skip_line_comments', '$unshift_lines', '$fold_first', '$text?', '$is_sibling_list_item?', '$find', '$delete_at', '$casecmp', '$sectname=', '$special=', '$numbered=', '$numbered', '$lineno', '$update_attributes', '$peek_lines', '$setext_section_title?', '$abs', '$line_length', '$cursor_at_prev_line', '$process_attribute_entries', '$next_line_empty?', '$process_authors', '$apply_header_subs', '$rstrip', '$each_with_index', '$compact', '$Array', '$squeeze', '$to_a', '$parse_style_attribute', '$process_attribute_entry', '$skip_comment_lines', '$store_attribute', '$sanitize_attribute_name', '$set_attribute', '$save_to', '$delete_attribute', '$ord', '$int_to_roman', '$resolve_list_marker', '$parse_colspecs', '$create_columns', '$format', '$starts_with_delimiter?', '$close_open_cell', '$parse_cellspec', '$delimiter', '$match_delimiter', '$post_match', '$buffer_has_unclosed_quotes?', '$skip_past_delimiter', '$buffer', '$buffer=', '$skip_past_escaped_delimiter', '$keep_cell_open', '$push_cellspec', '$close_cell', '$cell_open?', '$columns', '$assign_column_widths', '$has_header_option=', '$partition_header_footer', '$upto', '$shorthand_property_syntax', '$each_char', '$call', '$sub!', '$gsub!', '$%', '$begin']); + return (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + (function($base, $super, $parent_nesting) { + function $Parser(){}; + var self = $Parser = $klass($base, $super, 'Parser', $Parser); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Parser_1, TMP_Parser_2, TMP_Parser_3, TMP_Parser_initialize_4, TMP_Parser_parse_5, TMP_Parser_parse_document_header_6, TMP_Parser_parse_manpage_header_7, TMP_Parser_next_section_9, TMP_Parser_next_block_10, TMP_Parser_read_paragraph_lines_14, TMP_Parser_is_delimited_block$q_15, TMP_Parser_build_block_16, TMP_Parser_parse_blocks_17, TMP_Parser_parse_list_18, TMP_Parser_catalog_callouts_19, TMP_Parser_catalog_inline_anchor_21, TMP_Parser_catalog_inline_anchors_22, TMP_Parser_catalog_inline_biblio_anchor_24, TMP_Parser_parse_description_list_25, TMP_Parser_parse_callout_list_26, TMP_Parser_parse_list_item_27, TMP_Parser_read_lines_for_list_item_28, TMP_Parser_initialize_section_34, TMP_Parser_is_next_line_section$q_35, TMP_Parser_is_next_line_doctitle$q_36, TMP_Parser_is_section_title$q_37, TMP_Parser_atx_section_title$q_38, TMP_Parser_setext_section_title$q_39, TMP_Parser_parse_section_title_40, TMP_Parser_line_length_41, TMP_Parser_line_length_42, TMP_Parser_parse_header_metadata_43, TMP_Parser_process_authors_48, TMP_Parser_parse_block_metadata_lines_54, TMP_Parser_parse_block_metadata_line_55, TMP_Parser_process_attribute_entries_56, TMP_Parser_process_attribute_entry_57, TMP_Parser_store_attribute_58, TMP_Parser_resolve_list_marker_59, TMP_Parser_resolve_ordered_list_marker_60, TMP_Parser_is_sibling_list_item$q_62, TMP_Parser_parse_table_63, TMP_Parser_parse_colspecs_64, TMP_Parser_parse_cellspec_68, TMP_Parser_parse_style_attribute_69, TMP_Parser_adjust_indentation$B_73, TMP_Parser_sanitize_attribute_name_81; + + + self.$include($$($nesting, 'Logging')); + Opal.const_set($nesting[0], 'BlockMatchData', $$($nesting, 'Struct').$new("context", "masq", "tip", "terminator")); + Opal.const_set($nesting[0], 'TabRx', /\t/); + Opal.const_set($nesting[0], 'TabIndentRx', /^\t+/); + Opal.const_set($nesting[0], 'StartOfBlockProc', $send(self, 'lambda', [], (TMP_Parser_1 = function(l){var self = TMP_Parser_1.$$s || this, $a, $b; + + + + if (l == null) { + l = nil; + }; + return ($truthy($a = ($truthy($b = l['$start_with?']("[")) ? $$($nesting, 'BlockAttributeLineRx')['$match?'](l) : $b)) ? $a : self['$is_delimited_block?'](l));}, TMP_Parser_1.$$s = self, TMP_Parser_1.$$arity = 1, TMP_Parser_1))); + Opal.const_set($nesting[0], 'StartOfListProc', $send(self, 'lambda', [], (TMP_Parser_2 = function(l){var self = TMP_Parser_2.$$s || this; + + + + if (l == null) { + l = nil; + }; + return $$($nesting, 'AnyListRx')['$match?'](l);}, TMP_Parser_2.$$s = self, TMP_Parser_2.$$arity = 1, TMP_Parser_2))); + Opal.const_set($nesting[0], 'StartOfBlockOrListProc', $send(self, 'lambda', [], (TMP_Parser_3 = function(l){var self = TMP_Parser_3.$$s || this, $a, $b, $c; + + + + if (l == null) { + l = nil; + }; + return ($truthy($a = ($truthy($b = self['$is_delimited_block?'](l)) ? $b : ($truthy($c = l['$start_with?']("[")) ? $$($nesting, 'BlockAttributeLineRx')['$match?'](l) : $c))) ? $a : $$($nesting, 'AnyListRx')['$match?'](l));}, TMP_Parser_3.$$s = self, TMP_Parser_3.$$arity = 1, TMP_Parser_3))); + Opal.const_set($nesting[0], 'NoOp', nil); + Opal.const_set($nesting[0], 'TableCellHorzAlignments', $hash2(["<", ">", "^"], {"<": "left", ">": "right", "^": "center"})); + Opal.const_set($nesting[0], 'TableCellVertAlignments', $hash2(["<", ">", "^"], {"<": "top", ">": "bottom", "^": "middle"})); + Opal.const_set($nesting[0], 'TableCellStyles', $hash2(["d", "s", "e", "m", "h", "l", "v", "a"], {"d": "none", "s": "strong", "e": "emphasis", "m": "monospaced", "h": "header", "l": "literal", "v": "verse", "a": "asciidoc"})); + + Opal.def(self, '$initialize', TMP_Parser_initialize_4 = function $$initialize() { + var self = this; + + return self.$raise("Au contraire, mon frere. No parser instances will be running around.") + }, TMP_Parser_initialize_4.$$arity = 0); + Opal.defs(self, '$parse', TMP_Parser_parse_5 = function $$parse(reader, document, options) { + var $a, $b, $c, self = this, block_attributes = nil, new_section = nil; + + + + if (options == null) { + options = $hash2([], {}); + }; + block_attributes = self.$parse_document_header(reader, document); + if ($truthy(options['$[]']("header_only"))) { + } else { + while ($truthy(reader['$has_more_lines?']())) { + + $c = self.$next_section(reader, document, block_attributes), $b = Opal.to_ary($c), (new_section = ($b[0] == null ? nil : $b[0])), (block_attributes = ($b[1] == null ? nil : $b[1])), $c; + if ($truthy(new_section)) { + + document.$assign_numeral(new_section); + document.$blocks()['$<<'](new_section);}; + } + }; + return document; + }, TMP_Parser_parse_5.$$arity = -3); + Opal.defs(self, '$parse_document_header', TMP_Parser_parse_document_header_6 = function $$parse_document_header(reader, document) { + var $a, $b, self = this, block_attrs = nil, doc_attrs = nil, implicit_doctitle = nil, assigned_doctitle = nil, val = nil, $writer = nil, source_location = nil, _ = nil, doctitle = nil, atx = nil, separator = nil, section_title = nil, doc_id = nil, doc_role = nil, doc_reftext = nil; + + + block_attrs = self.$parse_block_metadata_lines(reader, document); + doc_attrs = document.$attributes(); + if ($truthy(($truthy($a = (implicit_doctitle = self['$is_next_line_doctitle?'](reader, block_attrs, doc_attrs['$[]']("leveloffset")))) ? block_attrs['$[]']("title") : $a))) { + return document.$finalize_header(block_attrs, false)}; + assigned_doctitle = nil; + if ($truthy((val = doc_attrs['$[]']("doctitle"))['$nil_or_empty?']())) { + } else { + + $writer = [(assigned_doctitle = val)]; + $send(document, 'title=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + if ($truthy(implicit_doctitle)) { + + if ($truthy(document.$sourcemap())) { + source_location = reader.$cursor()}; + $b = self.$parse_section_title(reader, document), $a = Opal.to_ary($b), document['$id='](($a[0] == null ? nil : $a[0])), (_ = ($a[1] == null ? nil : $a[1])), (doctitle = ($a[2] == null ? nil : $a[2])), (_ = ($a[3] == null ? nil : $a[3])), (atx = ($a[4] == null ? nil : $a[4])), $b; + if ($truthy(assigned_doctitle)) { + } else { + + $writer = [(assigned_doctitle = doctitle)]; + $send(document, 'title=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + if ($truthy(source_location)) { + + $writer = [source_location]; + $send(document.$header(), 'source_location=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if ($truthy(($truthy($a = atx) ? $a : document['$attribute_locked?']("compat-mode")))) { + } else { + + $writer = ["compat-mode", ""]; + $send(doc_attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + if ($truthy((separator = block_attrs['$[]']("separator")))) { + if ($truthy(document['$attribute_locked?']("title-separator"))) { + } else { + + $writer = ["title-separator", separator]; + $send(doc_attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }}; + + $writer = ["doctitle", (section_title = doctitle)]; + $send(doc_attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + if ($truthy((doc_id = block_attrs['$[]']("id")))) { + + $writer = [doc_id]; + $send(document, 'id=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + } else { + doc_id = document.$id() + }; + if ($truthy((doc_role = block_attrs['$[]']("role")))) { + + $writer = ["docrole", doc_role]; + $send(doc_attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if ($truthy((doc_reftext = block_attrs['$[]']("reftext")))) { + + $writer = ["reftext", doc_reftext]; + $send(doc_attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + block_attrs = $hash2([], {}); + self.$parse_header_metadata(reader, document); + if ($truthy(doc_id)) { + document.$register("refs", [doc_id, document])};}; + if ($truthy(($truthy($a = (val = doc_attrs['$[]']("doctitle"))['$nil_or_empty?']()) ? $a : val['$=='](section_title)))) { + } else { + + $writer = [(assigned_doctitle = val)]; + $send(document, 'title=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + if ($truthy(assigned_doctitle)) { + + $writer = ["doctitle", assigned_doctitle]; + $send(doc_attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if (document.$doctype()['$==']("manpage")) { + self.$parse_manpage_header(reader, document, block_attrs)}; + return document.$finalize_header(block_attrs); + }, TMP_Parser_parse_document_header_6.$$arity = 2); + Opal.defs(self, '$parse_manpage_header', TMP_Parser_parse_manpage_header_7 = function $$parse_manpage_header(reader, document, block_attributes) { + var $a, $b, TMP_8, self = this, doc_attrs = nil, $writer = nil, manvolnum = nil, mantitle = nil, manname = nil, name_section_level = nil, name_section = nil, name_section_buffer = nil, mannames = nil, error_msg = nil; + + + if ($truthy($$($nesting, 'ManpageTitleVolnumRx')['$=~']((doc_attrs = document.$attributes())['$[]']("doctitle")))) { + + + $writer = ["manvolnum", (manvolnum = (($a = $gvars['~']) === nil ? nil : $a['$[]'](2)))]; + $send(doc_attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["mantitle", (function() {if ($truthy((mantitle = (($a = $gvars['~']) === nil ? nil : $a['$[]'](1)))['$include?']($$($nesting, 'ATTR_REF_HEAD')))) { + + return document.$sub_attributes(mantitle); + } else { + return mantitle + }; return nil; })().$downcase()]; + $send(doc_attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + } else { + + self.$logger().$error(self.$message_with_context("non-conforming manpage title", $hash2(["source_location"], {"source_location": reader.$cursor_at_line(1)}))); + + $writer = ["mantitle", ($truthy($a = ($truthy($b = doc_attrs['$[]']("doctitle")) ? $b : doc_attrs['$[]']("docname"))) ? $a : "command")]; + $send(doc_attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["manvolnum", (manvolnum = "1")]; + $send(doc_attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + }; + if ($truthy(($truthy($a = (manname = doc_attrs['$[]']("manname"))) ? doc_attrs['$[]']("manpurpose") : $a))) { + + ($truthy($a = doc_attrs['$[]']("manname-title")) ? $a : (($writer = ["manname-title", "Name"]), $send(doc_attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + + $writer = ["mannames", [manname]]; + $send(doc_attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + if (document.$backend()['$==']("manpage")) { + + + $writer = ["docname", manname]; + $send(doc_attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["outfilesuffix", "" + "." + (manvolnum)]; + $send(doc_attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];;}; + } else { + + reader.$skip_blank_lines(); + reader.$save(); + block_attributes.$update(self.$parse_block_metadata_lines(reader, document)); + if ($truthy((name_section_level = self['$is_next_line_section?'](reader, $hash2([], {}))))) { + if (name_section_level['$=='](1)) { + + name_section = self.$initialize_section(reader, document, $hash2([], {})); + name_section_buffer = $send(reader.$read_lines_until($hash2(["break_on_blank_lines", "skip_line_comments"], {"break_on_blank_lines": true, "skip_line_comments": true})), 'map', [], "lstrip".$to_proc()).$join(" "); + if ($truthy($$($nesting, 'ManpageNamePurposeRx')['$=~'](name_section_buffer))) { + + ($truthy($a = doc_attrs['$[]']("manname-title")) ? $a : (($writer = ["manname-title", name_section.$title()]), $send(doc_attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + if ($truthy(name_section.$id())) { + + $writer = ["manname-id", name_section.$id()]; + $send(doc_attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + + $writer = ["manpurpose", (($a = $gvars['~']) === nil ? nil : $a['$[]'](2))]; + $send(doc_attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + if ($truthy((manname = (($a = $gvars['~']) === nil ? nil : $a['$[]'](1)))['$include?']($$($nesting, 'ATTR_REF_HEAD')))) { + manname = document.$sub_attributes(manname)}; + if ($truthy(manname['$include?'](","))) { + manname = (mannames = $send(manname.$split(","), 'map', [], (TMP_8 = function(n){var self = TMP_8.$$s || this; + + + + if (n == null) { + n = nil; + }; + return n.$lstrip();}, TMP_8.$$s = self, TMP_8.$$arity = 1, TMP_8)))['$[]'](0) + } else { + mannames = [manname] + }; + + $writer = ["manname", manname]; + $send(doc_attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["mannames", mannames]; + $send(doc_attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + if (document.$backend()['$==']("manpage")) { + + + $writer = ["docname", manname]; + $send(doc_attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["outfilesuffix", "" + "." + (manvolnum)]; + $send(doc_attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];;}; + } else { + error_msg = "non-conforming name section body" + }; + } else { + error_msg = "name section must be at level 1" + } + } else { + error_msg = "name section expected" + }; + if ($truthy(error_msg)) { + + reader.$restore_save(); + self.$logger().$error(self.$message_with_context(error_msg, $hash2(["source_location"], {"source_location": reader.$cursor()}))); + + $writer = ["manname", (manname = ($truthy($a = doc_attrs['$[]']("docname")) ? $a : "command"))]; + $send(doc_attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["mannames", [manname]]; + $send(doc_attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + if (document.$backend()['$==']("manpage")) { + + + $writer = ["docname", manname]; + $send(doc_attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["outfilesuffix", "" + "." + (manvolnum)]; + $send(doc_attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];;}; + } else { + reader.$discard_save() + }; + }; + return nil; + }, TMP_Parser_parse_manpage_header_7.$$arity = 3); + Opal.defs(self, '$next_section', TMP_Parser_next_section_9 = function $$next_section(reader, parent, attributes) { + var $a, $b, $c, $d, self = this, preamble = nil, intro = nil, part = nil, has_header = nil, book = nil, document = nil, $writer = nil, section = nil, current_level = nil, expected_next_level = nil, expected_next_level_alt = nil, title = nil, sectname = nil, next_level = nil, expected_condition = nil, new_section = nil, block_cursor = nil, new_block = nil, first_block = nil, child_block = nil; + + + + if (attributes == null) { + attributes = $hash2([], {}); + }; + preamble = (intro = (part = false)); + if ($truthy(($truthy($a = (($b = parent.$context()['$==']("document")) ? parent.$blocks()['$empty?']() : parent.$context()['$==']("document"))) ? ($truthy($b = ($truthy($c = (has_header = parent['$has_header?']())) ? $c : attributes.$delete("invalid-header"))) ? $b : self['$is_next_line_section?'](reader, attributes)['$!']()) : $a))) { + + book = (document = parent).$doctype()['$==']("book"); + if ($truthy(($truthy($a = has_header) ? $a : ($truthy($b = book) ? attributes['$[]'](1)['$!=']("abstract") : $b)))) { + + preamble = (intro = $$($nesting, 'Block').$new(parent, "preamble", $hash2(["content_model"], {"content_model": "compound"}))); + if ($truthy(($truthy($a = book) ? parent['$attr?']("preface-title") : $a))) { + + $writer = [parent.$attr("preface-title")]; + $send(preamble, 'title=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + parent.$blocks()['$<<'](preamble);}; + section = parent; + current_level = 0; + if ($truthy(parent.$attributes()['$key?']("fragment"))) { + expected_next_level = -1 + } else if ($truthy(book)) { + $a = [1, 0], (expected_next_level = $a[0]), (expected_next_level_alt = $a[1]), $a + } else { + expected_next_level = 1 + }; + } else { + + book = (document = parent.$document()).$doctype()['$==']("book"); + section = self.$initialize_section(reader, parent, attributes); + attributes = (function() {if ($truthy((title = attributes['$[]']("title")))) { + return $hash2(["title"], {"title": title}) + } else { + return $hash2([], {}) + }; return nil; })(); + expected_next_level = $rb_plus((current_level = section.$level()), 1); + if (current_level['$=='](0)) { + part = book + } else if ($truthy((($a = current_level['$=='](1)) ? section.$special() : current_level['$=='](1)))) { + if ($truthy(($truthy($a = ($truthy($b = (sectname = section.$sectname())['$==']("appendix")) ? $b : sectname['$==']("preface"))) ? $a : sectname['$==']("abstract")))) { + } else { + expected_next_level = nil + }}; + }; + reader.$skip_blank_lines(); + while ($truthy(reader['$has_more_lines?']())) { + + self.$parse_block_metadata_lines(reader, document, attributes); + if ($truthy((next_level = self['$is_next_line_section?'](reader, attributes)))) { + + if ($truthy(document['$attr?']("leveloffset"))) { + next_level = $rb_plus(next_level, document.$attr("leveloffset").$to_i())}; + if ($truthy($rb_gt(next_level, current_level))) { + + if ($truthy(expected_next_level)) { + if ($truthy(($truthy($b = ($truthy($c = next_level['$=='](expected_next_level)) ? $c : ($truthy($d = expected_next_level_alt) ? next_level['$=='](expected_next_level_alt) : $d))) ? $b : $rb_lt(expected_next_level, 0)))) { + } else { + + expected_condition = (function() {if ($truthy(expected_next_level_alt)) { + return "" + "expected levels " + (expected_next_level_alt) + " or " + (expected_next_level) + } else { + return "" + "expected level " + (expected_next_level) + }; return nil; })(); + self.$logger().$warn(self.$message_with_context("" + "section title out of sequence: " + (expected_condition) + ", got level " + (next_level), $hash2(["source_location"], {"source_location": reader.$cursor()}))); + } + } else { + self.$logger().$error(self.$message_with_context("" + (sectname) + " sections do not support nested sections", $hash2(["source_location"], {"source_location": reader.$cursor()}))) + }; + $c = self.$next_section(reader, section, attributes), $b = Opal.to_ary($c), (new_section = ($b[0] == null ? nil : $b[0])), (attributes = ($b[1] == null ? nil : $b[1])), $c; + section.$assign_numeral(new_section); + section.$blocks()['$<<'](new_section); + } else if ($truthy((($b = next_level['$=='](0)) ? section['$=='](document) : next_level['$=='](0)))) { + + if ($truthy(book)) { + } else { + self.$logger().$error(self.$message_with_context("level 0 sections can only be used when doctype is book", $hash2(["source_location"], {"source_location": reader.$cursor()}))) + }; + $c = self.$next_section(reader, section, attributes), $b = Opal.to_ary($c), (new_section = ($b[0] == null ? nil : $b[0])), (attributes = ($b[1] == null ? nil : $b[1])), $c; + section.$assign_numeral(new_section); + section.$blocks()['$<<'](new_section); + } else { + break; + }; + } else { + + block_cursor = reader.$cursor(); + if ($truthy((new_block = self.$next_block(reader, ($truthy($b = intro) ? $b : section), attributes, $hash2(["parse_metadata"], {"parse_metadata": false}))))) { + + if ($truthy(part)) { + if ($truthy(section['$blocks?']()['$!']())) { + if ($truthy(new_block.$style()['$!=']("partintro"))) { + if (new_block.$context()['$==']("paragraph")) { + + + $writer = ["open"]; + $send(new_block, 'context=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["partintro"]; + $send(new_block, 'style=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + } else { + + + $writer = [(intro = $$($nesting, 'Block').$new(section, "open", $hash2(["content_model"], {"content_model": "compound"})))]; + $send(new_block, 'parent=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["partintro"]; + $send(intro, 'style=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + section.$blocks()['$<<'](intro); + }} + } else if (section.$blocks().$size()['$=='](1)) { + + first_block = section.$blocks()['$[]'](0); + if ($truthy(($truthy($b = intro['$!']()) ? first_block.$content_model()['$==']("compound") : $b))) { + self.$logger().$error(self.$message_with_context("illegal block content outside of partintro block", $hash2(["source_location"], {"source_location": block_cursor}))) + } else if ($truthy(first_block.$content_model()['$!=']("compound"))) { + + + $writer = [(intro = $$($nesting, 'Block').$new(section, "open", $hash2(["content_model"], {"content_model": "compound"})))]; + $send(new_block, 'parent=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["partintro"]; + $send(intro, 'style=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + section.$blocks().$shift(); + if (first_block.$style()['$==']("partintro")) { + + + $writer = ["paragraph"]; + $send(first_block, 'context=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = [nil]; + $send(first_block, 'style=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];;}; + intro['$<<'](first_block); + section.$blocks()['$<<'](intro);};}}; + ($truthy($b = intro) ? $b : section).$blocks()['$<<'](new_block); + attributes = $hash2([], {});}; + }; + if ($truthy($b = reader.$skip_blank_lines())) { + $b + } else { + break; + }; + }; + if ($truthy(part)) { + if ($truthy(($truthy($a = section['$blocks?']()) ? section.$blocks()['$[]'](-1).$context()['$==']("section") : $a))) { + } else { + self.$logger().$error(self.$message_with_context("invalid part, must have at least one section (e.g., chapter, appendix, etc.)", $hash2(["source_location"], {"source_location": reader.$cursor()}))) + } + } else if ($truthy(preamble)) { + if ($truthy(preamble['$blocks?']())) { + if ($truthy(($truthy($a = ($truthy($b = book) ? $b : document.$blocks()['$[]'](1))) ? $a : $$($nesting, 'Compliance').$unwrap_standalone_preamble()['$!']()))) { + } else { + + document.$blocks().$shift(); + while ($truthy((child_block = preamble.$blocks().$shift()))) { + document['$<<'](child_block) + }; + } + } else { + document.$blocks().$shift() + }}; + return [(function() {if ($truthy(section['$!='](parent))) { + return section + } else { + return nil + }; return nil; })(), attributes.$dup()]; + }, TMP_Parser_next_section_9.$$arity = -3); + Opal.defs(self, '$next_block', TMP_Parser_next_block_10 = function $$next_block(reader, parent, attributes, options) {try { + + var $a, $b, $c, TMP_11, $d, TMP_12, TMP_13, self = this, skipped = nil, text_only = nil, document = nil, extensions = nil, block_extensions = nil, block_macro_extensions = nil, this_line = nil, doc_attrs = nil, style = nil, block = nil, block_context = nil, cloaked_context = nil, terminator = nil, delimited_block = nil, $writer = nil, indented = nil, md_syntax = nil, ch0 = nil, layout_break_chars = nil, ll = nil, blk_ctx = nil, target = nil, blk_attrs = nil, $case = nil, posattrs = nil, scaledwidth = nil, extension = nil, content = nil, default_attrs = nil, match = nil, float_id = nil, float_reftext = nil, float_title = nil, float_level = nil, lines = nil, in_list = nil, admonition_name = nil, credit_line = nil, attribution = nil, citetitle = nil, language = nil, comma_idx = nil, block_cursor = nil, block_reader = nil, content_model = nil, pos_attrs = nil, block_id = nil; + if ($gvars["~"] == null) $gvars["~"] = nil; + + + + if (attributes == null) { + attributes = $hash2([], {}); + }; + + if (options == null) { + options = $hash2([], {}); + }; + if ($truthy((skipped = reader.$skip_blank_lines()))) { + } else { + return nil + }; + if ($truthy(($truthy($a = (text_only = options['$[]']("text"))) ? $rb_gt(skipped, 0) : $a))) { + + options.$delete("text"); + text_only = false;}; + document = parent.$document(); + if ($truthy(options.$fetch("parse_metadata", true))) { + while ($truthy(self.$parse_block_metadata_line(reader, document, attributes, options))) { + + reader.$shift(); + ($truthy($b = reader.$skip_blank_lines()) ? $b : Opal.ret(nil)); + }}; + if ($truthy((extensions = document.$extensions()))) { + $a = [extensions['$blocks?'](), extensions['$block_macros?']()], (block_extensions = $a[0]), (block_macro_extensions = $a[1]), $a}; + reader.$mark(); + $a = [reader.$read_line(), document.$attributes(), attributes['$[]'](1)], (this_line = $a[0]), (doc_attrs = $a[1]), (style = $a[2]), $a; + block = (block_context = (cloaked_context = (terminator = nil))); + if ($truthy((delimited_block = self['$is_delimited_block?'](this_line, true)))) { + + block_context = (cloaked_context = delimited_block.$context()); + terminator = delimited_block.$terminator(); + if ($truthy(style['$!']())) { + style = (($writer = ["style", block_context.$to_s()]), $send(attributes, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]) + } else if ($truthy(style['$!='](block_context.$to_s()))) { + if ($truthy(delimited_block.$masq()['$include?'](style))) { + block_context = style.$to_sym() + } else if ($truthy(($truthy($a = delimited_block.$masq()['$include?']("admonition")) ? $$($nesting, 'ADMONITION_STYLES')['$include?'](style) : $a))) { + block_context = "admonition" + } else if ($truthy(($truthy($a = block_extensions) ? extensions['$registered_for_block?'](style, block_context) : $a))) { + block_context = style.$to_sym() + } else { + + self.$logger().$warn(self.$message_with_context("" + "invalid style for " + (block_context) + " block: " + (style), $hash2(["source_location"], {"source_location": reader.$cursor_at_mark()}))); + style = block_context.$to_s(); + }};}; + if ($truthy(delimited_block)) { + } else { + while ($truthy(true)) { + + if ($truthy(($truthy($b = ($truthy($c = style) ? $$($nesting, 'Compliance').$strict_verbatim_paragraphs() : $c)) ? $$($nesting, 'VERBATIM_STYLES')['$include?'](style) : $b))) { + + block_context = style.$to_sym(); + reader.$unshift_line(this_line); + break;;}; + if ($truthy(text_only)) { + indented = this_line['$start_with?'](" ", $$($nesting, 'TAB')) + } else { + + md_syntax = $$($nesting, 'Compliance').$markdown_syntax(); + if ($truthy(this_line['$start_with?'](" "))) { + + $b = [true, " "], (indented = $b[0]), (ch0 = $b[1]), $b; + if ($truthy(($truthy($b = ($truthy($c = md_syntax) ? $send(this_line.$lstrip(), 'start_with?', Opal.to_a($$($nesting, 'MARKDOWN_THEMATIC_BREAK_CHARS').$keys())) : $c)) ? $$($nesting, 'MarkdownThematicBreakRx')['$match?'](this_line) : $b))) { + + block = $$($nesting, 'Block').$new(parent, "thematic_break", $hash2(["content_model"], {"content_model": "empty"})); + break;;}; + } else if ($truthy(this_line['$start_with?']($$($nesting, 'TAB')))) { + $b = [true, $$($nesting, 'TAB')], (indented = $b[0]), (ch0 = $b[1]), $b + } else { + + $b = [false, this_line.$chr()], (indented = $b[0]), (ch0 = $b[1]), $b; + layout_break_chars = (function() {if ($truthy(md_syntax)) { + return $$($nesting, 'HYBRID_LAYOUT_BREAK_CHARS') + } else { + return $$($nesting, 'LAYOUT_BREAK_CHARS') + }; return nil; })(); + if ($truthy(($truthy($b = layout_break_chars['$key?'](ch0)) ? (function() {if ($truthy(md_syntax)) { + + return $$($nesting, 'ExtLayoutBreakRx')['$match?'](this_line); + } else { + + return (($c = this_line['$==']($rb_times(ch0, (ll = this_line.$length())))) ? $rb_gt(ll, 2) : this_line['$==']($rb_times(ch0, (ll = this_line.$length())))); + }; return nil; })() : $b))) { + + block = $$($nesting, 'Block').$new(parent, layout_break_chars['$[]'](ch0), $hash2(["content_model"], {"content_model": "empty"})); + break;; + } else if ($truthy(($truthy($b = this_line['$end_with?']("]")) ? this_line['$include?']("::") : $b))) { + if ($truthy(($truthy($b = ($truthy($c = ch0['$==']("i")) ? $c : this_line['$start_with?']("video:", "audio:"))) ? $$($nesting, 'BlockMediaMacroRx')['$=~'](this_line) : $b))) { + + $b = [(($c = $gvars['~']) === nil ? nil : $c['$[]'](1)).$to_sym(), (($c = $gvars['~']) === nil ? nil : $c['$[]'](2)), (($c = $gvars['~']) === nil ? nil : $c['$[]'](3))], (blk_ctx = $b[0]), (target = $b[1]), (blk_attrs = $b[2]), $b; + block = $$($nesting, 'Block').$new(parent, blk_ctx, $hash2(["content_model"], {"content_model": "empty"})); + if ($truthy(blk_attrs)) { + + $case = blk_ctx; + if ("video"['$===']($case)) {posattrs = ["poster", "width", "height"]} + else if ("audio"['$===']($case)) {posattrs = []} + else {posattrs = ["alt", "width", "height"]}; + block.$parse_attributes(blk_attrs, posattrs, $hash2(["sub_input", "into"], {"sub_input": true, "into": attributes}));}; + if ($truthy(attributes['$key?']("style"))) { + attributes.$delete("style")}; + if ($truthy(($truthy($b = target['$include?']($$($nesting, 'ATTR_REF_HEAD'))) ? (target = block.$sub_attributes(target, $hash2(["attribute_missing"], {"attribute_missing": "drop-line"})))['$empty?']() : $b))) { + if (($truthy($b = doc_attrs['$[]']("attribute-missing")) ? $b : $$($nesting, 'Compliance').$attribute_missing())['$==']("skip")) { + return $$($nesting, 'Block').$new(parent, "paragraph", $hash2(["content_model", "source"], {"content_model": "simple", "source": [this_line]})) + } else { + + attributes.$clear(); + return nil; + }}; + if (blk_ctx['$==']("image")) { + + document.$register("images", [target, (($writer = ["imagesdir", doc_attrs['$[]']("imagesdir")]), $send(attributes, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])]); + ($truthy($b = attributes['$[]']("alt")) ? $b : (($writer = ["alt", ($truthy($c = style) ? $c : (($writer = ["default-alt", $$($nesting, 'Helpers').$basename(target, true).$tr("_-", " ")]), $send(attributes, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]))]), $send(attributes, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + if ($truthy((scaledwidth = attributes.$delete("scaledwidth"))['$nil_or_empty?']())) { + } else { + + $writer = ["scaledwidth", (function() {if ($truthy($$($nesting, 'TrailingDigitsRx')['$match?'](scaledwidth))) { + return "" + (scaledwidth) + "%" + } else { + return scaledwidth + }; return nil; })()]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + if ($truthy(attributes['$key?']("title"))) { + + + $writer = [attributes.$delete("title")]; + $send(block, 'title=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + block.$assign_caption(attributes.$delete("caption"), "figure");};}; + + $writer = ["target", target]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + break;; + } else if ($truthy(($truthy($b = (($c = ch0['$==']("t")) ? this_line['$start_with?']("toc:") : ch0['$==']("t"))) ? $$($nesting, 'BlockTocMacroRx')['$=~'](this_line) : $b))) { + + block = $$($nesting, 'Block').$new(parent, "toc", $hash2(["content_model"], {"content_model": "empty"})); + if ($truthy((($b = $gvars['~']) === nil ? nil : $b['$[]'](1)))) { + block.$parse_attributes((($b = $gvars['~']) === nil ? nil : $b['$[]'](1)), [], $hash2(["into"], {"into": attributes}))}; + break;; + } else if ($truthy(($truthy($b = ($truthy($c = block_macro_extensions) ? $$($nesting, 'CustomBlockMacroRx')['$=~'](this_line) : $c)) ? (extension = extensions['$registered_for_block_macro?']((($c = $gvars['~']) === nil ? nil : $c['$[]'](1)))) : $b))) { + + $b = [(($c = $gvars['~']) === nil ? nil : $c['$[]'](2)), (($c = $gvars['~']) === nil ? nil : $c['$[]'](3))], (target = $b[0]), (content = $b[1]), $b; + if ($truthy(($truthy($b = ($truthy($c = target['$include?']($$($nesting, 'ATTR_REF_HEAD'))) ? (target = parent.$sub_attributes(target))['$empty?']() : $c)) ? ($truthy($c = doc_attrs['$[]']("attribute-missing")) ? $c : $$($nesting, 'Compliance').$attribute_missing())['$==']("drop-line") : $b))) { + + attributes.$clear(); + return nil;}; + if (extension.$config()['$[]']("content_model")['$==']("attributes")) { + if ($truthy(content)) { + document.$parse_attributes(content, ($truthy($b = extension.$config()['$[]']("pos_attrs")) ? $b : []), $hash2(["sub_input", "into"], {"sub_input": true, "into": attributes}))} + } else { + + $writer = ["text", ($truthy($b = content) ? $b : "")]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + if ($truthy((default_attrs = extension.$config()['$[]']("default_attrs")))) { + $send(attributes, 'update', [default_attrs], (TMP_11 = function(_, old_v){var self = TMP_11.$$s || this; + + + + if (_ == null) { + _ = nil; + }; + + if (old_v == null) { + old_v = nil; + }; + return old_v;}, TMP_11.$$s = self, TMP_11.$$arity = 2, TMP_11))}; + if ($truthy((block = extension.$process_method()['$[]'](parent, target, attributes)))) { + + attributes.$replace(block.$attributes()); + break;; + } else { + + attributes.$clear(); + return nil; + };}}; + }; + }; + if ($truthy(($truthy($b = ($truthy($c = indented['$!']()) ? (ch0 = ($truthy($d = ch0) ? $d : this_line.$chr()))['$==']("<") : $c)) ? $$($nesting, 'CalloutListRx')['$=~'](this_line) : $b))) { + + reader.$unshift_line(this_line); + block = self.$parse_callout_list(reader, $gvars["~"], parent, document.$callouts()); + + $writer = ["style", "arabic"]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + break;; + } else if ($truthy($$($nesting, 'UnorderedListRx')['$match?'](this_line))) { + + reader.$unshift_line(this_line); + if ($truthy(($truthy($b = ($truthy($c = style['$!']()) ? $$($nesting, 'Section')['$==='](parent) : $c)) ? parent.$sectname()['$==']("bibliography") : $b))) { + + $writer = ["style", (style = "bibliography")]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + block = self.$parse_list(reader, "ulist", parent, style); + break;; + } else if ($truthy((match = $$($nesting, 'OrderedListRx').$match(this_line)))) { + + reader.$unshift_line(this_line); + block = self.$parse_list(reader, "olist", parent, style); + if ($truthy(block.$style())) { + + $writer = ["style", block.$style()]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + break;; + } else if ($truthy((match = $$($nesting, 'DescriptionListRx').$match(this_line)))) { + + reader.$unshift_line(this_line); + block = self.$parse_description_list(reader, match, parent); + break;; + } else if ($truthy(($truthy($b = ($truthy($c = style['$==']("float")) ? $c : style['$==']("discrete"))) ? (function() {if ($truthy($$($nesting, 'Compliance').$underline_style_section_titles())) { + + return self['$is_section_title?'](this_line, reader.$peek_line()); + } else { + return ($truthy($c = indented['$!']()) ? self['$atx_section_title?'](this_line) : $c) + }; return nil; })() : $b))) { + + reader.$unshift_line(this_line); + $c = self.$parse_section_title(reader, document, attributes['$[]']("id")), $b = Opal.to_ary($c), (float_id = ($b[0] == null ? nil : $b[0])), (float_reftext = ($b[1] == null ? nil : $b[1])), (float_title = ($b[2] == null ? nil : $b[2])), (float_level = ($b[3] == null ? nil : $b[3])), $c; + if ($truthy(float_reftext)) { + + $writer = ["reftext", float_reftext]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + block = $$($nesting, 'Block').$new(parent, "floating_title", $hash2(["content_model"], {"content_model": "empty"})); + + $writer = [float_title]; + $send(block, 'title=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + attributes.$delete("title"); + + $writer = [($truthy($b = float_id) ? $b : (function() {if ($truthy(doc_attrs['$key?']("sectids"))) { + + return $$($nesting, 'Section').$generate_id(block.$title(), document); + } else { + return nil + }; return nil; })())]; + $send(block, 'id=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = [float_level]; + $send(block, 'level=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + break;; + } else if ($truthy(($truthy($b = style) ? style['$!=']("normal") : $b))) { + if ($truthy($$($nesting, 'PARAGRAPH_STYLES')['$include?'](style))) { + + block_context = style.$to_sym(); + cloaked_context = "paragraph"; + reader.$unshift_line(this_line); + break;; + } else if ($truthy($$($nesting, 'ADMONITION_STYLES')['$include?'](style))) { + + block_context = "admonition"; + cloaked_context = "paragraph"; + reader.$unshift_line(this_line); + break;; + } else if ($truthy(($truthy($b = block_extensions) ? extensions['$registered_for_block?'](style, "paragraph") : $b))) { + + block_context = style.$to_sym(); + cloaked_context = "paragraph"; + reader.$unshift_line(this_line); + break;; + } else { + + self.$logger().$warn(self.$message_with_context("" + "invalid style for paragraph: " + (style), $hash2(["source_location"], {"source_location": reader.$cursor_at_mark()}))); + style = nil; + }}; + reader.$unshift_line(this_line); + if ($truthy(($truthy($b = indented) ? style['$!']() : $b))) { + + lines = self.$read_paragraph_lines(reader, ($truthy($b = (in_list = $$($nesting, 'ListItem')['$==='](parent))) ? skipped['$=='](0) : $b), $hash2(["skip_line_comments"], {"skip_line_comments": text_only})); + self['$adjust_indentation!'](lines); + block = $$($nesting, 'Block').$new(parent, "literal", $hash2(["content_model", "source", "attributes"], {"content_model": "verbatim", "source": lines, "attributes": attributes})); + if ($truthy(in_list)) { + block.$set_option("listparagraph")}; + } else { + + lines = self.$read_paragraph_lines(reader, (($b = skipped['$=='](0)) ? $$($nesting, 'ListItem')['$==='](parent) : skipped['$=='](0)), $hash2(["skip_line_comments"], {"skip_line_comments": true})); + if ($truthy(text_only)) { + + if ($truthy(($truthy($b = indented) ? style['$==']("normal") : $b))) { + self['$adjust_indentation!'](lines)}; + block = $$($nesting, 'Block').$new(parent, "paragraph", $hash2(["content_model", "source", "attributes"], {"content_model": "simple", "source": lines, "attributes": attributes})); + } else if ($truthy(($truthy($b = ($truthy($c = $$($nesting, 'ADMONITION_STYLE_HEADS')['$include?'](ch0)) ? this_line['$include?'](":") : $c)) ? $$($nesting, 'AdmonitionParagraphRx')['$=~'](this_line) : $b))) { + + + $writer = [0, (($b = $gvars['~']) === nil ? nil : $b.$post_match())]; + $send(lines, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["name", (admonition_name = (($writer = ["style", (($b = $gvars['~']) === nil ? nil : $b['$[]'](1))]), $send(attributes, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]).$downcase())]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["textlabel", ($truthy($b = attributes.$delete("caption")) ? $b : doc_attrs['$[]']("" + (admonition_name) + "-caption"))]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + block = $$($nesting, 'Block').$new(parent, "admonition", $hash2(["content_model", "source", "attributes"], {"content_model": "simple", "source": lines, "attributes": attributes})); + } else if ($truthy(($truthy($b = ($truthy($c = md_syntax) ? ch0['$=='](">") : $c)) ? this_line['$start_with?']("> ") : $b))) { + + $send(lines, 'map!', [], (TMP_12 = function(line){var self = TMP_12.$$s || this; + + + + if (line == null) { + line = nil; + }; + if (line['$=='](">")) { + + return line.$slice(1, line.$length()); + } else { + + if ($truthy(line['$start_with?']("> "))) { + + return line.$slice(2, line.$length()); + } else { + return line + }; + };}, TMP_12.$$s = self, TMP_12.$$arity = 1, TMP_12)); + if ($truthy(lines['$[]'](-1)['$start_with?']("-- "))) { + + credit_line = (credit_line = lines.$pop()).$slice(3, credit_line.$length()); + while ($truthy(lines['$[]'](-1)['$empty?']())) { + lines.$pop() + };}; + + $writer = ["style", "quote"]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + block = self.$build_block("quote", "compound", false, parent, $$($nesting, 'Reader').$new(lines), attributes); + if ($truthy(credit_line)) { + + $c = block.$apply_subs(credit_line).$split(", ", 2), $b = Opal.to_ary($c), (attribution = ($b[0] == null ? nil : $b[0])), (citetitle = ($b[1] == null ? nil : $b[1])), $c; + if ($truthy(attribution)) { + + $writer = ["attribution", attribution]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if ($truthy(citetitle)) { + + $writer = ["citetitle", citetitle]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];};}; + } else if ($truthy(($truthy($b = ($truthy($c = (($d = ch0['$==']("\"")) ? $rb_gt(lines.$size(), 1) : ch0['$==']("\""))) ? lines['$[]'](-1)['$start_with?']("-- ") : $c)) ? lines['$[]'](-2)['$end_with?']("\"") : $b))) { + + + $writer = [0, this_line.$slice(1, this_line.$length())]; + $send(lines, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + credit_line = (credit_line = lines.$pop()).$slice(3, credit_line.$length()); + while ($truthy(lines['$[]'](-1)['$empty?']())) { + lines.$pop() + }; + lines['$<<'](lines.$pop().$chop()); + + $writer = ["style", "quote"]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + block = $$($nesting, 'Block').$new(parent, "quote", $hash2(["content_model", "source", "attributes"], {"content_model": "simple", "source": lines, "attributes": attributes})); + $c = block.$apply_subs(credit_line).$split(", ", 2), $b = Opal.to_ary($c), (attribution = ($b[0] == null ? nil : $b[0])), (citetitle = ($b[1] == null ? nil : $b[1])), $c; + if ($truthy(attribution)) { + + $writer = ["attribution", attribution]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if ($truthy(citetitle)) { + + $writer = ["citetitle", citetitle]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + } else { + + if ($truthy(($truthy($b = indented) ? style['$==']("normal") : $b))) { + self['$adjust_indentation!'](lines)}; + block = $$($nesting, 'Block').$new(parent, "paragraph", $hash2(["content_model", "source", "attributes"], {"content_model": "simple", "source": lines, "attributes": attributes})); + }; + self.$catalog_inline_anchors(lines.$join($$($nesting, 'LF')), block, document, reader); + }; + break;; + } + }; + if ($truthy(block)) { + } else { + + if ($truthy(($truthy($a = block_context['$==']("abstract")) ? $a : block_context['$==']("partintro")))) { + block_context = "open"}; + $case = block_context; + if ("admonition"['$===']($case)) { + + $writer = ["name", (admonition_name = style.$downcase())]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["textlabel", ($truthy($a = attributes.$delete("caption")) ? $a : doc_attrs['$[]']("" + (admonition_name) + "-caption"))]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + block = self.$build_block(block_context, "compound", terminator, parent, reader, attributes);} + else if ("comment"['$===']($case)) { + self.$build_block(block_context, "skip", terminator, parent, reader, attributes); + attributes.$clear(); + return nil;} + else if ("example"['$===']($case)) {block = self.$build_block(block_context, "compound", terminator, parent, reader, attributes)} + else if ("listing"['$===']($case) || "literal"['$===']($case)) {block = self.$build_block(block_context, "verbatim", terminator, parent, reader, attributes)} + else if ("source"['$===']($case)) { + $$($nesting, 'AttributeList').$rekey(attributes, [nil, "language", "linenums"]); + if ($truthy(attributes['$key?']("language"))) { + } else if ($truthy(doc_attrs['$key?']("source-language"))) { + + $writer = ["language", ($truthy($a = doc_attrs['$[]']("source-language")) ? $a : "text")]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if ($truthy(attributes['$key?']("linenums"))) { + } else if ($truthy(($truthy($a = attributes['$key?']("linenums-option")) ? $a : doc_attrs['$key?']("source-linenums-option")))) { + + $writer = ["linenums", ""]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if ($truthy(attributes['$key?']("indent"))) { + } else if ($truthy(doc_attrs['$key?']("source-indent"))) { + + $writer = ["indent", doc_attrs['$[]']("source-indent")]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + block = self.$build_block("listing", "verbatim", terminator, parent, reader, attributes);} + else if ("fenced_code"['$===']($case)) { + + $writer = ["style", "source"]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + if ((ll = this_line.$length())['$=='](3)) { + language = nil + } else if ($truthy((comma_idx = (language = this_line.$slice(3, ll)).$index(",")))) { + if ($truthy($rb_gt(comma_idx, 0))) { + + language = language.$slice(0, comma_idx).$strip(); + if ($truthy($rb_lt(comma_idx, $rb_minus(ll, 4)))) { + + $writer = ["linenums", ""]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + } else { + + language = nil; + if ($truthy($rb_gt(ll, 4))) { + + $writer = ["linenums", ""]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + } + } else { + language = language.$lstrip() + }; + if ($truthy(language['$nil_or_empty?']())) { + if ($truthy(doc_attrs['$key?']("source-language"))) { + + $writer = ["language", ($truthy($a = doc_attrs['$[]']("source-language")) ? $a : "text")]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];} + } else { + + $writer = ["language", language]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + if ($truthy(attributes['$key?']("linenums"))) { + } else if ($truthy(($truthy($a = attributes['$key?']("linenums-option")) ? $a : doc_attrs['$key?']("source-linenums-option")))) { + + $writer = ["linenums", ""]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if ($truthy(attributes['$key?']("indent"))) { + } else if ($truthy(doc_attrs['$key?']("source-indent"))) { + + $writer = ["indent", doc_attrs['$[]']("source-indent")]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + terminator = terminator.$slice(0, 3); + block = self.$build_block("listing", "verbatim", terminator, parent, reader, attributes);} + else if ("pass"['$===']($case)) {block = self.$build_block(block_context, "raw", terminator, parent, reader, attributes)} + else if ("stem"['$===']($case) || "latexmath"['$===']($case) || "asciimath"['$===']($case)) { + if (block_context['$==']("stem")) { + + $writer = ["style", $$($nesting, 'STEM_TYPE_ALIASES')['$[]'](($truthy($a = attributes['$[]'](2)) ? $a : doc_attrs['$[]']("stem")))]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + block = self.$build_block("stem", "raw", terminator, parent, reader, attributes);} + else if ("open"['$===']($case) || "sidebar"['$===']($case)) {block = self.$build_block(block_context, "compound", terminator, parent, reader, attributes)} + else if ("table"['$===']($case)) { + block_cursor = reader.$cursor(); + block_reader = $$($nesting, 'Reader').$new(reader.$read_lines_until($hash2(["terminator", "skip_line_comments", "context", "cursor"], {"terminator": terminator, "skip_line_comments": true, "context": "table", "cursor": "at_mark"})), block_cursor); + if ($truthy(terminator['$start_with?']("|", "!"))) { + } else { + ($truthy($a = attributes['$[]']("format")) ? $a : (($writer = ["format", (function() {if ($truthy(terminator['$start_with?'](","))) { + return "csv" + } else { + return "dsv" + }; return nil; })()]), $send(attributes, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])) + }; + block = self.$parse_table(block_reader, parent, attributes);} + else if ("quote"['$===']($case) || "verse"['$===']($case)) { + $$($nesting, 'AttributeList').$rekey(attributes, [nil, "attribution", "citetitle"]); + block = self.$build_block(block_context, (function() {if (block_context['$==']("verse")) { + return "verbatim" + } else { + return "compound" + }; return nil; })(), terminator, parent, reader, attributes);} + else {if ($truthy(($truthy($a = block_extensions) ? (extension = extensions['$registered_for_block?'](block_context, cloaked_context)) : $a))) { + + if ($truthy((content_model = extension.$config()['$[]']("content_model"))['$!=']("skip"))) { + + if ($truthy((pos_attrs = ($truthy($a = extension.$config()['$[]']("pos_attrs")) ? $a : []))['$empty?']()['$!']())) { + $$($nesting, 'AttributeList').$rekey(attributes, [nil].$concat(pos_attrs))}; + if ($truthy((default_attrs = extension.$config()['$[]']("default_attrs")))) { + $send(default_attrs, 'each', [], (TMP_13 = function(k, v){var self = TMP_13.$$s || this, $e; + + + + if (k == null) { + k = nil; + }; + + if (v == null) { + v = nil; + }; + return ($truthy($e = attributes['$[]'](k)) ? $e : (($writer = [k, v]), $send(attributes, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]));}, TMP_13.$$s = self, TMP_13.$$arity = 2, TMP_13))}; + + $writer = ["cloaked-context", cloaked_context]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];;}; + block = self.$build_block(block_context, content_model, terminator, parent, reader, attributes, $hash2(["extension"], {"extension": extension})); + if ($truthy(block)) { + } else { + + attributes.$clear(); + return nil; + }; + } else { + self.$raise("" + "Unsupported block type " + (block_context) + " at " + (reader.$cursor())) + }}; + }; + if ($truthy(document.$sourcemap())) { + + $writer = [reader.$cursor_at_mark()]; + $send(block, 'source_location=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if ($truthy(attributes['$key?']("title"))) { + + $writer = [attributes.$delete("title")]; + $send(block, 'title=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + + $writer = [attributes['$[]']("style")]; + $send(block, 'style=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + if ($truthy((block_id = ($truthy($a = block.$id()) ? $a : (($writer = [attributes['$[]']("id")]), $send(block, 'id=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]))))) { + if ($truthy(document.$register("refs", [block_id, block, ($truthy($a = attributes['$[]']("reftext")) ? $a : (function() {if ($truthy(block['$title?']())) { + return block.$title() + } else { + return nil + }; return nil; })())]))) { + } else { + self.$logger().$warn(self.$message_with_context("" + "id assigned to block already in use: " + (block_id), $hash2(["source_location"], {"source_location": reader.$cursor_at_mark()}))) + }}; + if ($truthy(attributes['$empty?']())) { + } else { + block.$attributes().$update(attributes) + }; + block.$lock_in_subs(); + if ($truthy(block['$sub?']("callouts"))) { + if ($truthy(self.$catalog_callouts(block.$source(), document))) { + } else { + block.$remove_sub("callouts") + }}; + return block; + } catch ($returner) { if ($returner === Opal.returner) { return $returner.$v } throw $returner; } + }, TMP_Parser_next_block_10.$$arity = -3); + Opal.defs(self, '$read_paragraph_lines', TMP_Parser_read_paragraph_lines_14 = function $$read_paragraph_lines(reader, break_at_list, opts) { + var self = this, $writer = nil, break_condition = nil; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + + $writer = ["break_on_blank_lines", true]; + $send(opts, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["break_on_list_continuation", true]; + $send(opts, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["preserve_last_line", true]; + $send(opts, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + break_condition = (function() {if ($truthy(break_at_list)) { + + if ($truthy($$($nesting, 'Compliance').$block_terminates_paragraph())) { + return $$($nesting, 'StartOfBlockOrListProc') + } else { + return $$($nesting, 'StartOfListProc') + }; + } else { + + if ($truthy($$($nesting, 'Compliance').$block_terminates_paragraph())) { + return $$($nesting, 'StartOfBlockProc') + } else { + return $$($nesting, 'NoOp') + }; + }; return nil; })(); + return $send(reader, 'read_lines_until', [opts], break_condition.$to_proc()); + }, TMP_Parser_read_paragraph_lines_14.$$arity = -3); + Opal.defs(self, '$is_delimited_block?', TMP_Parser_is_delimited_block$q_15 = function(line, return_match_data) { + var $a, $b, self = this, line_len = nil, tip = nil, tl = nil, fenced_code = nil, tip_3 = nil, context = nil, masq = nil; + + + + if (return_match_data == null) { + return_match_data = false; + }; + if ($truthy(($truthy($a = $rb_gt((line_len = line.$length()), 1)) ? $$($nesting, 'DELIMITED_BLOCK_HEADS')['$include?'](line.$slice(0, 2)) : $a))) { + } else { + return nil + }; + if (line_len['$=='](2)) { + + tip = line; + tl = 2; + } else { + + if ($truthy($rb_le(line_len, 4))) { + + tip = line; + tl = line_len; + } else { + + tip = line.$slice(0, 4); + tl = 4; + }; + fenced_code = false; + if ($truthy($$($nesting, 'Compliance').$markdown_syntax())) { + + tip_3 = (function() {if (tl['$=='](4)) { + return tip.$chop() + } else { + return tip + }; return nil; })(); + if (tip_3['$==']("```")) { + + if ($truthy((($a = tl['$=='](4)) ? tip['$end_with?']("`") : tl['$=='](4)))) { + return nil}; + tip = tip_3; + tl = 3; + fenced_code = true;};}; + if ($truthy((($a = tl['$=='](3)) ? fenced_code['$!']() : tl['$=='](3)))) { + return nil}; + }; + if ($truthy($$($nesting, 'DELIMITED_BLOCKS')['$key?'](tip))) { + if ($truthy(($truthy($a = $rb_lt(tl, 4)) ? $a : tl['$=='](line_len)))) { + if ($truthy(return_match_data)) { + + $b = $$($nesting, 'DELIMITED_BLOCKS')['$[]'](tip), $a = Opal.to_ary($b), (context = ($a[0] == null ? nil : $a[0])), (masq = ($a[1] == null ? nil : $a[1])), $b; + return $$($nesting, 'BlockMatchData').$new(context, masq, tip, tip); + } else { + return true + } + } else if ((("" + (tip)) + ($rb_times(tip.$slice(-1, 1), $rb_minus(line_len, tl))))['$=='](line)) { + if ($truthy(return_match_data)) { + + $b = $$($nesting, 'DELIMITED_BLOCKS')['$[]'](tip), $a = Opal.to_ary($b), (context = ($a[0] == null ? nil : $a[0])), (masq = ($a[1] == null ? nil : $a[1])), $b; + return $$($nesting, 'BlockMatchData').$new(context, masq, tip, line); + } else { + return true + } + } else { + return nil + } + } else { + return nil + }; + }, TMP_Parser_is_delimited_block$q_15.$$arity = -2); + Opal.defs(self, '$build_block', TMP_Parser_build_block_16 = function $$build_block(block_context, content_model, terminator, parent, reader, attributes, options) { + var $a, $b, self = this, skip_processing = nil, parse_as_content_model = nil, lines = nil, block_reader = nil, block_cursor = nil, indent = nil, tab_size = nil, extension = nil, block = nil, $writer = nil; + + + + if (options == null) { + options = $hash2([], {}); + }; + if (content_model['$==']("skip")) { + $a = [true, "simple"], (skip_processing = $a[0]), (parse_as_content_model = $a[1]), $a + } else if (content_model['$==']("raw")) { + $a = [false, "simple"], (skip_processing = $a[0]), (parse_as_content_model = $a[1]), $a + } else { + $a = [false, content_model], (skip_processing = $a[0]), (parse_as_content_model = $a[1]), $a + }; + if ($truthy(terminator['$nil?']())) { + + if (parse_as_content_model['$==']("verbatim")) { + lines = reader.$read_lines_until($hash2(["break_on_blank_lines", "break_on_list_continuation"], {"break_on_blank_lines": true, "break_on_list_continuation": true})) + } else { + + if (content_model['$==']("compound")) { + content_model = "simple"}; + lines = self.$read_paragraph_lines(reader, false, $hash2(["skip_line_comments", "skip_processing"], {"skip_line_comments": true, "skip_processing": skip_processing})); + }; + block_reader = nil; + } else if ($truthy(parse_as_content_model['$!=']("compound"))) { + + lines = reader.$read_lines_until($hash2(["terminator", "skip_processing", "context", "cursor"], {"terminator": terminator, "skip_processing": skip_processing, "context": block_context, "cursor": "at_mark"})); + block_reader = nil; + } else if (terminator['$=='](false)) { + + lines = nil; + block_reader = reader; + } else { + + lines = nil; + block_cursor = reader.$cursor(); + block_reader = $$($nesting, 'Reader').$new(reader.$read_lines_until($hash2(["terminator", "skip_processing", "context", "cursor"], {"terminator": terminator, "skip_processing": skip_processing, "context": block_context, "cursor": "at_mark"})), block_cursor); + }; + if (content_model['$==']("verbatim")) { + if ($truthy((indent = attributes['$[]']("indent")))) { + self['$adjust_indentation!'](lines, indent, ($truthy($a = attributes['$[]']("tabsize")) ? $a : parent.$document().$attributes()['$[]']("tabsize"))) + } else if ($truthy($rb_gt((tab_size = ($truthy($a = attributes['$[]']("tabsize")) ? $a : parent.$document().$attributes()['$[]']("tabsize")).$to_i()), 0))) { + self['$adjust_indentation!'](lines, nil, tab_size)} + } else if (content_model['$==']("skip")) { + return nil}; + if ($truthy((extension = options['$[]']("extension")))) { + + attributes.$delete("style"); + if ($truthy((block = extension.$process_method()['$[]'](parent, ($truthy($a = block_reader) ? $a : $$($nesting, 'Reader').$new(lines)), attributes.$dup())))) { + + attributes.$replace(block.$attributes()); + if ($truthy((($a = block.$content_model()['$==']("compound")) ? (lines = block.$lines())['$nil_or_empty?']()['$!']() : block.$content_model()['$==']("compound")))) { + + content_model = "compound"; + block_reader = $$($nesting, 'Reader').$new(lines);}; + } else { + return nil + }; + } else { + block = $$($nesting, 'Block').$new(parent, block_context, $hash2(["content_model", "source", "attributes"], {"content_model": content_model, "source": lines, "attributes": attributes})) + }; + if ($truthy(($truthy($a = ($truthy($b = attributes['$key?']("title")) ? block.$context()['$!=']("admonition") : $b)) ? parent.$document().$attributes()['$key?']("" + (block.$context()) + "-caption") : $a))) { + + + $writer = [attributes.$delete("title")]; + $send(block, 'title=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + block.$assign_caption(attributes.$delete("caption"));}; + if (content_model['$==']("compound")) { + self.$parse_blocks(block_reader, block)}; + return block; + }, TMP_Parser_build_block_16.$$arity = -7); + Opal.defs(self, '$parse_blocks', TMP_Parser_parse_blocks_17 = function $$parse_blocks(reader, parent) { + var $a, $b, $c, self = this, block = nil; + + while ($truthy(($truthy($b = ($truthy($c = (block = self.$next_block(reader, parent))) ? parent.$blocks()['$<<'](block) : $c)) ? $b : reader['$has_more_lines?']()))) { + + } + }, TMP_Parser_parse_blocks_17.$$arity = 2); + Opal.defs(self, '$parse_list', TMP_Parser_parse_list_18 = function $$parse_list(reader, list_type, parent, style) { + var $a, $b, $c, self = this, list_block = nil, list_rx = nil, list_item = nil; + if ($gvars["~"] == null) $gvars["~"] = nil; + + + list_block = $$($nesting, 'List').$new(parent, list_type); + while ($truthy(($truthy($b = reader['$has_more_lines?']()) ? (list_rx = ($truthy($c = list_rx) ? $c : $$($nesting, 'ListRxMap')['$[]'](list_type)))['$=~'](reader.$peek_line()) : $b))) { + + if ($truthy((list_item = self.$parse_list_item(reader, list_block, $gvars["~"], (($b = $gvars['~']) === nil ? nil : $b['$[]'](1)), style)))) { + list_block.$items()['$<<'](list_item)}; + if ($truthy($b = reader.$skip_blank_lines())) { + $b + } else { + break; + }; + }; + return list_block; + }, TMP_Parser_parse_list_18.$$arity = 4); + Opal.defs(self, '$catalog_callouts', TMP_Parser_catalog_callouts_19 = function $$catalog_callouts(text, document) { + var TMP_20, self = this, found = nil, autonum = nil; + + + found = false; + autonum = 0; + if ($truthy(text['$include?']("<"))) { + $send(text, 'scan', [$$($nesting, 'CalloutScanRx')], (TMP_20 = function(){var self = TMP_20.$$s || this, $a, $b, captured = nil, num = nil; + + + $a = [(($b = $gvars['~']) === nil ? nil : $b['$[]'](0)), (($b = $gvars['~']) === nil ? nil : $b['$[]'](2))], (captured = $a[0]), (num = $a[1]), $a; + if ($truthy(captured['$start_with?']("\\"))) { + } else { + document.$callouts().$register((function() {if (num['$=='](".")) { + return (autonum = $rb_plus(autonum, 1)).$to_s() + } else { + return num + }; return nil; })()) + }; + return (found = true);}, TMP_20.$$s = self, TMP_20.$$arity = 0, TMP_20))}; + return found; + }, TMP_Parser_catalog_callouts_19.$$arity = 2); + Opal.defs(self, '$catalog_inline_anchor', TMP_Parser_catalog_inline_anchor_21 = function $$catalog_inline_anchor(id, reftext, node, location, doc) { + var $a, self = this; + + + + if (doc == null) { + doc = nil; + }; + doc = ($truthy($a = doc) ? $a : node.$document()); + if ($truthy(($truthy($a = reftext) ? reftext['$include?']($$($nesting, 'ATTR_REF_HEAD')) : $a))) { + reftext = doc.$sub_attributes(reftext)}; + if ($truthy(doc.$register("refs", [id, $$($nesting, 'Inline').$new(node, "anchor", reftext, $hash2(["type", "id"], {"type": "ref", "id": id})), reftext]))) { + } else { + + if ($truthy($$($nesting, 'Reader')['$==='](location))) { + location = location.$cursor()}; + self.$logger().$warn(self.$message_with_context("" + "id assigned to anchor already in use: " + (id), $hash2(["source_location"], {"source_location": location}))); + }; + return nil; + }, TMP_Parser_catalog_inline_anchor_21.$$arity = -5); + Opal.defs(self, '$catalog_inline_anchors', TMP_Parser_catalog_inline_anchors_22 = function $$catalog_inline_anchors(text, block, document, reader) { + var $a, TMP_23, self = this; + + + if ($truthy(($truthy($a = text['$include?']("[[")) ? $a : text['$include?']("or:")))) { + $send(text, 'scan', [$$($nesting, 'InlineAnchorScanRx')], (TMP_23 = function(){var self = TMP_23.$$s || this, $b, m = nil, id = nil, reftext = nil, location = nil, offset = nil; + if ($gvars["~"] == null) $gvars["~"] = nil; + + + m = $gvars["~"]; + if ($truthy((id = (($b = $gvars['~']) === nil ? nil : $b['$[]'](1))))) { + if ($truthy((reftext = (($b = $gvars['~']) === nil ? nil : $b['$[]'](2))))) { + if ($truthy(($truthy($b = reftext['$include?']($$($nesting, 'ATTR_REF_HEAD'))) ? (reftext = document.$sub_attributes(reftext))['$empty?']() : $b))) { + return nil;}} + } else { + + id = (($b = $gvars['~']) === nil ? nil : $b['$[]'](3)); + if ($truthy((reftext = (($b = $gvars['~']) === nil ? nil : $b['$[]'](4))))) { + + if ($truthy(reftext['$include?']("]"))) { + reftext = reftext.$gsub("\\]", "]")}; + if ($truthy(($truthy($b = reftext['$include?']($$($nesting, 'ATTR_REF_HEAD'))) ? (reftext = document.$sub_attributes(reftext))['$empty?']() : $b))) { + return nil;};}; + }; + if ($truthy(document.$register("refs", [id, $$($nesting, 'Inline').$new(block, "anchor", reftext, $hash2(["type", "id"], {"type": "ref", "id": id})), reftext]))) { + return nil + } else { + + location = reader.$cursor_at_mark(); + if ($truthy($rb_gt((offset = $rb_plus(m.$pre_match().$count($$($nesting, 'LF')), (function() {if ($truthy(m['$[]'](0)['$start_with?']($$($nesting, 'LF')))) { + return 1 + } else { + return 0 + }; return nil; })())), 0))) { + (location = location.$dup()).$advance(offset)}; + return self.$logger().$warn(self.$message_with_context("" + "id assigned to anchor already in use: " + (id), $hash2(["source_location"], {"source_location": location}))); + };}, TMP_23.$$s = self, TMP_23.$$arity = 0, TMP_23))}; + return nil; + }, TMP_Parser_catalog_inline_anchors_22.$$arity = 4); + Opal.defs(self, '$catalog_inline_biblio_anchor', TMP_Parser_catalog_inline_biblio_anchor_24 = function $$catalog_inline_biblio_anchor(id, reftext, node, reader) { + var $a, self = this, styled_reftext = nil; + + + if ($truthy(node.$document().$register("refs", [id, $$($nesting, 'Inline').$new(node, "anchor", (styled_reftext = "" + "[" + (($truthy($a = reftext) ? $a : id)) + "]"), $hash2(["type", "id"], {"type": "bibref", "id": id})), styled_reftext]))) { + } else { + self.$logger().$warn(self.$message_with_context("" + "id assigned to bibliography anchor already in use: " + (id), $hash2(["source_location"], {"source_location": reader.$cursor()}))) + }; + return nil; + }, TMP_Parser_catalog_inline_biblio_anchor_24.$$arity = 4); + Opal.defs(self, '$parse_description_list', TMP_Parser_parse_description_list_25 = function $$parse_description_list(reader, match, parent) { + var $a, $b, $c, self = this, list_block = nil, previous_pair = nil, sibling_pattern = nil, term = nil, item = nil, $writer = nil; + + + list_block = $$($nesting, 'List').$new(parent, "dlist"); + previous_pair = nil; + sibling_pattern = $$($nesting, 'DescriptionListSiblingRx')['$[]'](match['$[]'](2)); + while ($truthy(($truthy($b = match) ? $b : ($truthy($c = reader['$has_more_lines?']()) ? (match = sibling_pattern.$match(reader.$peek_line())) : $c)))) { + + $c = self.$parse_list_item(reader, list_block, match, sibling_pattern), $b = Opal.to_ary($c), (term = ($b[0] == null ? nil : $b[0])), (item = ($b[1] == null ? nil : $b[1])), $c; + if ($truthy(($truthy($b = previous_pair) ? previous_pair['$[]'](1)['$!']() : $b))) { + + previous_pair['$[]'](0)['$<<'](term); + + $writer = [1, item]; + $send(previous_pair, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + } else { + list_block.$items()['$<<']((previous_pair = [[term], item])) + }; + match = nil; + }; + return list_block; + }, TMP_Parser_parse_description_list_25.$$arity = 3); + Opal.defs(self, '$parse_callout_list', TMP_Parser_parse_callout_list_26 = function $$parse_callout_list(reader, match, parent, callouts) { + var $a, $b, $c, self = this, list_block = nil, next_index = nil, autonum = nil, num = nil, list_item = nil, coids = nil, $writer = nil; + + + list_block = $$($nesting, 'List').$new(parent, "colist"); + next_index = 1; + autonum = 0; + while ($truthy(($truthy($b = match) ? $b : ($truthy($c = (match = $$($nesting, 'CalloutListRx').$match(reader.$peek_line()))) ? reader.$mark() : $c)))) { + + if ((num = match['$[]'](1))['$=='](".")) { + num = (autonum = $rb_plus(autonum, 1)).$to_s()}; + if (num['$=='](next_index.$to_s())) { + } else { + self.$logger().$warn(self.$message_with_context("" + "callout list item index: expected " + (next_index) + ", got " + (num), $hash2(["source_location"], {"source_location": reader.$cursor_at_mark()}))) + }; + if ($truthy((list_item = self.$parse_list_item(reader, list_block, match, "<1>")))) { + + list_block.$items()['$<<'](list_item); + if ($truthy((coids = callouts.$callout_ids(list_block.$items().$size()))['$empty?']())) { + self.$logger().$warn(self.$message_with_context("" + "no callout found for <" + (list_block.$items().$size()) + ">", $hash2(["source_location"], {"source_location": reader.$cursor_at_mark()}))) + } else { + + $writer = ["coids", coids]; + $send(list_item.$attributes(), '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + };}; + next_index = $rb_plus(next_index, 1); + match = nil; + }; + callouts.$next_list(); + return list_block; + }, TMP_Parser_parse_callout_list_26.$$arity = 4); + Opal.defs(self, '$parse_list_item', TMP_Parser_parse_list_item_27 = function $$parse_list_item(reader, list_block, match, sibling_trait, style) { + var $a, $b, self = this, list_type = nil, dlist = nil, list_term = nil, term_text = nil, item_text = nil, has_text = nil, list_item = nil, $writer = nil, sourcemap_assignment_deferred = nil, ordinal = nil, implicit_style = nil, block_cursor = nil, list_item_reader = nil, comment_lines = nil, subsequent_line = nil, continuation_connects_first_block = nil, content_adjacent = nil, block = nil; + + + + if (style == null) { + style = nil; + }; + if ((list_type = list_block.$context())['$==']("dlist")) { + + dlist = true; + list_term = $$($nesting, 'ListItem').$new(list_block, (term_text = match['$[]'](1))); + if ($truthy(($truthy($a = term_text['$start_with?']("[[")) ? $$($nesting, 'LeadingInlineAnchorRx')['$=~'](term_text) : $a))) { + self.$catalog_inline_anchor((($a = $gvars['~']) === nil ? nil : $a['$[]'](1)), ($truthy($a = (($b = $gvars['~']) === nil ? nil : $b['$[]'](2))) ? $a : (($b = $gvars['~']) === nil ? nil : $b.$post_match()).$lstrip()), list_term, reader)}; + if ($truthy((item_text = match['$[]'](3)))) { + has_text = true}; + list_item = $$($nesting, 'ListItem').$new(list_block, item_text); + if ($truthy(list_block.$document().$sourcemap())) { + + + $writer = [reader.$cursor()]; + $send(list_term, 'source_location=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + if ($truthy(has_text)) { + + $writer = [list_term.$source_location()]; + $send(list_item, 'source_location=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + } else { + sourcemap_assignment_deferred = true + };}; + } else { + + has_text = true; + list_item = $$($nesting, 'ListItem').$new(list_block, (item_text = match['$[]'](2))); + if ($truthy(list_block.$document().$sourcemap())) { + + $writer = [reader.$cursor()]; + $send(list_item, 'source_location=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if (list_type['$==']("ulist")) { + + + $writer = [sibling_trait]; + $send(list_item, 'marker=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + if ($truthy(item_text['$start_with?']("["))) { + if ($truthy(($truthy($a = style) ? style['$==']("bibliography") : $a))) { + if ($truthy($$($nesting, 'InlineBiblioAnchorRx')['$=~'](item_text))) { + self.$catalog_inline_biblio_anchor((($a = $gvars['~']) === nil ? nil : $a['$[]'](1)), (($a = $gvars['~']) === nil ? nil : $a['$[]'](2)), list_item, reader)} + } else if ($truthy(item_text['$start_with?']("[["))) { + if ($truthy($$($nesting, 'LeadingInlineAnchorRx')['$=~'](item_text))) { + self.$catalog_inline_anchor((($a = $gvars['~']) === nil ? nil : $a['$[]'](1)), (($a = $gvars['~']) === nil ? nil : $a['$[]'](2)), list_item, reader)} + } else if ($truthy(item_text['$start_with?']("[ ] ", "[x] ", "[*] "))) { + + + $writer = ["checklist-option", ""]; + $send(list_block.$attributes(), '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["checkbox", ""]; + $send(list_item.$attributes(), '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + if ($truthy(item_text['$start_with?']("[ "))) { + } else { + + $writer = ["checked", ""]; + $send(list_item.$attributes(), '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + + $writer = [item_text.$slice(4, item_text.$length())]; + $send(list_item, 'text=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];;}}; + } else if (list_type['$==']("olist")) { + + $b = self.$resolve_ordered_list_marker(sibling_trait, (ordinal = list_block.$items().$size()), true, reader), $a = Opal.to_ary($b), (sibling_trait = ($a[0] == null ? nil : $a[0])), (implicit_style = ($a[1] == null ? nil : $a[1])), $b; + + $writer = [sibling_trait]; + $send(list_item, 'marker=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + if ($truthy((($a = ordinal['$=='](0)) ? style['$!']() : ordinal['$=='](0)))) { + + $writer = [($truthy($a = implicit_style) ? $a : ($truthy($b = $$($nesting, 'ORDERED_LIST_STYLES')['$[]']($rb_minus(sibling_trait.$length(), 1))) ? $b : "arabic").$to_s())]; + $send(list_block, 'style=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if ($truthy(($truthy($a = item_text['$start_with?']("[[")) ? $$($nesting, 'LeadingInlineAnchorRx')['$=~'](item_text) : $a))) { + self.$catalog_inline_anchor((($a = $gvars['~']) === nil ? nil : $a['$[]'](1)), (($a = $gvars['~']) === nil ? nil : $a['$[]'](2)), list_item, reader)}; + } else { + + $writer = [sibling_trait]; + $send(list_item, 'marker=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + }; + reader.$shift(); + block_cursor = reader.$cursor(); + list_item_reader = $$($nesting, 'Reader').$new(self.$read_lines_for_list_item(reader, list_type, sibling_trait, has_text), block_cursor); + if ($truthy(list_item_reader['$has_more_lines?']())) { + + if ($truthy(sourcemap_assignment_deferred)) { + + $writer = [block_cursor]; + $send(list_item, 'source_location=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + comment_lines = list_item_reader.$skip_line_comments(); + if ($truthy((subsequent_line = list_item_reader.$peek_line()))) { + + if ($truthy(comment_lines['$empty?']())) { + } else { + list_item_reader.$unshift_lines(comment_lines) + }; + if ($truthy((continuation_connects_first_block = subsequent_line['$empty?']()))) { + content_adjacent = false + } else { + + content_adjacent = true; + if ($truthy(dlist)) { + } else { + has_text = nil + }; + }; + } else { + + continuation_connects_first_block = false; + content_adjacent = false; + }; + if ($truthy((block = self.$next_block(list_item_reader, list_item, $hash2([], {}), $hash2(["text"], {"text": has_text['$!']()}))))) { + list_item.$blocks()['$<<'](block)}; + while ($truthy(list_item_reader['$has_more_lines?']())) { + if ($truthy((block = self.$next_block(list_item_reader, list_item)))) { + list_item.$blocks()['$<<'](block)} + }; + list_item.$fold_first(continuation_connects_first_block, content_adjacent);}; + if ($truthy(dlist)) { + if ($truthy(($truthy($a = list_item['$text?']()) ? $a : list_item['$blocks?']()))) { + return [list_term, list_item] + } else { + return [list_term] + } + } else { + return list_item + }; + }, TMP_Parser_parse_list_item_27.$$arity = -5); + Opal.defs(self, '$read_lines_for_list_item', TMP_Parser_read_lines_for_list_item_28 = function $$read_lines_for_list_item(reader, list_type, sibling_trait, has_text) { + var $a, $b, $c, TMP_29, TMP_30, TMP_31, TMP_32, TMP_33, self = this, buffer = nil, continuation = nil, within_nested_list = nil, detached_continuation = nil, this_line = nil, prev_line = nil, $writer = nil, match = nil, nested_list_type = nil; + + + + if (sibling_trait == null) { + sibling_trait = nil; + }; + + if (has_text == null) { + has_text = true; + }; + buffer = []; + continuation = "inactive"; + within_nested_list = false; + detached_continuation = nil; + while ($truthy(reader['$has_more_lines?']())) { + + this_line = reader.$read_line(); + if ($truthy(self['$is_sibling_list_item?'](this_line, list_type, sibling_trait))) { + break;}; + prev_line = (function() {if ($truthy(buffer['$empty?']())) { + return nil + } else { + return buffer['$[]'](-1) + }; return nil; })(); + if (prev_line['$==']($$($nesting, 'LIST_CONTINUATION'))) { + + if (continuation['$==']("inactive")) { + + continuation = "active"; + has_text = true; + if ($truthy(within_nested_list)) { + } else { + + $writer = [-1, ""]; + $send(buffer, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + };}; + if (this_line['$==']($$($nesting, 'LIST_CONTINUATION'))) { + + if ($truthy(continuation['$!=']("frozen"))) { + + continuation = "frozen"; + buffer['$<<'](this_line);}; + this_line = nil; + continue;;};}; + if ($truthy((match = self['$is_delimited_block?'](this_line, true)))) { + if (continuation['$==']("active")) { + + buffer['$<<'](this_line); + buffer.$concat(reader.$read_lines_until($hash2(["terminator", "read_last_line", "context"], {"terminator": match.$terminator(), "read_last_line": true, "context": nil}))); + continuation = "inactive"; + } else { + break; + } + } else if ($truthy(($truthy($b = (($c = list_type['$==']("dlist")) ? continuation['$!=']("active") : list_type['$==']("dlist"))) ? $$($nesting, 'BlockAttributeLineRx')['$match?'](this_line) : $b))) { + break; + } else if ($truthy((($b = continuation['$==']("active")) ? this_line['$empty?']()['$!']() : continuation['$==']("active")))) { + if ($truthy($$($nesting, 'LiteralParagraphRx')['$match?'](this_line))) { + + reader.$unshift_line(this_line); + buffer.$concat($send(reader, 'read_lines_until', [$hash2(["preserve_last_line", "break_on_blank_lines", "break_on_list_continuation"], {"preserve_last_line": true, "break_on_blank_lines": true, "break_on_list_continuation": true})], (TMP_29 = function(line){var self = TMP_29.$$s || this, $d; + + + + if (line == null) { + line = nil; + }; + return (($d = list_type['$==']("dlist")) ? self['$is_sibling_list_item?'](line, list_type, sibling_trait) : list_type['$==']("dlist"));}, TMP_29.$$s = self, TMP_29.$$arity = 1, TMP_29))); + continuation = "inactive"; + } else if ($truthy(($truthy($b = ($truthy($c = $$($nesting, 'BlockTitleRx')['$match?'](this_line)) ? $c : $$($nesting, 'BlockAttributeLineRx')['$match?'](this_line))) ? $b : $$($nesting, 'AttributeEntryRx')['$match?'](this_line)))) { + buffer['$<<'](this_line) + } else { + + if ($truthy((nested_list_type = $send((function() {if ($truthy(within_nested_list)) { + return ["dlist"] + } else { + return $$($nesting, 'NESTABLE_LIST_CONTEXTS') + }; return nil; })(), 'find', [], (TMP_30 = function(ctx){var self = TMP_30.$$s || this; + + + + if (ctx == null) { + ctx = nil; + }; + return $$($nesting, 'ListRxMap')['$[]'](ctx)['$match?'](this_line);}, TMP_30.$$s = self, TMP_30.$$arity = 1, TMP_30))))) { + + within_nested_list = true; + if ($truthy((($b = nested_list_type['$==']("dlist")) ? (($c = $gvars['~']) === nil ? nil : $c['$[]'](3))['$nil_or_empty?']() : nested_list_type['$==']("dlist")))) { + has_text = false};}; + buffer['$<<'](this_line); + continuation = "inactive"; + } + } else if ($truthy(($truthy($b = prev_line) ? prev_line['$empty?']() : $b))) { + + if ($truthy(this_line['$empty?']())) { + + if ($truthy((this_line = ($truthy($b = reader.$skip_blank_lines()) ? reader.$read_line() : $b)))) { + } else { + break; + }; + if ($truthy(self['$is_sibling_list_item?'](this_line, list_type, sibling_trait))) { + break;};}; + if (this_line['$==']($$($nesting, 'LIST_CONTINUATION'))) { + + detached_continuation = buffer.$size(); + buffer['$<<'](this_line); + } else if ($truthy(has_text)) { + if ($truthy(self['$is_sibling_list_item?'](this_line, list_type, sibling_trait))) { + break; + } else if ($truthy((nested_list_type = $send($$($nesting, 'NESTABLE_LIST_CONTEXTS'), 'find', [], (TMP_31 = function(ctx){var self = TMP_31.$$s || this; + + + + if (ctx == null) { + ctx = nil; + }; + return $$($nesting, 'ListRxMap')['$[]'](ctx)['$=~'](this_line);}, TMP_31.$$s = self, TMP_31.$$arity = 1, TMP_31))))) { + + buffer['$<<'](this_line); + within_nested_list = true; + if ($truthy((($b = nested_list_type['$==']("dlist")) ? (($c = $gvars['~']) === nil ? nil : $c['$[]'](3))['$nil_or_empty?']() : nested_list_type['$==']("dlist")))) { + has_text = false}; + } else if ($truthy($$($nesting, 'LiteralParagraphRx')['$match?'](this_line))) { + + reader.$unshift_line(this_line); + buffer.$concat($send(reader, 'read_lines_until', [$hash2(["preserve_last_line", "break_on_blank_lines", "break_on_list_continuation"], {"preserve_last_line": true, "break_on_blank_lines": true, "break_on_list_continuation": true})], (TMP_32 = function(line){var self = TMP_32.$$s || this, $d; + + + + if (line == null) { + line = nil; + }; + return (($d = list_type['$==']("dlist")) ? self['$is_sibling_list_item?'](line, list_type, sibling_trait) : list_type['$==']("dlist"));}, TMP_32.$$s = self, TMP_32.$$arity = 1, TMP_32))); + } else { + break; + } + } else { + + if ($truthy(within_nested_list)) { + } else { + buffer.$pop() + }; + buffer['$<<'](this_line); + has_text = true; + }; + } else { + + if ($truthy(this_line['$empty?']()['$!']())) { + has_text = true}; + if ($truthy((nested_list_type = $send((function() {if ($truthy(within_nested_list)) { + return ["dlist"] + } else { + return $$($nesting, 'NESTABLE_LIST_CONTEXTS') + }; return nil; })(), 'find', [], (TMP_33 = function(ctx){var self = TMP_33.$$s || this; + + + + if (ctx == null) { + ctx = nil; + }; + return $$($nesting, 'ListRxMap')['$[]'](ctx)['$=~'](this_line);}, TMP_33.$$s = self, TMP_33.$$arity = 1, TMP_33))))) { + + within_nested_list = true; + if ($truthy((($b = nested_list_type['$==']("dlist")) ? (($c = $gvars['~']) === nil ? nil : $c['$[]'](3))['$nil_or_empty?']() : nested_list_type['$==']("dlist")))) { + has_text = false};}; + buffer['$<<'](this_line); + }; + this_line = nil; + }; + if ($truthy(this_line)) { + reader.$unshift_line(this_line)}; + if ($truthy(detached_continuation)) { + buffer.$delete_at(detached_continuation)}; + while ($truthy(($truthy($b = buffer['$empty?']()['$!']()) ? buffer['$[]'](-1)['$empty?']() : $b))) { + buffer.$pop() + }; + if ($truthy(($truthy($a = buffer['$empty?']()['$!']()) ? buffer['$[]'](-1)['$==']($$($nesting, 'LIST_CONTINUATION')) : $a))) { + buffer.$pop()}; + return buffer; + }, TMP_Parser_read_lines_for_list_item_28.$$arity = -3); + Opal.defs(self, '$initialize_section', TMP_Parser_initialize_section_34 = function $$initialize_section(reader, parent, attributes) { + var $a, $b, self = this, document = nil, book = nil, doctype = nil, source_location = nil, sect_style = nil, sect_id = nil, sect_reftext = nil, sect_title = nil, sect_level = nil, sect_atx = nil, $writer = nil, sect_name = nil, sect_special = nil, sect_numbered = nil, section = nil, id = nil; + + + + if (attributes == null) { + attributes = $hash2([], {}); + }; + document = parent.$document(); + book = (doctype = document.$doctype())['$==']("book"); + if ($truthy(document.$sourcemap())) { + source_location = reader.$cursor()}; + sect_style = attributes['$[]'](1); + $b = self.$parse_section_title(reader, document, attributes['$[]']("id")), $a = Opal.to_ary($b), (sect_id = ($a[0] == null ? nil : $a[0])), (sect_reftext = ($a[1] == null ? nil : $a[1])), (sect_title = ($a[2] == null ? nil : $a[2])), (sect_level = ($a[3] == null ? nil : $a[3])), (sect_atx = ($a[4] == null ? nil : $a[4])), $b; + if ($truthy(sect_reftext)) { + + $writer = ["reftext", sect_reftext]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + } else { + sect_reftext = attributes['$[]']("reftext") + }; + if ($truthy(sect_style)) { + if ($truthy(($truthy($a = book) ? sect_style['$==']("abstract") : $a))) { + $a = ["chapter", 1], (sect_name = $a[0]), (sect_level = $a[1]), $a + } else { + + $a = [sect_style, true], (sect_name = $a[0]), (sect_special = $a[1]), $a; + if (sect_level['$=='](0)) { + sect_level = 1}; + sect_numbered = sect_style['$==']("appendix"); + } + } else if ($truthy(book)) { + sect_name = (function() {if (sect_level['$=='](0)) { + return "part" + } else { + + if ($truthy($rb_gt(sect_level, 1))) { + return "section" + } else { + return "chapter" + }; + }; return nil; })() + } else if ($truthy((($a = doctype['$==']("manpage")) ? sect_title.$casecmp("synopsis")['$=='](0) : doctype['$==']("manpage")))) { + $a = ["synopsis", true], (sect_name = $a[0]), (sect_special = $a[1]), $a + } else { + sect_name = "section" + }; + section = $$($nesting, 'Section').$new(parent, sect_level); + $a = [sect_id, sect_title, sect_name, source_location], section['$id=']($a[0]), section['$title=']($a[1]), section['$sectname=']($a[2]), section['$source_location=']($a[3]), $a; + if ($truthy(sect_special)) { + + + $writer = [true]; + $send(section, 'special=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + if ($truthy(sect_numbered)) { + + $writer = [true]; + $send(section, 'numbered=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + } else if (document.$attributes()['$[]']("sectnums")['$==']("all")) { + + $writer = [(function() {if ($truthy(($truthy($a = book) ? sect_level['$=='](1) : $a))) { + return "chapter" + } else { + return true + }; return nil; })()]; + $send(section, 'numbered=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + } else if ($truthy(($truthy($a = document.$attributes()['$[]']("sectnums")) ? $rb_gt(sect_level, 0) : $a))) { + + $writer = [(function() {if ($truthy(section.$special())) { + return ($truthy($a = parent.$numbered()) ? true : $a) + } else { + return true + }; return nil; })()]; + $send(section, 'numbered=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + } else if ($truthy(($truthy($a = ($truthy($b = book) ? sect_level['$=='](0) : $b)) ? document.$attributes()['$[]']("partnums") : $a))) { + + $writer = [true]; + $send(section, 'numbered=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if ($truthy((id = ($truthy($a = section.$id()) ? $a : (($writer = [(function() {if ($truthy(document.$attributes()['$key?']("sectids"))) { + + return $$($nesting, 'Section').$generate_id(section.$title(), document); + } else { + return nil + }; return nil; })()]), $send(section, 'id=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]))))) { + if ($truthy(document.$register("refs", [id, section, ($truthy($a = sect_reftext) ? $a : section.$title())]))) { + } else { + self.$logger().$warn(self.$message_with_context("" + "id assigned to section already in use: " + (id), $hash2(["source_location"], {"source_location": reader.$cursor_at_line($rb_minus(reader.$lineno(), (function() {if ($truthy(sect_atx)) { + return 1 + } else { + return 2 + }; return nil; })()))}))) + }}; + section.$update_attributes(attributes); + reader.$skip_blank_lines(); + return section; + }, TMP_Parser_initialize_section_34.$$arity = -3); + Opal.defs(self, '$is_next_line_section?', TMP_Parser_is_next_line_section$q_35 = function(reader, attributes) { + var $a, $b, self = this, style = nil, next_lines = nil; + + if ($truthy(($truthy($a = (style = attributes['$[]'](1))) ? ($truthy($b = style['$==']("discrete")) ? $b : style['$==']("float")) : $a))) { + return nil + } else if ($truthy($$($nesting, 'Compliance').$underline_style_section_titles())) { + + next_lines = reader.$peek_lines(2, ($truthy($a = style) ? style['$==']("comment") : $a)); + return self['$is_section_title?'](($truthy($a = next_lines['$[]'](0)) ? $a : ""), next_lines['$[]'](1)); + } else { + return self['$atx_section_title?'](($truthy($a = reader.$peek_line()) ? $a : "")) + } + }, TMP_Parser_is_next_line_section$q_35.$$arity = 2); + Opal.defs(self, '$is_next_line_doctitle?', TMP_Parser_is_next_line_doctitle$q_36 = function(reader, attributes, leveloffset) { + var $a, self = this, sect_level = nil; + + if ($truthy(leveloffset)) { + return ($truthy($a = (sect_level = self['$is_next_line_section?'](reader, attributes))) ? $rb_plus(sect_level, leveloffset.$to_i())['$=='](0) : $a) + } else { + return self['$is_next_line_section?'](reader, attributes)['$=='](0) + } + }, TMP_Parser_is_next_line_doctitle$q_36.$$arity = 3); + Opal.defs(self, '$is_section_title?', TMP_Parser_is_section_title$q_37 = function(line1, line2) { + var $a, self = this; + + + + if (line2 == null) { + line2 = nil; + }; + return ($truthy($a = self['$atx_section_title?'](line1)) ? $a : (function() {if ($truthy(line2['$nil_or_empty?']())) { + return nil + } else { + return self['$setext_section_title?'](line1, line2) + }; return nil; })()); + }, TMP_Parser_is_section_title$q_37.$$arity = -2); + Opal.defs(self, '$atx_section_title?', TMP_Parser_atx_section_title$q_38 = function(line) { + var $a, self = this; + + if ($truthy((function() {if ($truthy($$($nesting, 'Compliance').$markdown_syntax())) { + + return ($truthy($a = line['$start_with?']("=", "#")) ? $$($nesting, 'ExtAtxSectionTitleRx')['$=~'](line) : $a); + } else { + + return ($truthy($a = line['$start_with?']("=")) ? $$($nesting, 'AtxSectionTitleRx')['$=~'](line) : $a); + }; return nil; })())) { + return $rb_minus((($a = $gvars['~']) === nil ? nil : $a['$[]'](1)).$length(), 1) + } else { + return nil + } + }, TMP_Parser_atx_section_title$q_38.$$arity = 1); + Opal.defs(self, '$setext_section_title?', TMP_Parser_setext_section_title$q_39 = function(line1, line2) { + var $a, $b, $c, self = this, level = nil, line2_ch1 = nil, line2_len = nil; + + if ($truthy(($truthy($a = ($truthy($b = ($truthy($c = (level = $$($nesting, 'SETEXT_SECTION_LEVELS')['$[]']((line2_ch1 = line2.$chr())))) ? $rb_times(line2_ch1, (line2_len = line2.$length()))['$=='](line2) : $c)) ? $$($nesting, 'SetextSectionTitleRx')['$match?'](line1) : $b)) ? $rb_lt($rb_minus(self.$line_length(line1), line2_len).$abs(), 2) : $a))) { + return level + } else { + return nil + } + }, TMP_Parser_setext_section_title$q_39.$$arity = 2); + Opal.defs(self, '$parse_section_title', TMP_Parser_parse_section_title_40 = function $$parse_section_title(reader, document, sect_id) { + var $a, $b, $c, $d, $e, self = this, sect_reftext = nil, line1 = nil, sect_level = nil, sect_title = nil, atx = nil, line2 = nil, line2_ch1 = nil, line2_len = nil; + + + + if (sect_id == null) { + sect_id = nil; + }; + sect_reftext = nil; + line1 = reader.$read_line(); + if ($truthy((function() {if ($truthy($$($nesting, 'Compliance').$markdown_syntax())) { + + return ($truthy($a = line1['$start_with?']("=", "#")) ? $$($nesting, 'ExtAtxSectionTitleRx')['$=~'](line1) : $a); + } else { + + return ($truthy($a = line1['$start_with?']("=")) ? $$($nesting, 'AtxSectionTitleRx')['$=~'](line1) : $a); + }; return nil; })())) { + + $a = [$rb_minus((($b = $gvars['~']) === nil ? nil : $b['$[]'](1)).$length(), 1), (($b = $gvars['~']) === nil ? nil : $b['$[]'](2)), true], (sect_level = $a[0]), (sect_title = $a[1]), (atx = $a[2]), $a; + if ($truthy(sect_id)) { + } else if ($truthy(($truthy($a = ($truthy($b = sect_title['$end_with?']("]]")) ? $$($nesting, 'InlineSectionAnchorRx')['$=~'](sect_title) : $b)) ? (($b = $gvars['~']) === nil ? nil : $b['$[]'](1))['$!']() : $a))) { + $a = [sect_title.$slice(0, $rb_minus(sect_title.$length(), (($b = $gvars['~']) === nil ? nil : $b['$[]'](0)).$length())), (($b = $gvars['~']) === nil ? nil : $b['$[]'](2)), (($b = $gvars['~']) === nil ? nil : $b['$[]'](3))], (sect_title = $a[0]), (sect_id = $a[1]), (sect_reftext = $a[2]), $a}; + } else if ($truthy(($truthy($a = ($truthy($b = ($truthy($c = ($truthy($d = ($truthy($e = $$($nesting, 'Compliance').$underline_style_section_titles()) ? (line2 = reader.$peek_line(true)) : $e)) ? (sect_level = $$($nesting, 'SETEXT_SECTION_LEVELS')['$[]']((line2_ch1 = line2.$chr()))) : $d)) ? $rb_times(line2_ch1, (line2_len = line2.$length()))['$=='](line2) : $c)) ? (sect_title = ($truthy($c = $$($nesting, 'SetextSectionTitleRx')['$=~'](line1)) ? (($d = $gvars['~']) === nil ? nil : $d['$[]'](1)) : $c)) : $b)) ? $rb_lt($rb_minus(self.$line_length(line1), line2_len).$abs(), 2) : $a))) { + + atx = false; + if ($truthy(sect_id)) { + } else if ($truthy(($truthy($a = ($truthy($b = sect_title['$end_with?']("]]")) ? $$($nesting, 'InlineSectionAnchorRx')['$=~'](sect_title) : $b)) ? (($b = $gvars['~']) === nil ? nil : $b['$[]'](1))['$!']() : $a))) { + $a = [sect_title.$slice(0, $rb_minus(sect_title.$length(), (($b = $gvars['~']) === nil ? nil : $b['$[]'](0)).$length())), (($b = $gvars['~']) === nil ? nil : $b['$[]'](2)), (($b = $gvars['~']) === nil ? nil : $b['$[]'](3))], (sect_title = $a[0]), (sect_id = $a[1]), (sect_reftext = $a[2]), $a}; + reader.$shift(); + } else { + self.$raise("" + "Unrecognized section at " + (reader.$cursor_at_prev_line())) + }; + if ($truthy(document['$attr?']("leveloffset"))) { + sect_level = $rb_plus(sect_level, document.$attr("leveloffset").$to_i())}; + return [sect_id, sect_reftext, sect_title, sect_level, atx]; + }, TMP_Parser_parse_section_title_40.$$arity = -3); + if ($truthy($$($nesting, 'FORCE_UNICODE_LINE_LENGTH'))) { + Opal.defs(self, '$line_length', TMP_Parser_line_length_41 = function $$line_length(line) { + var self = this; + + return line.$scan($$($nesting, 'UnicodeCharScanRx')).$size() + }, TMP_Parser_line_length_41.$$arity = 1) + } else { + Opal.defs(self, '$line_length', TMP_Parser_line_length_42 = function $$line_length(line) { + var self = this; + + return line.$length() + }, TMP_Parser_line_length_42.$$arity = 1) + }; + Opal.defs(self, '$parse_header_metadata', TMP_Parser_parse_header_metadata_43 = function $$parse_header_metadata(reader, document) { + var $a, TMP_44, TMP_45, TMP_46, self = this, doc_attrs = nil, implicit_authors = nil, metadata = nil, implicit_author = nil, implicit_authorinitials = nil, author_metadata = nil, rev_metadata = nil, rev_line = nil, match = nil, $writer = nil, component = nil, author_line = nil, authors = nil, author_idx = nil, author_key = nil, explicit = nil, sparse = nil, author_override = nil; + + + + if (document == null) { + document = nil; + }; + doc_attrs = ($truthy($a = document) ? document.$attributes() : $a); + self.$process_attribute_entries(reader, document); + $a = [(implicit_authors = $hash2([], {})), nil, nil], (metadata = $a[0]), (implicit_author = $a[1]), (implicit_authorinitials = $a[2]), $a; + if ($truthy(($truthy($a = reader['$has_more_lines?']()) ? reader['$next_line_empty?']()['$!']() : $a))) { + + if ($truthy((author_metadata = self.$process_authors(reader.$read_line()))['$empty?']())) { + } else { + + if ($truthy(document)) { + + $send(author_metadata, 'each', [], (TMP_44 = function(key, val){var self = TMP_44.$$s || this, $writer = nil; + + + + if (key == null) { + key = nil; + }; + + if (val == null) { + val = nil; + }; + if ($truthy(doc_attrs['$key?'](key))) { + return nil + } else { + + $writer = [key, (function() {if ($truthy($$$('::', 'String')['$==='](val))) { + + return document.$apply_header_subs(val); + } else { + return val + }; return nil; })()]; + $send(doc_attrs, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + };}, TMP_44.$$s = self, TMP_44.$$arity = 2, TMP_44)); + implicit_author = doc_attrs['$[]']("author"); + implicit_authorinitials = doc_attrs['$[]']("authorinitials"); + implicit_authors = doc_attrs['$[]']("authors");}; + metadata = author_metadata; + }; + self.$process_attribute_entries(reader, document); + rev_metadata = $hash2([], {}); + if ($truthy(($truthy($a = reader['$has_more_lines?']()) ? reader['$next_line_empty?']()['$!']() : $a))) { + + rev_line = reader.$read_line(); + if ($truthy((match = $$($nesting, 'RevisionInfoLineRx').$match(rev_line)))) { + + if ($truthy(match['$[]'](1))) { + + $writer = ["revnumber", match['$[]'](1).$rstrip()]; + $send(rev_metadata, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if ($truthy((component = match['$[]'](2).$strip())['$empty?']())) { + } else if ($truthy(($truthy($a = match['$[]'](1)['$!']()) ? component['$start_with?']("v") : $a))) { + + $writer = ["revnumber", component.$slice(1, component.$length())]; + $send(rev_metadata, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + } else { + + $writer = ["revdate", component]; + $send(rev_metadata, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + if ($truthy(match['$[]'](3))) { + + $writer = ["revremark", match['$[]'](3).$rstrip()]; + $send(rev_metadata, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + } else { + reader.$unshift_line(rev_line) + };}; + if ($truthy(rev_metadata['$empty?']())) { + } else { + + if ($truthy(document)) { + $send(rev_metadata, 'each', [], (TMP_45 = function(key, val){var self = TMP_45.$$s || this; + + + + if (key == null) { + key = nil; + }; + + if (val == null) { + val = nil; + }; + if ($truthy(doc_attrs['$key?'](key))) { + return nil + } else { + + $writer = [key, document.$apply_header_subs(val)]; + $send(doc_attrs, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + };}, TMP_45.$$s = self, TMP_45.$$arity = 2, TMP_45))}; + metadata.$update(rev_metadata); + }; + self.$process_attribute_entries(reader, document); + reader.$skip_blank_lines(); + } else { + author_metadata = $hash2([], {}) + }; + if ($truthy(document)) { + + if ($truthy(($truthy($a = doc_attrs['$key?']("author")) ? (author_line = doc_attrs['$[]']("author"))['$!='](implicit_author) : $a))) { + + author_metadata = self.$process_authors(author_line, true, false); + if ($truthy(doc_attrs['$[]']("authorinitials")['$!='](implicit_authorinitials))) { + author_metadata.$delete("authorinitials")}; + } else if ($truthy(($truthy($a = doc_attrs['$key?']("authors")) ? (author_line = doc_attrs['$[]']("authors"))['$!='](implicit_authors) : $a))) { + author_metadata = self.$process_authors(author_line, true) + } else { + + $a = [[], 1, "author_1", false, false], (authors = $a[0]), (author_idx = $a[1]), (author_key = $a[2]), (explicit = $a[3]), (sparse = $a[4]), $a; + while ($truthy(doc_attrs['$key?'](author_key))) { + + if ((author_override = doc_attrs['$[]'](author_key))['$=='](author_metadata['$[]'](author_key))) { + + authors['$<<'](nil); + sparse = true; + } else { + + authors['$<<'](author_override); + explicit = true; + }; + author_key = "" + "author_" + ((author_idx = $rb_plus(author_idx, 1))); + }; + if ($truthy(explicit)) { + + if ($truthy(sparse)) { + $send(authors, 'each_with_index', [], (TMP_46 = function(author, idx){var self = TMP_46.$$s || this, TMP_47, name_idx = nil; + + + + if (author == null) { + author = nil; + }; + + if (idx == null) { + idx = nil; + }; + if ($truthy(author)) { + return nil + } else { + + $writer = [idx, $send([author_metadata['$[]']("" + "firstname_" + ((name_idx = $rb_plus(idx, 1)))), author_metadata['$[]']("" + "middlename_" + (name_idx)), author_metadata['$[]']("" + "lastname_" + (name_idx))].$compact(), 'map', [], (TMP_47 = function(it){var self = TMP_47.$$s || this; + + + + if (it == null) { + it = nil; + }; + return it.$tr(" ", "_");}, TMP_47.$$s = self, TMP_47.$$arity = 1, TMP_47)).$join(" ")]; + $send(authors, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + };}, TMP_46.$$s = self, TMP_46.$$arity = 2, TMP_46))}; + author_metadata = self.$process_authors(authors, true, false); + } else { + author_metadata = $hash2([], {}) + }; + }; + if ($truthy(author_metadata['$empty?']())) { + ($truthy($a = metadata['$[]']("authorcount")) ? $a : (($writer = ["authorcount", (($writer = ["authorcount", 0]), $send(doc_attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])]), $send(metadata, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])) + } else { + + doc_attrs.$update(author_metadata); + if ($truthy(($truthy($a = doc_attrs['$key?']("email")['$!']()) ? doc_attrs['$key?']("email_1") : $a))) { + + $writer = ["email", doc_attrs['$[]']("email_1")]; + $send(doc_attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + };}; + return metadata; + }, TMP_Parser_parse_header_metadata_43.$$arity = -2); + Opal.defs(self, '$process_authors', TMP_Parser_process_authors_48 = function $$process_authors(author_line, names_only, multiple) { + var TMP_49, TMP_50, self = this, author_metadata = nil, author_idx = nil, keys = nil, author_entries = nil, $writer = nil; + + + + if (names_only == null) { + names_only = false; + }; + + if (multiple == null) { + multiple = true; + }; + author_metadata = $hash2([], {}); + author_idx = 0; + keys = ["author", "authorinitials", "firstname", "middlename", "lastname", "email"]; + author_entries = (function() {if ($truthy(multiple)) { + return $send(author_line.$split(";"), 'map', [], (TMP_49 = function(it){var self = TMP_49.$$s || this; + + + + if (it == null) { + it = nil; + }; + return it.$strip();}, TMP_49.$$s = self, TMP_49.$$arity = 1, TMP_49)) + } else { + return self.$Array(author_line) + }; return nil; })(); + $send(author_entries, 'each', [], (TMP_50 = function(author_entry){var self = TMP_50.$$s || this, TMP_51, TMP_52, $a, TMP_53, key_map = nil, $writer = nil, segments = nil, match = nil, author = nil, fname = nil, mname = nil, lname = nil; + + + + if (author_entry == null) { + author_entry = nil; + }; + if ($truthy(author_entry['$empty?']())) { + return nil;}; + author_idx = $rb_plus(author_idx, 1); + key_map = $hash2([], {}); + if (author_idx['$=='](1)) { + $send(keys, 'each', [], (TMP_51 = function(key){var self = TMP_51.$$s || this, $writer = nil; + + + + if (key == null) { + key = nil; + }; + $writer = [key.$to_sym(), key]; + $send(key_map, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];}, TMP_51.$$s = self, TMP_51.$$arity = 1, TMP_51)) + } else { + $send(keys, 'each', [], (TMP_52 = function(key){var self = TMP_52.$$s || this, $writer = nil; + + + + if (key == null) { + key = nil; + }; + $writer = [key.$to_sym(), "" + (key) + "_" + (author_idx)]; + $send(key_map, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];}, TMP_52.$$s = self, TMP_52.$$arity = 1, TMP_52)) + }; + if ($truthy(names_only)) { + + if ($truthy(author_entry['$include?']("<"))) { + + + $writer = [key_map['$[]']("author"), author_entry.$tr("_", " ")]; + $send(author_metadata, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + author_entry = author_entry.$gsub($$($nesting, 'XmlSanitizeRx'), "");}; + if ((segments = author_entry.$split(nil, 3)).$size()['$=='](3)) { + segments['$<<'](segments.$pop().$squeeze(" "))}; + } else if ($truthy((match = $$($nesting, 'AuthorInfoLineRx').$match(author_entry)))) { + (segments = match.$to_a()).$shift()}; + if ($truthy(segments)) { + + author = (($writer = [key_map['$[]']("firstname"), (fname = segments['$[]'](0).$tr("_", " "))]), $send(author_metadata, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]); + + $writer = [key_map['$[]']("authorinitials"), fname.$chr()]; + $send(author_metadata, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + if ($truthy(segments['$[]'](1))) { + if ($truthy(segments['$[]'](2))) { + + + $writer = [key_map['$[]']("middlename"), (mname = segments['$[]'](1).$tr("_", " "))]; + $send(author_metadata, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = [key_map['$[]']("lastname"), (lname = segments['$[]'](2).$tr("_", " "))]; + $send(author_metadata, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + author = $rb_plus($rb_plus($rb_plus($rb_plus(fname, " "), mname), " "), lname); + + $writer = [key_map['$[]']("authorinitials"), "" + (fname.$chr()) + (mname.$chr()) + (lname.$chr())]; + $send(author_metadata, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + } else { + + + $writer = [key_map['$[]']("lastname"), (lname = segments['$[]'](1).$tr("_", " "))]; + $send(author_metadata, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + author = $rb_plus($rb_plus(fname, " "), lname); + + $writer = [key_map['$[]']("authorinitials"), "" + (fname.$chr()) + (lname.$chr())]; + $send(author_metadata, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + }}; + ($truthy($a = author_metadata['$[]'](key_map['$[]']("author"))) ? $a : (($writer = [key_map['$[]']("author"), author]), $send(author_metadata, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + if ($truthy(($truthy($a = names_only) ? $a : segments['$[]'](3)['$!']()))) { + } else { + + $writer = [key_map['$[]']("email"), segments['$[]'](3)]; + $send(author_metadata, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + } else { + + + $writer = [key_map['$[]']("author"), (($writer = [key_map['$[]']("firstname"), (fname = author_entry.$squeeze(" ").$strip())]), $send(author_metadata, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])]; + $send(author_metadata, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = [key_map['$[]']("authorinitials"), fname.$chr()]; + $send(author_metadata, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + }; + if (author_idx['$=='](1)) { + + $writer = ["authors", author_metadata['$[]'](key_map['$[]']("author"))]; + $send(author_metadata, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + } else { + + if (author_idx['$=='](2)) { + $send(keys, 'each', [], (TMP_53 = function(key){var self = TMP_53.$$s || this; + + + + if (key == null) { + key = nil; + }; + if ($truthy(author_metadata['$key?'](key))) { + + $writer = ["" + (key) + "_1", author_metadata['$[]'](key)]; + $send(author_metadata, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + } else { + return nil + };}, TMP_53.$$s = self, TMP_53.$$arity = 1, TMP_53))}; + + $writer = ["authors", "" + (author_metadata['$[]']("authors")) + ", " + (author_metadata['$[]'](key_map['$[]']("author")))]; + $send(author_metadata, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];; + };}, TMP_50.$$s = self, TMP_50.$$arity = 1, TMP_50)); + + $writer = ["authorcount", author_idx]; + $send(author_metadata, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + return author_metadata; + }, TMP_Parser_process_authors_48.$$arity = -2); + Opal.defs(self, '$parse_block_metadata_lines', TMP_Parser_parse_block_metadata_lines_54 = function $$parse_block_metadata_lines(reader, document, attributes, options) { + var $a, $b, self = this; + + + + if (attributes == null) { + attributes = $hash2([], {}); + }; + + if (options == null) { + options = $hash2([], {}); + }; + while ($truthy(self.$parse_block_metadata_line(reader, document, attributes, options))) { + + reader.$shift(); + if ($truthy($b = reader.$skip_blank_lines())) { + $b + } else { + break; + }; + }; + return attributes; + }, TMP_Parser_parse_block_metadata_lines_54.$$arity = -3); + Opal.defs(self, '$parse_block_metadata_line', TMP_Parser_parse_block_metadata_line_55 = function $$parse_block_metadata_line(reader, document, attributes, options) { + var $a, $b, self = this, next_line = nil, normal = nil, $writer = nil, reftext = nil, current_style = nil, ll = nil; + if ($gvars["~"] == null) $gvars["~"] = nil; + + + + if (options == null) { + options = $hash2([], {}); + }; + if ($truthy(($truthy($a = (next_line = reader.$peek_line())) ? (function() {if ($truthy(options['$[]']("text"))) { + + return next_line['$start_with?']("[", "/"); + } else { + + return (normal = next_line['$start_with?']("[", ".", "/", ":")); + }; return nil; })() : $a))) { + if ($truthy(next_line['$start_with?']("["))) { + if ($truthy(next_line['$start_with?']("[["))) { + if ($truthy(($truthy($a = next_line['$end_with?']("]]")) ? $$($nesting, 'BlockAnchorRx')['$=~'](next_line) : $a))) { + + + $writer = ["id", (($a = $gvars['~']) === nil ? nil : $a['$[]'](1))]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + if ($truthy((reftext = (($a = $gvars['~']) === nil ? nil : $a['$[]'](2))))) { + + $writer = ["reftext", (function() {if ($truthy(reftext['$include?']($$($nesting, 'ATTR_REF_HEAD')))) { + + return document.$sub_attributes(reftext); + } else { + return reftext + }; return nil; })()]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + return true; + } else { + return nil + } + } else if ($truthy(($truthy($a = next_line['$end_with?']("]")) ? $$($nesting, 'BlockAttributeListRx')['$=~'](next_line) : $a))) { + + current_style = attributes['$[]'](1); + if ($truthy(document.$parse_attributes((($a = $gvars['~']) === nil ? nil : $a['$[]'](1)), [], $hash2(["sub_input", "sub_result", "into"], {"sub_input": true, "sub_result": true, "into": attributes}))['$[]'](1))) { + + $writer = [1, ($truthy($a = self.$parse_style_attribute(attributes, reader)) ? $a : current_style)]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + return true; + } else { + return nil + } + } else if ($truthy(($truthy($a = normal) ? next_line['$start_with?'](".") : $a))) { + if ($truthy($$($nesting, 'BlockTitleRx')['$=~'](next_line))) { + + + $writer = ["title", (($a = $gvars['~']) === nil ? nil : $a['$[]'](1))]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + return true; + } else { + return nil + } + } else if ($truthy(($truthy($a = normal['$!']()) ? $a : next_line['$start_with?']("/")))) { + if ($truthy(next_line['$start_with?']("//"))) { + if (next_line['$==']("//")) { + return true + } else if ($truthy(($truthy($a = normal) ? $rb_times("/", (ll = next_line.$length()))['$=='](next_line) : $a))) { + if (ll['$=='](3)) { + return nil + } else { + + reader.$read_lines_until($hash2(["terminator", "skip_first_line", "preserve_last_line", "skip_processing", "context"], {"terminator": next_line, "skip_first_line": true, "preserve_last_line": true, "skip_processing": true, "context": "comment"})); + return true; + } + } else if ($truthy(next_line['$start_with?']("///"))) { + return nil + } else { + return true + } + } else { + return nil + } + } else if ($truthy(($truthy($a = ($truthy($b = normal) ? next_line['$start_with?'](":") : $b)) ? $$($nesting, 'AttributeEntryRx')['$=~'](next_line) : $a))) { + + self.$process_attribute_entry(reader, document, attributes, $gvars["~"]); + return true; + } else { + return nil + } + } else { + return nil + }; + }, TMP_Parser_parse_block_metadata_line_55.$$arity = -4); + Opal.defs(self, '$process_attribute_entries', TMP_Parser_process_attribute_entries_56 = function $$process_attribute_entries(reader, document, attributes) { + var $a, self = this; + + + + if (attributes == null) { + attributes = nil; + }; + reader.$skip_comment_lines(); + while ($truthy(self.$process_attribute_entry(reader, document, attributes))) { + + reader.$shift(); + reader.$skip_comment_lines(); + }; + }, TMP_Parser_process_attribute_entries_56.$$arity = -3); + Opal.defs(self, '$process_attribute_entry', TMP_Parser_process_attribute_entry_57 = function $$process_attribute_entry(reader, document, attributes, match) { + var $a, $b, $c, self = this, value = nil, con = nil, next_line = nil, keep_open = nil; + + + + if (attributes == null) { + attributes = nil; + }; + + if (match == null) { + match = nil; + }; + if ($truthy((match = ($truthy($a = match) ? $a : (function() {if ($truthy(reader['$has_more_lines?']())) { + + return $$($nesting, 'AttributeEntryRx').$match(reader.$peek_line()); + } else { + return nil + }; return nil; })())))) { + + if ($truthy((value = match['$[]'](2))['$nil_or_empty?']())) { + value = "" + } else if ($truthy(value['$end_with?']($$($nesting, 'LINE_CONTINUATION'), $$($nesting, 'LINE_CONTINUATION_LEGACY')))) { + + $a = [value.$slice(-2, 2), value.$slice(0, $rb_minus(value.$length(), 2)).$rstrip()], (con = $a[0]), (value = $a[1]), $a; + while ($truthy(($truthy($b = reader.$advance()) ? (next_line = ($truthy($c = reader.$peek_line()) ? $c : ""))['$empty?']()['$!']() : $b))) { + + next_line = next_line.$lstrip(); + if ($truthy((keep_open = next_line['$end_with?'](con)))) { + next_line = next_line.$slice(0, $rb_minus(next_line.$length(), 2)).$rstrip()}; + value = "" + (value) + ((function() {if ($truthy(value['$end_with?']($$($nesting, 'HARD_LINE_BREAK')))) { + return $$($nesting, 'LF') + } else { + return " " + }; return nil; })()) + (next_line); + if ($truthy(keep_open)) { + } else { + break; + }; + };}; + self.$store_attribute(match['$[]'](1), value, document, attributes); + return true; + } else { + return nil + }; + }, TMP_Parser_process_attribute_entry_57.$$arity = -3); + Opal.defs(self, '$store_attribute', TMP_Parser_store_attribute_58 = function $$store_attribute(name, value, doc, attrs) { + var $a, self = this, resolved_value = nil; + + + + if (doc == null) { + doc = nil; + }; + + if (attrs == null) { + attrs = nil; + }; + if ($truthy(name['$end_with?']("!"))) { + $a = [name.$chop(), nil], (name = $a[0]), (value = $a[1]), $a + } else if ($truthy(name['$start_with?']("!"))) { + $a = [name.$slice(1, name.$length()), nil], (name = $a[0]), (value = $a[1]), $a}; + name = self.$sanitize_attribute_name(name); + if (name['$==']("numbered")) { + name = "sectnums"}; + if ($truthy(doc)) { + if ($truthy(value)) { + + if (name['$==']("leveloffset")) { + if ($truthy(value['$start_with?']("+"))) { + value = $rb_plus(doc.$attr("leveloffset", 0).$to_i(), value.$slice(1, value.$length()).$to_i()).$to_s() + } else if ($truthy(value['$start_with?']("-"))) { + value = $rb_minus(doc.$attr("leveloffset", 0).$to_i(), value.$slice(1, value.$length()).$to_i()).$to_s()}}; + if ($truthy((resolved_value = doc.$set_attribute(name, value)))) { + + value = resolved_value; + if ($truthy(attrs)) { + $$$($$($nesting, 'Document'), 'AttributeEntry').$new(name, value).$save_to(attrs)};}; + } else if ($truthy(($truthy($a = doc.$delete_attribute(name)) ? attrs : $a))) { + $$$($$($nesting, 'Document'), 'AttributeEntry').$new(name, value).$save_to(attrs)} + } else if ($truthy(attrs)) { + $$$($$($nesting, 'Document'), 'AttributeEntry').$new(name, value).$save_to(attrs)}; + return [name, value]; + }, TMP_Parser_store_attribute_58.$$arity = -3); + Opal.defs(self, '$resolve_list_marker', TMP_Parser_resolve_list_marker_59 = function $$resolve_list_marker(list_type, marker, ordinal, validate, reader) { + var self = this; + + + + if (ordinal == null) { + ordinal = 0; + }; + + if (validate == null) { + validate = false; + }; + + if (reader == null) { + reader = nil; + }; + if (list_type['$==']("ulist")) { + return marker + } else if (list_type['$==']("olist")) { + return self.$resolve_ordered_list_marker(marker, ordinal, validate, reader)['$[]'](0) + } else { + return "<1>" + }; + }, TMP_Parser_resolve_list_marker_59.$$arity = -3); + Opal.defs(self, '$resolve_ordered_list_marker', TMP_Parser_resolve_ordered_list_marker_60 = function $$resolve_ordered_list_marker(marker, ordinal, validate, reader) { + var TMP_61, $a, self = this, $case = nil, style = nil, expected = nil, actual = nil; + + + + if (ordinal == null) { + ordinal = 0; + }; + + if (validate == null) { + validate = false; + }; + + if (reader == null) { + reader = nil; + }; + if ($truthy(marker['$start_with?']("."))) { + return [marker]}; + $case = (style = $send($$($nesting, 'ORDERED_LIST_STYLES'), 'find', [], (TMP_61 = function(s){var self = TMP_61.$$s || this; + + + + if (s == null) { + s = nil; + }; + return $$($nesting, 'OrderedListMarkerRxMap')['$[]'](s)['$match?'](marker);}, TMP_61.$$s = self, TMP_61.$$arity = 1, TMP_61))); + if ("arabic"['$===']($case)) { + if ($truthy(validate)) { + + expected = $rb_plus(ordinal, 1); + actual = marker.$to_i();}; + marker = "1.";} + else if ("loweralpha"['$===']($case)) { + if ($truthy(validate)) { + + expected = $rb_plus("a"['$[]'](0).$ord(), ordinal).$chr(); + actual = marker.$chop();}; + marker = "a.";} + else if ("upperalpha"['$===']($case)) { + if ($truthy(validate)) { + + expected = $rb_plus("A"['$[]'](0).$ord(), ordinal).$chr(); + actual = marker.$chop();}; + marker = "A.";} + else if ("lowerroman"['$===']($case)) { + if ($truthy(validate)) { + + expected = $$($nesting, 'Helpers').$int_to_roman($rb_plus(ordinal, 1)).$downcase(); + actual = marker.$chop();}; + marker = "i)";} + else if ("upperroman"['$===']($case)) { + if ($truthy(validate)) { + + expected = $$($nesting, 'Helpers').$int_to_roman($rb_plus(ordinal, 1)); + actual = marker.$chop();}; + marker = "I)";}; + if ($truthy(($truthy($a = validate) ? expected['$!='](actual) : $a))) { + self.$logger().$warn(self.$message_with_context("" + "list item index: expected " + (expected) + ", got " + (actual), $hash2(["source_location"], {"source_location": reader.$cursor()})))}; + return [marker, style]; + }, TMP_Parser_resolve_ordered_list_marker_60.$$arity = -2); + Opal.defs(self, '$is_sibling_list_item?', TMP_Parser_is_sibling_list_item$q_62 = function(line, list_type, sibling_trait) { + var $a, self = this, matcher = nil, expected_marker = nil; + + + if ($truthy($$$('::', 'Regexp')['$==='](sibling_trait))) { + matcher = sibling_trait + } else { + + matcher = $$($nesting, 'ListRxMap')['$[]'](list_type); + expected_marker = sibling_trait; + }; + if ($truthy(matcher['$=~'](line))) { + if ($truthy(expected_marker)) { + return expected_marker['$=='](self.$resolve_list_marker(list_type, (($a = $gvars['~']) === nil ? nil : $a['$[]'](1)))) + } else { + return true + } + } else { + return false + }; + }, TMP_Parser_is_sibling_list_item$q_62.$$arity = 3); + Opal.defs(self, '$parse_table', TMP_Parser_parse_table_63 = function $$parse_table(table_reader, parent, attributes) { + var $a, $b, $c, $d, self = this, table = nil, $writer = nil, colspecs = nil, explicit_colspecs = nil, skipped = nil, parser_ctx = nil, format = nil, loop_idx = nil, implicit_header_boundary = nil, implicit_header = nil, line = nil, beyond_first = nil, next_cellspec = nil, m = nil, pre_match = nil, post_match = nil, $case = nil, cell_text = nil, $logical_op_recvr_tmp_2 = nil; + + + table = $$($nesting, 'Table').$new(parent, attributes); + if ($truthy(attributes['$key?']("title"))) { + + + $writer = [attributes.$delete("title")]; + $send(table, 'title=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + table.$assign_caption(attributes.$delete("caption"));}; + if ($truthy(($truthy($a = attributes['$key?']("cols")) ? (colspecs = self.$parse_colspecs(attributes['$[]']("cols")))['$empty?']()['$!']() : $a))) { + + table.$create_columns(colspecs); + explicit_colspecs = true;}; + skipped = ($truthy($a = table_reader.$skip_blank_lines()) ? $a : 0); + parser_ctx = $$$($$($nesting, 'Table'), 'ParserContext').$new(table_reader, table, attributes); + $a = [parser_ctx.$format(), -1, nil], (format = $a[0]), (loop_idx = $a[1]), (implicit_header_boundary = $a[2]), $a; + if ($truthy(($truthy($a = ($truthy($b = $rb_gt(skipped, 0)) ? $b : attributes['$key?']("header-option"))) ? $a : attributes['$key?']("noheader-option")))) { + } else { + implicit_header = true + }; + $a = false; while ($a || $truthy((line = table_reader.$read_line()))) {$a = false; + + if ($truthy(($truthy($b = (beyond_first = $rb_gt((loop_idx = $rb_plus(loop_idx, 1)), 0))) ? line['$empty?']() : $b))) { + + line = nil; + if ($truthy(implicit_header_boundary)) { + implicit_header_boundary = $rb_plus(implicit_header_boundary, 1)}; + } else if (format['$==']("psv")) { + if ($truthy(parser_ctx['$starts_with_delimiter?'](line))) { + + line = line.$slice(1, line.$length()); + parser_ctx.$close_open_cell(); + if ($truthy(implicit_header_boundary)) { + implicit_header_boundary = nil}; + } else { + + $c = self.$parse_cellspec(line, "start", parser_ctx.$delimiter()), $b = Opal.to_ary($c), (next_cellspec = ($b[0] == null ? nil : $b[0])), (line = ($b[1] == null ? nil : $b[1])), $c; + if ($truthy(next_cellspec)) { + + parser_ctx.$close_open_cell(next_cellspec); + if ($truthy(implicit_header_boundary)) { + implicit_header_boundary = nil}; + } else if ($truthy(($truthy($b = implicit_header_boundary) ? implicit_header_boundary['$=='](loop_idx) : $b))) { + $b = [false, nil], (implicit_header = $b[0]), (implicit_header_boundary = $b[1]), $b}; + }}; + if ($truthy(beyond_first)) { + } else { + + table_reader.$mark(); + if ($truthy(implicit_header)) { + if ($truthy(($truthy($b = table_reader['$has_more_lines?']()) ? table_reader.$peek_line()['$empty?']() : $b))) { + implicit_header_boundary = 1 + } else { + implicit_header = false + }}; + }; + $b = false; while ($b || $truthy(true)) {$b = false; + if ($truthy(($truthy($c = line) ? (m = parser_ctx.$match_delimiter(line)) : $c))) { + + $c = [m.$pre_match(), m.$post_match()], (pre_match = $c[0]), (post_match = $c[1]), $c; + $case = format; + if ("csv"['$===']($case)) { + if ($truthy(parser_ctx['$buffer_has_unclosed_quotes?'](pre_match))) { + + parser_ctx.$skip_past_delimiter(pre_match); + if ($truthy((line = post_match)['$empty?']())) { + break;}; + $b = true; continue;;}; + + $writer = ["" + (parser_ctx.$buffer()) + (pre_match)]; + $send(parser_ctx, 'buffer=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];;} + else if ("dsv"['$===']($case)) { + if ($truthy(pre_match['$end_with?']("\\"))) { + + parser_ctx.$skip_past_escaped_delimiter(pre_match); + if ($truthy((line = post_match)['$empty?']())) { + + + $writer = ["" + (parser_ctx.$buffer()) + ($$($nesting, 'LF'))]; + $send(parser_ctx, 'buffer=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + parser_ctx.$keep_cell_open(); + break;;}; + $b = true; continue;;}; + + $writer = ["" + (parser_ctx.$buffer()) + (pre_match)]; + $send(parser_ctx, 'buffer=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];;} + else { + if ($truthy(pre_match['$end_with?']("\\"))) { + + parser_ctx.$skip_past_escaped_delimiter(pre_match); + if ($truthy((line = post_match)['$empty?']())) { + + + $writer = ["" + (parser_ctx.$buffer()) + ($$($nesting, 'LF'))]; + $send(parser_ctx, 'buffer=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + parser_ctx.$keep_cell_open(); + break;;}; + $b = true; continue;;}; + $d = self.$parse_cellspec(pre_match), $c = Opal.to_ary($d), (next_cellspec = ($c[0] == null ? nil : $c[0])), (cell_text = ($c[1] == null ? nil : $c[1])), $d; + parser_ctx.$push_cellspec(next_cellspec); + + $writer = ["" + (parser_ctx.$buffer()) + (cell_text)]; + $send(parser_ctx, 'buffer=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];;}; + if ($truthy((line = post_match)['$empty?']())) { + line = nil}; + parser_ctx.$close_cell(); + } else { + + + $writer = ["" + (parser_ctx.$buffer()) + (line) + ($$($nesting, 'LF'))]; + $send(parser_ctx, 'buffer=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + $case = format; + if ("csv"['$===']($case)) {if ($truthy(parser_ctx['$buffer_has_unclosed_quotes?']())) { + + if ($truthy(($truthy($c = implicit_header_boundary) ? loop_idx['$=='](0) : $c))) { + $c = [false, nil], (implicit_header = $c[0]), (implicit_header_boundary = $c[1]), $c}; + parser_ctx.$keep_cell_open(); + } else { + parser_ctx.$close_cell(true) + }} + else if ("dsv"['$===']($case)) {parser_ctx.$close_cell(true)} + else {parser_ctx.$keep_cell_open()}; + break;; + } + }; + if ($truthy(parser_ctx['$cell_open?']())) { + if ($truthy(table_reader['$has_more_lines?']())) { + } else { + parser_ctx.$close_cell(true) + } + } else { + if ($truthy($b = table_reader.$skip_blank_lines())) { + $b + } else { + break; + } + }; + }; + if ($truthy(($truthy($a = (($logical_op_recvr_tmp_2 = table.$attributes()), ($truthy($b = $logical_op_recvr_tmp_2['$[]']("colcount")) ? $b : (($writer = ["colcount", table.$columns().$size()]), $send($logical_op_recvr_tmp_2, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])))['$=='](0)) ? $a : explicit_colspecs))) { + } else { + table.$assign_column_widths() + }; + if ($truthy(implicit_header)) { + + + $writer = [true]; + $send(table, 'has_header_option=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["header-option", ""]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["options", (function() {if ($truthy(attributes['$key?']("options"))) { + return "" + (attributes['$[]']("options")) + ",header" + } else { + return "header" + }; return nil; })()]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];;}; + table.$partition_header_footer(attributes); + return table; + }, TMP_Parser_parse_table_63.$$arity = 3); + Opal.defs(self, '$parse_colspecs', TMP_Parser_parse_colspecs_64 = function $$parse_colspecs(records) { + var TMP_65, TMP_66, self = this, specs = nil; + + + if ($truthy(records['$include?'](" "))) { + records = records.$delete(" ")}; + if (records['$=='](records.$to_i().$to_s())) { + return $send($$$('::', 'Array'), 'new', [records.$to_i()], (TMP_65 = function(){var self = TMP_65.$$s || this; + + return $hash2(["width"], {"width": 1})}, TMP_65.$$s = self, TMP_65.$$arity = 0, TMP_65))}; + specs = []; + $send((function() {if ($truthy(records['$include?'](","))) { + + return records.$split(",", -1); + } else { + + return records.$split(";", -1); + }; return nil; })(), 'each', [], (TMP_66 = function(record){var self = TMP_66.$$s || this, $a, $b, TMP_67, m = nil, spec = nil, colspec = nil, rowspec = nil, $writer = nil, width = nil; + + + + if (record == null) { + record = nil; + }; + if ($truthy(record['$empty?']())) { + return specs['$<<']($hash2(["width"], {"width": 1})) + } else if ($truthy((m = $$($nesting, 'ColumnSpecRx').$match(record)))) { + + spec = $hash2([], {}); + if ($truthy(m['$[]'](2))) { + + $b = m['$[]'](2).$split("."), $a = Opal.to_ary($b), (colspec = ($a[0] == null ? nil : $a[0])), (rowspec = ($a[1] == null ? nil : $a[1])), $b; + if ($truthy(($truthy($a = colspec['$nil_or_empty?']()['$!']()) ? $$($nesting, 'TableCellHorzAlignments')['$key?'](colspec) : $a))) { + + $writer = ["halign", $$($nesting, 'TableCellHorzAlignments')['$[]'](colspec)]; + $send(spec, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if ($truthy(($truthy($a = rowspec['$nil_or_empty?']()['$!']()) ? $$($nesting, 'TableCellVertAlignments')['$key?'](rowspec) : $a))) { + + $writer = ["valign", $$($nesting, 'TableCellVertAlignments')['$[]'](rowspec)]; + $send(spec, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];};}; + if ($truthy((width = m['$[]'](3)))) { + + $writer = ["width", (function() {if (width['$==']("~")) { + return -1 + } else { + return width.$to_i() + }; return nil; })()]; + $send(spec, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + } else { + + $writer = ["width", 1]; + $send(spec, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + if ($truthy(($truthy($a = m['$[]'](4)) ? $$($nesting, 'TableCellStyles')['$key?'](m['$[]'](4)) : $a))) { + + $writer = ["style", $$($nesting, 'TableCellStyles')['$[]'](m['$[]'](4))]; + $send(spec, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if ($truthy(m['$[]'](1))) { + return $send((1), 'upto', [m['$[]'](1).$to_i()], (TMP_67 = function(){var self = TMP_67.$$s || this; + + return specs['$<<'](spec.$dup())}, TMP_67.$$s = self, TMP_67.$$arity = 0, TMP_67)) + } else { + return specs['$<<'](spec) + }; + } else { + return nil + };}, TMP_66.$$s = self, TMP_66.$$arity = 1, TMP_66)); + return specs; + }, TMP_Parser_parse_colspecs_64.$$arity = 1); + Opal.defs(self, '$parse_cellspec', TMP_Parser_parse_cellspec_68 = function $$parse_cellspec(line, pos, delimiter) { + var $a, $b, self = this, m = nil, rest = nil, spec_part = nil, spec = nil, colspec = nil, rowspec = nil, $writer = nil; + + + + if (pos == null) { + pos = "end"; + }; + + if (delimiter == null) { + delimiter = nil; + }; + $a = [nil, ""], (m = $a[0]), (rest = $a[1]), $a; + if (pos['$==']("start")) { + if ($truthy(line['$include?'](delimiter))) { + + $b = line.$split(delimiter, 2), $a = Opal.to_ary($b), (spec_part = ($a[0] == null ? nil : $a[0])), (rest = ($a[1] == null ? nil : $a[1])), $b; + if ($truthy((m = $$($nesting, 'CellSpecStartRx').$match(spec_part)))) { + if ($truthy(m['$[]'](0)['$empty?']())) { + return [$hash2([], {}), rest]} + } else { + return [nil, line] + }; + } else { + return [nil, line] + } + } else if ($truthy((m = $$($nesting, 'CellSpecEndRx').$match(line)))) { + + if ($truthy(m['$[]'](0).$lstrip()['$empty?']())) { + return [$hash2([], {}), line.$rstrip()]}; + rest = m.$pre_match(); + } else { + return [$hash2([], {}), line] + }; + spec = $hash2([], {}); + if ($truthy(m['$[]'](1))) { + + $b = m['$[]'](1).$split("."), $a = Opal.to_ary($b), (colspec = ($a[0] == null ? nil : $a[0])), (rowspec = ($a[1] == null ? nil : $a[1])), $b; + colspec = (function() {if ($truthy(colspec['$nil_or_empty?']())) { + return 1 + } else { + return colspec.$to_i() + }; return nil; })(); + rowspec = (function() {if ($truthy(rowspec['$nil_or_empty?']())) { + return 1 + } else { + return rowspec.$to_i() + }; return nil; })(); + if (m['$[]'](2)['$==']("+")) { + + if (colspec['$=='](1)) { + } else { + + $writer = ["colspan", colspec]; + $send(spec, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + if (rowspec['$=='](1)) { + } else { + + $writer = ["rowspan", rowspec]; + $send(spec, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + } else if (m['$[]'](2)['$==']("*")) { + if (colspec['$=='](1)) { + } else { + + $writer = ["repeatcol", colspec]; + $send(spec, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }};}; + if ($truthy(m['$[]'](3))) { + + $b = m['$[]'](3).$split("."), $a = Opal.to_ary($b), (colspec = ($a[0] == null ? nil : $a[0])), (rowspec = ($a[1] == null ? nil : $a[1])), $b; + if ($truthy(($truthy($a = colspec['$nil_or_empty?']()['$!']()) ? $$($nesting, 'TableCellHorzAlignments')['$key?'](colspec) : $a))) { + + $writer = ["halign", $$($nesting, 'TableCellHorzAlignments')['$[]'](colspec)]; + $send(spec, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if ($truthy(($truthy($a = rowspec['$nil_or_empty?']()['$!']()) ? $$($nesting, 'TableCellVertAlignments')['$key?'](rowspec) : $a))) { + + $writer = ["valign", $$($nesting, 'TableCellVertAlignments')['$[]'](rowspec)]; + $send(spec, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];};}; + if ($truthy(($truthy($a = m['$[]'](4)) ? $$($nesting, 'TableCellStyles')['$key?'](m['$[]'](4)) : $a))) { + + $writer = ["style", $$($nesting, 'TableCellStyles')['$[]'](m['$[]'](4))]; + $send(spec, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + return [spec, rest]; + }, TMP_Parser_parse_cellspec_68.$$arity = -2); + Opal.defs(self, '$parse_style_attribute', TMP_Parser_parse_style_attribute_69 = function $$parse_style_attribute(attributes, reader) { + var $a, $b, TMP_70, TMP_71, TMP_72, self = this, raw_style = nil, type = nil, collector = nil, parsed = nil, save_current = nil, $writer = nil, parsed_style = nil, existing_role = nil, opts = nil, existing_opts = nil; + + + + if (reader == null) { + reader = nil; + }; + if ($truthy(($truthy($a = ($truthy($b = (raw_style = attributes['$[]'](1))) ? raw_style['$include?'](" ")['$!']() : $b)) ? $$($nesting, 'Compliance').$shorthand_property_syntax() : $a))) { + + $a = ["style", [], $hash2([], {})], (type = $a[0]), (collector = $a[1]), (parsed = $a[2]), $a; + save_current = $send(self, 'lambda', [], (TMP_70 = function(){var self = TMP_70.$$s || this, $c, $case = nil, $writer = nil; + + if ($truthy(collector['$empty?']())) { + if (type['$==']("style")) { + return nil + } else if ($truthy(reader)) { + return self.$logger().$warn(self.$message_with_context("" + "invalid empty " + (type) + " detected in style attribute", $hash2(["source_location"], {"source_location": reader.$cursor_at_prev_line()}))) + } else { + return self.$logger().$warn("" + "invalid empty " + (type) + " detected in style attribute") + } + } else { + + $case = type; + if ("role"['$===']($case) || "option"['$===']($case)) {($truthy($c = parsed['$[]'](type)) ? $c : (($writer = [type, []]), $send(parsed, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]))['$<<'](collector.$join())} + else if ("id"['$===']($case)) { + if ($truthy(parsed['$key?']("id"))) { + if ($truthy(reader)) { + self.$logger().$warn(self.$message_with_context("multiple ids detected in style attribute", $hash2(["source_location"], {"source_location": reader.$cursor_at_prev_line()}))) + } else { + self.$logger().$warn("multiple ids detected in style attribute") + }}; + + $writer = [type, collector.$join()]; + $send(parsed, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];;} + else { + $writer = [type, collector.$join()]; + $send(parsed, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + return (collector = []); + }}, TMP_70.$$s = self, TMP_70.$$arity = 0, TMP_70)); + $send(raw_style, 'each_char', [], (TMP_71 = function(c){var self = TMP_71.$$s || this, $c, $d, $case = nil; + + + + if (c == null) { + c = nil; + }; + if ($truthy(($truthy($c = ($truthy($d = c['$=='](".")) ? $d : c['$==']("#"))) ? $c : c['$==']("%")))) { + + save_current.$call(); + return (function() {$case = c; + if ("."['$===']($case)) {return (type = "role")} + else if ("#"['$===']($case)) {return (type = "id")} + else if ("%"['$===']($case)) {return (type = "option")} + else { return nil }})(); + } else { + return collector['$<<'](c) + };}, TMP_71.$$s = self, TMP_71.$$arity = 1, TMP_71)); + if (type['$==']("style")) { + + $writer = ["style", raw_style]; + $send(attributes, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + } else { + + save_current.$call(); + if ($truthy(parsed['$key?']("style"))) { + parsed_style = (($writer = ["style", parsed['$[]']("style")]), $send(attributes, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])}; + if ($truthy(parsed['$key?']("id"))) { + + $writer = ["id", parsed['$[]']("id")]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if ($truthy(parsed['$key?']("role"))) { + + $writer = ["role", (function() {if ($truthy((existing_role = attributes['$[]']("role"))['$nil_or_empty?']())) { + + return parsed['$[]']("role").$join(" "); + } else { + return "" + (existing_role) + " " + (parsed['$[]']("role").$join(" ")) + }; return nil; })()]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if ($truthy(parsed['$key?']("option"))) { + + $send((opts = parsed['$[]']("option")), 'each', [], (TMP_72 = function(opt){var self = TMP_72.$$s || this; + + + + if (opt == null) { + opt = nil; + }; + $writer = ["" + (opt) + "-option", ""]; + $send(attributes, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];}, TMP_72.$$s = self, TMP_72.$$arity = 1, TMP_72)); + + $writer = ["options", (function() {if ($truthy((existing_opts = attributes['$[]']("options"))['$nil_or_empty?']())) { + + return opts.$join(","); + } else { + return "" + (existing_opts) + "," + (opts.$join(",")) + }; return nil; })()]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];;}; + return parsed_style; + }; + } else { + + $writer = ["style", raw_style]; + $send(attributes, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + }; + }, TMP_Parser_parse_style_attribute_69.$$arity = -2); + Opal.defs(self, '$adjust_indentation!', TMP_Parser_adjust_indentation$B_73 = function(lines, indent, tab_size) { + var $a, TMP_74, TMP_77, TMP_78, TMP_79, TMP_80, self = this, full_tab_space = nil, gutter_width = nil, padding = nil; + + + + if (indent == null) { + indent = 0; + }; + + if (tab_size == null) { + tab_size = 0; + }; + if ($truthy(lines['$empty?']())) { + return nil}; + if ($truthy(($truthy($a = $rb_gt((tab_size = tab_size.$to_i()), 0)) ? lines.$join()['$include?']($$($nesting, 'TAB')) : $a))) { + + full_tab_space = $rb_times(" ", tab_size); + $send(lines, 'map!', [], (TMP_74 = function(line){var self = TMP_74.$$s || this, TMP_75, TMP_76, spaces_added = nil; + + + + if (line == null) { + line = nil; + }; + if ($truthy(line['$empty?']())) { + return line;}; + if ($truthy(line['$start_with?']($$($nesting, 'TAB')))) { + line = $send(line, 'sub', [$$($nesting, 'TabIndentRx')], (TMP_75 = function(){var self = TMP_75.$$s || this, $b; + + return $rb_times(full_tab_space, (($b = $gvars['~']) === nil ? nil : $b['$[]'](0)).$length())}, TMP_75.$$s = self, TMP_75.$$arity = 0, TMP_75))}; + if ($truthy(line['$include?']($$($nesting, 'TAB')))) { + + spaces_added = 0; + return line = $send(line, 'gsub', [$$($nesting, 'TabRx')], (TMP_76 = function(){var self = TMP_76.$$s || this, offset = nil, spaces = nil; + if ($gvars["~"] == null) $gvars["~"] = nil; + + if ((offset = $rb_plus($gvars["~"].$begin(0), spaces_added))['$%'](tab_size)['$=='](0)) { + + spaces_added = $rb_plus(spaces_added, $rb_minus(tab_size, 1)); + return full_tab_space; + } else { + + if ((spaces = $rb_minus(tab_size, offset['$%'](tab_size)))['$=='](1)) { + } else { + spaces_added = $rb_plus(spaces_added, $rb_minus(spaces, 1)) + }; + return $rb_times(" ", spaces); + }}, TMP_76.$$s = self, TMP_76.$$arity = 0, TMP_76)); + } else { + return line + };}, TMP_74.$$s = self, TMP_74.$$arity = 1, TMP_74));}; + if ($truthy(($truthy($a = indent) ? $rb_gt((indent = indent.$to_i()), -1) : $a))) { + } else { + return nil + }; + gutter_width = nil; + (function(){var $brk = Opal.new_brk(); try {return $send(lines, 'each', [], (TMP_77 = function(line){var self = TMP_77.$$s || this, $b, line_indent = nil; + + + + if (line == null) { + line = nil; + }; + if ($truthy(line['$empty?']())) { + return nil;}; + if ((line_indent = $rb_minus(line.$length(), line.$lstrip().$length()))['$=='](0)) { + + gutter_width = nil; + + Opal.brk(nil, $brk); + } else if ($truthy(($truthy($b = gutter_width) ? $rb_gt(line_indent, gutter_width) : $b))) { + return nil + } else { + return (gutter_width = line_indent) + };}, TMP_77.$$s = self, TMP_77.$$brk = $brk, TMP_77.$$arity = 1, TMP_77)) + } catch (err) { if (err === $brk) { return err.$v } else { throw err } }})(); + if (indent['$=='](0)) { + if ($truthy(gutter_width)) { + $send(lines, 'map!', [], (TMP_78 = function(line){var self = TMP_78.$$s || this; + + + + if (line == null) { + line = nil; + }; + if ($truthy(line['$empty?']())) { + return line + } else { + + return line.$slice(gutter_width, line.$length()); + };}, TMP_78.$$s = self, TMP_78.$$arity = 1, TMP_78))} + } else { + + padding = $rb_times(" ", indent); + if ($truthy(gutter_width)) { + $send(lines, 'map!', [], (TMP_79 = function(line){var self = TMP_79.$$s || this; + + + + if (line == null) { + line = nil; + }; + if ($truthy(line['$empty?']())) { + return line + } else { + return $rb_plus(padding, line.$slice(gutter_width, line.$length())) + };}, TMP_79.$$s = self, TMP_79.$$arity = 1, TMP_79)) + } else { + $send(lines, 'map!', [], (TMP_80 = function(line){var self = TMP_80.$$s || this; + + + + if (line == null) { + line = nil; + }; + if ($truthy(line['$empty?']())) { + return line + } else { + return $rb_plus(padding, line) + };}, TMP_80.$$s = self, TMP_80.$$arity = 1, TMP_80)) + }; + }; + return nil; + }, TMP_Parser_adjust_indentation$B_73.$$arity = -2); + return (Opal.defs(self, '$sanitize_attribute_name', TMP_Parser_sanitize_attribute_name_81 = function $$sanitize_attribute_name(name) { + var self = this; + + return name.$gsub($$($nesting, 'InvalidAttributeNameCharsRx'), "").$downcase() + }, TMP_Parser_sanitize_attribute_name_81.$$arity = 1), nil) && 'sanitize_attribute_name'; + })($nesting[0], null, $nesting) + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/path_resolver"] = function(Opal) { + function $rb_plus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); + } + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + function $rb_gt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $truthy = Opal.truthy, $hash2 = Opal.hash2, $send = Opal.send; + + Opal.add_stubs(['$include', '$attr_accessor', '$root?', '$posixify', '$expand_path', '$pwd', '$start_with?', '$==', '$match?', '$absolute_path?', '$+', '$length', '$descends_from?', '$slice', '$to_s', '$relative_path_from', '$new', '$include?', '$tr', '$partition_path', '$each', '$pop', '$<<', '$join_path', '$[]', '$web_root?', '$unc?', '$index', '$split', '$delete', '$[]=', '$-', '$join', '$raise', '$!', '$fetch', '$warn', '$logger', '$empty?', '$nil_or_empty?', '$chomp', '$!=', '$>', '$size', '$end_with?', '$uri_prefix', '$gsub']); + return (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + (function($base, $super, $parent_nesting) { + function $PathResolver(){}; + var self = $PathResolver = $klass($base, $super, 'PathResolver', $PathResolver); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_PathResolver_initialize_1, TMP_PathResolver_absolute_path$q_2, $a, TMP_PathResolver_root$q_3, TMP_PathResolver_unc$q_4, TMP_PathResolver_web_root$q_5, TMP_PathResolver_descends_from$q_6, TMP_PathResolver_relative_path_7, TMP_PathResolver_posixify_8, TMP_PathResolver_expand_path_9, TMP_PathResolver_partition_path_11, TMP_PathResolver_join_path_12, TMP_PathResolver_system_path_13, TMP_PathResolver_web_path_16; + + def.file_separator = def._partition_path_web = def._partition_path_sys = def.working_dir = nil; + + self.$include($$($nesting, 'Logging')); + Opal.const_set($nesting[0], 'DOT', "."); + Opal.const_set($nesting[0], 'DOT_DOT', ".."); + Opal.const_set($nesting[0], 'DOT_SLASH', "./"); + Opal.const_set($nesting[0], 'SLASH', "/"); + Opal.const_set($nesting[0], 'BACKSLASH', "\\"); + Opal.const_set($nesting[0], 'DOUBLE_SLASH', "//"); + Opal.const_set($nesting[0], 'WindowsRootRx', /^(?:[a-zA-Z]:)?[\\\/]/); + self.$attr_accessor("file_separator"); + self.$attr_accessor("working_dir"); + + Opal.def(self, '$initialize', TMP_PathResolver_initialize_1 = function $$initialize(file_separator, working_dir) { + var $a, $b, self = this; + + + + if (file_separator == null) { + file_separator = nil; + }; + + if (working_dir == null) { + working_dir = nil; + }; + self.file_separator = ($truthy($a = ($truthy($b = file_separator) ? $b : $$$($$$('::', 'File'), 'ALT_SEPARATOR'))) ? $a : $$$($$$('::', 'File'), 'SEPARATOR')); + self.working_dir = (function() {if ($truthy(working_dir)) { + + if ($truthy(self['$root?'](working_dir))) { + + return self.$posixify(working_dir); + } else { + + return $$$('::', 'File').$expand_path(working_dir); + }; + } else { + return $$$('::', 'Dir').$pwd() + }; return nil; })(); + self._partition_path_sys = $hash2([], {}); + return (self._partition_path_web = $hash2([], {})); + }, TMP_PathResolver_initialize_1.$$arity = -1); + + Opal.def(self, '$absolute_path?', TMP_PathResolver_absolute_path$q_2 = function(path) { + var $a, $b, self = this; + + return ($truthy($a = path['$start_with?']($$($nesting, 'SLASH'))) ? $a : (($b = self.file_separator['$==']($$($nesting, 'BACKSLASH'))) ? $$($nesting, 'WindowsRootRx')['$match?'](path) : self.file_separator['$==']($$($nesting, 'BACKSLASH')))) + }, TMP_PathResolver_absolute_path$q_2.$$arity = 1); + if ($truthy((($a = $$($nesting, 'RUBY_ENGINE')['$==']("opal")) ? $$$('::', 'JAVASCRIPT_IO_MODULE')['$==']("xmlhttprequest") : $$($nesting, 'RUBY_ENGINE')['$==']("opal")))) { + + Opal.def(self, '$root?', TMP_PathResolver_root$q_3 = function(path) { + var $a, self = this; + + return ($truthy($a = self['$absolute_path?'](path)) ? $a : path['$start_with?']("file://", "http://", "https://")) + }, TMP_PathResolver_root$q_3.$$arity = 1) + } else { + Opal.alias(self, "root?", "absolute_path?") + }; + + Opal.def(self, '$unc?', TMP_PathResolver_unc$q_4 = function(path) { + var self = this; + + return path['$start_with?']($$($nesting, 'DOUBLE_SLASH')) + }, TMP_PathResolver_unc$q_4.$$arity = 1); + + Opal.def(self, '$web_root?', TMP_PathResolver_web_root$q_5 = function(path) { + var self = this; + + return path['$start_with?']($$($nesting, 'SLASH')) + }, TMP_PathResolver_web_root$q_5.$$arity = 1); + + Opal.def(self, '$descends_from?', TMP_PathResolver_descends_from$q_6 = function(path, base) { + var $a, self = this; + + if (base['$=='](path)) { + return 0 + } else if (base['$==']($$($nesting, 'SLASH'))) { + return ($truthy($a = path['$start_with?']($$($nesting, 'SLASH'))) ? 1 : $a) + } else { + return ($truthy($a = path['$start_with?']($rb_plus(base, $$($nesting, 'SLASH')))) ? $rb_plus(base.$length(), 1) : $a) + } + }, TMP_PathResolver_descends_from$q_6.$$arity = 2); + + Opal.def(self, '$relative_path', TMP_PathResolver_relative_path_7 = function $$relative_path(path, base) { + var self = this, offset = nil; + + if ($truthy(self['$root?'](path))) { + if ($truthy((offset = self['$descends_from?'](path, base)))) { + return path.$slice(offset, path.$length()) + } else { + return $$($nesting, 'Pathname').$new(path).$relative_path_from($$($nesting, 'Pathname').$new(base)).$to_s() + } + } else { + return path + } + }, TMP_PathResolver_relative_path_7.$$arity = 2); + + Opal.def(self, '$posixify', TMP_PathResolver_posixify_8 = function $$posixify(path) { + var $a, self = this; + + if ($truthy(path)) { + if ($truthy((($a = self.file_separator['$==']($$($nesting, 'BACKSLASH'))) ? path['$include?']($$($nesting, 'BACKSLASH')) : self.file_separator['$==']($$($nesting, 'BACKSLASH'))))) { + + return path.$tr($$($nesting, 'BACKSLASH'), $$($nesting, 'SLASH')); + } else { + return path + } + } else { + return "" + } + }, TMP_PathResolver_posixify_8.$$arity = 1); + Opal.alias(self, "posixfy", "posixify"); + + Opal.def(self, '$expand_path', TMP_PathResolver_expand_path_9 = function $$expand_path(path) { + var $a, $b, TMP_10, self = this, path_segments = nil, path_root = nil, resolved_segments = nil; + + + $b = self.$partition_path(path), $a = Opal.to_ary($b), (path_segments = ($a[0] == null ? nil : $a[0])), (path_root = ($a[1] == null ? nil : $a[1])), $b; + if ($truthy(path['$include?']($$($nesting, 'DOT_DOT')))) { + + resolved_segments = []; + $send(path_segments, 'each', [], (TMP_10 = function(segment){var self = TMP_10.$$s || this; + + + + if (segment == null) { + segment = nil; + }; + if (segment['$==']($$($nesting, 'DOT_DOT'))) { + return resolved_segments.$pop() + } else { + return resolved_segments['$<<'](segment) + };}, TMP_10.$$s = self, TMP_10.$$arity = 1, TMP_10)); + return self.$join_path(resolved_segments, path_root); + } else { + return self.$join_path(path_segments, path_root) + }; + }, TMP_PathResolver_expand_path_9.$$arity = 1); + + Opal.def(self, '$partition_path', TMP_PathResolver_partition_path_11 = function $$partition_path(path, web) { + var self = this, result = nil, cache = nil, posix_path = nil, root = nil, path_segments = nil, $writer = nil; + + + + if (web == null) { + web = nil; + }; + if ($truthy((result = (cache = (function() {if ($truthy(web)) { + return self._partition_path_web + } else { + return self._partition_path_sys + }; return nil; })())['$[]'](path)))) { + return result}; + posix_path = self.$posixify(path); + if ($truthy(web)) { + if ($truthy(self['$web_root?'](posix_path))) { + root = $$($nesting, 'SLASH') + } else if ($truthy(posix_path['$start_with?']($$($nesting, 'DOT_SLASH')))) { + root = $$($nesting, 'DOT_SLASH')} + } else if ($truthy(self['$root?'](posix_path))) { + if ($truthy(self['$unc?'](posix_path))) { + root = $$($nesting, 'DOUBLE_SLASH') + } else if ($truthy(posix_path['$start_with?']($$($nesting, 'SLASH')))) { + root = $$($nesting, 'SLASH') + } else { + root = posix_path.$slice(0, $rb_plus(posix_path.$index($$($nesting, 'SLASH')), 1)) + } + } else if ($truthy(posix_path['$start_with?']($$($nesting, 'DOT_SLASH')))) { + root = $$($nesting, 'DOT_SLASH')}; + path_segments = (function() {if ($truthy(root)) { + + return posix_path.$slice(root.$length(), posix_path.$length()); + } else { + return posix_path + }; return nil; })().$split($$($nesting, 'SLASH')); + path_segments.$delete($$($nesting, 'DOT')); + + $writer = [path, [path_segments, root]]; + $send(cache, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];; + }, TMP_PathResolver_partition_path_11.$$arity = -2); + + Opal.def(self, '$join_path', TMP_PathResolver_join_path_12 = function $$join_path(segments, root) { + var self = this; + + + + if (root == null) { + root = nil; + }; + if ($truthy(root)) { + return "" + (root) + (segments.$join($$($nesting, 'SLASH'))) + } else { + + return segments.$join($$($nesting, 'SLASH')); + }; + }, TMP_PathResolver_join_path_12.$$arity = -2); + + Opal.def(self, '$system_path', TMP_PathResolver_system_path_13 = function $$system_path(target, start, jail, opts) { + var $a, $b, TMP_14, TMP_15, self = this, target_path = nil, target_segments = nil, _ = nil, jail_segments = nil, jail_root = nil, recheck = nil, start_segments = nil, start_root = nil, resolved_segments = nil, unresolved_segments = nil, warned = nil; + + + + if (start == null) { + start = nil; + }; + + if (jail == null) { + jail = nil; + }; + + if (opts == null) { + opts = $hash2([], {}); + }; + if ($truthy(jail)) { + + if ($truthy(self['$root?'](jail))) { + } else { + self.$raise($$$('::', 'SecurityError'), "" + "Jail is not an absolute path: " + (jail)) + }; + jail = self.$posixify(jail);}; + if ($truthy(target)) { + if ($truthy(self['$root?'](target))) { + + target_path = self.$expand_path(target); + if ($truthy(($truthy($a = jail) ? self['$descends_from?'](target_path, jail)['$!']() : $a))) { + if ($truthy(opts.$fetch("recover", true))) { + + self.$logger().$warn("" + (($truthy($a = opts['$[]']("target_name")) ? $a : "path")) + " is outside of jail; recovering automatically"); + $b = self.$partition_path(target_path), $a = Opal.to_ary($b), (target_segments = ($a[0] == null ? nil : $a[0])), (_ = ($a[1] == null ? nil : $a[1])), $b; + $b = self.$partition_path(jail), $a = Opal.to_ary($b), (jail_segments = ($a[0] == null ? nil : $a[0])), (jail_root = ($a[1] == null ? nil : $a[1])), $b; + return self.$join_path($rb_plus(jail_segments, target_segments), jail_root); + } else { + self.$raise($$$('::', 'SecurityError'), "" + (($truthy($a = opts['$[]']("target_name")) ? $a : "path")) + " " + (target) + " is outside of jail: " + (jail) + " (disallowed in safe mode)") + }}; + return target_path; + } else { + $b = self.$partition_path(target), $a = Opal.to_ary($b), (target_segments = ($a[0] == null ? nil : $a[0])), (_ = ($a[1] == null ? nil : $a[1])), $b + } + } else { + target_segments = [] + }; + if ($truthy(target_segments['$empty?']())) { + if ($truthy(start['$nil_or_empty?']())) { + return ($truthy($a = jail) ? $a : self.working_dir) + } else if ($truthy(self['$root?'](start))) { + if ($truthy(jail)) { + start = self.$posixify(start) + } else { + return self.$expand_path(start) + } + } else { + + $b = self.$partition_path(start), $a = Opal.to_ary($b), (target_segments = ($a[0] == null ? nil : $a[0])), (_ = ($a[1] == null ? nil : $a[1])), $b; + start = ($truthy($a = jail) ? $a : self.working_dir); + } + } else if ($truthy(start['$nil_or_empty?']())) { + start = ($truthy($a = jail) ? $a : self.working_dir) + } else if ($truthy(self['$root?'](start))) { + if ($truthy(jail)) { + start = self.$posixify(start)} + } else { + start = "" + (($truthy($a = jail) ? $a : self.working_dir).$chomp("/")) + "/" + (start) + }; + if ($truthy(($truthy($a = ($truthy($b = jail) ? (recheck = self['$descends_from?'](start, jail)['$!']()) : $b)) ? self.file_separator['$==']($$($nesting, 'BACKSLASH')) : $a))) { + + $b = self.$partition_path(start), $a = Opal.to_ary($b), (start_segments = ($a[0] == null ? nil : $a[0])), (start_root = ($a[1] == null ? nil : $a[1])), $b; + $b = self.$partition_path(jail), $a = Opal.to_ary($b), (jail_segments = ($a[0] == null ? nil : $a[0])), (jail_root = ($a[1] == null ? nil : $a[1])), $b; + if ($truthy(start_root['$!='](jail_root))) { + if ($truthy(opts.$fetch("recover", true))) { + + self.$logger().$warn("" + "start path for " + (($truthy($a = opts['$[]']("target_name")) ? $a : "path")) + " is outside of jail root; recovering automatically"); + start_segments = jail_segments; + recheck = false; + } else { + self.$raise($$$('::', 'SecurityError'), "" + "start path for " + (($truthy($a = opts['$[]']("target_name")) ? $a : "path")) + " " + (start) + " refers to location outside jail root: " + (jail) + " (disallowed in safe mode)") + }}; + } else { + $b = self.$partition_path(start), $a = Opal.to_ary($b), (start_segments = ($a[0] == null ? nil : $a[0])), (jail_root = ($a[1] == null ? nil : $a[1])), $b + }; + if ($truthy((resolved_segments = $rb_plus(start_segments, target_segments))['$include?']($$($nesting, 'DOT_DOT')))) { + + $a = [resolved_segments, []], (unresolved_segments = $a[0]), (resolved_segments = $a[1]), $a; + if ($truthy(jail)) { + + if ($truthy(jail_segments)) { + } else { + $b = self.$partition_path(jail), $a = Opal.to_ary($b), (jail_segments = ($a[0] == null ? nil : $a[0])), (_ = ($a[1] == null ? nil : $a[1])), $b + }; + warned = false; + $send(unresolved_segments, 'each', [], (TMP_14 = function(segment){var self = TMP_14.$$s || this, $c; + + + + if (segment == null) { + segment = nil; + }; + if (segment['$==']($$($nesting, 'DOT_DOT'))) { + if ($truthy($rb_gt(resolved_segments.$size(), jail_segments.$size()))) { + return resolved_segments.$pop() + } else if ($truthy(opts.$fetch("recover", true))) { + if ($truthy(warned)) { + return nil + } else { + + self.$logger().$warn("" + (($truthy($c = opts['$[]']("target_name")) ? $c : "path")) + " has illegal reference to ancestor of jail; recovering automatically"); + return (warned = true); + } + } else { + return self.$raise($$$('::', 'SecurityError'), "" + (($truthy($c = opts['$[]']("target_name")) ? $c : "path")) + " " + (target) + " refers to location outside jail: " + (jail) + " (disallowed in safe mode)") + } + } else { + return resolved_segments['$<<'](segment) + };}, TMP_14.$$s = self, TMP_14.$$arity = 1, TMP_14)); + } else { + $send(unresolved_segments, 'each', [], (TMP_15 = function(segment){var self = TMP_15.$$s || this; + + + + if (segment == null) { + segment = nil; + }; + if (segment['$==']($$($nesting, 'DOT_DOT'))) { + return resolved_segments.$pop() + } else { + return resolved_segments['$<<'](segment) + };}, TMP_15.$$s = self, TMP_15.$$arity = 1, TMP_15)) + };}; + if ($truthy(recheck)) { + + target_path = self.$join_path(resolved_segments, jail_root); + if ($truthy(self['$descends_from?'](target_path, jail))) { + return target_path + } else if ($truthy(opts.$fetch("recover", true))) { + + self.$logger().$warn("" + (($truthy($a = opts['$[]']("target_name")) ? $a : "path")) + " is outside of jail; recovering automatically"); + if ($truthy(jail_segments)) { + } else { + $b = self.$partition_path(jail), $a = Opal.to_ary($b), (jail_segments = ($a[0] == null ? nil : $a[0])), (_ = ($a[1] == null ? nil : $a[1])), $b + }; + return self.$join_path($rb_plus(jail_segments, target_segments), jail_root); + } else { + return self.$raise($$$('::', 'SecurityError'), "" + (($truthy($a = opts['$[]']("target_name")) ? $a : "path")) + " " + (target) + " is outside of jail: " + (jail) + " (disallowed in safe mode)") + }; + } else { + return self.$join_path(resolved_segments, jail_root) + }; + }, TMP_PathResolver_system_path_13.$$arity = -2); + return (Opal.def(self, '$web_path', TMP_PathResolver_web_path_16 = function $$web_path(target, start) { + var $a, $b, TMP_17, self = this, uri_prefix = nil, target_segments = nil, target_root = nil, resolved_segments = nil, resolved_path = nil; + + + + if (start == null) { + start = nil; + }; + target = self.$posixify(target); + start = self.$posixify(start); + uri_prefix = nil; + if ($truthy(($truthy($a = start['$nil_or_empty?']()) ? $a : self['$web_root?'](target)))) { + } else { + + target = (function() {if ($truthy(start['$end_with?']($$($nesting, 'SLASH')))) { + return "" + (start) + (target) + } else { + return "" + (start) + ($$($nesting, 'SLASH')) + (target) + }; return nil; })(); + if ($truthy((uri_prefix = $$($nesting, 'Helpers').$uri_prefix(target)))) { + target = target['$[]'](Opal.Range.$new(uri_prefix.$length(), -1, false))}; + }; + $b = self.$partition_path(target, true), $a = Opal.to_ary($b), (target_segments = ($a[0] == null ? nil : $a[0])), (target_root = ($a[1] == null ? nil : $a[1])), $b; + resolved_segments = []; + $send(target_segments, 'each', [], (TMP_17 = function(segment){var self = TMP_17.$$s || this, $c; + + + + if (segment == null) { + segment = nil; + }; + if (segment['$==']($$($nesting, 'DOT_DOT'))) { + if ($truthy(resolved_segments['$empty?']())) { + if ($truthy(($truthy($c = target_root) ? target_root['$!=']($$($nesting, 'DOT_SLASH')) : $c))) { + return nil + } else { + return resolved_segments['$<<'](segment) + } + } else if (resolved_segments['$[]'](-1)['$==']($$($nesting, 'DOT_DOT'))) { + return resolved_segments['$<<'](segment) + } else { + return resolved_segments.$pop() + } + } else { + return resolved_segments['$<<'](segment) + };}, TMP_17.$$s = self, TMP_17.$$arity = 1, TMP_17)); + if ($truthy((resolved_path = self.$join_path(resolved_segments, target_root))['$include?'](" "))) { + resolved_path = resolved_path.$gsub(" ", "%20")}; + if ($truthy(uri_prefix)) { + return "" + (uri_prefix) + (resolved_path) + } else { + return resolved_path + }; + }, TMP_PathResolver_web_path_16.$$arity = -2), nil) && 'web_path'; + })($nesting[0], null, $nesting) + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/reader"] = function(Opal) { + function $rb_plus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); + } + function $rb_gt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); + } + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + function $rb_times(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs * rhs : lhs['$*'](rhs); + } + function $rb_lt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); + } + function $rb_ge(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs >= rhs : lhs['$>='](rhs); + } + function $rb_divide(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs / rhs : lhs['$/'](rhs); + } + function $rb_le(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs <= rhs : lhs['$<='](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $hash2 = Opal.hash2, $truthy = Opal.truthy, $send = Opal.send, $gvars = Opal.gvars, $hash = Opal.hash; + + Opal.add_stubs(['$include', '$attr_reader', '$+', '$attr_accessor', '$!', '$===', '$split', '$file', '$dir', '$dirname', '$path', '$basename', '$lineno', '$prepare_lines', '$drop', '$[]', '$normalize_lines_from_string', '$normalize_lines_array', '$empty?', '$nil_or_empty?', '$peek_line', '$>', '$slice', '$length', '$process_line', '$times', '$shift', '$read_line', '$<<', '$-', '$unshift_all', '$has_more_lines?', '$join', '$read_lines', '$unshift', '$start_with?', '$==', '$*', '$read_lines_until', '$size', '$clear', '$cursor', '$[]=', '$!=', '$fetch', '$cursor_at_mark', '$warn', '$logger', '$message_with_context', '$new', '$each', '$instance_variables', '$instance_variable_get', '$dup', '$instance_variable_set', '$to_i', '$attributes', '$<', '$catalog', '$skip_front_matter!', '$pop', '$adjust_indentation!', '$attr', '$end_with?', '$include?', '$=~', '$preprocess_conditional_directive', '$preprocess_include_directive', '$pop_include', '$downcase', '$error', '$none?', '$key?', '$any?', '$all?', '$strip', '$resolve_expr_val', '$send', '$to_sym', '$replace_next_line', '$rstrip', '$sub_attributes', '$attribute_missing', '$include_processors?', '$find', '$handles?', '$instance', '$process_method', '$parse_attributes', '$>=', '$safe', '$resolve_include_path', '$split_delimited_value', '$/', '$to_a', '$uniq', '$sort', '$open', '$each_line', '$infinite?', '$push_include', '$delete', '$value?', '$force_encoding', '$create_include_cursor', '$rindex', '$delete_at', '$nil?', '$keys', '$read', '$uriish?', '$attr?', '$require_library', '$parse', '$normalize_system_path', '$file?', '$relative_path', '$path_resolver', '$base_dir', '$to_s', '$path=', '$extname', '$rootname', '$<=', '$to_f', '$extensions?', '$extensions', '$include_processors', '$class', '$object_id', '$inspect', '$map']); + return (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + + (function($base, $super, $parent_nesting) { + function $Reader(){}; + var self = $Reader = $klass($base, $super, 'Reader', $Reader); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Reader_initialize_4, TMP_Reader_prepare_lines_5, TMP_Reader_process_line_6, TMP_Reader_has_more_lines$q_7, TMP_Reader_empty$q_8, TMP_Reader_next_line_empty$q_9, TMP_Reader_peek_line_10, TMP_Reader_peek_lines_11, TMP_Reader_read_line_13, TMP_Reader_read_lines_14, TMP_Reader_read_15, TMP_Reader_advance_16, TMP_Reader_unshift_line_17, TMP_Reader_unshift_lines_18, TMP_Reader_replace_next_line_19, TMP_Reader_skip_blank_lines_20, TMP_Reader_skip_comment_lines_21, TMP_Reader_skip_line_comments_22, TMP_Reader_terminate_23, TMP_Reader_read_lines_until_24, TMP_Reader_shift_25, TMP_Reader_unshift_26, TMP_Reader_unshift_all_27, TMP_Reader_cursor_28, TMP_Reader_cursor_at_line_29, TMP_Reader_cursor_at_mark_30, TMP_Reader_cursor_before_mark_31, TMP_Reader_cursor_at_prev_line_32, TMP_Reader_mark_33, TMP_Reader_line_info_34, TMP_Reader_lines_35, TMP_Reader_string_36, TMP_Reader_source_37, TMP_Reader_save_38, TMP_Reader_restore_save_40, TMP_Reader_discard_save_42; + + def.file = def.lines = def.process_lines = def.look_ahead = def.unescape_next_line = def.lineno = def.dir = def.path = def.mark = def.source_lines = def.saved = nil; + + self.$include($$($nesting, 'Logging')); + (function($base, $super, $parent_nesting) { + function $Cursor(){}; + var self = $Cursor = $klass($base, $super, 'Cursor', $Cursor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Cursor_initialize_1, TMP_Cursor_advance_2, TMP_Cursor_line_info_3; + + def.lineno = def.path = nil; + + self.$attr_reader("file", "dir", "path", "lineno"); + + Opal.def(self, '$initialize', TMP_Cursor_initialize_1 = function $$initialize(file, dir, path, lineno) { + var $a, self = this; + + + + if (dir == null) { + dir = nil; + }; + + if (path == null) { + path = nil; + }; + + if (lineno == null) { + lineno = 1; + }; + return $a = [file, dir, path, lineno], (self.file = $a[0]), (self.dir = $a[1]), (self.path = $a[2]), (self.lineno = $a[3]), $a; + }, TMP_Cursor_initialize_1.$$arity = -2); + + Opal.def(self, '$advance', TMP_Cursor_advance_2 = function $$advance(num) { + var self = this; + + return (self.lineno = $rb_plus(self.lineno, num)) + }, TMP_Cursor_advance_2.$$arity = 1); + + Opal.def(self, '$line_info', TMP_Cursor_line_info_3 = function $$line_info() { + var self = this; + + return "" + (self.path) + ": line " + (self.lineno) + }, TMP_Cursor_line_info_3.$$arity = 0); + return Opal.alias(self, "to_s", "line_info"); + })($nesting[0], null, $nesting); + self.$attr_reader("file"); + self.$attr_reader("dir"); + self.$attr_reader("path"); + self.$attr_reader("lineno"); + self.$attr_reader("source_lines"); + self.$attr_accessor("process_lines"); + self.$attr_accessor("unterminated"); + + Opal.def(self, '$initialize', TMP_Reader_initialize_4 = function $$initialize(data, cursor, opts) { + var $a, $b, self = this; + + + + if (data == null) { + data = nil; + }; + + if (cursor == null) { + cursor = nil; + }; + + if (opts == null) { + opts = $hash2([], {}); + }; + if ($truthy(cursor['$!']())) { + + self.file = nil; + self.dir = "."; + self.path = ""; + self.lineno = 1; + } else if ($truthy($$$('::', 'String')['$==='](cursor))) { + + self.file = cursor; + $b = $$$('::', 'File').$split(self.file), $a = Opal.to_ary($b), (self.dir = ($a[0] == null ? nil : $a[0])), (self.path = ($a[1] == null ? nil : $a[1])), $b; + self.lineno = 1; + } else { + + if ($truthy((self.file = cursor.$file()))) { + + self.dir = ($truthy($a = cursor.$dir()) ? $a : $$$('::', 'File').$dirname(self.file)); + self.path = ($truthy($a = cursor.$path()) ? $a : $$$('::', 'File').$basename(self.file)); + } else { + + self.dir = ($truthy($a = cursor.$dir()) ? $a : "."); + self.path = ($truthy($a = cursor.$path()) ? $a : ""); + }; + self.lineno = ($truthy($a = cursor.$lineno()) ? $a : 1); + }; + self.lines = (function() {if ($truthy(data)) { + + return self.$prepare_lines(data, opts); + } else { + return [] + }; return nil; })(); + self.source_lines = self.lines.$drop(0); + self.mark = nil; + self.look_ahead = 0; + self.process_lines = true; + self.unescape_next_line = false; + self.unterminated = nil; + return (self.saved = nil); + }, TMP_Reader_initialize_4.$$arity = -1); + + Opal.def(self, '$prepare_lines', TMP_Reader_prepare_lines_5 = function $$prepare_lines(data, opts) { + var self = this; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + if ($truthy($$$('::', 'String')['$==='](data))) { + if ($truthy(opts['$[]']("normalize"))) { + return $$($nesting, 'Helpers').$normalize_lines_from_string(data) + } else { + return data.$split($$($nesting, 'LF'), -1) + } + } else if ($truthy(opts['$[]']("normalize"))) { + return $$($nesting, 'Helpers').$normalize_lines_array(data) + } else { + return data.$drop(0) + }; + }, TMP_Reader_prepare_lines_5.$$arity = -2); + + Opal.def(self, '$process_line', TMP_Reader_process_line_6 = function $$process_line(line) { + var self = this; + + + if ($truthy(self.process_lines)) { + self.look_ahead = $rb_plus(self.look_ahead, 1)}; + return line; + }, TMP_Reader_process_line_6.$$arity = 1); + + Opal.def(self, '$has_more_lines?', TMP_Reader_has_more_lines$q_7 = function() { + var self = this; + + if ($truthy(self.lines['$empty?']())) { + + self.look_ahead = 0; + return false; + } else { + return true + } + }, TMP_Reader_has_more_lines$q_7.$$arity = 0); + + Opal.def(self, '$empty?', TMP_Reader_empty$q_8 = function() { + var self = this; + + if ($truthy(self.lines['$empty?']())) { + + self.look_ahead = 0; + return true; + } else { + return false + } + }, TMP_Reader_empty$q_8.$$arity = 0); + Opal.alias(self, "eof?", "empty?"); + + Opal.def(self, '$next_line_empty?', TMP_Reader_next_line_empty$q_9 = function() { + var self = this; + + return self.$peek_line()['$nil_or_empty?']() + }, TMP_Reader_next_line_empty$q_9.$$arity = 0); + + Opal.def(self, '$peek_line', TMP_Reader_peek_line_10 = function $$peek_line(direct) { + var $a, self = this, line = nil; + + + + if (direct == null) { + direct = false; + }; + if ($truthy(($truthy($a = direct) ? $a : $rb_gt(self.look_ahead, 0)))) { + if ($truthy(self.unescape_next_line)) { + + return (line = self.lines['$[]'](0)).$slice(1, line.$length()); + } else { + return self.lines['$[]'](0) + } + } else if ($truthy(self.lines['$empty?']())) { + + self.look_ahead = 0; + return nil; + } else if ($truthy((line = self.$process_line(self.lines['$[]'](0))))) { + return line + } else { + return self.$peek_line() + }; + }, TMP_Reader_peek_line_10.$$arity = -1); + + Opal.def(self, '$peek_lines', TMP_Reader_peek_lines_11 = function $$peek_lines(num, direct) { + var $a, TMP_12, self = this, old_look_ahead = nil, result = nil; + + + + if (num == null) { + num = nil; + }; + + if (direct == null) { + direct = false; + }; + old_look_ahead = self.look_ahead; + result = []; + (function(){var $brk = Opal.new_brk(); try {return $send(($truthy($a = num) ? $a : $$($nesting, 'MAX_INT')), 'times', [], (TMP_12 = function(){var self = TMP_12.$$s || this, line = nil; + if (self.lineno == null) self.lineno = nil; + + if ($truthy((line = (function() {if ($truthy(direct)) { + return self.$shift() + } else { + return self.$read_line() + }; return nil; })()))) { + return result['$<<'](line) + } else { + + if ($truthy(direct)) { + self.lineno = $rb_minus(self.lineno, 1)}; + + Opal.brk(nil, $brk); + }}, TMP_12.$$s = self, TMP_12.$$brk = $brk, TMP_12.$$arity = 0, TMP_12)) + } catch (err) { if (err === $brk) { return err.$v } else { throw err } }})(); + if ($truthy(result['$empty?']())) { + } else { + + self.$unshift_all(result); + if ($truthy(direct)) { + self.look_ahead = old_look_ahead}; + }; + return result; + }, TMP_Reader_peek_lines_11.$$arity = -1); + + Opal.def(self, '$read_line', TMP_Reader_read_line_13 = function $$read_line() { + var $a, self = this; + + if ($truthy(($truthy($a = $rb_gt(self.look_ahead, 0)) ? $a : self['$has_more_lines?']()))) { + return self.$shift() + } else { + return nil + } + }, TMP_Reader_read_line_13.$$arity = 0); + + Opal.def(self, '$read_lines', TMP_Reader_read_lines_14 = function $$read_lines() { + var $a, self = this, lines = nil; + + + lines = []; + while ($truthy(self['$has_more_lines?']())) { + lines['$<<'](self.$shift()) + }; + return lines; + }, TMP_Reader_read_lines_14.$$arity = 0); + Opal.alias(self, "readlines", "read_lines"); + + Opal.def(self, '$read', TMP_Reader_read_15 = function $$read() { + var self = this; + + return self.$read_lines().$join($$($nesting, 'LF')) + }, TMP_Reader_read_15.$$arity = 0); + + Opal.def(self, '$advance', TMP_Reader_advance_16 = function $$advance() { + var self = this; + + if ($truthy(self.$shift())) { + return true + } else { + return false + } + }, TMP_Reader_advance_16.$$arity = 0); + + Opal.def(self, '$unshift_line', TMP_Reader_unshift_line_17 = function $$unshift_line(line_to_restore) { + var self = this; + + + self.$unshift(line_to_restore); + return nil; + }, TMP_Reader_unshift_line_17.$$arity = 1); + Opal.alias(self, "restore_line", "unshift_line"); + + Opal.def(self, '$unshift_lines', TMP_Reader_unshift_lines_18 = function $$unshift_lines(lines_to_restore) { + var self = this; + + + self.$unshift_all(lines_to_restore); + return nil; + }, TMP_Reader_unshift_lines_18.$$arity = 1); + Opal.alias(self, "restore_lines", "unshift_lines"); + + Opal.def(self, '$replace_next_line', TMP_Reader_replace_next_line_19 = function $$replace_next_line(replacement) { + var self = this; + + + self.$shift(); + self.$unshift(replacement); + return true; + }, TMP_Reader_replace_next_line_19.$$arity = 1); + Opal.alias(self, "replace_line", "replace_next_line"); + + Opal.def(self, '$skip_blank_lines', TMP_Reader_skip_blank_lines_20 = function $$skip_blank_lines() { + var $a, self = this, num_skipped = nil, next_line = nil; + + + if ($truthy(self['$empty?']())) { + return nil}; + num_skipped = 0; + while ($truthy((next_line = self.$peek_line()))) { + if ($truthy(next_line['$empty?']())) { + + self.$shift(); + num_skipped = $rb_plus(num_skipped, 1); + } else { + return num_skipped + } + }; + }, TMP_Reader_skip_blank_lines_20.$$arity = 0); + + Opal.def(self, '$skip_comment_lines', TMP_Reader_skip_comment_lines_21 = function $$skip_comment_lines() { + var $a, $b, self = this, next_line = nil, ll = nil; + + + if ($truthy(self['$empty?']())) { + return nil}; + while ($truthy(($truthy($b = (next_line = self.$peek_line())) ? next_line['$empty?']()['$!']() : $b))) { + if ($truthy(next_line['$start_with?']("//"))) { + if ($truthy(next_line['$start_with?']("///"))) { + if ($truthy(($truthy($b = $rb_gt((ll = next_line.$length()), 3)) ? next_line['$==']($rb_times("/", ll)) : $b))) { + self.$read_lines_until($hash2(["terminator", "skip_first_line", "read_last_line", "skip_processing", "context"], {"terminator": next_line, "skip_first_line": true, "read_last_line": true, "skip_processing": true, "context": "comment"})) + } else { + break; + } + } else { + self.$shift() + } + } else { + break; + } + }; + return nil; + }, TMP_Reader_skip_comment_lines_21.$$arity = 0); + + Opal.def(self, '$skip_line_comments', TMP_Reader_skip_line_comments_22 = function $$skip_line_comments() { + var $a, $b, self = this, comment_lines = nil, next_line = nil; + + + if ($truthy(self['$empty?']())) { + return []}; + comment_lines = []; + while ($truthy(($truthy($b = (next_line = self.$peek_line())) ? next_line['$empty?']()['$!']() : $b))) { + if ($truthy(next_line['$start_with?']("//"))) { + comment_lines['$<<'](self.$shift()) + } else { + break; + } + }; + return comment_lines; + }, TMP_Reader_skip_line_comments_22.$$arity = 0); + + Opal.def(self, '$terminate', TMP_Reader_terminate_23 = function $$terminate() { + var self = this; + + + self.lineno = $rb_plus(self.lineno, self.lines.$size()); + self.lines.$clear(); + self.look_ahead = 0; + return nil; + }, TMP_Reader_terminate_23.$$arity = 0); + + Opal.def(self, '$read_lines_until', TMP_Reader_read_lines_until_24 = function $$read_lines_until(options) { + var $a, $b, $c, $d, $iter = TMP_Reader_read_lines_until_24.$$p, $yield = $iter || nil, self = this, result = nil, restore_process_lines = nil, terminator = nil, start_cursor = nil, break_on_blank_lines = nil, break_on_list_continuation = nil, skip_comments = nil, complete = nil, line_read = nil, line_restored = nil, line = nil, $writer = nil, context = nil; + + if ($iter) TMP_Reader_read_lines_until_24.$$p = null; + + + if (options == null) { + options = $hash2([], {}); + }; + result = []; + if ($truthy(($truthy($a = self.process_lines) ? options['$[]']("skip_processing") : $a))) { + + self.process_lines = false; + restore_process_lines = true;}; + if ($truthy((terminator = options['$[]']("terminator")))) { + + start_cursor = ($truthy($a = options['$[]']("cursor")) ? $a : self.$cursor()); + break_on_blank_lines = false; + break_on_list_continuation = false; + } else { + + break_on_blank_lines = options['$[]']("break_on_blank_lines"); + break_on_list_continuation = options['$[]']("break_on_list_continuation"); + }; + skip_comments = options['$[]']("skip_line_comments"); + complete = (line_read = (line_restored = nil)); + if ($truthy(options['$[]']("skip_first_line"))) { + self.$shift()}; + while ($truthy(($truthy($b = complete['$!']()) ? (line = self.$read_line()) : $b))) { + + complete = (function() {while ($truthy(true)) { + + if ($truthy(($truthy($c = terminator) ? line['$=='](terminator) : $c))) { + return true}; + if ($truthy(($truthy($c = break_on_blank_lines) ? line['$empty?']() : $c))) { + return true}; + if ($truthy(($truthy($c = ($truthy($d = break_on_list_continuation) ? line_read : $d)) ? line['$==']($$($nesting, 'LIST_CONTINUATION')) : $c))) { + + + $writer = ["preserve_last_line", true]; + $send(options, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + return true;}; + if ($truthy((($c = ($yield !== nil)) ? Opal.yield1($yield, line) : ($yield !== nil)))) { + return true}; + return false; + }; return nil; })(); + if ($truthy(complete)) { + + if ($truthy(options['$[]']("read_last_line"))) { + + result['$<<'](line); + line_read = true;}; + if ($truthy(options['$[]']("preserve_last_line"))) { + + self.$unshift(line); + line_restored = true;}; + } else if ($truthy(($truthy($b = ($truthy($c = skip_comments) ? line['$start_with?']("//") : $c)) ? line['$start_with?']("///")['$!']() : $b))) { + } else { + + result['$<<'](line); + line_read = true; + }; + }; + if ($truthy(restore_process_lines)) { + + self.process_lines = true; + if ($truthy(($truthy($a = line_restored) ? terminator['$!']() : $a))) { + self.look_ahead = $rb_minus(self.look_ahead, 1)};}; + if ($truthy(($truthy($a = ($truthy($b = terminator) ? terminator['$!='](line) : $b)) ? (context = options.$fetch("context", terminator)) : $a))) { + + if (start_cursor['$==']("at_mark")) { + start_cursor = self.$cursor_at_mark()}; + self.$logger().$warn(self.$message_with_context("" + "unterminated " + (context) + " block", $hash2(["source_location"], {"source_location": start_cursor}))); + self.unterminated = true;}; + return result; + }, TMP_Reader_read_lines_until_24.$$arity = -1); + + Opal.def(self, '$shift', TMP_Reader_shift_25 = function $$shift() { + var self = this; + + + self.lineno = $rb_plus(self.lineno, 1); + if (self.look_ahead['$=='](0)) { + } else { + self.look_ahead = $rb_minus(self.look_ahead, 1) + }; + return self.lines.$shift(); + }, TMP_Reader_shift_25.$$arity = 0); + + Opal.def(self, '$unshift', TMP_Reader_unshift_26 = function $$unshift(line) { + var self = this; + + + self.lineno = $rb_minus(self.lineno, 1); + self.look_ahead = $rb_plus(self.look_ahead, 1); + return self.lines.$unshift(line); + }, TMP_Reader_unshift_26.$$arity = 1); + + Opal.def(self, '$unshift_all', TMP_Reader_unshift_all_27 = function $$unshift_all(lines) { + var self = this; + + + self.lineno = $rb_minus(self.lineno, lines.$size()); + self.look_ahead = $rb_plus(self.look_ahead, lines.$size()); + return $send(self.lines, 'unshift', Opal.to_a(lines)); + }, TMP_Reader_unshift_all_27.$$arity = 1); + + Opal.def(self, '$cursor', TMP_Reader_cursor_28 = function $$cursor() { + var self = this; + + return $$($nesting, 'Cursor').$new(self.file, self.dir, self.path, self.lineno) + }, TMP_Reader_cursor_28.$$arity = 0); + + Opal.def(self, '$cursor_at_line', TMP_Reader_cursor_at_line_29 = function $$cursor_at_line(lineno) { + var self = this; + + return $$($nesting, 'Cursor').$new(self.file, self.dir, self.path, lineno) + }, TMP_Reader_cursor_at_line_29.$$arity = 1); + + Opal.def(self, '$cursor_at_mark', TMP_Reader_cursor_at_mark_30 = function $$cursor_at_mark() { + var self = this; + + if ($truthy(self.mark)) { + return $send($$($nesting, 'Cursor'), 'new', Opal.to_a(self.mark)) + } else { + return self.$cursor() + } + }, TMP_Reader_cursor_at_mark_30.$$arity = 0); + + Opal.def(self, '$cursor_before_mark', TMP_Reader_cursor_before_mark_31 = function $$cursor_before_mark() { + var $a, $b, self = this, m_file = nil, m_dir = nil, m_path = nil, m_lineno = nil; + + if ($truthy(self.mark)) { + + $b = self.mark, $a = Opal.to_ary($b), (m_file = ($a[0] == null ? nil : $a[0])), (m_dir = ($a[1] == null ? nil : $a[1])), (m_path = ($a[2] == null ? nil : $a[2])), (m_lineno = ($a[3] == null ? nil : $a[3])), $b; + return $$($nesting, 'Cursor').$new(m_file, m_dir, m_path, $rb_minus(m_lineno, 1)); + } else { + return $$($nesting, 'Cursor').$new(self.file, self.dir, self.path, $rb_minus(self.lineno, 1)) + } + }, TMP_Reader_cursor_before_mark_31.$$arity = 0); + + Opal.def(self, '$cursor_at_prev_line', TMP_Reader_cursor_at_prev_line_32 = function $$cursor_at_prev_line() { + var self = this; + + return $$($nesting, 'Cursor').$new(self.file, self.dir, self.path, $rb_minus(self.lineno, 1)) + }, TMP_Reader_cursor_at_prev_line_32.$$arity = 0); + + Opal.def(self, '$mark', TMP_Reader_mark_33 = function $$mark() { + var self = this; + + return (self.mark = [self.file, self.dir, self.path, self.lineno]) + }, TMP_Reader_mark_33.$$arity = 0); + + Opal.def(self, '$line_info', TMP_Reader_line_info_34 = function $$line_info() { + var self = this; + + return "" + (self.path) + ": line " + (self.lineno) + }, TMP_Reader_line_info_34.$$arity = 0); + + Opal.def(self, '$lines', TMP_Reader_lines_35 = function $$lines() { + var self = this; + + return self.lines.$drop(0) + }, TMP_Reader_lines_35.$$arity = 0); + + Opal.def(self, '$string', TMP_Reader_string_36 = function $$string() { + var self = this; + + return self.lines.$join($$($nesting, 'LF')) + }, TMP_Reader_string_36.$$arity = 0); + + Opal.def(self, '$source', TMP_Reader_source_37 = function $$source() { + var self = this; + + return self.source_lines.$join($$($nesting, 'LF')) + }, TMP_Reader_source_37.$$arity = 0); + + Opal.def(self, '$save', TMP_Reader_save_38 = function $$save() { + var TMP_39, self = this, accum = nil; + + + accum = $hash2([], {}); + $send(self.$instance_variables(), 'each', [], (TMP_39 = function(name){var self = TMP_39.$$s || this, $a, $writer = nil, val = nil; + + + + if (name == null) { + name = nil; + }; + if ($truthy(($truthy($a = name['$==']("@saved")) ? $a : name['$==']("@source_lines")))) { + return nil + } else { + + $writer = [name, (function() {if ($truthy($$$('::', 'Array')['$===']((val = self.$instance_variable_get(name))))) { + return val.$dup() + } else { + return val + }; return nil; })()]; + $send(accum, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + };}, TMP_39.$$s = self, TMP_39.$$arity = 1, TMP_39)); + self.saved = accum; + return nil; + }, TMP_Reader_save_38.$$arity = 0); + + Opal.def(self, '$restore_save', TMP_Reader_restore_save_40 = function $$restore_save() { + var TMP_41, self = this; + + if ($truthy(self.saved)) { + + $send(self.saved, 'each', [], (TMP_41 = function(name, val){var self = TMP_41.$$s || this; + + + + if (name == null) { + name = nil; + }; + + if (val == null) { + val = nil; + }; + return self.$instance_variable_set(name, val);}, TMP_41.$$s = self, TMP_41.$$arity = 2, TMP_41)); + return (self.saved = nil); + } else { + return nil + } + }, TMP_Reader_restore_save_40.$$arity = 0); + + Opal.def(self, '$discard_save', TMP_Reader_discard_save_42 = function $$discard_save() { + var self = this; + + return (self.saved = nil) + }, TMP_Reader_discard_save_42.$$arity = 0); + return Opal.alias(self, "to_s", "line_info"); + })($nesting[0], null, $nesting); + (function($base, $super, $parent_nesting) { + function $PreprocessorReader(){}; + var self = $PreprocessorReader = $klass($base, $super, 'PreprocessorReader', $PreprocessorReader); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_PreprocessorReader_initialize_43, TMP_PreprocessorReader_prepare_lines_44, TMP_PreprocessorReader_process_line_45, TMP_PreprocessorReader_has_more_lines$q_46, TMP_PreprocessorReader_empty$q_47, TMP_PreprocessorReader_peek_line_48, TMP_PreprocessorReader_preprocess_conditional_directive_49, TMP_PreprocessorReader_preprocess_include_directive_54, TMP_PreprocessorReader_resolve_include_path_66, TMP_PreprocessorReader_push_include_67, TMP_PreprocessorReader_create_include_cursor_68, TMP_PreprocessorReader_pop_include_69, TMP_PreprocessorReader_include_depth_70, TMP_PreprocessorReader_exceeded_max_depth$q_71, TMP_PreprocessorReader_shift_72, TMP_PreprocessorReader_split_delimited_value_73, TMP_PreprocessorReader_skip_front_matter$B_74, TMP_PreprocessorReader_resolve_expr_val_75, TMP_PreprocessorReader_include_processors$q_76, TMP_PreprocessorReader_to_s_77; + + def.document = def.lineno = def.process_lines = def.look_ahead = def.skipping = def.include_stack = def.conditional_stack = def.path = def.include_processor_extensions = def.maxdepth = def.dir = def.lines = def.file = def.includes = def.unescape_next_line = nil; + + self.$attr_reader("include_stack"); + + Opal.def(self, '$initialize', TMP_PreprocessorReader_initialize_43 = function $$initialize(document, data, cursor, opts) { + var $iter = TMP_PreprocessorReader_initialize_43.$$p, $yield = $iter || nil, self = this, include_depth_default = nil; + + if ($iter) TMP_PreprocessorReader_initialize_43.$$p = null; + + + if (data == null) { + data = nil; + }; + + if (cursor == null) { + cursor = nil; + }; + + if (opts == null) { + opts = $hash2([], {}); + }; + self.document = document; + $send(self, Opal.find_super_dispatcher(self, 'initialize', TMP_PreprocessorReader_initialize_43, false), [data, cursor, opts], null); + include_depth_default = document.$attributes().$fetch("max-include-depth", 64).$to_i(); + if ($truthy($rb_lt(include_depth_default, 0))) { + include_depth_default = 0}; + self.maxdepth = $hash2(["abs", "rel"], {"abs": include_depth_default, "rel": include_depth_default}); + self.include_stack = []; + self.includes = document.$catalog()['$[]']("includes"); + self.skipping = false; + self.conditional_stack = []; + return (self.include_processor_extensions = nil); + }, TMP_PreprocessorReader_initialize_43.$$arity = -2); + + Opal.def(self, '$prepare_lines', TMP_PreprocessorReader_prepare_lines_44 = function $$prepare_lines(data, opts) { + var $a, $b, $iter = TMP_PreprocessorReader_prepare_lines_44.$$p, $yield = $iter || nil, self = this, result = nil, front_matter = nil, $writer = nil, first = nil, last = nil, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_PreprocessorReader_prepare_lines_44.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + + + if (opts == null) { + opts = $hash2([], {}); + }; + result = $send(self, Opal.find_super_dispatcher(self, 'prepare_lines', TMP_PreprocessorReader_prepare_lines_44, false), $zuper, $iter); + if ($truthy(($truthy($a = self.document) ? self.document.$attributes()['$[]']("skip-front-matter") : $a))) { + if ($truthy((front_matter = self['$skip_front_matter!'](result)))) { + + $writer = ["front-matter", front_matter.$join($$($nesting, 'LF'))]; + $send(self.document.$attributes(), '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}}; + if ($truthy(opts.$fetch("condense", true))) { + + while ($truthy(($truthy($b = (first = result['$[]'](0))) ? first['$empty?']() : $b))) { + ($truthy($b = result.$shift()) ? (self.lineno = $rb_plus(self.lineno, 1)) : $b) + }; + while ($truthy(($truthy($b = (last = result['$[]'](-1))) ? last['$empty?']() : $b))) { + result.$pop() + };}; + if ($truthy(opts['$[]']("indent"))) { + $$($nesting, 'Parser')['$adjust_indentation!'](result, opts['$[]']("indent"), self.document.$attr("tabsize"))}; + return result; + }, TMP_PreprocessorReader_prepare_lines_44.$$arity = -2); + + Opal.def(self, '$process_line', TMP_PreprocessorReader_process_line_45 = function $$process_line(line) { + var $a, $b, self = this; + + + if ($truthy(self.process_lines)) { + } else { + return line + }; + if ($truthy(line['$empty?']())) { + + self.look_ahead = $rb_plus(self.look_ahead, 1); + return line;}; + if ($truthy(($truthy($a = ($truthy($b = line['$end_with?']("]")) ? line['$start_with?']("[")['$!']() : $b)) ? line['$include?']("::") : $a))) { + if ($truthy(($truthy($a = line['$include?']("if")) ? $$($nesting, 'ConditionalDirectiveRx')['$=~'](line) : $a))) { + if ((($a = $gvars['~']) === nil ? nil : $a['$[]'](1))['$==']("\\")) { + + self.unescape_next_line = true; + self.look_ahead = $rb_plus(self.look_ahead, 1); + return line.$slice(1, line.$length()); + } else if ($truthy(self.$preprocess_conditional_directive((($a = $gvars['~']) === nil ? nil : $a['$[]'](2)), (($a = $gvars['~']) === nil ? nil : $a['$[]'](3)), (($a = $gvars['~']) === nil ? nil : $a['$[]'](4)), (($a = $gvars['~']) === nil ? nil : $a['$[]'](5))))) { + + self.$shift(); + return nil; + } else { + + self.look_ahead = $rb_plus(self.look_ahead, 1); + return line; + } + } else if ($truthy(self.skipping)) { + + self.$shift(); + return nil; + } else if ($truthy(($truthy($a = line['$start_with?']("inc", "\\inc")) ? $$($nesting, 'IncludeDirectiveRx')['$=~'](line) : $a))) { + if ((($a = $gvars['~']) === nil ? nil : $a['$[]'](1))['$==']("\\")) { + + self.unescape_next_line = true; + self.look_ahead = $rb_plus(self.look_ahead, 1); + return line.$slice(1, line.$length()); + } else if ($truthy(self.$preprocess_include_directive((($a = $gvars['~']) === nil ? nil : $a['$[]'](2)), (($a = $gvars['~']) === nil ? nil : $a['$[]'](3))))) { + return nil + } else { + + self.look_ahead = $rb_plus(self.look_ahead, 1); + return line; + } + } else { + + self.look_ahead = $rb_plus(self.look_ahead, 1); + return line; + } + } else if ($truthy(self.skipping)) { + + self.$shift(); + return nil; + } else { + + self.look_ahead = $rb_plus(self.look_ahead, 1); + return line; + }; + }, TMP_PreprocessorReader_process_line_45.$$arity = 1); + + Opal.def(self, '$has_more_lines?', TMP_PreprocessorReader_has_more_lines$q_46 = function() { + var self = this; + + if ($truthy(self.$peek_line())) { + return true + } else { + return false + } + }, TMP_PreprocessorReader_has_more_lines$q_46.$$arity = 0); + + Opal.def(self, '$empty?', TMP_PreprocessorReader_empty$q_47 = function() { + var self = this; + + if ($truthy(self.$peek_line())) { + return false + } else { + return true + } + }, TMP_PreprocessorReader_empty$q_47.$$arity = 0); + Opal.alias(self, "eof?", "empty?"); + + Opal.def(self, '$peek_line', TMP_PreprocessorReader_peek_line_48 = function $$peek_line(direct) { + var $iter = TMP_PreprocessorReader_peek_line_48.$$p, $yield = $iter || nil, self = this, line = nil, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_PreprocessorReader_peek_line_48.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + + + if (direct == null) { + direct = false; + }; + if ($truthy((line = $send(self, Opal.find_super_dispatcher(self, 'peek_line', TMP_PreprocessorReader_peek_line_48, false), $zuper, $iter)))) { + return line + } else if ($truthy(self.include_stack['$empty?']())) { + return nil + } else { + + self.$pop_include(); + return self.$peek_line(direct); + }; + }, TMP_PreprocessorReader_peek_line_48.$$arity = -1); + + Opal.def(self, '$preprocess_conditional_directive', TMP_PreprocessorReader_preprocess_conditional_directive_49 = function $$preprocess_conditional_directive(keyword, target, delimiter, text) { + var $a, $b, $c, TMP_50, TMP_51, TMP_52, TMP_53, self = this, no_target = nil, pair = nil, skip = nil, $case = nil, lhs = nil, op = nil, rhs = nil; + + + if ($truthy((no_target = target['$empty?']()))) { + } else { + target = target.$downcase() + }; + if ($truthy(($truthy($a = ($truthy($b = no_target) ? ($truthy($c = keyword['$==']("ifdef")) ? $c : keyword['$==']("ifndef")) : $b)) ? $a : ($truthy($b = text) ? keyword['$==']("endif") : $b)))) { + return false}; + if (keyword['$==']("endif")) { + + if ($truthy(self.conditional_stack['$empty?']())) { + self.$logger().$error(self.$message_with_context("" + "unmatched macro: endif::" + (target) + "[]", $hash2(["source_location"], {"source_location": self.$cursor()}))) + } else if ($truthy(($truthy($a = no_target) ? $a : target['$==']((pair = self.conditional_stack['$[]'](-1))['$[]']("target"))))) { + + self.conditional_stack.$pop(); + self.skipping = (function() {if ($truthy(self.conditional_stack['$empty?']())) { + return false + } else { + return self.conditional_stack['$[]'](-1)['$[]']("skipping") + }; return nil; })(); + } else { + self.$logger().$error(self.$message_with_context("" + "mismatched macro: endif::" + (target) + "[], expected endif::" + (pair['$[]']("target")) + "[]", $hash2(["source_location"], {"source_location": self.$cursor()}))) + }; + return true;}; + if ($truthy(self.skipping)) { + skip = false + } else { + $case = keyword; + if ("ifdef"['$===']($case)) {$case = delimiter; + if (","['$===']($case)) {skip = $send(target.$split(",", -1), 'none?', [], (TMP_50 = function(name){var self = TMP_50.$$s || this; + if (self.document == null) self.document = nil; + + + + if (name == null) { + name = nil; + }; + return self.document.$attributes()['$key?'](name);}, TMP_50.$$s = self, TMP_50.$$arity = 1, TMP_50))} + else if ("+"['$===']($case)) {skip = $send(target.$split("+", -1), 'any?', [], (TMP_51 = function(name){var self = TMP_51.$$s || this; + if (self.document == null) self.document = nil; + + + + if (name == null) { + name = nil; + }; + return self.document.$attributes()['$key?'](name)['$!']();}, TMP_51.$$s = self, TMP_51.$$arity = 1, TMP_51))} + else {skip = self.document.$attributes()['$key?'](target)['$!']()}} + else if ("ifndef"['$===']($case)) {$case = delimiter; + if (","['$===']($case)) {skip = $send(target.$split(",", -1), 'any?', [], (TMP_52 = function(name){var self = TMP_52.$$s || this; + if (self.document == null) self.document = nil; + + + + if (name == null) { + name = nil; + }; + return self.document.$attributes()['$key?'](name);}, TMP_52.$$s = self, TMP_52.$$arity = 1, TMP_52))} + else if ("+"['$===']($case)) {skip = $send(target.$split("+", -1), 'all?', [], (TMP_53 = function(name){var self = TMP_53.$$s || this; + if (self.document == null) self.document = nil; + + + + if (name == null) { + name = nil; + }; + return self.document.$attributes()['$key?'](name);}, TMP_53.$$s = self, TMP_53.$$arity = 1, TMP_53))} + else {skip = self.document.$attributes()['$key?'](target)}} + else if ("ifeval"['$===']($case)) { + if ($truthy(($truthy($a = no_target) ? $$($nesting, 'EvalExpressionRx')['$=~'](text.$strip()) : $a))) { + } else { + return false + }; + $a = [(($b = $gvars['~']) === nil ? nil : $b['$[]'](1)), (($b = $gvars['~']) === nil ? nil : $b['$[]'](2)), (($b = $gvars['~']) === nil ? nil : $b['$[]'](3))], (lhs = $a[0]), (op = $a[1]), (rhs = $a[2]), $a; + lhs = self.$resolve_expr_val(lhs); + rhs = self.$resolve_expr_val(rhs); + if (op['$==']("!=")) { + skip = lhs.$send("==", rhs) + } else { + skip = lhs.$send(op.$to_sym(), rhs)['$!']() + };} + }; + if ($truthy(($truthy($a = keyword['$==']("ifeval")) ? $a : text['$!']()))) { + + if ($truthy(skip)) { + self.skipping = true}; + self.conditional_stack['$<<']($hash2(["target", "skip", "skipping"], {"target": target, "skip": skip, "skipping": self.skipping})); + } else if ($truthy(($truthy($a = self.skipping) ? $a : skip))) { + } else { + + self.$replace_next_line(text.$rstrip()); + self.$unshift(""); + if ($truthy(text['$start_with?']("include::"))) { + self.look_ahead = $rb_minus(self.look_ahead, 1)}; + }; + return true; + }, TMP_PreprocessorReader_preprocess_conditional_directive_49.$$arity = 4); + + Opal.def(self, '$preprocess_include_directive', TMP_PreprocessorReader_preprocess_include_directive_54 = function $$preprocess_include_directive(target, attrlist) { + var $a, TMP_55, $b, TMP_56, TMP_57, TMP_58, TMP_60, TMP_63, TMP_64, TMP_65, self = this, doc = nil, expanded_target = nil, ext = nil, abs_maxdepth = nil, parsed_attrs = nil, inc_path = nil, target_type = nil, relpath = nil, inc_linenos = nil, inc_tags = nil, tag = nil, inc_lines = nil, inc_offset = nil, inc_lineno = nil, $writer = nil, tag_stack = nil, tags_used = nil, active_tag = nil, select = nil, base_select = nil, wildcard = nil, missing_tags = nil, inc_content = nil; + + + doc = self.document; + if ($truthy(($truthy($a = (expanded_target = target)['$include?']($$($nesting, 'ATTR_REF_HEAD'))) ? (expanded_target = doc.$sub_attributes(target, $hash2(["attribute_missing"], {"attribute_missing": "drop-line"})))['$empty?']() : $a))) { + + self.$shift(); + if (($truthy($a = doc.$attributes()['$[]']("attribute-missing")) ? $a : $$($nesting, 'Compliance').$attribute_missing())['$==']("skip")) { + self.$unshift("" + "Unresolved directive in " + (self.path) + " - include::" + (target) + "[" + (attrlist) + "]")}; + return true; + } else if ($truthy(($truthy($a = self['$include_processors?']()) ? (ext = $send(self.include_processor_extensions, 'find', [], (TMP_55 = function(candidate){var self = TMP_55.$$s || this; + + + + if (candidate == null) { + candidate = nil; + }; + return candidate.$instance()['$handles?'](expanded_target);}, TMP_55.$$s = self, TMP_55.$$arity = 1, TMP_55))) : $a))) { + + self.$shift(); + ext.$process_method()['$[]'](doc, self, expanded_target, doc.$parse_attributes(attrlist, [], $hash2(["sub_input"], {"sub_input": true}))); + return true; + } else if ($truthy($rb_ge(doc.$safe(), $$$($$($nesting, 'SafeMode'), 'SECURE')))) { + return self.$replace_next_line("" + "link:" + (expanded_target) + "[]") + } else if ($truthy($rb_gt((abs_maxdepth = self.maxdepth['$[]']("abs")), 0))) { + + if ($truthy($rb_ge(self.include_stack.$size(), abs_maxdepth))) { + + self.$logger().$error(self.$message_with_context("" + "maximum include depth of " + (self.maxdepth['$[]']("rel")) + " exceeded", $hash2(["source_location"], {"source_location": self.$cursor()}))); + return nil;}; + parsed_attrs = doc.$parse_attributes(attrlist, [], $hash2(["sub_input"], {"sub_input": true})); + $b = self.$resolve_include_path(expanded_target, attrlist, parsed_attrs), $a = Opal.to_ary($b), (inc_path = ($a[0] == null ? nil : $a[0])), (target_type = ($a[1] == null ? nil : $a[1])), (relpath = ($a[2] == null ? nil : $a[2])), $b; + if ($truthy(target_type)) { + } else { + return inc_path + }; + inc_linenos = (inc_tags = nil); + if ($truthy(attrlist)) { + if ($truthy(parsed_attrs['$key?']("lines"))) { + + inc_linenos = []; + $send(self.$split_delimited_value(parsed_attrs['$[]']("lines")), 'each', [], (TMP_56 = function(linedef){var self = TMP_56.$$s || this, $c, $d, from = nil, to = nil; + + + + if (linedef == null) { + linedef = nil; + }; + if ($truthy(linedef['$include?'](".."))) { + + $d = linedef.$split("..", 2), $c = Opal.to_ary($d), (from = ($c[0] == null ? nil : $c[0])), (to = ($c[1] == null ? nil : $c[1])), $d; + return (inc_linenos = $rb_plus(inc_linenos, (function() {if ($truthy(($truthy($c = to['$empty?']()) ? $c : $rb_lt((to = to.$to_i()), 0)))) { + return [from.$to_i(), $rb_divide(1, 0)] + } else { + return $$$('::', 'Range').$new(from.$to_i(), to).$to_a() + }; return nil; })())); + } else { + return inc_linenos['$<<'](linedef.$to_i()) + };}, TMP_56.$$s = self, TMP_56.$$arity = 1, TMP_56)); + inc_linenos = (function() {if ($truthy(inc_linenos['$empty?']())) { + return nil + } else { + return inc_linenos.$sort().$uniq() + }; return nil; })(); + } else if ($truthy(parsed_attrs['$key?']("tag"))) { + if ($truthy(($truthy($a = (tag = parsed_attrs['$[]']("tag"))['$empty?']()) ? $a : tag['$==']("!")))) { + } else { + inc_tags = (function() {if ($truthy(tag['$start_with?']("!"))) { + return $hash(tag.$slice(1, tag.$length()), false) + } else { + return $hash(tag, true) + }; return nil; })() + } + } else if ($truthy(parsed_attrs['$key?']("tags"))) { + + inc_tags = $hash2([], {}); + $send(self.$split_delimited_value(parsed_attrs['$[]']("tags")), 'each', [], (TMP_57 = function(tagdef){var self = TMP_57.$$s || this, $c, $writer = nil; + + + + if (tagdef == null) { + tagdef = nil; + }; + if ($truthy(($truthy($c = tagdef['$empty?']()) ? $c : tagdef['$==']("!")))) { + return nil + } else if ($truthy(tagdef['$start_with?']("!"))) { + + $writer = [tagdef.$slice(1, tagdef.$length()), false]; + $send(inc_tags, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + } else { + + $writer = [tagdef, true]; + $send(inc_tags, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + };}, TMP_57.$$s = self, TMP_57.$$arity = 1, TMP_57)); + if ($truthy(inc_tags['$empty?']())) { + inc_tags = nil};}}; + if ($truthy(inc_linenos)) { + + $a = [[], nil, 0], (inc_lines = $a[0]), (inc_offset = $a[1]), (inc_lineno = $a[2]), $a; + + try { + (function(){var $brk = Opal.new_brk(); try {return $send(self, 'open', [inc_path, "rb"], (TMP_58 = function(f){var self = TMP_58.$$s || this, TMP_59, select_remaining = nil; + + + + if (f == null) { + f = nil; + }; + select_remaining = nil; + return (function(){var $brk = Opal.new_brk(); try {return $send(f, 'each_line', [], (TMP_59 = function(l){var self = TMP_59.$$s || this, $c, $d, select = nil; + + + + if (l == null) { + l = nil; + }; + inc_lineno = $rb_plus(inc_lineno, 1); + if ($truthy(($truthy($c = select_remaining) ? $c : ($truthy($d = $$$('::', 'Float')['$===']((select = inc_linenos['$[]'](0)))) ? (select_remaining = select['$infinite?']()) : $d)))) { + + inc_offset = ($truthy($c = inc_offset) ? $c : inc_lineno); + return inc_lines['$<<'](l); + } else { + + if (select['$=='](inc_lineno)) { + + inc_offset = ($truthy($c = inc_offset) ? $c : inc_lineno); + inc_lines['$<<'](l); + inc_linenos.$shift();}; + if ($truthy(inc_linenos['$empty?']())) { + + Opal.brk(nil, $brk) + } else { + return nil + }; + };}, TMP_59.$$s = self, TMP_59.$$brk = $brk, TMP_59.$$arity = 1, TMP_59)) + } catch (err) { if (err === $brk) { return err.$v } else { throw err } }})();}, TMP_58.$$s = self, TMP_58.$$brk = $brk, TMP_58.$$arity = 1, TMP_58)) + } catch (err) { if (err === $brk) { return err.$v } else { throw err } }})() + } catch ($err) { + if (Opal.rescue($err, [$$($nesting, 'StandardError')])) { + try { + + self.$logger().$error(self.$message_with_context("" + "include " + (target_type) + " not readable: " + (inc_path), $hash2(["source_location"], {"source_location": self.$cursor()}))); + return self.$replace_next_line("" + "Unresolved directive in " + (self.path) + " - include::" + (expanded_target) + "[" + (attrlist) + "]"); + } finally { Opal.pop_exception() } + } else { throw $err; } + };; + self.$shift(); + if ($truthy(inc_offset)) { + + + $writer = ["partial-option", true]; + $send(parsed_attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + self.$push_include(inc_lines, inc_path, relpath, inc_offset, parsed_attrs);}; + } else if ($truthy(inc_tags)) { + + $a = [[], nil, 0, [], $$$('::', 'Set').$new(), nil], (inc_lines = $a[0]), (inc_offset = $a[1]), (inc_lineno = $a[2]), (tag_stack = $a[3]), (tags_used = $a[4]), (active_tag = $a[5]), $a; + if ($truthy(inc_tags['$key?']("**"))) { + if ($truthy(inc_tags['$key?']("*"))) { + + select = (base_select = inc_tags.$delete("**")); + wildcard = inc_tags.$delete("*"); + } else { + select = (base_select = (wildcard = inc_tags.$delete("**"))) + } + } else { + + select = (base_select = inc_tags['$value?'](true)['$!']()); + wildcard = inc_tags.$delete("*"); + }; + + try { + $send(self, 'open', [inc_path, "rb"], (TMP_60 = function(f){var self = TMP_60.$$s || this, $c, TMP_61, dbl_co = nil, dbl_sb = nil, encoding = nil; + + + + if (f == null) { + f = nil; + }; + $c = ["::", "[]"], (dbl_co = $c[0]), (dbl_sb = $c[1]), $c; + if ($truthy($$($nesting, 'COERCE_ENCODING'))) { + encoding = $$$($$$('::', 'Encoding'), 'UTF_8')}; + return $send(f, 'each_line', [], (TMP_61 = function(l){var self = TMP_61.$$s || this, $d, $e, TMP_62, this_tag = nil, include_cursor = nil, idx = nil; + + + + if (l == null) { + l = nil; + }; + inc_lineno = $rb_plus(inc_lineno, 1); + if ($truthy(encoding)) { + l.$force_encoding(encoding)}; + if ($truthy(($truthy($d = ($truthy($e = l['$include?'](dbl_co)) ? l['$include?'](dbl_sb) : $e)) ? $$($nesting, 'TagDirectiveRx')['$=~'](l) : $d))) { + if ($truthy((($d = $gvars['~']) === nil ? nil : $d['$[]'](1)))) { + if ((this_tag = (($d = $gvars['~']) === nil ? nil : $d['$[]'](2)))['$=='](active_tag)) { + + tag_stack.$pop(); + return $e = (function() {if ($truthy(tag_stack['$empty?']())) { + return [nil, base_select] + } else { + return tag_stack['$[]'](-1) + }; return nil; })(), $d = Opal.to_ary($e), (active_tag = ($d[0] == null ? nil : $d[0])), (select = ($d[1] == null ? nil : $d[1])), $e; + } else if ($truthy(inc_tags['$key?'](this_tag))) { + + include_cursor = self.$create_include_cursor(inc_path, expanded_target, inc_lineno); + if ($truthy((idx = $send(tag_stack, 'rindex', [], (TMP_62 = function(key, _){var self = TMP_62.$$s || this; + + + + if (key == null) { + key = nil; + }; + + if (_ == null) { + _ = nil; + }; + return key['$=='](this_tag);}, TMP_62.$$s = self, TMP_62.$$arity = 2, TMP_62))))) { + + if (idx['$=='](0)) { + tag_stack.$shift() + } else { + + tag_stack.$delete_at(idx); + }; + return self.$logger().$warn(self.$message_with_context("" + "mismatched end tag (expected '" + (active_tag) + "' but found '" + (this_tag) + "') at line " + (inc_lineno) + " of include " + (target_type) + ": " + (inc_path), $hash2(["source_location", "include_location"], {"source_location": self.$cursor(), "include_location": include_cursor}))); + } else { + return self.$logger().$warn(self.$message_with_context("" + "unexpected end tag '" + (this_tag) + "' at line " + (inc_lineno) + " of include " + (target_type) + ": " + (inc_path), $hash2(["source_location", "include_location"], {"source_location": self.$cursor(), "include_location": include_cursor}))) + }; + } else { + return nil + } + } else if ($truthy(inc_tags['$key?']((this_tag = (($d = $gvars['~']) === nil ? nil : $d['$[]'](2)))))) { + + tags_used['$<<'](this_tag); + return tag_stack['$<<']([(active_tag = this_tag), (select = inc_tags['$[]'](this_tag)), inc_lineno]); + } else if ($truthy(wildcard['$nil?']()['$!']())) { + + select = (function() {if ($truthy(($truthy($d = active_tag) ? select['$!']() : $d))) { + return false + } else { + return wildcard + }; return nil; })(); + return tag_stack['$<<']([(active_tag = this_tag), select, inc_lineno]); + } else { + return nil + } + } else if ($truthy(select)) { + + inc_offset = ($truthy($d = inc_offset) ? $d : inc_lineno); + return inc_lines['$<<'](l); + } else { + return nil + };}, TMP_61.$$s = self, TMP_61.$$arity = 1, TMP_61));}, TMP_60.$$s = self, TMP_60.$$arity = 1, TMP_60)) + } catch ($err) { + if (Opal.rescue($err, [$$($nesting, 'StandardError')])) { + try { + + self.$logger().$error(self.$message_with_context("" + "include " + (target_type) + " not readable: " + (inc_path), $hash2(["source_location"], {"source_location": self.$cursor()}))); + return self.$replace_next_line("" + "Unresolved directive in " + (self.path) + " - include::" + (expanded_target) + "[" + (attrlist) + "]"); + } finally { Opal.pop_exception() } + } else { throw $err; } + };; + if ($truthy(tag_stack['$empty?']())) { + } else { + $send(tag_stack, 'each', [], (TMP_63 = function(tag_name, _, tag_lineno){var self = TMP_63.$$s || this; + + + + if (tag_name == null) { + tag_name = nil; + }; + + if (_ == null) { + _ = nil; + }; + + if (tag_lineno == null) { + tag_lineno = nil; + }; + return self.$logger().$warn(self.$message_with_context("" + "detected unclosed tag '" + (tag_name) + "' starting at line " + (tag_lineno) + " of include " + (target_type) + ": " + (inc_path), $hash2(["source_location", "include_location"], {"source_location": self.$cursor(), "include_location": self.$create_include_cursor(inc_path, expanded_target, tag_lineno)})));}, TMP_63.$$s = self, TMP_63.$$arity = 3, TMP_63)) + }; + if ($truthy((missing_tags = $rb_minus(inc_tags.$keys().$to_a(), tags_used.$to_a()))['$empty?']())) { + } else { + self.$logger().$warn(self.$message_with_context("" + "tag" + ((function() {if ($truthy($rb_gt(missing_tags.$size(), 1))) { + return "s" + } else { + return "" + }; return nil; })()) + " '" + (missing_tags.$join(", ")) + "' not found in include " + (target_type) + ": " + (inc_path), $hash2(["source_location"], {"source_location": self.$cursor()}))) + }; + self.$shift(); + if ($truthy(inc_offset)) { + + if ($truthy(($truthy($a = ($truthy($b = base_select) ? wildcard : $b)) ? inc_tags['$empty?']() : $a))) { + } else { + + $writer = ["partial-option", true]; + $send(parsed_attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + self.$push_include(inc_lines, inc_path, relpath, inc_offset, parsed_attrs);}; + } else { + + try { + + inc_content = (function() {if (false) { + return $send($$$('::', 'File'), 'open', [inc_path, "rb"], (TMP_64 = function(f){var self = TMP_64.$$s || this; + + + + if (f == null) { + f = nil; + }; + return f.$read();}, TMP_64.$$s = self, TMP_64.$$arity = 1, TMP_64)) + } else { + return $send(self, 'open', [inc_path, "rb"], (TMP_65 = function(f){var self = TMP_65.$$s || this; + + + + if (f == null) { + f = nil; + }; + return f.$read();}, TMP_65.$$s = self, TMP_65.$$arity = 1, TMP_65)) + }; return nil; })(); + self.$shift(); + self.$push_include(inc_content, inc_path, relpath, 1, parsed_attrs); + } catch ($err) { + if (Opal.rescue($err, [$$($nesting, 'StandardError')])) { + try { + + self.$logger().$error(self.$message_with_context("" + "include " + (target_type) + " not readable: " + (inc_path), $hash2(["source_location"], {"source_location": self.$cursor()}))); + return self.$replace_next_line("" + "Unresolved directive in " + (self.path) + " - include::" + (expanded_target) + "[" + (attrlist) + "]"); + } finally { Opal.pop_exception() } + } else { throw $err; } + }; + }; + return true; + } else { + return nil + }; + }, TMP_PreprocessorReader_preprocess_include_directive_54.$$arity = 2); + + Opal.def(self, '$resolve_include_path', TMP_PreprocessorReader_resolve_include_path_66 = function $$resolve_include_path(target, attrlist, attributes) { + var $a, $b, self = this, doc = nil, inc_path = nil, relpath = nil; + + + doc = self.document; + if ($truthy(($truthy($a = $$($nesting, 'Helpers')['$uriish?'](target)) ? $a : (function() {if ($truthy($$$('::', 'String')['$==='](self.dir))) { + return nil + } else { + + return (target = "" + (self.dir) + "/" + (target)); + }; return nil; })()))) { + + if ($truthy(doc['$attr?']("allow-uri-read"))) { + } else { + return self.$replace_next_line("" + "link:" + (target) + "[" + (attrlist) + "]") + }; + if ($truthy(doc['$attr?']("cache-uri"))) { + if ($truthy((($b = $$$('::', 'OpenURI', 'skip_raise')) && ($a = $$$($b, 'Cache', 'skip_raise')) ? 'constant' : nil))) { + } else { + $$($nesting, 'Helpers').$require_library("open-uri/cached", "open-uri-cached") + } + } else if ($truthy($$$('::', 'RUBY_ENGINE_OPAL')['$!']())) { + $$$('::', 'OpenURI')}; + return [$$$('::', 'URI').$parse(target), "uri", target]; + } else { + + inc_path = doc.$normalize_system_path(target, self.dir, nil, $hash2(["target_name"], {"target_name": "include file"})); + if ($truthy($$$('::', 'File')['$file?'](inc_path))) { + } else if ($truthy(attributes['$key?']("optional-option"))) { + + self.$shift(); + return true; + } else { + + self.$logger().$error(self.$message_with_context("" + "include file not found: " + (inc_path), $hash2(["source_location"], {"source_location": self.$cursor()}))); + return self.$replace_next_line("" + "Unresolved directive in " + (self.path) + " - include::" + (target) + "[" + (attrlist) + "]"); + }; + relpath = doc.$path_resolver().$relative_path(inc_path, doc.$base_dir()); + return [inc_path, "file", relpath]; + }; + }, TMP_PreprocessorReader_resolve_include_path_66.$$arity = 3); + + Opal.def(self, '$push_include', TMP_PreprocessorReader_push_include_67 = function $$push_include(data, file, path, lineno, attributes) { + var $a, self = this, $writer = nil, dir = nil, depth = nil, old_leveloffset = nil; + + + + if (file == null) { + file = nil; + }; + + if (path == null) { + path = nil; + }; + + if (lineno == null) { + lineno = 1; + }; + + if (attributes == null) { + attributes = $hash2([], {}); + }; + self.include_stack['$<<']([self.lines, self.file, self.dir, self.path, self.lineno, self.maxdepth, self.process_lines]); + if ($truthy((self.file = file))) { + + if ($truthy($$$('::', 'String')['$==='](file))) { + self.dir = $$$('::', 'File').$dirname(file) + } else if ($truthy($$$('::', 'RUBY_ENGINE_OPAL'))) { + self.dir = $$$('::', 'URI').$parse($$$('::', 'File').$dirname((file = file.$to_s()))) + } else { + + + $writer = [(function() {if ((dir = $$$('::', 'File').$dirname(file.$path()))['$==']("/")) { + return "" + } else { + return dir + }; return nil; })()]; + $send((self.dir = file.$dup()), 'path=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + file = file.$to_s(); + }; + path = ($truthy($a = path) ? $a : $$$('::', 'File').$basename(file)); + self.process_lines = $$($nesting, 'ASCIIDOC_EXTENSIONS')['$[]']($$$('::', 'File').$extname(file)); + } else { + + self.dir = "."; + self.process_lines = true; + }; + if ($truthy(path)) { + + self.path = path; + if ($truthy(self.process_lines)) { + + $writer = [$$($nesting, 'Helpers').$rootname(path), (function() {if ($truthy(attributes['$[]']("partial-option"))) { + return nil + } else { + return true + }; return nil; })()]; + $send(self.includes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + } else { + self.path = "" + }; + self.lineno = lineno; + if ($truthy(attributes['$key?']("depth"))) { + + depth = attributes['$[]']("depth").$to_i(); + if ($truthy($rb_le(depth, 0))) { + depth = 1}; + self.maxdepth = $hash2(["abs", "rel"], {"abs": $rb_plus($rb_minus(self.include_stack.$size(), 1), depth), "rel": depth});}; + if ($truthy((self.lines = self.$prepare_lines(data, $hash2(["normalize", "condense", "indent"], {"normalize": true, "condense": false, "indent": attributes['$[]']("indent")})))['$empty?']())) { + self.$pop_include() + } else { + + if ($truthy(attributes['$key?']("leveloffset"))) { + + self.lines.$unshift(""); + self.lines.$unshift("" + ":leveloffset: " + (attributes['$[]']("leveloffset"))); + self.lines['$<<'](""); + if ($truthy((old_leveloffset = self.document.$attr("leveloffset")))) { + self.lines['$<<']("" + ":leveloffset: " + (old_leveloffset)) + } else { + self.lines['$<<'](":leveloffset!:") + }; + self.lineno = $rb_minus(self.lineno, 2);}; + self.look_ahead = 0; + }; + return self; + }, TMP_PreprocessorReader_push_include_67.$$arity = -2); + + Opal.def(self, '$create_include_cursor', TMP_PreprocessorReader_create_include_cursor_68 = function $$create_include_cursor(file, path, lineno) { + var self = this, dir = nil; + + + if ($truthy($$$('::', 'String')['$==='](file))) { + dir = $$$('::', 'File').$dirname(file) + } else if ($truthy($$$('::', 'RUBY_ENGINE_OPAL'))) { + dir = $$$('::', 'File').$dirname((file = file.$to_s())) + } else { + + dir = (function() {if ((dir = $$$('::', 'File').$dirname(file.$path()))['$==']("")) { + return "/" + } else { + return dir + }; return nil; })(); + file = file.$to_s(); + }; + return $$($nesting, 'Cursor').$new(file, dir, path, lineno); + }, TMP_PreprocessorReader_create_include_cursor_68.$$arity = 3); + + Opal.def(self, '$pop_include', TMP_PreprocessorReader_pop_include_69 = function $$pop_include() { + var $a, $b, self = this; + + if ($truthy($rb_gt(self.include_stack.$size(), 0))) { + + $b = self.include_stack.$pop(), $a = Opal.to_ary($b), (self.lines = ($a[0] == null ? nil : $a[0])), (self.file = ($a[1] == null ? nil : $a[1])), (self.dir = ($a[2] == null ? nil : $a[2])), (self.path = ($a[3] == null ? nil : $a[3])), (self.lineno = ($a[4] == null ? nil : $a[4])), (self.maxdepth = ($a[5] == null ? nil : $a[5])), (self.process_lines = ($a[6] == null ? nil : $a[6])), $b; + self.look_ahead = 0; + return nil; + } else { + return nil + } + }, TMP_PreprocessorReader_pop_include_69.$$arity = 0); + + Opal.def(self, '$include_depth', TMP_PreprocessorReader_include_depth_70 = function $$include_depth() { + var self = this; + + return self.include_stack.$size() + }, TMP_PreprocessorReader_include_depth_70.$$arity = 0); + + Opal.def(self, '$exceeded_max_depth?', TMP_PreprocessorReader_exceeded_max_depth$q_71 = function() { + var $a, self = this, abs_maxdepth = nil; + + if ($truthy(($truthy($a = $rb_gt((abs_maxdepth = self.maxdepth['$[]']("abs")), 0)) ? $rb_ge(self.include_stack.$size(), abs_maxdepth) : $a))) { + return self.maxdepth['$[]']("rel") + } else { + return false + } + }, TMP_PreprocessorReader_exceeded_max_depth$q_71.$$arity = 0); + + Opal.def(self, '$shift', TMP_PreprocessorReader_shift_72 = function $$shift() { + var $iter = TMP_PreprocessorReader_shift_72.$$p, $yield = $iter || nil, self = this, line = nil, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_PreprocessorReader_shift_72.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + if ($truthy(self.unescape_next_line)) { + + self.unescape_next_line = false; + return (line = $send(self, Opal.find_super_dispatcher(self, 'shift', TMP_PreprocessorReader_shift_72, false), $zuper, $iter)).$slice(1, line.$length()); + } else { + return $send(self, Opal.find_super_dispatcher(self, 'shift', TMP_PreprocessorReader_shift_72, false), $zuper, $iter) + } + }, TMP_PreprocessorReader_shift_72.$$arity = 0); + + Opal.def(self, '$split_delimited_value', TMP_PreprocessorReader_split_delimited_value_73 = function $$split_delimited_value(val) { + var self = this; + + if ($truthy(val['$include?'](","))) { + + return val.$split(","); + } else { + + return val.$split(";"); + } + }, TMP_PreprocessorReader_split_delimited_value_73.$$arity = 1); + + Opal.def(self, '$skip_front_matter!', TMP_PreprocessorReader_skip_front_matter$B_74 = function(data, increment_linenos) { + var $a, $b, self = this, front_matter = nil, original_data = nil; + + + + if (increment_linenos == null) { + increment_linenos = true; + }; + front_matter = nil; + if (data['$[]'](0)['$==']("---")) { + + original_data = data.$drop(0); + data.$shift(); + front_matter = []; + if ($truthy(increment_linenos)) { + self.lineno = $rb_plus(self.lineno, 1)}; + while ($truthy(($truthy($b = data['$empty?']()['$!']()) ? data['$[]'](0)['$!=']("---") : $b))) { + + front_matter['$<<'](data.$shift()); + if ($truthy(increment_linenos)) { + self.lineno = $rb_plus(self.lineno, 1)}; + }; + if ($truthy(data['$empty?']())) { + + $send(data, 'unshift', Opal.to_a(original_data)); + if ($truthy(increment_linenos)) { + self.lineno = 0}; + front_matter = nil; + } else { + + data.$shift(); + if ($truthy(increment_linenos)) { + self.lineno = $rb_plus(self.lineno, 1)}; + };}; + return front_matter; + }, TMP_PreprocessorReader_skip_front_matter$B_74.$$arity = -2); + + Opal.def(self, '$resolve_expr_val', TMP_PreprocessorReader_resolve_expr_val_75 = function $$resolve_expr_val(val) { + var $a, $b, self = this, quoted = nil; + + + if ($truthy(($truthy($a = ($truthy($b = val['$start_with?']("\"")) ? val['$end_with?']("\"") : $b)) ? $a : ($truthy($b = val['$start_with?']("'")) ? val['$end_with?']("'") : $b)))) { + + quoted = true; + val = val.$slice(1, $rb_minus(val.$length(), 1)); + } else { + quoted = false + }; + if ($truthy(val['$include?']($$($nesting, 'ATTR_REF_HEAD')))) { + val = self.document.$sub_attributes(val, $hash2(["attribute_missing"], {"attribute_missing": "drop"}))}; + if ($truthy(quoted)) { + return val + } else if ($truthy(val['$empty?']())) { + return nil + } else if (val['$==']("true")) { + return true + } else if (val['$==']("false")) { + return false + } else if ($truthy(val.$rstrip()['$empty?']())) { + return " " + } else if ($truthy(val['$include?']("."))) { + return val.$to_f() + } else { + return val.$to_i() + }; + }, TMP_PreprocessorReader_resolve_expr_val_75.$$arity = 1); + + Opal.def(self, '$include_processors?', TMP_PreprocessorReader_include_processors$q_76 = function() { + var $a, self = this; + + if ($truthy(self.include_processor_extensions['$nil?']())) { + if ($truthy(($truthy($a = self.document['$extensions?']()) ? self.document.$extensions()['$include_processors?']() : $a))) { + return (self.include_processor_extensions = self.document.$extensions().$include_processors())['$!']()['$!']() + } else { + return (self.include_processor_extensions = false) + } + } else { + return self.include_processor_extensions['$!='](false) + } + }, TMP_PreprocessorReader_include_processors$q_76.$$arity = 0); + return (Opal.def(self, '$to_s', TMP_PreprocessorReader_to_s_77 = function $$to_s() { + var TMP_78, self = this; + + return "" + "#<" + (self.$class()) + "@" + (self.$object_id()) + " {path: " + (self.path.$inspect()) + ", line #: " + (self.lineno) + ", include depth: " + (self.include_stack.$size()) + ", include stack: [" + ($send(self.include_stack, 'map', [], (TMP_78 = function(inc){var self = TMP_78.$$s || this; + + + + if (inc == null) { + inc = nil; + }; + return inc.$to_s();}, TMP_78.$$s = self, TMP_78.$$arity = 1, TMP_78)).$join(", ")) + "]}>" + }, TMP_PreprocessorReader_to_s_77.$$arity = 0), nil) && 'to_s'; + })($nesting[0], $$($nesting, 'Reader'), $nesting); + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/section"] = function(Opal) { + function $rb_plus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); + } + function $rb_gt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); + } + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $hash2 = Opal.hash2, $send = Opal.send, $truthy = Opal.truthy; + + Opal.add_stubs(['$attr_accessor', '$attr_reader', '$===', '$+', '$level', '$special', '$generate_id', '$title', '$==', '$>', '$sectnum', '$int_to_roman', '$to_i', '$reftext', '$!', '$empty?', '$sprintf', '$sub_quotes', '$compat_mode', '$[]', '$attributes', '$context', '$assign_numeral', '$class', '$object_id', '$inspect', '$size', '$length', '$chr', '$[]=', '$-', '$gsub', '$downcase', '$delete', '$tr_s', '$end_with?', '$chop', '$start_with?', '$slice', '$key?', '$catalog', '$unique_id_start_index']); + return (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + (function($base, $super, $parent_nesting) { + function $Section(){}; + var self = $Section = $klass($base, $super, 'Section', $Section); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Section_initialize_1, TMP_Section_generate_id_2, TMP_Section_sectnum_3, TMP_Section_xreftext_4, TMP_Section_$lt$lt_5, TMP_Section_to_s_6, TMP_Section_generate_id_7; + + def.document = def.level = def.numeral = def.parent = def.numbered = def.sectname = def.title = def.blocks = nil; + + self.$attr_accessor("index"); + self.$attr_accessor("sectname"); + self.$attr_accessor("special"); + self.$attr_accessor("numbered"); + self.$attr_reader("caption"); + + Opal.def(self, '$initialize', TMP_Section_initialize_1 = function $$initialize(parent, level, numbered, opts) { + var $a, $b, $iter = TMP_Section_initialize_1.$$p, $yield = $iter || nil, self = this; + + if ($iter) TMP_Section_initialize_1.$$p = null; + + + if (parent == null) { + parent = nil; + }; + + if (level == null) { + level = nil; + }; + + if (numbered == null) { + numbered = false; + }; + + if (opts == null) { + opts = $hash2([], {}); + }; + $send(self, Opal.find_super_dispatcher(self, 'initialize', TMP_Section_initialize_1, false), [parent, "section", opts], null); + if ($truthy($$($nesting, 'Section')['$==='](parent))) { + $a = [($truthy($b = level) ? $b : $rb_plus(parent.$level(), 1)), parent.$special()], (self.level = $a[0]), (self.special = $a[1]), $a + } else { + $a = [($truthy($b = level) ? $b : 1), false], (self.level = $a[0]), (self.special = $a[1]), $a + }; + self.numbered = numbered; + return (self.index = 0); + }, TMP_Section_initialize_1.$$arity = -1); + Opal.alias(self, "name", "title"); + + Opal.def(self, '$generate_id', TMP_Section_generate_id_2 = function $$generate_id() { + var self = this; + + return $$($nesting, 'Section').$generate_id(self.$title(), self.document) + }, TMP_Section_generate_id_2.$$arity = 0); + + Opal.def(self, '$sectnum', TMP_Section_sectnum_3 = function $$sectnum(delimiter, append) { + var $a, self = this; + + + + if (delimiter == null) { + delimiter = "."; + }; + + if (append == null) { + append = nil; + }; + append = ($truthy($a = append) ? $a : (function() {if (append['$=='](false)) { + return "" + } else { + return delimiter + }; return nil; })()); + if (self.level['$=='](1)) { + return "" + (self.numeral) + (append) + } else if ($truthy($rb_gt(self.level, 1))) { + if ($truthy($$($nesting, 'Section')['$==='](self.parent))) { + return "" + (self.parent.$sectnum(delimiter, delimiter)) + (self.numeral) + (append) + } else { + return "" + (self.numeral) + (append) + } + } else { + return "" + ($$($nesting, 'Helpers').$int_to_roman(self.numeral.$to_i())) + (append) + }; + }, TMP_Section_sectnum_3.$$arity = -1); + + Opal.def(self, '$xreftext', TMP_Section_xreftext_4 = function $$xreftext(xrefstyle) { + var $a, self = this, val = nil, $case = nil, type = nil, quoted_title = nil, signifier = nil; + + + + if (xrefstyle == null) { + xrefstyle = nil; + }; + if ($truthy(($truthy($a = (val = self.$reftext())) ? val['$empty?']()['$!']() : $a))) { + return val + } else if ($truthy(xrefstyle)) { + if ($truthy(self.numbered)) { + return (function() {$case = xrefstyle; + if ("full"['$===']($case)) { + if ($truthy(($truthy($a = (type = self.sectname)['$==']("chapter")) ? $a : type['$==']("appendix")))) { + quoted_title = self.$sprintf(self.$sub_quotes("_%s_"), self.$title()) + } else { + quoted_title = self.$sprintf(self.$sub_quotes((function() {if ($truthy(self.document.$compat_mode())) { + return "``%s''" + } else { + return "\"`%s`\"" + }; return nil; })()), self.$title()) + }; + if ($truthy((signifier = self.document.$attributes()['$[]']("" + (type) + "-refsig")))) { + return "" + (signifier) + " " + (self.$sectnum(".", ",")) + " " + (quoted_title) + } else { + return "" + (self.$sectnum(".", ",")) + " " + (quoted_title) + };} + else if ("short"['$===']($case)) {if ($truthy((signifier = self.document.$attributes()['$[]']("" + (self.sectname) + "-refsig")))) { + return "" + (signifier) + " " + (self.$sectnum(".", "")) + } else { + return self.$sectnum(".", "") + }} + else {if ($truthy(($truthy($a = (type = self.sectname)['$==']("chapter")) ? $a : type['$==']("appendix")))) { + + return self.$sprintf(self.$sub_quotes("_%s_"), self.$title()); + } else { + return self.$title() + }}})() + } else if ($truthy(($truthy($a = (type = self.sectname)['$==']("chapter")) ? $a : type['$==']("appendix")))) { + + return self.$sprintf(self.$sub_quotes("_%s_"), self.$title()); + } else { + return self.$title() + } + } else { + return self.$title() + }; + }, TMP_Section_xreftext_4.$$arity = -1); + + Opal.def(self, '$<<', TMP_Section_$lt$lt_5 = function(block) { + var $iter = TMP_Section_$lt$lt_5.$$p, $yield = $iter || nil, self = this, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_Section_$lt$lt_5.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + + if (block.$context()['$==']("section")) { + self.$assign_numeral(block)}; + return $send(self, Opal.find_super_dispatcher(self, '<<', TMP_Section_$lt$lt_5, false), $zuper, $iter); + }, TMP_Section_$lt$lt_5.$$arity = 1); + + Opal.def(self, '$to_s', TMP_Section_to_s_6 = function $$to_s() { + var $iter = TMP_Section_to_s_6.$$p, $yield = $iter || nil, self = this, formal_title = nil, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_Section_to_s_6.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + if ($truthy(self.title)) { + + formal_title = (function() {if ($truthy(self.numbered)) { + return "" + (self.$sectnum()) + " " + (self.title) + } else { + return self.title + }; return nil; })(); + return "" + "#<" + (self.$class()) + "@" + (self.$object_id()) + " {level: " + (self.level) + ", title: " + (formal_title.$inspect()) + ", blocks: " + (self.blocks.$size()) + "}>"; + } else { + return $send(self, Opal.find_super_dispatcher(self, 'to_s', TMP_Section_to_s_6, false), $zuper, $iter) + } + }, TMP_Section_to_s_6.$$arity = 0); + return (Opal.defs(self, '$generate_id', TMP_Section_generate_id_7 = function $$generate_id(title, document) { + var $a, $b, self = this, attrs = nil, pre = nil, sep = nil, no_sep = nil, $writer = nil, sep_sub = nil, gen_id = nil, ids = nil, cnt = nil, candidate_id = nil; + + + attrs = document.$attributes(); + pre = ($truthy($a = attrs['$[]']("idprefix")) ? $a : "_"); + if ($truthy((sep = attrs['$[]']("idseparator")))) { + if ($truthy(($truthy($a = sep.$length()['$=='](1)) ? $a : ($truthy($b = (no_sep = sep['$empty?']())['$!']()) ? (sep = (($writer = ["idseparator", sep.$chr()]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])) : $b)))) { + sep_sub = (function() {if ($truthy(($truthy($a = sep['$==']("-")) ? $a : sep['$=='](".")))) { + return " .-" + } else { + return "" + " " + (sep) + ".-" + }; return nil; })()} + } else { + $a = ["_", " _.-"], (sep = $a[0]), (sep_sub = $a[1]), $a + }; + gen_id = "" + (pre) + (title.$downcase().$gsub($$($nesting, 'InvalidSectionIdCharsRx'), "")); + if ($truthy(no_sep)) { + gen_id = gen_id.$delete(" ") + } else { + + gen_id = gen_id.$tr_s(sep_sub, sep); + if ($truthy(gen_id['$end_with?'](sep))) { + gen_id = gen_id.$chop()}; + if ($truthy(($truthy($a = pre['$empty?']()) ? gen_id['$start_with?'](sep) : $a))) { + gen_id = gen_id.$slice(1, gen_id.$length())}; + }; + if ($truthy(document.$catalog()['$[]']("ids")['$key?'](gen_id))) { + + $a = [document.$catalog()['$[]']("ids"), $$($nesting, 'Compliance').$unique_id_start_index()], (ids = $a[0]), (cnt = $a[1]), $a; + while ($truthy(ids['$key?']((candidate_id = "" + (gen_id) + (sep) + (cnt))))) { + cnt = $rb_plus(cnt, 1) + }; + return candidate_id; + } else { + return gen_id + }; + }, TMP_Section_generate_id_7.$$arity = 2), nil) && 'generate_id'; + })($nesting[0], $$($nesting, 'AbstractBlock'), $nesting) + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/stylesheets"] = function(Opal) { + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $truthy = Opal.truthy, $hash2 = Opal.hash2, $gvars = Opal.gvars, $send = Opal.send; + + Opal.add_stubs(['$join', '$new', '$rstrip', '$read', '$primary_stylesheet_data', '$write', '$primary_stylesheet_name', '$coderay_stylesheet_data', '$coderay_stylesheet_name', '$load_pygments', '$=~', '$css', '$[]', '$sub', '$[]=', '$-', '$pygments_stylesheet_data', '$pygments_stylesheet_name', '$!', '$nil?', '$require_library']); + return (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + (function($base, $super, $parent_nesting) { + function $Stylesheets(){}; + var self = $Stylesheets = $klass($base, $super, 'Stylesheets', $Stylesheets); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Stylesheets_instance_1, TMP_Stylesheets_primary_stylesheet_name_2, TMP_Stylesheets_primary_stylesheet_data_3, TMP_Stylesheets_embed_primary_stylesheet_4, TMP_Stylesheets_write_primary_stylesheet_5, TMP_Stylesheets_coderay_stylesheet_name_6, TMP_Stylesheets_coderay_stylesheet_data_7, TMP_Stylesheets_embed_coderay_stylesheet_8, TMP_Stylesheets_write_coderay_stylesheet_9, TMP_Stylesheets_pygments_stylesheet_name_10, TMP_Stylesheets_pygments_background_11, TMP_Stylesheets_pygments_stylesheet_data_12, TMP_Stylesheets_embed_pygments_stylesheet_13, TMP_Stylesheets_write_pygments_stylesheet_14, TMP_Stylesheets_load_pygments_15; + + def.primary_stylesheet_data = def.coderay_stylesheet_data = def.pygments_stylesheet_data = nil; + + Opal.const_set($nesting[0], 'DEFAULT_STYLESHEET_NAME', "asciidoctor.css"); + Opal.const_set($nesting[0], 'DEFAULT_PYGMENTS_STYLE', "default"); + Opal.const_set($nesting[0], 'STYLESHEETS_DATA_PATH', $$$('::', 'File').$join($$($nesting, 'DATA_PATH'), "stylesheets")); + Opal.const_set($nesting[0], 'PygmentsBgColorRx', /^\.pygments +\{ *background: *([^;]+);/); + self.__instance__ = self.$new(); + Opal.defs(self, '$instance', TMP_Stylesheets_instance_1 = function $$instance() { + var self = this; + if (self.__instance__ == null) self.__instance__ = nil; + + return self.__instance__ + }, TMP_Stylesheets_instance_1.$$arity = 0); + + Opal.def(self, '$primary_stylesheet_name', TMP_Stylesheets_primary_stylesheet_name_2 = function $$primary_stylesheet_name() { + var self = this; + + return $$($nesting, 'DEFAULT_STYLESHEET_NAME') + }, TMP_Stylesheets_primary_stylesheet_name_2.$$arity = 0); + + Opal.def(self, '$primary_stylesheet_data', TMP_Stylesheets_primary_stylesheet_data_3 = function $$primary_stylesheet_data() { + +var File = Opal.const_get_relative([], "File"); +var stylesheetsPath; +if (Opal.const_get_relative([], "JAVASCRIPT_PLATFORM")["$=="]("node")) { + if (File.$basename(__dirname) === "node" && File.$basename(File.$dirname(__dirname)) === "dist") { + stylesheetsPath = File.$join(File.$dirname(__dirname), "css"); + } else { + stylesheetsPath = File.$join(__dirname, "css"); + } +} else if (Opal.const_get_relative([], "JAVASCRIPT_ENGINE")["$=="]("nashorn")) { + if (File.$basename(__DIR__) === "nashorn" && File.$basename(File.$dirname(__DIR__)) === "dist") { + stylesheetsPath = File.$join(File.$dirname(__DIR__), "css"); + } else { + stylesheetsPath = File.$join(__DIR__, "css"); + } +} else { + stylesheetsPath = "css"; +} +return ((($a = self.primary_stylesheet_data) !== false && $a !== nil && $a != null) ? $a : self.primary_stylesheet_data = Opal.const_get_relative([], "IO").$read(File.$join(stylesheetsPath, "asciidoctor.css")).$chomp()); + + }, TMP_Stylesheets_primary_stylesheet_data_3.$$arity = 0); + + Opal.def(self, '$embed_primary_stylesheet', TMP_Stylesheets_embed_primary_stylesheet_4 = function $$embed_primary_stylesheet() { + var self = this; + + return "" + "" + }, TMP_Stylesheets_embed_primary_stylesheet_4.$$arity = 0); + + Opal.def(self, '$write_primary_stylesheet', TMP_Stylesheets_write_primary_stylesheet_5 = function $$write_primary_stylesheet(target_dir) { + var self = this; + + + + if (target_dir == null) { + target_dir = "."; + }; + return $$$('::', 'IO').$write($$$('::', 'File').$join(target_dir, self.$primary_stylesheet_name()), self.$primary_stylesheet_data()); + }, TMP_Stylesheets_write_primary_stylesheet_5.$$arity = -1); + + Opal.def(self, '$coderay_stylesheet_name', TMP_Stylesheets_coderay_stylesheet_name_6 = function $$coderay_stylesheet_name() { + var self = this; + + return "coderay-asciidoctor.css" + }, TMP_Stylesheets_coderay_stylesheet_name_6.$$arity = 0); + + Opal.def(self, '$coderay_stylesheet_data', TMP_Stylesheets_coderay_stylesheet_data_7 = function $$coderay_stylesheet_data() { + var $a, self = this; + + return (self.coderay_stylesheet_data = ($truthy($a = self.coderay_stylesheet_data) ? $a : $$$('::', 'IO').$read($$$('::', 'File').$join($$($nesting, 'STYLESHEETS_DATA_PATH'), "coderay-asciidoctor.css")).$rstrip())) + }, TMP_Stylesheets_coderay_stylesheet_data_7.$$arity = 0); + + Opal.def(self, '$embed_coderay_stylesheet', TMP_Stylesheets_embed_coderay_stylesheet_8 = function $$embed_coderay_stylesheet() { + var self = this; + + return "" + "" + }, TMP_Stylesheets_embed_coderay_stylesheet_8.$$arity = 0); + + Opal.def(self, '$write_coderay_stylesheet', TMP_Stylesheets_write_coderay_stylesheet_9 = function $$write_coderay_stylesheet(target_dir) { + var self = this; + + + + if (target_dir == null) { + target_dir = "."; + }; + return $$$('::', 'IO').$write($$$('::', 'File').$join(target_dir, self.$coderay_stylesheet_name()), self.$coderay_stylesheet_data()); + }, TMP_Stylesheets_write_coderay_stylesheet_9.$$arity = -1); + + Opal.def(self, '$pygments_stylesheet_name', TMP_Stylesheets_pygments_stylesheet_name_10 = function $$pygments_stylesheet_name(style) { + var $a, self = this; + + + + if (style == null) { + style = nil; + }; + return "" + "pygments-" + (($truthy($a = style) ? $a : $$($nesting, 'DEFAULT_PYGMENTS_STYLE'))) + ".css"; + }, TMP_Stylesheets_pygments_stylesheet_name_10.$$arity = -1); + + Opal.def(self, '$pygments_background', TMP_Stylesheets_pygments_background_11 = function $$pygments_background(style) { + var $a, $b, self = this; + + + + if (style == null) { + style = nil; + }; + if ($truthy(($truthy($a = self.$load_pygments()) ? $$($nesting, 'PygmentsBgColorRx')['$=~']($$$('::', 'Pygments').$css(".pygments", $hash2(["style"], {"style": ($truthy($b = style) ? $b : $$($nesting, 'DEFAULT_PYGMENTS_STYLE'))}))) : $a))) { + return (($a = $gvars['~']) === nil ? nil : $a['$[]'](1)) + } else { + return nil + }; + }, TMP_Stylesheets_pygments_background_11.$$arity = -1); + + Opal.def(self, '$pygments_stylesheet_data', TMP_Stylesheets_pygments_stylesheet_data_12 = function $$pygments_stylesheet_data(style) { + var $a, $b, self = this, $writer = nil; + + + + if (style == null) { + style = nil; + }; + if ($truthy(self.$load_pygments())) { + + style = ($truthy($a = style) ? $a : $$($nesting, 'DEFAULT_PYGMENTS_STYLE')); + return ($truthy($a = (self.pygments_stylesheet_data = ($truthy($b = self.pygments_stylesheet_data) ? $b : $hash2([], {})))['$[]'](style)) ? $a : (($writer = [style, ($truthy($b = $$$('::', 'Pygments').$css(".listingblock .pygments", $hash2(["classprefix", "style"], {"classprefix": "tok-", "style": style}))) ? $b : "/* Failed to load Pygments CSS. */").$sub(".listingblock .pygments {", ".listingblock .pygments, .listingblock .pygments code {")]), $send((self.pygments_stylesheet_data = ($truthy($b = self.pygments_stylesheet_data) ? $b : $hash2([], {}))), '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + } else { + return "/* Pygments CSS disabled. Pygments is not available. */" + }; + }, TMP_Stylesheets_pygments_stylesheet_data_12.$$arity = -1); + + Opal.def(self, '$embed_pygments_stylesheet', TMP_Stylesheets_embed_pygments_stylesheet_13 = function $$embed_pygments_stylesheet(style) { + var self = this; + + + + if (style == null) { + style = nil; + }; + return "" + ""; + }, TMP_Stylesheets_embed_pygments_stylesheet_13.$$arity = -1); + + Opal.def(self, '$write_pygments_stylesheet', TMP_Stylesheets_write_pygments_stylesheet_14 = function $$write_pygments_stylesheet(target_dir, style) { + var self = this; + + + + if (target_dir == null) { + target_dir = "."; + }; + + if (style == null) { + style = nil; + }; + return $$$('::', 'IO').$write($$$('::', 'File').$join(target_dir, self.$pygments_stylesheet_name(style)), self.$pygments_stylesheet_data(style)); + }, TMP_Stylesheets_write_pygments_stylesheet_14.$$arity = -1); + return (Opal.def(self, '$load_pygments', TMP_Stylesheets_load_pygments_15 = function $$load_pygments() { + var $a, self = this; + + if ($truthy((($a = $$$('::', 'Pygments', 'skip_raise')) ? 'constant' : nil))) { + return true + } else { + return $$($nesting, 'Helpers').$require_library("pygments", "pygments.rb", "ignore")['$nil?']()['$!']() + } + }, TMP_Stylesheets_load_pygments_15.$$arity = 0), nil) && 'load_pygments'; + })($nesting[0], null, $nesting) + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/table"] = function(Opal) { + function $rb_gt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); + } + function $rb_lt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); + } + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + function $rb_times(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs * rhs : lhs['$*'](rhs); + } + function $rb_divide(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs / rhs : lhs['$/'](rhs); + } + function $rb_plus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $send = Opal.send, $truthy = Opal.truthy, $hash2 = Opal.hash2, $gvars = Opal.gvars; + + Opal.add_stubs(['$attr_accessor', '$attr_reader', '$new', '$key?', '$[]', '$>', '$to_i', '$<', '$==', '$[]=', '$-', '$attributes', '$round', '$*', '$/', '$to_f', '$empty?', '$body', '$each', '$<<', '$size', '$+', '$assign_column_widths', '$warn', '$logger', '$update_attributes', '$assign_width', '$shift', '$style=', '$head=', '$pop', '$foot=', '$parent', '$sourcemap', '$dup', '$header_row?', '$table', '$delete', '$start_with?', '$rstrip', '$slice', '$length', '$advance', '$lstrip', '$strip', '$split', '$include?', '$readlines', '$unshift', '$nil?', '$=~', '$catalog_inline_anchor', '$apply_subs', '$convert', '$map', '$text', '$!', '$file', '$lineno', '$to_s', '$include', '$to_set', '$mark', '$nested?', '$document', '$error', '$message_with_context', '$cursor_at_prev_line', '$nil_or_empty?', '$escape', '$columns', '$match', '$chop', '$end_with?', '$gsub', '$push_cellspec', '$cell_open?', '$close_cell', '$take_cellspec', '$squeeze', '$upto', '$times', '$cursor_before_mark', '$rowspan', '$activate_rowspan', '$colspan', '$end_of_row?', '$!=', '$close_row', '$rows', '$effective_column_visits']); + return (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + + (function($base, $super, $parent_nesting) { + function $Table(){}; + var self = $Table = $klass($base, $super, 'Table', $Table); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Table_initialize_3, TMP_Table_header_row$q_4, TMP_Table_create_columns_5, TMP_Table_assign_column_widths_7, TMP_Table_partition_header_footer_11; + + def.attributes = def.document = def.has_header_option = def.rows = def.columns = nil; + + Opal.const_set($nesting[0], 'DEFAULT_PRECISION_FACTOR', 10000); + (function($base, $super, $parent_nesting) { + function $Rows(){}; + var self = $Rows = $klass($base, $super, 'Rows', $Rows); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Rows_initialize_1, TMP_Rows_by_section_2; + + def.head = def.body = def.foot = nil; + + self.$attr_accessor("head", "foot", "body"); + + Opal.def(self, '$initialize', TMP_Rows_initialize_1 = function $$initialize(head, foot, body) { + var self = this; + + + + if (head == null) { + head = []; + }; + + if (foot == null) { + foot = []; + }; + + if (body == null) { + body = []; + }; + self.head = head; + self.foot = foot; + return (self.body = body); + }, TMP_Rows_initialize_1.$$arity = -1); + Opal.alias(self, "[]", "send"); + return (Opal.def(self, '$by_section', TMP_Rows_by_section_2 = function $$by_section() { + var self = this; + + return [["head", self.head], ["body", self.body], ["foot", self.foot]] + }, TMP_Rows_by_section_2.$$arity = 0), nil) && 'by_section'; + })($nesting[0], null, $nesting); + self.$attr_accessor("columns"); + self.$attr_accessor("rows"); + self.$attr_accessor("has_header_option"); + self.$attr_reader("caption"); + + Opal.def(self, '$initialize', TMP_Table_initialize_3 = function $$initialize(parent, attributes) { + var $a, $b, $iter = TMP_Table_initialize_3.$$p, $yield = $iter || nil, self = this, pcwidth = nil, pcwidth_intval = nil, $writer = nil; + + if ($iter) TMP_Table_initialize_3.$$p = null; + + $send(self, Opal.find_super_dispatcher(self, 'initialize', TMP_Table_initialize_3, false), [parent, "table"], null); + self.rows = $$($nesting, 'Rows').$new(); + self.columns = []; + self.has_header_option = attributes['$key?']("header-option"); + if ($truthy((pcwidth = attributes['$[]']("width")))) { + if ($truthy(($truthy($a = $rb_gt((pcwidth_intval = pcwidth.$to_i()), 100)) ? $a : $rb_lt(pcwidth_intval, 1)))) { + if ($truthy((($a = pcwidth_intval['$=='](0)) ? ($truthy($b = pcwidth['$==']("0")) ? $b : pcwidth['$==']("0%")) : pcwidth_intval['$=='](0)))) { + } else { + pcwidth_intval = 100 + }} + } else { + pcwidth_intval = 100 + }; + + $writer = ["tablepcwidth", pcwidth_intval]; + $send(self.attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + if ($truthy(self.document.$attributes()['$key?']("pagewidth"))) { + ($truthy($a = self.attributes['$[]']("tableabswidth")) ? $a : (($writer = ["tableabswidth", $rb_times($rb_divide(self.attributes['$[]']("tablepcwidth").$to_f(), 100), self.document.$attributes()['$[]']("pagewidth")).$round()]), $send(self.attributes, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]))}; + if ($truthy(attributes['$key?']("rotate-option"))) { + + $writer = ["orientation", "landscape"]; + $send(attributes, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + } else { + return nil + }; + }, TMP_Table_initialize_3.$$arity = 2); + + Opal.def(self, '$header_row?', TMP_Table_header_row$q_4 = function() { + var $a, self = this; + + return ($truthy($a = self.has_header_option) ? self.rows.$body()['$empty?']() : $a) + }, TMP_Table_header_row$q_4.$$arity = 0); + + Opal.def(self, '$create_columns', TMP_Table_create_columns_5 = function $$create_columns(colspecs) { + var TMP_6, $a, self = this, cols = nil, autowidth_cols = nil, width_base = nil, num_cols = nil, $writer = nil; + + + cols = []; + autowidth_cols = nil; + width_base = 0; + $send(colspecs, 'each', [], (TMP_6 = function(colspec){var self = TMP_6.$$s || this, $a, colwidth = nil; + + + + if (colspec == null) { + colspec = nil; + }; + colwidth = colspec['$[]']("width"); + cols['$<<']($$($nesting, 'Column').$new(self, cols.$size(), colspec)); + if ($truthy($rb_lt(colwidth, 0))) { + return (autowidth_cols = ($truthy($a = autowidth_cols) ? $a : []))['$<<'](cols['$[]'](-1)) + } else { + return (width_base = $rb_plus(width_base, colwidth)) + };}, TMP_6.$$s = self, TMP_6.$$arity = 1, TMP_6)); + if ($truthy($rb_gt((num_cols = (self.columns = cols).$size()), 0))) { + + + $writer = ["colcount", num_cols]; + $send(self.attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + if ($truthy(($truthy($a = $rb_gt(width_base, 0)) ? $a : autowidth_cols))) { + } else { + width_base = nil + }; + self.$assign_column_widths(width_base, autowidth_cols);}; + return nil; + }, TMP_Table_create_columns_5.$$arity = 1); + + Opal.def(self, '$assign_column_widths', TMP_Table_assign_column_widths_7 = function $$assign_column_widths(width_base, autowidth_cols) { + var TMP_8, TMP_9, TMP_10, self = this, pf = nil, total_width = nil, col_pcwidth = nil, autowidth = nil, autowidth_attrs = nil; + + + + if (width_base == null) { + width_base = nil; + }; + + if (autowidth_cols == null) { + autowidth_cols = nil; + }; + pf = $$($nesting, 'DEFAULT_PRECISION_FACTOR'); + total_width = (col_pcwidth = 0); + if ($truthy(width_base)) { + + if ($truthy(autowidth_cols)) { + + if ($truthy($rb_gt(width_base, 100))) { + + autowidth = 0; + self.$logger().$warn("" + "total column width must not exceed 100% when using autowidth columns; got " + (width_base) + "%"); + } else { + + autowidth = $rb_divide($rb_times($rb_divide($rb_minus(100, width_base), autowidth_cols.$size()), pf).$to_i(), pf); + if (autowidth.$to_i()['$=='](autowidth)) { + autowidth = autowidth.$to_i()}; + width_base = 100; + }; + autowidth_attrs = $hash2(["width", "autowidth-option"], {"width": autowidth, "autowidth-option": ""}); + $send(autowidth_cols, 'each', [], (TMP_8 = function(col){var self = TMP_8.$$s || this; + + + + if (col == null) { + col = nil; + }; + return col.$update_attributes(autowidth_attrs);}, TMP_8.$$s = self, TMP_8.$$arity = 1, TMP_8));}; + $send(self.columns, 'each', [], (TMP_9 = function(col){var self = TMP_9.$$s || this; + + + + if (col == null) { + col = nil; + }; + return (total_width = $rb_plus(total_width, (col_pcwidth = col.$assign_width(nil, width_base, pf))));}, TMP_9.$$s = self, TMP_9.$$arity = 1, TMP_9)); + } else { + + col_pcwidth = $rb_divide($rb_divide($rb_times(100, pf), self.columns.$size()).$to_i(), pf); + if (col_pcwidth.$to_i()['$=='](col_pcwidth)) { + col_pcwidth = col_pcwidth.$to_i()}; + $send(self.columns, 'each', [], (TMP_10 = function(col){var self = TMP_10.$$s || this; + + + + if (col == null) { + col = nil; + }; + return (total_width = $rb_plus(total_width, col.$assign_width(col_pcwidth)));}, TMP_10.$$s = self, TMP_10.$$arity = 1, TMP_10)); + }; + if (total_width['$=='](100)) { + } else { + self.columns['$[]'](-1).$assign_width($rb_divide($rb_times($rb_plus($rb_minus(100, total_width), col_pcwidth), pf).$round(), pf)) + }; + return nil; + }, TMP_Table_assign_column_widths_7.$$arity = -1); + return (Opal.def(self, '$partition_header_footer', TMP_Table_partition_header_footer_11 = function $$partition_header_footer(attrs) { + var $a, TMP_12, self = this, $writer = nil, num_body_rows = nil, head = nil; + + + + $writer = ["rowcount", self.rows.$body().$size()]; + $send(self.attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + num_body_rows = self.rows.$body().$size(); + if ($truthy(($truthy($a = $rb_gt(num_body_rows, 0)) ? self.has_header_option : $a))) { + + head = self.rows.$body().$shift(); + num_body_rows = $rb_minus(num_body_rows, 1); + $send(head, 'each', [], (TMP_12 = function(c){var self = TMP_12.$$s || this; + + + + if (c == null) { + c = nil; + }; + $writer = [nil]; + $send(c, 'style=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];}, TMP_12.$$s = self, TMP_12.$$arity = 1, TMP_12)); + + $writer = [[head]]; + $send(self.rows, 'head=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];;}; + if ($truthy(($truthy($a = $rb_gt(num_body_rows, 0)) ? attrs['$key?']("footer-option") : $a))) { + + $writer = [[self.rows.$body().$pop()]]; + $send(self.rows, 'foot=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + return nil; + }, TMP_Table_partition_header_footer_11.$$arity = 1), nil) && 'partition_header_footer'; + })($nesting[0], $$($nesting, 'AbstractBlock'), $nesting); + (function($base, $super, $parent_nesting) { + function $Column(){}; + var self = $Column = $klass($base, $super, 'Column', $Column); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Column_initialize_13, TMP_Column_assign_width_14; + + def.attributes = nil; + + self.$attr_accessor("style"); + + Opal.def(self, '$initialize', TMP_Column_initialize_13 = function $$initialize(table, index, attributes) { + var $a, $iter = TMP_Column_initialize_13.$$p, $yield = $iter || nil, self = this, $writer = nil; + + if ($iter) TMP_Column_initialize_13.$$p = null; + + + if (attributes == null) { + attributes = $hash2([], {}); + }; + $send(self, Opal.find_super_dispatcher(self, 'initialize', TMP_Column_initialize_13, false), [table, "column"], null); + self.style = attributes['$[]']("style"); + + $writer = ["colnumber", $rb_plus(index, 1)]; + $send(attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + ($truthy($a = attributes['$[]']("width")) ? $a : (($writer = ["width", 1]), $send(attributes, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + ($truthy($a = attributes['$[]']("halign")) ? $a : (($writer = ["halign", "left"]), $send(attributes, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + ($truthy($a = attributes['$[]']("valign")) ? $a : (($writer = ["valign", "top"]), $send(attributes, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + return self.$update_attributes(attributes); + }, TMP_Column_initialize_13.$$arity = -3); + Opal.alias(self, "table", "parent"); + return (Opal.def(self, '$assign_width', TMP_Column_assign_width_14 = function $$assign_width(col_pcwidth, width_base, pf) { + var self = this, $writer = nil; + + + + if (width_base == null) { + width_base = nil; + }; + + if (pf == null) { + pf = 10000; + }; + if ($truthy(width_base)) { + + col_pcwidth = $rb_divide($rb_times($rb_times($rb_divide(self.attributes['$[]']("width").$to_f(), width_base), 100), pf).$to_i(), pf); + if (col_pcwidth.$to_i()['$=='](col_pcwidth)) { + col_pcwidth = col_pcwidth.$to_i()};}; + + $writer = ["colpcwidth", col_pcwidth]; + $send(self.attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + if ($truthy(self.$parent().$attributes()['$key?']("tableabswidth"))) { + + $writer = ["colabswidth", $rb_times($rb_divide(col_pcwidth, 100), self.$parent().$attributes()['$[]']("tableabswidth")).$round()]; + $send(self.attributes, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + return col_pcwidth; + }, TMP_Column_assign_width_14.$$arity = -2), nil) && 'assign_width'; + })($$($nesting, 'Table'), $$($nesting, 'AbstractNode'), $nesting); + (function($base, $super, $parent_nesting) { + function $Cell(){}; + var self = $Cell = $klass($base, $super, 'Cell', $Cell); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Cell_initialize_15, TMP_Cell_text_16, TMP_Cell_text$eq_17, TMP_Cell_content_18, TMP_Cell_file_20, TMP_Cell_lineno_21, TMP_Cell_to_s_22; + + def.document = def.text = def.subs = def.style = def.inner_document = def.source_location = def.colspan = def.rowspan = def.attributes = nil; + + self.$attr_reader("source_location"); + self.$attr_accessor("style"); + self.$attr_accessor("subs"); + self.$attr_accessor("colspan"); + self.$attr_accessor("rowspan"); + Opal.alias(self, "column", "parent"); + self.$attr_reader("inner_document"); + + Opal.def(self, '$initialize', TMP_Cell_initialize_15 = function $$initialize(column, cell_text, attributes, opts) { + var $a, $b, $iter = TMP_Cell_initialize_15.$$p, $yield = $iter || nil, self = this, in_header_row = nil, cell_style = nil, asciidoc = nil, inner_document_cursor = nil, lines_advanced = nil, literal = nil, normal_psv = nil, parent_doctitle = nil, inner_document_lines = nil, unprocessed_line1 = nil, preprocessed_lines = nil, $writer = nil; + + if ($iter) TMP_Cell_initialize_15.$$p = null; + + + if (attributes == null) { + attributes = $hash2([], {}); + }; + + if (opts == null) { + opts = $hash2([], {}); + }; + $send(self, Opal.find_super_dispatcher(self, 'initialize', TMP_Cell_initialize_15, false), [column, "cell"], null); + if ($truthy(self.document.$sourcemap())) { + self.source_location = opts['$[]']("cursor").$dup()}; + if ($truthy(column)) { + + if ($truthy((in_header_row = column.$table()['$header_row?']()))) { + } else { + cell_style = column.$attributes()['$[]']("style") + }; + self.$update_attributes(column.$attributes());}; + if ($truthy(attributes)) { + + if ($truthy(attributes['$empty?']())) { + self.colspan = (self.rowspan = nil) + } else { + + $a = [attributes.$delete("colspan"), attributes.$delete("rowspan")], (self.colspan = $a[0]), (self.rowspan = $a[1]), $a; + if ($truthy(in_header_row)) { + } else { + cell_style = ($truthy($a = attributes['$[]']("style")) ? $a : cell_style) + }; + self.$update_attributes(attributes); + }; + if (cell_style['$==']("asciidoc")) { + + asciidoc = true; + inner_document_cursor = opts['$[]']("cursor"); + if ($truthy((cell_text = cell_text.$rstrip())['$start_with?']($$($nesting, 'LF')))) { + + lines_advanced = 1; + while ($truthy((cell_text = cell_text.$slice(1, cell_text.$length()))['$start_with?']($$($nesting, 'LF')))) { + lines_advanced = $rb_plus(lines_advanced, 1) + }; + inner_document_cursor.$advance(lines_advanced); + } else { + cell_text = cell_text.$lstrip() + }; + } else if ($truthy(($truthy($a = (literal = cell_style['$==']("literal"))) ? $a : cell_style['$==']("verse")))) { + + cell_text = cell_text.$rstrip(); + while ($truthy(cell_text['$start_with?']($$($nesting, 'LF')))) { + cell_text = cell_text.$slice(1, cell_text.$length()) + }; + } else { + + normal_psv = true; + cell_text = (function() {if ($truthy(cell_text)) { + return cell_text.$strip() + } else { + return "" + }; return nil; })(); + }; + } else { + + self.colspan = (self.rowspan = nil); + if (cell_style['$==']("asciidoc")) { + + asciidoc = true; + inner_document_cursor = opts['$[]']("cursor");}; + }; + if ($truthy(asciidoc)) { + + parent_doctitle = self.document.$attributes().$delete("doctitle"); + inner_document_lines = cell_text.$split($$($nesting, 'LF'), -1); + if ($truthy(inner_document_lines['$empty?']())) { + } else if ($truthy((unprocessed_line1 = inner_document_lines['$[]'](0))['$include?']("::"))) { + + preprocessed_lines = $$($nesting, 'PreprocessorReader').$new(self.document, [unprocessed_line1]).$readlines(); + if ($truthy((($a = unprocessed_line1['$=='](preprocessed_lines['$[]'](0))) ? $rb_lt(preprocessed_lines.$size(), 2) : unprocessed_line1['$=='](preprocessed_lines['$[]'](0))))) { + } else { + + inner_document_lines.$shift(); + if ($truthy(preprocessed_lines['$empty?']())) { + } else { + $send(inner_document_lines, 'unshift', Opal.to_a(preprocessed_lines)) + }; + };}; + self.inner_document = $$($nesting, 'Document').$new(inner_document_lines, $hash2(["header_footer", "parent", "cursor"], {"header_footer": false, "parent": self.document, "cursor": inner_document_cursor})); + if ($truthy(parent_doctitle['$nil?']())) { + } else { + + $writer = ["doctitle", parent_doctitle]; + $send(self.document.$attributes(), '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + self.subs = nil; + } else if ($truthy(literal)) { + self.subs = $$($nesting, 'BASIC_SUBS') + } else { + + if ($truthy(($truthy($a = ($truthy($b = normal_psv) ? cell_text['$start_with?']("[[") : $b)) ? $$($nesting, 'LeadingInlineAnchorRx')['$=~'](cell_text) : $a))) { + $$($nesting, 'Parser').$catalog_inline_anchor((($a = $gvars['~']) === nil ? nil : $a['$[]'](1)), (($a = $gvars['~']) === nil ? nil : $a['$[]'](2)), self, opts['$[]']("cursor"), self.document)}; + self.subs = $$($nesting, 'NORMAL_SUBS'); + }; + self.text = cell_text; + return (self.style = cell_style); + }, TMP_Cell_initialize_15.$$arity = -3); + + Opal.def(self, '$text', TMP_Cell_text_16 = function $$text() { + var self = this; + + return self.$apply_subs(self.text, self.subs) + }, TMP_Cell_text_16.$$arity = 0); + + Opal.def(self, '$text=', TMP_Cell_text$eq_17 = function(val) { + var self = this; + + return (self.text = val) + }, TMP_Cell_text$eq_17.$$arity = 1); + + Opal.def(self, '$content', TMP_Cell_content_18 = function $$content() { + var TMP_19, self = this; + + if (self.style['$==']("asciidoc")) { + return self.inner_document.$convert() + } else { + return $send(self.$text().$split($$($nesting, 'BlankLineRx')), 'map', [], (TMP_19 = function(p){var self = TMP_19.$$s || this, $a; + if (self.style == null) self.style = nil; + + + + if (p == null) { + p = nil; + }; + if ($truthy(($truthy($a = self.style['$!']()) ? $a : self.style['$==']("header")))) { + return p + } else { + return $$($nesting, 'Inline').$new(self.$parent(), "quoted", p, $hash2(["type"], {"type": self.style})).$convert() + };}, TMP_19.$$s = self, TMP_19.$$arity = 1, TMP_19)) + } + }, TMP_Cell_content_18.$$arity = 0); + + Opal.def(self, '$file', TMP_Cell_file_20 = function $$file() { + var $a, self = this; + + return ($truthy($a = self.source_location) ? self.source_location.$file() : $a) + }, TMP_Cell_file_20.$$arity = 0); + + Opal.def(self, '$lineno', TMP_Cell_lineno_21 = function $$lineno() { + var $a, self = this; + + return ($truthy($a = self.source_location) ? self.source_location.$lineno() : $a) + }, TMP_Cell_lineno_21.$$arity = 0); + return (Opal.def(self, '$to_s', TMP_Cell_to_s_22 = function $$to_s() { + var $a, $iter = TMP_Cell_to_s_22.$$p, $yield = $iter || nil, self = this, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_Cell_to_s_22.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + return "" + ($send(self, Opal.find_super_dispatcher(self, 'to_s', TMP_Cell_to_s_22, false), $zuper, $iter).$to_s()) + " - [text: " + (self.text) + ", colspan: " + (($truthy($a = self.colspan) ? $a : 1)) + ", rowspan: " + (($truthy($a = self.rowspan) ? $a : 1)) + ", attributes: " + (self.attributes) + "]" + }, TMP_Cell_to_s_22.$$arity = 0), nil) && 'to_s'; + })($$($nesting, 'Table'), $$($nesting, 'AbstractNode'), $nesting); + (function($base, $super, $parent_nesting) { + function $ParserContext(){}; + var self = $ParserContext = $klass($base, $super, 'ParserContext', $ParserContext); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_ParserContext_initialize_23, TMP_ParserContext_starts_with_delimiter$q_24, TMP_ParserContext_match_delimiter_25, TMP_ParserContext_skip_past_delimiter_26, TMP_ParserContext_skip_past_escaped_delimiter_27, TMP_ParserContext_buffer_has_unclosed_quotes$q_28, TMP_ParserContext_take_cellspec_29, TMP_ParserContext_push_cellspec_30, TMP_ParserContext_keep_cell_open_31, TMP_ParserContext_mark_cell_closed_32, TMP_ParserContext_cell_open$q_33, TMP_ParserContext_cell_closed$q_34, TMP_ParserContext_close_open_cell_35, TMP_ParserContext_close_cell_36, TMP_ParserContext_close_row_39, TMP_ParserContext_activate_rowspan_40, TMP_ParserContext_end_of_row$q_42, TMP_ParserContext_effective_column_visits_43, TMP_ParserContext_advance_44; + + def.delimiter = def.delimiter_re = def.buffer = def.cellspecs = def.cell_open = def.format = def.start_cursor_data = def.reader = def.table = def.current_row = def.colcount = def.column_visits = def.active_rowspans = def.linenum = nil; + + self.$include($$($nesting, 'Logging')); + Opal.const_set($nesting[0], 'FORMATS', ["psv", "csv", "dsv", "tsv"].$to_set()); + Opal.const_set($nesting[0], 'DELIMITERS', $hash2(["psv", "csv", "dsv", "tsv", "!sv"], {"psv": ["|", /\|/], "csv": [",", /,/], "dsv": [":", /:/], "tsv": ["\t", /\t/], "!sv": ["!", /!/]})); + self.$attr_accessor("table"); + self.$attr_accessor("format"); + self.$attr_reader("colcount"); + self.$attr_accessor("buffer"); + self.$attr_reader("delimiter"); + self.$attr_reader("delimiter_re"); + + Opal.def(self, '$initialize', TMP_ParserContext_initialize_23 = function $$initialize(reader, table, attributes) { + var $a, $b, self = this, xsv = nil, sep = nil; + + + + if (attributes == null) { + attributes = $hash2([], {}); + }; + self.start_cursor_data = (self.reader = reader).$mark(); + self.table = table; + if ($truthy(attributes['$key?']("format"))) { + if ($truthy($$($nesting, 'FORMATS')['$include?']((xsv = attributes['$[]']("format"))))) { + if (xsv['$==']("tsv")) { + self.format = "csv" + } else if ($truthy((($a = (self.format = xsv)['$==']("psv")) ? table.$document()['$nested?']() : (self.format = xsv)['$==']("psv")))) { + xsv = "!sv"} + } else { + + self.$logger().$error(self.$message_with_context("" + "illegal table format: " + (xsv), $hash2(["source_location"], {"source_location": reader.$cursor_at_prev_line()}))); + $a = ["psv", (function() {if ($truthy(table.$document()['$nested?']())) { + return "!sv" + } else { + return "psv" + }; return nil; })()], (self.format = $a[0]), (xsv = $a[1]), $a; + } + } else { + $a = ["psv", (function() {if ($truthy(table.$document()['$nested?']())) { + return "!sv" + } else { + return "psv" + }; return nil; })()], (self.format = $a[0]), (xsv = $a[1]), $a + }; + if ($truthy(attributes['$key?']("separator"))) { + if ($truthy((sep = attributes['$[]']("separator"))['$nil_or_empty?']())) { + $b = $$($nesting, 'DELIMITERS')['$[]'](xsv), $a = Opal.to_ary($b), (self.delimiter = ($a[0] == null ? nil : $a[0])), (self.delimiter_re = ($a[1] == null ? nil : $a[1])), $b + } else if (sep['$==']("\\t")) { + $b = $$($nesting, 'DELIMITERS')['$[]']("tsv"), $a = Opal.to_ary($b), (self.delimiter = ($a[0] == null ? nil : $a[0])), (self.delimiter_re = ($a[1] == null ? nil : $a[1])), $b + } else { + $a = [sep, new RegExp($$$('::', 'Regexp').$escape(sep))], (self.delimiter = $a[0]), (self.delimiter_re = $a[1]), $a + } + } else { + $b = $$($nesting, 'DELIMITERS')['$[]'](xsv), $a = Opal.to_ary($b), (self.delimiter = ($a[0] == null ? nil : $a[0])), (self.delimiter_re = ($a[1] == null ? nil : $a[1])), $b + }; + self.colcount = (function() {if ($truthy(table.$columns()['$empty?']())) { + return -1 + } else { + return table.$columns().$size() + }; return nil; })(); + self.buffer = ""; + self.cellspecs = []; + self.cell_open = false; + self.active_rowspans = [0]; + self.column_visits = 0; + self.current_row = []; + return (self.linenum = -1); + }, TMP_ParserContext_initialize_23.$$arity = -3); + + Opal.def(self, '$starts_with_delimiter?', TMP_ParserContext_starts_with_delimiter$q_24 = function(line) { + var self = this; + + return line['$start_with?'](self.delimiter) + }, TMP_ParserContext_starts_with_delimiter$q_24.$$arity = 1); + + Opal.def(self, '$match_delimiter', TMP_ParserContext_match_delimiter_25 = function $$match_delimiter(line) { + var self = this; + + return self.delimiter_re.$match(line) + }, TMP_ParserContext_match_delimiter_25.$$arity = 1); + + Opal.def(self, '$skip_past_delimiter', TMP_ParserContext_skip_past_delimiter_26 = function $$skip_past_delimiter(pre) { + var self = this; + + + self.buffer = "" + (self.buffer) + (pre) + (self.delimiter); + return nil; + }, TMP_ParserContext_skip_past_delimiter_26.$$arity = 1); + + Opal.def(self, '$skip_past_escaped_delimiter', TMP_ParserContext_skip_past_escaped_delimiter_27 = function $$skip_past_escaped_delimiter(pre) { + var self = this; + + + self.buffer = "" + (self.buffer) + (pre.$chop()) + (self.delimiter); + return nil; + }, TMP_ParserContext_skip_past_escaped_delimiter_27.$$arity = 1); + + Opal.def(self, '$buffer_has_unclosed_quotes?', TMP_ParserContext_buffer_has_unclosed_quotes$q_28 = function(append) { + var $a, $b, self = this, record = nil, trailing_quote = nil; + + + + if (append == null) { + append = nil; + }; + if ((record = (function() {if ($truthy(append)) { + return $rb_plus(self.buffer, append).$strip() + } else { + return self.buffer.$strip() + }; return nil; })())['$==']("\"")) { + return true + } else if ($truthy(record['$start_with?']("\""))) { + if ($truthy(($truthy($a = ($truthy($b = (trailing_quote = record['$end_with?']("\""))) ? record['$end_with?']("\"\"") : $b)) ? $a : record['$start_with?']("\"\"")))) { + return ($truthy($a = (record = record.$gsub("\"\"", ""))['$start_with?']("\"")) ? record['$end_with?']("\"")['$!']() : $a) + } else { + return trailing_quote['$!']() + } + } else { + return false + }; + }, TMP_ParserContext_buffer_has_unclosed_quotes$q_28.$$arity = -1); + + Opal.def(self, '$take_cellspec', TMP_ParserContext_take_cellspec_29 = function $$take_cellspec() { + var self = this; + + return self.cellspecs.$shift() + }, TMP_ParserContext_take_cellspec_29.$$arity = 0); + + Opal.def(self, '$push_cellspec', TMP_ParserContext_push_cellspec_30 = function $$push_cellspec(cellspec) { + var $a, self = this; + + + + if (cellspec == null) { + cellspec = $hash2([], {}); + }; + self.cellspecs['$<<'](($truthy($a = cellspec) ? $a : $hash2([], {}))); + return nil; + }, TMP_ParserContext_push_cellspec_30.$$arity = -1); + + Opal.def(self, '$keep_cell_open', TMP_ParserContext_keep_cell_open_31 = function $$keep_cell_open() { + var self = this; + + + self.cell_open = true; + return nil; + }, TMP_ParserContext_keep_cell_open_31.$$arity = 0); + + Opal.def(self, '$mark_cell_closed', TMP_ParserContext_mark_cell_closed_32 = function $$mark_cell_closed() { + var self = this; + + + self.cell_open = false; + return nil; + }, TMP_ParserContext_mark_cell_closed_32.$$arity = 0); + + Opal.def(self, '$cell_open?', TMP_ParserContext_cell_open$q_33 = function() { + var self = this; + + return self.cell_open + }, TMP_ParserContext_cell_open$q_33.$$arity = 0); + + Opal.def(self, '$cell_closed?', TMP_ParserContext_cell_closed$q_34 = function() { + var self = this; + + return self.cell_open['$!']() + }, TMP_ParserContext_cell_closed$q_34.$$arity = 0); + + Opal.def(self, '$close_open_cell', TMP_ParserContext_close_open_cell_35 = function $$close_open_cell(next_cellspec) { + var self = this; + + + + if (next_cellspec == null) { + next_cellspec = $hash2([], {}); + }; + self.$push_cellspec(next_cellspec); + if ($truthy(self['$cell_open?']())) { + self.$close_cell(true)}; + self.$advance(); + return nil; + }, TMP_ParserContext_close_open_cell_35.$$arity = -1); + + Opal.def(self, '$close_cell', TMP_ParserContext_close_cell_36 = function $$close_cell(eol) {try { + + var $a, $b, TMP_37, self = this, cell_text = nil, cellspec = nil, repeat = nil; + + + + if (eol == null) { + eol = false; + }; + if (self.format['$==']("psv")) { + + cell_text = self.buffer; + self.buffer = ""; + if ($truthy((cellspec = self.$take_cellspec()))) { + repeat = ($truthy($a = cellspec.$delete("repeatcol")) ? $a : 1) + } else { + + self.$logger().$error(self.$message_with_context("table missing leading separator; recovering automatically", $hash2(["source_location"], {"source_location": $send($$$($$($nesting, 'Reader'), 'Cursor'), 'new', Opal.to_a(self.start_cursor_data))}))); + cellspec = $hash2([], {}); + repeat = 1; + }; + } else { + + cell_text = self.buffer.$strip(); + self.buffer = ""; + cellspec = nil; + repeat = 1; + if ($truthy(($truthy($a = (($b = self.format['$==']("csv")) ? cell_text['$empty?']()['$!']() : self.format['$==']("csv"))) ? cell_text['$include?']("\"") : $a))) { + if ($truthy(($truthy($a = cell_text['$start_with?']("\"")) ? cell_text['$end_with?']("\"") : $a))) { + if ($truthy((cell_text = cell_text.$slice(1, $rb_minus(cell_text.$length(), 2))))) { + cell_text = cell_text.$strip().$squeeze("\"") + } else { + + self.$logger().$error(self.$message_with_context("unclosed quote in CSV data; setting cell to empty", $hash2(["source_location"], {"source_location": self.reader.$cursor_at_prev_line()}))); + cell_text = ""; + } + } else { + cell_text = cell_text.$squeeze("\"") + }}; + }; + $send((1), 'upto', [repeat], (TMP_37 = function(i){var self = TMP_37.$$s || this, $c, $d, TMP_38, $e, column = nil, extra_cols = nil, offset = nil, cell = nil; + if (self.colcount == null) self.colcount = nil; + if (self.table == null) self.table = nil; + if (self.current_row == null) self.current_row = nil; + if (self.reader == null) self.reader = nil; + if (self.column_visits == null) self.column_visits = nil; + if (self.linenum == null) self.linenum = nil; + + + + if (i == null) { + i = nil; + }; + if (self.colcount['$=='](-1)) { + + self.table.$columns()['$<<']((column = $$$($$($nesting, 'Table'), 'Column').$new(self.table, $rb_minus($rb_plus(self.table.$columns().$size(), i), 1)))); + if ($truthy(($truthy($c = ($truthy($d = cellspec) ? cellspec['$key?']("colspan") : $d)) ? $rb_gt((extra_cols = $rb_minus(cellspec['$[]']("colspan").$to_i(), 1)), 0) : $c))) { + + offset = self.table.$columns().$size(); + $send(extra_cols, 'times', [], (TMP_38 = function(j){var self = TMP_38.$$s || this; + if (self.table == null) self.table = nil; + + + + if (j == null) { + j = nil; + }; + return self.table.$columns()['$<<']($$$($$($nesting, 'Table'), 'Column').$new(self.table, $rb_plus(offset, j)));}, TMP_38.$$s = self, TMP_38.$$arity = 1, TMP_38));}; + } else if ($truthy((column = self.table.$columns()['$[]'](self.current_row.$size())))) { + } else { + + self.$logger().$error(self.$message_with_context("dropping cell because it exceeds specified number of columns", $hash2(["source_location"], {"source_location": self.reader.$cursor_before_mark()}))); + Opal.ret(nil); + }; + cell = $$$($$($nesting, 'Table'), 'Cell').$new(column, cell_text, cellspec, $hash2(["cursor"], {"cursor": self.reader.$cursor_before_mark()})); + self.reader.$mark(); + if ($truthy(($truthy($c = cell.$rowspan()['$!']()) ? $c : cell.$rowspan()['$=='](1)))) { + } else { + self.$activate_rowspan(cell.$rowspan(), ($truthy($c = cell.$colspan()) ? $c : 1)) + }; + self.column_visits = $rb_plus(self.column_visits, ($truthy($c = cell.$colspan()) ? $c : 1)); + self.current_row['$<<'](cell); + if ($truthy(($truthy($c = self['$end_of_row?']()) ? ($truthy($d = ($truthy($e = self.colcount['$!='](-1)) ? $e : $rb_gt(self.linenum, 0))) ? $d : ($truthy($e = eol) ? i['$=='](repeat) : $e)) : $c))) { + return self.$close_row() + } else { + return nil + };}, TMP_37.$$s = self, TMP_37.$$arity = 1, TMP_37)); + self.cell_open = false; + return nil; + } catch ($returner) { if ($returner === Opal.returner) { return $returner.$v } throw $returner; } + }, TMP_ParserContext_close_cell_36.$$arity = -1); + + Opal.def(self, '$close_row', TMP_ParserContext_close_row_39 = function $$close_row() { + var $a, self = this, $writer = nil; + + + self.table.$rows().$body()['$<<'](self.current_row); + if (self.colcount['$=='](-1)) { + self.colcount = self.column_visits}; + self.column_visits = 0; + self.current_row = []; + self.active_rowspans.$shift(); + ($truthy($a = self.active_rowspans['$[]'](0)) ? $a : (($writer = [0, 0]), $send(self.active_rowspans, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + return nil; + }, TMP_ParserContext_close_row_39.$$arity = 0); + + Opal.def(self, '$activate_rowspan', TMP_ParserContext_activate_rowspan_40 = function $$activate_rowspan(rowspan, colspan) { + var TMP_41, self = this; + + + $send((1).$upto($rb_minus(rowspan, 1)), 'each', [], (TMP_41 = function(i){var self = TMP_41.$$s || this, $a, $writer = nil; + if (self.active_rowspans == null) self.active_rowspans = nil; + + + + if (i == null) { + i = nil; + }; + $writer = [i, $rb_plus(($truthy($a = self.active_rowspans['$[]'](i)) ? $a : 0), colspan)]; + $send(self.active_rowspans, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];}, TMP_41.$$s = self, TMP_41.$$arity = 1, TMP_41)); + return nil; + }, TMP_ParserContext_activate_rowspan_40.$$arity = 2); + + Opal.def(self, '$end_of_row?', TMP_ParserContext_end_of_row$q_42 = function() { + var $a, self = this; + + return ($truthy($a = self.colcount['$=='](-1)) ? $a : self.$effective_column_visits()['$=='](self.colcount)) + }, TMP_ParserContext_end_of_row$q_42.$$arity = 0); + + Opal.def(self, '$effective_column_visits', TMP_ParserContext_effective_column_visits_43 = function $$effective_column_visits() { + var self = this; + + return $rb_plus(self.column_visits, self.active_rowspans['$[]'](0)) + }, TMP_ParserContext_effective_column_visits_43.$$arity = 0); + return (Opal.def(self, '$advance', TMP_ParserContext_advance_44 = function $$advance() { + var self = this; + + return (self.linenum = $rb_plus(self.linenum, 1)) + }, TMP_ParserContext_advance_44.$$arity = 0), nil) && 'advance'; + })($$($nesting, 'Table'), null, $nesting); + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/converter/composite"] = function(Opal) { + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $send = Opal.send, $truthy = Opal.truthy, $hash2 = Opal.hash2; + + Opal.add_stubs(['$attr_reader', '$each', '$compact', '$flatten', '$respond_to?', '$composed', '$node_name', '$convert', '$converter_for', '$[]', '$find_converter', '$[]=', '$-', '$handles?', '$raise']); + return (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + (function($base, $super, $parent_nesting) { + function $CompositeConverter(){}; + var self = $CompositeConverter = $klass($base, $super, 'CompositeConverter', $CompositeConverter); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_CompositeConverter_initialize_1, TMP_CompositeConverter_convert_3, TMP_CompositeConverter_converter_for_4, TMP_CompositeConverter_find_converter_5; + + def.converter_map = def.converters = nil; + + self.$attr_reader("converters"); + + Opal.def(self, '$initialize', TMP_CompositeConverter_initialize_1 = function $$initialize(backend, $a) { + var $post_args, converters, TMP_2, self = this; + + + + $post_args = Opal.slice.call(arguments, 1, arguments.length); + + converters = $post_args;; + self.backend = backend; + $send((self.converters = converters.$flatten().$compact()), 'each', [], (TMP_2 = function(converter){var self = TMP_2.$$s || this; + + + + if (converter == null) { + converter = nil; + }; + if ($truthy(converter['$respond_to?']("composed"))) { + return converter.$composed(self) + } else { + return nil + };}, TMP_2.$$s = self, TMP_2.$$arity = 1, TMP_2)); + return (self.converter_map = $hash2([], {})); + }, TMP_CompositeConverter_initialize_1.$$arity = -2); + + Opal.def(self, '$convert', TMP_CompositeConverter_convert_3 = function $$convert(node, transform, opts) { + var $a, self = this; + + + + if (transform == null) { + transform = nil; + }; + + if (opts == null) { + opts = $hash2([], {}); + }; + transform = ($truthy($a = transform) ? $a : node.$node_name()); + return self.$converter_for(transform).$convert(node, transform, opts); + }, TMP_CompositeConverter_convert_3.$$arity = -2); + Opal.alias(self, "convert_with_options", "convert"); + + Opal.def(self, '$converter_for', TMP_CompositeConverter_converter_for_4 = function $$converter_for(transform) { + var $a, self = this, $writer = nil; + + return ($truthy($a = self.converter_map['$[]'](transform)) ? $a : (($writer = [transform, self.$find_converter(transform)]), $send(self.converter_map, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])) + }, TMP_CompositeConverter_converter_for_4.$$arity = 1); + return (Opal.def(self, '$find_converter', TMP_CompositeConverter_find_converter_5 = function $$find_converter(transform) {try { + + var TMP_6, self = this; + + + $send(self.converters, 'each', [], (TMP_6 = function(candidate){var self = TMP_6.$$s || this; + + + + if (candidate == null) { + candidate = nil; + }; + if ($truthy(candidate['$handles?'](transform))) { + Opal.ret(candidate) + } else { + return nil + };}, TMP_6.$$s = self, TMP_6.$$arity = 1, TMP_6)); + return self.$raise("" + "Could not find a converter to handle transform: " + (transform)); + } catch ($returner) { if ($returner === Opal.returner) { return $returner.$v } throw $returner; } + }, TMP_CompositeConverter_find_converter_5.$$arity = 1), nil) && 'find_converter'; + })($$($nesting, 'Converter'), $$$($$($nesting, 'Converter'), 'Base'), $nesting) + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/converter/html5"] = function(Opal) { + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + function $rb_gt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); + } + function $rb_plus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); + } + function $rb_le(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs <= rhs : lhs['$<='](rhs); + } + function $rb_lt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); + } + function $rb_times(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs * rhs : lhs['$*'](rhs); + } + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $send = Opal.send, $hash2 = Opal.hash2, $truthy = Opal.truthy, $gvars = Opal.gvars; + + Opal.add_stubs(['$default=', '$-', '$==', '$[]', '$instance', '$empty?', '$attr', '$attr?', '$<<', '$include?', '$gsub', '$extname', '$slice', '$length', '$doctitle', '$normalize_web_path', '$embed_primary_stylesheet', '$read_asset', '$normalize_system_path', '$===', '$coderay_stylesheet_name', '$embed_coderay_stylesheet', '$pygments_stylesheet_name', '$embed_pygments_stylesheet', '$docinfo', '$id', '$sections?', '$doctype', '$join', '$noheader', '$outline', '$generate_manname_section', '$has_header?', '$notitle', '$title', '$header', '$each', '$authors', '$>', '$name', '$email', '$sub_macros', '$+', '$downcase', '$concat', '$content', '$footnotes?', '$!', '$footnotes', '$index', '$text', '$nofooter', '$inspect', '$!=', '$to_i', '$attributes', '$document', '$sections', '$level', '$caption', '$captioned_title', '$numbered', '$<=', '$<', '$sectname', '$sectnum', '$role', '$title?', '$icon_uri', '$compact', '$media_uri', '$option?', '$append_boolean_attribute', '$style', '$items', '$blocks?', '$text?', '$chomp', '$safe', '$read_svg_contents', '$alt', '$image_uri', '$encode_quotes', '$append_link_constraint_attrs', '$pygments_background', '$to_sym', '$*', '$count', '$start_with?', '$end_with?', '$list_marker_keyword', '$parent', '$warn', '$logger', '$context', '$error', '$new', '$size', '$columns', '$by_section', '$rows', '$colspan', '$rowspan', '$role?', '$unshift', '$shift', '$split', '$nil_or_empty?', '$type', '$catalog', '$xreftext', '$target', '$map', '$chop', '$upcase', '$read_contents', '$sub', '$match']); + return (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + (function($base, $super, $parent_nesting) { + function $Html5Converter(){}; + var self = $Html5Converter = $klass($base, $super, 'Html5Converter', $Html5Converter); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Html5Converter_initialize_1, TMP_Html5Converter_document_2, TMP_Html5Converter_embedded_5, TMP_Html5Converter_outline_7, TMP_Html5Converter_section_9, TMP_Html5Converter_admonition_10, TMP_Html5Converter_audio_11, TMP_Html5Converter_colist_12, TMP_Html5Converter_dlist_15, TMP_Html5Converter_example_22, TMP_Html5Converter_floating_title_23, TMP_Html5Converter_image_24, TMP_Html5Converter_listing_25, TMP_Html5Converter_literal_26, TMP_Html5Converter_stem_27, TMP_Html5Converter_olist_29, TMP_Html5Converter_open_31, TMP_Html5Converter_page_break_32, TMP_Html5Converter_paragraph_33, TMP_Html5Converter_preamble_34, TMP_Html5Converter_quote_35, TMP_Html5Converter_thematic_break_36, TMP_Html5Converter_sidebar_37, TMP_Html5Converter_table_38, TMP_Html5Converter_toc_43, TMP_Html5Converter_ulist_44, TMP_Html5Converter_verse_46, TMP_Html5Converter_video_47, TMP_Html5Converter_inline_anchor_48, TMP_Html5Converter_inline_break_49, TMP_Html5Converter_inline_button_50, TMP_Html5Converter_inline_callout_51, TMP_Html5Converter_inline_footnote_52, TMP_Html5Converter_inline_image_53, TMP_Html5Converter_inline_indexterm_56, TMP_Html5Converter_inline_kbd_57, TMP_Html5Converter_inline_menu_58, TMP_Html5Converter_inline_quoted_59, TMP_Html5Converter_append_boolean_attribute_60, TMP_Html5Converter_encode_quotes_61, TMP_Html5Converter_generate_manname_section_62, TMP_Html5Converter_append_link_constraint_attrs_63, TMP_Html5Converter_read_svg_contents_64, $writer = nil; + + def.xml_mode = def.void_element_slash = def.stylesheets = def.pygments_bg = def.refs = nil; + + + $writer = [["", "", false]]; + $send(Opal.const_set($nesting[0], 'QUOTE_TAGS', $hash2(["monospaced", "emphasis", "strong", "double", "single", "mark", "superscript", "subscript", "asciimath", "latexmath"], {"monospaced": ["", "", true], "emphasis": ["", "", true], "strong": ["", "", true], "double": ["“", "”", false], "single": ["‘", "’", false], "mark": ["", "", true], "superscript": ["", "", true], "subscript": ["", "", true], "asciimath": ["\\$", "\\$", false], "latexmath": ["\\(", "\\)", false]})), 'default=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + Opal.const_set($nesting[0], 'DropAnchorRx', /<(?:a[^>+]+|\/a)>/); + Opal.const_set($nesting[0], 'StemBreakRx', / *\\\n(?:\\?\n)*|\n\n+/); + Opal.const_set($nesting[0], 'SvgPreambleRx', /^.*?(?=]*>/); + Opal.const_set($nesting[0], 'DimensionAttributeRx', /\s(?:width|height|style)=(["']).*?\1/); + + Opal.def(self, '$initialize', TMP_Html5Converter_initialize_1 = function $$initialize(backend, opts) { + var self = this; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + self.xml_mode = opts['$[]']("htmlsyntax")['$==']("xml"); + self.void_element_slash = (function() {if ($truthy(self.xml_mode)) { + return "/" + } else { + return nil + }; return nil; })(); + return (self.stylesheets = $$($nesting, 'Stylesheets').$instance()); + }, TMP_Html5Converter_initialize_1.$$arity = -2); + + Opal.def(self, '$document', TMP_Html5Converter_document_2 = function $$document(node) { + var $a, $b, $c, TMP_3, TMP_4, self = this, slash = nil, br = nil, asset_uri_scheme = nil, cdn_base = nil, linkcss = nil, result = nil, lang_attribute = nil, authors = nil, icon_href = nil, icon_type = nil, icon_ext = nil, webfonts = nil, iconfont_stylesheet = nil, $case = nil, highlighter = nil, pygments_style = nil, docinfo_content = nil, body_attrs = nil, sectioned = nil, classes = nil, details = nil, idx = nil, highlightjs_path = nil, prettify_path = nil, eqnums_val = nil, eqnums_opt = nil; + + + slash = self.void_element_slash; + br = "" + ""; + if ($truthy((asset_uri_scheme = node.$attr("asset-uri-scheme", "https"))['$empty?']())) { + } else { + asset_uri_scheme = "" + (asset_uri_scheme) + ":" + }; + cdn_base = "" + (asset_uri_scheme) + "//cdnjs.cloudflare.com/ajax/libs"; + linkcss = node['$attr?']("linkcss"); + result = [""]; + lang_attribute = (function() {if ($truthy(node['$attr?']("nolang"))) { + return "" + } else { + return "" + " lang=\"" + (node.$attr("lang", "en")) + "\"" + }; return nil; })(); + result['$<<']("" + ""); + result['$<<']("" + "\n" + "\n" + "\n" + "\n" + ""); + if ($truthy(node['$attr?']("app-name"))) { + result['$<<']("" + "")}; + if ($truthy(node['$attr?']("description"))) { + result['$<<']("" + "")}; + if ($truthy(node['$attr?']("keywords"))) { + result['$<<']("" + "")}; + if ($truthy(node['$attr?']("authors"))) { + result['$<<']("" + "")}; + if ($truthy(node['$attr?']("copyright"))) { + result['$<<']("" + "")}; + if ($truthy(node['$attr?']("favicon"))) { + + if ($truthy((icon_href = node.$attr("favicon"))['$empty?']())) { + $a = ["favicon.ico", "image/x-icon"], (icon_href = $a[0]), (icon_type = $a[1]), $a + } else { + icon_type = (function() {if ((icon_ext = $$$('::', 'File').$extname(icon_href))['$=='](".ico")) { + return "image/x-icon" + } else { + return "" + "image/" + (icon_ext.$slice(1, icon_ext.$length())) + }; return nil; })() + }; + result['$<<']("" + "");}; + result['$<<']("" + "" + (node.$doctitle($hash2(["sanitize", "use_fallback"], {"sanitize": true, "use_fallback": true}))) + ""); + if ($truthy($$($nesting, 'DEFAULT_STYLESHEET_KEYS')['$include?'](node.$attr("stylesheet")))) { + + if ($truthy((webfonts = node.$attr("webfonts")))) { + result['$<<']("" + "")}; + if ($truthy(linkcss)) { + result['$<<']("" + "") + } else { + result['$<<'](self.stylesheets.$embed_primary_stylesheet()) + }; + } else if ($truthy(node['$attr?']("stylesheet"))) { + if ($truthy(linkcss)) { + result['$<<']("" + "") + } else { + result['$<<']("" + "") + }}; + if ($truthy(node['$attr?']("icons", "font"))) { + if ($truthy(node['$attr?']("iconfont-remote"))) { + result['$<<']("" + "") + } else { + + iconfont_stylesheet = "" + (node.$attr("iconfont-name", "font-awesome")) + ".css"; + result['$<<']("" + ""); + }}; + $case = (highlighter = node.$attr("source-highlighter")); + if ("coderay"['$===']($case)) {if (node.$attr("coderay-css", "class")['$==']("class")) { + if ($truthy(linkcss)) { + result['$<<']("" + "") + } else { + result['$<<'](self.stylesheets.$embed_coderay_stylesheet()) + }}} + else if ("pygments"['$===']($case)) {if (node.$attr("pygments-css", "class")['$==']("class")) { + + pygments_style = node.$attr("pygments-style"); + if ($truthy(linkcss)) { + result['$<<']("" + "") + } else { + result['$<<'](self.stylesheets.$embed_pygments_stylesheet(pygments_style)) + };}}; + if ($truthy((docinfo_content = node.$docinfo())['$empty?']())) { + } else { + result['$<<'](docinfo_content) + }; + result['$<<'](""); + body_attrs = (function() {if ($truthy(node.$id())) { + return ["" + "id=\"" + (node.$id()) + "\""] + } else { + return [] + }; return nil; })(); + if ($truthy(($truthy($a = ($truthy($b = ($truthy($c = (sectioned = node['$sections?']())) ? node['$attr?']("toc-class") : $c)) ? node['$attr?']("toc") : $b)) ? node['$attr?']("toc-placement", "auto") : $a))) { + classes = [node.$doctype(), node.$attr("toc-class"), "" + "toc-" + (node.$attr("toc-position", "header"))] + } else { + classes = [node.$doctype()] + }; + if ($truthy(node['$attr?']("docrole"))) { + classes['$<<'](node.$attr("docrole"))}; + body_attrs['$<<']("" + "class=\"" + (classes.$join(" ")) + "\""); + if ($truthy(node['$attr?']("max-width"))) { + body_attrs['$<<']("" + "style=\"max-width: " + (node.$attr("max-width")) + ";\"")}; + result['$<<']("" + ""); + if ($truthy(node.$noheader())) { + } else { + + result['$<<']("
    "); + if (node.$doctype()['$==']("manpage")) { + + result['$<<']("" + "

    " + (node.$doctitle()) + " Manual Page

    "); + if ($truthy(($truthy($a = ($truthy($b = sectioned) ? node['$attr?']("toc") : $b)) ? node['$attr?']("toc-placement", "auto") : $a))) { + result['$<<']("" + "
    \n" + "
    " + (node.$attr("toc-title")) + "
    \n" + (self.$outline(node)) + "\n" + "
    ")}; + if ($truthy(node['$attr?']("manpurpose"))) { + result['$<<'](self.$generate_manname_section(node))}; + } else { + + if ($truthy(node['$has_header?']())) { + + if ($truthy(node.$notitle())) { + } else { + result['$<<']("" + "

    " + (node.$header().$title()) + "

    ") + }; + details = []; + idx = 1; + $send(node.$authors(), 'each', [], (TMP_3 = function(author){var self = TMP_3.$$s || this; + + + + if (author == null) { + author = nil; + }; + details['$<<']("" + "" + (author.$name()) + "" + (br)); + if ($truthy(author.$email())) { + details['$<<']("" + "" + (node.$sub_macros(author.$email())) + "" + (br))}; + return (idx = $rb_plus(idx, 1));}, TMP_3.$$s = self, TMP_3.$$arity = 1, TMP_3)); + if ($truthy(node['$attr?']("revnumber"))) { + details['$<<']("" + "" + (($truthy($a = node.$attr("version-label")) ? $a : "").$downcase()) + " " + (node.$attr("revnumber")) + ((function() {if ($truthy(node['$attr?']("revdate"))) { + return "," + } else { + return "" + }; return nil; })()) + "")}; + if ($truthy(node['$attr?']("revdate"))) { + details['$<<']("" + "" + (node.$attr("revdate")) + "")}; + if ($truthy(node['$attr?']("revremark"))) { + details['$<<']("" + (br) + "" + (node.$attr("revremark")) + "")}; + if ($truthy(details['$empty?']())) { + } else { + + result['$<<']("
    "); + result.$concat(details); + result['$<<']("
    "); + };}; + if ($truthy(($truthy($a = ($truthy($b = sectioned) ? node['$attr?']("toc") : $b)) ? node['$attr?']("toc-placement", "auto") : $a))) { + result['$<<']("" + "
    \n" + "
    " + (node.$attr("toc-title")) + "
    \n" + (self.$outline(node)) + "\n" + "
    ")}; + }; + result['$<<']("
    "); + }; + result['$<<']("" + "
    \n" + (node.$content()) + "\n" + "
    "); + if ($truthy(($truthy($a = node['$footnotes?']()) ? node['$attr?']("nofootnotes")['$!']() : $a))) { + + result['$<<']("" + "
    \n" + ""); + $send(node.$footnotes(), 'each', [], (TMP_4 = function(footnote){var self = TMP_4.$$s || this; + + + + if (footnote == null) { + footnote = nil; + }; + return result['$<<']("" + "
    \n" + "" + (footnote.$index()) + ". " + (footnote.$text()) + "\n" + "
    ");}, TMP_4.$$s = self, TMP_4.$$arity = 1, TMP_4)); + result['$<<']("
    ");}; + if ($truthy(node.$nofooter())) { + } else { + + result['$<<']("
    "); + result['$<<']("
    "); + if ($truthy(node['$attr?']("revnumber"))) { + result['$<<']("" + (node.$attr("version-label")) + " " + (node.$attr("revnumber")) + (br))}; + if ($truthy(($truthy($a = node['$attr?']("last-update-label")) ? node['$attr?']("reproducible")['$!']() : $a))) { + result['$<<']("" + (node.$attr("last-update-label")) + " " + (node.$attr("docdatetime")))}; + result['$<<']("
    "); + result['$<<']("
    "); + }; + if ($truthy((docinfo_content = node.$docinfo("footer"))['$empty?']())) { + } else { + result['$<<'](docinfo_content) + }; + $case = highlighter; + if ("highlightjs"['$===']($case) || "highlight.js"['$===']($case)) { + highlightjs_path = node.$attr("highlightjsdir", "" + (cdn_base) + "/highlight.js/9.13.1"); + result['$<<']("" + ""); + result['$<<']("" + "\n" + "");} + else if ("prettify"['$===']($case)) { + prettify_path = node.$attr("prettifydir", "" + (cdn_base) + "/prettify/r298"); + result['$<<']("" + ""); + result['$<<']("" + "\n" + "");}; + if ($truthy(node['$attr?']("stem"))) { + + eqnums_val = node.$attr("eqnums", "none"); + if ($truthy(eqnums_val['$empty?']())) { + eqnums_val = "AMS"}; + eqnums_opt = "" + " equationNumbers: { autoNumber: \"" + (eqnums_val) + "\" } "; + result['$<<']("" + "\n" + "");}; + result['$<<'](""); + result['$<<'](""); + return result.$join($$($nesting, 'LF')); + }, TMP_Html5Converter_document_2.$$arity = 1); + + Opal.def(self, '$embedded', TMP_Html5Converter_embedded_5 = function $$embedded(node) { + var $a, $b, $c, TMP_6, self = this, result = nil, id_attr = nil, toc_p = nil; + + + result = []; + if (node.$doctype()['$==']("manpage")) { + + if ($truthy(node.$notitle())) { + } else { + + id_attr = (function() {if ($truthy(node.$id())) { + return "" + " id=\"" + (node.$id()) + "\"" + } else { + return "" + }; return nil; })(); + result['$<<']("" + "" + (node.$doctitle()) + " Manual Page"); + }; + if ($truthy(node['$attr?']("manpurpose"))) { + result['$<<'](self.$generate_manname_section(node))}; + } else if ($truthy(($truthy($a = node['$has_header?']()) ? node.$notitle()['$!']() : $a))) { + + id_attr = (function() {if ($truthy(node.$id())) { + return "" + " id=\"" + (node.$id()) + "\"" + } else { + return "" + }; return nil; })(); + result['$<<']("" + "" + (node.$header().$title()) + "");}; + if ($truthy(($truthy($a = ($truthy($b = ($truthy($c = node['$sections?']()) ? node['$attr?']("toc") : $c)) ? (toc_p = node.$attr("toc-placement"))['$!=']("macro") : $b)) ? toc_p['$!=']("preamble") : $a))) { + result['$<<']("" + "
    \n" + "
    " + (node.$attr("toc-title")) + "
    \n" + (self.$outline(node)) + "\n" + "
    ")}; + result['$<<'](node.$content()); + if ($truthy(($truthy($a = node['$footnotes?']()) ? node['$attr?']("nofootnotes")['$!']() : $a))) { + + result['$<<']("" + "
    \n" + ""); + $send(node.$footnotes(), 'each', [], (TMP_6 = function(footnote){var self = TMP_6.$$s || this; + + + + if (footnote == null) { + footnote = nil; + }; + return result['$<<']("" + "
    \n" + "" + (footnote.$index()) + ". " + (footnote.$text()) + "\n" + "
    ");}, TMP_6.$$s = self, TMP_6.$$arity = 1, TMP_6)); + result['$<<']("
    ");}; + return result.$join($$($nesting, 'LF')); + }, TMP_Html5Converter_embedded_5.$$arity = 1); + + Opal.def(self, '$outline', TMP_Html5Converter_outline_7 = function $$outline(node, opts) { + var $a, $b, TMP_8, self = this, sectnumlevels = nil, toclevels = nil, sections = nil, result = nil; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + if ($truthy(node['$sections?']())) { + } else { + return nil + }; + sectnumlevels = ($truthy($a = opts['$[]']("sectnumlevels")) ? $a : ($truthy($b = node.$document().$attributes()['$[]']("sectnumlevels")) ? $b : 3).$to_i()); + toclevels = ($truthy($a = opts['$[]']("toclevels")) ? $a : ($truthy($b = node.$document().$attributes()['$[]']("toclevels")) ? $b : 2).$to_i()); + sections = node.$sections(); + result = ["" + "
      "]; + $send(sections, 'each', [], (TMP_8 = function(section){var self = TMP_8.$$s || this, $c, slevel = nil, stitle = nil, signifier = nil, child_toc_level = nil; + + + + if (section == null) { + section = nil; + }; + slevel = section.$level(); + if ($truthy(section.$caption())) { + stitle = section.$captioned_title() + } else if ($truthy(($truthy($c = section.$numbered()) ? $rb_le(slevel, sectnumlevels) : $c))) { + if ($truthy(($truthy($c = $rb_lt(slevel, 2)) ? node.$document().$doctype()['$==']("book") : $c))) { + if (section.$sectname()['$==']("chapter")) { + stitle = "" + ((function() {if ($truthy((signifier = node.$document().$attributes()['$[]']("chapter-signifier")))) { + return "" + (signifier) + " " + } else { + return "" + }; return nil; })()) + (section.$sectnum()) + " " + (section.$title()) + } else if (section.$sectname()['$==']("part")) { + stitle = "" + ((function() {if ($truthy((signifier = node.$document().$attributes()['$[]']("part-signifier")))) { + return "" + (signifier) + " " + } else { + return "" + }; return nil; })()) + (section.$sectnum(nil, ":")) + " " + (section.$title()) + } else { + stitle = "" + (section.$sectnum()) + " " + (section.$title()) + } + } else { + stitle = "" + (section.$sectnum()) + " " + (section.$title()) + } + } else { + stitle = section.$title() + }; + if ($truthy(stitle['$include?']("" + (stitle) + ""); + result['$<<'](child_toc_level); + return result['$<<'](""); + } else { + return result['$<<']("" + "
    • " + (stitle) + "
    • ") + };}, TMP_8.$$s = self, TMP_8.$$arity = 1, TMP_8)); + result['$<<']("
    "); + return result.$join($$($nesting, 'LF')); + }, TMP_Html5Converter_outline_7.$$arity = -2); + + Opal.def(self, '$section', TMP_Html5Converter_section_9 = function $$section(node) { + var $a, $b, self = this, doc_attrs = nil, level = nil, title = nil, signifier = nil, id_attr = nil, id = nil, role = nil; + + + doc_attrs = node.$document().$attributes(); + level = node.$level(); + if ($truthy(node.$caption())) { + title = node.$captioned_title() + } else if ($truthy(($truthy($a = node.$numbered()) ? $rb_le(level, ($truthy($b = doc_attrs['$[]']("sectnumlevels")) ? $b : 3).$to_i()) : $a))) { + if ($truthy(($truthy($a = $rb_lt(level, 2)) ? node.$document().$doctype()['$==']("book") : $a))) { + if (node.$sectname()['$==']("chapter")) { + title = "" + ((function() {if ($truthy((signifier = doc_attrs['$[]']("chapter-signifier")))) { + return "" + (signifier) + " " + } else { + return "" + }; return nil; })()) + (node.$sectnum()) + " " + (node.$title()) + } else if (node.$sectname()['$==']("part")) { + title = "" + ((function() {if ($truthy((signifier = doc_attrs['$[]']("part-signifier")))) { + return "" + (signifier) + " " + } else { + return "" + }; return nil; })()) + (node.$sectnum(nil, ":")) + " " + (node.$title()) + } else { + title = "" + (node.$sectnum()) + " " + (node.$title()) + } + } else { + title = "" + (node.$sectnum()) + " " + (node.$title()) + } + } else { + title = node.$title() + }; + if ($truthy(node.$id())) { + + id_attr = "" + " id=\"" + ((id = node.$id())) + "\""; + if ($truthy(doc_attrs['$[]']("sectlinks"))) { + title = "" + "" + (title) + ""}; + if ($truthy(doc_attrs['$[]']("sectanchors"))) { + if (doc_attrs['$[]']("sectanchors")['$==']("after")) { + title = "" + (title) + "" + } else { + title = "" + "" + (title) + }}; + } else { + id_attr = "" + }; + if (level['$=='](0)) { + return "" + "" + (title) + "\n" + (node.$content()) + } else { + return "" + "
    \n" + "" + (title) + "\n" + ((function() {if (level['$=='](1)) { + return "" + "
    \n" + (node.$content()) + "\n" + "
    " + } else { + return node.$content() + }; return nil; })()) + "\n" + "
    " + }; + }, TMP_Html5Converter_section_9.$$arity = 1); + + Opal.def(self, '$admonition', TMP_Html5Converter_admonition_10 = function $$admonition(node) { + var $a, self = this, id_attr = nil, name = nil, title_element = nil, label = nil, role = nil; + + + id_attr = (function() {if ($truthy(node.$id())) { + return "" + " id=\"" + (node.$id()) + "\"" + } else { + return "" + }; return nil; })(); + name = node.$attr("name"); + title_element = (function() {if ($truthy(node['$title?']())) { + return "" + "
    " + (node.$title()) + "
    \n" + } else { + return "" + }; return nil; })(); + if ($truthy(node.$document()['$attr?']("icons"))) { + if ($truthy(($truthy($a = node.$document()['$attr?']("icons", "font")) ? node['$attr?']("icon")['$!']() : $a))) { + label = "" + "" + } else { + label = "" + "\""" + } + } else { + label = "" + "
    " + (node.$attr("textlabel")) + "
    " + }; + return "" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "
    \n" + (label) + "\n" + "\n" + (title_element) + (node.$content()) + "\n" + "
    \n" + "
    "; + }, TMP_Html5Converter_admonition_10.$$arity = 1); + + Opal.def(self, '$audio', TMP_Html5Converter_audio_11 = function $$audio(node) { + var $a, self = this, xml = nil, id_attribute = nil, classes = nil, class_attribute = nil, title_element = nil, start_t = nil, end_t = nil, time_anchor = nil; + + + xml = self.xml_mode; + id_attribute = (function() {if ($truthy(node.$id())) { + return "" + " id=\"" + (node.$id()) + "\"" + } else { + return "" + }; return nil; })(); + classes = ["audioblock", node.$role()].$compact(); + class_attribute = "" + " class=\"" + (classes.$join(" ")) + "\""; + title_element = (function() {if ($truthy(node['$title?']())) { + return "" + "
    " + (node.$title()) + "
    \n" + } else { + return "" + }; return nil; })(); + start_t = node.$attr("start", nil, false); + end_t = node.$attr("end", nil, false); + time_anchor = (function() {if ($truthy(($truthy($a = start_t) ? $a : end_t))) { + return "" + "#t=" + (($truthy($a = start_t) ? $a : "")) + ((function() {if ($truthy(end_t)) { + return "" + "," + (end_t) + } else { + return "" + }; return nil; })()) + } else { + return "" + }; return nil; })(); + return "" + "\n" + (title_element) + "
    \n" + "\n" + "
    \n" + ""; + }, TMP_Html5Converter_audio_11.$$arity = 1); + + Opal.def(self, '$colist', TMP_Html5Converter_colist_12 = function $$colist(node) { + var $a, TMP_13, TMP_14, self = this, result = nil, id_attribute = nil, classes = nil, class_attribute = nil, font_icons = nil, num = nil; + + + result = []; + id_attribute = (function() {if ($truthy(node.$id())) { + return "" + " id=\"" + (node.$id()) + "\"" + } else { + return "" + }; return nil; })(); + classes = ["colist", node.$style(), node.$role()].$compact(); + class_attribute = "" + " class=\"" + (classes.$join(" ")) + "\""; + result['$<<']("" + ""); + if ($truthy(node['$title?']())) { + result['$<<']("" + "
    " + (node.$title()) + "
    ")}; + if ($truthy(node.$document()['$attr?']("icons"))) { + + result['$<<'](""); + $a = [node.$document()['$attr?']("icons", "font"), 0], (font_icons = $a[0]), (num = $a[1]), $a; + $send(node.$items(), 'each', [], (TMP_13 = function(item){var self = TMP_13.$$s || this, num_label = nil; + if (self.void_element_slash == null) self.void_element_slash = nil; + + + + if (item == null) { + item = nil; + }; + num = $rb_plus(num, 1); + if ($truthy(font_icons)) { + num_label = "" + "" + (num) + "" + } else { + num_label = "" + "\""" + }; + return result['$<<']("" + "\n" + "\n" + "\n" + "");}, TMP_13.$$s = self, TMP_13.$$arity = 1, TMP_13)); + result['$<<']("
    " + (num_label) + "" + (item.$text()) + ((function() {if ($truthy(item['$blocks?']())) { + return $rb_plus($$($nesting, 'LF'), item.$content()) + } else { + return "" + }; return nil; })()) + "
    "); + } else { + + result['$<<']("
      "); + $send(node.$items(), 'each', [], (TMP_14 = function(item){var self = TMP_14.$$s || this; + + + + if (item == null) { + item = nil; + }; + return result['$<<']("" + "
    1. \n" + "

      " + (item.$text()) + "

      " + ((function() {if ($truthy(item['$blocks?']())) { + return $rb_plus($$($nesting, 'LF'), item.$content()) + } else { + return "" + }; return nil; })()) + "\n" + "
    2. ");}, TMP_14.$$s = self, TMP_14.$$arity = 1, TMP_14)); + result['$<<']("
    "); + }; + result['$<<'](""); + return result.$join($$($nesting, 'LF')); + }, TMP_Html5Converter_colist_12.$$arity = 1); + + Opal.def(self, '$dlist', TMP_Html5Converter_dlist_15 = function $$dlist(node) { + var TMP_16, $a, TMP_18, TMP_20, self = this, result = nil, id_attribute = nil, classes = nil, $case = nil, class_attribute = nil, slash = nil, col_style_attribute = nil, dt_style_attribute = nil; + + + result = []; + id_attribute = (function() {if ($truthy(node.$id())) { + return "" + " id=\"" + (node.$id()) + "\"" + } else { + return "" + }; return nil; })(); + classes = (function() {$case = node.$style(); + if ("qanda"['$===']($case)) {return ["qlist", "qanda", node.$role()]} + else if ("horizontal"['$===']($case)) {return ["hdlist", node.$role()]} + else {return ["dlist", node.$style(), node.$role()]}})().$compact(); + class_attribute = "" + " class=\"" + (classes.$join(" ")) + "\""; + result['$<<']("" + ""); + if ($truthy(node['$title?']())) { + result['$<<']("" + "
    " + (node.$title()) + "
    ")}; + $case = node.$style(); + if ("qanda"['$===']($case)) { + result['$<<']("
      "); + $send(node.$items(), 'each', [], (TMP_16 = function(terms, dd){var self = TMP_16.$$s || this, TMP_17; + + + + if (terms == null) { + terms = nil; + }; + + if (dd == null) { + dd = nil; + }; + result['$<<']("
    1. "); + $send([].concat(Opal.to_a(terms)), 'each', [], (TMP_17 = function(dt){var self = TMP_17.$$s || this; + + + + if (dt == null) { + dt = nil; + }; + return result['$<<']("" + "

      " + (dt.$text()) + "

      ");}, TMP_17.$$s = self, TMP_17.$$arity = 1, TMP_17)); + if ($truthy(dd)) { + + if ($truthy(dd['$text?']())) { + result['$<<']("" + "

      " + (dd.$text()) + "

      ")}; + if ($truthy(dd['$blocks?']())) { + result['$<<'](dd.$content())};}; + return result['$<<']("
    2. ");}, TMP_16.$$s = self, TMP_16.$$arity = 2, TMP_16)); + result['$<<']("
    ");} + else if ("horizontal"['$===']($case)) { + slash = self.void_element_slash; + result['$<<'](""); + if ($truthy(($truthy($a = node['$attr?']("labelwidth")) ? $a : node['$attr?']("itemwidth")))) { + + result['$<<'](""); + col_style_attribute = (function() {if ($truthy(node['$attr?']("labelwidth"))) { + return "" + " style=\"width: " + (node.$attr("labelwidth").$chomp("%")) + "%;\"" + } else { + return "" + }; return nil; })(); + result['$<<']("" + ""); + col_style_attribute = (function() {if ($truthy(node['$attr?']("itemwidth"))) { + return "" + " style=\"width: " + (node.$attr("itemwidth").$chomp("%")) + "%;\"" + } else { + return "" + }; return nil; })(); + result['$<<']("" + ""); + result['$<<']("");}; + $send(node.$items(), 'each', [], (TMP_18 = function(terms, dd){var self = TMP_18.$$s || this, TMP_19, terms_array = nil, last_term = nil; + + + + if (terms == null) { + terms = nil; + }; + + if (dd == null) { + dd = nil; + }; + result['$<<'](""); + result['$<<']("" + ""); + result['$<<'](""); + return result['$<<']("");}, TMP_18.$$s = self, TMP_18.$$arity = 2, TMP_18)); + result['$<<']("
    "); + terms_array = [].concat(Opal.to_a(terms)); + last_term = terms_array['$[]'](-1); + $send(terms_array, 'each', [], (TMP_19 = function(dt){var self = TMP_19.$$s || this; + + + + if (dt == null) { + dt = nil; + }; + result['$<<'](dt.$text()); + if ($truthy(dt['$!='](last_term))) { + return result['$<<']("" + "") + } else { + return nil + };}, TMP_19.$$s = self, TMP_19.$$arity = 1, TMP_19)); + result['$<<'](""); + if ($truthy(dd)) { + + if ($truthy(dd['$text?']())) { + result['$<<']("" + "

    " + (dd.$text()) + "

    ")}; + if ($truthy(dd['$blocks?']())) { + result['$<<'](dd.$content())};}; + result['$<<']("
    ");} + else { + result['$<<']("
    "); + dt_style_attribute = (function() {if ($truthy(node.$style())) { + return "" + } else { + return " class=\"hdlist1\"" + }; return nil; })(); + $send(node.$items(), 'each', [], (TMP_20 = function(terms, dd){var self = TMP_20.$$s || this, TMP_21; + + + + if (terms == null) { + terms = nil; + }; + + if (dd == null) { + dd = nil; + }; + $send([].concat(Opal.to_a(terms)), 'each', [], (TMP_21 = function(dt){var self = TMP_21.$$s || this; + + + + if (dt == null) { + dt = nil; + }; + return result['$<<']("" + "" + (dt.$text()) + "");}, TMP_21.$$s = self, TMP_21.$$arity = 1, TMP_21)); + if ($truthy(dd)) { + + result['$<<']("
    "); + if ($truthy(dd['$text?']())) { + result['$<<']("" + "

    " + (dd.$text()) + "

    ")}; + if ($truthy(dd['$blocks?']())) { + result['$<<'](dd.$content())}; + return result['$<<']("
    "); + } else { + return nil + };}, TMP_20.$$s = self, TMP_20.$$arity = 2, TMP_20)); + result['$<<']("
    ");}; + result['$<<'](""); + return result.$join($$($nesting, 'LF')); + }, TMP_Html5Converter_dlist_15.$$arity = 1); + + Opal.def(self, '$example', TMP_Html5Converter_example_22 = function $$example(node) { + var self = this, id_attribute = nil, title_element = nil, role = nil; + + + id_attribute = (function() {if ($truthy(node.$id())) { + return "" + " id=\"" + (node.$id()) + "\"" + } else { + return "" + }; return nil; })(); + title_element = (function() {if ($truthy(node['$title?']())) { + return "" + "
    " + (node.$captioned_title()) + "
    \n" + } else { + return "" + }; return nil; })(); + return "" + "\n" + (title_element) + "
    \n" + (node.$content()) + "\n" + "
    \n" + ""; + }, TMP_Html5Converter_example_22.$$arity = 1); + + Opal.def(self, '$floating_title', TMP_Html5Converter_floating_title_23 = function $$floating_title(node) { + var self = this, tag_name = nil, id_attribute = nil, classes = nil; + + + tag_name = "" + "h" + ($rb_plus(node.$level(), 1)); + id_attribute = (function() {if ($truthy(node.$id())) { + return "" + " id=\"" + (node.$id()) + "\"" + } else { + return "" + }; return nil; })(); + classes = [node.$style(), node.$role()].$compact(); + return "" + "<" + (tag_name) + (id_attribute) + " class=\"" + (classes.$join(" ")) + "\">" + (node.$title()) + ""; + }, TMP_Html5Converter_floating_title_23.$$arity = 1); + + Opal.def(self, '$image', TMP_Html5Converter_image_24 = function $$image(node) { + var $a, $b, $c, self = this, target = nil, width_attr = nil, height_attr = nil, svg = nil, obj = nil, img = nil, fallback = nil, id_attr = nil, classes = nil, class_attr = nil, title_el = nil; + + + target = node.$attr("target"); + width_attr = (function() {if ($truthy(node['$attr?']("width"))) { + return "" + " width=\"" + (node.$attr("width")) + "\"" + } else { + return "" + }; return nil; })(); + height_attr = (function() {if ($truthy(node['$attr?']("height"))) { + return "" + " height=\"" + (node.$attr("height")) + "\"" + } else { + return "" + }; return nil; })(); + if ($truthy(($truthy($a = ($truthy($b = ($truthy($c = node['$attr?']("format", "svg", false)) ? $c : target['$include?'](".svg"))) ? $rb_lt(node.$document().$safe(), $$$($$($nesting, 'SafeMode'), 'SECURE')) : $b)) ? ($truthy($b = (svg = node['$option?']("inline"))) ? $b : (obj = node['$option?']("interactive"))) : $a))) { + if ($truthy(svg)) { + img = ($truthy($a = self.$read_svg_contents(node, target)) ? $a : "" + "" + (node.$alt()) + "") + } else if ($truthy(obj)) { + + fallback = (function() {if ($truthy(node['$attr?']("fallback"))) { + return "" + "\""" + } else { + return "" + "" + (node.$alt()) + "" + }; return nil; })(); + img = "" + "" + (fallback) + "";}}; + img = ($truthy($a = img) ? $a : "" + "\"""); + if ($truthy(node['$attr?']("link", nil, false))) { + img = "" + "" + (img) + ""}; + id_attr = (function() {if ($truthy(node.$id())) { + return "" + " id=\"" + (node.$id()) + "\"" + } else { + return "" + }; return nil; })(); + classes = ["imageblock"]; + if ($truthy(node['$attr?']("float"))) { + classes['$<<'](node.$attr("float"))}; + if ($truthy(node['$attr?']("align"))) { + classes['$<<']("" + "text-" + (node.$attr("align")))}; + if ($truthy(node.$role())) { + classes['$<<'](node.$role())}; + class_attr = "" + " class=\"" + (classes.$join(" ")) + "\""; + title_el = (function() {if ($truthy(node['$title?']())) { + return "" + "\n
    " + (node.$captioned_title()) + "
    " + } else { + return "" + }; return nil; })(); + return "" + "\n" + "
    \n" + (img) + "\n" + "
    " + (title_el) + "\n" + ""; + }, TMP_Html5Converter_image_24.$$arity = 1); + + Opal.def(self, '$listing', TMP_Html5Converter_listing_25 = function $$listing(node) { + var $a, self = this, nowrap = nil, language = nil, code_attrs = nil, $case = nil, pre_class = nil, pre_start = nil, pre_end = nil, id_attribute = nil, title_element = nil, role = nil; + + + nowrap = ($truthy($a = node.$document()['$attr?']("prewrap")['$!']()) ? $a : node['$option?']("nowrap")); + if (node.$style()['$==']("source")) { + + if ($truthy((language = node.$attr("language", nil, false)))) { + code_attrs = "" + " data-lang=\"" + (language) + "\"" + } else { + code_attrs = "" + }; + $case = node.$document().$attr("source-highlighter"); + if ("coderay"['$===']($case)) {pre_class = "" + " class=\"CodeRay highlight" + ((function() {if ($truthy(nowrap)) { + return " nowrap" + } else { + return "" + }; return nil; })()) + "\""} + else if ("pygments"['$===']($case)) {if ($truthy(node.$document()['$attr?']("pygments-css", "inline"))) { + + if ($truthy((($a = self['pygments_bg'], $a != null && $a !== nil) ? 'instance-variable' : nil))) { + } else { + self.pygments_bg = self.stylesheets.$pygments_background(node.$document().$attr("pygments-style")) + }; + pre_class = "" + " class=\"pygments highlight" + ((function() {if ($truthy(nowrap)) { + return " nowrap" + } else { + return "" + }; return nil; })()) + "\" style=\"background: " + (self.pygments_bg) + "\""; + } else { + pre_class = "" + " class=\"pygments highlight" + ((function() {if ($truthy(nowrap)) { + return " nowrap" + } else { + return "" + }; return nil; })()) + "\"" + }} + else if ("highlightjs"['$===']($case) || "highlight.js"['$===']($case)) { + pre_class = "" + " class=\"highlightjs highlight" + ((function() {if ($truthy(nowrap)) { + return " nowrap" + } else { + return "" + }; return nil; })()) + "\""; + if ($truthy(language)) { + code_attrs = "" + " class=\"language-" + (language) + " hljs\"" + (code_attrs)};} + else if ("prettify"['$===']($case)) { + pre_class = "" + " class=\"prettyprint highlight" + ((function() {if ($truthy(nowrap)) { + return " nowrap" + } else { + return "" + }; return nil; })()) + ((function() {if ($truthy(node['$attr?']("linenums", nil, false))) { + return " linenums" + } else { + return "" + }; return nil; })()) + "\""; + if ($truthy(language)) { + code_attrs = "" + " class=\"language-" + (language) + "\"" + (code_attrs)};} + else if ("html-pipeline"['$===']($case)) { + pre_class = (function() {if ($truthy(language)) { + return "" + " lang=\"" + (language) + "\"" + } else { + return "" + }; return nil; })(); + code_attrs = "";} + else { + pre_class = "" + " class=\"highlight" + ((function() {if ($truthy(nowrap)) { + return " nowrap" + } else { + return "" + }; return nil; })()) + "\""; + if ($truthy(language)) { + code_attrs = "" + " class=\"language-" + (language) + "\"" + (code_attrs)};}; + pre_start = "" + ""; + pre_end = "
    "; + } else { + + pre_start = "" + ""; + pre_end = ""; + }; + id_attribute = (function() {if ($truthy(node.$id())) { + return "" + " id=\"" + (node.$id()) + "\"" + } else { + return "" + }; return nil; })(); + title_element = (function() {if ($truthy(node['$title?']())) { + return "" + "
    " + (node.$captioned_title()) + "
    \n" + } else { + return "" + }; return nil; })(); + return "" + "\n" + (title_element) + "
    \n" + (pre_start) + (node.$content()) + (pre_end) + "\n" + "
    \n" + ""; + }, TMP_Html5Converter_listing_25.$$arity = 1); + + Opal.def(self, '$literal', TMP_Html5Converter_literal_26 = function $$literal(node) { + var $a, self = this, id_attribute = nil, title_element = nil, nowrap = nil, role = nil; + + + id_attribute = (function() {if ($truthy(node.$id())) { + return "" + " id=\"" + (node.$id()) + "\"" + } else { + return "" + }; return nil; })(); + title_element = (function() {if ($truthy(node['$title?']())) { + return "" + "
    " + (node.$title()) + "
    \n" + } else { + return "" + }; return nil; })(); + nowrap = ($truthy($a = node.$document()['$attr?']("prewrap")['$!']()) ? $a : node['$option?']("nowrap")); + return "" + "\n" + (title_element) + "
    \n" + "" + (node.$content()) + "\n" + "
    \n" + ""; + }, TMP_Html5Converter_literal_26.$$arity = 1); + + Opal.def(self, '$stem', TMP_Html5Converter_stem_27 = function $$stem(node) { + var $a, $b, TMP_28, self = this, id_attribute = nil, title_element = nil, style = nil, open = nil, close = nil, equation = nil, br = nil, role = nil; + + + id_attribute = (function() {if ($truthy(node.$id())) { + return "" + " id=\"" + (node.$id()) + "\"" + } else { + return "" + }; return nil; })(); + title_element = (function() {if ($truthy(node['$title?']())) { + return "" + "
    " + (node.$title()) + "
    \n" + } else { + return "" + }; return nil; })(); + $b = $$($nesting, 'BLOCK_MATH_DELIMITERS')['$[]']((style = node.$style().$to_sym())), $a = Opal.to_ary($b), (open = ($a[0] == null ? nil : $a[0])), (close = ($a[1] == null ? nil : $a[1])), $b; + equation = node.$content(); + if ($truthy((($a = style['$==']("asciimath")) ? equation['$include?']($$($nesting, 'LF')) : style['$==']("asciimath")))) { + + br = "" + "" + ($$($nesting, 'LF')); + equation = $send(equation, 'gsub', [$$($nesting, 'StemBreakRx')], (TMP_28 = function(){var self = TMP_28.$$s || this, $c; + + return "" + (close) + ($rb_times(br, (($c = $gvars['~']) === nil ? nil : $c['$[]'](0)).$count($$($nesting, 'LF')))) + (open)}, TMP_28.$$s = self, TMP_28.$$arity = 0, TMP_28));}; + if ($truthy(($truthy($a = equation['$start_with?'](open)) ? equation['$end_with?'](close) : $a))) { + } else { + equation = "" + (open) + (equation) + (close) + }; + return "" + "\n" + (title_element) + "
    \n" + (equation) + "\n" + "
    \n" + ""; + }, TMP_Html5Converter_stem_27.$$arity = 1); + + Opal.def(self, '$olist', TMP_Html5Converter_olist_29 = function $$olist(node) { + var TMP_30, self = this, result = nil, id_attribute = nil, classes = nil, class_attribute = nil, type_attribute = nil, keyword = nil, start_attribute = nil, reversed_attribute = nil; + + + result = []; + id_attribute = (function() {if ($truthy(node.$id())) { + return "" + " id=\"" + (node.$id()) + "\"" + } else { + return "" + }; return nil; })(); + classes = ["olist", node.$style(), node.$role()].$compact(); + class_attribute = "" + " class=\"" + (classes.$join(" ")) + "\""; + result['$<<']("" + ""); + if ($truthy(node['$title?']())) { + result['$<<']("" + "
    " + (node.$title()) + "
    ")}; + type_attribute = (function() {if ($truthy((keyword = node.$list_marker_keyword()))) { + return "" + " type=\"" + (keyword) + "\"" + } else { + return "" + }; return nil; })(); + start_attribute = (function() {if ($truthy(node['$attr?']("start"))) { + return "" + " start=\"" + (node.$attr("start")) + "\"" + } else { + return "" + }; return nil; })(); + reversed_attribute = (function() {if ($truthy(node['$option?']("reversed"))) { + + return self.$append_boolean_attribute("reversed", self.xml_mode); + } else { + return "" + }; return nil; })(); + result['$<<']("" + "
      "); + $send(node.$items(), 'each', [], (TMP_30 = function(item){var self = TMP_30.$$s || this; + + + + if (item == null) { + item = nil; + }; + result['$<<']("
    1. "); + result['$<<']("" + "

      " + (item.$text()) + "

      "); + if ($truthy(item['$blocks?']())) { + result['$<<'](item.$content())}; + return result['$<<']("
    2. ");}, TMP_30.$$s = self, TMP_30.$$arity = 1, TMP_30)); + result['$<<']("
    "); + result['$<<'](""); + return result.$join($$($nesting, 'LF')); + }, TMP_Html5Converter_olist_29.$$arity = 1); + + Opal.def(self, '$open', TMP_Html5Converter_open_31 = function $$open(node) { + var $a, $b, $c, self = this, style = nil, id_attr = nil, title_el = nil, role = nil; + + if ((style = node.$style())['$==']("abstract")) { + if ($truthy((($a = node.$parent()['$=='](node.$document())) ? node.$document().$doctype()['$==']("book") : node.$parent()['$=='](node.$document())))) { + + self.$logger().$warn("abstract block cannot be used in a document without a title when doctype is book. Excluding block content."); + return ""; + } else { + + id_attr = (function() {if ($truthy(node.$id())) { + return "" + " id=\"" + (node.$id()) + "\"" + } else { + return "" + }; return nil; })(); + title_el = (function() {if ($truthy(node['$title?']())) { + return "" + "
    " + (node.$title()) + "
    \n" + } else { + return "" + }; return nil; })(); + return "" + "\n" + (title_el) + "
    \n" + (node.$content()) + "\n" + "
    \n" + ""; + } + } else if ($truthy((($a = style['$==']("partintro")) ? ($truthy($b = ($truthy($c = $rb_gt(node.$level(), 0)) ? $c : node.$parent().$context()['$!=']("section"))) ? $b : node.$document().$doctype()['$!=']("book")) : style['$==']("partintro")))) { + + self.$logger().$error("partintro block can only be used when doctype is book and must be a child of a book part. Excluding block content."); + return ""; + } else { + + id_attr = (function() {if ($truthy(node.$id())) { + return "" + " id=\"" + (node.$id()) + "\"" + } else { + return "" + }; return nil; })(); + title_el = (function() {if ($truthy(node['$title?']())) { + return "" + "
    " + (node.$title()) + "
    \n" + } else { + return "" + }; return nil; })(); + return "" + "" + }, TMP_Html5Converter_page_break_32.$$arity = 1); + + Opal.def(self, '$paragraph', TMP_Html5Converter_paragraph_33 = function $$paragraph(node) { + var self = this, class_attribute = nil, attributes = nil; + + + class_attribute = (function() {if ($truthy(node.$role())) { + return "" + "class=\"paragraph " + (node.$role()) + "\"" + } else { + return "class=\"paragraph\"" + }; return nil; })(); + attributes = (function() {if ($truthy(node.$id())) { + return "" + "id=\"" + (node.$id()) + "\" " + (class_attribute) + } else { + return class_attribute + }; return nil; })(); + if ($truthy(node['$title?']())) { + return "" + "
    \n" + "
    " + (node.$title()) + "
    \n" + "

    " + (node.$content()) + "

    \n" + "
    " + } else { + return "" + "
    \n" + "

    " + (node.$content()) + "

    \n" + "
    " + }; + }, TMP_Html5Converter_paragraph_33.$$arity = 1); + + Opal.def(self, '$preamble', TMP_Html5Converter_preamble_34 = function $$preamble(node) { + var $a, $b, self = this, doc = nil, toc = nil; + + + if ($truthy(($truthy($a = ($truthy($b = (doc = node.$document())['$attr?']("toc-placement", "preamble")) ? doc['$sections?']() : $b)) ? doc['$attr?']("toc") : $a))) { + toc = "" + "\n" + "
    \n" + "
    " + (doc.$attr("toc-title")) + "
    \n" + (self.$outline(doc)) + "\n" + "
    " + } else { + toc = "" + }; + return "" + "
    \n" + "
    \n" + (node.$content()) + "\n" + "
    " + (toc) + "\n" + "
    "; + }, TMP_Html5Converter_preamble_34.$$arity = 1); + + Opal.def(self, '$quote', TMP_Html5Converter_quote_35 = function $$quote(node) { + var $a, self = this, id_attribute = nil, classes = nil, class_attribute = nil, title_element = nil, attribution = nil, citetitle = nil, cite_element = nil, attribution_text = nil, attribution_element = nil; + + + id_attribute = (function() {if ($truthy(node.$id())) { + return "" + " id=\"" + (node.$id()) + "\"" + } else { + return "" + }; return nil; })(); + classes = ["quoteblock", node.$role()].$compact(); + class_attribute = "" + " class=\"" + (classes.$join(" ")) + "\""; + title_element = (function() {if ($truthy(node['$title?']())) { + return "" + "\n
    " + (node.$title()) + "
    " + } else { + return "" + }; return nil; })(); + attribution = (function() {if ($truthy(node['$attr?']("attribution"))) { + + return node.$attr("attribution"); + } else { + return nil + }; return nil; })(); + citetitle = (function() {if ($truthy(node['$attr?']("citetitle"))) { + + return node.$attr("citetitle"); + } else { + return nil + }; return nil; })(); + if ($truthy(($truthy($a = attribution) ? $a : citetitle))) { + + cite_element = (function() {if ($truthy(citetitle)) { + return "" + "" + (citetitle) + "" + } else { + return "" + }; return nil; })(); + attribution_text = (function() {if ($truthy(attribution)) { + return "" + "— " + (attribution) + ((function() {if ($truthy(citetitle)) { + return "" + "\n" + } else { + return "" + }; return nil; })()) + } else { + return "" + }; return nil; })(); + attribution_element = "" + "\n
    \n" + (attribution_text) + (cite_element) + "\n
    "; + } else { + attribution_element = "" + }; + return "" + "" + (title_element) + "\n" + "
    \n" + (node.$content()) + "\n" + "
    " + (attribution_element) + "\n" + ""; + }, TMP_Html5Converter_quote_35.$$arity = 1); + + Opal.def(self, '$thematic_break', TMP_Html5Converter_thematic_break_36 = function $$thematic_break(node) { + var self = this; + + return "" + "" + }, TMP_Html5Converter_thematic_break_36.$$arity = 1); + + Opal.def(self, '$sidebar', TMP_Html5Converter_sidebar_37 = function $$sidebar(node) { + var self = this, id_attribute = nil, title_element = nil, role = nil; + + + id_attribute = (function() {if ($truthy(node.$id())) { + return "" + " id=\"" + (node.$id()) + "\"" + } else { + return "" + }; return nil; })(); + title_element = (function() {if ($truthy(node['$title?']())) { + return "" + "
    " + (node.$title()) + "
    \n" + } else { + return "" + }; return nil; })(); + return "" + "\n" + "
    \n" + (title_element) + (node.$content()) + "\n" + "
    \n" + ""; + }, TMP_Html5Converter_sidebar_37.$$arity = 1); + + Opal.def(self, '$table', TMP_Html5Converter_table_38 = function $$table(node) { + var $a, TMP_39, TMP_40, self = this, result = nil, id_attribute = nil, classes = nil, stripes = nil, styles = nil, autowidth = nil, tablewidth = nil, role = nil, class_attribute = nil, style_attribute = nil, slash = nil; + + + result = []; + id_attribute = (function() {if ($truthy(node.$id())) { + return "" + " id=\"" + (node.$id()) + "\"" + } else { + return "" + }; return nil; })(); + classes = ["tableblock", "" + "frame-" + (node.$attr("frame", "all")), "" + "grid-" + (node.$attr("grid", "all"))]; + if ($truthy((stripes = node.$attr("stripes")))) { + classes['$<<']("" + "stripes-" + (stripes))}; + styles = []; + if ($truthy(($truthy($a = (autowidth = node.$attributes()['$[]']("autowidth-option"))) ? node['$attr?']("width", nil, false)['$!']() : $a))) { + classes['$<<']("fit-content") + } else if ((tablewidth = node.$attr("tablepcwidth"))['$=='](100)) { + classes['$<<']("stretch") + } else { + styles['$<<']("" + "width: " + (tablewidth) + "%;") + }; + if ($truthy(node['$attr?']("float"))) { + classes['$<<'](node.$attr("float"))}; + if ($truthy((role = node.$role()))) { + classes['$<<'](role)}; + class_attribute = "" + " class=\"" + (classes.$join(" ")) + "\""; + style_attribute = (function() {if ($truthy(styles['$empty?']())) { + return "" + } else { + return "" + " style=\"" + (styles.$join(" ")) + "\"" + }; return nil; })(); + result['$<<']("" + ""); + if ($truthy(node['$title?']())) { + result['$<<']("" + "" + (node.$captioned_title()) + "")}; + if ($truthy($rb_gt(node.$attr("rowcount"), 0))) { + + slash = self.void_element_slash; + result['$<<'](""); + if ($truthy(autowidth)) { + result = $rb_plus(result, $$($nesting, 'Array').$new(node.$columns().$size(), "" + "")) + } else { + $send(node.$columns(), 'each', [], (TMP_39 = function(col){var self = TMP_39.$$s || this; + + + + if (col == null) { + col = nil; + }; + return result['$<<']((function() {if ($truthy(col.$attributes()['$[]']("autowidth-option"))) { + return "" + "" + } else { + return "" + "" + }; return nil; })());}, TMP_39.$$s = self, TMP_39.$$arity = 1, TMP_39)) + }; + result['$<<'](""); + $send(node.$rows().$by_section(), 'each', [], (TMP_40 = function(tsec, rows){var self = TMP_40.$$s || this, TMP_41; + + + + if (tsec == null) { + tsec = nil; + }; + + if (rows == null) { + rows = nil; + }; + if ($truthy(rows['$empty?']())) { + return nil;}; + result['$<<']("" + ""); + $send(rows, 'each', [], (TMP_41 = function(row){var self = TMP_41.$$s || this, TMP_42; + + + + if (row == null) { + row = nil; + }; + result['$<<'](""); + $send(row, 'each', [], (TMP_42 = function(cell){var self = TMP_42.$$s || this, $b, cell_content = nil, $case = nil, cell_tag_name = nil, cell_class_attribute = nil, cell_colspan_attribute = nil, cell_rowspan_attribute = nil, cell_style_attribute = nil; + + + + if (cell == null) { + cell = nil; + }; + if (tsec['$==']("head")) { + cell_content = cell.$text() + } else { + $case = cell.$style(); + if ("asciidoc"['$===']($case)) {cell_content = "" + "
    " + (cell.$content()) + "
    "} + else if ("verse"['$===']($case)) {cell_content = "" + "
    " + (cell.$text()) + "
    "} + else if ("literal"['$===']($case)) {cell_content = "" + "
    " + (cell.$text()) + "
    "} + else {cell_content = (function() {if ($truthy((cell_content = cell.$content())['$empty?']())) { + return "" + } else { + return "" + "

    " + (cell_content.$join("" + "

    \n" + "

    ")) + "

    " + }; return nil; })()} + }; + cell_tag_name = (function() {if ($truthy(($truthy($b = tsec['$==']("head")) ? $b : cell.$style()['$==']("header")))) { + return "th" + } else { + return "td" + }; return nil; })(); + cell_class_attribute = "" + " class=\"tableblock halign-" + (cell.$attr("halign")) + " valign-" + (cell.$attr("valign")) + "\""; + cell_colspan_attribute = (function() {if ($truthy(cell.$colspan())) { + return "" + " colspan=\"" + (cell.$colspan()) + "\"" + } else { + return "" + }; return nil; })(); + cell_rowspan_attribute = (function() {if ($truthy(cell.$rowspan())) { + return "" + " rowspan=\"" + (cell.$rowspan()) + "\"" + } else { + return "" + }; return nil; })(); + cell_style_attribute = (function() {if ($truthy(node.$document()['$attr?']("cellbgcolor"))) { + return "" + " style=\"background-color: " + (node.$document().$attr("cellbgcolor")) + ";\"" + } else { + return "" + }; return nil; })(); + return result['$<<']("" + "<" + (cell_tag_name) + (cell_class_attribute) + (cell_colspan_attribute) + (cell_rowspan_attribute) + (cell_style_attribute) + ">" + (cell_content) + "");}, TMP_42.$$s = self, TMP_42.$$arity = 1, TMP_42)); + return result['$<<']("");}, TMP_41.$$s = self, TMP_41.$$arity = 1, TMP_41)); + return result['$<<']("" + "
    ");}, TMP_40.$$s = self, TMP_40.$$arity = 2, TMP_40));}; + result['$<<'](""); + return result.$join($$($nesting, 'LF')); + }, TMP_Html5Converter_table_38.$$arity = 1); + + Opal.def(self, '$toc', TMP_Html5Converter_toc_43 = function $$toc(node) { + var $a, $b, self = this, doc = nil, id_attr = nil, title_id_attr = nil, title = nil, levels = nil, role = nil; + + + if ($truthy(($truthy($a = ($truthy($b = (doc = node.$document())['$attr?']("toc-placement", "macro")) ? doc['$sections?']() : $b)) ? doc['$attr?']("toc") : $a))) { + } else { + return "" + }; + if ($truthy(node.$id())) { + + id_attr = "" + " id=\"" + (node.$id()) + "\""; + title_id_attr = "" + " id=\"" + (node.$id()) + "title\""; + } else { + + id_attr = " id=\"toc\""; + title_id_attr = " id=\"toctitle\""; + }; + title = (function() {if ($truthy(node['$title?']())) { + return node.$title() + } else { + + return doc.$attr("toc-title"); + }; return nil; })(); + levels = (function() {if ($truthy(node['$attr?']("levels"))) { + return node.$attr("levels").$to_i() + } else { + return nil + }; return nil; })(); + role = (function() {if ($truthy(node['$role?']())) { + return node.$role() + } else { + + return doc.$attr("toc-class", "toc"); + }; return nil; })(); + return "" + "\n" + "" + (title) + "\n" + (self.$outline(doc, $hash2(["toclevels"], {"toclevels": levels}))) + "\n" + ""; + }, TMP_Html5Converter_toc_43.$$arity = 1); + + Opal.def(self, '$ulist', TMP_Html5Converter_ulist_44 = function $$ulist(node) { + var TMP_45, self = this, result = nil, id_attribute = nil, div_classes = nil, marker_checked = nil, marker_unchecked = nil, checklist = nil, ul_class_attribute = nil; + + + result = []; + id_attribute = (function() {if ($truthy(node.$id())) { + return "" + " id=\"" + (node.$id()) + "\"" + } else { + return "" + }; return nil; })(); + div_classes = ["ulist", node.$style(), node.$role()].$compact(); + marker_checked = (marker_unchecked = ""); + if ($truthy((checklist = node['$option?']("checklist")))) { + + div_classes.$unshift(div_classes.$shift(), "checklist"); + ul_class_attribute = " class=\"checklist\""; + if ($truthy(node['$option?']("interactive"))) { + if ($truthy(self.xml_mode)) { + + marker_checked = " "; + marker_unchecked = " "; + } else { + + marker_checked = " "; + marker_unchecked = " "; + } + } else if ($truthy(node.$document()['$attr?']("icons", "font"))) { + + marker_checked = " "; + marker_unchecked = " "; + } else { + + marker_checked = "✓ "; + marker_unchecked = "❏ "; + }; + } else { + ul_class_attribute = (function() {if ($truthy(node.$style())) { + return "" + " class=\"" + (node.$style()) + "\"" + } else { + return "" + }; return nil; })() + }; + result['$<<']("" + ""); + if ($truthy(node['$title?']())) { + result['$<<']("" + "
    " + (node.$title()) + "
    ")}; + result['$<<']("" + ""); + $send(node.$items(), 'each', [], (TMP_45 = function(item){var self = TMP_45.$$s || this, $a; + + + + if (item == null) { + item = nil; + }; + result['$<<']("
  • "); + if ($truthy(($truthy($a = checklist) ? item['$attr?']("checkbox") : $a))) { + result['$<<']("" + "

    " + ((function() {if ($truthy(item['$attr?']("checked"))) { + return marker_checked + } else { + return marker_unchecked + }; return nil; })()) + (item.$text()) + "

    ") + } else { + result['$<<']("" + "

    " + (item.$text()) + "

    ") + }; + if ($truthy(item['$blocks?']())) { + result['$<<'](item.$content())}; + return result['$<<']("
  • ");}, TMP_45.$$s = self, TMP_45.$$arity = 1, TMP_45)); + result['$<<'](""); + result['$<<'](""); + return result.$join($$($nesting, 'LF')); + }, TMP_Html5Converter_ulist_44.$$arity = 1); + + Opal.def(self, '$verse', TMP_Html5Converter_verse_46 = function $$verse(node) { + var $a, self = this, id_attribute = nil, classes = nil, class_attribute = nil, title_element = nil, attribution = nil, citetitle = nil, cite_element = nil, attribution_text = nil, attribution_element = nil; + + + id_attribute = (function() {if ($truthy(node.$id())) { + return "" + " id=\"" + (node.$id()) + "\"" + } else { + return "" + }; return nil; })(); + classes = ["verseblock", node.$role()].$compact(); + class_attribute = "" + " class=\"" + (classes.$join(" ")) + "\""; + title_element = (function() {if ($truthy(node['$title?']())) { + return "" + "\n
    " + (node.$title()) + "
    " + } else { + return "" + }; return nil; })(); + attribution = (function() {if ($truthy(node['$attr?']("attribution"))) { + + return node.$attr("attribution"); + } else { + return nil + }; return nil; })(); + citetitle = (function() {if ($truthy(node['$attr?']("citetitle"))) { + + return node.$attr("citetitle"); + } else { + return nil + }; return nil; })(); + if ($truthy(($truthy($a = attribution) ? $a : citetitle))) { + + cite_element = (function() {if ($truthy(citetitle)) { + return "" + "" + (citetitle) + "" + } else { + return "" + }; return nil; })(); + attribution_text = (function() {if ($truthy(attribution)) { + return "" + "— " + (attribution) + ((function() {if ($truthy(citetitle)) { + return "" + "\n" + } else { + return "" + }; return nil; })()) + } else { + return "" + }; return nil; })(); + attribution_element = "" + "\n
    \n" + (attribution_text) + (cite_element) + "\n
    "; + } else { + attribution_element = "" + }; + return "" + "" + (title_element) + "\n" + "
    " + (node.$content()) + "
    " + (attribution_element) + "\n" + ""; + }, TMP_Html5Converter_verse_46.$$arity = 1); + + Opal.def(self, '$video', TMP_Html5Converter_video_47 = function $$video(node) { + var $a, $b, self = this, xml = nil, id_attribute = nil, classes = nil, class_attribute = nil, title_element = nil, width_attribute = nil, height_attribute = nil, $case = nil, asset_uri_scheme = nil, start_anchor = nil, delimiter = nil, autoplay_param = nil, loop_param = nil, rel_param_val = nil, start_param = nil, end_param = nil, has_loop_param = nil, controls_param = nil, fs_param = nil, fs_attribute = nil, modest_param = nil, theme_param = nil, hl_param = nil, target = nil, list = nil, list_param = nil, playlist = nil, poster_attribute = nil, val = nil, preload_attribute = nil, start_t = nil, end_t = nil, time_anchor = nil; + + + xml = self.xml_mode; + id_attribute = (function() {if ($truthy(node.$id())) { + return "" + " id=\"" + (node.$id()) + "\"" + } else { + return "" + }; return nil; })(); + classes = ["videoblock"]; + if ($truthy(node['$attr?']("float"))) { + classes['$<<'](node.$attr("float"))}; + if ($truthy(node['$attr?']("align"))) { + classes['$<<']("" + "text-" + (node.$attr("align")))}; + if ($truthy(node.$role())) { + classes['$<<'](node.$role())}; + class_attribute = "" + " class=\"" + (classes.$join(" ")) + "\""; + title_element = (function() {if ($truthy(node['$title?']())) { + return "" + "\n
    " + (node.$title()) + "
    " + } else { + return "" + }; return nil; })(); + width_attribute = (function() {if ($truthy(node['$attr?']("width"))) { + return "" + " width=\"" + (node.$attr("width")) + "\"" + } else { + return "" + }; return nil; })(); + height_attribute = (function() {if ($truthy(node['$attr?']("height"))) { + return "" + " height=\"" + (node.$attr("height")) + "\"" + } else { + return "" + }; return nil; })(); + return (function() {$case = node.$attr("poster"); + if ("vimeo"['$===']($case)) { + if ($truthy((asset_uri_scheme = node.$document().$attr("asset-uri-scheme", "https"))['$empty?']())) { + } else { + asset_uri_scheme = "" + (asset_uri_scheme) + ":" + }; + start_anchor = (function() {if ($truthy(node['$attr?']("start", nil, false))) { + return "" + "#at=" + (node.$attr("start")) + } else { + return "" + }; return nil; })(); + delimiter = "?"; + if ($truthy(node['$option?']("autoplay"))) { + + autoplay_param = "" + (delimiter) + "autoplay=1"; + delimiter = "&"; + } else { + autoplay_param = "" + }; + loop_param = (function() {if ($truthy(node['$option?']("loop"))) { + return "" + (delimiter) + "loop=1" + } else { + return "" + }; return nil; })(); + return "" + "" + (title_element) + "\n" + "
    \n" + "\n" + "
    \n" + "";} + else if ("youtube"['$===']($case)) { + if ($truthy((asset_uri_scheme = node.$document().$attr("asset-uri-scheme", "https"))['$empty?']())) { + } else { + asset_uri_scheme = "" + (asset_uri_scheme) + ":" + }; + rel_param_val = (function() {if ($truthy(node['$option?']("related"))) { + return 1 + } else { + return 0 + }; return nil; })(); + start_param = (function() {if ($truthy(node['$attr?']("start", nil, false))) { + return "" + "&start=" + (node.$attr("start")) + } else { + return "" + }; return nil; })(); + end_param = (function() {if ($truthy(node['$attr?']("end", nil, false))) { + return "" + "&end=" + (node.$attr("end")) + } else { + return "" + }; return nil; })(); + autoplay_param = (function() {if ($truthy(node['$option?']("autoplay"))) { + return "&autoplay=1" + } else { + return "" + }; return nil; })(); + loop_param = (function() {if ($truthy((has_loop_param = node['$option?']("loop")))) { + return "&loop=1" + } else { + return "" + }; return nil; })(); + controls_param = (function() {if ($truthy(node['$option?']("nocontrols"))) { + return "&controls=0" + } else { + return "" + }; return nil; })(); + if ($truthy(node['$option?']("nofullscreen"))) { + + fs_param = "&fs=0"; + fs_attribute = ""; + } else { + + fs_param = ""; + fs_attribute = self.$append_boolean_attribute("allowfullscreen", xml); + }; + modest_param = (function() {if ($truthy(node['$option?']("modest"))) { + return "&modestbranding=1" + } else { + return "" + }; return nil; })(); + theme_param = (function() {if ($truthy(node['$attr?']("theme", nil, false))) { + return "" + "&theme=" + (node.$attr("theme")) + } else { + return "" + }; return nil; })(); + hl_param = (function() {if ($truthy(node['$attr?']("lang"))) { + return "" + "&hl=" + (node.$attr("lang")) + } else { + return "" + }; return nil; })(); + $b = node.$attr("target").$split("/", 2), $a = Opal.to_ary($b), (target = ($a[0] == null ? nil : $a[0])), (list = ($a[1] == null ? nil : $a[1])), $b; + if ($truthy((list = ($truthy($a = list) ? $a : node.$attr("list", nil, false))))) { + list_param = "" + "&list=" + (list) + } else { + + $b = target.$split(",", 2), $a = Opal.to_ary($b), (target = ($a[0] == null ? nil : $a[0])), (playlist = ($a[1] == null ? nil : $a[1])), $b; + if ($truthy((playlist = ($truthy($a = playlist) ? $a : node.$attr("playlist", nil, false))))) { + list_param = "" + "&playlist=" + (playlist) + } else { + list_param = (function() {if ($truthy(has_loop_param)) { + return "" + "&playlist=" + (target) + } else { + return "" + }; return nil; })() + }; + }; + return "" + "" + (title_element) + "\n" + "
    \n" + "\n" + "
    \n" + "";} + else { + poster_attribute = (function() {if ($truthy((val = node.$attr("poster", nil, false))['$nil_or_empty?']())) { + return "" + } else { + return "" + " poster=\"" + (node.$media_uri(val)) + "\"" + }; return nil; })(); + preload_attribute = (function() {if ($truthy((val = node.$attr("preload", nil, false))['$nil_or_empty?']())) { + return "" + } else { + return "" + " preload=\"" + (val) + "\"" + }; return nil; })(); + start_t = node.$attr("start", nil, false); + end_t = node.$attr("end", nil, false); + time_anchor = (function() {if ($truthy(($truthy($a = start_t) ? $a : end_t))) { + return "" + "#t=" + (($truthy($a = start_t) ? $a : "")) + ((function() {if ($truthy(end_t)) { + return "" + "," + (end_t) + } else { + return "" + }; return nil; })()) + } else { + return "" + }; return nil; })(); + return "" + "" + (title_element) + "\n" + "
    \n" + "\n" + "
    \n" + "";}})(); + }, TMP_Html5Converter_video_47.$$arity = 1); + + Opal.def(self, '$inline_anchor', TMP_Html5Converter_inline_anchor_48 = function $$inline_anchor(node) { + var $a, self = this, $case = nil, path = nil, attrs = nil, text = nil, refid = nil, ref = nil; + + return (function() {$case = node.$type(); + if ("xref"['$===']($case)) { + if ($truthy((path = node.$attributes()['$[]']("path")))) { + + attrs = self.$append_link_constraint_attrs(node, (function() {if ($truthy(node.$role())) { + return ["" + " class=\"" + (node.$role()) + "\""] + } else { + return [] + }; return nil; })()).$join(); + text = ($truthy($a = node.$text()) ? $a : path); + } else { + + attrs = (function() {if ($truthy(node.$role())) { + return "" + " class=\"" + (node.$role()) + "\"" + } else { + return "" + }; return nil; })(); + if ($truthy((text = node.$text()))) { + } else { + + refid = node.$attributes()['$[]']("refid"); + if ($truthy($$($nesting, 'AbstractNode')['$===']((ref = (self.refs = ($truthy($a = self.refs) ? $a : node.$document().$catalog()['$[]']("refs")))['$[]'](refid))))) { + text = ($truthy($a = ref.$xreftext(node.$attr("xrefstyle"))) ? $a : "" + "[" + (refid) + "]") + } else { + text = "" + "[" + (refid) + "]" + }; + }; + }; + return "" + "" + (text) + "";} + else if ("ref"['$===']($case)) {return "" + ""} + else if ("link"['$===']($case)) { + attrs = (function() {if ($truthy(node.$id())) { + return ["" + " id=\"" + (node.$id()) + "\""] + } else { + return [] + }; return nil; })(); + if ($truthy(node.$role())) { + attrs['$<<']("" + " class=\"" + (node.$role()) + "\"")}; + if ($truthy(node['$attr?']("title", nil, false))) { + attrs['$<<']("" + " title=\"" + (node.$attr("title")) + "\"")}; + return "" + "" + (node.$text()) + "";} + else if ("bibref"['$===']($case)) {return "" + "" + (node.$text())} + else { + self.$logger().$warn("" + "unknown anchor type: " + (node.$type().$inspect())); + return nil;}})() + }, TMP_Html5Converter_inline_anchor_48.$$arity = 1); + + Opal.def(self, '$inline_break', TMP_Html5Converter_inline_break_49 = function $$inline_break(node) { + var self = this; + + return "" + (node.$text()) + "" + }, TMP_Html5Converter_inline_break_49.$$arity = 1); + + Opal.def(self, '$inline_button', TMP_Html5Converter_inline_button_50 = function $$inline_button(node) { + var self = this; + + return "" + "" + (node.$text()) + "" + }, TMP_Html5Converter_inline_button_50.$$arity = 1); + + Opal.def(self, '$inline_callout', TMP_Html5Converter_inline_callout_51 = function $$inline_callout(node) { + var self = this, src = nil; + + if ($truthy(node.$document()['$attr?']("icons", "font"))) { + return "" + "(" + (node.$text()) + ")" + } else if ($truthy(node.$document()['$attr?']("icons"))) { + + src = node.$icon_uri("" + "callouts/" + (node.$text())); + return "" + "\"""; + } else { + return "" + (node.$attributes()['$[]']("guard")) + "(" + (node.$text()) + ")" + } + }, TMP_Html5Converter_inline_callout_51.$$arity = 1); + + Opal.def(self, '$inline_footnote', TMP_Html5Converter_inline_footnote_52 = function $$inline_footnote(node) { + var self = this, index = nil, id_attr = nil; + + if ($truthy((index = node.$attr("index", nil, false)))) { + if (node.$type()['$==']("xref")) { + return "" + "[" + (index) + "]" + } else { + + id_attr = (function() {if ($truthy(node.$id())) { + return "" + " id=\"_footnote_" + (node.$id()) + "\"" + } else { + return "" + }; return nil; })(); + return "" + "[" + (index) + "]"; + } + } else if (node.$type()['$==']("xref")) { + return "" + "[" + (node.$text()) + "]" + } else { + return nil + } + }, TMP_Html5Converter_inline_footnote_52.$$arity = 1); + + Opal.def(self, '$inline_image', TMP_Html5Converter_inline_image_53 = function $$inline_image(node) { + var $a, TMP_54, TMP_55, $b, $c, $d, self = this, type = nil, class_attr_val = nil, title_attr = nil, img = nil, target = nil, attrs = nil, svg = nil, obj = nil, fallback = nil, role = nil; + + + if ($truthy((($a = (type = node.$type())['$==']("icon")) ? node.$document()['$attr?']("icons", "font") : (type = node.$type())['$==']("icon")))) { + + class_attr_val = "" + "fa fa-" + (node.$target()); + $send($hash2(["size", "rotate", "flip"], {"size": "fa-", "rotate": "fa-rotate-", "flip": "fa-flip-"}), 'each', [], (TMP_54 = function(key, prefix){var self = TMP_54.$$s || this; + + + + if (key == null) { + key = nil; + }; + + if (prefix == null) { + prefix = nil; + }; + if ($truthy(node['$attr?'](key))) { + return (class_attr_val = "" + (class_attr_val) + " " + (prefix) + (node.$attr(key))) + } else { + return nil + };}, TMP_54.$$s = self, TMP_54.$$arity = 2, TMP_54)); + title_attr = (function() {if ($truthy(node['$attr?']("title"))) { + return "" + " title=\"" + (node.$attr("title")) + "\"" + } else { + return "" + }; return nil; })(); + img = "" + ""; + } else if ($truthy((($a = type['$==']("icon")) ? node.$document()['$attr?']("icons")['$!']() : type['$==']("icon")))) { + img = "" + "[" + (node.$alt()) + "]" + } else { + + target = node.$target(); + attrs = $send(["width", "height", "title"], 'map', [], (TMP_55 = function(name){var self = TMP_55.$$s || this; + + + + if (name == null) { + name = nil; + }; + if ($truthy(node['$attr?'](name))) { + return "" + " " + (name) + "=\"" + (node.$attr(name)) + "\"" + } else { + return "" + };}, TMP_55.$$s = self, TMP_55.$$arity = 1, TMP_55)).$join(); + if ($truthy(($truthy($a = ($truthy($b = ($truthy($c = type['$!=']("icon")) ? ($truthy($d = node['$attr?']("format", "svg", false)) ? $d : target['$include?'](".svg")) : $c)) ? $rb_lt(node.$document().$safe(), $$$($$($nesting, 'SafeMode'), 'SECURE')) : $b)) ? ($truthy($b = (svg = node['$option?']("inline"))) ? $b : (obj = node['$option?']("interactive"))) : $a))) { + if ($truthy(svg)) { + img = ($truthy($a = self.$read_svg_contents(node, target)) ? $a : "" + "" + (node.$alt()) + "") + } else if ($truthy(obj)) { + + fallback = (function() {if ($truthy(node['$attr?']("fallback"))) { + return "" + "\""" + } else { + return "" + "" + (node.$alt()) + "" + }; return nil; })(); + img = "" + "" + (fallback) + "";}}; + img = ($truthy($a = img) ? $a : "" + "\"""); + }; + if ($truthy(node['$attr?']("link", nil, false))) { + img = "" + "" + (img) + ""}; + if ($truthy((role = node.$role()))) { + if ($truthy(node['$attr?']("float"))) { + class_attr_val = "" + (type) + " " + (node.$attr("float")) + " " + (role) + } else { + class_attr_val = "" + (type) + " " + (role) + } + } else if ($truthy(node['$attr?']("float"))) { + class_attr_val = "" + (type) + " " + (node.$attr("float")) + } else { + class_attr_val = type + }; + return "" + "" + (img) + ""; + }, TMP_Html5Converter_inline_image_53.$$arity = 1); + + Opal.def(self, '$inline_indexterm', TMP_Html5Converter_inline_indexterm_56 = function $$inline_indexterm(node) { + var self = this; + + if (node.$type()['$==']("visible")) { + return node.$text() + } else { + return "" + } + }, TMP_Html5Converter_inline_indexterm_56.$$arity = 1); + + Opal.def(self, '$inline_kbd', TMP_Html5Converter_inline_kbd_57 = function $$inline_kbd(node) { + var self = this, keys = nil; + + if ((keys = node.$attr("keys")).$size()['$=='](1)) { + return "" + "" + (keys['$[]'](0)) + "" + } else { + return "" + "" + (keys.$join("+")) + "" + } + }, TMP_Html5Converter_inline_kbd_57.$$arity = 1); + + Opal.def(self, '$inline_menu', TMP_Html5Converter_inline_menu_58 = function $$inline_menu(node) { + var self = this, caret = nil, submenu_joiner = nil, menu = nil, submenus = nil, menuitem = nil; + + + caret = (function() {if ($truthy(node.$document()['$attr?']("icons", "font"))) { + return "  " + } else { + return "  " + }; return nil; })(); + submenu_joiner = "" + "
    " + (caret) + ""; + menu = node.$attr("menu"); + if ($truthy((submenus = node.$attr("submenus"))['$empty?']())) { + if ($truthy((menuitem = node.$attr("menuitem", nil, false)))) { + return "" + "" + (menu) + "" + (caret) + "" + (menuitem) + "" + } else { + return "" + "" + (menu) + "" + } + } else { + return "" + "" + (menu) + "" + (caret) + "" + (submenus.$join(submenu_joiner)) + "" + (caret) + "" + (node.$attr("menuitem")) + "" + }; + }, TMP_Html5Converter_inline_menu_58.$$arity = 1); + + Opal.def(self, '$inline_quoted', TMP_Html5Converter_inline_quoted_59 = function $$inline_quoted(node) { + var $a, $b, self = this, open = nil, close = nil, is_tag = nil, class_attr = nil, id_attr = nil; + + + $b = $$($nesting, 'QUOTE_TAGS')['$[]'](node.$type()), $a = Opal.to_ary($b), (open = ($a[0] == null ? nil : $a[0])), (close = ($a[1] == null ? nil : $a[1])), (is_tag = ($a[2] == null ? nil : $a[2])), $b; + if ($truthy(node.$role())) { + class_attr = "" + " class=\"" + (node.$role()) + "\""}; + if ($truthy(node.$id())) { + id_attr = "" + " id=\"" + (node.$id()) + "\""}; + if ($truthy(($truthy($a = class_attr) ? $a : id_attr))) { + if ($truthy(is_tag)) { + return "" + (open.$chop()) + (($truthy($a = id_attr) ? $a : "")) + (($truthy($a = class_attr) ? $a : "")) + ">" + (node.$text()) + (close) + } else { + return "" + "" + (open) + (node.$text()) + (close) + "" + } + } else { + return "" + (open) + (node.$text()) + (close) + }; + }, TMP_Html5Converter_inline_quoted_59.$$arity = 1); + + Opal.def(self, '$append_boolean_attribute', TMP_Html5Converter_append_boolean_attribute_60 = function $$append_boolean_attribute(name, xml) { + var self = this; + + if ($truthy(xml)) { + return "" + " " + (name) + "=\"" + (name) + "\"" + } else { + return "" + " " + (name) + } + }, TMP_Html5Converter_append_boolean_attribute_60.$$arity = 2); + + Opal.def(self, '$encode_quotes', TMP_Html5Converter_encode_quotes_61 = function $$encode_quotes(val) { + var self = this; + + if ($truthy(val['$include?']("\""))) { + + return val.$gsub("\"", """); + } else { + return val + } + }, TMP_Html5Converter_encode_quotes_61.$$arity = 1); + + Opal.def(self, '$generate_manname_section', TMP_Html5Converter_generate_manname_section_62 = function $$generate_manname_section(node) { + var $a, self = this, manname_title = nil, next_section = nil, next_section_title = nil, manname_id_attr = nil, manname_id = nil; + + + manname_title = node.$attr("manname-title", "Name"); + if ($truthy(($truthy($a = (next_section = node.$sections()['$[]'](0))) ? (next_section_title = next_section.$title())['$=='](next_section_title.$upcase()) : $a))) { + manname_title = manname_title.$upcase()}; + manname_id_attr = (function() {if ($truthy((manname_id = node.$attr("manname-id")))) { + return "" + " id=\"" + (manname_id) + "\"" + } else { + return "" + }; return nil; })(); + return "" + "" + (manname_title) + "\n" + "
    \n" + "

    " + (node.$attr("manname")) + " - " + (node.$attr("manpurpose")) + "

    \n" + "
    "; + }, TMP_Html5Converter_generate_manname_section_62.$$arity = 1); + + Opal.def(self, '$append_link_constraint_attrs', TMP_Html5Converter_append_link_constraint_attrs_63 = function $$append_link_constraint_attrs(node, attrs) { + var $a, self = this, rel = nil, window = nil; + + + + if (attrs == null) { + attrs = []; + }; + if ($truthy(node['$option?']("nofollow"))) { + rel = "nofollow"}; + if ($truthy((window = node.$attributes()['$[]']("window")))) { + + attrs['$<<']("" + " target=\"" + (window) + "\""); + if ($truthy(($truthy($a = window['$==']("_blank")) ? $a : node['$option?']("noopener")))) { + attrs['$<<']((function() {if ($truthy(rel)) { + return "" + " rel=\"" + (rel) + " noopener\"" + } else { + return " rel=\"noopener\"" + }; return nil; })())}; + } else if ($truthy(rel)) { + attrs['$<<']("" + " rel=\"" + (rel) + "\"")}; + return attrs; + }, TMP_Html5Converter_append_link_constraint_attrs_63.$$arity = -2); + return (Opal.def(self, '$read_svg_contents', TMP_Html5Converter_read_svg_contents_64 = function $$read_svg_contents(node, target) { + var TMP_65, self = this, svg = nil, old_start_tag = nil, new_start_tag = nil; + + + if ($truthy((svg = node.$read_contents(target, $hash2(["start", "normalize", "label"], {"start": node.$document().$attr("imagesdir"), "normalize": true, "label": "SVG"}))))) { + + if ($truthy(svg['$start_with?'](""); + } else { + return nil + };}, TMP_65.$$s = self, TMP_65.$$arity = 1, TMP_65)); + if ($truthy(new_start_tag)) { + svg = "" + (new_start_tag) + (svg['$[]'](Opal.Range.$new(old_start_tag.$length(), -1, false)))};}; + return svg; + }, TMP_Html5Converter_read_svg_contents_64.$$arity = 2), nil) && 'read_svg_contents'; + })($$($nesting, 'Converter'), $$$($$($nesting, 'Converter'), 'BuiltIn'), $nesting) + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/extensions"] = function(Opal) { + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + function $rb_plus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); + } + function $rb_gt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs); + } + function $rb_lt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); + } + var $a, self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $truthy = Opal.truthy, $module = Opal.module, $klass = Opal.klass, $hash2 = Opal.hash2, $send = Opal.send, $hash = Opal.hash; + + Opal.add_stubs(['$require', '$to_s', '$[]=', '$config', '$-', '$nil_or_empty?', '$name', '$grep', '$constants', '$include', '$const_get', '$extend', '$attr_reader', '$merge', '$class', '$update', '$raise', '$document', '$==', '$doctype', '$[]', '$+', '$level', '$delete', '$>', '$casecmp', '$new', '$title=', '$sectname=', '$special=', '$fetch', '$numbered=', '$!', '$key?', '$attr?', '$special', '$numbered', '$generate_id', '$title', '$id=', '$update_attributes', '$tr', '$basename', '$create_block', '$assign_caption', '$===', '$next_block', '$dup', '$<<', '$has_more_lines?', '$each', '$define_method', '$unshift', '$shift', '$send', '$empty?', '$size', '$call', '$option', '$flatten', '$respond_to?', '$include?', '$split', '$to_i', '$compact', '$inspect', '$attr_accessor', '$to_set', '$match?', '$resolve_regexp', '$method', '$register', '$values', '$groups', '$arity', '$instance_exec', '$to_proc', '$activate', '$add_document_processor', '$any?', '$select', '$add_syntax_processor', '$to_sym', '$instance_variable_get', '$kind', '$private', '$join', '$map', '$capitalize', '$instance_variable_set', '$resolve_args', '$freeze', '$process_block_given?', '$source_location', '$resolve_class', '$<', '$update_config', '$push', '$as_symbol', '$name=', '$pop', '$-@', '$next_auto_id', '$generate_name', '$class_for_name', '$reduce', '$const_defined?']); + + if ($truthy((($a = $$($nesting, 'Asciidoctor', 'skip_raise')) ? 'constant' : nil))) { + } else { + self.$require("asciidoctor".$to_s()) + }; + return (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + (function($base, $parent_nesting) { + function $Extensions() {}; + var self = $Extensions = $module($base, 'Extensions', $Extensions); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + + (function($base, $super, $parent_nesting) { + function $Processor(){}; + var self = $Processor = $klass($base, $super, 'Processor', $Processor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Processor_initialize_4, TMP_Processor_update_config_5, TMP_Processor_process_6, TMP_Processor_create_section_7, TMP_Processor_create_block_8, TMP_Processor_create_list_9, TMP_Processor_create_list_item_10, TMP_Processor_create_image_block_11, TMP_Processor_create_inline_12, TMP_Processor_parse_content_13, TMP_Processor_14; + + def.config = nil; + + (function(self, $parent_nesting) { + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_config_1, TMP_option_2, TMP_use_dsl_3; + + + + Opal.def(self, '$config', TMP_config_1 = function $$config() { + var $a, self = this; + if (self.config == null) self.config = nil; + + return (self.config = ($truthy($a = self.config) ? $a : $hash2([], {}))) + }, TMP_config_1.$$arity = 0); + + Opal.def(self, '$option', TMP_option_2 = function $$option(key, default_value) { + var self = this, $writer = nil; + + + $writer = [key, default_value]; + $send(self.$config(), '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + }, TMP_option_2.$$arity = 2); + + Opal.def(self, '$use_dsl', TMP_use_dsl_3 = function $$use_dsl() { + var self = this; + + if ($truthy(self.$name()['$nil_or_empty?']())) { + if ($truthy((Opal.Module.$$nesting = $nesting, self.$constants()).$grep("DSL"))) { + return self.$include(self.$const_get("DSL")) + } else { + return nil + } + } else if ($truthy((Opal.Module.$$nesting = $nesting, self.$constants()).$grep("DSL"))) { + return self.$extend(self.$const_get("DSL")) + } else { + return nil + } + }, TMP_use_dsl_3.$$arity = 0); + Opal.alias(self, "extend_dsl", "use_dsl"); + return Opal.alias(self, "include_dsl", "use_dsl"); + })(Opal.get_singleton_class(self), $nesting); + self.$attr_reader("config"); + + Opal.def(self, '$initialize', TMP_Processor_initialize_4 = function $$initialize(config) { + var self = this; + + + + if (config == null) { + config = $hash2([], {}); + }; + return (self.config = self.$class().$config().$merge(config)); + }, TMP_Processor_initialize_4.$$arity = -1); + + Opal.def(self, '$update_config', TMP_Processor_update_config_5 = function $$update_config(config) { + var self = this; + + return self.config.$update(config) + }, TMP_Processor_update_config_5.$$arity = 1); + + Opal.def(self, '$process', TMP_Processor_process_6 = function $$process($a) { + var $post_args, args, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + return self.$raise($$$('::', 'NotImplementedError'), "" + "Asciidoctor::Extensions::Processor subclass must implement #" + ("process") + " method"); + }, TMP_Processor_process_6.$$arity = -1); + + Opal.def(self, '$create_section', TMP_Processor_create_section_7 = function $$create_section(parent, title, attrs, opts) { + var $a, self = this, doc = nil, book = nil, doctype = nil, level = nil, style = nil, sectname = nil, special = nil, sect = nil, $writer = nil, id = nil; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + doc = parent.$document(); + book = (doctype = doc.$doctype())['$==']("book"); + level = ($truthy($a = opts['$[]']("level")) ? $a : $rb_plus(parent.$level(), 1)); + if ($truthy((style = attrs.$delete("style")))) { + if ($truthy(($truthy($a = book) ? style['$==']("abstract") : $a))) { + $a = ["chapter", 1], (sectname = $a[0]), (level = $a[1]), $a + } else { + + $a = [style, true], (sectname = $a[0]), (special = $a[1]), $a; + if (level['$=='](0)) { + level = 1}; + } + } else if ($truthy(book)) { + sectname = (function() {if (level['$=='](0)) { + return "part" + } else { + + if ($truthy($rb_gt(level, 1))) { + return "section" + } else { + return "chapter" + }; + }; return nil; })() + } else if ($truthy((($a = doctype['$==']("manpage")) ? title.$casecmp("synopsis")['$=='](0) : doctype['$==']("manpage")))) { + $a = ["synopsis", true], (sectname = $a[0]), (special = $a[1]), $a + } else { + sectname = "section" + }; + sect = $$($nesting, 'Section').$new(parent, level); + $a = [title, sectname], sect['$title=']($a[0]), sect['$sectname=']($a[1]), $a; + if ($truthy(special)) { + + + $writer = [true]; + $send(sect, 'special=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + if ($truthy(opts.$fetch("numbered", style['$==']("appendix")))) { + + $writer = [true]; + $send(sect, 'numbered=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + } else if ($truthy(($truthy($a = opts['$key?']("numbered")['$!']()) ? doc['$attr?']("sectnums", "all") : $a))) { + + $writer = [(function() {if ($truthy(($truthy($a = book) ? level['$=='](1) : $a))) { + return "chapter" + } else { + return true + }; return nil; })()]; + $send(sect, 'numbered=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + } else if ($truthy($rb_gt(level, 0))) { + if ($truthy(opts.$fetch("numbered", doc['$attr?']("sectnums")))) { + + $writer = [(function() {if ($truthy(sect.$special())) { + return ($truthy($a = parent.$numbered()) ? true : $a) + } else { + return true + }; return nil; })()]; + $send(sect, 'numbered=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];} + } else if ($truthy(opts.$fetch("numbered", ($truthy($a = book) ? doc['$attr?']("partnums") : $a)))) { + + $writer = [true]; + $send(sect, 'numbered=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if ((id = attrs.$delete("id"))['$=='](false)) { + } else { + + $writer = [(($writer = ["id", ($truthy($a = id) ? $a : (function() {if ($truthy(doc['$attr?']("sectids"))) { + + return $$($nesting, 'Section').$generate_id(sect.$title(), doc); + } else { + return nil + }; return nil; })())]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])]; + $send(sect, 'id=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + }; + sect.$update_attributes(attrs); + return sect; + }, TMP_Processor_create_section_7.$$arity = -4); + + Opal.def(self, '$create_block', TMP_Processor_create_block_8 = function $$create_block(parent, context, source, attrs, opts) { + var self = this; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + return $$($nesting, 'Block').$new(parent, context, $hash2(["source", "attributes"], {"source": source, "attributes": attrs}).$merge(opts)); + }, TMP_Processor_create_block_8.$$arity = -5); + + Opal.def(self, '$create_list', TMP_Processor_create_list_9 = function $$create_list(parent, context, attrs) { + var self = this, list = nil; + + + + if (attrs == null) { + attrs = nil; + }; + list = $$($nesting, 'List').$new(parent, context); + if ($truthy(attrs)) { + list.$update_attributes(attrs)}; + return list; + }, TMP_Processor_create_list_9.$$arity = -3); + + Opal.def(self, '$create_list_item', TMP_Processor_create_list_item_10 = function $$create_list_item(parent, text) { + var self = this; + + + + if (text == null) { + text = nil; + }; + return $$($nesting, 'ListItem').$new(parent, text); + }, TMP_Processor_create_list_item_10.$$arity = -2); + + Opal.def(self, '$create_image_block', TMP_Processor_create_image_block_11 = function $$create_image_block(parent, attrs, opts) { + var $a, self = this, target = nil, $writer = nil, title = nil, block = nil; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + if ($truthy((target = attrs['$[]']("target")))) { + } else { + self.$raise($$$('::', 'ArgumentError'), "Unable to create an image block, target attribute is required") + }; + ($truthy($a = attrs['$[]']("alt")) ? $a : (($writer = ["alt", (($writer = ["default-alt", $$($nesting, 'Helpers').$basename(target, true).$tr("_-", " ")]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + title = (function() {if ($truthy(attrs['$key?']("title"))) { + + return attrs.$delete("title"); + } else { + return nil + }; return nil; })(); + block = self.$create_block(parent, "image", nil, attrs, opts); + if ($truthy(title)) { + + + $writer = [title]; + $send(block, 'title=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + block.$assign_caption(attrs.$delete("caption"), ($truthy($a = opts['$[]']("caption_context")) ? $a : "figure"));}; + return block; + }, TMP_Processor_create_image_block_11.$$arity = -3); + + Opal.def(self, '$create_inline', TMP_Processor_create_inline_12 = function $$create_inline(parent, context, text, opts) { + var self = this; + + + + if (opts == null) { + opts = $hash2([], {}); + }; + return $$($nesting, 'Inline').$new(parent, context, text, opts); + }, TMP_Processor_create_inline_12.$$arity = -4); + + Opal.def(self, '$parse_content', TMP_Processor_parse_content_13 = function $$parse_content(parent, content, attributes) { + var $a, $b, $c, self = this, reader = nil, block = nil; + + + + if (attributes == null) { + attributes = nil; + }; + reader = (function() {if ($truthy($$($nesting, 'Reader')['$==='](content))) { + return content + } else { + + return $$($nesting, 'Reader').$new(content); + }; return nil; })(); + while ($truthy(($truthy($b = ($truthy($c = (block = $$($nesting, 'Parser').$next_block(reader, parent, (function() {if ($truthy(attributes)) { + return attributes.$dup() + } else { + return $hash2([], {}) + }; return nil; })()))) ? parent['$<<'](block) : $c)) ? $b : reader['$has_more_lines?']()))) { + + }; + return parent; + }, TMP_Processor_parse_content_13.$$arity = -3); + return $send([["create_paragraph", "create_block", "paragraph"], ["create_open_block", "create_block", "open"], ["create_example_block", "create_block", "example"], ["create_pass_block", "create_block", "pass"], ["create_listing_block", "create_block", "listing"], ["create_literal_block", "create_block", "literal"], ["create_anchor", "create_inline", "anchor"]], 'each', [], (TMP_Processor_14 = function(method_name, delegate_method_name, context){var self = TMP_Processor_14.$$s || this, TMP_15; + + + + if (method_name == null) { + method_name = nil; + }; + + if (delegate_method_name == null) { + delegate_method_name = nil; + }; + + if (context == null) { + context = nil; + }; + return $send(self, 'define_method', [method_name], (TMP_15 = function($a){var self = TMP_15.$$s || this, $post_args, args; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + args.$unshift(args.$shift(), context); + return $send(self, 'send', [delegate_method_name].concat(Opal.to_a(args)));}, TMP_15.$$s = self, TMP_15.$$arity = -1, TMP_15));}, TMP_Processor_14.$$s = self, TMP_Processor_14.$$arity = 3, TMP_Processor_14)); + })($nesting[0], null, $nesting); + (function($base, $parent_nesting) { + function $ProcessorDsl() {}; + var self = $ProcessorDsl = $module($base, 'ProcessorDsl', $ProcessorDsl); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_ProcessorDsl_option_16, TMP_ProcessorDsl_process_17, TMP_ProcessorDsl_process_block_given$q_18; + + + + Opal.def(self, '$option', TMP_ProcessorDsl_option_16 = function $$option(key, value) { + var self = this, $writer = nil; + + + $writer = [key, value]; + $send(self.$config(), '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + }, TMP_ProcessorDsl_option_16.$$arity = 2); + + Opal.def(self, '$process', TMP_ProcessorDsl_process_17 = function $$process($a) { + var $iter = TMP_ProcessorDsl_process_17.$$p, block = $iter || nil, $post_args, args, $b, self = this; + if (self.process_block == null) self.process_block = nil; + + if ($iter) TMP_ProcessorDsl_process_17.$$p = null; + + + if ($iter) TMP_ProcessorDsl_process_17.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + if ((block !== nil)) { + + if ($truthy(args['$empty?']())) { + } else { + self.$raise($$$('::', 'ArgumentError'), "" + "wrong number of arguments (given " + (args.$size()) + ", expected 0)") + }; + return (self.process_block = block); + } else if ($truthy((($b = self['process_block'], $b != null && $b !== nil) ? 'instance-variable' : nil))) { + return $send(self.process_block, 'call', Opal.to_a(args)) + } else { + return self.$raise($$$('::', 'NotImplementedError')) + }; + }, TMP_ProcessorDsl_process_17.$$arity = -1); + + Opal.def(self, '$process_block_given?', TMP_ProcessorDsl_process_block_given$q_18 = function() { + var $a, self = this; + + return (($a = self['process_block'], $a != null && $a !== nil) ? 'instance-variable' : nil) + }, TMP_ProcessorDsl_process_block_given$q_18.$$arity = 0); + })($nesting[0], $nesting); + (function($base, $parent_nesting) { + function $DocumentProcessorDsl() {}; + var self = $DocumentProcessorDsl = $module($base, 'DocumentProcessorDsl', $DocumentProcessorDsl); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_DocumentProcessorDsl_prefer_19; + + + self.$include($$($nesting, 'ProcessorDsl')); + + Opal.def(self, '$prefer', TMP_DocumentProcessorDsl_prefer_19 = function $$prefer() { + var self = this; + + return self.$option("position", ">>") + }, TMP_DocumentProcessorDsl_prefer_19.$$arity = 0); + })($nesting[0], $nesting); + (function($base, $parent_nesting) { + function $SyntaxProcessorDsl() {}; + var self = $SyntaxProcessorDsl = $module($base, 'SyntaxProcessorDsl', $SyntaxProcessorDsl); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_SyntaxProcessorDsl_named_20, TMP_SyntaxProcessorDsl_content_model_21, TMP_SyntaxProcessorDsl_positional_attrs_22, TMP_SyntaxProcessorDsl_default_attrs_23, TMP_SyntaxProcessorDsl_resolves_attributes_24; + + + self.$include($$($nesting, 'ProcessorDsl')); + + Opal.def(self, '$named', TMP_SyntaxProcessorDsl_named_20 = function $$named(value) { + var self = this; + + if ($truthy($$($nesting, 'Processor')['$==='](self))) { + return (self.name = value) + } else { + return self.$option("name", value) + } + }, TMP_SyntaxProcessorDsl_named_20.$$arity = 1); + Opal.alias(self, "match_name", "named"); + + Opal.def(self, '$content_model', TMP_SyntaxProcessorDsl_content_model_21 = function $$content_model(value) { + var self = this; + + return self.$option("content_model", value) + }, TMP_SyntaxProcessorDsl_content_model_21.$$arity = 1); + Opal.alias(self, "parse_content_as", "content_model"); + Opal.alias(self, "parses_content_as", "content_model"); + + Opal.def(self, '$positional_attrs', TMP_SyntaxProcessorDsl_positional_attrs_22 = function $$positional_attrs($a) { + var $post_args, value, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + value = $post_args;; + return self.$option("pos_attrs", value.$flatten()); + }, TMP_SyntaxProcessorDsl_positional_attrs_22.$$arity = -1); + Opal.alias(self, "name_attributes", "positional_attrs"); + Opal.alias(self, "name_positional_attributes", "positional_attrs"); + + Opal.def(self, '$default_attrs', TMP_SyntaxProcessorDsl_default_attrs_23 = function $$default_attrs(value) { + var self = this; + + return self.$option("default_attrs", value) + }, TMP_SyntaxProcessorDsl_default_attrs_23.$$arity = 1); + + Opal.def(self, '$resolves_attributes', TMP_SyntaxProcessorDsl_resolves_attributes_24 = function $$resolves_attributes($a) { + var $post_args, args, $b, TMP_25, TMP_26, self = this, $case = nil, names = nil, defaults = nil; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + if ($truthy($rb_gt(args.$size(), 1))) { + } else if ($truthy((args = args.$fetch(0, true))['$respond_to?']("to_sym"))) { + args = [args]}; + return (function() {$case = args; + if (true['$===']($case)) { + self.$option("pos_attrs", []); + return self.$option("default_attrs", $hash2([], {}));} + else if ($$$('::', 'Array')['$===']($case)) { + $b = [[], $hash2([], {})], (names = $b[0]), (defaults = $b[1]), $b; + $send(args, 'each', [], (TMP_25 = function(arg){var self = TMP_25.$$s || this, $c, $d, name = nil, value = nil, idx = nil, $writer = nil; + + + + if (arg == null) { + arg = nil; + }; + if ($truthy((arg = arg.$to_s())['$include?']("="))) { + + $d = arg.$split("=", 2), $c = Opal.to_ary($d), (name = ($c[0] == null ? nil : $c[0])), (value = ($c[1] == null ? nil : $c[1])), $d; + if ($truthy(name['$include?'](":"))) { + + $d = name.$split(":", 2), $c = Opal.to_ary($d), (idx = ($c[0] == null ? nil : $c[0])), (name = ($c[1] == null ? nil : $c[1])), $d; + idx = (function() {if (idx['$==']("@")) { + return names.$size() + } else { + return idx.$to_i() + }; return nil; })(); + + $writer = [idx, name]; + $send(names, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];;}; + + $writer = [name, value]; + $send(defaults, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];; + } else if ($truthy(arg['$include?'](":"))) { + + $d = arg.$split(":", 2), $c = Opal.to_ary($d), (idx = ($c[0] == null ? nil : $c[0])), (name = ($c[1] == null ? nil : $c[1])), $d; + idx = (function() {if (idx['$==']("@")) { + return names.$size() + } else { + return idx.$to_i() + }; return nil; })(); + + $writer = [idx, name]; + $send(names, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];; + } else { + return names['$<<'](arg) + };}, TMP_25.$$s = self, TMP_25.$$arity = 1, TMP_25)); + self.$option("pos_attrs", names.$compact()); + return self.$option("default_attrs", defaults);} + else if ($$$('::', 'Hash')['$===']($case)) { + $b = [[], $hash2([], {})], (names = $b[0]), (defaults = $b[1]), $b; + $send(args, 'each', [], (TMP_26 = function(key, val){var self = TMP_26.$$s || this, $c, $d, name = nil, idx = nil, $writer = nil; + + + + if (key == null) { + key = nil; + }; + + if (val == null) { + val = nil; + }; + if ($truthy((name = key.$to_s())['$include?'](":"))) { + + $d = name.$split(":", 2), $c = Opal.to_ary($d), (idx = ($c[0] == null ? nil : $c[0])), (name = ($c[1] == null ? nil : $c[1])), $d; + idx = (function() {if (idx['$==']("@")) { + return names.$size() + } else { + return idx.$to_i() + }; return nil; })(); + + $writer = [idx, name]; + $send(names, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];;}; + if ($truthy(val)) { + + $writer = [name, val]; + $send(defaults, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)]; + } else { + return nil + };}, TMP_26.$$s = self, TMP_26.$$arity = 2, TMP_26)); + self.$option("pos_attrs", names.$compact()); + return self.$option("default_attrs", defaults);} + else {return self.$raise($$$('::', 'ArgumentError'), "" + "unsupported attributes specification for macro: " + (args.$inspect()))}})(); + }, TMP_SyntaxProcessorDsl_resolves_attributes_24.$$arity = -1); + Opal.alias(self, "resolve_attributes", "resolves_attributes"); + })($nesting[0], $nesting); + (function($base, $super, $parent_nesting) { + function $Preprocessor(){}; + var self = $Preprocessor = $klass($base, $super, 'Preprocessor', $Preprocessor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Preprocessor_process_27; + + return (Opal.def(self, '$process', TMP_Preprocessor_process_27 = function $$process(document, reader) { + var self = this; + + return self.$raise($$$('::', 'NotImplementedError'), "" + "Asciidoctor::Extensions::Preprocessor subclass must implement #" + ("process") + " method") + }, TMP_Preprocessor_process_27.$$arity = 2), nil) && 'process' + })($nesting[0], $$($nesting, 'Processor'), $nesting); + Opal.const_set($$($nesting, 'Preprocessor'), 'DSL', $$($nesting, 'DocumentProcessorDsl')); + (function($base, $super, $parent_nesting) { + function $TreeProcessor(){}; + var self = $TreeProcessor = $klass($base, $super, 'TreeProcessor', $TreeProcessor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_TreeProcessor_process_28; + + return (Opal.def(self, '$process', TMP_TreeProcessor_process_28 = function $$process(document) { + var self = this; + + return self.$raise($$$('::', 'NotImplementedError'), "" + "Asciidoctor::Extensions::TreeProcessor subclass must implement #" + ("process") + " method") + }, TMP_TreeProcessor_process_28.$$arity = 1), nil) && 'process' + })($nesting[0], $$($nesting, 'Processor'), $nesting); + Opal.const_set($$($nesting, 'TreeProcessor'), 'DSL', $$($nesting, 'DocumentProcessorDsl')); + Opal.const_set($nesting[0], 'Treeprocessor', $$($nesting, 'TreeProcessor')); + (function($base, $super, $parent_nesting) { + function $Postprocessor(){}; + var self = $Postprocessor = $klass($base, $super, 'Postprocessor', $Postprocessor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Postprocessor_process_29; + + return (Opal.def(self, '$process', TMP_Postprocessor_process_29 = function $$process(document, output) { + var self = this; + + return self.$raise($$$('::', 'NotImplementedError'), "" + "Asciidoctor::Extensions::Postprocessor subclass must implement #" + ("process") + " method") + }, TMP_Postprocessor_process_29.$$arity = 2), nil) && 'process' + })($nesting[0], $$($nesting, 'Processor'), $nesting); + Opal.const_set($$($nesting, 'Postprocessor'), 'DSL', $$($nesting, 'DocumentProcessorDsl')); + (function($base, $super, $parent_nesting) { + function $IncludeProcessor(){}; + var self = $IncludeProcessor = $klass($base, $super, 'IncludeProcessor', $IncludeProcessor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_IncludeProcessor_process_30, TMP_IncludeProcessor_handles$q_31; + + + + Opal.def(self, '$process', TMP_IncludeProcessor_process_30 = function $$process(document, reader, target, attributes) { + var self = this; + + return self.$raise($$$('::', 'NotImplementedError'), "" + "Asciidoctor::Extensions::IncludeProcessor subclass must implement #" + ("process") + " method") + }, TMP_IncludeProcessor_process_30.$$arity = 4); + return (Opal.def(self, '$handles?', TMP_IncludeProcessor_handles$q_31 = function(target) { + var self = this; + + return true + }, TMP_IncludeProcessor_handles$q_31.$$arity = 1), nil) && 'handles?'; + })($nesting[0], $$($nesting, 'Processor'), $nesting); + (function($base, $parent_nesting) { + function $IncludeProcessorDsl() {}; + var self = $IncludeProcessorDsl = $module($base, 'IncludeProcessorDsl', $IncludeProcessorDsl); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_IncludeProcessorDsl_handles$q_32; + + + self.$include($$($nesting, 'DocumentProcessorDsl')); + + Opal.def(self, '$handles?', TMP_IncludeProcessorDsl_handles$q_32 = function($a) { + var $iter = TMP_IncludeProcessorDsl_handles$q_32.$$p, block = $iter || nil, $post_args, args, $b, self = this; + if (self.handles_block == null) self.handles_block = nil; + + if ($iter) TMP_IncludeProcessorDsl_handles$q_32.$$p = null; + + + if ($iter) TMP_IncludeProcessorDsl_handles$q_32.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + if ((block !== nil)) { + + if ($truthy(args['$empty?']())) { + } else { + self.$raise($$$('::', 'ArgumentError'), "" + "wrong number of arguments (given " + (args.$size()) + ", expected 0)") + }; + return (self.handles_block = block); + } else if ($truthy((($b = self['handles_block'], $b != null && $b !== nil) ? 'instance-variable' : nil))) { + return self.handles_block.$call(args['$[]'](0)) + } else { + return true + }; + }, TMP_IncludeProcessorDsl_handles$q_32.$$arity = -1); + })($nesting[0], $nesting); + Opal.const_set($$($nesting, 'IncludeProcessor'), 'DSL', $$($nesting, 'IncludeProcessorDsl')); + (function($base, $super, $parent_nesting) { + function $DocinfoProcessor(){}; + var self = $DocinfoProcessor = $klass($base, $super, 'DocinfoProcessor', $DocinfoProcessor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_DocinfoProcessor_initialize_33, TMP_DocinfoProcessor_process_34; + + def.config = nil; + + self.$attr_accessor("location"); + + Opal.def(self, '$initialize', TMP_DocinfoProcessor_initialize_33 = function $$initialize(config) { + var $a, $iter = TMP_DocinfoProcessor_initialize_33.$$p, $yield = $iter || nil, self = this, $writer = nil; + + if ($iter) TMP_DocinfoProcessor_initialize_33.$$p = null; + + + if (config == null) { + config = $hash2([], {}); + }; + $send(self, Opal.find_super_dispatcher(self, 'initialize', TMP_DocinfoProcessor_initialize_33, false), [config], null); + return ($truthy($a = self.config['$[]']("location")) ? $a : (($writer = ["location", "head"]), $send(self.config, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + }, TMP_DocinfoProcessor_initialize_33.$$arity = -1); + return (Opal.def(self, '$process', TMP_DocinfoProcessor_process_34 = function $$process(document) { + var self = this; + + return self.$raise($$$('::', 'NotImplementedError'), "" + "Asciidoctor::Extensions::DocinfoProcessor subclass must implement #" + ("process") + " method") + }, TMP_DocinfoProcessor_process_34.$$arity = 1), nil) && 'process'; + })($nesting[0], $$($nesting, 'Processor'), $nesting); + (function($base, $parent_nesting) { + function $DocinfoProcessorDsl() {}; + var self = $DocinfoProcessorDsl = $module($base, 'DocinfoProcessorDsl', $DocinfoProcessorDsl); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_DocinfoProcessorDsl_at_location_35; + + + self.$include($$($nesting, 'DocumentProcessorDsl')); + + Opal.def(self, '$at_location', TMP_DocinfoProcessorDsl_at_location_35 = function $$at_location(value) { + var self = this; + + return self.$option("location", value) + }, TMP_DocinfoProcessorDsl_at_location_35.$$arity = 1); + })($nesting[0], $nesting); + Opal.const_set($$($nesting, 'DocinfoProcessor'), 'DSL', $$($nesting, 'DocinfoProcessorDsl')); + (function($base, $super, $parent_nesting) { + function $BlockProcessor(){}; + var self = $BlockProcessor = $klass($base, $super, 'BlockProcessor', $BlockProcessor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_BlockProcessor_initialize_36, TMP_BlockProcessor_process_37; + + def.config = nil; + + self.$attr_accessor("name"); + + Opal.def(self, '$initialize', TMP_BlockProcessor_initialize_36 = function $$initialize(name, config) { + var $a, $iter = TMP_BlockProcessor_initialize_36.$$p, $yield = $iter || nil, self = this, $case = nil, $writer = nil; + + if ($iter) TMP_BlockProcessor_initialize_36.$$p = null; + + + if (name == null) { + name = nil; + }; + + if (config == null) { + config = $hash2([], {}); + }; + $send(self, Opal.find_super_dispatcher(self, 'initialize', TMP_BlockProcessor_initialize_36, false), [config], null); + self.name = ($truthy($a = name) ? $a : self.config['$[]']("name")); + $case = self.config['$[]']("contexts"); + if ($$$('::', 'NilClass')['$===']($case)) {($truthy($a = self.config['$[]']("contexts")) ? $a : (($writer = ["contexts", ["open", "paragraph"].$to_set()]), $send(self.config, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]))} + else if ($$$('::', 'Symbol')['$===']($case)) { + $writer = ["contexts", [self.config['$[]']("contexts")].$to_set()]; + $send(self.config, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];} + else { + $writer = ["contexts", self.config['$[]']("contexts").$to_set()]; + $send(self.config, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + return ($truthy($a = self.config['$[]']("content_model")) ? $a : (($writer = ["content_model", "compound"]), $send(self.config, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + }, TMP_BlockProcessor_initialize_36.$$arity = -1); + return (Opal.def(self, '$process', TMP_BlockProcessor_process_37 = function $$process(parent, reader, attributes) { + var self = this; + + return self.$raise($$$('::', 'NotImplementedError'), "" + "Asciidoctor::Extensions::BlockProcessor subclass must implement #" + ("process") + " method") + }, TMP_BlockProcessor_process_37.$$arity = 3), nil) && 'process'; + })($nesting[0], $$($nesting, 'Processor'), $nesting); + (function($base, $parent_nesting) { + function $BlockProcessorDsl() {}; + var self = $BlockProcessorDsl = $module($base, 'BlockProcessorDsl', $BlockProcessorDsl); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_BlockProcessorDsl_contexts_38; + + + self.$include($$($nesting, 'SyntaxProcessorDsl')); + + Opal.def(self, '$contexts', TMP_BlockProcessorDsl_contexts_38 = function $$contexts($a) { + var $post_args, value, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + value = $post_args;; + return self.$option("contexts", value.$flatten().$to_set()); + }, TMP_BlockProcessorDsl_contexts_38.$$arity = -1); + Opal.alias(self, "on_contexts", "contexts"); + Opal.alias(self, "on_context", "contexts"); + Opal.alias(self, "bound_to", "contexts"); + })($nesting[0], $nesting); + Opal.const_set($$($nesting, 'BlockProcessor'), 'DSL', $$($nesting, 'BlockProcessorDsl')); + (function($base, $super, $parent_nesting) { + function $MacroProcessor(){}; + var self = $MacroProcessor = $klass($base, $super, 'MacroProcessor', $MacroProcessor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_MacroProcessor_initialize_39, TMP_MacroProcessor_process_40; + + def.config = nil; + + self.$attr_accessor("name"); + + Opal.def(self, '$initialize', TMP_MacroProcessor_initialize_39 = function $$initialize(name, config) { + var $a, $iter = TMP_MacroProcessor_initialize_39.$$p, $yield = $iter || nil, self = this, $writer = nil; + + if ($iter) TMP_MacroProcessor_initialize_39.$$p = null; + + + if (name == null) { + name = nil; + }; + + if (config == null) { + config = $hash2([], {}); + }; + $send(self, Opal.find_super_dispatcher(self, 'initialize', TMP_MacroProcessor_initialize_39, false), [config], null); + self.name = ($truthy($a = name) ? $a : self.config['$[]']("name")); + return ($truthy($a = self.config['$[]']("content_model")) ? $a : (($writer = ["content_model", "attributes"]), $send(self.config, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + }, TMP_MacroProcessor_initialize_39.$$arity = -1); + return (Opal.def(self, '$process', TMP_MacroProcessor_process_40 = function $$process(parent, target, attributes) { + var self = this; + + return self.$raise($$$('::', 'NotImplementedError'), "" + "Asciidoctor::Extensions::MacroProcessor subclass must implement #" + ("process") + " method") + }, TMP_MacroProcessor_process_40.$$arity = 3), nil) && 'process'; + })($nesting[0], $$($nesting, 'Processor'), $nesting); + (function($base, $parent_nesting) { + function $MacroProcessorDsl() {}; + var self = $MacroProcessorDsl = $module($base, 'MacroProcessorDsl', $MacroProcessorDsl); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_MacroProcessorDsl_resolves_attributes_41; + + + self.$include($$($nesting, 'SyntaxProcessorDsl')); + + Opal.def(self, '$resolves_attributes', TMP_MacroProcessorDsl_resolves_attributes_41 = function $$resolves_attributes($a) { + var $post_args, args, $b, $iter = TMP_MacroProcessorDsl_resolves_attributes_41.$$p, $yield = $iter || nil, self = this, $zuper = nil, $zuper_i = nil, $zuper_ii = nil; + + if ($iter) TMP_MacroProcessorDsl_resolves_attributes_41.$$p = null; + // Prepare super implicit arguments + for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) { + $zuper[$zuper_i] = arguments[$zuper_i]; + } + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + if ($truthy((($b = args.$size()['$=='](1)) ? args['$[]'](0)['$!']() : args.$size()['$=='](1)))) { + + self.$option("content_model", "text"); + return nil;}; + $send(self, Opal.find_super_dispatcher(self, 'resolves_attributes', TMP_MacroProcessorDsl_resolves_attributes_41, false), $zuper, $iter); + return self.$option("content_model", "attributes"); + }, TMP_MacroProcessorDsl_resolves_attributes_41.$$arity = -1); + Opal.alias(self, "resolve_attributes", "resolves_attributes"); + })($nesting[0], $nesting); + (function($base, $super, $parent_nesting) { + function $BlockMacroProcessor(){}; + var self = $BlockMacroProcessor = $klass($base, $super, 'BlockMacroProcessor', $BlockMacroProcessor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_BlockMacroProcessor_name_42; + + def.name = nil; + return (Opal.def(self, '$name', TMP_BlockMacroProcessor_name_42 = function $$name() { + var self = this; + + + if ($truthy($$($nesting, 'MacroNameRx')['$match?'](self.name.$to_s()))) { + } else { + self.$raise($$$('::', 'ArgumentError'), "" + "invalid name for block macro: " + (self.name)) + }; + return self.name; + }, TMP_BlockMacroProcessor_name_42.$$arity = 0), nil) && 'name' + })($nesting[0], $$($nesting, 'MacroProcessor'), $nesting); + Opal.const_set($$($nesting, 'BlockMacroProcessor'), 'DSL', $$($nesting, 'MacroProcessorDsl')); + (function($base, $super, $parent_nesting) { + function $InlineMacroProcessor(){}; + var self = $InlineMacroProcessor = $klass($base, $super, 'InlineMacroProcessor', $InlineMacroProcessor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_InlineMacroProcessor_regexp_43, TMP_InlineMacroProcessor_resolve_regexp_44; + + def.config = def.name = nil; + + (Opal.class_variable_set($InlineMacroProcessor, '@@rx_cache', $hash2([], {}))); + + Opal.def(self, '$regexp', TMP_InlineMacroProcessor_regexp_43 = function $$regexp() { + var $a, self = this, $writer = nil; + + return ($truthy($a = self.config['$[]']("regexp")) ? $a : (($writer = ["regexp", self.$resolve_regexp(self.name.$to_s(), self.config['$[]']("format"))]), $send(self.config, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])) + }, TMP_InlineMacroProcessor_regexp_43.$$arity = 0); + return (Opal.def(self, '$resolve_regexp', TMP_InlineMacroProcessor_resolve_regexp_44 = function $$resolve_regexp(name, format) { + var $a, $b, self = this, $writer = nil; + + + if ($truthy($$($nesting, 'MacroNameRx')['$match?'](name))) { + } else { + self.$raise($$$('::', 'ArgumentError'), "" + "invalid name for inline macro: " + (name)) + }; + return ($truthy($a = (($b = $InlineMacroProcessor.$$cvars['@@rx_cache']) == null ? nil : $b)['$[]']([name, format])) ? $a : (($writer = [[name, format], new RegExp("" + "\\\\?" + (name) + ":" + ((function() {if (format['$==']("short")) { + return "(){0}" + } else { + return "(\\S+?)" + }; return nil; })()) + "\\[(|.*?[^\\\\])\\]")]), $send((($b = $InlineMacroProcessor.$$cvars['@@rx_cache']) == null ? nil : $b), '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + }, TMP_InlineMacroProcessor_resolve_regexp_44.$$arity = 2), nil) && 'resolve_regexp'; + })($nesting[0], $$($nesting, 'MacroProcessor'), $nesting); + (function($base, $parent_nesting) { + function $InlineMacroProcessorDsl() {}; + var self = $InlineMacroProcessorDsl = $module($base, 'InlineMacroProcessorDsl', $InlineMacroProcessorDsl); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_InlineMacroProcessorDsl_with_format_45, TMP_InlineMacroProcessorDsl_matches_46; + + + self.$include($$($nesting, 'MacroProcessorDsl')); + + Opal.def(self, '$with_format', TMP_InlineMacroProcessorDsl_with_format_45 = function $$with_format(value) { + var self = this; + + return self.$option("format", value) + }, TMP_InlineMacroProcessorDsl_with_format_45.$$arity = 1); + Opal.alias(self, "using_format", "with_format"); + + Opal.def(self, '$matches', TMP_InlineMacroProcessorDsl_matches_46 = function $$matches(value) { + var self = this; + + return self.$option("regexp", value) + }, TMP_InlineMacroProcessorDsl_matches_46.$$arity = 1); + Opal.alias(self, "match", "matches"); + Opal.alias(self, "matching", "matches"); + })($nesting[0], $nesting); + Opal.const_set($$($nesting, 'InlineMacroProcessor'), 'DSL', $$($nesting, 'InlineMacroProcessorDsl')); + (function($base, $super, $parent_nesting) { + function $Extension(){}; + var self = $Extension = $klass($base, $super, 'Extension', $Extension); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Extension_initialize_47; + + + self.$attr_reader("kind"); + self.$attr_reader("config"); + self.$attr_reader("instance"); + return (Opal.def(self, '$initialize', TMP_Extension_initialize_47 = function $$initialize(kind, instance, config) { + var self = this; + + + self.kind = kind; + self.instance = instance; + return (self.config = config); + }, TMP_Extension_initialize_47.$$arity = 3), nil) && 'initialize'; + })($nesting[0], null, $nesting); + (function($base, $super, $parent_nesting) { + function $ProcessorExtension(){}; + var self = $ProcessorExtension = $klass($base, $super, 'ProcessorExtension', $ProcessorExtension); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_ProcessorExtension_initialize_48; + + + self.$attr_reader("process_method"); + return (Opal.def(self, '$initialize', TMP_ProcessorExtension_initialize_48 = function $$initialize(kind, instance, process_method) { + var $a, $iter = TMP_ProcessorExtension_initialize_48.$$p, $yield = $iter || nil, self = this; + + if ($iter) TMP_ProcessorExtension_initialize_48.$$p = null; + + + if (process_method == null) { + process_method = nil; + }; + $send(self, Opal.find_super_dispatcher(self, 'initialize', TMP_ProcessorExtension_initialize_48, false), [kind, instance, instance.$config()], null); + return (self.process_method = ($truthy($a = process_method) ? $a : instance.$method("process"))); + }, TMP_ProcessorExtension_initialize_48.$$arity = -3), nil) && 'initialize'; + })($nesting[0], $$($nesting, 'Extension'), $nesting); + (function($base, $super, $parent_nesting) { + function $Group(){}; + var self = $Group = $klass($base, $super, 'Group', $Group); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Group_activate_50; + + + (function(self, $parent_nesting) { + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_register_49; + + return (Opal.def(self, '$register', TMP_register_49 = function $$register(name) { + var self = this; + + + + if (name == null) { + name = nil; + }; + return $$($nesting, 'Extensions').$register(name, self); + }, TMP_register_49.$$arity = -1), nil) && 'register' + })(Opal.get_singleton_class(self), $nesting); + return (Opal.def(self, '$activate', TMP_Group_activate_50 = function $$activate(registry) { + var self = this; + + return self.$raise($$$('::', 'NotImplementedError')) + }, TMP_Group_activate_50.$$arity = 1), nil) && 'activate'; + })($nesting[0], null, $nesting); + (function($base, $super, $parent_nesting) { + function $Registry(){}; + var self = $Registry = $klass($base, $super, 'Registry', $Registry); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Registry_initialize_51, TMP_Registry_activate_52, TMP_Registry_preprocessor_54, TMP_Registry_preprocessors$q_55, TMP_Registry_preprocessors_56, TMP_Registry_tree_processor_57, TMP_Registry_tree_processors$q_58, TMP_Registry_tree_processors_59, TMP_Registry_postprocessor_60, TMP_Registry_postprocessors$q_61, TMP_Registry_postprocessors_62, TMP_Registry_include_processor_63, TMP_Registry_include_processors$q_64, TMP_Registry_include_processors_65, TMP_Registry_docinfo_processor_66, TMP_Registry_docinfo_processors$q_67, TMP_Registry_docinfo_processors_69, TMP_Registry_block_71, TMP_Registry_blocks$q_72, TMP_Registry_registered_for_block$q_73, TMP_Registry_find_block_extension_74, TMP_Registry_block_macro_75, TMP_Registry_block_macros$q_76, TMP_Registry_registered_for_block_macro$q_77, TMP_Registry_find_block_macro_extension_78, TMP_Registry_inline_macro_79, TMP_Registry_inline_macros$q_80, TMP_Registry_registered_for_inline_macro$q_81, TMP_Registry_find_inline_macro_extension_82, TMP_Registry_inline_macros_83, TMP_Registry_prefer_84, TMP_Registry_add_document_processor_85, TMP_Registry_add_syntax_processor_87, TMP_Registry_resolve_args_89, TMP_Registry_as_symbol_90; + + def.groups = def.preprocessor_extensions = def.tree_processor_extensions = def.postprocessor_extensions = def.include_processor_extensions = def.docinfo_processor_extensions = def.block_extensions = def.block_macro_extensions = def.inline_macro_extensions = nil; + + self.$attr_reader("document"); + self.$attr_reader("groups"); + + Opal.def(self, '$initialize', TMP_Registry_initialize_51 = function $$initialize(groups) { + var self = this; + + + + if (groups == null) { + groups = $hash2([], {}); + }; + self.groups = groups; + self.preprocessor_extensions = (self.tree_processor_extensions = (self.postprocessor_extensions = (self.include_processor_extensions = (self.docinfo_processor_extensions = (self.block_extensions = (self.block_macro_extensions = (self.inline_macro_extensions = nil))))))); + return (self.document = nil); + }, TMP_Registry_initialize_51.$$arity = -1); + + Opal.def(self, '$activate', TMP_Registry_activate_52 = function $$activate(document) { + var TMP_53, self = this, ext_groups = nil; + + + self.document = document; + if ($truthy((ext_groups = $rb_plus($$($nesting, 'Extensions').$groups().$values(), self.groups.$values()))['$empty?']())) { + } else { + $send(ext_groups, 'each', [], (TMP_53 = function(group){var self = TMP_53.$$s || this, $case = nil; + + + + if (group == null) { + group = nil; + }; + return (function() {$case = group; + if ($$$('::', 'Proc')['$===']($case)) {return (function() {$case = group.$arity(); + if ((0)['$===']($case) || (-1)['$===']($case)) {return $send(self, 'instance_exec', [], group.$to_proc())} + else if ((1)['$===']($case)) {return group.$call(self)} + else { return nil }})()} + else if ($$$('::', 'Class')['$===']($case)) {return group.$new().$activate(self)} + else {return group.$activate(self)}})();}, TMP_53.$$s = self, TMP_53.$$arity = 1, TMP_53)) + }; + return self; + }, TMP_Registry_activate_52.$$arity = 1); + + Opal.def(self, '$preprocessor', TMP_Registry_preprocessor_54 = function $$preprocessor($a) { + var $iter = TMP_Registry_preprocessor_54.$$p, block = $iter || nil, $post_args, args, self = this; + + if ($iter) TMP_Registry_preprocessor_54.$$p = null; + + + if ($iter) TMP_Registry_preprocessor_54.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + return $send(self, 'add_document_processor', ["preprocessor", args], block.$to_proc()); + }, TMP_Registry_preprocessor_54.$$arity = -1); + + Opal.def(self, '$preprocessors?', TMP_Registry_preprocessors$q_55 = function() { + var self = this; + + return self.preprocessor_extensions['$!']()['$!']() + }, TMP_Registry_preprocessors$q_55.$$arity = 0); + + Opal.def(self, '$preprocessors', TMP_Registry_preprocessors_56 = function $$preprocessors() { + var self = this; + + return self.preprocessor_extensions + }, TMP_Registry_preprocessors_56.$$arity = 0); + + Opal.def(self, '$tree_processor', TMP_Registry_tree_processor_57 = function $$tree_processor($a) { + var $iter = TMP_Registry_tree_processor_57.$$p, block = $iter || nil, $post_args, args, self = this; + + if ($iter) TMP_Registry_tree_processor_57.$$p = null; + + + if ($iter) TMP_Registry_tree_processor_57.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + return $send(self, 'add_document_processor', ["tree_processor", args], block.$to_proc()); + }, TMP_Registry_tree_processor_57.$$arity = -1); + + Opal.def(self, '$tree_processors?', TMP_Registry_tree_processors$q_58 = function() { + var self = this; + + return self.tree_processor_extensions['$!']()['$!']() + }, TMP_Registry_tree_processors$q_58.$$arity = 0); + + Opal.def(self, '$tree_processors', TMP_Registry_tree_processors_59 = function $$tree_processors() { + var self = this; + + return self.tree_processor_extensions + }, TMP_Registry_tree_processors_59.$$arity = 0); + Opal.alias(self, "treeprocessor", "tree_processor"); + Opal.alias(self, "treeprocessors?", "tree_processors?"); + Opal.alias(self, "treeprocessors", "tree_processors"); + + Opal.def(self, '$postprocessor', TMP_Registry_postprocessor_60 = function $$postprocessor($a) { + var $iter = TMP_Registry_postprocessor_60.$$p, block = $iter || nil, $post_args, args, self = this; + + if ($iter) TMP_Registry_postprocessor_60.$$p = null; + + + if ($iter) TMP_Registry_postprocessor_60.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + return $send(self, 'add_document_processor', ["postprocessor", args], block.$to_proc()); + }, TMP_Registry_postprocessor_60.$$arity = -1); + + Opal.def(self, '$postprocessors?', TMP_Registry_postprocessors$q_61 = function() { + var self = this; + + return self.postprocessor_extensions['$!']()['$!']() + }, TMP_Registry_postprocessors$q_61.$$arity = 0); + + Opal.def(self, '$postprocessors', TMP_Registry_postprocessors_62 = function $$postprocessors() { + var self = this; + + return self.postprocessor_extensions + }, TMP_Registry_postprocessors_62.$$arity = 0); + + Opal.def(self, '$include_processor', TMP_Registry_include_processor_63 = function $$include_processor($a) { + var $iter = TMP_Registry_include_processor_63.$$p, block = $iter || nil, $post_args, args, self = this; + + if ($iter) TMP_Registry_include_processor_63.$$p = null; + + + if ($iter) TMP_Registry_include_processor_63.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + return $send(self, 'add_document_processor', ["include_processor", args], block.$to_proc()); + }, TMP_Registry_include_processor_63.$$arity = -1); + + Opal.def(self, '$include_processors?', TMP_Registry_include_processors$q_64 = function() { + var self = this; + + return self.include_processor_extensions['$!']()['$!']() + }, TMP_Registry_include_processors$q_64.$$arity = 0); + + Opal.def(self, '$include_processors', TMP_Registry_include_processors_65 = function $$include_processors() { + var self = this; + + return self.include_processor_extensions + }, TMP_Registry_include_processors_65.$$arity = 0); + + Opal.def(self, '$docinfo_processor', TMP_Registry_docinfo_processor_66 = function $$docinfo_processor($a) { + var $iter = TMP_Registry_docinfo_processor_66.$$p, block = $iter || nil, $post_args, args, self = this; + + if ($iter) TMP_Registry_docinfo_processor_66.$$p = null; + + + if ($iter) TMP_Registry_docinfo_processor_66.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + return $send(self, 'add_document_processor', ["docinfo_processor", args], block.$to_proc()); + }, TMP_Registry_docinfo_processor_66.$$arity = -1); + + Opal.def(self, '$docinfo_processors?', TMP_Registry_docinfo_processors$q_67 = function(location) { + var TMP_68, self = this; + + + + if (location == null) { + location = nil; + }; + if ($truthy(self.docinfo_processor_extensions)) { + if ($truthy(location)) { + return $send(self.docinfo_processor_extensions, 'any?', [], (TMP_68 = function(ext){var self = TMP_68.$$s || this; + + + + if (ext == null) { + ext = nil; + }; + return ext.$config()['$[]']("location")['$=='](location);}, TMP_68.$$s = self, TMP_68.$$arity = 1, TMP_68)) + } else { + return true + } + } else { + return false + }; + }, TMP_Registry_docinfo_processors$q_67.$$arity = -1); + + Opal.def(self, '$docinfo_processors', TMP_Registry_docinfo_processors_69 = function $$docinfo_processors(location) { + var TMP_70, self = this; + + + + if (location == null) { + location = nil; + }; + if ($truthy(self.docinfo_processor_extensions)) { + if ($truthy(location)) { + return $send(self.docinfo_processor_extensions, 'select', [], (TMP_70 = function(ext){var self = TMP_70.$$s || this; + + + + if (ext == null) { + ext = nil; + }; + return ext.$config()['$[]']("location")['$=='](location);}, TMP_70.$$s = self, TMP_70.$$arity = 1, TMP_70)) + } else { + return self.docinfo_processor_extensions + } + } else { + return nil + }; + }, TMP_Registry_docinfo_processors_69.$$arity = -1); + + Opal.def(self, '$block', TMP_Registry_block_71 = function $$block($a) { + var $iter = TMP_Registry_block_71.$$p, block = $iter || nil, $post_args, args, self = this; + + if ($iter) TMP_Registry_block_71.$$p = null; + + + if ($iter) TMP_Registry_block_71.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + return $send(self, 'add_syntax_processor', ["block", args], block.$to_proc()); + }, TMP_Registry_block_71.$$arity = -1); + + Opal.def(self, '$blocks?', TMP_Registry_blocks$q_72 = function() { + var self = this; + + return self.block_extensions['$!']()['$!']() + }, TMP_Registry_blocks$q_72.$$arity = 0); + + Opal.def(self, '$registered_for_block?', TMP_Registry_registered_for_block$q_73 = function(name, context) { + var self = this, ext = nil; + + if ($truthy((ext = self.block_extensions['$[]'](name.$to_sym())))) { + if ($truthy(ext.$config()['$[]']("contexts")['$include?'](context))) { + return ext + } else { + return false + } + } else { + return false + } + }, TMP_Registry_registered_for_block$q_73.$$arity = 2); + + Opal.def(self, '$find_block_extension', TMP_Registry_find_block_extension_74 = function $$find_block_extension(name) { + var self = this; + + return self.block_extensions['$[]'](name.$to_sym()) + }, TMP_Registry_find_block_extension_74.$$arity = 1); + + Opal.def(self, '$block_macro', TMP_Registry_block_macro_75 = function $$block_macro($a) { + var $iter = TMP_Registry_block_macro_75.$$p, block = $iter || nil, $post_args, args, self = this; + + if ($iter) TMP_Registry_block_macro_75.$$p = null; + + + if ($iter) TMP_Registry_block_macro_75.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + return $send(self, 'add_syntax_processor', ["block_macro", args], block.$to_proc()); + }, TMP_Registry_block_macro_75.$$arity = -1); + + Opal.def(self, '$block_macros?', TMP_Registry_block_macros$q_76 = function() { + var self = this; + + return self.block_macro_extensions['$!']()['$!']() + }, TMP_Registry_block_macros$q_76.$$arity = 0); + + Opal.def(self, '$registered_for_block_macro?', TMP_Registry_registered_for_block_macro$q_77 = function(name) { + var self = this, ext = nil; + + if ($truthy((ext = self.block_macro_extensions['$[]'](name.$to_sym())))) { + return ext + } else { + return false + } + }, TMP_Registry_registered_for_block_macro$q_77.$$arity = 1); + + Opal.def(self, '$find_block_macro_extension', TMP_Registry_find_block_macro_extension_78 = function $$find_block_macro_extension(name) { + var self = this; + + return self.block_macro_extensions['$[]'](name.$to_sym()) + }, TMP_Registry_find_block_macro_extension_78.$$arity = 1); + + Opal.def(self, '$inline_macro', TMP_Registry_inline_macro_79 = function $$inline_macro($a) { + var $iter = TMP_Registry_inline_macro_79.$$p, block = $iter || nil, $post_args, args, self = this; + + if ($iter) TMP_Registry_inline_macro_79.$$p = null; + + + if ($iter) TMP_Registry_inline_macro_79.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + return $send(self, 'add_syntax_processor', ["inline_macro", args], block.$to_proc()); + }, TMP_Registry_inline_macro_79.$$arity = -1); + + Opal.def(self, '$inline_macros?', TMP_Registry_inline_macros$q_80 = function() { + var self = this; + + return self.inline_macro_extensions['$!']()['$!']() + }, TMP_Registry_inline_macros$q_80.$$arity = 0); + + Opal.def(self, '$registered_for_inline_macro?', TMP_Registry_registered_for_inline_macro$q_81 = function(name) { + var self = this, ext = nil; + + if ($truthy((ext = self.inline_macro_extensions['$[]'](name.$to_sym())))) { + return ext + } else { + return false + } + }, TMP_Registry_registered_for_inline_macro$q_81.$$arity = 1); + + Opal.def(self, '$find_inline_macro_extension', TMP_Registry_find_inline_macro_extension_82 = function $$find_inline_macro_extension(name) { + var self = this; + + return self.inline_macro_extensions['$[]'](name.$to_sym()) + }, TMP_Registry_find_inline_macro_extension_82.$$arity = 1); + + Opal.def(self, '$inline_macros', TMP_Registry_inline_macros_83 = function $$inline_macros() { + var self = this; + + return self.inline_macro_extensions.$values() + }, TMP_Registry_inline_macros_83.$$arity = 0); + + Opal.def(self, '$prefer', TMP_Registry_prefer_84 = function $$prefer($a) { + var $iter = TMP_Registry_prefer_84.$$p, block = $iter || nil, $post_args, args, self = this, extension = nil, arg0 = nil, extensions_store = nil; + + if ($iter) TMP_Registry_prefer_84.$$p = null; + + + if ($iter) TMP_Registry_prefer_84.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + extension = (function() {if ($truthy($$($nesting, 'ProcessorExtension')['$===']((arg0 = args.$shift())))) { + return arg0 + } else { + + return $send(self, 'send', [arg0].concat(Opal.to_a(args)), block.$to_proc()); + }; return nil; })(); + extensions_store = self.$instance_variable_get(((("" + "@") + (extension.$kind())) + "_extensions").$to_sym()); + extensions_store.$unshift(extensions_store.$delete(extension)); + return extension; + }, TMP_Registry_prefer_84.$$arity = -1); + self.$private(); + + Opal.def(self, '$add_document_processor', TMP_Registry_add_document_processor_85 = function $$add_document_processor(kind, args) { + var $iter = TMP_Registry_add_document_processor_85.$$p, block = $iter || nil, TMP_86, $a, $b, $c, self = this, kind_name = nil, kind_class_symbol = nil, kind_class = nil, kind_java_class = nil, kind_store = nil, extension = nil, config = nil, processor = nil, processor_class = nil, processor_instance = nil; + + if ($iter) TMP_Registry_add_document_processor_85.$$p = null; + + + if ($iter) TMP_Registry_add_document_processor_85.$$p = null;; + kind_name = kind.$to_s().$tr("_", " "); + kind_class_symbol = $send(kind_name.$split(), 'map', [], (TMP_86 = function(it){var self = TMP_86.$$s || this; + + + + if (it == null) { + it = nil; + }; + return it.$capitalize();}, TMP_86.$$s = self, TMP_86.$$arity = 1, TMP_86)).$join().$to_sym(); + kind_class = $$($nesting, 'Extensions').$const_get(kind_class_symbol); + kind_java_class = (function() {if ($truthy((($a = $$$('::', 'AsciidoctorJ', 'skip_raise')) ? 'constant' : nil))) { + + return $$$($$$('::', 'AsciidoctorJ'), 'Extensions').$const_get(kind_class_symbol); + } else { + return nil + }; return nil; })(); + kind_store = ($truthy($b = self.$instance_variable_get(((("" + "@") + (kind)) + "_extensions").$to_sym())) ? $b : self.$instance_variable_set(((("" + "@") + (kind)) + "_extensions").$to_sym(), [])); + extension = (function() {if ((block !== nil)) { + + config = self.$resolve_args(args, 1); + processor = kind_class.$new(config); + if ($truthy(kind_class.$constants().$grep("DSL"))) { + processor.$extend(kind_class.$const_get("DSL"))}; + $send(processor, 'instance_exec', [], block.$to_proc()); + processor.$freeze(); + if ($truthy(processor['$process_block_given?']())) { + } else { + self.$raise($$$('::', 'ArgumentError'), "" + "No block specified to process " + (kind_name) + " extension at " + (block.$source_location())) + }; + return $$($nesting, 'ProcessorExtension').$new(kind, processor); + } else { + + $c = self.$resolve_args(args, 2), $b = Opal.to_ary($c), (processor = ($b[0] == null ? nil : $b[0])), (config = ($b[1] == null ? nil : $b[1])), $c; + if ($truthy((processor_class = $$($nesting, 'Extensions').$resolve_class(processor)))) { + + if ($truthy(($truthy($b = $rb_lt(processor_class, kind_class)) ? $b : ($truthy($c = kind_java_class) ? $rb_lt(processor_class, kind_java_class) : $c)))) { + } else { + self.$raise($$$('::', 'ArgumentError'), "" + "Invalid type for " + (kind_name) + " extension: " + (processor)) + }; + processor_instance = processor_class.$new(config); + processor_instance.$freeze(); + return $$($nesting, 'ProcessorExtension').$new(kind, processor_instance); + } else if ($truthy(($truthy($b = kind_class['$==='](processor)) ? $b : ($truthy($c = kind_java_class) ? kind_java_class['$==='](processor) : $c)))) { + + processor.$update_config(config); + processor.$freeze(); + return $$($nesting, 'ProcessorExtension').$new(kind, processor); + } else { + return self.$raise($$$('::', 'ArgumentError'), "" + "Invalid arguments specified for registering " + (kind_name) + " extension: " + (args)) + }; + }; return nil; })(); + if (extension.$config()['$[]']("position")['$=='](">>")) { + + kind_store.$unshift(extension); + } else { + + kind_store['$<<'](extension); + }; + return extension; + }, TMP_Registry_add_document_processor_85.$$arity = 2); + + Opal.def(self, '$add_syntax_processor', TMP_Registry_add_syntax_processor_87 = function $$add_syntax_processor(kind, args) { + var $iter = TMP_Registry_add_syntax_processor_87.$$p, block = $iter || nil, TMP_88, $a, $b, $c, self = this, kind_name = nil, kind_class_symbol = nil, kind_class = nil, kind_java_class = nil, kind_store = nil, name = nil, config = nil, processor = nil, $writer = nil, processor_class = nil, processor_instance = nil; + + if ($iter) TMP_Registry_add_syntax_processor_87.$$p = null; + + + if ($iter) TMP_Registry_add_syntax_processor_87.$$p = null;; + kind_name = kind.$to_s().$tr("_", " "); + kind_class_symbol = $send(kind_name.$split(), 'map', [], (TMP_88 = function(it){var self = TMP_88.$$s || this; + + + + if (it == null) { + it = nil; + }; + return it.$capitalize();}, TMP_88.$$s = self, TMP_88.$$arity = 1, TMP_88)).$push("Processor").$join().$to_sym(); + kind_class = $$($nesting, 'Extensions').$const_get(kind_class_symbol); + kind_java_class = (function() {if ($truthy((($a = $$$('::', 'AsciidoctorJ', 'skip_raise')) ? 'constant' : nil))) { + + return $$$($$$('::', 'AsciidoctorJ'), 'Extensions').$const_get(kind_class_symbol); + } else { + return nil + }; return nil; })(); + kind_store = ($truthy($b = self.$instance_variable_get(((("" + "@") + (kind)) + "_extensions").$to_sym())) ? $b : self.$instance_variable_set(((("" + "@") + (kind)) + "_extensions").$to_sym(), $hash2([], {}))); + if ((block !== nil)) { + + $c = self.$resolve_args(args, 2), $b = Opal.to_ary($c), (name = ($b[0] == null ? nil : $b[0])), (config = ($b[1] == null ? nil : $b[1])), $c; + processor = kind_class.$new(self.$as_symbol(name), config); + if ($truthy(kind_class.$constants().$grep("DSL"))) { + processor.$extend(kind_class.$const_get("DSL"))}; + if (block.$arity()['$=='](1)) { + Opal.yield1(block, processor) + } else { + $send(processor, 'instance_exec', [], block.$to_proc()) + }; + if ($truthy((name = self.$as_symbol(processor.$name())))) { + } else { + self.$raise($$$('::', 'ArgumentError'), "" + "No name specified for " + (kind_name) + " extension at " + (block.$source_location())) + }; + if ($truthy(processor['$process_block_given?']())) { + } else { + self.$raise($$$('::', 'NoMethodError'), "" + "No block specified to process " + (kind_name) + " extension at " + (block.$source_location())) + }; + processor.$freeze(); + + $writer = [name, $$($nesting, 'ProcessorExtension').$new(kind, processor)]; + $send(kind_store, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];; + } else { + + $c = self.$resolve_args(args, 3), $b = Opal.to_ary($c), (processor = ($b[0] == null ? nil : $b[0])), (name = ($b[1] == null ? nil : $b[1])), (config = ($b[2] == null ? nil : $b[2])), $c; + if ($truthy((processor_class = $$($nesting, 'Extensions').$resolve_class(processor)))) { + + if ($truthy(($truthy($b = $rb_lt(processor_class, kind_class)) ? $b : ($truthy($c = kind_java_class) ? $rb_lt(processor_class, kind_java_class) : $c)))) { + } else { + self.$raise($$$('::', 'ArgumentError'), "" + "Class specified for " + (kind_name) + " extension does not inherit from " + (kind_class) + ": " + (processor)) + }; + processor_instance = processor_class.$new(self.$as_symbol(name), config); + if ($truthy((name = self.$as_symbol(processor_instance.$name())))) { + } else { + self.$raise($$$('::', 'ArgumentError'), "" + "No name specified for " + (kind_name) + " extension: " + (processor)) + }; + processor_instance.$freeze(); + + $writer = [name, $$($nesting, 'ProcessorExtension').$new(kind, processor_instance)]; + $send(kind_store, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];; + } else if ($truthy(($truthy($b = kind_class['$==='](processor)) ? $b : ($truthy($c = kind_java_class) ? kind_java_class['$==='](processor) : $c)))) { + + processor.$update_config(config); + if ($truthy((name = (function() {if ($truthy(name)) { + + + $writer = [self.$as_symbol(name)]; + $send(processor, 'name=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];; + } else { + + return self.$as_symbol(processor.$name()); + }; return nil; })()))) { + } else { + self.$raise($$$('::', 'ArgumentError'), "" + "No name specified for " + (kind_name) + " extension: " + (processor)) + }; + processor.$freeze(); + + $writer = [name, $$($nesting, 'ProcessorExtension').$new(kind, processor)]; + $send(kind_store, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];; + } else { + return self.$raise($$$('::', 'ArgumentError'), "" + "Invalid arguments specified for registering " + (kind_name) + " extension: " + (args)) + }; + }; + }, TMP_Registry_add_syntax_processor_87.$$arity = 2); + + Opal.def(self, '$resolve_args', TMP_Registry_resolve_args_89 = function $$resolve_args(args, expect) { + var self = this, opts = nil, missing = nil; + + + opts = (function() {if ($truthy($$$('::', 'Hash')['$==='](args['$[]'](-1)))) { + return args.$pop() + } else { + return $hash2([], {}) + }; return nil; })(); + if (expect['$=='](1)) { + return opts}; + if ($truthy($rb_gt((missing = $rb_minus($rb_minus(expect, 1), args.$size())), 0))) { + args = $rb_plus(args, $$$('::', 'Array').$new(missing)) + } else if ($truthy($rb_lt(missing, 0))) { + args.$pop(missing['$-@']())}; + args['$<<'](opts); + return args; + }, TMP_Registry_resolve_args_89.$$arity = 2); + return (Opal.def(self, '$as_symbol', TMP_Registry_as_symbol_90 = function $$as_symbol(name) { + var self = this; + + if ($truthy(name)) { + return name.$to_sym() + } else { + return nil + } + }, TMP_Registry_as_symbol_90.$$arity = 1), nil) && 'as_symbol'; + })($nesting[0], null, $nesting); + (function(self, $parent_nesting) { + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_generate_name_91, TMP_next_auto_id_92, TMP_groups_93, TMP_create_94, TMP_register_95, TMP_unregister_all_96, TMP_unregister_97, TMP_resolve_class_99, TMP_class_for_name_100, TMP_class_for_name_101, TMP_class_for_name_103; + + + + Opal.def(self, '$generate_name', TMP_generate_name_91 = function $$generate_name() { + var self = this; + + return "" + "extgrp" + (self.$next_auto_id()) + }, TMP_generate_name_91.$$arity = 0); + + Opal.def(self, '$next_auto_id', TMP_next_auto_id_92 = function $$next_auto_id() { + var $a, self = this; + if (self.auto_id == null) self.auto_id = nil; + + + self.auto_id = ($truthy($a = self.auto_id) ? $a : -1); + return (self.auto_id = $rb_plus(self.auto_id, 1)); + }, TMP_next_auto_id_92.$$arity = 0); + + Opal.def(self, '$groups', TMP_groups_93 = function $$groups() { + var $a, self = this; + if (self.groups == null) self.groups = nil; + + return (self.groups = ($truthy($a = self.groups) ? $a : $hash2([], {}))) + }, TMP_groups_93.$$arity = 0); + + Opal.def(self, '$create', TMP_create_94 = function $$create(name) { + var $iter = TMP_create_94.$$p, block = $iter || nil, $a, self = this; + + if ($iter) TMP_create_94.$$p = null; + + + if ($iter) TMP_create_94.$$p = null;; + + if (name == null) { + name = nil; + }; + if ((block !== nil)) { + return $$($nesting, 'Registry').$new($hash(($truthy($a = name) ? $a : self.$generate_name()), block)) + } else { + return $$($nesting, 'Registry').$new() + }; + }, TMP_create_94.$$arity = -1); + Opal.alias(self, "build_registry", "create"); + + Opal.def(self, '$register', TMP_register_95 = function $$register($a) { + var $iter = TMP_register_95.$$p, block = $iter || nil, $post_args, args, $b, self = this, argc = nil, resolved_group = nil, group = nil, name = nil, $writer = nil; + + if ($iter) TMP_register_95.$$p = null; + + + if ($iter) TMP_register_95.$$p = null;; + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + args = $post_args;; + argc = args.$size(); + if ((block !== nil)) { + resolved_group = block + } else if ($truthy((group = args.$pop()))) { + resolved_group = ($truthy($b = self.$resolve_class(group)) ? $b : group) + } else { + self.$raise($$$('::', 'ArgumentError'), "Extension group to register not specified") + }; + name = ($truthy($b = args.$pop()) ? $b : self.$generate_name()); + if ($truthy(args['$empty?']())) { + } else { + self.$raise($$$('::', 'ArgumentError'), "" + "Wrong number of arguments (" + (argc) + " for 1..2)") + }; + + $writer = [name.$to_sym(), resolved_group]; + $send(self.$groups(), '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];; + }, TMP_register_95.$$arity = -1); + + Opal.def(self, '$unregister_all', TMP_unregister_all_96 = function $$unregister_all() { + var self = this; + + + self.groups = $hash2([], {}); + return nil; + }, TMP_unregister_all_96.$$arity = 0); + + Opal.def(self, '$unregister', TMP_unregister_97 = function $$unregister($a) { + var $post_args, names, TMP_98, self = this; + + + + $post_args = Opal.slice.call(arguments, 0, arguments.length); + + names = $post_args;; + $send(names, 'each', [], (TMP_98 = function(group){var self = TMP_98.$$s || this; + if (self.groups == null) self.groups = nil; + + + + if (group == null) { + group = nil; + }; + return self.groups.$delete(group.$to_sym());}, TMP_98.$$s = self, TMP_98.$$arity = 1, TMP_98)); + return nil; + }, TMP_unregister_97.$$arity = -1); + + Opal.def(self, '$resolve_class', TMP_resolve_class_99 = function $$resolve_class(object) { + var self = this, $case = nil; + + return (function() {$case = object; + if ($$$('::', 'Class')['$===']($case)) {return object} + else if ($$$('::', 'String')['$===']($case)) {return self.$class_for_name(object)} + else { return nil }})() + }, TMP_resolve_class_99.$$arity = 1); + if ($truthy($$$('::', 'RUBY_MIN_VERSION_2'))) { + return (Opal.def(self, '$class_for_name', TMP_class_for_name_100 = function $$class_for_name(qualified_name) { + var self = this, resolved = nil; + + try { + + resolved = $$$('::', 'Object').$const_get(qualified_name, false); + if ($truthy($$$('::', 'Class')['$==='](resolved))) { + } else { + self.$raise() + }; + return resolved; + } catch ($err) { + if (Opal.rescue($err, [$$($nesting, 'StandardError')])) { + try { + return self.$raise($$$('::', 'NameError'), "" + "Could not resolve class for name: " + (qualified_name)) + } finally { Opal.pop_exception() } + } else { throw $err; } + } + }, TMP_class_for_name_100.$$arity = 1), nil) && 'class_for_name' + } else if ($truthy($$$('::', 'RUBY_MIN_VERSION_1_9'))) { + return (Opal.def(self, '$class_for_name', TMP_class_for_name_101 = function $$class_for_name(qualified_name) { + var TMP_102, self = this, resolved = nil; + + try { + + resolved = $send(qualified_name.$split("::"), 'reduce', [$$$('::', 'Object')], (TMP_102 = function(current, name){var self = TMP_102.$$s || this; + + + + if (current == null) { + current = nil; + }; + + if (name == null) { + name = nil; + }; + if ($truthy(name['$empty?']())) { + return current + } else { + + return current.$const_get(name, false); + };}, TMP_102.$$s = self, TMP_102.$$arity = 2, TMP_102)); + if ($truthy($$$('::', 'Class')['$==='](resolved))) { + } else { + self.$raise() + }; + return resolved; + } catch ($err) { + if (Opal.rescue($err, [$$($nesting, 'StandardError')])) { + try { + return self.$raise($$$('::', 'NameError'), "" + "Could not resolve class for name: " + (qualified_name)) + } finally { Opal.pop_exception() } + } else { throw $err; } + } + }, TMP_class_for_name_101.$$arity = 1), nil) && 'class_for_name' + } else { + return (Opal.def(self, '$class_for_name', TMP_class_for_name_103 = function $$class_for_name(qualified_name) { + var TMP_104, self = this, resolved = nil; + + try { + + resolved = $send(qualified_name.$split("::"), 'reduce', [$$$('::', 'Object')], (TMP_104 = function(current, name){var self = TMP_104.$$s || this; + + + + if (current == null) { + current = nil; + }; + + if (name == null) { + name = nil; + }; + if ($truthy(name['$empty?']())) { + return current + } else { + + if ($truthy(current['$const_defined?'](name))) { + + return current.$const_get(name); + } else { + return self.$raise() + }; + };}, TMP_104.$$s = self, TMP_104.$$arity = 2, TMP_104)); + if ($truthy($$$('::', 'Class')['$==='](resolved))) { + } else { + self.$raise() + }; + return resolved; + } catch ($err) { + if (Opal.rescue($err, [$$($nesting, 'StandardError')])) { + try { + return self.$raise($$$('::', 'NameError'), "" + "Could not resolve class for name: " + (qualified_name)) + } finally { Opal.pop_exception() } + } else { throw $err; } + } + }, TMP_class_for_name_103.$$arity = 1), nil) && 'class_for_name' + }; + })(Opal.get_singleton_class(self), $nesting); + })($nesting[0], $nesting) + })($nesting[0], $nesting); +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/js/opal_ext/browser/reader"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $truthy = Opal.truthy; + + Opal.add_stubs(['$posixify', '$new', '$base_dir', '$start_with?', '$uriish?', '$descends_from?', '$key?', '$attributes', '$replace_next_line', '$absolute_path?', '$==', '$empty?', '$!', '$slice', '$length']); + return (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + (function($base, $super, $parent_nesting) { + function $PreprocessorReader(){}; + var self = $PreprocessorReader = $klass($base, $super, 'PreprocessorReader', $PreprocessorReader); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_PreprocessorReader_resolve_include_path_1; + + def.path_resolver = def.document = def.include_stack = def.dir = nil; + return (Opal.def(self, '$resolve_include_path', TMP_PreprocessorReader_resolve_include_path_1 = function $$resolve_include_path(target, attrlist, attributes) { + var $a, self = this, p_target = nil, target_type = nil, base_dir = nil, inc_path = nil, relpath = nil, ctx_dir = nil, top_level = nil, offset = nil; + + + p_target = (self.path_resolver = ($truthy($a = self.path_resolver) ? $a : $$($nesting, 'PathResolver').$new("\\"))).$posixify(target); + $a = ["file", self.document.$base_dir()], (target_type = $a[0]), (base_dir = $a[1]), $a; + if ($truthy(p_target['$start_with?']("file://"))) { + inc_path = (relpath = p_target) + } else if ($truthy($$($nesting, 'Helpers')['$uriish?'](p_target))) { + + if ($truthy(($truthy($a = self.path_resolver['$descends_from?'](p_target, base_dir)) ? $a : self.document.$attributes()['$key?']("allow-uri-read")))) { + } else { + return self.$replace_next_line("" + "link:" + (target) + "[" + (attrlist) + "]") + }; + inc_path = (relpath = p_target); + } else if ($truthy(self.path_resolver['$absolute_path?'](p_target))) { + inc_path = (relpath = "" + "file://" + ((function() {if ($truthy(p_target['$start_with?']("/"))) { + return "" + } else { + return "/" + }; return nil; })()) + (p_target)) + } else if ((ctx_dir = (function() {if ($truthy((top_level = self.include_stack['$empty?']()))) { + return base_dir + } else { + return self.dir + }; return nil; })())['$=='](".")) { + inc_path = (relpath = p_target) + } else if ($truthy(($truthy($a = ctx_dir['$start_with?']("file://")) ? $a : $$($nesting, 'Helpers')['$uriish?'](ctx_dir)['$!']()))) { + + inc_path = "" + (ctx_dir) + "/" + (p_target); + if ($truthy(top_level)) { + relpath = p_target + } else if ($truthy(($truthy($a = base_dir['$=='](".")) ? $a : (offset = self.path_resolver['$descends_from?'](inc_path, base_dir))['$!']()))) { + relpath = inc_path + } else { + relpath = inc_path.$slice(offset, inc_path.$length()) + }; + } else if ($truthy(top_level)) { + inc_path = "" + (ctx_dir) + "/" + ((relpath = p_target)) + } else if ($truthy(($truthy($a = (offset = self.path_resolver['$descends_from?'](ctx_dir, base_dir))) ? $a : self.document.$attributes()['$key?']("allow-uri-read")))) { + + inc_path = "" + (ctx_dir) + "/" + (p_target); + relpath = (function() {if ($truthy(offset)) { + + return inc_path.$slice(offset, inc_path.$length()); + } else { + return p_target + }; return nil; })(); + } else { + return self.$replace_next_line("" + "link:" + (target) + "[" + (attrlist) + "]") + }; + return [inc_path, "file", relpath]; + }, TMP_PreprocessorReader_resolve_include_path_1.$$arity = 3), nil) && 'resolve_include_path' + })($nesting[0], $$($nesting, 'Reader'), $nesting) + })($nesting[0], $nesting) +}; + +/* Generated by Opal 0.11.99.dev */ +Opal.modules["asciidoctor/js/postscript"] = function(Opal) { + var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice; + + Opal.add_stubs(['$require', '$==']); + + self.$require("asciidoctor/converter/composite"); + self.$require("asciidoctor/converter/html5"); + self.$require("asciidoctor/extensions"); + if ($$($nesting, 'JAVASCRIPT_IO_MODULE')['$==']("xmlhttprequest")) { + return self.$require("asciidoctor/js/opal_ext/browser/reader") + } else { + return nil + }; +}; + +/* Generated by Opal 0.11.99.dev */ +(function(Opal) { + function $rb_ge(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs >= rhs : lhs['$>='](rhs); + } + function $rb_minus(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs); + } + function $rb_lt(lhs, rhs) { + return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs); + } + var $a, self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $truthy = Opal.truthy, $gvars = Opal.gvars, $module = Opal.module, $hash2 = Opal.hash2, $send = Opal.send, $hash = Opal.hash; + if ($gvars[":"] == null) $gvars[":"] = nil; + + Opal.add_stubs(['$==', '$>=', '$require', '$unshift', '$dirname', '$each', '$constants', '$const_get', '$downcase', '$to_s', '$[]=', '$-', '$upcase', '$[]', '$values', '$new', '$attr_reader', '$instance_variable_set', '$send', '$<<', '$define', '$expand_path', '$join', '$home', '$pwd', '$!', '$!=', '$default_external', '$to_set', '$map', '$keys', '$slice', '$merge', '$default=', '$to_a', '$escape', '$drop', '$insert', '$dup', '$start', '$logger', '$logger=', '$===', '$split', '$gsub', '$respond_to?', '$raise', '$ancestors', '$class', '$path', '$utc', '$at', '$Integer', '$mtime', '$readlines', '$basename', '$extname', '$index', '$strftime', '$year', '$utc_offset', '$rewind', '$lines', '$each_line', '$record', '$parse', '$exception', '$message', '$set_backtrace', '$backtrace', '$stack_trace', '$stack_trace=', '$open', '$load', '$delete', '$key?', '$attributes', '$outfilesuffix', '$safe', '$normalize_system_path', '$mkdir_p', '$directory?', '$convert', '$write', '$<', '$attr?', '$attr', '$uriish?', '$include?', '$write_primary_stylesheet', '$instance', '$empty?', '$read_asset', '$file?', '$write_coderay_stylesheet', '$write_pygments_stylesheet']); + + if ($truthy((($a = $$($nesting, 'RUBY_ENGINE', 'skip_raise')) ? 'constant' : nil))) { + } else { + Opal.const_set($nesting[0], 'RUBY_ENGINE', "unknown") + }; + Opal.const_set($nesting[0], 'RUBY_ENGINE_OPAL', $$($nesting, 'RUBY_ENGINE')['$==']("opal")); + Opal.const_set($nesting[0], 'RUBY_ENGINE_JRUBY', $$($nesting, 'RUBY_ENGINE')['$==']("jruby")); + Opal.const_set($nesting[0], 'RUBY_MIN_VERSION_1_9', $rb_ge($$($nesting, 'RUBY_VERSION'), "1.9")); + Opal.const_set($nesting[0], 'RUBY_MIN_VERSION_2', $rb_ge($$($nesting, 'RUBY_VERSION'), "2")); + self.$require("set"); + if ($$($nesting, 'RUBY_ENGINE')['$==']("opal")) { + self.$require("asciidoctor/js") + } else { + nil + }; + $gvars[":"].$unshift($$($nesting, 'File').$dirname("asciidoctor.rb")); + self.$require("asciidoctor/logging"); + (function($base, $parent_nesting) { + function $Asciidoctor() {}; + var self = $Asciidoctor = $module($base, 'Asciidoctor', $Asciidoctor); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), $a, TMP_Asciidoctor_6, TMP_Asciidoctor_7, TMP_Asciidoctor_8, $writer = nil, quote_subs = nil, compat_quote_subs = nil; + + + Opal.const_set($nesting[0], 'RUBY_ENGINE', $$$('::', 'RUBY_ENGINE')); + (function($base, $parent_nesting) { + function $SafeMode() {}; + var self = $SafeMode = $module($base, 'SafeMode', $SafeMode); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_SafeMode_1, TMP_SafeMode_value_for_name_2, TMP_SafeMode_name_for_value_3, TMP_SafeMode_names_4, rec = nil; + + + Opal.const_set($nesting[0], 'UNSAFE', 0); + Opal.const_set($nesting[0], 'SAFE', 1); + Opal.const_set($nesting[0], 'SERVER', 10); + Opal.const_set($nesting[0], 'SECURE', 20); + rec = $hash2([], {}); + $send((Opal.Module.$$nesting = $nesting, self.$constants()), 'each', [], (TMP_SafeMode_1 = function(sym){var self = TMP_SafeMode_1.$$s || this, $writer = nil; + + + + if (sym == null) { + sym = nil; + }; + $writer = [self.$const_get(sym), sym.$to_s().$downcase()]; + $send(rec, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];}, TMP_SafeMode_1.$$s = self, TMP_SafeMode_1.$$arity = 1, TMP_SafeMode_1)); + self.names_by_value = rec; + Opal.defs(self, '$value_for_name', TMP_SafeMode_value_for_name_2 = function $$value_for_name(name) { + var self = this; + + return self.$const_get(name.$upcase()) + }, TMP_SafeMode_value_for_name_2.$$arity = 1); + Opal.defs(self, '$name_for_value', TMP_SafeMode_name_for_value_3 = function $$name_for_value(value) { + var self = this; + if (self.names_by_value == null) self.names_by_value = nil; + + return self.names_by_value['$[]'](value) + }, TMP_SafeMode_name_for_value_3.$$arity = 1); + Opal.defs(self, '$names', TMP_SafeMode_names_4 = function $$names() { + var self = this; + if (self.names_by_value == null) self.names_by_value = nil; + + return self.names_by_value.$values() + }, TMP_SafeMode_names_4.$$arity = 0); + })($nesting[0], $nesting); + (function($base, $parent_nesting) { + function $Compliance() {}; + var self = $Compliance = $module($base, 'Compliance', $Compliance); + + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_Compliance_define_5; + + + self.keys = $$$('::', 'Set').$new(); + (function(self, $parent_nesting) { + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return self.$attr_reader("keys") + })(Opal.get_singleton_class(self), $nesting); + Opal.defs(self, '$define', TMP_Compliance_define_5 = function $$define(key, value) { + var self = this; + if (self.keys == null) self.keys = nil; + + + self.$instance_variable_set("" + "@" + (key), value); + (function(self, $parent_nesting) { + var def = self.prototype, $nesting = [self].concat($parent_nesting); + + return self + })(Opal.get_singleton_class(self), $nesting).$send("attr_accessor", key); + self.keys['$<<'](key); + return nil; + }, TMP_Compliance_define_5.$$arity = 2); + self.$define("block_terminates_paragraph", true); + self.$define("strict_verbatim_paragraphs", true); + self.$define("underline_style_section_titles", true); + self.$define("unwrap_standalone_preamble", true); + self.$define("attribute_missing", "skip"); + self.$define("attribute_undefined", "drop-line"); + self.$define("shorthand_property_syntax", true); + self.$define("natural_xrefs", true); + self.$define("unique_id_start_index", 2); + self.$define("markdown_syntax", true); + })($nesting[0], $nesting); + Opal.const_set($nesting[0], 'ROOT_PATH', $$$('::', 'File').$dirname($$$('::', 'File').$dirname($$$('::', 'File').$expand_path("asciidoctor.rb")))); + Opal.const_set($nesting[0], 'DATA_PATH', $$$('::', 'File').$join($$($nesting, 'ROOT_PATH'), "data")); + + try { + Opal.const_set($nesting[0], 'USER_HOME', $$$('::', 'Dir').$home()) + } catch ($err) { + if (Opal.rescue($err, [$$($nesting, 'StandardError')])) { + try { + Opal.const_set($nesting[0], 'USER_HOME', ($truthy($a = $$$('::', 'ENV')['$[]']("HOME")) ? $a : $$$('::', 'Dir').$pwd())) + } finally { Opal.pop_exception() } + } else { throw $err; } + };; + Opal.const_set($nesting[0], 'COERCE_ENCODING', ($truthy($a = $$$('::', 'RUBY_ENGINE_OPAL')['$!']()) ? $$$('::', 'RUBY_MIN_VERSION_1_9') : $a)); + Opal.const_set($nesting[0], 'FORCE_ENCODING', ($truthy($a = $$($nesting, 'COERCE_ENCODING')) ? $$$('::', 'Encoding').$default_external()['$!=']($$$($$$('::', 'Encoding'), 'UTF_8')) : $a)); + Opal.const_set($nesting[0], 'BOM_BYTES_UTF_8', [239, 187, 191]); + Opal.const_set($nesting[0], 'BOM_BYTES_UTF_16LE', [255, 254]); + Opal.const_set($nesting[0], 'BOM_BYTES_UTF_16BE', [254, 255]); + Opal.const_set($nesting[0], 'FORCE_UNICODE_LINE_LENGTH', $$$('::', 'RUBY_MIN_VERSION_1_9')['$!']()); + Opal.const_set($nesting[0], 'LF', Opal.const_set($nesting[0], 'EOL', "\n")); + Opal.const_set($nesting[0], 'NULL', "\u0000"); + Opal.const_set($nesting[0], 'TAB', "\t"); + Opal.const_set($nesting[0], 'MAX_INT', 9007199254740991); + Opal.const_set($nesting[0], 'DEFAULT_DOCTYPE', "article"); + Opal.const_set($nesting[0], 'DEFAULT_BACKEND', "html5"); + Opal.const_set($nesting[0], 'DEFAULT_STYLESHEET_KEYS', ["", "DEFAULT"].$to_set()); + Opal.const_set($nesting[0], 'DEFAULT_STYLESHEET_NAME', "asciidoctor.css"); + Opal.const_set($nesting[0], 'BACKEND_ALIASES', $hash2(["html", "docbook"], {"html": "html5", "docbook": "docbook5"})); + Opal.const_set($nesting[0], 'DEFAULT_PAGE_WIDTHS', $hash2(["docbook"], {"docbook": 425})); + Opal.const_set($nesting[0], 'DEFAULT_EXTENSIONS', $hash2(["html", "docbook", "pdf", "epub", "manpage", "asciidoc"], {"html": ".html", "docbook": ".xml", "pdf": ".pdf", "epub": ".epub", "manpage": ".man", "asciidoc": ".adoc"})); + Opal.const_set($nesting[0], 'ASCIIDOC_EXTENSIONS', $hash2([".adoc", ".asciidoc", ".asc", ".ad", ".txt"], {".adoc": true, ".asciidoc": true, ".asc": true, ".ad": true, ".txt": true})); + Opal.const_set($nesting[0], 'SETEXT_SECTION_LEVELS', $hash2(["=", "-", "~", "^", "+"], {"=": 0, "-": 1, "~": 2, "^": 3, "+": 4})); + Opal.const_set($nesting[0], 'ADMONITION_STYLES', ["NOTE", "TIP", "IMPORTANT", "WARNING", "CAUTION"].$to_set()); + Opal.const_set($nesting[0], 'ADMONITION_STYLE_HEADS', ["N", "T", "I", "W", "C"].$to_set()); + Opal.const_set($nesting[0], 'PARAGRAPH_STYLES', ["comment", "example", "literal", "listing", "normal", "open", "pass", "quote", "sidebar", "source", "verse", "abstract", "partintro"].$to_set()); + Opal.const_set($nesting[0], 'VERBATIM_STYLES', ["literal", "listing", "source", "verse"].$to_set()); + Opal.const_set($nesting[0], 'DELIMITED_BLOCKS', $hash2(["--", "----", "....", "====", "****", "____", "\"\"", "++++", "|===", ",===", ":===", "!===", "////", "```"], {"--": ["open", ["comment", "example", "literal", "listing", "pass", "quote", "sidebar", "source", "verse", "admonition", "abstract", "partintro"].$to_set()], "----": ["listing", ["literal", "source"].$to_set()], "....": ["literal", ["listing", "source"].$to_set()], "====": ["example", ["admonition"].$to_set()], "****": ["sidebar", $$$('::', 'Set').$new()], "____": ["quote", ["verse"].$to_set()], "\"\"": ["quote", ["verse"].$to_set()], "++++": ["pass", ["stem", "latexmath", "asciimath"].$to_set()], "|===": ["table", $$$('::', 'Set').$new()], ",===": ["table", $$$('::', 'Set').$new()], ":===": ["table", $$$('::', 'Set').$new()], "!===": ["table", $$$('::', 'Set').$new()], "////": ["comment", $$$('::', 'Set').$new()], "```": ["fenced_code", $$$('::', 'Set').$new()]})); + Opal.const_set($nesting[0], 'DELIMITED_BLOCK_HEADS', $send($$($nesting, 'DELIMITED_BLOCKS').$keys(), 'map', [], (TMP_Asciidoctor_6 = function(key){var self = TMP_Asciidoctor_6.$$s || this; + + + + if (key == null) { + key = nil; + }; + return key.$slice(0, 2);}, TMP_Asciidoctor_6.$$s = self, TMP_Asciidoctor_6.$$arity = 1, TMP_Asciidoctor_6)).$to_set()); + Opal.const_set($nesting[0], 'LAYOUT_BREAK_CHARS', $hash2(["'", "<"], {"'": "thematic_break", "<": "page_break"})); + Opal.const_set($nesting[0], 'MARKDOWN_THEMATIC_BREAK_CHARS', $hash2(["-", "*", "_"], {"-": "thematic_break", "*": "thematic_break", "_": "thematic_break"})); + Opal.const_set($nesting[0], 'HYBRID_LAYOUT_BREAK_CHARS', $$($nesting, 'LAYOUT_BREAK_CHARS').$merge($$($nesting, 'MARKDOWN_THEMATIC_BREAK_CHARS'))); + Opal.const_set($nesting[0], 'NESTABLE_LIST_CONTEXTS', ["ulist", "olist", "dlist"]); + Opal.const_set($nesting[0], 'ORDERED_LIST_STYLES', ["arabic", "loweralpha", "lowerroman", "upperalpha", "upperroman"]); + Opal.const_set($nesting[0], 'ORDERED_LIST_KEYWORDS', $hash2(["loweralpha", "lowerroman", "upperalpha", "upperroman"], {"loweralpha": "a", "lowerroman": "i", "upperalpha": "A", "upperroman": "I"})); + Opal.const_set($nesting[0], 'ATTR_REF_HEAD', "{"); + Opal.const_set($nesting[0], 'LIST_CONTINUATION', "+"); + Opal.const_set($nesting[0], 'HARD_LINE_BREAK', " +"); + Opal.const_set($nesting[0], 'LINE_CONTINUATION', " \\"); + Opal.const_set($nesting[0], 'LINE_CONTINUATION_LEGACY', " +"); + Opal.const_set($nesting[0], 'MATHJAX_VERSION', "2.7.4"); + Opal.const_set($nesting[0], 'BLOCK_MATH_DELIMITERS', $hash2(["asciimath", "latexmath"], {"asciimath": ["\\$", "\\$"], "latexmath": ["\\[", "\\]"]})); + Opal.const_set($nesting[0], 'INLINE_MATH_DELIMITERS', $hash2(["asciimath", "latexmath"], {"asciimath": ["\\$", "\\$"], "latexmath": ["\\(", "\\)"]})); + + $writer = ["asciimath"]; + $send(Opal.const_set($nesting[0], 'STEM_TYPE_ALIASES', $hash2(["latexmath", "latex", "tex"], {"latexmath": "latexmath", "latex": "latexmath", "tex": "latexmath"})), 'default=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + Opal.const_set($nesting[0], 'FONT_AWESOME_VERSION', "4.7.0"); + Opal.const_set($nesting[0], 'FLEXIBLE_ATTRIBUTES', ["sectnums"]); + if ($$($nesting, 'RUBY_ENGINE')['$==']("opal")) { + if ($truthy((($a = $$($nesting, 'CC_ANY', 'skip_raise')) ? 'constant' : nil))) { + } else { + Opal.const_set($nesting[0], 'CC_ANY', "[^\\n]") + } + } else { + nil + }; + Opal.const_set($nesting[0], 'AuthorInfoLineRx', new RegExp("" + "^(" + ($$($nesting, 'CG_WORD')) + "[" + ($$($nesting, 'CC_WORD')) + "\\-'.]*)(?: +(" + ($$($nesting, 'CG_WORD')) + "[" + ($$($nesting, 'CC_WORD')) + "\\-'.]*))?(?: +(" + ($$($nesting, 'CG_WORD')) + "[" + ($$($nesting, 'CC_WORD')) + "\\-'.]*))?(?: +<([^>]+)>)?$")); + Opal.const_set($nesting[0], 'RevisionInfoLineRx', new RegExp("" + "^(?:[^\\d{]*(" + ($$($nesting, 'CC_ANY')) + "*?),)? *(?!:)(" + ($$($nesting, 'CC_ANY')) + "*?)(?: *(?!^),?: *(" + ($$($nesting, 'CC_ANY')) + "*))?$")); + Opal.const_set($nesting[0], 'ManpageTitleVolnumRx', new RegExp("" + "^(" + ($$($nesting, 'CC_ANY')) + "+?) *\\( *(" + ($$($nesting, 'CC_ANY')) + "+?) *\\)$")); + Opal.const_set($nesting[0], 'ManpageNamePurposeRx', new RegExp("" + "^(" + ($$($nesting, 'CC_ANY')) + "+?) +- +(" + ($$($nesting, 'CC_ANY')) + "+)$")); + Opal.const_set($nesting[0], 'ConditionalDirectiveRx', new RegExp("" + "^(\\\\)?(ifdef|ifndef|ifeval|endif)::(\\S*?(?:([,+])\\S*?)?)\\[(" + ($$($nesting, 'CC_ANY')) + "+)?\\]$")); + Opal.const_set($nesting[0], 'EvalExpressionRx', new RegExp("" + "^(" + ($$($nesting, 'CC_ANY')) + "+?) *([=!><]=|[><]) *(" + ($$($nesting, 'CC_ANY')) + "+)$")); + Opal.const_set($nesting[0], 'IncludeDirectiveRx', new RegExp("" + "^(\\\\)?include::([^\\[][^\\[]*)\\[(" + ($$($nesting, 'CC_ANY')) + "+)?\\]$")); + Opal.const_set($nesting[0], 'TagDirectiveRx', /\b(?:tag|(e)nd)::(\S+?)\[\](?=$|[ \r])/m); + Opal.const_set($nesting[0], 'AttributeEntryRx', new RegExp("" + "^:(!?" + ($$($nesting, 'CG_WORD')) + "[^:]*):(?:[ \\t]+(" + ($$($nesting, 'CC_ANY')) + "*))?$")); + Opal.const_set($nesting[0], 'InvalidAttributeNameCharsRx', new RegExp("" + "[^-" + ($$($nesting, 'CC_WORD')) + "]")); + if ($$($nesting, 'RUBY_ENGINE')['$==']("opal")) { + Opal.const_set($nesting[0], 'AttributeEntryPassMacroRx', /^pass:([a-z]+(?:,[a-z]+)*)?\[([\S\s]*)\]$/) + } else { + nil + }; + Opal.const_set($nesting[0], 'AttributeReferenceRx', new RegExp("" + "(\\\\)?\\{(" + ($$($nesting, 'CG_WORD')) + "[-" + ($$($nesting, 'CC_WORD')) + "]*|(set|counter2?):" + ($$($nesting, 'CC_ANY')) + "+?)(\\\\)?\\}")); + Opal.const_set($nesting[0], 'BlockAnchorRx', new RegExp("" + "^\\[\\[(?:|([" + ($$($nesting, 'CC_ALPHA')) + "_:][" + ($$($nesting, 'CC_WORD')) + ":.-]*)(?:, *(" + ($$($nesting, 'CC_ANY')) + "+))?)\\]\\]$")); + Opal.const_set($nesting[0], 'BlockAttributeListRx', new RegExp("" + "^\\[(|[" + ($$($nesting, 'CC_WORD')) + ".#%{,\"']" + ($$($nesting, 'CC_ANY')) + "*)\\]$")); + Opal.const_set($nesting[0], 'BlockAttributeLineRx', new RegExp("" + "^\\[(?:|[" + ($$($nesting, 'CC_WORD')) + ".#%{,\"']" + ($$($nesting, 'CC_ANY')) + "*|\\[(?:|[" + ($$($nesting, 'CC_ALPHA')) + "_:][" + ($$($nesting, 'CC_WORD')) + ":.-]*(?:, *" + ($$($nesting, 'CC_ANY')) + "+)?)\\])\\]$")); + Opal.const_set($nesting[0], 'BlockTitleRx', new RegExp("" + "^\\.(\\.?[^ \\t.]" + ($$($nesting, 'CC_ANY')) + "*)$")); + Opal.const_set($nesting[0], 'AdmonitionParagraphRx', new RegExp("" + "^(" + ($$($nesting, 'ADMONITION_STYLES').$to_a().$join("|")) + "):[ \\t]+")); + Opal.const_set($nesting[0], 'LiteralParagraphRx', new RegExp("" + "^([ \\t]+" + ($$($nesting, 'CC_ANY')) + "*)$")); + Opal.const_set($nesting[0], 'AtxSectionTitleRx', new RegExp("" + "^(=={0,5})[ \\t]+(" + ($$($nesting, 'CC_ANY')) + "+?)(?:[ \\t]+\\1)?$")); + Opal.const_set($nesting[0], 'ExtAtxSectionTitleRx', new RegExp("" + "^(=={0,5}|#\\\#{0,5})[ \\t]+(" + ($$($nesting, 'CC_ANY')) + "+?)(?:[ \\t]+\\1)?$")); + Opal.const_set($nesting[0], 'SetextSectionTitleRx', new RegExp("" + "^((?!\\.)" + ($$($nesting, 'CC_ANY')) + "*?" + ($$($nesting, 'CG_WORD')) + ($$($nesting, 'CC_ANY')) + "*)$")); + Opal.const_set($nesting[0], 'InlineSectionAnchorRx', new RegExp("" + " (\\\\)?\\[\\[([" + ($$($nesting, 'CC_ALPHA')) + "_:][" + ($$($nesting, 'CC_WORD')) + ":.-]*)(?:, *(" + ($$($nesting, 'CC_ANY')) + "+))?\\]\\]$")); + Opal.const_set($nesting[0], 'InvalidSectionIdCharsRx', new RegExp("" + "<[^>]+>|&(?:[a-z][a-z]+\\d{0,2}|#\\d\\d\\d{0,4}|#x[\\da-f][\\da-f][\\da-f]{0,3});|[^ " + ($$($nesting, 'CC_WORD')) + "\\-.]+?")); + Opal.const_set($nesting[0], 'AnyListRx', new RegExp("" + "^(?:[ \\t]*(?:-|\\*\\**|\\.\\.*|\\u2022|\\d+\\.|[a-zA-Z]\\.|[IVXivx]+\\))[ \\t]|(?!//[^/])" + ($$($nesting, 'CC_ANY')) + "*?(?::::{0,2}|;;)(?:$|[ \\t])|[ \\t])")); + Opal.const_set($nesting[0], 'UnorderedListRx', new RegExp("" + "^[ \\t]*(-|\\*\\**|\\u2022)[ \\t]+(" + ($$($nesting, 'CC_ANY')) + "*)$")); + Opal.const_set($nesting[0], 'OrderedListRx', new RegExp("" + "^[ \\t]*(\\.\\.*|\\d+\\.|[a-zA-Z]\\.|[IVXivx]+\\))[ \\t]+(" + ($$($nesting, 'CC_ANY')) + "*)$")); + Opal.const_set($nesting[0], 'OrderedListMarkerRxMap', $hash2(["arabic", "loweralpha", "lowerroman", "upperalpha", "upperroman"], {"arabic": /\d+\./, "loweralpha": /[a-z]\./, "lowerroman": /[ivx]+\)/, "upperalpha": /[A-Z]\./, "upperroman": /[IVX]+\)/})); + Opal.const_set($nesting[0], 'DescriptionListRx', new RegExp("" + "^(?!//[^/])[ \\t]*(" + ($$($nesting, 'CC_ANY')) + "*?)(:::{0,2}|;;)(?:$|[ \\t]+(" + ($$($nesting, 'CC_ANY')) + "*)$)")); + Opal.const_set($nesting[0], 'DescriptionListSiblingRx', $hash2(["::", ":::", "::::", ";;"], {"::": new RegExp("" + "^(?!//[^/])[ \\t]*(" + ($$($nesting, 'CC_ANY')) + "*[^:]|)(::)(?:$|[ \\t]+(" + ($$($nesting, 'CC_ANY')) + "*)$)"), ":::": new RegExp("" + "^(?!//[^/])[ \\t]*(" + ($$($nesting, 'CC_ANY')) + "*[^:]|)(:::)(?:$|[ \\t]+(" + ($$($nesting, 'CC_ANY')) + "*)$)"), "::::": new RegExp("" + "^(?!//[^/])[ \\t]*(" + ($$($nesting, 'CC_ANY')) + "*[^:]|)(::::)(?:$|[ \\t]+(" + ($$($nesting, 'CC_ANY')) + "*)$)"), ";;": new RegExp("" + "^(?!//[^/])[ \\t]*(" + ($$($nesting, 'CC_ANY')) + "*?)(;;)(?:$|[ \\t]+(" + ($$($nesting, 'CC_ANY')) + "*)$)")})); + Opal.const_set($nesting[0], 'CalloutListRx', new RegExp("" + "^<(\\d+|\\.)>[ \\t]+(" + ($$($nesting, 'CC_ANY')) + "*)$")); + Opal.const_set($nesting[0], 'CalloutExtractRx', /((?:\/\/|#|--|;;) ?)?(\\)?(?=(?: ?\\?)*$)/); + Opal.const_set($nesting[0], 'CalloutExtractRxt', "(\\\\)?<()(\\d+|\\.)>(?=(?: ?\\\\?<(?:\\d+|\\.)>)*$)"); + Opal.const_set($nesting[0], 'CalloutExtractRxMap', $send($$$('::', 'Hash'), 'new', [], (TMP_Asciidoctor_7 = function(h, k){var self = TMP_Asciidoctor_7.$$s || this; + + + + if (h == null) { + h = nil; + }; + + if (k == null) { + k = nil; + }; + $writer = [k, new RegExp("" + "(" + ($$$('::', 'Regexp').$escape(k)) + " ?)?" + ($$($nesting, 'CalloutExtractRxt')))]; + $send(h, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];}, TMP_Asciidoctor_7.$$s = self, TMP_Asciidoctor_7.$$arity = 2, TMP_Asciidoctor_7))); + Opal.const_set($nesting[0], 'CalloutScanRx', new RegExp("" + "\\\\?(?=(?: ?\\\\?)*" + ($$($nesting, 'CC_EOL')) + ")")); + Opal.const_set($nesting[0], 'CalloutSourceRx', new RegExp("" + "((?://|#|--|;;) ?)?(\\\\)?<!?(|--)(\\d+|\\.)\\3>(?=(?: ?\\\\?<!?\\3(?:\\d+|\\.)\\3>)*" + ($$($nesting, 'CC_EOL')) + ")")); + Opal.const_set($nesting[0], 'CalloutSourceRxt', "" + "(\\\\)?<()(\\d+|\\.)>(?=(?: ?\\\\?<(?:\\d+|\\.)>)*" + ($$($nesting, 'CC_EOL')) + ")"); + Opal.const_set($nesting[0], 'CalloutSourceRxMap', $send($$$('::', 'Hash'), 'new', [], (TMP_Asciidoctor_8 = function(h, k){var self = TMP_Asciidoctor_8.$$s || this; + + + + if (h == null) { + h = nil; + }; + + if (k == null) { + k = nil; + }; + $writer = [k, new RegExp("" + "(" + ($$$('::', 'Regexp').$escape(k)) + " ?)?" + ($$($nesting, 'CalloutSourceRxt')))]; + $send(h, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];}, TMP_Asciidoctor_8.$$s = self, TMP_Asciidoctor_8.$$arity = 2, TMP_Asciidoctor_8))); + Opal.const_set($nesting[0], 'ListRxMap', $hash2(["ulist", "olist", "dlist", "colist"], {"ulist": $$($nesting, 'UnorderedListRx'), "olist": $$($nesting, 'OrderedListRx'), "dlist": $$($nesting, 'DescriptionListRx'), "colist": $$($nesting, 'CalloutListRx')})); + Opal.const_set($nesting[0], 'ColumnSpecRx', /^(?:(\d+)\*)?([<^>](?:\.[<^>]?)?|(?:[<^>]?\.)?[<^>])?(\d+%?|~)?([a-z])?$/); + Opal.const_set($nesting[0], 'CellSpecStartRx', /^[ \t]*(?:(\d+(?:\.\d*)?|(?:\d*\.)?\d+)([*+]))?([<^>](?:\.[<^>]?)?|(?:[<^>]?\.)?[<^>])?([a-z])?$/); + Opal.const_set($nesting[0], 'CellSpecEndRx', /[ \t]+(?:(\d+(?:\.\d*)?|(?:\d*\.)?\d+)([*+]))?([<^>](?:\.[<^>]?)?|(?:[<^>]?\.)?[<^>])?([a-z])?$/); + Opal.const_set($nesting[0], 'CustomBlockMacroRx', new RegExp("" + "^(" + ($$($nesting, 'CG_WORD')) + "[-" + ($$($nesting, 'CC_WORD')) + "]*)::(|\\S|\\S" + ($$($nesting, 'CC_ANY')) + "*?\\S)\\[(" + ($$($nesting, 'CC_ANY')) + "+)?\\]$")); + Opal.const_set($nesting[0], 'BlockMediaMacroRx', new RegExp("" + "^(image|video|audio)::(\\S|\\S" + ($$($nesting, 'CC_ANY')) + "*?\\S)\\[(" + ($$($nesting, 'CC_ANY')) + "+)?\\]$")); + Opal.const_set($nesting[0], 'BlockTocMacroRx', new RegExp("" + "^toc::\\[(" + ($$($nesting, 'CC_ANY')) + "+)?\\]$")); + Opal.const_set($nesting[0], 'InlineAnchorRx', new RegExp("" + "(\\\\)?(?:\\[\\[([" + ($$($nesting, 'CC_ALPHA')) + "_:][" + ($$($nesting, 'CC_WORD')) + ":.-]*)(?:, *(" + ($$($nesting, 'CC_ANY')) + "+?))?\\]\\]|anchor:([" + ($$($nesting, 'CC_ALPHA')) + "_:][" + ($$($nesting, 'CC_WORD')) + ":.-]*)\\[(?:\\]|(" + ($$($nesting, 'CC_ANY')) + "*?[^\\\\])\\]))")); + Opal.const_set($nesting[0], 'InlineAnchorScanRx', new RegExp("" + "(?:^|[^\\\\\\[])\\[\\[([" + ($$($nesting, 'CC_ALPHA')) + "_:][" + ($$($nesting, 'CC_WORD')) + ":.-]*)(?:, *(" + ($$($nesting, 'CC_ANY')) + "+?))?\\]\\]|(?:^|[^\\\\])anchor:([" + ($$($nesting, 'CC_ALPHA')) + "_:][" + ($$($nesting, 'CC_WORD')) + ":.-]*)\\[(?:\\]|(" + ($$($nesting, 'CC_ANY')) + "*?[^\\\\])\\])")); + Opal.const_set($nesting[0], 'LeadingInlineAnchorRx', new RegExp("" + "^\\[\\[([" + ($$($nesting, 'CC_ALPHA')) + "_:][" + ($$($nesting, 'CC_WORD')) + ":.-]*)(?:, *(" + ($$($nesting, 'CC_ANY')) + "+?))?\\]\\]")); + Opal.const_set($nesting[0], 'InlineBiblioAnchorRx', new RegExp("" + "^\\[\\[\\[([" + ($$($nesting, 'CC_ALPHA')) + "_:][" + ($$($nesting, 'CC_WORD')) + ":.-]*)(?:, *(" + ($$($nesting, 'CC_ANY')) + "+?))?\\]\\]\\]")); + Opal.const_set($nesting[0], 'InlineEmailRx', new RegExp("" + "([\\\\>:/])?" + ($$($nesting, 'CG_WORD')) + "[" + ($$($nesting, 'CC_WORD')) + ".%+-]*@" + ($$($nesting, 'CG_ALNUM')) + "[" + ($$($nesting, 'CC_ALNUM')) + ".-]*\\." + ($$($nesting, 'CG_ALPHA')) + "{2,4}\\b")); + Opal.const_set($nesting[0], 'InlineFootnoteMacroRx', new RegExp("" + "\\\\?footnote(?:(ref):|:([\\w-]+)?)\\[(?:|(" + ($$($nesting, 'CC_ALL')) + "*?[^\\\\]))\\]", 'm')); + Opal.const_set($nesting[0], 'InlineImageMacroRx', new RegExp("" + "\\\\?i(?:mage|con):([^:\\s\\[](?:[^\\n\\[]*[^\\s\\[])?)\\[(|" + ($$($nesting, 'CC_ALL')) + "*?[^\\\\])\\]", 'm')); + Opal.const_set($nesting[0], 'InlineIndextermMacroRx', new RegExp("" + "\\\\?(?:(indexterm2?):\\[(" + ($$($nesting, 'CC_ALL')) + "*?[^\\\\])\\]|\\(\\((" + ($$($nesting, 'CC_ALL')) + "+?)\\)\\)(?!\\)))", 'm')); + Opal.const_set($nesting[0], 'InlineKbdBtnMacroRx', new RegExp("" + "(\\\\)?(kbd|btn):\\[(" + ($$($nesting, 'CC_ALL')) + "*?[^\\\\])\\]", 'm')); + Opal.const_set($nesting[0], 'InlineLinkRx', new RegExp("" + "(^|link:|" + ($$($nesting, 'CG_BLANK')) + "|<|[>\\(\\)\\[\\];])(\\\\?(?:https?|file|ftp|irc)://[^\\s\\[\\]<]*[^\\s.,\\[\\]<])(?:\\[(|" + ($$($nesting, 'CC_ALL')) + "*?[^\\\\])\\])?", 'm')); + Opal.const_set($nesting[0], 'InlineLinkMacroRx', new RegExp("" + "\\\\?(?:link|(mailto)):(|[^:\\s\\[][^\\s\\[]*)\\[(|" + ($$($nesting, 'CC_ALL')) + "*?[^\\\\])\\]", 'm')); + Opal.const_set($nesting[0], 'MacroNameRx', new RegExp("" + "^" + ($$($nesting, 'CG_WORD')) + "[-" + ($$($nesting, 'CC_WORD')) + "]*$")); + Opal.const_set($nesting[0], 'InlineStemMacroRx', new RegExp("" + "\\\\?(stem|(?:latex|ascii)math):([a-z]+(?:,[a-z]+)*)?\\[(" + ($$($nesting, 'CC_ALL')) + "*?[^\\\\])\\]", 'm')); + Opal.const_set($nesting[0], 'InlineMenuMacroRx', new RegExp("" + "\\\\?menu:(" + ($$($nesting, 'CG_WORD')) + "|[" + ($$($nesting, 'CC_WORD')) + "&][^\\n\\[]*[^\\s\\[])\\[ *(" + ($$($nesting, 'CC_ALL')) + "*?[^\\\\])?\\]", 'm')); + Opal.const_set($nesting[0], 'InlineMenuRx', new RegExp("" + "\\\\?\"([" + ($$($nesting, 'CC_WORD')) + "&][^\"]*?[ \\n]+>[ \\n]+[^\"]*)\"")); + Opal.const_set($nesting[0], 'InlinePassRx', $hash(false, ["+", "`", new RegExp("" + "(^|[^" + ($$($nesting, 'CC_WORD')) + ";:])(?:\\[([^\\]]+)\\])?(\\\\?(\\+|`)(\\S|\\S" + ($$($nesting, 'CC_ALL')) + "*?\\S)\\4)(?!" + ($$($nesting, 'CG_WORD')) + ")", 'm')], true, ["`", nil, new RegExp("" + "(^|[^`" + ($$($nesting, 'CC_WORD')) + "])(?:\\[([^\\]]+)\\])?(\\\\?(`)([^`\\s]|[^`\\s]" + ($$($nesting, 'CC_ALL')) + "*?\\S)\\4)(?![`" + ($$($nesting, 'CC_WORD')) + "])", 'm')])); + Opal.const_set($nesting[0], 'SinglePlusInlinePassRx', new RegExp("" + "^(\\\\)?\\+(\\S|\\S" + ($$($nesting, 'CC_ALL')) + "*?\\S)\\+$", 'm')); + Opal.const_set($nesting[0], 'InlinePassMacroRx', new RegExp("" + "(?:(?:(\\\\?)\\[([^\\]]+)\\])?(\\\\{0,2})(\\+\\+\\+?|\\$\\$)(" + ($$($nesting, 'CC_ALL')) + "*?)\\4|(\\\\?)pass:([a-z]+(?:,[a-z]+)*)?\\[(|" + ($$($nesting, 'CC_ALL')) + "*?[^\\\\])\\])", 'm')); + Opal.const_set($nesting[0], 'InlineXrefMacroRx', new RegExp("" + "\\\\?(?:<<([" + ($$($nesting, 'CC_WORD')) + "#/.:{]" + ($$($nesting, 'CC_ALL')) + "*?)>>|xref:([" + ($$($nesting, 'CC_WORD')) + "#/.:{]" + ($$($nesting, 'CC_ALL')) + "*?)\\[(?:\\]|(" + ($$($nesting, 'CC_ALL')) + "*?[^\\\\])\\]))", 'm')); + if ($$($nesting, 'RUBY_ENGINE')['$==']("opal")) { + Opal.const_set($nesting[0], 'HardLineBreakRx', new RegExp("" + "^(" + ($$($nesting, 'CC_ANY')) + "*) \\+$", 'm')) + } else { + nil + }; + Opal.const_set($nesting[0], 'MarkdownThematicBreakRx', /^ {0,3}([-*_])( *)\1\2\1$/); + Opal.const_set($nesting[0], 'ExtLayoutBreakRx', /^(?:'{3,}|<{3,}|([-*_])( *)\1\2\1)$/); + Opal.const_set($nesting[0], 'BlankLineRx', /\n{2,}/); + Opal.const_set($nesting[0], 'EscapedSpaceRx', /\\([ \t\n])/); + Opal.const_set($nesting[0], 'ReplaceableTextRx', /[&']|--|\.\.\.|\([CRT]M?\)/); + Opal.const_set($nesting[0], 'SpaceDelimiterRx', /([^\\])[ \t\n]+/); + Opal.const_set($nesting[0], 'SubModifierSniffRx', /[+-]/); + Opal.const_set($nesting[0], 'TrailingDigitsRx', /\d+$/); + if ($$($nesting, 'RUBY_ENGINE')['$==']("opal")) { + } else { + nil + }; + Opal.const_set($nesting[0], 'UriSniffRx', new RegExp("" + "^" + ($$($nesting, 'CG_ALPHA')) + "[" + ($$($nesting, 'CC_ALNUM')) + ".+-]+:/{0,2}")); + Opal.const_set($nesting[0], 'UriTerminatorRx', /[);:]$/); + Opal.const_set($nesting[0], 'XmlSanitizeRx', /<[^>]+>/); + Opal.const_set($nesting[0], 'INTRINSIC_ATTRIBUTES', $hash2(["startsb", "endsb", "vbar", "caret", "asterisk", "tilde", "plus", "backslash", "backtick", "blank", "empty", "sp", "two-colons", "two-semicolons", "nbsp", "deg", "zwsp", "quot", "apos", "lsquo", "rsquo", "ldquo", "rdquo", "wj", "brvbar", "pp", "cpp", "amp", "lt", "gt"], {"startsb": "[", "endsb": "]", "vbar": "|", "caret": "^", "asterisk": "*", "tilde": "~", "plus": "+", "backslash": "\\", "backtick": "`", "blank": "", "empty": "", "sp": " ", "two-colons": "::", "two-semicolons": ";;", "nbsp": " ", "deg": "°", "zwsp": "​", "quot": """, "apos": "'", "lsquo": "‘", "rsquo": "’", "ldquo": "“", "rdquo": "”", "wj": "⁠", "brvbar": "¦", "pp": "++", "cpp": "C++", "amp": "&", "lt": "<", "gt": ">"})); + quote_subs = [["strong", "unconstrained", new RegExp("" + "\\\\?(?:\\[([^\\]]+)\\])?\\*\\*(" + ($$($nesting, 'CC_ALL')) + "+?)\\*\\*", 'm')], ["strong", "constrained", new RegExp("" + "(^|[^" + ($$($nesting, 'CC_WORD')) + ";:}])(?:\\[([^\\]]+)\\])?\\*(\\S|\\S" + ($$($nesting, 'CC_ALL')) + "*?\\S)\\*(?!" + ($$($nesting, 'CG_WORD')) + ")", 'm')], ["double", "constrained", new RegExp("" + "(^|[^" + ($$($nesting, 'CC_WORD')) + ";:}])(?:\\[([^\\]]+)\\])?\"`(\\S|\\S" + ($$($nesting, 'CC_ALL')) + "*?\\S)`\"(?!" + ($$($nesting, 'CG_WORD')) + ")", 'm')], ["single", "constrained", new RegExp("" + "(^|[^" + ($$($nesting, 'CC_WORD')) + ";:`}])(?:\\[([^\\]]+)\\])?'`(\\S|\\S" + ($$($nesting, 'CC_ALL')) + "*?\\S)`'(?!" + ($$($nesting, 'CG_WORD')) + ")", 'm')], ["monospaced", "unconstrained", new RegExp("" + "\\\\?(?:\\[([^\\]]+)\\])?``(" + ($$($nesting, 'CC_ALL')) + "+?)``", 'm')], ["monospaced", "constrained", new RegExp("" + "(^|[^" + ($$($nesting, 'CC_WORD')) + ";:\"'`}])(?:\\[([^\\]]+)\\])?`(\\S|\\S" + ($$($nesting, 'CC_ALL')) + "*?\\S)`(?![" + ($$($nesting, 'CC_WORD')) + "\"'`])", 'm')], ["emphasis", "unconstrained", new RegExp("" + "\\\\?(?:\\[([^\\]]+)\\])?__(" + ($$($nesting, 'CC_ALL')) + "+?)__", 'm')], ["emphasis", "constrained", new RegExp("" + "(^|[^" + ($$($nesting, 'CC_WORD')) + ";:}])(?:\\[([^\\]]+)\\])?_(\\S|\\S" + ($$($nesting, 'CC_ALL')) + "*?\\S)_(?!" + ($$($nesting, 'CG_WORD')) + ")", 'm')], ["mark", "unconstrained", new RegExp("" + "\\\\?(?:\\[([^\\]]+)\\])?##(" + ($$($nesting, 'CC_ALL')) + "+?)##", 'm')], ["mark", "constrained", new RegExp("" + "(^|[^" + ($$($nesting, 'CC_WORD')) + "&;:}])(?:\\[([^\\]]+)\\])?#(\\S|\\S" + ($$($nesting, 'CC_ALL')) + "*?\\S)#(?!" + ($$($nesting, 'CG_WORD')) + ")", 'm')], ["superscript", "unconstrained", /\\?(?:\[([^\]]+)\])?\^(\S+?)\^/], ["subscript", "unconstrained", /\\?(?:\[([^\]]+)\])?~(\S+?)~/]]; + compat_quote_subs = quote_subs.$drop(0); + + $writer = [2, ["double", "constrained", new RegExp("" + "(^|[^" + ($$($nesting, 'CC_WORD')) + ";:}])(?:\\[([^\\]]+)\\])?``(\\S|\\S" + ($$($nesting, 'CC_ALL')) + "*?\\S)''(?!" + ($$($nesting, 'CG_WORD')) + ")", 'm')]]; + $send(compat_quote_subs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = [3, ["single", "constrained", new RegExp("" + "(^|[^" + ($$($nesting, 'CC_WORD')) + ";:}])(?:\\[([^\\]]+)\\])?`(\\S|\\S" + ($$($nesting, 'CC_ALL')) + "*?\\S)'(?!" + ($$($nesting, 'CG_WORD')) + ")", 'm')]]; + $send(compat_quote_subs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = [4, ["monospaced", "unconstrained", new RegExp("" + "\\\\?(?:\\[([^\\]]+)\\])?\\+\\+(" + ($$($nesting, 'CC_ALL')) + "+?)\\+\\+", 'm')]]; + $send(compat_quote_subs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = [5, ["monospaced", "constrained", new RegExp("" + "(^|[^" + ($$($nesting, 'CC_WORD')) + ";:}])(?:\\[([^\\]]+)\\])?\\+(\\S|\\S" + ($$($nesting, 'CC_ALL')) + "*?\\S)\\+(?!" + ($$($nesting, 'CG_WORD')) + ")", 'm')]]; + $send(compat_quote_subs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + compat_quote_subs.$insert(3, ["emphasis", "constrained", new RegExp("" + "(^|[^" + ($$($nesting, 'CC_WORD')) + ";:}])(?:\\[([^\\]]+)\\])?'(\\S|\\S" + ($$($nesting, 'CC_ALL')) + "*?\\S)'(?!" + ($$($nesting, 'CG_WORD')) + ")", 'm')]); + Opal.const_set($nesting[0], 'QUOTE_SUBS', $hash(false, quote_subs, true, compat_quote_subs)); + quote_subs = nil; + compat_quote_subs = nil; + Opal.const_set($nesting[0], 'REPLACEMENTS', [[/\\?\(C\)/, "©", "none"], [/\\?\(R\)/, "®", "none"], [/\\?\(TM\)/, "™", "none"], [/(^|\n| |\\)--( |\n|$)/, " — ", "none"], [new RegExp("" + "(" + ($$($nesting, 'CG_WORD')) + ")\\\\?--(?=" + ($$($nesting, 'CG_WORD')) + ")"), "—​", "leading"], [/\\?\.\.\./, "…​", "leading"], [/\\?`'/, "’", "none"], [new RegExp("" + "(" + ($$($nesting, 'CG_ALNUM')) + ")\\\\?'(?=" + ($$($nesting, 'CG_ALPHA')) + ")"), "’", "leading"], [/\\?->/, "→", "none"], [/\\?=>/, "⇒", "none"], [/\\?<-/, "←", "none"], [/\\?<=/, "⇐", "none"], [/\\?(&)amp;((?:[a-zA-Z][a-zA-Z]+\d{0,2}|#\d\d\d{0,4}|#x[\da-fA-F][\da-fA-F][\da-fA-F]{0,3});)/, "", "bounding"]]); + (function(self, $parent_nesting) { + var def = self.prototype, $nesting = [self].concat($parent_nesting), TMP_load_9, TMP_load_file_13, TMP_convert_15, TMP_convert_file_16; + + + + Opal.def(self, '$load', TMP_load_9 = function $$load(input, options) { + var $a, $b, TMP_10, TMP_11, TMP_12, self = this, timings = nil, logger = nil, $writer = nil, attrs = nil, attrs_arr = nil, lines = nil, input_path = nil, input_mtime = nil, docdate = nil, doctime = nil, doc = nil, ex = nil, context = nil, wrapped_ex = nil; + + + + if (options == null) { + options = $hash2([], {}); + }; + try { + + options = options.$dup(); + if ($truthy((timings = options['$[]']("timings")))) { + timings.$start("read")}; + if ($truthy(($truthy($a = (logger = options['$[]']("logger"))) ? logger['$!=']($$($nesting, 'LoggerManager').$logger()) : $a))) { + + $writer = [logger]; + $send($$($nesting, 'LoggerManager'), 'logger=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if ($truthy((attrs = options['$[]']("attributes"))['$!']())) { + attrs = $hash2([], {}) + } else if ($truthy(($truthy($a = $$$('::', 'Hash')['$==='](attrs)) ? $a : ($truthy($b = $$$('::', 'RUBY_ENGINE_JRUBY')) ? $$$($$$($$$('::', 'Java'), 'JavaUtil'), 'Map')['$==='](attrs) : $b)))) { + attrs = attrs.$dup() + } else if ($truthy($$$('::', 'Array')['$==='](attrs))) { + + $a = [$hash2([], {}), attrs], (attrs = $a[0]), (attrs_arr = $a[1]), $a; + $send(attrs_arr, 'each', [], (TMP_10 = function(entry){var self = TMP_10.$$s || this, $c, $d, k = nil, v = nil; + + + + if (entry == null) { + entry = nil; + }; + $d = entry.$split("=", 2), $c = Opal.to_ary($d), (k = ($c[0] == null ? nil : $c[0])), (v = ($c[1] == null ? nil : $c[1])), $d; + + $writer = [k, ($truthy($c = v) ? $c : "")]; + $send(attrs, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];;}, TMP_10.$$s = self, TMP_10.$$arity = 1, TMP_10)); + } else if ($truthy($$$('::', 'String')['$==='](attrs))) { + + $a = [$hash2([], {}), attrs.$gsub($$($nesting, 'SpaceDelimiterRx'), "" + "\\1" + ($$($nesting, 'NULL'))).$gsub($$($nesting, 'EscapedSpaceRx'), "\\1").$split($$($nesting, 'NULL'))], (attrs = $a[0]), (attrs_arr = $a[1]), $a; + $send(attrs_arr, 'each', [], (TMP_11 = function(entry){var self = TMP_11.$$s || this, $c, $d, k = nil, v = nil; + + + + if (entry == null) { + entry = nil; + }; + $d = entry.$split("=", 2), $c = Opal.to_ary($d), (k = ($c[0] == null ? nil : $c[0])), (v = ($c[1] == null ? nil : $c[1])), $d; + + $writer = [k, ($truthy($c = v) ? $c : "")]; + $send(attrs, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];;}, TMP_11.$$s = self, TMP_11.$$arity = 1, TMP_11)); + } else if ($truthy(($truthy($a = attrs['$respond_to?']("keys")) ? attrs['$respond_to?']("[]") : $a))) { + attrs = $$$('::', 'Hash')['$[]']($send(attrs.$keys(), 'map', [], (TMP_12 = function(k){var self = TMP_12.$$s || this; + + + + if (k == null) { + k = nil; + }; + return [k, attrs['$[]'](k)];}, TMP_12.$$s = self, TMP_12.$$arity = 1, TMP_12))) + } else { + self.$raise($$$('::', 'ArgumentError'), "" + "illegal type for attributes option: " + (attrs.$class().$ancestors().$join(" < "))) + }; + lines = nil; + if ($truthy($$$('::', 'File')['$==='](input))) { + + input_path = $$$('::', 'File').$expand_path(input.$path()); + input_mtime = (function() {if ($truthy($$$('::', 'ENV')['$[]']("SOURCE_DATE_EPOCH"))) { + return $$$('::', 'Time').$at(self.$Integer($$$('::', 'ENV')['$[]']("SOURCE_DATE_EPOCH"))).$utc() + } else { + return input.$mtime() + }; return nil; })(); + lines = input.$readlines(); + + $writer = ["docfile", input_path]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["docdir", $$$('::', 'File').$dirname(input_path)]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + + $writer = ["docname", $$($nesting, 'Helpers').$basename(input_path, (($writer = ["docfilesuffix", $$$('::', 'File').$extname(input_path)]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]))]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + if ($truthy((docdate = attrs['$[]']("docdate")))) { + ($truthy($a = attrs['$[]']("docyear")) ? $a : (($writer = ["docyear", (function() {if (docdate.$index("-")['$=='](4)) { + + return docdate.$slice(0, 4); + } else { + return nil + }; return nil; })()]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])) + } else { + + docdate = (($writer = ["docdate", input_mtime.$strftime("%F")]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]); + ($truthy($a = attrs['$[]']("docyear")) ? $a : (($writer = ["docyear", input_mtime.$year().$to_s()]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + }; + doctime = ($truthy($a = attrs['$[]']("doctime")) ? $a : (($writer = ["doctime", input_mtime.$strftime("" + "%T " + ((function() {if (input_mtime.$utc_offset()['$=='](0)) { + return "UTC" + } else { + return "%z" + }; return nil; })()))]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])); + + $writer = ["docdatetime", "" + (docdate) + " " + (doctime)]; + $send(attrs, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + } else if ($truthy(input['$respond_to?']("readlines"))) { + + + try { + input.$rewind() + } catch ($err) { + if (Opal.rescue($err, [$$($nesting, 'StandardError')])) { + try { + nil + } finally { Opal.pop_exception() } + } else { throw $err; } + };; + lines = input.$readlines(); + } else if ($truthy($$$('::', 'String')['$==='](input))) { + lines = (function() {if ($truthy($$$('::', 'RUBY_MIN_VERSION_2'))) { + return input.$lines() + } else { + return input.$each_line().$to_a() + }; return nil; })() + } else if ($truthy($$$('::', 'Array')['$==='](input))) { + lines = input.$drop(0) + } else { + self.$raise($$$('::', 'ArgumentError'), "" + "unsupported input type: " + (input.$class())) + }; + if ($truthy(timings)) { + + timings.$record("read"); + timings.$start("parse");}; + + $writer = ["attributes", attrs]; + $send(options, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + doc = (function() {if (options['$[]']("parse")['$=='](false)) { + + return $$($nesting, 'Document').$new(lines, options); + } else { + return $$($nesting, 'Document').$new(lines, options).$parse() + }; return nil; })(); + if ($truthy(timings)) { + timings.$record("parse")}; + return doc; + } catch ($err) { + if (Opal.rescue($err, [$$($nesting, 'StandardError')])) {ex = $err; + try { + + + try { + + context = "" + "asciidoctor: FAILED: " + (($truthy($a = attrs['$[]']("docfile")) ? $a : "")) + ": Failed to load AsciiDoc document"; + if ($truthy(ex['$respond_to?']("exception"))) { + + wrapped_ex = ex.$exception("" + (context) + " - " + (ex.$message())); + wrapped_ex.$set_backtrace(ex.$backtrace()); + } else { + + wrapped_ex = ex.$class().$new(context, ex); + + $writer = [ex.$stack_trace()]; + $send(wrapped_ex, 'stack_trace=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + }; + } catch ($err) { + if (Opal.rescue($err, [$$($nesting, 'StandardError')])) { + try { + wrapped_ex = ex + } finally { Opal.pop_exception() } + } else { throw $err; } + };; + return self.$raise(wrapped_ex); + } finally { Opal.pop_exception() } + } else { throw $err; } + }; + }, TMP_load_9.$$arity = -2); + + Opal.def(self, '$load_file', TMP_load_file_13 = function $$load_file(filename, options) { + var TMP_14, self = this; + + + + if (options == null) { + options = $hash2([], {}); + }; + return $send($$$('::', 'File'), 'open', [filename, "rb"], (TMP_14 = function(file){var self = TMP_14.$$s || this; + + + + if (file == null) { + file = nil; + }; + return self.$load(file, options);}, TMP_14.$$s = self, TMP_14.$$arity = 1, TMP_14)); + }, TMP_load_file_13.$$arity = -2); + + Opal.def(self, '$convert', TMP_convert_15 = function $$convert(input, options) { + var $a, $b, $c, $d, $e, self = this, to_file = nil, to_dir = nil, mkdirs = nil, $case = nil, write_to_same_dir = nil, stream_output = nil, write_to_target = nil, $writer = nil, input_path = nil, outdir = nil, doc = nil, outfile = nil, working_dir = nil, jail = nil, opts = nil, output = nil, stylesdir = nil, copy_asciidoctor_stylesheet = nil, copy_user_stylesheet = nil, stylesheet = nil, copy_coderay_stylesheet = nil, copy_pygments_stylesheet = nil, stylesoutdir = nil, stylesheet_src = nil, stylesheet_dest = nil, stylesheet_data = nil; + + + + if (options == null) { + options = $hash2([], {}); + }; + options = options.$dup(); + options.$delete("parse"); + to_file = options.$delete("to_file"); + to_dir = options.$delete("to_dir"); + mkdirs = ($truthy($a = options.$delete("mkdirs")) ? $a : false); + $case = to_file; + if (true['$===']($case) || nil['$===']($case)) { + write_to_same_dir = ($truthy($a = to_dir['$!']()) ? $$$('::', 'File')['$==='](input) : $a); + stream_output = false; + write_to_target = to_dir; + to_file = nil;} + else if (false['$===']($case)) { + write_to_same_dir = false; + stream_output = false; + write_to_target = false; + to_file = nil;} + else if ("/dev/null"['$===']($case)) {return self.$load(input, options)} + else { + write_to_same_dir = false; + write_to_target = (function() {if ($truthy((stream_output = to_file['$respond_to?']("write")))) { + return false + } else { + + + $writer = ["to_file", to_file]; + $send(options, '[]=', Opal.to_a($writer)); + return $writer[$rb_minus($writer["length"], 1)];; + }; return nil; })();}; + if ($truthy(options['$key?']("header_footer"))) { + } else if ($truthy(($truthy($a = write_to_same_dir) ? $a : write_to_target))) { + + $writer = ["header_footer", true]; + $send(options, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}; + if ($truthy(write_to_same_dir)) { + + input_path = $$$('::', 'File').$expand_path(input.$path()); + + $writer = ["to_dir", (outdir = $$$('::', 'File').$dirname(input_path))]; + $send(options, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];; + } else if ($truthy(write_to_target)) { + if ($truthy(to_dir)) { + if ($truthy(to_file)) { + + $writer = ["to_dir", $$$('::', 'File').$dirname($$$('::', 'File').$expand_path($$$('::', 'File').$join(to_dir, to_file)))]; + $send(options, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + } else { + + $writer = ["to_dir", $$$('::', 'File').$expand_path(to_dir)]; + $send(options, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)]; + } + } else if ($truthy(to_file)) { + + $writer = ["to_dir", $$$('::', 'File').$dirname($$$('::', 'File').$expand_path(to_file))]; + $send(options, '[]=', Opal.to_a($writer)); + $writer[$rb_minus($writer["length"], 1)];}}; + doc = self.$load(input, options); + if ($truthy(write_to_same_dir)) { + + outfile = $$$('::', 'File').$join(outdir, "" + (doc.$attributes()['$[]']("docname")) + (doc.$outfilesuffix())); + if (outfile['$=='](input_path)) { + self.$raise($$$('::', 'IOError'), "" + "input file and output file cannot be the same: " + (outfile))}; + } else if ($truthy(write_to_target)) { + + working_dir = (function() {if ($truthy(options['$key?']("base_dir"))) { + + return $$$('::', 'File').$expand_path(options['$[]']("base_dir")); + } else { + return $$$('::', 'Dir').$pwd() + }; return nil; })(); + jail = (function() {if ($truthy($rb_ge(doc.$safe(), $$$($$($nesting, 'SafeMode'), 'SAFE')))) { + return working_dir + } else { + return nil + }; return nil; })(); + if ($truthy(to_dir)) { + + outdir = doc.$normalize_system_path(to_dir, working_dir, jail, $hash2(["target_name", "recover"], {"target_name": "to_dir", "recover": false})); + if ($truthy(to_file)) { + + outfile = doc.$normalize_system_path(to_file, outdir, nil, $hash2(["target_name", "recover"], {"target_name": "to_dir", "recover": false})); + outdir = $$$('::', 'File').$dirname(outfile); + } else { + outfile = $$$('::', 'File').$join(outdir, "" + (doc.$attributes()['$[]']("docname")) + (doc.$outfilesuffix())) + }; + } else if ($truthy(to_file)) { + + outfile = doc.$normalize_system_path(to_file, working_dir, jail, $hash2(["target_name", "recover"], {"target_name": "to_dir", "recover": false})); + outdir = $$$('::', 'File').$dirname(outfile);}; + if ($truthy(($truthy($a = $$$('::', 'File')['$==='](input)) ? outfile['$==']($$$('::', 'File').$expand_path(input.$path())) : $a))) { + self.$raise($$$('::', 'IOError'), "" + "input file and output file cannot be the same: " + (outfile))}; + if ($truthy(mkdirs)) { + $$($nesting, 'Helpers').$mkdir_p(outdir) + } else if ($truthy($$$('::', 'File')['$directory?'](outdir))) { + } else { + self.$raise($$$('::', 'IOError'), "" + "target directory does not exist: " + (to_dir) + " (hint: set mkdirs option)") + }; + } else { + + outfile = to_file; + outdir = nil; + }; + opts = (function() {if ($truthy(($truthy($a = outfile) ? stream_output['$!']() : $a))) { + return $hash2(["outfile", "outdir"], {"outfile": outfile, "outdir": outdir}) + } else { + return $hash2([], {}) + }; return nil; })(); + output = doc.$convert(opts); + if ($truthy(outfile)) { + + doc.$write(output, outfile); + if ($truthy(($truthy($a = ($truthy($b = ($truthy($c = ($truthy($d = ($truthy($e = stream_output['$!']()) ? $rb_lt(doc.$safe(), $$$($$($nesting, 'SafeMode'), 'SECURE')) : $e)) ? doc['$attr?']("linkcss") : $d)) ? doc['$attr?']("copycss") : $c)) ? doc['$attr?']("basebackend-html") : $b)) ? ($truthy($b = (stylesdir = doc.$attr("stylesdir"))) ? $$($nesting, 'Helpers')['$uriish?'](stylesdir) : $b)['$!']() : $a))) { + + copy_asciidoctor_stylesheet = false; + copy_user_stylesheet = false; + if ($truthy((stylesheet = doc.$attr("stylesheet")))) { + if ($truthy($$($nesting, 'DEFAULT_STYLESHEET_KEYS')['$include?'](stylesheet))) { + copy_asciidoctor_stylesheet = true + } else if ($truthy($$($nesting, 'Helpers')['$uriish?'](stylesheet)['$!']())) { + copy_user_stylesheet = true}}; + copy_coderay_stylesheet = ($truthy($a = doc['$attr?']("source-highlighter", "coderay")) ? doc.$attr("coderay-css", "class")['$==']("class") : $a); + copy_pygments_stylesheet = ($truthy($a = doc['$attr?']("source-highlighter", "pygments")) ? doc.$attr("pygments-css", "class")['$==']("class") : $a); + if ($truthy(($truthy($a = ($truthy($b = ($truthy($c = copy_asciidoctor_stylesheet) ? $c : copy_user_stylesheet)) ? $b : copy_coderay_stylesheet)) ? $a : copy_pygments_stylesheet))) { + + stylesoutdir = doc.$normalize_system_path(stylesdir, outdir, (function() {if ($truthy($rb_ge(doc.$safe(), $$$($$($nesting, 'SafeMode'), 'SAFE')))) { + return outdir + } else { + return nil + }; return nil; })()); + if ($truthy(mkdirs)) { + $$($nesting, 'Helpers').$mkdir_p(stylesoutdir) + } else if ($truthy($$$('::', 'File')['$directory?'](stylesoutdir))) { + } else { + self.$raise($$$('::', 'IOError'), "" + "target stylesheet directory does not exist: " + (stylesoutdir) + " (hint: set mkdirs option)") + }; + if ($truthy(copy_asciidoctor_stylesheet)) { + $$($nesting, 'Stylesheets').$instance().$write_primary_stylesheet(stylesoutdir) + } else if ($truthy(copy_user_stylesheet)) { + + if ($truthy((stylesheet_src = doc.$attr("copycss"))['$empty?']())) { + stylesheet_src = doc.$normalize_system_path(stylesheet) + } else { + stylesheet_src = doc.$normalize_system_path(stylesheet_src) + }; + stylesheet_dest = doc.$normalize_system_path(stylesheet, stylesoutdir, (function() {if ($truthy($rb_ge(doc.$safe(), $$$($$($nesting, 'SafeMode'), 'SAFE')))) { + return outdir + } else { + return nil + }; return nil; })()); + if ($truthy(($truthy($a = stylesheet_src['$!='](stylesheet_dest)) ? (stylesheet_data = doc.$read_asset(stylesheet_src, $hash2(["warn_on_failure", "label"], {"warn_on_failure": $$$('::', 'File')['$file?'](stylesheet_dest)['$!'](), "label": "stylesheet"}))) : $a))) { + $$$('::', 'IO').$write(stylesheet_dest, stylesheet_data)};}; + if ($truthy(copy_coderay_stylesheet)) { + $$($nesting, 'Stylesheets').$instance().$write_coderay_stylesheet(stylesoutdir) + } else if ($truthy(copy_pygments_stylesheet)) { + $$($nesting, 'Stylesheets').$instance().$write_pygments_stylesheet(stylesoutdir, doc.$attr("pygments-style"))};};}; + return doc; + } else { + return output + }; + }, TMP_convert_15.$$arity = -2); + Opal.alias(self, "render", "convert"); + + Opal.def(self, '$convert_file', TMP_convert_file_16 = function $$convert_file(filename, options) { + var TMP_17, self = this; + + + + if (options == null) { + options = $hash2([], {}); + }; + return $send($$$('::', 'File'), 'open', [filename, "rb"], (TMP_17 = function(file){var self = TMP_17.$$s || this; + + + + if (file == null) { + file = nil; + }; + return self.$convert(file, options);}, TMP_17.$$s = self, TMP_17.$$arity = 1, TMP_17)); + }, TMP_convert_file_16.$$arity = -2); + Opal.alias(self, "render_file", "convert_file"); + if ($$($nesting, 'RUBY_ENGINE')['$==']("opal")) { + return nil + } else { + return nil + }; + })(Opal.get_singleton_class(self), $nesting); + if ($$($nesting, 'RUBY_ENGINE')['$==']("opal")) { + + self.$require("asciidoctor/timings"); + self.$require("asciidoctor/version"); + } else { + nil + }; + })($nesting[0], $nesting); + self.$require("asciidoctor/core_ext"); + self.$require("asciidoctor/helpers"); + self.$require("asciidoctor/substitutors"); + self.$require("asciidoctor/abstract_node"); + self.$require("asciidoctor/abstract_block"); + self.$require("asciidoctor/attribute_list"); + self.$require("asciidoctor/block"); + self.$require("asciidoctor/callouts"); + self.$require("asciidoctor/converter"); + self.$require("asciidoctor/document"); + self.$require("asciidoctor/inline"); + self.$require("asciidoctor/list"); + self.$require("asciidoctor/parser"); + self.$require("asciidoctor/path_resolver"); + self.$require("asciidoctor/reader"); + self.$require("asciidoctor/section"); + self.$require("asciidoctor/stylesheets"); + self.$require("asciidoctor/table"); + if ($$($nesting, 'RUBY_ENGINE')['$==']("opal")) { + return self.$require("asciidoctor/js/postscript") + } else { + return nil + }; +})(Opal); + + +/** + * Convert a JSON to an (Opal) Hash. + * @private + */ +var toHash = function (object) { + return object && !('$$smap' in object) ? Opal.hash(object) : object; +}; + +/** + * Convert an (Opal) Hash to JSON. + * @private + */ +var fromHash = function (hash) { + var object = {}; + var data = hash.$$smap; + for (var key in data) { + object[key] = data[key]; + } + return object; +}; + +/** + * @private + */ +var prepareOptions = function (options) { + if (options = toHash(options)) { + var attrs = options['$[]']('attributes'); + if (attrs && typeof attrs === 'object' && attrs.constructor.name === 'Object') { + options = options.$dup(); + options['$[]=']('attributes', toHash(attrs)); + } + } + return options; +}; + +function initializeClass (superClass, className, functions, defaultFunctions, argProxyFunctions) { + var scope = Opal.klass(Opal.Object, superClass, className, function () {}); + var postConstructFunction; + var initializeFunction; + var defaultFunctionsOverridden = {}; + for (var functionName in functions) { + if (functions.hasOwnProperty(functionName)) { + (function (functionName) { + var userFunction = functions[functionName]; + if (functionName === 'postConstruct') { + postConstructFunction = userFunction; + } else if (functionName === 'initialize') { + initializeFunction = userFunction; + } else { + if (defaultFunctions && defaultFunctions.hasOwnProperty(functionName)) { + defaultFunctionsOverridden[functionName] = true; + } + Opal.def(scope, '$' + functionName, function () { + var args; + if (argProxyFunctions && argProxyFunctions.hasOwnProperty(functionName)) { + args = argProxyFunctions[functionName](arguments); + } else { + args = arguments; + } + return userFunction.apply(this, args); + }); + } + }(functionName)); + } + } + var initialize; + if (typeof initializeFunction === 'function') { + initialize = function () { + initializeFunction.apply(this, arguments); + if (typeof postConstructFunction === 'function') { + postConstructFunction.bind(this)(); + } + }; + } else { + initialize = function () { + Opal.send(this, Opal.find_super_dispatcher(this, 'initialize', initialize)); + if (typeof postConstructFunction === 'function') { + postConstructFunction.bind(this)(); + } + }; + } + Opal.def(scope, '$initialize', initialize); + Opal.def(scope, 'super', function (func) { + if (typeof func === 'function') { + Opal.send(this, Opal.find_super_dispatcher(this, func.name, func)); + } else { + // Bind the initialize function to super(); + var argumentsList = Array.from(arguments); + for (var i = 0; i < argumentsList.length; i++) { + // convert all (Opal) Hash arguments to JSON. + if (typeof argumentsList[i] === 'object') { + argumentsList[i] = toHash(argumentsList[i]); + } + } + Opal.send(this, Opal.find_super_dispatcher(this, 'initialize', initialize), argumentsList); + } + }); + if (defaultFunctions) { + for (var defaultFunctionName in defaultFunctions) { + if (defaultFunctions.hasOwnProperty(defaultFunctionName) && !defaultFunctionsOverridden.hasOwnProperty(defaultFunctionName)) { + (function (defaultFunctionName) { + var defaultFunction = defaultFunctions[defaultFunctionName]; + Opal.def(scope, '$' + defaultFunctionName, function () { + return defaultFunction.apply(this, arguments); + }); + }(defaultFunctionName)); + } + } + } + return scope; +} + +// Asciidoctor API + +/** + * @namespace + * @description + * Methods for parsing AsciiDoc input files and converting documents. + * + * AsciiDoc documents comprise a header followed by zero or more sections. + * Sections are composed of blocks of content. For example: + *
    + *   = Doc Title
    + *
    + *   == Section 1
    + *
    + *   This is a paragraph block in the first section.
    + *
    + *   == Section 2
    + *
    + *   This section has a paragraph block and an olist block.
    + *
    + *   . Item 1
    + *   . Item 2
    + * 
    + * + * @example + * asciidoctor.convertFile('sample.adoc'); + */ +var Asciidoctor = Opal.Asciidoctor['$$class']; + +/** + * Get Asciidoctor core version number. + * + * @memberof Asciidoctor + * @returns {string} - returns the version number of Asciidoctor core. + */ +Asciidoctor.prototype.getCoreVersion = function () { + return this.$$const.VERSION; +}; + +/** + * Get Asciidoctor.js runtime environment informations. + * + * @memberof Asciidoctor + * @returns {Object} - returns the runtime environement including the ioModule, the platform, the engine and the framework. + */ +Asciidoctor.prototype.getRuntime = function () { + return { + ioModule: Opal.const_get_qualified('::', 'JAVASCRIPT_IO_MODULE'), + platform: Opal.const_get_qualified('::', 'JAVASCRIPT_PLATFORM'), + engine: Opal.const_get_qualified('::', 'JAVASCRIPT_ENGINE'), + framework: Opal.const_get_qualified('::', 'JAVASCRIPT_FRAMEWORK') + }; +}; + +/** + * Parse the AsciiDoc source input into an {@link Document} and convert it to the specified backend format. + * + * Accepts input as a Buffer or String. + * + * @param {string|Buffer} input - AsciiDoc input as String or Buffer + * @param {Object} options - a JSON of options to control processing (default: {}) + * @returns {string|Document} - returns the {@link Document} object if the converted String is written to a file, + * otherwise the converted String + * @memberof Asciidoctor + * @example + * var input = '= Hello, AsciiDoc!\n' + + * 'Guillaume Grossetie \n\n' + + * 'An introduction to http://asciidoc.org[AsciiDoc].\n\n' + + * '== First Section\n\n' + + * '* item 1\n' + + * '* item 2\n'; + * + * var html = asciidoctor.convert(input); + */ +Asciidoctor.prototype.convert = function (input, options) { + if (typeof input === 'object' && input.constructor.name === 'Buffer') { + input = input.toString('utf8'); + } + var result = this.$convert(input, prepareOptions(options)); + return result === Opal.nil ? '' : result; +}; + +/** + * Parse the AsciiDoc source input into an {@link Document} and convert it to the specified backend format. + * + * @param {string} filename - source filename + * @param {Object} options - a JSON of options to control processing (default: {}) + * @returns {string|Document} - returns the {@link Document} object if the converted String is written to a file, + * otherwise the converted String + * @memberof Asciidoctor + * @example + * var html = asciidoctor.convertFile('./document.adoc'); + */ +Asciidoctor.prototype.convertFile = function (filename, options) { + return this.$convert_file(filename, prepareOptions(options)); +}; + +/** + * Parse the AsciiDoc source input into an {@link Document} + * + * Accepts input as a Buffer or String. + * + * @param {string|Buffer} input - AsciiDoc input as String or Buffer + * @param {Object} options - a JSON of options to control processing (default: {}) + * @returns {Document} - returns the {@link Document} object + * @memberof Asciidoctor + */ +Asciidoctor.prototype.load = function (input, options) { + if (typeof input === 'object' && input.constructor.name === 'Buffer') { + input = input.toString('utf8'); + } + return this.$load(input, prepareOptions(options)); +}; + +/** + * Parse the contents of the AsciiDoc source file into an {@link Document} + * + * @param {string} filename - source filename + * @param {Object} options - a JSON of options to control processing (default: {}) + * @returns {Document} - returns the {@link Document} object + * @memberof Asciidoctor + */ +Asciidoctor.prototype.loadFile = function (filename, options) { + return this.$load_file(filename, prepareOptions(options)); +}; + +// AbstractBlock API + +/** + * @namespace + * @extends AbstractNode + */ +var AbstractBlock = Opal.Asciidoctor.AbstractBlock; + +/** + * Append a block to this block's list of child blocks. + * + * @memberof AbstractBlock + * @returns {AbstractBlock} - the parent block to which this block was appended. + * + */ +AbstractBlock.prototype.append = function (block) { + this.$append(block); + return this; +}; + +/* + * Apply the named inline substitutions to the specified text. + * + * If no substitutions are specified, the following substitutions are + * applied: + * + * specialcharacters, quotes, attributes, replacements, macros, and post_replacements + * @param {string} text - The text to substitute. + * @param {Array} subs - A list named substitutions to apply to the text. + * @memberof AbstractBlock + * @returns {string} - returns the substituted text. + */ +AbstractBlock.prototype.applySubstitutions = function (text, subs) { + return this.$apply_subs(text, subs); +}; + +/** + * Get the String title of this Block with title substitions applied + * + * The following substitutions are applied to block and section titles: + * + * specialcharacters, quotes, replacements, macros, attributes and post_replacements + * + * @memberof AbstractBlock + * @returns {string} - returns the converted String title for this Block, or undefined if the title is not set. + * @example + * block.title // "Foo 3^ # {two-colons} Bar(1)" + * block.getTitle(); // "Foo 3^ # :: Bar(1)" + */ +AbstractBlock.prototype.getTitle = function () { + var title = this.$title(); + return title === Opal.nil ? undefined : title; +}; + +/** + * Convenience method that returns the interpreted title of the Block + * with the caption prepended. + * Concatenates the value of this Block's caption instance variable and the + * return value of this Block's title method. No space is added between the + * two values. If the Block does not have a caption, the interpreted title is + * returned. + * + * @memberof AbstractBlock + * @returns {string} - the converted String title prefixed with the caption, or just the + * converted String title if no caption is set + */ +AbstractBlock.prototype.getCaptionedTitle = function () { + return this.$captioned_title(); +}; + +/** + * Get the style (block type qualifier) for this block. + * @memberof AbstractBlock + * @returns {string} - returns the style for this block + */ +AbstractBlock.prototype.getStyle = function () { + return this.style; +}; + +/** + * Get the caption for this block. + * @memberof AbstractBlock + * @returns {string} - returns the caption for this block + */ +AbstractBlock.prototype.getCaption = function () { + return this.$caption(); +}; + +/** + * Set the caption for this block. + * @param {string} caption - Caption + * @memberof AbstractBlock + */ +AbstractBlock.prototype.setCaption = function (caption) { + this.caption = caption; +}; + +/** + * Get the level of this section or the section level in which this block resides. + * @memberof AbstractBlock + * @returns {number} - returns the level of this section + */ +AbstractBlock.prototype.getLevel = function () { + return this.level; +}; + +/** + * Get the substitution keywords to be applied to the contents of this block. + * + * @memberof AbstractBlock + * @returns {Array} - the list of {string} substitution keywords associated with this block. + */ +AbstractBlock.prototype.getSubstitutions = function () { + return this.subs; +}; + +/** + * Check whether a given substitution keyword is present in the substitutions for this block. + * + * @memberof AbstractBlock + * @returns {boolean} - whether the substitution is present on this block. + */ +AbstractBlock.prototype.hasSubstitution = function (substitution) { + return this['$sub?'](substitution); +}; + +/** + * Remove the specified substitution keyword from the list of substitutions for this block. + * + * @memberof AbstractBlock + * @returns undefined + */ +AbstractBlock.prototype.removeSubstitution = function (substitution) { + this.$remove_sub(substitution); +}; + +/** + * Checks if the {@link AbstractBlock} contains any child blocks. + * @memberof AbstractBlock + * @returns {boolean} - whether the {@link AbstractBlock} has child blocks. + */ +AbstractBlock.prototype.hasBlocks = function () { + return this.blocks.length > 0; +}; + +/** + * Get the list of {@link AbstractBlock} sub-blocks for this block. + * @memberof AbstractBlock + * @returns {Array} - returns a list of {@link AbstractBlock} sub-blocks + */ +AbstractBlock.prototype.getBlocks = function () { + return this.blocks; +}; + +/** + * Get the converted result of the child blocks by converting the children appropriate to content model that this block supports. + * @memberof AbstractBlock + * @returns {string} - returns the converted result of the child blocks + */ +AbstractBlock.prototype.getContent = function () { + return this.$content(); +}; + +/** + * Get the converted content for this block. + * If the block has child blocks, the content method should cause them to be converted + * and returned as content that can be included in the parent block's template. + * @memberof AbstractBlock + * @returns {string} - returns the converted String content for this block + */ +AbstractBlock.prototype.convert = function () { + return this.$convert(); +}; + +/** + * Query for all descendant block-level nodes in the document tree + * that match the specified selector (context, style, id, and/or role). + * If a function block is given, it's used as an additional filter. + * If no selector or function block is supplied, all block-level nodes in the tree are returned. + * @param {Object} [selector] + * @param {function} [block] + * @example + * doc.findBy({'context': 'section'}); + * // => { level: 0, title: "Hello, AsciiDoc!", blocks: 0 } + * // => { level: 1, title: "First Section", blocks: 1 } + * + * doc.findBy({'context': 'section'}, function (section) { return section.getLevel() === 1; }); + * // => { level: 1, title: "First Section", blocks: 1 } + * + * doc.findBy({'context': 'listing', 'style': 'source'}); + * // => { context: :listing, content_model: :verbatim, style: "source", lines: 1 } + * + * @memberof AbstractBlock + * @returns {Array} - returns a list of block-level nodes that match the filter or an empty list if no matches are found + */ +AbstractBlock.prototype.findBy = function (selector, block) { + if (typeof block === 'undefined' && typeof selector === 'function') { + return Opal.send(this, 'find_by', null, selector); + } + else if (typeof block === 'function') { + return Opal.send(this, 'find_by', [toHash(selector)], block); + } + else { + return this.$find_by(toHash(selector)); + } +}; + +/** + * Get the source line number where this block started. + * @memberof AbstractBlock + * @returns {number} - returns the source line number where this block started + */ +AbstractBlock.prototype.getLineNumber = function () { + var lineno = this.$lineno(); + return lineno === Opal.nil ? undefined : lineno; +}; + +/** + * Check whether this block has any child Section objects. + * Only applies to Document and Section instances. + * @memberof AbstractBlock + * @returns {boolean} - true if this block has child Section objects, otherwise false + */ +AbstractBlock.prototype.hasSections = function () { + return this['$sections?'](); +}; + +/** + * Get the Array of child Section objects. + * Only applies to Document and Section instances. + * @memberof AbstractBlock + * @returns {Array} - returns an {Array} of {@link Section} objects + */ +AbstractBlock.prototype.getSections = function () { + return this.$sections(); +}; + +/** + * Get the numeral of this block (if section, relative to parent, otherwise absolute). + * Only assigned to section if automatic section numbering is enabled. + * Only assigned to formal block (block with title) if corresponding caption attribute is present. + * If the section is an appendix, the numeral is a letter (starting with A). + * @memberof AbstractBlock + * @returns {string} - returns the numeral + */ +AbstractBlock.prototype.getNumeral = function () { + // number was renamed to numeral + // https://github.com/asciidoctor/asciidoctor/commit/33ac4821e0375bcd5aa189c394ad7630717bcd55 + return this.$number(); +}; + +/** + * Set the numeral of this block. + * @memberof AbstractBlock + */ +AbstractBlock.prototype.setNumeral = function (value) { + // number was renamed to numeral + // https://github.com/asciidoctor/asciidoctor/commit/33ac4821e0375bcd5aa189c394ad7630717bcd55 + return this['$number='](value); +}; + +/** + * A convenience method that checks whether the title of this block is defined. + * + * @returns a {boolean} indicating whether this block has a title. + * @memberof AbstractBlock + */ +AbstractBlock.prototype.hasTitle = function () { + return this['$title?'](); +}; + +// Section API + +/** + * @namespace + * @extends AbstractBlock + */ +var Section = Opal.Asciidoctor.Section; + +/** + * Get the 0-based index order of this section within the parent block. + * @memberof Section + * @returns {number} + */ +Section.prototype.getIndex = function () { + return this.index; +}; + +/** + * Set the 0-based index order of this section within the parent block. + * @memberof Section + */ +Section.prototype.setIndex = function (value) { + this.index = value; +}; + +/** + * Get the section name of this section. + * @memberof Section + * @returns {string} + */ +Section.prototype.getSectionName = function () { + return this.sectname; +}; + +/** + * Set the section name of this section. + * @memberof Section + */ +Section.prototype.setSectionName = function (value) { + this.sectname = value; +}; + +/** + * Get the flag to indicate whether this is a special section or a child of one. + * @memberof Section + * @returns {boolean} + */ +Section.prototype.isSpecial = function () { + return this.special; +}; + +/** + * Set the flag to indicate whether this is a special section or a child of one. + * @memberof Section + */ +Section.prototype.setSpecial = function (value) { + this.special = value; +}; + +/** + * Get the state of the numbered attribute at this section (need to preserve for creating TOC). + * @memberof Section + * @returns {boolean} + */ +Section.prototype.isNumbered = function () { + return this.numbered; +}; + +/** + * Get the caption for this section (only relevant for appendices). + * @memberof Section + * @returns {string} + */ +Section.prototype.getCaption = function () { + var value = this.caption; + return value === Opal.nil ? undefined : value; +}; + +/** + * Get the name of the Section (title) + * @memberof Section + * @returns {string} + * @see {@link AbstractBlock#getTitle} + */ +Section.prototype.getName = function () { + return this.getTitle(); +}; + +/** + * @namespace + */ +var Block = Opal.Asciidoctor.Block; + +/** + * Get the source of this block. + * @memberof Block + * @returns {string} - returns the String source of this block. + */ +Block.prototype.getSource = function () { + return this.$source(); +}; + +/** + * Get the source lines of this block. + * @memberof Block + * @returns {Array} - returns the String {Array} of source lines for this block. + */ +Block.prototype.getSourceLines = function () { + return this.lines; +}; + +// AbstractNode API + +/** + * @namespace + */ +var AbstractNode = Opal.Asciidoctor.AbstractNode; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.getNodeName = function () { + return this.node_name; +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.getAttributes = function () { + return fromHash(this.attributes); +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.getAttribute = function (name, defaultValue, inherit) { + var value = this.$attr(name, defaultValue, inherit); + return value === Opal.nil ? undefined : value; +}; + +/** + * Check whether the specified attribute is present on this node. + * + * @memberof AbstractNode + * @returns {boolean} - true if the attribute is present, otherwise false + */ +AbstractNode.prototype.hasAttribute = function (name) { + return name in this.attributes.$$smap; +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.isAttribute = function (name, expectedValue, inherit) { + var result = this['$attr?'](name, expectedValue, inherit); + return result === Opal.nil ? false : result; +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.setAttribute = function (name, value, overwrite) { + if (typeof overwrite === 'undefined') overwrite = true; + return this.$set_attr(name, value, overwrite); +}; + +/** + * Remove the attribute from the current node. + * @param {string} name - The String attribute name to remove + * @returns {string} - returns the previous {String} value, or undefined if the attribute was not present. + * @memberof AbstractNode + */ +AbstractNode.prototype.removeAttribute = function (name) { + var value = this.$remove_attr(name); + return value === Opal.nil ? undefined : value; +}; + +/** + * Get the {@link Document} to which this node belongs. + * + * @memberof AbstractNode + * @returns {Document} - returns the {@link Document} object to which this node belongs. + */ +AbstractNode.prototype.getDocument = function () { + return this.document; +}; + +/** + * Get the {@link AbstractNode} to which this node is attached. + * + * @memberof AbstractNode + * @returns {AbstractNode} - returns the {@link AbstractNode} object to which this node is attached, + * or undefined if this node has no parent. + */ +AbstractNode.prototype.getParent = function () { + var parent = this.parent; + return parent === Opal.nil ? undefined : parent; +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.isInline = function () { + return this['$inline?'](); +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.isBlock = function () { + return this['$block?'](); +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.isRole = function (expected) { + return this['$role?'](expected); +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.getRole = function () { + return this.$role(); +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.hasRole = function (name) { + return this['$has_role?'](name); +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.getRoles = function () { + return this.$roles(); +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.addRole = function (name) { + return this.$add_role(name); +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.removeRole = function (name) { + return this.$remove_role(name); +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.isReftext = function () { + return this['$reftext?'](); +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.getReftext = function () { + return this.$reftext(); +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.getContext = function () { + var context = this.context; + // Automatically convert Opal pseudo-symbol to String + return typeof context === 'string' ? context : context.toString(); +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.getId = function () { + var id = this.id; + return id === Opal.nil ? undefined : id; +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.isOption = function (name) { + return this['$option?'](name); +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.setOption = function (name) { + return this.$set_option(name); +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.getIconUri = function (name) { + return this.$icon_uri(name); +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.getMediaUri = function (target, assetDirKey) { + return this.$media_uri(target, assetDirKey); +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.getImageUri = function (targetImage, assetDirKey) { + return this.$image_uri(targetImage, assetDirKey); +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.getConverter = function () { + return this.$converter(); +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.readContents = function (target, options) { + return this.$read_contents(target, toHash(options)); +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.readAsset = function (path, options) { + return this.$read_asset(path, toHash(options)); +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.normalizeWebPath = function (target, start, preserveTargetUri) { + return this.$normalize_web_path(target, start, preserveTargetUri); +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.normalizeSystemPath = function (target, start, jail, options) { + return this.$normalize_system_path(target, start, jail, toHash(options)); +}; + +/** + * @memberof AbstractNode + */ +AbstractNode.prototype.normalizeAssetPath = function (assetRef, assetName, autoCorrect) { + return this.$normalize_asset_path(assetRef, assetName, autoCorrect); +}; + +// Document API + +/** + * The {@link Document} class represents a parsed AsciiDoc document. + * + * Document is the root node of a parsed AsciiDoc document.
    + * It provides an abstract syntax tree (AST) that represents the structure of the AsciiDoc document + * from which the Document object was parsed. + * + * Although the constructor can be used to create an empty document object, + * more commonly, you'll load the document object from AsciiDoc source + * using the primary API methods on {@link Asciidoctor}. + * When using one of these APIs, you almost always want to set the safe mode to 'safe' (or 'unsafe') + * to enable all of Asciidoctor's features. + * + *
    + *   var doc = Asciidoctor.load('= Hello, AsciiDoc!', {'safe': 'safe'});
    + *   // => Asciidoctor::Document { doctype: "article", doctitle: "Hello, Asciidoc!", blocks: 0 }
    + * 
    + * + * Instances of this class can be used to extract information from the document or alter its structure. + * As such, the Document object is most often used in extensions and by integrations. + * + * The most basic usage of the Document object is to retrieve the document's title. + * + *
    + *  var source = '= Document Title';
    + *  var doc = asciidoctor.load(source, {'safe': 'safe'});
    + *  console.log(doc.getTitle()); // 'Document Title'
    + * 
    + * + * You can also use the Document object to access document attributes defined in the header, such as the author and doctype. + * @namespace + * @extends AbstractBlock + */ + +var Document = Opal.Asciidoctor.Document; + +/** + * Returns a JSON {Object} of ids captured by the processor. + * + * @returns {Object} - returns a JSON {Object} of ids in the document. + * @memberof Document + */ +Document.prototype.getIds = function () { + return fromHash(this.catalog.$$smap.ids); +}; + +/** + * Returns a JSON {Object} of references captured by the processor. + * + * @returns {Object} - returns a JSON {Object} of {AbstractNode} in the document. + * @memberof Document + */ +Document.prototype.getRefs = function () { + return fromHash(this.catalog.$$smap.refs); +}; + +/** + * Returns an {Array} of Document/ImageReference} captured by the processor. + * + * @returns {Array} - returns an {Array} of {Document/ImageReference} in the document. + * Will return an empty array if the option "catalog_assets: true" was not defined on the processor. + * @memberof Document + */ +Document.prototype.getImages = function () { + return this.catalog.$$smap.images; +}; + +/** + * Returns an {Array} of index terms captured by the processor. + * + * @returns {Array} - returns an {Array} of index terms in the document. + * Will return an empty array if the function was called before the document was converted. + * @memberof Document + */ +Document.prototype.getIndexTerms = function () { + return this.catalog.$$smap.indexterms; +}; + +/** + * Returns an {Array} of links captured by the processor. + * + * @returns {Array} - returns an {Array} of links in the document. + * Will return an empty array if: + * - the function was called before the document was converted + * - the option "catalog_assets: true" was not defined on the processor + * @memberof Document + */ +Document.prototype.getLinks = function () { + return this.catalog.$$smap.links; +}; + +/** + * @returns {boolean} - returns true if the document has footnotes otherwise false + * @memberof Document + */ +Document.prototype.hasFootnotes = function () { + return this['$footnotes?'](); +}; + +/** + * Returns an {Array} of {Document/Footnote} captured by the processor. + * + * @returns {Array} - returns an {Array} of {Document/Footnote} in the document. + * Will return an empty array if the function was called before the document was converted. + * @memberof Document + */ +Document.prototype.getFootnotes = function () { + return this.$footnotes(); +}; + +/** + * @returns {string} - returns the level-0 section + * @memberof Document + */ +Document.prototype.getHeader = function () { + return this.header; +}; + +/** + * @memberof Document + */ +Document.prototype.setAttribute = function (name, value) { + return this.$set_attribute(name, value); +}; + +/** + + * @memberof Document + */ +Document.prototype.removeAttribute = function (name) { + this.attributes.$delete(name); + this.attribute_overrides.$delete(name); +}; + +/** + * @memberof Document + */ +Document.prototype.convert = function (options) { + var result = this.$convert(toHash(options)); + return result === Opal.nil ? '' : result; +}; + +/** + * @memberof Document + */ +Document.prototype.write = function (output, target) { + return this.$write(output, target); +}; + +/** + * @returns {string} - returns the full name of the author as a String + * @memberof Document + */ +Document.prototype.getAuthor = function () { + return this.$author(); +}; + +/** + * @memberof Document + */ +Document.prototype.getSource = function () { + return this.$source(); +}; + +/** + * @memberof Document + */ +Document.prototype.getSourceLines = function () { + return this.$source_lines(); +}; + +/** + * @memberof Document + */ +Document.prototype.isNested = function () { + return this['$nested?'](); +}; + +/** + * @memberof Document + */ +Document.prototype.isEmbedded = function () { + return this['$embedded?'](); +}; + +/** + * @memberof Document + */ +Document.prototype.hasExtensions = function () { + return this['$extensions?'](); +}; + +/** + * @memberof Document + */ +Document.prototype.getDoctype = function () { + return this.doctype; +}; + +/** + * @memberof Document + */ +Document.prototype.getBackend = function () { + return this.backend; +}; + +/** + * @memberof Document + */ +Document.prototype.isBasebackend = function (base) { + return this['$basebackend?'](base); +}; + +/** + * Get the title explicitly defined in the document attributes. + * @returns {string} + * @see {@link AbstractNode#getAttributes} + * @memberof Document + */ +Document.prototype.getTitle = function () { + var title = this.$title(); + return title === Opal.nil ? undefined : title; +}; + +/** + * @memberof Document + */ +Document.prototype.setTitle = function (title) { + return this['$title='](title); +}; + +/** + * @memberof Document + * @returns {Document/Title} - returns a {@link Document/Title} + */ +Document.prototype.getDocumentTitle = function (options) { + var doctitle = this.$doctitle(toHash(options)); + return doctitle === Opal.nil ? undefined : doctitle; +}; + +/** + * @memberof Document + * @see {@link Document#getDocumentTitle} + */ +Document.prototype.getDoctitle = Document.prototype.getDocumentTitle; + +/** + * Get the document catalog Hash. + * @memberof Document + */ +Document.prototype.getCatalog = function () { + return fromHash(this.catalog); +}; + +/** + * @memberof Document + */ +Document.prototype.getReferences = Document.prototype.getCatalog; + +/** + * Get the document revision date from document header (document attribute revdate). + * @memberof Document + */ +Document.prototype.getRevisionDate = function () { + return this.getAttribute('revdate'); +}; + +/** + * @memberof Document + * @see Document#getRevisionDate + */ +Document.prototype.getRevdate = function () { + return this.getRevisionDate(); +}; + +/** + * Get the document revision number from document header (document attribute revnumber). + * @memberof Document + */ +Document.prototype.getRevisionNumber = function () { + return this.getAttribute('revnumber'); +}; + +/** + * Get the document revision remark from document header (document attribute revremark). + * @memberof Document + */ +Document.prototype.getRevisionRemark = function () { + return this.getAttribute('revremark'); +}; + + +/** + * Assign a value to the specified attribute in the document header. + * + * The assignment will be visible when the header attributes are restored, + * typically between processor phases (e.g., between parse and convert). + * + * @param {string} name - The {string} attribute name to assign + * @param {Object} value - The {Object} value to assign to the attribute (default: '') + * @param {boolean} overwrite - A {boolean} indicating whether to assign the attribute + * if already present in the attributes Hash (default: true) + * + * @memberof Document + * @returns {boolean} - returns true if the assignment was performed otherwise false + */ +Document.prototype.setHeaderAttribute = function (name, value, overwrite) { + if (typeof overwrite === 'undefined') overwrite = true; + if (typeof value === 'undefined') value = ''; + return this.$set_header_attribute(name, value, overwrite); +}; + +/** + * Convenience method to retrieve the authors of this document as an {Array} of {Document/Author} objects. + * + * This method is backed by the author-related attributes on the document. + * + * @memberof Document + * @returns {Array} - returns an {Array} of {Document/Author} objects. + */ +Document.prototype.getAuthors = function () { + return this.$authors(); +}; + +// Document.Footnote API + +/** + * @namespace + * @module Document/Footnote + */ +var Footnote = Document.Footnote; + +/** + * @memberof Document/Footnote + * @returns {number} - returns the footnote's index + */ +Footnote.prototype.getIndex = function () { + var index = this.$$data.index; + return index === Opal.nil ? undefined : index; +}; + +/** + * @memberof Document/Footnote + * @returns {string} - returns the footnote's id + */ +Footnote.prototype.getId = function () { + var id = this.$$data.id; + return id === Opal.nil ? undefined : id; +}; + +/** + * @memberof Document/Footnote + * @returns {string} - returns the footnote's text + */ +Footnote.prototype.getText = function () { + var text = this.$$data.text; + return text === Opal.nil ? undefined : text; +}; + +// Document.ImageReference API + +/** + * @namespace + * @module Document/ImageReference + */ +var ImageReference = Document.ImageReference; + +/** + * @memberof Document/ImageReference + * @returns {string} - returns the image's target + */ +ImageReference.prototype.getTarget = function () { + return this.$$data.target; +}; + +/** + * @memberof Document/ImageReference + * @returns {string} - returns the image's directory (imagesdir attribute) + */ +ImageReference.prototype.getImagesDirectory = function () { + var value = this.$$data.imagesdir; + return value === Opal.nil ? undefined : value; +}; + +// Document.Author API + +/** + * @namespace + * @module Document/Author + */ +var Author = Document.Author; + +/** + * @memberof Document/Author + * @returns {string} - returns the author's full name + */ +Author.prototype.getName = function () { + var name = this.$$data.name; + return name === Opal.nil ? undefined : name; +}; + +/** + * @memberof Document/Author + * @returns {string} - returns the author's first name + */ +Author.prototype.getFirstName = function () { + var firstName = this.$$data.firstname; + return firstName === Opal.nil ? undefined : firstName; +}; + +/** + * @memberof Document/Author + * @returns {string} - returns the author's middle name (or undefined if the author has no middle name) + */ +Author.prototype.getMiddleName = function () { + var middleName = this.$$data.middlename; + return middleName === Opal.nil ? undefined : middleName; +}; + +/** + * @memberof Document/Author + * @returns {string} - returns the author's last name + */ +Author.prototype.getLastName = function () { + var lastName = this.$$data.lastname; + return lastName === Opal.nil ? undefined : lastName; +}; + +/** + * @memberof Document/Author + * @returns {string} - returns the author's initials (by default based on the author's name) + */ +Author.prototype.getInitials = function () { + var initials = this.$$data.initials; + return initials === Opal.nil ? undefined : initials; +}; + +/** + * @memberof Document/Author + * @returns {string} - returns the author's email + */ +Author.prototype.getEmail = function () { + var email = this.$$data.email; + return email === Opal.nil ? undefined : email; +}; + +// private constructor +Document.RevisionInfo = function (date, number, remark) { + this.date = date; + this.number = number; + this.remark = remark; +}; + +/** + * @class + * @namespace + * @module Document/RevisionInfo + */ +var RevisionInfo = Document.RevisionInfo; + +/** + * Get the document revision date from document header (document attribute revdate). + * @memberof Document/RevisionInfo + */ +RevisionInfo.prototype.getDate = function () { + return this.date; +}; + +/** + * Get the document revision number from document header (document attribute revnumber). + * @memberof Document/RevisionInfo + */ +RevisionInfo.prototype.getNumber = function () { + return this.number; +}; + +/** + * Get the document revision remark from document header (document attribute revremark). + * A short summary of changes in this document revision. + * @memberof Document/RevisionInfo + */ +RevisionInfo.prototype.getRemark = function () { + return this.remark; +}; + +/** + * @memberof Document/RevisionInfo + * @returns {boolean} - returns true if the revision info is empty (ie. not defined), otherwise false + */ +RevisionInfo.prototype.isEmpty = function () { + return this.date === undefined && this.number === undefined && this.remark === undefined; +}; + +/** + * @memberof Document + * @returns {Document/RevisionInfo} - returns a {@link Document/RevisionInfo} + */ +Document.prototype.getRevisionInfo = function () { + return new Document.RevisionInfo(this.getRevisionDate(), this.getRevisionNumber(), this.getRevisionRemark()); +}; + +/** + * @memberof Document + * @returns {boolean} - returns true if the document contains revision info, otherwise false + */ +Document.prototype.hasRevisionInfo = function () { + var revisionInfo = this.getRevisionInfo(); + return !revisionInfo.isEmpty(); +}; + +/** + * @memberof Document + */ +Document.prototype.getNotitle = function () { + return this.$notitle(); +}; + +/** + * @memberof Document + */ +Document.prototype.getNoheader = function () { + return this.$noheader(); +}; + +/** + * @memberof Document + */ +Document.prototype.getNofooter = function () { + return this.$nofooter(); +}; + +/** + * @memberof Document + */ +Document.prototype.hasHeader = function () { + return this['$header?'](); +}; + +/** + * @memberof Document + */ +Document.prototype.deleteAttribute = function (name) { + return this.$delete_attribute(name); +}; + +/** + * @memberof Document + */ +Document.prototype.isAttributeLocked = function (name) { + return this['$attribute_locked?'](name); +}; + +/** + * @memberof Document + */ +Document.prototype.parse = function (data) { + return this.$parse(data); +}; + +/** + * @memberof Document + */ +Document.prototype.getDocinfo = function (docinfoLocation, suffix) { + return this.$docinfo(docinfoLocation, suffix); +}; + +/** + * @memberof Document + */ +Document.prototype.hasDocinfoProcessors = function (docinfoLocation) { + return this['$docinfo_processors?'](docinfoLocation); +}; + +/** + * @memberof Document + */ +Document.prototype.counterIncrement = function (counterName, block) { + return this.$counter_increment(counterName, block); +}; + +/** + * @memberof Document + */ +Document.prototype.counter = function (name, seed) { + return this.$counter(name, seed); +}; + +/** + * @memberof Document + */ +Document.prototype.getSafe = function () { + return this.safe; +}; + +/** + * @memberof Document + */ +Document.prototype.getCompatMode = function () { + return this.compat_mode; +}; + +/** + * @memberof Document + */ +Document.prototype.getSourcemap = function () { + return this.sourcemap; +}; + +/** + * @memberof Document + */ +Document.prototype.getCounters = function () { + return fromHash(this.counters); +}; + +/** + * @memberof Document + */ +Document.prototype.getCallouts = function () { + return this.$callouts(); +}; + +/** + * @memberof Document + */ +Document.prototype.getBaseDir = function () { + return this.base_dir; +}; + +/** + * @memberof Document + */ +Document.prototype.getOptions = function () { + return fromHash(this.options); +}; + +/** + * @memberof Document + */ +Document.prototype.getOutfilesuffix = function () { + return this.outfilesuffix; +}; + +/** + * @memberof Document + */ +Document.prototype.getParentDocument = function () { + return this.parent_document; +}; + +/** + * @memberof Document + */ +Document.prototype.getReader = function () { + return this.reader; +}; + +/** + * @memberof Document + */ +Document.prototype.getConverter = function () { + return this.converter; +}; + +/** + * @memberof Document + */ +Document.prototype.getExtensions = function () { + return this.extensions; +}; + +// Document.Title API + +/** + * @namespace + * @module Document/Title + */ +var Title = Document.Title; + +/** + * @memberof Document/Title + */ +Title.prototype.getMain = function () { + return this.main; +}; + +/** + * @memberof Document/Title + */ +Title.prototype.getCombined = function () { + return this.combined; +}; + +/** + * @memberof Document/Title + */ +Title.prototype.getSubtitle = function () { + var subtitle = this.subtitle; + return subtitle === Opal.nil ? undefined : subtitle; +}; + +/** + * @memberof Document/Title + */ +Title.prototype.isSanitized = function () { + var sanitized = this['$sanitized?'](); + return sanitized === Opal.nil ? false : sanitized; +}; + +/** + * @memberof Document/Title + */ +Title.prototype.hasSubtitle = function () { + return this['$subtitle?'](); +}; + +// Inline API + +/** + * @namespace + * @extends AbstractNode + */ +var Inline = Opal.Asciidoctor.Inline; + +/** + * Create a new Inline element. + * + * @memberof Inline + * @returns {Inline} - returns a new Inline element + */ +Opal.Asciidoctor.Inline['$$class'].prototype.create = function (parent, context, text, opts) { + return this.$new(parent, context, text, toHash(opts)); +}; + +/** + * Get the converted content for this inline node. + * + * @memberof Inline + * @returns {string} - returns the converted String content for this inline node + */ +Inline.prototype.convert = function () { + return this.$convert(); +}; + +/** + * Get the converted String text of this Inline node, if applicable. + * + * @memberof Inline + * @returns {string} - returns the converted String text for this Inline node, or undefined if not applicable for this node. + */ +Inline.prototype.getText = function () { + var text = this.$text(); + return text === Opal.nil ? undefined : text; +}; + +/** + * Get the String sub-type (aka qualifier) of this Inline node. + * + * This value is used to distinguish different variations of the same node + * category, such as different types of anchors. + * + * @memberof Inline + * @returns {string} - returns the string sub-type of this Inline node. + */ +Inline.prototype.getType = function () { + return this.$type(); +}; + +/** + * Get the primary String target of this Inline node. + * + * @memberof Inline + * @returns {string} - returns the string target of this Inline node. + */ +Inline.prototype.getTarget = function () { + var target = this.$target(); + return target === Opal.nil ? undefined : target; +}; + +// List API + +/** @namespace */ +var List = Opal.Asciidoctor.List; + +/** + * Get the Array of {@link ListItem} nodes for this {@link List}. + * + * @memberof List + * @returns {Array} - returns an Array of {@link ListItem} nodes. + */ +List.prototype.getItems = function () { + return this.blocks; +}; + +// ListItem API + +/** @namespace */ +var ListItem = Opal.Asciidoctor.ListItem; + +/** + * Get the converted String text of this ListItem node. + * + * @memberof ListItem + * @returns {string} - returns the converted String text for this ListItem node. + */ +ListItem.prototype.getText = function () { + return this.$text(); +}; + +/** + * Set the String source text of this ListItem node. + * + * @memberof ListItem + */ +ListItem.prototype.setText = function (text) { + return this.text = text; +}; + +// Reader API + +/** @namespace */ +var Reader = Opal.Asciidoctor.Reader; + +/** + * @memberof Reader + */ +Reader.prototype.pushInclude = function (data, file, path, lineno, attributes) { + return this.$push_include(data, file, path, lineno, toHash(attributes)); +}; + +/** + * Get the current location of the reader's cursor, which encapsulates the + * file, dir, path, and lineno of the file being read. + * + * @memberof Reader + */ +Reader.prototype.getCursor = function () { + return this.$cursor(); +}; + +/** + * Get a copy of the remaining {Array} of String lines managed by this Reader. + * + * @memberof Reader + * @returns {Array} - returns A copy of the String {Array} of lines remaining in this Reader. + */ +Reader.prototype.getLines = function () { + return this.$lines(); +}; + +/** + * Get the remaining lines managed by this Reader as a String. + * + * @memberof Reader + * @returns {string} - returns The remaining lines managed by this Reader as a String (joined by linefeed characters). + */ +Reader.prototype.getString = function () { + return this.$string(); +}; + +// Cursor API + +/** @namespace */ +var Cursor = Opal.Asciidoctor.Reader.Cursor; + +/** + * Get the file associated to the cursor. + * @memberof Cursor + */ +Cursor.prototype.getFile = function () { + var file = this.file; + return file === Opal.nil ? undefined : file; +}; + +/** + * Get the directory associated to the cursor. + * @memberof Cursor + * @returns {string} - returns the directory associated to the cursor + */ +Cursor.prototype.getDirectory = function () { + var dir = this.dir; + return dir === Opal.nil ? undefined : dir; +}; + +/** + * Get the path associated to the cursor. + * @memberof Cursor + * @returns {string} - returns the path associated to the cursor (or '') + */ +Cursor.prototype.getPath = function () { + var path = this.path; + return path === Opal.nil ? undefined : path; +}; + +/** + * Get the line number of the cursor. + * @memberof Cursor + * @returns {number} - returns the line number of the cursor + */ +Cursor.prototype.getLineNumber = function () { + return this.lineno; +}; + +// Logger API (available in Asciidoctor 1.5.7+) + +function initializeLoggerFormatterClass (className, functions) { + var superclass = Opal.const_get_qualified(Opal.Logger, 'Formatter'); + return initializeClass(superclass, className, functions, {}, { + 'call': function (args) { + for (var i = 0; i < args.length; i++) { + // convert all (Opal) Hash arguments to JSON. + if (typeof args[i] === 'object' && '$$smap' in args[i]) { + args[i] = fromHash(args[i]); + } + } + return args; + } + }); +} + +function initializeLoggerClass (className, functions) { + var superClass = Opal.const_get_qualified(Opal.Asciidoctor, 'Logger'); + return initializeClass(superClass, className, functions, {}, { + 'add': function (args) { + if (args.length >= 2 && typeof args[2] === 'object' && '$$smap' in args[2]) { + var message = args[2]; + var messageObject = fromHash(message); + messageObject.getText = function () { + return this['text']; + }; + messageObject.getSourceLocation = function () { + return this['source_location']; + }; + messageObject['$inspect'] = function () { + var sourceLocation = this.getSourceLocation(); + if (sourceLocation) { + return sourceLocation.getPath() + ': line ' + sourceLocation.getLineNumber() + ': ' + this.getText(); + } else { + return this.getText(); + } + }; + args[2] = messageObject; + } + return args; + } + }); +} + +/** + * @namespace + */ +var LoggerManager = Opal.const_get_qualified(Opal.Asciidoctor, 'LoggerManager', true); + +// Alias +Opal.Asciidoctor.LoggerManager = LoggerManager; + +if (LoggerManager) { + LoggerManager.getLogger = function () { + return this.$logger(); + }; + + LoggerManager.setLogger = function (logger) { + this.logger = logger; + }; + + LoggerManager.newLogger = function (name, functions) { + return initializeLoggerClass(name, functions).$new(); + }; + + LoggerManager.newFormatter = function (name, functions) { + return initializeLoggerFormatterClass(name, functions).$new(); + }; +} + +/** + * @namespace + */ +var LoggerSeverity = Opal.const_get_qualified(Opal.Logger, 'Severity', true); + +// Alias +Opal.Asciidoctor.LoggerSeverity = LoggerSeverity; + +if (LoggerSeverity) { + LoggerSeverity.get = function (severity) { + return LoggerSeverity.$constants()[severity]; + }; +} + +/** + * @namespace + */ +var LoggerFormatter = Opal.const_get_qualified(Opal.Logger, 'Formatter', true); + + +// Alias +Opal.Asciidoctor.LoggerFormatter = LoggerFormatter; + +if (LoggerFormatter) { + LoggerFormatter.prototype.call = function (severity, time, programName, message) { + return this.$call(LoggerSeverity.get(severity), time, programName, message); + }; +} + +/** + * @namespace + */ +var MemoryLogger = Opal.const_get_qualified(Opal.Asciidoctor, 'MemoryLogger', true); + +// Alias +Opal.Asciidoctor.MemoryLogger = MemoryLogger; + +if (MemoryLogger) { + MemoryLogger.prototype.getMessages = function () { + var messages = this.messages; + var result = []; + for (var i = 0; i < messages.length; i++) { + var message = messages[i]; + var messageObject = fromHash(message); + if (typeof messageObject.message === 'string') { + messageObject.getText = function () { + return this.message; + }; + } else { + // also convert the message attribute + messageObject.message = fromHash(messageObject.message); + messageObject.getText = function () { + return this.message['text']; + }; + } + messageObject.getSeverity = function () { + return this.severity.toString(); + }; + messageObject.getSourceLocation = function () { + return this.message['source_location']; + }; + result.push(messageObject); + } + return result; + }; +} + +/** + * @namespace + */ +var Logger = Opal.const_get_qualified(Opal.Asciidoctor, 'Logger', true); + +// Alias +Opal.Asciidoctor.Logger = Logger; + +if (Logger) { + Logger.prototype.getMaxSeverity = function () { + return this.max_severity; + }; + Logger.prototype.getFormatter = function () { + return this.formatter; + }; + Logger.prototype.setFormatter = function (formatter) { + return this.formatter = formatter; + }; + Logger.prototype.getLevel = function () { + return this.level; + }; + Logger.prototype.setLevel = function (level) { + return this.level = level; + }; + Logger.prototype.getProgramName = function () { + return this.progname; + }; + Logger.prototype.setProgramName = function (programName) { + return this.progname = programName; + }; +} + +/** + * @namespace + */ +var NullLogger = Opal.const_get_qualified(Opal.Asciidoctor, 'NullLogger', true); + +// Alias +Opal.Asciidoctor.NullLogger = NullLogger; + + +if (NullLogger) { + NullLogger.prototype.getMaxSeverity = function () { + return this.max_severity; + }; +} + + +// Alias +Opal.Asciidoctor.StopIteration = Opal.StopIteration; + +// Extensions API + +/** + * @private + */ +var toBlock = function (block) { + // arity is a mandatory field + block.$$arity = block.length; + return block; +}; + +var registerExtension = function (registry, type, processor, name) { + if (typeof processor === 'object' || processor.$$is_class) { + // processor is an instance or a class + return registry['$' + type](processor, name); + } else { + // processor is a function/lambda + return Opal.send(registry, type, name && [name], toBlock(processor)); + } +}; + +/** + * @namespace + * @description + * Extensions provide a way to participate in the parsing and converting + * phases of the AsciiDoc processor or extend the AsciiDoc syntax. + * + * The various extensions participate in AsciiDoc processing as follows: + * + * 1. After the source lines are normalized, {{@link Extensions/Preprocessor}}s modify or replace + * the source lines before parsing begins. {{@link Extensions/IncludeProcessor}}s are used to + * process include directives for targets which they claim to handle. + * 2. The Parser parses the block-level content into an abstract syntax tree. + * Custom blocks and block macros are processed by associated {{@link Extensions/BlockProcessor}}s + * and {{@link Extensions/BlockMacroProcessor}}s, respectively. + * 3. {{@link Extensions/TreeProcessor}}s are run on the abstract syntax tree. + * 4. Conversion of the document begins, at which point inline markup is processed + * and converted. Custom inline macros are processed by associated {InlineMacroProcessor}s. + * 5. {{@link Extensions/Postprocessor}}s modify or replace the converted document. + * 6. The output is written to the output stream. + * + * Extensions may be registered globally using the {Extensions.register} method + * or added to a custom {Registry} instance and passed as an option to a single + * Asciidoctor processor. + * + * @example + * Opal.Asciidoctor.Extensions.register(function () { + * this.block(function () { + * var self = this; + * self.named('shout'); + * self.onContext('paragraph'); + * self.process(function (parent, reader) { + * var lines = reader.getLines().map(function (l) { return l.toUpperCase(); }); + * return self.createBlock(parent, 'paragraph', lines); + * }); + * }); + * }); + */ +var Extensions = Opal.const_get_qualified(Opal.Asciidoctor, 'Extensions'); + +// Alias +Opal.Asciidoctor.Extensions = Extensions; + +/** + * Create a new {@link Extensions/Registry}. + * @param {string} name + * @param {function} block + * @memberof Extensions + * @returns {Extensions/Registry} - returns a {@link Extensions/Registry} + */ +Extensions.create = function (name, block) { + if (typeof name === 'function' && typeof block === 'undefined') { + return Opal.send(this, 'build_registry', null, toBlock(name)); + } else if (typeof block === 'function') { + return Opal.send(this, 'build_registry', [name], toBlock(block)); + } else { + return this.$build_registry(); + } +}; + +/** + * @memberof Extensions + */ +Extensions.register = function (name, block) { + if (typeof name === 'function' && typeof block === 'undefined') { + return Opal.send(this, 'register', null, toBlock(name)); + } else { + return Opal.send(this, 'register', [name], toBlock(block)); + } +}; + +/** + * Get statically-registerd extension groups. + * @memberof Extensions + */ +Extensions.getGroups = function () { + return fromHash(this.$groups()); +}; + +/** + * Unregister all statically-registered extension groups. + * @memberof Extensions + */ +Extensions.unregisterAll = function () { + this.$unregister_all(); +}; + +/** + * Unregister the specified statically-registered extension groups. + * + * NOTE Opal cannot delete an entry from a Hash that is indexed by symbol, so + * we have to resort to using low-level operations in this method. + * + * @memberof Extensions + */ +Extensions.unregister = function () { + var names = Array.prototype.concat.apply([], arguments); + var groups = this.$groups(); + var groupNameIdx = {}; + for (var i = 0, groupSymbolNames = groups.$$keys; i < groupSymbolNames.length; i++) { + var groupSymbolName = groupSymbolNames[i]; + groupNameIdx[groupSymbolName.toString()] = groupSymbolName; + } + for (var j = 0; j < names.length; j++) { + var groupStringName = names[j]; + if (groupStringName in groupNameIdx) Opal.hash_delete(groups, groupNameIdx[groupStringName]); + } +}; + +/** + * @namespace + * @module Extensions/Registry + */ +var Registry = Extensions.Registry; + +/** + * @memberof Extensions/Registry + */ +Registry.prototype.getGroups = Extensions.getGroups; + +/** + * @memberof Extensions/Registry + */ +Registry.prototype.unregisterAll = function () { + this.groups = Opal.hash(); +}; + +/** + * @memberof Extensions/Registry + */ +Registry.prototype.unregister = Extensions.unregister; + +/** + * @memberof Extensions/Registry + */ +Registry.prototype.prefer = function (name, processor) { + if (arguments.length === 1) { + processor = name; + name = null; + } + if (typeof processor === 'object' || processor.$$is_class) { + // processor is an instance or a class + return this['$prefer'](name, processor); + } else { + // processor is a function/lambda + return Opal.send(this, 'prefer', name && [name], toBlock(processor)); + } +}; + +/** + * @memberof Extensions/Registry + */ +Registry.prototype.block = function (name, processor) { + if (arguments.length === 1) { + processor = name; + name = null; + } + return registerExtension(this, 'block', processor, name); +}; + +/** + * @memberof Extensions/Registry + */ +Registry.prototype.inlineMacro = function (name, processor) { + if (arguments.length === 1) { + processor = name; + name = null; + } + return registerExtension(this, 'inline_macro', processor, name); +}; + +/** + * @memberof Extensions/Registry + */ +Registry.prototype.includeProcessor = function (name, processor) { + if (arguments.length === 1) { + processor = name; + name = null; + } + return registerExtension(this, 'include_processor', processor, name); +}; + +/** + * @memberof Extensions/Registry + */ +Registry.prototype.blockMacro = function (name, processor) { + if (arguments.length === 1) { + processor = name; + name = null; + } + return registerExtension(this, 'block_macro', processor, name); +}; + +/** + * @memberof Extensions/Registry + */ +Registry.prototype.treeProcessor = function (name, processor) { + if (arguments.length === 1) { + processor = name; + name = null; + } + return registerExtension(this, 'tree_processor', processor, name); +}; + +/** + * @memberof Extensions/Registry + */ +Registry.prototype.postprocessor = function (name, processor) { + if (arguments.length === 1) { + processor = name; + name = null; + } + return registerExtension(this, 'postprocessor', processor, name); +}; + +/** + * @memberof Extensions/Registry + */ +Registry.prototype.preprocessor = function (name, processor) { + if (arguments.length === 1) { + processor = name; + name = null; + } + return registerExtension(this, 'preprocessor', processor, name); +}; + +/** + * @memberof Extensions/Registry + */ + +Registry.prototype.docinfoProcessor = function (name, processor) { + if (arguments.length === 1) { + processor = name; + name = null; + } + return registerExtension(this, 'docinfo_processor', processor, name); +}; + +/** + * @namespace + * @module Extensions/Processor + */ +var Processor = Extensions.Processor; + +/** + * The extension will be added to the beginning of the list for that extension type. (default is append). + * @memberof Extensions/Processor + * @deprecated Please use the prefer function on the {@link Extensions/Registry}, + * the {@link Extensions/IncludeProcessor}, + * the {@link Extensions/TreeProcessor}, + * the {@link Extensions/Postprocessor}, + * the {@link Extensions/Preprocessor} + * or the {@link Extensions/DocinfoProcessor} + */ +Processor.prototype.prepend = function () { + this.$option('position', '>>'); +}; + +/** + * @memberof Extensions/Processor + */ +Processor.prototype.process = function (block) { + var handler = { + apply: function (target, thisArg, argumentsList) { + for (var i = 0; i < argumentsList.length; i++) { + // convert all (Opal) Hash arguments to JSON. + if (typeof argumentsList[i] === 'object' && '$$smap' in argumentsList[i]) { + argumentsList[i] = fromHash(argumentsList[i]); + } + } + return target.apply(thisArg, argumentsList); + } + }; + var blockProxy = new Proxy(block, handler); + return Opal.send(this, 'process', null, toBlock(blockProxy)); +}; + +/** + * @memberof Extensions/Processor + */ +Processor.prototype.named = function (name) { + return this.$named(name); +}; + +/** + * @memberof Extensions/Processor + */ +Processor.prototype.createBlock = function (parent, context, source, attrs, opts) { + return this.$create_block(parent, context, source, toHash(attrs), toHash(opts)); +}; + +/** + * Creates a list block node and links it to the specified parent. + * + * @param parent - The parent Block (Block, Section, or Document) of this new list block. + * @param {string} context - The list context (e.g., ulist, olist, colist, dlist) + * @param {Object} attrs - An object of attributes to set on this list block + * + * @memberof Extensions/Processor + */ +Processor.prototype.createList = function (parent, context, attrs) { + return this.$create_list(parent, context, toHash(attrs)); +}; + +/** + * Creates a list item node and links it to the specified parent. + * + * @param parent - The parent List of this new list item block. + * @param {string} text - The text of the list item. + * + * @memberof Extensions/Processor + */ +Processor.prototype.createListItem = function (parent, text) { + return this.$create_list_item(parent, text); +}; + +/** + * @memberof Extensions/Processor + */ +Processor.prototype.createImageBlock = function (parent, attrs, opts) { + return this.$create_image_block(parent, toHash(attrs), toHash(opts)); +}; + +/** + * @memberof Extensions/Processor + */ +Processor.prototype.createInline = function (parent, context, text, opts) { + if (opts && opts.attributes) { + opts.attributes = toHash(opts.attributes); + } + return this.$create_inline(parent, context, text, toHash(opts)); +}; + +/** + * @memberof Extensions/Processor + */ +Processor.prototype.parseContent = function (parent, content, attrs) { + return this.$parse_content(parent, content, attrs); +}; + +/** + * @memberof Extensions/Processor + */ +Processor.prototype.positionalAttributes = function (value) { + return this.$positional_attrs(value); +}; + +/** + * @memberof Extensions/Processor + */ +Processor.prototype.resolvesAttributes = function (args) { + return this.$resolves_attributes(args); +}; + +/** + * @namespace + * @module Extensions/BlockProcessor + */ +var BlockProcessor = Extensions.BlockProcessor; + +/** + * @memberof Extensions/BlockProcessor + */ +BlockProcessor.prototype.onContext = function (context) { + return this.$on_context(context); +}; + +/** + * @memberof Extensions/BlockProcessor + */ +BlockProcessor.prototype.onContexts = function () { + return this.$on_contexts(Array.prototype.slice.call(arguments)); +}; + +/** + * @memberof Extensions/BlockProcessor + */ +BlockProcessor.prototype.getName = function () { + var name = this.name; + return name === Opal.nil ? undefined : name; +}; + +/** + * @namespace + * @module Extensions/BlockMacroProcessor + */ +var BlockMacroProcessor = Extensions.BlockMacroProcessor; + +/** + * @memberof Extensions/BlockMacroProcessor + */ +BlockMacroProcessor.prototype.getName = function () { + var name = this.name; + return name === Opal.nil ? undefined : name; +}; + +/** + * @namespace + * @module Extensions/InlineMacroProcessor + */ +var InlineMacroProcessor = Extensions.InlineMacroProcessor; + +/** + * @memberof Extensions/InlineMacroProcessor + */ +InlineMacroProcessor.prototype.getName = function () { + var name = this.name; + return name === Opal.nil ? undefined : name; +}; + +/** + * @namespace + * @module Extensions/IncludeProcessor + */ +var IncludeProcessor = Extensions.IncludeProcessor; + +/** + * @memberof Extensions/IncludeProcessor + */ +IncludeProcessor.prototype.handles = function (block) { + return Opal.send(this, 'handles?', null, toBlock(block)); +}; + +/** + * @memberof Extensions/IncludeProcessor + */ +IncludeProcessor.prototype.prefer = function () { + this.$prefer(); +}; + +/** + * @namespace + * @module Extensions/TreeProcessor + */ +// eslint-disable-next-line no-unused-vars +var TreeProcessor = Extensions.TreeProcessor; + +/** + * @memberof Extensions/TreeProcessor + */ +TreeProcessor.prototype.prefer = function () { + this.$prefer(); +}; + +/** + * @namespace + * @module Extensions/Postprocessor + */ +// eslint-disable-next-line no-unused-vars +var Postprocessor = Extensions.Postprocessor; + +/** + * @memberof Extensions/Postprocessor + */ +Postprocessor.prototype.prefer = function () { + this.$prefer(); +}; + +/** + * @namespace + * @module Extensions/Preprocessor + */ +// eslint-disable-next-line no-unused-vars +var Preprocessor = Extensions.Preprocessor; + +/** + * @memberof Extensions/Preprocessor + */ +Preprocessor.prototype.prefer = function () { + this.$prefer(); +}; + +/** + * @namespace + * @module Extensions/DocinfoProcessor + */ +var DocinfoProcessor = Extensions.DocinfoProcessor; + +/** + * @memberof Extensions/DocinfoProcessor + */ +DocinfoProcessor.prototype.prefer = function () { + this.$prefer(); +}; + +/** + * @memberof Extensions/DocinfoProcessor + */ +DocinfoProcessor.prototype.atLocation = function (value) { + this.$at_location(value); +}; + +function initializeProcessorClass (superclassName, className, functions) { + var superClass = Opal.const_get_qualified(Extensions, superclassName); + return initializeClass(superClass, className, functions, { + 'handles?': function () { + return true; + } + }); +} + +// Postprocessor + +/** + * Create a postprocessor + * @description this API is experimental and subject to change + * @memberof Extensions + */ +Extensions.createPostprocessor = function (name, functions) { + if (arguments.length === 1) { + functions = name; + name = null; + } + return initializeProcessorClass('Postprocessor', name, functions); +}; + +/** + * Create and instantiate a postprocessor + * @description this API is experimental and subject to change + * @memberof Extensions + */ +Extensions.newPostprocessor = function (name, functions) { + if (arguments.length === 1) { + functions = name; + name = null; + } + return this.createPostprocessor(name, functions).$new(); +}; + +// Preprocessor + +/** + * Create a preprocessor + * @description this API is experimental and subject to change + * @memberof Extensions + */ +Extensions.createPreprocessor = function (name, functions) { + if (arguments.length === 1) { + functions = name; + name = null; + } + return initializeProcessorClass('Preprocessor', name, functions); +}; + +/** + * Create and instantiate a preprocessor + * @description this API is experimental and subject to change + * @memberof Extensions + */ +Extensions.newPreprocessor = function (name, functions) { + if (arguments.length === 1) { + functions = name; + name = null; + } + return this.createPreprocessor(name, functions).$new(); +}; + +// Tree Processor + +/** + * Create a tree processor + * @description this API is experimental and subject to change + * @memberof Extensions + */ +Extensions.createTreeProcessor = function (name, functions) { + if (arguments.length === 1) { + functions = name; + name = null; + } + return initializeProcessorClass('TreeProcessor', name, functions); +}; + +/** + * Create and instantiate a tree processor + * @description this API is experimental and subject to change + * @memberof Extensions + */ +Extensions.newTreeProcessor = function (name, functions) { + if (arguments.length === 1) { + functions = name; + name = null; + } + return this.createTreeProcessor(name, functions).$new(); +}; + +// Include Processor + +/** + * Create an include processor + * @description this API is experimental and subject to change + * @memberof Extensions + */ +Extensions.createIncludeProcessor = function (name, functions) { + if (arguments.length === 1) { + functions = name; + name = null; + } + return initializeProcessorClass('IncludeProcessor', name, functions); +}; + +/** + * Create and instantiate an include processor + * @description this API is experimental and subject to change + * @memberof Extensions + */ +Extensions.newIncludeProcessor = function (name, functions) { + if (arguments.length === 1) { + functions = name; + name = null; + } + return this.createIncludeProcessor(name, functions).$new(); +}; + +// Docinfo Processor + +/** + * Create a Docinfo processor + * @description this API is experimental and subject to change + * @memberof Extensions + */ +Extensions.createDocinfoProcessor = function (name, functions) { + if (arguments.length === 1) { + functions = name; + name = null; + } + return initializeProcessorClass('DocinfoProcessor', name, functions); +}; + +/** + * Create and instantiate a Docinfo processor + * @description this API is experimental and subject to change + * @memberof Extensions + */ +Extensions.newDocinfoProcessor = function (name, functions) { + if (arguments.length === 1) { + functions = name; + name = null; + } + return this.createDocinfoProcessor(name, functions).$new(); +}; + +// Block Processor + +/** + * Create a block processor + * @description this API is experimental and subject to change + * @memberof Extensions + */ +Extensions.createBlockProcessor = function (name, functions) { + if (arguments.length === 1) { + functions = name; + name = null; + } + return initializeProcessorClass('BlockProcessor', name, functions); +}; + +/** + * Create and instantiate a block processor + * @description this API is experimental and subject to change + * @memberof Extensions + */ +Extensions.newBlockProcessor = function (name, functions) { + if (arguments.length === 1) { + functions = name; + name = null; + } + return this.createBlockProcessor(name, functions).$new(); +}; + +// Inline Macro Processor + +/** + * Create an inline macro processor + * @description this API is experimental and subject to change + * @memberof Extensions + */ +Extensions.createInlineMacroProcessor = function (name, functions) { + if (arguments.length === 1) { + functions = name; + name = null; + } + return initializeProcessorClass('InlineMacroProcessor', name, functions); +}; + +/** + * Create and instantiate an inline macro processor + * @description this API is experimental and subject to change + * @memberof Extensions + */ +Extensions.newInlineMacroProcessor = function (name, functions) { + if (arguments.length === 1) { + functions = name; + name = null; + } + return this.createInlineMacroProcessor(name, functions).$new(); +}; + +// Block Macro Processor + +/** + * Create a block macro processor + * @description this API is experimental and subject to change + * @memberof Extensions + */ +Extensions.createBlockMacroProcessor = function (name, functions) { + if (arguments.length === 1) { + functions = name; + name = null; + } + return initializeProcessorClass('BlockMacroProcessor', name, functions); +}; + +/** + * Create and instantiate a block macro processor + * @description this API is experimental and subject to change + * @memberof Extensions + */ +Extensions.newBlockMacroProcessor = function (name, functions) { + if (arguments.length === 1) { + functions = name; + name = null; + } + return this.createBlockMacroProcessor(name, functions).$new(); +}; + +// Converter API + +/** + * @namespace + * @module Converter + */ +var Converter = Opal.const_get_qualified(Opal.Asciidoctor, 'Converter'); + +// Alias +Opal.Asciidoctor.Converter = Converter; + +/** + * Convert the specified node. + * + * @param {AbstractNode} node - the AbstractNode to convert + * @param {string} transform - an optional String transform that hints at + * which transformation should be applied to this node. + * @param {Object} opts - a JSON of options that provide additional hints about + * how to convert the node (default: {}) + * @returns the {Object} result of the conversion, typically a {string}. + * @memberof Converter + */ +Converter.prototype.convert = function (node, transform, opts) { + return this.$convert(node, transform, toHash(opts)); +}; + +// The built-in converter doesn't include Converter, so we have to force it +Converter.BuiltIn.prototype.convert = Converter.prototype.convert; + +// Converter Factory API + +/** + * @namespace + * @module Converter/Factory + */ +var ConverterFactory = Opal.Asciidoctor.Converter.Factory; + +// Alias +Opal.Asciidoctor.ConverterFactory = ConverterFactory; + +/** + * Register a custom converter in the global converter factory to handle conversion to the specified backends. + * If the backend value is an asterisk, the converter is used to handle any backend that does not have an explicit converter. + * + * @param converter - The Converter instance to register + * @param backends {Array} - A {string} {Array} of backend names that this converter should be registered to handle (optional, default: ['*']) + * @return {*} - Returns nothing + * @memberof Converter/Factory + */ +ConverterFactory.register = function (converter, backends) { + if (typeof converter === 'object' && typeof converter.$convert === 'undefined' && typeof converter.convert === 'function') { + Opal.def(converter, '$convert', converter.convert); + } + return this.$register(converter, backends); +}; + +/** + * Retrieves the singleton instance of the converter factory. + * + * @param {boolean} initialize - instantiate the singleton if it has not yet + * been instantiated. If this value is false and the singleton has not yet been + * instantiated, this method returns a fresh instance. + * @returns {Converter/Factory} an instance of the converter factory. + * @memberof Converter/Factory + */ +ConverterFactory.getDefault = function (initialize) { + return this.$default(initialize); +}; + +/** + * Create an instance of the converter bound to the specified backend. + * + * @param {string} backend - look for a converter bound to this keyword. + * @param {Object} opts - a JSON of options to pass to the converter (default: {}) + * @returns {Converter} - a converter instance for converting nodes in an Asciidoctor AST. + * @memberof Converter/Factory + */ +ConverterFactory.prototype.create = function (backend, opts) { + return this.$create(backend, toHash(opts)); +}; + +// Built-in converter + +/** + * @namespace + * @module Converter/Html5Converter + */ +var Html5Converter = Opal.Asciidoctor.Converter.Html5Converter; + +// Alias +Opal.Asciidoctor.Html5Converter = Html5Converter; + + +Html5Converter.prototype.convert = function (node, transform, opts) { + return this.$convert(node, transform, opts); +}; + + +var ASCIIDOCTOR_JS_VERSION = '1.5.9'; + + /** + * Get Asciidoctor.js version number. + * + * @memberof Asciidoctor + * @returns {string} - returns the version number of Asciidoctor.js. + */ + Asciidoctor.prototype.getVersion = function () { + return ASCIIDOCTOR_JS_VERSION; + }; + return Opal.Asciidoctor; +})); diff --git a/node_modules/asciidoctor.js/package.json b/node_modules/asciidoctor.js/package.json new file mode 100644 index 0000000..9e7a97b --- /dev/null +++ b/node_modules/asciidoctor.js/package.json @@ -0,0 +1,112 @@ +{ + "_args": [ + [ + "asciidoctor.js@1.5.9", + "/home/runner/work/jug-in.talks/jug-in.talks" + ] + ], + "_from": "asciidoctor.js@1.5.9", + "_id": "asciidoctor.js@1.5.9", + "_inBundle": false, + "_integrity": "sha512-k5JgwyV82TsiCpnYbDPReuHhzf/vRUt6NaZ+OGywkDDGeGG/CPfvN2Gd1MJ0iIZKDyuk4iJHOdY/2x1KBrWMzA==", + "_location": "/asciidoctor.js", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "asciidoctor.js@1.5.9", + "name": "asciidoctor.js", + "escapedName": "asciidoctor.js", + "rawSpec": "1.5.9", + "saveSpec": null, + "fetchSpec": "1.5.9" + }, + "_requiredBy": [ + "/asciidoctor-plantuml", + "/asciidoctor-reveal.js" + ], + "_resolved": "https://registry.npmjs.org/asciidoctor.js/-/asciidoctor.js-1.5.9.tgz", + "_spec": "1.5.9", + "_where": "/home/runner/work/jug-in.talks/jug-in.talks", + "authors": [ + "Dan Allen (https://github.com/mojavelinux)", + "Guillaume Grossetie (https://github.com/mogztter)", + "Anthonny Quérouil (https://github.com/anthonny)" + ], + "browser": "dist/browser/asciidoctor.js", + "bugs": { + "url": "https://github.com/asciidoctor/asciidoctor.js/issues" + }, + "dependencies": { + "opal-runtime": "1.0.11" + }, + "description": "A JavaScript AsciiDoc processor, cross-compiled from the Ruby-based AsciiDoc implementation, Asciidoctor, using Opal", + "devDependencies": { + "bestikk-download": "1.0.0", + "bestikk-fs": "1.0.0", + "bestikk-log": "0.1.0", + "bestikk-uglify": "1.0.0", + "chai": "4.1.2", + "cross-env": "5.1.4", + "documentation": "6.3.2", + "eslint": "4.19.1", + "http-server": "0.11.1", + "mocha": "5.1.1", + "opal-compiler": "1.0.11", + "puppeteer": "1.3.0", + "sinon": "5.0.6", + "xmlhttprequest": "1.8.0" + }, + "engines": { + "node": ">=8.11", + "npm": ">=5.0.0", + "yarn": ">=1.1.0" + }, + "files": [ + "dist", + "LICENSE", + "README.adoc" + ], + "homepage": "https://github.com/asciidoctor/asciidoctor.js", + "keywords": [ + "asciidoc", + "asciidoctor", + "opal", + "javascript", + "library" + ], + "license": "MIT", + "main": "dist/node/asciidoctor.js", + "name": "asciidoctor.js", + "publishConfig": { + "access": "public" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/asciidoctor/asciidoctor.js.git" + }, + "scripts": { + "benchmark": "node npm/benchmark.js", + "build": "node npm/build.js && npm run test && npm run lint", + "build:quick": "node npm/build.js && npm run test:node && npm run code:lint", + "clean": "node npm/clean.js", + "code:lint": "eslint src spec npm", + "dist": "cross-env MINIFY=1 node npm/dist.js", + "docs": "npm run docs:lint && npm run docs:build", + "docs:build": "documentation build src/** -f html -o build/docs -g", + "docs:lint": "documentation lint src/**", + "docs:serve": "documentation serve src/** -g -w", + "examples": "node npm/examples.js", + "lint": "npm run code:lint && npm run docs:lint", + "package": "cross-env MINIFY=1 node npm/build.js && cross-env MINIFY=1 npm run test", + "postpublish": "node npm/postpublish.js", + "prepublishOnly": "node npm/prepublish.js", + "release": "cross-env MINIFY=1 node npm/release.js", + "server": "node npm/server.js", + "test": "node npm/test/unsupported-features.js && npm run test:node && npm run test:browser && npm run test:nashorn", + "test:browser": "node spec/browser/run.js", + "test:nashorn": "node npm/test/nashorn.js", + "test:node": "mocha spec/*/*.spec.js" + }, + "version": "1.5.9" +} diff --git a/node_modules/balanced-match/.npmignore b/node_modules/balanced-match/.npmignore new file mode 100644 index 0000000..ae5d8c3 --- /dev/null +++ b/node_modules/balanced-match/.npmignore @@ -0,0 +1,5 @@ +test +.gitignore +.travis.yml +Makefile +example.js diff --git a/node_modules/balanced-match/LICENSE.md b/node_modules/balanced-match/LICENSE.md new file mode 100644 index 0000000..2cdc8e4 --- /dev/null +++ b/node_modules/balanced-match/LICENSE.md @@ -0,0 +1,21 @@ +(MIT) + +Copyright (c) 2013 Julian Gruber <julian@juliangruber.com> + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/balanced-match/README.md b/node_modules/balanced-match/README.md new file mode 100644 index 0000000..08e918c --- /dev/null +++ b/node_modules/balanced-match/README.md @@ -0,0 +1,91 @@ +# balanced-match + +Match balanced string pairs, like `{` and `}` or `` and ``. Supports regular expressions as well! + +[![build status](https://secure.travis-ci.org/juliangruber/balanced-match.svg)](http://travis-ci.org/juliangruber/balanced-match) +[![downloads](https://img.shields.io/npm/dm/balanced-match.svg)](https://www.npmjs.org/package/balanced-match) + +[![testling badge](https://ci.testling.com/juliangruber/balanced-match.png)](https://ci.testling.com/juliangruber/balanced-match) + +## Example + +Get the first matching pair of braces: + +```js +var balanced = require('balanced-match'); + +console.log(balanced('{', '}', 'pre{in{nested}}post')); +console.log(balanced('{', '}', 'pre{first}between{second}post')); +console.log(balanced(/\s+\{\s+/, /\s+\}\s+/, 'pre { in{nest} } post')); +``` + +The matches are: + +```bash +$ node example.js +{ start: 3, end: 14, pre: 'pre', body: 'in{nested}', post: 'post' } +{ start: 3, + end: 9, + pre: 'pre', + body: 'first', + post: 'between{second}post' } +{ start: 3, end: 17, pre: 'pre', body: 'in{nest}', post: 'post' } +``` + +## API + +### var m = balanced(a, b, str) + +For the first non-nested matching pair of `a` and `b` in `str`, return an +object with those keys: + +* **start** the index of the first match of `a` +* **end** the index of the matching `b` +* **pre** the preamble, `a` and `b` not included +* **body** the match, `a` and `b` not included +* **post** the postscript, `a` and `b` not included + +If there's no match, `undefined` will be returned. + +If the `str` contains more `a` than `b` / there are unmatched pairs, the first match that was closed will be used. For example, `{{a}` will match `['{', 'a', '']` and `{a}}` will match `['', 'a', '}']`. + +### var r = balanced.range(a, b, str) + +For the first non-nested matching pair of `a` and `b` in `str`, return an +array with indexes: `[ , ]`. + +If there's no match, `undefined` will be returned. + +If the `str` contains more `a` than `b` / there are unmatched pairs, the first match that was closed will be used. For example, `{{a}` will match `[ 1, 3 ]` and `{a}}` will match `[0, 2]`. + +## Installation + +With [npm](https://npmjs.org) do: + +```bash +npm install balanced-match +``` + +## License + +(MIT) + +Copyright (c) 2013 Julian Gruber <julian@juliangruber.com> + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/balanced-match/index.js b/node_modules/balanced-match/index.js new file mode 100644 index 0000000..1685a76 --- /dev/null +++ b/node_modules/balanced-match/index.js @@ -0,0 +1,59 @@ +'use strict'; +module.exports = balanced; +function balanced(a, b, str) { + if (a instanceof RegExp) a = maybeMatch(a, str); + if (b instanceof RegExp) b = maybeMatch(b, str); + + var r = range(a, b, str); + + return r && { + start: r[0], + end: r[1], + pre: str.slice(0, r[0]), + body: str.slice(r[0] + a.length, r[1]), + post: str.slice(r[1] + b.length) + }; +} + +function maybeMatch(reg, str) { + var m = str.match(reg); + return m ? m[0] : null; +} + +balanced.range = range; +function range(a, b, str) { + var begs, beg, left, right, result; + var ai = str.indexOf(a); + var bi = str.indexOf(b, ai + 1); + var i = ai; + + if (ai >= 0 && bi > 0) { + begs = []; + left = str.length; + + while (i >= 0 && !result) { + if (i == ai) { + begs.push(i); + ai = str.indexOf(a, i + 1); + } else if (begs.length == 1) { + result = [ begs.pop(), bi ]; + } else { + beg = begs.pop(); + if (beg < left) { + left = beg; + right = bi; + } + + bi = str.indexOf(b, i + 1); + } + + i = ai < bi && ai >= 0 ? ai : bi; + } + + if (begs.length) { + result = [ left, right ]; + } + } + + return result; +} diff --git a/node_modules/balanced-match/package.json b/node_modules/balanced-match/package.json new file mode 100644 index 0000000..f493d52 --- /dev/null +++ b/node_modules/balanced-match/package.json @@ -0,0 +1,80 @@ +{ + "_args": [ + [ + "balanced-match@1.0.0", + "/home/runner/work/jug-in.talks/jug-in.talks" + ] + ], + "_from": "balanced-match@1.0.0", + "_id": "balanced-match@1.0.0", + "_inBundle": false, + "_integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", + "_location": "/balanced-match", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "balanced-match@1.0.0", + "name": "balanced-match", + "escapedName": "balanced-match", + "rawSpec": "1.0.0", + "saveSpec": null, + "fetchSpec": "1.0.0" + }, + "_requiredBy": [ + "/brace-expansion" + ], + "_resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", + "_spec": "1.0.0", + "_where": "/home/runner/work/jug-in.talks/jug-in.talks", + "author": { + "name": "Julian Gruber", + "email": "mail@juliangruber.com", + "url": "http://juliangruber.com" + }, + "bugs": { + "url": "https://github.com/juliangruber/balanced-match/issues" + }, + "dependencies": {}, + "description": "Match balanced character pairs, like \"{\" and \"}\"", + "devDependencies": { + "matcha": "^0.7.0", + "tape": "^4.6.0" + }, + "homepage": "https://github.com/juliangruber/balanced-match", + "keywords": [ + "match", + "regexp", + "test", + "balanced", + "parse" + ], + "license": "MIT", + "main": "index.js", + "name": "balanced-match", + "repository": { + "type": "git", + "url": "git://github.com/juliangruber/balanced-match.git" + }, + "scripts": { + "bench": "make bench", + "test": "make test" + }, + "testling": { + "files": "test/*.js", + "browsers": [ + "ie/8..latest", + "firefox/20..latest", + "firefox/nightly", + "chrome/25..latest", + "chrome/canary", + "opera/12..latest", + "opera/next", + "safari/5.1..latest", + "ipad/6.0..latest", + "iphone/6.0..latest", + "android-browser/4.2..latest" + ] + }, + "version": "1.0.0" +} diff --git a/node_modules/brace-expansion/LICENSE b/node_modules/brace-expansion/LICENSE new file mode 100644 index 0000000..de32266 --- /dev/null +++ b/node_modules/brace-expansion/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2013 Julian Gruber + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/brace-expansion/README.md b/node_modules/brace-expansion/README.md new file mode 100644 index 0000000..6b4e0e1 --- /dev/null +++ b/node_modules/brace-expansion/README.md @@ -0,0 +1,129 @@ +# brace-expansion + +[Brace expansion](https://www.gnu.org/software/bash/manual/html_node/Brace-Expansion.html), +as known from sh/bash, in JavaScript. + +[![build status](https://secure.travis-ci.org/juliangruber/brace-expansion.svg)](http://travis-ci.org/juliangruber/brace-expansion) +[![downloads](https://img.shields.io/npm/dm/brace-expansion.svg)](https://www.npmjs.org/package/brace-expansion) +[![Greenkeeper badge](https://badges.greenkeeper.io/juliangruber/brace-expansion.svg)](https://greenkeeper.io/) + +[![testling badge](https://ci.testling.com/juliangruber/brace-expansion.png)](https://ci.testling.com/juliangruber/brace-expansion) + +## Example + +```js +var expand = require('brace-expansion'); + +expand('file-{a,b,c}.jpg') +// => ['file-a.jpg', 'file-b.jpg', 'file-c.jpg'] + +expand('-v{,,}') +// => ['-v', '-v', '-v'] + +expand('file{0..2}.jpg') +// => ['file0.jpg', 'file1.jpg', 'file2.jpg'] + +expand('file-{a..c}.jpg') +// => ['file-a.jpg', 'file-b.jpg', 'file-c.jpg'] + +expand('file{2..0}.jpg') +// => ['file2.jpg', 'file1.jpg', 'file0.jpg'] + +expand('file{0..4..2}.jpg') +// => ['file0.jpg', 'file2.jpg', 'file4.jpg'] + +expand('file-{a..e..2}.jpg') +// => ['file-a.jpg', 'file-c.jpg', 'file-e.jpg'] + +expand('file{00..10..5}.jpg') +// => ['file00.jpg', 'file05.jpg', 'file10.jpg'] + +expand('{{A..C},{a..c}}') +// => ['A', 'B', 'C', 'a', 'b', 'c'] + +expand('ppp{,config,oe{,conf}}') +// => ['ppp', 'pppconfig', 'pppoe', 'pppoeconf'] +``` + +## API + +```js +var expand = require('brace-expansion'); +``` + +### var expanded = expand(str) + +Return an array of all possible and valid expansions of `str`. If none are +found, `[str]` is returned. + +Valid expansions are: + +```js +/^(.*,)+(.+)?$/ +// {a,b,...} +``` + +A comma separated list of options, like `{a,b}` or `{a,{b,c}}` or `{,a,}`. + +```js +/^-?\d+\.\.-?\d+(\.\.-?\d+)?$/ +// {x..y[..incr]} +``` + +A numeric sequence from `x` to `y` inclusive, with optional increment. +If `x` or `y` start with a leading `0`, all the numbers will be padded +to have equal length. Negative numbers and backwards iteration work too. + +```js +/^-?\d+\.\.-?\d+(\.\.-?\d+)?$/ +// {x..y[..incr]} +``` + +An alphabetic sequence from `x` to `y` inclusive, with optional increment. +`x` and `y` must be exactly one character, and if given, `incr` must be a +number. + +For compatibility reasons, the string `${` is not eligible for brace expansion. + +## Installation + +With [npm](https://npmjs.org) do: + +```bash +npm install brace-expansion +``` + +## Contributors + +- [Julian Gruber](https://github.com/juliangruber) +- [Isaac Z. Schlueter](https://github.com/isaacs) + +## Sponsors + +This module is proudly supported by my [Sponsors](https://github.com/juliangruber/sponsors)! + +Do you want to support modules like this to improve their quality, stability and weigh in on new features? Then please consider donating to my [Patreon](https://www.patreon.com/juliangruber). Not sure how much of my modules you're using? Try [feross/thanks](https://github.com/feross/thanks)! + +## License + +(MIT) + +Copyright (c) 2013 Julian Gruber <julian@juliangruber.com> + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/brace-expansion/index.js b/node_modules/brace-expansion/index.js new file mode 100644 index 0000000..0478be8 --- /dev/null +++ b/node_modules/brace-expansion/index.js @@ -0,0 +1,201 @@ +var concatMap = require('concat-map'); +var balanced = require('balanced-match'); + +module.exports = expandTop; + +var escSlash = '\0SLASH'+Math.random()+'\0'; +var escOpen = '\0OPEN'+Math.random()+'\0'; +var escClose = '\0CLOSE'+Math.random()+'\0'; +var escComma = '\0COMMA'+Math.random()+'\0'; +var escPeriod = '\0PERIOD'+Math.random()+'\0'; + +function numeric(str) { + return parseInt(str, 10) == str + ? parseInt(str, 10) + : str.charCodeAt(0); +} + +function escapeBraces(str) { + return str.split('\\\\').join(escSlash) + .split('\\{').join(escOpen) + .split('\\}').join(escClose) + .split('\\,').join(escComma) + .split('\\.').join(escPeriod); +} + +function unescapeBraces(str) { + return str.split(escSlash).join('\\') + .split(escOpen).join('{') + .split(escClose).join('}') + .split(escComma).join(',') + .split(escPeriod).join('.'); +} + + +// Basically just str.split(","), but handling cases +// where we have nested braced sections, which should be +// treated as individual members, like {a,{b,c},d} +function parseCommaParts(str) { + if (!str) + return ['']; + + var parts = []; + var m = balanced('{', '}', str); + + if (!m) + return str.split(','); + + var pre = m.pre; + var body = m.body; + var post = m.post; + var p = pre.split(','); + + p[p.length-1] += '{' + body + '}'; + var postParts = parseCommaParts(post); + if (post.length) { + p[p.length-1] += postParts.shift(); + p.push.apply(p, postParts); + } + + parts.push.apply(parts, p); + + return parts; +} + +function expandTop(str) { + if (!str) + return []; + + // I don't know why Bash 4.3 does this, but it does. + // Anything starting with {} will have the first two bytes preserved + // but *only* at the top level, so {},a}b will not expand to anything, + // but a{},b}c will be expanded to [a}c,abc]. + // One could argue that this is a bug in Bash, but since the goal of + // this module is to match Bash's rules, we escape a leading {} + if (str.substr(0, 2) === '{}') { + str = '\\{\\}' + str.substr(2); + } + + return expand(escapeBraces(str), true).map(unescapeBraces); +} + +function identity(e) { + return e; +} + +function embrace(str) { + return '{' + str + '}'; +} +function isPadded(el) { + return /^-?0\d/.test(el); +} + +function lte(i, y) { + return i <= y; +} +function gte(i, y) { + return i >= y; +} + +function expand(str, isTop) { + var expansions = []; + + var m = balanced('{', '}', str); + if (!m || /\$$/.test(m.pre)) return [str]; + + var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body); + var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body); + var isSequence = isNumericSequence || isAlphaSequence; + var isOptions = m.body.indexOf(',') >= 0; + if (!isSequence && !isOptions) { + // {a},b} + if (m.post.match(/,.*\}/)) { + str = m.pre + '{' + m.body + escClose + m.post; + return expand(str); + } + return [str]; + } + + var n; + if (isSequence) { + n = m.body.split(/\.\./); + } else { + n = parseCommaParts(m.body); + if (n.length === 1) { + // x{{a,b}}y ==> x{a}y x{b}y + n = expand(n[0], false).map(embrace); + if (n.length === 1) { + var post = m.post.length + ? expand(m.post, false) + : ['']; + return post.map(function(p) { + return m.pre + n[0] + p; + }); + } + } + } + + // at this point, n is the parts, and we know it's not a comma set + // with a single entry. + + // no need to expand pre, since it is guaranteed to be free of brace-sets + var pre = m.pre; + var post = m.post.length + ? expand(m.post, false) + : ['']; + + var N; + + if (isSequence) { + var x = numeric(n[0]); + var y = numeric(n[1]); + var width = Math.max(n[0].length, n[1].length) + var incr = n.length == 3 + ? Math.abs(numeric(n[2])) + : 1; + var test = lte; + var reverse = y < x; + if (reverse) { + incr *= -1; + test = gte; + } + var pad = n.some(isPadded); + + N = []; + + for (var i = x; test(i, y); i += incr) { + var c; + if (isAlphaSequence) { + c = String.fromCharCode(i); + if (c === '\\') + c = ''; + } else { + c = String(i); + if (pad) { + var need = width - c.length; + if (need > 0) { + var z = new Array(need + 1).join('0'); + if (i < 0) + c = '-' + z + c.slice(1); + else + c = z + c; + } + } + } + N.push(c); + } + } else { + N = concatMap(n, function(el) { return expand(el, false) }); + } + + for (var j = 0; j < N.length; j++) { + for (var k = 0; k < post.length; k++) { + var expansion = pre + N[j] + post[k]; + if (!isTop || isSequence || expansion) + expansions.push(expansion); + } + } + + return expansions; +} + diff --git a/node_modules/brace-expansion/package.json b/node_modules/brace-expansion/package.json new file mode 100644 index 0000000..79252f1 --- /dev/null +++ b/node_modules/brace-expansion/package.json @@ -0,0 +1,78 @@ +{ + "_args": [ + [ + "brace-expansion@1.1.11", + "/home/runner/work/jug-in.talks/jug-in.talks" + ] + ], + "_from": "brace-expansion@1.1.11", + "_id": "brace-expansion@1.1.11", + "_inBundle": false, + "_integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "_location": "/brace-expansion", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "brace-expansion@1.1.11", + "name": "brace-expansion", + "escapedName": "brace-expansion", + "rawSpec": "1.1.11", + "saveSpec": null, + "fetchSpec": "1.1.11" + }, + "_requiredBy": [ + "/minimatch" + ], + "_resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "_spec": "1.1.11", + "_where": "/home/runner/work/jug-in.talks/jug-in.talks", + "author": { + "name": "Julian Gruber", + "email": "mail@juliangruber.com", + "url": "http://juliangruber.com" + }, + "bugs": { + "url": "https://github.com/juliangruber/brace-expansion/issues" + }, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + }, + "description": "Brace expansion as known from sh/bash", + "devDependencies": { + "matcha": "^0.7.0", + "tape": "^4.6.0" + }, + "homepage": "https://github.com/juliangruber/brace-expansion", + "keywords": [], + "license": "MIT", + "main": "index.js", + "name": "brace-expansion", + "repository": { + "type": "git", + "url": "git://github.com/juliangruber/brace-expansion.git" + }, + "scripts": { + "bench": "matcha test/perf/bench.js", + "gentest": "bash test/generate.sh", + "test": "tape test/*.js" + }, + "testling": { + "files": "test/*.js", + "browsers": [ + "ie/8..latest", + "firefox/20..latest", + "firefox/nightly", + "chrome/25..latest", + "chrome/canary", + "opera/12..latest", + "opera/next", + "safari/5.1..latest", + "ipad/6.0..latest", + "iphone/6.0..latest", + "android-browser/4.2..latest" + ] + }, + "version": "1.1.11" +} diff --git a/node_modules/concat-map/.travis.yml b/node_modules/concat-map/.travis.yml new file mode 100644 index 0000000..f1d0f13 --- /dev/null +++ b/node_modules/concat-map/.travis.yml @@ -0,0 +1,4 @@ +language: node_js +node_js: + - 0.4 + - 0.6 diff --git a/node_modules/concat-map/LICENSE b/node_modules/concat-map/LICENSE new file mode 100644 index 0000000..ee27ba4 --- /dev/null +++ b/node_modules/concat-map/LICENSE @@ -0,0 +1,18 @@ +This software is released under the MIT license: + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/concat-map/README.markdown b/node_modules/concat-map/README.markdown new file mode 100644 index 0000000..408f70a --- /dev/null +++ b/node_modules/concat-map/README.markdown @@ -0,0 +1,62 @@ +concat-map +========== + +Concatenative mapdashery. + +[![browser support](http://ci.testling.com/substack/node-concat-map.png)](http://ci.testling.com/substack/node-concat-map) + +[![build status](https://secure.travis-ci.org/substack/node-concat-map.png)](http://travis-ci.org/substack/node-concat-map) + +example +======= + +``` js +var concatMap = require('concat-map'); +var xs = [ 1, 2, 3, 4, 5, 6 ]; +var ys = concatMap(xs, function (x) { + return x % 2 ? [ x - 0.1, x, x + 0.1 ] : []; +}); +console.dir(ys); +``` + +*** + +``` +[ 0.9, 1, 1.1, 2.9, 3, 3.1, 4.9, 5, 5.1 ] +``` + +methods +======= + +``` js +var concatMap = require('concat-map') +``` + +concatMap(xs, fn) +----------------- + +Return an array of concatenated elements by calling `fn(x, i)` for each element +`x` and each index `i` in the array `xs`. + +When `fn(x, i)` returns an array, its result will be concatenated with the +result array. If `fn(x, i)` returns anything else, that value will be pushed +onto the end of the result array. + +install +======= + +With [npm](http://npmjs.org) do: + +``` +npm install concat-map +``` + +license +======= + +MIT + +notes +===== + +This module was written while sitting high above the ground in a tree. diff --git a/node_modules/concat-map/example/map.js b/node_modules/concat-map/example/map.js new file mode 100644 index 0000000..3365621 --- /dev/null +++ b/node_modules/concat-map/example/map.js @@ -0,0 +1,6 @@ +var concatMap = require('../'); +var xs = [ 1, 2, 3, 4, 5, 6 ]; +var ys = concatMap(xs, function (x) { + return x % 2 ? [ x - 0.1, x, x + 0.1 ] : []; +}); +console.dir(ys); diff --git a/node_modules/concat-map/index.js b/node_modules/concat-map/index.js new file mode 100644 index 0000000..b29a781 --- /dev/null +++ b/node_modules/concat-map/index.js @@ -0,0 +1,13 @@ +module.exports = function (xs, fn) { + var res = []; + for (var i = 0; i < xs.length; i++) { + var x = fn(xs[i], i); + if (isArray(x)) res.push.apply(res, x); + else res.push(x); + } + return res; +}; + +var isArray = Array.isArray || function (xs) { + return Object.prototype.toString.call(xs) === '[object Array]'; +}; diff --git a/node_modules/concat-map/package.json b/node_modules/concat-map/package.json new file mode 100644 index 0000000..9cc397d --- /dev/null +++ b/node_modules/concat-map/package.json @@ -0,0 +1,91 @@ +{ + "_args": [ + [ + "concat-map@0.0.1", + "/home/runner/work/jug-in.talks/jug-in.talks" + ] + ], + "_from": "concat-map@0.0.1", + "_id": "concat-map@0.0.1", + "_inBundle": false, + "_integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", + "_location": "/concat-map", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "concat-map@0.0.1", + "name": "concat-map", + "escapedName": "concat-map", + "rawSpec": "0.0.1", + "saveSpec": null, + "fetchSpec": "0.0.1" + }, + "_requiredBy": [ + "/brace-expansion" + ], + "_resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "_spec": "0.0.1", + "_where": "/home/runner/work/jug-in.talks/jug-in.talks", + "author": { + "name": "James Halliday", + "email": "mail@substack.net", + "url": "http://substack.net" + }, + "bugs": { + "url": "https://github.com/substack/node-concat-map/issues" + }, + "description": "concatenative mapdashery", + "devDependencies": { + "tape": "~2.4.0" + }, + "directories": { + "example": "example", + "test": "test" + }, + "homepage": "https://github.com/substack/node-concat-map#readme", + "keywords": [ + "concat", + "concatMap", + "map", + "functional", + "higher-order" + ], + "license": "MIT", + "main": "index.js", + "name": "concat-map", + "repository": { + "type": "git", + "url": "git://github.com/substack/node-concat-map.git" + }, + "scripts": { + "test": "tape test/*.js" + }, + "testling": { + "files": "test/*.js", + "browsers": { + "ie": [ + 6, + 7, + 8, + 9 + ], + "ff": [ + 3.5, + 10, + 15 + ], + "chrome": [ + 10, + 22 + ], + "safari": [ + 5.1 + ], + "opera": [ + 12 + ] + } + }, + "version": "0.0.1" +} diff --git a/node_modules/concat-map/test/map.js b/node_modules/concat-map/test/map.js new file mode 100644 index 0000000..fdbd702 --- /dev/null +++ b/node_modules/concat-map/test/map.js @@ -0,0 +1,39 @@ +var concatMap = require('../'); +var test = require('tape'); + +test('empty or not', function (t) { + var xs = [ 1, 2, 3, 4, 5, 6 ]; + var ixes = []; + var ys = concatMap(xs, function (x, ix) { + ixes.push(ix); + return x % 2 ? [ x - 0.1, x, x + 0.1 ] : []; + }); + t.same(ys, [ 0.9, 1, 1.1, 2.9, 3, 3.1, 4.9, 5, 5.1 ]); + t.same(ixes, [ 0, 1, 2, 3, 4, 5 ]); + t.end(); +}); + +test('always something', function (t) { + var xs = [ 'a', 'b', 'c', 'd' ]; + var ys = concatMap(xs, function (x) { + return x === 'b' ? [ 'B', 'B', 'B' ] : [ x ]; + }); + t.same(ys, [ 'a', 'B', 'B', 'B', 'c', 'd' ]); + t.end(); +}); + +test('scalars', function (t) { + var xs = [ 'a', 'b', 'c', 'd' ]; + var ys = concatMap(xs, function (x) { + return x === 'b' ? [ 'B', 'B', 'B' ] : x; + }); + t.same(ys, [ 'a', 'B', 'B', 'B', 'c', 'd' ]); + t.end(); +}); + +test('undefs', function (t) { + var xs = [ 'a', 'b', 'c', 'd' ]; + var ys = concatMap(xs, function () {}); + t.same(ys, [ undefined, undefined, undefined, undefined ]); + t.end(); +}); diff --git a/node_modules/glob/LICENSE b/node_modules/glob/LICENSE new file mode 100644 index 0000000..19129e3 --- /dev/null +++ b/node_modules/glob/LICENSE @@ -0,0 +1,15 @@ +The ISC License + +Copyright (c) Isaac Z. Schlueter and Contributors + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/glob/README.md b/node_modules/glob/README.md new file mode 100644 index 0000000..6960483 --- /dev/null +++ b/node_modules/glob/README.md @@ -0,0 +1,359 @@ +# Glob + +Match files using the patterns the shell uses, like stars and stuff. + +[![Build Status](https://travis-ci.org/isaacs/node-glob.svg?branch=master)](https://travis-ci.org/isaacs/node-glob/) [![Build Status](https://ci.appveyor.com/api/projects/status/kd7f3yftf7unxlsx?svg=true)](https://ci.appveyor.com/project/isaacs/node-glob) [![Coverage Status](https://coveralls.io/repos/isaacs/node-glob/badge.svg?branch=master&service=github)](https://coveralls.io/github/isaacs/node-glob?branch=master) + +This is a glob implementation in JavaScript. It uses the `minimatch` +library to do its matching. + +![](oh-my-glob.gif) + +## Usage + +```javascript +var glob = require("glob") + +// options is optional +glob("**/*.js", options, function (er, files) { + // files is an array of filenames. + // If the `nonull` option is set, and nothing + // was found, then files is ["**/*.js"] + // er is an error object or null. +}) +``` + +## Glob Primer + +"Globs" are the patterns you type when you do stuff like `ls *.js` on +the command line, or put `build/*` in a `.gitignore` file. + +Before parsing the path part patterns, braced sections are expanded +into a set. Braced sections start with `{` and end with `}`, with any +number of comma-delimited sections within. Braced sections may contain +slash characters, so `a{/b/c,bcd}` would expand into `a/b/c` and `abcd`. + +The following characters have special magic meaning when used in a +path portion: + +* `*` Matches 0 or more characters in a single path portion +* `?` Matches 1 character +* `[...]` Matches a range of characters, similar to a RegExp range. + If the first character of the range is `!` or `^` then it matches + any character not in the range. +* `!(pattern|pattern|pattern)` Matches anything that does not match + any of the patterns provided. +* `?(pattern|pattern|pattern)` Matches zero or one occurrence of the + patterns provided. +* `+(pattern|pattern|pattern)` Matches one or more occurrences of the + patterns provided. +* `*(a|b|c)` Matches zero or more occurrences of the patterns provided +* `@(pattern|pat*|pat?erN)` Matches exactly one of the patterns + provided +* `**` If a "globstar" is alone in a path portion, then it matches + zero or more directories and subdirectories searching for matches. + It does not crawl symlinked directories. + +### Dots + +If a file or directory path portion has a `.` as the first character, +then it will not match any glob pattern unless that pattern's +corresponding path part also has a `.` as its first character. + +For example, the pattern `a/.*/c` would match the file at `a/.b/c`. +However the pattern `a/*/c` would not, because `*` does not start with +a dot character. + +You can make glob treat dots as normal characters by setting +`dot:true` in the options. + +### Basename Matching + +If you set `matchBase:true` in the options, and the pattern has no +slashes in it, then it will seek for any file anywhere in the tree +with a matching basename. For example, `*.js` would match +`test/simple/basic.js`. + +### Empty Sets + +If no matching files are found, then an empty array is returned. This +differs from the shell, where the pattern itself is returned. For +example: + + $ echo a*s*d*f + a*s*d*f + +To get the bash-style behavior, set the `nonull:true` in the options. + +### See Also: + +* `man sh` +* `man bash` (Search for "Pattern Matching") +* `man 3 fnmatch` +* `man 5 gitignore` +* [minimatch documentation](https://github.com/isaacs/minimatch) + +## glob.hasMagic(pattern, [options]) + +Returns `true` if there are any special characters in the pattern, and +`false` otherwise. + +Note that the options affect the results. If `noext:true` is set in +the options object, then `+(a|b)` will not be considered a magic +pattern. If the pattern has a brace expansion, like `a/{b/c,x/y}` +then that is considered magical, unless `nobrace:true` is set in the +options. + +## glob(pattern, [options], cb) + +* `pattern` `{String}` Pattern to be matched +* `options` `{Object}` +* `cb` `{Function}` + * `err` `{Error | null}` + * `matches` `{Array}` filenames found matching the pattern + +Perform an asynchronous glob search. + +## glob.sync(pattern, [options]) + +* `pattern` `{String}` Pattern to be matched +* `options` `{Object}` +* return: `{Array}` filenames found matching the pattern + +Perform a synchronous glob search. + +## Class: glob.Glob + +Create a Glob object by instantiating the `glob.Glob` class. + +```javascript +var Glob = require("glob").Glob +var mg = new Glob(pattern, options, cb) +``` + +It's an EventEmitter, and starts walking the filesystem to find matches +immediately. + +### new glob.Glob(pattern, [options], [cb]) + +* `pattern` `{String}` pattern to search for +* `options` `{Object}` +* `cb` `{Function}` Called when an error occurs, or matches are found + * `err` `{Error | null}` + * `matches` `{Array}` filenames found matching the pattern + +Note that if the `sync` flag is set in the options, then matches will +be immediately available on the `g.found` member. + +### Properties + +* `minimatch` The minimatch object that the glob uses. +* `options` The options object passed in. +* `aborted` Boolean which is set to true when calling `abort()`. There + is no way at this time to continue a glob search after aborting, but + you can re-use the statCache to avoid having to duplicate syscalls. +* `cache` Convenience object. Each field has the following possible + values: + * `false` - Path does not exist + * `true` - Path exists + * `'FILE'` - Path exists, and is not a directory + * `'DIR'` - Path exists, and is a directory + * `[file, entries, ...]` - Path exists, is a directory, and the + array value is the results of `fs.readdir` +* `statCache` Cache of `fs.stat` results, to prevent statting the same + path multiple times. +* `symlinks` A record of which paths are symbolic links, which is + relevant in resolving `**` patterns. +* `realpathCache` An optional object which is passed to `fs.realpath` + to minimize unnecessary syscalls. It is stored on the instantiated + Glob object, and may be re-used. + +### Events + +* `end` When the matching is finished, this is emitted with all the + matches found. If the `nonull` option is set, and no match was found, + then the `matches` list contains the original pattern. The matches + are sorted, unless the `nosort` flag is set. +* `match` Every time a match is found, this is emitted with the specific + thing that matched. It is not deduplicated or resolved to a realpath. +* `error` Emitted when an unexpected error is encountered, or whenever + any fs error occurs if `options.strict` is set. +* `abort` When `abort()` is called, this event is raised. + +### Methods + +* `pause` Temporarily stop the search +* `resume` Resume the search +* `abort` Stop the search forever + +### Options + +All the options that can be passed to Minimatch can also be passed to +Glob to change pattern matching behavior. Also, some have been added, +or have glob-specific ramifications. + +All options are false by default, unless otherwise noted. + +All options are added to the Glob object, as well. + +If you are running many `glob` operations, you can pass a Glob object +as the `options` argument to a subsequent operation to shortcut some +`stat` and `readdir` calls. At the very least, you may pass in shared +`symlinks`, `statCache`, `realpathCache`, and `cache` options, so that +parallel glob operations will be sped up by sharing information about +the filesystem. + +* `cwd` The current working directory in which to search. Defaults + to `process.cwd()`. +* `root` The place where patterns starting with `/` will be mounted + onto. Defaults to `path.resolve(options.cwd, "/")` (`/` on Unix + systems, and `C:\` or some such on Windows.) +* `dot` Include `.dot` files in normal matches and `globstar` matches. + Note that an explicit dot in a portion of the pattern will always + match dot files. +* `nomount` By default, a pattern starting with a forward-slash will be + "mounted" onto the root setting, so that a valid filesystem path is + returned. Set this flag to disable that behavior. +* `mark` Add a `/` character to directory matches. Note that this + requires additional stat calls. +* `nosort` Don't sort the results. +* `stat` Set to true to stat *all* results. This reduces performance + somewhat, and is completely unnecessary, unless `readdir` is presumed + to be an untrustworthy indicator of file existence. +* `silent` When an unusual error is encountered when attempting to + read a directory, a warning will be printed to stderr. Set the + `silent` option to true to suppress these warnings. +* `strict` When an unusual error is encountered when attempting to + read a directory, the process will just continue on in search of + other matches. Set the `strict` option to raise an error in these + cases. +* `cache` See `cache` property above. Pass in a previously generated + cache object to save some fs calls. +* `statCache` A cache of results of filesystem information, to prevent + unnecessary stat calls. While it should not normally be necessary + to set this, you may pass the statCache from one glob() call to the + options object of another, if you know that the filesystem will not + change between calls. (See "Race Conditions" below.) +* `symlinks` A cache of known symbolic links. You may pass in a + previously generated `symlinks` object to save `lstat` calls when + resolving `**` matches. +* `sync` DEPRECATED: use `glob.sync(pattern, opts)` instead. +* `nounique` In some cases, brace-expanded patterns can result in the + same file showing up multiple times in the result set. By default, + this implementation prevents duplicates in the result set. Set this + flag to disable that behavior. +* `nonull` Set to never return an empty set, instead returning a set + containing the pattern itself. This is the default in glob(3). +* `debug` Set to enable debug logging in minimatch and glob. +* `nobrace` Do not expand `{a,b}` and `{1..3}` brace sets. +* `noglobstar` Do not match `**` against multiple filenames. (Ie, + treat it as a normal `*` instead.) +* `noext` Do not match `+(a|b)` "extglob" patterns. +* `nocase` Perform a case-insensitive match. Note: on + case-insensitive filesystems, non-magic patterns will match by + default, since `stat` and `readdir` will not raise errors. +* `matchBase` Perform a basename-only match if the pattern does not + contain any slash characters. That is, `*.js` would be treated as + equivalent to `**/*.js`, matching all js files in all directories. +* `nodir` Do not match directories, only files. (Note: to match + *only* directories, simply put a `/` at the end of the pattern.) +* `ignore` Add a pattern or an array of glob patterns to exclude matches. + Note: `ignore` patterns are *always* in `dot:true` mode, regardless + of any other settings. +* `follow` Follow symlinked directories when expanding `**` patterns. + Note that this can result in a lot of duplicate references in the + presence of cyclic links. +* `realpath` Set to true to call `fs.realpath` on all of the results. + In the case of a symlink that cannot be resolved, the full absolute + path to the matched entry is returned (though it will usually be a + broken symlink) + +## Comparisons to other fnmatch/glob implementations + +While strict compliance with the existing standards is a worthwhile +goal, some discrepancies exist between node-glob and other +implementations, and are intentional. + +The double-star character `**` is supported by default, unless the +`noglobstar` flag is set. This is supported in the manner of bsdglob +and bash 4.3, where `**` only has special significance if it is the only +thing in a path part. That is, `a/**/b` will match `a/x/y/b`, but +`a/**b` will not. + +Note that symlinked directories are not crawled as part of a `**`, +though their contents may match against subsequent portions of the +pattern. This prevents infinite loops and duplicates and the like. + +If an escaped pattern has no matches, and the `nonull` flag is set, +then glob returns the pattern as-provided, rather than +interpreting the character escapes. For example, +`glob.match([], "\\*a\\?")` will return `"\\*a\\?"` rather than +`"*a?"`. This is akin to setting the `nullglob` option in bash, except +that it does not resolve escaped pattern characters. + +If brace expansion is not disabled, then it is performed before any +other interpretation of the glob pattern. Thus, a pattern like +`+(a|{b),c)}`, which would not be valid in bash or zsh, is expanded +**first** into the set of `+(a|b)` and `+(a|c)`, and those patterns are +checked for validity. Since those two are valid, matching proceeds. + +### Comments and Negation + +Previously, this module let you mark a pattern as a "comment" if it +started with a `#` character, or a "negated" pattern if it started +with a `!` character. + +These options were deprecated in version 5, and removed in version 6. + +To specify things that should not match, use the `ignore` option. + +## Windows + +**Please only use forward-slashes in glob expressions.** + +Though windows uses either `/` or `\` as its path separator, only `/` +characters are used by this glob implementation. You must use +forward-slashes **only** in glob expressions. Back-slashes will always +be interpreted as escape characters, not path separators. + +Results from absolute patterns such as `/foo/*` are mounted onto the +root setting using `path.join`. On windows, this will by default result +in `/foo/*` matching `C:\foo\bar.txt`. + +## Race Conditions + +Glob searching, by its very nature, is susceptible to race conditions, +since it relies on directory walking and such. + +As a result, it is possible that a file that exists when glob looks for +it may have been deleted or modified by the time it returns the result. + +As part of its internal implementation, this program caches all stat +and readdir calls that it makes, in order to cut down on system +overhead. However, this also makes it even more susceptible to races, +especially if the cache or statCache objects are reused between glob +calls. + +Users are thus advised not to use a glob result as a guarantee of +filesystem state in the face of rapid changes. For the vast majority +of operations, this is never a problem. + +## Contributing + +Any change to behavior (including bugfixes) must come with a test. + +Patches that fail tests or reduce performance will be rejected. + +``` +# to run tests +npm test + +# to re-generate test fixtures +npm run test-regen + +# to benchmark against bash/zsh +npm run bench + +# to profile javascript +npm run prof +``` diff --git a/node_modules/glob/common.js b/node_modules/glob/common.js new file mode 100644 index 0000000..c9127eb --- /dev/null +++ b/node_modules/glob/common.js @@ -0,0 +1,226 @@ +exports.alphasort = alphasort +exports.alphasorti = alphasorti +exports.setopts = setopts +exports.ownProp = ownProp +exports.makeAbs = makeAbs +exports.finish = finish +exports.mark = mark +exports.isIgnored = isIgnored +exports.childrenIgnored = childrenIgnored + +function ownProp (obj, field) { + return Object.prototype.hasOwnProperty.call(obj, field) +} + +var path = require("path") +var minimatch = require("minimatch") +var isAbsolute = require("path-is-absolute") +var Minimatch = minimatch.Minimatch + +function alphasorti (a, b) { + return a.toLowerCase().localeCompare(b.toLowerCase()) +} + +function alphasort (a, b) { + return a.localeCompare(b) +} + +function setupIgnores (self, options) { + self.ignore = options.ignore || [] + + if (!Array.isArray(self.ignore)) + self.ignore = [self.ignore] + + if (self.ignore.length) { + self.ignore = self.ignore.map(ignoreMap) + } +} + +// ignore patterns are always in dot:true mode. +function ignoreMap (pattern) { + var gmatcher = null + if (pattern.slice(-3) === '/**') { + var gpattern = pattern.replace(/(\/\*\*)+$/, '') + gmatcher = new Minimatch(gpattern, { dot: true }) + } + + return { + matcher: new Minimatch(pattern, { dot: true }), + gmatcher: gmatcher + } +} + +function setopts (self, pattern, options) { + if (!options) + options = {} + + // base-matching: just use globstar for that. + if (options.matchBase && -1 === pattern.indexOf("/")) { + if (options.noglobstar) { + throw new Error("base matching requires globstar") + } + pattern = "**/" + pattern + } + + self.silent = !!options.silent + self.pattern = pattern + self.strict = options.strict !== false + self.realpath = !!options.realpath + self.realpathCache = options.realpathCache || Object.create(null) + self.follow = !!options.follow + self.dot = !!options.dot + self.mark = !!options.mark + self.nodir = !!options.nodir + if (self.nodir) + self.mark = true + self.sync = !!options.sync + self.nounique = !!options.nounique + self.nonull = !!options.nonull + self.nosort = !!options.nosort + self.nocase = !!options.nocase + self.stat = !!options.stat + self.noprocess = !!options.noprocess + + self.maxLength = options.maxLength || Infinity + self.cache = options.cache || Object.create(null) + self.statCache = options.statCache || Object.create(null) + self.symlinks = options.symlinks || Object.create(null) + + setupIgnores(self, options) + + self.changedCwd = false + var cwd = process.cwd() + if (!ownProp(options, "cwd")) + self.cwd = cwd + else { + self.cwd = options.cwd + self.changedCwd = path.resolve(options.cwd) !== cwd + } + + self.root = options.root || path.resolve(self.cwd, "/") + self.root = path.resolve(self.root) + if (process.platform === "win32") + self.root = self.root.replace(/\\/g, "/") + + self.nomount = !!options.nomount + + // disable comments and negation in Minimatch. + // Note that they are not supported in Glob itself anyway. + options.nonegate = true + options.nocomment = true + + self.minimatch = new Minimatch(pattern, options) + self.options = self.minimatch.options +} + +function finish (self) { + var nou = self.nounique + var all = nou ? [] : Object.create(null) + + for (var i = 0, l = self.matches.length; i < l; i ++) { + var matches = self.matches[i] + if (!matches || Object.keys(matches).length === 0) { + if (self.nonull) { + // do like the shell, and spit out the literal glob + var literal = self.minimatch.globSet[i] + if (nou) + all.push(literal) + else + all[literal] = true + } + } else { + // had matches + var m = Object.keys(matches) + if (nou) + all.push.apply(all, m) + else + m.forEach(function (m) { + all[m] = true + }) + } + } + + if (!nou) + all = Object.keys(all) + + if (!self.nosort) + all = all.sort(self.nocase ? alphasorti : alphasort) + + // at *some* point we statted all of these + if (self.mark) { + for (var i = 0; i < all.length; i++) { + all[i] = self._mark(all[i]) + } + if (self.nodir) { + all = all.filter(function (e) { + return !(/\/$/.test(e)) + }) + } + } + + if (self.ignore.length) + all = all.filter(function(m) { + return !isIgnored(self, m) + }) + + self.found = all +} + +function mark (self, p) { + var abs = makeAbs(self, p) + var c = self.cache[abs] + var m = p + if (c) { + var isDir = c === 'DIR' || Array.isArray(c) + var slash = p.slice(-1) === '/' + + if (isDir && !slash) + m += '/' + else if (!isDir && slash) + m = m.slice(0, -1) + + if (m !== p) { + var mabs = makeAbs(self, m) + self.statCache[mabs] = self.statCache[abs] + self.cache[mabs] = self.cache[abs] + } + } + + return m +} + +// lotta situps... +function makeAbs (self, f) { + var abs = f + if (f.charAt(0) === '/') { + abs = path.join(self.root, f) + } else if (isAbsolute(f) || f === '') { + abs = f + } else if (self.changedCwd) { + abs = path.resolve(self.cwd, f) + } else { + abs = path.resolve(f) + } + return abs +} + + +// Return true, if pattern ends with globstar '**', for the accompanying parent directory. +// Ex:- If node_modules/** is the pattern, add 'node_modules' to ignore list along with it's contents +function isIgnored (self, path) { + if (!self.ignore.length) + return false + + return self.ignore.some(function(item) { + return item.matcher.match(path) || !!(item.gmatcher && item.gmatcher.match(path)) + }) +} + +function childrenIgnored (self, path) { + if (!self.ignore.length) + return false + + return self.ignore.some(function(item) { + return !!(item.gmatcher && item.gmatcher.match(path)) + }) +} diff --git a/node_modules/glob/glob.js b/node_modules/glob/glob.js new file mode 100644 index 0000000..a62da27 --- /dev/null +++ b/node_modules/glob/glob.js @@ -0,0 +1,765 @@ +// Approach: +// +// 1. Get the minimatch set +// 2. For each pattern in the set, PROCESS(pattern, false) +// 3. Store matches per-set, then uniq them +// +// PROCESS(pattern, inGlobStar) +// Get the first [n] items from pattern that are all strings +// Join these together. This is PREFIX. +// If there is no more remaining, then stat(PREFIX) and +// add to matches if it succeeds. END. +// +// If inGlobStar and PREFIX is symlink and points to dir +// set ENTRIES = [] +// else readdir(PREFIX) as ENTRIES +// If fail, END +// +// with ENTRIES +// If pattern[n] is GLOBSTAR +// // handle the case where the globstar match is empty +// // by pruning it out, and testing the resulting pattern +// PROCESS(pattern[0..n] + pattern[n+1 .. $], false) +// // handle other cases. +// for ENTRY in ENTRIES (not dotfiles) +// // attach globstar + tail onto the entry +// // Mark that this entry is a globstar match +// PROCESS(pattern[0..n] + ENTRY + pattern[n .. $], true) +// +// else // not globstar +// for ENTRY in ENTRIES (not dotfiles, unless pattern[n] is dot) +// Test ENTRY against pattern[n] +// If fails, continue +// If passes, PROCESS(pattern[0..n] + item + pattern[n+1 .. $]) +// +// Caveat: +// Cache all stats and readdirs results to minimize syscall. Since all +// we ever care about is existence and directory-ness, we can just keep +// `true` for files, and [children,...] for directories, or `false` for +// things that don't exist. + +module.exports = glob + +var fs = require('fs') +var minimatch = require('minimatch') +var Minimatch = minimatch.Minimatch +var inherits = require('inherits') +var EE = require('events').EventEmitter +var path = require('path') +var assert = require('assert') +var isAbsolute = require('path-is-absolute') +var globSync = require('./sync.js') +var common = require('./common.js') +var alphasort = common.alphasort +var alphasorti = common.alphasorti +var setopts = common.setopts +var ownProp = common.ownProp +var inflight = require('inflight') +var util = require('util') +var childrenIgnored = common.childrenIgnored +var isIgnored = common.isIgnored + +var once = require('once') + +function glob (pattern, options, cb) { + if (typeof options === 'function') cb = options, options = {} + if (!options) options = {} + + if (options.sync) { + if (cb) + throw new TypeError('callback provided to sync glob') + return globSync(pattern, options) + } + + return new Glob(pattern, options, cb) +} + +glob.sync = globSync +var GlobSync = glob.GlobSync = globSync.GlobSync + +// old api surface +glob.glob = glob + +function extend (origin, add) { + if (add === null || typeof add !== 'object') { + return origin + } + + var keys = Object.keys(add) + var i = keys.length + while (i--) { + origin[keys[i]] = add[keys[i]] + } + return origin +} + +glob.hasMagic = function (pattern, options_) { + var options = extend({}, options_) + options.noprocess = true + + var g = new Glob(pattern, options) + var set = g.minimatch.set + if (set.length > 1) + return true + + for (var j = 0; j < set[0].length; j++) { + if (typeof set[0][j] !== 'string') + return true + } + + return false +} + +glob.Glob = Glob +inherits(Glob, EE) +function Glob (pattern, options, cb) { + if (typeof options === 'function') { + cb = options + options = null + } + + if (options && options.sync) { + if (cb) + throw new TypeError('callback provided to sync glob') + return new GlobSync(pattern, options) + } + + if (!(this instanceof Glob)) + return new Glob(pattern, options, cb) + + setopts(this, pattern, options) + this._didRealPath = false + + // process each pattern in the minimatch set + var n = this.minimatch.set.length + + // The matches are stored as {: true,...} so that + // duplicates are automagically pruned. + // Later, we do an Object.keys() on these. + // Keep them as a list so we can fill in when nonull is set. + this.matches = new Array(n) + + if (typeof cb === 'function') { + cb = once(cb) + this.on('error', cb) + this.on('end', function (matches) { + cb(null, matches) + }) + } + + var self = this + var n = this.minimatch.set.length + this._processing = 0 + this.matches = new Array(n) + + this._emitQueue = [] + this._processQueue = [] + this.paused = false + + if (this.noprocess) + return this + + if (n === 0) + return done() + + for (var i = 0; i < n; i ++) { + this._process(this.minimatch.set[i], i, false, done) + } + + function done () { + --self._processing + if (self._processing <= 0) + self._finish() + } +} + +Glob.prototype._finish = function () { + assert(this instanceof Glob) + if (this.aborted) + return + + if (this.realpath && !this._didRealpath) + return this._realpath() + + common.finish(this) + this.emit('end', this.found) +} + +Glob.prototype._realpath = function () { + if (this._didRealpath) + return + + this._didRealpath = true + + var n = this.matches.length + if (n === 0) + return this._finish() + + var self = this + for (var i = 0; i < this.matches.length; i++) + this._realpathSet(i, next) + + function next () { + if (--n === 0) + self._finish() + } +} + +Glob.prototype._realpathSet = function (index, cb) { + var matchset = this.matches[index] + if (!matchset) + return cb() + + var found = Object.keys(matchset) + var self = this + var n = found.length + + if (n === 0) + return cb() + + var set = this.matches[index] = Object.create(null) + found.forEach(function (p, i) { + // If there's a problem with the stat, then it means that + // one or more of the links in the realpath couldn't be + // resolved. just return the abs value in that case. + p = self._makeAbs(p) + fs.realpath(p, self.realpathCache, function (er, real) { + if (!er) + set[real] = true + else if (er.syscall === 'stat') + set[p] = true + else + self.emit('error', er) // srsly wtf right here + + if (--n === 0) { + self.matches[index] = set + cb() + } + }) + }) +} + +Glob.prototype._mark = function (p) { + return common.mark(this, p) +} + +Glob.prototype._makeAbs = function (f) { + return common.makeAbs(this, f) +} + +Glob.prototype.abort = function () { + this.aborted = true + this.emit('abort') +} + +Glob.prototype.pause = function () { + if (!this.paused) { + this.paused = true + this.emit('pause') + } +} + +Glob.prototype.resume = function () { + if (this.paused) { + this.emit('resume') + this.paused = false + if (this._emitQueue.length) { + var eq = this._emitQueue.slice(0) + this._emitQueue.length = 0 + for (var i = 0; i < eq.length; i ++) { + var e = eq[i] + this._emitMatch(e[0], e[1]) + } + } + if (this._processQueue.length) { + var pq = this._processQueue.slice(0) + this._processQueue.length = 0 + for (var i = 0; i < pq.length; i ++) { + var p = pq[i] + this._processing-- + this._process(p[0], p[1], p[2], p[3]) + } + } + } +} + +Glob.prototype._process = function (pattern, index, inGlobStar, cb) { + assert(this instanceof Glob) + assert(typeof cb === 'function') + + if (this.aborted) + return + + this._processing++ + if (this.paused) { + this._processQueue.push([pattern, index, inGlobStar, cb]) + return + } + + //console.error('PROCESS %d', this._processing, pattern) + + // Get the first [n] parts of pattern that are all strings. + var n = 0 + while (typeof pattern[n] === 'string') { + n ++ + } + // now n is the index of the first one that is *not* a string. + + // see if there's anything else + var prefix + switch (n) { + // if not, then this is rather simple + case pattern.length: + this._processSimple(pattern.join('/'), index, cb) + return + + case 0: + // pattern *starts* with some non-trivial item. + // going to readdir(cwd), but not include the prefix in matches. + prefix = null + break + + default: + // pattern has some string bits in the front. + // whatever it starts with, whether that's 'absolute' like /foo/bar, + // or 'relative' like '../baz' + prefix = pattern.slice(0, n).join('/') + break + } + + var remain = pattern.slice(n) + + // get the list of entries. + var read + if (prefix === null) + read = '.' + else if (isAbsolute(prefix) || isAbsolute(pattern.join('/'))) { + if (!prefix || !isAbsolute(prefix)) + prefix = '/' + prefix + read = prefix + } else + read = prefix + + var abs = this._makeAbs(read) + + //if ignored, skip _processing + if (childrenIgnored(this, read)) + return cb() + + var isGlobStar = remain[0] === minimatch.GLOBSTAR + if (isGlobStar) + this._processGlobStar(prefix, read, abs, remain, index, inGlobStar, cb) + else + this._processReaddir(prefix, read, abs, remain, index, inGlobStar, cb) +} + +Glob.prototype._processReaddir = function (prefix, read, abs, remain, index, inGlobStar, cb) { + var self = this + this._readdir(abs, inGlobStar, function (er, entries) { + return self._processReaddir2(prefix, read, abs, remain, index, inGlobStar, entries, cb) + }) +} + +Glob.prototype._processReaddir2 = function (prefix, read, abs, remain, index, inGlobStar, entries, cb) { + + // if the abs isn't a dir, then nothing can match! + if (!entries) + return cb() + + // It will only match dot entries if it starts with a dot, or if + // dot is set. Stuff like @(.foo|.bar) isn't allowed. + var pn = remain[0] + var negate = !!this.minimatch.negate + var rawGlob = pn._glob + var dotOk = this.dot || rawGlob.charAt(0) === '.' + + var matchedEntries = [] + for (var i = 0; i < entries.length; i++) { + var e = entries[i] + if (e.charAt(0) !== '.' || dotOk) { + var m + if (negate && !prefix) { + m = !e.match(pn) + } else { + m = e.match(pn) + } + if (m) + matchedEntries.push(e) + } + } + + //console.error('prd2', prefix, entries, remain[0]._glob, matchedEntries) + + var len = matchedEntries.length + // If there are no matched entries, then nothing matches. + if (len === 0) + return cb() + + // if this is the last remaining pattern bit, then no need for + // an additional stat *unless* the user has specified mark or + // stat explicitly. We know they exist, since readdir returned + // them. + + if (remain.length === 1 && !this.mark && !this.stat) { + if (!this.matches[index]) + this.matches[index] = Object.create(null) + + for (var i = 0; i < len; i ++) { + var e = matchedEntries[i] + if (prefix) { + if (prefix !== '/') + e = prefix + '/' + e + else + e = prefix + e + } + + if (e.charAt(0) === '/' && !this.nomount) { + e = path.join(this.root, e) + } + this._emitMatch(index, e) + } + // This was the last one, and no stats were needed + return cb() + } + + // now test all matched entries as stand-ins for that part + // of the pattern. + remain.shift() + for (var i = 0; i < len; i ++) { + var e = matchedEntries[i] + var newPattern + if (prefix) { + if (prefix !== '/') + e = prefix + '/' + e + else + e = prefix + e + } + this._process([e].concat(remain), index, inGlobStar, cb) + } + cb() +} + +Glob.prototype._emitMatch = function (index, e) { + if (this.aborted) + return + + if (this.matches[index][e]) + return + + if (isIgnored(this, e)) + return + + if (this.paused) { + this._emitQueue.push([index, e]) + return + } + + var abs = this._makeAbs(e) + + if (this.nodir) { + var c = this.cache[abs] + if (c === 'DIR' || Array.isArray(c)) + return + } + + if (this.mark) + e = this._mark(e) + + this.matches[index][e] = true + + var st = this.statCache[abs] + if (st) + this.emit('stat', e, st) + + this.emit('match', e) +} + +Glob.prototype._readdirInGlobStar = function (abs, cb) { + if (this.aborted) + return + + // follow all symlinked directories forever + // just proceed as if this is a non-globstar situation + if (this.follow) + return this._readdir(abs, false, cb) + + var lstatkey = 'lstat\0' + abs + var self = this + var lstatcb = inflight(lstatkey, lstatcb_) + + if (lstatcb) + fs.lstat(abs, lstatcb) + + function lstatcb_ (er, lstat) { + if (er) + return cb() + + var isSym = lstat.isSymbolicLink() + self.symlinks[abs] = isSym + + // If it's not a symlink or a dir, then it's definitely a regular file. + // don't bother doing a readdir in that case. + if (!isSym && !lstat.isDirectory()) { + self.cache[abs] = 'FILE' + cb() + } else + self._readdir(abs, false, cb) + } +} + +Glob.prototype._readdir = function (abs, inGlobStar, cb) { + if (this.aborted) + return + + cb = inflight('readdir\0'+abs+'\0'+inGlobStar, cb) + if (!cb) + return + + //console.error('RD %j %j', +inGlobStar, abs) + if (inGlobStar && !ownProp(this.symlinks, abs)) + return this._readdirInGlobStar(abs, cb) + + if (ownProp(this.cache, abs)) { + var c = this.cache[abs] + if (!c || c === 'FILE') + return cb() + + if (Array.isArray(c)) + return cb(null, c) + } + + var self = this + fs.readdir(abs, readdirCb(this, abs, cb)) +} + +function readdirCb (self, abs, cb) { + return function (er, entries) { + if (er) + self._readdirError(abs, er, cb) + else + self._readdirEntries(abs, entries, cb) + } +} + +Glob.prototype._readdirEntries = function (abs, entries, cb) { + if (this.aborted) + return + + // if we haven't asked to stat everything, then just + // assume that everything in there exists, so we can avoid + // having to stat it a second time. + if (!this.mark && !this.stat) { + for (var i = 0; i < entries.length; i ++) { + var e = entries[i] + if (abs === '/') + e = abs + e + else + e = abs + '/' + e + this.cache[e] = true + } + } + + this.cache[abs] = entries + return cb(null, entries) +} + +Glob.prototype._readdirError = function (f, er, cb) { + if (this.aborted) + return + + // handle errors, and cache the information + switch (er.code) { + case 'ENOTSUP': // https://github.com/isaacs/node-glob/issues/205 + case 'ENOTDIR': // totally normal. means it *does* exist. + this.cache[this._makeAbs(f)] = 'FILE' + break + + case 'ENOENT': // not terribly unusual + case 'ELOOP': + case 'ENAMETOOLONG': + case 'UNKNOWN': + this.cache[this._makeAbs(f)] = false + break + + default: // some unusual error. Treat as failure. + this.cache[this._makeAbs(f)] = false + if (this.strict) { + this.emit('error', er) + // If the error is handled, then we abort + // if not, we threw out of here + this.abort() + } + if (!this.silent) + console.error('glob error', er) + break + } + + return cb() +} + +Glob.prototype._processGlobStar = function (prefix, read, abs, remain, index, inGlobStar, cb) { + var self = this + this._readdir(abs, inGlobStar, function (er, entries) { + self._processGlobStar2(prefix, read, abs, remain, index, inGlobStar, entries, cb) + }) +} + + +Glob.prototype._processGlobStar2 = function (prefix, read, abs, remain, index, inGlobStar, entries, cb) { + //console.error('pgs2', prefix, remain[0], entries) + + // no entries means not a dir, so it can never have matches + // foo.txt/** doesn't match foo.txt + if (!entries) + return cb() + + // test without the globstar, and with every child both below + // and replacing the globstar. + var remainWithoutGlobStar = remain.slice(1) + var gspref = prefix ? [ prefix ] : [] + var noGlobStar = gspref.concat(remainWithoutGlobStar) + + // the noGlobStar pattern exits the inGlobStar state + this._process(noGlobStar, index, false, cb) + + var isSym = this.symlinks[abs] + var len = entries.length + + // If it's a symlink, and we're in a globstar, then stop + if (isSym && inGlobStar) + return cb() + + for (var i = 0; i < len; i++) { + var e = entries[i] + if (e.charAt(0) === '.' && !this.dot) + continue + + // these two cases enter the inGlobStar state + var instead = gspref.concat(entries[i], remainWithoutGlobStar) + this._process(instead, index, true, cb) + + var below = gspref.concat(entries[i], remain) + this._process(below, index, true, cb) + } + + cb() +} + +Glob.prototype._processSimple = function (prefix, index, cb) { + // XXX review this. Shouldn't it be doing the mounting etc + // before doing stat? kinda weird? + var self = this + this._stat(prefix, function (er, exists) { + self._processSimple2(prefix, index, er, exists, cb) + }) +} +Glob.prototype._processSimple2 = function (prefix, index, er, exists, cb) { + + //console.error('ps2', prefix, exists) + + if (!this.matches[index]) + this.matches[index] = Object.create(null) + + // If it doesn't exist, then just mark the lack of results + if (!exists) + return cb() + + if (prefix && isAbsolute(prefix) && !this.nomount) { + var trail = /[\/\\]$/.test(prefix) + if (prefix.charAt(0) === '/') { + prefix = path.join(this.root, prefix) + } else { + prefix = path.resolve(this.root, prefix) + if (trail) + prefix += '/' + } + } + + if (process.platform === 'win32') + prefix = prefix.replace(/\\/g, '/') + + // Mark this as a match + this._emitMatch(index, prefix) + cb() +} + +// Returns either 'DIR', 'FILE', or false +Glob.prototype._stat = function (f, cb) { + var abs = this._makeAbs(f) + var needDir = f.slice(-1) === '/' + + if (f.length > this.maxLength) + return cb() + + if (!this.stat && ownProp(this.cache, abs)) { + var c = this.cache[abs] + + if (Array.isArray(c)) + c = 'DIR' + + // It exists, but maybe not how we need it + if (!needDir || c === 'DIR') + return cb(null, c) + + if (needDir && c === 'FILE') + return cb() + + // otherwise we have to stat, because maybe c=true + // if we know it exists, but not what it is. + } + + var exists + var stat = this.statCache[abs] + if (stat !== undefined) { + if (stat === false) + return cb(null, stat) + else { + var type = stat.isDirectory() ? 'DIR' : 'FILE' + if (needDir && type === 'FILE') + return cb() + else + return cb(null, type, stat) + } + } + + var self = this + var statcb = inflight('stat\0' + abs, lstatcb_) + if (statcb) + fs.lstat(abs, statcb) + + function lstatcb_ (er, lstat) { + if (lstat && lstat.isSymbolicLink()) { + // If it's a symlink, then treat it as the target, unless + // the target does not exist, then treat it as a file. + return fs.stat(abs, function (er, stat) { + if (er) + self._stat2(f, abs, null, lstat, cb) + else + self._stat2(f, abs, er, stat, cb) + }) + } else { + self._stat2(f, abs, er, lstat, cb) + } + } +} + +Glob.prototype._stat2 = function (f, abs, er, stat, cb) { + if (er) { + this.statCache[abs] = false + return cb() + } + + var needDir = f.slice(-1) === '/' + this.statCache[abs] = stat + + if (abs.slice(-1) === '/' && !stat.isDirectory()) + return cb(null, false, stat) + + var c = stat.isDirectory() ? 'DIR' : 'FILE' + this.cache[abs] = this.cache[abs] || c + + if (needDir && c !== 'DIR') + return cb() + + return cb(null, c, stat) +} diff --git a/node_modules/glob/package.json b/node_modules/glob/package.json new file mode 100644 index 0000000..4cadffb --- /dev/null +++ b/node_modules/glob/package.json @@ -0,0 +1,78 @@ +{ + "_args": [ + [ + "glob@6.0.4", + "/home/runner/work/jug-in.talks/jug-in.talks" + ] + ], + "_from": "glob@6.0.4", + "_id": "glob@6.0.4", + "_inBundle": false, + "_integrity": "sha1-DwiGD2oVUSey+t1PnOJLGqtuTSI=", + "_location": "/glob", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "glob@6.0.4", + "name": "glob", + "escapedName": "glob", + "rawSpec": "6.0.4", + "saveSpec": null, + "fetchSpec": "6.0.4" + }, + "_requiredBy": [ + "/opal-runtime" + ], + "_resolved": "https://registry.npmjs.org/glob/-/glob-6.0.4.tgz", + "_spec": "6.0.4", + "_where": "/home/runner/work/jug-in.talks/jug-in.talks", + "author": { + "name": "Isaac Z. Schlueter", + "email": "i@izs.me", + "url": "http://blog.izs.me/" + }, + "bugs": { + "url": "https://github.com/isaacs/node-glob/issues" + }, + "dependencies": { + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "2 || 3", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "description": "a little globber", + "devDependencies": { + "mkdirp": "0", + "rimraf": "^2.2.8", + "tap": "^5.0.0", + "tick": "0.0.6" + }, + "engines": { + "node": "*" + }, + "files": [ + "glob.js", + "sync.js", + "common.js" + ], + "homepage": "https://github.com/isaacs/node-glob#readme", + "license": "ISC", + "main": "glob.js", + "name": "glob", + "repository": { + "type": "git", + "url": "git://github.com/isaacs/node-glob.git" + }, + "scripts": { + "bench": "bash benchmark.sh", + "benchclean": "node benchclean.js", + "prepublish": "npm run benchclean", + "prof": "bash prof.sh && cat profile.txt", + "profclean": "rm -f v8.log profile.txt", + "test": "tap test/*.js --cov", + "test-regen": "npm run profclean && TEST_REGEN=1 node test/00-setup.js" + }, + "version": "6.0.4" +} diff --git a/node_modules/glob/sync.js b/node_modules/glob/sync.js new file mode 100644 index 0000000..09883d2 --- /dev/null +++ b/node_modules/glob/sync.js @@ -0,0 +1,460 @@ +module.exports = globSync +globSync.GlobSync = GlobSync + +var fs = require('fs') +var minimatch = require('minimatch') +var Minimatch = minimatch.Minimatch +var Glob = require('./glob.js').Glob +var util = require('util') +var path = require('path') +var assert = require('assert') +var isAbsolute = require('path-is-absolute') +var common = require('./common.js') +var alphasort = common.alphasort +var alphasorti = common.alphasorti +var setopts = common.setopts +var ownProp = common.ownProp +var childrenIgnored = common.childrenIgnored + +function globSync (pattern, options) { + if (typeof options === 'function' || arguments.length === 3) + throw new TypeError('callback provided to sync glob\n'+ + 'See: https://github.com/isaacs/node-glob/issues/167') + + return new GlobSync(pattern, options).found +} + +function GlobSync (pattern, options) { + if (!pattern) + throw new Error('must provide pattern') + + if (typeof options === 'function' || arguments.length === 3) + throw new TypeError('callback provided to sync glob\n'+ + 'See: https://github.com/isaacs/node-glob/issues/167') + + if (!(this instanceof GlobSync)) + return new GlobSync(pattern, options) + + setopts(this, pattern, options) + + if (this.noprocess) + return this + + var n = this.minimatch.set.length + this.matches = new Array(n) + for (var i = 0; i < n; i ++) { + this._process(this.minimatch.set[i], i, false) + } + this._finish() +} + +GlobSync.prototype._finish = function () { + assert(this instanceof GlobSync) + if (this.realpath) { + var self = this + this.matches.forEach(function (matchset, index) { + var set = self.matches[index] = Object.create(null) + for (var p in matchset) { + try { + p = self._makeAbs(p) + var real = fs.realpathSync(p, self.realpathCache) + set[real] = true + } catch (er) { + if (er.syscall === 'stat') + set[self._makeAbs(p)] = true + else + throw er + } + } + }) + } + common.finish(this) +} + + +GlobSync.prototype._process = function (pattern, index, inGlobStar) { + assert(this instanceof GlobSync) + + // Get the first [n] parts of pattern that are all strings. + var n = 0 + while (typeof pattern[n] === 'string') { + n ++ + } + // now n is the index of the first one that is *not* a string. + + // See if there's anything else + var prefix + switch (n) { + // if not, then this is rather simple + case pattern.length: + this._processSimple(pattern.join('/'), index) + return + + case 0: + // pattern *starts* with some non-trivial item. + // going to readdir(cwd), but not include the prefix in matches. + prefix = null + break + + default: + // pattern has some string bits in the front. + // whatever it starts with, whether that's 'absolute' like /foo/bar, + // or 'relative' like '../baz' + prefix = pattern.slice(0, n).join('/') + break + } + + var remain = pattern.slice(n) + + // get the list of entries. + var read + if (prefix === null) + read = '.' + else if (isAbsolute(prefix) || isAbsolute(pattern.join('/'))) { + if (!prefix || !isAbsolute(prefix)) + prefix = '/' + prefix + read = prefix + } else + read = prefix + + var abs = this._makeAbs(read) + + //if ignored, skip processing + if (childrenIgnored(this, read)) + return + + var isGlobStar = remain[0] === minimatch.GLOBSTAR + if (isGlobStar) + this._processGlobStar(prefix, read, abs, remain, index, inGlobStar) + else + this._processReaddir(prefix, read, abs, remain, index, inGlobStar) +} + + +GlobSync.prototype._processReaddir = function (prefix, read, abs, remain, index, inGlobStar) { + var entries = this._readdir(abs, inGlobStar) + + // if the abs isn't a dir, then nothing can match! + if (!entries) + return + + // It will only match dot entries if it starts with a dot, or if + // dot is set. Stuff like @(.foo|.bar) isn't allowed. + var pn = remain[0] + var negate = !!this.minimatch.negate + var rawGlob = pn._glob + var dotOk = this.dot || rawGlob.charAt(0) === '.' + + var matchedEntries = [] + for (var i = 0; i < entries.length; i++) { + var e = entries[i] + if (e.charAt(0) !== '.' || dotOk) { + var m + if (negate && !prefix) { + m = !e.match(pn) + } else { + m = e.match(pn) + } + if (m) + matchedEntries.push(e) + } + } + + var len = matchedEntries.length + // If there are no matched entries, then nothing matches. + if (len === 0) + return + + // if this is the last remaining pattern bit, then no need for + // an additional stat *unless* the user has specified mark or + // stat explicitly. We know they exist, since readdir returned + // them. + + if (remain.length === 1 && !this.mark && !this.stat) { + if (!this.matches[index]) + this.matches[index] = Object.create(null) + + for (var i = 0; i < len; i ++) { + var e = matchedEntries[i] + if (prefix) { + if (prefix.slice(-1) !== '/') + e = prefix + '/' + e + else + e = prefix + e + } + + if (e.charAt(0) === '/' && !this.nomount) { + e = path.join(this.root, e) + } + this.matches[index][e] = true + } + // This was the last one, and no stats were needed + return + } + + // now test all matched entries as stand-ins for that part + // of the pattern. + remain.shift() + for (var i = 0; i < len; i ++) { + var e = matchedEntries[i] + var newPattern + if (prefix) + newPattern = [prefix, e] + else + newPattern = [e] + this._process(newPattern.concat(remain), index, inGlobStar) + } +} + + +GlobSync.prototype._emitMatch = function (index, e) { + var abs = this._makeAbs(e) + if (this.mark) + e = this._mark(e) + + if (this.matches[index][e]) + return + + if (this.nodir) { + var c = this.cache[this._makeAbs(e)] + if (c === 'DIR' || Array.isArray(c)) + return + } + + this.matches[index][e] = true + if (this.stat) + this._stat(e) +} + + +GlobSync.prototype._readdirInGlobStar = function (abs) { + // follow all symlinked directories forever + // just proceed as if this is a non-globstar situation + if (this.follow) + return this._readdir(abs, false) + + var entries + var lstat + var stat + try { + lstat = fs.lstatSync(abs) + } catch (er) { + // lstat failed, doesn't exist + return null + } + + var isSym = lstat.isSymbolicLink() + this.symlinks[abs] = isSym + + // If it's not a symlink or a dir, then it's definitely a regular file. + // don't bother doing a readdir in that case. + if (!isSym && !lstat.isDirectory()) + this.cache[abs] = 'FILE' + else + entries = this._readdir(abs, false) + + return entries +} + +GlobSync.prototype._readdir = function (abs, inGlobStar) { + var entries + + if (inGlobStar && !ownProp(this.symlinks, abs)) + return this._readdirInGlobStar(abs) + + if (ownProp(this.cache, abs)) { + var c = this.cache[abs] + if (!c || c === 'FILE') + return null + + if (Array.isArray(c)) + return c + } + + try { + return this._readdirEntries(abs, fs.readdirSync(abs)) + } catch (er) { + this._readdirError(abs, er) + return null + } +} + +GlobSync.prototype._readdirEntries = function (abs, entries) { + // if we haven't asked to stat everything, then just + // assume that everything in there exists, so we can avoid + // having to stat it a second time. + if (!this.mark && !this.stat) { + for (var i = 0; i < entries.length; i ++) { + var e = entries[i] + if (abs === '/') + e = abs + e + else + e = abs + '/' + e + this.cache[e] = true + } + } + + this.cache[abs] = entries + + // mark and cache dir-ness + return entries +} + +GlobSync.prototype._readdirError = function (f, er) { + // handle errors, and cache the information + switch (er.code) { + case 'ENOTSUP': // https://github.com/isaacs/node-glob/issues/205 + case 'ENOTDIR': // totally normal. means it *does* exist. + this.cache[this._makeAbs(f)] = 'FILE' + break + + case 'ENOENT': // not terribly unusual + case 'ELOOP': + case 'ENAMETOOLONG': + case 'UNKNOWN': + this.cache[this._makeAbs(f)] = false + break + + default: // some unusual error. Treat as failure. + this.cache[this._makeAbs(f)] = false + if (this.strict) + throw er + if (!this.silent) + console.error('glob error', er) + break + } +} + +GlobSync.prototype._processGlobStar = function (prefix, read, abs, remain, index, inGlobStar) { + + var entries = this._readdir(abs, inGlobStar) + + // no entries means not a dir, so it can never have matches + // foo.txt/** doesn't match foo.txt + if (!entries) + return + + // test without the globstar, and with every child both below + // and replacing the globstar. + var remainWithoutGlobStar = remain.slice(1) + var gspref = prefix ? [ prefix ] : [] + var noGlobStar = gspref.concat(remainWithoutGlobStar) + + // the noGlobStar pattern exits the inGlobStar state + this._process(noGlobStar, index, false) + + var len = entries.length + var isSym = this.symlinks[abs] + + // If it's a symlink, and we're in a globstar, then stop + if (isSym && inGlobStar) + return + + for (var i = 0; i < len; i++) { + var e = entries[i] + if (e.charAt(0) === '.' && !this.dot) + continue + + // these two cases enter the inGlobStar state + var instead = gspref.concat(entries[i], remainWithoutGlobStar) + this._process(instead, index, true) + + var below = gspref.concat(entries[i], remain) + this._process(below, index, true) + } +} + +GlobSync.prototype._processSimple = function (prefix, index) { + // XXX review this. Shouldn't it be doing the mounting etc + // before doing stat? kinda weird? + var exists = this._stat(prefix) + + if (!this.matches[index]) + this.matches[index] = Object.create(null) + + // If it doesn't exist, then just mark the lack of results + if (!exists) + return + + if (prefix && isAbsolute(prefix) && !this.nomount) { + var trail = /[\/\\]$/.test(prefix) + if (prefix.charAt(0) === '/') { + prefix = path.join(this.root, prefix) + } else { + prefix = path.resolve(this.root, prefix) + if (trail) + prefix += '/' + } + } + + if (process.platform === 'win32') + prefix = prefix.replace(/\\/g, '/') + + // Mark this as a match + this.matches[index][prefix] = true +} + +// Returns either 'DIR', 'FILE', or false +GlobSync.prototype._stat = function (f) { + var abs = this._makeAbs(f) + var needDir = f.slice(-1) === '/' + + if (f.length > this.maxLength) + return false + + if (!this.stat && ownProp(this.cache, abs)) { + var c = this.cache[abs] + + if (Array.isArray(c)) + c = 'DIR' + + // It exists, but maybe not how we need it + if (!needDir || c === 'DIR') + return c + + if (needDir && c === 'FILE') + return false + + // otherwise we have to stat, because maybe c=true + // if we know it exists, but not what it is. + } + + var exists + var stat = this.statCache[abs] + if (!stat) { + var lstat + try { + lstat = fs.lstatSync(abs) + } catch (er) { + return false + } + + if (lstat.isSymbolicLink()) { + try { + stat = fs.statSync(abs) + } catch (er) { + stat = lstat + } + } else { + stat = lstat + } + } + + this.statCache[abs] = stat + + var c = stat.isDirectory() ? 'DIR' : 'FILE' + this.cache[abs] = this.cache[abs] || c + + if (needDir && c !== 'DIR') + return false + + return c +} + +GlobSync.prototype._mark = function (p) { + return common.mark(this, p) +} + +GlobSync.prototype._makeAbs = function (f) { + return common.makeAbs(this, f) +} diff --git a/node_modules/highlight.js/LICENSE b/node_modules/highlight.js/LICENSE new file mode 100644 index 0000000..2250cc7 --- /dev/null +++ b/node_modules/highlight.js/LICENSE @@ -0,0 +1,29 @@ +BSD 3-Clause License + +Copyright (c) 2006, Ivan Sagalaev. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +* Neither the name of the copyright holder nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/node_modules/highlight.js/README.md b/node_modules/highlight.js/README.md new file mode 100644 index 0000000..be891b0 --- /dev/null +++ b/node_modules/highlight.js/README.md @@ -0,0 +1,342 @@ +# Highlight.js + +[![latest version](https://badgen.net/npm/v/highlight.js?label=latest)](https://www.npmjs.com/package/highlight.js) +[![beta](https://badgen.net/npm/v/highlight.js/beta)](https://www.npmjs.com/package/highlight.js) +[![slack](https://badgen.net/badge/icon/slack?icon=slack&label&color=pink)](https://join.slack.com/t/highlightjs/shared_invite/zt-jatdlkw4-h3LdjU5rC23t7aQ6zqoxzw) +[![license](https://badgen.net/github/license/highlightjs/highlight.js?color=cyan)](https://github.com/highlightjs/highlight.js/blob/master/LICENSE) +[![install size](https://badgen.net/packagephobia/install/highlight.js?label=npm+install)](https://packagephobia.now.sh/result?p=highlight.js) +![minified](https://img.shields.io/github/size/highlightjs/cdn-release/build/highlight.min.js?label=minified) +[![NPM downloads weekly](https://badgen.net/npm/dw/highlight.js?label=npm+downloads&color=purple)](https://www.npmjs.com/package/highlight.js) +[![jsDelivr CDN downloads](https://badgen.net/jsdelivr/hits/gh/highlightjs/cdn-release?label=jsDelivr+CDN&color=purple)](https://www.jsdelivr.com/package/gh/highlightjs/cdn-release) +![dev deps](https://badgen.net/david/dev/highlightjs/highlight.js?label=dev+deps) +[![code quality](https://badgen.net/lgtm/grade/g/highlightjs/highlight.js/js)](https://lgtm.com/projects/g/highlightjs/highlight.js/?mode=list) + +[![build and CI status](https://badgen.net/github/checks/highlightjs/highlight.js?label=build)](https://github.com/highlightjs/highlight.js/actions?query=workflow%3A%22Node.js+CI%22) +[![open issues](https://badgen.net/github/open-issues/highlightjs/highlight.js?label=issues&labelColor=orange&color=c41)](https://github.com/highlightjs/highlight.js/issues) +[![help welcome issues](https://badgen.net/github/label-issues/highlightjs/highlight.js/help%20welcome/open?labelColor=393&color=6c6)](https://github.com/highlightjs/highlight.js/issues?q=is%3Aopen+is%3Aissue+label%3A%22help+welcome%22) +[![beginner friendly issues](https://badgen.net/github/label-issues/highlightjs/highlight.js/beginner%20friendly/open?labelColor=669&color=99c)](https://github.com/highlightjs/highlight.js/issues?q=is%3Aopen+is%3Aissue+label%3A%22beginner+friendly%22) +[![vulnerabilities](https://badgen.net/snyk/highlightjs/highlight.js)](https://snyk.io/test/github/highlightjs/highlight.js?targetFile=package.json) + + + + + + + + +Highlight.js is a syntax highlighter written in JavaScript. It works in +the browser as well as on the server. It works with pretty much any +markup, doesn’t depend on any framework, and has automatic language +detection. + +#### Upgrading to Version 10 + +Version 10 is one of the biggest releases in quite some time. If you're +upgrading from version 9, there are some breaking changes and things you may +want to double check first. + +Please read [VERSION_10_UPGRADE.md](https://github.com/highlightjs/highlight.js/blob/master/VERSION_10_UPGRADE.md) for high-level summary of breaking changes and any actions you may need to take. See [VERSION_10_BREAKING_CHANGES.md](https://github.com/highlightjs/highlight.js/blob/master/VERSION_10_BREAKING_CHANGES.md) for a more detailed list and [CHANGES.md](https://github.com/highlightjs/highlight.js/blob/master/CHANGES.md) to learn what else is new. + +##### Support for older versions + +Please see [SECURITY.md](https://github.com/highlightjs/highlight.js/blob/master/SECURITY.md) for support information. + +## Getting Started + +The bare minimum for using highlight.js on a web page is linking to the +library along with one of the styles and calling [`initHighlightingOnLoad`][1]: + +```html + + + +``` + +This will find and highlight code inside of `
    ` tags; it tries
    +to detect the language automatically. If automatic detection doesn’t
    +work for you, you can specify the language in the `class` attribute:
    +
    +```html
    +
    ...
    +``` + +Classes may also be prefixed with either `language-` or `lang-`. + +```html +
    ...
    +``` + +### Plaintext and Disabling Highlighting + +To style arbitrary text like code, but without any highlighting, use the +`plaintext` class: + +```html +
    ...
    +``` + +To disable highlighting of a tag completely, use the `nohighlight` class: + +```html +
    ...
    +``` + +### Supported Languages + +Highlight.js supports over 180 different languages in the core library. There are also 3rd party +language plugins available for additional languages. You can find the full list of supported languages +in [SUPPORTED_LANGUAGES.md][9]. + +## Custom Initialization + +When you need a bit more control over the initialization of +highlight.js, you can use the [`highlightBlock`][3] and [`configure`][4] +functions. This allows you to control *what* to highlight and *when*. + +Here’s an equivalent way to calling [`initHighlightingOnLoad`][1] using +vanilla JS: + +```js +document.addEventListener('DOMContentLoaded', (event) => { + document.querySelectorAll('pre code').forEach((block) => { + hljs.highlightBlock(block); + }); +}); +``` + +You can use any tags instead of `
    ` to mark up your code. If
    +you don't use a container that preserves line breaks you will need to
    +configure highlight.js to use the `
    ` tag: + +```js +hljs.configure({useBR: true}); + +document.querySelectorAll('div.code').forEach((block) => { + hljs.highlightBlock(block); +}); +``` + +For other options refer to the documentation for [`configure`][4]. + + +## Using with Vue.js + +Simply register the plugin with Vue: + +```js +Vue.use(hljs.vuePlugin); +``` + +And you'll be provided with a `highlightjs` component for use +in your templates: + +```html +
    + + + + +
    +``` + +## Web Workers + +You can run highlighting inside a web worker to avoid freezing the browser +window while dealing with very big chunks of code. + +In your main script: + +```js +addEventListener('load', () => { + const code = document.querySelector('#code'); + const worker = new Worker('worker.js'); + worker.onmessage = (event) => { code.innerHTML = event.data; } + worker.postMessage(code.textContent); +}); +``` + +In worker.js: + +```js +onmessage = (event) => { + importScripts('/highlight.min.js'); + const result = self.hljs.highlightAuto(event.data); + postMessage(result.value); +}; +``` + +## Node.js + +You can use highlight.js with node to highlight content before sending it to the browser. +Make sure to use the `.value` property to get the formatted html. +For more info about the returned object refer to the api docs https://highlightjs.readthedocs.io/en/latest/api.html + + +```js +// require the highlight.js library, including all languages +const hljs = require('./highlight.js'); +const highlightedCode = hljs.highlightAuto('Hello World!').value +``` + +Or for a smaller footprint... load just the languages you need. + +```js +const hljs = require("highlight.js/lib/core"); // require only the core library +// separately require languages +hljs.registerLanguage('xml', require('highlight.js/lib/languages/xml')); + +const highlightedCode = hljs.highlight('xml', 'Hello World!').value +``` + + +## ES6 Modules + +First, you'll likely install via `npm` or `yarn` -- see [Getting the Library](#getting-the-library) below. + +In your application: + +```js +import hljs from 'highlight.js'; +``` + +The default import imports all languages. Therefore it is likely to be more efficient to import only the library and the languages you need: + +```js +import hljs from 'highlight.js/lib/core'; +import javascript from 'highlight.js/lib/languages/javascript'; +hljs.registerLanguage('javascript', javascript); +``` + +To set the syntax highlighting style, if your build tool processes CSS from your JavaScript entry point, you can also import the stylesheet directly as modules: + +```js +import hljs from 'highlight.js/lib/core'; +import 'highlight.js/styles/github.css'; +``` + + +## Getting the Library + +You can get highlight.js as a hosted, or custom-build, browser script or +as a server module. Right out of the box the browser script supports +both AMD and CommonJS, so if you wish you can use RequireJS or +Browserify without having to build from source. The server module also +works perfectly fine with Browserify, but there is the option to use a +build specific to browsers rather than something meant for a server. + + +**Do not link to GitHub directly.** The library is not supposed to work straight +from the source, it requires building. If none of the pre-packaged options +work for you refer to the [building documentation][6]. + +**On Almond.** You need to use the optimizer to give the module a name. For +example: + +```bash +r.js -o name=hljs paths.hljs=/path/to/highlight out=highlight.js +``` + +### CDN Hosted + +A prebuilt version of highlight.js bundled with many common languages is hosted by the following CDNs: + +**cdnjs** ([link](https://cdnjs.com/libraries/highlight.js)) + +```html + + + + +``` + +**jsdelivr** ([link](https://www.jsdelivr.com/package/gh/highlightjs/cdn-release)) + +```html + + +``` + +**unpkg** ([link](https://unpkg.com/browse/@highlightjs/cdn-assets/)) + +```html + + +``` + +**Note:** *The CDN-hosted `highlight.min.js` package doesn't bundle every language.* It would be +very large. You can find our list "common" languages that we bundle by default on our [download page][5]. + +### Self Hosting + +The [download page][5] can quickly generate a custom bundle including only the languages you need. + +Alternatively, you can build a browser package from [source](#source): + +``` +node tools/build.js -t browser :common +``` + +See our [building documentation][6] for more information. + +**Note:** Building from source should always result in the smallest size builds. The website download page is optimized for speed, not size. + + +#### Prebuilt CDN assets + +You can also download and self-host the same assets we serve up via our own CDNs. We publish those builds to the [cdn-release](https://github.com/highlightjs/cdn-release) GitHub repository. You can easily pull individual files off the CDN endpoints with `curl`, etc; if say you only needed `highlight.min.js` and a single CSS file. + +There is also an npm package [@highlightjs/cdn-assets](https://www.npmjs.com/package/@highlightjs/cdn-assets) if pulling the assets in via `npm` or `yarn` would be easier for your build process. + + +### NPM / Node.js server module + +Highlight.js can also be used on the server. The package with all supported languages can be installed from NPM or Yarn: + +```bash +npm install highlight.js +# or +yarn add highlight.js +``` + +Alternatively, you can build it from [source](#source): + +```bash +node tools/build.js -t node +``` + +See our [building documentation][6] for more information. + + +### Source + +[Current source][10] is always available on GitHub. + + +## License + +Highlight.js is released under the BSD License. See [LICENSE][7] file +for details. + + +## Links + +The official site for the library is at . + +Further in-depth documentation for the API and other topics is at +. + +Authors and contributors are listed in the [AUTHORS.txt][8] file. + +[1]: http://highlightjs.readthedocs.io/en/latest/api.html#inithighlightingonload +[2]: http://highlightjs.readthedocs.io/en/latest/css-classes-reference.html +[3]: http://highlightjs.readthedocs.io/en/latest/api.html#highlightblock-block +[4]: http://highlightjs.readthedocs.io/en/latest/api.html#configure-options +[5]: https://highlightjs.org/download/ +[6]: http://highlightjs.readthedocs.io/en/latest/building-testing.html +[7]: https://github.com/highlightjs/highlight.js/blob/master/LICENSE +[8]: https://github.com/highlightjs/highlight.js/blob/master/AUTHORS.txt +[9]: https://github.com/highlightjs/highlight.js/blob/master/SUPPORTED_LANGUAGES.md +[10]: https://github.com/highlightjs/ diff --git a/node_modules/highlight.js/lib/core.js b/node_modules/highlight.js/lib/core.js new file mode 100644 index 0000000..90c2b50 --- /dev/null +++ b/node_modules/highlight.js/lib/core.js @@ -0,0 +1,2256 @@ +function deepFreeze(obj) { + if (obj instanceof Map) { + obj.clear = obj.delete = obj.set = function () { + throw new Error('map is read-only'); + }; + } else if (obj instanceof Set) { + obj.add = obj.clear = obj.delete = function () { + throw new Error('set is read-only'); + }; + } + + // Freeze self + Object.freeze(obj); + + Object.getOwnPropertyNames(obj).forEach(function (name) { + var prop = obj[name]; + + // Freeze prop if it is an object + if (typeof prop == 'object' && !Object.isFrozen(prop)) { + deepFreeze(prop); + } + }); + + return obj; +} + +var deepFreezeEs6 = deepFreeze; +var _default = deepFreeze; +deepFreezeEs6.default = _default; + +class Response { + /** + * @param {CompiledMode} mode + */ + constructor(mode) { + // eslint-disable-next-line no-undefined + if (mode.data === undefined) mode.data = {}; + + this.data = mode.data; + } + + ignoreMatch() { + this.ignore = true; + } +} + +/** + * @param {string} value + * @returns {string} + */ +function escapeHTML(value) { + return value + .replace(/&/g, '&') + .replace(//g, '>') + .replace(/"/g, '"') + .replace(/'/g, '''); +} + +/** + * performs a shallow merge of multiple objects into one + * + * @template T + * @param {T} original + * @param {Record[]} objects + * @returns {T} a single new object + */ +function inherit(original, ...objects) { + /** @type Record */ + const result = Object.create(null); + + for (const key in original) { + result[key] = original[key]; + } + objects.forEach(function(obj) { + for (const key in obj) { + result[key] = obj[key]; + } + }); + return /** @type {T} */ (result); +} + +/* Stream merging */ + +/** + * @typedef Event + * @property {'start'|'stop'} event + * @property {number} offset + * @property {Node} node + */ + +/** + * @param {Node} node + */ +function tag(node) { + return node.nodeName.toLowerCase(); +} + +/** + * @param {Node} node + */ +function nodeStream(node) { + /** @type Event[] */ + const result = []; + (function _nodeStream(node, offset) { + for (let child = node.firstChild; child; child = child.nextSibling) { + if (child.nodeType === 3) { + offset += child.nodeValue.length; + } else if (child.nodeType === 1) { + result.push({ + event: 'start', + offset: offset, + node: child + }); + offset = _nodeStream(child, offset); + // Prevent void elements from having an end tag that would actually + // double them in the output. There are more void elements in HTML + // but we list only those realistically expected in code display. + if (!tag(child).match(/br|hr|img|input/)) { + result.push({ + event: 'stop', + offset: offset, + node: child + }); + } + } + } + return offset; + })(node, 0); + return result; +} + +/** + * @param {any} original - the original stream + * @param {any} highlighted - stream of the highlighted source + * @param {string} value - the original source itself + */ +function mergeStreams(original, highlighted, value) { + let processed = 0; + let result = ''; + const nodeStack = []; + + function selectStream() { + if (!original.length || !highlighted.length) { + return original.length ? original : highlighted; + } + if (original[0].offset !== highlighted[0].offset) { + return (original[0].offset < highlighted[0].offset) ? original : highlighted; + } + + /* + To avoid starting the stream just before it should stop the order is + ensured that original always starts first and closes last: + + if (event1 == 'start' && event2 == 'start') + return original; + if (event1 == 'start' && event2 == 'stop') + return highlighted; + if (event1 == 'stop' && event2 == 'start') + return original; + if (event1 == 'stop' && event2 == 'stop') + return highlighted; + + ... which is collapsed to: + */ + return highlighted[0].event === 'start' ? original : highlighted; + } + + /** + * @param {Node} node + */ + function open(node) { + /** @param {Attr} attr */ + function attributeString(attr) { + return ' ' + attr.nodeName + '="' + escapeHTML(attr.value) + '"'; + } + // @ts-ignore + result += '<' + tag(node) + [].map.call(node.attributes, attributeString).join('') + '>'; + } + + /** + * @param {Node} node + */ + function close(node) { + result += ''; + } + + /** + * @param {Event} event + */ + function render(event) { + (event.event === 'start' ? open : close)(event.node); + } + + while (original.length || highlighted.length) { + let stream = selectStream(); + result += escapeHTML(value.substring(processed, stream[0].offset)); + processed = stream[0].offset; + if (stream === original) { + /* + On any opening or closing tag of the original markup we first close + the entire highlighted node stack, then render the original tag along + with all the following original tags at the same offset and then + reopen all the tags on the highlighted stack. + */ + nodeStack.reverse().forEach(close); + do { + render(stream.splice(0, 1)[0]); + stream = selectStream(); + } while (stream === original && stream.length && stream[0].offset === processed); + nodeStack.reverse().forEach(open); + } else { + if (stream[0].event === 'start') { + nodeStack.push(stream[0].node); + } else { + nodeStack.pop(); + } + render(stream.splice(0, 1)[0]); + } + } + return result + escapeHTML(value.substr(processed)); +} + +var utils = /*#__PURE__*/Object.freeze({ + __proto__: null, + escapeHTML: escapeHTML, + inherit: inherit, + nodeStream: nodeStream, + mergeStreams: mergeStreams +}); + +/** + * @typedef {object} Renderer + * @property {(text: string) => void} addText + * @property {(node: Node) => void} openNode + * @property {(node: Node) => void} closeNode + * @property {() => string} value + */ + +/** @typedef {{kind?: string, sublanguage?: boolean}} Node */ +/** @typedef {{walk: (r: Renderer) => void}} Tree */ +/** */ + +const SPAN_CLOSE = ''; + +/** + * Determines if a node needs to be wrapped in + * + * @param {Node} node */ +const emitsWrappingTags = (node) => { + return !!node.kind; +}; + +/** @type {Renderer} */ +class HTMLRenderer { + /** + * Creates a new HTMLRenderer + * + * @param {Tree} parseTree - the parse tree (must support `walk` API) + * @param {{classPrefix: string}} options + */ + constructor(parseTree, options) { + this.buffer = ""; + this.classPrefix = options.classPrefix; + parseTree.walk(this); + } + + /** + * Adds texts to the output stream + * + * @param {string} text */ + addText(text) { + this.buffer += escapeHTML(text); + } + + /** + * Adds a node open to the output stream (if needed) + * + * @param {Node} node */ + openNode(node) { + if (!emitsWrappingTags(node)) return; + + let className = node.kind; + if (!node.sublanguage) { + className = `${this.classPrefix}${className}`; + } + this.span(className); + } + + /** + * Adds a node close to the output stream (if needed) + * + * @param {Node} node */ + closeNode(node) { + if (!emitsWrappingTags(node)) return; + + this.buffer += SPAN_CLOSE; + } + + /** + * returns the accumulated buffer + */ + value() { + return this.buffer; + } + + // helpers + + /** + * Builds a span element + * + * @param {string} className */ + span(className) { + this.buffer += ``; + } +} + +/** @typedef {{kind?: string, sublanguage?: boolean, children: Node[]} | string} Node */ +/** @typedef {{kind?: string, sublanguage?: boolean, children: Node[]} } DataNode */ +/** */ + +class TokenTree { + constructor() { + /** @type DataNode */ + this.rootNode = { children: [] }; + this.stack = [this.rootNode]; + } + + get top() { + return this.stack[this.stack.length - 1]; + } + + get root() { return this.rootNode; } + + /** @param {Node} node */ + add(node) { + this.top.children.push(node); + } + + /** @param {string} kind */ + openNode(kind) { + /** @type Node */ + const node = { kind, children: [] }; + this.add(node); + this.stack.push(node); + } + + closeNode() { + if (this.stack.length > 1) { + return this.stack.pop(); + } + // eslint-disable-next-line no-undefined + return undefined; + } + + closeAllNodes() { + while (this.closeNode()); + } + + toJSON() { + return JSON.stringify(this.rootNode, null, 4); + } + + /** + * @typedef { import("./html_renderer").Renderer } Renderer + * @param {Renderer} builder + */ + walk(builder) { + // this does not + return this.constructor._walk(builder, this.rootNode); + // this works + // return TokenTree._walk(builder, this.rootNode); + } + + /** + * @param {Renderer} builder + * @param {Node} node + */ + static _walk(builder, node) { + if (typeof node === "string") { + builder.addText(node); + } else if (node.children) { + builder.openNode(node); + node.children.forEach((child) => this._walk(builder, child)); + builder.closeNode(node); + } + return builder; + } + + /** + * @param {Node} node + */ + static _collapse(node) { + if (typeof node === "string") return; + if (!node.children) return; + + if (node.children.every(el => typeof el === "string")) { + // node.text = node.children.join(""); + // delete node.children; + node.children = [node.children.join("")]; + } else { + node.children.forEach((child) => { + TokenTree._collapse(child); + }); + } + } +} + +/** + Currently this is all private API, but this is the minimal API necessary + that an Emitter must implement to fully support the parser. + + Minimal interface: + + - addKeyword(text, kind) + - addText(text) + - addSublanguage(emitter, subLanguageName) + - finalize() + - openNode(kind) + - closeNode() + - closeAllNodes() + - toHTML() + +*/ + +/** + * @implements {Emitter} + */ +class TokenTreeEmitter extends TokenTree { + /** + * @param {*} options + */ + constructor(options) { + super(); + this.options = options; + } + + /** + * @param {string} text + * @param {string} kind + */ + addKeyword(text, kind) { + if (text === "") { return; } + + this.openNode(kind); + this.addText(text); + this.closeNode(); + } + + /** + * @param {string} text + */ + addText(text) { + if (text === "") { return; } + + this.add(text); + } + + /** + * @param {Emitter & {root: DataNode}} emitter + * @param {string} name + */ + addSublanguage(emitter, name) { + /** @type DataNode */ + const node = emitter.root; + node.kind = name; + node.sublanguage = true; + this.add(node); + } + + toHTML() { + const renderer = new HTMLRenderer(this, this.options); + return renderer.value(); + } + + finalize() { + return true; + } +} + +/** + * @param {string} value + * @returns {RegExp} + * */ +function escape(value) { + return new RegExp(value.replace(/[-/\\^$*+?.()|[\]{}]/g, '\\$&'), 'm'); +} + +/** + * @param {RegExp | string } re + * @returns {string} + */ +function source(re) { + if (!re) return null; + if (typeof re === "string") return re; + + return re.source; +} + +/** + * @param {...(RegExp | string) } args + * @returns {string} + */ +function concat(...args) { + const joined = args.map((x) => source(x)).join(""); + return joined; +} + +/** + * @param {RegExp} re + * @returns {number} + */ +function countMatchGroups(re) { + return (new RegExp(re.toString() + '|')).exec('').length - 1; +} + +/** + * Does lexeme start with a regular expression match at the beginning + * @param {RegExp} re + * @param {string} lexeme + */ +function startsWith(re, lexeme) { + const match = re && re.exec(lexeme); + return match && match.index === 0; +} + +// join logically computes regexps.join(separator), but fixes the +// backreferences so they continue to match. +// it also places each individual regular expression into it's own +// match group, keeping track of the sequencing of those match groups +// is currently an exercise for the caller. :-) +/** + * @param {(string | RegExp)[]} regexps + * @param {string} separator + * @returns {string} + */ +function join(regexps, separator = "|") { + // backreferenceRe matches an open parenthesis or backreference. To avoid + // an incorrect parse, it additionally matches the following: + // - [...] elements, where the meaning of parentheses and escapes change + // - other escape sequences, so we do not misparse escape sequences as + // interesting elements + // - non-matching or lookahead parentheses, which do not capture. These + // follow the '(' with a '?'. + const backreferenceRe = /\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./; + let numCaptures = 0; + let ret = ''; + for (let i = 0; i < regexps.length; i++) { + numCaptures += 1; + const offset = numCaptures; + let re = source(regexps[i]); + if (i > 0) { + ret += separator; + } + ret += "("; + while (re.length > 0) { + const match = backreferenceRe.exec(re); + if (match == null) { + ret += re; + break; + } + ret += re.substring(0, match.index); + re = re.substring(match.index + match[0].length); + if (match[0][0] === '\\' && match[1]) { + // Adjust the backreference. + ret += '\\' + String(Number(match[1]) + offset); + } else { + ret += match[0]; + if (match[0] === '(') { + numCaptures++; + } + } + } + ret += ")"; + } + return ret; +} + +// Common regexps +const IDENT_RE = '[a-zA-Z]\\w*'; +const UNDERSCORE_IDENT_RE = '[a-zA-Z_]\\w*'; +const NUMBER_RE = '\\b\\d+(\\.\\d+)?'; +const C_NUMBER_RE = '(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)'; // 0x..., 0..., decimal, float +const BINARY_NUMBER_RE = '\\b(0b[01]+)'; // 0b... +const RE_STARTERS_RE = '!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~'; + +/** +* @param { Partial & {binary?: string | RegExp} } opts +*/ +const SHEBANG = (opts = {}) => { + const beginShebang = /^#![ ]*\//; + if (opts.binary) { + opts.begin = concat( + beginShebang, + /.*\b/, + opts.binary, + /\b.*/); + } + return inherit({ + className: 'meta', + begin: beginShebang, + end: /$/, + relevance: 0, + /** @type {ModeCallback} */ + "on:begin": (m, resp) => { + if (m.index !== 0) resp.ignoreMatch(); + } + }, opts); +}; + +// Common modes +const BACKSLASH_ESCAPE = { + begin: '\\\\[\\s\\S]', relevance: 0 +}; +const APOS_STRING_MODE = { + className: 'string', + begin: '\'', + end: '\'', + illegal: '\\n', + contains: [BACKSLASH_ESCAPE] +}; +const QUOTE_STRING_MODE = { + className: 'string', + begin: '"', + end: '"', + illegal: '\\n', + contains: [BACKSLASH_ESCAPE] +}; +const PHRASAL_WORDS_MODE = { + begin: /\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/ +}; +/** + * Creates a comment mode + * + * @param {string | RegExp} begin + * @param {string | RegExp} end + * @param {Mode | {}} [modeOptions] + * @returns {Partial} + */ +const COMMENT = function(begin, end, modeOptions = {}) { + const mode = inherit( + { + className: 'comment', + begin, + end, + contains: [] + }, + modeOptions + ); + mode.contains.push(PHRASAL_WORDS_MODE); + mode.contains.push({ + className: 'doctag', + begin: '(?:TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):', + relevance: 0 + }); + return mode; +}; +const C_LINE_COMMENT_MODE = COMMENT('//', '$'); +const C_BLOCK_COMMENT_MODE = COMMENT('/\\*', '\\*/'); +const HASH_COMMENT_MODE = COMMENT('#', '$'); +const NUMBER_MODE = { + className: 'number', + begin: NUMBER_RE, + relevance: 0 +}; +const C_NUMBER_MODE = { + className: 'number', + begin: C_NUMBER_RE, + relevance: 0 +}; +const BINARY_NUMBER_MODE = { + className: 'number', + begin: BINARY_NUMBER_RE, + relevance: 0 +}; +const CSS_NUMBER_MODE = { + className: 'number', + begin: NUMBER_RE + '(' + + '%|em|ex|ch|rem' + + '|vw|vh|vmin|vmax' + + '|cm|mm|in|pt|pc|px' + + '|deg|grad|rad|turn' + + '|s|ms' + + '|Hz|kHz' + + '|dpi|dpcm|dppx' + + ')?', + relevance: 0 +}; +const REGEXP_MODE = { + // this outer rule makes sure we actually have a WHOLE regex and not simply + // an expression such as: + // + // 3 / something + // + // (which will then blow up when regex's `illegal` sees the newline) + begin: /(?=\/[^/\n]*\/)/, + contains: [{ + className: 'regexp', + begin: /\//, + end: /\/[gimuy]*/, + illegal: /\n/, + contains: [ + BACKSLASH_ESCAPE, + { + begin: /\[/, + end: /\]/, + relevance: 0, + contains: [BACKSLASH_ESCAPE] + } + ] + }] +}; +const TITLE_MODE = { + className: 'title', + begin: IDENT_RE, + relevance: 0 +}; +const UNDERSCORE_TITLE_MODE = { + className: 'title', + begin: UNDERSCORE_IDENT_RE, + relevance: 0 +}; +const METHOD_GUARD = { + // excludes method names from keyword processing + begin: '\\.\\s*' + UNDERSCORE_IDENT_RE, + relevance: 0 +}; + +/** + * Adds end same as begin mechanics to a mode + * + * Your mode must include at least a single () match group as that first match + * group is what is used for comparison + * @param {Partial} mode + */ +const END_SAME_AS_BEGIN = function(mode) { + return Object.assign(mode, + { + /** @type {ModeCallback} */ + 'on:begin': (m, resp) => { resp.data._beginMatch = m[1]; }, + /** @type {ModeCallback} */ + 'on:end': (m, resp) => { if (resp.data._beginMatch !== m[1]) resp.ignoreMatch(); } + }); +}; + +var MODES = /*#__PURE__*/Object.freeze({ + __proto__: null, + IDENT_RE: IDENT_RE, + UNDERSCORE_IDENT_RE: UNDERSCORE_IDENT_RE, + NUMBER_RE: NUMBER_RE, + C_NUMBER_RE: C_NUMBER_RE, + BINARY_NUMBER_RE: BINARY_NUMBER_RE, + RE_STARTERS_RE: RE_STARTERS_RE, + SHEBANG: SHEBANG, + BACKSLASH_ESCAPE: BACKSLASH_ESCAPE, + APOS_STRING_MODE: APOS_STRING_MODE, + QUOTE_STRING_MODE: QUOTE_STRING_MODE, + PHRASAL_WORDS_MODE: PHRASAL_WORDS_MODE, + COMMENT: COMMENT, + C_LINE_COMMENT_MODE: C_LINE_COMMENT_MODE, + C_BLOCK_COMMENT_MODE: C_BLOCK_COMMENT_MODE, + HASH_COMMENT_MODE: HASH_COMMENT_MODE, + NUMBER_MODE: NUMBER_MODE, + C_NUMBER_MODE: C_NUMBER_MODE, + BINARY_NUMBER_MODE: BINARY_NUMBER_MODE, + CSS_NUMBER_MODE: CSS_NUMBER_MODE, + REGEXP_MODE: REGEXP_MODE, + TITLE_MODE: TITLE_MODE, + UNDERSCORE_TITLE_MODE: UNDERSCORE_TITLE_MODE, + METHOD_GUARD: METHOD_GUARD, + END_SAME_AS_BEGIN: END_SAME_AS_BEGIN +}); + +// keywords that should have no default relevance value +const COMMON_KEYWORDS = [ + 'of', + 'and', + 'for', + 'in', + 'not', + 'or', + 'if', + 'then', + 'parent', // common variable name + 'list', // common variable name + 'value' // common variable name +]; + +// compilation + +/** + * Compiles a language definition result + * + * Given the raw result of a language definition (Language), compiles this so + * that it is ready for highlighting code. + * @param {Language} language + * @returns {CompiledLanguage} + */ +function compileLanguage(language) { + /** + * Builds a regex with the case sensativility of the current language + * + * @param {RegExp | string} value + * @param {boolean} [global] + */ + function langRe(value, global) { + return new RegExp( + source(value), + 'm' + (language.case_insensitive ? 'i' : '') + (global ? 'g' : '') + ); + } + + /** + Stores multiple regular expressions and allows you to quickly search for + them all in a string simultaneously - returning the first match. It does + this by creating a huge (a|b|c) regex - each individual item wrapped with () + and joined by `|` - using match groups to track position. When a match is + found checking which position in the array has content allows us to figure + out which of the original regexes / match groups triggered the match. + + The match object itself (the result of `Regex.exec`) is returned but also + enhanced by merging in any meta-data that was registered with the regex. + This is how we keep track of which mode matched, and what type of rule + (`illegal`, `begin`, end, etc). + */ + class MultiRegex { + constructor() { + this.matchIndexes = {}; + // @ts-ignore + this.regexes = []; + this.matchAt = 1; + this.position = 0; + } + + // @ts-ignore + addRule(re, opts) { + opts.position = this.position++; + // @ts-ignore + this.matchIndexes[this.matchAt] = opts; + this.regexes.push([opts, re]); + this.matchAt += countMatchGroups(re) + 1; + } + + compile() { + if (this.regexes.length === 0) { + // avoids the need to check length every time exec is called + // @ts-ignore + this.exec = () => null; + } + const terminators = this.regexes.map(el => el[1]); + this.matcherRe = langRe(join(terminators), true); + this.lastIndex = 0; + } + + /** @param {string} s */ + exec(s) { + this.matcherRe.lastIndex = this.lastIndex; + const match = this.matcherRe.exec(s); + if (!match) { return null; } + + // eslint-disable-next-line no-undefined + const i = match.findIndex((el, i) => i > 0 && el !== undefined); + // @ts-ignore + const matchData = this.matchIndexes[i]; + // trim off any earlier non-relevant match groups (ie, the other regex + // match groups that make up the multi-matcher) + match.splice(0, i); + + return Object.assign(match, matchData); + } + } + + /* + Created to solve the key deficiently with MultiRegex - there is no way to + test for multiple matches at a single location. Why would we need to do + that? In the future a more dynamic engine will allow certain matches to be + ignored. An example: if we matched say the 3rd regex in a large group but + decided to ignore it - we'd need to started testing again at the 4th + regex... but MultiRegex itself gives us no real way to do that. + + So what this class creates MultiRegexs on the fly for whatever search + position they are needed. + + NOTE: These additional MultiRegex objects are created dynamically. For most + grammars most of the time we will never actually need anything more than the + first MultiRegex - so this shouldn't have too much overhead. + + Say this is our search group, and we match regex3, but wish to ignore it. + + regex1 | regex2 | regex3 | regex4 | regex5 ' ie, startAt = 0 + + What we need is a new MultiRegex that only includes the remaining + possibilities: + + regex4 | regex5 ' ie, startAt = 3 + + This class wraps all that complexity up in a simple API... `startAt` decides + where in the array of expressions to start doing the matching. It + auto-increments, so if a match is found at position 2, then startAt will be + set to 3. If the end is reached startAt will return to 0. + + MOST of the time the parser will be setting startAt manually to 0. + */ + class ResumableMultiRegex { + constructor() { + // @ts-ignore + this.rules = []; + // @ts-ignore + this.multiRegexes = []; + this.count = 0; + + this.lastIndex = 0; + this.regexIndex = 0; + } + + // @ts-ignore + getMatcher(index) { + if (this.multiRegexes[index]) return this.multiRegexes[index]; + + const matcher = new MultiRegex(); + this.rules.slice(index).forEach(([re, opts]) => matcher.addRule(re, opts)); + matcher.compile(); + this.multiRegexes[index] = matcher; + return matcher; + } + + resumingScanAtSamePosition() { + return this.regexIndex !== 0; + } + + considerAll() { + this.regexIndex = 0; + } + + // @ts-ignore + addRule(re, opts) { + this.rules.push([re, opts]); + if (opts.type === "begin") this.count++; + } + + /** @param {string} s */ + exec(s) { + const m = this.getMatcher(this.regexIndex); + m.lastIndex = this.lastIndex; + let result = m.exec(s); + + // The following is because we have no easy way to say "resume scanning at the + // existing position but also skip the current rule ONLY". What happens is + // all prior rules are also skipped which can result in matching the wrong + // thing. Example of matching "booger": + + // our matcher is [string, "booger", number] + // + // ....booger.... + + // if "booger" is ignored then we'd really need a regex to scan from the + // SAME position for only: [string, number] but ignoring "booger" (if it + // was the first match), a simple resume would scan ahead who knows how + // far looking only for "number", ignoring potential string matches (or + // future "booger" matches that might be valid.) + + // So what we do: We execute two matchers, one resuming at the same + // position, but the second full matcher starting at the position after: + + // /--- resume first regex match here (for [number]) + // |/---- full match here for [string, "booger", number] + // vv + // ....booger.... + + // Which ever results in a match first is then used. So this 3-4 step + // process essentially allows us to say "match at this position, excluding + // a prior rule that was ignored". + // + // 1. Match "booger" first, ignore. Also proves that [string] does non match. + // 2. Resume matching for [number] + // 3. Match at index + 1 for [string, "booger", number] + // 4. If #2 and #3 result in matches, which came first? + if (this.resumingScanAtSamePosition()) { + if (result && result.index === this.lastIndex) ; else { // use the second matcher result + const m2 = this.getMatcher(0); + m2.lastIndex = this.lastIndex + 1; + result = m2.exec(s); + } + } + + if (result) { + this.regexIndex += result.position + 1; + if (this.regexIndex === this.count) { + // wrap-around to considering all matches again + this.considerAll(); + } + } + + return result; + } + } + + /** + * Given a mode, builds a huge ResumableMultiRegex that can be used to walk + * the content and find matches. + * + * @param {CompiledMode} mode + * @returns {ResumableMultiRegex} + */ + function buildModeRegex(mode) { + const mm = new ResumableMultiRegex(); + + mode.contains.forEach(term => mm.addRule(term.begin, { rule: term, type: "begin" })); + + if (mode.terminator_end) { + mm.addRule(mode.terminator_end, { type: "end" }); + } + if (mode.illegal) { + mm.addRule(mode.illegal, { type: "illegal" }); + } + + return mm; + } + + // TODO: We need negative look-behind support to do this properly + /** + * Skip a match if it has a preceding dot + * + * This is used for `beginKeywords` to prevent matching expressions such as + * `bob.keyword.do()`. The mode compiler automatically wires this up as a + * special _internal_ 'on:begin' callback for modes with `beginKeywords` + * @param {RegExpMatchArray} match + * @param {CallbackResponse} response + */ + function skipIfhasPrecedingDot(match, response) { + const before = match.input[match.index - 1]; + if (before === ".") { + response.ignoreMatch(); + } + } + + /** skip vs abort vs ignore + * + * @skip - The mode is still entered and exited normally (and contains rules apply), + * but all content is held and added to the parent buffer rather than being + * output when the mode ends. Mostly used with `sublanguage` to build up + * a single large buffer than can be parsed by sublanguage. + * + * - The mode begin ands ends normally. + * - Content matched is added to the parent mode buffer. + * - The parser cursor is moved forward normally. + * + * @abort - A hack placeholder until we have ignore. Aborts the mode (as if it + * never matched) but DOES NOT continue to match subsequent `contains` + * modes. Abort is bad/suboptimal because it can result in modes + * farther down not getting applied because an earlier rule eats the + * content but then aborts. + * + * - The mode does not begin. + * - Content matched by `begin` is added to the mode buffer. + * - The parser cursor is moved forward accordingly. + * + * @ignore - Ignores the mode (as if it never matched) and continues to match any + * subsequent `contains` modes. Ignore isn't technically possible with + * the current parser implementation. + * + * - The mode does not begin. + * - Content matched by `begin` is ignored. + * - The parser cursor is not moved forward. + */ + + /** + * Compiles an individual mode + * + * This can raise an error if the mode contains certain detectable known logic + * issues. + * @param {Mode} mode + * @param {CompiledMode | null} [parent] + * @returns {CompiledMode | never} + */ + function compileMode(mode, parent) { + const cmode = /** @type CompiledMode */ (mode); + if (mode.compiled) return cmode; + mode.compiled = true; + + // __beforeBegin is considered private API, internal use only + mode.__beforeBegin = null; + + mode.keywords = mode.keywords || mode.beginKeywords; + + let keywordPattern = null; + if (typeof mode.keywords === "object") { + keywordPattern = mode.keywords.$pattern; + delete mode.keywords.$pattern; + } + + if (mode.keywords) { + mode.keywords = compileKeywords(mode.keywords, language.case_insensitive); + } + + // both are not allowed + if (mode.lexemes && keywordPattern) { + throw new Error("ERR: Prefer `keywords.$pattern` to `mode.lexemes`, BOTH are not allowed. (see mode reference) "); + } + + // `mode.lexemes` was the old standard before we added and now recommend + // using `keywords.$pattern` to pass the keyword pattern + cmode.keywordPatternRe = langRe(mode.lexemes || keywordPattern || /\w+/, true); + + if (parent) { + if (mode.beginKeywords) { + // for languages with keywords that include non-word characters checking for + // a word boundary is not sufficient, so instead we check for a word boundary + // or whitespace - this does no harm in any case since our keyword engine + // doesn't allow spaces in keywords anyways and we still check for the boundary + // first + mode.begin = '\\b(' + mode.beginKeywords.split(' ').join('|') + ')(?!\\.)(?=\\b|\\s)'; + mode.__beforeBegin = skipIfhasPrecedingDot; + } + if (!mode.begin) mode.begin = /\B|\b/; + cmode.beginRe = langRe(mode.begin); + if (mode.endSameAsBegin) mode.end = mode.begin; + if (!mode.end && !mode.endsWithParent) mode.end = /\B|\b/; + if (mode.end) cmode.endRe = langRe(mode.end); + cmode.terminator_end = source(mode.end) || ''; + if (mode.endsWithParent && parent.terminator_end) { + cmode.terminator_end += (mode.end ? '|' : '') + parent.terminator_end; + } + } + if (mode.illegal) cmode.illegalRe = langRe(mode.illegal); + // eslint-disable-next-line no-undefined + if (mode.relevance === undefined) mode.relevance = 1; + if (!mode.contains) mode.contains = []; + + mode.contains = [].concat(...mode.contains.map(function(c) { + return expandOrCloneMode(c === 'self' ? mode : c); + })); + mode.contains.forEach(function(c) { compileMode(/** @type Mode */ (c), cmode); }); + + if (mode.starts) { + compileMode(mode.starts, parent); + } + + cmode.matcher = buildModeRegex(cmode); + return cmode; + } + + // self is not valid at the top-level + if (language.contains && language.contains.includes('self')) { + throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation."); + } + + // we need a null object, which inherit will guarantee + language.classNameAliases = inherit(language.classNameAliases || {}); + + return compileMode(/** @type Mode */ (language)); +} + +/** + * Determines if a mode has a dependency on it's parent or not + * + * If a mode does have a parent dependency then often we need to clone it if + * it's used in multiple places so that each copy points to the correct parent, + * where-as modes without a parent can often safely be re-used at the bottom of + * a mode chain. + * + * @param {Mode | null} mode + * @returns {boolean} - is there a dependency on the parent? + * */ +function dependencyOnParent(mode) { + if (!mode) return false; + + return mode.endsWithParent || dependencyOnParent(mode.starts); +} + +/** + * Expands a mode or clones it if necessary + * + * This is necessary for modes with parental dependenceis (see notes on + * `dependencyOnParent`) and for nodes that have `variants` - which must then be + * exploded into their own individual modes at compile time. + * + * @param {Mode} mode + * @returns {Mode | Mode[]} + * */ +function expandOrCloneMode(mode) { + if (mode.variants && !mode.cached_variants) { + mode.cached_variants = mode.variants.map(function(variant) { + return inherit(mode, { variants: null }, variant); + }); + } + + // EXPAND + // if we have variants then essentially "replace" the mode with the variants + // this happens in compileMode, where this function is called from + if (mode.cached_variants) { + return mode.cached_variants; + } + + // CLONE + // if we have dependencies on parents then we need a unique + // instance of ourselves, so we can be reused with many + // different parents without issue + if (dependencyOnParent(mode)) { + return inherit(mode, { starts: mode.starts ? inherit(mode.starts) : null }); + } + + if (Object.isFrozen(mode)) { + return inherit(mode); + } + + // no special dependency issues, just return ourselves + return mode; +} + +/*********************************************** + Keywords +***********************************************/ + +/** + * Given raw keywords from a language definition, compile them. + * + * @param {string | Record} rawKeywords + * @param {boolean} caseInsensitive + */ +function compileKeywords(rawKeywords, caseInsensitive) { + /** @type KeywordDict */ + const compiledKeywords = {}; + + if (typeof rawKeywords === 'string') { // string + splitAndCompile('keyword', rawKeywords); + } else { + Object.keys(rawKeywords).forEach(function(className) { + splitAndCompile(className, rawKeywords[className]); + }); + } + return compiledKeywords; + + // --- + + /** + * Compiles an individual list of keywords + * + * Ex: "for if when while|5" + * + * @param {string} className + * @param {string} keywordList + */ + function splitAndCompile(className, keywordList) { + if (caseInsensitive) { + keywordList = keywordList.toLowerCase(); + } + keywordList.split(' ').forEach(function(keyword) { + const pair = keyword.split('|'); + compiledKeywords[pair[0]] = [className, scoreForKeyword(pair[0], pair[1])]; + }); + } +} + +/** + * Returns the proper score for a given keyword + * + * Also takes into account comment keywords, which will be scored 0 UNLESS + * another score has been manually assigned. + * @param {string} keyword + * @param {string} [providedScore] + */ +function scoreForKeyword(keyword, providedScore) { + // manual scores always win over common keywords + // so you can force a score of 1 if you really insist + if (providedScore) { + return Number(providedScore); + } + + return commonKeyword(keyword) ? 0 : 1; +} + +/** + * Determines if a given keyword is common or not + * + * @param {string} keyword */ +function commonKeyword(keyword) { + return COMMON_KEYWORDS.includes(keyword.toLowerCase()); +} + +var version = "10.4.1"; + +// @ts-nocheck + +function hasValueOrEmptyAttribute(value) { + return Boolean(value || value === ""); +} + +function BuildVuePlugin(hljs) { + const Component = { + props: ["language", "code", "autodetect"], + data: function() { + return { + detectedLanguage: "", + unknownLanguage: false + }; + }, + computed: { + className() { + if (this.unknownLanguage) return ""; + + return "hljs " + this.detectedLanguage; + }, + highlighted() { + // no idea what language to use, return raw code + if (!this.autoDetect && !hljs.getLanguage(this.language)) { + console.warn(`The language "${this.language}" you specified could not be found.`); + this.unknownLanguage = true; + return escapeHTML(this.code); + } + + let result; + if (this.autoDetect) { + result = hljs.highlightAuto(this.code); + this.detectedLanguage = result.language; + } else { + result = hljs.highlight(this.language, this.code, this.ignoreIllegals); + this.detectedLanguage = this.language; + } + return result.value; + }, + autoDetect() { + return !this.language || hasValueOrEmptyAttribute(this.autodetect); + }, + ignoreIllegals() { + return true; + } + }, + // this avoids needing to use a whole Vue compilation pipeline just + // to build Highlight.js + render(createElement) { + return createElement("pre", {}, [ + createElement("code", { + class: this.className, + domProps: { innerHTML: this.highlighted }}) + ]); + } + // template: `
    ` + }; + + const VuePlugin = { + install(Vue) { + Vue.component('highlightjs', Component); + } + }; + + return { Component, VuePlugin }; +} + +/* +Syntax highlighting with language autodetection. +https://highlightjs.org/ +*/ + +const escape$1 = escapeHTML; +const inherit$1 = inherit; + +const { nodeStream: nodeStream$1, mergeStreams: mergeStreams$1 } = utils; +const NO_MATCH = Symbol("nomatch"); + +/** + * @param {any} hljs - object that is extended (legacy) + * @returns {HLJSApi} + */ +const HLJS = function(hljs) { + // Convenience variables for build-in objects + /** @type {unknown[]} */ + const ArrayProto = []; + + // Global internal variables used within the highlight.js library. + /** @type {Record} */ + const languages = Object.create(null); + /** @type {Record} */ + const aliases = Object.create(null); + /** @type {HLJSPlugin[]} */ + const plugins = []; + + // safe/production mode - swallows more errors, tries to keep running + // even if a single syntax or parse hits a fatal error + let SAFE_MODE = true; + const fixMarkupRe = /(^(<[^>]+>|\t|)+|\n)/gm; + const LANGUAGE_NOT_FOUND = "Could not find the language '{}', did you forget to load/include a language module?"; + /** @type {Language} */ + const PLAINTEXT_LANGUAGE = { disableAutodetect: true, name: 'Plain text', contains: [] }; + + // Global options used when within external APIs. This is modified when + // calling the `hljs.configure` function. + /** @type HLJSOptions */ + let options = { + noHighlightRe: /^(no-?highlight)$/i, + languageDetectRe: /\blang(?:uage)?-([\w-]+)\b/i, + classPrefix: 'hljs-', + tabReplace: null, + useBR: false, + languages: null, + // beta configuration options, subject to change, welcome to discuss + // https://github.com/highlightjs/highlight.js/issues/1086 + __emitter: TokenTreeEmitter + }; + + /* Utility functions */ + + /** + * Tests a language name to see if highlighting should be skipped + * @param {string} languageName + */ + function shouldNotHighlight(languageName) { + return options.noHighlightRe.test(languageName); + } + + /** + * @param {HighlightedHTMLElement} block - the HTML element to determine language for + */ + function blockLanguage(block) { + let classes = block.className + ' '; + + classes += block.parentNode ? block.parentNode.className : ''; + + // language-* takes precedence over non-prefixed class names. + const match = options.languageDetectRe.exec(classes); + if (match) { + const language = getLanguage(match[1]); + if (!language) { + console.warn(LANGUAGE_NOT_FOUND.replace("{}", match[1])); + console.warn("Falling back to no-highlight mode for this block.", block); + } + return language ? match[1] : 'no-highlight'; + } + + return classes + .split(/\s+/) + .find((_class) => shouldNotHighlight(_class) || getLanguage(_class)); + } + + /** + * Core highlighting function. + * + * @param {string} languageName - the language to use for highlighting + * @param {string} code - the code to highlight + * @param {boolean} [ignoreIllegals] - whether to ignore illegal matches, default is to bail + * @param {CompiledMode} [continuation] - current continuation mode, if any + * + * @returns {HighlightResult} Result - an object that represents the result + * @property {string} language - the language name + * @property {number} relevance - the relevance score + * @property {string} value - the highlighted HTML code + * @property {string} code - the original raw code + * @property {CompiledMode} top - top of the current mode stack + * @property {boolean} illegal - indicates whether any illegal matches were found + */ + function highlight(languageName, code, ignoreIllegals, continuation) { + /** @type {{ code: string, language: string, result?: any }} */ + const context = { + code, + language: languageName + }; + // the plugin can change the desired language or the code to be highlighted + // just be changing the object it was passed + fire("before:highlight", context); + + // a before plugin can usurp the result completely by providing it's own + // in which case we don't even need to call highlight + const result = context.result ? + context.result : + _highlight(context.language, context.code, ignoreIllegals, continuation); + + result.code = context.code; + // the plugin can change anything in result to suite it + fire("after:highlight", result); + + return result; + } + + /** + * private highlight that's used internally and does not fire callbacks + * + * @param {string} languageName - the language to use for highlighting + * @param {string} code - the code to highlight + * @param {boolean} [ignoreIllegals] - whether to ignore illegal matches, default is to bail + * @param {CompiledMode} [continuation] - current continuation mode, if any + * @returns {HighlightResult} - result of the highlight operation + */ + function _highlight(languageName, code, ignoreIllegals, continuation) { + const codeToHighlight = code; + + /** + * Return keyword data if a match is a keyword + * @param {CompiledMode} mode - current mode + * @param {RegExpMatchArray} match - regexp match data + * @returns {KeywordData | false} + */ + function keywordData(mode, match) { + const matchText = language.case_insensitive ? match[0].toLowerCase() : match[0]; + return Object.prototype.hasOwnProperty.call(mode.keywords, matchText) && mode.keywords[matchText]; + } + + function processKeywords() { + if (!top.keywords) { + emitter.addText(modeBuffer); + return; + } + + let lastIndex = 0; + top.keywordPatternRe.lastIndex = 0; + let match = top.keywordPatternRe.exec(modeBuffer); + let buf = ""; + + while (match) { + buf += modeBuffer.substring(lastIndex, match.index); + const data = keywordData(top, match); + if (data) { + const [kind, keywordRelevance] = data; + emitter.addText(buf); + buf = ""; + + relevance += keywordRelevance; + const cssClass = language.classNameAliases[kind] || kind; + emitter.addKeyword(match[0], cssClass); + } else { + buf += match[0]; + } + lastIndex = top.keywordPatternRe.lastIndex; + match = top.keywordPatternRe.exec(modeBuffer); + } + buf += modeBuffer.substr(lastIndex); + emitter.addText(buf); + } + + function processSubLanguage() { + if (modeBuffer === "") return; + /** @type HighlightResult */ + let result = null; + + if (typeof top.subLanguage === 'string') { + if (!languages[top.subLanguage]) { + emitter.addText(modeBuffer); + return; + } + result = _highlight(top.subLanguage, modeBuffer, true, continuations[top.subLanguage]); + continuations[top.subLanguage] = /** @type {CompiledMode} */ (result.top); + } else { + result = highlightAuto(modeBuffer, top.subLanguage.length ? top.subLanguage : null); + } + + // Counting embedded language score towards the host language may be disabled + // with zeroing the containing mode relevance. Use case in point is Markdown that + // allows XML everywhere and makes every XML snippet to have a much larger Markdown + // score. + if (top.relevance > 0) { + relevance += result.relevance; + } + emitter.addSublanguage(result.emitter, result.language); + } + + function processBuffer() { + if (top.subLanguage != null) { + processSubLanguage(); + } else { + processKeywords(); + } + modeBuffer = ''; + } + + /** + * @param {Mode} mode - new mode to start + */ + function startNewMode(mode) { + if (mode.className) { + emitter.openNode(language.classNameAliases[mode.className] || mode.className); + } + top = Object.create(mode, { parent: { value: top } }); + return top; + } + + /** + * @param {CompiledMode } mode - the mode to potentially end + * @param {RegExpMatchArray} match - the latest match + * @param {string} matchPlusRemainder - match plus remainder of content + * @returns {CompiledMode | void} - the next mode, or if void continue on in current mode + */ + function endOfMode(mode, match, matchPlusRemainder) { + let matched = startsWith(mode.endRe, matchPlusRemainder); + + if (matched) { + if (mode["on:end"]) { + const resp = new Response(mode); + mode["on:end"](match, resp); + if (resp.ignore) matched = false; + } + + if (matched) { + while (mode.endsParent && mode.parent) { + mode = mode.parent; + } + return mode; + } + } + // even if on:end fires an `ignore` it's still possible + // that we might trigger the end node because of a parent mode + if (mode.endsWithParent) { + return endOfMode(mode.parent, match, matchPlusRemainder); + } + } + + /** + * Handle matching but then ignoring a sequence of text + * + * @param {string} lexeme - string containing full match text + */ + function doIgnore(lexeme) { + if (top.matcher.regexIndex === 0) { + // no more regexs to potentially match here, so we move the cursor forward one + // space + modeBuffer += lexeme[0]; + return 1; + } else { + // no need to move the cursor, we still have additional regexes to try and + // match at this very spot + resumeScanAtSamePosition = true; + return 0; + } + } + + /** + * Handle the start of a new potential mode match + * + * @param {EnhancedMatch} match - the current match + * @returns {number} how far to advance the parse cursor + */ + function doBeginMatch(match) { + const lexeme = match[0]; + const newMode = match.rule; + + const resp = new Response(newMode); + // first internal before callbacks, then the public ones + const beforeCallbacks = [newMode.__beforeBegin, newMode["on:begin"]]; + for (const cb of beforeCallbacks) { + if (!cb) continue; + cb(match, resp); + if (resp.ignore) return doIgnore(lexeme); + } + + if (newMode && newMode.endSameAsBegin) { + newMode.endRe = escape(lexeme); + } + + if (newMode.skip) { + modeBuffer += lexeme; + } else { + if (newMode.excludeBegin) { + modeBuffer += lexeme; + } + processBuffer(); + if (!newMode.returnBegin && !newMode.excludeBegin) { + modeBuffer = lexeme; + } + } + startNewMode(newMode); + // if (mode["after:begin"]) { + // let resp = new Response(mode); + // mode["after:begin"](match, resp); + // } + return newMode.returnBegin ? 0 : lexeme.length; + } + + /** + * Handle the potential end of mode + * + * @param {RegExpMatchArray} match - the current match + */ + function doEndMatch(match) { + const lexeme = match[0]; + const matchPlusRemainder = codeToHighlight.substr(match.index); + + const endMode = endOfMode(top, match, matchPlusRemainder); + if (!endMode) { return NO_MATCH; } + + const origin = top; + if (origin.skip) { + modeBuffer += lexeme; + } else { + if (!(origin.returnEnd || origin.excludeEnd)) { + modeBuffer += lexeme; + } + processBuffer(); + if (origin.excludeEnd) { + modeBuffer = lexeme; + } + } + do { + if (top.className) { + emitter.closeNode(); + } + if (!top.skip && !top.subLanguage) { + relevance += top.relevance; + } + top = top.parent; + } while (top !== endMode.parent); + if (endMode.starts) { + if (endMode.endSameAsBegin) { + endMode.starts.endRe = endMode.endRe; + } + startNewMode(endMode.starts); + } + return origin.returnEnd ? 0 : lexeme.length; + } + + function processContinuations() { + const list = []; + for (let current = top; current !== language; current = current.parent) { + if (current.className) { + list.unshift(current.className); + } + } + list.forEach(item => emitter.openNode(item)); + } + + /** @type {{type?: MatchType, index?: number, rule?: Mode}}} */ + let lastMatch = {}; + + /** + * Process an individual match + * + * @param {string} textBeforeMatch - text preceeding the match (since the last match) + * @param {EnhancedMatch} [match] - the match itself + */ + function processLexeme(textBeforeMatch, match) { + const lexeme = match && match[0]; + + // add non-matched text to the current mode buffer + modeBuffer += textBeforeMatch; + + if (lexeme == null) { + processBuffer(); + return 0; + } + + // we've found a 0 width match and we're stuck, so we need to advance + // this happens when we have badly behaved rules that have optional matchers to the degree that + // sometimes they can end up matching nothing at all + // Ref: https://github.com/highlightjs/highlight.js/issues/2140 + if (lastMatch.type === "begin" && match.type === "end" && lastMatch.index === match.index && lexeme === "") { + // spit the "skipped" character that our regex choked on back into the output sequence + modeBuffer += codeToHighlight.slice(match.index, match.index + 1); + if (!SAFE_MODE) { + /** @type {AnnotatedError} */ + const err = new Error('0 width match regex'); + err.languageName = languageName; + err.badRule = lastMatch.rule; + throw err; + } + return 1; + } + lastMatch = match; + + if (match.type === "begin") { + return doBeginMatch(match); + } else if (match.type === "illegal" && !ignoreIllegals) { + // illegal match, we do not continue processing + /** @type {AnnotatedError} */ + const err = new Error('Illegal lexeme "' + lexeme + '" for mode "' + (top.className || '') + '"'); + err.mode = top; + throw err; + } else if (match.type === "end") { + const processed = doEndMatch(match); + if (processed !== NO_MATCH) { + return processed; + } + } + + // edge case for when illegal matches $ (end of line) which is technically + // a 0 width match but not a begin/end match so it's not caught by the + // first handler (when ignoreIllegals is true) + if (match.type === "illegal" && lexeme === "") { + // advance so we aren't stuck in an infinite loop + return 1; + } + + // infinite loops are BAD, this is a last ditch catch all. if we have a + // decent number of iterations yet our index (cursor position in our + // parsing) still 3x behind our index then something is very wrong + // so we bail + if (iterations > 100000 && iterations > match.index * 3) { + const err = new Error('potential infinite loop, way more iterations than matches'); + throw err; + } + + /* + Why might be find ourselves here? Only one occasion now. An end match that was + triggered but could not be completed. When might this happen? When an `endSameasBegin` + rule sets the end rule to a specific match. Since the overall mode termination rule that's + being used to scan the text isn't recompiled that means that any match that LOOKS like + the end (but is not, because it is not an exact match to the beginning) will + end up here. A definite end match, but when `doEndMatch` tries to "reapply" + the end rule and fails to match, we wind up here, and just silently ignore the end. + + This causes no real harm other than stopping a few times too many. + */ + + modeBuffer += lexeme; + return lexeme.length; + } + + const language = getLanguage(languageName); + if (!language) { + console.error(LANGUAGE_NOT_FOUND.replace("{}", languageName)); + throw new Error('Unknown language: "' + languageName + '"'); + } + + const md = compileLanguage(language); + let result = ''; + /** @type {CompiledMode} */ + let top = continuation || md; + /** @type Record */ + const continuations = {}; // keep continuations for sub-languages + const emitter = new options.__emitter(options); + processContinuations(); + let modeBuffer = ''; + let relevance = 0; + let index = 0; + let iterations = 0; + let resumeScanAtSamePosition = false; + + try { + top.matcher.considerAll(); + + for (;;) { + iterations++; + if (resumeScanAtSamePosition) { + // only regexes not matched previously will now be + // considered for a potential match + resumeScanAtSamePosition = false; + } else { + top.matcher.considerAll(); + } + top.matcher.lastIndex = index; + + const match = top.matcher.exec(codeToHighlight); + // console.log("match", match[0], match.rule && match.rule.begin) + + if (!match) break; + + const beforeMatch = codeToHighlight.substring(index, match.index); + const processedCount = processLexeme(beforeMatch, match); + index = match.index + processedCount; + } + processLexeme(codeToHighlight.substr(index)); + emitter.closeAllNodes(); + emitter.finalize(); + result = emitter.toHTML(); + + return { + relevance: relevance, + value: result, + language: languageName, + illegal: false, + emitter: emitter, + top: top + }; + } catch (err) { + if (err.message && err.message.includes('Illegal')) { + return { + illegal: true, + illegalBy: { + msg: err.message, + context: codeToHighlight.slice(index - 100, index + 100), + mode: err.mode + }, + sofar: result, + relevance: 0, + value: escape$1(codeToHighlight), + emitter: emitter + }; + } else if (SAFE_MODE) { + return { + illegal: false, + relevance: 0, + value: escape$1(codeToHighlight), + emitter: emitter, + language: languageName, + top: top, + errorRaised: err + }; + } else { + throw err; + } + } + } + + /** + * returns a valid highlight result, without actually doing any actual work, + * auto highlight starts with this and it's possible for small snippets that + * auto-detection may not find a better match + * @param {string} code + * @returns {HighlightResult} + */ + function justTextHighlightResult(code) { + const result = { + relevance: 0, + emitter: new options.__emitter(options), + value: escape$1(code), + illegal: false, + top: PLAINTEXT_LANGUAGE + }; + result.emitter.addText(code); + return result; + } + + /** + Highlighting with language detection. Accepts a string with the code to + highlight. Returns an object with the following properties: + + - language (detected language) + - relevance (int) + - value (an HTML string with highlighting markup) + - second_best (object with the same structure for second-best heuristically + detected language, may be absent) + + @param {string} code + @param {Array} [languageSubset] + @returns {AutoHighlightResult} + */ + function highlightAuto(code, languageSubset) { + languageSubset = languageSubset || options.languages || Object.keys(languages); + const plaintext = justTextHighlightResult(code); + + const results = languageSubset.filter(getLanguage).filter(autoDetection).map(name => + _highlight(name, code, false) + ); + results.unshift(plaintext); // plaintext is always an option + + const sorted = results.sort((a, b) => { + // sort base on relevance + if (a.relevance !== b.relevance) return b.relevance - a.relevance; + + // always award the tie to the base language + // ie if C++ and Arduino are tied, it's more likely to be C++ + if (a.language && b.language) { + if (getLanguage(a.language).supersetOf === b.language) { + return 1; + } else if (getLanguage(b.language).supersetOf === a.language) { + return -1; + } + } + + // otherwise say they are equal, which has the effect of sorting on + // relevance while preserving the original ordering - which is how ties + // have historically been settled, ie the language that comes first always + // wins in the case of a tie + return 0; + }); + + const [best, secondBest] = sorted; + + /** @type {AutoHighlightResult} */ + const result = best; + result.second_best = secondBest; + + return result; + } + + /** + Post-processing of the highlighted markup: + + - replace TABs with something more useful + - replace real line-breaks with '
    ' for non-pre containers + + @param {string} html + @returns {string} + */ + function fixMarkup(html) { + if (!(options.tabReplace || options.useBR)) { + return html; + } + + return html.replace(fixMarkupRe, match => { + if (match === '\n') { + return options.useBR ? '
    ' : match; + } else if (options.tabReplace) { + return match.replace(/\t/g, options.tabReplace); + } + return match; + }); + } + + /** + * Builds new class name for block given the language name + * + * @param {string} prevClassName + * @param {string} [currentLang] + * @param {string} [resultLang] + */ + function buildClassName(prevClassName, currentLang, resultLang) { + const language = currentLang ? aliases[currentLang] : resultLang; + const result = [prevClassName.trim()]; + + if (!prevClassName.match(/\bhljs\b/)) { + result.push('hljs'); + } + + if (!prevClassName.includes(language)) { + result.push(language); + } + + return result.join(' ').trim(); + } + + /** + * Applies highlighting to a DOM node containing code. Accepts a DOM node and + * two optional parameters for fixMarkup. + * + * @param {HighlightedHTMLElement} element - the HTML element to highlight + */ + function highlightBlock(element) { + /** @type HTMLElement */ + let node = null; + const language = blockLanguage(element); + + if (shouldNotHighlight(language)) return; + + fire("before:highlightBlock", + { block: element, language: language }); + + if (options.useBR) { + node = document.createElement('div'); + node.innerHTML = element.innerHTML.replace(/\n/g, '').replace(//g, '\n'); + } else { + node = element; + } + const text = node.textContent; + const result = language ? highlight(language, text, true) : highlightAuto(text); + + const originalStream = nodeStream$1(node); + if (originalStream.length) { + const resultNode = document.createElement('div'); + resultNode.innerHTML = result.value; + result.value = mergeStreams$1(originalStream, nodeStream$1(resultNode), text); + } + result.value = fixMarkup(result.value); + + fire("after:highlightBlock", { block: element, result: result }); + + element.innerHTML = result.value; + element.className = buildClassName(element.className, language, result.language); + element.result = { + language: result.language, + // TODO: remove with version 11.0 + re: result.relevance, + relavance: result.relevance + }; + if (result.second_best) { + element.second_best = { + language: result.second_best.language, + // TODO: remove with version 11.0 + re: result.second_best.relevance, + relavance: result.second_best.relevance + }; + } + } + + /** + * Updates highlight.js global options with the passed options + * + * @param {Partial} userOptions + */ + function configure(userOptions) { + if (userOptions.useBR) { + console.warn("'useBR' option is deprecated and will be removed entirely in v11.0"); + console.warn("Please see https://github.com/highlightjs/highlight.js/issues/2559"); + } + options = inherit$1(options, userOptions); + } + + /** + * Highlights to all
     blocks on a page
    +   *
    +   * @type {Function & {called?: boolean}}
    +   */
    +  const initHighlighting = () => {
    +    if (initHighlighting.called) return;
    +    initHighlighting.called = true;
    +
    +    const blocks = document.querySelectorAll('pre code');
    +    ArrayProto.forEach.call(blocks, highlightBlock);
    +  };
    +
    +  // Higlights all when DOMContentLoaded fires
    +  function initHighlightingOnLoad() {
    +    // @ts-ignore
    +    window.addEventListener('DOMContentLoaded', initHighlighting, false);
    +  }
    +
    +  /**
    +   * Register a language grammar module
    +   *
    +   * @param {string} languageName
    +   * @param {LanguageFn} languageDefinition
    +   */
    +  function registerLanguage(languageName, languageDefinition) {
    +    let lang = null;
    +    try {
    +      lang = languageDefinition(hljs);
    +    } catch (error) {
    +      console.error("Language definition for '{}' could not be registered.".replace("{}", languageName));
    +      // hard or soft error
    +      if (!SAFE_MODE) { throw error; } else { console.error(error); }
    +      // languages that have serious errors are replaced with essentially a
    +      // "plaintext" stand-in so that the code blocks will still get normal
    +      // css classes applied to them - and one bad language won't break the
    +      // entire highlighter
    +      lang = PLAINTEXT_LANGUAGE;
    +    }
    +    // give it a temporary name if it doesn't have one in the meta-data
    +    if (!lang.name) lang.name = languageName;
    +    languages[languageName] = lang;
    +    lang.rawDefinition = languageDefinition.bind(null, hljs);
    +
    +    if (lang.aliases) {
    +      registerAliases(lang.aliases, { languageName });
    +    }
    +  }
    +
    +  /**
    +   * @returns {string[]} List of language internal names
    +   */
    +  function listLanguages() {
    +    return Object.keys(languages);
    +  }
    +
    +  /**
    +    intended usage: When one language truly requires another
    +
    +    Unlike `getLanguage`, this will throw when the requested language
    +    is not available.
    +
    +    @param {string} name - name of the language to fetch/require
    +    @returns {Language | never}
    +  */
    +  function requireLanguage(name) {
    +    console.warn("requireLanguage is deprecated and will be removed entirely in the future.");
    +    console.warn("Please see https://github.com/highlightjs/highlight.js/pull/2844");
    +
    +    const lang = getLanguage(name);
    +    if (lang) { return lang; }
    +
    +    const err = new Error('The \'{}\' language is required, but not loaded.'.replace('{}', name));
    +    throw err;
    +  }
    +
    +  /**
    +   * @param {string} name - name of the language to retrieve
    +   * @returns {Language | undefined}
    +   */
    +  function getLanguage(name) {
    +    name = (name || '').toLowerCase();
    +    return languages[name] || languages[aliases[name]];
    +  }
    +
    +  /**
    +   *
    +   * @param {string|string[]} aliasList - single alias or list of aliases
    +   * @param {{languageName: string}} opts
    +   */
    +  function registerAliases(aliasList, { languageName }) {
    +    if (typeof aliasList === 'string') {
    +      aliasList = [aliasList];
    +    }
    +    aliasList.forEach(alias => { aliases[alias] = languageName; });
    +  }
    +
    +  /**
    +   * Determines if a given language has auto-detection enabled
    +   * @param {string} name - name of the language
    +   */
    +  function autoDetection(name) {
    +    const lang = getLanguage(name);
    +    return lang && !lang.disableAutodetect;
    +  }
    +
    +  /**
    +   * @param {HLJSPlugin} plugin
    +   */
    +  function addPlugin(plugin) {
    +    plugins.push(plugin);
    +  }
    +
    +  /**
    +   *
    +   * @param {PluginEvent} event
    +   * @param {any} args
    +   */
    +  function fire(event, args) {
    +    const cb = event;
    +    plugins.forEach(function(plugin) {
    +      if (plugin[cb]) {
    +        plugin[cb](args);
    +      }
    +    });
    +  }
    +
    +  /**
    +  Note: fixMarkup is deprecated and will be removed entirely in v11
    +
    +  @param {string} arg
    +  @returns {string}
    +  */
    +  function deprecateFixMarkup(arg) {
    +    console.warn("fixMarkup is deprecated and will be removed entirely in v11.0");
    +    console.warn("Please see https://github.com/highlightjs/highlight.js/issues/2534");
    +
    +    return fixMarkup(arg);
    +  }
    +
    +  /* Interface definition */
    +  Object.assign(hljs, {
    +    highlight,
    +    highlightAuto,
    +    fixMarkup: deprecateFixMarkup,
    +    highlightBlock,
    +    configure,
    +    initHighlighting,
    +    initHighlightingOnLoad,
    +    registerLanguage,
    +    listLanguages,
    +    getLanguage,
    +    registerAliases,
    +    requireLanguage,
    +    autoDetection,
    +    inherit: inherit$1,
    +    addPlugin,
    +    // plugins for frameworks
    +    vuePlugin: BuildVuePlugin(hljs).VuePlugin
    +  });
    +
    +  hljs.debugMode = function() { SAFE_MODE = false; };
    +  hljs.safeMode = function() { SAFE_MODE = true; };
    +  hljs.versionString = version;
    +
    +  for (const key in MODES) {
    +    // @ts-ignore
    +    if (typeof MODES[key] === "object") {
    +      // @ts-ignore
    +      deepFreezeEs6(MODES[key]);
    +    }
    +  }
    +
    +  // merge all the modes/regexs into our main object
    +  Object.assign(hljs, MODES);
    +
    +  return hljs;
    +};
    +
    +// export an "instance" of the highlighter
    +var highlight = HLJS({});
    +
    +module.exports = highlight;
    diff --git a/node_modules/highlight.js/lib/highlight.js b/node_modules/highlight.js/lib/highlight.js
    new file mode 100644
    index 0000000..4417957
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/highlight.js
    @@ -0,0 +1,2 @@
    +// This file has been deprecated in favor of core.js
    +var hljs = require('./core');
    diff --git a/node_modules/highlight.js/lib/index.js b/node_modules/highlight.js/lib/index.js
    new file mode 100644
    index 0000000..a233719
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/index.js
    @@ -0,0 +1,194 @@
    +var hljs = require('./core');
    +
    +hljs.registerLanguage('1c', require('./languages/1c'));
    +hljs.registerLanguage('abnf', require('./languages/abnf'));
    +hljs.registerLanguage('accesslog', require('./languages/accesslog'));
    +hljs.registerLanguage('actionscript', require('./languages/actionscript'));
    +hljs.registerLanguage('ada', require('./languages/ada'));
    +hljs.registerLanguage('angelscript', require('./languages/angelscript'));
    +hljs.registerLanguage('apache', require('./languages/apache'));
    +hljs.registerLanguage('applescript', require('./languages/applescript'));
    +hljs.registerLanguage('arcade', require('./languages/arcade'));
    +hljs.registerLanguage('arduino', require('./languages/arduino'));
    +hljs.registerLanguage('armasm', require('./languages/armasm'));
    +hljs.registerLanguage('xml', require('./languages/xml'));
    +hljs.registerLanguage('asciidoc', require('./languages/asciidoc'));
    +hljs.registerLanguage('aspectj', require('./languages/aspectj'));
    +hljs.registerLanguage('autohotkey', require('./languages/autohotkey'));
    +hljs.registerLanguage('autoit', require('./languages/autoit'));
    +hljs.registerLanguage('avrasm', require('./languages/avrasm'));
    +hljs.registerLanguage('awk', require('./languages/awk'));
    +hljs.registerLanguage('axapta', require('./languages/axapta'));
    +hljs.registerLanguage('bash', require('./languages/bash'));
    +hljs.registerLanguage('basic', require('./languages/basic'));
    +hljs.registerLanguage('bnf', require('./languages/bnf'));
    +hljs.registerLanguage('brainfuck', require('./languages/brainfuck'));
    +hljs.registerLanguage('c-like', require('./languages/c-like'));
    +hljs.registerLanguage('c', require('./languages/c'));
    +hljs.registerLanguage('cal', require('./languages/cal'));
    +hljs.registerLanguage('capnproto', require('./languages/capnproto'));
    +hljs.registerLanguage('ceylon', require('./languages/ceylon'));
    +hljs.registerLanguage('clean', require('./languages/clean'));
    +hljs.registerLanguage('clojure', require('./languages/clojure'));
    +hljs.registerLanguage('clojure-repl', require('./languages/clojure-repl'));
    +hljs.registerLanguage('cmake', require('./languages/cmake'));
    +hljs.registerLanguage('coffeescript', require('./languages/coffeescript'));
    +hljs.registerLanguage('coq', require('./languages/coq'));
    +hljs.registerLanguage('cos', require('./languages/cos'));
    +hljs.registerLanguage('cpp', require('./languages/cpp'));
    +hljs.registerLanguage('crmsh', require('./languages/crmsh'));
    +hljs.registerLanguage('crystal', require('./languages/crystal'));
    +hljs.registerLanguage('csharp', require('./languages/csharp'));
    +hljs.registerLanguage('csp', require('./languages/csp'));
    +hljs.registerLanguage('css', require('./languages/css'));
    +hljs.registerLanguage('d', require('./languages/d'));
    +hljs.registerLanguage('markdown', require('./languages/markdown'));
    +hljs.registerLanguage('dart', require('./languages/dart'));
    +hljs.registerLanguage('delphi', require('./languages/delphi'));
    +hljs.registerLanguage('diff', require('./languages/diff'));
    +hljs.registerLanguage('django', require('./languages/django'));
    +hljs.registerLanguage('dns', require('./languages/dns'));
    +hljs.registerLanguage('dockerfile', require('./languages/dockerfile'));
    +hljs.registerLanguage('dos', require('./languages/dos'));
    +hljs.registerLanguage('dsconfig', require('./languages/dsconfig'));
    +hljs.registerLanguage('dts', require('./languages/dts'));
    +hljs.registerLanguage('dust', require('./languages/dust'));
    +hljs.registerLanguage('ebnf', require('./languages/ebnf'));
    +hljs.registerLanguage('elixir', require('./languages/elixir'));
    +hljs.registerLanguage('elm', require('./languages/elm'));
    +hljs.registerLanguage('ruby', require('./languages/ruby'));
    +hljs.registerLanguage('erb', require('./languages/erb'));
    +hljs.registerLanguage('erlang-repl', require('./languages/erlang-repl'));
    +hljs.registerLanguage('erlang', require('./languages/erlang'));
    +hljs.registerLanguage('excel', require('./languages/excel'));
    +hljs.registerLanguage('fix', require('./languages/fix'));
    +hljs.registerLanguage('flix', require('./languages/flix'));
    +hljs.registerLanguage('fortran', require('./languages/fortran'));
    +hljs.registerLanguage('fsharp', require('./languages/fsharp'));
    +hljs.registerLanguage('gams', require('./languages/gams'));
    +hljs.registerLanguage('gauss', require('./languages/gauss'));
    +hljs.registerLanguage('gcode', require('./languages/gcode'));
    +hljs.registerLanguage('gherkin', require('./languages/gherkin'));
    +hljs.registerLanguage('glsl', require('./languages/glsl'));
    +hljs.registerLanguage('gml', require('./languages/gml'));
    +hljs.registerLanguage('go', require('./languages/go'));
    +hljs.registerLanguage('golo', require('./languages/golo'));
    +hljs.registerLanguage('gradle', require('./languages/gradle'));
    +hljs.registerLanguage('groovy', require('./languages/groovy'));
    +hljs.registerLanguage('haml', require('./languages/haml'));
    +hljs.registerLanguage('handlebars', require('./languages/handlebars'));
    +hljs.registerLanguage('haskell', require('./languages/haskell'));
    +hljs.registerLanguage('haxe', require('./languages/haxe'));
    +hljs.registerLanguage('hsp', require('./languages/hsp'));
    +hljs.registerLanguage('htmlbars', require('./languages/htmlbars'));
    +hljs.registerLanguage('http', require('./languages/http'));
    +hljs.registerLanguage('hy', require('./languages/hy'));
    +hljs.registerLanguage('inform7', require('./languages/inform7'));
    +hljs.registerLanguage('ini', require('./languages/ini'));
    +hljs.registerLanguage('irpf90', require('./languages/irpf90'));
    +hljs.registerLanguage('isbl', require('./languages/isbl'));
    +hljs.registerLanguage('java', require('./languages/java'));
    +hljs.registerLanguage('javascript', require('./languages/javascript'));
    +hljs.registerLanguage('jboss-cli', require('./languages/jboss-cli'));
    +hljs.registerLanguage('json', require('./languages/json'));
    +hljs.registerLanguage('julia', require('./languages/julia'));
    +hljs.registerLanguage('julia-repl', require('./languages/julia-repl'));
    +hljs.registerLanguage('kotlin', require('./languages/kotlin'));
    +hljs.registerLanguage('lasso', require('./languages/lasso'));
    +hljs.registerLanguage('latex', require('./languages/latex'));
    +hljs.registerLanguage('ldif', require('./languages/ldif'));
    +hljs.registerLanguage('leaf', require('./languages/leaf'));
    +hljs.registerLanguage('less', require('./languages/less'));
    +hljs.registerLanguage('lisp', require('./languages/lisp'));
    +hljs.registerLanguage('livecodeserver', require('./languages/livecodeserver'));
    +hljs.registerLanguage('livescript', require('./languages/livescript'));
    +hljs.registerLanguage('llvm', require('./languages/llvm'));
    +hljs.registerLanguage('lsl', require('./languages/lsl'));
    +hljs.registerLanguage('lua', require('./languages/lua'));
    +hljs.registerLanguage('makefile', require('./languages/makefile'));
    +hljs.registerLanguage('mathematica', require('./languages/mathematica'));
    +hljs.registerLanguage('matlab', require('./languages/matlab'));
    +hljs.registerLanguage('maxima', require('./languages/maxima'));
    +hljs.registerLanguage('mel', require('./languages/mel'));
    +hljs.registerLanguage('mercury', require('./languages/mercury'));
    +hljs.registerLanguage('mipsasm', require('./languages/mipsasm'));
    +hljs.registerLanguage('mizar', require('./languages/mizar'));
    +hljs.registerLanguage('perl', require('./languages/perl'));
    +hljs.registerLanguage('mojolicious', require('./languages/mojolicious'));
    +hljs.registerLanguage('monkey', require('./languages/monkey'));
    +hljs.registerLanguage('moonscript', require('./languages/moonscript'));
    +hljs.registerLanguage('n1ql', require('./languages/n1ql'));
    +hljs.registerLanguage('nginx', require('./languages/nginx'));
    +hljs.registerLanguage('nim', require('./languages/nim'));
    +hljs.registerLanguage('nix', require('./languages/nix'));
    +hljs.registerLanguage('node-repl', require('./languages/node-repl'));
    +hljs.registerLanguage('nsis', require('./languages/nsis'));
    +hljs.registerLanguage('objectivec', require('./languages/objectivec'));
    +hljs.registerLanguage('ocaml', require('./languages/ocaml'));
    +hljs.registerLanguage('openscad', require('./languages/openscad'));
    +hljs.registerLanguage('oxygene', require('./languages/oxygene'));
    +hljs.registerLanguage('parser3', require('./languages/parser3'));
    +hljs.registerLanguage('pf', require('./languages/pf'));
    +hljs.registerLanguage('pgsql', require('./languages/pgsql'));
    +hljs.registerLanguage('php', require('./languages/php'));
    +hljs.registerLanguage('php-template', require('./languages/php-template'));
    +hljs.registerLanguage('plaintext', require('./languages/plaintext'));
    +hljs.registerLanguage('pony', require('./languages/pony'));
    +hljs.registerLanguage('powershell', require('./languages/powershell'));
    +hljs.registerLanguage('processing', require('./languages/processing'));
    +hljs.registerLanguage('profile', require('./languages/profile'));
    +hljs.registerLanguage('prolog', require('./languages/prolog'));
    +hljs.registerLanguage('properties', require('./languages/properties'));
    +hljs.registerLanguage('protobuf', require('./languages/protobuf'));
    +hljs.registerLanguage('puppet', require('./languages/puppet'));
    +hljs.registerLanguage('purebasic', require('./languages/purebasic'));
    +hljs.registerLanguage('python', require('./languages/python'));
    +hljs.registerLanguage('python-repl', require('./languages/python-repl'));
    +hljs.registerLanguage('q', require('./languages/q'));
    +hljs.registerLanguage('qml', require('./languages/qml'));
    +hljs.registerLanguage('r', require('./languages/r'));
    +hljs.registerLanguage('reasonml', require('./languages/reasonml'));
    +hljs.registerLanguage('rib', require('./languages/rib'));
    +hljs.registerLanguage('roboconf', require('./languages/roboconf'));
    +hljs.registerLanguage('routeros', require('./languages/routeros'));
    +hljs.registerLanguage('rsl', require('./languages/rsl'));
    +hljs.registerLanguage('ruleslanguage', require('./languages/ruleslanguage'));
    +hljs.registerLanguage('rust', require('./languages/rust'));
    +hljs.registerLanguage('sas', require('./languages/sas'));
    +hljs.registerLanguage('scala', require('./languages/scala'));
    +hljs.registerLanguage('scheme', require('./languages/scheme'));
    +hljs.registerLanguage('scilab', require('./languages/scilab'));
    +hljs.registerLanguage('scss', require('./languages/scss'));
    +hljs.registerLanguage('shell', require('./languages/shell'));
    +hljs.registerLanguage('smali', require('./languages/smali'));
    +hljs.registerLanguage('smalltalk', require('./languages/smalltalk'));
    +hljs.registerLanguage('sml', require('./languages/sml'));
    +hljs.registerLanguage('sqf', require('./languages/sqf'));
    +hljs.registerLanguage('sql', require('./languages/sql'));
    +hljs.registerLanguage('stan', require('./languages/stan'));
    +hljs.registerLanguage('stata', require('./languages/stata'));
    +hljs.registerLanguage('step21', require('./languages/step21'));
    +hljs.registerLanguage('stylus', require('./languages/stylus'));
    +hljs.registerLanguage('subunit', require('./languages/subunit'));
    +hljs.registerLanguage('swift', require('./languages/swift'));
    +hljs.registerLanguage('taggerscript', require('./languages/taggerscript'));
    +hljs.registerLanguage('yaml', require('./languages/yaml'));
    +hljs.registerLanguage('tap', require('./languages/tap'));
    +hljs.registerLanguage('tcl', require('./languages/tcl'));
    +hljs.registerLanguage('thrift', require('./languages/thrift'));
    +hljs.registerLanguage('tp', require('./languages/tp'));
    +hljs.registerLanguage('twig', require('./languages/twig'));
    +hljs.registerLanguage('typescript', require('./languages/typescript'));
    +hljs.registerLanguage('vala', require('./languages/vala'));
    +hljs.registerLanguage('vbnet', require('./languages/vbnet'));
    +hljs.registerLanguage('vbscript', require('./languages/vbscript'));
    +hljs.registerLanguage('vbscript-html', require('./languages/vbscript-html'));
    +hljs.registerLanguage('verilog', require('./languages/verilog'));
    +hljs.registerLanguage('vhdl', require('./languages/vhdl'));
    +hljs.registerLanguage('vim', require('./languages/vim'));
    +hljs.registerLanguage('x86asm', require('./languages/x86asm'));
    +hljs.registerLanguage('xl', require('./languages/xl'));
    +hljs.registerLanguage('xquery', require('./languages/xquery'));
    +hljs.registerLanguage('zephir', require('./languages/zephir'));
    +
    +module.exports = hljs;
    \ No newline at end of file
    diff --git a/node_modules/highlight.js/lib/languages/1c.js b/node_modules/highlight.js/lib/languages/1c.js
    new file mode 100644
    index 0000000..4a2e352
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/1c.js
    @@ -0,0 +1,521 @@
    +/*
    +Language: 1C:Enterprise
    +Author: Stanislav Belov 
    +Description: built-in language 1C:Enterprise (v7, v8)
    +Category: enterprise
    +*/
    +
    +function _1c(hljs) {
    +
    +  // общий паттерн для определения идентификаторов
    +  var UNDERSCORE_IDENT_RE = '[A-Za-zА-Яа-яёЁ_][A-Za-zА-Яа-яёЁ_0-9]+';
    +
    +  // v7 уникальные ключевые слова, отсутствующие в v8 ==> keyword
    +  var v7_keywords =
    +  'далее ';
    +
    +  // v8 ключевые слова ==> keyword
    +  var v8_keywords =
    +  'возврат вызватьисключение выполнить для если и из или иначе иначеесли исключение каждого конецесли ' +
    +  'конецпопытки конеццикла не новый перейти перем по пока попытка прервать продолжить тогда цикл экспорт ';
    +
    +  // keyword : ключевые слова
    +  var KEYWORD = v7_keywords + v8_keywords;
    +
    +  // v7 уникальные директивы, отсутствующие в v8 ==> meta-keyword
    +  var v7_meta_keywords =
    +  'загрузитьизфайла ';
    +
    +  // v8 ключевые слова в инструкциях препроцессора, директивах компиляции, аннотациях ==> meta-keyword
    +  var v8_meta_keywords =
    +  'вебклиент вместо внешнеесоединение клиент конецобласти мобильноеприложениеклиент мобильноеприложениесервер ' +
    +  'наклиенте наклиентенасервере наклиентенасерверебезконтекста насервере насерверебезконтекста область перед ' +
    +  'после сервер толстыйклиентобычноеприложение толстыйклиентуправляемоеприложение тонкийклиент ';
    +
    +  // meta-keyword : ключевые слова в инструкциях препроцессора, директивах компиляции, аннотациях
    +  var METAKEYWORD = v7_meta_keywords + v8_meta_keywords;
    +
    +  // v7 системные константы ==> built_in
    +  var v7_system_constants =
    +  'разделительстраниц разделительстрок символтабуляции ';
    +
    +  // v7 уникальные методы глобального контекста, отсутствующие в v8 ==> built_in
    +  var v7_global_context_methods =
    +  'ansitooem oemtoansi ввестивидсубконто ввестиперечисление ввестипериод ввестиплансчетов выбранныйплансчетов ' +
    +  'датагод датамесяц датачисло заголовоксистемы значениевстроку значениеизстроки каталогиб каталогпользователя ' +
    +  'кодсимв конгода конецпериодаби конецрассчитанногопериодаби конецстандартногоинтервала конквартала конмесяца ' +
    +  'коннедели лог лог10 максимальноеколичествосубконто названиеинтерфейса названиенабораправ назначитьвид ' +
    +  'назначитьсчет найтиссылки началопериодаби началостандартногоинтервала начгода начквартала начмесяца ' +
    +  'начнедели номерднягода номерднянедели номернеделигода обработкаожидания основнойжурналрасчетов ' +
    +  'основнойплансчетов основнойязык очиститьокносообщений периодстр получитьвремята получитьдатута ' +
    +  'получитьдокументта получитьзначенияотбора получитьпозициюта получитьпустоезначение получитьта ' +
    +  'префиксавтонумерации пропись пустоезначение разм разобратьпозициюдокумента рассчитатьрегистрына ' +
    +  'рассчитатьрегистрыпо симв создатьобъект статусвозврата стрколичествострок сформироватьпозициюдокумента ' +
    +  'счетпокоду текущеевремя типзначения типзначениястр установитьтана установитьтапо фиксшаблон шаблон ';
    +
    +  // v8 методы глобального контекста ==> built_in
    +  var v8_global_context_methods =
    +  'acos asin atan base64значение base64строка cos exp log log10 pow sin sqrt tan xmlзначение xmlстрока ' +
    +  'xmlтип xmlтипзнч активноеокно безопасныйрежим безопасныйрежимразделенияданных булево ввестидату ввестизначение ' +
    +  'ввестистроку ввестичисло возможностьчтенияxml вопрос восстановитьзначение врег выгрузитьжурналрегистрации ' +
    +  'выполнитьобработкуоповещения выполнитьпроверкуправдоступа вычислить год данныеформывзначение дата день деньгода ' +
    +  'деньнедели добавитьмесяц заблокироватьданныедляредактирования заблокироватьработупользователя завершитьработусистемы ' +
    +  'загрузитьвнешнююкомпоненту закрытьсправку записатьjson записатьxml записатьдатуjson записьжурналарегистрации ' +
    +  'заполнитьзначениясвойств запроситьразрешениепользователя запуститьприложение запуститьсистему зафиксироватьтранзакцию ' +
    +  'значениевданныеформы значениевстрокувнутр значениевфайл значениезаполнено значениеизстрокивнутр значениеизфайла ' +
    +  'изxmlтипа импортмоделиxdto имякомпьютера имяпользователя инициализироватьпредопределенныеданные информацияобошибке ' +
    +  'каталогбиблиотекимобильногоустройства каталогвременныхфайлов каталогдокументов каталогпрограммы кодироватьстроку ' +
    +  'кодлокализацииинформационнойбазы кодсимвола командасистемы конецгода конецдня конецквартала конецмесяца конецминуты ' +
    +  'конецнедели конецчаса конфигурациябазыданныхизмененадинамически конфигурацияизменена копироватьданныеформы ' +
    +  'копироватьфайл краткоепредставлениеошибки лев макс местноевремя месяц мин минута монопольныйрежим найти ' +
    +  'найтинедопустимыесимволыxml найтиокнопонавигационнойссылке найтипомеченныенаудаление найтипоссылкам найтифайлы ' +
    +  'началогода началодня началоквартала началомесяца началоминуты началонедели началочаса начатьзапросразрешенияпользователя ' +
    +  'начатьзапускприложения начатькопированиефайла начатьперемещениефайла начатьподключениевнешнейкомпоненты ' +
    +  'начатьподключениерасширенияработыскриптографией начатьподключениерасширенияработысфайлами начатьпоискфайлов ' +
    +  'начатьполучениекаталогавременныхфайлов начатьполучениекаталогадокументов начатьполучениерабочегокаталогаданныхпользователя ' +
    +  'начатьполучениефайлов начатьпомещениефайла начатьпомещениефайлов начатьсозданиедвоичныхданныхизфайла начатьсозданиекаталога ' +
    +  'начатьтранзакцию начатьудалениефайлов начатьустановкувнешнейкомпоненты начатьустановкурасширенияработыскриптографией ' +
    +  'начатьустановкурасширенияработысфайлами неделягода необходимостьзавершениясоединения номерсеансаинформационнойбазы ' +
    +  'номерсоединенияинформационнойбазы нрег нстр обновитьинтерфейс обновитьнумерациюобъектов обновитьповторноиспользуемыезначения ' +
    +  'обработкапрерыванияпользователя объединитьфайлы окр описаниеошибки оповестить оповеститьобизменении ' +
    +  'отключитьобработчикзапросанастроекклиенталицензирования отключитьобработчикожидания отключитьобработчикоповещения ' +
    +  'открытьзначение открытьиндекссправки открытьсодержаниесправки открытьсправку открытьформу открытьформумодально ' +
    +  'отменитьтранзакцию очиститьжурналрегистрации очиститьнастройкипользователя очиститьсообщения параметрыдоступа ' +
    +  'перейтипонавигационнойссылке переместитьфайл подключитьвнешнююкомпоненту ' +
    +  'подключитьобработчикзапросанастроекклиенталицензирования подключитьобработчикожидания подключитьобработчикоповещения ' +
    +  'подключитьрасширениеработыскриптографией подключитьрасширениеработысфайлами подробноепредставлениеошибки ' +
    +  'показатьвводдаты показатьвводзначения показатьвводстроки показатьвводчисла показатьвопрос показатьзначение ' +
    +  'показатьинформациюобошибке показатьнакарте показатьоповещениепользователя показатьпредупреждение полноеимяпользователя ' +
    +  'получитьcomобъект получитьxmlтип получитьадреспоместоположению получитьблокировкусеансов получитьвремязавершенияспящегосеанса ' +
    +  'получитьвремязасыпанияпассивногосеанса получитьвремяожиданияблокировкиданных получитьданныевыбора ' +
    +  'получитьдополнительныйпараметрклиенталицензирования получитьдопустимыекодылокализации получитьдопустимыечасовыепояса ' +
    +  'получитьзаголовокклиентскогоприложения получитьзаголовоксистемы получитьзначенияотборажурналарегистрации ' +
    +  'получитьидентификаторконфигурации получитьизвременногохранилища получитьимявременногофайла ' +
    +  'получитьимяклиенталицензирования получитьинформациюэкрановклиента получитьиспользованиежурналарегистрации ' +
    +  'получитьиспользованиесобытияжурналарегистрации получитькраткийзаголовокприложения получитьмакетоформления ' +
    +  'получитьмаскувсефайлы получитьмаскувсефайлыклиента получитьмаскувсефайлысервера получитьместоположениепоадресу ' +
    +  'получитьминимальнуюдлинупаролейпользователей получитьнавигационнуюссылку получитьнавигационнуюссылкуинформационнойбазы ' +
    +  'получитьобновлениеконфигурациибазыданных получитьобновлениепредопределенныхданныхинформационнойбазы получитьобщиймакет ' +
    +  'получитьобщуюформу получитьокна получитьоперативнуюотметкувремени получитьотключениебезопасногорежима ' +
    +  'получитьпараметрыфункциональныхопцийинтерфейса получитьполноеимяпредопределенногозначения ' +
    +  'получитьпредставлениянавигационныхссылок получитьпроверкусложностипаролейпользователей получитьразделительпути ' +
    +  'получитьразделительпутиклиента получитьразделительпутисервера получитьсеансыинформационнойбазы ' +
    +  'получитьскоростьклиентскогосоединения получитьсоединенияинформационнойбазы получитьсообщенияпользователю ' +
    +  'получитьсоответствиеобъектаиформы получитьсоставстандартногоинтерфейсаodata получитьструктурухранениябазыданных ' +
    +  'получитьтекущийсеансинформационнойбазы получитьфайл получитьфайлы получитьформу получитьфункциональнуюопцию ' +
    +  'получитьфункциональнуюопциюинтерфейса получитьчасовойпоясинформационнойбазы пользователиос поместитьвовременноехранилище ' +
    +  'поместитьфайл поместитьфайлы прав праводоступа предопределенноезначение представлениекодалокализации представлениепериода ' +
    +  'представлениеправа представлениеприложения представлениесобытияжурналарегистрации представлениечасовогопояса предупреждение ' +
    +  'прекратитьработусистемы привилегированныйрежим продолжитьвызов прочитатьjson прочитатьxml прочитатьдатуjson пустаястрока ' +
    +  'рабочийкаталогданныхпользователя разблокироватьданныедляредактирования разделитьфайл разорватьсоединениесвнешнимисточникомданных ' +
    +  'раскодироватьстроку рольдоступна секунда сигнал символ скопироватьжурналрегистрации смещениелетнеговремени ' +
    +  'смещениестандартноговремени соединитьбуферыдвоичныхданных создатькаталог создатьфабрикуxdto сокрл сокрлп сокрп сообщить ' +
    +  'состояние сохранитьзначение сохранитьнастройкипользователя сред стрдлина стрзаканчиваетсяна стрзаменить стрнайти стрначинаетсяс ' +
    +  'строка строкасоединенияинформационнойбазы стрполучитьстроку стрразделить стрсоединить стрсравнить стрчисловхождений '+
    +  'стрчислострок стршаблон текущаядата текущаядатасеанса текущаяуниверсальнаядата текущаяуниверсальнаядатавмиллисекундах ' +
    +  'текущийвариантинтерфейсаклиентскогоприложения текущийвариантосновногошрифтаклиентскогоприложения текущийкодлокализации ' +
    +  'текущийрежимзапуска текущийязык текущийязыксистемы тип типзнч транзакцияактивна трег удалитьданныеинформационнойбазы ' +
    +  'удалитьизвременногохранилища удалитьобъекты удалитьфайлы универсальноевремя установитьбезопасныйрежим ' +
    +  'установитьбезопасныйрежимразделенияданных установитьблокировкусеансов установитьвнешнююкомпоненту ' +
    +  'установитьвремязавершенияспящегосеанса установитьвремязасыпанияпассивногосеанса установитьвремяожиданияблокировкиданных ' +
    +  'установитьзаголовокклиентскогоприложения установитьзаголовоксистемы установитьиспользованиежурналарегистрации ' +
    +  'установитьиспользованиесобытияжурналарегистрации установитькраткийзаголовокприложения ' +
    +  'установитьминимальнуюдлинупаролейпользователей установитьмонопольныйрежим установитьнастройкиклиенталицензирования ' +
    +  'установитьобновлениепредопределенныхданныхинформационнойбазы установитьотключениебезопасногорежима ' +
    +  'установитьпараметрыфункциональныхопцийинтерфейса установитьпривилегированныйрежим ' +
    +  'установитьпроверкусложностипаролейпользователей установитьрасширениеработыскриптографией ' +
    +  'установитьрасширениеработысфайлами установитьсоединениесвнешнимисточникомданных установитьсоответствиеобъектаиформы ' +
    +  'установитьсоставстандартногоинтерфейсаodata установитьчасовойпоясинформационнойбазы установитьчасовойпояссеанса ' +
    +  'формат цел час часовойпояс часовойпояссеанса число числопрописью этоадресвременногохранилища ';
    +
    +  // v8 свойства глобального контекста ==> built_in
    +  var v8_global_context_property =
    +  'wsссылки библиотекакартинок библиотекамакетовоформлениякомпоновкиданных библиотекастилей бизнеспроцессы ' +
    +  'внешниеисточникиданных внешниеобработки внешниеотчеты встроенныепокупки главныйинтерфейс главныйстиль ' +
    +  'документы доставляемыеуведомления журналыдокументов задачи информацияобинтернетсоединении использованиерабочейдаты ' +
    +  'историяработыпользователя константы критерииотбора метаданные обработки отображениерекламы отправкадоставляемыхуведомлений ' +
    +  'отчеты панельзадачос параметрзапуска параметрысеанса перечисления планывидоврасчета планывидовхарактеристик ' +
    +  'планыобмена планысчетов полнотекстовыйпоиск пользователиинформационнойбазы последовательности проверкавстроенныхпокупок ' +
    +  'рабочаядата расширенияконфигурации регистрыбухгалтерии регистрынакопления регистрырасчета регистрысведений ' +
    +  'регламентныезадания сериализаторxdto справочники средствагеопозиционирования средствакриптографии средствамультимедиа ' +
    +  'средстваотображениярекламы средствапочты средствателефонии фабрикаxdto файловыепотоки фоновыезадания хранилищанастроек ' +
    +  'хранилищевариантовотчетов хранилищенастроекданныхформ хранилищеобщихнастроек хранилищепользовательскихнастроекдинамическихсписков ' +
    +  'хранилищепользовательскихнастроекотчетов хранилищесистемныхнастроек ';
    +
    +  // built_in : встроенные или библиотечные объекты (константы, классы, функции)
    +  var BUILTIN =
    +  v7_system_constants +
    +  v7_global_context_methods + v8_global_context_methods +
    +  v8_global_context_property;
    +
    +  // v8 системные наборы значений ==> class
    +  var v8_system_sets_of_values =
    +  'webцвета windowsцвета windowsшрифты библиотекакартинок рамкистиля символы цветастиля шрифтыстиля ';
    +
    +  // v8 системные перечисления - интерфейсные ==> class
    +  var v8_system_enums_interface =
    +  'автоматическоесохранениеданныхформывнастройках автонумерациявформе автораздвижениесерий ' +
    +  'анимациядиаграммы вариантвыравниванияэлементовизаголовков вариантуправлениявысотойтаблицы ' +
    +  'вертикальнаяпрокруткаформы вертикальноеположение вертикальноеположениеэлемента видгруппыформы ' +
    +  'виддекорацииформы виддополненияэлементаформы видизмененияданных видкнопкиформы видпереключателя ' +
    +  'видподписейкдиаграмме видполяформы видфлажка влияниеразмеранапузырекдиаграммы горизонтальноеположение ' +
    +  'горизонтальноеположениеэлемента группировкаколонок группировкаподчиненныхэлементовформы ' +
    +  'группыиэлементы действиеперетаскивания дополнительныйрежимотображения допустимыедействияперетаскивания ' +
    +  'интервалмеждуэлементамиформы использованиевывода использованиеполосыпрокрутки ' +
    +  'используемоезначениеточкибиржевойдиаграммы историявыборапривводе источникзначенийоситочекдиаграммы ' +
    +  'источникзначенияразмерапузырькадиаграммы категориягруппыкоманд максимумсерий начальноеотображениедерева ' +
    +  'начальноеотображениесписка обновлениетекстаредактирования ориентациядендрограммы ориентациядиаграммы ' +
    +  'ориентацияметокдиаграммы ориентацияметоксводнойдиаграммы ориентацияэлементаформы отображениевдиаграмме ' +
    +  'отображениевлегендедиаграммы отображениегруппыкнопок отображениезаголовкашкалыдиаграммы ' +
    +  'отображениезначенийсводнойдиаграммы отображениезначенияизмерительнойдиаграммы ' +
    +  'отображениеинтерваладиаграммыганта отображениекнопки отображениекнопкивыбора отображениеобсужденийформы ' +
    +  'отображениеобычнойгруппы отображениеотрицательныхзначенийпузырьковойдиаграммы отображениепанелипоиска ' +
    +  'отображениеподсказки отображениепредупрежденияприредактировании отображениеразметкиполосырегулирования ' +
    +  'отображениестраницформы отображениетаблицы отображениетекстазначениядиаграммыганта ' +
    +  'отображениеуправленияобычнойгруппы отображениефигурыкнопки палитрацветовдиаграммы поведениеобычнойгруппы ' +
    +  'поддержкамасштабадендрограммы поддержкамасштабадиаграммыганта поддержкамасштабасводнойдиаграммы ' +
    +  'поисквтаблицепривводе положениезаголовкаэлементаформы положениекартинкикнопкиформы ' +
    +  'положениекартинкиэлементаграфическойсхемы положениекоманднойпанелиформы положениекоманднойпанелиэлементаформы ' +
    +  'положениеопорнойточкиотрисовки положениеподписейкдиаграмме положениеподписейшкалызначенийизмерительнойдиаграммы ' +
    +  'положениесостоянияпросмотра положениестрокипоиска положениетекстасоединительнойлинии положениеуправленияпоиском ' +
    +  'положениешкалывремени порядокотображенияточекгоризонтальнойгистограммы порядоксерийвлегендедиаграммы ' +
    +  'размеркартинки расположениезаголовкашкалыдиаграммы растягиваниеповертикалидиаграммыганта ' +
    +  'режимавтоотображениясостояния режимвводастроктаблицы режимвыборанезаполненного режимвыделениядаты ' +
    +  'режимвыделениястрокитаблицы режимвыделениятаблицы режимизмененияразмера режимизменениясвязанногозначения ' +
    +  'режимиспользованиядиалогапечати режимиспользованияпараметракоманды режиммасштабированияпросмотра ' +
    +  'режимосновногоокнаклиентскогоприложения режимоткрытияокнаформы режимотображениявыделения ' +
    +  'режимотображениягеографическойсхемы режимотображениязначенийсерии режимотрисовкисеткиграфическойсхемы ' +
    +  'режимполупрозрачностидиаграммы режимпробеловдиаграммы режимразмещениянастранице режимредактированияколонки ' +
    +  'режимсглаживаниядиаграммы режимсглаживанияиндикатора режимсписказадач сквозноевыравнивание ' +
    +  'сохранениеданныхформывнастройках способзаполнениятекстазаголовкашкалыдиаграммы ' +
    +  'способопределенияограничивающегозначениядиаграммы стандартнаягруппакоманд стандартноеоформление ' +
    +  'статусоповещенияпользователя стильстрелки типаппроксимациилиниитрендадиаграммы типдиаграммы ' +
    +  'типединицышкалывремени типимпортасерийслоягеографическойсхемы типлиниигеографическойсхемы типлиниидиаграммы ' +
    +  'типмаркерагеографическойсхемы типмаркерадиаграммы типобластиоформления ' +
    +  'типорганизацииисточникаданныхгеографическойсхемы типотображениясериислоягеографическойсхемы ' +
    +  'типотображенияточечногообъектагеографическойсхемы типотображенияшкалыэлементалегендыгеографическойсхемы ' +
    +  'типпоискаобъектовгеографическойсхемы типпроекциигеографическойсхемы типразмещенияизмерений ' +
    +  'типразмещенияреквизитовизмерений типрамкиэлементауправления типсводнойдиаграммы ' +
    +  'типсвязидиаграммыганта типсоединениязначенийпосериямдиаграммы типсоединенияточекдиаграммы ' +
    +  'типсоединительнойлинии типстороныэлементаграфическойсхемы типформыотчета типшкалырадарнойдиаграммы ' +
    +  'факторлиниитрендадиаграммы фигуракнопки фигурыграфическойсхемы фиксациявтаблице форматдняшкалывремени ' +
    +  'форматкартинки ширинаподчиненныхэлементовформы ';
    +
    +  // v8 системные перечисления - свойства прикладных объектов ==> class
    +  var v8_system_enums_objects_properties =
    +  'виддвижениябухгалтерии виддвижениянакопления видпериодарегистрарасчета видсчета видточкимаршрутабизнеспроцесса ' +
    +  'использованиеагрегатарегистранакопления использованиегруппиэлементов использованиережимапроведения ' +
    +  'использованиесреза периодичностьагрегатарегистранакопления режимавтовремя режимзаписидокумента режимпроведениядокумента ';
    +
    +  // v8 системные перечисления - планы обмена ==> class
    +  var v8_system_enums_exchange_plans =
    +  'авторегистрацияизменений допустимыйномерсообщения отправкаэлементаданных получениеэлементаданных ';
    +
    +  // v8 системные перечисления - табличный документ ==> class
    +  var v8_system_enums_tabular_document =
    +  'использованиерасшифровкитабличногодокумента ориентациястраницы положениеитоговколоноксводнойтаблицы ' +
    +  'положениеитоговстроксводнойтаблицы положениетекстаотносительнокартинки расположениезаголовкагруппировкитабличногодокумента ' +
    +  'способчтениязначенийтабличногодокумента типдвустороннейпечати типзаполненияобластитабличногодокумента ' +
    +  'типкурсоровтабличногодокумента типлиниирисункатабличногодокумента типлинииячейкитабличногодокумента ' +
    +  'типнаправленияпереходатабличногодокумента типотображениявыделениятабличногодокумента типотображениялинийсводнойтаблицы ' +
    +  'типразмещениятекстатабличногодокумента типрисункатабличногодокумента типсмещениятабличногодокумента ' +
    +  'типузоратабличногодокумента типфайлатабличногодокумента точностьпечати чередованиерасположениястраниц ';
    +
    +  // v8 системные перечисления - планировщик ==> class
    +  var v8_system_enums_sheduler =
    +  'отображениевремениэлементовпланировщика ';
    +
    +  // v8 системные перечисления - форматированный документ ==> class
    +  var v8_system_enums_formatted_document =
    +  'типфайлаформатированногодокумента ';
    +
    +  // v8 системные перечисления - запрос ==> class
    +  var v8_system_enums_query =
    +  'обходрезультатазапроса типзаписизапроса ';
    +
    +  // v8 системные перечисления - построитель отчета ==> class
    +  var v8_system_enums_report_builder =
    +  'видзаполнениярасшифровкипостроителяотчета типдобавленияпредставлений типизмеренияпостроителяотчета типразмещенияитогов ';
    +
    +  // v8 системные перечисления - работа с файлами ==> class
    +  var v8_system_enums_files =
    +  'доступкфайлу режимдиалогавыборафайла режимоткрытияфайла ';
    +
    +  // v8 системные перечисления - построитель запроса ==> class
    +  var v8_system_enums_query_builder =
    +  'типизмеренияпостроителязапроса ';
    +
    +  // v8 системные перечисления - анализ данных ==> class
    +  var v8_system_enums_data_analysis =
    +  'видданныханализа методкластеризации типединицыинтервалавременианализаданных типзаполнениятаблицырезультатаанализаданных ' +
    +  'типиспользованиячисловыхзначенийанализаданных типисточникаданныхпоискаассоциаций типколонкианализаданныхдереворешений ' +
    +  'типколонкианализаданныхкластеризация типколонкианализаданныхобщаястатистика типколонкианализаданныхпоискассоциаций ' +
    +  'типколонкианализаданныхпоискпоследовательностей типколонкимоделипрогноза типмерырасстоянияанализаданных ' +
    +  'типотсеченияправилассоциации типполяанализаданных типстандартизациианализаданных типупорядочиванияправилассоциациианализаданных ' +
    +  'типупорядочиванияшаблоновпоследовательностейанализаданных типупрощениядереварешений ';
    +
    +  // v8 системные перечисления - xml, json, xs, dom, xdto, web-сервисы ==> class
    +  var v8_system_enums_xml_json_xs_dom_xdto_ws =
    +  'wsнаправлениепараметра вариантxpathxs вариантзаписидатыjson вариантпростоготипаxs видгруппымоделиxs видфасетаxdto ' +
    +  'действиепостроителяdom завершенностьпростоготипаxs завершенностьсоставноготипаxs завершенностьсхемыxs запрещенныеподстановкиxs ' +
    +  'исключениягруппподстановкиxs категорияиспользованияатрибутаxs категорияограниченияидентичностиxs категорияограниченияпространствименxs ' +
    +  'методнаследованияxs модельсодержимогоxs назначениетипаxml недопустимыеподстановкиxs обработкапробельныхсимволовxs обработкасодержимогоxs ' +
    +  'ограничениезначенияxs параметрыотбораузловdom переносстрокjson позициявдокументеdom пробельныесимволыxml типатрибутаxml типзначенияjson ' +
    +  'типканоническогоxml типкомпонентыxs типпроверкиxml типрезультатаdomxpath типузлаdom типузлаxml формаxml формапредставленияxs ' +
    +  'форматдатыjson экранированиесимволовjson ';
    +
    +  // v8 системные перечисления - система компоновки данных ==> class
    +  var v8_system_enums_data_composition_system =
    +  'видсравнениякомпоновкиданных действиеобработкирасшифровкикомпоновкиданных направлениесортировкикомпоновкиданных ' +
    +  'расположениевложенныхэлементоврезультатакомпоновкиданных расположениеитоговкомпоновкиданных расположениегруппировкикомпоновкиданных ' +
    +  'расположениеполейгруппировкикомпоновкиданных расположениеполякомпоновкиданных расположениереквизитовкомпоновкиданных ' +
    +  'расположениересурсовкомпоновкиданных типбухгалтерскогоостаткакомпоновкиданных типвыводатекстакомпоновкиданных ' +
    +  'типгруппировкикомпоновкиданных типгруппыэлементовотборакомпоновкиданных типдополненияпериодакомпоновкиданных ' +
    +  'типзаголовкаполейкомпоновкиданных типмакетагруппировкикомпоновкиданных типмакетаобластикомпоновкиданных типостаткакомпоновкиданных ' +
    +  'типпериодакомпоновкиданных типразмещениятекстакомпоновкиданных типсвязинаборовданныхкомпоновкиданных типэлементарезультатакомпоновкиданных ' +
    +  'расположениелегендыдиаграммыкомпоновкиданных типпримененияотборакомпоновкиданных режимотображенияэлементанастройкикомпоновкиданных ' +
    +  'режимотображениянастроеккомпоновкиданных состояниеэлементанастройкикомпоновкиданных способвосстановлениянастроеккомпоновкиданных ' +
    +  'режимкомпоновкирезультата использованиепараметракомпоновкиданных автопозицияресурсовкомпоновкиданных '+
    +  'вариантиспользованиягруппировкикомпоновкиданных расположениересурсоввдиаграммекомпоновкиданных фиксациякомпоновкиданных ' +
    +  'использованиеусловногооформлениякомпоновкиданных ';
    +
    +  // v8 системные перечисления - почта ==> class
    +  var v8_system_enums_email =
    +  'важностьинтернетпочтовогосообщения обработкатекстаинтернетпочтовогосообщения способкодированияинтернетпочтовоговложения ' +
    +  'способкодированиянеasciiсимволовинтернетпочтовогосообщения типтекстапочтовогосообщения протоколинтернетпочты ' +
    +  'статусразборапочтовогосообщения ';
    +
    +  // v8 системные перечисления - журнал регистрации ==> class
    +  var v8_system_enums_logbook =
    +  'режимтранзакциизаписижурналарегистрации статустранзакциизаписижурналарегистрации уровеньжурналарегистрации ';
    +
    +  // v8 системные перечисления - криптография ==> class
    +  var v8_system_enums_cryptography =
    +  'расположениехранилищасертификатовкриптографии режимвключениясертификатовкриптографии режимпроверкисертификатакриптографии ' +
    +  'типхранилищасертификатовкриптографии ';
    +
    +  // v8 системные перечисления - ZIP ==> class
    +  var v8_system_enums_zip =
    +  'кодировкаименфайловвzipфайле методсжатияzip методшифрованияzip режимвосстановленияпутейфайловzip режимобработкиподкаталоговzip ' +
    +  'режимсохраненияпутейzip уровеньсжатияzip ';
    +
    +  // v8 системные перечисления -
    +  // Блокировка данных, Фоновые задания, Автоматизированное тестирование,
    +  // Доставляемые уведомления, Встроенные покупки, Интернет, Работа с двоичными данными ==> class
    +  var v8_system_enums_other =
    +  'звуковоеоповещение направлениепереходакстроке позициявпотоке порядокбайтов режимблокировкиданных режимуправленияблокировкойданных ' +
    +  'сервисвстроенныхпокупок состояниефоновогозадания типподписчикадоставляемыхуведомлений уровеньиспользованиязащищенногосоединенияftp ';
    +
    +  // v8 системные перечисления - схема запроса ==> class
    +  var v8_system_enums_request_schema =
    +  'направлениепорядкасхемызапроса типдополненияпериодамисхемызапроса типконтрольнойточкисхемызапроса типобъединениясхемызапроса ' +
    +  'типпараметрадоступнойтаблицысхемызапроса типсоединениясхемызапроса ';
    +
    +  // v8 системные перечисления - свойства объектов метаданных ==> class
    +  var v8_system_enums_properties_of_metadata_objects =
    +  'httpметод автоиспользованиеобщегореквизита автопрефиксномеразадачи вариантвстроенногоязыка видиерархии видрегистранакопления ' +
    +  'видтаблицывнешнегоисточникаданных записьдвиженийприпроведении заполнениепоследовательностей индексирование ' +
    +  'использованиебазыпланавидоврасчета использованиебыстроговыбора использованиеобщегореквизита использованиеподчинения ' +
    +  'использованиеполнотекстовогопоиска использованиеразделяемыхданныхобщегореквизита использованиереквизита ' +
    +  'назначениеиспользованияприложения назначениерасширенияконфигурации направлениепередачи обновлениепредопределенныхданных ' +
    +  'оперативноепроведение основноепредставлениевидарасчета основноепредставлениевидахарактеристики основноепредставлениезадачи ' +
    +  'основноепредставлениепланаобмена основноепредставлениесправочника основноепредставлениесчета перемещениеграницыприпроведении ' +
    +  'периодичностьномерабизнеспроцесса периодичностьномерадокумента периодичностьрегистрарасчета периодичностьрегистрасведений ' +
    +  'повторноеиспользованиевозвращаемыхзначений полнотекстовыйпоискпривводепостроке принадлежностьобъекта проведение ' +
    +  'разделениеаутентификацииобщегореквизита разделениеданныхобщегореквизита разделениерасширенийконфигурацииобщегореквизита '+
    +  'режимавтонумерацииобъектов режимзаписирегистра режимиспользованиямодальности ' +
    +  'режимиспользованиясинхронныхвызововрасширенийплатформыивнешнихкомпонент режимповторногоиспользованиясеансов ' +
    +  'режимполученияданныхвыборапривводепостроке режимсовместимости режимсовместимостиинтерфейса ' +
    +  'режимуправленияблокировкойданныхпоумолчанию сериикодовпланавидовхарактеристик сериикодовпланасчетов ' +
    +  'сериикодовсправочника созданиепривводе способвыбора способпоискастрокипривводепостроке способредактирования ' +
    +  'типданныхтаблицывнешнегоисточникаданных типкодапланавидоврасчета типкодасправочника типмакета типномерабизнеспроцесса ' +
    +  'типномерадокумента типномеразадачи типформы удалениедвижений ';
    +
    +  // v8 системные перечисления - разные ==> class
    +  var v8_system_enums_differents =
    +  'важностьпроблемыприменениярасширенияконфигурации вариантинтерфейсаклиентскогоприложения вариантмасштабаформклиентскогоприложения ' +
    +  'вариантосновногошрифтаклиентскогоприложения вариантстандартногопериода вариантстандартнойдатыначала видграницы видкартинки ' +
    +  'видотображенияполнотекстовогопоиска видрамки видсравнения видцвета видчисловогозначения видшрифта допустимаядлина допустимыйзнак ' +
    +  'использованиеbyteordermark использованиеметаданныхполнотекстовогопоиска источникрасширенийконфигурации клавиша кодвозвратадиалога ' +
    +  'кодировкаxbase кодировкатекста направлениепоиска направлениесортировки обновлениепредопределенныхданных обновлениеприизмененииданных ' +
    +  'отображениепанелиразделов проверказаполнения режимдиалогавопрос режимзапускаклиентскогоприложения режимокругления режимоткрытияформприложения ' +
    +  'режимполнотекстовогопоиска скоростьклиентскогосоединения состояниевнешнегоисточникаданных состояниеобновленияконфигурациибазыданных ' +
    +  'способвыборасертификатаwindows способкодированиястроки статуссообщения типвнешнейкомпоненты типплатформы типповеденияклавишиenter ' +
    +  'типэлементаинформацииовыполненииобновленияконфигурациибазыданных уровеньизоляциитранзакций хешфункция частидаты';
    +
    +  // class: встроенные наборы значений, системные перечисления (содержат дочерние значения, обращения к которым через разыменование)
    +  var CLASS =
    +  v8_system_sets_of_values +
    +  v8_system_enums_interface +
    +  v8_system_enums_objects_properties +
    +  v8_system_enums_exchange_plans +
    +  v8_system_enums_tabular_document +
    +  v8_system_enums_sheduler +
    +  v8_system_enums_formatted_document +
    +  v8_system_enums_query +
    +  v8_system_enums_report_builder +
    +  v8_system_enums_files +
    +  v8_system_enums_query_builder +
    +  v8_system_enums_data_analysis +
    +  v8_system_enums_xml_json_xs_dom_xdto_ws +
    +  v8_system_enums_data_composition_system +
    +  v8_system_enums_email +
    +  v8_system_enums_logbook +
    +  v8_system_enums_cryptography +
    +  v8_system_enums_zip +
    +  v8_system_enums_other +
    +  v8_system_enums_request_schema +
    +  v8_system_enums_properties_of_metadata_objects +
    +  v8_system_enums_differents;
    +
    +  // v8 общие объекты (у объектов есть конструктор, экземпляры создаются методом НОВЫЙ) ==> type
    +  var v8_shared_object =
    +  'comобъект ftpсоединение httpзапрос httpсервисответ httpсоединение wsопределения wsпрокси xbase анализданных аннотацияxs ' +
    +  'блокировкаданных буфердвоичныхданных включениеxs выражениекомпоновкиданных генераторслучайныхчисел географическаясхема ' +
    +  'географическиекоординаты графическаясхема группамоделиxs данныерасшифровкикомпоновкиданных двоичныеданные дендрограмма ' +
    +  'диаграмма диаграммаганта диалогвыборафайла диалогвыборацвета диалогвыборашрифта диалограсписаниярегламентногозадания ' +
    +  'диалогредактированиястандартногопериода диапазон документdom документhtml документацияxs доставляемоеуведомление ' +
    +  'записьdom записьfastinfoset записьhtml записьjson записьxml записьzipфайла записьданных записьтекста записьузловdom ' +
    +  'запрос защищенноесоединениеopenssl значенияполейрасшифровкикомпоновкиданных извлечениетекста импортxs интернетпочта ' +
    +  'интернетпочтовоесообщение интернетпочтовыйпрофиль интернетпрокси интернетсоединение информациядляприложенияxs ' +
    +  'использованиеатрибутаxs использованиесобытияжурналарегистрации источникдоступныхнастроеккомпоновкиданных ' +
    +  'итераторузловdom картинка квалификаторыдаты квалификаторыдвоичныхданных квалификаторыстроки квалификаторычисла ' +
    +  'компоновщикмакетакомпоновкиданных компоновщикнастроеккомпоновкиданных конструктормакетаоформлениякомпоновкиданных ' +
    +  'конструкторнастроеккомпоновкиданных конструкторформатнойстроки линия макеткомпоновкиданных макетобластикомпоновкиданных ' +
    +  'макетоформлениякомпоновкиданных маскаxs менеджеркриптографии наборсхемxml настройкикомпоновкиданных настройкисериализацииjson ' +
    +  'обработкакартинок обработкарасшифровкикомпоновкиданных обходдереваdom объявлениеатрибутаxs объявлениенотацииxs ' +
    +  'объявлениеэлементаxs описаниеиспользованиясобытиядоступжурналарегистрации ' +
    +  'описаниеиспользованиясобытияотказвдоступежурналарегистрации описаниеобработкирасшифровкикомпоновкиданных ' +
    +  'описаниепередаваемогофайла описаниетипов определениегруппыатрибутовxs определениегруппымоделиxs ' +
    +  'определениеограниченияидентичностиxs определениепростоготипаxs определениесоставноготипаxs определениетипадокументаdom ' +
    +  'определенияxpathxs отборкомпоновкиданных пакетотображаемыхдокументов параметрвыбора параметркомпоновкиданных ' +
    +  'параметрызаписиjson параметрызаписиxml параметрычтенияxml переопределениеxs планировщик полеанализаданных ' +
    +  'полекомпоновкиданных построительdom построительзапроса построительотчета построительотчетаанализаданных ' +
    +  'построительсхемxml поток потоквпамяти почта почтовоесообщение преобразованиеxsl преобразованиекканоническомуxml ' +
    +  'процессорвыводарезультатакомпоновкиданныхвколлекциюзначений процессорвыводарезультатакомпоновкиданныхвтабличныйдокумент ' +
    +  'процессоркомпоновкиданных разыменовательпространствименdom рамка расписаниерегламентногозадания расширенноеимяxml ' +
    +  'результатчтенияданных своднаядиаграмма связьпараметравыбора связьпотипу связьпотипукомпоновкиданных сериализаторxdto ' +
    +  'сертификатклиентаwindows сертификатклиентафайл сертификаткриптографии сертификатыудостоверяющихцентровwindows ' +
    +  'сертификатыудостоверяющихцентровфайл сжатиеданных системнаяинформация сообщениепользователю сочетаниеклавиш ' +
    +  'сравнениезначений стандартнаядатаначала стандартныйпериод схемаxml схемакомпоновкиданных табличныйдокумент ' +
    +  'текстовыйдокумент тестируемоеприложение типданныхxml уникальныйидентификатор фабрикаxdto файл файловыйпоток ' +
    +  'фасетдлиныxs фасетколичестваразрядовдробнойчастиxs фасетмаксимальноговключающегозначенияxs ' +
    +  'фасетмаксимальногоисключающегозначенияxs фасетмаксимальнойдлиныxs фасетминимальноговключающегозначенияxs ' +
    +  'фасетминимальногоисключающегозначенияxs фасетминимальнойдлиныxs фасетобразцаxs фасетобщегоколичестваразрядовxs ' +
    +  'фасетперечисленияxs фасетпробельныхсимволовxs фильтрузловdom форматированнаястрока форматированныйдокумент ' +
    +  'фрагментxs хешированиеданных хранилищезначения цвет чтениеfastinfoset чтениеhtml чтениеjson чтениеxml чтениеzipфайла ' +
    +  'чтениеданных чтениетекста чтениеузловdom шрифт элементрезультатакомпоновкиданных ';
    +
    +  // v8 универсальные коллекции значений ==> type
    +  var v8_universal_collection =
    +  'comsafearray деревозначений массив соответствие списокзначений структура таблицазначений фиксированнаяструктура ' +
    +  'фиксированноесоответствие фиксированныймассив ';
    +
    +  // type : встроенные типы
    +  var TYPE =
    +  v8_shared_object +
    +  v8_universal_collection;
    +
    +  // literal : примитивные типы
    +  var LITERAL = 'null истина ложь неопределено';
    +
    +  // number : числа
    +  var NUMBERS = hljs.inherit(hljs.NUMBER_MODE);
    +
    +  // string : строки
    +  var STRINGS = {
    +    className: 'string',
    +    begin: '"|\\|', end: '"|$',
    +    contains: [{begin: '""'}]
    +  };
    +
    +  // number : даты
    +  var DATE = {
    +    begin: "'", end: "'", excludeBegin: true, excludeEnd: true,
    +    contains: [
    +      {
    +        className: 'number',
    +        begin: '\\d{4}([\\.\\\\/:-]?\\d{2}){0,5}'
    +      }
    +    ]
    +  };
    +
    +  // comment : комментарии
    +  var COMMENTS = hljs.inherit(hljs.C_LINE_COMMENT_MODE);
    +
    +  // meta : инструкции препроцессора, директивы компиляции
    +  var META = {
    +    className: 'meta',
    +
    +    begin: '#|&', end: '$',
    +    keywords: {
    +      $pattern: UNDERSCORE_IDENT_RE,
    +      'meta-keyword': KEYWORD + METAKEYWORD
    +    },
    +    contains: [
    +      COMMENTS
    +    ]
    +  };
    +
    +  // symbol : метка goto
    +  var SYMBOL = {
    +    className: 'symbol',
    +    begin: '~', end: ';|:', excludeEnd: true
    +  };
    +
    +  // function : объявление процедур и функций
    +  var FUNCTION = {
    +    className: 'function',
    +    variants: [
    +      {begin: 'процедура|функция', end: '\\)', keywords: 'процедура функция'},
    +      {begin: 'конецпроцедуры|конецфункции', keywords: 'конецпроцедуры конецфункции'}
    +    ],
    +    contains: [
    +      {
    +        begin: '\\(', end: '\\)', endsParent : true,
    +        contains: [
    +          {
    +            className: 'params',
    +            begin: UNDERSCORE_IDENT_RE, end: ',', excludeEnd: true, endsWithParent: true,
    +            keywords: {
    +              $pattern: UNDERSCORE_IDENT_RE,
    +              keyword: 'знач',
    +              literal: LITERAL
    +            },
    +            contains: [
    +              NUMBERS,
    +              STRINGS,
    +              DATE
    +            ]
    +          },
    +          COMMENTS
    +        ]
    +      },
    +      hljs.inherit(hljs.TITLE_MODE, {begin: UNDERSCORE_IDENT_RE})
    +    ]
    +  };
    +
    +  return {
    +    name: '1C:Enterprise',
    +    case_insensitive: true,
    +    keywords: {
    +      $pattern: UNDERSCORE_IDENT_RE,
    +      keyword: KEYWORD,
    +      built_in: BUILTIN,
    +      class: CLASS,
    +      type: TYPE,
    +      literal: LITERAL
    +    },
    +    contains: [
    +      META,
    +      FUNCTION,
    +      COMMENTS,
    +      SYMBOL,
    +      NUMBERS,
    +      STRINGS,
    +      DATE
    +    ]
    +  };
    +}
    +
    +module.exports = _1c;
    diff --git a/node_modules/highlight.js/lib/languages/abnf.js b/node_modules/highlight.js/lib/languages/abnf.js
    new file mode 100644
    index 0000000..32e959c
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/abnf.js
    @@ -0,0 +1,77 @@
    +/*
    +Language: Augmented Backus-Naur Form
    +Author: Alex McKibben 
    +Website: https://tools.ietf.org/html/rfc5234
    +*/
    +
    +/** @type LanguageFn */
    +function abnf(hljs) {
    +  const regexes = {
    +    ruleDeclaration: "^[a-zA-Z][a-zA-Z0-9-]*",
    +    unexpectedChars: "[!@#$^&',?+~`|:]"
    +  };
    +
    +  const keywords = [
    +    "ALPHA",
    +    "BIT",
    +    "CHAR",
    +    "CR",
    +    "CRLF",
    +    "CTL",
    +    "DIGIT",
    +    "DQUOTE",
    +    "HEXDIG",
    +    "HTAB",
    +    "LF",
    +    "LWSP",
    +    "OCTET",
    +    "SP",
    +    "VCHAR",
    +    "WSP"
    +  ];
    +
    +  const commentMode = hljs.COMMENT(";", "$");
    +
    +  const terminalBinaryMode = {
    +    className: "symbol",
    +    begin: /%b[0-1]+(-[0-1]+|(\.[0-1]+)+){0,1}/
    +  };
    +
    +  const terminalDecimalMode = {
    +    className: "symbol",
    +    begin: /%d[0-9]+(-[0-9]+|(\.[0-9]+)+){0,1}/
    +  };
    +
    +  const terminalHexadecimalMode = {
    +    className: "symbol",
    +    begin: /%x[0-9A-F]+(-[0-9A-F]+|(\.[0-9A-F]+)+){0,1}/
    +  };
    +
    +  const caseSensitivityIndicatorMode = {
    +    className: "symbol",
    +    begin: /%[si]/
    +  };
    +
    +  const ruleDeclarationMode = {
    +    className: "attribute",
    +    begin: regexes.ruleDeclaration + '(?=\\s*=)'
    +  };
    +
    +  return {
    +    name: 'Augmented Backus-Naur Form',
    +    illegal: regexes.unexpectedChars,
    +    keywords: keywords.join(" "),
    +    contains: [
    +      ruleDeclarationMode,
    +      commentMode,
    +      terminalBinaryMode,
    +      terminalDecimalMode,
    +      terminalHexadecimalMode,
    +      caseSensitivityIndicatorMode,
    +      hljs.QUOTE_STRING_MODE,
    +      hljs.NUMBER_MODE
    +    ]
    +  };
    +}
    +
    +module.exports = abnf;
    diff --git a/node_modules/highlight.js/lib/languages/accesslog.js b/node_modules/highlight.js/lib/languages/accesslog.js
    new file mode 100644
    index 0000000..87b3afa
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/accesslog.js
    @@ -0,0 +1,79 @@
    +/*
    + Language: Apache Access Log
    + Author: Oleg Efimov 
    + Description: Apache/Nginx Access Logs
    + Website: https://httpd.apache.org/docs/2.4/logs.html#accesslog
    + */
    +
    +/** @type LanguageFn */
    +function accesslog(hljs) {
    +  // https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods
    +  const HTTP_VERBS = [
    +    "GET", "POST", "HEAD", "PUT", "DELETE", "CONNECT", "OPTIONS", "PATCH", "TRACE"
    +  ];
    +  return {
    +    name: 'Apache Access Log',
    +    contains: [
    +      // IP
    +      {
    +        className: 'number',
    +        begin: '^\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}(:\\d{1,5})?\\b',
    +        relevance: 5
    +      },
    +      // Other numbers
    +      {
    +        className: 'number',
    +        begin: '\\b\\d+\\b',
    +        relevance: 0
    +      },
    +      // Requests
    +      {
    +        className: 'string',
    +        begin: '"(' + HTTP_VERBS.join("|") + ')',
    +        end: '"',
    +        keywords: HTTP_VERBS.join(" "),
    +        illegal: '\\n',
    +        relevance: 5,
    +        contains: [{
    +          begin: 'HTTP/[12]\\.\\d',
    +          relevance: 5
    +        }]
    +      },
    +      // Dates
    +      {
    +        className: 'string',
    +        // dates must have a certain length, this prevents matching
    +        // simple array accesses a[123] and [] and other common patterns
    +        // found in other languages
    +        begin: /\[\d[^\]\n]{8,}\]/,
    +        illegal: '\\n',
    +        relevance: 1
    +      },
    +      {
    +        className: 'string',
    +        begin: /\[/,
    +        end: /\]/,
    +        illegal: '\\n',
    +        relevance: 0
    +      },
    +      // User agent / relevance boost
    +      {
    +        className: 'string',
    +        begin: '"Mozilla/\\d\\.\\d \\(',
    +        end: '"',
    +        illegal: '\\n',
    +        relevance: 3
    +      },
    +      // Strings
    +      {
    +        className: 'string',
    +        begin: '"',
    +        end: '"',
    +        illegal: '\\n',
    +        relevance: 0
    +      }
    +    ]
    +  };
    +}
    +
    +module.exports = accesslog;
    diff --git a/node_modules/highlight.js/lib/languages/actionscript.js b/node_modules/highlight.js/lib/languages/actionscript.js
    new file mode 100644
    index 0000000..bc58ad3
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/actionscript.js
    @@ -0,0 +1,87 @@
    +/*
    +Language: ActionScript
    +Author: Alexander Myadzel 
    +Category: scripting
    +*/
    +
    +/** @type LanguageFn */
    +function actionscript(hljs) {
    +  const IDENT_RE = '[a-zA-Z_$][a-zA-Z0-9_$]*';
    +  const IDENT_FUNC_RETURN_TYPE_RE = '([*]|[a-zA-Z_$][a-zA-Z0-9_$]*)';
    +
    +  const AS3_REST_ARG_MODE = {
    +    className: 'rest_arg',
    +    begin: '[.]{3}',
    +    end: IDENT_RE,
    +    relevance: 10
    +  };
    +
    +  return {
    +    name: 'ActionScript',
    +    aliases: ['as'],
    +    keywords: {
    +      keyword: 'as break case catch class const continue default delete do dynamic each ' +
    +        'else extends final finally for function get if implements import in include ' +
    +        'instanceof interface internal is namespace native new override package private ' +
    +        'protected public return set static super switch this throw try typeof use var void ' +
    +        'while with',
    +      literal: 'true false null undefined'
    +    },
    +    contains: [
    +      hljs.APOS_STRING_MODE,
    +      hljs.QUOTE_STRING_MODE,
    +      hljs.C_LINE_COMMENT_MODE,
    +      hljs.C_BLOCK_COMMENT_MODE,
    +      hljs.C_NUMBER_MODE,
    +      {
    +        className: 'class',
    +        beginKeywords: 'package',
    +        end: /\{/,
    +        contains: [hljs.TITLE_MODE]
    +      },
    +      {
    +        className: 'class',
    +        beginKeywords: 'class interface',
    +        end: /\{/,
    +        excludeEnd: true,
    +        contains: [
    +          { beginKeywords: 'extends implements' },
    +          hljs.TITLE_MODE
    +        ]
    +      },
    +      {
    +        className: 'meta',
    +        beginKeywords: 'import include',
    +        end: ';',
    +        keywords: { 'meta-keyword': 'import include' }
    +      },
    +      {
    +        className: 'function',
    +        beginKeywords: 'function',
    +        end: '[{;]',
    +        excludeEnd: true,
    +        illegal: '\\S',
    +        contains: [
    +          hljs.TITLE_MODE,
    +          {
    +            className: 'params',
    +            begin: '\\(',
    +            end: '\\)',
    +            contains: [
    +              hljs.APOS_STRING_MODE,
    +              hljs.QUOTE_STRING_MODE,
    +              hljs.C_LINE_COMMENT_MODE,
    +              hljs.C_BLOCK_COMMENT_MODE,
    +              AS3_REST_ARG_MODE
    +            ]
    +          },
    +          { begin: ':\\s*' + IDENT_FUNC_RETURN_TYPE_RE }
    +        ]
    +      },
    +      hljs.METHOD_GUARD
    +    ],
    +    illegal: /#/
    +  };
    +}
    +
    +module.exports = actionscript;
    diff --git a/node_modules/highlight.js/lib/languages/ada.js b/node_modules/highlight.js/lib/languages/ada.js
    new file mode 100644
    index 0000000..f427c65
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/ada.js
    @@ -0,0 +1,194 @@
    +/*
    +Language: Ada
    +Author: Lars Schulna 
    +Description: Ada is a general-purpose programming language that has great support for saftey critical and real-time applications.
    +             It has been developed by the DoD and thus has been used in military and safety-critical applications (like civil aviation).
    +             The first version appeared in the 80s, but it's still actively developed today with
    +             the newest standard being Ada2012.
    +*/
    +
    +// We try to support full Ada2012
    +//
    +// We highlight all appearances of types, keywords, literals (string, char, number, bool)
    +// and titles (user defined function/procedure/package)
    +// CSS classes are set accordingly
    +//
    +// Languages causing problems for language detection:
    +// xml (broken by Foo : Bar type), elm (broken by Foo : Bar type), vbscript-html (broken by body keyword)
    +// sql (ada default.txt has a lot of sql keywords)
    +
    +/** @type LanguageFn */
    +function ada(hljs) {
    +  // Regular expression for Ada numeric literals.
    +  // stolen form the VHDL highlighter
    +
    +  // Decimal literal:
    +  const INTEGER_RE = '\\d(_|\\d)*';
    +  const EXPONENT_RE = '[eE][-+]?' + INTEGER_RE;
    +  const DECIMAL_LITERAL_RE = INTEGER_RE + '(\\.' + INTEGER_RE + ')?' + '(' + EXPONENT_RE + ')?';
    +
    +  // Based literal:
    +  const BASED_INTEGER_RE = '\\w+';
    +  const BASED_LITERAL_RE = INTEGER_RE + '#' + BASED_INTEGER_RE + '(\\.' + BASED_INTEGER_RE + ')?' + '#' + '(' + EXPONENT_RE + ')?';
    +
    +  const NUMBER_RE = '\\b(' + BASED_LITERAL_RE + '|' + DECIMAL_LITERAL_RE + ')';
    +
    +  // Identifier regex
    +  const ID_REGEX = '[A-Za-z](_?[A-Za-z0-9.])*';
    +
    +  // bad chars, only allowed in literals
    +  const BAD_CHARS = `[]\\{\\}%#'"`;
    +
    +  // Ada doesn't have block comments, only line comments
    +  const COMMENTS = hljs.COMMENT('--', '$');
    +
    +  // variable declarations of the form
    +  // Foo : Bar := Baz;
    +  // where only Bar will be highlighted
    +  const VAR_DECLS = {
    +    // TODO: These spaces are not required by the Ada syntax
    +    // however, I have yet to see handwritten Ada code where
    +    // someone does not put spaces around :
    +    begin: '\\s+:\\s+',
    +    end: '\\s*(:=|;|\\)|=>|$)',
    +    // endsWithParent: true,
    +    // returnBegin: true,
    +    illegal: BAD_CHARS,
    +    contains: [
    +      {
    +        // workaround to avoid highlighting
    +        // named loops and declare blocks
    +        beginKeywords: 'loop for declare others',
    +        endsParent: true
    +      },
    +      {
    +        // properly highlight all modifiers
    +        className: 'keyword',
    +        beginKeywords: 'not null constant access function procedure in out aliased exception'
    +      },
    +      {
    +        className: 'type',
    +        begin: ID_REGEX,
    +        endsParent: true,
    +        relevance: 0
    +      }
    +    ]
    +  };
    +
    +  return {
    +    name: 'Ada',
    +    case_insensitive: true,
    +    keywords: {
    +      keyword:
    +                'abort else new return abs elsif not reverse abstract end ' +
    +                'accept entry select access exception of separate aliased exit or some ' +
    +                'all others subtype and for out synchronized array function overriding ' +
    +                'at tagged generic package task begin goto pragma terminate ' +
    +                'body private then if procedure type case in protected constant interface ' +
    +                'is raise use declare range delay limited record when delta loop rem while ' +
    +                'digits renames with do mod requeue xor',
    +      literal:
    +                'True False'
    +    },
    +    contains: [
    +      COMMENTS,
    +      // strings "foobar"
    +      {
    +        className: 'string',
    +        begin: /"/,
    +        end: /"/,
    +        contains: [{
    +          begin: /""/,
    +          relevance: 0
    +        }]
    +      },
    +      // characters ''
    +      {
    +        // character literals always contain one char
    +        className: 'string',
    +        begin: /'.'/
    +      },
    +      {
    +        // number literals
    +        className: 'number',
    +        begin: NUMBER_RE,
    +        relevance: 0
    +      },
    +      {
    +        // Attributes
    +        className: 'symbol',
    +        begin: "'" + ID_REGEX
    +      },
    +      {
    +        // package definition, maybe inside generic
    +        className: 'title',
    +        begin: '(\\bwith\\s+)?(\\bprivate\\s+)?\\bpackage\\s+(\\bbody\\s+)?',
    +        end: '(is|$)',
    +        keywords: 'package body',
    +        excludeBegin: true,
    +        excludeEnd: true,
    +        illegal: BAD_CHARS
    +      },
    +      {
    +        // function/procedure declaration/definition
    +        // maybe inside generic
    +        begin: '(\\b(with|overriding)\\s+)?\\b(function|procedure)\\s+',
    +        end: '(\\bis|\\bwith|\\brenames|\\)\\s*;)',
    +        keywords: 'overriding function procedure with is renames return',
    +        // we need to re-match the 'function' keyword, so that
    +        // the title mode below matches only exactly once
    +        returnBegin: true,
    +        contains:
    +                [
    +                  COMMENTS,
    +                  {
    +                    // name of the function/procedure
    +                    className: 'title',
    +                    begin: '(\\bwith\\s+)?\\b(function|procedure)\\s+',
    +                    end: '(\\(|\\s+|$)',
    +                    excludeBegin: true,
    +                    excludeEnd: true,
    +                    illegal: BAD_CHARS
    +                  },
    +                  // 'self'
    +                  // // parameter types
    +                  VAR_DECLS,
    +                  {
    +                    // return type
    +                    className: 'type',
    +                    begin: '\\breturn\\s+',
    +                    end: '(\\s+|;|$)',
    +                    keywords: 'return',
    +                    excludeBegin: true,
    +                    excludeEnd: true,
    +                    // we are done with functions
    +                    endsParent: true,
    +                    illegal: BAD_CHARS
    +
    +                  }
    +                ]
    +      },
    +      {
    +        // new type declarations
    +        // maybe inside generic
    +        className: 'type',
    +        begin: '\\b(sub)?type\\s+',
    +        end: '\\s+',
    +        keywords: 'type',
    +        excludeBegin: true,
    +        illegal: BAD_CHARS
    +      },
    +
    +      // see comment above the definition
    +      VAR_DECLS
    +
    +      // no markup
    +      // relevance boosters for small snippets
    +      // {begin: '\\s*=>\\s*'},
    +      // {begin: '\\s*:=\\s*'},
    +      // {begin: '\\s+:=\\s+'},
    +    ]
    +  };
    +}
    +
    +module.exports = ada;
    diff --git a/node_modules/highlight.js/lib/languages/angelscript.js b/node_modules/highlight.js/lib/languages/angelscript.js
    new file mode 100644
    index 0000000..ddbafbe
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/angelscript.js
    @@ -0,0 +1,123 @@
    +/*
    +Language: AngelScript
    +Author: Melissa Geels 
    +Category: scripting
    +Website: https://www.angelcode.com/angelscript/
    +*/
    +
    +/** @type LanguageFn */
    +function angelscript(hljs) {
    +  var builtInTypeMode = {
    +    className: 'built_in',
    +    begin: '\\b(void|bool|int|int8|int16|int32|int64|uint|uint8|uint16|uint32|uint64|string|ref|array|double|float|auto|dictionary)'
    +  };
    +
    +  var objectHandleMode = {
    +    className: 'symbol',
    +    begin: '[a-zA-Z0-9_]+@'
    +  };
    +
    +  var genericMode = {
    +    className: 'keyword',
    +    begin: '<', end: '>',
    +    contains: [ builtInTypeMode, objectHandleMode ]
    +  };
    +
    +  builtInTypeMode.contains = [ genericMode ];
    +  objectHandleMode.contains = [ genericMode ];
    +
    +  return {
    +    name: 'AngelScript',
    +    aliases: ['asc'],
    +
    +    keywords:
    +      'for in|0 break continue while do|0 return if else case switch namespace is cast ' +
    +      'or and xor not get|0 in inout|10 out override set|0 private public const default|0 ' +
    +      'final shared external mixin|10 enum typedef funcdef this super import from interface ' +
    +      'abstract|0 try catch protected explicit property',
    +
    +    // avoid close detection with C# and JS
    +    illegal: '(^using\\s+[A-Za-z0-9_\\.]+;$|\\bfunction\\s*[^\\(])',
    +
    +    contains: [
    +      { // 'strings'
    +        className: 'string',
    +        begin: '\'', end: '\'',
    +        illegal: '\\n',
    +        contains: [ hljs.BACKSLASH_ESCAPE ],
    +        relevance: 0
    +      },
    +
    +      // """heredoc strings"""
    +      {
    +        className: 'string',
    +        begin: '"""', end: '"""'
    +      },
    +
    +      { // "strings"
    +        className: 'string',
    +        begin: '"', end: '"',
    +        illegal: '\\n',
    +        contains: [ hljs.BACKSLASH_ESCAPE ],
    +        relevance: 0
    +      },
    +
    +      hljs.C_LINE_COMMENT_MODE, // single-line comments
    +      hljs.C_BLOCK_COMMENT_MODE, // comment blocks
    +
    +      { // metadata
    +        className: 'string',
    +        begin: '^\\s*\\[', end: '\\]',
    +      },
    +
    +      { // interface or namespace declaration
    +        beginKeywords: 'interface namespace', end: /\{/,
    +        illegal: '[;.\\-]',
    +        contains: [
    +          { // interface or namespace name
    +            className: 'symbol',
    +            begin: '[a-zA-Z0-9_]+'
    +          }
    +        ]
    +      },
    +
    +      { // class declaration
    +        beginKeywords: 'class', end: /\{/,
    +        illegal: '[;.\\-]',
    +        contains: [
    +          { // class name
    +            className: 'symbol',
    +            begin: '[a-zA-Z0-9_]+',
    +            contains: [
    +              {
    +                begin: '[:,]\\s*',
    +                contains: [
    +                  {
    +                    className: 'symbol',
    +                    begin: '[a-zA-Z0-9_]+'
    +                  }
    +                ]
    +              }
    +            ]
    +          }
    +        ]
    +      },
    +
    +      builtInTypeMode, // built-in types
    +      objectHandleMode, // object handles
    +
    +      { // literals
    +        className: 'literal',
    +        begin: '\\b(null|true|false)'
    +      },
    +
    +      { // numbers
    +        className: 'number',
    +        relevance: 0,
    +        begin: '(-?)(\\b0[xXbBoOdD][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?f?|\\.\\d+f?)([eE][-+]?\\d+f?)?)'
    +      }
    +    ]
    +  };
    +}
    +
    +module.exports = angelscript;
    diff --git a/node_modules/highlight.js/lib/languages/apache.js b/node_modules/highlight.js/lib/languages/apache.js
    new file mode 100644
    index 0000000..d9ec038
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/apache.js
    @@ -0,0 +1,84 @@
    +/*
    +Language: Apache config
    +Author: Ruslan Keba 
    +Contributors: Ivan Sagalaev 
    +Website: https://httpd.apache.org
    +Description: language definition for Apache configuration files (httpd.conf & .htaccess)
    +Category: common, config
    +*/
    +
    +/** @type LanguageFn */
    +function apache(hljs) {
    +  const NUMBER_REF = {
    +    className: 'number',
    +    begin: '[\\$%]\\d+'
    +  };
    +  const NUMBER = {
    +    className: 'number',
    +    begin: '\\d+'
    +  };
    +  const IP_ADDRESS = {
    +    className: "number",
    +    begin: '\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}(:\\d{1,5})?'
    +  };
    +  const PORT_NUMBER = {
    +    className: "number",
    +    begin: ":\\d{1,5}"
    +  };
    +  return {
    +    name: 'Apache config',
    +    aliases: ['apacheconf'],
    +    case_insensitive: true,
    +    contains: [
    +      hljs.HASH_COMMENT_MODE,
    +      {
    +        className: 'section',
    +        begin: '',
    +        contains: [
    +          IP_ADDRESS,
    +          PORT_NUMBER,
    +          // low relevance prevents us from claming XML/HTML where this rule would
    +          // match strings inside of XML tags
    +          hljs.inherit(hljs.QUOTE_STRING_MODE, { relevance: 0 })
    +        ]
    +      },
    +      {
    +        className: 'attribute',
    +        begin: /\w+/,
    +        relevance: 0,
    +        // keywords aren’t needed for highlighting per se, they only boost relevance
    +        // for a very generally defined mode (starts with a word, ends with line-end
    +        keywords: { nomarkup:
    +            'order deny allow setenv rewriterule rewriteengine rewritecond documentroot ' +
    +            'sethandler errordocument loadmodule options header listen serverroot ' +
    +            'servername' },
    +        starts: {
    +          end: /$/,
    +          relevance: 0,
    +          keywords: { literal: 'on off all deny allow' },
    +          contains: [
    +            {
    +              className: 'meta',
    +              begin: '\\s\\[',
    +              end: '\\]$'
    +            },
    +            {
    +              className: 'variable',
    +              begin: '[\\$%]\\{',
    +              end: '\\}',
    +              contains: ['self',
    +                NUMBER_REF]
    +            },
    +            IP_ADDRESS,
    +            NUMBER,
    +            hljs.QUOTE_STRING_MODE
    +          ]
    +        }
    +      }
    +    ],
    +    illegal: /\S/
    +  };
    +}
    +
    +module.exports = apache;
    diff --git a/node_modules/highlight.js/lib/languages/applescript.js b/node_modules/highlight.js/lib/languages/applescript.js
    new file mode 100644
    index 0000000..194a15e
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/applescript.js
    @@ -0,0 +1,109 @@
    +/*
    +Language: AppleScript
    +Authors: Nathan Grigg , Dr. Drang 
    +Category: scripting
    +Website: https://developer.apple.com/library/archive/documentation/AppleScript/Conceptual/AppleScriptLangGuide/introduction/ASLR_intro.html
    +*/
    +
    +/** @type LanguageFn */
    +function applescript(hljs) {
    +  const STRING = hljs.inherit(hljs.QUOTE_STRING_MODE, {
    +    illegal: ''
    +  });
    +  const PARAMS = {
    +    className: 'params',
    +    begin: '\\(',
    +    end: '\\)',
    +    contains: [
    +      'self',
    +      hljs.C_NUMBER_MODE,
    +      STRING
    +    ]
    +  };
    +  const COMMENT_MODE_1 = hljs.COMMENT('--', '$');
    +  const COMMENT_MODE_2 = hljs.COMMENT(
    +    '\\(\\*',
    +    '\\*\\)',
    +    {
    +      contains: [
    +        'self', // allow nesting
    +        COMMENT_MODE_1
    +      ]
    +    }
    +  );
    +  const COMMENTS = [
    +    COMMENT_MODE_1,
    +    COMMENT_MODE_2,
    +    hljs.HASH_COMMENT_MODE
    +  ];
    +
    +  return {
    +    name: 'AppleScript',
    +    aliases: ['osascript'],
    +    keywords: {
    +      keyword:
    +        'about above after against and around as at back before beginning ' +
    +        'behind below beneath beside between but by considering ' +
    +        'contain contains continue copy div does eighth else end equal ' +
    +        'equals error every exit fifth first for fourth from front ' +
    +        'get given global if ignoring in into is it its last local me ' +
    +        'middle mod my ninth not of on onto or over prop property put ref ' +
    +        'reference repeat returning script second set seventh since ' +
    +        'sixth some tell tenth that the|0 then third through thru ' +
    +        'timeout times to transaction try until where while whose with ' +
    +        'without',
    +      literal:
    +        'AppleScript false linefeed return pi quote result space tab true',
    +      built_in:
    +        'alias application boolean class constant date file integer list ' +
    +        'number real record string text ' +
    +        'activate beep count delay launch log offset read round ' +
    +        'run say summarize write ' +
    +        'character characters contents day frontmost id item length ' +
    +        'month name paragraph paragraphs rest reverse running time version ' +
    +        'weekday word words year'
    +    },
    +    contains: [
    +      STRING,
    +      hljs.C_NUMBER_MODE,
    +      {
    +        className: 'built_in',
    +        begin:
    +          '\\b(clipboard info|the clipboard|info for|list (disks|folder)|' +
    +          'mount volume|path to|(close|open for) access|(get|set) eof|' +
    +          'current date|do shell script|get volume settings|random number|' +
    +          'set volume|system attribute|system info|time to GMT|' +
    +          '(load|run|store) script|scripting components|' +
    +          'ASCII (character|number)|localized string|' +
    +          'choose (application|color|file|file name|' +
    +          'folder|from list|remote application|URL)|' +
    +          'display (alert|dialog))\\b|^\\s*return\\b'
    +      },
    +      {
    +        className: 'literal',
    +        begin:
    +          '\\b(text item delimiters|current application|missing value)\\b'
    +      },
    +      {
    +        className: 'keyword',
    +        begin:
    +          '\\b(apart from|aside from|instead of|out of|greater than|' +
    +          "isn't|(doesn't|does not) (equal|come before|come after|contain)|" +
    +          '(greater|less) than( or equal)?|(starts?|ends|begins?) with|' +
    +          'contained by|comes (before|after)|a (ref|reference)|POSIX file|' +
    +          'POSIX path|(date|time) string|quoted form)\\b'
    +      },
    +      {
    +        beginKeywords: 'on',
    +        illegal: '[${=;\\n]',
    +        contains: [
    +          hljs.UNDERSCORE_TITLE_MODE,
    +          PARAMS
    +        ]
    +      }
    +    ].concat(COMMENTS),
    +    illegal: '//|->|=>|\\[\\['
    +  };
    +}
    +
    +module.exports = applescript;
    diff --git a/node_modules/highlight.js/lib/languages/arcade.js b/node_modules/highlight.js/lib/languages/arcade.js
    new file mode 100644
    index 0000000..0c7a861
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/arcade.js
    @@ -0,0 +1,166 @@
    +/*
    + Language: ArcGIS Arcade
    + Category: scripting
    + Author: John Foster 
    + Website: https://developers.arcgis.com/arcade/
    + Description: ArcGIS Arcade is an expression language used in many Esri ArcGIS products such as Pro, Online, Server, Runtime, JavaScript, and Python
    +*/
    +
    +/** @type LanguageFn */
    +function arcade(hljs) {
    +  const IDENT_RE = '[A-Za-z_][0-9A-Za-z_]*';
    +  const KEYWORDS = {
    +    keyword:
    +      'if for while var new function do return void else break',
    +    literal:
    +      'BackSlash DoubleQuote false ForwardSlash Infinity NaN NewLine null PI SingleQuote Tab TextFormatting true undefined',
    +    built_in:
    +      'Abs Acos Angle Attachments Area AreaGeodetic Asin Atan Atan2 Average Bearing Boolean Buffer BufferGeodetic ' +
    +      'Ceil Centroid Clip Console Constrain Contains Cos Count Crosses Cut Date DateAdd ' +
    +      'DateDiff Day Decode DefaultValue Dictionary Difference Disjoint Distance DistanceGeodetic Distinct ' +
    +      'DomainCode DomainName Equals Exp Extent Feature FeatureSet FeatureSetByAssociation FeatureSetById FeatureSetByPortalItem ' +
    +      'FeatureSetByRelationshipName FeatureSetByTitle FeatureSetByUrl Filter First Floor Geometry GroupBy Guid HasKey Hour IIf IndexOf ' +
    +      'Intersection Intersects IsEmpty IsNan IsSelfIntersecting Length LengthGeodetic Log Max Mean Millisecond Min Minute Month ' +
    +      'MultiPartToSinglePart Multipoint NextSequenceValue Now Number OrderBy Overlaps Point Polygon ' +
    +      'Polyline Portal Pow Random Relate Reverse RingIsClockWise Round Second SetGeometry Sin Sort Sqrt Stdev Sum ' +
    +      'SymmetricDifference Tan Text Timestamp Today ToLocal Top Touches ToUTC TrackCurrentTime ' +
    +      'TrackGeometryWindow TrackIndex TrackStartTime TrackWindow TypeOf Union UrlEncode Variance ' +
    +      'Weekday When Within Year '
    +  };
    +  const SYMBOL = {
    +    className: 'symbol',
    +    begin: '\\$[datastore|feature|layer|map|measure|sourcefeature|sourcelayer|targetfeature|targetlayer|value|view]+'
    +  };
    +  const NUMBER = {
    +    className: 'number',
    +    variants: [
    +      {
    +        begin: '\\b(0[bB][01]+)'
    +      },
    +      {
    +        begin: '\\b(0[oO][0-7]+)'
    +      },
    +      {
    +        begin: hljs.C_NUMBER_RE
    +      }
    +    ],
    +    relevance: 0
    +  };
    +  const SUBST = {
    +    className: 'subst',
    +    begin: '\\$\\{',
    +    end: '\\}',
    +    keywords: KEYWORDS,
    +    contains: [] // defined later
    +  };
    +  const TEMPLATE_STRING = {
    +    className: 'string',
    +    begin: '`',
    +    end: '`',
    +    contains: [
    +      hljs.BACKSLASH_ESCAPE,
    +      SUBST
    +    ]
    +  };
    +  SUBST.contains = [
    +    hljs.APOS_STRING_MODE,
    +    hljs.QUOTE_STRING_MODE,
    +    TEMPLATE_STRING,
    +    NUMBER,
    +    hljs.REGEXP_MODE
    +  ];
    +  const PARAMS_CONTAINS = SUBST.contains.concat([
    +    hljs.C_BLOCK_COMMENT_MODE,
    +    hljs.C_LINE_COMMENT_MODE
    +  ]);
    +
    +  return {
    +    name: 'ArcGIS Arcade',
    +    aliases: ['arcade'],
    +    keywords: KEYWORDS,
    +    contains: [
    +      hljs.APOS_STRING_MODE,
    +      hljs.QUOTE_STRING_MODE,
    +      TEMPLATE_STRING,
    +      hljs.C_LINE_COMMENT_MODE,
    +      hljs.C_BLOCK_COMMENT_MODE,
    +      SYMBOL,
    +      NUMBER,
    +      { // object attr container
    +        begin: /[{,]\s*/,
    +        relevance: 0,
    +        contains: [{
    +          begin: IDENT_RE + '\\s*:',
    +          returnBegin: true,
    +          relevance: 0,
    +          contains: [{
    +            className: 'attr',
    +            begin: IDENT_RE,
    +            relevance: 0
    +          }]
    +        }]
    +      },
    +      { // "value" container
    +        begin: '(' + hljs.RE_STARTERS_RE + '|\\b(return)\\b)\\s*',
    +        keywords: 'return',
    +        contains: [
    +          hljs.C_LINE_COMMENT_MODE,
    +          hljs.C_BLOCK_COMMENT_MODE,
    +          hljs.REGEXP_MODE,
    +          {
    +            className: 'function',
    +            begin: '(\\(.*?\\)|' + IDENT_RE + ')\\s*=>',
    +            returnBegin: true,
    +            end: '\\s*=>',
    +            contains: [{
    +              className: 'params',
    +              variants: [
    +                {
    +                  begin: IDENT_RE
    +                },
    +                {
    +                  begin: /\(\s*\)/
    +                },
    +                {
    +                  begin: /\(/,
    +                  end: /\)/,
    +                  excludeBegin: true,
    +                  excludeEnd: true,
    +                  keywords: KEYWORDS,
    +                  contains: PARAMS_CONTAINS
    +                }
    +              ]
    +            }]
    +          }
    +        ],
    +        relevance: 0
    +      },
    +      {
    +        className: 'function',
    +        beginKeywords: 'function',
    +        end: /\{/,
    +        excludeEnd: true,
    +        contains: [
    +          hljs.inherit(hljs.TITLE_MODE, {
    +            begin: IDENT_RE
    +          }),
    +          {
    +            className: 'params',
    +            begin: /\(/,
    +            end: /\)/,
    +            excludeBegin: true,
    +            excludeEnd: true,
    +            contains: PARAMS_CONTAINS
    +          }
    +        ],
    +        illegal: /\[|%/
    +      },
    +      {
    +        begin: /\$[(.]/
    +      }
    +    ],
    +    illegal: /#(?!!)/
    +  };
    +}
    +
    +module.exports = arcade;
    diff --git a/node_modules/highlight.js/lib/languages/arduino.js b/node_modules/highlight.js/lib/languages/arduino.js
    new file mode 100644
    index 0000000..5c49306
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/arduino.js
    @@ -0,0 +1,444 @@
    +/**
    + * @param {string} value
    + * @returns {RegExp}
    + * */
    +
    +/**
    + * @param {RegExp | string } re
    + * @returns {string}
    + */
    +function source(re) {
    +  if (!re) return null;
    +  if (typeof re === "string") return re;
    +
    +  return re.source;
    +}
    +
    +/**
    + * @param {RegExp | string } re
    + * @returns {string}
    + */
    +function optional(re) {
    +  return concat('(', re, ')?');
    +}
    +
    +/**
    + * @param {...(RegExp | string) } args
    + * @returns {string}
    + */
    +function concat(...args) {
    +  const joined = args.map((x) => source(x)).join("");
    +  return joined;
    +}
    +
    +/*
    +Language: C-like foundation grammar for C/C++ grammars
    +Author: Ivan Sagalaev 
    +Contributors: Evgeny Stepanischev , Zaven Muradyan , Roel Deckers , Sam Wu , Jordi Petit , Pieter Vantorre , Google Inc. (David Benjamin) 
    +*/
    +
    +/** @type LanguageFn */
    +function cLike(hljs) {
    +  // added for historic reasons because `hljs.C_LINE_COMMENT_MODE` does
    +  // not include such support nor can we be sure all the grammars depending
    +  // on it would desire this behavior
    +  const C_LINE_COMMENT_MODE = hljs.COMMENT('//', '$', {
    +    contains: [
    +      {
    +        begin: /\\\n/
    +      }
    +    ]
    +  });
    +  const DECLTYPE_AUTO_RE = 'decltype\\(auto\\)';
    +  const NAMESPACE_RE = '[a-zA-Z_]\\w*::';
    +  const TEMPLATE_ARGUMENT_RE = '<[^<>]+>';
    +  const FUNCTION_TYPE_RE = '(' +
    +    DECLTYPE_AUTO_RE + '|' +
    +    optional(NAMESPACE_RE) +
    +    '[a-zA-Z_]\\w*' + optional(TEMPLATE_ARGUMENT_RE) +
    +  ')';
    +  const CPP_PRIMITIVE_TYPES = {
    +    className: 'keyword',
    +    begin: '\\b[a-z\\d_]*_t\\b'
    +  };
    +
    +  // https://en.cppreference.com/w/cpp/language/escape
    +  // \\ \x \xFF \u2837 \u00323747 \374
    +  const CHARACTER_ESCAPES = '\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)';
    +  const STRINGS = {
    +    className: 'string',
    +    variants: [
    +      {
    +        begin: '(u8?|U|L)?"',
    +        end: '"',
    +        illegal: '\\n',
    +        contains: [ hljs.BACKSLASH_ESCAPE ]
    +      },
    +      {
    +        begin: '(u8?|U|L)?\'(' + CHARACTER_ESCAPES + "|.)",
    +        end: '\'',
    +        illegal: '.'
    +      },
    +      hljs.END_SAME_AS_BEGIN({
    +        begin: /(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,
    +        end: /\)([^()\\ ]{0,16})"/
    +      })
    +    ]
    +  };
    +
    +  const NUMBERS = {
    +    className: 'number',
    +    variants: [
    +      {
    +        begin: '\\b(0b[01\']+)'
    +      },
    +      {
    +        begin: '(-?)\\b([\\d\']+(\\.[\\d\']*)?|\\.[\\d\']+)(u|U|l|L|ul|UL|f|F|b|B)'
    +      },
    +      {
    +        begin: '(-?)(\\b0[xX][a-fA-F0-9\']+|(\\b[\\d\']+(\\.[\\d\']*)?|\\.[\\d\']+)([eE][-+]?[\\d\']+)?)'
    +      }
    +    ],
    +    relevance: 0
    +  };
    +
    +  const PREPROCESSOR = {
    +    className: 'meta',
    +    begin: /#\s*[a-z]+\b/,
    +    end: /$/,
    +    keywords: {
    +      'meta-keyword':
    +        'if else elif endif define undef warning error line ' +
    +        'pragma _Pragma ifdef ifndef include'
    +    },
    +    contains: [
    +      {
    +        begin: /\\\n/,
    +        relevance: 0
    +      },
    +      hljs.inherit(STRINGS, {
    +        className: 'meta-string'
    +      }),
    +      {
    +        className: 'meta-string',
    +        begin: /<.*?>/,
    +        end: /$/,
    +        illegal: '\\n'
    +      },
    +      C_LINE_COMMENT_MODE,
    +      hljs.C_BLOCK_COMMENT_MODE
    +    ]
    +  };
    +
    +  const TITLE_MODE = {
    +    className: 'title',
    +    begin: optional(NAMESPACE_RE) + hljs.IDENT_RE,
    +    relevance: 0
    +  };
    +
    +  const FUNCTION_TITLE = optional(NAMESPACE_RE) + hljs.IDENT_RE + '\\s*\\(';
    +
    +  const CPP_KEYWORDS = {
    +    keyword: 'int float while private char char8_t char16_t char32_t catch import module export virtual operator sizeof ' +
    +      'dynamic_cast|10 typedef const_cast|10 const for static_cast|10 union namespace ' +
    +      'unsigned long volatile static protected bool template mutable if public friend ' +
    +      'do goto auto void enum else break extern using asm case typeid wchar_t ' +
    +      'short reinterpret_cast|10 default double register explicit signed typename try this ' +
    +      'switch continue inline delete alignas alignof constexpr consteval constinit decltype ' +
    +      'concept co_await co_return co_yield requires ' +
    +      'noexcept static_assert thread_local restrict final override ' +
    +      'atomic_bool atomic_char atomic_schar ' +
    +      'atomic_uchar atomic_short atomic_ushort atomic_int atomic_uint atomic_long atomic_ulong atomic_llong ' +
    +      'atomic_ullong new throw return ' +
    +      'and and_eq bitand bitor compl not not_eq or or_eq xor xor_eq',
    +    built_in: 'std string wstring cin cout cerr clog stdin stdout stderr stringstream istringstream ostringstream ' +
    +      'auto_ptr deque list queue stack vector map set pair bitset multiset multimap unordered_set ' +
    +      'unordered_map unordered_multiset unordered_multimap priority_queue make_pair array shared_ptr abort terminate abs acos ' +
    +      'asin atan2 atan calloc ceil cosh cos exit exp fabs floor fmod fprintf fputs free frexp ' +
    +      'fscanf future isalnum isalpha iscntrl isdigit isgraph islower isprint ispunct isspace isupper ' +
    +      'isxdigit tolower toupper labs ldexp log10 log malloc realloc memchr memcmp memcpy memset modf pow ' +
    +      'printf putchar puts scanf sinh sin snprintf sprintf sqrt sscanf strcat strchr strcmp ' +
    +      'strcpy strcspn strlen strncat strncmp strncpy strpbrk strrchr strspn strstr tanh tan ' +
    +      'vfprintf vprintf vsprintf endl initializer_list unique_ptr _Bool complex _Complex imaginary _Imaginary',
    +    literal: 'true false nullptr NULL'
    +  };
    +
    +  const EXPRESSION_CONTAINS = [
    +    PREPROCESSOR,
    +    CPP_PRIMITIVE_TYPES,
    +    C_LINE_COMMENT_MODE,
    +    hljs.C_BLOCK_COMMENT_MODE,
    +    NUMBERS,
    +    STRINGS
    +  ];
    +
    +  const EXPRESSION_CONTEXT = {
    +    // This mode covers expression context where we can't expect a function
    +    // definition and shouldn't highlight anything that looks like one:
    +    // `return some()`, `else if()`, `(x*sum(1, 2))`
    +    variants: [
    +      {
    +        begin: /=/,
    +        end: /;/
    +      },
    +      {
    +        begin: /\(/,
    +        end: /\)/
    +      },
    +      {
    +        beginKeywords: 'new throw return else',
    +        end: /;/
    +      }
    +    ],
    +    keywords: CPP_KEYWORDS,
    +    contains: EXPRESSION_CONTAINS.concat([
    +      {
    +        begin: /\(/,
    +        end: /\)/,
    +        keywords: CPP_KEYWORDS,
    +        contains: EXPRESSION_CONTAINS.concat([ 'self' ]),
    +        relevance: 0
    +      }
    +    ]),
    +    relevance: 0
    +  };
    +
    +  const FUNCTION_DECLARATION = {
    +    className: 'function',
    +    begin: '(' + FUNCTION_TYPE_RE + '[\\*&\\s]+)+' + FUNCTION_TITLE,
    +    returnBegin: true,
    +    end: /[{;=]/,
    +    excludeEnd: true,
    +    keywords: CPP_KEYWORDS,
    +    illegal: /[^\w\s\*&:<>]/,
    +    contains: [
    +      { // to prevent it from being confused as the function title
    +        begin: DECLTYPE_AUTO_RE,
    +        keywords: CPP_KEYWORDS,
    +        relevance: 0
    +      },
    +      {
    +        begin: FUNCTION_TITLE,
    +        returnBegin: true,
    +        contains: [ TITLE_MODE ],
    +        relevance: 0
    +      },
    +      {
    +        className: 'params',
    +        begin: /\(/,
    +        end: /\)/,
    +        keywords: CPP_KEYWORDS,
    +        relevance: 0,
    +        contains: [
    +          C_LINE_COMMENT_MODE,
    +          hljs.C_BLOCK_COMMENT_MODE,
    +          STRINGS,
    +          NUMBERS,
    +          CPP_PRIMITIVE_TYPES,
    +          // Count matching parentheses.
    +          {
    +            begin: /\(/,
    +            end: /\)/,
    +            keywords: CPP_KEYWORDS,
    +            relevance: 0,
    +            contains: [
    +              'self',
    +              C_LINE_COMMENT_MODE,
    +              hljs.C_BLOCK_COMMENT_MODE,
    +              STRINGS,
    +              NUMBERS,
    +              CPP_PRIMITIVE_TYPES
    +            ]
    +          }
    +        ]
    +      },
    +      CPP_PRIMITIVE_TYPES,
    +      C_LINE_COMMENT_MODE,
    +      hljs.C_BLOCK_COMMENT_MODE,
    +      PREPROCESSOR
    +    ]
    +  };
    +
    +  return {
    +    aliases: [
    +      'c',
    +      'cc',
    +      'h',
    +      'c++',
    +      'h++',
    +      'hpp',
    +      'hh',
    +      'hxx',
    +      'cxx'
    +    ],
    +    keywords: CPP_KEYWORDS,
    +    // the base c-like language will NEVER be auto-detected, rather the
    +    // derivitives: c, c++, arduino turn auto-detect back on for themselves
    +    disableAutodetect: true,
    +    illegal: ' rooms (9);`
    +          begin: '\\b(deque|list|queue|priority_queue|pair|stack|vector|map|set|bitset|multiset|multimap|unordered_map|unordered_set|unordered_multiset|unordered_multimap|array)\\s*<',
    +          end: '>',
    +          keywords: CPP_KEYWORDS,
    +          contains: [
    +            'self',
    +            CPP_PRIMITIVE_TYPES
    +          ]
    +        },
    +        {
    +          begin: hljs.IDENT_RE + '::',
    +          keywords: CPP_KEYWORDS
    +        },
    +        {
    +          className: 'class',
    +          beginKeywords: 'enum class struct union',
    +          end: /[{;:<>=]/,
    +          contains: [
    +            {
    +              beginKeywords: "final class struct"
    +            },
    +            hljs.TITLE_MODE
    +          ]
    +        }
    +      ]),
    +    exports: {
    +      preprocessor: PREPROCESSOR,
    +      strings: STRINGS,
    +      keywords: CPP_KEYWORDS
    +    }
    +  };
    +}
    +
    +/*
    +Language: C++
    +Category: common, system
    +Website: https://isocpp.org
    +*/
    +
    +/** @type LanguageFn */
    +function cPlusPlus(hljs) {
    +  const lang = cLike(hljs);
    +  // return auto-detection back on
    +  lang.disableAutodetect = false;
    +  lang.name = 'C++';
    +  lang.aliases = ['cc', 'c++', 'h++', 'hpp', 'hh', 'hxx', 'cxx'];
    +  return lang;
    +}
    +
    +/*
    +Language: Arduino
    +Author: Stefania Mellai 
    +Description: The Arduino® Language is a superset of C++. This rules are designed to highlight the Arduino® source code. For info about language see http://www.arduino.cc.
    +Website: https://www.arduino.cc
    +*/
    +
    +/** @type LanguageFn */
    +function arduino(hljs) {
    +  const ARDUINO_KW = {
    +    keyword:
    +      'boolean byte word String',
    +    built_in:
    +      'setup loop ' +
    +      'KeyboardController MouseController SoftwareSerial ' +
    +      'EthernetServer EthernetClient LiquidCrystal ' +
    +      'RobotControl GSMVoiceCall EthernetUDP EsploraTFT ' +
    +      'HttpClient RobotMotor WiFiClient GSMScanner ' +
    +      'FileSystem Scheduler GSMServer YunClient YunServer ' +
    +      'IPAddress GSMClient GSMModem Keyboard Ethernet ' +
    +      'Console GSMBand Esplora Stepper Process ' +
    +      'WiFiUDP GSM_SMS Mailbox USBHost Firmata PImage ' +
    +      'Client Server GSMPIN FileIO Bridge Serial ' +
    +      'EEPROM Stream Mouse Audio Servo File Task ' +
    +      'GPRS WiFi Wire TFT GSM SPI SD ' +
    +      'runShellCommandAsynchronously analogWriteResolution ' +
    +      'retrieveCallingNumber printFirmwareVersion ' +
    +      'analogReadResolution sendDigitalPortPair ' +
    +      'noListenOnLocalhost readJoystickButton setFirmwareVersion ' +
    +      'readJoystickSwitch scrollDisplayRight getVoiceCallStatus ' +
    +      'scrollDisplayLeft writeMicroseconds delayMicroseconds ' +
    +      'beginTransmission getSignalStrength runAsynchronously ' +
    +      'getAsynchronously listenOnLocalhost getCurrentCarrier ' +
    +      'readAccelerometer messageAvailable sendDigitalPorts ' +
    +      'lineFollowConfig countryNameWrite runShellCommand ' +
    +      'readStringUntil rewindDirectory readTemperature ' +
    +      'setClockDivider readLightSensor endTransmission ' +
    +      'analogReference detachInterrupt countryNameRead ' +
    +      'attachInterrupt encryptionType readBytesUntil ' +
    +      'robotNameWrite readMicrophone robotNameRead cityNameWrite ' +
    +      'userNameWrite readJoystickY readJoystickX mouseReleased ' +
    +      'openNextFile scanNetworks noInterrupts digitalWrite ' +
    +      'beginSpeaker mousePressed isActionDone mouseDragged ' +
    +      'displayLogos noAutoscroll addParameter remoteNumber ' +
    +      'getModifiers keyboardRead userNameRead waitContinue ' +
    +      'processInput parseCommand printVersion readNetworks ' +
    +      'writeMessage blinkVersion cityNameRead readMessage ' +
    +      'setDataMode parsePacket isListening setBitOrder ' +
    +      'beginPacket isDirectory motorsWrite drawCompass ' +
    +      'digitalRead clearScreen serialEvent rightToLeft ' +
    +      'setTextSize leftToRight requestFrom keyReleased ' +
    +      'compassRead analogWrite interrupts WiFiServer ' +
    +      'disconnect playMelody parseFloat autoscroll ' +
    +      'getPINUsed setPINUsed setTimeout sendAnalog ' +
    +      'readSlider analogRead beginWrite createChar ' +
    +      'motorsStop keyPressed tempoWrite readButton ' +
    +      'subnetMask debugPrint macAddress writeGreen ' +
    +      'randomSeed attachGPRS readString sendString ' +
    +      'remotePort releaseAll mouseMoved background ' +
    +      'getXChange getYChange answerCall getResult ' +
    +      'voiceCall endPacket constrain getSocket writeJSON ' +
    +      'getButton available connected findUntil readBytes ' +
    +      'exitValue readGreen writeBlue startLoop IPAddress ' +
    +      'isPressed sendSysex pauseMode gatewayIP setCursor ' +
    +      'getOemKey tuneWrite noDisplay loadImage switchPIN ' +
    +      'onRequest onReceive changePIN playFile noBuffer ' +
    +      'parseInt overflow checkPIN knobRead beginTFT ' +
    +      'bitClear updateIR bitWrite position writeRGB ' +
    +      'highByte writeRed setSpeed readBlue noStroke ' +
    +      'remoteIP transfer shutdown hangCall beginSMS ' +
    +      'endWrite attached maintain noCursor checkReg ' +
    +      'checkPUK shiftOut isValid shiftIn pulseIn ' +
    +      'connect println localIP pinMode getIMEI ' +
    +      'display noBlink process getBand running beginSD ' +
    +      'drawBMP lowByte setBand release bitRead prepare ' +
    +      'pointTo readRed setMode noFill remove listen ' +
    +      'stroke detach attach noTone exists buffer ' +
    +      'height bitSet circle config cursor random ' +
    +      'IRread setDNS endSMS getKey micros ' +
    +      'millis begin print write ready flush width ' +
    +      'isPIN blink clear press mkdir rmdir close ' +
    +      'point yield image BSSID click delay ' +
    +      'read text move peek beep rect line open ' +
    +      'seek fill size turn stop home find ' +
    +      'step tone sqrt RSSI SSID ' +
    +      'end bit tan cos sin pow map abs max ' +
    +      'min get run put',
    +    literal:
    +      'DIGITAL_MESSAGE FIRMATA_STRING ANALOG_MESSAGE ' +
    +      'REPORT_DIGITAL REPORT_ANALOG INPUT_PULLUP ' +
    +      'SET_PIN_MODE INTERNAL2V56 SYSTEM_RESET LED_BUILTIN ' +
    +      'INTERNAL1V1 SYSEX_START INTERNAL EXTERNAL ' +
    +      'DEFAULT OUTPUT INPUT HIGH LOW'
    +  };
    +
    +  const ARDUINO = cPlusPlus(hljs);
    +
    +  const kws = /** @type {Record} */ (ARDUINO.keywords);
    +
    +  kws.keyword += ' ' + ARDUINO_KW.keyword;
    +  kws.literal += ' ' + ARDUINO_KW.literal;
    +  kws.built_in += ' ' + ARDUINO_KW.built_in;
    +
    +  ARDUINO.name = 'Arduino';
    +  ARDUINO.aliases = ['ino'];
    +  ARDUINO.supersetOf = "cpp";
    +
    +  return ARDUINO;
    +}
    +
    +module.exports = arduino;
    diff --git a/node_modules/highlight.js/lib/languages/armasm.js b/node_modules/highlight.js/lib/languages/armasm.js
    new file mode 100644
    index 0000000..9b6dac3
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/armasm.js
    @@ -0,0 +1,131 @@
    +/*
    +Language: ARM Assembly
    +Author: Dan Panzarella 
    +Description: ARM Assembly including Thumb and Thumb2 instructions
    +Category: assembler
    +*/
    +
    +/** @type LanguageFn */
    +function armasm(hljs) {
    +  // local labels: %?[FB]?[AT]?\d{1,2}\w+
    +
    +  const COMMENT = {
    +    variants: [
    +      hljs.COMMENT('^[ \\t]*(?=#)', '$', {
    +        relevance: 0,
    +        excludeBegin: true
    +      }),
    +      hljs.COMMENT('[;@]', '$', {
    +        relevance: 0
    +      }),
    +      hljs.C_LINE_COMMENT_MODE,
    +      hljs.C_BLOCK_COMMENT_MODE
    +    ]
    +  };
    +
    +  return {
    +    name: 'ARM Assembly',
    +    case_insensitive: true,
    +    aliases: ['arm'],
    +    keywords: {
    +      $pattern: '\\.?' + hljs.IDENT_RE,
    +      meta:
    +        // GNU preprocs
    +        '.2byte .4byte .align .ascii .asciz .balign .byte .code .data .else .end .endif .endm .endr .equ .err .exitm .extern .global .hword .if .ifdef .ifndef .include .irp .long .macro .rept .req .section .set .skip .space .text .word .arm .thumb .code16 .code32 .force_thumb .thumb_func .ltorg ' +
    +        // ARM directives
    +        'ALIAS ALIGN ARM AREA ASSERT ATTR CN CODE CODE16 CODE32 COMMON CP DATA DCB DCD DCDU DCDO DCFD DCFDU DCI DCQ DCQU DCW DCWU DN ELIF ELSE END ENDFUNC ENDIF ENDP ENTRY EQU EXPORT EXPORTAS EXTERN FIELD FILL FUNCTION GBLA GBLL GBLS GET GLOBAL IF IMPORT INCBIN INCLUDE INFO KEEP LCLA LCLL LCLS LTORG MACRO MAP MEND MEXIT NOFP OPT PRESERVE8 PROC QN READONLY RELOC REQUIRE REQUIRE8 RLIST FN ROUT SETA SETL SETS SN SPACE SUBT THUMB THUMBX TTL WHILE WEND ',
    +      built_in:
    +        'r0 r1 r2 r3 r4 r5 r6 r7 r8 r9 r10 r11 r12 r13 r14 r15 ' + // standard registers
    +        'pc lr sp ip sl sb fp ' + // typical regs plus backward compatibility
    +        'a1 a2 a3 a4 v1 v2 v3 v4 v5 v6 v7 v8 f0 f1 f2 f3 f4 f5 f6 f7 ' + // more regs and fp
    +        'p0 p1 p2 p3 p4 p5 p6 p7 p8 p9 p10 p11 p12 p13 p14 p15 ' + // coprocessor regs
    +        'c0 c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 ' + // more coproc
    +        'q0 q1 q2 q3 q4 q5 q6 q7 q8 q9 q10 q11 q12 q13 q14 q15 ' + // advanced SIMD NEON regs
    +
    +        // program status registers
    +        'cpsr_c cpsr_x cpsr_s cpsr_f cpsr_cx cpsr_cxs cpsr_xs cpsr_xsf cpsr_sf cpsr_cxsf ' +
    +        'spsr_c spsr_x spsr_s spsr_f spsr_cx spsr_cxs spsr_xs spsr_xsf spsr_sf spsr_cxsf ' +
    +
    +        // NEON and VFP registers
    +        's0 s1 s2 s3 s4 s5 s6 s7 s8 s9 s10 s11 s12 s13 s14 s15 ' +
    +        's16 s17 s18 s19 s20 s21 s22 s23 s24 s25 s26 s27 s28 s29 s30 s31 ' +
    +        'd0 d1 d2 d3 d4 d5 d6 d7 d8 d9 d10 d11 d12 d13 d14 d15 ' +
    +        'd16 d17 d18 d19 d20 d21 d22 d23 d24 d25 d26 d27 d28 d29 d30 d31 ' +
    +
    +        '{PC} {VAR} {TRUE} {FALSE} {OPT} {CONFIG} {ENDIAN} {CODESIZE} {CPU} {FPU} {ARCHITECTURE} {PCSTOREOFFSET} {ARMASM_VERSION} {INTER} {ROPI} {RWPI} {SWST} {NOSWST} . @'
    +    },
    +    contains: [
    +      {
    +        className: 'keyword',
    +        begin: '\\b(' + // mnemonics
    +            'adc|' +
    +            '(qd?|sh?|u[qh]?)?add(8|16)?|usada?8|(q|sh?|u[qh]?)?(as|sa)x|' +
    +            'and|adrl?|sbc|rs[bc]|asr|b[lx]?|blx|bxj|cbn?z|tb[bh]|bic|' +
    +            'bfc|bfi|[su]bfx|bkpt|cdp2?|clz|clrex|cmp|cmn|cpsi[ed]|cps|' +
    +            'setend|dbg|dmb|dsb|eor|isb|it[te]{0,3}|lsl|lsr|ror|rrx|' +
    +            'ldm(([id][ab])|f[ds])?|ldr((s|ex)?[bhd])?|movt?|mvn|mra|mar|' +
    +            'mul|[us]mull|smul[bwt][bt]|smu[as]d|smmul|smmla|' +
    +            'mla|umlaal|smlal?([wbt][bt]|d)|mls|smlsl?[ds]|smc|svc|sev|' +
    +            'mia([bt]{2}|ph)?|mrr?c2?|mcrr2?|mrs|msr|orr|orn|pkh(tb|bt)|rbit|' +
    +            'rev(16|sh)?|sel|[su]sat(16)?|nop|pop|push|rfe([id][ab])?|' +
    +            'stm([id][ab])?|str(ex)?[bhd]?|(qd?)?sub|(sh?|q|u[qh]?)?sub(8|16)|' +
    +            '[su]xt(a?h|a?b(16)?)|srs([id][ab])?|swpb?|swi|smi|tst|teq|' +
    +            'wfe|wfi|yield' +
    +        ')' +
    +        '(eq|ne|cs|cc|mi|pl|vs|vc|hi|ls|ge|lt|gt|le|al|hs|lo)?' + // condition codes
    +        '[sptrx]?' + // legal postfixes
    +        '(?=\\s)' // followed by space
    +      },
    +      COMMENT,
    +      hljs.QUOTE_STRING_MODE,
    +      {
    +        className: 'string',
    +        begin: '\'',
    +        end: '[^\\\\]\'',
    +        relevance: 0
    +      },
    +      {
    +        className: 'title',
    +        begin: '\\|',
    +        end: '\\|',
    +        illegal: '\\n',
    +        relevance: 0
    +      },
    +      {
    +        className: 'number',
    +        variants: [
    +          { // hex
    +            begin: '[#$=]?0x[0-9a-f]+'
    +          },
    +          { // bin
    +            begin: '[#$=]?0b[01]+'
    +          },
    +          { // literal
    +            begin: '[#$=]\\d+'
    +          },
    +          { // bare number
    +            begin: '\\b\\d+'
    +          }
    +        ],
    +        relevance: 0
    +      },
    +      {
    +        className: 'symbol',
    +        variants: [
    +          { // GNU ARM syntax
    +            begin: '^[ \\t]*[a-z_\\.\\$][a-z0-9_\\.\\$]+:'
    +          },
    +          { // ARM syntax
    +            begin: '^[a-z_\\.\\$][a-z0-9_\\.\\$]+'
    +          },
    +          { // label reference
    +            begin: '[=#]\\w+'
    +          }
    +        ],
    +        relevance: 0
    +      }
    +    ]
    +  };
    +}
    +
    +module.exports = armasm;
    diff --git a/node_modules/highlight.js/lib/languages/asciidoc.js b/node_modules/highlight.js/lib/languages/asciidoc.js
    new file mode 100644
    index 0000000..68d8453
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/asciidoc.js
    @@ -0,0 +1,203 @@
    +/*
    +Language: AsciiDoc
    +Requires: xml.js
    +Author: Dan Allen 
    +Website: http://asciidoc.org
    +Description: A semantic, text-based document format that can be exported to HTML, DocBook and other backends.
    +Category: markup
    +*/
    +
    +/** @type LanguageFn */
    +function asciidoc(hljs) {
    +  return {
    +    name: 'AsciiDoc',
    +    aliases: ['adoc'],
    +    contains: [
    +      // block comment
    +      hljs.COMMENT(
    +        '^/{4,}\\n',
    +        '\\n/{4,}$',
    +        // can also be done as...
    +        // '^/{4,}$',
    +        // '^/{4,}$',
    +        {
    +          relevance: 10
    +        }
    +      ),
    +      // line comment
    +      hljs.COMMENT(
    +        '^//',
    +        '$',
    +        {
    +          relevance: 0
    +        }
    +      ),
    +      // title
    +      {
    +        className: 'title',
    +        begin: '^\\.\\w.*$'
    +      },
    +      // example, admonition & sidebar blocks
    +      {
    +        begin: '^[=\\*]{4,}\\n',
    +        end: '\\n^[=\\*]{4,}$',
    +        relevance: 10
    +      },
    +      // headings
    +      {
    +        className: 'section',
    +        relevance: 10,
    +        variants: [
    +          {
    +            begin: '^(={1,5}) .+?( \\1)?$'
    +          },
    +          {
    +            begin: '^[^\\[\\]\\n]+?\\n[=\\-~\\^\\+]{2,}$'
    +          }
    +        ]
    +      },
    +      // document attributes
    +      {
    +        className: 'meta',
    +        begin: '^:.+?:',
    +        end: '\\s',
    +        excludeEnd: true,
    +        relevance: 10
    +      },
    +      // block attributes
    +      {
    +        className: 'meta',
    +        begin: '^\\[.+?\\]$',
    +        relevance: 0
    +      },
    +      // quoteblocks
    +      {
    +        className: 'quote',
    +        begin: '^_{4,}\\n',
    +        end: '\\n_{4,}$',
    +        relevance: 10
    +      },
    +      // listing and literal blocks
    +      {
    +        className: 'code',
    +        begin: '^[\\-\\.]{4,}\\n',
    +        end: '\\n[\\-\\.]{4,}$',
    +        relevance: 10
    +      },
    +      // passthrough blocks
    +      {
    +        begin: '^\\+{4,}\\n',
    +        end: '\\n\\+{4,}$',
    +        contains: [{
    +          begin: '<',
    +          end: '>',
    +          subLanguage: 'xml',
    +          relevance: 0
    +        }],
    +        relevance: 10
    +      },
    +      // lists (can only capture indicators)
    +      {
    +        className: 'bullet',
    +        begin: '^(\\*+|-+|\\.+|[^\\n]+?::)\\s+'
    +      },
    +      // admonition
    +      {
    +        className: 'symbol',
    +        begin: '^(NOTE|TIP|IMPORTANT|WARNING|CAUTION):\\s+',
    +        relevance: 10
    +      },
    +      // inline strong
    +      {
    +        className: 'strong',
    +        // must not follow a word character or be followed by an asterisk or space
    +        begin: '\\B\\*(?![\\*\\s])',
    +        end: '(\\n{2}|\\*)',
    +        // allow escaped asterisk followed by word char
    +        contains: [{
    +          begin: '\\\\*\\w',
    +          relevance: 0
    +        }]
    +      },
    +      // inline emphasis
    +      {
    +        className: 'emphasis',
    +        // must not follow a word character or be followed by a single quote or space
    +        begin: '\\B\'(?![\'\\s])',
    +        end: '(\\n{2}|\')',
    +        // allow escaped single quote followed by word char
    +        contains: [{
    +          begin: '\\\\\'\\w',
    +          relevance: 0
    +        }],
    +        relevance: 0
    +      },
    +      // inline emphasis (alt)
    +      {
    +        className: 'emphasis',
    +        // must not follow a word character or be followed by an underline or space
    +        begin: '_(?![_\\s])',
    +        end: '(\\n{2}|_)',
    +        relevance: 0
    +      },
    +      // inline smart quotes
    +      {
    +        className: 'string',
    +        variants: [
    +          {
    +            begin: "``.+?''"
    +          },
    +          {
    +            begin: "`.+?'"
    +          }
    +        ]
    +      },
    +      // inline code snippets (TODO should get same treatment as strong and emphasis)
    +      {
    +        className: 'code',
    +        begin: '(`.+?`|\\+.+?\\+)',
    +        relevance: 0
    +      },
    +      // indented literal block
    +      {
    +        className: 'code',
    +        begin: '^[ \\t]',
    +        end: '$',
    +        relevance: 0
    +      },
    +      // horizontal rules
    +      {
    +        begin: '^\'{3,}[ \\t]*$',
    +        relevance: 10
    +      },
    +      // images and links
    +      {
    +        begin: '(link:)?(http|https|ftp|file|irc|image:?):\\S+?\\[[^[]*?\\]',
    +        returnBegin: true,
    +        contains: [
    +          {
    +            begin: '(link|image:?):',
    +            relevance: 0
    +          },
    +          {
    +            className: 'link',
    +            begin: '\\w',
    +            end: '[^\\[]+',
    +            relevance: 0
    +          },
    +          {
    +            className: 'string',
    +            begin: '\\[',
    +            end: '\\]',
    +            excludeBegin: true,
    +            excludeEnd: true,
    +            relevance: 0
    +          }
    +        ],
    +        relevance: 10
    +      }
    +    ]
    +  };
    +}
    +
    +module.exports = asciidoc;
    diff --git a/node_modules/highlight.js/lib/languages/aspectj.js b/node_modules/highlight.js/lib/languages/aspectj.js
    new file mode 100644
    index 0000000..f7454f8
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/aspectj.js
    @@ -0,0 +1,157 @@
    +/*
    +Language: AspectJ
    +Author: Hakan Ozler 
    +Website: https://www.eclipse.org/aspectj/
    +Description: Syntax Highlighting for the AspectJ Language which is a general-purpose aspect-oriented extension to the Java programming language.
    + */
    +
    +/** @type LanguageFn */
    +function aspectj(hljs) {
    +  const KEYWORDS = 'false synchronized int abstract float private char boolean static null if const ' +
    +    'for true while long throw strictfp finally protected import native final return void ' +
    +    'enum else extends implements break transient new catch instanceof byte super volatile case ' +
    +    'assert short package default double public try this switch continue throws privileged ' +
    +    'aspectOf adviceexecution proceed cflowbelow cflow initialization preinitialization ' +
    +    'staticinitialization withincode target within execution getWithinTypeName handler ' +
    +    'thisJoinPoint thisJoinPointStaticPart thisEnclosingJoinPointStaticPart declare parents ' +
    +    'warning error soft precedence thisAspectInstance';
    +  const SHORTKEYS = 'get set args call';
    +
    +  return {
    +    name: 'AspectJ',
    +    keywords: KEYWORDS,
    +    illegal: /<\/|#/,
    +    contains: [
    +      hljs.COMMENT(
    +        '/\\*\\*',
    +        '\\*/',
    +        {
    +          relevance: 0,
    +          contains: [
    +            {
    +              // eat up @'s in emails to prevent them to be recognized as doctags
    +              begin: /\w+@/,
    +              relevance: 0
    +            },
    +            {
    +              className: 'doctag',
    +              begin: '@[A-Za-z]+'
    +            }
    +          ]
    +        }
    +      ),
    +      hljs.C_LINE_COMMENT_MODE,
    +      hljs.C_BLOCK_COMMENT_MODE,
    +      hljs.APOS_STRING_MODE,
    +      hljs.QUOTE_STRING_MODE,
    +      {
    +        className: 'class',
    +        beginKeywords: 'aspect',
    +        end: /[{;=]/,
    +        excludeEnd: true,
    +        illegal: /[:;"\[\]]/,
    +        contains: [
    +          {
    +            beginKeywords: 'extends implements pertypewithin perthis pertarget percflowbelow percflow issingleton'
    +          },
    +          hljs.UNDERSCORE_TITLE_MODE,
    +          {
    +            begin: /\([^\)]*/,
    +            end: /[)]+/,
    +            keywords: KEYWORDS + ' ' + SHORTKEYS,
    +            excludeEnd: false
    +          }
    +        ]
    +      },
    +      {
    +        className: 'class',
    +        beginKeywords: 'class interface',
    +        end: /[{;=]/,
    +        excludeEnd: true,
    +        relevance: 0,
    +        keywords: 'class interface',
    +        illegal: /[:"\[\]]/,
    +        contains: [
    +          {
    +            beginKeywords: 'extends implements'
    +          },
    +          hljs.UNDERSCORE_TITLE_MODE
    +        ]
    +      },
    +      {
    +        // AspectJ Constructs
    +        beginKeywords: 'pointcut after before around throwing returning',
    +        end: /[)]/,
    +        excludeEnd: false,
    +        illegal: /["\[\]]/,
    +        contains: [{
    +          begin: hljs.UNDERSCORE_IDENT_RE + '\\s*\\(',
    +          returnBegin: true,
    +          contains: [hljs.UNDERSCORE_TITLE_MODE]
    +        }]
    +      },
    +      {
    +        begin: /[:]/,
    +        returnBegin: true,
    +        end: /[{;]/,
    +        relevance: 0,
    +        excludeEnd: false,
    +        keywords: KEYWORDS,
    +        illegal: /["\[\]]/,
    +        contains: [
    +          {
    +            begin: hljs.UNDERSCORE_IDENT_RE + '\\s*\\(',
    +            keywords: KEYWORDS + ' ' + SHORTKEYS,
    +            relevance: 0
    +          },
    +          hljs.QUOTE_STRING_MODE
    +        ]
    +      },
    +      {
    +        // this prevents 'new Name(...), or throw ...' from being recognized as a function definition
    +        beginKeywords: 'new throw',
    +        relevance: 0
    +      },
    +      {
    +        // the function class is a bit different for AspectJ compared to the Java language
    +        className: 'function',
    +        begin: /\w+ +\w+(\.\w+)?\s*\([^\)]*\)\s*((throws)[\w\s,]+)?[\{;]/,
    +        returnBegin: true,
    +        end: /[{;=]/,
    +        keywords: KEYWORDS,
    +        excludeEnd: true,
    +        contains: [
    +          {
    +            begin: hljs.UNDERSCORE_IDENT_RE + '\\s*\\(',
    +            returnBegin: true,
    +            relevance: 0,
    +            contains: [hljs.UNDERSCORE_TITLE_MODE]
    +          },
    +          {
    +            className: 'params',
    +            begin: /\(/,
    +            end: /\)/,
    +            relevance: 0,
    +            keywords: KEYWORDS,
    +            contains: [
    +              hljs.APOS_STRING_MODE,
    +              hljs.QUOTE_STRING_MODE,
    +              hljs.C_NUMBER_MODE,
    +              hljs.C_BLOCK_COMMENT_MODE
    +            ]
    +          },
    +          hljs.C_LINE_COMMENT_MODE,
    +          hljs.C_BLOCK_COMMENT_MODE
    +        ]
    +      },
    +      hljs.C_NUMBER_MODE,
    +      {
    +        // annotation is also used in this language
    +        className: 'meta',
    +        begin: '@[A-Za-z]+'
    +      }
    +    ]
    +  };
    +}
    +
    +module.exports = aspectj;
    diff --git a/node_modules/highlight.js/lib/languages/autohotkey.js b/node_modules/highlight.js/lib/languages/autohotkey.js
    new file mode 100644
    index 0000000..8dda10b
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/autohotkey.js
    @@ -0,0 +1,84 @@
    +/*
    +Language: AutoHotkey
    +Author: Seongwon Lee 
    +Description: AutoHotkey language definition
    +Category: scripting
    +*/
    +
    +/** @type LanguageFn */
    +function autohotkey(hljs) {
    +  const BACKTICK_ESCAPE = {
    +    begin: '`[\\s\\S]'
    +  };
    +
    +  return {
    +    name: 'AutoHotkey',
    +    case_insensitive: true,
    +    aliases: ['ahk'],
    +    keywords: {
    +      keyword: 'Break Continue Critical Exit ExitApp Gosub Goto New OnExit Pause return SetBatchLines SetTimer Suspend Thread Throw Until ahk_id ahk_class ahk_pid ahk_exe ahk_group',
    +      literal: 'true false NOT AND OR',
    +      built_in: 'ComSpec Clipboard ClipboardAll ErrorLevel'
    +    },
    +    contains: [
    +      BACKTICK_ESCAPE,
    +      hljs.inherit(hljs.QUOTE_STRING_MODE, {
    +        contains: [BACKTICK_ESCAPE]
    +      }),
    +      hljs.COMMENT(';', '$', {
    +        relevance: 0
    +      }),
    +      hljs.C_BLOCK_COMMENT_MODE,
    +      {
    +        className: 'number',
    +        begin: hljs.NUMBER_RE,
    +        relevance: 0
    +      },
    +      {
    +        // subst would be the most accurate however fails the point of
    +        // highlighting. variable is comparably the most accurate that actually
    +        // has some effect
    +        className: 'variable',
    +        begin: '%[a-zA-Z0-9#_$@]+%'
    +      },
    +      {
    +        className: 'built_in',
    +        begin: '^\\s*\\w+\\s*(,|%)'
    +        // I don't really know if this is totally relevant
    +      },
    +      {
    +        // symbol would be most accurate however is highlighted just like
    +        // built_in and that makes up a lot of AutoHotkey code meaning that it
    +        // would fail to highlight anything
    +        className: 'title',
    +        variants: [
    +          {
    +            begin: '^[^\\n";]+::(?!=)'
    +          },
    +          {
    +            begin: '^[^\\n";]+:(?!=)',
    +            // zero relevance as it catches a lot of things
    +            // followed by a single ':' in many languages
    +            relevance: 0
    +          }
    +        ]
    +      },
    +      {
    +        className: 'meta',
    +        begin: '^\\s*#\\w+',
    +        end: '$',
    +        relevance: 0
    +      },
    +      {
    +        className: 'built_in',
    +        begin: 'A_[a-zA-Z0-9]+'
    +      },
    +      {
    +        // consecutive commas, not for highlighting but just for relevance
    +        begin: ',\\s*,'
    +      }
    +    ]
    +  };
    +}
    +
    +module.exports = autohotkey;
    diff --git a/node_modules/highlight.js/lib/languages/autoit.js b/node_modules/highlight.js/lib/languages/autoit.js
    new file mode 100644
    index 0000000..fc8a36f
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/autoit.js
    @@ -0,0 +1,166 @@
    +/*
    +Language: AutoIt
    +Author: Manh Tuan 
    +Description: AutoIt language definition
    +Category: scripting
    +*/
    +
    +/** @type LanguageFn */
    +function autoit(hljs) {
    +  const KEYWORDS = 'ByRef Case Const ContinueCase ContinueLoop ' +
    +        'Default Dim Do Else ElseIf EndFunc EndIf EndSelect ' +
    +        'EndSwitch EndWith Enum Exit ExitLoop For Func ' +
    +        'Global If In Local Next ReDim Return Select Static ' +
    +        'Step Switch Then To Until Volatile WEnd While With';
    +
    +  const LITERAL = 'True False And Null Not Or';
    +
    +  const BUILT_IN
    +          = 'Abs ACos AdlibRegister AdlibUnRegister Asc AscW ASin Assign ATan AutoItSetOption AutoItWinGetTitle AutoItWinSetTitle Beep Binary BinaryLen BinaryMid BinaryToString BitAND BitNOT BitOR BitRotate BitShift BitXOR BlockInput Break Call CDTray Ceiling Chr ChrW ClipGet ClipPut ConsoleRead ConsoleWrite ConsoleWriteError ControlClick ControlCommand ControlDisable ControlEnable ControlFocus ControlGetFocus ControlGetHandle ControlGetPos ControlGetText ControlHide ControlListView ControlMove ControlSend ControlSetText ControlShow ControlTreeView Cos Dec DirCopy DirCreate DirGetSize DirMove DirRemove DllCall DllCallAddress DllCallbackFree DllCallbackGetPtr DllCallbackRegister DllClose DllOpen DllStructCreate DllStructGetData DllStructGetPtr DllStructGetSize DllStructSetData DriveGetDrive DriveGetFileSystem DriveGetLabel DriveGetSerial DriveGetType DriveMapAdd DriveMapDel DriveMapGet DriveSetLabel DriveSpaceFree DriveSpaceTotal DriveStatus EnvGet EnvSet EnvUpdate Eval Execute Exp FileChangeDir FileClose FileCopy FileCreateNTFSLink FileCreateShortcut FileDelete FileExists FileFindFirstFile FileFindNextFile FileFlush FileGetAttrib FileGetEncoding FileGetLongName FileGetPos FileGetShortcut FileGetShortName FileGetSize FileGetTime FileGetVersion FileInstall FileMove FileOpen FileOpenDialog FileRead FileReadLine FileReadToArray FileRecycle FileRecycleEmpty FileSaveDialog FileSelectFolder FileSetAttrib FileSetEnd FileSetPos FileSetTime FileWrite FileWriteLine Floor FtpSetProxy FuncName GUICreate GUICtrlCreateAvi GUICtrlCreateButton GUICtrlCreateCheckbox GUICtrlCreateCombo GUICtrlCreateContextMenu GUICtrlCreateDate GUICtrlCreateDummy GUICtrlCreateEdit GUICtrlCreateGraphic GUICtrlCreateGroup GUICtrlCreateIcon GUICtrlCreateInput GUICtrlCreateLabel GUICtrlCreateList GUICtrlCreateListView GUICtrlCreateListViewItem GUICtrlCreateMenu GUICtrlCreateMenuItem GUICtrlCreateMonthCal GUICtrlCreateObj GUICtrlCreatePic GUICtrlCreateProgress GUICtrlCreateRadio GUICtrlCreateSlider GUICtrlCreateTab GUICtrlCreateTabItem GUICtrlCreateTreeView GUICtrlCreateTreeViewItem GUICtrlCreateUpdown GUICtrlDelete GUICtrlGetHandle GUICtrlGetState GUICtrlRead GUICtrlRecvMsg GUICtrlRegisterListViewSort GUICtrlSendMsg GUICtrlSendToDummy GUICtrlSetBkColor GUICtrlSetColor GUICtrlSetCursor GUICtrlSetData GUICtrlSetDefBkColor GUICtrlSetDefColor GUICtrlSetFont GUICtrlSetGraphic GUICtrlSetImage GUICtrlSetLimit GUICtrlSetOnEvent GUICtrlSetPos GUICtrlSetResizing GUICtrlSetState GUICtrlSetStyle GUICtrlSetTip GUIDelete GUIGetCursorInfo GUIGetMsg GUIGetStyle GUIRegisterMsg GUISetAccelerators GUISetBkColor GUISetCoord GUISetCursor GUISetFont GUISetHelp GUISetIcon GUISetOnEvent GUISetState GUISetStyle GUIStartGroup GUISwitch Hex HotKeySet HttpSetProxy HttpSetUserAgent HWnd InetClose InetGet InetGetInfo InetGetSize InetRead IniDelete IniRead IniReadSection IniReadSectionNames IniRenameSection IniWrite IniWriteSection InputBox Int IsAdmin IsArray IsBinary IsBool IsDeclared IsDllStruct IsFloat IsFunc IsHWnd IsInt IsKeyword IsNumber IsObj IsPtr IsString Log MemGetStats Mod MouseClick MouseClickDrag MouseDown MouseGetCursor MouseGetPos MouseMove MouseUp MouseWheel MsgBox Number ObjCreate ObjCreateInterface ObjEvent ObjGet ObjName OnAutoItExitRegister OnAutoItExitUnRegister Ping PixelChecksum PixelGetColor PixelSearch ProcessClose ProcessExists ProcessGetStats ProcessList ProcessSetPriority ProcessWait ProcessWaitClose ProgressOff ProgressOn ProgressSet Ptr Random RegDelete RegEnumKey RegEnumVal RegRead RegWrite Round Run RunAs RunAsWait RunWait Send SendKeepActive SetError SetExtended ShellExecute ShellExecuteWait Shutdown Sin Sleep SoundPlay SoundSetWaveVolume SplashImageOn SplashOff SplashTextOn Sqrt SRandom StatusbarGetText StderrRead StdinWrite StdioClose StdoutRead String StringAddCR StringCompare StringFormat StringFromASCIIArray StringInStr StringIsAlNum StringIsAlpha StringIsASCII StringIsDigit StringIsFloat StringIsInt StringIsLower StringIsSpace StringIsUpper StringIsXDigit StringLeft StringLen StringLower StringMid StringRegExp StringRegExpReplace StringReplace StringReverse StringRight StringSplit StringStripCR StringStripWS StringToASCIIArray StringToBinary StringTrimLeft StringTrimRight StringUpper Tan TCPAccept TCPCloseSocket TCPConnect TCPListen TCPNameToIP TCPRecv TCPSend TCPShutdown, UDPShutdown TCPStartup, UDPStartup TimerDiff TimerInit ToolTip TrayCreateItem TrayCreateMenu TrayGetMsg TrayItemDelete TrayItemGetHandle TrayItemGetState TrayItemGetText TrayItemSetOnEvent TrayItemSetState TrayItemSetText TraySetClick TraySetIcon TraySetOnEvent TraySetPauseIcon TraySetState TraySetToolTip TrayTip UBound UDPBind UDPCloseSocket UDPOpen UDPRecv UDPSend VarGetType WinActivate WinActive WinClose WinExists WinFlash WinGetCaretPos WinGetClassList WinGetClientSize WinGetHandle WinGetPos WinGetProcess WinGetState WinGetText WinGetTitle WinKill WinList WinMenuSelectItem WinMinimizeAll WinMinimizeAllUndo WinMove WinSetOnTop WinSetState WinSetTitle WinSetTrans WinWait';
    +
    +  const COMMENT = {
    +    variants: [
    +      hljs.COMMENT(';', '$', {
    +        relevance: 0
    +      }),
    +      hljs.COMMENT('#cs', '#ce'),
    +      hljs.COMMENT('#comments-start', '#comments-end')
    +    ]
    +  };
    +
    +  const VARIABLE = {
    +    begin: '\\$[A-z0-9_]+'
    +  };
    +
    +  const STRING = {
    +    className: 'string',
    +    variants: [
    +      {
    +        begin: /"/,
    +        end: /"/,
    +        contains: [{
    +          begin: /""/,
    +          relevance: 0
    +        }]
    +      },
    +      {
    +        begin: /'/,
    +        end: /'/,
    +        contains: [{
    +          begin: /''/,
    +          relevance: 0
    +        }]
    +      }
    +    ]
    +  };
    +
    +  const NUMBER = {
    +    variants: [
    +      hljs.BINARY_NUMBER_MODE,
    +      hljs.C_NUMBER_MODE
    +    ]
    +  };
    +
    +  const PREPROCESSOR = {
    +    className: 'meta',
    +    begin: '#',
    +    end: '$',
    +    keywords: {
    +      'meta-keyword': 'comments include include-once NoTrayIcon OnAutoItStartRegister pragma compile RequireAdmin'
    +    },
    +    contains: [
    +      {
    +        begin: /\\\n/,
    +        relevance: 0
    +      },
    +      {
    +        beginKeywords: 'include',
    +        keywords: {
    +          'meta-keyword': 'include'
    +        },
    +        end: '$',
    +        contains: [
    +          STRING,
    +          {
    +            className: 'meta-string',
    +            variants: [
    +              {
    +                begin: '<',
    +                end: '>'
    +              },
    +              {
    +                begin: /"/,
    +                end: /"/,
    +                contains: [{
    +                  begin: /""/,
    +                  relevance: 0
    +                }]
    +              },
    +              {
    +                begin: /'/,
    +                end: /'/,
    +                contains: [{
    +                  begin: /''/,
    +                  relevance: 0
    +                }]
    +              }
    +            ]
    +          }
    +        ]
    +      },
    +      STRING,
    +      COMMENT
    +    ]
    +  };
    +
    +  const CONSTANT = {
    +    className: 'symbol',
    +    // begin: '@',
    +    // end: '$',
    +    // keywords: 'AppDataCommonDir AppDataDir AutoItExe AutoItPID AutoItVersion AutoItX64 COM_EventObj CommonFilesDir Compiled ComputerName ComSpec CPUArch CR CRLF DesktopCommonDir DesktopDepth DesktopDir DesktopHeight DesktopRefresh DesktopWidth DocumentsCommonDir error exitCode exitMethod extended FavoritesCommonDir FavoritesDir GUI_CtrlHandle GUI_CtrlId GUI_DragFile GUI_DragId GUI_DropId GUI_WinHandle HomeDrive HomePath HomeShare HotKeyPressed HOUR IPAddress1 IPAddress2 IPAddress3 IPAddress4 KBLayout LF LocalAppDataDir LogonDNSDomain LogonDomain LogonServer MDAY MIN MON MSEC MUILang MyDocumentsDir NumParams OSArch OSBuild OSLang OSServicePack OSType OSVersion ProgramFilesDir ProgramsCommonDir ProgramsDir ScriptDir ScriptFullPath ScriptLineNumber ScriptName SEC StartMenuCommonDir StartMenuDir StartupCommonDir StartupDir SW_DISABLE SW_ENABLE SW_HIDE SW_LOCK SW_MAXIMIZE SW_MINIMIZE SW_RESTORE SW_SHOW SW_SHOWDEFAULT SW_SHOWMAXIMIZED SW_SHOWMINIMIZED SW_SHOWMINNOACTIVE SW_SHOWNA SW_SHOWNOACTIVATE SW_SHOWNORMAL SW_UNLOCK SystemDir TAB TempDir TRAY_ID TrayIconFlashing TrayIconVisible UserName UserProfileDir WDAY WindowsDir WorkingDir YDAY YEAR',
    +    // relevance: 5
    +    begin: '@[A-z0-9_]+'
    +  };
    +
    +  const FUNCTION = {
    +    className: 'function',
    +    beginKeywords: 'Func',
    +    end: '$',
    +    illegal: '\\$|\\[|%',
    +    contains: [
    +      hljs.UNDERSCORE_TITLE_MODE,
    +      {
    +        className: 'params',
    +        begin: '\\(',
    +        end: '\\)',
    +        contains: [
    +          VARIABLE,
    +          STRING,
    +          NUMBER
    +        ]
    +      }
    +    ]
    +  };
    +
    +  return {
    +    name: 'AutoIt',
    +    case_insensitive: true,
    +    illegal: /\/\*/,
    +    keywords: {
    +      keyword: KEYWORDS,
    +      built_in: BUILT_IN,
    +      literal: LITERAL
    +    },
    +    contains: [
    +      COMMENT,
    +      VARIABLE,
    +      STRING,
    +      NUMBER,
    +      PREPROCESSOR,
    +      CONSTANT,
    +      FUNCTION
    +    ]
    +  };
    +}
    +
    +module.exports = autoit;
    diff --git a/node_modules/highlight.js/lib/languages/avrasm.js b/node_modules/highlight.js/lib/languages/avrasm.js
    new file mode 100644
    index 0000000..0f3b762
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/avrasm.js
    @@ -0,0 +1,80 @@
    +/*
    +Language: AVR Assembly
    +Author: Vladimir Ermakov 
    +Category: assembler
    +Website: https://www.microchip.com/webdoc/avrassembler/avrassembler.wb_instruction_list.html
    +*/
    +
    +/** @type LanguageFn */
    +function avrasm(hljs) {
    +  return {
    +    name: 'AVR Assembly',
    +    case_insensitive: true,
    +    keywords: {
    +      $pattern: '\\.?' + hljs.IDENT_RE,
    +      keyword:
    +        /* mnemonic */
    +        'adc add adiw and andi asr bclr bld brbc brbs brcc brcs break breq brge brhc brhs ' +
    +        'brid brie brlo brlt brmi brne brpl brsh brtc brts brvc brvs bset bst call cbi cbr ' +
    +        'clc clh cli cln clr cls clt clv clz com cp cpc cpi cpse dec eicall eijmp elpm eor ' +
    +        'fmul fmuls fmulsu icall ijmp in inc jmp ld ldd ldi lds lpm lsl lsr mov movw mul ' +
    +        'muls mulsu neg nop or ori out pop push rcall ret reti rjmp rol ror sbc sbr sbrc sbrs ' +
    +        'sec seh sbi sbci sbic sbis sbiw sei sen ser ses set sev sez sleep spm st std sts sub ' +
    +        'subi swap tst wdr',
    +      built_in:
    +        /* general purpose registers */
    +        'r0 r1 r2 r3 r4 r5 r6 r7 r8 r9 r10 r11 r12 r13 r14 r15 r16 r17 r18 r19 r20 r21 r22 ' +
    +        'r23 r24 r25 r26 r27 r28 r29 r30 r31 x|0 xh xl y|0 yh yl z|0 zh zl ' +
    +        /* IO Registers (ATMega128) */
    +        'ucsr1c udr1 ucsr1a ucsr1b ubrr1l ubrr1h ucsr0c ubrr0h tccr3c tccr3a tccr3b tcnt3h ' +
    +        'tcnt3l ocr3ah ocr3al ocr3bh ocr3bl ocr3ch ocr3cl icr3h icr3l etimsk etifr tccr1c ' +
    +        'ocr1ch ocr1cl twcr twdr twar twsr twbr osccal xmcra xmcrb eicra spmcsr spmcr portg ' +
    +        'ddrg ping portf ddrf sreg sph spl xdiv rampz eicrb eimsk gimsk gicr eifr gifr timsk ' +
    +        'tifr mcucr mcucsr tccr0 tcnt0 ocr0 assr tccr1a tccr1b tcnt1h tcnt1l ocr1ah ocr1al ' +
    +        'ocr1bh ocr1bl icr1h icr1l tccr2 tcnt2 ocr2 ocdr wdtcr sfior eearh eearl eedr eecr ' +
    +        'porta ddra pina portb ddrb pinb portc ddrc pinc portd ddrd pind spdr spsr spcr udr0 ' +
    +        'ucsr0a ucsr0b ubrr0l acsr admux adcsr adch adcl porte ddre pine pinf',
    +      meta:
    +        '.byte .cseg .db .def .device .dseg .dw .endmacro .equ .eseg .exit .include .list ' +
    +        '.listmac .macro .nolist .org .set'
    +    },
    +    contains: [
    +      hljs.C_BLOCK_COMMENT_MODE,
    +      hljs.COMMENT(
    +        ';',
    +        '$',
    +        {
    +          relevance: 0
    +        }
    +      ),
    +      hljs.C_NUMBER_MODE, // 0x..., decimal, float
    +      hljs.BINARY_NUMBER_MODE, // 0b...
    +      {
    +        className: 'number',
    +        begin: '\\b(\\$[a-zA-Z0-9]+|0o[0-7]+)' // $..., 0o...
    +      },
    +      hljs.QUOTE_STRING_MODE,
    +      {
    +        className: 'string',
    +        begin: '\'',
    +        end: '[^\\\\]\'',
    +        illegal: '[^\\\\][^\']'
    +      },
    +      {
    +        className: 'symbol',
    +        begin: '^[A-Za-z0-9_.$]+:'
    +      },
    +      {
    +        className: 'meta',
    +        begin: '#',
    +        end: '$'
    +      },
    +      { // substitution within a macro
    +        className: 'subst',
    +        begin: '@[0-9]+'
    +      }
    +    ]
    +  };
    +}
    +
    +module.exports = avrasm;
    diff --git a/node_modules/highlight.js/lib/languages/awk.js b/node_modules/highlight.js/lib/languages/awk.js
    new file mode 100644
    index 0000000..228e0cc
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/awk.js
    @@ -0,0 +1,73 @@
    +/*
    +Language: Awk
    +Author: Matthew Daly 
    +Website: https://www.gnu.org/software/gawk/manual/gawk.html
    +Description: language definition for Awk scripts
    +*/
    +
    +/** @type LanguageFn */
    +function awk(hljs) {
    +  const VARIABLE = {
    +    className: 'variable',
    +    variants: [
    +      {
    +        begin: /\$[\w\d#@][\w\d_]*/
    +      },
    +      {
    +        begin: /\$\{(.*?)\}/
    +      }
    +    ]
    +  };
    +  const KEYWORDS = 'BEGIN END if else while do for in break continue delete next nextfile function func exit|10';
    +  const STRING = {
    +    className: 'string',
    +    contains: [hljs.BACKSLASH_ESCAPE],
    +    variants: [
    +      {
    +        begin: /(u|b)?r?'''/,
    +        end: /'''/,
    +        relevance: 10
    +      },
    +      {
    +        begin: /(u|b)?r?"""/,
    +        end: /"""/,
    +        relevance: 10
    +      },
    +      {
    +        begin: /(u|r|ur)'/,
    +        end: /'/,
    +        relevance: 10
    +      },
    +      {
    +        begin: /(u|r|ur)"/,
    +        end: /"/,
    +        relevance: 10
    +      },
    +      {
    +        begin: /(b|br)'/,
    +        end: /'/
    +      },
    +      {
    +        begin: /(b|br)"/,
    +        end: /"/
    +      },
    +      hljs.APOS_STRING_MODE,
    +      hljs.QUOTE_STRING_MODE
    +    ]
    +  };
    +  return {
    +    name: 'Awk',
    +    keywords: {
    +      keyword: KEYWORDS
    +    },
    +    contains: [
    +      VARIABLE,
    +      STRING,
    +      hljs.REGEXP_MODE,
    +      hljs.HASH_COMMENT_MODE,
    +      hljs.NUMBER_MODE
    +    ]
    +  };
    +}
    +
    +module.exports = awk;
    diff --git a/node_modules/highlight.js/lib/languages/axapta.js b/node_modules/highlight.js/lib/languages/axapta.js
    new file mode 100644
    index 0000000..8b8d456
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/axapta.js
    @@ -0,0 +1,179 @@
    +/*
    +Language: Microsoft X++
    +Description: X++ is a language used in Microsoft Dynamics 365, Dynamics AX, and Axapta.
    +Author: Dmitri Roudakov 
    +Website: https://dynamics.microsoft.com/en-us/ax-overview/
    +Category: enterprise
    +*/
    +
    +/** @type LanguageFn */
    +function axapta(hljs) {
    +  const BUILT_IN_KEYWORDS = [
    +    'anytype',
    +    'boolean',
    +    'byte',
    +    'char',
    +    'container',
    +    'date',
    +    'double',
    +    'enum',
    +    'guid',
    +    'int',
    +    'int64',
    +    'long',
    +    'real',
    +    'short',
    +    'str',
    +    'utcdatetime',
    +    'var'
    +  ];
    +
    +  const LITERAL_KEYWORDS = [
    +    'default',
    +    'false',
    +    'null',
    +    'true'
    +  ];
    +
    +  const NORMAL_KEYWORDS = [
    +    'abstract',
    +    'as',
    +    'asc',
    +    'avg',
    +    'break',
    +    'breakpoint',
    +    'by',
    +    'byref',
    +    'case',
    +    'catch',
    +    'changecompany',
    +    'class',
    +    'client',
    +    'client',
    +    'common',
    +    'const',
    +    'continue',
    +    'count',
    +    'crosscompany',
    +    'delegate',
    +    'delete_from',
    +    'desc',
    +    'display',
    +    'div',
    +    'do',
    +    'edit',
    +    'else',
    +    'eventhandler',
    +    'exists',
    +    'extends',
    +    'final',
    +    'finally',
    +    'firstfast',
    +    'firstonly',
    +    'firstonly1',
    +    'firstonly10',
    +    'firstonly100',
    +    'firstonly1000',
    +    'flush',
    +    'for',
    +    'forceliterals',
    +    'forcenestedloop',
    +    'forceplaceholders',
    +    'forceselectorder',
    +    'forupdate',
    +    'from',
    +    'generateonly',
    +    'group',
    +    'hint',
    +    'if',
    +    'implements',
    +    'in',
    +    'index',
    +    'insert_recordset',
    +    'interface',
    +    'internal',
    +    'is',
    +    'join',
    +    'like',
    +    'maxof',
    +    'minof',
    +    'mod',
    +    'namespace',
    +    'new',
    +    'next',
    +    'nofetch',
    +    'notexists',
    +    'optimisticlock',
    +    'order',
    +    'outer',
    +    'pessimisticlock',
    +    'print',
    +    'private',
    +    'protected',
    +    'public',
    +    'readonly',
    +    'repeatableread',
    +    'retry',
    +    'return',
    +    'reverse',
    +    'select',
    +    'server',
    +    'setting',
    +    'static',
    +    'sum',
    +    'super',
    +    'switch',
    +    'this',
    +    'throw',
    +    'try',
    +    'ttsabort',
    +    'ttsbegin',
    +    'ttscommit',
    +    'unchecked',
    +    'update_recordset',
    +    'using',
    +    'validtimestate',
    +    'void',
    +    'where',
    +    'while'
    +  ];
    +
    +  const KEYWORDS = {
    +    keyword: NORMAL_KEYWORDS.join(' '),
    +    built_in: BUILT_IN_KEYWORDS.join(' '),
    +    literal: LITERAL_KEYWORDS.join(' ')
    +  };
    +
    +  return {
    +    name: 'X++',
    +    aliases: ['x++'],
    +    keywords: KEYWORDS,
    +    contains: [
    +      hljs.C_LINE_COMMENT_MODE,
    +      hljs.C_BLOCK_COMMENT_MODE,
    +      hljs.APOS_STRING_MODE,
    +      hljs.QUOTE_STRING_MODE,
    +      hljs.C_NUMBER_MODE,
    +      {
    +        className: 'meta',
    +        begin: '#',
    +        end: '$'
    +      },
    +      {
    +        className: 'class',
    +        beginKeywords: 'class interface',
    +        end: /\{/,
    +        excludeEnd: true,
    +        illegal: ':',
    +        contains: [
    +          {
    +            beginKeywords: 'extends implements'
    +          },
    +          hljs.UNDERSCORE_TITLE_MODE
    +        ]
    +      }
    +    ]
    +  };
    +}
    +
    +module.exports = axapta;
    diff --git a/node_modules/highlight.js/lib/languages/bash.js b/node_modules/highlight.js/lib/languages/bash.js
    new file mode 100644
    index 0000000..bfbf4d1
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/bash.js
    @@ -0,0 +1,169 @@
    +/**
    + * @param {string} value
    + * @returns {RegExp}
    + * */
    +
    +/**
    + * @param {RegExp | string } re
    + * @returns {string}
    + */
    +function source(re) {
    +  if (!re) return null;
    +  if (typeof re === "string") return re;
    +
    +  return re.source;
    +}
    +
    +/**
    + * @param {...(RegExp | string) } args
    + * @returns {string}
    + */
    +function concat(...args) {
    +  const joined = args.map((x) => source(x)).join("");
    +  return joined;
    +}
    +
    +/*
    +Language: Bash
    +Author: vah 
    +Contributrors: Benjamin Pannell 
    +Website: https://www.gnu.org/software/bash/
    +Category: common
    +*/
    +
    +/** @type LanguageFn */
    +function bash(hljs) {
    +  const VAR = {};
    +  const BRACED_VAR = {
    +    begin: /\$\{/,
    +    end:/\}/,
    +    contains: [
    +      "self",
    +      {
    +        begin: /:-/,
    +        contains: [ VAR ]
    +      } // default values
    +    ]
    +  };
    +  Object.assign(VAR,{
    +    className: 'variable',
    +    variants: [
    +      {begin: concat(/\$[\w\d#@][\w\d_]*/,
    +        // negative look-ahead tries to avoid matching patterns that are not
    +        // Perl at all like $ident$, @ident@, etc.
    +        `(?![\\w\\d])(?![$])`) },
    +      BRACED_VAR
    +    ]
    +  });
    +
    +  const SUBST = {
    +    className: 'subst',
    +    begin: /\$\(/, end: /\)/,
    +    contains: [hljs.BACKSLASH_ESCAPE]
    +  };
    +  const HERE_DOC = {
    +    begin: /<<-?\s*(?=\w+)/,
    +    starts: {
    +      contains: [
    +        hljs.END_SAME_AS_BEGIN({
    +          begin: /(\w+)/,
    +          end: /(\w+)/,
    +          className: 'string'
    +        })
    +      ]
    +    }
    +  };
    +  const QUOTE_STRING = {
    +    className: 'string',
    +    begin: /"/, end: /"/,
    +    contains: [
    +      hljs.BACKSLASH_ESCAPE,
    +      VAR,
    +      SUBST
    +    ]
    +  };
    +  SUBST.contains.push(QUOTE_STRING);
    +  const ESCAPED_QUOTE = {
    +    className: '',
    +    begin: /\\"/
    +
    +  };
    +  const APOS_STRING = {
    +    className: 'string',
    +    begin: /'/, end: /'/
    +  };
    +  const ARITHMETIC = {
    +    begin: /\$\(\(/,
    +    end: /\)\)/,
    +    contains: [
    +      { begin: /\d+#[0-9a-f]+/, className: "number" },
    +      hljs.NUMBER_MODE,
    +      VAR
    +    ]
    +  };
    +  const SH_LIKE_SHELLS = [
    +    "fish",
    +    "bash",
    +    "zsh",
    +    "sh",
    +    "csh",
    +    "ksh",
    +    "tcsh",
    +    "dash",
    +    "scsh",
    +  ];
    +  const KNOWN_SHEBANG = hljs.SHEBANG({
    +    binary: `(${SH_LIKE_SHELLS.join("|")})`,
    +    relevance: 10
    +  });
    +  const FUNCTION = {
    +    className: 'function',
    +    begin: /\w[\w\d_]*\s*\(\s*\)\s*\{/,
    +    returnBegin: true,
    +    contains: [hljs.inherit(hljs.TITLE_MODE, {begin: /\w[\w\d_]*/})],
    +    relevance: 0
    +  };
    +
    +  return {
    +    name: 'Bash',
    +    aliases: ['sh', 'zsh'],
    +    keywords: {
    +      $pattern: /\b[a-z._-]+\b/,
    +      keyword:
    +        'if then else elif fi for while in do done case esac function',
    +      literal:
    +        'true false',
    +      built_in:
    +        // Shell built-ins
    +        // http://www.gnu.org/software/bash/manual/html_node/Shell-Builtin-Commands.html
    +        'break cd continue eval exec exit export getopts hash pwd readonly return shift test times ' +
    +        'trap umask unset ' +
    +        // Bash built-ins
    +        'alias bind builtin caller command declare echo enable help let local logout mapfile printf ' +
    +        'read readarray source type typeset ulimit unalias ' +
    +        // Shell modifiers
    +        'set shopt ' +
    +        // Zsh built-ins
    +        'autoload bg bindkey bye cap chdir clone comparguments compcall compctl compdescribe compfiles ' +
    +        'compgroups compquote comptags comptry compvalues dirs disable disown echotc echoti emulate ' +
    +        'fc fg float functions getcap getln history integer jobs kill limit log noglob popd print ' +
    +        'pushd pushln rehash sched setcap setopt stat suspend ttyctl unfunction unhash unlimit ' +
    +        'unsetopt vared wait whence where which zcompile zformat zftp zle zmodload zparseopts zprof ' +
    +        'zpty zregexparse zsocket zstyle ztcp'
    +    },
    +    contains: [
    +      KNOWN_SHEBANG, // to catch known shells and boost relevancy
    +      hljs.SHEBANG(), // to catch unknown shells but still highlight the shebang
    +      FUNCTION,
    +      ARITHMETIC,
    +      hljs.HASH_COMMENT_MODE,
    +      HERE_DOC,
    +      QUOTE_STRING,
    +      ESCAPED_QUOTE,
    +      APOS_STRING,
    +      VAR
    +    ]
    +  };
    +}
    +
    +module.exports = bash;
    diff --git a/node_modules/highlight.js/lib/languages/basic.js b/node_modules/highlight.js/lib/languages/basic.js
    new file mode 100644
    index 0000000..75442b9
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/basic.js
    @@ -0,0 +1,65 @@
    +/*
    +Language: BASIC
    +Author: Raphaël Assénat 
    +Description: Based on the BASIC reference from the Tandy 1000 guide
    +Website: https://en.wikipedia.org/wiki/Tandy_1000
    +*/
    +
    +/** @type LanguageFn */
    +function basic(hljs) {
    +  return {
    +    name: 'BASIC',
    +    case_insensitive: true,
    +    illegal: '^\.',
    +    // Support explicitly typed variables that end with $%! or #.
    +    keywords: {
    +      $pattern: '[a-zA-Z][a-zA-Z0-9_$%!#]*',
    +      keyword:
    +        'ABS ASC AND ATN AUTO|0 BEEP BLOAD|10 BSAVE|10 CALL CALLS CDBL CHAIN CHDIR CHR$|10 CINT CIRCLE ' +
    +        'CLEAR CLOSE CLS COLOR COM COMMON CONT COS CSNG CSRLIN CVD CVI CVS DATA DATE$ ' +
    +        'DEFDBL DEFINT DEFSNG DEFSTR DEF|0 SEG USR DELETE DIM DRAW EDIT END ENVIRON ENVIRON$ ' +
    +        'EOF EQV ERASE ERDEV ERDEV$ ERL ERR ERROR EXP FIELD FILES FIX FOR|0 FRE GET GOSUB|10 GOTO ' +
    +        'HEX$ IF THEN ELSE|0 INKEY$ INP INPUT INPUT# INPUT$ INSTR IMP INT IOCTL IOCTL$ KEY ON ' +
    +        'OFF LIST KILL LEFT$ LEN LET LINE LLIST LOAD LOC LOCATE LOF LOG LPRINT USING LSET ' +
    +        'MERGE MID$ MKDIR MKD$ MKI$ MKS$ MOD NAME NEW NEXT NOISE NOT OCT$ ON OR PEN PLAY STRIG OPEN OPTION ' +
    +        'BASE OUT PAINT PALETTE PCOPY PEEK PMAP POINT POKE POS PRINT PRINT] PSET PRESET ' +
    +        'PUT RANDOMIZE READ REM RENUM RESET|0 RESTORE RESUME RETURN|0 RIGHT$ RMDIR RND RSET ' +
    +        'RUN SAVE SCREEN SGN SHELL SIN SOUND SPACE$ SPC SQR STEP STICK STOP STR$ STRING$ SWAP ' +
    +        'SYSTEM TAB TAN TIME$ TIMER TROFF TRON TO USR VAL VARPTR VARPTR$ VIEW WAIT WHILE ' +
    +        'WEND WIDTH WINDOW WRITE XOR'
    +    },
    +    contains: [
    +      hljs.QUOTE_STRING_MODE,
    +      hljs.COMMENT('REM', '$', {
    +        relevance: 10
    +      }),
    +      hljs.COMMENT('\'', '$', {
    +        relevance: 0
    +      }),
    +      {
    +        // Match line numbers
    +        className: 'symbol',
    +        begin: '^[0-9]+ ',
    +        relevance: 10
    +      },
    +      {
    +        // Match typed numeric constants (1000, 12.34!, 1.2e5, 1.5#, 1.2D2)
    +        className: 'number',
    +        begin: '\\b\\d+(\\.\\d+)?([edED]\\d+)?[#\!]?',
    +        relevance: 0
    +      },
    +      {
    +        // Match hexadecimal numbers (&Hxxxx)
    +        className: 'number',
    +        begin: '(&[hH][0-9a-fA-F]{1,4})'
    +      },
    +      {
    +        // Match octal numbers (&Oxxxxxx)
    +        className: 'number',
    +        begin: '(&[oO][0-7]{1,6})'
    +      }
    +    ]
    +  };
    +}
    +
    +module.exports = basic;
    diff --git a/node_modules/highlight.js/lib/languages/bnf.js b/node_modules/highlight.js/lib/languages/bnf.js
    new file mode 100644
    index 0000000..5c8673c
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/bnf.js
    @@ -0,0 +1,38 @@
    +/*
    +Language: Backus–Naur Form
    +Website: https://en.wikipedia.org/wiki/Backus–Naur_form
    +Author: Oleg Efimov 
    +*/
    +
    +/** @type LanguageFn */
    +function bnf(hljs) {
    +  return {
    +    name: 'Backus–Naur Form',
    +    contains: [
    +      // Attribute
    +      {
    +        className: 'attribute',
    +        begin: //
    +      },
    +      // Specific
    +      {
    +        begin: /::=/,
    +        end: /$/,
    +        contains: [
    +          {
    +            begin: //
    +          },
    +          // Common
    +          hljs.C_LINE_COMMENT_MODE,
    +          hljs.C_BLOCK_COMMENT_MODE,
    +          hljs.APOS_STRING_MODE,
    +          hljs.QUOTE_STRING_MODE
    +        ]
    +      }
    +    ]
    +  };
    +}
    +
    +module.exports = bnf;
    diff --git a/node_modules/highlight.js/lib/languages/brainfuck.js b/node_modules/highlight.js/lib/languages/brainfuck.js
    new file mode 100644
    index 0000000..3726b99
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/brainfuck.js
    @@ -0,0 +1,46 @@
    +/*
    +Language: Brainfuck
    +Author: Evgeny Stepanischev 
    +Website: https://esolangs.org/wiki/Brainfuck
    +*/
    +
    +/** @type LanguageFn */
    +function brainfuck(hljs) {
    +  const LITERAL = {
    +    className: 'literal',
    +    begin: /[+-]/,
    +    relevance: 0
    +  };
    +  return {
    +    name: 'Brainfuck',
    +    aliases: ['bf'],
    +    contains: [
    +      hljs.COMMENT(
    +        '[^\\[\\]\\.,\\+\\-<> \r\n]',
    +        '[\\[\\]\\.,\\+\\-<> \r\n]',
    +        {
    +          returnEnd: true,
    +          relevance: 0
    +        }
    +      ),
    +      {
    +        className: 'title',
    +        begin: '[\\[\\]]',
    +        relevance: 0
    +      },
    +      {
    +        className: 'string',
    +        begin: '[\\.,]',
    +        relevance: 0
    +      },
    +      {
    +        // this mode works as the only relevance counter
    +        begin: /(?:\+\+|--)/,
    +        contains: [LITERAL]
    +      },
    +      LITERAL
    +    ]
    +  };
    +}
    +
    +module.exports = brainfuck;
    diff --git a/node_modules/highlight.js/lib/languages/c-like.js b/node_modules/highlight.js/lib/languages/c-like.js
    new file mode 100644
    index 0000000..3f188a2
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/c-like.js
    @@ -0,0 +1,318 @@
    +/**
    + * @param {string} value
    + * @returns {RegExp}
    + * */
    +
    +/**
    + * @param {RegExp | string } re
    + * @returns {string}
    + */
    +function source(re) {
    +  if (!re) return null;
    +  if (typeof re === "string") return re;
    +
    +  return re.source;
    +}
    +
    +/**
    + * @param {RegExp | string } re
    + * @returns {string}
    + */
    +function optional(re) {
    +  return concat('(', re, ')?');
    +}
    +
    +/**
    + * @param {...(RegExp | string) } args
    + * @returns {string}
    + */
    +function concat(...args) {
    +  const joined = args.map((x) => source(x)).join("");
    +  return joined;
    +}
    +
    +/*
    +Language: C-like foundation grammar for C/C++ grammars
    +Author: Ivan Sagalaev 
    +Contributors: Evgeny Stepanischev , Zaven Muradyan , Roel Deckers , Sam Wu , Jordi Petit , Pieter Vantorre , Google Inc. (David Benjamin) 
    +*/
    +
    +/** @type LanguageFn */
    +function cLike(hljs) {
    +  // added for historic reasons because `hljs.C_LINE_COMMENT_MODE` does
    +  // not include such support nor can we be sure all the grammars depending
    +  // on it would desire this behavior
    +  const C_LINE_COMMENT_MODE = hljs.COMMENT('//', '$', {
    +    contains: [
    +      {
    +        begin: /\\\n/
    +      }
    +    ]
    +  });
    +  const DECLTYPE_AUTO_RE = 'decltype\\(auto\\)';
    +  const NAMESPACE_RE = '[a-zA-Z_]\\w*::';
    +  const TEMPLATE_ARGUMENT_RE = '<[^<>]+>';
    +  const FUNCTION_TYPE_RE = '(' +
    +    DECLTYPE_AUTO_RE + '|' +
    +    optional(NAMESPACE_RE) +
    +    '[a-zA-Z_]\\w*' + optional(TEMPLATE_ARGUMENT_RE) +
    +  ')';
    +  const CPP_PRIMITIVE_TYPES = {
    +    className: 'keyword',
    +    begin: '\\b[a-z\\d_]*_t\\b'
    +  };
    +
    +  // https://en.cppreference.com/w/cpp/language/escape
    +  // \\ \x \xFF \u2837 \u00323747 \374
    +  const CHARACTER_ESCAPES = '\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)';
    +  const STRINGS = {
    +    className: 'string',
    +    variants: [
    +      {
    +        begin: '(u8?|U|L)?"',
    +        end: '"',
    +        illegal: '\\n',
    +        contains: [ hljs.BACKSLASH_ESCAPE ]
    +      },
    +      {
    +        begin: '(u8?|U|L)?\'(' + CHARACTER_ESCAPES + "|.)",
    +        end: '\'',
    +        illegal: '.'
    +      },
    +      hljs.END_SAME_AS_BEGIN({
    +        begin: /(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,
    +        end: /\)([^()\\ ]{0,16})"/
    +      })
    +    ]
    +  };
    +
    +  const NUMBERS = {
    +    className: 'number',
    +    variants: [
    +      {
    +        begin: '\\b(0b[01\']+)'
    +      },
    +      {
    +        begin: '(-?)\\b([\\d\']+(\\.[\\d\']*)?|\\.[\\d\']+)(u|U|l|L|ul|UL|f|F|b|B)'
    +      },
    +      {
    +        begin: '(-?)(\\b0[xX][a-fA-F0-9\']+|(\\b[\\d\']+(\\.[\\d\']*)?|\\.[\\d\']+)([eE][-+]?[\\d\']+)?)'
    +      }
    +    ],
    +    relevance: 0
    +  };
    +
    +  const PREPROCESSOR = {
    +    className: 'meta',
    +    begin: /#\s*[a-z]+\b/,
    +    end: /$/,
    +    keywords: {
    +      'meta-keyword':
    +        'if else elif endif define undef warning error line ' +
    +        'pragma _Pragma ifdef ifndef include'
    +    },
    +    contains: [
    +      {
    +        begin: /\\\n/,
    +        relevance: 0
    +      },
    +      hljs.inherit(STRINGS, {
    +        className: 'meta-string'
    +      }),
    +      {
    +        className: 'meta-string',
    +        begin: /<.*?>/,
    +        end: /$/,
    +        illegal: '\\n'
    +      },
    +      C_LINE_COMMENT_MODE,
    +      hljs.C_BLOCK_COMMENT_MODE
    +    ]
    +  };
    +
    +  const TITLE_MODE = {
    +    className: 'title',
    +    begin: optional(NAMESPACE_RE) + hljs.IDENT_RE,
    +    relevance: 0
    +  };
    +
    +  const FUNCTION_TITLE = optional(NAMESPACE_RE) + hljs.IDENT_RE + '\\s*\\(';
    +
    +  const CPP_KEYWORDS = {
    +    keyword: 'int float while private char char8_t char16_t char32_t catch import module export virtual operator sizeof ' +
    +      'dynamic_cast|10 typedef const_cast|10 const for static_cast|10 union namespace ' +
    +      'unsigned long volatile static protected bool template mutable if public friend ' +
    +      'do goto auto void enum else break extern using asm case typeid wchar_t ' +
    +      'short reinterpret_cast|10 default double register explicit signed typename try this ' +
    +      'switch continue inline delete alignas alignof constexpr consteval constinit decltype ' +
    +      'concept co_await co_return co_yield requires ' +
    +      'noexcept static_assert thread_local restrict final override ' +
    +      'atomic_bool atomic_char atomic_schar ' +
    +      'atomic_uchar atomic_short atomic_ushort atomic_int atomic_uint atomic_long atomic_ulong atomic_llong ' +
    +      'atomic_ullong new throw return ' +
    +      'and and_eq bitand bitor compl not not_eq or or_eq xor xor_eq',
    +    built_in: 'std string wstring cin cout cerr clog stdin stdout stderr stringstream istringstream ostringstream ' +
    +      'auto_ptr deque list queue stack vector map set pair bitset multiset multimap unordered_set ' +
    +      'unordered_map unordered_multiset unordered_multimap priority_queue make_pair array shared_ptr abort terminate abs acos ' +
    +      'asin atan2 atan calloc ceil cosh cos exit exp fabs floor fmod fprintf fputs free frexp ' +
    +      'fscanf future isalnum isalpha iscntrl isdigit isgraph islower isprint ispunct isspace isupper ' +
    +      'isxdigit tolower toupper labs ldexp log10 log malloc realloc memchr memcmp memcpy memset modf pow ' +
    +      'printf putchar puts scanf sinh sin snprintf sprintf sqrt sscanf strcat strchr strcmp ' +
    +      'strcpy strcspn strlen strncat strncmp strncpy strpbrk strrchr strspn strstr tanh tan ' +
    +      'vfprintf vprintf vsprintf endl initializer_list unique_ptr _Bool complex _Complex imaginary _Imaginary',
    +    literal: 'true false nullptr NULL'
    +  };
    +
    +  const EXPRESSION_CONTAINS = [
    +    PREPROCESSOR,
    +    CPP_PRIMITIVE_TYPES,
    +    C_LINE_COMMENT_MODE,
    +    hljs.C_BLOCK_COMMENT_MODE,
    +    NUMBERS,
    +    STRINGS
    +  ];
    +
    +  const EXPRESSION_CONTEXT = {
    +    // This mode covers expression context where we can't expect a function
    +    // definition and shouldn't highlight anything that looks like one:
    +    // `return some()`, `else if()`, `(x*sum(1, 2))`
    +    variants: [
    +      {
    +        begin: /=/,
    +        end: /;/
    +      },
    +      {
    +        begin: /\(/,
    +        end: /\)/
    +      },
    +      {
    +        beginKeywords: 'new throw return else',
    +        end: /;/
    +      }
    +    ],
    +    keywords: CPP_KEYWORDS,
    +    contains: EXPRESSION_CONTAINS.concat([
    +      {
    +        begin: /\(/,
    +        end: /\)/,
    +        keywords: CPP_KEYWORDS,
    +        contains: EXPRESSION_CONTAINS.concat([ 'self' ]),
    +        relevance: 0
    +      }
    +    ]),
    +    relevance: 0
    +  };
    +
    +  const FUNCTION_DECLARATION = {
    +    className: 'function',
    +    begin: '(' + FUNCTION_TYPE_RE + '[\\*&\\s]+)+' + FUNCTION_TITLE,
    +    returnBegin: true,
    +    end: /[{;=]/,
    +    excludeEnd: true,
    +    keywords: CPP_KEYWORDS,
    +    illegal: /[^\w\s\*&:<>]/,
    +    contains: [
    +      { // to prevent it from being confused as the function title
    +        begin: DECLTYPE_AUTO_RE,
    +        keywords: CPP_KEYWORDS,
    +        relevance: 0
    +      },
    +      {
    +        begin: FUNCTION_TITLE,
    +        returnBegin: true,
    +        contains: [ TITLE_MODE ],
    +        relevance: 0
    +      },
    +      {
    +        className: 'params',
    +        begin: /\(/,
    +        end: /\)/,
    +        keywords: CPP_KEYWORDS,
    +        relevance: 0,
    +        contains: [
    +          C_LINE_COMMENT_MODE,
    +          hljs.C_BLOCK_COMMENT_MODE,
    +          STRINGS,
    +          NUMBERS,
    +          CPP_PRIMITIVE_TYPES,
    +          // Count matching parentheses.
    +          {
    +            begin: /\(/,
    +            end: /\)/,
    +            keywords: CPP_KEYWORDS,
    +            relevance: 0,
    +            contains: [
    +              'self',
    +              C_LINE_COMMENT_MODE,
    +              hljs.C_BLOCK_COMMENT_MODE,
    +              STRINGS,
    +              NUMBERS,
    +              CPP_PRIMITIVE_TYPES
    +            ]
    +          }
    +        ]
    +      },
    +      CPP_PRIMITIVE_TYPES,
    +      C_LINE_COMMENT_MODE,
    +      hljs.C_BLOCK_COMMENT_MODE,
    +      PREPROCESSOR
    +    ]
    +  };
    +
    +  return {
    +    aliases: [
    +      'c',
    +      'cc',
    +      'h',
    +      'c++',
    +      'h++',
    +      'hpp',
    +      'hh',
    +      'hxx',
    +      'cxx'
    +    ],
    +    keywords: CPP_KEYWORDS,
    +    // the base c-like language will NEVER be auto-detected, rather the
    +    // derivitives: c, c++, arduino turn auto-detect back on for themselves
    +    disableAutodetect: true,
    +    illegal: ' rooms (9);`
    +          begin: '\\b(deque|list|queue|priority_queue|pair|stack|vector|map|set|bitset|multiset|multimap|unordered_map|unordered_set|unordered_multiset|unordered_multimap|array)\\s*<',
    +          end: '>',
    +          keywords: CPP_KEYWORDS,
    +          contains: [
    +            'self',
    +            CPP_PRIMITIVE_TYPES
    +          ]
    +        },
    +        {
    +          begin: hljs.IDENT_RE + '::',
    +          keywords: CPP_KEYWORDS
    +        },
    +        {
    +          className: 'class',
    +          beginKeywords: 'enum class struct union',
    +          end: /[{;:<>=]/,
    +          contains: [
    +            {
    +              beginKeywords: "final class struct"
    +            },
    +            hljs.TITLE_MODE
    +          ]
    +        }
    +      ]),
    +    exports: {
    +      preprocessor: PREPROCESSOR,
    +      strings: STRINGS,
    +      keywords: CPP_KEYWORDS
    +    }
    +  };
    +}
    +
    +module.exports = cLike;
    diff --git a/node_modules/highlight.js/lib/languages/c.js b/node_modules/highlight.js/lib/languages/c.js
    new file mode 100644
    index 0000000..b762c6a
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/c.js
    @@ -0,0 +1,339 @@
    +/**
    + * @param {string} value
    + * @returns {RegExp}
    + * */
    +
    +/**
    + * @param {RegExp | string } re
    + * @returns {string}
    + */
    +function source(re) {
    +  if (!re) return null;
    +  if (typeof re === "string") return re;
    +
    +  return re.source;
    +}
    +
    +/**
    + * @param {RegExp | string } re
    + * @returns {string}
    + */
    +function optional(re) {
    +  return concat('(', re, ')?');
    +}
    +
    +/**
    + * @param {...(RegExp | string) } args
    + * @returns {string}
    + */
    +function concat(...args) {
    +  const joined = args.map((x) => source(x)).join("");
    +  return joined;
    +}
    +
    +/*
    +Language: C-like foundation grammar for C/C++ grammars
    +Author: Ivan Sagalaev 
    +Contributors: Evgeny Stepanischev , Zaven Muradyan , Roel Deckers , Sam Wu , Jordi Petit , Pieter Vantorre , Google Inc. (David Benjamin) 
    +*/
    +
    +/** @type LanguageFn */
    +function cLike(hljs) {
    +  // added for historic reasons because `hljs.C_LINE_COMMENT_MODE` does
    +  // not include such support nor can we be sure all the grammars depending
    +  // on it would desire this behavior
    +  const C_LINE_COMMENT_MODE = hljs.COMMENT('//', '$', {
    +    contains: [
    +      {
    +        begin: /\\\n/
    +      }
    +    ]
    +  });
    +  const DECLTYPE_AUTO_RE = 'decltype\\(auto\\)';
    +  const NAMESPACE_RE = '[a-zA-Z_]\\w*::';
    +  const TEMPLATE_ARGUMENT_RE = '<[^<>]+>';
    +  const FUNCTION_TYPE_RE = '(' +
    +    DECLTYPE_AUTO_RE + '|' +
    +    optional(NAMESPACE_RE) +
    +    '[a-zA-Z_]\\w*' + optional(TEMPLATE_ARGUMENT_RE) +
    +  ')';
    +  const CPP_PRIMITIVE_TYPES = {
    +    className: 'keyword',
    +    begin: '\\b[a-z\\d_]*_t\\b'
    +  };
    +
    +  // https://en.cppreference.com/w/cpp/language/escape
    +  // \\ \x \xFF \u2837 \u00323747 \374
    +  const CHARACTER_ESCAPES = '\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)';
    +  const STRINGS = {
    +    className: 'string',
    +    variants: [
    +      {
    +        begin: '(u8?|U|L)?"',
    +        end: '"',
    +        illegal: '\\n',
    +        contains: [ hljs.BACKSLASH_ESCAPE ]
    +      },
    +      {
    +        begin: '(u8?|U|L)?\'(' + CHARACTER_ESCAPES + "|.)",
    +        end: '\'',
    +        illegal: '.'
    +      },
    +      hljs.END_SAME_AS_BEGIN({
    +        begin: /(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,
    +        end: /\)([^()\\ ]{0,16})"/
    +      })
    +    ]
    +  };
    +
    +  const NUMBERS = {
    +    className: 'number',
    +    variants: [
    +      {
    +        begin: '\\b(0b[01\']+)'
    +      },
    +      {
    +        begin: '(-?)\\b([\\d\']+(\\.[\\d\']*)?|\\.[\\d\']+)(u|U|l|L|ul|UL|f|F|b|B)'
    +      },
    +      {
    +        begin: '(-?)(\\b0[xX][a-fA-F0-9\']+|(\\b[\\d\']+(\\.[\\d\']*)?|\\.[\\d\']+)([eE][-+]?[\\d\']+)?)'
    +      }
    +    ],
    +    relevance: 0
    +  };
    +
    +  const PREPROCESSOR = {
    +    className: 'meta',
    +    begin: /#\s*[a-z]+\b/,
    +    end: /$/,
    +    keywords: {
    +      'meta-keyword':
    +        'if else elif endif define undef warning error line ' +
    +        'pragma _Pragma ifdef ifndef include'
    +    },
    +    contains: [
    +      {
    +        begin: /\\\n/,
    +        relevance: 0
    +      },
    +      hljs.inherit(STRINGS, {
    +        className: 'meta-string'
    +      }),
    +      {
    +        className: 'meta-string',
    +        begin: /<.*?>/,
    +        end: /$/,
    +        illegal: '\\n'
    +      },
    +      C_LINE_COMMENT_MODE,
    +      hljs.C_BLOCK_COMMENT_MODE
    +    ]
    +  };
    +
    +  const TITLE_MODE = {
    +    className: 'title',
    +    begin: optional(NAMESPACE_RE) + hljs.IDENT_RE,
    +    relevance: 0
    +  };
    +
    +  const FUNCTION_TITLE = optional(NAMESPACE_RE) + hljs.IDENT_RE + '\\s*\\(';
    +
    +  const CPP_KEYWORDS = {
    +    keyword: 'int float while private char char8_t char16_t char32_t catch import module export virtual operator sizeof ' +
    +      'dynamic_cast|10 typedef const_cast|10 const for static_cast|10 union namespace ' +
    +      'unsigned long volatile static protected bool template mutable if public friend ' +
    +      'do goto auto void enum else break extern using asm case typeid wchar_t ' +
    +      'short reinterpret_cast|10 default double register explicit signed typename try this ' +
    +      'switch continue inline delete alignas alignof constexpr consteval constinit decltype ' +
    +      'concept co_await co_return co_yield requires ' +
    +      'noexcept static_assert thread_local restrict final override ' +
    +      'atomic_bool atomic_char atomic_schar ' +
    +      'atomic_uchar atomic_short atomic_ushort atomic_int atomic_uint atomic_long atomic_ulong atomic_llong ' +
    +      'atomic_ullong new throw return ' +
    +      'and and_eq bitand bitor compl not not_eq or or_eq xor xor_eq',
    +    built_in: 'std string wstring cin cout cerr clog stdin stdout stderr stringstream istringstream ostringstream ' +
    +      'auto_ptr deque list queue stack vector map set pair bitset multiset multimap unordered_set ' +
    +      'unordered_map unordered_multiset unordered_multimap priority_queue make_pair array shared_ptr abort terminate abs acos ' +
    +      'asin atan2 atan calloc ceil cosh cos exit exp fabs floor fmod fprintf fputs free frexp ' +
    +      'fscanf future isalnum isalpha iscntrl isdigit isgraph islower isprint ispunct isspace isupper ' +
    +      'isxdigit tolower toupper labs ldexp log10 log malloc realloc memchr memcmp memcpy memset modf pow ' +
    +      'printf putchar puts scanf sinh sin snprintf sprintf sqrt sscanf strcat strchr strcmp ' +
    +      'strcpy strcspn strlen strncat strncmp strncpy strpbrk strrchr strspn strstr tanh tan ' +
    +      'vfprintf vprintf vsprintf endl initializer_list unique_ptr _Bool complex _Complex imaginary _Imaginary',
    +    literal: 'true false nullptr NULL'
    +  };
    +
    +  const EXPRESSION_CONTAINS = [
    +    PREPROCESSOR,
    +    CPP_PRIMITIVE_TYPES,
    +    C_LINE_COMMENT_MODE,
    +    hljs.C_BLOCK_COMMENT_MODE,
    +    NUMBERS,
    +    STRINGS
    +  ];
    +
    +  const EXPRESSION_CONTEXT = {
    +    // This mode covers expression context where we can't expect a function
    +    // definition and shouldn't highlight anything that looks like one:
    +    // `return some()`, `else if()`, `(x*sum(1, 2))`
    +    variants: [
    +      {
    +        begin: /=/,
    +        end: /;/
    +      },
    +      {
    +        begin: /\(/,
    +        end: /\)/
    +      },
    +      {
    +        beginKeywords: 'new throw return else',
    +        end: /;/
    +      }
    +    ],
    +    keywords: CPP_KEYWORDS,
    +    contains: EXPRESSION_CONTAINS.concat([
    +      {
    +        begin: /\(/,
    +        end: /\)/,
    +        keywords: CPP_KEYWORDS,
    +        contains: EXPRESSION_CONTAINS.concat([ 'self' ]),
    +        relevance: 0
    +      }
    +    ]),
    +    relevance: 0
    +  };
    +
    +  const FUNCTION_DECLARATION = {
    +    className: 'function',
    +    begin: '(' + FUNCTION_TYPE_RE + '[\\*&\\s]+)+' + FUNCTION_TITLE,
    +    returnBegin: true,
    +    end: /[{;=]/,
    +    excludeEnd: true,
    +    keywords: CPP_KEYWORDS,
    +    illegal: /[^\w\s\*&:<>]/,
    +    contains: [
    +      { // to prevent it from being confused as the function title
    +        begin: DECLTYPE_AUTO_RE,
    +        keywords: CPP_KEYWORDS,
    +        relevance: 0
    +      },
    +      {
    +        begin: FUNCTION_TITLE,
    +        returnBegin: true,
    +        contains: [ TITLE_MODE ],
    +        relevance: 0
    +      },
    +      {
    +        className: 'params',
    +        begin: /\(/,
    +        end: /\)/,
    +        keywords: CPP_KEYWORDS,
    +        relevance: 0,
    +        contains: [
    +          C_LINE_COMMENT_MODE,
    +          hljs.C_BLOCK_COMMENT_MODE,
    +          STRINGS,
    +          NUMBERS,
    +          CPP_PRIMITIVE_TYPES,
    +          // Count matching parentheses.
    +          {
    +            begin: /\(/,
    +            end: /\)/,
    +            keywords: CPP_KEYWORDS,
    +            relevance: 0,
    +            contains: [
    +              'self',
    +              C_LINE_COMMENT_MODE,
    +              hljs.C_BLOCK_COMMENT_MODE,
    +              STRINGS,
    +              NUMBERS,
    +              CPP_PRIMITIVE_TYPES
    +            ]
    +          }
    +        ]
    +      },
    +      CPP_PRIMITIVE_TYPES,
    +      C_LINE_COMMENT_MODE,
    +      hljs.C_BLOCK_COMMENT_MODE,
    +      PREPROCESSOR
    +    ]
    +  };
    +
    +  return {
    +    aliases: [
    +      'c',
    +      'cc',
    +      'h',
    +      'c++',
    +      'h++',
    +      'hpp',
    +      'hh',
    +      'hxx',
    +      'cxx'
    +    ],
    +    keywords: CPP_KEYWORDS,
    +    // the base c-like language will NEVER be auto-detected, rather the
    +    // derivitives: c, c++, arduino turn auto-detect back on for themselves
    +    disableAutodetect: true,
    +    illegal: ' rooms (9);`
    +          begin: '\\b(deque|list|queue|priority_queue|pair|stack|vector|map|set|bitset|multiset|multimap|unordered_map|unordered_set|unordered_multiset|unordered_multimap|array)\\s*<',
    +          end: '>',
    +          keywords: CPP_KEYWORDS,
    +          contains: [
    +            'self',
    +            CPP_PRIMITIVE_TYPES
    +          ]
    +        },
    +        {
    +          begin: hljs.IDENT_RE + '::',
    +          keywords: CPP_KEYWORDS
    +        },
    +        {
    +          className: 'class',
    +          beginKeywords: 'enum class struct union',
    +          end: /[{;:<>=]/,
    +          contains: [
    +            {
    +              beginKeywords: "final class struct"
    +            },
    +            hljs.TITLE_MODE
    +          ]
    +        }
    +      ]),
    +    exports: {
    +      preprocessor: PREPROCESSOR,
    +      strings: STRINGS,
    +      keywords: CPP_KEYWORDS
    +    }
    +  };
    +}
    +
    +/*
    +Language: C
    +Category: common, system
    +Website: https://en.wikipedia.org/wiki/C_(programming_language)
    +*/
    +
    +/** @type LanguageFn */
    +function c(hljs) {
    +  const lang = cLike(hljs);
    +  // Until C is actually different than C++ there is no reason to auto-detect C
    +  // as it's own language since it would just fail auto-detect testing or
    +  // simply match with C++.
    +  //
    +  // See further comments in c-like.js.
    +
    +  // lang.disableAutodetect = false;
    +  lang.name = 'C';
    +  lang.aliases = ['c', 'h'];
    +  return lang;
    +}
    +
    +module.exports = c;
    diff --git a/node_modules/highlight.js/lib/languages/cal.js b/node_modules/highlight.js/lib/languages/cal.js
    new file mode 100644
    index 0000000..0cb44a3
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/cal.js
    @@ -0,0 +1,104 @@
    +/*
    +Language: C/AL
    +Author: Kenneth Fuglsang Christensen 
    +Description: Provides highlighting of Microsoft Dynamics NAV C/AL code files
    +Website: https://docs.microsoft.com/en-us/dynamics-nav/programming-in-c-al
    +*/
    +
    +/** @type LanguageFn */
    +function cal(hljs) {
    +  const KEYWORDS =
    +    'div mod in and or not xor asserterror begin case do downto else end exit for if of repeat then to ' +
    +    'until while with var';
    +  const LITERALS = 'false true';
    +  const COMMENT_MODES = [
    +    hljs.C_LINE_COMMENT_MODE,
    +    hljs.COMMENT(
    +      /\{/,
    +      /\}/,
    +      {
    +        relevance: 0
    +      }
    +    ),
    +    hljs.COMMENT(
    +      /\(\*/,
    +      /\*\)/,
    +      {
    +        relevance: 10
    +      }
    +    )
    +  ];
    +  const STRING = {
    +    className: 'string',
    +    begin: /'/,
    +    end: /'/,
    +    contains: [{
    +      begin: /''/
    +    }]
    +  };
    +  const CHAR_STRING = {
    +    className: 'string',
    +    begin: /(#\d+)+/
    +  };
    +  const DATE = {
    +    className: 'number',
    +    begin: '\\b\\d+(\\.\\d+)?(DT|D|T)',
    +    relevance: 0
    +  };
    +  const DBL_QUOTED_VARIABLE = {
    +    className: 'string', // not a string technically but makes sense to be highlighted in the same style
    +    begin: '"',
    +    end: '"'
    +  };
    +
    +  const PROCEDURE = {
    +    className: 'function',
    +    beginKeywords: 'procedure',
    +    end: /[:;]/,
    +    keywords: 'procedure|10',
    +    contains: [
    +      hljs.TITLE_MODE,
    +      {
    +        className: 'params',
    +        begin: /\(/,
    +        end: /\)/,
    +        keywords: KEYWORDS,
    +        contains: [
    +          STRING,
    +          CHAR_STRING
    +        ]
    +      }
    +    ].concat(COMMENT_MODES)
    +  };
    +
    +  const OBJECT = {
    +    className: 'class',
    +    begin: 'OBJECT (Table|Form|Report|Dataport|Codeunit|XMLport|MenuSuite|Page|Query) (\\d+) ([^\\r\\n]+)',
    +    returnBegin: true,
    +    contains: [
    +      hljs.TITLE_MODE,
    +      PROCEDURE
    +    ]
    +  };
    +
    +  return {
    +    name: 'C/AL',
    +    case_insensitive: true,
    +    keywords: {
    +      keyword: KEYWORDS,
    +      literal: LITERALS
    +    },
    +    illegal: /\/\*/,
    +    contains: [
    +      STRING,
    +      CHAR_STRING,
    +      DATE,
    +      DBL_QUOTED_VARIABLE,
    +      hljs.NUMBER_MODE,
    +      OBJECT,
    +      PROCEDURE
    +    ]
    +  };
    +}
    +
    +module.exports = cal;
    diff --git a/node_modules/highlight.js/lib/languages/capnproto.js b/node_modules/highlight.js/lib/languages/capnproto.js
    new file mode 100644
    index 0000000..013fe6b
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/capnproto.js
    @@ -0,0 +1,64 @@
    +/*
    +Language: Cap’n Proto
    +Author: Oleg Efimov 
    +Description: Cap’n Proto message definition format
    +Website: https://capnproto.org/capnp-tool.html
    +Category: protocols
    +*/
    +
    +/** @type LanguageFn */
    +function capnproto(hljs) {
    +  return {
    +    name: 'Cap’n Proto',
    +    aliases: ['capnp'],
    +    keywords: {
    +      keyword:
    +        'struct enum interface union group import using const annotation extends in of on as with from fixed',
    +      built_in:
    +        'Void Bool Int8 Int16 Int32 Int64 UInt8 UInt16 UInt32 UInt64 Float32 Float64 ' +
    +        'Text Data AnyPointer AnyStruct Capability List',
    +      literal:
    +        'true false'
    +    },
    +    contains: [
    +      hljs.QUOTE_STRING_MODE,
    +      hljs.NUMBER_MODE,
    +      hljs.HASH_COMMENT_MODE,
    +      {
    +        className: 'meta',
    +        begin: /@0x[\w\d]{16};/,
    +        illegal: /\n/
    +      },
    +      {
    +        className: 'symbol',
    +        begin: /@\d+\b/
    +      },
    +      {
    +        className: 'class',
    +        beginKeywords: 'struct enum',
    +        end: /\{/,
    +        illegal: /\n/,
    +        contains: [hljs.inherit(hljs.TITLE_MODE, {
    +          starts: {
    +            endsWithParent: true,
    +            excludeEnd: true
    +          } // hack: eating everything after the first title
    +        })]
    +      },
    +      {
    +        className: 'class',
    +        beginKeywords: 'interface',
    +        end: /\{/,
    +        illegal: /\n/,
    +        contains: [hljs.inherit(hljs.TITLE_MODE, {
    +          starts: {
    +            endsWithParent: true,
    +            excludeEnd: true
    +          } // hack: eating everything after the first title
    +        })]
    +      }
    +    ]
    +  };
    +}
    +
    +module.exports = capnproto;
    diff --git a/node_modules/highlight.js/lib/languages/ceylon.js b/node_modules/highlight.js/lib/languages/ceylon.js
    new file mode 100644
    index 0000000..ec62e24
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/ceylon.js
    @@ -0,0 +1,82 @@
    +/*
    +Language: Ceylon
    +Author: Lucas Werkmeister 
    +Website: https://ceylon-lang.org
    +*/
    +
    +/** @type LanguageFn */
    +function ceylon(hljs) {
    +  // 2.3. Identifiers and keywords
    +  const KEYWORDS =
    +    'assembly module package import alias class interface object given value ' +
    +    'assign void function new of extends satisfies abstracts in out return ' +
    +    'break continue throw assert dynamic if else switch case for while try ' +
    +    'catch finally then let this outer super is exists nonempty';
    +  // 7.4.1 Declaration Modifiers
    +  const DECLARATION_MODIFIERS =
    +    'shared abstract formal default actual variable late native deprecated ' +
    +    'final sealed annotation suppressWarnings small';
    +  // 7.4.2 Documentation
    +  const DOCUMENTATION =
    +    'doc by license see throws tagged';
    +  const SUBST = {
    +    className: 'subst',
    +    excludeBegin: true,
    +    excludeEnd: true,
    +    begin: /``/,
    +    end: /``/,
    +    keywords: KEYWORDS,
    +    relevance: 10
    +  };
    +  const EXPRESSIONS = [
    +    {
    +      // verbatim string
    +      className: 'string',
    +      begin: '"""',
    +      end: '"""',
    +      relevance: 10
    +    },
    +    {
    +      // string literal or template
    +      className: 'string',
    +      begin: '"',
    +      end: '"',
    +      contains: [SUBST]
    +    },
    +    {
    +      // character literal
    +      className: 'string',
    +      begin: "'",
    +      end: "'"
    +    },
    +    {
    +      // numeric literal
    +      className: 'number',
    +      begin: '#[0-9a-fA-F_]+|\\$[01_]+|[0-9_]+(?:\\.[0-9_](?:[eE][+-]?\\d+)?)?[kMGTPmunpf]?',
    +      relevance: 0
    +    }
    +  ];
    +  SUBST.contains = EXPRESSIONS;
    +
    +  return {
    +    name: 'Ceylon',
    +    keywords: {
    +      keyword: KEYWORDS + ' ' + DECLARATION_MODIFIERS,
    +      meta: DOCUMENTATION
    +    },
    +    illegal: '\\$[^01]|#[^0-9a-fA-F]',
    +    contains: [
    +      hljs.C_LINE_COMMENT_MODE,
    +      hljs.COMMENT('/\\*', '\\*/', {
    +        contains: ['self']
    +      }),
    +      {
    +        // compiler annotation
    +        className: 'meta',
    +        begin: '@[a-z]\\w*(?::"[^"]*")?'
    +      }
    +    ].concat(EXPRESSIONS)
    +  };
    +}
    +
    +module.exports = ceylon;
    diff --git a/node_modules/highlight.js/lib/languages/clean.js b/node_modules/highlight.js/lib/languages/clean.js
    new file mode 100644
    index 0000000..41340a9
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/clean.js
    @@ -0,0 +1,41 @@
    +/*
    +Language: Clean
    +Author: Camil Staps 
    +Category: functional
    +Website: http://clean.cs.ru.nl
    +*/
    +
    +/** @type LanguageFn */
    +function clean(hljs) {
    +  return {
    +    name: 'Clean',
    +    aliases: [
    +      'clean',
    +      'icl',
    +      'dcl'
    +    ],
    +    keywords: {
    +      keyword:
    +        'if let in with where case of class instance otherwise ' +
    +        'implementation definition system module from import qualified as ' +
    +        'special code inline foreign export ccall stdcall generic derive ' +
    +        'infix infixl infixr',
    +      built_in:
    +        'Int Real Char Bool',
    +      literal:
    +        'True False'
    +    },
    +    contains: [
    +      hljs.C_LINE_COMMENT_MODE,
    +      hljs.C_BLOCK_COMMENT_MODE,
    +      hljs.APOS_STRING_MODE,
    +      hljs.QUOTE_STRING_MODE,
    +      hljs.C_NUMBER_MODE,
    +      { // relevance booster
    +        begin: '->|<-[|:]?|#!?|>>=|\\{\\||\\|\\}|:==|=:|<>'
    +      }
    +    ]
    +  };
    +}
    +
    +module.exports = clean;
    diff --git a/node_modules/highlight.js/lib/languages/clojure-repl.js b/node_modules/highlight.js/lib/languages/clojure-repl.js
    new file mode 100644
    index 0000000..dcb7196
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/clojure-repl.js
    @@ -0,0 +1,25 @@
    +/*
    +Language: Clojure REPL
    +Description: Clojure REPL sessions
    +Author: Ivan Sagalaev 
    +Requires: clojure.js
    +Website: https://clojure.org
    +Category: lisp
    +*/
    +
    +/** @type LanguageFn */
    +function clojureRepl(hljs) {
    +  return {
    +    name: 'Clojure REPL',
    +    contains: [{
    +      className: 'meta',
    +      begin: /^([\w.-]+|\s*#_)?=>/,
    +      starts: {
    +        end: /$/,
    +        subLanguage: 'clojure'
    +      }
    +    }]
    +  };
    +}
    +
    +module.exports = clojureRepl;
    diff --git a/node_modules/highlight.js/lib/languages/clojure.js b/node_modules/highlight.js/lib/languages/clojure.js
    new file mode 100644
    index 0000000..ad439c9
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/clojure.js
    @@ -0,0 +1,127 @@
    +/*
    +Language: Clojure
    +Description: Clojure syntax (based on lisp.js)
    +Author: mfornos
    +Website: https://clojure.org
    +Category: lisp
    +*/
    +
    +/** @type LanguageFn */
    +function clojure(hljs) {
    +  var SYMBOLSTART = 'a-zA-Z_\\-!.?+*=<>&#\'';
    +  var SYMBOL_RE = '[' + SYMBOLSTART + '][' + SYMBOLSTART + '0-9/;:]*';
    +  var globals = 'def defonce defprotocol defstruct defmulti defmethod defn- defn defmacro deftype defrecord';
    +  var keywords = {
    +    $pattern: SYMBOL_RE,
    +    'builtin-name':
    +      // Clojure keywords
    +      globals + ' ' +
    +      'cond apply if-not if-let if not not= =|0 <|0 >|0 <=|0 >=|0 ==|0 +|0 /|0 *|0 -|0 rem ' +
    +      'quot neg? pos? delay? symbol? keyword? true? false? integer? empty? coll? list? ' +
    +      'set? ifn? fn? associative? sequential? sorted? counted? reversible? number? decimal? ' +
    +      'class? distinct? isa? float? rational? reduced? ratio? odd? even? char? seq? vector? ' +
    +      'string? map? nil? contains? zero? instance? not-every? not-any? libspec? -> ->> .. . ' +
    +      'inc compare do dotimes mapcat take remove take-while drop letfn drop-last take-last ' +
    +      'drop-while while intern condp case reduced cycle split-at split-with repeat replicate ' +
    +      'iterate range merge zipmap declare line-seq sort comparator sort-by dorun doall nthnext ' +
    +      'nthrest partition eval doseq await await-for let agent atom send send-off release-pending-sends ' +
    +      'add-watch mapv filterv remove-watch agent-error restart-agent set-error-handler error-handler ' +
    +      'set-error-mode! error-mode shutdown-agents quote var fn loop recur throw try monitor-enter ' +
    +      'monitor-exit macroexpand macroexpand-1 for dosync and or ' +
    +      'when when-not when-let comp juxt partial sequence memoize constantly complement identity assert ' +
    +      'peek pop doto proxy first rest cons cast coll last butlast ' +
    +      'sigs reify second ffirst fnext nfirst nnext meta with-meta ns in-ns create-ns import ' +
    +      'refer keys select-keys vals key val rseq name namespace promise into transient persistent! conj! ' +
    +      'assoc! dissoc! pop! disj! use class type num float double short byte boolean bigint biginteger ' +
    +      'bigdec print-method print-dup throw-if printf format load compile get-in update-in pr pr-on newline ' +
    +      'flush read slurp read-line subvec with-open memfn time re-find re-groups rand-int rand mod locking ' +
    +      'assert-valid-fdecl alias resolve ref deref refset swap! reset! set-validator! compare-and-set! alter-meta! ' +
    +      'reset-meta! commute get-validator alter ref-set ref-history-count ref-min-history ref-max-history ensure sync io! ' +
    +      'new next conj set! to-array future future-call into-array aset gen-class reduce map filter find empty ' +
    +      'hash-map hash-set sorted-map sorted-map-by sorted-set sorted-set-by vec vector seq flatten reverse assoc dissoc list ' +
    +      'disj get union difference intersection extend extend-type extend-protocol int nth delay count concat chunk chunk-buffer ' +
    +      'chunk-append chunk-first chunk-rest max min dec unchecked-inc-int unchecked-inc unchecked-dec-inc unchecked-dec unchecked-negate ' +
    +      'unchecked-add-int unchecked-add unchecked-subtract-int unchecked-subtract chunk-next chunk-cons chunked-seq? prn vary-meta ' +
    +      'lazy-seq spread list* str find-keyword keyword symbol gensym force rationalize'
    +  };
    +
    +  var SIMPLE_NUMBER_RE = '[-+]?\\d+(\\.\\d+)?';
    +
    +  var SYMBOL = {
    +    begin: SYMBOL_RE,
    +    relevance: 0
    +  };
    +  var NUMBER = {
    +    className: 'number', begin: SIMPLE_NUMBER_RE,
    +    relevance: 0
    +  };
    +  var STRING = hljs.inherit(hljs.QUOTE_STRING_MODE, {illegal: null});
    +  var COMMENT = hljs.COMMENT(
    +    ';',
    +    '$',
    +    {
    +      relevance: 0
    +    }
    +  );
    +  var LITERAL = {
    +    className: 'literal',
    +    begin: /\b(true|false|nil)\b/
    +  };
    +  var COLLECTION = {
    +    begin: '[\\[\\{]', end: '[\\]\\}]'
    +  };
    +  var HINT = {
    +    className: 'comment',
    +    begin: '\\^' + SYMBOL_RE
    +  };
    +  var HINT_COL = hljs.COMMENT('\\^\\{', '\\}');
    +  var KEY = {
    +    className: 'symbol',
    +    begin: '[:]{1,2}' + SYMBOL_RE
    +  };
    +  var LIST = {
    +    begin: '\\(', end: '\\)'
    +  };
    +  var BODY = {
    +    endsWithParent: true,
    +    relevance: 0
    +  };
    +  var NAME = {
    +    keywords: keywords,
    +    className: 'name',
    +    begin: SYMBOL_RE,
    +    relevance: 0,
    +    starts: BODY
    +  };
    +  var DEFAULT_CONTAINS = [LIST, STRING, HINT, HINT_COL, COMMENT, KEY, COLLECTION, NUMBER, LITERAL, SYMBOL];
    +
    +  var GLOBAL = {
    +    beginKeywords: globals,
    +    lexemes: SYMBOL_RE,
    +    end: '(\\[|#|\\d|"|:|\\{|\\)|\\(|$)',
    +    contains: [
    +      {
    +        className: 'title',
    +        begin: SYMBOL_RE,
    +        relevance: 0,
    +        excludeEnd: true,
    +        // we can only have a single title
    +        endsParent: true
    +      },
    +    ].concat(DEFAULT_CONTAINS)
    +  };
    +
    +  LIST.contains = [hljs.COMMENT('comment', ''), GLOBAL, NAME, BODY];
    +  BODY.contains = DEFAULT_CONTAINS;
    +  COLLECTION.contains = DEFAULT_CONTAINS;
    +  HINT_COL.contains = [COLLECTION];
    +
    +  return {
    +    name: 'Clojure',
    +    aliases: ['clj'],
    +    illegal: /\S/,
    +    contains: [LIST, STRING, HINT, HINT_COL, COMMENT, KEY, COLLECTION, NUMBER, LITERAL]
    +  };
    +}
    +
    +module.exports = clojure;
    diff --git a/node_modules/highlight.js/lib/languages/cmake.js b/node_modules/highlight.js/lib/languages/cmake.js
    new file mode 100644
    index 0000000..c5519da
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/cmake.js
    @@ -0,0 +1,64 @@
    +/*
    +Language: CMake
    +Description: CMake is an open-source cross-platform system for build automation.
    +Author: Igor Kalnitsky 
    +Website: https://cmake.org
    +*/
    +
    +/** @type LanguageFn */
    +function cmake(hljs) {
    +  return {
    +    name: 'CMake',
    +    aliases: ['cmake.in'],
    +    case_insensitive: true,
    +    keywords: {
    +      keyword:
    +        // scripting commands
    +        'break cmake_host_system_information cmake_minimum_required cmake_parse_arguments ' +
    +        'cmake_policy configure_file continue elseif else endforeach endfunction endif endmacro ' +
    +        'endwhile execute_process file find_file find_library find_package find_path ' +
    +        'find_program foreach function get_cmake_property get_directory_property ' +
    +        'get_filename_component get_property if include include_guard list macro ' +
    +        'mark_as_advanced math message option return separate_arguments ' +
    +        'set_directory_properties set_property set site_name string unset variable_watch while ' +
    +        // project commands
    +        'add_compile_definitions add_compile_options add_custom_command add_custom_target ' +
    +        'add_definitions add_dependencies add_executable add_library add_link_options ' +
    +        'add_subdirectory add_test aux_source_directory build_command create_test_sourcelist ' +
    +        'define_property enable_language enable_testing export fltk_wrap_ui ' +
    +        'get_source_file_property get_target_property get_test_property include_directories ' +
    +        'include_external_msproject include_regular_expression install link_directories ' +
    +        'link_libraries load_cache project qt_wrap_cpp qt_wrap_ui remove_definitions ' +
    +        'set_source_files_properties set_target_properties set_tests_properties source_group ' +
    +        'target_compile_definitions target_compile_features target_compile_options ' +
    +        'target_include_directories target_link_directories target_link_libraries ' +
    +        'target_link_options target_sources try_compile try_run ' +
    +        // CTest commands
    +        'ctest_build ctest_configure ctest_coverage ctest_empty_binary_directory ctest_memcheck ' +
    +        'ctest_read_custom_files ctest_run_script ctest_sleep ctest_start ctest_submit ' +
    +        'ctest_test ctest_update ctest_upload ' +
    +        // deprecated commands
    +        'build_name exec_program export_library_dependencies install_files install_programs ' +
    +        'install_targets load_command make_directory output_required_files remove ' +
    +        'subdir_depends subdirs use_mangled_mesa utility_source variable_requires write_file ' +
    +        'qt5_use_modules qt5_use_package qt5_wrap_cpp ' +
    +        // core keywords
    +        'on off true false and or not command policy target test exists is_newer_than ' +
    +        'is_directory is_symlink is_absolute matches less greater equal less_equal ' +
    +        'greater_equal strless strgreater strequal strless_equal strgreater_equal version_less ' +
    +        'version_greater version_equal version_less_equal version_greater_equal in_list defined'
    +    },
    +    contains: [
    +      {
    +        className: 'variable',
    +        begin: /\$\{/,
    +        end: /\}/
    +      },
    +      hljs.HASH_COMMENT_MODE,
    +      hljs.QUOTE_STRING_MODE,
    +      hljs.NUMBER_MODE
    +    ]
    +  };
    +}
    +
    +module.exports = cmake;
    diff --git a/node_modules/highlight.js/lib/languages/coffeescript.js b/node_modules/highlight.js/lib/languages/coffeescript.js
    new file mode 100644
    index 0000000..0813a65
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/coffeescript.js
    @@ -0,0 +1,353 @@
    +const KEYWORDS = [
    +  "as", // for exports
    +  "in",
    +  "of",
    +  "if",
    +  "for",
    +  "while",
    +  "finally",
    +  "var",
    +  "new",
    +  "function",
    +  "do",
    +  "return",
    +  "void",
    +  "else",
    +  "break",
    +  "catch",
    +  "instanceof",
    +  "with",
    +  "throw",
    +  "case",
    +  "default",
    +  "try",
    +  "switch",
    +  "continue",
    +  "typeof",
    +  "delete",
    +  "let",
    +  "yield",
    +  "const",
    +  "class",
    +  // JS handles these with a special rule
    +  // "get",
    +  // "set",
    +  "debugger",
    +  "async",
    +  "await",
    +  "static",
    +  "import",
    +  "from",
    +  "export",
    +  "extends"
    +];
    +const LITERALS = [
    +  "true",
    +  "false",
    +  "null",
    +  "undefined",
    +  "NaN",
    +  "Infinity"
    +];
    +
    +const TYPES = [
    +  "Intl",
    +  "DataView",
    +  "Number",
    +  "Math",
    +  "Date",
    +  "String",
    +  "RegExp",
    +  "Object",
    +  "Function",
    +  "Boolean",
    +  "Error",
    +  "Symbol",
    +  "Set",
    +  "Map",
    +  "WeakSet",
    +  "WeakMap",
    +  "Proxy",
    +  "Reflect",
    +  "JSON",
    +  "Promise",
    +  "Float64Array",
    +  "Int16Array",
    +  "Int32Array",
    +  "Int8Array",
    +  "Uint16Array",
    +  "Uint32Array",
    +  "Float32Array",
    +  "Array",
    +  "Uint8Array",
    +  "Uint8ClampedArray",
    +  "ArrayBuffer"
    +];
    +
    +const ERROR_TYPES = [
    +  "EvalError",
    +  "InternalError",
    +  "RangeError",
    +  "ReferenceError",
    +  "SyntaxError",
    +  "TypeError",
    +  "URIError"
    +];
    +
    +const BUILT_IN_GLOBALS = [
    +  "setInterval",
    +  "setTimeout",
    +  "clearInterval",
    +  "clearTimeout",
    +
    +  "require",
    +  "exports",
    +
    +  "eval",
    +  "isFinite",
    +  "isNaN",
    +  "parseFloat",
    +  "parseInt",
    +  "decodeURI",
    +  "decodeURIComponent",
    +  "encodeURI",
    +  "encodeURIComponent",
    +  "escape",
    +  "unescape"
    +];
    +
    +const BUILT_IN_VARIABLES = [
    +  "arguments",
    +  "this",
    +  "super",
    +  "console",
    +  "window",
    +  "document",
    +  "localStorage",
    +  "module",
    +  "global" // Node.js
    +];
    +
    +const BUILT_INS = [].concat(
    +  BUILT_IN_GLOBALS,
    +  BUILT_IN_VARIABLES,
    +  TYPES,
    +  ERROR_TYPES
    +);
    +
    +/*
    +Language: CoffeeScript
    +Author: Dmytrii Nagirniak 
    +Contributors: Oleg Efimov , Cédric Néhémie 
    +Description: CoffeeScript is a programming language that transcompiles to JavaScript. For info about language see http://coffeescript.org/
    +Category: common, scripting
    +Website: https://coffeescript.org
    +*/
    +
    +/** @type LanguageFn */
    +function coffeescript(hljs) {
    +  const COFFEE_BUILT_INS = [
    +    'npm',
    +    'print'
    +  ];
    +  const COFFEE_LITERALS = [
    +    'yes',
    +    'no',
    +    'on',
    +    'off'
    +  ];
    +  const COFFEE_KEYWORDS = [
    +    'then',
    +    'unless',
    +    'until',
    +    'loop',
    +    'by',
    +    'when',
    +    'and',
    +    'or',
    +    'is',
    +    'isnt',
    +    'not'
    +  ];
    +  const NOT_VALID_KEYWORDS = [
    +    "var",
    +    "const",
    +    "let",
    +    "function",
    +    "static"
    +  ];
    +  const excluding = (list) =>
    +    (kw) => !list.includes(kw);
    +  const KEYWORDS$1 = {
    +    keyword: KEYWORDS.concat(COFFEE_KEYWORDS).filter(excluding(NOT_VALID_KEYWORDS)).join(" "),
    +    literal: LITERALS.concat(COFFEE_LITERALS).join(" "),
    +    built_in: BUILT_INS.concat(COFFEE_BUILT_INS).join(" ")
    +  };
    +  const JS_IDENT_RE = '[A-Za-z$_][0-9A-Za-z$_]*';
    +  const SUBST = {
    +    className: 'subst',
    +    begin: /#\{/,
    +    end: /\}/,
    +    keywords: KEYWORDS$1
    +  };
    +  const EXPRESSIONS = [
    +    hljs.BINARY_NUMBER_MODE,
    +    hljs.inherit(hljs.C_NUMBER_MODE, {
    +      starts: {
    +        end: '(\\s*/)?',
    +        relevance: 0
    +      }
    +    }), // a number tries to eat the following slash to prevent treating it as a regexp
    +    {
    +      className: 'string',
    +      variants: [
    +        {
    +          begin: /'''/,
    +          end: /'''/,
    +          contains: [hljs.BACKSLASH_ESCAPE]
    +        },
    +        {
    +          begin: /'/,
    +          end: /'/,
    +          contains: [hljs.BACKSLASH_ESCAPE]
    +        },
    +        {
    +          begin: /"""/,
    +          end: /"""/,
    +          contains: [
    +            hljs.BACKSLASH_ESCAPE,
    +            SUBST
    +          ]
    +        },
    +        {
    +          begin: /"/,
    +          end: /"/,
    +          contains: [
    +            hljs.BACKSLASH_ESCAPE,
    +            SUBST
    +          ]
    +        }
    +      ]
    +    },
    +    {
    +      className: 'regexp',
    +      variants: [
    +        {
    +          begin: '///',
    +          end: '///',
    +          contains: [
    +            SUBST,
    +            hljs.HASH_COMMENT_MODE
    +          ]
    +        },
    +        {
    +          begin: '//[gim]{0,3}(?=\\W)',
    +          relevance: 0
    +        },
    +        {
    +          // regex can't start with space to parse x / 2 / 3 as two divisions
    +          // regex can't start with *, and it supports an "illegal" in the main mode
    +          begin: /\/(?![ *]).*?(?![\\]).\/[gim]{0,3}(?=\W)/
    +        }
    +      ]
    +    },
    +    {
    +      begin: '@' + JS_IDENT_RE // relevance booster
    +    },
    +    {
    +      subLanguage: 'javascript',
    +      excludeBegin: true,
    +      excludeEnd: true,
    +      variants: [
    +        {
    +          begin: '```',
    +          end: '```'
    +        },
    +        {
    +          begin: '`',
    +          end: '`'
    +        }
    +      ]
    +    }
    +  ];
    +  SUBST.contains = EXPRESSIONS;
    +
    +  const TITLE = hljs.inherit(hljs.TITLE_MODE, {
    +    begin: JS_IDENT_RE
    +  });
    +  const POSSIBLE_PARAMS_RE = '(\\(.*\\)\\s*)?\\B[-=]>';
    +  const PARAMS = {
    +    className: 'params',
    +    begin: '\\([^\\(]',
    +    returnBegin: true,
    +    /* We need another contained nameless mode to not have every nested
    +    pair of parens to be called "params" */
    +    contains: [{
    +      begin: /\(/,
    +      end: /\)/,
    +      keywords: KEYWORDS$1,
    +      contains: ['self'].concat(EXPRESSIONS)
    +    }]
    +  };
    +
    +  return {
    +    name: 'CoffeeScript',
    +    aliases: [
    +      'coffee',
    +      'cson',
    +      'iced'
    +    ],
    +    keywords: KEYWORDS$1,
    +    illegal: /\/\*/,
    +    contains: EXPRESSIONS.concat([
    +      hljs.COMMENT('###', '###'),
    +      hljs.HASH_COMMENT_MODE,
    +      {
    +        className: 'function',
    +        begin: '^\\s*' + JS_IDENT_RE + '\\s*=\\s*' + POSSIBLE_PARAMS_RE,
    +        end: '[-=]>',
    +        returnBegin: true,
    +        contains: [
    +          TITLE,
    +          PARAMS
    +        ]
    +      },
    +      {
    +        // anonymous function start
    +        begin: /[:\(,=]\s*/,
    +        relevance: 0,
    +        contains: [{
    +          className: 'function',
    +          begin: POSSIBLE_PARAMS_RE,
    +          end: '[-=]>',
    +          returnBegin: true,
    +          contains: [PARAMS]
    +        }]
    +      },
    +      {
    +        className: 'class',
    +        beginKeywords: 'class',
    +        end: '$',
    +        illegal: /[:="\[\]]/,
    +        contains: [
    +          {
    +            beginKeywords: 'extends',
    +            endsWithParent: true,
    +            illegal: /[:="\[\]]/,
    +            contains: [TITLE]
    +          },
    +          TITLE
    +        ]
    +      },
    +      {
    +        begin: JS_IDENT_RE + ':',
    +        end: ':',
    +        returnBegin: true,
    +        returnEnd: true,
    +        relevance: 0
    +      }
    +    ])
    +  };
    +}
    +
    +module.exports = coffeescript;
    diff --git a/node_modules/highlight.js/lib/languages/coq.js b/node_modules/highlight.js/lib/languages/coq.js
    new file mode 100644
    index 0000000..79957ea
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/coq.js
    @@ -0,0 +1,79 @@
    +/*
    +Language: Coq
    +Author: Stephan Boyer 
    +Category: functional
    +Website: https://coq.inria.fr
    +*/
    +
    +/** @type LanguageFn */
    +function coq(hljs) {
    +  return {
    +    name: 'Coq',
    +    keywords: {
    +      keyword:
    +        '_|0 as at cofix else end exists exists2 fix for forall fun if IF in let ' +
    +        'match mod Prop return Set then Type using where with ' +
    +        'Abort About Add Admit Admitted All Arguments Assumptions Axiom Back BackTo ' +
    +        'Backtrack Bind Blacklist Canonical Cd Check Class Classes Close Coercion ' +
    +        'Coercions CoFixpoint CoInductive Collection Combined Compute Conjecture ' +
    +        'Conjectures Constant constr Constraint Constructors Context Corollary ' +
    +        'CreateHintDb Cut Declare Defined Definition Delimit Dependencies Dependent ' +
    +        'Derive Drop eauto End Equality Eval Example Existential Existentials ' +
    +        'Existing Export exporting Extern Extract Extraction Fact Field Fields File ' +
    +        'Fixpoint Focus for From Function Functional Generalizable Global Goal Grab ' +
    +        'Grammar Graph Guarded Heap Hint HintDb Hints Hypotheses Hypothesis ident ' +
    +        'Identity If Immediate Implicit Import Include Inductive Infix Info Initial ' +
    +        'Inline Inspect Instance Instances Intro Intros Inversion Inversion_clear ' +
    +        'Language Left Lemma Let Libraries Library Load LoadPath Local Locate Ltac ML ' +
    +        'Mode Module Modules Monomorphic Morphism Next NoInline Notation Obligation ' +
    +        'Obligations Opaque Open Optimize Options Parameter Parameters Parametric ' +
    +        'Path Paths pattern Polymorphic Preterm Print Printing Program Projections ' +
    +        'Proof Proposition Pwd Qed Quit Rec Record Recursive Redirect Relation Remark ' +
    +        'Remove Require Reserved Reset Resolve Restart Rewrite Right Ring Rings Save ' +
    +        'Scheme Scope Scopes Script Search SearchAbout SearchHead SearchPattern ' +
    +        'SearchRewrite Section Separate Set Setoid Show Solve Sorted Step Strategies ' +
    +        'Strategy Structure SubClass Table Tables Tactic Term Test Theorem Time ' +
    +        'Timeout Transparent Type Typeclasses Types Undelimit Undo Unfocus Unfocused ' +
    +        'Unfold Universe Universes Unset Unshelve using Variable Variables Variant ' +
    +        'Verbose Visibility where with',
    +      built_in:
    +        'abstract absurd admit after apply as assert assumption at auto autorewrite ' +
    +        'autounfold before bottom btauto by case case_eq cbn cbv change ' +
    +        'classical_left classical_right clear clearbody cofix compare compute ' +
    +        'congruence constr_eq constructor contradict contradiction cut cutrewrite ' +
    +        'cycle decide decompose dependent destruct destruction dintuition ' +
    +        'discriminate discrR do double dtauto eapply eassumption eauto ecase ' +
    +        'econstructor edestruct ediscriminate eelim eexact eexists einduction ' +
    +        'einjection eleft elim elimtype enough equality erewrite eright ' +
    +        'esimplify_eq esplit evar exact exactly_once exfalso exists f_equal fail ' +
    +        'field field_simplify field_simplify_eq first firstorder fix fold fourier ' +
    +        'functional generalize generalizing gfail give_up has_evar hnf idtac in ' +
    +        'induction injection instantiate intro intro_pattern intros intuition ' +
    +        'inversion inversion_clear is_evar is_var lapply lazy left lia lra move ' +
    +        'native_compute nia nsatz omega once pattern pose progress proof psatz quote ' +
    +        'record red refine reflexivity remember rename repeat replace revert ' +
    +        'revgoals rewrite rewrite_strat right ring ring_simplify rtauto set ' +
    +        'setoid_reflexivity setoid_replace setoid_rewrite setoid_symmetry ' +
    +        'setoid_transitivity shelve shelve_unifiable simpl simple simplify_eq solve ' +
    +        'specialize split split_Rabs split_Rmult stepl stepr subst sum swap ' +
    +        'symmetry tactic tauto time timeout top transitivity trivial try tryif ' +
    +        'unfold unify until using vm_compute with'
    +    },
    +    contains: [
    +      hljs.QUOTE_STRING_MODE,
    +      hljs.COMMENT('\\(\\*', '\\*\\)'),
    +      hljs.C_NUMBER_MODE,
    +      {
    +        className: 'type',
    +        excludeBegin: true,
    +        begin: '\\|\\s*',
    +        end: '\\w+'
    +      },
    +      { // relevance booster
    +        begin: /[-=]>/
    +      }
    +    ]
    +  };
    +}
    +
    +module.exports = coq;
    diff --git a/node_modules/highlight.js/lib/languages/cos.js b/node_modules/highlight.js/lib/languages/cos.js
    new file mode 100644
    index 0000000..b15fc03
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/cos.js
    @@ -0,0 +1,139 @@
    +/*
    +Language: Caché Object Script
    +Author: Nikita Savchenko 
    +Category: enterprise, scripting
    +Website: https://cedocs.intersystems.com/latest/csp/docbook/DocBook.UI.Page.cls
    +*/
    +
    +/** @type LanguageFn */
    +function cos(hljs) {
    +  const STRINGS = {
    +    className: 'string',
    +    variants: [{
    +      begin: '"',
    +      end: '"',
    +      contains: [{ // escaped
    +        begin: "\"\"",
    +        relevance: 0
    +      }]
    +    }]
    +  };
    +
    +  const NUMBERS = {
    +    className: "number",
    +    begin: "\\b(\\d+(\\.\\d*)?|\\.\\d+)",
    +    relevance: 0
    +  };
    +
    +  const COS_KEYWORDS =
    +    'property parameter class classmethod clientmethod extends as break ' +
    +    'catch close continue do d|0 else elseif for goto halt hang h|0 if job ' +
    +    'j|0 kill k|0 lock l|0 merge new open quit q|0 read r|0 return set s|0 ' +
    +    'tcommit throw trollback try tstart use view while write w|0 xecute x|0 ' +
    +    'zkill znspace zn ztrap zwrite zw zzdump zzwrite print zbreak zinsert ' +
    +    'zload zprint zremove zsave zzprint mv mvcall mvcrt mvdim mvprint zquit ' +
    +    'zsync ascii';
    +
    +  // registered function - no need in them due to all functions are highlighted,
    +  // but I'll just leave this here.
    +
    +  // "$bit", "$bitcount",
    +  // "$bitfind", "$bitlogic", "$case", "$char", "$classmethod", "$classname",
    +  // "$compile", "$data", "$decimal", "$double", "$extract", "$factor",
    +  // "$find", "$fnumber", "$get", "$increment", "$inumber", "$isobject",
    +  // "$isvaliddouble", "$isvalidnum", "$justify", "$length", "$list",
    +  // "$listbuild", "$listdata", "$listfind", "$listfromstring", "$listget",
    +  // "$listlength", "$listnext", "$listsame", "$listtostring", "$listvalid",
    +  // "$locate", "$match", "$method", "$name", "$nconvert", "$next",
    +  // "$normalize", "$now", "$number", "$order", "$parameter", "$piece",
    +  // "$prefetchoff", "$prefetchon", "$property", "$qlength", "$qsubscript",
    +  // "$query", "$random", "$replace", "$reverse", "$sconvert", "$select",
    +  // "$sortbegin", "$sortend", "$stack", "$text", "$translate", "$view",
    +  // "$wascii", "$wchar", "$wextract", "$wfind", "$wiswide", "$wlength",
    +  // "$wreverse", "$xecute", "$zabs", "$zarccos", "$zarcsin", "$zarctan",
    +  // "$zcos", "$zcot", "$zcsc", "$zdate", "$zdateh", "$zdatetime",
    +  // "$zdatetimeh", "$zexp", "$zhex", "$zln", "$zlog", "$zpower", "$zsec",
    +  // "$zsin", "$zsqr", "$ztan", "$ztime", "$ztimeh", "$zboolean",
    +  // "$zconvert", "$zcrc", "$zcyc", "$zdascii", "$zdchar", "$zf",
    +  // "$ziswide", "$zlascii", "$zlchar", "$zname", "$zposition", "$zqascii",
    +  // "$zqchar", "$zsearch", "$zseek", "$zstrip", "$zwascii", "$zwchar",
    +  // "$zwidth", "$zwpack", "$zwbpack", "$zwunpack", "$zwbunpack", "$zzenkaku",
    +  // "$change", "$mv", "$mvat", "$mvfmt", "$mvfmts", "$mviconv",
    +  // "$mviconvs", "$mvinmat", "$mvlover", "$mvoconv", "$mvoconvs", "$mvraise",
    +  // "$mvtrans", "$mvv", "$mvname", "$zbitand", "$zbitcount", "$zbitfind",
    +  // "$zbitget", "$zbitlen", "$zbitnot", "$zbitor", "$zbitset", "$zbitstr",
    +  // "$zbitxor", "$zincrement", "$znext", "$zorder", "$zprevious", "$zsort",
    +  // "device", "$ecode", "$estack", "$etrap", "$halt", "$horolog",
    +  // "$io", "$job", "$key", "$namespace", "$principal", "$quit", "$roles",
    +  // "$storage", "$system", "$test", "$this", "$tlevel", "$username",
    +  // "$x", "$y", "$za", "$zb", "$zchild", "$zeof", "$zeos", "$zerror",
    +  // "$zhorolog", "$zio", "$zjob", "$zmode", "$znspace", "$zparent", "$zpi",
    +  // "$zpos", "$zreference", "$zstorage", "$ztimestamp", "$ztimezone",
    +  // "$ztrap", "$zversion"
    +
    +  return {
    +    name: 'Caché Object Script',
    +    case_insensitive: true,
    +    aliases: [
    +      "cos",
    +      "cls"
    +    ],
    +    keywords: COS_KEYWORDS,
    +    contains: [
    +      NUMBERS,
    +      STRINGS,
    +      hljs.C_LINE_COMMENT_MODE,
    +      hljs.C_BLOCK_COMMENT_MODE,
    +      {
    +        className: "comment",
    +        begin: /;/,
    +        end: "$",
    +        relevance: 0
    +      },
    +      { // Functions and user-defined functions: write $ztime(60*60*3), $$myFunc(10), $$^Val(1)
    +        className: "built_in",
    +        begin: /(?:\$\$?|\.\.)\^?[a-zA-Z]+/
    +      },
    +      { // Macro command: quit $$$OK
    +        className: "built_in",
    +        begin: /\$\$\$[a-zA-Z]+/
    +      },
    +      { // Special (global) variables: write %request.Content; Built-in classes: %Library.Integer
    +        className: "built_in",
    +        begin: /%[a-z]+(?:\.[a-z]+)*/
    +      },
    +      { // Global variable: set ^globalName = 12 write ^globalName
    +        className: "symbol",
    +        begin: /\^%?[a-zA-Z][\w]*/
    +      },
    +      { // Some control constructions: do ##class(Package.ClassName).Method(), ##super()
    +        className: "keyword",
    +        begin: /##class|##super|#define|#dim/
    +      },
    +      // sub-languages: are not fully supported by hljs by 11/15/2015
    +      // left for the future implementation.
    +      {
    +        begin: /&sql\(/,
    +        end: /\)/,
    +        excludeBegin: true,
    +        excludeEnd: true,
    +        subLanguage: "sql"
    +      },
    +      {
    +        begin: /&(js|jscript|javascript)/,
    +        excludeBegin: true,
    +        excludeEnd: true,
    +        subLanguage: "javascript"
    +      },
    +      {
    +        // this brakes first and last tag, but this is the only way to embed a valid html
    +        begin: /&html<\s*\s*>/,
    +        subLanguage: "xml"
    +      }
    +    ]
    +  };
    +}
    +
    +module.exports = cos;
    diff --git a/node_modules/highlight.js/lib/languages/cpp.js b/node_modules/highlight.js/lib/languages/cpp.js
    new file mode 100644
    index 0000000..3f3cd6f
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/cpp.js
    @@ -0,0 +1,334 @@
    +/**
    + * @param {string} value
    + * @returns {RegExp}
    + * */
    +
    +/**
    + * @param {RegExp | string } re
    + * @returns {string}
    + */
    +function source(re) {
    +  if (!re) return null;
    +  if (typeof re === "string") return re;
    +
    +  return re.source;
    +}
    +
    +/**
    + * @param {RegExp | string } re
    + * @returns {string}
    + */
    +function optional(re) {
    +  return concat('(', re, ')?');
    +}
    +
    +/**
    + * @param {...(RegExp | string) } args
    + * @returns {string}
    + */
    +function concat(...args) {
    +  const joined = args.map((x) => source(x)).join("");
    +  return joined;
    +}
    +
    +/*
    +Language: C-like foundation grammar for C/C++ grammars
    +Author: Ivan Sagalaev 
    +Contributors: Evgeny Stepanischev , Zaven Muradyan , Roel Deckers , Sam Wu , Jordi Petit , Pieter Vantorre , Google Inc. (David Benjamin) 
    +*/
    +
    +/** @type LanguageFn */
    +function cLike(hljs) {
    +  // added for historic reasons because `hljs.C_LINE_COMMENT_MODE` does
    +  // not include such support nor can we be sure all the grammars depending
    +  // on it would desire this behavior
    +  const C_LINE_COMMENT_MODE = hljs.COMMENT('//', '$', {
    +    contains: [
    +      {
    +        begin: /\\\n/
    +      }
    +    ]
    +  });
    +  const DECLTYPE_AUTO_RE = 'decltype\\(auto\\)';
    +  const NAMESPACE_RE = '[a-zA-Z_]\\w*::';
    +  const TEMPLATE_ARGUMENT_RE = '<[^<>]+>';
    +  const FUNCTION_TYPE_RE = '(' +
    +    DECLTYPE_AUTO_RE + '|' +
    +    optional(NAMESPACE_RE) +
    +    '[a-zA-Z_]\\w*' + optional(TEMPLATE_ARGUMENT_RE) +
    +  ')';
    +  const CPP_PRIMITIVE_TYPES = {
    +    className: 'keyword',
    +    begin: '\\b[a-z\\d_]*_t\\b'
    +  };
    +
    +  // https://en.cppreference.com/w/cpp/language/escape
    +  // \\ \x \xFF \u2837 \u00323747 \374
    +  const CHARACTER_ESCAPES = '\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)';
    +  const STRINGS = {
    +    className: 'string',
    +    variants: [
    +      {
    +        begin: '(u8?|U|L)?"',
    +        end: '"',
    +        illegal: '\\n',
    +        contains: [ hljs.BACKSLASH_ESCAPE ]
    +      },
    +      {
    +        begin: '(u8?|U|L)?\'(' + CHARACTER_ESCAPES + "|.)",
    +        end: '\'',
    +        illegal: '.'
    +      },
    +      hljs.END_SAME_AS_BEGIN({
    +        begin: /(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,
    +        end: /\)([^()\\ ]{0,16})"/
    +      })
    +    ]
    +  };
    +
    +  const NUMBERS = {
    +    className: 'number',
    +    variants: [
    +      {
    +        begin: '\\b(0b[01\']+)'
    +      },
    +      {
    +        begin: '(-?)\\b([\\d\']+(\\.[\\d\']*)?|\\.[\\d\']+)(u|U|l|L|ul|UL|f|F|b|B)'
    +      },
    +      {
    +        begin: '(-?)(\\b0[xX][a-fA-F0-9\']+|(\\b[\\d\']+(\\.[\\d\']*)?|\\.[\\d\']+)([eE][-+]?[\\d\']+)?)'
    +      }
    +    ],
    +    relevance: 0
    +  };
    +
    +  const PREPROCESSOR = {
    +    className: 'meta',
    +    begin: /#\s*[a-z]+\b/,
    +    end: /$/,
    +    keywords: {
    +      'meta-keyword':
    +        'if else elif endif define undef warning error line ' +
    +        'pragma _Pragma ifdef ifndef include'
    +    },
    +    contains: [
    +      {
    +        begin: /\\\n/,
    +        relevance: 0
    +      },
    +      hljs.inherit(STRINGS, {
    +        className: 'meta-string'
    +      }),
    +      {
    +        className: 'meta-string',
    +        begin: /<.*?>/,
    +        end: /$/,
    +        illegal: '\\n'
    +      },
    +      C_LINE_COMMENT_MODE,
    +      hljs.C_BLOCK_COMMENT_MODE
    +    ]
    +  };
    +
    +  const TITLE_MODE = {
    +    className: 'title',
    +    begin: optional(NAMESPACE_RE) + hljs.IDENT_RE,
    +    relevance: 0
    +  };
    +
    +  const FUNCTION_TITLE = optional(NAMESPACE_RE) + hljs.IDENT_RE + '\\s*\\(';
    +
    +  const CPP_KEYWORDS = {
    +    keyword: 'int float while private char char8_t char16_t char32_t catch import module export virtual operator sizeof ' +
    +      'dynamic_cast|10 typedef const_cast|10 const for static_cast|10 union namespace ' +
    +      'unsigned long volatile static protected bool template mutable if public friend ' +
    +      'do goto auto void enum else break extern using asm case typeid wchar_t ' +
    +      'short reinterpret_cast|10 default double register explicit signed typename try this ' +
    +      'switch continue inline delete alignas alignof constexpr consteval constinit decltype ' +
    +      'concept co_await co_return co_yield requires ' +
    +      'noexcept static_assert thread_local restrict final override ' +
    +      'atomic_bool atomic_char atomic_schar ' +
    +      'atomic_uchar atomic_short atomic_ushort atomic_int atomic_uint atomic_long atomic_ulong atomic_llong ' +
    +      'atomic_ullong new throw return ' +
    +      'and and_eq bitand bitor compl not not_eq or or_eq xor xor_eq',
    +    built_in: 'std string wstring cin cout cerr clog stdin stdout stderr stringstream istringstream ostringstream ' +
    +      'auto_ptr deque list queue stack vector map set pair bitset multiset multimap unordered_set ' +
    +      'unordered_map unordered_multiset unordered_multimap priority_queue make_pair array shared_ptr abort terminate abs acos ' +
    +      'asin atan2 atan calloc ceil cosh cos exit exp fabs floor fmod fprintf fputs free frexp ' +
    +      'fscanf future isalnum isalpha iscntrl isdigit isgraph islower isprint ispunct isspace isupper ' +
    +      'isxdigit tolower toupper labs ldexp log10 log malloc realloc memchr memcmp memcpy memset modf pow ' +
    +      'printf putchar puts scanf sinh sin snprintf sprintf sqrt sscanf strcat strchr strcmp ' +
    +      'strcpy strcspn strlen strncat strncmp strncpy strpbrk strrchr strspn strstr tanh tan ' +
    +      'vfprintf vprintf vsprintf endl initializer_list unique_ptr _Bool complex _Complex imaginary _Imaginary',
    +    literal: 'true false nullptr NULL'
    +  };
    +
    +  const EXPRESSION_CONTAINS = [
    +    PREPROCESSOR,
    +    CPP_PRIMITIVE_TYPES,
    +    C_LINE_COMMENT_MODE,
    +    hljs.C_BLOCK_COMMENT_MODE,
    +    NUMBERS,
    +    STRINGS
    +  ];
    +
    +  const EXPRESSION_CONTEXT = {
    +    // This mode covers expression context where we can't expect a function
    +    // definition and shouldn't highlight anything that looks like one:
    +    // `return some()`, `else if()`, `(x*sum(1, 2))`
    +    variants: [
    +      {
    +        begin: /=/,
    +        end: /;/
    +      },
    +      {
    +        begin: /\(/,
    +        end: /\)/
    +      },
    +      {
    +        beginKeywords: 'new throw return else',
    +        end: /;/
    +      }
    +    ],
    +    keywords: CPP_KEYWORDS,
    +    contains: EXPRESSION_CONTAINS.concat([
    +      {
    +        begin: /\(/,
    +        end: /\)/,
    +        keywords: CPP_KEYWORDS,
    +        contains: EXPRESSION_CONTAINS.concat([ 'self' ]),
    +        relevance: 0
    +      }
    +    ]),
    +    relevance: 0
    +  };
    +
    +  const FUNCTION_DECLARATION = {
    +    className: 'function',
    +    begin: '(' + FUNCTION_TYPE_RE + '[\\*&\\s]+)+' + FUNCTION_TITLE,
    +    returnBegin: true,
    +    end: /[{;=]/,
    +    excludeEnd: true,
    +    keywords: CPP_KEYWORDS,
    +    illegal: /[^\w\s\*&:<>]/,
    +    contains: [
    +      { // to prevent it from being confused as the function title
    +        begin: DECLTYPE_AUTO_RE,
    +        keywords: CPP_KEYWORDS,
    +        relevance: 0
    +      },
    +      {
    +        begin: FUNCTION_TITLE,
    +        returnBegin: true,
    +        contains: [ TITLE_MODE ],
    +        relevance: 0
    +      },
    +      {
    +        className: 'params',
    +        begin: /\(/,
    +        end: /\)/,
    +        keywords: CPP_KEYWORDS,
    +        relevance: 0,
    +        contains: [
    +          C_LINE_COMMENT_MODE,
    +          hljs.C_BLOCK_COMMENT_MODE,
    +          STRINGS,
    +          NUMBERS,
    +          CPP_PRIMITIVE_TYPES,
    +          // Count matching parentheses.
    +          {
    +            begin: /\(/,
    +            end: /\)/,
    +            keywords: CPP_KEYWORDS,
    +            relevance: 0,
    +            contains: [
    +              'self',
    +              C_LINE_COMMENT_MODE,
    +              hljs.C_BLOCK_COMMENT_MODE,
    +              STRINGS,
    +              NUMBERS,
    +              CPP_PRIMITIVE_TYPES
    +            ]
    +          }
    +        ]
    +      },
    +      CPP_PRIMITIVE_TYPES,
    +      C_LINE_COMMENT_MODE,
    +      hljs.C_BLOCK_COMMENT_MODE,
    +      PREPROCESSOR
    +    ]
    +  };
    +
    +  return {
    +    aliases: [
    +      'c',
    +      'cc',
    +      'h',
    +      'c++',
    +      'h++',
    +      'hpp',
    +      'hh',
    +      'hxx',
    +      'cxx'
    +    ],
    +    keywords: CPP_KEYWORDS,
    +    // the base c-like language will NEVER be auto-detected, rather the
    +    // derivitives: c, c++, arduino turn auto-detect back on for themselves
    +    disableAutodetect: true,
    +    illegal: ' rooms (9);`
    +          begin: '\\b(deque|list|queue|priority_queue|pair|stack|vector|map|set|bitset|multiset|multimap|unordered_map|unordered_set|unordered_multiset|unordered_multimap|array)\\s*<',
    +          end: '>',
    +          keywords: CPP_KEYWORDS,
    +          contains: [
    +            'self',
    +            CPP_PRIMITIVE_TYPES
    +          ]
    +        },
    +        {
    +          begin: hljs.IDENT_RE + '::',
    +          keywords: CPP_KEYWORDS
    +        },
    +        {
    +          className: 'class',
    +          beginKeywords: 'enum class struct union',
    +          end: /[{;:<>=]/,
    +          contains: [
    +            {
    +              beginKeywords: "final class struct"
    +            },
    +            hljs.TITLE_MODE
    +          ]
    +        }
    +      ]),
    +    exports: {
    +      preprocessor: PREPROCESSOR,
    +      strings: STRINGS,
    +      keywords: CPP_KEYWORDS
    +    }
    +  };
    +}
    +
    +/*
    +Language: C++
    +Category: common, system
    +Website: https://isocpp.org
    +*/
    +
    +/** @type LanguageFn */
    +function cpp(hljs) {
    +  const lang = cLike(hljs);
    +  // return auto-detection back on
    +  lang.disableAutodetect = false;
    +  lang.name = 'C++';
    +  lang.aliases = ['cc', 'c++', 'h++', 'hpp', 'hh', 'hxx', 'cxx'];
    +  return lang;
    +}
    +
    +module.exports = cpp;
    diff --git a/node_modules/highlight.js/lib/languages/crmsh.js b/node_modules/highlight.js/lib/languages/crmsh.js
    new file mode 100644
    index 0000000..78c951c
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/crmsh.js
    @@ -0,0 +1,102 @@
    +/*
    +Language: crmsh
    +Author: Kristoffer Gronlund 
    +Website: http://crmsh.github.io
    +Description: Syntax Highlighting for the crmsh DSL
    +Category: config
    +*/
    +
    +/** @type LanguageFn */
    +function crmsh(hljs) {
    +  const RESOURCES = 'primitive rsc_template';
    +  const COMMANDS = 'group clone ms master location colocation order fencing_topology ' +
    +      'rsc_ticket acl_target acl_group user role ' +
    +      'tag xml';
    +  const PROPERTY_SETS = 'property rsc_defaults op_defaults';
    +  const KEYWORDS = 'params meta operations op rule attributes utilization';
    +  const OPERATORS = 'read write deny defined not_defined in_range date spec in ' +
    +      'ref reference attribute type xpath version and or lt gt tag ' +
    +      'lte gte eq ne \\';
    +  const TYPES = 'number string';
    +  const LITERALS = 'Master Started Slave Stopped start promote demote stop monitor true false';
    +
    +  return {
    +    name: 'crmsh',
    +    aliases: [
    +      'crm',
    +      'pcmk'
    +    ],
    +    case_insensitive: true,
    +    keywords: {
    +      keyword: KEYWORDS + ' ' + OPERATORS + ' ' + TYPES,
    +      literal: LITERALS
    +    },
    +    contains: [
    +      hljs.HASH_COMMENT_MODE,
    +      {
    +        beginKeywords: 'node',
    +        starts: {
    +          end: '\\s*([\\w_-]+:)?',
    +          starts: {
    +            className: 'title',
    +            end: '\\s*[\\$\\w_][\\w_-]*'
    +          }
    +        }
    +      },
    +      {
    +        beginKeywords: RESOURCES,
    +        starts: {
    +          className: 'title',
    +          end: '\\s*[\\$\\w_][\\w_-]*',
    +          starts: {
    +            end: '\\s*@?[\\w_][\\w_\\.:-]*'
    +          }
    +        }
    +      },
    +      {
    +        begin: '\\b(' + COMMANDS.split(' ').join('|') + ')\\s+',
    +        keywords: COMMANDS,
    +        starts: {
    +          className: 'title',
    +          end: '[\\$\\w_][\\w_-]*'
    +        }
    +      },
    +      {
    +        beginKeywords: PROPERTY_SETS,
    +        starts: {
    +          className: 'title',
    +          end: '\\s*([\\w_-]+:)?'
    +        }
    +      },
    +      hljs.QUOTE_STRING_MODE,
    +      {
    +        className: 'meta',
    +        begin: '(ocf|systemd|service|lsb):[\\w_:-]+',
    +        relevance: 0
    +      },
    +      {
    +        className: 'number',
    +        begin: '\\b\\d+(\\.\\d+)?(ms|s|h|m)?',
    +        relevance: 0
    +      },
    +      {
    +        className: 'literal',
    +        begin: '[-]?(infinity|inf)',
    +        relevance: 0
    +      },
    +      {
    +        className: 'attr',
    +        begin: /([A-Za-z$_#][\w_-]+)=/,
    +        relevance: 0
    +      },
    +      {
    +        className: 'tag',
    +        begin: '',
    +        relevance: 0
    +      }
    +    ]
    +  };
    +}
    +
    +module.exports = crmsh;
    diff --git a/node_modules/highlight.js/lib/languages/crystal.js b/node_modules/highlight.js/lib/languages/crystal.js
    new file mode 100644
    index 0000000..9be806c
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/crystal.js
    @@ -0,0 +1,197 @@
    +/*
    +Language: Crystal
    +Author: TSUYUSATO Kitsune 
    +Website: https://crystal-lang.org
    +*/
    +
    +/** @type LanguageFn */
    +function crystal(hljs) {
    +  var INT_SUFFIX = '(_?[ui](8|16|32|64|128))?';
    +  var FLOAT_SUFFIX = '(_?f(32|64))?';
    +  var CRYSTAL_IDENT_RE = '[a-zA-Z_]\\w*[!?=]?';
    +  var CRYSTAL_METHOD_RE = '[a-zA-Z_]\\w*[!?=]?|[-+~]@|<<|>>|[=!]~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~|]|//|//=|&[-+*]=?|&\\*\\*|\\[\\][=?]?';
    +  var CRYSTAL_PATH_RE = '[A-Za-z_]\\w*(::\\w+)*(\\?|!)?';
    +  var CRYSTAL_KEYWORDS = {
    +    $pattern: CRYSTAL_IDENT_RE,
    +    keyword:
    +      'abstract alias annotation as as? asm begin break case class def do else elsif end ensure enum extend for fun if ' +
    +      'include instance_sizeof is_a? lib macro module next nil? of out pointerof private protected rescue responds_to? ' +
    +      'return require select self sizeof struct super then type typeof union uninitialized unless until verbatim when while with yield ' +
    +      '__DIR__ __END_LINE__ __FILE__ __LINE__',
    +    literal: 'false nil true'
    +  };
    +  var SUBST = {
    +    className: 'subst',
    +    begin: /#\{/, end: /\}/,
    +    keywords: CRYSTAL_KEYWORDS
    +  };
    +  var EXPANSION = {
    +    className: 'template-variable',
    +    variants: [
    +      {begin: '\\{\\{', end: '\\}\\}'},
    +      {begin: '\\{%', end: '%\\}'}
    +    ],
    +    keywords: CRYSTAL_KEYWORDS
    +  };
    +
    +  function recursiveParen(begin, end) {
    +    var
    +    contains = [{begin: begin, end: end}];
    +    contains[0].contains = contains;
    +    return contains;
    +  }
    +  var STRING = {
    +    className: 'string',
    +    contains: [hljs.BACKSLASH_ESCAPE, SUBST],
    +    variants: [
    +      {begin: /'/, end: /'/},
    +      {begin: /"/, end: /"/},
    +      {begin: /`/, end: /`/},
    +      {begin: '%[Qwi]?\\(', end: '\\)', contains: recursiveParen('\\(', '\\)')},
    +      {begin: '%[Qwi]?\\[', end: '\\]', contains: recursiveParen('\\[', '\\]')},
    +      {begin: '%[Qwi]?\\{', end: /\}/, contains: recursiveParen(/\{/, /\}/)},
    +      {begin: '%[Qwi]?<', end: '>', contains: recursiveParen('<', '>')},
    +      {begin: '%[Qwi]?\\|', end: '\\|'},
    +      {begin: /<<-\w+$/, end: /^\s*\w+$/},
    +    ],
    +    relevance: 0,
    +  };
    +  var Q_STRING = {
    +    className: 'string',
    +    variants: [
    +      {begin: '%q\\(', end: '\\)', contains: recursiveParen('\\(', '\\)')},
    +      {begin: '%q\\[', end: '\\]', contains: recursiveParen('\\[', '\\]')},
    +      {begin: '%q\\{', end: /\}/, contains: recursiveParen(/\{/, /\}/)},
    +      {begin: '%q<', end: '>', contains: recursiveParen('<', '>')},
    +      {begin: '%q\\|', end: '\\|'},
    +      {begin: /<<-'\w+'$/, end: /^\s*\w+$/},
    +    ],
    +    relevance: 0,
    +  };
    +  var REGEXP = {
    +    begin: '(?!%\\})(' + hljs.RE_STARTERS_RE + '|\\n|\\b(case|if|select|unless|until|when|while)\\b)\\s*',
    +    keywords: 'case if select unless until when while',
    +    contains: [
    +      {
    +        className: 'regexp',
    +        contains: [hljs.BACKSLASH_ESCAPE, SUBST],
    +        variants: [
    +          {begin: '//[a-z]*', relevance: 0},
    +          {begin: '/(?!\\/)', end: '/[a-z]*'},
    +        ]
    +      }
    +    ],
    +    relevance: 0
    +  };
    +  var REGEXP2 = {
    +    className: 'regexp',
    +    contains: [hljs.BACKSLASH_ESCAPE, SUBST],
    +    variants: [
    +      {begin: '%r\\(', end: '\\)', contains: recursiveParen('\\(', '\\)')},
    +      {begin: '%r\\[', end: '\\]', contains: recursiveParen('\\[', '\\]')},
    +      {begin: '%r\\{', end: /\}/, contains: recursiveParen(/\{/, /\}/)},
    +      {begin: '%r<', end: '>', contains: recursiveParen('<', '>')},
    +      {begin: '%r\\|', end: '\\|'},
    +    ],
    +    relevance: 0
    +  };
    +  var ATTRIBUTE = {
    +    className: 'meta',
    +    begin: '@\\[', end: '\\]',
    +    contains: [
    +      hljs.inherit(hljs.QUOTE_STRING_MODE, {className: 'meta-string'})
    +    ]
    +  };
    +  var CRYSTAL_DEFAULT_CONTAINS = [
    +    EXPANSION,
    +    STRING,
    +    Q_STRING,
    +    REGEXP2,
    +    REGEXP,
    +    ATTRIBUTE,
    +    hljs.HASH_COMMENT_MODE,
    +    {
    +      className: 'class',
    +      beginKeywords: 'class module struct', end: '$|;',
    +      illegal: /=/,
    +      contains: [
    +        hljs.HASH_COMMENT_MODE,
    +        hljs.inherit(hljs.TITLE_MODE, {begin: CRYSTAL_PATH_RE}),
    +        {begin: '<'} // relevance booster for inheritance
    +      ]
    +    },
    +    {
    +      className: 'class',
    +      beginKeywords: 'lib enum union', end: '$|;',
    +      illegal: /=/,
    +      contains: [
    +        hljs.HASH_COMMENT_MODE,
    +        hljs.inherit(hljs.TITLE_MODE, {begin: CRYSTAL_PATH_RE}),
    +      ],
    +      relevance: 10
    +    },
    +    {
    +      beginKeywords: 'annotation', end: '$|;',
    +      illegal: /=/,
    +      contains: [
    +        hljs.HASH_COMMENT_MODE,
    +        hljs.inherit(hljs.TITLE_MODE, {begin: CRYSTAL_PATH_RE}),
    +      ],
    +      relevance: 10
    +    },
    +    {
    +      className: 'function',
    +      beginKeywords: 'def', end: /\B\b/,
    +      contains: [
    +        hljs.inherit(hljs.TITLE_MODE, {
    +          begin: CRYSTAL_METHOD_RE,
    +          endsParent: true
    +        })
    +      ]
    +    },
    +    {
    +      className: 'function',
    +      beginKeywords: 'fun macro', end: /\B\b/,
    +      contains: [
    +        hljs.inherit(hljs.TITLE_MODE, {
    +          begin: CRYSTAL_METHOD_RE,
    +          endsParent: true
    +        })
    +      ],
    +      relevance: 2
    +    },
    +    {
    +      className: 'symbol',
    +      begin: hljs.UNDERSCORE_IDENT_RE + '(!|\\?)?:',
    +      relevance: 0
    +    },
    +    {
    +      className: 'symbol',
    +      begin: ':',
    +      contains: [STRING, {begin: CRYSTAL_METHOD_RE}],
    +      relevance: 0
    +    },
    +    {
    +      className: 'number',
    +      variants: [
    +        { begin: '\\b0b([01_]+)' + INT_SUFFIX },
    +        { begin: '\\b0o([0-7_]+)' + INT_SUFFIX },
    +        { begin: '\\b0x([A-Fa-f0-9_]+)' + INT_SUFFIX },
    +        { begin: '\\b([1-9][0-9_]*[0-9]|[0-9])(\\.[0-9][0-9_]*)?([eE]_?[-+]?[0-9_]*)?' + FLOAT_SUFFIX + '(?!_)' },
    +        { begin: '\\b([1-9][0-9_]*|0)' + INT_SUFFIX }
    +      ],
    +      relevance: 0
    +    }
    +  ];
    +  SUBST.contains = CRYSTAL_DEFAULT_CONTAINS;
    +  EXPANSION.contains = CRYSTAL_DEFAULT_CONTAINS.slice(1); // without EXPANSION
    +
    +  return {
    +    name: 'Crystal',
    +    aliases: ['cr'],
    +    keywords: CRYSTAL_KEYWORDS,
    +    contains: CRYSTAL_DEFAULT_CONTAINS
    +  };
    +}
    +
    +module.exports = crystal;
    diff --git a/node_modules/highlight.js/lib/languages/csharp.js b/node_modules/highlight.js/lib/languages/csharp.js
    new file mode 100644
    index 0000000..6474f2e
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/csharp.js
    @@ -0,0 +1,367 @@
    +/*
    +Language: C#
    +Author: Jason Diamond 
    +Contributor: Nicolas LLOBERA , Pieter Vantorre , David Pine 
    +Website: https://docs.microsoft.com/en-us/dotnet/csharp/
    +Category: common
    +*/
    +
    +/** @type LanguageFn */
    +function csharp(hljs) {
    +  var BUILT_IN_KEYWORDS = [
    +      'bool',
    +      'byte',
    +      'char',
    +      'decimal',
    +      'delegate',
    +      'double',
    +      'dynamic',
    +      'enum',
    +      'float',
    +      'int',
    +      'long',
    +      'nint',
    +      'nuint',
    +      'object',
    +      'sbyte',
    +      'short',
    +      'string',
    +      'ulong',
    +      'unit',
    +      'ushort'
    +  ];
    +  var FUNCTION_MODIFIERS = [
    +    'public',
    +    'private',
    +    'protected',
    +    'static',
    +    'internal',
    +    'protected',
    +    'abstract',
    +    'async',
    +    'extern',
    +    'override',
    +    'unsafe',
    +    'virtual',
    +    'new',
    +    'sealed',
    +    'partial'
    +  ];
    +  var LITERAL_KEYWORDS = [
    +      'default',
    +      'false',
    +      'null',
    +      'true'
    +  ];
    +  var NORMAL_KEYWORDS = [
    +    'abstract',
    +    'as',
    +    'base',
    +    'break',
    +    'case',
    +    'class',
    +    'const',
    +    'continue',
    +    'do',
    +    'else',
    +    'event',
    +    'explicit',
    +    'extern',
    +    'finally',
    +    'fixed',
    +    'for',
    +    'foreach',
    +    'goto',
    +    'if',
    +    'implicit',
    +    'in',
    +    'interface',
    +    'internal',
    +    'is',
    +    'lock',
    +    'namespace',
    +    'new',
    +    'operator',
    +    'out',
    +    'override',
    +    'params',
    +    'private',
    +    'protected',
    +    'public',
    +    'readonly',
    +    'record',
    +    'ref',
    +    'return',
    +    'sealed',
    +    'sizeof',
    +    'stackalloc',
    +    'static',
    +    'struct',
    +    'switch',
    +    'this',
    +    'throw',
    +    'try',
    +    'typeof',
    +    'unchecked',
    +    'unsafe',
    +    'using',
    +    'virtual',
    +    'void',
    +    'volatile',
    +    'while'
    +  ];
    +  var CONTEXTUAL_KEYWORDS = [
    +    'add',
    +    'alias',
    +    'and',
    +    'ascending',
    +    'async',
    +    'await',
    +    'by',
    +    'descending',
    +    'equals',
    +    'from',
    +    'get',
    +    'global',
    +    'group',
    +    'init',
    +    'into',
    +    'join',
    +    'let',
    +    'nameof',
    +    'not',
    +    'notnull',
    +    'on',
    +    'or',
    +    'orderby',
    +    'partial',
    +    'remove',
    +    'select',
    +    'set',
    +    'unmanaged',
    +    'value|0',
    +    'var',
    +    'when',
    +    'where',
    +    'with',
    +    'yield'
    +  ];
    +
    +  var KEYWORDS = {
    +    keyword: NORMAL_KEYWORDS.concat(CONTEXTUAL_KEYWORDS).join(' '),
    +    built_in: BUILT_IN_KEYWORDS.join(' '),
    +    literal: LITERAL_KEYWORDS.join(' ')
    +  };
    +  var TITLE_MODE = hljs.inherit(hljs.TITLE_MODE, {begin: '[a-zA-Z](\\.?\\w)*'});
    +  var NUMBERS = {
    +    className: 'number',
    +    variants: [
    +      { begin: '\\b(0b[01\']+)' },
    +      { begin: '(-?)\\b([\\d\']+(\\.[\\d\']*)?|\\.[\\d\']+)(u|U|l|L|ul|UL|f|F|b|B)' },
    +      { begin: '(-?)(\\b0[xX][a-fA-F0-9\']+|(\\b[\\d\']+(\\.[\\d\']*)?|\\.[\\d\']+)([eE][-+]?[\\d\']+)?)' }
    +    ],
    +    relevance: 0
    +  };
    +  var VERBATIM_STRING = {
    +    className: 'string',
    +    begin: '@"', end: '"',
    +    contains: [{begin: '""'}]
    +  };
    +  var VERBATIM_STRING_NO_LF = hljs.inherit(VERBATIM_STRING, {illegal: /\n/});
    +  var SUBST = {
    +    className: 'subst',
    +    begin: /\{/, end: /\}/,
    +    keywords: KEYWORDS
    +  };
    +  var SUBST_NO_LF = hljs.inherit(SUBST, {illegal: /\n/});
    +  var INTERPOLATED_STRING = {
    +    className: 'string',
    +    begin: /\$"/, end: '"',
    +    illegal: /\n/,
    +    contains: [{begin: /\{\{/}, {begin: /\}\}/}, hljs.BACKSLASH_ESCAPE, SUBST_NO_LF]
    +  };
    +  var INTERPOLATED_VERBATIM_STRING = {
    +    className: 'string',
    +    begin: /\$@"/, end: '"',
    +    contains: [{begin: /\{\{/}, {begin: /\}\}/}, {begin: '""'}, SUBST]
    +  };
    +  var INTERPOLATED_VERBATIM_STRING_NO_LF = hljs.inherit(INTERPOLATED_VERBATIM_STRING, {
    +    illegal: /\n/,
    +    contains: [{begin: /\{\{/}, {begin: /\}\}/}, {begin: '""'}, SUBST_NO_LF]
    +  });
    +  SUBST.contains = [
    +    INTERPOLATED_VERBATIM_STRING,
    +    INTERPOLATED_STRING,
    +    VERBATIM_STRING,
    +    hljs.APOS_STRING_MODE,
    +    hljs.QUOTE_STRING_MODE,
    +    NUMBERS,
    +    hljs.C_BLOCK_COMMENT_MODE
    +  ];
    +  SUBST_NO_LF.contains = [
    +    INTERPOLATED_VERBATIM_STRING_NO_LF,
    +    INTERPOLATED_STRING,
    +    VERBATIM_STRING_NO_LF,
    +    hljs.APOS_STRING_MODE,
    +    hljs.QUOTE_STRING_MODE,
    +    NUMBERS,
    +    hljs.inherit(hljs.C_BLOCK_COMMENT_MODE, {illegal: /\n/})
    +  ];
    +  var STRING = {
    +    variants: [
    +      INTERPOLATED_VERBATIM_STRING,
    +      INTERPOLATED_STRING,
    +      VERBATIM_STRING,
    +      hljs.APOS_STRING_MODE,
    +      hljs.QUOTE_STRING_MODE
    +    ]
    +  };
    +
    +  var GENERIC_MODIFIER = {
    +    begin: "<",
    +    end: ">",
    +    contains: [
    +      { beginKeywords: "in out"},
    +      TITLE_MODE
    +    ]
    +  };
    +  var TYPE_IDENT_RE = hljs.IDENT_RE + '(<' + hljs.IDENT_RE + '(\\s*,\\s*' + hljs.IDENT_RE + ')*>)?(\\[\\])?';
    +  var AT_IDENTIFIER = {
    +    // prevents expressions like `@class` from incorrect flagging
    +    // `class` as a keyword
    +    begin: "@" + hljs.IDENT_RE,
    +    relevance: 0
    +  };
    +
    +  return {
    +    name: 'C#',
    +    aliases: ['cs', 'c#'],
    +    keywords: KEYWORDS,
    +    illegal: /::/,
    +    contains: [
    +      hljs.COMMENT(
    +        '///',
    +        '$',
    +        {
    +          returnBegin: true,
    +          contains: [
    +            {
    +              className: 'doctag',
    +              variants: [
    +                {
    +                  begin: '///', relevance: 0
    +                },
    +                {
    +                  begin: ''
    +                },
    +                {
    +                  begin: ''
    +                }
    +              ]
    +            }
    +          ]
    +        }
    +      ),
    +      hljs.C_LINE_COMMENT_MODE,
    +      hljs.C_BLOCK_COMMENT_MODE,
    +      {
    +        className: 'meta',
    +        begin: '#', end: '$',
    +        keywords: {
    +          'meta-keyword': 'if else elif endif define undef warning error line region endregion pragma checksum'
    +        }
    +      },
    +      STRING,
    +      NUMBERS,
    +      {
    +        beginKeywords: 'class interface',
    +        relevance: 0,
    +        end: /[{;=]/,
    +        illegal: /[^\s:,]/,
    +        contains: [
    +          { beginKeywords: "where class" },
    +          TITLE_MODE,
    +          GENERIC_MODIFIER,
    +          hljs.C_LINE_COMMENT_MODE,
    +          hljs.C_BLOCK_COMMENT_MODE
    +        ]
    +      },
    +      {
    +        beginKeywords: 'namespace',
    +        relevance: 0,
    +        end: /[{;=]/,
    +        illegal: /[^\s:]/,
    +        contains: [
    +          TITLE_MODE,
    +          hljs.C_LINE_COMMENT_MODE,
    +          hljs.C_BLOCK_COMMENT_MODE
    +        ]
    +      },
    +      {
    +        beginKeywords: 'record',
    +        relevance: 0,
    +        end: /[{;=]/,
    +        illegal: /[^\s:]/,
    +        contains: [
    +          TITLE_MODE,
    +          GENERIC_MODIFIER,
    +          hljs.C_LINE_COMMENT_MODE,
    +          hljs.C_BLOCK_COMMENT_MODE
    +        ]
    +      },
    +      {
    +        // [Attributes("")]
    +        className: 'meta',
    +        begin: '^\\s*\\[', excludeBegin: true, end: '\\]', excludeEnd: true,
    +        contains: [
    +          {className: 'meta-string', begin: /"/, end: /"/}
    +        ]
    +      },
    +      {
    +        // Expression keywords prevent 'keyword Name(...)' from being
    +        // recognized as a function definition
    +        beginKeywords: 'new return throw await else',
    +        relevance: 0
    +      },
    +      {
    +        className: 'function',
    +        begin: '(' + TYPE_IDENT_RE + '\\s+)+' + hljs.IDENT_RE + '\\s*(<.+>\\s*)?\\(', returnBegin: true,
    +        end: /\s*[{;=]/, excludeEnd: true,
    +        keywords: KEYWORDS,
    +        contains: [
    +          // prevents these from being highlighted `title`
    +          {
    +            beginKeywords: FUNCTION_MODIFIERS.join(" "),
    +            relevance: 0
    +          },
    +          {
    +            begin: hljs.IDENT_RE + '\\s*(<.+>\\s*)?\\(', returnBegin: true,
    +            contains: [
    +              hljs.TITLE_MODE,
    +              GENERIC_MODIFIER
    +            ],
    +            relevance: 0
    +          },
    +          {
    +            className: 'params',
    +            begin: /\(/, end: /\)/,
    +            excludeBegin: true,
    +            excludeEnd: true,
    +            keywords: KEYWORDS,
    +            relevance: 0,
    +            contains: [
    +              STRING,
    +              NUMBERS,
    +              hljs.C_BLOCK_COMMENT_MODE
    +            ]
    +          },
    +          hljs.C_LINE_COMMENT_MODE,
    +          hljs.C_BLOCK_COMMENT_MODE
    +        ]
    +      },
    +      AT_IDENTIFIER
    +    ]
    +  };
    +}
    +
    +module.exports = csharp;
    diff --git a/node_modules/highlight.js/lib/languages/csp.js b/node_modules/highlight.js/lib/languages/csp.js
    new file mode 100644
    index 0000000..6539c47
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/csp.js
    @@ -0,0 +1,37 @@
    +/*
    +Language: CSP
    +Description: Content Security Policy definition highlighting
    +Author: Taras 
    +Website: https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP
    +
    +vim: ts=2 sw=2 st=2
    +*/
    +
    +/** @type LanguageFn */
    +function csp(hljs) {
    +  return {
    +    name: 'CSP',
    +    case_insensitive: false,
    +    keywords: {
    +      $pattern: '[a-zA-Z][a-zA-Z0-9_-]*',
    +      keyword: 'base-uri child-src connect-src default-src font-src form-action ' +
    +        'frame-ancestors frame-src img-src media-src object-src plugin-types ' +
    +        'report-uri sandbox script-src style-src'
    +    },
    +    contains: [
    +      {
    +        className: 'string',
    +        begin: "'",
    +        end: "'"
    +      },
    +      {
    +        className: 'attribute',
    +        begin: '^Content',
    +        end: ':',
    +        excludeEnd: true
    +      }
    +    ]
    +  };
    +}
    +
    +module.exports = csp;
    diff --git a/node_modules/highlight.js/lib/languages/css.js b/node_modules/highlight.js/lib/languages/css.js
    new file mode 100644
    index 0000000..8ab7e3e
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/css.js
    @@ -0,0 +1,135 @@
    +/*
    +Language: CSS
    +Category: common, css
    +Website: https://developer.mozilla.org/en-US/docs/Web/CSS
    +*/
    +
    +/** @type LanguageFn */
    +function css(hljs) {
    +  var FUNCTION_LIKE = {
    +    begin: /[\w-]+\(/, returnBegin: true,
    +    contains: [
    +      {
    +        className: 'built_in',
    +        begin: /[\w-]+/
    +      },
    +      {
    +        begin: /\(/, end: /\)/,
    +        contains: [
    +          hljs.APOS_STRING_MODE,
    +          hljs.QUOTE_STRING_MODE,
    +          hljs.CSS_NUMBER_MODE,
    +        ]
    +      }
    +    ]
    +  };
    +  var ATTRIBUTE = {
    +    className: 'attribute',
    +    begin: /\S/, end: ':', excludeEnd: true,
    +    starts: {
    +      endsWithParent: true, excludeEnd: true,
    +      contains: [
    +        FUNCTION_LIKE,
    +        hljs.CSS_NUMBER_MODE,
    +        hljs.QUOTE_STRING_MODE,
    +        hljs.APOS_STRING_MODE,
    +        hljs.C_BLOCK_COMMENT_MODE,
    +        {
    +          className: 'number', begin: '#[0-9A-Fa-f]+'
    +        },
    +        {
    +          className: 'meta', begin: '!important'
    +        }
    +      ]
    +    }
    +  };
    +  var AT_IDENTIFIER = '@[a-z-]+'; // @font-face
    +  var AT_MODIFIERS = "and or not only";
    +  var AT_PROPERTY_RE = /@-?\w[\w]*(-\w+)*/; // @-webkit-keyframes
    +  var IDENT_RE = '[a-zA-Z-][a-zA-Z0-9_-]*';
    +  var RULE = {
    +    begin: /([*]\s?)?(?:[A-Z_.\-\\]+|--[a-zA-Z0-9_-]+)\s*(\/\*\*\/)?:/, returnBegin: true, end: ';', endsWithParent: true,
    +    contains: [
    +      ATTRIBUTE
    +    ]
    +  };
    +
    +  return {
    +    name: 'CSS',
    +    case_insensitive: true,
    +    illegal: /[=|'\$]/,
    +    contains: [
    +      hljs.C_BLOCK_COMMENT_MODE,
    +      {
    +        className: 'selector-id', begin: /#[A-Za-z0-9_-]+/
    +      },
    +      {
    +        className: 'selector-class', begin: '\\.' + IDENT_RE
    +      },
    +      {
    +        className: 'selector-attr',
    +        begin: /\[/, end: /\]/,
    +        illegal: '$',
    +        contains: [
    +          hljs.APOS_STRING_MODE,
    +          hljs.QUOTE_STRING_MODE,
    +        ]
    +      },
    +      {
    +        className: 'selector-pseudo',
    +        begin: /:(:)?[a-zA-Z0-9_+()"'.-]+/
    +      },
    +      // matching these here allows us to treat them more like regular CSS
    +      // rules so everything between the {} gets regular rule highlighting,
    +      // which is what we want for page and font-face
    +      {
    +        begin: '@(page|font-face)',
    +        lexemes: AT_IDENTIFIER,
    +        keywords: '@page @font-face'
    +      },
    +      {
    +        begin: '@', end: '[{;]', // at_rule eating first "{" is a good thing
    +                                 // because it doesn’t let it to be parsed as
    +                                 // a rule set but instead drops parser into
    +                                 // the default mode which is how it should be.
    +        illegal: /:/, // break on Less variables @var: ...
    +        returnBegin: true,
    +        contains: [
    +          {
    +            className: 'keyword',
    +            begin: AT_PROPERTY_RE
    +          },
    +          {
    +            begin: /\s/, endsWithParent: true, excludeEnd: true,
    +            relevance: 0,
    +            keywords: AT_MODIFIERS,
    +            contains: [
    +              {
    +                begin: /[a-z-]+:/,
    +                className:"attribute"
    +              },
    +              hljs.APOS_STRING_MODE,
    +              hljs.QUOTE_STRING_MODE,
    +              hljs.CSS_NUMBER_MODE
    +            ]
    +          }
    +        ]
    +      },
    +      {
    +        className: 'selector-tag', begin: IDENT_RE,
    +        relevance: 0
    +      },
    +      {
    +        begin: /\{/, end: /\}/,
    +        illegal: /\S/,
    +        contains: [
    +          hljs.C_BLOCK_COMMENT_MODE,
    +          { begin: /;/ }, // empty ; rule
    +          RULE,
    +        ]
    +      }
    +    ]
    +  };
    +}
    +
    +module.exports = css;
    diff --git a/node_modules/highlight.js/lib/languages/d.js b/node_modules/highlight.js/lib/languages/d.js
    new file mode 100644
    index 0000000..f302283
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/d.js
    @@ -0,0 +1,271 @@
    +/*
    +Language: D
    +Author: Aleksandar Ruzicic 
    +Description: D is a language with C-like syntax and static typing. It pragmatically combines efficiency, control, and modeling power, with safety and programmer productivity.
    +Version: 1.0a
    +Website: https://dlang.org
    +Date: 2012-04-08
    +*/
    +
    +/**
    + * Known issues:
    + *
    + * - invalid hex string literals will be recognized as a double quoted strings
    + *   but 'x' at the beginning of string will not be matched
    + *
    + * - delimited string literals are not checked for matching end delimiter
    + *   (not possible to do with js regexp)
    + *
    + * - content of token string is colored as a string (i.e. no keyword coloring inside a token string)
    + *   also, content of token string is not validated to contain only valid D tokens
    + *
    + * - special token sequence rule is not strictly following D grammar (anything following #line
    + *   up to the end of line is matched as special token sequence)
    + */
    +
    +/** @type LanguageFn */
    +function d(hljs) {
    +  /**
    +   * Language keywords
    +   *
    +   * @type {Object}
    +   */
    +  const D_KEYWORDS = {
    +    $pattern: hljs.UNDERSCORE_IDENT_RE,
    +    keyword:
    +      'abstract alias align asm assert auto body break byte case cast catch class ' +
    +      'const continue debug default delete deprecated do else enum export extern final ' +
    +      'finally for foreach foreach_reverse|10 goto if immutable import in inout int ' +
    +      'interface invariant is lazy macro mixin module new nothrow out override package ' +
    +      'pragma private protected public pure ref return scope shared static struct ' +
    +      'super switch synchronized template this throw try typedef typeid typeof union ' +
    +      'unittest version void volatile while with __FILE__ __LINE__ __gshared|10 ' +
    +      '__thread __traits __DATE__ __EOF__ __TIME__ __TIMESTAMP__ __VENDOR__ __VERSION__',
    +    built_in:
    +      'bool cdouble cent cfloat char creal dchar delegate double dstring float function ' +
    +      'idouble ifloat ireal long real short string ubyte ucent uint ulong ushort wchar ' +
    +      'wstring',
    +    literal:
    +      'false null true'
    +  };
    +
    +  /**
    +   * Number literal regexps
    +   *
    +   * @type {String}
    +   */
    +  const decimal_integer_re = '(0|[1-9][\\d_]*)';
    +  const decimal_integer_nosus_re = '(0|[1-9][\\d_]*|\\d[\\d_]*|[\\d_]+?\\d)';
    +  const binary_integer_re = '0[bB][01_]+';
    +  const hexadecimal_digits_re = '([\\da-fA-F][\\da-fA-F_]*|_[\\da-fA-F][\\da-fA-F_]*)';
    +  const hexadecimal_integer_re = '0[xX]' + hexadecimal_digits_re;
    +
    +  const decimal_exponent_re = '([eE][+-]?' + decimal_integer_nosus_re + ')';
    +  const decimal_float_re = '(' + decimal_integer_nosus_re + '(\\.\\d*|' + decimal_exponent_re + ')|' +
    +                '\\d+\\.' + decimal_integer_nosus_re + '|' +
    +                '\\.' + decimal_integer_re + decimal_exponent_re + '?' +
    +              ')';
    +  const hexadecimal_float_re = '(0[xX](' +
    +                  hexadecimal_digits_re + '\\.' + hexadecimal_digits_re + '|' +
    +                  '\\.?' + hexadecimal_digits_re +
    +                 ')[pP][+-]?' + decimal_integer_nosus_re + ')';
    +
    +  const integer_re = '(' +
    +      decimal_integer_re + '|' +
    +      binary_integer_re + '|' +
    +       hexadecimal_integer_re +
    +    ')';
    +
    +  const float_re = '(' +
    +      hexadecimal_float_re + '|' +
    +      decimal_float_re +
    +    ')';
    +
    +  /**
    +   * Escape sequence supported in D string and character literals
    +   *
    +   * @type {String}
    +   */
    +  const escape_sequence_re = '\\\\(' +
    +              '[\'"\\?\\\\abfnrtv]|' + // common escapes
    +              'u[\\dA-Fa-f]{4}|' + // four hex digit unicode codepoint
    +              '[0-7]{1,3}|' + // one to three octal digit ascii char code
    +              'x[\\dA-Fa-f]{2}|' + // two hex digit ascii char code
    +              'U[\\dA-Fa-f]{8}' + // eight hex digit unicode codepoint
    +              ')|' +
    +              '&[a-zA-Z\\d]{2,};'; // named character entity
    +
    +  /**
    +   * D integer number literals
    +   *
    +   * @type {Object}
    +   */
    +  const D_INTEGER_MODE = {
    +    className: 'number',
    +    begin: '\\b' + integer_re + '(L|u|U|Lu|LU|uL|UL)?',
    +    relevance: 0
    +  };
    +
    +  /**
    +   * [D_FLOAT_MODE description]
    +   * @type {Object}
    +   */
    +  const D_FLOAT_MODE = {
    +    className: 'number',
    +    begin: '\\b(' +
    +        float_re + '([fF]|L|i|[fF]i|Li)?|' +
    +        integer_re + '(i|[fF]i|Li)' +
    +      ')',
    +    relevance: 0
    +  };
    +
    +  /**
    +   * D character literal
    +   *
    +   * @type {Object}
    +   */
    +  const D_CHARACTER_MODE = {
    +    className: 'string',
    +    begin: '\'(' + escape_sequence_re + '|.)',
    +    end: '\'',
    +    illegal: '.'
    +  };
    +
    +  /**
    +   * D string escape sequence
    +   *
    +   * @type {Object}
    +   */
    +  const D_ESCAPE_SEQUENCE = {
    +    begin: escape_sequence_re,
    +    relevance: 0
    +  };
    +
    +  /**
    +   * D double quoted string literal
    +   *
    +   * @type {Object}
    +   */
    +  const D_STRING_MODE = {
    +    className: 'string',
    +    begin: '"',
    +    contains: [D_ESCAPE_SEQUENCE],
    +    end: '"[cwd]?'
    +  };
    +
    +  /**
    +   * D wysiwyg and delimited string literals
    +   *
    +   * @type {Object}
    +   */
    +  const D_WYSIWYG_DELIMITED_STRING_MODE = {
    +    className: 'string',
    +    begin: '[rq]"',
    +    end: '"[cwd]?',
    +    relevance: 5
    +  };
    +
    +  /**
    +   * D alternate wysiwyg string literal
    +   *
    +   * @type {Object}
    +   */
    +  const D_ALTERNATE_WYSIWYG_STRING_MODE = {
    +    className: 'string',
    +    begin: '`',
    +    end: '`[cwd]?'
    +  };
    +
    +  /**
    +   * D hexadecimal string literal
    +   *
    +   * @type {Object}
    +   */
    +  const D_HEX_STRING_MODE = {
    +    className: 'string',
    +    begin: 'x"[\\da-fA-F\\s\\n\\r]*"[cwd]?',
    +    relevance: 10
    +  };
    +
    +  /**
    +   * D delimited string literal
    +   *
    +   * @type {Object}
    +   */
    +  const D_TOKEN_STRING_MODE = {
    +    className: 'string',
    +    begin: 'q"\\{',
    +    end: '\\}"'
    +  };
    +
    +  /**
    +   * Hashbang support
    +   *
    +   * @type {Object}
    +   */
    +  const D_HASHBANG_MODE = {
    +    className: 'meta',
    +    begin: '^#!',
    +    end: '$',
    +    relevance: 5
    +  };
    +
    +  /**
    +   * D special token sequence
    +   *
    +   * @type {Object}
    +   */
    +  const D_SPECIAL_TOKEN_SEQUENCE_MODE = {
    +    className: 'meta',
    +    begin: '#(line)',
    +    end: '$',
    +    relevance: 5
    +  };
    +
    +  /**
    +   * D attributes
    +   *
    +   * @type {Object}
    +   */
    +  const D_ATTRIBUTE_MODE = {
    +    className: 'keyword',
    +    begin: '@[a-zA-Z_][a-zA-Z_\\d]*'
    +  };
    +
    +  /**
    +   * D nesting comment
    +   *
    +   * @type {Object}
    +   */
    +  const D_NESTING_COMMENT_MODE = hljs.COMMENT(
    +    '\\/\\+',
    +    '\\+\\/',
    +    {
    +      contains: ['self'],
    +      relevance: 10
    +    }
    +  );
    +
    +  return {
    +    name: 'D',
    +    keywords: D_KEYWORDS,
    +    contains: [
    +      hljs.C_LINE_COMMENT_MODE,
    +      hljs.C_BLOCK_COMMENT_MODE,
    +      D_NESTING_COMMENT_MODE,
    +      D_HEX_STRING_MODE,
    +      D_STRING_MODE,
    +      D_WYSIWYG_DELIMITED_STRING_MODE,
    +      D_ALTERNATE_WYSIWYG_STRING_MODE,
    +      D_TOKEN_STRING_MODE,
    +      D_FLOAT_MODE,
    +      D_INTEGER_MODE,
    +      D_CHARACTER_MODE,
    +      D_HASHBANG_MODE,
    +      D_SPECIAL_TOKEN_SEQUENCE_MODE,
    +      D_ATTRIBUTE_MODE
    +    ]
    +  };
    +}
    +
    +module.exports = d;
    diff --git a/node_modules/highlight.js/lib/languages/dart.js b/node_modules/highlight.js/lib/languages/dart.js
    new file mode 100644
    index 0000000..c969b43
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/dart.js
    @@ -0,0 +1,198 @@
    +/*
    +Language: Dart
    +Requires: markdown.js
    +Author: Maxim Dikun 
    +Description: Dart a modern, object-oriented language developed by Google. For more information see https://www.dartlang.org/
    +Website: https://dart.dev
    +Category: scripting
    +*/
    +
    +/** @type LanguageFn */
    +function dart(hljs) {
    +  const SUBST = {
    +    className: 'subst',
    +    variants: [{
    +      begin: '\\$[A-Za-z0-9_]+'
    +    }]
    +  };
    +
    +  const BRACED_SUBST = {
    +    className: 'subst',
    +    variants: [{
    +      begin: /\$\{/,
    +      end: /\}/
    +    }],
    +    keywords: 'true false null this is new super'
    +  };
    +
    +  const STRING = {
    +    className: 'string',
    +    variants: [
    +      {
    +        begin: 'r\'\'\'',
    +        end: '\'\'\''
    +      },
    +      {
    +        begin: 'r"""',
    +        end: '"""'
    +      },
    +      {
    +        begin: 'r\'',
    +        end: '\'',
    +        illegal: '\\n'
    +      },
    +      {
    +        begin: 'r"',
    +        end: '"',
    +        illegal: '\\n'
    +      },
    +      {
    +        begin: '\'\'\'',
    +        end: '\'\'\'',
    +        contains: [
    +          hljs.BACKSLASH_ESCAPE,
    +          SUBST,
    +          BRACED_SUBST
    +        ]
    +      },
    +      {
    +        begin: '"""',
    +        end: '"""',
    +        contains: [
    +          hljs.BACKSLASH_ESCAPE,
    +          SUBST,
    +          BRACED_SUBST
    +        ]
    +      },
    +      {
    +        begin: '\'',
    +        end: '\'',
    +        illegal: '\\n',
    +        contains: [
    +          hljs.BACKSLASH_ESCAPE,
    +          SUBST,
    +          BRACED_SUBST
    +        ]
    +      },
    +      {
    +        begin: '"',
    +        end: '"',
    +        illegal: '\\n',
    +        contains: [
    +          hljs.BACKSLASH_ESCAPE,
    +          SUBST,
    +          BRACED_SUBST
    +        ]
    +      }
    +    ]
    +  };
    +  BRACED_SUBST.contains = [
    +    hljs.C_NUMBER_MODE,
    +    STRING
    +  ];
    +
    +  const BUILT_IN_TYPES = [
    +    // dart:core
    +    'Comparable',
    +    'DateTime',
    +    'Duration',
    +    'Function',
    +    'Iterable',
    +    'Iterator',
    +    'List',
    +    'Map',
    +    'Match',
    +    'Object',
    +    'Pattern',
    +    'RegExp',
    +    'Set',
    +    'Stopwatch',
    +    'String',
    +    'StringBuffer',
    +    'StringSink',
    +    'Symbol',
    +    'Type',
    +    'Uri',
    +    'bool',
    +    'double',
    +    'int',
    +    'num',
    +    // dart:html
    +    'Element',
    +    'ElementList'
    +  ];
    +  const NULLABLE_BUILT_IN_TYPES = BUILT_IN_TYPES.map((e) => `${e}?`);
    +
    +  const KEYWORDS = {
    +    keyword: 'abstract as assert async await break case catch class const continue covariant default deferred do ' +
    +      'dynamic else enum export extends extension external factory false final finally for Function get hide if ' +
    +      'implements import in inferface is late library mixin new null on operator part required rethrow return set ' +
    +      'show static super switch sync this throw true try typedef var void while with yield',
    +    built_in:
    +      BUILT_IN_TYPES
    +        .concat(NULLABLE_BUILT_IN_TYPES)
    +        .concat([
    +          // dart:core
    +          'Never',
    +          'Null',
    +          'dynamic',
    +          'print',
    +          // dart:html
    +          'document',
    +          'querySelector',
    +          'querySelectorAll',
    +          'window'
    +        ]).join(' '),
    +    $pattern: /[A-Za-z][A-Za-z0-9_]*\??/
    +  };
    +
    +  return {
    +    name: 'Dart',
    +    keywords: KEYWORDS,
    +    contains: [
    +      STRING,
    +      hljs.COMMENT(
    +        '/\\*\\*',
    +        '\\*/', {
    +          subLanguage: 'markdown',
    +          relevance: 0
    +        }
    +      ),
    +      hljs.COMMENT(
    +        '///+\\s*',
    +        '$', {
    +          contains: [{
    +            subLanguage: 'markdown',
    +            begin: '.',
    +            end: '$',
    +            relevance: 0
    +          }]
    +        }
    +      ),
    +      hljs.C_LINE_COMMENT_MODE,
    +      hljs.C_BLOCK_COMMENT_MODE,
    +      {
    +        className: 'class',
    +        beginKeywords: 'class interface',
    +        end: /\{/,
    +        excludeEnd: true,
    +        contains: [
    +          {
    +            beginKeywords: 'extends implements'
    +          },
    +          hljs.UNDERSCORE_TITLE_MODE
    +        ]
    +      },
    +      hljs.C_NUMBER_MODE,
    +      {
    +        className: 'meta',
    +        begin: '@[A-Za-z]+'
    +      },
    +      {
    +        begin: '=>' // No markup, just a relevance booster
    +      }
    +    ]
    +  };
    +}
    +
    +module.exports = dart;
    diff --git a/node_modules/highlight.js/lib/languages/delphi.js b/node_modules/highlight.js/lib/languages/delphi.js
    new file mode 100644
    index 0000000..668b11b
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/delphi.js
    @@ -0,0 +1,126 @@
    +/*
    +Language: Delphi
    +Website: https://www.embarcadero.com/products/delphi
    +*/
    +
    +/** @type LanguageFn */
    +function delphi(hljs) {
    +  const KEYWORDS =
    +    'exports register file shl array record property for mod while set ally label uses raise not ' +
    +    'stored class safecall var interface or private static exit index inherited to else stdcall ' +
    +    'override shr asm far resourcestring finalization packed virtual out and protected library do ' +
    +    'xorwrite goto near function end div overload object unit begin string on inline repeat until ' +
    +    'destructor write message program with read initialization except default nil if case cdecl in ' +
    +    'downto threadvar of try pascal const external constructor type public then implementation ' +
    +    'finally published procedure absolute reintroduce operator as is abstract alias assembler ' +
    +    'bitpacked break continue cppdecl cvar enumerator experimental platform deprecated ' +
    +    'unimplemented dynamic export far16 forward generic helper implements interrupt iochecks ' +
    +    'local name nodefault noreturn nostackframe oldfpccall otherwise saveregisters softfloat ' +
    +    'specialize strict unaligned varargs ';
    +  const COMMENT_MODES = [
    +    hljs.C_LINE_COMMENT_MODE,
    +    hljs.COMMENT(/\{/, /\}/, {
    +      relevance: 0
    +    }),
    +    hljs.COMMENT(/\(\*/, /\*\)/, {
    +      relevance: 10
    +    })
    +  ];
    +  const DIRECTIVE = {
    +    className: 'meta',
    +    variants: [
    +      {
    +        begin: /\{\$/,
    +        end: /\}/
    +      },
    +      {
    +        begin: /\(\*\$/,
    +        end: /\*\)/
    +      }
    +    ]
    +  };
    +  const STRING = {
    +    className: 'string',
    +    begin: /'/,
    +    end: /'/,
    +    contains: [{
    +      begin: /''/
    +    }]
    +  };
    +  const NUMBER = {
    +    className: 'number',
    +    relevance: 0,
    +    // Source: https://www.freepascal.org/docs-html/ref/refse6.html
    +    variants: [
    +      {
    +        // Hexadecimal notation, e.g., $7F.
    +        begin: '\\$[0-9A-Fa-f]+'
    +      },
    +      {
    +        // Octal notation, e.g., &42.
    +        begin: '&[0-7]+'
    +      },
    +      {
    +        // Binary notation, e.g., %1010.
    +        begin: '%[01]+'
    +      }
    +    ]
    +  };
    +  const CHAR_STRING = {
    +    className: 'string',
    +    begin: /(#\d+)+/
    +  };
    +  const CLASS = {
    +    begin: hljs.IDENT_RE + '\\s*=\\s*class\\s*\\(',
    +    returnBegin: true,
    +    contains: [hljs.TITLE_MODE]
    +  };
    +  const FUNCTION = {
    +    className: 'function',
    +    beginKeywords: 'function constructor destructor procedure',
    +    end: /[:;]/,
    +    keywords: 'function constructor|10 destructor|10 procedure|10',
    +    contains: [
    +      hljs.TITLE_MODE,
    +      {
    +        className: 'params',
    +        begin: /\(/,
    +        end: /\)/,
    +        keywords: KEYWORDS,
    +        contains: [
    +          STRING,
    +          CHAR_STRING,
    +          DIRECTIVE
    +        ].concat(COMMENT_MODES)
    +      },
    +      DIRECTIVE
    +    ].concat(COMMENT_MODES)
    +  };
    +  return {
    +    name: 'Delphi',
    +    aliases: [
    +      'dpr',
    +      'dfm',
    +      'pas',
    +      'pascal',
    +      'freepascal',
    +      'lazarus',
    +      'lpr',
    +      'lfm'
    +    ],
    +    case_insensitive: true,
    +    keywords: KEYWORDS,
    +    illegal: /"|\$[G-Zg-z]|\/\*|<\/|\|/,
    +    contains: [
    +      STRING,
    +      CHAR_STRING,
    +      hljs.NUMBER_MODE,
    +      NUMBER,
    +      CLASS,
    +      FUNCTION,
    +      DIRECTIVE
    +    ].concat(COMMENT_MODES)
    +  };
    +}
    +
    +module.exports = delphi;
    diff --git a/node_modules/highlight.js/lib/languages/diff.js b/node_modules/highlight.js/lib/languages/diff.js
    new file mode 100644
    index 0000000..db2feb8
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/diff.js
    @@ -0,0 +1,85 @@
    +/*
    +Language: Diff
    +Description: Unified and context diff
    +Author: Vasily Polovnyov 
    +Website: https://www.gnu.org/software/diffutils/
    +Category: common
    +*/
    +
    +/** @type LanguageFn */
    +function diff(hljs) {
    +  return {
    +    name: 'Diff',
    +    aliases: ['patch'],
    +    contains: [
    +      {
    +        className: 'meta',
    +        relevance: 10,
    +        variants: [
    +          {
    +            begin: /^@@ +-\d+,\d+ +\+\d+,\d+ +@@/
    +          },
    +          {
    +            begin: /^\*\*\* +\d+,\d+ +\*\*\*\*$/
    +          },
    +          {
    +            begin: /^--- +\d+,\d+ +----$/
    +          }
    +        ]
    +      },
    +      {
    +        className: 'comment',
    +        variants: [
    +          {
    +            begin: /Index: /,
    +            end: /$/
    +          },
    +          {
    +            begin: /^index/,
    +            end: /$/
    +          },
    +          {
    +            begin: /={3,}/,
    +            end: /$/
    +          },
    +          {
    +            begin: /^-{3}/,
    +            end: /$/
    +          },
    +          {
    +            begin: /^\*{3} /,
    +            end: /$/
    +          },
    +          {
    +            begin: /^\+{3}/,
    +            end: /$/
    +          },
    +          {
    +            begin: /^\*{15}$/
    +          },
    +          {
    +            begin: /^diff --git/,
    +            end: /$/
    +          }
    +        ]
    +      },
    +      {
    +        className: 'addition',
    +        begin: /^\+/,
    +        end: /$/
    +      },
    +      {
    +        className: 'deletion',
    +        begin: /^-/,
    +        end: /$/
    +      },
    +      {
    +        className: 'addition',
    +        begin: /^!/,
    +        end: /$/
    +      }
    +    ]
    +  };
    +}
    +
    +module.exports = diff;
    diff --git a/node_modules/highlight.js/lib/languages/django.js b/node_modules/highlight.js/lib/languages/django.js
    new file mode 100644
    index 0000000..4826c0f
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/django.js
    @@ -0,0 +1,77 @@
    +/*
    +Language: Django
    +Description: Django is a high-level Python Web framework that encourages rapid development and clean, pragmatic design.
    +Requires: xml.js
    +Author: Ivan Sagalaev 
    +Contributors: Ilya Baryshev 
    +Website: https://www.djangoproject.com
    +Category: template
    +*/
    +
    +/** @type LanguageFn */
    +function django(hljs) {
    +  const FILTER = {
    +    begin: /\|[A-Za-z]+:?/,
    +    keywords: {
    +      name:
    +        'truncatewords removetags linebreaksbr yesno get_digit timesince random striptags ' +
    +        'filesizeformat escape linebreaks length_is ljust rjust cut urlize fix_ampersands ' +
    +        'title floatformat capfirst pprint divisibleby add make_list unordered_list urlencode ' +
    +        'timeuntil urlizetrunc wordcount stringformat linenumbers slice date dictsort ' +
    +        'dictsortreversed default_if_none pluralize lower join center default ' +
    +        'truncatewords_html upper length phone2numeric wordwrap time addslashes slugify first ' +
    +        'escapejs force_escape iriencode last safe safeseq truncatechars localize unlocalize ' +
    +        'localtime utc timezone'
    +    },
    +    contains: [
    +      hljs.QUOTE_STRING_MODE,
    +      hljs.APOS_STRING_MODE
    +    ]
    +  };
    +
    +  return {
    +    name: 'Django',
    +    aliases: ['jinja'],
    +    case_insensitive: true,
    +    subLanguage: 'xml',
    +    contains: [
    +      hljs.COMMENT(/\{%\s*comment\s*%\}/, /\{%\s*endcomment\s*%\}/),
    +      hljs.COMMENT(/\{#/, /#\}/),
    +      {
    +        className: 'template-tag',
    +        begin: /\{%/,
    +        end: /%\}/,
    +        contains: [{
    +          className: 'name',
    +          begin: /\w+/,
    +          keywords: {
    +            name:
    +                'comment endcomment load templatetag ifchanged endifchanged if endif firstof for ' +
    +                'endfor ifnotequal endifnotequal widthratio extends include spaceless ' +
    +                'endspaceless regroup ifequal endifequal ssi now with cycle url filter ' +
    +                'endfilter debug block endblock else autoescape endautoescape csrf_token empty elif ' +
    +                'endwith static trans blocktrans endblocktrans get_static_prefix get_media_prefix ' +
    +                'plural get_current_language language get_available_languages ' +
    +                'get_current_language_bidi get_language_info get_language_info_list localize ' +
    +                'endlocalize localtime endlocaltime timezone endtimezone get_current_timezone ' +
    +                'verbatim'
    +          },
    +          starts: {
    +            endsWithParent: true,
    +            keywords: 'in by as',
    +            contains: [FILTER],
    +            relevance: 0
    +          }
    +        }]
    +      },
    +      {
    +        className: 'template-variable',
    +        begin: /\{\{/,
    +        end: /\}\}/,
    +        contains: [FILTER]
    +      }
    +    ]
    +  };
    +}
    +
    +module.exports = django;
    diff --git a/node_modules/highlight.js/lib/languages/dns.js b/node_modules/highlight.js/lib/languages/dns.js
    new file mode 100644
    index 0000000..0c3f4b6
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/dns.js
    @@ -0,0 +1,46 @@
    +/*
    +Language: DNS Zone
    +Author: Tim Schumacher 
    +Category: config
    +Website: https://en.wikipedia.org/wiki/Zone_file
    +*/
    +
    +/** @type LanguageFn */
    +function dns(hljs) {
    +  return {
    +    name: 'DNS Zone',
    +    aliases: [
    +      'bind',
    +      'zone'
    +    ],
    +    keywords: {
    +      keyword:
    +        'IN A AAAA AFSDB APL CAA CDNSKEY CDS CERT CNAME DHCID DLV DNAME DNSKEY DS HIP IPSECKEY KEY KX ' +
    +        'LOC MX NAPTR NS NSEC NSEC3 NSEC3PARAM PTR RRSIG RP SIG SOA SRV SSHFP TA TKEY TLSA TSIG TXT'
    +    },
    +    contains: [
    +      hljs.COMMENT(';', '$', {
    +        relevance: 0
    +      }),
    +      {
    +        className: 'meta',
    +        begin: /^\$(TTL|GENERATE|INCLUDE|ORIGIN)\b/
    +      },
    +      // IPv6
    +      {
    +        className: 'number',
    +        begin: '((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:)))\\b'
    +      },
    +      // IPv4
    +      {
    +        className: 'number',
    +        begin: '((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\b'
    +      },
    +      hljs.inherit(hljs.NUMBER_MODE, {
    +        begin: /\b\d+[dhwm]?/
    +      })
    +    ]
    +  };
    +}
    +
    +module.exports = dns;
    diff --git a/node_modules/highlight.js/lib/languages/dockerfile.js b/node_modules/highlight.js/lib/languages/dockerfile.js
    new file mode 100644
    index 0000000..73405bf
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/dockerfile.js
    @@ -0,0 +1,34 @@
    +/*
    +Language: Dockerfile
    +Requires: bash.js
    +Author: Alexis Hénaut 
    +Description: language definition for Dockerfile files
    +Website: https://docs.docker.com/engine/reference/builder/
    +Category: config
    +*/
    +
    +/** @type LanguageFn */
    +function dockerfile(hljs) {
    +  return {
    +    name: 'Dockerfile',
    +    aliases: ['docker'],
    +    case_insensitive: true,
    +    keywords: 'from maintainer expose env arg user onbuild stopsignal',
    +    contains: [
    +      hljs.HASH_COMMENT_MODE,
    +      hljs.APOS_STRING_MODE,
    +      hljs.QUOTE_STRING_MODE,
    +      hljs.NUMBER_MODE,
    +      {
    +        beginKeywords: 'run cmd entrypoint volume add copy workdir label healthcheck shell',
    +        starts: {
    +          end: /[^\\]$/,
    +          subLanguage: 'bash'
    +        }
    +      }
    +    ],
    +    illegal: '
    +Contributors: Anton Kochkov 
    +Website: https://en.wikipedia.org/wiki/Batch_file
    +*/
    +
    +/** @type LanguageFn */
    +function dos(hljs) {
    +  const COMMENT = hljs.COMMENT(
    +    /^\s*@?rem\b/, /$/,
    +    {
    +      relevance: 10
    +    }
    +  );
    +  const LABEL = {
    +    className: 'symbol',
    +    begin: '^\\s*[A-Za-z._?][A-Za-z0-9_$#@~.?]*(:|\\s+label)',
    +    relevance: 0
    +  };
    +  return {
    +    name: 'Batch file (DOS)',
    +    aliases: [
    +      'bat',
    +      'cmd'
    +    ],
    +    case_insensitive: true,
    +    illegal: /\/\*/,
    +    keywords: {
    +      keyword:
    +        'if else goto for in do call exit not exist errorlevel defined ' +
    +        'equ neq lss leq gtr geq',
    +      built_in:
    +        'prn nul lpt3 lpt2 lpt1 con com4 com3 com2 com1 aux ' +
    +        'shift cd dir echo setlocal endlocal set pause copy ' +
    +        'append assoc at attrib break cacls cd chcp chdir chkdsk chkntfs cls cmd color ' +
    +        'comp compact convert date dir diskcomp diskcopy doskey erase fs ' +
    +        'find findstr format ftype graftabl help keyb label md mkdir mode more move path ' +
    +        'pause print popd pushd promt rd recover rem rename replace restore rmdir shift ' +
    +        'sort start subst time title tree type ver verify vol ' +
    +        // winutils
    +        'ping net ipconfig taskkill xcopy ren del'
    +    },
    +    contains: [
    +      {
    +        className: 'variable',
    +        begin: /%%[^ ]|%[^ ]+?%|![^ ]+?!/
    +      },
    +      {
    +        className: 'function',
    +        begin: LABEL.begin,
    +        end: 'goto:eof',
    +        contains: [
    +          hljs.inherit(hljs.TITLE_MODE, {
    +            begin: '([_a-zA-Z]\\w*\\.)*([_a-zA-Z]\\w*:)?[_a-zA-Z]\\w*'
    +          }),
    +          COMMENT
    +        ]
    +      },
    +      {
    +        className: 'number',
    +        begin: '\\b\\d+',
    +        relevance: 0
    +      },
    +      COMMENT
    +    ]
    +  };
    +}
    +
    +module.exports = dos;
    diff --git a/node_modules/highlight.js/lib/languages/dsconfig.js b/node_modules/highlight.js/lib/languages/dsconfig.js
    new file mode 100644
    index 0000000..b51d2e7
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/dsconfig.js
    @@ -0,0 +1,66 @@
    +/*
    + Language: dsconfig
    + Description: dsconfig batch configuration language for LDAP directory servers
    + Contributors: Jacob Childress 
    + Category: enterprise, config
    + */
    +
    + /** @type LanguageFn */
    +function dsconfig(hljs) {
    +  const QUOTED_PROPERTY = {
    +    className: 'string',
    +    begin: /"/,
    +    end: /"/
    +  };
    +  const APOS_PROPERTY = {
    +    className: 'string',
    +    begin: /'/,
    +    end: /'/
    +  };
    +  const UNQUOTED_PROPERTY = {
    +    className: 'string',
    +    begin: /[\w\-?]+:\w+/,
    +    end: /\W/,
    +    relevance: 0
    +  };
    +  const VALUELESS_PROPERTY = {
    +    className: 'string',
    +    begin: /\w+(\-\w+)*/,
    +    end: /(?=\W)/,
    +    relevance: 0
    +  };
    +
    +  return {
    +    keywords: 'dsconfig',
    +    contains: [
    +      {
    +        className: 'keyword',
    +        begin: '^dsconfig',
    +        end: /\s/,
    +        excludeEnd: true,
    +        relevance: 10
    +      },
    +      {
    +        className: 'built_in',
    +        begin: /(list|create|get|set|delete)-(\w+)/,
    +        end: /\s/,
    +        excludeEnd: true,
    +        illegal: '!@#$%^&*()',
    +        relevance: 10
    +      },
    +      {
    +        className: 'built_in',
    +        begin: /--(\w+)/,
    +        end: /\s/,
    +        excludeEnd: true
    +      },
    +      QUOTED_PROPERTY,
    +      APOS_PROPERTY,
    +      UNQUOTED_PROPERTY,
    +      VALUELESS_PROPERTY,
    +      hljs.HASH_COMMENT_MODE
    +    ]
    +  };
    +}
    +
    +module.exports = dsconfig;
    diff --git a/node_modules/highlight.js/lib/languages/dts.js b/node_modules/highlight.js/lib/languages/dts.js
    new file mode 100644
    index 0000000..fc1a46e
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/dts.js
    @@ -0,0 +1,153 @@
    +/*
    +Language: Device Tree
    +Description: *.dts files used in the Linux kernel
    +Author: Martin Braun , Moritz Fischer 
    +Website: https://elinux.org/Device_Tree_Reference
    +Category: config
    +*/
    +
    +/** @type LanguageFn */
    +function dts(hljs) {
    +  const STRINGS = {
    +    className: 'string',
    +    variants: [
    +      hljs.inherit(hljs.QUOTE_STRING_MODE, {
    +        begin: '((u8?|U)|L)?"'
    +      }),
    +      {
    +        begin: '(u8?|U)?R"',
    +        end: '"',
    +        contains: [hljs.BACKSLASH_ESCAPE]
    +      },
    +      {
    +        begin: '\'\\\\?.',
    +        end: '\'',
    +        illegal: '.'
    +      }
    +    ]
    +  };
    +
    +  const NUMBERS = {
    +    className: 'number',
    +    variants: [
    +      {
    +        begin: '\\b(\\d+(\\.\\d*)?|\\.\\d+)(u|U|l|L|ul|UL|f|F)'
    +      },
    +      {
    +        begin: hljs.C_NUMBER_RE
    +      }
    +    ],
    +    relevance: 0
    +  };
    +
    +  const PREPROCESSOR = {
    +    className: 'meta',
    +    begin: '#',
    +    end: '$',
    +    keywords: {
    +      'meta-keyword': 'if else elif endif define undef ifdef ifndef'
    +    },
    +    contains: [
    +      {
    +        begin: /\\\n/,
    +        relevance: 0
    +      },
    +      {
    +        beginKeywords: 'include',
    +        end: '$',
    +        keywords: {
    +          'meta-keyword': 'include'
    +        },
    +        contains: [
    +          hljs.inherit(STRINGS, {
    +            className: 'meta-string'
    +          }),
    +          {
    +            className: 'meta-string',
    +            begin: '<',
    +            end: '>',
    +            illegal: '\\n'
    +          }
    +        ]
    +      },
    +      STRINGS,
    +      hljs.C_LINE_COMMENT_MODE,
    +      hljs.C_BLOCK_COMMENT_MODE
    +    ]
    +  };
    +
    +  const DTS_REFERENCE = {
    +    className: 'variable',
    +    begin: /&[a-z\d_]*\b/
    +  };
    +
    +  const DTS_KEYWORD = {
    +    className: 'meta-keyword',
    +    begin: '/[a-z][a-z\\d-]*/'
    +  };
    +
    +  const DTS_LABEL = {
    +    className: 'symbol',
    +    begin: '^\\s*[a-zA-Z_][a-zA-Z\\d_]*:'
    +  };
    +
    +  const DTS_CELL_PROPERTY = {
    +    className: 'params',
    +    begin: '<',
    +    end: '>',
    +    contains: [
    +      NUMBERS,
    +      DTS_REFERENCE
    +    ]
    +  };
    +
    +  const DTS_NODE = {
    +    className: 'class',
    +    begin: /[a-zA-Z_][a-zA-Z\d_@]*\s\{/,
    +    end: /[{;=]/,
    +    returnBegin: true,
    +    excludeEnd: true
    +  };
    +
    +  const DTS_ROOT_NODE = {
    +    className: 'class',
    +    begin: '/\\s*\\{',
    +    end: /\};/,
    +    relevance: 10,
    +    contains: [
    +      DTS_REFERENCE,
    +      DTS_KEYWORD,
    +      DTS_LABEL,
    +      DTS_NODE,
    +      DTS_CELL_PROPERTY,
    +      hljs.C_LINE_COMMENT_MODE,
    +      hljs.C_BLOCK_COMMENT_MODE,
    +      NUMBERS,
    +      STRINGS
    +    ]
    +  };
    +
    +  return {
    +    name: 'Device Tree',
    +    keywords: "",
    +    contains: [
    +      DTS_ROOT_NODE,
    +      DTS_REFERENCE,
    +      DTS_KEYWORD,
    +      DTS_LABEL,
    +      DTS_NODE,
    +      DTS_CELL_PROPERTY,
    +      hljs.C_LINE_COMMENT_MODE,
    +      hljs.C_BLOCK_COMMENT_MODE,
    +      NUMBERS,
    +      STRINGS,
    +      PREPROCESSOR,
    +      {
    +        begin: hljs.IDENT_RE + '::',
    +        keywords: ""
    +      }
    +    ]
    +  };
    +}
    +
    +module.exports = dts;
    diff --git a/node_modules/highlight.js/lib/languages/dust.js b/node_modules/highlight.js/lib/languages/dust.js
    new file mode 100644
    index 0000000..aa9d6da
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/dust.js
    @@ -0,0 +1,45 @@
    +/*
    +Language: Dust
    +Requires: xml.js
    +Author: Michael Allen 
    +Description: Matcher for dust.js templates.
    +Website: https://www.dustjs.com
    +Category: template
    +*/
    +
    +/** @type LanguageFn */
    +function dust(hljs) {
    +  const EXPRESSION_KEYWORDS = 'if eq ne lt lte gt gte select default math sep';
    +  return {
    +    name: 'Dust',
    +    aliases: ['dst'],
    +    case_insensitive: true,
    +    subLanguage: 'xml',
    +    contains: [
    +      {
    +        className: 'template-tag',
    +        begin: /\{[#\/]/,
    +        end: /\}/,
    +        illegal: /;/,
    +        contains: [{
    +          className: 'name',
    +          begin: /[a-zA-Z\.-]+/,
    +          starts: {
    +            endsWithParent: true,
    +            relevance: 0,
    +            contains: [hljs.QUOTE_STRING_MODE]
    +          }
    +        }]
    +      },
    +      {
    +        className: 'template-variable',
    +        begin: /\{/,
    +        end: /\}/,
    +        illegal: /;/,
    +        keywords: EXPRESSION_KEYWORDS
    +      }
    +    ]
    +  };
    +}
    +
    +module.exports = dust;
    diff --git a/node_modules/highlight.js/lib/languages/ebnf.js b/node_modules/highlight.js/lib/languages/ebnf.js
    new file mode 100644
    index 0000000..192ded7
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/ebnf.js
    @@ -0,0 +1,53 @@
    +/*
    +Language: Extended Backus-Naur Form
    +Author: Alex McKibben 
    +Website: https://en.wikipedia.org/wiki/Extended_Backus–Naur_form
    +*/
    +
    +/** @type LanguageFn */
    +function ebnf(hljs) {
    +  const commentMode = hljs.COMMENT(/\(\*/, /\*\)/);
    +
    +  const nonTerminalMode = {
    +    className: "attribute",
    +    begin: /^[ ]*[a-zA-Z]+([\s_-]+[a-zA-Z]+)*/
    +  };
    +
    +  const specialSequenceMode = {
    +    className: "meta",
    +    begin: /\?.*\?/
    +  };
    +
    +  const ruleBodyMode = {
    +    begin: /=/,
    +    end: /[.;]/,
    +    contains: [
    +      commentMode,
    +      specialSequenceMode,
    +      {
    +        // terminals
    +        className: 'string',
    +        variants: [
    +          hljs.APOS_STRING_MODE,
    +          hljs.QUOTE_STRING_MODE,
    +          {
    +            begin: '`',
    +            end: '`'
    +          }
    +        ]
    +      }
    +    ]
    +  };
    +
    +  return {
    +    name: 'Extended Backus-Naur Form',
    +    illegal: /\S/,
    +    contains: [
    +      commentMode,
    +      nonTerminalMode,
    +      ruleBodyMode
    +    ]
    +  };
    +}
    +
    +module.exports = ebnf;
    diff --git a/node_modules/highlight.js/lib/languages/elixir.js b/node_modules/highlight.js/lib/languages/elixir.js
    new file mode 100644
    index 0000000..c5fa6a9
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/elixir.js
    @@ -0,0 +1,259 @@
    +/*
    +Language: Elixir
    +Author: Josh Adams 
    +Description: language definition for Elixir source code files (.ex and .exs).  Based on ruby language support.
    +Category: functional
    +Website: https://elixir-lang.org
    +*/
    +
    +/** @type LanguageFn */
    +function elixir(hljs) {
    +  const ELIXIR_IDENT_RE = '[a-zA-Z_][a-zA-Z0-9_.]*(!|\\?)?';
    +  const ELIXIR_METHOD_RE = '[a-zA-Z_]\\w*[!?=]?|[-+~]@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?';
    +  const ELIXIR_KEYWORDS = {
    +    $pattern: ELIXIR_IDENT_RE,
    +    keyword: 'and false then defined module in return redo retry end for true self when ' +
    +    'next until do begin unless nil break not case cond alias while ensure or ' +
    +    'include use alias fn quote require import with|0'
    +  };
    +  const SUBST = {
    +    className: 'subst',
    +    begin: /#\{/,
    +    end: /\}/,
    +    keywords: ELIXIR_KEYWORDS
    +  };
    +  const NUMBER = {
    +    className: 'number',
    +    begin: '(\\b0o[0-7_]+)|(\\b0b[01_]+)|(\\b0x[0-9a-fA-F_]+)|(-?\\b[1-9][0-9_]*(\\.[0-9_]+([eE][-+]?[0-9]+)?)?)',
    +    relevance: 0
    +  };
    +  const SIGIL_DELIMITERS = '[/|([{<"\']';
    +  const LOWERCASE_SIGIL = {
    +    className: 'string',
    +    begin: '~[a-z]' + '(?=' + SIGIL_DELIMITERS + ')',
    +    contains: [
    +      {
    +        endsParent: true,
    +        contains: [
    +          {
    +            contains: [
    +              hljs.BACKSLASH_ESCAPE,
    +              SUBST
    +            ],
    +            variants: [
    +              {
    +                begin: /"/,
    +                end: /"/
    +              },
    +              {
    +                begin: /'/,
    +                end: /'/
    +              },
    +              {
    +                begin: /\//,
    +                end: /\//
    +              },
    +              {
    +                begin: /\|/,
    +                end: /\|/
    +              },
    +              {
    +                begin: /\(/,
    +                end: /\)/
    +              },
    +              {
    +                begin: /\[/,
    +                end: /\]/
    +              },
    +              {
    +                begin: /\{/,
    +                end: /\}/
    +              },
    +              {
    +                begin: //
    +              }
    +            ]
    +          }
    +        ]
    +      }
    +    ]
    +  };
    +
    +  const UPCASE_SIGIL = {
    +    className: 'string',
    +    begin: '~[A-Z]' + '(?=' + SIGIL_DELIMITERS + ')',
    +    contains: [
    +      {
    +        begin: /"/,
    +        end: /"/
    +      },
    +      {
    +        begin: /'/,
    +        end: /'/
    +      },
    +      {
    +        begin: /\//,
    +        end: /\//
    +      },
    +      {
    +        begin: /\|/,
    +        end: /\|/
    +      },
    +      {
    +        begin: /\(/,
    +        end: /\)/
    +      },
    +      {
    +        begin: /\[/,
    +        end: /\]/
    +      },
    +      {
    +        begin: /\{/,
    +        end: /\}/
    +      },
    +      {
    +        begin: //
    +      }
    +    ]
    +  };
    +
    +  const STRING = {
    +    className: 'string',
    +    contains: [
    +      hljs.BACKSLASH_ESCAPE,
    +      SUBST
    +    ],
    +    variants: [
    +      {
    +        begin: /"""/,
    +        end: /"""/
    +      },
    +      {
    +        begin: /'''/,
    +        end: /'''/
    +      },
    +      {
    +        begin: /~S"""/,
    +        end: /"""/,
    +        contains: []
    +      },
    +      {
    +        begin: /~S"/,
    +        end: /"/,
    +        contains: []
    +      },
    +      {
    +        begin: /~S'''/,
    +        end: /'''/,
    +        contains: []
    +      },
    +      {
    +        begin: /~S'/,
    +        end: /'/,
    +        contains: []
    +      },
    +      {
    +        begin: /'/,
    +        end: /'/
    +      },
    +      {
    +        begin: /"/,
    +        end: /"/
    +      }
    +    ]
    +  };
    +  const FUNCTION = {
    +    className: 'function',
    +    beginKeywords: 'def defp defmacro',
    +    end: /\B\b/, // the mode is ended by the title
    +    contains: [
    +      hljs.inherit(hljs.TITLE_MODE, {
    +        begin: ELIXIR_IDENT_RE,
    +        endsParent: true
    +      })
    +    ]
    +  };
    +  const CLASS = hljs.inherit(FUNCTION, {
    +    className: 'class',
    +    beginKeywords: 'defimpl defmodule defprotocol defrecord',
    +    end: /\bdo\b|$|;/
    +  });
    +  const ELIXIR_DEFAULT_CONTAINS = [
    +    STRING,
    +    UPCASE_SIGIL,
    +    LOWERCASE_SIGIL,
    +    hljs.HASH_COMMENT_MODE,
    +    CLASS,
    +    FUNCTION,
    +    {
    +      begin: '::'
    +    },
    +    {
    +      className: 'symbol',
    +      begin: ':(?![\\s:])',
    +      contains: [
    +        STRING,
    +        {
    +          begin: ELIXIR_METHOD_RE
    +        }
    +      ],
    +      relevance: 0
    +    },
    +    {
    +      className: 'symbol',
    +      begin: ELIXIR_IDENT_RE + ':(?!:)',
    +      relevance: 0
    +    },
    +    NUMBER,
    +    {
    +      className: 'variable',
    +      begin: '(\\$\\W)|((\\$|@@?)(\\w+))'
    +    },
    +    {
    +      begin: '->'
    +    },
    +    { // regexp container
    +      begin: '(' + hljs.RE_STARTERS_RE + ')\\s*',
    +      contains: [
    +        hljs.HASH_COMMENT_MODE,
    +        {
    +          // to prevent false regex triggers for the division function:
    +          // /:
    +          begin: /\/: (?=\d+\s*[,\]])/,
    +          relevance: 0,
    +          contains: [NUMBER]
    +        },
    +        {
    +          className: 'regexp',
    +          illegal: '\\n',
    +          contains: [
    +            hljs.BACKSLASH_ESCAPE,
    +            SUBST
    +          ],
    +          variants: [
    +            {
    +              begin: '/',
    +              end: '/[a-z]*'
    +            },
    +            {
    +              begin: '%r\\[',
    +              end: '\\][a-z]*'
    +            }
    +          ]
    +        }
    +      ],
    +      relevance: 0
    +    }
    +  ];
    +  SUBST.contains = ELIXIR_DEFAULT_CONTAINS;
    +
    +  return {
    +    name: 'Elixir',
    +    keywords: ELIXIR_KEYWORDS,
    +    contains: ELIXIR_DEFAULT_CONTAINS
    +  };
    +}
    +
    +module.exports = elixir;
    diff --git a/node_modules/highlight.js/lib/languages/elm.js b/node_modules/highlight.js/lib/languages/elm.js
    new file mode 100644
    index 0000000..d986f7c
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/elm.js
    @@ -0,0 +1,129 @@
    +/*
    +Language: Elm
    +Author: Janis Voigtlaender 
    +Website: https://elm-lang.org
    +Category: functional
    +*/
    +
    +/** @type LanguageFn */
    +function elm(hljs) {
    +  const COMMENT = {
    +    variants: [
    +      hljs.COMMENT('--', '$'),
    +      hljs.COMMENT(
    +        /\{-/,
    +        /-\}/,
    +        {
    +          contains: ['self']
    +        }
    +      )
    +    ]
    +  };
    +
    +  const CONSTRUCTOR = {
    +    className: 'type',
    +    begin: '\\b[A-Z][\\w\']*', // TODO: other constructors (built-in, infix).
    +    relevance: 0
    +  };
    +
    +  const LIST = {
    +    begin: '\\(',
    +    end: '\\)',
    +    illegal: '"',
    +    contains: [
    +      {
    +        className: 'type',
    +        begin: '\\b[A-Z][\\w]*(\\((\\.\\.|,|\\w+)\\))?'
    +      },
    +      COMMENT
    +    ]
    +  };
    +
    +  const RECORD = {
    +    begin: /\{/,
    +    end: /\}/,
    +    contains: LIST.contains
    +  };
    +
    +  const CHARACTER = {
    +    className: 'string',
    +    begin: '\'\\\\?.',
    +    end: '\'',
    +    illegal: '.'
    +  };
    +
    +  return {
    +    name: 'Elm',
    +    keywords:
    +      'let in if then else case of where module import exposing ' +
    +      'type alias as infix infixl infixr port effect command subscription',
    +    contains: [
    +
    +      // Top-level constructions.
    +
    +      {
    +        beginKeywords: 'port effect module',
    +        end: 'exposing',
    +        keywords: 'port effect module where command subscription exposing',
    +        contains: [
    +          LIST,
    +          COMMENT
    +        ],
    +        illegal: '\\W\\.|;'
    +      },
    +      {
    +        begin: 'import',
    +        end: '$',
    +        keywords: 'import as exposing',
    +        contains: [
    +          LIST,
    +          COMMENT
    +        ],
    +        illegal: '\\W\\.|;'
    +      },
    +      {
    +        begin: 'type',
    +        end: '$',
    +        keywords: 'type alias',
    +        contains: [
    +          CONSTRUCTOR,
    +          LIST,
    +          RECORD,
    +          COMMENT
    +        ]
    +      },
    +      {
    +        beginKeywords: 'infix infixl infixr',
    +        end: '$',
    +        contains: [
    +          hljs.C_NUMBER_MODE,
    +          COMMENT
    +        ]
    +      },
    +      {
    +        begin: 'port',
    +        end: '$',
    +        keywords: 'port',
    +        contains: [COMMENT]
    +      },
    +
    +      // Literals and names.
    +
    +      CHARACTER,
    +      hljs.QUOTE_STRING_MODE,
    +      hljs.C_NUMBER_MODE,
    +      CONSTRUCTOR,
    +      hljs.inherit(hljs.TITLE_MODE, {
    +        begin: '^[_a-z][\\w\']*'
    +      }),
    +      COMMENT,
    +
    +      {
    +        begin: '->|<-'
    +      } // No markup, relevance booster
    +    ],
    +    illegal: /;/
    +  };
    +}
    +
    +module.exports = elm;
    diff --git a/node_modules/highlight.js/lib/languages/erb.js b/node_modules/highlight.js/lib/languages/erb.js
    new file mode 100644
    index 0000000..1664923
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/erb.js
    @@ -0,0 +1,29 @@
    +/*
    +Language: ERB (Embedded Ruby)
    +Requires: xml.js, ruby.js
    +Author: Lucas Mazza 
    +Contributors: Kassio Borges 
    +Description: "Bridge" language defining fragments of Ruby in HTML within <% .. %>
    +Website: https://ruby-doc.org/stdlib-2.6.5/libdoc/erb/rdoc/ERB.html
    +Category: template
    +*/
    +
    +/** @type LanguageFn */
    +function erb(hljs) {
    +  return {
    +    name: 'ERB',
    +    subLanguage: 'xml',
    +    contains: [
    +      hljs.COMMENT('<%#', '%>'),
    +      {
    +        begin: '<%[%=-]?',
    +        end: '[%-]?%>',
    +        subLanguage: 'ruby',
    +        excludeBegin: true,
    +        excludeEnd: true
    +      }
    +    ]
    +  };
    +}
    +
    +module.exports = erb;
    diff --git a/node_modules/highlight.js/lib/languages/erlang-repl.js b/node_modules/highlight.js/lib/languages/erlang-repl.js
    new file mode 100644
    index 0000000..17e153b
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/erlang-repl.js
    @@ -0,0 +1,86 @@
    +/**
    + * @param {string} value
    + * @returns {RegExp}
    + * */
    +
    +/**
    + * @param {RegExp | string } re
    + * @returns {string}
    + */
    +function source(re) {
    +  if (!re) return null;
    +  if (typeof re === "string") return re;
    +
    +  return re.source;
    +}
    +
    +/**
    + * @param {...(RegExp | string) } args
    + * @returns {string}
    + */
    +function concat(...args) {
    +  const joined = args.map((x) => source(x)).join("");
    +  return joined;
    +}
    +
    +/*
    +Language: Erlang REPL
    +Author: Sergey Ignatov 
    +Website: https://www.erlang.org
    +Category: functional
    +*/
    +
    +/** @type LanguageFn */
    +function erlangRepl(hljs) {
    +  return {
    +    name: 'Erlang REPL',
    +    keywords: {
    +      built_in:
    +        'spawn spawn_link self',
    +      keyword:
    +        'after and andalso|10 band begin bnot bor bsl bsr bxor case catch cond div end fun if ' +
    +        'let not of or orelse|10 query receive rem try when xor'
    +    },
    +    contains: [
    +      {
    +        className: 'meta',
    +        begin: '^[0-9]+> ',
    +        relevance: 10
    +      },
    +      hljs.COMMENT('%', '$'),
    +      {
    +        className: 'number',
    +        begin: '\\b(\\d+(_\\d+)*#[a-fA-F0-9]+(_[a-fA-F0-9]+)*|\\d+(_\\d+)*(\\.\\d+(_\\d+)*)?([eE][-+]?\\d+)?)',
    +        relevance: 0
    +      },
    +      hljs.APOS_STRING_MODE,
    +      hljs.QUOTE_STRING_MODE,
    +      {
    +        begin: concat(
    +          /\?(::)?/,
    +          /([A-Z]\w*)/, // at least one identifier
    +          /((::)[A-Z]\w*)*/ // perhaps more
    +        )
    +      },
    +      {
    +        begin: '->'
    +      },
    +      {
    +        begin: 'ok'
    +      },
    +      {
    +        begin: '!'
    +      },
    +      {
    +        begin: '(\\b[a-z\'][a-zA-Z0-9_\']*:[a-z\'][a-zA-Z0-9_\']*)|(\\b[a-z\'][a-zA-Z0-9_\']*)',
    +        relevance: 0
    +      },
    +      {
    +        begin: '[A-Z][a-zA-Z0-9_\']*',
    +        relevance: 0
    +      }
    +    ]
    +  };
    +}
    +
    +module.exports = erlangRepl;
    diff --git a/node_modules/highlight.js/lib/languages/erlang.js b/node_modules/highlight.js/lib/languages/erlang.js
    new file mode 100644
    index 0000000..503d631
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/erlang.js
    @@ -0,0 +1,177 @@
    +/*
    +Language: Erlang
    +Description: Erlang is a general-purpose functional language, with strict evaluation, single assignment, and dynamic typing.
    +Author: Nikolay Zakharov , Dmitry Kovega 
    +Website: https://www.erlang.org
    +Category: functional
    +*/
    +
    +/** @type LanguageFn */
    +function erlang(hljs) {
    +  const BASIC_ATOM_RE = '[a-z\'][a-zA-Z0-9_\']*';
    +  const FUNCTION_NAME_RE = '(' + BASIC_ATOM_RE + ':' + BASIC_ATOM_RE + '|' + BASIC_ATOM_RE + ')';
    +  const ERLANG_RESERVED = {
    +    keyword:
    +      'after and andalso|10 band begin bnot bor bsl bzr bxor case catch cond div end fun if ' +
    +      'let not of orelse|10 query receive rem try when xor',
    +    literal:
    +      'false true'
    +  };
    +
    +  const COMMENT = hljs.COMMENT('%', '$');
    +  const NUMBER = {
    +    className: 'number',
    +    begin: '\\b(\\d+(_\\d+)*#[a-fA-F0-9]+(_[a-fA-F0-9]+)*|\\d+(_\\d+)*(\\.\\d+(_\\d+)*)?([eE][-+]?\\d+)?)',
    +    relevance: 0
    +  };
    +  const NAMED_FUN = {
    +    begin: 'fun\\s+' + BASIC_ATOM_RE + '/\\d+'
    +  };
    +  const FUNCTION_CALL = {
    +    begin: FUNCTION_NAME_RE + '\\(',
    +    end: '\\)',
    +    returnBegin: true,
    +    relevance: 0,
    +    contains: [
    +      {
    +        begin: FUNCTION_NAME_RE,
    +        relevance: 0
    +      },
    +      {
    +        begin: '\\(',
    +        end: '\\)',
    +        endsWithParent: true,
    +        returnEnd: true,
    +        relevance: 0
    +        // "contains" defined later
    +      }
    +    ]
    +  };
    +  const TUPLE = {
    +    begin: /\{/,
    +    end: /\}/,
    +    relevance: 0
    +    // "contains" defined later
    +  };
    +  const VAR1 = {
    +    begin: '\\b_([A-Z][A-Za-z0-9_]*)?',
    +    relevance: 0
    +  };
    +  const VAR2 = {
    +    begin: '[A-Z][a-zA-Z0-9_]*',
    +    relevance: 0
    +  };
    +  const RECORD_ACCESS = {
    +    begin: '#' + hljs.UNDERSCORE_IDENT_RE,
    +    relevance: 0,
    +    returnBegin: true,
    +    contains: [
    +      {
    +        begin: '#' + hljs.UNDERSCORE_IDENT_RE,
    +        relevance: 0
    +      },
    +      {
    +        begin: /\{/,
    +        end: /\}/,
    +        relevance: 0
    +        // "contains" defined later
    +      }
    +    ]
    +  };
    +
    +  const BLOCK_STATEMENTS = {
    +    beginKeywords: 'fun receive if try case',
    +    end: 'end',
    +    keywords: ERLANG_RESERVED
    +  };
    +  BLOCK_STATEMENTS.contains = [
    +    COMMENT,
    +    NAMED_FUN,
    +    hljs.inherit(hljs.APOS_STRING_MODE, {
    +      className: ''
    +    }),
    +    BLOCK_STATEMENTS,
    +    FUNCTION_CALL,
    +    hljs.QUOTE_STRING_MODE,
    +    NUMBER,
    +    TUPLE,
    +    VAR1,
    +    VAR2,
    +    RECORD_ACCESS
    +  ];
    +
    +  const BASIC_MODES = [
    +    COMMENT,
    +    NAMED_FUN,
    +    BLOCK_STATEMENTS,
    +    FUNCTION_CALL,
    +    hljs.QUOTE_STRING_MODE,
    +    NUMBER,
    +    TUPLE,
    +    VAR1,
    +    VAR2,
    +    RECORD_ACCESS
    +  ];
    +  FUNCTION_CALL.contains[1].contains = BASIC_MODES;
    +  TUPLE.contains = BASIC_MODES;
    +  RECORD_ACCESS.contains[1].contains = BASIC_MODES;
    +
    +  const PARAMS = {
    +    className: 'params',
    +    begin: '\\(',
    +    end: '\\)',
    +    contains: BASIC_MODES
    +  };
    +  return {
    +    name: 'Erlang',
    +    aliases: ['erl'],
    +    keywords: ERLANG_RESERVED,
    +    illegal: '(',
    +        returnBegin: true,
    +        illegal: '\\(|#|//|/\\*|\\\\|:|;',
    +        contains: [
    +          PARAMS,
    +          hljs.inherit(hljs.TITLE_MODE, {
    +            begin: BASIC_ATOM_RE
    +          })
    +        ],
    +        starts: {
    +          end: ';|\\.',
    +          keywords: ERLANG_RESERVED,
    +          contains: BASIC_MODES
    +        }
    +      },
    +      COMMENT,
    +      {
    +        begin: '^-',
    +        end: '\\.',
    +        relevance: 0,
    +        excludeEnd: true,
    +        returnBegin: true,
    +        keywords: {
    +          $pattern: '-' + hljs.IDENT_RE,
    +          keyword: '-module -record -undef -export -ifdef -ifndef -author -copyright -doc -vsn ' +
    +          '-import -include -include_lib -compile -define -else -endif -file -behaviour ' +
    +          '-behavior -spec'
    +        },
    +        contains: [PARAMS]
    +      },
    +      NUMBER,
    +      hljs.QUOTE_STRING_MODE,
    +      RECORD_ACCESS,
    +      VAR1,
    +      VAR2,
    +      TUPLE,
    +      {
    +        begin: /\.$/
    +      } // relevance booster
    +    ]
    +  };
    +}
    +
    +module.exports = erlang;
    diff --git a/node_modules/highlight.js/lib/languages/excel.js b/node_modules/highlight.js/lib/languages/excel.js
    new file mode 100644
    index 0000000..4f20fbc
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/excel.js
    @@ -0,0 +1,64 @@
    +/*
    +Language: Excel formulae
    +Author: Victor Zhou 
    +Description: Excel formulae
    +Website: https://products.office.com/en-us/excel/
    +*/
    +
    +/** @type LanguageFn */
    +function excel(hljs) {
    +  return {
    +    name: 'Excel formulae',
    +    aliases: [
    +      'xlsx',
    +      'xls'
    +    ],
    +    case_insensitive: true,
    +    // built-in functions imported from https://web.archive.org/web/20160513042710/https://support.office.com/en-us/article/Excel-functions-alphabetical-b3944572-255d-4efb-bb96-c6d90033e188
    +    keywords: {
    +      $pattern: /[a-zA-Z][\w\.]*/,
    +      built_in: 'ABS ACCRINT ACCRINTM ACOS ACOSH ACOT ACOTH AGGREGATE ADDRESS AMORDEGRC AMORLINC AND ARABIC AREAS ASC ASIN ASINH ATAN ATAN2 ATANH AVEDEV AVERAGE AVERAGEA AVERAGEIF AVERAGEIFS BAHTTEXT BASE BESSELI BESSELJ BESSELK BESSELY BETADIST BETA.DIST BETAINV BETA.INV BIN2DEC BIN2HEX BIN2OCT BINOMDIST BINOM.DIST BINOM.DIST.RANGE BINOM.INV BITAND BITLSHIFT BITOR BITRSHIFT BITXOR CALL CEILING CEILING.MATH CEILING.PRECISE CELL CHAR CHIDIST CHIINV CHITEST CHISQ.DIST CHISQ.DIST.RT CHISQ.INV CHISQ.INV.RT CHISQ.TEST CHOOSE CLEAN CODE COLUMN COLUMNS COMBIN COMBINA COMPLEX CONCAT CONCATENATE CONFIDENCE CONFIDENCE.NORM CONFIDENCE.T CONVERT CORREL COS COSH COT COTH COUNT COUNTA COUNTBLANK COUNTIF COUNTIFS COUPDAYBS COUPDAYS COUPDAYSNC COUPNCD COUPNUM COUPPCD COVAR COVARIANCE.P COVARIANCE.S CRITBINOM CSC CSCH CUBEKPIMEMBER CUBEMEMBER CUBEMEMBERPROPERTY CUBERANKEDMEMBER CUBESET CUBESETCOUNT CUBEVALUE CUMIPMT CUMPRINC DATE DATEDIF DATEVALUE DAVERAGE DAY DAYS DAYS360 DB DBCS DCOUNT DCOUNTA DDB DEC2BIN DEC2HEX DEC2OCT DECIMAL DEGREES DELTA DEVSQ DGET DISC DMAX DMIN DOLLAR DOLLARDE DOLLARFR DPRODUCT DSTDEV DSTDEVP DSUM DURATION DVAR DVARP EDATE EFFECT ENCODEURL EOMONTH ERF ERF.PRECISE ERFC ERFC.PRECISE ERROR.TYPE EUROCONVERT EVEN EXACT EXP EXPON.DIST EXPONDIST FACT FACTDOUBLE FALSE|0 F.DIST FDIST F.DIST.RT FILTERXML FIND FINDB F.INV F.INV.RT FINV FISHER FISHERINV FIXED FLOOR FLOOR.MATH FLOOR.PRECISE FORECAST FORECAST.ETS FORECAST.ETS.CONFINT FORECAST.ETS.SEASONALITY FORECAST.ETS.STAT FORECAST.LINEAR FORMULATEXT FREQUENCY F.TEST FTEST FV FVSCHEDULE GAMMA GAMMA.DIST GAMMADIST GAMMA.INV GAMMAINV GAMMALN GAMMALN.PRECISE GAUSS GCD GEOMEAN GESTEP GETPIVOTDATA GROWTH HARMEAN HEX2BIN HEX2DEC HEX2OCT HLOOKUP HOUR HYPERLINK HYPGEOM.DIST HYPGEOMDIST IF IFERROR IFNA IFS IMABS IMAGINARY IMARGUMENT IMCONJUGATE IMCOS IMCOSH IMCOT IMCSC IMCSCH IMDIV IMEXP IMLN IMLOG10 IMLOG2 IMPOWER IMPRODUCT IMREAL IMSEC IMSECH IMSIN IMSINH IMSQRT IMSUB IMSUM IMTAN INDEX INDIRECT INFO INT INTERCEPT INTRATE IPMT IRR ISBLANK ISERR ISERROR ISEVEN ISFORMULA ISLOGICAL ISNA ISNONTEXT ISNUMBER ISODD ISREF ISTEXT ISO.CEILING ISOWEEKNUM ISPMT JIS KURT LARGE LCM LEFT LEFTB LEN LENB LINEST LN LOG LOG10 LOGEST LOGINV LOGNORM.DIST LOGNORMDIST LOGNORM.INV LOOKUP LOWER MATCH MAX MAXA MAXIFS MDETERM MDURATION MEDIAN MID MIDBs MIN MINIFS MINA MINUTE MINVERSE MIRR MMULT MOD MODE MODE.MULT MODE.SNGL MONTH MROUND MULTINOMIAL MUNIT N NA NEGBINOM.DIST NEGBINOMDIST NETWORKDAYS NETWORKDAYS.INTL NOMINAL NORM.DIST NORMDIST NORMINV NORM.INV NORM.S.DIST NORMSDIST NORM.S.INV NORMSINV NOT NOW NPER NPV NUMBERVALUE OCT2BIN OCT2DEC OCT2HEX ODD ODDFPRICE ODDFYIELD ODDLPRICE ODDLYIELD OFFSET OR PDURATION PEARSON PERCENTILE.EXC PERCENTILE.INC PERCENTILE PERCENTRANK.EXC PERCENTRANK.INC PERCENTRANK PERMUT PERMUTATIONA PHI PHONETIC PI PMT POISSON.DIST POISSON POWER PPMT PRICE PRICEDISC PRICEMAT PROB PRODUCT PROPER PV QUARTILE QUARTILE.EXC QUARTILE.INC QUOTIENT RADIANS RAND RANDBETWEEN RANK.AVG RANK.EQ RANK RATE RECEIVED REGISTER.ID REPLACE REPLACEB REPT RIGHT RIGHTB ROMAN ROUND ROUNDDOWN ROUNDUP ROW ROWS RRI RSQ RTD SEARCH SEARCHB SEC SECH SECOND SERIESSUM SHEET SHEETS SIGN SIN SINH SKEW SKEW.P SLN SLOPE SMALL SQL.REQUEST SQRT SQRTPI STANDARDIZE STDEV STDEV.P STDEV.S STDEVA STDEVP STDEVPA STEYX SUBSTITUTE SUBTOTAL SUM SUMIF SUMIFS SUMPRODUCT SUMSQ SUMX2MY2 SUMX2PY2 SUMXMY2 SWITCH SYD T TAN TANH TBILLEQ TBILLPRICE TBILLYIELD T.DIST T.DIST.2T T.DIST.RT TDIST TEXT TEXTJOIN TIME TIMEVALUE T.INV T.INV.2T TINV TODAY TRANSPOSE TREND TRIM TRIMMEAN TRUE|0 TRUNC T.TEST TTEST TYPE UNICHAR UNICODE UPPER VALUE VAR VAR.P VAR.S VARA VARP VARPA VDB VLOOKUP WEBSERVICE WEEKDAY WEEKNUM WEIBULL WEIBULL.DIST WORKDAY WORKDAY.INTL XIRR XNPV XOR YEAR YEARFRAC YIELD YIELDDISC YIELDMAT Z.TEST ZTEST'
    +    },
    +    contains: [
    +      {
    +        /* matches a beginning equal sign found in Excel formula examples */
    +        begin: /^=/,
    +        end: /[^=]/,
    +        returnEnd: true,
    +        illegal: /=/, /* only allow single equal sign at front of line */
    +        relevance: 10
    +      },
    +      /* technically, there can be more than 2 letters in column names, but this prevents conflict with some keywords */
    +      {
    +        /* matches a reference to a single cell */
    +        className: 'symbol',
    +        begin: /\b[A-Z]{1,2}\d+\b/,
    +        end: /[^\d]/,
    +        excludeEnd: true,
    +        relevance: 0
    +      },
    +      {
    +        /* matches a reference to a range of cells */
    +        className: 'symbol',
    +        begin: /[A-Z]{0,2}\d*:[A-Z]{0,2}\d*/,
    +        relevance: 0
    +      },
    +      hljs.BACKSLASH_ESCAPE,
    +      hljs.QUOTE_STRING_MODE,
    +      {
    +        className: 'number',
    +        begin: hljs.NUMBER_RE + '(%)?',
    +        relevance: 0
    +      },
    +      /* Excel formula comments are done by putting the comment in a function call to N() */
    +      hljs.COMMENT(/\bN\(/, /\)/,
    +        {
    +          excludeBegin: true,
    +          excludeEnd: true,
    +          illegal: /\n/
    +        })
    +    ]
    +  };
    +}
    +
    +module.exports = excel;
    diff --git a/node_modules/highlight.js/lib/languages/fix.js b/node_modules/highlight.js/lib/languages/fix.js
    new file mode 100644
    index 0000000..137015c
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/fix.js
    @@ -0,0 +1,37 @@
    +/*
    +Language: FIX
    +Author: Brent Bradbury 
    +*/
    +
    +/** @type LanguageFn */
    +function fix(hljs) {
    +  return {
    +    name: 'FIX',
    +    contains: [{
    +      begin: /[^\u2401\u0001]+/,
    +      end: /[\u2401\u0001]/,
    +      excludeEnd: true,
    +      returnBegin: true,
    +      returnEnd: false,
    +      contains: [
    +        {
    +          begin: /([^\u2401\u0001=]+)/,
    +          end: /=([^\u2401\u0001=]+)/,
    +          returnEnd: true,
    +          returnBegin: false,
    +          className: 'attr'
    +        },
    +        {
    +          begin: /=/,
    +          end: /([\u2401\u0001])/,
    +          excludeEnd: true,
    +          excludeBegin: true,
    +          className: 'string'
    +        }
    +      ]
    +    }],
    +    case_insensitive: true
    +  };
    +}
    +
    +module.exports = fix;
    diff --git a/node_modules/highlight.js/lib/languages/flix.js b/node_modules/highlight.js/lib/languages/flix.js
    new file mode 100644
    index 0000000..25a834d
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/flix.js
    @@ -0,0 +1,53 @@
    +/*
    + Language: Flix
    + Category: functional
    + Author: Magnus Madsen 
    + Website: https://flix.dev/
    + */
    +
    + /** @type LanguageFn */
    +function flix(hljs) {
    +  const CHAR = {
    +    className: 'string',
    +    begin: /'(.|\\[xXuU][a-zA-Z0-9]+)'/
    +  };
    +
    +  const STRING = {
    +    className: 'string',
    +    variants: [{
    +      begin: '"',
    +      end: '"'
    +    }]
    +  };
    +
    +  const NAME = {
    +    className: 'title',
    +    begin: /[^0-9\n\t "'(),.`{}\[\]:;][^\n\t "'(),.`{}\[\]:;]+|[^0-9\n\t "'(),.`{}\[\]:;=]/
    +  };
    +
    +  const METHOD = {
    +    className: 'function',
    +    beginKeywords: 'def',
    +    end: /[:={\[(\n;]/,
    +    excludeEnd: true,
    +    contains: [NAME]
    +  };
    +
    +  return {
    +    name: 'Flix',
    +    keywords: {
    +      literal: 'true false',
    +      keyword: 'case class def else enum if impl import in lat rel index let match namespace switch type yield with'
    +    },
    +    contains: [
    +      hljs.C_LINE_COMMENT_MODE,
    +      hljs.C_BLOCK_COMMENT_MODE,
    +      CHAR,
    +      STRING,
    +      METHOD,
    +      hljs.C_NUMBER_MODE
    +    ]
    +  };
    +}
    +
    +module.exports = flix;
    diff --git a/node_modules/highlight.js/lib/languages/fortran.js b/node_modules/highlight.js/lib/languages/fortran.js
    new file mode 100644
    index 0000000..06adc64
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/fortran.js
    @@ -0,0 +1,159 @@
    +/**
    + * @param {string} value
    + * @returns {RegExp}
    + * */
    +
    +/**
    + * @param {RegExp | string } re
    + * @returns {string}
    + */
    +function source(re) {
    +  if (!re) return null;
    +  if (typeof re === "string") return re;
    +
    +  return re.source;
    +}
    +
    +/**
    + * @param {...(RegExp | string) } args
    + * @returns {string}
    + */
    +function concat(...args) {
    +  const joined = args.map((x) => source(x)).join("");
    +  return joined;
    +}
    +
    +/*
    +Language: Fortran
    +Author: Anthony Scemama 
    +Website: https://en.wikipedia.org/wiki/Fortran
    +Category: scientific
    +*/
    +
    +/** @type LanguageFn */
    +function fortran(hljs) {
    +  const PARAMS = {
    +    className: 'params',
    +    begin: '\\(',
    +    end: '\\)'
    +  };
    +
    +  const COMMENT = {
    +    variants: [
    +      hljs.COMMENT('!', '$', {
    +        relevance: 0
    +      }),
    +      // allow FORTRAN 77 style comments
    +      hljs.COMMENT('^C[ ]', '$', {
    +        relevance: 0
    +      }),
    +      hljs.COMMENT('^C$', '$', {
    +        relevance: 0
    +      })
    +    ]
    +  };
    +
    +  // regex in both fortran and irpf90 should match
    +  const OPTIONAL_NUMBER_SUFFIX = /(_[a-z_\d]+)?/;
    +  const OPTIONAL_NUMBER_EXP = /([de][+-]?\d+)?/;
    +  const NUMBER = {
    +    className: 'number',
    +    variants: [
    +      {
    +        begin: concat(/\b\d+/, /\.(\d*)/, OPTIONAL_NUMBER_EXP, OPTIONAL_NUMBER_SUFFIX)
    +      },
    +      {
    +        begin: concat(/\b\d+/, OPTIONAL_NUMBER_EXP, OPTIONAL_NUMBER_SUFFIX)
    +      },
    +      {
    +        begin: concat(/\.\d+/, OPTIONAL_NUMBER_EXP, OPTIONAL_NUMBER_SUFFIX)
    +      }
    +    ],
    +    relevance: 0
    +  };
    +
    +  const FUNCTION_DEF = {
    +    className: 'function',
    +    beginKeywords: 'subroutine function program',
    +    illegal: '[${=\\n]',
    +    contains: [
    +      hljs.UNDERSCORE_TITLE_MODE,
    +      PARAMS
    +    ]
    +  };
    +
    +  const STRING = {
    +    className: 'string',
    +    relevance: 0,
    +    variants: [
    +      hljs.APOS_STRING_MODE,
    +      hljs.QUOTE_STRING_MODE
    +    ]
    +  };
    +
    +  const KEYWORDS = {
    +    literal: '.False. .True.',
    +    keyword: 'kind do concurrent local shared while private call intrinsic where elsewhere ' +
    +      'type endtype endmodule endselect endinterface end enddo endif if forall endforall only contains default return stop then block endblock endassociate ' +
    +      'public subroutine|10 function program .and. .or. .not. .le. .eq. .ge. .gt. .lt. ' +
    +      'goto save else use module select case ' +
    +      'access blank direct exist file fmt form formatted iostat name named nextrec number opened rec recl sequential status unformatted unit ' +
    +      'continue format pause cycle exit ' +
    +      'c_null_char c_alert c_backspace c_form_feed flush wait decimal round iomsg ' +
    +      'synchronous nopass non_overridable pass protected volatile abstract extends import ' +
    +      'non_intrinsic value deferred generic final enumerator class associate bind enum ' +
    +      'c_int c_short c_long c_long_long c_signed_char c_size_t c_int8_t c_int16_t c_int32_t c_int64_t c_int_least8_t c_int_least16_t ' +
    +      'c_int_least32_t c_int_least64_t c_int_fast8_t c_int_fast16_t c_int_fast32_t c_int_fast64_t c_intmax_t C_intptr_t c_float c_double ' +
    +      'c_long_double c_float_complex c_double_complex c_long_double_complex c_bool c_char c_null_ptr c_null_funptr ' +
    +      'c_new_line c_carriage_return c_horizontal_tab c_vertical_tab iso_c_binding c_loc c_funloc c_associated  c_f_pointer ' +
    +      'c_ptr c_funptr iso_fortran_env character_storage_size error_unit file_storage_size input_unit iostat_end iostat_eor ' +
    +      'numeric_storage_size output_unit c_f_procpointer ieee_arithmetic ieee_support_underflow_control ' +
    +      'ieee_get_underflow_mode ieee_set_underflow_mode newunit contiguous recursive ' +
    +      'pad position action delim readwrite eor advance nml interface procedure namelist include sequence elemental pure impure ' +
    +      'integer real character complex logical codimension dimension allocatable|10 parameter ' +
    +      'external implicit|10 none double precision assign intent optional pointer ' +
    +      'target in out common equivalence data',
    +    built_in: 'alog alog10 amax0 amax1 amin0 amin1 amod cabs ccos cexp clog csin csqrt dabs dacos dasin datan datan2 dcos dcosh ddim dexp dint ' +
    +      'dlog dlog10 dmax1 dmin1 dmod dnint dsign dsin dsinh dsqrt dtan dtanh float iabs idim idint idnint ifix isign max0 max1 min0 min1 sngl ' +
    +      'algama cdabs cdcos cdexp cdlog cdsin cdsqrt cqabs cqcos cqexp cqlog cqsin cqsqrt dcmplx dconjg derf derfc dfloat dgamma dimag dlgama ' +
    +      'iqint qabs qacos qasin qatan qatan2 qcmplx qconjg qcos qcosh qdim qerf qerfc qexp qgamma qimag qlgama qlog qlog10 qmax1 qmin1 qmod ' +
    +      'qnint qsign qsin qsinh qsqrt qtan qtanh abs acos aimag aint anint asin atan atan2 char cmplx conjg cos cosh exp ichar index int log ' +
    +      'log10 max min nint sign sin sinh sqrt tan tanh print write dim lge lgt lle llt mod nullify allocate deallocate ' +
    +      'adjustl adjustr all allocated any associated bit_size btest ceiling count cshift date_and_time digits dot_product ' +
    +      'eoshift epsilon exponent floor fraction huge iand ibclr ibits ibset ieor ior ishft ishftc lbound len_trim matmul ' +
    +      'maxexponent maxloc maxval merge minexponent minloc minval modulo mvbits nearest pack present product ' +
    +      'radix random_number random_seed range repeat reshape rrspacing scale scan selected_int_kind selected_real_kind ' +
    +      'set_exponent shape size spacing spread sum system_clock tiny transpose trim ubound unpack verify achar iachar transfer ' +
    +      'dble entry dprod cpu_time command_argument_count get_command get_command_argument get_environment_variable is_iostat_end ' +
    +      'ieee_arithmetic ieee_support_underflow_control ieee_get_underflow_mode ieee_set_underflow_mode ' +
    +      'is_iostat_eor move_alloc new_line selected_char_kind same_type_as extends_type_of ' +
    +      'acosh asinh atanh bessel_j0 bessel_j1 bessel_jn bessel_y0 bessel_y1 bessel_yn erf erfc erfc_scaled gamma log_gamma hypot norm2 ' +
    +      'atomic_define atomic_ref execute_command_line leadz trailz storage_size merge_bits ' +
    +      'bge bgt ble blt dshiftl dshiftr findloc iall iany iparity image_index lcobound ucobound maskl maskr ' +
    +      'num_images parity popcnt poppar shifta shiftl shiftr this_image sync change team co_broadcast co_max co_min co_sum co_reduce'
    +  };
    +  return {
    +    name: 'Fortran',
    +    case_insensitive: true,
    +    aliases: [
    +      'f90',
    +      'f95'
    +    ],
    +    keywords: KEYWORDS,
    +    illegal: /\/\*/,
    +    contains: [
    +      STRING,
    +      FUNCTION_DEF,
    +      // allow `C = value` for assignments so they aren't misdetected
    +      // as Fortran 77 style comments
    +      {
    +        begin: /^C\s*=(?!=)/,
    +        relevance: 0
    +      },
    +      COMMENT,
    +      NUMBER
    +    ]
    +  };
    +}
    +
    +module.exports = fortran;
    diff --git a/node_modules/highlight.js/lib/languages/fsharp.js b/node_modules/highlight.js/lib/languages/fsharp.js
    new file mode 100644
    index 0000000..89488a0
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/fsharp.js
    @@ -0,0 +1,86 @@
    +/*
    +Language: F#
    +Author: Jonas Follesø 
    +Contributors: Troy Kershaw , Henrik Feldt 
    +Website: https://docs.microsoft.com/en-us/dotnet/fsharp/
    +Category: functional
    +*/
    +
    +/** @type LanguageFn */
    +function fsharp(hljs) {
    +  const TYPEPARAM = {
    +    begin: '<',
    +    end: '>',
    +    contains: [
    +      hljs.inherit(hljs.TITLE_MODE, {
    +        begin: /'[a-zA-Z0-9_]+/
    +      })
    +    ]
    +  };
    +
    +  return {
    +    name: 'F#',
    +    aliases: ['fs'],
    +    keywords:
    +      'abstract and as assert base begin class default delegate do done ' +
    +      'downcast downto elif else end exception extern false finally for ' +
    +      'fun function global if in inherit inline interface internal lazy let ' +
    +      'match member module mutable namespace new null of open or ' +
    +      'override private public rec return sig static struct then to ' +
    +      'true try type upcast use val void when while with yield',
    +    illegal: /\/\*/,
    +    contains: [
    +      {
    +        // monad builder keywords (matches before non-bang kws)
    +        className: 'keyword',
    +        begin: /\b(yield|return|let|do)!/
    +      },
    +      {
    +        className: 'string',
    +        begin: '@"',
    +        end: '"',
    +        contains: [
    +          {
    +            begin: '""'
    +          }
    +        ]
    +      },
    +      {
    +        className: 'string',
    +        begin: '"""',
    +        end: '"""'
    +      },
    +      hljs.COMMENT('\\(\\*(\\s)', '\\*\\)', {
    +        contains: ["self"]
    +      }),
    +      {
    +        className: 'class',
    +        beginKeywords: 'type',
    +        end: '\\(|=|$',
    +        excludeEnd: true,
    +        contains: [
    +          hljs.UNDERSCORE_TITLE_MODE,
    +          TYPEPARAM
    +        ]
    +      },
    +      {
    +        className: 'meta',
    +        begin: '\\[<',
    +        end: '>\\]',
    +        relevance: 10
    +      },
    +      {
    +        className: 'symbol',
    +        begin: '\\B(\'[A-Za-z])\\b',
    +        contains: [hljs.BACKSLASH_ESCAPE]
    +      },
    +      hljs.C_LINE_COMMENT_MODE,
    +      hljs.inherit(hljs.QUOTE_STRING_MODE, {
    +        illegal: null
    +      }),
    +      hljs.C_NUMBER_MODE
    +    ]
    +  };
    +}
    +
    +module.exports = fsharp;
    diff --git a/node_modules/highlight.js/lib/languages/gams.js b/node_modules/highlight.js/lib/languages/gams.js
    new file mode 100644
    index 0000000..5398fdc
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/gams.js
    @@ -0,0 +1,208 @@
    +/**
    + * @param {string} value
    + * @returns {RegExp}
    + * */
    +
    +/**
    + * @param {RegExp | string } re
    + * @returns {string}
    + */
    +function source(re) {
    +  if (!re) return null;
    +  if (typeof re === "string") return re;
    +
    +  return re.source;
    +}
    +
    +/**
    + * @param {RegExp | string } re
    + * @returns {string}
    + */
    +function anyNumberOfTimes(re) {
    +  return concat('(', re, ')*');
    +}
    +
    +/**
    + * @param {...(RegExp | string) } args
    + * @returns {string}
    + */
    +function concat(...args) {
    +  const joined = args.map((x) => source(x)).join("");
    +  return joined;
    +}
    +
    +/** @type LanguageFn */
    +function gams(hljs) {
    +  const KEYWORDS = {
    +    keyword:
    +      'abort acronym acronyms alias all and assign binary card diag display ' +
    +      'else eq file files for free ge gt if integer le loop lt maximizing ' +
    +      'minimizing model models ne negative no not option options or ord ' +
    +      'positive prod put putpage puttl repeat sameas semicont semiint smax ' +
    +      'smin solve sos1 sos2 sum system table then until using while xor yes',
    +    literal:
    +      'eps inf na',
    +    built_in:
    +      'abs arccos arcsin arctan arctan2 Beta betaReg binomial ceil centropy ' +
    +      'cos cosh cvPower div div0 eDist entropy errorf execSeed exp fact ' +
    +      'floor frac gamma gammaReg log logBeta logGamma log10 log2 mapVal max ' +
    +      'min mod ncpCM ncpF ncpVUpow ncpVUsin normal pi poly power ' +
    +      'randBinomial randLinear randTriangle round rPower sigmoid sign ' +
    +      'signPower sin sinh slexp sllog10 slrec sqexp sqlog10 sqr sqrec sqrt ' +
    +      'tan tanh trunc uniform uniformInt vcPower bool_and bool_eqv bool_imp ' +
    +      'bool_not bool_or bool_xor ifThen rel_eq rel_ge rel_gt rel_le rel_lt ' +
    +      'rel_ne gday gdow ghour gleap gmillisec gminute gmonth gsecond gyear ' +
    +      'jdate jnow jstart jtime errorLevel execError gamsRelease gamsVersion ' +
    +      'handleCollect handleDelete handleStatus handleSubmit heapFree ' +
    +      'heapLimit heapSize jobHandle jobKill jobStatus jobTerminate ' +
    +      'licenseLevel licenseStatus maxExecError sleep timeClose timeComp ' +
    +      'timeElapsed timeExec timeStart'
    +  };
    +  const PARAMS = {
    +    className: 'params',
    +    begin: /\(/,
    +    end: /\)/,
    +    excludeBegin: true,
    +    excludeEnd: true
    +  };
    +  const SYMBOLS = {
    +    className: 'symbol',
    +    variants: [
    +      {
    +        begin: /=[lgenxc]=/
    +      },
    +      {
    +        begin: /\$/
    +      }
    +    ]
    +  };
    +  const QSTR = { // One-line quoted comment string
    +    className: 'comment',
    +    variants: [
    +      {
    +        begin: '\'',
    +        end: '\''
    +      },
    +      {
    +        begin: '"',
    +        end: '"'
    +      }
    +    ],
    +    illegal: '\\n',
    +    contains: [hljs.BACKSLASH_ESCAPE]
    +  };
    +  const ASSIGNMENT = {
    +    begin: '/',
    +    end: '/',
    +    keywords: KEYWORDS,
    +    contains: [
    +      QSTR,
    +      hljs.C_LINE_COMMENT_MODE,
    +      hljs.C_BLOCK_COMMENT_MODE,
    +      hljs.QUOTE_STRING_MODE,
    +      hljs.APOS_STRING_MODE,
    +      hljs.C_NUMBER_MODE
    +    ]
    +  };
    +  const COMMENT_WORD = /[a-z0-9&#*=?@\\><:,()$[\]_.{}!+%^-]+/;
    +  const DESCTEXT = { // Parameter/set/variable description text
    +    begin: /[a-z][a-z0-9_]*(\([a-z0-9_, ]*\))?[ \t]+/,
    +    excludeBegin: true,
    +    end: '$',
    +    endsWithParent: true,
    +    contains: [
    +      QSTR,
    +      ASSIGNMENT,
    +      {
    +        className: 'comment',
    +        // one comment word, then possibly more
    +        begin: concat(
    +          COMMENT_WORD,
    +          // [ ] because \s would be too broad (matching newlines)
    +          anyNumberOfTimes(concat(/[ ]+/, COMMENT_WORD))
    +        ),
    +        relevance: 0
    +      }
    +    ]
    +  };
    +
    +  return {
    +    name: 'GAMS',
    +    aliases: ['gms'],
    +    case_insensitive: true,
    +    keywords: KEYWORDS,
    +    contains: [
    +      hljs.COMMENT(/^\$ontext/, /^\$offtext/),
    +      {
    +        className: 'meta',
    +        begin: '^\\$[a-z0-9]+',
    +        end: '$',
    +        returnBegin: true,
    +        contains: [
    +          {
    +            className: 'meta-keyword',
    +            begin: '^\\$[a-z0-9]+'
    +          }
    +        ]
    +      },
    +      hljs.COMMENT('^\\*', '$'),
    +      hljs.C_LINE_COMMENT_MODE,
    +      hljs.C_BLOCK_COMMENT_MODE,
    +      hljs.QUOTE_STRING_MODE,
    +      hljs.APOS_STRING_MODE,
    +      // Declarations
    +      {
    +        beginKeywords:
    +          'set sets parameter parameters variable variables ' +
    +          'scalar scalars equation equations',
    +        end: ';',
    +        contains: [
    +          hljs.COMMENT('^\\*', '$'),
    +          hljs.C_LINE_COMMENT_MODE,
    +          hljs.C_BLOCK_COMMENT_MODE,
    +          hljs.QUOTE_STRING_MODE,
    +          hljs.APOS_STRING_MODE,
    +          ASSIGNMENT,
    +          DESCTEXT
    +        ]
    +      },
    +      { // table environment
    +        beginKeywords: 'table',
    +        end: ';',
    +        returnBegin: true,
    +        contains: [
    +          { // table header row
    +            beginKeywords: 'table',
    +            end: '$',
    +            contains: [DESCTEXT]
    +          },
    +          hljs.COMMENT('^\\*', '$'),
    +          hljs.C_LINE_COMMENT_MODE,
    +          hljs.C_BLOCK_COMMENT_MODE,
    +          hljs.QUOTE_STRING_MODE,
    +          hljs.APOS_STRING_MODE,
    +          hljs.C_NUMBER_MODE
    +          // Table does not contain DESCTEXT or ASSIGNMENT
    +        ]
    +      },
    +      // Function definitions
    +      {
    +        className: 'function',
    +        begin: /^[a-z][a-z0-9_,\-+' ()$]+\.{2}/,
    +        returnBegin: true,
    +        contains: [
    +          { // Function title
    +            className: 'title',
    +            begin: /^[a-z0-9_]+/
    +          },
    +          PARAMS,
    +          SYMBOLS
    +        ]
    +      },
    +      hljs.C_NUMBER_MODE,
    +      SYMBOLS
    +    ]
    +  };
    +}
    +
    +module.exports = gams;
    diff --git a/node_modules/highlight.js/lib/languages/gauss.js b/node_modules/highlight.js/lib/languages/gauss.js
    new file mode 100644
    index 0000000..29254f0
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/gauss.js
    @@ -0,0 +1,316 @@
    +/*
    +Language: GAUSS
    +Author: Matt Evans 
    +Description: GAUSS Mathematical and Statistical language
    +Website: https://www.aptech.com
    +Category: scientific
    +*/
    +function gauss(hljs) {
    +  const KEYWORDS = {
    +    keyword: 'bool break call callexe checkinterrupt clear clearg closeall cls comlog compile ' +
    +              'continue create debug declare delete disable dlibrary dllcall do dos ed edit else ' +
    +              'elseif enable end endfor endif endp endo errorlog errorlogat expr external fn ' +
    +              'for format goto gosub graph if keyword let lib library line load loadarray loadexe ' +
    +              'loadf loadk loadm loadp loads loadx local locate loopnextindex lprint lpwidth lshow ' +
    +              'matrix msym ndpclex new open output outwidth plot plotsym pop prcsn print ' +
    +              'printdos proc push retp return rndcon rndmod rndmult rndseed run save saveall screen ' +
    +              'scroll setarray show sparse stop string struct system trace trap threadfor ' +
    +              'threadendfor threadbegin threadjoin threadstat threadend until use while winprint ' +
    +              'ne ge le gt lt and xor or not eq eqv',
    +    built_in: 'abs acf aconcat aeye amax amean AmericanBinomCall AmericanBinomCall_Greeks AmericanBinomCall_ImpVol ' +
    +              'AmericanBinomPut AmericanBinomPut_Greeks AmericanBinomPut_ImpVol AmericanBSCall AmericanBSCall_Greeks ' +
    +              'AmericanBSCall_ImpVol AmericanBSPut AmericanBSPut_Greeks AmericanBSPut_ImpVol amin amult annotationGetDefaults ' +
    +              'annotationSetBkd annotationSetFont annotationSetLineColor annotationSetLineStyle annotationSetLineThickness ' +
    +              'annualTradingDays arccos arcsin areshape arrayalloc arrayindex arrayinit arraytomat asciiload asclabel astd ' +
    +              'astds asum atan atan2 atranspose axmargin balance band bandchol bandcholsol bandltsol bandrv bandsolpd bar ' +
    +              'base10 begwind besselj bessely beta box boxcox cdfBeta cdfBetaInv cdfBinomial cdfBinomialInv cdfBvn cdfBvn2 ' +
    +              'cdfBvn2e cdfCauchy cdfCauchyInv cdfChic cdfChii cdfChinc cdfChincInv cdfExp cdfExpInv cdfFc cdfFnc cdfFncInv ' +
    +              'cdfGam cdfGenPareto cdfHyperGeo cdfLaplace cdfLaplaceInv cdfLogistic cdfLogisticInv cdfmControlCreate cdfMvn ' +
    +              'cdfMvn2e cdfMvnce cdfMvne cdfMvt2e cdfMvtce cdfMvte cdfN cdfN2 cdfNc cdfNegBinomial cdfNegBinomialInv cdfNi ' +
    +              'cdfPoisson cdfPoissonInv cdfRayleigh cdfRayleighInv cdfTc cdfTci cdfTnc cdfTvn cdfWeibull cdfWeibullInv cdir ' +
    +              'ceil ChangeDir chdir chiBarSquare chol choldn cholsol cholup chrs close code cols colsf combinate combinated ' +
    +              'complex con cond conj cons ConScore contour conv convertsatostr convertstrtosa corrm corrms corrvc corrx corrxs ' +
    +              'cos cosh counts countwts crossprd crout croutp csrcol csrlin csvReadM csvReadSA cumprodc cumsumc curve cvtos ' +
    +              'datacreate datacreatecomplex datalist dataload dataloop dataopen datasave date datestr datestring datestrymd ' +
    +              'dayinyr dayofweek dbAddDatabase dbClose dbCommit dbCreateQuery dbExecQuery dbGetConnectOptions dbGetDatabaseName ' +
    +              'dbGetDriverName dbGetDrivers dbGetHostName dbGetLastErrorNum dbGetLastErrorText dbGetNumericalPrecPolicy ' +
    +              'dbGetPassword dbGetPort dbGetTableHeaders dbGetTables dbGetUserName dbHasFeature dbIsDriverAvailable dbIsOpen ' +
    +              'dbIsOpenError dbOpen dbQueryBindValue dbQueryClear dbQueryCols dbQueryExecPrepared dbQueryFetchAllM dbQueryFetchAllSA ' +
    +              'dbQueryFetchOneM dbQueryFetchOneSA dbQueryFinish dbQueryGetBoundValue dbQueryGetBoundValues dbQueryGetField ' +
    +              'dbQueryGetLastErrorNum dbQueryGetLastErrorText dbQueryGetLastInsertID dbQueryGetLastQuery dbQueryGetPosition ' +
    +              'dbQueryIsActive dbQueryIsForwardOnly dbQueryIsNull dbQueryIsSelect dbQueryIsValid dbQueryPrepare dbQueryRows ' +
    +              'dbQuerySeek dbQuerySeekFirst dbQuerySeekLast dbQuerySeekNext dbQuerySeekPrevious dbQuerySetForwardOnly ' +
    +              'dbRemoveDatabase dbRollback dbSetConnectOptions dbSetDatabaseName dbSetHostName dbSetNumericalPrecPolicy ' +
    +              'dbSetPort dbSetUserName dbTransaction DeleteFile delif delrows denseToSp denseToSpRE denToZero design det detl ' +
    +              'dfft dffti diag diagrv digamma doswin DOSWinCloseall DOSWinOpen dotfeq dotfeqmt dotfge dotfgemt dotfgt dotfgtmt ' +
    +              'dotfle dotflemt dotflt dotfltmt dotfne dotfnemt draw drop dsCreate dstat dstatmt dstatmtControlCreate dtdate dtday ' +
    +              'dttime dttodtv dttostr dttoutc dtvnormal dtvtodt dtvtoutc dummy dummybr dummydn eig eigh eighv eigv elapsedTradingDays ' +
    +              'endwind envget eof eqSolve eqSolvemt eqSolvemtControlCreate eqSolvemtOutCreate eqSolveset erf erfc erfccplx erfcplx error ' +
    +              'etdays ethsec etstr EuropeanBinomCall EuropeanBinomCall_Greeks EuropeanBinomCall_ImpVol EuropeanBinomPut ' +
    +              'EuropeanBinomPut_Greeks EuropeanBinomPut_ImpVol EuropeanBSCall EuropeanBSCall_Greeks EuropeanBSCall_ImpVol ' +
    +              'EuropeanBSPut EuropeanBSPut_Greeks EuropeanBSPut_ImpVol exctsmpl exec execbg exp extern eye fcheckerr fclearerr feq ' +
    +              'feqmt fflush fft ffti fftm fftmi fftn fge fgemt fgets fgetsa fgetsat fgetst fgt fgtmt fileinfo filesa fle flemt ' +
    +              'floor flt fltmt fmod fne fnemt fonts fopen formatcv formatnv fputs fputst fseek fstrerror ftell ftocv ftos ftostrC ' +
    +              'gamma gammacplx gammaii gausset gdaAppend gdaCreate gdaDStat gdaDStatMat gdaGetIndex gdaGetName gdaGetNames gdaGetOrders ' +
    +              'gdaGetType gdaGetTypes gdaGetVarInfo gdaIsCplx gdaLoad gdaPack gdaRead gdaReadByIndex gdaReadSome gdaReadSparse ' +
    +              'gdaReadStruct gdaReportVarInfo gdaSave gdaUpdate gdaUpdateAndPack gdaVars gdaWrite gdaWrite32 gdaWriteSome getarray ' +
    +              'getdims getf getGAUSShome getmatrix getmatrix4D getname getnamef getNextTradingDay getNextWeekDay getnr getorders ' +
    +              'getpath getPreviousTradingDay getPreviousWeekDay getRow getscalar3D getscalar4D getTrRow getwind glm gradcplx gradMT ' +
    +              'gradMTm gradMTT gradMTTm gradp graphprt graphset hasimag header headermt hess hessMT hessMTg hessMTgw hessMTm ' +
    +              'hessMTmw hessMTT hessMTTg hessMTTgw hessMTTm hessMTw hessp hist histf histp hsec imag indcv indexcat indices indices2 ' +
    +              'indicesf indicesfn indnv indsav integrate1d integrateControlCreate intgrat2 intgrat3 inthp1 inthp2 inthp3 inthp4 ' +
    +              'inthpControlCreate intquad1 intquad2 intquad3 intrleav intrleavsa intrsect intsimp inv invpd invswp iscplx iscplxf ' +
    +              'isden isinfnanmiss ismiss key keyav keyw lag lag1 lagn lapEighb lapEighi lapEighvb lapEighvi lapgEig lapgEigh lapgEighv ' +
    +              'lapgEigv lapgSchur lapgSvdcst lapgSvds lapgSvdst lapSvdcusv lapSvds lapSvdusv ldlp ldlsol linSolve listwise ln lncdfbvn ' +
    +              'lncdfbvn2 lncdfmvn lncdfn lncdfn2 lncdfnc lnfact lngammacplx lnpdfmvn lnpdfmvt lnpdfn lnpdft loadd loadstruct loadwind ' +
    +              'loess loessmt loessmtControlCreate log loglog logx logy lower lowmat lowmat1 ltrisol lu lusol machEpsilon make makevars ' +
    +              'makewind margin matalloc matinit mattoarray maxbytes maxc maxindc maxv maxvec mbesselei mbesselei0 mbesselei1 mbesseli ' +
    +              'mbesseli0 mbesseli1 meanc median mergeby mergevar minc minindc minv miss missex missrv moment momentd movingave ' +
    +              'movingaveExpwgt movingaveWgt nextindex nextn nextnevn nextwind ntos null null1 numCombinations ols olsmt olsmtControlCreate ' +
    +              'olsqr olsqr2 olsqrmt ones optn optnevn orth outtyp pacf packedToSp packr parse pause pdfCauchy pdfChi pdfExp pdfGenPareto ' +
    +              'pdfHyperGeo pdfLaplace pdfLogistic pdfn pdfPoisson pdfRayleigh pdfWeibull pi pinv pinvmt plotAddArrow plotAddBar plotAddBox ' +
    +              'plotAddHist plotAddHistF plotAddHistP plotAddPolar plotAddScatter plotAddShape plotAddTextbox plotAddTS plotAddXY plotArea ' +
    +              'plotBar plotBox plotClearLayout plotContour plotCustomLayout plotGetDefaults plotHist plotHistF plotHistP plotLayout ' +
    +              'plotLogLog plotLogX plotLogY plotOpenWindow plotPolar plotSave plotScatter plotSetAxesPen plotSetBar plotSetBarFill ' +
    +              'plotSetBarStacked plotSetBkdColor plotSetFill plotSetGrid plotSetLegend plotSetLineColor plotSetLineStyle plotSetLineSymbol ' +
    +              'plotSetLineThickness plotSetNewWindow plotSetTitle plotSetWhichYAxis plotSetXAxisShow plotSetXLabel plotSetXRange ' +
    +              'plotSetXTicInterval plotSetXTicLabel plotSetYAxisShow plotSetYLabel plotSetYRange plotSetZAxisShow plotSetZLabel ' +
    +              'plotSurface plotTS plotXY polar polychar polyeval polygamma polyint polymake polymat polymroot polymult polyroot ' +
    +              'pqgwin previousindex princomp printfm printfmt prodc psi putarray putf putvals pvCreate pvGetIndex pvGetParNames ' +
    +              'pvGetParVector pvLength pvList pvPack pvPacki pvPackm pvPackmi pvPacks pvPacksi pvPacksm pvPacksmi pvPutParVector ' +
    +              'pvTest pvUnpack QNewton QNewtonmt QNewtonmtControlCreate QNewtonmtOutCreate QNewtonSet QProg QProgmt QProgmtInCreate ' +
    +              'qqr qqre qqrep qr qre qrep qrsol qrtsol qtyr qtyre qtyrep quantile quantiled qyr qyre qyrep qz rank rankindx readr ' +
    +              'real reclassify reclassifyCuts recode recserar recsercp recserrc rerun rescale reshape rets rev rfft rffti rfftip rfftn ' +
    +              'rfftnp rfftp rndBernoulli rndBeta rndBinomial rndCauchy rndChiSquare rndCon rndCreateState rndExp rndGamma rndGeo rndGumbel ' +
    +              'rndHyperGeo rndi rndKMbeta rndKMgam rndKMi rndKMn rndKMnb rndKMp rndKMu rndKMvm rndLaplace rndLCbeta rndLCgam rndLCi rndLCn ' +
    +              'rndLCnb rndLCp rndLCu rndLCvm rndLogNorm rndMTu rndMVn rndMVt rndn rndnb rndNegBinomial rndp rndPoisson rndRayleigh ' +
    +              'rndStateSkip rndu rndvm rndWeibull rndWishart rotater round rows rowsf rref sampleData satostrC saved saveStruct savewind ' +
    +              'scale scale3d scalerr scalinfnanmiss scalmiss schtoc schur searchsourcepath seekr select selif seqa seqm setdif setdifsa ' +
    +              'setvars setvwrmode setwind shell shiftr sin singleindex sinh sleep solpd sortc sortcc sortd sorthc sorthcc sortind ' +
    +              'sortindc sortmc sortr sortrc spBiconjGradSol spChol spConjGradSol spCreate spDenseSubmat spDiagRvMat spEigv spEye spLDL ' +
    +              'spline spLU spNumNZE spOnes spreadSheetReadM spreadSheetReadSA spreadSheetWrite spScale spSubmat spToDense spTrTDense ' +
    +              'spTScalar spZeros sqpSolve sqpSolveMT sqpSolveMTControlCreate sqpSolveMTlagrangeCreate sqpSolveMToutCreate sqpSolveSet ' +
    +              'sqrt statements stdc stdsc stocv stof strcombine strindx strlen strput strrindx strsect strsplit strsplitPad strtodt ' +
    +              'strtof strtofcplx strtriml strtrimr strtrunc strtruncl strtruncpad strtruncr submat subscat substute subvec sumc sumr ' +
    +              'surface svd svd1 svd2 svdcusv svds svdusv sysstate tab tan tanh tempname ' +
    +              'time timedt timestr timeutc title tkf2eps tkf2ps tocart todaydt toeplitz token topolar trapchk ' +
    +              'trigamma trimr trunc type typecv typef union unionsa uniqindx uniqindxsa unique uniquesa upmat upmat1 upper utctodt ' +
    +              'utctodtv utrisol vals varCovMS varCovXS varget vargetl varmall varmares varput varputl vartypef vcm vcms vcx vcxs ' +
    +              'vec vech vecr vector vget view viewxyz vlist vnamecv volume vput vread vtypecv wait waitc walkindex where window ' +
    +              'writer xlabel xlsGetSheetCount xlsGetSheetSize xlsGetSheetTypes xlsMakeRange xlsReadM xlsReadSA xlsWrite xlsWriteM ' +
    +              'xlsWriteSA xpnd xtics xy xyz ylabel ytics zeros zeta zlabel ztics cdfEmpirical dot h5create h5open h5read h5readAttribute ' +
    +              'h5write h5writeAttribute ldl plotAddErrorBar plotAddSurface plotCDFEmpirical plotSetColormap plotSetContourLabels ' +
    +              'plotSetLegendFont plotSetTextInterpreter plotSetXTicCount plotSetYTicCount plotSetZLevels powerm strjoin sylvester ' +
    +              'strtrim',
    +    literal: 'DB_AFTER_LAST_ROW DB_ALL_TABLES DB_BATCH_OPERATIONS DB_BEFORE_FIRST_ROW DB_BLOB DB_EVENT_NOTIFICATIONS ' +
    +             'DB_FINISH_QUERY DB_HIGH_PRECISION DB_LAST_INSERT_ID DB_LOW_PRECISION_DOUBLE DB_LOW_PRECISION_INT32 ' +
    +             'DB_LOW_PRECISION_INT64 DB_LOW_PRECISION_NUMBERS DB_MULTIPLE_RESULT_SETS DB_NAMED_PLACEHOLDERS ' +
    +             'DB_POSITIONAL_PLACEHOLDERS DB_PREPARED_QUERIES DB_QUERY_SIZE DB_SIMPLE_LOCKING DB_SYSTEM_TABLES DB_TABLES ' +
    +             'DB_TRANSACTIONS DB_UNICODE DB_VIEWS __STDIN __STDOUT __STDERR __FILE_DIR'
    +  };
    +
    +  const AT_COMMENT_MODE = hljs.COMMENT('@', '@');
    +
    +  const PREPROCESSOR =
    +  {
    +    className: 'meta',
    +    begin: '#',
    +    end: '$',
    +    keywords: {
    +      'meta-keyword': 'define definecs|10 undef ifdef ifndef iflight ifdllcall ifmac ifos2win ifunix else endif lineson linesoff srcfile srcline'
    +    },
    +    contains: [
    +      {
    +        begin: /\\\n/,
    +        relevance: 0
    +      },
    +      {
    +        beginKeywords: 'include',
    +        end: '$',
    +        keywords: {
    +          'meta-keyword': 'include'
    +        },
    +        contains: [
    +          {
    +            className: 'meta-string',
    +            begin: '"',
    +            end: '"',
    +            illegal: '\\n'
    +          }
    +        ]
    +      },
    +      hljs.C_LINE_COMMENT_MODE,
    +      hljs.C_BLOCK_COMMENT_MODE,
    +      AT_COMMENT_MODE
    +    ]
    +  };
    +
    +  const STRUCT_TYPE =
    +  {
    +    begin: /\bstruct\s+/,
    +    end: /\s/,
    +    keywords: "struct",
    +    contains: [
    +      {
    +        className: "type",
    +        begin: hljs.UNDERSCORE_IDENT_RE,
    +        relevance: 0
    +      }
    +    ]
    +  };
    +
    +  // only for definitions
    +  const PARSE_PARAMS = [
    +    {
    +      className: 'params',
    +      begin: /\(/,
    +      end: /\)/,
    +      excludeBegin: true,
    +      excludeEnd: true,
    +      endsWithParent: true,
    +      relevance: 0,
    +      contains: [
    +        { // dots
    +          className: 'literal',
    +          begin: /\.\.\./
    +        },
    +        hljs.C_NUMBER_MODE,
    +        hljs.C_BLOCK_COMMENT_MODE,
    +        AT_COMMENT_MODE,
    +        STRUCT_TYPE
    +      ]
    +    }
    +  ];
    +
    +  const FUNCTION_DEF =
    +  {
    +    className: "title",
    +    begin: hljs.UNDERSCORE_IDENT_RE,
    +    relevance: 0
    +  };
    +
    +  const DEFINITION = function(beginKeywords, end, inherits) {
    +    const mode = hljs.inherit(
    +      {
    +        className: "function",
    +        beginKeywords: beginKeywords,
    +        end: end,
    +        excludeEnd: true,
    +        contains: [].concat(PARSE_PARAMS)
    +      },
    +      inherits || {}
    +    );
    +    mode.contains.push(FUNCTION_DEF);
    +    mode.contains.push(hljs.C_NUMBER_MODE);
    +    mode.contains.push(hljs.C_BLOCK_COMMENT_MODE);
    +    mode.contains.push(AT_COMMENT_MODE);
    +    return mode;
    +  };
    +
    +  const BUILT_IN_REF =
    +  { // these are explicitly named internal function calls
    +    className: 'built_in',
    +    begin: '\\b(' + KEYWORDS.built_in.split(' ').join('|') + ')\\b'
    +  };
    +
    +  const STRING_REF =
    +  {
    +    className: 'string',
    +    begin: '"',
    +    end: '"',
    +    contains: [hljs.BACKSLASH_ESCAPE],
    +    relevance: 0
    +  };
    +
    +  const FUNCTION_REF =
    +  {
    +    // className: "fn_ref",
    +    begin: hljs.UNDERSCORE_IDENT_RE + '\\s*\\(',
    +    returnBegin: true,
    +    keywords: KEYWORDS,
    +    relevance: 0,
    +    contains: [
    +      {
    +        beginKeywords: KEYWORDS.keyword
    +      },
    +      BUILT_IN_REF,
    +      { // ambiguously named function calls get a relevance of 0
    +        className: 'built_in',
    +        begin: hljs.UNDERSCORE_IDENT_RE,
    +        relevance: 0
    +      }
    +    ]
    +  };
    +
    +  const FUNCTION_REF_PARAMS =
    +  {
    +    // className: "fn_ref_params",
    +    begin: /\(/,
    +    end: /\)/,
    +    relevance: 0,
    +    keywords: {
    +      built_in: KEYWORDS.built_in,
    +      literal: KEYWORDS.literal
    +    },
    +    contains: [
    +      hljs.C_NUMBER_MODE,
    +      hljs.C_BLOCK_COMMENT_MODE,
    +      AT_COMMENT_MODE,
    +      BUILT_IN_REF,
    +      FUNCTION_REF,
    +      STRING_REF,
    +      'self'
    +    ]
    +  };
    +
    +  FUNCTION_REF.contains.push(FUNCTION_REF_PARAMS);
    +
    +  return {
    +    name: 'GAUSS',
    +    aliases: ['gss'],
    +    case_insensitive: true, // language is case-insensitive
    +    keywords: KEYWORDS,
    +    illegal: /(\{[%#]|[%#]\}| <- )/,
    +    contains: [
    +      hljs.C_NUMBER_MODE,
    +      hljs.C_LINE_COMMENT_MODE,
    +      hljs.C_BLOCK_COMMENT_MODE,
    +      AT_COMMENT_MODE,
    +      STRING_REF,
    +      PREPROCESSOR,
    +      {
    +        className: 'keyword',
    +        begin: /\bexternal (matrix|string|array|sparse matrix|struct|proc|keyword|fn)/
    +      },
    +      DEFINITION('proc keyword', ';'),
    +      DEFINITION('fn', '='),
    +      {
    +        beginKeywords: 'for threadfor',
    +        end: /;/,
    +        // end: /\(/,
    +        relevance: 0,
    +        contains: [
    +          hljs.C_BLOCK_COMMENT_MODE,
    +          AT_COMMENT_MODE,
    +          FUNCTION_REF_PARAMS
    +        ]
    +      },
    +      { // custom method guard
    +        // excludes method names from keyword processing
    +        variants: [
    +          {
    +            begin: hljs.UNDERSCORE_IDENT_RE + '\\.' + hljs.UNDERSCORE_IDENT_RE
    +          },
    +          {
    +            begin: hljs.UNDERSCORE_IDENT_RE + '\\s*='
    +          }
    +        ],
    +        relevance: 0
    +      },
    +      FUNCTION_REF,
    +      STRUCT_TYPE
    +    ]
    +  };
    +}
    +
    +module.exports = gauss;
    diff --git a/node_modules/highlight.js/lib/languages/gcode.js b/node_modules/highlight.js/lib/languages/gcode.js
    new file mode 100644
    index 0000000..0f5cbe2
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/gcode.js
    @@ -0,0 +1,88 @@
    +/*
    + Language: G-code (ISO 6983)
    + Contributors: Adam Joseph Cook 
    + Description: G-code syntax highlighter for Fanuc and other common CNC machine tool controls.
    + Website: https://www.sis.se/api/document/preview/911952/
    + */
    +
    +function gcode(hljs) {
    +  const GCODE_IDENT_RE = '[A-Z_][A-Z0-9_.]*';
    +  const GCODE_CLOSE_RE = '%';
    +  const GCODE_KEYWORDS = {
    +    $pattern: GCODE_IDENT_RE,
    +    keyword: 'IF DO WHILE ENDWHILE CALL ENDIF SUB ENDSUB GOTO REPEAT ENDREPEAT ' +
    +      'EQ LT GT NE GE LE OR XOR'
    +  };
    +  const GCODE_START = {
    +    className: 'meta',
    +    begin: '([O])([0-9]+)'
    +  };
    +  const NUMBER = hljs.inherit(hljs.C_NUMBER_MODE, {
    +    begin: '([-+]?((\\.\\d+)|(\\d+)(\\.\\d*)?))|' + hljs.C_NUMBER_RE
    +  });
    +  const GCODE_CODE = [
    +    hljs.C_LINE_COMMENT_MODE,
    +    hljs.C_BLOCK_COMMENT_MODE,
    +    hljs.COMMENT(/\(/, /\)/),
    +    NUMBER,
    +    hljs.inherit(hljs.APOS_STRING_MODE, {
    +      illegal: null
    +    }),
    +    hljs.inherit(hljs.QUOTE_STRING_MODE, {
    +      illegal: null
    +    }),
    +    {
    +      className: 'name',
    +      begin: '([G])([0-9]+\\.?[0-9]?)'
    +    },
    +    {
    +      className: 'name',
    +      begin: '([M])([0-9]+\\.?[0-9]?)'
    +    },
    +    {
    +      className: 'attr',
    +      begin: '(VC|VS|#)',
    +      end: '(\\d+)'
    +    },
    +    {
    +      className: 'attr',
    +      begin: '(VZOFX|VZOFY|VZOFZ)'
    +    },
    +    {
    +      className: 'built_in',
    +      begin: '(ATAN|ABS|ACOS|ASIN|SIN|COS|EXP|FIX|FUP|ROUND|LN|TAN)(\\[)',
    +      contains: [
    +        NUMBER
    +      ],
    +      end: '\\]'
    +    },
    +    {
    +      className: 'symbol',
    +      variants: [
    +        {
    +          begin: 'N',
    +          end: '\\d+',
    +          illegal: '\\W'
    +        }
    +      ]
    +    }
    +  ];
    +
    +  return {
    +    name: 'G-code (ISO 6983)',
    +    aliases: ['nc'],
    +    // Some implementations (CNC controls) of G-code are interoperable with uppercase and lowercase letters seamlessly.
    +    // However, most prefer all uppercase and uppercase is customary.
    +    case_insensitive: true,
    +    keywords: GCODE_KEYWORDS,
    +    contains: [
    +      {
    +        className: 'meta',
    +        begin: GCODE_CLOSE_RE
    +      },
    +      GCODE_START
    +    ].concat(GCODE_CODE)
    +  };
    +}
    +
    +module.exports = gcode;
    diff --git a/node_modules/highlight.js/lib/languages/gherkin.js b/node_modules/highlight.js/lib/languages/gherkin.js
    new file mode 100644
    index 0000000..2cae1e2
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/gherkin.js
    @@ -0,0 +1,49 @@
    +/*
    + Language: Gherkin
    + Author: Sam Pikesley (@pikesley) 
    + Description: Gherkin is the format for cucumber specifications. It is a domain specific language which helps you to describe business behavior without the need to go into detail of implementation.
    + Website: https://cucumber.io/docs/gherkin/
    + */
    +
    +function gherkin(hljs) {
    +  return {
    +    name: 'Gherkin',
    +    aliases: ['feature'],
    +    keywords: 'Feature Background Ability Business\ Need Scenario Scenarios Scenario\ Outline Scenario\ Template Examples Given And Then But When',
    +    contains: [
    +      {
    +        className: 'symbol',
    +        begin: '\\*',
    +        relevance: 0
    +      },
    +      {
    +        className: 'meta',
    +        begin: '@[^@\\s]+'
    +      },
    +      {
    +        begin: '\\|',
    +        end: '\\|\\w*$',
    +        contains: [
    +          {
    +            className: 'string',
    +            begin: '[^|]+'
    +          }
    +        ]
    +      },
    +      {
    +        className: 'variable',
    +        begin: '<',
    +        end: '>'
    +      },
    +      hljs.HASH_COMMENT_MODE,
    +      {
    +        className: 'string',
    +        begin: '"""',
    +        end: '"""'
    +      },
    +      hljs.QUOTE_STRING_MODE
    +    ]
    +  };
    +}
    +
    +module.exports = gherkin;
    diff --git a/node_modules/highlight.js/lib/languages/glsl.js b/node_modules/highlight.js/lib/languages/glsl.js
    new file mode 100644
    index 0000000..4f52116
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/glsl.js
    @@ -0,0 +1,128 @@
    +/*
    +Language: GLSL
    +Description: OpenGL Shading Language
    +Author: Sergey Tikhomirov 
    +Website: https://en.wikipedia.org/wiki/OpenGL_Shading_Language
    +Category: graphics
    +*/
    +
    +function glsl(hljs) {
    +  return {
    +    name: 'GLSL',
    +    keywords: {
    +      keyword:
    +        // Statements
    +        'break continue discard do else for if return while switch case default ' +
    +        // Qualifiers
    +        'attribute binding buffer ccw centroid centroid varying coherent column_major const cw ' +
    +        'depth_any depth_greater depth_less depth_unchanged early_fragment_tests equal_spacing ' +
    +        'flat fractional_even_spacing fractional_odd_spacing highp in index inout invariant ' +
    +        'invocations isolines layout line_strip lines lines_adjacency local_size_x local_size_y ' +
    +        'local_size_z location lowp max_vertices mediump noperspective offset origin_upper_left ' +
    +        'out packed patch pixel_center_integer point_mode points precise precision quads r11f_g11f_b10f ' +
    +        'r16 r16_snorm r16f r16i r16ui r32f r32i r32ui r8 r8_snorm r8i r8ui readonly restrict ' +
    +        'rg16 rg16_snorm rg16f rg16i rg16ui rg32f rg32i rg32ui rg8 rg8_snorm rg8i rg8ui rgb10_a2 ' +
    +        'rgb10_a2ui rgba16 rgba16_snorm rgba16f rgba16i rgba16ui rgba32f rgba32i rgba32ui rgba8 ' +
    +        'rgba8_snorm rgba8i rgba8ui row_major sample shared smooth std140 std430 stream triangle_strip ' +
    +        'triangles triangles_adjacency uniform varying vertices volatile writeonly',
    +      type:
    +        'atomic_uint bool bvec2 bvec3 bvec4 dmat2 dmat2x2 dmat2x3 dmat2x4 dmat3 dmat3x2 dmat3x3 ' +
    +        'dmat3x4 dmat4 dmat4x2 dmat4x3 dmat4x4 double dvec2 dvec3 dvec4 float iimage1D iimage1DArray ' +
    +        'iimage2D iimage2DArray iimage2DMS iimage2DMSArray iimage2DRect iimage3D iimageBuffer ' +
    +        'iimageCube iimageCubeArray image1D image1DArray image2D image2DArray image2DMS image2DMSArray ' +
    +        'image2DRect image3D imageBuffer imageCube imageCubeArray int isampler1D isampler1DArray ' +
    +        'isampler2D isampler2DArray isampler2DMS isampler2DMSArray isampler2DRect isampler3D ' +
    +        'isamplerBuffer isamplerCube isamplerCubeArray ivec2 ivec3 ivec4 mat2 mat2x2 mat2x3 ' +
    +        'mat2x4 mat3 mat3x2 mat3x3 mat3x4 mat4 mat4x2 mat4x3 mat4x4 sampler1D sampler1DArray ' +
    +        'sampler1DArrayShadow sampler1DShadow sampler2D sampler2DArray sampler2DArrayShadow ' +
    +        'sampler2DMS sampler2DMSArray sampler2DRect sampler2DRectShadow sampler2DShadow sampler3D ' +
    +        'samplerBuffer samplerCube samplerCubeArray samplerCubeArrayShadow samplerCubeShadow ' +
    +        'image1D uimage1DArray uimage2D uimage2DArray uimage2DMS uimage2DMSArray uimage2DRect ' +
    +        'uimage3D uimageBuffer uimageCube uimageCubeArray uint usampler1D usampler1DArray ' +
    +        'usampler2D usampler2DArray usampler2DMS usampler2DMSArray usampler2DRect usampler3D ' +
    +        'samplerBuffer usamplerCube usamplerCubeArray uvec2 uvec3 uvec4 vec2 vec3 vec4 void',
    +      built_in:
    +        // Constants
    +        'gl_MaxAtomicCounterBindings gl_MaxAtomicCounterBufferSize gl_MaxClipDistances gl_MaxClipPlanes ' +
    +        'gl_MaxCombinedAtomicCounterBuffers gl_MaxCombinedAtomicCounters gl_MaxCombinedImageUniforms ' +
    +        'gl_MaxCombinedImageUnitsAndFragmentOutputs gl_MaxCombinedTextureImageUnits gl_MaxComputeAtomicCounterBuffers ' +
    +        'gl_MaxComputeAtomicCounters gl_MaxComputeImageUniforms gl_MaxComputeTextureImageUnits ' +
    +        'gl_MaxComputeUniformComponents gl_MaxComputeWorkGroupCount gl_MaxComputeWorkGroupSize ' +
    +        'gl_MaxDrawBuffers gl_MaxFragmentAtomicCounterBuffers gl_MaxFragmentAtomicCounters ' +
    +        'gl_MaxFragmentImageUniforms gl_MaxFragmentInputComponents gl_MaxFragmentInputVectors ' +
    +        'gl_MaxFragmentUniformComponents gl_MaxFragmentUniformVectors gl_MaxGeometryAtomicCounterBuffers ' +
    +        'gl_MaxGeometryAtomicCounters gl_MaxGeometryImageUniforms gl_MaxGeometryInputComponents ' +
    +        'gl_MaxGeometryOutputComponents gl_MaxGeometryOutputVertices gl_MaxGeometryTextureImageUnits ' +
    +        'gl_MaxGeometryTotalOutputComponents gl_MaxGeometryUniformComponents gl_MaxGeometryVaryingComponents ' +
    +        'gl_MaxImageSamples gl_MaxImageUnits gl_MaxLights gl_MaxPatchVertices gl_MaxProgramTexelOffset ' +
    +        'gl_MaxTessControlAtomicCounterBuffers gl_MaxTessControlAtomicCounters gl_MaxTessControlImageUniforms ' +
    +        'gl_MaxTessControlInputComponents gl_MaxTessControlOutputComponents gl_MaxTessControlTextureImageUnits ' +
    +        'gl_MaxTessControlTotalOutputComponents gl_MaxTessControlUniformComponents ' +
    +        'gl_MaxTessEvaluationAtomicCounterBuffers gl_MaxTessEvaluationAtomicCounters ' +
    +        'gl_MaxTessEvaluationImageUniforms gl_MaxTessEvaluationInputComponents gl_MaxTessEvaluationOutputComponents ' +
    +        'gl_MaxTessEvaluationTextureImageUnits gl_MaxTessEvaluationUniformComponents ' +
    +        'gl_MaxTessGenLevel gl_MaxTessPatchComponents gl_MaxTextureCoords gl_MaxTextureImageUnits ' +
    +        'gl_MaxTextureUnits gl_MaxVaryingComponents gl_MaxVaryingFloats gl_MaxVaryingVectors ' +
    +        'gl_MaxVertexAtomicCounterBuffers gl_MaxVertexAtomicCounters gl_MaxVertexAttribs gl_MaxVertexImageUniforms ' +
    +        'gl_MaxVertexOutputComponents gl_MaxVertexOutputVectors gl_MaxVertexTextureImageUnits ' +
    +        'gl_MaxVertexUniformComponents gl_MaxVertexUniformVectors gl_MaxViewports gl_MinProgramTexelOffset ' +
    +        // Variables
    +        'gl_BackColor gl_BackLightModelProduct gl_BackLightProduct gl_BackMaterial ' +
    +        'gl_BackSecondaryColor gl_ClipDistance gl_ClipPlane gl_ClipVertex gl_Color ' +
    +        'gl_DepthRange gl_EyePlaneQ gl_EyePlaneR gl_EyePlaneS gl_EyePlaneT gl_Fog gl_FogCoord ' +
    +        'gl_FogFragCoord gl_FragColor gl_FragCoord gl_FragData gl_FragDepth gl_FrontColor ' +
    +        'gl_FrontFacing gl_FrontLightModelProduct gl_FrontLightProduct gl_FrontMaterial ' +
    +        'gl_FrontSecondaryColor gl_GlobalInvocationID gl_InstanceID gl_InvocationID gl_Layer gl_LightModel ' +
    +        'gl_LightSource gl_LocalInvocationID gl_LocalInvocationIndex gl_ModelViewMatrix ' +
    +        'gl_ModelViewMatrixInverse gl_ModelViewMatrixInverseTranspose gl_ModelViewMatrixTranspose ' +
    +        'gl_ModelViewProjectionMatrix gl_ModelViewProjectionMatrixInverse gl_ModelViewProjectionMatrixInverseTranspose ' +
    +        'gl_ModelViewProjectionMatrixTranspose gl_MultiTexCoord0 gl_MultiTexCoord1 gl_MultiTexCoord2 ' +
    +        'gl_MultiTexCoord3 gl_MultiTexCoord4 gl_MultiTexCoord5 gl_MultiTexCoord6 gl_MultiTexCoord7 ' +
    +        'gl_Normal gl_NormalMatrix gl_NormalScale gl_NumSamples gl_NumWorkGroups gl_ObjectPlaneQ ' +
    +        'gl_ObjectPlaneR gl_ObjectPlaneS gl_ObjectPlaneT gl_PatchVerticesIn gl_Point gl_PointCoord ' +
    +        'gl_PointSize gl_Position gl_PrimitiveID gl_PrimitiveIDIn gl_ProjectionMatrix gl_ProjectionMatrixInverse ' +
    +        'gl_ProjectionMatrixInverseTranspose gl_ProjectionMatrixTranspose gl_SampleID gl_SampleMask ' +
    +        'gl_SampleMaskIn gl_SamplePosition gl_SecondaryColor gl_TessCoord gl_TessLevelInner gl_TessLevelOuter ' +
    +        'gl_TexCoord gl_TextureEnvColor gl_TextureMatrix gl_TextureMatrixInverse gl_TextureMatrixInverseTranspose ' +
    +        'gl_TextureMatrixTranspose gl_Vertex gl_VertexID gl_ViewportIndex gl_WorkGroupID gl_WorkGroupSize gl_in gl_out ' +
    +        // Functions
    +        'EmitStreamVertex EmitVertex EndPrimitive EndStreamPrimitive abs acos acosh all any asin ' +
    +        'asinh atan atanh atomicAdd atomicAnd atomicCompSwap atomicCounter atomicCounterDecrement ' +
    +        'atomicCounterIncrement atomicExchange atomicMax atomicMin atomicOr atomicXor barrier ' +
    +        'bitCount bitfieldExtract bitfieldInsert bitfieldReverse ceil clamp cos cosh cross ' +
    +        'dFdx dFdy degrees determinant distance dot equal exp exp2 faceforward findLSB findMSB ' +
    +        'floatBitsToInt floatBitsToUint floor fma fract frexp ftransform fwidth greaterThan ' +
    +        'greaterThanEqual groupMemoryBarrier imageAtomicAdd imageAtomicAnd imageAtomicCompSwap ' +
    +        'imageAtomicExchange imageAtomicMax imageAtomicMin imageAtomicOr imageAtomicXor imageLoad ' +
    +        'imageSize imageStore imulExtended intBitsToFloat interpolateAtCentroid interpolateAtOffset ' +
    +        'interpolateAtSample inverse inversesqrt isinf isnan ldexp length lessThan lessThanEqual log ' +
    +        'log2 matrixCompMult max memoryBarrier memoryBarrierAtomicCounter memoryBarrierBuffer ' +
    +        'memoryBarrierImage memoryBarrierShared min mix mod modf noise1 noise2 noise3 noise4 ' +
    +        'normalize not notEqual outerProduct packDouble2x32 packHalf2x16 packSnorm2x16 packSnorm4x8 ' +
    +        'packUnorm2x16 packUnorm4x8 pow radians reflect refract round roundEven shadow1D shadow1DLod ' +
    +        'shadow1DProj shadow1DProjLod shadow2D shadow2DLod shadow2DProj shadow2DProjLod sign sin sinh ' +
    +        'smoothstep sqrt step tan tanh texelFetch texelFetchOffset texture texture1D texture1DLod ' +
    +        'texture1DProj texture1DProjLod texture2D texture2DLod texture2DProj texture2DProjLod ' +
    +        'texture3D texture3DLod texture3DProj texture3DProjLod textureCube textureCubeLod ' +
    +        'textureGather textureGatherOffset textureGatherOffsets textureGrad textureGradOffset ' +
    +        'textureLod textureLodOffset textureOffset textureProj textureProjGrad textureProjGradOffset ' +
    +        'textureProjLod textureProjLodOffset textureProjOffset textureQueryLevels textureQueryLod ' +
    +        'textureSize transpose trunc uaddCarry uintBitsToFloat umulExtended unpackDouble2x32 ' +
    +        'unpackHalf2x16 unpackSnorm2x16 unpackSnorm4x8 unpackUnorm2x16 unpackUnorm4x8 usubBorrow',
    +      literal: 'true false'
    +    },
    +    illegal: '"',
    +    contains: [
    +      hljs.C_LINE_COMMENT_MODE,
    +      hljs.C_BLOCK_COMMENT_MODE,
    +      hljs.C_NUMBER_MODE,
    +      {
    +        className: 'meta',
    +        begin: '#',
    +        end: '$'
    +      }
    +    ]
    +  };
    +}
    +
    +module.exports = glsl;
    diff --git a/node_modules/highlight.js/lib/languages/gml.js b/node_modules/highlight.js/lib/languages/gml.js
    new file mode 100644
    index 0000000..c1dd0e3
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/gml.js
    @@ -0,0 +1,886 @@
    +/*
    +Language: GML
    +Author: Meseta 
    +Description: Game Maker Language for GameMaker Studio 2
    +Website: https://docs2.yoyogames.com
    +Category: scripting
    +*/
    +
    +function gml(hljs) {
    +  const GML_KEYWORDS = {
    +    keyword: 'begin end if then else while do for break continue with until ' +
    +      'repeat exit and or xor not return mod div switch case default var ' +
    +      'globalvar enum #macro #region #endregion',
    +    built_in: 'is_real is_string is_array is_undefined is_int32 is_int64 ' +
    +      'is_ptr is_vec3 is_vec4 is_matrix is_bool typeof ' +
    +      'variable_global_exists variable_global_get variable_global_set ' +
    +      'variable_instance_exists variable_instance_get variable_instance_set ' +
    +      'variable_instance_get_names array_length_1d array_length_2d ' +
    +      'array_height_2d array_equals array_create array_copy random ' +
    +      'random_range irandom irandom_range random_set_seed random_get_seed ' +
    +      'randomize randomise choose abs round floor ceil sign frac sqrt sqr ' +
    +      'exp ln log2 log10 sin cos tan arcsin arccos arctan arctan2 dsin dcos ' +
    +      'dtan darcsin darccos darctan darctan2 degtorad radtodeg power logn ' +
    +      'min max mean median clamp lerp dot_product dot_product_3d ' +
    +      'dot_product_normalised dot_product_3d_normalised ' +
    +      'dot_product_normalized dot_product_3d_normalized math_set_epsilon ' +
    +      'math_get_epsilon angle_difference point_distance_3d point_distance ' +
    +      'point_direction lengthdir_x lengthdir_y real string int64 ptr ' +
    +      'string_format chr ansi_char ord string_length string_byte_length ' +
    +      'string_pos string_copy string_char_at string_ord_at string_byte_at ' +
    +      'string_set_byte_at string_delete string_insert string_lower ' +
    +      'string_upper string_repeat string_letters string_digits ' +
    +      'string_lettersdigits string_replace string_replace_all string_count ' +
    +      'string_hash_to_newline clipboard_has_text clipboard_set_text ' +
    +      'clipboard_get_text date_current_datetime date_create_datetime ' +
    +      'date_valid_datetime date_inc_year date_inc_month date_inc_week ' +
    +      'date_inc_day date_inc_hour date_inc_minute date_inc_second ' +
    +      'date_get_year date_get_month date_get_week date_get_day ' +
    +      'date_get_hour date_get_minute date_get_second date_get_weekday ' +
    +      'date_get_day_of_year date_get_hour_of_year date_get_minute_of_year ' +
    +      'date_get_second_of_year date_year_span date_month_span ' +
    +      'date_week_span date_day_span date_hour_span date_minute_span ' +
    +      'date_second_span date_compare_datetime date_compare_date ' +
    +      'date_compare_time date_date_of date_time_of date_datetime_string ' +
    +      'date_date_string date_time_string date_days_in_month ' +
    +      'date_days_in_year date_leap_year date_is_today date_set_timezone ' +
    +      'date_get_timezone game_set_speed game_get_speed motion_set ' +
    +      'motion_add place_free place_empty place_meeting place_snapped ' +
    +      'move_random move_snap move_towards_point move_contact_solid ' +
    +      'move_contact_all move_outside_solid move_outside_all ' +
    +      'move_bounce_solid move_bounce_all move_wrap distance_to_point ' +
    +      'distance_to_object position_empty position_meeting path_start ' +
    +      'path_end mp_linear_step mp_potential_step mp_linear_step_object ' +
    +      'mp_potential_step_object mp_potential_settings mp_linear_path ' +
    +      'mp_potential_path mp_linear_path_object mp_potential_path_object ' +
    +      'mp_grid_create mp_grid_destroy mp_grid_clear_all mp_grid_clear_cell ' +
    +      'mp_grid_clear_rectangle mp_grid_add_cell mp_grid_get_cell ' +
    +      'mp_grid_add_rectangle mp_grid_add_instances mp_grid_path ' +
    +      'mp_grid_draw mp_grid_to_ds_grid collision_point collision_rectangle ' +
    +      'collision_circle collision_ellipse collision_line ' +
    +      'collision_point_list collision_rectangle_list collision_circle_list ' +
    +      'collision_ellipse_list collision_line_list instance_position_list ' +
    +      'instance_place_list point_in_rectangle ' +
    +      'point_in_triangle point_in_circle rectangle_in_rectangle ' +
    +      'rectangle_in_triangle rectangle_in_circle instance_find ' +
    +      'instance_exists instance_number instance_position instance_nearest ' +
    +      'instance_furthest instance_place instance_create_depth ' +
    +      'instance_create_layer instance_copy instance_change instance_destroy ' +
    +      'position_destroy position_change instance_id_get ' +
    +      'instance_deactivate_all instance_deactivate_object ' +
    +      'instance_deactivate_region instance_activate_all ' +
    +      'instance_activate_object instance_activate_region room_goto ' +
    +      'room_goto_previous room_goto_next room_previous room_next ' +
    +      'room_restart game_end game_restart game_load game_save ' +
    +      'game_save_buffer game_load_buffer event_perform event_user ' +
    +      'event_perform_object event_inherited show_debug_message ' +
    +      'show_debug_overlay debug_event debug_get_callstack alarm_get ' +
    +      'alarm_set font_texture_page_size keyboard_set_map keyboard_get_map ' +
    +      'keyboard_unset_map keyboard_check keyboard_check_pressed ' +
    +      'keyboard_check_released keyboard_check_direct keyboard_get_numlock ' +
    +      'keyboard_set_numlock keyboard_key_press keyboard_key_release ' +
    +      'keyboard_clear io_clear mouse_check_button ' +
    +      'mouse_check_button_pressed mouse_check_button_released ' +
    +      'mouse_wheel_up mouse_wheel_down mouse_clear draw_self draw_sprite ' +
    +      'draw_sprite_pos draw_sprite_ext draw_sprite_stretched ' +
    +      'draw_sprite_stretched_ext draw_sprite_tiled draw_sprite_tiled_ext ' +
    +      'draw_sprite_part draw_sprite_part_ext draw_sprite_general draw_clear ' +
    +      'draw_clear_alpha draw_point draw_line draw_line_width draw_rectangle ' +
    +      'draw_roundrect draw_roundrect_ext draw_triangle draw_circle ' +
    +      'draw_ellipse draw_set_circle_precision draw_arrow draw_button ' +
    +      'draw_path draw_healthbar draw_getpixel draw_getpixel_ext ' +
    +      'draw_set_colour draw_set_color draw_set_alpha draw_get_colour ' +
    +      'draw_get_color draw_get_alpha merge_colour make_colour_rgb ' +
    +      'make_colour_hsv colour_get_red colour_get_green colour_get_blue ' +
    +      'colour_get_hue colour_get_saturation colour_get_value merge_color ' +
    +      'make_color_rgb make_color_hsv color_get_red color_get_green ' +
    +      'color_get_blue color_get_hue color_get_saturation color_get_value ' +
    +      'merge_color screen_save screen_save_part draw_set_font ' +
    +      'draw_set_halign draw_set_valign draw_text draw_text_ext string_width ' +
    +      'string_height string_width_ext string_height_ext ' +
    +      'draw_text_transformed draw_text_ext_transformed draw_text_colour ' +
    +      'draw_text_ext_colour draw_text_transformed_colour ' +
    +      'draw_text_ext_transformed_colour draw_text_color draw_text_ext_color ' +
    +      'draw_text_transformed_color draw_text_ext_transformed_color ' +
    +      'draw_point_colour draw_line_colour draw_line_width_colour ' +
    +      'draw_rectangle_colour draw_roundrect_colour ' +
    +      'draw_roundrect_colour_ext draw_triangle_colour draw_circle_colour ' +
    +      'draw_ellipse_colour draw_point_color draw_line_color ' +
    +      'draw_line_width_color draw_rectangle_color draw_roundrect_color ' +
    +      'draw_roundrect_color_ext draw_triangle_color draw_circle_color ' +
    +      'draw_ellipse_color draw_primitive_begin draw_vertex ' +
    +      'draw_vertex_colour draw_vertex_color draw_primitive_end ' +
    +      'sprite_get_uvs font_get_uvs sprite_get_texture font_get_texture ' +
    +      'texture_get_width texture_get_height texture_get_uvs ' +
    +      'draw_primitive_begin_texture draw_vertex_texture ' +
    +      'draw_vertex_texture_colour draw_vertex_texture_color ' +
    +      'texture_global_scale surface_create surface_create_ext ' +
    +      'surface_resize surface_free surface_exists surface_get_width ' +
    +      'surface_get_height surface_get_texture surface_set_target ' +
    +      'surface_set_target_ext surface_reset_target surface_depth_disable ' +
    +      'surface_get_depth_disable draw_surface draw_surface_stretched ' +
    +      'draw_surface_tiled draw_surface_part draw_surface_ext ' +
    +      'draw_surface_stretched_ext draw_surface_tiled_ext ' +
    +      'draw_surface_part_ext draw_surface_general surface_getpixel ' +
    +      'surface_getpixel_ext surface_save surface_save_part surface_copy ' +
    +      'surface_copy_part application_surface_draw_enable ' +
    +      'application_get_position application_surface_enable ' +
    +      'application_surface_is_enabled display_get_width display_get_height ' +
    +      'display_get_orientation display_get_gui_width display_get_gui_height ' +
    +      'display_reset display_mouse_get_x display_mouse_get_y ' +
    +      'display_mouse_set display_set_ui_visibility ' +
    +      'window_set_fullscreen window_get_fullscreen ' +
    +      'window_set_caption window_set_min_width window_set_max_width ' +
    +      'window_set_min_height window_set_max_height window_get_visible_rects ' +
    +      'window_get_caption window_set_cursor window_get_cursor ' +
    +      'window_set_colour window_get_colour window_set_color ' +
    +      'window_get_color window_set_position window_set_size ' +
    +      'window_set_rectangle window_center window_get_x window_get_y ' +
    +      'window_get_width window_get_height window_mouse_get_x ' +
    +      'window_mouse_get_y window_mouse_set window_view_mouse_get_x ' +
    +      'window_view_mouse_get_y window_views_mouse_get_x ' +
    +      'window_views_mouse_get_y audio_listener_position ' +
    +      'audio_listener_velocity audio_listener_orientation ' +
    +      'audio_emitter_position audio_emitter_create audio_emitter_free ' +
    +      'audio_emitter_exists audio_emitter_pitch audio_emitter_velocity ' +
    +      'audio_emitter_falloff audio_emitter_gain audio_play_sound ' +
    +      'audio_play_sound_on audio_play_sound_at audio_stop_sound ' +
    +      'audio_resume_music audio_music_is_playing audio_resume_sound ' +
    +      'audio_pause_sound audio_pause_music audio_channel_num ' +
    +      'audio_sound_length audio_get_type audio_falloff_set_model ' +
    +      'audio_play_music audio_stop_music audio_master_gain audio_music_gain ' +
    +      'audio_sound_gain audio_sound_pitch audio_stop_all audio_resume_all ' +
    +      'audio_pause_all audio_is_playing audio_is_paused audio_exists ' +
    +      'audio_sound_set_track_position audio_sound_get_track_position ' +
    +      'audio_emitter_get_gain audio_emitter_get_pitch audio_emitter_get_x ' +
    +      'audio_emitter_get_y audio_emitter_get_z audio_emitter_get_vx ' +
    +      'audio_emitter_get_vy audio_emitter_get_vz ' +
    +      'audio_listener_set_position audio_listener_set_velocity ' +
    +      'audio_listener_set_orientation audio_listener_get_data ' +
    +      'audio_set_master_gain audio_get_master_gain audio_sound_get_gain ' +
    +      'audio_sound_get_pitch audio_get_name audio_sound_set_track_position ' +
    +      'audio_sound_get_track_position audio_create_stream ' +
    +      'audio_destroy_stream audio_create_sync_group ' +
    +      'audio_destroy_sync_group audio_play_in_sync_group ' +
    +      'audio_start_sync_group audio_stop_sync_group audio_pause_sync_group ' +
    +      'audio_resume_sync_group audio_sync_group_get_track_pos ' +
    +      'audio_sync_group_debug audio_sync_group_is_playing audio_debug ' +
    +      'audio_group_load audio_group_unload audio_group_is_loaded ' +
    +      'audio_group_load_progress audio_group_name audio_group_stop_all ' +
    +      'audio_group_set_gain audio_create_buffer_sound ' +
    +      'audio_free_buffer_sound audio_create_play_queue ' +
    +      'audio_free_play_queue audio_queue_sound audio_get_recorder_count ' +
    +      'audio_get_recorder_info audio_start_recording audio_stop_recording ' +
    +      'audio_sound_get_listener_mask audio_emitter_get_listener_mask ' +
    +      'audio_get_listener_mask audio_sound_set_listener_mask ' +
    +      'audio_emitter_set_listener_mask audio_set_listener_mask ' +
    +      'audio_get_listener_count audio_get_listener_info audio_system ' +
    +      'show_message show_message_async clickable_add clickable_add_ext ' +
    +      'clickable_change clickable_change_ext clickable_delete ' +
    +      'clickable_exists clickable_set_style show_question ' +
    +      'show_question_async get_integer get_string get_integer_async ' +
    +      'get_string_async get_login_async get_open_filename get_save_filename ' +
    +      'get_open_filename_ext get_save_filename_ext show_error ' +
    +      'highscore_clear highscore_add highscore_value highscore_name ' +
    +      'draw_highscore sprite_exists sprite_get_name sprite_get_number ' +
    +      'sprite_get_width sprite_get_height sprite_get_xoffset ' +
    +      'sprite_get_yoffset sprite_get_bbox_left sprite_get_bbox_right ' +
    +      'sprite_get_bbox_top sprite_get_bbox_bottom sprite_save ' +
    +      'sprite_save_strip sprite_set_cache_size sprite_set_cache_size_ext ' +
    +      'sprite_get_tpe sprite_prefetch sprite_prefetch_multi sprite_flush ' +
    +      'sprite_flush_multi sprite_set_speed sprite_get_speed_type ' +
    +      'sprite_get_speed font_exists font_get_name font_get_fontname ' +
    +      'font_get_bold font_get_italic font_get_first font_get_last ' +
    +      'font_get_size font_set_cache_size path_exists path_get_name ' +
    +      'path_get_length path_get_time path_get_kind path_get_closed ' +
    +      'path_get_precision path_get_number path_get_point_x path_get_point_y ' +
    +      'path_get_point_speed path_get_x path_get_y path_get_speed ' +
    +      'script_exists script_get_name timeline_add timeline_delete ' +
    +      'timeline_clear timeline_exists timeline_get_name ' +
    +      'timeline_moment_clear timeline_moment_add_script timeline_size ' +
    +      'timeline_max_moment object_exists object_get_name object_get_sprite ' +
    +      'object_get_solid object_get_visible object_get_persistent ' +
    +      'object_get_mask object_get_parent object_get_physics ' +
    +      'object_is_ancestor room_exists room_get_name sprite_set_offset ' +
    +      'sprite_duplicate sprite_assign sprite_merge sprite_add ' +
    +      'sprite_replace sprite_create_from_surface sprite_add_from_surface ' +
    +      'sprite_delete sprite_set_alpha_from_sprite sprite_collision_mask ' +
    +      'font_add_enable_aa font_add_get_enable_aa font_add font_add_sprite ' +
    +      'font_add_sprite_ext font_replace font_replace_sprite ' +
    +      'font_replace_sprite_ext font_delete path_set_kind path_set_closed ' +
    +      'path_set_precision path_add path_assign path_duplicate path_append ' +
    +      'path_delete path_add_point path_insert_point path_change_point ' +
    +      'path_delete_point path_clear_points path_reverse path_mirror ' +
    +      'path_flip path_rotate path_rescale path_shift script_execute ' +
    +      'object_set_sprite object_set_solid object_set_visible ' +
    +      'object_set_persistent object_set_mask room_set_width room_set_height ' +
    +      'room_set_persistent room_set_background_colour ' +
    +      'room_set_background_color room_set_view room_set_viewport ' +
    +      'room_get_viewport room_set_view_enabled room_add room_duplicate ' +
    +      'room_assign room_instance_add room_instance_clear room_get_camera ' +
    +      'room_set_camera asset_get_index asset_get_type ' +
    +      'file_text_open_from_string file_text_open_read file_text_open_write ' +
    +      'file_text_open_append file_text_close file_text_write_string ' +
    +      'file_text_write_real file_text_writeln file_text_read_string ' +
    +      'file_text_read_real file_text_readln file_text_eof file_text_eoln ' +
    +      'file_exists file_delete file_rename file_copy directory_exists ' +
    +      'directory_create directory_destroy file_find_first file_find_next ' +
    +      'file_find_close file_attributes filename_name filename_path ' +
    +      'filename_dir filename_drive filename_ext filename_change_ext ' +
    +      'file_bin_open file_bin_rewrite file_bin_close file_bin_position ' +
    +      'file_bin_size file_bin_seek file_bin_write_byte file_bin_read_byte ' +
    +      'parameter_count parameter_string environment_get_variable ' +
    +      'ini_open_from_string ini_open ini_close ini_read_string ' +
    +      'ini_read_real ini_write_string ini_write_real ini_key_exists ' +
    +      'ini_section_exists ini_key_delete ini_section_delete ' +
    +      'ds_set_precision ds_exists ds_stack_create ds_stack_destroy ' +
    +      'ds_stack_clear ds_stack_copy ds_stack_size ds_stack_empty ' +
    +      'ds_stack_push ds_stack_pop ds_stack_top ds_stack_write ds_stack_read ' +
    +      'ds_queue_create ds_queue_destroy ds_queue_clear ds_queue_copy ' +
    +      'ds_queue_size ds_queue_empty ds_queue_enqueue ds_queue_dequeue ' +
    +      'ds_queue_head ds_queue_tail ds_queue_write ds_queue_read ' +
    +      'ds_list_create ds_list_destroy ds_list_clear ds_list_copy ' +
    +      'ds_list_size ds_list_empty ds_list_add ds_list_insert ' +
    +      'ds_list_replace ds_list_delete ds_list_find_index ds_list_find_value ' +
    +      'ds_list_mark_as_list ds_list_mark_as_map ds_list_sort ' +
    +      'ds_list_shuffle ds_list_write ds_list_read ds_list_set ds_map_create ' +
    +      'ds_map_destroy ds_map_clear ds_map_copy ds_map_size ds_map_empty ' +
    +      'ds_map_add ds_map_add_list ds_map_add_map ds_map_replace ' +
    +      'ds_map_replace_map ds_map_replace_list ds_map_delete ds_map_exists ' +
    +      'ds_map_find_value ds_map_find_previous ds_map_find_next ' +
    +      'ds_map_find_first ds_map_find_last ds_map_write ds_map_read ' +
    +      'ds_map_secure_save ds_map_secure_load ds_map_secure_load_buffer ' +
    +      'ds_map_secure_save_buffer ds_map_set ds_priority_create ' +
    +      'ds_priority_destroy ds_priority_clear ds_priority_copy ' +
    +      'ds_priority_size ds_priority_empty ds_priority_add ' +
    +      'ds_priority_change_priority ds_priority_find_priority ' +
    +      'ds_priority_delete_value ds_priority_delete_min ds_priority_find_min ' +
    +      'ds_priority_delete_max ds_priority_find_max ds_priority_write ' +
    +      'ds_priority_read ds_grid_create ds_grid_destroy ds_grid_copy ' +
    +      'ds_grid_resize ds_grid_width ds_grid_height ds_grid_clear ' +
    +      'ds_grid_set ds_grid_add ds_grid_multiply ds_grid_set_region ' +
    +      'ds_grid_add_region ds_grid_multiply_region ds_grid_set_disk ' +
    +      'ds_grid_add_disk ds_grid_multiply_disk ds_grid_set_grid_region ' +
    +      'ds_grid_add_grid_region ds_grid_multiply_grid_region ds_grid_get ' +
    +      'ds_grid_get_sum ds_grid_get_max ds_grid_get_min ds_grid_get_mean ' +
    +      'ds_grid_get_disk_sum ds_grid_get_disk_min ds_grid_get_disk_max ' +
    +      'ds_grid_get_disk_mean ds_grid_value_exists ds_grid_value_x ' +
    +      'ds_grid_value_y ds_grid_value_disk_exists ds_grid_value_disk_x ' +
    +      'ds_grid_value_disk_y ds_grid_shuffle ds_grid_write ds_grid_read ' +
    +      'ds_grid_sort ds_grid_set ds_grid_get effect_create_below ' +
    +      'effect_create_above effect_clear part_type_create part_type_destroy ' +
    +      'part_type_exists part_type_clear part_type_shape part_type_sprite ' +
    +      'part_type_size part_type_scale part_type_orientation part_type_life ' +
    +      'part_type_step part_type_death part_type_speed part_type_direction ' +
    +      'part_type_gravity part_type_colour1 part_type_colour2 ' +
    +      'part_type_colour3 part_type_colour_mix part_type_colour_rgb ' +
    +      'part_type_colour_hsv part_type_color1 part_type_color2 ' +
    +      'part_type_color3 part_type_color_mix part_type_color_rgb ' +
    +      'part_type_color_hsv part_type_alpha1 part_type_alpha2 ' +
    +      'part_type_alpha3 part_type_blend part_system_create ' +
    +      'part_system_create_layer part_system_destroy part_system_exists ' +
    +      'part_system_clear part_system_draw_order part_system_depth ' +
    +      'part_system_position part_system_automatic_update ' +
    +      'part_system_automatic_draw part_system_update part_system_drawit ' +
    +      'part_system_get_layer part_system_layer part_particles_create ' +
    +      'part_particles_create_colour part_particles_create_color ' +
    +      'part_particles_clear part_particles_count part_emitter_create ' +
    +      'part_emitter_destroy part_emitter_destroy_all part_emitter_exists ' +
    +      'part_emitter_clear part_emitter_region part_emitter_burst ' +
    +      'part_emitter_stream external_call external_define external_free ' +
    +      'window_handle window_device matrix_get matrix_set ' +
    +      'matrix_build_identity matrix_build matrix_build_lookat ' +
    +      'matrix_build_projection_ortho matrix_build_projection_perspective ' +
    +      'matrix_build_projection_perspective_fov matrix_multiply ' +
    +      'matrix_transform_vertex matrix_stack_push matrix_stack_pop ' +
    +      'matrix_stack_multiply matrix_stack_set matrix_stack_clear ' +
    +      'matrix_stack_top matrix_stack_is_empty browser_input_capture ' +
    +      'os_get_config os_get_info os_get_language os_get_region ' +
    +      'os_lock_orientation display_get_dpi_x display_get_dpi_y ' +
    +      'display_set_gui_size display_set_gui_maximise ' +
    +      'display_set_gui_maximize device_mouse_dbclick_enable ' +
    +      'display_set_timing_method display_get_timing_method ' +
    +      'display_set_sleep_margin display_get_sleep_margin virtual_key_add ' +
    +      'virtual_key_hide virtual_key_delete virtual_key_show ' +
    +      'draw_enable_drawevent draw_enable_swf_aa draw_set_swf_aa_level ' +
    +      'draw_get_swf_aa_level draw_texture_flush draw_flush ' +
    +      'gpu_set_blendenable gpu_set_ztestenable gpu_set_zfunc ' +
    +      'gpu_set_zwriteenable gpu_set_lightingenable gpu_set_fog ' +
    +      'gpu_set_cullmode gpu_set_blendmode gpu_set_blendmode_ext ' +
    +      'gpu_set_blendmode_ext_sepalpha gpu_set_colorwriteenable ' +
    +      'gpu_set_colourwriteenable gpu_set_alphatestenable ' +
    +      'gpu_set_alphatestref gpu_set_alphatestfunc gpu_set_texfilter ' +
    +      'gpu_set_texfilter_ext gpu_set_texrepeat gpu_set_texrepeat_ext ' +
    +      'gpu_set_tex_filter gpu_set_tex_filter_ext gpu_set_tex_repeat ' +
    +      'gpu_set_tex_repeat_ext gpu_set_tex_mip_filter ' +
    +      'gpu_set_tex_mip_filter_ext gpu_set_tex_mip_bias ' +
    +      'gpu_set_tex_mip_bias_ext gpu_set_tex_min_mip gpu_set_tex_min_mip_ext ' +
    +      'gpu_set_tex_max_mip gpu_set_tex_max_mip_ext gpu_set_tex_max_aniso ' +
    +      'gpu_set_tex_max_aniso_ext gpu_set_tex_mip_enable ' +
    +      'gpu_set_tex_mip_enable_ext gpu_get_blendenable gpu_get_ztestenable ' +
    +      'gpu_get_zfunc gpu_get_zwriteenable gpu_get_lightingenable ' +
    +      'gpu_get_fog gpu_get_cullmode gpu_get_blendmode gpu_get_blendmode_ext ' +
    +      'gpu_get_blendmode_ext_sepalpha gpu_get_blendmode_src ' +
    +      'gpu_get_blendmode_dest gpu_get_blendmode_srcalpha ' +
    +      'gpu_get_blendmode_destalpha gpu_get_colorwriteenable ' +
    +      'gpu_get_colourwriteenable gpu_get_alphatestenable ' +
    +      'gpu_get_alphatestref gpu_get_alphatestfunc gpu_get_texfilter ' +
    +      'gpu_get_texfilter_ext gpu_get_texrepeat gpu_get_texrepeat_ext ' +
    +      'gpu_get_tex_filter gpu_get_tex_filter_ext gpu_get_tex_repeat ' +
    +      'gpu_get_tex_repeat_ext gpu_get_tex_mip_filter ' +
    +      'gpu_get_tex_mip_filter_ext gpu_get_tex_mip_bias ' +
    +      'gpu_get_tex_mip_bias_ext gpu_get_tex_min_mip gpu_get_tex_min_mip_ext ' +
    +      'gpu_get_tex_max_mip gpu_get_tex_max_mip_ext gpu_get_tex_max_aniso ' +
    +      'gpu_get_tex_max_aniso_ext gpu_get_tex_mip_enable ' +
    +      'gpu_get_tex_mip_enable_ext gpu_push_state gpu_pop_state ' +
    +      'gpu_get_state gpu_set_state draw_light_define_ambient ' +
    +      'draw_light_define_direction draw_light_define_point ' +
    +      'draw_light_enable draw_set_lighting draw_light_get_ambient ' +
    +      'draw_light_get draw_get_lighting shop_leave_rating url_get_domain ' +
    +      'url_open url_open_ext url_open_full get_timer achievement_login ' +
    +      'achievement_logout achievement_post achievement_increment ' +
    +      'achievement_post_score achievement_available ' +
    +      'achievement_show_achievements achievement_show_leaderboards ' +
    +      'achievement_load_friends achievement_load_leaderboard ' +
    +      'achievement_send_challenge achievement_load_progress ' +
    +      'achievement_reset achievement_login_status achievement_get_pic ' +
    +      'achievement_show_challenge_notifications achievement_get_challenges ' +
    +      'achievement_event achievement_show achievement_get_info ' +
    +      'cloud_file_save cloud_string_save cloud_synchronise ads_enable ' +
    +      'ads_disable ads_setup ads_engagement_launch ads_engagement_available ' +
    +      'ads_engagement_active ads_event ads_event_preload ' +
    +      'ads_set_reward_callback ads_get_display_height ads_get_display_width ' +
    +      'ads_move ads_interstitial_available ads_interstitial_display ' +
    +      'device_get_tilt_x device_get_tilt_y device_get_tilt_z ' +
    +      'device_is_keypad_open device_mouse_check_button ' +
    +      'device_mouse_check_button_pressed device_mouse_check_button_released ' +
    +      'device_mouse_x device_mouse_y device_mouse_raw_x device_mouse_raw_y ' +
    +      'device_mouse_x_to_gui device_mouse_y_to_gui iap_activate iap_status ' +
    +      'iap_enumerate_products iap_restore_all iap_acquire iap_consume ' +
    +      'iap_product_details iap_purchase_details facebook_init ' +
    +      'facebook_login facebook_status facebook_graph_request ' +
    +      'facebook_dialog facebook_logout facebook_launch_offerwall ' +
    +      'facebook_post_message facebook_send_invite facebook_user_id ' +
    +      'facebook_accesstoken facebook_check_permission ' +
    +      'facebook_request_read_permissions ' +
    +      'facebook_request_publish_permissions gamepad_is_supported ' +
    +      'gamepad_get_device_count gamepad_is_connected ' +
    +      'gamepad_get_description gamepad_get_button_threshold ' +
    +      'gamepad_set_button_threshold gamepad_get_axis_deadzone ' +
    +      'gamepad_set_axis_deadzone gamepad_button_count gamepad_button_check ' +
    +      'gamepad_button_check_pressed gamepad_button_check_released ' +
    +      'gamepad_button_value gamepad_axis_count gamepad_axis_value ' +
    +      'gamepad_set_vibration gamepad_set_colour gamepad_set_color ' +
    +      'os_is_paused window_has_focus code_is_compiled http_get ' +
    +      'http_get_file http_post_string http_request json_encode json_decode ' +
    +      'zip_unzip load_csv base64_encode base64_decode md5_string_unicode ' +
    +      'md5_string_utf8 md5_file os_is_network_connected sha1_string_unicode ' +
    +      'sha1_string_utf8 sha1_file os_powersave_enable analytics_event ' +
    +      'analytics_event_ext win8_livetile_tile_notification ' +
    +      'win8_livetile_tile_clear win8_livetile_badge_notification ' +
    +      'win8_livetile_badge_clear win8_livetile_queue_enable ' +
    +      'win8_secondarytile_pin win8_secondarytile_badge_notification ' +
    +      'win8_secondarytile_delete win8_livetile_notification_begin ' +
    +      'win8_livetile_notification_secondary_begin ' +
    +      'win8_livetile_notification_expiry win8_livetile_notification_tag ' +
    +      'win8_livetile_notification_text_add ' +
    +      'win8_livetile_notification_image_add win8_livetile_notification_end ' +
    +      'win8_appbar_enable win8_appbar_add_element ' +
    +      'win8_appbar_remove_element win8_settingscharm_add_entry ' +
    +      'win8_settingscharm_add_html_entry win8_settingscharm_add_xaml_entry ' +
    +      'win8_settingscharm_set_xaml_property ' +
    +      'win8_settingscharm_get_xaml_property win8_settingscharm_remove_entry ' +
    +      'win8_share_image win8_share_screenshot win8_share_file ' +
    +      'win8_share_url win8_share_text win8_search_enable ' +
    +      'win8_search_disable win8_search_add_suggestions ' +
    +      'win8_device_touchscreen_available win8_license_initialize_sandbox ' +
    +      'win8_license_trial_version winphone_license_trial_version ' +
    +      'winphone_tile_title winphone_tile_count winphone_tile_back_title ' +
    +      'winphone_tile_back_content winphone_tile_back_content_wide ' +
    +      'winphone_tile_front_image winphone_tile_front_image_small ' +
    +      'winphone_tile_front_image_wide winphone_tile_back_image ' +
    +      'winphone_tile_back_image_wide winphone_tile_background_colour ' +
    +      'winphone_tile_background_color winphone_tile_icon_image ' +
    +      'winphone_tile_small_icon_image winphone_tile_wide_content ' +
    +      'winphone_tile_cycle_images winphone_tile_small_background_image ' +
    +      'physics_world_create physics_world_gravity ' +
    +      'physics_world_update_speed physics_world_update_iterations ' +
    +      'physics_world_draw_debug physics_pause_enable physics_fixture_create ' +
    +      'physics_fixture_set_kinematic physics_fixture_set_density ' +
    +      'physics_fixture_set_awake physics_fixture_set_restitution ' +
    +      'physics_fixture_set_friction physics_fixture_set_collision_group ' +
    +      'physics_fixture_set_sensor physics_fixture_set_linear_damping ' +
    +      'physics_fixture_set_angular_damping physics_fixture_set_circle_shape ' +
    +      'physics_fixture_set_box_shape physics_fixture_set_edge_shape ' +
    +      'physics_fixture_set_polygon_shape physics_fixture_set_chain_shape ' +
    +      'physics_fixture_add_point physics_fixture_bind ' +
    +      'physics_fixture_bind_ext physics_fixture_delete physics_apply_force ' +
    +      'physics_apply_impulse physics_apply_angular_impulse ' +
    +      'physics_apply_local_force physics_apply_local_impulse ' +
    +      'physics_apply_torque physics_mass_properties physics_draw_debug ' +
    +      'physics_test_overlap physics_remove_fixture physics_set_friction ' +
    +      'physics_set_density physics_set_restitution physics_get_friction ' +
    +      'physics_get_density physics_get_restitution ' +
    +      'physics_joint_distance_create physics_joint_rope_create ' +
    +      'physics_joint_revolute_create physics_joint_prismatic_create ' +
    +      'physics_joint_pulley_create physics_joint_wheel_create ' +
    +      'physics_joint_weld_create physics_joint_friction_create ' +
    +      'physics_joint_gear_create physics_joint_enable_motor ' +
    +      'physics_joint_get_value physics_joint_set_value physics_joint_delete ' +
    +      'physics_particle_create physics_particle_delete ' +
    +      'physics_particle_delete_region_circle ' +
    +      'physics_particle_delete_region_box ' +
    +      'physics_particle_delete_region_poly physics_particle_set_flags ' +
    +      'physics_particle_set_category_flags physics_particle_draw ' +
    +      'physics_particle_draw_ext physics_particle_count ' +
    +      'physics_particle_get_data physics_particle_get_data_particle ' +
    +      'physics_particle_group_begin physics_particle_group_circle ' +
    +      'physics_particle_group_box physics_particle_group_polygon ' +
    +      'physics_particle_group_add_point physics_particle_group_end ' +
    +      'physics_particle_group_join physics_particle_group_delete ' +
    +      'physics_particle_group_count physics_particle_group_get_data ' +
    +      'physics_particle_group_get_mass physics_particle_group_get_inertia ' +
    +      'physics_particle_group_get_centre_x ' +
    +      'physics_particle_group_get_centre_y physics_particle_group_get_vel_x ' +
    +      'physics_particle_group_get_vel_y physics_particle_group_get_ang_vel ' +
    +      'physics_particle_group_get_x physics_particle_group_get_y ' +
    +      'physics_particle_group_get_angle physics_particle_set_group_flags ' +
    +      'physics_particle_get_group_flags physics_particle_get_max_count ' +
    +      'physics_particle_get_radius physics_particle_get_density ' +
    +      'physics_particle_get_damping physics_particle_get_gravity_scale ' +
    +      'physics_particle_set_max_count physics_particle_set_radius ' +
    +      'physics_particle_set_density physics_particle_set_damping ' +
    +      'physics_particle_set_gravity_scale network_create_socket ' +
    +      'network_create_socket_ext network_create_server ' +
    +      'network_create_server_raw network_connect network_connect_raw ' +
    +      'network_send_packet network_send_raw network_send_broadcast ' +
    +      'network_send_udp network_send_udp_raw network_set_timeout ' +
    +      'network_set_config network_resolve network_destroy buffer_create ' +
    +      'buffer_write buffer_read buffer_seek buffer_get_surface ' +
    +      'buffer_set_surface buffer_delete buffer_exists buffer_get_type ' +
    +      'buffer_get_alignment buffer_poke buffer_peek buffer_save ' +
    +      'buffer_save_ext buffer_load buffer_load_ext buffer_load_partial ' +
    +      'buffer_copy buffer_fill buffer_get_size buffer_tell buffer_resize ' +
    +      'buffer_md5 buffer_sha1 buffer_base64_encode buffer_base64_decode ' +
    +      'buffer_base64_decode_ext buffer_sizeof buffer_get_address ' +
    +      'buffer_create_from_vertex_buffer ' +
    +      'buffer_create_from_vertex_buffer_ext buffer_copy_from_vertex_buffer ' +
    +      'buffer_async_group_begin buffer_async_group_option ' +
    +      'buffer_async_group_end buffer_load_async buffer_save_async ' +
    +      'gml_release_mode gml_pragma steam_activate_overlay ' +
    +      'steam_is_overlay_enabled steam_is_overlay_activated ' +
    +      'steam_get_persona_name steam_initialised ' +
    +      'steam_is_cloud_enabled_for_app steam_is_cloud_enabled_for_account ' +
    +      'steam_file_persisted steam_get_quota_total steam_get_quota_free ' +
    +      'steam_file_write steam_file_write_file steam_file_read ' +
    +      'steam_file_delete steam_file_exists steam_file_size steam_file_share ' +
    +      'steam_is_screenshot_requested steam_send_screenshot ' +
    +      'steam_is_user_logged_on steam_get_user_steam_id steam_user_owns_dlc ' +
    +      'steam_user_installed_dlc steam_set_achievement steam_get_achievement ' +
    +      'steam_clear_achievement steam_set_stat_int steam_set_stat_float ' +
    +      'steam_set_stat_avg_rate steam_get_stat_int steam_get_stat_float ' +
    +      'steam_get_stat_avg_rate steam_reset_all_stats ' +
    +      'steam_reset_all_stats_achievements steam_stats_ready ' +
    +      'steam_create_leaderboard steam_upload_score steam_upload_score_ext ' +
    +      'steam_download_scores_around_user steam_download_scores ' +
    +      'steam_download_friends_scores steam_upload_score_buffer ' +
    +      'steam_upload_score_buffer_ext steam_current_game_language ' +
    +      'steam_available_languages steam_activate_overlay_browser ' +
    +      'steam_activate_overlay_user steam_activate_overlay_store ' +
    +      'steam_get_user_persona_name steam_get_app_id ' +
    +      'steam_get_user_account_id steam_ugc_download steam_ugc_create_item ' +
    +      'steam_ugc_start_item_update steam_ugc_set_item_title ' +
    +      'steam_ugc_set_item_description steam_ugc_set_item_visibility ' +
    +      'steam_ugc_set_item_tags steam_ugc_set_item_content ' +
    +      'steam_ugc_set_item_preview steam_ugc_submit_item_update ' +
    +      'steam_ugc_get_item_update_progress steam_ugc_subscribe_item ' +
    +      'steam_ugc_unsubscribe_item steam_ugc_num_subscribed_items ' +
    +      'steam_ugc_get_subscribed_items steam_ugc_get_item_install_info ' +
    +      'steam_ugc_get_item_update_info steam_ugc_request_item_details ' +
    +      'steam_ugc_create_query_user steam_ugc_create_query_user_ex ' +
    +      'steam_ugc_create_query_all steam_ugc_create_query_all_ex ' +
    +      'steam_ugc_query_set_cloud_filename_filter ' +
    +      'steam_ugc_query_set_match_any_tag steam_ugc_query_set_search_text ' +
    +      'steam_ugc_query_set_ranked_by_trend_days ' +
    +      'steam_ugc_query_add_required_tag steam_ugc_query_add_excluded_tag ' +
    +      'steam_ugc_query_set_return_long_description ' +
    +      'steam_ugc_query_set_return_total_only ' +
    +      'steam_ugc_query_set_allow_cached_response steam_ugc_send_query ' +
    +      'shader_set shader_get_name shader_reset shader_current ' +
    +      'shader_is_compiled shader_get_sampler_index shader_get_uniform ' +
    +      'shader_set_uniform_i shader_set_uniform_i_array shader_set_uniform_f ' +
    +      'shader_set_uniform_f_array shader_set_uniform_matrix ' +
    +      'shader_set_uniform_matrix_array shader_enable_corner_id ' +
    +      'texture_set_stage texture_get_texel_width texture_get_texel_height ' +
    +      'shaders_are_supported vertex_format_begin vertex_format_end ' +
    +      'vertex_format_delete vertex_format_add_position ' +
    +      'vertex_format_add_position_3d vertex_format_add_colour ' +
    +      'vertex_format_add_color vertex_format_add_normal ' +
    +      'vertex_format_add_texcoord vertex_format_add_textcoord ' +
    +      'vertex_format_add_custom vertex_create_buffer ' +
    +      'vertex_create_buffer_ext vertex_delete_buffer vertex_begin ' +
    +      'vertex_end vertex_position vertex_position_3d vertex_colour ' +
    +      'vertex_color vertex_argb vertex_texcoord vertex_normal vertex_float1 ' +
    +      'vertex_float2 vertex_float3 vertex_float4 vertex_ubyte4 ' +
    +      'vertex_submit vertex_freeze vertex_get_number vertex_get_buffer_size ' +
    +      'vertex_create_buffer_from_buffer ' +
    +      'vertex_create_buffer_from_buffer_ext push_local_notification ' +
    +      'push_get_first_local_notification push_get_next_local_notification ' +
    +      'push_cancel_local_notification skeleton_animation_set ' +
    +      'skeleton_animation_get skeleton_animation_mix ' +
    +      'skeleton_animation_set_ext skeleton_animation_get_ext ' +
    +      'skeleton_animation_get_duration skeleton_animation_get_frames ' +
    +      'skeleton_animation_clear skeleton_skin_set skeleton_skin_get ' +
    +      'skeleton_attachment_set skeleton_attachment_get ' +
    +      'skeleton_attachment_create skeleton_collision_draw_set ' +
    +      'skeleton_bone_data_get skeleton_bone_data_set ' +
    +      'skeleton_bone_state_get skeleton_bone_state_set skeleton_get_minmax ' +
    +      'skeleton_get_num_bounds skeleton_get_bounds ' +
    +      'skeleton_animation_get_frame skeleton_animation_set_frame ' +
    +      'draw_skeleton draw_skeleton_time draw_skeleton_instance ' +
    +      'draw_skeleton_collision skeleton_animation_list skeleton_skin_list ' +
    +      'skeleton_slot_data layer_get_id layer_get_id_at_depth ' +
    +      'layer_get_depth layer_create layer_destroy layer_destroy_instances ' +
    +      'layer_add_instance layer_has_instance layer_set_visible ' +
    +      'layer_get_visible layer_exists layer_x layer_y layer_get_x ' +
    +      'layer_get_y layer_hspeed layer_vspeed layer_get_hspeed ' +
    +      'layer_get_vspeed layer_script_begin layer_script_end layer_shader ' +
    +      'layer_get_script_begin layer_get_script_end layer_get_shader ' +
    +      'layer_set_target_room layer_get_target_room layer_reset_target_room ' +
    +      'layer_get_all layer_get_all_elements layer_get_name layer_depth ' +
    +      'layer_get_element_layer layer_get_element_type layer_element_move ' +
    +      'layer_force_draw_depth layer_is_draw_depth_forced ' +
    +      'layer_get_forced_depth layer_background_get_id ' +
    +      'layer_background_exists layer_background_create ' +
    +      'layer_background_destroy layer_background_visible ' +
    +      'layer_background_change layer_background_sprite ' +
    +      'layer_background_htiled layer_background_vtiled ' +
    +      'layer_background_stretch layer_background_yscale ' +
    +      'layer_background_xscale layer_background_blend ' +
    +      'layer_background_alpha layer_background_index layer_background_speed ' +
    +      'layer_background_get_visible layer_background_get_sprite ' +
    +      'layer_background_get_htiled layer_background_get_vtiled ' +
    +      'layer_background_get_stretch layer_background_get_yscale ' +
    +      'layer_background_get_xscale layer_background_get_blend ' +
    +      'layer_background_get_alpha layer_background_get_index ' +
    +      'layer_background_get_speed layer_sprite_get_id layer_sprite_exists ' +
    +      'layer_sprite_create layer_sprite_destroy layer_sprite_change ' +
    +      'layer_sprite_index layer_sprite_speed layer_sprite_xscale ' +
    +      'layer_sprite_yscale layer_sprite_angle layer_sprite_blend ' +
    +      'layer_sprite_alpha layer_sprite_x layer_sprite_y ' +
    +      'layer_sprite_get_sprite layer_sprite_get_index ' +
    +      'layer_sprite_get_speed layer_sprite_get_xscale ' +
    +      'layer_sprite_get_yscale layer_sprite_get_angle ' +
    +      'layer_sprite_get_blend layer_sprite_get_alpha layer_sprite_get_x ' +
    +      'layer_sprite_get_y layer_tilemap_get_id layer_tilemap_exists ' +
    +      'layer_tilemap_create layer_tilemap_destroy tilemap_tileset tilemap_x ' +
    +      'tilemap_y tilemap_set tilemap_set_at_pixel tilemap_get_tileset ' +
    +      'tilemap_get_tile_width tilemap_get_tile_height tilemap_get_width ' +
    +      'tilemap_get_height tilemap_get_x tilemap_get_y tilemap_get ' +
    +      'tilemap_get_at_pixel tilemap_get_cell_x_at_pixel ' +
    +      'tilemap_get_cell_y_at_pixel tilemap_clear draw_tilemap draw_tile ' +
    +      'tilemap_set_global_mask tilemap_get_global_mask tilemap_set_mask ' +
    +      'tilemap_get_mask tilemap_get_frame tile_set_empty tile_set_index ' +
    +      'tile_set_flip tile_set_mirror tile_set_rotate tile_get_empty ' +
    +      'tile_get_index tile_get_flip tile_get_mirror tile_get_rotate ' +
    +      'layer_tile_exists layer_tile_create layer_tile_destroy ' +
    +      'layer_tile_change layer_tile_xscale layer_tile_yscale ' +
    +      'layer_tile_blend layer_tile_alpha layer_tile_x layer_tile_y ' +
    +      'layer_tile_region layer_tile_visible layer_tile_get_sprite ' +
    +      'layer_tile_get_xscale layer_tile_get_yscale layer_tile_get_blend ' +
    +      'layer_tile_get_alpha layer_tile_get_x layer_tile_get_y ' +
    +      'layer_tile_get_region layer_tile_get_visible ' +
    +      'layer_instance_get_instance instance_activate_layer ' +
    +      'instance_deactivate_layer camera_create camera_create_view ' +
    +      'camera_destroy camera_apply camera_get_active camera_get_default ' +
    +      'camera_set_default camera_set_view_mat camera_set_proj_mat ' +
    +      'camera_set_update_script camera_set_begin_script ' +
    +      'camera_set_end_script camera_set_view_pos camera_set_view_size ' +
    +      'camera_set_view_speed camera_set_view_border camera_set_view_angle ' +
    +      'camera_set_view_target camera_get_view_mat camera_get_proj_mat ' +
    +      'camera_get_update_script camera_get_begin_script ' +
    +      'camera_get_end_script camera_get_view_x camera_get_view_y ' +
    +      'camera_get_view_width camera_get_view_height camera_get_view_speed_x ' +
    +      'camera_get_view_speed_y camera_get_view_border_x ' +
    +      'camera_get_view_border_y camera_get_view_angle ' +
    +      'camera_get_view_target view_get_camera view_get_visible ' +
    +      'view_get_xport view_get_yport view_get_wport view_get_hport ' +
    +      'view_get_surface_id view_set_camera view_set_visible view_set_xport ' +
    +      'view_set_yport view_set_wport view_set_hport view_set_surface_id ' +
    +      'gesture_drag_time gesture_drag_distance gesture_flick_speed ' +
    +      'gesture_double_tap_time gesture_double_tap_distance ' +
    +      'gesture_pinch_distance gesture_pinch_angle_towards ' +
    +      'gesture_pinch_angle_away gesture_rotate_time gesture_rotate_angle ' +
    +      'gesture_tap_count gesture_get_drag_time gesture_get_drag_distance ' +
    +      'gesture_get_flick_speed gesture_get_double_tap_time ' +
    +      'gesture_get_double_tap_distance gesture_get_pinch_distance ' +
    +      'gesture_get_pinch_angle_towards gesture_get_pinch_angle_away ' +
    +      'gesture_get_rotate_time gesture_get_rotate_angle ' +
    +      'gesture_get_tap_count keyboard_virtual_show keyboard_virtual_hide ' +
    +      'keyboard_virtual_status keyboard_virtual_height',
    +    literal: 'self other all noone global local undefined pointer_invalid ' +
    +      'pointer_null path_action_stop path_action_restart ' +
    +      'path_action_continue path_action_reverse true false pi GM_build_date ' +
    +      'GM_version GM_runtime_version  timezone_local timezone_utc ' +
    +      'gamespeed_fps gamespeed_microseconds  ev_create ev_destroy ev_step ' +
    +      'ev_alarm ev_keyboard ev_mouse ev_collision ev_other ev_draw ' +
    +      'ev_draw_begin ev_draw_end ev_draw_pre ev_draw_post ev_keypress ' +
    +      'ev_keyrelease ev_trigger ev_left_button ev_right_button ' +
    +      'ev_middle_button ev_no_button ev_left_press ev_right_press ' +
    +      'ev_middle_press ev_left_release ev_right_release ev_middle_release ' +
    +      'ev_mouse_enter ev_mouse_leave ev_mouse_wheel_up ev_mouse_wheel_down ' +
    +      'ev_global_left_button ev_global_right_button ev_global_middle_button ' +
    +      'ev_global_left_press ev_global_right_press ev_global_middle_press ' +
    +      'ev_global_left_release ev_global_right_release ' +
    +      'ev_global_middle_release ev_joystick1_left ev_joystick1_right ' +
    +      'ev_joystick1_up ev_joystick1_down ev_joystick1_button1 ' +
    +      'ev_joystick1_button2 ev_joystick1_button3 ev_joystick1_button4 ' +
    +      'ev_joystick1_button5 ev_joystick1_button6 ev_joystick1_button7 ' +
    +      'ev_joystick1_button8 ev_joystick2_left ev_joystick2_right ' +
    +      'ev_joystick2_up ev_joystick2_down ev_joystick2_button1 ' +
    +      'ev_joystick2_button2 ev_joystick2_button3 ev_joystick2_button4 ' +
    +      'ev_joystick2_button5 ev_joystick2_button6 ev_joystick2_button7 ' +
    +      'ev_joystick2_button8 ev_outside ev_boundary ev_game_start ' +
    +      'ev_game_end ev_room_start ev_room_end ev_no_more_lives ' +
    +      'ev_animation_end ev_end_of_path ev_no_more_health ev_close_button ' +
    +      'ev_user0 ev_user1 ev_user2 ev_user3 ev_user4 ev_user5 ev_user6 ' +
    +      'ev_user7 ev_user8 ev_user9 ev_user10 ev_user11 ev_user12 ev_user13 ' +
    +      'ev_user14 ev_user15 ev_step_normal ev_step_begin ev_step_end ev_gui ' +
    +      'ev_gui_begin ev_gui_end ev_cleanup ev_gesture ev_gesture_tap ' +
    +      'ev_gesture_double_tap ev_gesture_drag_start ev_gesture_dragging ' +
    +      'ev_gesture_drag_end ev_gesture_flick ev_gesture_pinch_start ' +
    +      'ev_gesture_pinch_in ev_gesture_pinch_out ev_gesture_pinch_end ' +
    +      'ev_gesture_rotate_start ev_gesture_rotating ev_gesture_rotate_end ' +
    +      'ev_global_gesture_tap ev_global_gesture_double_tap ' +
    +      'ev_global_gesture_drag_start ev_global_gesture_dragging ' +
    +      'ev_global_gesture_drag_end ev_global_gesture_flick ' +
    +      'ev_global_gesture_pinch_start ev_global_gesture_pinch_in ' +
    +      'ev_global_gesture_pinch_out ev_global_gesture_pinch_end ' +
    +      'ev_global_gesture_rotate_start ev_global_gesture_rotating ' +
    +      'ev_global_gesture_rotate_end vk_nokey vk_anykey vk_enter vk_return ' +
    +      'vk_shift vk_control vk_alt vk_escape vk_space vk_backspace vk_tab ' +
    +      'vk_pause vk_printscreen vk_left vk_right vk_up vk_down vk_home ' +
    +      'vk_end vk_delete vk_insert vk_pageup vk_pagedown vk_f1 vk_f2 vk_f3 ' +
    +      'vk_f4 vk_f5 vk_f6 vk_f7 vk_f8 vk_f9 vk_f10 vk_f11 vk_f12 vk_numpad0 ' +
    +      'vk_numpad1 vk_numpad2 vk_numpad3 vk_numpad4 vk_numpad5 vk_numpad6 ' +
    +      'vk_numpad7 vk_numpad8 vk_numpad9 vk_divide vk_multiply vk_subtract ' +
    +      'vk_add vk_decimal vk_lshift vk_lcontrol vk_lalt vk_rshift ' +
    +      'vk_rcontrol vk_ralt  mb_any mb_none mb_left mb_right mb_middle ' +
    +      'c_aqua c_black c_blue c_dkgray c_fuchsia c_gray c_green c_lime ' +
    +      'c_ltgray c_maroon c_navy c_olive c_purple c_red c_silver c_teal ' +
    +      'c_white c_yellow c_orange fa_left fa_center fa_right fa_top ' +
    +      'fa_middle fa_bottom pr_pointlist pr_linelist pr_linestrip ' +
    +      'pr_trianglelist pr_trianglestrip pr_trianglefan bm_complex bm_normal ' +
    +      'bm_add bm_max bm_subtract bm_zero bm_one bm_src_colour ' +
    +      'bm_inv_src_colour bm_src_color bm_inv_src_color bm_src_alpha ' +
    +      'bm_inv_src_alpha bm_dest_alpha bm_inv_dest_alpha bm_dest_colour ' +
    +      'bm_inv_dest_colour bm_dest_color bm_inv_dest_color bm_src_alpha_sat ' +
    +      'tf_point tf_linear tf_anisotropic mip_off mip_on mip_markedonly ' +
    +      'audio_falloff_none audio_falloff_inverse_distance ' +
    +      'audio_falloff_inverse_distance_clamped audio_falloff_linear_distance ' +
    +      'audio_falloff_linear_distance_clamped ' +
    +      'audio_falloff_exponent_distance ' +
    +      'audio_falloff_exponent_distance_clamped audio_old_system ' +
    +      'audio_new_system audio_mono audio_stereo audio_3d cr_default cr_none ' +
    +      'cr_arrow cr_cross cr_beam cr_size_nesw cr_size_ns cr_size_nwse ' +
    +      'cr_size_we cr_uparrow cr_hourglass cr_drag cr_appstart cr_handpoint ' +
    +      'cr_size_all spritespeed_framespersecond ' +
    +      'spritespeed_framespergameframe asset_object asset_unknown ' +
    +      'asset_sprite asset_sound asset_room asset_path asset_script ' +
    +      'asset_font asset_timeline asset_tiles asset_shader fa_readonly ' +
    +      'fa_hidden fa_sysfile fa_volumeid fa_directory fa_archive  ' +
    +      'ds_type_map ds_type_list ds_type_stack ds_type_queue ds_type_grid ' +
    +      'ds_type_priority ef_explosion ef_ring ef_ellipse ef_firework ' +
    +      'ef_smoke ef_smokeup ef_star ef_spark ef_flare ef_cloud ef_rain ' +
    +      'ef_snow pt_shape_pixel pt_shape_disk pt_shape_square pt_shape_line ' +
    +      'pt_shape_star pt_shape_circle pt_shape_ring pt_shape_sphere ' +
    +      'pt_shape_flare pt_shape_spark pt_shape_explosion pt_shape_cloud ' +
    +      'pt_shape_smoke pt_shape_snow ps_distr_linear ps_distr_gaussian ' +
    +      'ps_distr_invgaussian ps_shape_rectangle ps_shape_ellipse ' +
    +      'ps_shape_diamond ps_shape_line ty_real ty_string dll_cdecl ' +
    +      'dll_stdcall matrix_view matrix_projection matrix_world os_win32 ' +
    +      'os_windows os_macosx os_ios os_android os_symbian os_linux ' +
    +      'os_unknown os_winphone os_tizen os_win8native ' +
    +      'os_wiiu os_3ds  os_psvita os_bb10 os_ps4 os_xboxone ' +
    +      'os_ps3 os_xbox360 os_uwp os_tvos os_switch ' +
    +      'browser_not_a_browser browser_unknown browser_ie browser_firefox ' +
    +      'browser_chrome browser_safari browser_safari_mobile browser_opera ' +
    +      'browser_tizen browser_edge browser_windows_store browser_ie_mobile  ' +
    +      'device_ios_unknown device_ios_iphone device_ios_iphone_retina ' +
    +      'device_ios_ipad device_ios_ipad_retina device_ios_iphone5 ' +
    +      'device_ios_iphone6 device_ios_iphone6plus device_emulator ' +
    +      'device_tablet display_landscape display_landscape_flipped ' +
    +      'display_portrait display_portrait_flipped tm_sleep tm_countvsyncs ' +
    +      'of_challenge_win of_challen ge_lose of_challenge_tie ' +
    +      'leaderboard_type_number leaderboard_type_time_mins_secs ' +
    +      'cmpfunc_never cmpfunc_less cmpfunc_equal cmpfunc_lessequal ' +
    +      'cmpfunc_greater cmpfunc_notequal cmpfunc_greaterequal cmpfunc_always ' +
    +      'cull_noculling cull_clockwise cull_counterclockwise lighttype_dir ' +
    +      'lighttype_point iap_ev_storeload iap_ev_product iap_ev_purchase ' +
    +      'iap_ev_consume iap_ev_restore iap_storeload_ok iap_storeload_failed ' +
    +      'iap_status_uninitialised iap_status_unavailable iap_status_loading ' +
    +      'iap_status_available iap_status_processing iap_status_restoring ' +
    +      'iap_failed iap_unavailable iap_available iap_purchased iap_canceled ' +
    +      'iap_refunded fb_login_default fb_login_fallback_to_webview ' +
    +      'fb_login_no_fallback_to_webview fb_login_forcing_webview ' +
    +      'fb_login_use_system_account fb_login_forcing_safari  ' +
    +      'phy_joint_anchor_1_x phy_joint_anchor_1_y phy_joint_anchor_2_x ' +
    +      'phy_joint_anchor_2_y phy_joint_reaction_force_x ' +
    +      'phy_joint_reaction_force_y phy_joint_reaction_torque ' +
    +      'phy_joint_motor_speed phy_joint_angle phy_joint_motor_torque ' +
    +      'phy_joint_max_motor_torque phy_joint_translation phy_joint_speed ' +
    +      'phy_joint_motor_force phy_joint_max_motor_force phy_joint_length_1 ' +
    +      'phy_joint_length_2 phy_joint_damping_ratio phy_joint_frequency ' +
    +      'phy_joint_lower_angle_limit phy_joint_upper_angle_limit ' +
    +      'phy_joint_angle_limits phy_joint_max_length phy_joint_max_torque ' +
    +      'phy_joint_max_force phy_debug_render_aabb ' +
    +      'phy_debug_render_collision_pairs phy_debug_render_coms ' +
    +      'phy_debug_render_core_shapes phy_debug_render_joints ' +
    +      'phy_debug_render_obb phy_debug_render_shapes  ' +
    +      'phy_particle_flag_water phy_particle_flag_zombie ' +
    +      'phy_particle_flag_wall phy_particle_flag_spring ' +
    +      'phy_particle_flag_elastic phy_particle_flag_viscous ' +
    +      'phy_particle_flag_powder phy_particle_flag_tensile ' +
    +      'phy_particle_flag_colourmixing phy_particle_flag_colormixing ' +
    +      'phy_particle_group_flag_solid phy_particle_group_flag_rigid ' +
    +      'phy_particle_data_flag_typeflags phy_particle_data_flag_position ' +
    +      'phy_particle_data_flag_velocity phy_particle_data_flag_colour ' +
    +      'phy_particle_data_flag_color phy_particle_data_flag_category  ' +
    +      'achievement_our_info achievement_friends_info ' +
    +      'achievement_leaderboard_info achievement_achievement_info ' +
    +      'achievement_filter_all_players achievement_filter_friends_only ' +
    +      'achievement_filter_favorites_only ' +
    +      'achievement_type_achievement_challenge ' +
    +      'achievement_type_score_challenge achievement_pic_loaded  ' +
    +      'achievement_show_ui achievement_show_profile ' +
    +      'achievement_show_leaderboard achievement_show_achievement ' +
    +      'achievement_show_bank achievement_show_friend_picker ' +
    +      'achievement_show_purchase_prompt network_socket_tcp ' +
    +      'network_socket_udp network_socket_bluetooth network_type_connect ' +
    +      'network_type_disconnect network_type_data ' +
    +      'network_type_non_blocking_connect network_config_connect_timeout ' +
    +      'network_config_use_non_blocking_socket ' +
    +      'network_config_enable_reliable_udp ' +
    +      'network_config_disable_reliable_udp buffer_fixed buffer_grow ' +
    +      'buffer_wrap buffer_fast buffer_vbuffer buffer_network buffer_u8 ' +
    +      'buffer_s8 buffer_u16 buffer_s16 buffer_u32 buffer_s32 buffer_u64 ' +
    +      'buffer_f16 buffer_f32 buffer_f64 buffer_bool buffer_text ' +
    +      'buffer_string buffer_surface_copy buffer_seek_start ' +
    +      'buffer_seek_relative buffer_seek_end ' +
    +      'buffer_generalerror buffer_outofspace buffer_outofbounds ' +
    +      'buffer_invalidtype  text_type button_type input_type ANSI_CHARSET ' +
    +      'DEFAULT_CHARSET EASTEUROPE_CHARSET RUSSIAN_CHARSET SYMBOL_CHARSET ' +
    +      'SHIFTJIS_CHARSET HANGEUL_CHARSET GB2312_CHARSET CHINESEBIG5_CHARSET ' +
    +      'JOHAB_CHARSET HEBREW_CHARSET ARABIC_CHARSET GREEK_CHARSET ' +
    +      'TURKISH_CHARSET VIETNAMESE_CHARSET THAI_CHARSET MAC_CHARSET ' +
    +      'BALTIC_CHARSET OEM_CHARSET  gp_face1 gp_face2 gp_face3 gp_face4 ' +
    +      'gp_shoulderl gp_shoulderr gp_shoulderlb gp_shoulderrb gp_select ' +
    +      'gp_start gp_stickl gp_stickr gp_padu gp_padd gp_padl gp_padr ' +
    +      'gp_axislh gp_axislv gp_axisrh gp_axisrv ov_friends ov_community ' +
    +      'ov_players ov_settings ov_gamegroup ov_achievements lb_sort_none ' +
    +      'lb_sort_ascending lb_sort_descending lb_disp_none lb_disp_numeric ' +
    +      'lb_disp_time_sec lb_disp_time_ms ugc_result_success ' +
    +      'ugc_filetype_community ugc_filetype_microtrans ugc_visibility_public ' +
    +      'ugc_visibility_friends_only ugc_visibility_private ' +
    +      'ugc_query_RankedByVote ugc_query_RankedByPublicationDate ' +
    +      'ugc_query_AcceptedForGameRankedByAcceptanceDate ' +
    +      'ugc_query_RankedByTrend ' +
    +      'ugc_query_FavoritedByFriendsRankedByPublicationDate ' +
    +      'ugc_query_CreatedByFriendsRankedByPublicationDate ' +
    +      'ugc_query_RankedByNumTimesReported ' +
    +      'ugc_query_CreatedByFollowedUsersRankedByPublicationDate ' +
    +      'ugc_query_NotYetRated ugc_query_RankedByTotalVotesAsc ' +
    +      'ugc_query_RankedByVotesUp ugc_query_RankedByTextSearch ' +
    +      'ugc_sortorder_CreationOrderDesc ugc_sortorder_CreationOrderAsc ' +
    +      'ugc_sortorder_TitleAsc ugc_sortorder_LastUpdatedDesc ' +
    +      'ugc_sortorder_SubscriptionDateDesc ugc_sortorder_VoteScoreDesc ' +
    +      'ugc_sortorder_ForModeration ugc_list_Published ugc_list_VotedOn ' +
    +      'ugc_list_VotedUp ugc_list_VotedDown ugc_list_WillVoteLater ' +
    +      'ugc_list_Favorited ugc_list_Subscribed ugc_list_UsedOrPlayed ' +
    +      'ugc_list_Followed ugc_match_Items ugc_match_Items_Mtx ' +
    +      'ugc_match_Items_ReadyToUse ugc_match_Collections ugc_match_Artwork ' +
    +      'ugc_match_Videos ugc_match_Screenshots ugc_match_AllGuides ' +
    +      'ugc_match_WebGuides ugc_match_IntegratedGuides ' +
    +      'ugc_match_UsableInGame ugc_match_ControllerBindings  ' +
    +      'vertex_usage_position vertex_usage_colour vertex_usage_color ' +
    +      'vertex_usage_normal vertex_usage_texcoord vertex_usage_textcoord ' +
    +      'vertex_usage_blendweight vertex_usage_blendindices ' +
    +      'vertex_usage_psize vertex_usage_tangent vertex_usage_binormal ' +
    +      'vertex_usage_fog vertex_usage_depth vertex_usage_sample ' +
    +      'vertex_type_float1 vertex_type_float2 vertex_type_float3 ' +
    +      'vertex_type_float4 vertex_type_colour vertex_type_color ' +
    +      'vertex_type_ubyte4 layerelementtype_undefined ' +
    +      'layerelementtype_background layerelementtype_instance ' +
    +      'layerelementtype_oldtilemap layerelementtype_sprite ' +
    +      'layerelementtype_tilemap layerelementtype_particlesystem ' +
    +      'layerelementtype_tile tile_rotate tile_flip tile_mirror ' +
    +      'tile_index_mask kbv_type_default kbv_type_ascii kbv_type_url ' +
    +      'kbv_type_email kbv_type_numbers kbv_type_phone kbv_type_phone_name ' +
    +      'kbv_returnkey_default kbv_returnkey_go kbv_returnkey_google ' +
    +      'kbv_returnkey_join kbv_returnkey_next kbv_returnkey_route ' +
    +      'kbv_returnkey_search kbv_returnkey_send kbv_returnkey_yahoo ' +
    +      'kbv_returnkey_done kbv_returnkey_continue kbv_returnkey_emergency ' +
    +      'kbv_autocapitalize_none kbv_autocapitalize_words ' +
    +      'kbv_autocapitalize_sentences kbv_autocapitalize_characters',
    +    symbol: 'argument_relative argument argument0 argument1 argument2 ' +
    +      'argument3 argument4 argument5 argument6 argument7 argument8 ' +
    +      'argument9 argument10 argument11 argument12 argument13 argument14 ' +
    +      'argument15 argument_count x y xprevious yprevious xstart ystart ' +
    +      'hspeed vspeed direction speed friction gravity gravity_direction ' +
    +      'path_index path_position path_positionprevious path_speed ' +
    +      'path_scale path_orientation path_endaction object_index id solid ' +
    +      'persistent mask_index instance_count instance_id room_speed fps ' +
    +      'fps_real current_time current_year current_month current_day ' +
    +      'current_weekday current_hour current_minute current_second alarm ' +
    +      'timeline_index timeline_position timeline_speed timeline_running ' +
    +      'timeline_loop room room_first room_last room_width room_height ' +
    +      'room_caption room_persistent score lives health show_score ' +
    +      'show_lives show_health caption_score caption_lives caption_health ' +
    +      'event_type event_number event_object event_action ' +
    +      'application_surface gamemaker_pro gamemaker_registered ' +
    +      'gamemaker_version error_occurred error_last debug_mode ' +
    +      'keyboard_key keyboard_lastkey keyboard_lastchar keyboard_string ' +
    +      'mouse_x mouse_y mouse_button mouse_lastbutton cursor_sprite ' +
    +      'visible sprite_index sprite_width sprite_height sprite_xoffset ' +
    +      'sprite_yoffset image_number image_index image_speed depth ' +
    +      'image_xscale image_yscale image_angle image_alpha image_blend ' +
    +      'bbox_left bbox_right bbox_top bbox_bottom layer background_colour  ' +
    +      'background_showcolour background_color background_showcolor ' +
    +      'view_enabled view_current view_visible view_xview view_yview ' +
    +      'view_wview view_hview view_xport view_yport view_wport view_hport ' +
    +      'view_angle view_hborder view_vborder view_hspeed view_vspeed ' +
    +      'view_object view_surface_id view_camera game_id game_display_name ' +
    +      'game_project_name game_save_id working_directory temp_directory ' +
    +      'program_directory browser_width browser_height os_type os_device ' +
    +      'os_browser os_version display_aa async_load delta_time ' +
    +      'webgl_enabled event_data iap_data phy_rotation phy_position_x ' +
    +      'phy_position_y phy_angular_velocity phy_linear_velocity_x ' +
    +      'phy_linear_velocity_y phy_speed_x phy_speed_y phy_speed ' +
    +      'phy_angular_damping phy_linear_damping phy_bullet ' +
    +      'phy_fixed_rotation phy_active phy_mass phy_inertia phy_com_x ' +
    +      'phy_com_y phy_dynamic phy_kinematic phy_sleeping ' +
    +      'phy_collision_points phy_collision_x phy_collision_y ' +
    +      'phy_col_normal_x phy_col_normal_y phy_position_xprevious ' +
    +      'phy_position_yprevious'
    +  };
    +
    +  return {
    +    name: 'GML',
    +    aliases: [
    +      'gml',
    +      'GML'
    +    ],
    +    case_insensitive: false, // language is case-insensitive
    +    keywords: GML_KEYWORDS,
    +
    +    contains: [
    +      hljs.C_LINE_COMMENT_MODE,
    +      hljs.C_BLOCK_COMMENT_MODE,
    +      hljs.APOS_STRING_MODE,
    +      hljs.QUOTE_STRING_MODE,
    +      hljs.C_NUMBER_MODE
    +    ]
    +  };
    +}
    +
    +module.exports = gml;
    diff --git a/node_modules/highlight.js/lib/languages/go.js b/node_modules/highlight.js/lib/languages/go.js
    new file mode 100644
    index 0000000..4c80992
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/go.js
    @@ -0,0 +1,74 @@
    +/*
    +Language: Go
    +Author: Stephan Kountso aka StepLg 
    +Contributors: Evgeny Stepanischev 
    +Description: Google go language (golang). For info about language
    +Website: http://golang.org/
    +Category: common, system
    +*/
    +
    +function go(hljs) {
    +  const GO_KEYWORDS = {
    +    keyword:
    +      'break default func interface select case map struct chan else goto package switch ' +
    +      'const fallthrough if range type continue for import return var go defer ' +
    +      'bool byte complex64 complex128 float32 float64 int8 int16 int32 int64 string uint8 ' +
    +      'uint16 uint32 uint64 int uint uintptr rune',
    +    literal:
    +       'true false iota nil',
    +    built_in:
    +      'append cap close complex copy imag len make new panic print println real recover delete'
    +  };
    +  return {
    +    name: 'Go',
    +    aliases: ['golang'],
    +    keywords: GO_KEYWORDS,
    +    illegal: '
    +Description: a lightweight dynamic language for the JVM
    +Website: http://golo-lang.org/
    +*/
    +
    +function golo(hljs) {
    +  return {
    +    name: 'Golo',
    +    keywords: {
    +      keyword:
    +          'println readln print import module function local return let var ' +
    +          'while for foreach times in case when match with break continue ' +
    +          'augment augmentation each find filter reduce ' +
    +          'if then else otherwise try catch finally raise throw orIfNull ' +
    +          'DynamicObject|10 DynamicVariable struct Observable map set vector list array',
    +      literal:
    +          'true false null'
    +    },
    +    contains: [
    +      hljs.HASH_COMMENT_MODE,
    +      hljs.QUOTE_STRING_MODE,
    +      hljs.C_NUMBER_MODE,
    +      {
    +        className: 'meta',
    +        begin: '@[A-Za-z]+'
    +      }
    +    ]
    +  };
    +}
    +
    +module.exports = golo;
    diff --git a/node_modules/highlight.js/lib/languages/gradle.js b/node_modules/highlight.js/lib/languages/gradle.js
    new file mode 100644
    index 0000000..59b663e
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/gradle.js
    @@ -0,0 +1,44 @@
    +/*
    +Language: Gradle
    +Description: Gradle is an open-source build automation tool focused on flexibility and performance.
    +Website: https://gradle.org
    +Author: Damian Mee 
    +*/
    +
    +function gradle(hljs) {
    +  return {
    +    name: 'Gradle',
    +    case_insensitive: true,
    +    keywords: {
    +      keyword:
    +        'task project allprojects subprojects artifacts buildscript configurations ' +
    +        'dependencies repositories sourceSets description delete from into include ' +
    +        'exclude source classpath destinationDir includes options sourceCompatibility ' +
    +        'targetCompatibility group flatDir doLast doFirst flatten todir fromdir ant ' +
    +        'def abstract break case catch continue default do else extends final finally ' +
    +        'for if implements instanceof native new private protected public return static ' +
    +        'switch synchronized throw throws transient try volatile while strictfp package ' +
    +        'import false null super this true antlrtask checkstyle codenarc copy boolean ' +
    +        'byte char class double float int interface long short void compile runTime ' +
    +        'file fileTree abs any append asList asWritable call collect compareTo count ' +
    +        'div dump each eachByte eachFile eachLine every find findAll flatten getAt ' +
    +        'getErr getIn getOut getText grep immutable inject inspect intersect invokeMethods ' +
    +        'isCase join leftShift minus multiply newInputStream newOutputStream newPrintWriter ' +
    +        'newReader newWriter next plus pop power previous print println push putAt read ' +
    +        'readBytes readLines reverse reverseEach round size sort splitEachLine step subMap ' +
    +        'times toInteger toList tokenize upto waitForOrKill withPrintWriter withReader ' +
    +        'withStream withWriter withWriterAppend write writeLine'
    +    },
    +    contains: [
    +      hljs.C_LINE_COMMENT_MODE,
    +      hljs.C_BLOCK_COMMENT_MODE,
    +      hljs.APOS_STRING_MODE,
    +      hljs.QUOTE_STRING_MODE,
    +      hljs.NUMBER_MODE,
    +      hljs.REGEXP_MODE
    +
    +    ]
    +  };
    +}
    +
    +module.exports = gradle;
    diff --git a/node_modules/highlight.js/lib/languages/groovy.js b/node_modules/highlight.js/lib/languages/groovy.js
    new file mode 100644
    index 0000000..6d81c24
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/groovy.js
    @@ -0,0 +1,165 @@
    +/**
    + * @param {string} value
    + * @returns {RegExp}
    + * */
    +
    +/**
    + * @param {RegExp | string } re
    + * @returns {string}
    + */
    +function source(re) {
    +  if (!re) return null;
    +  if (typeof re === "string") return re;
    +
    +  return re.source;
    +}
    +
    +/**
    + * @param {RegExp | string } re
    + * @returns {string}
    + */
    +function lookahead(re) {
    +  return concat('(?=', re, ')');
    +}
    +
    +/**
    + * @param {...(RegExp | string) } args
    + * @returns {string}
    + */
    +function concat(...args) {
    +  const joined = args.map((x) => source(x)).join("");
    +  return joined;
    +}
    +
    +/*
    + Language: Groovy
    + Author: Guillaume Laforge 
    + Description: Groovy programming language implementation inspired from Vsevolod's Java mode
    + Website: https://groovy-lang.org
    + */
    +
    +function variants(variants, obj = {}) {
    +  obj.variants = variants;
    +  return obj;
    +}
    +
    +function groovy(hljs) {
    +  const IDENT_RE = '[A-Za-z0-9_$]+';
    +  const COMMENT = variants([
    +    hljs.C_LINE_COMMENT_MODE,
    +    hljs.C_BLOCK_COMMENT_MODE,
    +    hljs.COMMENT(
    +      '/\\*\\*',
    +      '\\*/',
    +      {
    +        relevance : 0,
    +        contains : [
    +          {
    +            // eat up @'s in emails to prevent them to be recognized as doctags
    +            begin: /\w+@/, relevance: 0
    +          }, {
    +            className : 'doctag',
    +            begin : '@[A-Za-z]+'
    +          }
    +        ]
    +      }
    +    )
    +  ]);
    +  const REGEXP = {
    +    className: 'regexp',
    +    begin: /~?\/[^\/\n]+\//,
    +    contains: [
    +      hljs.BACKSLASH_ESCAPE
    +    ]
    +  };
    +  const NUMBER = variants([
    +    hljs.BINARY_NUMBER_MODE,
    +    hljs.C_NUMBER_MODE,
    +  ]);
    +  const STRING = variants([
    +    {
    +      begin: /"""/,
    +      end: /"""/
    +    }, {
    +      begin: /'''/,
    +      end: /'''/
    +    }, {
    +      begin: "\\$/",
    +      end: "/\\$",
    +      relevance: 10
    +    },
    +    hljs.APOS_STRING_MODE,
    +    hljs.QUOTE_STRING_MODE,
    +    ],
    +    { className: "string" }
    +  );
    +
    +    return {
    +        name: 'Groovy',
    +        keywords: {
    +            built_in: 'this super',
    +            literal: 'true false null',
    +            keyword:
    +            'byte short char int long boolean float double void ' +
    +            // groovy specific keywords
    +            'def as in assert trait ' +
    +            // common keywords with Java
    +            'abstract static volatile transient public private protected synchronized final ' +
    +            'class interface enum if else for while switch case break default continue ' +
    +            'throw throws try catch finally implements extends new import package return instanceof'
    +        },
    +        contains: [
    +            hljs.SHEBANG({
    +              binary: "groovy",
    +              relevance: 10
    +            }),
    +            COMMENT,
    +            STRING,
    +            REGEXP,
    +            NUMBER,
    +            {
    +                className: 'class',
    +                beginKeywords: 'class interface trait enum', end: /\{/,
    +                illegal: ':',
    +                contains: [
    +                    {beginKeywords: 'extends implements'},
    +                    hljs.UNDERSCORE_TITLE_MODE
    +                ]
    +            },
    +            {
    +                className: 'meta',
    +                begin: '@[A-Za-z]+',
    +                relevance: 0
    +            },
    +            {
    +              // highlight map keys and named parameters as attrs
    +              className: 'attr', begin: IDENT_RE + '[ \t]*:'
    +            },
    +            {
    +              // catch middle element of the ternary operator
    +              // to avoid highlight it as a label, named parameter, or map key
    +              begin: /\?/,
    +              end: /:/,
    +              relevance: 0,
    +              contains: [
    +                COMMENT,
    +                STRING,
    +                REGEXP,
    +                NUMBER,
    +                'self'
    +              ]
    +            },
    +            {
    +                // highlight labeled statements
    +                className: 'symbol',
    +                begin: '^[ \t]*' + lookahead(IDENT_RE + ':'),
    +                excludeBegin: true,
    +                end: IDENT_RE + ':',
    +                relevance: 0
    +            }
    +        ],
    +        illegal: /#|<\//
    +    };
    +}
    +
    +module.exports = groovy;
    diff --git a/node_modules/highlight.js/lib/languages/haml.js b/node_modules/highlight.js/lib/languages/haml.js
    new file mode 100644
    index 0000000..cb6a536
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/haml.js
    @@ -0,0 +1,117 @@
    +/*
    +Language: HAML
    +Requires: ruby.js
    +Author: Dan Allen 
    +Website: http://haml.info
    +Category: template
    +*/
    +
    +// TODO support filter tags like :javascript, support inline HTML
    +function haml(hljs) {
    +  return {
    +    name: 'HAML',
    +    case_insensitive: true,
    +    contains: [
    +      {
    +        className: 'meta',
    +        begin: '^!!!( (5|1\\.1|Strict|Frameset|Basic|Mobile|RDFa|XML\\b.*))?$',
    +        relevance: 10
    +      },
    +      // FIXME these comments should be allowed to span indented lines
    +      hljs.COMMENT(
    +        '^\\s*(!=#|=#|-#|/).*$',
    +        false,
    +        {
    +          relevance: 0
    +        }
    +      ),
    +      {
    +        begin: '^\\s*(-|=|!=)(?!#)',
    +        starts: {
    +          end: '\\n',
    +          subLanguage: 'ruby'
    +        }
    +      },
    +      {
    +        className: 'tag',
    +        begin: '^\\s*%',
    +        contains: [
    +          {
    +            className: 'selector-tag',
    +            begin: '\\w+'
    +          },
    +          {
    +            className: 'selector-id',
    +            begin: '#[\\w-]+'
    +          },
    +          {
    +            className: 'selector-class',
    +            begin: '\\.[\\w-]+'
    +          },
    +          {
    +            begin: /\{\s*/,
    +            end: /\s*\}/,
    +            contains: [
    +              {
    +                begin: ':\\w+\\s*=>',
    +                end: ',\\s+',
    +                returnBegin: true,
    +                endsWithParent: true,
    +                contains: [
    +                  {
    +                    className: 'attr',
    +                    begin: ':\\w+'
    +                  },
    +                  hljs.APOS_STRING_MODE,
    +                  hljs.QUOTE_STRING_MODE,
    +                  {
    +                    begin: '\\w+',
    +                    relevance: 0
    +                  }
    +                ]
    +              }
    +            ]
    +          },
    +          {
    +            begin: '\\(\\s*',
    +            end: '\\s*\\)',
    +            excludeEnd: true,
    +            contains: [
    +              {
    +                begin: '\\w+\\s*=',
    +                end: '\\s+',
    +                returnBegin: true,
    +                endsWithParent: true,
    +                contains: [
    +                  {
    +                    className: 'attr',
    +                    begin: '\\w+',
    +                    relevance: 0
    +                  },
    +                  hljs.APOS_STRING_MODE,
    +                  hljs.QUOTE_STRING_MODE,
    +                  {
    +                    begin: '\\w+',
    +                    relevance: 0
    +                  }
    +                ]
    +              }
    +            ]
    +          }
    +        ]
    +      },
    +      {
    +        begin: '^\\s*[=~]\\s*'
    +      },
    +      {
    +        begin: /#\{/,
    +        starts: {
    +          end: /\}/,
    +          subLanguage: 'ruby'
    +        }
    +      }
    +    ]
    +  };
    +}
    +
    +module.exports = haml;
    diff --git a/node_modules/highlight.js/lib/languages/handlebars.js b/node_modules/highlight.js/lib/languages/handlebars.js
    new file mode 100644
    index 0000000..49c07f8
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/handlebars.js
    @@ -0,0 +1,324 @@
    +/**
    + * @param {string} value
    + * @returns {RegExp}
    + * */
    +
    +/**
    + * @param {RegExp | string } re
    + * @returns {string}
    + */
    +function source(re) {
    +  if (!re) return null;
    +  if (typeof re === "string") return re;
    +
    +  return re.source;
    +}
    +
    +/**
    + * @param {RegExp | string } re
    + * @returns {string}
    + */
    +function anyNumberOfTimes(re) {
    +  return concat('(', re, ')*');
    +}
    +
    +/**
    + * @param {RegExp | string } re
    + * @returns {string}
    + */
    +function optional(re) {
    +  return concat('(', re, ')?');
    +}
    +
    +/**
    + * @param {...(RegExp | string) } args
    + * @returns {string}
    + */
    +function concat(...args) {
    +  const joined = args.map((x) => source(x)).join("");
    +  return joined;
    +}
    +
    +/**
    + * Any of the passed expresssions may match
    + *
    + * Creates a huge this | this | that | that match
    + * @param {(RegExp | string)[] } args
    + * @returns {string}
    + */
    +function either(...args) {
    +  const joined = '(' + args.map((x) => source(x)).join("|") + ")";
    +  return joined;
    +}
    +
    +/*
    +Language: Handlebars
    +Requires: xml.js
    +Author: Robin Ward 
    +Description: Matcher for Handlebars as well as EmberJS additions.
    +Website: https://handlebarsjs.com
    +Category: template
    +*/
    +
    +function handlebars(hljs) {
    +  const BUILT_INS = {
    +    'builtin-name': [
    +      'action',
    +      'bindattr',
    +      'collection',
    +      'component',
    +      'concat',
    +      'debugger',
    +      'each',
    +      'each-in',
    +      'get',
    +      'hash',
    +      'if',
    +      'in',
    +      'input',
    +      'link-to',
    +      'loc',
    +      'log',
    +      'lookup',
    +      'mut',
    +      'outlet',
    +      'partial',
    +      'query-params',
    +      'render',
    +      'template',
    +      'textarea',
    +      'unbound',
    +      'unless',
    +      'view',
    +      'with',
    +      'yield'
    +    ].join(" ")
    +  };
    +
    +  const LITERALS = {
    +    literal: [
    +      'true',
    +      'false',
    +      'undefined',
    +      'null'
    +    ].join(" ")
    +  };
    +
    +  // as defined in https://handlebarsjs.com/guide/expressions.html#literal-segments
    +  // this regex matches literal segments like ' abc ' or [ abc ] as well as helpers and paths
    +  // like a/b, ./abc/cde, and abc.bcd
    +
    +  const DOUBLE_QUOTED_ID_REGEX = /""|"[^"]+"/;
    +  const SINGLE_QUOTED_ID_REGEX = /''|'[^']+'/;
    +  const BRACKET_QUOTED_ID_REGEX = /\[\]|\[[^\]]+\]/;
    +  const PLAIN_ID_REGEX = /[^\s!"#%&'()*+,.\/;<=>@\[\\\]^`{|}~]+/;
    +  const PATH_DELIMITER_REGEX = /(\.|\/)/;
    +  const ANY_ID = either(
    +    DOUBLE_QUOTED_ID_REGEX,
    +    SINGLE_QUOTED_ID_REGEX,
    +    BRACKET_QUOTED_ID_REGEX,
    +    PLAIN_ID_REGEX
    +    );
    +
    +  const IDENTIFIER_REGEX = concat(
    +    optional(/\.|\.\/|\//), // relative or absolute path
    +    ANY_ID,
    +    anyNumberOfTimes(concat(
    +      PATH_DELIMITER_REGEX,
    +      ANY_ID
    +    ))
    +  );
    +
    +  // identifier followed by a equal-sign (without the equal sign)
    +  const HASH_PARAM_REGEX = concat(
    +    '(',
    +    BRACKET_QUOTED_ID_REGEX, '|',
    +    PLAIN_ID_REGEX,
    +    ')(?==)'
    +  );
    +
    +  const HELPER_NAME_OR_PATH_EXPRESSION = {
    +    begin: IDENTIFIER_REGEX,
    +    lexemes: /[\w.\/]+/
    +  };
    +
    +  const HELPER_PARAMETER = hljs.inherit(HELPER_NAME_OR_PATH_EXPRESSION, {
    +    keywords: LITERALS
    +  });
    +
    +  const SUB_EXPRESSION = {
    +    begin: /\(/,
    +    end: /\)/
    +    // the "contains" is added below when all necessary sub-modes are defined
    +  };
    +
    +  const HASH = {
    +    // fka "attribute-assignment", parameters of the form 'key=value'
    +    className: 'attr',
    +    begin: HASH_PARAM_REGEX,
    +    relevance: 0,
    +    starts: {
    +      begin: /=/,
    +      end: /=/,
    +      starts: {
    +        contains: [
    +          hljs.NUMBER_MODE,
    +          hljs.QUOTE_STRING_MODE,
    +          hljs.APOS_STRING_MODE,
    +          HELPER_PARAMETER,
    +          SUB_EXPRESSION
    +        ]
    +      }
    +    }
    +  };
    +
    +  const BLOCK_PARAMS = {
    +    // parameters of the form '{{#with x as | y |}}...{{/with}}'
    +    begin: /as\s+\|/,
    +    keywords: {
    +      keyword: 'as'
    +    },
    +    end: /\|/,
    +    contains: [
    +      {
    +        // define sub-mode in order to prevent highlighting of block-parameter named "as"
    +        begin: /\w+/
    +      }
    +    ]
    +  };
    +
    +  const HELPER_PARAMETERS = {
    +    contains: [
    +      hljs.NUMBER_MODE,
    +      hljs.QUOTE_STRING_MODE,
    +      hljs.APOS_STRING_MODE,
    +      BLOCK_PARAMS,
    +      HASH,
    +      HELPER_PARAMETER,
    +      SUB_EXPRESSION
    +    ],
    +    returnEnd: true
    +    // the property "end" is defined through inheritance when the mode is used. If depends
    +    // on the surrounding mode, but "endsWithParent" does not work here (i.e. it includes the
    +    // end-token of the surrounding mode)
    +  };
    +
    +  const SUB_EXPRESSION_CONTENTS = hljs.inherit(HELPER_NAME_OR_PATH_EXPRESSION, {
    +    className: 'name',
    +    keywords: BUILT_INS,
    +    starts: hljs.inherit(HELPER_PARAMETERS, {
    +      end: /\)/
    +    })
    +  });
    +
    +  SUB_EXPRESSION.contains = [SUB_EXPRESSION_CONTENTS];
    +
    +  const OPENING_BLOCK_MUSTACHE_CONTENTS = hljs.inherit(HELPER_NAME_OR_PATH_EXPRESSION, {
    +    keywords: BUILT_INS,
    +    className: 'name',
    +    starts: hljs.inherit(HELPER_PARAMETERS, {
    +      end: /\}\}/
    +    })
    +  });
    +
    +  const CLOSING_BLOCK_MUSTACHE_CONTENTS = hljs.inherit(HELPER_NAME_OR_PATH_EXPRESSION, {
    +    keywords: BUILT_INS,
    +    className: 'name'
    +  });
    +
    +  const BASIC_MUSTACHE_CONTENTS = hljs.inherit(HELPER_NAME_OR_PATH_EXPRESSION, {
    +    className: 'name',
    +    keywords: BUILT_INS,
    +    starts: hljs.inherit(HELPER_PARAMETERS, {
    +      end: /\}\}/
    +    })
    +  });
    +
    +  const ESCAPE_MUSTACHE_WITH_PRECEEDING_BACKSLASH = {
    +    begin: /\\\{\{/,
    +    skip: true
    +  };
    +  const PREVENT_ESCAPE_WITH_ANOTHER_PRECEEDING_BACKSLASH = {
    +    begin: /\\\\(?=\{\{)/,
    +    skip: true
    +  };
    +
    +  return {
    +    name: 'Handlebars',
    +    aliases: [
    +      'hbs',
    +      'html.hbs',
    +      'html.handlebars',
    +      'htmlbars'
    +    ],
    +    case_insensitive: true,
    +    subLanguage: 'xml',
    +    contains: [
    +      ESCAPE_MUSTACHE_WITH_PRECEEDING_BACKSLASH,
    +      PREVENT_ESCAPE_WITH_ANOTHER_PRECEEDING_BACKSLASH,
    +      hljs.COMMENT(/\{\{!--/, /--\}\}/),
    +      hljs.COMMENT(/\{\{!/, /\}\}/),
    +      {
    +        // open raw block "{{{{raw}}}} content not evaluated {{{{/raw}}}}"
    +        className: 'template-tag',
    +        begin: /\{\{\{\{(?!\/)/,
    +        end: /\}\}\}\}/,
    +        contains: [OPENING_BLOCK_MUSTACHE_CONTENTS],
    +        starts: {
    +          end: /\{\{\{\{\//,
    +          returnEnd: true,
    +          subLanguage: 'xml'
    +        }
    +      },
    +      {
    +        // close raw block
    +        className: 'template-tag',
    +        begin: /\{\{\{\{\//,
    +        end: /\}\}\}\}/,
    +        contains: [CLOSING_BLOCK_MUSTACHE_CONTENTS]
    +      },
    +      {
    +        // open block statement
    +        className: 'template-tag',
    +        begin: /\{\{#/,
    +        end: /\}\}/,
    +        contains: [OPENING_BLOCK_MUSTACHE_CONTENTS]
    +      },
    +      {
    +        className: 'template-tag',
    +        begin: /\{\{(?=else\}\})/,
    +        end: /\}\}/,
    +        keywords: 'else'
    +      },
    +      {
    +        className: 'template-tag',
    +        begin: /\{\{(?=else if)/,
    +        end: /\}\}/,
    +        keywords: 'else if'
    +      },
    +      {
    +        // closing block statement
    +        className: 'template-tag',
    +        begin: /\{\{\//,
    +        end: /\}\}/,
    +        contains: [CLOSING_BLOCK_MUSTACHE_CONTENTS]
    +      },
    +      {
    +        // template variable or helper-call that is NOT html-escaped
    +        className: 'template-variable',
    +        begin: /\{\{\{/,
    +        end: /\}\}\}/,
    +        contains: [BASIC_MUSTACHE_CONTENTS]
    +      },
    +      {
    +        // template variable or helper-call that is html-escaped
    +        className: 'template-variable',
    +        begin: /\{\{/,
    +        end: /\}\}/,
    +        contains: [BASIC_MUSTACHE_CONTENTS]
    +      }
    +    ]
    +  };
    +}
    +
    +module.exports = handlebars;
    diff --git a/node_modules/highlight.js/lib/languages/haskell.js b/node_modules/highlight.js/lib/languages/haskell.js
    new file mode 100644
    index 0000000..5d6a367
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/haskell.js
    @@ -0,0 +1,173 @@
    +/*
    +Language: Haskell
    +Author: Jeremy Hull 
    +Contributors: Zena Treep 
    +Website: https://www.haskell.org
    +Category: functional
    +*/
    +
    +function haskell(hljs) {
    +  const COMMENT = {
    +    variants: [
    +      hljs.COMMENT('--', '$'),
    +      hljs.COMMENT(
    +        /\{-/,
    +        /-\}/,
    +        {
    +          contains: ['self']
    +        }
    +      )
    +    ]
    +  };
    +
    +  const PRAGMA = {
    +    className: 'meta',
    +    begin: /\{-#/,
    +    end: /#-\}/
    +  };
    +
    +  const PREPROCESSOR = {
    +    className: 'meta',
    +    begin: '^#',
    +    end: '$'
    +  };
    +
    +  const CONSTRUCTOR = {
    +    className: 'type',
    +    begin: '\\b[A-Z][\\w\']*', // TODO: other constructors (build-in, infix).
    +    relevance: 0
    +  };
    +
    +  const LIST = {
    +    begin: '\\(',
    +    end: '\\)',
    +    illegal: '"',
    +    contains: [
    +      PRAGMA,
    +      PREPROCESSOR,
    +      {
    +        className: 'type',
    +        begin: '\\b[A-Z][\\w]*(\\((\\.\\.|,|\\w+)\\))?'
    +      },
    +      hljs.inherit(hljs.TITLE_MODE, {
    +        begin: '[_a-z][\\w\']*'
    +      }),
    +      COMMENT
    +    ]
    +  };
    +
    +  const RECORD = {
    +    begin: /\{/,
    +    end: /\}/,
    +    contains: LIST.contains
    +  };
    +
    +  return {
    +    name: 'Haskell',
    +    aliases: ['hs'],
    +    keywords:
    +      'let in if then else case of where do module import hiding ' +
    +      'qualified type data newtype deriving class instance as default ' +
    +      'infix infixl infixr foreign export ccall stdcall cplusplus ' +
    +      'jvm dotnet safe unsafe family forall mdo proc rec',
    +    contains: [
    +      // Top-level constructions.
    +      {
    +        beginKeywords: 'module',
    +        end: 'where',
    +        keywords: 'module where',
    +        contains: [
    +          LIST,
    +          COMMENT
    +        ],
    +        illegal: '\\W\\.|;'
    +      },
    +      {
    +        begin: '\\bimport\\b',
    +        end: '$',
    +        keywords: 'import qualified as hiding',
    +        contains: [
    +          LIST,
    +          COMMENT
    +        ],
    +        illegal: '\\W\\.|;'
    +      },
    +      {
    +        className: 'class',
    +        begin: '^(\\s*)?(class|instance)\\b',
    +        end: 'where',
    +        keywords: 'class family instance where',
    +        contains: [
    +          CONSTRUCTOR,
    +          LIST,
    +          COMMENT
    +        ]
    +      },
    +      {
    +        className: 'class',
    +        begin: '\\b(data|(new)?type)\\b',
    +        end: '$',
    +        keywords: 'data family type newtype deriving',
    +        contains: [
    +          PRAGMA,
    +          CONSTRUCTOR,
    +          LIST,
    +          RECORD,
    +          COMMENT
    +        ]
    +      },
    +      {
    +        beginKeywords: 'default',
    +        end: '$',
    +        contains: [
    +          CONSTRUCTOR,
    +          LIST,
    +          COMMENT
    +        ]
    +      },
    +      {
    +        beginKeywords: 'infix infixl infixr',
    +        end: '$',
    +        contains: [
    +          hljs.C_NUMBER_MODE,
    +          COMMENT
    +        ]
    +      },
    +      {
    +        begin: '\\bforeign\\b',
    +        end: '$',
    +        keywords: 'foreign import export ccall stdcall cplusplus jvm ' +
    +                  'dotnet safe unsafe',
    +        contains: [
    +          CONSTRUCTOR,
    +          hljs.QUOTE_STRING_MODE,
    +          COMMENT
    +        ]
    +      },
    +      {
    +        className: 'meta',
    +        begin: '#!\\/usr\\/bin\\/env\ runhaskell',
    +        end: '$'
    +      },
    +      // "Whitespaces".
    +      PRAGMA,
    +      PREPROCESSOR,
    +
    +      // Literals and names.
    +
    +      // TODO: characters.
    +      hljs.QUOTE_STRING_MODE,
    +      hljs.C_NUMBER_MODE,
    +      CONSTRUCTOR,
    +      hljs.inherit(hljs.TITLE_MODE, {
    +        begin: '^[_a-z][\\w\']*'
    +      }),
    +      COMMENT,
    +      { // No markup, relevance booster
    +        begin: '->|<-'
    +      }
    +    ]
    +  };
    +}
    +
    +module.exports = haskell;
    diff --git a/node_modules/highlight.js/lib/languages/haxe.js b/node_modules/highlight.js/lib/languages/haxe.js
    new file mode 100644
    index 0000000..10045b3
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/haxe.js
    @@ -0,0 +1,157 @@
    +/*
    +Language: Haxe
    +Description: Haxe is an open source toolkit based on a modern, high level, strictly typed programming language.
    +Author: Christopher Kaster  (Based on the actionscript.js language file by Alexander Myadzel)
    +Contributors: Kenton Hamaluik 
    +Website: https://haxe.org
    +*/
    +
    +function haxe(hljs) {
    +
    +  const HAXE_BASIC_TYPES = 'Int Float String Bool Dynamic Void Array ';
    +
    +  return {
    +    name: 'Haxe',
    +    aliases: ['hx'],
    +    keywords: {
    +      keyword: 'break case cast catch continue default do dynamic else enum extern ' +
    +               'for function here if import in inline never new override package private get set ' +
    +               'public return static super switch this throw trace try typedef untyped using var while ' +
    +               HAXE_BASIC_TYPES,
    +      built_in:
    +        'trace this',
    +      literal:
    +        'true false null _'
    +    },
    +    contains: [
    +      {
    +        className: 'string', // interpolate-able strings
    +        begin: '\'',
    +        end: '\'',
    +        contains: [
    +          hljs.BACKSLASH_ESCAPE,
    +          {
    +            className: 'subst', // interpolation
    +            begin: '\\$\\{',
    +            end: '\\}'
    +          },
    +          {
    +            className: 'subst', // interpolation
    +            begin: '\\$',
    +            end: /\W\}/
    +          }
    +        ]
    +      },
    +      hljs.QUOTE_STRING_MODE,
    +      hljs.C_LINE_COMMENT_MODE,
    +      hljs.C_BLOCK_COMMENT_MODE,
    +      hljs.C_NUMBER_MODE,
    +      {
    +        className: 'meta', // compiler meta
    +        begin: '@:',
    +        end: '$'
    +      },
    +      {
    +        className: 'meta', // compiler conditionals
    +        begin: '#',
    +        end: '$',
    +        keywords: {
    +          'meta-keyword': 'if else elseif end error'
    +        }
    +      },
    +      {
    +        className: 'type', // function types
    +        begin: ':[ \t]*',
    +        end: '[^A-Za-z0-9_ \t\\->]',
    +        excludeBegin: true,
    +        excludeEnd: true,
    +        relevance: 0
    +      },
    +      {
    +        className: 'type', // types
    +        begin: ':[ \t]*',
    +        end: '\\W',
    +        excludeBegin: true,
    +        excludeEnd: true
    +      },
    +      {
    +        className: 'type', // instantiation
    +        begin: 'new *',
    +        end: '\\W',
    +        excludeBegin: true,
    +        excludeEnd: true
    +      },
    +      {
    +        className: 'class', // enums
    +        beginKeywords: 'enum',
    +        end: '\\{',
    +        contains: [hljs.TITLE_MODE]
    +      },
    +      {
    +        className: 'class', // abstracts
    +        beginKeywords: 'abstract',
    +        end: '[\\{$]',
    +        contains: [
    +          {
    +            className: 'type',
    +            begin: '\\(',
    +            end: '\\)',
    +            excludeBegin: true,
    +            excludeEnd: true
    +          },
    +          {
    +            className: 'type',
    +            begin: 'from +',
    +            end: '\\W',
    +            excludeBegin: true,
    +            excludeEnd: true
    +          },
    +          {
    +            className: 'type',
    +            begin: 'to +',
    +            end: '\\W',
    +            excludeBegin: true,
    +            excludeEnd: true
    +          },
    +          hljs.TITLE_MODE
    +        ],
    +        keywords: {
    +          keyword: 'abstract from to'
    +        }
    +      },
    +      {
    +        className: 'class', // classes
    +        begin: '\\b(class|interface) +',
    +        end: '[\\{$]',
    +        excludeEnd: true,
    +        keywords: 'class interface',
    +        contains: [
    +          {
    +            className: 'keyword',
    +            begin: '\\b(extends|implements) +',
    +            keywords: 'extends implements',
    +            contains: [
    +              {
    +                className: 'type',
    +                begin: hljs.IDENT_RE,
    +                relevance: 0
    +              }
    +            ]
    +          },
    +          hljs.TITLE_MODE
    +        ]
    +      },
    +      {
    +        className: 'function',
    +        beginKeywords: 'function',
    +        end: '\\(',
    +        excludeEnd: true,
    +        illegal: '\\S',
    +        contains: [hljs.TITLE_MODE]
    +      }
    +    ],
    +    illegal: /<\//
    +  };
    +}
    +
    +module.exports = haxe;
    diff --git a/node_modules/highlight.js/lib/languages/hsp.js b/node_modules/highlight.js/lib/languages/hsp.js
    new file mode 100644
    index 0000000..d2c09d6
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/hsp.js
    @@ -0,0 +1,65 @@
    +/*
    +Language: HSP
    +Author: prince 
    +Website: https://en.wikipedia.org/wiki/Hot_Soup_Processor
    +Category: scripting
    +*/
    +
    +function hsp(hljs) {
    +  return {
    +    name: 'HSP',
    +    case_insensitive: true,
    +    keywords: {
    +      $pattern: /[\w._]+/,
    +      keyword: 'goto gosub return break repeat loop continue wait await dim sdim foreach dimtype dup dupptr end stop newmod delmod mref run exgoto on mcall assert logmes newlab resume yield onexit onerror onkey onclick oncmd exist delete mkdir chdir dirlist bload bsave bcopy memfile if else poke wpoke lpoke getstr chdpm memexpand memcpy memset notesel noteadd notedel noteload notesave randomize noteunsel noteget split strrep setease button chgdisp exec dialog mmload mmplay mmstop mci pset pget syscolor mes print title pos circle cls font sysfont objsize picload color palcolor palette redraw width gsel gcopy gzoom gmode bmpsave hsvcolor getkey listbox chkbox combox input mesbox buffer screen bgscr mouse objsel groll line clrobj boxf objprm objmode stick grect grotate gsquare gradf objimage objskip objenable celload celdiv celput newcom querycom delcom cnvstow comres axobj winobj sendmsg comevent comevarg sarrayconv callfunc cnvwtos comevdisp libptr system hspstat hspver stat cnt err strsize looplev sublev iparam wparam lparam refstr refdval int rnd strlen length length2 length3 length4 vartype gettime peek wpeek lpeek varptr varuse noteinfo instr abs limit getease str strmid strf getpath strtrim sin cos tan atan sqrt double absf expf logf limitf powf geteasef mousex mousey mousew hwnd hinstance hdc ginfo objinfo dirinfo sysinfo thismod __hspver__ __hsp30__ __date__ __time__ __line__ __file__ _debug __hspdef__ and or xor not screen_normal screen_palette screen_hide screen_fixedsize screen_tool screen_frame gmode_gdi gmode_mem gmode_rgb0 gmode_alpha gmode_rgb0alpha gmode_add gmode_sub gmode_pixela ginfo_mx ginfo_my ginfo_act ginfo_sel ginfo_wx1 ginfo_wy1 ginfo_wx2 ginfo_wy2 ginfo_vx ginfo_vy ginfo_sizex ginfo_sizey ginfo_winx ginfo_winy ginfo_mesx ginfo_mesy ginfo_r ginfo_g ginfo_b ginfo_paluse ginfo_dispx ginfo_dispy ginfo_cx ginfo_cy ginfo_intid ginfo_newid ginfo_sx ginfo_sy objinfo_mode objinfo_bmscr objinfo_hwnd notemax notesize dir_cur dir_exe dir_win dir_sys dir_cmdline dir_desktop dir_mydoc dir_tv font_normal font_bold font_italic font_underline font_strikeout font_antialias objmode_normal objmode_guifont objmode_usefont gsquare_grad msgothic msmincho do until while wend for next _break _continue switch case default swbreak swend ddim ldim alloc m_pi rad2deg deg2rad ease_linear ease_quad_in ease_quad_out ease_quad_inout ease_cubic_in ease_cubic_out ease_cubic_inout ease_quartic_in ease_quartic_out ease_quartic_inout ease_bounce_in ease_bounce_out ease_bounce_inout ease_shake_in ease_shake_out ease_shake_inout ease_loop'
    +    },
    +    contains: [
    +      hljs.C_LINE_COMMENT_MODE,
    +      hljs.C_BLOCK_COMMENT_MODE,
    +      hljs.QUOTE_STRING_MODE,
    +      hljs.APOS_STRING_MODE,
    +
    +      {
    +        // multi-line string
    +        className: 'string',
    +        begin: /\{"/,
    +        end: /"\}/,
    +        contains: [hljs.BACKSLASH_ESCAPE]
    +      },
    +
    +      hljs.COMMENT(';', '$', {
    +        relevance: 0
    +      }),
    +
    +      {
    +        // pre-processor
    +        className: 'meta',
    +        begin: '#',
    +        end: '$',
    +        keywords: {
    +          'meta-keyword': 'addion cfunc cmd cmpopt comfunc const defcfunc deffunc define else endif enum epack func global if ifdef ifndef include modcfunc modfunc modinit modterm module pack packopt regcmd runtime undef usecom uselib'
    +        },
    +        contains: [
    +          hljs.inherit(hljs.QUOTE_STRING_MODE, {
    +            className: 'meta-string'
    +          }),
    +          hljs.NUMBER_MODE,
    +          hljs.C_NUMBER_MODE,
    +          hljs.C_LINE_COMMENT_MODE,
    +          hljs.C_BLOCK_COMMENT_MODE
    +        ]
    +      },
    +
    +      {
    +        // label
    +        className: 'symbol',
    +        begin: '^\\*(\\w+|@)'
    +      },
    +
    +      hljs.NUMBER_MODE,
    +      hljs.C_NUMBER_MODE
    +    ]
    +  };
    +}
    +
    +module.exports = hsp;
    diff --git a/node_modules/highlight.js/lib/languages/htmlbars.js b/node_modules/highlight.js/lib/languages/htmlbars.js
    new file mode 100644
    index 0000000..39c63ad
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/htmlbars.js
    @@ -0,0 +1,352 @@
    +/**
    + * @param {string} value
    + * @returns {RegExp}
    + * */
    +
    +/**
    + * @param {RegExp | string } re
    + * @returns {string}
    + */
    +function source(re) {
    +  if (!re) return null;
    +  if (typeof re === "string") return re;
    +
    +  return re.source;
    +}
    +
    +/**
    + * @param {RegExp | string } re
    + * @returns {string}
    + */
    +function anyNumberOfTimes(re) {
    +  return concat('(', re, ')*');
    +}
    +
    +/**
    + * @param {RegExp | string } re
    + * @returns {string}
    + */
    +function optional(re) {
    +  return concat('(', re, ')?');
    +}
    +
    +/**
    + * @param {...(RegExp | string) } args
    + * @returns {string}
    + */
    +function concat(...args) {
    +  const joined = args.map((x) => source(x)).join("");
    +  return joined;
    +}
    +
    +/**
    + * Any of the passed expresssions may match
    + *
    + * Creates a huge this | this | that | that match
    + * @param {(RegExp | string)[] } args
    + * @returns {string}
    + */
    +function either(...args) {
    +  const joined = '(' + args.map((x) => source(x)).join("|") + ")";
    +  return joined;
    +}
    +
    +/*
    +Language: Handlebars
    +Requires: xml.js
    +Author: Robin Ward 
    +Description: Matcher for Handlebars as well as EmberJS additions.
    +Website: https://handlebarsjs.com
    +Category: template
    +*/
    +
    +function handlebars(hljs) {
    +  const BUILT_INS = {
    +    'builtin-name': [
    +      'action',
    +      'bindattr',
    +      'collection',
    +      'component',
    +      'concat',
    +      'debugger',
    +      'each',
    +      'each-in',
    +      'get',
    +      'hash',
    +      'if',
    +      'in',
    +      'input',
    +      'link-to',
    +      'loc',
    +      'log',
    +      'lookup',
    +      'mut',
    +      'outlet',
    +      'partial',
    +      'query-params',
    +      'render',
    +      'template',
    +      'textarea',
    +      'unbound',
    +      'unless',
    +      'view',
    +      'with',
    +      'yield'
    +    ].join(" ")
    +  };
    +
    +  const LITERALS = {
    +    literal: [
    +      'true',
    +      'false',
    +      'undefined',
    +      'null'
    +    ].join(" ")
    +  };
    +
    +  // as defined in https://handlebarsjs.com/guide/expressions.html#literal-segments
    +  // this regex matches literal segments like ' abc ' or [ abc ] as well as helpers and paths
    +  // like a/b, ./abc/cde, and abc.bcd
    +
    +  const DOUBLE_QUOTED_ID_REGEX = /""|"[^"]+"/;
    +  const SINGLE_QUOTED_ID_REGEX = /''|'[^']+'/;
    +  const BRACKET_QUOTED_ID_REGEX = /\[\]|\[[^\]]+\]/;
    +  const PLAIN_ID_REGEX = /[^\s!"#%&'()*+,.\/;<=>@\[\\\]^`{|}~]+/;
    +  const PATH_DELIMITER_REGEX = /(\.|\/)/;
    +  const ANY_ID = either(
    +    DOUBLE_QUOTED_ID_REGEX,
    +    SINGLE_QUOTED_ID_REGEX,
    +    BRACKET_QUOTED_ID_REGEX,
    +    PLAIN_ID_REGEX
    +    );
    +
    +  const IDENTIFIER_REGEX = concat(
    +    optional(/\.|\.\/|\//), // relative or absolute path
    +    ANY_ID,
    +    anyNumberOfTimes(concat(
    +      PATH_DELIMITER_REGEX,
    +      ANY_ID
    +    ))
    +  );
    +
    +  // identifier followed by a equal-sign (without the equal sign)
    +  const HASH_PARAM_REGEX = concat(
    +    '(',
    +    BRACKET_QUOTED_ID_REGEX, '|',
    +    PLAIN_ID_REGEX,
    +    ')(?==)'
    +  );
    +
    +  const HELPER_NAME_OR_PATH_EXPRESSION = {
    +    begin: IDENTIFIER_REGEX,
    +    lexemes: /[\w.\/]+/
    +  };
    +
    +  const HELPER_PARAMETER = hljs.inherit(HELPER_NAME_OR_PATH_EXPRESSION, {
    +    keywords: LITERALS
    +  });
    +
    +  const SUB_EXPRESSION = {
    +    begin: /\(/,
    +    end: /\)/
    +    // the "contains" is added below when all necessary sub-modes are defined
    +  };
    +
    +  const HASH = {
    +    // fka "attribute-assignment", parameters of the form 'key=value'
    +    className: 'attr',
    +    begin: HASH_PARAM_REGEX,
    +    relevance: 0,
    +    starts: {
    +      begin: /=/,
    +      end: /=/,
    +      starts: {
    +        contains: [
    +          hljs.NUMBER_MODE,
    +          hljs.QUOTE_STRING_MODE,
    +          hljs.APOS_STRING_MODE,
    +          HELPER_PARAMETER,
    +          SUB_EXPRESSION
    +        ]
    +      }
    +    }
    +  };
    +
    +  const BLOCK_PARAMS = {
    +    // parameters of the form '{{#with x as | y |}}...{{/with}}'
    +    begin: /as\s+\|/,
    +    keywords: {
    +      keyword: 'as'
    +    },
    +    end: /\|/,
    +    contains: [
    +      {
    +        // define sub-mode in order to prevent highlighting of block-parameter named "as"
    +        begin: /\w+/
    +      }
    +    ]
    +  };
    +
    +  const HELPER_PARAMETERS = {
    +    contains: [
    +      hljs.NUMBER_MODE,
    +      hljs.QUOTE_STRING_MODE,
    +      hljs.APOS_STRING_MODE,
    +      BLOCK_PARAMS,
    +      HASH,
    +      HELPER_PARAMETER,
    +      SUB_EXPRESSION
    +    ],
    +    returnEnd: true
    +    // the property "end" is defined through inheritance when the mode is used. If depends
    +    // on the surrounding mode, but "endsWithParent" does not work here (i.e. it includes the
    +    // end-token of the surrounding mode)
    +  };
    +
    +  const SUB_EXPRESSION_CONTENTS = hljs.inherit(HELPER_NAME_OR_PATH_EXPRESSION, {
    +    className: 'name',
    +    keywords: BUILT_INS,
    +    starts: hljs.inherit(HELPER_PARAMETERS, {
    +      end: /\)/
    +    })
    +  });
    +
    +  SUB_EXPRESSION.contains = [SUB_EXPRESSION_CONTENTS];
    +
    +  const OPENING_BLOCK_MUSTACHE_CONTENTS = hljs.inherit(HELPER_NAME_OR_PATH_EXPRESSION, {
    +    keywords: BUILT_INS,
    +    className: 'name',
    +    starts: hljs.inherit(HELPER_PARAMETERS, {
    +      end: /\}\}/
    +    })
    +  });
    +
    +  const CLOSING_BLOCK_MUSTACHE_CONTENTS = hljs.inherit(HELPER_NAME_OR_PATH_EXPRESSION, {
    +    keywords: BUILT_INS,
    +    className: 'name'
    +  });
    +
    +  const BASIC_MUSTACHE_CONTENTS = hljs.inherit(HELPER_NAME_OR_PATH_EXPRESSION, {
    +    className: 'name',
    +    keywords: BUILT_INS,
    +    starts: hljs.inherit(HELPER_PARAMETERS, {
    +      end: /\}\}/
    +    })
    +  });
    +
    +  const ESCAPE_MUSTACHE_WITH_PRECEEDING_BACKSLASH = {
    +    begin: /\\\{\{/,
    +    skip: true
    +  };
    +  const PREVENT_ESCAPE_WITH_ANOTHER_PRECEEDING_BACKSLASH = {
    +    begin: /\\\\(?=\{\{)/,
    +    skip: true
    +  };
    +
    +  return {
    +    name: 'Handlebars',
    +    aliases: [
    +      'hbs',
    +      'html.hbs',
    +      'html.handlebars',
    +      'htmlbars'
    +    ],
    +    case_insensitive: true,
    +    subLanguage: 'xml',
    +    contains: [
    +      ESCAPE_MUSTACHE_WITH_PRECEEDING_BACKSLASH,
    +      PREVENT_ESCAPE_WITH_ANOTHER_PRECEEDING_BACKSLASH,
    +      hljs.COMMENT(/\{\{!--/, /--\}\}/),
    +      hljs.COMMENT(/\{\{!/, /\}\}/),
    +      {
    +        // open raw block "{{{{raw}}}} content not evaluated {{{{/raw}}}}"
    +        className: 'template-tag',
    +        begin: /\{\{\{\{(?!\/)/,
    +        end: /\}\}\}\}/,
    +        contains: [OPENING_BLOCK_MUSTACHE_CONTENTS],
    +        starts: {
    +          end: /\{\{\{\{\//,
    +          returnEnd: true,
    +          subLanguage: 'xml'
    +        }
    +      },
    +      {
    +        // close raw block
    +        className: 'template-tag',
    +        begin: /\{\{\{\{\//,
    +        end: /\}\}\}\}/,
    +        contains: [CLOSING_BLOCK_MUSTACHE_CONTENTS]
    +      },
    +      {
    +        // open block statement
    +        className: 'template-tag',
    +        begin: /\{\{#/,
    +        end: /\}\}/,
    +        contains: [OPENING_BLOCK_MUSTACHE_CONTENTS]
    +      },
    +      {
    +        className: 'template-tag',
    +        begin: /\{\{(?=else\}\})/,
    +        end: /\}\}/,
    +        keywords: 'else'
    +      },
    +      {
    +        className: 'template-tag',
    +        begin: /\{\{(?=else if)/,
    +        end: /\}\}/,
    +        keywords: 'else if'
    +      },
    +      {
    +        // closing block statement
    +        className: 'template-tag',
    +        begin: /\{\{\//,
    +        end: /\}\}/,
    +        contains: [CLOSING_BLOCK_MUSTACHE_CONTENTS]
    +      },
    +      {
    +        // template variable or helper-call that is NOT html-escaped
    +        className: 'template-variable',
    +        begin: /\{\{\{/,
    +        end: /\}\}\}/,
    +        contains: [BASIC_MUSTACHE_CONTENTS]
    +      },
    +      {
    +        // template variable or helper-call that is html-escaped
    +        className: 'template-variable',
    +        begin: /\{\{/,
    +        end: /\}\}/,
    +        contains: [BASIC_MUSTACHE_CONTENTS]
    +      }
    +    ]
    +  };
    +}
    +
    +/*
    + Language: HTMLBars (legacy)
    + Requires: xml.js
    + Description: Matcher for Handlebars as well as EmberJS additions.
    + Website: https://github.com/tildeio/htmlbars
    + Category: template
    + */
    +
    +function htmlbars(hljs) {
    +  const definition = handlebars(hljs);
    +
    +  definition.name = "HTMLbars";
    +
    +  // HACK: This lets handlebars do the auto-detection if it's been loaded (by
    +  // default the build script will load in alphabetical order) and if not (perhaps
    +  // an install is only using `htmlbars`, not `handlebars`) then this will still
    +  // allow HTMLBars to participate in the auto-detection
    +
    +  // worse case someone will have HTMLbars and handlebars competing for the same
    +  // content and will need to change their setup to only require handlebars, but
    +  // I don't consider this a breaking change
    +  if (hljs.getLanguage("handlebars")) {
    +    definition.disableAutodetect = true;
    +  }
    +
    +  return definition;
    +}
    +
    +module.exports = htmlbars;
    diff --git a/node_modules/highlight.js/lib/languages/http.js b/node_modules/highlight.js/lib/languages/http.js
    new file mode 100644
    index 0000000..1c9fece
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/http.js
    @@ -0,0 +1,51 @@
    +/*
    +Language: HTTP
    +Description: HTTP request and response headers with automatic body highlighting
    +Author: Ivan Sagalaev 
    +Category: common, protocols
    +Website: https://developer.mozilla.org/en-US/docs/Web/HTTP/Overview
    +*/
    +
    +function http(hljs) {
    +  var VERSION = 'HTTP/[0-9\\.]+';
    +  return {
    +    name: 'HTTP',
    +    aliases: ['https'],
    +    illegal: '\\S',
    +    contains: [
    +      {
    +        begin: '^' + VERSION, end: '$',
    +        contains: [{className: 'number', begin: '\\b\\d{3}\\b'}]
    +      },
    +      {
    +        begin: '^[A-Z]+ (.*?) ' + VERSION + '$', returnBegin: true, end: '$',
    +        contains: [
    +          {
    +            className: 'string',
    +            begin: ' ', end: ' ',
    +            excludeBegin: true, excludeEnd: true
    +          },
    +          {
    +            begin: VERSION
    +          },
    +          {
    +            className: 'keyword',
    +            begin: '[A-Z]+'
    +          }
    +        ]
    +      },
    +      {
    +        className: 'attribute',
    +        begin: '^\\w', end: ': ', excludeEnd: true,
    +        illegal: '\\n|\\s|=',
    +        starts: {end: '$', relevance: 0}
    +      },
    +      {
    +        begin: '\\n\\n',
    +        starts: {subLanguage: [], endsWithParent: true}
    +      }
    +    ]
    +  };
    +}
    +
    +module.exports = http;
    diff --git a/node_modules/highlight.js/lib/languages/hy.js b/node_modules/highlight.js/lib/languages/hy.js
    new file mode 100644
    index 0000000..43ff6ba
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/hy.js
    @@ -0,0 +1,109 @@
    +/*
    +Language: Hy
    +Description: Hy is a wonderful dialect of Lisp that’s embedded in Python.
    +Author: Sergey Sobko 
    +Website: http://docs.hylang.org/en/stable/
    +Category: lisp
    +*/
    +
    +function hy(hljs) {
    +  var SYMBOLSTART = 'a-zA-Z_\\-!.?+*=<>&#\'';
    +  var SYMBOL_RE = '[' + SYMBOLSTART + '][' + SYMBOLSTART + '0-9/;:]*';
    +  var keywords = {
    +    $pattern: SYMBOL_RE,
    +    'builtin-name':
    +      // keywords
    +      '!= % %= & &= * ** **= *= *map ' +
    +      '+ += , --build-class-- --import-- -= . / // //= ' +
    +      '/= < << <<= <= = > >= >> >>= ' +
    +      '@ @= ^ ^= abs accumulate all and any ap-compose ' +
    +      'ap-dotimes ap-each ap-each-while ap-filter ap-first ap-if ap-last ap-map ap-map-when ap-pipe ' +
    +      'ap-reduce ap-reject apply as-> ascii assert assoc bin break butlast ' +
    +      'callable calling-module-name car case cdr chain chr coll? combinations compile ' +
    +      'compress cond cons cons? continue count curry cut cycle dec ' +
    +      'def default-method defclass defmacro defmacro-alias defmacro/g! defmain defmethod defmulti defn ' +
    +      'defn-alias defnc defnr defreader defseq del delattr delete-route dict-comp dir ' +
    +      'disassemble dispatch-reader-macro distinct divmod do doto drop drop-last drop-while empty? ' +
    +      'end-sequence eval eval-and-compile eval-when-compile even? every? except exec filter first ' +
    +      'flatten float? fn fnc fnr for for* format fraction genexpr ' +
    +      'gensym get getattr global globals group-by hasattr hash hex id ' +
    +      'identity if if* if-not if-python2 import in inc input instance? ' +
    +      'integer integer-char? integer? interleave interpose is is-coll is-cons is-empty is-even ' +
    +      'is-every is-float is-instance is-integer is-integer-char is-iterable is-iterator is-keyword is-neg is-none ' +
    +      'is-not is-numeric is-odd is-pos is-string is-symbol is-zero isinstance islice issubclass ' +
    +      'iter iterable? iterate iterator? keyword keyword? lambda last len let ' +
    +      'lif lif-not list* list-comp locals loop macro-error macroexpand macroexpand-1 macroexpand-all ' +
    +      'map max merge-with method-decorator min multi-decorator multicombinations name neg? next ' +
    +      'none? nonlocal not not-in not? nth numeric? oct odd? open ' +
    +      'or ord partition permutations pos? post-route postwalk pow prewalk print ' +
    +      'product profile/calls profile/cpu put-route quasiquote quote raise range read read-str ' +
    +      'recursive-replace reduce remove repeat repeatedly repr require rest round route ' +
    +      'route-with-methods rwm second seq set-comp setattr setv some sorted string ' +
    +      'string? sum switch symbol? take take-nth take-while tee try unless ' +
    +      'unquote unquote-splicing vars walk when while with with* with-decorator with-gensyms ' +
    +      'xi xor yield yield-from zero? zip zip-longest | |= ~'
    +   };
    +
    +  var SIMPLE_NUMBER_RE = '[-+]?\\d+(\\.\\d+)?';
    +
    +  var SYMBOL = {
    +    begin: SYMBOL_RE,
    +    relevance: 0
    +  };
    +  var NUMBER = {
    +    className: 'number', begin: SIMPLE_NUMBER_RE,
    +    relevance: 0
    +  };
    +  var STRING = hljs.inherit(hljs.QUOTE_STRING_MODE, {illegal: null});
    +  var COMMENT = hljs.COMMENT(
    +    ';',
    +    '$',
    +    {
    +      relevance: 0
    +    }
    +  );
    +  var LITERAL = {
    +    className: 'literal',
    +    begin: /\b([Tt]rue|[Ff]alse|nil|None)\b/
    +  };
    +  var COLLECTION = {
    +    begin: '[\\[\\{]', end: '[\\]\\}]'
    +  };
    +  var HINT = {
    +    className: 'comment',
    +    begin: '\\^' + SYMBOL_RE
    +  };
    +  var HINT_COL = hljs.COMMENT('\\^\\{', '\\}');
    +  var KEY = {
    +    className: 'symbol',
    +    begin: '[:]{1,2}' + SYMBOL_RE
    +  };
    +  var LIST = {
    +    begin: '\\(', end: '\\)'
    +  };
    +  var BODY = {
    +    endsWithParent: true,
    +    relevance: 0
    +  };
    +  var NAME = {
    +    className: 'name',
    +    relevance: 0,
    +    keywords: keywords,
    +    begin: SYMBOL_RE,
    +    starts: BODY
    +  };
    +  var DEFAULT_CONTAINS = [LIST, STRING, HINT, HINT_COL, COMMENT, KEY, COLLECTION, NUMBER, LITERAL, SYMBOL];
    +
    +  LIST.contains = [hljs.COMMENT('comment', ''), NAME, BODY];
    +  BODY.contains = DEFAULT_CONTAINS;
    +  COLLECTION.contains = DEFAULT_CONTAINS;
    +
    +  return {
    +    name: 'Hy',
    +    aliases: ['hylang'],
    +    illegal: /\S/,
    +    contains: [hljs.SHEBANG(), LIST, STRING, HINT, HINT_COL, COMMENT, KEY, COLLECTION, NUMBER, LITERAL]
    +  };
    +}
    +
    +module.exports = hy;
    diff --git a/node_modules/highlight.js/lib/languages/inform7.js b/node_modules/highlight.js/lib/languages/inform7.js
    new file mode 100644
    index 0000000..8570468
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/inform7.js
    @@ -0,0 +1,70 @@
    +/*
    +Language: Inform 7
    +Author: Bruno Dias 
    +Description: Language definition for Inform 7, a DSL for writing parser interactive fiction.
    +Website: http://inform7.com
    +*/
    +
    +function inform7(hljs) {
    +  const START_BRACKET = '\\[';
    +  const END_BRACKET = '\\]';
    +  return {
    +    name: 'Inform 7',
    +    aliases: ['i7'],
    +    case_insensitive: true,
    +    keywords: {
    +      // Some keywords more or less unique to I7, for relevance.
    +      keyword:
    +        // kind:
    +        'thing room person man woman animal container ' +
    +        'supporter backdrop door ' +
    +        // characteristic:
    +        'scenery open closed locked inside gender ' +
    +        // verb:
    +        'is are say understand ' +
    +        // misc keyword:
    +        'kind of rule'
    +    },
    +    contains: [
    +      {
    +        className: 'string',
    +        begin: '"',
    +        end: '"',
    +        relevance: 0,
    +        contains: [
    +          {
    +            className: 'subst',
    +            begin: START_BRACKET,
    +            end: END_BRACKET
    +          }
    +        ]
    +      },
    +      {
    +        className: 'section',
    +        begin: /^(Volume|Book|Part|Chapter|Section|Table)\b/,
    +        end: '$'
    +      },
    +      {
    +        // Rule definition
    +        // This is here for relevance.
    +        begin: /^(Check|Carry out|Report|Instead of|To|Rule|When|Before|After)\b/,
    +        end: ':',
    +        contains: [
    +          {
    +            // Rule name
    +            begin: '\\(This',
    +            end: '\\)'
    +          }
    +        ]
    +      },
    +      {
    +        className: 'comment',
    +        begin: START_BRACKET,
    +        end: END_BRACKET,
    +        contains: ['self']
    +      }
    +    ]
    +  };
    +}
    +
    +module.exports = inform7;
    diff --git a/node_modules/highlight.js/lib/languages/ini.js b/node_modules/highlight.js/lib/languages/ini.js
    new file mode 100644
    index 0000000..1e02731
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/ini.js
    @@ -0,0 +1,173 @@
    +/**
    + * @param {string} value
    + * @returns {RegExp}
    + * */
    +
    +/**
    + * @param {RegExp | string } re
    + * @returns {string}
    + */
    +function source(re) {
    +  if (!re) return null;
    +  if (typeof re === "string") return re;
    +
    +  return re.source;
    +}
    +
    +/**
    + * @param {RegExp | string } re
    + * @returns {string}
    + */
    +function lookahead(re) {
    +  return concat('(?=', re, ')');
    +}
    +
    +/**
    + * @param {...(RegExp | string) } args
    + * @returns {string}
    + */
    +function concat(...args) {
    +  const joined = args.map((x) => source(x)).join("");
    +  return joined;
    +}
    +
    +/**
    + * Any of the passed expresssions may match
    + *
    + * Creates a huge this | this | that | that match
    + * @param {(RegExp | string)[] } args
    + * @returns {string}
    + */
    +function either(...args) {
    +  const joined = '(' + args.map((x) => source(x)).join("|") + ")";
    +  return joined;
    +}
    +
    +/*
    +Language: TOML, also INI
    +Description: TOML aims to be a minimal configuration file format that's easy to read due to obvious semantics.
    +Contributors: Guillaume Gomez 
    +Category: common, config
    +Website: https://github.com/toml-lang/toml
    +*/
    +
    +function ini(hljs) {
    +  const NUMBERS = {
    +    className: 'number',
    +    relevance: 0,
    +    variants: [
    +      {
    +        begin: /([+-]+)?[\d]+_[\d_]+/
    +      },
    +      {
    +        begin: hljs.NUMBER_RE
    +      }
    +    ]
    +  };
    +  const COMMENTS = hljs.COMMENT();
    +  COMMENTS.variants = [
    +    {
    +      begin: /;/,
    +      end: /$/
    +    },
    +    {
    +      begin: /#/,
    +      end: /$/
    +    }
    +  ];
    +  const VARIABLES = {
    +    className: 'variable',
    +    variants: [
    +      {
    +        begin: /\$[\w\d"][\w\d_]*/
    +      },
    +      {
    +        begin: /\$\{(.*?)\}/
    +      }
    +    ]
    +  };
    +  const LITERALS = {
    +    className: 'literal',
    +    begin: /\bon|off|true|false|yes|no\b/
    +  };
    +  const STRINGS = {
    +    className: "string",
    +    contains: [hljs.BACKSLASH_ESCAPE],
    +    variants: [
    +      {
    +        begin: "'''",
    +        end: "'''",
    +        relevance: 10
    +      },
    +      {
    +        begin: '"""',
    +        end: '"""',
    +        relevance: 10
    +      },
    +      {
    +        begin: '"',
    +        end: '"'
    +      },
    +      {
    +        begin: "'",
    +        end: "'"
    +      }
    +    ]
    +  };
    +  const ARRAY = {
    +    begin: /\[/,
    +    end: /\]/,
    +    contains: [
    +      COMMENTS,
    +      LITERALS,
    +      VARIABLES,
    +      STRINGS,
    +      NUMBERS,
    +      'self'
    +    ],
    +    relevance: 0
    +  };
    +
    +  const BARE_KEY = /[A-Za-z0-9_-]+/;
    +  const QUOTED_KEY_DOUBLE_QUOTE = /"(\\"|[^"])*"/;
    +  const QUOTED_KEY_SINGLE_QUOTE = /'[^']*'/;
    +  const ANY_KEY = either(
    +    BARE_KEY, QUOTED_KEY_DOUBLE_QUOTE, QUOTED_KEY_SINGLE_QUOTE
    +  );
    +  const DOTTED_KEY = concat(
    +    ANY_KEY, '(\\s*\\.\\s*', ANY_KEY, ')*',
    +    lookahead(/\s*=\s*[^#\s]/)
    +  );
    +
    +  return {
    +    name: 'TOML, also INI',
    +    aliases: ['toml'],
    +    case_insensitive: true,
    +    illegal: /\S/,
    +    contains: [
    +      COMMENTS,
    +      {
    +        className: 'section',
    +        begin: /\[+/,
    +        end: /\]+/
    +      },
    +      {
    +        begin: DOTTED_KEY,
    +        className: 'attr',
    +        starts: {
    +          end: /$/,
    +          contains: [
    +            COMMENTS,
    +            ARRAY,
    +            LITERALS,
    +            VARIABLES,
    +            STRINGS,
    +            NUMBERS
    +          ]
    +        }
    +      }
    +    ]
    +  };
    +}
    +
    +module.exports = ini;
    diff --git a/node_modules/highlight.js/lib/languages/irpf90.js b/node_modules/highlight.js/lib/languages/irpf90.js
    new file mode 100644
    index 0000000..1f2a27a
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/irpf90.js
    @@ -0,0 +1,141 @@
    +/**
    + * @param {string} value
    + * @returns {RegExp}
    + * */
    +
    +/**
    + * @param {RegExp | string } re
    + * @returns {string}
    + */
    +function source(re) {
    +  if (!re) return null;
    +  if (typeof re === "string") return re;
    +
    +  return re.source;
    +}
    +
    +/**
    + * @param {...(RegExp | string) } args
    + * @returns {string}
    + */
    +function concat(...args) {
    +  const joined = args.map((x) => source(x)).join("");
    +  return joined;
    +}
    +
    +/*
    +Language: IRPF90
    +Author: Anthony Scemama 
    +Description: IRPF90 is an open-source Fortran code generator
    +Website: http://irpf90.ups-tlse.fr
    +Category: scientific
    +*/
    +
    +/** @type LanguageFn */
    +function irpf90(hljs) {
    +  const PARAMS = {
    +    className: 'params',
    +    begin: '\\(',
    +    end: '\\)'
    +  };
    +
    +  // regex in both fortran and irpf90 should match
    +  const OPTIONAL_NUMBER_SUFFIX = /(_[a-z_\d]+)?/;
    +  const OPTIONAL_NUMBER_EXP = /([de][+-]?\d+)?/;
    +  const NUMBER = {
    +    className: 'number',
    +    variants: [
    +      {
    +        begin: concat(/\b\d+/, /\.(\d*)/, OPTIONAL_NUMBER_EXP, OPTIONAL_NUMBER_SUFFIX)
    +      },
    +      {
    +        begin: concat(/\b\d+/, OPTIONAL_NUMBER_EXP, OPTIONAL_NUMBER_SUFFIX)
    +      },
    +      {
    +        begin: concat(/\.\d+/, OPTIONAL_NUMBER_EXP, OPTIONAL_NUMBER_SUFFIX)
    +      }
    +    ],
    +    relevance: 0
    +  };
    +
    +  const F_KEYWORDS = {
    +    literal: '.False. .True.',
    +    keyword: 'kind do while private call intrinsic where elsewhere ' +
    +      'type endtype endmodule endselect endinterface end enddo endif if forall endforall only contains default return stop then ' +
    +      'public subroutine|10 function program .and. .or. .not. .le. .eq. .ge. .gt. .lt. ' +
    +      'goto save else use module select case ' +
    +      'access blank direct exist file fmt form formatted iostat name named nextrec number opened rec recl sequential status unformatted unit ' +
    +      'continue format pause cycle exit ' +
    +      'c_null_char c_alert c_backspace c_form_feed flush wait decimal round iomsg ' +
    +      'synchronous nopass non_overridable pass protected volatile abstract extends import ' +
    +      'non_intrinsic value deferred generic final enumerator class associate bind enum ' +
    +      'c_int c_short c_long c_long_long c_signed_char c_size_t c_int8_t c_int16_t c_int32_t c_int64_t c_int_least8_t c_int_least16_t ' +
    +      'c_int_least32_t c_int_least64_t c_int_fast8_t c_int_fast16_t c_int_fast32_t c_int_fast64_t c_intmax_t C_intptr_t c_float c_double ' +
    +      'c_long_double c_float_complex c_double_complex c_long_double_complex c_bool c_char c_null_ptr c_null_funptr ' +
    +      'c_new_line c_carriage_return c_horizontal_tab c_vertical_tab iso_c_binding c_loc c_funloc c_associated  c_f_pointer ' +
    +      'c_ptr c_funptr iso_fortran_env character_storage_size error_unit file_storage_size input_unit iostat_end iostat_eor ' +
    +      'numeric_storage_size output_unit c_f_procpointer ieee_arithmetic ieee_support_underflow_control ' +
    +      'ieee_get_underflow_mode ieee_set_underflow_mode newunit contiguous recursive ' +
    +      'pad position action delim readwrite eor advance nml interface procedure namelist include sequence elemental pure ' +
    +      'integer real character complex logical dimension allocatable|10 parameter ' +
    +      'external implicit|10 none double precision assign intent optional pointer ' +
    +      'target in out common equivalence data ' +
    +      // IRPF90 special keywords
    +      'begin_provider &begin_provider end_provider begin_shell end_shell begin_template end_template subst assert touch ' +
    +      'soft_touch provide no_dep free irp_if irp_else irp_endif irp_write irp_read',
    +    built_in: 'alog alog10 amax0 amax1 amin0 amin1 amod cabs ccos cexp clog csin csqrt dabs dacos dasin datan datan2 dcos dcosh ddim dexp dint ' +
    +      'dlog dlog10 dmax1 dmin1 dmod dnint dsign dsin dsinh dsqrt dtan dtanh float iabs idim idint idnint ifix isign max0 max1 min0 min1 sngl ' +
    +      'algama cdabs cdcos cdexp cdlog cdsin cdsqrt cqabs cqcos cqexp cqlog cqsin cqsqrt dcmplx dconjg derf derfc dfloat dgamma dimag dlgama ' +
    +      'iqint qabs qacos qasin qatan qatan2 qcmplx qconjg qcos qcosh qdim qerf qerfc qexp qgamma qimag qlgama qlog qlog10 qmax1 qmin1 qmod ' +
    +      'qnint qsign qsin qsinh qsqrt qtan qtanh abs acos aimag aint anint asin atan atan2 char cmplx conjg cos cosh exp ichar index int log ' +
    +      'log10 max min nint sign sin sinh sqrt tan tanh print write dim lge lgt lle llt mod nullify allocate deallocate ' +
    +      'adjustl adjustr all allocated any associated bit_size btest ceiling count cshift date_and_time digits dot_product ' +
    +      'eoshift epsilon exponent floor fraction huge iand ibclr ibits ibset ieor ior ishft ishftc lbound len_trim matmul ' +
    +      'maxexponent maxloc maxval merge minexponent minloc minval modulo mvbits nearest pack present product ' +
    +      'radix random_number random_seed range repeat reshape rrspacing scale scan selected_int_kind selected_real_kind ' +
    +      'set_exponent shape size spacing spread sum system_clock tiny transpose trim ubound unpack verify achar iachar transfer ' +
    +      'dble entry dprod cpu_time command_argument_count get_command get_command_argument get_environment_variable is_iostat_end ' +
    +      'ieee_arithmetic ieee_support_underflow_control ieee_get_underflow_mode ieee_set_underflow_mode ' +
    +      'is_iostat_eor move_alloc new_line selected_char_kind same_type_as extends_type_of ' +
    +      'acosh asinh atanh bessel_j0 bessel_j1 bessel_jn bessel_y0 bessel_y1 bessel_yn erf erfc erfc_scaled gamma log_gamma hypot norm2 ' +
    +      'atomic_define atomic_ref execute_command_line leadz trailz storage_size merge_bits ' +
    +      'bge bgt ble blt dshiftl dshiftr findloc iall iany iparity image_index lcobound ucobound maskl maskr ' +
    +      'num_images parity popcnt poppar shifta shiftl shiftr this_image ' +
    +      // IRPF90 special built_ins
    +      'IRP_ALIGN irp_here'
    +  };
    +  return {
    +    name: 'IRPF90',
    +    case_insensitive: true,
    +    keywords: F_KEYWORDS,
    +    illegal: /\/\*/,
    +    contains: [
    +      hljs.inherit(hljs.APOS_STRING_MODE, {
    +        className: 'string',
    +        relevance: 0
    +      }),
    +      hljs.inherit(hljs.QUOTE_STRING_MODE, {
    +        className: 'string',
    +        relevance: 0
    +      }),
    +      {
    +        className: 'function',
    +        beginKeywords: 'subroutine function program',
    +        illegal: '[${=\\n]',
    +        contains: [
    +          hljs.UNDERSCORE_TITLE_MODE,
    +          PARAMS
    +        ]
    +      },
    +      hljs.COMMENT('!', '$', {
    +        relevance: 0
    +      }),
    +      hljs.COMMENT('begin_doc', 'end_doc', {
    +        relevance: 10
    +      }),
    +      NUMBER
    +    ]
    +  };
    +}
    +
    +module.exports = irpf90;
    diff --git a/node_modules/highlight.js/lib/languages/isbl.js b/node_modules/highlight.js/lib/languages/isbl.js
    new file mode 100644
    index 0000000..7d25e2d
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/isbl.js
    @@ -0,0 +1,3208 @@
    +/*
    +Language: ISBL
    +Author: Dmitriy Tarasov 
    +Description: built-in language DIRECTUM
    +Category: enterprise
    +*/
    +
    +function isbl(hljs) {
    +  // Определение идентификаторов
    +  const UNDERSCORE_IDENT_RE = "[A-Za-zА-Яа-яёЁ_!][A-Za-zА-Яа-яёЁ_0-9]*";
    +
    +  // Определение имен функций
    +  const FUNCTION_NAME_IDENT_RE = "[A-Za-zА-Яа-яёЁ_][A-Za-zА-Яа-яёЁ_0-9]*";
    +
    +  // keyword : ключевые слова
    +  const KEYWORD =
    +    "and и else иначе endexcept endfinally endforeach конецвсе endif конецесли endwhile конецпока " +
    +    "except exitfor finally foreach все if если in в not не or или try while пока ";
    +
    +  // SYSRES Constants
    +  const sysres_constants =
    +    "SYSRES_CONST_ACCES_RIGHT_TYPE_EDIT " +
    +    "SYSRES_CONST_ACCES_RIGHT_TYPE_FULL " +
    +    "SYSRES_CONST_ACCES_RIGHT_TYPE_VIEW " +
    +    "SYSRES_CONST_ACCESS_MODE_REQUISITE_CODE " +
    +    "SYSRES_CONST_ACCESS_NO_ACCESS_VIEW " +
    +    "SYSRES_CONST_ACCESS_NO_ACCESS_VIEW_CODE " +
    +    "SYSRES_CONST_ACCESS_RIGHTS_ADD_REQUISITE_CODE " +
    +    "SYSRES_CONST_ACCESS_RIGHTS_ADD_REQUISITE_YES_CODE " +
    +    "SYSRES_CONST_ACCESS_RIGHTS_CHANGE_REQUISITE_CODE " +
    +    "SYSRES_CONST_ACCESS_RIGHTS_CHANGE_REQUISITE_YES_CODE " +
    +    "SYSRES_CONST_ACCESS_RIGHTS_DELETE_REQUISITE_CODE " +
    +    "SYSRES_CONST_ACCESS_RIGHTS_DELETE_REQUISITE_YES_CODE " +
    +    "SYSRES_CONST_ACCESS_RIGHTS_EXECUTE_REQUISITE_CODE " +
    +    "SYSRES_CONST_ACCESS_RIGHTS_EXECUTE_REQUISITE_YES_CODE " +
    +    "SYSRES_CONST_ACCESS_RIGHTS_NO_ACCESS_REQUISITE_CODE " +
    +    "SYSRES_CONST_ACCESS_RIGHTS_NO_ACCESS_REQUISITE_YES_CODE " +
    +    "SYSRES_CONST_ACCESS_RIGHTS_RATIFY_REQUISITE_CODE " +
    +    "SYSRES_CONST_ACCESS_RIGHTS_RATIFY_REQUISITE_YES_CODE " +
    +    "SYSRES_CONST_ACCESS_RIGHTS_REQUISITE_CODE " +
    +    "SYSRES_CONST_ACCESS_RIGHTS_VIEW " +
    +    "SYSRES_CONST_ACCESS_RIGHTS_VIEW_CODE " +
    +    "SYSRES_CONST_ACCESS_RIGHTS_VIEW_REQUISITE_CODE " +
    +    "SYSRES_CONST_ACCESS_RIGHTS_VIEW_REQUISITE_YES_CODE " +
    +    "SYSRES_CONST_ACCESS_TYPE_CHANGE " +
    +    "SYSRES_CONST_ACCESS_TYPE_CHANGE_CODE " +
    +    "SYSRES_CONST_ACCESS_TYPE_EXISTS " +
    +    "SYSRES_CONST_ACCESS_TYPE_EXISTS_CODE " +
    +    "SYSRES_CONST_ACCESS_TYPE_FULL " +
    +    "SYSRES_CONST_ACCESS_TYPE_FULL_CODE " +
    +    "SYSRES_CONST_ACCESS_TYPE_VIEW " +
    +    "SYSRES_CONST_ACCESS_TYPE_VIEW_CODE " +
    +    "SYSRES_CONST_ACTION_TYPE_ABORT " +
    +    "SYSRES_CONST_ACTION_TYPE_ACCEPT " +
    +    "SYSRES_CONST_ACTION_TYPE_ACCESS_RIGHTS " +
    +    "SYSRES_CONST_ACTION_TYPE_ADD_ATTACHMENT " +
    +    "SYSRES_CONST_ACTION_TYPE_CHANGE_CARD " +
    +    "SYSRES_CONST_ACTION_TYPE_CHANGE_KIND " +
    +    "SYSRES_CONST_ACTION_TYPE_CHANGE_STORAGE " +
    +    "SYSRES_CONST_ACTION_TYPE_CONTINUE " +
    +    "SYSRES_CONST_ACTION_TYPE_COPY " +
    +    "SYSRES_CONST_ACTION_TYPE_CREATE " +
    +    "SYSRES_CONST_ACTION_TYPE_CREATE_VERSION " +
    +    "SYSRES_CONST_ACTION_TYPE_DELETE " +
    +    "SYSRES_CONST_ACTION_TYPE_DELETE_ATTACHMENT " +
    +    "SYSRES_CONST_ACTION_TYPE_DELETE_VERSION " +
    +    "SYSRES_CONST_ACTION_TYPE_DISABLE_DELEGATE_ACCESS_RIGHTS " +
    +    "SYSRES_CONST_ACTION_TYPE_ENABLE_DELEGATE_ACCESS_RIGHTS " +
    +    "SYSRES_CONST_ACTION_TYPE_ENCRYPTION_BY_CERTIFICATE " +
    +    "SYSRES_CONST_ACTION_TYPE_ENCRYPTION_BY_CERTIFICATE_AND_PASSWORD " +
    +    "SYSRES_CONST_ACTION_TYPE_ENCRYPTION_BY_PASSWORD " +
    +    "SYSRES_CONST_ACTION_TYPE_EXPORT_WITH_LOCK " +
    +    "SYSRES_CONST_ACTION_TYPE_EXPORT_WITHOUT_LOCK " +
    +    "SYSRES_CONST_ACTION_TYPE_IMPORT_WITH_UNLOCK " +
    +    "SYSRES_CONST_ACTION_TYPE_IMPORT_WITHOUT_UNLOCK " +
    +    "SYSRES_CONST_ACTION_TYPE_LIFE_CYCLE_STAGE " +
    +    "SYSRES_CONST_ACTION_TYPE_LOCK " +
    +    "SYSRES_CONST_ACTION_TYPE_LOCK_FOR_SERVER " +
    +    "SYSRES_CONST_ACTION_TYPE_LOCK_MODIFY " +
    +    "SYSRES_CONST_ACTION_TYPE_MARK_AS_READED " +
    +    "SYSRES_CONST_ACTION_TYPE_MARK_AS_UNREADED " +
    +    "SYSRES_CONST_ACTION_TYPE_MODIFY " +
    +    "SYSRES_CONST_ACTION_TYPE_MODIFY_CARD " +
    +    "SYSRES_CONST_ACTION_TYPE_MOVE_TO_ARCHIVE " +
    +    "SYSRES_CONST_ACTION_TYPE_OFF_ENCRYPTION " +
    +    "SYSRES_CONST_ACTION_TYPE_PASSWORD_CHANGE " +
    +    "SYSRES_CONST_ACTION_TYPE_PERFORM " +
    +    "SYSRES_CONST_ACTION_TYPE_RECOVER_FROM_LOCAL_COPY " +
    +    "SYSRES_CONST_ACTION_TYPE_RESTART " +
    +    "SYSRES_CONST_ACTION_TYPE_RESTORE_FROM_ARCHIVE " +
    +    "SYSRES_CONST_ACTION_TYPE_REVISION " +
    +    "SYSRES_CONST_ACTION_TYPE_SEND_BY_MAIL " +
    +    "SYSRES_CONST_ACTION_TYPE_SIGN " +
    +    "SYSRES_CONST_ACTION_TYPE_START " +
    +    "SYSRES_CONST_ACTION_TYPE_UNLOCK " +
    +    "SYSRES_CONST_ACTION_TYPE_UNLOCK_FROM_SERVER " +
    +    "SYSRES_CONST_ACTION_TYPE_VERSION_STATE " +
    +    "SYSRES_CONST_ACTION_TYPE_VERSION_VISIBILITY " +
    +    "SYSRES_CONST_ACTION_TYPE_VIEW " +
    +    "SYSRES_CONST_ACTION_TYPE_VIEW_SHADOW_COPY " +
    +    "SYSRES_CONST_ACTION_TYPE_WORKFLOW_DESCRIPTION_MODIFY " +
    +    "SYSRES_CONST_ACTION_TYPE_WRITE_HISTORY " +
    +    "SYSRES_CONST_ACTIVE_VERSION_STATE_PICK_VALUE " +
    +    "SYSRES_CONST_ADD_REFERENCE_MODE_NAME " +
    +    "SYSRES_CONST_ADDITION_REQUISITE_CODE " +
    +    "SYSRES_CONST_ADDITIONAL_PARAMS_REQUISITE_CODE " +
    +    "SYSRES_CONST_ADITIONAL_JOB_END_DATE_REQUISITE_NAME " +
    +    "SYSRES_CONST_ADITIONAL_JOB_READ_REQUISITE_NAME " +
    +    "SYSRES_CONST_ADITIONAL_JOB_START_DATE_REQUISITE_NAME " +
    +    "SYSRES_CONST_ADITIONAL_JOB_STATE_REQUISITE_NAME " +
    +    "SYSRES_CONST_ADMINISTRATION_HISTORY_ADDING_USER_TO_GROUP_ACTION " +
    +    "SYSRES_CONST_ADMINISTRATION_HISTORY_ADDING_USER_TO_GROUP_ACTION_CODE " +
    +    "SYSRES_CONST_ADMINISTRATION_HISTORY_CREATION_COMP_ACTION " +
    +    "SYSRES_CONST_ADMINISTRATION_HISTORY_CREATION_COMP_ACTION_CODE " +
    +    "SYSRES_CONST_ADMINISTRATION_HISTORY_CREATION_GROUP_ACTION " +
    +    "SYSRES_CONST_ADMINISTRATION_HISTORY_CREATION_GROUP_ACTION_CODE " +
    +    "SYSRES_CONST_ADMINISTRATION_HISTORY_CREATION_USER_ACTION " +
    +    "SYSRES_CONST_ADMINISTRATION_HISTORY_CREATION_USER_ACTION_CODE " +
    +    "SYSRES_CONST_ADMINISTRATION_HISTORY_DATABASE_USER_CREATION " +
    +    "SYSRES_CONST_ADMINISTRATION_HISTORY_DATABASE_USER_CREATION_ACTION " +
    +    "SYSRES_CONST_ADMINISTRATION_HISTORY_DATABASE_USER_DELETION " +
    +    "SYSRES_CONST_ADMINISTRATION_HISTORY_DATABASE_USER_DELETION_ACTION " +
    +    "SYSRES_CONST_ADMINISTRATION_HISTORY_DELETION_COMP_ACTION " +
    +    "SYSRES_CONST_ADMINISTRATION_HISTORY_DELETION_COMP_ACTION_CODE " +
    +    "SYSRES_CONST_ADMINISTRATION_HISTORY_DELETION_GROUP_ACTION " +
    +    "SYSRES_CONST_ADMINISTRATION_HISTORY_DELETION_GROUP_ACTION_CODE " +
    +    "SYSRES_CONST_ADMINISTRATION_HISTORY_DELETION_USER_ACTION " +
    +    "SYSRES_CONST_ADMINISTRATION_HISTORY_DELETION_USER_ACTION_CODE " +
    +    "SYSRES_CONST_ADMINISTRATION_HISTORY_DELETION_USER_FROM_GROUP_ACTION " +
    +    "SYSRES_CONST_ADMINISTRATION_HISTORY_DELETION_USER_FROM_GROUP_ACTION_CODE " +
    +    "SYSRES_CONST_ADMINISTRATION_HISTORY_GRANTING_FILTERER_ACTION " +
    +    "SYSRES_CONST_ADMINISTRATION_HISTORY_GRANTING_FILTERER_ACTION_CODE " +
    +    "SYSRES_CONST_ADMINISTRATION_HISTORY_GRANTING_FILTERER_RESTRICTION_ACTION " +
    +    "SYSRES_CONST_ADMINISTRATION_HISTORY_GRANTING_FILTERER_RESTRICTION_ACTION_CODE " +
    +    "SYSRES_CONST_ADMINISTRATION_HISTORY_GRANTING_PRIVILEGE_ACTION " +
    +    "SYSRES_CONST_ADMINISTRATION_HISTORY_GRANTING_PRIVILEGE_ACTION_CODE " +
    +    "SYSRES_CONST_ADMINISTRATION_HISTORY_GRANTING_RIGHTS_ACTION " +
    +    "SYSRES_CONST_ADMINISTRATION_HISTORY_GRANTING_RIGHTS_ACTION_CODE " +
    +    "SYSRES_CONST_ADMINISTRATION_HISTORY_IS_MAIN_SERVER_CHANGED_ACTION " +
    +    "SYSRES_CONST_ADMINISTRATION_HISTORY_IS_MAIN_SERVER_CHANGED_ACTION_CODE " +
    +    "SYSRES_CONST_ADMINISTRATION_HISTORY_IS_PUBLIC_CHANGED_ACTION " +
    +    "SYSRES_CONST_ADMINISTRATION_HISTORY_IS_PUBLIC_CHANGED_ACTION_CODE " +
    +    "SYSRES_CONST_ADMINISTRATION_HISTORY_REMOVING_FILTERER_ACTION " +
    +    "SYSRES_CONST_ADMINISTRATION_HISTORY_REMOVING_FILTERER_ACTION_CODE " +
    +    "SYSRES_CONST_ADMINISTRATION_HISTORY_REMOVING_FILTERER_RESTRICTION_ACTION " +
    +    "SYSRES_CONST_ADMINISTRATION_HISTORY_REMOVING_FILTERER_RESTRICTION_ACTION_CODE " +
    +    "SYSRES_CONST_ADMINISTRATION_HISTORY_REMOVING_PRIVILEGE_ACTION " +
    +    "SYSRES_CONST_ADMINISTRATION_HISTORY_REMOVING_PRIVILEGE_ACTION_CODE " +
    +    "SYSRES_CONST_ADMINISTRATION_HISTORY_REMOVING_RIGHTS_ACTION " +
    +    "SYSRES_CONST_ADMINISTRATION_HISTORY_REMOVING_RIGHTS_ACTION_CODE " +
    +    "SYSRES_CONST_ADMINISTRATION_HISTORY_SERVER_LOGIN_CREATION " +
    +    "SYSRES_CONST_ADMINISTRATION_HISTORY_SERVER_LOGIN_CREATION_ACTION " +
    +    "SYSRES_CONST_ADMINISTRATION_HISTORY_SERVER_LOGIN_DELETION " +
    +    "SYSRES_CONST_ADMINISTRATION_HISTORY_SERVER_LOGIN_DELETION_ACTION " +
    +    "SYSRES_CONST_ADMINISTRATION_HISTORY_UPDATING_CATEGORY_ACTION " +
    +    "SYSRES_CONST_ADMINISTRATION_HISTORY_UPDATING_CATEGORY_ACTION_CODE " +
    +    "SYSRES_CONST_ADMINISTRATION_HISTORY_UPDATING_COMP_TITLE_ACTION " +
    +    "SYSRES_CONST_ADMINISTRATION_HISTORY_UPDATING_COMP_TITLE_ACTION_CODE " +
    +    "SYSRES_CONST_ADMINISTRATION_HISTORY_UPDATING_FULL_NAME_ACTION " +
    +    "SYSRES_CONST_ADMINISTRATION_HISTORY_UPDATING_FULL_NAME_ACTION_CODE " +
    +    "SYSRES_CONST_ADMINISTRATION_HISTORY_UPDATING_GROUP_ACTION " +
    +    "SYSRES_CONST_ADMINISTRATION_HISTORY_UPDATING_GROUP_ACTION_CODE " +
    +    "SYSRES_CONST_ADMINISTRATION_HISTORY_UPDATING_PARENT_GROUP_ACTION " +
    +    "SYSRES_CONST_ADMINISTRATION_HISTORY_UPDATING_PARENT_GROUP_ACTION_CODE " +
    +    "SYSRES_CONST_ADMINISTRATION_HISTORY_UPDATING_USER_AUTH_TYPE_ACTION " +
    +    "SYSRES_CONST_ADMINISTRATION_HISTORY_UPDATING_USER_AUTH_TYPE_ACTION_CODE " +
    +    "SYSRES_CONST_ADMINISTRATION_HISTORY_UPDATING_USER_LOGIN_ACTION " +
    +    "SYSRES_CONST_ADMINISTRATION_HISTORY_UPDATING_USER_LOGIN_ACTION_CODE " +
    +    "SYSRES_CONST_ADMINISTRATION_HISTORY_UPDATING_USER_STATUS_ACTION " +
    +    "SYSRES_CONST_ADMINISTRATION_HISTORY_UPDATING_USER_STATUS_ACTION_CODE " +
    +    "SYSRES_CONST_ADMINISTRATION_HISTORY_USER_PASSWORD_CHANGE " +
    +    "SYSRES_CONST_ADMINISTRATION_HISTORY_USER_PASSWORD_CHANGE_ACTION " +
    +    "SYSRES_CONST_ALL_ACCEPT_CONDITION_RUS " +
    +    "SYSRES_CONST_ALL_USERS_GROUP " +
    +    "SYSRES_CONST_ALL_USERS_GROUP_NAME " +
    +    "SYSRES_CONST_ALL_USERS_SERVER_GROUP_NAME " +
    +    "SYSRES_CONST_ALLOWED_ACCESS_TYPE_CODE " +
    +    "SYSRES_CONST_ALLOWED_ACCESS_TYPE_NAME " +
    +    "SYSRES_CONST_APP_VIEWER_TYPE_REQUISITE_CODE " +
    +    "SYSRES_CONST_APPROVING_SIGNATURE_NAME " +
    +    "SYSRES_CONST_APPROVING_SIGNATURE_REQUISITE_CODE " +
    +    "SYSRES_CONST_ASSISTANT_SUBSTITUE_TYPE " +
    +    "SYSRES_CONST_ASSISTANT_SUBSTITUE_TYPE_CODE " +
    +    "SYSRES_CONST_ATTACH_TYPE_COMPONENT_TOKEN " +
    +    "SYSRES_CONST_ATTACH_TYPE_DOC " +
    +    "SYSRES_CONST_ATTACH_TYPE_EDOC " +
    +    "SYSRES_CONST_ATTACH_TYPE_FOLDER " +
    +    "SYSRES_CONST_ATTACH_TYPE_JOB " +
    +    "SYSRES_CONST_ATTACH_TYPE_REFERENCE " +
    +    "SYSRES_CONST_ATTACH_TYPE_TASK " +
    +    "SYSRES_CONST_AUTH_ENCODED_PASSWORD " +
    +    "SYSRES_CONST_AUTH_ENCODED_PASSWORD_CODE " +
    +    "SYSRES_CONST_AUTH_NOVELL " +
    +    "SYSRES_CONST_AUTH_PASSWORD " +
    +    "SYSRES_CONST_AUTH_PASSWORD_CODE " +
    +    "SYSRES_CONST_AUTH_WINDOWS " +
    +    "SYSRES_CONST_AUTHENTICATING_SIGNATURE_NAME " +
    +    "SYSRES_CONST_AUTHENTICATING_SIGNATURE_REQUISITE_CODE " +
    +    "SYSRES_CONST_AUTO_ENUM_METHOD_FLAG " +
    +    "SYSRES_CONST_AUTO_NUMERATION_CODE " +
    +    "SYSRES_CONST_AUTO_STRONG_ENUM_METHOD_FLAG " +
    +    "SYSRES_CONST_AUTOTEXT_NAME_REQUISITE_CODE " +
    +    "SYSRES_CONST_AUTOTEXT_TEXT_REQUISITE_CODE " +
    +    "SYSRES_CONST_AUTOTEXT_USAGE_ALL " +
    +    "SYSRES_CONST_AUTOTEXT_USAGE_ALL_CODE " +
    +    "SYSRES_CONST_AUTOTEXT_USAGE_SIGN " +
    +    "SYSRES_CONST_AUTOTEXT_USAGE_SIGN_CODE " +
    +    "SYSRES_CONST_AUTOTEXT_USAGE_WORK " +
    +    "SYSRES_CONST_AUTOTEXT_USAGE_WORK_CODE " +
    +    "SYSRES_CONST_AUTOTEXT_USE_ANYWHERE_CODE " +
    +    "SYSRES_CONST_AUTOTEXT_USE_ON_SIGNING_CODE " +
    +    "SYSRES_CONST_AUTOTEXT_USE_ON_WORK_CODE " +
    +    "SYSRES_CONST_BEGIN_DATE_REQUISITE_CODE " +
    +    "SYSRES_CONST_BLACK_LIFE_CYCLE_STAGE_FONT_COLOR " +
    +    "SYSRES_CONST_BLUE_LIFE_CYCLE_STAGE_FONT_COLOR " +
    +    "SYSRES_CONST_BTN_PART " +
    +    "SYSRES_CONST_CALCULATED_ROLE_TYPE_CODE " +
    +    "SYSRES_CONST_CALL_TYPE_VARIABLE_BUTTON_VALUE " +
    +    "SYSRES_CONST_CALL_TYPE_VARIABLE_PROGRAM_VALUE " +
    +    "SYSRES_CONST_CANCEL_MESSAGE_FUNCTION_RESULT " +
    +    "SYSRES_CONST_CARD_PART " +
    +    "SYSRES_CONST_CARD_REFERENCE_MODE_NAME " +
    +    "SYSRES_CONST_CERTIFICATE_TYPE_REQUISITE_ENCRYPT_VALUE " +
    +    "SYSRES_CONST_CERTIFICATE_TYPE_REQUISITE_SIGN_AND_ENCRYPT_VALUE " +
    +    "SYSRES_CONST_CERTIFICATE_TYPE_REQUISITE_SIGN_VALUE " +
    +    "SYSRES_CONST_CHECK_PARAM_VALUE_DATE_PARAM_TYPE " +
    +    "SYSRES_CONST_CHECK_PARAM_VALUE_FLOAT_PARAM_TYPE " +
    +    "SYSRES_CONST_CHECK_PARAM_VALUE_INTEGER_PARAM_TYPE " +
    +    "SYSRES_CONST_CHECK_PARAM_VALUE_PICK_PARAM_TYPE " +
    +    "SYSRES_CONST_CHECK_PARAM_VALUE_REEFRENCE_PARAM_TYPE " +
    +    "SYSRES_CONST_CLOSED_RECORD_FLAG_VALUE_FEMININE " +
    +    "SYSRES_CONST_CLOSED_RECORD_FLAG_VALUE_MASCULINE " +
    +    "SYSRES_CONST_CODE_COMPONENT_TYPE_ADMIN " +
    +    "SYSRES_CONST_CODE_COMPONENT_TYPE_DEVELOPER " +
    +    "SYSRES_CONST_CODE_COMPONENT_TYPE_DOCS " +
    +    "SYSRES_CONST_CODE_COMPONENT_TYPE_EDOC_CARDS " +
    +    "SYSRES_CONST_CODE_COMPONENT_TYPE_EXTERNAL_EXECUTABLE " +
    +    "SYSRES_CONST_CODE_COMPONENT_TYPE_OTHER " +
    +    "SYSRES_CONST_CODE_COMPONENT_TYPE_REFERENCE " +
    +    "SYSRES_CONST_CODE_COMPONENT_TYPE_REPORT " +
    +    "SYSRES_CONST_CODE_COMPONENT_TYPE_SCRIPT " +
    +    "SYSRES_CONST_CODE_COMPONENT_TYPE_URL " +
    +    "SYSRES_CONST_CODE_REQUISITE_ACCESS " +
    +    "SYSRES_CONST_CODE_REQUISITE_CODE " +
    +    "SYSRES_CONST_CODE_REQUISITE_COMPONENT " +
    +    "SYSRES_CONST_CODE_REQUISITE_DESCRIPTION " +
    +    "SYSRES_CONST_CODE_REQUISITE_EXCLUDE_COMPONENT " +
    +    "SYSRES_CONST_CODE_REQUISITE_RECORD " +
    +    "SYSRES_CONST_COMMENT_REQ_CODE " +
    +    "SYSRES_CONST_COMMON_SETTINGS_REQUISITE_CODE " +
    +    "SYSRES_CONST_COMP_CODE_GRD " +
    +    "SYSRES_CONST_COMPONENT_GROUP_TYPE_REQUISITE_CODE " +
    +    "SYSRES_CONST_COMPONENT_TYPE_ADMIN_COMPONENTS " +
    +    "SYSRES_CONST_COMPONENT_TYPE_DEVELOPER_COMPONENTS " +
    +    "SYSRES_CONST_COMPONENT_TYPE_DOCS " +
    +    "SYSRES_CONST_COMPONENT_TYPE_EDOC_CARDS " +
    +    "SYSRES_CONST_COMPONENT_TYPE_EDOCS " +
    +    "SYSRES_CONST_COMPONENT_TYPE_EXTERNAL_EXECUTABLE " +
    +    "SYSRES_CONST_COMPONENT_TYPE_OTHER " +
    +    "SYSRES_CONST_COMPONENT_TYPE_REFERENCE_TYPES " +
    +    "SYSRES_CONST_COMPONENT_TYPE_REFERENCES " +
    +    "SYSRES_CONST_COMPONENT_TYPE_REPORTS " +
    +    "SYSRES_CONST_COMPONENT_TYPE_SCRIPTS " +
    +    "SYSRES_CONST_COMPONENT_TYPE_URL " +
    +    "SYSRES_CONST_COMPONENTS_REMOTE_SERVERS_VIEW_CODE " +
    +    "SYSRES_CONST_CONDITION_BLOCK_DESCRIPTION " +
    +    "SYSRES_CONST_CONST_FIRM_STATUS_COMMON " +
    +    "SYSRES_CONST_CONST_FIRM_STATUS_INDIVIDUAL " +
    +    "SYSRES_CONST_CONST_NEGATIVE_VALUE " +
    +    "SYSRES_CONST_CONST_POSITIVE_VALUE " +
    +    "SYSRES_CONST_CONST_SERVER_STATUS_DONT_REPLICATE " +
    +    "SYSRES_CONST_CONST_SERVER_STATUS_REPLICATE " +
    +    "SYSRES_CONST_CONTENTS_REQUISITE_CODE " +
    +    "SYSRES_CONST_DATA_TYPE_BOOLEAN " +
    +    "SYSRES_CONST_DATA_TYPE_DATE " +
    +    "SYSRES_CONST_DATA_TYPE_FLOAT " +
    +    "SYSRES_CONST_DATA_TYPE_INTEGER " +
    +    "SYSRES_CONST_DATA_TYPE_PICK " +
    +    "SYSRES_CONST_DATA_TYPE_REFERENCE " +
    +    "SYSRES_CONST_DATA_TYPE_STRING " +
    +    "SYSRES_CONST_DATA_TYPE_TEXT " +
    +    "SYSRES_CONST_DATA_TYPE_VARIANT " +
    +    "SYSRES_CONST_DATE_CLOSE_REQ_CODE " +
    +    "SYSRES_CONST_DATE_FORMAT_DATE_ONLY_CHAR " +
    +    "SYSRES_CONST_DATE_OPEN_REQ_CODE " +
    +    "SYSRES_CONST_DATE_REQUISITE " +
    +    "SYSRES_CONST_DATE_REQUISITE_CODE " +
    +    "SYSRES_CONST_DATE_REQUISITE_NAME " +
    +    "SYSRES_CONST_DATE_REQUISITE_TYPE " +
    +    "SYSRES_CONST_DATE_TYPE_CHAR " +
    +    "SYSRES_CONST_DATETIME_FORMAT_VALUE " +
    +    "SYSRES_CONST_DEA_ACCESS_RIGHTS_ACTION_CODE " +
    +    "SYSRES_CONST_DESCRIPTION_LOCALIZE_ID_REQUISITE_CODE " +
    +    "SYSRES_CONST_DESCRIPTION_REQUISITE_CODE " +
    +    "SYSRES_CONST_DET1_PART " +
    +    "SYSRES_CONST_DET2_PART " +
    +    "SYSRES_CONST_DET3_PART " +
    +    "SYSRES_CONST_DET4_PART " +
    +    "SYSRES_CONST_DET5_PART " +
    +    "SYSRES_CONST_DET6_PART " +
    +    "SYSRES_CONST_DETAIL_DATASET_KEY_REQUISITE_CODE " +
    +    "SYSRES_CONST_DETAIL_PICK_REQUISITE_CODE " +
    +    "SYSRES_CONST_DETAIL_REQ_CODE " +
    +    "SYSRES_CONST_DO_NOT_USE_ACCESS_TYPE_CODE " +
    +    "SYSRES_CONST_DO_NOT_USE_ACCESS_TYPE_NAME " +
    +    "SYSRES_CONST_DO_NOT_USE_ON_VIEW_ACCESS_TYPE_CODE " +
    +    "SYSRES_CONST_DO_NOT_USE_ON_VIEW_ACCESS_TYPE_NAME " +
    +    "SYSRES_CONST_DOCUMENT_STORAGES_CODE " +
    +    "SYSRES_CONST_DOCUMENT_TEMPLATES_TYPE_NAME " +
    +    "SYSRES_CONST_DOUBLE_REQUISITE_CODE " +
    +    "SYSRES_CONST_EDITOR_CLOSE_FILE_OBSERV_TYPE_CODE " +
    +    "SYSRES_CONST_EDITOR_CLOSE_PROCESS_OBSERV_TYPE_CODE " +
    +    "SYSRES_CONST_EDITOR_TYPE_REQUISITE_CODE " +
    +    "SYSRES_CONST_EDITORS_APPLICATION_NAME_REQUISITE_CODE " +
    +    "SYSRES_CONST_EDITORS_CREATE_SEVERAL_PROCESSES_REQUISITE_CODE " +
    +    "SYSRES_CONST_EDITORS_EXTENSION_REQUISITE_CODE " +
    +    "SYSRES_CONST_EDITORS_OBSERVER_BY_PROCESS_TYPE " +
    +    "SYSRES_CONST_EDITORS_REFERENCE_CODE " +
    +    "SYSRES_CONST_EDITORS_REPLACE_SPEC_CHARS_REQUISITE_CODE " +
    +    "SYSRES_CONST_EDITORS_USE_PLUGINS_REQUISITE_CODE " +
    +    "SYSRES_CONST_EDITORS_VIEW_DOCUMENT_OPENED_TO_EDIT_CODE " +
    +    "SYSRES_CONST_EDOC_CARD_TYPE_REQUISITE_CODE " +
    +    "SYSRES_CONST_EDOC_CARD_TYPES_LINK_REQUISITE_CODE " +
    +    "SYSRES_CONST_EDOC_CERTIFICATE_AND_PASSWORD_ENCODE_CODE " +
    +    "SYSRES_CONST_EDOC_CERTIFICATE_ENCODE_CODE " +
    +    "SYSRES_CONST_EDOC_DATE_REQUISITE_CODE " +
    +    "SYSRES_CONST_EDOC_KIND_REFERENCE_CODE " +
    +    "SYSRES_CONST_EDOC_KINDS_BY_TEMPLATE_ACTION_CODE " +
    +    "SYSRES_CONST_EDOC_MANAGE_ACCESS_CODE " +
    +    "SYSRES_CONST_EDOC_NONE_ENCODE_CODE " +
    +    "SYSRES_CONST_EDOC_NUMBER_REQUISITE_CODE " +
    +    "SYSRES_CONST_EDOC_PASSWORD_ENCODE_CODE " +
    +    "SYSRES_CONST_EDOC_READONLY_ACCESS_CODE " +
    +    "SYSRES_CONST_EDOC_SHELL_LIFE_TYPE_VIEW_VALUE " +
    +    "SYSRES_CONST_EDOC_SIZE_RESTRICTION_PRIORITY_REQUISITE_CODE " +
    +    "SYSRES_CONST_EDOC_STORAGE_CHECK_ACCESS_RIGHTS_REQUISITE_CODE " +
    +    "SYSRES_CONST_EDOC_STORAGE_COMPUTER_NAME_REQUISITE_CODE " +
    +    "SYSRES_CONST_EDOC_STORAGE_DATABASE_NAME_REQUISITE_CODE " +
    +    "SYSRES_CONST_EDOC_STORAGE_EDIT_IN_STORAGE_REQUISITE_CODE " +
    +    "SYSRES_CONST_EDOC_STORAGE_LOCAL_PATH_REQUISITE_CODE " +
    +    "SYSRES_CONST_EDOC_STORAGE_SHARED_SOURCE_NAME_REQUISITE_CODE " +
    +    "SYSRES_CONST_EDOC_TEMPLATE_REQUISITE_CODE " +
    +    "SYSRES_CONST_EDOC_TYPES_REFERENCE_CODE " +
    +    "SYSRES_CONST_EDOC_VERSION_ACTIVE_STAGE_CODE " +
    +    "SYSRES_CONST_EDOC_VERSION_DESIGN_STAGE_CODE " +
    +    "SYSRES_CONST_EDOC_VERSION_OBSOLETE_STAGE_CODE " +
    +    "SYSRES_CONST_EDOC_WRITE_ACCES_CODE " +
    +    "SYSRES_CONST_EDOCUMENT_CARD_REQUISITES_REFERENCE_CODE_SELECTED_REQUISITE " +
    +    "SYSRES_CONST_ENCODE_CERTIFICATE_TYPE_CODE " +
    +    "SYSRES_CONST_END_DATE_REQUISITE_CODE " +
    +    "SYSRES_CONST_ENUMERATION_TYPE_REQUISITE_CODE " +
    +    "SYSRES_CONST_EXECUTE_ACCESS_RIGHTS_TYPE_CODE " +
    +    "SYSRES_CONST_EXECUTIVE_FILE_STORAGE_TYPE " +
    +    "SYSRES_CONST_EXIST_CONST " +
    +    "SYSRES_CONST_EXIST_VALUE " +
    +    "SYSRES_CONST_EXPORT_LOCK_TYPE_ASK " +
    +    "SYSRES_CONST_EXPORT_LOCK_TYPE_WITH_LOCK " +
    +    "SYSRES_CONST_EXPORT_LOCK_TYPE_WITHOUT_LOCK " +
    +    "SYSRES_CONST_EXPORT_VERSION_TYPE_ASK " +
    +    "SYSRES_CONST_EXPORT_VERSION_TYPE_LAST " +
    +    "SYSRES_CONST_EXPORT_VERSION_TYPE_LAST_ACTIVE " +
    +    "SYSRES_CONST_EXTENSION_REQUISITE_CODE " +
    +    "SYSRES_CONST_FILTER_NAME_REQUISITE_CODE " +
    +    "SYSRES_CONST_FILTER_REQUISITE_CODE " +
    +    "SYSRES_CONST_FILTER_TYPE_COMMON_CODE " +
    +    "SYSRES_CONST_FILTER_TYPE_COMMON_NAME " +
    +    "SYSRES_CONST_FILTER_TYPE_USER_CODE " +
    +    "SYSRES_CONST_FILTER_TYPE_USER_NAME " +
    +    "SYSRES_CONST_FILTER_VALUE_REQUISITE_NAME " +
    +    "SYSRES_CONST_FLOAT_NUMBER_FORMAT_CHAR " +
    +    "SYSRES_CONST_FLOAT_REQUISITE_TYPE " +
    +    "SYSRES_CONST_FOLDER_AUTHOR_VALUE " +
    +    "SYSRES_CONST_FOLDER_KIND_ANY_OBJECTS " +
    +    "SYSRES_CONST_FOLDER_KIND_COMPONENTS " +
    +    "SYSRES_CONST_FOLDER_KIND_EDOCS " +
    +    "SYSRES_CONST_FOLDER_KIND_JOBS " +
    +    "SYSRES_CONST_FOLDER_KIND_TASKS " +
    +    "SYSRES_CONST_FOLDER_TYPE_COMMON " +
    +    "SYSRES_CONST_FOLDER_TYPE_COMPONENT " +
    +    "SYSRES_CONST_FOLDER_TYPE_FAVORITES " +
    +    "SYSRES_CONST_FOLDER_TYPE_INBOX " +
    +    "SYSRES_CONST_FOLDER_TYPE_OUTBOX " +
    +    "SYSRES_CONST_FOLDER_TYPE_QUICK_LAUNCH " +
    +    "SYSRES_CONST_FOLDER_TYPE_SEARCH " +
    +    "SYSRES_CONST_FOLDER_TYPE_SHORTCUTS " +
    +    "SYSRES_CONST_FOLDER_TYPE_USER " +
    +    "SYSRES_CONST_FROM_DICTIONARY_ENUM_METHOD_FLAG " +
    +    "SYSRES_CONST_FULL_SUBSTITUTE_TYPE " +
    +    "SYSRES_CONST_FULL_SUBSTITUTE_TYPE_CODE " +
    +    "SYSRES_CONST_FUNCTION_CANCEL_RESULT " +
    +    "SYSRES_CONST_FUNCTION_CATEGORY_SYSTEM " +
    +    "SYSRES_CONST_FUNCTION_CATEGORY_USER " +
    +    "SYSRES_CONST_FUNCTION_FAILURE_RESULT " +
    +    "SYSRES_CONST_FUNCTION_SAVE_RESULT " +
    +    "SYSRES_CONST_GENERATED_REQUISITE " +
    +    "SYSRES_CONST_GREEN_LIFE_CYCLE_STAGE_FONT_COLOR " +
    +    "SYSRES_CONST_GROUP_ACCOUNT_TYPE_VALUE_CODE " +
    +    "SYSRES_CONST_GROUP_CATEGORY_NORMAL_CODE " +
    +    "SYSRES_CONST_GROUP_CATEGORY_NORMAL_NAME " +
    +    "SYSRES_CONST_GROUP_CATEGORY_SERVICE_CODE " +
    +    "SYSRES_CONST_GROUP_CATEGORY_SERVICE_NAME " +
    +    "SYSRES_CONST_GROUP_COMMON_CATEGORY_FIELD_VALUE " +
    +    "SYSRES_CONST_GROUP_FULL_NAME_REQUISITE_CODE " +
    +    "SYSRES_CONST_GROUP_NAME_REQUISITE_CODE " +
    +    "SYSRES_CONST_GROUP_RIGHTS_T_REQUISITE_CODE " +
    +    "SYSRES_CONST_GROUP_SERVER_CODES_REQUISITE_CODE " +
    +    "SYSRES_CONST_GROUP_SERVER_NAME_REQUISITE_CODE " +
    +    "SYSRES_CONST_GROUP_SERVICE_CATEGORY_FIELD_VALUE " +
    +    "SYSRES_CONST_GROUP_USER_REQUISITE_CODE " +
    +    "SYSRES_CONST_GROUPS_REFERENCE_CODE " +
    +    "SYSRES_CONST_GROUPS_REQUISITE_CODE " +
    +    "SYSRES_CONST_HIDDEN_MODE_NAME " +
    +    "SYSRES_CONST_HIGH_LVL_REQUISITE_CODE " +
    +    "SYSRES_CONST_HISTORY_ACTION_CREATE_CODE " +
    +    "SYSRES_CONST_HISTORY_ACTION_DELETE_CODE " +
    +    "SYSRES_CONST_HISTORY_ACTION_EDIT_CODE " +
    +    "SYSRES_CONST_HOUR_CHAR " +
    +    "SYSRES_CONST_ID_REQUISITE_CODE " +
    +    "SYSRES_CONST_IDSPS_REQUISITE_CODE " +
    +    "SYSRES_CONST_IMAGE_MODE_COLOR " +
    +    "SYSRES_CONST_IMAGE_MODE_GREYSCALE " +
    +    "SYSRES_CONST_IMAGE_MODE_MONOCHROME " +
    +    "SYSRES_CONST_IMPORTANCE_HIGH " +
    +    "SYSRES_CONST_IMPORTANCE_LOW " +
    +    "SYSRES_CONST_IMPORTANCE_NORMAL " +
    +    "SYSRES_CONST_IN_DESIGN_VERSION_STATE_PICK_VALUE " +
    +    "SYSRES_CONST_INCOMING_WORK_RULE_TYPE_CODE " +
    +    "SYSRES_CONST_INT_REQUISITE " +
    +    "SYSRES_CONST_INT_REQUISITE_TYPE " +
    +    "SYSRES_CONST_INTEGER_NUMBER_FORMAT_CHAR " +
    +    "SYSRES_CONST_INTEGER_TYPE_CHAR " +
    +    "SYSRES_CONST_IS_GENERATED_REQUISITE_NEGATIVE_VALUE " +
    +    "SYSRES_CONST_IS_PUBLIC_ROLE_REQUISITE_CODE " +
    +    "SYSRES_CONST_IS_REMOTE_USER_NEGATIVE_VALUE " +
    +    "SYSRES_CONST_IS_REMOTE_USER_POSITIVE_VALUE " +
    +    "SYSRES_CONST_IS_STORED_REQUISITE_NEGATIVE_VALUE " +
    +    "SYSRES_CONST_IS_STORED_REQUISITE_STORED_VALUE " +
    +    "SYSRES_CONST_ITALIC_LIFE_CYCLE_STAGE_DRAW_STYLE " +
    +    "SYSRES_CONST_JOB_BLOCK_DESCRIPTION " +
    +    "SYSRES_CONST_JOB_KIND_CONTROL_JOB " +
    +    "SYSRES_CONST_JOB_KIND_JOB " +
    +    "SYSRES_CONST_JOB_KIND_NOTICE " +
    +    "SYSRES_CONST_JOB_STATE_ABORTED " +
    +    "SYSRES_CONST_JOB_STATE_COMPLETE " +
    +    "SYSRES_CONST_JOB_STATE_WORKING " +
    +    "SYSRES_CONST_KIND_REQUISITE_CODE " +
    +    "SYSRES_CONST_KIND_REQUISITE_NAME " +
    +    "SYSRES_CONST_KINDS_CREATE_SHADOW_COPIES_REQUISITE_CODE " +
    +    "SYSRES_CONST_KINDS_DEFAULT_EDOC_LIFE_STAGE_REQUISITE_CODE " +
    +    "SYSRES_CONST_KINDS_EDOC_ALL_TEPLATES_ALLOWED_REQUISITE_CODE " +
    +    "SYSRES_CONST_KINDS_EDOC_ALLOW_LIFE_CYCLE_STAGE_CHANGING_REQUISITE_CODE " +
    +    "SYSRES_CONST_KINDS_EDOC_ALLOW_MULTIPLE_ACTIVE_VERSIONS_REQUISITE_CODE " +
    +    "SYSRES_CONST_KINDS_EDOC_SHARE_ACCES_RIGHTS_BY_DEFAULT_CODE " +
    +    "SYSRES_CONST_KINDS_EDOC_TEMPLATE_REQUISITE_CODE " +
    +    "SYSRES_CONST_KINDS_EDOC_TYPE_REQUISITE_CODE " +
    +    "SYSRES_CONST_KINDS_SIGNERS_REQUISITES_CODE " +
    +    "SYSRES_CONST_KOD_INPUT_TYPE " +
    +    "SYSRES_CONST_LAST_UPDATE_DATE_REQUISITE_CODE " +
    +    "SYSRES_CONST_LIFE_CYCLE_START_STAGE_REQUISITE_CODE " +
    +    "SYSRES_CONST_LILAC_LIFE_CYCLE_STAGE_FONT_COLOR " +
    +    "SYSRES_CONST_LINK_OBJECT_KIND_COMPONENT " +
    +    "SYSRES_CONST_LINK_OBJECT_KIND_DOCUMENT " +
    +    "SYSRES_CONST_LINK_OBJECT_KIND_EDOC " +
    +    "SYSRES_CONST_LINK_OBJECT_KIND_FOLDER " +
    +    "SYSRES_CONST_LINK_OBJECT_KIND_JOB " +
    +    "SYSRES_CONST_LINK_OBJECT_KIND_REFERENCE " +
    +    "SYSRES_CONST_LINK_OBJECT_KIND_TASK " +
    +    "SYSRES_CONST_LINK_REF_TYPE_REQUISITE_CODE " +
    +    "SYSRES_CONST_LIST_REFERENCE_MODE_NAME " +
    +    "SYSRES_CONST_LOCALIZATION_DICTIONARY_MAIN_VIEW_CODE " +
    +    "SYSRES_CONST_MAIN_VIEW_CODE " +
    +    "SYSRES_CONST_MANUAL_ENUM_METHOD_FLAG " +
    +    "SYSRES_CONST_MASTER_COMP_TYPE_REQUISITE_CODE " +
    +    "SYSRES_CONST_MASTER_TABLE_REC_ID_REQUISITE_CODE " +
    +    "SYSRES_CONST_MAXIMIZED_MODE_NAME " +
    +    "SYSRES_CONST_ME_VALUE " +
    +    "SYSRES_CONST_MESSAGE_ATTENTION_CAPTION " +
    +    "SYSRES_CONST_MESSAGE_CONFIRMATION_CAPTION " +
    +    "SYSRES_CONST_MESSAGE_ERROR_CAPTION " +
    +    "SYSRES_CONST_MESSAGE_INFORMATION_CAPTION " +
    +    "SYSRES_CONST_MINIMIZED_MODE_NAME " +
    +    "SYSRES_CONST_MINUTE_CHAR " +
    +    "SYSRES_CONST_MODULE_REQUISITE_CODE " +
    +    "SYSRES_CONST_MONITORING_BLOCK_DESCRIPTION " +
    +    "SYSRES_CONST_MONTH_FORMAT_VALUE " +
    +    "SYSRES_CONST_NAME_LOCALIZE_ID_REQUISITE_CODE " +
    +    "SYSRES_CONST_NAME_REQUISITE_CODE " +
    +    "SYSRES_CONST_NAME_SINGULAR_REQUISITE_CODE " +
    +    "SYSRES_CONST_NAMEAN_INPUT_TYPE " +
    +    "SYSRES_CONST_NEGATIVE_PICK_VALUE " +
    +    "SYSRES_CONST_NEGATIVE_VALUE " +
    +    "SYSRES_CONST_NO " +
    +    "SYSRES_CONST_NO_PICK_VALUE " +
    +    "SYSRES_CONST_NO_SIGNATURE_REQUISITE_CODE " +
    +    "SYSRES_CONST_NO_VALUE " +
    +    "SYSRES_CONST_NONE_ACCESS_RIGHTS_TYPE_CODE " +
    +    "SYSRES_CONST_NONOPERATING_RECORD_FLAG_VALUE " +
    +    "SYSRES_CONST_NONOPERATING_RECORD_FLAG_VALUE_MASCULINE " +
    +    "SYSRES_CONST_NORMAL_ACCESS_RIGHTS_TYPE_CODE " +
    +    "SYSRES_CONST_NORMAL_LIFE_CYCLE_STAGE_DRAW_STYLE " +
    +    "SYSRES_CONST_NORMAL_MODE_NAME " +
    +    "SYSRES_CONST_NOT_ALLOWED_ACCESS_TYPE_CODE " +
    +    "SYSRES_CONST_NOT_ALLOWED_ACCESS_TYPE_NAME " +
    +    "SYSRES_CONST_NOTE_REQUISITE_CODE " +
    +    "SYSRES_CONST_NOTICE_BLOCK_DESCRIPTION " +
    +    "SYSRES_CONST_NUM_REQUISITE " +
    +    "SYSRES_CONST_NUM_STR_REQUISITE_CODE " +
    +    "SYSRES_CONST_NUMERATION_AUTO_NOT_STRONG " +
    +    "SYSRES_CONST_NUMERATION_AUTO_STRONG " +
    +    "SYSRES_CONST_NUMERATION_FROM_DICTONARY " +
    +    "SYSRES_CONST_NUMERATION_MANUAL " +
    +    "SYSRES_CONST_NUMERIC_TYPE_CHAR " +
    +    "SYSRES_CONST_NUMREQ_REQUISITE_CODE " +
    +    "SYSRES_CONST_OBSOLETE_VERSION_STATE_PICK_VALUE " +
    +    "SYSRES_CONST_OPERATING_RECORD_FLAG_VALUE " +
    +    "SYSRES_CONST_OPERATING_RECORD_FLAG_VALUE_CODE " +
    +    "SYSRES_CONST_OPERATING_RECORD_FLAG_VALUE_FEMININE " +
    +    "SYSRES_CONST_OPERATING_RECORD_FLAG_VALUE_MASCULINE " +
    +    "SYSRES_CONST_OPTIONAL_FORM_COMP_REQCODE_PREFIX " +
    +    "SYSRES_CONST_ORANGE_LIFE_CYCLE_STAGE_FONT_COLOR " +
    +    "SYSRES_CONST_ORIGINALREF_REQUISITE_CODE " +
    +    "SYSRES_CONST_OURFIRM_REF_CODE " +
    +    "SYSRES_CONST_OURFIRM_REQUISITE_CODE " +
    +    "SYSRES_CONST_OURFIRM_VAR " +
    +    "SYSRES_CONST_OUTGOING_WORK_RULE_TYPE_CODE " +
    +    "SYSRES_CONST_PICK_NEGATIVE_RESULT " +
    +    "SYSRES_CONST_PICK_POSITIVE_RESULT " +
    +    "SYSRES_CONST_PICK_REQUISITE " +
    +    "SYSRES_CONST_PICK_REQUISITE_TYPE " +
    +    "SYSRES_CONST_PICK_TYPE_CHAR " +
    +    "SYSRES_CONST_PLAN_STATUS_REQUISITE_CODE " +
    +    "SYSRES_CONST_PLATFORM_VERSION_COMMENT " +
    +    "SYSRES_CONST_PLUGINS_SETTINGS_DESCRIPTION_REQUISITE_CODE " +
    +    "SYSRES_CONST_POSITIVE_PICK_VALUE " +
    +    "SYSRES_CONST_POWER_TO_CREATE_ACTION_CODE " +
    +    "SYSRES_CONST_POWER_TO_SIGN_ACTION_CODE " +
    +    "SYSRES_CONST_PRIORITY_REQUISITE_CODE " +
    +    "SYSRES_CONST_QUALIFIED_TASK_TYPE " +
    +    "SYSRES_CONST_QUALIFIED_TASK_TYPE_CODE " +
    +    "SYSRES_CONST_RECSTAT_REQUISITE_CODE " +
    +    "SYSRES_CONST_RED_LIFE_CYCLE_STAGE_FONT_COLOR " +
    +    "SYSRES_CONST_REF_ID_T_REF_TYPE_REQUISITE_CODE " +
    +    "SYSRES_CONST_REF_REQUISITE " +
    +    "SYSRES_CONST_REF_REQUISITE_TYPE " +
    +    "SYSRES_CONST_REF_REQUISITES_REFERENCE_CODE_SELECTED_REQUISITE " +
    +    "SYSRES_CONST_REFERENCE_RECORD_HISTORY_CREATE_ACTION_CODE " +
    +    "SYSRES_CONST_REFERENCE_RECORD_HISTORY_DELETE_ACTION_CODE " +
    +    "SYSRES_CONST_REFERENCE_RECORD_HISTORY_MODIFY_ACTION_CODE " +
    +    "SYSRES_CONST_REFERENCE_TYPE_CHAR " +
    +    "SYSRES_CONST_REFERENCE_TYPE_REQUISITE_NAME " +
    +    "SYSRES_CONST_REFERENCES_ADD_PARAMS_REQUISITE_CODE " +
    +    "SYSRES_CONST_REFERENCES_DISPLAY_REQUISITE_REQUISITE_CODE " +
    +    "SYSRES_CONST_REMOTE_SERVER_STATUS_WORKING " +
    +    "SYSRES_CONST_REMOTE_SERVER_TYPE_MAIN " +
    +    "SYSRES_CONST_REMOTE_SERVER_TYPE_SECONDARY " +
    +    "SYSRES_CONST_REMOTE_USER_FLAG_VALUE_CODE " +
    +    "SYSRES_CONST_REPORT_APP_EDITOR_INTERNAL " +
    +    "SYSRES_CONST_REPORT_BASE_REPORT_ID_REQUISITE_CODE " +
    +    "SYSRES_CONST_REPORT_BASE_REPORT_REQUISITE_CODE " +
    +    "SYSRES_CONST_REPORT_SCRIPT_REQUISITE_CODE " +
    +    "SYSRES_CONST_REPORT_TEMPLATE_REQUISITE_CODE " +
    +    "SYSRES_CONST_REPORT_VIEWER_CODE_REQUISITE_CODE " +
    +    "SYSRES_CONST_REQ_ALLOW_COMPONENT_DEFAULT_VALUE " +
    +    "SYSRES_CONST_REQ_ALLOW_RECORD_DEFAULT_VALUE " +
    +    "SYSRES_CONST_REQ_ALLOW_SERVER_COMPONENT_DEFAULT_VALUE " +
    +    "SYSRES_CONST_REQ_MODE_AVAILABLE_CODE " +
    +    "SYSRES_CONST_REQ_MODE_EDIT_CODE " +
    +    "SYSRES_CONST_REQ_MODE_HIDDEN_CODE " +
    +    "SYSRES_CONST_REQ_MODE_NOT_AVAILABLE_CODE " +
    +    "SYSRES_CONST_REQ_MODE_VIEW_CODE " +
    +    "SYSRES_CONST_REQ_NUMBER_REQUISITE_CODE " +
    +    "SYSRES_CONST_REQ_SECTION_VALUE " +
    +    "SYSRES_CONST_REQ_TYPE_VALUE " +
    +    "SYSRES_CONST_REQUISITE_FORMAT_BY_UNIT " +
    +    "SYSRES_CONST_REQUISITE_FORMAT_DATE_FULL " +
    +    "SYSRES_CONST_REQUISITE_FORMAT_DATE_TIME " +
    +    "SYSRES_CONST_REQUISITE_FORMAT_LEFT " +
    +    "SYSRES_CONST_REQUISITE_FORMAT_RIGHT " +
    +    "SYSRES_CONST_REQUISITE_FORMAT_WITHOUT_UNIT " +
    +    "SYSRES_CONST_REQUISITE_NUMBER_REQUISITE_CODE " +
    +    "SYSRES_CONST_REQUISITE_SECTION_ACTIONS " +
    +    "SYSRES_CONST_REQUISITE_SECTION_BUTTON " +
    +    "SYSRES_CONST_REQUISITE_SECTION_BUTTONS " +
    +    "SYSRES_CONST_REQUISITE_SECTION_CARD " +
    +    "SYSRES_CONST_REQUISITE_SECTION_TABLE " +
    +    "SYSRES_CONST_REQUISITE_SECTION_TABLE10 " +
    +    "SYSRES_CONST_REQUISITE_SECTION_TABLE11 " +
    +    "SYSRES_CONST_REQUISITE_SECTION_TABLE12 " +
    +    "SYSRES_CONST_REQUISITE_SECTION_TABLE13 " +
    +    "SYSRES_CONST_REQUISITE_SECTION_TABLE14 " +
    +    "SYSRES_CONST_REQUISITE_SECTION_TABLE15 " +
    +    "SYSRES_CONST_REQUISITE_SECTION_TABLE16 " +
    +    "SYSRES_CONST_REQUISITE_SECTION_TABLE17 " +
    +    "SYSRES_CONST_REQUISITE_SECTION_TABLE18 " +
    +    "SYSRES_CONST_REQUISITE_SECTION_TABLE19 " +
    +    "SYSRES_CONST_REQUISITE_SECTION_TABLE2 " +
    +    "SYSRES_CONST_REQUISITE_SECTION_TABLE20 " +
    +    "SYSRES_CONST_REQUISITE_SECTION_TABLE21 " +
    +    "SYSRES_CONST_REQUISITE_SECTION_TABLE22 " +
    +    "SYSRES_CONST_REQUISITE_SECTION_TABLE23 " +
    +    "SYSRES_CONST_REQUISITE_SECTION_TABLE24 " +
    +    "SYSRES_CONST_REQUISITE_SECTION_TABLE3 " +
    +    "SYSRES_CONST_REQUISITE_SECTION_TABLE4 " +
    +    "SYSRES_CONST_REQUISITE_SECTION_TABLE5 " +
    +    "SYSRES_CONST_REQUISITE_SECTION_TABLE6 " +
    +    "SYSRES_CONST_REQUISITE_SECTION_TABLE7 " +
    +    "SYSRES_CONST_REQUISITE_SECTION_TABLE8 " +
    +    "SYSRES_CONST_REQUISITE_SECTION_TABLE9 " +
    +    "SYSRES_CONST_REQUISITES_PSEUDOREFERENCE_REQUISITE_NUMBER_REQUISITE_CODE " +
    +    "SYSRES_CONST_RIGHT_ALIGNMENT_CODE " +
    +    "SYSRES_CONST_ROLES_REFERENCE_CODE " +
    +    "SYSRES_CONST_ROUTE_STEP_AFTER_RUS " +
    +    "SYSRES_CONST_ROUTE_STEP_AND_CONDITION_RUS " +
    +    "SYSRES_CONST_ROUTE_STEP_OR_CONDITION_RUS " +
    +    "SYSRES_CONST_ROUTE_TYPE_COMPLEX " +
    +    "SYSRES_CONST_ROUTE_TYPE_PARALLEL " +
    +    "SYSRES_CONST_ROUTE_TYPE_SERIAL " +
    +    "SYSRES_CONST_SBDATASETDESC_NEGATIVE_VALUE " +
    +    "SYSRES_CONST_SBDATASETDESC_POSITIVE_VALUE " +
    +    "SYSRES_CONST_SBVIEWSDESC_POSITIVE_VALUE " +
    +    "SYSRES_CONST_SCRIPT_BLOCK_DESCRIPTION " +
    +    "SYSRES_CONST_SEARCH_BY_TEXT_REQUISITE_CODE " +
    +    "SYSRES_CONST_SEARCHES_COMPONENT_CONTENT " +
    +    "SYSRES_CONST_SEARCHES_CRITERIA_ACTION_NAME " +
    +    "SYSRES_CONST_SEARCHES_EDOC_CONTENT " +
    +    "SYSRES_CONST_SEARCHES_FOLDER_CONTENT " +
    +    "SYSRES_CONST_SEARCHES_JOB_CONTENT " +
    +    "SYSRES_CONST_SEARCHES_REFERENCE_CODE " +
    +    "SYSRES_CONST_SEARCHES_TASK_CONTENT " +
    +    "SYSRES_CONST_SECOND_CHAR " +
    +    "SYSRES_CONST_SECTION_REQUISITE_ACTIONS_VALUE " +
    +    "SYSRES_CONST_SECTION_REQUISITE_CARD_VALUE " +
    +    "SYSRES_CONST_SECTION_REQUISITE_CODE " +
    +    "SYSRES_CONST_SECTION_REQUISITE_DETAIL_1_VALUE " +
    +    "SYSRES_CONST_SECTION_REQUISITE_DETAIL_2_VALUE " +
    +    "SYSRES_CONST_SECTION_REQUISITE_DETAIL_3_VALUE " +
    +    "SYSRES_CONST_SECTION_REQUISITE_DETAIL_4_VALUE " +
    +    "SYSRES_CONST_SECTION_REQUISITE_DETAIL_5_VALUE " +
    +    "SYSRES_CONST_SECTION_REQUISITE_DETAIL_6_VALUE " +
    +    "SYSRES_CONST_SELECT_REFERENCE_MODE_NAME " +
    +    "SYSRES_CONST_SELECT_TYPE_SELECTABLE " +
    +    "SYSRES_CONST_SELECT_TYPE_SELECTABLE_ONLY_CHILD " +
    +    "SYSRES_CONST_SELECT_TYPE_SELECTABLE_WITH_CHILD " +
    +    "SYSRES_CONST_SELECT_TYPE_UNSLECTABLE " +
    +    "SYSRES_CONST_SERVER_TYPE_MAIN " +
    +    "SYSRES_CONST_SERVICE_USER_CATEGORY_FIELD_VALUE " +
    +    "SYSRES_CONST_SETTINGS_USER_REQUISITE_CODE " +
    +    "SYSRES_CONST_SIGNATURE_AND_ENCODE_CERTIFICATE_TYPE_CODE " +
    +    "SYSRES_CONST_SIGNATURE_CERTIFICATE_TYPE_CODE " +
    +    "SYSRES_CONST_SINGULAR_TITLE_REQUISITE_CODE " +
    +    "SYSRES_CONST_SQL_SERVER_AUTHENTIFICATION_FLAG_VALUE_CODE " +
    +    "SYSRES_CONST_SQL_SERVER_ENCODE_AUTHENTIFICATION_FLAG_VALUE_CODE " +
    +    "SYSRES_CONST_STANDART_ROUTE_REFERENCE_CODE " +
    +    "SYSRES_CONST_STANDART_ROUTE_REFERENCE_COMMENT_REQUISITE_CODE " +
    +    "SYSRES_CONST_STANDART_ROUTES_GROUPS_REFERENCE_CODE " +
    +    "SYSRES_CONST_STATE_REQ_NAME " +
    +    "SYSRES_CONST_STATE_REQUISITE_ACTIVE_VALUE " +
    +    "SYSRES_CONST_STATE_REQUISITE_CLOSED_VALUE " +
    +    "SYSRES_CONST_STATE_REQUISITE_CODE " +
    +    "SYSRES_CONST_STATIC_ROLE_TYPE_CODE " +
    +    "SYSRES_CONST_STATUS_PLAN_DEFAULT_VALUE " +
    +    "SYSRES_CONST_STATUS_VALUE_AUTOCLEANING " +
    +    "SYSRES_CONST_STATUS_VALUE_BLUE_SQUARE " +
    +    "SYSRES_CONST_STATUS_VALUE_COMPLETE " +
    +    "SYSRES_CONST_STATUS_VALUE_GREEN_SQUARE " +
    +    "SYSRES_CONST_STATUS_VALUE_ORANGE_SQUARE " +
    +    "SYSRES_CONST_STATUS_VALUE_PURPLE_SQUARE " +
    +    "SYSRES_CONST_STATUS_VALUE_RED_SQUARE " +
    +    "SYSRES_CONST_STATUS_VALUE_SUSPEND " +
    +    "SYSRES_CONST_STATUS_VALUE_YELLOW_SQUARE " +
    +    "SYSRES_CONST_STDROUTE_SHOW_TO_USERS_REQUISITE_CODE " +
    +    "SYSRES_CONST_STORAGE_TYPE_FILE " +
    +    "SYSRES_CONST_STORAGE_TYPE_SQL_SERVER " +
    +    "SYSRES_CONST_STR_REQUISITE " +
    +    "SYSRES_CONST_STRIKEOUT_LIFE_CYCLE_STAGE_DRAW_STYLE " +
    +    "SYSRES_CONST_STRING_FORMAT_LEFT_ALIGN_CHAR " +
    +    "SYSRES_CONST_STRING_FORMAT_RIGHT_ALIGN_CHAR " +
    +    "SYSRES_CONST_STRING_REQUISITE_CODE " +
    +    "SYSRES_CONST_STRING_REQUISITE_TYPE " +
    +    "SYSRES_CONST_STRING_TYPE_CHAR " +
    +    "SYSRES_CONST_SUBSTITUTES_PSEUDOREFERENCE_CODE " +
    +    "SYSRES_CONST_SUBTASK_BLOCK_DESCRIPTION " +
    +    "SYSRES_CONST_SYSTEM_SETTING_CURRENT_USER_PARAM_VALUE " +
    +    "SYSRES_CONST_SYSTEM_SETTING_EMPTY_VALUE_PARAM_VALUE " +
    +    "SYSRES_CONST_SYSTEM_VERSION_COMMENT " +
    +    "SYSRES_CONST_TASK_ACCESS_TYPE_ALL " +
    +    "SYSRES_CONST_TASK_ACCESS_TYPE_ALL_MEMBERS " +
    +    "SYSRES_CONST_TASK_ACCESS_TYPE_MANUAL " +
    +    "SYSRES_CONST_TASK_ENCODE_TYPE_CERTIFICATION " +
    +    "SYSRES_CONST_TASK_ENCODE_TYPE_CERTIFICATION_AND_PASSWORD " +
    +    "SYSRES_CONST_TASK_ENCODE_TYPE_NONE " +
    +    "SYSRES_CONST_TASK_ENCODE_TYPE_PASSWORD " +
    +    "SYSRES_CONST_TASK_ROUTE_ALL_CONDITION " +
    +    "SYSRES_CONST_TASK_ROUTE_AND_CONDITION " +
    +    "SYSRES_CONST_TASK_ROUTE_OR_CONDITION " +
    +    "SYSRES_CONST_TASK_STATE_ABORTED " +
    +    "SYSRES_CONST_TASK_STATE_COMPLETE " +
    +    "SYSRES_CONST_TASK_STATE_CONTINUED " +
    +    "SYSRES_CONST_TASK_STATE_CONTROL " +
    +    "SYSRES_CONST_TASK_STATE_INIT " +
    +    "SYSRES_CONST_TASK_STATE_WORKING " +
    +    "SYSRES_CONST_TASK_TITLE " +
    +    "SYSRES_CONST_TASK_TYPES_GROUPS_REFERENCE_CODE " +
    +    "SYSRES_CONST_TASK_TYPES_REFERENCE_CODE " +
    +    "SYSRES_CONST_TEMPLATES_REFERENCE_CODE " +
    +    "SYSRES_CONST_TEST_DATE_REQUISITE_NAME " +
    +    "SYSRES_CONST_TEST_DEV_DATABASE_NAME " +
    +    "SYSRES_CONST_TEST_DEV_SYSTEM_CODE " +
    +    "SYSRES_CONST_TEST_EDMS_DATABASE_NAME " +
    +    "SYSRES_CONST_TEST_EDMS_MAIN_CODE " +
    +    "SYSRES_CONST_TEST_EDMS_MAIN_DB_NAME " +
    +    "SYSRES_CONST_TEST_EDMS_SECOND_CODE " +
    +    "SYSRES_CONST_TEST_EDMS_SECOND_DB_NAME " +
    +    "SYSRES_CONST_TEST_EDMS_SYSTEM_CODE " +
    +    "SYSRES_CONST_TEST_NUMERIC_REQUISITE_NAME " +
    +    "SYSRES_CONST_TEXT_REQUISITE " +
    +    "SYSRES_CONST_TEXT_REQUISITE_CODE " +
    +    "SYSRES_CONST_TEXT_REQUISITE_TYPE " +
    +    "SYSRES_CONST_TEXT_TYPE_CHAR " +
    +    "SYSRES_CONST_TYPE_CODE_REQUISITE_CODE " +
    +    "SYSRES_CONST_TYPE_REQUISITE_CODE " +
    +    "SYSRES_CONST_UNDEFINED_LIFE_CYCLE_STAGE_FONT_COLOR " +
    +    "SYSRES_CONST_UNITS_SECTION_ID_REQUISITE_CODE " +
    +    "SYSRES_CONST_UNITS_SECTION_REQUISITE_CODE " +
    +    "SYSRES_CONST_UNOPERATING_RECORD_FLAG_VALUE_CODE " +
    +    "SYSRES_CONST_UNSTORED_DATA_REQUISITE_CODE " +
    +    "SYSRES_CONST_UNSTORED_DATA_REQUISITE_NAME " +
    +    "SYSRES_CONST_USE_ACCESS_TYPE_CODE " +
    +    "SYSRES_CONST_USE_ACCESS_TYPE_NAME " +
    +    "SYSRES_CONST_USER_ACCOUNT_TYPE_VALUE_CODE " +
    +    "SYSRES_CONST_USER_ADDITIONAL_INFORMATION_REQUISITE_CODE " +
    +    "SYSRES_CONST_USER_AND_GROUP_ID_FROM_PSEUDOREFERENCE_REQUISITE_CODE " +
    +    "SYSRES_CONST_USER_CATEGORY_NORMAL " +
    +    "SYSRES_CONST_USER_CERTIFICATE_REQUISITE_CODE " +
    +    "SYSRES_CONST_USER_CERTIFICATE_STATE_REQUISITE_CODE " +
    +    "SYSRES_CONST_USER_CERTIFICATE_SUBJECT_NAME_REQUISITE_CODE " +
    +    "SYSRES_CONST_USER_CERTIFICATE_THUMBPRINT_REQUISITE_CODE " +
    +    "SYSRES_CONST_USER_COMMON_CATEGORY " +
    +    "SYSRES_CONST_USER_COMMON_CATEGORY_CODE " +
    +    "SYSRES_CONST_USER_FULL_NAME_REQUISITE_CODE " +
    +    "SYSRES_CONST_USER_GROUP_TYPE_REQUISITE_CODE " +
    +    "SYSRES_CONST_USER_LOGIN_REQUISITE_CODE " +
    +    "SYSRES_CONST_USER_REMOTE_CONTROLLER_REQUISITE_CODE " +
    +    "SYSRES_CONST_USER_REMOTE_SYSTEM_REQUISITE_CODE " +
    +    "SYSRES_CONST_USER_RIGHTS_T_REQUISITE_CODE " +
    +    "SYSRES_CONST_USER_SERVER_NAME_REQUISITE_CODE " +
    +    "SYSRES_CONST_USER_SERVICE_CATEGORY " +
    +    "SYSRES_CONST_USER_SERVICE_CATEGORY_CODE " +
    +    "SYSRES_CONST_USER_STATUS_ADMINISTRATOR_CODE " +
    +    "SYSRES_CONST_USER_STATUS_ADMINISTRATOR_NAME " +
    +    "SYSRES_CONST_USER_STATUS_DEVELOPER_CODE " +
    +    "SYSRES_CONST_USER_STATUS_DEVELOPER_NAME " +
    +    "SYSRES_CONST_USER_STATUS_DISABLED_CODE " +
    +    "SYSRES_CONST_USER_STATUS_DISABLED_NAME " +
    +    "SYSRES_CONST_USER_STATUS_SYSTEM_DEVELOPER_CODE " +
    +    "SYSRES_CONST_USER_STATUS_USER_CODE " +
    +    "SYSRES_CONST_USER_STATUS_USER_NAME " +
    +    "SYSRES_CONST_USER_STATUS_USER_NAME_DEPRECATED " +
    +    "SYSRES_CONST_USER_TYPE_FIELD_VALUE_USER " +
    +    "SYSRES_CONST_USER_TYPE_REQUISITE_CODE " +
    +    "SYSRES_CONST_USERS_CONTROLLER_REQUISITE_CODE " +
    +    "SYSRES_CONST_USERS_IS_MAIN_SERVER_REQUISITE_CODE " +
    +    "SYSRES_CONST_USERS_REFERENCE_CODE " +
    +    "SYSRES_CONST_USERS_REGISTRATION_CERTIFICATES_ACTION_NAME " +
    +    "SYSRES_CONST_USERS_REQUISITE_CODE " +
    +    "SYSRES_CONST_USERS_SYSTEM_REQUISITE_CODE " +
    +    "SYSRES_CONST_USERS_USER_ACCESS_RIGHTS_TYPR_REQUISITE_CODE " +
    +    "SYSRES_CONST_USERS_USER_AUTHENTICATION_REQUISITE_CODE " +
    +    "SYSRES_CONST_USERS_USER_COMPONENT_REQUISITE_CODE " +
    +    "SYSRES_CONST_USERS_USER_GROUP_REQUISITE_CODE " +
    +    "SYSRES_CONST_USERS_VIEW_CERTIFICATES_ACTION_NAME " +
    +    "SYSRES_CONST_VIEW_DEFAULT_CODE " +
    +    "SYSRES_CONST_VIEW_DEFAULT_NAME " +
    +    "SYSRES_CONST_VIEWER_REQUISITE_CODE " +
    +    "SYSRES_CONST_WAITING_BLOCK_DESCRIPTION " +
    +    "SYSRES_CONST_WIZARD_FORM_LABEL_TEST_STRING  " +
    +    "SYSRES_CONST_WIZARD_QUERY_PARAM_HEIGHT_ETALON_STRING " +
    +    "SYSRES_CONST_WIZARD_REFERENCE_COMMENT_REQUISITE_CODE " +
    +    "SYSRES_CONST_WORK_RULES_DESCRIPTION_REQUISITE_CODE " +
    +    "SYSRES_CONST_WORK_TIME_CALENDAR_REFERENCE_CODE " +
    +    "SYSRES_CONST_WORK_WORKFLOW_HARD_ROUTE_TYPE_VALUE " +
    +    "SYSRES_CONST_WORK_WORKFLOW_HARD_ROUTE_TYPE_VALUE_CODE " +
    +    "SYSRES_CONST_WORK_WORKFLOW_HARD_ROUTE_TYPE_VALUE_CODE_RUS " +
    +    "SYSRES_CONST_WORK_WORKFLOW_SOFT_ROUTE_TYPE_VALUE_CODE_RUS " +
    +    "SYSRES_CONST_WORKFLOW_ROUTE_TYPR_HARD " +
    +    "SYSRES_CONST_WORKFLOW_ROUTE_TYPR_SOFT " +
    +    "SYSRES_CONST_XML_ENCODING " +
    +    "SYSRES_CONST_XREC_STAT_REQUISITE_CODE " +
    +    "SYSRES_CONST_XRECID_FIELD_NAME " +
    +    "SYSRES_CONST_YES " +
    +    "SYSRES_CONST_YES_NO_2_REQUISITE_CODE " +
    +    "SYSRES_CONST_YES_NO_REQUISITE_CODE " +
    +    "SYSRES_CONST_YES_NO_T_REF_TYPE_REQUISITE_CODE " +
    +    "SYSRES_CONST_YES_PICK_VALUE " +
    +    "SYSRES_CONST_YES_VALUE ";
    +
    +  // Base constant
    +  const base_constants = "CR FALSE nil NO_VALUE NULL TAB TRUE YES_VALUE ";
    +
    +  // Base group name
    +  const base_group_name_constants =
    +    "ADMINISTRATORS_GROUP_NAME CUSTOMIZERS_GROUP_NAME DEVELOPERS_GROUP_NAME SERVICE_USERS_GROUP_NAME ";
    +
    +  // Decision block properties
    +  const decision_block_properties_constants =
    +    "DECISION_BLOCK_FIRST_OPERAND_PROPERTY DECISION_BLOCK_NAME_PROPERTY DECISION_BLOCK_OPERATION_PROPERTY " +
    +    "DECISION_BLOCK_RESULT_TYPE_PROPERTY DECISION_BLOCK_SECOND_OPERAND_PROPERTY ";
    +
    +  // File extension
    +  const file_extension_constants =
    +    "ANY_FILE_EXTENTION COMPRESSED_DOCUMENT_EXTENSION EXTENDED_DOCUMENT_EXTENSION " +
    +    "SHORT_COMPRESSED_DOCUMENT_EXTENSION SHORT_EXTENDED_DOCUMENT_EXTENSION ";
    +
    +  // Job block properties
    +  const job_block_properties_constants =
    +    "JOB_BLOCK_ABORT_DEADLINE_PROPERTY " +
    +    "JOB_BLOCK_AFTER_FINISH_EVENT " +
    +    "JOB_BLOCK_AFTER_QUERY_PARAMETERS_EVENT " +
    +    "JOB_BLOCK_ATTACHMENT_PROPERTY " +
    +    "JOB_BLOCK_ATTACHMENTS_RIGHTS_GROUP_PROPERTY " +
    +    "JOB_BLOCK_ATTACHMENTS_RIGHTS_TYPE_PROPERTY " +
    +    "JOB_BLOCK_BEFORE_QUERY_PARAMETERS_EVENT " +
    +    "JOB_BLOCK_BEFORE_START_EVENT " +
    +    "JOB_BLOCK_CREATED_JOBS_PROPERTY " +
    +    "JOB_BLOCK_DEADLINE_PROPERTY " +
    +    "JOB_BLOCK_EXECUTION_RESULTS_PROPERTY " +
    +    "JOB_BLOCK_IS_PARALLEL_PROPERTY " +
    +    "JOB_BLOCK_IS_RELATIVE_ABORT_DEADLINE_PROPERTY " +
    +    "JOB_BLOCK_IS_RELATIVE_DEADLINE_PROPERTY " +
    +    "JOB_BLOCK_JOB_TEXT_PROPERTY " +
    +    "JOB_BLOCK_NAME_PROPERTY " +
    +    "JOB_BLOCK_NEED_SIGN_ON_PERFORM_PROPERTY " +
    +    "JOB_BLOCK_PERFORMER_PROPERTY " +
    +    "JOB_BLOCK_RELATIVE_ABORT_DEADLINE_TYPE_PROPERTY " +
    +    "JOB_BLOCK_RELATIVE_DEADLINE_TYPE_PROPERTY " +
    +    "JOB_BLOCK_SUBJECT_PROPERTY ";
    +
    +  // Language code
    +  const language_code_constants = "ENGLISH_LANGUAGE_CODE RUSSIAN_LANGUAGE_CODE ";
    +
    +  // Launching external applications
    +  const launching_external_applications_constants =
    +    "smHidden smMaximized smMinimized smNormal wmNo wmYes ";
    +
    +  // Link kind
    +  const link_kind_constants =
    +    "COMPONENT_TOKEN_LINK_KIND " +
    +    "DOCUMENT_LINK_KIND " +
    +    "EDOCUMENT_LINK_KIND " +
    +    "FOLDER_LINK_KIND " +
    +    "JOB_LINK_KIND " +
    +    "REFERENCE_LINK_KIND " +
    +    "TASK_LINK_KIND ";
    +
    +  // Lock type
    +  const lock_type_constants =
    +    "COMPONENT_TOKEN_LOCK_TYPE EDOCUMENT_VERSION_LOCK_TYPE ";
    +
    +  // Monitor block properties
    +  const monitor_block_properties_constants =
    +    "MONITOR_BLOCK_AFTER_FINISH_EVENT " +
    +    "MONITOR_BLOCK_BEFORE_START_EVENT " +
    +    "MONITOR_BLOCK_DEADLINE_PROPERTY " +
    +    "MONITOR_BLOCK_INTERVAL_PROPERTY " +
    +    "MONITOR_BLOCK_INTERVAL_TYPE_PROPERTY " +
    +    "MONITOR_BLOCK_IS_RELATIVE_DEADLINE_PROPERTY " +
    +    "MONITOR_BLOCK_NAME_PROPERTY " +
    +    "MONITOR_BLOCK_RELATIVE_DEADLINE_TYPE_PROPERTY " +
    +    "MONITOR_BLOCK_SEARCH_SCRIPT_PROPERTY ";
    +
    +  // Notice block properties
    +  const notice_block_properties_constants =
    +    "NOTICE_BLOCK_AFTER_FINISH_EVENT " +
    +    "NOTICE_BLOCK_ATTACHMENT_PROPERTY " +
    +    "NOTICE_BLOCK_ATTACHMENTS_RIGHTS_GROUP_PROPERTY " +
    +    "NOTICE_BLOCK_ATTACHMENTS_RIGHTS_TYPE_PROPERTY " +
    +    "NOTICE_BLOCK_BEFORE_START_EVENT " +
    +    "NOTICE_BLOCK_CREATED_NOTICES_PROPERTY " +
    +    "NOTICE_BLOCK_DEADLINE_PROPERTY " +
    +    "NOTICE_BLOCK_IS_RELATIVE_DEADLINE_PROPERTY " +
    +    "NOTICE_BLOCK_NAME_PROPERTY " +
    +    "NOTICE_BLOCK_NOTICE_TEXT_PROPERTY " +
    +    "NOTICE_BLOCK_PERFORMER_PROPERTY " +
    +    "NOTICE_BLOCK_RELATIVE_DEADLINE_TYPE_PROPERTY " +
    +    "NOTICE_BLOCK_SUBJECT_PROPERTY ";
    +
    +  // Object events
    +  const object_events_constants =
    +    "dseAfterCancel " +
    +    "dseAfterClose " +
    +    "dseAfterDelete " +
    +    "dseAfterDeleteOutOfTransaction " +
    +    "dseAfterInsert " +
    +    "dseAfterOpen " +
    +    "dseAfterScroll " +
    +    "dseAfterUpdate " +
    +    "dseAfterUpdateOutOfTransaction " +
    +    "dseBeforeCancel " +
    +    "dseBeforeClose " +
    +    "dseBeforeDelete " +
    +    "dseBeforeDetailUpdate " +
    +    "dseBeforeInsert " +
    +    "dseBeforeOpen " +
    +    "dseBeforeUpdate " +
    +    "dseOnAnyRequisiteChange " +
    +    "dseOnCloseRecord " +
    +    "dseOnDeleteError " +
    +    "dseOnOpenRecord " +
    +    "dseOnPrepareUpdate " +
    +    "dseOnUpdateError " +
    +    "dseOnUpdateRatifiedRecord " +
    +    "dseOnValidDelete " +
    +    "dseOnValidUpdate " +
    +    "reOnChange " +
    +    "reOnChangeValues " +
    +    "SELECTION_BEGIN_ROUTE_EVENT " +
    +    "SELECTION_END_ROUTE_EVENT ";
    +
    +  // Object params
    +  const object_params_constants =
    +    "CURRENT_PERIOD_IS_REQUIRED " +
    +    "PREVIOUS_CARD_TYPE_NAME " +
    +    "SHOW_RECORD_PROPERTIES_FORM ";
    +
    +  // Other
    +  const other_constants =
    +    "ACCESS_RIGHTS_SETTING_DIALOG_CODE " +
    +    "ADMINISTRATOR_USER_CODE " +
    +    "ANALYTIC_REPORT_TYPE " +
    +    "asrtHideLocal " +
    +    "asrtHideRemote " +
    +    "CALCULATED_ROLE_TYPE_CODE " +
    +    "COMPONENTS_REFERENCE_DEVELOPER_VIEW_CODE " +
    +    "DCTS_TEST_PROTOCOLS_FOLDER_PATH " +
    +    "E_EDOC_VERSION_ALREADY_APPROVINGLY_SIGNED " +
    +    "E_EDOC_VERSION_ALREADY_APPROVINGLY_SIGNED_BY_USER " +
    +    "E_EDOC_VERSION_ALREDY_SIGNED " +
    +    "E_EDOC_VERSION_ALREDY_SIGNED_BY_USER " +
    +    "EDOC_TYPES_CODE_REQUISITE_FIELD_NAME " +
    +    "EDOCUMENTS_ALIAS_NAME " +
    +    "FILES_FOLDER_PATH " +
    +    "FILTER_OPERANDS_DELIMITER " +
    +    "FILTER_OPERATIONS_DELIMITER " +
    +    "FORMCARD_NAME " +
    +    "FORMLIST_NAME " +
    +    "GET_EXTENDED_DOCUMENT_EXTENSION_CREATION_MODE " +
    +    "GET_EXTENDED_DOCUMENT_EXTENSION_IMPORT_MODE " +
    +    "INTEGRATED_REPORT_TYPE " +
    +    "IS_BUILDER_APPLICATION_ROLE " +
    +    "IS_BUILDER_APPLICATION_ROLE2 " +
    +    "IS_BUILDER_USERS " +
    +    "ISBSYSDEV " +
    +    "LOG_FOLDER_PATH " +
    +    "mbCancel " +
    +    "mbNo " +
    +    "mbNoToAll " +
    +    "mbOK " +
    +    "mbYes " +
    +    "mbYesToAll " +
    +    "MEMORY_DATASET_DESRIPTIONS_FILENAME " +
    +    "mrNo " +
    +    "mrNoToAll " +
    +    "mrYes " +
    +    "mrYesToAll " +
    +    "MULTIPLE_SELECT_DIALOG_CODE " +
    +    "NONOPERATING_RECORD_FLAG_FEMININE " +
    +    "NONOPERATING_RECORD_FLAG_MASCULINE " +
    +    "OPERATING_RECORD_FLAG_FEMININE " +
    +    "OPERATING_RECORD_FLAG_MASCULINE " +
    +    "PROFILING_SETTINGS_COMMON_SETTINGS_CODE_VALUE " +
    +    "PROGRAM_INITIATED_LOOKUP_ACTION " +
    +    "ratDelete " +
    +    "ratEdit " +
    +    "ratInsert " +
    +    "REPORT_TYPE " +
    +    "REQUIRED_PICK_VALUES_VARIABLE " +
    +    "rmCard " +
    +    "rmList " +
    +    "SBRTE_PROGID_DEV " +
    +    "SBRTE_PROGID_RELEASE " +
    +    "STATIC_ROLE_TYPE_CODE " +
    +    "SUPPRESS_EMPTY_TEMPLATE_CREATION " +
    +    "SYSTEM_USER_CODE " +
    +    "UPDATE_DIALOG_DATASET " +
    +    "USED_IN_OBJECT_HINT_PARAM " +
    +    "USER_INITIATED_LOOKUP_ACTION " +
    +    "USER_NAME_FORMAT " +
    +    "USER_SELECTION_RESTRICTIONS " +
    +    "WORKFLOW_TEST_PROTOCOLS_FOLDER_PATH " +
    +    "ELS_SUBTYPE_CONTROL_NAME " +
    +    "ELS_FOLDER_KIND_CONTROL_NAME " +
    +    "REPEAT_PROCESS_CURRENT_OBJECT_EXCEPTION_NAME ";
    +
    +  // Privileges
    +  const privileges_constants =
    +    "PRIVILEGE_COMPONENT_FULL_ACCESS " +
    +    "PRIVILEGE_DEVELOPMENT_EXPORT " +
    +    "PRIVILEGE_DEVELOPMENT_IMPORT " +
    +    "PRIVILEGE_DOCUMENT_DELETE " +
    +    "PRIVILEGE_ESD " +
    +    "PRIVILEGE_FOLDER_DELETE " +
    +    "PRIVILEGE_MANAGE_ACCESS_RIGHTS " +
    +    "PRIVILEGE_MANAGE_REPLICATION " +
    +    "PRIVILEGE_MANAGE_SESSION_SERVER " +
    +    "PRIVILEGE_OBJECT_FULL_ACCESS " +
    +    "PRIVILEGE_OBJECT_VIEW " +
    +    "PRIVILEGE_RESERVE_LICENSE " +
    +    "PRIVILEGE_SYSTEM_CUSTOMIZE " +
    +    "PRIVILEGE_SYSTEM_DEVELOP " +
    +    "PRIVILEGE_SYSTEM_INSTALL " +
    +    "PRIVILEGE_TASK_DELETE " +
    +    "PRIVILEGE_USER_PLUGIN_SETTINGS_CUSTOMIZE " +
    +    "PRIVILEGES_PSEUDOREFERENCE_CODE ";
    +
    +  // Pseudoreference code
    +  const pseudoreference_code_constants =
    +    "ACCESS_TYPES_PSEUDOREFERENCE_CODE " +
    +    "ALL_AVAILABLE_COMPONENTS_PSEUDOREFERENCE_CODE " +
    +    "ALL_AVAILABLE_PRIVILEGES_PSEUDOREFERENCE_CODE " +
    +    "ALL_REPLICATE_COMPONENTS_PSEUDOREFERENCE_CODE " +
    +    "AVAILABLE_DEVELOPERS_COMPONENTS_PSEUDOREFERENCE_CODE " +
    +    "COMPONENTS_PSEUDOREFERENCE_CODE " +
    +    "FILTRATER_SETTINGS_CONFLICTS_PSEUDOREFERENCE_CODE " +
    +    "GROUPS_PSEUDOREFERENCE_CODE " +
    +    "RECEIVE_PROTOCOL_PSEUDOREFERENCE_CODE " +
    +    "REFERENCE_REQUISITE_PSEUDOREFERENCE_CODE " +
    +    "REFERENCE_REQUISITES_PSEUDOREFERENCE_CODE " +
    +    "REFTYPES_PSEUDOREFERENCE_CODE " +
    +    "REPLICATION_SEANCES_DIARY_PSEUDOREFERENCE_CODE " +
    +    "SEND_PROTOCOL_PSEUDOREFERENCE_CODE " +
    +    "SUBSTITUTES_PSEUDOREFERENCE_CODE " +
    +    "SYSTEM_SETTINGS_PSEUDOREFERENCE_CODE " +
    +    "UNITS_PSEUDOREFERENCE_CODE " +
    +    "USERS_PSEUDOREFERENCE_CODE " +
    +    "VIEWERS_PSEUDOREFERENCE_CODE ";
    +
    +  // Requisite ISBCertificateType values
    +  const requisite_ISBCertificateType_values_constants =
    +    "CERTIFICATE_TYPE_ENCRYPT " +
    +    "CERTIFICATE_TYPE_SIGN " +
    +    "CERTIFICATE_TYPE_SIGN_AND_ENCRYPT ";
    +
    +  // Requisite ISBEDocStorageType values
    +  const requisite_ISBEDocStorageType_values_constants =
    +    "STORAGE_TYPE_FILE " +
    +    "STORAGE_TYPE_NAS_CIFS " +
    +    "STORAGE_TYPE_SAPERION " +
    +    "STORAGE_TYPE_SQL_SERVER ";
    +
    +  // Requisite CompType2 values
    +  const requisite_compType2_values_constants =
    +    "COMPTYPE2_REQUISITE_DOCUMENTS_VALUE " +
    +    "COMPTYPE2_REQUISITE_TASKS_VALUE " +
    +    "COMPTYPE2_REQUISITE_FOLDERS_VALUE " +
    +    "COMPTYPE2_REQUISITE_REFERENCES_VALUE ";
    +
    +  // Requisite name
    +  const requisite_name_constants =
    +    "SYSREQ_CODE " +
    +    "SYSREQ_COMPTYPE2 " +
    +    "SYSREQ_CONST_AVAILABLE_FOR_WEB " +
    +    "SYSREQ_CONST_COMMON_CODE " +
    +    "SYSREQ_CONST_COMMON_VALUE " +
    +    "SYSREQ_CONST_FIRM_CODE " +
    +    "SYSREQ_CONST_FIRM_STATUS " +
    +    "SYSREQ_CONST_FIRM_VALUE " +
    +    "SYSREQ_CONST_SERVER_STATUS " +
    +    "SYSREQ_CONTENTS " +
    +    "SYSREQ_DATE_OPEN " +
    +    "SYSREQ_DATE_CLOSE " +
    +    "SYSREQ_DESCRIPTION " +
    +    "SYSREQ_DESCRIPTION_LOCALIZE_ID " +
    +    "SYSREQ_DOUBLE " +
    +    "SYSREQ_EDOC_ACCESS_TYPE " +
    +    "SYSREQ_EDOC_AUTHOR " +
    +    "SYSREQ_EDOC_CREATED " +
    +    "SYSREQ_EDOC_DELEGATE_RIGHTS_REQUISITE_CODE " +
    +    "SYSREQ_EDOC_EDITOR " +
    +    "SYSREQ_EDOC_ENCODE_TYPE " +
    +    "SYSREQ_EDOC_ENCRYPTION_PLUGIN_NAME " +
    +    "SYSREQ_EDOC_ENCRYPTION_PLUGIN_VERSION " +
    +    "SYSREQ_EDOC_EXPORT_DATE " +
    +    "SYSREQ_EDOC_EXPORTER " +
    +    "SYSREQ_EDOC_KIND " +
    +    "SYSREQ_EDOC_LIFE_STAGE_NAME " +
    +    "SYSREQ_EDOC_LOCKED_FOR_SERVER_CODE " +
    +    "SYSREQ_EDOC_MODIFIED " +
    +    "SYSREQ_EDOC_NAME " +
    +    "SYSREQ_EDOC_NOTE " +
    +    "SYSREQ_EDOC_QUALIFIED_ID " +
    +    "SYSREQ_EDOC_SESSION_KEY " +
    +    "SYSREQ_EDOC_SESSION_KEY_ENCRYPTION_PLUGIN_NAME " +
    +    "SYSREQ_EDOC_SESSION_KEY_ENCRYPTION_PLUGIN_VERSION " +
    +    "SYSREQ_EDOC_SIGNATURE_TYPE " +
    +    "SYSREQ_EDOC_SIGNED " +
    +    "SYSREQ_EDOC_STORAGE " +
    +    "SYSREQ_EDOC_STORAGES_ARCHIVE_STORAGE " +
    +    "SYSREQ_EDOC_STORAGES_CHECK_RIGHTS " +
    +    "SYSREQ_EDOC_STORAGES_COMPUTER_NAME " +
    +    "SYSREQ_EDOC_STORAGES_EDIT_IN_STORAGE " +
    +    "SYSREQ_EDOC_STORAGES_EXECUTIVE_STORAGE " +
    +    "SYSREQ_EDOC_STORAGES_FUNCTION " +
    +    "SYSREQ_EDOC_STORAGES_INITIALIZED " +
    +    "SYSREQ_EDOC_STORAGES_LOCAL_PATH " +
    +    "SYSREQ_EDOC_STORAGES_SAPERION_DATABASE_NAME " +
    +    "SYSREQ_EDOC_STORAGES_SEARCH_BY_TEXT " +
    +    "SYSREQ_EDOC_STORAGES_SERVER_NAME " +
    +    "SYSREQ_EDOC_STORAGES_SHARED_SOURCE_NAME " +
    +    "SYSREQ_EDOC_STORAGES_TYPE " +
    +    "SYSREQ_EDOC_TEXT_MODIFIED " +
    +    "SYSREQ_EDOC_TYPE_ACT_CODE " +
    +    "SYSREQ_EDOC_TYPE_ACT_DESCRIPTION " +
    +    "SYSREQ_EDOC_TYPE_ACT_DESCRIPTION_LOCALIZE_ID " +
    +    "SYSREQ_EDOC_TYPE_ACT_ON_EXECUTE " +
    +    "SYSREQ_EDOC_TYPE_ACT_ON_EXECUTE_EXISTS " +
    +    "SYSREQ_EDOC_TYPE_ACT_SECTION " +
    +    "SYSREQ_EDOC_TYPE_ADD_PARAMS " +
    +    "SYSREQ_EDOC_TYPE_COMMENT " +
    +    "SYSREQ_EDOC_TYPE_EVENT_TEXT " +
    +    "SYSREQ_EDOC_TYPE_NAME_IN_SINGULAR " +
    +    "SYSREQ_EDOC_TYPE_NAME_IN_SINGULAR_LOCALIZE_ID " +
    +    "SYSREQ_EDOC_TYPE_NAME_LOCALIZE_ID " +
    +    "SYSREQ_EDOC_TYPE_NUMERATION_METHOD " +
    +    "SYSREQ_EDOC_TYPE_PSEUDO_REQUISITE_CODE " +
    +    "SYSREQ_EDOC_TYPE_REQ_CODE " +
    +    "SYSREQ_EDOC_TYPE_REQ_DESCRIPTION " +
    +    "SYSREQ_EDOC_TYPE_REQ_DESCRIPTION_LOCALIZE_ID " +
    +    "SYSREQ_EDOC_TYPE_REQ_IS_LEADING " +
    +    "SYSREQ_EDOC_TYPE_REQ_IS_REQUIRED " +
    +    "SYSREQ_EDOC_TYPE_REQ_NUMBER " +
    +    "SYSREQ_EDOC_TYPE_REQ_ON_CHANGE " +
    +    "SYSREQ_EDOC_TYPE_REQ_ON_CHANGE_EXISTS " +
    +    "SYSREQ_EDOC_TYPE_REQ_ON_SELECT " +
    +    "SYSREQ_EDOC_TYPE_REQ_ON_SELECT_KIND " +
    +    "SYSREQ_EDOC_TYPE_REQ_SECTION " +
    +    "SYSREQ_EDOC_TYPE_VIEW_CARD " +
    +    "SYSREQ_EDOC_TYPE_VIEW_CODE " +
    +    "SYSREQ_EDOC_TYPE_VIEW_COMMENT " +
    +    "SYSREQ_EDOC_TYPE_VIEW_IS_MAIN " +
    +    "SYSREQ_EDOC_TYPE_VIEW_NAME " +
    +    "SYSREQ_EDOC_TYPE_VIEW_NAME_LOCALIZE_ID " +
    +    "SYSREQ_EDOC_VERSION_AUTHOR " +
    +    "SYSREQ_EDOC_VERSION_CRC " +
    +    "SYSREQ_EDOC_VERSION_DATA " +
    +    "SYSREQ_EDOC_VERSION_EDITOR " +
    +    "SYSREQ_EDOC_VERSION_EXPORT_DATE " +
    +    "SYSREQ_EDOC_VERSION_EXPORTER " +
    +    "SYSREQ_EDOC_VERSION_HIDDEN " +
    +    "SYSREQ_EDOC_VERSION_LIFE_STAGE " +
    +    "SYSREQ_EDOC_VERSION_MODIFIED " +
    +    "SYSREQ_EDOC_VERSION_NOTE " +
    +    "SYSREQ_EDOC_VERSION_SIGNATURE_TYPE " +
    +    "SYSREQ_EDOC_VERSION_SIGNED " +
    +    "SYSREQ_EDOC_VERSION_SIZE " +
    +    "SYSREQ_EDOC_VERSION_SOURCE " +
    +    "SYSREQ_EDOC_VERSION_TEXT_MODIFIED " +
    +    "SYSREQ_EDOCKIND_DEFAULT_VERSION_STATE_CODE " +
    +    "SYSREQ_FOLDER_KIND " +
    +    "SYSREQ_FUNC_CATEGORY " +
    +    "SYSREQ_FUNC_COMMENT " +
    +    "SYSREQ_FUNC_GROUP " +
    +    "SYSREQ_FUNC_GROUP_COMMENT " +
    +    "SYSREQ_FUNC_GROUP_NUMBER " +
    +    "SYSREQ_FUNC_HELP " +
    +    "SYSREQ_FUNC_PARAM_DEF_VALUE " +
    +    "SYSREQ_FUNC_PARAM_IDENT " +
    +    "SYSREQ_FUNC_PARAM_NUMBER " +
    +    "SYSREQ_FUNC_PARAM_TYPE " +
    +    "SYSREQ_FUNC_TEXT " +
    +    "SYSREQ_GROUP_CATEGORY " +
    +    "SYSREQ_ID " +
    +    "SYSREQ_LAST_UPDATE " +
    +    "SYSREQ_LEADER_REFERENCE " +
    +    "SYSREQ_LINE_NUMBER " +
    +    "SYSREQ_MAIN_RECORD_ID " +
    +    "SYSREQ_NAME " +
    +    "SYSREQ_NAME_LOCALIZE_ID " +
    +    "SYSREQ_NOTE " +
    +    "SYSREQ_ORIGINAL_RECORD " +
    +    "SYSREQ_OUR_FIRM " +
    +    "SYSREQ_PROFILING_SETTINGS_BATCH_LOGING " +
    +    "SYSREQ_PROFILING_SETTINGS_BATCH_SIZE " +
    +    "SYSREQ_PROFILING_SETTINGS_PROFILING_ENABLED " +
    +    "SYSREQ_PROFILING_SETTINGS_SQL_PROFILING_ENABLED " +
    +    "SYSREQ_PROFILING_SETTINGS_START_LOGGED " +
    +    "SYSREQ_RECORD_STATUS " +
    +    "SYSREQ_REF_REQ_FIELD_NAME " +
    +    "SYSREQ_REF_REQ_FORMAT " +
    +    "SYSREQ_REF_REQ_GENERATED " +
    +    "SYSREQ_REF_REQ_LENGTH " +
    +    "SYSREQ_REF_REQ_PRECISION " +
    +    "SYSREQ_REF_REQ_REFERENCE " +
    +    "SYSREQ_REF_REQ_SECTION " +
    +    "SYSREQ_REF_REQ_STORED " +
    +    "SYSREQ_REF_REQ_TOKENS " +
    +    "SYSREQ_REF_REQ_TYPE " +
    +    "SYSREQ_REF_REQ_VIEW " +
    +    "SYSREQ_REF_TYPE_ACT_CODE " +
    +    "SYSREQ_REF_TYPE_ACT_DESCRIPTION " +
    +    "SYSREQ_REF_TYPE_ACT_DESCRIPTION_LOCALIZE_ID " +
    +    "SYSREQ_REF_TYPE_ACT_ON_EXECUTE " +
    +    "SYSREQ_REF_TYPE_ACT_ON_EXECUTE_EXISTS " +
    +    "SYSREQ_REF_TYPE_ACT_SECTION " +
    +    "SYSREQ_REF_TYPE_ADD_PARAMS " +
    +    "SYSREQ_REF_TYPE_COMMENT " +
    +    "SYSREQ_REF_TYPE_COMMON_SETTINGS " +
    +    "SYSREQ_REF_TYPE_DISPLAY_REQUISITE_NAME " +
    +    "SYSREQ_REF_TYPE_EVENT_TEXT " +
    +    "SYSREQ_REF_TYPE_MAIN_LEADING_REF " +
    +    "SYSREQ_REF_TYPE_NAME_IN_SINGULAR " +
    +    "SYSREQ_REF_TYPE_NAME_IN_SINGULAR_LOCALIZE_ID " +
    +    "SYSREQ_REF_TYPE_NAME_LOCALIZE_ID " +
    +    "SYSREQ_REF_TYPE_NUMERATION_METHOD " +
    +    "SYSREQ_REF_TYPE_REQ_CODE " +
    +    "SYSREQ_REF_TYPE_REQ_DESCRIPTION " +
    +    "SYSREQ_REF_TYPE_REQ_DESCRIPTION_LOCALIZE_ID " +
    +    "SYSREQ_REF_TYPE_REQ_IS_CONTROL " +
    +    "SYSREQ_REF_TYPE_REQ_IS_FILTER " +
    +    "SYSREQ_REF_TYPE_REQ_IS_LEADING " +
    +    "SYSREQ_REF_TYPE_REQ_IS_REQUIRED " +
    +    "SYSREQ_REF_TYPE_REQ_NUMBER " +
    +    "SYSREQ_REF_TYPE_REQ_ON_CHANGE " +
    +    "SYSREQ_REF_TYPE_REQ_ON_CHANGE_EXISTS " +
    +    "SYSREQ_REF_TYPE_REQ_ON_SELECT " +
    +    "SYSREQ_REF_TYPE_REQ_ON_SELECT_KIND " +
    +    "SYSREQ_REF_TYPE_REQ_SECTION " +
    +    "SYSREQ_REF_TYPE_VIEW_CARD " +
    +    "SYSREQ_REF_TYPE_VIEW_CODE " +
    +    "SYSREQ_REF_TYPE_VIEW_COMMENT " +
    +    "SYSREQ_REF_TYPE_VIEW_IS_MAIN " +
    +    "SYSREQ_REF_TYPE_VIEW_NAME " +
    +    "SYSREQ_REF_TYPE_VIEW_NAME_LOCALIZE_ID " +
    +    "SYSREQ_REFERENCE_TYPE_ID " +
    +    "SYSREQ_STATE " +
    +    "SYSREQ_STATЕ " +
    +    "SYSREQ_SYSTEM_SETTINGS_VALUE " +
    +    "SYSREQ_TYPE " +
    +    "SYSREQ_UNIT " +
    +    "SYSREQ_UNIT_ID " +
    +    "SYSREQ_USER_GROUPS_GROUP_FULL_NAME " +
    +    "SYSREQ_USER_GROUPS_GROUP_NAME " +
    +    "SYSREQ_USER_GROUPS_GROUP_SERVER_NAME " +
    +    "SYSREQ_USERS_ACCESS_RIGHTS " +
    +    "SYSREQ_USERS_AUTHENTICATION " +
    +    "SYSREQ_USERS_CATEGORY " +
    +    "SYSREQ_USERS_COMPONENT " +
    +    "SYSREQ_USERS_COMPONENT_USER_IS_PUBLIC " +
    +    "SYSREQ_USERS_DOMAIN " +
    +    "SYSREQ_USERS_FULL_USER_NAME " +
    +    "SYSREQ_USERS_GROUP " +
    +    "SYSREQ_USERS_IS_MAIN_SERVER " +
    +    "SYSREQ_USERS_LOGIN " +
    +    "SYSREQ_USERS_REFERENCE_USER_IS_PUBLIC " +
    +    "SYSREQ_USERS_STATUS " +
    +    "SYSREQ_USERS_USER_CERTIFICATE " +
    +    "SYSREQ_USERS_USER_CERTIFICATE_INFO " +
    +    "SYSREQ_USERS_USER_CERTIFICATE_PLUGIN_NAME " +
    +    "SYSREQ_USERS_USER_CERTIFICATE_PLUGIN_VERSION " +
    +    "SYSREQ_USERS_USER_CERTIFICATE_STATE " +
    +    "SYSREQ_USERS_USER_CERTIFICATE_SUBJECT_NAME " +
    +    "SYSREQ_USERS_USER_CERTIFICATE_THUMBPRINT " +
    +    "SYSREQ_USERS_USER_DEFAULT_CERTIFICATE " +
    +    "SYSREQ_USERS_USER_DESCRIPTION " +
    +    "SYSREQ_USERS_USER_GLOBAL_NAME " +
    +    "SYSREQ_USERS_USER_LOGIN " +
    +    "SYSREQ_USERS_USER_MAIN_SERVER " +
    +    "SYSREQ_USERS_USER_TYPE " +
    +    "SYSREQ_WORK_RULES_FOLDER_ID ";
    +
    +  // Result
    +  const result_constants = "RESULT_VAR_NAME RESULT_VAR_NAME_ENG ";
    +
    +  // Rule identification
    +  const rule_identification_constants =
    +    "AUTO_NUMERATION_RULE_ID " +
    +    "CANT_CHANGE_ID_REQUISITE_RULE_ID " +
    +    "CANT_CHANGE_OURFIRM_REQUISITE_RULE_ID " +
    +    "CHECK_CHANGING_REFERENCE_RECORD_USE_RULE_ID " +
    +    "CHECK_CODE_REQUISITE_RULE_ID " +
    +    "CHECK_DELETING_REFERENCE_RECORD_USE_RULE_ID " +
    +    "CHECK_FILTRATER_CHANGES_RULE_ID " +
    +    "CHECK_RECORD_INTERVAL_RULE_ID " +
    +    "CHECK_REFERENCE_INTERVAL_RULE_ID " +
    +    "CHECK_REQUIRED_DATA_FULLNESS_RULE_ID " +
    +    "CHECK_REQUIRED_REQUISITES_FULLNESS_RULE_ID " +
    +    "MAKE_RECORD_UNRATIFIED_RULE_ID " +
    +    "RESTORE_AUTO_NUMERATION_RULE_ID " +
    +    "SET_FIRM_CONTEXT_FROM_RECORD_RULE_ID " +
    +    "SET_FIRST_RECORD_IN_LIST_FORM_RULE_ID " +
    +    "SET_IDSPS_VALUE_RULE_ID " +
    +    "SET_NEXT_CODE_VALUE_RULE_ID " +
    +    "SET_OURFIRM_BOUNDS_RULE_ID " +
    +    "SET_OURFIRM_REQUISITE_RULE_ID ";
    +
    +  // Script block properties
    +  const script_block_properties_constants =
    +    "SCRIPT_BLOCK_AFTER_FINISH_EVENT " +
    +    "SCRIPT_BLOCK_BEFORE_START_EVENT " +
    +    "SCRIPT_BLOCK_EXECUTION_RESULTS_PROPERTY " +
    +    "SCRIPT_BLOCK_NAME_PROPERTY " +
    +    "SCRIPT_BLOCK_SCRIPT_PROPERTY ";
    +
    +  // Subtask block properties
    +  const subtask_block_properties_constants =
    +    "SUBTASK_BLOCK_ABORT_DEADLINE_PROPERTY " +
    +    "SUBTASK_BLOCK_AFTER_FINISH_EVENT " +
    +    "SUBTASK_BLOCK_ASSIGN_PARAMS_EVENT " +
    +    "SUBTASK_BLOCK_ATTACHMENTS_PROPERTY " +
    +    "SUBTASK_BLOCK_ATTACHMENTS_RIGHTS_GROUP_PROPERTY " +
    +    "SUBTASK_BLOCK_ATTACHMENTS_RIGHTS_TYPE_PROPERTY " +
    +    "SUBTASK_BLOCK_BEFORE_START_EVENT " +
    +    "SUBTASK_BLOCK_CREATED_TASK_PROPERTY " +
    +    "SUBTASK_BLOCK_CREATION_EVENT " +
    +    "SUBTASK_BLOCK_DEADLINE_PROPERTY " +
    +    "SUBTASK_BLOCK_IMPORTANCE_PROPERTY " +
    +    "SUBTASK_BLOCK_INITIATOR_PROPERTY " +
    +    "SUBTASK_BLOCK_IS_RELATIVE_ABORT_DEADLINE_PROPERTY " +
    +    "SUBTASK_BLOCK_IS_RELATIVE_DEADLINE_PROPERTY " +
    +    "SUBTASK_BLOCK_JOBS_TYPE_PROPERTY " +
    +    "SUBTASK_BLOCK_NAME_PROPERTY " +
    +    "SUBTASK_BLOCK_PARALLEL_ROUTE_PROPERTY " +
    +    "SUBTASK_BLOCK_PERFORMERS_PROPERTY " +
    +    "SUBTASK_BLOCK_RELATIVE_ABORT_DEADLINE_TYPE_PROPERTY " +
    +    "SUBTASK_BLOCK_RELATIVE_DEADLINE_TYPE_PROPERTY " +
    +    "SUBTASK_BLOCK_REQUIRE_SIGN_PROPERTY " +
    +    "SUBTASK_BLOCK_STANDARD_ROUTE_PROPERTY " +
    +    "SUBTASK_BLOCK_START_EVENT " +
    +    "SUBTASK_BLOCK_STEP_CONTROL_PROPERTY " +
    +    "SUBTASK_BLOCK_SUBJECT_PROPERTY " +
    +    "SUBTASK_BLOCK_TASK_CONTROL_PROPERTY " +
    +    "SUBTASK_BLOCK_TEXT_PROPERTY " +
    +    "SUBTASK_BLOCK_UNLOCK_ATTACHMENTS_ON_STOP_PROPERTY " +
    +    "SUBTASK_BLOCK_USE_STANDARD_ROUTE_PROPERTY " +
    +    "SUBTASK_BLOCK_WAIT_FOR_TASK_COMPLETE_PROPERTY ";
    +
    +  // System component
    +  const system_component_constants =
    +    "SYSCOMP_CONTROL_JOBS " +
    +    "SYSCOMP_FOLDERS " +
    +    "SYSCOMP_JOBS " +
    +    "SYSCOMP_NOTICES " +
    +    "SYSCOMP_TASKS ";
    +
    +  // System dialogs
    +  const system_dialogs_constants =
    +    "SYSDLG_CREATE_EDOCUMENT " +
    +    "SYSDLG_CREATE_EDOCUMENT_VERSION " +
    +    "SYSDLG_CURRENT_PERIOD " +
    +    "SYSDLG_EDIT_FUNCTION_HELP " +
    +    "SYSDLG_EDOCUMENT_KINDS_FOR_TEMPLATE " +
    +    "SYSDLG_EXPORT_MULTIPLE_EDOCUMENTS " +
    +    "SYSDLG_EXPORT_SINGLE_EDOCUMENT " +
    +    "SYSDLG_IMPORT_EDOCUMENT " +
    +    "SYSDLG_MULTIPLE_SELECT " +
    +    "SYSDLG_SETUP_ACCESS_RIGHTS " +
    +    "SYSDLG_SETUP_DEFAULT_RIGHTS " +
    +    "SYSDLG_SETUP_FILTER_CONDITION " +
    +    "SYSDLG_SETUP_SIGN_RIGHTS " +
    +    "SYSDLG_SETUP_TASK_OBSERVERS " +
    +    "SYSDLG_SETUP_TASK_ROUTE " +
    +    "SYSDLG_SETUP_USERS_LIST " +
    +    "SYSDLG_SIGN_EDOCUMENT " +
    +    "SYSDLG_SIGN_MULTIPLE_EDOCUMENTS ";
    +
    +  // System reference names
    +  const system_reference_names_constants =
    +    "SYSREF_ACCESS_RIGHTS_TYPES " +
    +    "SYSREF_ADMINISTRATION_HISTORY " +
    +    "SYSREF_ALL_AVAILABLE_COMPONENTS " +
    +    "SYSREF_ALL_AVAILABLE_PRIVILEGES " +
    +    "SYSREF_ALL_REPLICATING_COMPONENTS " +
    +    "SYSREF_AVAILABLE_DEVELOPERS_COMPONENTS " +
    +    "SYSREF_CALENDAR_EVENTS " +
    +    "SYSREF_COMPONENT_TOKEN_HISTORY " +
    +    "SYSREF_COMPONENT_TOKENS " +
    +    "SYSREF_COMPONENTS " +
    +    "SYSREF_CONSTANTS " +
    +    "SYSREF_DATA_RECEIVE_PROTOCOL " +
    +    "SYSREF_DATA_SEND_PROTOCOL " +
    +    "SYSREF_DIALOGS " +
    +    "SYSREF_DIALOGS_REQUISITES " +
    +    "SYSREF_EDITORS " +
    +    "SYSREF_EDOC_CARDS " +
    +    "SYSREF_EDOC_TYPES " +
    +    "SYSREF_EDOCUMENT_CARD_REQUISITES " +
    +    "SYSREF_EDOCUMENT_CARD_TYPES " +
    +    "SYSREF_EDOCUMENT_CARD_TYPES_REFERENCE " +
    +    "SYSREF_EDOCUMENT_CARDS " +
    +    "SYSREF_EDOCUMENT_HISTORY " +
    +    "SYSREF_EDOCUMENT_KINDS " +
    +    "SYSREF_EDOCUMENT_REQUISITES " +
    +    "SYSREF_EDOCUMENT_SIGNATURES " +
    +    "SYSREF_EDOCUMENT_TEMPLATES " +
    +    "SYSREF_EDOCUMENT_TEXT_STORAGES " +
    +    "SYSREF_EDOCUMENT_VIEWS " +
    +    "SYSREF_FILTERER_SETUP_CONFLICTS " +
    +    "SYSREF_FILTRATER_SETTING_CONFLICTS " +
    +    "SYSREF_FOLDER_HISTORY " +
    +    "SYSREF_FOLDERS " +
    +    "SYSREF_FUNCTION_GROUPS " +
    +    "SYSREF_FUNCTION_PARAMS " +
    +    "SYSREF_FUNCTIONS " +
    +    "SYSREF_JOB_HISTORY " +
    +    "SYSREF_LINKS " +
    +    "SYSREF_LOCALIZATION_DICTIONARY " +
    +    "SYSREF_LOCALIZATION_LANGUAGES " +
    +    "SYSREF_MODULES " +
    +    "SYSREF_PRIVILEGES " +
    +    "SYSREF_RECORD_HISTORY " +
    +    "SYSREF_REFERENCE_REQUISITES " +
    +    "SYSREF_REFERENCE_TYPE_VIEWS " +
    +    "SYSREF_REFERENCE_TYPES " +
    +    "SYSREF_REFERENCES " +
    +    "SYSREF_REFERENCES_REQUISITES " +
    +    "SYSREF_REMOTE_SERVERS " +
    +    "SYSREF_REPLICATION_SESSIONS_LOG " +
    +    "SYSREF_REPLICATION_SESSIONS_PROTOCOL " +
    +    "SYSREF_REPORTS " +
    +    "SYSREF_ROLES " +
    +    "SYSREF_ROUTE_BLOCK_GROUPS " +
    +    "SYSREF_ROUTE_BLOCKS " +
    +    "SYSREF_SCRIPTS " +
    +    "SYSREF_SEARCHES " +
    +    "SYSREF_SERVER_EVENTS " +
    +    "SYSREF_SERVER_EVENTS_HISTORY " +
    +    "SYSREF_STANDARD_ROUTE_GROUPS " +
    +    "SYSREF_STANDARD_ROUTES " +
    +    "SYSREF_STATUSES " +
    +    "SYSREF_SYSTEM_SETTINGS " +
    +    "SYSREF_TASK_HISTORY " +
    +    "SYSREF_TASK_KIND_GROUPS " +
    +    "SYSREF_TASK_KINDS " +
    +    "SYSREF_TASK_RIGHTS " +
    +    "SYSREF_TASK_SIGNATURES " +
    +    "SYSREF_TASKS " +
    +    "SYSREF_UNITS " +
    +    "SYSREF_USER_GROUPS " +
    +    "SYSREF_USER_GROUPS_REFERENCE " +
    +    "SYSREF_USER_SUBSTITUTION " +
    +    "SYSREF_USERS " +
    +    "SYSREF_USERS_REFERENCE " +
    +    "SYSREF_VIEWERS " +
    +    "SYSREF_WORKING_TIME_CALENDARS ";
    +
    +  // Table name
    +  const table_name_constants =
    +    "ACCESS_RIGHTS_TABLE_NAME " +
    +    "EDMS_ACCESS_TABLE_NAME " +
    +    "EDOC_TYPES_TABLE_NAME ";
    +
    +  // Test
    +  const test_constants =
    +    "TEST_DEV_DB_NAME " +
    +    "TEST_DEV_SYSTEM_CODE " +
    +    "TEST_EDMS_DB_NAME " +
    +    "TEST_EDMS_MAIN_CODE " +
    +    "TEST_EDMS_MAIN_DB_NAME " +
    +    "TEST_EDMS_SECOND_CODE " +
    +    "TEST_EDMS_SECOND_DB_NAME " +
    +    "TEST_EDMS_SYSTEM_CODE " +
    +    "TEST_ISB5_MAIN_CODE " +
    +    "TEST_ISB5_SECOND_CODE " +
    +    "TEST_SQL_SERVER_2005_NAME " +
    +    "TEST_SQL_SERVER_NAME ";
    +
    +  // Using the dialog windows
    +  const using_the_dialog_windows_constants =
    +    "ATTENTION_CAPTION " +
    +    "cbsCommandLinks " +
    +    "cbsDefault " +
    +    "CONFIRMATION_CAPTION " +
    +    "ERROR_CAPTION " +
    +    "INFORMATION_CAPTION " +
    +    "mrCancel " +
    +    "mrOk ";
    +
    +  // Using the document
    +  const using_the_document_constants =
    +    "EDOC_VERSION_ACTIVE_STAGE_CODE " +
    +    "EDOC_VERSION_DESIGN_STAGE_CODE " +
    +    "EDOC_VERSION_OBSOLETE_STAGE_CODE ";
    +
    +  // Using the EA and encryption
    +  const using_the_EA_and_encryption_constants =
    +    "cpDataEnciphermentEnabled " +
    +    "cpDigitalSignatureEnabled " +
    +    "cpID " +
    +    "cpIssuer " +
    +    "cpPluginVersion " +
    +    "cpSerial " +
    +    "cpSubjectName " +
    +    "cpSubjSimpleName " +
    +    "cpValidFromDate " +
    +    "cpValidToDate ";
    +
    +  // Using the ISBL-editor
    +  const using_the_ISBL_editor_constants =
    +    "ISBL_SYNTAX " + "NO_SYNTAX " + "XML_SYNTAX ";
    +
    +  // Wait block properties
    +  const wait_block_properties_constants =
    +    "WAIT_BLOCK_AFTER_FINISH_EVENT " +
    +    "WAIT_BLOCK_BEFORE_START_EVENT " +
    +    "WAIT_BLOCK_DEADLINE_PROPERTY " +
    +    "WAIT_BLOCK_IS_RELATIVE_DEADLINE_PROPERTY " +
    +    "WAIT_BLOCK_NAME_PROPERTY " +
    +    "WAIT_BLOCK_RELATIVE_DEADLINE_TYPE_PROPERTY ";
    +
    +  // SYSRES Common
    +  const sysres_common_constants =
    +    "SYSRES_COMMON " +
    +    "SYSRES_CONST " +
    +    "SYSRES_MBFUNC " +
    +    "SYSRES_SBDATA " +
    +    "SYSRES_SBGUI " +
    +    "SYSRES_SBINTF " +
    +    "SYSRES_SBREFDSC " +
    +    "SYSRES_SQLERRORS " +
    +    "SYSRES_SYSCOMP ";
    +
    +  // Константы ==> built_in
    +  const CONSTANTS =
    +    sysres_constants +
    +    base_constants +
    +    base_group_name_constants +
    +    decision_block_properties_constants +
    +    file_extension_constants +
    +    job_block_properties_constants +
    +    language_code_constants +
    +    launching_external_applications_constants +
    +    link_kind_constants +
    +    lock_type_constants +
    +    monitor_block_properties_constants +
    +    notice_block_properties_constants +
    +    object_events_constants +
    +    object_params_constants +
    +    other_constants +
    +    privileges_constants +
    +    pseudoreference_code_constants +
    +    requisite_ISBCertificateType_values_constants +
    +    requisite_ISBEDocStorageType_values_constants +
    +    requisite_compType2_values_constants +
    +    requisite_name_constants +
    +    result_constants +
    +    rule_identification_constants +
    +    script_block_properties_constants +
    +    subtask_block_properties_constants +
    +    system_component_constants +
    +    system_dialogs_constants +
    +    system_reference_names_constants +
    +    table_name_constants +
    +    test_constants +
    +    using_the_dialog_windows_constants +
    +    using_the_document_constants +
    +    using_the_EA_and_encryption_constants +
    +    using_the_ISBL_editor_constants +
    +    wait_block_properties_constants +
    +    sysres_common_constants;
    +
    +  // enum TAccountType
    +  const TAccountType = "atUser atGroup atRole ";
    +
    +  // enum TActionEnabledMode
    +  const TActionEnabledMode =
    +    "aemEnabledAlways " +
    +    "aemDisabledAlways " +
    +    "aemEnabledOnBrowse " +
    +    "aemEnabledOnEdit " +
    +    "aemDisabledOnBrowseEmpty ";
    +
    +  // enum TAddPosition
    +  const TAddPosition = "apBegin apEnd ";
    +
    +  // enum TAlignment
    +  const TAlignment = "alLeft alRight ";
    +
    +  // enum TAreaShowMode
    +  const TAreaShowMode =
    +    "asmNever " +
    +    "asmNoButCustomize " +
    +    "asmAsLastTime " +
    +    "asmYesButCustomize " +
    +    "asmAlways ";
    +
    +  // enum TCertificateInvalidationReason
    +  const TCertificateInvalidationReason = "cirCommon cirRevoked ";
    +
    +  // enum TCertificateType
    +  const TCertificateType = "ctSignature ctEncode ctSignatureEncode ";
    +
    +  // enum TCheckListBoxItemState
    +  const TCheckListBoxItemState = "clbUnchecked clbChecked clbGrayed ";
    +
    +  // enum TCloseOnEsc
    +  const TCloseOnEsc = "ceISB ceAlways ceNever ";
    +
    +  // enum TCompType
    +  const TCompType =
    +    "ctDocument " +
    +    "ctReference " +
    +    "ctScript " +
    +    "ctUnknown " +
    +    "ctReport " +
    +    "ctDialog " +
    +    "ctFunction " +
    +    "ctFolder " +
    +    "ctEDocument " +
    +    "ctTask " +
    +    "ctJob " +
    +    "ctNotice " +
    +    "ctControlJob ";
    +
    +  // enum TConditionFormat
    +  const TConditionFormat = "cfInternal cfDisplay ";
    +
    +  // enum TConnectionIntent
    +  const TConnectionIntent = "ciUnspecified ciWrite ciRead ";
    +
    +  // enum TContentKind
    +  const TContentKind =
    +    "ckFolder " +
    +    "ckEDocument " +
    +    "ckTask " +
    +    "ckJob " +
    +    "ckComponentToken " +
    +    "ckAny " +
    +    "ckReference " +
    +    "ckScript " +
    +    "ckReport " +
    +    "ckDialog ";
    +
    +  // enum TControlType
    +  const TControlType =
    +    "ctISBLEditor " +
    +    "ctBevel " +
    +    "ctButton " +
    +    "ctCheckListBox " +
    +    "ctComboBox " +
    +    "ctComboEdit " +
    +    "ctGrid " +
    +    "ctDBCheckBox " +
    +    "ctDBComboBox " +
    +    "ctDBEdit " +
    +    "ctDBEllipsis " +
    +    "ctDBMemo " +
    +    "ctDBNavigator " +
    +    "ctDBRadioGroup " +
    +    "ctDBStatusLabel " +
    +    "ctEdit " +
    +    "ctGroupBox " +
    +    "ctInplaceHint " +
    +    "ctMemo " +
    +    "ctPanel " +
    +    "ctListBox " +
    +    "ctRadioButton " +
    +    "ctRichEdit " +
    +    "ctTabSheet " +
    +    "ctWebBrowser " +
    +    "ctImage " +
    +    "ctHyperLink " +
    +    "ctLabel " +
    +    "ctDBMultiEllipsis " +
    +    "ctRibbon " +
    +    "ctRichView " +
    +    "ctInnerPanel " +
    +    "ctPanelGroup " +
    +    "ctBitButton ";
    +
    +  // enum TCriterionContentType
    +  const TCriterionContentType =
    +    "cctDate " +
    +    "cctInteger " +
    +    "cctNumeric " +
    +    "cctPick " +
    +    "cctReference " +
    +    "cctString " +
    +    "cctText ";
    +
    +  // enum TCultureType
    +  const TCultureType = "cltInternal cltPrimary cltGUI ";
    +
    +  // enum TDataSetEventType
    +  const TDataSetEventType =
    +    "dseBeforeOpen " +
    +    "dseAfterOpen " +
    +    "dseBeforeClose " +
    +    "dseAfterClose " +
    +    "dseOnValidDelete " +
    +    "dseBeforeDelete " +
    +    "dseAfterDelete " +
    +    "dseAfterDeleteOutOfTransaction " +
    +    "dseOnDeleteError " +
    +    "dseBeforeInsert " +
    +    "dseAfterInsert " +
    +    "dseOnValidUpdate " +
    +    "dseBeforeUpdate " +
    +    "dseOnUpdateRatifiedRecord " +
    +    "dseAfterUpdate " +
    +    "dseAfterUpdateOutOfTransaction " +
    +    "dseOnUpdateError " +
    +    "dseAfterScroll " +
    +    "dseOnOpenRecord " +
    +    "dseOnCloseRecord " +
    +    "dseBeforeCancel " +
    +    "dseAfterCancel " +
    +    "dseOnUpdateDeadlockError " +
    +    "dseBeforeDetailUpdate " +
    +    "dseOnPrepareUpdate " +
    +    "dseOnAnyRequisiteChange ";
    +
    +  // enum TDataSetState
    +  const TDataSetState = "dssEdit dssInsert dssBrowse dssInActive ";
    +
    +  // enum TDateFormatType
    +  const TDateFormatType = "dftDate dftShortDate dftDateTime dftTimeStamp ";
    +
    +  // enum TDateOffsetType
    +  const TDateOffsetType = "dotDays dotHours dotMinutes dotSeconds ";
    +
    +  // enum TDateTimeKind
    +  const TDateTimeKind = "dtkndLocal dtkndUTC ";
    +
    +  // enum TDeaAccessRights
    +  const TDeaAccessRights = "arNone arView arEdit arFull ";
    +
    +  // enum TDocumentDefaultAction
    +  const TDocumentDefaultAction = "ddaView ddaEdit ";
    +
    +  // enum TEditMode
    +  const TEditMode =
    +    "emLock " +
    +    "emEdit " +
    +    "emSign " +
    +    "emExportWithLock " +
    +    "emImportWithUnlock " +
    +    "emChangeVersionNote " +
    +    "emOpenForModify " +
    +    "emChangeLifeStage " +
    +    "emDelete " +
    +    "emCreateVersion " +
    +    "emImport " +
    +    "emUnlockExportedWithLock " +
    +    "emStart " +
    +    "emAbort " +
    +    "emReInit " +
    +    "emMarkAsReaded " +
    +    "emMarkAsUnreaded " +
    +    "emPerform " +
    +    "emAccept " +
    +    "emResume " +
    +    "emChangeRights " +
    +    "emEditRoute " +
    +    "emEditObserver " +
    +    "emRecoveryFromLocalCopy " +
    +    "emChangeWorkAccessType " +
    +    "emChangeEncodeTypeToCertificate " +
    +    "emChangeEncodeTypeToPassword " +
    +    "emChangeEncodeTypeToNone " +
    +    "emChangeEncodeTypeToCertificatePassword " +
    +    "emChangeStandardRoute " +
    +    "emGetText " +
    +    "emOpenForView " +
    +    "emMoveToStorage " +
    +    "emCreateObject " +
    +    "emChangeVersionHidden " +
    +    "emDeleteVersion " +
    +    "emChangeLifeCycleStage " +
    +    "emApprovingSign " +
    +    "emExport " +
    +    "emContinue " +
    +    "emLockFromEdit " +
    +    "emUnLockForEdit " +
    +    "emLockForServer " +
    +    "emUnlockFromServer " +
    +    "emDelegateAccessRights " +
    +    "emReEncode ";
    +
    +  // enum TEditorCloseObservType
    +  const TEditorCloseObservType = "ecotFile ecotProcess ";
    +
    +  // enum TEdmsApplicationAction
    +  const TEdmsApplicationAction = "eaGet eaCopy eaCreate eaCreateStandardRoute ";
    +
    +  // enum TEDocumentLockType
    +  const TEDocumentLockType = "edltAll edltNothing edltQuery ";
    +
    +  // enum TEDocumentStepShowMode
    +  const TEDocumentStepShowMode = "essmText essmCard ";
    +
    +  // enum TEDocumentStepVersionType
    +  const TEDocumentStepVersionType = "esvtLast esvtLastActive esvtSpecified ";
    +
    +  // enum TEDocumentStorageFunction
    +  const TEDocumentStorageFunction = "edsfExecutive edsfArchive ";
    +
    +  // enum TEDocumentStorageType
    +  const TEDocumentStorageType = "edstSQLServer edstFile ";
    +
    +  // enum TEDocumentVersionSourceType
    +  const TEDocumentVersionSourceType =
    +    "edvstNone edvstEDocumentVersionCopy edvstFile edvstTemplate edvstScannedFile ";
    +
    +  // enum TEDocumentVersionState
    +  const TEDocumentVersionState = "vsDefault vsDesign vsActive vsObsolete ";
    +
    +  // enum TEncodeType
    +  const TEncodeType = "etNone etCertificate etPassword etCertificatePassword ";
    +
    +  // enum TExceptionCategory
    +  const TExceptionCategory = "ecException ecWarning ecInformation ";
    +
    +  // enum TExportedSignaturesType
    +  const TExportedSignaturesType = "estAll estApprovingOnly ";
    +
    +  // enum TExportedVersionType
    +  const TExportedVersionType = "evtLast evtLastActive evtQuery ";
    +
    +  // enum TFieldDataType
    +  const TFieldDataType =
    +    "fdtString " +
    +    "fdtNumeric " +
    +    "fdtInteger " +
    +    "fdtDate " +
    +    "fdtText " +
    +    "fdtUnknown " +
    +    "fdtWideString " +
    +    "fdtLargeInteger ";
    +
    +  // enum TFolderType
    +  const TFolderType =
    +    "ftInbox " +
    +    "ftOutbox " +
    +    "ftFavorites " +
    +    "ftCommonFolder " +
    +    "ftUserFolder " +
    +    "ftComponents " +
    +    "ftQuickLaunch " +
    +    "ftShortcuts " +
    +    "ftSearch ";
    +
    +  // enum TGridRowHeight
    +  const TGridRowHeight = "grhAuto " + "grhX1 " + "grhX2 " + "grhX3 ";
    +
    +  // enum THyperlinkType
    +  const THyperlinkType = "hltText " + "hltRTF " + "hltHTML ";
    +
    +  // enum TImageFileFormat
    +  const TImageFileFormat =
    +    "iffBMP " +
    +    "iffJPEG " +
    +    "iffMultiPageTIFF " +
    +    "iffSinglePageTIFF " +
    +    "iffTIFF " +
    +    "iffPNG ";
    +
    +  // enum TImageMode
    +  const TImageMode = "im8bGrayscale " + "im24bRGB " + "im1bMonochrome ";
    +
    +  // enum TImageType
    +  const TImageType = "itBMP " + "itJPEG " + "itWMF " + "itPNG ";
    +
    +  // enum TInplaceHintKind
    +  const TInplaceHintKind =
    +    "ikhInformation " + "ikhWarning " + "ikhError " + "ikhNoIcon ";
    +
    +  // enum TISBLContext
    +  const TISBLContext =
    +    "icUnknown " +
    +    "icScript " +
    +    "icFunction " +
    +    "icIntegratedReport " +
    +    "icAnalyticReport " +
    +    "icDataSetEventHandler " +
    +    "icActionHandler " +
    +    "icFormEventHandler " +
    +    "icLookUpEventHandler " +
    +    "icRequisiteChangeEventHandler " +
    +    "icBeforeSearchEventHandler " +
    +    "icRoleCalculation " +
    +    "icSelectRouteEventHandler " +
    +    "icBlockPropertyCalculation " +
    +    "icBlockQueryParamsEventHandler " +
    +    "icChangeSearchResultEventHandler " +
    +    "icBlockEventHandler " +
    +    "icSubTaskInitEventHandler " +
    +    "icEDocDataSetEventHandler " +
    +    "icEDocLookUpEventHandler " +
    +    "icEDocActionHandler " +
    +    "icEDocFormEventHandler " +
    +    "icEDocRequisiteChangeEventHandler " +
    +    "icStructuredConversionRule " +
    +    "icStructuredConversionEventBefore " +
    +    "icStructuredConversionEventAfter " +
    +    "icWizardEventHandler " +
    +    "icWizardFinishEventHandler " +
    +    "icWizardStepEventHandler " +
    +    "icWizardStepFinishEventHandler " +
    +    "icWizardActionEnableEventHandler " +
    +    "icWizardActionExecuteEventHandler " +
    +    "icCreateJobsHandler " +
    +    "icCreateNoticesHandler " +
    +    "icBeforeLookUpEventHandler " +
    +    "icAfterLookUpEventHandler " +
    +    "icTaskAbortEventHandler " +
    +    "icWorkflowBlockActionHandler " +
    +    "icDialogDataSetEventHandler " +
    +    "icDialogActionHandler " +
    +    "icDialogLookUpEventHandler " +
    +    "icDialogRequisiteChangeEventHandler " +
    +    "icDialogFormEventHandler " +
    +    "icDialogValidCloseEventHandler " +
    +    "icBlockFormEventHandler " +
    +    "icTaskFormEventHandler " +
    +    "icReferenceMethod " +
    +    "icEDocMethod " +
    +    "icDialogMethod " +
    +    "icProcessMessageHandler ";
    +
    +  // enum TItemShow
    +  const TItemShow = "isShow " + "isHide " + "isByUserSettings ";
    +
    +  // enum TJobKind
    +  const TJobKind = "jkJob " + "jkNotice " + "jkControlJob ";
    +
    +  // enum TJoinType
    +  const TJoinType = "jtInner " + "jtLeft " + "jtRight " + "jtFull " + "jtCross ";
    +
    +  // enum TLabelPos
    +  const TLabelPos = "lbpAbove " + "lbpBelow " + "lbpLeft " + "lbpRight ";
    +
    +  // enum TLicensingType
    +  const TLicensingType = "eltPerConnection " + "eltPerUser ";
    +
    +  // enum TLifeCycleStageFontColor
    +  const TLifeCycleStageFontColor =
    +    "sfcUndefined " +
    +    "sfcBlack " +
    +    "sfcGreen " +
    +    "sfcRed " +
    +    "sfcBlue " +
    +    "sfcOrange " +
    +    "sfcLilac ";
    +
    +  // enum TLifeCycleStageFontStyle
    +  const TLifeCycleStageFontStyle = "sfsItalic " + "sfsStrikeout " + "sfsNormal ";
    +
    +  // enum TLockableDevelopmentComponentType
    +  const TLockableDevelopmentComponentType =
    +    "ldctStandardRoute " +
    +    "ldctWizard " +
    +    "ldctScript " +
    +    "ldctFunction " +
    +    "ldctRouteBlock " +
    +    "ldctIntegratedReport " +
    +    "ldctAnalyticReport " +
    +    "ldctReferenceType " +
    +    "ldctEDocumentType " +
    +    "ldctDialog " +
    +    "ldctServerEvents ";
    +
    +  // enum TMaxRecordCountRestrictionType
    +  const TMaxRecordCountRestrictionType =
    +    "mrcrtNone " + "mrcrtUser " + "mrcrtMaximal " + "mrcrtCustom ";
    +
    +  // enum TRangeValueType
    +  const TRangeValueType =
    +    "vtEqual " + "vtGreaterOrEqual " + "vtLessOrEqual " + "vtRange ";
    +
    +  // enum TRelativeDate
    +  const TRelativeDate =
    +    "rdYesterday " +
    +    "rdToday " +
    +    "rdTomorrow " +
    +    "rdThisWeek " +
    +    "rdThisMonth " +
    +    "rdThisYear " +
    +    "rdNextMonth " +
    +    "rdNextWeek " +
    +    "rdLastWeek " +
    +    "rdLastMonth ";
    +
    +  // enum TReportDestination
    +  const TReportDestination = "rdWindow " + "rdFile " + "rdPrinter ";
    +
    +  // enum TReqDataType
    +  const TReqDataType =
    +    "rdtString " +
    +    "rdtNumeric " +
    +    "rdtInteger " +
    +    "rdtDate " +
    +    "rdtReference " +
    +    "rdtAccount " +
    +    "rdtText " +
    +    "rdtPick " +
    +    "rdtUnknown " +
    +    "rdtLargeInteger " +
    +    "rdtDocument ";
    +
    +  // enum TRequisiteEventType
    +  const TRequisiteEventType = "reOnChange " + "reOnChangeValues ";
    +
    +  // enum TSBTimeType
    +  const TSBTimeType = "ttGlobal " + "ttLocal " + "ttUser " + "ttSystem ";
    +
    +  // enum TSearchShowMode
    +  const TSearchShowMode =
    +    "ssmBrowse " + "ssmSelect " + "ssmMultiSelect " + "ssmBrowseModal ";
    +
    +  // enum TSelectMode
    +  const TSelectMode = "smSelect " + "smLike " + "smCard ";
    +
    +  // enum TSignatureType
    +  const TSignatureType = "stNone " + "stAuthenticating " + "stApproving ";
    +
    +  // enum TSignerContentType
    +  const TSignerContentType = "sctString " + "sctStream ";
    +
    +  // enum TStringsSortType
    +  const TStringsSortType = "sstAnsiSort " + "sstNaturalSort ";
    +
    +  // enum TStringValueType
    +  const TStringValueType = "svtEqual " + "svtContain ";
    +
    +  // enum TStructuredObjectAttributeType
    +  const TStructuredObjectAttributeType =
    +    "soatString " +
    +    "soatNumeric " +
    +    "soatInteger " +
    +    "soatDatetime " +
    +    "soatReferenceRecord " +
    +    "soatText " +
    +    "soatPick " +
    +    "soatBoolean " +
    +    "soatEDocument " +
    +    "soatAccount " +
    +    "soatIntegerCollection " +
    +    "soatNumericCollection " +
    +    "soatStringCollection " +
    +    "soatPickCollection " +
    +    "soatDatetimeCollection " +
    +    "soatBooleanCollection " +
    +    "soatReferenceRecordCollection " +
    +    "soatEDocumentCollection " +
    +    "soatAccountCollection " +
    +    "soatContents " +
    +    "soatUnknown ";
    +
    +  // enum TTaskAbortReason
    +  const TTaskAbortReason = "tarAbortByUser " + "tarAbortByWorkflowException ";
    +
    +  // enum TTextValueType
    +  const TTextValueType = "tvtAllWords " + "tvtExactPhrase " + "tvtAnyWord ";
    +
    +  // enum TUserObjectStatus
    +  const TUserObjectStatus =
    +    "usNone " +
    +    "usCompleted " +
    +    "usRedSquare " +
    +    "usBlueSquare " +
    +    "usYellowSquare " +
    +    "usGreenSquare " +
    +    "usOrangeSquare " +
    +    "usPurpleSquare " +
    +    "usFollowUp ";
    +
    +  // enum TUserType
    +  const TUserType =
    +    "utUnknown " +
    +    "utUser " +
    +    "utDeveloper " +
    +    "utAdministrator " +
    +    "utSystemDeveloper " +
    +    "utDisconnected ";
    +
    +  // enum TValuesBuildType
    +  const TValuesBuildType =
    +    "btAnd " + "btDetailAnd " + "btOr " + "btNotOr " + "btOnly ";
    +
    +  // enum TViewMode
    +  const TViewMode = "vmView " + "vmSelect " + "vmNavigation ";
    +
    +  // enum TViewSelectionMode
    +  const TViewSelectionMode =
    +    "vsmSingle " + "vsmMultiple " + "vsmMultipleCheck " + "vsmNoSelection ";
    +
    +  // enum TWizardActionType
    +  const TWizardActionType =
    +    "wfatPrevious " + "wfatNext " + "wfatCancel " + "wfatFinish ";
    +
    +  // enum TWizardFormElementProperty
    +  const TWizardFormElementProperty =
    +    "wfepUndefined " +
    +    "wfepText3 " +
    +    "wfepText6 " +
    +    "wfepText9 " +
    +    "wfepSpinEdit " +
    +    "wfepDropDown " +
    +    "wfepRadioGroup " +
    +    "wfepFlag " +
    +    "wfepText12 " +
    +    "wfepText15 " +
    +    "wfepText18 " +
    +    "wfepText21 " +
    +    "wfepText24 " +
    +    "wfepText27 " +
    +    "wfepText30 " +
    +    "wfepRadioGroupColumn1 " +
    +    "wfepRadioGroupColumn2 " +
    +    "wfepRadioGroupColumn3 ";
    +
    +  // enum TWizardFormElementType
    +  const TWizardFormElementType =
    +    "wfetQueryParameter " + "wfetText " + "wfetDelimiter " + "wfetLabel ";
    +
    +  // enum TWizardParamType
    +  const TWizardParamType =
    +    "wptString " +
    +    "wptInteger " +
    +    "wptNumeric " +
    +    "wptBoolean " +
    +    "wptDateTime " +
    +    "wptPick " +
    +    "wptText " +
    +    "wptUser " +
    +    "wptUserList " +
    +    "wptEDocumentInfo " +
    +    "wptEDocumentInfoList " +
    +    "wptReferenceRecordInfo " +
    +    "wptReferenceRecordInfoList " +
    +    "wptFolderInfo " +
    +    "wptTaskInfo " +
    +    "wptContents " +
    +    "wptFileName " +
    +    "wptDate ";
    +
    +  // enum TWizardStepResult
    +  const TWizardStepResult =
    +    "wsrComplete " +
    +    "wsrGoNext " +
    +    "wsrGoPrevious " +
    +    "wsrCustom " +
    +    "wsrCancel " +
    +    "wsrGoFinal ";
    +
    +  // enum TWizardStepType
    +  const TWizardStepType =
    +    "wstForm " +
    +    "wstEDocument " +
    +    "wstTaskCard " +
    +    "wstReferenceRecordCard " +
    +    "wstFinal ";
    +
    +  // enum TWorkAccessType
    +  const TWorkAccessType = "waAll " + "waPerformers " + "waManual ";
    +
    +  // enum TWorkflowBlockType
    +  const TWorkflowBlockType =
    +    "wsbStart " +
    +    "wsbFinish " +
    +    "wsbNotice " +
    +    "wsbStep " +
    +    "wsbDecision " +
    +    "wsbWait " +
    +    "wsbMonitor " +
    +    "wsbScript " +
    +    "wsbConnector " +
    +    "wsbSubTask " +
    +    "wsbLifeCycleStage " +
    +    "wsbPause ";
    +
    +  // enum TWorkflowDataType
    +  const TWorkflowDataType =
    +    "wdtInteger " +
    +    "wdtFloat " +
    +    "wdtString " +
    +    "wdtPick " +
    +    "wdtDateTime " +
    +    "wdtBoolean " +
    +    "wdtTask " +
    +    "wdtJob " +
    +    "wdtFolder " +
    +    "wdtEDocument " +
    +    "wdtReferenceRecord " +
    +    "wdtUser " +
    +    "wdtGroup " +
    +    "wdtRole " +
    +    "wdtIntegerCollection " +
    +    "wdtFloatCollection " +
    +    "wdtStringCollection " +
    +    "wdtPickCollection " +
    +    "wdtDateTimeCollection " +
    +    "wdtBooleanCollection " +
    +    "wdtTaskCollection " +
    +    "wdtJobCollection " +
    +    "wdtFolderCollection " +
    +    "wdtEDocumentCollection " +
    +    "wdtReferenceRecordCollection " +
    +    "wdtUserCollection " +
    +    "wdtGroupCollection " +
    +    "wdtRoleCollection " +
    +    "wdtContents " +
    +    "wdtUserList " +
    +    "wdtSearchDescription " +
    +    "wdtDeadLine " +
    +    "wdtPickSet " +
    +    "wdtAccountCollection ";
    +
    +  // enum TWorkImportance
    +  const TWorkImportance = "wiLow " + "wiNormal " + "wiHigh ";
    +
    +  // enum TWorkRouteType
    +  const TWorkRouteType = "wrtSoft " + "wrtHard ";
    +
    +  // enum TWorkState
    +  const TWorkState =
    +    "wsInit " +
    +    "wsRunning " +
    +    "wsDone " +
    +    "wsControlled " +
    +    "wsAborted " +
    +    "wsContinued ";
    +
    +  // enum TWorkTextBuildingMode
    +  const TWorkTextBuildingMode =
    +    "wtmFull " + "wtmFromCurrent " + "wtmOnlyCurrent ";
    +
    +  // Перечисления
    +  const ENUMS =
    +    TAccountType +
    +    TActionEnabledMode +
    +    TAddPosition +
    +    TAlignment +
    +    TAreaShowMode +
    +    TCertificateInvalidationReason +
    +    TCertificateType +
    +    TCheckListBoxItemState +
    +    TCloseOnEsc +
    +    TCompType +
    +    TConditionFormat +
    +    TConnectionIntent +
    +    TContentKind +
    +    TControlType +
    +    TCriterionContentType +
    +    TCultureType +
    +    TDataSetEventType +
    +    TDataSetState +
    +    TDateFormatType +
    +    TDateOffsetType +
    +    TDateTimeKind +
    +    TDeaAccessRights +
    +    TDocumentDefaultAction +
    +    TEditMode +
    +    TEditorCloseObservType +
    +    TEdmsApplicationAction +
    +    TEDocumentLockType +
    +    TEDocumentStepShowMode +
    +    TEDocumentStepVersionType +
    +    TEDocumentStorageFunction +
    +    TEDocumentStorageType +
    +    TEDocumentVersionSourceType +
    +    TEDocumentVersionState +
    +    TEncodeType +
    +    TExceptionCategory +
    +    TExportedSignaturesType +
    +    TExportedVersionType +
    +    TFieldDataType +
    +    TFolderType +
    +    TGridRowHeight +
    +    THyperlinkType +
    +    TImageFileFormat +
    +    TImageMode +
    +    TImageType +
    +    TInplaceHintKind +
    +    TISBLContext +
    +    TItemShow +
    +    TJobKind +
    +    TJoinType +
    +    TLabelPos +
    +    TLicensingType +
    +    TLifeCycleStageFontColor +
    +    TLifeCycleStageFontStyle +
    +    TLockableDevelopmentComponentType +
    +    TMaxRecordCountRestrictionType +
    +    TRangeValueType +
    +    TRelativeDate +
    +    TReportDestination +
    +    TReqDataType +
    +    TRequisiteEventType +
    +    TSBTimeType +
    +    TSearchShowMode +
    +    TSelectMode +
    +    TSignatureType +
    +    TSignerContentType +
    +    TStringsSortType +
    +    TStringValueType +
    +    TStructuredObjectAttributeType +
    +    TTaskAbortReason +
    +    TTextValueType +
    +    TUserObjectStatus +
    +    TUserType +
    +    TValuesBuildType +
    +    TViewMode +
    +    TViewSelectionMode +
    +    TWizardActionType +
    +    TWizardFormElementProperty +
    +    TWizardFormElementType +
    +    TWizardParamType +
    +    TWizardStepResult +
    +    TWizardStepType +
    +    TWorkAccessType +
    +    TWorkflowBlockType +
    +    TWorkflowDataType +
    +    TWorkImportance +
    +    TWorkRouteType +
    +    TWorkState +
    +    TWorkTextBuildingMode;
    +
    +  // Системные функции ==> SYSFUNCTIONS
    +  const system_functions =
    +    "AddSubString " +
    +    "AdjustLineBreaks " +
    +    "AmountInWords " +
    +    "Analysis " +
    +    "ArrayDimCount " +
    +    "ArrayHighBound " +
    +    "ArrayLowBound " +
    +    "ArrayOf " +
    +    "ArrayReDim " +
    +    "Assert " +
    +    "Assigned " +
    +    "BeginOfMonth " +
    +    "BeginOfPeriod " +
    +    "BuildProfilingOperationAnalysis " +
    +    "CallProcedure " +
    +    "CanReadFile " +
    +    "CArrayElement " +
    +    "CDataSetRequisite " +
    +    "ChangeDate " +
    +    "ChangeReferenceDataset " +
    +    "Char " +
    +    "CharPos " +
    +    "CheckParam " +
    +    "CheckParamValue " +
    +    "CompareStrings " +
    +    "ConstantExists " +
    +    "ControlState " +
    +    "ConvertDateStr " +
    +    "Copy " +
    +    "CopyFile " +
    +    "CreateArray " +
    +    "CreateCachedReference " +
    +    "CreateConnection " +
    +    "CreateDialog " +
    +    "CreateDualListDialog " +
    +    "CreateEditor " +
    +    "CreateException " +
    +    "CreateFile " +
    +    "CreateFolderDialog " +
    +    "CreateInputDialog " +
    +    "CreateLinkFile " +
    +    "CreateList " +
    +    "CreateLock " +
    +    "CreateMemoryDataSet " +
    +    "CreateObject " +
    +    "CreateOpenDialog " +
    +    "CreateProgress " +
    +    "CreateQuery " +
    +    "CreateReference " +
    +    "CreateReport " +
    +    "CreateSaveDialog " +
    +    "CreateScript " +
    +    "CreateSQLPivotFunction " +
    +    "CreateStringList " +
    +    "CreateTreeListSelectDialog " +
    +    "CSelectSQL " +
    +    "CSQL " +
    +    "CSubString " +
    +    "CurrentUserID " +
    +    "CurrentUserName " +
    +    "CurrentVersion " +
    +    "DataSetLocateEx " +
    +    "DateDiff " +
    +    "DateTimeDiff " +
    +    "DateToStr " +
    +    "DayOfWeek " +
    +    "DeleteFile " +
    +    "DirectoryExists " +
    +    "DisableCheckAccessRights " +
    +    "DisableCheckFullShowingRestriction " +
    +    "DisableMassTaskSendingRestrictions " +
    +    "DropTable " +
    +    "DupeString " +
    +    "EditText " +
    +    "EnableCheckAccessRights " +
    +    "EnableCheckFullShowingRestriction " +
    +    "EnableMassTaskSendingRestrictions " +
    +    "EndOfMonth " +
    +    "EndOfPeriod " +
    +    "ExceptionExists " +
    +    "ExceptionsOff " +
    +    "ExceptionsOn " +
    +    "Execute " +
    +    "ExecuteProcess " +
    +    "Exit " +
    +    "ExpandEnvironmentVariables " +
    +    "ExtractFileDrive " +
    +    "ExtractFileExt " +
    +    "ExtractFileName " +
    +    "ExtractFilePath " +
    +    "ExtractParams " +
    +    "FileExists " +
    +    "FileSize " +
    +    "FindFile " +
    +    "FindSubString " +
    +    "FirmContext " +
    +    "ForceDirectories " +
    +    "Format " +
    +    "FormatDate " +
    +    "FormatNumeric " +
    +    "FormatSQLDate " +
    +    "FormatString " +
    +    "FreeException " +
    +    "GetComponent " +
    +    "GetComponentLaunchParam " +
    +    "GetConstant " +
    +    "GetLastException " +
    +    "GetReferenceRecord " +
    +    "GetRefTypeByRefID " +
    +    "GetTableID " +
    +    "GetTempFolder " +
    +    "IfThen " +
    +    "In " +
    +    "IndexOf " +
    +    "InputDialog " +
    +    "InputDialogEx " +
    +    "InteractiveMode " +
    +    "IsFileLocked " +
    +    "IsGraphicFile " +
    +    "IsNumeric " +
    +    "Length " +
    +    "LoadString " +
    +    "LoadStringFmt " +
    +    "LocalTimeToUTC " +
    +    "LowerCase " +
    +    "Max " +
    +    "MessageBox " +
    +    "MessageBoxEx " +
    +    "MimeDecodeBinary " +
    +    "MimeDecodeString " +
    +    "MimeEncodeBinary " +
    +    "MimeEncodeString " +
    +    "Min " +
    +    "MoneyInWords " +
    +    "MoveFile " +
    +    "NewID " +
    +    "Now " +
    +    "OpenFile " +
    +    "Ord " +
    +    "Precision " +
    +    "Raise " +
    +    "ReadCertificateFromFile " +
    +    "ReadFile " +
    +    "ReferenceCodeByID " +
    +    "ReferenceNumber " +
    +    "ReferenceRequisiteMode " +
    +    "ReferenceRequisiteValue " +
    +    "RegionDateSettings " +
    +    "RegionNumberSettings " +
    +    "RegionTimeSettings " +
    +    "RegRead " +
    +    "RegWrite " +
    +    "RenameFile " +
    +    "Replace " +
    +    "Round " +
    +    "SelectServerCode " +
    +    "SelectSQL " +
    +    "ServerDateTime " +
    +    "SetConstant " +
    +    "SetManagedFolderFieldsState " +
    +    "ShowConstantsInputDialog " +
    +    "ShowMessage " +
    +    "Sleep " +
    +    "Split " +
    +    "SQL " +
    +    "SQL2XLSTAB " +
    +    "SQLProfilingSendReport " +
    +    "StrToDate " +
    +    "SubString " +
    +    "SubStringCount " +
    +    "SystemSetting " +
    +    "Time " +
    +    "TimeDiff " +
    +    "Today " +
    +    "Transliterate " +
    +    "Trim " +
    +    "UpperCase " +
    +    "UserStatus " +
    +    "UTCToLocalTime " +
    +    "ValidateXML " +
    +    "VarIsClear " +
    +    "VarIsEmpty " +
    +    "VarIsNull " +
    +    "WorkTimeDiff " +
    +    "WriteFile " +
    +    "WriteFileEx " +
    +    "WriteObjectHistory " +
    +    "Анализ " +
    +    "БазаДанных " +
    +    "БлокЕсть " +
    +    "БлокЕстьРасш " +
    +    "БлокИнфо " +
    +    "БлокСнять " +
    +    "БлокСнятьРасш " +
    +    "БлокУстановить " +
    +    "Ввод " +
    +    "ВводМеню " +
    +    "ВедС " +
    +    "ВедСпр " +
    +    "ВерхняяГраницаМассива " +
    +    "ВнешПрогр " +
    +    "Восст " +
    +    "ВременнаяПапка " +
    +    "Время " +
    +    "ВыборSQL " +
    +    "ВыбратьЗапись " +
    +    "ВыделитьСтр " +
    +    "Вызвать " +
    +    "Выполнить " +
    +    "ВыпПрогр " +
    +    "ГрафическийФайл " +
    +    "ГруппаДополнительно " +
    +    "ДатаВремяСерв " +
    +    "ДеньНедели " +
    +    "ДиалогДаНет " +
    +    "ДлинаСтр " +
    +    "ДобПодстр " +
    +    "ЕПусто " +
    +    "ЕслиТо " +
    +    "ЕЧисло " +
    +    "ЗамПодстр " +
    +    "ЗаписьСправочника " +
    +    "ЗначПоляСпр " +
    +    "ИДТипСпр " +
    +    "ИзвлечьДиск " +
    +    "ИзвлечьИмяФайла " +
    +    "ИзвлечьПуть " +
    +    "ИзвлечьРасширение " +
    +    "ИзмДат " +
    +    "ИзменитьРазмерМассива " +
    +    "ИзмеренийМассива " +
    +    "ИмяОрг " +
    +    "ИмяПоляСпр " +
    +    "Индекс " +
    +    "ИндикаторЗакрыть " +
    +    "ИндикаторОткрыть " +
    +    "ИндикаторШаг " +
    +    "ИнтерактивныйРежим " +
    +    "ИтогТблСпр " +
    +    "КодВидВедСпр " +
    +    "КодВидСпрПоИД " +
    +    "КодПоAnalit " +
    +    "КодСимвола " +
    +    "КодСпр " +
    +    "КолПодстр " +
    +    "КолПроп " +
    +    "КонМес " +
    +    "Конст " +
    +    "КонстЕсть " +
    +    "КонстЗнач " +
    +    "КонТран " +
    +    "КопироватьФайл " +
    +    "КопияСтр " +
    +    "КПериод " +
    +    "КСтрТблСпр " +
    +    "Макс " +
    +    "МаксСтрТблСпр " +
    +    "Массив " +
    +    "Меню " +
    +    "МенюРасш " +
    +    "Мин " +
    +    "НаборДанныхНайтиРасш " +
    +    "НаимВидСпр " +
    +    "НаимПоAnalit " +
    +    "НаимСпр " +
    +    "НастроитьПереводыСтрок " +
    +    "НачМес " +
    +    "НачТран " +
    +    "НижняяГраницаМассива " +
    +    "НомерСпр " +
    +    "НПериод " +
    +    "Окно " +
    +    "Окр " +
    +    "Окружение " +
    +    "ОтлИнфДобавить " +
    +    "ОтлИнфУдалить " +
    +    "Отчет " +
    +    "ОтчетАнал " +
    +    "ОтчетИнт " +
    +    "ПапкаСуществует " +
    +    "Пауза " +
    +    "ПВыборSQL " +
    +    "ПереименоватьФайл " +
    +    "Переменные " +
    +    "ПереместитьФайл " +
    +    "Подстр " +
    +    "ПоискПодстр " +
    +    "ПоискСтр " +
    +    "ПолучитьИДТаблицы " +
    +    "ПользовательДополнительно " +
    +    "ПользовательИД " +
    +    "ПользовательИмя " +
    +    "ПользовательСтатус " +
    +    "Прервать " +
    +    "ПроверитьПараметр " +
    +    "ПроверитьПараметрЗнач " +
    +    "ПроверитьУсловие " +
    +    "РазбСтр " +
    +    "РазнВремя " +
    +    "РазнДат " +
    +    "РазнДатаВремя " +
    +    "РазнРабВремя " +
    +    "РегУстВрем " +
    +    "РегУстДат " +
    +    "РегУстЧсл " +
    +    "РедТекст " +
    +    "РеестрЗапись " +
    +    "РеестрСписокИменПарам " +
    +    "РеестрЧтение " +
    +    "РеквСпр " +
    +    "РеквСпрПр " +
    +    "Сегодня " +
    +    "Сейчас " +
    +    "Сервер " +
    +    "СерверПроцессИД " +
    +    "СертификатФайлСчитать " +
    +    "СжПроб " +
    +    "Символ " +
    +    "СистемаДиректумКод " +
    +    "СистемаИнформация " +
    +    "СистемаКод " +
    +    "Содержит " +
    +    "СоединениеЗакрыть " +
    +    "СоединениеОткрыть " +
    +    "СоздатьДиалог " +
    +    "СоздатьДиалогВыбораИзДвухСписков " +
    +    "СоздатьДиалогВыбораПапки " +
    +    "СоздатьДиалогОткрытияФайла " +
    +    "СоздатьДиалогСохраненияФайла " +
    +    "СоздатьЗапрос " +
    +    "СоздатьИндикатор " +
    +    "СоздатьИсключение " +
    +    "СоздатьКэшированныйСправочник " +
    +    "СоздатьМассив " +
    +    "СоздатьНаборДанных " +
    +    "СоздатьОбъект " +
    +    "СоздатьОтчет " +
    +    "СоздатьПапку " +
    +    "СоздатьРедактор " +
    +    "СоздатьСоединение " +
    +    "СоздатьСписок " +
    +    "СоздатьСписокСтрок " +
    +    "СоздатьСправочник " +
    +    "СоздатьСценарий " +
    +    "СоздСпр " +
    +    "СостСпр " +
    +    "Сохр " +
    +    "СохрСпр " +
    +    "СписокСистем " +
    +    "Спр " +
    +    "Справочник " +
    +    "СпрБлокЕсть " +
    +    "СпрБлокСнять " +
    +    "СпрБлокСнятьРасш " +
    +    "СпрБлокУстановить " +
    +    "СпрИзмНабДан " +
    +    "СпрКод " +
    +    "СпрНомер " +
    +    "СпрОбновить " +
    +    "СпрОткрыть " +
    +    "СпрОтменить " +
    +    "СпрПарам " +
    +    "СпрПолеЗнач " +
    +    "СпрПолеИмя " +
    +    "СпрРекв " +
    +    "СпрРеквВведЗн " +
    +    "СпрРеквНовые " +
    +    "СпрРеквПр " +
    +    "СпрРеквПредЗн " +
    +    "СпрРеквРежим " +
    +    "СпрРеквТипТекст " +
    +    "СпрСоздать " +
    +    "СпрСост " +
    +    "СпрСохранить " +
    +    "СпрТблИтог " +
    +    "СпрТблСтр " +
    +    "СпрТблСтрКол " +
    +    "СпрТблСтрМакс " +
    +    "СпрТблСтрМин " +
    +    "СпрТблСтрПред " +
    +    "СпрТблСтрСлед " +
    +    "СпрТблСтрСозд " +
    +    "СпрТблСтрУд " +
    +    "СпрТекПредст " +
    +    "СпрУдалить " +
    +    "СравнитьСтр " +
    +    "СтрВерхРегистр " +
    +    "СтрНижнРегистр " +
    +    "СтрТблСпр " +
    +    "СумПроп " +
    +    "Сценарий " +
    +    "СценарийПарам " +
    +    "ТекВерсия " +
    +    "ТекОрг " +
    +    "Точн " +
    +    "Тран " +
    +    "Транслитерация " +
    +    "УдалитьТаблицу " +
    +    "УдалитьФайл " +
    +    "УдСпр " +
    +    "УдСтрТблСпр " +
    +    "Уст " +
    +    "УстановкиКонстант " +
    +    "ФайлАтрибутСчитать " +
    +    "ФайлАтрибутУстановить " +
    +    "ФайлВремя " +
    +    "ФайлВремяУстановить " +
    +    "ФайлВыбрать " +
    +    "ФайлЗанят " +
    +    "ФайлЗаписать " +
    +    "ФайлИскать " +
    +    "ФайлКопировать " +
    +    "ФайлМожноЧитать " +
    +    "ФайлОткрыть " +
    +    "ФайлПереименовать " +
    +    "ФайлПерекодировать " +
    +    "ФайлПереместить " +
    +    "ФайлПросмотреть " +
    +    "ФайлРазмер " +
    +    "ФайлСоздать " +
    +    "ФайлСсылкаСоздать " +
    +    "ФайлСуществует " +
    +    "ФайлСчитать " +
    +    "ФайлУдалить " +
    +    "ФмтSQLДат " +
    +    "ФмтДат " +
    +    "ФмтСтр " +
    +    "ФмтЧсл " +
    +    "Формат " +
    +    "ЦМассивЭлемент " +
    +    "ЦНаборДанныхРеквизит " +
    +    "ЦПодстр ";
    +
    +  // Предопределенные переменные ==> built_in
    +  const predefined_variables =
    +    "AltState " +
    +    "Application " +
    +    "CallType " +
    +    "ComponentTokens " +
    +    "CreatedJobs " +
    +    "CreatedNotices " +
    +    "ControlState " +
    +    "DialogResult " +
    +    "Dialogs " +
    +    "EDocuments " +
    +    "EDocumentVersionSource " +
    +    "Folders " +
    +    "GlobalIDs " +
    +    "Job " +
    +    "Jobs " +
    +    "InputValue " +
    +    "LookUpReference " +
    +    "LookUpRequisiteNames " +
    +    "LookUpSearch " +
    +    "Object " +
    +    "ParentComponent " +
    +    "Processes " +
    +    "References " +
    +    "Requisite " +
    +    "ReportName " +
    +    "Reports " +
    +    "Result " +
    +    "Scripts " +
    +    "Searches " +
    +    "SelectedAttachments " +
    +    "SelectedItems " +
    +    "SelectMode " +
    +    "Sender " +
    +    "ServerEvents " +
    +    "ServiceFactory " +
    +    "ShiftState " +
    +    "SubTask " +
    +    "SystemDialogs " +
    +    "Tasks " +
    +    "Wizard " +
    +    "Wizards " +
    +    "Work " +
    +    "ВызовСпособ " +
    +    "ИмяОтчета " +
    +    "РеквЗнач ";
    +
    +  // Интерфейсы ==> type
    +  const interfaces =
    +    "IApplication " +
    +    "IAccessRights " +
    +    "IAccountRepository " +
    +    "IAccountSelectionRestrictions " +
    +    "IAction " +
    +    "IActionList " +
    +    "IAdministrationHistoryDescription " +
    +    "IAnchors " +
    +    "IApplication " +
    +    "IArchiveInfo " +
    +    "IAttachment " +
    +    "IAttachmentList " +
    +    "ICheckListBox " +
    +    "ICheckPointedList " +
    +    "IColumn " +
    +    "IComponent " +
    +    "IComponentDescription " +
    +    "IComponentToken " +
    +    "IComponentTokenFactory " +
    +    "IComponentTokenInfo " +
    +    "ICompRecordInfo " +
    +    "IConnection " +
    +    "IContents " +
    +    "IControl " +
    +    "IControlJob " +
    +    "IControlJobInfo " +
    +    "IControlList " +
    +    "ICrypto " +
    +    "ICrypto2 " +
    +    "ICustomJob " +
    +    "ICustomJobInfo " +
    +    "ICustomListBox " +
    +    "ICustomObjectWizardStep " +
    +    "ICustomWork " +
    +    "ICustomWorkInfo " +
    +    "IDataSet " +
    +    "IDataSetAccessInfo " +
    +    "IDataSigner " +
    +    "IDateCriterion " +
    +    "IDateRequisite " +
    +    "IDateRequisiteDescription " +
    +    "IDateValue " +
    +    "IDeaAccessRights " +
    +    "IDeaObjectInfo " +
    +    "IDevelopmentComponentLock " +
    +    "IDialog " +
    +    "IDialogFactory " +
    +    "IDialogPickRequisiteItems " +
    +    "IDialogsFactory " +
    +    "IDICSFactory " +
    +    "IDocRequisite " +
    +    "IDocumentInfo " +
    +    "IDualListDialog " +
    +    "IECertificate " +
    +    "IECertificateInfo " +
    +    "IECertificates " +
    +    "IEditControl " +
    +    "IEditorForm " +
    +    "IEdmsExplorer " +
    +    "IEdmsObject " +
    +    "IEdmsObjectDescription " +
    +    "IEdmsObjectFactory " +
    +    "IEdmsObjectInfo " +
    +    "IEDocument " +
    +    "IEDocumentAccessRights " +
    +    "IEDocumentDescription " +
    +    "IEDocumentEditor " +
    +    "IEDocumentFactory " +
    +    "IEDocumentInfo " +
    +    "IEDocumentStorage " +
    +    "IEDocumentVersion " +
    +    "IEDocumentVersionListDialog " +
    +    "IEDocumentVersionSource " +
    +    "IEDocumentWizardStep " +
    +    "IEDocVerSignature " +
    +    "IEDocVersionState " +
    +    "IEnabledMode " +
    +    "IEncodeProvider " +
    +    "IEncrypter " +
    +    "IEvent " +
    +    "IEventList " +
    +    "IException " +
    +    "IExternalEvents " +
    +    "IExternalHandler " +
    +    "IFactory " +
    +    "IField " +
    +    "IFileDialog " +
    +    "IFolder " +
    +    "IFolderDescription " +
    +    "IFolderDialog " +
    +    "IFolderFactory " +
    +    "IFolderInfo " +
    +    "IForEach " +
    +    "IForm " +
    +    "IFormTitle " +
    +    "IFormWizardStep " +
    +    "IGlobalIDFactory " +
    +    "IGlobalIDInfo " +
    +    "IGrid " +
    +    "IHasher " +
    +    "IHistoryDescription " +
    +    "IHyperLinkControl " +
    +    "IImageButton " +
    +    "IImageControl " +
    +    "IInnerPanel " +
    +    "IInplaceHint " +
    +    "IIntegerCriterion " +
    +    "IIntegerList " +
    +    "IIntegerRequisite " +
    +    "IIntegerValue " +
    +    "IISBLEditorForm " +
    +    "IJob " +
    +    "IJobDescription " +
    +    "IJobFactory " +
    +    "IJobForm " +
    +    "IJobInfo " +
    +    "ILabelControl " +
    +    "ILargeIntegerCriterion " +
    +    "ILargeIntegerRequisite " +
    +    "ILargeIntegerValue " +
    +    "ILicenseInfo " +
    +    "ILifeCycleStage " +
    +    "IList " +
    +    "IListBox " +
    +    "ILocalIDInfo " +
    +    "ILocalization " +
    +    "ILock " +
    +    "IMemoryDataSet " +
    +    "IMessagingFactory " +
    +    "IMetadataRepository " +
    +    "INotice " +
    +    "INoticeInfo " +
    +    "INumericCriterion " +
    +    "INumericRequisite " +
    +    "INumericValue " +
    +    "IObject " +
    +    "IObjectDescription " +
    +    "IObjectImporter " +
    +    "IObjectInfo " +
    +    "IObserver " +
    +    "IPanelGroup " +
    +    "IPickCriterion " +
    +    "IPickProperty " +
    +    "IPickRequisite " +
    +    "IPickRequisiteDescription " +
    +    "IPickRequisiteItem " +
    +    "IPickRequisiteItems " +
    +    "IPickValue " +
    +    "IPrivilege " +
    +    "IPrivilegeList " +
    +    "IProcess " +
    +    "IProcessFactory " +
    +    "IProcessMessage " +
    +    "IProgress " +
    +    "IProperty " +
    +    "IPropertyChangeEvent " +
    +    "IQuery " +
    +    "IReference " +
    +    "IReferenceCriterion " +
    +    "IReferenceEnabledMode " +
    +    "IReferenceFactory " +
    +    "IReferenceHistoryDescription " +
    +    "IReferenceInfo " +
    +    "IReferenceRecordCardWizardStep " +
    +    "IReferenceRequisiteDescription " +
    +    "IReferencesFactory " +
    +    "IReferenceValue " +
    +    "IRefRequisite " +
    +    "IReport " +
    +    "IReportFactory " +
    +    "IRequisite " +
    +    "IRequisiteDescription " +
    +    "IRequisiteDescriptionList " +
    +    "IRequisiteFactory " +
    +    "IRichEdit " +
    +    "IRouteStep " +
    +    "IRule " +
    +    "IRuleList " +
    +    "ISchemeBlock " +
    +    "IScript " +
    +    "IScriptFactory " +
    +    "ISearchCriteria " +
    +    "ISearchCriterion " +
    +    "ISearchDescription " +
    +    "ISearchFactory " +
    +    "ISearchFolderInfo " +
    +    "ISearchForObjectDescription " +
    +    "ISearchResultRestrictions " +
    +    "ISecuredContext " +
    +    "ISelectDialog " +
    +    "IServerEvent " +
    +    "IServerEventFactory " +
    +    "IServiceDialog " +
    +    "IServiceFactory " +
    +    "ISignature " +
    +    "ISignProvider " +
    +    "ISignProvider2 " +
    +    "ISignProvider3 " +
    +    "ISimpleCriterion " +
    +    "IStringCriterion " +
    +    "IStringList " +
    +    "IStringRequisite " +
    +    "IStringRequisiteDescription " +
    +    "IStringValue " +
    +    "ISystemDialogsFactory " +
    +    "ISystemInfo " +
    +    "ITabSheet " +
    +    "ITask " +
    +    "ITaskAbortReasonInfo " +
    +    "ITaskCardWizardStep " +
    +    "ITaskDescription " +
    +    "ITaskFactory " +
    +    "ITaskInfo " +
    +    "ITaskRoute " +
    +    "ITextCriterion " +
    +    "ITextRequisite " +
    +    "ITextValue " +
    +    "ITreeListSelectDialog " +
    +    "IUser " +
    +    "IUserList " +
    +    "IValue " +
    +    "IView " +
    +    "IWebBrowserControl " +
    +    "IWizard " +
    +    "IWizardAction " +
    +    "IWizardFactory " +
    +    "IWizardFormElement " +
    +    "IWizardParam " +
    +    "IWizardPickParam " +
    +    "IWizardReferenceParam " +
    +    "IWizardStep " +
    +    "IWorkAccessRights " +
    +    "IWorkDescription " +
    +    "IWorkflowAskableParam " +
    +    "IWorkflowAskableParams " +
    +    "IWorkflowBlock " +
    +    "IWorkflowBlockResult " +
    +    "IWorkflowEnabledMode " +
    +    "IWorkflowParam " +
    +    "IWorkflowPickParam " +
    +    "IWorkflowReferenceParam " +
    +    "IWorkState " +
    +    "IWorkTreeCustomNode " +
    +    "IWorkTreeJobNode " +
    +    "IWorkTreeTaskNode " +
    +    "IXMLEditorForm " +
    +    "SBCrypto ";
    +
    +  // built_in : встроенные или библиотечные объекты (константы, перечисления)
    +  const BUILTIN = CONSTANTS + ENUMS;
    +
    +  // class: встроенные наборы значений, системные объекты, фабрики
    +  const CLASS = predefined_variables;
    +
    +  // literal : примитивные типы
    +  const LITERAL = "null true false nil ";
    +
    +  // number : числа
    +  const NUMBERS = {
    +    className: "number",
    +    begin: hljs.NUMBER_RE,
    +    relevance: 0
    +  };
    +
    +  // string : строки
    +  const STRINGS = {
    +    className: "string",
    +    variants: [
    +      {
    +        begin: '"',
    +        end: '"'
    +      },
    +      {
    +        begin: "'",
    +        end: "'"
    +      }
    +    ]
    +  };
    +
    +  // Токены
    +  const DOCTAGS = {
    +    className: "doctag",
    +    begin: "\\b(?:TODO|DONE|BEGIN|END|STUB|CHG|FIXME|NOTE|BUG|XXX)\\b",
    +    relevance: 0
    +  };
    +
    +  // Однострочный комментарий
    +  const ISBL_LINE_COMMENT_MODE = {
    +    className: "comment",
    +    begin: "//",
    +    end: "$",
    +    relevance: 0,
    +    contains: [
    +      hljs.PHRASAL_WORDS_MODE,
    +      DOCTAGS
    +    ]
    +  };
    +
    +  // Многострочный комментарий
    +  const ISBL_BLOCK_COMMENT_MODE = {
    +    className: "comment",
    +    begin: "/\\*",
    +    end: "\\*/",
    +    relevance: 0,
    +    contains: [
    +      hljs.PHRASAL_WORDS_MODE,
    +      DOCTAGS
    +    ]
    +  };
    +
    +  // comment : комментарии
    +  const COMMENTS = {
    +    variants: [
    +      ISBL_LINE_COMMENT_MODE,
    +      ISBL_BLOCK_COMMENT_MODE
    +    ]
    +  };
    +
    +  // keywords : ключевые слова
    +  const KEYWORDS = {
    +    $pattern: UNDERSCORE_IDENT_RE,
    +    keyword: KEYWORD,
    +    built_in: BUILTIN,
    +    class: CLASS,
    +    literal: LITERAL
    +  };
    +
    +  // methods : методы
    +  const METHODS = {
    +    begin: "\\.\\s*" + hljs.UNDERSCORE_IDENT_RE,
    +    keywords: KEYWORDS,
    +    relevance: 0
    +  };
    +
    +  // type : встроенные типы
    +  const TYPES = {
    +    className: "type",
    +    begin: ":[ \\t]*(" + interfaces.trim().replace(/\s/g, "|") + ")",
    +    end: "[ \\t]*=",
    +    excludeEnd: true
    +  };
    +
    +  // variables : переменные
    +  const VARIABLES = {
    +    className: "variable",
    +    keywords: KEYWORDS,
    +    begin: UNDERSCORE_IDENT_RE,
    +    relevance: 0,
    +    contains: [
    +      TYPES,
    +      METHODS
    +    ]
    +  };
    +
    +  // Имена функций
    +  const FUNCTION_TITLE = FUNCTION_NAME_IDENT_RE + "\\(";
    +
    +  const TITLE_MODE = {
    +    className: "title",
    +    keywords: {
    +      $pattern: UNDERSCORE_IDENT_RE,
    +      built_in: system_functions
    +    },
    +    begin: FUNCTION_TITLE,
    +    end: "\\(",
    +    returnBegin: true,
    +    excludeEnd: true
    +  };
    +
    +  // function : функции
    +  const FUNCTIONS = {
    +    className: "function",
    +    begin: FUNCTION_TITLE,
    +    end: "\\)$",
    +    returnBegin: true,
    +    keywords: KEYWORDS,
    +    illegal: "[\\[\\]\\|\\$\\?%,~#@]",
    +    contains: [
    +      TITLE_MODE,
    +      METHODS,
    +      VARIABLES,
    +      STRINGS,
    +      NUMBERS,
    +      COMMENTS
    +    ]
    +  };
    +
    +  return {
    +    name: 'ISBL',
    +    aliases: ["isbl"],
    +    case_insensitive: true,
    +    keywords: KEYWORDS,
    +    illegal: "\\$|\\?|%|,|;$|~|#|@|
    +Category: common, enterprise
    +Website: https://www.java.com/
    +*/
    +
    +function java(hljs) {
    +  var JAVA_IDENT_RE = '[\u00C0-\u02B8a-zA-Z_$][\u00C0-\u02B8a-zA-Z_$0-9]*';
    +  var GENERIC_IDENT_RE = JAVA_IDENT_RE + '(<' + JAVA_IDENT_RE + '(\\s*,\\s*' + JAVA_IDENT_RE + ')*>)?';
    +  var KEYWORDS = 'false synchronized int abstract float private char boolean var static null if const ' +
    +    'for true while long strictfp finally protected import native final void ' +
    +    'enum else break transient catch instanceof byte super volatile case assert short ' +
    +    'package default double public try this switch continue throws protected public private ' +
    +    'module requires exports do';
    +
    +  var ANNOTATION = {
    +    className: 'meta',
    +    begin: '@' + JAVA_IDENT_RE,
    +    contains: [
    +      {
    +        begin: /\(/,
    +        end: /\)/,
    +        contains: ["self"] // allow nested () inside our annotation
    +      },
    +    ]
    +  };
    +  const NUMBER = NUMERIC;
    +
    +  return {
    +    name: 'Java',
    +    aliases: ['jsp'],
    +    keywords: KEYWORDS,
    +    illegal: /<\/|#/,
    +    contains: [
    +      hljs.COMMENT(
    +        '/\\*\\*',
    +        '\\*/',
    +        {
    +          relevance: 0,
    +          contains: [
    +            {
    +              // eat up @'s in emails to prevent them to be recognized as doctags
    +              begin: /\w+@/, relevance: 0
    +            },
    +            {
    +              className: 'doctag',
    +              begin: '@[A-Za-z]+'
    +            }
    +          ]
    +        }
    +      ),
    +      // relevance boost
    +      {
    +        begin: /import java\.[a-z]+\./,
    +        keywords: "import",
    +        relevance: 2
    +      },
    +      hljs.C_LINE_COMMENT_MODE,
    +      hljs.C_BLOCK_COMMENT_MODE,
    +      hljs.APOS_STRING_MODE,
    +      hljs.QUOTE_STRING_MODE,
    +      {
    +        className: 'class',
    +        beginKeywords: 'class interface enum', end: /[{;=]/, excludeEnd: true,
    +        keywords: 'class interface enum',
    +        illegal: /[:"\[\]]/,
    +        contains: [
    +          { beginKeywords: 'extends implements' },
    +          hljs.UNDERSCORE_TITLE_MODE
    +        ]
    +      },
    +      {
    +        // Expression keywords prevent 'keyword Name(...)' from being
    +        // recognized as a function definition
    +        beginKeywords: 'new throw return else',
    +        relevance: 0
    +      },
    +      {
    +        className: 'class',
    +        begin: 'record\\s+' + hljs.UNDERSCORE_IDENT_RE + '\\s*\\(',
    +        returnBegin: true,
    +        excludeEnd: true,
    +        end: /[{;=]/,
    +        keywords: KEYWORDS,
    +        contains: [
    +          { beginKeywords: "record" },
    +          {
    +            begin: hljs.UNDERSCORE_IDENT_RE + '\\s*\\(',
    +            returnBegin: true,
    +            relevance: 0,
    +            contains: [hljs.UNDERSCORE_TITLE_MODE]
    +          },
    +          {
    +            className: 'params',
    +            begin: /\(/, end: /\)/,
    +            keywords: KEYWORDS,
    +            relevance: 0,
    +            contains: [
    +              hljs.C_BLOCK_COMMENT_MODE
    +            ]
    +          },
    +          hljs.C_LINE_COMMENT_MODE,
    +          hljs.C_BLOCK_COMMENT_MODE
    +        ]
    +      },
    +      {
    +        className: 'function',
    +        begin: '(' + GENERIC_IDENT_RE + '\\s+)+' + hljs.UNDERSCORE_IDENT_RE + '\\s*\\(', returnBegin: true, end: /[{;=]/,
    +        excludeEnd: true,
    +        keywords: KEYWORDS,
    +        contains: [
    +          {
    +            begin: hljs.UNDERSCORE_IDENT_RE + '\\s*\\(', returnBegin: true,
    +            relevance: 0,
    +            contains: [hljs.UNDERSCORE_TITLE_MODE]
    +          },
    +          {
    +            className: 'params',
    +            begin: /\(/, end: /\)/,
    +            keywords: KEYWORDS,
    +            relevance: 0,
    +            contains: [
    +              ANNOTATION,
    +              hljs.APOS_STRING_MODE,
    +              hljs.QUOTE_STRING_MODE,
    +              NUMBER,
    +              hljs.C_BLOCK_COMMENT_MODE
    +            ]
    +          },
    +          hljs.C_LINE_COMMENT_MODE,
    +          hljs.C_BLOCK_COMMENT_MODE
    +        ]
    +      },
    +      NUMBER,
    +      ANNOTATION
    +    ]
    +  };
    +}
    +
    +module.exports = java;
    diff --git a/node_modules/highlight.js/lib/languages/javascript.js b/node_modules/highlight.js/lib/languages/javascript.js
    new file mode 100644
    index 0000000..9ea49bf
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/javascript.js
    @@ -0,0 +1,601 @@
    +const IDENT_RE = '[A-Za-z$_][0-9A-Za-z$_]*';
    +const KEYWORDS = [
    +  "as", // for exports
    +  "in",
    +  "of",
    +  "if",
    +  "for",
    +  "while",
    +  "finally",
    +  "var",
    +  "new",
    +  "function",
    +  "do",
    +  "return",
    +  "void",
    +  "else",
    +  "break",
    +  "catch",
    +  "instanceof",
    +  "with",
    +  "throw",
    +  "case",
    +  "default",
    +  "try",
    +  "switch",
    +  "continue",
    +  "typeof",
    +  "delete",
    +  "let",
    +  "yield",
    +  "const",
    +  "class",
    +  // JS handles these with a special rule
    +  // "get",
    +  // "set",
    +  "debugger",
    +  "async",
    +  "await",
    +  "static",
    +  "import",
    +  "from",
    +  "export",
    +  "extends"
    +];
    +const LITERALS = [
    +  "true",
    +  "false",
    +  "null",
    +  "undefined",
    +  "NaN",
    +  "Infinity"
    +];
    +
    +const TYPES = [
    +  "Intl",
    +  "DataView",
    +  "Number",
    +  "Math",
    +  "Date",
    +  "String",
    +  "RegExp",
    +  "Object",
    +  "Function",
    +  "Boolean",
    +  "Error",
    +  "Symbol",
    +  "Set",
    +  "Map",
    +  "WeakSet",
    +  "WeakMap",
    +  "Proxy",
    +  "Reflect",
    +  "JSON",
    +  "Promise",
    +  "Float64Array",
    +  "Int16Array",
    +  "Int32Array",
    +  "Int8Array",
    +  "Uint16Array",
    +  "Uint32Array",
    +  "Float32Array",
    +  "Array",
    +  "Uint8Array",
    +  "Uint8ClampedArray",
    +  "ArrayBuffer"
    +];
    +
    +const ERROR_TYPES = [
    +  "EvalError",
    +  "InternalError",
    +  "RangeError",
    +  "ReferenceError",
    +  "SyntaxError",
    +  "TypeError",
    +  "URIError"
    +];
    +
    +const BUILT_IN_GLOBALS = [
    +  "setInterval",
    +  "setTimeout",
    +  "clearInterval",
    +  "clearTimeout",
    +
    +  "require",
    +  "exports",
    +
    +  "eval",
    +  "isFinite",
    +  "isNaN",
    +  "parseFloat",
    +  "parseInt",
    +  "decodeURI",
    +  "decodeURIComponent",
    +  "encodeURI",
    +  "encodeURIComponent",
    +  "escape",
    +  "unescape"
    +];
    +
    +const BUILT_IN_VARIABLES = [
    +  "arguments",
    +  "this",
    +  "super",
    +  "console",
    +  "window",
    +  "document",
    +  "localStorage",
    +  "module",
    +  "global" // Node.js
    +];
    +
    +const BUILT_INS = [].concat(
    +  BUILT_IN_GLOBALS,
    +  BUILT_IN_VARIABLES,
    +  TYPES,
    +  ERROR_TYPES
    +);
    +
    +/**
    + * @param {string} value
    + * @returns {RegExp}
    + * */
    +
    +/**
    + * @param {RegExp | string } re
    + * @returns {string}
    + */
    +function source(re) {
    +  if (!re) return null;
    +  if (typeof re === "string") return re;
    +
    +  return re.source;
    +}
    +
    +/**
    + * @param {RegExp | string } re
    + * @returns {string}
    + */
    +function lookahead(re) {
    +  return concat('(?=', re, ')');
    +}
    +
    +/**
    + * @param {...(RegExp | string) } args
    + * @returns {string}
    + */
    +function concat(...args) {
    +  const joined = args.map((x) => source(x)).join("");
    +  return joined;
    +}
    +
    +/*
    +Language: JavaScript
    +Description: JavaScript (JS) is a lightweight, interpreted, or just-in-time compiled programming language with first-class functions.
    +Category: common, scripting
    +Website: https://developer.mozilla.org/en-US/docs/Web/JavaScript
    +*/
    +
    +/** @type LanguageFn */
    +function javascript(hljs) {
    +  /**
    +   * Takes a string like " {
    +    const tag = "',
    +    end: ''
    +  };
    +  const XML_TAG = {
    +    begin: /<[A-Za-z0-9\\._:-]+/,
    +    end: /\/[A-Za-z0-9\\._:-]+>|\/>/,
    +    /**
    +     * @param {RegExpMatchArray} match
    +     * @param {CallbackResponse} response
    +     */
    +    isTrulyOpeningTag: (match, response) => {
    +      const afterMatchIndex = match[0].length + match.index;
    +      const nextChar = match.input[afterMatchIndex];
    +      // nested type?
    +      // HTML should not include another raw `<` inside a tag
    +      // But a type might: `>`, etc.
    +      if (nextChar === "<") {
    +        response.ignoreMatch();
    +        return;
    +      }
    +      // 
    +      // This is now either a tag or a type.
    +      if (nextChar === ">") {
    +        // if we cannot find a matching closing tag, then we
    +        // will ignore it
    +        if (!hasClosingTag(match, { after: afterMatchIndex })) {
    +          response.ignoreMatch();
    +        }
    +      }
    +    }
    +  };
    +  const KEYWORDS$1 = {
    +    $pattern: IDENT_RE,
    +    keyword: KEYWORDS.join(" "),
    +    literal: LITERALS.join(" "),
    +    built_in: BUILT_INS.join(" ")
    +  };
    +
    +  // https://tc39.es/ecma262/#sec-literals-numeric-literals
    +  const decimalDigits = '[0-9](_?[0-9])*';
    +  const frac = `\\.(${decimalDigits})`;
    +  // DecimalIntegerLiteral, including Annex B NonOctalDecimalIntegerLiteral
    +  // https://tc39.es/ecma262/#sec-additional-syntax-numeric-literals
    +  const decimalInteger = `0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*`;
    +  const NUMBER = {
    +    className: 'number',
    +    variants: [
    +      // DecimalLiteral
    +      { begin: `(\\b(${decimalInteger})((${frac})|\\.)?|(${frac}))` +
    +        `[eE][+-]?(${decimalDigits})\\b` },
    +      { begin: `\\b(${decimalInteger})\\b((${frac})\\b|\\.)?|(${frac})\\b` },
    +
    +      // DecimalBigIntegerLiteral
    +      { begin: `\\b(0|[1-9](_?[0-9])*)n\\b` },
    +
    +      // NonDecimalIntegerLiteral
    +      { begin: "\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b" },
    +      { begin: "\\b0[bB][0-1](_?[0-1])*n?\\b" },
    +      { begin: "\\b0[oO][0-7](_?[0-7])*n?\\b" },
    +
    +      // LegacyOctalIntegerLiteral (does not include underscore separators)
    +      // https://tc39.es/ecma262/#sec-additional-syntax-numeric-literals
    +      { begin: "\\b0[0-7]+n?\\b" },
    +    ],
    +    relevance: 0
    +  };
    +
    +  const SUBST = {
    +    className: 'subst',
    +    begin: '\\$\\{',
    +    end: '\\}',
    +    keywords: KEYWORDS$1,
    +    contains: [] // defined later
    +  };
    +  const HTML_TEMPLATE = {
    +    begin: 'html`',
    +    end: '',
    +    starts: {
    +      end: '`',
    +      returnEnd: false,
    +      contains: [
    +        hljs.BACKSLASH_ESCAPE,
    +        SUBST
    +      ],
    +      subLanguage: 'xml'
    +    }
    +  };
    +  const CSS_TEMPLATE = {
    +    begin: 'css`',
    +    end: '',
    +    starts: {
    +      end: '`',
    +      returnEnd: false,
    +      contains: [
    +        hljs.BACKSLASH_ESCAPE,
    +        SUBST
    +      ],
    +      subLanguage: 'css'
    +    }
    +  };
    +  const TEMPLATE_STRING = {
    +    className: 'string',
    +    begin: '`',
    +    end: '`',
    +    contains: [
    +      hljs.BACKSLASH_ESCAPE,
    +      SUBST
    +    ]
    +  };
    +  const JSDOC_COMMENT = hljs.COMMENT(
    +    '/\\*\\*',
    +    '\\*/',
    +    {
    +      relevance: 0,
    +      contains: [
    +        {
    +          className: 'doctag',
    +          begin: '@[A-Za-z]+',
    +          contains: [
    +            {
    +              className: 'type',
    +              begin: '\\{',
    +              end: '\\}',
    +              relevance: 0
    +            },
    +            {
    +              className: 'variable',
    +              begin: IDENT_RE$1 + '(?=\\s*(-)|$)',
    +              endsParent: true,
    +              relevance: 0
    +            },
    +            // eat spaces (not newlines) so we can find
    +            // types or variables
    +            {
    +              begin: /(?=[^\n])\s/,
    +              relevance: 0
    +            }
    +          ]
    +        }
    +      ]
    +    }
    +  );
    +  const COMMENT = {
    +    className: "comment",
    +    variants: [
    +      JSDOC_COMMENT,
    +      hljs.C_BLOCK_COMMENT_MODE,
    +      hljs.C_LINE_COMMENT_MODE
    +    ]
    +  };
    +  const SUBST_INTERNALS = [
    +    hljs.APOS_STRING_MODE,
    +    hljs.QUOTE_STRING_MODE,
    +    HTML_TEMPLATE,
    +    CSS_TEMPLATE,
    +    TEMPLATE_STRING,
    +    NUMBER,
    +    hljs.REGEXP_MODE
    +  ];
    +  SUBST.contains = SUBST_INTERNALS
    +    .concat({
    +      // we need to pair up {} inside our subst to prevent
    +      // it from ending too early by matching another }
    +      begin: /\{/,
    +      end: /\}/,
    +      keywords: KEYWORDS$1,
    +      contains: [
    +        "self"
    +      ].concat(SUBST_INTERNALS)
    +    });
    +  const SUBST_AND_COMMENTS = [].concat(COMMENT, SUBST.contains);
    +  const PARAMS_CONTAINS = SUBST_AND_COMMENTS.concat([
    +    // eat recursive parens in sub expressions
    +    {
    +      begin: /\(/,
    +      end: /\)/,
    +      keywords: KEYWORDS$1,
    +      contains: ["self"].concat(SUBST_AND_COMMENTS)
    +    }
    +  ]);
    +  const PARAMS = {
    +    className: 'params',
    +    begin: /\(/,
    +    end: /\)/,
    +    excludeBegin: true,
    +    excludeEnd: true,
    +    keywords: KEYWORDS$1,
    +    contains: PARAMS_CONTAINS
    +  };
    +
    +  return {
    +    name: 'Javascript',
    +    aliases: ['js', 'jsx', 'mjs', 'cjs'],
    +    keywords: KEYWORDS$1,
    +    // this will be extended by TypeScript
    +    exports: { PARAMS_CONTAINS },
    +    illegal: /#(?![$_A-z])/,
    +    contains: [
    +      hljs.SHEBANG({
    +        label: "shebang",
    +        binary: "node",
    +        relevance: 5
    +      }),
    +      {
    +        label: "use_strict",
    +        className: 'meta',
    +        relevance: 10,
    +        begin: /^\s*['"]use (strict|asm)['"]/
    +      },
    +      hljs.APOS_STRING_MODE,
    +      hljs.QUOTE_STRING_MODE,
    +      HTML_TEMPLATE,
    +      CSS_TEMPLATE,
    +      TEMPLATE_STRING,
    +      COMMENT,
    +      NUMBER,
    +      { // object attr container
    +        begin: concat(/[{,\n]\s*/,
    +          // we need to look ahead to make sure that we actually have an
    +          // attribute coming up so we don't steal a comma from a potential
    +          // "value" container
    +          //
    +          // NOTE: this might not work how you think.  We don't actually always
    +          // enter this mode and stay.  Instead it might merely match `,
    +          // ` and then immediately end after the , because it
    +          // fails to find any actual attrs. But this still does the job because
    +          // it prevents the value contain rule from grabbing this instead and
    +          // prevening this rule from firing when we actually DO have keys.
    +          lookahead(concat(
    +            // we also need to allow for multiple possible comments inbetween
    +            // the first key:value pairing
    +            /(((\/\/.*$)|(\/\*(\*[^/]|[^*])*\*\/))\s*)*/,
    +            IDENT_RE$1 + '\\s*:'))),
    +        relevance: 0,
    +        contains: [
    +          {
    +            className: 'attr',
    +            begin: IDENT_RE$1 + lookahead('\\s*:'),
    +            relevance: 0
    +          }
    +        ]
    +      },
    +      { // "value" container
    +        begin: '(' + hljs.RE_STARTERS_RE + '|\\b(case|return|throw)\\b)\\s*',
    +        keywords: 'return throw case',
    +        contains: [
    +          COMMENT,
    +          hljs.REGEXP_MODE,
    +          {
    +            className: 'function',
    +            // we have to count the parens to make sure we actually have the
    +            // correct bounding ( ) before the =>.  There could be any number of
    +            // sub-expressions inside also surrounded by parens.
    +            begin: '(\\(' +
    +            '[^()]*(\\(' +
    +            '[^()]*(\\(' +
    +            '[^()]*' +
    +            '\\)[^()]*)*' +
    +            '\\)[^()]*)*' +
    +            '\\)|' + hljs.UNDERSCORE_IDENT_RE + ')\\s*=>',
    +            returnBegin: true,
    +            end: '\\s*=>',
    +            contains: [
    +              {
    +                className: 'params',
    +                variants: [
    +                  {
    +                    begin: hljs.UNDERSCORE_IDENT_RE,
    +                    relevance: 0
    +                  },
    +                  {
    +                    className: null,
    +                    begin: /\(\s*\)/,
    +                    skip: true
    +                  },
    +                  {
    +                    begin: /\(/,
    +                    end: /\)/,
    +                    excludeBegin: true,
    +                    excludeEnd: true,
    +                    keywords: KEYWORDS$1,
    +                    contains: PARAMS_CONTAINS
    +                  }
    +                ]
    +              }
    +            ]
    +          },
    +          { // could be a comma delimited list of params to a function call
    +            begin: /,/, relevance: 0
    +          },
    +          {
    +            className: '',
    +            begin: /\s/,
    +            end: /\s*/,
    +            skip: true
    +          },
    +          { // JSX
    +            variants: [
    +              { begin: FRAGMENT.begin, end: FRAGMENT.end },
    +              {
    +                begin: XML_TAG.begin,
    +                // we carefully check the opening tag to see if it truly
    +                // is a tag and not a false positive
    +                'on:begin': XML_TAG.isTrulyOpeningTag,
    +                end: XML_TAG.end
    +              }
    +            ],
    +            subLanguage: 'xml',
    +            contains: [
    +              {
    +                begin: XML_TAG.begin,
    +                end: XML_TAG.end,
    +                skip: true,
    +                contains: ['self']
    +              }
    +            ]
    +          }
    +        ],
    +        relevance: 0
    +      },
    +      {
    +        className: 'function',
    +        beginKeywords: 'function',
    +        end: /[{;]/,
    +        excludeEnd: true,
    +        keywords: KEYWORDS$1,
    +        contains: [
    +          'self',
    +          hljs.inherit(hljs.TITLE_MODE, { begin: IDENT_RE$1 }),
    +          PARAMS
    +        ],
    +        illegal: /%/
    +      },
    +      {
    +        // prevent this from getting swallowed up by function
    +        // since they appear "function like"
    +        beginKeywords: "while if switch catch for"
    +      },
    +      {
    +        className: 'function',
    +        // we have to count the parens to make sure we actually have the correct
    +        // bounding ( ).  There could be any number of sub-expressions inside
    +        // also surrounded by parens.
    +        begin: hljs.UNDERSCORE_IDENT_RE +
    +          '\\(' + // first parens
    +          '[^()]*(\\(' +
    +            '[^()]*(\\(' +
    +              '[^()]*' +
    +            '\\)[^()]*)*' +
    +          '\\)[^()]*)*' +
    +          '\\)\\s*\\{', // end parens
    +        returnBegin:true,
    +        contains: [
    +          PARAMS,
    +          hljs.inherit(hljs.TITLE_MODE, { begin: IDENT_RE$1 }),
    +        ]
    +      },
    +      // hack: prevents detection of keywords in some circumstances
    +      // .keyword()
    +      // $keyword = x
    +      {
    +        variants: [
    +          { begin: '\\.' + IDENT_RE$1 },
    +          { begin: '\\$' + IDENT_RE$1 }
    +        ],
    +        relevance: 0
    +      },
    +      { // ES6 class
    +        className: 'class',
    +        beginKeywords: 'class',
    +        end: /[{;=]/,
    +        excludeEnd: true,
    +        illegal: /[:"[\]]/,
    +        contains: [
    +          { beginKeywords: 'extends' },
    +          hljs.UNDERSCORE_TITLE_MODE
    +        ]
    +      },
    +      {
    +        begin: /\b(?=constructor)/,
    +        end: /[{;]/,
    +        excludeEnd: true,
    +        contains: [
    +          hljs.inherit(hljs.TITLE_MODE, { begin: IDENT_RE$1 }),
    +          'self',
    +          PARAMS
    +        ]
    +      },
    +      {
    +        begin: '(get|set)\\s+(?=' + IDENT_RE$1 + '\\()',
    +        end: /\{/,
    +        keywords: "get set",
    +        contains: [
    +          hljs.inherit(hljs.TITLE_MODE, { begin: IDENT_RE$1 }),
    +          { begin: /\(\)/ }, // eat to avoid empty params
    +          PARAMS
    +        ]
    +      },
    +      {
    +        begin: /\$[(.]/ // relevance booster for a pattern common to JS libs: `$(something)` and `$.something`
    +      }
    +    ]
    +  };
    +}
    +
    +module.exports = javascript;
    diff --git a/node_modules/highlight.js/lib/languages/jboss-cli.js b/node_modules/highlight.js/lib/languages/jboss-cli.js
    new file mode 100644
    index 0000000..64519d1
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/jboss-cli.js
    @@ -0,0 +1,63 @@
    +/*
    + Language: JBoss CLI
    + Author: Raphaël Parrëe 
    + Description: language definition jboss cli
    + Website: https://docs.jboss.org/author/display/WFLY/Command+Line+Interface
    + Category: config
    + */
    +
    +function jbossCli(hljs) {
    +  const PARAM = {
    +    begin: /[\w-]+ *=/,
    +    returnBegin: true,
    +    relevance: 0,
    +    contains: [
    +      {
    +        className: 'attr',
    +        begin: /[\w-]+/
    +      }
    +    ]
    +  };
    +  const PARAMSBLOCK = {
    +    className: 'params',
    +    begin: /\(/,
    +    end: /\)/,
    +    contains: [PARAM],
    +    relevance: 0
    +  };
    +  const OPERATION = {
    +    className: 'function',
    +    begin: /:[\w\-.]+/,
    +    relevance: 0
    +  };
    +  const PATH = {
    +    className: 'string',
    +    begin: /\B([\/.])[\w\-.\/=]+/
    +  };
    +  const COMMAND_PARAMS = {
    +    className: 'params',
    +    begin: /--[\w\-=\/]+/
    +  };
    +  return {
    +    name: 'JBoss CLI',
    +    aliases: ['wildfly-cli'],
    +    keywords: {
    +      $pattern: '[a-z\-]+',
    +      keyword: 'alias batch cd clear command connect connection-factory connection-info data-source deploy ' +
    +      'deployment-info deployment-overlay echo echo-dmr help history if jdbc-driver-info jms-queue|20 jms-topic|20 ls ' +
    +      'patch pwd quit read-attribute read-operation reload rollout-plan run-batch set shutdown try unalias ' +
    +      'undeploy unset version xa-data-source', // module
    +      literal: 'true false'
    +    },
    +    contains: [
    +      hljs.HASH_COMMENT_MODE,
    +      hljs.QUOTE_STRING_MODE,
    +      COMMAND_PARAMS,
    +      OPERATION,
    +      PATH,
    +      PARAMSBLOCK
    +    ]
    +  };
    +}
    +
    +module.exports = jbossCli;
    diff --git a/node_modules/highlight.js/lib/languages/json.js b/node_modules/highlight.js/lib/languages/json.js
    new file mode 100644
    index 0000000..83e52bb
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/json.js
    @@ -0,0 +1,63 @@
    +/*
    +Language: JSON
    +Description: JSON (JavaScript Object Notation) is a lightweight data-interchange format.
    +Author: Ivan Sagalaev 
    +Website: http://www.json.org
    +Category: common, protocols
    +*/
    +
    +function json(hljs) {
    +  const LITERALS = {
    +    literal: 'true false null'
    +  };
    +  const ALLOWED_COMMENTS = [
    +    hljs.C_LINE_COMMENT_MODE,
    +    hljs.C_BLOCK_COMMENT_MODE
    +  ];
    +  const TYPES = [
    +    hljs.QUOTE_STRING_MODE,
    +    hljs.C_NUMBER_MODE
    +  ];
    +  const VALUE_CONTAINER = {
    +    end: ',',
    +    endsWithParent: true,
    +    excludeEnd: true,
    +    contains: TYPES,
    +    keywords: LITERALS
    +  };
    +  const OBJECT = {
    +    begin: /\{/,
    +    end: /\}/,
    +    contains: [
    +      {
    +        className: 'attr',
    +        begin: /"/,
    +        end: /"/,
    +        contains: [hljs.BACKSLASH_ESCAPE],
    +        illegal: '\\n'
    +      },
    +      hljs.inherit(VALUE_CONTAINER, {
    +        begin: /:/
    +      })
    +    ].concat(ALLOWED_COMMENTS),
    +    illegal: '\\S'
    +  };
    +  const ARRAY = {
    +    begin: '\\[',
    +    end: '\\]',
    +    contains: [hljs.inherit(VALUE_CONTAINER)], // inherit is a workaround for a bug that makes shared modes with endsWithParent compile only the ending of one of the parents
    +    illegal: '\\S'
    +  };
    +  TYPES.push(OBJECT, ARRAY);
    +  ALLOWED_COMMENTS.forEach(function(rule) {
    +    TYPES.push(rule);
    +  });
    +  return {
    +    name: 'JSON',
    +    contains: TYPES,
    +    keywords: LITERALS,
    +    illegal: '\\S'
    +  };
    +}
    +
    +module.exports = json;
    diff --git a/node_modules/highlight.js/lib/languages/julia-repl.js b/node_modules/highlight.js/lib/languages/julia-repl.js
    new file mode 100644
    index 0000000..60fec98
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/julia-repl.js
    @@ -0,0 +1,50 @@
    +/*
    +Language: Julia REPL
    +Description: Julia REPL sessions
    +Author: Morten Piibeleht 
    +Website: https://julialang.org
    +Requires: julia.js
    +
    +The Julia REPL code blocks look something like the following:
    +
    +  julia> function foo(x)
    +             x + 1
    +         end
    +  foo (generic function with 1 method)
    +
    +They start on a new line with "julia>". Usually there should also be a space after this, but
    +we also allow the code to start right after the > character. The code may run over multiple
    +lines, but the additional lines must start with six spaces (i.e. be indented to match
    +"julia>"). The rest of the code is assumed to be output from the executed code and will be
    +left un-highlighted.
    +
    +Using simply spaces to identify line continuations may get a false-positive if the output
    +also prints out six spaces, but such cases should be rare.
    +*/
    +
    +function juliaRepl(hljs) {
    +  return {
    +    name: 'Julia REPL',
    +    contains: [
    +      {
    +        className: 'meta',
    +        begin: /^julia>/,
    +        relevance: 10,
    +        starts: {
    +          // end the highlighting if we are on a new line and the line does not have at
    +          // least six spaces in the beginning
    +          end: /^(?![ ]{6})/,
    +          subLanguage: 'julia'
    +      },
    +      // jldoctest Markdown blocks are used in the Julia manual and package docs indicate
    +      // code snippets that should be verified when the documentation is built. They can be
    +      // either REPL-like or script-like, but are usually REPL-like and therefore we apply
    +      // julia-repl highlighting to them. More information can be found in Documenter's
    +      // manual: https://juliadocs.github.io/Documenter.jl/latest/man/doctests.html
    +      aliases: ['jldoctest']
    +      }
    +    ]
    +  }
    +}
    +
    +module.exports = juliaRepl;
    diff --git a/node_modules/highlight.js/lib/languages/julia.js b/node_modules/highlight.js/lib/languages/julia.js
    new file mode 100644
    index 0000000..b3b3dc8
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/julia.js
    @@ -0,0 +1,416 @@
    +/*
    +Language: Julia
    +Description: Julia is a high-level, high-performance, dynamic programming language.
    +Author: Kenta Sato 
    +Contributors: Alex Arslan , Fredrik Ekre 
    +Website: https://julialang.org
    +*/
    +
    +function julia(hljs) {
    +  // Since there are numerous special names in Julia, it is too much trouble
    +  // to maintain them by hand. Hence these names (i.e. keywords, literals and
    +  // built-ins) are automatically generated from Julia 1.5.2 itself through
    +  // the following scripts for each.
    +
    +  // ref: https://docs.julialang.org/en/v1/manual/variables/#Allowed-Variable-Names
    +  var VARIABLE_NAME_RE = '[A-Za-z_\\u00A1-\\uFFFF][A-Za-z_0-9\\u00A1-\\uFFFF]*';
    +
    +  // # keyword generator, multi-word keywords handled manually below (Julia 1.5.2)
    +  // import REPL.REPLCompletions
    +  // res = String["in", "isa", "where"]
    +  // for kw in collect(x.keyword for x in REPLCompletions.complete_keyword(""))
    +  //     if !(contains(kw, " ") || kw == "struct")
    +  //         push!(res, kw)
    +  //     end
    +  // end
    +  // sort!(unique!(res))
    +  // foreach(x -> println("\'", x, "\',"), res)
    +  var KEYWORD_LIST = [
    +    'baremodule',
    +    'begin',
    +    'break',
    +    'catch',
    +    'ccall',
    +    'const',
    +    'continue',
    +    'do',
    +    'else',
    +    'elseif',
    +    'end',
    +    'export',
    +    'false',
    +    'finally',
    +    'for',
    +    'function',
    +    'global',
    +    'if',
    +    'import',
    +    'in',
    +    'isa',
    +    'let',
    +    'local',
    +    'macro',
    +    'module',
    +    'quote',
    +    'return',
    +    'true',
    +    'try',
    +    'using',
    +    'where',
    +    'while',
    +  ];
    +
    +  // # literal generator (Julia 1.5.2)
    +  // import REPL.REPLCompletions
    +  // res = String["true", "false"]
    +  // for compl in filter!(x -> isa(x, REPLCompletions.ModuleCompletion) && (x.parent === Base || x.parent === Core),
    +  //                     REPLCompletions.completions("", 0)[1])
    +  //     try
    +  //         v = eval(Symbol(compl.mod))
    +  //         if !(v isa Function || v isa Type || v isa TypeVar || v isa Module || v isa Colon)
    +  //             push!(res, compl.mod)
    +  //         end
    +  //     catch e
    +  //     end
    +  // end
    +  // sort!(unique!(res))
    +  // foreach(x -> println("\'", x, "\',"), res)
    +  var LITERAL_LIST = [
    +    'ARGS',
    +    'C_NULL',
    +    'DEPOT_PATH',
    +    'ENDIAN_BOM',
    +    'ENV',
    +    'Inf',
    +    'Inf16',
    +    'Inf32',
    +    'Inf64',
    +    'InsertionSort',
    +    'LOAD_PATH',
    +    'MergeSort',
    +    'NaN',
    +    'NaN16',
    +    'NaN32',
    +    'NaN64',
    +    'PROGRAM_FILE',
    +    'QuickSort',
    +    'RoundDown',
    +    'RoundFromZero',
    +    'RoundNearest',
    +    'RoundNearestTiesAway',
    +    'RoundNearestTiesUp',
    +    'RoundToZero',
    +    'RoundUp',
    +    'VERSION|0',
    +    'devnull',
    +    'false',
    +    'im',
    +    'missing',
    +    'nothing',
    +    'pi',
    +    'stderr',
    +    'stdin',
    +    'stdout',
    +    'true',
    +    'undef',
    +    'π',
    +    'ℯ',
    +  ];
    +
    +  // # built_in generator (Julia 1.5.2)
    +  // import REPL.REPLCompletions
    +  // res = String[]
    +  // for compl in filter!(x -> isa(x, REPLCompletions.ModuleCompletion) && (x.parent === Base || x.parent === Core),
    +  //                     REPLCompletions.completions("", 0)[1])
    +  //     try
    +  //         v = eval(Symbol(compl.mod))
    +  //         if (v isa Type || v isa TypeVar) && (compl.mod != "=>")
    +  //             push!(res, compl.mod)
    +  //         end
    +  //     catch e
    +  //     end
    +  // end
    +  // sort!(unique!(res))
    +  // foreach(x -> println("\'", x, "\',"), res)
    +  var BUILT_IN_LIST = [
    +    'AbstractArray',
    +    'AbstractChannel',
    +    'AbstractChar',
    +    'AbstractDict',
    +    'AbstractDisplay',
    +    'AbstractFloat',
    +    'AbstractIrrational',
    +    'AbstractMatrix',
    +    'AbstractRange',
    +    'AbstractSet',
    +    'AbstractString',
    +    'AbstractUnitRange',
    +    'AbstractVecOrMat',
    +    'AbstractVector',
    +    'Any',
    +    'ArgumentError',
    +    'Array',
    +    'AssertionError',
    +    'BigFloat',
    +    'BigInt',
    +    'BitArray',
    +    'BitMatrix',
    +    'BitSet',
    +    'BitVector',
    +    'Bool',
    +    'BoundsError',
    +    'CapturedException',
    +    'CartesianIndex',
    +    'CartesianIndices',
    +    'Cchar',
    +    'Cdouble',
    +    'Cfloat',
    +    'Channel',
    +    'Char',
    +    'Cint',
    +    'Cintmax_t',
    +    'Clong',
    +    'Clonglong',
    +    'Cmd',
    +    'Colon',
    +    'Complex',
    +    'ComplexF16',
    +    'ComplexF32',
    +    'ComplexF64',
    +    'CompositeException',
    +    'Condition',
    +    'Cptrdiff_t',
    +    'Cshort',
    +    'Csize_t',
    +    'Cssize_t',
    +    'Cstring',
    +    'Cuchar',
    +    'Cuint',
    +    'Cuintmax_t',
    +    'Culong',
    +    'Culonglong',
    +    'Cushort',
    +    'Cvoid',
    +    'Cwchar_t',
    +    'Cwstring',
    +    'DataType',
    +    'DenseArray',
    +    'DenseMatrix',
    +    'DenseVecOrMat',
    +    'DenseVector',
    +    'Dict',
    +    'DimensionMismatch',
    +    'Dims',
    +    'DivideError',
    +    'DomainError',
    +    'EOFError',
    +    'Enum',
    +    'ErrorException',
    +    'Exception',
    +    'ExponentialBackOff',
    +    'Expr',
    +    'Float16',
    +    'Float32',
    +    'Float64',
    +    'Function',
    +    'GlobalRef',
    +    'HTML',
    +    'IO',
    +    'IOBuffer',
    +    'IOContext',
    +    'IOStream',
    +    'IdDict',
    +    'IndexCartesian',
    +    'IndexLinear',
    +    'IndexStyle',
    +    'InexactError',
    +    'InitError',
    +    'Int',
    +    'Int128',
    +    'Int16',
    +    'Int32',
    +    'Int64',
    +    'Int8',
    +    'Integer',
    +    'InterruptException',
    +    'InvalidStateException',
    +    'Irrational',
    +    'KeyError',
    +    'LinRange',
    +    'LineNumberNode',
    +    'LinearIndices',
    +    'LoadError',
    +    'MIME',
    +    'Matrix',
    +    'Method',
    +    'MethodError',
    +    'Missing',
    +    'MissingException',
    +    'Module',
    +    'NTuple',
    +    'NamedTuple',
    +    'Nothing',
    +    'Number',
    +    'OrdinalRange',
    +    'OutOfMemoryError',
    +    'OverflowError',
    +    'Pair',
    +    'PartialQuickSort',
    +    'PermutedDimsArray',
    +    'Pipe',
    +    'ProcessFailedException',
    +    'Ptr',
    +    'QuoteNode',
    +    'Rational',
    +    'RawFD',
    +    'ReadOnlyMemoryError',
    +    'Real',
    +    'ReentrantLock',
    +    'Ref',
    +    'Regex',
    +    'RegexMatch',
    +    'RoundingMode',
    +    'SegmentationFault',
    +    'Set',
    +    'Signed',
    +    'Some',
    +    'StackOverflowError',
    +    'StepRange',
    +    'StepRangeLen',
    +    'StridedArray',
    +    'StridedMatrix',
    +    'StridedVecOrMat',
    +    'StridedVector',
    +    'String',
    +    'StringIndexError',
    +    'SubArray',
    +    'SubString',
    +    'SubstitutionString',
    +    'Symbol',
    +    'SystemError',
    +    'Task',
    +    'TaskFailedException',
    +    'Text',
    +    'TextDisplay',
    +    'Timer',
    +    'Tuple',
    +    'Type',
    +    'TypeError',
    +    'TypeVar',
    +    'UInt',
    +    'UInt128',
    +    'UInt16',
    +    'UInt32',
    +    'UInt64',
    +    'UInt8',
    +    'UndefInitializer',
    +    'UndefKeywordError',
    +    'UndefRefError',
    +    'UndefVarError',
    +    'Union',
    +    'UnionAll',
    +    'UnitRange',
    +    'Unsigned',
    +    'Val',
    +    'Vararg',
    +    'VecElement',
    +    'VecOrMat',
    +    'Vector',
    +    'VersionNumber',
    +    'WeakKeyDict',
    +    'WeakRef',
    +  ];
    +
    +  var KEYWORDS = {
    +    $pattern: VARIABLE_NAME_RE,
    +    keyword: KEYWORD_LIST.join(" "),
    +    literal: LITERAL_LIST.join(" "),
    +    built_in: BUILT_IN_LIST.join(" "),
    +  };
    +
    +  // placeholder for recursive self-reference
    +  var DEFAULT = {
    +    keywords: KEYWORDS, illegal: /<\//
    +  };
    +
    +  // ref: https://docs.julialang.org/en/v1/manual/integers-and-floating-point-numbers/
    +  var NUMBER = {
    +    className: 'number',
    +    // supported numeric literals:
    +    //  * binary literal (e.g. 0x10)
    +    //  * octal literal (e.g. 0o76543210)
    +    //  * hexadecimal literal (e.g. 0xfedcba876543210)
    +    //  * hexadecimal floating point literal (e.g. 0x1p0, 0x1.2p2)
    +    //  * decimal literal (e.g. 9876543210, 100_000_000)
    +    //  * floating pointe literal (e.g. 1.2, 1.2f, .2, 1., 1.2e10, 1.2e-10)
    +    begin: /(\b0x[\d_]*(\.[\d_]*)?|0x\.\d[\d_]*)p[-+]?\d+|\b0[box][a-fA-F0-9][a-fA-F0-9_]*|(\b\d[\d_]*(\.[\d_]*)?|\.\d[\d_]*)([eEfF][-+]?\d+)?/,
    +    relevance: 0
    +  };
    +
    +  var CHAR = {
    +    className: 'string',
    +    begin: /'(.|\\[xXuU][a-zA-Z0-9]+)'/
    +  };
    +
    +  var INTERPOLATION = {
    +    className: 'subst',
    +    begin: /\$\(/, end: /\)/,
    +    keywords: KEYWORDS
    +  };
    +
    +  var INTERPOLATED_VARIABLE = {
    +    className: 'variable',
    +    begin: '\\$' + VARIABLE_NAME_RE
    +  };
    +
    +  // TODO: neatly escape normal code in string literal
    +  var STRING = {
    +    className: 'string',
    +    contains: [hljs.BACKSLASH_ESCAPE, INTERPOLATION, INTERPOLATED_VARIABLE],
    +    variants: [
    +      { begin: /\w*"""/, end: /"""\w*/, relevance: 10 },
    +      { begin: /\w*"/, end: /"\w*/ }
    +    ]
    +  };
    +
    +  var COMMAND = {
    +    className: 'string',
    +    contains: [hljs.BACKSLASH_ESCAPE, INTERPOLATION, INTERPOLATED_VARIABLE],
    +    begin: '`', end: '`'
    +  };
    +
    +  var MACROCALL = {
    +    className: 'meta',
    +    begin: '@' + VARIABLE_NAME_RE
    +  };
    +
    +  var COMMENT = {
    +    className: 'comment',
    +    variants: [
    +      { begin: '#=', end: '=#', relevance: 10 },
    +      { begin: '#', end: '$' }
    +    ]
    +  };
    +
    +  DEFAULT.name = 'Julia';
    +  DEFAULT.contains = [
    +    NUMBER,
    +    CHAR,
    +    STRING,
    +    COMMAND,
    +    MACROCALL,
    +    COMMENT,
    +    hljs.HASH_COMMENT_MODE,
    +    {
    +      className: 'keyword',
    +      begin:
    +        '\\b(((abstract|primitive)\\s+)type|(mutable\\s+)?struct)\\b'
    +    },
    +    {begin: /<:/}  // relevance booster
    +  ];
    +  INTERPOLATION.contains = DEFAULT.contains;
    +
    +  return DEFAULT;
    +}
    +
    +module.exports = julia;
    diff --git a/node_modules/highlight.js/lib/languages/kotlin.js b/node_modules/highlight.js/lib/languages/kotlin.js
    new file mode 100644
    index 0000000..3b77f2e
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/kotlin.js
    @@ -0,0 +1,284 @@
    +// https://docs.oracle.com/javase/specs/jls/se15/html/jls-3.html#jls-3.10
    +var decimalDigits = '[0-9](_*[0-9])*';
    +var frac = `\\.(${decimalDigits})`;
    +var hexDigits = '[0-9a-fA-F](_*[0-9a-fA-F])*';
    +var NUMERIC = {
    +  className: 'number',
    +  variants: [
    +    // DecimalFloatingPointLiteral
    +    // including ExponentPart
    +    { begin: `(\\b(${decimalDigits})((${frac})|\\.)?|(${frac}))` +
    +      `[eE][+-]?(${decimalDigits})[fFdD]?\\b` },
    +    // excluding ExponentPart
    +    { begin: `\\b(${decimalDigits})((${frac})[fFdD]?\\b|\\.([fFdD]\\b)?)` },
    +    { begin: `(${frac})[fFdD]?\\b` },
    +    { begin: `\\b(${decimalDigits})[fFdD]\\b` },
    +
    +    // HexadecimalFloatingPointLiteral
    +    { begin: `\\b0[xX]((${hexDigits})\\.?|(${hexDigits})?\\.(${hexDigits}))` +
    +      `[pP][+-]?(${decimalDigits})[fFdD]?\\b` },
    +
    +    // DecimalIntegerLiteral
    +    { begin: '\\b(0|[1-9](_*[0-9])*)[lL]?\\b' },
    +
    +    // HexIntegerLiteral
    +    { begin: `\\b0[xX](${hexDigits})[lL]?\\b` },
    +
    +    // OctalIntegerLiteral
    +    { begin: '\\b0(_*[0-7])*[lL]?\\b' },
    +
    +    // BinaryIntegerLiteral
    +    { begin: '\\b0[bB][01](_*[01])*[lL]?\\b' },
    +  ],
    +  relevance: 0
    +};
    +
    +/*
    + Language: Kotlin
    + Description: Kotlin is an OSS statically typed programming language that targets the JVM, Android, JavaScript and Native.
    + Author: Sergey Mashkov 
    + Website: https://kotlinlang.org
    + Category: common
    + */
    +
    +function kotlin(hljs) {
    +  const KEYWORDS = {
    +    keyword:
    +      'abstract as val var vararg get set class object open private protected public noinline ' +
    +      'crossinline dynamic final enum if else do while for when throw try catch finally ' +
    +      'import package is in fun override companion reified inline lateinit init ' +
    +      'interface annotation data sealed internal infix operator out by constructor super ' +
    +      'tailrec where const inner suspend typealias external expect actual',
    +    built_in:
    +      'Byte Short Char Int Long Boolean Float Double Void Unit Nothing',
    +    literal:
    +      'true false null'
    +  };
    +  const KEYWORDS_WITH_LABEL = {
    +    className: 'keyword',
    +    begin: /\b(break|continue|return|this)\b/,
    +    starts: {
    +      contains: [
    +        {
    +          className: 'symbol',
    +          begin: /@\w+/
    +        }
    +      ]
    +    }
    +  };
    +  const LABEL = {
    +    className: 'symbol',
    +    begin: hljs.UNDERSCORE_IDENT_RE + '@'
    +  };
    +
    +  // for string templates
    +  const SUBST = {
    +    className: 'subst',
    +    begin: /\$\{/,
    +    end: /\}/,
    +    contains: [ hljs.C_NUMBER_MODE ]
    +  };
    +  const VARIABLE = {
    +    className: 'variable',
    +    begin: '\\$' + hljs.UNDERSCORE_IDENT_RE
    +  };
    +  const STRING = {
    +    className: 'string',
    +    variants: [
    +      {
    +        begin: '"""',
    +        end: '"""(?=[^"])',
    +        contains: [
    +          VARIABLE,
    +          SUBST
    +        ]
    +      },
    +      // Can't use built-in modes easily, as we want to use STRING in the meta
    +      // context as 'meta-string' and there's no syntax to remove explicitly set
    +      // classNames in built-in modes.
    +      {
    +        begin: '\'',
    +        end: '\'',
    +        illegal: /\n/,
    +        contains: [ hljs.BACKSLASH_ESCAPE ]
    +      },
    +      {
    +        begin: '"',
    +        end: '"',
    +        illegal: /\n/,
    +        contains: [
    +          hljs.BACKSLASH_ESCAPE,
    +          VARIABLE,
    +          SUBST
    +        ]
    +      }
    +    ]
    +  };
    +  SUBST.contains.push(STRING);
    +
    +  const ANNOTATION_USE_SITE = {
    +    className: 'meta',
    +    begin: '@(?:file|property|field|get|set|receiver|param|setparam|delegate)\\s*:(?:\\s*' + hljs.UNDERSCORE_IDENT_RE + ')?'
    +  };
    +  const ANNOTATION = {
    +    className: 'meta',
    +    begin: '@' + hljs.UNDERSCORE_IDENT_RE,
    +    contains: [
    +      {
    +        begin: /\(/,
    +        end: /\)/,
    +        contains: [
    +          hljs.inherit(STRING, {
    +            className: 'meta-string'
    +          })
    +        ]
    +      }
    +    ]
    +  };
    +
    +  // https://kotlinlang.org/docs/reference/whatsnew11.html#underscores-in-numeric-literals
    +  // According to the doc above, the number mode of kotlin is the same as java 8,
    +  // so the code below is copied from java.js
    +  const KOTLIN_NUMBER_MODE = NUMERIC;
    +  const KOTLIN_NESTED_COMMENT = hljs.COMMENT(
    +    '/\\*', '\\*/',
    +    {
    +      contains: [ hljs.C_BLOCK_COMMENT_MODE ]
    +    }
    +  );
    +  const KOTLIN_PAREN_TYPE = {
    +    variants: [
    +      {
    +        className: 'type',
    +        begin: hljs.UNDERSCORE_IDENT_RE
    +      },
    +      {
    +        begin: /\(/,
    +        end: /\)/,
    +        contains: [] // defined later
    +      }
    +    ]
    +  };
    +  const KOTLIN_PAREN_TYPE2 = KOTLIN_PAREN_TYPE;
    +  KOTLIN_PAREN_TYPE2.variants[1].contains = [ KOTLIN_PAREN_TYPE ];
    +  KOTLIN_PAREN_TYPE.variants[1].contains = [ KOTLIN_PAREN_TYPE2 ];
    +
    +  return {
    +    name: 'Kotlin',
    +    aliases: [ 'kt' ],
    +    keywords: KEYWORDS,
    +    contains: [
    +      hljs.COMMENT(
    +        '/\\*\\*',
    +        '\\*/',
    +        {
    +          relevance: 0,
    +          contains: [
    +            {
    +              className: 'doctag',
    +              begin: '@[A-Za-z]+'
    +            }
    +          ]
    +        }
    +      ),
    +      hljs.C_LINE_COMMENT_MODE,
    +      KOTLIN_NESTED_COMMENT,
    +      KEYWORDS_WITH_LABEL,
    +      LABEL,
    +      ANNOTATION_USE_SITE,
    +      ANNOTATION,
    +      {
    +        className: 'function',
    +        beginKeywords: 'fun',
    +        end: '[(]|$',
    +        returnBegin: true,
    +        excludeEnd: true,
    +        keywords: KEYWORDS,
    +        relevance: 5,
    +        contains: [
    +          {
    +            begin: hljs.UNDERSCORE_IDENT_RE + '\\s*\\(',
    +            returnBegin: true,
    +            relevance: 0,
    +            contains: [ hljs.UNDERSCORE_TITLE_MODE ]
    +          },
    +          {
    +            className: 'type',
    +            begin: //,
    +            keywords: 'reified',
    +            relevance: 0
    +          },
    +          {
    +            className: 'params',
    +            begin: /\(/,
    +            end: /\)/,
    +            endsParent: true,
    +            keywords: KEYWORDS,
    +            relevance: 0,
    +            contains: [
    +              {
    +                begin: /:/,
    +                end: /[=,\/]/,
    +                endsWithParent: true,
    +                contains: [
    +                  KOTLIN_PAREN_TYPE,
    +                  hljs.C_LINE_COMMENT_MODE,
    +                  KOTLIN_NESTED_COMMENT
    +                ],
    +                relevance: 0
    +              },
    +              hljs.C_LINE_COMMENT_MODE,
    +              KOTLIN_NESTED_COMMENT,
    +              ANNOTATION_USE_SITE,
    +              ANNOTATION,
    +              STRING,
    +              hljs.C_NUMBER_MODE
    +            ]
    +          },
    +          KOTLIN_NESTED_COMMENT
    +        ]
    +      },
    +      {
    +        className: 'class',
    +        beginKeywords: 'class interface trait', // remove 'trait' when removed from KEYWORDS
    +        end: /[:\{(]|$/,
    +        excludeEnd: true,
    +        illegal: 'extends implements',
    +        contains: [
    +          {
    +            beginKeywords: 'public protected internal private constructor'
    +          },
    +          hljs.UNDERSCORE_TITLE_MODE,
    +          {
    +            className: 'type',
    +            begin: //,
    +            excludeBegin: true,
    +            excludeEnd: true,
    +            relevance: 0
    +          },
    +          {
    +            className: 'type',
    +            begin: /[,:]\s*/,
    +            end: /[<\(,]|$/,
    +            excludeBegin: true,
    +            returnEnd: true
    +          },
    +          ANNOTATION_USE_SITE,
    +          ANNOTATION
    +        ]
    +      },
    +      STRING,
    +      {
    +        className: 'meta',
    +        begin: "^#!/usr/bin/env",
    +        end: '$',
    +        illegal: '\n'
    +      },
    +      KOTLIN_NUMBER_MODE
    +    ]
    +  };
    +}
    +
    +module.exports = kotlin;
    diff --git a/node_modules/highlight.js/lib/languages/lasso.js b/node_modules/highlight.js/lib/languages/lasso.js
    new file mode 100644
    index 0000000..184b490
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/lasso.js
    @@ -0,0 +1,187 @@
    +/*
    +Language: Lasso
    +Author: Eric Knibbe 
    +Description: Lasso is a language and server platform for database-driven web applications. This definition handles Lasso 9 syntax and LassoScript for Lasso 8.6 and earlier.
    +Website: http://www.lassosoft.com/What-Is-Lasso
    +*/
    +
    +function lasso(hljs) {
    +  const LASSO_IDENT_RE = '[a-zA-Z_][\\w.]*';
    +  const LASSO_ANGLE_RE = '<\\?(lasso(script)?|=)';
    +  const LASSO_CLOSE_RE = '\\]|\\?>';
    +  const LASSO_KEYWORDS = {
    +    $pattern: LASSO_IDENT_RE + '|&[lg]t;',
    +    literal:
    +      'true false none minimal full all void and or not ' +
    +      'bw nbw ew new cn ncn lt lte gt gte eq neq rx nrx ft',
    +    built_in:
    +      'array date decimal duration integer map pair string tag xml null ' +
    +      'boolean bytes keyword list locale queue set stack staticarray ' +
    +      'local var variable global data self inherited currentcapture givenblock',
    +    keyword:
    +      'cache database_names database_schemanames database_tablenames ' +
    +      'define_tag define_type email_batch encode_set html_comment handle ' +
    +      'handle_error header if inline iterate ljax_target link ' +
    +      'link_currentaction link_currentgroup link_currentrecord link_detail ' +
    +      'link_firstgroup link_firstrecord link_lastgroup link_lastrecord ' +
    +      'link_nextgroup link_nextrecord link_prevgroup link_prevrecord log ' +
    +      'loop namespace_using output_none portal private protect records ' +
    +      'referer referrer repeating resultset rows search_args ' +
    +      'search_arguments select sort_args sort_arguments thread_atomic ' +
    +      'value_list while abort case else fail_if fail_ifnot fail if_empty ' +
    +      'if_false if_null if_true loop_abort loop_continue loop_count params ' +
    +      'params_up return return_value run_children soap_definetag ' +
    +      'soap_lastrequest soap_lastresponse tag_name ascending average by ' +
    +      'define descending do equals frozen group handle_failure import in ' +
    +      'into join let match max min on order parent protected provide public ' +
    +      'require returnhome skip split_thread sum take thread to trait type ' +
    +      'where with yield yieldhome'
    +  };
    +  const HTML_COMMENT = hljs.COMMENT(
    +    '',
    +    {
    +      relevance: 0
    +    }
    +  );
    +  const LASSO_NOPROCESS = {
    +    className: 'meta',
    +    begin: '\\[noprocess\\]',
    +    starts: {
    +      end: '\\[/noprocess\\]',
    +      returnEnd: true,
    +      contains: [HTML_COMMENT]
    +    }
    +  };
    +  const LASSO_START = {
    +    className: 'meta',
    +    begin: '\\[/noprocess|' + LASSO_ANGLE_RE
    +  };
    +  const LASSO_DATAMEMBER = {
    +    className: 'symbol',
    +    begin: '\'' + LASSO_IDENT_RE + '\''
    +  };
    +  const LASSO_CODE = [
    +    hljs.C_LINE_COMMENT_MODE,
    +    hljs.C_BLOCK_COMMENT_MODE,
    +    hljs.inherit(hljs.C_NUMBER_MODE, {
    +      begin: hljs.C_NUMBER_RE + '|(-?infinity|NaN)\\b'
    +    }),
    +    hljs.inherit(hljs.APOS_STRING_MODE, {
    +      illegal: null
    +    }),
    +    hljs.inherit(hljs.QUOTE_STRING_MODE, {
    +      illegal: null
    +    }),
    +    {
    +      className: 'string',
    +      begin: '`',
    +      end: '`'
    +    },
    +    { // variables
    +      variants: [
    +        {
    +          begin: '[#$]' + LASSO_IDENT_RE
    +        },
    +        {
    +          begin: '#',
    +          end: '\\d+',
    +          illegal: '\\W'
    +        }
    +      ]
    +    },
    +    {
    +      className: 'type',
    +      begin: '::\\s*',
    +      end: LASSO_IDENT_RE,
    +      illegal: '\\W'
    +    },
    +    {
    +      className: 'params',
    +      variants: [
    +        {
    +          begin: '-(?!infinity)' + LASSO_IDENT_RE,
    +          relevance: 0
    +        },
    +        {
    +          begin: '(\\.\\.\\.)'
    +        }
    +      ]
    +    },
    +    {
    +      begin: /(->|\.)\s*/,
    +      relevance: 0,
    +      contains: [LASSO_DATAMEMBER]
    +    },
    +    {
    +      className: 'class',
    +      beginKeywords: 'define',
    +      returnEnd: true,
    +      end: '\\(|=>',
    +      contains: [
    +        hljs.inherit(hljs.TITLE_MODE, {
    +          begin: LASSO_IDENT_RE + '(=(?!>))?|[-+*/%](?!>)'
    +        })
    +      ]
    +    }
    +  ];
    +  return {
    +    name: 'Lasso',
    +    aliases: [
    +      'ls',
    +      'lassoscript'
    +    ],
    +    case_insensitive: true,
    +    keywords: LASSO_KEYWORDS,
    +    contains: [
    +      {
    +        className: 'meta',
    +        begin: LASSO_CLOSE_RE,
    +        relevance: 0,
    +        starts: { // markup
    +          end: '\\[|' + LASSO_ANGLE_RE,
    +          returnEnd: true,
    +          relevance: 0,
    +          contains: [HTML_COMMENT]
    +        }
    +      },
    +      LASSO_NOPROCESS,
    +      LASSO_START,
    +      {
    +        className: 'meta',
    +        begin: '\\[no_square_brackets',
    +        starts: {
    +          end: '\\[/no_square_brackets\\]', // not implemented in the language
    +          keywords: LASSO_KEYWORDS,
    +          contains: [
    +            {
    +              className: 'meta',
    +              begin: LASSO_CLOSE_RE,
    +              relevance: 0,
    +              starts: {
    +                end: '\\[noprocess\\]|' + LASSO_ANGLE_RE,
    +                returnEnd: true,
    +                contains: [HTML_COMMENT]
    +              }
    +            },
    +            LASSO_NOPROCESS,
    +            LASSO_START
    +          ].concat(LASSO_CODE)
    +        }
    +      },
    +      {
    +        className: 'meta',
    +        begin: '\\[',
    +        relevance: 0
    +      },
    +      {
    +        className: 'meta',
    +        begin: '^#!',
    +        end: 'lasso9$',
    +        relevance: 10
    +      }
    +    ].concat(LASSO_CODE)
    +  };
    +}
    +
    +module.exports = lasso;
    diff --git a/node_modules/highlight.js/lib/languages/latex.js b/node_modules/highlight.js/lib/languages/latex.js
    new file mode 100644
    index 0000000..b5dbeeb
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/latex.js
    @@ -0,0 +1,276 @@
    +/**
    + * @param {string} value
    + * @returns {RegExp}
    + * */
    +
    +/**
    + * @param {RegExp | string } re
    + * @returns {string}
    + */
    +function source(re) {
    +  if (!re) return null;
    +  if (typeof re === "string") return re;
    +
    +  return re.source;
    +}
    +
    +/**
    + * Any of the passed expresssions may match
    + *
    + * Creates a huge this | this | that | that match
    + * @param {(RegExp | string)[] } args
    + * @returns {string}
    + */
    +function either(...args) {
    +  const joined = '(' + args.map((x) => source(x)).join("|") + ")";
    +  return joined;
    +}
    +
    +/*
    +Language: LaTeX
    +Author: Benedikt Wilde 
    +Website: https://www.latex-project.org
    +Category: markup
    +*/
    +
    +/** @type LanguageFn */
    +function latex(hljs) {
    +  const KNOWN_CONTROL_WORDS = either(...[
    +      '(?:NeedsTeXFormat|RequirePackage|GetIdInfo)',
    +      'Provides(?:Expl)?(?:Package|Class|File)',
    +      '(?:DeclareOption|ProcessOptions)',
    +      '(?:documentclass|usepackage|input|include)',
    +      'makeat(?:letter|other)',
    +      'ExplSyntax(?:On|Off)',
    +      '(?:new|renew|provide)?command',
    +      '(?:re)newenvironment',
    +      '(?:New|Renew|Provide|Declare)(?:Expandable)?DocumentCommand',
    +      '(?:New|Renew|Provide|Declare)DocumentEnvironment',
    +      '(?:(?:e|g|x)?def|let)',
    +      '(?:begin|end)',
    +      '(?:part|chapter|(?:sub){0,2}section|(?:sub)?paragraph)',
    +      'caption',
    +      '(?:label|(?:eq|page|name)?ref|(?:paren|foot|super)?cite)',
    +      '(?:alpha|beta|[Gg]amma|[Dd]elta|(?:var)?epsilon|zeta|eta|[Tt]heta|vartheta)',
    +      '(?:iota|(?:var)?kappa|[Ll]ambda|mu|nu|[Xx]i|[Pp]i|varpi|(?:var)rho)',
    +      '(?:[Ss]igma|varsigma|tau|[Uu]psilon|[Pp]hi|varphi|chi|[Pp]si|[Oo]mega)',
    +      '(?:frac|sum|prod|lim|infty|times|sqrt|leq|geq|left|right|middle|[bB]igg?)',
    +      '(?:[lr]angle|q?quad|[lcvdi]?dots|d?dot|hat|tilde|bar)'
    +    ].map(word => word + '(?![a-zA-Z@:_])'));
    +  const L3_REGEX = new RegExp([
    +      // A function \module_function_name:signature or \__module_function_name:signature,
    +      // where both module and function_name need at least two characters and
    +      // function_name may contain single underscores.
    +      '(?:__)?[a-zA-Z]{2,}_[a-zA-Z](?:_?[a-zA-Z])+:[a-zA-Z]*',
    +      // A variable \scope_module_and_name_type or \scope__module_ane_name_type,
    +      // where scope is one of l, g or c, type needs at least two characters
    +      // and module_and_name may contain single underscores.
    +      '[lgc]__?[a-zA-Z](?:_?[a-zA-Z])*_[a-zA-Z]{2,}',
    +      // A quark \q_the_name or \q__the_name or
    +      // scan mark \s_the_name or \s__vthe_name,
    +      // where variable_name needs at least two characters and
    +      // may contain single underscores.
    +      '[qs]__?[a-zA-Z](?:_?[a-zA-Z])+',
    +      // Other LaTeX3 macro names that are not covered by the three rules above.
    +      'use(?:_i)?:[a-zA-Z]*',
    +      '(?:else|fi|or):',
    +      '(?:if|cs|exp):w',
    +      '(?:hbox|vbox):n',
    +      '::[a-zA-Z]_unbraced',
    +      '::[a-zA-Z:]'
    +    ].map(pattern => pattern + '(?![a-zA-Z:_])').join('|'));
    +  const L2_VARIANTS = [
    +    {begin: /[a-zA-Z@]+/}, // control word
    +    {begin: /[^a-zA-Z@]?/} // control symbol
    +  ];
    +  const DOUBLE_CARET_VARIANTS = [
    +    {begin: /\^{6}[0-9a-f]{6}/},
    +    {begin: /\^{5}[0-9a-f]{5}/},
    +    {begin: /\^{4}[0-9a-f]{4}/},
    +    {begin: /\^{3}[0-9a-f]{3}/},
    +    {begin: /\^{2}[0-9a-f]{2}/},
    +    {begin: /\^{2}[\u0000-\u007f]/}
    +  ];
    +  const CONTROL_SEQUENCE = {
    +    className: 'keyword',
    +    begin: /\\/,
    +    relevance: 0,
    +    contains: [
    +      {
    +        endsParent: true,
    +        begin: KNOWN_CONTROL_WORDS
    +      },
    +      {
    +        endsParent: true,
    +        begin: L3_REGEX
    +      },
    +      {
    +        endsParent: true,
    +        variants: DOUBLE_CARET_VARIANTS
    +      },
    +      {
    +        endsParent: true,
    +        relevance: 0,
    +        variants: L2_VARIANTS
    +      }
    +    ]
    +  };
    +  const MACRO_PARAM = {
    +    className: 'params',
    +    relevance: 0,
    +    begin: /#+\d?/
    +  };
    +  const DOUBLE_CARET_CHAR = {
    +    // relevance: 1
    +    variants: DOUBLE_CARET_VARIANTS
    +  };
    +  const SPECIAL_CATCODE = {
    +    className: 'built_in',
    +    relevance: 0,
    +    begin: /[$&^_]/
    +  };
    +  const MAGIC_COMMENT = {
    +    className: 'meta',
    +    begin: '% !TeX',
    +    end: '$',
    +    relevance: 10
    +  };
    +  const COMMENT = hljs.COMMENT(
    +    '%',
    +    '$',
    +    {
    +      relevance: 0
    +    }
    +  );
    +  const EVERYTHING_BUT_VERBATIM = [
    +    CONTROL_SEQUENCE,
    +    MACRO_PARAM,
    +    DOUBLE_CARET_CHAR,
    +    SPECIAL_CATCODE,
    +    MAGIC_COMMENT,
    +    COMMENT
    +  ];
    +  const BRACE_GROUP_NO_VERBATIM = {
    +    begin: /\{/, end: /\}/,
    +    relevance: 0,
    +    contains: ['self', ...EVERYTHING_BUT_VERBATIM]
    +  };
    +  const ARGUMENT_BRACES = hljs.inherit(
    +    BRACE_GROUP_NO_VERBATIM,
    +    {
    +      relevance: 0,
    +      endsParent: true,
    +      contains: [BRACE_GROUP_NO_VERBATIM, ...EVERYTHING_BUT_VERBATIM]
    +    }
    +  );
    +  const ARGUMENT_BRACKETS = {
    +    begin: /\[/,
    +      end: /\]/,
    +    endsParent: true,
    +    relevance: 0,
    +    contains: [BRACE_GROUP_NO_VERBATIM, ...EVERYTHING_BUT_VERBATIM]
    +  };
    +  const SPACE_GOBBLER = {
    +    begin: /\s+/,
    +    relevance: 0
    +  };
    +  const ARGUMENT_M = [ARGUMENT_BRACES];
    +  const ARGUMENT_O = [ARGUMENT_BRACKETS];
    +  const ARGUMENT_AND_THEN = function(arg, starts_mode) {
    +    return {
    +      contains: [SPACE_GOBBLER],
    +      starts: {
    +        relevance: 0,
    +        contains: arg,
    +        starts: starts_mode
    +      }
    +    };
    +  };
    +  const CSNAME = function(csname, starts_mode) {
    +    return {
    +        begin: '\\\\' + csname + '(?![a-zA-Z@:_])',
    +        keywords: {$pattern: /\\[a-zA-Z]+/, keyword: '\\' + csname},
    +        relevance: 0,
    +        contains: [SPACE_GOBBLER],
    +        starts: starts_mode
    +      };
    +  };
    +  const BEGIN_ENV = function(envname, starts_mode) {
    +    return hljs.inherit(
    +      {
    +        begin: '\\\\begin(?=[ \t]*(\\r?\\n[ \t]*)?\\{' + envname + '\\})',
    +        keywords: {$pattern: /\\[a-zA-Z]+/, keyword: '\\begin'},
    +        relevance: 0,
    +      },
    +      ARGUMENT_AND_THEN(ARGUMENT_M, starts_mode)
    +    );
    +  };
    +  const VERBATIM_DELIMITED_EQUAL = (innerName = "string") => {
    +    return hljs.END_SAME_AS_BEGIN({
    +      className: innerName,
    +      begin: /(.|\r?\n)/,
    +      end: /(.|\r?\n)/,
    +      excludeBegin: true,
    +      excludeEnd: true,
    +      endsParent: true
    +    });
    +  };
    +  const VERBATIM_DELIMITED_ENV = function(envname) {
    +    return {
    +      className: 'string',
    +      end: '(?=\\\\end\\{' + envname + '\\})'
    +    };
    +  };
    +
    +  const VERBATIM_DELIMITED_BRACES = (innerName = "string") => {
    +    return {
    +      relevance: 0,
    +      begin: /\{/,
    +      starts: {
    +        endsParent: true,
    +        contains: [
    +          {
    +            className: innerName,
    +            end: /(?=\})/,
    +            endsParent:true,
    +            contains: [
    +              {
    +                begin: /\{/,
    +                end: /\}/,
    +                relevance: 0,
    +                contains: ["self"]
    +              }
    +            ],
    +          }
    +        ]
    +      }
    +    };
    +  };
    +  const VERBATIM = [
    +    ...['verb', 'lstinline'].map(csname => CSNAME(csname, {contains: [VERBATIM_DELIMITED_EQUAL()]})),
    +    CSNAME('mint', ARGUMENT_AND_THEN(ARGUMENT_M, {contains: [VERBATIM_DELIMITED_EQUAL()]})),
    +    CSNAME('mintinline', ARGUMENT_AND_THEN(ARGUMENT_M, {contains: [VERBATIM_DELIMITED_BRACES(), VERBATIM_DELIMITED_EQUAL()]})),
    +    CSNAME('url', {contains: [VERBATIM_DELIMITED_BRACES("link"), VERBATIM_DELIMITED_BRACES("link")]}),
    +    CSNAME('hyperref', {contains: [VERBATIM_DELIMITED_BRACES("link")]}),
    +    CSNAME('href', ARGUMENT_AND_THEN(ARGUMENT_O, {contains: [VERBATIM_DELIMITED_BRACES("link")]})),
    +    ...[].concat(...['', '\\*'].map(suffix => [
    +      BEGIN_ENV('verbatim' + suffix, VERBATIM_DELIMITED_ENV('verbatim' + suffix)),
    +      BEGIN_ENV('filecontents' + suffix,  ARGUMENT_AND_THEN(ARGUMENT_M, VERBATIM_DELIMITED_ENV('filecontents' + suffix))),
    +      ...['', 'B', 'L'].map(prefix =>
    +        BEGIN_ENV(prefix + 'Verbatim' + suffix, ARGUMENT_AND_THEN(ARGUMENT_O, VERBATIM_DELIMITED_ENV(prefix + 'Verbatim' + suffix)))
    +      )
    +    ])),
    +    BEGIN_ENV('minted', ARGUMENT_AND_THEN(ARGUMENT_O, ARGUMENT_AND_THEN(ARGUMENT_M, VERBATIM_DELIMITED_ENV('minted')))),
    +  ];
    +
    +  return {
    +    name: 'LaTeX',
    +    aliases: ['TeX'],
    +    contains: [
    +      ...VERBATIM,
    +      ...EVERYTHING_BUT_VERBATIM
    +    ]
    +  };
    +}
    +
    +module.exports = latex;
    diff --git a/node_modules/highlight.js/lib/languages/ldif.js b/node_modules/highlight.js/lib/languages/ldif.js
    new file mode 100644
    index 0000000..3b8d37b
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/ldif.js
    @@ -0,0 +1,42 @@
    +/*
    +Language: LDIF
    +Contributors: Jacob Childress 
    +Category: enterprise, config
    +Website: https://en.wikipedia.org/wiki/LDAP_Data_Interchange_Format
    +*/
    +function ldif(hljs) {
    +  return {
    +    name: 'LDIF',
    +    contains: [
    +      {
    +        className: 'attribute',
    +        begin: '^dn',
    +        end: ': ',
    +        excludeEnd: true,
    +        starts: {
    +          end: '$',
    +          relevance: 0
    +        },
    +        relevance: 10
    +      },
    +      {
    +        className: 'attribute',
    +        begin: '^\\w',
    +        end: ': ',
    +        excludeEnd: true,
    +        starts: {
    +          end: '$',
    +          relevance: 0
    +        }
    +      },
    +      {
    +        className: 'literal',
    +        begin: '^-',
    +        end: '$'
    +      },
    +      hljs.HASH_COMMENT_MODE
    +    ]
    +  };
    +}
    +
    +module.exports = ldif;
    diff --git a/node_modules/highlight.js/lib/languages/leaf.js b/node_modules/highlight.js/lib/languages/leaf.js
    new file mode 100644
    index 0000000..e0ec10d
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/leaf.js
    @@ -0,0 +1,49 @@
    +/*
    +Language: Leaf
    +Author: Hale Chan 
    +Description: Based on the Leaf reference from https://vapor.github.io/documentation/guide/leaf.html.
    +*/
    +
    +function leaf(hljs) {
    +  return {
    +    name: 'Leaf',
    +    contains: [
    +      {
    +        className: 'function',
    +        begin: '#+' + '[A-Za-z_0-9]*' + '\\(',
    +        end: / \{/,
    +        returnBegin: true,
    +        excludeEnd: true,
    +        contains: [
    +          {
    +            className: 'keyword',
    +            begin: '#+'
    +          },
    +          {
    +            className: 'title',
    +            begin: '[A-Za-z_][A-Za-z_0-9]*'
    +          },
    +          {
    +            className: 'params',
    +            begin: '\\(',
    +            end: '\\)',
    +            endsParent: true,
    +            contains: [
    +              {
    +                className: 'string',
    +                begin: '"',
    +                end: '"'
    +              },
    +              {
    +                className: 'variable',
    +                begin: '[A-Za-z_][A-Za-z_0-9]*'
    +              }
    +            ]
    +          }
    +        ]
    +      }
    +    ]
    +  };
    +}
    +
    +module.exports = leaf;
    diff --git a/node_modules/highlight.js/lib/languages/less.js b/node_modules/highlight.js/lib/languages/less.js
    new file mode 100644
    index 0000000..931d337
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/less.js
    @@ -0,0 +1,150 @@
    +/*
    +Language: Less
    +Description: It's CSS, with just a little more.
    +Author:   Max Mikhailov 
    +Website: http://lesscss.org
    +Category: common, css
    +*/
    +
    +function less(hljs) {
    +  var IDENT_RE        = '[\\w-]+'; // yes, Less identifiers may begin with a digit
    +  var INTERP_IDENT_RE = '(' + IDENT_RE + '|@\\{' + IDENT_RE + '\\})';
    +
    +  /* Generic Modes */
    +
    +  var RULES = [], VALUE = []; // forward def. for recursive modes
    +
    +  var STRING_MODE = function(c) { return {
    +    // Less strings are not multiline (also include '~' for more consistent coloring of "escaped" strings)
    +    className: 'string', begin: '~?' + c + '.*?' + c
    +  };};
    +
    +  var IDENT_MODE = function(name, begin, relevance) { return {
    +    className: name, begin: begin, relevance: relevance
    +  };};
    +
    +  var PARENS_MODE = {
    +    // used only to properly balance nested parens inside mixin call, def. arg list
    +    begin: '\\(', end: '\\)', contains: VALUE, relevance: 0
    +  };
    +
    +  // generic Less highlighter (used almost everywhere except selectors):
    +  VALUE.push(
    +    hljs.C_LINE_COMMENT_MODE,
    +    hljs.C_BLOCK_COMMENT_MODE,
    +    STRING_MODE("'"),
    +    STRING_MODE('"'),
    +    hljs.CSS_NUMBER_MODE, // fixme: it does not include dot for numbers like .5em :(
    +    {
    +      begin: '(url|data-uri)\\(',
    +      starts: {className: 'string', end: '[\\)\\n]', excludeEnd: true}
    +    },
    +    IDENT_MODE('number', '#[0-9A-Fa-f]+\\b'),
    +    PARENS_MODE,
    +    IDENT_MODE('variable', '@@?' + IDENT_RE, 10),
    +    IDENT_MODE('variable', '@\\{'  + IDENT_RE + '\\}'),
    +    IDENT_MODE('built_in', '~?`[^`]*?`'), // inline javascript (or whatever host language) *multiline* string
    +    { // @media features (it’s here to not duplicate things in AT_RULE_MODE with extra PARENS_MODE overriding):
    +      className: 'attribute', begin: IDENT_RE + '\\s*:', end: ':', returnBegin: true, excludeEnd: true
    +    },
    +    {
    +      className: 'meta',
    +      begin: '!important'
    +    }
    +  );
    +
    +  var VALUE_WITH_RULESETS = VALUE.concat({
    +    begin: /\{/, end: /\}/, contains: RULES
    +  });
    +
    +  var MIXIN_GUARD_MODE = {
    +    beginKeywords: 'when', endsWithParent: true,
    +    contains: [{beginKeywords: 'and not'}].concat(VALUE) // using this form to override VALUE’s 'function' match
    +  };
    +
    +  /* Rule-Level Modes */
    +
    +  var RULE_MODE = {
    +    begin: INTERP_IDENT_RE + '\\s*:', returnBegin: true, end: '[;}]',
    +    relevance: 0,
    +    contains: [
    +      {
    +        className: 'attribute',
    +        begin: INTERP_IDENT_RE, end: ':', excludeEnd: true,
    +        starts: {
    +          endsWithParent: true, illegal: '[<=$]',
    +          relevance: 0,
    +          contains: VALUE
    +        }
    +      }
    +    ]
    +  };
    +
    +  var AT_RULE_MODE = {
    +    className: 'keyword',
    +    begin: '@(import|media|charset|font-face|(-[a-z]+-)?keyframes|supports|document|namespace|page|viewport|host)\\b',
    +    starts: {end: '[;{}]', returnEnd: true, contains: VALUE, relevance: 0}
    +  };
    +
    +  // variable definitions and calls
    +  var VAR_RULE_MODE = {
    +    className: 'variable',
    +    variants: [
    +      // using more strict pattern for higher relevance to increase chances of Less detection.
    +      // this is *the only* Less specific statement used in most of the sources, so...
    +      // (we’ll still often loose to the css-parser unless there's '//' comment,
    +      // simply because 1 variable just can't beat 99 properties :)
    +      {begin: '@' + IDENT_RE + '\\s*:', relevance: 15},
    +      {begin: '@' + IDENT_RE}
    +    ],
    +    starts: {end: '[;}]', returnEnd: true, contains: VALUE_WITH_RULESETS}
    +  };
    +
    +  var SELECTOR_MODE = {
    +    // first parse unambiguous selectors (i.e. those not starting with tag)
    +    // then fall into the scary lookahead-discriminator variant.
    +    // this mode also handles mixin definitions and calls
    +    variants: [{
    +      begin: '[\\.#:&\\[>]', end: '[;{}]'  // mixin calls end with ';'
    +      }, {
    +      begin: INTERP_IDENT_RE, end: /\{/
    +    }],
    +    returnBegin: true,
    +    returnEnd:   true,
    +    illegal: '[<=\'$"]',
    +    relevance: 0,
    +    contains: [
    +      hljs.C_LINE_COMMENT_MODE,
    +      hljs.C_BLOCK_COMMENT_MODE,
    +      MIXIN_GUARD_MODE,
    +      IDENT_MODE('keyword',  'all\\b'),
    +      IDENT_MODE('variable', '@\\{'  + IDENT_RE + '\\}'),     // otherwise it’s identified as tag
    +      IDENT_MODE('selector-tag',  INTERP_IDENT_RE + '%?', 0), // '%' for more consistent coloring of @keyframes "tags"
    +      IDENT_MODE('selector-id', '#' + INTERP_IDENT_RE),
    +      IDENT_MODE('selector-class', '\\.' + INTERP_IDENT_RE, 0),
    +      IDENT_MODE('selector-tag',  '&', 0),
    +      {className: 'selector-attr', begin: '\\[', end: '\\]'},
    +      {className: 'selector-pseudo', begin: /:(:)?[a-zA-Z0-9_\-+()"'.]+/},
    +      {begin: '\\(', end: '\\)', contains: VALUE_WITH_RULESETS}, // argument list of parametric mixins
    +      {begin: '!important'} // eat !important after mixin call or it will be colored as tag
    +    ]
    +  };
    +
    +  RULES.push(
    +    hljs.C_LINE_COMMENT_MODE,
    +    hljs.C_BLOCK_COMMENT_MODE,
    +    AT_RULE_MODE,
    +    VAR_RULE_MODE,
    +    RULE_MODE,
    +    SELECTOR_MODE
    +  );
    +
    +  return {
    +    name: 'Less',
    +    case_insensitive: true,
    +    illegal: '[=>\'/<($"]',
    +    contains: RULES
    +  };
    +}
    +
    +module.exports = less;
    diff --git a/node_modules/highlight.js/lib/languages/lisp.js b/node_modules/highlight.js/lib/languages/lisp.js
    new file mode 100644
    index 0000000..4c84d8f
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/lisp.js
    @@ -0,0 +1,111 @@
    +/*
    +Language: Lisp
    +Description: Generic lisp syntax
    +Author: Vasily Polovnyov 
    +Category: lisp
    +*/
    +
    +function lisp(hljs) {
    +  var LISP_IDENT_RE = '[a-zA-Z_\\-+\\*\\/<=>&#][a-zA-Z0-9_\\-+*\\/<=>&#!]*';
    +  var MEC_RE = '\\|[^]*?\\|';
    +  var LISP_SIMPLE_NUMBER_RE = '(-|\\+)?\\d+(\\.\\d+|\\/\\d+)?((d|e|f|l|s|D|E|F|L|S)(\\+|-)?\\d+)?';
    +  var LITERAL = {
    +    className: 'literal',
    +    begin: '\\b(t{1}|nil)\\b'
    +  };
    +  var NUMBER = {
    +    className: 'number',
    +    variants: [
    +      {begin: LISP_SIMPLE_NUMBER_RE, relevance: 0},
    +      {begin: '#(b|B)[0-1]+(/[0-1]+)?'},
    +      {begin: '#(o|O)[0-7]+(/[0-7]+)?'},
    +      {begin: '#(x|X)[0-9a-fA-F]+(/[0-9a-fA-F]+)?'},
    +      {begin: '#(c|C)\\(' + LISP_SIMPLE_NUMBER_RE + ' +' + LISP_SIMPLE_NUMBER_RE, end: '\\)'}
    +    ]
    +  };
    +  var STRING = hljs.inherit(hljs.QUOTE_STRING_MODE, {illegal: null});
    +  var COMMENT = hljs.COMMENT(
    +    ';', '$',
    +    {
    +      relevance: 0
    +    }
    +  );
    +  var VARIABLE = {
    +    begin: '\\*', end: '\\*'
    +  };
    +  var KEYWORD = {
    +    className: 'symbol',
    +    begin: '[:&]' + LISP_IDENT_RE
    +  };
    +  var IDENT = {
    +    begin: LISP_IDENT_RE,
    +    relevance: 0
    +  };
    +  var MEC = {
    +    begin: MEC_RE
    +  };
    +  var QUOTED_LIST = {
    +    begin: '\\(', end: '\\)',
    +    contains: ['self', LITERAL, STRING, NUMBER, IDENT]
    +  };
    +  var QUOTED = {
    +    contains: [NUMBER, STRING, VARIABLE, KEYWORD, QUOTED_LIST, IDENT],
    +    variants: [
    +      {
    +        begin: '[\'`]\\(', end: '\\)'
    +      },
    +      {
    +        begin: '\\(quote ', end: '\\)',
    +        keywords: {name: 'quote'}
    +      },
    +      {
    +        begin: '\'' + MEC_RE
    +      }
    +    ]
    +  };
    +  var QUOTED_ATOM = {
    +    variants: [
    +      {begin: '\'' + LISP_IDENT_RE},
    +      {begin: '#\'' + LISP_IDENT_RE + '(::' + LISP_IDENT_RE + ')*'}
    +    ]
    +  };
    +  var LIST = {
    +    begin: '\\(\\s*', end: '\\)'
    +  };
    +  var BODY = {
    +    endsWithParent: true,
    +    relevance: 0
    +  };
    +  LIST.contains = [
    +    {
    +      className: 'name',
    +      variants: [
    +        {
    +          begin: LISP_IDENT_RE,
    +          relevance: 0,
    +        },
    +        {begin: MEC_RE}
    +      ]
    +    },
    +    BODY
    +  ];
    +  BODY.contains = [QUOTED, QUOTED_ATOM, LIST, LITERAL, NUMBER, STRING, COMMENT, VARIABLE, KEYWORD, MEC, IDENT];
    +
    +  return {
    +    name: 'Lisp',
    +    illegal: /\S/,
    +    contains: [
    +      NUMBER,
    +      hljs.SHEBANG(),
    +      LITERAL,
    +      STRING,
    +      COMMENT,
    +      QUOTED,
    +      QUOTED_ATOM,
    +      LIST,
    +      IDENT
    +    ]
    +  };
    +}
    +
    +module.exports = lisp;
    diff --git a/node_modules/highlight.js/lib/languages/livecodeserver.js b/node_modules/highlight.js/lib/languages/livecodeserver.js
    new file mode 100644
    index 0000000..b78c9b1
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/livecodeserver.js
    @@ -0,0 +1,189 @@
    +/*
    +Language: LiveCode
    +Author: Ralf Bitter 
    +Description: Language definition for LiveCode server accounting for revIgniter (a web application framework) characteristics.
    +Version: 1.1
    +Date: 2019-04-17
    +Category: enterprise
    +*/
    +
    +function livecodeserver(hljs) {
    +  const VARIABLE = {
    +    className: 'variable',
    +    variants: [
    +      {
    +        begin: '\\b([gtps][A-Z]{1}[a-zA-Z0-9]*)(\\[.+\\])?(?:\\s*?)'
    +      },
    +      {
    +        begin: '\\$_[A-Z]+'
    +      }
    +    ],
    +    relevance: 0
    +  };
    +  const COMMENT_MODES = [
    +    hljs.C_BLOCK_COMMENT_MODE,
    +    hljs.HASH_COMMENT_MODE,
    +    hljs.COMMENT('--', '$'),
    +    hljs.COMMENT('[^:]//', '$')
    +  ];
    +  const TITLE1 = hljs.inherit(hljs.TITLE_MODE, {
    +    variants: [
    +      {
    +        begin: '\\b_*rig[A-Z][A-Za-z0-9_\\-]*'
    +      },
    +      {
    +        begin: '\\b_[a-z0-9\\-]+'
    +      }
    +    ]
    +  });
    +  const TITLE2 = hljs.inherit(hljs.TITLE_MODE, {
    +    begin: '\\b([A-Za-z0-9_\\-]+)\\b'
    +  });
    +  return {
    +    name: 'LiveCode',
    +    case_insensitive: false,
    +    keywords: {
    +      keyword:
    +        '$_COOKIE $_FILES $_GET $_GET_BINARY $_GET_RAW $_POST $_POST_BINARY $_POST_RAW $_SESSION $_SERVER ' +
    +        'codepoint codepoints segment segments codeunit codeunits sentence sentences trueWord trueWords paragraph ' +
    +        'after byte bytes english the until http forever descending using line real8 with seventh ' +
    +        'for stdout finally element word words fourth before black ninth sixth characters chars stderr ' +
    +        'uInt1 uInt1s uInt2 uInt2s stdin string lines relative rel any fifth items from middle mid ' +
    +        'at else of catch then third it file milliseconds seconds second secs sec int1 int1s int4 ' +
    +        'int4s internet int2 int2s normal text item last long detailed effective uInt4 uInt4s repeat ' +
    +        'end repeat URL in try into switch to words https token binfile each tenth as ticks tick ' +
    +        'system real4 by dateItems without char character ascending eighth whole dateTime numeric short ' +
    +        'first ftp integer abbreviated abbr abbrev private case while if ' +
    +        'div mod wrap and or bitAnd bitNot bitOr bitXor among not in a an within ' +
    +        'contains ends with begins the keys of keys',
    +      literal:
    +        'SIX TEN FORMFEED NINE ZERO NONE SPACE FOUR FALSE COLON CRLF PI COMMA ENDOFFILE EOF EIGHT FIVE ' +
    +        'QUOTE EMPTY ONE TRUE RETURN CR LINEFEED RIGHT BACKSLASH NULL SEVEN TAB THREE TWO ' +
    +        'six ten formfeed nine zero none space four false colon crlf pi comma endoffile eof eight five ' +
    +        'quote empty one true return cr linefeed right backslash null seven tab three two ' +
    +        'RIVERSION RISTATE FILE_READ_MODE FILE_WRITE_MODE FILE_WRITE_MODE DIR_WRITE_MODE FILE_READ_UMASK ' +
    +        'FILE_WRITE_UMASK DIR_READ_UMASK DIR_WRITE_UMASK',
    +      built_in:
    +        'put abs acos aliasReference annuity arrayDecode arrayEncode asin atan atan2 average avg avgDev base64Decode ' +
    +        'base64Encode baseConvert binaryDecode binaryEncode byteOffset byteToNum cachedURL cachedURLs charToNum ' +
    +        'cipherNames codepointOffset codepointProperty codepointToNum codeunitOffset commandNames compound compress ' +
    +        'constantNames cos date dateFormat decompress difference directories ' +
    +        'diskSpace DNSServers exp exp1 exp2 exp10 extents files flushEvents folders format functionNames geometricMean global ' +
    +        'globals hasMemory harmonicMean hostAddress hostAddressToName hostName hostNameToAddress isNumber ISOToMac itemOffset ' +
    +        'keys len length libURLErrorData libUrlFormData libURLftpCommand libURLLastHTTPHeaders libURLLastRHHeaders ' +
    +        'libUrlMultipartFormAddPart libUrlMultipartFormData libURLVersion lineOffset ln ln1 localNames log log2 log10 ' +
    +        'longFilePath lower macToISO matchChunk matchText matrixMultiply max md5Digest median merge messageAuthenticationCode messageDigest millisec ' +
    +        'millisecs millisecond milliseconds min monthNames nativeCharToNum normalizeText num number numToByte numToChar ' +
    +        'numToCodepoint numToNativeChar offset open openfiles openProcesses openProcessIDs openSockets ' +
    +        'paragraphOffset paramCount param params peerAddress pendingMessages platform popStdDev populationStandardDeviation ' +
    +        'populationVariance popVariance processID random randomBytes replaceText result revCreateXMLTree revCreateXMLTreeFromFile ' +
    +        'revCurrentRecord revCurrentRecordIsFirst revCurrentRecordIsLast revDatabaseColumnCount revDatabaseColumnIsNull ' +
    +        'revDatabaseColumnLengths revDatabaseColumnNames revDatabaseColumnNamed revDatabaseColumnNumbered ' +
    +        'revDatabaseColumnTypes revDatabaseConnectResult revDatabaseCursors revDatabaseID revDatabaseTableNames ' +
    +        'revDatabaseType revDataFromQuery revdb_closeCursor revdb_columnbynumber revdb_columncount revdb_columnisnull ' +
    +        'revdb_columnlengths revdb_columnnames revdb_columntypes revdb_commit revdb_connect revdb_connections ' +
    +        'revdb_connectionerr revdb_currentrecord revdb_cursorconnection revdb_cursorerr revdb_cursors revdb_dbtype ' +
    +        'revdb_disconnect revdb_execute revdb_iseof revdb_isbof revdb_movefirst revdb_movelast revdb_movenext ' +
    +        'revdb_moveprev revdb_query revdb_querylist revdb_recordcount revdb_rollback revdb_tablenames ' +
    +        'revGetDatabaseDriverPath revNumberOfRecords revOpenDatabase revOpenDatabases revQueryDatabase ' +
    +        'revQueryDatabaseBlob revQueryResult revQueryIsAtStart revQueryIsAtEnd revUnixFromMacPath revXMLAttribute ' +
    +        'revXMLAttributes revXMLAttributeValues revXMLChildContents revXMLChildNames revXMLCreateTreeFromFileWithNamespaces ' +
    +        'revXMLCreateTreeWithNamespaces revXMLDataFromXPathQuery revXMLEvaluateXPath revXMLFirstChild revXMLMatchingNode ' +
    +        'revXMLNextSibling revXMLNodeContents revXMLNumberOfChildren revXMLParent revXMLPreviousSibling ' +
    +        'revXMLRootNode revXMLRPC_CreateRequest revXMLRPC_Documents revXMLRPC_Error ' +
    +        'revXMLRPC_GetHost revXMLRPC_GetMethod revXMLRPC_GetParam revXMLText revXMLRPC_Execute ' +
    +        'revXMLRPC_GetParamCount revXMLRPC_GetParamNode revXMLRPC_GetParamType revXMLRPC_GetPath revXMLRPC_GetPort ' +
    +        'revXMLRPC_GetProtocol revXMLRPC_GetRequest revXMLRPC_GetResponse revXMLRPC_GetSocket revXMLTree ' +
    +        'revXMLTrees revXMLValidateDTD revZipDescribeItem revZipEnumerateItems revZipOpenArchives round sampVariance ' +
    +        'sec secs seconds sentenceOffset sha1Digest shell shortFilePath sin specialFolderPath sqrt standardDeviation statRound ' +
    +        'stdDev sum sysError systemVersion tan tempName textDecode textEncode tick ticks time to tokenOffset toLower toUpper ' +
    +        'transpose truewordOffset trunc uniDecode uniEncode upper URLDecode URLEncode URLStatus uuid value variableNames ' +
    +        'variance version waitDepth weekdayNames wordOffset xsltApplyStylesheet xsltApplyStylesheetFromFile xsltLoadStylesheet ' +
    +        'xsltLoadStylesheetFromFile add breakpoint cancel clear local variable file word line folder directory URL close socket process ' +
    +        'combine constant convert create new alias folder directory decrypt delete variable word line folder ' +
    +        'directory URL dispatch divide do encrypt filter get include intersect kill libURLDownloadToFile ' +
    +        'libURLFollowHttpRedirects libURLftpUpload libURLftpUploadFile libURLresetAll libUrlSetAuthCallback libURLSetDriver ' +
    +        'libURLSetCustomHTTPHeaders libUrlSetExpect100 libURLSetFTPListCommand libURLSetFTPMode libURLSetFTPStopTime ' +
    +        'libURLSetStatusCallback load extension loadedExtensions multiply socket prepare process post seek rel relative read from process rename ' +
    +        'replace require resetAll resolve revAddXMLNode revAppendXML revCloseCursor revCloseDatabase revCommitDatabase ' +
    +        'revCopyFile revCopyFolder revCopyXMLNode revDeleteFolder revDeleteXMLNode revDeleteAllXMLTrees ' +
    +        'revDeleteXMLTree revExecuteSQL revGoURL revInsertXMLNode revMoveFolder revMoveToFirstRecord revMoveToLastRecord ' +
    +        'revMoveToNextRecord revMoveToPreviousRecord revMoveToRecord revMoveXMLNode revPutIntoXMLNode revRollBackDatabase ' +
    +        'revSetDatabaseDriverPath revSetXMLAttribute revXMLRPC_AddParam revXMLRPC_DeleteAllDocuments revXMLAddDTD ' +
    +        'revXMLRPC_Free revXMLRPC_FreeAll revXMLRPC_DeleteDocument revXMLRPC_DeleteParam revXMLRPC_SetHost ' +
    +        'revXMLRPC_SetMethod revXMLRPC_SetPort revXMLRPC_SetProtocol revXMLRPC_SetSocket revZipAddItemWithData ' +
    +        'revZipAddItemWithFile revZipAddUncompressedItemWithData revZipAddUncompressedItemWithFile revZipCancel ' +
    +        'revZipCloseArchive revZipDeleteItem revZipExtractItemToFile revZipExtractItemToVariable revZipSetProgressCallback ' +
    +        'revZipRenameItem revZipReplaceItemWithData revZipReplaceItemWithFile revZipOpenArchive send set sort split start stop ' +
    +        'subtract symmetric union unload vectorDotProduct wait write'
    +    },
    +    contains: [
    +      VARIABLE,
    +      {
    +        className: 'keyword',
    +        begin: '\\bend\\sif\\b'
    +      },
    +      {
    +        className: 'function',
    +        beginKeywords: 'function',
    +        end: '$',
    +        contains: [
    +          VARIABLE,
    +          TITLE2,
    +          hljs.APOS_STRING_MODE,
    +          hljs.QUOTE_STRING_MODE,
    +          hljs.BINARY_NUMBER_MODE,
    +          hljs.C_NUMBER_MODE,
    +          TITLE1
    +        ]
    +      },
    +      {
    +        className: 'function',
    +        begin: '\\bend\\s+',
    +        end: '$',
    +        keywords: 'end',
    +        contains: [
    +          TITLE2,
    +          TITLE1
    +        ],
    +        relevance: 0
    +      },
    +      {
    +        beginKeywords: 'command on',
    +        end: '$',
    +        contains: [
    +          VARIABLE,
    +          TITLE2,
    +          hljs.APOS_STRING_MODE,
    +          hljs.QUOTE_STRING_MODE,
    +          hljs.BINARY_NUMBER_MODE,
    +          hljs.C_NUMBER_MODE,
    +          TITLE1
    +        ]
    +      },
    +      {
    +        className: 'meta',
    +        variants: [
    +          {
    +            begin: '<\\?(rev|lc|livecode)',
    +            relevance: 10
    +          },
    +          {
    +            begin: '<\\?'
    +          },
    +          {
    +            begin: '\\?>'
    +          }
    +        ]
    +      },
    +      hljs.APOS_STRING_MODE,
    +      hljs.QUOTE_STRING_MODE,
    +      hljs.BINARY_NUMBER_MODE,
    +      hljs.C_NUMBER_MODE,
    +      TITLE1
    +    ].concat(COMMENT_MODES),
    +    illegal: ';$|^\\[|^=|&|\\{'
    +  };
    +}
    +
    +module.exports = livecodeserver;
    diff --git a/node_modules/highlight.js/lib/languages/livescript.js b/node_modules/highlight.js/lib/languages/livescript.js
    new file mode 100644
    index 0000000..0eb0fe9
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/livescript.js
    @@ -0,0 +1,371 @@
    +const KEYWORDS = [
    +  "as", // for exports
    +  "in",
    +  "of",
    +  "if",
    +  "for",
    +  "while",
    +  "finally",
    +  "var",
    +  "new",
    +  "function",
    +  "do",
    +  "return",
    +  "void",
    +  "else",
    +  "break",
    +  "catch",
    +  "instanceof",
    +  "with",
    +  "throw",
    +  "case",
    +  "default",
    +  "try",
    +  "switch",
    +  "continue",
    +  "typeof",
    +  "delete",
    +  "let",
    +  "yield",
    +  "const",
    +  "class",
    +  // JS handles these with a special rule
    +  // "get",
    +  // "set",
    +  "debugger",
    +  "async",
    +  "await",
    +  "static",
    +  "import",
    +  "from",
    +  "export",
    +  "extends"
    +];
    +const LITERALS = [
    +  "true",
    +  "false",
    +  "null",
    +  "undefined",
    +  "NaN",
    +  "Infinity"
    +];
    +
    +const TYPES = [
    +  "Intl",
    +  "DataView",
    +  "Number",
    +  "Math",
    +  "Date",
    +  "String",
    +  "RegExp",
    +  "Object",
    +  "Function",
    +  "Boolean",
    +  "Error",
    +  "Symbol",
    +  "Set",
    +  "Map",
    +  "WeakSet",
    +  "WeakMap",
    +  "Proxy",
    +  "Reflect",
    +  "JSON",
    +  "Promise",
    +  "Float64Array",
    +  "Int16Array",
    +  "Int32Array",
    +  "Int8Array",
    +  "Uint16Array",
    +  "Uint32Array",
    +  "Float32Array",
    +  "Array",
    +  "Uint8Array",
    +  "Uint8ClampedArray",
    +  "ArrayBuffer"
    +];
    +
    +const ERROR_TYPES = [
    +  "EvalError",
    +  "InternalError",
    +  "RangeError",
    +  "ReferenceError",
    +  "SyntaxError",
    +  "TypeError",
    +  "URIError"
    +];
    +
    +const BUILT_IN_GLOBALS = [
    +  "setInterval",
    +  "setTimeout",
    +  "clearInterval",
    +  "clearTimeout",
    +
    +  "require",
    +  "exports",
    +
    +  "eval",
    +  "isFinite",
    +  "isNaN",
    +  "parseFloat",
    +  "parseInt",
    +  "decodeURI",
    +  "decodeURIComponent",
    +  "encodeURI",
    +  "encodeURIComponent",
    +  "escape",
    +  "unescape"
    +];
    +
    +const BUILT_IN_VARIABLES = [
    +  "arguments",
    +  "this",
    +  "super",
    +  "console",
    +  "window",
    +  "document",
    +  "localStorage",
    +  "module",
    +  "global" // Node.js
    +];
    +
    +const BUILT_INS = [].concat(
    +  BUILT_IN_GLOBALS,
    +  BUILT_IN_VARIABLES,
    +  TYPES,
    +  ERROR_TYPES
    +);
    +
    +/*
    +Language: LiveScript
    +Author: Taneli Vatanen 
    +Contributors: Jen Evers-Corvina 
    +Origin: coffeescript.js
    +Description: LiveScript is a programming language that transcompiles to JavaScript. For info about language see http://livescript.net/
    +Website: https://livescript.net
    +Category: scripting
    +*/
    +
    +function livescript(hljs) {
    +  const LIVESCRIPT_BUILT_INS = [
    +    'npm',
    +    'print'
    +  ];
    +  const LIVESCRIPT_LITERALS = [
    +    'yes',
    +    'no',
    +    'on',
    +    'off',
    +    'it',
    +    'that',
    +    'void'
    +  ];
    +  const LIVESCRIPT_KEYWORDS = [
    +    'then',
    +    'unless',
    +    'until',
    +    'loop',
    +    'of',
    +    'by',
    +    'when',
    +    'and',
    +    'or',
    +    'is',
    +    'isnt',
    +    'not',
    +    'it',
    +    'that',
    +    'otherwise',
    +    'from',
    +    'to',
    +    'til',
    +    'fallthrough',
    +    'case',
    +    'enum',
    +    'native',
    +    'list',
    +    'map',
    +    '__hasProp',
    +    '__extends',
    +    '__slice',
    +    '__bind',
    +    '__indexOf'
    +  ];
    +  const KEYWORDS$1 = {
    +    keyword: KEYWORDS.concat(LIVESCRIPT_KEYWORDS).join(" "),
    +    literal: LITERALS.concat(LIVESCRIPT_LITERALS).join(" "),
    +    built_in: BUILT_INS.concat(LIVESCRIPT_BUILT_INS).join(" ")
    +  };
    +  const JS_IDENT_RE = '[A-Za-z$_](?:-[0-9A-Za-z$_]|[0-9A-Za-z$_])*';
    +  const TITLE = hljs.inherit(hljs.TITLE_MODE, {
    +    begin: JS_IDENT_RE
    +  });
    +  const SUBST = {
    +    className: 'subst',
    +    begin: /#\{/,
    +    end: /\}/,
    +    keywords: KEYWORDS$1
    +  };
    +  const SUBST_SIMPLE = {
    +    className: 'subst',
    +    begin: /#[A-Za-z$_]/,
    +    end: /(?:-[0-9A-Za-z$_]|[0-9A-Za-z$_])*/,
    +    keywords: KEYWORDS$1
    +  };
    +  const EXPRESSIONS = [
    +    hljs.BINARY_NUMBER_MODE,
    +    {
    +      className: 'number',
    +      begin: '(\\b0[xX][a-fA-F0-9_]+)|(\\b\\d(\\d|_\\d)*(\\.(\\d(\\d|_\\d)*)?)?(_*[eE]([-+]\\d(_\\d|\\d)*)?)?[_a-z]*)',
    +      relevance: 0,
    +      starts: {
    +        end: '(\\s*/)?',
    +        relevance: 0
    +      } // a number tries to eat the following slash to prevent treating it as a regexp
    +    },
    +    {
    +      className: 'string',
    +      variants: [
    +        {
    +          begin: /'''/,
    +          end: /'''/,
    +          contains: [hljs.BACKSLASH_ESCAPE]
    +        },
    +        {
    +          begin: /'/,
    +          end: /'/,
    +          contains: [hljs.BACKSLASH_ESCAPE]
    +        },
    +        {
    +          begin: /"""/,
    +          end: /"""/,
    +          contains: [
    +            hljs.BACKSLASH_ESCAPE,
    +            SUBST,
    +            SUBST_SIMPLE
    +          ]
    +        },
    +        {
    +          begin: /"/,
    +          end: /"/,
    +          contains: [
    +            hljs.BACKSLASH_ESCAPE,
    +            SUBST,
    +            SUBST_SIMPLE
    +          ]
    +        },
    +        {
    +          begin: /\\/,
    +          end: /(\s|$)/,
    +          excludeEnd: true
    +        }
    +      ]
    +    },
    +    {
    +      className: 'regexp',
    +      variants: [
    +        {
    +          begin: '//',
    +          end: '//[gim]*',
    +          contains: [
    +            SUBST,
    +            hljs.HASH_COMMENT_MODE
    +          ]
    +        },
    +        {
    +          // regex can't start with space to parse x / 2 / 3 as two divisions
    +          // regex can't start with *, and it supports an "illegal" in the main mode
    +          begin: /\/(?![ *])(\\.|[^\\\n])*?\/[gim]*(?=\W)/
    +        }
    +      ]
    +    },
    +    {
    +      begin: '@' + JS_IDENT_RE
    +    },
    +    {
    +      begin: '``',
    +      end: '``',
    +      excludeBegin: true,
    +      excludeEnd: true,
    +      subLanguage: 'javascript'
    +    }
    +  ];
    +  SUBST.contains = EXPRESSIONS;
    +
    +  const PARAMS = {
    +    className: 'params',
    +    begin: '\\(',
    +    returnBegin: true,
    +    /* We need another contained nameless mode to not have every nested
    +    pair of parens to be called "params" */
    +    contains: [
    +      {
    +        begin: /\(/,
    +        end: /\)/,
    +        keywords: KEYWORDS$1,
    +        contains: ['self'].concat(EXPRESSIONS)
    +      }
    +    ]
    +  };
    +
    +  const SYMBOLS = {
    +    begin: '(#=>|=>|\\|>>|-?->|!->)'
    +  };
    +
    +  return {
    +    name: 'LiveScript',
    +    aliases: ['ls'],
    +    keywords: KEYWORDS$1,
    +    illegal: /\/\*/,
    +    contains: EXPRESSIONS.concat([
    +      hljs.COMMENT('\\/\\*', '\\*\\/'),
    +      hljs.HASH_COMMENT_MODE,
    +      SYMBOLS, // relevance booster
    +      {
    +        className: 'function',
    +        contains: [
    +          TITLE,
    +          PARAMS
    +        ],
    +        returnBegin: true,
    +        variants: [
    +          {
    +            begin: '(' + JS_IDENT_RE + '\\s*(?:=|:=)\\s*)?(\\(.*\\)\\s*)?\\B->\\*?',
    +            end: '->\\*?'
    +          },
    +          {
    +            begin: '(' + JS_IDENT_RE + '\\s*(?:=|:=)\\s*)?!?(\\(.*\\)\\s*)?\\B[-~]{1,2}>\\*?',
    +            end: '[-~]{1,2}>\\*?'
    +          },
    +          {
    +            begin: '(' + JS_IDENT_RE + '\\s*(?:=|:=)\\s*)?(\\(.*\\)\\s*)?\\B!?[-~]{1,2}>\\*?',
    +            end: '!?[-~]{1,2}>\\*?'
    +          }
    +        ]
    +      },
    +      {
    +        className: 'class',
    +        beginKeywords: 'class',
    +        end: '$',
    +        illegal: /[:="\[\]]/,
    +        contains: [
    +          {
    +            beginKeywords: 'extends',
    +            endsWithParent: true,
    +            illegal: /[:="\[\]]/,
    +            contains: [TITLE]
    +          },
    +          TITLE
    +        ]
    +      },
    +      {
    +        begin: JS_IDENT_RE + ':',
    +        end: ':',
    +        returnBegin: true,
    +        returnEnd: true,
    +        relevance: 0
    +      }
    +    ])
    +  };
    +}
    +
    +module.exports = livescript;
    diff --git a/node_modules/highlight.js/lib/languages/llvm.js b/node_modules/highlight.js/lib/languages/llvm.js
    new file mode 100644
    index 0000000..b7eac64
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/llvm.js
    @@ -0,0 +1,154 @@
    +/**
    + * @param {string} value
    + * @returns {RegExp}
    + * */
    +
    +/**
    + * @param {RegExp | string } re
    + * @returns {string}
    + */
    +function source(re) {
    +  if (!re) return null;
    +  if (typeof re === "string") return re;
    +
    +  return re.source;
    +}
    +
    +/**
    + * @param {...(RegExp | string) } args
    + * @returns {string}
    + */
    +function concat(...args) {
    +  const joined = args.map((x) => source(x)).join("");
    +  return joined;
    +}
    +
    +/*
    +Language: LLVM IR
    +Author: Michael Rodler 
    +Description: language used as intermediate representation in the LLVM compiler framework
    +Website: https://llvm.org/docs/LangRef.html
    +Category: assembler
    +Audit: 2020
    +*/
    +
    +/** @type LanguageFn */
    +function llvm(hljs) {
    +  const IDENT_RE = /([-a-zA-Z$._][\w$.-]*)/;
    +  const TYPE = {
    +    className: 'type',
    +    begin: /\bi\d+(?=\s|\b)/
    +  };
    +  const OPERATOR = {
    +    className: 'operator',
    +    relevance: 0,
    +    begin: /=/
    +  };
    +  const PUNCTUATION = {
    +    className: 'punctuation',
    +    relevance: 0,
    +    begin: /,/
    +  };
    +  const NUMBER = {
    +    className: 'number',
    +    variants: [
    +        { begin: /0[xX][a-fA-F0-9]+/ },
    +        { begin: /-?\d+(?:[.]\d+)?(?:[eE][-+]?\d+(?:[.]\d+)?)?/ }
    +    ],
    +    relevance: 0
    +  };
    +  const LABEL = {
    +    className: 'symbol',
    +    variants: [
    +        { begin: /^\s*[a-z]+:/ }, // labels
    +    ],
    +    relevance: 0
    +  };
    +  const VARIABLE = {
    +    className: 'variable',
    +    variants: [
    +      { begin: concat(/%/, IDENT_RE) },
    +      { begin: /%\d+/ },
    +      { begin: /#\d+/ },
    +    ]
    +  };
    +  const FUNCTION = {
    +    className: 'title',
    +    variants: [
    +      { begin: concat(/@/, IDENT_RE) },
    +      { begin: /@\d+/ },
    +      { begin: concat(/!/, IDENT_RE) },
    +      { begin: concat(/!\d+/, IDENT_RE) },
    +      // https://llvm.org/docs/LangRef.html#namedmetadatastructure
    +      // obviously a single digit can also be used in this fashion
    +      { begin: /!\d+/ }
    +    ]
    +  };
    +
    +  return {
    +    name: 'LLVM IR',
    +    // TODO: split into different categories of keywords
    +    keywords:
    +      'begin end true false declare define global ' +
    +      'constant private linker_private internal ' +
    +      'available_externally linkonce linkonce_odr weak ' +
    +      'weak_odr appending dllimport dllexport common ' +
    +      'default hidden protected extern_weak external ' +
    +      'thread_local zeroinitializer undef null to tail ' +
    +      'target triple datalayout volatile nuw nsw nnan ' +
    +      'ninf nsz arcp fast exact inbounds align ' +
    +      'addrspace section alias module asm sideeffect ' +
    +      'gc dbg linker_private_weak attributes blockaddress ' +
    +      'initialexec localdynamic localexec prefix unnamed_addr ' +
    +      'ccc fastcc coldcc x86_stdcallcc x86_fastcallcc ' +
    +      'arm_apcscc arm_aapcscc arm_aapcs_vfpcc ptx_device ' +
    +      'ptx_kernel intel_ocl_bicc msp430_intrcc spir_func ' +
    +      'spir_kernel x86_64_sysvcc x86_64_win64cc x86_thiscallcc ' +
    +      'cc c signext zeroext inreg sret nounwind ' +
    +      'noreturn noalias nocapture byval nest readnone ' +
    +      'readonly inlinehint noinline alwaysinline optsize ssp ' +
    +      'sspreq noredzone noimplicitfloat naked builtin cold ' +
    +      'nobuiltin noduplicate nonlazybind optnone returns_twice ' +
    +      'sanitize_address sanitize_memory sanitize_thread sspstrong ' +
    +      'uwtable returned type opaque eq ne slt sgt ' +
    +      'sle sge ult ugt ule uge oeq one olt ogt ' +
    +      'ole oge ord uno ueq une x acq_rel acquire ' +
    +      'alignstack atomic catch cleanup filter inteldialect ' +
    +      'max min monotonic nand personality release seq_cst ' +
    +      'singlethread umax umin unordered xchg add fadd ' +
    +      'sub fsub mul fmul udiv sdiv fdiv urem srem ' +
    +      'frem shl lshr ashr and or xor icmp fcmp ' +
    +      'phi call trunc zext sext fptrunc fpext uitofp ' +
    +      'sitofp fptoui fptosi inttoptr ptrtoint bitcast ' +
    +      'addrspacecast select va_arg ret br switch invoke ' +
    +      'unwind unreachable indirectbr landingpad resume ' +
    +      'malloc alloca free load store getelementptr ' +
    +      'extractelement insertelement shufflevector getresult ' +
    +      'extractvalue insertvalue atomicrmw cmpxchg fence ' +
    +      'argmemonly double',
    +    contains: [
    +      TYPE,
    +      // this matches "empty comments"...
    +      // ...because it's far more likely this is a statement terminator in
    +      // another language than an actual comment
    +      hljs.COMMENT(/;\s*$/, null, { relevance: 0 }),
    +      hljs.COMMENT(/;/, /$/),
    +      hljs.QUOTE_STRING_MODE,
    +      {
    +        className: 'string',
    +        variants: [
    +          // Double-quoted string
    +          { begin: /"/, end: /[^\\]"/ },
    +        ]
    +      },
    +      FUNCTION,
    +      PUNCTUATION,
    +      OPERATOR,
    +      VARIABLE,
    +      LABEL,
    +      NUMBER
    +    ]
    +  };
    +}
    +
    +module.exports = llvm;
    diff --git a/node_modules/highlight.js/lib/languages/lsl.js b/node_modules/highlight.js/lib/languages/lsl.js
    new file mode 100644
    index 0000000..279fc46
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/lsl.js
    @@ -0,0 +1,95 @@
    +/*
    +Language: LSL (Linden Scripting Language)
    +Description: The Linden Scripting Language is used in Second Life by Linden Labs.
    +Author: Builder's Brewery 
    +Website: http://wiki.secondlife.com/wiki/LSL_Portal
    +Category: scripting
    +*/
    +
    +function lsl(hljs) {
    +
    +    var LSL_STRING_ESCAPE_CHARS = {
    +        className: 'subst',
    +        begin: /\\[tn"\\]/
    +    };
    +
    +    var LSL_STRINGS = {
    +        className: 'string',
    +        begin: '"',
    +        end: '"',
    +        contains: [
    +            LSL_STRING_ESCAPE_CHARS
    +        ]
    +    };
    +
    +    var LSL_NUMBERS = {
    +        className: 'number',
    +        relevance:0,
    +        begin: hljs.C_NUMBER_RE
    +    };
    +
    +    var LSL_CONSTANTS = {
    +        className: 'literal',
    +        variants: [
    +            {
    +                begin: '\\b(PI|TWO_PI|PI_BY_TWO|DEG_TO_RAD|RAD_TO_DEG|SQRT2)\\b'
    +            },
    +            {
    +                begin: '\\b(XP_ERROR_(EXPERIENCES_DISABLED|EXPERIENCE_(DISABLED|SUSPENDED)|INVALID_(EXPERIENCE|PARAMETERS)|KEY_NOT_FOUND|MATURITY_EXCEEDED|NONE|NOT_(FOUND|PERMITTED(_LAND)?)|NO_EXPERIENCE|QUOTA_EXCEEDED|RETRY_UPDATE|STORAGE_EXCEPTION|STORE_DISABLED|THROTTLED|UNKNOWN_ERROR)|JSON_APPEND|STATUS_(PHYSICS|ROTATE_[XYZ]|PHANTOM|SANDBOX|BLOCK_GRAB(_OBJECT)?|(DIE|RETURN)_AT_EDGE|CAST_SHADOWS|OK|MALFORMED_PARAMS|TYPE_MISMATCH|BOUNDS_ERROR|NOT_(FOUND|SUPPORTED)|INTERNAL_ERROR|WHITELIST_FAILED)|AGENT(_(BY_(LEGACY_|USER)NAME|FLYING|ATTACHMENTS|SCRIPTED|MOUSELOOK|SITTING|ON_OBJECT|AWAY|WALKING|IN_AIR|TYPING|CROUCHING|BUSY|ALWAYS_RUN|AUTOPILOT|LIST_(PARCEL(_OWNER)?|REGION)))?|CAMERA_(PITCH|DISTANCE|BEHINDNESS_(ANGLE|LAG)|(FOCUS|POSITION)(_(THRESHOLD|LOCKED|LAG))?|FOCUS_OFFSET|ACTIVE)|ANIM_ON|LOOP|REVERSE|PING_PONG|SMOOTH|ROTATE|SCALE|ALL_SIDES|LINK_(ROOT|SET|ALL_(OTHERS|CHILDREN)|THIS)|ACTIVE|PASS(IVE|_(ALWAYS|IF_NOT_HANDLED|NEVER))|SCRIPTED|CONTROL_(FWD|BACK|(ROT_)?(LEFT|RIGHT)|UP|DOWN|(ML_)?LBUTTON)|PERMISSION_(RETURN_OBJECTS|DEBIT|OVERRIDE_ANIMATIONS|SILENT_ESTATE_MANAGEMENT|TAKE_CONTROLS|TRIGGER_ANIMATION|ATTACH|CHANGE_LINKS|(CONTROL|TRACK)_CAMERA|TELEPORT)|INVENTORY_(TEXTURE|SOUND|OBJECT|SCRIPT|LANDMARK|CLOTHING|NOTECARD|BODYPART|ANIMATION|GESTURE|ALL|NONE)|CHANGED_(INVENTORY|COLOR|SHAPE|SCALE|TEXTURE|LINK|ALLOWED_DROP|OWNER|REGION(_START)?|TELEPORT|MEDIA)|OBJECT_(CLICK_ACTION|HOVER_HEIGHT|LAST_OWNER_ID|(PHYSICS|SERVER|STREAMING)_COST|UNKNOWN_DETAIL|CHARACTER_TIME|PHANTOM|PHYSICS|TEMP_(ATTACHED|ON_REZ)|NAME|DESC|POS|PRIM_(COUNT|EQUIVALENCE)|RETURN_(PARCEL(_OWNER)?|REGION)|REZZER_KEY|ROO?T|VELOCITY|OMEGA|OWNER|GROUP(_TAG)?|CREATOR|ATTACHED_(POINT|SLOTS_AVAILABLE)|RENDER_WEIGHT|(BODY_SHAPE|PATHFINDING)_TYPE|(RUNNING|TOTAL)_SCRIPT_COUNT|TOTAL_INVENTORY_COUNT|SCRIPT_(MEMORY|TIME))|TYPE_(INTEGER|FLOAT|STRING|KEY|VECTOR|ROTATION|INVALID)|(DEBUG|PUBLIC)_CHANNEL|ATTACH_(AVATAR_CENTER|CHEST|HEAD|BACK|PELVIS|MOUTH|CHIN|NECK|NOSE|BELLY|[LR](SHOULDER|HAND|FOOT|EAR|EYE|[UL](ARM|LEG)|HIP)|(LEFT|RIGHT)_PEC|HUD_(CENTER_[12]|TOP_(RIGHT|CENTER|LEFT)|BOTTOM(_(RIGHT|LEFT))?)|[LR]HAND_RING1|TAIL_(BASE|TIP)|[LR]WING|FACE_(JAW|[LR]EAR|[LR]EYE|TOUNGE)|GROIN|HIND_[LR]FOOT)|LAND_(LEVEL|RAISE|LOWER|SMOOTH|NOISE|REVERT)|DATA_(ONLINE|NAME|BORN|SIM_(POS|STATUS|RATING)|PAYINFO)|PAYMENT_INFO_(ON_FILE|USED)|REMOTE_DATA_(CHANNEL|REQUEST|REPLY)|PSYS_(PART_(BF_(ZERO|ONE(_MINUS_(DEST_COLOR|SOURCE_(ALPHA|COLOR)))?|DEST_COLOR|SOURCE_(ALPHA|COLOR))|BLEND_FUNC_(DEST|SOURCE)|FLAGS|(START|END)_(COLOR|ALPHA|SCALE|GLOW)|MAX_AGE|(RIBBON|WIND|INTERP_(COLOR|SCALE)|BOUNCE|FOLLOW_(SRC|VELOCITY)|TARGET_(POS|LINEAR)|EMISSIVE)_MASK)|SRC_(MAX_AGE|PATTERN|ANGLE_(BEGIN|END)|BURST_(RATE|PART_COUNT|RADIUS|SPEED_(MIN|MAX))|ACCEL|TEXTURE|TARGET_KEY|OMEGA|PATTERN_(DROP|EXPLODE|ANGLE(_CONE(_EMPTY)?)?)))|VEHICLE_(REFERENCE_FRAME|TYPE_(NONE|SLED|CAR|BOAT|AIRPLANE|BALLOON)|(LINEAR|ANGULAR)_(FRICTION_TIMESCALE|MOTOR_DIRECTION)|LINEAR_MOTOR_OFFSET|HOVER_(HEIGHT|EFFICIENCY|TIMESCALE)|BUOYANCY|(LINEAR|ANGULAR)_(DEFLECTION_(EFFICIENCY|TIMESCALE)|MOTOR_(DECAY_)?TIMESCALE)|VERTICAL_ATTRACTION_(EFFICIENCY|TIMESCALE)|BANKING_(EFFICIENCY|MIX|TIMESCALE)|FLAG_(NO_DEFLECTION_UP|LIMIT_(ROLL_ONLY|MOTOR_UP)|HOVER_((WATER|TERRAIN|UP)_ONLY|GLOBAL_HEIGHT)|MOUSELOOK_(STEER|BANK)|CAMERA_DECOUPLED))|PRIM_(ALLOW_UNSIT|ALPHA_MODE(_(BLEND|EMISSIVE|MASK|NONE))?|NORMAL|SPECULAR|TYPE(_(BOX|CYLINDER|PRISM|SPHERE|TORUS|TUBE|RING|SCULPT))?|HOLE_(DEFAULT|CIRCLE|SQUARE|TRIANGLE)|MATERIAL(_(STONE|METAL|GLASS|WOOD|FLESH|PLASTIC|RUBBER))?|SHINY_(NONE|LOW|MEDIUM|HIGH)|BUMP_(NONE|BRIGHT|DARK|WOOD|BARK|BRICKS|CHECKER|CONCRETE|TILE|STONE|DISKS|GRAVEL|BLOBS|SIDING|LARGETILE|STUCCO|SUCTION|WEAVE)|TEXGEN_(DEFAULT|PLANAR)|SCRIPTED_SIT_ONLY|SCULPT_(TYPE_(SPHERE|TORUS|PLANE|CYLINDER|MASK)|FLAG_(MIRROR|INVERT))|PHYSICS(_(SHAPE_(CONVEX|NONE|PRIM|TYPE)))?|(POS|ROT)_LOCAL|SLICE|TEXT|FLEXIBLE|POINT_LIGHT|TEMP_ON_REZ|PHANTOM|POSITION|SIT_TARGET|SIZE|ROTATION|TEXTURE|NAME|OMEGA|DESC|LINK_TARGET|COLOR|BUMP_SHINY|FULLBRIGHT|TEXGEN|GLOW|MEDIA_(ALT_IMAGE_ENABLE|CONTROLS|(CURRENT|HOME)_URL|AUTO_(LOOP|PLAY|SCALE|ZOOM)|FIRST_CLICK_INTERACT|(WIDTH|HEIGHT)_PIXELS|WHITELIST(_ENABLE)?|PERMS_(INTERACT|CONTROL)|PARAM_MAX|CONTROLS_(STANDARD|MINI)|PERM_(NONE|OWNER|GROUP|ANYONE)|MAX_(URL_LENGTH|WHITELIST_(SIZE|COUNT)|(WIDTH|HEIGHT)_PIXELS)))|MASK_(BASE|OWNER|GROUP|EVERYONE|NEXT)|PERM_(TRANSFER|MODIFY|COPY|MOVE|ALL)|PARCEL_(MEDIA_COMMAND_(STOP|PAUSE|PLAY|LOOP|TEXTURE|URL|TIME|AGENT|UNLOAD|AUTO_ALIGN|TYPE|SIZE|DESC|LOOP_SET)|FLAG_(ALLOW_(FLY|(GROUP_)?SCRIPTS|LANDMARK|TERRAFORM|DAMAGE|CREATE_(GROUP_)?OBJECTS)|USE_(ACCESS_(GROUP|LIST)|BAN_LIST|LAND_PASS_LIST)|LOCAL_SOUND_ONLY|RESTRICT_PUSHOBJECT|ALLOW_(GROUP|ALL)_OBJECT_ENTRY)|COUNT_(TOTAL|OWNER|GROUP|OTHER|SELECTED|TEMP)|DETAILS_(NAME|DESC|OWNER|GROUP|AREA|ID|SEE_AVATARS))|LIST_STAT_(MAX|MIN|MEAN|MEDIAN|STD_DEV|SUM(_SQUARES)?|NUM_COUNT|GEOMETRIC_MEAN|RANGE)|PAY_(HIDE|DEFAULT)|REGION_FLAG_(ALLOW_DAMAGE|FIXED_SUN|BLOCK_TERRAFORM|SANDBOX|DISABLE_(COLLISIONS|PHYSICS)|BLOCK_FLY|ALLOW_DIRECT_TELEPORT|RESTRICT_PUSHOBJECT)|HTTP_(METHOD|MIMETYPE|BODY_(MAXLENGTH|TRUNCATED)|CUSTOM_HEADER|PRAGMA_NO_CACHE|VERBOSE_THROTTLE|VERIFY_CERT)|SIT_(INVALID_(AGENT|LINK_OBJECT)|NO(T_EXPERIENCE|_(ACCESS|EXPERIENCE_PERMISSION|SIT_TARGET)))|STRING_(TRIM(_(HEAD|TAIL))?)|CLICK_ACTION_(NONE|TOUCH|SIT|BUY|PAY|OPEN(_MEDIA)?|PLAY|ZOOM)|TOUCH_INVALID_FACE|PROFILE_(NONE|SCRIPT_MEMORY)|RC_(DATA_FLAGS|DETECT_PHANTOM|GET_(LINK_NUM|NORMAL|ROOT_KEY)|MAX_HITS|REJECT_(TYPES|AGENTS|(NON)?PHYSICAL|LAND))|RCERR_(CAST_TIME_EXCEEDED|SIM_PERF_LOW|UNKNOWN)|ESTATE_ACCESS_(ALLOWED_(AGENT|GROUP)_(ADD|REMOVE)|BANNED_AGENT_(ADD|REMOVE))|DENSITY|FRICTION|RESTITUTION|GRAVITY_MULTIPLIER|KFM_(COMMAND|CMD_(PLAY|STOP|PAUSE)|MODE|FORWARD|LOOP|PING_PONG|REVERSE|DATA|ROTATION|TRANSLATION)|ERR_(GENERIC|PARCEL_PERMISSIONS|MALFORMED_PARAMS|RUNTIME_PERMISSIONS|THROTTLED)|CHARACTER_(CMD_((SMOOTH_)?STOP|JUMP)|DESIRED_(TURN_)?SPEED|RADIUS|STAY_WITHIN_PARCEL|LENGTH|ORIENTATION|ACCOUNT_FOR_SKIPPED_FRAMES|AVOIDANCE_MODE|TYPE(_([ABCD]|NONE))?|MAX_(DECEL|TURN_RADIUS|(ACCEL|SPEED)))|PURSUIT_(OFFSET|FUZZ_FACTOR|GOAL_TOLERANCE|INTERCEPT)|REQUIRE_LINE_OF_SIGHT|FORCE_DIRECT_PATH|VERTICAL|HORIZONTAL|AVOID_(CHARACTERS|DYNAMIC_OBSTACLES|NONE)|PU_(EVADE_(HIDDEN|SPOTTED)|FAILURE_(DYNAMIC_PATHFINDING_DISABLED|INVALID_(GOAL|START)|NO_(NAVMESH|VALID_DESTINATION)|OTHER|TARGET_GONE|(PARCEL_)?UNREACHABLE)|(GOAL|SLOWDOWN_DISTANCE)_REACHED)|TRAVERSAL_TYPE(_(FAST|NONE|SLOW))?|CONTENT_TYPE_(ATOM|FORM|HTML|JSON|LLSD|RSS|TEXT|XHTML|XML)|GCNP_(RADIUS|STATIC)|(PATROL|WANDER)_PAUSE_AT_WAYPOINTS|OPT_(AVATAR|CHARACTER|EXCLUSION_VOLUME|LEGACY_LINKSET|MATERIAL_VOLUME|OTHER|STATIC_OBSTACLE|WALKABLE)|SIM_STAT_PCT_CHARS_STEPPED)\\b'
    +            },
    +            {
    +                begin: '\\b(FALSE|TRUE)\\b'
    +            },
    +            {
    +                begin: '\\b(ZERO_ROTATION)\\b'
    +            },
    +            {
    +                begin: '\\b(EOF|JSON_(ARRAY|DELETE|FALSE|INVALID|NULL|NUMBER|OBJECT|STRING|TRUE)|NULL_KEY|TEXTURE_(BLANK|DEFAULT|MEDIA|PLYWOOD|TRANSPARENT)|URL_REQUEST_(GRANTED|DENIED))\\b'
    +            },
    +            {
    +                begin: '\\b(ZERO_VECTOR|TOUCH_INVALID_(TEXCOORD|VECTOR))\\b'
    +            }
    +        ]
    +    };
    +
    +    var LSL_FUNCTIONS = {
    +        className: 'built_in',
    +        begin: '\\b(ll(AgentInExperience|(Create|DataSize|Delete|KeyCount|Keys|Read|Update)KeyValue|GetExperience(Details|ErrorMessage)|ReturnObjectsBy(ID|Owner)|Json(2List|[GS]etValue|ValueType)|Sin|Cos|Tan|Atan2|Sqrt|Pow|Abs|Fabs|Frand|Floor|Ceil|Round|Vec(Mag|Norm|Dist)|Rot(Between|2(Euler|Fwd|Left|Up))|(Euler|Axes)2Rot|Whisper|(Region|Owner)?Say|Shout|Listen(Control|Remove)?|Sensor(Repeat|Remove)?|Detected(Name|Key|Owner|Type|Pos|Vel|Grab|Rot|Group|LinkNumber)|Die|Ground|Wind|([GS]et)(AnimationOverride|MemoryLimit|PrimMediaParams|ParcelMusicURL|Object(Desc|Name)|PhysicsMaterial|Status|Scale|Color|Alpha|Texture|Pos|Rot|Force|Torque)|ResetAnimationOverride|(Scale|Offset|Rotate)Texture|(Rot)?Target(Remove)?|(Stop)?MoveToTarget|Apply(Rotational)?Impulse|Set(KeyframedMotion|ContentType|RegionPos|(Angular)?Velocity|Buoyancy|HoverHeight|ForceAndTorque|TimerEvent|ScriptState|Damage|TextureAnim|Sound(Queueing|Radius)|Vehicle(Type|(Float|Vector|Rotation)Param)|(Touch|Sit)?Text|Camera(Eye|At)Offset|PrimitiveParams|ClickAction|Link(Alpha|Color|PrimitiveParams(Fast)?|Texture(Anim)?|Camera|Media)|RemoteScriptAccessPin|PayPrice|LocalRot)|ScaleByFactor|Get((Max|Min)ScaleFactor|ClosestNavPoint|StaticPath|SimStats|Env|PrimitiveParams|Link(PrimitiveParams|Number(OfSides)?|Key|Name|Media)|HTTPHeader|FreeURLs|Object(Details|PermMask|PrimCount)|Parcel(MaxPrims|Details|Prim(Count|Owners))|Attached(List)?|(SPMax|Free|Used)Memory|Region(Name|TimeDilation|FPS|Corner|AgentCount)|Root(Position|Rotation)|UnixTime|(Parcel|Region)Flags|(Wall|GMT)clock|SimulatorHostname|BoundingBox|GeometricCenter|Creator|NumberOf(Prims|NotecardLines|Sides)|Animation(List)?|(Camera|Local)(Pos|Rot)|Vel|Accel|Omega|Time(stamp|OfDay)|(Object|CenterOf)?Mass|MassMKS|Energy|Owner|(Owner)?Key|SunDirection|Texture(Offset|Scale|Rot)|Inventory(Number|Name|Key|Type|Creator|PermMask)|Permissions(Key)?|StartParameter|List(Length|EntryType)|Date|Agent(Size|Info|Language|List)|LandOwnerAt|NotecardLine|Script(Name|State))|(Get|Reset|GetAndReset)Time|PlaySound(Slave)?|LoopSound(Master|Slave)?|(Trigger|Stop|Preload)Sound|((Get|Delete)Sub|Insert)String|To(Upper|Lower)|Give(InventoryList|Money)|RezObject|(Stop)?LookAt|Sleep|CollisionFilter|(Take|Release)Controls|DetachFromAvatar|AttachToAvatar(Temp)?|InstantMessage|(GetNext)?Email|StopHover|MinEventDelay|RotLookAt|String(Length|Trim)|(Start|Stop)Animation|TargetOmega|Request(Experience)?Permissions|(Create|Break)Link|BreakAllLinks|(Give|Remove)Inventory|Water|PassTouches|Request(Agent|Inventory)Data|TeleportAgent(Home|GlobalCoords)?|ModifyLand|CollisionSound|ResetScript|MessageLinked|PushObject|PassCollisions|AxisAngle2Rot|Rot2(Axis|Angle)|A(cos|sin)|AngleBetween|AllowInventoryDrop|SubStringIndex|List2(CSV|Integer|Json|Float|String|Key|Vector|Rot|List(Strided)?)|DeleteSubList|List(Statistics|Sort|Randomize|(Insert|Find|Replace)List)|EdgeOfWorld|AdjustSoundVolume|Key2Name|TriggerSoundLimited|EjectFromLand|(CSV|ParseString)2List|OverMyLand|SameGroup|UnSit|Ground(Slope|Normal|Contour)|GroundRepel|(Set|Remove)VehicleFlags|SitOnLink|(AvatarOn)?(Link)?SitTarget|Script(Danger|Profiler)|Dialog|VolumeDetect|ResetOtherScript|RemoteLoadScriptPin|(Open|Close)RemoteDataChannel|SendRemoteData|RemoteDataReply|(Integer|String)ToBase64|XorBase64|Log(10)?|Base64To(String|Integer)|ParseStringKeepNulls|RezAtRoot|RequestSimulatorData|ForceMouselook|(Load|Release|(E|Une)scape)URL|ParcelMedia(CommandList|Query)|ModPow|MapDestination|(RemoveFrom|AddTo|Reset)Land(Pass|Ban)List|(Set|Clear)CameraParams|HTTP(Request|Response)|TextBox|DetectedTouch(UV|Face|Pos|(N|Bin)ormal|ST)|(MD5|SHA1|DumpList2)String|Request(Secure)?URL|Clear(Prim|Link)Media|(Link)?ParticleSystem|(Get|Request)(Username|DisplayName)|RegionSayTo|CastRay|GenerateKey|TransferLindenDollars|ManageEstateAccess|(Create|Delete)Character|ExecCharacterCmd|Evade|FleeFrom|NavigateTo|PatrolPoints|Pursue|UpdateCharacter|WanderWithin))\\b'
    +    };
    +
    +    return {
    +        name: 'LSL (Linden Scripting Language)',
    +        illegal: ':',
    +        contains: [
    +            LSL_STRINGS,
    +            {
    +                className: 'comment',
    +                variants: [
    +                    hljs.COMMENT('//', '$'),
    +                    hljs.COMMENT('/\\*', '\\*/')
    +                ],
    +                relevance: 0
    +            },
    +            LSL_NUMBERS,
    +            {
    +                className: 'section',
    +                variants: [
    +                    {
    +                        begin: '\\b(state|default)\\b'
    +                    },
    +                    {
    +                        begin: '\\b(state_(entry|exit)|touch(_(start|end))?|(land_)?collision(_(start|end))?|timer|listen|(no_)?sensor|control|(not_)?at_(rot_)?target|money|email|experience_permissions(_denied)?|run_time_permissions|changed|attach|dataserver|moving_(start|end)|link_message|(on|object)_rez|remote_data|http_re(sponse|quest)|path_update|transaction_result)\\b'
    +                    }
    +                ]
    +            },
    +            LSL_FUNCTIONS,
    +            LSL_CONSTANTS,
    +            {
    +                className: 'type',
    +                begin: '\\b(integer|float|string|key|vector|quaternion|rotation|list)\\b'
    +            }
    +        ]
    +    };
    +}
    +
    +module.exports = lsl;
    diff --git a/node_modules/highlight.js/lib/languages/lua.js b/node_modules/highlight.js/lib/languages/lua.js
    new file mode 100644
    index 0000000..210669d
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/lua.js
    @@ -0,0 +1,82 @@
    +/*
    +Language: Lua
    +Description: Lua is a powerful, efficient, lightweight, embeddable scripting language.
    +Author: Andrew Fedorov 
    +Category: common, scripting
    +Website: https://www.lua.org
    +*/
    +
    +function lua(hljs) {
    +  const OPENING_LONG_BRACKET = '\\[=*\\[';
    +  const CLOSING_LONG_BRACKET = '\\]=*\\]';
    +  const LONG_BRACKETS = {
    +    begin: OPENING_LONG_BRACKET,
    +    end: CLOSING_LONG_BRACKET,
    +    contains: ['self']
    +  };
    +  const COMMENTS = [
    +    hljs.COMMENT('--(?!' + OPENING_LONG_BRACKET + ')', '$'),
    +    hljs.COMMENT(
    +      '--' + OPENING_LONG_BRACKET,
    +      CLOSING_LONG_BRACKET,
    +      {
    +        contains: [LONG_BRACKETS],
    +        relevance: 10
    +      }
    +    )
    +  ];
    +  return {
    +    name: 'Lua',
    +    keywords: {
    +      $pattern: hljs.UNDERSCORE_IDENT_RE,
    +      literal: "true false nil",
    +      keyword: "and break do else elseif end for goto if in local not or repeat return then until while",
    +      built_in:
    +        // Metatags and globals:
    +        '_G _ENV _VERSION __index __newindex __mode __call __metatable __tostring __len ' +
    +        '__gc __add __sub __mul __div __mod __pow __concat __unm __eq __lt __le assert ' +
    +        // Standard methods and properties:
    +        'collectgarbage dofile error getfenv getmetatable ipairs load loadfile loadstring ' +
    +        'module next pairs pcall print rawequal rawget rawset require select setfenv ' +
    +        'setmetatable tonumber tostring type unpack xpcall arg self ' +
    +        // Library methods and properties (one line per library):
    +        'coroutine resume yield status wrap create running debug getupvalue ' +
    +        'debug sethook getmetatable gethook setmetatable setlocal traceback setfenv getinfo setupvalue getlocal getregistry getfenv ' +
    +        'io lines write close flush open output type read stderr stdin input stdout popen tmpfile ' +
    +        'math log max acos huge ldexp pi cos tanh pow deg tan cosh sinh random randomseed frexp ceil floor rad abs sqrt modf asin min mod fmod log10 atan2 exp sin atan ' +
    +        'os exit setlocale date getenv difftime remove time clock tmpname rename execute package preload loadlib loaded loaders cpath config path seeall ' +
    +        'string sub upper len gfind rep find match char dump gmatch reverse byte format gsub lower ' +
    +        'table setn insert getn foreachi maxn foreach concat sort remove'
    +    },
    +    contains: COMMENTS.concat([
    +      {
    +        className: 'function',
    +        beginKeywords: 'function',
    +        end: '\\)',
    +        contains: [
    +          hljs.inherit(hljs.TITLE_MODE, {
    +            begin: '([_a-zA-Z]\\w*\\.)*([_a-zA-Z]\\w*:)?[_a-zA-Z]\\w*'
    +          }),
    +          {
    +            className: 'params',
    +            begin: '\\(',
    +            endsWithParent: true,
    +            contains: COMMENTS
    +          }
    +        ].concat(COMMENTS)
    +      },
    +      hljs.C_NUMBER_MODE,
    +      hljs.APOS_STRING_MODE,
    +      hljs.QUOTE_STRING_MODE,
    +      {
    +        className: 'string',
    +        begin: OPENING_LONG_BRACKET,
    +        end: CLOSING_LONG_BRACKET,
    +        contains: [LONG_BRACKETS],
    +        relevance: 5
    +      }
    +    ])
    +  };
    +}
    +
    +module.exports = lua;
    diff --git a/node_modules/highlight.js/lib/languages/makefile.js b/node_modules/highlight.js/lib/languages/makefile.js
    new file mode 100644
    index 0000000..d082771
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/makefile.js
    @@ -0,0 +1,91 @@
    +/*
    +Language: Makefile
    +Author: Ivan Sagalaev 
    +Contributors: Joël Porquet 
    +Website: https://www.gnu.org/software/make/manual/html_node/Introduction.html
    +Category: common
    +*/
    +
    +function makefile(hljs) {
    +  /* Variables: simple (eg $(var)) and special (eg $@) */
    +  const VARIABLE = {
    +    className: 'variable',
    +    variants: [
    +      {
    +        begin: '\\$\\(' + hljs.UNDERSCORE_IDENT_RE + '\\)',
    +        contains: [ hljs.BACKSLASH_ESCAPE ]
    +      },
    +      {
    +        begin: /\$[@% source(x)).join("");
    +  return joined;
    +}
    +
    +/*
    +Language: Markdown
    +Requires: xml.js
    +Author: John Crepezzi 
    +Website: https://daringfireball.net/projects/markdown/
    +Category: common, markup
    +*/
    +
    +function markdown(hljs) {
    +  const INLINE_HTML = {
    +    begin: /<\/?[A-Za-z_]/,
    +    end: '>',
    +    subLanguage: 'xml',
    +    relevance: 0
    +  };
    +  const HORIZONTAL_RULE = {
    +    begin: '^[-\\*]{3,}',
    +    end: '$'
    +  };
    +  const CODE = {
    +    className: 'code',
    +    variants: [
    +      // TODO: fix to allow these to work with sublanguage also
    +      {
    +        begin: '(`{3,})[^`](.|\\n)*?\\1`*[ ]*'
    +      },
    +      {
    +        begin: '(~{3,})[^~](.|\\n)*?\\1~*[ ]*'
    +      },
    +      // needed to allow markdown as a sublanguage to work
    +      {
    +        begin: '```',
    +        end: '```+[ ]*$'
    +      },
    +      {
    +        begin: '~~~',
    +        end: '~~~+[ ]*$'
    +      },
    +      {
    +        begin: '`.+?`'
    +      },
    +      {
    +        begin: '(?=^( {4}|\\t))',
    +        // use contains to gobble up multiple lines to allow the block to be whatever size
    +        // but only have a single open/close tag vs one per line
    +        contains: [
    +          {
    +            begin: '^( {4}|\\t)',
    +            end: '(\\n)$'
    +          }
    +        ],
    +        relevance: 0
    +      }
    +    ]
    +  };
    +  const LIST = {
    +    className: 'bullet',
    +    begin: '^[ \t]*([*+-]|(\\d+\\.))(?=\\s+)',
    +    end: '\\s+',
    +    excludeEnd: true
    +  };
    +  const LINK_REFERENCE = {
    +    begin: /^\[[^\n]+\]:/,
    +    returnBegin: true,
    +    contains: [
    +      {
    +        className: 'symbol',
    +        begin: /\[/,
    +        end: /\]/,
    +        excludeBegin: true,
    +        excludeEnd: true
    +      },
    +      {
    +        className: 'link',
    +        begin: /:\s*/,
    +        end: /$/,
    +        excludeBegin: true
    +      }
    +    ]
    +  };
    +  const URL_SCHEME = /[A-Za-z][A-Za-z0-9+.-]*/;
    +  const LINK = {
    +    variants: [
    +      // too much like nested array access in so many languages
    +      // to have any real relevance
    +      {
    +        begin: /\[.+?\]\[.*?\]/,
    +        relevance: 0
    +      },
    +      // popular internet URLs
    +      {
    +        begin: /\[.+?\]\(((data|javascript|mailto):|(?:http|ftp)s?:\/\/).*?\)/,
    +        relevance: 2
    +      },
    +      {
    +        begin: concat(/\[.+?\]\(/, URL_SCHEME, /:\/\/.*?\)/),
    +        relevance: 2
    +      },
    +      // relative urls
    +      {
    +        begin: /\[.+?\]\([./?&#].*?\)/,
    +        relevance: 1
    +      },
    +      // whatever else, lower relevance (might not be a link at all)
    +      {
    +        begin: /\[.+?\]\(.*?\)/,
    +        relevance: 0
    +      }
    +    ],
    +    returnBegin: true,
    +    contains: [
    +      {
    +        className: 'string',
    +        relevance: 0,
    +        begin: '\\[',
    +        end: '\\]',
    +        excludeBegin: true,
    +        returnEnd: true
    +      },
    +      {
    +        className: 'link',
    +        relevance: 0,
    +        begin: '\\]\\(',
    +        end: '\\)',
    +        excludeBegin: true,
    +        excludeEnd: true
    +      },
    +      {
    +        className: 'symbol',
    +        relevance: 0,
    +        begin: '\\]\\[',
    +        end: '\\]',
    +        excludeBegin: true,
    +        excludeEnd: true
    +      }
    +    ]
    +  };
    +  const BOLD = {
    +    className: 'strong',
    +    contains: [],
    +    variants: [
    +      {
    +        begin: /_{2}/,
    +        end: /_{2}/
    +      },
    +      {
    +        begin: /\*{2}/,
    +        end: /\*{2}/
    +      }
    +    ]
    +  };
    +  const ITALIC = {
    +    className: 'emphasis',
    +    contains: [],
    +    variants: [
    +      {
    +        begin: /\*(?!\*)/,
    +        end: /\*/
    +      },
    +      {
    +        begin: /_(?!_)/,
    +        end: /_/,
    +        relevance: 0
    +      }
    +    ]
    +  };
    +  BOLD.contains.push(ITALIC);
    +  ITALIC.contains.push(BOLD);
    +
    +  let CONTAINABLE = [
    +    INLINE_HTML,
    +    LINK
    +  ];
    +
    +  BOLD.contains = BOLD.contains.concat(CONTAINABLE);
    +  ITALIC.contains = ITALIC.contains.concat(CONTAINABLE);
    +
    +  CONTAINABLE = CONTAINABLE.concat(BOLD, ITALIC);
    +
    +  const HEADER = {
    +    className: 'section',
    +    variants: [
    +      {
    +        begin: '^#{1,6}',
    +        end: '$',
    +        contains: CONTAINABLE
    +      },
    +      {
    +        begin: '(?=^.+?\\n[=-]{2,}$)',
    +        contains: [
    +          {
    +            begin: '^[=-]*$'
    +          },
    +          {
    +            begin: '^',
    +            end: "\\n",
    +            contains: CONTAINABLE
    +          }
    +        ]
    +      }
    +    ]
    +  };
    +
    +  const BLOCKQUOTE = {
    +    className: 'quote',
    +    begin: '^>\\s+',
    +    contains: CONTAINABLE,
    +    end: '$'
    +  };
    +
    +  return {
    +    name: 'Markdown',
    +    aliases: [
    +      'md',
    +      'mkdown',
    +      'mkd'
    +    ],
    +    contains: [
    +      HEADER,
    +      INLINE_HTML,
    +      LIST,
    +      BOLD,
    +      ITALIC,
    +      BLOCKQUOTE,
    +      CODE,
    +      HORIZONTAL_RULE,
    +      LINK,
    +      LINK_REFERENCE
    +    ]
    +  };
    +}
    +
    +module.exports = markdown;
    diff --git a/node_modules/highlight.js/lib/languages/mathematica.js b/node_modules/highlight.js/lib/languages/mathematica.js
    new file mode 100644
    index 0000000..f376cb0
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/mathematica.js
    @@ -0,0 +1,6797 @@
    +const SYSTEM_SYMBOLS = [
    +  "AASTriangle",
    +  "AbelianGroup",
    +  "Abort",
    +  "AbortKernels",
    +  "AbortProtect",
    +  "AbortScheduledTask",
    +  "Above",
    +  "Abs",
    +  "AbsArg",
    +  "AbsArgPlot",
    +  "Absolute",
    +  "AbsoluteCorrelation",
    +  "AbsoluteCorrelationFunction",
    +  "AbsoluteCurrentValue",
    +  "AbsoluteDashing",
    +  "AbsoluteFileName",
    +  "AbsoluteOptions",
    +  "AbsolutePointSize",
    +  "AbsoluteThickness",
    +  "AbsoluteTime",
    +  "AbsoluteTiming",
    +  "AcceptanceThreshold",
    +  "AccountingForm",
    +  "Accumulate",
    +  "Accuracy",
    +  "AccuracyGoal",
    +  "ActionDelay",
    +  "ActionMenu",
    +  "ActionMenuBox",
    +  "ActionMenuBoxOptions",
    +  "Activate",
    +  "Active",
    +  "ActiveClassification",
    +  "ActiveClassificationObject",
    +  "ActiveItem",
    +  "ActivePrediction",
    +  "ActivePredictionObject",
    +  "ActiveStyle",
    +  "AcyclicGraphQ",
    +  "AddOnHelpPath",
    +  "AddSides",
    +  "AddTo",
    +  "AddToSearchIndex",
    +  "AddUsers",
    +  "AdjacencyGraph",
    +  "AdjacencyList",
    +  "AdjacencyMatrix",
    +  "AdjacentMeshCells",
    +  "AdjustmentBox",
    +  "AdjustmentBoxOptions",
    +  "AdjustTimeSeriesForecast",
    +  "AdministrativeDivisionData",
    +  "AffineHalfSpace",
    +  "AffineSpace",
    +  "AffineStateSpaceModel",
    +  "AffineTransform",
    +  "After",
    +  "AggregatedEntityClass",
    +  "AggregationLayer",
    +  "AircraftData",
    +  "AirportData",
    +  "AirPressureData",
    +  "AirTemperatureData",
    +  "AiryAi",
    +  "AiryAiPrime",
    +  "AiryAiZero",
    +  "AiryBi",
    +  "AiryBiPrime",
    +  "AiryBiZero",
    +  "AlgebraicIntegerQ",
    +  "AlgebraicNumber",
    +  "AlgebraicNumberDenominator",
    +  "AlgebraicNumberNorm",
    +  "AlgebraicNumberPolynomial",
    +  "AlgebraicNumberTrace",
    +  "AlgebraicRules",
    +  "AlgebraicRulesData",
    +  "Algebraics",
    +  "AlgebraicUnitQ",
    +  "Alignment",
    +  "AlignmentMarker",
    +  "AlignmentPoint",
    +  "All",
    +  "AllowAdultContent",
    +  "AllowedCloudExtraParameters",
    +  "AllowedCloudParameterExtensions",
    +  "AllowedDimensions",
    +  "AllowedFrequencyRange",
    +  "AllowedHeads",
    +  "AllowGroupClose",
    +  "AllowIncomplete",
    +  "AllowInlineCells",
    +  "AllowKernelInitialization",
    +  "AllowLooseGrammar",
    +  "AllowReverseGroupClose",
    +  "AllowScriptLevelChange",
    +  "AllowVersionUpdate",
    +  "AllTrue",
    +  "Alphabet",
    +  "AlphabeticOrder",
    +  "AlphabeticSort",
    +  "AlphaChannel",
    +  "AlternateImage",
    +  "AlternatingFactorial",
    +  "AlternatingGroup",
    +  "AlternativeHypothesis",
    +  "Alternatives",
    +  "AltitudeMethod",
    +  "AmbientLight",
    +  "AmbiguityFunction",
    +  "AmbiguityList",
    +  "Analytic",
    +  "AnatomyData",
    +  "AnatomyForm",
    +  "AnatomyPlot3D",
    +  "AnatomySkinStyle",
    +  "AnatomyStyling",
    +  "AnchoredSearch",
    +  "And",
    +  "AndersonDarlingTest",
    +  "AngerJ",
    +  "AngleBisector",
    +  "AngleBracket",
    +  "AnglePath",
    +  "AnglePath3D",
    +  "AngleVector",
    +  "AngularGauge",
    +  "Animate",
    +  "AnimationCycleOffset",
    +  "AnimationCycleRepetitions",
    +  "AnimationDirection",
    +  "AnimationDisplayTime",
    +  "AnimationRate",
    +  "AnimationRepetitions",
    +  "AnimationRunning",
    +  "AnimationRunTime",
    +  "AnimationTimeIndex",
    +  "Animator",
    +  "AnimatorBox",
    +  "AnimatorBoxOptions",
    +  "AnimatorElements",
    +  "Annotate",
    +  "Annotation",
    +  "AnnotationDelete",
    +  "AnnotationKeys",
    +  "AnnotationRules",
    +  "AnnotationValue",
    +  "Annuity",
    +  "AnnuityDue",
    +  "Annulus",
    +  "AnomalyDetection",
    +  "AnomalyDetector",
    +  "AnomalyDetectorFunction",
    +  "Anonymous",
    +  "Antialiasing",
    +  "AntihermitianMatrixQ",
    +  "Antisymmetric",
    +  "AntisymmetricMatrixQ",
    +  "Antonyms",
    +  "AnyOrder",
    +  "AnySubset",
    +  "AnyTrue",
    +  "Apart",
    +  "ApartSquareFree",
    +  "APIFunction",
    +  "Appearance",
    +  "AppearanceElements",
    +  "AppearanceRules",
    +  "AppellF1",
    +  "Append",
    +  "AppendCheck",
    +  "AppendLayer",
    +  "AppendTo",
    +  "Apply",
    +  "ApplySides",
    +  "ArcCos",
    +  "ArcCosh",
    +  "ArcCot",
    +  "ArcCoth",
    +  "ArcCsc",
    +  "ArcCsch",
    +  "ArcCurvature",
    +  "ARCHProcess",
    +  "ArcLength",
    +  "ArcSec",
    +  "ArcSech",
    +  "ArcSin",
    +  "ArcSinDistribution",
    +  "ArcSinh",
    +  "ArcTan",
    +  "ArcTanh",
    +  "Area",
    +  "Arg",
    +  "ArgMax",
    +  "ArgMin",
    +  "ArgumentCountQ",
    +  "ARIMAProcess",
    +  "ArithmeticGeometricMean",
    +  "ARMAProcess",
    +  "Around",
    +  "AroundReplace",
    +  "ARProcess",
    +  "Array",
    +  "ArrayComponents",
    +  "ArrayDepth",
    +  "ArrayFilter",
    +  "ArrayFlatten",
    +  "ArrayMesh",
    +  "ArrayPad",
    +  "ArrayPlot",
    +  "ArrayQ",
    +  "ArrayResample",
    +  "ArrayReshape",
    +  "ArrayRules",
    +  "Arrays",
    +  "Arrow",
    +  "Arrow3DBox",
    +  "ArrowBox",
    +  "Arrowheads",
    +  "ASATriangle",
    +  "Ask",
    +  "AskAppend",
    +  "AskConfirm",
    +  "AskDisplay",
    +  "AskedQ",
    +  "AskedValue",
    +  "AskFunction",
    +  "AskState",
    +  "AskTemplateDisplay",
    +  "AspectRatio",
    +  "AspectRatioFixed",
    +  "Assert",
    +  "AssociateTo",
    +  "Association",
    +  "AssociationFormat",
    +  "AssociationMap",
    +  "AssociationQ",
    +  "AssociationThread",
    +  "AssumeDeterministic",
    +  "Assuming",
    +  "Assumptions",
    +  "AstronomicalData",
    +  "Asymptotic",
    +  "AsymptoticDSolveValue",
    +  "AsymptoticEqual",
    +  "AsymptoticEquivalent",
    +  "AsymptoticGreater",
    +  "AsymptoticGreaterEqual",
    +  "AsymptoticIntegrate",
    +  "AsymptoticLess",
    +  "AsymptoticLessEqual",
    +  "AsymptoticOutputTracker",
    +  "AsymptoticProduct",
    +  "AsymptoticRSolveValue",
    +  "AsymptoticSolve",
    +  "AsymptoticSum",
    +  "Asynchronous",
    +  "AsynchronousTaskObject",
    +  "AsynchronousTasks",
    +  "Atom",
    +  "AtomCoordinates",
    +  "AtomCount",
    +  "AtomDiagramCoordinates",
    +  "AtomList",
    +  "AtomQ",
    +  "AttentionLayer",
    +  "Attributes",
    +  "Audio",
    +  "AudioAmplify",
    +  "AudioAnnotate",
    +  "AudioAnnotationLookup",
    +  "AudioBlockMap",
    +  "AudioCapture",
    +  "AudioChannelAssignment",
    +  "AudioChannelCombine",
    +  "AudioChannelMix",
    +  "AudioChannels",
    +  "AudioChannelSeparate",
    +  "AudioData",
    +  "AudioDelay",
    +  "AudioDelete",
    +  "AudioDevice",
    +  "AudioDistance",
    +  "AudioEncoding",
    +  "AudioFade",
    +  "AudioFrequencyShift",
    +  "AudioGenerator",
    +  "AudioIdentify",
    +  "AudioInputDevice",
    +  "AudioInsert",
    +  "AudioInstanceQ",
    +  "AudioIntervals",
    +  "AudioJoin",
    +  "AudioLabel",
    +  "AudioLength",
    +  "AudioLocalMeasurements",
    +  "AudioLooping",
    +  "AudioLoudness",
    +  "AudioMeasurements",
    +  "AudioNormalize",
    +  "AudioOutputDevice",
    +  "AudioOverlay",
    +  "AudioPad",
    +  "AudioPan",
    +  "AudioPartition",
    +  "AudioPause",
    +  "AudioPitchShift",
    +  "AudioPlay",
    +  "AudioPlot",
    +  "AudioQ",
    +  "AudioRecord",
    +  "AudioReplace",
    +  "AudioResample",
    +  "AudioReverb",
    +  "AudioReverse",
    +  "AudioSampleRate",
    +  "AudioSpectralMap",
    +  "AudioSpectralTransformation",
    +  "AudioSplit",
    +  "AudioStop",
    +  "AudioStream",
    +  "AudioStreams",
    +  "AudioTimeStretch",
    +  "AudioTracks",
    +  "AudioTrim",
    +  "AudioType",
    +  "AugmentedPolyhedron",
    +  "AugmentedSymmetricPolynomial",
    +  "Authenticate",
    +  "Authentication",
    +  "AuthenticationDialog",
    +  "AutoAction",
    +  "Autocomplete",
    +  "AutocompletionFunction",
    +  "AutoCopy",
    +  "AutocorrelationTest",
    +  "AutoDelete",
    +  "AutoEvaluateEvents",
    +  "AutoGeneratedPackage",
    +  "AutoIndent",
    +  "AutoIndentSpacings",
    +  "AutoItalicWords",
    +  "AutoloadPath",
    +  "AutoMatch",
    +  "Automatic",
    +  "AutomaticImageSize",
    +  "AutoMultiplicationSymbol",
    +  "AutoNumberFormatting",
    +  "AutoOpenNotebooks",
    +  "AutoOpenPalettes",
    +  "AutoQuoteCharacters",
    +  "AutoRefreshed",
    +  "AutoRemove",
    +  "AutorunSequencing",
    +  "AutoScaling",
    +  "AutoScroll",
    +  "AutoSpacing",
    +  "AutoStyleOptions",
    +  "AutoStyleWords",
    +  "AutoSubmitting",
    +  "Axes",
    +  "AxesEdge",
    +  "AxesLabel",
    +  "AxesOrigin",
    +  "AxesStyle",
    +  "AxiomaticTheory",
    +  "Axis",
    +  "BabyMonsterGroupB",
    +  "Back",
    +  "Background",
    +  "BackgroundAppearance",
    +  "BackgroundTasksSettings",
    +  "Backslash",
    +  "Backsubstitution",
    +  "Backward",
    +  "Ball",
    +  "Band",
    +  "BandpassFilter",
    +  "BandstopFilter",
    +  "BarabasiAlbertGraphDistribution",
    +  "BarChart",
    +  "BarChart3D",
    +  "BarcodeImage",
    +  "BarcodeRecognize",
    +  "BaringhausHenzeTest",
    +  "BarLegend",
    +  "BarlowProschanImportance",
    +  "BarnesG",
    +  "BarOrigin",
    +  "BarSpacing",
    +  "BartlettHannWindow",
    +  "BartlettWindow",
    +  "BaseDecode",
    +  "BaseEncode",
    +  "BaseForm",
    +  "Baseline",
    +  "BaselinePosition",
    +  "BaseStyle",
    +  "BasicRecurrentLayer",
    +  "BatchNormalizationLayer",
    +  "BatchSize",
    +  "BatesDistribution",
    +  "BattleLemarieWavelet",
    +  "BayesianMaximization",
    +  "BayesianMaximizationObject",
    +  "BayesianMinimization",
    +  "BayesianMinimizationObject",
    +  "Because",
    +  "BeckmannDistribution",
    +  "Beep",
    +  "Before",
    +  "Begin",
    +  "BeginDialogPacket",
    +  "BeginFrontEndInteractionPacket",
    +  "BeginPackage",
    +  "BellB",
    +  "BellY",
    +  "Below",
    +  "BenfordDistribution",
    +  "BeniniDistribution",
    +  "BenktanderGibratDistribution",
    +  "BenktanderWeibullDistribution",
    +  "BernoulliB",
    +  "BernoulliDistribution",
    +  "BernoulliGraphDistribution",
    +  "BernoulliProcess",
    +  "BernsteinBasis",
    +  "BesselFilterModel",
    +  "BesselI",
    +  "BesselJ",
    +  "BesselJZero",
    +  "BesselK",
    +  "BesselY",
    +  "BesselYZero",
    +  "Beta",
    +  "BetaBinomialDistribution",
    +  "BetaDistribution",
    +  "BetaNegativeBinomialDistribution",
    +  "BetaPrimeDistribution",
    +  "BetaRegularized",
    +  "Between",
    +  "BetweennessCentrality",
    +  "BeveledPolyhedron",
    +  "BezierCurve",
    +  "BezierCurve3DBox",
    +  "BezierCurve3DBoxOptions",
    +  "BezierCurveBox",
    +  "BezierCurveBoxOptions",
    +  "BezierFunction",
    +  "BilateralFilter",
    +  "Binarize",
    +  "BinaryDeserialize",
    +  "BinaryDistance",
    +  "BinaryFormat",
    +  "BinaryImageQ",
    +  "BinaryRead",
    +  "BinaryReadList",
    +  "BinarySerialize",
    +  "BinaryWrite",
    +  "BinCounts",
    +  "BinLists",
    +  "Binomial",
    +  "BinomialDistribution",
    +  "BinomialProcess",
    +  "BinormalDistribution",
    +  "BiorthogonalSplineWavelet",
    +  "BipartiteGraphQ",
    +  "BiquadraticFilterModel",
    +  "BirnbaumImportance",
    +  "BirnbaumSaundersDistribution",
    +  "BitAnd",
    +  "BitClear",
    +  "BitGet",
    +  "BitLength",
    +  "BitNot",
    +  "BitOr",
    +  "BitSet",
    +  "BitShiftLeft",
    +  "BitShiftRight",
    +  "BitXor",
    +  "BiweightLocation",
    +  "BiweightMidvariance",
    +  "Black",
    +  "BlackmanHarrisWindow",
    +  "BlackmanNuttallWindow",
    +  "BlackmanWindow",
    +  "Blank",
    +  "BlankForm",
    +  "BlankNullSequence",
    +  "BlankSequence",
    +  "Blend",
    +  "Block",
    +  "BlockchainAddressData",
    +  "BlockchainBase",
    +  "BlockchainBlockData",
    +  "BlockchainContractValue",
    +  "BlockchainData",
    +  "BlockchainGet",
    +  "BlockchainKeyEncode",
    +  "BlockchainPut",
    +  "BlockchainTokenData",
    +  "BlockchainTransaction",
    +  "BlockchainTransactionData",
    +  "BlockchainTransactionSign",
    +  "BlockchainTransactionSubmit",
    +  "BlockMap",
    +  "BlockRandom",
    +  "BlomqvistBeta",
    +  "BlomqvistBetaTest",
    +  "Blue",
    +  "Blur",
    +  "BodePlot",
    +  "BohmanWindow",
    +  "Bold",
    +  "Bond",
    +  "BondCount",
    +  "BondList",
    +  "BondQ",
    +  "Bookmarks",
    +  "Boole",
    +  "BooleanConsecutiveFunction",
    +  "BooleanConvert",
    +  "BooleanCountingFunction",
    +  "BooleanFunction",
    +  "BooleanGraph",
    +  "BooleanMaxterms",
    +  "BooleanMinimize",
    +  "BooleanMinterms",
    +  "BooleanQ",
    +  "BooleanRegion",
    +  "Booleans",
    +  "BooleanStrings",
    +  "BooleanTable",
    +  "BooleanVariables",
    +  "BorderDimensions",
    +  "BorelTannerDistribution",
    +  "Bottom",
    +  "BottomHatTransform",
    +  "BoundaryDiscretizeGraphics",
    +  "BoundaryDiscretizeRegion",
    +  "BoundaryMesh",
    +  "BoundaryMeshRegion",
    +  "BoundaryMeshRegionQ",
    +  "BoundaryStyle",
    +  "BoundedRegionQ",
    +  "BoundingRegion",
    +  "Bounds",
    +  "Box",
    +  "BoxBaselineShift",
    +  "BoxData",
    +  "BoxDimensions",
    +  "Boxed",
    +  "Boxes",
    +  "BoxForm",
    +  "BoxFormFormatTypes",
    +  "BoxFrame",
    +  "BoxID",
    +  "BoxMargins",
    +  "BoxMatrix",
    +  "BoxObject",
    +  "BoxRatios",
    +  "BoxRotation",
    +  "BoxRotationPoint",
    +  "BoxStyle",
    +  "BoxWhiskerChart",
    +  "Bra",
    +  "BracketingBar",
    +  "BraKet",
    +  "BrayCurtisDistance",
    +  "BreadthFirstScan",
    +  "Break",
    +  "BridgeData",
    +  "BrightnessEqualize",
    +  "BroadcastStationData",
    +  "Brown",
    +  "BrownForsytheTest",
    +  "BrownianBridgeProcess",
    +  "BrowserCategory",
    +  "BSplineBasis",
    +  "BSplineCurve",
    +  "BSplineCurve3DBox",
    +  "BSplineCurve3DBoxOptions",
    +  "BSplineCurveBox",
    +  "BSplineCurveBoxOptions",
    +  "BSplineFunction",
    +  "BSplineSurface",
    +  "BSplineSurface3DBox",
    +  "BSplineSurface3DBoxOptions",
    +  "BubbleChart",
    +  "BubbleChart3D",
    +  "BubbleScale",
    +  "BubbleSizes",
    +  "BuildingData",
    +  "BulletGauge",
    +  "BusinessDayQ",
    +  "ButterflyGraph",
    +  "ButterworthFilterModel",
    +  "Button",
    +  "ButtonBar",
    +  "ButtonBox",
    +  "ButtonBoxOptions",
    +  "ButtonCell",
    +  "ButtonContents",
    +  "ButtonData",
    +  "ButtonEvaluator",
    +  "ButtonExpandable",
    +  "ButtonFrame",
    +  "ButtonFunction",
    +  "ButtonMargins",
    +  "ButtonMinHeight",
    +  "ButtonNote",
    +  "ButtonNotebook",
    +  "ButtonSource",
    +  "ButtonStyle",
    +  "ButtonStyleMenuListing",
    +  "Byte",
    +  "ByteArray",
    +  "ByteArrayFormat",
    +  "ByteArrayQ",
    +  "ByteArrayToString",
    +  "ByteCount",
    +  "ByteOrdering",
    +  "C",
    +  "CachedValue",
    +  "CacheGraphics",
    +  "CachePersistence",
    +  "CalendarConvert",
    +  "CalendarData",
    +  "CalendarType",
    +  "Callout",
    +  "CalloutMarker",
    +  "CalloutStyle",
    +  "CallPacket",
    +  "CanberraDistance",
    +  "Cancel",
    +  "CancelButton",
    +  "CandlestickChart",
    +  "CanonicalGraph",
    +  "CanonicalizePolygon",
    +  "CanonicalizePolyhedron",
    +  "CanonicalName",
    +  "CanonicalWarpingCorrespondence",
    +  "CanonicalWarpingDistance",
    +  "CantorMesh",
    +  "CantorStaircase",
    +  "Cap",
    +  "CapForm",
    +  "CapitalDifferentialD",
    +  "Capitalize",
    +  "CapsuleShape",
    +  "CaptureRunning",
    +  "CardinalBSplineBasis",
    +  "CarlemanLinearize",
    +  "CarmichaelLambda",
    +  "CaseOrdering",
    +  "Cases",
    +  "CaseSensitive",
    +  "Cashflow",
    +  "Casoratian",
    +  "Catalan",
    +  "CatalanNumber",
    +  "Catch",
    +  "CategoricalDistribution",
    +  "Catenate",
    +  "CatenateLayer",
    +  "CauchyDistribution",
    +  "CauchyWindow",
    +  "CayleyGraph",
    +  "CDF",
    +  "CDFDeploy",
    +  "CDFInformation",
    +  "CDFWavelet",
    +  "Ceiling",
    +  "CelestialSystem",
    +  "Cell",
    +  "CellAutoOverwrite",
    +  "CellBaseline",
    +  "CellBoundingBox",
    +  "CellBracketOptions",
    +  "CellChangeTimes",
    +  "CellContents",
    +  "CellContext",
    +  "CellDingbat",
    +  "CellDynamicExpression",
    +  "CellEditDuplicate",
    +  "CellElementsBoundingBox",
    +  "CellElementSpacings",
    +  "CellEpilog",
    +  "CellEvaluationDuplicate",
    +  "CellEvaluationFunction",
    +  "CellEvaluationLanguage",
    +  "CellEventActions",
    +  "CellFrame",
    +  "CellFrameColor",
    +  "CellFrameLabelMargins",
    +  "CellFrameLabels",
    +  "CellFrameMargins",
    +  "CellGroup",
    +  "CellGroupData",
    +  "CellGrouping",
    +  "CellGroupingRules",
    +  "CellHorizontalScrolling",
    +  "CellID",
    +  "CellLabel",
    +  "CellLabelAutoDelete",
    +  "CellLabelMargins",
    +  "CellLabelPositioning",
    +  "CellLabelStyle",
    +  "CellLabelTemplate",
    +  "CellMargins",
    +  "CellObject",
    +  "CellOpen",
    +  "CellPrint",
    +  "CellProlog",
    +  "Cells",
    +  "CellSize",
    +  "CellStyle",
    +  "CellTags",
    +  "CellularAutomaton",
    +  "CensoredDistribution",
    +  "Censoring",
    +  "Center",
    +  "CenterArray",
    +  "CenterDot",
    +  "CentralFeature",
    +  "CentralMoment",
    +  "CentralMomentGeneratingFunction",
    +  "Cepstrogram",
    +  "CepstrogramArray",
    +  "CepstrumArray",
    +  "CForm",
    +  "ChampernowneNumber",
    +  "ChangeOptions",
    +  "ChannelBase",
    +  "ChannelBrokerAction",
    +  "ChannelDatabin",
    +  "ChannelHistoryLength",
    +  "ChannelListen",
    +  "ChannelListener",
    +  "ChannelListeners",
    +  "ChannelListenerWait",
    +  "ChannelObject",
    +  "ChannelPreSendFunction",
    +  "ChannelReceiverFunction",
    +  "ChannelSend",
    +  "ChannelSubscribers",
    +  "ChanVeseBinarize",
    +  "Character",
    +  "CharacterCounts",
    +  "CharacterEncoding",
    +  "CharacterEncodingsPath",
    +  "CharacteristicFunction",
    +  "CharacteristicPolynomial",
    +  "CharacterName",
    +  "CharacterNormalize",
    +  "CharacterRange",
    +  "Characters",
    +  "ChartBaseStyle",
    +  "ChartElementData",
    +  "ChartElementDataFunction",
    +  "ChartElementFunction",
    +  "ChartElements",
    +  "ChartLabels",
    +  "ChartLayout",
    +  "ChartLegends",
    +  "ChartStyle",
    +  "Chebyshev1FilterModel",
    +  "Chebyshev2FilterModel",
    +  "ChebyshevDistance",
    +  "ChebyshevT",
    +  "ChebyshevU",
    +  "Check",
    +  "CheckAbort",
    +  "CheckAll",
    +  "Checkbox",
    +  "CheckboxBar",
    +  "CheckboxBox",
    +  "CheckboxBoxOptions",
    +  "ChemicalData",
    +  "ChessboardDistance",
    +  "ChiDistribution",
    +  "ChineseRemainder",
    +  "ChiSquareDistribution",
    +  "ChoiceButtons",
    +  "ChoiceDialog",
    +  "CholeskyDecomposition",
    +  "Chop",
    +  "ChromaticityPlot",
    +  "ChromaticityPlot3D",
    +  "ChromaticPolynomial",
    +  "Circle",
    +  "CircleBox",
    +  "CircleDot",
    +  "CircleMinus",
    +  "CirclePlus",
    +  "CirclePoints",
    +  "CircleThrough",
    +  "CircleTimes",
    +  "CirculantGraph",
    +  "CircularOrthogonalMatrixDistribution",
    +  "CircularQuaternionMatrixDistribution",
    +  "CircularRealMatrixDistribution",
    +  "CircularSymplecticMatrixDistribution",
    +  "CircularUnitaryMatrixDistribution",
    +  "Circumsphere",
    +  "CityData",
    +  "ClassifierFunction",
    +  "ClassifierInformation",
    +  "ClassifierMeasurements",
    +  "ClassifierMeasurementsObject",
    +  "Classify",
    +  "ClassPriors",
    +  "Clear",
    +  "ClearAll",
    +  "ClearAttributes",
    +  "ClearCookies",
    +  "ClearPermissions",
    +  "ClearSystemCache",
    +  "ClebschGordan",
    +  "ClickPane",
    +  "Clip",
    +  "ClipboardNotebook",
    +  "ClipFill",
    +  "ClippingStyle",
    +  "ClipPlanes",
    +  "ClipPlanesStyle",
    +  "ClipRange",
    +  "Clock",
    +  "ClockGauge",
    +  "ClockwiseContourIntegral",
    +  "Close",
    +  "Closed",
    +  "CloseKernels",
    +  "ClosenessCentrality",
    +  "Closing",
    +  "ClosingAutoSave",
    +  "ClosingEvent",
    +  "ClosingSaveDialog",
    +  "CloudAccountData",
    +  "CloudBase",
    +  "CloudConnect",
    +  "CloudConnections",
    +  "CloudDeploy",
    +  "CloudDirectory",
    +  "CloudDisconnect",
    +  "CloudEvaluate",
    +  "CloudExport",
    +  "CloudExpression",
    +  "CloudExpressions",
    +  "CloudFunction",
    +  "CloudGet",
    +  "CloudImport",
    +  "CloudLoggingData",
    +  "CloudObject",
    +  "CloudObjectInformation",
    +  "CloudObjectInformationData",
    +  "CloudObjectNameFormat",
    +  "CloudObjects",
    +  "CloudObjectURLType",
    +  "CloudPublish",
    +  "CloudPut",
    +  "CloudRenderingMethod",
    +  "CloudSave",
    +  "CloudShare",
    +  "CloudSubmit",
    +  "CloudSymbol",
    +  "CloudUnshare",
    +  "CloudUserID",
    +  "ClusterClassify",
    +  "ClusterDissimilarityFunction",
    +  "ClusteringComponents",
    +  "ClusteringTree",
    +  "CMYKColor",
    +  "Coarse",
    +  "CodeAssistOptions",
    +  "Coefficient",
    +  "CoefficientArrays",
    +  "CoefficientDomain",
    +  "CoefficientList",
    +  "CoefficientRules",
    +  "CoifletWavelet",
    +  "Collect",
    +  "Colon",
    +  "ColonForm",
    +  "ColorBalance",
    +  "ColorCombine",
    +  "ColorConvert",
    +  "ColorCoverage",
    +  "ColorData",
    +  "ColorDataFunction",
    +  "ColorDetect",
    +  "ColorDistance",
    +  "ColorFunction",
    +  "ColorFunctionScaling",
    +  "Colorize",
    +  "ColorNegate",
    +  "ColorOutput",
    +  "ColorProfileData",
    +  "ColorQ",
    +  "ColorQuantize",
    +  "ColorReplace",
    +  "ColorRules",
    +  "ColorSelectorSettings",
    +  "ColorSeparate",
    +  "ColorSetter",
    +  "ColorSetterBox",
    +  "ColorSetterBoxOptions",
    +  "ColorSlider",
    +  "ColorsNear",
    +  "ColorSpace",
    +  "ColorToneMapping",
    +  "Column",
    +  "ColumnAlignments",
    +  "ColumnBackgrounds",
    +  "ColumnForm",
    +  "ColumnLines",
    +  "ColumnsEqual",
    +  "ColumnSpacings",
    +  "ColumnWidths",
    +  "CombinedEntityClass",
    +  "CombinerFunction",
    +  "CometData",
    +  "CommonDefaultFormatTypes",
    +  "Commonest",
    +  "CommonestFilter",
    +  "CommonName",
    +  "CommonUnits",
    +  "CommunityBoundaryStyle",
    +  "CommunityGraphPlot",
    +  "CommunityLabels",
    +  "CommunityRegionStyle",
    +  "CompanyData",
    +  "CompatibleUnitQ",
    +  "CompilationOptions",
    +  "CompilationTarget",
    +  "Compile",
    +  "Compiled",
    +  "CompiledCodeFunction",
    +  "CompiledFunction",
    +  "CompilerOptions",
    +  "Complement",
    +  "ComplementedEntityClass",
    +  "CompleteGraph",
    +  "CompleteGraphQ",
    +  "CompleteKaryTree",
    +  "CompletionsListPacket",
    +  "Complex",
    +  "ComplexContourPlot",
    +  "Complexes",
    +  "ComplexExpand",
    +  "ComplexInfinity",
    +  "ComplexityFunction",
    +  "ComplexListPlot",
    +  "ComplexPlot",
    +  "ComplexPlot3D",
    +  "ComplexRegionPlot",
    +  "ComplexStreamPlot",
    +  "ComplexVectorPlot",
    +  "ComponentMeasurements",
    +  "ComponentwiseContextMenu",
    +  "Compose",
    +  "ComposeList",
    +  "ComposeSeries",
    +  "CompositeQ",
    +  "Composition",
    +  "CompoundElement",
    +  "CompoundExpression",
    +  "CompoundPoissonDistribution",
    +  "CompoundPoissonProcess",
    +  "CompoundRenewalProcess",
    +  "Compress",
    +  "CompressedData",
    +  "CompressionLevel",
    +  "ComputeUncertainty",
    +  "Condition",
    +  "ConditionalExpression",
    +  "Conditioned",
    +  "Cone",
    +  "ConeBox",
    +  "ConfidenceLevel",
    +  "ConfidenceRange",
    +  "ConfidenceTransform",
    +  "ConfigurationPath",
    +  "ConformAudio",
    +  "ConformImages",
    +  "Congruent",
    +  "ConicHullRegion",
    +  "ConicHullRegion3DBox",
    +  "ConicHullRegionBox",
    +  "ConicOptimization",
    +  "Conjugate",
    +  "ConjugateTranspose",
    +  "Conjunction",
    +  "Connect",
    +  "ConnectedComponents",
    +  "ConnectedGraphComponents",
    +  "ConnectedGraphQ",
    +  "ConnectedMeshComponents",
    +  "ConnectedMoleculeComponents",
    +  "ConnectedMoleculeQ",
    +  "ConnectionSettings",
    +  "ConnectLibraryCallbackFunction",
    +  "ConnectSystemModelComponents",
    +  "ConnesWindow",
    +  "ConoverTest",
    +  "ConsoleMessage",
    +  "ConsoleMessagePacket",
    +  "Constant",
    +  "ConstantArray",
    +  "ConstantArrayLayer",
    +  "ConstantImage",
    +  "ConstantPlusLayer",
    +  "ConstantRegionQ",
    +  "Constants",
    +  "ConstantTimesLayer",
    +  "ConstellationData",
    +  "ConstrainedMax",
    +  "ConstrainedMin",
    +  "Construct",
    +  "Containing",
    +  "ContainsAll",
    +  "ContainsAny",
    +  "ContainsExactly",
    +  "ContainsNone",
    +  "ContainsOnly",
    +  "ContentFieldOptions",
    +  "ContentLocationFunction",
    +  "ContentObject",
    +  "ContentPadding",
    +  "ContentsBoundingBox",
    +  "ContentSelectable",
    +  "ContentSize",
    +  "Context",
    +  "ContextMenu",
    +  "Contexts",
    +  "ContextToFileName",
    +  "Continuation",
    +  "Continue",
    +  "ContinuedFraction",
    +  "ContinuedFractionK",
    +  "ContinuousAction",
    +  "ContinuousMarkovProcess",
    +  "ContinuousTask",
    +  "ContinuousTimeModelQ",
    +  "ContinuousWaveletData",
    +  "ContinuousWaveletTransform",
    +  "ContourDetect",
    +  "ContourGraphics",
    +  "ContourIntegral",
    +  "ContourLabels",
    +  "ContourLines",
    +  "ContourPlot",
    +  "ContourPlot3D",
    +  "Contours",
    +  "ContourShading",
    +  "ContourSmoothing",
    +  "ContourStyle",
    +  "ContraharmonicMean",
    +  "ContrastiveLossLayer",
    +  "Control",
    +  "ControlActive",
    +  "ControlAlignment",
    +  "ControlGroupContentsBox",
    +  "ControllabilityGramian",
    +  "ControllabilityMatrix",
    +  "ControllableDecomposition",
    +  "ControllableModelQ",
    +  "ControllerDuration",
    +  "ControllerInformation",
    +  "ControllerInformationData",
    +  "ControllerLinking",
    +  "ControllerManipulate",
    +  "ControllerMethod",
    +  "ControllerPath",
    +  "ControllerState",
    +  "ControlPlacement",
    +  "ControlsRendering",
    +  "ControlType",
    +  "Convergents",
    +  "ConversionOptions",
    +  "ConversionRules",
    +  "ConvertToBitmapPacket",
    +  "ConvertToPostScript",
    +  "ConvertToPostScriptPacket",
    +  "ConvexHullMesh",
    +  "ConvexPolygonQ",
    +  "ConvexPolyhedronQ",
    +  "ConvolutionLayer",
    +  "Convolve",
    +  "ConwayGroupCo1",
    +  "ConwayGroupCo2",
    +  "ConwayGroupCo3",
    +  "CookieFunction",
    +  "Cookies",
    +  "CoordinateBoundingBox",
    +  "CoordinateBoundingBoxArray",
    +  "CoordinateBounds",
    +  "CoordinateBoundsArray",
    +  "CoordinateChartData",
    +  "CoordinatesToolOptions",
    +  "CoordinateTransform",
    +  "CoordinateTransformData",
    +  "CoprimeQ",
    +  "Coproduct",
    +  "CopulaDistribution",
    +  "Copyable",
    +  "CopyDatabin",
    +  "CopyDirectory",
    +  "CopyFile",
    +  "CopyTag",
    +  "CopyToClipboard",
    +  "CornerFilter",
    +  "CornerNeighbors",
    +  "Correlation",
    +  "CorrelationDistance",
    +  "CorrelationFunction",
    +  "CorrelationTest",
    +  "Cos",
    +  "Cosh",
    +  "CoshIntegral",
    +  "CosineDistance",
    +  "CosineWindow",
    +  "CosIntegral",
    +  "Cot",
    +  "Coth",
    +  "Count",
    +  "CountDistinct",
    +  "CountDistinctBy",
    +  "CounterAssignments",
    +  "CounterBox",
    +  "CounterBoxOptions",
    +  "CounterClockwiseContourIntegral",
    +  "CounterEvaluator",
    +  "CounterFunction",
    +  "CounterIncrements",
    +  "CounterStyle",
    +  "CounterStyleMenuListing",
    +  "CountRoots",
    +  "CountryData",
    +  "Counts",
    +  "CountsBy",
    +  "Covariance",
    +  "CovarianceEstimatorFunction",
    +  "CovarianceFunction",
    +  "CoxianDistribution",
    +  "CoxIngersollRossProcess",
    +  "CoxModel",
    +  "CoxModelFit",
    +  "CramerVonMisesTest",
    +  "CreateArchive",
    +  "CreateCellID",
    +  "CreateChannel",
    +  "CreateCloudExpression",
    +  "CreateDatabin",
    +  "CreateDataStructure",
    +  "CreateDataSystemModel",
    +  "CreateDialog",
    +  "CreateDirectory",
    +  "CreateDocument",
    +  "CreateFile",
    +  "CreateIntermediateDirectories",
    +  "CreateManagedLibraryExpression",
    +  "CreateNotebook",
    +  "CreatePacletArchive",
    +  "CreatePalette",
    +  "CreatePalettePacket",
    +  "CreatePermissionsGroup",
    +  "CreateScheduledTask",
    +  "CreateSearchIndex",
    +  "CreateSystemModel",
    +  "CreateTemporary",
    +  "CreateUUID",
    +  "CreateWindow",
    +  "CriterionFunction",
    +  "CriticalityFailureImportance",
    +  "CriticalitySuccessImportance",
    +  "CriticalSection",
    +  "Cross",
    +  "CrossEntropyLossLayer",
    +  "CrossingCount",
    +  "CrossingDetect",
    +  "CrossingPolygon",
    +  "CrossMatrix",
    +  "Csc",
    +  "Csch",
    +  "CTCLossLayer",
    +  "Cube",
    +  "CubeRoot",
    +  "Cubics",
    +  "Cuboid",
    +  "CuboidBox",
    +  "Cumulant",
    +  "CumulantGeneratingFunction",
    +  "Cup",
    +  "CupCap",
    +  "Curl",
    +  "CurlyDoubleQuote",
    +  "CurlyQuote",
    +  "CurrencyConvert",
    +  "CurrentDate",
    +  "CurrentImage",
    +  "CurrentlySpeakingPacket",
    +  "CurrentNotebookImage",
    +  "CurrentScreenImage",
    +  "CurrentValue",
    +  "Curry",
    +  "CurryApplied",
    +  "CurvatureFlowFilter",
    +  "CurveClosed",
    +  "Cyan",
    +  "CycleGraph",
    +  "CycleIndexPolynomial",
    +  "Cycles",
    +  "CyclicGroup",
    +  "Cyclotomic",
    +  "Cylinder",
    +  "CylinderBox",
    +  "CylindricalDecomposition",
    +  "D",
    +  "DagumDistribution",
    +  "DamData",
    +  "DamerauLevenshteinDistance",
    +  "DampingFactor",
    +  "Darker",
    +  "Dashed",
    +  "Dashing",
    +  "DatabaseConnect",
    +  "DatabaseDisconnect",
    +  "DatabaseReference",
    +  "Databin",
    +  "DatabinAdd",
    +  "DatabinRemove",
    +  "Databins",
    +  "DatabinUpload",
    +  "DataCompression",
    +  "DataDistribution",
    +  "DataRange",
    +  "DataReversed",
    +  "Dataset",
    +  "DatasetDisplayPanel",
    +  "DataStructure",
    +  "DataStructureQ",
    +  "Date",
    +  "DateBounds",
    +  "Dated",
    +  "DateDelimiters",
    +  "DateDifference",
    +  "DatedUnit",
    +  "DateFormat",
    +  "DateFunction",
    +  "DateHistogram",
    +  "DateInterval",
    +  "DateList",
    +  "DateListLogPlot",
    +  "DateListPlot",
    +  "DateListStepPlot",
    +  "DateObject",
    +  "DateObjectQ",
    +  "DateOverlapsQ",
    +  "DatePattern",
    +  "DatePlus",
    +  "DateRange",
    +  "DateReduction",
    +  "DateString",
    +  "DateTicksFormat",
    +  "DateValue",
    +  "DateWithinQ",
    +  "DaubechiesWavelet",
    +  "DavisDistribution",
    +  "DawsonF",
    +  "DayCount",
    +  "DayCountConvention",
    +  "DayHemisphere",
    +  "DaylightQ",
    +  "DayMatchQ",
    +  "DayName",
    +  "DayNightTerminator",
    +  "DayPlus",
    +  "DayRange",
    +  "DayRound",
    +  "DeBruijnGraph",
    +  "DeBruijnSequence",
    +  "Debug",
    +  "DebugTag",
    +  "Decapitalize",
    +  "Decimal",
    +  "DecimalForm",
    +  "DeclareKnownSymbols",
    +  "DeclarePackage",
    +  "Decompose",
    +  "DeconvolutionLayer",
    +  "Decrement",
    +  "Decrypt",
    +  "DecryptFile",
    +  "DedekindEta",
    +  "DeepSpaceProbeData",
    +  "Default",
    +  "DefaultAxesStyle",
    +  "DefaultBaseStyle",
    +  "DefaultBoxStyle",
    +  "DefaultButton",
    +  "DefaultColor",
    +  "DefaultControlPlacement",
    +  "DefaultDuplicateCellStyle",
    +  "DefaultDuration",
    +  "DefaultElement",
    +  "DefaultFaceGridsStyle",
    +  "DefaultFieldHintStyle",
    +  "DefaultFont",
    +  "DefaultFontProperties",
    +  "DefaultFormatType",
    +  "DefaultFormatTypeForStyle",
    +  "DefaultFrameStyle",
    +  "DefaultFrameTicksStyle",
    +  "DefaultGridLinesStyle",
    +  "DefaultInlineFormatType",
    +  "DefaultInputFormatType",
    +  "DefaultLabelStyle",
    +  "DefaultMenuStyle",
    +  "DefaultNaturalLanguage",
    +  "DefaultNewCellStyle",
    +  "DefaultNewInlineCellStyle",
    +  "DefaultNotebook",
    +  "DefaultOptions",
    +  "DefaultOutputFormatType",
    +  "DefaultPrintPrecision",
    +  "DefaultStyle",
    +  "DefaultStyleDefinitions",
    +  "DefaultTextFormatType",
    +  "DefaultTextInlineFormatType",
    +  "DefaultTicksStyle",
    +  "DefaultTooltipStyle",
    +  "DefaultValue",
    +  "DefaultValues",
    +  "Defer",
    +  "DefineExternal",
    +  "DefineInputStreamMethod",
    +  "DefineOutputStreamMethod",
    +  "DefineResourceFunction",
    +  "Definition",
    +  "Degree",
    +  "DegreeCentrality",
    +  "DegreeGraphDistribution",
    +  "DegreeLexicographic",
    +  "DegreeReverseLexicographic",
    +  "DEigensystem",
    +  "DEigenvalues",
    +  "Deinitialization",
    +  "Del",
    +  "DelaunayMesh",
    +  "Delayed",
    +  "Deletable",
    +  "Delete",
    +  "DeleteAnomalies",
    +  "DeleteBorderComponents",
    +  "DeleteCases",
    +  "DeleteChannel",
    +  "DeleteCloudExpression",
    +  "DeleteContents",
    +  "DeleteDirectory",
    +  "DeleteDuplicates",
    +  "DeleteDuplicatesBy",
    +  "DeleteFile",
    +  "DeleteMissing",
    +  "DeleteObject",
    +  "DeletePermissionsKey",
    +  "DeleteSearchIndex",
    +  "DeleteSmallComponents",
    +  "DeleteStopwords",
    +  "DeleteWithContents",
    +  "DeletionWarning",
    +  "DelimitedArray",
    +  "DelimitedSequence",
    +  "Delimiter",
    +  "DelimiterFlashTime",
    +  "DelimiterMatching",
    +  "Delimiters",
    +  "DeliveryFunction",
    +  "Dendrogram",
    +  "Denominator",
    +  "DensityGraphics",
    +  "DensityHistogram",
    +  "DensityPlot",
    +  "DensityPlot3D",
    +  "DependentVariables",
    +  "Deploy",
    +  "Deployed",
    +  "Depth",
    +  "DepthFirstScan",
    +  "Derivative",
    +  "DerivativeFilter",
    +  "DerivedKey",
    +  "DescriptorStateSpace",
    +  "DesignMatrix",
    +  "DestroyAfterEvaluation",
    +  "Det",
    +  "DeviceClose",
    +  "DeviceConfigure",
    +  "DeviceExecute",
    +  "DeviceExecuteAsynchronous",
    +  "DeviceObject",
    +  "DeviceOpen",
    +  "DeviceOpenQ",
    +  "DeviceRead",
    +  "DeviceReadBuffer",
    +  "DeviceReadLatest",
    +  "DeviceReadList",
    +  "DeviceReadTimeSeries",
    +  "Devices",
    +  "DeviceStreams",
    +  "DeviceWrite",
    +  "DeviceWriteBuffer",
    +  "DGaussianWavelet",
    +  "DiacriticalPositioning",
    +  "Diagonal",
    +  "DiagonalizableMatrixQ",
    +  "DiagonalMatrix",
    +  "DiagonalMatrixQ",
    +  "Dialog",
    +  "DialogIndent",
    +  "DialogInput",
    +  "DialogLevel",
    +  "DialogNotebook",
    +  "DialogProlog",
    +  "DialogReturn",
    +  "DialogSymbols",
    +  "Diamond",
    +  "DiamondMatrix",
    +  "DiceDissimilarity",
    +  "DictionaryLookup",
    +  "DictionaryWordQ",
    +  "DifferenceDelta",
    +  "DifferenceOrder",
    +  "DifferenceQuotient",
    +  "DifferenceRoot",
    +  "DifferenceRootReduce",
    +  "Differences",
    +  "DifferentialD",
    +  "DifferentialRoot",
    +  "DifferentialRootReduce",
    +  "DifferentiatorFilter",
    +  "DigitalSignature",
    +  "DigitBlock",
    +  "DigitBlockMinimum",
    +  "DigitCharacter",
    +  "DigitCount",
    +  "DigitQ",
    +  "DihedralAngle",
    +  "DihedralGroup",
    +  "Dilation",
    +  "DimensionalCombinations",
    +  "DimensionalMeshComponents",
    +  "DimensionReduce",
    +  "DimensionReducerFunction",
    +  "DimensionReduction",
    +  "Dimensions",
    +  "DiracComb",
    +  "DiracDelta",
    +  "DirectedEdge",
    +  "DirectedEdges",
    +  "DirectedGraph",
    +  "DirectedGraphQ",
    +  "DirectedInfinity",
    +  "Direction",
    +  "Directive",
    +  "Directory",
    +  "DirectoryName",
    +  "DirectoryQ",
    +  "DirectoryStack",
    +  "DirichletBeta",
    +  "DirichletCharacter",
    +  "DirichletCondition",
    +  "DirichletConvolve",
    +  "DirichletDistribution",
    +  "DirichletEta",
    +  "DirichletL",
    +  "DirichletLambda",
    +  "DirichletTransform",
    +  "DirichletWindow",
    +  "DisableConsolePrintPacket",
    +  "DisableFormatting",
    +  "DiscreteAsymptotic",
    +  "DiscreteChirpZTransform",
    +  "DiscreteConvolve",
    +  "DiscreteDelta",
    +  "DiscreteHadamardTransform",
    +  "DiscreteIndicator",
    +  "DiscreteLimit",
    +  "DiscreteLQEstimatorGains",
    +  "DiscreteLQRegulatorGains",
    +  "DiscreteLyapunovSolve",
    +  "DiscreteMarkovProcess",
    +  "DiscreteMaxLimit",
    +  "DiscreteMinLimit",
    +  "DiscretePlot",
    +  "DiscretePlot3D",
    +  "DiscreteRatio",
    +  "DiscreteRiccatiSolve",
    +  "DiscreteShift",
    +  "DiscreteTimeModelQ",
    +  "DiscreteUniformDistribution",
    +  "DiscreteVariables",
    +  "DiscreteWaveletData",
    +  "DiscreteWaveletPacketTransform",
    +  "DiscreteWaveletTransform",
    +  "DiscretizeGraphics",
    +  "DiscretizeRegion",
    +  "Discriminant",
    +  "DisjointQ",
    +  "Disjunction",
    +  "Disk",
    +  "DiskBox",
    +  "DiskMatrix",
    +  "DiskSegment",
    +  "Dispatch",
    +  "DispatchQ",
    +  "DispersionEstimatorFunction",
    +  "Display",
    +  "DisplayAllSteps",
    +  "DisplayEndPacket",
    +  "DisplayFlushImagePacket",
    +  "DisplayForm",
    +  "DisplayFunction",
    +  "DisplayPacket",
    +  "DisplayRules",
    +  "DisplaySetSizePacket",
    +  "DisplayString",
    +  "DisplayTemporary",
    +  "DisplayWith",
    +  "DisplayWithRef",
    +  "DisplayWithVariable",
    +  "DistanceFunction",
    +  "DistanceMatrix",
    +  "DistanceTransform",
    +  "Distribute",
    +  "Distributed",
    +  "DistributedContexts",
    +  "DistributeDefinitions",
    +  "DistributionChart",
    +  "DistributionDomain",
    +  "DistributionFitTest",
    +  "DistributionParameterAssumptions",
    +  "DistributionParameterQ",
    +  "Dithering",
    +  "Div",
    +  "Divergence",
    +  "Divide",
    +  "DivideBy",
    +  "Dividers",
    +  "DivideSides",
    +  "Divisible",
    +  "Divisors",
    +  "DivisorSigma",
    +  "DivisorSum",
    +  "DMSList",
    +  "DMSString",
    +  "Do",
    +  "DockedCells",
    +  "DocumentGenerator",
    +  "DocumentGeneratorInformation",
    +  "DocumentGeneratorInformationData",
    +  "DocumentGenerators",
    +  "DocumentNotebook",
    +  "DocumentWeightingRules",
    +  "Dodecahedron",
    +  "DomainRegistrationInformation",
    +  "DominantColors",
    +  "DOSTextFormat",
    +  "Dot",
    +  "DotDashed",
    +  "DotEqual",
    +  "DotLayer",
    +  "DotPlusLayer",
    +  "Dotted",
    +  "DoubleBracketingBar",
    +  "DoubleContourIntegral",
    +  "DoubleDownArrow",
    +  "DoubleLeftArrow",
    +  "DoubleLeftRightArrow",
    +  "DoubleLeftTee",
    +  "DoubleLongLeftArrow",
    +  "DoubleLongLeftRightArrow",
    +  "DoubleLongRightArrow",
    +  "DoubleRightArrow",
    +  "DoubleRightTee",
    +  "DoubleUpArrow",
    +  "DoubleUpDownArrow",
    +  "DoubleVerticalBar",
    +  "DoublyInfinite",
    +  "Down",
    +  "DownArrow",
    +  "DownArrowBar",
    +  "DownArrowUpArrow",
    +  "DownLeftRightVector",
    +  "DownLeftTeeVector",
    +  "DownLeftVector",
    +  "DownLeftVectorBar",
    +  "DownRightTeeVector",
    +  "DownRightVector",
    +  "DownRightVectorBar",
    +  "Downsample",
    +  "DownTee",
    +  "DownTeeArrow",
    +  "DownValues",
    +  "DragAndDrop",
    +  "DrawEdges",
    +  "DrawFrontFaces",
    +  "DrawHighlighted",
    +  "Drop",
    +  "DropoutLayer",
    +  "DSolve",
    +  "DSolveValue",
    +  "Dt",
    +  "DualLinearProgramming",
    +  "DualPolyhedron",
    +  "DualSystemsModel",
    +  "DumpGet",
    +  "DumpSave",
    +  "DuplicateFreeQ",
    +  "Duration",
    +  "Dynamic",
    +  "DynamicBox",
    +  "DynamicBoxOptions",
    +  "DynamicEvaluationTimeout",
    +  "DynamicGeoGraphics",
    +  "DynamicImage",
    +  "DynamicLocation",
    +  "DynamicModule",
    +  "DynamicModuleBox",
    +  "DynamicModuleBoxOptions",
    +  "DynamicModuleParent",
    +  "DynamicModuleValues",
    +  "DynamicName",
    +  "DynamicNamespace",
    +  "DynamicReference",
    +  "DynamicSetting",
    +  "DynamicUpdating",
    +  "DynamicWrapper",
    +  "DynamicWrapperBox",
    +  "DynamicWrapperBoxOptions",
    +  "E",
    +  "EarthImpactData",
    +  "EarthquakeData",
    +  "EccentricityCentrality",
    +  "Echo",
    +  "EchoFunction",
    +  "EclipseType",
    +  "EdgeAdd",
    +  "EdgeBetweennessCentrality",
    +  "EdgeCapacity",
    +  "EdgeCapForm",
    +  "EdgeColor",
    +  "EdgeConnectivity",
    +  "EdgeContract",
    +  "EdgeCost",
    +  "EdgeCount",
    +  "EdgeCoverQ",
    +  "EdgeCycleMatrix",
    +  "EdgeDashing",
    +  "EdgeDelete",
    +  "EdgeDetect",
    +  "EdgeForm",
    +  "EdgeIndex",
    +  "EdgeJoinForm",
    +  "EdgeLabeling",
    +  "EdgeLabels",
    +  "EdgeLabelStyle",
    +  "EdgeList",
    +  "EdgeOpacity",
    +  "EdgeQ",
    +  "EdgeRenderingFunction",
    +  "EdgeRules",
    +  "EdgeShapeFunction",
    +  "EdgeStyle",
    +  "EdgeTaggedGraph",
    +  "EdgeTaggedGraphQ",
    +  "EdgeTags",
    +  "EdgeThickness",
    +  "EdgeWeight",
    +  "EdgeWeightedGraphQ",
    +  "Editable",
    +  "EditButtonSettings",
    +  "EditCellTagsSettings",
    +  "EditDistance",
    +  "EffectiveInterest",
    +  "Eigensystem",
    +  "Eigenvalues",
    +  "EigenvectorCentrality",
    +  "Eigenvectors",
    +  "Element",
    +  "ElementData",
    +  "ElementwiseLayer",
    +  "ElidedForms",
    +  "Eliminate",
    +  "EliminationOrder",
    +  "Ellipsoid",
    +  "EllipticE",
    +  "EllipticExp",
    +  "EllipticExpPrime",
    +  "EllipticF",
    +  "EllipticFilterModel",
    +  "EllipticK",
    +  "EllipticLog",
    +  "EllipticNomeQ",
    +  "EllipticPi",
    +  "EllipticReducedHalfPeriods",
    +  "EllipticTheta",
    +  "EllipticThetaPrime",
    +  "EmbedCode",
    +  "EmbeddedHTML",
    +  "EmbeddedService",
    +  "EmbeddingLayer",
    +  "EmbeddingObject",
    +  "EmitSound",
    +  "EmphasizeSyntaxErrors",
    +  "EmpiricalDistribution",
    +  "Empty",
    +  "EmptyGraphQ",
    +  "EmptyRegion",
    +  "EnableConsolePrintPacket",
    +  "Enabled",
    +  "Encode",
    +  "Encrypt",
    +  "EncryptedObject",
    +  "EncryptFile",
    +  "End",
    +  "EndAdd",
    +  "EndDialogPacket",
    +  "EndFrontEndInteractionPacket",
    +  "EndOfBuffer",
    +  "EndOfFile",
    +  "EndOfLine",
    +  "EndOfString",
    +  "EndPackage",
    +  "EngineEnvironment",
    +  "EngineeringForm",
    +  "Enter",
    +  "EnterExpressionPacket",
    +  "EnterTextPacket",
    +  "Entity",
    +  "EntityClass",
    +  "EntityClassList",
    +  "EntityCopies",
    +  "EntityFunction",
    +  "EntityGroup",
    +  "EntityInstance",
    +  "EntityList",
    +  "EntityPrefetch",
    +  "EntityProperties",
    +  "EntityProperty",
    +  "EntityPropertyClass",
    +  "EntityRegister",
    +  "EntityStore",
    +  "EntityStores",
    +  "EntityTypeName",
    +  "EntityUnregister",
    +  "EntityValue",
    +  "Entropy",
    +  "EntropyFilter",
    +  "Environment",
    +  "Epilog",
    +  "EpilogFunction",
    +  "Equal",
    +  "EqualColumns",
    +  "EqualRows",
    +  "EqualTilde",
    +  "EqualTo",
    +  "EquatedTo",
    +  "Equilibrium",
    +  "EquirippleFilterKernel",
    +  "Equivalent",
    +  "Erf",
    +  "Erfc",
    +  "Erfi",
    +  "ErlangB",
    +  "ErlangC",
    +  "ErlangDistribution",
    +  "Erosion",
    +  "ErrorBox",
    +  "ErrorBoxOptions",
    +  "ErrorNorm",
    +  "ErrorPacket",
    +  "ErrorsDialogSettings",
    +  "EscapeRadius",
    +  "EstimatedBackground",
    +  "EstimatedDistribution",
    +  "EstimatedProcess",
    +  "EstimatorGains",
    +  "EstimatorRegulator",
    +  "EuclideanDistance",
    +  "EulerAngles",
    +  "EulerCharacteristic",
    +  "EulerE",
    +  "EulerGamma",
    +  "EulerianGraphQ",
    +  "EulerMatrix",
    +  "EulerPhi",
    +  "Evaluatable",
    +  "Evaluate",
    +  "Evaluated",
    +  "EvaluatePacket",
    +  "EvaluateScheduledTask",
    +  "EvaluationBox",
    +  "EvaluationCell",
    +  "EvaluationCompletionAction",
    +  "EvaluationData",
    +  "EvaluationElements",
    +  "EvaluationEnvironment",
    +  "EvaluationMode",
    +  "EvaluationMonitor",
    +  "EvaluationNotebook",
    +  "EvaluationObject",
    +  "EvaluationOrder",
    +  "Evaluator",
    +  "EvaluatorNames",
    +  "EvenQ",
    +  "EventData",
    +  "EventEvaluator",
    +  "EventHandler",
    +  "EventHandlerTag",
    +  "EventLabels",
    +  "EventSeries",
    +  "ExactBlackmanWindow",
    +  "ExactNumberQ",
    +  "ExactRootIsolation",
    +  "ExampleData",
    +  "Except",
    +  "ExcludedForms",
    +  "ExcludedLines",
    +  "ExcludedPhysicalQuantities",
    +  "ExcludePods",
    +  "Exclusions",
    +  "ExclusionsStyle",
    +  "Exists",
    +  "Exit",
    +  "ExitDialog",
    +  "ExoplanetData",
    +  "Exp",
    +  "Expand",
    +  "ExpandAll",
    +  "ExpandDenominator",
    +  "ExpandFileName",
    +  "ExpandNumerator",
    +  "Expectation",
    +  "ExpectationE",
    +  "ExpectedValue",
    +  "ExpGammaDistribution",
    +  "ExpIntegralE",
    +  "ExpIntegralEi",
    +  "ExpirationDate",
    +  "Exponent",
    +  "ExponentFunction",
    +  "ExponentialDistribution",
    +  "ExponentialFamily",
    +  "ExponentialGeneratingFunction",
    +  "ExponentialMovingAverage",
    +  "ExponentialPowerDistribution",
    +  "ExponentPosition",
    +  "ExponentStep",
    +  "Export",
    +  "ExportAutoReplacements",
    +  "ExportByteArray",
    +  "ExportForm",
    +  "ExportPacket",
    +  "ExportString",
    +  "Expression",
    +  "ExpressionCell",
    +  "ExpressionGraph",
    +  "ExpressionPacket",
    +  "ExpressionUUID",
    +  "ExpToTrig",
    +  "ExtendedEntityClass",
    +  "ExtendedGCD",
    +  "Extension",
    +  "ExtentElementFunction",
    +  "ExtentMarkers",
    +  "ExtentSize",
    +  "ExternalBundle",
    +  "ExternalCall",
    +  "ExternalDataCharacterEncoding",
    +  "ExternalEvaluate",
    +  "ExternalFunction",
    +  "ExternalFunctionName",
    +  "ExternalIdentifier",
    +  "ExternalObject",
    +  "ExternalOptions",
    +  "ExternalSessionObject",
    +  "ExternalSessions",
    +  "ExternalStorageBase",
    +  "ExternalStorageDownload",
    +  "ExternalStorageGet",
    +  "ExternalStorageObject",
    +  "ExternalStoragePut",
    +  "ExternalStorageUpload",
    +  "ExternalTypeSignature",
    +  "ExternalValue",
    +  "Extract",
    +  "ExtractArchive",
    +  "ExtractLayer",
    +  "ExtractPacletArchive",
    +  "ExtremeValueDistribution",
    +  "FaceAlign",
    +  "FaceForm",
    +  "FaceGrids",
    +  "FaceGridsStyle",
    +  "FacialFeatures",
    +  "Factor",
    +  "FactorComplete",
    +  "Factorial",
    +  "Factorial2",
    +  "FactorialMoment",
    +  "FactorialMomentGeneratingFunction",
    +  "FactorialPower",
    +  "FactorInteger",
    +  "FactorList",
    +  "FactorSquareFree",
    +  "FactorSquareFreeList",
    +  "FactorTerms",
    +  "FactorTermsList",
    +  "Fail",
    +  "Failure",
    +  "FailureAction",
    +  "FailureDistribution",
    +  "FailureQ",
    +  "False",
    +  "FareySequence",
    +  "FARIMAProcess",
    +  "FeatureDistance",
    +  "FeatureExtract",
    +  "FeatureExtraction",
    +  "FeatureExtractor",
    +  "FeatureExtractorFunction",
    +  "FeatureNames",
    +  "FeatureNearest",
    +  "FeatureSpacePlot",
    +  "FeatureSpacePlot3D",
    +  "FeatureTypes",
    +  "FEDisableConsolePrintPacket",
    +  "FeedbackLinearize",
    +  "FeedbackSector",
    +  "FeedbackSectorStyle",
    +  "FeedbackType",
    +  "FEEnableConsolePrintPacket",
    +  "FetalGrowthData",
    +  "Fibonacci",
    +  "Fibonorial",
    +  "FieldCompletionFunction",
    +  "FieldHint",
    +  "FieldHintStyle",
    +  "FieldMasked",
    +  "FieldSize",
    +  "File",
    +  "FileBaseName",
    +  "FileByteCount",
    +  "FileConvert",
    +  "FileDate",
    +  "FileExistsQ",
    +  "FileExtension",
    +  "FileFormat",
    +  "FileHandler",
    +  "FileHash",
    +  "FileInformation",
    +  "FileName",
    +  "FileNameDepth",
    +  "FileNameDialogSettings",
    +  "FileNameDrop",
    +  "FileNameForms",
    +  "FileNameJoin",
    +  "FileNames",
    +  "FileNameSetter",
    +  "FileNameSplit",
    +  "FileNameTake",
    +  "FilePrint",
    +  "FileSize",
    +  "FileSystemMap",
    +  "FileSystemScan",
    +  "FileTemplate",
    +  "FileTemplateApply",
    +  "FileType",
    +  "FilledCurve",
    +  "FilledCurveBox",
    +  "FilledCurveBoxOptions",
    +  "Filling",
    +  "FillingStyle",
    +  "FillingTransform",
    +  "FilteredEntityClass",
    +  "FilterRules",
    +  "FinancialBond",
    +  "FinancialData",
    +  "FinancialDerivative",
    +  "FinancialIndicator",
    +  "Find",
    +  "FindAnomalies",
    +  "FindArgMax",
    +  "FindArgMin",
    +  "FindChannels",
    +  "FindClique",
    +  "FindClusters",
    +  "FindCookies",
    +  "FindCurvePath",
    +  "FindCycle",
    +  "FindDevices",
    +  "FindDistribution",
    +  "FindDistributionParameters",
    +  "FindDivisions",
    +  "FindEdgeCover",
    +  "FindEdgeCut",
    +  "FindEdgeIndependentPaths",
    +  "FindEquationalProof",
    +  "FindEulerianCycle",
    +  "FindExternalEvaluators",
    +  "FindFaces",
    +  "FindFile",
    +  "FindFit",
    +  "FindFormula",
    +  "FindFundamentalCycles",
    +  "FindGeneratingFunction",
    +  "FindGeoLocation",
    +  "FindGeometricConjectures",
    +  "FindGeometricTransform",
    +  "FindGraphCommunities",
    +  "FindGraphIsomorphism",
    +  "FindGraphPartition",
    +  "FindHamiltonianCycle",
    +  "FindHamiltonianPath",
    +  "FindHiddenMarkovStates",
    +  "FindImageText",
    +  "FindIndependentEdgeSet",
    +  "FindIndependentVertexSet",
    +  "FindInstance",
    +  "FindIntegerNullVector",
    +  "FindKClan",
    +  "FindKClique",
    +  "FindKClub",
    +  "FindKPlex",
    +  "FindLibrary",
    +  "FindLinearRecurrence",
    +  "FindList",
    +  "FindMatchingColor",
    +  "FindMaximum",
    +  "FindMaximumCut",
    +  "FindMaximumFlow",
    +  "FindMaxValue",
    +  "FindMeshDefects",
    +  "FindMinimum",
    +  "FindMinimumCostFlow",
    +  "FindMinimumCut",
    +  "FindMinValue",
    +  "FindMoleculeSubstructure",
    +  "FindPath",
    +  "FindPeaks",
    +  "FindPermutation",
    +  "FindPostmanTour",
    +  "FindProcessParameters",
    +  "FindRepeat",
    +  "FindRoot",
    +  "FindSequenceFunction",
    +  "FindSettings",
    +  "FindShortestPath",
    +  "FindShortestTour",
    +  "FindSpanningTree",
    +  "FindSystemModelEquilibrium",
    +  "FindTextualAnswer",
    +  "FindThreshold",
    +  "FindTransientRepeat",
    +  "FindVertexCover",
    +  "FindVertexCut",
    +  "FindVertexIndependentPaths",
    +  "Fine",
    +  "FinishDynamic",
    +  "FiniteAbelianGroupCount",
    +  "FiniteGroupCount",
    +  "FiniteGroupData",
    +  "First",
    +  "FirstCase",
    +  "FirstPassageTimeDistribution",
    +  "FirstPosition",
    +  "FischerGroupFi22",
    +  "FischerGroupFi23",
    +  "FischerGroupFi24Prime",
    +  "FisherHypergeometricDistribution",
    +  "FisherRatioTest",
    +  "FisherZDistribution",
    +  "Fit",
    +  "FitAll",
    +  "FitRegularization",
    +  "FittedModel",
    +  "FixedOrder",
    +  "FixedPoint",
    +  "FixedPointList",
    +  "FlashSelection",
    +  "Flat",
    +  "Flatten",
    +  "FlattenAt",
    +  "FlattenLayer",
    +  "FlatTopWindow",
    +  "FlipView",
    +  "Floor",
    +  "FlowPolynomial",
    +  "FlushPrintOutputPacket",
    +  "Fold",
    +  "FoldList",
    +  "FoldPair",
    +  "FoldPairList",
    +  "FollowRedirects",
    +  "Font",
    +  "FontColor",
    +  "FontFamily",
    +  "FontForm",
    +  "FontName",
    +  "FontOpacity",
    +  "FontPostScriptName",
    +  "FontProperties",
    +  "FontReencoding",
    +  "FontSize",
    +  "FontSlant",
    +  "FontSubstitutions",
    +  "FontTracking",
    +  "FontVariations",
    +  "FontWeight",
    +  "For",
    +  "ForAll",
    +  "ForceVersionInstall",
    +  "Format",
    +  "FormatRules",
    +  "FormatType",
    +  "FormatTypeAutoConvert",
    +  "FormatValues",
    +  "FormBox",
    +  "FormBoxOptions",
    +  "FormControl",
    +  "FormFunction",
    +  "FormLayoutFunction",
    +  "FormObject",
    +  "FormPage",
    +  "FormTheme",
    +  "FormulaData",
    +  "FormulaLookup",
    +  "FortranForm",
    +  "Forward",
    +  "ForwardBackward",
    +  "Fourier",
    +  "FourierCoefficient",
    +  "FourierCosCoefficient",
    +  "FourierCosSeries",
    +  "FourierCosTransform",
    +  "FourierDCT",
    +  "FourierDCTFilter",
    +  "FourierDCTMatrix",
    +  "FourierDST",
    +  "FourierDSTMatrix",
    +  "FourierMatrix",
    +  "FourierParameters",
    +  "FourierSequenceTransform",
    +  "FourierSeries",
    +  "FourierSinCoefficient",
    +  "FourierSinSeries",
    +  "FourierSinTransform",
    +  "FourierTransform",
    +  "FourierTrigSeries",
    +  "FractionalBrownianMotionProcess",
    +  "FractionalGaussianNoiseProcess",
    +  "FractionalPart",
    +  "FractionBox",
    +  "FractionBoxOptions",
    +  "FractionLine",
    +  "Frame",
    +  "FrameBox",
    +  "FrameBoxOptions",
    +  "Framed",
    +  "FrameInset",
    +  "FrameLabel",
    +  "Frameless",
    +  "FrameMargins",
    +  "FrameRate",
    +  "FrameStyle",
    +  "FrameTicks",
    +  "FrameTicksStyle",
    +  "FRatioDistribution",
    +  "FrechetDistribution",
    +  "FreeQ",
    +  "FrenetSerretSystem",
    +  "FrequencySamplingFilterKernel",
    +  "FresnelC",
    +  "FresnelF",
    +  "FresnelG",
    +  "FresnelS",
    +  "Friday",
    +  "FrobeniusNumber",
    +  "FrobeniusSolve",
    +  "FromAbsoluteTime",
    +  "FromCharacterCode",
    +  "FromCoefficientRules",
    +  "FromContinuedFraction",
    +  "FromDate",
    +  "FromDigits",
    +  "FromDMS",
    +  "FromEntity",
    +  "FromJulianDate",
    +  "FromLetterNumber",
    +  "FromPolarCoordinates",
    +  "FromRomanNumeral",
    +  "FromSphericalCoordinates",
    +  "FromUnixTime",
    +  "Front",
    +  "FrontEndDynamicExpression",
    +  "FrontEndEventActions",
    +  "FrontEndExecute",
    +  "FrontEndObject",
    +  "FrontEndResource",
    +  "FrontEndResourceString",
    +  "FrontEndStackSize",
    +  "FrontEndToken",
    +  "FrontEndTokenExecute",
    +  "FrontEndValueCache",
    +  "FrontEndVersion",
    +  "FrontFaceColor",
    +  "FrontFaceOpacity",
    +  "Full",
    +  "FullAxes",
    +  "FullDefinition",
    +  "FullForm",
    +  "FullGraphics",
    +  "FullInformationOutputRegulator",
    +  "FullOptions",
    +  "FullRegion",
    +  "FullSimplify",
    +  "Function",
    +  "FunctionCompile",
    +  "FunctionCompileExport",
    +  "FunctionCompileExportByteArray",
    +  "FunctionCompileExportLibrary",
    +  "FunctionCompileExportString",
    +  "FunctionDomain",
    +  "FunctionExpand",
    +  "FunctionInterpolation",
    +  "FunctionPeriod",
    +  "FunctionRange",
    +  "FunctionSpace",
    +  "FussellVeselyImportance",
    +  "GaborFilter",
    +  "GaborMatrix",
    +  "GaborWavelet",
    +  "GainMargins",
    +  "GainPhaseMargins",
    +  "GalaxyData",
    +  "GalleryView",
    +  "Gamma",
    +  "GammaDistribution",
    +  "GammaRegularized",
    +  "GapPenalty",
    +  "GARCHProcess",
    +  "GatedRecurrentLayer",
    +  "Gather",
    +  "GatherBy",
    +  "GaugeFaceElementFunction",
    +  "GaugeFaceStyle",
    +  "GaugeFrameElementFunction",
    +  "GaugeFrameSize",
    +  "GaugeFrameStyle",
    +  "GaugeLabels",
    +  "GaugeMarkers",
    +  "GaugeStyle",
    +  "GaussianFilter",
    +  "GaussianIntegers",
    +  "GaussianMatrix",
    +  "GaussianOrthogonalMatrixDistribution",
    +  "GaussianSymplecticMatrixDistribution",
    +  "GaussianUnitaryMatrixDistribution",
    +  "GaussianWindow",
    +  "GCD",
    +  "GegenbauerC",
    +  "General",
    +  "GeneralizedLinearModelFit",
    +  "GenerateAsymmetricKeyPair",
    +  "GenerateConditions",
    +  "GeneratedCell",
    +  "GeneratedDocumentBinding",
    +  "GenerateDerivedKey",
    +  "GenerateDigitalSignature",
    +  "GenerateDocument",
    +  "GeneratedParameters",
    +  "GeneratedQuantityMagnitudes",
    +  "GenerateFileSignature",
    +  "GenerateHTTPResponse",
    +  "GenerateSecuredAuthenticationKey",
    +  "GenerateSymmetricKey",
    +  "GeneratingFunction",
    +  "GeneratorDescription",
    +  "GeneratorHistoryLength",
    +  "GeneratorOutputType",
    +  "Generic",
    +  "GenericCylindricalDecomposition",
    +  "GenomeData",
    +  "GenomeLookup",
    +  "GeoAntipode",
    +  "GeoArea",
    +  "GeoArraySize",
    +  "GeoBackground",
    +  "GeoBoundingBox",
    +  "GeoBounds",
    +  "GeoBoundsRegion",
    +  "GeoBubbleChart",
    +  "GeoCenter",
    +  "GeoCircle",
    +  "GeoContourPlot",
    +  "GeoDensityPlot",
    +  "GeodesicClosing",
    +  "GeodesicDilation",
    +  "GeodesicErosion",
    +  "GeodesicOpening",
    +  "GeoDestination",
    +  "GeodesyData",
    +  "GeoDirection",
    +  "GeoDisk",
    +  "GeoDisplacement",
    +  "GeoDistance",
    +  "GeoDistanceList",
    +  "GeoElevationData",
    +  "GeoEntities",
    +  "GeoGraphics",
    +  "GeogravityModelData",
    +  "GeoGridDirectionDifference",
    +  "GeoGridLines",
    +  "GeoGridLinesStyle",
    +  "GeoGridPosition",
    +  "GeoGridRange",
    +  "GeoGridRangePadding",
    +  "GeoGridUnitArea",
    +  "GeoGridUnitDistance",
    +  "GeoGridVector",
    +  "GeoGroup",
    +  "GeoHemisphere",
    +  "GeoHemisphereBoundary",
    +  "GeoHistogram",
    +  "GeoIdentify",
    +  "GeoImage",
    +  "GeoLabels",
    +  "GeoLength",
    +  "GeoListPlot",
    +  "GeoLocation",
    +  "GeologicalPeriodData",
    +  "GeomagneticModelData",
    +  "GeoMarker",
    +  "GeometricAssertion",
    +  "GeometricBrownianMotionProcess",
    +  "GeometricDistribution",
    +  "GeometricMean",
    +  "GeometricMeanFilter",
    +  "GeometricOptimization",
    +  "GeometricScene",
    +  "GeometricTransformation",
    +  "GeometricTransformation3DBox",
    +  "GeometricTransformation3DBoxOptions",
    +  "GeometricTransformationBox",
    +  "GeometricTransformationBoxOptions",
    +  "GeoModel",
    +  "GeoNearest",
    +  "GeoPath",
    +  "GeoPosition",
    +  "GeoPositionENU",
    +  "GeoPositionXYZ",
    +  "GeoProjection",
    +  "GeoProjectionData",
    +  "GeoRange",
    +  "GeoRangePadding",
    +  "GeoRegionValuePlot",
    +  "GeoResolution",
    +  "GeoScaleBar",
    +  "GeoServer",
    +  "GeoSmoothHistogram",
    +  "GeoStreamPlot",
    +  "GeoStyling",
    +  "GeoStylingImageFunction",
    +  "GeoVariant",
    +  "GeoVector",
    +  "GeoVectorENU",
    +  "GeoVectorPlot",
    +  "GeoVectorXYZ",
    +  "GeoVisibleRegion",
    +  "GeoVisibleRegionBoundary",
    +  "GeoWithinQ",
    +  "GeoZoomLevel",
    +  "GestureHandler",
    +  "GestureHandlerTag",
    +  "Get",
    +  "GetBoundingBoxSizePacket",
    +  "GetContext",
    +  "GetEnvironment",
    +  "GetFileName",
    +  "GetFrontEndOptionsDataPacket",
    +  "GetLinebreakInformationPacket",
    +  "GetMenusPacket",
    +  "GetPageBreakInformationPacket",
    +  "Glaisher",
    +  "GlobalClusteringCoefficient",
    +  "GlobalPreferences",
    +  "GlobalSession",
    +  "Glow",
    +  "GoldenAngle",
    +  "GoldenRatio",
    +  "GompertzMakehamDistribution",
    +  "GoochShading",
    +  "GoodmanKruskalGamma",
    +  "GoodmanKruskalGammaTest",
    +  "Goto",
    +  "Grad",
    +  "Gradient",
    +  "GradientFilter",
    +  "GradientOrientationFilter",
    +  "GrammarApply",
    +  "GrammarRules",
    +  "GrammarToken",
    +  "Graph",
    +  "Graph3D",
    +  "GraphAssortativity",
    +  "GraphAutomorphismGroup",
    +  "GraphCenter",
    +  "GraphComplement",
    +  "GraphData",
    +  "GraphDensity",
    +  "GraphDiameter",
    +  "GraphDifference",
    +  "GraphDisjointUnion",
    +  "GraphDistance",
    +  "GraphDistanceMatrix",
    +  "GraphElementData",
    +  "GraphEmbedding",
    +  "GraphHighlight",
    +  "GraphHighlightStyle",
    +  "GraphHub",
    +  "Graphics",
    +  "Graphics3D",
    +  "Graphics3DBox",
    +  "Graphics3DBoxOptions",
    +  "GraphicsArray",
    +  "GraphicsBaseline",
    +  "GraphicsBox",
    +  "GraphicsBoxOptions",
    +  "GraphicsColor",
    +  "GraphicsColumn",
    +  "GraphicsComplex",
    +  "GraphicsComplex3DBox",
    +  "GraphicsComplex3DBoxOptions",
    +  "GraphicsComplexBox",
    +  "GraphicsComplexBoxOptions",
    +  "GraphicsContents",
    +  "GraphicsData",
    +  "GraphicsGrid",
    +  "GraphicsGridBox",
    +  "GraphicsGroup",
    +  "GraphicsGroup3DBox",
    +  "GraphicsGroup3DBoxOptions",
    +  "GraphicsGroupBox",
    +  "GraphicsGroupBoxOptions",
    +  "GraphicsGrouping",
    +  "GraphicsHighlightColor",
    +  "GraphicsRow",
    +  "GraphicsSpacing",
    +  "GraphicsStyle",
    +  "GraphIntersection",
    +  "GraphLayout",
    +  "GraphLinkEfficiency",
    +  "GraphPeriphery",
    +  "GraphPlot",
    +  "GraphPlot3D",
    +  "GraphPower",
    +  "GraphPropertyDistribution",
    +  "GraphQ",
    +  "GraphRadius",
    +  "GraphReciprocity",
    +  "GraphRoot",
    +  "GraphStyle",
    +  "GraphUnion",
    +  "Gray",
    +  "GrayLevel",
    +  "Greater",
    +  "GreaterEqual",
    +  "GreaterEqualLess",
    +  "GreaterEqualThan",
    +  "GreaterFullEqual",
    +  "GreaterGreater",
    +  "GreaterLess",
    +  "GreaterSlantEqual",
    +  "GreaterThan",
    +  "GreaterTilde",
    +  "Green",
    +  "GreenFunction",
    +  "Grid",
    +  "GridBaseline",
    +  "GridBox",
    +  "GridBoxAlignment",
    +  "GridBoxBackground",
    +  "GridBoxDividers",
    +  "GridBoxFrame",
    +  "GridBoxItemSize",
    +  "GridBoxItemStyle",
    +  "GridBoxOptions",
    +  "GridBoxSpacings",
    +  "GridCreationSettings",
    +  "GridDefaultElement",
    +  "GridElementStyleOptions",
    +  "GridFrame",
    +  "GridFrameMargins",
    +  "GridGraph",
    +  "GridLines",
    +  "GridLinesStyle",
    +  "GroebnerBasis",
    +  "GroupActionBase",
    +  "GroupBy",
    +  "GroupCentralizer",
    +  "GroupElementFromWord",
    +  "GroupElementPosition",
    +  "GroupElementQ",
    +  "GroupElements",
    +  "GroupElementToWord",
    +  "GroupGenerators",
    +  "Groupings",
    +  "GroupMultiplicationTable",
    +  "GroupOrbits",
    +  "GroupOrder",
    +  "GroupPageBreakWithin",
    +  "GroupSetwiseStabilizer",
    +  "GroupStabilizer",
    +  "GroupStabilizerChain",
    +  "GroupTogetherGrouping",
    +  "GroupTogetherNestedGrouping",
    +  "GrowCutComponents",
    +  "Gudermannian",
    +  "GuidedFilter",
    +  "GumbelDistribution",
    +  "HaarWavelet",
    +  "HadamardMatrix",
    +  "HalfLine",
    +  "HalfNormalDistribution",
    +  "HalfPlane",
    +  "HalfSpace",
    +  "HalftoneShading",
    +  "HamiltonianGraphQ",
    +  "HammingDistance",
    +  "HammingWindow",
    +  "HandlerFunctions",
    +  "HandlerFunctionsKeys",
    +  "HankelH1",
    +  "HankelH2",
    +  "HankelMatrix",
    +  "HankelTransform",
    +  "HannPoissonWindow",
    +  "HannWindow",
    +  "HaradaNortonGroupHN",
    +  "HararyGraph",
    +  "HarmonicMean",
    +  "HarmonicMeanFilter",
    +  "HarmonicNumber",
    +  "Hash",
    +  "HatchFilling",
    +  "HatchShading",
    +  "Haversine",
    +  "HazardFunction",
    +  "Head",
    +  "HeadCompose",
    +  "HeaderAlignment",
    +  "HeaderBackground",
    +  "HeaderDisplayFunction",
    +  "HeaderLines",
    +  "HeaderSize",
    +  "HeaderStyle",
    +  "Heads",
    +  "HeavisideLambda",
    +  "HeavisidePi",
    +  "HeavisideTheta",
    +  "HeldGroupHe",
    +  "HeldPart",
    +  "HelpBrowserLookup",
    +  "HelpBrowserNotebook",
    +  "HelpBrowserSettings",
    +  "Here",
    +  "HermiteDecomposition",
    +  "HermiteH",
    +  "HermitianMatrixQ",
    +  "HessenbergDecomposition",
    +  "Hessian",
    +  "HeunB",
    +  "HeunBPrime",
    +  "HeunC",
    +  "HeunCPrime",
    +  "HeunD",
    +  "HeunDPrime",
    +  "HeunG",
    +  "HeunGPrime",
    +  "HeunT",
    +  "HeunTPrime",
    +  "HexadecimalCharacter",
    +  "Hexahedron",
    +  "HexahedronBox",
    +  "HexahedronBoxOptions",
    +  "HiddenItems",
    +  "HiddenMarkovProcess",
    +  "HiddenSurface",
    +  "Highlighted",
    +  "HighlightGraph",
    +  "HighlightImage",
    +  "HighlightMesh",
    +  "HighpassFilter",
    +  "HigmanSimsGroupHS",
    +  "HilbertCurve",
    +  "HilbertFilter",
    +  "HilbertMatrix",
    +  "Histogram",
    +  "Histogram3D",
    +  "HistogramDistribution",
    +  "HistogramList",
    +  "HistogramTransform",
    +  "HistogramTransformInterpolation",
    +  "HistoricalPeriodData",
    +  "HitMissTransform",
    +  "HITSCentrality",
    +  "HjorthDistribution",
    +  "HodgeDual",
    +  "HoeffdingD",
    +  "HoeffdingDTest",
    +  "Hold",
    +  "HoldAll",
    +  "HoldAllComplete",
    +  "HoldComplete",
    +  "HoldFirst",
    +  "HoldForm",
    +  "HoldPattern",
    +  "HoldRest",
    +  "HolidayCalendar",
    +  "HomeDirectory",
    +  "HomePage",
    +  "Horizontal",
    +  "HorizontalForm",
    +  "HorizontalGauge",
    +  "HorizontalScrollPosition",
    +  "HornerForm",
    +  "HostLookup",
    +  "HotellingTSquareDistribution",
    +  "HoytDistribution",
    +  "HTMLSave",
    +  "HTTPErrorResponse",
    +  "HTTPRedirect",
    +  "HTTPRequest",
    +  "HTTPRequestData",
    +  "HTTPResponse",
    +  "Hue",
    +  "HumanGrowthData",
    +  "HumpDownHump",
    +  "HumpEqual",
    +  "HurwitzLerchPhi",
    +  "HurwitzZeta",
    +  "HyperbolicDistribution",
    +  "HypercubeGraph",
    +  "HyperexponentialDistribution",
    +  "Hyperfactorial",
    +  "Hypergeometric0F1",
    +  "Hypergeometric0F1Regularized",
    +  "Hypergeometric1F1",
    +  "Hypergeometric1F1Regularized",
    +  "Hypergeometric2F1",
    +  "Hypergeometric2F1Regularized",
    +  "HypergeometricDistribution",
    +  "HypergeometricPFQ",
    +  "HypergeometricPFQRegularized",
    +  "HypergeometricU",
    +  "Hyperlink",
    +  "HyperlinkAction",
    +  "HyperlinkCreationSettings",
    +  "Hyperplane",
    +  "Hyphenation",
    +  "HyphenationOptions",
    +  "HypoexponentialDistribution",
    +  "HypothesisTestData",
    +  "I",
    +  "IconData",
    +  "Iconize",
    +  "IconizedObject",
    +  "IconRules",
    +  "Icosahedron",
    +  "Identity",
    +  "IdentityMatrix",
    +  "If",
    +  "IgnoreCase",
    +  "IgnoreDiacritics",
    +  "IgnorePunctuation",
    +  "IgnoreSpellCheck",
    +  "IgnoringInactive",
    +  "Im",
    +  "Image",
    +  "Image3D",
    +  "Image3DProjection",
    +  "Image3DSlices",
    +  "ImageAccumulate",
    +  "ImageAdd",
    +  "ImageAdjust",
    +  "ImageAlign",
    +  "ImageApply",
    +  "ImageApplyIndexed",
    +  "ImageAspectRatio",
    +  "ImageAssemble",
    +  "ImageAugmentationLayer",
    +  "ImageBoundingBoxes",
    +  "ImageCache",
    +  "ImageCacheValid",
    +  "ImageCapture",
    +  "ImageCaptureFunction",
    +  "ImageCases",
    +  "ImageChannels",
    +  "ImageClip",
    +  "ImageCollage",
    +  "ImageColorSpace",
    +  "ImageCompose",
    +  "ImageContainsQ",
    +  "ImageContents",
    +  "ImageConvolve",
    +  "ImageCooccurrence",
    +  "ImageCorners",
    +  "ImageCorrelate",
    +  "ImageCorrespondingPoints",
    +  "ImageCrop",
    +  "ImageData",
    +  "ImageDeconvolve",
    +  "ImageDemosaic",
    +  "ImageDifference",
    +  "ImageDimensions",
    +  "ImageDisplacements",
    +  "ImageDistance",
    +  "ImageEffect",
    +  "ImageExposureCombine",
    +  "ImageFeatureTrack",
    +  "ImageFileApply",
    +  "ImageFileFilter",
    +  "ImageFileScan",
    +  "ImageFilter",
    +  "ImageFocusCombine",
    +  "ImageForestingComponents",
    +  "ImageFormattingWidth",
    +  "ImageForwardTransformation",
    +  "ImageGraphics",
    +  "ImageHistogram",
    +  "ImageIdentify",
    +  "ImageInstanceQ",
    +  "ImageKeypoints",
    +  "ImageLabels",
    +  "ImageLegends",
    +  "ImageLevels",
    +  "ImageLines",
    +  "ImageMargins",
    +  "ImageMarker",
    +  "ImageMarkers",
    +  "ImageMeasurements",
    +  "ImageMesh",
    +  "ImageMultiply",
    +  "ImageOffset",
    +  "ImagePad",
    +  "ImagePadding",
    +  "ImagePartition",
    +  "ImagePeriodogram",
    +  "ImagePerspectiveTransformation",
    +  "ImagePosition",
    +  "ImagePreviewFunction",
    +  "ImagePyramid",
    +  "ImagePyramidApply",
    +  "ImageQ",
    +  "ImageRangeCache",
    +  "ImageRecolor",
    +  "ImageReflect",
    +  "ImageRegion",
    +  "ImageResize",
    +  "ImageResolution",
    +  "ImageRestyle",
    +  "ImageRotate",
    +  "ImageRotated",
    +  "ImageSaliencyFilter",
    +  "ImageScaled",
    +  "ImageScan",
    +  "ImageSize",
    +  "ImageSizeAction",
    +  "ImageSizeCache",
    +  "ImageSizeMultipliers",
    +  "ImageSizeRaw",
    +  "ImageSubtract",
    +  "ImageTake",
    +  "ImageTransformation",
    +  "ImageTrim",
    +  "ImageType",
    +  "ImageValue",
    +  "ImageValuePositions",
    +  "ImagingDevice",
    +  "ImplicitRegion",
    +  "Implies",
    +  "Import",
    +  "ImportAutoReplacements",
    +  "ImportByteArray",
    +  "ImportOptions",
    +  "ImportString",
    +  "ImprovementImportance",
    +  "In",
    +  "Inactivate",
    +  "Inactive",
    +  "IncidenceGraph",
    +  "IncidenceList",
    +  "IncidenceMatrix",
    +  "IncludeAromaticBonds",
    +  "IncludeConstantBasis",
    +  "IncludeDefinitions",
    +  "IncludeDirectories",
    +  "IncludeFileExtension",
    +  "IncludeGeneratorTasks",
    +  "IncludeHydrogens",
    +  "IncludeInflections",
    +  "IncludeMetaInformation",
    +  "IncludePods",
    +  "IncludeQuantities",
    +  "IncludeRelatedTables",
    +  "IncludeSingularTerm",
    +  "IncludeWindowTimes",
    +  "Increment",
    +  "IndefiniteMatrixQ",
    +  "Indent",
    +  "IndentingNewlineSpacings",
    +  "IndentMaxFraction",
    +  "IndependenceTest",
    +  "IndependentEdgeSetQ",
    +  "IndependentPhysicalQuantity",
    +  "IndependentUnit",
    +  "IndependentUnitDimension",
    +  "IndependentVertexSetQ",
    +  "Indeterminate",
    +  "IndeterminateThreshold",
    +  "IndexCreationOptions",
    +  "Indexed",
    +  "IndexEdgeTaggedGraph",
    +  "IndexGraph",
    +  "IndexTag",
    +  "Inequality",
    +  "InexactNumberQ",
    +  "InexactNumbers",
    +  "InfiniteFuture",
    +  "InfiniteLine",
    +  "InfinitePast",
    +  "InfinitePlane",
    +  "Infinity",
    +  "Infix",
    +  "InflationAdjust",
    +  "InflationMethod",
    +  "Information",
    +  "InformationData",
    +  "InformationDataGrid",
    +  "Inherited",
    +  "InheritScope",
    +  "InhomogeneousPoissonProcess",
    +  "InitialEvaluationHistory",
    +  "Initialization",
    +  "InitializationCell",
    +  "InitializationCellEvaluation",
    +  "InitializationCellWarning",
    +  "InitializationObjects",
    +  "InitializationValue",
    +  "Initialize",
    +  "InitialSeeding",
    +  "InlineCounterAssignments",
    +  "InlineCounterIncrements",
    +  "InlineRules",
    +  "Inner",
    +  "InnerPolygon",
    +  "InnerPolyhedron",
    +  "Inpaint",
    +  "Input",
    +  "InputAliases",
    +  "InputAssumptions",
    +  "InputAutoReplacements",
    +  "InputField",
    +  "InputFieldBox",
    +  "InputFieldBoxOptions",
    +  "InputForm",
    +  "InputGrouping",
    +  "InputNamePacket",
    +  "InputNotebook",
    +  "InputPacket",
    +  "InputSettings",
    +  "InputStream",
    +  "InputString",
    +  "InputStringPacket",
    +  "InputToBoxFormPacket",
    +  "Insert",
    +  "InsertionFunction",
    +  "InsertionPointObject",
    +  "InsertLinebreaks",
    +  "InsertResults",
    +  "Inset",
    +  "Inset3DBox",
    +  "Inset3DBoxOptions",
    +  "InsetBox",
    +  "InsetBoxOptions",
    +  "Insphere",
    +  "Install",
    +  "InstallService",
    +  "InstanceNormalizationLayer",
    +  "InString",
    +  "Integer",
    +  "IntegerDigits",
    +  "IntegerExponent",
    +  "IntegerLength",
    +  "IntegerName",
    +  "IntegerPart",
    +  "IntegerPartitions",
    +  "IntegerQ",
    +  "IntegerReverse",
    +  "Integers",
    +  "IntegerString",
    +  "Integral",
    +  "Integrate",
    +  "Interactive",
    +  "InteractiveTradingChart",
    +  "Interlaced",
    +  "Interleaving",
    +  "InternallyBalancedDecomposition",
    +  "InterpolatingFunction",
    +  "InterpolatingPolynomial",
    +  "Interpolation",
    +  "InterpolationOrder",
    +  "InterpolationPoints",
    +  "InterpolationPrecision",
    +  "Interpretation",
    +  "InterpretationBox",
    +  "InterpretationBoxOptions",
    +  "InterpretationFunction",
    +  "Interpreter",
    +  "InterpretTemplate",
    +  "InterquartileRange",
    +  "Interrupt",
    +  "InterruptSettings",
    +  "IntersectedEntityClass",
    +  "IntersectingQ",
    +  "Intersection",
    +  "Interval",
    +  "IntervalIntersection",
    +  "IntervalMarkers",
    +  "IntervalMarkersStyle",
    +  "IntervalMemberQ",
    +  "IntervalSlider",
    +  "IntervalUnion",
    +  "Into",
    +  "Inverse",
    +  "InverseBetaRegularized",
    +  "InverseCDF",
    +  "InverseChiSquareDistribution",
    +  "InverseContinuousWaveletTransform",
    +  "InverseDistanceTransform",
    +  "InverseEllipticNomeQ",
    +  "InverseErf",
    +  "InverseErfc",
    +  "InverseFourier",
    +  "InverseFourierCosTransform",
    +  "InverseFourierSequenceTransform",
    +  "InverseFourierSinTransform",
    +  "InverseFourierTransform",
    +  "InverseFunction",
    +  "InverseFunctions",
    +  "InverseGammaDistribution",
    +  "InverseGammaRegularized",
    +  "InverseGaussianDistribution",
    +  "InverseGudermannian",
    +  "InverseHankelTransform",
    +  "InverseHaversine",
    +  "InverseImagePyramid",
    +  "InverseJacobiCD",
    +  "InverseJacobiCN",
    +  "InverseJacobiCS",
    +  "InverseJacobiDC",
    +  "InverseJacobiDN",
    +  "InverseJacobiDS",
    +  "InverseJacobiNC",
    +  "InverseJacobiND",
    +  "InverseJacobiNS",
    +  "InverseJacobiSC",
    +  "InverseJacobiSD",
    +  "InverseJacobiSN",
    +  "InverseLaplaceTransform",
    +  "InverseMellinTransform",
    +  "InversePermutation",
    +  "InverseRadon",
    +  "InverseRadonTransform",
    +  "InverseSeries",
    +  "InverseShortTimeFourier",
    +  "InverseSpectrogram",
    +  "InverseSurvivalFunction",
    +  "InverseTransformedRegion",
    +  "InverseWaveletTransform",
    +  "InverseWeierstrassP",
    +  "InverseWishartMatrixDistribution",
    +  "InverseZTransform",
    +  "Invisible",
    +  "InvisibleApplication",
    +  "InvisibleTimes",
    +  "IPAddress",
    +  "IrreduciblePolynomialQ",
    +  "IslandData",
    +  "IsolatingInterval",
    +  "IsomorphicGraphQ",
    +  "IsotopeData",
    +  "Italic",
    +  "Item",
    +  "ItemAspectRatio",
    +  "ItemBox",
    +  "ItemBoxOptions",
    +  "ItemDisplayFunction",
    +  "ItemSize",
    +  "ItemStyle",
    +  "ItoProcess",
    +  "JaccardDissimilarity",
    +  "JacobiAmplitude",
    +  "Jacobian",
    +  "JacobiCD",
    +  "JacobiCN",
    +  "JacobiCS",
    +  "JacobiDC",
    +  "JacobiDN",
    +  "JacobiDS",
    +  "JacobiNC",
    +  "JacobiND",
    +  "JacobiNS",
    +  "JacobiP",
    +  "JacobiSC",
    +  "JacobiSD",
    +  "JacobiSN",
    +  "JacobiSymbol",
    +  "JacobiZeta",
    +  "JankoGroupJ1",
    +  "JankoGroupJ2",
    +  "JankoGroupJ3",
    +  "JankoGroupJ4",
    +  "JarqueBeraALMTest",
    +  "JohnsonDistribution",
    +  "Join",
    +  "JoinAcross",
    +  "Joined",
    +  "JoinedCurve",
    +  "JoinedCurveBox",
    +  "JoinedCurveBoxOptions",
    +  "JoinForm",
    +  "JordanDecomposition",
    +  "JordanModelDecomposition",
    +  "JulianDate",
    +  "JuliaSetBoettcher",
    +  "JuliaSetIterationCount",
    +  "JuliaSetPlot",
    +  "JuliaSetPoints",
    +  "K",
    +  "KagiChart",
    +  "KaiserBesselWindow",
    +  "KaiserWindow",
    +  "KalmanEstimator",
    +  "KalmanFilter",
    +  "KarhunenLoeveDecomposition",
    +  "KaryTree",
    +  "KatzCentrality",
    +  "KCoreComponents",
    +  "KDistribution",
    +  "KEdgeConnectedComponents",
    +  "KEdgeConnectedGraphQ",
    +  "KeepExistingVersion",
    +  "KelvinBei",
    +  "KelvinBer",
    +  "KelvinKei",
    +  "KelvinKer",
    +  "KendallTau",
    +  "KendallTauTest",
    +  "KernelExecute",
    +  "KernelFunction",
    +  "KernelMixtureDistribution",
    +  "KernelObject",
    +  "Kernels",
    +  "Ket",
    +  "Key",
    +  "KeyCollisionFunction",
    +  "KeyComplement",
    +  "KeyDrop",
    +  "KeyDropFrom",
    +  "KeyExistsQ",
    +  "KeyFreeQ",
    +  "KeyIntersection",
    +  "KeyMap",
    +  "KeyMemberQ",
    +  "KeypointStrength",
    +  "Keys",
    +  "KeySelect",
    +  "KeySort",
    +  "KeySortBy",
    +  "KeyTake",
    +  "KeyUnion",
    +  "KeyValueMap",
    +  "KeyValuePattern",
    +  "Khinchin",
    +  "KillProcess",
    +  "KirchhoffGraph",
    +  "KirchhoffMatrix",
    +  "KleinInvariantJ",
    +  "KnapsackSolve",
    +  "KnightTourGraph",
    +  "KnotData",
    +  "KnownUnitQ",
    +  "KochCurve",
    +  "KolmogorovSmirnovTest",
    +  "KroneckerDelta",
    +  "KroneckerModelDecomposition",
    +  "KroneckerProduct",
    +  "KroneckerSymbol",
    +  "KuiperTest",
    +  "KumaraswamyDistribution",
    +  "Kurtosis",
    +  "KuwaharaFilter",
    +  "KVertexConnectedComponents",
    +  "KVertexConnectedGraphQ",
    +  "LABColor",
    +  "Label",
    +  "Labeled",
    +  "LabeledSlider",
    +  "LabelingFunction",
    +  "LabelingSize",
    +  "LabelStyle",
    +  "LabelVisibility",
    +  "LaguerreL",
    +  "LakeData",
    +  "LambdaComponents",
    +  "LambertW",
    +  "LaminaData",
    +  "LanczosWindow",
    +  "LandauDistribution",
    +  "Language",
    +  "LanguageCategory",
    +  "LanguageData",
    +  "LanguageIdentify",
    +  "LanguageOptions",
    +  "LaplaceDistribution",
    +  "LaplaceTransform",
    +  "Laplacian",
    +  "LaplacianFilter",
    +  "LaplacianGaussianFilter",
    +  "Large",
    +  "Larger",
    +  "Last",
    +  "Latitude",
    +  "LatitudeLongitude",
    +  "LatticeData",
    +  "LatticeReduce",
    +  "Launch",
    +  "LaunchKernels",
    +  "LayeredGraphPlot",
    +  "LayerSizeFunction",
    +  "LayoutInformation",
    +  "LCHColor",
    +  "LCM",
    +  "LeaderSize",
    +  "LeafCount",
    +  "LeapYearQ",
    +  "LearnDistribution",
    +  "LearnedDistribution",
    +  "LearningRate",
    +  "LearningRateMultipliers",
    +  "LeastSquares",
    +  "LeastSquaresFilterKernel",
    +  "Left",
    +  "LeftArrow",
    +  "LeftArrowBar",
    +  "LeftArrowRightArrow",
    +  "LeftDownTeeVector",
    +  "LeftDownVector",
    +  "LeftDownVectorBar",
    +  "LeftRightArrow",
    +  "LeftRightVector",
    +  "LeftTee",
    +  "LeftTeeArrow",
    +  "LeftTeeVector",
    +  "LeftTriangle",
    +  "LeftTriangleBar",
    +  "LeftTriangleEqual",
    +  "LeftUpDownVector",
    +  "LeftUpTeeVector",
    +  "LeftUpVector",
    +  "LeftUpVectorBar",
    +  "LeftVector",
    +  "LeftVectorBar",
    +  "LegendAppearance",
    +  "Legended",
    +  "LegendFunction",
    +  "LegendLabel",
    +  "LegendLayout",
    +  "LegendMargins",
    +  "LegendMarkers",
    +  "LegendMarkerSize",
    +  "LegendreP",
    +  "LegendreQ",
    +  "LegendreType",
    +  "Length",
    +  "LengthWhile",
    +  "LerchPhi",
    +  "Less",
    +  "LessEqual",
    +  "LessEqualGreater",
    +  "LessEqualThan",
    +  "LessFullEqual",
    +  "LessGreater",
    +  "LessLess",
    +  "LessSlantEqual",
    +  "LessThan",
    +  "LessTilde",
    +  "LetterCharacter",
    +  "LetterCounts",
    +  "LetterNumber",
    +  "LetterQ",
    +  "Level",
    +  "LeveneTest",
    +  "LeviCivitaTensor",
    +  "LevyDistribution",
    +  "Lexicographic",
    +  "LibraryDataType",
    +  "LibraryFunction",
    +  "LibraryFunctionError",
    +  "LibraryFunctionInformation",
    +  "LibraryFunctionLoad",
    +  "LibraryFunctionUnload",
    +  "LibraryLoad",
    +  "LibraryUnload",
    +  "LicenseID",
    +  "LiftingFilterData",
    +  "LiftingWaveletTransform",
    +  "LightBlue",
    +  "LightBrown",
    +  "LightCyan",
    +  "Lighter",
    +  "LightGray",
    +  "LightGreen",
    +  "Lighting",
    +  "LightingAngle",
    +  "LightMagenta",
    +  "LightOrange",
    +  "LightPink",
    +  "LightPurple",
    +  "LightRed",
    +  "LightSources",
    +  "LightYellow",
    +  "Likelihood",
    +  "Limit",
    +  "LimitsPositioning",
    +  "LimitsPositioningTokens",
    +  "LindleyDistribution",
    +  "Line",
    +  "Line3DBox",
    +  "Line3DBoxOptions",
    +  "LinearFilter",
    +  "LinearFractionalOptimization",
    +  "LinearFractionalTransform",
    +  "LinearGradientImage",
    +  "LinearizingTransformationData",
    +  "LinearLayer",
    +  "LinearModelFit",
    +  "LinearOffsetFunction",
    +  "LinearOptimization",
    +  "LinearProgramming",
    +  "LinearRecurrence",
    +  "LinearSolve",
    +  "LinearSolveFunction",
    +  "LineBox",
    +  "LineBoxOptions",
    +  "LineBreak",
    +  "LinebreakAdjustments",
    +  "LineBreakChart",
    +  "LinebreakSemicolonWeighting",
    +  "LineBreakWithin",
    +  "LineColor",
    +  "LineGraph",
    +  "LineIndent",
    +  "LineIndentMaxFraction",
    +  "LineIntegralConvolutionPlot",
    +  "LineIntegralConvolutionScale",
    +  "LineLegend",
    +  "LineOpacity",
    +  "LineSpacing",
    +  "LineWrapParts",
    +  "LinkActivate",
    +  "LinkClose",
    +  "LinkConnect",
    +  "LinkConnectedQ",
    +  "LinkCreate",
    +  "LinkError",
    +  "LinkFlush",
    +  "LinkFunction",
    +  "LinkHost",
    +  "LinkInterrupt",
    +  "LinkLaunch",
    +  "LinkMode",
    +  "LinkObject",
    +  "LinkOpen",
    +  "LinkOptions",
    +  "LinkPatterns",
    +  "LinkProtocol",
    +  "LinkRankCentrality",
    +  "LinkRead",
    +  "LinkReadHeld",
    +  "LinkReadyQ",
    +  "Links",
    +  "LinkService",
    +  "LinkWrite",
    +  "LinkWriteHeld",
    +  "LiouvilleLambda",
    +  "List",
    +  "Listable",
    +  "ListAnimate",
    +  "ListContourPlot",
    +  "ListContourPlot3D",
    +  "ListConvolve",
    +  "ListCorrelate",
    +  "ListCurvePathPlot",
    +  "ListDeconvolve",
    +  "ListDensityPlot",
    +  "ListDensityPlot3D",
    +  "Listen",
    +  "ListFormat",
    +  "ListFourierSequenceTransform",
    +  "ListInterpolation",
    +  "ListLineIntegralConvolutionPlot",
    +  "ListLinePlot",
    +  "ListLogLinearPlot",
    +  "ListLogLogPlot",
    +  "ListLogPlot",
    +  "ListPicker",
    +  "ListPickerBox",
    +  "ListPickerBoxBackground",
    +  "ListPickerBoxOptions",
    +  "ListPlay",
    +  "ListPlot",
    +  "ListPlot3D",
    +  "ListPointPlot3D",
    +  "ListPolarPlot",
    +  "ListQ",
    +  "ListSliceContourPlot3D",
    +  "ListSliceDensityPlot3D",
    +  "ListSliceVectorPlot3D",
    +  "ListStepPlot",
    +  "ListStreamDensityPlot",
    +  "ListStreamPlot",
    +  "ListSurfacePlot3D",
    +  "ListVectorDensityPlot",
    +  "ListVectorPlot",
    +  "ListVectorPlot3D",
    +  "ListZTransform",
    +  "Literal",
    +  "LiteralSearch",
    +  "LocalAdaptiveBinarize",
    +  "LocalCache",
    +  "LocalClusteringCoefficient",
    +  "LocalizeDefinitions",
    +  "LocalizeVariables",
    +  "LocalObject",
    +  "LocalObjects",
    +  "LocalResponseNormalizationLayer",
    +  "LocalSubmit",
    +  "LocalSymbol",
    +  "LocalTime",
    +  "LocalTimeZone",
    +  "LocationEquivalenceTest",
    +  "LocationTest",
    +  "Locator",
    +  "LocatorAutoCreate",
    +  "LocatorBox",
    +  "LocatorBoxOptions",
    +  "LocatorCentering",
    +  "LocatorPane",
    +  "LocatorPaneBox",
    +  "LocatorPaneBoxOptions",
    +  "LocatorRegion",
    +  "Locked",
    +  "Log",
    +  "Log10",
    +  "Log2",
    +  "LogBarnesG",
    +  "LogGamma",
    +  "LogGammaDistribution",
    +  "LogicalExpand",
    +  "LogIntegral",
    +  "LogisticDistribution",
    +  "LogisticSigmoid",
    +  "LogitModelFit",
    +  "LogLikelihood",
    +  "LogLinearPlot",
    +  "LogLogisticDistribution",
    +  "LogLogPlot",
    +  "LogMultinormalDistribution",
    +  "LogNormalDistribution",
    +  "LogPlot",
    +  "LogRankTest",
    +  "LogSeriesDistribution",
    +  "LongEqual",
    +  "Longest",
    +  "LongestCommonSequence",
    +  "LongestCommonSequencePositions",
    +  "LongestCommonSubsequence",
    +  "LongestCommonSubsequencePositions",
    +  "LongestMatch",
    +  "LongestOrderedSequence",
    +  "LongForm",
    +  "Longitude",
    +  "LongLeftArrow",
    +  "LongLeftRightArrow",
    +  "LongRightArrow",
    +  "LongShortTermMemoryLayer",
    +  "Lookup",
    +  "Loopback",
    +  "LoopFreeGraphQ",
    +  "Looping",
    +  "LossFunction",
    +  "LowerCaseQ",
    +  "LowerLeftArrow",
    +  "LowerRightArrow",
    +  "LowerTriangularize",
    +  "LowerTriangularMatrixQ",
    +  "LowpassFilter",
    +  "LQEstimatorGains",
    +  "LQGRegulator",
    +  "LQOutputRegulatorGains",
    +  "LQRegulatorGains",
    +  "LUBackSubstitution",
    +  "LucasL",
    +  "LuccioSamiComponents",
    +  "LUDecomposition",
    +  "LunarEclipse",
    +  "LUVColor",
    +  "LyapunovSolve",
    +  "LyonsGroupLy",
    +  "MachineID",
    +  "MachineName",
    +  "MachineNumberQ",
    +  "MachinePrecision",
    +  "MacintoshSystemPageSetup",
    +  "Magenta",
    +  "Magnification",
    +  "Magnify",
    +  "MailAddressValidation",
    +  "MailExecute",
    +  "MailFolder",
    +  "MailItem",
    +  "MailReceiverFunction",
    +  "MailResponseFunction",
    +  "MailSearch",
    +  "MailServerConnect",
    +  "MailServerConnection",
    +  "MailSettings",
    +  "MainSolve",
    +  "MaintainDynamicCaches",
    +  "Majority",
    +  "MakeBoxes",
    +  "MakeExpression",
    +  "MakeRules",
    +  "ManagedLibraryExpressionID",
    +  "ManagedLibraryExpressionQ",
    +  "MandelbrotSetBoettcher",
    +  "MandelbrotSetDistance",
    +  "MandelbrotSetIterationCount",
    +  "MandelbrotSetMemberQ",
    +  "MandelbrotSetPlot",
    +  "MangoldtLambda",
    +  "ManhattanDistance",
    +  "Manipulate",
    +  "Manipulator",
    +  "MannedSpaceMissionData",
    +  "MannWhitneyTest",
    +  "MantissaExponent",
    +  "Manual",
    +  "Map",
    +  "MapAll",
    +  "MapAt",
    +  "MapIndexed",
    +  "MAProcess",
    +  "MapThread",
    +  "MarchenkoPasturDistribution",
    +  "MarcumQ",
    +  "MardiaCombinedTest",
    +  "MardiaKurtosisTest",
    +  "MardiaSkewnessTest",
    +  "MarginalDistribution",
    +  "MarkovProcessProperties",
    +  "Masking",
    +  "MatchingDissimilarity",
    +  "MatchLocalNameQ",
    +  "MatchLocalNames",
    +  "MatchQ",
    +  "Material",
    +  "MathematicalFunctionData",
    +  "MathematicaNotation",
    +  "MathieuC",
    +  "MathieuCharacteristicA",
    +  "MathieuCharacteristicB",
    +  "MathieuCharacteristicExponent",
    +  "MathieuCPrime",
    +  "MathieuGroupM11",
    +  "MathieuGroupM12",
    +  "MathieuGroupM22",
    +  "MathieuGroupM23",
    +  "MathieuGroupM24",
    +  "MathieuS",
    +  "MathieuSPrime",
    +  "MathMLForm",
    +  "MathMLText",
    +  "Matrices",
    +  "MatrixExp",
    +  "MatrixForm",
    +  "MatrixFunction",
    +  "MatrixLog",
    +  "MatrixNormalDistribution",
    +  "MatrixPlot",
    +  "MatrixPower",
    +  "MatrixPropertyDistribution",
    +  "MatrixQ",
    +  "MatrixRank",
    +  "MatrixTDistribution",
    +  "Max",
    +  "MaxBend",
    +  "MaxCellMeasure",
    +  "MaxColorDistance",
    +  "MaxDate",
    +  "MaxDetect",
    +  "MaxDuration",
    +  "MaxExtraBandwidths",
    +  "MaxExtraConditions",
    +  "MaxFeatureDisplacement",
    +  "MaxFeatures",
    +  "MaxFilter",
    +  "MaximalBy",
    +  "Maximize",
    +  "MaxItems",
    +  "MaxIterations",
    +  "MaxLimit",
    +  "MaxMemoryUsed",
    +  "MaxMixtureKernels",
    +  "MaxOverlapFraction",
    +  "MaxPlotPoints",
    +  "MaxPoints",
    +  "MaxRecursion",
    +  "MaxStableDistribution",
    +  "MaxStepFraction",
    +  "MaxSteps",
    +  "MaxStepSize",
    +  "MaxTrainingRounds",
    +  "MaxValue",
    +  "MaxwellDistribution",
    +  "MaxWordGap",
    +  "McLaughlinGroupMcL",
    +  "Mean",
    +  "MeanAbsoluteLossLayer",
    +  "MeanAround",
    +  "MeanClusteringCoefficient",
    +  "MeanDegreeConnectivity",
    +  "MeanDeviation",
    +  "MeanFilter",
    +  "MeanGraphDistance",
    +  "MeanNeighborDegree",
    +  "MeanShift",
    +  "MeanShiftFilter",
    +  "MeanSquaredLossLayer",
    +  "Median",
    +  "MedianDeviation",
    +  "MedianFilter",
    +  "MedicalTestData",
    +  "Medium",
    +  "MeijerG",
    +  "MeijerGReduce",
    +  "MeixnerDistribution",
    +  "MellinConvolve",
    +  "MellinTransform",
    +  "MemberQ",
    +  "MemoryAvailable",
    +  "MemoryConstrained",
    +  "MemoryConstraint",
    +  "MemoryInUse",
    +  "MengerMesh",
    +  "Menu",
    +  "MenuAppearance",
    +  "MenuCommandKey",
    +  "MenuEvaluator",
    +  "MenuItem",
    +  "MenuList",
    +  "MenuPacket",
    +  "MenuSortingValue",
    +  "MenuStyle",
    +  "MenuView",
    +  "Merge",
    +  "MergeDifferences",
    +  "MergingFunction",
    +  "MersennePrimeExponent",
    +  "MersennePrimeExponentQ",
    +  "Mesh",
    +  "MeshCellCentroid",
    +  "MeshCellCount",
    +  "MeshCellHighlight",
    +  "MeshCellIndex",
    +  "MeshCellLabel",
    +  "MeshCellMarker",
    +  "MeshCellMeasure",
    +  "MeshCellQuality",
    +  "MeshCells",
    +  "MeshCellShapeFunction",
    +  "MeshCellStyle",
    +  "MeshConnectivityGraph",
    +  "MeshCoordinates",
    +  "MeshFunctions",
    +  "MeshPrimitives",
    +  "MeshQualityGoal",
    +  "MeshRange",
    +  "MeshRefinementFunction",
    +  "MeshRegion",
    +  "MeshRegionQ",
    +  "MeshShading",
    +  "MeshStyle",
    +  "Message",
    +  "MessageDialog",
    +  "MessageList",
    +  "MessageName",
    +  "MessageObject",
    +  "MessageOptions",
    +  "MessagePacket",
    +  "Messages",
    +  "MessagesNotebook",
    +  "MetaCharacters",
    +  "MetaInformation",
    +  "MeteorShowerData",
    +  "Method",
    +  "MethodOptions",
    +  "MexicanHatWavelet",
    +  "MeyerWavelet",
    +  "Midpoint",
    +  "Min",
    +  "MinColorDistance",
    +  "MinDate",
    +  "MinDetect",
    +  "MineralData",
    +  "MinFilter",
    +  "MinimalBy",
    +  "MinimalPolynomial",
    +  "MinimalStateSpaceModel",
    +  "Minimize",
    +  "MinimumTimeIncrement",
    +  "MinIntervalSize",
    +  "MinkowskiQuestionMark",
    +  "MinLimit",
    +  "MinMax",
    +  "MinorPlanetData",
    +  "Minors",
    +  "MinRecursion",
    +  "MinSize",
    +  "MinStableDistribution",
    +  "Minus",
    +  "MinusPlus",
    +  "MinValue",
    +  "Missing",
    +  "MissingBehavior",
    +  "MissingDataMethod",
    +  "MissingDataRules",
    +  "MissingQ",
    +  "MissingString",
    +  "MissingStyle",
    +  "MissingValuePattern",
    +  "MittagLefflerE",
    +  "MixedFractionParts",
    +  "MixedGraphQ",
    +  "MixedMagnitude",
    +  "MixedRadix",
    +  "MixedRadixQuantity",
    +  "MixedUnit",
    +  "MixtureDistribution",
    +  "Mod",
    +  "Modal",
    +  "Mode",
    +  "Modular",
    +  "ModularInverse",
    +  "ModularLambda",
    +  "Module",
    +  "Modulus",
    +  "MoebiusMu",
    +  "Molecule",
    +  "MoleculeContainsQ",
    +  "MoleculeEquivalentQ",
    +  "MoleculeGraph",
    +  "MoleculeModify",
    +  "MoleculePattern",
    +  "MoleculePlot",
    +  "MoleculePlot3D",
    +  "MoleculeProperty",
    +  "MoleculeQ",
    +  "MoleculeRecognize",
    +  "MoleculeValue",
    +  "Moment",
    +  "Momentary",
    +  "MomentConvert",
    +  "MomentEvaluate",
    +  "MomentGeneratingFunction",
    +  "MomentOfInertia",
    +  "Monday",
    +  "Monitor",
    +  "MonomialList",
    +  "MonomialOrder",
    +  "MonsterGroupM",
    +  "MoonPhase",
    +  "MoonPosition",
    +  "MorletWavelet",
    +  "MorphologicalBinarize",
    +  "MorphologicalBranchPoints",
    +  "MorphologicalComponents",
    +  "MorphologicalEulerNumber",
    +  "MorphologicalGraph",
    +  "MorphologicalPerimeter",
    +  "MorphologicalTransform",
    +  "MortalityData",
    +  "Most",
    +  "MountainData",
    +  "MouseAnnotation",
    +  "MouseAppearance",
    +  "MouseAppearanceTag",
    +  "MouseButtons",
    +  "Mouseover",
    +  "MousePointerNote",
    +  "MousePosition",
    +  "MovieData",
    +  "MovingAverage",
    +  "MovingMap",
    +  "MovingMedian",
    +  "MoyalDistribution",
    +  "Multicolumn",
    +  "MultiedgeStyle",
    +  "MultigraphQ",
    +  "MultilaunchWarning",
    +  "MultiLetterItalics",
    +  "MultiLetterStyle",
    +  "MultilineFunction",
    +  "Multinomial",
    +  "MultinomialDistribution",
    +  "MultinormalDistribution",
    +  "MultiplicativeOrder",
    +  "Multiplicity",
    +  "MultiplySides",
    +  "Multiselection",
    +  "MultivariateHypergeometricDistribution",
    +  "MultivariatePoissonDistribution",
    +  "MultivariateTDistribution",
    +  "N",
    +  "NakagamiDistribution",
    +  "NameQ",
    +  "Names",
    +  "NamespaceBox",
    +  "NamespaceBoxOptions",
    +  "Nand",
    +  "NArgMax",
    +  "NArgMin",
    +  "NBernoulliB",
    +  "NBodySimulation",
    +  "NBodySimulationData",
    +  "NCache",
    +  "NDEigensystem",
    +  "NDEigenvalues",
    +  "NDSolve",
    +  "NDSolveValue",
    +  "Nearest",
    +  "NearestFunction",
    +  "NearestMeshCells",
    +  "NearestNeighborGraph",
    +  "NearestTo",
    +  "NebulaData",
    +  "NeedCurrentFrontEndPackagePacket",
    +  "NeedCurrentFrontEndSymbolsPacket",
    +  "NeedlemanWunschSimilarity",
    +  "Needs",
    +  "Negative",
    +  "NegativeBinomialDistribution",
    +  "NegativeDefiniteMatrixQ",
    +  "NegativeIntegers",
    +  "NegativeMultinomialDistribution",
    +  "NegativeRationals",
    +  "NegativeReals",
    +  "NegativeSemidefiniteMatrixQ",
    +  "NeighborhoodData",
    +  "NeighborhoodGraph",
    +  "Nest",
    +  "NestedGreaterGreater",
    +  "NestedLessLess",
    +  "NestedScriptRules",
    +  "NestGraph",
    +  "NestList",
    +  "NestWhile",
    +  "NestWhileList",
    +  "NetAppend",
    +  "NetBidirectionalOperator",
    +  "NetChain",
    +  "NetDecoder",
    +  "NetDelete",
    +  "NetDrop",
    +  "NetEncoder",
    +  "NetEvaluationMode",
    +  "NetExtract",
    +  "NetFlatten",
    +  "NetFoldOperator",
    +  "NetGANOperator",
    +  "NetGraph",
    +  "NetInformation",
    +  "NetInitialize",
    +  "NetInsert",
    +  "NetInsertSharedArrays",
    +  "NetJoin",
    +  "NetMapOperator",
    +  "NetMapThreadOperator",
    +  "NetMeasurements",
    +  "NetModel",
    +  "NetNestOperator",
    +  "NetPairEmbeddingOperator",
    +  "NetPort",
    +  "NetPortGradient",
    +  "NetPrepend",
    +  "NetRename",
    +  "NetReplace",
    +  "NetReplacePart",
    +  "NetSharedArray",
    +  "NetStateObject",
    +  "NetTake",
    +  "NetTrain",
    +  "NetTrainResultsObject",
    +  "NetworkPacketCapture",
    +  "NetworkPacketRecording",
    +  "NetworkPacketRecordingDuring",
    +  "NetworkPacketTrace",
    +  "NeumannValue",
    +  "NevilleThetaC",
    +  "NevilleThetaD",
    +  "NevilleThetaN",
    +  "NevilleThetaS",
    +  "NewPrimitiveStyle",
    +  "NExpectation",
    +  "Next",
    +  "NextCell",
    +  "NextDate",
    +  "NextPrime",
    +  "NextScheduledTaskTime",
    +  "NHoldAll",
    +  "NHoldFirst",
    +  "NHoldRest",
    +  "NicholsGridLines",
    +  "NicholsPlot",
    +  "NightHemisphere",
    +  "NIntegrate",
    +  "NMaximize",
    +  "NMaxValue",
    +  "NMinimize",
    +  "NMinValue",
    +  "NominalVariables",
    +  "NonAssociative",
    +  "NoncentralBetaDistribution",
    +  "NoncentralChiSquareDistribution",
    +  "NoncentralFRatioDistribution",
    +  "NoncentralStudentTDistribution",
    +  "NonCommutativeMultiply",
    +  "NonConstants",
    +  "NondimensionalizationTransform",
    +  "None",
    +  "NoneTrue",
    +  "NonlinearModelFit",
    +  "NonlinearStateSpaceModel",
    +  "NonlocalMeansFilter",
    +  "NonNegative",
    +  "NonNegativeIntegers",
    +  "NonNegativeRationals",
    +  "NonNegativeReals",
    +  "NonPositive",
    +  "NonPositiveIntegers",
    +  "NonPositiveRationals",
    +  "NonPositiveReals",
    +  "Nor",
    +  "NorlundB",
    +  "Norm",
    +  "Normal",
    +  "NormalDistribution",
    +  "NormalGrouping",
    +  "NormalizationLayer",
    +  "Normalize",
    +  "Normalized",
    +  "NormalizedSquaredEuclideanDistance",
    +  "NormalMatrixQ",
    +  "NormalsFunction",
    +  "NormFunction",
    +  "Not",
    +  "NotCongruent",
    +  "NotCupCap",
    +  "NotDoubleVerticalBar",
    +  "Notebook",
    +  "NotebookApply",
    +  "NotebookAutoSave",
    +  "NotebookClose",
    +  "NotebookConvertSettings",
    +  "NotebookCreate",
    +  "NotebookCreateReturnObject",
    +  "NotebookDefault",
    +  "NotebookDelete",
    +  "NotebookDirectory",
    +  "NotebookDynamicExpression",
    +  "NotebookEvaluate",
    +  "NotebookEventActions",
    +  "NotebookFileName",
    +  "NotebookFind",
    +  "NotebookFindReturnObject",
    +  "NotebookGet",
    +  "NotebookGetLayoutInformationPacket",
    +  "NotebookGetMisspellingsPacket",
    +  "NotebookImport",
    +  "NotebookInformation",
    +  "NotebookInterfaceObject",
    +  "NotebookLocate",
    +  "NotebookObject",
    +  "NotebookOpen",
    +  "NotebookOpenReturnObject",
    +  "NotebookPath",
    +  "NotebookPrint",
    +  "NotebookPut",
    +  "NotebookPutReturnObject",
    +  "NotebookRead",
    +  "NotebookResetGeneratedCells",
    +  "Notebooks",
    +  "NotebookSave",
    +  "NotebookSaveAs",
    +  "NotebookSelection",
    +  "NotebookSetupLayoutInformationPacket",
    +  "NotebooksMenu",
    +  "NotebookTemplate",
    +  "NotebookWrite",
    +  "NotElement",
    +  "NotEqualTilde",
    +  "NotExists",
    +  "NotGreater",
    +  "NotGreaterEqual",
    +  "NotGreaterFullEqual",
    +  "NotGreaterGreater",
    +  "NotGreaterLess",
    +  "NotGreaterSlantEqual",
    +  "NotGreaterTilde",
    +  "Nothing",
    +  "NotHumpDownHump",
    +  "NotHumpEqual",
    +  "NotificationFunction",
    +  "NotLeftTriangle",
    +  "NotLeftTriangleBar",
    +  "NotLeftTriangleEqual",
    +  "NotLess",
    +  "NotLessEqual",
    +  "NotLessFullEqual",
    +  "NotLessGreater",
    +  "NotLessLess",
    +  "NotLessSlantEqual",
    +  "NotLessTilde",
    +  "NotNestedGreaterGreater",
    +  "NotNestedLessLess",
    +  "NotPrecedes",
    +  "NotPrecedesEqual",
    +  "NotPrecedesSlantEqual",
    +  "NotPrecedesTilde",
    +  "NotReverseElement",
    +  "NotRightTriangle",
    +  "NotRightTriangleBar",
    +  "NotRightTriangleEqual",
    +  "NotSquareSubset",
    +  "NotSquareSubsetEqual",
    +  "NotSquareSuperset",
    +  "NotSquareSupersetEqual",
    +  "NotSubset",
    +  "NotSubsetEqual",
    +  "NotSucceeds",
    +  "NotSucceedsEqual",
    +  "NotSucceedsSlantEqual",
    +  "NotSucceedsTilde",
    +  "NotSuperset",
    +  "NotSupersetEqual",
    +  "NotTilde",
    +  "NotTildeEqual",
    +  "NotTildeFullEqual",
    +  "NotTildeTilde",
    +  "NotVerticalBar",
    +  "Now",
    +  "NoWhitespace",
    +  "NProbability",
    +  "NProduct",
    +  "NProductFactors",
    +  "NRoots",
    +  "NSolve",
    +  "NSum",
    +  "NSumTerms",
    +  "NuclearExplosionData",
    +  "NuclearReactorData",
    +  "Null",
    +  "NullRecords",
    +  "NullSpace",
    +  "NullWords",
    +  "Number",
    +  "NumberCompose",
    +  "NumberDecompose",
    +  "NumberExpand",
    +  "NumberFieldClassNumber",
    +  "NumberFieldDiscriminant",
    +  "NumberFieldFundamentalUnits",
    +  "NumberFieldIntegralBasis",
    +  "NumberFieldNormRepresentatives",
    +  "NumberFieldRegulator",
    +  "NumberFieldRootsOfUnity",
    +  "NumberFieldSignature",
    +  "NumberForm",
    +  "NumberFormat",
    +  "NumberLinePlot",
    +  "NumberMarks",
    +  "NumberMultiplier",
    +  "NumberPadding",
    +  "NumberPoint",
    +  "NumberQ",
    +  "NumberSeparator",
    +  "NumberSigns",
    +  "NumberString",
    +  "Numerator",
    +  "NumeratorDenominator",
    +  "NumericalOrder",
    +  "NumericalSort",
    +  "NumericArray",
    +  "NumericArrayQ",
    +  "NumericArrayType",
    +  "NumericFunction",
    +  "NumericQ",
    +  "NuttallWindow",
    +  "NValues",
    +  "NyquistGridLines",
    +  "NyquistPlot",
    +  "O",
    +  "ObservabilityGramian",
    +  "ObservabilityMatrix",
    +  "ObservableDecomposition",
    +  "ObservableModelQ",
    +  "OceanData",
    +  "Octahedron",
    +  "OddQ",
    +  "Off",
    +  "Offset",
    +  "OLEData",
    +  "On",
    +  "ONanGroupON",
    +  "Once",
    +  "OneIdentity",
    +  "Opacity",
    +  "OpacityFunction",
    +  "OpacityFunctionScaling",
    +  "Open",
    +  "OpenAppend",
    +  "Opener",
    +  "OpenerBox",
    +  "OpenerBoxOptions",
    +  "OpenerView",
    +  "OpenFunctionInspectorPacket",
    +  "Opening",
    +  "OpenRead",
    +  "OpenSpecialOptions",
    +  "OpenTemporary",
    +  "OpenWrite",
    +  "Operate",
    +  "OperatingSystem",
    +  "OperatorApplied",
    +  "OptimumFlowData",
    +  "Optional",
    +  "OptionalElement",
    +  "OptionInspectorSettings",
    +  "OptionQ",
    +  "Options",
    +  "OptionsPacket",
    +  "OptionsPattern",
    +  "OptionValue",
    +  "OptionValueBox",
    +  "OptionValueBoxOptions",
    +  "Or",
    +  "Orange",
    +  "Order",
    +  "OrderDistribution",
    +  "OrderedQ",
    +  "Ordering",
    +  "OrderingBy",
    +  "OrderingLayer",
    +  "Orderless",
    +  "OrderlessPatternSequence",
    +  "OrnsteinUhlenbeckProcess",
    +  "Orthogonalize",
    +  "OrthogonalMatrixQ",
    +  "Out",
    +  "Outer",
    +  "OuterPolygon",
    +  "OuterPolyhedron",
    +  "OutputAutoOverwrite",
    +  "OutputControllabilityMatrix",
    +  "OutputControllableModelQ",
    +  "OutputForm",
    +  "OutputFormData",
    +  "OutputGrouping",
    +  "OutputMathEditExpression",
    +  "OutputNamePacket",
    +  "OutputResponse",
    +  "OutputSizeLimit",
    +  "OutputStream",
    +  "Over",
    +  "OverBar",
    +  "OverDot",
    +  "Overflow",
    +  "OverHat",
    +  "Overlaps",
    +  "Overlay",
    +  "OverlayBox",
    +  "OverlayBoxOptions",
    +  "Overscript",
    +  "OverscriptBox",
    +  "OverscriptBoxOptions",
    +  "OverTilde",
    +  "OverVector",
    +  "OverwriteTarget",
    +  "OwenT",
    +  "OwnValues",
    +  "Package",
    +  "PackingMethod",
    +  "PackPaclet",
    +  "PacletDataRebuild",
    +  "PacletDirectoryAdd",
    +  "PacletDirectoryLoad",
    +  "PacletDirectoryRemove",
    +  "PacletDirectoryUnload",
    +  "PacletDisable",
    +  "PacletEnable",
    +  "PacletFind",
    +  "PacletFindRemote",
    +  "PacletInformation",
    +  "PacletInstall",
    +  "PacletInstallSubmit",
    +  "PacletNewerQ",
    +  "PacletObject",
    +  "PacletObjectQ",
    +  "PacletSite",
    +  "PacletSiteObject",
    +  "PacletSiteRegister",
    +  "PacletSites",
    +  "PacletSiteUnregister",
    +  "PacletSiteUpdate",
    +  "PacletUninstall",
    +  "PacletUpdate",
    +  "PaddedForm",
    +  "Padding",
    +  "PaddingLayer",
    +  "PaddingSize",
    +  "PadeApproximant",
    +  "PadLeft",
    +  "PadRight",
    +  "PageBreakAbove",
    +  "PageBreakBelow",
    +  "PageBreakWithin",
    +  "PageFooterLines",
    +  "PageFooters",
    +  "PageHeaderLines",
    +  "PageHeaders",
    +  "PageHeight",
    +  "PageRankCentrality",
    +  "PageTheme",
    +  "PageWidth",
    +  "Pagination",
    +  "PairedBarChart",
    +  "PairedHistogram",
    +  "PairedSmoothHistogram",
    +  "PairedTTest",
    +  "PairedZTest",
    +  "PaletteNotebook",
    +  "PalettePath",
    +  "PalindromeQ",
    +  "Pane",
    +  "PaneBox",
    +  "PaneBoxOptions",
    +  "Panel",
    +  "PanelBox",
    +  "PanelBoxOptions",
    +  "Paneled",
    +  "PaneSelector",
    +  "PaneSelectorBox",
    +  "PaneSelectorBoxOptions",
    +  "PaperWidth",
    +  "ParabolicCylinderD",
    +  "ParagraphIndent",
    +  "ParagraphSpacing",
    +  "ParallelArray",
    +  "ParallelCombine",
    +  "ParallelDo",
    +  "Parallelepiped",
    +  "ParallelEvaluate",
    +  "Parallelization",
    +  "Parallelize",
    +  "ParallelMap",
    +  "ParallelNeeds",
    +  "Parallelogram",
    +  "ParallelProduct",
    +  "ParallelSubmit",
    +  "ParallelSum",
    +  "ParallelTable",
    +  "ParallelTry",
    +  "Parameter",
    +  "ParameterEstimator",
    +  "ParameterMixtureDistribution",
    +  "ParameterVariables",
    +  "ParametricFunction",
    +  "ParametricNDSolve",
    +  "ParametricNDSolveValue",
    +  "ParametricPlot",
    +  "ParametricPlot3D",
    +  "ParametricRampLayer",
    +  "ParametricRegion",
    +  "ParentBox",
    +  "ParentCell",
    +  "ParentConnect",
    +  "ParentDirectory",
    +  "ParentForm",
    +  "Parenthesize",
    +  "ParentList",
    +  "ParentNotebook",
    +  "ParetoDistribution",
    +  "ParetoPickandsDistribution",
    +  "ParkData",
    +  "Part",
    +  "PartBehavior",
    +  "PartialCorrelationFunction",
    +  "PartialD",
    +  "ParticleAcceleratorData",
    +  "ParticleData",
    +  "Partition",
    +  "PartitionGranularity",
    +  "PartitionsP",
    +  "PartitionsQ",
    +  "PartLayer",
    +  "PartOfSpeech",
    +  "PartProtection",
    +  "ParzenWindow",
    +  "PascalDistribution",
    +  "PassEventsDown",
    +  "PassEventsUp",
    +  "Paste",
    +  "PasteAutoQuoteCharacters",
    +  "PasteBoxFormInlineCells",
    +  "PasteButton",
    +  "Path",
    +  "PathGraph",
    +  "PathGraphQ",
    +  "Pattern",
    +  "PatternFilling",
    +  "PatternSequence",
    +  "PatternTest",
    +  "PauliMatrix",
    +  "PaulWavelet",
    +  "Pause",
    +  "PausedTime",
    +  "PDF",
    +  "PeakDetect",
    +  "PeanoCurve",
    +  "PearsonChiSquareTest",
    +  "PearsonCorrelationTest",
    +  "PearsonDistribution",
    +  "PercentForm",
    +  "PerfectNumber",
    +  "PerfectNumberQ",
    +  "PerformanceGoal",
    +  "Perimeter",
    +  "PeriodicBoundaryCondition",
    +  "PeriodicInterpolation",
    +  "Periodogram",
    +  "PeriodogramArray",
    +  "Permanent",
    +  "Permissions",
    +  "PermissionsGroup",
    +  "PermissionsGroupMemberQ",
    +  "PermissionsGroups",
    +  "PermissionsKey",
    +  "PermissionsKeys",
    +  "PermutationCycles",
    +  "PermutationCyclesQ",
    +  "PermutationGroup",
    +  "PermutationLength",
    +  "PermutationList",
    +  "PermutationListQ",
    +  "PermutationMax",
    +  "PermutationMin",
    +  "PermutationOrder",
    +  "PermutationPower",
    +  "PermutationProduct",
    +  "PermutationReplace",
    +  "Permutations",
    +  "PermutationSupport",
    +  "Permute",
    +  "PeronaMalikFilter",
    +  "Perpendicular",
    +  "PerpendicularBisector",
    +  "PersistenceLocation",
    +  "PersistenceTime",
    +  "PersistentObject",
    +  "PersistentObjects",
    +  "PersistentValue",
    +  "PersonData",
    +  "PERTDistribution",
    +  "PetersenGraph",
    +  "PhaseMargins",
    +  "PhaseRange",
    +  "PhysicalSystemData",
    +  "Pi",
    +  "Pick",
    +  "PIDData",
    +  "PIDDerivativeFilter",
    +  "PIDFeedforward",
    +  "PIDTune",
    +  "Piecewise",
    +  "PiecewiseExpand",
    +  "PieChart",
    +  "PieChart3D",
    +  "PillaiTrace",
    +  "PillaiTraceTest",
    +  "PingTime",
    +  "Pink",
    +  "PitchRecognize",
    +  "Pivoting",
    +  "PixelConstrained",
    +  "PixelValue",
    +  "PixelValuePositions",
    +  "Placed",
    +  "Placeholder",
    +  "PlaceholderReplace",
    +  "Plain",
    +  "PlanarAngle",
    +  "PlanarGraph",
    +  "PlanarGraphQ",
    +  "PlanckRadiationLaw",
    +  "PlaneCurveData",
    +  "PlanetaryMoonData",
    +  "PlanetData",
    +  "PlantData",
    +  "Play",
    +  "PlayRange",
    +  "Plot",
    +  "Plot3D",
    +  "Plot3Matrix",
    +  "PlotDivision",
    +  "PlotJoined",
    +  "PlotLabel",
    +  "PlotLabels",
    +  "PlotLayout",
    +  "PlotLegends",
    +  "PlotMarkers",
    +  "PlotPoints",
    +  "PlotRange",
    +  "PlotRangeClipping",
    +  "PlotRangeClipPlanesStyle",
    +  "PlotRangePadding",
    +  "PlotRegion",
    +  "PlotStyle",
    +  "PlotTheme",
    +  "Pluralize",
    +  "Plus",
    +  "PlusMinus",
    +  "Pochhammer",
    +  "PodStates",
    +  "PodWidth",
    +  "Point",
    +  "Point3DBox",
    +  "Point3DBoxOptions",
    +  "PointBox",
    +  "PointBoxOptions",
    +  "PointFigureChart",
    +  "PointLegend",
    +  "PointSize",
    +  "PoissonConsulDistribution",
    +  "PoissonDistribution",
    +  "PoissonProcess",
    +  "PoissonWindow",
    +  "PolarAxes",
    +  "PolarAxesOrigin",
    +  "PolarGridLines",
    +  "PolarPlot",
    +  "PolarTicks",
    +  "PoleZeroMarkers",
    +  "PolyaAeppliDistribution",
    +  "PolyGamma",
    +  "Polygon",
    +  "Polygon3DBox",
    +  "Polygon3DBoxOptions",
    +  "PolygonalNumber",
    +  "PolygonAngle",
    +  "PolygonBox",
    +  "PolygonBoxOptions",
    +  "PolygonCoordinates",
    +  "PolygonDecomposition",
    +  "PolygonHoleScale",
    +  "PolygonIntersections",
    +  "PolygonScale",
    +  "Polyhedron",
    +  "PolyhedronAngle",
    +  "PolyhedronCoordinates",
    +  "PolyhedronData",
    +  "PolyhedronDecomposition",
    +  "PolyhedronGenus",
    +  "PolyLog",
    +  "PolynomialExtendedGCD",
    +  "PolynomialForm",
    +  "PolynomialGCD",
    +  "PolynomialLCM",
    +  "PolynomialMod",
    +  "PolynomialQ",
    +  "PolynomialQuotient",
    +  "PolynomialQuotientRemainder",
    +  "PolynomialReduce",
    +  "PolynomialRemainder",
    +  "Polynomials",
    +  "PoolingLayer",
    +  "PopupMenu",
    +  "PopupMenuBox",
    +  "PopupMenuBoxOptions",
    +  "PopupView",
    +  "PopupWindow",
    +  "Position",
    +  "PositionIndex",
    +  "Positive",
    +  "PositiveDefiniteMatrixQ",
    +  "PositiveIntegers",
    +  "PositiveRationals",
    +  "PositiveReals",
    +  "PositiveSemidefiniteMatrixQ",
    +  "PossibleZeroQ",
    +  "Postfix",
    +  "PostScript",
    +  "Power",
    +  "PowerDistribution",
    +  "PowerExpand",
    +  "PowerMod",
    +  "PowerModList",
    +  "PowerRange",
    +  "PowerSpectralDensity",
    +  "PowersRepresentations",
    +  "PowerSymmetricPolynomial",
    +  "Precedence",
    +  "PrecedenceForm",
    +  "Precedes",
    +  "PrecedesEqual",
    +  "PrecedesSlantEqual",
    +  "PrecedesTilde",
    +  "Precision",
    +  "PrecisionGoal",
    +  "PreDecrement",
    +  "Predict",
    +  "PredictionRoot",
    +  "PredictorFunction",
    +  "PredictorInformation",
    +  "PredictorMeasurements",
    +  "PredictorMeasurementsObject",
    +  "PreemptProtect",
    +  "PreferencesPath",
    +  "Prefix",
    +  "PreIncrement",
    +  "Prepend",
    +  "PrependLayer",
    +  "PrependTo",
    +  "PreprocessingRules",
    +  "PreserveColor",
    +  "PreserveImageOptions",
    +  "Previous",
    +  "PreviousCell",
    +  "PreviousDate",
    +  "PriceGraphDistribution",
    +  "PrimaryPlaceholder",
    +  "Prime",
    +  "PrimeNu",
    +  "PrimeOmega",
    +  "PrimePi",
    +  "PrimePowerQ",
    +  "PrimeQ",
    +  "Primes",
    +  "PrimeZetaP",
    +  "PrimitivePolynomialQ",
    +  "PrimitiveRoot",
    +  "PrimitiveRootList",
    +  "PrincipalComponents",
    +  "PrincipalValue",
    +  "Print",
    +  "PrintableASCIIQ",
    +  "PrintAction",
    +  "PrintForm",
    +  "PrintingCopies",
    +  "PrintingOptions",
    +  "PrintingPageRange",
    +  "PrintingStartingPageNumber",
    +  "PrintingStyleEnvironment",
    +  "Printout3D",
    +  "Printout3DPreviewer",
    +  "PrintPrecision",
    +  "PrintTemporary",
    +  "Prism",
    +  "PrismBox",
    +  "PrismBoxOptions",
    +  "PrivateCellOptions",
    +  "PrivateEvaluationOptions",
    +  "PrivateFontOptions",
    +  "PrivateFrontEndOptions",
    +  "PrivateKey",
    +  "PrivateNotebookOptions",
    +  "PrivatePaths",
    +  "Probability",
    +  "ProbabilityDistribution",
    +  "ProbabilityPlot",
    +  "ProbabilityPr",
    +  "ProbabilityScalePlot",
    +  "ProbitModelFit",
    +  "ProcessConnection",
    +  "ProcessDirectory",
    +  "ProcessEnvironment",
    +  "Processes",
    +  "ProcessEstimator",
    +  "ProcessInformation",
    +  "ProcessObject",
    +  "ProcessParameterAssumptions",
    +  "ProcessParameterQ",
    +  "ProcessStateDomain",
    +  "ProcessStatus",
    +  "ProcessTimeDomain",
    +  "Product",
    +  "ProductDistribution",
    +  "ProductLog",
    +  "ProgressIndicator",
    +  "ProgressIndicatorBox",
    +  "ProgressIndicatorBoxOptions",
    +  "Projection",
    +  "Prolog",
    +  "PromptForm",
    +  "ProofObject",
    +  "Properties",
    +  "Property",
    +  "PropertyList",
    +  "PropertyValue",
    +  "Proportion",
    +  "Proportional",
    +  "Protect",
    +  "Protected",
    +  "ProteinData",
    +  "Pruning",
    +  "PseudoInverse",
    +  "PsychrometricPropertyData",
    +  "PublicKey",
    +  "PublisherID",
    +  "PulsarData",
    +  "PunctuationCharacter",
    +  "Purple",
    +  "Put",
    +  "PutAppend",
    +  "Pyramid",
    +  "PyramidBox",
    +  "PyramidBoxOptions",
    +  "QBinomial",
    +  "QFactorial",
    +  "QGamma",
    +  "QHypergeometricPFQ",
    +  "QnDispersion",
    +  "QPochhammer",
    +  "QPolyGamma",
    +  "QRDecomposition",
    +  "QuadraticIrrationalQ",
    +  "QuadraticOptimization",
    +  "Quantile",
    +  "QuantilePlot",
    +  "Quantity",
    +  "QuantityArray",
    +  "QuantityDistribution",
    +  "QuantityForm",
    +  "QuantityMagnitude",
    +  "QuantityQ",
    +  "QuantityUnit",
    +  "QuantityVariable",
    +  "QuantityVariableCanonicalUnit",
    +  "QuantityVariableDimensions",
    +  "QuantityVariableIdentifier",
    +  "QuantityVariablePhysicalQuantity",
    +  "Quartics",
    +  "QuartileDeviation",
    +  "Quartiles",
    +  "QuartileSkewness",
    +  "Query",
    +  "QueueingNetworkProcess",
    +  "QueueingProcess",
    +  "QueueProperties",
    +  "Quiet",
    +  "Quit",
    +  "Quotient",
    +  "QuotientRemainder",
    +  "RadialGradientImage",
    +  "RadialityCentrality",
    +  "RadicalBox",
    +  "RadicalBoxOptions",
    +  "RadioButton",
    +  "RadioButtonBar",
    +  "RadioButtonBox",
    +  "RadioButtonBoxOptions",
    +  "Radon",
    +  "RadonTransform",
    +  "RamanujanTau",
    +  "RamanujanTauL",
    +  "RamanujanTauTheta",
    +  "RamanujanTauZ",
    +  "Ramp",
    +  "Random",
    +  "RandomChoice",
    +  "RandomColor",
    +  "RandomComplex",
    +  "RandomEntity",
    +  "RandomFunction",
    +  "RandomGeoPosition",
    +  "RandomGraph",
    +  "RandomImage",
    +  "RandomInstance",
    +  "RandomInteger",
    +  "RandomPermutation",
    +  "RandomPoint",
    +  "RandomPolygon",
    +  "RandomPolyhedron",
    +  "RandomPrime",
    +  "RandomReal",
    +  "RandomSample",
    +  "RandomSeed",
    +  "RandomSeeding",
    +  "RandomVariate",
    +  "RandomWalkProcess",
    +  "RandomWord",
    +  "Range",
    +  "RangeFilter",
    +  "RangeSpecification",
    +  "RankedMax",
    +  "RankedMin",
    +  "RarerProbability",
    +  "Raster",
    +  "Raster3D",
    +  "Raster3DBox",
    +  "Raster3DBoxOptions",
    +  "RasterArray",
    +  "RasterBox",
    +  "RasterBoxOptions",
    +  "Rasterize",
    +  "RasterSize",
    +  "Rational",
    +  "RationalFunctions",
    +  "Rationalize",
    +  "Rationals",
    +  "Ratios",
    +  "RawArray",
    +  "RawBoxes",
    +  "RawData",
    +  "RawMedium",
    +  "RayleighDistribution",
    +  "Re",
    +  "Read",
    +  "ReadByteArray",
    +  "ReadLine",
    +  "ReadList",
    +  "ReadProtected",
    +  "ReadString",
    +  "Real",
    +  "RealAbs",
    +  "RealBlockDiagonalForm",
    +  "RealDigits",
    +  "RealExponent",
    +  "Reals",
    +  "RealSign",
    +  "Reap",
    +  "RebuildPacletData",
    +  "RecognitionPrior",
    +  "RecognitionThreshold",
    +  "Record",
    +  "RecordLists",
    +  "RecordSeparators",
    +  "Rectangle",
    +  "RectangleBox",
    +  "RectangleBoxOptions",
    +  "RectangleChart",
    +  "RectangleChart3D",
    +  "RectangularRepeatingElement",
    +  "RecurrenceFilter",
    +  "RecurrenceTable",
    +  "RecurringDigitsForm",
    +  "Red",
    +  "Reduce",
    +  "RefBox",
    +  "ReferenceLineStyle",
    +  "ReferenceMarkers",
    +  "ReferenceMarkerStyle",
    +  "Refine",
    +  "ReflectionMatrix",
    +  "ReflectionTransform",
    +  "Refresh",
    +  "RefreshRate",
    +  "Region",
    +  "RegionBinarize",
    +  "RegionBoundary",
    +  "RegionBoundaryStyle",
    +  "RegionBounds",
    +  "RegionCentroid",
    +  "RegionDifference",
    +  "RegionDimension",
    +  "RegionDisjoint",
    +  "RegionDistance",
    +  "RegionDistanceFunction",
    +  "RegionEmbeddingDimension",
    +  "RegionEqual",
    +  "RegionFillingStyle",
    +  "RegionFunction",
    +  "RegionImage",
    +  "RegionIntersection",
    +  "RegionMeasure",
    +  "RegionMember",
    +  "RegionMemberFunction",
    +  "RegionMoment",
    +  "RegionNearest",
    +  "RegionNearestFunction",
    +  "RegionPlot",
    +  "RegionPlot3D",
    +  "RegionProduct",
    +  "RegionQ",
    +  "RegionResize",
    +  "RegionSize",
    +  "RegionSymmetricDifference",
    +  "RegionUnion",
    +  "RegionWithin",
    +  "RegisterExternalEvaluator",
    +  "RegularExpression",
    +  "Regularization",
    +  "RegularlySampledQ",
    +  "RegularPolygon",
    +  "ReIm",
    +  "ReImLabels",
    +  "ReImPlot",
    +  "ReImStyle",
    +  "Reinstall",
    +  "RelationalDatabase",
    +  "RelationGraph",
    +  "Release",
    +  "ReleaseHold",
    +  "ReliabilityDistribution",
    +  "ReliefImage",
    +  "ReliefPlot",
    +  "RemoteAuthorizationCaching",
    +  "RemoteConnect",
    +  "RemoteConnectionObject",
    +  "RemoteFile",
    +  "RemoteRun",
    +  "RemoteRunProcess",
    +  "Remove",
    +  "RemoveAlphaChannel",
    +  "RemoveAsynchronousTask",
    +  "RemoveAudioStream",
    +  "RemoveBackground",
    +  "RemoveChannelListener",
    +  "RemoveChannelSubscribers",
    +  "Removed",
    +  "RemoveDiacritics",
    +  "RemoveInputStreamMethod",
    +  "RemoveOutputStreamMethod",
    +  "RemoveProperty",
    +  "RemoveScheduledTask",
    +  "RemoveUsers",
    +  "RemoveVideoStream",
    +  "RenameDirectory",
    +  "RenameFile",
    +  "RenderAll",
    +  "RenderingOptions",
    +  "RenewalProcess",
    +  "RenkoChart",
    +  "RepairMesh",
    +  "Repeated",
    +  "RepeatedNull",
    +  "RepeatedString",
    +  "RepeatedTiming",
    +  "RepeatingElement",
    +  "Replace",
    +  "ReplaceAll",
    +  "ReplaceHeldPart",
    +  "ReplaceImageValue",
    +  "ReplaceList",
    +  "ReplacePart",
    +  "ReplacePixelValue",
    +  "ReplaceRepeated",
    +  "ReplicateLayer",
    +  "RequiredPhysicalQuantities",
    +  "Resampling",
    +  "ResamplingAlgorithmData",
    +  "ResamplingMethod",
    +  "Rescale",
    +  "RescalingTransform",
    +  "ResetDirectory",
    +  "ResetMenusPacket",
    +  "ResetScheduledTask",
    +  "ReshapeLayer",
    +  "Residue",
    +  "ResizeLayer",
    +  "Resolve",
    +  "ResourceAcquire",
    +  "ResourceData",
    +  "ResourceFunction",
    +  "ResourceObject",
    +  "ResourceRegister",
    +  "ResourceRemove",
    +  "ResourceSearch",
    +  "ResourceSubmissionObject",
    +  "ResourceSubmit",
    +  "ResourceSystemBase",
    +  "ResourceSystemPath",
    +  "ResourceUpdate",
    +  "ResourceVersion",
    +  "ResponseForm",
    +  "Rest",
    +  "RestartInterval",
    +  "Restricted",
    +  "Resultant",
    +  "ResumePacket",
    +  "Return",
    +  "ReturnEntersInput",
    +  "ReturnExpressionPacket",
    +  "ReturnInputFormPacket",
    +  "ReturnPacket",
    +  "ReturnReceiptFunction",
    +  "ReturnTextPacket",
    +  "Reverse",
    +  "ReverseApplied",
    +  "ReverseBiorthogonalSplineWavelet",
    +  "ReverseElement",
    +  "ReverseEquilibrium",
    +  "ReverseGraph",
    +  "ReverseSort",
    +  "ReverseSortBy",
    +  "ReverseUpEquilibrium",
    +  "RevolutionAxis",
    +  "RevolutionPlot3D",
    +  "RGBColor",
    +  "RiccatiSolve",
    +  "RiceDistribution",
    +  "RidgeFilter",
    +  "RiemannR",
    +  "RiemannSiegelTheta",
    +  "RiemannSiegelZ",
    +  "RiemannXi",
    +  "Riffle",
    +  "Right",
    +  "RightArrow",
    +  "RightArrowBar",
    +  "RightArrowLeftArrow",
    +  "RightComposition",
    +  "RightCosetRepresentative",
    +  "RightDownTeeVector",
    +  "RightDownVector",
    +  "RightDownVectorBar",
    +  "RightTee",
    +  "RightTeeArrow",
    +  "RightTeeVector",
    +  "RightTriangle",
    +  "RightTriangleBar",
    +  "RightTriangleEqual",
    +  "RightUpDownVector",
    +  "RightUpTeeVector",
    +  "RightUpVector",
    +  "RightUpVectorBar",
    +  "RightVector",
    +  "RightVectorBar",
    +  "RiskAchievementImportance",
    +  "RiskReductionImportance",
    +  "RogersTanimotoDissimilarity",
    +  "RollPitchYawAngles",
    +  "RollPitchYawMatrix",
    +  "RomanNumeral",
    +  "Root",
    +  "RootApproximant",
    +  "RootIntervals",
    +  "RootLocusPlot",
    +  "RootMeanSquare",
    +  "RootOfUnityQ",
    +  "RootReduce",
    +  "Roots",
    +  "RootSum",
    +  "Rotate",
    +  "RotateLabel",
    +  "RotateLeft",
    +  "RotateRight",
    +  "RotationAction",
    +  "RotationBox",
    +  "RotationBoxOptions",
    +  "RotationMatrix",
    +  "RotationTransform",
    +  "Round",
    +  "RoundImplies",
    +  "RoundingRadius",
    +  "Row",
    +  "RowAlignments",
    +  "RowBackgrounds",
    +  "RowBox",
    +  "RowHeights",
    +  "RowLines",
    +  "RowMinHeight",
    +  "RowReduce",
    +  "RowsEqual",
    +  "RowSpacings",
    +  "RSolve",
    +  "RSolveValue",
    +  "RudinShapiro",
    +  "RudvalisGroupRu",
    +  "Rule",
    +  "RuleCondition",
    +  "RuleDelayed",
    +  "RuleForm",
    +  "RulePlot",
    +  "RulerUnits",
    +  "Run",
    +  "RunProcess",
    +  "RunScheduledTask",
    +  "RunThrough",
    +  "RuntimeAttributes",
    +  "RuntimeOptions",
    +  "RussellRaoDissimilarity",
    +  "SameQ",
    +  "SameTest",
    +  "SameTestProperties",
    +  "SampledEntityClass",
    +  "SampleDepth",
    +  "SampledSoundFunction",
    +  "SampledSoundList",
    +  "SampleRate",
    +  "SamplingPeriod",
    +  "SARIMAProcess",
    +  "SARMAProcess",
    +  "SASTriangle",
    +  "SatelliteData",
    +  "SatisfiabilityCount",
    +  "SatisfiabilityInstances",
    +  "SatisfiableQ",
    +  "Saturday",
    +  "Save",
    +  "Saveable",
    +  "SaveAutoDelete",
    +  "SaveConnection",
    +  "SaveDefinitions",
    +  "SavitzkyGolayMatrix",
    +  "SawtoothWave",
    +  "Scale",
    +  "Scaled",
    +  "ScaleDivisions",
    +  "ScaledMousePosition",
    +  "ScaleOrigin",
    +  "ScalePadding",
    +  "ScaleRanges",
    +  "ScaleRangeStyle",
    +  "ScalingFunctions",
    +  "ScalingMatrix",
    +  "ScalingTransform",
    +  "Scan",
    +  "ScheduledTask",
    +  "ScheduledTaskActiveQ",
    +  "ScheduledTaskInformation",
    +  "ScheduledTaskInformationData",
    +  "ScheduledTaskObject",
    +  "ScheduledTasks",
    +  "SchurDecomposition",
    +  "ScientificForm",
    +  "ScientificNotationThreshold",
    +  "ScorerGi",
    +  "ScorerGiPrime",
    +  "ScorerHi",
    +  "ScorerHiPrime",
    +  "ScreenRectangle",
    +  "ScreenStyleEnvironment",
    +  "ScriptBaselineShifts",
    +  "ScriptForm",
    +  "ScriptLevel",
    +  "ScriptMinSize",
    +  "ScriptRules",
    +  "ScriptSizeMultipliers",
    +  "Scrollbars",
    +  "ScrollingOptions",
    +  "ScrollPosition",
    +  "SearchAdjustment",
    +  "SearchIndexObject",
    +  "SearchIndices",
    +  "SearchQueryString",
    +  "SearchResultObject",
    +  "Sec",
    +  "Sech",
    +  "SechDistribution",
    +  "SecondOrderConeOptimization",
    +  "SectionGrouping",
    +  "SectorChart",
    +  "SectorChart3D",
    +  "SectorOrigin",
    +  "SectorSpacing",
    +  "SecuredAuthenticationKey",
    +  "SecuredAuthenticationKeys",
    +  "SeedRandom",
    +  "Select",
    +  "Selectable",
    +  "SelectComponents",
    +  "SelectedCells",
    +  "SelectedNotebook",
    +  "SelectFirst",
    +  "Selection",
    +  "SelectionAnimate",
    +  "SelectionCell",
    +  "SelectionCellCreateCell",
    +  "SelectionCellDefaultStyle",
    +  "SelectionCellParentStyle",
    +  "SelectionCreateCell",
    +  "SelectionDebuggerTag",
    +  "SelectionDuplicateCell",
    +  "SelectionEvaluate",
    +  "SelectionEvaluateCreateCell",
    +  "SelectionMove",
    +  "SelectionPlaceholder",
    +  "SelectionSetStyle",
    +  "SelectWithContents",
    +  "SelfLoops",
    +  "SelfLoopStyle",
    +  "SemanticImport",
    +  "SemanticImportString",
    +  "SemanticInterpretation",
    +  "SemialgebraicComponentInstances",
    +  "SemidefiniteOptimization",
    +  "SendMail",
    +  "SendMessage",
    +  "Sequence",
    +  "SequenceAlignment",
    +  "SequenceAttentionLayer",
    +  "SequenceCases",
    +  "SequenceCount",
    +  "SequenceFold",
    +  "SequenceFoldList",
    +  "SequenceForm",
    +  "SequenceHold",
    +  "SequenceLastLayer",
    +  "SequenceMostLayer",
    +  "SequencePosition",
    +  "SequencePredict",
    +  "SequencePredictorFunction",
    +  "SequenceReplace",
    +  "SequenceRestLayer",
    +  "SequenceReverseLayer",
    +  "SequenceSplit",
    +  "Series",
    +  "SeriesCoefficient",
    +  "SeriesData",
    +  "SeriesTermGoal",
    +  "ServiceConnect",
    +  "ServiceDisconnect",
    +  "ServiceExecute",
    +  "ServiceObject",
    +  "ServiceRequest",
    +  "ServiceResponse",
    +  "ServiceSubmit",
    +  "SessionSubmit",
    +  "SessionTime",
    +  "Set",
    +  "SetAccuracy",
    +  "SetAlphaChannel",
    +  "SetAttributes",
    +  "Setbacks",
    +  "SetBoxFormNamesPacket",
    +  "SetCloudDirectory",
    +  "SetCookies",
    +  "SetDelayed",
    +  "SetDirectory",
    +  "SetEnvironment",
    +  "SetEvaluationNotebook",
    +  "SetFileDate",
    +  "SetFileLoadingContext",
    +  "SetNotebookStatusLine",
    +  "SetOptions",
    +  "SetOptionsPacket",
    +  "SetPermissions",
    +  "SetPrecision",
    +  "SetProperty",
    +  "SetSecuredAuthenticationKey",
    +  "SetSelectedNotebook",
    +  "SetSharedFunction",
    +  "SetSharedVariable",
    +  "SetSpeechParametersPacket",
    +  "SetStreamPosition",
    +  "SetSystemModel",
    +  "SetSystemOptions",
    +  "Setter",
    +  "SetterBar",
    +  "SetterBox",
    +  "SetterBoxOptions",
    +  "Setting",
    +  "SetUsers",
    +  "SetValue",
    +  "Shading",
    +  "Shallow",
    +  "ShannonWavelet",
    +  "ShapiroWilkTest",
    +  "Share",
    +  "SharingList",
    +  "Sharpen",
    +  "ShearingMatrix",
    +  "ShearingTransform",
    +  "ShellRegion",
    +  "ShenCastanMatrix",
    +  "ShiftedGompertzDistribution",
    +  "ShiftRegisterSequence",
    +  "Short",
    +  "ShortDownArrow",
    +  "Shortest",
    +  "ShortestMatch",
    +  "ShortestPathFunction",
    +  "ShortLeftArrow",
    +  "ShortRightArrow",
    +  "ShortTimeFourier",
    +  "ShortTimeFourierData",
    +  "ShortUpArrow",
    +  "Show",
    +  "ShowAutoConvert",
    +  "ShowAutoSpellCheck",
    +  "ShowAutoStyles",
    +  "ShowCellBracket",
    +  "ShowCellLabel",
    +  "ShowCellTags",
    +  "ShowClosedCellArea",
    +  "ShowCodeAssist",
    +  "ShowContents",
    +  "ShowControls",
    +  "ShowCursorTracker",
    +  "ShowGroupOpenCloseIcon",
    +  "ShowGroupOpener",
    +  "ShowInvisibleCharacters",
    +  "ShowPageBreaks",
    +  "ShowPredictiveInterface",
    +  "ShowSelection",
    +  "ShowShortBoxForm",
    +  "ShowSpecialCharacters",
    +  "ShowStringCharacters",
    +  "ShowSyntaxStyles",
    +  "ShrinkingDelay",
    +  "ShrinkWrapBoundingBox",
    +  "SiderealTime",
    +  "SiegelTheta",
    +  "SiegelTukeyTest",
    +  "SierpinskiCurve",
    +  "SierpinskiMesh",
    +  "Sign",
    +  "Signature",
    +  "SignedRankTest",
    +  "SignedRegionDistance",
    +  "SignificanceLevel",
    +  "SignPadding",
    +  "SignTest",
    +  "SimilarityRules",
    +  "SimpleGraph",
    +  "SimpleGraphQ",
    +  "SimplePolygonQ",
    +  "SimplePolyhedronQ",
    +  "Simplex",
    +  "Simplify",
    +  "Sin",
    +  "Sinc",
    +  "SinghMaddalaDistribution",
    +  "SingleEvaluation",
    +  "SingleLetterItalics",
    +  "SingleLetterStyle",
    +  "SingularValueDecomposition",
    +  "SingularValueList",
    +  "SingularValuePlot",
    +  "SingularValues",
    +  "Sinh",
    +  "SinhIntegral",
    +  "SinIntegral",
    +  "SixJSymbol",
    +  "Skeleton",
    +  "SkeletonTransform",
    +  "SkellamDistribution",
    +  "Skewness",
    +  "SkewNormalDistribution",
    +  "SkinStyle",
    +  "Skip",
    +  "SliceContourPlot3D",
    +  "SliceDensityPlot3D",
    +  "SliceDistribution",
    +  "SliceVectorPlot3D",
    +  "Slider",
    +  "Slider2D",
    +  "Slider2DBox",
    +  "Slider2DBoxOptions",
    +  "SliderBox",
    +  "SliderBoxOptions",
    +  "SlideView",
    +  "Slot",
    +  "SlotSequence",
    +  "Small",
    +  "SmallCircle",
    +  "Smaller",
    +  "SmithDecomposition",
    +  "SmithDelayCompensator",
    +  "SmithWatermanSimilarity",
    +  "SmoothDensityHistogram",
    +  "SmoothHistogram",
    +  "SmoothHistogram3D",
    +  "SmoothKernelDistribution",
    +  "SnDispersion",
    +  "Snippet",
    +  "SnubPolyhedron",
    +  "SocialMediaData",
    +  "Socket",
    +  "SocketConnect",
    +  "SocketListen",
    +  "SocketListener",
    +  "SocketObject",
    +  "SocketOpen",
    +  "SocketReadMessage",
    +  "SocketReadyQ",
    +  "Sockets",
    +  "SocketWaitAll",
    +  "SocketWaitNext",
    +  "SoftmaxLayer",
    +  "SokalSneathDissimilarity",
    +  "SolarEclipse",
    +  "SolarSystemFeatureData",
    +  "SolidAngle",
    +  "SolidData",
    +  "SolidRegionQ",
    +  "Solve",
    +  "SolveAlways",
    +  "SolveDelayed",
    +  "Sort",
    +  "SortBy",
    +  "SortedBy",
    +  "SortedEntityClass",
    +  "Sound",
    +  "SoundAndGraphics",
    +  "SoundNote",
    +  "SoundVolume",
    +  "SourceLink",
    +  "Sow",
    +  "Space",
    +  "SpaceCurveData",
    +  "SpaceForm",
    +  "Spacer",
    +  "Spacings",
    +  "Span",
    +  "SpanAdjustments",
    +  "SpanCharacterRounding",
    +  "SpanFromAbove",
    +  "SpanFromBoth",
    +  "SpanFromLeft",
    +  "SpanLineThickness",
    +  "SpanMaxSize",
    +  "SpanMinSize",
    +  "SpanningCharacters",
    +  "SpanSymmetric",
    +  "SparseArray",
    +  "SpatialGraphDistribution",
    +  "SpatialMedian",
    +  "SpatialTransformationLayer",
    +  "Speak",
    +  "SpeakerMatchQ",
    +  "SpeakTextPacket",
    +  "SpearmanRankTest",
    +  "SpearmanRho",
    +  "SpeciesData",
    +  "SpecificityGoal",
    +  "SpectralLineData",
    +  "Spectrogram",
    +  "SpectrogramArray",
    +  "Specularity",
    +  "SpeechCases",
    +  "SpeechInterpreter",
    +  "SpeechRecognize",
    +  "SpeechSynthesize",
    +  "SpellingCorrection",
    +  "SpellingCorrectionList",
    +  "SpellingDictionaries",
    +  "SpellingDictionariesPath",
    +  "SpellingOptions",
    +  "SpellingSuggestionsPacket",
    +  "Sphere",
    +  "SphereBox",
    +  "SpherePoints",
    +  "SphericalBesselJ",
    +  "SphericalBesselY",
    +  "SphericalHankelH1",
    +  "SphericalHankelH2",
    +  "SphericalHarmonicY",
    +  "SphericalPlot3D",
    +  "SphericalRegion",
    +  "SphericalShell",
    +  "SpheroidalEigenvalue",
    +  "SpheroidalJoiningFactor",
    +  "SpheroidalPS",
    +  "SpheroidalPSPrime",
    +  "SpheroidalQS",
    +  "SpheroidalQSPrime",
    +  "SpheroidalRadialFactor",
    +  "SpheroidalS1",
    +  "SpheroidalS1Prime",
    +  "SpheroidalS2",
    +  "SpheroidalS2Prime",
    +  "Splice",
    +  "SplicedDistribution",
    +  "SplineClosed",
    +  "SplineDegree",
    +  "SplineKnots",
    +  "SplineWeights",
    +  "Split",
    +  "SplitBy",
    +  "SpokenString",
    +  "Sqrt",
    +  "SqrtBox",
    +  "SqrtBoxOptions",
    +  "Square",
    +  "SquaredEuclideanDistance",
    +  "SquareFreeQ",
    +  "SquareIntersection",
    +  "SquareMatrixQ",
    +  "SquareRepeatingElement",
    +  "SquaresR",
    +  "SquareSubset",
    +  "SquareSubsetEqual",
    +  "SquareSuperset",
    +  "SquareSupersetEqual",
    +  "SquareUnion",
    +  "SquareWave",
    +  "SSSTriangle",
    +  "StabilityMargins",
    +  "StabilityMarginsStyle",
    +  "StableDistribution",
    +  "Stack",
    +  "StackBegin",
    +  "StackComplete",
    +  "StackedDateListPlot",
    +  "StackedListPlot",
    +  "StackInhibit",
    +  "StadiumShape",
    +  "StandardAtmosphereData",
    +  "StandardDeviation",
    +  "StandardDeviationFilter",
    +  "StandardForm",
    +  "Standardize",
    +  "Standardized",
    +  "StandardOceanData",
    +  "StandbyDistribution",
    +  "Star",
    +  "StarClusterData",
    +  "StarData",
    +  "StarGraph",
    +  "StartAsynchronousTask",
    +  "StartExternalSession",
    +  "StartingStepSize",
    +  "StartOfLine",
    +  "StartOfString",
    +  "StartProcess",
    +  "StartScheduledTask",
    +  "StartupSound",
    +  "StartWebSession",
    +  "StateDimensions",
    +  "StateFeedbackGains",
    +  "StateOutputEstimator",
    +  "StateResponse",
    +  "StateSpaceModel",
    +  "StateSpaceRealization",
    +  "StateSpaceTransform",
    +  "StateTransformationLinearize",
    +  "StationaryDistribution",
    +  "StationaryWaveletPacketTransform",
    +  "StationaryWaveletTransform",
    +  "StatusArea",
    +  "StatusCentrality",
    +  "StepMonitor",
    +  "StereochemistryElements",
    +  "StieltjesGamma",
    +  "StippleShading",
    +  "StirlingS1",
    +  "StirlingS2",
    +  "StopAsynchronousTask",
    +  "StoppingPowerData",
    +  "StopScheduledTask",
    +  "StrataVariables",
    +  "StratonovichProcess",
    +  "StreamColorFunction",
    +  "StreamColorFunctionScaling",
    +  "StreamDensityPlot",
    +  "StreamMarkers",
    +  "StreamPlot",
    +  "StreamPoints",
    +  "StreamPosition",
    +  "Streams",
    +  "StreamScale",
    +  "StreamStyle",
    +  "String",
    +  "StringBreak",
    +  "StringByteCount",
    +  "StringCases",
    +  "StringContainsQ",
    +  "StringCount",
    +  "StringDelete",
    +  "StringDrop",
    +  "StringEndsQ",
    +  "StringExpression",
    +  "StringExtract",
    +  "StringForm",
    +  "StringFormat",
    +  "StringFreeQ",
    +  "StringInsert",
    +  "StringJoin",
    +  "StringLength",
    +  "StringMatchQ",
    +  "StringPadLeft",
    +  "StringPadRight",
    +  "StringPart",
    +  "StringPartition",
    +  "StringPosition",
    +  "StringQ",
    +  "StringRepeat",
    +  "StringReplace",
    +  "StringReplaceList",
    +  "StringReplacePart",
    +  "StringReverse",
    +  "StringRiffle",
    +  "StringRotateLeft",
    +  "StringRotateRight",
    +  "StringSkeleton",
    +  "StringSplit",
    +  "StringStartsQ",
    +  "StringTake",
    +  "StringTemplate",
    +  "StringToByteArray",
    +  "StringToStream",
    +  "StringTrim",
    +  "StripBoxes",
    +  "StripOnInput",
    +  "StripWrapperBoxes",
    +  "StrokeForm",
    +  "StructuralImportance",
    +  "StructuredArray",
    +  "StructuredArrayHeadQ",
    +  "StructuredSelection",
    +  "StruveH",
    +  "StruveL",
    +  "Stub",
    +  "StudentTDistribution",
    +  "Style",
    +  "StyleBox",
    +  "StyleBoxAutoDelete",
    +  "StyleData",
    +  "StyleDefinitions",
    +  "StyleForm",
    +  "StyleHints",
    +  "StyleKeyMapping",
    +  "StyleMenuListing",
    +  "StyleNameDialogSettings",
    +  "StyleNames",
    +  "StylePrint",
    +  "StyleSheetPath",
    +  "Subdivide",
    +  "Subfactorial",
    +  "Subgraph",
    +  "SubMinus",
    +  "SubPlus",
    +  "SubresultantPolynomialRemainders",
    +  "SubresultantPolynomials",
    +  "Subresultants",
    +  "Subscript",
    +  "SubscriptBox",
    +  "SubscriptBoxOptions",
    +  "Subscripted",
    +  "Subsequences",
    +  "Subset",
    +  "SubsetCases",
    +  "SubsetCount",
    +  "SubsetEqual",
    +  "SubsetMap",
    +  "SubsetPosition",
    +  "SubsetQ",
    +  "SubsetReplace",
    +  "Subsets",
    +  "SubStar",
    +  "SubstitutionSystem",
    +  "Subsuperscript",
    +  "SubsuperscriptBox",
    +  "SubsuperscriptBoxOptions",
    +  "SubtitleEncoding",
    +  "SubtitleTracks",
    +  "Subtract",
    +  "SubtractFrom",
    +  "SubtractSides",
    +  "SubValues",
    +  "Succeeds",
    +  "SucceedsEqual",
    +  "SucceedsSlantEqual",
    +  "SucceedsTilde",
    +  "Success",
    +  "SuchThat",
    +  "Sum",
    +  "SumConvergence",
    +  "SummationLayer",
    +  "Sunday",
    +  "SunPosition",
    +  "Sunrise",
    +  "Sunset",
    +  "SuperDagger",
    +  "SuperMinus",
    +  "SupernovaData",
    +  "SuperPlus",
    +  "Superscript",
    +  "SuperscriptBox",
    +  "SuperscriptBoxOptions",
    +  "Superset",
    +  "SupersetEqual",
    +  "SuperStar",
    +  "Surd",
    +  "SurdForm",
    +  "SurfaceAppearance",
    +  "SurfaceArea",
    +  "SurfaceColor",
    +  "SurfaceData",
    +  "SurfaceGraphics",
    +  "SurvivalDistribution",
    +  "SurvivalFunction",
    +  "SurvivalModel",
    +  "SurvivalModelFit",
    +  "SuspendPacket",
    +  "SuzukiDistribution",
    +  "SuzukiGroupSuz",
    +  "SwatchLegend",
    +  "Switch",
    +  "Symbol",
    +  "SymbolName",
    +  "SymletWavelet",
    +  "Symmetric",
    +  "SymmetricGroup",
    +  "SymmetricKey",
    +  "SymmetricMatrixQ",
    +  "SymmetricPolynomial",
    +  "SymmetricReduction",
    +  "Symmetrize",
    +  "SymmetrizedArray",
    +  "SymmetrizedArrayRules",
    +  "SymmetrizedDependentComponents",
    +  "SymmetrizedIndependentComponents",
    +  "SymmetrizedReplacePart",
    +  "SynchronousInitialization",
    +  "SynchronousUpdating",
    +  "Synonyms",
    +  "Syntax",
    +  "SyntaxForm",
    +  "SyntaxInformation",
    +  "SyntaxLength",
    +  "SyntaxPacket",
    +  "SyntaxQ",
    +  "SynthesizeMissingValues",
    +  "SystemCredential",
    +  "SystemCredentialData",
    +  "SystemCredentialKey",
    +  "SystemCredentialKeys",
    +  "SystemCredentialStoreObject",
    +  "SystemDialogInput",
    +  "SystemException",
    +  "SystemGet",
    +  "SystemHelpPath",
    +  "SystemInformation",
    +  "SystemInformationData",
    +  "SystemInstall",
    +  "SystemModel",
    +  "SystemModeler",
    +  "SystemModelExamples",
    +  "SystemModelLinearize",
    +  "SystemModelParametricSimulate",
    +  "SystemModelPlot",
    +  "SystemModelProgressReporting",
    +  "SystemModelReliability",
    +  "SystemModels",
    +  "SystemModelSimulate",
    +  "SystemModelSimulateSensitivity",
    +  "SystemModelSimulationData",
    +  "SystemOpen",
    +  "SystemOptions",
    +  "SystemProcessData",
    +  "SystemProcesses",
    +  "SystemsConnectionsModel",
    +  "SystemsModelDelay",
    +  "SystemsModelDelayApproximate",
    +  "SystemsModelDelete",
    +  "SystemsModelDimensions",
    +  "SystemsModelExtract",
    +  "SystemsModelFeedbackConnect",
    +  "SystemsModelLabels",
    +  "SystemsModelLinearity",
    +  "SystemsModelMerge",
    +  "SystemsModelOrder",
    +  "SystemsModelParallelConnect",
    +  "SystemsModelSeriesConnect",
    +  "SystemsModelStateFeedbackConnect",
    +  "SystemsModelVectorRelativeOrders",
    +  "SystemStub",
    +  "SystemTest",
    +  "Tab",
    +  "TabFilling",
    +  "Table",
    +  "TableAlignments",
    +  "TableDepth",
    +  "TableDirections",
    +  "TableForm",
    +  "TableHeadings",
    +  "TableSpacing",
    +  "TableView",
    +  "TableViewBox",
    +  "TableViewBoxBackground",
    +  "TableViewBoxItemSize",
    +  "TableViewBoxOptions",
    +  "TabSpacings",
    +  "TabView",
    +  "TabViewBox",
    +  "TabViewBoxOptions",
    +  "TagBox",
    +  "TagBoxNote",
    +  "TagBoxOptions",
    +  "TaggingRules",
    +  "TagSet",
    +  "TagSetDelayed",
    +  "TagStyle",
    +  "TagUnset",
    +  "Take",
    +  "TakeDrop",
    +  "TakeLargest",
    +  "TakeLargestBy",
    +  "TakeList",
    +  "TakeSmallest",
    +  "TakeSmallestBy",
    +  "TakeWhile",
    +  "Tally",
    +  "Tan",
    +  "Tanh",
    +  "TargetDevice",
    +  "TargetFunctions",
    +  "TargetSystem",
    +  "TargetUnits",
    +  "TaskAbort",
    +  "TaskExecute",
    +  "TaskObject",
    +  "TaskRemove",
    +  "TaskResume",
    +  "Tasks",
    +  "TaskSuspend",
    +  "TaskWait",
    +  "TautologyQ",
    +  "TelegraphProcess",
    +  "TemplateApply",
    +  "TemplateArgBox",
    +  "TemplateBox",
    +  "TemplateBoxOptions",
    +  "TemplateEvaluate",
    +  "TemplateExpression",
    +  "TemplateIf",
    +  "TemplateObject",
    +  "TemplateSequence",
    +  "TemplateSlot",
    +  "TemplateSlotSequence",
    +  "TemplateUnevaluated",
    +  "TemplateVerbatim",
    +  "TemplateWith",
    +  "TemporalData",
    +  "TemporalRegularity",
    +  "Temporary",
    +  "TemporaryVariable",
    +  "TensorContract",
    +  "TensorDimensions",
    +  "TensorExpand",
    +  "TensorProduct",
    +  "TensorQ",
    +  "TensorRank",
    +  "TensorReduce",
    +  "TensorSymmetry",
    +  "TensorTranspose",
    +  "TensorWedge",
    +  "TestID",
    +  "TestReport",
    +  "TestReportObject",
    +  "TestResultObject",
    +  "Tetrahedron",
    +  "TetrahedronBox",
    +  "TetrahedronBoxOptions",
    +  "TeXForm",
    +  "TeXSave",
    +  "Text",
    +  "Text3DBox",
    +  "Text3DBoxOptions",
    +  "TextAlignment",
    +  "TextBand",
    +  "TextBoundingBox",
    +  "TextBox",
    +  "TextCases",
    +  "TextCell",
    +  "TextClipboardType",
    +  "TextContents",
    +  "TextData",
    +  "TextElement",
    +  "TextForm",
    +  "TextGrid",
    +  "TextJustification",
    +  "TextLine",
    +  "TextPacket",
    +  "TextParagraph",
    +  "TextPosition",
    +  "TextRecognize",
    +  "TextSearch",
    +  "TextSearchReport",
    +  "TextSentences",
    +  "TextString",
    +  "TextStructure",
    +  "TextStyle",
    +  "TextTranslation",
    +  "Texture",
    +  "TextureCoordinateFunction",
    +  "TextureCoordinateScaling",
    +  "TextWords",
    +  "Therefore",
    +  "ThermodynamicData",
    +  "ThermometerGauge",
    +  "Thick",
    +  "Thickness",
    +  "Thin",
    +  "Thinning",
    +  "ThisLink",
    +  "ThompsonGroupTh",
    +  "Thread",
    +  "ThreadingLayer",
    +  "ThreeJSymbol",
    +  "Threshold",
    +  "Through",
    +  "Throw",
    +  "ThueMorse",
    +  "Thumbnail",
    +  "Thursday",
    +  "Ticks",
    +  "TicksStyle",
    +  "TideData",
    +  "Tilde",
    +  "TildeEqual",
    +  "TildeFullEqual",
    +  "TildeTilde",
    +  "TimeConstrained",
    +  "TimeConstraint",
    +  "TimeDirection",
    +  "TimeFormat",
    +  "TimeGoal",
    +  "TimelinePlot",
    +  "TimeObject",
    +  "TimeObjectQ",
    +  "TimeRemaining",
    +  "Times",
    +  "TimesBy",
    +  "TimeSeries",
    +  "TimeSeriesAggregate",
    +  "TimeSeriesForecast",
    +  "TimeSeriesInsert",
    +  "TimeSeriesInvertibility",
    +  "TimeSeriesMap",
    +  "TimeSeriesMapThread",
    +  "TimeSeriesModel",
    +  "TimeSeriesModelFit",
    +  "TimeSeriesResample",
    +  "TimeSeriesRescale",
    +  "TimeSeriesShift",
    +  "TimeSeriesThread",
    +  "TimeSeriesWindow",
    +  "TimeUsed",
    +  "TimeValue",
    +  "TimeWarpingCorrespondence",
    +  "TimeWarpingDistance",
    +  "TimeZone",
    +  "TimeZoneConvert",
    +  "TimeZoneOffset",
    +  "Timing",
    +  "Tiny",
    +  "TitleGrouping",
    +  "TitsGroupT",
    +  "ToBoxes",
    +  "ToCharacterCode",
    +  "ToColor",
    +  "ToContinuousTimeModel",
    +  "ToDate",
    +  "Today",
    +  "ToDiscreteTimeModel",
    +  "ToEntity",
    +  "ToeplitzMatrix",
    +  "ToExpression",
    +  "ToFileName",
    +  "Together",
    +  "Toggle",
    +  "ToggleFalse",
    +  "Toggler",
    +  "TogglerBar",
    +  "TogglerBox",
    +  "TogglerBoxOptions",
    +  "ToHeldExpression",
    +  "ToInvertibleTimeSeries",
    +  "TokenWords",
    +  "Tolerance",
    +  "ToLowerCase",
    +  "Tomorrow",
    +  "ToNumberField",
    +  "TooBig",
    +  "Tooltip",
    +  "TooltipBox",
    +  "TooltipBoxOptions",
    +  "TooltipDelay",
    +  "TooltipStyle",
    +  "ToonShading",
    +  "Top",
    +  "TopHatTransform",
    +  "ToPolarCoordinates",
    +  "TopologicalSort",
    +  "ToRadicals",
    +  "ToRules",
    +  "ToSphericalCoordinates",
    +  "ToString",
    +  "Total",
    +  "TotalHeight",
    +  "TotalLayer",
    +  "TotalVariationFilter",
    +  "TotalWidth",
    +  "TouchPosition",
    +  "TouchscreenAutoZoom",
    +  "TouchscreenControlPlacement",
    +  "ToUpperCase",
    +  "Tr",
    +  "Trace",
    +  "TraceAbove",
    +  "TraceAction",
    +  "TraceBackward",
    +  "TraceDepth",
    +  "TraceDialog",
    +  "TraceForward",
    +  "TraceInternal",
    +  "TraceLevel",
    +  "TraceOff",
    +  "TraceOn",
    +  "TraceOriginal",
    +  "TracePrint",
    +  "TraceScan",
    +  "TrackedSymbols",
    +  "TrackingFunction",
    +  "TracyWidomDistribution",
    +  "TradingChart",
    +  "TraditionalForm",
    +  "TraditionalFunctionNotation",
    +  "TraditionalNotation",
    +  "TraditionalOrder",
    +  "TrainingProgressCheckpointing",
    +  "TrainingProgressFunction",
    +  "TrainingProgressMeasurements",
    +  "TrainingProgressReporting",
    +  "TrainingStoppingCriterion",
    +  "TrainingUpdateSchedule",
    +  "TransferFunctionCancel",
    +  "TransferFunctionExpand",
    +  "TransferFunctionFactor",
    +  "TransferFunctionModel",
    +  "TransferFunctionPoles",
    +  "TransferFunctionTransform",
    +  "TransferFunctionZeros",
    +  "TransformationClass",
    +  "TransformationFunction",
    +  "TransformationFunctions",
    +  "TransformationMatrix",
    +  "TransformedDistribution",
    +  "TransformedField",
    +  "TransformedProcess",
    +  "TransformedRegion",
    +  "TransitionDirection",
    +  "TransitionDuration",
    +  "TransitionEffect",
    +  "TransitiveClosureGraph",
    +  "TransitiveReductionGraph",
    +  "Translate",
    +  "TranslationOptions",
    +  "TranslationTransform",
    +  "Transliterate",
    +  "Transparent",
    +  "TransparentColor",
    +  "Transpose",
    +  "TransposeLayer",
    +  "TrapSelection",
    +  "TravelDirections",
    +  "TravelDirectionsData",
    +  "TravelDistance",
    +  "TravelDistanceList",
    +  "TravelMethod",
    +  "TravelTime",
    +  "TreeForm",
    +  "TreeGraph",
    +  "TreeGraphQ",
    +  "TreePlot",
    +  "TrendStyle",
    +  "Triangle",
    +  "TriangleCenter",
    +  "TriangleConstruct",
    +  "TriangleMeasurement",
    +  "TriangleWave",
    +  "TriangularDistribution",
    +  "TriangulateMesh",
    +  "Trig",
    +  "TrigExpand",
    +  "TrigFactor",
    +  "TrigFactorList",
    +  "Trigger",
    +  "TrigReduce",
    +  "TrigToExp",
    +  "TrimmedMean",
    +  "TrimmedVariance",
    +  "TropicalStormData",
    +  "True",
    +  "TrueQ",
    +  "TruncatedDistribution",
    +  "TruncatedPolyhedron",
    +  "TsallisQExponentialDistribution",
    +  "TsallisQGaussianDistribution",
    +  "TTest",
    +  "Tube",
    +  "TubeBezierCurveBox",
    +  "TubeBezierCurveBoxOptions",
    +  "TubeBox",
    +  "TubeBoxOptions",
    +  "TubeBSplineCurveBox",
    +  "TubeBSplineCurveBoxOptions",
    +  "Tuesday",
    +  "TukeyLambdaDistribution",
    +  "TukeyWindow",
    +  "TunnelData",
    +  "Tuples",
    +  "TuranGraph",
    +  "TuringMachine",
    +  "TuttePolynomial",
    +  "TwoWayRule",
    +  "Typed",
    +  "TypeSpecifier",
    +  "UnateQ",
    +  "Uncompress",
    +  "UnconstrainedParameters",
    +  "Undefined",
    +  "UnderBar",
    +  "Underflow",
    +  "Underlined",
    +  "Underoverscript",
    +  "UnderoverscriptBox",
    +  "UnderoverscriptBoxOptions",
    +  "Underscript",
    +  "UnderscriptBox",
    +  "UnderscriptBoxOptions",
    +  "UnderseaFeatureData",
    +  "UndirectedEdge",
    +  "UndirectedGraph",
    +  "UndirectedGraphQ",
    +  "UndoOptions",
    +  "UndoTrackedVariables",
    +  "Unequal",
    +  "UnequalTo",
    +  "Unevaluated",
    +  "UniformDistribution",
    +  "UniformGraphDistribution",
    +  "UniformPolyhedron",
    +  "UniformSumDistribution",
    +  "Uninstall",
    +  "Union",
    +  "UnionedEntityClass",
    +  "UnionPlus",
    +  "Unique",
    +  "UnitaryMatrixQ",
    +  "UnitBox",
    +  "UnitConvert",
    +  "UnitDimensions",
    +  "Unitize",
    +  "UnitRootTest",
    +  "UnitSimplify",
    +  "UnitStep",
    +  "UnitSystem",
    +  "UnitTriangle",
    +  "UnitVector",
    +  "UnitVectorLayer",
    +  "UnityDimensions",
    +  "UniverseModelData",
    +  "UniversityData",
    +  "UnixTime",
    +  "Unprotect",
    +  "UnregisterExternalEvaluator",
    +  "UnsameQ",
    +  "UnsavedVariables",
    +  "Unset",
    +  "UnsetShared",
    +  "UntrackedVariables",
    +  "Up",
    +  "UpArrow",
    +  "UpArrowBar",
    +  "UpArrowDownArrow",
    +  "Update",
    +  "UpdateDynamicObjects",
    +  "UpdateDynamicObjectsSynchronous",
    +  "UpdateInterval",
    +  "UpdatePacletSites",
    +  "UpdateSearchIndex",
    +  "UpDownArrow",
    +  "UpEquilibrium",
    +  "UpperCaseQ",
    +  "UpperLeftArrow",
    +  "UpperRightArrow",
    +  "UpperTriangularize",
    +  "UpperTriangularMatrixQ",
    +  "Upsample",
    +  "UpSet",
    +  "UpSetDelayed",
    +  "UpTee",
    +  "UpTeeArrow",
    +  "UpTo",
    +  "UpValues",
    +  "URL",
    +  "URLBuild",
    +  "URLDecode",
    +  "URLDispatcher",
    +  "URLDownload",
    +  "URLDownloadSubmit",
    +  "URLEncode",
    +  "URLExecute",
    +  "URLExpand",
    +  "URLFetch",
    +  "URLFetchAsynchronous",
    +  "URLParse",
    +  "URLQueryDecode",
    +  "URLQueryEncode",
    +  "URLRead",
    +  "URLResponseTime",
    +  "URLSave",
    +  "URLSaveAsynchronous",
    +  "URLShorten",
    +  "URLSubmit",
    +  "UseGraphicsRange",
    +  "UserDefinedWavelet",
    +  "Using",
    +  "UsingFrontEnd",
    +  "UtilityFunction",
    +  "V2Get",
    +  "ValenceErrorHandling",
    +  "ValidationLength",
    +  "ValidationSet",
    +  "Value",
    +  "ValueBox",
    +  "ValueBoxOptions",
    +  "ValueDimensions",
    +  "ValueForm",
    +  "ValuePreprocessingFunction",
    +  "ValueQ",
    +  "Values",
    +  "ValuesData",
    +  "Variables",
    +  "Variance",
    +  "VarianceEquivalenceTest",
    +  "VarianceEstimatorFunction",
    +  "VarianceGammaDistribution",
    +  "VarianceTest",
    +  "VectorAngle",
    +  "VectorAround",
    +  "VectorAspectRatio",
    +  "VectorColorFunction",
    +  "VectorColorFunctionScaling",
    +  "VectorDensityPlot",
    +  "VectorGlyphData",
    +  "VectorGreater",
    +  "VectorGreaterEqual",
    +  "VectorLess",
    +  "VectorLessEqual",
    +  "VectorMarkers",
    +  "VectorPlot",
    +  "VectorPlot3D",
    +  "VectorPoints",
    +  "VectorQ",
    +  "VectorRange",
    +  "Vectors",
    +  "VectorScale",
    +  "VectorScaling",
    +  "VectorSizes",
    +  "VectorStyle",
    +  "Vee",
    +  "Verbatim",
    +  "Verbose",
    +  "VerboseConvertToPostScriptPacket",
    +  "VerificationTest",
    +  "VerifyConvergence",
    +  "VerifyDerivedKey",
    +  "VerifyDigitalSignature",
    +  "VerifyFileSignature",
    +  "VerifyInterpretation",
    +  "VerifySecurityCertificates",
    +  "VerifySolutions",
    +  "VerifyTestAssumptions",
    +  "Version",
    +  "VersionedPreferences",
    +  "VersionNumber",
    +  "VertexAdd",
    +  "VertexCapacity",
    +  "VertexColors",
    +  "VertexComponent",
    +  "VertexConnectivity",
    +  "VertexContract",
    +  "VertexCoordinateRules",
    +  "VertexCoordinates",
    +  "VertexCorrelationSimilarity",
    +  "VertexCosineSimilarity",
    +  "VertexCount",
    +  "VertexCoverQ",
    +  "VertexDataCoordinates",
    +  "VertexDegree",
    +  "VertexDelete",
    +  "VertexDiceSimilarity",
    +  "VertexEccentricity",
    +  "VertexInComponent",
    +  "VertexInDegree",
    +  "VertexIndex",
    +  "VertexJaccardSimilarity",
    +  "VertexLabeling",
    +  "VertexLabels",
    +  "VertexLabelStyle",
    +  "VertexList",
    +  "VertexNormals",
    +  "VertexOutComponent",
    +  "VertexOutDegree",
    +  "VertexQ",
    +  "VertexRenderingFunction",
    +  "VertexReplace",
    +  "VertexShape",
    +  "VertexShapeFunction",
    +  "VertexSize",
    +  "VertexStyle",
    +  "VertexTextureCoordinates",
    +  "VertexWeight",
    +  "VertexWeightedGraphQ",
    +  "Vertical",
    +  "VerticalBar",
    +  "VerticalForm",
    +  "VerticalGauge",
    +  "VerticalSeparator",
    +  "VerticalSlider",
    +  "VerticalTilde",
    +  "Video",
    +  "VideoEncoding",
    +  "VideoExtractFrames",
    +  "VideoFrameList",
    +  "VideoFrameMap",
    +  "VideoPause",
    +  "VideoPlay",
    +  "VideoQ",
    +  "VideoStop",
    +  "VideoStream",
    +  "VideoStreams",
    +  "VideoTimeSeries",
    +  "VideoTracks",
    +  "VideoTrim",
    +  "ViewAngle",
    +  "ViewCenter",
    +  "ViewMatrix",
    +  "ViewPoint",
    +  "ViewPointSelectorSettings",
    +  "ViewPort",
    +  "ViewProjection",
    +  "ViewRange",
    +  "ViewVector",
    +  "ViewVertical",
    +  "VirtualGroupData",
    +  "Visible",
    +  "VisibleCell",
    +  "VoiceStyleData",
    +  "VoigtDistribution",
    +  "VolcanoData",
    +  "Volume",
    +  "VonMisesDistribution",
    +  "VoronoiMesh",
    +  "WaitAll",
    +  "WaitAsynchronousTask",
    +  "WaitNext",
    +  "WaitUntil",
    +  "WakebyDistribution",
    +  "WalleniusHypergeometricDistribution",
    +  "WaringYuleDistribution",
    +  "WarpingCorrespondence",
    +  "WarpingDistance",
    +  "WatershedComponents",
    +  "WatsonUSquareTest",
    +  "WattsStrogatzGraphDistribution",
    +  "WaveletBestBasis",
    +  "WaveletFilterCoefficients",
    +  "WaveletImagePlot",
    +  "WaveletListPlot",
    +  "WaveletMapIndexed",
    +  "WaveletMatrixPlot",
    +  "WaveletPhi",
    +  "WaveletPsi",
    +  "WaveletScale",
    +  "WaveletScalogram",
    +  "WaveletThreshold",
    +  "WeaklyConnectedComponents",
    +  "WeaklyConnectedGraphComponents",
    +  "WeaklyConnectedGraphQ",
    +  "WeakStationarity",
    +  "WeatherData",
    +  "WeatherForecastData",
    +  "WebAudioSearch",
    +  "WebElementObject",
    +  "WeberE",
    +  "WebExecute",
    +  "WebImage",
    +  "WebImageSearch",
    +  "WebSearch",
    +  "WebSessionObject",
    +  "WebSessions",
    +  "WebWindowObject",
    +  "Wedge",
    +  "Wednesday",
    +  "WeibullDistribution",
    +  "WeierstrassE1",
    +  "WeierstrassE2",
    +  "WeierstrassE3",
    +  "WeierstrassEta1",
    +  "WeierstrassEta2",
    +  "WeierstrassEta3",
    +  "WeierstrassHalfPeriods",
    +  "WeierstrassHalfPeriodW1",
    +  "WeierstrassHalfPeriodW2",
    +  "WeierstrassHalfPeriodW3",
    +  "WeierstrassInvariantG2",
    +  "WeierstrassInvariantG3",
    +  "WeierstrassInvariants",
    +  "WeierstrassP",
    +  "WeierstrassPPrime",
    +  "WeierstrassSigma",
    +  "WeierstrassZeta",
    +  "WeightedAdjacencyGraph",
    +  "WeightedAdjacencyMatrix",
    +  "WeightedData",
    +  "WeightedGraphQ",
    +  "Weights",
    +  "WelchWindow",
    +  "WheelGraph",
    +  "WhenEvent",
    +  "Which",
    +  "While",
    +  "White",
    +  "WhiteNoiseProcess",
    +  "WhitePoint",
    +  "Whitespace",
    +  "WhitespaceCharacter",
    +  "WhittakerM",
    +  "WhittakerW",
    +  "WienerFilter",
    +  "WienerProcess",
    +  "WignerD",
    +  "WignerSemicircleDistribution",
    +  "WikidataData",
    +  "WikidataSearch",
    +  "WikipediaData",
    +  "WikipediaSearch",
    +  "WilksW",
    +  "WilksWTest",
    +  "WindDirectionData",
    +  "WindingCount",
    +  "WindingPolygon",
    +  "WindowClickSelect",
    +  "WindowElements",
    +  "WindowFloating",
    +  "WindowFrame",
    +  "WindowFrameElements",
    +  "WindowMargins",
    +  "WindowMovable",
    +  "WindowOpacity",
    +  "WindowPersistentStyles",
    +  "WindowSelected",
    +  "WindowSize",
    +  "WindowStatusArea",
    +  "WindowTitle",
    +  "WindowToolbars",
    +  "WindowWidth",
    +  "WindSpeedData",
    +  "WindVectorData",
    +  "WinsorizedMean",
    +  "WinsorizedVariance",
    +  "WishartMatrixDistribution",
    +  "With",
    +  "WolframAlpha",
    +  "WolframAlphaDate",
    +  "WolframAlphaQuantity",
    +  "WolframAlphaResult",
    +  "WolframLanguageData",
    +  "Word",
    +  "WordBoundary",
    +  "WordCharacter",
    +  "WordCloud",
    +  "WordCount",
    +  "WordCounts",
    +  "WordData",
    +  "WordDefinition",
    +  "WordFrequency",
    +  "WordFrequencyData",
    +  "WordList",
    +  "WordOrientation",
    +  "WordSearch",
    +  "WordSelectionFunction",
    +  "WordSeparators",
    +  "WordSpacings",
    +  "WordStem",
    +  "WordTranslation",
    +  "WorkingPrecision",
    +  "WrapAround",
    +  "Write",
    +  "WriteLine",
    +  "WriteString",
    +  "Wronskian",
    +  "XMLElement",
    +  "XMLObject",
    +  "XMLTemplate",
    +  "Xnor",
    +  "Xor",
    +  "XYZColor",
    +  "Yellow",
    +  "Yesterday",
    +  "YuleDissimilarity",
    +  "ZernikeR",
    +  "ZeroSymmetric",
    +  "ZeroTest",
    +  "ZeroWidthTimes",
    +  "Zeta",
    +  "ZetaZero",
    +  "ZIPCodeData",
    +  "ZipfDistribution",
    +  "ZoomCenter",
    +  "ZoomFactor",
    +  "ZTest",
    +  "ZTransform",
    +  "$Aborted",
    +  "$ActivationGroupID",
    +  "$ActivationKey",
    +  "$ActivationUserRegistered",
    +  "$AddOnsDirectory",
    +  "$AllowDataUpdates",
    +  "$AllowExternalChannelFunctions",
    +  "$AllowInternet",
    +  "$AssertFunction",
    +  "$Assumptions",
    +  "$AsynchronousTask",
    +  "$AudioDecoders",
    +  "$AudioEncoders",
    +  "$AudioInputDevices",
    +  "$AudioOutputDevices",
    +  "$BaseDirectory",
    +  "$BasePacletsDirectory",
    +  "$BatchInput",
    +  "$BatchOutput",
    +  "$BlockchainBase",
    +  "$BoxForms",
    +  "$ByteOrdering",
    +  "$CacheBaseDirectory",
    +  "$Canceled",
    +  "$ChannelBase",
    +  "$CharacterEncoding",
    +  "$CharacterEncodings",
    +  "$CloudAccountName",
    +  "$CloudBase",
    +  "$CloudConnected",
    +  "$CloudConnection",
    +  "$CloudCreditsAvailable",
    +  "$CloudEvaluation",
    +  "$CloudExpressionBase",
    +  "$CloudObjectNameFormat",
    +  "$CloudObjectURLType",
    +  "$CloudRootDirectory",
    +  "$CloudSymbolBase",
    +  "$CloudUserID",
    +  "$CloudUserUUID",
    +  "$CloudVersion",
    +  "$CloudVersionNumber",
    +  "$CloudWolframEngineVersionNumber",
    +  "$CommandLine",
    +  "$CompilationTarget",
    +  "$ConditionHold",
    +  "$ConfiguredKernels",
    +  "$Context",
    +  "$ContextPath",
    +  "$ControlActiveSetting",
    +  "$Cookies",
    +  "$CookieStore",
    +  "$CreationDate",
    +  "$CurrentLink",
    +  "$CurrentTask",
    +  "$CurrentWebSession",
    +  "$DataStructures",
    +  "$DateStringFormat",
    +  "$DefaultAudioInputDevice",
    +  "$DefaultAudioOutputDevice",
    +  "$DefaultFont",
    +  "$DefaultFrontEnd",
    +  "$DefaultImagingDevice",
    +  "$DefaultLocalBase",
    +  "$DefaultMailbox",
    +  "$DefaultNetworkInterface",
    +  "$DefaultPath",
    +  "$DefaultProxyRules",
    +  "$DefaultSystemCredentialStore",
    +  "$Display",
    +  "$DisplayFunction",
    +  "$DistributedContexts",
    +  "$DynamicEvaluation",
    +  "$Echo",
    +  "$EmbedCodeEnvironments",
    +  "$EmbeddableServices",
    +  "$EntityStores",
    +  "$Epilog",
    +  "$EvaluationCloudBase",
    +  "$EvaluationCloudObject",
    +  "$EvaluationEnvironment",
    +  "$ExportFormats",
    +  "$ExternalIdentifierTypes",
    +  "$ExternalStorageBase",
    +  "$Failed",
    +  "$FinancialDataSource",
    +  "$FontFamilies",
    +  "$FormatType",
    +  "$FrontEnd",
    +  "$FrontEndSession",
    +  "$GeoEntityTypes",
    +  "$GeoLocation",
    +  "$GeoLocationCity",
    +  "$GeoLocationCountry",
    +  "$GeoLocationPrecision",
    +  "$GeoLocationSource",
    +  "$HistoryLength",
    +  "$HomeDirectory",
    +  "$HTMLExportRules",
    +  "$HTTPCookies",
    +  "$HTTPRequest",
    +  "$IgnoreEOF",
    +  "$ImageFormattingWidth",
    +  "$ImageResolution",
    +  "$ImagingDevice",
    +  "$ImagingDevices",
    +  "$ImportFormats",
    +  "$IncomingMailSettings",
    +  "$InitialDirectory",
    +  "$Initialization",
    +  "$InitializationContexts",
    +  "$Input",
    +  "$InputFileName",
    +  "$InputStreamMethods",
    +  "$Inspector",
    +  "$InstallationDate",
    +  "$InstallationDirectory",
    +  "$InterfaceEnvironment",
    +  "$InterpreterTypes",
    +  "$IterationLimit",
    +  "$KernelCount",
    +  "$KernelID",
    +  "$Language",
    +  "$LaunchDirectory",
    +  "$LibraryPath",
    +  "$LicenseExpirationDate",
    +  "$LicenseID",
    +  "$LicenseProcesses",
    +  "$LicenseServer",
    +  "$LicenseSubprocesses",
    +  "$LicenseType",
    +  "$Line",
    +  "$Linked",
    +  "$LinkSupported",
    +  "$LoadedFiles",
    +  "$LocalBase",
    +  "$LocalSymbolBase",
    +  "$MachineAddresses",
    +  "$MachineDomain",
    +  "$MachineDomains",
    +  "$MachineEpsilon",
    +  "$MachineID",
    +  "$MachineName",
    +  "$MachinePrecision",
    +  "$MachineType",
    +  "$MaxExtraPrecision",
    +  "$MaxLicenseProcesses",
    +  "$MaxLicenseSubprocesses",
    +  "$MaxMachineNumber",
    +  "$MaxNumber",
    +  "$MaxPiecewiseCases",
    +  "$MaxPrecision",
    +  "$MaxRootDegree",
    +  "$MessageGroups",
    +  "$MessageList",
    +  "$MessagePrePrint",
    +  "$Messages",
    +  "$MinMachineNumber",
    +  "$MinNumber",
    +  "$MinorReleaseNumber",
    +  "$MinPrecision",
    +  "$MobilePhone",
    +  "$ModuleNumber",
    +  "$NetworkConnected",
    +  "$NetworkInterfaces",
    +  "$NetworkLicense",
    +  "$NewMessage",
    +  "$NewSymbol",
    +  "$NotebookInlineStorageLimit",
    +  "$Notebooks",
    +  "$NoValue",
    +  "$NumberMarks",
    +  "$Off",
    +  "$OperatingSystem",
    +  "$Output",
    +  "$OutputForms",
    +  "$OutputSizeLimit",
    +  "$OutputStreamMethods",
    +  "$Packages",
    +  "$ParentLink",
    +  "$ParentProcessID",
    +  "$PasswordFile",
    +  "$PatchLevelID",
    +  "$Path",
    +  "$PathnameSeparator",
    +  "$PerformanceGoal",
    +  "$Permissions",
    +  "$PermissionsGroupBase",
    +  "$PersistenceBase",
    +  "$PersistencePath",
    +  "$PipeSupported",
    +  "$PlotTheme",
    +  "$Post",
    +  "$Pre",
    +  "$PreferencesDirectory",
    +  "$PreInitialization",
    +  "$PrePrint",
    +  "$PreRead",
    +  "$PrintForms",
    +  "$PrintLiteral",
    +  "$Printout3DPreviewer",
    +  "$ProcessID",
    +  "$ProcessorCount",
    +  "$ProcessorType",
    +  "$ProductInformation",
    +  "$ProgramName",
    +  "$PublisherID",
    +  "$RandomState",
    +  "$RecursionLimit",
    +  "$RegisteredDeviceClasses",
    +  "$RegisteredUserName",
    +  "$ReleaseNumber",
    +  "$RequesterAddress",
    +  "$RequesterWolframID",
    +  "$RequesterWolframUUID",
    +  "$RootDirectory",
    +  "$ScheduledTask",
    +  "$ScriptCommandLine",
    +  "$ScriptInputString",
    +  "$SecuredAuthenticationKeyTokens",
    +  "$ServiceCreditsAvailable",
    +  "$Services",
    +  "$SessionID",
    +  "$SetParentLink",
    +  "$SharedFunctions",
    +  "$SharedVariables",
    +  "$SoundDisplay",
    +  "$SoundDisplayFunction",
    +  "$SourceLink",
    +  "$SSHAuthentication",
    +  "$SubtitleDecoders",
    +  "$SubtitleEncoders",
    +  "$SummaryBoxDataSizeLimit",
    +  "$SuppressInputFormHeads",
    +  "$SynchronousEvaluation",
    +  "$SyntaxHandler",
    +  "$System",
    +  "$SystemCharacterEncoding",
    +  "$SystemCredentialStore",
    +  "$SystemID",
    +  "$SystemMemory",
    +  "$SystemShell",
    +  "$SystemTimeZone",
    +  "$SystemWordLength",
    +  "$TemplatePath",
    +  "$TemporaryDirectory",
    +  "$TemporaryPrefix",
    +  "$TestFileName",
    +  "$TextStyle",
    +  "$TimedOut",
    +  "$TimeUnit",
    +  "$TimeZone",
    +  "$TimeZoneEntity",
    +  "$TopDirectory",
    +  "$TraceOff",
    +  "$TraceOn",
    +  "$TracePattern",
    +  "$TracePostAction",
    +  "$TracePreAction",
    +  "$UnitSystem",
    +  "$Urgent",
    +  "$UserAddOnsDirectory",
    +  "$UserAgentLanguages",
    +  "$UserAgentMachine",
    +  "$UserAgentName",
    +  "$UserAgentOperatingSystem",
    +  "$UserAgentString",
    +  "$UserAgentVersion",
    +  "$UserBaseDirectory",
    +  "$UserBasePacletsDirectory",
    +  "$UserDocumentsDirectory",
    +  "$Username",
    +  "$UserName",
    +  "$UserURLBase",
    +  "$Version",
    +  "$VersionNumber",
    +  "$VideoDecoders",
    +  "$VideoEncoders",
    +  "$VoiceStyles",
    +  "$WolframDocumentsDirectory",
    +  "$WolframID",
    +  "$WolframUUID"
    +];
    +
    +/**
    + * @param {string} value
    + * @returns {RegExp}
    + * */
    +
    +/**
    + * @param {RegExp | string } re
    + * @returns {string}
    + */
    +function source(re) {
    +  if (!re) return null;
    +  if (typeof re === "string") return re;
    +
    +  return re.source;
    +}
    +
    +/**
    + * @param {RegExp | string } re
    + * @returns {string}
    + */
    +function optional(re) {
    +  return concat('(', re, ')?');
    +}
    +
    +/**
    + * @param {...(RegExp | string) } args
    + * @returns {string}
    + */
    +function concat(...args) {
    +  const joined = args.map((x) => source(x)).join("");
    +  return joined;
    +}
    +
    +/**
    + * Any of the passed expresssions may match
    + *
    + * Creates a huge this | this | that | that match
    + * @param {(RegExp | string)[] } args
    + * @returns {string}
    + */
    +function either(...args) {
    +  const joined = '(' + args.map((x) => source(x)).join("|") + ")";
    +  return joined;
    +}
    +
    +/*
    +Language: Wolfram Language
    +Description: The Wolfram Language is the programming language used in Wolfram Mathematica, a modern technical computing system spanning most areas of technical computing.
    +Authors: Patrick Scheibe , Robert Jacobson 
    +Website: https://www.wolfram.com/mathematica/
    +Category: scientific
    +*/
    +
    +/** @type LanguageFn */
    +function mathematica(hljs) {
    +  /*
    +  This rather scary looking matching of Mathematica numbers is carefully explained by Robert Jacobson here:
    +  https://wltools.github.io/LanguageSpec/Specification/Syntax/Number-representations/
    +   */
    +  const BASE_RE = /([2-9]|[1-2]\d|[3][0-5])\^\^/;
    +  const BASE_DIGITS_RE = /(\w*\.\w+|\w+\.\w*|\w+)/;
    +  const NUMBER_RE = /(\d*\.\d+|\d+\.\d*|\d+)/;
    +  const BASE_NUMBER_RE = either(concat(BASE_RE, BASE_DIGITS_RE), NUMBER_RE);
    +
    +  const ACCURACY_RE = /``[+-]?(\d*\.\d+|\d+\.\d*|\d+)/;
    +  const PRECISION_RE = /`([+-]?(\d*\.\d+|\d+\.\d*|\d+))?/;
    +  const APPROXIMATE_NUMBER_RE = either(ACCURACY_RE, PRECISION_RE);
    +
    +  const SCIENTIFIC_NOTATION_RE = /\*\^[+-]?\d+/;
    +
    +  const MATHEMATICA_NUMBER_RE = concat(
    +    BASE_NUMBER_RE,
    +    optional(APPROXIMATE_NUMBER_RE),
    +    optional(SCIENTIFIC_NOTATION_RE)
    +  );
    +
    +  const NUMBERS = {
    +    className: 'number',
    +    relevance: 0,
    +    begin: MATHEMATICA_NUMBER_RE
    +  };
    +
    +  const SYMBOL_RE = /[a-zA-Z$][a-zA-Z0-9$]*/;
    +  const SYSTEM_SYMBOLS_SET = new Set(SYSTEM_SYMBOLS);
    +  /** @type {Mode} */
    +  const SYMBOLS = {
    +    variants: [
    +      {
    +        className: 'builtin-symbol',
    +        begin: SYMBOL_RE,
    +        // for performance out of fear of regex.either(...Mathematica.SYSTEM_SYMBOLS)
    +        "on:begin": (match, response) => {
    +          if (!SYSTEM_SYMBOLS_SET.has(match[0])) response.ignoreMatch();
    +        }
    +      },
    +      {
    +        className: 'symbol',
    +        relevance: 0,
    +        begin: SYMBOL_RE
    +      }
    +    ]
    +  };
    +
    +  const NAMED_CHARACTER = {
    +    className: 'named-character',
    +    begin: /\\\[[$a-zA-Z][$a-zA-Z0-9]+\]/
    +  };
    +
    +  const OPERATORS = {
    +    className: 'operator',
    +    relevance: 0,
    +    begin: /[+\-*/,;.:@~=><&|_`'^?!%]+/
    +  };
    +  const PATTERNS = {
    +    className: 'pattern',
    +    relevance: 0,
    +    begin: /([a-zA-Z$][a-zA-Z0-9$]*)?_+([a-zA-Z$][a-zA-Z0-9$]*)?/
    +  };
    +
    +  const SLOTS = {
    +    className: 'slot',
    +    relevance: 0,
    +    begin: /#[a-zA-Z$][a-zA-Z0-9$]*|#+[0-9]?/
    +  };
    +
    +  const BRACES = {
    +    className: 'brace',
    +    relevance: 0,
    +    begin: /[[\](){}]/
    +  };
    +
    +  const MESSAGES = {
    +    className: 'message-name',
    +    relevance: 0,
    +    begin: concat("::", SYMBOL_RE)
    +  };
    +
    +  return {
    +    name: 'Mathematica',
    +    aliases: [
    +      'mma',
    +      'wl'
    +    ],
    +    classNameAliases: {
    +      brace: 'punctuation',
    +      pattern: 'type',
    +      slot: 'type',
    +      symbol: 'variable',
    +      'named-character': 'variable',
    +      'builtin-symbol': 'built_in',
    +      'message-name': 'string'
    +    },
    +    contains: [
    +      hljs.COMMENT(/\(\*/, /\*\)/, {
    +        contains: [ 'self' ]
    +      }),
    +      PATTERNS,
    +      SLOTS,
    +      MESSAGES,
    +      SYMBOLS,
    +      NAMED_CHARACTER,
    +      hljs.QUOTE_STRING_MODE,
    +      NUMBERS,
    +      OPERATORS,
    +      BRACES
    +    ]
    +  };
    +}
    +
    +module.exports = mathematica;
    diff --git a/node_modules/highlight.js/lib/languages/matlab.js b/node_modules/highlight.js/lib/languages/matlab.js
    new file mode 100644
    index 0000000..af05c3d
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/matlab.js
    @@ -0,0 +1,106 @@
    +/*
    +Language: Matlab
    +Author: Denis Bardadym 
    +Contributors: Eugene Nizhibitsky , Egor Rogov 
    +Website: https://www.mathworks.com/products/matlab.html
    +Category: scientific
    +*/
    +
    +/*
    +  Formal syntax is not published, helpful link:
    +  https://github.com/kornilova-l/matlab-IntelliJ-plugin/blob/master/src/main/grammar/Matlab.bnf
    +*/
    +function matlab(hljs) {
    +
    +  var TRANSPOSE_RE = '(\'|\\.\')+';
    +  var TRANSPOSE = {
    +    relevance: 0,
    +    contains: [
    +      { begin: TRANSPOSE_RE }
    +    ]
    +  };
    +
    +  return {
    +    name: 'Matlab',
    +    keywords: {
    +      keyword:
    +        'arguments break case catch classdef continue else elseif end enumeration events for function ' +
    +        'global if methods otherwise parfor persistent properties return spmd switch try while',
    +      built_in:
    +        'sin sind sinh asin asind asinh cos cosd cosh acos acosd acosh tan tand tanh atan ' +
    +        'atand atan2 atanh sec secd sech asec asecd asech csc cscd csch acsc acscd acsch cot ' +
    +        'cotd coth acot acotd acoth hypot exp expm1 log log1p log10 log2 pow2 realpow reallog ' +
    +        'realsqrt sqrt nthroot nextpow2 abs angle complex conj imag real unwrap isreal ' +
    +        'cplxpair fix floor ceil round mod rem sign airy besselj bessely besselh besseli ' +
    +        'besselk beta betainc betaln ellipj ellipke erf erfc erfcx erfinv expint gamma ' +
    +        'gammainc gammaln psi legendre cross dot factor isprime primes gcd lcm rat rats perms ' +
    +        'nchoosek factorial cart2sph cart2pol pol2cart sph2cart hsv2rgb rgb2hsv zeros ones ' +
    +        'eye repmat rand randn linspace logspace freqspace meshgrid accumarray size length ' +
    +        'ndims numel disp isempty isequal isequalwithequalnans cat reshape diag blkdiag tril ' +
    +        'triu fliplr flipud flipdim rot90 find sub2ind ind2sub bsxfun ndgrid permute ipermute ' +
    +        'shiftdim circshift squeeze isscalar isvector ans eps realmax realmin pi i|0 inf nan ' +
    +        'isnan isinf isfinite j|0 why compan gallery hadamard hankel hilb invhilb magic pascal ' +
    +        'rosser toeplitz vander wilkinson max min nanmax nanmin mean nanmean type table ' +
    +        'readtable writetable sortrows sort figure plot plot3 scatter scatter3 cellfun ' +
    +        'legend intersect ismember procrustes hold num2cell '
    +    },
    +    illegal: '(//|"|#|/\\*|\\s+/\\w+)',
    +    contains: [
    +      {
    +        className: 'function',
    +        beginKeywords: 'function', end: '$',
    +        contains: [
    +          hljs.UNDERSCORE_TITLE_MODE,
    +          {
    +            className: 'params',
    +            variants: [
    +              {begin: '\\(', end: '\\)'},
    +              {begin: '\\[', end: '\\]'}
    +            ]
    +          }
    +        ]
    +      },
    +      {
    +        className: 'built_in',
    +        begin: /true|false/,
    +        relevance: 0,
    +        starts: TRANSPOSE
    +      },
    +      {
    +        begin: '[a-zA-Z][a-zA-Z_0-9]*' + TRANSPOSE_RE,
    +        relevance: 0
    +      },
    +      {
    +        className: 'number',
    +        begin: hljs.C_NUMBER_RE,
    +        relevance: 0,
    +        starts: TRANSPOSE
    +      },
    +      {
    +        className: 'string',
    +        begin: '\'', end: '\'',
    +        contains: [
    +          hljs.BACKSLASH_ESCAPE,
    +          {begin: '\'\''}]
    +      },
    +      {
    +        begin: /\]|\}|\)/,
    +        relevance: 0,
    +        starts: TRANSPOSE
    +      },
    +      {
    +        className: 'string',
    +        begin: '"', end: '"',
    +        contains: [
    +          hljs.BACKSLASH_ESCAPE,
    +          {begin: '""'}
    +        ],
    +        starts: TRANSPOSE
    +      },
    +      hljs.COMMENT('^\\s*%\\{\\s*$', '^\\s*%\\}\\s*$'),
    +      hljs.COMMENT('%', '$')
    +    ]
    +  };
    +}
    +
    +module.exports = matlab;
    diff --git a/node_modules/highlight.js/lib/languages/maxima.js b/node_modules/highlight.js/lib/languages/maxima.js
    new file mode 100644
    index 0000000..d0b210a
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/maxima.js
    @@ -0,0 +1,417 @@
    +/*
    +Language: Maxima
    +Author: Robert Dodier 
    +Website: http://maxima.sourceforge.net
    +Category: scientific
    +*/
    +
    +function maxima(hljs) {
    +  const KEYWORDS =
    +    'if then else elseif for thru do while unless step in and or not';
    +  const LITERALS =
    +    'true false unknown inf minf ind und %e %i %pi %phi %gamma';
    +  const BUILTIN_FUNCTIONS =
    +    ' abasep abs absint absolute_real_time acos acosh acot acoth acsc acsch activate' +
    +    ' addcol add_edge add_edges addmatrices addrow add_vertex add_vertices adjacency_matrix' +
    +    ' adjoin adjoint af agd airy airy_ai airy_bi airy_dai airy_dbi algsys alg_type' +
    +    ' alias allroots alphacharp alphanumericp amortization %and annuity_fv' +
    +    ' annuity_pv antid antidiff AntiDifference append appendfile apply apply1 apply2' +
    +    ' applyb1 apropos args arit_amortization arithmetic arithsum array arrayapply' +
    +    ' arrayinfo arraymake arraysetapply ascii asec asech asin asinh askinteger' +
    +    ' asksign assoc assoc_legendre_p assoc_legendre_q assume assume_external_byte_order' +
    +    ' asympa at atan atan2 atanh atensimp atom atvalue augcoefmatrix augmented_lagrangian_method' +
    +    ' av average_degree backtrace bars barsplot barsplot_description base64 base64_decode' +
    +    ' bashindices batch batchload bc2 bdvac belln benefit_cost bern bernpoly bernstein_approx' +
    +    ' bernstein_expand bernstein_poly bessel bessel_i bessel_j bessel_k bessel_simplify' +
    +    ' bessel_y beta beta_incomplete beta_incomplete_generalized beta_incomplete_regularized' +
    +    ' bezout bfallroots bffac bf_find_root bf_fmin_cobyla bfhzeta bfloat bfloatp' +
    +    ' bfpsi bfpsi0 bfzeta biconnected_components bimetric binomial bipartition' +
    +    ' block blockmatrixp bode_gain bode_phase bothcoef box boxplot boxplot_description' +
    +    ' break bug_report build_info|10 buildq build_sample burn cabs canform canten' +
    +    ' cardinality carg cartan cartesian_product catch cauchy_matrix cbffac cdf_bernoulli' +
    +    ' cdf_beta cdf_binomial cdf_cauchy cdf_chi2 cdf_continuous_uniform cdf_discrete_uniform' +
    +    ' cdf_exp cdf_f cdf_gamma cdf_general_finite_discrete cdf_geometric cdf_gumbel' +
    +    ' cdf_hypergeometric cdf_laplace cdf_logistic cdf_lognormal cdf_negative_binomial' +
    +    ' cdf_noncentral_chi2 cdf_noncentral_student_t cdf_normal cdf_pareto cdf_poisson' +
    +    ' cdf_rank_sum cdf_rayleigh cdf_signed_rank cdf_student_t cdf_weibull cdisplay' +
    +    ' ceiling central_moment cequal cequalignore cf cfdisrep cfexpand cgeodesic' +
    +    ' cgreaterp cgreaterpignore changename changevar chaosgame charat charfun charfun2' +
    +    ' charlist charp charpoly chdir chebyshev_t chebyshev_u checkdiv check_overlaps' +
    +    ' chinese cholesky christof chromatic_index chromatic_number cint circulant_graph' +
    +    ' clear_edge_weight clear_rules clear_vertex_label clebsch_gordan clebsch_graph' +
    +    ' clessp clesspignore close closefile cmetric coeff coefmatrix cograd col collapse' +
    +    ' collectterms columnop columnspace columnswap columnvector combination combine' +
    +    ' comp2pui compare compfile compile compile_file complement_graph complete_bipartite_graph' +
    +    ' complete_graph complex_number_p components compose_functions concan concat' +
    +    ' conjugate conmetderiv connected_components connect_vertices cons constant' +
    +    ' constantp constituent constvalue cont2part content continuous_freq contortion' +
    +    ' contour_plot contract contract_edge contragrad contrib_ode convert coord' +
    +    ' copy copy_file copy_graph copylist copymatrix cor cos cosh cot coth cov cov1' +
    +    ' covdiff covect covers crc24sum create_graph create_list csc csch csetup cspline' +
    +    ' ctaylor ct_coordsys ctransform ctranspose cube_graph cuboctahedron_graph' +
    +    ' cunlisp cv cycle_digraph cycle_graph cylindrical days360 dblint deactivate' +
    +    ' declare declare_constvalue declare_dimensions declare_fundamental_dimensions' +
    +    ' declare_fundamental_units declare_qty declare_translated declare_unit_conversion' +
    +    ' declare_units declare_weights decsym defcon define define_alt_display define_variable' +
    +    ' defint defmatch defrule defstruct deftaylor degree_sequence del delete deleten' +
    +    ' delta demo demoivre denom depends derivdegree derivlist describe desolve' +
    +    ' determinant dfloat dgauss_a dgauss_b dgeev dgemm dgeqrf dgesv dgesvd diag' +
    +    ' diagmatrix diag_matrix diagmatrixp diameter diff digitcharp dimacs_export' +
    +    ' dimacs_import dimension dimensionless dimensions dimensions_as_list direct' +
    +    ' directory discrete_freq disjoin disjointp disolate disp dispcon dispform' +
    +    ' dispfun dispJordan display disprule dispterms distrib divide divisors divsum' +
    +    ' dkummer_m dkummer_u dlange dodecahedron_graph dotproduct dotsimp dpart' +
    +    ' draw draw2d draw3d drawdf draw_file draw_graph dscalar echelon edge_coloring' +
    +    ' edge_connectivity edges eigens_by_jacobi eigenvalues eigenvectors eighth' +
    +    ' einstein eivals eivects elapsed_real_time elapsed_run_time ele2comp ele2polynome' +
    +    ' ele2pui elem elementp elevation_grid elim elim_allbut eliminate eliminate_using' +
    +    ' ellipse elliptic_e elliptic_ec elliptic_eu elliptic_f elliptic_kc elliptic_pi' +
    +    ' ematrix empty_graph emptyp endcons entermatrix entertensor entier equal equalp' +
    +    ' equiv_classes erf erfc erf_generalized erfi errcatch error errormsg errors' +
    +    ' euler ev eval_string evenp every evolution evolution2d evundiff example exp' +
    +    ' expand expandwrt expandwrt_factored expint expintegral_chi expintegral_ci' +
    +    ' expintegral_e expintegral_e1 expintegral_ei expintegral_e_simplify expintegral_li' +
    +    ' expintegral_shi expintegral_si explicit explose exponentialize express expt' +
    +    ' exsec extdiff extract_linear_equations extremal_subset ezgcd %f f90 facsum' +
    +    ' factcomb factor factorfacsum factorial factorout factorsum facts fast_central_elements' +
    +    ' fast_linsolve fasttimes featurep fernfale fft fib fibtophi fifth filename_merge' +
    +    ' file_search file_type fillarray findde find_root find_root_abs find_root_error' +
    +    ' find_root_rel first fix flatten flength float floatnump floor flower_snark' +
    +    ' flush flush1deriv flushd flushnd flush_output fmin_cobyla forget fortran' +
    +    ' fourcos fourexpand fourier fourier_elim fourint fourintcos fourintsin foursimp' +
    +    ' foursin fourth fposition frame_bracket freeof freshline fresnel_c fresnel_s' +
    +    ' from_adjacency_matrix frucht_graph full_listify fullmap fullmapl fullratsimp' +
    +    ' fullratsubst fullsetify funcsolve fundamental_dimensions fundamental_units' +
    +    ' fundef funmake funp fv g0 g1 gamma gamma_greek gamma_incomplete gamma_incomplete_generalized' +
    +    ' gamma_incomplete_regularized gauss gauss_a gauss_b gaussprob gcd gcdex gcdivide' +
    +    ' gcfac gcfactor gd generalized_lambert_w genfact gen_laguerre genmatrix gensym' +
    +    ' geo_amortization geo_annuity_fv geo_annuity_pv geomap geometric geometric_mean' +
    +    ' geosum get getcurrentdirectory get_edge_weight getenv get_lu_factors get_output_stream_string' +
    +    ' get_pixel get_plot_option get_tex_environment get_tex_environment_default' +
    +    ' get_vertex_label gfactor gfactorsum ggf girth global_variances gn gnuplot_close' +
    +    ' gnuplot_replot gnuplot_reset gnuplot_restart gnuplot_start go Gosper GosperSum' +
    +    ' gr2d gr3d gradef gramschmidt graph6_decode graph6_encode graph6_export graph6_import' +
    +    ' graph_center graph_charpoly graph_eigenvalues graph_flow graph_order graph_periphery' +
    +    ' graph_product graph_size graph_union great_rhombicosidodecahedron_graph great_rhombicuboctahedron_graph' +
    +    ' grid_graph grind grobner_basis grotzch_graph hamilton_cycle hamilton_path' +
    +    ' hankel hankel_1 hankel_2 harmonic harmonic_mean hav heawood_graph hermite' +
    +    ' hessian hgfred hilbertmap hilbert_matrix hipow histogram histogram_description' +
    +    ' hodge horner hypergeometric i0 i1 %ibes ic1 ic2 ic_convert ichr1 ichr2 icosahedron_graph' +
    +    ' icosidodecahedron_graph icurvature ident identfor identity idiff idim idummy' +
    +    ' ieqn %if ifactors iframes ifs igcdex igeodesic_coords ilt image imagpart' +
    +    ' imetric implicit implicit_derivative implicit_plot indexed_tensor indices' +
    +    ' induced_subgraph inferencep inference_result infix info_display init_atensor' +
    +    ' init_ctensor in_neighbors innerproduct inpart inprod inrt integerp integer_partitions' +
    +    ' integrate intersect intersection intervalp intopois intosum invariant1 invariant2' +
    +    ' inverse_fft inverse_jacobi_cd inverse_jacobi_cn inverse_jacobi_cs inverse_jacobi_dc' +
    +    ' inverse_jacobi_dn inverse_jacobi_ds inverse_jacobi_nc inverse_jacobi_nd inverse_jacobi_ns' +
    +    ' inverse_jacobi_sc inverse_jacobi_sd inverse_jacobi_sn invert invert_by_adjoint' +
    +    ' invert_by_lu inv_mod irr is is_biconnected is_bipartite is_connected is_digraph' +
    +    ' is_edge_in_graph is_graph is_graph_or_digraph ishow is_isomorphic isolate' +
    +    ' isomorphism is_planar isqrt isreal_p is_sconnected is_tree is_vertex_in_graph' +
    +    ' items_inference %j j0 j1 jacobi jacobian jacobi_cd jacobi_cn jacobi_cs jacobi_dc' +
    +    ' jacobi_dn jacobi_ds jacobi_nc jacobi_nd jacobi_ns jacobi_p jacobi_sc jacobi_sd' +
    +    ' jacobi_sn JF jn join jordan julia julia_set julia_sin %k kdels kdelta kill' +
    +    ' killcontext kostka kron_delta kronecker_product kummer_m kummer_u kurtosis' +
    +    ' kurtosis_bernoulli kurtosis_beta kurtosis_binomial kurtosis_chi2 kurtosis_continuous_uniform' +
    +    ' kurtosis_discrete_uniform kurtosis_exp kurtosis_f kurtosis_gamma kurtosis_general_finite_discrete' +
    +    ' kurtosis_geometric kurtosis_gumbel kurtosis_hypergeometric kurtosis_laplace' +
    +    ' kurtosis_logistic kurtosis_lognormal kurtosis_negative_binomial kurtosis_noncentral_chi2' +
    +    ' kurtosis_noncentral_student_t kurtosis_normal kurtosis_pareto kurtosis_poisson' +
    +    ' kurtosis_rayleigh kurtosis_student_t kurtosis_weibull label labels lagrange' +
    +    ' laguerre lambda lambert_w laplace laplacian_matrix last lbfgs lc2kdt lcharp' +
    +    ' lc_l lcm lc_u ldefint ldisp ldisplay legendre_p legendre_q leinstein length' +
    +    ' let letrules letsimp levi_civita lfreeof lgtreillis lhs li liediff limit' +
    +    ' Lindstedt linear linearinterpol linear_program linear_regression line_graph' +
    +    ' linsolve listarray list_correlations listify list_matrix_entries list_nc_monomials' +
    +    ' listoftens listofvars listp lmax lmin load loadfile local locate_matrix_entry' +
    +    ' log logcontract log_gamma lopow lorentz_gauge lowercasep lpart lratsubst' +
    +    ' lreduce lriemann lsquares_estimates lsquares_estimates_approximate lsquares_estimates_exact' +
    +    ' lsquares_mse lsquares_residual_mse lsquares_residuals lsum ltreillis lu_backsub' +
    +    ' lucas lu_factor %m macroexpand macroexpand1 make_array makebox makefact makegamma' +
    +    ' make_graph make_level_picture makelist makeOrders make_poly_continent make_poly_country' +
    +    ' make_polygon make_random_state make_rgb_picture makeset make_string_input_stream' +
    +    ' make_string_output_stream make_transform mandelbrot mandelbrot_set map mapatom' +
    +    ' maplist matchdeclare matchfix mat_cond mat_fullunblocker mat_function mathml_display' +
    +    ' mat_norm matrix matrixmap matrixp matrix_size mattrace mat_trace mat_unblocker' +
    +    ' max max_clique max_degree max_flow maximize_lp max_independent_set max_matching' +
    +    ' maybe md5sum mean mean_bernoulli mean_beta mean_binomial mean_chi2 mean_continuous_uniform' +
    +    ' mean_deviation mean_discrete_uniform mean_exp mean_f mean_gamma mean_general_finite_discrete' +
    +    ' mean_geometric mean_gumbel mean_hypergeometric mean_laplace mean_logistic' +
    +    ' mean_lognormal mean_negative_binomial mean_noncentral_chi2 mean_noncentral_student_t' +
    +    ' mean_normal mean_pareto mean_poisson mean_rayleigh mean_student_t mean_weibull' +
    +    ' median median_deviation member mesh metricexpandall mgf1_sha1 min min_degree' +
    +    ' min_edge_cut minfactorial minimalPoly minimize_lp minimum_spanning_tree minor' +
    +    ' minpack_lsquares minpack_solve min_vertex_cover min_vertex_cut mkdir mnewton' +
    +    ' mod mode_declare mode_identity ModeMatrix moebius mon2schur mono monomial_dimensions' +
    +    ' multibernstein_poly multi_display_for_texinfo multi_elem multinomial multinomial_coeff' +
    +    ' multi_orbit multiplot_mode multi_pui multsym multthru mycielski_graph nary' +
    +    ' natural_unit nc_degree ncexpt ncharpoly negative_picture neighbors new newcontext' +
    +    ' newdet new_graph newline newton new_variable next_prime nicedummies niceindices' +
    +    ' ninth nofix nonarray noncentral_moment nonmetricity nonnegintegerp nonscalarp' +
    +    ' nonzeroandfreeof notequal nounify nptetrad npv nroots nterms ntermst' +
    +    ' nthroot nullity nullspace num numbered_boundaries numberp number_to_octets' +
    +    ' num_distinct_partitions numerval numfactor num_partitions nusum nzeta nzetai' +
    +    ' nzetar octets_to_number octets_to_oid odd_girth oddp ode2 ode_check odelin' +
    +    ' oid_to_octets op opena opena_binary openr openr_binary openw openw_binary' +
    +    ' operatorp opsubst optimize %or orbit orbits ordergreat ordergreatp orderless' +
    +    ' orderlessp orthogonal_complement orthopoly_recur orthopoly_weight outermap' +
    +    ' out_neighbors outofpois pade parabolic_cylinder_d parametric parametric_surface' +
    +    ' parg parGosper parse_string parse_timedate part part2cont partfrac partition' +
    +    ' partition_set partpol path_digraph path_graph pathname_directory pathname_name' +
    +    ' pathname_type pdf_bernoulli pdf_beta pdf_binomial pdf_cauchy pdf_chi2 pdf_continuous_uniform' +
    +    ' pdf_discrete_uniform pdf_exp pdf_f pdf_gamma pdf_general_finite_discrete' +
    +    ' pdf_geometric pdf_gumbel pdf_hypergeometric pdf_laplace pdf_logistic pdf_lognormal' +
    +    ' pdf_negative_binomial pdf_noncentral_chi2 pdf_noncentral_student_t pdf_normal' +
    +    ' pdf_pareto pdf_poisson pdf_rank_sum pdf_rayleigh pdf_signed_rank pdf_student_t' +
    +    ' pdf_weibull pearson_skewness permanent permut permutation permutations petersen_graph' +
    +    ' petrov pickapart picture_equalp picturep piechart piechart_description planar_embedding' +
    +    ' playback plog plot2d plot3d plotdf ploteq plsquares pochhammer points poisdiff' +
    +    ' poisexpt poisint poismap poisplus poissimp poissubst poistimes poistrim polar' +
    +    ' polarform polartorect polar_to_xy poly_add poly_buchberger poly_buchberger_criterion' +
    +    ' poly_colon_ideal poly_content polydecomp poly_depends_p poly_elimination_ideal' +
    +    ' poly_exact_divide poly_expand poly_expt poly_gcd polygon poly_grobner poly_grobner_equal' +
    +    ' poly_grobner_member poly_grobner_subsetp poly_ideal_intersection poly_ideal_polysaturation' +
    +    ' poly_ideal_polysaturation1 poly_ideal_saturation poly_ideal_saturation1 poly_lcm' +
    +    ' poly_minimization polymod poly_multiply polynome2ele polynomialp poly_normal_form' +
    +    ' poly_normalize poly_normalize_list poly_polysaturation_extension poly_primitive_part' +
    +    ' poly_pseudo_divide poly_reduced_grobner poly_reduction poly_saturation_extension' +
    +    ' poly_s_polynomial poly_subtract polytocompanion pop postfix potential power_mod' +
    +    ' powerseries powerset prefix prev_prime primep primes principal_components' +
    +    ' print printf printfile print_graph printpois printprops prodrac product properties' +
    +    ' propvars psi psubst ptriangularize pui pui2comp pui2ele pui2polynome pui_direct' +
    +    ' puireduc push put pv qput qrange qty quad_control quad_qag quad_qagi quad_qagp' +
    +    ' quad_qags quad_qawc quad_qawf quad_qawo quad_qaws quadrilateral quantile' +
    +    ' quantile_bernoulli quantile_beta quantile_binomial quantile_cauchy quantile_chi2' +
    +    ' quantile_continuous_uniform quantile_discrete_uniform quantile_exp quantile_f' +
    +    ' quantile_gamma quantile_general_finite_discrete quantile_geometric quantile_gumbel' +
    +    ' quantile_hypergeometric quantile_laplace quantile_logistic quantile_lognormal' +
    +    ' quantile_negative_binomial quantile_noncentral_chi2 quantile_noncentral_student_t' +
    +    ' quantile_normal quantile_pareto quantile_poisson quantile_rayleigh quantile_student_t' +
    +    ' quantile_weibull quartile_skewness quit qunit quotient racah_v racah_w radcan' +
    +    ' radius random random_bernoulli random_beta random_binomial random_bipartite_graph' +
    +    ' random_cauchy random_chi2 random_continuous_uniform random_digraph random_discrete_uniform' +
    +    ' random_exp random_f random_gamma random_general_finite_discrete random_geometric' +
    +    ' random_graph random_graph1 random_gumbel random_hypergeometric random_laplace' +
    +    ' random_logistic random_lognormal random_negative_binomial random_network' +
    +    ' random_noncentral_chi2 random_noncentral_student_t random_normal random_pareto' +
    +    ' random_permutation random_poisson random_rayleigh random_regular_graph random_student_t' +
    +    ' random_tournament random_tree random_weibull range rank rat ratcoef ratdenom' +
    +    ' ratdiff ratdisrep ratexpand ratinterpol rational rationalize ratnumer ratnump' +
    +    ' ratp ratsimp ratsubst ratvars ratweight read read_array read_binary_array' +
    +    ' read_binary_list read_binary_matrix readbyte readchar read_hashed_array readline' +
    +    ' read_list read_matrix read_nested_list readonly read_xpm real_imagpart_to_conjugate' +
    +    ' realpart realroots rearray rectangle rectform rectform_log_if_constant recttopolar' +
    +    ' rediff reduce_consts reduce_order region region_boundaries region_boundaries_plus' +
    +    ' rem remainder remarray rembox remcomps remcon remcoord remfun remfunction' +
    +    ' remlet remove remove_constvalue remove_dimensions remove_edge remove_fundamental_dimensions' +
    +    ' remove_fundamental_units remove_plot_option remove_vertex rempart remrule' +
    +    ' remsym remvalue rename rename_file reset reset_displays residue resolvante' +
    +    ' resolvante_alternee1 resolvante_bipartite resolvante_diedrale resolvante_klein' +
    +    ' resolvante_klein3 resolvante_produit_sym resolvante_unitaire resolvante_vierer' +
    +    ' rest resultant return reveal reverse revert revert2 rgb2level rhs ricci riemann' +
    +    ' rinvariant risch rk rmdir rncombine romberg room rootscontract round row' +
    +    ' rowop rowswap rreduce run_testsuite %s save saving scalarp scaled_bessel_i' +
    +    ' scaled_bessel_i0 scaled_bessel_i1 scalefactors scanmap scatterplot scatterplot_description' +
    +    ' scene schur2comp sconcat scopy scsimp scurvature sdowncase sec sech second' +
    +    ' sequal sequalignore set_alt_display setdifference set_draw_defaults set_edge_weight' +
    +    ' setelmx setequalp setify setp set_partitions set_plot_option set_prompt set_random_state' +
    +    ' set_tex_environment set_tex_environment_default setunits setup_autoload set_up_dot_simplifications' +
    +    ' set_vertex_label seventh sexplode sf sha1sum sha256sum shortest_path shortest_weighted_path' +
    +    ' show showcomps showratvars sierpinskiale sierpinskimap sign signum similaritytransform' +
    +    ' simp_inequality simplify_sum simplode simpmetderiv simtran sin sinh sinsert' +
    +    ' sinvertcase sixth skewness skewness_bernoulli skewness_beta skewness_binomial' +
    +    ' skewness_chi2 skewness_continuous_uniform skewness_discrete_uniform skewness_exp' +
    +    ' skewness_f skewness_gamma skewness_general_finite_discrete skewness_geometric' +
    +    ' skewness_gumbel skewness_hypergeometric skewness_laplace skewness_logistic' +
    +    ' skewness_lognormal skewness_negative_binomial skewness_noncentral_chi2 skewness_noncentral_student_t' +
    +    ' skewness_normal skewness_pareto skewness_poisson skewness_rayleigh skewness_student_t' +
    +    ' skewness_weibull slength smake small_rhombicosidodecahedron_graph small_rhombicuboctahedron_graph' +
    +    ' smax smin smismatch snowmap snub_cube_graph snub_dodecahedron_graph solve' +
    +    ' solve_rec solve_rec_rat some somrac sort sparse6_decode sparse6_encode sparse6_export' +
    +    ' sparse6_import specint spherical spherical_bessel_j spherical_bessel_y spherical_hankel1' +
    +    ' spherical_hankel2 spherical_harmonic spherical_to_xyz splice split sposition' +
    +    ' sprint sqfr sqrt sqrtdenest sremove sremovefirst sreverse ssearch ssort sstatus' +
    +    ' ssubst ssubstfirst staircase standardize standardize_inverse_trig starplot' +
    +    ' starplot_description status std std1 std_bernoulli std_beta std_binomial' +
    +    ' std_chi2 std_continuous_uniform std_discrete_uniform std_exp std_f std_gamma' +
    +    ' std_general_finite_discrete std_geometric std_gumbel std_hypergeometric std_laplace' +
    +    ' std_logistic std_lognormal std_negative_binomial std_noncentral_chi2 std_noncentral_student_t' +
    +    ' std_normal std_pareto std_poisson std_rayleigh std_student_t std_weibull' +
    +    ' stemplot stirling stirling1 stirling2 strim striml strimr string stringout' +
    +    ' stringp strong_components struve_h struve_l sublis sublist sublist_indices' +
    +    ' submatrix subsample subset subsetp subst substinpart subst_parallel substpart' +
    +    ' substring subvar subvarp sum sumcontract summand_to_rec supcase supcontext' +
    +    ' symbolp symmdifference symmetricp system take_channel take_inference tan' +
    +    ' tanh taylor taylorinfo taylorp taylor_simplifier taytorat tcl_output tcontract' +
    +    ' tellrat tellsimp tellsimpafter tentex tenth test_mean test_means_difference' +
    +    ' test_normality test_proportion test_proportions_difference test_rank_sum' +
    +    ' test_sign test_signed_rank test_variance test_variance_ratio tex tex1 tex_display' +
    +    ' texput %th third throw time timedate timer timer_info tldefint tlimit todd_coxeter' +
    +    ' toeplitz tokens to_lisp topological_sort to_poly to_poly_solve totaldisrep' +
    +    ' totalfourier totient tpartpol trace tracematrix trace_options transform_sample' +
    +    ' translate translate_file transpose treefale tree_reduce treillis treinat' +
    +    ' triangle triangularize trigexpand trigrat trigreduce trigsimp trunc truncate' +
    +    ' truncated_cube_graph truncated_dodecahedron_graph truncated_icosahedron_graph' +
    +    ' truncated_tetrahedron_graph tr_warnings_get tube tutte_graph ueivects uforget' +
    +    ' ultraspherical underlying_graph undiff union unique uniteigenvectors unitp' +
    +    ' units unit_step unitvector unorder unsum untellrat untimer' +
    +    ' untrace uppercasep uricci uriemann uvect vandermonde_matrix var var1 var_bernoulli' +
    +    ' var_beta var_binomial var_chi2 var_continuous_uniform var_discrete_uniform' +
    +    ' var_exp var_f var_gamma var_general_finite_discrete var_geometric var_gumbel' +
    +    ' var_hypergeometric var_laplace var_logistic var_lognormal var_negative_binomial' +
    +    ' var_noncentral_chi2 var_noncentral_student_t var_normal var_pareto var_poisson' +
    +    ' var_rayleigh var_student_t var_weibull vector vectorpotential vectorsimp' +
    +    ' verbify vers vertex_coloring vertex_connectivity vertex_degree vertex_distance' +
    +    ' vertex_eccentricity vertex_in_degree vertex_out_degree vertices vertices_to_cycle' +
    +    ' vertices_to_path %w weyl wheel_graph wiener_index wigner_3j wigner_6j' +
    +    ' wigner_9j with_stdout write_binary_data writebyte write_data writefile wronskian' +
    +    ' xreduce xthru %y Zeilberger zeroequiv zerofor zeromatrix zeromatrixp zeta' +
    +    ' zgeev zheev zlange zn_add_table zn_carmichael_lambda zn_characteristic_factors' +
    +    ' zn_determinant zn_factor_generators zn_invert_by_lu zn_log zn_mult_table' +
    +    ' absboxchar activecontexts adapt_depth additive adim aform algebraic' +
    +    ' algepsilon algexact aliases allbut all_dotsimp_denoms allocation allsym alphabetic' +
    +    ' animation antisymmetric arrays askexp assume_pos assume_pos_pred assumescalar' +
    +    ' asymbol atomgrad atrig1 axes axis_3d axis_bottom axis_left axis_right axis_top' +
    +    ' azimuth background background_color backsubst berlefact bernstein_explicit' +
    +    ' besselexpand beta_args_sum_to_integer beta_expand bftorat bftrunc bindtest' +
    +    ' border boundaries_array box boxchar breakup %c capping cauchysum cbrange' +
    +    ' cbtics center cflength cframe_flag cnonmet_flag color color_bar color_bar_tics' +
    +    ' colorbox columns commutative complex cone context contexts contour contour_levels' +
    +    ' cosnpiflag ctaypov ctaypt ctayswitch ctayvar ct_coords ctorsion_flag ctrgsimp' +
    +    ' cube current_let_rule_package cylinder data_file_name debugmode decreasing' +
    +    ' default_let_rule_package delay dependencies derivabbrev derivsubst detout' +
    +    ' diagmetric diff dim dimensions dispflag display2d|10 display_format_internal' +
    +    ' distribute_over doallmxops domain domxexpt domxmxops domxnctimes dontfactor' +
    +    ' doscmxops doscmxplus dot0nscsimp dot0simp dot1simp dotassoc dotconstrules' +
    +    ' dotdistrib dotexptsimp dotident dotscrules draw_graph_program draw_realpart' +
    +    ' edge_color edge_coloring edge_partition edge_type edge_width %edispflag' +
    +    ' elevation %emode endphi endtheta engineering_format_floats enhanced3d %enumer' +
    +    ' epsilon_lp erfflag erf_representation errormsg error_size error_syms error_type' +
    +    ' %e_to_numlog eval even evenfun evflag evfun ev_point expandwrt_denom expintexpand' +
    +    ' expintrep expon expop exptdispflag exptisolate exptsubst facexpand facsum_combine' +
    +    ' factlim factorflag factorial_expand factors_only fb feature features' +
    +    ' file_name file_output_append file_search_demo file_search_lisp file_search_maxima|10' +
    +    ' file_search_tests file_search_usage file_type_lisp file_type_maxima|10 fill_color' +
    +    ' fill_density filled_func fixed_vertices flipflag float2bf font font_size' +
    +    ' fortindent fortspaces fpprec fpprintprec functions gamma_expand gammalim' +
    +    ' gdet genindex gensumnum GGFCFMAX GGFINFINITY globalsolve gnuplot_command' +
    +    ' gnuplot_curve_styles gnuplot_curve_titles gnuplot_default_term_command gnuplot_dumb_term_command' +
    +    ' gnuplot_file_args gnuplot_file_name gnuplot_out_file gnuplot_pdf_term_command' +
    +    ' gnuplot_pm3d gnuplot_png_term_command gnuplot_postamble gnuplot_preamble' +
    +    ' gnuplot_ps_term_command gnuplot_svg_term_command gnuplot_term gnuplot_view_args' +
    +    ' Gosper_in_Zeilberger gradefs grid grid2d grind halfangles head_angle head_both' +
    +    ' head_length head_type height hypergeometric_representation %iargs ibase' +
    +    ' icc1 icc2 icounter idummyx ieqnprint ifb ifc1 ifc2 ifg ifgi ifr iframe_bracket_form' +
    +    ' ifri igeowedge_flag ikt1 ikt2 imaginary inchar increasing infeval' +
    +    ' infinity inflag infolists inm inmc1 inmc2 intanalysis integer integervalued' +
    +    ' integrate_use_rootsof integration_constant integration_constant_counter interpolate_color' +
    +    ' intfaclim ip_grid ip_grid_in irrational isolate_wrt_times iterations itr' +
    +    ' julia_parameter %k1 %k2 keepfloat key key_pos kinvariant kt label label_alignment' +
    +    ' label_orientation labels lassociative lbfgs_ncorrections lbfgs_nfeval_max' +
    +    ' leftjust legend letrat let_rule_packages lfg lg lhospitallim limsubst linear' +
    +    ' linear_solver linechar linel|10 linenum line_type linewidth line_width linsolve_params' +
    +    ' linsolvewarn lispdisp listarith listconstvars listdummyvars lmxchar load_pathname' +
    +    ' loadprint logabs logarc logcb logconcoeffp logexpand lognegint logsimp logx' +
    +    ' logx_secondary logy logy_secondary logz lriem m1pbranch macroexpansion macros' +
    +    ' mainvar manual_demo maperror mapprint matrix_element_add matrix_element_mult' +
    +    ' matrix_element_transpose maxapplydepth maxapplyheight maxima_tempdir|10 maxima_userdir|10' +
    +    ' maxnegex MAX_ORD maxposex maxpsifracdenom maxpsifracnum maxpsinegint maxpsiposint' +
    +    ' maxtayorder mesh_lines_color method mod_big_prime mode_check_errorp' +
    +    ' mode_checkp mode_check_warnp mod_test mod_threshold modular_linear_solver' +
    +    ' modulus multiplicative multiplicities myoptions nary negdistrib negsumdispflag' +
    +    ' newline newtonepsilon newtonmaxiter nextlayerfactor niceindicespref nm nmc' +
    +    ' noeval nolabels nonegative_lp noninteger nonscalar noun noundisp nouns np' +
    +    ' npi nticks ntrig numer numer_pbranch obase odd oddfun opacity opproperties' +
    +    ' opsubst optimprefix optionset orientation origin orthopoly_returns_intervals' +
    +    ' outative outchar packagefile palette partswitch pdf_file pfeformat phiresolution' +
    +    ' %piargs piece pivot_count_sx pivot_max_sx plot_format plot_options plot_realpart' +
    +    ' png_file pochhammer_max_index points pointsize point_size points_joined point_type' +
    +    ' poislim poisson poly_coefficient_ring poly_elimination_order polyfactor poly_grobner_algorithm' +
    +    ' poly_grobner_debug poly_monomial_order poly_primary_elimination_order poly_return_term_list' +
    +    ' poly_secondary_elimination_order poly_top_reduction_only posfun position' +
    +    ' powerdisp pred prederror primep_number_of_tests product_use_gamma program' +
    +    ' programmode promote_float_to_bigfloat prompt proportional_axes props psexpand' +
    +    ' ps_file radexpand radius radsubstflag rassociative ratalgdenom ratchristof' +
    +    ' ratdenomdivide rateinstein ratepsilon ratfac rational ratmx ratprint ratriemann' +
    +    ' ratsimpexpons ratvarswitch ratweights ratweyl ratwtlvl real realonly redraw' +
    +    ' refcheck resolution restart resultant ric riem rmxchar %rnum_list rombergabs' +
    +    ' rombergit rombergmin rombergtol rootsconmode rootsepsilon run_viewer same_xy' +
    +    ' same_xyz savedef savefactors scalar scalarmatrixp scale scale_lp setcheck' +
    +    ' setcheckbreak setval show_edge_color show_edges show_edge_type show_edge_width' +
    +    ' show_id show_label showtime show_vertex_color show_vertex_size show_vertex_type' +
    +    ' show_vertices show_weight simp simplified_output simplify_products simpproduct' +
    +    ' simpsum sinnpiflag solvedecomposes solveexplicit solvefactors solvenullwarn' +
    +    ' solveradcan solvetrigwarn space sparse sphere spring_embedding_depth sqrtdispflag' +
    +    ' stardisp startphi starttheta stats_numer stringdisp structures style sublis_apply_lambda' +
    +    ' subnumsimp sumexpand sumsplitfact surface surface_hide svg_file symmetric' +
    +    ' tab taylordepth taylor_logexpand taylor_order_coefficients taylor_truncate_polynomials' +
    +    ' tensorkill terminal testsuite_files thetaresolution timer_devalue title tlimswitch' +
    +    ' tr track transcompile transform transform_xy translate_fast_arrays transparent' +
    +    ' transrun tr_array_as_ref tr_bound_function_applyp tr_file_tty_messagesp tr_float_can_branch_complex' +
    +    ' tr_function_call_default trigexpandplus trigexpandtimes triginverses trigsign' +
    +    ' trivial_solutions tr_numer tr_optimize_max_loop tr_semicompile tr_state_vars' +
    +    ' tr_warn_bad_function_calls tr_warn_fexpr tr_warn_meval tr_warn_mode' +
    +    ' tr_warn_undeclared tr_warn_undefined_variable tstep ttyoff tube_extremes' +
    +    ' ufg ug %unitexpand unit_vectors uric uriem use_fast_arrays user_preamble' +
    +    ' usersetunits values vect_cross verbose vertex_color vertex_coloring vertex_partition' +
    +    ' vertex_size vertex_type view warnings weyl width windowname windowtitle wired_surface' +
    +    ' wireframe xaxis xaxis_color xaxis_secondary xaxis_type xaxis_width xlabel' +
    +    ' xlabel_secondary xlength xrange xrange_secondary xtics xtics_axis xtics_rotate' +
    +    ' xtics_rotate_secondary xtics_secondary xtics_secondary_axis xu_grid x_voxel' +
    +    ' xy_file xyplane xy_scale yaxis yaxis_color yaxis_secondary yaxis_type yaxis_width' +
    +    ' ylabel ylabel_secondary ylength yrange yrange_secondary ytics ytics_axis' +
    +    ' ytics_rotate ytics_rotate_secondary ytics_secondary ytics_secondary_axis' +
    +    ' yv_grid y_voxel yx_ratio zaxis zaxis_color zaxis_type zaxis_width zeroa zerob' +
    +    ' zerobern zeta%pi zlabel zlabel_rotate zlength zmin zn_primroot_limit zn_primroot_pretest';
    +  const SYMBOLS = '_ __ %|0 %%|0';
    +
    +  return {
    +    name: 'Maxima',
    +    keywords: {
    +      $pattern: '[A-Za-z_%][0-9A-Za-z_%]*',
    +      keyword: KEYWORDS,
    +      literal: LITERALS,
    +      built_in: BUILTIN_FUNCTIONS,
    +      symbol: SYMBOLS
    +    },
    +    contains: [
    +      {
    +        className: 'comment',
    +        begin: '/\\*',
    +        end: '\\*/',
    +        contains: [ 'self' ]
    +      },
    +      hljs.QUOTE_STRING_MODE,
    +      {
    +        className: 'number',
    +        relevance: 0,
    +        variants: [
    +          {
    +            // float number w/ exponent
    +            // hmm, I wonder if we ought to include other exponent markers?
    +            begin: '\\b(\\d+|\\d+\\.|\\.\\d+|\\d+\\.\\d+)[Ee][-+]?\\d+\\b'
    +          },
    +          {
    +            // bigfloat number
    +            begin: '\\b(\\d+|\\d+\\.|\\.\\d+|\\d+\\.\\d+)[Bb][-+]?\\d+\\b',
    +            relevance: 10
    +          },
    +          {
    +            // float number w/out exponent
    +            // Doesn't seem to recognize floats which start with '.'
    +            begin: '\\b(\\.\\d+|\\d+\\.\\d+)\\b'
    +          },
    +          {
    +            // integer in base up to 36
    +            // Doesn't seem to recognize integers which end with '.'
    +            begin: '\\b(\\d+|0[0-9A-Za-z]+)\\.?\\b'
    +          }
    +        ]
    +      }
    +    ],
    +    illegal: /@/
    +  };
    +}
    +
    +module.exports = maxima;
    diff --git a/node_modules/highlight.js/lib/languages/mel.js b/node_modules/highlight.js/lib/languages/mel.js
    new file mode 100644
    index 0000000..6c66f67
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/mel.js
    @@ -0,0 +1,236 @@
    +/*
    +Language: MEL
    +Description: Maya Embedded Language
    +Author: Shuen-Huei Guan 
    +Website: http://www.autodesk.com/products/autodesk-maya/overview
    +Category: graphics
    +*/
    +
    +function mel(hljs) {
    +  return {
    +    name: 'MEL',
    +    keywords:
    +      'int float string vector matrix if else switch case default while do for in break ' +
    +      'continue global proc return about abs addAttr addAttributeEditorNodeHelp addDynamic ' +
    +      'addNewShelfTab addPP addPanelCategory addPrefixToName advanceToNextDrivenKey ' +
    +      'affectedNet affects aimConstraint air alias aliasAttr align alignCtx alignCurve ' +
    +      'alignSurface allViewFit ambientLight angle angleBetween animCone animCurveEditor ' +
    +      'animDisplay animView annotate appendStringArray applicationName applyAttrPreset ' +
    +      'applyTake arcLenDimContext arcLengthDimension arclen arrayMapper art3dPaintCtx ' +
    +      'artAttrCtx artAttrPaintVertexCtx artAttrSkinPaintCtx artAttrTool artBuildPaintMenu ' +
    +      'artFluidAttrCtx artPuttyCtx artSelectCtx artSetPaintCtx artUserPaintCtx assignCommand ' +
    +      'assignInputDevice assignViewportFactories attachCurve attachDeviceAttr attachSurface ' +
    +      'attrColorSliderGrp attrCompatibility attrControlGrp attrEnumOptionMenu ' +
    +      'attrEnumOptionMenuGrp attrFieldGrp attrFieldSliderGrp attrNavigationControlGrp ' +
    +      'attrPresetEditWin attributeExists attributeInfo attributeMenu attributeQuery ' +
    +      'autoKeyframe autoPlace bakeClip bakeFluidShading bakePartialHistory bakeResults ' +
    +      'bakeSimulation basename basenameEx batchRender bessel bevel bevelPlus binMembership ' +
    +      'bindSkin blend2 blendShape blendShapeEditor blendShapePanel blendTwoAttr blindDataType ' +
    +      'boneLattice boundary boxDollyCtx boxZoomCtx bufferCurve buildBookmarkMenu ' +
    +      'buildKeyframeMenu button buttonManip CBG cacheFile cacheFileCombine cacheFileMerge ' +
    +      'cacheFileTrack camera cameraView canCreateManip canvas capitalizeString catch ' +
    +      'catchQuiet ceil changeSubdivComponentDisplayLevel changeSubdivRegion channelBox ' +
    +      'character characterMap characterOutlineEditor characterize chdir checkBox checkBoxGrp ' +
    +      'checkDefaultRenderGlobals choice circle circularFillet clamp clear clearCache clip ' +
    +      'clipEditor clipEditorCurrentTimeCtx clipSchedule clipSchedulerOutliner clipTrimBefore ' +
    +      'closeCurve closeSurface cluster cmdFileOutput cmdScrollFieldExecuter ' +
    +      'cmdScrollFieldReporter cmdShell coarsenSubdivSelectionList collision color ' +
    +      'colorAtPoint colorEditor colorIndex colorIndexSliderGrp colorSliderButtonGrp ' +
    +      'colorSliderGrp columnLayout commandEcho commandLine commandPort compactHairSystem ' +
    +      'componentEditor compositingInterop computePolysetVolume condition cone confirmDialog ' +
    +      'connectAttr connectControl connectDynamic connectJoint connectionInfo constrain ' +
    +      'constrainValue constructionHistory container containsMultibyte contextInfo control ' +
    +      'convertFromOldLayers convertIffToPsd convertLightmap convertSolidTx convertTessellation ' +
    +      'convertUnit copyArray copyFlexor copyKey copySkinWeights cos cpButton cpCache ' +
    +      'cpClothSet cpCollision cpConstraint cpConvClothToMesh cpForces cpGetSolverAttr cpPanel ' +
    +      'cpProperty cpRigidCollisionFilter cpSeam cpSetEdit cpSetSolverAttr cpSolver ' +
    +      'cpSolverTypes cpTool cpUpdateClothUVs createDisplayLayer createDrawCtx createEditor ' +
    +      'createLayeredPsdFile createMotionField createNewShelf createNode createRenderLayer ' +
    +      'createSubdivRegion cross crossProduct ctxAbort ctxCompletion ctxEditMode ctxTraverse ' +
    +      'currentCtx currentTime currentTimeCtx currentUnit curve curveAddPtCtx ' +
    +      'curveCVCtx curveEPCtx curveEditorCtx curveIntersect curveMoveEPCtx curveOnSurface ' +
    +      'curveSketchCtx cutKey cycleCheck cylinder dagPose date defaultLightListCheckBox ' +
    +      'defaultNavigation defineDataServer defineVirtualDevice deformer deg_to_rad delete ' +
    +      'deleteAttr deleteShadingGroupsAndMaterials deleteShelfTab deleteUI deleteUnusedBrushes ' +
    +      'delrandstr detachCurve detachDeviceAttr detachSurface deviceEditor devicePanel dgInfo ' +
    +      'dgdirty dgeval dgtimer dimWhen directKeyCtx directionalLight dirmap dirname disable ' +
    +      'disconnectAttr disconnectJoint diskCache displacementToPoly displayAffected ' +
    +      'displayColor displayCull displayLevelOfDetail displayPref displayRGBColor ' +
    +      'displaySmoothness displayStats displayString displaySurface distanceDimContext ' +
    +      'distanceDimension doBlur dolly dollyCtx dopeSheetEditor dot dotProduct ' +
    +      'doubleProfileBirailSurface drag dragAttrContext draggerContext dropoffLocator ' +
    +      'duplicate duplicateCurve duplicateSurface dynCache dynControl dynExport dynExpression ' +
    +      'dynGlobals dynPaintEditor dynParticleCtx dynPref dynRelEdPanel dynRelEditor ' +
    +      'dynamicLoad editAttrLimits editDisplayLayerGlobals editDisplayLayerMembers ' +
    +      'editRenderLayerAdjustment editRenderLayerGlobals editRenderLayerMembers editor ' +
    +      'editorTemplate effector emit emitter enableDevice encodeString endString endsWith env ' +
    +      'equivalent equivalentTol erf error eval evalDeferred evalEcho event ' +
    +      'exactWorldBoundingBox exclusiveLightCheckBox exec executeForEachObject exists exp ' +
    +      'expression expressionEditorListen extendCurve extendSurface extrude fcheck fclose feof ' +
    +      'fflush fgetline fgetword file fileBrowserDialog fileDialog fileExtension fileInfo ' +
    +      'filetest filletCurve filter filterCurve filterExpand filterStudioImport ' +
    +      'findAllIntersections findAnimCurves findKeyframe findMenuItem findRelatedSkinCluster ' +
    +      'finder firstParentOf fitBspline flexor floatEq floatField floatFieldGrp floatScrollBar ' +
    +      'floatSlider floatSlider2 floatSliderButtonGrp floatSliderGrp floor flow fluidCacheInfo ' +
    +      'fluidEmitter fluidVoxelInfo flushUndo fmod fontDialog fopen formLayout format fprint ' +
    +      'frameLayout fread freeFormFillet frewind fromNativePath fwrite gamma gauss ' +
    +      'geometryConstraint getApplicationVersionAsFloat getAttr getClassification ' +
    +      'getDefaultBrush getFileList getFluidAttr getInputDeviceRange getMayaPanelTypes ' +
    +      'getModifiers getPanel getParticleAttr getPluginResource getenv getpid glRender ' +
    +      'glRenderEditor globalStitch gmatch goal gotoBindPose grabColor gradientControl ' +
    +      'gradientControlNoAttr graphDollyCtx graphSelectContext graphTrackCtx gravity grid ' +
    +      'gridLayout group groupObjectsByName HfAddAttractorToAS HfAssignAS HfBuildEqualMap ' +
    +      'HfBuildFurFiles HfBuildFurImages HfCancelAFR HfConnectASToHF HfCreateAttractor ' +
    +      'HfDeleteAS HfEditAS HfPerformCreateAS HfRemoveAttractorFromAS HfSelectAttached ' +
    +      'HfSelectAttractors HfUnAssignAS hardenPointCurve hardware hardwareRenderPanel ' +
    +      'headsUpDisplay headsUpMessage help helpLine hermite hide hilite hitTest hotBox hotkey ' +
    +      'hotkeyCheck hsv_to_rgb hudButton hudSlider hudSliderButton hwReflectionMap hwRender ' +
    +      'hwRenderLoad hyperGraph hyperPanel hyperShade hypot iconTextButton iconTextCheckBox ' +
    +      'iconTextRadioButton iconTextRadioCollection iconTextScrollList iconTextStaticLabel ' +
    +      'ikHandle ikHandleCtx ikHandleDisplayScale ikSolver ikSplineHandleCtx ikSystem ' +
    +      'ikSystemInfo ikfkDisplayMethod illustratorCurves image imfPlugins inheritTransform ' +
    +      'insertJoint insertJointCtx insertKeyCtx insertKnotCurve insertKnotSurface instance ' +
    +      'instanceable instancer intField intFieldGrp intScrollBar intSlider intSliderGrp ' +
    +      'interToUI internalVar intersect iprEngine isAnimCurve isConnected isDirty isParentOf ' +
    +      'isSameObject isTrue isValidObjectName isValidString isValidUiName isolateSelect ' +
    +      'itemFilter itemFilterAttr itemFilterRender itemFilterType joint jointCluster jointCtx ' +
    +      'jointDisplayScale jointLattice keyTangent keyframe keyframeOutliner ' +
    +      'keyframeRegionCurrentTimeCtx keyframeRegionDirectKeyCtx keyframeRegionDollyCtx ' +
    +      'keyframeRegionInsertKeyCtx keyframeRegionMoveKeyCtx keyframeRegionScaleKeyCtx ' +
    +      'keyframeRegionSelectKeyCtx keyframeRegionSetKeyCtx keyframeRegionTrackCtx ' +
    +      'keyframeStats lassoContext lattice latticeDeformKeyCtx launch launchImageEditor ' +
    +      'layerButton layeredShaderPort layeredTexturePort layout layoutDialog lightList ' +
    +      'lightListEditor lightListPanel lightlink lineIntersection linearPrecision linstep ' +
    +      'listAnimatable listAttr listCameras listConnections listDeviceAttachments listHistory ' +
    +      'listInputDeviceAxes listInputDeviceButtons listInputDevices listMenuAnnotation ' +
    +      'listNodeTypes listPanelCategories listRelatives listSets listTransforms ' +
    +      'listUnselected listerEditor loadFluid loadNewShelf loadPlugin ' +
    +      'loadPluginLanguageResources loadPrefObjects localizedPanelLabel lockNode loft log ' +
    +      'longNameOf lookThru ls lsThroughFilter lsType lsUI Mayatomr mag makeIdentity makeLive ' +
    +      'makePaintable makeRoll makeSingleSurface makeTubeOn makebot manipMoveContext ' +
    +      'manipMoveLimitsCtx manipOptions manipRotateContext manipRotateLimitsCtx ' +
    +      'manipScaleContext manipScaleLimitsCtx marker match max memory menu menuBarLayout ' +
    +      'menuEditor menuItem menuItemToShelf menuSet menuSetPref messageLine min minimizeApp ' +
    +      'mirrorJoint modelCurrentTimeCtx modelEditor modelPanel mouse movIn movOut move ' +
    +      'moveIKtoFK moveKeyCtx moveVertexAlongDirection multiProfileBirailSurface mute ' +
    +      'nParticle nameCommand nameField namespace namespaceInfo newPanelItems newton nodeCast ' +
    +      'nodeIconButton nodeOutliner nodePreset nodeType noise nonLinear normalConstraint ' +
    +      'normalize nurbsBoolean nurbsCopyUVSet nurbsCube nurbsEditUV nurbsPlane nurbsSelect ' +
    +      'nurbsSquare nurbsToPoly nurbsToPolygonsPref nurbsToSubdiv nurbsToSubdivPref ' +
    +      'nurbsUVSet nurbsViewDirectionVector objExists objectCenter objectLayer objectType ' +
    +      'objectTypeUI obsoleteProc oceanNurbsPreviewPlane offsetCurve offsetCurveOnSurface ' +
    +      'offsetSurface openGLExtension openMayaPref optionMenu optionMenuGrp optionVar orbit ' +
    +      'orbitCtx orientConstraint outlinerEditor outlinerPanel overrideModifier ' +
    +      'paintEffectsDisplay pairBlend palettePort paneLayout panel panelConfiguration ' +
    +      'panelHistory paramDimContext paramDimension paramLocator parent parentConstraint ' +
    +      'particle particleExists particleInstancer particleRenderInfo partition pasteKey ' +
    +      'pathAnimation pause pclose percent performanceOptions pfxstrokes pickWalk picture ' +
    +      'pixelMove planarSrf plane play playbackOptions playblast plugAttr plugNode pluginInfo ' +
    +      'pluginResourceUtil pointConstraint pointCurveConstraint pointLight pointMatrixMult ' +
    +      'pointOnCurve pointOnSurface pointPosition poleVectorConstraint polyAppend ' +
    +      'polyAppendFacetCtx polyAppendVertex polyAutoProjection polyAverageNormal ' +
    +      'polyAverageVertex polyBevel polyBlendColor polyBlindData polyBoolOp polyBridgeEdge ' +
    +      'polyCacheMonitor polyCheck polyChipOff polyClipboard polyCloseBorder polyCollapseEdge ' +
    +      'polyCollapseFacet polyColorBlindData polyColorDel polyColorPerVertex polyColorSet ' +
    +      'polyCompare polyCone polyCopyUV polyCrease polyCreaseCtx polyCreateFacet ' +
    +      'polyCreateFacetCtx polyCube polyCut polyCutCtx polyCylinder polyCylindricalProjection ' +
    +      'polyDelEdge polyDelFacet polyDelVertex polyDuplicateAndConnect polyDuplicateEdge ' +
    +      'polyEditUV polyEditUVShell polyEvaluate polyExtrudeEdge polyExtrudeFacet ' +
    +      'polyExtrudeVertex polyFlipEdge polyFlipUV polyForceUV polyGeoSampler polyHelix ' +
    +      'polyInfo polyInstallAction polyLayoutUV polyListComponentConversion polyMapCut ' +
    +      'polyMapDel polyMapSew polyMapSewMove polyMergeEdge polyMergeEdgeCtx polyMergeFacet ' +
    +      'polyMergeFacetCtx polyMergeUV polyMergeVertex polyMirrorFace polyMoveEdge ' +
    +      'polyMoveFacet polyMoveFacetUV polyMoveUV polyMoveVertex polyNormal polyNormalPerVertex ' +
    +      'polyNormalizeUV polyOptUvs polyOptions polyOutput polyPipe polyPlanarProjection ' +
    +      'polyPlane polyPlatonicSolid polyPoke polyPrimitive polyPrism polyProjection ' +
    +      'polyPyramid polyQuad polyQueryBlindData polyReduce polySelect polySelectConstraint ' +
    +      'polySelectConstraintMonitor polySelectCtx polySelectEditCtx polySeparate ' +
    +      'polySetToFaceNormal polySewEdge polyShortestPathCtx polySmooth polySoftEdge ' +
    +      'polySphere polySphericalProjection polySplit polySplitCtx polySplitEdge polySplitRing ' +
    +      'polySplitVertex polyStraightenUVBorder polySubdivideEdge polySubdivideFacet ' +
    +      'polyToSubdiv polyTorus polyTransfer polyTriangulate polyUVSet polyUnite polyWedgeFace ' +
    +      'popen popupMenu pose pow preloadRefEd print progressBar progressWindow projFileViewer ' +
    +      'projectCurve projectTangent projectionContext projectionManip promptDialog propModCtx ' +
    +      'propMove psdChannelOutliner psdEditTextureFile psdExport psdTextureFile putenv pwd ' +
    +      'python querySubdiv quit rad_to_deg radial radioButton radioButtonGrp radioCollection ' +
    +      'radioMenuItemCollection rampColorPort rand randomizeFollicles randstate rangeControl ' +
    +      'readTake rebuildCurve rebuildSurface recordAttr recordDevice redo reference ' +
    +      'referenceEdit referenceQuery refineSubdivSelectionList refresh refreshAE ' +
    +      'registerPluginResource rehash reloadImage removeJoint removeMultiInstance ' +
    +      'removePanelCategory rename renameAttr renameSelectionList renameUI render ' +
    +      'renderGlobalsNode renderInfo renderLayerButton renderLayerParent ' +
    +      'renderLayerPostProcess renderLayerUnparent renderManip renderPartition ' +
    +      'renderQualityNode renderSettings renderThumbnailUpdate renderWindowEditor ' +
    +      'renderWindowSelectContext renderer reorder reorderDeformers requires reroot ' +
    +      'resampleFluid resetAE resetPfxToPolyCamera resetTool resolutionNode retarget ' +
    +      'reverseCurve reverseSurface revolve rgb_to_hsv rigidBody rigidSolver roll rollCtx ' +
    +      'rootOf rot rotate rotationInterpolation roundConstantRadius rowColumnLayout rowLayout ' +
    +      'runTimeCommand runup sampleImage saveAllShelves saveAttrPreset saveFluid saveImage ' +
    +      'saveInitialState saveMenu savePrefObjects savePrefs saveShelf saveToolSettings scale ' +
    +      'scaleBrushBrightness scaleComponents scaleConstraint scaleKey scaleKeyCtx sceneEditor ' +
    +      'sceneUIReplacement scmh scriptCtx scriptEditorInfo scriptJob scriptNode scriptTable ' +
    +      'scriptToShelf scriptedPanel scriptedPanelType scrollField scrollLayout sculpt ' +
    +      'searchPathArray seed selLoadSettings select selectContext selectCurveCV selectKey ' +
    +      'selectKeyCtx selectKeyframeRegionCtx selectMode selectPref selectPriority selectType ' +
    +      'selectedNodes selectionConnection separator setAttr setAttrEnumResource ' +
    +      'setAttrMapping setAttrNiceNameResource setConstraintRestPosition ' +
    +      'setDefaultShadingGroup setDrivenKeyframe setDynamic setEditCtx setEditor setFluidAttr ' +
    +      'setFocus setInfinity setInputDeviceMapping setKeyCtx setKeyPath setKeyframe ' +
    +      'setKeyframeBlendshapeTargetWts setMenuMode setNodeNiceNameResource setNodeTypeFlag ' +
    +      'setParent setParticleAttr setPfxToPolyCamera setPluginResource setProject ' +
    +      'setStampDensity setStartupMessage setState setToolTo setUITemplate setXformManip sets ' +
    +      'shadingConnection shadingGeometryRelCtx shadingLightRelCtx shadingNetworkCompare ' +
    +      'shadingNode shapeCompare shelfButton shelfLayout shelfTabLayout shellField ' +
    +      'shortNameOf showHelp showHidden showManipCtx showSelectionInTitle ' +
    +      'showShadingGroupAttrEditor showWindow sign simplify sin singleProfileBirailSurface ' +
    +      'size sizeBytes skinCluster skinPercent smoothCurve smoothTangentSurface smoothstep ' +
    +      'snap2to2 snapKey snapMode snapTogetherCtx snapshot soft softMod softModCtx sort sound ' +
    +      'soundControl source spaceLocator sphere sphrand spotLight spotLightPreviewPort ' +
    +      'spreadSheetEditor spring sqrt squareSurface srtContext stackTrace startString ' +
    +      'startsWith stitchAndExplodeShell stitchSurface stitchSurfacePoints strcmp ' +
    +      'stringArrayCatenate stringArrayContains stringArrayCount stringArrayInsertAtIndex ' +
    +      'stringArrayIntersector stringArrayRemove stringArrayRemoveAtIndex ' +
    +      'stringArrayRemoveDuplicates stringArrayRemoveExact stringArrayToString ' +
    +      'stringToStringArray strip stripPrefixFromName stroke subdAutoProjection ' +
    +      'subdCleanTopology subdCollapse subdDuplicateAndConnect subdEditUV ' +
    +      'subdListComponentConversion subdMapCut subdMapSewMove subdMatchTopology subdMirror ' +
    +      'subdToBlind subdToPoly subdTransferUVsToCache subdiv subdivCrease ' +
    +      'subdivDisplaySmoothness substitute substituteAllString substituteGeometry substring ' +
    +      'surface surfaceSampler surfaceShaderList swatchDisplayPort switchTable symbolButton ' +
    +      'symbolCheckBox sysFile system tabLayout tan tangentConstraint texLatticeDeformContext ' +
    +      'texManipContext texMoveContext texMoveUVShellContext texRotateContext texScaleContext ' +
    +      'texSelectContext texSelectShortestPathCtx texSmudgeUVContext texWinToolCtx text ' +
    +      'textCurves textField textFieldButtonGrp textFieldGrp textManip textScrollList ' +
    +      'textToShelf textureDisplacePlane textureHairColor texturePlacementContext ' +
    +      'textureWindow threadCount threePointArcCtx timeControl timePort timerX toNativePath ' +
    +      'toggle toggleAxis toggleWindowVisibility tokenize tokenizeList tolerance tolower ' +
    +      'toolButton toolCollection toolDropped toolHasOptions toolPropertyWindow torus toupper ' +
    +      'trace track trackCtx transferAttributes transformCompare transformLimits translator ' +
    +      'trim trunc truncateFluidCache truncateHairCache tumble tumbleCtx turbulence ' +
    +      'twoPointArcCtx uiRes uiTemplate unassignInputDevice undo undoInfo ungroup uniform unit ' +
    +      'unloadPlugin untangleUV untitledFileName untrim upAxis updateAE userCtx uvLink ' +
    +      'uvSnapshot validateShelfName vectorize view2dToolCtx viewCamera viewClipPlane ' +
    +      'viewFit viewHeadOn viewLookAt viewManip viewPlace viewSet visor volumeAxis vortex ' +
    +      'waitCursor warning webBrowser webBrowserPrefs whatIs window windowPref wire ' +
    +      'wireContext workspace wrinkle wrinkleContext writeTake xbmLangPathList xform',
    +    illegal: '
    +Description: Mercury is a logic/functional programming language which combines the clarity and expressiveness of declarative programming with advanced static analysis and error detection features.
    +Website: https://www.mercurylang.org
    +*/
    +
    +function mercury(hljs) {
    +  const KEYWORDS = {
    +    keyword:
    +      'module use_module import_module include_module end_module initialise ' +
    +      'mutable initialize finalize finalise interface implementation pred ' +
    +      'mode func type inst solver any_pred any_func is semidet det nondet ' +
    +      'multi erroneous failure cc_nondet cc_multi typeclass instance where ' +
    +      'pragma promise external trace atomic or_else require_complete_switch ' +
    +      'require_det require_semidet require_multi require_nondet ' +
    +      'require_cc_multi require_cc_nondet require_erroneous require_failure',
    +    meta:
    +      // pragma
    +      'inline no_inline type_spec source_file fact_table obsolete memo ' +
    +      'loop_check minimal_model terminates does_not_terminate ' +
    +      'check_termination promise_equivalent_clauses ' +
    +      // preprocessor
    +      'foreign_proc foreign_decl foreign_code foreign_type ' +
    +      'foreign_import_module foreign_export_enum foreign_export ' +
    +      'foreign_enum may_call_mercury will_not_call_mercury thread_safe ' +
    +      'not_thread_safe maybe_thread_safe promise_pure promise_semipure ' +
    +      'tabled_for_io local untrailed trailed attach_to_io_state ' +
    +      'can_pass_as_mercury_type stable will_not_throw_exception ' +
    +      'may_modify_trail will_not_modify_trail may_duplicate ' +
    +      'may_not_duplicate affects_liveness does_not_affect_liveness ' +
    +      'doesnt_affect_liveness no_sharing unknown_sharing sharing',
    +    built_in:
    +      'some all not if then else true fail false try catch catch_any ' +
    +      'semidet_true semidet_false semidet_fail impure_true impure semipure'
    +  };
    +
    +  const COMMENT = hljs.COMMENT('%', '$');
    +
    +  const NUMCODE = {
    +    className: 'number',
    +    begin: "0'.\\|0[box][0-9a-fA-F]*"
    +  };
    +
    +  const ATOM = hljs.inherit(hljs.APOS_STRING_MODE, {
    +    relevance: 0
    +  });
    +  const STRING = hljs.inherit(hljs.QUOTE_STRING_MODE, {
    +    relevance: 0
    +  });
    +  const STRING_FMT = {
    +    className: 'subst',
    +    begin: '\\\\[abfnrtv]\\|\\\\x[0-9a-fA-F]*\\\\\\|%[-+# *.0-9]*[dioxXucsfeEgGp]',
    +    relevance: 0
    +  };
    +  STRING.contains = STRING.contains.slice(); // we need our own copy of contains
    +  STRING.contains.push(STRING_FMT);
    +
    +  const IMPLICATION = {
    +    className: 'built_in',
    +    variants: [
    +      {
    +        begin: '<=>'
    +      },
    +      {
    +        begin: '<=',
    +        relevance: 0
    +      },
    +      {
    +        begin: '=>',
    +        relevance: 0
    +      },
    +      {
    +        begin: '/\\\\'
    +      },
    +      {
    +        begin: '\\\\/'
    +      }
    +    ]
    +  };
    +
    +  const HEAD_BODY_CONJUNCTION = {
    +    className: 'built_in',
    +    variants: [
    +      {
    +        begin: ':-\\|-->'
    +      },
    +      {
    +        begin: '=',
    +        relevance: 0
    +      }
    +    ]
    +  };
    +
    +  return {
    +    name: 'Mercury',
    +    aliases: [
    +      'm',
    +      'moo'
    +    ],
    +    keywords: KEYWORDS,
    +    contains: [
    +      IMPLICATION,
    +      HEAD_BODY_CONJUNCTION,
    +      COMMENT,
    +      hljs.C_BLOCK_COMMENT_MODE,
    +      NUMCODE,
    +      hljs.NUMBER_MODE,
    +      ATOM,
    +      STRING,
    +      { // relevance booster
    +        begin: /:-/
    +      },
    +      { // relevance booster
    +        begin: /\.$/
    +      }
    +    ]
    +  };
    +}
    +
    +module.exports = mercury;
    diff --git a/node_modules/highlight.js/lib/languages/mipsasm.js b/node_modules/highlight.js/lib/languages/mipsasm.js
    new file mode 100644
    index 0000000..9f14dde
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/mipsasm.js
    @@ -0,0 +1,109 @@
    +/*
    +Language: MIPS Assembly
    +Author: Nebuleon Fumika 
    +Description: MIPS Assembly (up to MIPS32R2)
    +Website: https://en.wikipedia.org/wiki/MIPS_architecture
    +Category: assembler
    +*/
    +
    +function mipsasm(hljs) {
    +  // local labels: %?[FB]?[AT]?\d{1,2}\w+
    +  return {
    +    name: 'MIPS Assembly',
    +    case_insensitive: true,
    +    aliases: [ 'mips' ],
    +    keywords: {
    +      $pattern: '\\.?' + hljs.IDENT_RE,
    +      meta:
    +        // GNU preprocs
    +        '.2byte .4byte .align .ascii .asciz .balign .byte .code .data .else .end .endif .endm .endr .equ .err .exitm .extern .global .hword .if .ifdef .ifndef .include .irp .long .macro .rept .req .section .set .skip .space .text .word .ltorg ',
    +      built_in:
    +        '$0 $1 $2 $3 $4 $5 $6 $7 $8 $9 $10 $11 $12 $13 $14 $15 ' + // integer registers
    +        '$16 $17 $18 $19 $20 $21 $22 $23 $24 $25 $26 $27 $28 $29 $30 $31 ' + // integer registers
    +        'zero at v0 v1 a0 a1 a2 a3 a4 a5 a6 a7 ' + // integer register aliases
    +        't0 t1 t2 t3 t4 t5 t6 t7 t8 t9 s0 s1 s2 s3 s4 s5 s6 s7 s8 ' + // integer register aliases
    +        'k0 k1 gp sp fp ra ' + // integer register aliases
    +        '$f0 $f1 $f2 $f2 $f4 $f5 $f6 $f7 $f8 $f9 $f10 $f11 $f12 $f13 $f14 $f15 ' + // floating-point registers
    +        '$f16 $f17 $f18 $f19 $f20 $f21 $f22 $f23 $f24 $f25 $f26 $f27 $f28 $f29 $f30 $f31 ' + // floating-point registers
    +        'Context Random EntryLo0 EntryLo1 Context PageMask Wired EntryHi ' + // Coprocessor 0 registers
    +        'HWREna BadVAddr Count Compare SR IntCtl SRSCtl SRSMap Cause EPC PRId ' + // Coprocessor 0 registers
    +        'EBase Config Config1 Config2 Config3 LLAddr Debug DEPC DESAVE CacheErr ' + // Coprocessor 0 registers
    +        'ECC ErrorEPC TagLo DataLo TagHi DataHi WatchLo WatchHi PerfCtl PerfCnt ' // Coprocessor 0 registers
    +    },
    +    contains: [
    +      {
    +        className: 'keyword',
    +        begin: '\\b(' + // mnemonics
    +            // 32-bit integer instructions
    +            'addi?u?|andi?|b(al)?|beql?|bgez(al)?l?|bgtzl?|blezl?|bltz(al)?l?|' +
    +            'bnel?|cl[oz]|divu?|ext|ins|j(al)?|jalr(\\.hb)?|jr(\\.hb)?|lbu?|lhu?|' +
    +            'll|lui|lw[lr]?|maddu?|mfhi|mflo|movn|movz|move|msubu?|mthi|mtlo|mul|' +
    +            'multu?|nop|nor|ori?|rotrv?|sb|sc|se[bh]|sh|sllv?|slti?u?|srav?|' +
    +            'srlv?|subu?|sw[lr]?|xori?|wsbh|' +
    +            // floating-point instructions
    +            'abs\\.[sd]|add\\.[sd]|alnv.ps|bc1[ft]l?|' +
    +            'c\\.(s?f|un|u?eq|[ou]lt|[ou]le|ngle?|seq|l[et]|ng[et])\\.[sd]|' +
    +            '(ceil|floor|round|trunc)\\.[lw]\\.[sd]|cfc1|cvt\\.d\\.[lsw]|' +
    +            'cvt\\.l\\.[dsw]|cvt\\.ps\\.s|cvt\\.s\\.[dlw]|cvt\\.s\\.p[lu]|cvt\\.w\\.[dls]|' +
    +            'div\\.[ds]|ldx?c1|luxc1|lwx?c1|madd\\.[sd]|mfc1|mov[fntz]?\\.[ds]|' +
    +            'msub\\.[sd]|mth?c1|mul\\.[ds]|neg\\.[ds]|nmadd\\.[ds]|nmsub\\.[ds]|' +
    +            'p[lu][lu]\\.ps|recip\\.fmt|r?sqrt\\.[ds]|sdx?c1|sub\\.[ds]|suxc1|' +
    +            'swx?c1|' +
    +            // system control instructions
    +            'break|cache|d?eret|[de]i|ehb|mfc0|mtc0|pause|prefx?|rdhwr|' +
    +            'rdpgpr|sdbbp|ssnop|synci?|syscall|teqi?|tgei?u?|tlb(p|r|w[ir])|' +
    +            'tlti?u?|tnei?|wait|wrpgpr' +
    +        ')',
    +        end: '\\s'
    +      },
    +      // lines ending with ; or # aren't really comments, probably auto-detect fail
    +      hljs.COMMENT('[;#](?!\\s*$)', '$'),
    +      hljs.C_BLOCK_COMMENT_MODE,
    +      hljs.QUOTE_STRING_MODE,
    +      {
    +        className: 'string',
    +        begin: '\'',
    +        end: '[^\\\\]\'',
    +        relevance: 0
    +      },
    +      {
    +        className: 'title',
    +        begin: '\\|',
    +        end: '\\|',
    +        illegal: '\\n',
    +        relevance: 0
    +      },
    +      {
    +        className: 'number',
    +        variants: [
    +          { // hex
    +            begin: '0x[0-9a-f]+'
    +          },
    +          { // bare number
    +            begin: '\\b-?\\d+'
    +          }
    +        ],
    +        relevance: 0
    +      },
    +      {
    +        className: 'symbol',
    +        variants: [
    +          { // GNU MIPS syntax
    +            begin: '^\\s*[a-z_\\.\\$][a-z0-9_\\.\\$]+:'
    +          },
    +          { // numbered local labels
    +            begin: '^\\s*[0-9]+:'
    +          },
    +          { // number local label reference (backwards, forwards)
    +            begin: '[0-9]+[bf]'
    +          }
    +        ],
    +        relevance: 0
    +      }
    +    ],
    +    // forward slashes are not allowed
    +    illegal: /\//
    +  };
    +}
    +
    +module.exports = mipsasm;
    diff --git a/node_modules/highlight.js/lib/languages/mizar.js b/node_modules/highlight.js/lib/languages/mizar.js
    new file mode 100644
    index 0000000..ed02c0d
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/mizar.js
    @@ -0,0 +1,29 @@
    +/*
    +Language: Mizar
    +Description: The Mizar Language is a formal language derived from the mathematical vernacular.
    +Author: Kelley van Evert 
    +Website: http://mizar.org/language/
    +Category: scientific
    +*/
    +
    +function mizar(hljs) {
    +  return {
    +    name: 'Mizar',
    +    keywords:
    +      'environ vocabularies notations constructors definitions ' +
    +      'registrations theorems schemes requirements begin end definition ' +
    +      'registration cluster existence pred func defpred deffunc theorem ' +
    +      'proof let take assume then thus hence ex for st holds consider ' +
    +      'reconsider such that and in provided of as from be being by means ' +
    +      'equals implies iff redefine define now not or attr is mode ' +
    +      'suppose per cases set thesis contradiction scheme reserve struct ' +
    +      'correctness compatibility coherence symmetry assymetry ' +
    +      'reflexivity irreflexivity connectedness uniqueness commutativity ' +
    +      'idempotence involutiveness projectivity',
    +    contains: [
    +      hljs.COMMENT('::', '$')
    +    ]
    +  };
    +}
    +
    +module.exports = mizar;
    diff --git a/node_modules/highlight.js/lib/languages/mojolicious.js b/node_modules/highlight.js/lib/languages/mojolicious.js
    new file mode 100644
    index 0000000..890b16b
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/mojolicious.js
    @@ -0,0 +1,36 @@
    +/*
    +Language: Mojolicious
    +Requires: xml.js, perl.js
    +Author: Dotan Dimet 
    +Description: Mojolicious .ep (Embedded Perl) templates
    +Website: https://mojolicious.org
    +Category: template
    +*/
    +function mojolicious(hljs) {
    +  return {
    +    name: 'Mojolicious',
    +    subLanguage: 'xml',
    +    contains: [
    +      {
    +        className: 'meta',
    +        begin: '^__(END|DATA)__$'
    +      },
    +      // mojolicious line
    +      {
    +        begin: "^\\s*%{1,2}={0,2}",
    +        end: '$',
    +        subLanguage: 'perl'
    +      },
    +      // mojolicious block
    +      {
    +        begin: "<%{1,2}={0,2}",
    +        end: "={0,1}%>",
    +        subLanguage: 'perl',
    +        excludeBegin: true,
    +        excludeEnd: true
    +      }
    +    ]
    +  };
    +}
    +
    +module.exports = mojolicious;
    diff --git a/node_modules/highlight.js/lib/languages/monkey.js b/node_modules/highlight.js/lib/languages/monkey.js
    new file mode 100644
    index 0000000..2d99a15
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/monkey.js
    @@ -0,0 +1,89 @@
    +/*
    +Language: Monkey
    +Description: Monkey2 is an easy to use, cross platform, games oriented programming language from Blitz Research.
    +Author: Arthur Bikmullin 
    +Website: https://blitzresearch.itch.io/monkey2
    +*/
    +
    +function monkey(hljs) {
    +  const NUMBER = {
    +    className: 'number',
    +    relevance: 0,
    +    variants: [
    +      {
    +        begin: '[$][a-fA-F0-9]+'
    +      },
    +      hljs.NUMBER_MODE
    +    ]
    +  };
    +
    +  return {
    +    name: 'Monkey',
    +    case_insensitive: true,
    +    keywords: {
    +      keyword: 'public private property continue exit extern new try catch ' +
    +        'eachin not abstract final select case default const local global field ' +
    +        'end if then else elseif endif while wend repeat until forever for ' +
    +        'to step next return module inline throw import',
    +
    +      built_in: 'DebugLog DebugStop Error Print ACos ACosr ASin ASinr ATan ATan2 ATan2r ATanr Abs Abs Ceil ' +
    +        'Clamp Clamp Cos Cosr Exp Floor Log Max Max Min Min Pow Sgn Sgn Sin Sinr Sqrt Tan Tanr Seed PI HALFPI TWOPI',
    +
    +      literal: 'true false null and or shl shr mod'
    +    },
    +    illegal: /\/\*/,
    +    contains: [
    +      hljs.COMMENT('#rem', '#end'),
    +      hljs.COMMENT(
    +        "'",
    +        '$',
    +        {
    +          relevance: 0
    +        }
    +      ),
    +      {
    +        className: 'function',
    +        beginKeywords: 'function method',
    +        end: '[(=:]|$',
    +        illegal: /\n/,
    +        contains: [ hljs.UNDERSCORE_TITLE_MODE ]
    +      },
    +      {
    +        className: 'class',
    +        beginKeywords: 'class interface',
    +        end: '$',
    +        contains: [
    +          {
    +            beginKeywords: 'extends implements'
    +          },
    +          hljs.UNDERSCORE_TITLE_MODE
    +        ]
    +      },
    +      {
    +        className: 'built_in',
    +        begin: '\\b(self|super)\\b'
    +      },
    +      {
    +        className: 'meta',
    +        begin: '\\s*#',
    +        end: '$',
    +        keywords: {
    +          'meta-keyword': 'if else elseif endif end then'
    +        }
    +      },
    +      {
    +        className: 'meta',
    +        begin: '^\\s*strict\\b'
    +      },
    +      {
    +        beginKeywords: 'alias',
    +        end: '=',
    +        contains: [ hljs.UNDERSCORE_TITLE_MODE ]
    +      },
    +      hljs.QUOTE_STRING_MODE,
    +      NUMBER
    +    ]
    +  };
    +}
    +
    +module.exports = monkey;
    diff --git a/node_modules/highlight.js/lib/languages/moonscript.js b/node_modules/highlight.js/lib/languages/moonscript.js
    new file mode 100644
    index 0000000..fe24cd9
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/moonscript.js
    @@ -0,0 +1,147 @@
    +/*
    +Language: MoonScript
    +Author: Billy Quith 
    +Description: MoonScript is a programming language that transcompiles to Lua.
    +Origin: coffeescript.js
    +Website: http://moonscript.org/
    +Category: scripting
    +*/
    +
    +function moonscript(hljs) {
    +  const KEYWORDS = {
    +    keyword:
    +      // Moonscript keywords
    +      'if then not for in while do return else elseif break continue switch and or ' +
    +      'unless when class extends super local import export from using',
    +    literal:
    +      'true false nil',
    +    built_in:
    +      '_G _VERSION assert collectgarbage dofile error getfenv getmetatable ipairs load ' +
    +      'loadfile loadstring module next pairs pcall print rawequal rawget rawset require ' +
    +      'select setfenv setmetatable tonumber tostring type unpack xpcall coroutine debug ' +
    +      'io math os package string table'
    +  };
    +  const JS_IDENT_RE = '[A-Za-z$_][0-9A-Za-z$_]*';
    +  const SUBST = {
    +    className: 'subst',
    +    begin: /#\{/,
    +    end: /\}/,
    +    keywords: KEYWORDS
    +  };
    +  const EXPRESSIONS = [
    +    hljs.inherit(hljs.C_NUMBER_MODE,
    +      {
    +        starts: {
    +          end: '(\\s*/)?',
    +          relevance: 0
    +        }
    +      }), // a number tries to eat the following slash to prevent treating it as a regexp
    +    {
    +      className: 'string',
    +      variants: [
    +        {
    +          begin: /'/,
    +          end: /'/,
    +          contains: [ hljs.BACKSLASH_ESCAPE ]
    +        },
    +        {
    +          begin: /"/,
    +          end: /"/,
    +          contains: [
    +            hljs.BACKSLASH_ESCAPE,
    +            SUBST
    +          ]
    +        }
    +      ]
    +    },
    +    {
    +      className: 'built_in',
    +      begin: '@__' + hljs.IDENT_RE
    +    },
    +    {
    +      begin: '@' + hljs.IDENT_RE // relevance booster on par with CoffeeScript
    +    },
    +    {
    +      begin: hljs.IDENT_RE + '\\\\' + hljs.IDENT_RE // inst\method
    +    }
    +  ];
    +  SUBST.contains = EXPRESSIONS;
    +
    +  const TITLE = hljs.inherit(hljs.TITLE_MODE, {
    +    begin: JS_IDENT_RE
    +  });
    +  const POSSIBLE_PARAMS_RE = '(\\(.*\\)\\s*)?\\B[-=]>';
    +  const PARAMS = {
    +    className: 'params',
    +    begin: '\\([^\\(]',
    +    returnBegin: true,
    +    /* We need another contained nameless mode to not have every nested
    +    pair of parens to be called "params" */
    +    contains: [
    +      {
    +        begin: /\(/,
    +        end: /\)/,
    +        keywords: KEYWORDS,
    +        contains: [ 'self' ].concat(EXPRESSIONS)
    +      }
    +    ]
    +  };
    +
    +  return {
    +    name: 'MoonScript',
    +    aliases: [ 'moon' ],
    +    keywords: KEYWORDS,
    +    illegal: /\/\*/,
    +    contains: EXPRESSIONS.concat([
    +      hljs.COMMENT('--', '$'),
    +      {
    +        className: 'function', // function: -> =>
    +        begin: '^\\s*' + JS_IDENT_RE + '\\s*=\\s*' + POSSIBLE_PARAMS_RE,
    +        end: '[-=]>',
    +        returnBegin: true,
    +        contains: [
    +          TITLE,
    +          PARAMS
    +        ]
    +      },
    +      {
    +        begin: /[\(,:=]\s*/, // anonymous function start
    +        relevance: 0,
    +        contains: [
    +          {
    +            className: 'function',
    +            begin: POSSIBLE_PARAMS_RE,
    +            end: '[-=]>',
    +            returnBegin: true,
    +            contains: [ PARAMS ]
    +          }
    +        ]
    +      },
    +      {
    +        className: 'class',
    +        beginKeywords: 'class',
    +        end: '$',
    +        illegal: /[:="\[\]]/,
    +        contains: [
    +          {
    +            beginKeywords: 'extends',
    +            endsWithParent: true,
    +            illegal: /[:="\[\]]/,
    +            contains: [ TITLE ]
    +          },
    +          TITLE
    +        ]
    +      },
    +      {
    +        className: 'name', // table
    +        begin: JS_IDENT_RE + ':',
    +        end: ':',
    +        returnBegin: true,
    +        returnEnd: true,
    +        relevance: 0
    +      }
    +    ])
    +  };
    +}
    +
    +module.exports = moonscript;
    diff --git a/node_modules/highlight.js/lib/languages/n1ql.js b/node_modules/highlight.js/lib/languages/n1ql.js
    new file mode 100644
    index 0000000..bef9523
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/n1ql.js
    @@ -0,0 +1,77 @@
    +/*
    + Language: N1QL
    + Author: Andres Täht 
    + Contributors: Rene Saarsoo 
    + Description: Couchbase query language
    + Website: https://www.couchbase.com/products/n1ql
    + */
    +
    +function n1ql(hljs) {
    +  return {
    +    name: 'N1QL',
    +    case_insensitive: true,
    +    contains: [
    +      {
    +        beginKeywords:
    +          'build create index delete drop explain infer|10 insert merge prepare select update upsert|10',
    +        end: /;/, endsWithParent: true,
    +        keywords: {
    +          // Taken from http://developer.couchbase.com/documentation/server/current/n1ql/n1ql-language-reference/reservedwords.html
    +          keyword:
    +            'all alter analyze and any array as asc begin between binary boolean break bucket build by call ' +
    +            'case cast cluster collate collection commit connect continue correlate cover create database ' +
    +            'dataset datastore declare decrement delete derived desc describe distinct do drop each element ' +
    +            'else end every except exclude execute exists explain fetch first flatten for force from ' +
    +            'function grant group gsi having if ignore ilike in include increment index infer inline inner ' +
    +            'insert intersect into is join key keys keyspace known last left let letting like limit lsm map ' +
    +            'mapping matched materialized merge minus namespace nest not number object offset on ' +
    +            'option or order outer over parse partition password path pool prepare primary private privilege ' +
    +            'procedure public raw realm reduce rename return returning revoke right role rollback satisfies ' +
    +            'schema select self semi set show some start statistics string system then to transaction trigger ' +
    +            'truncate under union unique unknown unnest unset update upsert use user using validate value ' +
    +            'valued values via view when where while with within work xor',
    +          // Taken from http://developer.couchbase.com/documentation/server/4.5/n1ql/n1ql-language-reference/literals.html
    +          literal:
    +            'true false null missing|5',
    +          // Taken from http://developer.couchbase.com/documentation/server/4.5/n1ql/n1ql-language-reference/functions.html
    +          built_in:
    +            'array_agg array_append array_concat array_contains array_count array_distinct array_ifnull array_length ' +
    +            'array_max array_min array_position array_prepend array_put array_range array_remove array_repeat array_replace ' +
    +            'array_reverse array_sort array_sum avg count max min sum greatest least ifmissing ifmissingornull ifnull ' +
    +            'missingif nullif ifinf ifnan ifnanorinf naninf neginfif posinfif clock_millis clock_str date_add_millis ' +
    +            'date_add_str date_diff_millis date_diff_str date_part_millis date_part_str date_trunc_millis date_trunc_str ' +
    +            'duration_to_str millis str_to_millis millis_to_str millis_to_utc millis_to_zone_name now_millis now_str ' +
    +            'str_to_duration str_to_utc str_to_zone_name decode_json encode_json encoded_size poly_length base64 base64_encode ' +
    +            'base64_decode meta uuid abs acos asin atan atan2 ceil cos degrees e exp ln log floor pi power radians random ' +
    +            'round sign sin sqrt tan trunc object_length object_names object_pairs object_inner_pairs object_values ' +
    +            'object_inner_values object_add object_put object_remove object_unwrap regexp_contains regexp_like regexp_position ' +
    +            'regexp_replace contains initcap length lower ltrim position repeat replace rtrim split substr title trim upper ' +
    +            'isarray isatom isboolean isnumber isobject isstring type toarray toatom toboolean tonumber toobject tostring'
    +        },
    +        contains: [
    +          {
    +            className: 'string',
    +            begin: '\'', end: '\'',
    +            contains: [hljs.BACKSLASH_ESCAPE]
    +          },
    +          {
    +            className: 'string',
    +            begin: '"', end: '"',
    +            contains: [hljs.BACKSLASH_ESCAPE]
    +          },
    +          {
    +            className: 'symbol',
    +            begin: '`', end: '`',
    +            contains: [hljs.BACKSLASH_ESCAPE],
    +            relevance: 2
    +          },
    +          hljs.C_NUMBER_MODE,
    +          hljs.C_BLOCK_COMMENT_MODE
    +        ]
    +      },
    +      hljs.C_BLOCK_COMMENT_MODE
    +    ]
    +  };
    +}
    +
    +module.exports = n1ql;
    diff --git a/node_modules/highlight.js/lib/languages/nginx.js b/node_modules/highlight.js/lib/languages/nginx.js
    new file mode 100644
    index 0000000..186e2f4
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/nginx.js
    @@ -0,0 +1,140 @@
    +/*
    +Language: Nginx config
    +Author: Peter Leonov 
    +Contributors: Ivan Sagalaev 
    +Category: common, config
    +Website: https://www.nginx.com
    +*/
    +
    +function nginx(hljs) {
    +  const VAR = {
    +    className: 'variable',
    +    variants: [
    +      {
    +        begin: /\$\d+/
    +      },
    +      {
    +        begin: /\$\{/,
    +        end: /\}/
    +      },
    +      {
    +        begin: /[$@]/ + hljs.UNDERSCORE_IDENT_RE
    +      }
    +    ]
    +  };
    +  const DEFAULT = {
    +    endsWithParent: true,
    +    keywords: {
    +      $pattern: '[a-z/_]+',
    +      literal:
    +        'on off yes no true false none blocked debug info notice warn error crit ' +
    +        'select break last permanent redirect kqueue rtsig epoll poll /dev/poll'
    +    },
    +    relevance: 0,
    +    illegal: '=>',
    +    contains: [
    +      hljs.HASH_COMMENT_MODE,
    +      {
    +        className: 'string',
    +        contains: [
    +          hljs.BACKSLASH_ESCAPE,
    +          VAR
    +        ],
    +        variants: [
    +          {
    +            begin: /"/,
    +            end: /"/
    +          },
    +          {
    +            begin: /'/,
    +            end: /'/
    +          }
    +        ]
    +      },
    +      // this swallows entire URLs to avoid detecting numbers within
    +      {
    +        begin: '([a-z]+):/',
    +        end: '\\s',
    +        endsWithParent: true,
    +        excludeEnd: true,
    +        contains: [ VAR ]
    +      },
    +      {
    +        className: 'regexp',
    +        contains: [
    +          hljs.BACKSLASH_ESCAPE,
    +          VAR
    +        ],
    +        variants: [
    +          {
    +            begin: "\\s\\^",
    +            end: "\\s|\\{|;",
    +            returnEnd: true
    +          },
    +          // regexp locations (~, ~*)
    +          {
    +            begin: "~\\*?\\s+",
    +            end: "\\s|\\{|;",
    +            returnEnd: true
    +          },
    +          // *.example.com
    +          {
    +            begin: "\\*(\\.[a-z\\-]+)+"
    +          },
    +          // sub.example.*
    +          {
    +            begin: "([a-z\\-]+\\.)+\\*"
    +          }
    +        ]
    +      },
    +      // IP
    +      {
    +        className: 'number',
    +        begin: '\\b\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}(:\\d{1,5})?\\b'
    +      },
    +      // units
    +      {
    +        className: 'number',
    +        begin: '\\b\\d+[kKmMgGdshdwy]*\\b',
    +        relevance: 0
    +      },
    +      VAR
    +    ]
    +  };
    +
    +  return {
    +    name: 'Nginx config',
    +    aliases: [ 'nginxconf' ],
    +    contains: [
    +      hljs.HASH_COMMENT_MODE,
    +      {
    +        begin: hljs.UNDERSCORE_IDENT_RE + '\\s+\\{',
    +        returnBegin: true,
    +        end: /\{/,
    +        contains: [
    +          {
    +            className: 'section',
    +            begin: hljs.UNDERSCORE_IDENT_RE
    +          }
    +        ],
    +        relevance: 0
    +      },
    +      {
    +        begin: hljs.UNDERSCORE_IDENT_RE + '\\s',
    +        end: ';|\\{',
    +        returnBegin: true,
    +        contains: [
    +          {
    +            className: 'attribute',
    +            begin: hljs.UNDERSCORE_IDENT_RE,
    +            starts: DEFAULT
    +          }
    +        ],
    +        relevance: 0
    +      }
    +    ],
    +    illegal: '[^\\s\\}]'
    +  };
    +}
    +
    +module.exports = nginx;
    diff --git a/node_modules/highlight.js/lib/languages/nim.js b/node_modules/highlight.js/lib/languages/nim.js
    new file mode 100644
    index 0000000..cd00f0e
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/nim.js
    @@ -0,0 +1,80 @@
    +/*
    +Language: Nim
    +Description: Nim is a statically typed compiled systems programming language.
    +Website: https://nim-lang.org
    +Category: system
    +*/
    +
    +function nim(hljs) {
    +  return {
    +    name: 'Nim',
    +    aliases: [ 'nim' ],
    +    keywords: {
    +      keyword:
    +        'addr and as asm bind block break case cast const continue converter ' +
    +        'discard distinct div do elif else end enum except export finally ' +
    +        'for from func generic if import in include interface is isnot iterator ' +
    +        'let macro method mixin mod nil not notin object of or out proc ptr ' +
    +        'raise ref return shl shr static template try tuple type using var ' +
    +        'when while with without xor yield',
    +      literal:
    +        'shared guarded stdin stdout stderr result true false',
    +      built_in:
    +        'int int8 int16 int32 int64 uint uint8 uint16 uint32 uint64 float ' +
    +        'float32 float64 bool char string cstring pointer expr stmt void ' +
    +        'auto any range array openarray varargs seq set clong culong cchar ' +
    +        'cschar cshort cint csize clonglong cfloat cdouble clongdouble ' +
    +        'cuchar cushort cuint culonglong cstringarray semistatic'
    +    },
    +    contains: [
    +      {
    +        className: 'meta', // Actually pragma
    +        begin: /\{\./,
    +        end: /\.\}/,
    +        relevance: 10
    +      },
    +      {
    +        className: 'string',
    +        begin: /[a-zA-Z]\w*"/,
    +        end: /"/,
    +        contains: [
    +          {
    +            begin: /""/
    +          }
    +        ]
    +      },
    +      {
    +        className: 'string',
    +        begin: /([a-zA-Z]\w*)?"""/,
    +        end: /"""/
    +      },
    +      hljs.QUOTE_STRING_MODE,
    +      {
    +        className: 'type',
    +        begin: /\b[A-Z]\w+\b/,
    +        relevance: 0
    +      },
    +      {
    +        className: 'number',
    +        relevance: 0,
    +        variants: [
    +          {
    +            begin: /\b(0[xX][0-9a-fA-F][_0-9a-fA-F]*)('?[iIuU](8|16|32|64))?/
    +          },
    +          {
    +            begin: /\b(0o[0-7][_0-7]*)('?[iIuUfF](8|16|32|64))?/
    +          },
    +          {
    +            begin: /\b(0(b|B)[01][_01]*)('?[iIuUfF](8|16|32|64))?/
    +          },
    +          {
    +            begin: /\b(\d[_\d]*)('?[iIuUfF](8|16|32|64))?/
    +          }
    +        ]
    +      },
    +      hljs.HASH_COMMENT_MODE
    +    ]
    +  };
    +}
    +
    +module.exports = nim;
    diff --git a/node_modules/highlight.js/lib/languages/nix.js b/node_modules/highlight.js/lib/languages/nix.js
    new file mode 100644
    index 0000000..15b945e
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/nix.js
    @@ -0,0 +1,65 @@
    +/*
    +Language: Nix
    +Author: Domen Kožar 
    +Description: Nix functional language
    +Website: http://nixos.org/nix
    +*/
    +
    +function nix(hljs) {
    +  const NIX_KEYWORDS = {
    +    keyword:
    +      'rec with let in inherit assert if else then',
    +    literal:
    +      'true false or and null',
    +    built_in:
    +      'import abort baseNameOf dirOf isNull builtins map removeAttrs throw ' +
    +      'toString derivation'
    +  };
    +  const ANTIQUOTE = {
    +    className: 'subst',
    +    begin: /\$\{/,
    +    end: /\}/,
    +    keywords: NIX_KEYWORDS
    +  };
    +  const ATTRS = {
    +    begin: /[a-zA-Z0-9-_]+(\s*=)/,
    +    returnBegin: true,
    +    relevance: 0,
    +    contains: [
    +      {
    +        className: 'attr',
    +        begin: /\S+/
    +      }
    +    ]
    +  };
    +  const STRING = {
    +    className: 'string',
    +    contains: [ ANTIQUOTE ],
    +    variants: [
    +      {
    +        begin: "''",
    +        end: "''"
    +      },
    +      {
    +        begin: '"',
    +        end: '"'
    +      }
    +    ]
    +  };
    +  const EXPRESSIONS = [
    +    hljs.NUMBER_MODE,
    +    hljs.HASH_COMMENT_MODE,
    +    hljs.C_BLOCK_COMMENT_MODE,
    +    STRING,
    +    ATTRS
    +  ];
    +  ANTIQUOTE.contains = EXPRESSIONS;
    +  return {
    +    name: 'Nix',
    +    aliases: [ "nixos" ],
    +    keywords: NIX_KEYWORDS,
    +    contains: EXPRESSIONS
    +  };
    +}
    +
    +module.exports = nix;
    diff --git a/node_modules/highlight.js/lib/languages/node-repl.js b/node_modules/highlight.js/lib/languages/node-repl.js
    new file mode 100644
    index 0000000..15e3b66
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/node-repl.js
    @@ -0,0 +1,37 @@
    +/*
    +Language: Node REPL
    +Requires: javascript.js
    +Author: Marat Nagayev 
    +Category: scripting
    +*/
    +
    +/** @type LanguageFn */
    +function nodeRepl(hljs) {
    +  return {
    +    name: 'Node REPL',
    +    contains: [
    +      {
    +        className: 'meta',
    +        starts: {
    +          // a space separates the REPL prefix from the actual code
    +          // this is purely for cleaner HTML output
    +          end: / |$/,
    +          starts: {
    +            end: '$',
    +            subLanguage: 'javascript'
    +          }
    +        },
    +        variants: [
    +          {
    +            begin: /^>(?=[ ]|$)/
    +          },
    +          {
    +            begin: /^\.\.\.(?=[ ]|$)/
    +          }
    +        ]
    +      }
    +    ]
    +  };
    +}
    +
    +module.exports = nodeRepl;
    diff --git a/node_modules/highlight.js/lib/languages/nsis.js b/node_modules/highlight.js/lib/languages/nsis.js
    new file mode 100644
    index 0000000..da621ba
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/nsis.js
    @@ -0,0 +1,119 @@
    +/*
    +Language: NSIS
    +Description: Nullsoft Scriptable Install System
    +Author: Jan T. Sott 
    +Website: https://nsis.sourceforge.io/Main_Page
    +*/
    +
    +function nsis(hljs) {
    +  const CONSTANTS = {
    +    className: 'variable',
    +    begin: /\$(ADMINTOOLS|APPDATA|CDBURN_AREA|CMDLINE|COMMONFILES32|COMMONFILES64|COMMONFILES|COOKIES|DESKTOP|DOCUMENTS|EXEDIR|EXEFILE|EXEPATH|FAVORITES|FONTS|HISTORY|HWNDPARENT|INSTDIR|INTERNET_CACHE|LANGUAGE|LOCALAPPDATA|MUSIC|NETHOOD|OUTDIR|PICTURES|PLUGINSDIR|PRINTHOOD|PROFILE|PROGRAMFILES32|PROGRAMFILES64|PROGRAMFILES|QUICKLAUNCH|RECENT|RESOURCES_LOCALIZED|RESOURCES|SENDTO|SMPROGRAMS|SMSTARTUP|STARTMENU|SYSDIR|TEMP|TEMPLATES|VIDEOS|WINDIR)/
    +  };
    +
    +  const DEFINES = {
    +    // ${defines}
    +    className: 'variable',
    +    begin: /\$+\{[\w.:-]+\}/
    +  };
    +
    +  const VARIABLES = {
    +    // $variables
    +    className: 'variable',
    +    begin: /\$+\w+/,
    +    illegal: /\(\)\{\}/
    +  };
    +
    +  const LANGUAGES = {
    +    // $(language_strings)
    +    className: 'variable',
    +    begin: /\$+\([\w^.:-]+\)/
    +  };
    +
    +  const PARAMETERS = {
    +    // command parameters
    +    className: 'params',
    +    begin: '(ARCHIVE|FILE_ATTRIBUTE_ARCHIVE|FILE_ATTRIBUTE_NORMAL|FILE_ATTRIBUTE_OFFLINE|FILE_ATTRIBUTE_READONLY|FILE_ATTRIBUTE_SYSTEM|FILE_ATTRIBUTE_TEMPORARY|HKCR|HKCU|HKDD|HKEY_CLASSES_ROOT|HKEY_CURRENT_CONFIG|HKEY_CURRENT_USER|HKEY_DYN_DATA|HKEY_LOCAL_MACHINE|HKEY_PERFORMANCE_DATA|HKEY_USERS|HKLM|HKPD|HKU|IDABORT|IDCANCEL|IDIGNORE|IDNO|IDOK|IDRETRY|IDYES|MB_ABORTRETRYIGNORE|MB_DEFBUTTON1|MB_DEFBUTTON2|MB_DEFBUTTON3|MB_DEFBUTTON4|MB_ICONEXCLAMATION|MB_ICONINFORMATION|MB_ICONQUESTION|MB_ICONSTOP|MB_OK|MB_OKCANCEL|MB_RETRYCANCEL|MB_RIGHT|MB_RTLREADING|MB_SETFOREGROUND|MB_TOPMOST|MB_USERICON|MB_YESNO|NORMAL|OFFLINE|READONLY|SHCTX|SHELL_CONTEXT|SYSTEM|TEMPORARY)'
    +  };
    +
    +  const COMPILER = {
    +    // !compiler_flags
    +    className: 'keyword',
    +    begin: /!(addincludedir|addplugindir|appendfile|cd|define|delfile|echo|else|endif|error|execute|finalize|getdllversion|gettlbversion|if|ifdef|ifmacrodef|ifmacrondef|ifndef|include|insertmacro|macro|macroend|makensis|packhdr|searchparse|searchreplace|system|tempfile|undef|verbose|warning)/
    +  };
    +
    +  const METACHARS = {
    +    // $\n, $\r, $\t, $$
    +    className: 'meta',
    +    begin: /\$(\\[nrt]|\$)/
    +  };
    +
    +  const PLUGINS = {
    +    // plug::ins
    +    className: 'class',
    +    begin: /\w+::\w+/
    +  };
    +
    +  const STRING = {
    +    className: 'string',
    +    variants: [
    +      {
    +        begin: '"',
    +        end: '"'
    +      },
    +      {
    +        begin: '\'',
    +        end: '\''
    +      },
    +      {
    +        begin: '`',
    +        end: '`'
    +      }
    +    ],
    +    illegal: /\n/,
    +    contains: [
    +      METACHARS,
    +      CONSTANTS,
    +      DEFINES,
    +      VARIABLES,
    +      LANGUAGES
    +    ]
    +  };
    +
    +  return {
    +    name: 'NSIS',
    +    case_insensitive: false,
    +    keywords: {
    +      keyword:
    +      'Abort AddBrandingImage AddSize AllowRootDirInstall AllowSkipFiles AutoCloseWindow BGFont BGGradient BrandingText BringToFront Call CallInstDLL Caption ChangeUI CheckBitmap ClearErrors CompletedText ComponentText CopyFiles CRCCheck CreateDirectory CreateFont CreateShortCut Delete DeleteINISec DeleteINIStr DeleteRegKey DeleteRegValue DetailPrint DetailsButtonText DirText DirVar DirVerify EnableWindow EnumRegKey EnumRegValue Exch Exec ExecShell ExecShellWait ExecWait ExpandEnvStrings File FileBufSize FileClose FileErrorText FileOpen FileRead FileReadByte FileReadUTF16LE FileReadWord FileWriteUTF16LE FileSeek FileWrite FileWriteByte FileWriteWord FindClose FindFirst FindNext FindWindow FlushINI GetCurInstType GetCurrentAddress GetDlgItem GetDLLVersion GetDLLVersionLocal GetErrorLevel GetFileTime GetFileTimeLocal GetFullPathName GetFunctionAddress GetInstDirError GetKnownFolderPath GetLabelAddress GetTempFileName Goto HideWindow Icon IfAbort IfErrors IfFileExists IfRebootFlag IfRtlLanguage IfShellVarContextAll IfSilent InitPluginsDir InstallButtonText InstallColors InstallDir InstallDirRegKey InstProgressFlags InstType InstTypeGetText InstTypeSetText Int64Cmp Int64CmpU Int64Fmt IntCmp IntCmpU IntFmt IntOp IntPtrCmp IntPtrCmpU IntPtrOp IsWindow LangString LicenseBkColor LicenseData LicenseForceSelection LicenseLangString LicenseText LoadAndSetImage LoadLanguageFile LockWindow LogSet LogText ManifestDPIAware ManifestLongPathAware ManifestMaxVersionTested ManifestSupportedOS MessageBox MiscButtonText Name Nop OutFile Page PageCallbacks PEAddResource PEDllCharacteristics PERemoveResource PESubsysVer Pop Push Quit ReadEnvStr ReadINIStr ReadRegDWORD ReadRegStr Reboot RegDLL Rename RequestExecutionLevel ReserveFile Return RMDir SearchPath SectionGetFlags SectionGetInstTypes SectionGetSize SectionGetText SectionIn SectionSetFlags SectionSetInstTypes SectionSetSize SectionSetText SendMessage SetAutoClose SetBrandingImage SetCompress SetCompressor SetCompressorDictSize SetCtlColors SetCurInstType SetDatablockOptimize SetDateSave SetDetailsPrint SetDetailsView SetErrorLevel SetErrors SetFileAttributes SetFont SetOutPath SetOverwrite SetRebootFlag SetRegView SetShellVarContext SetSilent ShowInstDetails ShowUninstDetails ShowWindow SilentInstall SilentUnInstall Sleep SpaceTexts StrCmp StrCmpS StrCpy StrLen SubCaption Unicode UninstallButtonText UninstallCaption UninstallIcon UninstallSubCaption UninstallText UninstPage UnRegDLL Var VIAddVersionKey VIFileVersion VIProductVersion WindowIcon WriteINIStr WriteRegBin WriteRegDWORD WriteRegExpandStr WriteRegMultiStr WriteRegNone WriteRegStr WriteUninstaller XPStyle',
    +      literal:
    +      'admin all auto both bottom bzip2 colored components current custom directory false force hide highest ifdiff ifnewer instfiles lastused leave left license listonly lzma nevershow none normal notset off on open print right show silent silentlog smooth textonly top true try un.components un.custom un.directory un.instfiles un.license uninstConfirm user Win10 Win7 Win8 WinVista zlib'
    +    },
    +    contains: [
    +      hljs.HASH_COMMENT_MODE,
    +      hljs.C_BLOCK_COMMENT_MODE,
    +      hljs.COMMENT(
    +        ';',
    +        '$',
    +        {
    +          relevance: 0
    +        }
    +      ),
    +      {
    +        className: 'function',
    +        beginKeywords: 'Function PageEx Section SectionGroup',
    +        end: '$'
    +      },
    +      STRING,
    +      COMPILER,
    +      DEFINES,
    +      VARIABLES,
    +      LANGUAGES,
    +      PARAMETERS,
    +      PLUGINS,
    +      hljs.NUMBER_MODE
    +    ]
    +  };
    +}
    +
    +module.exports = nsis;
    diff --git a/node_modules/highlight.js/lib/languages/objectivec.js b/node_modules/highlight.js/lib/languages/objectivec.js
    new file mode 100644
    index 0000000..18016ef
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/objectivec.js
    @@ -0,0 +1,121 @@
    +/*
    +Language: Objective-C
    +Author: Valerii Hiora 
    +Contributors: Angel G. Olloqui , Matt Diephouse , Andrew Farmer , Minh Nguyễn 
    +Website: https://developer.apple.com/documentation/objectivec
    +Category: common
    +*/
    +
    +function objectivec(hljs) {
    +  const API_CLASS = {
    +    className: 'built_in',
    +    begin: '\\b(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)\\w+'
    +  };
    +  const IDENTIFIER_RE = /[a-zA-Z@][a-zA-Z0-9_]*/;
    +  const OBJC_KEYWORDS = {
    +    $pattern: IDENTIFIER_RE,
    +    keyword:
    +      'int float while char export sizeof typedef const struct for union ' +
    +      'unsigned long volatile static bool mutable if do return goto void ' +
    +      'enum else break extern asm case short default double register explicit ' +
    +      'signed typename this switch continue wchar_t inline readonly assign ' +
    +      'readwrite self @synchronized id typeof ' +
    +      'nonatomic super unichar IBOutlet IBAction strong weak copy ' +
    +      'in out inout bycopy byref oneway __strong __weak __block __autoreleasing ' +
    +      '@private @protected @public @try @property @end @throw @catch @finally ' +
    +      '@autoreleasepool @synthesize @dynamic @selector @optional @required ' +
    +      '@encode @package @import @defs @compatibility_alias ' +
    +      '__bridge __bridge_transfer __bridge_retained __bridge_retain ' +
    +      '__covariant __contravariant __kindof ' +
    +      '_Nonnull _Nullable _Null_unspecified ' +
    +      '__FUNCTION__ __PRETTY_FUNCTION__ __attribute__ ' +
    +      'getter setter retain unsafe_unretained ' +
    +      'nonnull nullable null_unspecified null_resettable class instancetype ' +
    +      'NS_DESIGNATED_INITIALIZER NS_UNAVAILABLE NS_REQUIRES_SUPER ' +
    +      'NS_RETURNS_INNER_POINTER NS_INLINE NS_AVAILABLE NS_DEPRECATED ' +
    +      'NS_ENUM NS_OPTIONS NS_SWIFT_UNAVAILABLE ' +
    +      'NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_END ' +
    +      'NS_REFINED_FOR_SWIFT NS_SWIFT_NAME NS_SWIFT_NOTHROW ' +
    +      'NS_DURING NS_HANDLER NS_ENDHANDLER NS_VALUERETURN NS_VOIDRETURN',
    +    literal:
    +      'false true FALSE TRUE nil YES NO NULL',
    +    built_in:
    +      'BOOL dispatch_once_t dispatch_queue_t dispatch_sync dispatch_async dispatch_once'
    +  };
    +  const CLASS_KEYWORDS = {
    +    $pattern: IDENTIFIER_RE,
    +    keyword: '@interface @class @protocol @implementation'
    +  };
    +  return {
    +    name: 'Objective-C',
    +    aliases: [
    +      'mm',
    +      'objc',
    +      'obj-c',
    +      'obj-c++',
    +      'objective-c++'
    +    ],
    +    keywords: OBJC_KEYWORDS,
    +    illegal: '/,
    +            end: /$/,
    +            illegal: '\\n'
    +          },
    +          hljs.C_LINE_COMMENT_MODE,
    +          hljs.C_BLOCK_COMMENT_MODE
    +        ]
    +      },
    +      {
    +        className: 'class',
    +        begin: '(' + CLASS_KEYWORDS.keyword.split(' ').join('|') + ')\\b',
    +        end: /(\{|$)/,
    +        excludeEnd: true,
    +        keywords: CLASS_KEYWORDS,
    +        contains: [ hljs.UNDERSCORE_TITLE_MODE ]
    +      },
    +      {
    +        begin: '\\.' + hljs.UNDERSCORE_IDENT_RE,
    +        relevance: 0
    +      }
    +    ]
    +  };
    +}
    +
    +module.exports = objectivec;
    diff --git a/node_modules/highlight.js/lib/languages/ocaml.js b/node_modules/highlight.js/lib/languages/ocaml.js
    new file mode 100644
    index 0000000..3e617bd
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/ocaml.js
    @@ -0,0 +1,82 @@
    +/*
    +Language: OCaml
    +Author: Mehdi Dogguy 
    +Contributors: Nicolas Braud-Santoni , Mickael Delahaye 
    +Description: OCaml language definition.
    +Website: https://ocaml.org
    +Category: functional
    +*/
    +
    +function ocaml(hljs) {
    +  /* missing support for heredoc-like string (OCaml 4.0.2+) */
    +  return {
    +    name: 'OCaml',
    +    aliases: ['ml'],
    +    keywords: {
    +      $pattern: '[a-z_]\\w*!?',
    +      keyword:
    +        'and as assert asr begin class constraint do done downto else end ' +
    +        'exception external for fun function functor if in include ' +
    +        'inherit! inherit initializer land lazy let lor lsl lsr lxor match method!|10 method ' +
    +        'mod module mutable new object of open! open or private rec sig struct ' +
    +        'then to try type val! val virtual when while with ' +
    +        /* camlp4 */
    +        'parser value',
    +      built_in:
    +        /* built-in types */
    +        'array bool bytes char exn|5 float int int32 int64 list lazy_t|5 nativeint|5 string unit ' +
    +        /* (some) types in Pervasives */
    +        'in_channel out_channel ref',
    +      literal:
    +        'true false'
    +    },
    +    illegal: /\/\/|>>/,
    +    contains: [
    +      {
    +        className: 'literal',
    +        begin: '\\[(\\|\\|)?\\]|\\(\\)',
    +        relevance: 0
    +      },
    +      hljs.COMMENT(
    +        '\\(\\*',
    +        '\\*\\)',
    +        {
    +          contains: ['self']
    +        }
    +      ),
    +      { /* type variable */
    +        className: 'symbol',
    +        begin: '\'[A-Za-z_](?!\')[\\w\']*'
    +        /* the grammar is ambiguous on how 'a'b should be interpreted but not the compiler */
    +      },
    +      { /* polymorphic variant */
    +        className: 'type',
    +        begin: '`[A-Z][\\w\']*'
    +      },
    +      { /* module or constructor */
    +        className: 'type',
    +        begin: '\\b[A-Z][\\w\']*',
    +        relevance: 0
    +      },
    +      { /* don't color identifiers, but safely catch all identifiers with '*/
    +        begin: '[a-z_]\\w*\'[\\w\']*', relevance: 0
    +      },
    +      hljs.inherit(hljs.APOS_STRING_MODE, {className: 'string', relevance: 0}),
    +      hljs.inherit(hljs.QUOTE_STRING_MODE, {illegal: null}),
    +      {
    +        className: 'number',
    +        begin:
    +          '\\b(0[xX][a-fA-F0-9_]+[Lln]?|' +
    +          '0[oO][0-7_]+[Lln]?|' +
    +          '0[bB][01_]+[Lln]?|' +
    +          '[0-9][0-9_]*([Lln]|(\\.[0-9_]*)?([eE][-+]?[0-9_]+)?)?)',
    +        relevance: 0
    +      },
    +      {
    +        begin: /->/ // relevance booster
    +      }
    +    ]
    +  }
    +}
    +
    +module.exports = ocaml;
    diff --git a/node_modules/highlight.js/lib/languages/openscad.js b/node_modules/highlight.js/lib/languages/openscad.js
    new file mode 100644
    index 0000000..5470805
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/openscad.js
    @@ -0,0 +1,81 @@
    +/*
    +Language: OpenSCAD
    +Author: Dan Panzarella 
    +Description: OpenSCAD is a language for the 3D CAD modeling software of the same name.
    +Website: https://www.openscad.org
    +Category: scientific
    +*/
    +
    +function openscad(hljs) {
    +  const SPECIAL_VARS = {
    +    className: 'keyword',
    +    begin: '\\$(f[asn]|t|vp[rtd]|children)'
    +  };
    +  const LITERALS = {
    +    className: 'literal',
    +    begin: 'false|true|PI|undef'
    +  };
    +  const NUMBERS = {
    +    className: 'number',
    +    begin: '\\b\\d+(\\.\\d+)?(e-?\\d+)?', // adds 1e5, 1e-10
    +    relevance: 0
    +  };
    +  const STRING = hljs.inherit(hljs.QUOTE_STRING_MODE, {
    +    illegal: null
    +  });
    +  const PREPRO = {
    +    className: 'meta',
    +    keywords: {
    +      'meta-keyword': 'include use'
    +    },
    +    begin: 'include|use <',
    +    end: '>'
    +  };
    +  const PARAMS = {
    +    className: 'params',
    +    begin: '\\(',
    +    end: '\\)',
    +    contains: [
    +      'self',
    +      NUMBERS,
    +      STRING,
    +      SPECIAL_VARS,
    +      LITERALS
    +    ]
    +  };
    +  const MODIFIERS = {
    +    begin: '[*!#%]',
    +    relevance: 0
    +  };
    +  const FUNCTIONS = {
    +    className: 'function',
    +    beginKeywords: 'module function',
    +    end: /=|\{/,
    +    contains: [
    +      PARAMS,
    +      hljs.UNDERSCORE_TITLE_MODE
    +    ]
    +  };
    +
    +  return {
    +    name: 'OpenSCAD',
    +    aliases: [ 'scad' ],
    +    keywords: {
    +      keyword: 'function module include use for intersection_for if else \\%',
    +      literal: 'false true PI undef',
    +      built_in: 'circle square polygon text sphere cube cylinder polyhedron translate rotate scale resize mirror multmatrix color offset hull minkowski union difference intersection abs sign sin cos tan acos asin atan atan2 floor round ceil ln log pow sqrt exp rands min max concat lookup str chr search version version_num norm cross parent_module echo import import_dxf dxf_linear_extrude linear_extrude rotate_extrude surface projection render children dxf_cross dxf_dim let assign'
    +    },
    +    contains: [
    +      hljs.C_LINE_COMMENT_MODE,
    +      hljs.C_BLOCK_COMMENT_MODE,
    +      NUMBERS,
    +      PREPRO,
    +      STRING,
    +      SPECIAL_VARS,
    +      MODIFIERS,
    +      FUNCTIONS
    +    ]
    +  };
    +}
    +
    +module.exports = openscad;
    diff --git a/node_modules/highlight.js/lib/languages/oxygene.js b/node_modules/highlight.js/lib/languages/oxygene.js
    new file mode 100644
    index 0000000..4649cf8
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/oxygene.js
    @@ -0,0 +1,101 @@
    +/*
    +Language: Oxygene
    +Author: Carlo Kok 
    +Description: Oxygene is built on the foundation of Object Pascal, revamped and extended to be a modern language for the twenty-first century.
    +Website: https://www.elementscompiler.com/elements/default.aspx
    +*/
    +
    +function oxygene(hljs) {
    +  const OXYGENE_KEYWORDS = {
    +    $pattern: /\.?\w+/,
    +    keyword:
    +      'abstract add and array as asc aspect assembly async begin break block by case class concat const copy constructor continue ' +
    +      'create default delegate desc distinct div do downto dynamic each else empty end ensure enum equals event except exit extension external false ' +
    +      'final finalize finalizer finally flags for forward from function future global group has if implementation implements implies in index inherited ' +
    +      'inline interface into invariants is iterator join locked locking loop matching method mod module namespace nested new nil not notify nullable of ' +
    +      'old on operator or order out override parallel params partial pinned private procedure property protected public queryable raise read readonly ' +
    +      'record reintroduce remove repeat require result reverse sealed select self sequence set shl shr skip static step soft take then to true try tuple ' +
    +      'type union unit unsafe until uses using var virtual raises volatile where while with write xor yield await mapped deprecated stdcall cdecl pascal ' +
    +      'register safecall overload library platform reference packed strict published autoreleasepool selector strong weak unretained'
    +  };
    +  const CURLY_COMMENT = hljs.COMMENT(
    +    /\{/,
    +    /\}/,
    +    {
    +      relevance: 0
    +    }
    +  );
    +  const PAREN_COMMENT = hljs.COMMENT(
    +    '\\(\\*',
    +    '\\*\\)',
    +    {
    +      relevance: 10
    +    }
    +  );
    +  const STRING = {
    +    className: 'string',
    +    begin: '\'',
    +    end: '\'',
    +    contains: [
    +      {
    +        begin: '\'\''
    +      }
    +    ]
    +  };
    +  const CHAR_STRING = {
    +    className: 'string',
    +    begin: '(#\\d+)+'
    +  };
    +  const FUNCTION = {
    +    className: 'function',
    +    beginKeywords: 'function constructor destructor procedure method',
    +    end: '[:;]',
    +    keywords: 'function constructor|10 destructor|10 procedure|10 method|10',
    +    contains: [
    +      hljs.TITLE_MODE,
    +      {
    +        className: 'params',
    +        begin: '\\(',
    +        end: '\\)',
    +        keywords: OXYGENE_KEYWORDS,
    +        contains: [
    +          STRING,
    +          CHAR_STRING
    +        ]
    +      },
    +      CURLY_COMMENT,
    +      PAREN_COMMENT
    +    ]
    +  };
    +  return {
    +    name: 'Oxygene',
    +    case_insensitive: true,
    +    keywords: OXYGENE_KEYWORDS,
    +    illegal: '("|\\$[G-Zg-z]|\\/\\*||->)',
    +    contains: [
    +      CURLY_COMMENT,
    +      PAREN_COMMENT,
    +      hljs.C_LINE_COMMENT_MODE,
    +      STRING,
    +      CHAR_STRING,
    +      hljs.NUMBER_MODE,
    +      FUNCTION,
    +      {
    +        className: 'class',
    +        begin: '=\\bclass\\b',
    +        end: 'end;',
    +        keywords: OXYGENE_KEYWORDS,
    +        contains: [
    +          STRING,
    +          CHAR_STRING,
    +          CURLY_COMMENT,
    +          PAREN_COMMENT,
    +          hljs.C_LINE_COMMENT_MODE,
    +          FUNCTION
    +        ]
    +      }
    +    ]
    +  };
    +}
    +
    +module.exports = oxygene;
    diff --git a/node_modules/highlight.js/lib/languages/parser3.js b/node_modules/highlight.js/lib/languages/parser3.js
    new file mode 100644
    index 0000000..708b02c
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/parser3.js
    @@ -0,0 +1,57 @@
    +/*
    +Language: Parser3
    +Requires: xml.js
    +Author: Oleg Volchkov 
    +Website: https://www.parser.ru/en/
    +Category: template
    +*/
    +
    +function parser3(hljs) {
    +  const CURLY_SUBCOMMENT = hljs.COMMENT(
    +    /\{/,
    +    /\}/,
    +    {
    +      contains: [ 'self' ]
    +    }
    +  );
    +  return {
    +    name: 'Parser3',
    +    subLanguage: 'xml',
    +    relevance: 0,
    +    contains: [
    +      hljs.COMMENT('^#', '$'),
    +      hljs.COMMENT(
    +        /\^rem\{/,
    +        /\}/,
    +        {
    +          relevance: 10,
    +          contains: [ CURLY_SUBCOMMENT ]
    +        }
    +      ),
    +      {
    +        className: 'meta',
    +        begin: '^@(?:BASE|USE|CLASS|OPTIONS)$',
    +        relevance: 10
    +      },
    +      {
    +        className: 'title',
    +        begin: '@[\\w\\-]+\\[[\\w^;\\-]*\\](?:\\[[\\w^;\\-]*\\])?(?:.*)$'
    +      },
    +      {
    +        className: 'variable',
    +        begin: /\$\{?[\w\-.:]+\}?/
    +      },
    +      {
    +        className: 'keyword',
    +        begin: /\^[\w\-.:]+/
    +      },
    +      {
    +        className: 'number',
    +        begin: '\\^#[0-9a-fA-F]+'
    +      },
    +      hljs.C_NUMBER_MODE
    +    ]
    +  };
    +}
    +
    +module.exports = parser3;
    diff --git a/node_modules/highlight.js/lib/languages/perl.js b/node_modules/highlight.js/lib/languages/perl.js
    new file mode 100644
    index 0000000..6842d6c
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/perl.js
    @@ -0,0 +1,240 @@
    +/**
    + * @param {string} value
    + * @returns {RegExp}
    + * */
    +
    +/**
    + * @param {RegExp | string } re
    + * @returns {string}
    + */
    +function source(re) {
    +  if (!re) return null;
    +  if (typeof re === "string") return re;
    +
    +  return re.source;
    +}
    +
    +/**
    + * @param {...(RegExp | string) } args
    + * @returns {string}
    + */
    +function concat(...args) {
    +  const joined = args.map((x) => source(x)).join("");
    +  return joined;
    +}
    +
    +/*
    +Language: Perl
    +Author: Peter Leonov 
    +Website: https://www.perl.org
    +Category: common
    +*/
    +
    +/** @type LanguageFn */
    +function perl(hljs) {
    +  // https://perldoc.perl.org/perlre#Modifiers
    +  const REGEX_MODIFIERS = /[dualxmsipn]{0,12}/; // aa and xx are valid, making max length 12
    +  const PERL_KEYWORDS = {
    +    $pattern: /[\w.]+/,
    +    keyword: 'getpwent getservent quotemeta msgrcv scalar kill dbmclose undef lc ' +
    +    'ma syswrite tr send umask sysopen shmwrite vec qx utime local oct semctl localtime ' +
    +    'readpipe do return format read sprintf dbmopen pop getpgrp not getpwnam rewinddir qq ' +
    +    'fileno qw endprotoent wait sethostent bless s|0 opendir continue each sleep endgrent ' +
    +    'shutdown dump chomp connect getsockname die socketpair close flock exists index shmget ' +
    +    'sub for endpwent redo lstat msgctl setpgrp abs exit select print ref gethostbyaddr ' +
    +    'unshift fcntl syscall goto getnetbyaddr join gmtime symlink semget splice x|0 ' +
    +    'getpeername recv log setsockopt cos last reverse gethostbyname getgrnam study formline ' +
    +    'endhostent times chop length gethostent getnetent pack getprotoent getservbyname rand ' +
    +    'mkdir pos chmod y|0 substr endnetent printf next open msgsnd readdir use unlink ' +
    +    'getsockopt getpriority rindex wantarray hex system getservbyport endservent int chr ' +
    +    'untie rmdir prototype tell listen fork shmread ucfirst setprotoent else sysseek link ' +
    +    'getgrgid shmctl waitpid unpack getnetbyname reset chdir grep split require caller ' +
    +    'lcfirst until warn while values shift telldir getpwuid my getprotobynumber delete and ' +
    +    'sort uc defined srand accept package seekdir getprotobyname semop our rename seek if q|0 ' +
    +    'chroot sysread setpwent no crypt getc chown sqrt write setnetent setpriority foreach ' +
    +    'tie sin msgget map stat getlogin unless elsif truncate exec keys glob tied closedir ' +
    +    'ioctl socket readlink eval xor readline binmode setservent eof ord bind alarm pipe ' +
    +    'atan2 getgrent exp time push setgrent gt lt or ne m|0 break given say state when'
    +  };
    +  const SUBST = {
    +    className: 'subst',
    +    begin: '[$@]\\{',
    +    end: '\\}',
    +    keywords: PERL_KEYWORDS
    +  };
    +  const METHOD = {
    +    begin: /->\{/,
    +    end: /\}/
    +    // contains defined later
    +  };
    +  const VAR = {
    +    variants: [
    +      {
    +        begin: /\$\d/
    +      },
    +      {
    +        begin: concat(
    +          /[$%@](\^\w\b|#\w+(::\w+)*|\{\w+\}|\w+(::\w*)*)/,
    +          // negative look-ahead tries to avoid matching patterns that are not
    +          // Perl at all like $ident$, @ident@, etc.
    +          `(?![A-Za-z])(?![@$%])`
    +        )
    +      },
    +      {
    +        begin: /[$%@][^\s\w{]/,
    +        relevance: 0
    +      }
    +    ]
    +  };
    +  const STRING_CONTAINS = [
    +    hljs.BACKSLASH_ESCAPE,
    +    SUBST,
    +    VAR
    +  ];
    +  const PERL_DEFAULT_CONTAINS = [
    +    VAR,
    +    hljs.HASH_COMMENT_MODE,
    +    hljs.COMMENT(
    +      /^=\w/,
    +      /=cut/,
    +      {
    +        endsWithParent: true
    +      }
    +    ),
    +    METHOD,
    +    {
    +      className: 'string',
    +      contains: STRING_CONTAINS,
    +      variants: [
    +        {
    +          begin: 'q[qwxr]?\\s*\\(',
    +          end: '\\)',
    +          relevance: 5
    +        },
    +        {
    +          begin: 'q[qwxr]?\\s*\\[',
    +          end: '\\]',
    +          relevance: 5
    +        },
    +        {
    +          begin: 'q[qwxr]?\\s*\\{',
    +          end: '\\}',
    +          relevance: 5
    +        },
    +        {
    +          begin: 'q[qwxr]?\\s*\\|',
    +          end: '\\|',
    +          relevance: 5
    +        },
    +        {
    +          begin: 'q[qwxr]?\\s*<',
    +          end: '>',
    +          relevance: 5
    +        },
    +        {
    +          begin: 'qw\\s+q',
    +          end: 'q',
    +          relevance: 5
    +        },
    +        {
    +          begin: '\'',
    +          end: '\'',
    +          contains: [ hljs.BACKSLASH_ESCAPE ]
    +        },
    +        {
    +          begin: '"',
    +          end: '"'
    +        },
    +        {
    +          begin: '`',
    +          end: '`',
    +          contains: [ hljs.BACKSLASH_ESCAPE ]
    +        },
    +        {
    +          begin: /\{\w+\}/,
    +          contains: [],
    +          relevance: 0
    +        },
    +        {
    +          begin: '-?\\w+\\s*=>',
    +          contains: [],
    +          relevance: 0
    +        }
    +      ]
    +    },
    +    {
    +      className: 'number',
    +      begin: '(\\b0[0-7_]+)|(\\b0x[0-9a-fA-F_]+)|(\\b[1-9][0-9_]*(\\.[0-9_]+)?)|[0_]\\b',
    +      relevance: 0
    +    },
    +    { // regexp container
    +      begin: '(\\/\\/|' + hljs.RE_STARTERS_RE + '|\\b(split|return|print|reverse|grep)\\b)\\s*',
    +      keywords: 'split return print reverse grep',
    +      relevance: 0,
    +      contains: [
    +        hljs.HASH_COMMENT_MODE,
    +        {
    +          className: 'regexp',
    +          begin: concat(
    +            /(s|tr|y)/,
    +            /\//,
    +            /(\\.|[^\\\/])*/,
    +            /\//,
    +            /(\\.|[^\\\/])*/,
    +            /\//,
    +            REGEX_MODIFIERS,
    +          ),
    +          relevance: 10
    +        },
    +        {
    +          className: 'regexp',
    +          begin: /(m|qr)?\//,
    +          end: concat(
    +            /\//,
    +            REGEX_MODIFIERS
    +          ),
    +          contains: [ hljs.BACKSLASH_ESCAPE ],
    +          relevance: 0 // allows empty "//" which is a common comment delimiter in other languages
    +        }
    +      ]
    +    },
    +    {
    +      className: 'function',
    +      beginKeywords: 'sub',
    +      end: '(\\s*\\(.*?\\))?[;{]',
    +      excludeEnd: true,
    +      relevance: 5,
    +      contains: [ hljs.TITLE_MODE ]
    +    },
    +    {
    +      begin: '-\\w\\b',
    +      relevance: 0
    +    },
    +    {
    +      begin: "^__DATA__$",
    +      end: "^__END__$",
    +      subLanguage: 'mojolicious',
    +      contains: [
    +        {
    +          begin: "^@@.*",
    +          end: "$",
    +          className: "comment"
    +        }
    +      ]
    +    }
    +  ];
    +  SUBST.contains = PERL_DEFAULT_CONTAINS;
    +  METHOD.contains = PERL_DEFAULT_CONTAINS;
    +
    +  return {
    +    name: 'Perl',
    +    aliases: [
    +      'pl',
    +      'pm'
    +    ],
    +    keywords: PERL_KEYWORDS,
    +    contains: PERL_DEFAULT_CONTAINS
    +  };
    +}
    +
    +module.exports = perl;
    diff --git a/node_modules/highlight.js/lib/languages/pf.js b/node_modules/highlight.js/lib/languages/pf.js
    new file mode 100644
    index 0000000..6068936
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/pf.js
    @@ -0,0 +1,59 @@
    +/*
    +Language: Packet Filter config
    +Description: pf.conf — packet filter configuration file (OpenBSD)
    +Author: Peter Piwowarski 
    +Website: http://man.openbsd.org/pf.conf
    +Category: config
    +*/
    +
    +function pf(hljs) {
    +  const MACRO = {
    +    className: 'variable',
    +    begin: /\$[\w\d#@][\w\d_]*/
    +  };
    +  const TABLE = {
    +    className: 'variable',
    +    begin: /<(?!\/)/,
    +    end: />/
    +  };
    +
    +  return {
    +    name: 'Packet Filter config',
    +    aliases: [ 'pf.conf' ],
    +    keywords: {
    +      $pattern: /[a-z0-9_<>-]+/,
    +      built_in: /* block match pass are "actions" in pf.conf(5), the rest are
    +                 * lexically similar top-level commands.
    +                 */
    +        'block match pass load anchor|5 antispoof|10 set table',
    +      keyword:
    +        'in out log quick on rdomain inet inet6 proto from port os to route ' +
    +        'allow-opts divert-packet divert-reply divert-to flags group icmp-type ' +
    +        'icmp6-type label once probability recieved-on rtable prio queue ' +
    +        'tos tag tagged user keep fragment for os drop ' +
    +        'af-to|10 binat-to|10 nat-to|10 rdr-to|10 bitmask least-stats random round-robin ' +
    +        'source-hash static-port ' +
    +        'dup-to reply-to route-to ' +
    +        'parent bandwidth default min max qlimit ' +
    +        'block-policy debug fingerprints hostid limit loginterface optimization ' +
    +        'reassemble ruleset-optimization basic none profile skip state-defaults ' +
    +        'state-policy timeout ' +
    +        'const counters persist ' +
    +        'no modulate synproxy state|5 floating if-bound no-sync pflow|10 sloppy ' +
    +        'source-track global rule max-src-nodes max-src-states max-src-conn ' +
    +        'max-src-conn-rate overload flush ' +
    +        'scrub|5 max-mss min-ttl no-df|10 random-id',
    +      literal:
    +        'all any no-route self urpf-failed egress|5 unknown'
    +    },
    +    contains: [
    +      hljs.HASH_COMMENT_MODE,
    +      hljs.NUMBER_MODE,
    +      hljs.QUOTE_STRING_MODE,
    +      MACRO,
    +      TABLE
    +    ]
    +  };
    +}
    +
    +module.exports = pf;
    diff --git a/node_modules/highlight.js/lib/languages/pgsql.js b/node_modules/highlight.js/lib/languages/pgsql.js
    new file mode 100644
    index 0000000..9978c2d
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/pgsql.js
    @@ -0,0 +1,630 @@
    +/*
    +Language: PostgreSQL and PL/pgSQL
    +Author: Egor Rogov (e.rogov@postgrespro.ru)
    +Website: https://www.postgresql.org/docs/11/sql.html
    +Description:
    +    This language incorporates both PostgreSQL SQL dialect and PL/pgSQL language.
    +    It is based on PostgreSQL version 11. Some notes:
    +    - Text in double-dollar-strings is _always_ interpreted as some programming code. Text
    +      in ordinary quotes is _never_ interpreted that way and highlighted just as a string.
    +    - There are quite a bit "special cases". That's because many keywords are not strictly
    +      they are keywords in some contexts and ordinary identifiers in others. Only some
    +      of such cases are handled; you still can get some of your identifiers highlighted
    +      wrong way.
    +    - Function names deliberately are not highlighted. There is no way to tell function
    +      call from other constructs, hence we can't highlight _all_ function names. And
    +      some names highlighted while others not looks ugly.
    +*/
    +
    +function pgsql(hljs) {
    +  const COMMENT_MODE = hljs.COMMENT('--', '$');
    +  const UNQUOTED_IDENT = '[a-zA-Z_][a-zA-Z_0-9$]*';
    +  const DOLLAR_STRING = '\\$([a-zA-Z_]?|[a-zA-Z_][a-zA-Z_0-9]*)\\$';
    +  const LABEL = '<<\\s*' + UNQUOTED_IDENT + '\\s*>>';
    +
    +  const SQL_KW =
    +    // https://www.postgresql.org/docs/11/static/sql-keywords-appendix.html
    +    // https://www.postgresql.org/docs/11/static/sql-commands.html
    +    // SQL commands (starting words)
    +    'ABORT ALTER ANALYZE BEGIN CALL CHECKPOINT|10 CLOSE CLUSTER COMMENT COMMIT COPY CREATE DEALLOCATE DECLARE ' +
    +    'DELETE DISCARD DO DROP END EXECUTE EXPLAIN FETCH GRANT IMPORT INSERT LISTEN LOAD LOCK MOVE NOTIFY ' +
    +    'PREPARE REASSIGN|10 REFRESH REINDEX RELEASE RESET REVOKE ROLLBACK SAVEPOINT SECURITY SELECT SET SHOW ' +
    +    'START TRUNCATE UNLISTEN|10 UPDATE VACUUM|10 VALUES ' +
    +    // SQL commands (others)
    +    'AGGREGATE COLLATION CONVERSION|10 DATABASE DEFAULT PRIVILEGES DOMAIN TRIGGER EXTENSION FOREIGN ' +
    +    'WRAPPER|10 TABLE FUNCTION GROUP LANGUAGE LARGE OBJECT MATERIALIZED VIEW OPERATOR CLASS ' +
    +    'FAMILY POLICY PUBLICATION|10 ROLE RULE SCHEMA SEQUENCE SERVER STATISTICS SUBSCRIPTION SYSTEM ' +
    +    'TABLESPACE CONFIGURATION DICTIONARY PARSER TEMPLATE TYPE USER MAPPING PREPARED ACCESS ' +
    +    'METHOD CAST AS TRANSFORM TRANSACTION OWNED TO INTO SESSION AUTHORIZATION ' +
    +    'INDEX PROCEDURE ASSERTION ' +
    +    // additional reserved key words
    +    'ALL ANALYSE AND ANY ARRAY ASC ASYMMETRIC|10 BOTH CASE CHECK ' +
    +    'COLLATE COLUMN CONCURRENTLY|10 CONSTRAINT CROSS ' +
    +    'DEFERRABLE RANGE ' +
    +    'DESC DISTINCT ELSE EXCEPT FOR FREEZE|10 FROM FULL HAVING ' +
    +    'ILIKE IN INITIALLY INNER INTERSECT IS ISNULL JOIN LATERAL LEADING LIKE LIMIT ' +
    +    'NATURAL NOT NOTNULL NULL OFFSET ON ONLY OR ORDER OUTER OVERLAPS PLACING PRIMARY ' +
    +    'REFERENCES RETURNING SIMILAR SOME SYMMETRIC TABLESAMPLE THEN ' +
    +    'TRAILING UNION UNIQUE USING VARIADIC|10 VERBOSE WHEN WHERE WINDOW WITH ' +
    +    // some of non-reserved (which are used in clauses or as PL/pgSQL keyword)
    +    'BY RETURNS INOUT OUT SETOF|10 IF STRICT CURRENT CONTINUE OWNER LOCATION OVER PARTITION WITHIN ' +
    +    'BETWEEN ESCAPE EXTERNAL INVOKER DEFINER WORK RENAME VERSION CONNECTION CONNECT ' +
    +    'TABLES TEMP TEMPORARY FUNCTIONS SEQUENCES TYPES SCHEMAS OPTION CASCADE RESTRICT ADD ADMIN ' +
    +    'EXISTS VALID VALIDATE ENABLE DISABLE REPLICA|10 ALWAYS PASSING COLUMNS PATH ' +
    +    'REF VALUE OVERRIDING IMMUTABLE STABLE VOLATILE BEFORE AFTER EACH ROW PROCEDURAL ' +
    +    'ROUTINE NO HANDLER VALIDATOR OPTIONS STORAGE OIDS|10 WITHOUT INHERIT DEPENDS CALLED ' +
    +    'INPUT LEAKPROOF|10 COST ROWS NOWAIT SEARCH UNTIL ENCRYPTED|10 PASSWORD CONFLICT|10 ' +
    +    'INSTEAD INHERITS CHARACTERISTICS WRITE CURSOR ALSO STATEMENT SHARE EXCLUSIVE INLINE ' +
    +    'ISOLATION REPEATABLE READ COMMITTED SERIALIZABLE UNCOMMITTED LOCAL GLOBAL SQL PROCEDURES ' +
    +    'RECURSIVE SNAPSHOT ROLLUP CUBE TRUSTED|10 INCLUDE FOLLOWING PRECEDING UNBOUNDED RANGE GROUPS ' +
    +    'UNENCRYPTED|10 SYSID FORMAT DELIMITER HEADER QUOTE ENCODING FILTER OFF ' +
    +    // some parameters of VACUUM/ANALYZE/EXPLAIN
    +    'FORCE_QUOTE FORCE_NOT_NULL FORCE_NULL COSTS BUFFERS TIMING SUMMARY DISABLE_PAGE_SKIPPING ' +
    +    //
    +    'RESTART CYCLE GENERATED IDENTITY DEFERRED IMMEDIATE LEVEL LOGGED UNLOGGED ' +
    +    'OF NOTHING NONE EXCLUDE ATTRIBUTE ' +
    +    // from GRANT (not keywords actually)
    +    'USAGE ROUTINES ' +
    +    // actually literals, but look better this way (due to IS TRUE, IS FALSE, ISNULL etc)
    +    'TRUE FALSE NAN INFINITY ';
    +
    +  const ROLE_ATTRS = // only those not in keywrods already
    +    'SUPERUSER NOSUPERUSER CREATEDB NOCREATEDB CREATEROLE NOCREATEROLE INHERIT NOINHERIT ' +
    +    'LOGIN NOLOGIN REPLICATION NOREPLICATION BYPASSRLS NOBYPASSRLS ';
    +
    +  const PLPGSQL_KW =
    +    'ALIAS BEGIN CONSTANT DECLARE END EXCEPTION RETURN PERFORM|10 RAISE GET DIAGNOSTICS ' +
    +    'STACKED|10 FOREACH LOOP ELSIF EXIT WHILE REVERSE SLICE DEBUG LOG INFO NOTICE WARNING ASSERT ' +
    +    'OPEN ';
    +
    +  const TYPES =
    +    // https://www.postgresql.org/docs/11/static/datatype.html
    +    'BIGINT INT8 BIGSERIAL SERIAL8 BIT VARYING VARBIT BOOLEAN BOOL BOX BYTEA CHARACTER CHAR VARCHAR ' +
    +    'CIDR CIRCLE DATE DOUBLE PRECISION FLOAT8 FLOAT INET INTEGER INT INT4 INTERVAL JSON JSONB LINE LSEG|10 ' +
    +    'MACADDR MACADDR8 MONEY NUMERIC DEC DECIMAL PATH POINT POLYGON REAL FLOAT4 SMALLINT INT2 ' +
    +    'SMALLSERIAL|10 SERIAL2|10 SERIAL|10 SERIAL4|10 TEXT TIME ZONE TIMETZ|10 TIMESTAMP TIMESTAMPTZ|10 TSQUERY|10 TSVECTOR|10 ' +
    +    'TXID_SNAPSHOT|10 UUID XML NATIONAL NCHAR ' +
    +    'INT4RANGE|10 INT8RANGE|10 NUMRANGE|10 TSRANGE|10 TSTZRANGE|10 DATERANGE|10 ' +
    +    // pseudotypes
    +    'ANYELEMENT ANYARRAY ANYNONARRAY ANYENUM ANYRANGE CSTRING INTERNAL ' +
    +    'RECORD PG_DDL_COMMAND VOID UNKNOWN OPAQUE REFCURSOR ' +
    +    // spec. type
    +    'NAME ' +
    +    // OID-types
    +    'OID REGPROC|10 REGPROCEDURE|10 REGOPER|10 REGOPERATOR|10 REGCLASS|10 REGTYPE|10 REGROLE|10 ' +
    +    'REGNAMESPACE|10 REGCONFIG|10 REGDICTIONARY|10 ';// +
    +
    +  const TYPES_RE =
    +    TYPES.trim()
    +      .split(' ')
    +      .map(function(val) { return val.split('|')[0]; })
    +      .join('|');
    +
    +  const SQL_BI =
    +    'CURRENT_TIME CURRENT_TIMESTAMP CURRENT_USER CURRENT_CATALOG|10 CURRENT_DATE LOCALTIME LOCALTIMESTAMP ' +
    +    'CURRENT_ROLE|10 CURRENT_SCHEMA|10 SESSION_USER PUBLIC ';
    +
    +  const PLPGSQL_BI =
    +    'FOUND NEW OLD TG_NAME|10 TG_WHEN|10 TG_LEVEL|10 TG_OP|10 TG_RELID|10 TG_RELNAME|10 ' +
    +    'TG_TABLE_NAME|10 TG_TABLE_SCHEMA|10 TG_NARGS|10 TG_ARGV|10 TG_EVENT|10 TG_TAG|10 ' +
    +    // get diagnostics
    +    'ROW_COUNT RESULT_OID|10 PG_CONTEXT|10 RETURNED_SQLSTATE COLUMN_NAME CONSTRAINT_NAME ' +
    +    'PG_DATATYPE_NAME|10 MESSAGE_TEXT TABLE_NAME SCHEMA_NAME PG_EXCEPTION_DETAIL|10 ' +
    +    'PG_EXCEPTION_HINT|10 PG_EXCEPTION_CONTEXT|10 ';
    +
    +  const PLPGSQL_EXCEPTIONS =
    +    // exceptions https://www.postgresql.org/docs/current/static/errcodes-appendix.html
    +    'SQLSTATE SQLERRM|10 ' +
    +    'SUCCESSFUL_COMPLETION WARNING DYNAMIC_RESULT_SETS_RETURNED IMPLICIT_ZERO_BIT_PADDING ' +
    +    'NULL_VALUE_ELIMINATED_IN_SET_FUNCTION PRIVILEGE_NOT_GRANTED PRIVILEGE_NOT_REVOKED ' +
    +    'STRING_DATA_RIGHT_TRUNCATION DEPRECATED_FEATURE NO_DATA NO_ADDITIONAL_DYNAMIC_RESULT_SETS_RETURNED ' +
    +    'SQL_STATEMENT_NOT_YET_COMPLETE CONNECTION_EXCEPTION CONNECTION_DOES_NOT_EXIST CONNECTION_FAILURE ' +
    +    'SQLCLIENT_UNABLE_TO_ESTABLISH_SQLCONNECTION SQLSERVER_REJECTED_ESTABLISHMENT_OF_SQLCONNECTION ' +
    +    'TRANSACTION_RESOLUTION_UNKNOWN PROTOCOL_VIOLATION TRIGGERED_ACTION_EXCEPTION FEATURE_NOT_SUPPORTED ' +
    +    'INVALID_TRANSACTION_INITIATION LOCATOR_EXCEPTION INVALID_LOCATOR_SPECIFICATION INVALID_GRANTOR ' +
    +    'INVALID_GRANT_OPERATION INVALID_ROLE_SPECIFICATION DIAGNOSTICS_EXCEPTION ' +
    +    'STACKED_DIAGNOSTICS_ACCESSED_WITHOUT_ACTIVE_HANDLER CASE_NOT_FOUND CARDINALITY_VIOLATION ' +
    +    'DATA_EXCEPTION ARRAY_SUBSCRIPT_ERROR CHARACTER_NOT_IN_REPERTOIRE DATETIME_FIELD_OVERFLOW ' +
    +    'DIVISION_BY_ZERO ERROR_IN_ASSIGNMENT ESCAPE_CHARACTER_CONFLICT INDICATOR_OVERFLOW ' +
    +    'INTERVAL_FIELD_OVERFLOW INVALID_ARGUMENT_FOR_LOGARITHM INVALID_ARGUMENT_FOR_NTILE_FUNCTION ' +
    +    'INVALID_ARGUMENT_FOR_NTH_VALUE_FUNCTION INVALID_ARGUMENT_FOR_POWER_FUNCTION ' +
    +    'INVALID_ARGUMENT_FOR_WIDTH_BUCKET_FUNCTION INVALID_CHARACTER_VALUE_FOR_CAST ' +
    +    'INVALID_DATETIME_FORMAT INVALID_ESCAPE_CHARACTER INVALID_ESCAPE_OCTET INVALID_ESCAPE_SEQUENCE ' +
    +    'NONSTANDARD_USE_OF_ESCAPE_CHARACTER INVALID_INDICATOR_PARAMETER_VALUE INVALID_PARAMETER_VALUE ' +
    +    'INVALID_REGULAR_EXPRESSION INVALID_ROW_COUNT_IN_LIMIT_CLAUSE ' +
    +    'INVALID_ROW_COUNT_IN_RESULT_OFFSET_CLAUSE INVALID_TABLESAMPLE_ARGUMENT INVALID_TABLESAMPLE_REPEAT ' +
    +    'INVALID_TIME_ZONE_DISPLACEMENT_VALUE INVALID_USE_OF_ESCAPE_CHARACTER MOST_SPECIFIC_TYPE_MISMATCH ' +
    +    'NULL_VALUE_NOT_ALLOWED NULL_VALUE_NO_INDICATOR_PARAMETER NUMERIC_VALUE_OUT_OF_RANGE ' +
    +    'SEQUENCE_GENERATOR_LIMIT_EXCEEDED STRING_DATA_LENGTH_MISMATCH STRING_DATA_RIGHT_TRUNCATION ' +
    +    'SUBSTRING_ERROR TRIM_ERROR UNTERMINATED_C_STRING ZERO_LENGTH_CHARACTER_STRING ' +
    +    'FLOATING_POINT_EXCEPTION INVALID_TEXT_REPRESENTATION INVALID_BINARY_REPRESENTATION ' +
    +    'BAD_COPY_FILE_FORMAT UNTRANSLATABLE_CHARACTER NOT_AN_XML_DOCUMENT INVALID_XML_DOCUMENT ' +
    +    'INVALID_XML_CONTENT INVALID_XML_COMMENT INVALID_XML_PROCESSING_INSTRUCTION ' +
    +    'INTEGRITY_CONSTRAINT_VIOLATION RESTRICT_VIOLATION NOT_NULL_VIOLATION FOREIGN_KEY_VIOLATION ' +
    +    'UNIQUE_VIOLATION CHECK_VIOLATION EXCLUSION_VIOLATION INVALID_CURSOR_STATE ' +
    +    'INVALID_TRANSACTION_STATE ACTIVE_SQL_TRANSACTION BRANCH_TRANSACTION_ALREADY_ACTIVE ' +
    +    'HELD_CURSOR_REQUIRES_SAME_ISOLATION_LEVEL INAPPROPRIATE_ACCESS_MODE_FOR_BRANCH_TRANSACTION ' +
    +    'INAPPROPRIATE_ISOLATION_LEVEL_FOR_BRANCH_TRANSACTION ' +
    +    'NO_ACTIVE_SQL_TRANSACTION_FOR_BRANCH_TRANSACTION READ_ONLY_SQL_TRANSACTION ' +
    +    'SCHEMA_AND_DATA_STATEMENT_MIXING_NOT_SUPPORTED NO_ACTIVE_SQL_TRANSACTION ' +
    +    'IN_FAILED_SQL_TRANSACTION IDLE_IN_TRANSACTION_SESSION_TIMEOUT INVALID_SQL_STATEMENT_NAME ' +
    +    'TRIGGERED_DATA_CHANGE_VIOLATION INVALID_AUTHORIZATION_SPECIFICATION INVALID_PASSWORD ' +
    +    'DEPENDENT_PRIVILEGE_DESCRIPTORS_STILL_EXIST DEPENDENT_OBJECTS_STILL_EXIST ' +
    +    'INVALID_TRANSACTION_TERMINATION SQL_ROUTINE_EXCEPTION FUNCTION_EXECUTED_NO_RETURN_STATEMENT ' +
    +    'MODIFYING_SQL_DATA_NOT_PERMITTED PROHIBITED_SQL_STATEMENT_ATTEMPTED ' +
    +    'READING_SQL_DATA_NOT_PERMITTED INVALID_CURSOR_NAME EXTERNAL_ROUTINE_EXCEPTION ' +
    +    'CONTAINING_SQL_NOT_PERMITTED MODIFYING_SQL_DATA_NOT_PERMITTED ' +
    +    'PROHIBITED_SQL_STATEMENT_ATTEMPTED READING_SQL_DATA_NOT_PERMITTED ' +
    +    'EXTERNAL_ROUTINE_INVOCATION_EXCEPTION INVALID_SQLSTATE_RETURNED NULL_VALUE_NOT_ALLOWED ' +
    +    'TRIGGER_PROTOCOL_VIOLATED SRF_PROTOCOL_VIOLATED EVENT_TRIGGER_PROTOCOL_VIOLATED ' +
    +    'SAVEPOINT_EXCEPTION INVALID_SAVEPOINT_SPECIFICATION INVALID_CATALOG_NAME ' +
    +    'INVALID_SCHEMA_NAME TRANSACTION_ROLLBACK TRANSACTION_INTEGRITY_CONSTRAINT_VIOLATION ' +
    +    'SERIALIZATION_FAILURE STATEMENT_COMPLETION_UNKNOWN DEADLOCK_DETECTED ' +
    +    'SYNTAX_ERROR_OR_ACCESS_RULE_VIOLATION SYNTAX_ERROR INSUFFICIENT_PRIVILEGE CANNOT_COERCE ' +
    +    'GROUPING_ERROR WINDOWING_ERROR INVALID_RECURSION INVALID_FOREIGN_KEY INVALID_NAME ' +
    +    'NAME_TOO_LONG RESERVED_NAME DATATYPE_MISMATCH INDETERMINATE_DATATYPE COLLATION_MISMATCH ' +
    +    'INDETERMINATE_COLLATION WRONG_OBJECT_TYPE GENERATED_ALWAYS UNDEFINED_COLUMN ' +
    +    'UNDEFINED_FUNCTION UNDEFINED_TABLE UNDEFINED_PARAMETER UNDEFINED_OBJECT ' +
    +    'DUPLICATE_COLUMN DUPLICATE_CURSOR DUPLICATE_DATABASE DUPLICATE_FUNCTION ' +
    +    'DUPLICATE_PREPARED_STATEMENT DUPLICATE_SCHEMA DUPLICATE_TABLE DUPLICATE_ALIAS ' +
    +    'DUPLICATE_OBJECT AMBIGUOUS_COLUMN AMBIGUOUS_FUNCTION AMBIGUOUS_PARAMETER AMBIGUOUS_ALIAS ' +
    +    'INVALID_COLUMN_REFERENCE INVALID_COLUMN_DEFINITION INVALID_CURSOR_DEFINITION ' +
    +    'INVALID_DATABASE_DEFINITION INVALID_FUNCTION_DEFINITION ' +
    +    'INVALID_PREPARED_STATEMENT_DEFINITION INVALID_SCHEMA_DEFINITION INVALID_TABLE_DEFINITION ' +
    +    'INVALID_OBJECT_DEFINITION WITH_CHECK_OPTION_VIOLATION INSUFFICIENT_RESOURCES DISK_FULL ' +
    +    'OUT_OF_MEMORY TOO_MANY_CONNECTIONS CONFIGURATION_LIMIT_EXCEEDED PROGRAM_LIMIT_EXCEEDED ' +
    +    'STATEMENT_TOO_COMPLEX TOO_MANY_COLUMNS TOO_MANY_ARGUMENTS OBJECT_NOT_IN_PREREQUISITE_STATE ' +
    +    'OBJECT_IN_USE CANT_CHANGE_RUNTIME_PARAM LOCK_NOT_AVAILABLE OPERATOR_INTERVENTION ' +
    +    'QUERY_CANCELED ADMIN_SHUTDOWN CRASH_SHUTDOWN CANNOT_CONNECT_NOW DATABASE_DROPPED ' +
    +    'SYSTEM_ERROR IO_ERROR UNDEFINED_FILE DUPLICATE_FILE SNAPSHOT_TOO_OLD CONFIG_FILE_ERROR ' +
    +    'LOCK_FILE_EXISTS FDW_ERROR FDW_COLUMN_NAME_NOT_FOUND FDW_DYNAMIC_PARAMETER_VALUE_NEEDED ' +
    +    'FDW_FUNCTION_SEQUENCE_ERROR FDW_INCONSISTENT_DESCRIPTOR_INFORMATION ' +
    +    'FDW_INVALID_ATTRIBUTE_VALUE FDW_INVALID_COLUMN_NAME FDW_INVALID_COLUMN_NUMBER ' +
    +    'FDW_INVALID_DATA_TYPE FDW_INVALID_DATA_TYPE_DESCRIPTORS ' +
    +    'FDW_INVALID_DESCRIPTOR_FIELD_IDENTIFIER FDW_INVALID_HANDLE FDW_INVALID_OPTION_INDEX ' +
    +    'FDW_INVALID_OPTION_NAME FDW_INVALID_STRING_LENGTH_OR_BUFFER_LENGTH ' +
    +    'FDW_INVALID_STRING_FORMAT FDW_INVALID_USE_OF_NULL_POINTER FDW_TOO_MANY_HANDLES ' +
    +    'FDW_OUT_OF_MEMORY FDW_NO_SCHEMAS FDW_OPTION_NAME_NOT_FOUND FDW_REPLY_HANDLE ' +
    +    'FDW_SCHEMA_NOT_FOUND FDW_TABLE_NOT_FOUND FDW_UNABLE_TO_CREATE_EXECUTION ' +
    +    'FDW_UNABLE_TO_CREATE_REPLY FDW_UNABLE_TO_ESTABLISH_CONNECTION PLPGSQL_ERROR ' +
    +    'RAISE_EXCEPTION NO_DATA_FOUND TOO_MANY_ROWS ASSERT_FAILURE INTERNAL_ERROR DATA_CORRUPTED ' +
    +    'INDEX_CORRUPTED ';
    +
    +  const FUNCTIONS =
    +    // https://www.postgresql.org/docs/11/static/functions-aggregate.html
    +    'ARRAY_AGG AVG BIT_AND BIT_OR BOOL_AND BOOL_OR COUNT EVERY JSON_AGG JSONB_AGG JSON_OBJECT_AGG ' +
    +    'JSONB_OBJECT_AGG MAX MIN MODE STRING_AGG SUM XMLAGG ' +
    +    'CORR COVAR_POP COVAR_SAMP REGR_AVGX REGR_AVGY REGR_COUNT REGR_INTERCEPT REGR_R2 REGR_SLOPE ' +
    +    'REGR_SXX REGR_SXY REGR_SYY STDDEV STDDEV_POP STDDEV_SAMP VARIANCE VAR_POP VAR_SAMP ' +
    +    'PERCENTILE_CONT PERCENTILE_DISC ' +
    +    // https://www.postgresql.org/docs/11/static/functions-window.html
    +    'ROW_NUMBER RANK DENSE_RANK PERCENT_RANK CUME_DIST NTILE LAG LEAD FIRST_VALUE LAST_VALUE NTH_VALUE ' +
    +    // https://www.postgresql.org/docs/11/static/functions-comparison.html
    +    'NUM_NONNULLS NUM_NULLS ' +
    +    // https://www.postgresql.org/docs/11/static/functions-math.html
    +    'ABS CBRT CEIL CEILING DEGREES DIV EXP FLOOR LN LOG MOD PI POWER RADIANS ROUND SCALE SIGN SQRT ' +
    +    'TRUNC WIDTH_BUCKET ' +
    +    'RANDOM SETSEED ' +
    +    'ACOS ACOSD ASIN ASIND ATAN ATAND ATAN2 ATAN2D COS COSD COT COTD SIN SIND TAN TAND ' +
    +    // https://www.postgresql.org/docs/11/static/functions-string.html
    +    'BIT_LENGTH CHAR_LENGTH CHARACTER_LENGTH LOWER OCTET_LENGTH OVERLAY POSITION SUBSTRING TREAT TRIM UPPER ' +
    +    'ASCII BTRIM CHR CONCAT CONCAT_WS CONVERT CONVERT_FROM CONVERT_TO DECODE ENCODE INITCAP ' +
    +    'LEFT LENGTH LPAD LTRIM MD5 PARSE_IDENT PG_CLIENT_ENCODING QUOTE_IDENT|10 QUOTE_LITERAL|10 ' +
    +    'QUOTE_NULLABLE|10 REGEXP_MATCH REGEXP_MATCHES REGEXP_REPLACE REGEXP_SPLIT_TO_ARRAY ' +
    +    'REGEXP_SPLIT_TO_TABLE REPEAT REPLACE REVERSE RIGHT RPAD RTRIM SPLIT_PART STRPOS SUBSTR ' +
    +    'TO_ASCII TO_HEX TRANSLATE ' +
    +    // https://www.postgresql.org/docs/11/static/functions-binarystring.html
    +    'OCTET_LENGTH GET_BIT GET_BYTE SET_BIT SET_BYTE ' +
    +    // https://www.postgresql.org/docs/11/static/functions-formatting.html
    +    'TO_CHAR TO_DATE TO_NUMBER TO_TIMESTAMP ' +
    +    // https://www.postgresql.org/docs/11/static/functions-datetime.html
    +    'AGE CLOCK_TIMESTAMP|10 DATE_PART DATE_TRUNC ISFINITE JUSTIFY_DAYS JUSTIFY_HOURS JUSTIFY_INTERVAL ' +
    +    'MAKE_DATE MAKE_INTERVAL|10 MAKE_TIME MAKE_TIMESTAMP|10 MAKE_TIMESTAMPTZ|10 NOW STATEMENT_TIMESTAMP|10 ' +
    +    'TIMEOFDAY TRANSACTION_TIMESTAMP|10 ' +
    +    // https://www.postgresql.org/docs/11/static/functions-enum.html
    +    'ENUM_FIRST ENUM_LAST ENUM_RANGE ' +
    +    // https://www.postgresql.org/docs/11/static/functions-geometry.html
    +    'AREA CENTER DIAMETER HEIGHT ISCLOSED ISOPEN NPOINTS PCLOSE POPEN RADIUS WIDTH ' +
    +    'BOX BOUND_BOX CIRCLE LINE LSEG PATH POLYGON ' +
    +    // https://www.postgresql.org/docs/11/static/functions-net.html
    +    'ABBREV BROADCAST HOST HOSTMASK MASKLEN NETMASK NETWORK SET_MASKLEN TEXT INET_SAME_FAMILY ' +
    +    'INET_MERGE MACADDR8_SET7BIT ' +
    +    // https://www.postgresql.org/docs/11/static/functions-textsearch.html
    +    'ARRAY_TO_TSVECTOR GET_CURRENT_TS_CONFIG NUMNODE PLAINTO_TSQUERY PHRASETO_TSQUERY WEBSEARCH_TO_TSQUERY ' +
    +    'QUERYTREE SETWEIGHT STRIP TO_TSQUERY TO_TSVECTOR JSON_TO_TSVECTOR JSONB_TO_TSVECTOR TS_DELETE ' +
    +    'TS_FILTER TS_HEADLINE TS_RANK TS_RANK_CD TS_REWRITE TSQUERY_PHRASE TSVECTOR_TO_ARRAY ' +
    +    'TSVECTOR_UPDATE_TRIGGER TSVECTOR_UPDATE_TRIGGER_COLUMN ' +
    +    // https://www.postgresql.org/docs/11/static/functions-xml.html
    +    'XMLCOMMENT XMLCONCAT XMLELEMENT XMLFOREST XMLPI XMLROOT ' +
    +    'XMLEXISTS XML_IS_WELL_FORMED XML_IS_WELL_FORMED_DOCUMENT XML_IS_WELL_FORMED_CONTENT ' +
    +    'XPATH XPATH_EXISTS XMLTABLE XMLNAMESPACES ' +
    +    'TABLE_TO_XML TABLE_TO_XMLSCHEMA TABLE_TO_XML_AND_XMLSCHEMA ' +
    +    'QUERY_TO_XML QUERY_TO_XMLSCHEMA QUERY_TO_XML_AND_XMLSCHEMA ' +
    +    'CURSOR_TO_XML CURSOR_TO_XMLSCHEMA ' +
    +    'SCHEMA_TO_XML SCHEMA_TO_XMLSCHEMA SCHEMA_TO_XML_AND_XMLSCHEMA ' +
    +    'DATABASE_TO_XML DATABASE_TO_XMLSCHEMA DATABASE_TO_XML_AND_XMLSCHEMA ' +
    +    'XMLATTRIBUTES ' +
    +    // https://www.postgresql.org/docs/11/static/functions-json.html
    +    'TO_JSON TO_JSONB ARRAY_TO_JSON ROW_TO_JSON JSON_BUILD_ARRAY JSONB_BUILD_ARRAY JSON_BUILD_OBJECT ' +
    +    'JSONB_BUILD_OBJECT JSON_OBJECT JSONB_OBJECT JSON_ARRAY_LENGTH JSONB_ARRAY_LENGTH JSON_EACH ' +
    +    'JSONB_EACH JSON_EACH_TEXT JSONB_EACH_TEXT JSON_EXTRACT_PATH JSONB_EXTRACT_PATH ' +
    +    'JSON_OBJECT_KEYS JSONB_OBJECT_KEYS JSON_POPULATE_RECORD JSONB_POPULATE_RECORD JSON_POPULATE_RECORDSET ' +
    +    'JSONB_POPULATE_RECORDSET JSON_ARRAY_ELEMENTS JSONB_ARRAY_ELEMENTS JSON_ARRAY_ELEMENTS_TEXT ' +
    +    'JSONB_ARRAY_ELEMENTS_TEXT JSON_TYPEOF JSONB_TYPEOF JSON_TO_RECORD JSONB_TO_RECORD JSON_TO_RECORDSET ' +
    +    'JSONB_TO_RECORDSET JSON_STRIP_NULLS JSONB_STRIP_NULLS JSONB_SET JSONB_INSERT JSONB_PRETTY ' +
    +    // https://www.postgresql.org/docs/11/static/functions-sequence.html
    +    'CURRVAL LASTVAL NEXTVAL SETVAL ' +
    +    // https://www.postgresql.org/docs/11/static/functions-conditional.html
    +    'COALESCE NULLIF GREATEST LEAST ' +
    +    // https://www.postgresql.org/docs/11/static/functions-array.html
    +    'ARRAY_APPEND ARRAY_CAT ARRAY_NDIMS ARRAY_DIMS ARRAY_FILL ARRAY_LENGTH ARRAY_LOWER ARRAY_POSITION ' +
    +    'ARRAY_POSITIONS ARRAY_PREPEND ARRAY_REMOVE ARRAY_REPLACE ARRAY_TO_STRING ARRAY_UPPER CARDINALITY ' +
    +    'STRING_TO_ARRAY UNNEST ' +
    +    // https://www.postgresql.org/docs/11/static/functions-range.html
    +    'ISEMPTY LOWER_INC UPPER_INC LOWER_INF UPPER_INF RANGE_MERGE ' +
    +    // https://www.postgresql.org/docs/11/static/functions-srf.html
    +    'GENERATE_SERIES GENERATE_SUBSCRIPTS ' +
    +    // https://www.postgresql.org/docs/11/static/functions-info.html
    +    'CURRENT_DATABASE CURRENT_QUERY CURRENT_SCHEMA|10 CURRENT_SCHEMAS|10 INET_CLIENT_ADDR INET_CLIENT_PORT ' +
    +    'INET_SERVER_ADDR INET_SERVER_PORT ROW_SECURITY_ACTIVE FORMAT_TYPE ' +
    +    'TO_REGCLASS TO_REGPROC TO_REGPROCEDURE TO_REGOPER TO_REGOPERATOR TO_REGTYPE TO_REGNAMESPACE TO_REGROLE ' +
    +    'COL_DESCRIPTION OBJ_DESCRIPTION SHOBJ_DESCRIPTION ' +
    +    'TXID_CURRENT TXID_CURRENT_IF_ASSIGNED TXID_CURRENT_SNAPSHOT TXID_SNAPSHOT_XIP TXID_SNAPSHOT_XMAX ' +
    +    'TXID_SNAPSHOT_XMIN TXID_VISIBLE_IN_SNAPSHOT TXID_STATUS ' +
    +    // https://www.postgresql.org/docs/11/static/functions-admin.html
    +    'CURRENT_SETTING SET_CONFIG BRIN_SUMMARIZE_NEW_VALUES BRIN_SUMMARIZE_RANGE BRIN_DESUMMARIZE_RANGE ' +
    +    'GIN_CLEAN_PENDING_LIST ' +
    +    // https://www.postgresql.org/docs/11/static/functions-trigger.html
    +    'SUPPRESS_REDUNDANT_UPDATES_TRIGGER ' +
    +    // ihttps://www.postgresql.org/docs/devel/static/lo-funcs.html
    +    'LO_FROM_BYTEA LO_PUT LO_GET LO_CREAT LO_CREATE LO_UNLINK LO_IMPORT LO_EXPORT LOREAD LOWRITE ' +
    +    //
    +    'GROUPING CAST ';
    +
    +  const FUNCTIONS_RE =
    +      FUNCTIONS.trim()
    +        .split(' ')
    +        .map(function(val) { return val.split('|')[0]; })
    +        .join('|');
    +
    +  return {
    +    name: 'PostgreSQL',
    +    aliases: [
    +      'postgres',
    +      'postgresql'
    +    ],
    +    case_insensitive: true,
    +    keywords: {
    +      keyword:
    +            SQL_KW + PLPGSQL_KW + ROLE_ATTRS,
    +      built_in:
    +            SQL_BI + PLPGSQL_BI + PLPGSQL_EXCEPTIONS
    +    },
    +    // Forbid some cunstructs from other languages to improve autodetect. In fact
    +    // "[a-z]:" is legal (as part of array slice), but improbabal.
    +    illegal: /:==|\W\s*\(\*|(^|\s)\$[a-z]|\{\{|[a-z]:\s*$|\.\.\.|TO:|DO:/,
    +    contains: [
    +      // special handling of some words, which are reserved only in some contexts
    +      {
    +        className: 'keyword',
    +        variants: [
    +          {
    +            begin: /\bTEXT\s*SEARCH\b/
    +          },
    +          {
    +            begin: /\b(PRIMARY|FOREIGN|FOR(\s+NO)?)\s+KEY\b/
    +          },
    +          {
    +            begin: /\bPARALLEL\s+(UNSAFE|RESTRICTED|SAFE)\b/
    +          },
    +          {
    +            begin: /\bSTORAGE\s+(PLAIN|EXTERNAL|EXTENDED|MAIN)\b/
    +          },
    +          {
    +            begin: /\bMATCH\s+(FULL|PARTIAL|SIMPLE)\b/
    +          },
    +          {
    +            begin: /\bNULLS\s+(FIRST|LAST)\b/
    +          },
    +          {
    +            begin: /\bEVENT\s+TRIGGER\b/
    +          },
    +          {
    +            begin: /\b(MAPPING|OR)\s+REPLACE\b/
    +          },
    +          {
    +            begin: /\b(FROM|TO)\s+(PROGRAM|STDIN|STDOUT)\b/
    +          },
    +          {
    +            begin: /\b(SHARE|EXCLUSIVE)\s+MODE\b/
    +          },
    +          {
    +            begin: /\b(LEFT|RIGHT)\s+(OUTER\s+)?JOIN\b/
    +          },
    +          {
    +            begin: /\b(FETCH|MOVE)\s+(NEXT|PRIOR|FIRST|LAST|ABSOLUTE|RELATIVE|FORWARD|BACKWARD)\b/
    +          },
    +          {
    +            begin: /\bPRESERVE\s+ROWS\b/
    +          },
    +          {
    +            begin: /\bDISCARD\s+PLANS\b/
    +          },
    +          {
    +            begin: /\bREFERENCING\s+(OLD|NEW)\b/
    +          },
    +          {
    +            begin: /\bSKIP\s+LOCKED\b/
    +          },
    +          {
    +            begin: /\bGROUPING\s+SETS\b/
    +          },
    +          {
    +            begin: /\b(BINARY|INSENSITIVE|SCROLL|NO\s+SCROLL)\s+(CURSOR|FOR)\b/
    +          },
    +          {
    +            begin: /\b(WITH|WITHOUT)\s+HOLD\b/
    +          },
    +          {
    +            begin: /\bWITH\s+(CASCADED|LOCAL)\s+CHECK\s+OPTION\b/
    +          },
    +          {
    +            begin: /\bEXCLUDE\s+(TIES|NO\s+OTHERS)\b/
    +          },
    +          {
    +            begin: /\bFORMAT\s+(TEXT|XML|JSON|YAML)\b/
    +          },
    +          {
    +            begin: /\bSET\s+((SESSION|LOCAL)\s+)?NAMES\b/
    +          },
    +          {
    +            begin: /\bIS\s+(NOT\s+)?UNKNOWN\b/
    +          },
    +          {
    +            begin: /\bSECURITY\s+LABEL\b/
    +          },
    +          {
    +            begin: /\bSTANDALONE\s+(YES|NO|NO\s+VALUE)\b/
    +          },
    +          {
    +            begin: /\bWITH\s+(NO\s+)?DATA\b/
    +          },
    +          {
    +            begin: /\b(FOREIGN|SET)\s+DATA\b/
    +          },
    +          {
    +            begin: /\bSET\s+(CATALOG|CONSTRAINTS)\b/
    +          },
    +          {
    +            begin: /\b(WITH|FOR)\s+ORDINALITY\b/
    +          },
    +          {
    +            begin: /\bIS\s+(NOT\s+)?DOCUMENT\b/
    +          },
    +          {
    +            begin: /\bXML\s+OPTION\s+(DOCUMENT|CONTENT)\b/
    +          },
    +          {
    +            begin: /\b(STRIP|PRESERVE)\s+WHITESPACE\b/
    +          },
    +          {
    +            begin: /\bNO\s+(ACTION|MAXVALUE|MINVALUE)\b/
    +          },
    +          {
    +            begin: /\bPARTITION\s+BY\s+(RANGE|LIST|HASH)\b/
    +          },
    +          {
    +            begin: /\bAT\s+TIME\s+ZONE\b/
    +          },
    +          {
    +            begin: /\bGRANTED\s+BY\b/
    +          },
    +          {
    +            begin: /\bRETURN\s+(QUERY|NEXT)\b/
    +          },
    +          {
    +            begin: /\b(ATTACH|DETACH)\s+PARTITION\b/
    +          },
    +          {
    +            begin: /\bFORCE\s+ROW\s+LEVEL\s+SECURITY\b/
    +          },
    +          {
    +            begin: /\b(INCLUDING|EXCLUDING)\s+(COMMENTS|CONSTRAINTS|DEFAULTS|IDENTITY|INDEXES|STATISTICS|STORAGE|ALL)\b/
    +          },
    +          {
    +            begin: /\bAS\s+(ASSIGNMENT|IMPLICIT|PERMISSIVE|RESTRICTIVE|ENUM|RANGE)\b/
    +          }
    +        ]
    +      },
    +      // functions named as keywords, followed by '('
    +      {
    +        begin: /\b(FORMAT|FAMILY|VERSION)\s*\(/
    +        // keywords: { built_in: 'FORMAT FAMILY VERSION' }
    +      },
    +      // INCLUDE ( ... ) in index_parameters in CREATE TABLE
    +      {
    +        begin: /\bINCLUDE\s*\(/,
    +        keywords: 'INCLUDE'
    +      },
    +      // not highlight RANGE if not in frame_clause (not 100% correct, but seems satisfactory)
    +      {
    +        begin: /\bRANGE(?!\s*(BETWEEN|UNBOUNDED|CURRENT|[-0-9]+))/
    +      },
    +      // disable highlighting in commands CREATE AGGREGATE/COLLATION/DATABASE/OPERTOR/TEXT SEARCH .../TYPE
    +      // and in PL/pgSQL RAISE ... USING
    +      {
    +        begin: /\b(VERSION|OWNER|TEMPLATE|TABLESPACE|CONNECTION\s+LIMIT|PROCEDURE|RESTRICT|JOIN|PARSER|COPY|START|END|COLLATION|INPUT|ANALYZE|STORAGE|LIKE|DEFAULT|DELIMITER|ENCODING|COLUMN|CONSTRAINT|TABLE|SCHEMA)\s*=/
    +      },
    +      // PG_smth; HAS_some_PRIVILEGE
    +      {
    +        // className: 'built_in',
    +        begin: /\b(PG_\w+?|HAS_[A-Z_]+_PRIVILEGE)\b/,
    +        relevance: 10
    +      },
    +      // extract
    +      {
    +        begin: /\bEXTRACT\s*\(/,
    +        end: /\bFROM\b/,
    +        returnEnd: true,
    +        keywords: {
    +          // built_in: 'EXTRACT',
    +          type: 'CENTURY DAY DECADE DOW DOY EPOCH HOUR ISODOW ISOYEAR MICROSECONDS ' +
    +                        'MILLENNIUM MILLISECONDS MINUTE MONTH QUARTER SECOND TIMEZONE TIMEZONE_HOUR ' +
    +                        'TIMEZONE_MINUTE WEEK YEAR'
    +        }
    +      },
    +      // xmlelement, xmlpi - special NAME
    +      {
    +        begin: /\b(XMLELEMENT|XMLPI)\s*\(\s*NAME/,
    +        keywords: {
    +          // built_in: 'XMLELEMENT XMLPI',
    +          keyword: 'NAME'
    +        }
    +      },
    +      // xmlparse, xmlserialize
    +      {
    +        begin: /\b(XMLPARSE|XMLSERIALIZE)\s*\(\s*(DOCUMENT|CONTENT)/,
    +        keywords: {
    +          // built_in: 'XMLPARSE XMLSERIALIZE',
    +          keyword: 'DOCUMENT CONTENT'
    +        }
    +      },
    +      // Sequences. We actually skip everything between CACHE|INCREMENT|MAXVALUE|MINVALUE and
    +      // nearest following numeric constant. Without with trick we find a lot of "keywords"
    +      // in 'avrasm' autodetection test...
    +      {
    +        beginKeywords: 'CACHE INCREMENT MAXVALUE MINVALUE',
    +        end: hljs.C_NUMBER_RE,
    +        returnEnd: true,
    +        keywords: 'BY CACHE INCREMENT MAXVALUE MINVALUE'
    +      },
    +      // WITH|WITHOUT TIME ZONE as part of datatype
    +      {
    +        className: 'type',
    +        begin: /\b(WITH|WITHOUT)\s+TIME\s+ZONE\b/
    +      },
    +      // INTERVAL optional fields
    +      {
    +        className: 'type',
    +        begin: /\bINTERVAL\s+(YEAR|MONTH|DAY|HOUR|MINUTE|SECOND)(\s+TO\s+(MONTH|HOUR|MINUTE|SECOND))?\b/
    +      },
    +      // Pseudo-types which allowed only as return type
    +      {
    +        begin: /\bRETURNS\s+(LANGUAGE_HANDLER|TRIGGER|EVENT_TRIGGER|FDW_HANDLER|INDEX_AM_HANDLER|TSM_HANDLER)\b/,
    +        keywords: {
    +          keyword: 'RETURNS',
    +          type: 'LANGUAGE_HANDLER TRIGGER EVENT_TRIGGER FDW_HANDLER INDEX_AM_HANDLER TSM_HANDLER'
    +        }
    +      },
    +      // Known functions - only when followed by '('
    +      {
    +        begin: '\\b(' + FUNCTIONS_RE + ')\\s*\\('
    +        // keywords: { built_in: FUNCTIONS }
    +      },
    +      // Types
    +      {
    +        begin: '\\.(' + TYPES_RE + ')\\b' // prevent highlight as type, say, 'oid' in 'pgclass.oid'
    +      },
    +      {
    +        begin: '\\b(' + TYPES_RE + ')\\s+PATH\\b', // in XMLTABLE
    +        keywords: {
    +          keyword: 'PATH', // hopefully no one would use PATH type in XMLTABLE...
    +          type: TYPES.replace('PATH ', '')
    +        }
    +      },
    +      {
    +        className: 'type',
    +        begin: '\\b(' + TYPES_RE + ')\\b'
    +      },
    +      // Strings, see https://www.postgresql.org/docs/11/static/sql-syntax-lexical.html#SQL-SYNTAX-CONSTANTS
    +      {
    +        className: 'string',
    +        begin: '\'',
    +        end: '\'',
    +        contains: [
    +          {
    +            begin: '\'\''
    +          }
    +        ]
    +      },
    +      {
    +        className: 'string',
    +        begin: '(e|E|u&|U&)\'',
    +        end: '\'',
    +        contains: [
    +          {
    +            begin: '\\\\.'
    +          }
    +        ],
    +        relevance: 10
    +      },
    +      hljs.END_SAME_AS_BEGIN({
    +        begin: DOLLAR_STRING,
    +        end: DOLLAR_STRING,
    +        contains: [
    +          {
    +            // actually we want them all except SQL; listed are those with known implementations
    +            // and XML + JSON just in case
    +            subLanguage: [
    +              'pgsql',
    +              'perl',
    +              'python',
    +              'tcl',
    +              'r',
    +              'lua',
    +              'java',
    +              'php',
    +              'ruby',
    +              'bash',
    +              'scheme',
    +              'xml',
    +              'json'
    +            ],
    +            endsWithParent: true
    +          }
    +        ]
    +      }),
    +      // identifiers in quotes
    +      {
    +        begin: '"',
    +        end: '"',
    +        contains: [
    +          {
    +            begin: '""'
    +          }
    +        ]
    +      },
    +      // numbers
    +      hljs.C_NUMBER_MODE,
    +      // comments
    +      hljs.C_BLOCK_COMMENT_MODE,
    +      COMMENT_MODE,
    +      // PL/pgSQL staff
    +      // %ROWTYPE, %TYPE, $n
    +      {
    +        className: 'meta',
    +        variants: [
    +          { // %TYPE, %ROWTYPE
    +            begin: '%(ROW)?TYPE',
    +            relevance: 10
    +          },
    +          { // $n
    +            begin: '\\$\\d+'
    +          },
    +          { // #compiler option
    +            begin: '^#\\w',
    +            end: '$'
    +          }
    +        ]
    +      },
    +      // <>
    +      {
    +        className: 'symbol',
    +        begin: LABEL,
    +        relevance: 10
    +      }
    +    ]
    +  };
    +}
    +
    +module.exports = pgsql;
    diff --git a/node_modules/highlight.js/lib/languages/php-template.js b/node_modules/highlight.js/lib/languages/php-template.js
    new file mode 100644
    index 0000000..a3de4b2
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/php-template.js
    @@ -0,0 +1,54 @@
    +/*
    +Language: PHP Template
    +Requires: xml.js, php.js
    +Author: Josh Goebel 
    +Website: https://www.php.net
    +Category: common
    +*/
    +
    +function phpTemplate(hljs) {
    +  return {
    +    name: "PHP template",
    +    subLanguage: 'xml',
    +    contains: [
    +      {
    +        begin: /<\?(php|=)?/,
    +        end: /\?>/,
    +        subLanguage: 'php',
    +        contains: [
    +          // We don't want the php closing tag ?> to close the PHP block when
    +          // inside any of the following blocks:
    +          {
    +            begin: '/\\*',
    +            end: '\\*/',
    +            skip: true
    +          },
    +          {
    +            begin: 'b"',
    +            end: '"',
    +            skip: true
    +          },
    +          {
    +            begin: 'b\'',
    +            end: '\'',
    +            skip: true
    +          },
    +          hljs.inherit(hljs.APOS_STRING_MODE, {
    +            illegal: null,
    +            className: null,
    +            contains: null,
    +            skip: true
    +          }),
    +          hljs.inherit(hljs.QUOTE_STRING_MODE, {
    +            illegal: null,
    +            className: null,
    +            contains: null,
    +            skip: true
    +          })
    +        ]
    +      }
    +    ]
    +  };
    +}
    +
    +module.exports = phpTemplate;
    diff --git a/node_modules/highlight.js/lib/languages/php.js b/node_modules/highlight.js/lib/languages/php.js
    new file mode 100644
    index 0000000..3932455
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/php.js
    @@ -0,0 +1,188 @@
    +/*
    +Language: PHP
    +Author: Victor Karamzin 
    +Contributors: Evgeny Stepanischev , Ivan Sagalaev 
    +Website: https://www.php.net
    +Category: common
    +*/
    +
    +/**
    + * @param {HLJSApi} hljs
    + * @returns {LanguageDetail}
    + * */
    +function php(hljs) {
    +  const VARIABLE = {
    +    className: 'variable',
    +    begin: '\\$+[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*' +
    +      // negative look-ahead tries to avoid matching patterns that are not
    +      // Perl at all like $ident$, @ident@, etc.
    +      `(?![A-Za-z0-9])(?![$])`
    +  };
    +  const PREPROCESSOR = {
    +    className: 'meta',
    +    variants: [
    +      { begin: /<\?php/, relevance: 10 }, // boost for obvious PHP
    +      { begin: /<\?[=]?/ },
    +      { begin: /\?>/ } // end php tag
    +    ]
    +  };
    +  const SUBST = {
    +    className: 'subst',
    +    variants: [
    +      { begin: /\$\w+/ },
    +      { begin: /\{\$/, end: /\}/ }
    +    ]
    +  };
    +  const SINGLE_QUOTED = hljs.inherit(hljs.APOS_STRING_MODE, {
    +    illegal: null,
    +  });
    +  const DOUBLE_QUOTED = hljs.inherit(hljs.QUOTE_STRING_MODE, {
    +    illegal: null,
    +    contains: hljs.QUOTE_STRING_MODE.contains.concat(SUBST),
    +  });
    +  const HEREDOC = hljs.END_SAME_AS_BEGIN({
    +    begin: /<<<[ \t]*(\w+)\n/,
    +    end: /[ \t]*(\w+)\b/,
    +    contains: hljs.QUOTE_STRING_MODE.contains.concat(SUBST),
    +  });
    +  const STRING = {
    +    className: 'string',
    +    contains: [hljs.BACKSLASH_ESCAPE, PREPROCESSOR],
    +    variants: [
    +      hljs.inherit(SINGLE_QUOTED, {
    +        begin: "b'", end: "'",
    +      }),
    +      hljs.inherit(DOUBLE_QUOTED, {
    +        begin: 'b"', end: '"',
    +      }),
    +      DOUBLE_QUOTED,
    +      SINGLE_QUOTED,
    +      HEREDOC
    +    ]
    +  };
    +  const NUMBER = {variants: [hljs.BINARY_NUMBER_MODE, hljs.C_NUMBER_MODE]};
    +  const KEYWORDS = {
    +    keyword:
    +    // Magic constants:
    +    // 
    +    '__CLASS__ __DIR__ __FILE__ __FUNCTION__ __LINE__ __METHOD__ __NAMESPACE__ __TRAIT__ ' +
    +    // Function that look like language construct or language construct that look like function:
    +    // List of keywords that may not require parenthesis
    +    'die echo exit include include_once print require require_once ' +
    +    // These are not language construct (function) but operate on the currently-executing function and can access the current symbol table
    +    // 'compact extract func_get_arg func_get_args func_num_args get_called_class get_parent_class ' +
    +    // Other keywords:
    +    // 
    +    // 
    +    'array abstract and as binary bool boolean break callable case catch class clone const continue declare ' +
    +    'default do double else elseif empty enddeclare endfor endforeach endif endswitch endwhile eval extends ' +
    +    'final finally float for foreach from global goto if implements instanceof insteadof int integer interface ' +
    +    'isset iterable list match|0 new object or private protected public real return string switch throw trait ' +
    +    'try unset use var void while xor yield',
    +    literal: 'false null true',
    +    built_in:
    +    // Standard PHP library:
    +    // 
    +    'Error|0 ' + // error is too common a name esp since PHP is case in-sensitive
    +    'AppendIterator ArgumentCountError ArithmeticError ArrayIterator ArrayObject AssertionError BadFunctionCallException BadMethodCallException CachingIterator CallbackFilterIterator CompileError Countable DirectoryIterator DivisionByZeroError DomainException EmptyIterator ErrorException Exception FilesystemIterator FilterIterator GlobIterator InfiniteIterator InvalidArgumentException IteratorIterator LengthException LimitIterator LogicException MultipleIterator NoRewindIterator OutOfBoundsException OutOfRangeException OuterIterator OverflowException ParentIterator ParseError RangeException RecursiveArrayIterator RecursiveCachingIterator RecursiveCallbackFilterIterator RecursiveDirectoryIterator RecursiveFilterIterator RecursiveIterator RecursiveIteratorIterator RecursiveRegexIterator RecursiveTreeIterator RegexIterator RuntimeException SeekableIterator SplDoublyLinkedList SplFileInfo SplFileObject SplFixedArray SplHeap SplMaxHeap SplMinHeap SplObjectStorage SplObserver SplObserver SplPriorityQueue SplQueue SplStack SplSubject SplSubject SplTempFileObject TypeError UnderflowException UnexpectedValueException ' +
    +    // Reserved interfaces:
    +    // 
    +    'ArrayAccess Closure Generator Iterator IteratorAggregate Serializable Throwable Traversable WeakReference ' +
    +    // Reserved classes:
    +    // 
    +    'Directory __PHP_Incomplete_Class parent php_user_filter self static stdClass'
    +  };
    +  return {
    +    aliases: ['php', 'php3', 'php4', 'php5', 'php6', 'php7', 'php8'],
    +    case_insensitive: true,
    +    keywords: KEYWORDS,
    +    contains: [
    +      hljs.HASH_COMMENT_MODE,
    +      hljs.COMMENT('//', '$', {contains: [PREPROCESSOR]}),
    +      hljs.COMMENT(
    +        '/\\*',
    +        '\\*/',
    +        {
    +          contains: [
    +            {
    +              className: 'doctag',
    +              begin: '@[A-Za-z]+'
    +            }
    +          ]
    +        }
    +      ),
    +      hljs.COMMENT(
    +        '__halt_compiler.+?;',
    +        false,
    +        {
    +          endsWithParent: true,
    +          keywords: '__halt_compiler'
    +        }
    +      ),
    +      PREPROCESSOR,
    +      {
    +        className: 'keyword', begin: /\$this\b/
    +      },
    +      VARIABLE,
    +      {
    +        // swallow composed identifiers to avoid parsing them as keywords
    +        begin: /(::|->)+[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/
    +      },
    +      {
    +        className: 'function',
    +        relevance: 0,
    +        beginKeywords: 'fn function', end: /[;{]/, excludeEnd: true,
    +        illegal: '[$%\\[]',
    +        contains: [
    +          hljs.UNDERSCORE_TITLE_MODE,
    +          {
    +            begin: '=>' // No markup, just a relevance booster
    +          },
    +          {
    +            className: 'params',
    +            begin: '\\(', end: '\\)',
    +            excludeBegin: true,
    +            excludeEnd: true,
    +            keywords: KEYWORDS,
    +            contains: [
    +              'self',
    +              VARIABLE,
    +              hljs.C_BLOCK_COMMENT_MODE,
    +              STRING,
    +              NUMBER
    +            ]
    +          }
    +        ]
    +      },
    +      {
    +        className: 'class',
    +        beginKeywords: 'class interface',
    +        relevance: 0,
    +        end: /\{/,
    +        excludeEnd: true,
    +        illegal: /[:($"]/,
    +        contains: [
    +          {beginKeywords: 'extends implements'},
    +          hljs.UNDERSCORE_TITLE_MODE
    +        ]
    +      },
    +      {
    +        beginKeywords: 'namespace',
    +        relevance: 0,
    +        end: ';',
    +        illegal: /[.']/,
    +        contains: [hljs.UNDERSCORE_TITLE_MODE]
    +      },
    +      {
    +        beginKeywords: 'use',
    +        relevance: 0,
    +        end: ';',
    +        contains: [hljs.UNDERSCORE_TITLE_MODE]
    +      },
    +      STRING,
    +      NUMBER
    +    ]
    +  };
    +}
    +
    +module.exports = php;
    diff --git a/node_modules/highlight.js/lib/languages/plaintext.js b/node_modules/highlight.js/lib/languages/plaintext.js
    new file mode 100644
    index 0000000..5cb2de7
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/plaintext.js
    @@ -0,0 +1,19 @@
    +/*
    +Language: Plain text
    +Author: Egor Rogov (e.rogov@postgrespro.ru)
    +Description: Plain text without any highlighting.
    +Category: common
    +*/
    +
    +function plaintext(hljs) {
    +  return {
    +    name: 'Plain text',
    +    aliases: [
    +      'text',
    +      'txt'
    +    ],
    +    disableAutodetect: true
    +  };
    +}
    +
    +module.exports = plaintext;
    diff --git a/node_modules/highlight.js/lib/languages/pony.js b/node_modules/highlight.js/lib/languages/pony.js
    new file mode 100644
    index 0000000..6bfba13
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/pony.js
    @@ -0,0 +1,89 @@
    +/*
    +Language: Pony
    +Author: Joe Eli McIlvain 
    +Description: Pony is an open-source, object-oriented, actor-model,
    +             capabilities-secure, high performance programming language.
    +Website: https://www.ponylang.io
    +*/
    +
    +function pony(hljs) {
    +  const KEYWORDS = {
    +    keyword:
    +      'actor addressof and as be break class compile_error compile_intrinsic ' +
    +      'consume continue delegate digestof do else elseif embed end error ' +
    +      'for fun if ifdef in interface is isnt lambda let match new not object ' +
    +      'or primitive recover repeat return struct then trait try type until ' +
    +      'use var where while with xor',
    +    meta:
    +      'iso val tag trn box ref',
    +    literal:
    +      'this false true'
    +  };
    +
    +  const TRIPLE_QUOTE_STRING_MODE = {
    +    className: 'string',
    +    begin: '"""',
    +    end: '"""',
    +    relevance: 10
    +  };
    +
    +  const QUOTE_STRING_MODE = {
    +    className: 'string',
    +    begin: '"',
    +    end: '"',
    +    contains: [ hljs.BACKSLASH_ESCAPE ]
    +  };
    +
    +  const SINGLE_QUOTE_CHAR_MODE = {
    +    className: 'string',
    +    begin: '\'',
    +    end: '\'',
    +    contains: [ hljs.BACKSLASH_ESCAPE ],
    +    relevance: 0
    +  };
    +
    +  const TYPE_NAME = {
    +    className: 'type',
    +    begin: '\\b_?[A-Z][\\w]*',
    +    relevance: 0
    +  };
    +
    +  const PRIMED_NAME = {
    +    begin: hljs.IDENT_RE + '\'',
    +    relevance: 0
    +  };
    +
    +  const NUMBER_MODE = {
    +    className: 'number',
    +    begin: '(-?)(\\b0[xX][a-fA-F0-9]+|\\b0[bB][01]+|(\\b\\d+(_\\d+)?(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)',
    +    relevance: 0
    +  };
    +
    +  /**
    +   * The `FUNCTION` and `CLASS` modes were intentionally removed to simplify
    +   * highlighting and fix cases like
    +   * ```
    +   * interface Iterator[A: A]
    +   *   fun has_next(): Bool
    +   *   fun next(): A?
    +   * ```
    +   * where it is valid to have a function head without a body
    +   */
    +
    +  return {
    +    name: 'Pony',
    +    keywords: KEYWORDS,
    +    contains: [
    +      TYPE_NAME,
    +      TRIPLE_QUOTE_STRING_MODE,
    +      QUOTE_STRING_MODE,
    +      SINGLE_QUOTE_CHAR_MODE,
    +      PRIMED_NAME,
    +      NUMBER_MODE,
    +      hljs.C_LINE_COMMENT_MODE,
    +      hljs.C_BLOCK_COMMENT_MODE
    +    ]
    +  };
    +}
    +
    +module.exports = pony;
    diff --git a/node_modules/highlight.js/lib/languages/powershell.js b/node_modules/highlight.js/lib/languages/powershell.js
    new file mode 100644
    index 0000000..7580ae8
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/powershell.js
    @@ -0,0 +1,331 @@
    +/*
    +Language: PowerShell
    +Description: PowerShell is a task-based command-line shell and scripting language built on .NET.
    +Author: David Mohundro 
    +Contributors: Nicholas Blumhardt , Victor Zhou , Nicolas Le Gall 
    +Website: https://docs.microsoft.com/en-us/powershell/
    +*/
    +
    +function powershell(hljs) {
    +  const TYPES = [
    +    "string",
    +    "char",
    +    "byte",
    +    "int",
    +    "long",
    +    "bool",
    +    "decimal",
    +    "single",
    +    "double",
    +    "DateTime",
    +    "xml",
    +    "array",
    +    "hashtable",
    +    "void"
    +  ];
    +
    +  // https://msdn.microsoft.com/en-us/library/ms714428(v=vs.85).aspx
    +  const VALID_VERBS =
    +    'Add|Clear|Close|Copy|Enter|Exit|Find|Format|Get|Hide|Join|Lock|' +
    +    'Move|New|Open|Optimize|Pop|Push|Redo|Remove|Rename|Reset|Resize|' +
    +    'Search|Select|Set|Show|Skip|Split|Step|Switch|Undo|Unlock|' +
    +    'Watch|Backup|Checkpoint|Compare|Compress|Convert|ConvertFrom|' +
    +    'ConvertTo|Dismount|Edit|Expand|Export|Group|Import|Initialize|' +
    +    'Limit|Merge|Out|Publish|Restore|Save|Sync|Unpublish|Update|' +
    +    'Approve|Assert|Complete|Confirm|Deny|Disable|Enable|Install|Invoke|Register|' +
    +    'Request|Restart|Resume|Start|Stop|Submit|Suspend|Uninstall|' +
    +    'Unregister|Wait|Debug|Measure|Ping|Repair|Resolve|Test|Trace|Connect|' +
    +    'Disconnect|Read|Receive|Send|Write|Block|Grant|Protect|Revoke|Unblock|' +
    +    'Unprotect|Use|ForEach|Sort|Tee|Where';
    +
    +  const COMPARISON_OPERATORS =
    +    '-and|-as|-band|-bnot|-bor|-bxor|-casesensitive|-ccontains|-ceq|-cge|-cgt|' +
    +    '-cle|-clike|-clt|-cmatch|-cne|-cnotcontains|-cnotlike|-cnotmatch|-contains|' +
    +    '-creplace|-csplit|-eq|-exact|-f|-file|-ge|-gt|-icontains|-ieq|-ige|-igt|' +
    +    '-ile|-ilike|-ilt|-imatch|-in|-ine|-inotcontains|-inotlike|-inotmatch|' +
    +    '-ireplace|-is|-isnot|-isplit|-join|-le|-like|-lt|-match|-ne|-not|' +
    +    '-notcontains|-notin|-notlike|-notmatch|-or|-regex|-replace|-shl|-shr|' +
    +    '-split|-wildcard|-xor';
    +
    +  const KEYWORDS = {
    +    $pattern: /-?[A-z\.\-]+\b/,
    +    keyword:
    +      'if else foreach return do while until elseif begin for trap data dynamicparam ' +
    +      'end break throw param continue finally in switch exit filter try process catch ' +
    +      'hidden static parameter',
    +    // "echo" relevance has been set to 0 to avoid auto-detect conflicts with shell transcripts
    +    built_in:
    +      'ac asnp cat cd CFS chdir clc clear clhy cli clp cls clv cnsn compare copy cp ' +
    +      'cpi cpp curl cvpa dbp del diff dir dnsn ebp echo|0 epal epcsv epsn erase etsn exsn fc fhx ' +
    +      'fl ft fw gal gbp gc gcb gci gcm gcs gdr gerr ghy gi gin gjb gl gm gmo gp gps gpv group ' +
    +      'gsn gsnp gsv gtz gu gv gwmi h history icm iex ihy ii ipal ipcsv ipmo ipsn irm ise iwmi ' +
    +      'iwr kill lp ls man md measure mi mount move mp mv nal ndr ni nmo npssc nsn nv ogv oh ' +
    +      'popd ps pushd pwd r rbp rcjb rcsn rd rdr ren ri rjb rm rmdir rmo rni rnp rp rsn rsnp ' +
    +      'rujb rv rvpa rwmi sajb sal saps sasv sbp sc scb select set shcm si sl sleep sls sort sp ' +
    +      'spjb spps spsv start stz sujb sv swmi tee trcm type wget where wjb write'
    +    // TODO: 'validate[A-Z]+' can't work in keywords
    +  };
    +
    +  const TITLE_NAME_RE = /\w[\w\d]*((-)[\w\d]+)*/;
    +
    +  const BACKTICK_ESCAPE = {
    +    begin: '`[\\s\\S]',
    +    relevance: 0
    +  };
    +
    +  const VAR = {
    +    className: 'variable',
    +    variants: [
    +      {
    +        begin: /\$\B/
    +      },
    +      {
    +        className: 'keyword',
    +        begin: /\$this/
    +      },
    +      {
    +        begin: /\$[\w\d][\w\d_:]*/
    +      }
    +    ]
    +  };
    +
    +  const LITERAL = {
    +    className: 'literal',
    +    begin: /\$(null|true|false)\b/
    +  };
    +
    +  const QUOTE_STRING = {
    +    className: "string",
    +    variants: [
    +      {
    +        begin: /"/,
    +        end: /"/
    +      },
    +      {
    +        begin: /@"/,
    +        end: /^"@/
    +      }
    +    ],
    +    contains: [
    +      BACKTICK_ESCAPE,
    +      VAR,
    +      {
    +        className: 'variable',
    +        begin: /\$[A-z]/,
    +        end: /[^A-z]/
    +      }
    +    ]
    +  };
    +
    +  const APOS_STRING = {
    +    className: 'string',
    +    variants: [
    +      {
    +        begin: /'/,
    +        end: /'/
    +      },
    +      {
    +        begin: /@'/,
    +        end: /^'@/
    +      }
    +    ]
    +  };
    +
    +  const PS_HELPTAGS = {
    +    className: "doctag",
    +    variants: [
    +      /* no paramater help tags */
    +      {
    +        begin: /\.(synopsis|description|example|inputs|outputs|notes|link|component|role|functionality)/
    +      },
    +      /* one parameter help tags */
    +      {
    +        begin: /\.(parameter|forwardhelptargetname|forwardhelpcategory|remotehelprunspace|externalhelp)\s+\S+/
    +      }
    +    ]
    +  };
    +
    +  const PS_COMMENT = hljs.inherit(
    +    hljs.COMMENT(null, null),
    +    {
    +      variants: [
    +        /* single-line comment */
    +        {
    +          begin: /#/,
    +          end: /$/
    +        },
    +        /* multi-line comment */
    +        {
    +          begin: /<#/,
    +          end: /#>/
    +        }
    +      ],
    +      contains: [ PS_HELPTAGS ]
    +    }
    +  );
    +
    +  const CMDLETS = {
    +    className: 'built_in',
    +    variants: [
    +      {
    +        begin: '('.concat(VALID_VERBS, ')+(-)[\\w\\d]+')
    +      }
    +    ]
    +  };
    +
    +  const PS_CLASS = {
    +    className: 'class',
    +    beginKeywords: 'class enum',
    +    end: /\s*[{]/,
    +    excludeEnd: true,
    +    relevance: 0,
    +    contains: [ hljs.TITLE_MODE ]
    +  };
    +
    +  const PS_FUNCTION = {
    +    className: 'function',
    +    begin: /function\s+/,
    +    end: /\s*\{|$/,
    +    excludeEnd: true,
    +    returnBegin: true,
    +    relevance: 0,
    +    contains: [
    +      {
    +        begin: "function",
    +        relevance: 0,
    +        className: "keyword"
    +      },
    +      {
    +        className: "title",
    +        begin: TITLE_NAME_RE,
    +        relevance: 0
    +      },
    +      {
    +        begin: /\(/,
    +        end: /\)/,
    +        className: "params",
    +        relevance: 0,
    +        contains: [ VAR ]
    +      }
    +      // CMDLETS
    +    ]
    +  };
    +
    +  // Using statment, plus type, plus assembly name.
    +  const PS_USING = {
    +    begin: /using\s/,
    +    end: /$/,
    +    returnBegin: true,
    +    contains: [
    +      QUOTE_STRING,
    +      APOS_STRING,
    +      {
    +        className: 'keyword',
    +        begin: /(using|assembly|command|module|namespace|type)/
    +      }
    +    ]
    +  };
    +
    +  // Comperison operators & function named parameters.
    +  const PS_ARGUMENTS = {
    +    variants: [
    +      // PS literals are pretty verbose so it's a good idea to accent them a bit.
    +      {
    +        className: 'operator',
    +        begin: '('.concat(COMPARISON_OPERATORS, ')\\b')
    +      },
    +      {
    +        className: 'literal',
    +        begin: /(-)[\w\d]+/,
    +        relevance: 0
    +      }
    +    ]
    +  };
    +
    +  const HASH_SIGNS = {
    +    className: 'selector-tag',
    +    begin: /@\B/,
    +    relevance: 0
    +  };
    +
    +  // It's a very general rule so I'll narrow it a bit with some strict boundaries
    +  // to avoid any possible false-positive collisions!
    +  const PS_METHODS = {
    +    className: 'function',
    +    begin: /\[.*\]\s*[\w]+[ ]??\(/,
    +    end: /$/,
    +    returnBegin: true,
    +    relevance: 0,
    +    contains: [
    +      {
    +        className: 'keyword',
    +        begin: '('.concat(
    +          KEYWORDS.keyword.toString().replace(/\s/g, '|'
    +          ), ')\\b'),
    +        endsParent: true,
    +        relevance: 0
    +      },
    +      hljs.inherit(hljs.TITLE_MODE, {
    +        endsParent: true
    +      })
    +    ]
    +  };
    +
    +  const GENTLEMANS_SET = [
    +    // STATIC_MEMBER,
    +    PS_METHODS,
    +    PS_COMMENT,
    +    BACKTICK_ESCAPE,
    +    hljs.NUMBER_MODE,
    +    QUOTE_STRING,
    +    APOS_STRING,
    +    // PS_NEW_OBJECT_TYPE,
    +    CMDLETS,
    +    VAR,
    +    LITERAL,
    +    HASH_SIGNS
    +  ];
    +
    +  const PS_TYPE = {
    +    begin: /\[/,
    +    end: /\]/,
    +    excludeBegin: true,
    +    excludeEnd: true,
    +    relevance: 0,
    +    contains: [].concat(
    +      'self',
    +      GENTLEMANS_SET,
    +      {
    +        begin: "(" + TYPES.join("|") + ")",
    +        className: "built_in",
    +        relevance: 0
    +      },
    +      {
    +        className: 'type',
    +        begin: /[\.\w\d]+/,
    +        relevance: 0
    +      }
    +    )
    +  };
    +
    +  PS_METHODS.contains.unshift(PS_TYPE);
    +
    +  return {
    +    name: 'PowerShell',
    +    aliases: [
    +      "ps",
    +      "ps1"
    +    ],
    +    case_insensitive: true,
    +    keywords: KEYWORDS,
    +    contains: GENTLEMANS_SET.concat(
    +      PS_CLASS,
    +      PS_FUNCTION,
    +      PS_USING,
    +      PS_ARGUMENTS,
    +      PS_TYPE
    +    )
    +  };
    +}
    +
    +module.exports = powershell;
    diff --git a/node_modules/highlight.js/lib/languages/processing.js b/node_modules/highlight.js/lib/languages/processing.js
    new file mode 100644
    index 0000000..3690333
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/processing.js
    @@ -0,0 +1,58 @@
    +/*
    +Language: Processing
    +Description: Processing is a flexible software sketchbook and a language for learning how to code within the context of the visual arts.
    +Author: Erik Paluka 
    +Website: https://processing.org
    +Category: graphics
    +*/
    +
    +function processing(hljs) {
    +  return {
    +    name: 'Processing',
    +    keywords: {
    +      keyword: 'BufferedReader PVector PFont PImage PGraphics HashMap boolean byte char color ' +
    +        'double float int long String Array FloatDict FloatList IntDict IntList JSONArray JSONObject ' +
    +        'Object StringDict StringList Table TableRow XML ' +
    +        // Java keywords
    +        'false synchronized int abstract float private char boolean static null if const ' +
    +        'for true while long throw strictfp finally protected import native final return void ' +
    +        'enum else break transient new catch instanceof byte super volatile case assert short ' +
    +        'package default double public try this switch continue throws protected public private',
    +      literal: 'P2D P3D HALF_PI PI QUARTER_PI TAU TWO_PI',
    +      title: 'setup draw',
    +      built_in: 'displayHeight displayWidth mouseY mouseX mousePressed pmouseX pmouseY key ' +
    +        'keyCode pixels focused frameCount frameRate height width ' +
    +        'size createGraphics beginDraw createShape loadShape PShape arc ellipse line point ' +
    +        'quad rect triangle bezier bezierDetail bezierPoint bezierTangent curve curveDetail curvePoint ' +
    +        'curveTangent curveTightness shape shapeMode beginContour beginShape bezierVertex curveVertex ' +
    +        'endContour endShape quadraticVertex vertex ellipseMode noSmooth rectMode smooth strokeCap ' +
    +        'strokeJoin strokeWeight mouseClicked mouseDragged mouseMoved mousePressed mouseReleased ' +
    +        'mouseWheel keyPressed keyPressedkeyReleased keyTyped print println save saveFrame day hour ' +
    +        'millis minute month second year background clear colorMode fill noFill noStroke stroke alpha ' +
    +        'blue brightness color green hue lerpColor red saturation modelX modelY modelZ screenX screenY ' +
    +        'screenZ ambient emissive shininess specular add createImage beginCamera camera endCamera frustum ' +
    +        'ortho perspective printCamera printProjection cursor frameRate noCursor exit loop noLoop popStyle ' +
    +        'pushStyle redraw binary boolean byte char float hex int str unbinary unhex join match matchAll nf ' +
    +        'nfc nfp nfs split splitTokens trim append arrayCopy concat expand reverse shorten sort splice subset ' +
    +        'box sphere sphereDetail createInput createReader loadBytes loadJSONArray loadJSONObject loadStrings ' +
    +        'loadTable loadXML open parseXML saveTable selectFolder selectInput beginRaw beginRecord createOutput ' +
    +        'createWriter endRaw endRecord PrintWritersaveBytes saveJSONArray saveJSONObject saveStream saveStrings ' +
    +        'saveXML selectOutput popMatrix printMatrix pushMatrix resetMatrix rotate rotateX rotateY rotateZ scale ' +
    +        'shearX shearY translate ambientLight directionalLight lightFalloff lights lightSpecular noLights normal ' +
    +        'pointLight spotLight image imageMode loadImage noTint requestImage tint texture textureMode textureWrap ' +
    +        'blend copy filter get loadPixels set updatePixels blendMode loadShader PShaderresetShader shader createFont ' +
    +        'loadFont text textFont textAlign textLeading textMode textSize textWidth textAscent textDescent abs ceil ' +
    +        'constrain dist exp floor lerp log mag map max min norm pow round sq sqrt acos asin atan atan2 cos degrees ' +
    +        'radians sin tan noise noiseDetail noiseSeed random randomGaussian randomSeed'
    +    },
    +    contains: [
    +      hljs.C_LINE_COMMENT_MODE,
    +      hljs.C_BLOCK_COMMENT_MODE,
    +      hljs.APOS_STRING_MODE,
    +      hljs.QUOTE_STRING_MODE,
    +      hljs.C_NUMBER_MODE
    +    ]
    +  };
    +}
    +
    +module.exports = processing;
    diff --git a/node_modules/highlight.js/lib/languages/profile.js b/node_modules/highlight.js/lib/languages/profile.js
    new file mode 100644
    index 0000000..35a8fe7
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/profile.js
    @@ -0,0 +1,43 @@
    +/*
    +Language: Python profiler
    +Description: Python profiler results
    +Author: Brian Beck 
    +*/
    +
    +function profile(hljs) {
    +  return {
    +    name: 'Python profiler',
    +    contains: [
    +      hljs.C_NUMBER_MODE,
    +      {
    +        begin: '[a-zA-Z_][\\da-zA-Z_]+\\.[\\da-zA-Z_]{1,3}',
    +        end: ':',
    +        excludeEnd: true
    +      },
    +      {
    +        begin: '(ncalls|tottime|cumtime)',
    +        end: '$',
    +        keywords: 'ncalls tottime|10 cumtime|10 filename',
    +        relevance: 10
    +      },
    +      {
    +        begin: 'function calls',
    +        end: '$',
    +        contains: [ hljs.C_NUMBER_MODE ],
    +        relevance: 10
    +      },
    +      hljs.APOS_STRING_MODE,
    +      hljs.QUOTE_STRING_MODE,
    +      {
    +        className: 'string',
    +        begin: '\\(',
    +        end: '\\)$',
    +        excludeBegin: true,
    +        excludeEnd: true,
    +        relevance: 0
    +      }
    +    ]
    +  };
    +}
    +
    +module.exports = profile;
    diff --git a/node_modules/highlight.js/lib/languages/prolog.js b/node_modules/highlight.js/lib/languages/prolog.js
    new file mode 100644
    index 0000000..25556cd
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/prolog.js
    @@ -0,0 +1,102 @@
    +/*
    +Language: Prolog
    +Description: Prolog is a general purpose logic programming language associated with artificial intelligence and computational linguistics.
    +Author: Raivo Laanemets 
    +Website: https://en.wikipedia.org/wiki/Prolog
    +*/
    +
    +function prolog(hljs) {
    +  const ATOM = {
    +
    +    begin: /[a-z][A-Za-z0-9_]*/,
    +    relevance: 0
    +  };
    +
    +  const VAR = {
    +
    +    className: 'symbol',
    +    variants: [
    +      {
    +        begin: /[A-Z][a-zA-Z0-9_]*/
    +      },
    +      {
    +        begin: /_[A-Za-z0-9_]*/
    +      }
    +    ],
    +    relevance: 0
    +  };
    +
    +  const PARENTED = {
    +
    +    begin: /\(/,
    +    end: /\)/,
    +    relevance: 0
    +  };
    +
    +  const LIST = {
    +
    +    begin: /\[/,
    +    end: /\]/
    +  };
    +
    +  const LINE_COMMENT = {
    +
    +    className: 'comment',
    +    begin: /%/,
    +    end: /$/,
    +    contains: [ hljs.PHRASAL_WORDS_MODE ]
    +  };
    +
    +  const BACKTICK_STRING = {
    +
    +    className: 'string',
    +    begin: /`/,
    +    end: /`/,
    +    contains: [ hljs.BACKSLASH_ESCAPE ]
    +  };
    +
    +  const CHAR_CODE = {
    +    className: 'string', // 0'a etc.
    +    begin: /0'(\\'|.)/
    +  };
    +
    +  const SPACE_CODE = {
    +    className: 'string',
    +    begin: /0'\\s/ // 0'\s
    +  };
    +
    +  const PRED_OP = { // relevance booster
    +    begin: /:-/
    +  };
    +
    +  const inner = [
    +
    +    ATOM,
    +    VAR,
    +    PARENTED,
    +    PRED_OP,
    +    LIST,
    +    LINE_COMMENT,
    +    hljs.C_BLOCK_COMMENT_MODE,
    +    hljs.QUOTE_STRING_MODE,
    +    hljs.APOS_STRING_MODE,
    +    BACKTICK_STRING,
    +    CHAR_CODE,
    +    SPACE_CODE,
    +    hljs.C_NUMBER_MODE
    +  ];
    +
    +  PARENTED.contains = inner;
    +  LIST.contains = inner;
    +
    +  return {
    +    name: 'Prolog',
    +    contains: inner.concat([
    +      { // relevance booster
    +        begin: /\.$/
    +      }
    +    ])
    +  };
    +}
    +
    +module.exports = prolog;
    diff --git a/node_modules/highlight.js/lib/languages/properties.js b/node_modules/highlight.js/lib/languages/properties.js
    new file mode 100644
    index 0000000..c167660
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/properties.js
    @@ -0,0 +1,84 @@
    +/*
    +Language: .properties
    +Contributors: Valentin Aitken , Egor Rogov 
    +Website: https://en.wikipedia.org/wiki/.properties
    +Category: common, config
    +*/
    +
    +function properties(hljs) {
    +
    +  // whitespaces: space, tab, formfeed
    +  var WS0 = '[ \\t\\f]*';
    +  var WS1 = '[ \\t\\f]+';
    +  // delimiter
    +  var EQUAL_DELIM = WS0+'[:=]'+WS0;
    +  var WS_DELIM = WS1;
    +  var DELIM = '(' + EQUAL_DELIM + '|' + WS_DELIM + ')';
    +  var KEY_ALPHANUM = '([^\\\\\\W:= \\t\\f\\n]|\\\\.)+';
    +  var KEY_OTHER = '([^\\\\:= \\t\\f\\n]|\\\\.)+';
    +
    +  var DELIM_AND_VALUE = {
    +          // skip DELIM
    +          end: DELIM,
    +          relevance: 0,
    +          starts: {
    +            // value: everything until end of line (again, taking into account backslashes)
    +            className: 'string',
    +            end: /$/,
    +            relevance: 0,
    +            contains: [
    +              { begin: '\\\\\\n' }
    +            ]
    +          }
    +        };
    +
    +  return {
    +    name: '.properties',
    +    case_insensitive: true,
    +    illegal: /\S/,
    +    contains: [
    +      hljs.COMMENT('^\\s*[!#]', '$'),
    +      // key: everything until whitespace or = or : (taking into account backslashes)
    +      // case of a "normal" key
    +      {
    +        returnBegin: true,
    +        variants: [
    +          { begin: KEY_ALPHANUM + EQUAL_DELIM, relevance: 1 },
    +          { begin: KEY_ALPHANUM + WS_DELIM, relevance: 0 }
    +        ],
    +        contains: [
    +          {
    +            className: 'attr',
    +            begin: KEY_ALPHANUM,
    +            endsParent: true,
    +            relevance: 0
    +          }
    +        ],
    +        starts: DELIM_AND_VALUE
    +      },
    +      // case of key containing non-alphanumeric chars => relevance = 0
    +      {
    +        begin: KEY_OTHER + DELIM,
    +        returnBegin: true,
    +        relevance: 0,
    +        contains: [
    +          {
    +            className: 'meta',
    +            begin: KEY_OTHER,
    +            endsParent: true,
    +            relevance: 0
    +          }
    +        ],
    +        starts: DELIM_AND_VALUE
    +      },
    +      // case of an empty key
    +      {
    +        className: 'attr',
    +        relevance: 0,
    +        begin: KEY_OTHER + WS0 + '$'
    +      }
    +    ]
    +  };
    +}
    +
    +module.exports = properties;
    diff --git a/node_modules/highlight.js/lib/languages/protobuf.js b/node_modules/highlight.js/lib/languages/protobuf.js
    new file mode 100644
    index 0000000..2ab25f1
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/protobuf.js
    @@ -0,0 +1,47 @@
    +/*
    +Language: Protocol Buffers
    +Author: Dan Tao 
    +Description: Protocol buffer message definition format
    +Website: https://developers.google.com/protocol-buffers/docs/proto3
    +Category: protocols
    +*/
    +
    +function protobuf(hljs) {
    +  return {
    +    name: 'Protocol Buffers',
    +    keywords: {
    +      keyword: 'package import option optional required repeated group oneof',
    +      built_in: 'double float int32 int64 uint32 uint64 sint32 sint64 ' +
    +        'fixed32 fixed64 sfixed32 sfixed64 bool string bytes',
    +      literal: 'true false'
    +    },
    +    contains: [
    +      hljs.QUOTE_STRING_MODE,
    +      hljs.NUMBER_MODE,
    +      hljs.C_LINE_COMMENT_MODE,
    +      hljs.C_BLOCK_COMMENT_MODE,
    +      {
    +        className: 'class',
    +        beginKeywords: 'message enum service', end: /\{/,
    +        illegal: /\n/,
    +        contains: [
    +          hljs.inherit(hljs.TITLE_MODE, {
    +            starts: {endsWithParent: true, excludeEnd: true} // hack: eating everything after the first title
    +          })
    +        ]
    +      },
    +      {
    +        className: 'function',
    +        beginKeywords: 'rpc',
    +        end: /[{;]/, excludeEnd: true,
    +        keywords: 'rpc returns'
    +      },
    +      { // match enum items (relevance)
    +        // BLAH = ...;
    +        begin: /^\s*[A-Z_]+(?=\s*=[^\n]+;$)/
    +      }
    +    ]
    +  };
    +}
    +
    +module.exports = protobuf;
    diff --git a/node_modules/highlight.js/lib/languages/puppet.js b/node_modules/highlight.js/lib/languages/puppet.js
    new file mode 100644
    index 0000000..026f63a
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/puppet.js
    @@ -0,0 +1,147 @@
    +/*
    +Language: Puppet
    +Author: Jose Molina Colmenero 
    +Website: https://puppet.com/docs
    +Category: config
    +*/
    +
    +function puppet(hljs) {
    +  const PUPPET_KEYWORDS = {
    +    keyword:
    +    /* language keywords */
    +      'and case default else elsif false if in import enherits node or true undef unless main settings $string ',
    +    literal:
    +    /* metaparameters */
    +      'alias audit before loglevel noop require subscribe tag ' +
    +      /* normal attributes */
    +      'owner ensure group mode name|0 changes context force incl lens load_path onlyif provider returns root show_diff type_check ' +
    +      'en_address ip_address realname command environment hour monute month monthday special target weekday ' +
    +      'creates cwd ogoutput refresh refreshonly tries try_sleep umask backup checksum content ctime force ignore ' +
    +      'links mtime purge recurse recurselimit replace selinux_ignore_defaults selrange selrole seltype seluser source ' +
    +      'souirce_permissions sourceselect validate_cmd validate_replacement allowdupe attribute_membership auth_membership forcelocal gid ' +
    +      'ia_load_module members system host_aliases ip allowed_trunk_vlans description device_url duplex encapsulation etherchannel ' +
    +      'native_vlan speed principals allow_root auth_class auth_type authenticate_user k_of_n mechanisms rule session_owner shared options ' +
    +      'device fstype enable hasrestart directory present absent link atboot blockdevice device dump pass remounts poller_tag use ' +
    +      'message withpath adminfile allow_virtual allowcdrom category configfiles flavor install_options instance package_settings platform ' +
    +      'responsefile status uninstall_options vendor unless_system_user unless_uid binary control flags hasstatus manifest pattern restart running ' +
    +      'start stop allowdupe auths expiry gid groups home iterations key_membership keys managehome membership password password_max_age ' +
    +      'password_min_age profile_membership profiles project purge_ssh_keys role_membership roles salt shell uid baseurl cost descr enabled ' +
    +      'enablegroups exclude failovermethod gpgcheck gpgkey http_caching include includepkgs keepalive metadata_expire metalink mirrorlist ' +
    +      'priority protect proxy proxy_password proxy_username repo_gpgcheck s3_enabled skip_if_unavailable sslcacert sslclientcert sslclientkey ' +
    +      'sslverify mounted',
    +    built_in:
    +    /* core facts */
    +      'architecture augeasversion blockdevices boardmanufacturer boardproductname boardserialnumber cfkey dhcp_servers ' +
    +      'domain ec2_ ec2_userdata facterversion filesystems ldom fqdn gid hardwareisa hardwaremodel hostname id|0 interfaces ' +
    +      'ipaddress ipaddress_ ipaddress6 ipaddress6_ iphostnumber is_virtual kernel kernelmajversion kernelrelease kernelversion ' +
    +      'kernelrelease kernelversion lsbdistcodename lsbdistdescription lsbdistid lsbdistrelease lsbmajdistrelease lsbminordistrelease ' +
    +      'lsbrelease macaddress macaddress_ macosx_buildversion macosx_productname macosx_productversion macosx_productverson_major ' +
    +      'macosx_productversion_minor manufacturer memoryfree memorysize netmask metmask_ network_ operatingsystem operatingsystemmajrelease ' +
    +      'operatingsystemrelease osfamily partitions path physicalprocessorcount processor processorcount productname ps puppetversion ' +
    +      'rubysitedir rubyversion selinux selinux_config_mode selinux_config_policy selinux_current_mode selinux_current_mode selinux_enforced ' +
    +      'selinux_policyversion serialnumber sp_ sshdsakey sshecdsakey sshrsakey swapencrypted swapfree swapsize timezone type uniqueid uptime ' +
    +      'uptime_days uptime_hours uptime_seconds uuid virtual vlans xendomains zfs_version zonenae zones zpool_version'
    +  };
    +
    +  const COMMENT = hljs.COMMENT('#', '$');
    +
    +  const IDENT_RE = '([A-Za-z_]|::)(\\w|::)*';
    +
    +  const TITLE = hljs.inherit(hljs.TITLE_MODE, {
    +    begin: IDENT_RE
    +  });
    +
    +  const VARIABLE = {
    +    className: 'variable',
    +    begin: '\\$' + IDENT_RE
    +  };
    +
    +  const STRING = {
    +    className: 'string',
    +    contains: [
    +      hljs.BACKSLASH_ESCAPE,
    +      VARIABLE
    +    ],
    +    variants: [
    +      {
    +        begin: /'/,
    +        end: /'/
    +      },
    +      {
    +        begin: /"/,
    +        end: /"/
    +      }
    +    ]
    +  };
    +
    +  return {
    +    name: 'Puppet',
    +    aliases: [ 'pp' ],
    +    contains: [
    +      COMMENT,
    +      VARIABLE,
    +      STRING,
    +      {
    +        beginKeywords: 'class',
    +        end: '\\{|;',
    +        illegal: /=/,
    +        contains: [
    +          TITLE,
    +          COMMENT
    +        ]
    +      },
    +      {
    +        beginKeywords: 'define',
    +        end: /\{/,
    +        contains: [
    +          {
    +            className: 'section',
    +            begin: hljs.IDENT_RE,
    +            endsParent: true
    +          }
    +        ]
    +      },
    +      {
    +        begin: hljs.IDENT_RE + '\\s+\\{',
    +        returnBegin: true,
    +        end: /\S/,
    +        contains: [
    +          {
    +            className: 'keyword',
    +            begin: hljs.IDENT_RE
    +          },
    +          {
    +            begin: /\{/,
    +            end: /\}/,
    +            keywords: PUPPET_KEYWORDS,
    +            relevance: 0,
    +            contains: [
    +              STRING,
    +              COMMENT,
    +              {
    +                begin: '[a-zA-Z_]+\\s*=>',
    +                returnBegin: true,
    +                end: '=>',
    +                contains: [
    +                  {
    +                    className: 'attr',
    +                    begin: hljs.IDENT_RE
    +                  }
    +                ]
    +              },
    +              {
    +                className: 'number',
    +                begin: '(\\b0[0-7_]+)|(\\b0x[0-9a-fA-F_]+)|(\\b[1-9][0-9_]*(\\.[0-9_]+)?)|[0_]\\b',
    +                relevance: 0
    +              },
    +              VARIABLE
    +            ]
    +          }
    +        ],
    +        relevance: 0
    +      }
    +    ]
    +  };
    +}
    +
    +module.exports = puppet;
    diff --git a/node_modules/highlight.js/lib/languages/purebasic.js b/node_modules/highlight.js/lib/languages/purebasic.js
    new file mode 100644
    index 0000000..6dd36cf
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/purebasic.js
    @@ -0,0 +1,101 @@
    +/*
    +Language: PureBASIC
    +Author: Tristano Ajmone 
    +Description: Syntax highlighting for PureBASIC (v.5.00-5.60). No inline ASM highlighting. (v.1.2, May 2017)
    +Credits: I've taken inspiration from the PureBasic language file for GeSHi, created by Gustavo Julio Fiorenza (GuShH).
    +Website: https://www.purebasic.com
    +*/
    +
    +// Base deafult colors in PB IDE: background: #FFFFDF; foreground: #000000;
    +
    +function purebasic(hljs) {
    +  const STRINGS = { // PB IDE color: #0080FF (Azure Radiance)
    +    className: 'string',
    +    begin: '(~)?"',
    +    end: '"',
    +    illegal: '\\n'
    +  };
    +  const CONSTANTS = { // PB IDE color: #924B72 (Cannon Pink)
    +    //  "#" + a letter or underscore + letters, digits or underscores + (optional) "$"
    +    className: 'symbol',
    +    begin: '#[a-zA-Z_]\\w*\\$?'
    +  };
    +
    +  return {
    +    name: 'PureBASIC',
    +    aliases: [
    +      'pb',
    +      'pbi'
    +    ],
    +    keywords: // PB IDE color: #006666 (Blue Stone) + Bold
    +      // Keywords from all version of PureBASIC 5.00 upward ...
    +      'Align And Array As Break CallDebugger Case CompilerCase CompilerDefault ' +
    +      'CompilerElse CompilerElseIf CompilerEndIf CompilerEndSelect CompilerError ' +
    +      'CompilerIf CompilerSelect CompilerWarning Continue Data DataSection Debug ' +
    +      'DebugLevel Declare DeclareC DeclareCDLL DeclareDLL DeclareModule Default ' +
    +      'Define Dim DisableASM DisableDebugger DisableExplicit Else ElseIf EnableASM ' +
    +      'EnableDebugger EnableExplicit End EndDataSection EndDeclareModule EndEnumeration ' +
    +      'EndIf EndImport EndInterface EndMacro EndModule EndProcedure EndSelect ' +
    +      'EndStructure EndStructureUnion EndWith Enumeration EnumerationBinary Extends ' +
    +      'FakeReturn For ForEach ForEver Global Gosub Goto If Import ImportC ' +
    +      'IncludeBinary IncludeFile IncludePath Interface List Macro MacroExpandedCount ' +
    +      'Map Module NewList NewMap Next Not Or Procedure ProcedureC ' +
    +      'ProcedureCDLL ProcedureDLL ProcedureReturn Protected Prototype PrototypeC ReDim ' +
    +      'Read Repeat Restore Return Runtime Select Shared Static Step Structure ' +
    +      'StructureUnion Swap Threaded To UndefineMacro Until Until  UnuseModule ' +
    +      'UseModule Wend While With XIncludeFile XOr',
    +    contains: [
    +      // COMMENTS | PB IDE color: #00AAAA (Persian Green)
    +      hljs.COMMENT(';', '$', {
    +        relevance: 0
    +      }),
    +
    +      { // PROCEDURES DEFINITIONS
    +        className: 'function',
    +        begin: '\\b(Procedure|Declare)(C|CDLL|DLL)?\\b',
    +        end: '\\(',
    +        excludeEnd: true,
    +        returnBegin: true,
    +        contains: [
    +          { // PROCEDURE KEYWORDS | PB IDE color: #006666 (Blue Stone) + Bold
    +            className: 'keyword',
    +            begin: '(Procedure|Declare)(C|CDLL|DLL)?',
    +            excludeEnd: true
    +          },
    +          { // PROCEDURE RETURN TYPE SETTING | PB IDE color: #000000 (Black)
    +            className: 'type',
    +            begin: '\\.\\w*'
    +            // end: ' ',
    +          },
    +          hljs.UNDERSCORE_TITLE_MODE // PROCEDURE NAME | PB IDE color: #006666 (Blue Stone)
    +        ]
    +      },
    +      STRINGS,
    +      CONSTANTS
    +    ]
    +  };
    +}
    +
    +/*  ==============================================================================
    +                                      CHANGELOG
    +    ==============================================================================
    +    - v.1.2 (2017-05-12)
    +        -- BUG-FIX: Some keywords were accidentally joyned together. Now fixed.
    +    - v.1.1 (2017-04-30)
    +        -- Updated to PureBASIC 5.60.
    +        -- Keywords list now built by extracting them from the PureBASIC SDK's
    +           "SyntaxHilighting.dll" (from each PureBASIC version). Tokens from each
    +           version are added to the list, and renamed or removed tokens are kept
    +           for the sake of covering all versions of the language from PureBASIC
    +           v5.00 upward. (NOTE: currently, there are no renamed or deprecated
    +           tokens in the keywords list). For more info, see:
    +           -- http://www.purebasic.fr/english/viewtopic.php?&p=506269
    +           -- https://github.com/tajmone/purebasic-archives/tree/master/syntax-highlighting/guidelines
    +    - v.1.0 (April 2016)
    +        -- First release
    +        -- Keywords list taken and adapted from GuShH's (Gustavo Julio Fiorenza)
    +           PureBasic language file for GeSHi:
    +           -- https://github.com/easybook/geshi/blob/master/geshi/purebasic.php
    +*/
    +
    +module.exports = purebasic;
    diff --git a/node_modules/highlight.js/lib/languages/python-repl.js b/node_modules/highlight.js/lib/languages/python-repl.js
    new file mode 100644
    index 0000000..6c1ead0
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/python-repl.js
    @@ -0,0 +1,36 @@
    +/*
    +Language: Python REPL
    +Requires: python.js
    +Author: Josh Goebel 
    +Category: common
    +*/
    +
    +function pythonRepl(hljs) {
    +  return {
    +    aliases: [ 'pycon' ],
    +    contains: [
    +      {
    +        className: 'meta',
    +        starts: {
    +          // a space separates the REPL prefix from the actual code
    +          // this is purely for cleaner HTML output
    +          end: / |$/,
    +          starts: {
    +            end: '$',
    +            subLanguage: 'python'
    +          }
    +        },
    +        variants: [
    +          {
    +            begin: /^>>>(?=[ ]|$)/
    +          },
    +          {
    +            begin: /^\.\.\.(?=[ ]|$)/
    +          }
    +        ]
    +      }
    +    ]
    +  };
    +}
    +
    +module.exports = pythonRepl;
    diff --git a/node_modules/highlight.js/lib/languages/python.js b/node_modules/highlight.js/lib/languages/python.js
    new file mode 100644
    index 0000000..bc2b221
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/python.js
    @@ -0,0 +1,289 @@
    +/*
    +Language: Python
    +Description: Python is an interpreted, object-oriented, high-level programming language with dynamic semantics.
    +Website: https://www.python.org
    +Category: common
    +*/
    +
    +function python(hljs) {
    +  const RESERVED_WORDS = [
    +    'and',
    +    'as',
    +    'assert',
    +    'async',
    +    'await',
    +    'break',
    +    'class',
    +    'continue',
    +    'def',
    +    'del',
    +    'elif',
    +    'else',
    +    'except',
    +    'finally',
    +    'for',
    +    '',
    +    'from',
    +    'global',
    +    'if',
    +    'import',
    +    'in',
    +    'is',
    +    'lambda',
    +    'nonlocal|10',
    +    'not',
    +    'or',
    +    'pass',
    +    'raise',
    +    'return',
    +    'try',
    +    'while',
    +    'with',
    +    'yield',
    +  ];
    +
    +  const BUILT_INS = [
    +    '__import__',
    +    'abs',
    +    'all',
    +    'any',
    +    'ascii',
    +    'bin',
    +    'bool',
    +    'breakpoint',
    +    'bytearray',
    +    'bytes',
    +    'callable',
    +    'chr',
    +    'classmethod',
    +    'compile',
    +    'complex',
    +    'delattr',
    +    'dict',
    +    'dir',
    +    'divmod',
    +    'enumerate',
    +    'eval',
    +    'exec',
    +    'filter',
    +    'float',
    +    'format',
    +    'frozenset',
    +    'getattr',
    +    'globals',
    +    'hasattr',
    +    'hash',
    +    'help',
    +    'hex',
    +    'id',
    +    'input',
    +    'int',
    +    'isinstance',
    +    'issubclass',
    +    'iter',
    +    'len',
    +    'list',
    +    'locals',
    +    'map',
    +    'max',
    +    'memoryview',
    +    'min',
    +    'next',
    +    'object',
    +    'oct',
    +    'open',
    +    'ord',
    +    'pow',
    +    'print',
    +    'property',
    +    'range',
    +    'repr',
    +    'reversed',
    +    'round',
    +    'set',
    +    'setattr',
    +    'slice',
    +    'sorted',
    +    'staticmethod',
    +    'str',
    +    'sum',
    +    'super',
    +    'tuple',
    +    'type',
    +    'vars',
    +    'zip',
    +  ];
    +
    +  const LITERALS = [
    +    '__debug__',
    +    'Ellipsis',
    +    'False',
    +    'None',
    +    'NotImplemented',
    +    'True',
    +  ];
    +
    +  const KEYWORDS = {
    +    keyword: RESERVED_WORDS.join(' '),
    +    built_in: BUILT_INS.join(' '),
    +    literal: LITERALS.join(' ')
    +  };
    +
    +  const PROMPT = {
    +    className: 'meta',  begin: /^(>>>|\.\.\.) /
    +  };
    +
    +  const SUBST = {
    +    className: 'subst',
    +    begin: /\{/, end: /\}/,
    +    keywords: KEYWORDS,
    +    illegal: /#/
    +  };
    +
    +  const LITERAL_BRACKET = {
    +    begin: /\{\{/,
    +    relevance: 0
    +  };
    +
    +  const STRING = {
    +    className: 'string',
    +    contains: [hljs.BACKSLASH_ESCAPE],
    +    variants: [
    +      {
    +        begin: /([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?'''/, end: /'''/,
    +        contains: [hljs.BACKSLASH_ESCAPE, PROMPT],
    +        relevance: 10
    +      },
    +      {
    +        begin: /([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?"""/, end: /"""/,
    +        contains: [hljs.BACKSLASH_ESCAPE, PROMPT],
    +        relevance: 10
    +      },
    +      {
    +        begin: /([fF][rR]|[rR][fF]|[fF])'''/, end: /'''/,
    +        contains: [hljs.BACKSLASH_ESCAPE, PROMPT, LITERAL_BRACKET, SUBST]
    +      },
    +      {
    +        begin: /([fF][rR]|[rR][fF]|[fF])"""/, end: /"""/,
    +        contains: [hljs.BACKSLASH_ESCAPE, PROMPT, LITERAL_BRACKET, SUBST]
    +      },
    +      {
    +        begin: /([uU]|[rR])'/, end: /'/,
    +        relevance: 10
    +      },
    +      {
    +        begin: /([uU]|[rR])"/, end: /"/,
    +        relevance: 10
    +      },
    +      {
    +        begin: /([bB]|[bB][rR]|[rR][bB])'/, end: /'/
    +      },
    +      {
    +        begin: /([bB]|[bB][rR]|[rR][bB])"/, end: /"/
    +      },
    +      {
    +        begin: /([fF][rR]|[rR][fF]|[fF])'/, end: /'/,
    +        contains: [hljs.BACKSLASH_ESCAPE, LITERAL_BRACKET, SUBST]
    +      },
    +      {
    +        begin: /([fF][rR]|[rR][fF]|[fF])"/, end: /"/,
    +        contains: [hljs.BACKSLASH_ESCAPE, LITERAL_BRACKET, SUBST]
    +      },
    +      hljs.APOS_STRING_MODE,
    +      hljs.QUOTE_STRING_MODE
    +    ]
    +  };
    +
    +  // https://docs.python.org/3.9/reference/lexical_analysis.html#numeric-literals
    +  const digitpart = '[0-9](_?[0-9])*';
    +  const pointfloat = `(\\b(${digitpart}))?\\.(${digitpart})|\\b(${digitpart})\\.`;
    +  const NUMBER = {
    +    className: 'number', relevance: 0,
    +    variants: [
    +      // exponentfloat, pointfloat
    +      // https://docs.python.org/3.9/reference/lexical_analysis.html#floating-point-literals
    +      // optionally imaginary
    +      // https://docs.python.org/3.9/reference/lexical_analysis.html#imaginary-literals
    +      // Note: no leading \b because floats can start with a decimal point
    +      // and we don't want to mishandle e.g. `fn(.5)`,
    +      // no trailing \b for pointfloat because it can end with a decimal point
    +      // and we don't want to mishandle e.g. `0..hex()`; this should be safe
    +      // because both MUST contain a decimal point and so cannot be confused with
    +      // the interior part of an identifier
    +      { begin: `(\\b(${digitpart})|(${pointfloat}))[eE][+-]?(${digitpart})[jJ]?\\b` },
    +      { begin: `(${pointfloat})[jJ]?` },
    +
    +      // decinteger, bininteger, octinteger, hexinteger
    +      // https://docs.python.org/3.9/reference/lexical_analysis.html#integer-literals
    +      // optionally "long" in Python 2
    +      // https://docs.python.org/2.7/reference/lexical_analysis.html#integer-and-long-integer-literals
    +      // decinteger is optionally imaginary
    +      // https://docs.python.org/3.9/reference/lexical_analysis.html#imaginary-literals
    +      { begin: '\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?\\b' },
    +      { begin: '\\b0[bB](_?[01])+[lL]?\\b' },
    +      { begin: '\\b0[oO](_?[0-7])+[lL]?\\b' },
    +      { begin: '\\b0[xX](_?[0-9a-fA-F])+[lL]?\\b' },
    +
    +      // imagnumber (digitpart-based)
    +      // https://docs.python.org/3.9/reference/lexical_analysis.html#imaginary-literals
    +      { begin: `\\b(${digitpart})[jJ]\\b` },
    +    ]
    +  };
    +
    +  const PARAMS = {
    +    className: 'params',
    +    variants: [
    +      // Exclude params at functions without params
    +      {begin: /\(\s*\)/, skip: true, className: null },
    +      {
    +        begin: /\(/, end: /\)/, excludeBegin: true, excludeEnd: true,
    +        keywords: KEYWORDS,
    +        contains: ['self', PROMPT, NUMBER, STRING, hljs.HASH_COMMENT_MODE],
    +      },
    +    ],
    +  };
    +  SUBST.contains = [STRING, NUMBER, PROMPT];
    +
    +  return {
    +    name: 'Python',
    +    aliases: ['py', 'gyp', 'ipython'],
    +    keywords: KEYWORDS,
    +    illegal: /(<\/|->|\?)|=>/,
    +    contains: [
    +      PROMPT,
    +      NUMBER,
    +      // eat "if" prior to string so that it won't accidentally be
    +      // labeled as an f-string as in:
    +      { begin: /\bself\b/, }, // very common convention
    +      { beginKeywords: "if", relevance: 0 },
    +      STRING,
    +      hljs.HASH_COMMENT_MODE,
    +      {
    +        variants: [
    +          {className: 'function', beginKeywords: 'def'},
    +          {className: 'class', beginKeywords: 'class'}
    +        ],
    +        end: /:/,
    +        illegal: /[${=;\n,]/,
    +        contains: [
    +          hljs.UNDERSCORE_TITLE_MODE,
    +          PARAMS,
    +          {
    +            begin: /->/, endsWithParent: true,
    +            keywords: 'None'
    +          }
    +        ]
    +      },
    +      {
    +        className: 'meta',
    +        begin: /^[\t ]*@/, end: /(?=#)|$/,
    +        contains: [NUMBER, PARAMS, STRING]
    +      },
    +      {
    +        begin: /\b(print|exec)\(/ // don’t highlight keywords-turned-functions in Python 3
    +      }
    +    ]
    +  };
    +}
    +
    +module.exports = python;
    diff --git a/node_modules/highlight.js/lib/languages/q.js b/node_modules/highlight.js/lib/languages/q.js
    new file mode 100644
    index 0000000..0737415
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/q.js
    @@ -0,0 +1,37 @@
    +/*
    +Language: Q
    +Description: Q is a vector-based functional paradigm programming language built into the kdb+ database.
    +             (K/Q/Kdb+ from Kx Systems)
    +Author: Sergey Vidyuk 
    +Website: https://kx.com/connect-with-us/developers/
    +*/
    +
    +function q(hljs) {
    +  const KEYWORDS = {
    +    $pattern: /(`?)[A-Za-z0-9_]+\b/,
    +    keyword:
    +      'do while select delete by update from',
    +    literal:
    +      '0b 1b',
    +    built_in:
    +      'neg not null string reciprocal floor ceiling signum mod xbar xlog and or each scan over prior mmu lsq inv md5 ltime gtime count first var dev med cov cor all any rand sums prds mins maxs fills deltas ratios avgs differ prev next rank reverse iasc idesc asc desc msum mcount mavg mdev xrank mmin mmax xprev rotate distinct group where flip type key til get value attr cut set upsert raze union inter except cross sv vs sublist enlist read0 read1 hopen hclose hdel hsym hcount peach system ltrim rtrim trim lower upper ssr view tables views cols xcols keys xkey xcol xasc xdesc fkeys meta lj aj aj0 ij pj asof uj ww wj wj1 fby xgroup ungroup ej save load rsave rload show csv parse eval min max avg wavg wsum sin cos tan sum',
    +    type:
    +      '`float `double int `timestamp `timespan `datetime `time `boolean `symbol `char `byte `short `long `real `month `date `minute `second `guid'
    +  };
    +
    +  return {
    +    name: 'Q',
    +    aliases: [
    +      'k',
    +      'kdb'
    +    ],
    +    keywords: KEYWORDS,
    +    contains: [
    +      hljs.C_LINE_COMMENT_MODE,
    +      hljs.QUOTE_STRING_MODE,
    +      hljs.C_NUMBER_MODE
    +    ]
    +  };
    +}
    +
    +module.exports = q;
    diff --git a/node_modules/highlight.js/lib/languages/qml.js b/node_modules/highlight.js/lib/languages/qml.js
    new file mode 100644
    index 0000000..57b109d
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/qml.js
    @@ -0,0 +1,225 @@
    +/**
    + * @param {string} value
    + * @returns {RegExp}
    + * */
    +
    +/**
    + * @param {RegExp | string } re
    + * @returns {string}
    + */
    +function source(re) {
    +  if (!re) return null;
    +  if (typeof re === "string") return re;
    +
    +  return re.source;
    +}
    +
    +/**
    + * @param {...(RegExp | string) } args
    + * @returns {string}
    + */
    +function concat(...args) {
    +  const joined = args.map((x) => source(x)).join("");
    +  return joined;
    +}
    +
    +/*
    +Language: QML
    +Requires: javascript.js, xml.js
    +Author: John Foster 
    +Description: Syntax highlighting for the Qt Quick QML scripting language, based mostly off
    +             the JavaScript parser.
    +Website: https://doc.qt.io/qt-5/qmlapplications.html
    +Category: scripting
    +*/
    +
    +function qml(hljs) {
    +  const KEYWORDS = {
    +    keyword:
    +      'in of on if for while finally var new function do return void else break catch ' +
    +      'instanceof with throw case default try this switch continue typeof delete ' +
    +      'let yield const export super debugger as async await import',
    +    literal:
    +      'true false null undefined NaN Infinity',
    +    built_in:
    +      'eval isFinite isNaN parseFloat parseInt decodeURI decodeURIComponent ' +
    +      'encodeURI encodeURIComponent escape unescape Object Function Boolean Error ' +
    +      'EvalError InternalError RangeError ReferenceError StopIteration SyntaxError ' +
    +      'TypeError URIError Number Math Date String RegExp Array Float32Array ' +
    +      'Float64Array Int16Array Int32Array Int8Array Uint16Array Uint32Array ' +
    +      'Uint8Array Uint8ClampedArray ArrayBuffer DataView JSON Intl arguments require ' +
    +      'module console window document Symbol Set Map WeakSet WeakMap Proxy Reflect ' +
    +      'Behavior bool color coordinate date double enumeration font geocircle georectangle ' +
    +      'geoshape int list matrix4x4 parent point quaternion real rect ' +
    +      'size string url variant vector2d vector3d vector4d ' +
    +      'Promise'
    +  };
    +
    +  const QML_IDENT_RE = '[a-zA-Z_][a-zA-Z0-9\\._]*';
    +
    +  // Isolate property statements. Ends at a :, =, ;, ,, a comment or end of line.
    +  // Use property class.
    +  const PROPERTY = {
    +    className: 'keyword',
    +    begin: '\\bproperty\\b',
    +    starts: {
    +      className: 'string',
    +      end: '(:|=|;|,|//|/\\*|$)',
    +      returnEnd: true
    +    }
    +  };
    +
    +  // Isolate signal statements. Ends at a ) a comment or end of line.
    +  // Use property class.
    +  const SIGNAL = {
    +    className: 'keyword',
    +    begin: '\\bsignal\\b',
    +    starts: {
    +      className: 'string',
    +      end: '(\\(|:|=|;|,|//|/\\*|$)',
    +      returnEnd: true
    +    }
    +  };
    +
    +  // id: is special in QML. When we see id: we want to mark the id: as attribute and
    +  // emphasize the token following.
    +  const ID_ID = {
    +    className: 'attribute',
    +    begin: '\\bid\\s*:',
    +    starts: {
    +      className: 'string',
    +      end: QML_IDENT_RE,
    +      returnEnd: false
    +    }
    +  };
    +
    +  // Find QML object attribute. An attribute is a QML identifier followed by :.
    +  // Unfortunately it's hard to know where it ends, as it may contain scalars,
    +  // objects, object definitions, or javascript. The true end is either when the parent
    +  // ends or the next attribute is detected.
    +  const QML_ATTRIBUTE = {
    +    begin: QML_IDENT_RE + '\\s*:',
    +    returnBegin: true,
    +    contains: [
    +      {
    +        className: 'attribute',
    +        begin: QML_IDENT_RE,
    +        end: '\\s*:',
    +        excludeEnd: true,
    +        relevance: 0
    +      }
    +    ],
    +    relevance: 0
    +  };
    +
    +  // Find QML object. A QML object is a QML identifier followed by { and ends at the matching }.
    +  // All we really care about is finding IDENT followed by { and just mark up the IDENT and ignore the {.
    +  const QML_OBJECT = {
    +    begin: concat(QML_IDENT_RE, /\s*\{/),
    +    end: /\{/,
    +    returnBegin: true,
    +    relevance: 0,
    +    contains: [
    +      hljs.inherit(hljs.TITLE_MODE, {
    +        begin: QML_IDENT_RE
    +      })
    +    ]
    +  };
    +
    +  return {
    +    name: 'QML',
    +    aliases: [ 'qt' ],
    +    case_insensitive: false,
    +    keywords: KEYWORDS,
    +    contains: [
    +      {
    +        className: 'meta',
    +        begin: /^\s*['"]use (strict|asm)['"]/
    +      },
    +      hljs.APOS_STRING_MODE,
    +      hljs.QUOTE_STRING_MODE,
    +      { // template string
    +        className: 'string',
    +        begin: '`',
    +        end: '`',
    +        contains: [
    +          hljs.BACKSLASH_ESCAPE,
    +          {
    +            className: 'subst',
    +            begin: '\\$\\{',
    +            end: '\\}'
    +          }
    +        ]
    +      },
    +      hljs.C_LINE_COMMENT_MODE,
    +      hljs.C_BLOCK_COMMENT_MODE,
    +      {
    +        className: 'number',
    +        variants: [
    +          {
    +            begin: '\\b(0[bB][01]+)'
    +          },
    +          {
    +            begin: '\\b(0[oO][0-7]+)'
    +          },
    +          {
    +            begin: hljs.C_NUMBER_RE
    +          }
    +        ],
    +        relevance: 0
    +      },
    +      { // "value" container
    +        begin: '(' + hljs.RE_STARTERS_RE + '|\\b(case|return|throw)\\b)\\s*',
    +        keywords: 'return throw case',
    +        contains: [
    +          hljs.C_LINE_COMMENT_MODE,
    +          hljs.C_BLOCK_COMMENT_MODE,
    +          hljs.REGEXP_MODE,
    +          { // E4X / JSX
    +            begin: /\s*[);\]]/,
    +            relevance: 0,
    +            subLanguage: 'xml'
    +          }
    +        ],
    +        relevance: 0
    +      },
    +      SIGNAL,
    +      PROPERTY,
    +      {
    +        className: 'function',
    +        beginKeywords: 'function',
    +        end: /\{/,
    +        excludeEnd: true,
    +        contains: [
    +          hljs.inherit(hljs.TITLE_MODE, {
    +            begin: /[A-Za-z$_][0-9A-Za-z$_]*/
    +          }),
    +          {
    +            className: 'params',
    +            begin: /\(/,
    +            end: /\)/,
    +            excludeBegin: true,
    +            excludeEnd: true,
    +            contains: [
    +              hljs.C_LINE_COMMENT_MODE,
    +              hljs.C_BLOCK_COMMENT_MODE
    +            ]
    +          }
    +        ],
    +        illegal: /\[|%/
    +      },
    +      {
    +        // hack: prevents detection of keywords after dots
    +        begin: '\\.' + hljs.IDENT_RE,
    +        relevance: 0
    +      },
    +      ID_ID,
    +      QML_ATTRIBUTE,
    +      QML_OBJECT
    +    ],
    +    illegal: /#/
    +  };
    +}
    +
    +module.exports = qml;
    diff --git a/node_modules/highlight.js/lib/languages/r.js b/node_modules/highlight.js/lib/languages/r.js
    new file mode 100644
    index 0000000..3cf0c76
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/r.js
    @@ -0,0 +1,215 @@
    +/**
    + * @param {string} value
    + * @returns {RegExp}
    + * */
    +
    +/**
    + * @param {RegExp | string } re
    + * @returns {string}
    + */
    +function source(re) {
    +  if (!re) return null;
    +  if (typeof re === "string") return re;
    +
    +  return re.source;
    +}
    +
    +/**
    + * @param {...(RegExp | string) } args
    + * @returns {string}
    + */
    +function concat(...args) {
    +  const joined = args.map((x) => source(x)).join("");
    +  return joined;
    +}
    +
    +/*
    +Language: R
    +Description: R is a free software environment for statistical computing and graphics.
    +Author: Joe Cheng 
    +Contributors: Konrad Rudolph 
    +Website: https://www.r-project.org
    +Category: scientific
    +*/
    +
    +function r(hljs) {
    +  // Identifiers in R cannot start with `_`, but they can start with `.` if it
    +  // is not immediately followed by a digit.
    +  // R also supports quoted identifiers, which are near-arbitrary sequences
    +  // delimited by backticks (`…`), which may contain escape sequences. These are
    +  // handled in a separate mode. See `test/markup/r/names.txt` for examples.
    +  // FIXME: Support Unicode identifiers.
    +  const IDENT_RE = /(?:(?:[a-zA-Z]|\.[._a-zA-Z])[._a-zA-Z0-9]*)|\.(?!\d)/;
    +  const SIMPLE_IDENT = /[a-zA-Z][a-zA-Z_0-9]*/;
    +
    +  return {
    +    name: 'R',
    +
    +    // only in Haskell, not R
    +    illegal: /->/,
    +    keywords: {
    +      $pattern: IDENT_RE,
    +      keyword:
    +        'function if in break next repeat else for while',
    +      literal:
    +        'NULL NA TRUE FALSE Inf NaN NA_integer_|10 NA_real_|10 ' +
    +        'NA_character_|10 NA_complex_|10',
    +      built_in:
    +        // Builtin constants
    +        'LETTERS letters month.abb month.name pi T F ' +
    +        // Primitive functions
    +        // These are all the functions in `base` that are implemented as a
    +        // `.Primitive`, minus those functions that are also keywords.
    +        'abs acos acosh all any anyNA Arg as.call as.character ' +
    +        'as.complex as.double as.environment as.integer as.logical ' +
    +        'as.null.default as.numeric as.raw asin asinh atan atanh attr ' +
    +        'attributes baseenv browser c call ceiling class Conj cos cosh ' +
    +        'cospi cummax cummin cumprod cumsum digamma dim dimnames ' +
    +        'emptyenv exp expression floor forceAndCall gamma gc.time ' +
    +        'globalenv Im interactive invisible is.array is.atomic is.call ' +
    +        'is.character is.complex is.double is.environment is.expression ' +
    +        'is.finite is.function is.infinite is.integer is.language ' +
    +        'is.list is.logical is.matrix is.na is.name is.nan is.null ' +
    +        'is.numeric is.object is.pairlist is.raw is.recursive is.single ' +
    +        'is.symbol lazyLoadDBfetch length lgamma list log max min ' +
    +        'missing Mod names nargs nzchar oldClass on.exit pos.to.env ' +
    +        'proc.time prod quote range Re rep retracemem return round ' +
    +        'seq_along seq_len seq.int sign signif sin sinh sinpi sqrt ' +
    +        'standardGeneric substitute sum switch tan tanh tanpi tracemem ' +
    +        'trigamma trunc unclass untracemem UseMethod xtfrm',
    +    },
    +
    +    contains: [
    +      // Roxygen comments
    +      hljs.COMMENT(
    +        /#'/,
    +        /$/,
    +        {
    +          contains: [
    +            {
    +              // Handle `@examples` separately to cause all subsequent code
    +              // until the next `@`-tag on its own line to be kept as-is,
    +              // preventing highlighting. This code is example R code, so nested
    +              // doctags shouldn’t be treated as such. See
    +              // `test/markup/r/roxygen.txt` for an example.
    +              className: 'doctag',
    +              begin: '@examples',
    +              starts: {
    +                contains: [
    +                  { begin: /\n/ },
    +                  {
    +                    begin: /#'\s*(?=@[a-zA-Z]+)/,
    +                    endsParent: true,
    +                  },
    +                  {
    +                    begin: /#'/,
    +                    end: /$/,
    +                    excludeBegin: true,
    +                  }
    +                ]
    +              }
    +            },
    +            {
    +              // Handle `@param` to highlight the parameter name following
    +              // after.
    +              className: 'doctag',
    +              begin: '@param',
    +              end: /$/,
    +              contains: [
    +                {
    +                  className: 'variable',
    +                  variants: [
    +                    { begin: IDENT_RE },
    +                    { begin: /`(?:\\.|[^`\\])+`/ }
    +                  ],
    +                  endsParent: true
    +                }
    +              ]
    +            },
    +            {
    +              className: 'doctag',
    +              begin: /@[a-zA-Z]+/
    +            },
    +            {
    +              className: 'meta-keyword',
    +              begin: /\\[a-zA-Z]+/,
    +            }
    +          ]
    +        }
    +      ),
    +
    +      hljs.HASH_COMMENT_MODE,
    +
    +      {
    +        className: 'string',
    +        contains: [hljs.BACKSLASH_ESCAPE],
    +        variants: [
    +          hljs.END_SAME_AS_BEGIN({ begin: /[rR]"(-*)\(/, end: /\)(-*)"/ }),
    +          hljs.END_SAME_AS_BEGIN({ begin: /[rR]"(-*)\{/, end: /\}(-*)"/ }),
    +          hljs.END_SAME_AS_BEGIN({ begin: /[rR]"(-*)\[/, end: /\](-*)"/ }),
    +          hljs.END_SAME_AS_BEGIN({ begin: /[rR]'(-*)\(/, end: /\)(-*)'/ }),
    +          hljs.END_SAME_AS_BEGIN({ begin: /[rR]'(-*)\{/, end: /\}(-*)'/ }),
    +          hljs.END_SAME_AS_BEGIN({ begin: /[rR]'(-*)\[/, end: /\](-*)'/ }),
    +          {begin: '"', end: '"', relevance: 0},
    +          {begin: "'", end: "'", relevance: 0}
    +        ],
    +      },
    +      {
    +        className: 'number',
    +        variants: [
    +          // TODO: replace with negative look-behind when available
    +          // { begin: /(? {
    +        //   if (match.index > 0) {
    +        //     let priorChar = match.input[match.index - 1];
    +        //     if (priorChar.match(/[a-zA-Z0-9._]/)) response.ignoreMatch();
    +        //   }
    +        // },
    +        relevance: 0
    +      },
    +
    +      {
    +        // infix operator
    +        begin: '%',
    +        end: '%'
    +      },
    +      // relevance boost for assignment
    +      {
    +        begin: concat(SIMPLE_IDENT, "\\s+<-\\s+")
    +      },
    +      {
    +        // escaped identifier
    +        begin: '`',
    +        end: '`',
    +        contains: [
    +          { begin: /\\./ }
    +        ]
    +      }
    +    ]
    +  };
    +}
    +
    +module.exports = r;
    diff --git a/node_modules/highlight.js/lib/languages/reasonml.js b/node_modules/highlight.js/lib/languages/reasonml.js
    new file mode 100644
    index 0000000..c2c4cbd
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/reasonml.js
    @@ -0,0 +1,321 @@
    +/*
    +Language: ReasonML
    +Description: Reason lets you write simple, fast and quality type safe code while leveraging both the JavaScript & OCaml ecosystems.
    +Website: https://reasonml.github.io
    +Author: Gidi Meir Morris 
    +Category: functional
    +*/
    +function reasonml(hljs) {
    +  function orReValues(ops) {
    +    return ops
    +      .map(function(op) {
    +        return op
    +          .split('')
    +          .map(function(char) {
    +            return '\\' + char;
    +          })
    +          .join('');
    +      })
    +      .join('|');
    +  }
    +
    +  const RE_IDENT = '~?[a-z$_][0-9a-zA-Z$_]*';
    +  const RE_MODULE_IDENT = '`?[A-Z$_][0-9a-zA-Z$_]*';
    +
    +  const RE_PARAM_TYPEPARAM = '\'?[a-z$_][0-9a-z$_]*';
    +  const RE_PARAM_TYPE = '\\s*:\\s*[a-z$_][0-9a-z$_]*(\\(\\s*(' + RE_PARAM_TYPEPARAM + '\\s*(,' + RE_PARAM_TYPEPARAM + '\\s*)*)?\\))?';
    +  const RE_PARAM = RE_IDENT + '(' + RE_PARAM_TYPE + '){0,2}';
    +  const RE_OPERATOR = "(" + orReValues([
    +    '||',
    +    '++',
    +    '**',
    +    '+.',
    +    '*',
    +    '/',
    +    '*.',
    +    '/.',
    +    '...'
    +  ]) + "|\\|>|&&|==|===)";
    +  const RE_OPERATOR_SPACED = "\\s+" + RE_OPERATOR + "\\s+";
    +
    +  const KEYWORDS = {
    +    keyword:
    +      'and as asr assert begin class constraint do done downto else end exception external ' +
    +      'for fun function functor if in include inherit initializer ' +
    +      'land lazy let lor lsl lsr lxor match method mod module mutable new nonrec ' +
    +      'object of open or private rec sig struct then to try type val virtual when while with',
    +    built_in:
    +      'array bool bytes char exn|5 float int int32 int64 list lazy_t|5 nativeint|5 ref string unit ',
    +    literal:
    +      'true false'
    +  };
    +
    +  const RE_NUMBER = '\\b(0[xX][a-fA-F0-9_]+[Lln]?|' +
    +    '0[oO][0-7_]+[Lln]?|' +
    +    '0[bB][01_]+[Lln]?|' +
    +    '[0-9][0-9_]*([Lln]|(\\.[0-9_]*)?([eE][-+]?[0-9_]+)?)?)';
    +
    +  const NUMBER_MODE = {
    +    className: 'number',
    +    relevance: 0,
    +    variants: [
    +      {
    +        begin: RE_NUMBER
    +      },
    +      {
    +        begin: '\\(-' + RE_NUMBER + '\\)'
    +      }
    +    ]
    +  };
    +
    +  const OPERATOR_MODE = {
    +    className: 'operator',
    +    relevance: 0,
    +    begin: RE_OPERATOR
    +  };
    +  const LIST_CONTENTS_MODES = [
    +    {
    +      className: 'identifier',
    +      relevance: 0,
    +      begin: RE_IDENT
    +    },
    +    OPERATOR_MODE,
    +    NUMBER_MODE
    +  ];
    +
    +  const MODULE_ACCESS_CONTENTS = [
    +    hljs.QUOTE_STRING_MODE,
    +    OPERATOR_MODE,
    +    {
    +      className: 'module',
    +      begin: "\\b" + RE_MODULE_IDENT,
    +      returnBegin: true,
    +      end: "\.",
    +      contains: [
    +        {
    +          className: 'identifier',
    +          begin: RE_MODULE_IDENT,
    +          relevance: 0
    +        }
    +      ]
    +    }
    +  ];
    +
    +  const PARAMS_CONTENTS = [
    +    {
    +      className: 'module',
    +      begin: "\\b" + RE_MODULE_IDENT,
    +      returnBegin: true,
    +      end: "\.",
    +      relevance: 0,
    +      contains: [
    +        {
    +          className: 'identifier',
    +          begin: RE_MODULE_IDENT,
    +          relevance: 0
    +        }
    +      ]
    +    }
    +  ];
    +
    +  const PARAMS_MODE = {
    +    begin: RE_IDENT,
    +    end: '(,|\\n|\\))',
    +    relevance: 0,
    +    contains: [
    +      OPERATOR_MODE,
    +      {
    +        className: 'typing',
    +        begin: ':',
    +        end: '(,|\\n)',
    +        returnBegin: true,
    +        relevance: 0,
    +        contains: PARAMS_CONTENTS
    +      }
    +    ]
    +  };
    +
    +  const FUNCTION_BLOCK_MODE = {
    +    className: 'function',
    +    relevance: 0,
    +    keywords: KEYWORDS,
    +    variants: [
    +      {
    +        begin: '\\s(\\(\\.?.*?\\)|' + RE_IDENT + ')\\s*=>',
    +        end: '\\s*=>',
    +        returnBegin: true,
    +        relevance: 0,
    +        contains: [
    +          {
    +            className: 'params',
    +            variants: [
    +              {
    +                begin: RE_IDENT
    +              },
    +              {
    +                begin: RE_PARAM
    +              },
    +              {
    +                begin: /\(\s*\)/
    +              }
    +            ]
    +          }
    +        ]
    +      },
    +      {
    +        begin: '\\s\\(\\.?[^;\\|]*\\)\\s*=>',
    +        end: '\\s=>',
    +        returnBegin: true,
    +        relevance: 0,
    +        contains: [
    +          {
    +            className: 'params',
    +            relevance: 0,
    +            variants: [ PARAMS_MODE ]
    +          }
    +        ]
    +      },
    +      {
    +        begin: '\\(\\.\\s' + RE_IDENT + '\\)\\s*=>'
    +      }
    +    ]
    +  };
    +  MODULE_ACCESS_CONTENTS.push(FUNCTION_BLOCK_MODE);
    +
    +  const CONSTRUCTOR_MODE = {
    +    className: 'constructor',
    +    begin: RE_MODULE_IDENT + '\\(',
    +    end: '\\)',
    +    illegal: '\\n',
    +    keywords: KEYWORDS,
    +    contains: [
    +      hljs.QUOTE_STRING_MODE,
    +      OPERATOR_MODE,
    +      {
    +        className: 'params',
    +        begin: '\\b' + RE_IDENT
    +      }
    +    ]
    +  };
    +
    +  const PATTERN_MATCH_BLOCK_MODE = {
    +    className: 'pattern-match',
    +    begin: '\\|',
    +    returnBegin: true,
    +    keywords: KEYWORDS,
    +    end: '=>',
    +    relevance: 0,
    +    contains: [
    +      CONSTRUCTOR_MODE,
    +      OPERATOR_MODE,
    +      {
    +        relevance: 0,
    +        className: 'constructor',
    +        begin: RE_MODULE_IDENT
    +      }
    +    ]
    +  };
    +
    +  const MODULE_ACCESS_MODE = {
    +    className: 'module-access',
    +    keywords: KEYWORDS,
    +    returnBegin: true,
    +    variants: [
    +      {
    +        begin: "\\b(" + RE_MODULE_IDENT + "\\.)+" + RE_IDENT
    +      },
    +      {
    +        begin: "\\b(" + RE_MODULE_IDENT + "\\.)+\\(",
    +        end: "\\)",
    +        returnBegin: true,
    +        contains: [
    +          FUNCTION_BLOCK_MODE,
    +          {
    +            begin: '\\(',
    +            end: '\\)',
    +            skip: true
    +          }
    +        ].concat(MODULE_ACCESS_CONTENTS)
    +      },
    +      {
    +        begin: "\\b(" + RE_MODULE_IDENT + "\\.)+\\{",
    +        end: /\}/
    +      }
    +    ],
    +    contains: MODULE_ACCESS_CONTENTS
    +  };
    +
    +  PARAMS_CONTENTS.push(MODULE_ACCESS_MODE);
    +
    +  return {
    +    name: 'ReasonML',
    +    aliases: [ 're' ],
    +    keywords: KEYWORDS,
    +    illegal: '(:-|:=|\\$\\{|\\+=)',
    +    contains: [
    +      hljs.COMMENT('/\\*', '\\*/', {
    +        illegal: '^(#,\\/\\/)'
    +      }),
    +      {
    +        className: 'character',
    +        begin: '\'(\\\\[^\']+|[^\'])\'',
    +        illegal: '\\n',
    +        relevance: 0
    +      },
    +      hljs.QUOTE_STRING_MODE,
    +      {
    +        className: 'literal',
    +        begin: '\\(\\)',
    +        relevance: 0
    +      },
    +      {
    +        className: 'literal',
    +        begin: '\\[\\|',
    +        end: '\\|\\]',
    +        relevance: 0,
    +        contains: LIST_CONTENTS_MODES
    +      },
    +      {
    +        className: 'literal',
    +        begin: '\\[',
    +        end: '\\]',
    +        relevance: 0,
    +        contains: LIST_CONTENTS_MODES
    +      },
    +      CONSTRUCTOR_MODE,
    +      {
    +        className: 'operator',
    +        begin: RE_OPERATOR_SPACED,
    +        illegal: '-->',
    +        relevance: 0
    +      },
    +      NUMBER_MODE,
    +      hljs.C_LINE_COMMENT_MODE,
    +      PATTERN_MATCH_BLOCK_MODE,
    +      FUNCTION_BLOCK_MODE,
    +      {
    +        className: 'module-def',
    +        begin: "\\bmodule\\s+" + RE_IDENT + "\\s+" + RE_MODULE_IDENT + "\\s+=\\s+\\{",
    +        end: /\}/,
    +        returnBegin: true,
    +        keywords: KEYWORDS,
    +        relevance: 0,
    +        contains: [
    +          {
    +            className: 'module',
    +            relevance: 0,
    +            begin: RE_MODULE_IDENT
    +          },
    +          {
    +            begin: /\{/,
    +            end: /\}/,
    +            skip: true
    +          }
    +        ].concat(MODULE_ACCESS_CONTENTS)
    +      },
    +      MODULE_ACCESS_MODE
    +    ]
    +  };
    +}
    +
    +module.exports = reasonml;
    diff --git a/node_modules/highlight.js/lib/languages/rib.js b/node_modules/highlight.js/lib/languages/rib.js
    new file mode 100644
    index 0000000..f1d0f4a
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/rib.js
    @@ -0,0 +1,37 @@
    +/*
    +Language: RenderMan RIB
    +Author: Konstantin Evdokimenko 
    +Contributors: Shuen-Huei Guan 
    +Website: https://renderman.pixar.com/resources/RenderMan_20/ribBinding.html
    +Category: graphics
    +*/
    +
    +function rib(hljs) {
    +  return {
    +    name: 'RenderMan RIB',
    +    keywords:
    +      'ArchiveRecord AreaLightSource Atmosphere Attribute AttributeBegin AttributeEnd Basis ' +
    +      'Begin Blobby Bound Clipping ClippingPlane Color ColorSamples ConcatTransform Cone ' +
    +      'CoordinateSystem CoordSysTransform CropWindow Curves Cylinder DepthOfField Detail ' +
    +      'DetailRange Disk Displacement Display End ErrorHandler Exposure Exterior Format ' +
    +      'FrameAspectRatio FrameBegin FrameEnd GeneralPolygon GeometricApproximation Geometry ' +
    +      'Hider Hyperboloid Identity Illuminate Imager Interior LightSource ' +
    +      'MakeCubeFaceEnvironment MakeLatLongEnvironment MakeShadow MakeTexture Matte ' +
    +      'MotionBegin MotionEnd NuPatch ObjectBegin ObjectEnd ObjectInstance Opacity Option ' +
    +      'Orientation Paraboloid Patch PatchMesh Perspective PixelFilter PixelSamples ' +
    +      'PixelVariance Points PointsGeneralPolygons PointsPolygons Polygon Procedural Projection ' +
    +      'Quantize ReadArchive RelativeDetail ReverseOrientation Rotate Scale ScreenWindow ' +
    +      'ShadingInterpolation ShadingRate Shutter Sides Skew SolidBegin SolidEnd Sphere ' +
    +      'SubdivisionMesh Surface TextureCoordinates Torus Transform TransformBegin TransformEnd ' +
    +      'TransformPoints Translate TrimCurve WorldBegin WorldEnd',
    +    illegal: '
    +Description: Syntax highlighting for Roboconf's DSL
    +Website: http://roboconf.net
    +Category: config
    +*/
    +
    +function roboconf(hljs) {
    +  const IDENTIFIER = '[a-zA-Z-_][^\\n{]+\\{';
    +
    +  const PROPERTY = {
    +    className: 'attribute',
    +    begin: /[a-zA-Z-_]+/,
    +    end: /\s*:/,
    +    excludeEnd: true,
    +    starts: {
    +      end: ';',
    +      relevance: 0,
    +      contains: [
    +        {
    +          className: 'variable',
    +          begin: /\.[a-zA-Z-_]+/
    +        },
    +        {
    +          className: 'keyword',
    +          begin: /\(optional\)/
    +        }
    +      ]
    +    }
    +  };
    +
    +  return {
    +    name: 'Roboconf',
    +    aliases: [
    +      'graph',
    +      'instances'
    +    ],
    +    case_insensitive: true,
    +    keywords: 'import',
    +    contains: [
    +      // Facet sections
    +      {
    +        begin: '^facet ' + IDENTIFIER,
    +        end: /\}/,
    +        keywords: 'facet',
    +        contains: [
    +          PROPERTY,
    +          hljs.HASH_COMMENT_MODE
    +        ]
    +      },
    +
    +      // Instance sections
    +      {
    +        begin: '^\\s*instance of ' + IDENTIFIER,
    +        end: /\}/,
    +        keywords: 'name count channels instance-data instance-state instance of',
    +        illegal: /\S/,
    +        contains: [
    +          'self',
    +          PROPERTY,
    +          hljs.HASH_COMMENT_MODE
    +        ]
    +      },
    +
    +      // Component sections
    +      {
    +        begin: '^' + IDENTIFIER,
    +        end: /\}/,
    +        contains: [
    +          PROPERTY,
    +          hljs.HASH_COMMENT_MODE
    +        ]
    +      },
    +
    +      // Comments
    +      hljs.HASH_COMMENT_MODE
    +    ]
    +  };
    +}
    +
    +module.exports = roboconf;
    diff --git a/node_modules/highlight.js/lib/languages/routeros.js b/node_modules/highlight.js/lib/languages/routeros.js
    new file mode 100644
    index 0000000..58763a9
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/routeros.js
    @@ -0,0 +1,171 @@
    +/*
    +Language: Microtik RouterOS script
    +Author: Ivan Dementev 
    +Description: Scripting host provides a way to automate some router maintenance tasks by means of executing user-defined scripts bounded to some event occurrence
    +Website: https://wiki.mikrotik.com/wiki/Manual:Scripting
    +*/
    +
    +// Colors from RouterOS terminal:
    +//   green        - #0E9A00
    +//   teal         - #0C9A9A
    +//   purple       - #99069A
    +//   light-brown  - #9A9900
    +
    +function routeros(hljs) {
    +  const STATEMENTS = 'foreach do while for if from to step else on-error and or not in';
    +
    +  // Global commands: Every global command should start with ":" token, otherwise it will be treated as variable.
    +  const GLOBAL_COMMANDS = 'global local beep delay put len typeof pick log time set find environment terminal error execute parse resolve toarray tobool toid toip toip6 tonum tostr totime';
    +
    +  // Common commands: Following commands available from most sub-menus:
    +  const COMMON_COMMANDS = 'add remove enable disable set get print export edit find run debug error info warning';
    +
    +  const LITERALS = 'true false yes no nothing nil null';
    +
    +  const OBJECTS = 'traffic-flow traffic-generator firewall scheduler aaa accounting address-list address align area bandwidth-server bfd bgp bridge client clock community config connection console customer default dhcp-client dhcp-server discovery dns e-mail ethernet filter firmware gps graphing group hardware health hotspot identity igmp-proxy incoming instance interface ip ipsec ipv6 irq l2tp-server lcd ldp logging mac-server mac-winbox mangle manual mirror mme mpls nat nd neighbor network note ntp ospf ospf-v3 ovpn-server page peer pim ping policy pool port ppp pppoe-client pptp-server prefix profile proposal proxy queue radius resource rip ripng route routing screen script security-profiles server service service-port settings shares smb sms sniffer snmp snooper socks sstp-server system tool tracking type upgrade upnp user-manager users user vlan secret vrrp watchdog web-access wireless pptp pppoe lan wan layer7-protocol lease simple raw';
    +
    +  const VAR = {
    +    className: 'variable',
    +    variants: [
    +      {
    +        begin: /\$[\w\d#@][\w\d_]*/
    +      },
    +      {
    +        begin: /\$\{(.*?)\}/
    +      }
    +    ]
    +  };
    +
    +  const QUOTE_STRING = {
    +    className: 'string',
    +    begin: /"/,
    +    end: /"/,
    +    contains: [
    +      hljs.BACKSLASH_ESCAPE,
    +      VAR,
    +      {
    +        className: 'variable',
    +        begin: /\$\(/,
    +        end: /\)/,
    +        contains: [ hljs.BACKSLASH_ESCAPE ]
    +      }
    +    ]
    +  };
    +
    +  const APOS_STRING = {
    +    className: 'string',
    +    begin: /'/,
    +    end: /'/
    +  };
    +
    +  return {
    +    name: 'Microtik RouterOS script',
    +    aliases: [
    +      'routeros',
    +      'mikrotik'
    +    ],
    +    case_insensitive: true,
    +    keywords: {
    +      $pattern: /:?[\w-]+/,
    +      literal: LITERALS,
    +      keyword: STATEMENTS + ' :' + STATEMENTS.split(' ').join(' :') + ' :' + GLOBAL_COMMANDS.split(' ').join(' :')
    +    },
    +    contains: [
    +      { // illegal syntax
    +        variants: [
    +          { // -- comment
    +            begin: /\/\*/,
    +            end: /\*\//
    +          },
    +          { // Stan comment
    +            begin: /\/\//,
    +            end: /$/
    +          },
    +          { // HTML tags
    +            begin: /<\//,
    +            end: />/
    +          }
    +        ],
    +        illegal: /./
    +      },
    +      hljs.COMMENT('^#', '$'),
    +      QUOTE_STRING,
    +      APOS_STRING,
    +      VAR,
    +      { // attribute=value
    +        begin: /[\w-]+=([^\s{}[\]()]+)/,
    +        relevance: 0,
    +        returnBegin: true,
    +        contains: [
    +          {
    +            className: 'attribute',
    +            begin: /[^=]+/
    +          },
    +          {
    +            begin: /=/,
    +            endsWithParent: true,
    +            relevance: 0,
    +            contains: [
    +              QUOTE_STRING,
    +              APOS_STRING,
    +              VAR,
    +              {
    +                className: 'literal',
    +                begin: '\\b(' + LITERALS.split(' ').join('|') + ')\\b'
    +              },
    +              {
    +                // Do not format unclassified values. Needed to exclude highlighting of values as built_in.
    +                begin: /("[^"]*"|[^\s{}[\]]+)/
    +              }
    +              /*
    +              {
    +                // IPv4 addresses and subnets
    +                className: 'number',
    +                variants: [
    +                  {begin: IPADDR_wBITMASK+'(,'+IPADDR_wBITMASK+')*'}, //192.168.0.0/24,1.2.3.0/24
    +                  {begin: IPADDR+'-'+IPADDR},       // 192.168.0.1-192.168.0.3
    +                  {begin: IPADDR+'(,'+IPADDR+')*'}, // 192.168.0.1,192.168.0.34,192.168.24.1,192.168.0.1
    +                ]
    +              },
    +              {
    +                // MAC addresses and DHCP Client IDs
    +                className: 'number',
    +                begin: /\b(1:)?([0-9A-Fa-f]{1,2}[:-]){5}([0-9A-Fa-f]){1,2}\b/,
    +              },
    +              */
    +            ]
    +          }
    +        ]
    +      },
    +      {
    +        // HEX values
    +        className: 'number',
    +        begin: /\*[0-9a-fA-F]+/
    +      },
    +      {
    +        begin: '\\b(' + COMMON_COMMANDS.split(' ').join('|') + ')([\\s[(\\]|])',
    +        returnBegin: true,
    +        contains: [
    +          {
    +            className: 'builtin-name', // 'function',
    +            begin: /\w+/
    +          }
    +        ]
    +      },
    +      {
    +        className: 'built_in',
    +        variants: [
    +          {
    +            begin: '(\\.\\./|/|\\s)((' + OBJECTS.split(' ').join('|') + ');?\\s)+'
    +          },
    +          {
    +            begin: /\.\./,
    +            relevance: 0
    +          }
    +        ]
    +      }
    +    ]
    +  };
    +}
    +
    +module.exports = routeros;
    diff --git a/node_modules/highlight.js/lib/languages/rsl.js b/node_modules/highlight.js/lib/languages/rsl.js
    new file mode 100644
    index 0000000..2e1983c
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/rsl.js
    @@ -0,0 +1,49 @@
    +/*
    +Language: RenderMan RSL
    +Author: Konstantin Evdokimenko 
    +Contributors: Shuen-Huei Guan 
    +Website: https://renderman.pixar.com/resources/RenderMan_20/shadingLanguage.html
    +Category: graphics
    +*/
    +
    +function rsl(hljs) {
    +  return {
    +    name: 'RenderMan RSL',
    +    keywords: {
    +      keyword:
    +        'float color point normal vector matrix while for if do return else break extern continue',
    +      built_in:
    +        'abs acos ambient area asin atan atmosphere attribute calculatenormal ceil cellnoise ' +
    +        'clamp comp concat cos degrees depth Deriv diffuse distance Du Dv environment exp ' +
    +        'faceforward filterstep floor format fresnel incident length lightsource log match ' +
    +        'max min mod noise normalize ntransform opposite option phong pnoise pow printf ' +
    +        'ptlined radians random reflect refract renderinfo round setcomp setxcomp setycomp ' +
    +        'setzcomp shadow sign sin smoothstep specular specularbrdf spline sqrt step tan ' +
    +        'texture textureinfo trace transform vtransform xcomp ycomp zcomp'
    +    },
    +    illegal: ' source(x)).join("");
    +  return joined;
    +}
    +
    +/*
    +Language: Ruby
    +Description: Ruby is a dynamic, open source programming language with a focus on simplicity and productivity.
    +Website: https://www.ruby-lang.org/
    +Author: Anton Kovalyov 
    +Contributors: Peter Leonov , Vasily Polovnyov , Loren Segal , Pascal Hurni , Cedric Sohrauer 
    +Category: common
    +*/
    +
    +function ruby(hljs) {
    +  var RUBY_METHOD_RE = '([a-zA-Z_]\\w*[!?=]?|[-+~]@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?)';
    +  var RUBY_KEYWORDS = {
    +    keyword:
    +      'and then defined module in return redo if BEGIN retry end for self when ' +
    +      'next until do begin unless END rescue else break undef not super class case ' +
    +      'require yield alias while ensure elsif or include attr_reader attr_writer attr_accessor ' +
    +      '__FILE__',
    +    built_in: 'proc lambda',
    +    literal:
    +      'true false nil'
    +  };
    +  var YARDOCTAG = {
    +    className: 'doctag',
    +    begin: '@[A-Za-z]+'
    +  };
    +  var IRB_OBJECT = {
    +    begin: '#<', end: '>'
    +  };
    +  var COMMENT_MODES = [
    +    hljs.COMMENT(
    +      '#',
    +      '$',
    +      {
    +        contains: [YARDOCTAG]
    +      }
    +    ),
    +    hljs.COMMENT(
    +      '^=begin',
    +      '^=end',
    +      {
    +        contains: [YARDOCTAG],
    +        relevance: 10
    +      }
    +    ),
    +    hljs.COMMENT('^__END__', '\\n$')
    +  ];
    +  var SUBST = {
    +    className: 'subst',
    +    begin: /#\{/, end: /\}/,
    +    keywords: RUBY_KEYWORDS
    +  };
    +  var STRING = {
    +    className: 'string',
    +    contains: [hljs.BACKSLASH_ESCAPE, SUBST],
    +    variants: [
    +      {begin: /'/, end: /'/},
    +      {begin: /"/, end: /"/},
    +      {begin: /`/, end: /`/},
    +      {begin: /%[qQwWx]?\(/, end: /\)/},
    +      {begin: /%[qQwWx]?\[/, end: /\]/},
    +      {begin: /%[qQwWx]?\{/, end: /\}/},
    +      {begin: /%[qQwWx]?/},
    +      {begin: /%[qQwWx]?\//, end: /\//},
    +      {begin: /%[qQwWx]?%/, end: /%/},
    +      {begin: /%[qQwWx]?-/, end: /-/},
    +      {begin: /%[qQwWx]?\|/, end: /\|/},
    +      {
    +        // \B in the beginning suppresses recognition of ?-sequences where ?
    +        // is the last character of a preceding identifier, as in: `func?4`
    +        begin: /\B\?(\\\d{1,3}|\\x[A-Fa-f0-9]{1,2}|\\u[A-Fa-f0-9]{4}|\\?\S)\b/
    +      },
    +      { // heredocs
    +        begin: /<<[-~]?'?(\w+)\n(?:[^\n]*\n)*?\s*\1\b/,
    +        returnBegin: true,
    +        contains: [
    +          { begin: /<<[-~]?'?/ },
    +          hljs.END_SAME_AS_BEGIN({
    +            begin: /(\w+)/, end: /(\w+)/,
    +            contains: [hljs.BACKSLASH_ESCAPE, SUBST],
    +          })
    +        ]
    +      }
    +    ]
    +  };
    +
    +  // Ruby syntax is underdocumented, but this grammar seems to be accurate
    +  // as of version 2.7.2 (confirmed with (irb and `Ripper.sexp(...)`)
    +  // https://docs.ruby-lang.org/en/2.7.0/doc/syntax/literals_rdoc.html#label-Numbers
    +  var decimal = '[1-9](_?[0-9])*|0';
    +  var digits = '[0-9](_?[0-9])*';
    +  var NUMBER = {
    +    className: 'number', relevance: 0,
    +    variants: [
    +      // decimal integer/float, optionally exponential or rational, optionally imaginary
    +      { begin: `\\b(${decimal})(\\.(${digits}))?([eE][+-]?(${digits})|r)?i?\\b` },
    +
    +      // explicit decimal/binary/octal/hexadecimal integer,
    +      // optionally rational and/or imaginary
    +      { begin: "\\b0[dD][0-9](_?[0-9])*r?i?\\b" },
    +      { begin: "\\b0[bB][0-1](_?[0-1])*r?i?\\b" },
    +      { begin: "\\b0[oO][0-7](_?[0-7])*r?i?\\b" },
    +      { begin: "\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*r?i?\\b" },
    +
    +      // 0-prefixed implicit octal integer, optionally rational and/or imaginary
    +      { begin: "\\b0(_?[0-7])+r?i?\\b" },
    +    ]
    +  };
    +
    +  var PARAMS = {
    +    className: 'params',
    +    begin: '\\(', end: '\\)', endsParent: true,
    +    keywords: RUBY_KEYWORDS
    +  };
    +
    +  var RUBY_DEFAULT_CONTAINS = [
    +    STRING,
    +    {
    +      className: 'class',
    +      beginKeywords: 'class module', end: '$|;',
    +      illegal: /=/,
    +      contains: [
    +        hljs.inherit(hljs.TITLE_MODE, {begin: '[A-Za-z_]\\w*(::\\w+)*(\\?|!)?'}),
    +        {
    +          begin: '<\\s*',
    +          contains: [{
    +            begin: '(' + hljs.IDENT_RE + '::)?' + hljs.IDENT_RE
    +          }]
    +        }
    +      ].concat(COMMENT_MODES)
    +    },
    +    {
    +      className: 'function',
    +      // def method_name(
    +      // def method_name;
    +      // def method_name (end of line)
    +      begin: concat(/def\s*/, lookahead(RUBY_METHOD_RE + "\\s*(\\(|;|$)")),
    +      keywords: "def",
    +      end: '$|;',
    +      contains: [
    +        hljs.inherit(hljs.TITLE_MODE, {begin: RUBY_METHOD_RE}),
    +        PARAMS
    +      ].concat(COMMENT_MODES)
    +    },
    +    {
    +      // swallow namespace qualifiers before symbols
    +      begin: hljs.IDENT_RE + '::'
    +    },
    +    {
    +      className: 'symbol',
    +      begin: hljs.UNDERSCORE_IDENT_RE + '(!|\\?)?:',
    +      relevance: 0
    +    },
    +    {
    +      className: 'symbol',
    +      begin: ':(?!\\s)',
    +      contains: [STRING, {begin: RUBY_METHOD_RE}],
    +      relevance: 0
    +    },
    +    NUMBER,
    +    {
    +      // negative-look forward attemps to prevent false matches like:
    +      // @ident@ or $ident$ that might indicate this is not ruby at all
    +      className: "variable",
    +      begin: '(\\$\\W)|((\\$|@@?)(\\w+))(?=[^@$?])' + `(?![A-Za-z])(?![@$?'])`
    +    },
    +    {
    +      className: 'params',
    +      begin: /\|/,
    +      end: /\|/,
    +      relevance:0, // this could be a lot of things (in other languages) other than params
    +      keywords: RUBY_KEYWORDS
    +    },
    +    { // regexp container
    +      begin: '(' + hljs.RE_STARTERS_RE + '|unless)\\s*',
    +      keywords: 'unless',
    +      contains: [
    +        {
    +          className: 'regexp',
    +          contains: [hljs.BACKSLASH_ESCAPE, SUBST],
    +          illegal: /\n/,
    +          variants: [
    +            {begin: '/', end: '/[a-z]*'},
    +            {begin: /%r\{/, end: /\}[a-z]*/},
    +            {begin: '%r\\(', end: '\\)[a-z]*'},
    +            {begin: '%r!', end: '![a-z]*'},
    +            {begin: '%r\\[', end: '\\][a-z]*'}
    +          ]
    +        }
    +      ].concat(IRB_OBJECT, COMMENT_MODES),
    +      relevance: 0
    +    }
    +  ].concat(IRB_OBJECT, COMMENT_MODES);
    +
    +  SUBST.contains = RUBY_DEFAULT_CONTAINS;
    +  PARAMS.contains = RUBY_DEFAULT_CONTAINS;
    +
    +  // >>
    +  // ?>
    +  var SIMPLE_PROMPT = "[>?]>";
    +  // irb(main):001:0>
    +  var DEFAULT_PROMPT = "[\\w#]+\\(\\w+\\):\\d+:\\d+>";
    +  var RVM_PROMPT = "(\\w+-)?\\d+\\.\\d+\\.\\d+(p\\d+)?[^\\d][^>]+>";
    +
    +  var IRB_DEFAULT = [
    +    {
    +      begin: /^\s*=>/,
    +      starts: {
    +        end: '$', contains: RUBY_DEFAULT_CONTAINS
    +      }
    +    },
    +    {
    +      className: 'meta',
    +      begin: '^('+SIMPLE_PROMPT+"|"+DEFAULT_PROMPT+'|'+RVM_PROMPT+')(?=[ ])',
    +      starts: {
    +        end: '$', contains: RUBY_DEFAULT_CONTAINS
    +      }
    +    }
    +  ];
    +
    +  COMMENT_MODES.unshift(IRB_OBJECT);
    +
    +  return {
    +    name: 'Ruby',
    +    aliases: ['rb', 'gemspec', 'podspec', 'thor', 'irb'],
    +    keywords: RUBY_KEYWORDS,
    +    illegal: /\/\*/,
    +    contains: [
    +        hljs.SHEBANG({binary:"ruby"}),
    +      ]
    +      .concat(IRB_DEFAULT)
    +      .concat(COMMENT_MODES)
    +      .concat(RUBY_DEFAULT_CONTAINS)
    +  };
    +}
    +
    +module.exports = ruby;
    diff --git a/node_modules/highlight.js/lib/languages/ruleslanguage.js b/node_modules/highlight.js/lib/languages/ruleslanguage.js
    new file mode 100644
    index 0000000..f9503ea
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/ruleslanguage.js
    @@ -0,0 +1,78 @@
    +/*
    +Language: Oracle Rules Language
    +Author: Jason Jacobson 
    +Description: The Oracle Utilities Rules Language is used to program the Oracle Utilities Applications acquired from LODESTAR Corporation.  The products include Billing Component, LPSS, Pricing Component etc. through version 1.6.1.
    +Website: https://docs.oracle.com/cd/E17904_01/dev.1111/e10227/rlref.htm
    +Category: enterprise
    +*/
    +
    +function ruleslanguage(hljs) {
    +  return {
    +    name: 'Oracle Rules Language',
    +    keywords: {
    +      keyword:
    +        'BILL_PERIOD BILL_START BILL_STOP RS_EFFECTIVE_START RS_EFFECTIVE_STOP RS_JURIS_CODE RS_OPCO_CODE ' +
    +        'INTDADDATTRIBUTE|5 INTDADDVMSG|5 INTDBLOCKOP|5 INTDBLOCKOPNA|5 INTDCLOSE|5 INTDCOUNT|5 ' +
    +        'INTDCOUNTSTATUSCODE|5 INTDCREATEMASK|5 INTDCREATEDAYMASK|5 INTDCREATEFACTORMASK|5 ' +
    +        'INTDCREATEHANDLE|5 INTDCREATEOVERRIDEDAYMASK|5 INTDCREATEOVERRIDEMASK|5 ' +
    +        'INTDCREATESTATUSCODEMASK|5 INTDCREATETOUPERIOD|5 INTDDELETE|5 INTDDIPTEST|5 INTDEXPORT|5 ' +
    +        'INTDGETERRORCODE|5 INTDGETERRORMESSAGE|5 INTDISEQUAL|5 INTDJOIN|5 INTDLOAD|5 INTDLOADACTUALCUT|5 ' +
    +        'INTDLOADDATES|5 INTDLOADHIST|5 INTDLOADLIST|5 INTDLOADLISTDATES|5 INTDLOADLISTENERGY|5 ' +
    +        'INTDLOADLISTHIST|5 INTDLOADRELATEDCHANNEL|5 INTDLOADSP|5 INTDLOADSTAGING|5 INTDLOADUOM|5 ' +
    +        'INTDLOADUOMDATES|5 INTDLOADUOMHIST|5 INTDLOADVERSION|5 INTDOPEN|5 INTDREADFIRST|5 INTDREADNEXT|5 ' +
    +        'INTDRECCOUNT|5 INTDRELEASE|5 INTDREPLACE|5 INTDROLLAVG|5 INTDROLLPEAK|5 INTDSCALAROP|5 INTDSCALE|5 ' +
    +        'INTDSETATTRIBUTE|5 INTDSETDSTPARTICIPANT|5 INTDSETSTRING|5 INTDSETVALUE|5 INTDSETVALUESTATUS|5 ' +
    +        'INTDSHIFTSTARTTIME|5 INTDSMOOTH|5 INTDSORT|5 INTDSPIKETEST|5 INTDSUBSET|5 INTDTOU|5 ' +
    +        'INTDTOURELEASE|5 INTDTOUVALUE|5 INTDUPDATESTATS|5 INTDVALUE|5 STDEV INTDDELETEEX|5 ' +
    +        'INTDLOADEXACTUAL|5 INTDLOADEXCUT|5 INTDLOADEXDATES|5 INTDLOADEX|5 INTDLOADEXRELATEDCHANNEL|5 ' +
    +        'INTDSAVEEX|5 MVLOAD|5 MVLOADACCT|5 MVLOADACCTDATES|5 MVLOADACCTHIST|5 MVLOADDATES|5 MVLOADHIST|5 ' +
    +        'MVLOADLIST|5 MVLOADLISTDATES|5 MVLOADLISTHIST|5 IF FOR NEXT DONE SELECT END CALL ABORT CLEAR CHANNEL FACTOR LIST NUMBER ' +
    +        'OVERRIDE SET WEEK DISTRIBUTIONNODE ELSE WHEN THEN OTHERWISE IENUM CSV INCLUDE LEAVE RIDER SAVE DELETE ' +
    +        'NOVALUE SECTION WARN SAVE_UPDATE DETERMINANT LABEL REPORT REVENUE EACH ' +
    +        'IN FROM TOTAL CHARGE BLOCK AND OR CSV_FILE RATE_CODE AUXILIARY_DEMAND ' +
    +        'UIDACCOUNT RS BILL_PERIOD_SELECT HOURS_PER_MONTH INTD_ERROR_STOP SEASON_SCHEDULE_NAME ' +
    +        'ACCOUNTFACTOR ARRAYUPPERBOUND CALLSTOREDPROC GETADOCONNECTION GETCONNECT GETDATASOURCE ' +
    +        'GETQUALIFIER GETUSERID HASVALUE LISTCOUNT LISTOP LISTUPDATE LISTVALUE PRORATEFACTOR RSPRORATE ' +
    +        'SETBINPATH SETDBMONITOR WQ_OPEN BILLINGHOURS DATE DATEFROMFLOAT DATETIMEFROMSTRING ' +
    +        'DATETIMETOSTRING DATETOFLOAT DAY DAYDIFF DAYNAME DBDATETIME HOUR MINUTE MONTH MONTHDIFF ' +
    +        'MONTHHOURS MONTHNAME ROUNDDATE SAMEWEEKDAYLASTYEAR SECOND WEEKDAY WEEKDIFF YEAR YEARDAY ' +
    +        'YEARSTR COMPSUM HISTCOUNT HISTMAX HISTMIN HISTMINNZ HISTVALUE MAXNRANGE MAXRANGE MINRANGE ' +
    +        'COMPIKVA COMPKVA COMPKVARFROMKQKW COMPLF IDATTR FLAG LF2KW LF2KWH MAXKW POWERFACTOR ' +
    +        'READING2USAGE AVGSEASON MAXSEASON MONTHLYMERGE SEASONVALUE SUMSEASON ACCTREADDATES ' +
    +        'ACCTTABLELOAD CONFIGADD CONFIGGET CREATEOBJECT CREATEREPORT EMAILCLIENT EXPBLKMDMUSAGE ' +
    +        'EXPMDMUSAGE EXPORT_USAGE FACTORINEFFECT GETUSERSPECIFIEDSTOP INEFFECT ISHOLIDAY RUNRATE ' +
    +        'SAVE_PROFILE SETREPORTTITLE USEREXIT WATFORRUNRATE TO TABLE ACOS ASIN ATAN ATAN2 BITAND CEIL ' +
    +        'COS COSECANT COSH COTANGENT DIVQUOT DIVREM EXP FABS FLOOR FMOD FREPM FREXPN LOG LOG10 MAX MAXN ' +
    +        'MIN MINNZ MODF POW ROUND ROUND2VALUE ROUNDINT SECANT SIN SINH SQROOT TAN TANH FLOAT2STRING ' +
    +        'FLOAT2STRINGNC INSTR LEFT LEN LTRIM MID RIGHT RTRIM STRING STRINGNC TOLOWER TOUPPER TRIM ' +
    +        'NUMDAYS READ_DATE STAGING',
    +      built_in:
    +        'IDENTIFIER OPTIONS XML_ELEMENT XML_OP XML_ELEMENT_OF DOMDOCCREATE DOMDOCLOADFILE DOMDOCLOADXML ' +
    +        'DOMDOCSAVEFILE DOMDOCGETROOT DOMDOCADDPI DOMNODEGETNAME DOMNODEGETTYPE DOMNODEGETVALUE DOMNODEGETCHILDCT ' +
    +        'DOMNODEGETFIRSTCHILD DOMNODEGETSIBLING DOMNODECREATECHILDELEMENT DOMNODESETATTRIBUTE ' +
    +        'DOMNODEGETCHILDELEMENTCT DOMNODEGETFIRSTCHILDELEMENT DOMNODEGETSIBLINGELEMENT DOMNODEGETATTRIBUTECT ' +
    +        'DOMNODEGETATTRIBUTEI DOMNODEGETATTRIBUTEBYNAME DOMNODEGETBYNAME'
    +    },
    +    contains: [
    +      hljs.C_LINE_COMMENT_MODE,
    +      hljs.C_BLOCK_COMMENT_MODE,
    +      hljs.APOS_STRING_MODE,
    +      hljs.QUOTE_STRING_MODE,
    +      hljs.C_NUMBER_MODE,
    +      {
    +        className: 'literal',
    +        variants: [
    +          { // looks like #-comment
    +            begin: '#\\s+',
    +            relevance: 0
    +          },
    +          {
    +            begin: '#[a-zA-Z .]+'
    +          }
    +        ]
    +      }
    +    ]
    +  };
    +}
    +
    +module.exports = ruleslanguage;
    diff --git a/node_modules/highlight.js/lib/languages/rust.js b/node_modules/highlight.js/lib/languages/rust.js
    new file mode 100644
    index 0000000..afb2c7e
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/rust.js
    @@ -0,0 +1,146 @@
    +/*
    +Language: Rust
    +Author: Andrey Vlasovskikh 
    +Contributors: Roman Shmatov , Kasper Andersen 
    +Website: https://www.rust-lang.org
    +Category: common, system
    +*/
    +
    +function rust(hljs) {
    +  const NUM_SUFFIX = '([ui](8|16|32|64|128|size)|f(32|64))\?';
    +  const KEYWORDS =
    +    'abstract as async await become box break const continue crate do dyn ' +
    +    'else enum extern false final fn for if impl in let loop macro match mod ' +
    +    'move mut override priv pub ref return self Self static struct super ' +
    +    'trait true try type typeof unsafe unsized use virtual where while yield';
    +  const BUILTINS =
    +    // functions
    +    'drop ' +
    +    // types
    +    'i8 i16 i32 i64 i128 isize ' +
    +    'u8 u16 u32 u64 u128 usize ' +
    +    'f32 f64 ' +
    +    'str char bool ' +
    +    'Box Option Result String Vec ' +
    +    // traits
    +    'Copy Send Sized Sync Drop Fn FnMut FnOnce ToOwned Clone Debug ' +
    +    'PartialEq PartialOrd Eq Ord AsRef AsMut Into From Default Iterator ' +
    +    'Extend IntoIterator DoubleEndedIterator ExactSizeIterator ' +
    +    'SliceConcatExt ToString ' +
    +    // macros
    +    'assert! assert_eq! bitflags! bytes! cfg! col! concat! concat_idents! ' +
    +    'debug_assert! debug_assert_eq! env! panic! file! format! format_args! ' +
    +    'include_bin! include_str! line! local_data_key! module_path! ' +
    +    'option_env! print! println! select! stringify! try! unimplemented! ' +
    +    'unreachable! vec! write! writeln! macro_rules! assert_ne! debug_assert_ne!';
    +  return {
    +    name: 'Rust',
    +    aliases: [ 'rs' ],
    +    keywords: {
    +      $pattern: hljs.IDENT_RE + '!?',
    +      keyword:
    +        KEYWORDS,
    +      literal:
    +        'true false Some None Ok Err',
    +      built_in:
    +        BUILTINS
    +    },
    +    illegal: ''
    +      }
    +    ]
    +  };
    +}
    +
    +module.exports = rust;
    diff --git a/node_modules/highlight.js/lib/languages/sas.js b/node_modules/highlight.js/lib/languages/sas.js
    new file mode 100644
    index 0000000..a65ddd2
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/sas.js
    @@ -0,0 +1,137 @@
    +/*
    +Language: SAS
    +Author: Mauricio Caceres 
    +Description: Syntax Highlighting for SAS
    +*/
    +
    +function sas(hljs) {
    +  // Data step and PROC SQL statements
    +  const SAS_KEYWORDS =
    +    'do if then else end until while ' +
    +    '' +
    +    'abort array attrib by call cards cards4 catname continue ' +
    +    'datalines datalines4 delete delim delimiter display dm drop ' +
    +    'endsas error file filename footnote format goto in infile ' +
    +    'informat input keep label leave length libname link list ' +
    +    'lostcard merge missing modify options output out page put ' +
    +    'redirect remove rename replace retain return select set skip ' +
    +    'startsas stop title update waitsas where window x systask ' +
    +    '' +
    +    'add and alter as cascade check create delete describe ' +
    +    'distinct drop foreign from group having index insert into in ' +
    +    'key like message modify msgtype not null on or order primary ' +
    +    'references reset restrict select set table unique update ' +
    +    'validate view where';
    +
    +  // Built-in SAS functions
    +  const SAS_FUN =
    +    'abs|addr|airy|arcos|arsin|atan|attrc|attrn|band|' +
    +    'betainv|blshift|bnot|bor|brshift|bxor|byte|cdf|ceil|' +
    +    'cexist|cinv|close|cnonct|collate|compbl|compound|' +
    +    'compress|cos|cosh|css|curobs|cv|daccdb|daccdbsl|' +
    +    'daccsl|daccsyd|dacctab|dairy|date|datejul|datepart|' +
    +    'datetime|day|dclose|depdb|depdbsl|depdbsl|depsl|' +
    +    'depsl|depsyd|depsyd|deptab|deptab|dequote|dhms|dif|' +
    +    'digamma|dim|dinfo|dnum|dopen|doptname|doptnum|dread|' +
    +    'dropnote|dsname|erf|erfc|exist|exp|fappend|fclose|' +
    +    'fcol|fdelete|fetch|fetchobs|fexist|fget|fileexist|' +
    +    'filename|fileref|finfo|finv|fipname|fipnamel|' +
    +    'fipstate|floor|fnonct|fnote|fopen|foptname|foptnum|' +
    +    'fpoint|fpos|fput|fread|frewind|frlen|fsep|fuzz|' +
    +    'fwrite|gaminv|gamma|getoption|getvarc|getvarn|hbound|' +
    +    'hms|hosthelp|hour|ibessel|index|indexc|indexw|input|' +
    +    'inputc|inputn|int|intck|intnx|intrr|irr|jbessel|' +
    +    'juldate|kurtosis|lag|lbound|left|length|lgamma|' +
    +    'libname|libref|log|log10|log2|logpdf|logpmf|logsdf|' +
    +    'lowcase|max|mdy|mean|min|minute|mod|month|mopen|' +
    +    'mort|n|netpv|nmiss|normal|note|npv|open|ordinal|' +
    +    'pathname|pdf|peek|peekc|pmf|point|poisson|poke|' +
    +    'probbeta|probbnml|probchi|probf|probgam|probhypr|' +
    +    'probit|probnegb|probnorm|probt|put|putc|putn|qtr|' +
    +    'quote|ranbin|rancau|ranexp|rangam|range|rank|rannor|' +
    +    'ranpoi|rantbl|rantri|ranuni|repeat|resolve|reverse|' +
    +    'rewind|right|round|saving|scan|sdf|second|sign|' +
    +    'sin|sinh|skewness|soundex|spedis|sqrt|std|stderr|' +
    +    'stfips|stname|stnamel|substr|sum|symget|sysget|' +
    +    'sysmsg|sysprod|sysrc|system|tan|tanh|time|timepart|' +
    +    'tinv|tnonct|today|translate|tranwrd|trigamma|' +
    +    'trim|trimn|trunc|uniform|upcase|uss|var|varfmt|' +
    +    'varinfmt|varlabel|varlen|varname|varnum|varray|' +
    +    'varrayx|vartype|verify|vformat|vformatd|vformatdx|' +
    +    'vformatn|vformatnx|vformatw|vformatwx|vformatx|' +
    +    'vinarray|vinarrayx|vinformat|vinformatd|vinformatdx|' +
    +    'vinformatn|vinformatnx|vinformatw|vinformatwx|' +
    +    'vinformatx|vlabel|vlabelx|vlength|vlengthx|vname|' +
    +    'vnamex|vtype|vtypex|weekday|year|yyq|zipfips|zipname|' +
    +    'zipnamel|zipstate';
    +
    +  // Built-in macro functions
    +  const SAS_MACRO_FUN =
    +    'bquote|nrbquote|cmpres|qcmpres|compstor|' +
    +    'datatyp|display|do|else|end|eval|global|goto|' +
    +    'if|index|input|keydef|label|left|length|let|' +
    +    'local|lowcase|macro|mend|nrbquote|nrquote|' +
    +    'nrstr|put|qcmpres|qleft|qlowcase|qscan|' +
    +    'qsubstr|qsysfunc|qtrim|quote|qupcase|scan|str|' +
    +    'substr|superq|syscall|sysevalf|sysexec|sysfunc|' +
    +    'sysget|syslput|sysprod|sysrc|sysrput|then|to|' +
    +    'trim|unquote|until|upcase|verify|while|window';
    +
    +  return {
    +    name: 'SAS',
    +    aliases: [
    +      'sas',
    +      'SAS'
    +    ],
    +    case_insensitive: true, // SAS is case-insensitive
    +    keywords: {
    +      literal:
    +        'null missing _all_ _automatic_ _character_ _infile_ ' +
    +        '_n_ _name_ _null_ _numeric_ _user_ _webout_',
    +      meta:
    +        SAS_KEYWORDS
    +    },
    +    contains: [
    +      {
    +        // Distinct highlight for proc , data, run, quit
    +        className: 'keyword',
    +        begin: /^\s*(proc [\w\d_]+|data|run|quit)[\s;]/
    +      },
    +      {
    +        // Macro variables
    +        className: 'variable',
    +        begin: /&[a-zA-Z_&][a-zA-Z0-9_]*\.?/
    +      },
    +      {
    +        // Special emphasis for datalines|cards
    +        className: 'emphasis',
    +        begin: /^\s*datalines|cards.*;/,
    +        end: /^\s*;\s*$/
    +      },
    +      { // Built-in macro variables take precedence
    +        className: 'built_in',
    +        begin: '%(' + SAS_MACRO_FUN + ')'
    +      },
    +      {
    +        // User-defined macro functions highlighted after
    +        className: 'name',
    +        begin: /%[a-zA-Z_][a-zA-Z_0-9]*/
    +      },
    +      {
    +        className: 'meta',
    +        begin: '[^%](' + SAS_FUN + ')[\(]'
    +      },
    +      {
    +        className: 'string',
    +        variants: [
    +          hljs.APOS_STRING_MODE,
    +          hljs.QUOTE_STRING_MODE
    +        ]
    +      },
    +      hljs.COMMENT('\\*', ';'),
    +      hljs.C_BLOCK_COMMENT_MODE
    +    ]
    +  };
    +}
    +
    +module.exports = sas;
    diff --git a/node_modules/highlight.js/lib/languages/scala.js b/node_modules/highlight.js/lib/languages/scala.js
    new file mode 100644
    index 0000000..c590932
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/scala.js
    @@ -0,0 +1,139 @@
    +/*
    +Language: Scala
    +Category: functional
    +Author: Jan Berkel 
    +Contributors: Erik Osheim 
    +Website: https://www.scala-lang.org
    +*/
    +
    +function scala(hljs) {
    +  const ANNOTATION = {
    +    className: 'meta',
    +    begin: '@[A-Za-z]+'
    +  };
    +
    +  // used in strings for escaping/interpolation/substitution
    +  const SUBST = {
    +    className: 'subst',
    +    variants: [
    +      {
    +        begin: '\\$[A-Za-z0-9_]+'
    +      },
    +      {
    +        begin: /\$\{/,
    +        end: /\}/
    +      }
    +    ]
    +  };
    +
    +  const STRING = {
    +    className: 'string',
    +    variants: [
    +      {
    +        begin: '"',
    +        end: '"',
    +        illegal: '\\n',
    +        contains: [ hljs.BACKSLASH_ESCAPE ]
    +      },
    +      {
    +        begin: '"""',
    +        end: '"""',
    +        relevance: 10
    +      },
    +      {
    +        begin: '[a-z]+"',
    +        end: '"',
    +        illegal: '\\n',
    +        contains: [ hljs.BACKSLASH_ESCAPE,
    +          SUBST ]
    +      },
    +      {
    +        className: 'string',
    +        begin: '[a-z]+"""',
    +        end: '"""',
    +        contains: [ SUBST ],
    +        relevance: 10
    +      }
    +    ]
    +
    +  };
    +
    +  const SYMBOL = {
    +    className: 'symbol',
    +    begin: '\'\\w[\\w\\d_]*(?!\')'
    +  };
    +
    +  const TYPE = {
    +    className: 'type',
    +    begin: '\\b[A-Z][A-Za-z0-9_]*',
    +    relevance: 0
    +  };
    +
    +  const NAME = {
    +    className: 'title',
    +    begin: /[^0-9\n\t "'(),.`{}\[\]:;][^\n\t "'(),.`{}\[\]:;]+|[^0-9\n\t "'(),.`{}\[\]:;=]/,
    +    relevance: 0
    +  };
    +
    +  const CLASS = {
    +    className: 'class',
    +    beginKeywords: 'class object trait type',
    +    end: /[:={\[\n;]/,
    +    excludeEnd: true,
    +    contains: [
    +      hljs.C_LINE_COMMENT_MODE,
    +      hljs.C_BLOCK_COMMENT_MODE,
    +      {
    +        beginKeywords: 'extends with',
    +        relevance: 10
    +      },
    +      {
    +        begin: /\[/,
    +        end: /\]/,
    +        excludeBegin: true,
    +        excludeEnd: true,
    +        relevance: 0,
    +        contains: [ TYPE ]
    +      },
    +      {
    +        className: 'params',
    +        begin: /\(/,
    +        end: /\)/,
    +        excludeBegin: true,
    +        excludeEnd: true,
    +        relevance: 0,
    +        contains: [ TYPE ]
    +      },
    +      NAME
    +    ]
    +  };
    +
    +  const METHOD = {
    +    className: 'function',
    +    beginKeywords: 'def',
    +    end: /[:={\[(\n;]/,
    +    excludeEnd: true,
    +    contains: [ NAME ]
    +  };
    +
    +  return {
    +    name: 'Scala',
    +    keywords: {
    +      literal: 'true false null',
    +      keyword: 'type yield lazy override def with val var sealed abstract private trait object if forSome for while throw finally protected extends import final return else break new catch super class case package default try this match continue throws implicit'
    +    },
    +    contains: [
    +      hljs.C_LINE_COMMENT_MODE,
    +      hljs.C_BLOCK_COMMENT_MODE,
    +      STRING,
    +      SYMBOL,
    +      TYPE,
    +      METHOD,
    +      CLASS,
    +      hljs.C_NUMBER_MODE,
    +      ANNOTATION
    +    ]
    +  };
    +}
    +
    +module.exports = scala;
    diff --git a/node_modules/highlight.js/lib/languages/scheme.js b/node_modules/highlight.js/lib/languages/scheme.js
    new file mode 100644
    index 0000000..88a2699
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/scheme.js
    @@ -0,0 +1,146 @@
    +/*
    +Language: Scheme
    +Description: Scheme is a programming language in the Lisp family.
    +             (keywords based on http://community.schemewiki.org/?scheme-keywords)
    +Author: JP Verkamp 
    +Contributors: Ivan Sagalaev 
    +Origin: clojure.js
    +Website: http://community.schemewiki.org/?what-is-scheme
    +Category: lisp
    +*/
    +
    +function scheme(hljs) {
    +  var SCHEME_IDENT_RE = '[^\\(\\)\\[\\]\\{\\}",\'`;#|\\\\\\s]+';
    +  var SCHEME_SIMPLE_NUMBER_RE = '(-|\\+)?\\d+([./]\\d+)?';
    +  var SCHEME_COMPLEX_NUMBER_RE = SCHEME_SIMPLE_NUMBER_RE + '[+\\-]' + SCHEME_SIMPLE_NUMBER_RE + 'i';
    +  var KEYWORDS = {
    +    $pattern: SCHEME_IDENT_RE,
    +    'builtin-name':
    +      'case-lambda call/cc class define-class exit-handler field import ' +
    +      'inherit init-field interface let*-values let-values let/ec mixin ' +
    +      'opt-lambda override protect provide public rename require ' +
    +      'require-for-syntax syntax syntax-case syntax-error unit/sig unless ' +
    +      'when with-syntax and begin call-with-current-continuation ' +
    +      'call-with-input-file call-with-output-file case cond define ' +
    +      'define-syntax delay do dynamic-wind else for-each if lambda let let* ' +
    +      'let-syntax letrec letrec-syntax map or syntax-rules \' * + , ,@ - ... / ' +
    +      '; < <= = => > >= ` abs acos angle append apply asin assoc assq assv atan ' +
    +      'boolean? caar cadr call-with-input-file call-with-output-file ' +
    +      'call-with-values car cdddar cddddr cdr ceiling char->integer ' +
    +      'char-alphabetic? char-ci<=? char-ci=? char-ci>? ' +
    +      'char-downcase char-lower-case? char-numeric? char-ready? char-upcase ' +
    +      'char-upper-case? char-whitespace? char<=? char=? char>? ' +
    +      'char? close-input-port close-output-port complex? cons cos ' +
    +      'current-input-port current-output-port denominator display eof-object? ' +
    +      'eq? equal? eqv? eval even? exact->inexact exact? exp expt floor ' +
    +      'force gcd imag-part inexact->exact inexact? input-port? integer->char ' +
    +      'integer? interaction-environment lcm length list list->string ' +
    +      'list->vector list-ref list-tail list? load log magnitude make-polar ' +
    +      'make-rectangular make-string make-vector max member memq memv min ' +
    +      'modulo negative? newline not null-environment null? number->string ' +
    +      'number? numerator odd? open-input-file open-output-file output-port? ' +
    +      'pair? peek-char port? positive? procedure? quasiquote quote quotient ' +
    +      'rational? rationalize read read-char real-part real? remainder reverse ' +
    +      'round scheme-report-environment set! set-car! set-cdr! sin sqrt string ' +
    +      'string->list string->number string->symbol string-append string-ci<=? ' +
    +      'string-ci=? string-ci>? string-copy ' +
    +      'string-fill! string-length string-ref string-set! string<=? string=? string>? string? substring symbol->string symbol? ' +
    +      'tan transcript-off transcript-on truncate values vector ' +
    +      'vector->list vector-fill! vector-length vector-ref vector-set! ' +
    +      'with-input-from-file with-output-to-file write write-char zero?'
    +  };
    +
    +  var LITERAL = {
    +    className: 'literal',
    +    begin: '(#t|#f|#\\\\' + SCHEME_IDENT_RE + '|#\\\\.)'
    +  };
    +
    +  var NUMBER = {
    +    className: 'number',
    +    variants: [
    +      { begin: SCHEME_SIMPLE_NUMBER_RE, relevance: 0 },
    +      { begin: SCHEME_COMPLEX_NUMBER_RE, relevance: 0 },
    +      { begin: '#b[0-1]+(/[0-1]+)?' },
    +      { begin: '#o[0-7]+(/[0-7]+)?' },
    +      { begin: '#x[0-9a-f]+(/[0-9a-f]+)?' }
    +    ]
    +  };
    +
    +  var STRING = hljs.QUOTE_STRING_MODE;
    +
    +  var COMMENT_MODES = [
    +    hljs.COMMENT(
    +      ';',
    +      '$',
    +      {
    +        relevance: 0
    +      }
    +    ),
    +    hljs.COMMENT('#\\|', '\\|#')
    +  ];
    +
    +  var IDENT = {
    +    begin: SCHEME_IDENT_RE,
    +    relevance: 0
    +  };
    +
    +  var QUOTED_IDENT = {
    +    className: 'symbol',
    +    begin: '\'' + SCHEME_IDENT_RE
    +  };
    +
    +  var BODY = {
    +    endsWithParent: true,
    +    relevance: 0
    +  };
    +
    +  var QUOTED_LIST = {
    +    variants: [
    +      { begin: /'/ },
    +      { begin: '`' }
    +    ],
    +    contains: [
    +      {
    +        begin: '\\(', end: '\\)',
    +        contains: ['self', LITERAL, STRING, NUMBER, IDENT, QUOTED_IDENT]
    +      }
    +    ]
    +  };
    +
    +  var NAME = {
    +    className: 'name',
    +    relevance: 0,
    +    begin: SCHEME_IDENT_RE,
    +    keywords: KEYWORDS
    +  };
    +
    +  var LAMBDA = {
    +    begin: /lambda/, endsWithParent: true, returnBegin: true,
    +    contains: [
    +      NAME,
    +      {
    +        begin: /\(/, end: /\)/, endsParent: true,
    +        contains: [IDENT],
    +      }
    +    ]
    +  };
    +
    +  var LIST = {
    +    variants: [
    +      { begin: '\\(', end: '\\)' },
    +      { begin: '\\[', end: '\\]' }
    +    ],
    +    contains: [LAMBDA, NAME, BODY]
    +  };
    +
    +  BODY.contains = [LITERAL, NUMBER, STRING, IDENT, QUOTED_IDENT, QUOTED_LIST, LIST].concat(COMMENT_MODES);
    +
    +  return {
    +    name: 'Scheme',
    +    illegal: /\S/,
    +    contains: [hljs.SHEBANG(), NUMBER, STRING, QUOTED_IDENT, QUOTED_LIST, LIST].concat(COMMENT_MODES)
    +  };
    +}
    +
    +module.exports = scheme;
    diff --git a/node_modules/highlight.js/lib/languages/scilab.js b/node_modules/highlight.js/lib/languages/scilab.js
    new file mode 100644
    index 0000000..f964410
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/scilab.js
    @@ -0,0 +1,73 @@
    +/*
    +Language: Scilab
    +Author: Sylvestre Ledru 
    +Origin: matlab.js
    +Description: Scilab is a port from Matlab
    +Website: https://www.scilab.org
    +Category: scientific
    +*/
    +
    +function scilab(hljs) {
    +  const COMMON_CONTAINS = [
    +    hljs.C_NUMBER_MODE,
    +    {
    +      className: 'string',
    +      begin: '\'|\"',
    +      end: '\'|\"',
    +      contains: [ hljs.BACKSLASH_ESCAPE,
    +        {
    +          begin: '\'\''
    +        } ]
    +    }
    +  ];
    +
    +  return {
    +    name: 'Scilab',
    +    aliases: [ 'sci' ],
    +    keywords: {
    +      $pattern: /%?\w+/,
    +      keyword: 'abort break case clear catch continue do elseif else endfunction end for function ' +
    +        'global if pause return resume select try then while',
    +      literal:
    +        '%f %F %t %T %pi %eps %inf %nan %e %i %z %s',
    +      built_in: // Scilab has more than 2000 functions. Just list the most commons
    +       'abs and acos asin atan ceil cd chdir clearglobal cosh cos cumprod deff disp error ' +
    +       'exec execstr exists exp eye gettext floor fprintf fread fsolve imag isdef isempty ' +
    +       'isinfisnan isvector lasterror length load linspace list listfiles log10 log2 log ' +
    +       'max min msprintf mclose mopen ones or pathconvert poly printf prod pwd rand real ' +
    +       'round sinh sin size gsort sprintf sqrt strcat strcmps tring sum system tanh tan ' +
    +       'type typename warning zeros matrix'
    +    },
    +    illegal: '("|#|/\\*|\\s+/\\w+)',
    +    contains: [
    +      {
    +        className: 'function',
    +        beginKeywords: 'function',
    +        end: '$',
    +        contains: [
    +          hljs.UNDERSCORE_TITLE_MODE,
    +          {
    +            className: 'params',
    +            begin: '\\(',
    +            end: '\\)'
    +          }
    +        ]
    +      },
    +      // seems to be a guard against [ident]' or [ident].
    +      // perhaps to prevent attributes from flagging as keywords?
    +      {
    +        begin: '[a-zA-Z_][a-zA-Z_0-9]*[\\.\']+',
    +        relevance: 0
    +      },
    +      {
    +        begin: '\\[',
    +        end: '\\][\\.\']*',
    +        relevance: 0,
    +        contains: COMMON_CONTAINS
    +      },
    +      hljs.COMMENT('//', '$')
    +    ].concat(COMMON_CONTAINS)
    +  };
    +}
    +
    +module.exports = scilab;
    diff --git a/node_modules/highlight.js/lib/languages/scss.js b/node_modules/highlight.js/lib/languages/scss.js
    new file mode 100644
    index 0000000..0cc87c2
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/scss.js
    @@ -0,0 +1,124 @@
    +/*
    +Language: SCSS
    +Description: Scss is an extension of the syntax of CSS.
    +Author: Kurt Emch 
    +Website: https://sass-lang.com
    +Category: common, css
    +*/
    +function scss(hljs) {
    +  var AT_IDENTIFIER = '@[a-z-]+'; // @font-face
    +  var AT_MODIFIERS = "and or not only";
    +  var IDENT_RE = '[a-zA-Z-][a-zA-Z0-9_-]*';
    +  var VARIABLE = {
    +    className: 'variable',
    +    begin: '(\\$' + IDENT_RE + ')\\b'
    +  };
    +  var HEXCOLOR = {
    +    className: 'number', begin: '#[0-9A-Fa-f]+'
    +  };
    +  var DEF_INTERNALS = {
    +    className: 'attribute',
    +    begin: '[A-Z\\_\\.\\-]+', end: ':',
    +    excludeEnd: true,
    +    illegal: '[^\\s]',
    +    starts: {
    +      endsWithParent: true, excludeEnd: true,
    +      contains: [
    +        HEXCOLOR,
    +        hljs.CSS_NUMBER_MODE,
    +        hljs.QUOTE_STRING_MODE,
    +        hljs.APOS_STRING_MODE,
    +        hljs.C_BLOCK_COMMENT_MODE,
    +        {
    +          className: 'meta', begin: '!important'
    +        }
    +      ]
    +    }
    +  };
    +  return {
    +    name: 'SCSS',
    +    case_insensitive: true,
    +    illegal: '[=/|\']',
    +    contains: [
    +      hljs.C_LINE_COMMENT_MODE,
    +      hljs.C_BLOCK_COMMENT_MODE,
    +      {
    +        className: 'selector-id', begin: '#[A-Za-z0-9_-]+',
    +        relevance: 0
    +      },
    +      {
    +        className: 'selector-class', begin: '\\.[A-Za-z0-9_-]+',
    +        relevance: 0
    +      },
    +      {
    +        className: 'selector-attr', begin: '\\[', end: '\\]',
    +        illegal: '$'
    +      },
    +      {
    +        className: 'selector-tag', // begin: IDENT_RE, end: '[,|\\s]'
    +        begin: '\\b(a|abbr|acronym|address|area|article|aside|audio|b|base|big|blockquote|body|br|button|canvas|caption|cite|code|col|colgroup|command|datalist|dd|del|details|dfn|div|dl|dt|em|embed|fieldset|figcaption|figure|footer|form|frame|frameset|(h[1-6])|head|header|hgroup|hr|html|i|iframe|img|input|ins|kbd|keygen|label|legend|li|link|map|mark|meta|meter|nav|noframes|noscript|object|ol|optgroup|option|output|p|param|pre|progress|q|rp|rt|ruby|samp|script|section|select|small|span|strike|strong|style|sub|sup|table|tbody|td|textarea|tfoot|th|thead|time|title|tr|tt|ul|var|video)\\b',
    +        relevance: 0
    +      },
    +      {
    +        className: 'selector-pseudo',
    +        begin: ':(visited|valid|root|right|required|read-write|read-only|out-range|optional|only-of-type|only-child|nth-of-type|nth-last-of-type|nth-last-child|nth-child|not|link|left|last-of-type|last-child|lang|invalid|indeterminate|in-range|hover|focus|first-of-type|first-line|first-letter|first-child|first|enabled|empty|disabled|default|checked|before|after|active)'
    +      },
    +      {
    +        className: 'selector-pseudo',
    +        begin: '::(after|before|choices|first-letter|first-line|repeat-index|repeat-item|selection|value)'
    +      },
    +      VARIABLE,
    +      {
    +        className: 'attribute',
    +        begin: '\\b(src|z-index|word-wrap|word-spacing|word-break|width|widows|white-space|visibility|vertical-align|unicode-bidi|transition-timing-function|transition-property|transition-duration|transition-delay|transition|transform-style|transform-origin|transform|top|text-underline-position|text-transform|text-shadow|text-rendering|text-overflow|text-indent|text-decoration-style|text-decoration-line|text-decoration-color|text-decoration|text-align-last|text-align|tab-size|table-layout|right|resize|quotes|position|pointer-events|perspective-origin|perspective|page-break-inside|page-break-before|page-break-after|padding-top|padding-right|padding-left|padding-bottom|padding|overflow-y|overflow-x|overflow-wrap|overflow|outline-width|outline-style|outline-offset|outline-color|outline|orphans|order|opacity|object-position|object-fit|normal|none|nav-up|nav-right|nav-left|nav-index|nav-down|min-width|min-height|max-width|max-height|mask|marks|margin-top|margin-right|margin-left|margin-bottom|margin|list-style-type|list-style-position|list-style-image|list-style|line-height|letter-spacing|left|justify-content|initial|inherit|ime-mode|image-orientation|image-resolution|image-rendering|icon|hyphens|height|font-weight|font-variant-ligatures|font-variant|font-style|font-stretch|font-size-adjust|font-size|font-language-override|font-kerning|font-feature-settings|font-family|font|float|flex-wrap|flex-shrink|flex-grow|flex-flow|flex-direction|flex-basis|flex|filter|empty-cells|display|direction|cursor|counter-reset|counter-increment|content|column-width|column-span|column-rule-width|column-rule-style|column-rule-color|column-rule|column-gap|column-fill|column-count|columns|color|clip-path|clip|clear|caption-side|break-inside|break-before|break-after|box-sizing|box-shadow|box-decoration-break|bottom|border-width|border-top-width|border-top-style|border-top-right-radius|border-top-left-radius|border-top-color|border-top|border-style|border-spacing|border-right-width|border-right-style|border-right-color|border-right|border-radius|border-left-width|border-left-style|border-left-color|border-left|border-image-width|border-image-source|border-image-slice|border-image-repeat|border-image-outset|border-image|border-color|border-collapse|border-bottom-width|border-bottom-style|border-bottom-right-radius|border-bottom-left-radius|border-bottom-color|border-bottom|border|background-size|background-repeat|background-position|background-origin|background-image|background-color|background-clip|background-attachment|background-blend-mode|background|backface-visibility|auto|animation-timing-function|animation-play-state|animation-name|animation-iteration-count|animation-fill-mode|animation-duration|animation-direction|animation-delay|animation|align-self|align-items|align-content)\\b',
    +        illegal: '[^\\s]'
    +      },
    +      {
    +        begin: '\\b(whitespace|wait|w-resize|visible|vertical-text|vertical-ideographic|uppercase|upper-roman|upper-alpha|underline|transparent|top|thin|thick|text|text-top|text-bottom|tb-rl|table-header-group|table-footer-group|sw-resize|super|strict|static|square|solid|small-caps|separate|se-resize|scroll|s-resize|rtl|row-resize|ridge|right|repeat|repeat-y|repeat-x|relative|progress|pointer|overline|outside|outset|oblique|nowrap|not-allowed|normal|none|nw-resize|no-repeat|no-drop|newspaper|ne-resize|n-resize|move|middle|medium|ltr|lr-tb|lowercase|lower-roman|lower-alpha|loose|list-item|line|line-through|line-edge|lighter|left|keep-all|justify|italic|inter-word|inter-ideograph|inside|inset|inline|inline-block|inherit|inactive|ideograph-space|ideograph-parenthesis|ideograph-numeric|ideograph-alpha|horizontal|hidden|help|hand|groove|fixed|ellipsis|e-resize|double|dotted|distribute|distribute-space|distribute-letter|distribute-all-lines|disc|disabled|default|decimal|dashed|crosshair|collapse|col-resize|circle|char|center|capitalize|break-word|break-all|bottom|both|bolder|bold|block|bidi-override|below|baseline|auto|always|all-scroll|absolute|table|table-cell)\\b'
    +      },
    +      {
    +        begin: ':', end: ';',
    +        contains: [
    +          VARIABLE,
    +          HEXCOLOR,
    +          hljs.CSS_NUMBER_MODE,
    +          hljs.QUOTE_STRING_MODE,
    +          hljs.APOS_STRING_MODE,
    +          {
    +            className: 'meta', begin: '!important'
    +          }
    +        ]
    +      },
    +      // matching these here allows us to treat them more like regular CSS
    +      // rules so everything between the {} gets regular rule highlighting,
    +      // which is what we want for page and font-face
    +      {
    +        begin: '@(page|font-face)',
    +        lexemes: AT_IDENTIFIER,
    +        keywords: '@page @font-face'
    +      },
    +      {
    +        begin: '@', end: '[{;]',
    +        returnBegin: true,
    +        keywords: AT_MODIFIERS,
    +        contains: [
    +          {
    +            begin: AT_IDENTIFIER,
    +            className: "keyword"
    +          },
    +          VARIABLE,
    +          hljs.QUOTE_STRING_MODE,
    +          hljs.APOS_STRING_MODE,
    +          HEXCOLOR,
    +          hljs.CSS_NUMBER_MODE,
    +          // {
    +          //   begin: '\\s[A-Za-z0-9_.-]+',
    +          //   relevance: 0
    +          // }
    +        ]
    +      }
    +    ]
    +  };
    +}
    +
    +module.exports = scss;
    diff --git a/node_modules/highlight.js/lib/languages/shell.js b/node_modules/highlight.js/lib/languages/shell.js
    new file mode 100644
    index 0000000..bb2c8f7
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/shell.js
    @@ -0,0 +1,30 @@
    +/*
    +Language: Shell Session
    +Requires: bash.js
    +Author: TSUYUSATO Kitsune 
    +Category: common
    +Audit: 2020
    +*/
    +
    +/** @type LanguageFn */
    +function shell(hljs) {
    +  return {
    +    name: 'Shell Session',
    +    aliases: [ 'console' ],
    +    contains: [
    +      {
    +        className: 'meta',
    +        // We cannot add \s (spaces) in the regular expression otherwise it will be too broad and produce unexpected result.
    +        // For instance, in the following example, it would match "echo /path/to/home >" as a prompt:
    +        // echo /path/to/home > t.exe
    +        begin: /^\s{0,3}[/~\w\d[\]()@-]*[>%$#]/,
    +        starts: {
    +          end: /[^\\](?=\s*$)/,
    +          subLanguage: 'bash'
    +        }
    +      }
    +    ]
    +  };
    +}
    +
    +module.exports = shell;
    diff --git a/node_modules/highlight.js/lib/languages/smali.js b/node_modules/highlight.js/lib/languages/smali.js
    new file mode 100644
    index 0000000..9a9eecd
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/smali.js
    @@ -0,0 +1,136 @@
    +/*
    +Language: Smali
    +Author: Dennis Titze 
    +Description: Basic Smali highlighting
    +Website: https://github.com/JesusFreke/smali
    +*/
    +
    +function smali(hljs) {
    +  const smali_instr_low_prio = [
    +    'add',
    +    'and',
    +    'cmp',
    +    'cmpg',
    +    'cmpl',
    +    'const',
    +    'div',
    +    'double',
    +    'float',
    +    'goto',
    +    'if',
    +    'int',
    +    'long',
    +    'move',
    +    'mul',
    +    'neg',
    +    'new',
    +    'nop',
    +    'not',
    +    'or',
    +    'rem',
    +    'return',
    +    'shl',
    +    'shr',
    +    'sput',
    +    'sub',
    +    'throw',
    +    'ushr',
    +    'xor'
    +  ];
    +  const smali_instr_high_prio = [
    +    'aget',
    +    'aput',
    +    'array',
    +    'check',
    +    'execute',
    +    'fill',
    +    'filled',
    +    'goto/16',
    +    'goto/32',
    +    'iget',
    +    'instance',
    +    'invoke',
    +    'iput',
    +    'monitor',
    +    'packed',
    +    'sget',
    +    'sparse'
    +  ];
    +  const smali_keywords = [
    +    'transient',
    +    'constructor',
    +    'abstract',
    +    'final',
    +    'synthetic',
    +    'public',
    +    'private',
    +    'protected',
    +    'static',
    +    'bridge',
    +    'system'
    +  ];
    +  return {
    +    name: 'Smali',
    +    aliases: [ 'smali' ],
    +    contains: [
    +      {
    +        className: 'string',
    +        begin: '"',
    +        end: '"',
    +        relevance: 0
    +      },
    +      hljs.COMMENT(
    +        '#',
    +        '$',
    +        {
    +          relevance: 0
    +        }
    +      ),
    +      {
    +        className: 'keyword',
    +        variants: [
    +          {
    +            begin: '\\s*\\.end\\s[a-zA-Z0-9]*'
    +          },
    +          {
    +            begin: '^[ ]*\\.[a-zA-Z]*',
    +            relevance: 0
    +          },
    +          {
    +            begin: '\\s:[a-zA-Z_0-9]*',
    +            relevance: 0
    +          },
    +          {
    +            begin: '\\s(' + smali_keywords.join('|') + ')'
    +          }
    +        ]
    +      },
    +      {
    +        className: 'built_in',
    +        variants: [
    +          {
    +            begin: '\\s(' + smali_instr_low_prio.join('|') + ')\\s'
    +          },
    +          {
    +            begin: '\\s(' + smali_instr_low_prio.join('|') + ')((-|/)[a-zA-Z0-9]+)+\\s',
    +            relevance: 10
    +          },
    +          {
    +            begin: '\\s(' + smali_instr_high_prio.join('|') + ')((-|/)[a-zA-Z0-9]+)*\\s',
    +            relevance: 10
    +          }
    +        ]
    +      },
    +      {
    +        className: 'class',
    +        begin: 'L[^\(;:\n]*;',
    +        relevance: 0
    +      },
    +      {
    +        begin: '[vp][0-9]+'
    +      }
    +    ]
    +  };
    +}
    +
    +module.exports = smali;
    diff --git a/node_modules/highlight.js/lib/languages/smalltalk.js b/node_modules/highlight.js/lib/languages/smalltalk.js
    new file mode 100644
    index 0000000..c1d0215
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/smalltalk.js
    @@ -0,0 +1,63 @@
    +/*
    +Language: Smalltalk
    +Description: Smalltalk is an object-oriented, dynamically typed reflective programming language.
    +Author: Vladimir Gubarkov 
    +Website: https://en.wikipedia.org/wiki/Smalltalk
    +*/
    +
    +function smalltalk(hljs) {
    +  const VAR_IDENT_RE = '[a-z][a-zA-Z0-9_]*';
    +  const CHAR = {
    +    className: 'string',
    +    begin: '\\$.{1}'
    +  };
    +  const SYMBOL = {
    +    className: 'symbol',
    +    begin: '#' + hljs.UNDERSCORE_IDENT_RE
    +  };
    +  return {
    +    name: 'Smalltalk',
    +    aliases: [ 'st' ],
    +    keywords: 'self super nil true false thisContext', // only 6
    +    contains: [
    +      hljs.COMMENT('"', '"'),
    +      hljs.APOS_STRING_MODE,
    +      {
    +        className: 'type',
    +        begin: '\\b[A-Z][A-Za-z0-9_]*',
    +        relevance: 0
    +      },
    +      {
    +        begin: VAR_IDENT_RE + ':',
    +        relevance: 0
    +      },
    +      hljs.C_NUMBER_MODE,
    +      SYMBOL,
    +      CHAR,
    +      {
    +        // This looks more complicated than needed to avoid combinatorial
    +        // explosion under V8. It effectively means `| var1 var2 ... |` with
    +        // whitespace adjacent to `|` being optional.
    +        begin: '\\|[ ]*' + VAR_IDENT_RE + '([ ]+' + VAR_IDENT_RE + ')*[ ]*\\|',
    +        returnBegin: true,
    +        end: /\|/,
    +        illegal: /\S/,
    +        contains: [ {
    +          begin: '(\\|[ ]*)?' + VAR_IDENT_RE
    +        } ]
    +      },
    +      {
    +        begin: '#\\(',
    +        end: '\\)',
    +        contains: [
    +          hljs.APOS_STRING_MODE,
    +          CHAR,
    +          hljs.C_NUMBER_MODE,
    +          SYMBOL
    +        ]
    +      }
    +    ]
    +  };
    +}
    +
    +module.exports = smalltalk;
    diff --git a/node_modules/highlight.js/lib/languages/sml.js b/node_modules/highlight.js/lib/languages/sml.js
    new file mode 100644
    index 0000000..16b4cc1
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/sml.js
    @@ -0,0 +1,81 @@
    +/*
    +Language: SML (Standard ML)
    +Author: Edwin Dalorzo 
    +Description: SML language definition.
    +Website: https://www.smlnj.org
    +Origin: ocaml.js
    +Category: functional
    +*/
    +function sml(hljs) {
    +  return {
    +    name: 'SML (Standard ML)',
    +    aliases: [ 'ml' ],
    +    keywords: {
    +      $pattern: '[a-z_]\\w*!?',
    +      keyword:
    +        /* according to Definition of Standard ML 97  */
    +        'abstype and andalso as case datatype do else end eqtype ' +
    +        'exception fn fun functor handle if in include infix infixr ' +
    +        'let local nonfix of op open orelse raise rec sharing sig ' +
    +        'signature struct structure then type val with withtype where while',
    +      built_in:
    +        /* built-in types according to basis library */
    +        'array bool char exn int list option order real ref string substring vector unit word',
    +      literal:
    +        'true false NONE SOME LESS EQUAL GREATER nil'
    +    },
    +    illegal: /\/\/|>>/,
    +    contains: [
    +      {
    +        className: 'literal',
    +        begin: /\[(\|\|)?\]|\(\)/,
    +        relevance: 0
    +      },
    +      hljs.COMMENT(
    +        '\\(\\*',
    +        '\\*\\)',
    +        {
    +          contains: [ 'self' ]
    +        }
    +      ),
    +      { /* type variable */
    +        className: 'symbol',
    +        begin: '\'[A-Za-z_](?!\')[\\w\']*'
    +        /* the grammar is ambiguous on how 'a'b should be interpreted but not the compiler */
    +      },
    +      { /* polymorphic variant */
    +        className: 'type',
    +        begin: '`[A-Z][\\w\']*'
    +      },
    +      { /* module or constructor */
    +        className: 'type',
    +        begin: '\\b[A-Z][\\w\']*',
    +        relevance: 0
    +      },
    +      { /* don't color identifiers, but safely catch all identifiers with ' */
    +        begin: '[a-z_]\\w*\'[\\w\']*'
    +      },
    +      hljs.inherit(hljs.APOS_STRING_MODE, {
    +        className: 'string',
    +        relevance: 0
    +      }),
    +      hljs.inherit(hljs.QUOTE_STRING_MODE, {
    +        illegal: null
    +      }),
    +      {
    +        className: 'number',
    +        begin:
    +          '\\b(0[xX][a-fA-F0-9_]+[Lln]?|' +
    +          '0[oO][0-7_]+[Lln]?|' +
    +          '0[bB][01_]+[Lln]?|' +
    +          '[0-9][0-9_]*([Lln]|(\\.[0-9_]*)?([eE][-+]?[0-9_]+)?)?)',
    +        relevance: 0
    +      },
    +      {
    +        begin: /[-=]>/ // relevance booster
    +      }
    +    ]
    +  };
    +}
    +
    +module.exports = sml;
    diff --git a/node_modules/highlight.js/lib/languages/sqf.js b/node_modules/highlight.js/lib/languages/sqf.js
    new file mode 100644
    index 0000000..13c41d6
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/sqf.js
    @@ -0,0 +1,449 @@
    +/*
    +Language: SQF
    +Author: Søren Enevoldsen 
    +Contributors: Marvin Saignat , Dedmen Miller 
    +Description: Scripting language for the Arma game series
    +Website: https://community.bistudio.com/wiki/SQF_syntax
    +Category: scripting
    +*/
    +
    +function sqf(hljs) {
    +  // In SQF, a variable start with _
    +  const VARIABLE = {
    +    className: 'variable',
    +    begin: /\b_+[a-zA-Z]\w*/
    +  };
    +
    +  // In SQF, a function should fit myTag_fnc_myFunction pattern
    +  // https://community.bistudio.com/wiki/Functions_Library_(Arma_3)#Adding_a_Function
    +  const FUNCTION = {
    +    className: 'title',
    +    begin: /[a-zA-Z][a-zA-Z0-9]+_fnc_\w*/
    +  };
    +
    +  // In SQF strings, quotes matching the start are escaped by adding a consecutive.
    +  // Example of single escaped quotes: " "" " and  ' '' '.
    +  const STRINGS = {
    +    className: 'string',
    +    variants: [
    +      {
    +        begin: '"',
    +        end: '"',
    +        contains: [ {
    +          begin: '""',
    +          relevance: 0
    +        } ]
    +      },
    +      {
    +        begin: '\'',
    +        end: '\'',
    +        contains: [ {
    +          begin: '\'\'',
    +          relevance: 0
    +        } ]
    +      }
    +    ]
    +  };
    +
    +  // list of keywords from:
    +  // https://community.bistudio.com/wiki/PreProcessor_Commands
    +  const PREPROCESSOR = {
    +    className: 'meta',
    +    begin: /#\s*[a-z]+\b/,
    +    end: /$/,
    +    keywords: {
    +      'meta-keyword':
    +        'define undef ifdef ifndef else endif include'
    +    },
    +    contains: [
    +      {
    +        begin: /\\\n/,
    +        relevance: 0
    +      },
    +      hljs.inherit(STRINGS, {
    +        className: 'meta-string'
    +      }),
    +      {
    +        className: 'meta-string',
    +        begin: /<[^\n>]*>/,
    +        end: /$/,
    +        illegal: '\\n'
    +      },
    +      hljs.C_LINE_COMMENT_MODE,
    +      hljs.C_BLOCK_COMMENT_MODE
    +    ]
    +  };
    +
    +  return {
    +    name: 'SQF',
    +    aliases: [ 'sqf' ],
    +    case_insensitive: true,
    +    keywords: {
    +      keyword:
    +        'case catch default do else exit exitWith for forEach from if ' +
    +        'private switch then throw to try waitUntil while with',
    +      built_in:
    +        'abs accTime acos action actionIDs actionKeys actionKeysImages actionKeysNames ' +
    +        'actionKeysNamesArray actionName actionParams activateAddons activatedAddons activateKey ' +
    +        'add3DENConnection add3DENEventHandler add3DENLayer addAction addBackpack addBackpackCargo ' +
    +        'addBackpackCargoGlobal addBackpackGlobal addCamShake addCuratorAddons addCuratorCameraArea ' +
    +        'addCuratorEditableObjects addCuratorEditingArea addCuratorPoints addEditorObject addEventHandler ' +
    +        'addForce addGoggles addGroupIcon addHandgunItem addHeadgear addItem addItemCargo ' +
    +        'addItemCargoGlobal addItemPool addItemToBackpack addItemToUniform addItemToVest addLiveStats ' +
    +        'addMagazine addMagazineAmmoCargo addMagazineCargo addMagazineCargoGlobal addMagazineGlobal ' +
    +        'addMagazinePool addMagazines addMagazineTurret addMenu addMenuItem addMissionEventHandler ' +
    +        'addMPEventHandler addMusicEventHandler addOwnedMine addPlayerScores addPrimaryWeaponItem ' +
    +        'addPublicVariableEventHandler addRating addResources addScore addScoreSide addSecondaryWeaponItem ' +
    +        'addSwitchableUnit addTeamMember addToRemainsCollector addTorque addUniform addVehicle addVest ' +
    +        'addWaypoint addWeapon addWeaponCargo addWeaponCargoGlobal addWeaponGlobal addWeaponItem ' +
    +        'addWeaponPool addWeaponTurret admin agent agents AGLToASL aimedAtTarget aimPos airDensityRTD ' +
    +        'airplaneThrottle airportSide AISFinishHeal alive all3DENEntities allAirports allControls ' +
    +        'allCurators allCutLayers allDead allDeadMen allDisplays allGroups allMapMarkers allMines ' +
    +        'allMissionObjects allow3DMode allowCrewInImmobile allowCuratorLogicIgnoreAreas allowDamage ' +
    +        'allowDammage allowFileOperations allowFleeing allowGetIn allowSprint allPlayers allSimpleObjects ' +
    +        'allSites allTurrets allUnits allUnitsUAV allVariables ammo ammoOnPylon and animate animateBay ' +
    +        'animateDoor animatePylon animateSource animationNames animationPhase animationSourcePhase ' +
    +        'animationState append apply armoryPoints arrayIntersect asin ASLToAGL ASLToATL assert ' +
    +        'assignAsCargo assignAsCargoIndex assignAsCommander assignAsDriver assignAsGunner assignAsTurret ' +
    +        'assignCurator assignedCargo assignedCommander assignedDriver assignedGunner assignedItems ' +
    +        'assignedTarget assignedTeam assignedVehicle assignedVehicleRole assignItem assignTeam ' +
    +        'assignToAirport atan atan2 atg ATLToASL attachedObject attachedObjects attachedTo attachObject ' +
    +        'attachTo attackEnabled backpack backpackCargo backpackContainer backpackItems backpackMagazines ' +
    +        'backpackSpaceFor behaviour benchmark binocular boundingBox boundingBoxReal boundingCenter ' +
    +        'breakOut breakTo briefingName buildingExit buildingPos buttonAction buttonSetAction cadetMode ' +
    +        'call callExtension camCommand camCommit camCommitPrepared camCommitted camConstuctionSetParams ' +
    +        'camCreate camDestroy cameraEffect cameraEffectEnableHUD cameraInterest cameraOn cameraView ' +
    +        'campaignConfigFile camPreload camPreloaded camPrepareBank camPrepareDir camPrepareDive ' +
    +        'camPrepareFocus camPrepareFov camPrepareFovRange camPreparePos camPrepareRelPos camPrepareTarget ' +
    +        'camSetBank camSetDir camSetDive camSetFocus camSetFov camSetFovRange camSetPos camSetRelPos ' +
    +        'camSetTarget camTarget camUseNVG canAdd canAddItemToBackpack canAddItemToUniform canAddItemToVest ' +
    +        'cancelSimpleTaskDestination canFire canMove canSlingLoad canStand canSuspend ' +
    +        'canTriggerDynamicSimulation canUnloadInCombat canVehicleCargo captive captiveNum cbChecked ' +
    +        'cbSetChecked ceil channelEnabled cheatsEnabled checkAIFeature checkVisibility className ' +
    +        'clearAllItemsFromBackpack clearBackpackCargo clearBackpackCargoGlobal clearGroupIcons ' +
    +        'clearItemCargo clearItemCargoGlobal clearItemPool clearMagazineCargo clearMagazineCargoGlobal ' +
    +        'clearMagazinePool clearOverlay clearRadio clearWeaponCargo clearWeaponCargoGlobal clearWeaponPool ' +
    +        'clientOwner closeDialog closeDisplay closeOverlay collapseObjectTree collect3DENHistory ' +
    +        'collectiveRTD combatMode commandArtilleryFire commandChat commander commandFire commandFollow ' +
    +        'commandFSM commandGetOut commandingMenu commandMove commandRadio commandStop ' +
    +        'commandSuppressiveFire commandTarget commandWatch comment commitOverlay compile compileFinal ' +
    +        'completedFSM composeText configClasses configFile configHierarchy configName configProperties ' +
    +        'configSourceAddonList configSourceMod configSourceModList confirmSensorTarget ' +
    +        'connectTerminalToUAV controlsGroupCtrl copyFromClipboard copyToClipboard copyWaypoints cos count ' +
    +        'countEnemy countFriendly countSide countType countUnknown create3DENComposition create3DENEntity ' +
    +        'createAgent createCenter createDialog createDiaryLink createDiaryRecord createDiarySubject ' +
    +        'createDisplay createGearDialog createGroup createGuardedPoint createLocation createMarker ' +
    +        'createMarkerLocal createMenu createMine createMissionDisplay createMPCampaignDisplay ' +
    +        'createSimpleObject createSimpleTask createSite createSoundSource createTask createTeam ' +
    +        'createTrigger createUnit createVehicle createVehicleCrew createVehicleLocal crew ctAddHeader ' +
    +        'ctAddRow ctClear ctCurSel ctData ctFindHeaderRows ctFindRowHeader ctHeaderControls ctHeaderCount ' +
    +        'ctRemoveHeaders ctRemoveRows ctrlActivate ctrlAddEventHandler ctrlAngle ctrlAutoScrollDelay ' +
    +        'ctrlAutoScrollRewind ctrlAutoScrollSpeed ctrlChecked ctrlClassName ctrlCommit ctrlCommitted ' +
    +        'ctrlCreate ctrlDelete ctrlEnable ctrlEnabled ctrlFade ctrlHTMLLoaded ctrlIDC ctrlIDD ' +
    +        'ctrlMapAnimAdd ctrlMapAnimClear ctrlMapAnimCommit ctrlMapAnimDone ctrlMapCursor ctrlMapMouseOver ' +
    +        'ctrlMapScale ctrlMapScreenToWorld ctrlMapWorldToScreen ctrlModel ctrlModelDirAndUp ctrlModelScale ' +
    +        'ctrlParent ctrlParentControlsGroup ctrlPosition ctrlRemoveAllEventHandlers ctrlRemoveEventHandler ' +
    +        'ctrlScale ctrlSetActiveColor ctrlSetAngle ctrlSetAutoScrollDelay ctrlSetAutoScrollRewind ' +
    +        'ctrlSetAutoScrollSpeed ctrlSetBackgroundColor ctrlSetChecked ctrlSetEventHandler ctrlSetFade ' +
    +        'ctrlSetFocus ctrlSetFont ctrlSetFontH1 ctrlSetFontH1B ctrlSetFontH2 ctrlSetFontH2B ctrlSetFontH3 ' +
    +        'ctrlSetFontH3B ctrlSetFontH4 ctrlSetFontH4B ctrlSetFontH5 ctrlSetFontH5B ctrlSetFontH6 ' +
    +        'ctrlSetFontH6B ctrlSetFontHeight ctrlSetFontHeightH1 ctrlSetFontHeightH2 ctrlSetFontHeightH3 ' +
    +        'ctrlSetFontHeightH4 ctrlSetFontHeightH5 ctrlSetFontHeightH6 ctrlSetFontHeightSecondary ' +
    +        'ctrlSetFontP ctrlSetFontPB ctrlSetFontSecondary ctrlSetForegroundColor ctrlSetModel ' +
    +        'ctrlSetModelDirAndUp ctrlSetModelScale ctrlSetPixelPrecision ctrlSetPosition ctrlSetScale ' +
    +        'ctrlSetStructuredText ctrlSetText ctrlSetTextColor ctrlSetTooltip ctrlSetTooltipColorBox ' +
    +        'ctrlSetTooltipColorShade ctrlSetTooltipColorText ctrlShow ctrlShown ctrlText ctrlTextHeight ' +
    +        'ctrlTextWidth ctrlType ctrlVisible ctRowControls ctRowCount ctSetCurSel ctSetData ' +
    +        'ctSetHeaderTemplate ctSetRowTemplate ctSetValue ctValue curatorAddons curatorCamera ' +
    +        'curatorCameraArea curatorCameraAreaCeiling curatorCoef curatorEditableObjects curatorEditingArea ' +
    +        'curatorEditingAreaType curatorMouseOver curatorPoints curatorRegisteredObjects curatorSelected ' +
    +        'curatorWaypointCost current3DENOperation currentChannel currentCommand currentMagazine ' +
    +        'currentMagazineDetail currentMagazineDetailTurret currentMagazineTurret currentMuzzle ' +
    +        'currentNamespace currentTask currentTasks currentThrowable currentVisionMode currentWaypoint ' +
    +        'currentWeapon currentWeaponMode currentWeaponTurret currentZeroing cursorObject cursorTarget ' +
    +        'customChat customRadio cutFadeOut cutObj cutRsc cutText damage date dateToNumber daytime ' +
    +        'deActivateKey debriefingText debugFSM debugLog deg delete3DENEntities deleteAt deleteCenter ' +
    +        'deleteCollection deleteEditorObject deleteGroup deleteGroupWhenEmpty deleteIdentity ' +
    +        'deleteLocation deleteMarker deleteMarkerLocal deleteRange deleteResources deleteSite deleteStatus ' +
    +        'deleteTeam deleteVehicle deleteVehicleCrew deleteWaypoint detach detectedMines ' +
    +        'diag_activeMissionFSMs diag_activeScripts diag_activeSQFScripts diag_activeSQSScripts ' +
    +        'diag_captureFrame diag_captureFrameToFile diag_captureSlowFrame diag_codePerformance ' +
    +        'diag_drawMode diag_enable diag_enabled diag_fps diag_fpsMin diag_frameNo diag_lightNewLoad ' +
    +        'diag_list diag_log diag_logSlowFrame diag_mergeConfigFile diag_recordTurretLimits ' +
    +        'diag_setLightNew diag_tickTime diag_toggle dialog diarySubjectExists didJIP didJIPOwner ' +
    +        'difficulty difficultyEnabled difficultyEnabledRTD difficultyOption direction directSay disableAI ' +
    +        'disableCollisionWith disableConversation disableDebriefingStats disableMapIndicators ' +
    +        'disableNVGEquipment disableRemoteSensors disableSerialization disableTIEquipment ' +
    +        'disableUAVConnectability disableUserInput displayAddEventHandler displayCtrl displayParent ' +
    +        'displayRemoveAllEventHandlers displayRemoveEventHandler displaySetEventHandler dissolveTeam ' +
    +        'distance distance2D distanceSqr distributionRegion do3DENAction doArtilleryFire doFire doFollow ' +
    +        'doFSM doGetOut doMove doorPhase doStop doSuppressiveFire doTarget doWatch drawArrow drawEllipse ' +
    +        'drawIcon drawIcon3D drawLine drawLine3D drawLink drawLocation drawPolygon drawRectangle ' +
    +        'drawTriangle driver drop dynamicSimulationDistance dynamicSimulationDistanceCoef ' +
    +        'dynamicSimulationEnabled dynamicSimulationSystemEnabled echo edit3DENMissionAttributes editObject ' +
    +        'editorSetEventHandler effectiveCommander emptyPositions enableAI enableAIFeature ' +
    +        'enableAimPrecision enableAttack enableAudioFeature enableAutoStartUpRTD enableAutoTrimRTD ' +
    +        'enableCamShake enableCaustics enableChannel enableCollisionWith enableCopilot ' +
    +        'enableDebriefingStats enableDiagLegend enableDynamicSimulation enableDynamicSimulationSystem ' +
    +        'enableEndDialog enableEngineArtillery enableEnvironment enableFatigue enableGunLights ' +
    +        'enableInfoPanelComponent enableIRLasers enableMimics enablePersonTurret enableRadio enableReload ' +
    +        'enableRopeAttach enableSatNormalOnDetail enableSaving enableSentences enableSimulation ' +
    +        'enableSimulationGlobal enableStamina enableTeamSwitch enableTraffic enableUAVConnectability ' +
    +        'enableUAVWaypoints enableVehicleCargo enableVehicleSensor enableWeaponDisassembly ' +
    +        'endLoadingScreen endMission engineOn enginesIsOnRTD enginesRpmRTD enginesTorqueRTD entities ' +
    +        'environmentEnabled estimatedEndServerTime estimatedTimeLeft evalObjectArgument everyBackpack ' +
    +        'everyContainer exec execEditorScript execFSM execVM exp expectedDestination exportJIPMessages ' +
    +        'eyeDirection eyePos face faction fadeMusic fadeRadio fadeSound fadeSpeech failMission ' +
    +        'fillWeaponsFromPool find findCover findDisplay findEditorObject findEmptyPosition ' +
    +        'findEmptyPositionReady findIf findNearestEnemy finishMissionInit finite fire fireAtTarget ' +
    +        'firstBackpack flag flagAnimationPhase flagOwner flagSide flagTexture fleeing floor flyInHeight ' +
    +        'flyInHeightASL fog fogForecast fogParams forceAddUniform forcedMap forceEnd forceFlagTexture ' +
    +        'forceFollowRoad forceMap forceRespawn forceSpeed forceWalk forceWeaponFire forceWeatherChange ' +
    +        'forEachMember forEachMemberAgent forEachMemberTeam forgetTarget format formation ' +
    +        'formationDirection formationLeader formationMembers formationPosition formationTask formatText ' +
    +        'formLeader freeLook fromEditor fuel fullCrew gearIDCAmmoCount gearSlotAmmoCount gearSlotData ' +
    +        'get3DENActionState get3DENAttribute get3DENCamera get3DENConnections get3DENEntity ' +
    +        'get3DENEntityID get3DENGrid get3DENIconsVisible get3DENLayerEntities get3DENLinesVisible ' +
    +        'get3DENMissionAttribute get3DENMouseOver get3DENSelected getAimingCoef getAllEnvSoundControllers ' +
    +        'getAllHitPointsDamage getAllOwnedMines getAllSoundControllers getAmmoCargo getAnimAimPrecision ' +
    +        'getAnimSpeedCoef getArray getArtilleryAmmo getArtilleryComputerSettings getArtilleryETA ' +
    +        'getAssignedCuratorLogic getAssignedCuratorUnit getBackpackCargo getBleedingRemaining ' +
    +        'getBurningValue getCameraViewDirection getCargoIndex getCenterOfMass getClientState ' +
    +        'getClientStateNumber getCompatiblePylonMagazines getConnectedUAV getContainerMaxLoad ' +
    +        'getCursorObjectParams getCustomAimCoef getDammage getDescription getDir getDirVisual ' +
    +        'getDLCAssetsUsage getDLCAssetsUsageByName getDLCs getEditorCamera getEditorMode ' +
    +        'getEditorObjectScope getElevationOffset getEnvSoundController getFatigue getForcedFlagTexture ' +
    +        'getFriend getFSMVariable getFuelCargo getGroupIcon getGroupIconParams getGroupIcons getHideFrom ' +
    +        'getHit getHitIndex getHitPointDamage getItemCargo getMagazineCargo getMarkerColor getMarkerPos ' +
    +        'getMarkerSize getMarkerType getMass getMissionConfig getMissionConfigValue getMissionDLCs ' +
    +        'getMissionLayerEntities getModelInfo getMousePosition getMusicPlayedTime getNumber ' +
    +        'getObjectArgument getObjectChildren getObjectDLC getObjectMaterials getObjectProxy ' +
    +        'getObjectTextures getObjectType getObjectViewDistance getOxygenRemaining getPersonUsedDLCs ' +
    +        'getPilotCameraDirection getPilotCameraPosition getPilotCameraRotation getPilotCameraTarget ' +
    +        'getPlateNumber getPlayerChannel getPlayerScores getPlayerUID getPos getPosASL getPosASLVisual ' +
    +        'getPosASLW getPosATL getPosATLVisual getPosVisual getPosWorld getPylonMagazines getRelDir ' +
    +        'getRelPos getRemoteSensorsDisabled getRepairCargo getResolution getShadowDistance getShotParents ' +
    +        'getSlingLoad getSoundController getSoundControllerResult getSpeed getStamina getStatValue ' +
    +        'getSuppression getTerrainGrid getTerrainHeightASL getText getTotalDLCUsageTime getUnitLoadout ' +
    +        'getUnitTrait getUserMFDText getUserMFDvalue getVariable getVehicleCargo getWeaponCargo ' +
    +        'getWeaponSway getWingsOrientationRTD getWingsPositionRTD getWPPos glanceAt globalChat globalRadio ' +
    +        'goggles goto group groupChat groupFromNetId groupIconSelectable groupIconsVisible groupId ' +
    +        'groupOwner groupRadio groupSelectedUnits groupSelectUnit gunner gusts halt handgunItems ' +
    +        'handgunMagazine handgunWeapon handsHit hasInterface hasPilotCamera hasWeapon hcAllGroups ' +
    +        'hcGroupParams hcLeader hcRemoveAllGroups hcRemoveGroup hcSelected hcSelectGroup hcSetGroup ' +
    +        'hcShowBar hcShownBar headgear hideBody hideObject hideObjectGlobal hideSelection hint hintC ' +
    +        'hintCadet hintSilent hmd hostMission htmlLoad HUDMovementLevels humidity image importAllGroups ' +
    +        'importance in inArea inAreaArray incapacitatedState inflame inflamed infoPanel ' +
    +        'infoPanelComponentEnabled infoPanelComponents infoPanels inGameUISetEventHandler inheritsFrom ' +
    +        'initAmbientLife inPolygon inputAction inRangeOfArtillery insertEditorObject intersect is3DEN ' +
    +        'is3DENMultiplayer isAbleToBreathe isAgent isArray isAutoHoverOn isAutonomous isAutotest ' +
    +        'isBleeding isBurning isClass isCollisionLightOn isCopilotEnabled isDamageAllowed isDedicated ' +
    +        'isDLCAvailable isEngineOn isEqualTo isEqualType isEqualTypeAll isEqualTypeAny isEqualTypeArray ' +
    +        'isEqualTypeParams isFilePatchingEnabled isFlashlightOn isFlatEmpty isForcedWalk isFormationLeader ' +
    +        'isGroupDeletedWhenEmpty isHidden isInRemainsCollector isInstructorFigureEnabled isIRLaserOn ' +
    +        'isKeyActive isKindOf isLaserOn isLightOn isLocalized isManualFire isMarkedForCollection ' +
    +        'isMultiplayer isMultiplayerSolo isNil isNull isNumber isObjectHidden isObjectRTD isOnRoad ' +
    +        'isPipEnabled isPlayer isRealTime isRemoteExecuted isRemoteExecutedJIP isServer isShowing3DIcons ' +
    +        'isSimpleObject isSprintAllowed isStaminaEnabled isSteamMission isStreamFriendlyUIEnabled isText ' +
    +        'isTouchingGround isTurnedOut isTutHintsEnabled isUAVConnectable isUAVConnected isUIContext ' +
    +        'isUniformAllowed isVehicleCargo isVehicleRadarOn isVehicleSensorEnabled isWalking ' +
    +        'isWeaponDeployed isWeaponRested itemCargo items itemsWithMagazines join joinAs joinAsSilent ' +
    +        'joinSilent joinString kbAddDatabase kbAddDatabaseTargets kbAddTopic kbHasTopic kbReact ' +
    +        'kbRemoveTopic kbTell kbWasSaid keyImage keyName knowsAbout land landAt landResult language ' +
    +        'laserTarget lbAdd lbClear lbColor lbColorRight lbCurSel lbData lbDelete lbIsSelected lbPicture ' +
    +        'lbPictureRight lbSelection lbSetColor lbSetColorRight lbSetCurSel lbSetData lbSetPicture ' +
    +        'lbSetPictureColor lbSetPictureColorDisabled lbSetPictureColorSelected lbSetPictureRight ' +
    +        'lbSetPictureRightColor lbSetPictureRightColorDisabled lbSetPictureRightColorSelected ' +
    +        'lbSetSelectColor lbSetSelectColorRight lbSetSelected lbSetText lbSetTextRight lbSetTooltip ' +
    +        'lbSetValue lbSize lbSort lbSortByValue lbText lbTextRight lbValue leader leaderboardDeInit ' +
    +        'leaderboardGetRows leaderboardInit leaderboardRequestRowsFriends leaderboardsRequestUploadScore ' +
    +        'leaderboardsRequestUploadScoreKeepBest leaderboardState leaveVehicle libraryCredits ' +
    +        'libraryDisclaimers lifeState lightAttachObject lightDetachObject lightIsOn lightnings limitSpeed ' +
    +        'linearConversion lineIntersects lineIntersectsObjs lineIntersectsSurfaces lineIntersectsWith ' +
    +        'linkItem list listObjects listRemoteTargets listVehicleSensors ln lnbAddArray lnbAddColumn ' +
    +        'lnbAddRow lnbClear lnbColor lnbCurSelRow lnbData lnbDeleteColumn lnbDeleteRow ' +
    +        'lnbGetColumnsPosition lnbPicture lnbSetColor lnbSetColumnsPos lnbSetCurSelRow lnbSetData ' +
    +        'lnbSetPicture lnbSetText lnbSetValue lnbSize lnbSort lnbSortByValue lnbText lnbValue load loadAbs ' +
    +        'loadBackpack loadFile loadGame loadIdentity loadMagazine loadOverlay loadStatus loadUniform ' +
    +        'loadVest local localize locationPosition lock lockCameraTo lockCargo lockDriver locked ' +
    +        'lockedCargo lockedDriver lockedTurret lockIdentity lockTurret lockWP log logEntities logNetwork ' +
    +        'logNetworkTerminate lookAt lookAtPos magazineCargo magazines magazinesAllTurrets magazinesAmmo ' +
    +        'magazinesAmmoCargo magazinesAmmoFull magazinesDetail magazinesDetailBackpack ' +
    +        'magazinesDetailUniform magazinesDetailVest magazinesTurret magazineTurretAmmo mapAnimAdd ' +
    +        'mapAnimClear mapAnimCommit mapAnimDone mapCenterOnCamera mapGridPosition markAsFinishedOnSteam ' +
    +        'markerAlpha markerBrush markerColor markerDir markerPos markerShape markerSize markerText ' +
    +        'markerType max members menuAction menuAdd menuChecked menuClear menuCollapse menuData menuDelete ' +
    +        'menuEnable menuEnabled menuExpand menuHover menuPicture menuSetAction menuSetCheck menuSetData ' +
    +        'menuSetPicture menuSetValue menuShortcut menuShortcutText menuSize menuSort menuText menuURL ' +
    +        'menuValue min mineActive mineDetectedBy missionConfigFile missionDifficulty missionName ' +
    +        'missionNamespace missionStart missionVersion mod modelToWorld modelToWorldVisual ' +
    +        'modelToWorldVisualWorld modelToWorldWorld modParams moonIntensity moonPhase morale move ' +
    +        'move3DENCamera moveInAny moveInCargo moveInCommander moveInDriver moveInGunner moveInTurret ' +
    +        'moveObjectToEnd moveOut moveTime moveTo moveToCompleted moveToFailed musicVolume name nameSound ' +
    +        'nearEntities nearestBuilding nearestLocation nearestLocations nearestLocationWithDubbing ' +
    +        'nearestObject nearestObjects nearestTerrainObjects nearObjects nearObjectsReady nearRoads ' +
    +        'nearSupplies nearTargets needReload netId netObjNull newOverlay nextMenuItemIndex ' +
    +        'nextWeatherChange nMenuItems not numberOfEnginesRTD numberToDate objectCurators objectFromNetId ' +
    +        'objectParent objStatus onBriefingGroup onBriefingNotes onBriefingPlan onBriefingTeamSwitch ' +
    +        'onCommandModeChanged onDoubleClick onEachFrame onGroupIconClick onGroupIconOverEnter ' +
    +        'onGroupIconOverLeave onHCGroupSelectionChanged onMapSingleClick onPlayerConnected ' +
    +        'onPlayerDisconnected onPreloadFinished onPreloadStarted onShowNewObject onTeamSwitch ' +
    +        'openCuratorInterface openDLCPage openMap openSteamApp openYoutubeVideo or orderGetIn overcast ' +
    +        'overcastForecast owner param params parseNumber parseSimpleArray parseText parsingNamespace ' +
    +        'particlesQuality pickWeaponPool pitch pixelGrid pixelGridBase pixelGridNoUIScale pixelH pixelW ' +
    +        'playableSlotsNumber playableUnits playAction playActionNow player playerRespawnTime playerSide ' +
    +        'playersNumber playGesture playMission playMove playMoveNow playMusic playScriptedMission ' +
    +        'playSound playSound3D position positionCameraToWorld posScreenToWorld posWorldToScreen ' +
    +        'ppEffectAdjust ppEffectCommit ppEffectCommitted ppEffectCreate ppEffectDestroy ppEffectEnable ' +
    +        'ppEffectEnabled ppEffectForceInNVG precision preloadCamera preloadObject preloadSound ' +
    +        'preloadTitleObj preloadTitleRsc preprocessFile preprocessFileLineNumbers primaryWeapon ' +
    +        'primaryWeaponItems primaryWeaponMagazine priority processDiaryLink productVersion profileName ' +
    +        'profileNamespace profileNameSteam progressLoadingScreen progressPosition progressSetPosition ' +
    +        'publicVariable publicVariableClient publicVariableServer pushBack pushBackUnique putWeaponPool ' +
    +        'queryItemsPool queryMagazinePool queryWeaponPool rad radioChannelAdd radioChannelCreate ' +
    +        'radioChannelRemove radioChannelSetCallSign radioChannelSetLabel radioVolume rain rainbow random ' +
    +        'rank rankId rating rectangular registeredTasks registerTask reload reloadEnabled remoteControl ' +
    +        'remoteExec remoteExecCall remoteExecutedOwner remove3DENConnection remove3DENEventHandler ' +
    +        'remove3DENLayer removeAction removeAll3DENEventHandlers removeAllActions removeAllAssignedItems ' +
    +        'removeAllContainers removeAllCuratorAddons removeAllCuratorCameraAreas ' +
    +        'removeAllCuratorEditingAreas removeAllEventHandlers removeAllHandgunItems removeAllItems ' +
    +        'removeAllItemsWithMagazines removeAllMissionEventHandlers removeAllMPEventHandlers ' +
    +        'removeAllMusicEventHandlers removeAllOwnedMines removeAllPrimaryWeaponItems removeAllWeapons ' +
    +        'removeBackpack removeBackpackGlobal removeCuratorAddons removeCuratorCameraArea ' +
    +        'removeCuratorEditableObjects removeCuratorEditingArea removeDrawIcon removeDrawLinks ' +
    +        'removeEventHandler removeFromRemainsCollector removeGoggles removeGroupIcon removeHandgunItem ' +
    +        'removeHeadgear removeItem removeItemFromBackpack removeItemFromUniform removeItemFromVest ' +
    +        'removeItems removeMagazine removeMagazineGlobal removeMagazines removeMagazinesTurret ' +
    +        'removeMagazineTurret removeMenuItem removeMissionEventHandler removeMPEventHandler ' +
    +        'removeMusicEventHandler removeOwnedMine removePrimaryWeaponItem removeSecondaryWeaponItem ' +
    +        'removeSimpleTask removeSwitchableUnit removeTeamMember removeUniform removeVest removeWeapon ' +
    +        'removeWeaponAttachmentCargo removeWeaponCargo removeWeaponGlobal removeWeaponTurret ' +
    +        'reportRemoteTarget requiredVersion resetCamShake resetSubgroupDirection resize resources ' +
    +        'respawnVehicle restartEditorCamera reveal revealMine reverse reversedMouseY roadAt ' +
    +        'roadsConnectedTo roleDescription ropeAttachedObjects ropeAttachedTo ropeAttachEnabled ' +
    +        'ropeAttachTo ropeCreate ropeCut ropeDestroy ropeDetach ropeEndPosition ropeLength ropes ' +
    +        'ropeUnwind ropeUnwound rotorsForcesRTD rotorsRpmRTD round runInitScript safeZoneH safeZoneW ' +
    +        'safeZoneWAbs safeZoneX safeZoneXAbs safeZoneY save3DENInventory saveGame saveIdentity ' +
    +        'saveJoysticks saveOverlay saveProfileNamespace saveStatus saveVar savingEnabled say say2D say3D ' +
    +        'scopeName score scoreSide screenshot screenToWorld scriptDone scriptName scudState ' +
    +        'secondaryWeapon secondaryWeaponItems secondaryWeaponMagazine select selectBestPlaces ' +
    +        'selectDiarySubject selectedEditorObjects selectEditorObject selectionNames selectionPosition ' +
    +        'selectLeader selectMax selectMin selectNoPlayer selectPlayer selectRandom selectRandomWeighted ' +
    +        'selectWeapon selectWeaponTurret sendAUMessage sendSimpleCommand sendTask sendTaskResult ' +
    +        'sendUDPMessage serverCommand serverCommandAvailable serverCommandExecutable serverName serverTime ' +
    +        'set set3DENAttribute set3DENAttributes set3DENGrid set3DENIconsVisible set3DENLayer ' +
    +        'set3DENLinesVisible set3DENLogicType set3DENMissionAttribute set3DENMissionAttributes ' +
    +        'set3DENModelsVisible set3DENObjectType set3DENSelected setAccTime setActualCollectiveRTD ' +
    +        'setAirplaneThrottle setAirportSide setAmmo setAmmoCargo setAmmoOnPylon setAnimSpeedCoef ' +
    +        'setAperture setApertureNew setArmoryPoints setAttributes setAutonomous setBehaviour ' +
    +        'setBleedingRemaining setBrakesRTD setCameraInterest setCamShakeDefParams setCamShakeParams ' +
    +        'setCamUseTI setCaptive setCenterOfMass setCollisionLight setCombatMode setCompassOscillation ' +
    +        'setConvoySeparation setCuratorCameraAreaCeiling setCuratorCoef setCuratorEditingAreaType ' +
    +        'setCuratorWaypointCost setCurrentChannel setCurrentTask setCurrentWaypoint setCustomAimCoef ' +
    +        'setCustomWeightRTD setDamage setDammage setDate setDebriefingText setDefaultCamera setDestination ' +
    +        'setDetailMapBlendPars setDir setDirection setDrawIcon setDriveOnPath setDropInterval ' +
    +        'setDynamicSimulationDistance setDynamicSimulationDistanceCoef setEditorMode setEditorObjectScope ' +
    +        'setEffectCondition setEngineRPMRTD setFace setFaceAnimation setFatigue setFeatureType ' +
    +        'setFlagAnimationPhase setFlagOwner setFlagSide setFlagTexture setFog setFormation ' +
    +        'setFormationTask setFormDir setFriend setFromEditor setFSMVariable setFuel setFuelCargo ' +
    +        'setGroupIcon setGroupIconParams setGroupIconsSelectable setGroupIconsVisible setGroupId ' +
    +        'setGroupIdGlobal setGroupOwner setGusts setHideBehind setHit setHitIndex setHitPointDamage ' +
    +        'setHorizonParallaxCoef setHUDMovementLevels setIdentity setImportance setInfoPanel setLeader ' +
    +        'setLightAmbient setLightAttenuation setLightBrightness setLightColor setLightDayLight ' +
    +        'setLightFlareMaxDistance setLightFlareSize setLightIntensity setLightnings setLightUseFlare ' +
    +        'setLocalWindParams setMagazineTurretAmmo setMarkerAlpha setMarkerAlphaLocal setMarkerBrush ' +
    +        'setMarkerBrushLocal setMarkerColor setMarkerColorLocal setMarkerDir setMarkerDirLocal ' +
    +        'setMarkerPos setMarkerPosLocal setMarkerShape setMarkerShapeLocal setMarkerSize ' +
    +        'setMarkerSizeLocal setMarkerText setMarkerTextLocal setMarkerType setMarkerTypeLocal setMass ' +
    +        'setMimic setMousePosition setMusicEffect setMusicEventHandler setName setNameSound ' +
    +        'setObjectArguments setObjectMaterial setObjectMaterialGlobal setObjectProxy setObjectTexture ' +
    +        'setObjectTextureGlobal setObjectViewDistance setOvercast setOwner setOxygenRemaining ' +
    +        'setParticleCircle setParticleClass setParticleFire setParticleParams setParticleRandom ' +
    +        'setPilotCameraDirection setPilotCameraRotation setPilotCameraTarget setPilotLight setPiPEffect ' +
    +        'setPitch setPlateNumber setPlayable setPlayerRespawnTime setPos setPosASL setPosASL2 setPosASLW ' +
    +        'setPosATL setPosition setPosWorld setPylonLoadOut setPylonsPriority setRadioMsg setRain ' +
    +        'setRainbow setRandomLip setRank setRectangular setRepairCargo setRotorBrakeRTD setShadowDistance ' +
    +        'setShotParents setSide setSimpleTaskAlwaysVisible setSimpleTaskCustomData ' +
    +        'setSimpleTaskDescription setSimpleTaskDestination setSimpleTaskTarget setSimpleTaskType ' +
    +        'setSimulWeatherLayers setSize setSkill setSlingLoad setSoundEffect setSpeaker setSpeech ' +
    +        'setSpeedMode setStamina setStaminaScheme setStatValue setSuppression setSystemOfUnits ' +
    +        'setTargetAge setTaskMarkerOffset setTaskResult setTaskState setTerrainGrid setText ' +
    +        'setTimeMultiplier setTitleEffect setTrafficDensity setTrafficDistance setTrafficGap ' +
    +        'setTrafficSpeed setTriggerActivation setTriggerArea setTriggerStatements setTriggerText ' +
    +        'setTriggerTimeout setTriggerType setType setUnconscious setUnitAbility setUnitLoadout setUnitPos ' +
    +        'setUnitPosWeak setUnitRank setUnitRecoilCoefficient setUnitTrait setUnloadInCombat ' +
    +        'setUserActionText setUserMFDText setUserMFDvalue setVariable setVectorDir setVectorDirAndUp ' +
    +        'setVectorUp setVehicleAmmo setVehicleAmmoDef setVehicleArmor setVehicleCargo setVehicleId ' +
    +        'setVehicleLock setVehiclePosition setVehicleRadar setVehicleReceiveRemoteTargets ' +
    +        'setVehicleReportOwnPosition setVehicleReportRemoteTargets setVehicleTIPars setVehicleVarName ' +
    +        'setVelocity setVelocityModelSpace setVelocityTransformation setViewDistance ' +
    +        'setVisibleIfTreeCollapsed setWantedRPMRTD setWaves setWaypointBehaviour setWaypointCombatMode ' +
    +        'setWaypointCompletionRadius setWaypointDescription setWaypointForceBehaviour setWaypointFormation ' +
    +        'setWaypointHousePosition setWaypointLoiterRadius setWaypointLoiterType setWaypointName ' +
    +        'setWaypointPosition setWaypointScript setWaypointSpeed setWaypointStatements setWaypointTimeout ' +
    +        'setWaypointType setWaypointVisible setWeaponReloadingTime setWind setWindDir setWindForce ' +
    +        'setWindStr setWingForceScaleRTD setWPPos show3DIcons showChat showCinemaBorder showCommandingMenu ' +
    +        'showCompass showCuratorCompass showGPS showHUD showLegend showMap shownArtilleryComputer ' +
    +        'shownChat shownCompass shownCuratorCompass showNewEditorObject shownGPS shownHUD shownMap ' +
    +        'shownPad shownRadio shownScoretable shownUAVFeed shownWarrant shownWatch showPad showRadio ' +
    +        'showScoretable showSubtitles showUAVFeed showWarrant showWatch showWaypoint showWaypoints side ' +
    +        'sideChat sideEnemy sideFriendly sideRadio simpleTasks simulationEnabled simulCloudDensity ' +
    +        'simulCloudOcclusion simulInClouds simulWeatherSync sin size sizeOf skill skillFinal skipTime ' +
    +        'sleep sliderPosition sliderRange sliderSetPosition sliderSetRange sliderSetSpeed sliderSpeed ' +
    +        'slingLoadAssistantShown soldierMagazines someAmmo sort soundVolume spawn speaker speed speedMode ' +
    +        'splitString sqrt squadParams stance startLoadingScreen step stop stopEngineRTD stopped str ' +
    +        'sunOrMoon supportInfo suppressFor surfaceIsWater surfaceNormal surfaceType swimInDepth ' +
    +        'switchableUnits switchAction switchCamera switchGesture switchLight switchMove ' +
    +        'synchronizedObjects synchronizedTriggers synchronizedWaypoints synchronizeObjectsAdd ' +
    +        'synchronizeObjectsRemove synchronizeTrigger synchronizeWaypoint systemChat systemOfUnits tan ' +
    +        'targetKnowledge targets targetsAggregate targetsQuery taskAlwaysVisible taskChildren ' +
    +        'taskCompleted taskCustomData taskDescription taskDestination taskHint taskMarkerOffset taskParent ' +
    +        'taskResult taskState taskType teamMember teamName teams teamSwitch teamSwitchEnabled teamType ' +
    +        'terminate terrainIntersect terrainIntersectASL terrainIntersectAtASL text textLog textLogFormat ' +
    +        'tg time timeMultiplier titleCut titleFadeOut titleObj titleRsc titleText toArray toFixed toLower ' +
    +        'toString toUpper triggerActivated triggerActivation triggerArea triggerAttachedVehicle ' +
    +        'triggerAttachObject triggerAttachVehicle triggerDynamicSimulation triggerStatements triggerText ' +
    +        'triggerTimeout triggerTimeoutCurrent triggerType turretLocal turretOwner turretUnit tvAdd tvClear ' +
    +        'tvCollapse tvCollapseAll tvCount tvCurSel tvData tvDelete tvExpand tvExpandAll tvPicture ' +
    +        'tvSetColor tvSetCurSel tvSetData tvSetPicture tvSetPictureColor tvSetPictureColorDisabled ' +
    +        'tvSetPictureColorSelected tvSetPictureRight tvSetPictureRightColor tvSetPictureRightColorDisabled ' +
    +        'tvSetPictureRightColorSelected tvSetText tvSetTooltip tvSetValue tvSort tvSortByValue tvText ' +
    +        'tvTooltip tvValue type typeName typeOf UAVControl uiNamespace uiSleep unassignCurator ' +
    +        'unassignItem unassignTeam unassignVehicle underwater uniform uniformContainer uniformItems ' +
    +        'uniformMagazines unitAddons unitAimPosition unitAimPositionVisual unitBackpack unitIsUAV unitPos ' +
    +        'unitReady unitRecoilCoefficient units unitsBelowHeight unlinkItem unlockAchievement ' +
    +        'unregisterTask updateDrawIcon updateMenuItem updateObjectTree useAISteeringComponent ' +
    +        'useAudioTimeForMoves userInputDisabled vectorAdd vectorCos vectorCrossProduct vectorDiff ' +
    +        'vectorDir vectorDirVisual vectorDistance vectorDistanceSqr vectorDotProduct vectorFromTo ' +
    +        'vectorMagnitude vectorMagnitudeSqr vectorModelToWorld vectorModelToWorldVisual vectorMultiply ' +
    +        'vectorNormalized vectorUp vectorUpVisual vectorWorldToModel vectorWorldToModelVisual vehicle ' +
    +        'vehicleCargoEnabled vehicleChat vehicleRadio vehicleReceiveRemoteTargets vehicleReportOwnPosition ' +
    +        'vehicleReportRemoteTargets vehicles vehicleVarName velocity velocityModelSpace verifySignature ' +
    +        'vest vestContainer vestItems vestMagazines viewDistance visibleCompass visibleGPS visibleMap ' +
    +        'visiblePosition visiblePositionASL visibleScoretable visibleWatch waves waypointAttachedObject ' +
    +        'waypointAttachedVehicle waypointAttachObject waypointAttachVehicle waypointBehaviour ' +
    +        'waypointCombatMode waypointCompletionRadius waypointDescription waypointForceBehaviour ' +
    +        'waypointFormation waypointHousePosition waypointLoiterRadius waypointLoiterType waypointName ' +
    +        'waypointPosition waypoints waypointScript waypointsEnabledUAV waypointShow waypointSpeed ' +
    +        'waypointStatements waypointTimeout waypointTimeoutCurrent waypointType waypointVisible ' +
    +        'weaponAccessories weaponAccessoriesCargo weaponCargo weaponDirection weaponInertia weaponLowered ' +
    +        'weapons weaponsItems weaponsItemsCargo weaponState weaponsTurret weightRTD WFSideText wind ',
    +      literal:
    +        'blufor civilian configNull controlNull displayNull east endl false grpNull independent lineBreak ' +
    +        'locationNull nil objNull opfor pi resistance scriptNull sideAmbientLife sideEmpty sideLogic ' +
    +        'sideUnknown taskNull teamMemberNull true west'
    +    },
    +    contains: [
    +      hljs.C_LINE_COMMENT_MODE,
    +      hljs.C_BLOCK_COMMENT_MODE,
    +      hljs.NUMBER_MODE,
    +      VARIABLE,
    +      FUNCTION,
    +      STRINGS,
    +      PREPROCESSOR
    +    ],
    +    illegal: /#|^\$ /
    +  };
    +}
    +
    +module.exports = sqf;
    diff --git a/node_modules/highlight.js/lib/languages/sql.js b/node_modules/highlight.js/lib/languages/sql.js
    new file mode 100644
    index 0000000..a934bcd
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/sql.js
    @@ -0,0 +1,170 @@
    +/*
    + Language: SQL
    + Contributors: Nikolay Lisienko , Heiko August , Travis Odom , Vadimtro , Benjamin Auder 
    + Website: https://en.wikipedia.org/wiki/SQL
    + Category: common
    + */
    +
    +function sql(hljs) {
    +  var COMMENT_MODE = hljs.COMMENT('--', '$');
    +  return {
    +    name: 'SQL',
    +    case_insensitive: true,
    +    illegal: /[<>{}*]/,
    +    contains: [
    +      {
    +        beginKeywords:
    +          'begin end start commit rollback savepoint lock alter create drop rename call ' +
    +          'delete do handler insert load replace select truncate update set show pragma grant ' +
    +          'merge describe use explain help declare prepare execute deallocate release ' +
    +          'unlock purge reset change stop analyze cache flush optimize repair kill ' +
    +          'install uninstall checksum restore check backup revoke comment values with',
    +        end: /;/, endsWithParent: true,
    +        keywords: {
    +          $pattern: /[\w\.]+/,
    +          keyword:
    +            'as abort abs absolute acc acce accep accept access accessed accessible account acos action activate add ' +
    +            'addtime admin administer advanced advise aes_decrypt aes_encrypt after agent aggregate ali alia alias ' +
    +            'all allocate allow alter always analyze ancillary and anti any anydata anydataset anyschema anytype apply ' +
    +            'archive archived archivelog are as asc ascii asin assembly assertion associate asynchronous at atan ' +
    +            'atn2 attr attri attrib attribu attribut attribute attributes audit authenticated authentication authid ' +
    +            'authors auto autoallocate autodblink autoextend automatic availability avg backup badfile basicfile ' +
    +            'before begin beginning benchmark between bfile bfile_base big bigfile bin binary_double binary_float ' +
    +            'binlog bit_and bit_count bit_length bit_or bit_xor bitmap blob_base block blocksize body both bound ' +
    +            'bucket buffer_cache buffer_pool build bulk by byte byteordermark bytes cache caching call calling cancel ' +
    +            'capacity cascade cascaded case cast catalog category ceil ceiling chain change changed char_base ' +
    +            'char_length character_length characters characterset charindex charset charsetform charsetid check ' +
    +            'checksum checksum_agg child choose chr chunk class cleanup clear client clob clob_base clone close ' +
    +            'cluster_id cluster_probability cluster_set clustering coalesce coercibility col collate collation ' +
    +            'collect colu colum column column_value columns columns_updated comment commit compact compatibility ' +
    +            'compiled complete composite_limit compound compress compute concat concat_ws concurrent confirm conn ' +
    +            'connec connect connect_by_iscycle connect_by_isleaf connect_by_root connect_time connection ' +
    +            'consider consistent constant constraint constraints constructor container content contents context ' +
    +            'contributors controlfile conv convert convert_tz corr corr_k corr_s corresponding corruption cos cost ' +
    +            'count count_big counted covar_pop covar_samp cpu_per_call cpu_per_session crc32 create creation ' +
    +            'critical cross cube cume_dist curdate current current_date current_time current_timestamp current_user ' +
    +            'cursor curtime customdatum cycle data database databases datafile datafiles datalength date_add ' +
    +            'date_cache date_format date_sub dateadd datediff datefromparts datename datepart datetime2fromparts ' +
    +            'day day_to_second dayname dayofmonth dayofweek dayofyear days db_role_change dbtimezone ddl deallocate ' +
    +            'declare decode decompose decrement decrypt deduplicate def defa defau defaul default defaults ' +
    +            'deferred defi defin define degrees delayed delegate delete delete_all delimited demand dense_rank ' +
    +            'depth dequeue des_decrypt des_encrypt des_key_file desc descr descri describ describe descriptor ' +
    +            'deterministic diagnostics difference dimension direct_load directory disable disable_all ' +
    +            'disallow disassociate discardfile disconnect diskgroup distinct distinctrow distribute distributed div ' +
    +            'do document domain dotnet double downgrade drop dumpfile duplicate duration each edition editionable ' +
    +            'editions element ellipsis else elsif elt empty enable enable_all enclosed encode encoding encrypt ' +
    +            'end end-exec endian enforced engine engines enqueue enterprise entityescaping eomonth error errors ' +
    +            'escaped evalname evaluate event eventdata events except exception exceptions exchange exclude excluding ' +
    +            'execu execut execute exempt exists exit exp expire explain explode export export_set extended extent external ' +
    +            'external_1 external_2 externally extract failed failed_login_attempts failover failure far fast ' +
    +            'feature_set feature_value fetch field fields file file_name_convert filesystem_like_logging final ' +
    +            'finish first first_value fixed flash_cache flashback floor flush following follows for forall force foreign ' +
    +            'form forma format found found_rows freelist freelists freepools fresh from from_base64 from_days ' +
    +            'ftp full function general generated get get_format get_lock getdate getutcdate global global_name ' +
    +            'globally go goto grant grants greatest group group_concat group_id grouping grouping_id groups ' +
    +            'gtid_subtract guarantee guard handler hash hashkeys having hea head headi headin heading heap help hex ' +
    +            'hierarchy high high_priority hosts hour hours http id ident_current ident_incr ident_seed identified ' +
    +            'identity idle_time if ifnull ignore iif ilike ilm immediate import in include including increment ' +
    +            'index indexes indexing indextype indicator indices inet6_aton inet6_ntoa inet_aton inet_ntoa infile ' +
    +            'initial initialized initially initrans inmemory inner innodb input insert install instance instantiable ' +
    +            'instr interface interleaved intersect into invalidate invisible is is_free_lock is_ipv4 is_ipv4_compat ' +
    +            'is_not is_not_null is_used_lock isdate isnull isolation iterate java join json json_exists ' +
    +            'keep keep_duplicates key keys kill language large last last_day last_insert_id last_value lateral lax lcase ' +
    +            'lead leading least leaves left len lenght length less level levels library like like2 like4 likec limit ' +
    +            'lines link list listagg little ln load load_file lob lobs local localtime localtimestamp locate ' +
    +            'locator lock locked log log10 log2 logfile logfiles logging logical logical_reads_per_call ' +
    +            'logoff logon logs long loop low low_priority lower lpad lrtrim ltrim main make_set makedate maketime ' +
    +            'managed management manual map mapping mask master master_pos_wait match matched materialized max ' +
    +            'maxextents maximize maxinstances maxlen maxlogfiles maxloghistory maxlogmembers maxsize maxtrans ' +
    +            'md5 measures median medium member memcompress memory merge microsecond mid migration min minextents ' +
    +            'minimum mining minus minute minutes minvalue missing mod mode model modification modify module monitoring month ' +
    +            'months mount move movement multiset mutex name name_const names nan national native natural nav nchar ' +
    +            'nclob nested never new newline next nextval no no_write_to_binlog noarchivelog noaudit nobadfile ' +
    +            'nocheck nocompress nocopy nocycle nodelay nodiscardfile noentityescaping noguarantee nokeep nologfile ' +
    +            'nomapping nomaxvalue nominimize nominvalue nomonitoring none noneditionable nonschema noorder ' +
    +            'nopr nopro noprom nopromp noprompt norely noresetlogs noreverse normal norowdependencies noschemacheck ' +
    +            'noswitch not nothing notice notnull notrim novalidate now nowait nth_value nullif nulls num numb numbe ' +
    +            'nvarchar nvarchar2 object ocicoll ocidate ocidatetime ociduration ociinterval ociloblocator ocinumber ' +
    +            'ociref ocirefcursor ocirowid ocistring ocitype oct octet_length of off offline offset oid oidindex old ' +
    +            'on online only opaque open operations operator optimal optimize option optionally or oracle oracle_date ' +
    +            'oradata ord ordaudio orddicom orddoc order ordimage ordinality ordvideo organization orlany orlvary ' +
    +            'out outer outfile outline output over overflow overriding package pad parallel parallel_enable ' +
    +            'parameters parent parse partial partition partitions pascal passing password password_grace_time ' +
    +            'password_lock_time password_reuse_max password_reuse_time password_verify_function patch path patindex ' +
    +            'pctincrease pctthreshold pctused pctversion percent percent_rank percentile_cont percentile_disc ' +
    +            'performance period period_add period_diff permanent physical pi pipe pipelined pivot pluggable plugin ' +
    +            'policy position post_transaction pow power pragma prebuilt precedes preceding precision prediction ' +
    +            'prediction_cost prediction_details prediction_probability prediction_set prepare present preserve ' +
    +            'prior priority private private_sga privileges procedural procedure procedure_analyze processlist ' +
    +            'profiles project prompt protection public publishingservername purge quarter query quick quiesce quota ' +
    +            'quotename radians raise rand range rank raw read reads readsize rebuild record records ' +
    +            'recover recovery recursive recycle redo reduced ref reference referenced references referencing refresh ' +
    +            'regexp_like register regr_avgx regr_avgy regr_count regr_intercept regr_r2 regr_slope regr_sxx regr_sxy ' +
    +            'reject rekey relational relative relaylog release release_lock relies_on relocate rely rem remainder rename ' +
    +            'repair repeat replace replicate replication required reset resetlogs resize resource respect restore ' +
    +            'restricted result result_cache resumable resume retention return returning returns reuse reverse revoke ' +
    +            'right rlike role roles rollback rolling rollup round row row_count rowdependencies rowid rownum rows ' +
    +            'rtrim rules safe salt sample save savepoint sb1 sb2 sb4 scan schema schemacheck scn scope scroll ' +
    +            'sdo_georaster sdo_topo_geometry search sec_to_time second seconds section securefile security seed segment select ' +
    +            'self semi sequence sequential serializable server servererror session session_user sessions_per_user set ' +
    +            'sets settings sha sha1 sha2 share shared shared_pool short show shrink shutdown si_averagecolor ' +
    +            'si_colorhistogram si_featurelist si_positionalcolor si_stillimage si_texture siblings sid sign sin ' +
    +            'size size_t sizes skip slave sleep smalldatetimefromparts smallfile snapshot some soname sort soundex ' +
    +            'source space sparse spfile split sql sql_big_result sql_buffer_result sql_cache sql_calc_found_rows ' +
    +            'sql_small_result sql_variant_property sqlcode sqldata sqlerror sqlname sqlstate sqrt square standalone ' +
    +            'standby start starting startup statement static statistics stats_binomial_test stats_crosstab ' +
    +            'stats_ks_test stats_mode stats_mw_test stats_one_way_anova stats_t_test_ stats_t_test_indep ' +
    +            'stats_t_test_one stats_t_test_paired stats_wsr_test status std stddev stddev_pop stddev_samp stdev ' +
    +            'stop storage store stored str str_to_date straight_join strcmp strict string struct stuff style subdate ' +
    +            'subpartition subpartitions substitutable substr substring subtime subtring_index subtype success sum ' +
    +            'suspend switch switchoffset switchover sync synchronous synonym sys sys_xmlagg sysasm sysaux sysdate ' +
    +            'sysdatetimeoffset sysdba sysoper system system_user sysutcdatetime table tables tablespace tablesample tan tdo ' +
    +            'template temporary terminated tertiary_weights test than then thread through tier ties time time_format ' +
    +            'time_zone timediff timefromparts timeout timestamp timestampadd timestampdiff timezone_abbr ' +
    +            'timezone_minute timezone_region to to_base64 to_date to_days to_seconds todatetimeoffset trace tracking ' +
    +            'transaction transactional translate translation treat trigger trigger_nestlevel triggers trim truncate ' +
    +            'try_cast try_convert try_parse type ub1 ub2 ub4 ucase unarchived unbounded uncompress ' +
    +            'under undo unhex unicode uniform uninstall union unique unix_timestamp unknown unlimited unlock unnest unpivot ' +
    +            'unrecoverable unsafe unsigned until untrusted unusable unused update updated upgrade upped upper upsert ' +
    +            'url urowid usable usage use use_stored_outlines user user_data user_resources users using utc_date ' +
    +            'utc_timestamp uuid uuid_short validate validate_password_strength validation valist value values var ' +
    +            'var_samp varcharc vari varia variab variabl variable variables variance varp varraw varrawc varray ' +
    +            'verify version versions view virtual visible void wait wallet warning warnings week weekday weekofyear ' +
    +            'wellformed when whene whenev wheneve whenever where while whitespace window with within without work wrapped ' +
    +            'xdb xml xmlagg xmlattributes xmlcast xmlcolattval xmlelement xmlexists xmlforest xmlindex xmlnamespaces ' +
    +            'xmlpi xmlquery xmlroot xmlschema xmlserialize xmltable xmltype xor year year_to_month years yearweek',
    +          literal:
    +            'true false null unknown',
    +          built_in:
    +            'array bigint binary bit blob bool boolean char character date dec decimal float int int8 integer interval number ' +
    +            'numeric real record serial serial8 smallint text time timestamp tinyint varchar varchar2 varying void'
    +        },
    +        contains: [
    +          {
    +            className: 'string',
    +            begin: '\'', end: '\'',
    +            contains: [{begin: '\'\''}]
    +          },
    +          {
    +            className: 'string',
    +            begin: '"', end: '"',
    +            contains: [{begin: '""'}]
    +          },
    +          {
    +            className: 'string',
    +            begin: '`', end: '`'
    +          },
    +          hljs.C_NUMBER_MODE,
    +          hljs.C_BLOCK_COMMENT_MODE,
    +          COMMENT_MODE,
    +          hljs.HASH_COMMENT_MODE
    +        ]
    +      },
    +      hljs.C_BLOCK_COMMENT_MODE,
    +      COMMENT_MODE,
    +      hljs.HASH_COMMENT_MODE
    +    ]
    +  };
    +}
    +
    +module.exports = sql;
    diff --git a/node_modules/highlight.js/lib/languages/stan.js b/node_modules/highlight.js/lib/languages/stan.js
    new file mode 100644
    index 0000000..26ce45f
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/stan.js
    @@ -0,0 +1,548 @@
    +/*
    +Language: Stan
    +Description: The Stan probabilistic programming language
    +Author: Jeffrey B. Arnold 
    +Website: http://mc-stan.org/
    +Category: scientific
    +*/
    +
    +function stan(hljs) {
    +  // variable names cannot conflict with block identifiers
    +  const BLOCKS = [
    +    'functions',
    +    'model',
    +    'data',
    +    'parameters',
    +    'quantities',
    +    'transformed',
    +    'generated'
    +  ];
    +  const STATEMENTS = [
    +    'for',
    +    'in',
    +    'if',
    +    'else',
    +    'while',
    +    'break',
    +    'continue',
    +    'return'
    +  ];
    +  const SPECIAL_FUNCTIONS = [
    +    'print',
    +    'reject',
    +    'increment_log_prob|10',
    +    'integrate_ode|10',
    +    'integrate_ode_rk45|10',
    +    'integrate_ode_bdf|10',
    +    'algebra_solver'
    +  ];
    +  const VAR_TYPES = [
    +    'int',
    +    'real',
    +    'vector',
    +    'ordered',
    +    'positive_ordered',
    +    'simplex',
    +    'unit_vector',
    +    'row_vector',
    +    'matrix',
    +    'cholesky_factor_corr|10',
    +    'cholesky_factor_cov|10',
    +    'corr_matrix|10',
    +    'cov_matrix|10',
    +    'void'
    +  ];
    +  const FUNCTIONS = [
    +    'Phi',
    +    'Phi_approx',
    +    'abs',
    +    'acos',
    +    'acosh',
    +    'algebra_solver',
    +    'append_array',
    +    'append_col',
    +    'append_row',
    +    'asin',
    +    'asinh',
    +    'atan',
    +    'atan2',
    +    'atanh',
    +    'bernoulli_cdf',
    +    'bernoulli_lccdf',
    +    'bernoulli_lcdf',
    +    'bernoulli_logit_lpmf',
    +    'bernoulli_logit_rng',
    +    'bernoulli_lpmf',
    +    'bernoulli_rng',
    +    'bessel_first_kind',
    +    'bessel_second_kind',
    +    'beta_binomial_cdf',
    +    'beta_binomial_lccdf',
    +    'beta_binomial_lcdf',
    +    'beta_binomial_lpmf',
    +    'beta_binomial_rng',
    +    'beta_cdf',
    +    'beta_lccdf',
    +    'beta_lcdf',
    +    'beta_lpdf',
    +    'beta_rng',
    +    'binary_log_loss',
    +    'binomial_cdf',
    +    'binomial_coefficient_log',
    +    'binomial_lccdf',
    +    'binomial_lcdf',
    +    'binomial_logit_lpmf',
    +    'binomial_lpmf',
    +    'binomial_rng',
    +    'block',
    +    'categorical_logit_lpmf',
    +    'categorical_logit_rng',
    +    'categorical_lpmf',
    +    'categorical_rng',
    +    'cauchy_cdf',
    +    'cauchy_lccdf',
    +    'cauchy_lcdf',
    +    'cauchy_lpdf',
    +    'cauchy_rng',
    +    'cbrt',
    +    'ceil',
    +    'chi_square_cdf',
    +    'chi_square_lccdf',
    +    'chi_square_lcdf',
    +    'chi_square_lpdf',
    +    'chi_square_rng',
    +    'cholesky_decompose',
    +    'choose',
    +    'col',
    +    'cols',
    +    'columns_dot_product',
    +    'columns_dot_self',
    +    'cos',
    +    'cosh',
    +    'cov_exp_quad',
    +    'crossprod',
    +    'csr_extract_u',
    +    'csr_extract_v',
    +    'csr_extract_w',
    +    'csr_matrix_times_vector',
    +    'csr_to_dense_matrix',
    +    'cumulative_sum',
    +    'determinant',
    +    'diag_matrix',
    +    'diag_post_multiply',
    +    'diag_pre_multiply',
    +    'diagonal',
    +    'digamma',
    +    'dims',
    +    'dirichlet_lpdf',
    +    'dirichlet_rng',
    +    'distance',
    +    'dot_product',
    +    'dot_self',
    +    'double_exponential_cdf',
    +    'double_exponential_lccdf',
    +    'double_exponential_lcdf',
    +    'double_exponential_lpdf',
    +    'double_exponential_rng',
    +    'e',
    +    'eigenvalues_sym',
    +    'eigenvectors_sym',
    +    'erf',
    +    'erfc',
    +    'exp',
    +    'exp2',
    +    'exp_mod_normal_cdf',
    +    'exp_mod_normal_lccdf',
    +    'exp_mod_normal_lcdf',
    +    'exp_mod_normal_lpdf',
    +    'exp_mod_normal_rng',
    +    'expm1',
    +    'exponential_cdf',
    +    'exponential_lccdf',
    +    'exponential_lcdf',
    +    'exponential_lpdf',
    +    'exponential_rng',
    +    'fabs',
    +    'falling_factorial',
    +    'fdim',
    +    'floor',
    +    'fma',
    +    'fmax',
    +    'fmin',
    +    'fmod',
    +    'frechet_cdf',
    +    'frechet_lccdf',
    +    'frechet_lcdf',
    +    'frechet_lpdf',
    +    'frechet_rng',
    +    'gamma_cdf',
    +    'gamma_lccdf',
    +    'gamma_lcdf',
    +    'gamma_lpdf',
    +    'gamma_p',
    +    'gamma_q',
    +    'gamma_rng',
    +    'gaussian_dlm_obs_lpdf',
    +    'get_lp',
    +    'gumbel_cdf',
    +    'gumbel_lccdf',
    +    'gumbel_lcdf',
    +    'gumbel_lpdf',
    +    'gumbel_rng',
    +    'head',
    +    'hypergeometric_lpmf',
    +    'hypergeometric_rng',
    +    'hypot',
    +    'inc_beta',
    +    'int_step',
    +    'integrate_ode',
    +    'integrate_ode_bdf',
    +    'integrate_ode_rk45',
    +    'inv',
    +    'inv_Phi',
    +    'inv_chi_square_cdf',
    +    'inv_chi_square_lccdf',
    +    'inv_chi_square_lcdf',
    +    'inv_chi_square_lpdf',
    +    'inv_chi_square_rng',
    +    'inv_cloglog',
    +    'inv_gamma_cdf',
    +    'inv_gamma_lccdf',
    +    'inv_gamma_lcdf',
    +    'inv_gamma_lpdf',
    +    'inv_gamma_rng',
    +    'inv_logit',
    +    'inv_sqrt',
    +    'inv_square',
    +    'inv_wishart_lpdf',
    +    'inv_wishart_rng',
    +    'inverse',
    +    'inverse_spd',
    +    'is_inf',
    +    'is_nan',
    +    'lbeta',
    +    'lchoose',
    +    'lgamma',
    +    'lkj_corr_cholesky_lpdf',
    +    'lkj_corr_cholesky_rng',
    +    'lkj_corr_lpdf',
    +    'lkj_corr_rng',
    +    'lmgamma',
    +    'lmultiply',
    +    'log',
    +    'log10',
    +    'log1m',
    +    'log1m_exp',
    +    'log1m_inv_logit',
    +    'log1p',
    +    'log1p_exp',
    +    'log2',
    +    'log_determinant',
    +    'log_diff_exp',
    +    'log_falling_factorial',
    +    'log_inv_logit',
    +    'log_mix',
    +    'log_rising_factorial',
    +    'log_softmax',
    +    'log_sum_exp',
    +    'logistic_cdf',
    +    'logistic_lccdf',
    +    'logistic_lcdf',
    +    'logistic_lpdf',
    +    'logistic_rng',
    +    'logit',
    +    'lognormal_cdf',
    +    'lognormal_lccdf',
    +    'lognormal_lcdf',
    +    'lognormal_lpdf',
    +    'lognormal_rng',
    +    'machine_precision',
    +    'matrix_exp',
    +    'max',
    +    'mdivide_left_spd',
    +    'mdivide_left_tri_low',
    +    'mdivide_right_spd',
    +    'mdivide_right_tri_low',
    +    'mean',
    +    'min',
    +    'modified_bessel_first_kind',
    +    'modified_bessel_second_kind',
    +    'multi_gp_cholesky_lpdf',
    +    'multi_gp_lpdf',
    +    'multi_normal_cholesky_lpdf',
    +    'multi_normal_cholesky_rng',
    +    'multi_normal_lpdf',
    +    'multi_normal_prec_lpdf',
    +    'multi_normal_rng',
    +    'multi_student_t_lpdf',
    +    'multi_student_t_rng',
    +    'multinomial_lpmf',
    +    'multinomial_rng',
    +    'multiply_log',
    +    'multiply_lower_tri_self_transpose',
    +    'neg_binomial_2_cdf',
    +    'neg_binomial_2_lccdf',
    +    'neg_binomial_2_lcdf',
    +    'neg_binomial_2_log_lpmf',
    +    'neg_binomial_2_log_rng',
    +    'neg_binomial_2_lpmf',
    +    'neg_binomial_2_rng',
    +    'neg_binomial_cdf',
    +    'neg_binomial_lccdf',
    +    'neg_binomial_lcdf',
    +    'neg_binomial_lpmf',
    +    'neg_binomial_rng',
    +    'negative_infinity',
    +    'normal_cdf',
    +    'normal_lccdf',
    +    'normal_lcdf',
    +    'normal_lpdf',
    +    'normal_rng',
    +    'not_a_number',
    +    'num_elements',
    +    'ordered_logistic_lpmf',
    +    'ordered_logistic_rng',
    +    'owens_t',
    +    'pareto_cdf',
    +    'pareto_lccdf',
    +    'pareto_lcdf',
    +    'pareto_lpdf',
    +    'pareto_rng',
    +    'pareto_type_2_cdf',
    +    'pareto_type_2_lccdf',
    +    'pareto_type_2_lcdf',
    +    'pareto_type_2_lpdf',
    +    'pareto_type_2_rng',
    +    'pi',
    +    'poisson_cdf',
    +    'poisson_lccdf',
    +    'poisson_lcdf',
    +    'poisson_log_lpmf',
    +    'poisson_log_rng',
    +    'poisson_lpmf',
    +    'poisson_rng',
    +    'positive_infinity',
    +    'pow',
    +    'print',
    +    'prod',
    +    'qr_Q',
    +    'qr_R',
    +    'quad_form',
    +    'quad_form_diag',
    +    'quad_form_sym',
    +    'rank',
    +    'rayleigh_cdf',
    +    'rayleigh_lccdf',
    +    'rayleigh_lcdf',
    +    'rayleigh_lpdf',
    +    'rayleigh_rng',
    +    'reject',
    +    'rep_array',
    +    'rep_matrix',
    +    'rep_row_vector',
    +    'rep_vector',
    +    'rising_factorial',
    +    'round',
    +    'row',
    +    'rows',
    +    'rows_dot_product',
    +    'rows_dot_self',
    +    'scaled_inv_chi_square_cdf',
    +    'scaled_inv_chi_square_lccdf',
    +    'scaled_inv_chi_square_lcdf',
    +    'scaled_inv_chi_square_lpdf',
    +    'scaled_inv_chi_square_rng',
    +    'sd',
    +    'segment',
    +    'sin',
    +    'singular_values',
    +    'sinh',
    +    'size',
    +    'skew_normal_cdf',
    +    'skew_normal_lccdf',
    +    'skew_normal_lcdf',
    +    'skew_normal_lpdf',
    +    'skew_normal_rng',
    +    'softmax',
    +    'sort_asc',
    +    'sort_desc',
    +    'sort_indices_asc',
    +    'sort_indices_desc',
    +    'sqrt',
    +    'sqrt2',
    +    'square',
    +    'squared_distance',
    +    'step',
    +    'student_t_cdf',
    +    'student_t_lccdf',
    +    'student_t_lcdf',
    +    'student_t_lpdf',
    +    'student_t_rng',
    +    'sub_col',
    +    'sub_row',
    +    'sum',
    +    'tail',
    +    'tan',
    +    'tanh',
    +    'target',
    +    'tcrossprod',
    +    'tgamma',
    +    'to_array_1d',
    +    'to_array_2d',
    +    'to_matrix',
    +    'to_row_vector',
    +    'to_vector',
    +    'trace',
    +    'trace_gen_quad_form',
    +    'trace_quad_form',
    +    'trigamma',
    +    'trunc',
    +    'uniform_cdf',
    +    'uniform_lccdf',
    +    'uniform_lcdf',
    +    'uniform_lpdf',
    +    'uniform_rng',
    +    'variance',
    +    'von_mises_lpdf',
    +    'von_mises_rng',
    +    'weibull_cdf',
    +    'weibull_lccdf',
    +    'weibull_lcdf',
    +    'weibull_lpdf',
    +    'weibull_rng',
    +    'wiener_lpdf',
    +    'wishart_lpdf',
    +    'wishart_rng'
    +  ];
    +  const DISTRIBUTIONS = [
    +    'bernoulli',
    +    'bernoulli_logit',
    +    'beta',
    +    'beta_binomial',
    +    'binomial',
    +    'binomial_logit',
    +    'categorical',
    +    'categorical_logit',
    +    'cauchy',
    +    'chi_square',
    +    'dirichlet',
    +    'double_exponential',
    +    'exp_mod_normal',
    +    'exponential',
    +    'frechet',
    +    'gamma',
    +    'gaussian_dlm_obs',
    +    'gumbel',
    +    'hypergeometric',
    +    'inv_chi_square',
    +    'inv_gamma',
    +    'inv_wishart',
    +    'lkj_corr',
    +    'lkj_corr_cholesky',
    +    'logistic',
    +    'lognormal',
    +    'multi_gp',
    +    'multi_gp_cholesky',
    +    'multi_normal',
    +    'multi_normal_cholesky',
    +    'multi_normal_prec',
    +    'multi_student_t',
    +    'multinomial',
    +    'neg_binomial',
    +    'neg_binomial_2',
    +    'neg_binomial_2_log',
    +    'normal',
    +    'ordered_logistic',
    +    'pareto',
    +    'pareto_type_2',
    +    'poisson',
    +    'poisson_log',
    +    'rayleigh',
    +    'scaled_inv_chi_square',
    +    'skew_normal',
    +    'student_t',
    +    'uniform',
    +    'von_mises',
    +    'weibull',
    +    'wiener',
    +    'wishart'
    +  ];
    +
    +  return {
    +    name: 'Stan',
    +    aliases: [ 'stanfuncs' ],
    +    keywords: {
    +      $pattern: hljs.IDENT_RE,
    +      title: BLOCKS.join(' '),
    +      keyword: STATEMENTS.concat(VAR_TYPES).concat(SPECIAL_FUNCTIONS).join(' '),
    +      built_in: FUNCTIONS.join(' ')
    +    },
    +    contains: [
    +      hljs.C_LINE_COMMENT_MODE,
    +      hljs.COMMENT(
    +        /#/,
    +        /$/,
    +        {
    +          relevance: 0,
    +          keywords: {
    +            'meta-keyword': 'include'
    +          }
    +        }
    +      ),
    +      hljs.COMMENT(
    +        /\/\*/,
    +        /\*\//,
    +        {
    +          relevance: 0,
    +          // highlight doc strings mentioned in Stan reference
    +          contains: [
    +            {
    +              className: 'doctag',
    +              begin: /@(return|param)/
    +            }
    +          ]
    +        }
    +      ),
    +      {
    +        // hack: in range constraints, lower must follow "<"
    +        begin: /<\s*lower\s*=/,
    +        keywords: 'lower'
    +      },
    +      {
    +        // hack: in range constraints, upper must follow either , or <
    +        //  or 
    +        begin: /[<,]\s*upper\s*=/,
    +        keywords: 'upper'
    +      },
    +      {
    +        className: 'keyword',
    +        begin: /\btarget\s*\+=/,
    +        relevance: 10
    +      },
    +      {
    +        begin: '~\\s*(' + hljs.IDENT_RE + ')\\s*\\(',
    +        keywords: DISTRIBUTIONS.join(' ')
    +      },
    +      {
    +        className: 'number',
    +        variants: [
    +          {
    +            begin: /\b\d+(?:\.\d*)?(?:[eE][+-]?\d+)?/
    +          },
    +          {
    +            begin: /\.\d+(?:[eE][+-]?\d+)?\b/
    +          }
    +        ],
    +        relevance: 0
    +      },
    +      {
    +        className: 'string',
    +        begin: '"',
    +        end: '"',
    +        relevance: 0
    +      }
    +    ]
    +  };
    +}
    +
    +module.exports = stan;
    diff --git a/node_modules/highlight.js/lib/languages/stata.js b/node_modules/highlight.js/lib/languages/stata.js
    new file mode 100644
    index 0000000..7a9561d
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/stata.js
    @@ -0,0 +1,60 @@
    +/*
    +Language: Stata
    +Author: Brian Quistorff 
    +Contributors: Drew McDonald 
    +Description: Stata is a general-purpose statistical software package created in 1985 by StataCorp.
    +Website: https://en.wikipedia.org/wiki/Stata
    +Category: scientific
    +*/
    +
    +/*
    +  This is a fork and modification of Drew McDonald's file (https://github.com/drewmcdonald/stata-highlighting). I have also included a list of builtin commands from https://bugs.kde.org/show_bug.cgi?id=135646.
    +*/
    +
    +function stata(hljs) {
    +  return {
    +    name: 'Stata',
    +    aliases: [
    +      'do',
    +      'ado'
    +    ],
    +    case_insensitive: true,
    +    keywords: 'if else in foreach for forv forva forval forvalu forvalue forvalues by bys bysort xi quietly qui capture about ac ac_7 acprplot acprplot_7 adjust ado adopath adoupdate alpha ameans an ano anov anova anova_estat anova_terms anovadef aorder ap app appe appen append arch arch_dr arch_estat arch_p archlm areg areg_p args arima arima_dr arima_estat arima_p as asmprobit asmprobit_estat asmprobit_lf asmprobit_mfx__dlg asmprobit_p ass asse asser assert avplot avplot_7 avplots avplots_7 bcskew0 bgodfrey bias binreg bip0_lf biplot bipp_lf bipr_lf bipr_p biprobit bitest bitesti bitowt blogit bmemsize boot bootsamp bootstrap bootstrap_8 boxco_l boxco_p boxcox boxcox_6 boxcox_p bprobit br break brier bro brow brows browse brr brrstat bs bs_7 bsampl_w bsample bsample_7 bsqreg bstat bstat_7 bstat_8 bstrap bstrap_7 bubble bubbleplot ca ca_estat ca_p cabiplot camat canon canon_8 canon_8_p canon_estat canon_p cap caprojection capt captu captur capture cat cc cchart cchart_7 cci cd censobs_table centile cf char chdir checkdlgfiles checkestimationsample checkhlpfiles checksum chelp ci cii cl class classutil clear cli clis clist clo clog clog_lf clog_p clogi clogi_sw clogit clogit_lf clogit_p clogitp clogl_sw cloglog clonevar clslistarray cluster cluster_measures cluster_stop cluster_tree cluster_tree_8 clustermat cmdlog cnr cnre cnreg cnreg_p cnreg_sw cnsreg codebook collaps4 collapse colormult_nb colormult_nw compare compress conf confi confir confirm conren cons const constr constra constrai constrain constraint continue contract copy copyright copysource cor corc corr corr2data corr_anti corr_kmo corr_smc corre correl correla correlat correlate corrgram cou coun count cox cox_p cox_sw coxbase coxhaz coxvar cprplot cprplot_7 crc cret cretu cretur creturn cross cs cscript cscript_log csi ct ct_is ctset ctst_5 ctst_st cttost cumsp cumsp_7 cumul cusum cusum_7 cutil d|0 datasig datasign datasigna datasignat datasignatu datasignatur datasignature datetof db dbeta de dec deco decod decode deff des desc descr descri describ describe destring dfbeta dfgls dfuller di di_g dir dirstats dis discard disp disp_res disp_s displ displa display distinct do doe doed doedi doedit dotplot dotplot_7 dprobit drawnorm drop ds ds_util dstdize duplicates durbina dwstat dydx e|0 ed edi edit egen eivreg emdef en enc enco encod encode eq erase ereg ereg_lf ereg_p ereg_sw ereghet ereghet_glf ereghet_glf_sh ereghet_gp ereghet_ilf ereghet_ilf_sh ereghet_ip eret eretu eretur ereturn err erro error esize est est_cfexist est_cfname est_clickable est_expand est_hold est_table est_unhold est_unholdok estat estat_default estat_summ estat_vce_only esti estimates etodow etof etomdy ex exi exit expand expandcl fac fact facto factor factor_estat factor_p factor_pca_rotated factor_rotate factormat fcast fcast_compute fcast_graph fdades fdadesc fdadescr fdadescri fdadescrib fdadescribe fdasav fdasave fdause fh_st file open file read file close file filefilter fillin find_hlp_file findfile findit findit_7 fit fl fli flis flist for5_0 forest forestplot form forma format fpredict frac_154 frac_adj frac_chk frac_cox frac_ddp frac_dis frac_dv frac_in frac_mun frac_pp frac_pq frac_pv frac_wgt frac_xo fracgen fracplot fracplot_7 fracpoly fracpred fron_ex fron_hn fron_p fron_tn fron_tn2 frontier ftodate ftoe ftomdy ftowdate funnel funnelplot g|0 gamhet_glf gamhet_gp gamhet_ilf gamhet_ip gamma gamma_d2 gamma_p gamma_sw gammahet gdi_hexagon gdi_spokes ge gen gene gener genera generat generate genrank genstd genvmean gettoken gl gladder gladder_7 glim_l01 glim_l02 glim_l03 glim_l04 glim_l05 glim_l06 glim_l07 glim_l08 glim_l09 glim_l10 glim_l11 glim_l12 glim_lf glim_mu glim_nw1 glim_nw2 glim_nw3 glim_p glim_v1 glim_v2 glim_v3 glim_v4 glim_v5 glim_v6 glim_v7 glm glm_6 glm_p glm_sw glmpred glo glob globa global glogit glogit_8 glogit_p gmeans gnbre_lf gnbreg gnbreg_5 gnbreg_p gomp_lf gompe_sw gomper_p gompertz gompertzhet gomphet_glf gomphet_glf_sh gomphet_gp gomphet_ilf gomphet_ilf_sh gomphet_ip gphdot gphpen gphprint gprefs gprobi_p gprobit gprobit_8 gr gr7 gr_copy gr_current gr_db gr_describe gr_dir gr_draw gr_draw_replay gr_drop gr_edit gr_editviewopts gr_example gr_example2 gr_export gr_print gr_qscheme gr_query gr_read gr_rename gr_replay gr_save gr_set gr_setscheme gr_table gr_undo gr_use graph graph7 grebar greigen greigen_7 greigen_8 grmeanby grmeanby_7 gs_fileinfo gs_filetype gs_graphinfo gs_stat gsort gwood h|0 hadimvo hareg hausman haver he heck_d2 heckma_p heckman heckp_lf heckpr_p heckprob hel help hereg hetpr_lf hetpr_p hetprob hettest hexdump hilite hist hist_7 histogram hlogit hlu hmeans hotel hotelling hprobit hreg hsearch icd9 icd9_ff icd9p iis impute imtest inbase include inf infi infil infile infix inp inpu input ins insheet insp inspe inspec inspect integ inten intreg intreg_7 intreg_p intrg2_ll intrg_ll intrg_ll2 ipolate iqreg ir irf irf_create irfm iri is_svy is_svysum isid istdize ivprob_1_lf ivprob_lf ivprobit ivprobit_p ivreg ivreg_footnote ivtob_1_lf ivtob_lf ivtobit ivtobit_p jackknife jacknife jknife jknife_6 jknife_8 jkstat joinby kalarma1 kap kap_3 kapmeier kappa kapwgt kdensity kdensity_7 keep ksm ksmirnov ktau kwallis l|0 la lab labbe labbeplot labe label labelbook ladder levels levelsof leverage lfit lfit_p li lincom line linktest lis list lloghet_glf lloghet_glf_sh lloghet_gp lloghet_ilf lloghet_ilf_sh lloghet_ip llogi_sw llogis_p llogist llogistic llogistichet lnorm_lf lnorm_sw lnorma_p lnormal lnormalhet lnormhet_glf lnormhet_glf_sh lnormhet_gp lnormhet_ilf lnormhet_ilf_sh lnormhet_ip lnskew0 loadingplot loc loca local log logi logis_lf logistic logistic_p logit logit_estat logit_p loglogs logrank loneway lookfor lookup lowess lowess_7 lpredict lrecomp lroc lroc_7 lrtest ls lsens lsens_7 lsens_x lstat ltable ltable_7 ltriang lv lvr2plot lvr2plot_7 m|0 ma mac macr macro makecns man manova manova_estat manova_p manovatest mantel mark markin markout marksample mat mat_capp mat_order mat_put_rr mat_rapp mata mata_clear mata_describe mata_drop mata_matdescribe mata_matsave mata_matuse mata_memory mata_mlib mata_mosave mata_rename mata_which matalabel matcproc matlist matname matr matri matrix matrix_input__dlg matstrik mcc mcci md0_ md1_ md1debug_ md2_ md2debug_ mds mds_estat mds_p mdsconfig mdslong mdsmat mdsshepard mdytoe mdytof me_derd mean means median memory memsize menl meqparse mer merg merge meta mfp mfx mhelp mhodds minbound mixed_ll mixed_ll_reparm mkassert mkdir mkmat mkspline ml ml_5 ml_adjs ml_bhhhs ml_c_d ml_check ml_clear ml_cnt ml_debug ml_defd ml_e0 ml_e0_bfgs ml_e0_cycle ml_e0_dfp ml_e0i ml_e1 ml_e1_bfgs ml_e1_bhhh ml_e1_cycle ml_e1_dfp ml_e2 ml_e2_cycle ml_ebfg0 ml_ebfr0 ml_ebfr1 ml_ebh0q ml_ebhh0 ml_ebhr0 ml_ebr0i ml_ecr0i ml_edfp0 ml_edfr0 ml_edfr1 ml_edr0i ml_eds ml_eer0i ml_egr0i ml_elf ml_elf_bfgs ml_elf_bhhh ml_elf_cycle ml_elf_dfp ml_elfi ml_elfs ml_enr0i ml_enrr0 ml_erdu0 ml_erdu0_bfgs ml_erdu0_bhhh ml_erdu0_bhhhq ml_erdu0_cycle ml_erdu0_dfp ml_erdu0_nrbfgs ml_exde ml_footnote ml_geqnr ml_grad0 ml_graph ml_hbhhh ml_hd0 ml_hold ml_init ml_inv ml_log ml_max ml_mlout ml_mlout_8 ml_model ml_nb0 ml_opt ml_p ml_plot ml_query ml_rdgrd ml_repor ml_s_e ml_score ml_searc ml_technique ml_unhold mleval mlf_ mlmatbysum mlmatsum mlog mlogi mlogit mlogit_footnote mlogit_p mlopts mlsum mlvecsum mnl0_ mor more mov move mprobit mprobit_lf mprobit_p mrdu0_ mrdu1_ mvdecode mvencode mvreg mvreg_estat n|0 nbreg nbreg_al nbreg_lf nbreg_p nbreg_sw nestreg net newey newey_7 newey_p news nl nl_7 nl_9 nl_9_p nl_p nl_p_7 nlcom nlcom_p nlexp2 nlexp2_7 nlexp2a nlexp2a_7 nlexp3 nlexp3_7 nlgom3 nlgom3_7 nlgom4 nlgom4_7 nlinit nllog3 nllog3_7 nllog4 nllog4_7 nlog_rd nlogit nlogit_p nlogitgen nlogittree nlpred no nobreak noi nois noisi noisil noisily note notes notes_dlg nptrend numlabel numlist odbc old_ver olo olog ologi ologi_sw ologit ologit_p ologitp on one onew onewa oneway op_colnm op_comp op_diff op_inv op_str opr opro oprob oprob_sw oprobi oprobi_p oprobit oprobitp opts_exclusive order orthog orthpoly ou out outf outfi outfil outfile outs outsh outshe outshee outsheet ovtest pac pac_7 palette parse parse_dissim pause pca pca_8 pca_display pca_estat pca_p pca_rotate pcamat pchart pchart_7 pchi pchi_7 pcorr pctile pentium pergram pergram_7 permute permute_8 personal peto_st pkcollapse pkcross pkequiv pkexamine pkexamine_7 pkshape pksumm pksumm_7 pl plo plot plugin pnorm pnorm_7 poisgof poiss_lf poiss_sw poisso_p poisson poisson_estat post postclose postfile postutil pperron pr prais prais_e prais_e2 prais_p predict predictnl preserve print pro prob probi probit probit_estat probit_p proc_time procoverlay procrustes procrustes_estat procrustes_p profiler prog progr progra program prop proportion prtest prtesti pwcorr pwd q\\s qby qbys qchi qchi_7 qladder qladder_7 qnorm qnorm_7 qqplot qqplot_7 qreg qreg_c qreg_p qreg_sw qu quadchk quantile quantile_7 que quer query range ranksum ratio rchart rchart_7 rcof recast reclink recode reg reg3 reg3_p regdw regr regre regre_p2 regres regres_p regress regress_estat regriv_p remap ren rena renam rename renpfix repeat replace report reshape restore ret retu retur return rm rmdir robvar roccomp roccomp_7 roccomp_8 rocf_lf rocfit rocfit_8 rocgold rocplot rocplot_7 roctab roctab_7 rolling rologit rologit_p rot rota rotat rotate rotatemat rreg rreg_p ru run runtest rvfplot rvfplot_7 rvpplot rvpplot_7 sa safesum sample sampsi sav save savedresults saveold sc sca scal scala scalar scatter scm_mine sco scob_lf scob_p scobi_sw scobit scor score scoreplot scoreplot_help scree screeplot screeplot_help sdtest sdtesti se search separate seperate serrbar serrbar_7 serset set set_defaults sfrancia sh she shel shell shewhart shewhart_7 signestimationsample signrank signtest simul simul_7 simulate simulate_8 sktest sleep slogit slogit_d2 slogit_p smooth snapspan so sor sort spearman spikeplot spikeplot_7 spikeplt spline_x split sqreg sqreg_p sret sretu sretur sreturn ssc st st_ct st_hc st_hcd st_hcd_sh st_is st_issys st_note st_promo st_set st_show st_smpl st_subid stack statsby statsby_8 stbase stci stci_7 stcox stcox_estat stcox_fr stcox_fr_ll stcox_p stcox_sw stcoxkm stcoxkm_7 stcstat stcurv stcurve stcurve_7 stdes stem stepwise stereg stfill stgen stir stjoin stmc stmh stphplot stphplot_7 stphtest stphtest_7 stptime strate strate_7 streg streg_sw streset sts sts_7 stset stsplit stsum sttocc sttoct stvary stweib su suest suest_8 sum summ summa summar summari summariz summarize sunflower sureg survcurv survsum svar svar_p svmat svy svy_disp svy_dreg svy_est svy_est_7 svy_estat svy_get svy_gnbreg_p svy_head svy_header svy_heckman_p svy_heckprob_p svy_intreg_p svy_ivreg_p svy_logistic_p svy_logit_p svy_mlogit_p svy_nbreg_p svy_ologit_p svy_oprobit_p svy_poisson_p svy_probit_p svy_regress_p svy_sub svy_sub_7 svy_x svy_x_7 svy_x_p svydes svydes_8 svygen svygnbreg svyheckman svyheckprob svyintreg svyintreg_7 svyintrg svyivreg svylc svylog_p svylogit svymarkout svymarkout_8 svymean svymlog svymlogit svynbreg svyolog svyologit svyoprob svyoprobit svyopts svypois svypois_7 svypoisson svyprobit svyprobt svyprop svyprop_7 svyratio svyreg svyreg_p svyregress svyset svyset_7 svyset_8 svytab svytab_7 svytest svytotal sw sw_8 swcnreg swcox swereg swilk swlogis swlogit swologit swoprbt swpois swprobit swqreg swtobit swweib symmetry symmi symplot symplot_7 syntax sysdescribe sysdir sysuse szroeter ta tab tab1 tab2 tab_or tabd tabdi tabdis tabdisp tabi table tabodds tabodds_7 tabstat tabu tabul tabula tabulat tabulate te tempfile tempname tempvar tes test testnl testparm teststd tetrachoric time_it timer tis tob tobi tobit tobit_p tobit_sw token tokeni tokeniz tokenize tostring total translate translator transmap treat_ll treatr_p treatreg trim trimfill trnb_cons trnb_mean trpoiss_d2 trunc_ll truncr_p truncreg tsappend tset tsfill tsline tsline_ex tsreport tsrevar tsrline tsset tssmooth tsunab ttest ttesti tut_chk tut_wait tutorial tw tware_st two twoway twoway__fpfit_serset twoway__function_gen twoway__histogram_gen twoway__ipoint_serset twoway__ipoints_serset twoway__kdensity_gen twoway__lfit_serset twoway__normgen_gen twoway__pci_serset twoway__qfit_serset twoway__scatteri_serset twoway__sunflower_gen twoway_ksm_serset ty typ type typeof u|0 unab unabbrev unabcmd update us use uselabel var var_mkcompanion var_p varbasic varfcast vargranger varirf varirf_add varirf_cgraph varirf_create varirf_ctable varirf_describe varirf_dir varirf_drop varirf_erase varirf_graph varirf_ograph varirf_rename varirf_set varirf_table varlist varlmar varnorm varsoc varstable varstable_w varstable_w2 varwle vce vec vec_fevd vec_mkphi vec_p vec_p_w vecirf_create veclmar veclmar_w vecnorm vecnorm_w vecrank vecstable verinst vers versi versio version view viewsource vif vwls wdatetof webdescribe webseek webuse weib1_lf weib2_lf weib_lf weib_lf0 weibhet_glf weibhet_glf_sh weibhet_glfa weibhet_glfa_sh weibhet_gp weibhet_ilf weibhet_ilf_sh weibhet_ilfa weibhet_ilfa_sh weibhet_ip weibu_sw weibul_p weibull weibull_c weibull_s weibullhet wh whelp whi which whil while wilc_st wilcoxon win wind windo window winexec wntestb wntestb_7 wntestq xchart xchart_7 xcorr xcorr_7 xi xi_6 xmlsav xmlsave xmluse xpose xsh xshe xshel xshell xt_iis xt_tis xtab_p xtabond xtbin_p xtclog xtcloglog xtcloglog_8 xtcloglog_d2 xtcloglog_pa_p xtcloglog_re_p xtcnt_p xtcorr xtdata xtdes xtfront_p xtfrontier xtgee xtgee_elink xtgee_estat xtgee_makeivar xtgee_p xtgee_plink xtgls xtgls_p xthaus xthausman xtht_p xthtaylor xtile xtint_p xtintreg xtintreg_8 xtintreg_d2 xtintreg_p xtivp_1 xtivp_2 xtivreg xtline xtline_ex xtlogit xtlogit_8 xtlogit_d2 xtlogit_fe_p xtlogit_pa_p xtlogit_re_p xtmixed xtmixed_estat xtmixed_p xtnb_fe xtnb_lf xtnbreg xtnbreg_pa_p xtnbreg_refe_p xtpcse xtpcse_p xtpois xtpoisson xtpoisson_d2 xtpoisson_pa_p xtpoisson_refe_p xtpred xtprobit xtprobit_8 xtprobit_d2 xtprobit_re_p xtps_fe xtps_lf xtps_ren xtps_ren_8 xtrar_p xtrc xtrc_p xtrchh xtrefe_p xtreg xtreg_be xtreg_fe xtreg_ml xtreg_pa_p xtreg_re xtregar xtrere_p xtset xtsf_ll xtsf_llti xtsum xttab xttest0 xttobit xttobit_8 xttobit_p xttrans yx yxview__barlike_draw yxview_area_draw yxview_bar_draw yxview_dot_draw yxview_dropline_draw yxview_function_draw yxview_iarrow_draw yxview_ilabels_draw yxview_normal_draw yxview_pcarrow_draw yxview_pcbarrow_draw yxview_pccapsym_draw yxview_pcscatter_draw yxview_pcspike_draw yxview_rarea_draw yxview_rbar_draw yxview_rbarm_draw yxview_rcap_draw yxview_rcapsym_draw yxview_rconnected_draw yxview_rline_draw yxview_rscatter_draw yxview_rspike_draw yxview_spike_draw yxview_sunflower_draw zap_s zinb zinb_llf zinb_plf zip zip_llf zip_p zip_plf zt_ct_5 zt_hc_5 zt_hcd_5 zt_is_5 zt_iss_5 zt_sho_5 zt_smp_5 ztbase_5 ztcox_5 ztdes_5 ztereg_5 ztfill_5 ztgen_5 ztir_5 ztjoin_5 ztnb ztnb_p ztp ztp_p zts_5 ztset_5 ztspli_5 ztsum_5 zttoct_5 ztvary_5 ztweib_5',
    +    contains: [
    +      {
    +        className: 'symbol',
    +        begin: /`[a-zA-Z0-9_]+'/
    +      },
    +      {
    +        className: 'variable',
    +        begin: /\$\{?[a-zA-Z0-9_]+\}?/
    +      },
    +      {
    +        className: 'string',
    +        variants: [
    +          {
    +            begin: '`"[^\r\n]*?"\''
    +          },
    +          {
    +            begin: '"[^\r\n"]*"'
    +          }
    +        ]
    +      },
    +
    +      {
    +        className: 'built_in',
    +        variants: [
    +          {
    +            begin: '\\b(abs|acos|asin|atan|atan2|atanh|ceil|cloglog|comb|cos|digamma|exp|floor|invcloglog|invlogit|ln|lnfact|lnfactorial|lngamma|log|log10|max|min|mod|reldif|round|sign|sin|sqrt|sum|tan|tanh|trigamma|trunc|betaden|Binomial|binorm|binormal|chi2|chi2tail|dgammapda|dgammapdada|dgammapdadx|dgammapdx|dgammapdxdx|F|Fden|Ftail|gammaden|gammap|ibeta|invbinomial|invchi2|invchi2tail|invF|invFtail|invgammap|invibeta|invnchi2|invnFtail|invnibeta|invnorm|invnormal|invttail|nbetaden|nchi2|nFden|nFtail|nibeta|norm|normal|normalden|normd|npnchi2|tden|ttail|uniform|abbrev|char|index|indexnot|length|lower|ltrim|match|plural|proper|real|regexm|regexr|regexs|reverse|rtrim|string|strlen|strlower|strltrim|strmatch|strofreal|strpos|strproper|strreverse|strrtrim|strtrim|strupper|subinstr|subinword|substr|trim|upper|word|wordcount|_caller|autocode|byteorder|chop|clip|cond|e|epsdouble|epsfloat|group|inlist|inrange|irecode|matrix|maxbyte|maxdouble|maxfloat|maxint|maxlong|mi|minbyte|mindouble|minfloat|minint|minlong|missing|r|recode|replay|return|s|scalar|d|date|day|dow|doy|halfyear|mdy|month|quarter|week|year|d|daily|dofd|dofh|dofm|dofq|dofw|dofy|h|halfyearly|hofd|m|mofd|monthly|q|qofd|quarterly|tin|twithin|w|weekly|wofd|y|yearly|yh|ym|yofd|yq|yw|cholesky|colnumb|colsof|corr|det|diag|diag0cnt|el|get|hadamard|I|inv|invsym|issym|issymmetric|J|matmissing|matuniform|mreldif|nullmat|rownumb|rowsof|sweep|syminv|trace|vec|vecdiag)(?=\\()'
    +          }
    +        ]
    +      },
    +
    +      hljs.COMMENT('^[ \t]*\\*.*$', false),
    +      hljs.C_LINE_COMMENT_MODE,
    +      hljs.C_BLOCK_COMMENT_MODE
    +    ]
    +  };
    +}
    +
    +module.exports = stata;
    diff --git a/node_modules/highlight.js/lib/languages/step21.js b/node_modules/highlight.js/lib/languages/step21.js
    new file mode 100644
    index 0000000..09fc2ba
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/step21.js
    @@ -0,0 +1,66 @@
    +/*
    +Language: STEP Part 21
    +Contributors: Adam Joseph Cook 
    +Description: Syntax highlighter for STEP Part 21 files (ISO 10303-21).
    +Website: https://en.wikipedia.org/wiki/ISO_10303-21
    +*/
    +
    +function step21(hljs) {
    +  const STEP21_IDENT_RE = '[A-Z_][A-Z0-9_.]*';
    +  const STEP21_KEYWORDS = {
    +    $pattern: STEP21_IDENT_RE,
    +    keyword: 'HEADER ENDSEC DATA'
    +  };
    +  const STEP21_START = {
    +    className: 'meta',
    +    begin: 'ISO-10303-21;',
    +    relevance: 10
    +  };
    +  const STEP21_CLOSE = {
    +    className: 'meta',
    +    begin: 'END-ISO-10303-21;',
    +    relevance: 10
    +  };
    +
    +  return {
    +    name: 'STEP Part 21',
    +    aliases: [
    +      'p21',
    +      'step',
    +      'stp'
    +    ],
    +    case_insensitive: true, // STEP 21 is case insensitive in theory, in practice all non-comments are capitalized.
    +    keywords: STEP21_KEYWORDS,
    +    contains: [
    +      STEP21_START,
    +      STEP21_CLOSE,
    +      hljs.C_LINE_COMMENT_MODE,
    +      hljs.C_BLOCK_COMMENT_MODE,
    +      hljs.COMMENT('/\\*\\*!', '\\*/'),
    +      hljs.C_NUMBER_MODE,
    +      hljs.inherit(hljs.APOS_STRING_MODE, {
    +        illegal: null
    +      }),
    +      hljs.inherit(hljs.QUOTE_STRING_MODE, {
    +        illegal: null
    +      }),
    +      {
    +        className: 'string',
    +        begin: "'",
    +        end: "'"
    +      },
    +      {
    +        className: 'symbol',
    +        variants: [
    +          {
    +            begin: '#',
    +            end: '\\d+',
    +            illegal: '\\W'
    +          }
    +        ]
    +      }
    +    ]
    +  };
    +}
    +
    +module.exports = step21;
    diff --git a/node_modules/highlight.js/lib/languages/stylus.js b/node_modules/highlight.js/lib/languages/stylus.js
    new file mode 100644
    index 0000000..bc00d9c
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/stylus.js
    @@ -0,0 +1,455 @@
    +/*
    +Language: Stylus
    +Author: Bryant Williams 
    +Description: Stylus is an expressive, robust, feature-rich CSS language built for nodejs.
    +Website: https://github.com/stylus/stylus
    +Category: css
    +*/
    +
    +function stylus(hljs) {
    +
    +  var VARIABLE = {
    +    className: 'variable',
    +    begin: '\\$' + hljs.IDENT_RE
    +  };
    +
    +  var HEX_COLOR = {
    +    className: 'number',
    +    begin: '#([a-fA-F0-9]{6}|[a-fA-F0-9]{3})'
    +  };
    +
    +  var AT_KEYWORDS = [
    +    'charset',
    +    'css',
    +    'debug',
    +    'extend',
    +    'font-face',
    +    'for',
    +    'import',
    +    'include',
    +    'media',
    +    'mixin',
    +    'page',
    +    'warn',
    +    'while'
    +  ];
    +
    +  var PSEUDO_SELECTORS = [
    +    'after',
    +    'before',
    +    'first-letter',
    +    'first-line',
    +    'active',
    +    'first-child',
    +    'focus',
    +    'hover',
    +    'lang',
    +    'link',
    +    'visited'
    +  ];
    +
    +  var TAGS = [
    +    'a',
    +    'abbr',
    +    'address',
    +    'article',
    +    'aside',
    +    'audio',
    +    'b',
    +    'blockquote',
    +    'body',
    +    'button',
    +    'canvas',
    +    'caption',
    +    'cite',
    +    'code',
    +    'dd',
    +    'del',
    +    'details',
    +    'dfn',
    +    'div',
    +    'dl',
    +    'dt',
    +    'em',
    +    'fieldset',
    +    'figcaption',
    +    'figure',
    +    'footer',
    +    'form',
    +    'h1',
    +    'h2',
    +    'h3',
    +    'h4',
    +    'h5',
    +    'h6',
    +    'header',
    +    'hgroup',
    +    'html',
    +    'i',
    +    'iframe',
    +    'img',
    +    'input',
    +    'ins',
    +    'kbd',
    +    'label',
    +    'legend',
    +    'li',
    +    'mark',
    +    'menu',
    +    'nav',
    +    'object',
    +    'ol',
    +    'p',
    +    'q',
    +    'quote',
    +    'samp',
    +    'section',
    +    'span',
    +    'strong',
    +    'summary',
    +    'sup',
    +    'table',
    +    'tbody',
    +    'td',
    +    'textarea',
    +    'tfoot',
    +    'th',
    +    'thead',
    +    'time',
    +    'tr',
    +    'ul',
    +    'var',
    +    'video'
    +  ];
    +
    +  var LOOKAHEAD_TAG_END = '(?=[.\\s\\n[:,])';
    +
    +  var ATTRIBUTES = [
    +    'align-content',
    +    'align-items',
    +    'align-self',
    +    'animation',
    +    'animation-delay',
    +    'animation-direction',
    +    'animation-duration',
    +    'animation-fill-mode',
    +    'animation-iteration-count',
    +    'animation-name',
    +    'animation-play-state',
    +    'animation-timing-function',
    +    'auto',
    +    'backface-visibility',
    +    'background',
    +    'background-attachment',
    +    'background-clip',
    +    'background-color',
    +    'background-image',
    +    'background-origin',
    +    'background-position',
    +    'background-repeat',
    +    'background-size',
    +    'border',
    +    'border-bottom',
    +    'border-bottom-color',
    +    'border-bottom-left-radius',
    +    'border-bottom-right-radius',
    +    'border-bottom-style',
    +    'border-bottom-width',
    +    'border-collapse',
    +    'border-color',
    +    'border-image',
    +    'border-image-outset',
    +    'border-image-repeat',
    +    'border-image-slice',
    +    'border-image-source',
    +    'border-image-width',
    +    'border-left',
    +    'border-left-color',
    +    'border-left-style',
    +    'border-left-width',
    +    'border-radius',
    +    'border-right',
    +    'border-right-color',
    +    'border-right-style',
    +    'border-right-width',
    +    'border-spacing',
    +    'border-style',
    +    'border-top',
    +    'border-top-color',
    +    'border-top-left-radius',
    +    'border-top-right-radius',
    +    'border-top-style',
    +    'border-top-width',
    +    'border-width',
    +    'bottom',
    +    'box-decoration-break',
    +    'box-shadow',
    +    'box-sizing',
    +    'break-after',
    +    'break-before',
    +    'break-inside',
    +    'caption-side',
    +    'clear',
    +    'clip',
    +    'clip-path',
    +    'color',
    +    'column-count',
    +    'column-fill',
    +    'column-gap',
    +    'column-rule',
    +    'column-rule-color',
    +    'column-rule-style',
    +    'column-rule-width',
    +    'column-span',
    +    'column-width',
    +    'columns',
    +    'content',
    +    'counter-increment',
    +    'counter-reset',
    +    'cursor',
    +    'direction',
    +    'display',
    +    'empty-cells',
    +    'filter',
    +    'flex',
    +    'flex-basis',
    +    'flex-direction',
    +    'flex-flow',
    +    'flex-grow',
    +    'flex-shrink',
    +    'flex-wrap',
    +    'float',
    +    'font',
    +    'font-family',
    +    'font-feature-settings',
    +    'font-kerning',
    +    'font-language-override',
    +    'font-size',
    +    'font-size-adjust',
    +    'font-stretch',
    +    'font-style',
    +    'font-variant',
    +    'font-variant-ligatures',
    +    'font-weight',
    +    'height',
    +    'hyphens',
    +    'icon',
    +    'image-orientation',
    +    'image-rendering',
    +    'image-resolution',
    +    'ime-mode',
    +    'inherit',
    +    'initial',
    +    'justify-content',
    +    'left',
    +    'letter-spacing',
    +    'line-height',
    +    'list-style',
    +    'list-style-image',
    +    'list-style-position',
    +    'list-style-type',
    +    'margin',
    +    'margin-bottom',
    +    'margin-left',
    +    'margin-right',
    +    'margin-top',
    +    'marks',
    +    'mask',
    +    'max-height',
    +    'max-width',
    +    'min-height',
    +    'min-width',
    +    'nav-down',
    +    'nav-index',
    +    'nav-left',
    +    'nav-right',
    +    'nav-up',
    +    'none',
    +    'normal',
    +    'object-fit',
    +    'object-position',
    +    'opacity',
    +    'order',
    +    'orphans',
    +    'outline',
    +    'outline-color',
    +    'outline-offset',
    +    'outline-style',
    +    'outline-width',
    +    'overflow',
    +    'overflow-wrap',
    +    'overflow-x',
    +    'overflow-y',
    +    'padding',
    +    'padding-bottom',
    +    'padding-left',
    +    'padding-right',
    +    'padding-top',
    +    'page-break-after',
    +    'page-break-before',
    +    'page-break-inside',
    +    'perspective',
    +    'perspective-origin',
    +    'pointer-events',
    +    'position',
    +    'quotes',
    +    'resize',
    +    'right',
    +    'tab-size',
    +    'table-layout',
    +    'text-align',
    +    'text-align-last',
    +    'text-decoration',
    +    'text-decoration-color',
    +    'text-decoration-line',
    +    'text-decoration-style',
    +    'text-indent',
    +    'text-overflow',
    +    'text-rendering',
    +    'text-shadow',
    +    'text-transform',
    +    'text-underline-position',
    +    'top',
    +    'transform',
    +    'transform-origin',
    +    'transform-style',
    +    'transition',
    +    'transition-delay',
    +    'transition-duration',
    +    'transition-property',
    +    'transition-timing-function',
    +    'unicode-bidi',
    +    'vertical-align',
    +    'visibility',
    +    'white-space',
    +    'widows',
    +    'width',
    +    'word-break',
    +    'word-spacing',
    +    'word-wrap',
    +    'z-index'
    +  ];
    +
    +  // illegals
    +  var ILLEGAL = [
    +    '\\?',
    +    '(\\bReturn\\b)', // monkey
    +    '(\\bEnd\\b)', // monkey
    +    '(\\bend\\b)', // vbscript
    +    '(\\bdef\\b)', // gradle
    +    ';', // a whole lot of languages
    +    '#\\s', // markdown
    +    '\\*\\s', // markdown
    +    '===\\s', // markdown
    +    '\\|',
    +    '%', // prolog
    +  ];
    +
    +  return {
    +    name: 'Stylus',
    +    aliases: ['styl'],
    +    case_insensitive: false,
    +    keywords: 'if else for in',
    +    illegal: '(' + ILLEGAL.join('|') + ')',
    +    contains: [
    +
    +      // strings
    +      hljs.QUOTE_STRING_MODE,
    +      hljs.APOS_STRING_MODE,
    +
    +      // comments
    +      hljs.C_LINE_COMMENT_MODE,
    +      hljs.C_BLOCK_COMMENT_MODE,
    +
    +      // hex colors
    +      HEX_COLOR,
    +
    +      // class tag
    +      {
    +        begin: '\\.[a-zA-Z][a-zA-Z0-9_-]*' + LOOKAHEAD_TAG_END,
    +        className: 'selector-class'
    +      },
    +
    +      // id tag
    +      {
    +        begin: '#[a-zA-Z][a-zA-Z0-9_-]*' + LOOKAHEAD_TAG_END,
    +        className: 'selector-id'
    +      },
    +
    +      // tags
    +      {
    +        begin: '\\b(' + TAGS.join('|') + ')' + LOOKAHEAD_TAG_END,
    +        className: 'selector-tag'
    +      },
    +
    +      // psuedo selectors
    +      {
    +        begin: '&?:?:\\b(' + PSEUDO_SELECTORS.join('|') + ')' + LOOKAHEAD_TAG_END
    +      },
    +
    +      // @ keywords
    +      {
    +        begin: '\@(' + AT_KEYWORDS.join('|') + ')\\b'
    +      },
    +
    +      // variables
    +      VARIABLE,
    +
    +      // dimension
    +      hljs.CSS_NUMBER_MODE,
    +
    +      // number
    +      hljs.NUMBER_MODE,
    +
    +      // functions
    +      //  - only from beginning of line + whitespace
    +      {
    +        className: 'function',
    +        begin: '^[a-zA-Z][a-zA-Z0-9_\-]*\\(.*\\)',
    +        illegal: '[\\n]',
    +        returnBegin: true,
    +        contains: [
    +          {className: 'title', begin: '\\b[a-zA-Z][a-zA-Z0-9_\-]*'},
    +          {
    +            className: 'params',
    +            begin: /\(/,
    +            end: /\)/,
    +            contains: [
    +              HEX_COLOR,
    +              VARIABLE,
    +              hljs.APOS_STRING_MODE,
    +              hljs.CSS_NUMBER_MODE,
    +              hljs.NUMBER_MODE,
    +              hljs.QUOTE_STRING_MODE
    +            ]
    +          }
    +        ]
    +      },
    +
    +      // attributes
    +      //  - only from beginning of line + whitespace
    +      //  - must have whitespace after it
    +      {
    +        className: 'attribute',
    +        begin: '\\b(' + ATTRIBUTES.reverse().join('|') + ')\\b',
    +        starts: {
    +          // value container
    +          end: /;|$/,
    +          contains: [
    +            HEX_COLOR,
    +            VARIABLE,
    +            hljs.APOS_STRING_MODE,
    +            hljs.QUOTE_STRING_MODE,
    +            hljs.CSS_NUMBER_MODE,
    +            hljs.NUMBER_MODE,
    +            hljs.C_BLOCK_COMMENT_MODE
    +          ],
    +          illegal: /\./,
    +          relevance: 0
    +        }
    +      }
    +    ]
    +  };
    +}
    +
    +module.exports = stylus;
    diff --git a/node_modules/highlight.js/lib/languages/subunit.js b/node_modules/highlight.js/lib/languages/subunit.js
    new file mode 100644
    index 0000000..00add37
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/subunit.js
    @@ -0,0 +1,51 @@
    +/*
    +Language: SubUnit
    +Author: Sergey Bronnikov 
    +Website: https://pypi.org/project/python-subunit/
    +*/
    +
    +function subunit(hljs) {
    +  const DETAILS = {
    +    className: 'string',
    +    begin: '\\[\n(multipart)?',
    +    end: '\\]\n'
    +  };
    +  const TIME = {
    +    className: 'string',
    +    begin: '\\d{4}-\\d{2}-\\d{2}(\\s+)\\d{2}:\\d{2}:\\d{2}\.\\d+Z'
    +  };
    +  const PROGRESSVALUE = {
    +    className: 'string',
    +    begin: '(\\+|-)\\d+'
    +  };
    +  const KEYWORDS = {
    +    className: 'keyword',
    +    relevance: 10,
    +    variants: [
    +      {
    +        begin: '^(test|testing|success|successful|failure|error|skip|xfail|uxsuccess)(:?)\\s+(test)?'
    +      },
    +      {
    +        begin: '^progress(:?)(\\s+)?(pop|push)?'
    +      },
    +      {
    +        begin: '^tags:'
    +      },
    +      {
    +        begin: '^time:'
    +      }
    +    ]
    +  };
    +  return {
    +    name: 'SubUnit',
    +    case_insensitive: true,
    +    contains: [
    +      DETAILS,
    +      TIME,
    +      PROGRESSVALUE,
    +      KEYWORDS
    +    ]
    +  };
    +}
    +
    +module.exports = subunit;
    diff --git a/node_modules/highlight.js/lib/languages/swift.js b/node_modules/highlight.js/lib/languages/swift.js
    new file mode 100644
    index 0000000..6bcda35
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/swift.js
    @@ -0,0 +1,166 @@
    +/*
    +Language: Swift
    +Description: Swift is a general-purpose programming language built using a modern approach to safety, performance, and software design patterns.
    +Author: Chris Eidhof 
    +Contributors: Nate Cook , Alexander Lichter 
    +Website: https://swift.org
    +Category: common, system
    +*/
    +
    +
    +function swift(hljs) {
    +  var SWIFT_KEYWORDS = {
    +      // override the pattern since the default of of /\w+/ is not sufficient to
    +      // capture the keywords that start with the character "#"
    +      $pattern: /[\w#]+/,
    +      keyword: '#available #colorLiteral #column #else #elseif #endif #file ' +
    +        '#fileLiteral #function #if #imageLiteral #line #selector #sourceLocation ' +
    +        '_ __COLUMN__ __FILE__ __FUNCTION__ __LINE__ Any as as! as? associatedtype ' +
    +        'associativity break case catch class continue convenience default defer deinit didSet do ' +
    +        'dynamic dynamicType else enum extension fallthrough false fileprivate final for func ' +
    +        'get guard if import in indirect infix init inout internal is lazy left let ' +
    +        'mutating nil none nonmutating open operator optional override postfix precedence ' +
    +        'prefix private protocol Protocol public repeat required rethrows return ' +
    +        'right self Self set some static struct subscript super switch throw throws true ' +
    +        'try try! try? Type typealias unowned var weak where while willSet',
    +      literal: 'true false nil',
    +      built_in: 'abs advance alignof alignofValue anyGenerator assert assertionFailure ' +
    +        'bridgeFromObjectiveC bridgeFromObjectiveCUnconditional bridgeToObjectiveC ' +
    +        'bridgeToObjectiveCUnconditional c compactMap contains count countElements countLeadingZeros ' +
    +        'debugPrint debugPrintln distance dropFirst dropLast dump encodeBitsAsWords ' +
    +        'enumerate equal fatalError filter find getBridgedObjectiveCType getVaList ' +
    +        'indices insertionSort isBridgedToObjectiveC isBridgedVerbatimToObjectiveC ' +
    +        'isUniquelyReferenced isUniquelyReferencedNonObjC join lazy lexicographicalCompare ' +
    +        'map max maxElement min minElement numericCast overlaps partition posix ' +
    +        'precondition preconditionFailure print println quickSort readLine reduce reflect ' +
    +        'reinterpretCast reverse roundUpToAlignment sizeof sizeofValue sort split ' +
    +        'startsWith stride strideof strideofValue swap toString transcode ' +
    +        'underestimateCount unsafeAddressOf unsafeBitCast unsafeDowncast unsafeUnwrap ' +
    +        'unsafeReflect withExtendedLifetime withObjectAtPlusZero withUnsafePointer ' +
    +        'withUnsafePointerToObject withUnsafeMutablePointer withUnsafeMutablePointers ' +
    +        'withUnsafePointer withUnsafePointers withVaList zip'
    +    };
    +
    +  var TYPE = {
    +    className: 'type',
    +    begin: '\\b[A-Z][\\w\u00C0-\u02B8\']*',
    +    relevance: 0
    +  };
    +  // slightly more special to swift
    +  var OPTIONAL_USING_TYPE = {
    +    className: 'type',
    +    begin: '\\b[A-Z][\\w\u00C0-\u02B8\']*[!?]'
    +  };
    +  var BLOCK_COMMENT = hljs.COMMENT(
    +    '/\\*',
    +    '\\*/',
    +    {
    +      contains: ['self']
    +    }
    +  );
    +  var SUBST = {
    +    className: 'subst',
    +    begin: /\\\(/, end: '\\)',
    +    keywords: SWIFT_KEYWORDS,
    +    contains: [] // assigned later
    +  };
    +  var STRING = {
    +    className: 'string',
    +    contains: [hljs.BACKSLASH_ESCAPE, SUBST],
    +    variants: [
    +      {begin: /"""/, end: /"""/},
    +      {begin: /"/, end: /"/},
    +    ]
    +  };
    +
    +  // https://docs.swift.org/swift-book/ReferenceManual/LexicalStructure.html#grammar_numeric-literal
    +  // TODO: Update for leading `-` after lookbehind is supported everywhere
    +  var decimalDigits = '([0-9]_*)+';
    +  var hexDigits = '([0-9a-fA-F]_*)+';
    +  var NUMBER = {
    +      className: 'number',
    +      relevance: 0,
    +      variants: [
    +        // decimal floating-point-literal (subsumes decimal-literal)
    +        { begin: `\\b(${decimalDigits})(\\.(${decimalDigits}))?` +
    +          `([eE][+-]?(${decimalDigits}))?\\b` },
    +
    +        // hexadecimal floating-point-literal (subsumes hexadecimal-literal)
    +        { begin: `\\b0x(${hexDigits})(\\.(${hexDigits}))?` +
    +          `([pP][+-]?(${decimalDigits}))?\\b` },
    +
    +        // octal-literal
    +        { begin: /\b0o([0-7]_*)+\b/ },
    +
    +        // binary-literal
    +        { begin: /\b0b([01]_*)+\b/ },
    +      ]
    +  };
    +  SUBST.contains = [NUMBER];
    +
    +  return {
    +    name: 'Swift',
    +    keywords: SWIFT_KEYWORDS,
    +    contains: [
    +      STRING,
    +      hljs.C_LINE_COMMENT_MODE,
    +      BLOCK_COMMENT,
    +      OPTIONAL_USING_TYPE,
    +      TYPE,
    +      NUMBER,
    +      {
    +        className: 'function',
    +        beginKeywords: 'func', end: /\{/, excludeEnd: true,
    +        contains: [
    +          hljs.inherit(hljs.TITLE_MODE, {
    +            begin: /[A-Za-z$_][0-9A-Za-z$_]*/
    +          }),
    +          {
    +            begin: //
    +          },
    +          {
    +            className: 'params',
    +            begin: /\(/, end: /\)/, endsParent: true,
    +            keywords: SWIFT_KEYWORDS,
    +            contains: [
    +              'self',
    +              NUMBER,
    +              STRING,
    +              hljs.C_BLOCK_COMMENT_MODE,
    +              {begin: ':'} // relevance booster
    +            ],
    +            illegal: /["']/
    +          }
    +        ],
    +        illegal: /\[|%/
    +      },
    +      {
    +        className: 'class',
    +        beginKeywords: 'struct protocol class extension enum',
    +        keywords: SWIFT_KEYWORDS,
    +        end: '\\{',
    +        excludeEnd: true,
    +        contains: [
    +          hljs.inherit(hljs.TITLE_MODE, {begin: /[A-Za-z$_][\u00C0-\u02B80-9A-Za-z$_]*/})
    +        ]
    +      },
    +      {
    +        className: 'meta', // @attributes
    +        begin: '(@discardableResult|@warn_unused_result|@exported|@lazy|@noescape|' +
    +                  '@NSCopying|@NSManaged|@objc|@objcMembers|@convention|@required|' +
    +                  '@noreturn|@IBAction|@IBDesignable|@IBInspectable|@IBOutlet|' +
    +                  '@infix|@prefix|@postfix|@autoclosure|@testable|@available|' +
    +                  '@nonobjc|@NSApplicationMain|@UIApplicationMain|@dynamicMemberLookup|' +
    +                  '@propertyWrapper|@main)\\b'
    +
    +      },
    +      {
    +        beginKeywords: 'import', end: /$/,
    +        contains: [hljs.C_LINE_COMMENT_MODE, BLOCK_COMMENT],
    +        relevance: 0
    +      }
    +    ]
    +  };
    +}
    +
    +module.exports = swift;
    diff --git a/node_modules/highlight.js/lib/languages/taggerscript.js b/node_modules/highlight.js/lib/languages/taggerscript.js
    new file mode 100644
    index 0000000..c82ba28
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/taggerscript.js
    @@ -0,0 +1,52 @@
    +/*
    +Language: Tagger Script
    +Author: Philipp Wolfer 
    +Description: Syntax Highlighting for the Tagger Script as used by MusicBrainz Picard.
    +Website: https://picard.musicbrainz.org
    + */
    +function taggerscript(hljs) {
    +  const COMMENT = {
    +    className: 'comment',
    +    begin: /\$noop\(/,
    +    end: /\)/,
    +    contains: [ {
    +      begin: /\(/,
    +      end: /\)/,
    +      contains: [ 'self',
    +        {
    +          begin: /\\./
    +        } ]
    +    } ],
    +    relevance: 10
    +  };
    +
    +  const FUNCTION = {
    +    className: 'keyword',
    +    begin: /\$(?!noop)[a-zA-Z][_a-zA-Z0-9]*/,
    +    end: /\(/,
    +    excludeEnd: true
    +  };
    +
    +  const VARIABLE = {
    +    className: 'variable',
    +    begin: /%[_a-zA-Z0-9:]*/,
    +    end: '%'
    +  };
    +
    +  const ESCAPE_SEQUENCE = {
    +    className: 'symbol',
    +    begin: /\\./
    +  };
    +
    +  return {
    +    name: 'Tagger Script',
    +    contains: [
    +      COMMENT,
    +      FUNCTION,
    +      VARIABLE,
    +      ESCAPE_SEQUENCE
    +    ]
    +  };
    +}
    +
    +module.exports = taggerscript;
    diff --git a/node_modules/highlight.js/lib/languages/tap.js b/node_modules/highlight.js/lib/languages/tap.js
    new file mode 100644
    index 0000000..c57ab40
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/tap.js
    @@ -0,0 +1,55 @@
    +/*
    +Language: Test Anything Protocol
    +Description: TAP, the Test Anything Protocol, is a simple text-based interface between testing modules in a test harness.
    +Requires: yaml.js
    +Author: Sergey Bronnikov 
    +Website: https://testanything.org
    +*/
    +
    +function tap(hljs) {
    +  return {
    +    name: 'Test Anything Protocol',
    +    case_insensitive: true,
    +    contains: [
    +      hljs.HASH_COMMENT_MODE,
    +      // version of format and total amount of testcases
    +      {
    +        className: 'meta',
    +        variants: [
    +          {
    +            begin: '^TAP version (\\d+)$'
    +          },
    +          {
    +            begin: '^1\\.\\.(\\d+)$'
    +          }
    +        ]
    +      },
    +      // YAML block
    +      {
    +        begin: /---$/,
    +        end: '\\.\\.\\.$',
    +        subLanguage: 'yaml',
    +        relevance: 0
    +      },
    +      // testcase number
    +      {
    +        className: 'number',
    +        begin: ' (\\d+) '
    +      },
    +      // testcase status and description
    +      {
    +        className: 'symbol',
    +        variants: [
    +          {
    +            begin: '^ok'
    +          },
    +          {
    +            begin: '^not ok'
    +          }
    +        ]
    +      }
    +    ]
    +  };
    +}
    +
    +module.exports = tap;
    diff --git a/node_modules/highlight.js/lib/languages/tcl.js b/node_modules/highlight.js/lib/languages/tcl.js
    new file mode 100644
    index 0000000..5d6d4ce
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/tcl.js
    @@ -0,0 +1,69 @@
    +/*
    +Language: Tcl
    +Description: Tcl is a very simple programming language.
    +Author: Radek Liska 
    +Website: https://www.tcl.tk/about/language.html
    +*/
    +
    +function tcl(hljs) {
    +  return {
    +    name: 'Tcl',
    +    aliases: ['tk'],
    +    keywords: 'after append apply array auto_execok auto_import auto_load auto_mkindex ' +
    +      'auto_mkindex_old auto_qualify auto_reset bgerror binary break catch cd chan clock ' +
    +      'close concat continue dde dict encoding eof error eval exec exit expr fblocked ' +
    +      'fconfigure fcopy file fileevent filename flush for foreach format gets glob global ' +
    +      'history http if incr info interp join lappend|10 lassign|10 lindex|10 linsert|10 list ' +
    +      'llength|10 load lrange|10 lrepeat|10 lreplace|10 lreverse|10 lsearch|10 lset|10 lsort|10 '+
    +      'mathfunc mathop memory msgcat namespace open package parray pid pkg::create pkg_mkIndex '+
    +      'platform platform::shell proc puts pwd read refchan regexp registry regsub|10 rename '+
    +      'return safe scan seek set socket source split string subst switch tcl_endOfWord '+
    +      'tcl_findLibrary tcl_startOfNextWord tcl_startOfPreviousWord tcl_wordBreakAfter '+
    +      'tcl_wordBreakBefore tcltest tclvars tell time tm trace unknown unload unset update '+
    +      'uplevel upvar variable vwait while',
    +    contains: [
    +      hljs.COMMENT(';[ \\t]*#', '$'),
    +      hljs.COMMENT('^[ \\t]*#', '$'),
    +      {
    +        beginKeywords: 'proc',
    +        end: '[\\{]',
    +        excludeEnd: true,
    +        contains: [
    +          {
    +            className: 'title',
    +            begin: '[ \\t\\n\\r]+(::)?[a-zA-Z_]((::)?[a-zA-Z0-9_])*',
    +            end: '[ \\t\\n\\r]',
    +            endsWithParent: true,
    +            excludeEnd: true
    +          }
    +        ]
    +      },
    +      {
    +        excludeEnd: true,
    +        variants: [
    +          {
    +            begin: '\\$(\\{)?(::)?[a-zA-Z_]((::)?[a-zA-Z0-9_])*\\(([a-zA-Z0-9_])*\\)',
    +            end: '[^a-zA-Z0-9_\\}\\$]'
    +          },
    +          {
    +            begin: '\\$(\\{)?(::)?[a-zA-Z_]((::)?[a-zA-Z0-9_])*',
    +            end: '(\\))?[^a-zA-Z0-9_\\}\\$]'
    +          }
    +        ]
    +      },
    +      {
    +        className: 'string',
    +        contains: [hljs.BACKSLASH_ESCAPE],
    +        variants: [
    +          hljs.inherit(hljs.QUOTE_STRING_MODE, {illegal: null})
    +        ]
    +      },
    +      {
    +        className: 'number',
    +        variants: [hljs.BINARY_NUMBER_MODE, hljs.C_NUMBER_MODE]
    +      }
    +    ]
    +  }
    +}
    +
    +module.exports = tcl;
    diff --git a/node_modules/highlight.js/lib/languages/thrift.js b/node_modules/highlight.js/lib/languages/thrift.js
    new file mode 100644
    index 0000000..7d05b87
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/thrift.js
    @@ -0,0 +1,51 @@
    +/*
    +Language: Thrift
    +Author: Oleg Efimov 
    +Description: Thrift message definition format
    +Website: https://thrift.apache.org
    +Category: protocols
    +*/
    +
    +function thrift(hljs) {
    +  const BUILT_IN_TYPES = 'bool byte i16 i32 i64 double string binary';
    +  return {
    +    name: 'Thrift',
    +    keywords: {
    +      keyword:
    +        'namespace const typedef struct enum service exception void oneway set list map required optional',
    +      built_in:
    +        BUILT_IN_TYPES,
    +      literal:
    +        'true false'
    +    },
    +    contains: [
    +      hljs.QUOTE_STRING_MODE,
    +      hljs.NUMBER_MODE,
    +      hljs.C_LINE_COMMENT_MODE,
    +      hljs.C_BLOCK_COMMENT_MODE,
    +      {
    +        className: 'class',
    +        beginKeywords: 'struct enum service exception',
    +        end: /\{/,
    +        illegal: /\n/,
    +        contains: [
    +          hljs.inherit(hljs.TITLE_MODE, {
    +            // hack: eating everything after the first title
    +            starts: {
    +              endsWithParent: true,
    +              excludeEnd: true
    +            }
    +          })
    +        ]
    +      },
    +      {
    +        begin: '\\b(set|list|map)\\s*<',
    +        end: '>',
    +        keywords: BUILT_IN_TYPES,
    +        contains: [ 'self' ]
    +      }
    +    ]
    +  };
    +}
    +
    +module.exports = thrift;
    diff --git a/node_modules/highlight.js/lib/languages/tp.js b/node_modules/highlight.js/lib/languages/tp.js
    new file mode 100644
    index 0000000..58b4d43
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/tp.js
    @@ -0,0 +1,95 @@
    +/*
    +Language: TP
    +Author: Jay Strybis 
    +Description: FANUC TP programming language (TPP).
    +*/
    +
    +function tp(hljs) {
    +  const TPID = {
    +    className: 'number',
    +    begin: '[1-9][0-9]*', /* no leading zeros */
    +    relevance: 0
    +  };
    +  const TPLABEL = {
    +    className: 'symbol',
    +    begin: ':[^\\]]+'
    +  };
    +  const TPDATA = {
    +    className: 'built_in',
    +    begin: '(AR|P|PAYLOAD|PR|R|SR|RSR|LBL|VR|UALM|MESSAGE|UTOOL|UFRAME|TIMER|' +
    +    'TIMER_OVERFLOW|JOINT_MAX_SPEED|RESUME_PROG|DIAG_REC)\\[',
    +    end: '\\]',
    +    contains: [
    +      'self',
    +      TPID,
    +      TPLABEL
    +    ]
    +  };
    +  const TPIO = {
    +    className: 'built_in',
    +    begin: '(AI|AO|DI|DO|F|RI|RO|UI|UO|GI|GO|SI|SO)\\[',
    +    end: '\\]',
    +    contains: [
    +      'self',
    +      TPID,
    +      hljs.QUOTE_STRING_MODE, /* for pos section at bottom */
    +      TPLABEL
    +    ]
    +  };
    +
    +  return {
    +    name: 'TP',
    +    keywords: {
    +      keyword:
    +        'ABORT ACC ADJUST AND AP_LD BREAK CALL CNT COL CONDITION CONFIG DA DB ' +
    +        'DIV DETECT ELSE END ENDFOR ERR_NUM ERROR_PROG FINE FOR GP GUARD INC ' +
    +        'IF JMP LINEAR_MAX_SPEED LOCK MOD MONITOR OFFSET Offset OR OVERRIDE ' +
    +        'PAUSE PREG PTH RT_LD RUN SELECT SKIP Skip TA TB TO TOOL_OFFSET ' +
    +        'Tool_Offset UF UT UFRAME_NUM UTOOL_NUM UNLOCK WAIT X Y Z W P R STRLEN ' +
    +        'SUBSTR FINDSTR VOFFSET PROG ATTR MN POS',
    +      literal:
    +        'ON OFF max_speed LPOS JPOS ENABLE DISABLE START STOP RESET'
    +    },
    +    contains: [
    +      TPDATA,
    +      TPIO,
    +      {
    +        className: 'keyword',
    +        begin: '/(PROG|ATTR|MN|POS|END)\\b'
    +      },
    +      {
    +        /* this is for cases like ,CALL */
    +        className: 'keyword',
    +        begin: '(CALL|RUN|POINT_LOGIC|LBL)\\b'
    +      },
    +      {
    +        /* this is for cases like CNT100 where the default lexemes do not
    +         * separate the keyword and the number */
    +        className: 'keyword',
    +        begin: '\\b(ACC|CNT|Skip|Offset|PSPD|RT_LD|AP_LD|Tool_Offset)'
    +      },
    +      {
    +        /* to catch numbers that do not have a word boundary on the left */
    +        className: 'number',
    +        begin: '\\d+(sec|msec|mm/sec|cm/min|inch/min|deg/sec|mm|in|cm)?\\b',
    +        relevance: 0
    +      },
    +      hljs.COMMENT('//', '[;$]'),
    +      hljs.COMMENT('!', '[;$]'),
    +      hljs.COMMENT('--eg:', '$'),
    +      hljs.QUOTE_STRING_MODE,
    +      {
    +        className: 'string',
    +        begin: '\'',
    +        end: '\''
    +      },
    +      hljs.C_NUMBER_MODE,
    +      {
    +        className: 'variable',
    +        begin: '\\$[A-Za-z0-9_]+'
    +      }
    +    ]
    +  };
    +}
    +
    +module.exports = tp;
    diff --git a/node_modules/highlight.js/lib/languages/twig.js b/node_modules/highlight.js/lib/languages/twig.js
    new file mode 100644
    index 0000000..216c8b1
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/twig.js
    @@ -0,0 +1,77 @@
    +/*
    +Language: Twig
    +Requires: xml.js
    +Author: Luke Holder 
    +Description: Twig is a templating language for PHP
    +Website: https://twig.symfony.com
    +Category: template
    +*/
    +
    +function twig(hljs) {
    +  var PARAMS = {
    +    className: 'params',
    +    begin: '\\(', end: '\\)'
    +  };
    +
    +  var FUNCTION_NAMES = 'attribute block constant cycle date dump include ' +
    +                  'max min parent random range source template_from_string';
    +
    +  var FUNCTIONS = {
    +    beginKeywords: FUNCTION_NAMES,
    +    keywords: {name: FUNCTION_NAMES},
    +    relevance: 0,
    +    contains: [
    +      PARAMS
    +    ]
    +  };
    +
    +  var FILTER = {
    +    begin: /\|[A-Za-z_]+:?/,
    +    keywords:
    +      'abs batch capitalize column convert_encoding date date_modify default ' +
    +      'escape filter first format inky_to_html inline_css join json_encode keys last ' +
    +      'length lower map markdown merge nl2br number_format raw reduce replace ' +
    +      'reverse round slice sort spaceless split striptags title trim upper url_encode',
    +    contains: [
    +      FUNCTIONS
    +    ]
    +  };
    +
    +  var TAGS = 'apply autoescape block deprecated do embed extends filter flush for from ' +
    +    'if import include macro sandbox set use verbatim with';
    +
    +  TAGS = TAGS + ' ' + TAGS.split(' ').map(function(t){return 'end' + t}).join(' ');
    +
    +  return {
    +    name: 'Twig',
    +    aliases: ['craftcms'],
    +    case_insensitive: true,
    +    subLanguage: 'xml',
    +    contains: [
    +      hljs.COMMENT(/\{#/, /#\}/),
    +      {
    +        className: 'template-tag',
    +        begin: /\{%/, end: /%\}/,
    +        contains: [
    +          {
    +            className: 'name',
    +            begin: /\w+/,
    +            keywords: TAGS,
    +            starts: {
    +              endsWithParent: true,
    +              contains: [FILTER, FUNCTIONS],
    +              relevance: 0
    +            }
    +          }
    +        ]
    +      },
    +      {
    +        className: 'template-variable',
    +        begin: /\{\{/, end: /\}\}/,
    +        contains: ['self', FILTER, FUNCTIONS]
    +      }
    +    ]
    +  };
    +}
    +
    +module.exports = twig;
    diff --git a/node_modules/highlight.js/lib/languages/typescript.js b/node_modules/highlight.js/lib/languages/typescript.js
    new file mode 100644
    index 0000000..2b65ab2
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/typescript.js
    @@ -0,0 +1,694 @@
    +const IDENT_RE = '[A-Za-z$_][0-9A-Za-z$_]*';
    +const KEYWORDS = [
    +  "as", // for exports
    +  "in",
    +  "of",
    +  "if",
    +  "for",
    +  "while",
    +  "finally",
    +  "var",
    +  "new",
    +  "function",
    +  "do",
    +  "return",
    +  "void",
    +  "else",
    +  "break",
    +  "catch",
    +  "instanceof",
    +  "with",
    +  "throw",
    +  "case",
    +  "default",
    +  "try",
    +  "switch",
    +  "continue",
    +  "typeof",
    +  "delete",
    +  "let",
    +  "yield",
    +  "const",
    +  "class",
    +  // JS handles these with a special rule
    +  // "get",
    +  // "set",
    +  "debugger",
    +  "async",
    +  "await",
    +  "static",
    +  "import",
    +  "from",
    +  "export",
    +  "extends"
    +];
    +const LITERALS = [
    +  "true",
    +  "false",
    +  "null",
    +  "undefined",
    +  "NaN",
    +  "Infinity"
    +];
    +
    +const TYPES = [
    +  "Intl",
    +  "DataView",
    +  "Number",
    +  "Math",
    +  "Date",
    +  "String",
    +  "RegExp",
    +  "Object",
    +  "Function",
    +  "Boolean",
    +  "Error",
    +  "Symbol",
    +  "Set",
    +  "Map",
    +  "WeakSet",
    +  "WeakMap",
    +  "Proxy",
    +  "Reflect",
    +  "JSON",
    +  "Promise",
    +  "Float64Array",
    +  "Int16Array",
    +  "Int32Array",
    +  "Int8Array",
    +  "Uint16Array",
    +  "Uint32Array",
    +  "Float32Array",
    +  "Array",
    +  "Uint8Array",
    +  "Uint8ClampedArray",
    +  "ArrayBuffer"
    +];
    +
    +const ERROR_TYPES = [
    +  "EvalError",
    +  "InternalError",
    +  "RangeError",
    +  "ReferenceError",
    +  "SyntaxError",
    +  "TypeError",
    +  "URIError"
    +];
    +
    +const BUILT_IN_GLOBALS = [
    +  "setInterval",
    +  "setTimeout",
    +  "clearInterval",
    +  "clearTimeout",
    +
    +  "require",
    +  "exports",
    +
    +  "eval",
    +  "isFinite",
    +  "isNaN",
    +  "parseFloat",
    +  "parseInt",
    +  "decodeURI",
    +  "decodeURIComponent",
    +  "encodeURI",
    +  "encodeURIComponent",
    +  "escape",
    +  "unescape"
    +];
    +
    +const BUILT_IN_VARIABLES = [
    +  "arguments",
    +  "this",
    +  "super",
    +  "console",
    +  "window",
    +  "document",
    +  "localStorage",
    +  "module",
    +  "global" // Node.js
    +];
    +
    +const BUILT_INS = [].concat(
    +  BUILT_IN_GLOBALS,
    +  BUILT_IN_VARIABLES,
    +  TYPES,
    +  ERROR_TYPES
    +);
    +
    +/**
    + * @param {string} value
    + * @returns {RegExp}
    + * */
    +
    +/**
    + * @param {RegExp | string } re
    + * @returns {string}
    + */
    +function source(re) {
    +  if (!re) return null;
    +  if (typeof re === "string") return re;
    +
    +  return re.source;
    +}
    +
    +/**
    + * @param {RegExp | string } re
    + * @returns {string}
    + */
    +function lookahead(re) {
    +  return concat('(?=', re, ')');
    +}
    +
    +/**
    + * @param {...(RegExp | string) } args
    + * @returns {string}
    + */
    +function concat(...args) {
    +  const joined = args.map((x) => source(x)).join("");
    +  return joined;
    +}
    +
    +/*
    +Language: JavaScript
    +Description: JavaScript (JS) is a lightweight, interpreted, or just-in-time compiled programming language with first-class functions.
    +Category: common, scripting
    +Website: https://developer.mozilla.org/en-US/docs/Web/JavaScript
    +*/
    +
    +/** @type LanguageFn */
    +function javascript(hljs) {
    +  /**
    +   * Takes a string like " {
    +    const tag = "',
    +    end: ''
    +  };
    +  const XML_TAG = {
    +    begin: /<[A-Za-z0-9\\._:-]+/,
    +    end: /\/[A-Za-z0-9\\._:-]+>|\/>/,
    +    /**
    +     * @param {RegExpMatchArray} match
    +     * @param {CallbackResponse} response
    +     */
    +    isTrulyOpeningTag: (match, response) => {
    +      const afterMatchIndex = match[0].length + match.index;
    +      const nextChar = match.input[afterMatchIndex];
    +      // nested type?
    +      // HTML should not include another raw `<` inside a tag
    +      // But a type might: `>`, etc.
    +      if (nextChar === "<") {
    +        response.ignoreMatch();
    +        return;
    +      }
    +      // 
    +      // This is now either a tag or a type.
    +      if (nextChar === ">") {
    +        // if we cannot find a matching closing tag, then we
    +        // will ignore it
    +        if (!hasClosingTag(match, { after: afterMatchIndex })) {
    +          response.ignoreMatch();
    +        }
    +      }
    +    }
    +  };
    +  const KEYWORDS$1 = {
    +    $pattern: IDENT_RE,
    +    keyword: KEYWORDS.join(" "),
    +    literal: LITERALS.join(" "),
    +    built_in: BUILT_INS.join(" ")
    +  };
    +
    +  // https://tc39.es/ecma262/#sec-literals-numeric-literals
    +  const decimalDigits = '[0-9](_?[0-9])*';
    +  const frac = `\\.(${decimalDigits})`;
    +  // DecimalIntegerLiteral, including Annex B NonOctalDecimalIntegerLiteral
    +  // https://tc39.es/ecma262/#sec-additional-syntax-numeric-literals
    +  const decimalInteger = `0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*`;
    +  const NUMBER = {
    +    className: 'number',
    +    variants: [
    +      // DecimalLiteral
    +      { begin: `(\\b(${decimalInteger})((${frac})|\\.)?|(${frac}))` +
    +        `[eE][+-]?(${decimalDigits})\\b` },
    +      { begin: `\\b(${decimalInteger})\\b((${frac})\\b|\\.)?|(${frac})\\b` },
    +
    +      // DecimalBigIntegerLiteral
    +      { begin: `\\b(0|[1-9](_?[0-9])*)n\\b` },
    +
    +      // NonDecimalIntegerLiteral
    +      { begin: "\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b" },
    +      { begin: "\\b0[bB][0-1](_?[0-1])*n?\\b" },
    +      { begin: "\\b0[oO][0-7](_?[0-7])*n?\\b" },
    +
    +      // LegacyOctalIntegerLiteral (does not include underscore separators)
    +      // https://tc39.es/ecma262/#sec-additional-syntax-numeric-literals
    +      { begin: "\\b0[0-7]+n?\\b" },
    +    ],
    +    relevance: 0
    +  };
    +
    +  const SUBST = {
    +    className: 'subst',
    +    begin: '\\$\\{',
    +    end: '\\}',
    +    keywords: KEYWORDS$1,
    +    contains: [] // defined later
    +  };
    +  const HTML_TEMPLATE = {
    +    begin: 'html`',
    +    end: '',
    +    starts: {
    +      end: '`',
    +      returnEnd: false,
    +      contains: [
    +        hljs.BACKSLASH_ESCAPE,
    +        SUBST
    +      ],
    +      subLanguage: 'xml'
    +    }
    +  };
    +  const CSS_TEMPLATE = {
    +    begin: 'css`',
    +    end: '',
    +    starts: {
    +      end: '`',
    +      returnEnd: false,
    +      contains: [
    +        hljs.BACKSLASH_ESCAPE,
    +        SUBST
    +      ],
    +      subLanguage: 'css'
    +    }
    +  };
    +  const TEMPLATE_STRING = {
    +    className: 'string',
    +    begin: '`',
    +    end: '`',
    +    contains: [
    +      hljs.BACKSLASH_ESCAPE,
    +      SUBST
    +    ]
    +  };
    +  const JSDOC_COMMENT = hljs.COMMENT(
    +    '/\\*\\*',
    +    '\\*/',
    +    {
    +      relevance: 0,
    +      contains: [
    +        {
    +          className: 'doctag',
    +          begin: '@[A-Za-z]+',
    +          contains: [
    +            {
    +              className: 'type',
    +              begin: '\\{',
    +              end: '\\}',
    +              relevance: 0
    +            },
    +            {
    +              className: 'variable',
    +              begin: IDENT_RE$1 + '(?=\\s*(-)|$)',
    +              endsParent: true,
    +              relevance: 0
    +            },
    +            // eat spaces (not newlines) so we can find
    +            // types or variables
    +            {
    +              begin: /(?=[^\n])\s/,
    +              relevance: 0
    +            }
    +          ]
    +        }
    +      ]
    +    }
    +  );
    +  const COMMENT = {
    +    className: "comment",
    +    variants: [
    +      JSDOC_COMMENT,
    +      hljs.C_BLOCK_COMMENT_MODE,
    +      hljs.C_LINE_COMMENT_MODE
    +    ]
    +  };
    +  const SUBST_INTERNALS = [
    +    hljs.APOS_STRING_MODE,
    +    hljs.QUOTE_STRING_MODE,
    +    HTML_TEMPLATE,
    +    CSS_TEMPLATE,
    +    TEMPLATE_STRING,
    +    NUMBER,
    +    hljs.REGEXP_MODE
    +  ];
    +  SUBST.contains = SUBST_INTERNALS
    +    .concat({
    +      // we need to pair up {} inside our subst to prevent
    +      // it from ending too early by matching another }
    +      begin: /\{/,
    +      end: /\}/,
    +      keywords: KEYWORDS$1,
    +      contains: [
    +        "self"
    +      ].concat(SUBST_INTERNALS)
    +    });
    +  const SUBST_AND_COMMENTS = [].concat(COMMENT, SUBST.contains);
    +  const PARAMS_CONTAINS = SUBST_AND_COMMENTS.concat([
    +    // eat recursive parens in sub expressions
    +    {
    +      begin: /\(/,
    +      end: /\)/,
    +      keywords: KEYWORDS$1,
    +      contains: ["self"].concat(SUBST_AND_COMMENTS)
    +    }
    +  ]);
    +  const PARAMS = {
    +    className: 'params',
    +    begin: /\(/,
    +    end: /\)/,
    +    excludeBegin: true,
    +    excludeEnd: true,
    +    keywords: KEYWORDS$1,
    +    contains: PARAMS_CONTAINS
    +  };
    +
    +  return {
    +    name: 'Javascript',
    +    aliases: ['js', 'jsx', 'mjs', 'cjs'],
    +    keywords: KEYWORDS$1,
    +    // this will be extended by TypeScript
    +    exports: { PARAMS_CONTAINS },
    +    illegal: /#(?![$_A-z])/,
    +    contains: [
    +      hljs.SHEBANG({
    +        label: "shebang",
    +        binary: "node",
    +        relevance: 5
    +      }),
    +      {
    +        label: "use_strict",
    +        className: 'meta',
    +        relevance: 10,
    +        begin: /^\s*['"]use (strict|asm)['"]/
    +      },
    +      hljs.APOS_STRING_MODE,
    +      hljs.QUOTE_STRING_MODE,
    +      HTML_TEMPLATE,
    +      CSS_TEMPLATE,
    +      TEMPLATE_STRING,
    +      COMMENT,
    +      NUMBER,
    +      { // object attr container
    +        begin: concat(/[{,\n]\s*/,
    +          // we need to look ahead to make sure that we actually have an
    +          // attribute coming up so we don't steal a comma from a potential
    +          // "value" container
    +          //
    +          // NOTE: this might not work how you think.  We don't actually always
    +          // enter this mode and stay.  Instead it might merely match `,
    +          // ` and then immediately end after the , because it
    +          // fails to find any actual attrs. But this still does the job because
    +          // it prevents the value contain rule from grabbing this instead and
    +          // prevening this rule from firing when we actually DO have keys.
    +          lookahead(concat(
    +            // we also need to allow for multiple possible comments inbetween
    +            // the first key:value pairing
    +            /(((\/\/.*$)|(\/\*(\*[^/]|[^*])*\*\/))\s*)*/,
    +            IDENT_RE$1 + '\\s*:'))),
    +        relevance: 0,
    +        contains: [
    +          {
    +            className: 'attr',
    +            begin: IDENT_RE$1 + lookahead('\\s*:'),
    +            relevance: 0
    +          }
    +        ]
    +      },
    +      { // "value" container
    +        begin: '(' + hljs.RE_STARTERS_RE + '|\\b(case|return|throw)\\b)\\s*',
    +        keywords: 'return throw case',
    +        contains: [
    +          COMMENT,
    +          hljs.REGEXP_MODE,
    +          {
    +            className: 'function',
    +            // we have to count the parens to make sure we actually have the
    +            // correct bounding ( ) before the =>.  There could be any number of
    +            // sub-expressions inside also surrounded by parens.
    +            begin: '(\\(' +
    +            '[^()]*(\\(' +
    +            '[^()]*(\\(' +
    +            '[^()]*' +
    +            '\\)[^()]*)*' +
    +            '\\)[^()]*)*' +
    +            '\\)|' + hljs.UNDERSCORE_IDENT_RE + ')\\s*=>',
    +            returnBegin: true,
    +            end: '\\s*=>',
    +            contains: [
    +              {
    +                className: 'params',
    +                variants: [
    +                  {
    +                    begin: hljs.UNDERSCORE_IDENT_RE,
    +                    relevance: 0
    +                  },
    +                  {
    +                    className: null,
    +                    begin: /\(\s*\)/,
    +                    skip: true
    +                  },
    +                  {
    +                    begin: /\(/,
    +                    end: /\)/,
    +                    excludeBegin: true,
    +                    excludeEnd: true,
    +                    keywords: KEYWORDS$1,
    +                    contains: PARAMS_CONTAINS
    +                  }
    +                ]
    +              }
    +            ]
    +          },
    +          { // could be a comma delimited list of params to a function call
    +            begin: /,/, relevance: 0
    +          },
    +          {
    +            className: '',
    +            begin: /\s/,
    +            end: /\s*/,
    +            skip: true
    +          },
    +          { // JSX
    +            variants: [
    +              { begin: FRAGMENT.begin, end: FRAGMENT.end },
    +              {
    +                begin: XML_TAG.begin,
    +                // we carefully check the opening tag to see if it truly
    +                // is a tag and not a false positive
    +                'on:begin': XML_TAG.isTrulyOpeningTag,
    +                end: XML_TAG.end
    +              }
    +            ],
    +            subLanguage: 'xml',
    +            contains: [
    +              {
    +                begin: XML_TAG.begin,
    +                end: XML_TAG.end,
    +                skip: true,
    +                contains: ['self']
    +              }
    +            ]
    +          }
    +        ],
    +        relevance: 0
    +      },
    +      {
    +        className: 'function',
    +        beginKeywords: 'function',
    +        end: /[{;]/,
    +        excludeEnd: true,
    +        keywords: KEYWORDS$1,
    +        contains: [
    +          'self',
    +          hljs.inherit(hljs.TITLE_MODE, { begin: IDENT_RE$1 }),
    +          PARAMS
    +        ],
    +        illegal: /%/
    +      },
    +      {
    +        // prevent this from getting swallowed up by function
    +        // since they appear "function like"
    +        beginKeywords: "while if switch catch for"
    +      },
    +      {
    +        className: 'function',
    +        // we have to count the parens to make sure we actually have the correct
    +        // bounding ( ).  There could be any number of sub-expressions inside
    +        // also surrounded by parens.
    +        begin: hljs.UNDERSCORE_IDENT_RE +
    +          '\\(' + // first parens
    +          '[^()]*(\\(' +
    +            '[^()]*(\\(' +
    +              '[^()]*' +
    +            '\\)[^()]*)*' +
    +          '\\)[^()]*)*' +
    +          '\\)\\s*\\{', // end parens
    +        returnBegin:true,
    +        contains: [
    +          PARAMS,
    +          hljs.inherit(hljs.TITLE_MODE, { begin: IDENT_RE$1 }),
    +        ]
    +      },
    +      // hack: prevents detection of keywords in some circumstances
    +      // .keyword()
    +      // $keyword = x
    +      {
    +        variants: [
    +          { begin: '\\.' + IDENT_RE$1 },
    +          { begin: '\\$' + IDENT_RE$1 }
    +        ],
    +        relevance: 0
    +      },
    +      { // ES6 class
    +        className: 'class',
    +        beginKeywords: 'class',
    +        end: /[{;=]/,
    +        excludeEnd: true,
    +        illegal: /[:"[\]]/,
    +        contains: [
    +          { beginKeywords: 'extends' },
    +          hljs.UNDERSCORE_TITLE_MODE
    +        ]
    +      },
    +      {
    +        begin: /\b(?=constructor)/,
    +        end: /[{;]/,
    +        excludeEnd: true,
    +        contains: [
    +          hljs.inherit(hljs.TITLE_MODE, { begin: IDENT_RE$1 }),
    +          'self',
    +          PARAMS
    +        ]
    +      },
    +      {
    +        begin: '(get|set)\\s+(?=' + IDENT_RE$1 + '\\()',
    +        end: /\{/,
    +        keywords: "get set",
    +        contains: [
    +          hljs.inherit(hljs.TITLE_MODE, { begin: IDENT_RE$1 }),
    +          { begin: /\(\)/ }, // eat to avoid empty params
    +          PARAMS
    +        ]
    +      },
    +      {
    +        begin: /\$[(.]/ // relevance booster for a pattern common to JS libs: `$(something)` and `$.something`
    +      }
    +    ]
    +  };
    +}
    +
    +/*
    +Language: TypeScript
    +Author: Panu Horsmalahti 
    +Contributors: Ike Ku 
    +Description: TypeScript is a strict superset of JavaScript
    +Website: https://www.typescriptlang.org
    +Category: common, scripting
    +*/
    +
    +/** @type LanguageFn */
    +function typescript(hljs) {
    +  const IDENT_RE$1 = IDENT_RE;
    +  const NAMESPACE = {
    +    beginKeywords: 'namespace', end: /\{/, excludeEnd: true
    +  };
    +  const INTERFACE = {
    +    beginKeywords: 'interface', end: /\{/, excludeEnd: true,
    +    keywords: 'interface extends'
    +  };
    +  const USE_STRICT = {
    +    className: 'meta',
    +    relevance: 10,
    +    begin: /^\s*['"]use strict['"]/
    +  };
    +  const TYPES = [
    +    "any",
    +    "void",
    +    "number",
    +    "boolean",
    +    "string",
    +    "object",
    +    "never",
    +    "enum"
    +  ];
    +  const TS_SPECIFIC_KEYWORDS = [
    +    "type",
    +    "namespace",
    +    "typedef",
    +    "interface",
    +    "public",
    +    "private",
    +    "protected",
    +    "implements",
    +    "declare",
    +    "abstract",
    +    "readonly"
    +  ];
    +  const KEYWORDS$1 = {
    +    $pattern: IDENT_RE,
    +    keyword: KEYWORDS.concat(TS_SPECIFIC_KEYWORDS).join(" "),
    +    literal: LITERALS.join(" "),
    +    built_in: BUILT_INS.concat(TYPES).join(" ")
    +  };
    +  const DECORATOR = {
    +    className: 'meta',
    +    begin: '@' + IDENT_RE$1,
    +  };
    +
    +  const swapMode = (mode, label, replacement) => {
    +    const indx = mode.contains.findIndex(m => m.label === label);
    +    if (indx === -1) { throw new Error("can not find mode to replace"); }
    +    mode.contains.splice(indx, 1, replacement);
    +  };
    +
    +  const tsLanguage = javascript(hljs);
    +
    +  // this should update anywhere keywords is used since
    +  // it will be the same actual JS object
    +  Object.assign(tsLanguage.keywords, KEYWORDS$1);
    +
    +  tsLanguage.exports.PARAMS_CONTAINS.push(DECORATOR);
    +  tsLanguage.contains = tsLanguage.contains.concat([
    +    DECORATOR,
    +    NAMESPACE,
    +    INTERFACE,
    +  ]);
    +
    +  // TS gets a simpler shebang rule than JS
    +  swapMode(tsLanguage, "shebang", hljs.SHEBANG());
    +  // JS use strict rule purposely excludes `asm` which makes no sense
    +  swapMode(tsLanguage, "use_strict", USE_STRICT);
    +
    +  const functionDeclaration = tsLanguage.contains.find(m => m.className === "function");
    +  functionDeclaration.relevance = 0; // () => {} is more typical in TypeScript
    +
    +  Object.assign(tsLanguage, {
    +    name: 'TypeScript',
    +    aliases: ['ts']
    +  });
    +
    +  return tsLanguage;
    +}
    +
    +module.exports = typescript;
    diff --git a/node_modules/highlight.js/lib/languages/vala.js b/node_modules/highlight.js/lib/languages/vala.js
    new file mode 100644
    index 0000000..e3a577d
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/vala.js
    @@ -0,0 +1,61 @@
    +/*
    +Language: Vala
    +Author: Antono Vasiljev 
    +Description: Vala is a new programming language that aims to bring modern programming language features to GNOME developers without imposing any additional runtime requirements and without using a different ABI compared to applications and libraries written in C.
    +Website: https://wiki.gnome.org/Projects/Vala
    +*/
    +
    +function vala(hljs) {
    +  return {
    +    name: 'Vala',
    +    keywords: {
    +      keyword:
    +        // Value types
    +        'char uchar unichar int uint long ulong short ushort int8 int16 int32 int64 uint8 ' +
    +        'uint16 uint32 uint64 float double bool struct enum string void ' +
    +        // Reference types
    +        'weak unowned owned ' +
    +        // Modifiers
    +        'async signal static abstract interface override virtual delegate ' +
    +        // Control Structures
    +        'if while do for foreach else switch case break default return try catch ' +
    +        // Visibility
    +        'public private protected internal ' +
    +        // Other
    +        'using new this get set const stdout stdin stderr var',
    +      built_in:
    +        'DBus GLib CCode Gee Object Gtk Posix',
    +      literal:
    +        'false true null'
    +    },
    +    contains: [
    +      {
    +        className: 'class',
    +        beginKeywords: 'class interface namespace',
    +        end: /\{/,
    +        excludeEnd: true,
    +        illegal: '[^,:\\n\\s\\.]',
    +        contains: [ hljs.UNDERSCORE_TITLE_MODE ]
    +      },
    +      hljs.C_LINE_COMMENT_MODE,
    +      hljs.C_BLOCK_COMMENT_MODE,
    +      {
    +        className: 'string',
    +        begin: '"""',
    +        end: '"""',
    +        relevance: 5
    +      },
    +      hljs.APOS_STRING_MODE,
    +      hljs.QUOTE_STRING_MODE,
    +      hljs.C_NUMBER_MODE,
    +      {
    +        className: 'meta',
    +        begin: '^#',
    +        end: '$',
    +        relevance: 2
    +      }
    +    ]
    +  };
    +}
    +
    +module.exports = vala;
    diff --git a/node_modules/highlight.js/lib/languages/vbnet.js b/node_modules/highlight.js/lib/languages/vbnet.js
    new file mode 100644
    index 0000000..83f8896
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/vbnet.js
    @@ -0,0 +1,75 @@
    +/*
    +Language: Visual Basic .NET
    +Description: Visual Basic .NET (VB.NET) is a multi-paradigm, object-oriented programming language, implemented on the .NET Framework.
    +Author: Poren Chiang 
    +Website: https://docs.microsoft.com/en-us/dotnet/visual-basic/getting-started/
    +*/
    +
    +function vbnet(hljs) {
    +  return {
    +    name: 'Visual Basic .NET',
    +    aliases: [ 'vb' ],
    +    case_insensitive: true,
    +    keywords: {
    +      keyword:
    +        'addhandler addressof alias and andalso aggregate ansi as async assembly auto await binary by byref byval ' + /* a-b */
    +        'call case catch class compare const continue custom declare default delegate dim distinct do ' + /* c-d */
    +        'each equals else elseif end enum erase error event exit explicit finally for friend from function ' + /* e-f */
    +        'get global goto group handles if implements imports in inherits interface into is isfalse isnot istrue iterator ' + /* g-i */
    +        'join key let lib like loop me mid mod module mustinherit mustoverride mybase myclass ' + /* j-m */
    +        'nameof namespace narrowing new next not notinheritable notoverridable ' + /* n */
    +        'of off on operator option optional or order orelse overloads overridable overrides ' + /* o */
    +        'paramarray partial preserve private property protected public ' + /* p */
    +        'raiseevent readonly redim rem removehandler resume return ' + /* r */
    +        'select set shadows shared skip static step stop structure strict sub synclock ' + /* s */
    +        'take text then throw to try unicode until using when where while widening with withevents writeonly xor yield', /* t-y */
    +      built_in:
    +        'boolean byte cbool cbyte cchar cdate cdec cdbl char cint clng cobj csbyte cshort csng cstr ctype ' + /* b-c */
    +        'date decimal directcast double gettype getxmlnamespace iif integer long object ' + /* d-o */
    +        'sbyte short single string trycast typeof uinteger ulong ushort', /* s-u */
    +      literal:
    +        'true false nothing'
    +    },
    +    illegal: '//|\\{|\\}|endif|gosub|variant|wend|^\\$ ', /* reserved deprecated keywords */
    +    contains: [
    +      hljs.inherit(hljs.QUOTE_STRING_MODE, {
    +        contains: [
    +          {
    +            begin: '""'
    +          }
    +        ]
    +      }),
    +      hljs.COMMENT(
    +        '\'',
    +        '$',
    +        {
    +          returnBegin: true,
    +          contains: [
    +            {
    +              className: 'doctag',
    +              begin: '\'\'\'|',
    +              contains: [ hljs.PHRASAL_WORDS_MODE ]
    +            },
    +            {
    +              className: 'doctag',
    +              begin: '',
    +              contains: [ hljs.PHRASAL_WORDS_MODE ]
    +            }
    +          ]
    +        }
    +      ),
    +      hljs.C_NUMBER_MODE,
    +      {
    +        className: 'meta',
    +        begin: '#',
    +        end: '$',
    +        keywords: {
    +          'meta-keyword': 'if else elseif end region externalsource'
    +        }
    +      }
    +    ]
    +  };
    +}
    +
    +module.exports = vbnet;
    diff --git a/node_modules/highlight.js/lib/languages/vbscript-html.js b/node_modules/highlight.js/lib/languages/vbscript-html.js
    new file mode 100644
    index 0000000..24c1319
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/vbscript-html.js
    @@ -0,0 +1,24 @@
    +/*
    +Language: VBScript in HTML
    +Requires: xml.js, vbscript.js
    +Author: Ivan Sagalaev 
    +Description: "Bridge" language defining fragments of VBScript in HTML within <% .. %>
    +Website: https://en.wikipedia.org/wiki/VBScript
    +Category: scripting
    +*/
    +
    +function vbscriptHtml(hljs) {
    +  return {
    +    name: 'VBScript in HTML',
    +    subLanguage: 'xml',
    +    contains: [
    +      {
    +        begin: '<%',
    +        end: '%>',
    +        subLanguage: 'vbscript'
    +      }
    +    ]
    +  };
    +}
    +
    +module.exports = vbscriptHtml;
    diff --git a/node_modules/highlight.js/lib/languages/vbscript.js b/node_modules/highlight.js/lib/languages/vbscript.js
    new file mode 100644
    index 0000000..fe2d811
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/vbscript.js
    @@ -0,0 +1,109 @@
    +/**
    + * @param {string} value
    + * @returns {RegExp}
    + * */
    +
    +/**
    + * @param {RegExp | string } re
    + * @returns {string}
    + */
    +function source(re) {
    +  if (!re) return null;
    +  if (typeof re === "string") return re;
    +
    +  return re.source;
    +}
    +
    +/**
    + * @param {...(RegExp | string) } args
    + * @returns {string}
    + */
    +function concat(...args) {
    +  const joined = args.map((x) => source(x)).join("");
    +  return joined;
    +}
    +
    +/**
    + * Any of the passed expresssions may match
    + *
    + * Creates a huge this | this | that | that match
    + * @param {(RegExp | string)[] } args
    + * @returns {string}
    + */
    +function either(...args) {
    +  const joined = '(' + args.map((x) => source(x)).join("|") + ")";
    +  return joined;
    +}
    +
    +/*
    +Language: VBScript
    +Description: VBScript ("Microsoft Visual Basic Scripting Edition") is an Active Scripting language developed by Microsoft that is modeled on Visual Basic.
    +Author: Nikita Ledyaev 
    +Contributors: Michal Gabrukiewicz 
    +Website: https://en.wikipedia.org/wiki/VBScript
    +Category: scripting
    +*/
    +
    +/** @type LanguageFn */
    +function vbscript(hljs) {
    +  const BUILT_IN_FUNCTIONS = ('lcase month vartype instrrev ubound setlocale getobject rgb getref string ' +
    +  'weekdayname rnd dateadd monthname now day minute isarray cbool round formatcurrency ' +
    +  'conversions csng timevalue second year space abs clng timeserial fixs len asc ' +
    +  'isempty maths dateserial atn timer isobject filter weekday datevalue ccur isdate ' +
    +  'instr datediff formatdatetime replace isnull right sgn array snumeric log cdbl hex ' +
    +  'chr lbound msgbox ucase getlocale cos cdate cbyte rtrim join hour oct typename trim ' +
    +  'strcomp int createobject loadpicture tan formatnumber mid ' +
    +  'split  cint sin datepart ltrim sqr ' +
    +  'time derived eval date formatpercent exp inputbox left ascw ' +
    +  'chrw regexp cstr err').split(" ");
    +  const BUILT_IN_OBJECTS = [
    +    "server",
    +    "response",
    +    "request",
    +    // take no arguments so can be called without ()
    +    "scriptengine",
    +    "scriptenginebuildversion",
    +    "scriptengineminorversion",
    +    "scriptenginemajorversion"
    +  ];
    +
    +  const BUILT_IN_CALL = {
    +    begin: concat(either(...BUILT_IN_FUNCTIONS), "\\s*\\("),
    +    // relevance 0 because this is acting as a beginKeywords really
    +    relevance:0,
    +    keywords: {
    +      built_in: BUILT_IN_FUNCTIONS.join(" ")
    +    }
    +  };
    +
    +  return {
    +    name: 'VBScript',
    +    aliases: ['vbs'],
    +    case_insensitive: true,
    +    keywords: {
    +      keyword:
    +        'call class const dim do loop erase execute executeglobal exit for each next function ' +
    +        'if then else on error option explicit new private property let get public randomize ' +
    +        'redim rem select case set stop sub while wend with end to elseif is or xor and not ' +
    +        'class_initialize class_terminate default preserve in me byval byref step resume goto',
    +      built_in: BUILT_IN_OBJECTS.join(" "),
    +      literal:
    +        'true false null nothing empty'
    +    },
    +    illegal: '//',
    +    contains: [
    +      BUILT_IN_CALL,
    +      hljs.inherit(hljs.QUOTE_STRING_MODE, {contains: [{begin: '""'}]}),
    +      hljs.COMMENT(
    +        /'/,
    +        /$/,
    +        {
    +          relevance: 0
    +        }
    +      ),
    +      hljs.C_NUMBER_MODE
    +    ]
    +  };
    +}
    +
    +module.exports = vbscript;
    diff --git a/node_modules/highlight.js/lib/languages/verilog.js b/node_modules/highlight.js/lib/languages/verilog.js
    new file mode 100644
    index 0000000..b5435ee
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/verilog.js
    @@ -0,0 +1,131 @@
    +/*
    +Language: Verilog
    +Author: Jon Evans 
    +Contributors: Boone Severson 
    +Description: Verilog is a hardware description language used in electronic design automation to describe digital and mixed-signal systems. This highlighter supports Verilog and SystemVerilog through IEEE 1800-2012.
    +Website: http://www.verilog.com
    +*/
    +
    +function verilog(hljs) {
    +  const SV_KEYWORDS = {
    +    $pattern: /[\w\$]+/,
    +    keyword:
    +      'accept_on alias always always_comb always_ff always_latch and assert assign ' +
    +      'assume automatic before begin bind bins binsof bit break buf|0 bufif0 bufif1 ' +
    +      'byte case casex casez cell chandle checker class clocking cmos config const ' +
    +      'constraint context continue cover covergroup coverpoint cross deassign default ' +
    +      'defparam design disable dist do edge else end endcase endchecker endclass ' +
    +      'endclocking endconfig endfunction endgenerate endgroup endinterface endmodule ' +
    +      'endpackage endprimitive endprogram endproperty endspecify endsequence endtable ' +
    +      'endtask enum event eventually expect export extends extern final first_match for ' +
    +      'force foreach forever fork forkjoin function generate|5 genvar global highz0 highz1 ' +
    +      'if iff ifnone ignore_bins illegal_bins implements implies import incdir include ' +
    +      'initial inout input inside instance int integer interconnect interface intersect ' +
    +      'join join_any join_none large let liblist library local localparam logic longint ' +
    +      'macromodule matches medium modport module nand negedge nettype new nexttime nmos ' +
    +      'nor noshowcancelled not notif0 notif1 or output package packed parameter pmos ' +
    +      'posedge primitive priority program property protected pull0 pull1 pulldown pullup ' +
    +      'pulsestyle_ondetect pulsestyle_onevent pure rand randc randcase randsequence rcmos ' +
    +      'real realtime ref reg reject_on release repeat restrict return rnmos rpmos rtran ' +
    +      'rtranif0 rtranif1 s_always s_eventually s_nexttime s_until s_until_with scalared ' +
    +      'sequence shortint shortreal showcancelled signed small soft solve specify specparam ' +
    +      'static string strong strong0 strong1 struct super supply0 supply1 sync_accept_on ' +
    +      'sync_reject_on table tagged task this throughout time timeprecision timeunit tran ' +
    +      'tranif0 tranif1 tri tri0 tri1 triand trior trireg type typedef union unique unique0 ' +
    +      'unsigned until until_with untyped use uwire var vectored virtual void wait wait_order ' +
    +      'wand weak weak0 weak1 while wildcard wire with within wor xnor xor',
    +    literal:
    +      'null',
    +    built_in:
    +      '$finish $stop $exit $fatal $error $warning $info $realtime $time $printtimescale ' +
    +      '$bitstoreal $bitstoshortreal $itor $signed $cast $bits $stime $timeformat ' +
    +      '$realtobits $shortrealtobits $rtoi $unsigned $asserton $assertkill $assertpasson ' +
    +      '$assertfailon $assertnonvacuouson $assertoff $assertcontrol $assertpassoff ' +
    +      '$assertfailoff $assertvacuousoff $isunbounded $sampled $fell $changed $past_gclk ' +
    +      '$fell_gclk $changed_gclk $rising_gclk $steady_gclk $coverage_control ' +
    +      '$coverage_get $coverage_save $set_coverage_db_name $rose $stable $past ' +
    +      '$rose_gclk $stable_gclk $future_gclk $falling_gclk $changing_gclk $display ' +
    +      '$coverage_get_max $coverage_merge $get_coverage $load_coverage_db $typename ' +
    +      '$unpacked_dimensions $left $low $increment $clog2 $ln $log10 $exp $sqrt $pow ' +
    +      '$floor $ceil $sin $cos $tan $countbits $onehot $isunknown $fatal $warning ' +
    +      '$dimensions $right $high $size $asin $acos $atan $atan2 $hypot $sinh $cosh ' +
    +      '$tanh $asinh $acosh $atanh $countones $onehot0 $error $info $random ' +
    +      '$dist_chi_square $dist_erlang $dist_exponential $dist_normal $dist_poisson ' +
    +      '$dist_t $dist_uniform $q_initialize $q_remove $q_exam $async$and$array ' +
    +      '$async$nand$array $async$or$array $async$nor$array $sync$and$array ' +
    +      '$sync$nand$array $sync$or$array $sync$nor$array $q_add $q_full $psprintf ' +
    +      '$async$and$plane $async$nand$plane $async$or$plane $async$nor$plane ' +
    +      '$sync$and$plane $sync$nand$plane $sync$or$plane $sync$nor$plane $system ' +
    +      '$display $displayb $displayh $displayo $strobe $strobeb $strobeh $strobeo ' +
    +      '$write $readmemb $readmemh $writememh $value$plusargs ' +
    +      '$dumpvars $dumpon $dumplimit $dumpports $dumpportson $dumpportslimit ' +
    +      '$writeb $writeh $writeo $monitor $monitorb $monitorh $monitoro $writememb ' +
    +      '$dumpfile $dumpoff $dumpall $dumpflush $dumpportsoff $dumpportsall ' +
    +      '$dumpportsflush $fclose $fdisplay $fdisplayb $fdisplayh $fdisplayo ' +
    +      '$fstrobe $fstrobeb $fstrobeh $fstrobeo $swrite $swriteb $swriteh ' +
    +      '$swriteo $fscanf $fread $fseek $fflush $feof $fopen $fwrite $fwriteb ' +
    +      '$fwriteh $fwriteo $fmonitor $fmonitorb $fmonitorh $fmonitoro $sformat ' +
    +      '$sformatf $fgetc $ungetc $fgets $sscanf $rewind $ftell $ferror'
    +  };
    +
    +  return {
    +    name: 'Verilog',
    +    aliases: [
    +      'v',
    +      'sv',
    +      'svh'
    +    ],
    +    case_insensitive: false,
    +    keywords: SV_KEYWORDS,
    +    contains: [
    +      hljs.C_BLOCK_COMMENT_MODE,
    +      hljs.C_LINE_COMMENT_MODE,
    +      hljs.QUOTE_STRING_MODE,
    +      {
    +        className: 'number',
    +        contains: [ hljs.BACKSLASH_ESCAPE ],
    +        variants: [
    +          {
    +            begin: '\\b((\\d+\'(b|h|o|d|B|H|O|D))[0-9xzXZa-fA-F_]+)'
    +          },
    +          {
    +            begin: '\\B((\'(b|h|o|d|B|H|O|D))[0-9xzXZa-fA-F_]+)'
    +          },
    +          {
    +            begin: '\\b([0-9_])+',
    +            relevance: 0
    +          }
    +        ]
    +      },
    +      /* parameters to instances */
    +      {
    +        className: 'variable',
    +        variants: [
    +          {
    +            begin: '#\\((?!parameter).+\\)'
    +          },
    +          {
    +            begin: '\\.\\w+',
    +            relevance: 0
    +          }
    +        ]
    +      },
    +      {
    +        className: 'meta',
    +        begin: '`',
    +        end: '$',
    +        keywords: {
    +          'meta-keyword':
    +            'define __FILE__ ' +
    +            '__LINE__ begin_keywords celldefine default_nettype define ' +
    +            'else elsif end_keywords endcelldefine endif ifdef ifndef ' +
    +            'include line nounconnected_drive pragma resetall timescale ' +
    +            'unconnected_drive undef undefineall'
    +        },
    +        relevance: 0
    +      }
    +    ]
    +  };
    +}
    +
    +module.exports = verilog;
    diff --git a/node_modules/highlight.js/lib/languages/vhdl.js b/node_modules/highlight.js/lib/languages/vhdl.js
    new file mode 100644
    index 0000000..80966ad
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/vhdl.js
    @@ -0,0 +1,71 @@
    +/*
    +Language: VHDL
    +Author: Igor Kalnitsky 
    +Contributors: Daniel C.K. Kho , Guillaume Savaton 
    +Description: VHDL is a hardware description language used in electronic design automation to describe digital and mixed-signal systems.
    +Website: https://en.wikipedia.org/wiki/VHDL
    +*/
    +
    +function vhdl(hljs) {
    +  // Regular expression for VHDL numeric literals.
    +
    +  // Decimal literal:
    +  const INTEGER_RE = '\\d(_|\\d)*';
    +  const EXPONENT_RE = '[eE][-+]?' + INTEGER_RE;
    +  const DECIMAL_LITERAL_RE = INTEGER_RE + '(\\.' + INTEGER_RE + ')?' + '(' + EXPONENT_RE + ')?';
    +  // Based literal:
    +  const BASED_INTEGER_RE = '\\w+';
    +  const BASED_LITERAL_RE = INTEGER_RE + '#' + BASED_INTEGER_RE + '(\\.' + BASED_INTEGER_RE + ')?' + '#' + '(' + EXPONENT_RE + ')?';
    +
    +  const NUMBER_RE = '\\b(' + BASED_LITERAL_RE + '|' + DECIMAL_LITERAL_RE + ')';
    +
    +  return {
    +    name: 'VHDL',
    +    case_insensitive: true,
    +    keywords: {
    +      keyword:
    +        'abs access after alias all and architecture array assert assume assume_guarantee attribute ' +
    +        'begin block body buffer bus case component configuration constant context cover disconnect ' +
    +        'downto default else elsif end entity exit fairness file for force function generate ' +
    +        'generic group guarded if impure in inertial inout is label library linkage literal ' +
    +        'loop map mod nand new next nor not null of on open or others out package parameter port ' +
    +        'postponed procedure process property protected pure range record register reject ' +
    +        'release rem report restrict restrict_guarantee return rol ror select sequence ' +
    +        'severity shared signal sla sll sra srl strong subtype then to transport type ' +
    +        'unaffected units until use variable view vmode vprop vunit wait when while with xnor xor',
    +      built_in:
    +        'boolean bit character ' +
    +        'integer time delay_length natural positive ' +
    +        'string bit_vector file_open_kind file_open_status ' +
    +        'std_logic std_logic_vector unsigned signed boolean_vector integer_vector ' +
    +        'std_ulogic std_ulogic_vector unresolved_unsigned u_unsigned unresolved_signed u_signed ' +
    +        'real_vector time_vector',
    +      literal:
    +        'false true note warning error failure ' + // severity_level
    +        'line text side width' // textio
    +    },
    +    illegal: /\{/,
    +    contains: [
    +      hljs.C_BLOCK_COMMENT_MODE, // VHDL-2008 block commenting.
    +      hljs.COMMENT('--', '$'),
    +      hljs.QUOTE_STRING_MODE,
    +      {
    +        className: 'number',
    +        begin: NUMBER_RE,
    +        relevance: 0
    +      },
    +      {
    +        className: 'string',
    +        begin: '\'(U|X|0|1|Z|W|L|H|-)\'',
    +        contains: [ hljs.BACKSLASH_ESCAPE ]
    +      },
    +      {
    +        className: 'symbol',
    +        begin: '\'[A-Za-z](_?[A-Za-z0-9])*',
    +        contains: [ hljs.BACKSLASH_ESCAPE ]
    +      }
    +    ]
    +  };
    +}
    +
    +module.exports = vhdl;
    diff --git a/node_modules/highlight.js/lib/languages/vim.js b/node_modules/highlight.js/lib/languages/vim.js
    new file mode 100644
    index 0000000..13810ae
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/vim.js
    @@ -0,0 +1,123 @@
    +/*
    +Language: Vim Script
    +Author: Jun Yang 
    +Description: full keyword and built-in from http://vimdoc.sourceforge.net/htmldoc/
    +Website: https://www.vim.org
    +Category: scripting
    +*/
    +
    +function vim(hljs) {
    +  return {
    +    name: 'Vim Script',
    +    keywords: {
    +      $pattern: /[!#@\w]+/,
    +      keyword:
    +        // express version except: ! & * < = > !! # @ @@
    +        'N|0 P|0 X|0 a|0 ab abc abo al am an|0 ar arga argd arge argdo argg argl argu as au aug aun b|0 bN ba bad bd be bel bf bl bm bn bo bp br brea breaka breakd breakl bro bufdo buffers bun bw c|0 cN cNf ca cabc caddb cad caddf cal cat cb cc ccl cd ce cex cf cfir cgetb cgete cg changes chd che checkt cl cla clo cm cmapc cme cn cnew cnf cno cnorea cnoreme co col colo com comc comp con conf cope ' +
    +        'cp cpf cq cr cs cst cu cuna cunme cw delm deb debugg delc delf dif diffg diffo diffp diffpu diffs diffthis dig di dl dell dj dli do doautoa dp dr ds dsp e|0 ea ec echoe echoh echom echon el elsei em en endfo endf endt endw ene ex exe exi exu f|0 files filet fin fina fini fir fix fo foldc foldd folddoc foldo for fu go gr grepa gu gv ha helpf helpg helpt hi hid his ia iabc if ij il im imapc ' +
    +        'ime ino inorea inoreme int is isp iu iuna iunme j|0 ju k|0 keepa kee keepj lN lNf l|0 lad laddb laddf la lan lat lb lc lch lcl lcs le lefta let lex lf lfir lgetb lgete lg lgr lgrepa lh ll lla lli lmak lm lmapc lne lnew lnf ln loadk lo loc lockv lol lope lp lpf lr ls lt lu lua luad luaf lv lvimgrepa lw m|0 ma mak map mapc marks mat me menut mes mk mks mksp mkv mkvie mod mz mzf nbc nb nbs new nm nmapc nme nn nnoreme noa no noh norea noreme norm nu nun nunme ol o|0 om omapc ome on ono onoreme opt ou ounme ow p|0 ' +
    +        'profd prof pro promptr pc ped pe perld po popu pp pre prev ps pt ptN ptf ptj ptl ptn ptp ptr pts pu pw py3 python3 py3d py3f py pyd pyf quita qa rec red redi redr redraws reg res ret retu rew ri rightb rub rubyd rubyf rund ru rv sN san sa sal sav sb sbN sba sbf sbl sbm sbn sbp sbr scrip scripte scs se setf setg setl sf sfir sh sim sig sil sl sla sm smap smapc sme sn sni sno snor snoreme sor ' +
    +        'so spelld spe spelli spellr spellu spellw sp spr sre st sta startg startr star stopi stj sts sun sunm sunme sus sv sw sy synti sync tN tabN tabc tabdo tabe tabf tabfir tabl tabm tabnew ' +
    +        'tabn tabo tabp tabr tabs tab ta tags tc tcld tclf te tf th tj tl tm tn to tp tr try ts tu u|0 undoj undol una unh unl unlo unm unme uns up ve verb vert vim vimgrepa vi viu vie vm vmapc vme vne vn vnoreme vs vu vunme windo w|0 wN wa wh wi winc winp wn wp wq wqa ws wu wv x|0 xa xmapc xm xme xn xnoreme xu xunme y|0 z|0 ~ ' +
    +        // full version
    +        'Next Print append abbreviate abclear aboveleft all amenu anoremenu args argadd argdelete argedit argglobal arglocal argument ascii autocmd augroup aunmenu buffer bNext ball badd bdelete behave belowright bfirst blast bmodified bnext botright bprevious brewind break breakadd breakdel breaklist browse bunload ' +
    +        'bwipeout change cNext cNfile cabbrev cabclear caddbuffer caddexpr caddfile call catch cbuffer cclose center cexpr cfile cfirst cgetbuffer cgetexpr cgetfile chdir checkpath checktime clist clast close cmap cmapclear cmenu cnext cnewer cnfile cnoremap cnoreabbrev cnoremenu copy colder colorscheme command comclear compiler continue confirm copen cprevious cpfile cquit crewind cscope cstag cunmap ' +
    +        'cunabbrev cunmenu cwindow delete delmarks debug debuggreedy delcommand delfunction diffupdate diffget diffoff diffpatch diffput diffsplit digraphs display deletel djump dlist doautocmd doautoall deletep drop dsearch dsplit edit earlier echo echoerr echohl echomsg else elseif emenu endif endfor ' +
    +        'endfunction endtry endwhile enew execute exit exusage file filetype find finally finish first fixdel fold foldclose folddoopen folddoclosed foldopen function global goto grep grepadd gui gvim hardcopy help helpfind helpgrep helptags highlight hide history insert iabbrev iabclear ijump ilist imap ' +
    +        'imapclear imenu inoremap inoreabbrev inoremenu intro isearch isplit iunmap iunabbrev iunmenu join jumps keepalt keepmarks keepjumps lNext lNfile list laddexpr laddbuffer laddfile last language later lbuffer lcd lchdir lclose lcscope left leftabove lexpr lfile lfirst lgetbuffer lgetexpr lgetfile lgrep lgrepadd lhelpgrep llast llist lmake lmap lmapclear lnext lnewer lnfile lnoremap loadkeymap loadview ' +
    +        'lockmarks lockvar lolder lopen lprevious lpfile lrewind ltag lunmap luado luafile lvimgrep lvimgrepadd lwindow move mark make mapclear match menu menutranslate messages mkexrc mksession mkspell mkvimrc mkview mode mzscheme mzfile nbclose nbkey nbsart next nmap nmapclear nmenu nnoremap ' +
    +        'nnoremenu noautocmd noremap nohlsearch noreabbrev noremenu normal number nunmap nunmenu oldfiles open omap omapclear omenu only onoremap onoremenu options ounmap ounmenu ownsyntax print profdel profile promptfind promptrepl pclose pedit perl perldo pop popup ppop preserve previous psearch ptag ptNext ' +
    +        'ptfirst ptjump ptlast ptnext ptprevious ptrewind ptselect put pwd py3do py3file python pydo pyfile quit quitall qall read recover redo redir redraw redrawstatus registers resize retab return rewind right rightbelow ruby rubydo rubyfile rundo runtime rviminfo substitute sNext sandbox sargument sall saveas sbuffer sbNext sball sbfirst sblast sbmodified sbnext sbprevious sbrewind scriptnames scriptencoding ' +
    +        'scscope set setfiletype setglobal setlocal sfind sfirst shell simalt sign silent sleep slast smagic smapclear smenu snext sniff snomagic snoremap snoremenu sort source spelldump spellgood spellinfo spellrepall spellundo spellwrong split sprevious srewind stop stag startgreplace startreplace ' +
    +        'startinsert stopinsert stjump stselect sunhide sunmap sunmenu suspend sview swapname syntax syntime syncbind tNext tabNext tabclose tabedit tabfind tabfirst tablast tabmove tabnext tabonly tabprevious tabrewind tag tcl tcldo tclfile tearoff tfirst throw tjump tlast tmenu tnext topleft tprevious ' + 'trewind tselect tunmenu undo undojoin undolist unabbreviate unhide unlet unlockvar unmap unmenu unsilent update vglobal version verbose vertical vimgrep vimgrepadd visual viusage view vmap vmapclear vmenu vnew ' +
    +        'vnoremap vnoremenu vsplit vunmap vunmenu write wNext wall while winsize wincmd winpos wnext wprevious wqall wsverb wundo wviminfo xit xall xmapclear xmap xmenu xnoremap xnoremenu xunmap xunmenu yank',
    +      built_in: // built in func
    +        'synIDtrans atan2 range matcharg did_filetype asin feedkeys xor argv ' +
    +        'complete_check add getwinposx getqflist getwinposy screencol ' +
    +        'clearmatches empty extend getcmdpos mzeval garbagecollect setreg ' +
    +        'ceil sqrt diff_hlID inputsecret get getfperm getpid filewritable ' +
    +        'shiftwidth max sinh isdirectory synID system inputrestore winline ' +
    +        'atan visualmode inputlist tabpagewinnr round getregtype mapcheck ' +
    +        'hasmapto histdel argidx findfile sha256 exists toupper getcmdline ' +
    +        'taglist string getmatches bufnr strftime winwidth bufexists ' +
    +        'strtrans tabpagebuflist setcmdpos remote_read printf setloclist ' +
    +        'getpos getline bufwinnr float2nr len getcmdtype diff_filler luaeval ' +
    +        'resolve libcallnr foldclosedend reverse filter has_key bufname ' +
    +        'str2float strlen setline getcharmod setbufvar index searchpos ' +
    +        'shellescape undofile foldclosed setqflist buflisted strchars str2nr ' +
    +        'virtcol floor remove undotree remote_expr winheight gettabwinvar ' +
    +        'reltime cursor tabpagenr finddir localtime acos getloclist search ' +
    +        'tanh matchend rename gettabvar strdisplaywidth type abs py3eval ' +
    +        'setwinvar tolower wildmenumode log10 spellsuggest bufloaded ' +
    +        'synconcealed nextnonblank server2client complete settabwinvar ' +
    +        'executable input wincol setmatches getftype hlID inputsave ' +
    +        'searchpair or screenrow line settabvar histadd deepcopy strpart ' +
    +        'remote_peek and eval getftime submatch screenchar winsaveview ' +
    +        'matchadd mkdir screenattr getfontname libcall reltimestr getfsize ' +
    +        'winnr invert pow getbufline byte2line soundfold repeat fnameescape ' +
    +        'tagfiles sin strwidth spellbadword trunc maparg log lispindent ' +
    +        'hostname setpos globpath remote_foreground getchar synIDattr ' +
    +        'fnamemodify cscope_connection stridx winbufnr indent min ' +
    +        'complete_add nr2char searchpairpos inputdialog values matchlist ' +
    +        'items hlexists strridx browsedir expand fmod pathshorten line2byte ' +
    +        'argc count getwinvar glob foldtextresult getreg foreground cosh ' +
    +        'matchdelete has char2nr simplify histget searchdecl iconv ' +
    +        'winrestcmd pumvisible writefile foldlevel haslocaldir keys cos ' +
    +        'matchstr foldtext histnr tan tempname getcwd byteidx getbufvar ' +
    +        'islocked escape eventhandler remote_send serverlist winrestview ' +
    +        'synstack pyeval prevnonblank readfile cindent filereadable changenr ' +
    +        'exp'
    +    },
    +    illegal: /;/,
    +    contains: [
    +      hljs.NUMBER_MODE,
    +      {
    +        className: 'string',
    +        begin: '\'',
    +        end: '\'',
    +        illegal: '\\n'
    +      },
    +
    +      /*
    +      A double quote can start either a string or a line comment. Strings are
    +      ended before the end of a line by another double quote and can contain
    +      escaped double-quotes and post-escaped line breaks.
    +
    +      Also, any double quote at the beginning of a line is a comment but we
    +      don't handle that properly at the moment: any double quote inside will
    +      turn them into a string. Handling it properly will require a smarter
    +      parser.
    +      */
    +      {
    +        className: 'string',
    +        begin: /"(\\"|\n\\|[^"\n])*"/
    +      },
    +      hljs.COMMENT('"', '$'),
    +
    +      {
    +        className: 'variable',
    +        begin: /[bwtglsav]:[\w\d_]*/
    +      },
    +      {
    +        className: 'function',
    +        beginKeywords: 'function function!',
    +        end: '$',
    +        relevance: 0,
    +        contains: [
    +          hljs.TITLE_MODE,
    +          {
    +            className: 'params',
    +            begin: '\\(',
    +            end: '\\)'
    +          }
    +        ]
    +      },
    +      {
    +        className: 'symbol',
    +        begin: /<[\w-]+>/
    +      }
    +    ]
    +  };
    +}
    +
    +module.exports = vim;
    diff --git a/node_modules/highlight.js/lib/languages/x86asm.js b/node_modules/highlight.js/lib/languages/x86asm.js
    new file mode 100644
    index 0000000..8736cf0
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/x86asm.js
    @@ -0,0 +1,163 @@
    +/*
    +Language: Intel x86 Assembly
    +Author: innocenat 
    +Description: x86 assembly language using Intel's mnemonic and NASM syntax
    +Website: https://en.wikipedia.org/wiki/X86_assembly_language
    +Category: assembler
    +*/
    +
    +function x86asm(hljs) {
    +  return {
    +    name: 'Intel x86 Assembly',
    +    case_insensitive: true,
    +    keywords: {
    +      $pattern: '[.%]?' + hljs.IDENT_RE,
    +      keyword:
    +        'lock rep repe repz repne repnz xaquire xrelease bnd nobnd ' +
    +        'aaa aad aam aas adc add and arpl bb0_reset bb1_reset bound bsf bsr bswap bt btc btr bts call cbw cdq cdqe clc cld cli clts cmc cmp cmpsb cmpsd cmpsq cmpsw cmpxchg cmpxchg486 cmpxchg8b cmpxchg16b cpuid cpu_read cpu_write cqo cwd cwde daa das dec div dmint emms enter equ f2xm1 fabs fadd faddp fbld fbstp fchs fclex fcmovb fcmovbe fcmove fcmovnb fcmovnbe fcmovne fcmovnu fcmovu fcom fcomi fcomip fcomp fcompp fcos fdecstp fdisi fdiv fdivp fdivr fdivrp femms feni ffree ffreep fiadd ficom ficomp fidiv fidivr fild fimul fincstp finit fist fistp fisttp fisub fisubr fld fld1 fldcw fldenv fldl2e fldl2t fldlg2 fldln2 fldpi fldz fmul fmulp fnclex fndisi fneni fninit fnop fnsave fnstcw fnstenv fnstsw fpatan fprem fprem1 fptan frndint frstor fsave fscale fsetpm fsin fsincos fsqrt fst fstcw fstenv fstp fstsw fsub fsubp fsubr fsubrp ftst fucom fucomi fucomip fucomp fucompp fxam fxch fxtract fyl2x fyl2xp1 hlt ibts icebp idiv imul in inc incbin insb insd insw int int01 int1 int03 int3 into invd invpcid invlpg invlpga iret iretd iretq iretw jcxz jecxz jrcxz jmp jmpe lahf lar lds lea leave les lfence lfs lgdt lgs lidt lldt lmsw loadall loadall286 lodsb lodsd lodsq lodsw loop loope loopne loopnz loopz lsl lss ltr mfence monitor mov movd movq movsb movsd movsq movsw movsx movsxd movzx mul mwait neg nop not or out outsb outsd outsw packssdw packsswb packuswb paddb paddd paddsb paddsiw paddsw paddusb paddusw paddw pand pandn pause paveb pavgusb pcmpeqb pcmpeqd pcmpeqw pcmpgtb pcmpgtd pcmpgtw pdistib pf2id pfacc pfadd pfcmpeq pfcmpge pfcmpgt pfmax pfmin pfmul pfrcp pfrcpit1 pfrcpit2 pfrsqit1 pfrsqrt pfsub pfsubr pi2fd pmachriw pmaddwd pmagw pmulhriw pmulhrwa pmulhrwc pmulhw pmullw pmvgezb pmvlzb pmvnzb pmvzb pop popa popad popaw popf popfd popfq popfw por prefetch prefetchw pslld psllq psllw psrad psraw psrld psrlq psrlw psubb psubd psubsb psubsiw psubsw psubusb psubusw psubw punpckhbw punpckhdq punpckhwd punpcklbw punpckldq punpcklwd push pusha pushad pushaw pushf pushfd pushfq pushfw pxor rcl rcr rdshr rdmsr rdpmc rdtsc rdtscp ret retf retn rol ror rdm rsdc rsldt rsm rsts sahf sal salc sar sbb scasb scasd scasq scasw sfence sgdt shl shld shr shrd sidt sldt skinit smi smint smintold smsw stc std sti stosb stosd stosq stosw str sub svdc svldt svts swapgs syscall sysenter sysexit sysret test ud0 ud1 ud2b ud2 ud2a umov verr verw fwait wbinvd wrshr wrmsr xadd xbts xchg xlatb xlat xor cmove cmovz cmovne cmovnz cmova cmovnbe cmovae cmovnb cmovb cmovnae cmovbe cmovna cmovg cmovnle cmovge cmovnl cmovl cmovnge cmovle cmovng cmovc cmovnc cmovo cmovno cmovs cmovns cmovp cmovpe cmovnp cmovpo je jz jne jnz ja jnbe jae jnb jb jnae jbe jna jg jnle jge jnl jl jnge jle jng jc jnc jo jno js jns jpo jnp jpe jp sete setz setne setnz seta setnbe setae setnb setnc setb setnae setcset setbe setna setg setnle setge setnl setl setnge setle setng sets setns seto setno setpe setp setpo setnp addps addss andnps andps cmpeqps cmpeqss cmpleps cmpless cmpltps cmpltss cmpneqps cmpneqss cmpnleps cmpnless cmpnltps cmpnltss cmpordps cmpordss cmpunordps cmpunordss cmpps cmpss comiss cvtpi2ps cvtps2pi cvtsi2ss cvtss2si cvttps2pi cvttss2si divps divss ldmxcsr maxps maxss minps minss movaps movhps movlhps movlps movhlps movmskps movntps movss movups mulps mulss orps rcpps rcpss rsqrtps rsqrtss shufps sqrtps sqrtss stmxcsr subps subss ucomiss unpckhps unpcklps xorps fxrstor fxrstor64 fxsave fxsave64 xgetbv xsetbv xsave xsave64 xsaveopt xsaveopt64 xrstor xrstor64 prefetchnta prefetcht0 prefetcht1 prefetcht2 maskmovq movntq pavgb pavgw pextrw pinsrw pmaxsw pmaxub pminsw pminub pmovmskb pmulhuw psadbw pshufw pf2iw pfnacc pfpnacc pi2fw pswapd maskmovdqu clflush movntdq movnti movntpd movdqa movdqu movdq2q movq2dq paddq pmuludq pshufd pshufhw pshuflw pslldq psrldq psubq punpckhqdq punpcklqdq addpd addsd andnpd andpd cmpeqpd cmpeqsd cmplepd cmplesd cmpltpd cmpltsd cmpneqpd cmpneqsd cmpnlepd cmpnlesd cmpnltpd cmpnltsd cmpordpd cmpordsd cmpunordpd cmpunordsd cmppd comisd cvtdq2pd cvtdq2ps cvtpd2dq cvtpd2pi cvtpd2ps cvtpi2pd cvtps2dq cvtps2pd cvtsd2si cvtsd2ss cvtsi2sd cvtss2sd cvttpd2pi cvttpd2dq cvttps2dq cvttsd2si divpd divsd maxpd maxsd minpd minsd movapd movhpd movlpd movmskpd movupd mulpd mulsd orpd shufpd sqrtpd sqrtsd subpd subsd ucomisd unpckhpd unpcklpd xorpd addsubpd addsubps haddpd haddps hsubpd hsubps lddqu movddup movshdup movsldup clgi stgi vmcall vmclear vmfunc vmlaunch vmload vmmcall vmptrld vmptrst vmread vmresume vmrun vmsave vmwrite vmxoff vmxon invept invvpid pabsb pabsw pabsd palignr phaddw phaddd phaddsw phsubw phsubd phsubsw pmaddubsw pmulhrsw pshufb psignb psignw psignd extrq insertq movntsd movntss lzcnt blendpd blendps blendvpd blendvps dppd dpps extractps insertps movntdqa mpsadbw packusdw pblendvb pblendw pcmpeqq pextrb pextrd pextrq phminposuw pinsrb pinsrd pinsrq pmaxsb pmaxsd pmaxud pmaxuw pminsb pminsd pminud pminuw pmovsxbw pmovsxbd pmovsxbq pmovsxwd pmovsxwq pmovsxdq pmovzxbw pmovzxbd pmovzxbq pmovzxwd pmovzxwq pmovzxdq pmuldq pmulld ptest roundpd roundps roundsd roundss crc32 pcmpestri pcmpestrm pcmpistri pcmpistrm pcmpgtq popcnt getsec pfrcpv pfrsqrtv movbe aesenc aesenclast aesdec aesdeclast aesimc aeskeygenassist vaesenc vaesenclast vaesdec vaesdeclast vaesimc vaeskeygenassist vaddpd vaddps vaddsd vaddss vaddsubpd vaddsubps vandpd vandps vandnpd vandnps vblendpd vblendps vblendvpd vblendvps vbroadcastss vbroadcastsd vbroadcastf128 vcmpeq_ospd vcmpeqpd vcmplt_ospd vcmpltpd vcmple_ospd vcmplepd vcmpunord_qpd vcmpunordpd vcmpneq_uqpd vcmpneqpd vcmpnlt_uspd vcmpnltpd vcmpnle_uspd vcmpnlepd vcmpord_qpd vcmpordpd vcmpeq_uqpd vcmpnge_uspd vcmpngepd vcmpngt_uspd vcmpngtpd vcmpfalse_oqpd vcmpfalsepd vcmpneq_oqpd vcmpge_ospd vcmpgepd vcmpgt_ospd vcmpgtpd vcmptrue_uqpd vcmptruepd vcmplt_oqpd vcmple_oqpd vcmpunord_spd vcmpneq_uspd vcmpnlt_uqpd vcmpnle_uqpd vcmpord_spd vcmpeq_uspd vcmpnge_uqpd vcmpngt_uqpd vcmpfalse_ospd vcmpneq_ospd vcmpge_oqpd vcmpgt_oqpd vcmptrue_uspd vcmppd vcmpeq_osps vcmpeqps vcmplt_osps vcmpltps vcmple_osps vcmpleps vcmpunord_qps vcmpunordps vcmpneq_uqps vcmpneqps vcmpnlt_usps vcmpnltps vcmpnle_usps vcmpnleps vcmpord_qps vcmpordps vcmpeq_uqps vcmpnge_usps vcmpngeps vcmpngt_usps vcmpngtps vcmpfalse_oqps vcmpfalseps vcmpneq_oqps vcmpge_osps vcmpgeps vcmpgt_osps vcmpgtps vcmptrue_uqps vcmptrueps vcmplt_oqps vcmple_oqps vcmpunord_sps vcmpneq_usps vcmpnlt_uqps vcmpnle_uqps vcmpord_sps vcmpeq_usps vcmpnge_uqps vcmpngt_uqps vcmpfalse_osps vcmpneq_osps vcmpge_oqps vcmpgt_oqps vcmptrue_usps vcmpps vcmpeq_ossd vcmpeqsd vcmplt_ossd vcmpltsd vcmple_ossd vcmplesd vcmpunord_qsd vcmpunordsd vcmpneq_uqsd vcmpneqsd vcmpnlt_ussd vcmpnltsd vcmpnle_ussd vcmpnlesd vcmpord_qsd vcmpordsd vcmpeq_uqsd vcmpnge_ussd vcmpngesd vcmpngt_ussd vcmpngtsd vcmpfalse_oqsd vcmpfalsesd vcmpneq_oqsd vcmpge_ossd vcmpgesd vcmpgt_ossd vcmpgtsd vcmptrue_uqsd vcmptruesd vcmplt_oqsd vcmple_oqsd vcmpunord_ssd vcmpneq_ussd vcmpnlt_uqsd vcmpnle_uqsd vcmpord_ssd vcmpeq_ussd vcmpnge_uqsd vcmpngt_uqsd vcmpfalse_ossd vcmpneq_ossd vcmpge_oqsd vcmpgt_oqsd vcmptrue_ussd vcmpsd vcmpeq_osss vcmpeqss vcmplt_osss vcmpltss vcmple_osss vcmpless vcmpunord_qss vcmpunordss vcmpneq_uqss vcmpneqss vcmpnlt_usss vcmpnltss vcmpnle_usss vcmpnless vcmpord_qss vcmpordss vcmpeq_uqss vcmpnge_usss vcmpngess vcmpngt_usss vcmpngtss vcmpfalse_oqss vcmpfalsess vcmpneq_oqss vcmpge_osss vcmpgess vcmpgt_osss vcmpgtss vcmptrue_uqss vcmptruess vcmplt_oqss vcmple_oqss vcmpunord_sss vcmpneq_usss vcmpnlt_uqss vcmpnle_uqss vcmpord_sss vcmpeq_usss vcmpnge_uqss vcmpngt_uqss vcmpfalse_osss vcmpneq_osss vcmpge_oqss vcmpgt_oqss vcmptrue_usss vcmpss vcomisd vcomiss vcvtdq2pd vcvtdq2ps vcvtpd2dq vcvtpd2ps vcvtps2dq vcvtps2pd vcvtsd2si vcvtsd2ss vcvtsi2sd vcvtsi2ss vcvtss2sd vcvtss2si vcvttpd2dq vcvttps2dq vcvttsd2si vcvttss2si vdivpd vdivps vdivsd vdivss vdppd vdpps vextractf128 vextractps vhaddpd vhaddps vhsubpd vhsubps vinsertf128 vinsertps vlddqu vldqqu vldmxcsr vmaskmovdqu vmaskmovps vmaskmovpd vmaxpd vmaxps vmaxsd vmaxss vminpd vminps vminsd vminss vmovapd vmovaps vmovd vmovq vmovddup vmovdqa vmovqqa vmovdqu vmovqqu vmovhlps vmovhpd vmovhps vmovlhps vmovlpd vmovlps vmovmskpd vmovmskps vmovntdq vmovntqq vmovntdqa vmovntpd vmovntps vmovsd vmovshdup vmovsldup vmovss vmovupd vmovups vmpsadbw vmulpd vmulps vmulsd vmulss vorpd vorps vpabsb vpabsw vpabsd vpacksswb vpackssdw vpackuswb vpackusdw vpaddb vpaddw vpaddd vpaddq vpaddsb vpaddsw vpaddusb vpaddusw vpalignr vpand vpandn vpavgb vpavgw vpblendvb vpblendw vpcmpestri vpcmpestrm vpcmpistri vpcmpistrm vpcmpeqb vpcmpeqw vpcmpeqd vpcmpeqq vpcmpgtb vpcmpgtw vpcmpgtd vpcmpgtq vpermilpd vpermilps vperm2f128 vpextrb vpextrw vpextrd vpextrq vphaddw vphaddd vphaddsw vphminposuw vphsubw vphsubd vphsubsw vpinsrb vpinsrw vpinsrd vpinsrq vpmaddwd vpmaddubsw vpmaxsb vpmaxsw vpmaxsd vpmaxub vpmaxuw vpmaxud vpminsb vpminsw vpminsd vpminub vpminuw vpminud vpmovmskb vpmovsxbw vpmovsxbd vpmovsxbq vpmovsxwd vpmovsxwq vpmovsxdq vpmovzxbw vpmovzxbd vpmovzxbq vpmovzxwd vpmovzxwq vpmovzxdq vpmulhuw vpmulhrsw vpmulhw vpmullw vpmulld vpmuludq vpmuldq vpor vpsadbw vpshufb vpshufd vpshufhw vpshuflw vpsignb vpsignw vpsignd vpslldq vpsrldq vpsllw vpslld vpsllq vpsraw vpsrad vpsrlw vpsrld vpsrlq vptest vpsubb vpsubw vpsubd vpsubq vpsubsb vpsubsw vpsubusb vpsubusw vpunpckhbw vpunpckhwd vpunpckhdq vpunpckhqdq vpunpcklbw vpunpcklwd vpunpckldq vpunpcklqdq vpxor vrcpps vrcpss vrsqrtps vrsqrtss vroundpd vroundps vroundsd vroundss vshufpd vshufps vsqrtpd vsqrtps vsqrtsd vsqrtss vstmxcsr vsubpd vsubps vsubsd vsubss vtestps vtestpd vucomisd vucomiss vunpckhpd vunpckhps vunpcklpd vunpcklps vxorpd vxorps vzeroall vzeroupper pclmullqlqdq pclmulhqlqdq pclmullqhqdq pclmulhqhqdq pclmulqdq vpclmullqlqdq vpclmulhqlqdq vpclmullqhqdq vpclmulhqhqdq vpclmulqdq vfmadd132ps vfmadd132pd vfmadd312ps vfmadd312pd vfmadd213ps vfmadd213pd vfmadd123ps vfmadd123pd vfmadd231ps vfmadd231pd vfmadd321ps vfmadd321pd vfmaddsub132ps vfmaddsub132pd vfmaddsub312ps vfmaddsub312pd vfmaddsub213ps vfmaddsub213pd vfmaddsub123ps vfmaddsub123pd vfmaddsub231ps vfmaddsub231pd vfmaddsub321ps vfmaddsub321pd vfmsub132ps vfmsub132pd vfmsub312ps vfmsub312pd vfmsub213ps vfmsub213pd vfmsub123ps vfmsub123pd vfmsub231ps vfmsub231pd vfmsub321ps vfmsub321pd vfmsubadd132ps vfmsubadd132pd vfmsubadd312ps vfmsubadd312pd vfmsubadd213ps vfmsubadd213pd vfmsubadd123ps vfmsubadd123pd vfmsubadd231ps vfmsubadd231pd vfmsubadd321ps vfmsubadd321pd vfnmadd132ps vfnmadd132pd vfnmadd312ps vfnmadd312pd vfnmadd213ps vfnmadd213pd vfnmadd123ps vfnmadd123pd vfnmadd231ps vfnmadd231pd vfnmadd321ps vfnmadd321pd vfnmsub132ps vfnmsub132pd vfnmsub312ps vfnmsub312pd vfnmsub213ps vfnmsub213pd vfnmsub123ps vfnmsub123pd vfnmsub231ps vfnmsub231pd vfnmsub321ps vfnmsub321pd vfmadd132ss vfmadd132sd vfmadd312ss vfmadd312sd vfmadd213ss vfmadd213sd vfmadd123ss vfmadd123sd vfmadd231ss vfmadd231sd vfmadd321ss vfmadd321sd vfmsub132ss vfmsub132sd vfmsub312ss vfmsub312sd vfmsub213ss vfmsub213sd vfmsub123ss vfmsub123sd vfmsub231ss vfmsub231sd vfmsub321ss vfmsub321sd vfnmadd132ss vfnmadd132sd vfnmadd312ss vfnmadd312sd vfnmadd213ss vfnmadd213sd vfnmadd123ss vfnmadd123sd vfnmadd231ss vfnmadd231sd vfnmadd321ss vfnmadd321sd vfnmsub132ss vfnmsub132sd vfnmsub312ss vfnmsub312sd vfnmsub213ss vfnmsub213sd vfnmsub123ss vfnmsub123sd vfnmsub231ss vfnmsub231sd vfnmsub321ss vfnmsub321sd rdfsbase rdgsbase rdrand wrfsbase wrgsbase vcvtph2ps vcvtps2ph adcx adox rdseed clac stac xstore xcryptecb xcryptcbc xcryptctr xcryptcfb xcryptofb montmul xsha1 xsha256 llwpcb slwpcb lwpval lwpins vfmaddpd vfmaddps vfmaddsd vfmaddss vfmaddsubpd vfmaddsubps vfmsubaddpd vfmsubaddps vfmsubpd vfmsubps vfmsubsd vfmsubss vfnmaddpd vfnmaddps vfnmaddsd vfnmaddss vfnmsubpd vfnmsubps vfnmsubsd vfnmsubss vfrczpd vfrczps vfrczsd vfrczss vpcmov vpcomb vpcomd vpcomq vpcomub vpcomud vpcomuq vpcomuw vpcomw vphaddbd vphaddbq vphaddbw vphadddq vphaddubd vphaddubq vphaddubw vphaddudq vphadduwd vphadduwq vphaddwd vphaddwq vphsubbw vphsubdq vphsubwd vpmacsdd vpmacsdqh vpmacsdql vpmacssdd vpmacssdqh vpmacssdql vpmacsswd vpmacssww vpmacswd vpmacsww vpmadcsswd vpmadcswd vpperm vprotb vprotd vprotq vprotw vpshab vpshad vpshaq vpshaw vpshlb vpshld vpshlq vpshlw vbroadcasti128 vpblendd vpbroadcastb vpbroadcastw vpbroadcastd vpbroadcastq vpermd vpermpd vpermps vpermq vperm2i128 vextracti128 vinserti128 vpmaskmovd vpmaskmovq vpsllvd vpsllvq vpsravd vpsrlvd vpsrlvq vgatherdpd vgatherqpd vgatherdps vgatherqps vpgatherdd vpgatherqd vpgatherdq vpgatherqq xabort xbegin xend xtest andn bextr blci blcic blsi blsic blcfill blsfill blcmsk blsmsk blsr blcs bzhi mulx pdep pext rorx sarx shlx shrx tzcnt tzmsk t1mskc valignd valignq vblendmpd vblendmps vbroadcastf32x4 vbroadcastf64x4 vbroadcasti32x4 vbroadcasti64x4 vcompresspd vcompressps vcvtpd2udq vcvtps2udq vcvtsd2usi vcvtss2usi vcvttpd2udq vcvttps2udq vcvttsd2usi vcvttss2usi vcvtudq2pd vcvtudq2ps vcvtusi2sd vcvtusi2ss vexpandpd vexpandps vextractf32x4 vextractf64x4 vextracti32x4 vextracti64x4 vfixupimmpd vfixupimmps vfixupimmsd vfixupimmss vgetexppd vgetexpps vgetexpsd vgetexpss vgetmantpd vgetmantps vgetmantsd vgetmantss vinsertf32x4 vinsertf64x4 vinserti32x4 vinserti64x4 vmovdqa32 vmovdqa64 vmovdqu32 vmovdqu64 vpabsq vpandd vpandnd vpandnq vpandq vpblendmd vpblendmq vpcmpltd vpcmpled vpcmpneqd vpcmpnltd vpcmpnled vpcmpd vpcmpltq vpcmpleq vpcmpneqq vpcmpnltq vpcmpnleq vpcmpq vpcmpequd vpcmpltud vpcmpleud vpcmpnequd vpcmpnltud vpcmpnleud vpcmpud vpcmpequq vpcmpltuq vpcmpleuq vpcmpnequq vpcmpnltuq vpcmpnleuq vpcmpuq vpcompressd vpcompressq vpermi2d vpermi2pd vpermi2ps vpermi2q vpermt2d vpermt2pd vpermt2ps vpermt2q vpexpandd vpexpandq vpmaxsq vpmaxuq vpminsq vpminuq vpmovdb vpmovdw vpmovqb vpmovqd vpmovqw vpmovsdb vpmovsdw vpmovsqb vpmovsqd vpmovsqw vpmovusdb vpmovusdw vpmovusqb vpmovusqd vpmovusqw vpord vporq vprold vprolq vprolvd vprolvq vprord vprorq vprorvd vprorvq vpscatterdd vpscatterdq vpscatterqd vpscatterqq vpsraq vpsravq vpternlogd vpternlogq vptestmd vptestmq vptestnmd vptestnmq vpxord vpxorq vrcp14pd vrcp14ps vrcp14sd vrcp14ss vrndscalepd vrndscaleps vrndscalesd vrndscaless vrsqrt14pd vrsqrt14ps vrsqrt14sd vrsqrt14ss vscalefpd vscalefps vscalefsd vscalefss vscatterdpd vscatterdps vscatterqpd vscatterqps vshuff32x4 vshuff64x2 vshufi32x4 vshufi64x2 kandnw kandw kmovw knotw kortestw korw kshiftlw kshiftrw kunpckbw kxnorw kxorw vpbroadcastmb2q vpbroadcastmw2d vpconflictd vpconflictq vplzcntd vplzcntq vexp2pd vexp2ps vrcp28pd vrcp28ps vrcp28sd vrcp28ss vrsqrt28pd vrsqrt28ps vrsqrt28sd vrsqrt28ss vgatherpf0dpd vgatherpf0dps vgatherpf0qpd vgatherpf0qps vgatherpf1dpd vgatherpf1dps vgatherpf1qpd vgatherpf1qps vscatterpf0dpd vscatterpf0dps vscatterpf0qpd vscatterpf0qps vscatterpf1dpd vscatterpf1dps vscatterpf1qpd vscatterpf1qps prefetchwt1 bndmk bndcl bndcu bndcn bndmov bndldx bndstx sha1rnds4 sha1nexte sha1msg1 sha1msg2 sha256rnds2 sha256msg1 sha256msg2 hint_nop0 hint_nop1 hint_nop2 hint_nop3 hint_nop4 hint_nop5 hint_nop6 hint_nop7 hint_nop8 hint_nop9 hint_nop10 hint_nop11 hint_nop12 hint_nop13 hint_nop14 hint_nop15 hint_nop16 hint_nop17 hint_nop18 hint_nop19 hint_nop20 hint_nop21 hint_nop22 hint_nop23 hint_nop24 hint_nop25 hint_nop26 hint_nop27 hint_nop28 hint_nop29 hint_nop30 hint_nop31 hint_nop32 hint_nop33 hint_nop34 hint_nop35 hint_nop36 hint_nop37 hint_nop38 hint_nop39 hint_nop40 hint_nop41 hint_nop42 hint_nop43 hint_nop44 hint_nop45 hint_nop46 hint_nop47 hint_nop48 hint_nop49 hint_nop50 hint_nop51 hint_nop52 hint_nop53 hint_nop54 hint_nop55 hint_nop56 hint_nop57 hint_nop58 hint_nop59 hint_nop60 hint_nop61 hint_nop62 hint_nop63',
    +      built_in:
    +        // Instruction pointer
    +        'ip eip rip ' +
    +        // 8-bit registers
    +        'al ah bl bh cl ch dl dh sil dil bpl spl r8b r9b r10b r11b r12b r13b r14b r15b ' +
    +        // 16-bit registers
    +        'ax bx cx dx si di bp sp r8w r9w r10w r11w r12w r13w r14w r15w ' +
    +        // 32-bit registers
    +        'eax ebx ecx edx esi edi ebp esp eip r8d r9d r10d r11d r12d r13d r14d r15d ' +
    +        // 64-bit registers
    +        'rax rbx rcx rdx rsi rdi rbp rsp r8 r9 r10 r11 r12 r13 r14 r15 ' +
    +        // Segment registers
    +        'cs ds es fs gs ss ' +
    +        // Floating point stack registers
    +        'st st0 st1 st2 st3 st4 st5 st6 st7 ' +
    +        // MMX Registers
    +        'mm0 mm1 mm2 mm3 mm4 mm5 mm6 mm7 ' +
    +        // SSE registers
    +        'xmm0  xmm1  xmm2  xmm3  xmm4  xmm5  xmm6  xmm7  xmm8  xmm9 xmm10  xmm11 xmm12 xmm13 xmm14 xmm15 ' +
    +        'xmm16 xmm17 xmm18 xmm19 xmm20 xmm21 xmm22 xmm23 xmm24 xmm25 xmm26 xmm27 xmm28 xmm29 xmm30 xmm31 ' +
    +        // AVX registers
    +        'ymm0  ymm1  ymm2  ymm3  ymm4  ymm5  ymm6  ymm7  ymm8  ymm9 ymm10  ymm11 ymm12 ymm13 ymm14 ymm15 ' +
    +        'ymm16 ymm17 ymm18 ymm19 ymm20 ymm21 ymm22 ymm23 ymm24 ymm25 ymm26 ymm27 ymm28 ymm29 ymm30 ymm31 ' +
    +        // AVX-512F registers
    +        'zmm0  zmm1  zmm2  zmm3  zmm4  zmm5  zmm6  zmm7  zmm8  zmm9 zmm10  zmm11 zmm12 zmm13 zmm14 zmm15 ' +
    +        'zmm16 zmm17 zmm18 zmm19 zmm20 zmm21 zmm22 zmm23 zmm24 zmm25 zmm26 zmm27 zmm28 zmm29 zmm30 zmm31 ' +
    +        // AVX-512F mask registers
    +        'k0 k1 k2 k3 k4 k5 k6 k7 ' +
    +        // Bound (MPX) register
    +        'bnd0 bnd1 bnd2 bnd3 ' +
    +        // Special register
    +        'cr0 cr1 cr2 cr3 cr4 cr8 dr0 dr1 dr2 dr3 dr8 tr3 tr4 tr5 tr6 tr7 ' +
    +        // NASM altreg package
    +        'r0 r1 r2 r3 r4 r5 r6 r7 r0b r1b r2b r3b r4b r5b r6b r7b ' +
    +        'r0w r1w r2w r3w r4w r5w r6w r7w r0d r1d r2d r3d r4d r5d r6d r7d ' +
    +        'r0h r1h r2h r3h ' +
    +        'r0l r1l r2l r3l r4l r5l r6l r7l r8l r9l r10l r11l r12l r13l r14l r15l ' +
    +
    +        'db dw dd dq dt ddq do dy dz ' +
    +        'resb resw resd resq rest resdq reso resy resz ' +
    +        'incbin equ times ' +
    +        'byte word dword qword nosplit rel abs seg wrt strict near far a32 ptr',
    +
    +      meta:
    +        '%define %xdefine %+ %undef %defstr %deftok %assign %strcat %strlen %substr %rotate %elif %else %endif ' +
    +        '%if %ifmacro %ifctx %ifidn %ifidni %ifid %ifnum %ifstr %iftoken %ifempty %ifenv %error %warning %fatal %rep ' +
    +        '%endrep %include %push %pop %repl %pathsearch %depend %use %arg %stacksize %local %line %comment %endcomment ' +
    +        '.nolist ' +
    +        '__FILE__ __LINE__ __SECT__  __BITS__ __OUTPUT_FORMAT__ __DATE__ __TIME__ __DATE_NUM__ __TIME_NUM__ ' +
    +        '__UTC_DATE__ __UTC_TIME__ __UTC_DATE_NUM__ __UTC_TIME_NUM__  __PASS__ struc endstruc istruc at iend ' +
    +        'align alignb sectalign daz nodaz up down zero default option assume public ' +
    +
    +        'bits use16 use32 use64 default section segment absolute extern global common cpu float ' +
    +        '__utf16__ __utf16le__ __utf16be__ __utf32__ __utf32le__ __utf32be__ ' +
    +        '__float8__ __float16__ __float32__ __float64__ __float80m__ __float80e__ __float128l__ __float128h__ ' +
    +        '__Infinity__ __QNaN__ __SNaN__ Inf NaN QNaN SNaN float8 float16 float32 float64 float80m float80e ' +
    +        'float128l float128h __FLOAT_DAZ__ __FLOAT_ROUND__ __FLOAT__'
    +    },
    +    contains: [
    +      hljs.COMMENT(
    +        ';',
    +        '$',
    +        {
    +          relevance: 0
    +        }
    +      ),
    +      {
    +        className: 'number',
    +        variants: [
    +          // Float number and x87 BCD
    +          {
    +            begin: '\\b(?:([0-9][0-9_]*)?\\.[0-9_]*(?:[eE][+-]?[0-9_]+)?|' +
    +                   '(0[Xx])?[0-9][0-9_]*(\\.[0-9_]*)?(?:[pP](?:[+-]?[0-9_]+)?)?)\\b',
    +            relevance: 0
    +          },
    +
    +          // Hex number in $
    +          {
    +            begin: '\\$[0-9][0-9A-Fa-f]*',
    +            relevance: 0
    +          },
    +
    +          // Number in H,D,T,Q,O,B,Y suffix
    +          {
    +            begin: '\\b(?:[0-9A-Fa-f][0-9A-Fa-f_]*[Hh]|[0-9][0-9_]*[DdTt]?|[0-7][0-7_]*[QqOo]|[0-1][0-1_]*[BbYy])\\b'
    +          },
    +
    +          // Number in X,D,T,Q,O,B,Y prefix
    +          {
    +            begin: '\\b(?:0[Xx][0-9A-Fa-f_]+|0[DdTt][0-9_]+|0[QqOo][0-7_]+|0[BbYy][0-1_]+)\\b'
    +          }
    +        ]
    +      },
    +      // Double quote string
    +      hljs.QUOTE_STRING_MODE,
    +      {
    +        className: 'string',
    +        variants: [
    +          // Single-quoted string
    +          {
    +            begin: '\'',
    +            end: '[^\\\\]\''
    +          },
    +          // Backquoted string
    +          {
    +            begin: '`',
    +            end: '[^\\\\]`'
    +          }
    +        ],
    +        relevance: 0
    +      },
    +      {
    +        className: 'symbol',
    +        variants: [
    +          // Global label and local label
    +          {
    +            begin: '^\\s*[A-Za-z._?][A-Za-z0-9_$#@~.?]*(:|\\s+label)'
    +          },
    +          // Macro-local label
    +          {
    +            begin: '^\\s*%%[A-Za-z0-9_$#@~.?]*:'
    +          }
    +        ],
    +        relevance: 0
    +      },
    +      // Macro parameter
    +      {
    +        className: 'subst',
    +        begin: '%[0-9]+',
    +        relevance: 0
    +      },
    +      // Macro parameter
    +      {
    +        className: 'subst',
    +        begin: '%!\S+',
    +        relevance: 0
    +      },
    +      {
    +        className: 'meta',
    +        begin: /^\s*\.[\w_-]+/
    +      }
    +    ]
    +  };
    +}
    +
    +module.exports = x86asm;
    diff --git a/node_modules/highlight.js/lib/languages/xl.js b/node_modules/highlight.js/lib/languages/xl.js
    new file mode 100644
    index 0000000..270741d
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/xl.js
    @@ -0,0 +1,92 @@
    +/*
    +Language: XL
    +Author: Christophe de Dinechin 
    +Description: An extensible programming language, based on parse tree rewriting
    +Website: http://xlr.sf.net
    +*/
    +
    +function xl(hljs) {
    +  const BUILTIN_MODULES =
    +    'ObjectLoader Animate MovieCredits Slides Filters Shading Materials LensFlare Mapping VLCAudioVideo ' +
    +    'StereoDecoder PointCloud NetworkAccess RemoteControl RegExp ChromaKey Snowfall NodeJS Speech Charts';
    +
    +  const XL_KEYWORDS = {
    +    $pattern: /[a-zA-Z][a-zA-Z0-9_?]*/,
    +    keyword:
    +      'if then else do while until for loop import with is as where when by data constant ' +
    +      'integer real text name boolean symbol infix prefix postfix block tree',
    +    literal:
    +      'true false nil',
    +    built_in:
    +      'in mod rem and or xor not abs sign floor ceil sqrt sin cos tan asin ' +
    +      'acos atan exp expm1 log log2 log10 log1p pi at text_length text_range ' +
    +      'text_find text_replace contains page slide basic_slide title_slide ' +
    +      'title subtitle fade_in fade_out fade_at clear_color color line_color ' +
    +      'line_width texture_wrap texture_transform texture scale_?x scale_?y ' +
    +      'scale_?z? translate_?x translate_?y translate_?z? rotate_?x rotate_?y ' +
    +      'rotate_?z? rectangle circle ellipse sphere path line_to move_to ' +
    +      'quad_to curve_to theme background contents locally time mouse_?x ' +
    +      'mouse_?y mouse_buttons ' +
    +      BUILTIN_MODULES
    +  };
    +
    +  const DOUBLE_QUOTE_TEXT = {
    +    className: 'string',
    +    begin: '"',
    +    end: '"',
    +    illegal: '\\n'
    +  };
    +  const SINGLE_QUOTE_TEXT = {
    +    className: 'string',
    +    begin: '\'',
    +    end: '\'',
    +    illegal: '\\n'
    +  };
    +  const LONG_TEXT = {
    +    className: 'string',
    +    begin: '<<',
    +    end: '>>'
    +  };
    +  const BASED_NUMBER = {
    +    className: 'number',
    +    begin: '[0-9]+#[0-9A-Z_]+(\\.[0-9-A-Z_]+)?#?([Ee][+-]?[0-9]+)?'
    +  };
    +  const IMPORT = {
    +    beginKeywords: 'import',
    +    end: '$',
    +    keywords: XL_KEYWORDS,
    +    contains: [ DOUBLE_QUOTE_TEXT ]
    +  };
    +  const FUNCTION_DEFINITION = {
    +    className: 'function',
    +    begin: /[a-z][^\n]*->/,
    +    returnBegin: true,
    +    end: /->/,
    +    contains: [
    +      hljs.inherit(hljs.TITLE_MODE, {
    +        starts: {
    +          endsWithParent: true,
    +          keywords: XL_KEYWORDS
    +        }
    +      })
    +    ]
    +  };
    +  return {
    +    name: 'XL',
    +    aliases: [ 'tao' ],
    +    keywords: XL_KEYWORDS,
    +    contains: [
    +      hljs.C_LINE_COMMENT_MODE,
    +      hljs.C_BLOCK_COMMENT_MODE,
    +      DOUBLE_QUOTE_TEXT,
    +      SINGLE_QUOTE_TEXT,
    +      LONG_TEXT,
    +      FUNCTION_DEFINITION,
    +      IMPORT,
    +      BASED_NUMBER,
    +      hljs.NUMBER_MODE
    +    ]
    +  };
    +}
    +
    +module.exports = xl;
    diff --git a/node_modules/highlight.js/lib/languages/xml.js b/node_modules/highlight.js/lib/languages/xml.js
    new file mode 100644
    index 0000000..a67bd30
    --- /dev/null
    +++ b/node_modules/highlight.js/lib/languages/xml.js
    @@ -0,0 +1,285 @@
    +/**
    + * @param {string} value
    + * @returns {RegExp}
    + * */
    +
    +/**
    + * @param {RegExp | string } re
    + * @returns {string}
    + */
    +function source(re) {
    +  if (!re) return null;
    +  if (typeof re === "string") return re;
    +
    +  return re.source;
    +}
    +
    +/**
    + * @param {RegExp | string } re
    + * @returns {string}
    + */
    +function lookahead(re) {
    +  return concat('(?=', re, ')');
    +}
    +
    +/**
    + * @param {RegExp | string } re
    + * @returns {string}
    + */
    +function optional(re) {
    +  return concat('(', re, ')?');
    +}
    +
    +/**
    + * @param {...(RegExp | string) } args
    + * @returns {string}
    + */
    +function concat(...args) {
    +  const joined = args.map((x) => source(x)).join("");
    +  return joined;
    +}
    +
    +/**
    + * Any of the passed expresssions may match
    + *
    + * Creates a huge this | this | that | that match
    + * @param {(RegExp | string)[] } args
    + * @returns {string}
    + */
    +function either(...args) {
    +  const joined = '(' + args.map((x) => source(x)).join("|") + ")";
    +  return joined;
    +}
    +
    +/*
    +Language: HTML, XML
    +Website: https://www.w3.org/XML/
    +Category: common
    +*/
    +
    +/** @type LanguageFn */
    +function xml(hljs) {
    +  // Element names can contain letters, digits, hyphens, underscores, and periods
    +  const TAG_NAME_RE = concat(/[A-Z_]/, optional(/[A-Z0-9_.-]+:/), /[A-Z0-9_.-]*/);
    +  const XML_IDENT_RE = '[A-Za-z0-9\\._:-]+';
    +  const XML_ENTITIES = {
    +    className: 'symbol',
    +    begin: '&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;'
    +  };
    +  const XML_META_KEYWORDS = {
    +    begin: '\\s',
    +    contains: [
    +      {
    +        className: 'meta-keyword',
    +        begin: '#?[a-z_][a-z1-9_-]+',
    +        illegal: '\\n'
    +      }
    +    ]
    +  };
    +  const XML_META_PAR_KEYWORDS = hljs.inherit(XML_META_KEYWORDS, {
    +    begin: '\\(',
    +    end: '\\)'
    +  });
    +  const APOS_META_STRING_MODE = hljs.inherit(hljs.APOS_STRING_MODE, {
    +    className: 'meta-string'
    +  });
    +  const QUOTE_META_STRING_MODE = hljs.inherit(hljs.QUOTE_STRING_MODE, {
    +    className: 'meta-string'
    +  });
    +  const TAG_INTERNALS = {
    +    endsWithParent: true,
    +    illegal: /`]+/
    +              }
    +            ]
    +          }
    +        ]
    +      }
    +    ]
    +  };
    +  return {
    +    name: 'HTML, XML',
    +    aliases: [
    +      'html',
    +      'xhtml',
    +      'rss',
    +      'atom',
    +      'xjb',
    +      'xsd',
    +      'xsl',
    +      'plist',
    +      'wsf',
    +      'svg'
    +    ],
    +    case_insensitive: true,
    +    contains: [
    +      {
    +        className: 'meta',
    +        begin: '',
    +        relevance: 10,
    +        contains: [
    +          XML_META_KEYWORDS,
    +          QUOTE_META_STRING_MODE,
    +          APOS_META_STRING_MODE,
    +          XML_META_PAR_KEYWORDS,
    +          {
    +            begin: '\\[',
    +            end: '\\]',
    +            contains: [
    +              {
    +                className: 'meta',
    +                begin: '',
    +                contains: [
    +                  XML_META_KEYWORDS,
    +                  XML_META_PAR_KEYWORDS,
    +                  QUOTE_META_STRING_MODE,
    +                  APOS_META_STRING_MODE
    +                ]
    +              }
    +            ]
    +          }
    +        ]
    +      },
    +      hljs.COMMENT(
    +        '',
    +        {
    +          relevance: 10
    +        }
    +      ),
    +      {
    +        begin: '',
    +        relevance: 10
    +      },
    +      XML_ENTITIES,
    +      {
    +        className: 'meta',
    +        begin: /<\?xml/,
    +        end: /\?>/,
    +        relevance: 10
    +      },
    +      {
    +        className: 'tag',
    +        /*
    +        The lookahead pattern (?=...) ensures that 'begin' only matches
    +        ')',
    +        end: '>',
    +        keywords: {
    +          name: 'style'
    +        },
    +        contains: [ TAG_INTERNALS ],
    +        starts: {
    +          end: '',
    +          returnEnd: true,
    +          subLanguage: [
    +            'css',
    +            'xml'
    +          ]
    +        }
    +      },
    +      {
    +        className: 'tag',
    +        // See the comment in the ",rE:!0,sL:["css","xml"]}},{cN:"tag",b:"|$)",e:">",k:{name:"script"},c:[t],starts:{e:"",rE:!0,sL:["actionscript","javascript","handlebars","xml"]}},{cN:"meta",v:[{b:/<\?xml/,e:/\?>/,r:10},{b:/<\?\w+/,e:/\?>/}]},{cN:"tag",b:"",c:[{cN:"name",b:/[^\/><\s]+/,r:0},t]}]}});hljs.registerLanguage("vbscript",function(e){return{aliases:["vbs"],cI:!0,k:{keyword:"call class const dim do loop erase execute executeglobal exit for each next function if then else on error option explicit new private property let get public randomize redim rem select case set stop sub while wend with end to elseif is or xor and not class_initialize class_terminate default preserve in me byval byref step resume goto",built_in:"lcase month vartype instrrev ubound setlocale getobject rgb getref string weekdayname rnd dateadd monthname now day minute isarray cbool round formatcurrency conversions csng timevalue second year space abs clng timeserial fixs len asc isempty maths dateserial atn timer isobject filter weekday datevalue ccur isdate instr datediff formatdatetime replace isnull right sgn array snumeric log cdbl hex chr lbound msgbox ucase getlocale cos cdate cbyte rtrim join hour oct typename trim strcomp int createobject loadpicture tan formatnumber mid scriptenginebuildversion scriptengine split scriptengineminorversion cint sin datepart ltrim sqr scriptenginemajorversion time derived eval date formatpercent exp inputbox left ascw chrw regexp server response request cstr err",literal:"true false null nothing empty"},i:"//",c:[e.inherit(e.QSM,{c:[{b:'""'}]}),e.C(/'/,/$/,{r:0}),e.CNM]}});hljs.registerLanguage("vbscript-html",function(r){return{sL:"xml",c:[{b:"<%",e:"%>",sL:"vbscript"}]}});hljs.registerLanguage("typescript",function(e){var r={keyword:"in if for while finally var new function do return void else break catch instanceof with throw case default try this switch continue typeof delete let yield const class public private protected get set super static implements enum export import declare type namespace abstract as from extends async await",literal:"true false null undefined NaN Infinity",built_in:"eval isFinite isNaN parseFloat parseInt decodeURI decodeURIComponent encodeURI encodeURIComponent escape unescape Object Function Boolean Error EvalError InternalError RangeError ReferenceError StopIteration SyntaxError TypeError URIError Number Math Date String RegExp Array Float32Array Float64Array Int16Array Int32Array Int8Array Uint16Array Uint32Array Uint8Array Uint8ClampedArray ArrayBuffer DataView JSON Intl arguments require module console window document any number boolean string void Promise"};return{aliases:["ts"],k:r,c:[{cN:"meta",b:/^\s*['"]use strict['"]/},e.ASM,e.QSM,{cN:"string",b:"`",e:"`",c:[e.BE,{cN:"subst",b:"\\$\\{",e:"\\}"}]},e.CLCM,e.CBCM,{cN:"number",v:[{b:"\\b(0[bB][01]+)"},{b:"\\b(0[oO][0-7]+)"},{b:e.CNR}],r:0},{b:"("+e.RSR+"|\\b(case|return|throw)\\b)\\s*",k:"return throw case",c:[e.CLCM,e.CBCM,e.RM,{cN:"function",b:"(\\(.*?\\)|"+e.IR+")\\s*=>",rB:!0,e:"\\s*=>",c:[{cN:"params",v:[{b:e.IR},{b:/\(\s*\)/},{b:/\(/,e:/\)/,eB:!0,eE:!0,k:r,c:["self",e.CLCM,e.CBCM]}]}]}],r:0},{cN:"function",b:"function",e:/[\{;]/,eE:!0,k:r,c:["self",e.inherit(e.TM,{b:/[A-Za-z$_][0-9A-Za-z$_]*/}),{cN:"params",b:/\(/,e:/\)/,eB:!0,eE:!0,k:r,c:[e.CLCM,e.CBCM],i:/["'\(]/}],i:/%/,r:0},{bK:"constructor",e:/\{/,eE:!0,c:["self",{cN:"params",b:/\(/,e:/\)/,eB:!0,eE:!0,k:r,c:[e.CLCM,e.CBCM],i:/["'\(]/}]},{b:/module\./,k:{built_in:"module"},r:0},{bK:"module",e:/\{/,eE:!0},{bK:"interface",e:/\{/,eE:!0,k:"interface extends"},{b:/\$[(.]/},{b:"\\."+e.IR,r:0},{cN:"meta",b:"@[A-Za-z]+"}]}});hljs.registerLanguage("bnf",function(e){return{c:[{cN:"attribute",b://},{b:/::=/,starts:{e:/$/,c:[{b://},e.CLCM,e.CBCM,e.ASM,e.QSM]}}]}});hljs.registerLanguage("moonscript",function(e){var t={keyword:"if then not for in while do return else elseif break continue switch and or unless when class extends super local import export from using",literal:"true false nil",built_in:"_G _VERSION assert collectgarbage dofile error getfenv getmetatable ipairs load loadfile loadstring module next pairs pcall print rawequal rawget rawset require select setfenv setmetatable tonumber tostring type unpack xpcall coroutine debug io math os package string table"},r="[A-Za-z$_][0-9A-Za-z$_]*",s={cN:"subst",b:/#\{/,e:/}/,k:t},a=[e.inherit(e.CNM,{starts:{e:"(\\s*/)?",r:0}}),{cN:"string",v:[{b:/'/,e:/'/,c:[e.BE]},{b:/"/,e:/"/,c:[e.BE,s]}]},{cN:"built_in",b:"@__"+e.IR},{b:"@"+e.IR},{b:e.IR+"\\\\"+e.IR}];s.c=a;var c=e.inherit(e.TM,{b:r}),n="(\\(.*\\))?\\s*\\B[-=]>",i={cN:"params",b:"\\([^\\(]",rB:!0,c:[{b:/\(/,e:/\)/,k:t,c:["self"].concat(a)}]};return{aliases:["moon"],k:t,i:/\/\*/,c:a.concat([e.C("--","$"),{cN:"function",b:"^\\s*"+r+"\\s*=\\s*"+n,e:"[-=]>",rB:!0,c:[c,i]},{b:/[\(,:=]\s*/,r:0,c:[{cN:"function",b:n,e:"[-=]>",rB:!0,c:[i]}]},{cN:"class",bK:"class",e:"$",i:/[:="\[\]]/,c:[{bK:"extends",eW:!0,i:/[:="\[\]]/,c:[c]},c]},{cN:"name",b:r+":",e:":",rB:!0,rE:!0,r:0}])}});hljs.registerLanguage("java",function(e){var a="[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*",t=a+"(<"+a+"(\\s*,\\s*"+a+")*>)?",r="false synchronized int abstract float private char boolean static null if const for true while long strictfp finally protected import native final void enum else break transient catch instanceof byte super volatile case assert short package default double public try this switch continue throws protected public private module requires exports do",s="\\b(0[bB]([01]+[01_]+[01]+|[01]+)|0[xX]([a-fA-F0-9]+[a-fA-F0-9_]+[a-fA-F0-9]+|[a-fA-F0-9]+)|(([\\d]+[\\d_]+[\\d]+|[\\d]+)(\\.([\\d]+[\\d_]+[\\d]+|[\\d]+))?|\\.([\\d]+[\\d_]+[\\d]+|[\\d]+))([eE][-+]?\\d+)?)[lLfF]?",c={cN:"number",b:s,r:0};return{aliases:["jsp"],k:r,i:/<\/|#/,c:[e.C("/\\*\\*","\\*/",{r:0,c:[{b:/\w+@/,r:0},{cN:"doctag",b:"@[A-Za-z]+"}]}),e.CLCM,e.CBCM,e.ASM,e.QSM,{cN:"class",bK:"class interface",e:/[{;=]/,eE:!0,k:"class interface",i:/[:"\[\]]/,c:[{bK:"extends implements"},e.UTM]},{bK:"new throw return else",r:0},{cN:"function",b:"("+t+"\\s+)+"+e.UIR+"\\s*\\(",rB:!0,e:/[{;=]/,eE:!0,k:r,c:[{b:e.UIR+"\\s*\\(",rB:!0,r:0,c:[e.UTM]},{cN:"params",b:/\(/,e:/\)/,k:r,r:0,c:[e.ASM,e.QSM,e.CNM,e.CBCM]},e.CLCM,e.CBCM]},c,{cN:"meta",b:"@[A-Za-z]+"}]}});hljs.registerLanguage("fsharp",function(e){var t={b:"<",e:">",c:[e.inherit(e.TM,{b:/'[a-zA-Z0-9_]+/})]};return{aliases:["fs"],k:"abstract and as assert base begin class default delegate do done downcast downto elif else end exception extern false finally for fun function global if in inherit inline interface internal lazy let match member module mutable namespace new null of open or override private public rec return sig static struct then to true try type upcast use val void when while with yield",i:/\/\*/,c:[{cN:"keyword",b:/\b(yield|return|let|do)!/},{cN:"string",b:'@"',e:'"',c:[{b:'""'}]},{cN:"string",b:'"""',e:'"""'},e.C("\\(\\*","\\*\\)"),{cN:"class",bK:"type",e:"\\(|=|$",eE:!0,c:[e.UTM,t]},{cN:"meta",b:"\\[<",e:">\\]",r:10},{cN:"symbol",b:"\\B('[A-Za-z])\\b",c:[e.BE]},e.CLCM,e.inherit(e.QSM,{i:null}),e.CNM]}});hljs.registerLanguage("cpp",function(t){var e={cN:"keyword",b:"\\b[a-z\\d_]*_t\\b"},r={cN:"string",v:[{b:'(u8?|U)?L?"',e:'"',i:"\\n",c:[t.BE]},{b:'(u8?|U)?R"',e:'"',c:[t.BE]},{b:"'\\\\?.",e:"'",i:"."}]},s={cN:"number",v:[{b:"\\b(0b[01']+)"},{b:"(-?)\\b([\\d']+(\\.[\\d']*)?|\\.[\\d']+)(u|U|l|L|ul|UL|f|F|b|B)"},{b:"(-?)(\\b0[xX][a-fA-F0-9']+|(\\b[\\d']+(\\.[\\d']*)?|\\.[\\d']+)([eE][-+]?[\\d']+)?)"}],r:0},i={cN:"meta",b:/#\s*[a-z]+\b/,e:/$/,k:{"meta-keyword":"if else elif endif define undef warning error line pragma ifdef ifndef include"},c:[{b:/\\\n/,r:0},t.inherit(r,{cN:"meta-string"}),{cN:"meta-string",b:/<[^\n>]*>/,e:/$/,i:"\\n"},t.CLCM,t.CBCM]},a=t.IR+"\\s*\\(",c={keyword:"int float while private char catch import module export virtual operator sizeof dynamic_cast|10 typedef const_cast|10 const for static_cast|10 union namespace unsigned long volatile static protected bool template mutable if public friend do goto auto void enum else break extern using asm case typeid short reinterpret_cast|10 default double register explicit signed typename try this switch continue inline delete alignof constexpr decltype noexcept static_assert thread_local restrict _Bool complex _Complex _Imaginary atomic_bool atomic_char atomic_schar atomic_uchar atomic_short atomic_ushort atomic_int atomic_uint atomic_long atomic_ulong atomic_llong atomic_ullong new throw return and or not",built_in:"std string cin cout cerr clog stdin stdout stderr stringstream istringstream ostringstream auto_ptr deque list queue stack vector map set bitset multiset multimap unordered_set unordered_map unordered_multiset unordered_multimap array shared_ptr abort abs acos asin atan2 atan calloc ceil cosh cos exit exp fabs floor fmod fprintf fputs free frexp fscanf isalnum isalpha iscntrl isdigit isgraph islower isprint ispunct isspace isupper isxdigit tolower toupper labs ldexp log10 log malloc realloc memchr memcmp memcpy memset modf pow printf putchar puts scanf sinh sin snprintf sprintf sqrt sscanf strcat strchr strcmp strcpy strcspn strlen strncat strncmp strncpy strpbrk strrchr strspn strstr tanh tan vfprintf vprintf vsprintf endl initializer_list unique_ptr",literal:"true false nullptr NULL"},n=[e,t.CLCM,t.CBCM,s,r];return{aliases:["c","cc","h","c++","h++","hpp"],k:c,i:"",k:c,c:["self",e]},{b:t.IR+"::",k:c},{v:[{b:/=/,e:/;/},{b:/\(/,e:/\)/},{bK:"new throw return else",e:/;/}],k:c,c:n.concat([{b:/\(/,e:/\)/,k:c,c:n.concat(["self"]),r:0}]),r:0},{cN:"function",b:"("+t.IR+"[\\*&\\s]+)+"+a,rB:!0,e:/[{;=]/,eE:!0,k:c,i:/[^\w\s\*&]/,c:[{b:a,rB:!0,c:[t.TM],r:0},{cN:"params",b:/\(/,e:/\)/,k:c,r:0,c:[t.CLCM,t.CBCM,r,s,e]},t.CLCM,t.CBCM,i]},{cN:"class",bK:"class struct",e:/[{;:]/,c:[{b://,c:["self"]},t.TM]}]),exports:{preprocessor:i,strings:r,k:c}}});hljs.registerLanguage("lua",function(e){var t="\\[=*\\[",a="\\]=*\\]",r={b:t,e:a,c:["self"]},n=[e.C("--(?!"+t+")","$"),e.C("--"+t,a,{c:[r],r:10})];return{l:e.UIR,k:{literal:"true false nil",keyword:"and break do else elseif end for goto if in local not or repeat return then until while",built_in:"_G _ENV _VERSION __index __newindex __mode __call __metatable __tostring __len __gc __add __sub __mul __div __mod __pow __concat __unm __eq __lt __le assert collectgarbage dofile error getfenv getmetatable ipairs load loadfile loadstringmodule next pairs pcall print rawequal rawget rawset require select setfenvsetmetatable tonumber tostring type unpack xpcall arg selfcoroutine resume yield status wrap create running debug getupvalue debug sethook getmetatable gethook setmetatable setlocal traceback setfenv getinfo setupvalue getlocal getregistry getfenv io lines write close flush open output type read stderr stdin input stdout popen tmpfile math log max acos huge ldexp pi cos tanh pow deg tan cosh sinh random randomseed frexp ceil floor rad abs sqrt modf asin min mod fmod log10 atan2 exp sin atan os exit setlocale date getenv difftime remove time clock tmpname rename execute package preload loadlib loaded loaders cpath config path seeall string sub upper len gfind rep find match char dump gmatch reverse byte format gsub lower table setn insert getn foreachi maxn foreach concat sort remove"},c:n.concat([{cN:"function",bK:"function",e:"\\)",c:[e.inherit(e.TM,{b:"([_a-zA-Z]\\w*\\.)*([_a-zA-Z]\\w*:)?[_a-zA-Z]\\w*"}),{cN:"params",b:"\\(",eW:!0,c:n}].concat(n)},e.CNM,e.ASM,e.QSM,{cN:"string",b:t,e:a,c:[r],r:5}])}});hljs.registerLanguage("erlang",function(e){var r="[a-z'][a-zA-Z0-9_']*",c="("+r+":"+r+"|"+r+")",b={keyword:"after and andalso|10 band begin bnot bor bsl bzr bxor case catch cond div end fun if let not of orelse|10 query receive rem try when xor",literal:"false true"},i=e.C("%","$"),n={cN:"number",b:"\\b(\\d+#[a-fA-F0-9]+|\\d+(\\.\\d+)?([eE][-+]?\\d+)?)",r:0},a={b:"fun\\s+"+r+"/\\d+"},d={b:c+"\\(",e:"\\)",rB:!0,r:0,c:[{b:c,r:0},{b:"\\(",e:"\\)",eW:!0,rE:!0,r:0}]},o={b:"{",e:"}",r:0},t={b:"\\b_([A-Z][A-Za-z0-9_]*)?",r:0},f={b:"[A-Z][a-zA-Z0-9_]*",r:0},l={b:"#"+e.UIR,r:0,rB:!0,c:[{b:"#"+e.UIR,r:0},{b:"{",e:"}",r:0}]},s={bK:"fun receive if try case",e:"end",k:b};s.c=[i,a,e.inherit(e.ASM,{cN:""}),s,d,e.QSM,n,o,t,f,l];var u=[i,a,s,d,e.QSM,n,o,t,f,l];d.c[1].c=u,o.c=u,l.c[1].c=u;var h={cN:"params",b:"\\(",e:"\\)",c:u};return{aliases:["erl"],k:b,i:"(",rB:!0,i:"\\(|#|//|/\\*|\\\\|:|;",c:[h,e.inherit(e.TM,{b:r})],starts:{e:";|\\.",k:b,c:u}},i,{b:"^-",e:"\\.",r:0,eE:!0,rB:!0,l:"-"+e.IR,k:"-module -record -undef -export -ifdef -ifndef -author -copyright -doc -vsn -import -include -include_lib -compile -define -else -endif -file -behaviour -behavior -spec",c:[h]},n,e.QSM,l,t,f,o,{b:/\.$/}]}});hljs.registerLanguage("htmlbars",function(e){var a="action collection component concat debugger each each-in else get hash if input link-to loc log mut outlet partial query-params render textarea unbound unless with yield view",t={i:/\}\}/,b:/[a-zA-Z0-9_]+=/,rB:!0,r:0,c:[{cN:"attr",b:/[a-zA-Z0-9_]+/}]},i=({i:/\}\}/,b:/\)/,e:/\)/,c:[{b:/[a-zA-Z\.\-]+/,k:{built_in:a},starts:{eW:!0,r:0,c:[e.QSM]}}]},{eW:!0,r:0,k:{keyword:"as",built_in:a},c:[e.QSM,t,e.NM]});return{cI:!0,sL:"xml",c:[e.C("{{!(--)?","(--)?}}"),{cN:"template-tag",b:/\{\{[#\/]/,e:/\}\}/,c:[{cN:"name",b:/[a-zA-Z\.\-]+/,k:{"builtin-name":a},starts:i}]},{cN:"template-variable",b:/\{\{[a-zA-Z][a-zA-Z\-]+/,e:/\}\}/,k:{keyword:"as",built_in:a},c:[e.QSM]}]}});hljs.registerLanguage("ruby",function(e){var b="[a-zA-Z_]\\w*[!?=]?|[-+~]\\@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?",r={keyword:"and then defined module in return redo if BEGIN retry end for self when next until do begin unless END rescue else break undef not super class case require yield alias while ensure elsif or include attr_reader attr_writer attr_accessor",literal:"true false nil"},c={cN:"doctag",b:"@[A-Za-z]+"},a={b:"#<",e:">"},s=[e.C("#","$",{c:[c]}),e.C("^\\=begin","^\\=end",{c:[c],r:10}),e.C("^__END__","\\n$")],n={cN:"subst",b:"#\\{",e:"}",k:r},t={cN:"string",c:[e.BE,n],v:[{b:/'/,e:/'/},{b:/"/,e:/"/},{b:/`/,e:/`/},{b:"%[qQwWx]?\\(",e:"\\)"},{b:"%[qQwWx]?\\[",e:"\\]"},{b:"%[qQwWx]?{",e:"}"},{b:"%[qQwWx]?<",e:">"},{b:"%[qQwWx]?/",e:"/"},{b:"%[qQwWx]?%",e:"%"},{b:"%[qQwWx]?-",e:"-"},{b:"%[qQwWx]?\\|",e:"\\|"},{b:/\B\?(\\\d{1,3}|\\x[A-Fa-f0-9]{1,2}|\\u[A-Fa-f0-9]{4}|\\?\S)\b/},{b:/<<(-?)\w+$/,e:/^\s*\w+$/}]},i={cN:"params",b:"\\(",e:"\\)",endsParent:!0,k:r},d=[t,a,{cN:"class",bK:"class module",e:"$|;",i:/=/,c:[e.inherit(e.TM,{b:"[A-Za-z_]\\w*(::\\w+)*(\\?|\\!)?"}),{b:"<\\s*",c:[{b:"("+e.IR+"::)?"+e.IR}]}].concat(s)},{cN:"function",bK:"def",e:"$|;",c:[e.inherit(e.TM,{b:b}),i].concat(s)},{b:e.IR+"::"},{cN:"symbol",b:e.UIR+"(\\!|\\?)?:",r:0},{cN:"symbol",b:":(?!\\s)",c:[t,{b:b}],r:0},{cN:"number",b:"(\\b0[0-7_]+)|(\\b0x[0-9a-fA-F_]+)|(\\b[1-9][0-9_]*(\\.[0-9_]+)?)|[0_]\\b",r:0},{b:"(\\$\\W)|((\\$|\\@\\@?)(\\w+))"},{cN:"params",b:/\|/,e:/\|/,k:r},{b:"("+e.RSR+"|unless)\\s*",k:"unless",c:[a,{cN:"regexp",c:[e.BE,n],i:/\n/,v:[{b:"/",e:"/[a-z]*"},{b:"%r{",e:"}[a-z]*"},{b:"%r\\(",e:"\\)[a-z]*"},{b:"%r!",e:"![a-z]*"},{b:"%r\\[",e:"\\][a-z]*"}]}].concat(s),r:0}].concat(s);n.c=d,i.c=d;var l="[>?]>",o="[\\w#]+\\(\\w+\\):\\d+:\\d+>",u="(\\w+-)?\\d+\\.\\d+\\.\\d(p\\d+)?[^>]+>",w=[{b:/^\s*=>/,starts:{e:"$",c:d}},{cN:"meta",b:"^("+l+"|"+o+"|"+u+")",starts:{e:"$",c:d}}];return{aliases:["rb","gemspec","podspec","thor","irb"],k:r,i:/\/\*/,c:s.concat(w).concat(d)}});hljs.registerLanguage("haml",function(s){return{cI:!0,c:[{cN:"meta",b:"^!!!( (5|1\\.1|Strict|Frameset|Basic|Mobile|RDFa|XML\\b.*))?$",r:10},s.C("^\\s*(!=#|=#|-#|/).*$",!1,{r:0}),{b:"^\\s*(-|=|!=)(?!#)",starts:{e:"\\n",sL:"ruby"}},{cN:"tag",b:"^\\s*%",c:[{cN:"selector-tag",b:"\\w+"},{cN:"selector-id",b:"#[\\w-]+"},{cN:"selector-class",b:"\\.[\\w-]+"},{b:"{\\s*",e:"\\s*}",c:[{b:":\\w+\\s*=>",e:",\\s+",rB:!0,eW:!0,c:[{cN:"attr",b:":\\w+"},s.ASM,s.QSM,{b:"\\w+",r:0}]}]},{b:"\\(\\s*",e:"\\s*\\)",eE:!0,c:[{b:"\\w+\\s*=",e:"\\s+",rB:!0,eW:!0,c:[{cN:"attr",b:"\\w+",r:0},s.ASM,s.QSM,{b:"\\w+",r:0}]}]}]},{b:"^\\s*[=~]\\s*"},{b:"#{",starts:{e:"}",sL:"ruby"}}]}});hljs.registerLanguage("mizar",function(e){return{k:"environ vocabularies notations constructors definitions registrations theorems schemes requirements begin end definition registration cluster existence pred func defpred deffunc theorem proof let take assume then thus hence ex for st holds consider reconsider such that and in provided of as from be being by means equals implies iff redefine define now not or attr is mode suppose per cases set thesis contradiction scheme reserve struct correctness compatibility coherence symmetry assymetry reflexivity irreflexivity connectedness uniqueness commutativity idempotence involutiveness projectivity",c:[e.C("::","$")]}});hljs.registerLanguage("sql",function(e){var t=e.C("--","$");return{cI:!0,i:/[<>{}*#]/,c:[{bK:"begin end start commit rollback savepoint lock alter create drop rename call delete do handler insert load replace select truncate update set show pragma grant merge describe use explain help declare prepare execute deallocate release unlock purge reset change stop analyze cache flush optimize repair kill install uninstall checksum restore check backup revoke comment",e:/;/,eW:!0,l:/[\w\.]+/,k:{keyword:"abort abs absolute acc acce accep accept access accessed accessible account acos action activate add addtime admin administer advanced advise aes_decrypt aes_encrypt after agent aggregate ali alia alias allocate allow alter always analyze ancillary and any anydata anydataset anyschema anytype apply archive archived archivelog are as asc ascii asin assembly assertion associate asynchronous at atan atn2 attr attri attrib attribu attribut attribute attributes audit authenticated authentication authid authors auto autoallocate autodblink autoextend automatic availability avg backup badfile basicfile before begin beginning benchmark between bfile bfile_base big bigfile bin binary_double binary_float binlog bit_and bit_count bit_length bit_or bit_xor bitmap blob_base block blocksize body both bound buffer_cache buffer_pool build bulk by byte byteordermark bytes cache caching call calling cancel capacity cascade cascaded case cast catalog category ceil ceiling chain change changed char_base char_length character_length characters characterset charindex charset charsetform charsetid check checksum checksum_agg child choose chr chunk class cleanup clear client clob clob_base clone close cluster_id cluster_probability cluster_set clustering coalesce coercibility col collate collation collect colu colum column column_value columns columns_updated comment commit compact compatibility compiled complete composite_limit compound compress compute concat concat_ws concurrent confirm conn connec connect connect_by_iscycle connect_by_isleaf connect_by_root connect_time connection consider consistent constant constraint constraints constructor container content contents context contributors controlfile conv convert convert_tz corr corr_k corr_s corresponding corruption cos cost count count_big counted covar_pop covar_samp cpu_per_call cpu_per_session crc32 create creation critical cross cube cume_dist curdate current current_date current_time current_timestamp current_user cursor curtime customdatum cycle data database databases datafile datafiles datalength date_add date_cache date_format date_sub dateadd datediff datefromparts datename datepart datetime2fromparts day day_to_second dayname dayofmonth dayofweek dayofyear days db_role_change dbtimezone ddl deallocate declare decode decompose decrement decrypt deduplicate def defa defau defaul default defaults deferred defi defin define degrees delayed delegate delete delete_all delimited demand dense_rank depth dequeue des_decrypt des_encrypt des_key_file desc descr descri describ describe descriptor deterministic diagnostics difference dimension direct_load directory disable disable_all disallow disassociate discardfile disconnect diskgroup distinct distinctrow distribute distributed div do document domain dotnet double downgrade drop dumpfile duplicate duration each edition editionable editions element ellipsis else elsif elt empty enable enable_all enclosed encode encoding encrypt end end-exec endian enforced engine engines enqueue enterprise entityescaping eomonth error errors escaped evalname evaluate event eventdata events except exception exceptions exchange exclude excluding execu execut execute exempt exists exit exp expire explain export export_set extended extent external external_1 external_2 externally extract failed failed_login_attempts failover failure far fast feature_set feature_value fetch field fields file file_name_convert filesystem_like_logging final finish first first_value fixed flash_cache flashback floor flush following follows for forall force form forma format found found_rows freelist freelists freepools fresh from from_base64 from_days ftp full function general generated get get_format get_lock getdate getutcdate global global_name globally go goto grant grants greatest group group_concat group_id grouping grouping_id groups gtid_subtract guarantee guard handler hash hashkeys having hea head headi headin heading heap help hex hierarchy high high_priority hosts hour http id ident_current ident_incr ident_seed identified identity idle_time if ifnull ignore iif ilike ilm immediate import in include including increment index indexes indexing indextype indicator indices inet6_aton inet6_ntoa inet_aton inet_ntoa infile initial initialized initially initrans inmemory inner innodb input insert install instance instantiable instr interface interleaved intersect into invalidate invisible is is_free_lock is_ipv4 is_ipv4_compat is_not is_not_null is_used_lock isdate isnull isolation iterate java join json json_exists keep keep_duplicates key keys kill language large last last_day last_insert_id last_value lax lcase lead leading least leaves left len lenght length less level levels library like like2 like4 likec limit lines link list listagg little ln load load_file lob lobs local localtime localtimestamp locate locator lock locked log log10 log2 logfile logfiles logging logical logical_reads_per_call logoff logon logs long loop low low_priority lower lpad lrtrim ltrim main make_set makedate maketime managed management manual map mapping mask master master_pos_wait match matched materialized max maxextents maximize maxinstances maxlen maxlogfiles maxloghistory maxlogmembers maxsize maxtrans md5 measures median medium member memcompress memory merge microsecond mid migration min minextents minimum mining minus minute minvalue missing mod mode model modification modify module monitoring month months mount move movement multiset mutex name name_const names nan national native natural nav nchar nclob nested never new newline next nextval no no_write_to_binlog noarchivelog noaudit nobadfile nocheck nocompress nocopy nocycle nodelay nodiscardfile noentityescaping noguarantee nokeep nologfile nomapping nomaxvalue nominimize nominvalue nomonitoring none noneditionable nonschema noorder nopr nopro noprom nopromp noprompt norely noresetlogs noreverse normal norowdependencies noschemacheck noswitch not nothing notice notrim novalidate now nowait nth_value nullif nulls num numb numbe nvarchar nvarchar2 object ocicoll ocidate ocidatetime ociduration ociinterval ociloblocator ocinumber ociref ocirefcursor ocirowid ocistring ocitype oct octet_length of off offline offset oid oidindex old on online only opaque open operations operator optimal optimize option optionally or oracle oracle_date oradata ord ordaudio orddicom orddoc order ordimage ordinality ordvideo organization orlany orlvary out outer outfile outline output over overflow overriding package pad parallel parallel_enable parameters parent parse partial partition partitions pascal passing password password_grace_time password_lock_time password_reuse_max password_reuse_time password_verify_function patch path patindex pctincrease pctthreshold pctused pctversion percent percent_rank percentile_cont percentile_disc performance period period_add period_diff permanent physical pi pipe pipelined pivot pluggable plugin policy position post_transaction pow power pragma prebuilt precedes preceding precision prediction prediction_cost prediction_details prediction_probability prediction_set prepare present preserve prior priority private private_sga privileges procedural procedure procedure_analyze processlist profiles project prompt protection public publishingservername purge quarter query quick quiesce quota quotename radians raise rand range rank raw read reads readsize rebuild record records recover recovery recursive recycle redo reduced ref reference referenced references referencing refresh regexp_like register regr_avgx regr_avgy regr_count regr_intercept regr_r2 regr_slope regr_sxx regr_sxy reject rekey relational relative relaylog release release_lock relies_on relocate rely rem remainder rename repair repeat replace replicate replication required reset resetlogs resize resource respect restore restricted result result_cache resumable resume retention return returning returns reuse reverse revoke right rlike role roles rollback rolling rollup round row row_count rowdependencies rowid rownum rows rtrim rules safe salt sample save savepoint sb1 sb2 sb4 scan schema schemacheck scn scope scroll sdo_georaster sdo_topo_geometry search sec_to_time second section securefile security seed segment select self sequence sequential serializable server servererror session session_user sessions_per_user set sets settings sha sha1 sha2 share shared shared_pool short show shrink shutdown si_averagecolor si_colorhistogram si_featurelist si_positionalcolor si_stillimage si_texture siblings sid sign sin size size_t sizes skip slave sleep smalldatetimefromparts smallfile snapshot some soname sort soundex source space sparse spfile split sql sql_big_result sql_buffer_result sql_cache sql_calc_found_rows sql_small_result sql_variant_property sqlcode sqldata sqlerror sqlname sqlstate sqrt square standalone standby start starting startup statement static statistics stats_binomial_test stats_crosstab stats_ks_test stats_mode stats_mw_test stats_one_way_anova stats_t_test_ stats_t_test_indep stats_t_test_one stats_t_test_paired stats_wsr_test status std stddev stddev_pop stddev_samp stdev stop storage store stored str str_to_date straight_join strcmp strict string struct stuff style subdate subpartition subpartitions substitutable substr substring subtime subtring_index subtype success sum suspend switch switchoffset switchover sync synchronous synonym sys sys_xmlagg sysasm sysaux sysdate sysdatetimeoffset sysdba sysoper system system_user sysutcdatetime table tables tablespace tan tdo template temporary terminated tertiary_weights test than then thread through tier ties time time_format time_zone timediff timefromparts timeout timestamp timestampadd timestampdiff timezone_abbr timezone_minute timezone_region to to_base64 to_date to_days to_seconds todatetimeoffset trace tracking transaction transactional translate translation treat trigger trigger_nestlevel triggers trim truncate try_cast try_convert try_parse type ub1 ub2 ub4 ucase unarchived unbounded uncompress under undo unhex unicode uniform uninstall union unique unix_timestamp unknown unlimited unlock unpivot unrecoverable unsafe unsigned until untrusted unusable unused update updated upgrade upped upper upsert url urowid usable usage use use_stored_outlines user user_data user_resources users using utc_date utc_timestamp uuid uuid_short validate validate_password_strength validation valist value values var var_samp varcharc vari varia variab variabl variable variables variance varp varraw varrawc varray verify version versions view virtual visible void wait wallet warning warnings week weekday weekofyear wellformed when whene whenev wheneve whenever where while whitespace with within without work wrapped xdb xml xmlagg xmlattributes xmlcast xmlcolattval xmlelement xmlexists xmlforest xmlindex xmlnamespaces xmlpi xmlquery xmlroot xmlschema xmlserialize xmltable xmltype xor year year_to_month years yearweek",literal:"true false null",built_in:"array bigint binary bit blob boolean char character date dec decimal float int int8 integer interval number numeric real record serial serial8 smallint text varchar varying void"},c:[{cN:"string",b:"'",e:"'",c:[e.BE,{b:"''"}]},{cN:"string",b:'"',e:'"',c:[e.BE,{b:'""'}]},{cN:"string",b:"`",e:"`",c:[e.BE]},e.CNM,e.CBCM,t]},e.CBCM,t]}});hljs.registerLanguage("django",function(e){var t={b:/\|[A-Za-z]+:?/,k:{name:"truncatewords removetags linebreaksbr yesno get_digit timesince random striptags filesizeformat escape linebreaks length_is ljust rjust cut urlize fix_ampersands title floatformat capfirst pprint divisibleby add make_list unordered_list urlencode timeuntil urlizetrunc wordcount stringformat linenumbers slice date dictsort dictsortreversed default_if_none pluralize lower join center default truncatewords_html upper length phone2numeric wordwrap time addslashes slugify first escapejs force_escape iriencode last safe safeseq truncatechars localize unlocalize localtime utc timezone"},c:[e.QSM,e.ASM]};return{aliases:["jinja"],cI:!0,sL:"xml",c:[e.C(/\{%\s*comment\s*%}/,/\{%\s*endcomment\s*%}/),e.C(/\{#/,/#}/),{cN:"template-tag",b:/\{%/,e:/%}/,c:[{cN:"name",b:/\w+/,k:{name:"comment endcomment load templatetag ifchanged endifchanged if endif firstof for endfor ifnotequal endifnotequal widthratio extends include spaceless endspaceless regroup ifequal endifequal ssi now with cycle url filter endfilter debug block endblock else autoescape endautoescape csrf_token empty elif endwith static trans blocktrans endblocktrans get_static_prefix get_media_prefix plural get_current_language language get_available_languages get_current_language_bidi get_language_info get_language_info_list localize endlocalize localtime endlocaltime timezone endtimezone get_current_timezone verbatim"},starts:{eW:!0,k:"in by as",c:[t],r:0}}]},{cN:"template-variable",b:/\{\{/,e:/}}/,c:[t]}]}});hljs.registerLanguage("avrasm",function(r){return{cI:!0,l:"\\.?"+r.IR,k:{keyword:"adc add adiw and andi asr bclr bld brbc brbs brcc brcs break breq brge brhc brhs brid brie brlo brlt brmi brne brpl brsh brtc brts brvc brvs bset bst call cbi cbr clc clh cli cln clr cls clt clv clz com cp cpc cpi cpse dec eicall eijmp elpm eor fmul fmuls fmulsu icall ijmp in inc jmp ld ldd ldi lds lpm lsl lsr mov movw mul muls mulsu neg nop or ori out pop push rcall ret reti rjmp rol ror sbc sbr sbrc sbrs sec seh sbi sbci sbic sbis sbiw sei sen ser ses set sev sez sleep spm st std sts sub subi swap tst wdr",built_in:"r0 r1 r2 r3 r4 r5 r6 r7 r8 r9 r10 r11 r12 r13 r14 r15 r16 r17 r18 r19 r20 r21 r22 r23 r24 r25 r26 r27 r28 r29 r30 r31 x|0 xh xl y|0 yh yl z|0 zh zl ucsr1c udr1 ucsr1a ucsr1b ubrr1l ubrr1h ucsr0c ubrr0h tccr3c tccr3a tccr3b tcnt3h tcnt3l ocr3ah ocr3al ocr3bh ocr3bl ocr3ch ocr3cl icr3h icr3l etimsk etifr tccr1c ocr1ch ocr1cl twcr twdr twar twsr twbr osccal xmcra xmcrb eicra spmcsr spmcr portg ddrg ping portf ddrf sreg sph spl xdiv rampz eicrb eimsk gimsk gicr eifr gifr timsk tifr mcucr mcucsr tccr0 tcnt0 ocr0 assr tccr1a tccr1b tcnt1h tcnt1l ocr1ah ocr1al ocr1bh ocr1bl icr1h icr1l tccr2 tcnt2 ocr2 ocdr wdtcr sfior eearh eearl eedr eecr porta ddra pina portb ddrb pinb portc ddrc pinc portd ddrd pind spdr spsr spcr udr0 ucsr0a ucsr0b ubrr0l acsr admux adcsr adch adcl porte ddre pine pinf",meta:".byte .cseg .db .def .device .dseg .dw .endmacro .equ .eseg .exit .include .list .listmac .macro .nolist .org .set"},c:[r.CBCM,r.C(";","$",{r:0}),r.CNM,r.BNM,{cN:"number",b:"\\b(\\$[a-zA-Z0-9]+|0o[0-7]+)"},r.QSM,{cN:"string",b:"'",e:"[^\\\\]'",i:"[^\\\\][^']"},{cN:"symbol",b:"^[A-Za-z0-9_.$]+:"},{cN:"meta",b:"#",e:"$"},{cN:"subst",b:"@[0-9]+"}]}});hljs.registerLanguage("q",function(e){var s={keyword:"do while select delete by update from",literal:"0b 1b",built_in:"neg not null string reciprocal floor ceiling signum mod xbar xlog and or each scan over prior mmu lsq inv md5 ltime gtime count first var dev med cov cor all any rand sums prds mins maxs fills deltas ratios avgs differ prev next rank reverse iasc idesc asc desc msum mcount mavg mdev xrank mmin mmax xprev rotate distinct group where flip type key til get value attr cut set upsert raze union inter except cross sv vs sublist enlist read0 read1 hopen hclose hdel hsym hcount peach system ltrim rtrim trim lower upper ssr view tables views cols xcols keys xkey xcol xasc xdesc fkeys meta lj aj aj0 ij pj asof uj ww wj wj1 fby xgroup ungroup ej save load rsave rload show csv parse eval min max avg wavg wsum sin cos tan sum",type:"`float `double int `timestamp `timespan `datetime `time `boolean `symbol `char `byte `short `long `real `month `date `minute `second `guid"};return{aliases:["k","kdb"],k:s,l:/(`?)[A-Za-z0-9_]+\b/,c:[e.CLCM,e.QSM,e.CNM]}});hljs.registerLanguage("brainfuck",function(r){var n={cN:"literal",b:"[\\+\\-]",r:0};return{aliases:["bf"],c:[r.C("[^\\[\\]\\.,\\+\\-<> \r\n]","[\\[\\]\\.,\\+\\-<> \r\n]",{rE:!0,r:0}),{cN:"title",b:"[\\[\\]]",r:0},{cN:"string",b:"[\\.,]",r:0},{b:/\+\+|\-\-/,rB:!0,c:[n]},n]}});hljs.registerLanguage("nginx",function(e){var r={cN:"variable",v:[{b:/\$\d+/},{b:/\$\{/,e:/}/},{b:"[\\$\\@]"+e.UIR}]},b={eW:!0,l:"[a-z/_]+",k:{literal:"on off yes no true false none blocked debug info notice warn error crit select break last permanent redirect kqueue rtsig epoll poll /dev/poll"},r:0,i:"=>",c:[e.HCM,{cN:"string",c:[e.BE,r],v:[{b:/"/,e:/"/},{b:/'/,e:/'/}]},{b:"([a-z]+):/",e:"\\s",eW:!0,eE:!0,c:[r]},{cN:"regexp",c:[e.BE,r],v:[{b:"\\s\\^",e:"\\s|{|;",rE:!0},{b:"~\\*?\\s+",e:"\\s|{|;",rE:!0},{b:"\\*(\\.[a-z\\-]+)+"},{b:"([a-z\\-]+\\.)+\\*"}]},{cN:"number",b:"\\b\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}(:\\d{1,5})?\\b"},{cN:"number",b:"\\b\\d+[kKmMgGdshdwy]*\\b",r:0},r]};return{aliases:["nginxconf"],c:[e.HCM,{b:e.UIR+"\\s+{",rB:!0,e:"{",c:[{cN:"section",b:e.UIR}],r:0},{b:e.UIR+"\\s",e:";|{",rB:!0,c:[{cN:"attribute",b:e.UIR,starts:b}],r:0}],i:"[^\\s\\}]"}});hljs.registerLanguage("excel",function(E){return{aliases:["xlsx","xls"],cI:!0,l:/[a-zA-Z][\w\.]*/,k:{built_in:"ABS ACCRINT ACCRINTM ACOS ACOSH ACOT ACOTH AGGREGATE ADDRESS AMORDEGRC AMORLINC AND ARABIC AREAS ASC ASIN ASINH ATAN ATAN2 ATANH AVEDEV AVERAGE AVERAGEA AVERAGEIF AVERAGEIFS BAHTTEXT BASE BESSELI BESSELJ BESSELK BESSELY BETADIST BETA.DIST BETAINV BETA.INV BIN2DEC BIN2HEX BIN2OCT BINOMDIST BINOM.DIST BINOM.DIST.RANGE BINOM.INV BITAND BITLSHIFT BITOR BITRSHIFT BITXOR CALL CEILING CEILING.MATH CEILING.PRECISE CELL CHAR CHIDIST CHIINV CHITEST CHISQ.DIST CHISQ.DIST.RT CHISQ.INV CHISQ.INV.RT CHISQ.TEST CHOOSE CLEAN CODE COLUMN COLUMNS COMBIN COMBINA COMPLEX CONCAT CONCATENATE CONFIDENCE CONFIDENCE.NORM CONFIDENCE.T CONVERT CORREL COS COSH COT COTH COUNT COUNTA COUNTBLANK COUNTIF COUNTIFS COUPDAYBS COUPDAYS COUPDAYSNC COUPNCD COUPNUM COUPPCD COVAR COVARIANCE.P COVARIANCE.S CRITBINOM CSC CSCH CUBEKPIMEMBER CUBEMEMBER CUBEMEMBERPROPERTY CUBERANKEDMEMBER CUBESET CUBESETCOUNT CUBEVALUE CUMIPMT CUMPRINC DATE DATEDIF DATEVALUE DAVERAGE DAY DAYS DAYS360 DB DBCS DCOUNT DCOUNTA DDB DEC2BIN DEC2HEX DEC2OCT DECIMAL DEGREES DELTA DEVSQ DGET DISC DMAX DMIN DOLLAR DOLLARDE DOLLARFR DPRODUCT DSTDEV DSTDEVP DSUM DURATION DVAR DVARP EDATE EFFECT ENCODEURL EOMONTH ERF ERF.PRECISE ERFC ERFC.PRECISE ERROR.TYPE EUROCONVERT EVEN EXACT EXP EXPON.DIST EXPONDIST FACT FACTDOUBLE FALSE|0 F.DIST FDIST F.DIST.RT FILTERXML FIND FINDB F.INV F.INV.RT FINV FISHER FISHERINV FIXED FLOOR FLOOR.MATH FLOOR.PRECISE FORECAST FORECAST.ETS FORECAST.ETS.CONFINT FORECAST.ETS.SEASONALITY FORECAST.ETS.STAT FORECAST.LINEAR FORMULATEXT FREQUENCY F.TEST FTEST FV FVSCHEDULE GAMMA GAMMA.DIST GAMMADIST GAMMA.INV GAMMAINV GAMMALN GAMMALN.PRECISE GAUSS GCD GEOMEAN GESTEP GETPIVOTDATA GROWTH HARMEAN HEX2BIN HEX2DEC HEX2OCT HLOOKUP HOUR HYPERLINK HYPGEOM.DIST HYPGEOMDIST IF|0 IFERROR IFNA IFS IMABS IMAGINARY IMARGUMENT IMCONJUGATE IMCOS IMCOSH IMCOT IMCSC IMCSCH IMDIV IMEXP IMLN IMLOG10 IMLOG2 IMPOWER IMPRODUCT IMREAL IMSEC IMSECH IMSIN IMSINH IMSQRT IMSUB IMSUM IMTAN INDEX INDIRECT INFO INT INTERCEPT INTRATE IPMT IRR ISBLANK ISERR ISERROR ISEVEN ISFORMULA ISLOGICAL ISNA ISNONTEXT ISNUMBER ISODD ISREF ISTEXT ISO.CEILING ISOWEEKNUM ISPMT JIS KURT LARGE LCM LEFT LEFTB LEN LENB LINEST LN LOG LOG10 LOGEST LOGINV LOGNORM.DIST LOGNORMDIST LOGNORM.INV LOOKUP LOWER MATCH MAX MAXA MAXIFS MDETERM MDURATION MEDIAN MID MIDBs MIN MINIFS MINA MINUTE MINVERSE MIRR MMULT MOD MODE MODE.MULT MODE.SNGL MONTH MROUND MULTINOMIAL MUNIT N NA NEGBINOM.DIST NEGBINOMDIST NETWORKDAYS NETWORKDAYS.INTL NOMINAL NORM.DIST NORMDIST NORMINV NORM.INV NORM.S.DIST NORMSDIST NORM.S.INV NORMSINV NOT NOW NPER NPV NUMBERVALUE OCT2BIN OCT2DEC OCT2HEX ODD ODDFPRICE ODDFYIELD ODDLPRICE ODDLYIELD OFFSET OR PDURATION PEARSON PERCENTILE.EXC PERCENTILE.INC PERCENTILE PERCENTRANK.EXC PERCENTRANK.INC PERCENTRANK PERMUT PERMUTATIONA PHI PHONETIC PI PMT POISSON.DIST POISSON POWER PPMT PRICE PRICEDISC PRICEMAT PROB PRODUCT PROPER PV QUARTILE QUARTILE.EXC QUARTILE.INC QUOTIENT RADIANS RAND RANDBETWEEN RANK.AVG RANK.EQ RANK RATE RECEIVED REGISTER.ID REPLACE REPLACEB REPT RIGHT RIGHTB ROMAN ROUND ROUNDDOWN ROUNDUP ROW ROWS RRI RSQ RTD SEARCH SEARCHB SEC SECH SECOND SERIESSUM SHEET SHEETS SIGN SIN SINH SKEW SKEW.P SLN SLOPE SMALL SQL.REQUEST SQRT SQRTPI STANDARDIZE STDEV STDEV.P STDEV.S STDEVA STDEVP STDEVPA STEYX SUBSTITUTE SUBTOTAL SUM SUMIF SUMIFS SUMPRODUCT SUMSQ SUMX2MY2 SUMX2PY2 SUMXMY2 SWITCH SYD T TAN TANH TBILLEQ TBILLPRICE TBILLYIELD T.DIST T.DIST.2T T.DIST.RT TDIST TEXT TEXTJOIN TIME TIMEVALUE T.INV T.INV.2T TINV TODAY TRANSPOSE TREND TRIM TRIMMEAN TRUE|0 TRUNC T.TEST TTEST TYPE UNICHAR UNICODE UPPER VALUE VAR VAR.P VAR.S VARA VARP VARPA VDB VLOOKUP WEBSERVICE WEEKDAY WEEKNUM WEIBULL WEIBULL.DIST WORKDAY WORKDAY.INTL XIRR XNPV XOR YEAR YEARFRAC YIELD YIELDDISC YIELDMAT Z.TEST ZTEST"},c:[{b:/^=/,e:/[^=]/,rE:!0,i:/=/,r:10},{cN:"symbol",b:/\b[A-Z]{1,2}\d+\b/,e:/[^\d]/,eE:!0,r:0},{cN:"symbol",b:/[A-Z]{0,2}\d*:[A-Z]{0,2}\d*/,r:0},E.BE,E.QSM,{cN:"number",b:E.NR+"(%)?",r:0},E.C(/\bN\(/,/\)/,{eB:!0,eE:!0,i:/\n/})]}});hljs.registerLanguage("aspectj",function(e){var t="false synchronized int abstract float private char boolean static null if const for true while long throw strictfp finally protected import native final return void enum else extends implements break transient new catch instanceof byte super volatile case assert short package default double public try this switch continue throws privileged aspectOf adviceexecution proceed cflowbelow cflow initialization preinitialization staticinitialization withincode target within execution getWithinTypeName handler thisJoinPoint thisJoinPointStaticPart thisEnclosingJoinPointStaticPart declare parents warning error soft precedence thisAspectInstance",i="get set args call";return{k:t,i:/<\/|#/,c:[e.C("/\\*\\*","\\*/",{r:0,c:[{b:/\w+@/,r:0},{cN:"doctag",b:"@[A-Za-z]+"}]}),e.CLCM,e.CBCM,e.ASM,e.QSM,{cN:"class",bK:"aspect",e:/[{;=]/,eE:!0,i:/[:;"\[\]]/,c:[{bK:"extends implements pertypewithin perthis pertarget percflowbelow percflow issingleton"},e.UTM,{b:/\([^\)]*/,e:/[)]+/,k:t+" "+i,eE:!1}]},{cN:"class",bK:"class interface",e:/[{;=]/,eE:!0,r:0,k:"class interface",i:/[:"\[\]]/,c:[{bK:"extends implements"},e.UTM]},{bK:"pointcut after before around throwing returning",e:/[)]/,eE:!1,i:/["\[\]]/,c:[{b:e.UIR+"\\s*\\(",rB:!0,c:[e.UTM]}]},{b:/[:]/,rB:!0,e:/[{;]/,r:0,eE:!1,k:t,i:/["\[\]]/,c:[{b:e.UIR+"\\s*\\(",k:t+" "+i,r:0},e.QSM]},{bK:"new throw",r:0},{cN:"function",b:/\w+ +\w+(\.)?\w+\s*\([^\)]*\)\s*((throws)[\w\s,]+)?[\{;]/,rB:!0,e:/[{;=]/,k:t,eE:!0,c:[{b:e.UIR+"\\s*\\(",rB:!0,r:0,c:[e.UTM]},{cN:"params",b:/\(/,e:/\)/,r:0,k:t,c:[e.ASM,e.QSM,e.CNM,e.CBCM]},e.CLCM,e.CBCM]},e.CNM,{cN:"meta",b:"@[A-Za-z]+"}]}});hljs.registerLanguage("yaml",function(e){var b="true false yes no null",a="^[ \\-]*",r="[a-zA-Z_][\\w\\-]*",t={cN:"attr",v:[{b:a+r+":"},{b:a+'"'+r+'":'},{b:a+"'"+r+"':"}]},c={cN:"template-variable",v:[{b:"{{",e:"}}"},{b:"%{",e:"}"}]},l={cN:"string",r:0,v:[{b:/'/,e:/'/},{b:/"/,e:/"/},{b:/\S+/}],c:[e.BE,c]};return{cI:!0,aliases:["yml","YAML","yaml"],c:[t,{cN:"meta",b:"^---s*$",r:10},{cN:"string",b:"[\\|>] *$",rE:!0,c:l.c,e:t.v[0].b},{b:"<%[%=-]?",e:"[%-]?%>",sL:"ruby",eB:!0,eE:!0,r:0},{cN:"type",b:"!!"+e.UIR},{cN:"meta",b:"&"+e.UIR+"$"},{cN:"meta",b:"\\*"+e.UIR+"$"},{cN:"bullet",b:"^ *-",r:0},e.HCM,{bK:b,k:{literal:b}},e.CNM,l]}});hljs.registerLanguage("tap",function(b){return{cI:!0,c:[b.HCM,{cN:"meta",v:[{b:"^TAP version (\\d+)$"},{b:"^1\\.\\.(\\d+)$"}]},{b:"(s+)?---$",e:"\\.\\.\\.$",sL:"yaml",r:0},{cN:"number",b:" (\\d+) "},{cN:"symbol",v:[{b:"^ok"},{b:"^not ok"}]}]}});hljs.registerLanguage("stan",function(e){return{c:[e.HCM,e.CLCM,e.CBCM,{b:e.UIR,l:e.UIR,k:{name:"for in while repeat until if then else",symbol:"bernoulli bernoulli_logit binomial binomial_logit beta_binomial hypergeometric categorical categorical_logit ordered_logistic neg_binomial neg_binomial_2 neg_binomial_2_log poisson poisson_log multinomial normal exp_mod_normal skew_normal student_t cauchy double_exponential logistic gumbel lognormal chi_square inv_chi_square scaled_inv_chi_square exponential inv_gamma weibull frechet rayleigh wiener pareto pareto_type_2 von_mises uniform multi_normal multi_normal_prec multi_normal_cholesky multi_gp multi_gp_cholesky multi_student_t gaussian_dlm_obs dirichlet lkj_corr lkj_corr_cholesky wishart inv_wishart","selector-tag":"int real vector simplex unit_vector ordered positive_ordered row_vector matrix cholesky_factor_corr cholesky_factor_cov corr_matrix cov_matrix",title:"functions model data parameters quantities transformed generated",literal:"true false"},r:0},{cN:"number",b:"0[xX][0-9a-fA-F]+[Li]?\\b",r:0},{cN:"number",b:"0[xX][0-9a-fA-F]+[Li]?\\b",r:0},{cN:"number",b:"\\d+(?:[eE][+\\-]?\\d*)?L\\b",r:0},{cN:"number",b:"\\d+\\.(?!\\d)(?:i\\b)?",r:0},{cN:"number",b:"\\d+(?:\\.\\d*)?(?:[eE][+\\-]?\\d*)?i?\\b",r:0},{cN:"number",b:"\\.\\d+(?:[eE][+\\-]?\\d*)?i?\\b",r:0}]}});hljs.registerLanguage("ebnf",function(a){var e=a.C(/\(\*/,/\*\)/),t={cN:"attribute",b:/^[ ]*[a-zA-Z][a-zA-Z-]*([\s-]+[a-zA-Z][a-zA-Z]*)*/},r={cN:"meta",b:/\?.*\?/},b={b:/=/,e:/;/,c:[e,r,a.ASM,a.QSM]};return{i:/\S/,c:[e,t,b]}});hljs.registerLanguage("scheme",function(e){var t="[^\\(\\)\\[\\]\\{\\}\",'`;#|\\\\\\s]+",r="(\\-|\\+)?\\d+([./]\\d+)?",a=r+"[+\\-]"+r+"i",i={"builtin-name":"case-lambda call/cc class define-class exit-handler field import inherit init-field interface let*-values let-values let/ec mixin opt-lambda override protect provide public rename require require-for-syntax syntax syntax-case syntax-error unit/sig unless when with-syntax and begin call-with-current-continuation call-with-input-file call-with-output-file case cond define define-syntax delay do dynamic-wind else for-each if lambda let let* let-syntax letrec letrec-syntax map or syntax-rules ' * + , ,@ - ... / ; < <= = => > >= ` abs acos angle append apply asin assoc assq assv atan boolean? caar cadr call-with-input-file call-with-output-file call-with-values car cdddar cddddr cdr ceiling char->integer char-alphabetic? char-ci<=? char-ci=? char-ci>? char-downcase char-lower-case? char-numeric? char-ready? char-upcase char-upper-case? char-whitespace? char<=? char=? char>? char? close-input-port close-output-port complex? cons cos current-input-port current-output-port denominator display eof-object? eq? equal? eqv? eval even? exact->inexact exact? exp expt floor force gcd imag-part inexact->exact inexact? input-port? integer->char integer? interaction-environment lcm length list list->string list->vector list-ref list-tail list? load log magnitude make-polar make-rectangular make-string make-vector max member memq memv min modulo negative? newline not null-environment null? number->string number? numerator odd? open-input-file open-output-file output-port? pair? peek-char port? positive? procedure? quasiquote quote quotient rational? rationalize read read-char real-part real? remainder reverse round scheme-report-environment set! set-car! set-cdr! sin sqrt string string->list string->number string->symbol string-append string-ci<=? string-ci=? string-ci>? string-copy string-fill! string-length string-ref string-set! string<=? string=? string>? string? substring symbol->string symbol? tan transcript-off transcript-on truncate values vector vector->list vector-fill! vector-length vector-ref vector-set! with-input-from-file with-output-to-file write write-char zero?"},n={cN:"meta",b:"^#!",e:"$"},c={cN:"literal",b:"(#t|#f|#\\\\"+t+"|#\\\\.)"},l={cN:"number",v:[{b:r,r:0},{b:a,r:0},{b:"#b[0-1]+(/[0-1]+)?"},{b:"#o[0-7]+(/[0-7]+)?"},{b:"#x[0-9a-f]+(/[0-9a-f]+)?"}]},s=e.QSM,o=[e.C(";","$",{r:0}),e.C("#\\|","\\|#")],u={b:t,r:0},p={cN:"symbol",b:"'"+t},d={eW:!0,r:0},m={v:[{b:/'/},{b:"`"}],c:[{b:"\\(",e:"\\)",c:["self",c,s,l,u,p]}]},g={cN:"name",b:t,l:t,k:i},h={b:/lambda/,eW:!0,rB:!0,c:[g,{b:/\(/,e:/\)/,endsParent:!0,c:[u]}]},b={v:[{b:"\\(",e:"\\)"},{b:"\\[",e:"\\]"}],c:[h,g,d]};return d.c=[c,l,s,u,p,m,b].concat(o),{i:/\S/,c:[n,l,s,p,m,b].concat(o)}});hljs.registerLanguage("mipsasm",function(s){return{cI:!0,aliases:["mips"],l:"\\.?"+s.IR,k:{meta:".2byte .4byte .align .ascii .asciz .balign .byte .code .data .else .end .endif .endm .endr .equ .err .exitm .extern .global .hword .if .ifdef .ifndef .include .irp .long .macro .rept .req .section .set .skip .space .text .word .ltorg ",built_in:"$0 $1 $2 $3 $4 $5 $6 $7 $8 $9 $10 $11 $12 $13 $14 $15 $16 $17 $18 $19 $20 $21 $22 $23 $24 $25 $26 $27 $28 $29 $30 $31 zero at v0 v1 a0 a1 a2 a3 a4 a5 a6 a7 t0 t1 t2 t3 t4 t5 t6 t7 t8 t9 s0 s1 s2 s3 s4 s5 s6 s7 s8 k0 k1 gp sp fp ra $f0 $f1 $f2 $f2 $f4 $f5 $f6 $f7 $f8 $f9 $f10 $f11 $f12 $f13 $f14 $f15 $f16 $f17 $f18 $f19 $f20 $f21 $f22 $f23 $f24 $f25 $f26 $f27 $f28 $f29 $f30 $f31 Context Random EntryLo0 EntryLo1 Context PageMask Wired EntryHi HWREna BadVAddr Count Compare SR IntCtl SRSCtl SRSMap Cause EPC PRId EBase Config Config1 Config2 Config3 LLAddr Debug DEPC DESAVE CacheErr ECC ErrorEPC TagLo DataLo TagHi DataHi WatchLo WatchHi PerfCtl PerfCnt "},c:[{cN:"keyword",b:"\\b(addi?u?|andi?|b(al)?|beql?|bgez(al)?l?|bgtzl?|blezl?|bltz(al)?l?|bnel?|cl[oz]|divu?|ext|ins|j(al)?|jalr(.hb)?|jr(.hb)?|lbu?|lhu?|ll|lui|lw[lr]?|maddu?|mfhi|mflo|movn|movz|move|msubu?|mthi|mtlo|mul|multu?|nop|nor|ori?|rotrv?|sb|sc|se[bh]|sh|sllv?|slti?u?|srav?|srlv?|subu?|sw[lr]?|xori?|wsbh|abs.[sd]|add.[sd]|alnv.ps|bc1[ft]l?|c.(s?f|un|u?eq|[ou]lt|[ou]le|ngle?|seq|l[et]|ng[et]).[sd]|(ceil|floor|round|trunc).[lw].[sd]|cfc1|cvt.d.[lsw]|cvt.l.[dsw]|cvt.ps.s|cvt.s.[dlw]|cvt.s.p[lu]|cvt.w.[dls]|div.[ds]|ldx?c1|luxc1|lwx?c1|madd.[sd]|mfc1|mov[fntz]?.[ds]|msub.[sd]|mth?c1|mul.[ds]|neg.[ds]|nmadd.[ds]|nmsub.[ds]|p[lu][lu].ps|recip.fmt|r?sqrt.[ds]|sdx?c1|sub.[ds]|suxc1|swx?c1|break|cache|d?eret|[de]i|ehb|mfc0|mtc0|pause|prefx?|rdhwr|rdpgpr|sdbbp|ssnop|synci?|syscall|teqi?|tgei?u?|tlb(p|r|w[ir])|tlti?u?|tnei?|wait|wrpgpr)",e:"\\s"},s.C("[;#]","$"),s.CBCM,s.QSM,{cN:"string",b:"'",e:"[^\\\\]'",r:0},{cN:"title",b:"\\|",e:"\\|",i:"\\n",r:0},{cN:"number",v:[{b:"0x[0-9a-f]+"},{b:"\\b-?\\d+"}],r:0},{cN:"symbol",v:[{b:"^\\s*[a-z_\\.\\$][a-z0-9_\\.\\$]+:"},{b:"^\\s*[0-9]+:"},{b:"[0-9]+[bf]"}],r:0}],i:"/"}});hljs.registerLanguage("purebasic",function(e){var r={cN:"string",b:'(~)?"',e:'"',i:"\\n"},t={cN:"symbol",b:"#[a-zA-Z_]\\w*\\$?"};return{aliases:["pb","pbi"],k:"And As Break CallDebugger Case CompilerCase CompilerDefault CompilerElse CompilerEndIf CompilerEndSelect CompilerError CompilerIf CompilerSelect Continue Data DataSection EndDataSection Debug DebugLevel Default Define Dim DisableASM DisableDebugger DisableExplicit Else ElseIf EnableASM EnableDebugger EnableExplicit End EndEnumeration EndIf EndImport EndInterface EndMacro EndProcedure EndSelect EndStructure EndStructureUnion EndWith Enumeration Extends FakeReturn For Next ForEach ForEver Global Gosub Goto If Import ImportC IncludeBinary IncludeFile IncludePath Interface Macro NewList Not Or ProcedureReturn Protected Prototype PrototypeC Read ReDim Repeat Until Restore Return Select Shared Static Step Structure StructureUnion Swap To Wend While With XIncludeFile XOr Procedure ProcedureC ProcedureCDLL ProcedureDLL Declare DeclareC DeclareCDLL DeclareDLL",c:[e.C(";","$",{r:0}),{cN:"function",b:"\\b(Procedure|Declare)(C|CDLL|DLL)?\\b",e:"\\(",eE:!0,rB:!0,c:[{cN:"keyword",b:"(Procedure|Declare)(C|CDLL|DLL)?",eE:!0},{cN:"type",b:"\\.\\w*"},e.UTM]},r,t]}});hljs.registerLanguage("jboss-cli",function(e){var a={b:/[\w-]+ *=/,rB:!0,r:0,c:[{cN:"attr",b:/[\w-]+/}]},r={cN:"params",b:/\(/,e:/\)/,c:[a],r:0},o={cN:"function",b:/:[\w\-.]+/,r:0},t={cN:"string",b:/\B(([\/.])[\w\-.\/=]+)+/},c={cN:"params",b:/--[\w\-=\/]+/};return{aliases:["wildfly-cli"],l:"[a-z-]+",k:{keyword:"alias batch cd clear command connect connection-factory connection-info data-source deploy deployment-info deployment-overlay echo echo-dmr help history if jdbc-driver-info jms-queue|20 jms-topic|20 ls patch pwd quit read-attribute read-operation reload rollout-plan run-batch set shutdown try unalias undeploy unset version xa-data-source",literal:"true false"},c:[e.HCM,e.QSM,c,o,t,r]}});hljs.registerLanguage("php",function(e){var c={b:"\\$+[a-zA-Z_-ÿ][a-zA-Z0-9_-ÿ]*"},i={cN:"meta",b:/<\?(php)?|\?>/},t={cN:"string",c:[e.BE,i],v:[{b:'b"',e:'"'},{b:"b'",e:"'"},e.inherit(e.ASM,{i:null}),e.inherit(e.QSM,{i:null})]},a={v:[e.BNM,e.CNM]};return{aliases:["php3","php4","php5","php6"],cI:!0,k:"and include_once list abstract global private echo interface as static endswitch array null if endwhile or const for endforeach self var while isset public protected exit foreach throw elseif include __FILE__ empty require_once do xor return parent clone use __CLASS__ __LINE__ else break print eval new catch __METHOD__ case exception default die require __FUNCTION__ enddeclare final try switch continue endfor endif declare unset true false trait goto instanceof insteadof __DIR__ __NAMESPACE__ yield finally",c:[e.HCM,e.C("//","$",{c:[i]}),e.C("/\\*","\\*/",{c:[{cN:"doctag",b:"@[A-Za-z]+"}]}),e.C("__halt_compiler.+?;",!1,{eW:!0,k:"__halt_compiler",l:e.UIR}),{cN:"string",b:/<<<['"]?\w+['"]?$/,e:/^\w+;?$/,c:[e.BE,{cN:"subst",v:[{b:/\$\w+/},{b:/\{\$/,e:/\}/}]}]},i,{cN:"keyword",b:/\$this\b/},c,{b:/(::|->)+[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/},{cN:"function",bK:"function",e:/[;{]/,eE:!0,i:"\\$|\\[|%",c:[e.UTM,{cN:"params",b:"\\(",e:"\\)",c:["self",c,e.CBCM,t,a]}]},{cN:"class",bK:"class interface",e:"{",eE:!0,i:/[:\(\$"]/,c:[{bK:"extends implements"},e.UTM]},{bK:"namespace",e:";",i:/[\.']/,c:[e.UTM]},{bK:"use",e:";",c:[e.UTM]},{b:"=>"},t,a]}});hljs.registerLanguage("tex",function(c){var e={cN:"tag",b:/\\/,r:0,c:[{cN:"name",v:[{b:/[a-zA-Zа-яА-я]+[*]?/},{b:/[^a-zA-Zа-яА-я0-9]/}],starts:{eW:!0,r:0,c:[{cN:"string",v:[{b:/\[/,e:/\]/},{b:/\{/,e:/\}/}]},{b:/\s*=\s*/,eW:!0,r:0,c:[{cN:"number",b:/-?\d*\.?\d+(pt|pc|mm|cm|in|dd|cc|ex|em)?/}]}]}}]};return{c:[e,{cN:"formula",c:[e],r:0,v:[{b:/\$\$/,e:/\$\$/},{b:/\$/,e:/\$/}]},c.C("%","$",{r:0})]}});hljs.registerLanguage("profile",function(e){return{c:[e.CNM,{b:"[a-zA-Z_][\\da-zA-Z_]+\\.[\\da-zA-Z_]{1,3}",e:":",eE:!0},{b:"(ncalls|tottime|cumtime)",e:"$",k:"ncalls tottime|10 cumtime|10 filename",r:10},{b:"function calls",e:"$",c:[e.CNM],r:10},e.ASM,e.QSM,{cN:"string",b:"\\(",e:"\\)$",eB:!0,eE:!0,r:0}]}});hljs.registerLanguage("gherkin",function(e){return{aliases:["feature"],k:"Feature Background Ability Business Need Scenario Scenarios Scenario Outline Scenario Template Examples Given And Then But When",c:[{cN:"symbol",b:"\\*",r:0},{cN:"meta",b:"@[^@\\s]+"},{b:"\\|",e:"\\|\\w*$",c:[{cN:"string",b:"[^|]+"}]},{cN:"variable",b:"<",e:">"},e.HCM,{cN:"string",b:'"""',e:'"""'},e.QSM]}});hljs.registerLanguage("smalltalk",function(e){var s="[a-z][a-zA-Z0-9_]*",a={cN:"string",b:"\\$.{1}"},r={cN:"symbol",b:"#"+e.UIR};return{aliases:["st"],k:"self super nil true false thisContext",c:[e.C('"','"'),e.ASM,{cN:"type",b:"\\b[A-Z][A-Za-z0-9_]*",r:0},{b:s+":",r:0},e.CNM,r,a,{b:"\\|[ ]*"+s+"([ ]+"+s+")*[ ]*\\|",rB:!0,e:/\|/,i:/\S/,c:[{b:"(\\|[ ]*)?"+s}]},{b:"\\#\\(",e:"\\)",c:[e.ASM,a,e.CNM,r]}]}});hljs.registerLanguage("arduino",function(e){var t=e.getLanguage("cpp").exports;return{k:{keyword:"boolean byte word string String array "+t.k.keyword,built_in:"setup loop while catch for if do goto try switch case else default break continue return KeyboardController MouseController SoftwareSerial EthernetServer EthernetClient LiquidCrystal RobotControl GSMVoiceCall EthernetUDP EsploraTFT HttpClient RobotMotor WiFiClient GSMScanner FileSystem Scheduler GSMServer YunClient YunServer IPAddress GSMClient GSMModem Keyboard Ethernet Console GSMBand Esplora Stepper Process WiFiUDP GSM_SMS Mailbox USBHost Firmata PImage Client Server GSMPIN FileIO Bridge Serial EEPROM Stream Mouse Audio Servo File Task GPRS WiFi Wire TFT GSM SPI SD runShellCommandAsynchronously analogWriteResolution retrieveCallingNumber printFirmwareVersion analogReadResolution sendDigitalPortPair noListenOnLocalhost readJoystickButton setFirmwareVersion readJoystickSwitch scrollDisplayRight getVoiceCallStatus scrollDisplayLeft writeMicroseconds delayMicroseconds beginTransmission getSignalStrength runAsynchronously getAsynchronously listenOnLocalhost getCurrentCarrier readAccelerometer messageAvailable sendDigitalPorts lineFollowConfig countryNameWrite runShellCommand readStringUntil rewindDirectory readTemperature setClockDivider readLightSensor endTransmission analogReference detachInterrupt countryNameRead attachInterrupt encryptionType readBytesUntil robotNameWrite readMicrophone robotNameRead cityNameWrite userNameWrite readJoystickY readJoystickX mouseReleased openNextFile scanNetworks noInterrupts digitalWrite beginSpeaker mousePressed isActionDone mouseDragged displayLogos noAutoscroll addParameter remoteNumber getModifiers keyboardRead userNameRead waitContinue processInput parseCommand printVersion readNetworks writeMessage blinkVersion cityNameRead readMessage setDataMode parsePacket isListening setBitOrder beginPacket isDirectory motorsWrite drawCompass digitalRead clearScreen serialEvent rightToLeft setTextSize leftToRight requestFrom keyReleased compassRead analogWrite interrupts WiFiServer disconnect playMelody parseFloat autoscroll getPINUsed setPINUsed setTimeout sendAnalog readSlider analogRead beginWrite createChar motorsStop keyPressed tempoWrite readButton subnetMask debugPrint macAddress writeGreen randomSeed attachGPRS readString sendString remotePort releaseAll mouseMoved background getXChange getYChange answerCall getResult voiceCall endPacket constrain getSocket writeJSON getButton available connected findUntil readBytes exitValue readGreen writeBlue startLoop IPAddress isPressed sendSysex pauseMode gatewayIP setCursor getOemKey tuneWrite noDisplay loadImage switchPIN onRequest onReceive changePIN playFile noBuffer parseInt overflow checkPIN knobRead beginTFT bitClear updateIR bitWrite position writeRGB highByte writeRed setSpeed readBlue noStroke remoteIP transfer shutdown hangCall beginSMS endWrite attached maintain noCursor checkReg checkPUK shiftOut isValid shiftIn pulseIn connect println localIP pinMode getIMEI display noBlink process getBand running beginSD drawBMP lowByte setBand release bitRead prepare pointTo readRed setMode noFill remove listen stroke detach attach noTone exists buffer height bitSet circle config cursor random IRread setDNS endSMS getKey micros millis begin print write ready flush width isPIN blink clear press mkdir rmdir close point yield image BSSID click delay read text move peek beep rect line open seek fill size turn stop home find step tone sqrt RSSI SSID end bit tan cos sin pow map abs max min get run put",literal:"DIGITAL_MESSAGE FIRMATA_STRING ANALOG_MESSAGE REPORT_DIGITAL REPORT_ANALOG INPUT_PULLUP SET_PIN_MODE INTERNAL2V56 SYSTEM_RESET LED_BUILTIN INTERNAL1V1 SYSEX_START INTERNAL EXTERNAL DEFAULT OUTPUT INPUT HIGH LOW"},c:[t.preprocessor,e.CLCM,e.CBCM,e.ASM,e.QSM,e.CNM]}});hljs.registerLanguage("mathematica",function(e){return{aliases:["mma"],l:"(\\$|\\b)"+e.IR+"\\b",k:"AbelianGroup Abort AbortKernels AbortProtect Above Abs Absolute AbsoluteCorrelation AbsoluteCorrelationFunction AbsoluteCurrentValue AbsoluteDashing AbsoluteFileName AbsoluteOptions AbsolutePointSize AbsoluteThickness AbsoluteTime AbsoluteTiming AccountingForm Accumulate Accuracy AccuracyGoal ActionDelay ActionMenu ActionMenuBox ActionMenuBoxOptions Active ActiveItem ActiveStyle AcyclicGraphQ AddOnHelpPath AddTo AdjacencyGraph AdjacencyList AdjacencyMatrix AdjustmentBox AdjustmentBoxOptions AdjustTimeSeriesForecast AffineTransform After AiryAi AiryAiPrime AiryAiZero AiryBi AiryBiPrime AiryBiZero AlgebraicIntegerQ AlgebraicNumber AlgebraicNumberDenominator AlgebraicNumberNorm AlgebraicNumberPolynomial AlgebraicNumberTrace AlgebraicRules AlgebraicRulesData Algebraics AlgebraicUnitQ Alignment AlignmentMarker AlignmentPoint All AllowedDimensions AllowGroupClose AllowInlineCells AllowKernelInitialization AllowReverseGroupClose AllowScriptLevelChange AlphaChannel AlternatingGroup AlternativeHypothesis Alternatives AmbientLight Analytic AnchoredSearch And AndersonDarlingTest AngerJ AngleBracket AngularGauge Animate AnimationCycleOffset AnimationCycleRepetitions AnimationDirection AnimationDisplayTime AnimationRate AnimationRepetitions AnimationRunning Animator AnimatorBox AnimatorBoxOptions AnimatorElements Annotation Annuity AnnuityDue Antialiasing Antisymmetric Apart ApartSquareFree Appearance AppearanceElements AppellF1 Append AppendTo Apply ArcCos ArcCosh ArcCot ArcCoth ArcCsc ArcCsch ArcSec ArcSech ArcSin ArcSinDistribution ArcSinh ArcTan ArcTanh Arg ArgMax ArgMin ArgumentCountQ ARIMAProcess ArithmeticGeometricMean ARMAProcess ARProcess Array ArrayComponents ArrayDepth ArrayFlatten ArrayPad ArrayPlot ArrayQ ArrayReshape ArrayRules Arrays Arrow Arrow3DBox ArrowBox Arrowheads AspectRatio AspectRatioFixed Assert Assuming Assumptions AstronomicalData Asynchronous AsynchronousTaskObject AsynchronousTasks AtomQ Attributes AugmentedSymmetricPolynomial AutoAction AutoDelete AutoEvaluateEvents AutoGeneratedPackage AutoIndent AutoIndentSpacings AutoItalicWords AutoloadPath AutoMatch Automatic AutomaticImageSize AutoMultiplicationSymbol AutoNumberFormatting AutoOpenNotebooks AutoOpenPalettes AutorunSequencing AutoScaling AutoScroll AutoSpacing AutoStyleOptions AutoStyleWords Axes AxesEdge AxesLabel AxesOrigin AxesStyle Axis BabyMonsterGroupB Back Background BackgroundTasksSettings Backslash Backsubstitution Backward Band BandpassFilter BandstopFilter BarabasiAlbertGraphDistribution BarChart BarChart3D BarLegend BarlowProschanImportance BarnesG BarOrigin BarSpacing BartlettHannWindow BartlettWindow BaseForm Baseline BaselinePosition BaseStyle BatesDistribution BattleLemarieWavelet Because BeckmannDistribution Beep Before Begin BeginDialogPacket BeginFrontEndInteractionPacket BeginPackage BellB BellY Below BenfordDistribution BeniniDistribution BenktanderGibratDistribution BenktanderWeibullDistribution BernoulliB BernoulliDistribution BernoulliGraphDistribution BernoulliProcess BernsteinBasis BesselFilterModel BesselI BesselJ BesselJZero BesselK BesselY BesselYZero Beta BetaBinomialDistribution BetaDistribution BetaNegativeBinomialDistribution BetaPrimeDistribution BetaRegularized BetweennessCentrality BezierCurve BezierCurve3DBox BezierCurve3DBoxOptions BezierCurveBox BezierCurveBoxOptions BezierFunction BilateralFilter Binarize BinaryFormat BinaryImageQ BinaryRead BinaryReadList BinaryWrite BinCounts BinLists Binomial BinomialDistribution BinomialProcess BinormalDistribution BiorthogonalSplineWavelet BipartiteGraphQ BirnbaumImportance BirnbaumSaundersDistribution BitAnd BitClear BitGet BitLength BitNot BitOr BitSet BitShiftLeft BitShiftRight BitXor Black BlackmanHarrisWindow BlackmanNuttallWindow BlackmanWindow Blank BlankForm BlankNullSequence BlankSequence Blend Block BlockRandom BlomqvistBeta BlomqvistBetaTest Blue Blur BodePlot BohmanWindow Bold Bookmarks Boole BooleanConsecutiveFunction BooleanConvert BooleanCountingFunction BooleanFunction BooleanGraph BooleanMaxterms BooleanMinimize BooleanMinterms Booleans BooleanTable BooleanVariables BorderDimensions BorelTannerDistribution Bottom BottomHatTransform BoundaryStyle Bounds Box BoxBaselineShift BoxData BoxDimensions Boxed Boxes BoxForm BoxFormFormatTypes BoxFrame BoxID BoxMargins BoxMatrix BoxRatios BoxRotation BoxRotationPoint BoxStyle BoxWhiskerChart Bra BracketingBar BraKet BrayCurtisDistance BreadthFirstScan Break Brown BrownForsytheTest BrownianBridgeProcess BrowserCategory BSplineBasis BSplineCurve BSplineCurve3DBox BSplineCurveBox BSplineCurveBoxOptions BSplineFunction BSplineSurface BSplineSurface3DBox BubbleChart BubbleChart3D BubbleScale BubbleSizes BulletGauge BusinessDayQ ButterflyGraph ButterworthFilterModel Button ButtonBar ButtonBox ButtonBoxOptions ButtonCell ButtonContents ButtonData ButtonEvaluator ButtonExpandable ButtonFrame ButtonFunction ButtonMargins ButtonMinHeight ButtonNote ButtonNotebook ButtonSource ButtonStyle ButtonStyleMenuListing Byte ByteCount ByteOrdering C CachedValue CacheGraphics CalendarData CalendarType CallPacket CanberraDistance Cancel CancelButton CandlestickChart Cap CapForm CapitalDifferentialD CardinalBSplineBasis CarmichaelLambda Cases Cashflow Casoratian Catalan CatalanNumber Catch CauchyDistribution CauchyWindow CayleyGraph CDF CDFDeploy CDFInformation CDFWavelet Ceiling Cell CellAutoOverwrite CellBaseline CellBoundingBox CellBracketOptions CellChangeTimes CellContents CellContext CellDingbat CellDynamicExpression CellEditDuplicate CellElementsBoundingBox CellElementSpacings CellEpilog CellEvaluationDuplicate CellEvaluationFunction CellEventActions CellFrame CellFrameColor CellFrameLabelMargins CellFrameLabels CellFrameMargins CellGroup CellGroupData CellGrouping CellGroupingRules CellHorizontalScrolling CellID CellLabel CellLabelAutoDelete CellLabelMargins CellLabelPositioning CellMargins CellObject CellOpen CellPrint CellProlog Cells CellSize CellStyle CellTags CellularAutomaton CensoredDistribution Censoring Center CenterDot CentralMoment CentralMomentGeneratingFunction CForm ChampernowneNumber ChanVeseBinarize Character CharacterEncoding CharacterEncodingsPath CharacteristicFunction CharacteristicPolynomial CharacterRange Characters ChartBaseStyle ChartElementData ChartElementDataFunction ChartElementFunction ChartElements ChartLabels ChartLayout ChartLegends ChartStyle Chebyshev1FilterModel Chebyshev2FilterModel ChebyshevDistance ChebyshevT ChebyshevU Check CheckAbort CheckAll Checkbox CheckboxBar CheckboxBox CheckboxBoxOptions ChemicalData ChessboardDistance ChiDistribution ChineseRemainder ChiSquareDistribution ChoiceButtons ChoiceDialog CholeskyDecomposition Chop Circle CircleBox CircleDot CircleMinus CirclePlus CircleTimes CirculantGraph CityData Clear ClearAll ClearAttributes ClearSystemCache ClebschGordan ClickPane Clip ClipboardNotebook ClipFill ClippingStyle ClipPlanes ClipRange Clock ClockGauge ClockwiseContourIntegral Close Closed CloseKernels ClosenessCentrality Closing ClosingAutoSave ClosingEvent ClusteringComponents CMYKColor Coarse Coefficient CoefficientArrays CoefficientDomain CoefficientList CoefficientRules CoifletWavelet Collect Colon ColonForm ColorCombine ColorConvert ColorData ColorDataFunction ColorFunction ColorFunctionScaling Colorize ColorNegate ColorOutput ColorProfileData ColorQuantize ColorReplace ColorRules ColorSelectorSettings ColorSeparate ColorSetter ColorSetterBox ColorSetterBoxOptions ColorSlider ColorSpace Column ColumnAlignments ColumnBackgrounds ColumnForm ColumnLines ColumnsEqual ColumnSpacings ColumnWidths CommonDefaultFormatTypes Commonest CommonestFilter CommonUnits CommunityBoundaryStyle CommunityGraphPlot CommunityLabels CommunityRegionStyle CompatibleUnitQ CompilationOptions CompilationTarget Compile Compiled CompiledFunction Complement CompleteGraph CompleteGraphQ CompleteKaryTree CompletionsListPacket Complex Complexes ComplexExpand ComplexInfinity ComplexityFunction ComponentMeasurements ComponentwiseContextMenu Compose ComposeList ComposeSeries Composition CompoundExpression CompoundPoissonDistribution CompoundPoissonProcess CompoundRenewalProcess Compress CompressedData Condition ConditionalExpression Conditioned Cone ConeBox ConfidenceLevel ConfidenceRange ConfidenceTransform ConfigurationPath Congruent Conjugate ConjugateTranspose Conjunction Connect ConnectedComponents ConnectedGraphQ ConnesWindow ConoverTest ConsoleMessage ConsoleMessagePacket ConsolePrint Constant ConstantArray Constants ConstrainedMax ConstrainedMin ContentPadding ContentsBoundingBox ContentSelectable ContentSize Context ContextMenu Contexts ContextToFilename ContextToFileName Continuation Continue ContinuedFraction ContinuedFractionK ContinuousAction ContinuousMarkovProcess ContinuousTimeModelQ ContinuousWaveletData ContinuousWaveletTransform ContourDetect ContourGraphics ContourIntegral ContourLabels ContourLines ContourPlot ContourPlot3D Contours ContourShading ContourSmoothing ContourStyle ContraharmonicMean Control ControlActive ControlAlignment ControllabilityGramian ControllabilityMatrix ControllableDecomposition ControllableModelQ ControllerDuration ControllerInformation ControllerInformationData ControllerLinking ControllerManipulate ControllerMethod ControllerPath ControllerState ControlPlacement ControlsRendering ControlType Convergents ConversionOptions ConversionRules ConvertToBitmapPacket ConvertToPostScript ConvertToPostScriptPacket Convolve ConwayGroupCo1 ConwayGroupCo2 ConwayGroupCo3 CoordinateChartData CoordinatesToolOptions CoordinateTransform CoordinateTransformData CoprimeQ Coproduct CopulaDistribution Copyable CopyDirectory CopyFile CopyTag CopyToClipboard CornerFilter CornerNeighbors Correlation CorrelationDistance CorrelationFunction CorrelationTest Cos Cosh CoshIntegral CosineDistance CosineWindow CosIntegral Cot Coth Count CounterAssignments CounterBox CounterBoxOptions CounterClockwiseContourIntegral CounterEvaluator CounterFunction CounterIncrements CounterStyle CounterStyleMenuListing CountRoots CountryData Covariance CovarianceEstimatorFunction CovarianceFunction CoxianDistribution CoxIngersollRossProcess CoxModel CoxModelFit CramerVonMisesTest CreateArchive CreateDialog CreateDirectory CreateDocument CreateIntermediateDirectories CreatePalette CreatePalettePacket CreateScheduledTask CreateTemporary CreateWindow CriticalityFailureImportance CriticalitySuccessImportance CriticalSection Cross CrossingDetect CrossMatrix Csc Csch CubeRoot Cubics Cuboid CuboidBox Cumulant CumulantGeneratingFunction Cup CupCap Curl CurlyDoubleQuote CurlyQuote CurrentImage CurrentlySpeakingPacket CurrentValue CurvatureFlowFilter CurveClosed Cyan CycleGraph CycleIndexPolynomial Cycles CyclicGroup Cyclotomic Cylinder CylinderBox CylindricalDecomposition D DagumDistribution DamerauLevenshteinDistance DampingFactor Darker Dashed Dashing DataCompression DataDistribution DataRange DataReversed Date DateDelimiters DateDifference DateFunction DateList DateListLogPlot DateListPlot DatePattern DatePlus DateRange DateString DateTicksFormat DaubechiesWavelet DavisDistribution DawsonF DayCount DayCountConvention DayMatchQ DayName DayPlus DayRange DayRound DeBruijnGraph Debug DebugTag Decimal DeclareKnownSymbols DeclarePackage Decompose Decrement DedekindEta Default DefaultAxesStyle DefaultBaseStyle DefaultBoxStyle DefaultButton DefaultColor DefaultControlPlacement DefaultDuplicateCellStyle DefaultDuration DefaultElement DefaultFaceGridsStyle DefaultFieldHintStyle DefaultFont DefaultFontProperties DefaultFormatType DefaultFormatTypeForStyle DefaultFrameStyle DefaultFrameTicksStyle DefaultGridLinesStyle DefaultInlineFormatType DefaultInputFormatType DefaultLabelStyle DefaultMenuStyle DefaultNaturalLanguage DefaultNewCellStyle DefaultNewInlineCellStyle DefaultNotebook DefaultOptions DefaultOutputFormatType DefaultStyle DefaultStyleDefinitions DefaultTextFormatType DefaultTextInlineFormatType DefaultTicksStyle DefaultTooltipStyle DefaultValues Defer DefineExternal DefineInputStreamMethod DefineOutputStreamMethod Definition Degree DegreeCentrality DegreeGraphDistribution DegreeLexicographic DegreeReverseLexicographic Deinitialization Del Deletable Delete DeleteBorderComponents DeleteCases DeleteContents DeleteDirectory DeleteDuplicates DeleteFile DeleteSmallComponents DeleteWithContents DeletionWarning Delimiter DelimiterFlashTime DelimiterMatching Delimiters Denominator DensityGraphics DensityHistogram DensityPlot DependentVariables Deploy Deployed Depth DepthFirstScan Derivative DerivativeFilter DescriptorStateSpace DesignMatrix Det DGaussianWavelet DiacriticalPositioning Diagonal DiagonalMatrix Dialog DialogIndent DialogInput DialogLevel DialogNotebook DialogProlog DialogReturn DialogSymbols Diamond DiamondMatrix DiceDissimilarity DictionaryLookup DifferenceDelta DifferenceOrder DifferenceRoot DifferenceRootReduce Differences DifferentialD DifferentialRoot DifferentialRootReduce DifferentiatorFilter DigitBlock DigitBlockMinimum DigitCharacter DigitCount DigitQ DihedralGroup Dilation Dimensions DiracComb DiracDelta DirectedEdge DirectedEdges DirectedGraph DirectedGraphQ DirectedInfinity Direction Directive Directory DirectoryName DirectoryQ DirectoryStack DirichletCharacter DirichletConvolve DirichletDistribution DirichletL DirichletTransform DirichletWindow DisableConsolePrintPacket DiscreteChirpZTransform DiscreteConvolve DiscreteDelta DiscreteHadamardTransform DiscreteIndicator DiscreteLQEstimatorGains DiscreteLQRegulatorGains DiscreteLyapunovSolve DiscreteMarkovProcess DiscretePlot DiscretePlot3D DiscreteRatio DiscreteRiccatiSolve DiscreteShift DiscreteTimeModelQ DiscreteUniformDistribution DiscreteVariables DiscreteWaveletData DiscreteWaveletPacketTransform DiscreteWaveletTransform Discriminant Disjunction Disk DiskBox DiskMatrix Dispatch DispersionEstimatorFunction Display DisplayAllSteps DisplayEndPacket DisplayFlushImagePacket DisplayForm DisplayFunction DisplayPacket DisplayRules DisplaySetSizePacket DisplayString DisplayTemporary DisplayWith DisplayWithRef DisplayWithVariable DistanceFunction DistanceTransform Distribute Distributed DistributedContexts DistributeDefinitions DistributionChart DistributionDomain DistributionFitTest DistributionParameterAssumptions DistributionParameterQ Dithering Div Divergence Divide DivideBy Dividers Divisible Divisors DivisorSigma DivisorSum DMSList DMSString Do DockedCells DocumentNotebook DominantColors DOSTextFormat Dot DotDashed DotEqual Dotted DoubleBracketingBar DoubleContourIntegral DoubleDownArrow DoubleLeftArrow DoubleLeftRightArrow DoubleLeftTee DoubleLongLeftArrow DoubleLongLeftRightArrow DoubleLongRightArrow DoubleRightArrow DoubleRightTee DoubleUpArrow DoubleUpDownArrow DoubleVerticalBar DoublyInfinite Down DownArrow DownArrowBar DownArrowUpArrow DownLeftRightVector DownLeftTeeVector DownLeftVector DownLeftVectorBar DownRightTeeVector DownRightVector DownRightVectorBar Downsample DownTee DownTeeArrow DownValues DragAndDrop DrawEdges DrawFrontFaces DrawHighlighted Drop DSolve Dt DualLinearProgramming DualSystemsModel DumpGet DumpSave DuplicateFreeQ Dynamic DynamicBox DynamicBoxOptions DynamicEvaluationTimeout DynamicLocation DynamicModule DynamicModuleBox DynamicModuleBoxOptions DynamicModuleParent DynamicModuleValues DynamicName DynamicNamespace DynamicReference DynamicSetting DynamicUpdating DynamicWrapper DynamicWrapperBox DynamicWrapperBoxOptions E EccentricityCentrality EdgeAdd EdgeBetweennessCentrality EdgeCapacity EdgeCapForm EdgeColor EdgeConnectivity EdgeCost EdgeCount EdgeCoverQ EdgeDashing EdgeDelete EdgeDetect EdgeForm EdgeIndex EdgeJoinForm EdgeLabeling EdgeLabels EdgeLabelStyle EdgeList EdgeOpacity EdgeQ EdgeRenderingFunction EdgeRules EdgeShapeFunction EdgeStyle EdgeThickness EdgeWeight Editable EditButtonSettings EditCellTagsSettings EditDistance EffectiveInterest Eigensystem Eigenvalues EigenvectorCentrality Eigenvectors Element ElementData Eliminate EliminationOrder EllipticE EllipticExp EllipticExpPrime EllipticF EllipticFilterModel EllipticK EllipticLog EllipticNomeQ EllipticPi EllipticReducedHalfPeriods EllipticTheta EllipticThetaPrime EmitSound EmphasizeSyntaxErrors EmpiricalDistribution Empty EmptyGraphQ EnableConsolePrintPacket Enabled Encode End EndAdd EndDialogPacket EndFrontEndInteractionPacket EndOfFile EndOfLine EndOfString EndPackage EngineeringForm Enter EnterExpressionPacket EnterTextPacket Entropy EntropyFilter Environment Epilog Equal EqualColumns EqualRows EqualTilde EquatedTo Equilibrium EquirippleFilterKernel Equivalent Erf Erfc Erfi ErlangB ErlangC ErlangDistribution Erosion ErrorBox ErrorBoxOptions ErrorNorm ErrorPacket ErrorsDialogSettings EstimatedDistribution EstimatedProcess EstimatorGains EstimatorRegulator EuclideanDistance EulerE EulerGamma EulerianGraphQ EulerPhi Evaluatable Evaluate Evaluated EvaluatePacket EvaluationCell EvaluationCompletionAction EvaluationElements EvaluationMode EvaluationMonitor EvaluationNotebook EvaluationObject EvaluationOrder Evaluator EvaluatorNames EvenQ EventData EventEvaluator EventHandler EventHandlerTag EventLabels ExactBlackmanWindow ExactNumberQ ExactRootIsolation ExampleData Except ExcludedForms ExcludePods Exclusions ExclusionsStyle Exists Exit ExitDialog Exp Expand ExpandAll ExpandDenominator ExpandFileName ExpandNumerator Expectation ExpectationE ExpectedValue ExpGammaDistribution ExpIntegralE ExpIntegralEi Exponent ExponentFunction ExponentialDistribution ExponentialFamily ExponentialGeneratingFunction ExponentialMovingAverage ExponentialPowerDistribution ExponentPosition ExponentStep Export ExportAutoReplacements ExportPacket ExportString Expression ExpressionCell ExpressionPacket ExpToTrig ExtendedGCD Extension ExtentElementFunction ExtentMarkers ExtentSize ExternalCall ExternalDataCharacterEncoding Extract ExtractArchive ExtremeValueDistribution FaceForm FaceGrids FaceGridsStyle Factor FactorComplete Factorial Factorial2 FactorialMoment FactorialMomentGeneratingFunction FactorialPower FactorInteger FactorList FactorSquareFree FactorSquareFreeList FactorTerms FactorTermsList Fail FailureDistribution False FARIMAProcess FEDisableConsolePrintPacket FeedbackSector FeedbackSectorStyle FeedbackType FEEnableConsolePrintPacket Fibonacci FieldHint FieldHintStyle FieldMasked FieldSize File FileBaseName FileByteCount FileDate FileExistsQ FileExtension FileFormat FileHash FileInformation FileName FileNameDepth FileNameDialogSettings FileNameDrop FileNameJoin FileNames FileNameSetter FileNameSplit FileNameTake FilePrint FileType FilledCurve FilledCurveBox Filling FillingStyle FillingTransform FilterRules FinancialBond FinancialData FinancialDerivative FinancialIndicator Find FindArgMax FindArgMin FindClique FindClusters FindCurvePath FindDistributionParameters FindDivisions FindEdgeCover FindEdgeCut FindEulerianCycle FindFaces FindFile FindFit FindGeneratingFunction FindGeoLocation FindGeometricTransform FindGraphCommunities FindGraphIsomorphism FindGraphPartition FindHamiltonianCycle FindIndependentEdgeSet FindIndependentVertexSet FindInstance FindIntegerNullVector FindKClan FindKClique FindKClub FindKPlex FindLibrary FindLinearRecurrence FindList FindMaximum FindMaximumFlow FindMaxValue FindMinimum FindMinimumCostFlow FindMinimumCut FindMinValue FindPermutation FindPostmanTour FindProcessParameters FindRoot FindSequenceFunction FindSettings FindShortestPath FindShortestTour FindThreshold FindVertexCover FindVertexCut Fine FinishDynamic FiniteAbelianGroupCount FiniteGroupCount FiniteGroupData First FirstPassageTimeDistribution FischerGroupFi22 FischerGroupFi23 FischerGroupFi24Prime FisherHypergeometricDistribution FisherRatioTest FisherZDistribution Fit FitAll FittedModel FixedPoint FixedPointList FlashSelection Flat Flatten FlattenAt FlatTopWindow FlipView Floor FlushPrintOutputPacket Fold FoldList Font FontColor FontFamily FontForm FontName FontOpacity FontPostScriptName FontProperties FontReencoding FontSize FontSlant FontSubstitutions FontTracking FontVariations FontWeight For ForAll Format FormatRules FormatType FormatTypeAutoConvert FormatValues FormBox FormBoxOptions FortranForm Forward ForwardBackward Fourier FourierCoefficient FourierCosCoefficient FourierCosSeries FourierCosTransform FourierDCT FourierDCTFilter FourierDCTMatrix FourierDST FourierDSTMatrix FourierMatrix FourierParameters FourierSequenceTransform FourierSeries FourierSinCoefficient FourierSinSeries FourierSinTransform FourierTransform FourierTrigSeries FractionalBrownianMotionProcess FractionalPart FractionBox FractionBoxOptions FractionLine Frame FrameBox FrameBoxOptions Framed FrameInset FrameLabel Frameless FrameMargins FrameStyle FrameTicks FrameTicksStyle FRatioDistribution FrechetDistribution FreeQ FrequencySamplingFilterKernel FresnelC FresnelS Friday FrobeniusNumber FrobeniusSolve FromCharacterCode FromCoefficientRules FromContinuedFraction FromDate FromDigits FromDMS Front FrontEndDynamicExpression FrontEndEventActions FrontEndExecute FrontEndObject FrontEndResource FrontEndResourceString FrontEndStackSize FrontEndToken FrontEndTokenExecute FrontEndValueCache FrontEndVersion FrontFaceColor FrontFaceOpacity Full FullAxes FullDefinition FullForm FullGraphics FullOptions FullSimplify Function FunctionExpand FunctionInterpolation FunctionSpace FussellVeselyImportance GaborFilter GaborMatrix GaborWavelet GainMargins GainPhaseMargins Gamma GammaDistribution GammaRegularized GapPenalty Gather GatherBy GaugeFaceElementFunction GaugeFaceStyle GaugeFrameElementFunction GaugeFrameSize GaugeFrameStyle GaugeLabels GaugeMarkers GaugeStyle GaussianFilter GaussianIntegers GaussianMatrix GaussianWindow GCD GegenbauerC General GeneralizedLinearModelFit GenerateConditions GeneratedCell GeneratedParameters GeneratingFunction Generic GenericCylindricalDecomposition GenomeData GenomeLookup GeodesicClosing GeodesicDilation GeodesicErosion GeodesicOpening GeoDestination GeodesyData GeoDirection GeoDistance GeoGridPosition GeometricBrownianMotionProcess GeometricDistribution GeometricMean GeometricMeanFilter GeometricTransformation GeometricTransformation3DBox GeometricTransformation3DBoxOptions GeometricTransformationBox GeometricTransformationBoxOptions GeoPosition GeoPositionENU GeoPositionXYZ GeoProjectionData GestureHandler GestureHandlerTag Get GetBoundingBoxSizePacket GetContext GetEnvironment GetFileName GetFrontEndOptionsDataPacket GetLinebreakInformationPacket GetMenusPacket GetPageBreakInformationPacket Glaisher GlobalClusteringCoefficient GlobalPreferences GlobalSession Glow GoldenRatio GompertzMakehamDistribution GoodmanKruskalGamma GoodmanKruskalGammaTest Goto Grad Gradient GradientFilter GradientOrientationFilter Graph GraphAssortativity GraphCenter GraphComplement GraphData GraphDensity GraphDiameter GraphDifference GraphDisjointUnion GraphDistance GraphDistanceMatrix GraphElementData GraphEmbedding GraphHighlight GraphHighlightStyle GraphHub Graphics Graphics3D Graphics3DBox Graphics3DBoxOptions GraphicsArray GraphicsBaseline GraphicsBox GraphicsBoxOptions GraphicsColor GraphicsColumn GraphicsComplex GraphicsComplex3DBox GraphicsComplex3DBoxOptions GraphicsComplexBox GraphicsComplexBoxOptions GraphicsContents GraphicsData GraphicsGrid GraphicsGridBox GraphicsGroup GraphicsGroup3DBox GraphicsGroup3DBoxOptions GraphicsGroupBox GraphicsGroupBoxOptions GraphicsGrouping GraphicsHighlightColor GraphicsRow GraphicsSpacing GraphicsStyle GraphIntersection GraphLayout GraphLinkEfficiency GraphPeriphery GraphPlot GraphPlot3D GraphPower GraphPropertyDistribution GraphQ GraphRadius GraphReciprocity GraphRoot GraphStyle GraphUnion Gray GrayLevel GreatCircleDistance Greater GreaterEqual GreaterEqualLess GreaterFullEqual GreaterGreater GreaterLess GreaterSlantEqual GreaterTilde Green Grid GridBaseline GridBox GridBoxAlignment GridBoxBackground GridBoxDividers GridBoxFrame GridBoxItemSize GridBoxItemStyle GridBoxOptions GridBoxSpacings GridCreationSettings GridDefaultElement GridElementStyleOptions GridFrame GridFrameMargins GridGraph GridLines GridLinesStyle GroebnerBasis GroupActionBase GroupCentralizer GroupElementFromWord GroupElementPosition GroupElementQ GroupElements GroupElementToWord GroupGenerators GroupMultiplicationTable GroupOrbits GroupOrder GroupPageBreakWithin GroupSetwiseStabilizer GroupStabilizer GroupStabilizerChain Gudermannian GumbelDistribution HaarWavelet HadamardMatrix HalfNormalDistribution HamiltonianGraphQ HammingDistance HammingWindow HankelH1 HankelH2 HankelMatrix HannPoissonWindow HannWindow HaradaNortonGroupHN HararyGraph HarmonicMean HarmonicMeanFilter HarmonicNumber Hash HashTable Haversine HazardFunction Head HeadCompose Heads HeavisideLambda HeavisidePi HeavisideTheta HeldGroupHe HeldPart HelpBrowserLookup HelpBrowserNotebook HelpBrowserSettings HermiteDecomposition HermiteH HermitianMatrixQ HessenbergDecomposition Hessian HexadecimalCharacter Hexahedron HexahedronBox HexahedronBoxOptions HiddenSurface HighlightGraph HighlightImage HighpassFilter HigmanSimsGroupHS HilbertFilter HilbertMatrix Histogram Histogram3D HistogramDistribution HistogramList HistogramTransform HistogramTransformInterpolation HitMissTransform HITSCentrality HodgeDual HoeffdingD HoeffdingDTest Hold HoldAll HoldAllComplete HoldComplete HoldFirst HoldForm HoldPattern HoldRest HolidayCalendar HomeDirectory HomePage Horizontal HorizontalForm HorizontalGauge HorizontalScrollPosition HornerForm HotellingTSquareDistribution HoytDistribution HTMLSave Hue HumpDownHump HumpEqual HurwitzLerchPhi HurwitzZeta HyperbolicDistribution HypercubeGraph HyperexponentialDistribution Hyperfactorial Hypergeometric0F1 Hypergeometric0F1Regularized Hypergeometric1F1 Hypergeometric1F1Regularized Hypergeometric2F1 Hypergeometric2F1Regularized HypergeometricDistribution HypergeometricPFQ HypergeometricPFQRegularized HypergeometricU Hyperlink HyperlinkCreationSettings Hyphenation HyphenationOptions HypoexponentialDistribution HypothesisTestData I Identity IdentityMatrix If IgnoreCase Im Image Image3D Image3DSlices ImageAccumulate ImageAdd ImageAdjust ImageAlign ImageApply ImageAspectRatio ImageAssemble ImageCache ImageCacheValid ImageCapture ImageChannels ImageClip ImageColorSpace ImageCompose ImageConvolve ImageCooccurrence ImageCorners ImageCorrelate ImageCorrespondingPoints ImageCrop ImageData ImageDataPacket ImageDeconvolve ImageDemosaic ImageDifference ImageDimensions ImageDistance ImageEffect ImageFeatureTrack ImageFileApply ImageFileFilter ImageFileScan ImageFilter ImageForestingComponents ImageForwardTransformation ImageHistogram ImageKeypoints ImageLevels ImageLines ImageMargins ImageMarkers ImageMeasurements ImageMultiply ImageOffset ImagePad ImagePadding ImagePartition ImagePeriodogram ImagePerspectiveTransformation ImageQ ImageRangeCache ImageReflect ImageRegion ImageResize ImageResolution ImageRotate ImageRotated ImageScaled ImageScan ImageSize ImageSizeAction ImageSizeCache ImageSizeMultipliers ImageSizeRaw ImageSubtract ImageTake ImageTransformation ImageTrim ImageType ImageValue ImageValuePositions Implies Import ImportAutoReplacements ImportString ImprovementImportance In IncidenceGraph IncidenceList IncidenceMatrix IncludeConstantBasis IncludeFileExtension IncludePods IncludeSingularTerm Increment Indent IndentingNewlineSpacings IndentMaxFraction IndependenceTest IndependentEdgeSetQ IndependentUnit IndependentVertexSetQ Indeterminate IndexCreationOptions Indexed IndexGraph IndexTag Inequality InexactNumberQ InexactNumbers Infinity Infix Information Inherited InheritScope Initialization InitializationCell InitializationCellEvaluation InitializationCellWarning InlineCounterAssignments InlineCounterIncrements InlineRules Inner Inpaint Input InputAliases InputAssumptions InputAutoReplacements InputField InputFieldBox InputFieldBoxOptions InputForm InputGrouping InputNamePacket InputNotebook InputPacket InputSettings InputStream InputString InputStringPacket InputToBoxFormPacket Insert InsertionPointObject InsertResults Inset Inset3DBox Inset3DBoxOptions InsetBox InsetBoxOptions Install InstallService InString Integer IntegerDigits IntegerExponent IntegerLength IntegerPart IntegerPartitions IntegerQ Integers IntegerString Integral Integrate Interactive InteractiveTradingChart Interlaced Interleaving InternallyBalancedDecomposition InterpolatingFunction InterpolatingPolynomial Interpolation InterpolationOrder InterpolationPoints InterpolationPrecision Interpretation InterpretationBox InterpretationBoxOptions InterpretationFunction InterpretTemplate InterquartileRange Interrupt InterruptSettings Intersection Interval IntervalIntersection IntervalMemberQ IntervalUnion Inverse InverseBetaRegularized InverseCDF InverseChiSquareDistribution InverseContinuousWaveletTransform InverseDistanceTransform InverseEllipticNomeQ InverseErf InverseErfc InverseFourier InverseFourierCosTransform InverseFourierSequenceTransform InverseFourierSinTransform InverseFourierTransform InverseFunction InverseFunctions InverseGammaDistribution InverseGammaRegularized InverseGaussianDistribution InverseGudermannian InverseHaversine InverseJacobiCD InverseJacobiCN InverseJacobiCS InverseJacobiDC InverseJacobiDN InverseJacobiDS InverseJacobiNC InverseJacobiND InverseJacobiNS InverseJacobiSC InverseJacobiSD InverseJacobiSN InverseLaplaceTransform InversePermutation InverseRadon InverseSeries InverseSurvivalFunction InverseWaveletTransform InverseWeierstrassP InverseZTransform Invisible InvisibleApplication InvisibleTimes IrreduciblePolynomialQ IsolatingInterval IsomorphicGraphQ IsotopeData Italic Item ItemBox ItemBoxOptions ItemSize ItemStyle ItoProcess JaccardDissimilarity JacobiAmplitude Jacobian JacobiCD JacobiCN JacobiCS JacobiDC JacobiDN JacobiDS JacobiNC JacobiND JacobiNS JacobiP JacobiSC JacobiSD JacobiSN JacobiSymbol JacobiZeta JankoGroupJ1 JankoGroupJ2 JankoGroupJ3 JankoGroupJ4 JarqueBeraALMTest JohnsonDistribution Join Joined JoinedCurve JoinedCurveBox JoinForm JordanDecomposition JordanModelDecomposition K KagiChart KaiserBesselWindow KaiserWindow KalmanEstimator KalmanFilter KarhunenLoeveDecomposition KaryTree KatzCentrality KCoreComponents KDistribution KelvinBei KelvinBer KelvinKei KelvinKer KendallTau KendallTauTest KernelExecute KernelMixtureDistribution KernelObject Kernels Ket Khinchin KirchhoffGraph KirchhoffMatrix KleinInvariantJ KnightTourGraph KnotData KnownUnitQ KolmogorovSmirnovTest KroneckerDelta KroneckerModelDecomposition KroneckerProduct KroneckerSymbol KuiperTest KumaraswamyDistribution Kurtosis KuwaharaFilter Label Labeled LabeledSlider LabelingFunction LabelStyle LaguerreL LambdaComponents LambertW LanczosWindow LandauDistribution Language LanguageCategory LaplaceDistribution LaplaceTransform Laplacian LaplacianFilter LaplacianGaussianFilter Large Larger Last Latitude LatitudeLongitude LatticeData LatticeReduce Launch LaunchKernels LayeredGraphPlot LayerSizeFunction LayoutInformation LCM LeafCount LeapYearQ LeastSquares LeastSquaresFilterKernel Left LeftArrow LeftArrowBar LeftArrowRightArrow LeftDownTeeVector LeftDownVector LeftDownVectorBar LeftRightArrow LeftRightVector LeftTee LeftTeeArrow LeftTeeVector LeftTriangle LeftTriangleBar LeftTriangleEqual LeftUpDownVector LeftUpTeeVector LeftUpVector LeftUpVectorBar LeftVector LeftVectorBar LegendAppearance Legended LegendFunction LegendLabel LegendLayout LegendMargins LegendMarkers LegendMarkerSize LegendreP LegendreQ LegendreType Length LengthWhile LerchPhi Less LessEqual LessEqualGreater LessFullEqual LessGreater LessLess LessSlantEqual LessTilde LetterCharacter LetterQ Level LeveneTest LeviCivitaTensor LevyDistribution Lexicographic LibraryFunction LibraryFunctionError LibraryFunctionInformation LibraryFunctionLoad LibraryFunctionUnload LibraryLoad LibraryUnload LicenseID LiftingFilterData LiftingWaveletTransform LightBlue LightBrown LightCyan Lighter LightGray LightGreen Lighting LightingAngle LightMagenta LightOrange LightPink LightPurple LightRed LightSources LightYellow Likelihood Limit LimitsPositioning LimitsPositioningTokens LindleyDistribution Line Line3DBox LinearFilter LinearFractionalTransform LinearModelFit LinearOffsetFunction LinearProgramming LinearRecurrence LinearSolve LinearSolveFunction LineBox LineBreak LinebreakAdjustments LineBreakChart LineBreakWithin LineColor LineForm LineGraph LineIndent LineIndentMaxFraction LineIntegralConvolutionPlot LineIntegralConvolutionScale LineLegend LineOpacity LineSpacing LineWrapParts LinkActivate LinkClose LinkConnect LinkConnectedQ LinkCreate LinkError LinkFlush LinkFunction LinkHost LinkInterrupt LinkLaunch LinkMode LinkObject LinkOpen LinkOptions LinkPatterns LinkProtocol LinkRead LinkReadHeld LinkReadyQ Links LinkWrite LinkWriteHeld LiouvilleLambda List Listable ListAnimate ListContourPlot ListContourPlot3D ListConvolve ListCorrelate ListCurvePathPlot ListDeconvolve ListDensityPlot Listen ListFourierSequenceTransform ListInterpolation ListLineIntegralConvolutionPlot ListLinePlot ListLogLinearPlot ListLogLogPlot ListLogPlot ListPicker ListPickerBox ListPickerBoxBackground ListPickerBoxOptions ListPlay ListPlot ListPlot3D ListPointPlot3D ListPolarPlot ListQ ListStreamDensityPlot ListStreamPlot ListSurfacePlot3D ListVectorDensityPlot ListVectorPlot ListVectorPlot3D ListZTransform Literal LiteralSearch LocalClusteringCoefficient LocalizeVariables LocationEquivalenceTest LocationTest Locator LocatorAutoCreate LocatorBox LocatorBoxOptions LocatorCentering LocatorPane LocatorPaneBox LocatorPaneBoxOptions LocatorRegion Locked Log Log10 Log2 LogBarnesG LogGamma LogGammaDistribution LogicalExpand LogIntegral LogisticDistribution LogitModelFit LogLikelihood LogLinearPlot LogLogisticDistribution LogLogPlot LogMultinormalDistribution LogNormalDistribution LogPlot LogRankTest LogSeriesDistribution LongEqual Longest LongestAscendingSequence LongestCommonSequence LongestCommonSequencePositions LongestCommonSubsequence LongestCommonSubsequencePositions LongestMatch LongForm Longitude LongLeftArrow LongLeftRightArrow LongRightArrow Loopback LoopFreeGraphQ LowerCaseQ LowerLeftArrow LowerRightArrow LowerTriangularize LowpassFilter LQEstimatorGains LQGRegulator LQOutputRegulatorGains LQRegulatorGains LUBackSubstitution LucasL LuccioSamiComponents LUDecomposition LyapunovSolve LyonsGroupLy MachineID MachineName MachineNumberQ MachinePrecision MacintoshSystemPageSetup Magenta Magnification Magnify MainSolve MaintainDynamicCaches Majority MakeBoxes MakeExpression MakeRules MangoldtLambda ManhattanDistance Manipulate Manipulator MannWhitneyTest MantissaExponent Manual Map MapAll MapAt MapIndexed MAProcess MapThread MarcumQ MardiaCombinedTest MardiaKurtosisTest MardiaSkewnessTest MarginalDistribution MarkovProcessProperties Masking MatchingDissimilarity MatchLocalNameQ MatchLocalNames MatchQ Material MathematicaNotation MathieuC MathieuCharacteristicA MathieuCharacteristicB MathieuCharacteristicExponent MathieuCPrime MathieuGroupM11 MathieuGroupM12 MathieuGroupM22 MathieuGroupM23 MathieuGroupM24 MathieuS MathieuSPrime MathMLForm MathMLText Matrices MatrixExp MatrixForm MatrixFunction MatrixLog MatrixPlot MatrixPower MatrixQ MatrixRank Max MaxBend MaxDetect MaxExtraBandwidths MaxExtraConditions MaxFeatures MaxFilter Maximize MaxIterations MaxMemoryUsed MaxMixtureKernels MaxPlotPoints MaxPoints MaxRecursion MaxStableDistribution MaxStepFraction MaxSteps MaxStepSize MaxValue MaxwellDistribution McLaughlinGroupMcL Mean MeanClusteringCoefficient MeanDegreeConnectivity MeanDeviation MeanFilter MeanGraphDistance MeanNeighborDegree MeanShift MeanShiftFilter Median MedianDeviation MedianFilter Medium MeijerG MeixnerDistribution MemberQ MemoryConstrained MemoryInUse Menu MenuAppearance MenuCommandKey MenuEvaluator MenuItem MenuPacket MenuSortingValue MenuStyle MenuView MergeDifferences Mesh MeshFunctions MeshRange MeshShading MeshStyle Message MessageDialog MessageList MessageName MessageOptions MessagePacket Messages MessagesNotebook MetaCharacters MetaInformation Method MethodOptions MexicanHatWavelet MeyerWavelet Min MinDetect MinFilter MinimalPolynomial MinimalStateSpaceModel Minimize Minors MinRecursion MinSize MinStableDistribution Minus MinusPlus MinValue Missing MissingDataMethod MittagLefflerE MixedRadix MixedRadixQuantity MixtureDistribution Mod Modal Mode Modular ModularLambda Module Modulus MoebiusMu Moment Momentary MomentConvert MomentEvaluate MomentGeneratingFunction Monday Monitor MonomialList MonomialOrder MonsterGroupM MorletWavelet MorphologicalBinarize MorphologicalBranchPoints MorphologicalComponents MorphologicalEulerNumber MorphologicalGraph MorphologicalPerimeter MorphologicalTransform Most MouseAnnotation MouseAppearance MouseAppearanceTag MouseButtons Mouseover MousePointerNote MousePosition MovingAverage MovingMedian MoyalDistribution MultiedgeStyle MultilaunchWarning MultiLetterItalics MultiLetterStyle MultilineFunction Multinomial MultinomialDistribution MultinormalDistribution MultiplicativeOrder Multiplicity Multiselection MultivariateHypergeometricDistribution MultivariatePoissonDistribution MultivariateTDistribution N NakagamiDistribution NameQ Names NamespaceBox Nand NArgMax NArgMin NBernoulliB NCache NDSolve NDSolveValue Nearest NearestFunction NeedCurrentFrontEndPackagePacket NeedCurrentFrontEndSymbolsPacket NeedlemanWunschSimilarity Needs Negative NegativeBinomialDistribution NegativeMultinomialDistribution NeighborhoodGraph Nest NestedGreaterGreater NestedLessLess NestedScriptRules NestList NestWhile NestWhileList NevilleThetaC NevilleThetaD NevilleThetaN NevilleThetaS NewPrimitiveStyle NExpectation Next NextPrime NHoldAll NHoldFirst NHoldRest NicholsGridLines NicholsPlot NIntegrate NMaximize NMaxValue NMinimize NMinValue NominalVariables NonAssociative NoncentralBetaDistribution NoncentralChiSquareDistribution NoncentralFRatioDistribution NoncentralStudentTDistribution NonCommutativeMultiply NonConstants None NonlinearModelFit NonlocalMeansFilter NonNegative NonPositive Nor NorlundB Norm Normal NormalDistribution NormalGrouping Normalize NormalizedSquaredEuclideanDistance NormalsFunction NormFunction Not NotCongruent NotCupCap NotDoubleVerticalBar Notebook NotebookApply NotebookAutoSave NotebookClose NotebookConvertSettings NotebookCreate NotebookCreateReturnObject NotebookDefault NotebookDelete NotebookDirectory NotebookDynamicExpression NotebookEvaluate NotebookEventActions NotebookFileName NotebookFind NotebookFindReturnObject NotebookGet NotebookGetLayoutInformationPacket NotebookGetMisspellingsPacket NotebookInformation NotebookInterfaceObject NotebookLocate NotebookObject NotebookOpen NotebookOpenReturnObject NotebookPath NotebookPrint NotebookPut NotebookPutReturnObject NotebookRead NotebookResetGeneratedCells Notebooks NotebookSave NotebookSaveAs NotebookSelection NotebookSetupLayoutInformationPacket NotebooksMenu NotebookWrite NotElement NotEqualTilde NotExists NotGreater NotGreaterEqual NotGreaterFullEqual NotGreaterGreater NotGreaterLess NotGreaterSlantEqual NotGreaterTilde NotHumpDownHump NotHumpEqual NotLeftTriangle NotLeftTriangleBar NotLeftTriangleEqual NotLess NotLessEqual NotLessFullEqual NotLessGreater NotLessLess NotLessSlantEqual NotLessTilde NotNestedGreaterGreater NotNestedLessLess NotPrecedes NotPrecedesEqual NotPrecedesSlantEqual NotPrecedesTilde NotReverseElement NotRightTriangle NotRightTriangleBar NotRightTriangleEqual NotSquareSubset NotSquareSubsetEqual NotSquareSuperset NotSquareSupersetEqual NotSubset NotSubsetEqual NotSucceeds NotSucceedsEqual NotSucceedsSlantEqual NotSucceedsTilde NotSuperset NotSupersetEqual NotTilde NotTildeEqual NotTildeFullEqual NotTildeTilde NotVerticalBar NProbability NProduct NProductFactors NRoots NSolve NSum NSumTerms Null NullRecords NullSpace NullWords Number NumberFieldClassNumber NumberFieldDiscriminant NumberFieldFundamentalUnits NumberFieldIntegralBasis NumberFieldNormRepresentatives NumberFieldRegulator NumberFieldRootsOfUnity NumberFieldSignature NumberForm NumberFormat NumberMarks NumberMultiplier NumberPadding NumberPoint NumberQ NumberSeparator NumberSigns NumberString Numerator NumericFunction NumericQ NuttallWindow NValues NyquistGridLines NyquistPlot O ObservabilityGramian ObservabilityMatrix ObservableDecomposition ObservableModelQ OddQ Off Offset OLEData On ONanGroupON OneIdentity Opacity Open OpenAppend Opener OpenerBox OpenerBoxOptions OpenerView OpenFunctionInspectorPacket Opening OpenRead OpenSpecialOptions OpenTemporary OpenWrite Operate OperatingSystem OptimumFlowData Optional OptionInspectorSettings OptionQ Options OptionsPacket OptionsPattern OptionValue OptionValueBox OptionValueBoxOptions Or Orange Order OrderDistribution OrderedQ Ordering Orderless OrnsteinUhlenbeckProcess Orthogonalize Out Outer OutputAutoOverwrite OutputControllabilityMatrix OutputControllableModelQ OutputForm OutputFormData OutputGrouping OutputMathEditExpression OutputNamePacket OutputResponse OutputSizeLimit OutputStream Over OverBar OverDot Overflow OverHat Overlaps Overlay OverlayBox OverlayBoxOptions Overscript OverscriptBox OverscriptBoxOptions OverTilde OverVector OwenT OwnValues PackingMethod PaddedForm Padding PadeApproximant PadLeft PadRight PageBreakAbove PageBreakBelow PageBreakWithin PageFooterLines PageFooters PageHeaderLines PageHeaders PageHeight PageRankCentrality PageWidth PairedBarChart PairedHistogram PairedSmoothHistogram PairedTTest PairedZTest PaletteNotebook PalettePath Pane PaneBox PaneBoxOptions Panel PanelBox PanelBoxOptions Paneled PaneSelector PaneSelectorBox PaneSelectorBoxOptions PaperWidth ParabolicCylinderD ParagraphIndent ParagraphSpacing ParallelArray ParallelCombine ParallelDo ParallelEvaluate Parallelization Parallelize ParallelMap ParallelNeeds ParallelProduct ParallelSubmit ParallelSum ParallelTable ParallelTry Parameter ParameterEstimator ParameterMixtureDistribution ParameterVariables ParametricFunction ParametricNDSolve ParametricNDSolveValue ParametricPlot ParametricPlot3D ParentConnect ParentDirectory ParentForm Parenthesize ParentList ParetoDistribution Part PartialCorrelationFunction PartialD ParticleData Partition PartitionsP PartitionsQ ParzenWindow PascalDistribution PassEventsDown PassEventsUp Paste PasteBoxFormInlineCells PasteButton Path PathGraph PathGraphQ Pattern PatternSequence PatternTest PauliMatrix PaulWavelet Pause PausedTime PDF PearsonChiSquareTest PearsonCorrelationTest PearsonDistribution PerformanceGoal PeriodicInterpolation Periodogram PeriodogramArray PermutationCycles PermutationCyclesQ PermutationGroup PermutationLength PermutationList PermutationListQ PermutationMax PermutationMin PermutationOrder PermutationPower PermutationProduct PermutationReplace Permutations PermutationSupport Permute PeronaMalikFilter Perpendicular PERTDistribution PetersenGraph PhaseMargins Pi Pick PIDData PIDDerivativeFilter PIDFeedforward PIDTune Piecewise PiecewiseExpand PieChart PieChart3D PillaiTrace PillaiTraceTest Pink Pivoting PixelConstrained PixelValue PixelValuePositions Placed Placeholder PlaceholderReplace Plain PlanarGraphQ Play PlayRange Plot Plot3D Plot3Matrix PlotDivision PlotJoined PlotLabel PlotLayout PlotLegends PlotMarkers PlotPoints PlotRange PlotRangeClipping PlotRangePadding PlotRegion PlotStyle Plus PlusMinus Pochhammer PodStates PodWidth Point Point3DBox PointBox PointFigureChart PointForm PointLegend PointSize PoissonConsulDistribution PoissonDistribution PoissonProcess PoissonWindow PolarAxes PolarAxesOrigin PolarGridLines PolarPlot PolarTicks PoleZeroMarkers PolyaAeppliDistribution PolyGamma Polygon Polygon3DBox Polygon3DBoxOptions PolygonBox PolygonBoxOptions PolygonHoleScale PolygonIntersections PolygonScale PolyhedronData PolyLog PolynomialExtendedGCD PolynomialForm PolynomialGCD PolynomialLCM PolynomialMod PolynomialQ PolynomialQuotient PolynomialQuotientRemainder PolynomialReduce PolynomialRemainder Polynomials PopupMenu PopupMenuBox PopupMenuBoxOptions PopupView PopupWindow Position Positive PositiveDefiniteMatrixQ PossibleZeroQ Postfix PostScript Power PowerDistribution PowerExpand PowerMod PowerModList PowerSpectralDensity PowersRepresentations PowerSymmetricPolynomial Precedence PrecedenceForm Precedes PrecedesEqual PrecedesSlantEqual PrecedesTilde Precision PrecisionGoal PreDecrement PredictionRoot PreemptProtect PreferencesPath Prefix PreIncrement Prepend PrependTo PreserveImageOptions Previous PriceGraphDistribution PrimaryPlaceholder Prime PrimeNu PrimeOmega PrimePi PrimePowerQ PrimeQ Primes PrimeZetaP PrimitiveRoot PrincipalComponents PrincipalValue Print PrintAction PrintForm PrintingCopies PrintingOptions PrintingPageRange PrintingStartingPageNumber PrintingStyleEnvironment PrintPrecision PrintTemporary Prism PrismBox PrismBoxOptions PrivateCellOptions PrivateEvaluationOptions PrivateFontOptions PrivateFrontEndOptions PrivateNotebookOptions PrivatePaths Probability ProbabilityDistribution ProbabilityPlot ProbabilityPr ProbabilityScalePlot ProbitModelFit ProcessEstimator ProcessParameterAssumptions ProcessParameterQ ProcessStateDomain ProcessTimeDomain Product ProductDistribution ProductLog ProgressIndicator ProgressIndicatorBox ProgressIndicatorBoxOptions Projection Prolog PromptForm Properties Property PropertyList PropertyValue Proportion Proportional Protect Protected ProteinData Pruning PseudoInverse Purple Put PutAppend Pyramid PyramidBox PyramidBoxOptions QBinomial QFactorial QGamma QHypergeometricPFQ QPochhammer QPolyGamma QRDecomposition QuadraticIrrationalQ Quantile QuantilePlot Quantity QuantityForm QuantityMagnitude QuantityQ QuantityUnit Quartics QuartileDeviation Quartiles QuartileSkewness QueueingNetworkProcess QueueingProcess QueueProperties Quiet Quit Quotient QuotientRemainder RadialityCentrality RadicalBox RadicalBoxOptions RadioButton RadioButtonBar RadioButtonBox RadioButtonBoxOptions Radon RamanujanTau RamanujanTauL RamanujanTauTheta RamanujanTauZ Random RandomChoice RandomComplex RandomFunction RandomGraph RandomImage RandomInteger RandomPermutation RandomPrime RandomReal RandomSample RandomSeed RandomVariate RandomWalkProcess Range RangeFilter RangeSpecification RankedMax RankedMin Raster Raster3D Raster3DBox Raster3DBoxOptions RasterArray RasterBox RasterBoxOptions Rasterize RasterSize Rational RationalFunctions Rationalize Rationals Ratios Raw RawArray RawBoxes RawData RawMedium RayleighDistribution Re Read ReadList ReadProtected Real RealBlockDiagonalForm RealDigits RealExponent Reals Reap Record RecordLists RecordSeparators Rectangle RectangleBox RectangleBoxOptions RectangleChart RectangleChart3D RecurrenceFilter RecurrenceTable RecurringDigitsForm Red Reduce RefBox ReferenceLineStyle ReferenceMarkers ReferenceMarkerStyle Refine ReflectionMatrix ReflectionTransform Refresh RefreshRate RegionBinarize RegionFunction RegionPlot RegionPlot3D RegularExpression Regularization Reinstall Release ReleaseHold ReliabilityDistribution ReliefImage ReliefPlot Remove RemoveAlphaChannel RemoveAsynchronousTask Removed RemoveInputStreamMethod RemoveOutputStreamMethod RemoveProperty RemoveScheduledTask RenameDirectory RenameFile RenderAll RenderingOptions RenewalProcess RenkoChart Repeated RepeatedNull RepeatedString Replace ReplaceAll ReplaceHeldPart ReplaceImageValue ReplaceList ReplacePart ReplacePixelValue ReplaceRepeated Resampling Rescale RescalingTransform ResetDirectory ResetMenusPacket ResetScheduledTask Residue Resolve Rest Resultant ResumePacket Return ReturnExpressionPacket ReturnInputFormPacket ReturnPacket ReturnTextPacket Reverse ReverseBiorthogonalSplineWavelet ReverseElement ReverseEquilibrium ReverseGraph ReverseUpEquilibrium RevolutionAxis RevolutionPlot3D RGBColor RiccatiSolve RiceDistribution RidgeFilter RiemannR RiemannSiegelTheta RiemannSiegelZ Riffle Right RightArrow RightArrowBar RightArrowLeftArrow RightCosetRepresentative RightDownTeeVector RightDownVector RightDownVectorBar RightTee RightTeeArrow RightTeeVector RightTriangle RightTriangleBar RightTriangleEqual RightUpDownVector RightUpTeeVector RightUpVector RightUpVectorBar RightVector RightVectorBar RiskAchievementImportance RiskReductionImportance RogersTanimotoDissimilarity Root RootApproximant RootIntervals RootLocusPlot RootMeanSquare RootOfUnityQ RootReduce Roots RootSum Rotate RotateLabel RotateLeft RotateRight RotationAction RotationBox RotationBoxOptions RotationMatrix RotationTransform Round RoundImplies RoundingRadius Row RowAlignments RowBackgrounds RowBox RowHeights RowLines RowMinHeight RowReduce RowsEqual RowSpacings RSolve RudvalisGroupRu Rule RuleCondition RuleDelayed RuleForm RulerUnits Run RunScheduledTask RunThrough RuntimeAttributes RuntimeOptions RussellRaoDissimilarity SameQ SameTest SampleDepth SampledSoundFunction SampledSoundList SampleRate SamplingPeriod SARIMAProcess SARMAProcess SatisfiabilityCount SatisfiabilityInstances SatisfiableQ Saturday Save Saveable SaveAutoDelete SaveDefinitions SawtoothWave Scale Scaled ScaleDivisions ScaledMousePosition ScaleOrigin ScalePadding ScaleRanges ScaleRangeStyle ScalingFunctions ScalingMatrix ScalingTransform Scan ScheduledTaskActiveQ ScheduledTaskData ScheduledTaskObject ScheduledTasks SchurDecomposition ScientificForm ScreenRectangle ScreenStyleEnvironment ScriptBaselineShifts ScriptLevel ScriptMinSize ScriptRules ScriptSizeMultipliers Scrollbars ScrollingOptions ScrollPosition Sec Sech SechDistribution SectionGrouping SectorChart SectorChart3D SectorOrigin SectorSpacing SeedRandom Select Selectable SelectComponents SelectedCells SelectedNotebook Selection SelectionAnimate SelectionCell SelectionCellCreateCell SelectionCellDefaultStyle SelectionCellParentStyle SelectionCreateCell SelectionDebuggerTag SelectionDuplicateCell SelectionEvaluate SelectionEvaluateCreateCell SelectionMove SelectionPlaceholder SelectionSetStyle SelectWithContents SelfLoops SelfLoopStyle SemialgebraicComponentInstances SendMail Sequence SequenceAlignment SequenceForm SequenceHold SequenceLimit Series SeriesCoefficient SeriesData SessionTime Set SetAccuracy SetAlphaChannel SetAttributes Setbacks SetBoxFormNamesPacket SetDelayed SetDirectory SetEnvironment SetEvaluationNotebook SetFileDate SetFileLoadingContext SetNotebookStatusLine SetOptions SetOptionsPacket SetPrecision SetProperty SetSelectedNotebook SetSharedFunction SetSharedVariable SetSpeechParametersPacket SetStreamPosition SetSystemOptions Setter SetterBar SetterBox SetterBoxOptions Setting SetValue Shading Shallow ShannonWavelet ShapiroWilkTest Share Sharpen ShearingMatrix ShearingTransform ShenCastanMatrix Short ShortDownArrow Shortest ShortestMatch ShortestPathFunction ShortLeftArrow ShortRightArrow ShortUpArrow Show ShowAutoStyles ShowCellBracket ShowCellLabel ShowCellTags ShowClosedCellArea ShowContents ShowControls ShowCursorTracker ShowGroupOpenCloseIcon ShowGroupOpener ShowInvisibleCharacters ShowPageBreaks ShowPredictiveInterface ShowSelection ShowShortBoxForm ShowSpecialCharacters ShowStringCharacters ShowSyntaxStyles ShrinkingDelay ShrinkWrapBoundingBox SiegelTheta SiegelTukeyTest Sign Signature SignedRankTest SignificanceLevel SignPadding SignTest SimilarityRules SimpleGraph SimpleGraphQ Simplify Sin Sinc SinghMaddalaDistribution SingleEvaluation SingleLetterItalics SingleLetterStyle SingularValueDecomposition SingularValueList SingularValuePlot SingularValues Sinh SinhIntegral SinIntegral SixJSymbol Skeleton SkeletonTransform SkellamDistribution Skewness SkewNormalDistribution Skip SliceDistribution Slider Slider2D Slider2DBox Slider2DBoxOptions SliderBox SliderBoxOptions SlideView Slot SlotSequence Small SmallCircle Smaller SmithDelayCompensator SmithWatermanSimilarity SmoothDensityHistogram SmoothHistogram SmoothHistogram3D SmoothKernelDistribution SocialMediaData Socket SokalSneathDissimilarity Solve SolveAlways SolveDelayed Sort SortBy Sound SoundAndGraphics SoundNote SoundVolume Sow Space SpaceForm Spacer Spacings Span SpanAdjustments SpanCharacterRounding SpanFromAbove SpanFromBoth SpanFromLeft SpanLineThickness SpanMaxSize SpanMinSize SpanningCharacters SpanSymmetric SparseArray SpatialGraphDistribution Speak SpeakTextPacket SpearmanRankTest SpearmanRho Spectrogram SpectrogramArray Specularity SpellingCorrection SpellingDictionaries SpellingDictionariesPath SpellingOptions SpellingSuggestionsPacket Sphere SphereBox SphericalBesselJ SphericalBesselY SphericalHankelH1 SphericalHankelH2 SphericalHarmonicY SphericalPlot3D SphericalRegion SpheroidalEigenvalue SpheroidalJoiningFactor SpheroidalPS SpheroidalPSPrime SpheroidalQS SpheroidalQSPrime SpheroidalRadialFactor SpheroidalS1 SpheroidalS1Prime SpheroidalS2 SpheroidalS2Prime Splice SplicedDistribution SplineClosed SplineDegree SplineKnots SplineWeights Split SplitBy SpokenString Sqrt SqrtBox SqrtBoxOptions Square SquaredEuclideanDistance SquareFreeQ SquareIntersection SquaresR SquareSubset SquareSubsetEqual SquareSuperset SquareSupersetEqual SquareUnion SquareWave StabilityMargins StabilityMarginsStyle StableDistribution Stack StackBegin StackComplete StackInhibit StandardDeviation StandardDeviationFilter StandardForm Standardize StandbyDistribution Star StarGraph StartAsynchronousTask StartingStepSize StartOfLine StartOfString StartScheduledTask StartupSound StateDimensions StateFeedbackGains StateOutputEstimator StateResponse StateSpaceModel StateSpaceRealization StateSpaceTransform StationaryDistribution StationaryWaveletPacketTransform StationaryWaveletTransform StatusArea StatusCentrality StepMonitor StieltjesGamma StirlingS1 StirlingS2 StopAsynchronousTask StopScheduledTask StrataVariables StratonovichProcess StreamColorFunction StreamColorFunctionScaling StreamDensityPlot StreamPlot StreamPoints StreamPosition Streams StreamScale StreamStyle String StringBreak StringByteCount StringCases StringCount StringDrop StringExpression StringForm StringFormat StringFreeQ StringInsert StringJoin StringLength StringMatchQ StringPosition StringQ StringReplace StringReplaceList StringReplacePart StringReverse StringRotateLeft StringRotateRight StringSkeleton StringSplit StringTake StringToStream StringTrim StripBoxes StripOnInput StripWrapperBoxes StrokeForm StructuralImportance StructuredArray StructuredSelection StruveH StruveL Stub StudentTDistribution Style StyleBox StyleBoxAutoDelete StyleBoxOptions StyleData StyleDefinitions StyleForm StyleKeyMapping StyleMenuListing StyleNameDialogSettings StyleNames StylePrint StyleSheetPath Subfactorial Subgraph SubMinus SubPlus SubresultantPolynomialRemainders SubresultantPolynomials Subresultants Subscript SubscriptBox SubscriptBoxOptions Subscripted Subset SubsetEqual Subsets SubStar Subsuperscript SubsuperscriptBox SubsuperscriptBoxOptions Subtract SubtractFrom SubValues Succeeds SucceedsEqual SucceedsSlantEqual SucceedsTilde SuchThat Sum SumConvergence Sunday SuperDagger SuperMinus SuperPlus Superscript SuperscriptBox SuperscriptBoxOptions Superset SupersetEqual SuperStar Surd SurdForm SurfaceColor SurfaceGraphics SurvivalDistribution SurvivalFunction SurvivalModel SurvivalModelFit SuspendPacket SuzukiDistribution SuzukiGroupSuz SwatchLegend Switch Symbol SymbolName SymletWavelet Symmetric SymmetricGroup SymmetricMatrixQ SymmetricPolynomial SymmetricReduction Symmetrize SymmetrizedArray SymmetrizedArrayRules SymmetrizedDependentComponents SymmetrizedIndependentComponents SymmetrizedReplacePart SynchronousInitialization SynchronousUpdating Syntax SyntaxForm SyntaxInformation SyntaxLength SyntaxPacket SyntaxQ SystemDialogInput SystemException SystemHelpPath SystemInformation SystemInformationData SystemOpen SystemOptions SystemsModelDelay SystemsModelDelayApproximate SystemsModelDelete SystemsModelDimensions SystemsModelExtract SystemsModelFeedbackConnect SystemsModelLabels SystemsModelOrder SystemsModelParallelConnect SystemsModelSeriesConnect SystemsModelStateFeedbackConnect SystemStub Tab TabFilling Table TableAlignments TableDepth TableDirections TableForm TableHeadings TableSpacing TableView TableViewBox TabSpacings TabView TabViewBox TabViewBoxOptions TagBox TagBoxNote TagBoxOptions TaggingRules TagSet TagSetDelayed TagStyle TagUnset Take TakeWhile Tally Tan Tanh TargetFunctions TargetUnits TautologyQ TelegraphProcess TemplateBox TemplateBoxOptions TemplateSlotSequence TemporalData Temporary TemporaryVariable TensorContract TensorDimensions TensorExpand TensorProduct TensorQ TensorRank TensorReduce TensorSymmetry TensorTranspose TensorWedge Tetrahedron TetrahedronBox TetrahedronBoxOptions TeXForm TeXSave Text Text3DBox Text3DBoxOptions TextAlignment TextBand TextBoundingBox TextBox TextCell TextClipboardType TextData TextForm TextJustification TextLine TextPacket TextParagraph TextRecognize TextRendering TextStyle Texture TextureCoordinateFunction TextureCoordinateScaling Therefore ThermometerGauge Thick Thickness Thin Thinning ThisLink ThompsonGroupTh Thread ThreeJSymbol Threshold Through Throw Thumbnail Thursday Ticks TicksStyle Tilde TildeEqual TildeFullEqual TildeTilde TimeConstrained TimeConstraint Times TimesBy TimeSeriesForecast TimeSeriesInvertibility TimeUsed TimeValue TimeZone Timing Tiny TitleGrouping TitsGroupT ToBoxes ToCharacterCode ToColor ToContinuousTimeModel ToDate ToDiscreteTimeModel ToeplitzMatrix ToExpression ToFileName Together Toggle ToggleFalse Toggler TogglerBar TogglerBox TogglerBoxOptions ToHeldExpression ToInvertibleTimeSeries TokenWords Tolerance ToLowerCase ToNumberField TooBig Tooltip TooltipBox TooltipBoxOptions TooltipDelay TooltipStyle Top TopHatTransform TopologicalSort ToRadicals ToRules ToString Total TotalHeight TotalVariationFilter TotalWidth TouchscreenAutoZoom TouchscreenControlPlacement ToUpperCase Tr Trace TraceAbove TraceAction TraceBackward TraceDepth TraceDialog TraceForward TraceInternal TraceLevel TraceOff TraceOn TraceOriginal TracePrint TraceScan TrackedSymbols TradingChart TraditionalForm TraditionalFunctionNotation TraditionalNotation TraditionalOrder TransferFunctionCancel TransferFunctionExpand TransferFunctionFactor TransferFunctionModel TransferFunctionPoles TransferFunctionTransform TransferFunctionZeros TransformationFunction TransformationFunctions TransformationMatrix TransformedDistribution TransformedField Translate TranslationTransform TransparentColor Transpose TreeForm TreeGraph TreeGraphQ TreePlot TrendStyle TriangleWave TriangularDistribution Trig TrigExpand TrigFactor TrigFactorList Trigger TrigReduce TrigToExp TrimmedMean True TrueQ TruncatedDistribution TsallisQExponentialDistribution TsallisQGaussianDistribution TTest Tube TubeBezierCurveBox TubeBezierCurveBoxOptions TubeBox TubeBSplineCurveBox TubeBSplineCurveBoxOptions Tuesday TukeyLambdaDistribution TukeyWindow Tuples TuranGraph TuringMachine Transparent UnateQ Uncompress Undefined UnderBar Underflow Underlined Underoverscript UnderoverscriptBox UnderoverscriptBoxOptions Underscript UnderscriptBox UnderscriptBoxOptions UndirectedEdge UndirectedGraph UndirectedGraphQ UndocumentedTestFEParserPacket UndocumentedTestGetSelectionPacket Unequal Unevaluated UniformDistribution UniformGraphDistribution UniformSumDistribution Uninstall Union UnionPlus Unique UnitBox UnitConvert UnitDimensions Unitize UnitRootTest UnitSimplify UnitStep UnitTriangle UnitVector Unprotect UnsameQ UnsavedVariables Unset UnsetShared UntrackedVariables Up UpArrow UpArrowBar UpArrowDownArrow Update UpdateDynamicObjects UpdateDynamicObjectsSynchronous UpdateInterval UpDownArrow UpEquilibrium UpperCaseQ UpperLeftArrow UpperRightArrow UpperTriangularize Upsample UpSet UpSetDelayed UpTee UpTeeArrow UpValues URL URLFetch URLFetchAsynchronous URLSave URLSaveAsynchronous UseGraphicsRange Using UsingFrontEnd V2Get ValidationLength Value ValueBox ValueBoxOptions ValueForm ValueQ ValuesData Variables Variance VarianceEquivalenceTest VarianceEstimatorFunction VarianceGammaDistribution VarianceTest VectorAngle VectorColorFunction VectorColorFunctionScaling VectorDensityPlot VectorGlyphData VectorPlot VectorPlot3D VectorPoints VectorQ Vectors VectorScale VectorStyle Vee Verbatim Verbose VerboseConvertToPostScriptPacket VerifyConvergence VerifySolutions VerifyTestAssumptions Version VersionNumber VertexAdd VertexCapacity VertexColors VertexComponent VertexConnectivity VertexCoordinateRules VertexCoordinates VertexCorrelationSimilarity VertexCosineSimilarity VertexCount VertexCoverQ VertexDataCoordinates VertexDegree VertexDelete VertexDiceSimilarity VertexEccentricity VertexInComponent VertexInDegree VertexIndex VertexJaccardSimilarity VertexLabeling VertexLabels VertexLabelStyle VertexList VertexNormals VertexOutComponent VertexOutDegree VertexQ VertexRenderingFunction VertexReplace VertexShape VertexShapeFunction VertexSize VertexStyle VertexTextureCoordinates VertexWeight Vertical VerticalBar VerticalForm VerticalGauge VerticalSeparator VerticalSlider VerticalTilde ViewAngle ViewCenter ViewMatrix ViewPoint ViewPointSelectorSettings ViewPort ViewRange ViewVector ViewVertical VirtualGroupData Visible VisibleCell VoigtDistribution VonMisesDistribution WaitAll WaitAsynchronousTask WaitNext WaitUntil WakebyDistribution WalleniusHypergeometricDistribution WaringYuleDistribution WatershedComponents WatsonUSquareTest WattsStrogatzGraphDistribution WaveletBestBasis WaveletFilterCoefficients WaveletImagePlot WaveletListPlot WaveletMapIndexed WaveletMatrixPlot WaveletPhi WaveletPsi WaveletScale WaveletScalogram WaveletThreshold WeaklyConnectedComponents WeaklyConnectedGraphQ WeakStationarity WeatherData WeberE Wedge Wednesday WeibullDistribution WeierstrassHalfPeriods WeierstrassInvariants WeierstrassP WeierstrassPPrime WeierstrassSigma WeierstrassZeta WeightedAdjacencyGraph WeightedAdjacencyMatrix WeightedData WeightedGraphQ Weights WelchWindow WheelGraph WhenEvent Which While White Whitespace WhitespaceCharacter WhittakerM WhittakerW WienerFilter WienerProcess WignerD WignerSemicircleDistribution WilksW WilksWTest WindowClickSelect WindowElements WindowFloating WindowFrame WindowFrameElements WindowMargins WindowMovable WindowOpacity WindowSelected WindowSize WindowStatusArea WindowTitle WindowToolbars WindowWidth With WolframAlpha WolframAlphaDate WolframAlphaQuantity WolframAlphaResult Word WordBoundary WordCharacter WordData WordSearch WordSeparators WorkingPrecision Write WriteString Wronskian XMLElement XMLObject Xnor Xor Yellow YuleDissimilarity ZernikeR ZeroSymmetric ZeroTest ZeroWidthTimes Zeta ZetaZero ZipfDistribution ZTest ZTransform $Aborted $ActivationGroupID $ActivationKey $ActivationUserRegistered $AddOnsDirectory $AssertFunction $Assumptions $AsynchronousTask $BaseDirectory $BatchInput $BatchOutput $BoxForms $ByteOrdering $Canceled $CharacterEncoding $CharacterEncodings $CommandLine $CompilationTarget $ConditionHold $ConfiguredKernels $Context $ContextPath $ControlActiveSetting $CreationDate $CurrentLink $DateStringFormat $DefaultFont $DefaultFrontEnd $DefaultImagingDevice $DefaultPath $Display $DisplayFunction $DistributedContexts $DynamicEvaluation $Echo $Epilog $ExportFormats $Failed $FinancialDataSource $FormatType $FrontEnd $FrontEndSession $GeoLocation $HistoryLength $HomeDirectory $HTTPCookies $IgnoreEOF $ImagingDevices $ImportFormats $InitialDirectory $Input $InputFileName $InputStreamMethods $Inspector $InstallationDate $InstallationDirectory $InterfaceEnvironment $IterationLimit $KernelCount $KernelID $Language $LaunchDirectory $LibraryPath $LicenseExpirationDate $LicenseID $LicenseProcesses $LicenseServer $LicenseSubprocesses $LicenseType $Line $Linked $LinkSupported $LoadedFiles $MachineAddresses $MachineDomain $MachineDomains $MachineEpsilon $MachineID $MachineName $MachinePrecision $MachineType $MaxExtraPrecision $MaxLicenseProcesses $MaxLicenseSubprocesses $MaxMachineNumber $MaxNumber $MaxPiecewiseCases $MaxPrecision $MaxRootDegree $MessageGroups $MessageList $MessagePrePrint $Messages $MinMachineNumber $MinNumber $MinorReleaseNumber $MinPrecision $ModuleNumber $NetworkLicense $NewMessage $NewSymbol $Notebooks $NumberMarks $Off $OperatingSystem $Output $OutputForms $OutputSizeLimit $OutputStreamMethods $Packages $ParentLink $ParentProcessID $PasswordFile $PatchLevelID $Path $PathnameSeparator $PerformanceGoal $PipeSupported $Post $Pre $PreferencesDirectory $PrePrint $PreRead $PrintForms $PrintLiteral $ProcessID $ProcessorCount $ProcessorType $ProductInformation $ProgramName $RandomState $RecursionLimit $ReleaseNumber $RootDirectory $ScheduledTask $ScriptCommandLine $SessionID $SetParentLink $SharedFunctions $SharedVariables $SoundDisplay $SoundDisplayFunction $SuppressInputFormHeads $SynchronousEvaluation $SyntaxHandler $System $SystemCharacterEncoding $SystemID $SystemWordLength $TemporaryDirectory $TemporaryPrefix $TextStyle $TimedOut $TimeUnit $TimeZone $TopDirectory $TraceOff $TraceOn $TracePattern $TracePostAction $TracePreAction $Urgent $UserAddOnsDirectory $UserBaseDirectory $UserDocumentsDirectory $UserName $Version $VersionNumber",
    +c:[{cN:"comment",b:/\(\*/,e:/\*\)/},e.ASM,e.QSM,e.CNM,{b:/\{/,e:/\}/,i:/:/}]}});hljs.registerLanguage("roboconf",function(a){var e="[a-zA-Z-_][^\\n{]+\\{",n={cN:"attribute",b:/[a-zA-Z-_]+/,e:/\s*:/,eE:!0,starts:{e:";",r:0,c:[{cN:"variable",b:/\.[a-zA-Z-_]+/},{cN:"keyword",b:/\(optional\)/}]}};return{aliases:["graph","instances"],cI:!0,k:"import",c:[{b:"^facet "+e,e:"}",k:"facet",c:[n,a.HCM]},{b:"^\\s*instance of "+e,e:"}",k:"name count channels instance-data instance-state instance of",i:/\S/,c:["self",n,a.HCM]},{b:"^"+e,e:"}",c:[n,a.HCM]},a.HCM]}});hljs.registerLanguage("vim",function(e){return{l:/[!#@\w]+/,k:{keyword:"N|0 P|0 X|0 a|0 ab abc abo al am an|0 ar arga argd arge argdo argg argl argu as au aug aun b|0 bN ba bad bd be bel bf bl bm bn bo bp br brea breaka breakd breakl bro bufdo buffers bun bw c|0 cN cNf ca cabc caddb cad caddf cal cat cb cc ccl cd ce cex cf cfir cgetb cgete cg changes chd che checkt cl cla clo cm cmapc cme cn cnew cnf cno cnorea cnoreme co col colo com comc comp con conf cope cp cpf cq cr cs cst cu cuna cunme cw delm deb debugg delc delf dif diffg diffo diffp diffpu diffs diffthis dig di dl dell dj dli do doautoa dp dr ds dsp e|0 ea ec echoe echoh echom echon el elsei em en endfo endf endt endw ene ex exe exi exu f|0 files filet fin fina fini fir fix fo foldc foldd folddoc foldo for fu go gr grepa gu gv ha helpf helpg helpt hi hid his ia iabc if ij il im imapc ime ino inorea inoreme int is isp iu iuna iunme j|0 ju k|0 keepa kee keepj lN lNf l|0 lad laddb laddf la lan lat lb lc lch lcl lcs le lefta let lex lf lfir lgetb lgete lg lgr lgrepa lh ll lla lli lmak lm lmapc lne lnew lnf ln loadk lo loc lockv lol lope lp lpf lr ls lt lu lua luad luaf lv lvimgrepa lw m|0 ma mak map mapc marks mat me menut mes mk mks mksp mkv mkvie mod mz mzf nbc nb nbs new nm nmapc nme nn nnoreme noa no noh norea noreme norm nu nun nunme ol o|0 om omapc ome on ono onoreme opt ou ounme ow p|0 profd prof pro promptr pc ped pe perld po popu pp pre prev ps pt ptN ptf ptj ptl ptn ptp ptr pts pu pw py3 python3 py3d py3f py pyd pyf quita qa rec red redi redr redraws reg res ret retu rew ri rightb rub rubyd rubyf rund ru rv sN san sa sal sav sb sbN sba sbf sbl sbm sbn sbp sbr scrip scripte scs se setf setg setl sf sfir sh sim sig sil sl sla sm smap smapc sme sn sni sno snor snoreme sor so spelld spe spelli spellr spellu spellw sp spr sre st sta startg startr star stopi stj sts sun sunm sunme sus sv sw sy synti sync tN tabN tabc tabdo tabe tabf tabfir tabl tabm tabnew tabn tabo tabp tabr tabs tab ta tags tc tcld tclf te tf th tj tl tm tn to tp tr try ts tu u|0 undoj undol una unh unl unlo unm unme uns up ve verb vert vim vimgrepa vi viu vie vm vmapc vme vne vn vnoreme vs vu vunme windo w|0 wN wa wh wi winc winp wn wp wq wqa ws wu wv x|0 xa xmapc xm xme xn xnoreme xu xunme y|0 z|0 ~ Next Print append abbreviate abclear aboveleft all amenu anoremenu args argadd argdelete argedit argglobal arglocal argument ascii autocmd augroup aunmenu buffer bNext ball badd bdelete behave belowright bfirst blast bmodified bnext botright bprevious brewind break breakadd breakdel breaklist browse bunload bwipeout change cNext cNfile cabbrev cabclear caddbuffer caddexpr caddfile call catch cbuffer cclose center cexpr cfile cfirst cgetbuffer cgetexpr cgetfile chdir checkpath checktime clist clast close cmap cmapclear cmenu cnext cnewer cnfile cnoremap cnoreabbrev cnoremenu copy colder colorscheme command comclear compiler continue confirm copen cprevious cpfile cquit crewind cscope cstag cunmap cunabbrev cunmenu cwindow delete delmarks debug debuggreedy delcommand delfunction diffupdate diffget diffoff diffpatch diffput diffsplit digraphs display deletel djump dlist doautocmd doautoall deletep drop dsearch dsplit edit earlier echo echoerr echohl echomsg else elseif emenu endif endfor endfunction endtry endwhile enew execute exit exusage file filetype find finally finish first fixdel fold foldclose folddoopen folddoclosed foldopen function global goto grep grepadd gui gvim hardcopy help helpfind helpgrep helptags highlight hide history insert iabbrev iabclear ijump ilist imap imapclear imenu inoremap inoreabbrev inoremenu intro isearch isplit iunmap iunabbrev iunmenu join jumps keepalt keepmarks keepjumps lNext lNfile list laddexpr laddbuffer laddfile last language later lbuffer lcd lchdir lclose lcscope left leftabove lexpr lfile lfirst lgetbuffer lgetexpr lgetfile lgrep lgrepadd lhelpgrep llast llist lmake lmap lmapclear lnext lnewer lnfile lnoremap loadkeymap loadview lockmarks lockvar lolder lopen lprevious lpfile lrewind ltag lunmap luado luafile lvimgrep lvimgrepadd lwindow move mark make mapclear match menu menutranslate messages mkexrc mksession mkspell mkvimrc mkview mode mzscheme mzfile nbclose nbkey nbsart next nmap nmapclear nmenu nnoremap nnoremenu noautocmd noremap nohlsearch noreabbrev noremenu normal number nunmap nunmenu oldfiles open omap omapclear omenu only onoremap onoremenu options ounmap ounmenu ownsyntax print profdel profile promptfind promptrepl pclose pedit perl perldo pop popup ppop preserve previous psearch ptag ptNext ptfirst ptjump ptlast ptnext ptprevious ptrewind ptselect put pwd py3do py3file python pydo pyfile quit quitall qall read recover redo redir redraw redrawstatus registers resize retab return rewind right rightbelow ruby rubydo rubyfile rundo runtime rviminfo substitute sNext sandbox sargument sall saveas sbuffer sbNext sball sbfirst sblast sbmodified sbnext sbprevious sbrewind scriptnames scriptencoding scscope set setfiletype setglobal setlocal sfind sfirst shell simalt sign silent sleep slast smagic smapclear smenu snext sniff snomagic snoremap snoremenu sort source spelldump spellgood spellinfo spellrepall spellundo spellwrong split sprevious srewind stop stag startgreplace startreplace startinsert stopinsert stjump stselect sunhide sunmap sunmenu suspend sview swapname syntax syntime syncbind tNext tabNext tabclose tabedit tabfind tabfirst tablast tabmove tabnext tabonly tabprevious tabrewind tag tcl tcldo tclfile tearoff tfirst throw tjump tlast tmenu tnext topleft tprevious trewind tselect tunmenu undo undojoin undolist unabbreviate unhide unlet unlockvar unmap unmenu unsilent update vglobal version verbose vertical vimgrep vimgrepadd visual viusage view vmap vmapclear vmenu vnew vnoremap vnoremenu vsplit vunmap vunmenu write wNext wall while winsize wincmd winpos wnext wprevious wqall wsverb wundo wviminfo xit xall xmapclear xmap xmenu xnoremap xnoremenu xunmap xunmenu yank",built_in:"synIDtrans atan2 range matcharg did_filetype asin feedkeys xor argv complete_check add getwinposx getqflist getwinposy screencol clearmatches empty extend getcmdpos mzeval garbagecollect setreg ceil sqrt diff_hlID inputsecret get getfperm getpid filewritable shiftwidth max sinh isdirectory synID system inputrestore winline atan visualmode inputlist tabpagewinnr round getregtype mapcheck hasmapto histdel argidx findfile sha256 exists toupper getcmdline taglist string getmatches bufnr strftime winwidth bufexists strtrans tabpagebuflist setcmdpos remote_read printf setloclist getpos getline bufwinnr float2nr len getcmdtype diff_filler luaeval resolve libcallnr foldclosedend reverse filter has_key bufname str2float strlen setline getcharmod setbufvar index searchpos shellescape undofile foldclosed setqflist buflisted strchars str2nr virtcol floor remove undotree remote_expr winheight gettabwinvar reltime cursor tabpagenr finddir localtime acos getloclist search tanh matchend rename gettabvar strdisplaywidth type abs py3eval setwinvar tolower wildmenumode log10 spellsuggest bufloaded synconcealed nextnonblank server2client complete settabwinvar executable input wincol setmatches getftype hlID inputsave searchpair or screenrow line settabvar histadd deepcopy strpart remote_peek and eval getftime submatch screenchar winsaveview matchadd mkdir screenattr getfontname libcall reltimestr getfsize winnr invert pow getbufline byte2line soundfold repeat fnameescape tagfiles sin strwidth spellbadword trunc maparg log lispindent hostname setpos globpath remote_foreground getchar synIDattr fnamemodify cscope_connection stridx winbufnr indent min complete_add nr2char searchpairpos inputdialog values matchlist items hlexists strridx browsedir expand fmod pathshorten line2byte argc count getwinvar glob foldtextresult getreg foreground cosh matchdelete has char2nr simplify histget searchdecl iconv winrestcmd pumvisible writefile foldlevel haslocaldir keys cos matchstr foldtext histnr tan tempname getcwd byteidx getbufvar islocked escape eventhandler remote_send serverlist winrestview synstack pyeval prevnonblank readfile cindent filereadable changenr exp"},i:/;/,c:[e.NM,e.ASM,{cN:"string",b:/"(\\"|\n\\|[^"\n])*"/},e.C('"',"$"),{cN:"variable",b:/[bwtglsav]:[\w\d_]*/},{cN:"function",bK:"function function!",e:"$",r:0,c:[e.TM,{cN:"params",b:"\\(",e:"\\)"}]},{cN:"symbol",b:/<[\w-]+>/}]}});hljs.registerLanguage("d",function(e){var t={keyword:"abstract alias align asm assert auto body break byte case cast catch class const continue debug default delete deprecated do else enum export extern final finally for foreach foreach_reverse|10 goto if immutable import in inout int interface invariant is lazy macro mixin module new nothrow out override package pragma private protected public pure ref return scope shared static struct super switch synchronized template this throw try typedef typeid typeof union unittest version void volatile while with __FILE__ __LINE__ __gshared|10 __thread __traits __DATE__ __EOF__ __TIME__ __TIMESTAMP__ __VENDOR__ __VERSION__",built_in:"bool cdouble cent cfloat char creal dchar delegate double dstring float function idouble ifloat ireal long real short string ubyte ucent uint ulong ushort wchar wstring",literal:"false null true"},r="(0|[1-9][\\d_]*)",a="(0|[1-9][\\d_]*|\\d[\\d_]*|[\\d_]+?\\d)",i="0[bB][01_]+",n="([\\da-fA-F][\\da-fA-F_]*|_[\\da-fA-F][\\da-fA-F_]*)",_="0[xX]"+n,c="([eE][+-]?"+a+")",d="("+a+"(\\.\\d*|"+c+")|\\d+\\."+a+a+"|\\."+r+c+"?)",o="(0[xX]("+n+"\\."+n+"|\\.?"+n+")[pP][+-]?"+a+")",s="("+r+"|"+i+"|"+_+")",l="("+o+"|"+d+")",u="\\\\(['\"\\?\\\\abfnrtv]|u[\\dA-Fa-f]{4}|[0-7]{1,3}|x[\\dA-Fa-f]{2}|U[\\dA-Fa-f]{8})|&[a-zA-Z\\d]{2,};",b={cN:"number",b:"\\b"+s+"(L|u|U|Lu|LU|uL|UL)?",r:0},f={cN:"number",b:"\\b("+l+"([fF]|L|i|[fF]i|Li)?|"+s+"(i|[fF]i|Li))",r:0},g={cN:"string",b:"'("+u+"|.)",e:"'",i:"."},h={b:u,r:0},p={cN:"string",b:'"',c:[h],e:'"[cwd]?'},m={cN:"string",b:'[rq]"',e:'"[cwd]?',r:5},w={cN:"string",b:"`",e:"`[cwd]?"},N={cN:"string",b:'x"[\\da-fA-F\\s\\n\\r]*"[cwd]?',r:10},A={cN:"string",b:'q"\\{',e:'\\}"'},F={cN:"meta",b:"^#!",e:"$",r:5},y={cN:"meta",b:"#(line)",e:"$",r:5},L={cN:"keyword",b:"@[a-zA-Z_][a-zA-Z_\\d]*"},v=e.C("\\/\\+","\\+\\/",{c:["self"],r:10});return{l:e.UIR,k:t,c:[e.CLCM,e.CBCM,v,N,p,m,w,A,f,b,g,F,y,L]}});hljs.registerLanguage("scilab",function(e){var s=[e.CNM,{cN:"string",b:"'|\"",e:"'|\"",c:[e.BE,{b:"''"}]}];return{aliases:["sci"],l:/%?\w+/,k:{keyword:"abort break case clear catch continue do elseif else endfunction end for function global if pause return resume select try then while",literal:"%f %F %t %T %pi %eps %inf %nan %e %i %z %s",built_in:"abs and acos asin atan ceil cd chdir clearglobal cosh cos cumprod deff disp error exec execstr exists exp eye gettext floor fprintf fread fsolve imag isdef isempty isinfisnan isvector lasterror length load linspace list listfiles log10 log2 log max min msprintf mclose mopen ones or pathconvert poly printf prod pwd rand real round sinh sin size gsort sprintf sqrt strcat strcmps tring sum system tanh tan type typename warning zeros matrix"},i:'("|#|/\\*|\\s+/\\w+)',c:[{cN:"function",bK:"function",e:"$",c:[e.UTM,{cN:"params",b:"\\(",e:"\\)"}]},{b:"[a-zA-Z_][a-zA-Z_0-9]*('+[\\.']*|[\\.']+)",e:"",r:0},{b:"\\[",e:"\\]'*[\\.']*",r:0,c:s},e.C("//","$")].concat(s)}});hljs.registerLanguage("lisp",function(b){var e="[a-zA-Z_\\-\\+\\*\\/\\<\\=\\>\\&\\#][a-zA-Z0-9_\\-\\+\\*\\/\\<\\=\\>\\&\\#!]*",c="\\|[^]*?\\|",r="(\\-|\\+)?\\d+(\\.\\d+|\\/\\d+)?((d|e|f|l|s|D|E|F|L|S)(\\+|\\-)?\\d+)?",a={cN:"meta",b:"^#!",e:"$"},l={cN:"literal",b:"\\b(t{1}|nil)\\b"},n={cN:"number",v:[{b:r,r:0},{b:"#(b|B)[0-1]+(/[0-1]+)?"},{b:"#(o|O)[0-7]+(/[0-7]+)?"},{b:"#(x|X)[0-9a-fA-F]+(/[0-9a-fA-F]+)?"},{b:"#(c|C)\\("+r+" +"+r,e:"\\)"}]},i=b.inherit(b.QSM,{i:null}),t=b.C(";","$",{r:0}),s={b:"\\*",e:"\\*"},u={cN:"symbol",b:"[:&]"+e},d={b:e,r:0},f={b:c},m={b:"\\(",e:"\\)",c:["self",l,i,n,d]},o={c:[n,i,s,u,m,d],v:[{b:"['`]\\(",e:"\\)"},{b:"\\(quote ",e:"\\)",k:{name:"quote"}},{b:"'"+c}]},v={v:[{b:"'"+e},{b:"#'"+e+"(::"+e+")*"}]},N={b:"\\(\\s*",e:"\\)"},A={eW:!0,r:0};return N.c=[{cN:"name",v:[{b:e},{b:c}]},A],A.c=[o,v,N,l,n,i,t,s,u,f,d],{i:/\S/,c:[n,a,l,i,t,o,v,N,d]}});hljs.registerLanguage("xquery",function(e){var t="for let if while then else return where group by xquery encoding versionmodule namespace boundary-space preserve strip default collation base-uri orderingcopy-namespaces order declare import schema namespace function option in allowing emptyat tumbling window sliding window start when only end when previous next stable ascendingdescending empty greatest least some every satisfies switch case typeswitch try catch andor to union intersect instance of treat as castable cast map array delete insert intoreplace value rename copy modify update",a="false true xs:string xs:integer element item xs:date xs:datetime xs:float xs:double xs:decimal QName xs:anyURI xs:long xs:int xs:short xs:byte attribute",s={b:/\$[a-zA-Z0-9\-]+/},n={cN:"number",b:"(\\b0[0-7_]+)|(\\b0x[0-9a-fA-F_]+)|(\\b[1-9][0-9_]*(\\.[0-9_]+)?)|[0_]\\b",r:0},r={cN:"string",v:[{b:/"/,e:/"/,c:[{b:/""/,r:0}]},{b:/'/,e:/'/,c:[{b:/''/,r:0}]}]},i={cN:"meta",b:"%\\w+"},c={cN:"comment",b:"\\(:",e:":\\)",r:10,c:[{cN:"doctag",b:"@\\w+"}]},o={b:"{",e:"}"},l=[s,r,n,c,i,o];return o.c=l,{aliases:["xpath","xq"],cI:!1,l:/[a-zA-Z\$][a-zA-Z0-9_:\-]*/,i:/(proc)|(abstract)|(extends)|(until)|(#)/,k:{keyword:t,literal:a},c:l}});hljs.registerLanguage("csp",function(r){return{cI:!1,l:"[a-zA-Z][a-zA-Z0-9_-]*",k:{keyword:"base-uri child-src connect-src default-src font-src form-action frame-ancestors frame-src img-src media-src object-src plugin-types report-uri sandbox script-src style-src"},c:[{cN:"string",b:"'",e:"'"},{cN:"attribute",b:"^Content",e:":",eE:!0}]}});hljs.registerLanguage("twig",function(e){var t={cN:"params",b:"\\(",e:"\\)"},a="attribute block constant cycle date dump include max min parent random range source template_from_string",r={bK:a,k:{name:a},r:0,c:[t]},c={b:/\|[A-Za-z_]+:?/,k:"abs batch capitalize convert_encoding date date_modify default escape first format join json_encode keys last length lower merge nl2br number_format raw replace reverse round slice sort split striptags title trim upper url_encode",c:[r]},s="autoescape block do embed extends filter flush for if import include macro sandbox set spaceless use verbatim";return s=s+" "+s.split(" ").map(function(e){return"end"+e}).join(" "),{aliases:["craftcms"],cI:!0,sL:"xml",c:[e.C(/\{#/,/#}/),{cN:"template-tag",b:/\{%/,e:/%}/,c:[{cN:"name",b:/\w+/,k:s,starts:{eW:!0,c:[c,r],r:0}}]},{cN:"template-variable",b:/\{\{/,e:/}}/,c:["self",c,r]}]}});hljs.registerLanguage("accesslog",function(T){return{c:[{cN:"number",b:"\\b\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}(:\\d{1,5})?\\b"},{cN:"number",b:"\\b\\d+\\b",r:0},{cN:"string",b:'"(GET|POST|HEAD|PUT|DELETE|CONNECT|OPTIONS|PATCH|TRACE)',e:'"',k:"GET POST HEAD PUT DELETE CONNECT OPTIONS PATCH TRACE",i:"\\n",r:10},{cN:"string",b:/\[/,e:/\]/,i:"\\n"},{cN:"string",b:'"',e:'"',i:"\\n"}]}});hljs.registerLanguage("smali",function(t){var s=["add","and","cmp","cmpg","cmpl","const","div","double","float","goto","if","int","long","move","mul","neg","new","nop","not","or","rem","return","shl","shr","sput","sub","throw","ushr","xor"],e=["aget","aput","array","check","execute","fill","filled","goto/16","goto/32","iget","instance","invoke","iput","monitor","packed","sget","sparse"],r=["transient","constructor","abstract","final","synthetic","public","private","protected","static","bridge","system"];return{aliases:["smali"],c:[{cN:"string",b:'"',e:'"',r:0},t.C("#","$",{r:0}),{cN:"keyword",v:[{b:"\\s*\\.end\\s[a-zA-Z0-9]*"},{b:"^[ ]*\\.[a-zA-Z]*",r:0},{b:"\\s:[a-zA-Z_0-9]*",r:0},{b:"\\s("+r.join("|")+")"}]},{cN:"built_in",v:[{b:"\\s("+s.join("|")+")\\s"},{b:"\\s("+s.join("|")+")((\\-|/)[a-zA-Z0-9]+)+\\s",r:10},{b:"\\s("+e.join("|")+")((\\-|/)[a-zA-Z0-9]+)*\\s",r:10}]},{cN:"class",b:"L[^(;:\n]*;",r:0},{b:"[vp][0-9]+"}]}});hljs.registerLanguage("rsl",function(e){return{k:{keyword:"float color point normal vector matrix while for if do return else break extern continue",built_in:"abs acos ambient area asin atan atmosphere attribute calculatenormal ceil cellnoise clamp comp concat cos degrees depth Deriv diffuse distance Du Dv environment exp faceforward filterstep floor format fresnel incident length lightsource log match max min mod noise normalize ntransform opposite option phong pnoise pow printf ptlined radians random reflect refract renderinfo round setcomp setxcomp setycomp setzcomp shadow sign sin smoothstep specular specularbrdf spline sqrt step tan texture textureinfo trace transform vtransform xcomp ycomp zcomp"},i:"\\<:\-,()$\[\]_.{}!+%^]+)+/,r:0}]};return{aliases:["gms"],cI:!0,k:a,c:[e.C(/^\$ontext/,/^\$offtext/),{cN:"meta",b:"^\\$[a-z0-9]+",e:"$",rB:!0,c:[{cN:"meta-keyword",b:"^\\$[a-z0-9]+"}]},e.C("^\\*","$"),e.CLCM,e.CBCM,e.QSM,e.ASM,{bK:"set sets parameter parameters variable variables scalar scalars equation equations",e:";",c:[e.C("^\\*","$"),e.CLCM,e.CBCM,e.QSM,e.ASM,i,l]},{bK:"table",e:";",rB:!0,c:[{bK:"table",e:"$",c:[l]},e.C("^\\*","$"),e.CLCM,e.CBCM,e.QSM,e.ASM,e.CNM]},{cN:"function",b:/^[a-z][a-z0-9_,\-+' ()$]+\.{2}/,rB:!0,c:[{cN:"title",b:/^[a-z][a-z0-9_]+/},o,r]},e.CNM,r]}});hljs.registerLanguage("http",function(e){var t="HTTP/[0-9\\.]+";return{aliases:["https"],i:"\\S",c:[{b:"^"+t,e:"$",c:[{cN:"number",b:"\\b\\d{3}\\b"}]},{b:"^[A-Z]+ (.*?) "+t+"$",rB:!0,e:"$",c:[{cN:"string",b:" ",e:" ",eB:!0,eE:!0},{b:t},{cN:"keyword",b:"[A-Z]+"}]},{cN:"attribute",b:"^\\w",e:": ",eE:!0,i:"\\n|\\s|=",starts:{e:"$",r:0}},{b:"\\n\\n",starts:{sL:[],eW:!0}}]}});hljs.registerLanguage("thrift",function(e){var t="bool byte i16 i32 i64 double string binary";return{k:{keyword:"namespace const typedef struct enum service exception void oneway set list map required optional",built_in:t,literal:"true false"},c:[e.QSM,e.NM,e.CLCM,e.CBCM,{cN:"class",bK:"struct enum service exception",e:/\{/,i:/\n/,c:[e.inherit(e.TM,{starts:{eW:!0,eE:!0}})]},{b:"\\b(set|list|map)\\s*<",e:">",k:t,c:["self"]}]}});hljs.registerLanguage("gradle",function(e){return{cI:!0,k:{keyword:"task project allprojects subprojects artifacts buildscript configurations dependencies repositories sourceSets description delete from into include exclude source classpath destinationDir includes options sourceCompatibility targetCompatibility group flatDir doLast doFirst flatten todir fromdir ant def abstract break case catch continue default do else extends final finally for if implements instanceof native new private protected public return static switch synchronized throw throws transient try volatile while strictfp package import false null super this true antlrtask checkstyle codenarc copy boolean byte char class double float int interface long short void compile runTime file fileTree abs any append asList asWritable call collect compareTo count div dump each eachByte eachFile eachLine every find findAll flatten getAt getErr getIn getOut getText grep immutable inject inspect intersect invokeMethods isCase join leftShift minus multiply newInputStream newOutputStream newPrintWriter newReader newWriter next plus pop power previous print println push putAt read readBytes readLines reverse reverseEach round size sort splitEachLine step subMap times toInteger toList tokenize upto waitForOrKill withPrintWriter withReader withStream withWriter withWriterAppend write writeLine"},c:[e.CLCM,e.CBCM,e.ASM,e.QSM,e.NM,e.RM]}});hljs.registerLanguage("cmake",function(e){return{aliases:["cmake.in"],cI:!0,k:{keyword:"add_custom_command add_custom_target add_definitions add_dependencies add_executable add_library add_subdirectory add_test aux_source_directory break build_command cmake_minimum_required cmake_policy configure_file create_test_sourcelist define_property else elseif enable_language enable_testing endforeach endfunction endif endmacro endwhile execute_process export find_file find_library find_package find_path find_program fltk_wrap_ui foreach function get_cmake_property get_directory_property get_filename_component get_property get_source_file_property get_target_property get_test_property if include include_directories include_external_msproject include_regular_expression install link_directories load_cache load_command macro mark_as_advanced message option output_required_files project qt_wrap_cpp qt_wrap_ui remove_definitions return separate_arguments set set_directory_properties set_property set_source_files_properties set_target_properties set_tests_properties site_name source_group string target_link_libraries try_compile try_run unset variable_watch while build_name exec_program export_library_dependencies install_files install_programs install_targets link_libraries make_directory remove subdir_depends subdirs use_mangled_mesa utility_source variable_requires write_file qt5_use_modules qt5_use_package qt5_wrap_cpp on off true false and or equal less greater strless strgreater strequal matches"},c:[{cN:"variable",b:"\\${",e:"}"},e.HCM,e.QSM,e.NM]}});hljs.registerLanguage("inform7",function(e){var r="\\[",o="\\]";return{aliases:["i7"],cI:!0,k:{keyword:"thing room person man woman animal container supporter backdrop door scenery open closed locked inside gender is are say understand kind of rule"},c:[{cN:"string",b:'"',e:'"',r:0,c:[{cN:"subst",b:r,e:o}]},{cN:"section",b:/^(Volume|Book|Part|Chapter|Section|Table)\b/,e:"$"},{b:/^(Check|Carry out|Report|Instead of|To|Rule|When|Before|After)\b/,e:":",c:[{b:"\\(This",e:"\\)"}]},{cN:"comment",b:r,e:o,c:["self"]}]}});hljs.registerLanguage("cs",function(e){var i={keyword:"abstract as base bool break byte case catch char checked const continue decimal default delegate do double else enum event explicit extern finally fixed float for foreach goto if implicit in int interface internal is lock long object operator out override params private protected public readonly ref sbyte sealed short sizeof stackalloc static string struct switch this try typeof uint ulong unchecked unsafe ushort using virtual void volatile while nameof add alias ascending async await by descending dynamic equals from get global group into join let on orderby partial remove select set value var where yield",literal:"null false true"},r={cN:"string",b:'@"',e:'"',c:[{b:'""'}]},t=e.inherit(r,{i:/\n/}),a={cN:"subst",b:"{",e:"}",k:i},n=e.inherit(a,{i:/\n/}),c={cN:"string",b:/\$"/,e:'"',i:/\n/,c:[{b:"{{"},{b:"}}"},e.BE,n]},s={cN:"string",b:/\$@"/,e:'"',c:[{b:"{{"},{b:"}}"},{b:'""'},a]},o=e.inherit(s,{i:/\n/,c:[{b:"{{"},{b:"}}"},{b:'""'},n]});a.c=[s,c,r,e.ASM,e.QSM,e.CNM,e.CBCM],n.c=[o,c,t,e.ASM,e.QSM,e.CNM,e.inherit(e.CBCM,{i:/\n/})];var l={v:[s,c,r,e.ASM,e.QSM]},b=e.IR+"(<"+e.IR+"(\\s*,\\s*"+e.IR+")*>)?(\\[\\])?";return{aliases:["csharp"],k:i,i:/::/,c:[e.C("///","$",{rB:!0,c:[{cN:"doctag",v:[{b:"///",r:0},{b:""},{b:""}]}]}),e.CLCM,e.CBCM,{cN:"meta",b:"#",e:"$",k:{"meta-keyword":"if else elif endif define undef warning error line region endregion pragma checksum"}},l,e.CNM,{bK:"class interface",e:/[{;=]/,i:/[^\s:]/,c:[e.TM,e.CLCM,e.CBCM]},{bK:"namespace",e:/[{;=]/,i:/[^\s:]/,c:[e.inherit(e.TM,{b:"[a-zA-Z](\\.?\\w)*"}),e.CLCM,e.CBCM]},{bK:"new return throw await",r:0},{cN:"function",b:"("+b+"\\s+)+"+e.IR+"\\s*\\(",rB:!0,e:/[{;=]/,eE:!0,k:i,c:[{b:e.IR+"\\s*\\(",rB:!0,c:[e.TM],r:0},{cN:"params",b:/\(/,e:/\)/,eB:!0,eE:!0,k:i,r:0,c:[l,e.CNM,e.CBCM]},e.CLCM,e.CBCM]}]}});hljs.registerLanguage("clojure-repl",function(e){return{c:[{cN:"meta",b:/^([\w.-]+|\s*#_)=>/,starts:{e:/$/,sL:"clojure"}}]}});hljs.registerLanguage("zephir",function(e){var i={cN:"string",c:[e.BE],v:[{b:'b"',e:'"'},{b:"b'",e:"'"},e.inherit(e.ASM,{i:null}),e.inherit(e.QSM,{i:null})]},n={v:[e.BNM,e.CNM]};return{aliases:["zep"],cI:!0,k:"and include_once list abstract global private echo interface as static endswitch array null if endwhile or const for endforeach self var let while isset public protected exit foreach throw elseif include __FILE__ empty require_once do xor return parent clone use __CLASS__ __LINE__ else break print eval new catch __METHOD__ case exception default die require __FUNCTION__ enddeclare final try switch continue endfor endif declare unset true false trait goto instanceof insteadof __DIR__ __NAMESPACE__ yield finally int uint long ulong char uchar double float bool boolean stringlikely unlikely",c:[e.CLCM,e.HCM,e.C("/\\*","\\*/",{c:[{cN:"doctag",b:"@[A-Za-z]+"}]}),e.C("__halt_compiler.+?;",!1,{eW:!0,k:"__halt_compiler",l:e.UIR}),{cN:"string",b:"<<<['\"]?\\w+['\"]?$",e:"^\\w+;",c:[e.BE]},{b:/(::|->)+[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/},{cN:"function",bK:"function",e:/[;{]/,eE:!0,i:"\\$|\\[|%",c:[e.UTM,{cN:"params",b:"\\(",e:"\\)",c:["self",e.CBCM,i,n]}]},{cN:"class",bK:"class interface",e:"{",eE:!0,i:/[:\(\$"]/,c:[{bK:"extends implements"},e.UTM]},{bK:"namespace",e:";",i:/[\.']/,c:[e.UTM]},{bK:"use",e:";",c:[e.UTM]},{b:"=>"},i,n]}});hljs.registerLanguage("nsis",function(e){var t={cN:"variable",b:/\$(ADMINTOOLS|APPDATA|CDBURN_AREA|CMDLINE|COMMONFILES32|COMMONFILES64|COMMONFILES|COOKIES|DESKTOP|DOCUMENTS|EXEDIR|EXEFILE|EXEPATH|FAVORITES|FONTS|HISTORY|HWNDPARENT|INSTDIR|INTERNET_CACHE|LANGUAGE|LOCALAPPDATA|MUSIC|NETHOOD|OUTDIR|PICTURES|PLUGINSDIR|PRINTHOOD|PROFILE|PROGRAMFILES32|PROGRAMFILES64|PROGRAMFILES|QUICKLAUNCH|RECENT|RESOURCES_LOCALIZED|RESOURCES|SENDTO|SMPROGRAMS|SMSTARTUP|STARTMENU|SYSDIR|TEMP|TEMPLATES|VIDEOS|WINDIR)/},i={cN:"variable",b:/\$+{[\w\.:-]+}/},n={cN:"variable",b:/\$+\w+/,i:/\(\){}/},r={cN:"variable",b:/\$+\([\w\^\.:-]+\)/},o={cN:"params",b:"(ARCHIVE|FILE_ATTRIBUTE_ARCHIVE|FILE_ATTRIBUTE_NORMAL|FILE_ATTRIBUTE_OFFLINE|FILE_ATTRIBUTE_READONLY|FILE_ATTRIBUTE_SYSTEM|FILE_ATTRIBUTE_TEMPORARY|HKCR|HKCU|HKDD|HKEY_CLASSES_ROOT|HKEY_CURRENT_CONFIG|HKEY_CURRENT_USER|HKEY_DYN_DATA|HKEY_LOCAL_MACHINE|HKEY_PERFORMANCE_DATA|HKEY_USERS|HKLM|HKPD|HKU|IDABORT|IDCANCEL|IDIGNORE|IDNO|IDOK|IDRETRY|IDYES|MB_ABORTRETRYIGNORE|MB_DEFBUTTON1|MB_DEFBUTTON2|MB_DEFBUTTON3|MB_DEFBUTTON4|MB_ICONEXCLAMATION|MB_ICONINFORMATION|MB_ICONQUESTION|MB_ICONSTOP|MB_OK|MB_OKCANCEL|MB_RETRYCANCEL|MB_RIGHT|MB_RTLREADING|MB_SETFOREGROUND|MB_TOPMOST|MB_USERICON|MB_YESNO|NORMAL|OFFLINE|READONLY|SHCTX|SHELL_CONTEXT|SYSTEM|TEMPORARY)"},l={cN:"keyword",b:/\!(addincludedir|addplugindir|appendfile|cd|define|delfile|echo|else|endif|error|execute|finalize|getdllversionsystem|ifdef|ifmacrodef|ifmacrondef|ifndef|if|include|insertmacro|macroend|macro|makensis|packhdr|searchparse|searchreplace|tempfile|undef|verbose|warning)/},s={cN:"subst",b:/\$(\\[nrt]|\$)/},a={cN:"class",b:/\w+\:\:\w+/},S={cN:"string",v:[{b:'"',e:'"'},{b:"'",e:"'"},{b:"`",e:"`"}],i:/\n/,c:[s,t,i,n,r]};return{cI:!1,k:{keyword:"Abort AddBrandingImage AddSize AllowRootDirInstall AllowSkipFiles AutoCloseWindow BGFont BGGradient BrandingText BringToFront Call CallInstDLL Caption ChangeUI CheckBitmap ClearErrors CompletedText ComponentText CopyFiles CRCCheck CreateDirectory CreateFont CreateShortCut Delete DeleteINISec DeleteINIStr DeleteRegKey DeleteRegValue DetailPrint DetailsButtonText DirText DirVar DirVerify EnableWindow EnumRegKey EnumRegValue Exch Exec ExecShell ExecWait ExpandEnvStrings File FileBufSize FileClose FileErrorText FileOpen FileRead FileReadByte FileReadUTF16LE FileReadWord FileSeek FileWrite FileWriteByte FileWriteUTF16LE FileWriteWord FindClose FindFirst FindNext FindWindow FlushINI FunctionEnd GetCurInstType GetCurrentAddress GetDlgItem GetDLLVersion GetDLLVersionLocal GetErrorLevel GetFileTime GetFileTimeLocal GetFullPathName GetFunctionAddress GetInstDirError GetLabelAddress GetTempFileName Goto HideWindow Icon IfAbort IfErrors IfFileExists IfRebootFlag IfSilent InitPluginsDir InstallButtonText InstallColors InstallDir InstallDirRegKey InstProgressFlags InstType InstTypeGetText InstTypeSetText IntCmp IntCmpU IntFmt IntOp IsWindow LangString LicenseBkColor LicenseData LicenseForceSelection LicenseLangString LicenseText LoadLanguageFile LockWindow LogSet LogText ManifestDPIAware ManifestSupportedOS MessageBox MiscButtonText Name Nop OutFile Page PageCallbacks PageExEnd Pop Push Quit ReadEnvStr ReadINIStr ReadRegDWORD ReadRegStr Reboot RegDLL Rename RequestExecutionLevel ReserveFile Return RMDir SearchPath SectionEnd SectionGetFlags SectionGetInstTypes SectionGetSize SectionGetText SectionGroupEnd SectionIn SectionSetFlags SectionSetInstTypes SectionSetSize SectionSetText SendMessage SetAutoClose SetBrandingImage SetCompress SetCompressor SetCompressorDictSize SetCtlColors SetCurInstType SetDatablockOptimize SetDateSave SetDetailsPrint SetDetailsView SetErrorLevel SetErrors SetFileAttributes SetFont SetOutPath SetOverwrite SetRebootFlag SetRegView SetShellVarContext SetSilent ShowInstDetails ShowUninstDetails ShowWindow SilentInstall SilentUnInstall Sleep SpaceTexts StrCmp StrCmpS StrCpy StrLen SubCaption Unicode UninstallButtonText UninstallCaption UninstallIcon UninstallSubCaption UninstallText UninstPage UnRegDLL Var VIAddVersionKey VIFileVersion VIProductVersion WindowIcon WriteINIStr WriteRegBin WriteRegDWORD WriteRegExpandStr WriteRegStr WriteUninstaller XPStyle",literal:"admin all auto both bottom bzip2 colored components current custom directory false force hide highest ifdiff ifnewer instfiles lastused leave left license listonly lzma nevershow none normal notset off on open print right show silent silentlog smooth textonly top true try un.components un.custom un.directory un.instfiles un.license uninstConfirm user Win10 Win7 Win8 WinVista zlib"},c:[e.HCM,e.CBCM,e.C(";","$",{r:0}),{cN:"function",bK:"Function PageEx Section SectionGroup",e:"$"},S,l,i,n,r,o,a,e.NM]}});hljs.registerLanguage("sqf",function(e){var t=e.getLanguage("cpp").exports,a={cN:"variable",b:/\b_+[a-zA-Z_]\w*/},o={cN:"title",b:/[a-zA-Z][a-zA-Z0-9]+_fnc_\w*/},r={cN:"string",v:[{b:'"',e:'"',c:[{b:'""',r:0}]},{b:"'",e:"'",c:[{b:"''",r:0}]}]};return{aliases:["sqf"],cI:!0,k:{keyword:"case catch default do else exit exitWith for forEach from if switch then throw to try waitUntil while with",built_in:"abs accTime acos action actionIDs actionKeys actionKeysImages actionKeysNames actionKeysNamesArray actionName actionParams activateAddons activatedAddons activateKey add3DENConnection add3DENEventHandler add3DENLayer addAction addBackpack addBackpackCargo addBackpackCargoGlobal addBackpackGlobal addCamShake addCuratorAddons addCuratorCameraArea addCuratorEditableObjects addCuratorEditingArea addCuratorPoints addEditorObject addEventHandler addGoggles addGroupIcon addHandgunItem addHeadgear addItem addItemCargo addItemCargoGlobal addItemPool addItemToBackpack addItemToUniform addItemToVest addLiveStats addMagazine addMagazineAmmoCargo addMagazineCargo addMagazineCargoGlobal addMagazineGlobal addMagazinePool addMagazines addMagazineTurret addMenu addMenuItem addMissionEventHandler addMPEventHandler addMusicEventHandler addOwnedMine addPlayerScores addPrimaryWeaponItem addPublicVariableEventHandler addRating addResources addScore addScoreSide addSecondaryWeaponItem addSwitchableUnit addTeamMember addToRemainsCollector addUniform addVehicle addVest addWaypoint addWeapon addWeaponCargo addWeaponCargoGlobal addWeaponGlobal addWeaponItem addWeaponPool addWeaponTurret agent agents AGLToASL aimedAtTarget aimPos airDensityRTD airportSide AISFinishHeal alive all3DENEntities allControls allCurators allCutLayers allDead allDeadMen allDisplays allGroups allMapMarkers allMines allMissionObjects allow3DMode allowCrewInImmobile allowCuratorLogicIgnoreAreas allowDamage allowDammage allowFileOperations allowFleeing allowGetIn allowSprint allPlayers allSites allTurrets allUnits allUnitsUAV allVariables ammo and animate animateDoor animateSource animationNames animationPhase animationSourcePhase animationState append apply armoryPoints arrayIntersect asin ASLToAGL ASLToATL assert assignAsCargo assignAsCargoIndex assignAsCommander assignAsDriver assignAsGunner assignAsTurret assignCurator assignedCargo assignedCommander assignedDriver assignedGunner assignedItems assignedTarget assignedTeam assignedVehicle assignedVehicleRole assignItem assignTeam assignToAirport atan atan2 atg ATLToASL attachedObject attachedObjects attachedTo attachObject attachTo attackEnabled backpack backpackCargo backpackContainer backpackItems backpackMagazines backpackSpaceFor behaviour benchmark binocular blufor boundingBox boundingBoxReal boundingCenter breakOut breakTo briefingName buildingExit buildingPos buttonAction buttonSetAction cadetMode call callExtension camCommand camCommit camCommitPrepared camCommitted camConstuctionSetParams camCreate camDestroy cameraEffect cameraEffectEnableHUD cameraInterest cameraOn cameraView campaignConfigFile camPreload camPreloaded camPrepareBank camPrepareDir camPrepareDive camPrepareFocus camPrepareFov camPrepareFovRange camPreparePos camPrepareRelPos camPrepareTarget camSetBank camSetDir camSetDive camSetFocus camSetFov camSetFovRange camSetPos camSetRelPos camSetTarget camTarget camUseNVG canAdd canAddItemToBackpack canAddItemToUniform canAddItemToVest cancelSimpleTaskDestination canFire canMove canSlingLoad canStand canSuspend canUnloadInCombat canVehicleCargo captive captiveNum cbChecked cbSetChecked ceil channelEnabled cheatsEnabled checkAIFeature checkVisibility civilian className clearAllItemsFromBackpack clearBackpackCargo clearBackpackCargoGlobal clearGroupIcons clearItemCargo clearItemCargoGlobal clearItemPool clearMagazineCargo clearMagazineCargoGlobal clearMagazinePool clearOverlay clearRadio clearWeaponCargo clearWeaponCargoGlobal clearWeaponPool clientOwner closeDialog closeDisplay closeOverlay collapseObjectTree collect3DENHistory combatMode commandArtilleryFire commandChat commander commandFire commandFollow commandFSM commandGetOut commandingMenu commandMove commandRadio commandStop commandSuppressiveFire commandTarget commandWatch comment commitOverlay compile compileFinal completedFSM composeText configClasses configFile configHierarchy configName configNull configProperties configSourceAddonList configSourceMod configSourceModList connectTerminalToUAV controlNull controlsGroupCtrl copyFromClipboard copyToClipboard copyWaypoints cos count countEnemy countFriendly countSide countType countUnknown create3DENComposition create3DENEntity createAgent createCenter createDialog createDiaryLink createDiaryRecord createDiarySubject createDisplay createGearDialog createGroup createGuardedPoint createLocation createMarker createMarkerLocal createMenu createMine createMissionDisplay createMPCampaignDisplay createSimpleObject createSimpleTask createSite createSoundSource createTask createTeam createTrigger createUnit createVehicle createVehicleCrew createVehicleLocal crew ctrlActivate ctrlAddEventHandler ctrlAngle ctrlAutoScrollDelay ctrlAutoScrollRewind ctrlAutoScrollSpeed ctrlChecked ctrlClassName ctrlCommit ctrlCommitted ctrlCreate ctrlDelete ctrlEnable ctrlEnabled ctrlFade ctrlHTMLLoaded ctrlIDC ctrlIDD ctrlMapAnimAdd ctrlMapAnimClear ctrlMapAnimCommit ctrlMapAnimDone ctrlMapCursor ctrlMapMouseOver ctrlMapScale ctrlMapScreenToWorld ctrlMapWorldToScreen ctrlModel ctrlModelDirAndUp ctrlModelScale ctrlParent ctrlParentControlsGroup ctrlPosition ctrlRemoveAllEventHandlers ctrlRemoveEventHandler ctrlScale ctrlSetActiveColor ctrlSetAngle ctrlSetAutoScrollDelay ctrlSetAutoScrollRewind ctrlSetAutoScrollSpeed ctrlSetBackgroundColor ctrlSetChecked ctrlSetEventHandler ctrlSetFade ctrlSetFocus ctrlSetFont ctrlSetFontH1 ctrlSetFontH1B ctrlSetFontH2 ctrlSetFontH2B ctrlSetFontH3 ctrlSetFontH3B ctrlSetFontH4 ctrlSetFontH4B ctrlSetFontH5 ctrlSetFontH5B ctrlSetFontH6 ctrlSetFontH6B ctrlSetFontHeight ctrlSetFontHeightH1 ctrlSetFontHeightH2 ctrlSetFontHeightH3 ctrlSetFontHeightH4 ctrlSetFontHeightH5 ctrlSetFontHeightH6 ctrlSetFontHeightSecondary ctrlSetFontP ctrlSetFontPB ctrlSetFontSecondary ctrlSetForegroundColor ctrlSetModel ctrlSetModelDirAndUp ctrlSetModelScale ctrlSetPosition ctrlSetScale ctrlSetStructuredText ctrlSetText ctrlSetTextColor ctrlSetTooltip ctrlSetTooltipColorBox ctrlSetTooltipColorShade ctrlSetTooltipColorText ctrlShow ctrlShown ctrlText ctrlTextHeight ctrlType ctrlVisible curatorAddons curatorCamera curatorCameraArea curatorCameraAreaCeiling curatorCoef curatorEditableObjects curatorEditingArea curatorEditingAreaType curatorMouseOver curatorPoints curatorRegisteredObjects curatorSelected curatorWaypointCost current3DENOperation currentChannel currentCommand currentMagazine currentMagazineDetail currentMagazineDetailTurret currentMagazineTurret currentMuzzle currentNamespace currentTask currentTasks currentThrowable currentVisionMode currentWaypoint currentWeapon currentWeaponMode currentWeaponTurret currentZeroing cursorObject cursorTarget customChat customRadio cutFadeOut cutObj cutRsc cutText damage date dateToNumber daytime deActivateKey debriefingText debugFSM debugLog deg delete3DENEntities deleteAt deleteCenter deleteCollection deleteEditorObject deleteGroup deleteIdentity deleteLocation deleteMarker deleteMarkerLocal deleteRange deleteResources deleteSite deleteStatus deleteTeam deleteVehicle deleteVehicleCrew deleteWaypoint detach detectedMines diag_activeMissionFSMs diag_activeScripts diag_activeSQFScripts diag_activeSQSScripts diag_captureFrame diag_captureSlowFrame diag_codePerformance diag_drawMode diag_enable diag_enabled diag_fps diag_fpsMin diag_frameNo diag_list diag_log diag_logSlowFrame diag_mergeConfigFile diag_recordTurretLimits diag_tickTime diag_toggle dialog diarySubjectExists didJIP didJIPOwner difficulty difficultyEnabled difficultyEnabledRTD difficultyOption direction directSay disableAI disableCollisionWith disableConversation disableDebriefingStats disableNVGEquipment disableRemoteSensors disableSerialization disableTIEquipment disableUAVConnectability disableUserInput displayAddEventHandler displayCtrl displayNull displayParent displayRemoveAllEventHandlers displayRemoveEventHandler displaySetEventHandler dissolveTeam distance distance2D distanceSqr distributionRegion do3DENAction doArtilleryFire doFire doFollow doFSM doGetOut doMove doorPhase doStop doSuppressiveFire doTarget doWatch drawArrow drawEllipse drawIcon drawIcon3D drawLine drawLine3D drawLink drawLocation drawPolygon drawRectangle driver drop east echo edit3DENMissionAttributes editObject editorSetEventHandler effectiveCommander emptyPositions enableAI enableAIFeature enableAimPrecision enableAttack enableAudioFeature enableCamShake enableCaustics enableChannel enableCollisionWith enableCopilot enableDebriefingStats enableDiagLegend enableEndDialog enableEngineArtillery enableEnvironment enableFatigue enableGunLights enableIRLasers enableMimics enablePersonTurret enableRadio enableReload enableRopeAttach enableSatNormalOnDetail enableSaving enableSentences enableSimulation enableSimulationGlobal enableStamina enableTeamSwitch enableUAVConnectability enableUAVWaypoints enableVehicleCargo endLoadingScreen endMission engineOn enginesIsOnRTD enginesRpmRTD enginesTorqueRTD entities estimatedEndServerTime estimatedTimeLeft evalObjectArgument everyBackpack everyContainer exec execEditorScript execFSM execVM exp expectedDestination exportJIPMessages eyeDirection eyePos face faction fadeMusic fadeRadio fadeSound fadeSpeech failMission fillWeaponsFromPool find findCover findDisplay findEditorObject findEmptyPosition findEmptyPositionReady findNearestEnemy finishMissionInit finite fire fireAtTarget firstBackpack flag flagOwner flagSide flagTexture fleeing floor flyInHeight flyInHeightASL fog fogForecast fogParams forceAddUniform forcedMap forceEnd forceMap forceRespawn forceSpeed forceWalk forceWeaponFire forceWeatherChange forEachMember forEachMemberAgent forEachMemberTeam format formation formationDirection formationLeader formationMembers formationPosition formationTask formatText formLeader freeLook fromEditor fuel fullCrew gearIDCAmmoCount gearSlotAmmoCount gearSlotData get3DENActionState get3DENAttribute get3DENCamera get3DENConnections get3DENEntity get3DENEntityID get3DENGrid get3DENIconsVisible get3DENLayerEntities get3DENLinesVisible get3DENMissionAttribute get3DENMouseOver get3DENSelected getAimingCoef getAllHitPointsDamage getAllOwnedMines getAmmoCargo getAnimAimPrecision getAnimSpeedCoef getArray getArtilleryAmmo getArtilleryComputerSettings getArtilleryETA getAssignedCuratorLogic getAssignedCuratorUnit getBackpackCargo getBleedingRemaining getBurningValue getCameraViewDirection getCargoIndex getCenterOfMass getClientState getClientStateNumber getConnectedUAV getCustomAimingCoef getDammage getDescription getDir getDirVisual getDLCs getEditorCamera getEditorMode getEditorObjectScope getElevationOffset getFatigue getFriend getFSMVariable getFuelCargo getGroupIcon getGroupIconParams getGroupIcons getHideFrom getHit getHitIndex getHitPointDamage getItemCargo getMagazineCargo getMarkerColor getMarkerPos getMarkerSize getMarkerType getMass getMissionConfig getMissionConfigValue getMissionDLCs getMissionLayerEntities getModelInfo getMousePosition getNumber getObjectArgument getObjectChildren getObjectDLC getObjectMaterials getObjectProxy getObjectTextures getObjectType getObjectViewDistance getOxygenRemaining getPersonUsedDLCs getPilotCameraDirection getPilotCameraPosition getPilotCameraRotation getPilotCameraTarget getPlayerChannel getPlayerScores getPlayerUID getPos getPosASL getPosASLVisual getPosASLW getPosATL getPosATLVisual getPosVisual getPosWorld getRelDir getRelPos getRemoteSensorsDisabled getRepairCargo getResolution getShadowDistance getShotParents getSlingLoad getSpeed getStamina getStatValue getSuppression getTerrainHeightASL getText getUnitLoadout getUnitTrait getVariable getVehicleCargo getWeaponCargo getWeaponSway getWPPos glanceAt globalChat globalRadio goggles goto group groupChat groupFromNetId groupIconSelectable groupIconsVisible groupId groupOwner groupRadio groupSelectedUnits groupSelectUnit grpNull gunner gusts halt handgunItems handgunMagazine handgunWeapon handsHit hasInterface hasPilotCamera hasWeapon hcAllGroups hcGroupParams hcLeader hcRemoveAllGroups hcRemoveGroup hcSelected hcSelectGroup hcSetGroup hcShowBar hcShownBar headgear hideBody hideObject hideObjectGlobal hideSelection hint hintC hintCadet hintSilent hmd hostMission htmlLoad HUDMovementLevels humidity image importAllGroups importance in inArea inAreaArray incapacitatedState independent inflame inflamed inGameUISetEventHandler inheritsFrom initAmbientLife inPolygon inputAction inRangeOfArtillery insertEditorObject intersect is3DEN is3DENMultiplayer isAbleToBreathe isAgent isArray isAutoHoverOn isAutonomous isAutotest isBleeding isBurning isClass isCollisionLightOn isCopilotEnabled isDedicated isDLCAvailable isEngineOn isEqualTo isEqualType isEqualTypeAll isEqualTypeAny isEqualTypeArray isEqualTypeParams isFilePatchingEnabled isFlashlightOn isFlatEmpty isForcedWalk isFormationLeader isHidden isInRemainsCollector isInstructorFigureEnabled isIRLaserOn isKeyActive isKindOf isLightOn isLocalized isManualFire isMarkedForCollection isMultiplayer isMultiplayerSolo isNil isNull isNumber isObjectHidden isObjectRTD isOnRoad isPipEnabled isPlayer isRealTime isRemoteExecuted isRemoteExecutedJIP isServer isShowing3DIcons isSprintAllowed isStaminaEnabled isSteamMission isStreamFriendlyUIEnabled isText isTouchingGround isTurnedOut isTutHintsEnabled isUAVConnectable isUAVConnected isUniformAllowed isVehicleCargo isWalking isWeaponDeployed isWeaponRested itemCargo items itemsWithMagazines join joinAs joinAsSilent joinSilent joinString kbAddDatabase kbAddDatabaseTargets kbAddTopic kbHasTopic kbReact kbRemoveTopic kbTell kbWasSaid keyImage keyName knowsAbout land landAt landResult language laserTarget lbAdd lbClear lbColor lbCurSel lbData lbDelete lbIsSelected lbPicture lbSelection lbSetColor lbSetCurSel lbSetData lbSetPicture lbSetPictureColor lbSetPictureColorDisabled lbSetPictureColorSelected lbSetSelectColor lbSetSelectColorRight lbSetSelected lbSetTooltip lbSetValue lbSize lbSort lbSortByValue lbText lbValue leader leaderboardDeInit leaderboardGetRows leaderboardInit leaveVehicle libraryCredits libraryDisclaimers lifeState lightAttachObject lightDetachObject lightIsOn lightnings limitSpeed linearConversion lineBreak lineIntersects lineIntersectsObjs lineIntersectsSurfaces lineIntersectsWith linkItem list listObjects ln lnbAddArray lnbAddColumn lnbAddRow lnbClear lnbColor lnbCurSelRow lnbData lnbDeleteColumn lnbDeleteRow lnbGetColumnsPosition lnbPicture lnbSetColor lnbSetColumnsPos lnbSetCurSelRow lnbSetData lnbSetPicture lnbSetText lnbSetValue lnbSize lnbText lnbValue load loadAbs loadBackpack loadFile loadGame loadIdentity loadMagazine loadOverlay loadStatus loadUniform loadVest local localize locationNull locationPosition lock lockCameraTo lockCargo lockDriver locked lockedCargo lockedDriver lockedTurret lockIdentity lockTurret lockWP log logEntities logNetwork logNetworkTerminate lookAt lookAtPos magazineCargo magazines magazinesAllTurrets magazinesAmmo magazinesAmmoCargo magazinesAmmoFull magazinesDetail magazinesDetailBackpack magazinesDetailUniform magazinesDetailVest magazinesTurret magazineTurretAmmo mapAnimAdd mapAnimClear mapAnimCommit mapAnimDone mapCenterOnCamera mapGridPosition markAsFinishedOnSteam markerAlpha markerBrush markerColor markerDir markerPos markerShape markerSize markerText markerType max members menuAction menuAdd menuChecked menuClear menuCollapse menuData menuDelete menuEnable menuEnabled menuExpand menuHover menuPicture menuSetAction menuSetCheck menuSetData menuSetPicture menuSetValue menuShortcut menuShortcutText menuSize menuSort menuText menuURL menuValue min mineActive mineDetectedBy missionConfigFile missionDifficulty missionName missionNamespace missionStart missionVersion mod modelToWorld modelToWorldVisual modParams moonIntensity moonPhase morale move move3DENCamera moveInAny moveInCargo moveInCommander moveInDriver moveInGunner moveInTurret moveObjectToEnd moveOut moveTime moveTo moveToCompleted moveToFailed musicVolume name nameSound nearEntities nearestBuilding nearestLocation nearestLocations nearestLocationWithDubbing nearestObject nearestObjects nearestTerrainObjects nearObjects nearObjectsReady nearRoads nearSupplies nearTargets needReload netId netObjNull newOverlay nextMenuItemIndex nextWeatherChange nMenuItems not numberToDate objectCurators objectFromNetId objectParent objNull objStatus onBriefingGroup onBriefingNotes onBriefingPlan onBriefingTeamSwitch onCommandModeChanged onDoubleClick onEachFrame onGroupIconClick onGroupIconOverEnter onGroupIconOverLeave onHCGroupSelectionChanged onMapSingleClick onPlayerConnected onPlayerDisconnected onPreloadFinished onPreloadStarted onShowNewObject onTeamSwitch openCuratorInterface openDLCPage openMap openYoutubeVideo opfor or orderGetIn overcast overcastForecast owner param params parseNumber parseText parsingNamespace particlesQuality pi pickWeaponPool pitch pixelGrid pixelGridBase pixelGridNoUIScale pixelH pixelW playableSlotsNumber playableUnits playAction playActionNow player playerRespawnTime playerSide playersNumber playGesture playMission playMove playMoveNow playMusic playScriptedMission playSound playSound3D position positionCameraToWorld posScreenToWorld posWorldToScreen ppEffectAdjust ppEffectCommit ppEffectCommitted ppEffectCreate ppEffectDestroy ppEffectEnable ppEffectEnabled ppEffectForceInNVG precision preloadCamera preloadObject preloadSound preloadTitleObj preloadTitleRsc preprocessFile preprocessFileLineNumbers primaryWeapon primaryWeaponItems primaryWeaponMagazine priority private processDiaryLink productVersion profileName profileNamespace profileNameSteam progressLoadingScreen progressPosition progressSetPosition publicVariable publicVariableClient publicVariableServer pushBack pushBackUnique putWeaponPool queryItemsPool queryMagazinePool queryWeaponPool rad radioChannelAdd radioChannelCreate radioChannelRemove radioChannelSetCallSign radioChannelSetLabel radioVolume rain rainbow random rank rankId rating rectangular registeredTasks registerTask reload reloadEnabled remoteControl remoteExec remoteExecCall remove3DENConnection remove3DENEventHandler remove3DENLayer removeAction removeAll3DENEventHandlers removeAllActions removeAllAssignedItems removeAllContainers removeAllCuratorAddons removeAllCuratorCameraAreas removeAllCuratorEditingAreas removeAllEventHandlers removeAllHandgunItems removeAllItems removeAllItemsWithMagazines removeAllMissionEventHandlers removeAllMPEventHandlers removeAllMusicEventHandlers removeAllOwnedMines removeAllPrimaryWeaponItems removeAllWeapons removeBackpack removeBackpackGlobal removeCuratorAddons removeCuratorCameraArea removeCuratorEditableObjects removeCuratorEditingArea removeDrawIcon removeDrawLinks removeEventHandler removeFromRemainsCollector removeGoggles removeGroupIcon removeHandgunItem removeHeadgear removeItem removeItemFromBackpack removeItemFromUniform removeItemFromVest removeItems removeMagazine removeMagazineGlobal removeMagazines removeMagazinesTurret removeMagazineTurret removeMenuItem removeMissionEventHandler removeMPEventHandler removeMusicEventHandler removeOwnedMine removePrimaryWeaponItem removeSecondaryWeaponItem removeSimpleTask removeSwitchableUnit removeTeamMember removeUniform removeVest removeWeapon removeWeaponGlobal removeWeaponTurret requiredVersion resetCamShake resetSubgroupDirection resistance resize resources respawnVehicle restartEditorCamera reveal revealMine reverse reversedMouseY roadAt roadsConnectedTo roleDescription ropeAttachedObjects ropeAttachedTo ropeAttachEnabled ropeAttachTo ropeCreate ropeCut ropeDestroy ropeDetach ropeEndPosition ropeLength ropes ropeUnwind ropeUnwound rotorsForcesRTD rotorsRpmRTD round runInitScript safeZoneH safeZoneW safeZoneWAbs safeZoneX safeZoneXAbs safeZoneY save3DENInventory saveGame saveIdentity saveJoysticks saveOverlay saveProfileNamespace saveStatus saveVar savingEnabled say say2D say3D scopeName score scoreSide screenshot screenToWorld scriptDone scriptName scriptNull scudState secondaryWeapon secondaryWeaponItems secondaryWeaponMagazine select selectBestPlaces selectDiarySubject selectedEditorObjects selectEditorObject selectionNames selectionPosition selectLeader selectMax selectMin selectNoPlayer selectPlayer selectRandom selectWeapon selectWeaponTurret sendAUMessage sendSimpleCommand sendTask sendTaskResult sendUDPMessage serverCommand serverCommandAvailable serverCommandExecutable serverName serverTime set set3DENAttribute set3DENAttributes set3DENGrid set3DENIconsVisible set3DENLayer set3DENLinesVisible set3DENMissionAttributes set3DENModelsVisible set3DENObjectType set3DENSelected setAccTime setAirportSide setAmmo setAmmoCargo setAnimSpeedCoef setAperture setApertureNew setArmoryPoints setAttributes setAutonomous setBehaviour setBleedingRemaining setCameraInterest setCamShakeDefParams setCamShakeParams setCamUseTi setCaptive setCenterOfMass setCollisionLight setCombatMode setCompassOscillation setCuratorCameraAreaCeiling setCuratorCoef setCuratorEditingAreaType setCuratorWaypointCost setCurrentChannel setCurrentTask setCurrentWaypoint setCustomAimCoef setDamage setDammage setDate setDebriefingText setDefaultCamera setDestination setDetailMapBlendPars setDir setDirection setDrawIcon setDropInterval setEditorMode setEditorObjectScope setEffectCondition setFace setFaceAnimation setFatigue setFlagOwner setFlagSide setFlagTexture setFog setFormation setFormationTask setFormDir setFriend setFromEditor setFSMVariable setFuel setFuelCargo setGroupIcon setGroupIconParams setGroupIconsSelectable setGroupIconsVisible setGroupId setGroupIdGlobal setGroupOwner setGusts setHideBehind setHit setHitIndex setHitPointDamage setHorizonParallaxCoef setHUDMovementLevels setIdentity setImportance setLeader setLightAmbient setLightAttenuation setLightBrightness setLightColor setLightDayLight setLightFlareMaxDistance setLightFlareSize setLightIntensity setLightnings setLightUseFlare setLocalWindParams setMagazineTurretAmmo setMarkerAlpha setMarkerAlphaLocal setMarkerBrush setMarkerBrushLocal setMarkerColor setMarkerColorLocal setMarkerDir setMarkerDirLocal setMarkerPos setMarkerPosLocal setMarkerShape setMarkerShapeLocal setMarkerSize setMarkerSizeLocal setMarkerText setMarkerTextLocal setMarkerType setMarkerTypeLocal setMass setMimic setMousePosition setMusicEffect setMusicEventHandler setName setNameSound setObjectArguments setObjectMaterial setObjectMaterialGlobal setObjectProxy setObjectTexture setObjectTextureGlobal setObjectViewDistance setOvercast setOwner setOxygenRemaining setParticleCircle setParticleClass setParticleFire setParticleParams setParticleRandom setPilotCameraDirection setPilotCameraRotation setPilotCameraTarget setPilotLight setPiPEffect setPitch setPlayable setPlayerRespawnTime setPos setPosASL setPosASL2 setPosASLW setPosATL setPosition setPosWorld setRadioMsg setRain setRainbow setRandomLip setRank setRectangular setRepairCargo setShadowDistance setShotParents setSide setSimpleTaskAlwaysVisible setSimpleTaskCustomData setSimpleTaskDescription setSimpleTaskDestination setSimpleTaskTarget setSimpleTaskType setSimulWeatherLayers setSize setSkill setSlingLoad setSoundEffect setSpeaker setSpeech setSpeedMode setStamina setStaminaScheme setStatValue setSuppression setSystemOfUnits setTargetAge setTaskResult setTaskState setTerrainGrid setText setTimeMultiplier setTitleEffect setTriggerActivation setTriggerArea setTriggerStatements setTriggerText setTriggerTimeout setTriggerType setType setUnconscious setUnitAbility setUnitLoadout setUnitPos setUnitPosWeak setUnitRank setUnitRecoilCoefficient setUnitTrait setUnloadInCombat setUserActionText setVariable setVectorDir setVectorDirAndUp setVectorUp setVehicleAmmo setVehicleAmmoDef setVehicleArmor setVehicleCargo setVehicleId setVehicleLock setVehiclePosition setVehicleTiPars setVehicleVarName setVelocity setVelocityTransformation setViewDistance setVisibleIfTreeCollapsed setWaves setWaypointBehaviour setWaypointCombatMode setWaypointCompletionRadius setWaypointDescription setWaypointForceBehaviour setWaypointFormation setWaypointHousePosition setWaypointLoiterRadius setWaypointLoiterType setWaypointName setWaypointPosition setWaypointScript setWaypointSpeed setWaypointStatements setWaypointTimeout setWaypointType setWaypointVisible setWeaponReloadingTime setWind setWindDir setWindForce setWindStr setWPPos show3DIcons showChat showCinemaBorder showCommandingMenu showCompass showCuratorCompass showGPS showHUD showLegend showMap shownArtilleryComputer shownChat shownCompass shownCuratorCompass showNewEditorObject shownGPS shownHUD shownMap shownPad shownRadio shownScoretable shownUAVFeed shownWarrant shownWatch showPad showRadio showScoretable showSubtitles showUAVFeed showWarrant showWatch showWaypoint showWaypoints side sideAmbientLife sideChat sideEmpty sideEnemy sideFriendly sideLogic sideRadio sideUnknown simpleTasks simulationEnabled simulCloudDensity simulCloudOcclusion simulInClouds simulWeatherSync sin size sizeOf skill skillFinal skipTime sleep sliderPosition sliderRange sliderSetPosition sliderSetRange sliderSetSpeed sliderSpeed slingLoadAssistantShown soldierMagazines someAmmo sort soundVolume spawn speaker speed speedMode splitString sqrt squadParams stance startLoadingScreen step stop stopEngineRTD stopped str sunOrMoon supportInfo suppressFor surfaceIsWater surfaceNormal surfaceType swimInDepth switchableUnits switchAction switchCamera switchGesture switchLight switchMove synchronizedObjects synchronizedTriggers synchronizedWaypoints synchronizeObjectsAdd synchronizeObjectsRemove synchronizeTrigger synchronizeWaypoint systemChat systemOfUnits tan targetKnowledge targetsAggregate targetsQuery taskAlwaysVisible taskChildren taskCompleted taskCustomData taskDescription taskDestination taskHint taskMarkerOffset taskNull taskParent taskResult taskState taskType teamMember teamMemberNull teamName teams teamSwitch teamSwitchEnabled teamType terminate terrainIntersect terrainIntersectASL text textLog textLogFormat tg time timeMultiplier titleCut titleFadeOut titleObj titleRsc titleText toArray toFixed toLower toString toUpper triggerActivated triggerActivation triggerArea triggerAttachedVehicle triggerAttachObject triggerAttachVehicle triggerStatements triggerText triggerTimeout triggerTimeoutCurrent triggerType turretLocal turretOwner turretUnit tvAdd tvClear tvCollapse tvCount tvCurSel tvData tvDelete tvExpand tvPicture tvSetCurSel tvSetData tvSetPicture tvSetPictureColor tvSetPictureColorDisabled tvSetPictureColorSelected tvSetPictureRight tvSetPictureRightColor tvSetPictureRightColorDisabled tvSetPictureRightColorSelected tvSetText tvSetTooltip tvSetValue tvSort tvSortByValue tvText tvTooltip tvValue type typeName typeOf UAVControl uiNamespace uiSleep unassignCurator unassignItem unassignTeam unassignVehicle underwater uniform uniformContainer uniformItems uniformMagazines unitAddons unitAimPosition unitAimPositionVisual unitBackpack unitIsUAV unitPos unitReady unitRecoilCoefficient units unitsBelowHeight unlinkItem unlockAchievement unregisterTask updateDrawIcon updateMenuItem updateObjectTree useAISteeringComponent useAudioTimeForMoves vectorAdd vectorCos vectorCrossProduct vectorDiff vectorDir vectorDirVisual vectorDistance vectorDistanceSqr vectorDotProduct vectorFromTo vectorMagnitude vectorMagnitudeSqr vectorMultiply vectorNormalized vectorUp vectorUpVisual vehicle vehicleCargoEnabled vehicleChat vehicleRadio vehicles vehicleVarName velocity velocityModelSpace verifySignature vest vestContainer vestItems vestMagazines viewDistance visibleCompass visibleGPS visibleMap visiblePosition visiblePositionASL visibleScoretable visibleWatch waves waypointAttachedObject waypointAttachedVehicle waypointAttachObject waypointAttachVehicle waypointBehaviour waypointCombatMode waypointCompletionRadius waypointDescription waypointForceBehaviour waypointFormation waypointHousePosition waypointLoiterRadius waypointLoiterType waypointName waypointPosition waypoints waypointScript waypointsEnabledUAV waypointShow waypointSpeed waypointStatements waypointTimeout waypointTimeoutCurrent waypointType waypointVisible weaponAccessories weaponAccessoriesCargo weaponCargo weaponDirection weaponInertia weaponLowered weapons weaponsItems weaponsItemsCargo weaponState weaponsTurret weightRTD west WFSideText wind",literal:"true false nil"},c:[e.CLCM,e.CBCM,e.NM,a,o,r,t.preprocessor],i:/#/}});hljs.registerLanguage("dsconfig",function(e){var i={cN:"string",b:/"/,e:/"/},r={cN:"string",b:/'/,e:/'/},s={cN:"string",b:"[\\w-?]+:\\w+",e:"\\W",r:0},t={cN:"string",b:"\\w+-?\\w+",e:"\\W",r:0};return{k:"dsconfig",c:[{cN:"keyword",b:"^dsconfig",e:"\\s",eE:!0,r:10},{cN:"built_in",b:"(list|create|get|set|delete)-(\\w+)",e:"\\s",eE:!0,i:"!@#$%^&*()",r:10},{cN:"built_in",b:"--(\\w+)",e:"\\s",eE:!0},i,r,s,t,e.HCM]}});hljs.registerLanguage("apache",function(e){var r={cN:"number",b:"[\\$%]\\d+"};return{aliases:["apacheconf"],cI:!0,c:[e.HCM,{cN:"section",b:""},{cN:"attribute",b:/\w+/,r:0,k:{nomarkup:"order deny allow setenv rewriterule rewriteengine rewritecond documentroot sethandler errordocument loadmodule options header listen serverroot servername"},starts:{e:/$/,r:0,k:{literal:"on off all"},c:[{cN:"meta",b:"\\s\\[",e:"\\]$"},{cN:"variable",b:"[\\$%]\\{",e:"\\}",c:["self",r]},r,e.QSM]}}],i:/\S/}});hljs.registerLanguage("erb",function(e){return{sL:"xml",c:[e.C("<%#","%>"),{b:"<%[%=-]?",e:"[%-]?%>",sL:"ruby",eB:!0,eE:!0}]}});hljs.registerLanguage("gauss",function(e){var t={keyword:"and bool break call callexe checkinterrupt clear clearg closeall cls comlog compile continue create debug declare delete disable dlibrary dllcall do dos ed edit else elseif enable end endfor endif endp endo errorlog errorlogat expr external fn for format goto gosub graph if keyword let lib library line load loadarray loadexe loadf loadk loadm loadp loads loadx local locate loopnextindex lprint lpwidth lshow matrix msym ndpclex new not open or output outwidth plot plotsym pop prcsn print printdos proc push retp return rndcon rndmod rndmult rndseed run save saveall screen scroll setarray show sparse stop string struct system trace trap threadfor threadendfor threadbegin threadjoin threadstat threadend until use while winprint",built_in:"abs acf aconcat aeye amax amean AmericanBinomCall AmericanBinomCall_Greeks AmericanBinomCall_ImpVol AmericanBinomPut AmericanBinomPut_Greeks AmericanBinomPut_ImpVol AmericanBSCall AmericanBSCall_Greeks AmericanBSCall_ImpVol AmericanBSPut AmericanBSPut_Greeks AmericanBSPut_ImpVol amin amult annotationGetDefaults annotationSetBkd annotationSetFont annotationSetLineColor annotationSetLineStyle annotationSetLineThickness annualTradingDays arccos arcsin areshape arrayalloc arrayindex arrayinit arraytomat asciiload asclabel astd astds asum atan atan2 atranspose axmargin balance band bandchol bandcholsol bandltsol bandrv bandsolpd bar base10 begwind besselj bessely beta box boxcox cdfBeta cdfBetaInv cdfBinomial cdfBinomialInv cdfBvn cdfBvn2 cdfBvn2e cdfCauchy cdfCauchyInv cdfChic cdfChii cdfChinc cdfChincInv cdfExp cdfExpInv cdfFc cdfFnc cdfFncInv cdfGam cdfGenPareto cdfHyperGeo cdfLaplace cdfLaplaceInv cdfLogistic cdfLogisticInv cdfmControlCreate cdfMvn cdfMvn2e cdfMvnce cdfMvne cdfMvt2e cdfMvtce cdfMvte cdfN cdfN2 cdfNc cdfNegBinomial cdfNegBinomialInv cdfNi cdfPoisson cdfPoissonInv cdfRayleigh cdfRayleighInv cdfTc cdfTci cdfTnc cdfTvn cdfWeibull cdfWeibullInv cdir ceil ChangeDir chdir chiBarSquare chol choldn cholsol cholup chrs close code cols colsf combinate combinated complex con cond conj cons ConScore contour conv convertsatostr convertstrtosa corrm corrms corrvc corrx corrxs cos cosh counts countwts crossprd crout croutp csrcol csrlin csvReadM csvReadSA cumprodc cumsumc curve cvtos datacreate datacreatecomplex datalist dataload dataloop dataopen datasave date datestr datestring datestrymd dayinyr dayofweek dbAddDatabase dbClose dbCommit dbCreateQuery dbExecQuery dbGetConnectOptions dbGetDatabaseName dbGetDriverName dbGetDrivers dbGetHostName dbGetLastErrorNum dbGetLastErrorText dbGetNumericalPrecPolicy dbGetPassword dbGetPort dbGetTableHeaders dbGetTables dbGetUserName dbHasFeature dbIsDriverAvailable dbIsOpen dbIsOpenError dbOpen dbQueryBindValue dbQueryClear dbQueryCols dbQueryExecPrepared dbQueryFetchAllM dbQueryFetchAllSA dbQueryFetchOneM dbQueryFetchOneSA dbQueryFinish dbQueryGetBoundValue dbQueryGetBoundValues dbQueryGetField dbQueryGetLastErrorNum dbQueryGetLastErrorText dbQueryGetLastInsertID dbQueryGetLastQuery dbQueryGetPosition dbQueryIsActive dbQueryIsForwardOnly dbQueryIsNull dbQueryIsSelect dbQueryIsValid dbQueryPrepare dbQueryRows dbQuerySeek dbQuerySeekFirst dbQuerySeekLast dbQuerySeekNext dbQuerySeekPrevious dbQuerySetForwardOnly dbRemoveDatabase dbRollback dbSetConnectOptions dbSetDatabaseName dbSetHostName dbSetNumericalPrecPolicy dbSetPort dbSetUserName dbTransaction DeleteFile delif delrows denseToSp denseToSpRE denToZero design det detl dfft dffti diag diagrv digamma doswin DOSWinCloseall DOSWinOpen dotfeq dotfeqmt dotfge dotfgemt dotfgt dotfgtmt dotfle dotflemt dotflt dotfltmt dotfne dotfnemt draw drop dsCreate dstat dstatmt dstatmtControlCreate dtdate dtday dttime dttodtv dttostr dttoutc dtvnormal dtvtodt dtvtoutc dummy dummybr dummydn eig eigh eighv eigv elapsedTradingDays endwind envget eof eqSolve eqSolvemt eqSolvemtControlCreate eqSolvemtOutCreate eqSolveset erf erfc erfccplx erfcplx error etdays ethsec etstr EuropeanBinomCall EuropeanBinomCall_Greeks EuropeanBinomCall_ImpVol EuropeanBinomPut EuropeanBinomPut_Greeks EuropeanBinomPut_ImpVol EuropeanBSCall EuropeanBSCall_Greeks EuropeanBSCall_ImpVol EuropeanBSPut EuropeanBSPut_Greeks EuropeanBSPut_ImpVol exctsmpl exec execbg exp extern eye fcheckerr fclearerr feq feqmt fflush fft ffti fftm fftmi fftn fge fgemt fgets fgetsa fgetsat fgetst fgt fgtmt fileinfo filesa fle flemt floor flt fltmt fmod fne fnemt fonts fopen formatcv formatnv fputs fputst fseek fstrerror ftell ftocv ftos ftostrC gamma gammacplx gammaii gausset gdaAppend gdaCreate gdaDStat gdaDStatMat gdaGetIndex gdaGetName gdaGetNames gdaGetOrders gdaGetType gdaGetTypes gdaGetVarInfo gdaIsCplx gdaLoad gdaPack gdaRead gdaReadByIndex gdaReadSome gdaReadSparse gdaReadStruct gdaReportVarInfo gdaSave gdaUpdate gdaUpdateAndPack gdaVars gdaWrite gdaWrite32 gdaWriteSome getarray getdims getf getGAUSShome getmatrix getmatrix4D getname getnamef getNextTradingDay getNextWeekDay getnr getorders getpath getPreviousTradingDay getPreviousWeekDay getRow getscalar3D getscalar4D getTrRow getwind glm gradcplx gradMT gradMTm gradMTT gradMTTm gradp graphprt graphset hasimag header headermt hess hessMT hessMTg hessMTgw hessMTm hessMTmw hessMTT hessMTTg hessMTTgw hessMTTm hessMTw hessp hist histf histp hsec imag indcv indexcat indices indices2 indicesf indicesfn indnv indsav integrate1d integrateControlCreate intgrat2 intgrat3 inthp1 inthp2 inthp3 inthp4 inthpControlCreate intquad1 intquad2 intquad3 intrleav intrleavsa intrsect intsimp inv invpd invswp iscplx iscplxf isden isinfnanmiss ismiss key keyav keyw lag lag1 lagn lapEighb lapEighi lapEighvb lapEighvi lapgEig lapgEigh lapgEighv lapgEigv lapgSchur lapgSvdcst lapgSvds lapgSvdst lapSvdcusv lapSvds lapSvdusv ldlp ldlsol linSolve listwise ln lncdfbvn lncdfbvn2 lncdfmvn lncdfn lncdfn2 lncdfnc lnfact lngammacplx lnpdfmvn lnpdfmvt lnpdfn lnpdft loadd loadstruct loadwind loess loessmt loessmtControlCreate log loglog logx logy lower lowmat lowmat1 ltrisol lu lusol machEpsilon make makevars makewind margin matalloc matinit mattoarray maxbytes maxc maxindc maxv maxvec mbesselei mbesselei0 mbesselei1 mbesseli mbesseli0 mbesseli1 meanc median mergeby mergevar minc minindc minv miss missex missrv moment momentd movingave movingaveExpwgt movingaveWgt nextindex nextn nextnevn nextwind ntos null null1 numCombinations ols olsmt olsmtControlCreate olsqr olsqr2 olsqrmt ones optn optnevn orth outtyp pacf packedToSp packr parse pause pdfCauchy pdfChi pdfExp pdfGenPareto pdfHyperGeo pdfLaplace pdfLogistic pdfn pdfPoisson pdfRayleigh pdfWeibull pi pinv pinvmt plotAddArrow plotAddBar plotAddBox plotAddHist plotAddHistF plotAddHistP plotAddPolar plotAddScatter plotAddShape plotAddTextbox plotAddTS plotAddXY plotArea plotBar plotBox plotClearLayout plotContour plotCustomLayout plotGetDefaults plotHist plotHistF plotHistP plotLayout plotLogLog plotLogX plotLogY plotOpenWindow plotPolar plotSave plotScatter plotSetAxesPen plotSetBar plotSetBarFill plotSetBarStacked plotSetBkdColor plotSetFill plotSetGrid plotSetLegend plotSetLineColor plotSetLineStyle plotSetLineSymbol plotSetLineThickness plotSetNewWindow plotSetTitle plotSetWhichYAxis plotSetXAxisShow plotSetXLabel plotSetXRange plotSetXTicInterval plotSetXTicLabel plotSetYAxisShow plotSetYLabel plotSetYRange plotSetZAxisShow plotSetZLabel plotSurface plotTS plotXY polar polychar polyeval polygamma polyint polymake polymat polymroot polymult polyroot pqgwin previousindex princomp printfm printfmt prodc psi putarray putf putvals pvCreate pvGetIndex pvGetParNames pvGetParVector pvLength pvList pvPack pvPacki pvPackm pvPackmi pvPacks pvPacksi pvPacksm pvPacksmi pvPutParVector pvTest pvUnpack QNewton QNewtonmt QNewtonmtControlCreate QNewtonmtOutCreate QNewtonSet QProg QProgmt QProgmtInCreate qqr qqre qqrep qr qre qrep qrsol qrtsol qtyr qtyre qtyrep quantile quantiled qyr qyre qyrep qz rank rankindx readr real reclassify reclassifyCuts recode recserar recsercp recserrc rerun rescale reshape rets rev rfft rffti rfftip rfftn rfftnp rfftp rndBernoulli rndBeta rndBinomial rndCauchy rndChiSquare rndCon rndCreateState rndExp rndGamma rndGeo rndGumbel rndHyperGeo rndi rndKMbeta rndKMgam rndKMi rndKMn rndKMnb rndKMp rndKMu rndKMvm rndLaplace rndLCbeta rndLCgam rndLCi rndLCn rndLCnb rndLCp rndLCu rndLCvm rndLogNorm rndMTu rndMVn rndMVt rndn rndnb rndNegBinomial rndp rndPoisson rndRayleigh rndStateSkip rndu rndvm rndWeibull rndWishart rotater round rows rowsf rref sampleData satostrC saved saveStruct savewind scale scale3d scalerr scalinfnanmiss scalmiss schtoc schur searchsourcepath seekr select selif seqa seqm setdif setdifsa setvars setvwrmode setwind shell shiftr sin singleindex sinh sleep solpd sortc sortcc sortd sorthc sorthcc sortind sortindc sortmc sortr sortrc spBiconjGradSol spChol spConjGradSol spCreate spDenseSubmat spDiagRvMat spEigv spEye spLDL spline spLU spNumNZE spOnes spreadSheetReadM spreadSheetReadSA spreadSheetWrite spScale spSubmat spToDense spTrTDense spTScalar spZeros sqpSolve sqpSolveMT sqpSolveMTControlCreate sqpSolveMTlagrangeCreate sqpSolveMToutCreate sqpSolveSet sqrt statements stdc stdsc stocv stof strcombine strindx strlen strput strrindx strsect strsplit strsplitPad strtodt strtof strtofcplx strtriml strtrimr strtrunc strtruncl strtruncpad strtruncr submat subscat substute subvec sumc sumr surface svd svd1 svd2 svdcusv svds svdusv sysstate tab tan tanh tempname threadBegin threadEnd threadEndFor threadFor threadJoin threadStat time timedt timestr timeutc title tkf2eps tkf2ps tocart todaydt toeplitz token topolar trapchk trigamma trimr trunc type typecv typef union unionsa uniqindx uniqindxsa unique uniquesa upmat upmat1 upper utctodt utctodtv utrisol vals varCovMS varCovXS varget vargetl varmall varmares varput varputl vartypef vcm vcms vcx vcxs vec vech vecr vector vget view viewxyz vlist vnamecv volume vput vread vtypecv wait waitc walkindex where window writer xlabel xlsGetSheetCount xlsGetSheetSize xlsGetSheetTypes xlsMakeRange xlsReadM xlsReadSA xlsWrite xlsWriteM xlsWriteSA xpnd xtics xy xyz ylabel ytics zeros zeta zlabel ztics cdfEmpirical dot h5create h5open h5read h5readAttribute h5write h5writeAttribute ldl plotAddErrorBar plotAddSurface plotCDFEmpirical plotSetColormap plotSetContourLabels plotSetLegendFont plotSetTextInterpreter plotSetXTicCount plotSetYTicCount plotSetZLevels powerm strjoin strtrim sylvester",literal:"DB_AFTER_LAST_ROW DB_ALL_TABLES DB_BATCH_OPERATIONS DB_BEFORE_FIRST_ROW DB_BLOB DB_EVENT_NOTIFICATIONS DB_FINISH_QUERY DB_HIGH_PRECISION DB_LAST_INSERT_ID DB_LOW_PRECISION_DOUBLE DB_LOW_PRECISION_INT32 DB_LOW_PRECISION_INT64 DB_LOW_PRECISION_NUMBERS DB_MULTIPLE_RESULT_SETS DB_NAMED_PLACEHOLDERS DB_POSITIONAL_PLACEHOLDERS DB_PREPARED_QUERIES DB_QUERY_SIZE DB_SIMPLE_LOCKING DB_SYSTEM_TABLES DB_TABLES DB_TRANSACTIONS DB_UNICODE DB_VIEWS"},a={cN:"meta",b:"#",e:"$",k:{"meta-keyword":"define definecs|10 undef ifdef ifndef iflight ifdllcall ifmac ifos2win ifunix else endif lineson linesoff srcfile srcline"},c:[{b:/\\\n/,r:0},{bK:"include",e:"$",k:{"meta-keyword":"include"},c:[{cN:"meta-string",b:'"',e:'"',i:"\\n"}]},e.CLCM,e.CBCM]},r=e.UIR+"\\s*\\(?",o=[{cN:"params",b:/\(/,e:/\)/,k:t,r:0,c:[e.CNM,e.CLCM,e.CBCM]}];return{aliases:["gss"],cI:!0,k:t,i:"(\\{[%#]|[%#]\\})",c:[e.CNM,e.CLCM,e.CBCM,e.C("@","@"),a,{cN:"string",b:'"',e:'"',c:[e.BE]},{cN:"function",bK:"proc keyword",e:";",eE:!0,k:t,c:[{b:r,rB:!0,c:[e.UTM],r:0},e.CNM,e.CLCM,e.CBCM,a].concat(o)},{cN:"function",bK:"fn",e:";",eE:!0,k:t,c:[{b:r+e.IR+"\\)?\\s*\\=\\s*",rB:!0,c:[e.UTM],r:0},e.CNM,e.CLCM,e.CBCM].concat(o)},{cN:"function",b:"\\bexternal (proc|keyword|fn)\\s+",e:";",eE:!0,k:t,c:[{b:r,rB:!0,c:[e.UTM],r:0},e.CLCM,e.CBCM]},{cN:"function",b:"\\bexternal (matrix|string|array|sparse matrix|struct "+e.IR+")\\s+",e:";",eE:!0,k:t,c:[e.CLCM,e.CBCM]}]}});hljs.registerLanguage("objectivec",function(e){var t={cN:"built_in",b:"\\b(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)\\w+"},_={keyword:"int float while char export sizeof typedef const struct for union unsigned long volatile static bool mutable if do return goto void enum else break extern asm case short default double register explicit signed typename this switch continue wchar_t inline readonly assign readwrite self @synchronized id typeof nonatomic super unichar IBOutlet IBAction strong weak copy in out inout bycopy byref oneway __strong __weak __block __autoreleasing @private @protected @public @try @property @end @throw @catch @finally @autoreleasepool @synthesize @dynamic @selector @optional @required @encode @package @import @defs @compatibility_alias __bridge __bridge_transfer __bridge_retained __bridge_retain __covariant __contravariant __kindof _Nonnull _Nullable _Null_unspecified __FUNCTION__ __PRETTY_FUNCTION__ __attribute__ getter setter retain unsafe_unretained nonnull nullable null_unspecified null_resettable class instancetype NS_DESIGNATED_INITIALIZER NS_UNAVAILABLE NS_REQUIRES_SUPER NS_RETURNS_INNER_POINTER NS_INLINE NS_AVAILABLE NS_DEPRECATED NS_ENUM NS_OPTIONS NS_SWIFT_UNAVAILABLE NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_END NS_REFINED_FOR_SWIFT NS_SWIFT_NAME NS_SWIFT_NOTHROW NS_DURING NS_HANDLER NS_ENDHANDLER NS_VALUERETURN NS_VOIDRETURN",literal:"false true FALSE TRUE nil YES NO NULL",built_in:"BOOL dispatch_once_t dispatch_queue_t dispatch_sync dispatch_async dispatch_once"},i=/[a-zA-Z@][a-zA-Z0-9_]*/,n="@interface @class @protocol @implementation";return{aliases:["mm","objc","obj-c"],k:_,l:i,i:""}]}]},{cN:"class",b:"("+n.split(" ").join("|")+")\\b",e:"({|$)",eE:!0,k:n,l:i,c:[e.UTM]},{b:"\\."+e.UIR,r:0}]}});hljs.registerLanguage("handlebars",function(e){var a={"builtin-name":"each in with if else unless bindattr action collection debugger log outlet template unbound view yield"};return{aliases:["hbs","html.hbs","html.handlebars"],cI:!0,sL:"xml",c:[e.C("{{!(--)?","(--)?}}"),{cN:"template-tag",b:/\{\{[#\/]/,e:/\}\}/,c:[{cN:"name",b:/[a-zA-Z\.-]+/,k:a,starts:{eW:!0,r:0,c:[e.QSM]}}]},{cN:"template-variable",b:/\{\{/,e:/\}\}/,k:a}]}});hljs.registerLanguage("mercury",function(e){var i={keyword:"module use_module import_module include_module end_module initialise mutable initialize finalize finalise interface implementation pred mode func type inst solver any_pred any_func is semidet det nondet multi erroneous failure cc_nondet cc_multi typeclass instance where pragma promise external trace atomic or_else require_complete_switch require_det require_semidet require_multi require_nondet require_cc_multi require_cc_nondet require_erroneous require_failure",meta:"inline no_inline type_spec source_file fact_table obsolete memo loop_check minimal_model terminates does_not_terminate check_termination promise_equivalent_clauses foreign_proc foreign_decl foreign_code foreign_type foreign_import_module foreign_export_enum foreign_export foreign_enum may_call_mercury will_not_call_mercury thread_safe not_thread_safe maybe_thread_safe promise_pure promise_semipure tabled_for_io local untrailed trailed attach_to_io_state can_pass_as_mercury_type stable will_not_throw_exception may_modify_trail will_not_modify_trail may_duplicate may_not_duplicate affects_liveness does_not_affect_liveness doesnt_affect_liveness no_sharing unknown_sharing sharing",built_in:"some all not if then else true fail false try catch catch_any semidet_true semidet_false semidet_fail impure_true impure semipure"},r=e.C("%","$"),t={cN:"number",b:"0'.\\|0[box][0-9a-fA-F]*"},_=e.inherit(e.ASM,{r:0}),n=e.inherit(e.QSM,{r:0}),a={cN:"subst",b:"\\\\[abfnrtv]\\|\\\\x[0-9a-fA-F]*\\\\\\|%[-+# *.0-9]*[dioxXucsfeEgGp]",r:0};n.c.push(a);var o={cN:"built_in",v:[{b:"<=>"},{b:"<=",r:0},{b:"=>",r:0},{b:"/\\\\"},{b:"\\\\/"}]},l={cN:"built_in",v:[{b:":-\\|-->"},{b:"=",r:0}]};return{aliases:["m","moo"],k:i,c:[o,l,r,e.CBCM,t,e.NM,_,n,{b:/:-/}]}});hljs.registerLanguage("dns",function(d){return{aliases:["bind","zone"],k:{keyword:"IN A AAAA AFSDB APL CAA CDNSKEY CDS CERT CNAME DHCID DLV DNAME DNSKEY DS HIP IPSECKEY KEY KX LOC MX NAPTR NS NSEC NSEC3 NSEC3PARAM PTR RRSIG RP SIG SOA SRV SSHFP TA TKEY TLSA TSIG TXT"},c:[d.C(";","$",{r:0}),{cN:"meta",b:/^\$(TTL|GENERATE|INCLUDE|ORIGIN)\b/},{cN:"number",b:"((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:)))\\b"},{cN:"number",b:"((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]).){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\b"},d.inherit(d.NM,{b:/\b\d+[dhwm]?/})]}});hljs.registerLanguage("pony",function(e){var r={keyword:"actor addressof and as be break class compile_error compile_intrinsicconsume continue delegate digestof do else elseif embed end errorfor fun if ifdef in interface is isnt lambda let match new not objector primitive recover repeat return struct then trait try type until use var where while with xor",meta:"iso val tag trn box ref",literal:"this false true"},t={cN:"string",b:'"""',e:'"""',r:10},c={cN:"string",b:'"',e:'"',c:[e.BE]},i={cN:"string",b:"'",e:"'",c:[e.BE],r:0},n={cN:"type",b:"\\b_?[A-Z][\\w]*",r:0},s={b:e.IR+"'",r:0},a={cN:"class",bK:"class actor",e:"$",c:[e.TM,e.CLCM]},o={cN:"function",bK:"new fun",e:"=>",c:[e.TM,{b:/\(/,e:/\)/,c:[n,s,e.CNM,e.CBCM]},{b:/:/,eW:!0,c:[n]},e.CLCM]};return{k:r,c:[a,o,n,t,c,i,s,e.CNM,e.CLCM,e.CBCM]}});hljs.registerLanguage("leaf",function(e){return{c:[{cN:"function",b:"#+[A-Za-z_0-9]*\\(",e:" {",rB:!0,eE:!0,c:[{cN:"keyword",b:"#+"},{cN:"title",b:"[A-Za-z_][A-Za-z_0-9]*"},{cN:"params",b:"\\(",e:"\\)",endsParent:!0,c:[{cN:"string",b:'"',e:'"'},{cN:"variable",b:"[A-Za-z_][A-Za-z_0-9]*"}]}]}]}});hljs.registerLanguage("dust",function(e){var t="if eq ne lt lte gt gte select default math sep";return{aliases:["dst"],cI:!0,sL:"xml",c:[{cN:"template-tag",b:/\{[#\/]/,e:/\}/,i:/;/,c:[{cN:"name",b:/[a-zA-Z\.-]+/,starts:{eW:!0,r:0,c:[e.QSM]}}]},{cN:"template-variable",b:/\{/,e:/\}/,i:/;/,k:t}]}});hljs.registerLanguage("erlang-repl",function(e){return{k:{built_in:"spawn spawn_link self",keyword:"after and andalso|10 band begin bnot bor bsl bsr bxor case catch cond div end fun if let not of or orelse|10 query receive rem try when xor"},c:[{cN:"meta",b:"^[0-9]+> ",r:10},e.C("%","$"),{cN:"number",b:"\\b(\\d+#[a-fA-F0-9]+|\\d+(\\.\\d+)?([eE][-+]?\\d+)?)",r:0},e.ASM,e.QSM,{b:"\\?(::)?([A-Z]\\w*(::)?)+"},{b:"->"},{b:"ok"},{b:"!"},{b:"(\\b[a-z'][a-zA-Z0-9_']*:[a-z'][a-zA-Z0-9_']*)|(\\b[a-z'][a-zA-Z0-9_']*)",r:0},{b:"[A-Z][a-zA-Z0-9_']*",r:0}]}});hljs.registerLanguage("r",function(e){var r="([a-zA-Z]|\\.[a-zA-Z.])[a-zA-Z0-9._]*";return{c:[e.HCM,{b:r,l:r,k:{keyword:"function if in break next repeat else for return switch while try tryCatch stop warning require library attach detach source setMethod setGeneric setGroupGeneric setClass ...",literal:"NULL NA TRUE FALSE T F Inf NaN NA_integer_|10 NA_real_|10 NA_character_|10 NA_complex_|10"},r:0},{cN:"number",b:"0[xX][0-9a-fA-F]+[Li]?\\b",r:0},{cN:"number",b:"\\d+(?:[eE][+\\-]?\\d*)?L\\b",r:0},{cN:"number",b:"\\d+\\.(?!\\d)(?:i\\b)?",r:0},{cN:"number",b:"\\d+(?:\\.\\d*)?(?:[eE][+\\-]?\\d*)?i?\\b",r:0},{cN:"number",b:"\\.\\d+(?:[eE][+\\-]?\\d*)?i?\\b",r:0},{b:"`",e:"`",r:0},{cN:"string",c:[e.BE],v:[{b:'"',e:'"'},{b:"'",e:"'"}]}]}});hljs.registerLanguage("delphi",function(e){var r="exports register file shl array record property for mod while set ally label uses raise not stored class safecall var interface or private static exit index inherited to else stdcall override shr asm far resourcestring finalization packed virtual out and protected library do xorwrite goto near function end div overload object unit begin string on inline repeat until destructor write message program with read initialization except default nil if case cdecl in downto threadvar of try pascal const external constructor type public then implementation finally published procedure absolute reintroduce operator as is abstract alias assembler bitpacked break continue cppdecl cvar enumerator experimental platform deprecated unimplemented dynamic export far16 forward generic helper implements interrupt iochecks local name nodefault noreturn nostackframe oldfpccall otherwise saveregisters softfloat specialize strict unaligned varargs ",t=[e.CLCM,e.C(/\{/,/\}/,{r:0}),e.C(/\(\*/,/\*\)/,{r:10})],a={cN:"meta",v:[{b:/\{\$/,e:/\}/},{b:/\(\*\$/,e:/\*\)/}]},c={cN:"string",b:/'/,e:/'/,c:[{b:/''/}]},i={cN:"string",b:/(#\d+)+/},o={b:e.IR+"\\s*=\\s*class\\s*\\(",rB:!0,c:[e.TM]},n={cN:"function",bK:"function constructor destructor procedure",e:/[:;]/,k:"function constructor|10 destructor|10 procedure|10",c:[e.TM,{cN:"params",b:/\(/,e:/\)/,k:r,c:[c,i,a].concat(t)},a].concat(t)};return{aliases:["dpr","dfm","pas","pascal","freepascal","lazarus","lpr","lfm"],cI:!0,k:r,i:/"|\$[G-Zg-z]|\/\*|<\/|\|/,c:[c,i,e.NM,o,n,a].concat(t)}});hljs.registerLanguage("markdown",function(e){return{aliases:["md","mkdown","mkd"],c:[{cN:"section",v:[{b:"^#{1,6}",e:"$"},{b:"^.+?\\n[=-]{2,}$"}]},{b:"<",e:">",sL:"xml",r:0},{cN:"bullet",b:"^([*+-]|(\\d+\\.))\\s+"},{cN:"strong",b:"[*_]{2}.+?[*_]{2}"},{cN:"emphasis",v:[{b:"\\*.+?\\*"},{b:"_.+?_",r:0}]},{cN:"quote",b:"^>\\s+",e:"$"},{cN:"code",v:[{b:"^```w*s*$",e:"^```s*$"},{b:"`.+?`"},{b:"^( {4}|	)",e:"$",r:0}]},{b:"^[-\\*]{3,}",e:"$"},{b:"\\[.+?\\][\\(\\[].*?[\\)\\]]",rB:!0,c:[{cN:"string",b:"\\[",e:"\\]",eB:!0,rE:!0,r:0},{cN:"link",b:"\\]\\(",e:"\\)",eB:!0,eE:!0},{cN:"symbol",b:"\\]\\[",e:"\\]",eB:!0,eE:!0}],r:10},{b:/^\[[^\n]+\]:/,rB:!0,c:[{cN:"symbol",b:/\[/,e:/\]/,eB:!0,eE:!0},{cN:"link",b:/:\s*/,e:/$/,eB:!0}]}]}});hljs.registerLanguage("dart",function(e){var t={cN:"subst",b:"\\$\\{",e:"}",k:"true false null this is new super"},r={cN:"string",v:[{b:"r'''",e:"'''"},{b:'r"""',e:'"""'},{b:"r'",e:"'",i:"\\n"},{b:'r"',e:'"',i:"\\n"},{b:"'''",e:"'''",c:[e.BE,t]},{b:'"""',e:'"""',c:[e.BE,t]},{b:"'",e:"'",i:"\\n",c:[e.BE,t]},{b:'"',e:'"',i:"\\n",c:[e.BE,t]}]};t.c=[e.CNM,r];var n={keyword:"assert async await break case catch class const continue default do else enum extends false final finally for if in is new null rethrow return super switch sync this throw true try var void while with yield abstract as dynamic export external factory get implements import library operator part set static typedef",built_in:"print Comparable DateTime Duration Function Iterable Iterator List Map Match Null Object Pattern RegExp Set Stopwatch String StringBuffer StringSink Symbol Type Uri bool double int num document window querySelector querySelectorAll Element ElementList"};return{k:n,c:[r,e.C("/\\*\\*","\\*/",{sL:"markdown"}),e.C("///","$",{sL:"markdown"}),e.CLCM,e.CBCM,{cN:"class",bK:"class interface",e:"{",eE:!0,c:[{bK:"extends implements"},e.UTM]},e.CNM,{cN:"meta",b:"@[A-Za-z]+"},{b:"=>"}]}});hljs.registerLanguage("step21",function(e){var i="[A-Z_][A-Z0-9_.]*",r={keyword:"HEADER ENDSEC DATA"},t={cN:"meta",b:"ISO-10303-21;",r:10},n={cN:"meta",b:"END-ISO-10303-21;",r:10};return{aliases:["p21","step","stp"],cI:!0,l:i,k:r,c:[t,n,e.CLCM,e.CBCM,e.C("/\\*\\*!","\\*/"),e.CNM,e.inherit(e.ASM,{i:null}),e.inherit(e.QSM,{i:null}),{cN:"string",b:"'",e:"'"},{cN:"symbol",v:[{b:"#",e:"\\d+",i:"\\W"}]}]}});hljs.registerLanguage("cos",function(e){var t={cN:"string",v:[{b:'"',e:'"',c:[{b:'""',r:0}]}]},r={cN:"number",b:"\\b(\\d+(\\.\\d*)?|\\.\\d+)",r:0},s="property parameter class classmethod clientmethod extends as break catch close continue do d|0 else elseif for goto halt hang h|0 if job j|0 kill k|0 lock l|0 merge new open quit q|0 read r|0 return set s|0 tcommit throw trollback try tstart use view while write w|0 xecute x|0 zkill znspace zn ztrap zwrite zw zzdump zzwrite print zbreak zinsert zload zprint zremove zsave zzprint mv mvcall mvcrt mvdim mvprint zquit zsync ascii";return{cI:!0,aliases:["cos","cls"],k:s,c:[r,t,e.CLCM,e.CBCM,{cN:"comment",b:/;/,e:"$",r:0},{cN:"built_in",b:/(?:\$\$?|\.\.)\^?[a-zA-Z]+/},{cN:"built_in",b:/\$\$\$[a-zA-Z]+/},{cN:"built_in",b:/%[a-z]+(?:\.[a-z]+)*/},{cN:"symbol",b:/\^%?[a-zA-Z][\w]*/},{cN:"keyword",b:/##class|##super|#define|#dim/},{b:/&sql\(/,e:/\)/,eB:!0,eE:!0,sL:"sql"},{b:/&(js|jscript|javascript)/,eB:!0,eE:!0,sL:"javascript"},{b:/&html<\s*\s*>/,sL:"xml"}]}});hljs.registerLanguage("maxima",function(e){var t="if then else elseif for thru do while unless step in and or not",a="true false unknown inf minf ind und %e %i %pi %phi %gamma",r=" abasep abs absint absolute_real_time acos acosh acot acoth acsc acsch activate addcol add_edge add_edges addmatrices addrow add_vertex add_vertices adjacency_matrix adjoin adjoint af agd airy airy_ai airy_bi airy_dai airy_dbi algsys alg_type alias allroots alphacharp alphanumericp amortization %and annuity_fv annuity_pv antid antidiff AntiDifference append appendfile apply apply1 apply2 applyb1 apropos args arit_amortization arithmetic arithsum array arrayapply arrayinfo arraymake arraysetapply ascii asec asech asin asinh askinteger asksign assoc assoc_legendre_p assoc_legendre_q assume assume_external_byte_order asympa at atan atan2 atanh atensimp atom atvalue augcoefmatrix augmented_lagrangian_method av average_degree backtrace bars barsplot barsplot_description base64 base64_decode bashindices batch batchload bc2 bdvac belln benefit_cost bern bernpoly bernstein_approx bernstein_expand bernstein_poly bessel bessel_i bessel_j bessel_k bessel_simplify bessel_y beta beta_incomplete beta_incomplete_generalized beta_incomplete_regularized bezout bfallroots bffac bf_find_root bf_fmin_cobyla bfhzeta bfloat bfloatp bfpsi bfpsi0 bfzeta biconnected_components bimetric binomial bipartition block blockmatrixp bode_gain bode_phase bothcoef box boxplot boxplot_description break bug_report build_info|10 buildq build_sample burn cabs canform canten cardinality carg cartan cartesian_product catch cauchy_matrix cbffac cdf_bernoulli cdf_beta cdf_binomial cdf_cauchy cdf_chi2 cdf_continuous_uniform cdf_discrete_uniform cdf_exp cdf_f cdf_gamma cdf_general_finite_discrete cdf_geometric cdf_gumbel cdf_hypergeometric cdf_laplace cdf_logistic cdf_lognormal cdf_negative_binomial cdf_noncentral_chi2 cdf_noncentral_student_t cdf_normal cdf_pareto cdf_poisson cdf_rank_sum cdf_rayleigh cdf_signed_rank cdf_student_t cdf_weibull cdisplay ceiling central_moment cequal cequalignore cf cfdisrep cfexpand cgeodesic cgreaterp cgreaterpignore changename changevar chaosgame charat charfun charfun2 charlist charp charpoly chdir chebyshev_t chebyshev_u checkdiv check_overlaps chinese cholesky christof chromatic_index chromatic_number cint circulant_graph clear_edge_weight clear_rules clear_vertex_label clebsch_gordan clebsch_graph clessp clesspignore close closefile cmetric coeff coefmatrix cograd col collapse collectterms columnop columnspace columnswap columnvector combination combine comp2pui compare compfile compile compile_file complement_graph complete_bipartite_graph complete_graph complex_number_p components compose_functions concan concat conjugate conmetderiv connected_components connect_vertices cons constant constantp constituent constvalue cont2part content continuous_freq contortion contour_plot contract contract_edge contragrad contrib_ode convert coord copy copy_file copy_graph copylist copymatrix cor cos cosh cot coth cov cov1 covdiff covect covers crc24sum create_graph create_list csc csch csetup cspline ctaylor ct_coordsys ctransform ctranspose cube_graph cuboctahedron_graph cunlisp cv cycle_digraph cycle_graph cylindrical days360 dblint deactivate declare declare_constvalue declare_dimensions declare_fundamental_dimensions declare_fundamental_units declare_qty declare_translated declare_unit_conversion declare_units declare_weights decsym defcon define define_alt_display define_variable defint defmatch defrule defstruct deftaylor degree_sequence del delete deleten delta demo demoivre denom depends derivdegree derivlist describe desolve determinant dfloat dgauss_a dgauss_b dgeev dgemm dgeqrf dgesv dgesvd diag diagmatrix diag_matrix diagmatrixp diameter diff digitcharp dimacs_export dimacs_import dimension dimensionless dimensions dimensions_as_list direct directory discrete_freq disjoin disjointp disolate disp dispcon dispform dispfun dispJordan display disprule dispterms distrib divide divisors divsum dkummer_m dkummer_u dlange dodecahedron_graph dotproduct dotsimp dpart draw draw2d draw3d drawdf draw_file draw_graph dscalar echelon edge_coloring edge_connectivity edges eigens_by_jacobi eigenvalues eigenvectors eighth einstein eivals eivects elapsed_real_time elapsed_run_time ele2comp ele2polynome ele2pui elem elementp elevation_grid elim elim_allbut eliminate eliminate_using ellipse elliptic_e elliptic_ec elliptic_eu elliptic_f elliptic_kc elliptic_pi ematrix empty_graph emptyp endcons entermatrix entertensor entier equal equalp equiv_classes erf erfc erf_generalized erfi errcatch error errormsg errors euler ev eval_string evenp every evolution evolution2d evundiff example exp expand expandwrt expandwrt_factored expint expintegral_chi expintegral_ci expintegral_e expintegral_e1 expintegral_ei expintegral_e_simplify expintegral_li expintegral_shi expintegral_si explicit explose exponentialize express expt exsec extdiff extract_linear_equations extremal_subset ezgcd %f f90 facsum factcomb factor factorfacsum factorial factorout factorsum facts fast_central_elements fast_linsolve fasttimes featurep fernfale fft fib fibtophi fifth filename_merge file_search file_type fillarray findde find_root find_root_abs find_root_error find_root_rel first fix flatten flength float floatnump floor flower_snark flush flush1deriv flushd flushnd flush_output fmin_cobyla forget fortran fourcos fourexpand fourier fourier_elim fourint fourintcos fourintsin foursimp foursin fourth fposition frame_bracket freeof freshline fresnel_c fresnel_s from_adjacency_matrix frucht_graph full_listify fullmap fullmapl fullratsimp fullratsubst fullsetify funcsolve fundamental_dimensions fundamental_units fundef funmake funp fv g0 g1 gamma gamma_greek gamma_incomplete gamma_incomplete_generalized gamma_incomplete_regularized gauss gauss_a gauss_b gaussprob gcd gcdex gcdivide gcfac gcfactor gd generalized_lambert_w genfact gen_laguerre genmatrix gensym geo_amortization geo_annuity_fv geo_annuity_pv geomap geometric geometric_mean geosum get getcurrentdirectory get_edge_weight getenv get_lu_factors get_output_stream_string get_pixel get_plot_option get_tex_environment get_tex_environment_default get_vertex_label gfactor gfactorsum ggf girth global_variances gn gnuplot_close gnuplot_replot gnuplot_reset gnuplot_restart gnuplot_start go Gosper GosperSum gr2d gr3d gradef gramschmidt graph6_decode graph6_encode graph6_export graph6_import graph_center graph_charpoly graph_eigenvalues graph_flow graph_order graph_periphery graph_product graph_size graph_union great_rhombicosidodecahedron_graph great_rhombicuboctahedron_graph grid_graph grind grobner_basis grotzch_graph hamilton_cycle hamilton_path hankel hankel_1 hankel_2 harmonic harmonic_mean hav heawood_graph hermite hessian hgfred hilbertmap hilbert_matrix hipow histogram histogram_description hodge horner hypergeometric i0 i1 %ibes ic1 ic2 ic_convert ichr1 ichr2 icosahedron_graph icosidodecahedron_graph icurvature ident identfor identity idiff idim idummy ieqn %if ifactors iframes ifs igcdex igeodesic_coords ilt image imagpart imetric implicit implicit_derivative implicit_plot indexed_tensor indices induced_subgraph inferencep inference_result infix info_display init_atensor init_ctensor in_neighbors innerproduct inpart inprod inrt integerp integer_partitions integrate intersect intersection intervalp intopois intosum invariant1 invariant2 inverse_fft inverse_jacobi_cd inverse_jacobi_cn inverse_jacobi_cs inverse_jacobi_dc inverse_jacobi_dn inverse_jacobi_ds inverse_jacobi_nc inverse_jacobi_nd inverse_jacobi_ns inverse_jacobi_sc inverse_jacobi_sd inverse_jacobi_sn invert invert_by_adjoint invert_by_lu inv_mod irr is is_biconnected is_bipartite is_connected is_digraph is_edge_in_graph is_graph is_graph_or_digraph ishow is_isomorphic isolate isomorphism is_planar isqrt isreal_p is_sconnected is_tree is_vertex_in_graph items_inference %j j0 j1 jacobi jacobian jacobi_cd jacobi_cn jacobi_cs jacobi_dc jacobi_dn jacobi_ds jacobi_nc jacobi_nd jacobi_ns jacobi_p jacobi_sc jacobi_sd jacobi_sn JF jn join jordan julia julia_set julia_sin %k kdels kdelta kill killcontext kostka kron_delta kronecker_product kummer_m kummer_u kurtosis kurtosis_bernoulli kurtosis_beta kurtosis_binomial kurtosis_chi2 kurtosis_continuous_uniform kurtosis_discrete_uniform kurtosis_exp kurtosis_f kurtosis_gamma kurtosis_general_finite_discrete kurtosis_geometric kurtosis_gumbel kurtosis_hypergeometric kurtosis_laplace kurtosis_logistic kurtosis_lognormal kurtosis_negative_binomial kurtosis_noncentral_chi2 kurtosis_noncentral_student_t kurtosis_normal kurtosis_pareto kurtosis_poisson kurtosis_rayleigh kurtosis_student_t kurtosis_weibull label labels lagrange laguerre lambda lambert_w laplace laplacian_matrix last lbfgs lc2kdt lcharp lc_l lcm lc_u ldefint ldisp ldisplay legendre_p legendre_q leinstein length let letrules letsimp levi_civita lfreeof lgtreillis lhs li liediff limit Lindstedt linear linearinterpol linear_program linear_regression line_graph linsolve listarray list_correlations listify list_matrix_entries list_nc_monomials listoftens listofvars listp lmax lmin load loadfile local locate_matrix_entry log logcontract log_gamma lopow lorentz_gauge lowercasep lpart lratsubst lreduce lriemann lsquares_estimates lsquares_estimates_approximate lsquares_estimates_exact lsquares_mse lsquares_residual_mse lsquares_residuals lsum ltreillis lu_backsub lucas lu_factor %m macroexpand macroexpand1 make_array makebox makefact makegamma make_graph make_level_picture makelist makeOrders make_poly_continent make_poly_country make_polygon make_random_state make_rgb_picture makeset make_string_input_stream make_string_output_stream make_transform mandelbrot mandelbrot_set map mapatom maplist matchdeclare matchfix mat_cond mat_fullunblocker mat_function mathml_display mat_norm matrix matrixmap matrixp matrix_size mattrace mat_trace mat_unblocker max max_clique max_degree max_flow maximize_lp max_independent_set max_matching maybe md5sum mean mean_bernoulli mean_beta mean_binomial mean_chi2 mean_continuous_uniform mean_deviation mean_discrete_uniform mean_exp mean_f mean_gamma mean_general_finite_discrete mean_geometric mean_gumbel mean_hypergeometric mean_laplace mean_logistic mean_lognormal mean_negative_binomial mean_noncentral_chi2 mean_noncentral_student_t mean_normal mean_pareto mean_poisson mean_rayleigh mean_student_t mean_weibull median median_deviation member mesh metricexpandall mgf1_sha1 min min_degree min_edge_cut minfactorial minimalPoly minimize_lp minimum_spanning_tree minor minpack_lsquares minpack_solve min_vertex_cover min_vertex_cut mkdir mnewton mod mode_declare mode_identity ModeMatrix moebius mon2schur mono monomial_dimensions multibernstein_poly multi_display_for_texinfo multi_elem multinomial multinomial_coeff multi_orbit multiplot_mode multi_pui multsym multthru mycielski_graph nary natural_unit nc_degree ncexpt ncharpoly negative_picture neighbors new newcontext newdet new_graph newline newton new_variable next_prime nicedummies niceindices ninth nofix nonarray noncentral_moment nonmetricity nonnegintegerp nonscalarp nonzeroandfreeof notequal nounify nptetrad npv nroots nterms ntermst nthroot nullity nullspace num numbered_boundaries numberp number_to_octets num_distinct_partitions numerval numfactor num_partitions nusum nzeta nzetai nzetar octets_to_number octets_to_oid odd_girth oddp ode2 ode_check odelin oid_to_octets op opena opena_binary openr openr_binary openw openw_binary operatorp opsubst optimize %or orbit orbits ordergreat ordergreatp orderless orderlessp orthogonal_complement orthopoly_recur orthopoly_weight outermap out_neighbors outofpois pade parabolic_cylinder_d parametric parametric_surface parg parGosper parse_string parse_timedate part part2cont partfrac partition partition_set partpol path_digraph path_graph pathname_directory pathname_name pathname_type pdf_bernoulli pdf_beta pdf_binomial pdf_cauchy pdf_chi2 pdf_continuous_uniform pdf_discrete_uniform pdf_exp pdf_f pdf_gamma pdf_general_finite_discrete pdf_geometric pdf_gumbel pdf_hypergeometric pdf_laplace pdf_logistic pdf_lognormal pdf_negative_binomial pdf_noncentral_chi2 pdf_noncentral_student_t pdf_normal pdf_pareto pdf_poisson pdf_rank_sum pdf_rayleigh pdf_signed_rank pdf_student_t pdf_weibull pearson_skewness permanent permut permutation permutations petersen_graph petrov pickapart picture_equalp picturep piechart piechart_description planar_embedding playback plog plot2d plot3d plotdf ploteq plsquares pochhammer points poisdiff poisexpt poisint poismap poisplus poissimp poissubst poistimes poistrim polar polarform polartorect polar_to_xy poly_add poly_buchberger poly_buchberger_criterion poly_colon_ideal poly_content polydecomp poly_depends_p poly_elimination_ideal poly_exact_divide poly_expand poly_expt poly_gcd polygon poly_grobner poly_grobner_equal poly_grobner_member poly_grobner_subsetp poly_ideal_intersection poly_ideal_polysaturation poly_ideal_polysaturation1 poly_ideal_saturation poly_ideal_saturation1 poly_lcm poly_minimization polymod poly_multiply polynome2ele polynomialp poly_normal_form poly_normalize poly_normalize_list poly_polysaturation_extension poly_primitive_part poly_pseudo_divide poly_reduced_grobner poly_reduction poly_saturation_extension poly_s_polynomial poly_subtract polytocompanion pop postfix potential power_mod powerseries powerset prefix prev_prime primep primes principal_components print printf printfile print_graph printpois printprops prodrac product properties propvars psi psubst ptriangularize pui pui2comp pui2ele pui2polynome pui_direct puireduc push put pv qput qrange qty quad_control quad_qag quad_qagi quad_qagp quad_qags quad_qawc quad_qawf quad_qawo quad_qaws quadrilateral quantile quantile_bernoulli quantile_beta quantile_binomial quantile_cauchy quantile_chi2 quantile_continuous_uniform quantile_discrete_uniform quantile_exp quantile_f quantile_gamma quantile_general_finite_discrete quantile_geometric quantile_gumbel quantile_hypergeometric quantile_laplace quantile_logistic quantile_lognormal quantile_negative_binomial quantile_noncentral_chi2 quantile_noncentral_student_t quantile_normal quantile_pareto quantile_poisson quantile_rayleigh quantile_student_t quantile_weibull quartile_skewness quit qunit quotient racah_v racah_w radcan radius random random_bernoulli random_beta random_binomial random_bipartite_graph random_cauchy random_chi2 random_continuous_uniform random_digraph random_discrete_uniform random_exp random_f random_gamma random_general_finite_discrete random_geometric random_graph random_graph1 random_gumbel random_hypergeometric random_laplace random_logistic random_lognormal random_negative_binomial random_network random_noncentral_chi2 random_noncentral_student_t random_normal random_pareto random_permutation random_poisson random_rayleigh random_regular_graph random_student_t random_tournament random_tree random_weibull range rank rat ratcoef ratdenom ratdiff ratdisrep ratexpand ratinterpol rational rationalize ratnumer ratnump ratp ratsimp ratsubst ratvars ratweight read read_array read_binary_array read_binary_list read_binary_matrix readbyte readchar read_hashed_array readline read_list read_matrix read_nested_list readonly read_xpm real_imagpart_to_conjugate realpart realroots rearray rectangle rectform rectform_log_if_constant recttopolar rediff reduce_consts reduce_order region region_boundaries region_boundaries_plus rem remainder remarray rembox remcomps remcon remcoord remfun remfunction remlet remove remove_constvalue remove_dimensions remove_edge remove_fundamental_dimensions remove_fundamental_units remove_plot_option remove_vertex rempart remrule remsym remvalue rename rename_file reset reset_displays residue resolvante resolvante_alternee1 resolvante_bipartite resolvante_diedrale resolvante_klein resolvante_klein3 resolvante_produit_sym resolvante_unitaire resolvante_vierer rest resultant return reveal reverse revert revert2 rgb2level rhs ricci riemann rinvariant risch rk rmdir rncombine romberg room rootscontract round row rowop rowswap rreduce run_testsuite %s save saving scalarp scaled_bessel_i scaled_bessel_i0 scaled_bessel_i1 scalefactors scanmap scatterplot scatterplot_description scene schur2comp sconcat scopy scsimp scurvature sdowncase sec sech second sequal sequalignore set_alt_display setdifference set_draw_defaults set_edge_weight setelmx setequalp setify setp set_partitions set_plot_option set_prompt set_random_state set_tex_environment set_tex_environment_default setunits setup_autoload set_up_dot_simplifications set_vertex_label seventh sexplode sf sha1sum sha256sum shortest_path shortest_weighted_path show showcomps showratvars sierpinskiale sierpinskimap sign signum similaritytransform simp_inequality simplify_sum simplode simpmetderiv simtran sin sinh sinsert sinvertcase sixth skewness skewness_bernoulli skewness_beta skewness_binomial skewness_chi2 skewness_continuous_uniform skewness_discrete_uniform skewness_exp skewness_f skewness_gamma skewness_general_finite_discrete skewness_geometric skewness_gumbel skewness_hypergeometric skewness_laplace skewness_logistic skewness_lognormal skewness_negative_binomial skewness_noncentral_chi2 skewness_noncentral_student_t skewness_normal skewness_pareto skewness_poisson skewness_rayleigh skewness_student_t skewness_weibull slength smake small_rhombicosidodecahedron_graph small_rhombicuboctahedron_graph smax smin smismatch snowmap snub_cube_graph snub_dodecahedron_graph solve solve_rec solve_rec_rat some somrac sort sparse6_decode sparse6_encode sparse6_export sparse6_import specint spherical spherical_bessel_j spherical_bessel_y spherical_hankel1 spherical_hankel2 spherical_harmonic spherical_to_xyz splice split sposition sprint sqfr sqrt sqrtdenest sremove sremovefirst sreverse ssearch ssort sstatus ssubst ssubstfirst staircase standardize standardize_inverse_trig starplot starplot_description status std std1 std_bernoulli std_beta std_binomial std_chi2 std_continuous_uniform std_discrete_uniform std_exp std_f std_gamma std_general_finite_discrete std_geometric std_gumbel std_hypergeometric std_laplace std_logistic std_lognormal std_negative_binomial std_noncentral_chi2 std_noncentral_student_t std_normal std_pareto std_poisson std_rayleigh std_student_t std_weibull stemplot stirling stirling1 stirling2 strim striml strimr string stringout stringp strong_components struve_h struve_l sublis sublist sublist_indices submatrix subsample subset subsetp subst substinpart subst_parallel substpart substring subvar subvarp sum sumcontract summand_to_rec supcase supcontext symbolp symmdifference symmetricp system take_channel take_inference tan tanh taylor taylorinfo taylorp taylor_simplifier taytorat tcl_output tcontract tellrat tellsimp tellsimpafter tentex tenth test_mean test_means_difference test_normality test_proportion test_proportions_difference test_rank_sum test_sign test_signed_rank test_variance test_variance_ratio tex tex1 tex_display texput %th third throw time timedate timer timer_info tldefint tlimit todd_coxeter toeplitz tokens to_lisp topological_sort to_poly to_poly_solve totaldisrep totalfourier totient tpartpol trace tracematrix trace_options transform_sample translate translate_file transpose treefale tree_reduce treillis treinat triangle triangularize trigexpand trigrat trigreduce trigsimp trunc truncate truncated_cube_graph truncated_dodecahedron_graph truncated_icosahedron_graph truncated_tetrahedron_graph tr_warnings_get tube tutte_graph ueivects uforget ultraspherical underlying_graph undiff union unique uniteigenvectors unitp units unit_step unitvector unorder unsum untellrat untimer untrace uppercasep uricci uriemann uvect vandermonde_matrix var var1 var_bernoulli var_beta var_binomial var_chi2 var_continuous_uniform var_discrete_uniform var_exp var_f var_gamma var_general_finite_discrete var_geometric var_gumbel var_hypergeometric var_laplace var_logistic var_lognormal var_negative_binomial var_noncentral_chi2 var_noncentral_student_t var_normal var_pareto var_poisson var_rayleigh var_student_t var_weibull vector vectorpotential vectorsimp verbify vers vertex_coloring vertex_connectivity vertex_degree vertex_distance vertex_eccentricity vertex_in_degree vertex_out_degree vertices vertices_to_cycle vertices_to_path %w weyl wheel_graph wiener_index wigner_3j wigner_6j wigner_9j with_stdout write_binary_data writebyte write_data writefile wronskian xreduce xthru %y Zeilberger zeroequiv zerofor zeromatrix zeromatrixp zeta zgeev zheev zlange zn_add_table zn_carmichael_lambda zn_characteristic_factors zn_determinant zn_factor_generators zn_invert_by_lu zn_log zn_mult_table absboxchar activecontexts adapt_depth additive adim aform algebraic algepsilon algexact aliases allbut all_dotsimp_denoms allocation allsym alphabetic animation antisymmetric arrays askexp assume_pos assume_pos_pred assumescalar asymbol atomgrad atrig1 axes axis_3d axis_bottom axis_left axis_right axis_top azimuth background background_color backsubst berlefact bernstein_explicit besselexpand beta_args_sum_to_integer beta_expand bftorat bftrunc bindtest border boundaries_array box boxchar breakup %c capping cauchysum cbrange cbtics center cflength cframe_flag cnonmet_flag color color_bar color_bar_tics colorbox columns commutative complex cone context contexts contour contour_levels cosnpiflag ctaypov ctaypt ctayswitch ctayvar ct_coords ctorsion_flag ctrgsimp cube current_let_rule_package cylinder data_file_name debugmode decreasing default_let_rule_package delay dependencies derivabbrev derivsubst detout diagmetric diff dim dimensions dispflag display2d|10 display_format_internal distribute_over doallmxops domain domxexpt domxmxops domxnctimes dontfactor doscmxops doscmxplus dot0nscsimp dot0simp dot1simp dotassoc dotconstrules dotdistrib dotexptsimp dotident dotscrules draw_graph_program draw_realpart edge_color edge_coloring edge_partition edge_type edge_width %edispflag elevation %emode endphi endtheta engineering_format_floats enhanced3d %enumer epsilon_lp erfflag erf_representation errormsg error_size error_syms error_type %e_to_numlog eval even evenfun evflag evfun ev_point expandwrt_denom expintexpand expintrep expon expop exptdispflag exptisolate exptsubst facexpand facsum_combine factlim factorflag factorial_expand factors_only fb feature features file_name file_output_append file_search_demo file_search_lisp file_search_maxima|10 file_search_tests file_search_usage file_type_lisp file_type_maxima|10 fill_color fill_density filled_func fixed_vertices flipflag float2bf font font_size fortindent fortspaces fpprec fpprintprec functions gamma_expand gammalim gdet genindex gensumnum GGFCFMAX GGFINFINITY globalsolve gnuplot_command gnuplot_curve_styles gnuplot_curve_titles gnuplot_default_term_command gnuplot_dumb_term_command gnuplot_file_args gnuplot_file_name gnuplot_out_file gnuplot_pdf_term_command gnuplot_pm3d gnuplot_png_term_command gnuplot_postamble gnuplot_preamble gnuplot_ps_term_command gnuplot_svg_term_command gnuplot_term gnuplot_view_args Gosper_in_Zeilberger gradefs grid grid2d grind halfangles head_angle head_both head_length head_type height hypergeometric_representation %iargs ibase icc1 icc2 icounter idummyx ieqnprint ifb ifc1 ifc2 ifg ifgi ifr iframe_bracket_form ifri igeowedge_flag ikt1 ikt2 imaginary inchar increasing infeval infinity inflag infolists inm inmc1 inmc2 intanalysis integer integervalued integrate_use_rootsof integration_constant integration_constant_counter interpolate_color intfaclim ip_grid ip_grid_in irrational isolate_wrt_times iterations itr julia_parameter %k1 %k2 keepfloat key key_pos kinvariant kt label label_alignment label_orientation labels lassociative lbfgs_ncorrections lbfgs_nfeval_max leftjust legend letrat let_rule_packages lfg lg lhospitallim limsubst linear linear_solver linechar linel|10 linenum line_type linewidth line_width linsolve_params linsolvewarn lispdisp listarith listconstvars listdummyvars lmxchar load_pathname loadprint logabs logarc logcb logconcoeffp logexpand lognegint logsimp logx logx_secondary logy logy_secondary logz lriem m1pbranch macroexpansion macros mainvar manual_demo maperror mapprint matrix_element_add matrix_element_mult matrix_element_transpose maxapplydepth maxapplyheight maxima_tempdir|10 maxima_userdir|10 maxnegex MAX_ORD maxposex maxpsifracdenom maxpsifracnum maxpsinegint maxpsiposint maxtayorder mesh_lines_color method mod_big_prime mode_check_errorp mode_checkp mode_check_warnp mod_test mod_threshold modular_linear_solver modulus multiplicative multiplicities myoptions nary negdistrib negsumdispflag newline newtonepsilon newtonmaxiter nextlayerfactor niceindicespref nm nmc noeval nolabels nonegative_lp noninteger nonscalar noun noundisp nouns np npi nticks ntrig numer numer_pbranch obase odd oddfun opacity opproperties opsubst optimprefix optionset orientation origin orthopoly_returns_intervals outative outchar packagefile palette partswitch pdf_file pfeformat phiresolution %piargs piece pivot_count_sx pivot_max_sx plot_format plot_options plot_realpart png_file pochhammer_max_index points pointsize point_size points_joined point_type poislim poisson poly_coefficient_ring poly_elimination_order polyfactor poly_grobner_algorithm poly_grobner_debug poly_monomial_order poly_primary_elimination_order poly_return_term_list poly_secondary_elimination_order poly_top_reduction_only posfun position powerdisp pred prederror primep_number_of_tests product_use_gamma program programmode promote_float_to_bigfloat prompt proportional_axes props psexpand ps_file radexpand radius radsubstflag rassociative ratalgdenom ratchristof ratdenomdivide rateinstein ratepsilon ratfac rational ratmx ratprint ratriemann ratsimpexpons ratvarswitch ratweights ratweyl ratwtlvl real realonly redraw refcheck resolution restart resultant ric riem rmxchar %rnum_list rombergabs rombergit rombergmin rombergtol rootsconmode rootsepsilon run_viewer same_xy same_xyz savedef savefactors scalar scalarmatrixp scale scale_lp setcheck setcheckbreak setval show_edge_color show_edges show_edge_type show_edge_width show_id show_label showtime show_vertex_color show_vertex_size show_vertex_type show_vertices show_weight simp simplified_output simplify_products simpproduct simpsum sinnpiflag solvedecomposes solveexplicit solvefactors solvenullwarn solveradcan solvetrigwarn space sparse sphere spring_embedding_depth sqrtdispflag stardisp startphi starttheta stats_numer stringdisp structures style sublis_apply_lambda subnumsimp sumexpand sumsplitfact surface surface_hide svg_file symmetric tab taylordepth taylor_logexpand taylor_order_coefficients taylor_truncate_polynomials tensorkill terminal testsuite_files thetaresolution timer_devalue title tlimswitch tr track transcompile transform transform_xy translate_fast_arrays transparent transrun tr_array_as_ref tr_bound_function_applyp tr_file_tty_messagesp tr_float_can_branch_complex tr_function_call_default trigexpandplus trigexpandtimes triginverses trigsign trivial_solutions tr_numer tr_optimize_max_loop tr_semicompile tr_state_vars tr_warn_bad_function_calls tr_warn_fexpr tr_warn_meval tr_warn_mode tr_warn_undeclared tr_warn_undefined_variable tstep ttyoff tube_extremes ufg ug %unitexpand unit_vectors uric uriem use_fast_arrays user_preamble usersetunits values vect_cross verbose vertex_color vertex_coloring vertex_partition vertex_size vertex_type view warnings weyl width windowname windowtitle wired_surface wireframe xaxis xaxis_color xaxis_secondary xaxis_type xaxis_width xlabel xlabel_secondary xlength xrange xrange_secondary xtics xtics_axis xtics_rotate xtics_rotate_secondary xtics_secondary xtics_secondary_axis xu_grid x_voxel xy_file xyplane xy_scale yaxis yaxis_color yaxis_secondary yaxis_type yaxis_width ylabel ylabel_secondary ylength yrange yrange_secondary ytics ytics_axis ytics_rotate ytics_rotate_secondary ytics_secondary ytics_secondary_axis yv_grid y_voxel yx_ratio zaxis zaxis_color zaxis_type zaxis_width zeroa zerob zerobern zeta%pi zlabel zlabel_rotate zlength zmin zn_primroot_limit zn_primroot_pretest",i="_ __ %|0 %%|0";return{l:"[A-Za-z_%][0-9A-Za-z_%]*",k:{keyword:t,literal:a,built_in:r,symbol:i},c:[{cN:"comment",b:"/\\*",e:"\\*/",c:["self"]},e.QSM,{cN:"number",r:0,v:[{b:"\\b(\\d+|\\d+\\.|\\.\\d+|\\d+\\.\\d+)[Ee][-+]?\\d+\\b"},{b:"\\b(\\d+|\\d+\\.|\\.\\d+|\\d+\\.\\d+)[Bb][-+]?\\d+\\b",r:10},{b:"\\b(\\.\\d+|\\d+\\.\\d+)\\b"},{b:"\\b(\\d+|0[0-9A-Za-z]+)\\.?\\b"}]}],i:/@/}});hljs.registerLanguage("crystal",function(e){function r(e,r){var b=[{b:e,e:r}];return b[0].c=b,b}var b="(_[uif](8|16|32|64))?",c="[a-zA-Z_]\\w*[!?=]?",n="!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",i="[a-zA-Z_]\\w*[!?=]?|[-+~]\\@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\][=?]?",s={keyword:"abstract alias as asm begin break case class def do else elsif end ensure enum extend for fun if ifdef include instance_sizeof is_a? lib macro module next of out pointerof private protected rescue responds_to? return require self sizeof struct super then type typeof union unless until when while with yield __DIR__ __FILE__ __LINE__",literal:"false nil true"},t={cN:"subst",b:"#{",e:"}",k:s},a={cN:"template-variable",v:[{b:"\\{\\{",e:"\\}\\}"},{b:"\\{%",e:"%\\}"}],k:s},l={cN:"string",c:[e.BE,t],v:[{b:/'/,e:/'/},{b:/"/,e:/"/},{b:/`/,e:/`/},{b:"%w?\\(",e:"\\)",c:r("\\(","\\)")},{b:"%w?\\[",e:"\\]",c:r("\\[","\\]")},{b:"%w?{",e:"}",c:r("{","}")},{b:"%w?<",e:">",c:r("<",">")},{b:"%w?/",e:"/"},{b:"%w?%",e:"%"},{b:"%w?-",e:"-"},{b:"%w?\\|",e:"\\|"}],r:0},u={b:"("+n+")\\s*",c:[{cN:"regexp",c:[e.BE,t],v:[{b:"//[a-z]*",r:0},{b:"/",e:"/[a-z]*"},{b:"%r\\(",e:"\\)",c:r("\\(","\\)")},{b:"%r\\[",e:"\\]",c:r("\\[","\\]")},{b:"%r{",e:"}",c:r("{","}")},{b:"%r<",e:">",c:r("<",">")},{b:"%r/",e:"/"},{b:"%r%",e:"%"},{b:"%r-",e:"-"},{b:"%r\\|",e:"\\|"}]}],r:0},o={cN:"regexp",c:[e.BE,t],v:[{b:"%r\\(",e:"\\)",c:r("\\(","\\)")},{b:"%r\\[",e:"\\]",c:r("\\[","\\]")},{b:"%r{",e:"}",c:r("{","}")},{b:"%r<",e:">",c:r("<",">")},{b:"%r/",e:"/"},{b:"%r%",e:"%"},{b:"%r-",e:"-"},{b:"%r\\|",e:"\\|"}],r:0},_={cN:"meta",b:"@\\[",e:"\\]",c:[e.inherit(e.QSM,{cN:"meta-string"})]},f=[a,l,u,o,_,e.HCM,{cN:"class",bK:"class module struct",e:"$|;",i:/=/,c:[e.HCM,e.inherit(e.TM,{b:"[A-Za-z_]\\w*(::\\w+)*(\\?|\\!)?"}),{b:"<"}]},{cN:"class",bK:"lib enum union",e:"$|;",i:/=/,c:[e.HCM,e.inherit(e.TM,{b:"[A-Za-z_]\\w*(::\\w+)*(\\?|\\!)?"})],r:10},{cN:"function",bK:"def",e:/\B\b/,c:[e.inherit(e.TM,{b:i,endsParent:!0})]},{cN:"function",bK:"fun macro",e:/\B\b/,c:[e.inherit(e.TM,{b:i,endsParent:!0})],r:5},{cN:"symbol",b:e.UIR+"(\\!|\\?)?:",r:0},{cN:"symbol",b:":",c:[l,{b:i}],r:0},{cN:"number",v:[{b:"\\b0b([01_]*[01])"+b},{b:"\\b0o([0-7_]*[0-7])"+b},{b:"\\b0x([A-Fa-f0-9_]*[A-Fa-f0-9])"+b},{b:"\\b(([0-9][0-9_]*[0-9]|[0-9])(\\.[0-9_]*[0-9])?([eE][+-]?[0-9_]*[0-9])?)"+b}],r:0}];return t.c=f,a.c=f.slice(1),{aliases:["cr"],l:c,k:s,c:f}});hljs.registerLanguage("ocaml",function(e){return{aliases:["ml"],k:{keyword:"and as assert asr begin class constraint do done downto else end exception external for fun function functor if in include inherit! inherit initializer land lazy let lor lsl lsr lxor match method!|10 method mod module mutable new object of open! open or private rec sig struct then to try type val! val virtual when while with parser value",built_in:"array bool bytes char exn|5 float int int32 int64 list lazy_t|5 nativeint|5 string unit in_channel out_channel ref",literal:"true false"},i:/\/\/|>>/,l:"[a-z_]\\w*!?",c:[{cN:"literal",b:"\\[(\\|\\|)?\\]|\\(\\)",r:0},e.C("\\(\\*","\\*\\)",{c:["self"]}),{cN:"symbol",b:"'[A-Za-z_](?!')[\\w']*"},{cN:"type",b:"`[A-Z][\\w']*"},{cN:"type",b:"\\b[A-Z][\\w']*",r:0},{b:"[a-z_]\\w*'[\\w']*",r:0},e.inherit(e.ASM,{cN:"string",r:0}),e.inherit(e.QSM,{i:null}),{cN:"number",b:"\\b(0[xX][a-fA-F0-9_]+[Lln]?|0[oO][0-7_]+[Lln]?|0[bB][01_]+[Lln]?|[0-9][0-9_]*([Lln]|(\\.[0-9_]*)?([eE][-+]?[0-9_]+)?)?)",r:0},{b:/[-=]>/}]}});hljs.registerLanguage("json",function(e){var i={literal:"true false null"},n=[e.QSM,e.CNM],r={e:",",eW:!0,eE:!0,c:n,k:i},t={b:"{",e:"}",c:[{cN:"attr",b:/"/,e:/"/,c:[e.BE],i:"\\n"},e.inherit(r,{b:/:/})],i:"\\S"},c={b:"\\[",e:"\\]",c:[e.inherit(r)],i:"\\S"};return n.splice(n.length,0,t,c),{c:n,k:i,i:"\\S"}});hljs.registerLanguage("processing",function(e){return{k:{keyword:"BufferedReader PVector PFont PImage PGraphics HashMap boolean byte char color double float int long String Array FloatDict FloatList IntDict IntList JSONArray JSONObject Object StringDict StringList Table TableRow XML false synchronized int abstract float private char boolean static null if const for true while long throw strictfp finally protected import native final return void enum else break transient new catch instanceof byte super volatile case assert short package default double public try this switch continue throws protected public private",literal:"P2D P3D HALF_PI PI QUARTER_PI TAU TWO_PI",title:"setup draw",built_in:"displayHeight displayWidth mouseY mouseX mousePressed pmouseX pmouseY key keyCode pixels focused frameCount frameRate height width size createGraphics beginDraw createShape loadShape PShape arc ellipse line point quad rect triangle bezier bezierDetail bezierPoint bezierTangent curve curveDetail curvePoint curveTangent curveTightness shape shapeMode beginContour beginShape bezierVertex curveVertex endContour endShape quadraticVertex vertex ellipseMode noSmooth rectMode smooth strokeCap strokeJoin strokeWeight mouseClicked mouseDragged mouseMoved mousePressed mouseReleased mouseWheel keyPressed keyPressedkeyReleased keyTyped print println save saveFrame day hour millis minute month second year background clear colorMode fill noFill noStroke stroke alpha blue brightness color green hue lerpColor red saturation modelX modelY modelZ screenX screenY screenZ ambient emissive shininess specular add createImage beginCamera camera endCamera frustum ortho perspective printCamera printProjection cursor frameRate noCursor exit loop noLoop popStyle pushStyle redraw binary boolean byte char float hex int str unbinary unhex join match matchAll nf nfc nfp nfs split splitTokens trim append arrayCopy concat expand reverse shorten sort splice subset box sphere sphereDetail createInput createReader loadBytes loadJSONArray loadJSONObject loadStrings loadTable loadXML open parseXML saveTable selectFolder selectInput beginRaw beginRecord createOutput createWriter endRaw endRecord PrintWritersaveBytes saveJSONArray saveJSONObject saveStream saveStrings saveXML selectOutput popMatrix printMatrix pushMatrix resetMatrix rotate rotateX rotateY rotateZ scale shearX shearY translate ambientLight directionalLight lightFalloff lights lightSpecular noLights normal pointLight spotLight image imageMode loadImage noTint requestImage tint texture textureMode textureWrap blend copy filter get loadPixels set updatePixels blendMode loadShader PShaderresetShader shader createFont loadFont text textFont textAlign textLeading textMode textSize textWidth textAscent textDescent abs ceil constrain dist exp floor lerp log mag map max min norm pow round sq sqrt acos asin atan atan2 cos degrees radians sin tan noise noiseDetail noiseSeed random randomGaussian randomSeed"},c:[e.CLCM,e.CBCM,e.ASM,e.QSM,e.CNM]}});hljs.registerLanguage("1c",function(c){var e="[a-zA-Zа-яА-Я][a-zA-Z0-9_а-яА-Я]*",n="возврат дата для если и или иначе иначеесли исключение конецесли конецпопытки конецпроцедуры конецфункции конеццикла константа не перейти перем перечисление по пока попытка прервать продолжить процедура строка тогда фс функция цикл число экспорт",b="ansitooem oemtoansi ввестивидсубконто ввестидату ввестизначение ввестиперечисление ввестипериод ввестиплансчетов ввестистроку ввестичисло вопрос восстановитьзначение врег выбранныйплансчетов вызватьисключение датагод датамесяц датачисло добавитьмесяц завершитьработусистемы заголовоксистемы записьжурналарегистрации запуститьприложение зафиксироватьтранзакцию значениевстроку значениевстрокувнутр значениевфайл значениеизстроки значениеизстрокивнутр значениеизфайла имякомпьютера имяпользователя каталогвременныхфайлов каталогиб каталогпользователя каталогпрограммы кодсимв командасистемы конгода конецпериодаби конецрассчитанногопериодаби конецстандартногоинтервала конквартала конмесяца коннедели лев лог лог10 макс максимальноеколичествосубконто мин монопольныйрежим названиеинтерфейса названиенабораправ назначитьвид назначитьсчет найти найтипомеченныенаудаление найтиссылки началопериодаби началостандартногоинтервала начатьтранзакцию начгода начквартала начмесяца начнедели номерднягода номерднянедели номернеделигода нрег обработкаожидания окр описаниеошибки основнойжурналрасчетов основнойплансчетов основнойязык открытьформу открытьформумодально отменитьтранзакцию очиститьокносообщений периодстр полноеимяпользователя получитьвремята получитьдатута получитьдокументта получитьзначенияотбора получитьпозициюта получитьпустоезначение получитьта прав праводоступа предупреждение префиксавтонумерации пустаястрока пустоезначение рабочаядаттьпустоезначение рабочаядата разделительстраниц разделительстрок разм разобратьпозициюдокумента рассчитатьрегистрына рассчитатьрегистрыпо сигнал симв символтабуляции создатьобъект сокрл сокрлп сокрп сообщить состояние сохранитьзначение сред статусвозврата стрдлина стрзаменить стрколичествострок стрполучитьстроку  стрчисловхождений сформироватьпозициюдокумента счетпокоду текущаядата текущеевремя типзначения типзначениястр удалитьобъекты установитьтана установитьтапо фиксшаблон формат цел шаблон",i={b:'""'},r={cN:"string",b:'"',e:'"|$',c:[i]},t={cN:"string",b:"\\|",e:'"|$',c:[i]};return{cI:!0,l:e,k:{keyword:n,built_in:b},c:[c.CLCM,c.NM,r,t,{cN:"function",b:"(процедура|функция)",e:"$",l:e,k:"процедура функция",c:[{b:"экспорт",eW:!0,l:e,k:"экспорт",c:[c.CLCM]},{cN:"params",b:"\\(",e:"\\)",l:e,k:"знач",c:[r,t]},c.CLCM,c.inherit(c.TM,{b:e})]},{cN:"meta",b:"#",e:"$"},{cN:"number",b:"'\\d{2}\\.\\d{2}\\.(\\d{2}|\\d{4})'"}]}});hljs.registerLanguage("julia",function(e){var r={keyword:"in abstract baremodule begin bitstype break catch ccall const continue do else elseif end export finally for function global if immutable import importall let local macro module quote return try type typealias using while",literal:"true false ARGS CPU_CORES C_NULL DL_LOAD_PATH DevNull ENDIAN_BOM ENV I|0 Inf Inf16 Inf32 InsertionSort JULIA_HOME LOAD_PATH MS_ASYNC MS_INVALIDATE MS_SYNC MergeSort NaN NaN16 NaN32 OS_NAME QuickSort RTLD_DEEPBIND RTLD_FIRST RTLD_GLOBAL RTLD_LAZY RTLD_LOCAL RTLD_NODELETE RTLD_NOLOAD RTLD_NOW RoundDown RoundFromZero RoundNearest RoundToZero RoundUp STDERR STDIN STDOUT VERSION WORD_SIZE catalan cglobal e|0 eu|0 eulergamma golden im nothing pi γ π φ Inf64 NaN64 RoundNearestTiesAway RoundNearestTiesUp ",built_in:"ANY ASCIIString AbstractArray AbstractRNG AbstractSparseArray Any ArgumentError Array Associative Base64Pipe Bidiagonal BigFloat BigInt BitArray BitMatrix BitVector Bool BoundsError Box CFILE Cchar Cdouble Cfloat Char CharString Cint Clong Clonglong ClusterManager Cmd Coff_t Colon Complex Complex128 Complex32 Complex64 Condition Cptrdiff_t Cshort Csize_t Cssize_t Cuchar Cuint Culong Culonglong Cushort Cwchar_t DArray DataType DenseArray Diagonal Dict DimensionMismatch DirectIndexString Display DivideError DomainError EOFError EachLine Enumerate ErrorException Exception Expr Factorization FileMonitor FileOffset Filter Float16 Float32 Float64 FloatRange FloatingPoint Function GetfieldNode GotoNode Hermitian IO IOBuffer IOStream IPv4 IPv6 InexactError Int Int128 Int16 Int32 Int64 Int8 IntSet Integer InterruptException IntrinsicFunction KeyError LabelNode LambdaStaticData LineNumberNode LoadError LocalProcess MIME MathConst MemoryError MersenneTwister Method MethodError MethodTable Module NTuple NewvarNode Nothing Number ObjectIdDict OrdinalRange OverflowError ParseError PollingFileWatcher ProcessExitedException ProcessGroup Ptr QuoteNode Range Range1 Ranges Rational RawFD Real Regex RegexMatch RemoteRef RepString RevString RopeString RoundingMode Set SharedArray Signed SparseMatrixCSC StackOverflowError Stat StatStruct StepRange String SubArray SubString SymTridiagonal Symbol SymbolNode Symmetric SystemError Task TextDisplay Timer TmStruct TopNode Triangular Tridiagonal Type TypeConstructor TypeError TypeName TypeVar UTF16String UTF32String UTF8String UdpSocket Uint Uint128 Uint16 Uint32 Uint64 Uint8 UndefRefError UndefVarError UniformScaling UnionType UnitRange Unsigned Vararg VersionNumber WString WeakKeyDict WeakRef Woodbury Zip AbstractChannel AbstractFloat AbstractString AssertionError Base64DecodePipe Base64EncodePipe BufferStream CapturedException CartesianIndex CartesianRange Channel Cintmax_t CompositeException Cstring Cuintmax_t Cwstring Date DateTime Dims Enum GenSym GlobalRef HTML InitError InvalidStateException Irrational LinSpace LowerTriangular NullException Nullable OutOfMemoryError Pair PartialQuickSort Pipe RandomDevice ReadOnlyMemoryError ReentrantLock Ref RemoteException SegmentationFault SerializationState SimpleVector TCPSocket Text Tuple UDPSocket UInt UInt128 UInt16 UInt32 UInt64 UInt8 UnicodeError Union UpperTriangular Val Void WorkerConfig AbstractMatrix AbstractSparseMatrix AbstractSparseVector AbstractVecOrMat AbstractVector DenseMatrix DenseVecOrMat DenseVector Matrix SharedMatrix SharedVector StridedArray StridedMatrix StridedVecOrMat StridedVector VecOrMat Vector "},t="[A-Za-z_\\u00A1-\\uFFFF][A-Za-z_0-9\\u00A1-\\uFFFF]*",a={l:t,k:r,i:/<\//},n={cN:"type",b:/::/},o={cN:"type",b:/<:/},i={cN:"number",b:/(\b0x[\d_]*(\.[\d_]*)?|0x\.\d[\d_]*)p[-+]?\d+|\b0[box][a-fA-F0-9][a-fA-F0-9_]*|(\b\d[\d_]*(\.[\d_]*)?|\.\d[\d_]*)([eEfF][-+]?\d+)?/,r:0},l={cN:"string",b:/'(.|\\[xXuU][a-zA-Z0-9]+)'/},c={cN:"subst",b:/\$\(/,e:/\)/,k:r},s={cN:"variable",b:"\\$"+t},d={cN:"string",c:[e.BE,c,s],v:[{b:/\w*"""/,e:/"""\w*/,r:10},{b:/\w*"/,e:/"\w*/}]},S={cN:"string",c:[e.BE,c,s],b:"`",e:"`"},u={cN:"meta",b:"@"+t},g={cN:"comment",v:[{b:"#=",e:"=#",r:10},{b:"#",e:"$"}]};return a.c=[i,l,n,o,d,S,u,g,e.HCM],c.c=a.c,a});hljs.registerLanguage("scss",function(e){var t="[a-zA-Z-][a-zA-Z0-9_-]*",i={cN:"variable",b:"(\\$"+t+")\\b"},r={cN:"number",b:"#[0-9A-Fa-f]+"};({cN:"attribute",b:"[A-Z\\_\\.\\-]+",e:":",eE:!0,i:"[^\\s]",starts:{eW:!0,eE:!0,c:[r,e.CSSNM,e.QSM,e.ASM,e.CBCM,{cN:"meta",b:"!important"}]}});return{cI:!0,i:"[=/|']",c:[e.CLCM,e.CBCM,{cN:"selector-id",b:"\\#[A-Za-z0-9_-]+",r:0},{cN:"selector-class",b:"\\.[A-Za-z0-9_-]+",r:0},{cN:"selector-attr",b:"\\[",e:"\\]",i:"$"},{cN:"selector-tag",b:"\\b(a|abbr|acronym|address|area|article|aside|audio|b|base|big|blockquote|body|br|button|canvas|caption|cite|code|col|colgroup|command|datalist|dd|del|details|dfn|div|dl|dt|em|embed|fieldset|figcaption|figure|footer|form|frame|frameset|(h[1-6])|head|header|hgroup|hr|html|i|iframe|img|input|ins|kbd|keygen|label|legend|li|link|map|mark|meta|meter|nav|noframes|noscript|object|ol|optgroup|option|output|p|param|pre|progress|q|rp|rt|ruby|samp|script|section|select|small|span|strike|strong|style|sub|sup|table|tbody|td|textarea|tfoot|th|thead|time|title|tr|tt|ul|var|video)\\b",r:0},{b:":(visited|valid|root|right|required|read-write|read-only|out-range|optional|only-of-type|only-child|nth-of-type|nth-last-of-type|nth-last-child|nth-child|not|link|left|last-of-type|last-child|lang|invalid|indeterminate|in-range|hover|focus|first-of-type|first-line|first-letter|first-child|first|enabled|empty|disabled|default|checked|before|after|active)"},{b:"::(after|before|choices|first-letter|first-line|repeat-index|repeat-item|selection|value)"},i,{cN:"attribute",b:"\\b(z-index|word-wrap|word-spacing|word-break|width|widows|white-space|visibility|vertical-align|unicode-bidi|transition-timing-function|transition-property|transition-duration|transition-delay|transition|transform-style|transform-origin|transform|top|text-underline-position|text-transform|text-shadow|text-rendering|text-overflow|text-indent|text-decoration-style|text-decoration-line|text-decoration-color|text-decoration|text-align-last|text-align|tab-size|table-layout|right|resize|quotes|position|pointer-events|perspective-origin|perspective|page-break-inside|page-break-before|page-break-after|padding-top|padding-right|padding-left|padding-bottom|padding|overflow-y|overflow-x|overflow-wrap|overflow|outline-width|outline-style|outline-offset|outline-color|outline|orphans|order|opacity|object-position|object-fit|normal|none|nav-up|nav-right|nav-left|nav-index|nav-down|min-width|min-height|max-width|max-height|mask|marks|margin-top|margin-right|margin-left|margin-bottom|margin|list-style-type|list-style-position|list-style-image|list-style|line-height|letter-spacing|left|justify-content|initial|inherit|ime-mode|image-orientation|image-resolution|image-rendering|icon|hyphens|height|font-weight|font-variant-ligatures|font-variant|font-style|font-stretch|font-size-adjust|font-size|font-language-override|font-kerning|font-feature-settings|font-family|font|float|flex-wrap|flex-shrink|flex-grow|flex-flow|flex-direction|flex-basis|flex|filter|empty-cells|display|direction|cursor|counter-reset|counter-increment|content|column-width|column-span|column-rule-width|column-rule-style|column-rule-color|column-rule|column-gap|column-fill|column-count|columns|color|clip-path|clip|clear|caption-side|break-inside|break-before|break-after|box-sizing|box-shadow|box-decoration-break|bottom|border-width|border-top-width|border-top-style|border-top-right-radius|border-top-left-radius|border-top-color|border-top|border-style|border-spacing|border-right-width|border-right-style|border-right-color|border-right|border-radius|border-left-width|border-left-style|border-left-color|border-left|border-image-width|border-image-source|border-image-slice|border-image-repeat|border-image-outset|border-image|border-color|border-collapse|border-bottom-width|border-bottom-style|border-bottom-right-radius|border-bottom-left-radius|border-bottom-color|border-bottom|border|background-size|background-repeat|background-position|background-origin|background-image|background-color|background-clip|background-attachment|background-blend-mode|background|backface-visibility|auto|animation-timing-function|animation-play-state|animation-name|animation-iteration-count|animation-fill-mode|animation-duration|animation-direction|animation-delay|animation|align-self|align-items|align-content)\\b",i:"[^\\s]"},{b:"\\b(whitespace|wait|w-resize|visible|vertical-text|vertical-ideographic|uppercase|upper-roman|upper-alpha|underline|transparent|top|thin|thick|text|text-top|text-bottom|tb-rl|table-header-group|table-footer-group|sw-resize|super|strict|static|square|solid|small-caps|separate|se-resize|scroll|s-resize|rtl|row-resize|ridge|right|repeat|repeat-y|repeat-x|relative|progress|pointer|overline|outside|outset|oblique|nowrap|not-allowed|normal|none|nw-resize|no-repeat|no-drop|newspaper|ne-resize|n-resize|move|middle|medium|ltr|lr-tb|lowercase|lower-roman|lower-alpha|loose|list-item|line|line-through|line-edge|lighter|left|keep-all|justify|italic|inter-word|inter-ideograph|inside|inset|inline|inline-block|inherit|inactive|ideograph-space|ideograph-parenthesis|ideograph-numeric|ideograph-alpha|horizontal|hidden|help|hand|groove|fixed|ellipsis|e-resize|double|dotted|distribute|distribute-space|distribute-letter|distribute-all-lines|disc|disabled|default|decimal|dashed|crosshair|collapse|col-resize|circle|char|center|capitalize|break-word|break-all|bottom|both|bolder|bold|block|bidi-override|below|baseline|auto|always|all-scroll|absolute|table|table-cell)\\b"},{b:":",e:";",c:[i,r,e.CSSNM,e.QSM,e.ASM,{cN:"meta",b:"!important"}]},{b:"@",e:"[{;]",k:"mixin include extend for if else each while charset import debug media page content font-face namespace warn",c:[i,e.QSM,e.ASM,r,e.CSSNM,{b:"\\s[A-Za-z0-9_.-]+",r:0}]}]}});hljs.registerLanguage("perl",function(e){var t="getpwent getservent quotemeta msgrcv scalar kill dbmclose undef lc ma syswrite tr send umask sysopen shmwrite vec qx utime local oct semctl localtime readpipe do return format read sprintf dbmopen pop getpgrp not getpwnam rewinddir qqfileno qw endprotoent wait sethostent bless s|0 opendir continue each sleep endgrent shutdown dump chomp connect getsockname die socketpair close flock exists index shmgetsub for endpwent redo lstat msgctl setpgrp abs exit select print ref gethostbyaddr unshift fcntl syscall goto getnetbyaddr join gmtime symlink semget splice x|0 getpeername recv log setsockopt cos last reverse gethostbyname getgrnam study formline endhostent times chop length gethostent getnetent pack getprotoent getservbyname rand mkdir pos chmod y|0 substr endnetent printf next open msgsnd readdir use unlink getsockopt getpriority rindex wantarray hex system getservbyport endservent int chr untie rmdir prototype tell listen fork shmread ucfirst setprotoent else sysseek link getgrgid shmctl waitpid unpack getnetbyname reset chdir grep split require caller lcfirst until warn while values shift telldir getpwuid my getprotobynumber delete and sort uc defined srand accept package seekdir getprotobyname semop our rename seek if q|0 chroot sysread setpwent no crypt getc chown sqrt write setnetent setpriority foreach tie sin msgget map stat getlogin unless elsif truncate exec keys glob tied closedirioctl socket readlink eval xor readline binmode setservent eof ord bind alarm pipe atan2 getgrent exp time push setgrent gt lt or ne m|0 break given say state when",r={cN:"subst",b:"[$@]\\{",e:"\\}",k:t},s={b:"->{",e:"}"},n={v:[{b:/\$\d/},{b:/[\$%@](\^\w\b|#\w+(::\w+)*|{\w+}|\w+(::\w*)*)/},{b:/[\$%@][^\s\w{]/,r:0}]},i=[e.BE,r,n],o=[n,e.HCM,e.C("^\\=\\w","\\=cut",{eW:!0}),s,{cN:"string",c:i,v:[{b:"q[qwxr]?\\s*\\(",e:"\\)",r:5},{b:"q[qwxr]?\\s*\\[",e:"\\]",r:5},{b:"q[qwxr]?\\s*\\{",e:"\\}",r:5},{b:"q[qwxr]?\\s*\\|",e:"\\|",r:5},{b:"q[qwxr]?\\s*\\<",e:"\\>",r:5},{b:"qw\\s+q",e:"q",r:5},{b:"'",e:"'",c:[e.BE]},{b:'"',e:'"'},{b:"`",e:"`",c:[e.BE]},{b:"{\\w+}",c:[],r:0},{b:"-?\\w+\\s*\\=\\>",c:[],r:0}]},{cN:"number",b:"(\\b0[0-7_]+)|(\\b0x[0-9a-fA-F_]+)|(\\b[1-9][0-9_]*(\\.[0-9_]+)?)|[0_]\\b",r:0},{b:"(\\/\\/|"+e.RSR+"|\\b(split|return|print|reverse|grep)\\b)\\s*",k:"split return print reverse grep",r:0,c:[e.HCM,{cN:"regexp",b:"(s|tr|y)/(\\\\.|[^/])*/(\\\\.|[^/])*/[a-z]*",r:10},{cN:"regexp",b:"(m|qr)?/",e:"/[a-z]*",c:[e.BE],r:0}]},{cN:"function",bK:"sub",e:"(\\s*\\(.*?\\))?[;{]",eE:!0,r:5,c:[e.TM]},{b:"-\\w\\b",r:0},{b:"^__DATA__$",e:"^__END__$",sL:"mojolicious",c:[{b:"^@@.*",e:"$",cN:"comment"}]}];return r.c=o,s.c=o,{aliases:["pl","pm"],l:/[\w\.]+/,k:t,c:o}});hljs.registerLanguage("mojolicious",function(e){return{sL:"xml",c:[{cN:"meta",b:"^__(END|DATA)__$"},{b:"^\\s*%{1,2}={0,2}",e:"$",sL:"perl"},{b:"<%{1,2}={0,2}",e:"={0,1}%>",sL:"perl",eB:!0,eE:!0}]}});hljs.registerLanguage("lsl",function(E){var T={cN:"subst",b:/\\[tn"\\]/},e={cN:"string",b:'"',e:'"',c:[T]},A={cN:"number",b:E.CNR},R={cN:"literal",v:[{b:"\\b(?:PI|TWO_PI|PI_BY_TWO|DEG_TO_RAD|RAD_TO_DEG|SQRT2)\\b"},{b:"\\b(?:XP_ERROR_(?:EXPERIENCES_DISABLED|EXPERIENCE_(?:DISABLED|SUSPENDED)|INVALID_(?:EXPERIENCE|PARAMETERS)|KEY_NOT_FOUND|MATURITY_EXCEEDED|NONE|NOT_(?:FOUND|PERMITTED(?:_LAND)?)|NO_EXPERIENCE|QUOTA_EXCEEDED|RETRY_UPDATE|STORAGE_EXCEPTION|STORE_DISABLED|THROTTLED|UNKNOWN_ERROR)|JSON_APPEND|STATUS_(?:PHYSICS|ROTATE_[XYZ]|PHANTOM|SANDBOX|BLOCK_GRAB(?:_OBJECT)?|(?:DIE|RETURN)_AT_EDGE|CAST_SHADOWS|OK|MALFORMED_PARAMS|TYPE_MISMATCH|BOUNDS_ERROR|NOT_(?:FOUND|SUPPORTED)|INTERNAL_ERROR|WHITELIST_FAILED)|AGENT(?:_(?:BY_(?:LEGACY_|USER)NAME|FLYING|ATTACHMENTS|SCRIPTED|MOUSELOOK|SITTING|ON_OBJECT|AWAY|WALKING|IN_AIR|TYPING|CROUCHING|BUSY|ALWAYS_RUN|AUTOPILOT|LIST_(?:PARCEL(?:_OWNER)?|REGION)))?|CAMERA_(?:PITCH|DISTANCE|BEHINDNESS_(?:ANGLE|LAG)|(?:FOCUS|POSITION)(?:_(?:THRESHOLD|LOCKED|LAG))?|FOCUS_OFFSET|ACTIVE)|ANIM_ON|LOOP|REVERSE|PING_PONG|SMOOTH|ROTATE|SCALE|ALL_SIDES|LINK_(?:ROOT|SET|ALL_(?:OTHERS|CHILDREN)|THIS)|ACTIVE|PASS(?:IVE|_(?:ALWAYS|IF_NOT_HANDLED|NEVER))|SCRIPTED|CONTROL_(?:FWD|BACK|(?:ROT_)?(?:LEFT|RIGHT)|UP|DOWN|(?:ML_)?LBUTTON)|PERMISSION_(?:RETURN_OBJECTS|DEBIT|OVERRIDE_ANIMATIONS|SILENT_ESTATE_MANAGEMENT|TAKE_CONTROLS|TRIGGER_ANIMATION|ATTACH|CHANGE_LINKS|(?:CONTROL|TRACK)_CAMERA|TELEPORT)|INVENTORY_(?:TEXTURE|SOUND|OBJECT|SCRIPT|LANDMARK|CLOTHING|NOTECARD|BODYPART|ANIMATION|GESTURE|ALL|NONE)|CHANGED_(?:INVENTORY|COLOR|SHAPE|SCALE|TEXTURE|LINK|ALLOWED_DROP|OWNER|REGION(?:_START)?|TELEPORT|MEDIA)|OBJECT_(?:CLICK_ACTION|HOVER_HEIGHT|LAST_OWNER_ID|(?:PHYSICS|SERVER|STREAMING)_COST|UNKNOWN_DETAIL|CHARACTER_TIME|PHANTOM|PHYSICS|TEMP_ON_REZ|NAME|DESC|POS|PRIM_(?:COUNT|EQUIVALENCE)|RETURN_(?:PARCEL(?:_OWNER)?|REGION)|REZZER_KEY|ROO?T|VELOCITY|OMEGA|OWNER|GROUP|CREATOR|ATTACHED_POINT|RENDER_WEIGHT|(?:BODY_SHAPE|PATHFINDING)_TYPE|(?:RUNNING|TOTAL)_SCRIPT_COUNT|TOTAL_INVENTORY_COUNT|SCRIPT_(?:MEMORY|TIME))|TYPE_(?:INTEGER|FLOAT|STRING|KEY|VECTOR|ROTATION|INVALID)|(?:DEBUG|PUBLIC)_CHANNEL|ATTACH_(?:AVATAR_CENTER|CHEST|HEAD|BACK|PELVIS|MOUTH|CHIN|NECK|NOSE|BELLY|[LR](?:SHOULDER|HAND|FOOT|EAR|EYE|[UL](?:ARM|LEG)|HIP)|(?:LEFT|RIGHT)_PEC|HUD_(?:CENTER_[12]|TOP_(?:RIGHT|CENTER|LEFT)|BOTTOM(?:_(?:RIGHT|LEFT))?)|[LR]HAND_RING1|TAIL_(?:BASE|TIP)|[LR]WING|FACE_(?:JAW|[LR]EAR|[LR]EYE|TOUNGE)|GROIN|HIND_[LR]FOOT)|LAND_(?:LEVEL|RAISE|LOWER|SMOOTH|NOISE|REVERT)|DATA_(?:ONLINE|NAME|BORN|SIM_(?:POS|STATUS|RATING)|PAYINFO)|PAYMENT_INFO_(?:ON_FILE|USED)|REMOTE_DATA_(?:CHANNEL|REQUEST|REPLY)|PSYS_(?:PART_(?:BF_(?:ZERO|ONE(?:_MINUS_(?:DEST_COLOR|SOURCE_(ALPHA|COLOR)))?|DEST_COLOR|SOURCE_(ALPHA|COLOR))|BLEND_FUNC_(DEST|SOURCE)|FLAGS|(?:START|END)_(?:COLOR|ALPHA|SCALE|GLOW)|MAX_AGE|(?:RIBBON|WIND|INTERP_(?:COLOR|SCALE)|BOUNCE|FOLLOW_(?:SRC|VELOCITY)|TARGET_(?:POS|LINEAR)|EMISSIVE)_MASK)|SRC_(?:MAX_AGE|PATTERN|ANGLE_(?:BEGIN|END)|BURST_(?:RATE|PART_COUNT|RADIUS|SPEED_(?:MIN|MAX))|ACCEL|TEXTURE|TARGET_KEY|OMEGA|PATTERN_(?:DROP|EXPLODE|ANGLE(?:_CONE(?:_EMPTY)?)?)))|VEHICLE_(?:REFERENCE_FRAME|TYPE_(?:NONE|SLED|CAR|BOAT|AIRPLANE|BALLOON)|(?:LINEAR|ANGULAR)_(?:FRICTION_TIMESCALE|MOTOR_DIRECTION)|LINEAR_MOTOR_OFFSET|HOVER_(?:HEIGHT|EFFICIENCY|TIMESCALE)|BUOYANCY|(?:LINEAR|ANGULAR)_(?:DEFLECTION_(?:EFFICIENCY|TIMESCALE)|MOTOR_(?:DECAY_)?TIMESCALE)|VERTICAL_ATTRACTION_(?:EFFICIENCY|TIMESCALE)|BANKING_(?:EFFICIENCY|MIX|TIMESCALE)|FLAG_(?:NO_DEFLECTION_UP|LIMIT_(?:ROLL_ONLY|MOTOR_UP)|HOVER_(?:(?:WATER|TERRAIN|UP)_ONLY|GLOBAL_HEIGHT)|MOUSELOOK_(?:STEER|BANK)|CAMERA_DECOUPLED))|PRIM_(?:ALPHA_MODE(?:_(?:BLEND|EMISSIVE|MASK|NONE))?|NORMAL|SPECULAR|TYPE(?:_(?:BOX|CYLINDER|PRISM|SPHERE|TORUS|TUBE|RING|SCULPT))?|HOLE_(?:DEFAULT|CIRCLE|SQUARE|TRIANGLE)|MATERIAL(?:_(?:STONE|METAL|GLASS|WOOD|FLESH|PLASTIC|RUBBER))?|SHINY_(?:NONE|LOW|MEDIUM|HIGH)|BUMP_(?:NONE|BRIGHT|DARK|WOOD|BARK|BRICKS|CHECKER|CONCRETE|TILE|STONE|DISKS|GRAVEL|BLOBS|SIDING|LARGETILE|STUCCO|SUCTION|WEAVE)|TEXGEN_(?:DEFAULT|PLANAR)|SCULPT_(?:TYPE_(?:SPHERE|TORUS|PLANE|CYLINDER|MASK)|FLAG_(?:MIRROR|INVERT))|PHYSICS(?:_(?:SHAPE_(?:CONVEX|NONE|PRIM|TYPE)))?|(?:POS|ROT)_LOCAL|SLICE|TEXT|FLEXIBLE|POINT_LIGHT|TEMP_ON_REZ|PHANTOM|POSITION|SIZE|ROTATION|TEXTURE|NAME|OMEGA|DESC|LINK_TARGET|COLOR|BUMP_SHINY|FULLBRIGHT|TEXGEN|GLOW|MEDIA_(?:ALT_IMAGE_ENABLE|CONTROLS|(?:CURRENT|HOME)_URL|AUTO_(?:LOOP|PLAY|SCALE|ZOOM)|FIRST_CLICK_INTERACT|(?:WIDTH|HEIGHT)_PIXELS|WHITELIST(?:_ENABLE)?|PERMS_(?:INTERACT|CONTROL)|PARAM_MAX|CONTROLS_(?:STANDARD|MINI)|PERM_(?:NONE|OWNER|GROUP|ANYONE)|MAX_(?:URL_LENGTH|WHITELIST_(?:SIZE|COUNT)|(?:WIDTH|HEIGHT)_PIXELS)))|MASK_(?:BASE|OWNER|GROUP|EVERYONE|NEXT)|PERM_(?:TRANSFER|MODIFY|COPY|MOVE|ALL)|PARCEL_(?:MEDIA_COMMAND_(?:STOP|PAUSE|PLAY|LOOP|TEXTURE|URL|TIME|AGENT|UNLOAD|AUTO_ALIGN|TYPE|SIZE|DESC|LOOP_SET)|FLAG_(?:ALLOW_(?:FLY|(?:GROUP_)?SCRIPTS|LANDMARK|TERRAFORM|DAMAGE|CREATE_(?:GROUP_)?OBJECTS)|USE_(?:ACCESS_(?:GROUP|LIST)|BAN_LIST|LAND_PASS_LIST)|LOCAL_SOUND_ONLY|RESTRICT_PUSHOBJECT|ALLOW_(?:GROUP|ALL)_OBJECT_ENTRY)|COUNT_(?:TOTAL|OWNER|GROUP|OTHER|SELECTED|TEMP)|DETAILS_(?:NAME|DESC|OWNER|GROUP|AREA|ID|SEE_AVATARS))|LIST_STAT_(?:MAX|MIN|MEAN|MEDIAN|STD_DEV|SUM(?:_SQUARES)?|NUM_COUNT|GEOMETRIC_MEAN|RANGE)|PAY_(?:HIDE|DEFAULT)|REGION_FLAG_(?:ALLOW_DAMAGE|FIXED_SUN|BLOCK_TERRAFORM|SANDBOX|DISABLE_(?:COLLISIONS|PHYSICS)|BLOCK_FLY|ALLOW_DIRECT_TELEPORT|RESTRICT_PUSHOBJECT)|HTTP_(?:METHOD|MIMETYPE|BODY_(?:MAXLENGTH|TRUNCATED)|CUSTOM_HEADER|PRAGMA_NO_CACHE|VERBOSE_THROTTLE|VERIFY_CERT)|STRING_(?:TRIM(?:_(?:HEAD|TAIL))?)|CLICK_ACTION_(?:NONE|TOUCH|SIT|BUY|PAY|OPEN(?:_MEDIA)?|PLAY|ZOOM)|TOUCH_INVALID_FACE|PROFILE_(?:NONE|SCRIPT_MEMORY)|RC_(?:DATA_FLAGS|DETECT_PHANTOM|GET_(?:LINK_NUM|NORMAL|ROOT_KEY)|MAX_HITS|REJECT_(?:TYPES|AGENTS|(?:NON)?PHYSICAL|LAND))|RCERR_(?:CAST_TIME_EXCEEDED|SIM_PERF_LOW|UNKNOWN)|ESTATE_ACCESS_(?:ALLOWED_(?:AGENT|GROUP)_(?:ADD|REMOVE)|BANNED_AGENT_(?:ADD|REMOVE))|DENSITY|FRICTION|RESTITUTION|GRAVITY_MULTIPLIER|KFM_(?:COMMAND|CMD_(?:PLAY|STOP|PAUSE)|MODE|FORWARD|LOOP|PING_PONG|REVERSE|DATA|ROTATION|TRANSLATION)|ERR_(?:GENERIC|PARCEL_PERMISSIONS|MALFORMED_PARAMS|RUNTIME_PERMISSIONS|THROTTLED)|CHARACTER_(?:CMD_(?:(?:SMOOTH_)?STOP|JUMP)|DESIRED_(?:TURN_)?SPEED|RADIUS|STAY_WITHIN_PARCEL|LENGTH|ORIENTATION|ACCOUNT_FOR_SKIPPED_FRAMES|AVOIDANCE_MODE|TYPE(?:_(?:[ABCD]|NONE))?|MAX_(?:DECEL|TURN_RADIUS|(?:ACCEL|SPEED)))|PURSUIT_(?:OFFSET|FUZZ_FACTOR|GOAL_TOLERANCE|INTERCEPT)|REQUIRE_LINE_OF_SIGHT|FORCE_DIRECT_PATH|VERTICAL|HORIZONTAL|AVOID_(?:CHARACTERS|DYNAMIC_OBSTACLES|NONE)|PU_(?:EVADE_(?:HIDDEN|SPOTTED)|FAILURE_(?:DYNAMIC_PATHFINDING_DISABLED|INVALID_(?:GOAL|START)|NO_(?:NAVMESH|VALID_DESTINATION)|OTHER|TARGET_GONE|(?:PARCEL_)?UNREACHABLE)|(?:GOAL|SLOWDOWN_DISTANCE)_REACHED)|TRAVERSAL_TYPE(?:_(?:FAST|NONE|SLOW))?|CONTENT_TYPE_(?:ATOM|FORM|HTML|JSON|LLSD|RSS|TEXT|XHTML|XML)|GCNP_(?:RADIUS|STATIC)|(?:PATROL|WANDER)_PAUSE_AT_WAYPOINTS|OPT_(?:AVATAR|CHARACTER|EXCLUSION_VOLUME|LEGACY_LINKSET|MATERIAL_VOLUME|OTHER|STATIC_OBSTACLE|WALKABLE)|SIM_STAT_PCT_CHARS_STEPPED)\\b"},{b:"\\b(?:FALSE|TRUE)\\b"},{b:"\\b(?:ZERO_ROTATION)\\b"},{b:"\\b(?:EOF|JSON_(?:ARRAY|DELETE|FALSE|INVALID|NULL|NUMBER|OBJECT|STRING|TRUE)|NULL_KEY|TEXTURE_(?:BLANK|DEFAULT|MEDIA|PLYWOOD|TRANSPARENT)|URL_REQUEST_(?:GRANTED|DENIED))\\b"},{b:"\\b(?:ZERO_VECTOR|TOUCH_INVALID_(?:TEXCOORD|VECTOR))\\b"}]},O={cN:"built_in",b:"\\b(?:ll(?:AgentInExperience|(?:Create|DataSize|Delete|KeyCount|Keys|Read|Update)KeyValue|GetExperience(?:Details|ErrorMessage)|ReturnObjectsBy(?:ID|Owner)|Json(?:2List|[GS]etValue|ValueType)|Sin|Cos|Tan|Atan2|Sqrt|Pow|Abs|Fabs|Frand|Floor|Ceil|Round|Vec(?:Mag|Norm|Dist)|Rot(?:Between|2(?:Euler|Fwd|Left|Up))|(?:Euler|Axes)2Rot|Whisper|(?:Region|Owner)?Say|Shout|Listen(?:Control|Remove)?|Sensor(?:Repeat|Remove)?|Detected(?:Name|Key|Owner|Type|Pos|Vel|Grab|Rot|Group|LinkNumber)|Die|Ground|Wind|(?:[GS]et)(?:AnimationOverride|MemoryLimit|PrimMediaParams|ParcelMusicURL|Object(?:Desc|Name)|PhysicsMaterial|Status|Scale|Color|Alpha|Texture|Pos|Rot|Force|Torque)|ResetAnimationOverride|(?:Scale|Offset|Rotate)Texture|(?:Rot)?Target(?:Remove)?|(?:Stop)?MoveToTarget|Apply(?:Rotational)?Impulse|Set(?:KeyframedMotion|ContentType|RegionPos|(?:Angular)?Velocity|Buoyancy|HoverHeight|ForceAndTorque|TimerEvent|ScriptState|Damage|TextureAnim|Sound(?:Queueing|Radius)|Vehicle(?:Type|(?:Float|Vector|Rotation)Param)|(?:Touch|Sit)?Text|Camera(?:Eye|At)Offset|PrimitiveParams|ClickAction|Link(?:Alpha|Color|PrimitiveParams(?:Fast)?|Texture(?:Anim)?|Camera|Media)|RemoteScriptAccessPin|PayPrice|LocalRot)|ScaleByFactor|Get(?:(?:Max|Min)ScaleFactor|ClosestNavPoint|StaticPath|SimStats|Env|PrimitiveParams|Link(?:PrimitiveParams|Number(?:OfSides)?|Key|Name|Media)|HTTPHeader|FreeURLs|Object(?:Details|PermMask|PrimCount)|Parcel(?:MaxPrims|Details|Prim(?:Count|Owners))|Attached(?:List)?|(?:SPMax|Free|Used)Memory|Region(?:Name|TimeDilation|FPS|Corner|AgentCount)|Root(?:Position|Rotation)|UnixTime|(?:Parcel|Region)Flags|(?:Wall|GMT)clock|SimulatorHostname|BoundingBox|GeometricCenter|Creator|NumberOf(?:Prims|NotecardLines|Sides)|Animation(?:List)?|(?:Camera|Local)(?:Pos|Rot)|Vel|Accel|Omega|Time(?:stamp|OfDay)|(?:Object|CenterOf)?Mass|MassMKS|Energy|Owner|(?:Owner)?Key|SunDirection|Texture(?:Offset|Scale|Rot)|Inventory(?:Number|Name|Key|Type|Creator|PermMask)|Permissions(?:Key)?|StartParameter|List(?:Length|EntryType)|Date|Agent(?:Size|Info|Language|List)|LandOwnerAt|NotecardLine|Script(?:Name|State))|(?:Get|Reset|GetAndReset)Time|PlaySound(?:Slave)?|LoopSound(?:Master|Slave)?|(?:Trigger|Stop|Preload)Sound|(?:(?:Get|Delete)Sub|Insert)String|To(?:Upper|Lower)|Give(?:InventoryList|Money)|RezObject|(?:Stop)?LookAt|Sleep|CollisionFilter|(?:Take|Release)Controls|DetachFromAvatar|AttachToAvatar(?:Temp)?|InstantMessage|(?:GetNext)?Email|StopHover|MinEventDelay|RotLookAt|String(?:Length|Trim)|(?:Start|Stop)Animation|TargetOmega|Request(?:Experience)?Permissions|(?:Create|Break)Link|BreakAllLinks|(?:Give|Remove)Inventory|Water|PassTouches|Request(?:Agent|Inventory)Data|TeleportAgent(?:Home|GlobalCoords)?|ModifyLand|CollisionSound|ResetScript|MessageLinked|PushObject|PassCollisions|AxisAngle2Rot|Rot2(?:Axis|Angle)|A(?:cos|sin)|AngleBetween|AllowInventoryDrop|SubStringIndex|List2(?:CSV|Integer|Json|Float|String|Key|Vector|Rot|List(?:Strided)?)|DeleteSubList|List(?:Statistics|Sort|Randomize|(?:Insert|Find|Replace)List)|EdgeOfWorld|AdjustSoundVolume|Key2Name|TriggerSoundLimited|EjectFromLand|(?:CSV|ParseString)2List|OverMyLand|SameGroup|UnSit|Ground(?:Slope|Normal|Contour)|GroundRepel|(?:Set|Remove)VehicleFlags|(?:AvatarOn)?(?:Link)?SitTarget|Script(?:Danger|Profiler)|Dialog|VolumeDetect|ResetOtherScript|RemoteLoadScriptPin|(?:Open|Close)RemoteDataChannel|SendRemoteData|RemoteDataReply|(?:Integer|String)ToBase64|XorBase64|Log(?:10)?|Base64To(?:String|Integer)|ParseStringKeepNulls|RezAtRoot|RequestSimulatorData|ForceMouselook|(?:Load|Release|(?:E|Une)scape)URL|ParcelMedia(?:CommandList|Query)|ModPow|MapDestination|(?:RemoveFrom|AddTo|Reset)Land(?:Pass|Ban)List|(?:Set|Clear)CameraParams|HTTP(?:Request|Response)|TextBox|DetectedTouch(?:UV|Face|Pos|(?:N|Bin)ormal|ST)|(?:MD5|SHA1|DumpList2)String|Request(?:Secure)?URL|Clear(?:Prim|Link)Media|(?:Link)?ParticleSystem|(?:Get|Request)(?:Username|DisplayName)|RegionSayTo|CastRay|GenerateKey|TransferLindenDollars|ManageEstateAccess|(?:Create|Delete)Character|ExecCharacterCmd|Evade|FleeFrom|NavigateTo|PatrolPoints|Pursue|UpdateCharacter|WanderWithin))\\b"};return{i:":",c:[e,{cN:"comment",v:[E.C("//","$"),E.C("/\\*","\\*/")]},A,{cN:"section",v:[{b:"\\b(?:state|default)\\b"},{b:"\\b(?:state_(?:entry|exit)|touch(?:_(?:start|end))?|(?:land_)?collision(?:_(?:start|end))?|timer|listen|(?:no_)?sensor|control|(?:not_)?at_(?:rot_)?target|money|email|experience_permissions(?:_denied)?|run_time_permissions|changed|attach|dataserver|moving_(?:start|end)|link_message|(?:on|object)_rez|remote_data|http_re(?:sponse|quest)|path_update|transaction_result)\\b"}]},O,R,{cN:"type",b:"\\b(?:integer|float|string|key|vector|quaternion|rotation|list)\\b"}]}});hljs.registerLanguage("dos",function(e){var r=e.C(/^\s*@?rem\b/,/$/,{r:10}),t={cN:"symbol",b:"^\\s*[A-Za-z._?][A-Za-z0-9_$#@~.?]*(:|\\s+label)",r:0};return{aliases:["bat","cmd"],cI:!0,i:/\/\*/,k:{keyword:"if else goto for in do call exit not exist errorlevel defined equ neq lss leq gtr geq",built_in:"prn nul lpt3 lpt2 lpt1 con com4 com3 com2 com1 aux shift cd dir echo setlocal endlocal set pause copy append assoc at attrib break cacls cd chcp chdir chkdsk chkntfs cls cmd color comp compact convert date dir diskcomp diskcopy doskey erase fs find findstr format ftype graftabl help keyb label md mkdir mode more move path pause print popd pushd promt rd recover rem rename replace restore rmdir shiftsort start subst time title tree type ver verify vol ping net ipconfig taskkill xcopy ren del"},c:[{cN:"variable",b:/%%[^ ]|%[^ ]+?%|![^ ]+?!/},{cN:"function",b:t.b,e:"goto:eof",c:[e.inherit(e.TM,{b:"([_a-zA-Z]\\w*\\.)*([_a-zA-Z]\\w*:)?[_a-zA-Z]\\w*"}),r]},{cN:"number",b:"\\b\\d+",r:0},r]}});hljs.registerLanguage("puppet",function(e){var s={keyword:"and case default else elsif false if in import enherits node or true undef unless main settings $string ",literal:"alias audit before loglevel noop require subscribe tag owner ensure group mode name|0 changes context force incl lens load_path onlyif provider returns root show_diff type_check en_address ip_address realname command environment hour monute month monthday special target weekday creates cwd ogoutput refresh refreshonly tries try_sleep umask backup checksum content ctime force ignore links mtime purge recurse recurselimit replace selinux_ignore_defaults selrange selrole seltype seluser source souirce_permissions sourceselect validate_cmd validate_replacement allowdupe attribute_membership auth_membership forcelocal gid ia_load_module members system host_aliases ip allowed_trunk_vlans description device_url duplex encapsulation etherchannel native_vlan speed principals allow_root auth_class auth_type authenticate_user k_of_n mechanisms rule session_owner shared options device fstype enable hasrestart directory present absent link atboot blockdevice device dump pass remounts poller_tag use message withpath adminfile allow_virtual allowcdrom category configfiles flavor install_options instance package_settings platform responsefile status uninstall_options vendor unless_system_user unless_uid binary control flags hasstatus manifest pattern restart running start stop allowdupe auths expiry gid groups home iterations key_membership keys managehome membership password password_max_age password_min_age profile_membership profiles project purge_ssh_keys role_membership roles salt shell uid baseurl cost descr enabled enablegroups exclude failovermethod gpgcheck gpgkey http_caching include includepkgs keepalive metadata_expire metalink mirrorlist priority protect proxy proxy_password proxy_username repo_gpgcheck s3_enabled skip_if_unavailable sslcacert sslclientcert sslclientkey sslverify mounted",built_in:"architecture augeasversion blockdevices boardmanufacturer boardproductname boardserialnumber cfkey dhcp_servers domain ec2_ ec2_userdata facterversion filesystems ldom fqdn gid hardwareisa hardwaremodel hostname id|0 interfaces ipaddress ipaddress_ ipaddress6 ipaddress6_ iphostnumber is_virtual kernel kernelmajversion kernelrelease kernelversion kernelrelease kernelversion lsbdistcodename lsbdistdescription lsbdistid lsbdistrelease lsbmajdistrelease lsbminordistrelease lsbrelease macaddress macaddress_ macosx_buildversion macosx_productname macosx_productversion macosx_productverson_major macosx_productversion_minor manufacturer memoryfree memorysize netmask metmask_ network_ operatingsystem operatingsystemmajrelease operatingsystemrelease osfamily partitions path physicalprocessorcount processor processorcount productname ps puppetversion rubysitedir rubyversion selinux selinux_config_mode selinux_config_policy selinux_current_mode selinux_current_mode selinux_enforced selinux_policyversion serialnumber sp_ sshdsakey sshecdsakey sshrsakey swapencrypted swapfree swapsize timezone type uniqueid uptime uptime_days uptime_hours uptime_seconds uuid virtual vlans xendomains zfs_version zonenae zones zpool_version"},r=e.C("#","$"),a="([A-Za-z_]|::)(\\w|::)*",i=e.inherit(e.TM,{b:a}),o={cN:"variable",b:"\\$"+a},t={cN:"string",c:[e.BE,o],v:[{b:/'/,e:/'/},{b:/"/,e:/"/}]};return{aliases:["pp"],c:[r,o,t,{bK:"class",e:"\\{|;",i:/=/,c:[i,r]},{bK:"define",e:/\{/,c:[{cN:"section",b:e.IR,endsParent:!0}]},{b:e.IR+"\\s+\\{",rB:!0,e:/\S/,c:[{cN:"keyword",b:e.IR},{b:/\{/,e:/\}/,k:s,r:0,c:[t,r,{b:"[a-zA-Z_]+\\s*=>",rB:!0,e:"=>",c:[{cN:"attr",b:e.IR}]},{cN:"number",b:"(\\b0[0-7_]+)|(\\b0x[0-9a-fA-F_]+)|(\\b[1-9][0-9_]*(\\.[0-9_]+)?)|[0_]\\b",r:0},o]}],r:0}]}});hljs.registerLanguage("swift",function(e){var t={keyword:"__COLUMN__ __FILE__ __FUNCTION__ __LINE__ as as! as? associativity break case catch class continue convenience default defer deinit didSet do dynamic dynamicType else enum extension fallthrough false final for func get guard if import in indirect infix init inout internal is lazy left let mutating nil none nonmutating operator optional override postfix precedence prefix private protocol Protocol public repeat required rethrows return right self Self set static struct subscript super switch throw throws true try try! try? Type typealias unowned var weak where while willSet",literal:"true false nil",built_in:"abs advance alignof alignofValue anyGenerator assert assertionFailure bridgeFromObjectiveC bridgeFromObjectiveCUnconditional bridgeToObjectiveC bridgeToObjectiveCUnconditional c contains count countElements countLeadingZeros debugPrint debugPrintln distance dropFirst dropLast dump encodeBitsAsWords enumerate equal fatalError filter find getBridgedObjectiveCType getVaList indices insertionSort isBridgedToObjectiveC isBridgedVerbatimToObjectiveC isUniquelyReferenced isUniquelyReferencedNonObjC join lazy lexicographicalCompare map max maxElement min minElement numericCast overlaps partition posix precondition preconditionFailure print println quickSort readLine reduce reflect reinterpretCast reverse roundUpToAlignment sizeof sizeofValue sort split startsWith stride strideof strideofValue swap toString transcode underestimateCount unsafeAddressOf unsafeBitCast unsafeDowncast unsafeUnwrap unsafeReflect withExtendedLifetime withObjectAtPlusZero withUnsafePointer withUnsafePointerToObject withUnsafeMutablePointer withUnsafeMutablePointers withUnsafePointer withUnsafePointers withVaList zip"},i={cN:"type",b:"\\b[A-Z][\\wÀ-ʸ']*",r:0},n=e.C("/\\*","\\*/",{c:["self"]}),r={cN:"subst",b:/\\\(/,e:"\\)",k:t,c:[]},a={cN:"number",b:"\\b([\\d_]+(\\.[\\deE_]+)?|0x[a-fA-F0-9_]+(\\.[a-fA-F0-9p_]+)?|0b[01_]+|0o[0-7_]+)\\b",r:0},o=e.inherit(e.QSM,{c:[r,e.BE]});return r.c=[a],{k:t,c:[o,e.CLCM,n,i,a,{cN:"function",bK:"func",e:"{",eE:!0,c:[e.inherit(e.TM,{b:/[A-Za-z$_][0-9A-Za-z$_]*/}),{b://},{cN:"params",b:/\(/,e:/\)/,endsParent:!0,k:t,c:["self",a,o,e.CBCM,{b:":"}],i:/["']/}],i:/\[|%/},{cN:"class",bK:"struct protocol class extension enum",k:t,e:"\\{",eE:!0,c:[e.inherit(e.TM,{b:/[A-Za-z$_][\u00C0-\u02B80-9A-Za-z$_]*/})]},{cN:"meta",b:"(@warn_unused_result|@exported|@lazy|@noescape|@NSCopying|@NSManaged|@objc|@convention|@required|@noreturn|@IBAction|@IBDesignable|@IBInspectable|@IBOutlet|@infix|@prefix|@postfix|@autoclosure|@testable|@available|@nonobjc|@NSApplicationMain|@UIApplicationMain)"},{bK:"import",e:/$/,c:[e.CLCM,n]}]}});hljs.registerLanguage("gcode",function(N){var e="[A-Z_][A-Z0-9_.]*",c="\\%",E="IF DO WHILE ENDWHILE CALL ENDIF SUB ENDSUB GOTO REPEAT ENDREPEAT EQ LT GT NE GE LE OR XOR",i={cN:"meta",b:"([O])([0-9]+)"},n=[N.CLCM,N.CBCM,N.C(/\(/,/\)/),N.inherit(N.CNM,{b:"([-+]?([0-9]*\\.?[0-9]+\\.?))|"+N.CNR}),N.inherit(N.ASM,{i:null}),N.inherit(N.QSM,{i:null}),{cN:"name",b:"([G])([0-9]+\\.?[0-9]?)"},{cN:"name",b:"([M])([0-9]+\\.?[0-9]?)"},{cN:"attr",b:"(VC|VS|#)",e:"(\\d+)"},{cN:"attr",b:"(VZOFX|VZOFY|VZOFZ)"},{cN:"built_in",b:"(ATAN|ABS|ACOS|ASIN|SIN|COS|EXP|FIX|FUP|ROUND|LN|TAN)(\\[)",e:"([-+]?([0-9]*\\.?[0-9]+\\.?))(\\])"},{cN:"symbol",v:[{b:"N",e:"\\d+",i:"\\W"}]}];return{aliases:["nc"],cI:!0,l:e,k:E,c:[{cN:"meta",b:c},i].concat(n)}});hljs.registerLanguage("ceylon",function(e){var a="assembly module package import alias class interface object given value assign void function new of extends satisfies abstracts in out return break continue throw assert dynamic if else switch case for while try catch finally then let this outer super is exists nonempty",t="shared abstract formal default actual variable late native deprecatedfinal sealed annotation suppressWarnings small",s="doc by license see throws tagged",n={cN:"subst",eB:!0,eE:!0,b:/``/,e:/``/,k:a,r:10},r=[{cN:"string",b:'"""',e:'"""',r:10},{cN:"string",b:'"',e:'"',c:[n]},{cN:"string",b:"'",e:"'"},{cN:"number",b:"#[0-9a-fA-F_]+|\\$[01_]+|[0-9_]+(?:\\.[0-9_](?:[eE][+-]?\\d+)?)?[kMGTPmunpf]?",r:0}];return n.c=r,{k:{keyword:a+" "+t,meta:s},i:"\\$[^01]|#[^0-9a-fA-F]",c:[e.CLCM,e.C("/\\*","\\*/",{c:["self"]}),{cN:"meta",b:'@[a-z]\\w*(?:\\:"[^"]*")?'}].concat(r)}});hljs.registerLanguage("bash",function(e){var t={cN:"variable",v:[{b:/\$[\w\d#@][\w\d_]*/},{b:/\$\{(.*?)}/}]},s={cN:"string",b:/"/,e:/"/,c:[e.BE,t,{cN:"variable",b:/\$\(/,e:/\)/,c:[e.BE]}]},a={cN:"string",b:/'/,e:/'/};return{aliases:["sh","zsh"],l:/-?[a-z\._]+/,k:{keyword:"if then else elif fi for while in do done case esac function",literal:"true false",built_in:"break cd continue eval exec exit export getopts hash pwd readonly return shift test times trap umask unset alias bind builtin caller command declare echo enable help let local logout mapfile printf read readarray source type typeset ulimit unalias set shopt autoload bg bindkey bye cap chdir clone comparguments compcall compctl compdescribe compfiles compgroups compquote comptags comptry compvalues dirs disable disown echotc echoti emulate fc fg float functions getcap getln history integer jobs kill limit log noglob popd print pushd pushln rehash sched setcap setopt stat suspend ttyctl unfunction unhash unlimit unsetopt vared wait whence where which zcompile zformat zftp zle zmodload zparseopts zprof zpty zregexparse zsocket zstyle ztcp",_:"-ne -eq -lt -gt -f -d -e -s -l -a"},c:[{cN:"meta",b:/^#![^\n]+sh\s*$/,r:10},{cN:"function",b:/\w[\w\d_]*\s*\(\s*\)\s*\{/,rB:!0,c:[e.inherit(e.TM,{b:/\w[\w\d_]*/})],r:0},e.HCM,s,a,t]}});hljs.registerLanguage("dockerfile",function(e){return{aliases:["docker"],cI:!0,k:"from maintainer expose env arg user onbuild stopsignal",c:[e.HCM,e.ASM,e.QSM,e.NM,{bK:"run cmd entrypoint volume add copy workdir label healthcheck shell",starts:{e:/[^\\]\n/,sL:"bash"}}],i:"",o={cN:"params",b:"\\([^\\(]",rB:!0,c:[{b:/\(/,e:/\)/,k:c,c:["self"].concat(i)}]};return{aliases:["coffee","cson","iced"],k:c,i:/\/\*/,c:i.concat([e.C("###","###"),e.HCM,{cN:"function",b:"^\\s*"+n+"\\s*=\\s*"+t,e:"[-=]>",rB:!0,c:[s,o]},{b:/[:\(,=]\s*/,r:0,c:[{cN:"function",b:t,e:"[-=]>",rB:!0,c:[o]}]},{cN:"class",bK:"class",e:"$",i:/[:="\[\]]/,c:[{bK:"extends",eW:!0,i:/[:="\[\]]/,c:[s]},s]},{b:n+":",e:":",rB:!0,rE:!0,r:0}])}});hljs.registerLanguage("protobuf",function(e){return{k:{keyword:"package import option optional required repeated group",built_in:"double float int32 int64 uint32 uint64 sint32 sint64 fixed32 fixed64 sfixed32 sfixed64 bool string bytes",literal:"true false"},c:[e.QSM,e.NM,e.CLCM,{cN:"class",bK:"message enum service",e:/\{/,i:/\n/,c:[e.inherit(e.TM,{starts:{eW:!0,eE:!0}})]},{cN:"function",bK:"rpc",e:/;/,eE:!0,k:"rpc returns"},{b:/^\s*[A-Z_]+/,e:/\s*=/,eE:!0}]}});hljs.registerLanguage("matlab",function(e){var a=[e.CNM,{cN:"string",b:"'",e:"'",c:[e.BE,{b:"''"}]}],s={r:0,c:[{b:/'['\.]*/}]};return{k:{keyword:"break case catch classdef continue else elseif end enumerated events for function global if methods otherwise parfor persistent properties return spmd switch try while",built_in:"sin sind sinh asin asind asinh cos cosd cosh acos acosd acosh tan tand tanh atan atand atan2 atanh sec secd sech asec asecd asech csc cscd csch acsc acscd acsch cot cotd coth acot acotd acoth hypot exp expm1 log log1p log10 log2 pow2 realpow reallog realsqrt sqrt nthroot nextpow2 abs angle complex conj imag real unwrap isreal cplxpair fix floor ceil round mod rem sign airy besselj bessely besselh besseli besselk beta betainc betaln ellipj ellipke erf erfc erfcx erfinv expint gamma gammainc gammaln psi legendre cross dot factor isprime primes gcd lcm rat rats perms nchoosek factorial cart2sph cart2pol pol2cart sph2cart hsv2rgb rgb2hsv zeros ones eye repmat rand randn linspace logspace freqspace meshgrid accumarray size length ndims numel disp isempty isequal isequalwithequalnans cat reshape diag blkdiag tril triu fliplr flipud flipdim rot90 find sub2ind ind2sub bsxfun ndgrid permute ipermute shiftdim circshift squeeze isscalar isvector ans eps realmax realmin pi i inf nan isnan isinf isfinite j why compan gallery hadamard hankel hilb invhilb magic pascal rosser toeplitz vander wilkinson"},i:'(//|"|#|/\\*|\\s+/\\w+)',c:[{cN:"function",bK:"function",e:"$",c:[e.UTM,{cN:"params",v:[{b:"\\(",e:"\\)"},{b:"\\[",e:"\\]"}]}]},{b:/[a-zA-Z_][a-zA-Z_0-9]*'['\.]*/,rB:!0,r:0,c:[{b:/[a-zA-Z_][a-zA-Z_0-9]*/,r:0},s.c[0]]},{b:"\\[",e:"\\]",c:a,r:0,starts:s},{b:"\\{",e:/}/,c:a,r:0,starts:s},{b:/\)/,r:0,starts:s},e.C("^\\s*\\%\\{\\s*$","^\\s*\\%\\}\\s*$"),e.C("\\%","$")].concat(a)}});hljs.registerLanguage("irpf90",function(e){var t={cN:"params",b:"\\(",e:"\\)"},n={literal:".False. .True.",keyword:"kind do while private call intrinsic where elsewhere type endtype endmodule endselect endinterface end enddo endif if forall endforall only contains default return stop then public subroutine|10 function program .and. .or. .not. .le. .eq. .ge. .gt. .lt. goto save else use module select case access blank direct exist file fmt form formatted iostat name named nextrec number opened rec recl sequential status unformatted unit continue format pause cycle exit c_null_char c_alert c_backspace c_form_feed flush wait decimal round iomsg synchronous nopass non_overridable pass protected volatile abstract extends import non_intrinsic value deferred generic final enumerator class associate bind enum c_int c_short c_long c_long_long c_signed_char c_size_t c_int8_t c_int16_t c_int32_t c_int64_t c_int_least8_t c_int_least16_t c_int_least32_t c_int_least64_t c_int_fast8_t c_int_fast16_t c_int_fast32_t c_int_fast64_t c_intmax_t C_intptr_t c_float c_double c_long_double c_float_complex c_double_complex c_long_double_complex c_bool c_char c_null_ptr c_null_funptr c_new_line c_carriage_return c_horizontal_tab c_vertical_tab iso_c_binding c_loc c_funloc c_associated  c_f_pointer c_ptr c_funptr iso_fortran_env character_storage_size error_unit file_storage_size input_unit iostat_end iostat_eor numeric_storage_size output_unit c_f_procpointer ieee_arithmetic ieee_support_underflow_control ieee_get_underflow_mode ieee_set_underflow_mode newunit contiguous recursive pad position action delim readwrite eor advance nml interface procedure namelist include sequence elemental pure integer real character complex logical dimension allocatable|10 parameter external implicit|10 none double precision assign intent optional pointer target in out common equivalence data begin_provider &begin_provider end_provider begin_shell end_shell begin_template end_template subst assert touch soft_touch provide no_dep free irp_if irp_else irp_endif irp_write irp_read",built_in:"alog alog10 amax0 amax1 amin0 amin1 amod cabs ccos cexp clog csin csqrt dabs dacos dasin datan datan2 dcos dcosh ddim dexp dint dlog dlog10 dmax1 dmin1 dmod dnint dsign dsin dsinh dsqrt dtan dtanh float iabs idim idint idnint ifix isign max0 max1 min0 min1 sngl algama cdabs cdcos cdexp cdlog cdsin cdsqrt cqabs cqcos cqexp cqlog cqsin cqsqrt dcmplx dconjg derf derfc dfloat dgamma dimag dlgama iqint qabs qacos qasin qatan qatan2 qcmplx qconjg qcos qcosh qdim qerf qerfc qexp qgamma qimag qlgama qlog qlog10 qmax1 qmin1 qmod qnint qsign qsin qsinh qsqrt qtan qtanh abs acos aimag aint anint asin atan atan2 char cmplx conjg cos cosh exp ichar index int log log10 max min nint sign sin sinh sqrt tan tanh print write dim lge lgt lle llt mod nullify allocate deallocate adjustl adjustr all allocated any associated bit_size btest ceiling count cshift date_and_time digits dot_product eoshift epsilon exponent floor fraction huge iand ibclr ibits ibset ieor ior ishft ishftc lbound len_trim matmul maxexponent maxloc maxval merge minexponent minloc minval modulo mvbits nearest pack present product radix random_number random_seed range repeat reshape rrspacing scale scan selected_int_kind selected_real_kind set_exponent shape size spacing spread sum system_clock tiny transpose trim ubound unpack verify achar iachar transfer dble entry dprod cpu_time command_argument_count get_command get_command_argument get_environment_variable is_iostat_end ieee_arithmetic ieee_support_underflow_control ieee_get_underflow_mode ieee_set_underflow_mode is_iostat_eor move_alloc new_line selected_char_kind same_type_as extends_type_ofacosh asinh atanh bessel_j0 bessel_j1 bessel_jn bessel_y0 bessel_y1 bessel_yn erf erfc erfc_scaled gamma log_gamma hypot norm2 atomic_define atomic_ref execute_command_line leadz trailz storage_size merge_bits bge bgt ble blt dshiftl dshiftr findloc iall iany iparity image_index lcobound ucobound maskl maskr num_images parity popcnt poppar shifta shiftl shiftr this_image IRP_ALIGN irp_here"};return{cI:!0,k:n,i:/\/\*/,c:[e.inherit(e.ASM,{cN:"string",r:0}),e.inherit(e.QSM,{cN:"string",r:0}),{cN:"function",bK:"subroutine function program",i:"[${=\\n]",c:[e.UTM,t]},e.C("!","$",{r:0}),e.C("begin_doc","end_doc",{r:10}),{cN:"number",b:"(?=\\b|\\+|\\-|\\.)(?=\\.\\d|\\d)(?:\\d+)?(?:\\.?\\d*)(?:[de][+-]?\\d+)?\\b\\.?",r:0}]}});hljs.registerLanguage("kotlin",function(e){var t={keyword:"abstract as val var vararg get set class object open private protected public noinline crossinline dynamic final enum if else do while for when throw try catch finally import package is in fun override companion reified inline lateinit initinterface annotation data sealed internal infix operator out by constructor super trait volatile transient native default",built_in:"Byte Short Char Int Long Boolean Float Double Void Unit Nothing",literal:"true false null"},r={cN:"keyword",b:/\b(break|continue|return|this)\b/,starts:{c:[{cN:"symbol",b:/@\w+/}]}},i={cN:"symbol",b:e.UIR+"@"},n={cN:"subst",v:[{b:"\\$"+e.UIR},{b:"\\${",e:"}",c:[e.ASM,e.CNM]}]},a={cN:"string",v:[{b:'"""',e:'"""',c:[n]},{b:"'",e:"'",i:/\n/,c:[e.BE]},{b:'"',e:'"',i:/\n/,c:[e.BE,n]}]},c={cN:"meta",b:"@(?:file|property|field|get|set|receiver|param|setparam|delegate)\\s*:(?:\\s*"+e.UIR+")?"},s={cN:"meta",b:"@"+e.UIR,c:[{b:/\(/,e:/\)/,c:[e.inherit(a,{cN:"meta-string"})]}]};return{k:t,c:[e.C("/\\*\\*","\\*/",{r:0,c:[{cN:"doctag",b:"@[A-Za-z]+"}]}),e.CLCM,e.CBCM,r,i,c,s,{cN:"function",bK:"fun",e:"[(]|$",rB:!0,eE:!0,k:t,i:/fun\s+(<.*>)?[^\s\(]+(\s+[^\s\(]+)\s*=/,r:5,c:[{b:e.UIR+"\\s*\\(",rB:!0,r:0,c:[e.UTM]},{cN:"type",b://,k:"reified",r:0},{cN:"params",b:/\(/,e:/\)/,endsParent:!0,k:t,r:0,c:[{b:/:/,e:/[=,\/]/,eW:!0,c:[{cN:"type",b:e.UIR},e.CLCM,e.CBCM],r:0},e.CLCM,e.CBCM,c,s,a,e.CNM]},e.CBCM]},{cN:"class",bK:"class interface trait",e:/[:\{(]|$/,eE:!0,i:"extends implements",c:[{bK:"public protected internal private constructor"},e.UTM,{cN:"type",b://,eB:!0,eE:!0,r:0},{cN:"type",b:/[,:]\s*/,e:/[<\(,]|$/,eB:!0,rE:!0},c,s]},a,{cN:"meta",b:"^#!/usr/bin/env",e:"$",i:"\n"},e.CNM]}});hljs.registerLanguage("crmsh",function(t){var e="primitive rsc_template",r="group clone ms master location colocation order fencing_topology rsc_ticket acl_target acl_group user role tag xml",s="property rsc_defaults op_defaults",a="params meta operations op rule attributes utilization",i="read write deny defined not_defined in_range date spec in ref reference attribute type xpath version and or lt gt tag lte gte eq ne \\",o="number string",n="Master Started Slave Stopped start promote demote stop monitor true false";return{aliases:["crm","pcmk"],cI:!0,k:{keyword:a+" "+i+" "+o,literal:n},c:[t.HCM,{bK:"node",starts:{e:"\\s*([\\w_-]+:)?",starts:{cN:"title",e:"\\s*[\\$\\w_][\\w_-]*"}}},{bK:e,starts:{cN:"title",e:"\\s*[\\$\\w_][\\w_-]*",starts:{e:"\\s*@?[\\w_][\\w_\\.:-]*"}}},{b:"\\b("+r.split(" ").join("|")+")\\s+",k:r,starts:{cN:"title",e:"[\\$\\w_][\\w_-]*"}},{bK:s,starts:{cN:"title",e:"\\s*([\\w_-]+:)?"}},t.QSM,{cN:"meta",b:"(ocf|systemd|service|lsb):[\\w_:-]+",r:0},{cN:"number",b:"\\b\\d+(\\.\\d+)?(ms|s|h|m)?",r:0},{cN:"literal",b:"[-]?(infinity|inf)",r:0},{cN:"attr",b:/([A-Za-z\$_\#][\w_-]+)=/,r:0},{cN:"tag",b:"",r:0}]}});hljs.registerLanguage("haskell",function(e){var i={v:[e.C("--","$"),e.C("{-","-}",{c:["self"]})]},a={cN:"meta",b:"{-#",e:"#-}"},l={cN:"meta",b:"^#",e:"$"},c={cN:"type",b:"\\b[A-Z][\\w']*",r:0},n={b:"\\(",e:"\\)",i:'"',c:[a,l,{cN:"type",b:"\\b[A-Z][\\w]*(\\((\\.\\.|,|\\w+)\\))?"},e.inherit(e.TM,{b:"[_a-z][\\w']*"}),i]},s={b:"{",e:"}",c:n.c};return{aliases:["hs"],k:"let in if then else case of where do module import hiding qualified type data newtype deriving class instance as default infix infixl infixr foreign export ccall stdcall cplusplus jvm dotnet safe unsafe family forall mdo proc rec",c:[{bK:"module",e:"where",k:"module where",c:[n,i],i:"\\W\\.|;"},{b:"\\bimport\\b",e:"$",k:"import qualified as hiding",c:[n,i],i:"\\W\\.|;"},{cN:"class",b:"^(\\s*)?(class|instance)\\b",e:"where",k:"class family instance where",c:[c,n,i]},{cN:"class",b:"\\b(data|(new)?type)\\b",e:"$",k:"data family type newtype deriving",c:[a,c,n,s,i]},{bK:"default",e:"$",c:[c,n,i]},{bK:"infix infixl infixr",e:"$",c:[e.CNM,i]},{b:"\\bforeign\\b",e:"$",k:"foreign import export ccall stdcall cplusplus jvm dotnet safe unsafe",c:[c,e.QSM,i]},{cN:"meta",b:"#!\\/usr\\/bin\\/env runhaskell",e:"$"},a,l,e.QSM,e.CNM,c,e.inherit(e.TM,{b:"^[_a-z][\\w']*"}),i,{b:"->|<-"}]}});hljs.registerLanguage("flix",function(e){var t={cN:"string",b:/'(.|\\[xXuU][a-zA-Z0-9]+)'/},i={cN:"string",v:[{b:'"',e:'"'}]},n={cN:"title",b:/[^0-9\n\t "'(),.`{}\[\]:;][^\n\t "'(),.`{}\[\]:;]+|[^0-9\n\t "'(),.`{}\[\]:;=]/},c={cN:"function",bK:"def",e:/[:={\[(\n;]/,eE:!0,c:[n]};return{k:{literal:"true false",keyword:"case class def else enum if impl import in lat rel index let match namespace switch type yield with"},c:[e.CLCM,e.CBCM,t,i,c,e.CNM]}});hljs.registerLanguage("scala",function(e){var t={cN:"meta",b:"@[A-Za-z]+"},a={cN:"subst",v:[{b:"\\$[A-Za-z0-9_]+"},{b:"\\${",e:"}"}]},r={cN:"string",v:[{b:'"',e:'"',i:"\\n",c:[e.BE]},{b:'"""',e:'"""',r:10},{b:'[a-z]+"',e:'"',i:"\\n",c:[e.BE,a]},{cN:"string",b:'[a-z]+"""',e:'"""',c:[a],r:10}]},c={cN:"symbol",b:"'\\w[\\w\\d_]*(?!')"},i={cN:"type",b:"\\b[A-Z][A-Za-z0-9_]*",r:0},s={cN:"title",b:/[^0-9\n\t "'(),.`{}\[\]:;][^\n\t "'(),.`{}\[\]:;]+|[^0-9\n\t "'(),.`{}\[\]:;=]/,r:0},n={cN:"class",bK:"class object trait type",e:/[:={\[\n;]/,eE:!0,c:[{bK:"extends with",r:10},{b:/\[/,e:/\]/,eB:!0,eE:!0,r:0,c:[i]},{cN:"params",b:/\(/,e:/\)/,eB:!0,eE:!0,r:0,c:[i]},s]},l={cN:"function",bK:"def",e:/[:={\[(\n;]/,eE:!0,c:[s]};return{k:{literal:"true false null",keyword:"type yield lazy override def with val var sealed abstract private trait object if forSome for while throw finally protected extends import final return else break new catch super class case package default try this match continue throws implicit"},c:[e.CLCM,e.CBCM,r,c,i,l,n,e.CNM,t]}});hljs.registerLanguage("powershell",function(e){var t={b:"`[\\s\\S]",r:0},o={cN:"variable",v:[{b:/\$[\w\d][\w\d_:]*/}]},r={cN:"literal",b:/\$(null|true|false)\b/},n={cN:"string",v:[{b:/"/,e:/"/},{b:/@"/,e:/^"@/}],c:[t,o,{cN:"variable",b:/\$[A-z]/,e:/[^A-z]/}]},a={cN:"string",v:[{b:/'/,e:/'/},{b:/@'/,e:/^'@/}]},i={cN:"doctag",v:[{b:/\.(synopsis|description|example|inputs|outputs|notes|link|component|role|functionality)/},{b:/\.(parameter|forwardhelptargetname|forwardhelpcategory|remotehelprunspace|externalhelp)\s+\S+/}]},s=e.inherit(e.C(null,null),{v:[{b:/#/,e:/$/},{b:/<#/,e:/#>/}],c:[i]});return{aliases:["ps"],l:/-?[A-z\.\-]+/,cI:!0,k:{keyword:"if else foreach return function do while until elseif begin for trap data dynamicparam end break throw param continue finally in switch exit filter try process catch",built_in:"Add-Computer Add-Content Add-History Add-JobTrigger Add-Member Add-PSSnapin Add-Type Checkpoint-Computer Clear-Content Clear-EventLog Clear-History Clear-Host Clear-Item Clear-ItemProperty Clear-Variable Compare-Object Complete-Transaction Connect-PSSession Connect-WSMan Convert-Path ConvertFrom-Csv ConvertFrom-Json ConvertFrom-SecureString ConvertFrom-StringData ConvertTo-Csv ConvertTo-Html ConvertTo-Json ConvertTo-SecureString ConvertTo-Xml Copy-Item Copy-ItemProperty Debug-Process Disable-ComputerRestore Disable-JobTrigger Disable-PSBreakpoint Disable-PSRemoting Disable-PSSessionConfiguration Disable-WSManCredSSP Disconnect-PSSession Disconnect-WSMan Disable-ScheduledJob Enable-ComputerRestore Enable-JobTrigger Enable-PSBreakpoint Enable-PSRemoting Enable-PSSessionConfiguration Enable-ScheduledJob Enable-WSManCredSSP Enter-PSSession Exit-PSSession Export-Alias Export-Clixml Export-Console Export-Counter Export-Csv Export-FormatData Export-ModuleMember Export-PSSession ForEach-Object Format-Custom Format-List Format-Table Format-Wide Get-Acl Get-Alias Get-AuthenticodeSignature Get-ChildItem Get-Command Get-ComputerRestorePoint Get-Content Get-ControlPanelItem Get-Counter Get-Credential Get-Culture Get-Date Get-Event Get-EventLog Get-EventSubscriber Get-ExecutionPolicy Get-FormatData Get-Host Get-HotFix Get-Help Get-History Get-IseSnippet Get-Item Get-ItemProperty Get-Job Get-JobTrigger Get-Location Get-Member Get-Module Get-PfxCertificate Get-Process Get-PSBreakpoint Get-PSCallStack Get-PSDrive Get-PSProvider Get-PSSession Get-PSSessionConfiguration Get-PSSnapin Get-Random Get-ScheduledJob Get-ScheduledJobOption Get-Service Get-TraceSource Get-Transaction Get-TypeData Get-UICulture Get-Unique Get-Variable Get-Verb Get-WinEvent Get-WmiObject Get-WSManCredSSP Get-WSManInstance Group-Object Import-Alias Import-Clixml Import-Counter Import-Csv Import-IseSnippet Import-LocalizedData Import-PSSession Import-Module Invoke-AsWorkflow Invoke-Command Invoke-Expression Invoke-History Invoke-Item Invoke-RestMethod Invoke-WebRequest Invoke-WmiMethod Invoke-WSManAction Join-Path Limit-EventLog Measure-Command Measure-Object Move-Item Move-ItemProperty New-Alias New-Event New-EventLog New-IseSnippet New-Item New-ItemProperty New-JobTrigger New-Object New-Module New-ModuleManifest New-PSDrive New-PSSession New-PSSessionConfigurationFile New-PSSessionOption New-PSTransportOption New-PSWorkflowExecutionOption New-PSWorkflowSession New-ScheduledJobOption New-Service New-TimeSpan New-Variable New-WebServiceProxy New-WinEvent New-WSManInstance New-WSManSessionOption Out-Default Out-File Out-GridView Out-Host Out-Null Out-Printer Out-String Pop-Location Push-Location Read-Host Receive-Job Register-EngineEvent Register-ObjectEvent Register-PSSessionConfiguration Register-ScheduledJob Register-WmiEvent Remove-Computer Remove-Event Remove-EventLog Remove-Item Remove-ItemProperty Remove-Job Remove-JobTrigger Remove-Module Remove-PSBreakpoint Remove-PSDrive Remove-PSSession Remove-PSSnapin Remove-TypeData Remove-Variable Remove-WmiObject Remove-WSManInstance Rename-Computer Rename-Item Rename-ItemProperty Reset-ComputerMachinePassword Resolve-Path Restart-Computer Restart-Service Restore-Computer Resume-Job Resume-Service Save-Help Select-Object Select-String Select-Xml Send-MailMessage Set-Acl Set-Alias Set-AuthenticodeSignature Set-Content Set-Date Set-ExecutionPolicy Set-Item Set-ItemProperty Set-JobTrigger Set-Location Set-PSBreakpoint Set-PSDebug Set-PSSessionConfiguration Set-ScheduledJob Set-ScheduledJobOption Set-Service Set-StrictMode Set-TraceSource Set-Variable Set-WmiInstance Set-WSManInstance Set-WSManQuickConfig Show-Command Show-ControlPanelItem Show-EventLog Sort-Object Split-Path Start-Job Start-Process Start-Service Start-Sleep Start-Transaction Start-Transcript Stop-Computer Stop-Job Stop-Process Stop-Service Stop-Transcript Suspend-Job Suspend-Service Tee-Object Test-ComputerSecureChannel Test-Connection Test-ModuleManifest Test-Path Test-PSSessionConfigurationFile Trace-Command Unblock-File Undo-Transaction Unregister-Event Unregister-PSSessionConfiguration Unregister-ScheduledJob Update-FormatData Update-Help Update-List Update-TypeData Use-Transaction Wait-Event Wait-Job Wait-Process Where-Object Write-Debug Write-Error Write-EventLog Write-Host Write-Output Write-Progress Write-Verbose Write-Warning Add-MDTPersistentDrive Disable-MDTMonitorService Enable-MDTMonitorService Get-MDTDeploymentShareStatistics Get-MDTMonitorData Get-MDTOperatingSystemCatalog Get-MDTPersistentDrive Import-MDTApplication Import-MDTDriver Import-MDTOperatingSystem Import-MDTPackage Import-MDTTaskSequence New-MDTDatabase Remove-MDTMonitorData Remove-MDTPersistentDrive Restore-MDTPersistentDrive Set-MDTMonitorData Test-MDTDeploymentShare Test-MDTMonitorData Update-MDTDatabaseSchema Update-MDTDeploymentShare Update-MDTLinkedDS Update-MDTMedia Update-MDTMedia Add-VamtProductKey Export-VamtData Find-VamtManagedMachine Get-VamtConfirmationId Get-VamtProduct Get-VamtProductKey Import-VamtData Initialize-VamtData Install-VamtConfirmationId Install-VamtProductActivation Install-VamtProductKey Update-VamtProduct",nomarkup:"-ne -eq -lt -gt -ge -le -not -like -notlike -match -notmatch -contains -notcontains -in -notin -replace"},c:[t,e.NM,n,a,r,o,s]}});hljs.registerLanguage("cal",function(e){var r="div mod in and or not xor asserterror begin case do downto else end exit for if of repeat then to until while with var",t="false true",c=[e.CLCM,e.C(/\{/,/\}/,{r:0}),e.C(/\(\*/,/\*\)/,{r:10})],n={cN:"string",b:/'/,e:/'/,c:[{b:/''/}]},o={cN:"string",b:/(#\d+)+/},a={cN:"number",b:"\\b\\d+(\\.\\d+)?(DT|D|T)",r:0},i={cN:"string",b:'"',e:'"'},d={cN:"function",bK:"procedure",e:/[:;]/,k:"procedure|10",c:[e.TM,{cN:"params",b:/\(/,e:/\)/,k:r,c:[n,o]}].concat(c)},s={cN:"class",b:"OBJECT (Table|Form|Report|Dataport|Codeunit|XMLport|MenuSuite|Page|Query) (\\d+) ([^\\r\\n]+)",rB:!0,c:[e.TM,d]};return{cI:!0,k:{keyword:r,literal:t},i:/\/\*/,c:[n,o,a,i,e.NM,s,d]}});hljs.registerLanguage("openscad",function(e){var r={cN:"keyword",b:"\\$(f[asn]|t|vp[rtd]|children)"},n={cN:"literal",b:"false|true|PI|undef"},o={cN:"number",b:"\\b\\d+(\\.\\d+)?(e-?\\d+)?",r:0},i=e.inherit(e.QSM,{i:null}),t={cN:"meta",k:{"meta-keyword":"include use"},b:"include|use <",e:">"},s={cN:"params",b:"\\(",e:"\\)",c:["self",o,i,r,n]},c={b:"[*!#%]",r:0},a={cN:"function",bK:"module function",e:"\\=|\\{",c:[s,e.UTM]};return{aliases:["scad"],k:{keyword:"function module include use for intersection_for if else \\%",literal:"false true PI undef",built_in:"circle square polygon text sphere cube cylinder polyhedron translate rotate scale resize mirror multmatrix color offset hull minkowski union difference intersection abs sign sin cos tan acos asin atan atan2 floor round ceil ln log pow sqrt exp rands min max concat lookup str chr search version version_num norm cross parent_module echo import import_dxf dxf_linear_extrude linear_extrude rotate_extrude surface projection render children dxf_cross dxf_dim let assign"},c:[e.CLCM,e.CBCM,o,t,i,r,c,a]}});hljs.registerLanguage("dts",function(e){var a={cN:"string",v:[e.inherit(e.QSM,{b:'((u8?|U)|L)?"'}),{b:'(u8?|U)?R"',e:'"',c:[e.BE]},{b:"'\\\\?.",e:"'",i:"."}]},c={cN:"number",v:[{b:"\\b(\\d+(\\.\\d*)?|\\.\\d+)(u|U|l|L|ul|UL|f|F)"},{b:e.CNR}],r:0},b={cN:"meta",b:"#",e:"$",k:{"meta-keyword":"if else elif endif define undef ifdef ifndef"},c:[{b:/\\\n/,r:0},{bK:"include",e:"$",k:{"meta-keyword":"include"},c:[e.inherit(a,{cN:"meta-string"}),{cN:"meta-string",b:"<",e:">",i:"\\n"}]},a,e.CLCM,e.CBCM]},i={cN:"variable",b:"\\&[a-z\\d_]*\\b"},r={cN:"meta-keyword",b:"/[a-z][a-z\\d-]*/"},d={cN:"symbol",b:"^\\s*[a-zA-Z_][a-zA-Z\\d_]*:"},n={cN:"params",b:"<",e:">",c:[c,i]},s={cN:"class",b:/[a-zA-Z_][a-zA-Z\d_@]*\s{/,e:/[{;=]/,rB:!0,eE:!0},t={cN:"class",b:"/\\s*{",e:"};",r:10,c:[i,r,d,s,n,e.CLCM,e.CBCM,c,a]};return{k:"",c:[t,i,r,d,s,n,e.CLCM,e.CBCM,c,a,b,{b:e.IR+"::",k:""}]}});hljs.registerLanguage("sml",function(e){return{aliases:["ml"],k:{keyword:"abstype and andalso as case datatype do else end eqtype exception fn fun functor handle if in include infix infixr let local nonfix of op open orelse raise rec sharing sig signature struct structure then type val with withtype where while",built_in:"array bool char exn int list option order real ref string substring vector unit word",literal:"true false NONE SOME LESS EQUAL GREATER nil"},i:/\/\/|>>/,l:"[a-z_]\\w*!?",c:[{cN:"literal",b:/\[(\|\|)?\]|\(\)/,r:0},e.C("\\(\\*","\\*\\)",{c:["self"]}),{cN:"symbol",b:"'[A-Za-z_](?!')[\\w']*"},{cN:"type",b:"`[A-Z][\\w']*"},{cN:"type",b:"\\b[A-Z][\\w']*",r:0},{b:"[a-z_]\\w*'[\\w']*"},e.inherit(e.ASM,{cN:"string",r:0}),e.inherit(e.QSM,{i:null}),{cN:"number",b:"\\b(0[xX][a-fA-F0-9_]+[Lln]?|0[oO][0-7_]+[Lln]?|0[bB][01_]+[Lln]?|[0-9][0-9_]*([Lln]|(\\.[0-9_]*)?([eE][-+]?[0-9_]+)?)?)",r:0},{b:/[-=]>/}]}});hljs.registerLanguage("verilog",function(e){var n={keyword:"accept_on alias always always_comb always_ff always_latch and assert assign assume automatic before begin bind bins binsof bit break buf|0 bufif0 bufif1 byte case casex casez cell chandle checker class clocking cmos config const constraint context continue cover covergroup coverpoint cross deassign default defparam design disable dist do edge else end endcase endchecker endclass endclocking endconfig endfunction endgenerate endgroup endinterface endmodule endpackage endprimitive endprogram endproperty endspecify endsequence endtable endtask enum event eventually expect export extends extern final first_match for force foreach forever fork forkjoin function generate|5 genvar global highz0 highz1 if iff ifnone ignore_bins illegal_bins implements implies import incdir include initial inout input inside instance int integer interconnect interface intersect join join_any join_none large let liblist library local localparam logic longint macromodule matches medium modport module nand negedge nettype new nexttime nmos nor noshowcancelled not notif0 notif1 or output package packed parameter pmos posedge primitive priority program property protected pull0 pull1 pulldown pullup pulsestyle_ondetect pulsestyle_onevent pure rand randc randcase randsequence rcmos real realtime ref reg reject_on release repeat restrict return rnmos rpmos rtran rtranif0 rtranif1 s_always s_eventually s_nexttime s_until s_until_with scalared sequence shortint shortreal showcancelled signed small soft solve specify specparam static string strong strong0 strong1 struct super supply0 supply1 sync_accept_on sync_reject_on table tagged task this throughout time timeprecision timeunit tran tranif0 tranif1 tri tri0 tri1 triand trior trireg type typedef union unique unique0 unsigned until until_with untyped use uwire var vectored virtual void wait wait_order wand weak weak0 weak1 while wildcard wire with within wor xnor xor",literal:"null",built_in:"$finish $stop $exit $fatal $error $warning $info $realtime $time $printtimescale $bitstoreal $bitstoshortreal $itor $signed $cast $bits $stime $timeformat $realtobits $shortrealtobits $rtoi $unsigned $asserton $assertkill $assertpasson $assertfailon $assertnonvacuouson $assertoff $assertcontrol $assertpassoff $assertfailoff $assertvacuousoff $isunbounded $sampled $fell $changed $past_gclk $fell_gclk $changed_gclk $rising_gclk $steady_gclk $coverage_control $coverage_get $coverage_save $set_coverage_db_name $rose $stable $past $rose_gclk $stable_gclk $future_gclk $falling_gclk $changing_gclk $display $coverage_get_max $coverage_merge $get_coverage $load_coverage_db $typename $unpacked_dimensions $left $low $increment $clog2 $ln $log10 $exp $sqrt $pow $floor $ceil $sin $cos $tan $countbits $onehot $isunknown $fatal $warning $dimensions $right $high $size $asin $acos $atan $atan2 $hypot $sinh $cosh $tanh $asinh $acosh $atanh $countones $onehot0 $error $info $random $dist_chi_square $dist_erlang $dist_exponential $dist_normal $dist_poisson $dist_t $dist_uniform $q_initialize $q_remove $q_exam $async$and$array $async$nand$array $async$or$array $async$nor$array $sync$and$array $sync$nand$array $sync$or$array $sync$nor$array $q_add $q_full $psprintf $async$and$plane $async$nand$plane $async$or$plane $async$nor$plane $sync$and$plane $sync$nand$plane $sync$or$plane $sync$nor$plane $system $display $displayb $displayh $displayo $strobe $strobeb $strobeh $strobeo $write $readmemb $readmemh $writememh $value$plusargs $dumpvars $dumpon $dumplimit $dumpports $dumpportson $dumpportslimit $writeb $writeh $writeo $monitor $monitorb $monitorh $monitoro $writememb $dumpfile $dumpoff $dumpall $dumpflush $dumpportsoff $dumpportsall $dumpportsflush $fclose $fdisplay $fdisplayb $fdisplayh $fdisplayo $fstrobe $fstrobeb $fstrobeh $fstrobeo $swrite $swriteb $swriteh $swriteo $fscanf $fread $fseek $fflush $feof $fopen $fwrite $fwriteb $fwriteh $fwriteo $fmonitor $fmonitorb $fmonitorh $fmonitoro $sformat $sformatf $fgetc $ungetc $fgets $sscanf $rewind $ftell $ferror"};return{aliases:["v","sv","svh"],cI:!1,k:n,l:/[\w\$]+/,c:[e.CBCM,e.CLCM,e.QSM,{cN:"number",c:[e.BE],v:[{b:"\\b((\\d+'(b|h|o|d|B|H|O|D))[0-9xzXZa-fA-F_]+)"},{b:"\\B(('(b|h|o|d|B|H|O|D))[0-9xzXZa-fA-F_]+)"},{b:"\\b([0-9_])+",r:0}]},{cN:"variable",v:[{b:"#\\((?!parameter).+\\)"},{b:"\\.\\w+",r:0}]},{cN:"meta",b:"`",e:"$",k:{"meta-keyword":"define __FILE__ __LINE__ begin_keywords celldefine default_nettype define else elsif end_keywords endcelldefine endif ifdef ifndef include line nounconnected_drive pragma resetall timescale unconnected_drive undef undefineall"},r:0}]}});hljs.registerLanguage("hsp",function(e){return{cI:!0,l:/[\w\._]+/,k:"goto gosub return break repeat loop continue wait await dim sdim foreach dimtype dup dupptr end stop newmod delmod mref run exgoto on mcall assert logmes newlab resume yield onexit onerror onkey onclick oncmd exist delete mkdir chdir dirlist bload bsave bcopy memfile if else poke wpoke lpoke getstr chdpm memexpand memcpy memset notesel noteadd notedel noteload notesave randomize noteunsel noteget split strrep setease button chgdisp exec dialog mmload mmplay mmstop mci pset pget syscolor mes print title pos circle cls font sysfont objsize picload color palcolor palette redraw width gsel gcopy gzoom gmode bmpsave hsvcolor getkey listbox chkbox combox input mesbox buffer screen bgscr mouse objsel groll line clrobj boxf objprm objmode stick grect grotate gsquare gradf objimage objskip objenable celload celdiv celput newcom querycom delcom cnvstow comres axobj winobj sendmsg comevent comevarg sarrayconv callfunc cnvwtos comevdisp libptr system hspstat hspver stat cnt err strsize looplev sublev iparam wparam lparam refstr refdval int rnd strlen length length2 length3 length4 vartype gettime peek wpeek lpeek varptr varuse noteinfo instr abs limit getease str strmid strf getpath strtrim sin cos tan atan sqrt double absf expf logf limitf powf geteasef mousex mousey mousew hwnd hinstance hdc ginfo objinfo dirinfo sysinfo thismod __hspver__ __hsp30__ __date__ __time__ __line__ __file__ _debug __hspdef__ and or xor not screen_normal screen_palette screen_hide screen_fixedsize screen_tool screen_frame gmode_gdi gmode_mem gmode_rgb0 gmode_alpha gmode_rgb0alpha gmode_add gmode_sub gmode_pixela ginfo_mx ginfo_my ginfo_act ginfo_sel ginfo_wx1 ginfo_wy1 ginfo_wx2 ginfo_wy2 ginfo_vx ginfo_vy ginfo_sizex ginfo_sizey ginfo_winx ginfo_winy ginfo_mesx ginfo_mesy ginfo_r ginfo_g ginfo_b ginfo_paluse ginfo_dispx ginfo_dispy ginfo_cx ginfo_cy ginfo_intid ginfo_newid ginfo_sx ginfo_sy objinfo_mode objinfo_bmscr objinfo_hwnd notemax notesize dir_cur dir_exe dir_win dir_sys dir_cmdline dir_desktop dir_mydoc dir_tv font_normal font_bold font_italic font_underline font_strikeout font_antialias objmode_normal objmode_guifont objmode_usefont gsquare_grad msgothic msmincho do until while wend for next _break _continue switch case default swbreak swend ddim ldim alloc m_pi rad2deg deg2rad ease_linear ease_quad_in ease_quad_out ease_quad_inout ease_cubic_in ease_cubic_out ease_cubic_inout ease_quartic_in ease_quartic_out ease_quartic_inout ease_bounce_in ease_bounce_out ease_bounce_inout ease_shake_in ease_shake_out ease_shake_inout ease_loop",c:[e.CLCM,e.CBCM,e.QSM,e.ASM,{cN:"string",b:'{"',e:'"}',c:[e.BE]},e.C(";","$",{r:0}),{cN:"meta",b:"#",e:"$",k:{"meta-keyword":"addion cfunc cmd cmpopt comfunc const defcfunc deffunc define else endif enum epack func global if ifdef ifndef include modcfunc modfunc modinit modterm module pack packopt regcmd runtime undef usecom uselib"},c:[e.inherit(e.QSM,{cN:"meta-string"}),e.NM,e.CNM,e.CLCM,e.CBCM]},{cN:"symbol",b:"^\\*(\\w+|@)"},e.NM,e.CNM]}});hljs.registerLanguage("rib",function(e){return{k:"ArchiveRecord AreaLightSource Atmosphere Attribute AttributeBegin AttributeEnd Basis Begin Blobby Bound Clipping ClippingPlane Color ColorSamples ConcatTransform Cone CoordinateSystem CoordSysTransform CropWindow Curves Cylinder DepthOfField Detail DetailRange Disk Displacement Display End ErrorHandler Exposure Exterior Format FrameAspectRatio FrameBegin FrameEnd GeneralPolygon GeometricApproximation Geometry Hider Hyperboloid Identity Illuminate Imager Interior LightSource MakeCubeFaceEnvironment MakeLatLongEnvironment MakeShadow MakeTexture Matte MotionBegin MotionEnd NuPatch ObjectBegin ObjectEnd ObjectInstance Opacity Option Orientation Paraboloid Patch PatchMesh Perspective PixelFilter PixelSamples PixelVariance Points PointsGeneralPolygons PointsPolygons Polygon Procedural Projection Quantize ReadArchive RelativeDetail ReverseOrientation Rotate Scale ScreenWindow ShadingInterpolation ShadingRate Shutter Sides Skew SolidBegin SolidEnd Sphere SubdivisionMesh Surface TextureCoordinates Torus Transform TransformBegin TransformEnd TransformPoints Translate TrimCurve WorldBegin WorldEnd",i:""}]}});hljs.registerLanguage("elixir",function(e){var r="[a-zA-Z_][a-zA-Z0-9_]*(\\!|\\?)?",n="[a-zA-Z_]\\w*[!?=]?|[-+~]\\@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?",b="and false then defined module in return redo retry end for true self when next until do begin unless nil break not case cond alias while ensure or include use alias fn quote",c={cN:"subst",b:"#\\{",e:"}",l:r,k:b},a={cN:"string",c:[e.BE,c],v:[{b:/'/,e:/'/},{b:/"/,e:/"/}]},i={cN:"function",bK:"def defp defmacro",e:/\B\b/,c:[e.inherit(e.TM,{b:r,endsParent:!0})]},l=e.inherit(i,{cN:"class",bK:"defimpl defmodule defprotocol defrecord",e:/\bdo\b|$|;/}),s=[a,e.HCM,l,i,{cN:"symbol",b:":(?!\\s)",c:[a,{b:n}],r:0},{cN:"symbol",b:r+":",r:0},{cN:"number",b:"(\\b0[0-7_]+)|(\\b0x[0-9a-fA-F_]+)|(\\b[1-9][0-9_]*(\\.[0-9_]+)?)|[0_]\\b",r:0},{cN:"variable",b:"(\\$\\W)|((\\$|\\@\\@?)(\\w+))"},{b:"->"},{b:"("+e.RSR+")\\s*",c:[e.HCM,{cN:"regexp",i:"\\n",c:[e.BE,c],v:[{b:"/",e:"/[a-z]*"},{b:"%r\\[",e:"\\][a-z]*"}]}],r:0}];return c.c=s,{l:r,k:b,c:s}});hljs.registerLanguage("asciidoc",function(e){return{aliases:["adoc"],c:[e.C("^/{4,}\\n","\\n/{4,}$",{r:10}),e.C("^//","$",{r:0}),{cN:"title",b:"^\\.\\w.*$"},{b:"^[=\\*]{4,}\\n",e:"\\n^[=\\*]{4,}$",r:10},{cN:"section",r:10,v:[{b:"^(={1,5}) .+?( \\1)?$"},{b:"^[^\\[\\]\\n]+?\\n[=\\-~\\^\\+]{2,}$"}]},{cN:"meta",b:"^:.+?:",e:"\\s",eE:!0,r:10},{cN:"meta",b:"^\\[.+?\\]$",r:0},{cN:"quote",b:"^_{4,}\\n",e:"\\n_{4,}$",r:10},{cN:"code",b:"^[\\-\\.]{4,}\\n",e:"\\n[\\-\\.]{4,}$",r:10},{b:"^\\+{4,}\\n",e:"\\n\\+{4,}$",c:[{b:"<",e:">",sL:"xml",r:0}],r:10},{cN:"bullet",b:"^(\\*+|\\-+|\\.+|[^\\n]+?::)\\s+"},{cN:"symbol",b:"^(NOTE|TIP|IMPORTANT|WARNING|CAUTION):\\s+",r:10},{cN:"strong",b:"\\B\\*(?![\\*\\s])",e:"(\\n{2}|\\*)",c:[{b:"\\\\*\\w",r:0}]},{cN:"emphasis",b:"\\B'(?!['\\s])",e:"(\\n{2}|')",c:[{b:"\\\\'\\w",r:0}],r:0},{cN:"emphasis",b:"_(?![_\\s])",e:"(\\n{2}|_)",r:0},{cN:"string",v:[{b:"``.+?''"},{b:"`.+?'"}]},{cN:"code",b:"(`.+?`|\\+.+?\\+)",r:0},{cN:"code",b:"^[ \\t]",e:"$",r:0},{b:"^'{3,}[ \\t]*$",r:10},{b:"(link:)?(http|https|ftp|file|irc|image:?):\\S+\\[.*?\\]",rB:!0,c:[{b:"(link|image:?):",r:0},{cN:"link",b:"\\w",e:"[^\\[]+",r:0},{cN:"string",b:"\\[",e:"\\]",eB:!0,eE:!0,r:0}],r:10}]}});hljs.registerLanguage("capnproto",function(t){return{aliases:["capnp"],k:{keyword:"struct enum interface union group import using const annotation extends in of on as with from fixed",built_in:"Void Bool Int8 Int16 Int32 Int64 UInt8 UInt16 UInt32 UInt64 Float32 Float64 Text Data AnyPointer AnyStruct Capability List",literal:"true false"},c:[t.QSM,t.NM,t.HCM,{cN:"meta",b:/@0x[\w\d]{16};/,i:/\n/},{cN:"symbol",b:/@\d+\b/},{cN:"class",bK:"struct enum",e:/\{/,i:/\n/,c:[t.inherit(t.TM,{starts:{eW:!0,eE:!0}})]},{cN:"class",bK:"interface",e:/\{/,i:/\n/,c:[t.inherit(t.TM,{starts:{eW:!0,eE:!0}})]}]}});hljs.registerLanguage("makefile",function(e){var i={cN:"variable",v:[{b:"\\$\\("+e.UIR+"\\)",c:[e.BE]},{b:/\$[@%%$#]",starts:{e:"$",sL:"bash"}}]}});hljs.registerLanguage("oxygene",function(e){var r="abstract add and array as asc aspect assembly async begin break block by case class concat const copy constructor continue create default delegate desc distinct div do downto dynamic each else empty end ensure enum equals event except exit extension external false final finalize finalizer finally flags for forward from function future global group has if implementation implements implies in index inherited inline interface into invariants is iterator join locked locking loop matching method mod module namespace nested new nil not notify nullable of old on operator or order out override parallel params partial pinned private procedure property protected public queryable raise read readonly record reintroduce remove repeat require result reverse sealed select self sequence set shl shr skip static step soft take then to true try tuple type union unit unsafe until uses using var virtual raises volatile where while with write xor yield await mapped deprecated stdcall cdecl pascal register safecall overload library platform reference packed strict published autoreleasepool selector strong weak unretained",t=e.C("{","}",{r:0}),a=e.C("\\(\\*","\\*\\)",{r:10}),n={cN:"string",b:"'",e:"'",c:[{b:"''"}]},o={cN:"string",b:"(#\\d+)+"},i={cN:"function",bK:"function constructor destructor procedure method",e:"[:;]",k:"function constructor|10 destructor|10 procedure|10 method|10",c:[e.TM,{cN:"params",b:"\\(",e:"\\)",k:r,c:[n,o]},t,a]};return{cI:!0,l:/\.?\w+/,k:r,i:'("|\\$[G-Zg-z]|\\/\\*||->)',c:[t,a,e.CLCM,n,o,e.NM,i,{cN:"class",b:"=\\bclass\\b",e:"end;",k:r,c:[n,o,t,a,e.CLCM,i]}]}});hljs.registerLanguage("autoit",function(e){var t="ByRef Case Const ContinueCase ContinueLoop Default Dim Do Else ElseIf EndFunc EndIf EndSelect EndSwitch EndWith Enum Exit ExitLoop For Func Global If In Local Next ReDim Return Select Static Step Switch Then To Until Volatile WEnd While With",r="True False And Null Not Or",i="Abs ACos AdlibRegister AdlibUnRegister Asc AscW ASin Assign ATan AutoItSetOption AutoItWinGetTitle AutoItWinSetTitle Beep Binary BinaryLen BinaryMid BinaryToString BitAND BitNOT BitOR BitRotate BitShift BitXOR BlockInput Break Call CDTray Ceiling Chr ChrW ClipGet ClipPut ConsoleRead ConsoleWrite ConsoleWriteError ControlClick ControlCommand ControlDisable ControlEnable ControlFocus ControlGetFocus ControlGetHandle ControlGetPos ControlGetText ControlHide ControlListView ControlMove ControlSend ControlSetText ControlShow ControlTreeView Cos Dec DirCopy DirCreate DirGetSize DirMove DirRemove DllCall DllCallAddress DllCallbackFree DllCallbackGetPtr DllCallbackRegister DllClose DllOpen DllStructCreate DllStructGetData DllStructGetPtr DllStructGetSize DllStructSetData DriveGetDrive DriveGetFileSystem DriveGetLabel DriveGetSerial DriveGetType DriveMapAdd DriveMapDel DriveMapGet DriveSetLabel DriveSpaceFree DriveSpaceTotal DriveStatus EnvGet EnvSet EnvUpdate Eval Execute Exp FileChangeDir FileClose FileCopy FileCreateNTFSLink FileCreateShortcut FileDelete FileExists FileFindFirstFile FileFindNextFile FileFlush FileGetAttrib FileGetEncoding FileGetLongName FileGetPos FileGetShortcut FileGetShortName FileGetSize FileGetTime FileGetVersion FileInstall FileMove FileOpen FileOpenDialog FileRead FileReadLine FileReadToArray FileRecycle FileRecycleEmpty FileSaveDialog FileSelectFolder FileSetAttrib FileSetEnd FileSetPos FileSetTime FileWrite FileWriteLine Floor FtpSetProxy FuncName GUICreate GUICtrlCreateAvi GUICtrlCreateButton GUICtrlCreateCheckbox GUICtrlCreateCombo GUICtrlCreateContextMenu GUICtrlCreateDate GUICtrlCreateDummy GUICtrlCreateEdit GUICtrlCreateGraphic GUICtrlCreateGroup GUICtrlCreateIcon GUICtrlCreateInput GUICtrlCreateLabel GUICtrlCreateList GUICtrlCreateListView GUICtrlCreateListViewItem GUICtrlCreateMenu GUICtrlCreateMenuItem GUICtrlCreateMonthCal GUICtrlCreateObj GUICtrlCreatePic GUICtrlCreateProgress GUICtrlCreateRadio GUICtrlCreateSlider GUICtrlCreateTab GUICtrlCreateTabItem GUICtrlCreateTreeView GUICtrlCreateTreeViewItem GUICtrlCreateUpdown GUICtrlDelete GUICtrlGetHandle GUICtrlGetState GUICtrlRead GUICtrlRecvMsg GUICtrlRegisterListViewSort GUICtrlSendMsg GUICtrlSendToDummy GUICtrlSetBkColor GUICtrlSetColor GUICtrlSetCursor GUICtrlSetData GUICtrlSetDefBkColor GUICtrlSetDefColor GUICtrlSetFont GUICtrlSetGraphic GUICtrlSetImage GUICtrlSetLimit GUICtrlSetOnEvent GUICtrlSetPos GUICtrlSetResizing GUICtrlSetState GUICtrlSetStyle GUICtrlSetTip GUIDelete GUIGetCursorInfo GUIGetMsg GUIGetStyle GUIRegisterMsg GUISetAccelerators GUISetBkColor GUISetCoord GUISetCursor GUISetFont GUISetHelp GUISetIcon GUISetOnEvent GUISetState GUISetStyle GUIStartGroup GUISwitch Hex HotKeySet HttpSetProxy HttpSetUserAgent HWnd InetClose InetGet InetGetInfo InetGetSize InetRead IniDelete IniRead IniReadSection IniReadSectionNames IniRenameSection IniWrite IniWriteSection InputBox Int IsAdmin IsArray IsBinary IsBool IsDeclared IsDllStruct IsFloat IsFunc IsHWnd IsInt IsKeyword IsNumber IsObj IsPtr IsString Log MemGetStats Mod MouseClick MouseClickDrag MouseDown MouseGetCursor MouseGetPos MouseMove MouseUp MouseWheel MsgBox Number ObjCreate ObjCreateInterface ObjEvent ObjGet ObjName OnAutoItExitRegister OnAutoItExitUnRegister Ping PixelChecksum PixelGetColor PixelSearch ProcessClose ProcessExists ProcessGetStats ProcessList ProcessSetPriority ProcessWait ProcessWaitClose ProgressOff ProgressOn ProgressSet Ptr Random RegDelete RegEnumKey RegEnumVal RegRead RegWrite Round Run RunAs RunAsWait RunWait Send SendKeepActive SetError SetExtended ShellExecute ShellExecuteWait Shutdown Sin Sleep SoundPlay SoundSetWaveVolume SplashImageOn SplashOff SplashTextOn Sqrt SRandom StatusbarGetText StderrRead StdinWrite StdioClose StdoutRead String StringAddCR StringCompare StringFormat StringFromASCIIArray StringInStr StringIsAlNum StringIsAlpha StringIsASCII StringIsDigit StringIsFloat StringIsInt StringIsLower StringIsSpace StringIsUpper StringIsXDigit StringLeft StringLen StringLower StringMid StringRegExp StringRegExpReplace StringReplace StringReverse StringRight StringSplit StringStripCR StringStripWS StringToASCIIArray StringToBinary StringTrimLeft StringTrimRight StringUpper Tan TCPAccept TCPCloseSocket TCPConnect TCPListen TCPNameToIP TCPRecv TCPSend TCPShutdown, UDPShutdown TCPStartup, UDPStartup TimerDiff TimerInit ToolTip TrayCreateItem TrayCreateMenu TrayGetMsg TrayItemDelete TrayItemGetHandle TrayItemGetState TrayItemGetText TrayItemSetOnEvent TrayItemSetState TrayItemSetText TraySetClick TraySetIcon TraySetOnEvent TraySetPauseIcon TraySetState TraySetToolTip TrayTip UBound UDPBind UDPCloseSocket UDPOpen UDPRecv UDPSend VarGetType WinActivate WinActive WinClose WinExists WinFlash WinGetCaretPos WinGetClassList WinGetClientSize WinGetHandle WinGetPos WinGetProcess WinGetState WinGetText WinGetTitle WinKill WinList WinMenuSelectItem WinMinimizeAll WinMinimizeAllUndo WinMove WinSetOnTop WinSetState WinSetTitle WinSetTrans WinWait",l={v:[e.C(";","$",{r:0}),e.C("#cs","#ce"),e.C("#comments-start","#comments-end")]},n={b:"\\$[A-z0-9_]+"},o={cN:"string",v:[{b:/"/,e:/"/,c:[{b:/""/,r:0}]},{b:/'/,e:/'/,c:[{b:/''/,r:0}]}]},a={v:[e.BNM,e.CNM]},S={cN:"meta",b:"#",e:"$",k:{"meta-keyword":"comments include include-once NoTrayIcon OnAutoItStartRegister pragma compile RequireAdmin"},c:[{b:/\\\n/,r:0},{bK:"include",k:{"meta-keyword":"include"},e:"$",c:[o,{cN:"meta-string",v:[{b:"<",e:">"},{b:/"/,e:/"/,c:[{b:/""/,r:0}]},{b:/'/,e:/'/,c:[{b:/''/,r:0}]}]}]},o,l]},C={cN:"symbol",b:"@[A-z0-9_]+"},s={cN:"function",bK:"Func",e:"$",i:"\\$|\\[|%",c:[e.UTM,{cN:"params",b:"\\(",e:"\\)",c:[n,o,a]}]};return{cI:!0,i:/\/\*/,k:{keyword:t,built_in:i,literal:r},c:[l,n,o,a,S,C,s]}});hljs.registerLanguage("axapta",function(e){return{k:"false int abstract private char boolean static null if for true while long throw finally protected final return void enum else break new catch byte super case short default double public try this switch continue reverse firstfast firstonly forupdate nofetch sum avg minof maxof count order group by asc desc index hint like dispaly edit client server ttsbegin ttscommit str real date container anytype common div mod",c:[e.CLCM,e.CBCM,e.ASM,e.QSM,e.CNM,{cN:"meta",b:"#",e:"$"},{cN:"class",bK:"class interface",e:"{",eE:!0,i:":",c:[{bK:"extends implements"},e.UTM]}]}});hljs.registerLanguage("qml",function(r){var e={keyword:"in of on if for while finally var new function do return void else break catch instanceof with throw case default try this switch continue typeof delete let yield const export super debugger as async await import",literal:"true false null undefined NaN Infinity",built_in:"eval isFinite isNaN parseFloat parseInt decodeURI decodeURIComponent encodeURI encodeURIComponent escape unescape Object Function Boolean Error EvalError InternalError RangeError ReferenceError StopIteration SyntaxError TypeError URIError Number Math Date String RegExp Array Float32Array Float64Array Int16Array Int32Array Int8Array Uint16Array Uint32Array Uint8Array Uint8ClampedArray ArrayBuffer DataView JSON Intl arguments require module console window document Symbol Set Map WeakSet WeakMap Proxy Reflect Behavior bool color coordinate date double enumeration font geocircle georectangle geoshape int list matrix4x4 parent point quaternion real rect size string url var variant vector2d vector3d vector4dPromise"},t="[a-zA-Z_][a-zA-Z0-9\\._]*",a={cN:"keyword",b:"\\bproperty\\b",starts:{cN:"string",e:"(:|=|;|,|//|/\\*|$)",rE:!0}},n={cN:"keyword",b:"\\bsignal\\b",starts:{cN:"string",e:"(\\(|:|=|;|,|//|/\\*|$)",rE:!0}},o={cN:"attribute",b:"\\bid\\s*:",starts:{cN:"string",e:t,rE:!1}},i={b:t+"\\s*:",rB:!0,c:[{cN:"attribute",b:t,e:"\\s*:",eE:!0,r:0}],r:0},c={b:t+"\\s*{",e:"{",rB:!0,r:0,c:[r.inherit(r.TM,{b:t})]};return{aliases:["qt"],cI:!1,k:e,c:[{cN:"meta",b:/^\s*['"]use (strict|asm)['"]/},r.ASM,r.QSM,{cN:"string",b:"`",e:"`",c:[r.BE,{cN:"subst",b:"\\$\\{",e:"\\}"}]},r.CLCM,r.CBCM,{cN:"number",v:[{b:"\\b(0[bB][01]+)"},{b:"\\b(0[oO][0-7]+)"},{b:r.CNR}],r:0},{b:"("+r.RSR+"|\\b(case|return|throw)\\b)\\s*",k:"return throw case",c:[r.CLCM,r.CBCM,r.RM,{b:/\s*[);\]]/,r:0,sL:"xml"}],r:0},n,a,{cN:"function",bK:"function",e:/\{/,eE:!0,c:[r.inherit(r.TM,{b:/[A-Za-z$_][0-9A-Za-z$_]*/}),{cN:"params",b:/\(/,e:/\)/,eB:!0,eE:!0,c:[r.CLCM,r.CBCM]}],i:/\[|%/},{b:"\\."+r.IR,r:0},o,i,c],i:/#/}});hljs.registerLanguage("subunit",function(s){var r={cN:"string",b:"\\[\n(multipart)?",e:"\\]\n"},t={cN:"string",b:"\\d{4}-\\d{2}-\\d{2}(\\s+)\\d{2}:\\d{2}:\\d{2}.\\d+Z"},e={cN:"string",b:"(\\+|-)\\d+"},c={cN:"keyword",r:10,v:[{b:"^(test|testing|success|successful|failure|error|skip|xfail|uxsuccess)(:?)\\s+(test)?"},{b:"^progress(:?)(\\s+)?(pop|push)?"},{b:"^tags:"},{b:"^time:"}]};return{cI:!0,c:[r,t,e,c]}});hljs.registerLanguage("vala",function(t){return{k:{keyword:"char uchar unichar int uint long ulong short ushort int8 int16 int32 int64 uint8 uint16 uint32 uint64 float double bool struct enum string void weak unowned owned async signal static abstract interface override virtual delegate if while do for foreach else switch case break default return try catch public private protected internal using new this get set const stdout stdin stderr var",built_in:"DBus GLib CCode Gee Object Gtk Posix",literal:"false true null"},c:[{cN:"class",bK:"class interface namespace",e:"{",eE:!0,i:"[^,:\\n\\s\\.]",c:[t.UTM]},t.CLCM,t.CBCM,{cN:"string",b:'"""',e:'"""',r:5},t.ASM,t.QSM,t.CNM,{cN:"meta",b:"^#",e:"$",r:2}]}});hljs.registerLanguage("hy",function(e){var t={"builtin-name":"!= % %= & &= * ** **= *= *map + += , --build-class-- --import-- -= . / // //= /= < << <<= <= = > >= >> >>= @ @= ^ ^= abs accumulate all and any ap-compose ap-dotimes ap-each ap-each-while ap-filter ap-first ap-if ap-last ap-map ap-map-when ap-pipe ap-reduce ap-reject apply as-> ascii assert assoc bin break butlast callable calling-module-name car case cdr chain chr coll? combinations compile compress cond cons cons? continue count curry cut cycle dec def default-method defclass defmacro defmacro-alias defmacro/g! defmain defmethod defmulti defn defn-alias defnc defnr defreader defseq del delattr delete-route dict-comp dir disassemble dispatch-reader-macro distinct divmod do doto drop drop-last drop-while empty? end-sequence eval eval-and-compile eval-when-compile even? every? except exec filter first flatten float? fn fnc fnr for for* format fraction genexpr gensym get getattr global globals group-by hasattr hash hex id identity if if* if-not if-python2 import in inc input instance? integer integer-char? integer? interleave interpose is is-coll is-cons is-empty is-even is-every is-float is-instance is-integer is-integer-char is-iterable is-iterator is-keyword is-neg is-none is-not is-numeric is-odd is-pos is-string is-symbol is-zero isinstance islice issubclass iter iterable? iterate iterator? keyword keyword? lambda last len let lif lif-not list* list-comp locals loop macro-error macroexpand macroexpand-1 macroexpand-all map max merge-with method-decorator min multi-decorator multicombinations name neg? next none? nonlocal not not-in not? nth numeric? oct odd? open or ord partition permutations pos? post-route postwalk pow prewalk print product profile/calls profile/cpu put-route quasiquote quote raise range read read-str recursive-replace reduce remove repeat repeatedly repr require rest round route route-with-methods rwm second seq set-comp setattr setv some sorted string string? sum switch symbol? take take-nth take-while tee try unless unquote unquote-splicing vars walk when while with with* with-decorator with-gensyms xi xor yield yield-from zero? zip zip-longest | |= ~"},i="a-zA-Z_\\-!.?+*=<>&#'",a="["+i+"]["+i+"0-9/;:]*",r="[-+]?\\d+(\\.\\d+)?",o={cN:"meta",b:"^#!",e:"$"},s={b:a,r:0},n={cN:"number",b:r,r:0},l=e.inherit(e.QSM,{i:null}),c=e.C(";","$",{r:0}),d={cN:"literal",b:/\b([Tt]rue|[Ff]alse|nil|None)\b/},p={b:"[\\[\\{]",e:"[\\]\\}]"},m={cN:"comment",b:"\\^"+a},u=e.C("\\^\\{","\\}"),f={cN:"symbol",b:"[:]{1,2}"+a},h={b:"\\(",e:"\\)"},b={eW:!0,r:0},g={k:t,l:a,cN:"name",b:a,starts:b},y=[h,l,m,u,c,f,p,n,d,s];return h.c=[e.C("comment",""),g,b],b.c=y,p.c=y,{aliases:["hylang"],i:/\S/,c:[o,h,l,m,u,c,f,p,n,d]}});hljs.registerLanguage("glsl",function(e){return{k:{keyword:"break continue discard do else for if return while switch case default attribute binding buffer ccw centroid centroid varying coherent column_major const cw depth_any depth_greater depth_less depth_unchanged early_fragment_tests equal_spacing flat fractional_even_spacing fractional_odd_spacing highp in index inout invariant invocations isolines layout line_strip lines lines_adjacency local_size_x local_size_y local_size_z location lowp max_vertices mediump noperspective offset origin_upper_left out packed patch pixel_center_integer point_mode points precise precision quads r11f_g11f_b10f r16 r16_snorm r16f r16i r16ui r32f r32i r32ui r8 r8_snorm r8i r8ui readonly restrict rg16 rg16_snorm rg16f rg16i rg16ui rg32f rg32i rg32ui rg8 rg8_snorm rg8i rg8ui rgb10_a2 rgb10_a2ui rgba16 rgba16_snorm rgba16f rgba16i rgba16ui rgba32f rgba32i rgba32ui rgba8 rgba8_snorm rgba8i rgba8ui row_major sample shared smooth std140 std430 stream triangle_strip triangles triangles_adjacency uniform varying vertices volatile writeonly",type:"atomic_uint bool bvec2 bvec3 bvec4 dmat2 dmat2x2 dmat2x3 dmat2x4 dmat3 dmat3x2 dmat3x3 dmat3x4 dmat4 dmat4x2 dmat4x3 dmat4x4 double dvec2 dvec3 dvec4 float iimage1D iimage1DArray iimage2D iimage2DArray iimage2DMS iimage2DMSArray iimage2DRect iimage3D iimageBufferiimageCube iimageCubeArray image1D image1DArray image2D image2DArray image2DMS image2DMSArray image2DRect image3D imageBuffer imageCube imageCubeArray int isampler1D isampler1DArray isampler2D isampler2DArray isampler2DMS isampler2DMSArray isampler2DRect isampler3D isamplerBuffer isamplerCube isamplerCubeArray ivec2 ivec3 ivec4 mat2 mat2x2 mat2x3 mat2x4 mat3 mat3x2 mat3x3 mat3x4 mat4 mat4x2 mat4x3 mat4x4 sampler1D sampler1DArray sampler1DArrayShadow sampler1DShadow sampler2D sampler2DArray sampler2DArrayShadow sampler2DMS sampler2DMSArray sampler2DRect sampler2DRectShadow sampler2DShadow sampler3D samplerBuffer samplerCube samplerCubeArray samplerCubeArrayShadow samplerCubeShadow image1D uimage1DArray uimage2D uimage2DArray uimage2DMS uimage2DMSArray uimage2DRect uimage3D uimageBuffer uimageCube uimageCubeArray uint usampler1D usampler1DArray usampler2D usampler2DArray usampler2DMS usampler2DMSArray usampler2DRect usampler3D samplerBuffer usamplerCube usamplerCubeArray uvec2 uvec3 uvec4 vec2 vec3 vec4 void",built_in:"gl_MaxAtomicCounterBindings gl_MaxAtomicCounterBufferSize gl_MaxClipDistances gl_MaxClipPlanes gl_MaxCombinedAtomicCounterBuffers gl_MaxCombinedAtomicCounters gl_MaxCombinedImageUniforms gl_MaxCombinedImageUnitsAndFragmentOutputs gl_MaxCombinedTextureImageUnits gl_MaxComputeAtomicCounterBuffers gl_MaxComputeAtomicCounters gl_MaxComputeImageUniforms gl_MaxComputeTextureImageUnits gl_MaxComputeUniformComponents gl_MaxComputeWorkGroupCount gl_MaxComputeWorkGroupSize gl_MaxDrawBuffers gl_MaxFragmentAtomicCounterBuffers gl_MaxFragmentAtomicCounters gl_MaxFragmentImageUniforms gl_MaxFragmentInputComponents gl_MaxFragmentInputVectors gl_MaxFragmentUniformComponents gl_MaxFragmentUniformVectors gl_MaxGeometryAtomicCounterBuffers gl_MaxGeometryAtomicCounters gl_MaxGeometryImageUniforms gl_MaxGeometryInputComponents gl_MaxGeometryOutputComponents gl_MaxGeometryOutputVertices gl_MaxGeometryTextureImageUnits gl_MaxGeometryTotalOutputComponents gl_MaxGeometryUniformComponents gl_MaxGeometryVaryingComponents gl_MaxImageSamples gl_MaxImageUnits gl_MaxLights gl_MaxPatchVertices gl_MaxProgramTexelOffset gl_MaxTessControlAtomicCounterBuffers gl_MaxTessControlAtomicCounters gl_MaxTessControlImageUniforms gl_MaxTessControlInputComponents gl_MaxTessControlOutputComponents gl_MaxTessControlTextureImageUnits gl_MaxTessControlTotalOutputComponents gl_MaxTessControlUniformComponents gl_MaxTessEvaluationAtomicCounterBuffers gl_MaxTessEvaluationAtomicCounters gl_MaxTessEvaluationImageUniforms gl_MaxTessEvaluationInputComponents gl_MaxTessEvaluationOutputComponents gl_MaxTessEvaluationTextureImageUnits gl_MaxTessEvaluationUniformComponents gl_MaxTessGenLevel gl_MaxTessPatchComponents gl_MaxTextureCoords gl_MaxTextureImageUnits gl_MaxTextureUnits gl_MaxVaryingComponents gl_MaxVaryingFloats gl_MaxVaryingVectors gl_MaxVertexAtomicCounterBuffers gl_MaxVertexAtomicCounters gl_MaxVertexAttribs gl_MaxVertexImageUniforms gl_MaxVertexOutputComponents gl_MaxVertexOutputVectors gl_MaxVertexTextureImageUnits gl_MaxVertexUniformComponents gl_MaxVertexUniformVectors gl_MaxViewports gl_MinProgramTexelOffset gl_BackColor gl_BackLightModelProduct gl_BackLightProduct gl_BackMaterial gl_BackSecondaryColor gl_ClipDistance gl_ClipPlane gl_ClipVertex gl_Color gl_DepthRange gl_EyePlaneQ gl_EyePlaneR gl_EyePlaneS gl_EyePlaneT gl_Fog gl_FogCoord gl_FogFragCoord gl_FragColor gl_FragCoord gl_FragData gl_FragDepth gl_FrontColor gl_FrontFacing gl_FrontLightModelProduct gl_FrontLightProduct gl_FrontMaterial gl_FrontSecondaryColor gl_GlobalInvocationID gl_InstanceID gl_InvocationID gl_Layer gl_LightModel gl_LightSource gl_LocalInvocationID gl_LocalInvocationIndex gl_ModelViewMatrix gl_ModelViewMatrixInverse gl_ModelViewMatrixInverseTranspose gl_ModelViewMatrixTranspose gl_ModelViewProjectionMatrix gl_ModelViewProjectionMatrixInverse gl_ModelViewProjectionMatrixInverseTranspose gl_ModelViewProjectionMatrixTranspose gl_MultiTexCoord0 gl_MultiTexCoord1 gl_MultiTexCoord2 gl_MultiTexCoord3 gl_MultiTexCoord4 gl_MultiTexCoord5 gl_MultiTexCoord6 gl_MultiTexCoord7 gl_Normal gl_NormalMatrix gl_NormalScale gl_NumSamples gl_NumWorkGroups gl_ObjectPlaneQ gl_ObjectPlaneR gl_ObjectPlaneS gl_ObjectPlaneT gl_PatchVerticesIn gl_Point gl_PointCoord gl_PointSize gl_Position gl_PrimitiveID gl_PrimitiveIDIn gl_ProjectionMatrix gl_ProjectionMatrixInverse gl_ProjectionMatrixInverseTranspose gl_ProjectionMatrixTranspose gl_SampleID gl_SampleMask gl_SampleMaskIn gl_SamplePosition gl_SecondaryColor gl_TessCoord gl_TessLevelInner gl_TessLevelOuter gl_TexCoord gl_TextureEnvColor gl_TextureMatrix gl_TextureMatrixInverse gl_TextureMatrixInverseTranspose gl_TextureMatrixTranspose gl_Vertex gl_VertexID gl_ViewportIndex gl_WorkGroupID gl_WorkGroupSize gl_in gl_out EmitStreamVertex EmitVertex EndPrimitive EndStreamPrimitive abs acos acosh all any asin asinh atan atanh atomicAdd atomicAnd atomicCompSwap atomicCounter atomicCounterDecrement atomicCounterIncrement atomicExchange atomicMax atomicMin atomicOr atomicXor barrier bitCount bitfieldExtract bitfieldInsert bitfieldReverse ceil clamp cos cosh cross dFdx dFdy degrees determinant distance dot equal exp exp2 faceforward findLSB findMSB floatBitsToInt floatBitsToUint floor fma fract frexp ftransform fwidth greaterThan greaterThanEqual groupMemoryBarrier imageAtomicAdd imageAtomicAnd imageAtomicCompSwap imageAtomicExchange imageAtomicMax imageAtomicMin imageAtomicOr imageAtomicXor imageLoad imageSize imageStore imulExtended intBitsToFloat interpolateAtCentroid interpolateAtOffset interpolateAtSample inverse inversesqrt isinf isnan ldexp length lessThan lessThanEqual log log2 matrixCompMult max memoryBarrier memoryBarrierAtomicCounter memoryBarrierBuffer memoryBarrierImage memoryBarrierShared min mix mod modf noise1 noise2 noise3 noise4 normalize not notEqual outerProduct packDouble2x32 packHalf2x16 packSnorm2x16 packSnorm4x8 packUnorm2x16 packUnorm4x8 pow radians reflect refract round roundEven shadow1D shadow1DLod shadow1DProj shadow1DProjLod shadow2D shadow2DLod shadow2DProj shadow2DProjLod sign sin sinh smoothstep sqrt step tan tanh texelFetch texelFetchOffset texture texture1D texture1DLod texture1DProj texture1DProjLod texture2D texture2DLod texture2DProj texture2DProjLod texture3D texture3DLod texture3DProj texture3DProjLod textureCube textureCubeLod textureGather textureGatherOffset textureGatherOffsets textureGrad textureGradOffset textureLod textureLodOffset textureOffset textureProj textureProjGrad textureProjGradOffset textureProjLod textureProjLodOffset textureProjOffset textureQueryLevels textureQueryLod textureSize transpose trunc uaddCarry uintBitsToFloat umulExtended unpackDouble2x32 unpackHalf2x16 unpackSnorm2x16 unpackSnorm4x8 unpackUnorm2x16 unpackUnorm4x8 usubBorrow",literal:"true false"},i:'"',c:[e.CLCM,e.CBCM,e.CNM,{cN:"meta",b:"#",e:"$"}]}});hljs.registerLanguage("pf",function(t){var o={cN:"variable",b:/\$[\w\d#@][\w\d_]*/},e={cN:"variable",b:/<(?!\/)/,e:/>/};return{aliases:["pf.conf"],l:/[a-z0-9_<>-]+/,k:{built_in:"block match pass load anchor|5 antispoof|10 set table",keyword:"in out log quick on rdomain inet inet6 proto from port os to routeallow-opts divert-packet divert-reply divert-to flags group icmp-typeicmp6-type label once probability recieved-on rtable prio queuetos tag tagged user keep fragment for os dropaf-to|10 binat-to|10 nat-to|10 rdr-to|10 bitmask least-stats random round-robinsource-hash static-portdup-to reply-to route-toparent bandwidth default min max qlimitblock-policy debug fingerprints hostid limit loginterface optimizationreassemble ruleset-optimization basic none profile skip state-defaultsstate-policy timeoutconst counters persistno modulate synproxy state|5 floating if-bound no-sync pflow|10 sloppysource-track global rule max-src-nodes max-src-states max-src-connmax-src-conn-rate overload flushscrub|5 max-mss min-ttl no-df|10 random-id",literal:"all any no-route self urpf-failed egress|5 unknown"},c:[t.HCM,t.NM,t.QSM,o,e]}});hljs.registerLanguage("vbnet",function(e){return{aliases:["vb"],cI:!0,k:{keyword:"addhandler addressof alias and andalso aggregate ansi as assembly auto binary by byref byval call case catch class compare const continue custom declare default delegate dim distinct do each equals else elseif end enum erase error event exit explicit finally for friend from function get global goto group handles if implements imports in inherits interface into is isfalse isnot istrue join key let lib like loop me mid mod module mustinherit mustoverride mybase myclass namespace narrowing new next not notinheritable notoverridable of off on operator option optional or order orelse overloads overridable overrides paramarray partial preserve private property protected public raiseevent readonly redim rem removehandler resume return select set shadows shared skip static step stop structure strict sub synclock take text then throw to try unicode until using when where while widening with withevents writeonly xor",built_in:"boolean byte cbool cbyte cchar cdate cdec cdbl char cint clng cobj csbyte cshort csng cstr ctype date decimal directcast double gettype getxmlnamespace iif integer long object sbyte short single string trycast typeof uinteger ulong ushort",literal:"true false nothing"},i:"//|{|}|endif|gosub|variant|wend",c:[e.inherit(e.QSM,{c:[{b:'""'}]}),e.C("'","$",{rB:!0,c:[{cN:"doctag",b:"'''|",c:[e.PWM]},{cN:"doctag",b:"",c:[e.PWM]}]}),e.CNM,{cN:"meta",b:"#",e:"$",k:{"meta-keyword":"if else elseif end region externalsource"}}]}});hljs.registerLanguage("coq",function(e){return{k:{keyword:"_ as at cofix else end exists exists2 fix for forall fun if IF in let match mod Prop return Set then Type using where with Abort About Add Admit Admitted All Arguments Assumptions Axiom Back BackTo Backtrack Bind Blacklist Canonical Cd Check Class Classes Close Coercion Coercions CoFixpoint CoInductive Collection Combined Compute Conjecture Conjectures Constant constr Constraint Constructors Context Corollary CreateHintDb Cut Declare Defined Definition Delimit Dependencies DependentDerive Drop eauto End Equality Eval Example Existential Existentials Existing Export exporting Extern Extract Extraction Fact Field Fields File Fixpoint Focus for From Function Functional Generalizable Global Goal Grab Grammar Graph Guarded Heap Hint HintDb Hints Hypotheses Hypothesis ident Identity If Immediate Implicit Import Include Inductive Infix Info Initial Inline Inspect Instance Instances Intro Intros Inversion Inversion_clear Language Left Lemma Let Libraries Library Load LoadPath Local Locate Ltac ML Mode Module Modules Monomorphic Morphism Next NoInline Notation Obligation Obligations Opaque Open Optimize Options Parameter Parameters Parametric Path Paths pattern Polymorphic Preterm Print Printing Program Projections Proof Proposition Pwd Qed Quit Rec Record Recursive Redirect Relation Remark Remove Require Reserved Reset Resolve Restart Rewrite Right Ring Rings Save Scheme Scope Scopes Script Search SearchAbout SearchHead SearchPattern SearchRewrite Section Separate Set Setoid Show Solve Sorted Step Strategies Strategy Structure SubClass Table Tables Tactic Term Test Theorem Time Timeout Transparent Type Typeclasses Types Undelimit Undo Unfocus Unfocused Unfold Universe Universes Unset Unshelve using Variable Variables Variant Verbose Visibility where with",built_in:"abstract absurd admit after apply as assert assumption at auto autorewrite autounfold before bottom btauto by case case_eq cbn cbv change classical_left classical_right clear clearbody cofix compare compute congruence constr_eq constructor contradict contradiction cut cutrewrite cycle decide decompose dependent destruct destruction dintuition discriminate discrR do double dtauto eapply eassumption eauto ecase econstructor edestruct ediscriminate eelim eexact eexists einduction einjection eleft elim elimtype enough equality erewrite eright esimplify_eq esplit evar exact exactly_once exfalso exists f_equal fail field field_simplify field_simplify_eq first firstorder fix fold fourier functional generalize generalizing gfail give_up has_evar hnf idtac in induction injection instantiate intro intro_pattern intros intuition inversion inversion_clear is_evar is_var lapply lazy left lia lra move native_compute nia nsatz omega once pattern pose progress proof psatz quote record red refine reflexivity remember rename repeat replace revert revgoals rewrite rewrite_strat right ring ring_simplify rtauto set setoid_reflexivity setoid_replace setoid_rewrite setoid_symmetry setoid_transitivity shelve shelve_unifiable simpl simple simplify_eq solve specialize split split_Rabs split_Rmult stepl stepr subst sum swap symmetry tactic tauto time timeout top transitivity trivial try tryif unfold unify until using vm_compute with"},c:[e.QSM,e.C("\\(\\*","\\*\\)"),e.CNM,{cN:"type",eB:!0,b:"\\|\\s*",e:"\\w+"},{b:/[-=]>/}]}});
    \ No newline at end of file
    diff --git a/node_modules/reveal.js/plugin/markdown/example.html b/node_modules/reveal.js/plugin/markdown/example.html
    new file mode 100644
    index 0000000..300e39e
    --- /dev/null
    +++ b/node_modules/reveal.js/plugin/markdown/example.html
    @@ -0,0 +1,136 @@
    +
    +
    +
    +	
    +		
    +
    +		reveal.js - Markdown Demo
    +
    +		
    +		
    +
    +        
    +	
    +
    +	
    +
    +		
    + +
    + + +
    + + +
    + +
    + + +
    + +
    + + +
    + +
    + + +
    + +
    + + +
    + +
    + + +
    + +
    + + +
    + +
    + +
    +
    + + + + + + + + diff --git a/node_modules/reveal.js/plugin/markdown/example.md b/node_modules/reveal.js/plugin/markdown/example.md new file mode 100644 index 0000000..89c7534 --- /dev/null +++ b/node_modules/reveal.js/plugin/markdown/example.md @@ -0,0 +1,36 @@ +# Markdown Demo + + + +## External 1.1 + +Content 1.1 + +Note: This will only appear in the speaker notes window. + + +## External 1.2 + +Content 1.2 + + + +## External 2 + +Content 2.1 + + + +## External 3.1 + +Content 3.1 + + +## External 3.2 + +Content 3.2 + + +## External 3.3 + +![External Image](https://s3.amazonaws.com/static.slid.es/logo/v2/slides-symbol-512x512.png) diff --git a/node_modules/reveal.js/plugin/markdown/markdown.js b/node_modules/reveal.js/plugin/markdown/markdown.js new file mode 100755 index 0000000..aa08ee5 --- /dev/null +++ b/node_modules/reveal.js/plugin/markdown/markdown.js @@ -0,0 +1,412 @@ +/** + * The reveal.js markdown plugin. Handles parsing of + * markdown inside of presentations as well as loading + * of external markdown documents. + */ +(function( root, factory ) { + if (typeof define === 'function' && define.amd) { + root.marked = require( './marked' ); + root.RevealMarkdown = factory( root.marked ); + root.RevealMarkdown.initialize(); + } else if( typeof exports === 'object' ) { + module.exports = factory( require( './marked' ) ); + } else { + // Browser globals (root is window) + root.RevealMarkdown = factory( root.marked ); + root.RevealMarkdown.initialize(); + } +}( this, function( marked ) { + + var DEFAULT_SLIDE_SEPARATOR = '^\r?\n---\r?\n$', + DEFAULT_NOTES_SEPARATOR = 'notes?:', + DEFAULT_ELEMENT_ATTRIBUTES_SEPARATOR = '\\\.element\\\s*?(.+?)$', + DEFAULT_SLIDE_ATTRIBUTES_SEPARATOR = '\\\.slide:\\\s*?(\\\S.+?)$'; + + var SCRIPT_END_PLACEHOLDER = '__SCRIPT_END__'; + + + /** + * Retrieves the markdown contents of a slide section + * element. Normalizes leading tabs/whitespace. + */ + function getMarkdownFromSlide( section ) { + + // look for a ' ); + + var leadingWs = text.match( /^\n?(\s*)/ )[1].length, + leadingTabs = text.match( /^\n?(\t*)/ )[1].length; + + if( leadingTabs > 0 ) { + text = text.replace( new RegExp('\\n?\\t{' + leadingTabs + '}','g'), '\n' ); + } + else if( leadingWs > 1 ) { + text = text.replace( new RegExp('\\n? {' + leadingWs + '}', 'g'), '\n' ); + } + + return text; + + } + + /** + * Given a markdown slide section element, this will + * return all arguments that aren't related to markdown + * parsing. Used to forward any other user-defined arguments + * to the output markdown slide. + */ + function getForwardedAttributes( section ) { + + var attributes = section.attributes; + var result = []; + + for( var i = 0, len = attributes.length; i < len; i++ ) { + var name = attributes[i].name, + value = attributes[i].value; + + // disregard attributes that are used for markdown loading/parsing + if( /data\-(markdown|separator|vertical|notes)/gi.test( name ) ) continue; + + if( value ) { + result.push( name + '="' + value + '"' ); + } + else { + result.push( name ); + } + } + + return result.join( ' ' ); + + } + + /** + * Inspects the given options and fills out default + * values for what's not defined. + */ + function getSlidifyOptions( options ) { + + options = options || {}; + options.separator = options.separator || DEFAULT_SLIDE_SEPARATOR; + options.notesSeparator = options.notesSeparator || DEFAULT_NOTES_SEPARATOR; + options.attributes = options.attributes || ''; + + return options; + + } + + /** + * Helper function for constructing a markdown slide. + */ + function createMarkdownSlide( content, options ) { + + options = getSlidifyOptions( options ); + + var notesMatch = content.split( new RegExp( options.notesSeparator, 'mgi' ) ); + + if( notesMatch.length === 2 ) { + content = notesMatch[0] + ''; + } + + // prevent script end tags in the content from interfering + // with parsing + content = content.replace( /<\/script>/g, SCRIPT_END_PLACEHOLDER ); + + return ''; + + } + + /** + * Parses a data string into multiple slides based + * on the passed in separator arguments. + */ + function slidify( markdown, options ) { + + options = getSlidifyOptions( options ); + + var separatorRegex = new RegExp( options.separator + ( options.verticalSeparator ? '|' + options.verticalSeparator : '' ), 'mg' ), + horizontalSeparatorRegex = new RegExp( options.separator ); + + var matches, + lastIndex = 0, + isHorizontal, + wasHorizontal = true, + content, + sectionStack = []; + + // iterate until all blocks between separators are stacked up + while( matches = separatorRegex.exec( markdown ) ) { + notes = null; + + // determine direction (horizontal by default) + isHorizontal = horizontalSeparatorRegex.test( matches[0] ); + + if( !isHorizontal && wasHorizontal ) { + // create vertical stack + sectionStack.push( [] ); + } + + // pluck slide content from markdown input + content = markdown.substring( lastIndex, matches.index ); + + if( isHorizontal && wasHorizontal ) { + // add to horizontal stack + sectionStack.push( content ); + } + else { + // add to vertical stack + sectionStack[sectionStack.length-1].push( content ); + } + + lastIndex = separatorRegex.lastIndex; + wasHorizontal = isHorizontal; + } + + // add the remaining slide + ( wasHorizontal ? sectionStack : sectionStack[sectionStack.length-1] ).push( markdown.substring( lastIndex ) ); + + var markdownSections = ''; + + // flatten the hierarchical stack, and insert
    tags + for( var i = 0, len = sectionStack.length; i < len; i++ ) { + // vertical + if( sectionStack[i] instanceof Array ) { + markdownSections += '
    '; + + sectionStack[i].forEach( function( child ) { + markdownSections += '
    ' + createMarkdownSlide( child, options ) + '
    '; + } ); + + markdownSections += '
    '; + } + else { + markdownSections += '
    ' + createMarkdownSlide( sectionStack[i], options ) + '
    '; + } + } + + return markdownSections; + + } + + /** + * Parses any current data-markdown slides, splits + * multi-slide markdown into separate sections and + * handles loading of external markdown. + */ + function processSlides() { + + var sections = document.querySelectorAll( '[data-markdown]'), + section; + + for( var i = 0, len = sections.length; i < len; i++ ) { + + section = sections[i]; + + if( section.getAttribute( 'data-markdown' ).length ) { + + var xhr = new XMLHttpRequest(), + url = section.getAttribute( 'data-markdown' ); + + datacharset = section.getAttribute( 'data-charset' ); + + // see https://developer.mozilla.org/en-US/docs/Web/API/element.getAttribute#Notes + if( datacharset != null && datacharset != '' ) { + xhr.overrideMimeType( 'text/html; charset=' + datacharset ); + } + + xhr.onreadystatechange = function() { + if( xhr.readyState === 4 ) { + // file protocol yields status code 0 (useful for local debug, mobile applications etc.) + if ( ( xhr.status >= 200 && xhr.status < 300 ) || xhr.status === 0 ) { + + section.outerHTML = slidify( xhr.responseText, { + separator: section.getAttribute( 'data-separator' ), + verticalSeparator: section.getAttribute( 'data-separator-vertical' ), + notesSeparator: section.getAttribute( 'data-separator-notes' ), + attributes: getForwardedAttributes( section ) + }); + + } + else { + + section.outerHTML = '
    ' + + 'ERROR: The attempt to fetch ' + url + ' failed with HTTP status ' + xhr.status + '.' + + 'Check your browser\'s JavaScript console for more details.' + + '

    Remember that you need to serve the presentation HTML from a HTTP server.

    ' + + '
    '; + + } + } + }; + + xhr.open( 'GET', url, false ); + + try { + xhr.send(); + } + catch ( e ) { + alert( 'Failed to get the Markdown file ' + url + '. Make sure that the presentation and the file are served by a HTTP server and the file can be found there. ' + e ); + } + + } + else if( section.getAttribute( 'data-separator' ) || section.getAttribute( 'data-separator-vertical' ) || section.getAttribute( 'data-separator-notes' ) ) { + + section.outerHTML = slidify( getMarkdownFromSlide( section ), { + separator: section.getAttribute( 'data-separator' ), + verticalSeparator: section.getAttribute( 'data-separator-vertical' ), + notesSeparator: section.getAttribute( 'data-separator-notes' ), + attributes: getForwardedAttributes( section ) + }); + + } + else { + section.innerHTML = createMarkdownSlide( getMarkdownFromSlide( section ) ); + } + } + + } + + /** + * Check if a node value has the attributes pattern. + * If yes, extract it and add that value as one or several attributes + * the the terget element. + * + * You need Cache Killer on Chrome to see the effect on any FOM transformation + * directly on refresh (F5) + * http://stackoverflow.com/questions/5690269/disabling-chrome-cache-for-website-development/7000899#answer-11786277 + */ + function addAttributeInElement( node, elementTarget, separator ) { + + var mardownClassesInElementsRegex = new RegExp( separator, 'mg' ); + var mardownClassRegex = new RegExp( "([^\"= ]+?)=\"([^\"=]+?)\"", 'mg' ); + var nodeValue = node.nodeValue; + if( matches = mardownClassesInElementsRegex.exec( nodeValue ) ) { + + var classes = matches[1]; + nodeValue = nodeValue.substring( 0, matches.index ) + nodeValue.substring( mardownClassesInElementsRegex.lastIndex ); + node.nodeValue = nodeValue; + while( matchesClass = mardownClassRegex.exec( classes ) ) { + elementTarget.setAttribute( matchesClass[1], matchesClass[2] ); + } + return true; + } + return false; + } + + /** + * Add attributes to the parent element of a text node, + * or the element of an attribute node. + */ + function addAttributes( section, element, previousElement, separatorElementAttributes, separatorSectionAttributes ) { + + if ( element != null && element.childNodes != undefined && element.childNodes.length > 0 ) { + previousParentElement = element; + for( var i = 0; i < element.childNodes.length; i++ ) { + childElement = element.childNodes[i]; + if ( i > 0 ) { + j = i - 1; + while ( j >= 0 ) { + aPreviousChildElement = element.childNodes[j]; + if ( typeof aPreviousChildElement.setAttribute == 'function' && aPreviousChildElement.tagName != "BR" ) { + previousParentElement = aPreviousChildElement; + break; + } + j = j - 1; + } + } + parentSection = section; + if( childElement.nodeName == "section" ) { + parentSection = childElement ; + previousParentElement = childElement ; + } + if ( typeof childElement.setAttribute == 'function' || childElement.nodeType == Node.COMMENT_NODE ) { + addAttributes( parentSection, childElement, previousParentElement, separatorElementAttributes, separatorSectionAttributes ); + } + } + } + + if ( element.nodeType == Node.COMMENT_NODE ) { + if ( addAttributeInElement( element, previousElement, separatorElementAttributes ) == false ) { + addAttributeInElement( element, section, separatorSectionAttributes ); + } + } + } + + /** + * Converts any current data-markdown slides in the + * DOM to HTML. + */ + function convertSlides() { + + var sections = document.querySelectorAll( '[data-markdown]'); + + for( var i = 0, len = sections.length; i < len; i++ ) { + + var section = sections[i]; + + // Only parse the same slide once + if( !section.getAttribute( 'data-markdown-parsed' ) ) { + + section.setAttribute( 'data-markdown-parsed', true ) + + var notes = section.querySelector( 'aside.notes' ); + var markdown = getMarkdownFromSlide( section ); + + section.innerHTML = marked( markdown ); + addAttributes( section, section, null, section.getAttribute( 'data-element-attributes' ) || + section.parentNode.getAttribute( 'data-element-attributes' ) || + DEFAULT_ELEMENT_ATTRIBUTES_SEPARATOR, + section.getAttribute( 'data-attributes' ) || + section.parentNode.getAttribute( 'data-attributes' ) || + DEFAULT_SLIDE_ATTRIBUTES_SEPARATOR); + + // If there were notes, we need to re-add them after + // having overwritten the section's HTML + if( notes ) { + section.appendChild( notes ); + } + + } + + } + + } + + // API + return { + + initialize: function() { + if( typeof marked === 'undefined' ) { + throw 'The reveal.js Markdown plugin requires marked to be loaded'; + } + + if( typeof hljs !== 'undefined' ) { + marked.setOptions({ + highlight: function( code, lang ) { + return hljs.highlightAuto( code, [lang] ).value; + } + }); + } + + var options = Reveal.getConfig().markdown; + + if ( options ) { + marked.setOptions( options ); + } + + processSlides(); + convertSlides(); + }, + + // TODO: Do these belong in the API? + processSlides: processSlides, + convertSlides: convertSlides, + slidify: slidify + + }; + +})); diff --git a/node_modules/reveal.js/plugin/markdown/marked.js b/node_modules/reveal.js/plugin/markdown/marked.js new file mode 100644 index 0000000..555c1dc --- /dev/null +++ b/node_modules/reveal.js/plugin/markdown/marked.js @@ -0,0 +1,6 @@ +/** + * marked - a markdown parser + * Copyright (c) 2011-2014, Christopher Jeffrey. (MIT Licensed) + * https://github.com/chjj/marked + */ +(function(){var block={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,fences:noop,hr:/^( *[-*_]){3,} *(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *#* *(?:\n+|$)/,nptable:noop,lheading:/^([^\n]+)\n *(=|-){2,} *(?:\n+|$)/,blockquote:/^( *>[^\n]+(\n(?!def)[^\n]+)*\n*)+/,list:/^( *)(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,html:/^ *(?:comment *(?:\n|\s*$)|closed *(?:\n{2,}|\s*$)|closing *(?:\n{2,}|\s*$))/,def:/^ *\[([^\]]+)\]: *]+)>?(?: +["(]([^\n]+)[")])? *(?:\n+|$)/,table:noop,paragraph:/^((?:[^\n]+\n?(?!hr|heading|lheading|blockquote|tag|def))+)\n*/,text:/^[^\n]+/};block.bullet=/(?:[*+-]|\d+\.)/;block.item=/^( *)(bull) [^\n]*(?:\n(?!\1bull )[^\n]*)*/;block.item=replace(block.item,"gm")(/bull/g,block.bullet)();block.list=replace(block.list)(/bull/g,block.bullet)("hr","\\n+(?=\\1?(?:[-*_] *){3,}(?:\\n+|$))")("def","\\n+(?="+block.def.source+")")();block.blockquote=replace(block.blockquote)("def",block.def)();block._tag="(?!(?:"+"a|em|strong|small|s|cite|q|dfn|abbr|data|time|code"+"|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo"+"|span|br|wbr|ins|del|img)\\b)\\w+(?!:/|[^\\w\\s@]*@)\\b";block.html=replace(block.html)("comment",//)("closed",/<(tag)[\s\S]+?<\/\1>/)("closing",/])*?>/)(/tag/g,block._tag)();block.paragraph=replace(block.paragraph)("hr",block.hr)("heading",block.heading)("lheading",block.lheading)("blockquote",block.blockquote)("tag","<"+block._tag)("def",block.def)();block.normal=merge({},block);block.gfm=merge({},block.normal,{fences:/^ *(`{3,}|~{3,})[ \.]*(\S+)? *\n([\s\S]*?)\s*\1 *(?:\n+|$)/,paragraph:/^/,heading:/^ *(#{1,6}) +([^\n]+?) *#* *(?:\n+|$)/});block.gfm.paragraph=replace(block.paragraph)("(?!","(?!"+block.gfm.fences.source.replace("\\1","\\2")+"|"+block.list.source.replace("\\1","\\3")+"|")();block.tables=merge({},block.gfm,{nptable:/^ *(\S.*\|.*)\n *([-:]+ *\|[-| :]*)\n((?:.*\|.*(?:\n|$))*)\n*/,table:/^ *\|(.+)\n *\|( *[-:]+[-| :]*)\n((?: *\|.*(?:\n|$))*)\n*/});function Lexer(options){this.tokens=[];this.tokens.links={};this.options=options||marked.defaults;this.rules=block.normal;if(this.options.gfm){if(this.options.tables){this.rules=block.tables}else{this.rules=block.gfm}}}Lexer.rules=block;Lexer.lex=function(src,options){var lexer=new Lexer(options);return lexer.lex(src)};Lexer.prototype.lex=function(src){src=src.replace(/\r\n|\r/g,"\n").replace(/\t/g," ").replace(/\u00a0/g," ").replace(/\u2424/g,"\n");return this.token(src,true)};Lexer.prototype.token=function(src,top,bq){var src=src.replace(/^ +$/gm,""),next,loose,cap,bull,b,item,space,i,l;while(src){if(cap=this.rules.newline.exec(src)){src=src.substring(cap[0].length);if(cap[0].length>1){this.tokens.push({type:"space"})}}if(cap=this.rules.code.exec(src)){src=src.substring(cap[0].length);cap=cap[0].replace(/^ {4}/gm,"");this.tokens.push({type:"code",text:!this.options.pedantic?cap.replace(/\n+$/,""):cap});continue}if(cap=this.rules.fences.exec(src)){src=src.substring(cap[0].length);this.tokens.push({type:"code",lang:cap[2],text:cap[3]||""});continue}if(cap=this.rules.heading.exec(src)){src=src.substring(cap[0].length);this.tokens.push({type:"heading",depth:cap[1].length,text:cap[2]});continue}if(top&&(cap=this.rules.nptable.exec(src))){src=src.substring(cap[0].length);item={type:"table",header:cap[1].replace(/^ *| *\| *$/g,"").split(/ *\| */),align:cap[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:cap[3].replace(/\n$/,"").split("\n")};for(i=0;i ?/gm,"");this.token(cap,top,true);this.tokens.push({type:"blockquote_end"});continue}if(cap=this.rules.list.exec(src)){src=src.substring(cap[0].length);bull=cap[2];this.tokens.push({type:"list_start",ordered:bull.length>1});cap=cap[0].match(this.rules.item);next=false;l=cap.length;i=0;for(;i1&&b.length>1)){src=cap.slice(i+1).join("\n")+src;i=l-1}}loose=next||/\n\n(?!\s*$)/.test(item);if(i!==l-1){next=item.charAt(item.length-1)==="\n";if(!loose)loose=next}this.tokens.push({type:loose?"loose_item_start":"list_item_start"});this.token(item,false,bq);this.tokens.push({type:"list_item_end"})}this.tokens.push({type:"list_end"});continue}if(cap=this.rules.html.exec(src)){src=src.substring(cap[0].length);this.tokens.push({type:this.options.sanitize?"paragraph":"html",pre:!this.options.sanitizer&&(cap[1]==="pre"||cap[1]==="script"||cap[1]==="style"),text:cap[0]});continue}if(!bq&&top&&(cap=this.rules.def.exec(src))){src=src.substring(cap[0].length);this.tokens.links[cap[1].toLowerCase()]={href:cap[2],title:cap[3]};continue}if(top&&(cap=this.rules.table.exec(src))){src=src.substring(cap[0].length);item={type:"table",header:cap[1].replace(/^ *| *\| *$/g,"").split(/ *\| */),align:cap[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:cap[3].replace(/(?: *\| *)?\n$/,"").split("\n")};for(i=0;i])/,autolink:/^<([^ >]+(@|:\/)[^ >]+)>/,url:noop,tag:/^|^<\/?\w+(?:"[^"]*"|'[^']*'|[^'">])*?>/,link:/^!?\[(inside)\]\(href\)/,reflink:/^!?\[(inside)\]\s*\[([^\]]*)\]/,nolink:/^!?\[((?:\[[^\]]*\]|[^\[\]])*)\]/,strong:/^__([\s\S]+?)__(?!_)|^\*\*([\s\S]+?)\*\*(?!\*)/,em:/^\b_((?:[^_]|__)+?)_\b|^\*((?:\*\*|[\s\S])+?)\*(?!\*)/,code:/^(`+)\s*([\s\S]*?[^`])\s*\1(?!`)/,br:/^ {2,}\n(?!\s*$)/,del:noop,text:/^[\s\S]+?(?=[\\?(?:\s+['"]([\s\S]*?)['"])?\s*/;inline.link=replace(inline.link)("inside",inline._inside)("href",inline._href)();inline.reflink=replace(inline.reflink)("inside",inline._inside)();inline.normal=merge({},inline);inline.pedantic=merge({},inline.normal,{strong:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,em:/^_(?=\S)([\s\S]*?\S)_(?!_)|^\*(?=\S)([\s\S]*?\S)\*(?!\*)/});inline.gfm=merge({},inline.normal,{escape:replace(inline.escape)("])","~|])")(),url:/^(https?:\/\/[^\s<]+[^<.,:;"')\]\s])/,del:/^~~(?=\S)([\s\S]*?\S)~~/,text:replace(inline.text)("]|","~]|")("|","|https?://|")()});inline.breaks=merge({},inline.gfm,{br:replace(inline.br)("{2,}","*")(),text:replace(inline.gfm.text)("{2,}","*")()});function InlineLexer(links,options){this.options=options||marked.defaults;this.links=links;this.rules=inline.normal;this.renderer=this.options.renderer||new Renderer;this.renderer.options=this.options;if(!this.links){throw new Error("Tokens array requires a `links` property.")}if(this.options.gfm){if(this.options.breaks){this.rules=inline.breaks}else{this.rules=inline.gfm}}else if(this.options.pedantic){this.rules=inline.pedantic}}InlineLexer.rules=inline;InlineLexer.output=function(src,links,options){var inline=new InlineLexer(links,options);return inline.output(src)};InlineLexer.prototype.output=function(src){var out="",link,text,href,cap;while(src){if(cap=this.rules.escape.exec(src)){src=src.substring(cap[0].length);out+=cap[1];continue}if(cap=this.rules.autolink.exec(src)){src=src.substring(cap[0].length);if(cap[2]==="@"){text=cap[1].charAt(6)===":"?this.mangle(cap[1].substring(7)):this.mangle(cap[1]);href=this.mangle("mailto:")+text}else{text=escape(cap[1]);href=text}out+=this.renderer.link(href,null,text);continue}if(!this.inLink&&(cap=this.rules.url.exec(src))){src=src.substring(cap[0].length);text=escape(cap[1]);href=text;out+=this.renderer.link(href,null,text);continue}if(cap=this.rules.tag.exec(src)){if(!this.inLink&&/^
    /i.test(cap[0])){this.inLink=false}src=src.substring(cap[0].length);out+=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(cap[0]):escape(cap[0]):cap[0];continue}if(cap=this.rules.link.exec(src)){src=src.substring(cap[0].length);this.inLink=true;out+=this.outputLink(cap,{href:cap[2],title:cap[3]});this.inLink=false;continue}if((cap=this.rules.reflink.exec(src))||(cap=this.rules.nolink.exec(src))){src=src.substring(cap[0].length);link=(cap[2]||cap[1]).replace(/\s+/g," ");link=this.links[link.toLowerCase()];if(!link||!link.href){out+=cap[0].charAt(0);src=cap[0].substring(1)+src;continue}this.inLink=true;out+=this.outputLink(cap,link);this.inLink=false;continue}if(cap=this.rules.strong.exec(src)){src=src.substring(cap[0].length);out+=this.renderer.strong(this.output(cap[2]||cap[1]));continue}if(cap=this.rules.em.exec(src)){src=src.substring(cap[0].length);out+=this.renderer.em(this.output(cap[2]||cap[1]));continue}if(cap=this.rules.code.exec(src)){src=src.substring(cap[0].length);out+=this.renderer.codespan(escape(cap[2],true));continue}if(cap=this.rules.br.exec(src)){src=src.substring(cap[0].length);out+=this.renderer.br();continue}if(cap=this.rules.del.exec(src)){src=src.substring(cap[0].length);out+=this.renderer.del(this.output(cap[1]));continue}if(cap=this.rules.text.exec(src)){src=src.substring(cap[0].length);out+=this.renderer.text(escape(this.smartypants(cap[0])));continue}if(src){throw new Error("Infinite loop on byte: "+src.charCodeAt(0))}}return out};InlineLexer.prototype.outputLink=function(cap,link){var href=escape(link.href),title=link.title?escape(link.title):null;return cap[0].charAt(0)!=="!"?this.renderer.link(href,title,this.output(cap[1])):this.renderer.image(href,title,escape(cap[1]))};InlineLexer.prototype.smartypants=function(text){if(!this.options.smartypants)return text;return text.replace(/---/g,"—").replace(/--/g,"–").replace(/(^|[-\u2014/(\[{"\s])'/g,"$1‘").replace(/'/g,"’").replace(/(^|[-\u2014/(\[{\u2018\s])"/g,"$1“").replace(/"/g,"”").replace(/\.{3}/g,"…")};InlineLexer.prototype.mangle=function(text){if(!this.options.mangle)return text;var out="",l=text.length,i=0,ch;for(;i.5){ch="x"+ch.toString(16)}out+="&#"+ch+";"}return out};function Renderer(options){this.options=options||{}}Renderer.prototype.code=function(code,lang,escaped){if(this.options.highlight){var out=this.options.highlight(code,lang);if(out!=null&&out!==code){escaped=true;code=out}}if(!lang){return"
    "+(escaped?code:escape(code,true))+"\n
    "}return'
    '+(escaped?code:escape(code,true))+"\n
    \n"};Renderer.prototype.blockquote=function(quote){return"
    \n"+quote+"
    \n"};Renderer.prototype.html=function(html){return html};Renderer.prototype.heading=function(text,level,raw){return"'+text+"\n"};Renderer.prototype.hr=function(){return this.options.xhtml?"
    \n":"
    \n"};Renderer.prototype.list=function(body,ordered){var type=ordered?"ol":"ul";return"<"+type+">\n"+body+"\n"};Renderer.prototype.listitem=function(text){return"
  • "+text+"
  • \n"};Renderer.prototype.paragraph=function(text){return"

    "+text+"

    \n"};Renderer.prototype.table=function(header,body){return"\n"+"\n"+header+"\n"+"\n"+body+"\n"+"
    \n"};Renderer.prototype.tablerow=function(content){return"\n"+content+"\n"};Renderer.prototype.tablecell=function(content,flags){var type=flags.header?"th":"td";var tag=flags.align?"<"+type+' style="text-align:'+flags.align+'">':"<"+type+">";return tag+content+"\n"};Renderer.prototype.strong=function(text){return""+text+""};Renderer.prototype.em=function(text){return""+text+""};Renderer.prototype.codespan=function(text){return""+text+""};Renderer.prototype.br=function(){return this.options.xhtml?"
    ":"
    "};Renderer.prototype.del=function(text){return""+text+""};Renderer.prototype.link=function(href,title,text){if(this.options.sanitize){try{var prot=decodeURIComponent(unescape(href)).replace(/[^\w:]/g,"").toLowerCase()}catch(e){return""}if(prot.indexOf("javascript:")===0||prot.indexOf("vbscript:")===0){return""}}var out='
    ";return out};Renderer.prototype.image=function(href,title,text){var out=''+text+'":">";return out};Renderer.prototype.text=function(text){return text};function Parser(options){this.tokens=[];this.token=null;this.options=options||marked.defaults;this.options.renderer=this.options.renderer||new Renderer;this.renderer=this.options.renderer;this.renderer.options=this.options}Parser.parse=function(src,options,renderer){var parser=new Parser(options,renderer);return parser.parse(src)};Parser.prototype.parse=function(src){this.inline=new InlineLexer(src.links,this.options,this.renderer);this.tokens=src.reverse();var out="";while(this.next()){out+=this.tok()}return out};Parser.prototype.next=function(){return this.token=this.tokens.pop()};Parser.prototype.peek=function(){return this.tokens[this.tokens.length-1]||0};Parser.prototype.parseText=function(){var body=this.token.text;while(this.peek().type==="text"){body+="\n"+this.next().text}return this.inline.output(body)};Parser.prototype.tok=function(){switch(this.token.type){case"space":{return""}case"hr":{return this.renderer.hr()}case"heading":{return this.renderer.heading(this.inline.output(this.token.text),this.token.depth,this.token.text)}case"code":{return this.renderer.code(this.token.text,this.token.lang,this.token.escaped)}case"table":{var header="",body="",i,row,cell,flags,j;cell="";for(i=0;i/g,">").replace(/"/g,""").replace(/'/g,"'")}function unescape(html){return html.replace(/&([#\w]+);/g,function(_,n){n=n.toLowerCase();if(n==="colon")return":";if(n.charAt(0)==="#"){return n.charAt(1)==="x"?String.fromCharCode(parseInt(n.substring(2),16)):String.fromCharCode(+n.substring(1))}return""})}function replace(regex,opt){regex=regex.source;opt=opt||"";return function self(name,val){if(!name)return new RegExp(regex,opt);val=val.source||val;val=val.replace(/(^|[^\[])\^/g,"$1");regex=regex.replace(name,val);return self}}function noop(){}noop.exec=noop;function merge(obj){var i=1,target,key;for(;iAn error occured:

    "+escape(e.message+"",true)+"
    "}throw e}}marked.options=marked.setOptions=function(opt){merge(marked.defaults,opt);return marked};marked.defaults={gfm:true,tables:true,breaks:false,pedantic:false,sanitize:false,sanitizer:null,mangle:true,smartLists:false,silent:false,highlight:null,langPrefix:"lang-",smartypants:false,headerPrefix:"",renderer:new Renderer,xhtml:false};marked.Parser=Parser;marked.parser=Parser.parse;marked.Renderer=Renderer;marked.Lexer=Lexer;marked.lexer=Lexer.lex;marked.InlineLexer=InlineLexer;marked.inlineLexer=InlineLexer.output;marked.parse=marked;if(typeof module!=="undefined"&&typeof exports==="object"){module.exports=marked}else if(typeof define==="function"&&define.amd){define(function(){return marked})}else{this.marked=marked}}).call(function(){return this||(typeof window!=="undefined"?window:global)}()); \ No newline at end of file diff --git a/node_modules/reveal.js/plugin/math/math.js b/node_modules/reveal.js/plugin/math/math.js new file mode 100755 index 0000000..7867376 --- /dev/null +++ b/node_modules/reveal.js/plugin/math/math.js @@ -0,0 +1,67 @@ +/** + * A plugin which enables rendering of math equations inside + * of reveal.js slides. Essentially a thin wrapper for MathJax. + * + * @author Hakim El Hattab + */ +var RevealMath = window.RevealMath || (function(){ + + var options = Reveal.getConfig().math || {}; + options.mathjax = options.mathjax || 'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js'; + options.config = options.config || 'TeX-AMS_HTML-full'; + options.tex2jax = options.tex2jax || { + inlineMath: [['$','$'],['\\(','\\)']] , + skipTags: ['script','noscript','style','textarea','pre'] }; + + loadScript( options.mathjax + '?config=' + options.config, function() { + + MathJax.Hub.Config({ + messageStyle: 'none', + tex2jax: options.tex2jax, + skipStartupTypeset: true + }); + + // Typeset followed by an immediate reveal.js layout since + // the typesetting process could affect slide height + MathJax.Hub.Queue( [ 'Typeset', MathJax.Hub ] ); + MathJax.Hub.Queue( Reveal.layout ); + + // Reprocess equations in slides when they turn visible + Reveal.addEventListener( 'slidechanged', function( event ) { + + MathJax.Hub.Queue( [ 'Typeset', MathJax.Hub, event.currentSlide ] ); + + } ); + + } ); + + function loadScript( url, callback ) { + + var head = document.querySelector( 'head' ); + var script = document.createElement( 'script' ); + script.type = 'text/javascript'; + script.src = url; + + // Wrapper for callback to make sure it only fires once + var finish = function() { + if( typeof callback === 'function' ) { + callback.call(); + callback = null; + } + } + + script.onload = finish; + + // IE + script.onreadystatechange = function() { + if ( this.readyState === 'loaded' ) { + finish(); + } + } + + // Normal browsers + head.appendChild( script ); + + } + +})(); diff --git a/node_modules/reveal.js/plugin/multiplex/client.js b/node_modules/reveal.js/plugin/multiplex/client.js new file mode 100644 index 0000000..3ffd1e0 --- /dev/null +++ b/node_modules/reveal.js/plugin/multiplex/client.js @@ -0,0 +1,13 @@ +(function() { + var multiplex = Reveal.getConfig().multiplex; + var socketId = multiplex.id; + var socket = io.connect(multiplex.url); + + socket.on(multiplex.id, function(data) { + // ignore data from sockets that aren't ours + if (data.socketId !== socketId) { return; } + if( window.location.host === 'localhost:1947' ) return; + + Reveal.setState(data.state); + }); +}()); diff --git a/node_modules/reveal.js/plugin/multiplex/index.js b/node_modules/reveal.js/plugin/multiplex/index.js new file mode 100644 index 0000000..8195f04 --- /dev/null +++ b/node_modules/reveal.js/plugin/multiplex/index.js @@ -0,0 +1,64 @@ +var http = require('http'); +var express = require('express'); +var fs = require('fs'); +var io = require('socket.io'); +var crypto = require('crypto'); + +var app = express(); +var staticDir = express.static; +var server = http.createServer(app); + +io = io(server); + +var opts = { + port: process.env.PORT || 1948, + baseDir : __dirname + '/../../' +}; + +io.on( 'connection', function( socket ) { + socket.on('multiplex-statechanged', function(data) { + if (typeof data.secret == 'undefined' || data.secret == null || data.secret === '') return; + if (createHash(data.secret) === data.socketId) { + data.secret = null; + socket.broadcast.emit(data.socketId, data); + }; + }); +}); + +[ 'css', 'js', 'plugin', 'lib' ].forEach(function(dir) { + app.use('/' + dir, staticDir(opts.baseDir + dir)); +}); + +app.get("/", function(req, res) { + res.writeHead(200, {'Content-Type': 'text/html'}); + + var stream = fs.createReadStream(opts.baseDir + '/index.html'); + stream.on('error', function( error ) { + res.write('

    reveal.js multiplex server.

    Generate token'); + res.end(); + }); + stream.on('readable', function() { + stream.pipe(res); + }); +}); + +app.get("/token", function(req,res) { + var ts = new Date().getTime(); + var rand = Math.floor(Math.random()*9999999); + var secret = ts.toString() + rand.toString(); + res.send({secret: secret, socketId: createHash(secret)}); +}); + +var createHash = function(secret) { + var cipher = crypto.createCipher('blowfish', secret); + return(cipher.final('hex')); +}; + +// Actually listen +server.listen( opts.port || null ); + +var brown = '\033[33m', + green = '\033[32m', + reset = '\033[0m'; + +console.log( brown + "reveal.js:" + reset + " Multiplex running on port " + green + opts.port + reset ); \ No newline at end of file diff --git a/node_modules/reveal.js/plugin/multiplex/master.js b/node_modules/reveal.js/plugin/multiplex/master.js new file mode 100644 index 0000000..7f4bf45 --- /dev/null +++ b/node_modules/reveal.js/plugin/multiplex/master.js @@ -0,0 +1,34 @@ +(function() { + + // Don't emit events from inside of notes windows + if ( window.location.search.match( /receiver/gi ) ) { return; } + + var multiplex = Reveal.getConfig().multiplex; + + var socket = io.connect( multiplex.url ); + + function post() { + + var messageData = { + state: Reveal.getState(), + secret: multiplex.secret, + socketId: multiplex.id + }; + + socket.emit( 'multiplex-statechanged', messageData ); + + }; + + // post once the page is loaded, so the client follows also on "open URL". + window.addEventListener( 'load', post ); + + // Monitor events that trigger a change in state + Reveal.addEventListener( 'slidechanged', post ); + Reveal.addEventListener( 'fragmentshown', post ); + Reveal.addEventListener( 'fragmenthidden', post ); + Reveal.addEventListener( 'overviewhidden', post ); + Reveal.addEventListener( 'overviewshown', post ); + Reveal.addEventListener( 'paused', post ); + Reveal.addEventListener( 'resumed', post ); + +}()); diff --git a/node_modules/reveal.js/plugin/multiplex/package.json b/node_modules/reveal.js/plugin/multiplex/package.json new file mode 100644 index 0000000..bbed77a --- /dev/null +++ b/node_modules/reveal.js/plugin/multiplex/package.json @@ -0,0 +1,19 @@ +{ + "name": "reveal-js-multiplex", + "version": "1.0.0", + "description": "reveal.js multiplex server", + "homepage": "http://revealjs.com", + "scripts": { + "start": "node index.js" + }, + "engines": { + "node": "~4.1.1" + }, + "dependencies": { + "express": "~4.13.3", + "grunt-cli": "~0.1.13", + "mustache": "~2.2.1", + "socket.io": "~1.3.7" + }, + "license": "MIT" +} diff --git a/node_modules/reveal.js/plugin/notes-server/client.js b/node_modules/reveal.js/plugin/notes-server/client.js new file mode 100644 index 0000000..00b277b --- /dev/null +++ b/node_modules/reveal.js/plugin/notes-server/client.js @@ -0,0 +1,65 @@ +(function() { + + // don't emit events from inside the previews themselves + if( window.location.search.match( /receiver/gi ) ) { return; } + + var socket = io.connect( window.location.origin ), + socketId = Math.random().toString().slice( 2 ); + + console.log( 'View slide notes at ' + window.location.origin + '/notes/' + socketId ); + + window.open( window.location.origin + '/notes/' + socketId, 'notes-' + socketId ); + + /** + * Posts the current slide data to the notes window + */ + function post() { + + var slideElement = Reveal.getCurrentSlide(), + notesElement = slideElement.querySelector( 'aside.notes' ); + + var messageData = { + notes: '', + markdown: false, + socketId: socketId, + state: Reveal.getState() + }; + + // Look for notes defined in a slide attribute + if( slideElement.hasAttribute( 'data-notes' ) ) { + messageData.notes = slideElement.getAttribute( 'data-notes' ); + } + + // Look for notes defined in an aside element + if( notesElement ) { + messageData.notes = notesElement.innerHTML; + messageData.markdown = typeof notesElement.getAttribute( 'data-markdown' ) === 'string'; + } + + socket.emit( 'statechanged', messageData ); + + } + + // When a new notes window connects, post our current state + socket.on( 'new-subscriber', function( data ) { + post(); + } ); + + // When the state changes from inside of the speaker view + socket.on( 'statechanged-speaker', function( data ) { + Reveal.setState( data.state ); + } ); + + // Monitor events that trigger a change in state + Reveal.addEventListener( 'slidechanged', post ); + Reveal.addEventListener( 'fragmentshown', post ); + Reveal.addEventListener( 'fragmenthidden', post ); + Reveal.addEventListener( 'overviewhidden', post ); + Reveal.addEventListener( 'overviewshown', post ); + Reveal.addEventListener( 'paused', post ); + Reveal.addEventListener( 'resumed', post ); + + // Post the initial state + post(); + +}()); diff --git a/node_modules/reveal.js/plugin/notes-server/index.js b/node_modules/reveal.js/plugin/notes-server/index.js new file mode 100644 index 0000000..b95f071 --- /dev/null +++ b/node_modules/reveal.js/plugin/notes-server/index.js @@ -0,0 +1,69 @@ +var http = require('http'); +var express = require('express'); +var fs = require('fs'); +var io = require('socket.io'); +var Mustache = require('mustache'); + +var app = express(); +var staticDir = express.static; +var server = http.createServer(app); + +io = io(server); + +var opts = { + port : 1947, + baseDir : __dirname + '/../../' +}; + +io.on( 'connection', function( socket ) { + + socket.on( 'new-subscriber', function( data ) { + socket.broadcast.emit( 'new-subscriber', data ); + }); + + socket.on( 'statechanged', function( data ) { + delete data.state.overview; + socket.broadcast.emit( 'statechanged', data ); + }); + + socket.on( 'statechanged-speaker', function( data ) { + delete data.state.overview; + socket.broadcast.emit( 'statechanged-speaker', data ); + }); + +}); + +[ 'css', 'js', 'images', 'plugin', 'lib' ].forEach( function( dir ) { + app.use( '/' + dir, staticDir( opts.baseDir + dir ) ); +}); + +app.get('/', function( req, res ) { + + res.writeHead( 200, { 'Content-Type': 'text/html' } ); + fs.createReadStream( opts.baseDir + '/index.html' ).pipe( res ); + +}); + +app.get( '/notes/:socketId', function( req, res ) { + + fs.readFile( opts.baseDir + 'plugin/notes-server/notes.html', function( err, data ) { + res.send( Mustache.to_html( data.toString(), { + socketId : req.params.socketId + })); + }); + +}); + +// Actually listen +server.listen( opts.port || null ); + +var brown = '\033[33m', + green = '\033[32m', + reset = '\033[0m'; + +var slidesLocation = 'http://localhost' + ( opts.port ? ( ':' + opts.port ) : '' ); + +console.log( brown + 'reveal.js - Speaker Notes' + reset ); +console.log( '1. Open the slides at ' + green + slidesLocation + reset ); +console.log( '2. Click on the link in your JS console to go to the notes page' ); +console.log( '3. Advance through your slides and your notes will advance automatically' ); diff --git a/node_modules/reveal.js/plugin/notes-server/notes.html b/node_modules/reveal.js/plugin/notes-server/notes.html new file mode 100644 index 0000000..ab8c5b1 --- /dev/null +++ b/node_modules/reveal.js/plugin/notes-server/notes.html @@ -0,0 +1,585 @@ + + + + + + reveal.js - Slide Notes + + + + + + +
    +
    Upcoming
    +
    +
    +

    Time Click to Reset

    +
    + 0:00 AM +
    +
    + 00:00:00 +
    +
    +
    + + +
    +
    + + +
    + + + + + + + + diff --git a/node_modules/reveal.js/plugin/notes/notes.html b/node_modules/reveal.js/plugin/notes/notes.html new file mode 100644 index 0000000..0c4eca5 --- /dev/null +++ b/node_modules/reveal.js/plugin/notes/notes.html @@ -0,0 +1,792 @@ + + + + + + reveal.js - Slide Notes + + + + + + +
    Loading speaker view...
    + +
    +
    Upcoming
    +
    +
    +

    Time Click to Reset

    +
    + 0:00 AM +
    +
    + 00:00:00 +
    +
    + + + +
    + + +
    +
    + + +
    + + + + + diff --git a/node_modules/reveal.js/plugin/notes/notes.js b/node_modules/reveal.js/plugin/notes/notes.js new file mode 100644 index 0000000..a5b15b4 --- /dev/null +++ b/node_modules/reveal.js/plugin/notes/notes.js @@ -0,0 +1,147 @@ +/** + * Handles opening of and synchronization with the reveal.js + * notes window. + * + * Handshake process: + * 1. This window posts 'connect' to notes window + * - Includes URL of presentation to show + * 2. Notes window responds with 'connected' when it is available + * 3. This window proceeds to send the current presentation state + * to the notes window + */ +var RevealNotes = (function() { + + function openNotes( notesFilePath ) { + + if( !notesFilePath ) { + var jsFileLocation = document.querySelector('script[src$="notes.js"]').src; // this js file path + jsFileLocation = jsFileLocation.replace(/notes\.js(\?.*)?$/, ''); // the js folder path + notesFilePath = jsFileLocation + 'notes.html'; + } + + var notesPopup = window.open( notesFilePath, 'reveal.js - Notes', 'width=1100,height=700' ); + + if( !notesPopup ) { + alert( 'Speaker view popup failed to open. Please make sure popups are allowed and reopen the speaker view.' ); + return; + } + + // Allow popup window access to Reveal API + notesPopup.Reveal = window.Reveal; + + /** + * Connect to the notes window through a postmessage handshake. + * Using postmessage enables us to work in situations where the + * origins differ, such as a presentation being opened from the + * file system. + */ + function connect() { + // Keep trying to connect until we get a 'connected' message back + var connectInterval = setInterval( function() { + notesPopup.postMessage( JSON.stringify( { + namespace: 'reveal-notes', + type: 'connect', + url: window.location.protocol + '//' + window.location.host + window.location.pathname + window.location.search, + state: Reveal.getState() + } ), '*' ); + }, 500 ); + + window.addEventListener( 'message', function( event ) { + var data = JSON.parse( event.data ); + if( data && data.namespace === 'reveal-notes' && data.type === 'connected' ) { + clearInterval( connectInterval ); + onConnected(); + } + } ); + } + + /** + * Posts the current slide data to the notes window + */ + function post( event ) { + + var slideElement = Reveal.getCurrentSlide(), + notesElement = slideElement.querySelector( 'aside.notes' ), + fragmentElement = slideElement.querySelector( '.current-fragment' ); + + var messageData = { + namespace: 'reveal-notes', + type: 'state', + notes: '', + markdown: false, + whitespace: 'normal', + state: Reveal.getState() + }; + + // Look for notes defined in a slide attribute + if( slideElement.hasAttribute( 'data-notes' ) ) { + messageData.notes = slideElement.getAttribute( 'data-notes' ); + messageData.whitespace = 'pre-wrap'; + } + + // Look for notes defined in a fragment + if( fragmentElement ) { + var fragmentNotes = fragmentElement.querySelector( 'aside.notes' ); + if( fragmentNotes ) { + notesElement = fragmentNotes; + } + else if( fragmentElement.hasAttribute( 'data-notes' ) ) { + messageData.notes = fragmentElement.getAttribute( 'data-notes' ); + messageData.whitespace = 'pre-wrap'; + + // In case there are slide notes + notesElement = null; + } + } + + // Look for notes defined in an aside element + if( notesElement ) { + messageData.notes = notesElement.innerHTML; + messageData.markdown = typeof notesElement.getAttribute( 'data-markdown' ) === 'string'; + } + + notesPopup.postMessage( JSON.stringify( messageData ), '*' ); + + } + + /** + * Called once we have established a connection to the notes + * window. + */ + function onConnected() { + + // Monitor events that trigger a change in state + Reveal.addEventListener( 'slidechanged', post ); + Reveal.addEventListener( 'fragmentshown', post ); + Reveal.addEventListener( 'fragmenthidden', post ); + Reveal.addEventListener( 'overviewhidden', post ); + Reveal.addEventListener( 'overviewshown', post ); + Reveal.addEventListener( 'paused', post ); + Reveal.addEventListener( 'resumed', post ); + + // Post the initial state + post(); + + } + + connect(); + + } + + if( !/receiver/i.test( window.location.search ) ) { + + // If the there's a 'notes' query set, open directly + if( window.location.search.match( /(\?|\&)notes/gi ) !== null ) { + openNotes(); + } + + // Open the notes when the 's' key is hit + Reveal.addKeyBinding({keyCode: 83, key: 'S', description: 'Speaker notes view'}, function() { + openNotes(); + } ); + + } + + return { open: openNotes }; + +})(); diff --git a/node_modules/reveal.js/plugin/print-pdf/print-pdf.js b/node_modules/reveal.js/plugin/print-pdf/print-pdf.js new file mode 100644 index 0000000..f62aedc --- /dev/null +++ b/node_modules/reveal.js/plugin/print-pdf/print-pdf.js @@ -0,0 +1,67 @@ +/** + * phantomjs script for printing presentations to PDF. + * + * Example: + * phantomjs print-pdf.js "http://revealjs.com?print-pdf" reveal-demo.pdf + * + * @author Manuel Bieh (https://github.com/manuelbieh) + * @author Hakim El Hattab (https://github.com/hakimel) + * @author Manuel Riezebosch (https://github.com/riezebosch) + */ + +// html2pdf.js +var system = require( 'system' ); + +var probePage = new WebPage(); +var printPage = new WebPage(); + +var inputFile = system.args[1] || 'index.html?print-pdf'; +var outputFile = system.args[2] || 'slides.pdf'; + +if( outputFile.match( /\.pdf$/gi ) === null ) { + outputFile += '.pdf'; +} + +console.log( 'Export PDF: Reading reveal.js config [1/4]' ); + +probePage.open( inputFile, function( status ) { + + console.log( 'Export PDF: Preparing print layout [2/4]' ); + + var config = probePage.evaluate( function() { + return Reveal.getConfig(); + } ); + + if( config ) { + + printPage.paperSize = { + width: Math.floor( config.width * ( 1 + config.margin ) ), + height: Math.floor( config.height * ( 1 + config.margin ) ), + border: 0 + }; + + printPage.open( inputFile, function( status ) { + console.log( 'Export PDF: Preparing pdf [3/4]') + printPage.evaluate( function() { + Reveal.isReady() ? window.callPhantom() : Reveal.addEventListener( 'pdf-ready', window.callPhantom ); + } ); + } ); + + printPage.onCallback = function( data ) { + // For some reason we need to "jump the queue" for syntax highlighting to work. + // See: http://stackoverflow.com/a/3580132/129269 + setTimeout( function() { + console.log( 'Export PDF: Writing file [4/4]' ); + printPage.render( outputFile ); + console.log( 'Export PDF: Finished successfully!' ); + phantom.exit(); + }, 0 ); + }; + } + else { + + console.log( 'Export PDF: Unable to read reveal.js config. Make sure the input address points to a reveal.js page.' ); + phantom.exit( 1 ); + + } +} ); diff --git a/node_modules/reveal.js/plugin/search/search.js b/node_modules/reveal.js/plugin/search/search.js new file mode 100644 index 0000000..6d694d2 --- /dev/null +++ b/node_modules/reveal.js/plugin/search/search.js @@ -0,0 +1,206 @@ +/* + * Handles finding a text string anywhere in the slides and showing the next occurrence to the user + * by navigatating to that slide and highlighting it. + * + * By Jon Snyder , February 2013 + */ + +var RevealSearch = (function() { + + var matchedSlides; + var currentMatchedIndex; + var searchboxDirty; + var myHilitor; + +// Original JavaScript code by Chirp Internet: www.chirp.com.au +// Please acknowledge use of this code by including this header. +// 2/2013 jon: modified regex to display any match, not restricted to word boundaries. + +function Hilitor(id, tag) +{ + + var targetNode = document.getElementById(id) || document.body; + var hiliteTag = tag || "EM"; + var skipTags = new RegExp("^(?:" + hiliteTag + "|SCRIPT|FORM)$"); + var colors = ["#ff6", "#a0ffff", "#9f9", "#f99", "#f6f"]; + var wordColor = []; + var colorIdx = 0; + var matchRegex = ""; + var matchingSlides = []; + + this.setRegex = function(input) + { + input = input.replace(/^[^\w]+|[^\w]+$/g, "").replace(/[^\w'-]+/g, "|"); + matchRegex = new RegExp("(" + input + ")","i"); + } + + this.getRegex = function() + { + return matchRegex.toString().replace(/^\/\\b\(|\)\\b\/i$/g, "").replace(/\|/g, " "); + } + + // recursively apply word highlighting + this.hiliteWords = function(node) + { + if(node == undefined || !node) return; + if(!matchRegex) return; + if(skipTags.test(node.nodeName)) return; + + if(node.hasChildNodes()) { + for(var i=0; i < node.childNodes.length; i++) + this.hiliteWords(node.childNodes[i]); + } + if(node.nodeType == 3) { // NODE_TEXT + if((nv = node.nodeValue) && (regs = matchRegex.exec(nv))) { + //find the slide's section element and save it in our list of matching slides + var secnode = node; + while (secnode != null && secnode.nodeName != 'SECTION') { + secnode = secnode.parentNode; + } + + var slideIndex = Reveal.getIndices(secnode); + var slidelen = matchingSlides.length; + var alreadyAdded = false; + for (var i=0; i < slidelen; i++) { + if ( (matchingSlides[i].h === slideIndex.h) && (matchingSlides[i].v === slideIndex.v) ) { + alreadyAdded = true; + } + } + if (! alreadyAdded) { + matchingSlides.push(slideIndex); + } + + if(!wordColor[regs[0].toLowerCase()]) { + wordColor[regs[0].toLowerCase()] = colors[colorIdx++ % colors.length]; + } + + var match = document.createElement(hiliteTag); + match.appendChild(document.createTextNode(regs[0])); + match.style.backgroundColor = wordColor[regs[0].toLowerCase()]; + match.style.fontStyle = "inherit"; + match.style.color = "#000"; + + var after = node.splitText(regs.index); + after.nodeValue = after.nodeValue.substring(regs[0].length); + node.parentNode.insertBefore(match, after); + } + } + }; + + // remove highlighting + this.remove = function() + { + var arr = document.getElementsByTagName(hiliteTag); + while(arr.length && (el = arr[0])) { + el.parentNode.replaceChild(el.firstChild, el); + } + }; + + // start highlighting at target node + this.apply = function(input) + { + if(input == undefined || !input) return; + this.remove(); + this.setRegex(input); + this.hiliteWords(targetNode); + return matchingSlides; + }; + +} + + function openSearch() { + //ensure the search term input dialog is visible and has focus: + var inputboxdiv = document.getElementById("searchinputdiv"); + var inputbox = document.getElementById("searchinput"); + inputboxdiv.style.display = "inline"; + inputbox.focus(); + inputbox.select(); + } + + function closeSearch() { + var inputboxdiv = document.getElementById("searchinputdiv"); + inputboxdiv.style.display = "none"; + if(myHilitor) myHilitor.remove(); + } + + function toggleSearch() { + var inputboxdiv = document.getElementById("searchinputdiv"); + if (inputboxdiv.style.display !== "inline") { + openSearch(); + } + else { + closeSearch(); + } + } + + function doSearch() { + //if there's been a change in the search term, perform a new search: + if (searchboxDirty) { + var searchstring = document.getElementById("searchinput").value; + + if (searchstring === '') { + if(myHilitor) myHilitor.remove(); + matchedSlides = null; + } + else { + //find the keyword amongst the slides + myHilitor = new Hilitor("slidecontent"); + matchedSlides = myHilitor.apply(searchstring); + currentMatchedIndex = 0; + } + } + + if (matchedSlides) { + //navigate to the next slide that has the keyword, wrapping to the first if necessary + if (matchedSlides.length && (matchedSlides.length <= currentMatchedIndex)) { + currentMatchedIndex = 0; + } + if (matchedSlides.length > currentMatchedIndex) { + Reveal.slide(matchedSlides[currentMatchedIndex].h, matchedSlides[currentMatchedIndex].v); + currentMatchedIndex++; + } + } + } + + var dom = {}; + dom.wrapper = document.querySelector( '.reveal' ); + + if( !dom.wrapper.querySelector( '.searchbox' ) ) { + var searchElement = document.createElement( 'div' ); + searchElement.id = "searchinputdiv"; + searchElement.classList.add( 'searchdiv' ); + searchElement.style.position = 'absolute'; + searchElement.style.top = '10px'; + searchElement.style.right = '10px'; + searchElement.style.zIndex = 10; + //embedded base64 search icon Designed by Sketchdock - http://www.sketchdock.com/: + searchElement.innerHTML = ''; + dom.wrapper.appendChild( searchElement ); + } + + document.getElementById( 'searchbutton' ).addEventListener( 'click', function(event) { + doSearch(); + }, false ); + + document.getElementById( 'searchinput' ).addEventListener( 'keyup', function( event ) { + switch (event.keyCode) { + case 13: + event.preventDefault(); + doSearch(); + searchboxDirty = false; + break; + default: + searchboxDirty = true; + } + }, false ); + + document.addEventListener( 'keydown', function( event ) { + if( event.key == "F" && (event.ctrlKey || event.metaKey) ) { //Control+Shift+f + event.preventDefault(); + toggleSearch(); + } + }, false ); + if( window.Reveal ) Reveal.registerKeyboardShortcut( 'Ctrl-Shift-F', 'Search' ); + closeSearch(); + return { open: openSearch }; +})(); diff --git a/node_modules/reveal.js/plugin/zoom-js/zoom.js b/node_modules/reveal.js/plugin/zoom-js/zoom.js new file mode 100644 index 0000000..8531790 --- /dev/null +++ b/node_modules/reveal.js/plugin/zoom-js/zoom.js @@ -0,0 +1,272 @@ +// Custom reveal.js integration +(function(){ + var revealElement = document.querySelector( '.reveal' ); + if( revealElement ) { + + revealElement.addEventListener( 'mousedown', function( event ) { + var defaultModifier = /Linux/.test( window.navigator.platform ) ? 'ctrl' : 'alt'; + + var modifier = ( Reveal.getConfig().zoomKey ? Reveal.getConfig().zoomKey : defaultModifier ) + 'Key'; + var zoomLevel = ( Reveal.getConfig().zoomLevel ? Reveal.getConfig().zoomLevel : 2 ); + + if( event[ modifier ] && !Reveal.isOverview() ) { + event.preventDefault(); + + zoom.to({ + x: event.clientX, + y: event.clientY, + scale: zoomLevel, + pan: false + }); + } + } ); + + } +})(); + +/*! + * zoom.js 0.3 (modified for use with reveal.js) + * http://lab.hakim.se/zoom-js + * MIT licensed + * + * Copyright (C) 2011-2014 Hakim El Hattab, http://hakim.se + */ +var zoom = (function(){ + + // The current zoom level (scale) + var level = 1; + + // The current mouse position, used for panning + var mouseX = 0, + mouseY = 0; + + // Timeout before pan is activated + var panEngageTimeout = -1, + panUpdateInterval = -1; + + // Check for transform support so that we can fallback otherwise + var supportsTransforms = 'WebkitTransform' in document.body.style || + 'MozTransform' in document.body.style || + 'msTransform' in document.body.style || + 'OTransform' in document.body.style || + 'transform' in document.body.style; + + if( supportsTransforms ) { + // The easing that will be applied when we zoom in/out + document.body.style.transition = 'transform 0.8s ease'; + document.body.style.OTransition = '-o-transform 0.8s ease'; + document.body.style.msTransition = '-ms-transform 0.8s ease'; + document.body.style.MozTransition = '-moz-transform 0.8s ease'; + document.body.style.WebkitTransition = '-webkit-transform 0.8s ease'; + } + + // Zoom out if the user hits escape + document.addEventListener( 'keyup', function( event ) { + if( level !== 1 && event.keyCode === 27 ) { + zoom.out(); + } + } ); + + // Monitor mouse movement for panning + document.addEventListener( 'mousemove', function( event ) { + if( level !== 1 ) { + mouseX = event.clientX; + mouseY = event.clientY; + } + } ); + + /** + * Applies the CSS required to zoom in, prefers the use of CSS3 + * transforms but falls back on zoom for IE. + * + * @param {Object} rect + * @param {Number} scale + */ + function magnify( rect, scale ) { + + var scrollOffset = getScrollOffset(); + + // Ensure a width/height is set + rect.width = rect.width || 1; + rect.height = rect.height || 1; + + // Center the rect within the zoomed viewport + rect.x -= ( window.innerWidth - ( rect.width * scale ) ) / 2; + rect.y -= ( window.innerHeight - ( rect.height * scale ) ) / 2; + + if( supportsTransforms ) { + // Reset + if( scale === 1 ) { + document.body.style.transform = ''; + document.body.style.OTransform = ''; + document.body.style.msTransform = ''; + document.body.style.MozTransform = ''; + document.body.style.WebkitTransform = ''; + } + // Scale + else { + var origin = scrollOffset.x +'px '+ scrollOffset.y +'px', + transform = 'translate('+ -rect.x +'px,'+ -rect.y +'px) scale('+ scale +')'; + + document.body.style.transformOrigin = origin; + document.body.style.OTransformOrigin = origin; + document.body.style.msTransformOrigin = origin; + document.body.style.MozTransformOrigin = origin; + document.body.style.WebkitTransformOrigin = origin; + + document.body.style.transform = transform; + document.body.style.OTransform = transform; + document.body.style.msTransform = transform; + document.body.style.MozTransform = transform; + document.body.style.WebkitTransform = transform; + } + } + else { + // Reset + if( scale === 1 ) { + document.body.style.position = ''; + document.body.style.left = ''; + document.body.style.top = ''; + document.body.style.width = ''; + document.body.style.height = ''; + document.body.style.zoom = ''; + } + // Scale + else { + document.body.style.position = 'relative'; + document.body.style.left = ( - ( scrollOffset.x + rect.x ) / scale ) + 'px'; + document.body.style.top = ( - ( scrollOffset.y + rect.y ) / scale ) + 'px'; + document.body.style.width = ( scale * 100 ) + '%'; + document.body.style.height = ( scale * 100 ) + '%'; + document.body.style.zoom = scale; + } + } + + level = scale; + + if( document.documentElement.classList ) { + if( level !== 1 ) { + document.documentElement.classList.add( 'zoomed' ); + } + else { + document.documentElement.classList.remove( 'zoomed' ); + } + } + } + + /** + * Pan the document when the mosue cursor approaches the edges + * of the window. + */ + function pan() { + var range = 0.12, + rangeX = window.innerWidth * range, + rangeY = window.innerHeight * range, + scrollOffset = getScrollOffset(); + + // Up + if( mouseY < rangeY ) { + window.scroll( scrollOffset.x, scrollOffset.y - ( 1 - ( mouseY / rangeY ) ) * ( 14 / level ) ); + } + // Down + else if( mouseY > window.innerHeight - rangeY ) { + window.scroll( scrollOffset.x, scrollOffset.y + ( 1 - ( window.innerHeight - mouseY ) / rangeY ) * ( 14 / level ) ); + } + + // Left + if( mouseX < rangeX ) { + window.scroll( scrollOffset.x - ( 1 - ( mouseX / rangeX ) ) * ( 14 / level ), scrollOffset.y ); + } + // Right + else if( mouseX > window.innerWidth - rangeX ) { + window.scroll( scrollOffset.x + ( 1 - ( window.innerWidth - mouseX ) / rangeX ) * ( 14 / level ), scrollOffset.y ); + } + } + + function getScrollOffset() { + return { + x: window.scrollX !== undefined ? window.scrollX : window.pageXOffset, + y: window.scrollY !== undefined ? window.scrollY : window.pageYOffset + } + } + + return { + /** + * Zooms in on either a rectangle or HTML element. + * + * @param {Object} options + * - element: HTML element to zoom in on + * OR + * - x/y: coordinates in non-transformed space to zoom in on + * - width/height: the portion of the screen to zoom in on + * - scale: can be used instead of width/height to explicitly set scale + */ + to: function( options ) { + + // Due to an implementation limitation we can't zoom in + // to another element without zooming out first + if( level !== 1 ) { + zoom.out(); + } + else { + options.x = options.x || 0; + options.y = options.y || 0; + + // If an element is set, that takes precedence + if( !!options.element ) { + // Space around the zoomed in element to leave on screen + var padding = 20; + var bounds = options.element.getBoundingClientRect(); + + options.x = bounds.left - padding; + options.y = bounds.top - padding; + options.width = bounds.width + ( padding * 2 ); + options.height = bounds.height + ( padding * 2 ); + } + + // If width/height values are set, calculate scale from those values + if( options.width !== undefined && options.height !== undefined ) { + options.scale = Math.max( Math.min( window.innerWidth / options.width, window.innerHeight / options.height ), 1 ); + } + + if( options.scale > 1 ) { + options.x *= options.scale; + options.y *= options.scale; + + magnify( options, options.scale ); + + if( options.pan !== false ) { + + // Wait with engaging panning as it may conflict with the + // zoom transition + panEngageTimeout = setTimeout( function() { + panUpdateInterval = setInterval( pan, 1000 / 60 ); + }, 800 ); + + } + } + } + }, + + /** + * Resets the document zoom state to its default. + */ + out: function() { + clearTimeout( panEngageTimeout ); + clearInterval( panUpdateInterval ); + + magnify( { x: 0, y: 0 }, 1 ); + + level = 1; + }, + + // Alias + magnify: function( options ) { this.to( options ) }, + reset: function() { this.out() }, + + zoomLevel: function() { + return level; + } + } + +})(); diff --git a/node_modules/reveal.js/test/examples/assets/image1.png b/node_modules/reveal.js/test/examples/assets/image1.png new file mode 100644 index 0000000..8747594 Binary files /dev/null and b/node_modules/reveal.js/test/examples/assets/image1.png differ diff --git a/node_modules/reveal.js/test/examples/assets/image2.png b/node_modules/reveal.js/test/examples/assets/image2.png new file mode 100644 index 0000000..6c403a0 Binary files /dev/null and b/node_modules/reveal.js/test/examples/assets/image2.png differ diff --git a/node_modules/reveal.js/test/examples/barebones.html b/node_modules/reveal.js/test/examples/barebones.html new file mode 100644 index 0000000..2bee3cb --- /dev/null +++ b/node_modules/reveal.js/test/examples/barebones.html @@ -0,0 +1,41 @@ + + + + + + + reveal.js - Barebones + + + + + + +
    + +
    + +
    +

    Barebones Presentation

    +

    This example contains the bare minimum includes and markup required to run a reveal.js presentation.

    +
    + +
    +

    No Theme

    +

    There's no theme included, so it will fall back on browser defaults.

    +
    + +
    + +
    + + + + + + + diff --git a/node_modules/reveal.js/test/examples/embedded-media.html b/node_modules/reveal.js/test/examples/embedded-media.html new file mode 100644 index 0000000..bbad4be --- /dev/null +++ b/node_modules/reveal.js/test/examples/embedded-media.html @@ -0,0 +1,49 @@ + + + + + + + reveal.js - Embedded Media + + + + + + + + + +
    + +
    + +
    +

    Embedded Media Test

    +
    + +
    + +
    + +
    +

    Empty Slide

    +
    + +
    + +
    + + + + + + + + diff --git a/node_modules/reveal.js/test/examples/math.html b/node_modules/reveal.js/test/examples/math.html new file mode 100644 index 0000000..d35e827 --- /dev/null +++ b/node_modules/reveal.js/test/examples/math.html @@ -0,0 +1,185 @@ + + + + + + + reveal.js - Math Plugin + + + + + + + + + +
    + +
    + +
    +

    reveal.js Math Plugin

    +

    A thin wrapper for MathJax

    +
    + +
    +

    The Lorenz Equations

    + + \[\begin{aligned} + \dot{x} & = \sigma(y-x) \\ + \dot{y} & = \rho x - y - xz \\ + \dot{z} & = -\beta z + xy + \end{aligned} \] +
    + +
    +

    The Cauchy-Schwarz Inequality

    + + +
    + +
    +

    A Cross Product Formula

    + + \[\mathbf{V}_1 \times \mathbf{V}_2 = \begin{vmatrix} + \mathbf{i} & \mathbf{j} & \mathbf{k} \\ + \frac{\partial X}{\partial u} & \frac{\partial Y}{\partial u} & 0 \\ + \frac{\partial X}{\partial v} & \frac{\partial Y}{\partial v} & 0 + \end{vmatrix} \] +
    + +
    +

    The probability of getting \(k\) heads when flipping \(n\) coins is

    + + \[P(E) = {n \choose k} p^k (1-p)^{ n-k} \] +
    + +
    +

    An Identity of Ramanujan

    + + \[ \frac{1}{\Bigl(\sqrt{\phi \sqrt{5}}-\phi\Bigr) e^{\frac25 \pi}} = + 1+\frac{e^{-2\pi}} {1+\frac{e^{-4\pi}} {1+\frac{e^{-6\pi}} + {1+\frac{e^{-8\pi}} {1+\ldots} } } } \] +
    + +
    +

    A Rogers-Ramanujan Identity

    + + \[ 1 + \frac{q^2}{(1-q)}+\frac{q^6}{(1-q)(1-q^2)}+\cdots = + \prod_{j=0}^{\infty}\frac{1}{(1-q^{5j+2})(1-q^{5j+3})}\] +
    + +
    +

    Maxwell’s Equations

    + + \[ \begin{aligned} + \nabla \times \vec{\mathbf{B}} -\, \frac1c\, \frac{\partial\vec{\mathbf{E}}}{\partial t} & = \frac{4\pi}{c}\vec{\mathbf{j}} \\ \nabla \cdot \vec{\mathbf{E}} & = 4 \pi \rho \\ + \nabla \times \vec{\mathbf{E}}\, +\, \frac1c\, \frac{\partial\vec{\mathbf{B}}}{\partial t} & = \vec{\mathbf{0}} \\ + \nabla \cdot \vec{\mathbf{B}} & = 0 \end{aligned} + \] +
    + +
    +
    +

    The Lorenz Equations

    + +
    + \[\begin{aligned} + \dot{x} & = \sigma(y-x) \\ + \dot{y} & = \rho x - y - xz \\ + \dot{z} & = -\beta z + xy + \end{aligned} \] +
    +
    + +
    +

    The Cauchy-Schwarz Inequality

    + +
    + \[ \left( \sum_{k=1}^n a_k b_k \right)^2 \leq \left( \sum_{k=1}^n a_k^2 \right) \left( \sum_{k=1}^n b_k^2 \right) \] +
    +
    + +
    +

    A Cross Product Formula

    + +
    + \[\mathbf{V}_1 \times \mathbf{V}_2 = \begin{vmatrix} + \mathbf{i} & \mathbf{j} & \mathbf{k} \\ + \frac{\partial X}{\partial u} & \frac{\partial Y}{\partial u} & 0 \\ + \frac{\partial X}{\partial v} & \frac{\partial Y}{\partial v} & 0 + \end{vmatrix} \] +
    +
    + +
    +

    The probability of getting \(k\) heads when flipping \(n\) coins is

    + +
    + \[P(E) = {n \choose k} p^k (1-p)^{ n-k} \] +
    +
    + +
    +

    An Identity of Ramanujan

    + +
    + \[ \frac{1}{\Bigl(\sqrt{\phi \sqrt{5}}-\phi\Bigr) e^{\frac25 \pi}} = + 1+\frac{e^{-2\pi}} {1+\frac{e^{-4\pi}} {1+\frac{e^{-6\pi}} + {1+\frac{e^{-8\pi}} {1+\ldots} } } } \] +
    +
    + +
    +

    A Rogers-Ramanujan Identity

    + +
    + \[ 1 + \frac{q^2}{(1-q)}+\frac{q^6}{(1-q)(1-q^2)}+\cdots = + \prod_{j=0}^{\infty}\frac{1}{(1-q^{5j+2})(1-q^{5j+3})}\] +
    +
    + +
    +

    Maxwell’s Equations

    + +
    + \[ \begin{aligned} + \nabla \times \vec{\mathbf{B}} -\, \frac1c\, \frac{\partial\vec{\mathbf{E}}}{\partial t} & = \frac{4\pi}{c}\vec{\mathbf{j}} \\ \nabla \cdot \vec{\mathbf{E}} & = 4 \pi \rho \\ + \nabla \times \vec{\mathbf{E}}\, +\, \frac1c\, \frac{\partial\vec{\mathbf{B}}}{\partial t} & = \vec{\mathbf{0}} \\ + \nabla \cdot \vec{\mathbf{B}} & = 0 \end{aligned} + \] +
    +
    +
    + +
    + +
    + + + + + + + + diff --git a/node_modules/reveal.js/test/examples/slide-backgrounds.html b/node_modules/reveal.js/test/examples/slide-backgrounds.html new file mode 100644 index 0000000..316c92a --- /dev/null +++ b/node_modules/reveal.js/test/examples/slide-backgrounds.html @@ -0,0 +1,144 @@ + + + + + + + reveal.js - Slide Backgrounds + + + + + + + + + + +
    + +
    + +
    +

    data-background: #00ffff

    +
    + +
    +

    data-background: #bb00bb

    +
    + +
    +

    data-background: lightblue

    +
    + +
    +
    +

    data-background: #ff0000

    +
    +
    +

    data-background: rgba(0, 0, 0, 0.2)

    +
    +
    +

    data-background: salmon

    +
    +
    + +
    +
    +

    Background applied to stack

    +
    +
    +

    Background applied to stack

    +
    +
    +

    Background applied to slide inside of stack

    +
    +
    + +
    +

    Background image

    +
    + +
    +
    +

    Background image

    +
    +
    +

    Background image

    +
    +
    + +
    +

    Background image

    +
    data-background-size="100px" data-background-repeat="repeat" data-background-color="#111"
    +
    + +
    +

    Same background twice (1/2)

    +
    +
    +

    Same background twice (2/2)

    +
    + +
    +

    Video background

    +
    + +
    +

    Iframe background

    +
    + +
    +
    +

    Same background twice vertical (1/2)

    +
    +
    +

    Same background twice vertical (2/2)

    +
    +
    + +
    +

    Same background from horizontal to vertical (1/3)

    +
    +
    +
    +

    Same background from horizontal to vertical (2/3)

    +
    +
    +

    Same background from horizontal to vertical (3/3)

    +
    +
    + +
    + +
    + + + + + + + + diff --git a/node_modules/reveal.js/test/examples/slide-transitions.html b/node_modules/reveal.js/test/examples/slide-transitions.html new file mode 100644 index 0000000..88119dc --- /dev/null +++ b/node_modules/reveal.js/test/examples/slide-transitions.html @@ -0,0 +1,101 @@ + + + + + + + reveal.js - Slide Transitions + + + + + + + + +
    + +
    + +
    +

    Default

    +
    + +
    +

    Default

    +
    + +
    +

    data-transition: zoom

    +
    + +
    +

    data-transition: zoom-in fade-out

    +
    + +
    +

    Default

    +
    + +
    +

    data-transition: convex

    +
    + +
    +

    data-transition: convex-in concave-out

    +
    + +
    +
    +

    Default

    +
    +
    +

    data-transition: concave

    +
    +
    +

    data-transition: convex-in fade-out

    +
    +
    +

    Default

    +
    +
    + +
    +

    data-transition: none

    +
    + +
    +

    Default

    +
    + +
    + +
    + + + + + + + + diff --git a/node_modules/reveal.js/test/qunit-2.5.0.css b/node_modules/reveal.js/test/qunit-2.5.0.css new file mode 100644 index 0000000..21ac68b --- /dev/null +++ b/node_modules/reveal.js/test/qunit-2.5.0.css @@ -0,0 +1,436 @@ +/*! + * QUnit 2.5.0 + * https://qunitjs.com/ + * + * Copyright jQuery Foundation and other contributors + * Released under the MIT license + * https://jquery.org/license + * + * Date: 2018-01-10T02:56Z + */ + +/** Font Family and Sizes */ + +#qunit-tests, #qunit-header, #qunit-banner, #qunit-testrunner-toolbar, #qunit-filteredTest, #qunit-userAgent, #qunit-testresult { + font-family: "Helvetica Neue Light", "HelveticaNeue-Light", "Helvetica Neue", Calibri, Helvetica, Arial, sans-serif; +} + +#qunit-testrunner-toolbar, #qunit-filteredTest, #qunit-userAgent, #qunit-testresult, #qunit-tests li { font-size: small; } +#qunit-tests { font-size: smaller; } + + +/** Resets */ + +#qunit-tests, #qunit-header, #qunit-banner, #qunit-filteredTest, #qunit-userAgent, #qunit-testresult, #qunit-modulefilter { + margin: 0; + padding: 0; +} + + +/** Header (excluding toolbar) */ + +#qunit-header { + padding: 0.5em 0 0.5em 1em; + + color: #8699A4; + background-color: #0D3349; + + font-size: 1.5em; + line-height: 1em; + font-weight: 400; + + border-radius: 5px 5px 0 0; +} + +#qunit-header a { + text-decoration: none; + color: #C2CCD1; +} + +#qunit-header a:hover, +#qunit-header a:focus { + color: #FFF; +} + +#qunit-banner { + height: 5px; +} + +#qunit-filteredTest { + padding: 0.5em 1em 0.5em 1em; + color: #366097; + background-color: #F4FF77; +} + +#qunit-userAgent { + padding: 0.5em 1em 0.5em 1em; + color: #FFF; + background-color: #2B81AF; + text-shadow: rgba(0, 0, 0, 0.5) 2px 2px 1px; +} + + +/** Toolbar */ + +#qunit-testrunner-toolbar { + padding: 0.5em 1em 0.5em 1em; + color: #5E740B; + background-color: #EEE; +} + +#qunit-testrunner-toolbar .clearfix { + height: 0; + clear: both; +} + +#qunit-testrunner-toolbar label { + display: inline-block; +} + +#qunit-testrunner-toolbar input[type=checkbox], +#qunit-testrunner-toolbar input[type=radio] { + margin: 3px; + vertical-align: -2px; +} + +#qunit-testrunner-toolbar input[type=text] { + box-sizing: border-box; + height: 1.6em; +} + +.qunit-url-config, +.qunit-filter, +#qunit-modulefilter { + display: inline-block; + line-height: 2.1em; +} + +.qunit-filter, +#qunit-modulefilter { + float: right; + position: relative; + margin-left: 1em; +} + +.qunit-url-config label { + margin-right: 0.5em; +} + +#qunit-modulefilter-search { + box-sizing: border-box; + width: 400px; +} + +#qunit-modulefilter-search-container:after { + position: absolute; + right: 0.3em; + content: "\25bc"; + color: black; +} + +#qunit-modulefilter-dropdown { + /* align with #qunit-modulefilter-search */ + box-sizing: border-box; + width: 400px; + position: absolute; + right: 0; + top: 50%; + margin-top: 0.8em; + + border: 1px solid #D3D3D3; + border-top: none; + border-radius: 0 0 .25em .25em; + color: #000; + background-color: #F5F5F5; + z-index: 99; +} + +#qunit-modulefilter-dropdown a { + color: inherit; + text-decoration: none; +} + +#qunit-modulefilter-dropdown .clickable.checked { + font-weight: bold; + color: #000; + background-color: #D2E0E6; +} + +#qunit-modulefilter-dropdown .clickable:hover { + color: #FFF; + background-color: #0D3349; +} + +#qunit-modulefilter-actions { + display: block; + overflow: auto; + + /* align with #qunit-modulefilter-dropdown-list */ + font: smaller/1.5em sans-serif; +} + +#qunit-modulefilter-dropdown #qunit-modulefilter-actions > * { + box-sizing: border-box; + max-height: 2.8em; + display: block; + padding: 0.4em; +} + +#qunit-modulefilter-dropdown #qunit-modulefilter-actions > button { + float: right; + font: inherit; +} + +#qunit-modulefilter-dropdown #qunit-modulefilter-actions > :last-child { + /* insert padding to align with checkbox margins */ + padding-left: 3px; +} + +#qunit-modulefilter-dropdown-list { + max-height: 200px; + overflow-y: auto; + margin: 0; + border-top: 2px groove threedhighlight; + padding: 0.4em 0 0; + font: smaller/1.5em sans-serif; +} + +#qunit-modulefilter-dropdown-list li { + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; +} + +#qunit-modulefilter-dropdown-list .clickable { + display: block; + padding-left: 0.15em; +} + + +/** Tests: Pass/Fail */ + +#qunit-tests { + list-style-position: inside; +} + +#qunit-tests li { + padding: 0.4em 1em 0.4em 1em; + border-bottom: 1px solid #FFF; + list-style-position: inside; +} + +#qunit-tests > li { + display: none; +} + +#qunit-tests li.running, +#qunit-tests li.pass, +#qunit-tests li.fail, +#qunit-tests li.skipped, +#qunit-tests li.aborted { + display: list-item; +} + +#qunit-tests.hidepass { + position: relative; +} + +#qunit-tests.hidepass li.running, +#qunit-tests.hidepass li.pass:not(.todo) { + visibility: hidden; + position: absolute; + width: 0; + height: 0; + padding: 0; + border: 0; + margin: 0; +} + +#qunit-tests li strong { + cursor: pointer; +} + +#qunit-tests li.skipped strong { + cursor: default; +} + +#qunit-tests li a { + padding: 0.5em; + color: #C2CCD1; + text-decoration: none; +} + +#qunit-tests li p a { + padding: 0.25em; + color: #6B6464; +} +#qunit-tests li a:hover, +#qunit-tests li a:focus { + color: #000; +} + +#qunit-tests li .runtime { + float: right; + font-size: smaller; +} + +.qunit-assert-list { + margin-top: 0.5em; + padding: 0.5em; + + background-color: #FFF; + + border-radius: 5px; +} + +.qunit-source { + margin: 0.6em 0 0.3em; +} + +.qunit-collapsed { + display: none; +} + +#qunit-tests table { + border-collapse: collapse; + margin-top: 0.2em; +} + +#qunit-tests th { + text-align: right; + vertical-align: top; + padding: 0 0.5em 0 0; +} + +#qunit-tests td { + vertical-align: top; +} + +#qunit-tests pre { + margin: 0; + white-space: pre-wrap; + word-wrap: break-word; +} + +#qunit-tests del { + color: #374E0C; + background-color: #E0F2BE; + text-decoration: none; +} + +#qunit-tests ins { + color: #500; + background-color: #FFCACA; + text-decoration: none; +} + +/*** Test Counts */ + +#qunit-tests b.counts { color: #000; } +#qunit-tests b.passed { color: #5E740B; } +#qunit-tests b.failed { color: #710909; } + +#qunit-tests li li { + padding: 5px; + background-color: #FFF; + border-bottom: none; + list-style-position: inside; +} + +/*** Passing Styles */ + +#qunit-tests li li.pass { + color: #3C510C; + background-color: #FFF; + border-left: 10px solid #C6E746; +} + +#qunit-tests .pass { color: #528CE0; background-color: #D2E0E6; } +#qunit-tests .pass .test-name { color: #366097; } + +#qunit-tests .pass .test-actual, +#qunit-tests .pass .test-expected { color: #999; } + +#qunit-banner.qunit-pass { background-color: #C6E746; } + +/*** Failing Styles */ + +#qunit-tests li li.fail { + color: #710909; + background-color: #FFF; + border-left: 10px solid #EE5757; + white-space: pre; +} + +#qunit-tests > li:last-child { + border-radius: 0 0 5px 5px; +} + +#qunit-tests .fail { color: #000; background-color: #EE5757; } +#qunit-tests .fail .test-name, +#qunit-tests .fail .module-name { color: #000; } + +#qunit-tests .fail .test-actual { color: #EE5757; } +#qunit-tests .fail .test-expected { color: #008000; } + +#qunit-banner.qunit-fail { background-color: #EE5757; } + + +/*** Aborted tests */ +#qunit-tests .aborted { color: #000; background-color: orange; } +/*** Skipped tests */ + +#qunit-tests .skipped { + background-color: #EBECE9; +} + +#qunit-tests .qunit-todo-label, +#qunit-tests .qunit-skipped-label { + background-color: #F4FF77; + display: inline-block; + font-style: normal; + color: #366097; + line-height: 1.8em; + padding: 0 0.5em; + margin: -0.4em 0.4em -0.4em 0; +} + +#qunit-tests .qunit-todo-label { + background-color: #EEE; +} + +/** Result */ + +#qunit-testresult { + color: #2B81AF; + background-color: #D2E0E6; + + border-bottom: 1px solid #FFF; +} +#qunit-testresult .clearfix { + height: 0; + clear: both; +} +#qunit-testresult .module-name { + font-weight: 700; +} +#qunit-testresult-display { + padding: 0.5em 1em 0.5em 1em; + width: 85%; + float:left; +} +#qunit-testresult-controls { + padding: 0.5em 1em 0.5em 1em; + width: 10%; + float:left; +} + +/** Fixture */ + +#qunit-fixture { + position: absolute; + top: -10000px; + left: -10000px; + width: 1000px; + height: 1000px; +} diff --git a/node_modules/reveal.js/test/qunit-2.5.0.js b/node_modules/reveal.js/test/qunit-2.5.0.js new file mode 100644 index 0000000..db72a26 --- /dev/null +++ b/node_modules/reveal.js/test/qunit-2.5.0.js @@ -0,0 +1,5188 @@ +/*! + * QUnit 2.5.0 + * https://qunitjs.com/ + * + * Copyright jQuery Foundation and other contributors + * Released under the MIT license + * https://jquery.org/license + * + * Date: 2018-01-10T02:56Z + */ +(function (global$1) { + 'use strict'; + + global$1 = global$1 && global$1.hasOwnProperty('default') ? global$1['default'] : global$1; + + var window = global$1.window; + var self$1 = global$1.self; + var console = global$1.console; + var setTimeout = global$1.setTimeout; + var clearTimeout = global$1.clearTimeout; + + var document = window && window.document; + var navigator = window && window.navigator; + + var localSessionStorage = function () { + var x = "qunit-test-string"; + try { + global$1.sessionStorage.setItem(x, x); + global$1.sessionStorage.removeItem(x); + return global$1.sessionStorage; + } catch (e) { + return undefined; + } + }(); + + var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { + return typeof obj; + } : function (obj) { + return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; + }; + + + + + + + + + + + + var classCallCheck = function (instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); + } + }; + + var createClass = function () { + function defineProperties(target, props) { + for (var i = 0; i < props.length; i++) { + var descriptor = props[i]; + descriptor.enumerable = descriptor.enumerable || false; + descriptor.configurable = true; + if ("value" in descriptor) descriptor.writable = true; + Object.defineProperty(target, descriptor.key, descriptor); + } + } + + return function (Constructor, protoProps, staticProps) { + if (protoProps) defineProperties(Constructor.prototype, protoProps); + if (staticProps) defineProperties(Constructor, staticProps); + return Constructor; + }; + }(); + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + var toConsumableArray = function (arr) { + if (Array.isArray(arr)) { + for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i]; + + return arr2; + } else { + return Array.from(arr); + } + }; + + var toString = Object.prototype.toString; + var hasOwn = Object.prototype.hasOwnProperty; + var now = Date.now || function () { + return new Date().getTime(); + }; + + var defined = { + document: window && window.document !== undefined, + setTimeout: setTimeout !== undefined + }; + + // Returns a new Array with the elements that are in a but not in b + function diff(a, b) { + var i, + j, + result = a.slice(); + + for (i = 0; i < result.length; i++) { + for (j = 0; j < b.length; j++) { + if (result[i] === b[j]) { + result.splice(i, 1); + i--; + break; + } + } + } + return result; + } + + /** + * Determines whether an element exists in a given array or not. + * + * @method inArray + * @param {Any} elem + * @param {Array} array + * @return {Boolean} + */ + function inArray(elem, array) { + return array.indexOf(elem) !== -1; + } + + /** + * Makes a clone of an object using only Array or Object as base, + * and copies over the own enumerable properties. + * + * @param {Object} obj + * @return {Object} New object with only the own properties (recursively). + */ + function objectValues(obj) { + var key, + val, + vals = is("array", obj) ? [] : {}; + for (key in obj) { + if (hasOwn.call(obj, key)) { + val = obj[key]; + vals[key] = val === Object(val) ? objectValues(val) : val; + } + } + return vals; + } + + function extend(a, b, undefOnly) { + for (var prop in b) { + if (hasOwn.call(b, prop)) { + if (b[prop] === undefined) { + delete a[prop]; + } else if (!(undefOnly && typeof a[prop] !== "undefined")) { + a[prop] = b[prop]; + } + } + } + + return a; + } + + function objectType(obj) { + if (typeof obj === "undefined") { + return "undefined"; + } + + // Consider: typeof null === object + if (obj === null) { + return "null"; + } + + var match = toString.call(obj).match(/^\[object\s(.*)\]$/), + type = match && match[1]; + + switch (type) { + case "Number": + if (isNaN(obj)) { + return "nan"; + } + return "number"; + case "String": + case "Boolean": + case "Array": + case "Set": + case "Map": + case "Date": + case "RegExp": + case "Function": + case "Symbol": + return type.toLowerCase(); + default: + return typeof obj === "undefined" ? "undefined" : _typeof(obj); + } + } + + // Safe object type checking + function is(type, obj) { + return objectType(obj) === type; + } + + // Based on Java's String.hashCode, a simple but not + // rigorously collision resistant hashing function + function generateHash(module, testName) { + var str = module + "\x1C" + testName; + var hash = 0; + + for (var i = 0; i < str.length; i++) { + hash = (hash << 5) - hash + str.charCodeAt(i); + hash |= 0; + } + + // Convert the possibly negative integer hash code into an 8 character hex string, which isn't + // strictly necessary but increases user understanding that the id is a SHA-like hash + var hex = (0x100000000 + hash).toString(16); + if (hex.length < 8) { + hex = "0000000" + hex; + } + + return hex.slice(-8); + } + + // Test for equality any JavaScript type. + // Authors: Philippe Rathé , David Chan + var equiv = (function () { + + // Value pairs queued for comparison. Used for breadth-first processing order, recursion + // detection and avoiding repeated comparison (see below for details). + // Elements are { a: val, b: val }. + var pairs = []; + + var getProto = Object.getPrototypeOf || function (obj) { + return obj.__proto__; + }; + + function useStrictEquality(a, b) { + + // This only gets called if a and b are not strict equal, and is used to compare on + // the primitive values inside object wrappers. For example: + // `var i = 1;` + // `var j = new Number(1);` + // Neither a nor b can be null, as a !== b and they have the same type. + if ((typeof a === "undefined" ? "undefined" : _typeof(a)) === "object") { + a = a.valueOf(); + } + if ((typeof b === "undefined" ? "undefined" : _typeof(b)) === "object") { + b = b.valueOf(); + } + + return a === b; + } + + function compareConstructors(a, b) { + var protoA = getProto(a); + var protoB = getProto(b); + + // Comparing constructors is more strict than using `instanceof` + if (a.constructor === b.constructor) { + return true; + } + + // Ref #851 + // If the obj prototype descends from a null constructor, treat it + // as a null prototype. + if (protoA && protoA.constructor === null) { + protoA = null; + } + if (protoB && protoB.constructor === null) { + protoB = null; + } + + // Allow objects with no prototype to be equivalent to + // objects with Object as their constructor. + if (protoA === null && protoB === Object.prototype || protoB === null && protoA === Object.prototype) { + return true; + } + + return false; + } + + function getRegExpFlags(regexp) { + return "flags" in regexp ? regexp.flags : regexp.toString().match(/[gimuy]*$/)[0]; + } + + function isContainer(val) { + return ["object", "array", "map", "set"].indexOf(objectType(val)) !== -1; + } + + function breadthFirstCompareChild(a, b) { + + // If a is a container not reference-equal to b, postpone the comparison to the + // end of the pairs queue -- unless (a, b) has been seen before, in which case skip + // over the pair. + if (a === b) { + return true; + } + if (!isContainer(a)) { + return typeEquiv(a, b); + } + if (pairs.every(function (pair) { + return pair.a !== a || pair.b !== b; + })) { + + // Not yet started comparing this pair + pairs.push({ a: a, b: b }); + } + return true; + } + + var callbacks = { + "string": useStrictEquality, + "boolean": useStrictEquality, + "number": useStrictEquality, + "null": useStrictEquality, + "undefined": useStrictEquality, + "symbol": useStrictEquality, + "date": useStrictEquality, + + "nan": function nan() { + return true; + }, + + "regexp": function regexp(a, b) { + return a.source === b.source && + + // Include flags in the comparison + getRegExpFlags(a) === getRegExpFlags(b); + }, + + // abort (identical references / instance methods were skipped earlier) + "function": function _function() { + return false; + }, + + "array": function array(a, b) { + var i, len; + + len = a.length; + if (len !== b.length) { + + // Safe and faster + return false; + } + + for (i = 0; i < len; i++) { + + // Compare non-containers; queue non-reference-equal containers + if (!breadthFirstCompareChild(a[i], b[i])) { + return false; + } + } + return true; + }, + + // Define sets a and b to be equivalent if for each element aVal in a, there + // is some element bVal in b such that aVal and bVal are equivalent. Element + // repetitions are not counted, so these are equivalent: + // a = new Set( [ {}, [], [] ] ); + // b = new Set( [ {}, {}, [] ] ); + "set": function set$$1(a, b) { + var innerEq, + outerEq = true; + + if (a.size !== b.size) { + + // This optimization has certain quirks because of the lack of + // repetition counting. For instance, adding the same + // (reference-identical) element to two equivalent sets can + // make them non-equivalent. + return false; + } + + a.forEach(function (aVal) { + + // Short-circuit if the result is already known. (Using for...of + // with a break clause would be cleaner here, but it would cause + // a syntax error on older Javascript implementations even if + // Set is unused) + if (!outerEq) { + return; + } + + innerEq = false; + + b.forEach(function (bVal) { + var parentPairs; + + // Likewise, short-circuit if the result is already known + if (innerEq) { + return; + } + + // Swap out the global pairs list, as the nested call to + // innerEquiv will clobber its contents + parentPairs = pairs; + if (innerEquiv(bVal, aVal)) { + innerEq = true; + } + + // Replace the global pairs list + pairs = parentPairs; + }); + + if (!innerEq) { + outerEq = false; + } + }); + + return outerEq; + }, + + // Define maps a and b to be equivalent if for each key-value pair (aKey, aVal) + // in a, there is some key-value pair (bKey, bVal) in b such that + // [ aKey, aVal ] and [ bKey, bVal ] are equivalent. Key repetitions are not + // counted, so these are equivalent: + // a = new Map( [ [ {}, 1 ], [ {}, 1 ], [ [], 1 ] ] ); + // b = new Map( [ [ {}, 1 ], [ [], 1 ], [ [], 1 ] ] ); + "map": function map(a, b) { + var innerEq, + outerEq = true; + + if (a.size !== b.size) { + + // This optimization has certain quirks because of the lack of + // repetition counting. For instance, adding the same + // (reference-identical) key-value pair to two equivalent maps + // can make them non-equivalent. + return false; + } + + a.forEach(function (aVal, aKey) { + + // Short-circuit if the result is already known. (Using for...of + // with a break clause would be cleaner here, but it would cause + // a syntax error on older Javascript implementations even if + // Map is unused) + if (!outerEq) { + return; + } + + innerEq = false; + + b.forEach(function (bVal, bKey) { + var parentPairs; + + // Likewise, short-circuit if the result is already known + if (innerEq) { + return; + } + + // Swap out the global pairs list, as the nested call to + // innerEquiv will clobber its contents + parentPairs = pairs; + if (innerEquiv([bVal, bKey], [aVal, aKey])) { + innerEq = true; + } + + // Replace the global pairs list + pairs = parentPairs; + }); + + if (!innerEq) { + outerEq = false; + } + }); + + return outerEq; + }, + + "object": function object(a, b) { + var i, + aProperties = [], + bProperties = []; + + if (compareConstructors(a, b) === false) { + return false; + } + + // Be strict: don't ensure hasOwnProperty and go deep + for (i in a) { + + // Collect a's properties + aProperties.push(i); + + // Skip OOP methods that look the same + if (a.constructor !== Object && typeof a.constructor !== "undefined" && typeof a[i] === "function" && typeof b[i] === "function" && a[i].toString() === b[i].toString()) { + continue; + } + + // Compare non-containers; queue non-reference-equal containers + if (!breadthFirstCompareChild(a[i], b[i])) { + return false; + } + } + + for (i in b) { + + // Collect b's properties + bProperties.push(i); + } + + // Ensures identical properties name + return typeEquiv(aProperties.sort(), bProperties.sort()); + } + }; + + function typeEquiv(a, b) { + var type = objectType(a); + + // Callbacks for containers will append to the pairs queue to achieve breadth-first + // search order. The pairs queue is also used to avoid reprocessing any pair of + // containers that are reference-equal to a previously visited pair (a special case + // this being recursion detection). + // + // Because of this approach, once typeEquiv returns a false value, it should not be + // called again without clearing the pair queue else it may wrongly report a visited + // pair as being equivalent. + return objectType(b) === type && callbacks[type](a, b); + } + + function innerEquiv(a, b) { + var i, pair; + + // We're done when there's nothing more to compare + if (arguments.length < 2) { + return true; + } + + // Clear the global pair queue and add the top-level values being compared + pairs = [{ a: a, b: b }]; + + for (i = 0; i < pairs.length; i++) { + pair = pairs[i]; + + // Perform type-specific comparison on any pairs that are not strictly + // equal. For container types, that comparison will postpone comparison + // of any sub-container pair to the end of the pair queue. This gives + // breadth-first search order. It also avoids the reprocessing of + // reference-equal siblings, cousins etc, which can have a significant speed + // impact when comparing a container of small objects each of which has a + // reference to the same (singleton) large object. + if (pair.a !== pair.b && !typeEquiv(pair.a, pair.b)) { + return false; + } + } + + // ...across all consecutive argument pairs + return arguments.length === 2 || innerEquiv.apply(this, [].slice.call(arguments, 1)); + } + + return function () { + var result = innerEquiv.apply(undefined, arguments); + + // Release any retained objects + pairs.length = 0; + return result; + }; + })(); + + /** + * Config object: Maintain internal state + * Later exposed as QUnit.config + * `config` initialized at top of scope + */ + var config = { + + // The queue of tests to run + queue: [], + + // Block until document ready + blocking: true, + + // By default, run previously failed tests first + // very useful in combination with "Hide passed tests" checked + reorder: true, + + // By default, modify document.title when suite is done + altertitle: true, + + // HTML Reporter: collapse every test except the first failing test + // If false, all failing tests will be expanded + collapse: true, + + // By default, scroll to top of the page when suite is done + scrolltop: true, + + // Depth up-to which object will be dumped + maxDepth: 5, + + // When enabled, all tests must call expect() + requireExpects: false, + + // Placeholder for user-configurable form-exposed URL parameters + urlConfig: [], + + // Set of all modules. + modules: [], + + // The first unnamed module + currentModule: { + name: "", + tests: [], + childModules: [], + testsRun: 0, + unskippedTestsRun: 0, + hooks: { + before: [], + beforeEach: [], + afterEach: [], + after: [] + } + }, + + callbacks: {}, + + // The storage module to use for reordering tests + storage: localSessionStorage + }; + + // take a predefined QUnit.config and extend the defaults + var globalConfig = window && window.QUnit && window.QUnit.config; + + // only extend the global config if there is no QUnit overload + if (window && window.QUnit && !window.QUnit.version) { + extend(config, globalConfig); + } + + // Push a loose unnamed module to the modules collection + config.modules.push(config.currentModule); + + // Based on jsDump by Ariel Flesler + // http://flesler.blogspot.com/2008/05/jsdump-pretty-dump-of-any-javascript.html + var dump = (function () { + function quote(str) { + return "\"" + str.toString().replace(/\\/g, "\\\\").replace(/"/g, "\\\"") + "\""; + } + function literal(o) { + return o + ""; + } + function join(pre, arr, post) { + var s = dump.separator(), + base = dump.indent(), + inner = dump.indent(1); + if (arr.join) { + arr = arr.join("," + s + inner); + } + if (!arr) { + return pre + post; + } + return [pre, inner + arr, base + post].join(s); + } + function array(arr, stack) { + var i = arr.length, + ret = new Array(i); + + if (dump.maxDepth && dump.depth > dump.maxDepth) { + return "[object Array]"; + } + + this.up(); + while (i--) { + ret[i] = this.parse(arr[i], undefined, stack); + } + this.down(); + return join("[", ret, "]"); + } + + function isArray(obj) { + return ( + + //Native Arrays + toString.call(obj) === "[object Array]" || + + // NodeList objects + typeof obj.length === "number" && obj.item !== undefined && (obj.length ? obj.item(0) === obj[0] : obj.item(0) === null && obj[0] === undefined) + ); + } + + var reName = /^function (\w+)/, + dump = { + + // The objType is used mostly internally, you can fix a (custom) type in advance + parse: function parse(obj, objType, stack) { + stack = stack || []; + var res, + parser, + parserType, + objIndex = stack.indexOf(obj); + + if (objIndex !== -1) { + return "recursion(" + (objIndex - stack.length) + ")"; + } + + objType = objType || this.typeOf(obj); + parser = this.parsers[objType]; + parserType = typeof parser === "undefined" ? "undefined" : _typeof(parser); + + if (parserType === "function") { + stack.push(obj); + res = parser.call(this, obj, stack); + stack.pop(); + return res; + } + return parserType === "string" ? parser : this.parsers.error; + }, + typeOf: function typeOf(obj) { + var type; + + if (obj === null) { + type = "null"; + } else if (typeof obj === "undefined") { + type = "undefined"; + } else if (is("regexp", obj)) { + type = "regexp"; + } else if (is("date", obj)) { + type = "date"; + } else if (is("function", obj)) { + type = "function"; + } else if (obj.setInterval !== undefined && obj.document !== undefined && obj.nodeType === undefined) { + type = "window"; + } else if (obj.nodeType === 9) { + type = "document"; + } else if (obj.nodeType) { + type = "node"; + } else if (isArray(obj)) { + type = "array"; + } else if (obj.constructor === Error.prototype.constructor) { + type = "error"; + } else { + type = typeof obj === "undefined" ? "undefined" : _typeof(obj); + } + return type; + }, + + separator: function separator() { + if (this.multiline) { + return this.HTML ? "
    " : "\n"; + } else { + return this.HTML ? " " : " "; + } + }, + + // Extra can be a number, shortcut for increasing-calling-decreasing + indent: function indent(extra) { + if (!this.multiline) { + return ""; + } + var chr = this.indentChar; + if (this.HTML) { + chr = chr.replace(/\t/g, " ").replace(/ /g, " "); + } + return new Array(this.depth + (extra || 0)).join(chr); + }, + up: function up(a) { + this.depth += a || 1; + }, + down: function down(a) { + this.depth -= a || 1; + }, + setParser: function setParser(name, parser) { + this.parsers[name] = parser; + }, + + // The next 3 are exposed so you can use them + quote: quote, + literal: literal, + join: join, + depth: 1, + maxDepth: config.maxDepth, + + // This is the list of parsers, to modify them, use dump.setParser + parsers: { + window: "[Window]", + document: "[Document]", + error: function error(_error) { + return "Error(\"" + _error.message + "\")"; + }, + unknown: "[Unknown]", + "null": "null", + "undefined": "undefined", + "function": function _function(fn) { + var ret = "function", + + + // Functions never have name in IE + name = "name" in fn ? fn.name : (reName.exec(fn) || [])[1]; + + if (name) { + ret += " " + name; + } + ret += "("; + + ret = [ret, dump.parse(fn, "functionArgs"), "){"].join(""); + return join(ret, dump.parse(fn, "functionCode"), "}"); + }, + array: array, + nodelist: array, + "arguments": array, + object: function object(map, stack) { + var keys, + key, + val, + i, + nonEnumerableProperties, + ret = []; + + if (dump.maxDepth && dump.depth > dump.maxDepth) { + return "[object Object]"; + } + + dump.up(); + keys = []; + for (key in map) { + keys.push(key); + } + + // Some properties are not always enumerable on Error objects. + nonEnumerableProperties = ["message", "name"]; + for (i in nonEnumerableProperties) { + key = nonEnumerableProperties[i]; + if (key in map && !inArray(key, keys)) { + keys.push(key); + } + } + keys.sort(); + for (i = 0; i < keys.length; i++) { + key = keys[i]; + val = map[key]; + ret.push(dump.parse(key, "key") + ": " + dump.parse(val, undefined, stack)); + } + dump.down(); + return join("{", ret, "}"); + }, + node: function node(_node) { + var len, + i, + val, + open = dump.HTML ? "<" : "<", + close = dump.HTML ? ">" : ">", + tag = _node.nodeName.toLowerCase(), + ret = open + tag, + attrs = _node.attributes; + + if (attrs) { + for (i = 0, len = attrs.length; i < len; i++) { + val = attrs[i].nodeValue; + + // IE6 includes all attributes in .attributes, even ones not explicitly + // set. Those have values like undefined, null, 0, false, "" or + // "inherit". + if (val && val !== "inherit") { + ret += " " + attrs[i].nodeName + "=" + dump.parse(val, "attribute"); + } + } + } + ret += close; + + // Show content of TextNode or CDATASection + if (_node.nodeType === 3 || _node.nodeType === 4) { + ret += _node.nodeValue; + } + + return ret + open + "/" + tag + close; + }, + + // Function calls it internally, it's the arguments part of the function + functionArgs: function functionArgs(fn) { + var args, + l = fn.length; + + if (!l) { + return ""; + } + + args = new Array(l); + while (l--) { + + // 97 is 'a' + args[l] = String.fromCharCode(97 + l); + } + return " " + args.join(", ") + " "; + }, + + // Object calls it internally, the key part of an item in a map + key: quote, + + // Function calls it internally, it's the content of the function + functionCode: "[code]", + + // Node calls it internally, it's a html attribute value + attribute: quote, + string: quote, + date: quote, + regexp: literal, + number: literal, + "boolean": literal, + symbol: function symbol(sym) { + return sym.toString(); + } + }, + + // If true, entities are escaped ( <, >, \t, space and \n ) + HTML: false, + + // Indentation unit + indentChar: " ", + + // If true, items in a collection, are separated by a \n, else just a space. + multiline: true + }; + + return dump; + })(); + + var LISTENERS = Object.create(null); + var SUPPORTED_EVENTS = ["runStart", "suiteStart", "testStart", "assertion", "testEnd", "suiteEnd", "runEnd"]; + + /** + * Emits an event with the specified data to all currently registered listeners. + * Callbacks will fire in the order in which they are registered (FIFO). This + * function is not exposed publicly; it is used by QUnit internals to emit + * logging events. + * + * @private + * @method emit + * @param {String} eventName + * @param {Object} data + * @return {Void} + */ + function emit(eventName, data) { + if (objectType(eventName) !== "string") { + throw new TypeError("eventName must be a string when emitting an event"); + } + + // Clone the callbacks in case one of them registers a new callback + var originalCallbacks = LISTENERS[eventName]; + var callbacks = originalCallbacks ? [].concat(toConsumableArray(originalCallbacks)) : []; + + for (var i = 0; i < callbacks.length; i++) { + callbacks[i](data); + } + } + + /** + * Registers a callback as a listener to the specified event. + * + * @public + * @method on + * @param {String} eventName + * @param {Function} callback + * @return {Void} + */ + function on(eventName, callback) { + if (objectType(eventName) !== "string") { + throw new TypeError("eventName must be a string when registering a listener"); + } else if (!inArray(eventName, SUPPORTED_EVENTS)) { + var events = SUPPORTED_EVENTS.join(", "); + throw new Error("\"" + eventName + "\" is not a valid event; must be one of: " + events + "."); + } else if (objectType(callback) !== "function") { + throw new TypeError("callback must be a function when registering a listener"); + } + + if (!LISTENERS[eventName]) { + LISTENERS[eventName] = []; + } + + // Don't register the same callback more than once + if (!inArray(callback, LISTENERS[eventName])) { + LISTENERS[eventName].push(callback); + } + } + + // Register logging callbacks + function registerLoggingCallbacks(obj) { + var i, + l, + key, + callbackNames = ["begin", "done", "log", "testStart", "testDone", "moduleStart", "moduleDone"]; + + function registerLoggingCallback(key) { + var loggingCallback = function loggingCallback(callback) { + if (objectType(callback) !== "function") { + throw new Error("QUnit logging methods require a callback function as their first parameters."); + } + + config.callbacks[key].push(callback); + }; + + return loggingCallback; + } + + for (i = 0, l = callbackNames.length; i < l; i++) { + key = callbackNames[i]; + + // Initialize key collection of logging callback + if (objectType(config.callbacks[key]) === "undefined") { + config.callbacks[key] = []; + } + + obj[key] = registerLoggingCallback(key); + } + } + + function runLoggingCallbacks(key, args) { + var i, l, callbacks; + + callbacks = config.callbacks[key]; + for (i = 0, l = callbacks.length; i < l; i++) { + callbacks[i](args); + } + } + + // Doesn't support IE9, it will return undefined on these browsers + // See also https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Error/Stack + var fileName = (sourceFromStacktrace(0) || "").replace(/(:\d+)+\)?/, "").replace(/.+\//, ""); + + function extractStacktrace(e, offset) { + offset = offset === undefined ? 4 : offset; + + var stack, include, i; + + if (e && e.stack) { + stack = e.stack.split("\n"); + if (/^error$/i.test(stack[0])) { + stack.shift(); + } + if (fileName) { + include = []; + for (i = offset; i < stack.length; i++) { + if (stack[i].indexOf(fileName) !== -1) { + break; + } + include.push(stack[i]); + } + if (include.length) { + return include.join("\n"); + } + } + return stack[offset]; + } + } + + function sourceFromStacktrace(offset) { + var error = new Error(); + + // Support: Safari <=7 only, IE <=10 - 11 only + // Not all browsers generate the `stack` property for `new Error()`, see also #636 + if (!error.stack) { + try { + throw error; + } catch (err) { + error = err; + } + } + + return extractStacktrace(error, offset); + } + + var priorityCount = 0; + var unitSampler = void 0; + + /** + * Advances the ProcessingQueue to the next item if it is ready. + * @param {Boolean} last + */ + function advance() { + var start = now(); + config.depth = (config.depth || 0) + 1; + + while (config.queue.length && !config.blocking) { + var elapsedTime = now() - start; + + if (!defined.setTimeout || config.updateRate <= 0 || elapsedTime < config.updateRate) { + if (priorityCount > 0) { + priorityCount--; + } + + config.queue.shift()(); + } else { + setTimeout(advance); + break; + } + } + + config.depth--; + + if (!config.blocking && !config.queue.length && config.depth === 0) { + done(); + } + } + + function addToQueueImmediate(callback) { + if (objectType(callback) === "array") { + while (callback.length) { + addToQueueImmediate(callback.pop()); + } + + return; + } + + config.queue.unshift(callback); + priorityCount++; + } + + /** + * Adds a function to the ProcessingQueue for execution. + * @param {Function|Array} callback + * @param {Boolean} priority + * @param {String} seed + */ + function addToQueue(callback, prioritize, seed) { + if (prioritize) { + config.queue.splice(priorityCount++, 0, callback); + } else if (seed) { + if (!unitSampler) { + unitSampler = unitSamplerGenerator(seed); + } + + // Insert into a random position after all prioritized items + var index = Math.floor(unitSampler() * (config.queue.length - priorityCount + 1)); + config.queue.splice(priorityCount + index, 0, callback); + } else { + config.queue.push(callback); + } + } + + /** + * Creates a seeded "sample" generator which is used for randomizing tests. + */ + function unitSamplerGenerator(seed) { + + // 32-bit xorshift, requires only a nonzero seed + // http://excamera.com/sphinx/article-xorshift.html + var sample = parseInt(generateHash(seed), 16) || -1; + return function () { + sample ^= sample << 13; + sample ^= sample >>> 17; + sample ^= sample << 5; + + // ECMAScript has no unsigned number type + if (sample < 0) { + sample += 0x100000000; + } + + return sample / 0x100000000; + }; + } + + /** + * This function is called when the ProcessingQueue is done processing all + * items. It handles emitting the final run events. + */ + function done() { + var storage = config.storage; + + ProcessingQueue.finished = true; + + var runtime = now() - config.started; + var passed = config.stats.all - config.stats.bad; + + emit("runEnd", globalSuite.end(true)); + runLoggingCallbacks("done", { + passed: passed, + failed: config.stats.bad, + total: config.stats.all, + runtime: runtime + }); + + // Clear own storage items if all tests passed + if (storage && config.stats.bad === 0) { + for (var i = storage.length - 1; i >= 0; i--) { + var key = storage.key(i); + + if (key.indexOf("qunit-test-") === 0) { + storage.removeItem(key); + } + } + } + } + + var ProcessingQueue = { + finished: false, + add: addToQueue, + addImmediate: addToQueueImmediate, + advance: advance + }; + + var TestReport = function () { + function TestReport(name, suite, options) { + classCallCheck(this, TestReport); + + this.name = name; + this.suiteName = suite.name; + this.fullName = suite.fullName.concat(name); + this.runtime = 0; + this.assertions = []; + + this.skipped = !!options.skip; + this.todo = !!options.todo; + + this.valid = options.valid; + + this._startTime = 0; + this._endTime = 0; + + suite.pushTest(this); + } + + createClass(TestReport, [{ + key: "start", + value: function start(recordTime) { + if (recordTime) { + this._startTime = Date.now(); + } + + return { + name: this.name, + suiteName: this.suiteName, + fullName: this.fullName.slice() + }; + } + }, { + key: "end", + value: function end(recordTime) { + if (recordTime) { + this._endTime = Date.now(); + } + + return extend(this.start(), { + runtime: this.getRuntime(), + status: this.getStatus(), + errors: this.getFailedAssertions(), + assertions: this.getAssertions() + }); + } + }, { + key: "pushAssertion", + value: function pushAssertion(assertion) { + this.assertions.push(assertion); + } + }, { + key: "getRuntime", + value: function getRuntime() { + return this._endTime - this._startTime; + } + }, { + key: "getStatus", + value: function getStatus() { + if (this.skipped) { + return "skipped"; + } + + var testPassed = this.getFailedAssertions().length > 0 ? this.todo : !this.todo; + + if (!testPassed) { + return "failed"; + } else if (this.todo) { + return "todo"; + } else { + return "passed"; + } + } + }, { + key: "getFailedAssertions", + value: function getFailedAssertions() { + return this.assertions.filter(function (assertion) { + return !assertion.passed; + }); + } + }, { + key: "getAssertions", + value: function getAssertions() { + return this.assertions.slice(); + } + + // Remove actual and expected values from assertions. This is to prevent + // leaking memory throughout a test suite. + + }, { + key: "slimAssertions", + value: function slimAssertions() { + this.assertions = this.assertions.map(function (assertion) { + delete assertion.actual; + delete assertion.expected; + return assertion; + }); + } + }]); + return TestReport; + }(); + + var focused$1 = false; + + function Test(settings) { + var i, l; + + ++Test.count; + + this.expected = null; + this.assertions = []; + this.semaphore = 0; + this.module = config.currentModule; + this.stack = sourceFromStacktrace(3); + this.steps = []; + this.timeout = undefined; + + // If a module is skipped, all its tests and the tests of the child suites + // should be treated as skipped even if they are defined as `only` or `todo`. + // As for `todo` module, all its tests will be treated as `todo` except for + // tests defined as `skip` which will be left intact. + // + // So, if a test is defined as `todo` and is inside a skipped module, we should + // then treat that test as if was defined as `skip`. + if (this.module.skip) { + settings.skip = true; + settings.todo = false; + + // Skipped tests should be left intact + } else if (this.module.todo && !settings.skip) { + settings.todo = true; + } + + extend(this, settings); + + this.testReport = new TestReport(settings.testName, this.module.suiteReport, { + todo: settings.todo, + skip: settings.skip, + valid: this.valid() + }); + + // Register unique strings + for (i = 0, l = this.module.tests; i < l.length; i++) { + if (this.module.tests[i].name === this.testName) { + this.testName += " "; + } + } + + this.testId = generateHash(this.module.name, this.testName); + + this.module.tests.push({ + name: this.testName, + testId: this.testId, + skip: !!settings.skip + }); + + if (settings.skip) { + + // Skipped tests will fully ignore any sent callback + this.callback = function () {}; + this.async = false; + this.expected = 0; + } else { + if (typeof this.callback !== "function") { + var method = this.todo ? "todo" : "test"; + + // eslint-disable-next-line max-len + throw new TypeError("You must provide a function as a test callback to QUnit." + method + "(\"" + settings.testName + "\")"); + } + + this.assert = new Assert(this); + } + } + + Test.count = 0; + + function getNotStartedModules(startModule) { + var module = startModule, + modules = []; + + while (module && module.testsRun === 0) { + modules.push(module); + module = module.parentModule; + } + + return modules; + } + + Test.prototype = { + before: function before() { + var i, + startModule, + module = this.module, + notStartedModules = getNotStartedModules(module); + + for (i = notStartedModules.length - 1; i >= 0; i--) { + startModule = notStartedModules[i]; + startModule.stats = { all: 0, bad: 0, started: now() }; + emit("suiteStart", startModule.suiteReport.start(true)); + runLoggingCallbacks("moduleStart", { + name: startModule.name, + tests: startModule.tests + }); + } + + config.current = this; + + this.testEnvironment = extend({}, module.testEnvironment); + + this.started = now(); + emit("testStart", this.testReport.start(true)); + runLoggingCallbacks("testStart", { + name: this.testName, + module: module.name, + testId: this.testId, + previousFailure: this.previousFailure + }); + + if (!config.pollution) { + saveGlobal(); + } + }, + + run: function run() { + var promise; + + config.current = this; + + this.callbackStarted = now(); + + if (config.notrycatch) { + runTest(this); + return; + } + + try { + runTest(this); + } catch (e) { + this.pushFailure("Died on test #" + (this.assertions.length + 1) + " " + this.stack + ": " + (e.message || e), extractStacktrace(e, 0)); + + // Else next test will carry the responsibility + saveGlobal(); + + // Restart the tests if they're blocking + if (config.blocking) { + internalRecover(this); + } + } + + function runTest(test) { + promise = test.callback.call(test.testEnvironment, test.assert); + test.resolvePromise(promise); + + // If the test has a "lock" on it, but the timeout is 0, then we push a + // failure as the test should be synchronous. + if (test.timeout === 0 && test.semaphore !== 0) { + pushFailure("Test did not finish synchronously even though assert.timeout( 0 ) was used.", sourceFromStacktrace(2)); + } + } + }, + + after: function after() { + checkPollution(); + }, + + queueHook: function queueHook(hook, hookName, hookOwner) { + var _this = this; + + var callHook = function callHook() { + var promise = hook.call(_this.testEnvironment, _this.assert); + _this.resolvePromise(promise, hookName); + }; + + var runHook = function runHook() { + if (hookName === "before") { + if (hookOwner.unskippedTestsRun !== 0) { + return; + } + + _this.preserveEnvironment = true; + } + + if (hookName === "after" && hookOwner.unskippedTestsRun !== numberOfUnskippedTests(hookOwner) - 1 && config.queue.length > 2) { + return; + } + + config.current = _this; + if (config.notrycatch) { + callHook(); + return; + } + try { + callHook(); + } catch (error) { + _this.pushFailure(hookName + " failed on " + _this.testName + ": " + (error.message || error), extractStacktrace(error, 0)); + } + }; + + return runHook; + }, + + + // Currently only used for module level hooks, can be used to add global level ones + hooks: function hooks(handler) { + var hooks = []; + + function processHooks(test, module) { + if (module.parentModule) { + processHooks(test, module.parentModule); + } + + if (module.hooks[handler].length) { + for (var i = 0; i < module.hooks[handler].length; i++) { + hooks.push(test.queueHook(module.hooks[handler][i], handler, module)); + } + } + } + + // Hooks are ignored on skipped tests + if (!this.skip) { + processHooks(this, this.module); + } + + return hooks; + }, + + + finish: function finish() { + config.current = this; + if (config.requireExpects && this.expected === null) { + this.pushFailure("Expected number of assertions to be defined, but expect() was " + "not called.", this.stack); + } else if (this.expected !== null && this.expected !== this.assertions.length) { + this.pushFailure("Expected " + this.expected + " assertions, but " + this.assertions.length + " were run", this.stack); + } else if (this.expected === null && !this.assertions.length) { + this.pushFailure("Expected at least one assertion, but none were run - call " + "expect(0) to accept zero assertions.", this.stack); + } + + var i, + module = this.module, + moduleName = module.name, + testName = this.testName, + skipped = !!this.skip, + todo = !!this.todo, + bad = 0, + storage = config.storage; + + this.runtime = now() - this.started; + + config.stats.all += this.assertions.length; + module.stats.all += this.assertions.length; + + for (i = 0; i < this.assertions.length; i++) { + if (!this.assertions[i].result) { + bad++; + config.stats.bad++; + module.stats.bad++; + } + } + + notifyTestsRan(module, skipped); + + // Store result when possible + if (storage) { + if (bad) { + storage.setItem("qunit-test-" + moduleName + "-" + testName, bad); + } else { + storage.removeItem("qunit-test-" + moduleName + "-" + testName); + } + } + + // After emitting the js-reporters event we cleanup the assertion data to + // avoid leaking it. It is not used by the legacy testDone callbacks. + emit("testEnd", this.testReport.end(true)); + this.testReport.slimAssertions(); + + runLoggingCallbacks("testDone", { + name: testName, + module: moduleName, + skipped: skipped, + todo: todo, + failed: bad, + passed: this.assertions.length - bad, + total: this.assertions.length, + runtime: skipped ? 0 : this.runtime, + + // HTML Reporter use + assertions: this.assertions, + testId: this.testId, + + // Source of Test + source: this.stack + }); + + if (module.testsRun === numberOfTests(module)) { + logSuiteEnd(module); + + // Check if the parent modules, iteratively, are done. If that the case, + // we emit the `suiteEnd` event and trigger `moduleDone` callback. + var parent = module.parentModule; + while (parent && parent.testsRun === numberOfTests(parent)) { + logSuiteEnd(parent); + parent = parent.parentModule; + } + } + + config.current = undefined; + + function logSuiteEnd(module) { + emit("suiteEnd", module.suiteReport.end(true)); + runLoggingCallbacks("moduleDone", { + name: module.name, + tests: module.tests, + failed: module.stats.bad, + passed: module.stats.all - module.stats.bad, + total: module.stats.all, + runtime: now() - module.stats.started + }); + } + }, + + preserveTestEnvironment: function preserveTestEnvironment() { + if (this.preserveEnvironment) { + this.module.testEnvironment = this.testEnvironment; + this.testEnvironment = extend({}, this.module.testEnvironment); + } + }, + + queue: function queue() { + var test = this; + + if (!this.valid()) { + return; + } + + function runTest() { + + // Each of these can by async + ProcessingQueue.addImmediate([function () { + test.before(); + }, test.hooks("before"), function () { + test.preserveTestEnvironment(); + }, test.hooks("beforeEach"), function () { + test.run(); + }, test.hooks("afterEach").reverse(), test.hooks("after").reverse(), function () { + test.after(); + }, function () { + test.finish(); + }]); + } + + var previousFailCount = config.storage && +config.storage.getItem("qunit-test-" + this.module.name + "-" + this.testName); + + // Prioritize previously failed tests, detected from storage + var prioritize = config.reorder && !!previousFailCount; + + this.previousFailure = !!previousFailCount; + + ProcessingQueue.add(runTest, prioritize, config.seed); + + // If the queue has already finished, we manually process the new test + if (ProcessingQueue.finished) { + ProcessingQueue.advance(); + } + }, + + + pushResult: function pushResult(resultInfo) { + if (this !== config.current) { + throw new Error("Assertion occurred after test had finished."); + } + + // Destructure of resultInfo = { result, actual, expected, message, negative } + var source, + details = { + module: this.module.name, + name: this.testName, + result: resultInfo.result, + message: resultInfo.message, + actual: resultInfo.actual, + testId: this.testId, + negative: resultInfo.negative || false, + runtime: now() - this.started, + todo: !!this.todo + }; + + if (hasOwn.call(resultInfo, "expected")) { + details.expected = resultInfo.expected; + } + + if (!resultInfo.result) { + source = resultInfo.source || sourceFromStacktrace(); + + if (source) { + details.source = source; + } + } + + this.logAssertion(details); + + this.assertions.push({ + result: !!resultInfo.result, + message: resultInfo.message + }); + }, + + pushFailure: function pushFailure(message, source, actual) { + if (!(this instanceof Test)) { + throw new Error("pushFailure() assertion outside test context, was " + sourceFromStacktrace(2)); + } + + this.pushResult({ + result: false, + message: message || "error", + actual: actual || null, + source: source + }); + }, + + /** + * Log assertion details using both the old QUnit.log interface and + * QUnit.on( "assertion" ) interface. + * + * @private + */ + logAssertion: function logAssertion(details) { + runLoggingCallbacks("log", details); + + var assertion = { + passed: details.result, + actual: details.actual, + expected: details.expected, + message: details.message, + stack: details.source, + todo: details.todo + }; + this.testReport.pushAssertion(assertion); + emit("assertion", assertion); + }, + + + resolvePromise: function resolvePromise(promise, phase) { + var then, + resume, + message, + test = this; + if (promise != null) { + then = promise.then; + if (objectType(then) === "function") { + resume = internalStop(test); + if (config.notrycatch) { + then.call(promise, function () { + resume(); + }); + } else { + then.call(promise, function () { + resume(); + }, function (error) { + message = "Promise rejected " + (!phase ? "during" : phase.replace(/Each$/, "")) + " \"" + test.testName + "\": " + (error && error.message || error); + test.pushFailure(message, extractStacktrace(error, 0)); + + // Else next test will carry the responsibility + saveGlobal(); + + // Unblock + resume(); + }); + } + } + } + }, + + valid: function valid() { + var filter = config.filter, + regexFilter = /^(!?)\/([\w\W]*)\/(i?$)/.exec(filter), + module = config.module && config.module.toLowerCase(), + fullName = this.module.name + ": " + this.testName; + + function moduleChainNameMatch(testModule) { + var testModuleName = testModule.name ? testModule.name.toLowerCase() : null; + if (testModuleName === module) { + return true; + } else if (testModule.parentModule) { + return moduleChainNameMatch(testModule.parentModule); + } else { + return false; + } + } + + function moduleChainIdMatch(testModule) { + return inArray(testModule.moduleId, config.moduleId) || testModule.parentModule && moduleChainIdMatch(testModule.parentModule); + } + + // Internally-generated tests are always valid + if (this.callback && this.callback.validTest) { + return true; + } + + if (config.moduleId && config.moduleId.length > 0 && !moduleChainIdMatch(this.module)) { + + return false; + } + + if (config.testId && config.testId.length > 0 && !inArray(this.testId, config.testId)) { + + return false; + } + + if (module && !moduleChainNameMatch(this.module)) { + return false; + } + + if (!filter) { + return true; + } + + return regexFilter ? this.regexFilter(!!regexFilter[1], regexFilter[2], regexFilter[3], fullName) : this.stringFilter(filter, fullName); + }, + + regexFilter: function regexFilter(exclude, pattern, flags, fullName) { + var regex = new RegExp(pattern, flags); + var match = regex.test(fullName); + + return match !== exclude; + }, + + stringFilter: function stringFilter(filter, fullName) { + filter = filter.toLowerCase(); + fullName = fullName.toLowerCase(); + + var include = filter.charAt(0) !== "!"; + if (!include) { + filter = filter.slice(1); + } + + // If the filter matches, we need to honour include + if (fullName.indexOf(filter) !== -1) { + return include; + } + + // Otherwise, do the opposite + return !include; + } + }; + + function pushFailure() { + if (!config.current) { + throw new Error("pushFailure() assertion outside test context, in " + sourceFromStacktrace(2)); + } + + // Gets current test obj + var currentTest = config.current; + + return currentTest.pushFailure.apply(currentTest, arguments); + } + + function saveGlobal() { + config.pollution = []; + + if (config.noglobals) { + for (var key in global$1) { + if (hasOwn.call(global$1, key)) { + + // In Opera sometimes DOM element ids show up here, ignore them + if (/^qunit-test-output/.test(key)) { + continue; + } + config.pollution.push(key); + } + } + } + } + + function checkPollution() { + var newGlobals, + deletedGlobals, + old = config.pollution; + + saveGlobal(); + + newGlobals = diff(config.pollution, old); + if (newGlobals.length > 0) { + pushFailure("Introduced global variable(s): " + newGlobals.join(", ")); + } + + deletedGlobals = diff(old, config.pollution); + if (deletedGlobals.length > 0) { + pushFailure("Deleted global variable(s): " + deletedGlobals.join(", ")); + } + } + + // Will be exposed as QUnit.test + function test(testName, callback) { + if (focused$1) { + return; + } + + var newTest = new Test({ + testName: testName, + callback: callback + }); + + newTest.queue(); + } + + function todo(testName, callback) { + if (focused$1) { + return; + } + + var newTest = new Test({ + testName: testName, + callback: callback, + todo: true + }); + + newTest.queue(); + } + + // Will be exposed as QUnit.skip + function skip(testName) { + if (focused$1) { + return; + } + + var test = new Test({ + testName: testName, + skip: true + }); + + test.queue(); + } + + // Will be exposed as QUnit.only + function only(testName, callback) { + if (focused$1) { + return; + } + + config.queue.length = 0; + focused$1 = true; + + var newTest = new Test({ + testName: testName, + callback: callback + }); + + newTest.queue(); + } + + // Put a hold on processing and return a function that will release it. + function internalStop(test) { + test.semaphore += 1; + config.blocking = true; + + // Set a recovery timeout, if so configured. + if (defined.setTimeout) { + var timeoutDuration = void 0; + + if (typeof test.timeout === "number") { + timeoutDuration = test.timeout; + } else if (typeof config.testTimeout === "number") { + timeoutDuration = config.testTimeout; + } + + if (typeof timeoutDuration === "number" && timeoutDuration > 0) { + clearTimeout(config.timeout); + config.timeout = setTimeout(function () { + pushFailure("Test took longer than " + timeoutDuration + "ms; test timed out.", sourceFromStacktrace(2)); + internalRecover(test); + }, timeoutDuration); + } + } + + var released = false; + return function resume() { + if (released) { + return; + } + + released = true; + test.semaphore -= 1; + internalStart(test); + }; + } + + // Forcefully release all processing holds. + function internalRecover(test) { + test.semaphore = 0; + internalStart(test); + } + + // Release a processing hold, scheduling a resumption attempt if no holds remain. + function internalStart(test) { + + // If semaphore is non-numeric, throw error + if (isNaN(test.semaphore)) { + test.semaphore = 0; + + pushFailure("Invalid value on test.semaphore", sourceFromStacktrace(2)); + return; + } + + // Don't start until equal number of stop-calls + if (test.semaphore > 0) { + return; + } + + // Throw an Error if start is called more often than stop + if (test.semaphore < 0) { + test.semaphore = 0; + + pushFailure("Tried to restart test while already started (test's semaphore was 0 already)", sourceFromStacktrace(2)); + return; + } + + // Add a slight delay to allow more assertions etc. + if (defined.setTimeout) { + if (config.timeout) { + clearTimeout(config.timeout); + } + config.timeout = setTimeout(function () { + if (test.semaphore > 0) { + return; + } + + if (config.timeout) { + clearTimeout(config.timeout); + } + + begin(); + }); + } else { + begin(); + } + } + + function collectTests(module) { + var tests = [].concat(module.tests); + var modules = [].concat(toConsumableArray(module.childModules)); + + // Do a breadth-first traversal of the child modules + while (modules.length) { + var nextModule = modules.shift(); + tests.push.apply(tests, nextModule.tests); + modules.push.apply(modules, toConsumableArray(nextModule.childModules)); + } + + return tests; + } + + function numberOfTests(module) { + return collectTests(module).length; + } + + function numberOfUnskippedTests(module) { + return collectTests(module).filter(function (test) { + return !test.skip; + }).length; + } + + function notifyTestsRan(module, skipped) { + module.testsRun++; + if (!skipped) { + module.unskippedTestsRun++; + } + while (module = module.parentModule) { + module.testsRun++; + if (!skipped) { + module.unskippedTestsRun++; + } + } + } + + /** + * Returns a function that proxies to the given method name on the globals + * console object. The proxy will also detect if the console doesn't exist and + * will appropriately no-op. This allows support for IE9, which doesn't have a + * console if the developer tools are not open. + */ + function consoleProxy(method) { + return function () { + if (console) { + console[method].apply(console, arguments); + } + }; + } + + var Logger = { + warn: consoleProxy("warn") + }; + + var Assert = function () { + function Assert(testContext) { + classCallCheck(this, Assert); + + this.test = testContext; + } + + // Assert helpers + + createClass(Assert, [{ + key: "timeout", + value: function timeout(duration) { + if (typeof duration !== "number") { + throw new Error("You must pass a number as the duration to assert.timeout"); + } + + this.test.timeout = duration; + } + + // Documents a "step", which is a string value, in a test as a passing assertion + + }, { + key: "step", + value: function step(message) { + var result = !!message; + + this.test.steps.push(message); + + return this.pushResult({ + result: result, + message: message || "You must provide a message to assert.step" + }); + } + + // Verifies the steps in a test match a given array of string values + + }, { + key: "verifySteps", + value: function verifySteps(steps, message) { + this.deepEqual(this.test.steps, steps, message); + this.test.steps.length = 0; + } + + // Specify the number of expected assertions to guarantee that failed test + // (no assertions are run at all) don't slip through. + + }, { + key: "expect", + value: function expect(asserts) { + if (arguments.length === 1) { + this.test.expected = asserts; + } else { + return this.test.expected; + } + } + + // Put a hold on processing and return a function that will release it a maximum of once. + + }, { + key: "async", + value: function async(count) { + var test$$1 = this.test; + + var popped = false, + acceptCallCount = count; + + if (typeof acceptCallCount === "undefined") { + acceptCallCount = 1; + } + + var resume = internalStop(test$$1); + + return function done() { + if (config.current !== test$$1) { + throw Error("assert.async callback called after test finished."); + } + + if (popped) { + test$$1.pushFailure("Too many calls to the `assert.async` callback", sourceFromStacktrace(2)); + return; + } + + acceptCallCount -= 1; + if (acceptCallCount > 0) { + return; + } + + popped = true; + resume(); + }; + } + + // Exports test.push() to the user API + // Alias of pushResult. + + }, { + key: "push", + value: function push(result, actual, expected, message, negative) { + Logger.warn("assert.push is deprecated and will be removed in QUnit 3.0." + " Please use assert.pushResult instead (https://api.qunitjs.com/assert/pushResult)."); + + var currentAssert = this instanceof Assert ? this : config.current.assert; + return currentAssert.pushResult({ + result: result, + actual: actual, + expected: expected, + message: message, + negative: negative + }); + } + }, { + key: "pushResult", + value: function pushResult(resultInfo) { + + // Destructure of resultInfo = { result, actual, expected, message, negative } + var assert = this; + var currentTest = assert instanceof Assert && assert.test || config.current; + + // Backwards compatibility fix. + // Allows the direct use of global exported assertions and QUnit.assert.* + // Although, it's use is not recommended as it can leak assertions + // to other tests from async tests, because we only get a reference to the current test, + // not exactly the test where assertion were intended to be called. + if (!currentTest) { + throw new Error("assertion outside test context, in " + sourceFromStacktrace(2)); + } + + if (!(assert instanceof Assert)) { + assert = currentTest.assert; + } + + return assert.test.pushResult(resultInfo); + } + }, { + key: "ok", + value: function ok(result, message) { + if (!message) { + message = result ? "okay" : "failed, expected argument to be truthy, was: " + dump.parse(result); + } + + this.pushResult({ + result: !!result, + actual: result, + expected: true, + message: message + }); + } + }, { + key: "notOk", + value: function notOk(result, message) { + if (!message) { + message = !result ? "okay" : "failed, expected argument to be falsy, was: " + dump.parse(result); + } + + this.pushResult({ + result: !result, + actual: result, + expected: false, + message: message + }); + } + }, { + key: "equal", + value: function equal(actual, expected, message) { + + // eslint-disable-next-line eqeqeq + var result = expected == actual; + + this.pushResult({ + result: result, + actual: actual, + expected: expected, + message: message + }); + } + }, { + key: "notEqual", + value: function notEqual(actual, expected, message) { + + // eslint-disable-next-line eqeqeq + var result = expected != actual; + + this.pushResult({ + result: result, + actual: actual, + expected: expected, + message: message, + negative: true + }); + } + }, { + key: "propEqual", + value: function propEqual(actual, expected, message) { + actual = objectValues(actual); + expected = objectValues(expected); + + this.pushResult({ + result: equiv(actual, expected), + actual: actual, + expected: expected, + message: message + }); + } + }, { + key: "notPropEqual", + value: function notPropEqual(actual, expected, message) { + actual = objectValues(actual); + expected = objectValues(expected); + + this.pushResult({ + result: !equiv(actual, expected), + actual: actual, + expected: expected, + message: message, + negative: true + }); + } + }, { + key: "deepEqual", + value: function deepEqual(actual, expected, message) { + this.pushResult({ + result: equiv(actual, expected), + actual: actual, + expected: expected, + message: message + }); + } + }, { + key: "notDeepEqual", + value: function notDeepEqual(actual, expected, message) { + this.pushResult({ + result: !equiv(actual, expected), + actual: actual, + expected: expected, + message: message, + negative: true + }); + } + }, { + key: "strictEqual", + value: function strictEqual(actual, expected, message) { + this.pushResult({ + result: expected === actual, + actual: actual, + expected: expected, + message: message + }); + } + }, { + key: "notStrictEqual", + value: function notStrictEqual(actual, expected, message) { + this.pushResult({ + result: expected !== actual, + actual: actual, + expected: expected, + message: message, + negative: true + }); + } + }, { + key: "throws", + value: function throws(block, expected, message) { + var actual = void 0, + result = false; + + var currentTest = this instanceof Assert && this.test || config.current; + + // 'expected' is optional unless doing string comparison + if (objectType(expected) === "string") { + if (message == null) { + message = expected; + expected = null; + } else { + throw new Error("throws/raises does not accept a string value for the expected argument.\n" + "Use a non-string object value (e.g. regExp) instead if it's necessary."); + } + } + + currentTest.ignoreGlobalErrors = true; + try { + block.call(currentTest.testEnvironment); + } catch (e) { + actual = e; + } + currentTest.ignoreGlobalErrors = false; + + if (actual) { + var expectedType = objectType(expected); + + // We don't want to validate thrown error + if (!expected) { + result = true; + expected = null; + + // Expected is a regexp + } else if (expectedType === "regexp") { + result = expected.test(errorString(actual)); + + // Expected is a constructor, maybe an Error constructor + } else if (expectedType === "function" && actual instanceof expected) { + result = true; + + // Expected is an Error object + } else if (expectedType === "object") { + result = actual instanceof expected.constructor && actual.name === expected.name && actual.message === expected.message; + + // Expected is a validation function which returns true if validation passed + } else if (expectedType === "function" && expected.call({}, actual) === true) { + expected = null; + result = true; + } + } + + currentTest.assert.pushResult({ + result: result, + actual: actual, + expected: expected, + message: message + }); + } + }, { + key: "rejects", + value: function rejects(promise, expected, message) { + var result = false; + + var currentTest = this instanceof Assert && this.test || config.current; + + // 'expected' is optional unless doing string comparison + if (objectType(expected) === "string") { + if (message === undefined) { + message = expected; + expected = undefined; + } else { + message = "assert.rejects does not accept a string value for the expected " + "argument.\nUse a non-string object value (e.g. validator function) instead " + "if necessary."; + + currentTest.assert.pushResult({ + result: false, + message: message + }); + + return; + } + } + + var then = promise && promise.then; + if (objectType(then) !== "function") { + var _message = "The value provided to `assert.rejects` in " + "\"" + currentTest.testName + "\" was not a promise."; + + currentTest.assert.pushResult({ + result: false, + message: _message, + actual: promise + }); + + return; + } + + var done = this.async(); + + return then.call(promise, function handleFulfillment() { + var message = "The promise returned by the `assert.rejects` callback in " + "\"" + currentTest.testName + "\" did not reject."; + + currentTest.assert.pushResult({ + result: false, + message: message, + actual: promise + }); + + done(); + }, function handleRejection(actual) { + if (actual) { + var expectedType = objectType(expected); + + // We don't want to validate + if (expected === undefined) { + result = true; + expected = null; + + // Expected is a regexp + } else if (expectedType === "regexp") { + result = expected.test(errorString(actual)); + + // Expected is a constructor, maybe an Error constructor + } else if (expectedType === "function" && actual instanceof expected) { + result = true; + + // Expected is an Error object + } else if (expectedType === "object") { + result = actual instanceof expected.constructor && actual.name === expected.name && actual.message === expected.message; + + // Expected is a validation function which returns true if validation passed + } else { + if (expectedType === "function") { + result = expected.call({}, actual) === true; + expected = null; + + // Expected is some other invalid type + } else { + result = false; + message = "invalid expected value provided to `assert.rejects` " + "callback in \"" + currentTest.testName + "\": " + expectedType + "."; + } + } + } + + currentTest.assert.pushResult({ + result: result, + actual: actual, + expected: expected, + message: message + }); + + done(); + }); + } + }]); + return Assert; + }(); + + // Provide an alternative to assert.throws(), for environments that consider throws a reserved word + // Known to us are: Closure Compiler, Narwhal + // eslint-disable-next-line dot-notation + + + Assert.prototype.raises = Assert.prototype["throws"]; + + /** + * Converts an error into a simple string for comparisons. + * + * @param {Error} error + * @return {String} + */ + function errorString(error) { + var resultErrorString = error.toString(); + + if (resultErrorString.substring(0, 7) === "[object") { + var name = error.name ? error.name.toString() : "Error"; + var message = error.message ? error.message.toString() : ""; + + if (name && message) { + return name + ": " + message; + } else if (name) { + return name; + } else if (message) { + return message; + } else { + return "Error"; + } + } else { + return resultErrorString; + } + } + + /* global module, exports, define */ + function exportQUnit(QUnit) { + + if (defined.document) { + + // QUnit may be defined when it is preconfigured but then only QUnit and QUnit.config may be defined. + if (window.QUnit && window.QUnit.version) { + throw new Error("QUnit has already been defined."); + } + + window.QUnit = QUnit; + } + + // For nodejs + if (typeof module !== "undefined" && module && module.exports) { + module.exports = QUnit; + + // For consistency with CommonJS environments' exports + module.exports.QUnit = QUnit; + } + + // For CommonJS with exports, but without module.exports, like Rhino + if (typeof exports !== "undefined" && exports) { + exports.QUnit = QUnit; + } + + if (typeof define === "function" && define.amd) { + define(function () { + return QUnit; + }); + QUnit.config.autostart = false; + } + + // For Web/Service Workers + if (self$1 && self$1.WorkerGlobalScope && self$1 instanceof self$1.WorkerGlobalScope) { + self$1.QUnit = QUnit; + } + } + + var SuiteReport = function () { + function SuiteReport(name, parentSuite) { + classCallCheck(this, SuiteReport); + + this.name = name; + this.fullName = parentSuite ? parentSuite.fullName.concat(name) : []; + + this.tests = []; + this.childSuites = []; + + if (parentSuite) { + parentSuite.pushChildSuite(this); + } + } + + createClass(SuiteReport, [{ + key: "start", + value: function start(recordTime) { + if (recordTime) { + this._startTime = Date.now(); + } + + return { + name: this.name, + fullName: this.fullName.slice(), + tests: this.tests.map(function (test) { + return test.start(); + }), + childSuites: this.childSuites.map(function (suite) { + return suite.start(); + }), + testCounts: { + total: this.getTestCounts().total + } + }; + } + }, { + key: "end", + value: function end(recordTime) { + if (recordTime) { + this._endTime = Date.now(); + } + + return { + name: this.name, + fullName: this.fullName.slice(), + tests: this.tests.map(function (test) { + return test.end(); + }), + childSuites: this.childSuites.map(function (suite) { + return suite.end(); + }), + testCounts: this.getTestCounts(), + runtime: this.getRuntime(), + status: this.getStatus() + }; + } + }, { + key: "pushChildSuite", + value: function pushChildSuite(suite) { + this.childSuites.push(suite); + } + }, { + key: "pushTest", + value: function pushTest(test) { + this.tests.push(test); + } + }, { + key: "getRuntime", + value: function getRuntime() { + return this._endTime - this._startTime; + } + }, { + key: "getTestCounts", + value: function getTestCounts() { + var counts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : { passed: 0, failed: 0, skipped: 0, todo: 0, total: 0 }; + + counts = this.tests.reduce(function (counts, test) { + if (test.valid) { + counts[test.getStatus()]++; + counts.total++; + } + + return counts; + }, counts); + + return this.childSuites.reduce(function (counts, suite) { + return suite.getTestCounts(counts); + }, counts); + } + }, { + key: "getStatus", + value: function getStatus() { + var _getTestCounts = this.getTestCounts(), + total = _getTestCounts.total, + failed = _getTestCounts.failed, + skipped = _getTestCounts.skipped, + todo = _getTestCounts.todo; + + if (failed) { + return "failed"; + } else { + if (skipped === total) { + return "skipped"; + } else if (todo === total) { + return "todo"; + } else { + return "passed"; + } + } + } + }]); + return SuiteReport; + }(); + + // Handle an unhandled exception. By convention, returns true if further + // error handling should be suppressed and false otherwise. + // In this case, we will only suppress further error handling if the + // "ignoreGlobalErrors" configuration option is enabled. + function onError(error) { + for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { + args[_key - 1] = arguments[_key]; + } + + if (config.current) { + if (config.current.ignoreGlobalErrors) { + return true; + } + pushFailure.apply(undefined, [error.message, error.fileName + ":" + error.lineNumber].concat(args)); + } else { + test("global failure", extend(function () { + pushFailure.apply(undefined, [error.message, error.fileName + ":" + error.lineNumber].concat(args)); + }, { validTest: true })); + } + + return false; + } + + // Handle an unhandled rejection + function onUnhandledRejection(reason) { + var resultInfo = { + result: false, + message: reason.message || "error", + actual: reason, + source: reason.stack || sourceFromStacktrace(3) + }; + + var currentTest = config.current; + if (currentTest) { + currentTest.assert.pushResult(resultInfo); + } else { + test("global failure", extend(function (assert) { + assert.pushResult(resultInfo); + }, { validTest: true })); + } + } + + var focused = false; + var QUnit = {}; + var globalSuite = new SuiteReport(); + + // The initial "currentModule" represents the global (or top-level) module that + // is not explicitly defined by the user, therefore we add the "globalSuite" to + // it since each module has a suiteReport associated with it. + config.currentModule.suiteReport = globalSuite; + + var moduleStack = []; + var globalStartCalled = false; + var runStarted = false; + + // Figure out if we're running the tests from a server or not + QUnit.isLocal = !(defined.document && window.location.protocol !== "file:"); + + // Expose the current QUnit version + QUnit.version = "2.5.0"; + + function createModule(name, testEnvironment, modifiers) { + var parentModule = moduleStack.length ? moduleStack.slice(-1)[0] : null; + var moduleName = parentModule !== null ? [parentModule.name, name].join(" > ") : name; + var parentSuite = parentModule ? parentModule.suiteReport : globalSuite; + + var skip$$1 = parentModule !== null && parentModule.skip || modifiers.skip; + var todo$$1 = parentModule !== null && parentModule.todo || modifiers.todo; + + var module = { + name: moduleName, + parentModule: parentModule, + tests: [], + moduleId: generateHash(moduleName), + testsRun: 0, + unskippedTestsRun: 0, + childModules: [], + suiteReport: new SuiteReport(name, parentSuite), + + // Pass along `skip` and `todo` properties from parent module, in case + // there is one, to childs. And use own otherwise. + // This property will be used to mark own tests and tests of child suites + // as either `skipped` or `todo`. + skip: skip$$1, + todo: skip$$1 ? false : todo$$1 + }; + + var env = {}; + if (parentModule) { + parentModule.childModules.push(module); + extend(env, parentModule.testEnvironment); + } + extend(env, testEnvironment); + module.testEnvironment = env; + + config.modules.push(module); + return module; + } + + function processModule(name, options, executeNow) { + var modifiers = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}; + + var module = createModule(name, options, modifiers); + + // Move any hooks to a 'hooks' object + var testEnvironment = module.testEnvironment; + var hooks = module.hooks = {}; + + setHookFromEnvironment(hooks, testEnvironment, "before"); + setHookFromEnvironment(hooks, testEnvironment, "beforeEach"); + setHookFromEnvironment(hooks, testEnvironment, "afterEach"); + setHookFromEnvironment(hooks, testEnvironment, "after"); + + function setHookFromEnvironment(hooks, environment, name) { + var potentialHook = environment[name]; + hooks[name] = typeof potentialHook === "function" ? [potentialHook] : []; + delete environment[name]; + } + + var moduleFns = { + before: setHookFunction(module, "before"), + beforeEach: setHookFunction(module, "beforeEach"), + afterEach: setHookFunction(module, "afterEach"), + after: setHookFunction(module, "after") + }; + + var currentModule = config.currentModule; + if (objectType(executeNow) === "function") { + moduleStack.push(module); + config.currentModule = module; + executeNow.call(module.testEnvironment, moduleFns); + moduleStack.pop(); + module = module.parentModule || currentModule; + } + + config.currentModule = module; + } + + // TODO: extract this to a new file alongside its related functions + function module$1(name, options, executeNow) { + if (focused) { + return; + } + + if (arguments.length === 2) { + if (objectType(options) === "function") { + executeNow = options; + options = undefined; + } + } + + processModule(name, options, executeNow); + } + + module$1.only = function () { + if (focused) { + return; + } + + config.modules.length = 0; + config.queue.length = 0; + + module$1.apply(undefined, arguments); + + focused = true; + }; + + module$1.skip = function (name, options, executeNow) { + if (focused) { + return; + } + + if (arguments.length === 2) { + if (objectType(options) === "function") { + executeNow = options; + options = undefined; + } + } + + processModule(name, options, executeNow, { skip: true }); + }; + + module$1.todo = function (name, options, executeNow) { + if (focused) { + return; + } + + if (arguments.length === 2) { + if (objectType(options) === "function") { + executeNow = options; + options = undefined; + } + } + + processModule(name, options, executeNow, { todo: true }); + }; + + extend(QUnit, { + on: on, + + module: module$1, + + test: test, + + todo: todo, + + skip: skip, + + only: only, + + start: function start(count) { + var globalStartAlreadyCalled = globalStartCalled; + + if (!config.current) { + globalStartCalled = true; + + if (runStarted) { + throw new Error("Called start() while test already started running"); + } else if (globalStartAlreadyCalled || count > 1) { + throw new Error("Called start() outside of a test context too many times"); + } else if (config.autostart) { + throw new Error("Called start() outside of a test context when " + "QUnit.config.autostart was true"); + } else if (!config.pageLoaded) { + + // The page isn't completely loaded yet, so we set autostart and then + // load if we're in Node or wait for the browser's load event. + config.autostart = true; + + // Starts from Node even if .load was not previously called. We still return + // early otherwise we'll wind up "beginning" twice. + if (!defined.document) { + QUnit.load(); + } + + return; + } + } else { + throw new Error("QUnit.start cannot be called inside a test context."); + } + + scheduleBegin(); + }, + + config: config, + + is: is, + + objectType: objectType, + + extend: extend, + + load: function load() { + config.pageLoaded = true; + + // Initialize the configuration options + extend(config, { + stats: { all: 0, bad: 0 }, + started: 0, + updateRate: 1000, + autostart: true, + filter: "" + }, true); + + if (!runStarted) { + config.blocking = false; + + if (config.autostart) { + scheduleBegin(); + } + } + }, + + stack: function stack(offset) { + offset = (offset || 0) + 2; + return sourceFromStacktrace(offset); + }, + + onError: onError, + + onUnhandledRejection: onUnhandledRejection + }); + + QUnit.pushFailure = pushFailure; + QUnit.assert = Assert.prototype; + QUnit.equiv = equiv; + QUnit.dump = dump; + + registerLoggingCallbacks(QUnit); + + function scheduleBegin() { + + runStarted = true; + + // Add a slight delay to allow definition of more modules and tests. + if (defined.setTimeout) { + setTimeout(function () { + begin(); + }); + } else { + begin(); + } + } + + function begin() { + var i, + l, + modulesLog = []; + + // If the test run hasn't officially begun yet + if (!config.started) { + + // Record the time of the test run's beginning + config.started = now(); + + // Delete the loose unnamed module if unused. + if (config.modules[0].name === "" && config.modules[0].tests.length === 0) { + config.modules.shift(); + } + + // Avoid unnecessary information by not logging modules' test environments + for (i = 0, l = config.modules.length; i < l; i++) { + modulesLog.push({ + name: config.modules[i].name, + tests: config.modules[i].tests + }); + } + + // The test run is officially beginning now + emit("runStart", globalSuite.start(true)); + runLoggingCallbacks("begin", { + totalTests: Test.count, + modules: modulesLog + }); + } + + config.blocking = false; + ProcessingQueue.advance(); + } + + function setHookFunction(module, hookName) { + return function setHook(callback) { + module.hooks[hookName].push(callback); + }; + } + + exportQUnit(QUnit); + + (function () { + + if (typeof window === "undefined" || typeof document === "undefined") { + return; + } + + var config = QUnit.config, + hasOwn = Object.prototype.hasOwnProperty; + + // Stores fixture HTML for resetting later + function storeFixture() { + + // Avoid overwriting user-defined values + if (hasOwn.call(config, "fixture")) { + return; + } + + var fixture = document.getElementById("qunit-fixture"); + if (fixture) { + config.fixture = fixture.innerHTML; + } + } + + QUnit.begin(storeFixture); + + // Resets the fixture DOM element if available. + function resetFixture() { + if (config.fixture == null) { + return; + } + + var fixture = document.getElementById("qunit-fixture"); + if (fixture) { + fixture.innerHTML = config.fixture; + } + } + + QUnit.testStart(resetFixture); + })(); + + (function () { + + // Only interact with URLs via window.location + var location = typeof window !== "undefined" && window.location; + if (!location) { + return; + } + + var urlParams = getUrlParams(); + + QUnit.urlParams = urlParams; + + // Match module/test by inclusion in an array + QUnit.config.moduleId = [].concat(urlParams.moduleId || []); + QUnit.config.testId = [].concat(urlParams.testId || []); + + // Exact case-insensitive match of the module name + QUnit.config.module = urlParams.module; + + // Regular expression or case-insenstive substring match against "moduleName: testName" + QUnit.config.filter = urlParams.filter; + + // Test order randomization + if (urlParams.seed === true) { + + // Generate a random seed if the option is specified without a value + QUnit.config.seed = Math.random().toString(36).slice(2); + } else if (urlParams.seed) { + QUnit.config.seed = urlParams.seed; + } + + // Add URL-parameter-mapped config values with UI form rendering data + QUnit.config.urlConfig.push({ + id: "hidepassed", + label: "Hide passed tests", + tooltip: "Only show tests and assertions that fail. Stored as query-strings." + }, { + id: "noglobals", + label: "Check for Globals", + tooltip: "Enabling this will test if any test introduces new properties on the " + "global object (`window` in Browsers). Stored as query-strings." + }, { + id: "notrycatch", + label: "No try-catch", + tooltip: "Enabling this will run tests outside of a try-catch block. Makes debugging " + "exceptions in IE reasonable. Stored as query-strings." + }); + + QUnit.begin(function () { + var i, + option, + urlConfig = QUnit.config.urlConfig; + + for (i = 0; i < urlConfig.length; i++) { + + // Options can be either strings or objects with nonempty "id" properties + option = QUnit.config.urlConfig[i]; + if (typeof option !== "string") { + option = option.id; + } + + if (QUnit.config[option] === undefined) { + QUnit.config[option] = urlParams[option]; + } + } + }); + + function getUrlParams() { + var i, param, name, value; + var urlParams = Object.create(null); + var params = location.search.slice(1).split("&"); + var length = params.length; + + for (i = 0; i < length; i++) { + if (params[i]) { + param = params[i].split("="); + name = decodeQueryParam(param[0]); + + // Allow just a key to turn on a flag, e.g., test.html?noglobals + value = param.length === 1 || decodeQueryParam(param.slice(1).join("=")); + if (name in urlParams) { + urlParams[name] = [].concat(urlParams[name], value); + } else { + urlParams[name] = value; + } + } + } + + return urlParams; + } + + function decodeQueryParam(param) { + return decodeURIComponent(param.replace(/\+/g, "%20")); + } + })(); + + var stats = { + passedTests: 0, + failedTests: 0, + skippedTests: 0, + todoTests: 0 + }; + + // Escape text for attribute or text content. + function escapeText(s) { + if (!s) { + return ""; + } + s = s + ""; + + // Both single quotes and double quotes (for attributes) + return s.replace(/['"<>&]/g, function (s) { + switch (s) { + case "'": + return "'"; + case "\"": + return """; + case "<": + return "<"; + case ">": + return ">"; + case "&": + return "&"; + } + }); + } + + (function () { + + // Don't load the HTML Reporter on non-browser environments + if (typeof window === "undefined" || !window.document) { + return; + } + + var config = QUnit.config, + document$$1 = window.document, + collapseNext = false, + hasOwn = Object.prototype.hasOwnProperty, + unfilteredUrl = setUrl({ filter: undefined, module: undefined, + moduleId: undefined, testId: undefined }), + modulesList = []; + + function addEvent(elem, type, fn) { + elem.addEventListener(type, fn, false); + } + + function removeEvent(elem, type, fn) { + elem.removeEventListener(type, fn, false); + } + + function addEvents(elems, type, fn) { + var i = elems.length; + while (i--) { + addEvent(elems[i], type, fn); + } + } + + function hasClass(elem, name) { + return (" " + elem.className + " ").indexOf(" " + name + " ") >= 0; + } + + function addClass(elem, name) { + if (!hasClass(elem, name)) { + elem.className += (elem.className ? " " : "") + name; + } + } + + function toggleClass(elem, name, force) { + if (force || typeof force === "undefined" && !hasClass(elem, name)) { + addClass(elem, name); + } else { + removeClass(elem, name); + } + } + + function removeClass(elem, name) { + var set = " " + elem.className + " "; + + // Class name may appear multiple times + while (set.indexOf(" " + name + " ") >= 0) { + set = set.replace(" " + name + " ", " "); + } + + // Trim for prettiness + elem.className = typeof set.trim === "function" ? set.trim() : set.replace(/^\s+|\s+$/g, ""); + } + + function id(name) { + return document$$1.getElementById && document$$1.getElementById(name); + } + + function abortTests() { + var abortButton = id("qunit-abort-tests-button"); + if (abortButton) { + abortButton.disabled = true; + abortButton.innerHTML = "Aborting..."; + } + QUnit.config.queue.length = 0; + return false; + } + + function interceptNavigation(ev) { + applyUrlParams(); + + if (ev && ev.preventDefault) { + ev.preventDefault(); + } + + return false; + } + + function getUrlConfigHtml() { + var i, + j, + val, + escaped, + escapedTooltip, + selection = false, + urlConfig = config.urlConfig, + urlConfigHtml = ""; + + for (i = 0; i < urlConfig.length; i++) { + + // Options can be either strings or objects with nonempty "id" properties + val = config.urlConfig[i]; + if (typeof val === "string") { + val = { + id: val, + label: val + }; + } + + escaped = escapeText(val.id); + escapedTooltip = escapeText(val.tooltip); + + if (!val.value || typeof val.value === "string") { + urlConfigHtml += ""; + } else { + urlConfigHtml += ""; + } + } + + return urlConfigHtml; + } + + // Handle "click" events on toolbar checkboxes and "change" for select menus. + // Updates the URL with the new state of `config.urlConfig` values. + function toolbarChanged() { + var updatedUrl, + value, + tests, + field = this, + params = {}; + + // Detect if field is a select menu or a checkbox + if ("selectedIndex" in field) { + value = field.options[field.selectedIndex].value || undefined; + } else { + value = field.checked ? field.defaultValue || true : undefined; + } + + params[field.name] = value; + updatedUrl = setUrl(params); + + // Check if we can apply the change without a page refresh + if ("hidepassed" === field.name && "replaceState" in window.history) { + QUnit.urlParams[field.name] = value; + config[field.name] = value || false; + tests = id("qunit-tests"); + if (tests) { + toggleClass(tests, "hidepass", value || false); + } + window.history.replaceState(null, "", updatedUrl); + } else { + window.location = updatedUrl; + } + } + + function setUrl(params) { + var key, + arrValue, + i, + querystring = "?", + location = window.location; + + params = QUnit.extend(QUnit.extend({}, QUnit.urlParams), params); + + for (key in params) { + + // Skip inherited or undefined properties + if (hasOwn.call(params, key) && params[key] !== undefined) { + + // Output a parameter for each value of this key + // (but usually just one) + arrValue = [].concat(params[key]); + for (i = 0; i < arrValue.length; i++) { + querystring += encodeURIComponent(key); + if (arrValue[i] !== true) { + querystring += "=" + encodeURIComponent(arrValue[i]); + } + querystring += "&"; + } + } + } + return location.protocol + "//" + location.host + location.pathname + querystring.slice(0, -1); + } + + function applyUrlParams() { + var i, + selectedModules = [], + modulesList = id("qunit-modulefilter-dropdown-list").getElementsByTagName("input"), + filter = id("qunit-filter-input").value; + + for (i = 0; i < modulesList.length; i++) { + if (modulesList[i].checked) { + selectedModules.push(modulesList[i].value); + } + } + + window.location = setUrl({ + filter: filter === "" ? undefined : filter, + moduleId: selectedModules.length === 0 ? undefined : selectedModules, + + // Remove module and testId filter + module: undefined, + testId: undefined + }); + } + + function toolbarUrlConfigContainer() { + var urlConfigContainer = document$$1.createElement("span"); + + urlConfigContainer.innerHTML = getUrlConfigHtml(); + addClass(urlConfigContainer, "qunit-url-config"); + + addEvents(urlConfigContainer.getElementsByTagName("input"), "change", toolbarChanged); + addEvents(urlConfigContainer.getElementsByTagName("select"), "change", toolbarChanged); + + return urlConfigContainer; + } + + function abortTestsButton() { + var button = document$$1.createElement("button"); + button.id = "qunit-abort-tests-button"; + button.innerHTML = "Abort"; + addEvent(button, "click", abortTests); + return button; + } + + function toolbarLooseFilter() { + var filter = document$$1.createElement("form"), + label = document$$1.createElement("label"), + input = document$$1.createElement("input"), + button = document$$1.createElement("button"); + + addClass(filter, "qunit-filter"); + + label.innerHTML = "Filter: "; + + input.type = "text"; + input.value = config.filter || ""; + input.name = "filter"; + input.id = "qunit-filter-input"; + + button.innerHTML = "Go"; + + label.appendChild(input); + + filter.appendChild(label); + filter.appendChild(document$$1.createTextNode(" ")); + filter.appendChild(button); + addEvent(filter, "submit", interceptNavigation); + + return filter; + } + + function moduleListHtml() { + var i, + checked, + html = ""; + + for (i = 0; i < config.modules.length; i++) { + if (config.modules[i].name !== "") { + checked = config.moduleId.indexOf(config.modules[i].moduleId) > -1; + html += "
  • "; + } + } + + return html; + } + + function toolbarModuleFilter() { + var allCheckbox, + commit, + reset, + moduleFilter = document$$1.createElement("form"), + label = document$$1.createElement("label"), + moduleSearch = document$$1.createElement("input"), + dropDown = document$$1.createElement("div"), + actions = document$$1.createElement("span"), + dropDownList = document$$1.createElement("ul"), + dirty = false; + + moduleSearch.id = "qunit-modulefilter-search"; + addEvent(moduleSearch, "input", searchInput); + addEvent(moduleSearch, "input", searchFocus); + addEvent(moduleSearch, "focus", searchFocus); + addEvent(moduleSearch, "click", searchFocus); + + label.id = "qunit-modulefilter-search-container"; + label.innerHTML = "Module: "; + label.appendChild(moduleSearch); + + actions.id = "qunit-modulefilter-actions"; + actions.innerHTML = "" + "" + ""; + allCheckbox = actions.lastChild.firstChild; + commit = actions.firstChild; + reset = commit.nextSibling; + addEvent(commit, "click", applyUrlParams); + + dropDownList.id = "qunit-modulefilter-dropdown-list"; + dropDownList.innerHTML = moduleListHtml(); + + dropDown.id = "qunit-modulefilter-dropdown"; + dropDown.style.display = "none"; + dropDown.appendChild(actions); + dropDown.appendChild(dropDownList); + addEvent(dropDown, "change", selectionChange); + selectionChange(); + + moduleFilter.id = "qunit-modulefilter"; + moduleFilter.appendChild(label); + moduleFilter.appendChild(dropDown); + addEvent(moduleFilter, "submit", interceptNavigation); + addEvent(moduleFilter, "reset", function () { + + // Let the reset happen, then update styles + window.setTimeout(selectionChange); + }); + + // Enables show/hide for the dropdown + function searchFocus() { + if (dropDown.style.display !== "none") { + return; + } + + dropDown.style.display = "block"; + addEvent(document$$1, "click", hideHandler); + addEvent(document$$1, "keydown", hideHandler); + + // Hide on Escape keydown or outside-container click + function hideHandler(e) { + var inContainer = moduleFilter.contains(e.target); + + if (e.keyCode === 27 || !inContainer) { + if (e.keyCode === 27 && inContainer) { + moduleSearch.focus(); + } + dropDown.style.display = "none"; + removeEvent(document$$1, "click", hideHandler); + removeEvent(document$$1, "keydown", hideHandler); + moduleSearch.value = ""; + searchInput(); + } + } + } + + // Processes module search box input + function searchInput() { + var i, + item, + searchText = moduleSearch.value.toLowerCase(), + listItems = dropDownList.children; + + for (i = 0; i < listItems.length; i++) { + item = listItems[i]; + if (!searchText || item.textContent.toLowerCase().indexOf(searchText) > -1) { + item.style.display = ""; + } else { + item.style.display = "none"; + } + } + } + + // Processes selection changes + function selectionChange(evt) { + var i, + item, + checkbox = evt && evt.target || allCheckbox, + modulesList = dropDownList.getElementsByTagName("input"), + selectedNames = []; + + toggleClass(checkbox.parentNode, "checked", checkbox.checked); + + dirty = false; + if (checkbox.checked && checkbox !== allCheckbox) { + allCheckbox.checked = false; + removeClass(allCheckbox.parentNode, "checked"); + } + for (i = 0; i < modulesList.length; i++) { + item = modulesList[i]; + if (!evt) { + toggleClass(item.parentNode, "checked", item.checked); + } else if (checkbox === allCheckbox && checkbox.checked) { + item.checked = false; + removeClass(item.parentNode, "checked"); + } + dirty = dirty || item.checked !== item.defaultChecked; + if (item.checked) { + selectedNames.push(item.parentNode.textContent); + } + } + + commit.style.display = reset.style.display = dirty ? "" : "none"; + moduleSearch.placeholder = selectedNames.join(", ") || allCheckbox.parentNode.textContent; + moduleSearch.title = "Type to filter list. Current selection:\n" + (selectedNames.join("\n") || allCheckbox.parentNode.textContent); + } + + return moduleFilter; + } + + function appendToolbar() { + var toolbar = id("qunit-testrunner-toolbar"); + + if (toolbar) { + toolbar.appendChild(toolbarUrlConfigContainer()); + toolbar.appendChild(toolbarModuleFilter()); + toolbar.appendChild(toolbarLooseFilter()); + toolbar.appendChild(document$$1.createElement("div")).className = "clearfix"; + } + } + + function appendHeader() { + var header = id("qunit-header"); + + if (header) { + header.innerHTML = "
    " + header.innerHTML + " "; + } + } + + function appendBanner() { + var banner = id("qunit-banner"); + + if (banner) { + banner.className = ""; + } + } + + function appendTestResults() { + var tests = id("qunit-tests"), + result = id("qunit-testresult"), + controls; + + if (result) { + result.parentNode.removeChild(result); + } + + if (tests) { + tests.innerHTML = ""; + result = document$$1.createElement("p"); + result.id = "qunit-testresult"; + result.className = "result"; + tests.parentNode.insertBefore(result, tests); + result.innerHTML = "
    Running...
     
    " + "
    " + "
    "; + controls = id("qunit-testresult-controls"); + } + + if (controls) { + controls.appendChild(abortTestsButton()); + } + } + + function appendFilteredTest() { + var testId = QUnit.config.testId; + if (!testId || testId.length <= 0) { + return ""; + } + return "
    Rerunning selected tests: " + escapeText(testId.join(", ")) + " Run all tests
    "; + } + + function appendUserAgent() { + var userAgent = id("qunit-userAgent"); + + if (userAgent) { + userAgent.innerHTML = ""; + userAgent.appendChild(document$$1.createTextNode("QUnit " + QUnit.version + "; " + navigator.userAgent)); + } + } + + function appendInterface() { + var qunit = id("qunit"); + + if (qunit) { + qunit.innerHTML = "

    " + escapeText(document$$1.title) + "

    " + "

    " + "
    " + appendFilteredTest() + "

    " + "
      "; + } + + appendHeader(); + appendBanner(); + appendTestResults(); + appendUserAgent(); + appendToolbar(); + } + + function appendTestsList(modules) { + var i, l, x, z, test, moduleObj; + + for (i = 0, l = modules.length; i < l; i++) { + moduleObj = modules[i]; + + for (x = 0, z = moduleObj.tests.length; x < z; x++) { + test = moduleObj.tests[x]; + + appendTest(test.name, test.testId, moduleObj.name); + } + } + } + + function appendTest(name, testId, moduleName) { + var title, + rerunTrigger, + testBlock, + assertList, + tests = id("qunit-tests"); + + if (!tests) { + return; + } + + title = document$$1.createElement("strong"); + title.innerHTML = getNameHtml(name, moduleName); + + rerunTrigger = document$$1.createElement("a"); + rerunTrigger.innerHTML = "Rerun"; + rerunTrigger.href = setUrl({ testId: testId }); + + testBlock = document$$1.createElement("li"); + testBlock.appendChild(title); + testBlock.appendChild(rerunTrigger); + testBlock.id = "qunit-test-output-" + testId; + + assertList = document$$1.createElement("ol"); + assertList.className = "qunit-assert-list"; + + testBlock.appendChild(assertList); + + tests.appendChild(testBlock); + } + + // HTML Reporter initialization and load + QUnit.begin(function (details) { + var i, moduleObj, tests; + + // Sort modules by name for the picker + for (i = 0; i < details.modules.length; i++) { + moduleObj = details.modules[i]; + if (moduleObj.name) { + modulesList.push(moduleObj.name); + } + } + modulesList.sort(function (a, b) { + return a.localeCompare(b); + }); + + // Initialize QUnit elements + appendInterface(); + appendTestsList(details.modules); + tests = id("qunit-tests"); + if (tests && config.hidepassed) { + addClass(tests, "hidepass"); + } + }); + + QUnit.done(function (details) { + var banner = id("qunit-banner"), + tests = id("qunit-tests"), + abortButton = id("qunit-abort-tests-button"), + totalTests = stats.passedTests + stats.skippedTests + stats.todoTests + stats.failedTests, + html = [totalTests, " tests completed in ", details.runtime, " milliseconds, with ", stats.failedTests, " failed, ", stats.skippedTests, " skipped, and ", stats.todoTests, " todo.
      ", "", details.passed, " assertions of ", details.total, " passed, ", details.failed, " failed."].join(""), + test, + assertLi, + assertList; + + // Update remaing tests to aborted + if (abortButton && abortButton.disabled) { + html = "Tests aborted after " + details.runtime + " milliseconds."; + + for (var i = 0; i < tests.children.length; i++) { + test = tests.children[i]; + if (test.className === "" || test.className === "running") { + test.className = "aborted"; + assertList = test.getElementsByTagName("ol")[0]; + assertLi = document$$1.createElement("li"); + assertLi.className = "fail"; + assertLi.innerHTML = "Test aborted."; + assertList.appendChild(assertLi); + } + } + } + + if (banner && (!abortButton || abortButton.disabled === false)) { + banner.className = stats.failedTests ? "qunit-fail" : "qunit-pass"; + } + + if (abortButton) { + abortButton.parentNode.removeChild(abortButton); + } + + if (tests) { + id("qunit-testresult-display").innerHTML = html; + } + + if (config.altertitle && document$$1.title) { + + // Show ✖ for good, ✔ for bad suite result in title + // use escape sequences in case file gets loaded with non-utf-8 + // charset + document$$1.title = [stats.failedTests ? "\u2716" : "\u2714", document$$1.title.replace(/^[\u2714\u2716] /i, "")].join(" "); + } + + // Scroll back to top to show results + if (config.scrolltop && window.scrollTo) { + window.scrollTo(0, 0); + } + }); + + function getNameHtml(name, module) { + var nameHtml = ""; + + if (module) { + nameHtml = "" + escapeText(module) + ": "; + } + + nameHtml += "" + escapeText(name) + ""; + + return nameHtml; + } + + QUnit.testStart(function (details) { + var running, testBlock, bad; + + testBlock = id("qunit-test-output-" + details.testId); + if (testBlock) { + testBlock.className = "running"; + } else { + + // Report later registered tests + appendTest(details.name, details.testId, details.module); + } + + running = id("qunit-testresult-display"); + if (running) { + bad = QUnit.config.reorder && details.previousFailure; + + running.innerHTML = [bad ? "Rerunning previously failed test:
      " : "Running:
      ", getNameHtml(details.name, details.module)].join(""); + } + }); + + function stripHtml(string) { + + // Strip tags, html entity and whitespaces + return string.replace(/<\/?[^>]+(>|$)/g, "").replace(/\"/g, "").replace(/\s+/g, ""); + } + + QUnit.log(function (details) { + var assertList, + assertLi, + message, + expected, + actual, + diff, + showDiff = false, + testItem = id("qunit-test-output-" + details.testId); + + if (!testItem) { + return; + } + + message = escapeText(details.message) || (details.result ? "okay" : "failed"); + message = "" + message + ""; + message += "@ " + details.runtime + " ms"; + + // The pushFailure doesn't provide details.expected + // when it calls, it's implicit to also not show expected and diff stuff + // Also, we need to check details.expected existence, as it can exist and be undefined + if (!details.result && hasOwn.call(details, "expected")) { + if (details.negative) { + expected = "NOT " + QUnit.dump.parse(details.expected); + } else { + expected = QUnit.dump.parse(details.expected); + } + + actual = QUnit.dump.parse(details.actual); + message += ""; + + if (actual !== expected) { + + message += ""; + + if (typeof details.actual === "number" && typeof details.expected === "number") { + if (!isNaN(details.actual) && !isNaN(details.expected)) { + showDiff = true; + diff = details.actual - details.expected; + diff = (diff > 0 ? "+" : "") + diff; + } + } else if (typeof details.actual !== "boolean" && typeof details.expected !== "boolean") { + diff = QUnit.diff(expected, actual); + + // don't show diff if there is zero overlap + showDiff = stripHtml(diff).length !== stripHtml(expected).length + stripHtml(actual).length; + } + + if (showDiff) { + message += ""; + } + } else if (expected.indexOf("[object Array]") !== -1 || expected.indexOf("[object Object]") !== -1) { + message += ""; + } else { + message += ""; + } + + if (details.source) { + message += ""; + } + + message += "
      Expected:
      " + escapeText(expected) + "
      Result:
      " + escapeText(actual) + "
      Diff:
      " + diff + "
      Message: " + "Diff suppressed as the depth of object is more than current max depth (" + QUnit.config.maxDepth + ").

      Hint: Use QUnit.dump.maxDepth to " + " run with a higher max depth or " + "Rerun without max depth.

      Message: " + "Diff suppressed as the expected and actual results have an equivalent" + " serialization
      Source:
      " + escapeText(details.source) + "
      "; + + // This occurs when pushFailure is set and we have an extracted stack trace + } else if (!details.result && details.source) { + message += "" + "" + "
      Source:
      " + escapeText(details.source) + "
      "; + } + + assertList = testItem.getElementsByTagName("ol")[0]; + + assertLi = document$$1.createElement("li"); + assertLi.className = details.result ? "pass" : "fail"; + assertLi.innerHTML = message; + assertList.appendChild(assertLi); + }); + + QUnit.testDone(function (details) { + var testTitle, + time, + testItem, + assertList, + good, + bad, + testCounts, + skipped, + sourceName, + tests = id("qunit-tests"); + + if (!tests) { + return; + } + + testItem = id("qunit-test-output-" + details.testId); + + assertList = testItem.getElementsByTagName("ol")[0]; + + good = details.passed; + bad = details.failed; + + // This test passed if it has no unexpected failed assertions + var testPassed = details.failed > 0 ? details.todo : !details.todo; + + if (testPassed) { + + // Collapse the passing tests + addClass(assertList, "qunit-collapsed"); + } else if (config.collapse) { + if (!collapseNext) { + + // Skip collapsing the first failing test + collapseNext = true; + } else { + + // Collapse remaining tests + addClass(assertList, "qunit-collapsed"); + } + } + + // The testItem.firstChild is the test name + testTitle = testItem.firstChild; + + testCounts = bad ? "" + bad + ", " + "" + good + ", " : ""; + + testTitle.innerHTML += " (" + testCounts + details.assertions.length + ")"; + + if (details.skipped) { + stats.skippedTests++; + + testItem.className = "skipped"; + skipped = document$$1.createElement("em"); + skipped.className = "qunit-skipped-label"; + skipped.innerHTML = "skipped"; + testItem.insertBefore(skipped, testTitle); + } else { + addEvent(testTitle, "click", function () { + toggleClass(assertList, "qunit-collapsed"); + }); + + testItem.className = testPassed ? "pass" : "fail"; + + if (details.todo) { + var todoLabel = document$$1.createElement("em"); + todoLabel.className = "qunit-todo-label"; + todoLabel.innerHTML = "todo"; + testItem.className += " todo"; + testItem.insertBefore(todoLabel, testTitle); + } + + time = document$$1.createElement("span"); + time.className = "runtime"; + time.innerHTML = details.runtime + " ms"; + testItem.insertBefore(time, assertList); + + if (!testPassed) { + stats.failedTests++; + } else if (details.todo) { + stats.todoTests++; + } else { + stats.passedTests++; + } + } + + // Show the source of the test when showing assertions + if (details.source) { + sourceName = document$$1.createElement("p"); + sourceName.innerHTML = "Source: " + details.source; + addClass(sourceName, "qunit-source"); + if (testPassed) { + addClass(sourceName, "qunit-collapsed"); + } + addEvent(testTitle, "click", function () { + toggleClass(sourceName, "qunit-collapsed"); + }); + testItem.appendChild(sourceName); + } + }); + + // Avoid readyState issue with phantomjs + // Ref: #818 + var notPhantom = function (p) { + return !(p && p.version && p.version.major > 0); + }(window.phantom); + + if (notPhantom && document$$1.readyState === "complete") { + QUnit.load(); + } else { + addEvent(window, "load", QUnit.load); + } + + // Wrap window.onerror. We will call the original window.onerror to see if + // the existing handler fully handles the error; if not, we will call the + // QUnit.onError function. + var originalWindowOnError = window.onerror; + + // Cover uncaught exceptions + // Returning true will suppress the default browser handler, + // returning false will let it run. + window.onerror = function (message, fileName, lineNumber) { + var ret = false; + if (originalWindowOnError) { + for (var _len = arguments.length, args = Array(_len > 3 ? _len - 3 : 0), _key = 3; _key < _len; _key++) { + args[_key - 3] = arguments[_key]; + } + + ret = originalWindowOnError.call.apply(originalWindowOnError, [this, message, fileName, lineNumber].concat(args)); + } + + // Treat return value as window.onerror itself does, + // Only do our handling if not suppressed. + if (ret !== true) { + var error = { + message: message, + fileName: fileName, + lineNumber: lineNumber + }; + + ret = QUnit.onError(error); + } + + return ret; + }; + + // Listen for unhandled rejections, and call QUnit.onUnhandledRejection + window.addEventListener("unhandledrejection", function (event) { + QUnit.onUnhandledRejection(event.reason); + }); + })(); + + /* + * This file is a modified version of google-diff-match-patch's JavaScript implementation + * (https://code.google.com/p/google-diff-match-patch/source/browse/trunk/javascript/diff_match_patch_uncompressed.js), + * modifications are licensed as more fully set forth in LICENSE.txt. + * + * The original source of google-diff-match-patch is attributable and licensed as follows: + * + * Copyright 2006 Google Inc. + * https://code.google.com/p/google-diff-match-patch/ + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * More Info: + * https://code.google.com/p/google-diff-match-patch/ + * + * Usage: QUnit.diff(expected, actual) + * + */ + QUnit.diff = function () { + function DiffMatchPatch() {} + + // DIFF FUNCTIONS + + /** + * The data structure representing a diff is an array of tuples: + * [[DIFF_DELETE, 'Hello'], [DIFF_INSERT, 'Goodbye'], [DIFF_EQUAL, ' world.']] + * which means: delete 'Hello', add 'Goodbye' and keep ' world.' + */ + var DIFF_DELETE = -1, + DIFF_INSERT = 1, + DIFF_EQUAL = 0; + + /** + * Find the differences between two texts. Simplifies the problem by stripping + * any common prefix or suffix off the texts before diffing. + * @param {string} text1 Old string to be diffed. + * @param {string} text2 New string to be diffed. + * @param {boolean=} optChecklines Optional speedup flag. If present and false, + * then don't run a line-level diff first to identify the changed areas. + * Defaults to true, which does a faster, slightly less optimal diff. + * @return {!Array.} Array of diff tuples. + */ + DiffMatchPatch.prototype.DiffMain = function (text1, text2, optChecklines) { + var deadline, checklines, commonlength, commonprefix, commonsuffix, diffs; + + // The diff must be complete in up to 1 second. + deadline = new Date().getTime() + 1000; + + // Check for null inputs. + if (text1 === null || text2 === null) { + throw new Error("Null input. (DiffMain)"); + } + + // Check for equality (speedup). + if (text1 === text2) { + if (text1) { + return [[DIFF_EQUAL, text1]]; + } + return []; + } + + if (typeof optChecklines === "undefined") { + optChecklines = true; + } + + checklines = optChecklines; + + // Trim off common prefix (speedup). + commonlength = this.diffCommonPrefix(text1, text2); + commonprefix = text1.substring(0, commonlength); + text1 = text1.substring(commonlength); + text2 = text2.substring(commonlength); + + // Trim off common suffix (speedup). + commonlength = this.diffCommonSuffix(text1, text2); + commonsuffix = text1.substring(text1.length - commonlength); + text1 = text1.substring(0, text1.length - commonlength); + text2 = text2.substring(0, text2.length - commonlength); + + // Compute the diff on the middle block. + diffs = this.diffCompute(text1, text2, checklines, deadline); + + // Restore the prefix and suffix. + if (commonprefix) { + diffs.unshift([DIFF_EQUAL, commonprefix]); + } + if (commonsuffix) { + diffs.push([DIFF_EQUAL, commonsuffix]); + } + this.diffCleanupMerge(diffs); + return diffs; + }; + + /** + * Reduce the number of edits by eliminating operationally trivial equalities. + * @param {!Array.} diffs Array of diff tuples. + */ + DiffMatchPatch.prototype.diffCleanupEfficiency = function (diffs) { + var changes, equalities, equalitiesLength, lastequality, pointer, preIns, preDel, postIns, postDel; + changes = false; + equalities = []; // Stack of indices where equalities are found. + equalitiesLength = 0; // Keeping our own length var is faster in JS. + /** @type {?string} */ + lastequality = null; + + // Always equal to diffs[equalities[equalitiesLength - 1]][1] + pointer = 0; // Index of current position. + + // Is there an insertion operation before the last equality. + preIns = false; + + // Is there a deletion operation before the last equality. + preDel = false; + + // Is there an insertion operation after the last equality. + postIns = false; + + // Is there a deletion operation after the last equality. + postDel = false; + while (pointer < diffs.length) { + + // Equality found. + if (diffs[pointer][0] === DIFF_EQUAL) { + if (diffs[pointer][1].length < 4 && (postIns || postDel)) { + + // Candidate found. + equalities[equalitiesLength++] = pointer; + preIns = postIns; + preDel = postDel; + lastequality = diffs[pointer][1]; + } else { + + // Not a candidate, and can never become one. + equalitiesLength = 0; + lastequality = null; + } + postIns = postDel = false; + + // An insertion or deletion. + } else { + + if (diffs[pointer][0] === DIFF_DELETE) { + postDel = true; + } else { + postIns = true; + } + + /* + * Five types to be split: + * ABXYCD + * AXCD + * ABXC + * AXCD + * ABXC + */ + if (lastequality && (preIns && preDel && postIns && postDel || lastequality.length < 2 && preIns + preDel + postIns + postDel === 3)) { + + // Duplicate record. + diffs.splice(equalities[equalitiesLength - 1], 0, [DIFF_DELETE, lastequality]); + + // Change second copy to insert. + diffs[equalities[equalitiesLength - 1] + 1][0] = DIFF_INSERT; + equalitiesLength--; // Throw away the equality we just deleted; + lastequality = null; + if (preIns && preDel) { + + // No changes made which could affect previous entry, keep going. + postIns = postDel = true; + equalitiesLength = 0; + } else { + equalitiesLength--; // Throw away the previous equality. + pointer = equalitiesLength > 0 ? equalities[equalitiesLength - 1] : -1; + postIns = postDel = false; + } + changes = true; + } + } + pointer++; + } + + if (changes) { + this.diffCleanupMerge(diffs); + } + }; + + /** + * Convert a diff array into a pretty HTML report. + * @param {!Array.} diffs Array of diff tuples. + * @param {integer} string to be beautified. + * @return {string} HTML representation. + */ + DiffMatchPatch.prototype.diffPrettyHtml = function (diffs) { + var op, + data, + x, + html = []; + for (x = 0; x < diffs.length; x++) { + op = diffs[x][0]; // Operation (insert, delete, equal) + data = diffs[x][1]; // Text of change. + switch (op) { + case DIFF_INSERT: + html[x] = "" + escapeText(data) + ""; + break; + case DIFF_DELETE: + html[x] = "" + escapeText(data) + ""; + break; + case DIFF_EQUAL: + html[x] = "" + escapeText(data) + ""; + break; + } + } + return html.join(""); + }; + + /** + * Determine the common prefix of two strings. + * @param {string} text1 First string. + * @param {string} text2 Second string. + * @return {number} The number of characters common to the start of each + * string. + */ + DiffMatchPatch.prototype.diffCommonPrefix = function (text1, text2) { + var pointermid, pointermax, pointermin, pointerstart; + + // Quick check for common null cases. + if (!text1 || !text2 || text1.charAt(0) !== text2.charAt(0)) { + return 0; + } + + // Binary search. + // Performance analysis: https://neil.fraser.name/news/2007/10/09/ + pointermin = 0; + pointermax = Math.min(text1.length, text2.length); + pointermid = pointermax; + pointerstart = 0; + while (pointermin < pointermid) { + if (text1.substring(pointerstart, pointermid) === text2.substring(pointerstart, pointermid)) { + pointermin = pointermid; + pointerstart = pointermin; + } else { + pointermax = pointermid; + } + pointermid = Math.floor((pointermax - pointermin) / 2 + pointermin); + } + return pointermid; + }; + + /** + * Determine the common suffix of two strings. + * @param {string} text1 First string. + * @param {string} text2 Second string. + * @return {number} The number of characters common to the end of each string. + */ + DiffMatchPatch.prototype.diffCommonSuffix = function (text1, text2) { + var pointermid, pointermax, pointermin, pointerend; + + // Quick check for common null cases. + if (!text1 || !text2 || text1.charAt(text1.length - 1) !== text2.charAt(text2.length - 1)) { + return 0; + } + + // Binary search. + // Performance analysis: https://neil.fraser.name/news/2007/10/09/ + pointermin = 0; + pointermax = Math.min(text1.length, text2.length); + pointermid = pointermax; + pointerend = 0; + while (pointermin < pointermid) { + if (text1.substring(text1.length - pointermid, text1.length - pointerend) === text2.substring(text2.length - pointermid, text2.length - pointerend)) { + pointermin = pointermid; + pointerend = pointermin; + } else { + pointermax = pointermid; + } + pointermid = Math.floor((pointermax - pointermin) / 2 + pointermin); + } + return pointermid; + }; + + /** + * Find the differences between two texts. Assumes that the texts do not + * have any common prefix or suffix. + * @param {string} text1 Old string to be diffed. + * @param {string} text2 New string to be diffed. + * @param {boolean} checklines Speedup flag. If false, then don't run a + * line-level diff first to identify the changed areas. + * If true, then run a faster, slightly less optimal diff. + * @param {number} deadline Time when the diff should be complete by. + * @return {!Array.} Array of diff tuples. + * @private + */ + DiffMatchPatch.prototype.diffCompute = function (text1, text2, checklines, deadline) { + var diffs, longtext, shorttext, i, hm, text1A, text2A, text1B, text2B, midCommon, diffsA, diffsB; + + if (!text1) { + + // Just add some text (speedup). + return [[DIFF_INSERT, text2]]; + } + + if (!text2) { + + // Just delete some text (speedup). + return [[DIFF_DELETE, text1]]; + } + + longtext = text1.length > text2.length ? text1 : text2; + shorttext = text1.length > text2.length ? text2 : text1; + i = longtext.indexOf(shorttext); + if (i !== -1) { + + // Shorter text is inside the longer text (speedup). + diffs = [[DIFF_INSERT, longtext.substring(0, i)], [DIFF_EQUAL, shorttext], [DIFF_INSERT, longtext.substring(i + shorttext.length)]]; + + // Swap insertions for deletions if diff is reversed. + if (text1.length > text2.length) { + diffs[0][0] = diffs[2][0] = DIFF_DELETE; + } + return diffs; + } + + if (shorttext.length === 1) { + + // Single character string. + // After the previous speedup, the character can't be an equality. + return [[DIFF_DELETE, text1], [DIFF_INSERT, text2]]; + } + + // Check to see if the problem can be split in two. + hm = this.diffHalfMatch(text1, text2); + if (hm) { + + // A half-match was found, sort out the return data. + text1A = hm[0]; + text1B = hm[1]; + text2A = hm[2]; + text2B = hm[3]; + midCommon = hm[4]; + + // Send both pairs off for separate processing. + diffsA = this.DiffMain(text1A, text2A, checklines, deadline); + diffsB = this.DiffMain(text1B, text2B, checklines, deadline); + + // Merge the results. + return diffsA.concat([[DIFF_EQUAL, midCommon]], diffsB); + } + + if (checklines && text1.length > 100 && text2.length > 100) { + return this.diffLineMode(text1, text2, deadline); + } + + return this.diffBisect(text1, text2, deadline); + }; + + /** + * Do the two texts share a substring which is at least half the length of the + * longer text? + * This speedup can produce non-minimal diffs. + * @param {string} text1 First string. + * @param {string} text2 Second string. + * @return {Array.} Five element Array, containing the prefix of + * text1, the suffix of text1, the prefix of text2, the suffix of + * text2 and the common middle. Or null if there was no match. + * @private + */ + DiffMatchPatch.prototype.diffHalfMatch = function (text1, text2) { + var longtext, shorttext, dmp, text1A, text2B, text2A, text1B, midCommon, hm1, hm2, hm; + + longtext = text1.length > text2.length ? text1 : text2; + shorttext = text1.length > text2.length ? text2 : text1; + if (longtext.length < 4 || shorttext.length * 2 < longtext.length) { + return null; // Pointless. + } + dmp = this; // 'this' becomes 'window' in a closure. + + /** + * Does a substring of shorttext exist within longtext such that the substring + * is at least half the length of longtext? + * Closure, but does not reference any external variables. + * @param {string} longtext Longer string. + * @param {string} shorttext Shorter string. + * @param {number} i Start index of quarter length substring within longtext. + * @return {Array.} Five element Array, containing the prefix of + * longtext, the suffix of longtext, the prefix of shorttext, the suffix + * of shorttext and the common middle. Or null if there was no match. + * @private + */ + function diffHalfMatchI(longtext, shorttext, i) { + var seed, j, bestCommon, prefixLength, suffixLength, bestLongtextA, bestLongtextB, bestShorttextA, bestShorttextB; + + // Start with a 1/4 length substring at position i as a seed. + seed = longtext.substring(i, i + Math.floor(longtext.length / 4)); + j = -1; + bestCommon = ""; + while ((j = shorttext.indexOf(seed, j + 1)) !== -1) { + prefixLength = dmp.diffCommonPrefix(longtext.substring(i), shorttext.substring(j)); + suffixLength = dmp.diffCommonSuffix(longtext.substring(0, i), shorttext.substring(0, j)); + if (bestCommon.length < suffixLength + prefixLength) { + bestCommon = shorttext.substring(j - suffixLength, j) + shorttext.substring(j, j + prefixLength); + bestLongtextA = longtext.substring(0, i - suffixLength); + bestLongtextB = longtext.substring(i + prefixLength); + bestShorttextA = shorttext.substring(0, j - suffixLength); + bestShorttextB = shorttext.substring(j + prefixLength); + } + } + if (bestCommon.length * 2 >= longtext.length) { + return [bestLongtextA, bestLongtextB, bestShorttextA, bestShorttextB, bestCommon]; + } else { + return null; + } + } + + // First check if the second quarter is the seed for a half-match. + hm1 = diffHalfMatchI(longtext, shorttext, Math.ceil(longtext.length / 4)); + + // Check again based on the third quarter. + hm2 = diffHalfMatchI(longtext, shorttext, Math.ceil(longtext.length / 2)); + if (!hm1 && !hm2) { + return null; + } else if (!hm2) { + hm = hm1; + } else if (!hm1) { + hm = hm2; + } else { + + // Both matched. Select the longest. + hm = hm1[4].length > hm2[4].length ? hm1 : hm2; + } + + // A half-match was found, sort out the return data. + if (text1.length > text2.length) { + text1A = hm[0]; + text1B = hm[1]; + text2A = hm[2]; + text2B = hm[3]; + } else { + text2A = hm[0]; + text2B = hm[1]; + text1A = hm[2]; + text1B = hm[3]; + } + midCommon = hm[4]; + return [text1A, text1B, text2A, text2B, midCommon]; + }; + + /** + * Do a quick line-level diff on both strings, then rediff the parts for + * greater accuracy. + * This speedup can produce non-minimal diffs. + * @param {string} text1 Old string to be diffed. + * @param {string} text2 New string to be diffed. + * @param {number} deadline Time when the diff should be complete by. + * @return {!Array.} Array of diff tuples. + * @private + */ + DiffMatchPatch.prototype.diffLineMode = function (text1, text2, deadline) { + var a, diffs, linearray, pointer, countInsert, countDelete, textInsert, textDelete, j; + + // Scan the text on a line-by-line basis first. + a = this.diffLinesToChars(text1, text2); + text1 = a.chars1; + text2 = a.chars2; + linearray = a.lineArray; + + diffs = this.DiffMain(text1, text2, false, deadline); + + // Convert the diff back to original text. + this.diffCharsToLines(diffs, linearray); + + // Eliminate freak matches (e.g. blank lines) + this.diffCleanupSemantic(diffs); + + // Rediff any replacement blocks, this time character-by-character. + // Add a dummy entry at the end. + diffs.push([DIFF_EQUAL, ""]); + pointer = 0; + countDelete = 0; + countInsert = 0; + textDelete = ""; + textInsert = ""; + while (pointer < diffs.length) { + switch (diffs[pointer][0]) { + case DIFF_INSERT: + countInsert++; + textInsert += diffs[pointer][1]; + break; + case DIFF_DELETE: + countDelete++; + textDelete += diffs[pointer][1]; + break; + case DIFF_EQUAL: + + // Upon reaching an equality, check for prior redundancies. + if (countDelete >= 1 && countInsert >= 1) { + + // Delete the offending records and add the merged ones. + diffs.splice(pointer - countDelete - countInsert, countDelete + countInsert); + pointer = pointer - countDelete - countInsert; + a = this.DiffMain(textDelete, textInsert, false, deadline); + for (j = a.length - 1; j >= 0; j--) { + diffs.splice(pointer, 0, a[j]); + } + pointer = pointer + a.length; + } + countInsert = 0; + countDelete = 0; + textDelete = ""; + textInsert = ""; + break; + } + pointer++; + } + diffs.pop(); // Remove the dummy entry at the end. + + return diffs; + }; + + /** + * Find the 'middle snake' of a diff, split the problem in two + * and return the recursively constructed diff. + * See Myers 1986 paper: An O(ND) Difference Algorithm and Its Variations. + * @param {string} text1 Old string to be diffed. + * @param {string} text2 New string to be diffed. + * @param {number} deadline Time at which to bail if not yet complete. + * @return {!Array.} Array of diff tuples. + * @private + */ + DiffMatchPatch.prototype.diffBisect = function (text1, text2, deadline) { + var text1Length, text2Length, maxD, vOffset, vLength, v1, v2, x, delta, front, k1start, k1end, k2start, k2end, k2Offset, k1Offset, x1, x2, y1, y2, d, k1, k2; + + // Cache the text lengths to prevent multiple calls. + text1Length = text1.length; + text2Length = text2.length; + maxD = Math.ceil((text1Length + text2Length) / 2); + vOffset = maxD; + vLength = 2 * maxD; + v1 = new Array(vLength); + v2 = new Array(vLength); + + // Setting all elements to -1 is faster in Chrome & Firefox than mixing + // integers and undefined. + for (x = 0; x < vLength; x++) { + v1[x] = -1; + v2[x] = -1; + } + v1[vOffset + 1] = 0; + v2[vOffset + 1] = 0; + delta = text1Length - text2Length; + + // If the total number of characters is odd, then the front path will collide + // with the reverse path. + front = delta % 2 !== 0; + + // Offsets for start and end of k loop. + // Prevents mapping of space beyond the grid. + k1start = 0; + k1end = 0; + k2start = 0; + k2end = 0; + for (d = 0; d < maxD; d++) { + + // Bail out if deadline is reached. + if (new Date().getTime() > deadline) { + break; + } + + // Walk the front path one step. + for (k1 = -d + k1start; k1 <= d - k1end; k1 += 2) { + k1Offset = vOffset + k1; + if (k1 === -d || k1 !== d && v1[k1Offset - 1] < v1[k1Offset + 1]) { + x1 = v1[k1Offset + 1]; + } else { + x1 = v1[k1Offset - 1] + 1; + } + y1 = x1 - k1; + while (x1 < text1Length && y1 < text2Length && text1.charAt(x1) === text2.charAt(y1)) { + x1++; + y1++; + } + v1[k1Offset] = x1; + if (x1 > text1Length) { + + // Ran off the right of the graph. + k1end += 2; + } else if (y1 > text2Length) { + + // Ran off the bottom of the graph. + k1start += 2; + } else if (front) { + k2Offset = vOffset + delta - k1; + if (k2Offset >= 0 && k2Offset < vLength && v2[k2Offset] !== -1) { + + // Mirror x2 onto top-left coordinate system. + x2 = text1Length - v2[k2Offset]; + if (x1 >= x2) { + + // Overlap detected. + return this.diffBisectSplit(text1, text2, x1, y1, deadline); + } + } + } + } + + // Walk the reverse path one step. + for (k2 = -d + k2start; k2 <= d - k2end; k2 += 2) { + k2Offset = vOffset + k2; + if (k2 === -d || k2 !== d && v2[k2Offset - 1] < v2[k2Offset + 1]) { + x2 = v2[k2Offset + 1]; + } else { + x2 = v2[k2Offset - 1] + 1; + } + y2 = x2 - k2; + while (x2 < text1Length && y2 < text2Length && text1.charAt(text1Length - x2 - 1) === text2.charAt(text2Length - y2 - 1)) { + x2++; + y2++; + } + v2[k2Offset] = x2; + if (x2 > text1Length) { + + // Ran off the left of the graph. + k2end += 2; + } else if (y2 > text2Length) { + + // Ran off the top of the graph. + k2start += 2; + } else if (!front) { + k1Offset = vOffset + delta - k2; + if (k1Offset >= 0 && k1Offset < vLength && v1[k1Offset] !== -1) { + x1 = v1[k1Offset]; + y1 = vOffset + x1 - k1Offset; + + // Mirror x2 onto top-left coordinate system. + x2 = text1Length - x2; + if (x1 >= x2) { + + // Overlap detected. + return this.diffBisectSplit(text1, text2, x1, y1, deadline); + } + } + } + } + } + + // Diff took too long and hit the deadline or + // number of diffs equals number of characters, no commonality at all. + return [[DIFF_DELETE, text1], [DIFF_INSERT, text2]]; + }; + + /** + * Given the location of the 'middle snake', split the diff in two parts + * and recurse. + * @param {string} text1 Old string to be diffed. + * @param {string} text2 New string to be diffed. + * @param {number} x Index of split point in text1. + * @param {number} y Index of split point in text2. + * @param {number} deadline Time at which to bail if not yet complete. + * @return {!Array.} Array of diff tuples. + * @private + */ + DiffMatchPatch.prototype.diffBisectSplit = function (text1, text2, x, y, deadline) { + var text1a, text1b, text2a, text2b, diffs, diffsb; + text1a = text1.substring(0, x); + text2a = text2.substring(0, y); + text1b = text1.substring(x); + text2b = text2.substring(y); + + // Compute both diffs serially. + diffs = this.DiffMain(text1a, text2a, false, deadline); + diffsb = this.DiffMain(text1b, text2b, false, deadline); + + return diffs.concat(diffsb); + }; + + /** + * Reduce the number of edits by eliminating semantically trivial equalities. + * @param {!Array.} diffs Array of diff tuples. + */ + DiffMatchPatch.prototype.diffCleanupSemantic = function (diffs) { + var changes, equalities, equalitiesLength, lastequality, pointer, lengthInsertions2, lengthDeletions2, lengthInsertions1, lengthDeletions1, deletion, insertion, overlapLength1, overlapLength2; + changes = false; + equalities = []; // Stack of indices where equalities are found. + equalitiesLength = 0; // Keeping our own length var is faster in JS. + /** @type {?string} */ + lastequality = null; + + // Always equal to diffs[equalities[equalitiesLength - 1]][1] + pointer = 0; // Index of current position. + + // Number of characters that changed prior to the equality. + lengthInsertions1 = 0; + lengthDeletions1 = 0; + + // Number of characters that changed after the equality. + lengthInsertions2 = 0; + lengthDeletions2 = 0; + while (pointer < diffs.length) { + if (diffs[pointer][0] === DIFF_EQUAL) { + // Equality found. + equalities[equalitiesLength++] = pointer; + lengthInsertions1 = lengthInsertions2; + lengthDeletions1 = lengthDeletions2; + lengthInsertions2 = 0; + lengthDeletions2 = 0; + lastequality = diffs[pointer][1]; + } else { + // An insertion or deletion. + if (diffs[pointer][0] === DIFF_INSERT) { + lengthInsertions2 += diffs[pointer][1].length; + } else { + lengthDeletions2 += diffs[pointer][1].length; + } + + // Eliminate an equality that is smaller or equal to the edits on both + // sides of it. + if (lastequality && lastequality.length <= Math.max(lengthInsertions1, lengthDeletions1) && lastequality.length <= Math.max(lengthInsertions2, lengthDeletions2)) { + + // Duplicate record. + diffs.splice(equalities[equalitiesLength - 1], 0, [DIFF_DELETE, lastequality]); + + // Change second copy to insert. + diffs[equalities[equalitiesLength - 1] + 1][0] = DIFF_INSERT; + + // Throw away the equality we just deleted. + equalitiesLength--; + + // Throw away the previous equality (it needs to be reevaluated). + equalitiesLength--; + pointer = equalitiesLength > 0 ? equalities[equalitiesLength - 1] : -1; + + // Reset the counters. + lengthInsertions1 = 0; + lengthDeletions1 = 0; + lengthInsertions2 = 0; + lengthDeletions2 = 0; + lastequality = null; + changes = true; + } + } + pointer++; + } + + // Normalize the diff. + if (changes) { + this.diffCleanupMerge(diffs); + } + + // Find any overlaps between deletions and insertions. + // e.g: abcxxxxxxdef + // -> abcxxxdef + // e.g: xxxabcdefxxx + // -> defxxxabc + // Only extract an overlap if it is as big as the edit ahead or behind it. + pointer = 1; + while (pointer < diffs.length) { + if (diffs[pointer - 1][0] === DIFF_DELETE && diffs[pointer][0] === DIFF_INSERT) { + deletion = diffs[pointer - 1][1]; + insertion = diffs[pointer][1]; + overlapLength1 = this.diffCommonOverlap(deletion, insertion); + overlapLength2 = this.diffCommonOverlap(insertion, deletion); + if (overlapLength1 >= overlapLength2) { + if (overlapLength1 >= deletion.length / 2 || overlapLength1 >= insertion.length / 2) { + + // Overlap found. Insert an equality and trim the surrounding edits. + diffs.splice(pointer, 0, [DIFF_EQUAL, insertion.substring(0, overlapLength1)]); + diffs[pointer - 1][1] = deletion.substring(0, deletion.length - overlapLength1); + diffs[pointer + 1][1] = insertion.substring(overlapLength1); + pointer++; + } + } else { + if (overlapLength2 >= deletion.length / 2 || overlapLength2 >= insertion.length / 2) { + + // Reverse overlap found. + // Insert an equality and swap and trim the surrounding edits. + diffs.splice(pointer, 0, [DIFF_EQUAL, deletion.substring(0, overlapLength2)]); + + diffs[pointer - 1][0] = DIFF_INSERT; + diffs[pointer - 1][1] = insertion.substring(0, insertion.length - overlapLength2); + diffs[pointer + 1][0] = DIFF_DELETE; + diffs[pointer + 1][1] = deletion.substring(overlapLength2); + pointer++; + } + } + pointer++; + } + pointer++; + } + }; + + /** + * Determine if the suffix of one string is the prefix of another. + * @param {string} text1 First string. + * @param {string} text2 Second string. + * @return {number} The number of characters common to the end of the first + * string and the start of the second string. + * @private + */ + DiffMatchPatch.prototype.diffCommonOverlap = function (text1, text2) { + var text1Length, text2Length, textLength, best, length, pattern, found; + + // Cache the text lengths to prevent multiple calls. + text1Length = text1.length; + text2Length = text2.length; + + // Eliminate the null case. + if (text1Length === 0 || text2Length === 0) { + return 0; + } + + // Truncate the longer string. + if (text1Length > text2Length) { + text1 = text1.substring(text1Length - text2Length); + } else if (text1Length < text2Length) { + text2 = text2.substring(0, text1Length); + } + textLength = Math.min(text1Length, text2Length); + + // Quick check for the worst case. + if (text1 === text2) { + return textLength; + } + + // Start by looking for a single character match + // and increase length until no match is found. + // Performance analysis: https://neil.fraser.name/news/2010/11/04/ + best = 0; + length = 1; + while (true) { + pattern = text1.substring(textLength - length); + found = text2.indexOf(pattern); + if (found === -1) { + return best; + } + length += found; + if (found === 0 || text1.substring(textLength - length) === text2.substring(0, length)) { + best = length; + length++; + } + } + }; + + /** + * Split two texts into an array of strings. Reduce the texts to a string of + * hashes where each Unicode character represents one line. + * @param {string} text1 First string. + * @param {string} text2 Second string. + * @return {{chars1: string, chars2: string, lineArray: !Array.}} + * An object containing the encoded text1, the encoded text2 and + * the array of unique strings. + * The zeroth element of the array of unique strings is intentionally blank. + * @private + */ + DiffMatchPatch.prototype.diffLinesToChars = function (text1, text2) { + var lineArray, lineHash, chars1, chars2; + lineArray = []; // E.g. lineArray[4] === 'Hello\n' + lineHash = {}; // E.g. lineHash['Hello\n'] === 4 + + // '\x00' is a valid character, but various debuggers don't like it. + // So we'll insert a junk entry to avoid generating a null character. + lineArray[0] = ""; + + /** + * Split a text into an array of strings. Reduce the texts to a string of + * hashes where each Unicode character represents one line. + * Modifies linearray and linehash through being a closure. + * @param {string} text String to encode. + * @return {string} Encoded string. + * @private + */ + function diffLinesToCharsMunge(text) { + var chars, lineStart, lineEnd, lineArrayLength, line; + chars = ""; + + // Walk the text, pulling out a substring for each line. + // text.split('\n') would would temporarily double our memory footprint. + // Modifying text would create many large strings to garbage collect. + lineStart = 0; + lineEnd = -1; + + // Keeping our own length variable is faster than looking it up. + lineArrayLength = lineArray.length; + while (lineEnd < text.length - 1) { + lineEnd = text.indexOf("\n", lineStart); + if (lineEnd === -1) { + lineEnd = text.length - 1; + } + line = text.substring(lineStart, lineEnd + 1); + lineStart = lineEnd + 1; + + var lineHashExists = lineHash.hasOwnProperty ? lineHash.hasOwnProperty(line) : lineHash[line] !== undefined; + + if (lineHashExists) { + chars += String.fromCharCode(lineHash[line]); + } else { + chars += String.fromCharCode(lineArrayLength); + lineHash[line] = lineArrayLength; + lineArray[lineArrayLength++] = line; + } + } + return chars; + } + + chars1 = diffLinesToCharsMunge(text1); + chars2 = diffLinesToCharsMunge(text2); + return { + chars1: chars1, + chars2: chars2, + lineArray: lineArray + }; + }; + + /** + * Rehydrate the text in a diff from a string of line hashes to real lines of + * text. + * @param {!Array.} diffs Array of diff tuples. + * @param {!Array.} lineArray Array of unique strings. + * @private + */ + DiffMatchPatch.prototype.diffCharsToLines = function (diffs, lineArray) { + var x, chars, text, y; + for (x = 0; x < diffs.length; x++) { + chars = diffs[x][1]; + text = []; + for (y = 0; y < chars.length; y++) { + text[y] = lineArray[chars.charCodeAt(y)]; + } + diffs[x][1] = text.join(""); + } + }; + + /** + * Reorder and merge like edit sections. Merge equalities. + * Any edit section can move as long as it doesn't cross an equality. + * @param {!Array.} diffs Array of diff tuples. + */ + DiffMatchPatch.prototype.diffCleanupMerge = function (diffs) { + var pointer, countDelete, countInsert, textInsert, textDelete, commonlength, changes, diffPointer, position; + diffs.push([DIFF_EQUAL, ""]); // Add a dummy entry at the end. + pointer = 0; + countDelete = 0; + countInsert = 0; + textDelete = ""; + textInsert = ""; + + while (pointer < diffs.length) { + switch (diffs[pointer][0]) { + case DIFF_INSERT: + countInsert++; + textInsert += diffs[pointer][1]; + pointer++; + break; + case DIFF_DELETE: + countDelete++; + textDelete += diffs[pointer][1]; + pointer++; + break; + case DIFF_EQUAL: + + // Upon reaching an equality, check for prior redundancies. + if (countDelete + countInsert > 1) { + if (countDelete !== 0 && countInsert !== 0) { + + // Factor out any common prefixes. + commonlength = this.diffCommonPrefix(textInsert, textDelete); + if (commonlength !== 0) { + if (pointer - countDelete - countInsert > 0 && diffs[pointer - countDelete - countInsert - 1][0] === DIFF_EQUAL) { + diffs[pointer - countDelete - countInsert - 1][1] += textInsert.substring(0, commonlength); + } else { + diffs.splice(0, 0, [DIFF_EQUAL, textInsert.substring(0, commonlength)]); + pointer++; + } + textInsert = textInsert.substring(commonlength); + textDelete = textDelete.substring(commonlength); + } + + // Factor out any common suffixies. + commonlength = this.diffCommonSuffix(textInsert, textDelete); + if (commonlength !== 0) { + diffs[pointer][1] = textInsert.substring(textInsert.length - commonlength) + diffs[pointer][1]; + textInsert = textInsert.substring(0, textInsert.length - commonlength); + textDelete = textDelete.substring(0, textDelete.length - commonlength); + } + } + + // Delete the offending records and add the merged ones. + if (countDelete === 0) { + diffs.splice(pointer - countInsert, countDelete + countInsert, [DIFF_INSERT, textInsert]); + } else if (countInsert === 0) { + diffs.splice(pointer - countDelete, countDelete + countInsert, [DIFF_DELETE, textDelete]); + } else { + diffs.splice(pointer - countDelete - countInsert, countDelete + countInsert, [DIFF_DELETE, textDelete], [DIFF_INSERT, textInsert]); + } + pointer = pointer - countDelete - countInsert + (countDelete ? 1 : 0) + (countInsert ? 1 : 0) + 1; + } else if (pointer !== 0 && diffs[pointer - 1][0] === DIFF_EQUAL) { + + // Merge this equality with the previous one. + diffs[pointer - 1][1] += diffs[pointer][1]; + diffs.splice(pointer, 1); + } else { + pointer++; + } + countInsert = 0; + countDelete = 0; + textDelete = ""; + textInsert = ""; + break; + } + } + if (diffs[diffs.length - 1][1] === "") { + diffs.pop(); // Remove the dummy entry at the end. + } + + // Second pass: look for single edits surrounded on both sides by equalities + // which can be shifted sideways to eliminate an equality. + // e.g: ABAC -> ABAC + changes = false; + pointer = 1; + + // Intentionally ignore the first and last element (don't need checking). + while (pointer < diffs.length - 1) { + if (diffs[pointer - 1][0] === DIFF_EQUAL && diffs[pointer + 1][0] === DIFF_EQUAL) { + + diffPointer = diffs[pointer][1]; + position = diffPointer.substring(diffPointer.length - diffs[pointer - 1][1].length); + + // This is a single edit surrounded by equalities. + if (position === diffs[pointer - 1][1]) { + + // Shift the edit over the previous equality. + diffs[pointer][1] = diffs[pointer - 1][1] + diffs[pointer][1].substring(0, diffs[pointer][1].length - diffs[pointer - 1][1].length); + diffs[pointer + 1][1] = diffs[pointer - 1][1] + diffs[pointer + 1][1]; + diffs.splice(pointer - 1, 1); + changes = true; + } else if (diffPointer.substring(0, diffs[pointer + 1][1].length) === diffs[pointer + 1][1]) { + + // Shift the edit over the next equality. + diffs[pointer - 1][1] += diffs[pointer + 1][1]; + diffs[pointer][1] = diffs[pointer][1].substring(diffs[pointer + 1][1].length) + diffs[pointer + 1][1]; + diffs.splice(pointer + 1, 1); + changes = true; + } + } + pointer++; + } + + // If shifts were made, the diff needs reordering and another shift sweep. + if (changes) { + this.diffCleanupMerge(diffs); + } + }; + + return function (o, n) { + var diff, output, text; + diff = new DiffMatchPatch(); + output = diff.DiffMain(o, n); + diff.diffCleanupEfficiency(output); + text = diff.diffPrettyHtml(output); + + return text; + }; + }(); + +}((function() { return this; }()))); diff --git a/node_modules/reveal.js/test/simple.md b/node_modules/reveal.js/test/simple.md new file mode 100644 index 0000000..c72a440 --- /dev/null +++ b/node_modules/reveal.js/test/simple.md @@ -0,0 +1,12 @@ +## Slide 1.1 + +```js +var a = 1; +``` + + +## Slide 1.2 + + + +## Slide 2 diff --git a/node_modules/reveal.js/test/test-markdown-element-attributes.html b/node_modules/reveal.js/test/test-markdown-element-attributes.html new file mode 100644 index 0000000..4a09272 --- /dev/null +++ b/node_modules/reveal.js/test/test-markdown-element-attributes.html @@ -0,0 +1,134 @@ + + + + + + + reveal.js - Test Markdown Element Attributes + + + + + + + +
      +
      + + + + + + + + + + + + + diff --git a/node_modules/reveal.js/test/test-markdown-element-attributes.js b/node_modules/reveal.js/test/test-markdown-element-attributes.js new file mode 100644 index 0000000..fc87b7b --- /dev/null +++ b/node_modules/reveal.js/test/test-markdown-element-attributes.js @@ -0,0 +1,44 @@ +Reveal.addEventListener( 'ready', function() { + + QUnit.module( 'Markdown' ); + + QUnit.test( 'Vertical separator', function( assert ) { + assert.strictEqual( document.querySelectorAll( '.reveal .slides>section>section' ).length, 4, 'found four slides' ); + }); + + QUnit.test( 'Attributes on element header in vertical slides', function( assert ) { + assert.strictEqual( document.querySelectorAll( '.reveal .slides section>section h2.fragment.fade-out' ).length, 1, 'found one vertical slide with class fragment.fade-out on header' ); + assert.strictEqual( document.querySelectorAll( '.reveal .slides section>section h2.fragment.shrink' ).length, 1, 'found one vertical slide with class fragment.shrink on header' ); + }); + + QUnit.test( 'Attributes on element paragraphs in vertical slides', function( assert ) { + assert.strictEqual( document.querySelectorAll( '.reveal .slides section>section p.fragment.grow' ).length, 2, 'found a vertical slide with two paragraphs with class fragment.grow' ); + }); + + QUnit.test( 'Attributes on element list items in vertical slides', function( assert ) { + assert.strictEqual( document.querySelectorAll( '.reveal .slides section>section li.fragment.grow' ).length, 3, 'found a vertical slide with three list items with class fragment.grow' ); + }); + + QUnit.test( 'Attributes on element paragraphs in horizontal slides', function( assert ) { + assert.strictEqual( document.querySelectorAll( '.reveal .slides section p.fragment.highlight-red' ).length, 4, 'found a horizontal slide with four paragraphs with class fragment.grow' ); + }); + + QUnit.test( 'Attributes on element list items in horizontal slides', function( assert ) { + assert.strictEqual( document.querySelectorAll( '.reveal .slides section li.fragment.highlight-green' ).length, 5, 'found a horizontal slide with five list items with class fragment.roll-in' ); + }); + + QUnit.test( 'Attributes on element image in horizontal slides', function( assert ) { + assert.strictEqual( document.querySelectorAll( '.reveal .slides section img.reveal.stretch' ).length, 1, 'found a horizontal slide with stretched image, class img.reveal.stretch' ); + }); + + QUnit.test( 'Attributes on elements in vertical slides with default element attribute separator', function( assert ) { + assert.strictEqual( document.querySelectorAll( '.reveal .slides section h2.fragment.highlight-red' ).length, 2, 'found two h2 titles with fragment highlight-red in vertical slides with default element attribute separator' ); + }); + + QUnit.test( 'Attributes on elements in single slides with default element attribute separator', function( assert ) { + assert.strictEqual( document.querySelectorAll( '.reveal .slides section p.fragment.highlight-blue' ).length, 3, 'found three elements with fragment highlight-blue in single slide with default element attribute separator' ); + }); + +} ); + +Reveal.initialize(); diff --git a/node_modules/reveal.js/test/test-markdown-external.html b/node_modules/reveal.js/test/test-markdown-external.html new file mode 100644 index 0000000..d4912b0 --- /dev/null +++ b/node_modules/reveal.js/test/test-markdown-external.html @@ -0,0 +1,36 @@ + + + + + + + reveal.js - Test Markdown + + + + + + + +
      +
      + + + + + + + + + + + + + + diff --git a/node_modules/reveal.js/test/test-markdown-external.js b/node_modules/reveal.js/test/test-markdown-external.js new file mode 100644 index 0000000..f924986 --- /dev/null +++ b/node_modules/reveal.js/test/test-markdown-external.js @@ -0,0 +1,20 @@ +Reveal.addEventListener( 'ready', function() { + + QUnit.module( 'Markdown' ); + + QUnit.test( 'Vertical separator', function( assert ) { + assert.strictEqual( document.querySelectorAll( '.reveal .slides>section>section' ).length, 2, 'found two slides' ); + }); + + QUnit.test( 'Horizontal separator', function( assert ) { + assert.strictEqual( document.querySelectorAll( '.reveal .slides>section' ).length, 2, 'found two slides' ); + }); + + QUnit.test( 'Language highlighter', function( assert ) { + assert.strictEqual( document.querySelectorAll( '.hljs-keyword' ).length, 1, 'got rendered highlight tag.' ); + assert.strictEqual( document.querySelector( '.hljs-keyword' ).innerHTML, 'var', 'the same keyword: var.' ); + }); + +} ); + +Reveal.initialize(); diff --git a/node_modules/reveal.js/test/test-markdown-options.html b/node_modules/reveal.js/test/test-markdown-options.html new file mode 100644 index 0000000..598243a --- /dev/null +++ b/node_modules/reveal.js/test/test-markdown-options.html @@ -0,0 +1,41 @@ + + + + + + + reveal.js - Test Markdown Options + + + + + + + +
      +
      + + + + + + + + + + + diff --git a/node_modules/reveal.js/test/test-markdown-options.js b/node_modules/reveal.js/test/test-markdown-options.js new file mode 100644 index 0000000..ef61659 --- /dev/null +++ b/node_modules/reveal.js/test/test-markdown-options.js @@ -0,0 +1,27 @@ +Reveal.addEventListener( 'ready', function() { + + QUnit.module( 'Markdown' ); + + QUnit.test( 'Options are set', function( assert ) { + assert.strictEqual( marked.defaults.smartypants, true ); + }); + + QUnit.test( 'Smart quotes are activated', function( assert ) { + var text = document.querySelector( '.reveal .slides>section>p' ).textContent; + + assert.strictEqual( /['"]/.test( text ), false ); + assert.strictEqual( /[“”‘’]/.test( text ), true ); + }); + +} ); + +Reveal.initialize({ + dependencies: [ + { src: '../plugin/markdown/marked.js' }, + // Test loading JS files with query strings + { src: '../plugin/markdown/markdown.js?query=string' }, + ], + markdown: { + smartypants: true + } +}); diff --git a/node_modules/reveal.js/test/test-markdown-slide-attributes.html b/node_modules/reveal.js/test/test-markdown-slide-attributes.html new file mode 100644 index 0000000..e90a9cf --- /dev/null +++ b/node_modules/reveal.js/test/test-markdown-slide-attributes.html @@ -0,0 +1,128 @@ + + + + + + + reveal.js - Test Markdown Attributes + + + + + + + +
      +
      + + + + + + + + + + + + + diff --git a/node_modules/reveal.js/test/test-markdown-slide-attributes.js b/node_modules/reveal.js/test/test-markdown-slide-attributes.js new file mode 100644 index 0000000..b44323a --- /dev/null +++ b/node_modules/reveal.js/test/test-markdown-slide-attributes.js @@ -0,0 +1,44 @@ +Reveal.addEventListener( 'ready', function() { + + QUnit.module( 'Markdown' ); + + QUnit.test( 'Vertical separator', function( assert ) { + assert.strictEqual( document.querySelectorAll( '.reveal .slides>section>section' ).length, 6, 'found six vertical slides' ); + }); + + QUnit.test( 'Id on slide', function( assert ) { + assert.strictEqual( document.querySelectorAll( '.reveal .slides>section>section#slide2' ).length, 1, 'found one slide with id slide2' ); + assert.strictEqual( document.querySelectorAll( '.reveal .slides>section>section a[href="#/slide2"]' ).length, 1, 'found one slide with a link to slide2' ); + }); + + QUnit.test( 'data-background attributes', function( assert ) { + assert.strictEqual( document.querySelectorAll( '.reveal .slides>section>section[data-background="#A0C66B"]' ).length, 1, 'found one vertical slide with data-background="#A0C66B"' ); + assert.strictEqual( document.querySelectorAll( '.reveal .slides>section>section[data-background="#ff0000"]' ).length, 1, 'found one vertical slide with data-background="#ff0000"' ); + assert.strictEqual( document.querySelectorAll( '.reveal .slides>section[data-background="#C6916B"]' ).length, 1, 'found one slide with data-background="#C6916B"' ); + }); + + QUnit.test( 'data-transition attributes', function( assert ) { + assert.strictEqual( document.querySelectorAll( '.reveal .slides>section>section[data-transition="zoom"]' ).length, 1, 'found one vertical slide with data-transition="zoom"' ); + assert.strictEqual( document.querySelectorAll( '.reveal .slides>section>section[data-transition="fade"]' ).length, 1, 'found one vertical slide with data-transition="fade"' ); + assert.strictEqual( document.querySelectorAll( '.reveal .slides section [data-transition="zoom"]' ).length, 1, 'found one slide with data-transition="zoom"' ); + }); + + QUnit.test( 'data-background attributes with default separator', function( assert ) { + assert.strictEqual( document.querySelectorAll( '.reveal .slides>section>section[data-background="#A7C66B"]' ).length, 1, 'found one vertical slide with data-background="#A0C66B"' ); + assert.strictEqual( document.querySelectorAll( '.reveal .slides>section>section[data-background="#f70000"]' ).length, 1, 'found one vertical slide with data-background="#ff0000"' ); + assert.strictEqual( document.querySelectorAll( '.reveal .slides>section[data-background="#C7916B"]' ).length, 1, 'found one slide with data-background="#C6916B"' ); + }); + + QUnit.test( 'data-transition attributes with default separator', function( assert ) { + assert.strictEqual( document.querySelectorAll( '.reveal .slides>section>section[data-transition="concave"]' ).length, 1, 'found one vertical slide with data-transition="zoom"' ); + assert.strictEqual( document.querySelectorAll( '.reveal .slides>section>section[data-transition="page"]' ).length, 1, 'found one vertical slide with data-transition="fade"' ); + assert.strictEqual( document.querySelectorAll( '.reveal .slides section [data-transition="concave"]' ).length, 1, 'found one slide with data-transition="zoom"' ); + }); + + QUnit.test( 'data-transition attributes with inline content', function( assert ) { + assert.strictEqual( document.querySelectorAll( '.reveal .slides>section[data-background="#ff0000"]' ).length, 3, 'found three horizontal slides with data-background="#ff0000"' ); + }); + +} ); + +Reveal.initialize(); diff --git a/node_modules/reveal.js/test/test-markdown.html b/node_modules/reveal.js/test/test-markdown.html new file mode 100644 index 0000000..00f7e7a --- /dev/null +++ b/node_modules/reveal.js/test/test-markdown.html @@ -0,0 +1,52 @@ + + + + + + + reveal.js - Test Markdown + + + + + + + +
      +
      + + + + + + + + + + + + + diff --git a/node_modules/reveal.js/test/test-markdown.js b/node_modules/reveal.js/test/test-markdown.js new file mode 100644 index 0000000..5ea8bf2 --- /dev/null +++ b/node_modules/reveal.js/test/test-markdown.js @@ -0,0 +1,11 @@ +Reveal.addEventListener( 'ready', function() { + + QUnit.module( 'Markdown' ); + + QUnit.test( 'Vertical separator', function( assert ) { + assert.strictEqual( document.querySelectorAll( '.reveal .slides>section>section' ).length, 2, 'found two slides' ); + }); + +} ); + +Reveal.initialize(); diff --git a/node_modules/reveal.js/test/test-pdf.html b/node_modules/reveal.js/test/test-pdf.html new file mode 100644 index 0000000..5ab8578 --- /dev/null +++ b/node_modules/reveal.js/test/test-pdf.html @@ -0,0 +1,83 @@ + + + + + + + reveal.js - Test PDF exports + + + + + + + + +
      +
      + + + + + + + + + + + diff --git a/node_modules/reveal.js/test/test-pdf.js b/node_modules/reveal.js/test/test-pdf.js new file mode 100644 index 0000000..1ebf997 --- /dev/null +++ b/node_modules/reveal.js/test/test-pdf.js @@ -0,0 +1,12 @@ +Reveal.addEventListener( 'ready', function() { + + // Only one test for now, we're mainly ensuring that there + // are no execution errors when running PDF mode + + QUnit.test( 'Reveal.isReady', function( assert ) { + assert.strictEqual( Reveal.isReady(), true, 'returns true' ); + }); + +} ); + +Reveal.initialize({ pdf: true }); diff --git a/node_modules/reveal.js/test/test.html b/node_modules/reveal.js/test/test.html new file mode 100644 index 0000000..f0a5050 --- /dev/null +++ b/node_modules/reveal.js/test/test.html @@ -0,0 +1,86 @@ + + + + + + + reveal.js - Tests + + + + + + + +
      +
      + + + + + + + + + + + diff --git a/node_modules/reveal.js/test/test.js b/node_modules/reveal.js/test/test.js new file mode 100644 index 0000000..f8515a0 --- /dev/null +++ b/node_modules/reveal.js/test/test.js @@ -0,0 +1,593 @@ +// These tests expect the DOM to contain a presentation +// with the following slide structure: +// +// 1 +// 2 - Three sub-slides +// 3 - Three fragment elements +// 3 - Two fragments with same data-fragment-index +// 4 + +Reveal.addEventListener( 'ready', function() { + + // --------------------------------------------------------------- + // DOM TESTS + + QUnit.module( 'DOM' ); + + QUnit.test( 'Initial slides classes', function( assert ) { + var horizontalSlides = document.querySelectorAll( '.reveal .slides>section' ) + + assert.strictEqual( document.querySelectorAll( '.reveal .slides section.past' ).length, 0, 'no .past slides' ); + assert.strictEqual( document.querySelectorAll( '.reveal .slides section.present' ).length, 1, 'one .present slide' ); + assert.strictEqual( document.querySelectorAll( '.reveal .slides>section.future' ).length, horizontalSlides.length - 1, 'remaining horizontal slides are .future' ); + + assert.strictEqual( document.querySelectorAll( '.reveal .slides section.stack' ).length, 2, 'two .stacks' ); + + assert.ok( document.querySelectorAll( '.reveal .slides section.stack' )[0].querySelectorAll( '.future' ).length > 0, 'vertical slides are given .future' ); + }); + + // --------------------------------------------------------------- + // API TESTS + + QUnit.module( 'API' ); + + QUnit.test( 'Reveal.isReady', function( assert ) { + assert.strictEqual( Reveal.isReady(), true, 'returns true' ); + }); + + QUnit.test( 'Reveal.isOverview', function( assert ) { + assert.strictEqual( Reveal.isOverview(), false, 'false by default' ); + + Reveal.toggleOverview(); + assert.strictEqual( Reveal.isOverview(), true, 'true after toggling on' ); + + Reveal.toggleOverview(); + assert.strictEqual( Reveal.isOverview(), false, 'false after toggling off' ); + }); + + QUnit.test( 'Reveal.isPaused', function( assert ) { + assert.strictEqual( Reveal.isPaused(), false, 'false by default' ); + + Reveal.togglePause(); + assert.strictEqual( Reveal.isPaused(), true, 'true after pausing' ); + + Reveal.togglePause(); + assert.strictEqual( Reveal.isPaused(), false, 'false after resuming' ); + }); + + QUnit.test( 'Reveal.isFirstSlide', function( assert ) { + Reveal.slide( 0, 0 ); + assert.strictEqual( Reveal.isFirstSlide(), true, 'true after Reveal.slide( 0, 0 )' ); + + Reveal.slide( 1, 0 ); + assert.strictEqual( Reveal.isFirstSlide(), false, 'false after Reveal.slide( 1, 0 )' ); + + Reveal.slide( 0, 0 ); + assert.strictEqual( Reveal.isFirstSlide(), true, 'true after Reveal.slide( 0, 0 )' ); + }); + + QUnit.test( 'Reveal.isFirstSlide after vertical slide', function( assert ) { + Reveal.slide( 1, 1 ); + Reveal.slide( 0, 0 ); + assert.strictEqual( Reveal.isFirstSlide(), true, 'true after Reveal.slide( 1, 1 ) and then Reveal.slide( 0, 0 )' ); + }); + + QUnit.test( 'Reveal.isLastSlide', function( assert ) { + Reveal.slide( 0, 0 ); + assert.strictEqual( Reveal.isLastSlide(), false, 'false after Reveal.slide( 0, 0 )' ); + + var lastSlideIndex = document.querySelectorAll( '.reveal .slides>section' ).length - 1; + + Reveal.slide( lastSlideIndex, 0 ); + assert.strictEqual( Reveal.isLastSlide(), true, 'true after Reveal.slide( '+ lastSlideIndex +', 0 )' ); + + Reveal.slide( 0, 0 ); + assert.strictEqual( Reveal.isLastSlide(), false, 'false after Reveal.slide( 0, 0 )' ); + }); + + QUnit.test( 'Reveal.isLastSlide after vertical slide', function( assert ) { + var lastSlideIndex = document.querySelectorAll( '.reveal .slides>section' ).length - 1; + + Reveal.slide( 1, 1 ); + Reveal.slide( lastSlideIndex ); + assert.strictEqual( Reveal.isLastSlide(), true, 'true after Reveal.slide( 1, 1 ) and then Reveal.slide( '+ lastSlideIndex +', 0 )' ); + }); + + QUnit.test( 'Reveal.getTotalSlides', function( assert ) { + assert.strictEqual( Reveal.getTotalSlides(), 8, 'eight slides in total' ); + }); + + QUnit.test( 'Reveal.getIndices', function( assert ) { + var indices = Reveal.getIndices(); + + assert.ok( indices.hasOwnProperty( 'h' ), 'h exists' ); + assert.ok( indices.hasOwnProperty( 'v' ), 'v exists' ); + assert.ok( indices.hasOwnProperty( 'f' ), 'f exists' ); + + Reveal.slide( 1, 0 ); + assert.strictEqual( Reveal.getIndices().h, 1, 'h 1' ); + assert.strictEqual( Reveal.getIndices().v, 0, 'v 0' ); + + Reveal.slide( 1, 2 ); + assert.strictEqual( Reveal.getIndices().h, 1, 'h 1' ); + assert.strictEqual( Reveal.getIndices().v, 2, 'v 2' ); + + Reveal.slide( 0, 0 ); + assert.strictEqual( Reveal.getIndices().h, 0, 'h 0' ); + assert.strictEqual( Reveal.getIndices().v, 0, 'v 0' ); + }); + + QUnit.test( 'Reveal.getSlide', function( assert ) { + assert.equal( Reveal.getSlide( 0 ), document.querySelector( '.reveal .slides>section:first-child' ), 'gets correct first slide' ); + assert.equal( Reveal.getSlide( 1 ), document.querySelector( '.reveal .slides>section:nth-child(2)' ), 'no v index returns stack' ); + assert.equal( Reveal.getSlide( 1, 0 ), document.querySelector( '.reveal .slides>section:nth-child(2)>section:nth-child(1)' ), 'v index 0 returns first vertical child' ); + assert.equal( Reveal.getSlide( 1, 1 ), document.querySelector( '.reveal .slides>section:nth-child(2)>section:nth-child(2)' ), 'v index 1 returns second vertical child' ); + + assert.strictEqual( Reveal.getSlide( 100 ), undefined, 'undefined when out of horizontal bounds' ); + assert.strictEqual( Reveal.getSlide( 1, 100 ), undefined, 'undefined when out of vertical bounds' ); + }); + + QUnit.test( 'Reveal.getSlideBackground', function( assert ) { + assert.equal( Reveal.getSlideBackground( 0 ), document.querySelector( '.reveal .backgrounds>.slide-background:first-child' ), 'gets correct first background' ); + assert.equal( Reveal.getSlideBackground( 1 ), document.querySelector( '.reveal .backgrounds>.slide-background:nth-child(2)' ), 'no v index returns stack' ); + assert.equal( Reveal.getSlideBackground( 1, 0 ), document.querySelector( '.reveal .backgrounds>.slide-background:nth-child(2) .slide-background:nth-child(2)' ), 'v index 0 returns first vertical child' ); + assert.equal( Reveal.getSlideBackground( 1, 1 ), document.querySelector( '.reveal .backgrounds>.slide-background:nth-child(2) .slide-background:nth-child(3)' ), 'v index 1 returns second vertical child' ); + + assert.strictEqual( Reveal.getSlideBackground( 100 ), undefined, 'undefined when out of horizontal bounds' ); + assert.strictEqual( Reveal.getSlideBackground( 1, 100 ), undefined, 'undefined when out of vertical bounds' ); + }); + + QUnit.test( 'Reveal.getSlideNotes', function( assert ) { + Reveal.slide( 0, 0 ); + assert.ok( Reveal.getSlideNotes() === 'speaker notes 1', 'works with